From: Andrea Amorese Date: Thu, 12 Aug 2021 15:11:38 +0000 (+0200) Subject: Built motion from commit 66c130d4.|2.5.33 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22thisimagedoesnotexist.png/%22javascript:;//%22%7B%7Blicense.fax?a=commitdiff_plain;h=8462b29b4e00d87755383e349a2bb4ebf2d2ef2a;p=motion2.git Built motion from commit 66c130d4.|2.5.33 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index f842e17..10f1b47 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-08-12T14:40:50.132Z", + "time": "2021-08-12T15:04:39.084Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 6a215f7..675d188 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-08-12T14:40:50.132Z", + "time": "2021-08-12T15:04:39.084Z", "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 648d9b6..d009b0d 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 _0xe0b1=['jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','STRING','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','getDataValue','action','integration'];(function(_0x1f75e8,_0x7fa97f){var _0x120699=function(_0x4d817b){while(--_0x4d817b){_0x1f75e8['push'](_0x1f75e8['shift']());}};_0x120699(++_0x7fa97f);}(_0xe0b1,0x95));var _0x1e0b=function(_0x1ad07b,_0x551d55){_0x1ad07b=_0x1ad07b-0x0;var _0x2c447f=_0xe0b1[_0x1ad07b];return _0x2c447f;};'use strict';var Sequelize=require(_0x1e0b('0x0'));module[_0x1e0b('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xe9b311){return this[_0x1e0b('0x2')](_0x1e0b('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x1e0b('0x4'),'motionbar',_0x1e0b('0x5'),'urlForward',_0x1e0b('0x6'),_0x1e0b('0x7'),_0x1e0b('0x8')]],'msg':_0x1e0b('0x9')}},'comment':_0x1e0b('0x9')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x1e0b('0xa')},'data2':{'type':Sequelize[_0x1e0b('0xb')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x1e0b('0xb')](0x1000),'comment':_0x1e0b('0xc')},'data4':{'type':Sequelize[_0x1e0b('0xb')](0x1000)},'data5':{'type':Sequelize[_0x1e0b('0xb')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x1e0b('0xd')]}}; \ No newline at end of file +var _0xc4b0=['contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x4c3296,_0x262566){var _0x5260de=function(_0x2543c6){while(--_0x2543c6){_0x4c3296['push'](_0x4c3296['shift']());}};_0x5260de(++_0x262566);}(_0xc4b0,0x124));var _0x0c4b=function(_0x120123,_0x4eff59){_0x120123=_0x120123-0x0;var _0x3bec4c=_0xc4b0[_0x120123];return _0x3bec4c;};'use strict';var Sequelize=require(_0x0c4b('0x0'));module[_0x0c4b('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xc3e945){return this[_0x0c4b('0x2')](_0x0c4b('0x3'));}},'action':{'type':Sequelize[_0x0c4b('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0c4b('0x5'),_0x0c4b('0x6'),_0x0c4b('0x7'),_0x0c4b('0x8'),_0x0c4b('0x9'),_0x0c4b('0xa'),_0x0c4b('0xb'),_0x0c4b('0xc')]],'msg':_0x0c4b('0xd')}},'comment':_0x0c4b('0xd')},'data1':{'type':Sequelize[_0x0c4b('0x4')](0x1000),'comment':_0x0c4b('0xe')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x0c4b('0x4')](0x1000),'comment':_0x0c4b('0xf')},'data4':{'type':Sequelize[_0x0c4b('0x4')](0x1000)},'data5':{'type':Sequelize[_0x0c4b('0x4')](0x1000)},'data6':{'type':Sequelize[_0x0c4b('0x4')]},'data7':{'type':Sequelize[_0x0c4b('0x10')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 62a7938..eea3cc9 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 _0xe08b=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','count','limit','set','Content-Range','json','apply','reject','save','destroy','sendStatus','error','stack','name','send','body','params','then','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','crypto'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe08b,0x81));var _0xbe08=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0xe08b[_0x2932cf];return _0x1711dd;};'use strict';var emlformat=require(_0xbe08('0x0'));var rimraf=require(_0xbe08('0x1'));var zipdir=require(_0xbe08('0x2'));var jsonpatch=require(_0xbe08('0x3'));var rp=require(_0xbe08('0x4'));var moment=require(_0xbe08('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xbe08('0x6'));var sox=require(_0xbe08('0x7'));var csv=require('to-csv');var ejs=require(_0xbe08('0x8'));var fs=require('fs');var fs_extra=require(_0xbe08('0x9'));var _=require(_0xbe08('0xa'));var squel=require('squel');var crypto=require(_0xbe08('0xb'));var jsforce=require(_0xbe08('0xc'));var deskjs=require(_0xbe08('0xd'));var toCsv=require(_0xbe08('0xe'));var querystring=require(_0xbe08('0xf'));var Papa=require(_0xbe08('0x10'));var Redis=require(_0xbe08('0x11'));var authService=require(_0xbe08('0x12'));var qs=require(_0xbe08('0x13'));var as=require(_0xbe08('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe08('0x15'))(_0xbe08('0x16'));var utils=require('../../config/utils');var config=require(_0xbe08('0x17'));var licenseUtil=require(_0xbe08('0x18'));var db=require(_0xbe08('0x19'))['db'];function respondWithStatusCode(_0x22c97c,_0x5b3135){_0x5b3135=_0x5b3135||0xcc;return function(_0x5e08b4){if(_0x5e08b4){return _0x22c97c['sendStatus'](_0x5b3135);}return _0x22c97c[_0xbe08('0x1a')](_0x5b3135)['end']();};}function respondWithResult(_0x299f0c,_0x102668){_0x102668=_0x102668||0xc8;return function(_0x4aee86){if(_0x4aee86){return _0x299f0c[_0xbe08('0x1a')](_0x102668)['json'](_0x4aee86);}};}function respondWithFilteredResult(_0x2782fd,_0x3d150b){return function(_0x4b53fe){if(_0x4b53fe){var _0x510a06=typeof _0x3d150b['offset']==='undefined'&&typeof _0x3d150b['limit']==='undefined';var _0x4d2394=_0x4b53fe['count'];var _0x5f3763=_0x510a06?0x0:_0x3d150b[_0xbe08('0x1b')];var _0x20a405=_0x510a06?_0x4b53fe[_0xbe08('0x1c')]:_0x3d150b['offset']+_0x3d150b[_0xbe08('0x1d')];var _0x32f0a8;if(_0x20a405>=_0x4d2394){_0x20a405=_0x4d2394;_0x32f0a8=0xc8;}else{_0x32f0a8=0xce;}_0x2782fd[_0xbe08('0x1a')](_0x32f0a8);return _0x2782fd[_0xbe08('0x1e')](_0xbe08('0x1f'),_0x5f3763+'-'+_0x20a405+'/'+_0x4d2394)[_0xbe08('0x20')](_0x4b53fe);}return null;};}function patchUpdates(_0x4af782){return function(_0x14b895){try{jsonpatch[_0xbe08('0x21')](_0x14b895,_0x4af782,!![]);}catch(_0x37a07e){return BPromise[_0xbe08('0x22')](_0x37a07e);}return _0x14b895[_0xbe08('0x23')]();};}function saveUpdates(_0x1f76f,_0x3ddc2f){return function(_0x3085bf){if(_0x3085bf){return _0x3085bf['update'](_0x1f76f)['then'](function(_0x302176){return _0x302176;});}return null;};}function removeEntity(_0x5291fa,_0xbe75f1){return function(_0xa8312c){if(_0xa8312c){return _0xa8312c[_0xbe08('0x24')]()['then'](function(){_0x5291fa[_0xbe08('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x137b6a,_0x202163){return function(_0x1d0537){if(!_0x1d0537){_0x137b6a[_0xbe08('0x25')](0x194);}return _0x1d0537;};}function handleError(_0xde4858,_0x503a2e){_0x503a2e=_0x503a2e||0x1f4;return function(_0x52cdfe){logger[_0xbe08('0x26')](_0x52cdfe[_0xbe08('0x27')]);if(_0x52cdfe[_0xbe08('0x28')]){delete _0x52cdfe['name'];}_0xde4858[_0xbe08('0x1a')](_0x503a2e)[_0xbe08('0x29')](_0x52cdfe);};}exports['update']=function(_0x39bb6d,_0x3f89f8){if(_0x39bb6d['body']['id']){delete _0x39bb6d[_0xbe08('0x2a')]['id'];}return db['Action']['find']({'where':{'id':_0x39bb6d[_0xbe08('0x2b')]['id']}})[_0xbe08('0x2c')](handleEntityNotFound(_0x3f89f8,null))[_0xbe08('0x2c')](saveUpdates(_0x39bb6d[_0xbe08('0x2a')],null))[_0xbe08('0x2c')](respondWithResult(_0x3f89f8,null))['catch'](handleError(_0x3f89f8,null));};exports[_0xbe08('0x24')]=function(_0x2f9ca4,_0x2967bb){return db['Action'][_0xbe08('0x2d')]({'where':{'id':_0x2f9ca4[_0xbe08('0x2b')]['id']}})[_0xbe08('0x2c')](handleEntityNotFound(_0x2967bb,null))[_0xbe08('0x2c')](removeEntity(_0x2967bb,null))[_0xbe08('0x2e')](handleError(_0x2967bb,null));}; \ No newline at end of file +var _0x12cb=['fs-extra','lodash','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','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','body','find','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x12cb,0xb9));var _0xb12c=function(_0x3fedac,_0x3ec6ef){_0x3fedac=_0x3fedac-0x0;var _0x4f3e1e=_0x12cb[_0x3fedac];return _0x4f3e1e;};'use strict';var emlformat=require(_0xb12c('0x0'));var rimraf=require(_0xb12c('0x1'));var zipdir=require(_0xb12c('0x2'));var jsonpatch=require(_0xb12c('0x3'));var rp=require(_0xb12c('0x4'));var moment=require(_0xb12c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb12c('0x6'));var util=require('util');var path=require(_0xb12c('0x7'));var sox=require(_0xb12c('0x8'));var csv=require(_0xb12c('0x9'));var ejs=require(_0xb12c('0xa'));var fs=require('fs');var fs_extra=require(_0xb12c('0xb'));var _=require(_0xb12c('0xc'));var squel=require('squel');var crypto=require(_0xb12c('0xd'));var jsforce=require(_0xb12c('0xe'));var deskjs=require(_0xb12c('0xf'));var toCsv=require(_0xb12c('0x9'));var querystring=require(_0xb12c('0x10'));var Papa=require(_0xb12c('0x11'));var Redis=require(_0xb12c('0x12'));var authService=require(_0xb12c('0x13'));var qs=require(_0xb12c('0x14'));var as=require(_0xb12c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb12c('0x16'))('api');var utils=require(_0xb12c('0x17'));var config=require(_0xb12c('0x18'));var licenseUtil=require(_0xb12c('0x19'));var db=require(_0xb12c('0x1a'))['db'];function respondWithStatusCode(_0x422f2c,_0x10cb16){_0x10cb16=_0x10cb16||0xcc;return function(_0x933577){if(_0x933577){return _0x422f2c[_0xb12c('0x1b')](_0x10cb16);}return _0x422f2c[_0xb12c('0x1c')](_0x10cb16)['end']();};}function respondWithResult(_0x3c11cf,_0x581602){_0x581602=_0x581602||0xc8;return function(_0x5ff660){if(_0x5ff660){return _0x3c11cf[_0xb12c('0x1c')](_0x581602)[_0xb12c('0x1d')](_0x5ff660);}};}function respondWithFilteredResult(_0x4d6bb9,_0x2a8d54){return function(_0x5e65ce){if(_0x5e65ce){var _0x2a22cf=typeof _0x2a8d54['offset']===_0xb12c('0x1e')&&typeof _0x2a8d54[_0xb12c('0x1f')]===_0xb12c('0x1e');var _0x5e7d7e=_0x5e65ce[_0xb12c('0x20')];var _0x733975=_0x2a22cf?0x0:_0x2a8d54[_0xb12c('0x21')];var _0x878a09=_0x2a22cf?_0x5e65ce[_0xb12c('0x20')]:_0x2a8d54[_0xb12c('0x21')]+_0x2a8d54[_0xb12c('0x1f')];var _0x105b5d;if(_0x878a09>=_0x5e7d7e){_0x878a09=_0x5e7d7e;_0x105b5d=0xc8;}else{_0x105b5d=0xce;}_0x4d6bb9[_0xb12c('0x1c')](_0x105b5d);return _0x4d6bb9[_0xb12c('0x22')](_0xb12c('0x23'),_0x733975+'-'+_0x878a09+'/'+_0x5e7d7e)[_0xb12c('0x1d')](_0x5e65ce);}return null;};}function patchUpdates(_0x508584){return function(_0x4d5e26){try{jsonpatch[_0xb12c('0x24')](_0x4d5e26,_0x508584,!![]);}catch(_0x4f35af){return BPromise[_0xb12c('0x25')](_0x4f35af);}return _0x4d5e26[_0xb12c('0x26')]();};}function saveUpdates(_0x308aa8,_0xc81f1a){return function(_0x39f40f){if(_0x39f40f){return _0x39f40f[_0xb12c('0x27')](_0x308aa8)[_0xb12c('0x28')](function(_0x2011a6){return _0x2011a6;});}return null;};}function removeEntity(_0x52dceb,_0x5b0a18){return function(_0x46ec8c){if(_0x46ec8c){return _0x46ec8c['destroy']()[_0xb12c('0x28')](function(){_0x52dceb['status'](0xcc)[_0xb12c('0x29')]();});}};}function handleEntityNotFound(_0x3f870b,_0x581862){return function(_0x4918f4){if(!_0x4918f4){_0x3f870b[_0xb12c('0x1b')](0x194);}return _0x4918f4;};}function handleError(_0x3c6177,_0x18cc32){_0x18cc32=_0x18cc32||0x1f4;return function(_0x331e60){logger['error'](_0x331e60[_0xb12c('0x2a')]);if(_0x331e60[_0xb12c('0x2b')]){delete _0x331e60[_0xb12c('0x2b')];}_0x3c6177['status'](_0x18cc32)[_0xb12c('0x2c')](_0x331e60);};}exports[_0xb12c('0x27')]=function(_0x489797,_0x1ccd5a){if(_0x489797[_0xb12c('0x2d')]['id']){delete _0x489797['body']['id'];}return db['Action'][_0xb12c('0x2e')]({'where':{'id':_0x489797['params']['id']}})[_0xb12c('0x28')](handleEntityNotFound(_0x1ccd5a,null))[_0xb12c('0x28')](saveUpdates(_0x489797['body'],null))[_0xb12c('0x28')](respondWithResult(_0x1ccd5a,null))[_0xb12c('0x2f')](handleError(_0x1ccd5a,null));};exports['destroy']=function(_0x34b172,_0x1c1c6a){return db['Action'][_0xb12c('0x2e')]({'where':{'id':_0x34b172[_0xb12c('0x30')]['id']}})['then'](handleEntityNotFound(_0x1c1c6a,null))[_0xb12c('0x28')](removeEntity(_0x1c1c6a,null))[_0xb12c('0x2f')](handleError(_0x1c1c6a,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 9e222dd..bc97316 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 _0x0706=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions'];(function(_0x532bd3,_0x946a47){var _0x17232e=function(_0x35cf4b){while(--_0x35cf4b){_0x532bd3['push'](_0x532bd3['shift']());}};_0x17232e(++_0x946a47);}(_0x0706,0x1ec));var _0x6070=function(_0x7ae663,_0x39a060){_0x7ae663=_0x7ae663-0x0;var _0x5ed682=_0x0706[_0x7ae663];return _0x5ed682;};'use strict';var _=require(_0x6070('0x0'));var util=require(_0x6070('0x1'));var logger=require('../../config/logger')(_0x6070('0x2'));var moment=require(_0x6070('0x3'));var BPromise=require(_0x6070('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6070('0x5'));var rimraf=require(_0x6070('0x6'));var config=require(_0x6070('0x7'));var attributes=require(_0x6070('0x8'));module[_0x6070('0x9')]=function(_0xb201ba,_0x3eb5c7){return _0xb201ba['define'](_0x6070('0xa'),attributes,{'tableName':_0x6070('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6c0=['rimraf','../../config/environment','Action','tools_actions','lodash','../../config/logger','bluebird','path'];(function(_0x274cc8,_0x200a57){var _0x4d397d=function(_0x267f7f){while(--_0x267f7f){_0x274cc8['push'](_0x274cc8['shift']());}};_0x4d397d(++_0x200a57);}(_0xf6c0,0x194));var _0x0f6c=function(_0x253cdb,_0x142a36){_0x253cdb=_0x253cdb-0x0;var _0x1ae7f4=_0xf6c0[_0x253cdb];return _0x1ae7f4;};'use strict';var _=require(_0x0f6c('0x0'));var util=require('util');var logger=require(_0x0f6c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0f6c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f6c('0x3'));var rimraf=require(_0x0f6c('0x4'));var config=require(_0x0f6c('0x5'));var attributes=require('./action.attributes');module['exports']=function(_0x5baf53,_0x161454){return _0x5baf53['define'](_0x0f6c('0x6'),attributes,{'tableName':_0x0f6c('0x7'),'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 c895ab3..187ec50 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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xf494,0x1c6));var _0x4f49=function(_0x53cf76,_0x38b057){_0x53cf76=_0x53cf76-0x0;var _0x33bf4d=_0xf494[_0x53cf76];return _0x33bf4d;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file +var _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3d08d0,_0x452367){var _0x5588a9=function(_0x26eb78){while(--_0x26eb78){_0x3d08d0['push'](_0x3d08d0['shift']());}};_0x5588a9(++_0x452367);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4dd0a7,_0xb4399f){_0x4dd0a7=_0x4dd0a7-0x0;var _0x487e9b=_0x7fbe[_0x4dd0a7];return _0x487e9b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 72fca4f..67e13e8 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 _0x1802=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','delete','destroy','exports','multer'];(function(_0x3bd2c8,_0x395b96){var _0x25374f=function(_0x5ee528){while(--_0x5ee528){_0x3bd2c8['push'](_0x3bd2c8['shift']());}};_0x25374f(++_0x395b96);}(_0x1802,0x1c1));var _0x2180=function(_0x29718c,_0x438054){_0x29718c=_0x29718c-0x0;var _0x206b76=_0x1802[_0x29718c];return _0x206b76;};'use strict';var multer=require(_0x2180('0x0'));var util=require(_0x2180('0x1'));var path=require(_0x2180('0x2'));var timeout=require(_0x2180('0x3'));var express=require(_0x2180('0x4'));var router=express[_0x2180('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2180('0x6'));var interaction=require(_0x2180('0x7'));var config=require(_0x2180('0x8'));var controller=require(_0x2180('0x9'));router['put'](_0x2180('0xa'),auth[_0x2180('0xb')](),controller['update']);router[_0x2180('0xc')]('/:id',auth[_0x2180('0xb')](),controller[_0x2180('0xd')]);module[_0x2180('0xe')]=router; \ No newline at end of file +var _0x57df=['../../components/auth/service','../../config/environment','put','update','/:id','isAuthenticated','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x17e710,_0x4bd2d6){var _0x4d06e5=function(_0x38eb9a){while(--_0x38eb9a){_0x17e710['push'](_0x17e710['shift']());}};_0x4d06e5(++_0x4bd2d6);}(_0x57df,0x1a8));var _0xf57d=function(_0x5c26b2,_0xf5a5ae){_0x5c26b2=_0x5c26b2-0x0;var _0x4e7fab=_0x57df[_0x5c26b2];return _0x4e7fab;};'use strict';var multer=require('multer');var util=require(_0xf57d('0x0'));var path=require('path');var timeout=require(_0xf57d('0x1'));var express=require(_0xf57d('0x2'));var router=express[_0xf57d('0x3')]();var fs_extra=require(_0xf57d('0x4'));var auth=require(_0xf57d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf57d('0x6'));var controller=require('./action.controller');router[_0xf57d('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xf57d('0x8')]);router['delete'](_0xf57d('0x9'),auth[_0xf57d('0xa')](),controller[_0xf57d('0xb')]);module[_0xf57d('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 457a41d..ea380e4 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 _0x5d17=['sequelize','exports','STRING','TEXT'];(function(_0x2a72bd,_0x3f304e){var _0x1ac78d=function(_0x4a0a03){while(--_0x4a0a03){_0x2a72bd['push'](_0x2a72bd['shift']());}};_0x1ac78d(++_0x3f304e);}(_0x5d17,0x114));var _0x75d1=function(_0x2379bd,_0x98d1d3){_0x2379bd=_0x2379bd-0x0;var _0x51bbf1=_0x5d17[_0x2379bd];return _0x51bbf1;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x75d1('0x2')]},'table':{'type':Sequelize[_0x75d1('0x2')]},'conditions':{'type':Sequelize[_0x75d1('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3f8a=['TEXT','sequelize','exports','STRING'];(function(_0x4cd9c8,_0x1c06bc){var _0x236d11=function(_0x5f4201){while(--_0x5f4201){_0x4cd9c8['push'](_0x4cd9c8['shift']());}};_0x236d11(++_0x1c06bc);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x5b0007,_0x10d242){_0x5b0007=_0x5b0007-0x0;var _0x519086=_0x3f8a[_0x5b0007];return _0x519086;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'name':{'type':Sequelize[_0xa3f8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa3f8('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xa3f8('0x2')]},'conditions':{'type':Sequelize[_0xa3f8('0x3')]},'joins':{'type':Sequelize[_0xa3f8('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index c9c9aec..4312dee 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 _0x426a=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','table','conditions','clone','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','MAX(%s)','HOUR(%s)','value','Sequelize','keyBy','output','web','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','toString','child_process','fork','../../files/reports','savename','COUNT(*)','run','runReport','cross_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','%s.%s\x20=\x20%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','end','error','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length'];(function(_0x42ab1d,_0x1c61cc){var _0x270686=function(_0x295a2e){while(--_0x295a2e){_0x42ab1d['push'](_0x42ab1d['shift']());}};_0x270686(++_0x1c61cc);}(_0x426a,0x6b));var _0xa426=function(_0x4553f6,_0x2176c8){_0x4553f6=_0x4553f6-0x0;var _0x4700bb=_0x426a[_0x4553f6];return _0x4700bb;};'use strict';var emlformat=require(_0xa426('0x0'));var rimraf=require(_0xa426('0x1'));var zipdir=require(_0xa426('0x2'));var jsonpatch=require(_0xa426('0x3'));var rp=require(_0xa426('0x4'));var moment=require('moment');var BPromise=require(_0xa426('0x5'));var Mustache=require(_0xa426('0x6'));var util=require(_0xa426('0x7'));var path=require(_0xa426('0x8'));var sox=require(_0xa426('0x9'));var csv=require(_0xa426('0xa'));var ejs=require(_0xa426('0xb'));var fs=require('fs');var fs_extra=require(_0xa426('0xc'));var _=require(_0xa426('0xd'));var squel=require(_0xa426('0xe'));var crypto=require(_0xa426('0xf'));var jsforce=require(_0xa426('0x10'));var deskjs=require(_0xa426('0x11'));var toCsv=require(_0xa426('0xa'));var querystring=require(_0xa426('0x12'));var Papa=require(_0xa426('0x13'));var Redis=require(_0xa426('0x14'));var authService=require(_0xa426('0x15'));var qs=require(_0xa426('0x16'));var as=require(_0xa426('0x17'));var hardwareService=require(_0xa426('0x18'));var logger=require(_0xa426('0x19'))(_0xa426('0x1a'));var utils=require(_0xa426('0x1b'));var config=require(_0xa426('0x1c'));var licenseUtil=require(_0xa426('0x1d'));var db=require(_0xa426('0x1e'))['db'];var dbH=require('../../mysqldb')[_0xa426('0x1f')];function respondWithStatusCode(_0x383fd4,_0x400c4a){_0x400c4a=_0x400c4a||0xcc;return function(_0x25e003){if(_0x25e003){return _0x383fd4['sendStatus'](_0x400c4a);}return _0x383fd4[_0xa426('0x20')](_0x400c4a)['end']();};}function respondWithResult(_0x1aa133,_0xe60f47){_0xe60f47=_0xe60f47||0xc8;return function(_0x334ec8){if(_0x334ec8){return _0x1aa133[_0xa426('0x20')](_0xe60f47)['json'](_0x334ec8);}};}function respondWithFilteredResult(_0x538c70,_0x3109ba){return function(_0x273db2){if(_0x273db2){var _0x511de1=typeof _0x3109ba[_0xa426('0x21')]===_0xa426('0x22')&&typeof _0x3109ba[_0xa426('0x23')]===_0xa426('0x22');var _0x48f755=_0x273db2['count'];var _0x3acd0c=_0x511de1?0x0:_0x3109ba[_0xa426('0x21')];var _0x55c149=_0x511de1?_0x273db2[_0xa426('0x24')]:_0x3109ba[_0xa426('0x21')]+_0x3109ba[_0xa426('0x23')];var _0x3a5da4;if(_0x55c149>=_0x48f755){_0x55c149=_0x48f755;_0x3a5da4=0xc8;}else{_0x3a5da4=0xce;}_0x538c70['status'](_0x3a5da4);return _0x538c70['set'](_0xa426('0x25'),_0x3acd0c+'-'+_0x55c149+'/'+_0x48f755)['json'](_0x273db2);}return null;};}function patchUpdates(_0xd1beb6){return function(_0x4e4e2b){try{jsonpatch[_0xa426('0x26')](_0x4e4e2b,_0xd1beb6,!![]);}catch(_0x58396e){return BPromise[_0xa426('0x27')](_0x58396e);}return _0x4e4e2b[_0xa426('0x28')]();};}function saveUpdates(_0x9782b6,_0x119548){return function(_0x142896){if(_0x142896){return _0x142896[_0xa426('0x29')](_0x9782b6)[_0xa426('0x2a')](function(_0x4731b3){return _0x4731b3;});}return null;};}function removeEntity(_0x132df2,_0x1d385c){return function(_0x5926d9){if(_0x5926d9){return _0x5926d9[_0xa426('0x2b')]()[_0xa426('0x2a')](function(){var _0xaf9118=_0x5926d9[_0xa426('0x2c')]({'plain':!![]});var _0x3abda8=_0xa426('0x2d');return db[_0xa426('0x2e')][_0xa426('0x2b')]({'where':{'type':_0x3abda8,'resourceId':_0xaf9118['id']}})['then'](function(){return _0x5926d9;});})[_0xa426('0x2a')](function(){_0x132df2['status'](0xcc)[_0xa426('0x2f')]();});}};}function handleEntityNotFound(_0x522c57,_0x2c1fd9){return function(_0x23b2af){if(!_0x23b2af){_0x522c57['sendStatus'](0x194);}return _0x23b2af;};}function handleError(_0xbda27a,_0x12edf3){_0x12edf3=_0x12edf3||0x1f4;return function(_0x21122f){logger[_0xa426('0x30')](_0x21122f['stack']);if(_0x21122f['name']){delete _0x21122f[_0xa426('0x31')];}_0xbda27a[_0xa426('0x20')](_0x12edf3)[_0xa426('0x32')](_0x21122f);};}exports[_0xa426('0x33')]=function(_0x2fd0ef,_0x1bc9f7){var _0x11df55={},_0xa8d102={},_0x51044f={'count':0x0,'rows':[]};var _0x35898f=_['map'](db[_0xa426('0x34')][_0xa426('0x35')],function(_0x2df8b9){return{'name':_0x2df8b9[_0xa426('0x36')],'type':_0x2df8b9[_0xa426('0x37')][_0xa426('0x38')]};});_0xa8d102[_0xa426('0x39')]=_[_0xa426('0x3a')](_0x35898f,'name');_0xa8d102[_0xa426('0x3b')]=_[_0xa426('0x3c')](_0x2fd0ef[_0xa426('0x3b')]);_0xa8d102[_0xa426('0x3d')]=_[_0xa426('0x3e')](_0xa8d102['model'],_0xa8d102['query']);_0x11df55[_0xa426('0x3f')]=_['intersection'](_0xa8d102[_0xa426('0x39')],qs[_0xa426('0x40')](_0x2fd0ef['query']['fields']));_0x11df55['attributes']=_0x11df55[_0xa426('0x3f')][_0xa426('0x41')]?_0x11df55[_0xa426('0x3f')]:_0xa8d102['model'];if(!_0x2fd0ef['query'][_0xa426('0x42')](_0xa426('0x43'))){_0x11df55[_0xa426('0x23')]=qs['limit'](_0x2fd0ef[_0xa426('0x3b')]['limit']);_0x11df55[_0xa426('0x21')]=qs[_0xa426('0x21')](_0x2fd0ef[_0xa426('0x3b')][_0xa426('0x21')]);}_0x11df55[_0xa426('0x44')]=qs[_0xa426('0x45')](_0x2fd0ef[_0xa426('0x3b')]['sort']);_0x11df55[_0xa426('0x46')]=qs[_0xa426('0x3d')](_[_0xa426('0x47')](_0x2fd0ef[_0xa426('0x3b')],_0xa8d102[_0xa426('0x3d')]),_0x35898f);if(_0x2fd0ef[_0xa426('0x3b')][_0xa426('0x48')]){_0x11df55['where']=_[_0xa426('0x49')](_0x11df55['where'],{'$or':_[_0xa426('0x3a')](_0x35898f,function(_0x5ac90d){if(_0x5ac90d[_0xa426('0x37')]!==_0xa426('0x4a')){var _0x58784e={};_0x58784e[_0x5ac90d[_0xa426('0x31')]]={'$like':'%'+_0x2fd0ef[_0xa426('0x3b')][_0xa426('0x48')]+'%'};return _0x58784e;}})});}_0x11df55=_[_0xa426('0x49')]({},_0x11df55,_0x2fd0ef['options']);var _0x385f70={'where':_0x11df55[_0xa426('0x46')]};return db[_0xa426('0x34')]['count'](_0x385f70)[_0xa426('0x2a')](function(_0x2bc851){_0x51044f['count']=_0x2bc851;if(_0x2fd0ef[_0xa426('0x3b')][_0xa426('0x4b')]){_0x11df55[_0xa426('0x4c')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xa426('0x4d')](_0x11df55);})[_0xa426('0x2a')](function(_0x149396){_0x51044f[_0xa426('0x4e')]=_0x149396;return _0x51044f;})['then'](respondWithFilteredResult(_0x1bc9f7,_0x11df55))[_0xa426('0x4f')](handleError(_0x1bc9f7,null));};exports[_0xa426('0x50')]=function(_0x4a3581,_0x1be8f1){var _0x3f7efa={'raw':![],'where':{'id':_0x4a3581[_0xa426('0x51')]['id']}},_0x22c8ae={};_0x22c8ae[_0xa426('0x39')]=_[_0xa426('0x3c')](db[_0xa426('0x34')][_0xa426('0x35')]);_0x22c8ae[_0xa426('0x3b')]=_[_0xa426('0x3c')](_0x4a3581['query']);_0x22c8ae['filters']=_[_0xa426('0x3e')](_0x22c8ae[_0xa426('0x39')],_0x22c8ae['query']);_0x3f7efa['attributes']=_[_0xa426('0x3e')](_0x22c8ae[_0xa426('0x39')],qs[_0xa426('0x40')](_0x4a3581[_0xa426('0x3b')][_0xa426('0x40')]));_0x3f7efa[_0xa426('0x3f')]=_0x3f7efa[_0xa426('0x3f')][_0xa426('0x41')]?_0x3f7efa[_0xa426('0x3f')]:_0x22c8ae[_0xa426('0x39')];if(_0x4a3581[_0xa426('0x3b')][_0xa426('0x4b')]){_0x3f7efa[_0xa426('0x4c')]=[{'all':!![]}];}_0x3f7efa=_[_0xa426('0x49')]({},_0x3f7efa,_0x4a3581[_0xa426('0x52')]);return db[_0xa426('0x34')][_0xa426('0x53')](_0x3f7efa)[_0xa426('0x2a')](handleEntityNotFound(_0x1be8f1,null))['then'](respondWithResult(_0x1be8f1,null))[_0xa426('0x4f')](handleError(_0x1be8f1,null));};exports['create']=function(_0x443608,_0x1f1729){return db[_0xa426('0x34')][_0xa426('0x54')](_0x443608['body'],{})[_0xa426('0x2a')](function(_0x4ca42c){var _0xdf2fe4=_0x443608[_0xa426('0x55')]['get']({'plain':!![]});if(!_0xdf2fe4)throw new Error(_0xa426('0x56'));if(_0xdf2fe4[_0xa426('0x57')]===_0xa426('0x55')){var _0x1a3a5d=_0x4ca42c[_0xa426('0x2c')]({'plain':!![]});var _0x3d1fa5='Reports';return db[_0xa426('0x58')]['find']({'where':{'name':_0x3d1fa5,'userProfileId':_0xdf2fe4[_0xa426('0x59')]},'raw':!![]})[_0xa426('0x2a')](function(_0x58e004){if(_0x58e004&&_0x58e004['autoAssociation']===0x0){return db[_0xa426('0x2e')][_0xa426('0x54')]({'name':_0x1a3a5d[_0xa426('0x31')],'resourceId':_0x1a3a5d['id'],'type':_0xa426('0x2d'),'sectionId':_0x58e004['id']},{})[_0xa426('0x2a')](function(){return _0x4ca42c;});}else{return _0x4ca42c;}})[_0xa426('0x4f')](function(_0x490eee){logger[_0xa426('0x30')](_0xa426('0x5a'),_0x490eee);throw _0x490eee;});}return _0x4ca42c;})[_0xa426('0x2a')](respondWithResult(_0x1f1729,0xc9))[_0xa426('0x4f')](handleError(_0x1f1729,null));};exports[_0xa426('0x29')]=function(_0x5b98c5,_0x14401f){if(_0x5b98c5[_0xa426('0x5b')]['id']){delete _0x5b98c5[_0xa426('0x5b')]['id'];}return db[_0xa426('0x34')][_0xa426('0x53')]({'where':{'id':_0x5b98c5[_0xa426('0x51')]['id']}})[_0xa426('0x2a')](handleEntityNotFound(_0x14401f,null))[_0xa426('0x2a')](saveUpdates(_0x5b98c5['body'],null))['then'](respondWithResult(_0x14401f,null))[_0xa426('0x4f')](handleError(_0x14401f,null));};exports[_0xa426('0x2b')]=function(_0x5d1a77,_0x2f694c){return db[_0xa426('0x34')][_0xa426('0x53')]({'where':{'id':_0x5d1a77['params']['id']}})[_0xa426('0x2a')](handleEntityNotFound(_0x2f694c,null))[_0xa426('0x2a')](removeEntity(_0x2f694c,null))[_0xa426('0x4f')](handleError(_0x2f694c,null));};exports[_0xa426('0x5c')]=function(_0x4f6dcb,_0x176956){var _0x312be5=0xa;var _0x2d7652=[_0xa426('0x5d'),_0xa426('0x5e'),_0xa426('0x5f'),'cross_join'];var _0x4fdf7a={'SUM':_0xa426('0x60'),'COUNT':_0xa426('0x61'),'COUNT DISTINCT':_0xa426('0x62'),'MAX':'MAX(%s)','MIN':_0xa426('0x63'),'AVG':_0xa426('0x64'),'GROUP_CONCAT':_0xa426('0x65'),'GROUP_CONCAT ASC':_0xa426('0x66'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x405072={'SEC_TO_TIME':_0xa426('0x67'),'DATE':_0xa426('0x68'),'HOUR':'HOUR(%s)','ROUND':_0xa426('0x69'),'UNIX_TIMESTAMP':_0xa426('0x6a')};var _0x2d72ba=function(_0x250860){return!_[_0xa426('0x6b')]([_0xa426('0x6c'),_0xa426('0x6d'),_0xa426('0x6e'),_0xa426('0x6f')],_0x250860);};var _0x430358=function(_0x4c69dd){if(!_0x4c69dd||!_0x4c69dd[_0xa426('0x70')][_0xa426('0x41')]){return'';}for(var _0x24dc98='(',_0x31c83a=0x0;_0x31c83a<_0x4c69dd[_0xa426('0x70')]['length'];_0x31c83a+=0x1){_0x31c83a>0x0&&(_0x24dc98+='\x20'+_0x4c69dd[_0xa426('0x71')]+'\x20');_0x24dc98+=_0x4c69dd[_0xa426('0x70')][_0x31c83a][_0xa426('0x72')]?_0x430358(_0x4c69dd[_0xa426('0x70')][_0x31c83a]['group']):_0x4c69dd[_0xa426('0x70')][_0x31c83a]['field']+'\x20'+_0x4c69dd[_0xa426('0x70')][_0x31c83a]['condition']+(_0x2d72ba(_0x4c69dd[_0xa426('0x70')][_0x31c83a][_0xa426('0x73')])?'\x20'+_0x4c69dd[_0xa426('0x70')][_0x31c83a]['value']:'');}return _0x24dc98+')';};var _0x1849c3={'where':{'id':_0x4f6dcb[_0xa426('0x51')]['id']}},_0x18483a,_0x4e11f0,_0x154e94,_0x3755e7,_0x5074f3;_0x1849c3=_[_0xa426('0x49')]({},_0x1849c3,_0x4f6dcb[_0xa426('0x52')]);return db[_0xa426('0x34')][_0xa426('0x53')](_0x1849c3)['then'](function(_0x5a7ca9){if(_0x5a7ca9){_0x18483a=_0x5a7ca9;return _0x5a7ca9['getFields']();}return null;})[_0xa426('0x2a')](function(_0x2d2bf4){if(_0x2d2bf4){if(!_0x2d2bf4['length']){throw new db['Sequelize'][(_0xa426('0x74'))](_0xa426('0x75'),0x193);}_0x4e11f0=_0x2d2bf4;return db[_0xa426('0x76')][_0xa426('0x4d')]({'raw':!![]});}return null;})[_0xa426('0x2a')](function(_0x1d87d2){if(_0x1d87d2){_0x154e94=_['keyBy'](_0x1d87d2,'id');var _0x1e7361;var _0x27bc75=squel['select']();_0x27bc75[_0xa426('0x77')](_0x18483a['table']);for(var _0x1a2a8c=0x0;_0x1a2a8c<_0x4e11f0[_0xa426('0x41')];_0x1a2a8c+=0x1){_0x1e7361=_0x4e11f0[_0x1a2a8c]['MetricId']?_0x154e94[_0x4e11f0[_0x1a2a8c][_0xa426('0x78')]][_0xa426('0x79')]:_0x4e11f0[_0x1a2a8c][_0xa426('0x7a')];_0x1e7361=_0x4e11f0[_0x1a2a8c][_0xa426('0x7b')]?_[_0xa426('0x7c')](_0x4fdf7a[_0x4e11f0[_0x1a2a8c]['function']],'%s',_0x1e7361):_0x1e7361;_0x1e7361=_0x4e11f0[_0x1a2a8c][_0xa426('0x7d')]?_[_0xa426('0x7c')](_0x405072[_0x4e11f0[_0x1a2a8c][_0xa426('0x7d')]],'%s',_0x1e7361):_0x1e7361;if(_0x4e11f0[_0x1a2a8c][_0xa426('0x7e')]){_0x27bc75['group'](_0x1e7361);}_0x4e11f0[_0x1a2a8c]['orderBy']&&_0x27bc75['order'](_0x1e7361,_0x4e11f0[_0x1a2a8c][_0xa426('0x7f')]===_0xa426('0x80')?![]:!![]);_0x27bc75['field'](_0x1e7361,_0x4e11f0[_0x1a2a8c][_0xa426('0x81')]||_0x1e7361);}if(_0x18483a[_0xa426('0x82')]){_0x18483a[_0xa426('0x82')]=JSON[_0xa426('0x83')](_0x18483a[_0xa426('0x82')]);for(var _0xc96a5=0x0;_0xc96a5<_0x18483a[_0xa426('0x82')][_0xa426('0x41')];_0xc96a5+=0x1){if(_0x18483a['joins'][_0xc96a5][_0xa426('0x37')]&&_[_0xa426('0x6b')](_0x2d7652,_0x18483a[_0xa426('0x82')][_0xc96a5]['type'])&&_0x18483a[_0xa426('0x82')][_0xc96a5][_0xa426('0x84')]&&_0x18483a[_0xa426('0x82')][_0xc96a5]['foreignTable']&&_0x18483a[_0xa426('0x82')][_0xc96a5][_0xa426('0x85')]){_0x27bc75[_0x18483a['joins'][_0xc96a5]['type']](_0x18483a[_0xa426('0x82')][_0xc96a5][_0xa426('0x86')],null,util[_0xa426('0x7d')]('%s.%s\x20=\x20%s.%s',_0x18483a[_0xa426('0x87')],_0x18483a[_0xa426('0x82')][_0xc96a5]['parentKey'],_0x18483a['joins'][_0xc96a5]['foreignTable'],_0x18483a[_0xa426('0x82')][_0xc96a5]['foreignKey']));}}}if(_0x18483a['conditions']){_0x18483a[_0xa426('0x88')]=JSON[_0xa426('0x83')](_0x18483a[_0xa426('0x88')]);_0x27bc75[_0xa426('0x46')](_0x430358(_0x18483a[_0xa426('0x88')][_0xa426('0x72')]));}_0x5074f3=_0x27bc75[_0xa426('0x89')]();_0x27bc75[_0xa426('0x23')](_0x312be5);_0x27bc75[_0xa426('0x21')](0x0);logger[_0xa426('0x8a')](_0xa426('0x8b'),_0x27bc75['toString']());return dbH[_0xa426('0x8c')][_0xa426('0x3b')](_0x27bc75['toString'](),{'type':dbH['sequelize'][_0xa426('0x8d')][_0xa426('0x8e')]});}})['then'](respondWithResult(_0x176956,null))[_0xa426('0x4f')](handleError(_0x176956,null));};function runReport(_0x2a1129,_0x55508f,_0xcc1a76){var _0x447ec4=_0x55508f[_0xa426('0x31')];var _0x48bd9a=0xa;var _0x59a95f=[_0xa426('0x5d'),'left_join','right_join','cross_join'];var _0x2a9b8d={'SUM':_0xa426('0x60'),'COUNT':_0xa426('0x61'),'COUNT DISTINCT':_0xa426('0x62'),'MAX':_0xa426('0x8f'),'MIN':_0xa426('0x63'),'AVG':_0xa426('0x64'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xa426('0x66'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x10bee8={'SEC_TO_TIME':_0xa426('0x67'),'DATE':_0xa426('0x68'),'HOUR':_0xa426('0x90'),'ROUND':_0xa426('0x69'),'UNIX_TIMESTAMP':_0xa426('0x6a')};var _0x588bab=function(_0x39a76e){return!_[_0xa426('0x6b')]([_0xa426('0x6c'),_0xa426('0x6d'),'IS\x20EMPTY',_0xa426('0x6f')],_0x39a76e);};var _0x14c2e9=function(_0x11924b){if(!_0x11924b||!_0x11924b[_0xa426('0x70')][_0xa426('0x41')]){return'';}for(var _0x3b5ca2='(',_0x5b58b4=0x0;_0x5b58b4<_0x11924b['rules'][_0xa426('0x41')];_0x5b58b4+=0x1){_0x5b58b4>0x0&&(_0x3b5ca2+='\x20'+_0x11924b[_0xa426('0x71')]+'\x20');_0x3b5ca2+=_0x11924b[_0xa426('0x70')][_0x5b58b4]['group']?_0x14c2e9(_0x11924b[_0xa426('0x70')][_0x5b58b4][_0xa426('0x72')]):_0x11924b[_0xa426('0x70')][_0x5b58b4][_0xa426('0x7a')]+'\x20'+_0x11924b[_0xa426('0x70')][_0x5b58b4][_0xa426('0x73')]+(_0x588bab(_0x11924b[_0xa426('0x70')][_0x5b58b4][_0xa426('0x73')])?'\x20'+_0x11924b['rules'][_0x5b58b4][_0xa426('0x91')]:'');}return _0x3b5ca2+')';};var _0x36b448={'where':{'id':_0x2a1129['id']}},_0x538e4a,_0x22c842,_0x538d6f,_0x42a653,_0x5a16e5;_0x36b448=_['merge']({},_0x36b448,_0xcc1a76);return db['AnalyticCustomReport'][_0xa426('0x53')](_0x36b448)['then'](function(_0x355eec){if(_0x355eec){_0x538e4a=_0x355eec;return _0x355eec['getFields']();}return null;})['then'](function(_0x590396){if(_0x590396){if(!_0x590396[_0xa426('0x41')]){throw new db[(_0xa426('0x92'))][(_0xa426('0x74'))](_0xa426('0x75'),0x193);}_0x22c842=_0x590396;return db[_0xa426('0x76')]['findAll']({'raw':!![]});}return null;})[_0xa426('0x2a')](function(_0x890165){if(_0x890165){_0x538d6f=_[_0xa426('0x93')](_0x890165,'id');var _0x15ddd6;var _0x5ad6c1=squel['select']();_0x5ad6c1[_0xa426('0x77')](_0x538e4a[_0xa426('0x87')]);for(var _0x5c13d4=0x0;_0x5c13d4<_0x22c842['length'];_0x5c13d4+=0x1){_0x15ddd6=_0x22c842[_0x5c13d4]['MetricId']?_0x538d6f[_0x22c842[_0x5c13d4]['MetricId']][_0xa426('0x79')]:_0x22c842[_0x5c13d4][_0xa426('0x7a')];_0x15ddd6=_0x22c842[_0x5c13d4]['function']?_[_0xa426('0x7c')](_0x2a9b8d[_0x22c842[_0x5c13d4][_0xa426('0x7b')]],'%s',_0x15ddd6):_0x15ddd6;_0x15ddd6=_0x22c842[_0x5c13d4]['format']?_[_0xa426('0x7c')](_0x10bee8[_0x22c842[_0x5c13d4][_0xa426('0x7d')]],'%s',_0x15ddd6):_0x15ddd6;if(_0x22c842[_0x5c13d4][_0xa426('0x7e')]){_0x5ad6c1['group'](_0x15ddd6);}_0x22c842[_0x5c13d4][_0xa426('0x7f')]&&_0x5ad6c1[_0xa426('0x44')](_0x15ddd6,_0x22c842[_0x5c13d4][_0xa426('0x7f')]===_0xa426('0x80')?![]:!![]);_0x5ad6c1['field'](_0x15ddd6,_0x22c842[_0x5c13d4][_0xa426('0x81')]||_0x15ddd6);}if(_0x538e4a[_0xa426('0x82')]){_0x538e4a[_0xa426('0x82')]=JSON[_0xa426('0x83')](_0x538e4a[_0xa426('0x82')]);for(var _0x5a01a5=0x0;_0x5a01a5<_0x538e4a[_0xa426('0x82')][_0xa426('0x41')];_0x5a01a5+=0x1){if(_0x538e4a['joins'][_0x5a01a5][_0xa426('0x37')]&&_[_0xa426('0x6b')](_0x59a95f,_0x538e4a['joins'][_0x5a01a5][_0xa426('0x37')])&&_0x538e4a[_0xa426('0x82')][_0x5a01a5][_0xa426('0x84')]&&_0x538e4a[_0xa426('0x82')][_0x5a01a5][_0xa426('0x86')]&&_0x538e4a[_0xa426('0x82')][_0x5a01a5][_0xa426('0x85')]){_0x5ad6c1[_0x538e4a['joins'][_0x5a01a5][_0xa426('0x37')]](_0x538e4a['joins'][_0x5a01a5][_0xa426('0x86')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x538e4a['table'],_0x538e4a[_0xa426('0x82')][_0x5a01a5]['parentKey'],_0x538e4a[_0xa426('0x82')][_0x5a01a5][_0xa426('0x86')],_0x538e4a[_0xa426('0x82')][_0x5a01a5][_0xa426('0x85')]));}}}if(_0x538e4a[_0xa426('0x88')]){_0x538e4a[_0xa426('0x88')]=JSON[_0xa426('0x83')](_0x538e4a[_0xa426('0x88')]);_0x5ad6c1[_0xa426('0x46')](_0x14c2e9(_0x538e4a[_0xa426('0x88')]['group']));}_0x5a16e5=_0x5ad6c1['clone']();_0x5ad6c1[_0xa426('0x23')](_0x48bd9a);_0x5ad6c1['offset'](0x0);return;}})[_0xa426('0x2a')](function(){if(_0x55508f[_0xa426('0x94')]===_0xa426('0x95')){return null;}var _0x462104=_[_0xa426('0x49')](_0x55508f,{'name':_0x55508f[_0xa426('0x96')]||_0x55508f[_0xa426('0x31')]||_0x538e4a[_0xa426('0x31')],'basename':_0x447ec4,'savename':util['format'](_0xa426('0x97'),_0x55508f[_0xa426('0x31')]||_0x538e4a[_0xa426('0x31')],require('randomstring')[_0xa426('0x98')](0x4),_0x55508f['output']||_0xa426('0x99')),'reportId':_0x538e4a['id'],'reportType':_0xa426('0x9a')});return db[_0xa426('0x9b')]['create'](_0x462104,{'raw':!![]});})[_0xa426('0x2a')](function(_0xcbd36b){if(_0x538e4a[_0xa426('0x87')]===_0xa426('0x9c')){_0x5a16e5['where'](_0x538e4a[_0xa426('0x87')]+_0xa426('0x9d'),_0x55508f[_0xa426('0x9e')],_0x55508f['endDate']);}else{_0x5a16e5[_0xa426('0x46')](_0x538e4a['table']+_0xa426('0x9f'),_0x55508f[_0xa426('0x9e')],_0x55508f[_0xa426('0xa0')]);}if(_0xcbd36b){logger['info'](_0xa426('0xa1'),_0x5a16e5[_0xa426('0xa2')]());require(_0xa426('0xa3'))[_0xa426('0xa4')](path['join'](__dirname,'../../components/export/',_0xcbd36b[_0xa426('0x94')]),[_0xcbd36b['id'],_0x5a16e5['toString'](),path[_0xa426('0x5d')](__dirname,_0xa426('0xa5'),_0xcbd36b[_0xa426('0xa6')]),_0x447ec4]);return _0xcbd36b;}else{var _0x408942=squel['select']();_0x408942[_0xa426('0x77')]('('+_0x5a16e5['toString']()+')','countTable');_0x408942['field'](_0xa426('0xa7'),'count');_0x5a16e5[_0xa426('0x23')](_0x55508f[_0xa426('0x23')]||_0x48bd9a);_0x5a16e5[_0xa426('0x21')](_0x55508f[_0xa426('0x21')]||0x0);return dbH[_0xa426('0x8c')][_0xa426('0x3b')](_0x408942['toString'](),{'type':dbH[_0xa426('0x8c')][_0xa426('0x8d')][_0xa426('0x8e')]})[_0xa426('0x2a')](function(_0x5ea8f2){if(!_0x5ea8f2[_0xa426('0x41')]){_0x42a653=0x0;}else{_0x42a653=_0x5ea8f2[0x0][_0xa426('0x24')]||0x0;}return dbH[_0xa426('0x8c')][_0xa426('0x3b')](_0x5a16e5[_0xa426('0xa2')](),{'type':dbH[_0xa426('0x8c')][_0xa426('0x8d')][_0xa426('0x8e')]});})[_0xa426('0x2a')](function(_0x427393){return{'rows':_0x427393||[],'count':_0x42a653};});}});}exports[_0xa426('0xa8')]=function(_0x764b3,_0x462fe2){return runReport(_0x764b3['params'],_0x764b3[_0xa426('0x3b')],_0x764b3[_0xa426('0x52')])[_0xa426('0x2a')](respondWithResult(_0x462fe2,null))[_0xa426('0x4f')](handleError(_0x462fe2,null));};exports[_0xa426('0xa9')]=runReport;exports[_0xa426('0x3b')]=function(_0x5c65d7,_0x9e5096){var _0x28fc89=0xa;var _0x5efe34=[_0xa426('0x5d'),'left_join',_0xa426('0x5f'),_0xa426('0xaa')];var _0x48f58c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa426('0x62'),'MAX':_0xa426('0x8f'),'MIN':_0xa426('0x63'),'AVG':_0xa426('0x64'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xa426('0x66'),'GROUP_CONCAT DESC':_0xa426('0xab')};var _0x4134cd={'SEC_TO_TIME':_0xa426('0x67'),'DATE':'DATE(%s)','HOUR':_0xa426('0x90'),'ROUND':_0xa426('0x69'),'UNIX_TIMESTAMP':_0xa426('0x6a')};var _0x41d4ff=function(_0x3c4525){return!_['includes']([_0xa426('0x6c'),_0xa426('0x6d'),_0xa426('0x6e'),_0xa426('0x6f')],_0x3c4525);};var _0x3ec517=function(_0x2b84a4){if(!_0x2b84a4||!_0x2b84a4[_0xa426('0x70')][_0xa426('0x41')]){return'';}for(var _0x1ca67d='(',_0x2a4f82=0x0;_0x2a4f82<_0x2b84a4[_0xa426('0x70')][_0xa426('0x41')];_0x2a4f82+=0x1){_0x2a4f82>0x0&&(_0x1ca67d+='\x20'+_0x2b84a4['operator']+'\x20');_0x1ca67d+=_0x2b84a4[_0xa426('0x70')][_0x2a4f82][_0xa426('0x72')]?_0x3ec517(_0x2b84a4[_0xa426('0x70')][_0x2a4f82][_0xa426('0x72')]):_0x2b84a4['rules'][_0x2a4f82][_0xa426('0x7a')]+'\x20'+_0x2b84a4[_0xa426('0x70')][_0x2a4f82][_0xa426('0x73')]+(_0x41d4ff(_0x2b84a4[_0xa426('0x70')][_0x2a4f82]['condition'])?'\x20'+_0x2b84a4[_0xa426('0x70')][_0x2a4f82][_0xa426('0x91')]:'');}return _0x1ca67d+')';};var _0x50e4ad={'where':{'id':_0x5c65d7[_0xa426('0x51')]['id']}},_0x4314f4,_0x10069d,_0x1186df,_0x478400,_0x213712;_0x50e4ad=_[_0xa426('0x49')]({},_0x50e4ad,_0x5c65d7['options']);return db[_0xa426('0x34')][_0xa426('0x53')](_0x50e4ad)[_0xa426('0x2a')](function(_0x40cc96){if(_0x40cc96){_0x4314f4=_0x40cc96;return _0x40cc96['getFields']();}return null;})[_0xa426('0x2a')](function(_0xdbc5f4){if(_0xdbc5f4){if(!_0xdbc5f4[_0xa426('0x41')]){throw new db[(_0xa426('0x92'))][(_0xa426('0x74'))](_0xa426('0x75'),0x193);}_0x10069d=_0xdbc5f4;return db[_0xa426('0x76')][_0xa426('0x4d')]({'raw':!![]});}return null;})[_0xa426('0x2a')](function(_0x21b47c){if(_0x21b47c){_0x1186df=_[_0xa426('0x93')](_0x21b47c,'id');var _0x5f55d8;var _0x16556a=squel['select']();_0x16556a[_0xa426('0x77')](_0x4314f4[_0xa426('0x87')]);for(var _0x38dc33=0x0;_0x38dc33<_0x10069d[_0xa426('0x41')];_0x38dc33+=0x1){_0x5f55d8=_0x10069d[_0x38dc33][_0xa426('0x78')]?_0x1186df[_0x10069d[_0x38dc33][_0xa426('0x78')]][_0xa426('0x79')]:_0x10069d[_0x38dc33][_0xa426('0x7a')];_0x5f55d8=_0x10069d[_0x38dc33]['function']?_[_0xa426('0x7c')](_0x48f58c[_0x10069d[_0x38dc33]['function']],'%s',_0x5f55d8):_0x5f55d8;_0x5f55d8=_0x10069d[_0x38dc33][_0xa426('0x7d')]?_[_0xa426('0x7c')](_0x4134cd[_0x10069d[_0x38dc33][_0xa426('0x7d')]],'%s',_0x5f55d8):_0x5f55d8;if(_0x10069d[_0x38dc33]['groupBy']){_0x16556a['group'](_0x5f55d8);}_0x10069d[_0x38dc33]['orderBy']&&_0x16556a[_0xa426('0x44')](_0x5f55d8,_0x10069d[_0x38dc33][_0xa426('0x7f')]===_0xa426('0x80')?![]:!![]);_0x16556a[_0xa426('0x7a')](_0x5f55d8,_0x10069d[_0x38dc33][_0xa426('0x81')]||_0x5f55d8);}if(_0x4314f4['joins']){_0x4314f4['joins']=JSON['parse'](_0x4314f4[_0xa426('0x82')]);for(var _0x52a5be=0x0;_0x52a5be<_0x4314f4[_0xa426('0x82')][_0xa426('0x41')];_0x52a5be+=0x1){if(_0x4314f4[_0xa426('0x82')][_0x52a5be][_0xa426('0x37')]&&_[_0xa426('0x6b')](_0x5efe34,_0x4314f4[_0xa426('0x82')][_0x52a5be]['type'])&&_0x4314f4[_0xa426('0x82')][_0x52a5be][_0xa426('0x84')]&&_0x4314f4['joins'][_0x52a5be][_0xa426('0x86')]&&_0x4314f4[_0xa426('0x82')][_0x52a5be][_0xa426('0x85')]){_0x16556a[_0x4314f4[_0xa426('0x82')][_0x52a5be]['type']](_0x4314f4[_0xa426('0x82')][_0x52a5be][_0xa426('0x86')],null,util[_0xa426('0x7d')](_0xa426('0xac'),_0x4314f4[_0xa426('0x87')],_0x4314f4[_0xa426('0x82')][_0x52a5be]['parentKey'],_0x4314f4[_0xa426('0x82')][_0x52a5be][_0xa426('0x86')],_0x4314f4[_0xa426('0x82')][_0x52a5be][_0xa426('0x85')]));}}}if(_0x4314f4['conditions']){_0x4314f4[_0xa426('0x88')]=JSON[_0xa426('0x83')](_0x4314f4[_0xa426('0x88')]);_0x16556a[_0xa426('0x46')](_0x3ec517(_0x4314f4[_0xa426('0x88')]['group']));}_0x213712=_0x16556a[_0xa426('0x89')]();_0x16556a[_0xa426('0x23')](_0x28fc89);_0x16556a[_0xa426('0x21')](0x0);logger[_0xa426('0x8a')](_0xa426('0x8b'),_0x16556a[_0xa426('0xa2')]());return dbH[_0xa426('0x8c')][_0xa426('0x3b')](_0x16556a[_0xa426('0xa2')](),{'type':dbH[_0xa426('0x8c')]['QueryTypes'][_0xa426('0x8e')]});}})[_0xa426('0x2a')](function(){return{'sql':_0x213712[_0xa426('0xa2')]()};})['then'](respondWithResult(_0x9e5096,null))[_0xa426('0x4f')](handleError(_0x9e5096,null));}; \ No newline at end of file +var _0x23b3=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','userProfileId','autoAssociation','catch','update','body','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','MetricId','metric','function','format','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','left_join','COUNT(DISTINCT\x20%s)','HOUR(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','keyBy','select','replace','groupBy','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','SELECT','runReport','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','then','CustomReports','UserProfileResource','error','name','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','create','user'];(function(_0x2ea08a,_0x240f73){var _0x5401ad=function(_0x194c90){while(--_0x194c90){_0x2ea08a['push'](_0x2ea08a['shift']());}};_0x5401ad(++_0x240f73);}(_0x23b3,0x101));var _0x323b=function(_0x50bd84,_0x1be88b){_0x50bd84=_0x50bd84-0x0;var _0x4fd95d=_0x23b3[_0x50bd84];return _0x4fd95d;};'use strict';var emlformat=require(_0x323b('0x0'));var rimraf=require(_0x323b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x323b('0x2'));var rp=require(_0x323b('0x3'));var moment=require(_0x323b('0x4'));var BPromise=require(_0x323b('0x5'));var Mustache=require(_0x323b('0x6'));var util=require(_0x323b('0x7'));var path=require(_0x323b('0x8'));var sox=require(_0x323b('0x9'));var csv=require(_0x323b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x323b('0xb'));var _=require('lodash');var squel=require(_0x323b('0xc'));var crypto=require(_0x323b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x323b('0xe'));var toCsv=require(_0x323b('0xa'));var querystring=require(_0x323b('0xf'));var Papa=require('papaparse');var Redis=require(_0x323b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x323b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x323b('0x12'))('api');var utils=require(_0x323b('0x13'));var config=require(_0x323b('0x14'));var licenseUtil=require(_0x323b('0x15'));var db=require(_0x323b('0x16'))['db'];var dbH=require('../../mysqldb')[_0x323b('0x17')];function respondWithStatusCode(_0x4ef19d,_0x5b842a){_0x5b842a=_0x5b842a||0xcc;return function(_0x48508e){if(_0x48508e){return _0x4ef19d[_0x323b('0x18')](_0x5b842a);}return _0x4ef19d[_0x323b('0x19')](_0x5b842a)[_0x323b('0x1a')]();};}function respondWithResult(_0x4f6e5d,_0x42b77b){_0x42b77b=_0x42b77b||0xc8;return function(_0x8f64b0){if(_0x8f64b0){return _0x4f6e5d[_0x323b('0x19')](_0x42b77b)[_0x323b('0x1b')](_0x8f64b0);}};}function respondWithFilteredResult(_0xbb1eab,_0x13142c){return function(_0x4bc3a1){if(_0x4bc3a1){var _0x46705f=typeof _0x13142c[_0x323b('0x1c')]===_0x323b('0x1d')&&typeof _0x13142c['limit']===_0x323b('0x1d');var _0x4de4d2=_0x4bc3a1[_0x323b('0x1e')];var _0x3af07d=_0x46705f?0x0:_0x13142c[_0x323b('0x1c')];var _0x196924=_0x46705f?_0x4bc3a1[_0x323b('0x1e')]:_0x13142c[_0x323b('0x1c')]+_0x13142c['limit'];var _0x55cbe6;if(_0x196924>=_0x4de4d2){_0x196924=_0x4de4d2;_0x55cbe6=0xc8;}else{_0x55cbe6=0xce;}_0xbb1eab[_0x323b('0x19')](_0x55cbe6);return _0xbb1eab[_0x323b('0x1f')](_0x323b('0x20'),_0x3af07d+'-'+_0x196924+'/'+_0x4de4d2)[_0x323b('0x1b')](_0x4bc3a1);}return null;};}function patchUpdates(_0x3bc769){return function(_0x10c2b5){try{jsonpatch[_0x323b('0x21')](_0x10c2b5,_0x3bc769,!![]);}catch(_0x52645f){return BPromise[_0x323b('0x22')](_0x52645f);}return _0x10c2b5[_0x323b('0x23')]();};}function saveUpdates(_0x3c3fc2,_0x4d8153){return function(_0x35a73f){if(_0x35a73f){return _0x35a73f['update'](_0x3c3fc2)['then'](function(_0x52de08){return _0x52de08;});}return null;};}function removeEntity(_0x3c51fa,_0x371c2b){return function(_0x1413a5){if(_0x1413a5){return _0x1413a5[_0x323b('0x24')]()[_0x323b('0x25')](function(){var _0x52f947=_0x1413a5['get']({'plain':!![]});var _0x47d8b0=_0x323b('0x26');return db[_0x323b('0x27')][_0x323b('0x24')]({'where':{'type':_0x47d8b0,'resourceId':_0x52f947['id']}})[_0x323b('0x25')](function(){return _0x1413a5;});})[_0x323b('0x25')](function(){_0x3c51fa[_0x323b('0x19')](0xcc)[_0x323b('0x1a')]();});}};}function handleEntityNotFound(_0x318721,_0x215ce9){return function(_0x1f0dcc){if(!_0x1f0dcc){_0x318721[_0x323b('0x18')](0x194);}return _0x1f0dcc;};}function handleError(_0x499a3c,_0x828bd1){_0x828bd1=_0x828bd1||0x1f4;return function(_0x54d5bd){logger[_0x323b('0x28')](_0x54d5bd['stack']);if(_0x54d5bd[_0x323b('0x29')]){delete _0x54d5bd[_0x323b('0x29')];}_0x499a3c[_0x323b('0x19')](_0x828bd1)['send'](_0x54d5bd);};}exports['index']=function(_0x4aba3f,_0x241c7c){var _0x29e5b9={},_0x227848={},_0x2e9b13={'count':0x0,'rows':[]};var _0x318abe=_['map'](db[_0x323b('0x2a')][_0x323b('0x2b')],function(_0x5970c0){return{'name':_0x5970c0[_0x323b('0x2c')],'type':_0x5970c0[_0x323b('0x2d')][_0x323b('0x2e')]};});_0x227848[_0x323b('0x2f')]=_[_0x323b('0x30')](_0x318abe,_0x323b('0x29'));_0x227848[_0x323b('0x31')]=_[_0x323b('0x32')](_0x4aba3f['query']);_0x227848[_0x323b('0x33')]=_[_0x323b('0x34')](_0x227848['model'],_0x227848[_0x323b('0x31')]);_0x29e5b9[_0x323b('0x35')]=_[_0x323b('0x34')](_0x227848[_0x323b('0x2f')],qs[_0x323b('0x36')](_0x4aba3f['query'][_0x323b('0x36')]));_0x29e5b9[_0x323b('0x35')]=_0x29e5b9[_0x323b('0x35')][_0x323b('0x37')]?_0x29e5b9[_0x323b('0x35')]:_0x227848[_0x323b('0x2f')];if(!_0x4aba3f[_0x323b('0x31')]['hasOwnProperty'](_0x323b('0x38'))){_0x29e5b9['limit']=qs[_0x323b('0x39')](_0x4aba3f[_0x323b('0x31')]['limit']);_0x29e5b9['offset']=qs[_0x323b('0x1c')](_0x4aba3f[_0x323b('0x31')][_0x323b('0x1c')]);}_0x29e5b9[_0x323b('0x3a')]=qs[_0x323b('0x3b')](_0x4aba3f['query'][_0x323b('0x3b')]);_0x29e5b9[_0x323b('0x3c')]=qs[_0x323b('0x33')](_['pick'](_0x4aba3f[_0x323b('0x31')],_0x227848[_0x323b('0x33')]),_0x318abe);if(_0x4aba3f[_0x323b('0x31')][_0x323b('0x3d')]){_0x29e5b9[_0x323b('0x3c')]=_['merge'](_0x29e5b9[_0x323b('0x3c')],{'$or':_[_0x323b('0x30')](_0x318abe,function(_0x1feb54){if(_0x1feb54['type']!==_0x323b('0x3e')){var _0x2eef79={};_0x2eef79[_0x1feb54[_0x323b('0x29')]]={'$like':'%'+_0x4aba3f[_0x323b('0x31')][_0x323b('0x3d')]+'%'};return _0x2eef79;}})});}_0x29e5b9=_[_0x323b('0x3f')]({},_0x29e5b9,_0x4aba3f[_0x323b('0x40')]);var _0xc21534={'where':_0x29e5b9['where']};return db[_0x323b('0x2a')][_0x323b('0x1e')](_0xc21534)[_0x323b('0x25')](function(_0x204701){_0x2e9b13['count']=_0x204701;if(_0x4aba3f[_0x323b('0x31')][_0x323b('0x41')]){_0x29e5b9[_0x323b('0x42')]=[{'all':!![]}];}return db[_0x323b('0x2a')][_0x323b('0x43')](_0x29e5b9);})[_0x323b('0x25')](function(_0x1899f7){_0x2e9b13[_0x323b('0x44')]=_0x1899f7;return _0x2e9b13;})[_0x323b('0x25')](respondWithFilteredResult(_0x241c7c,_0x29e5b9))['catch'](handleError(_0x241c7c,null));};exports[_0x323b('0x45')]=function(_0x4e429c,_0x3e52f4){var _0x46d7f3={'raw':![],'where':{'id':_0x4e429c[_0x323b('0x46')]['id']}},_0x2d5f9e={};_0x2d5f9e[_0x323b('0x2f')]=_[_0x323b('0x32')](db[_0x323b('0x2a')][_0x323b('0x2b')]);_0x2d5f9e[_0x323b('0x31')]=_[_0x323b('0x32')](_0x4e429c['query']);_0x2d5f9e[_0x323b('0x33')]=_[_0x323b('0x34')](_0x2d5f9e[_0x323b('0x2f')],_0x2d5f9e['query']);_0x46d7f3['attributes']=_[_0x323b('0x34')](_0x2d5f9e[_0x323b('0x2f')],qs[_0x323b('0x36')](_0x4e429c[_0x323b('0x31')][_0x323b('0x36')]));_0x46d7f3[_0x323b('0x35')]=_0x46d7f3[_0x323b('0x35')][_0x323b('0x37')]?_0x46d7f3[_0x323b('0x35')]:_0x2d5f9e[_0x323b('0x2f')];if(_0x4e429c[_0x323b('0x31')][_0x323b('0x41')]){_0x46d7f3[_0x323b('0x42')]=[{'all':!![]}];}_0x46d7f3=_[_0x323b('0x3f')]({},_0x46d7f3,_0x4e429c[_0x323b('0x40')]);return db[_0x323b('0x2a')]['find'](_0x46d7f3)['then'](handleEntityNotFound(_0x3e52f4,null))[_0x323b('0x25')](respondWithResult(_0x3e52f4,null))['catch'](handleError(_0x3e52f4,null));};exports[_0x323b('0x47')]=function(_0x1e2d7a,_0xf517a1){return db[_0x323b('0x2a')][_0x323b('0x47')](_0x1e2d7a['body'],{})[_0x323b('0x25')](function(_0x3d4ce0){var _0x1076f1=_0x1e2d7a[_0x323b('0x48')]['get']({'plain':!![]});if(!_0x1076f1)throw new Error(_0x323b('0x49'));if(_0x1076f1[_0x323b('0x4a')]===_0x323b('0x48')){var _0xd3dae3=_0x3d4ce0[_0x323b('0x4b')]({'plain':!![]});var _0x141226='Reports';return db['UserProfileSection'][_0x323b('0x4c')]({'where':{'name':_0x141226,'userProfileId':_0x1076f1[_0x323b('0x4d')]},'raw':!![]})[_0x323b('0x25')](function(_0x910ae2){if(_0x910ae2&&_0x910ae2[_0x323b('0x4e')]===0x0){return db['UserProfileResource'][_0x323b('0x47')]({'name':_0xd3dae3[_0x323b('0x29')],'resourceId':_0xd3dae3['id'],'type':'CustomReports','sectionId':_0x910ae2['id']},{})[_0x323b('0x25')](function(){return _0x3d4ce0;});}else{return _0x3d4ce0;}})['catch'](function(_0x2b92c9){logger[_0x323b('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b92c9);throw _0x2b92c9;});}return _0x3d4ce0;})[_0x323b('0x25')](respondWithResult(_0xf517a1,0xc9))[_0x323b('0x4f')](handleError(_0xf517a1,null));};exports[_0x323b('0x50')]=function(_0x8ca848,_0x27cf10){if(_0x8ca848[_0x323b('0x51')]['id']){delete _0x8ca848[_0x323b('0x51')]['id'];}return db['AnalyticCustomReport'][_0x323b('0x4c')]({'where':{'id':_0x8ca848[_0x323b('0x46')]['id']}})[_0x323b('0x25')](handleEntityNotFound(_0x27cf10,null))[_0x323b('0x25')](saveUpdates(_0x8ca848['body'],null))[_0x323b('0x25')](respondWithResult(_0x27cf10,null))[_0x323b('0x4f')](handleError(_0x27cf10,null));};exports[_0x323b('0x24')]=function(_0x14ffcf,_0x2d5b87){return db['AnalyticCustomReport'][_0x323b('0x4c')]({'where':{'id':_0x14ffcf[_0x323b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d5b87,null))[_0x323b('0x25')](removeEntity(_0x2d5b87,null))['catch'](handleError(_0x2d5b87,null));};exports[_0x323b('0x52')]=function(_0x2845a4,_0x157df1){var _0x2f7875=0xa;var _0x4fd33b=[_0x323b('0x53'),'left_join',_0x323b('0x54'),_0x323b('0x55')];var _0x1a568c={'SUM':_0x323b('0x56'),'COUNT':_0x323b('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x323b('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x323b('0x59'),'GROUP_CONCAT ASC':_0x323b('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5c9aba={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x323b('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x323b('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x52a2f4=function(_0x26addd){return!_['includes']([_0x323b('0x5d'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x323b('0x5e')],_0x26addd);};var _0x37d30a=function(_0x53b78a){if(!_0x53b78a||!_0x53b78a[_0x323b('0x5f')][_0x323b('0x37')]){return'';}for(var _0x2e98c0='(',_0x5aa71c=0x0;_0x5aa71c<_0x53b78a['rules'][_0x323b('0x37')];_0x5aa71c+=0x1){_0x5aa71c>0x0&&(_0x2e98c0+='\x20'+_0x53b78a[_0x323b('0x60')]+'\x20');_0x2e98c0+=_0x53b78a[_0x323b('0x5f')][_0x5aa71c][_0x323b('0x61')]?_0x37d30a(_0x53b78a[_0x323b('0x5f')][_0x5aa71c]['group']):_0x53b78a[_0x323b('0x5f')][_0x5aa71c][_0x323b('0x62')]+'\x20'+_0x53b78a['rules'][_0x5aa71c][_0x323b('0x63')]+(_0x52a2f4(_0x53b78a[_0x323b('0x5f')][_0x5aa71c]['condition'])?'\x20'+_0x53b78a[_0x323b('0x5f')][_0x5aa71c][_0x323b('0x64')]:'');}return _0x2e98c0+')';};var _0x5998f4={'where':{'id':_0x2845a4[_0x323b('0x46')]['id']}},_0x336d4b,_0x2a0c78,_0x225422,_0x1713db,_0x509ca1;_0x5998f4=_[_0x323b('0x3f')]({},_0x5998f4,_0x2845a4['options']);return db[_0x323b('0x2a')][_0x323b('0x4c')](_0x5998f4)[_0x323b('0x25')](function(_0xe43e6b){if(_0xe43e6b){_0x336d4b=_0xe43e6b;return _0xe43e6b[_0x323b('0x65')]();}return null;})['then'](function(_0x937ebf){if(_0x937ebf){if(!_0x937ebf[_0x323b('0x37')]){throw new db[(_0x323b('0x66'))][(_0x323b('0x67'))](_0x323b('0x68'),0x193);}_0x2a0c78=_0x937ebf;return db[_0x323b('0x69')][_0x323b('0x43')]({'raw':!![]});}return null;})[_0x323b('0x25')](function(_0x4c24b2){if(_0x4c24b2){_0x225422=_['keyBy'](_0x4c24b2,'id');var _0x5619a3;var _0x4c773a=squel['select']();_0x4c773a[_0x323b('0x6a')](_0x336d4b['table']);for(var _0x420719=0x0;_0x420719<_0x2a0c78[_0x323b('0x37')];_0x420719+=0x1){_0x5619a3=_0x2a0c78[_0x420719][_0x323b('0x6b')]?_0x225422[_0x2a0c78[_0x420719]['MetricId']][_0x323b('0x6c')]:_0x2a0c78[_0x420719][_0x323b('0x62')];_0x5619a3=_0x2a0c78[_0x420719][_0x323b('0x6d')]?_['replace'](_0x1a568c[_0x2a0c78[_0x420719][_0x323b('0x6d')]],'%s',_0x5619a3):_0x5619a3;_0x5619a3=_0x2a0c78[_0x420719][_0x323b('0x6e')]?_['replace'](_0x5c9aba[_0x2a0c78[_0x420719][_0x323b('0x6e')]],'%s',_0x5619a3):_0x5619a3;if(_0x2a0c78[_0x420719]['groupBy']){_0x4c773a[_0x323b('0x61')](_0x5619a3);}_0x2a0c78[_0x420719][_0x323b('0x6f')]&&_0x4c773a[_0x323b('0x3a')](_0x5619a3,_0x2a0c78[_0x420719][_0x323b('0x6f')]===_0x323b('0x70')?![]:!![]);_0x4c773a[_0x323b('0x62')](_0x5619a3,_0x2a0c78[_0x420719][_0x323b('0x71')]||_0x5619a3);}if(_0x336d4b[_0x323b('0x72')]){_0x336d4b[_0x323b('0x72')]=JSON[_0x323b('0x73')](_0x336d4b[_0x323b('0x72')]);for(var _0x224d20=0x0;_0x224d20<_0x336d4b[_0x323b('0x72')]['length'];_0x224d20+=0x1){if(_0x336d4b['joins'][_0x224d20][_0x323b('0x2d')]&&_['includes'](_0x4fd33b,_0x336d4b[_0x323b('0x72')][_0x224d20]['type'])&&_0x336d4b['joins'][_0x224d20][_0x323b('0x74')]&&_0x336d4b[_0x323b('0x72')][_0x224d20]['foreignTable']&&_0x336d4b['joins'][_0x224d20][_0x323b('0x75')]){_0x4c773a[_0x336d4b[_0x323b('0x72')][_0x224d20][_0x323b('0x2d')]](_0x336d4b[_0x323b('0x72')][_0x224d20][_0x323b('0x76')],null,util[_0x323b('0x6e')](_0x323b('0x77'),_0x336d4b[_0x323b('0x78')],_0x336d4b[_0x323b('0x72')][_0x224d20][_0x323b('0x74')],_0x336d4b[_0x323b('0x72')][_0x224d20][_0x323b('0x76')],_0x336d4b[_0x323b('0x72')][_0x224d20]['foreignKey']));}}}if(_0x336d4b[_0x323b('0x79')]){_0x336d4b[_0x323b('0x79')]=JSON['parse'](_0x336d4b[_0x323b('0x79')]);_0x4c773a[_0x323b('0x3c')](_0x37d30a(_0x336d4b[_0x323b('0x79')]['group']));}_0x509ca1=_0x4c773a['clone']();_0x4c773a['limit'](_0x2f7875);_0x4c773a[_0x323b('0x1c')](0x0);logger[_0x323b('0x7a')](_0x323b('0x7b'),_0x4c773a['toString']());return dbH[_0x323b('0x7c')][_0x323b('0x31')](_0x4c773a[_0x323b('0x7d')](),{'type':dbH[_0x323b('0x7c')][_0x323b('0x7e')]['SELECT']});}})[_0x323b('0x25')](respondWithResult(_0x157df1,null))['catch'](handleError(_0x157df1,null));};function runReport(_0x32990a,_0x45ef54,_0x568b58){var _0xd37d62=_0x45ef54[_0x323b('0x29')];var _0x2c8186=0xa;var _0x32e636=[_0x323b('0x53'),_0x323b('0x7f'),_0x323b('0x54'),_0x323b('0x55')];var _0xcc0a22={'SUM':_0x323b('0x56'),'COUNT':_0x323b('0x57'),'COUNT DISTINCT':_0x323b('0x80'),'MAX':'MAX(%s)','MIN':_0x323b('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x323b('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x16c56c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x323b('0x5b'),'HOUR':_0x323b('0x81'),'ROUND':_0x323b('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3ce5e3=function(_0x1de1ac){return!_[_0x323b('0x82')]([_0x323b('0x5d'),_0x323b('0x83'),_0x323b('0x84'),'IS\x20NOT\x20EMPTY'],_0x1de1ac);};var _0x508a0e=function(_0x1a4f9b){if(!_0x1a4f9b||!_0x1a4f9b[_0x323b('0x5f')]['length']){return'';}for(var _0x30d401='(',_0x1b1c14=0x0;_0x1b1c14<_0x1a4f9b[_0x323b('0x5f')][_0x323b('0x37')];_0x1b1c14+=0x1){_0x1b1c14>0x0&&(_0x30d401+='\x20'+_0x1a4f9b['operator']+'\x20');_0x30d401+=_0x1a4f9b['rules'][_0x1b1c14][_0x323b('0x61')]?_0x508a0e(_0x1a4f9b[_0x323b('0x5f')][_0x1b1c14][_0x323b('0x61')]):_0x1a4f9b['rules'][_0x1b1c14][_0x323b('0x62')]+'\x20'+_0x1a4f9b[_0x323b('0x5f')][_0x1b1c14]['condition']+(_0x3ce5e3(_0x1a4f9b['rules'][_0x1b1c14]['condition'])?'\x20'+_0x1a4f9b[_0x323b('0x5f')][_0x1b1c14][_0x323b('0x64')]:'');}return _0x30d401+')';};var _0x1575ef={'where':{'id':_0x32990a['id']}},_0x180797,_0x749358,_0x2709cb,_0x3531cc,_0xdf3cc2;_0x1575ef=_[_0x323b('0x3f')]({},_0x1575ef,_0x568b58);return db[_0x323b('0x2a')][_0x323b('0x4c')](_0x1575ef)[_0x323b('0x25')](function(_0x5624f2){if(_0x5624f2){_0x180797=_0x5624f2;return _0x5624f2['getFields']();}return null;})['then'](function(_0x3d6821){if(_0x3d6821){if(!_0x3d6821[_0x323b('0x37')]){throw new db[(_0x323b('0x66'))]['ValidationErrorItem'](_0x323b('0x68'),0x193);}_0x749358=_0x3d6821;return db[_0x323b('0x69')][_0x323b('0x43')]({'raw':!![]});}return null;})[_0x323b('0x25')](function(_0x4603e8){if(_0x4603e8){_0x2709cb=_[_0x323b('0x85')](_0x4603e8,'id');var _0x41b79d;var _0x20b11a=squel[_0x323b('0x86')]();_0x20b11a[_0x323b('0x6a')](_0x180797[_0x323b('0x78')]);for(var _0x51c057=0x0;_0x51c057<_0x749358[_0x323b('0x37')];_0x51c057+=0x1){_0x41b79d=_0x749358[_0x51c057][_0x323b('0x6b')]?_0x2709cb[_0x749358[_0x51c057][_0x323b('0x6b')]]['metric']:_0x749358[_0x51c057][_0x323b('0x62')];_0x41b79d=_0x749358[_0x51c057][_0x323b('0x6d')]?_[_0x323b('0x87')](_0xcc0a22[_0x749358[_0x51c057][_0x323b('0x6d')]],'%s',_0x41b79d):_0x41b79d;_0x41b79d=_0x749358[_0x51c057][_0x323b('0x6e')]?_[_0x323b('0x87')](_0x16c56c[_0x749358[_0x51c057]['format']],'%s',_0x41b79d):_0x41b79d;if(_0x749358[_0x51c057][_0x323b('0x88')]){_0x20b11a[_0x323b('0x61')](_0x41b79d);}_0x749358[_0x51c057][_0x323b('0x6f')]&&_0x20b11a[_0x323b('0x3a')](_0x41b79d,_0x749358[_0x51c057][_0x323b('0x6f')]===_0x323b('0x70')?![]:!![]);_0x20b11a['field'](_0x41b79d,_0x749358[_0x51c057]['alias']||_0x41b79d);}if(_0x180797[_0x323b('0x72')]){_0x180797[_0x323b('0x72')]=JSON['parse'](_0x180797[_0x323b('0x72')]);for(var _0x35a9df=0x0;_0x35a9df<_0x180797['joins'][_0x323b('0x37')];_0x35a9df+=0x1){if(_0x180797[_0x323b('0x72')][_0x35a9df][_0x323b('0x2d')]&&_[_0x323b('0x82')](_0x32e636,_0x180797['joins'][_0x35a9df][_0x323b('0x2d')])&&_0x180797[_0x323b('0x72')][_0x35a9df]['parentKey']&&_0x180797[_0x323b('0x72')][_0x35a9df][_0x323b('0x76')]&&_0x180797[_0x323b('0x72')][_0x35a9df]['foreignKey']){_0x20b11a[_0x180797['joins'][_0x35a9df]['type']](_0x180797['joins'][_0x35a9df][_0x323b('0x76')],null,util['format'](_0x323b('0x77'),_0x180797[_0x323b('0x78')],_0x180797['joins'][_0x35a9df][_0x323b('0x74')],_0x180797['joins'][_0x35a9df][_0x323b('0x76')],_0x180797['joins'][_0x35a9df][_0x323b('0x75')]));}}}if(_0x180797[_0x323b('0x79')]){_0x180797[_0x323b('0x79')]=JSON[_0x323b('0x73')](_0x180797['conditions']);_0x20b11a[_0x323b('0x3c')](_0x508a0e(_0x180797[_0x323b('0x79')]['group']));}_0xdf3cc2=_0x20b11a[_0x323b('0x89')]();_0x20b11a[_0x323b('0x39')](_0x2c8186);_0x20b11a[_0x323b('0x1c')](0x0);return;}})[_0x323b('0x25')](function(){if(_0x45ef54[_0x323b('0x8a')]===_0x323b('0x8b')){return null;}var _0x35d007=_[_0x323b('0x3f')](_0x45ef54,{'name':_0x45ef54[_0x323b('0x8c')]||_0x45ef54[_0x323b('0x29')]||_0x180797[_0x323b('0x29')],'basename':_0xd37d62,'savename':util['format'](_0x323b('0x8d'),_0x45ef54[_0x323b('0x29')]||_0x180797[_0x323b('0x29')],require(_0x323b('0x8e'))[_0x323b('0x8f')](0x4),_0x45ef54['output']||_0x323b('0x90')),'reportId':_0x180797['id'],'reportType':'custom'});return db[_0x323b('0x91')]['create'](_0x35d007,{'raw':!![]});})[_0x323b('0x25')](function(_0xb10582){if(_0x180797[_0x323b('0x78')]===_0x323b('0x92')){_0xdf3cc2[_0x323b('0x3c')](_0x180797[_0x323b('0x78')]+_0x323b('0x93'),_0x45ef54[_0x323b('0x94')],_0x45ef54['endDate']);}else{_0xdf3cc2['where'](_0x180797[_0x323b('0x78')]+_0x323b('0x95'),_0x45ef54[_0x323b('0x94')],_0x45ef54[_0x323b('0x96')]);}if(_0xb10582){logger[_0x323b('0x97')](_0x323b('0x98'),_0xdf3cc2[_0x323b('0x7d')]());require('child_process')[_0x323b('0x99')](path[_0x323b('0x53')](__dirname,_0x323b('0x9a'),_0xb10582['output']),[_0xb10582['id'],_0xdf3cc2[_0x323b('0x7d')](),path[_0x323b('0x53')](__dirname,_0x323b('0x9b'),_0xb10582['savename']),_0xd37d62]);return _0xb10582;}else{var _0x33bf3e=squel['select']();_0x33bf3e[_0x323b('0x6a')]('('+_0xdf3cc2[_0x323b('0x7d')]()+')',_0x323b('0x9c'));_0x33bf3e[_0x323b('0x62')](_0x323b('0x9d'),'count');_0xdf3cc2[_0x323b('0x39')](_0x45ef54['limit']||_0x2c8186);_0xdf3cc2[_0x323b('0x1c')](_0x45ef54['offset']||0x0);return dbH[_0x323b('0x7c')][_0x323b('0x31')](_0x33bf3e[_0x323b('0x7d')](),{'type':dbH['sequelize']['QueryTypes'][_0x323b('0x9e')]})[_0x323b('0x25')](function(_0x4f8b5c){if(!_0x4f8b5c['length']){_0x3531cc=0x0;}else{_0x3531cc=_0x4f8b5c[0x0][_0x323b('0x1e')]||0x0;}return dbH[_0x323b('0x7c')][_0x323b('0x31')](_0xdf3cc2['toString'](),{'type':dbH['sequelize'][_0x323b('0x7e')][_0x323b('0x9e')]});})['then'](function(_0x9cc796){return{'rows':_0x9cc796||[],'count':_0x3531cc};});}});}exports['run']=function(_0x57d73f,_0xc9f81a){return runReport(_0x57d73f[_0x323b('0x46')],_0x57d73f['query'],_0x57d73f[_0x323b('0x40')])[_0x323b('0x25')](respondWithResult(_0xc9f81a,null))[_0x323b('0x4f')](handleError(_0xc9f81a,null));};exports[_0x323b('0x9f')]=runReport;exports[_0x323b('0x31')]=function(_0x1e6ef6,_0x37306c){var _0x25b8b6=0xa;var _0x7c1e7f=[_0x323b('0x53'),_0x323b('0x7f'),_0x323b('0x54'),_0x323b('0x55')];var _0x461a2c={'SUM':_0x323b('0x56'),'COUNT':_0x323b('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x323b('0xa0'),'MIN':'MIN(%s)','AVG':_0x323b('0xa1'),'GROUP_CONCAT':_0x323b('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x323b('0xa2')};var _0x2592e6={'SEC_TO_TIME':_0x323b('0xa3'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x323b('0xa4')};var _0x2190ff=function(_0x51359e){return!_[_0x323b('0x82')]([_0x323b('0x5d'),_0x323b('0x83'),_0x323b('0x84'),_0x323b('0x5e')],_0x51359e);};var _0x127444=function(_0x1f80f5){if(!_0x1f80f5||!_0x1f80f5[_0x323b('0x5f')][_0x323b('0x37')]){return'';}for(var _0x52a735='(',_0x1abec6=0x0;_0x1abec6<_0x1f80f5[_0x323b('0x5f')]['length'];_0x1abec6+=0x1){_0x1abec6>0x0&&(_0x52a735+='\x20'+_0x1f80f5[_0x323b('0x60')]+'\x20');_0x52a735+=_0x1f80f5['rules'][_0x1abec6][_0x323b('0x61')]?_0x127444(_0x1f80f5[_0x323b('0x5f')][_0x1abec6]['group']):_0x1f80f5['rules'][_0x1abec6]['field']+'\x20'+_0x1f80f5[_0x323b('0x5f')][_0x1abec6]['condition']+(_0x2190ff(_0x1f80f5[_0x323b('0x5f')][_0x1abec6][_0x323b('0x63')])?'\x20'+_0x1f80f5['rules'][_0x1abec6][_0x323b('0x64')]:'');}return _0x52a735+')';};var _0x4c1822={'where':{'id':_0x1e6ef6[_0x323b('0x46')]['id']}},_0x43eb11,_0x4c8450,_0xfe3003,_0x288562,_0x826e70;_0x4c1822=_[_0x323b('0x3f')]({},_0x4c1822,_0x1e6ef6[_0x323b('0x40')]);return db['AnalyticCustomReport'][_0x323b('0x4c')](_0x4c1822)[_0x323b('0x25')](function(_0x164f75){if(_0x164f75){_0x43eb11=_0x164f75;return _0x164f75[_0x323b('0x65')]();}return null;})[_0x323b('0x25')](function(_0x1afe93){if(_0x1afe93){if(!_0x1afe93[_0x323b('0x37')]){throw new db[(_0x323b('0x66'))]['ValidationErrorItem'](_0x323b('0x68'),0x193);}_0x4c8450=_0x1afe93;return db[_0x323b('0x69')]['findAll']({'raw':!![]});}return null;})[_0x323b('0x25')](function(_0x395cab){if(_0x395cab){_0xfe3003=_[_0x323b('0x85')](_0x395cab,'id');var _0x4da285;var _0x2406e9=squel['select']();_0x2406e9[_0x323b('0x6a')](_0x43eb11[_0x323b('0x78')]);for(var _0x18c755=0x0;_0x18c755<_0x4c8450[_0x323b('0x37')];_0x18c755+=0x1){_0x4da285=_0x4c8450[_0x18c755][_0x323b('0x6b')]?_0xfe3003[_0x4c8450[_0x18c755][_0x323b('0x6b')]]['metric']:_0x4c8450[_0x18c755][_0x323b('0x62')];_0x4da285=_0x4c8450[_0x18c755][_0x323b('0x6d')]?_[_0x323b('0x87')](_0x461a2c[_0x4c8450[_0x18c755][_0x323b('0x6d')]],'%s',_0x4da285):_0x4da285;_0x4da285=_0x4c8450[_0x18c755][_0x323b('0x6e')]?_[_0x323b('0x87')](_0x2592e6[_0x4c8450[_0x18c755]['format']],'%s',_0x4da285):_0x4da285;if(_0x4c8450[_0x18c755][_0x323b('0x88')]){_0x2406e9[_0x323b('0x61')](_0x4da285);}_0x4c8450[_0x18c755][_0x323b('0x6f')]&&_0x2406e9[_0x323b('0x3a')](_0x4da285,_0x4c8450[_0x18c755][_0x323b('0x6f')]===_0x323b('0x70')?![]:!![]);_0x2406e9[_0x323b('0x62')](_0x4da285,_0x4c8450[_0x18c755][_0x323b('0x71')]||_0x4da285);}if(_0x43eb11['joins']){_0x43eb11[_0x323b('0x72')]=JSON['parse'](_0x43eb11[_0x323b('0x72')]);for(var _0x47248e=0x0;_0x47248e<_0x43eb11[_0x323b('0x72')]['length'];_0x47248e+=0x1){if(_0x43eb11['joins'][_0x47248e]['type']&&_[_0x323b('0x82')](_0x7c1e7f,_0x43eb11[_0x323b('0x72')][_0x47248e][_0x323b('0x2d')])&&_0x43eb11[_0x323b('0x72')][_0x47248e][_0x323b('0x74')]&&_0x43eb11['joins'][_0x47248e][_0x323b('0x76')]&&_0x43eb11[_0x323b('0x72')][_0x47248e]['foreignKey']){_0x2406e9[_0x43eb11[_0x323b('0x72')][_0x47248e][_0x323b('0x2d')]](_0x43eb11[_0x323b('0x72')][_0x47248e][_0x323b('0x76')],null,util[_0x323b('0x6e')](_0x323b('0x77'),_0x43eb11[_0x323b('0x78')],_0x43eb11[_0x323b('0x72')][_0x47248e][_0x323b('0x74')],_0x43eb11[_0x323b('0x72')][_0x47248e][_0x323b('0x76')],_0x43eb11[_0x323b('0x72')][_0x47248e][_0x323b('0x75')]));}}}if(_0x43eb11['conditions']){_0x43eb11[_0x323b('0x79')]=JSON[_0x323b('0x73')](_0x43eb11['conditions']);_0x2406e9[_0x323b('0x3c')](_0x127444(_0x43eb11[_0x323b('0x79')][_0x323b('0x61')]));}_0x826e70=_0x2406e9[_0x323b('0x89')]();_0x2406e9[_0x323b('0x39')](_0x25b8b6);_0x2406e9[_0x323b('0x1c')](0x0);logger[_0x323b('0x7a')]('Limited\x20Query:',_0x2406e9[_0x323b('0x7d')]());return dbH[_0x323b('0x7c')][_0x323b('0x31')](_0x2406e9['toString'](),{'type':dbH[_0x323b('0x7c')]['QueryTypes']['SELECT']});}})[_0x323b('0x25')](function(){return{'sql':_0x826e70[_0x323b('0x7d')]()};})[_0x323b('0x25')](respondWithResult(_0x37306c,null))['catch'](handleError(_0x37306c,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index f085635..009a9b6 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 _0x5ab2=['rimraf','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport','lodash','util','api','bluebird','request-promise','path'];(function(_0x21b037,_0x1f310a){var _0x20556c=function(_0x1855a9){while(--_0x1855a9){_0x21b037['push'](_0x21b037['shift']());}};_0x20556c(++_0x1f310a);}(_0x5ab2,0xc0));var _0x25ab=function(_0x301a61,_0x48678b){_0x301a61=_0x301a61-0x0;var _0xc8c459=_0x5ab2[_0x301a61];return _0xc8c459;};'use strict';var _=require(_0x25ab('0x0'));var util=require(_0x25ab('0x1'));var logger=require('../../config/logger')(_0x25ab('0x2'));var moment=require('moment');var BPromise=require(_0x25ab('0x3'));var rp=require(_0x25ab('0x4'));var fs=require('fs');var path=require(_0x25ab('0x5'));var rimraf=require(_0x25ab('0x6'));var config=require(_0x25ab('0x7'));var attributes=require(_0x25ab('0x8'));module[_0x25ab('0x9')]=function(_0x27deb4,_0x100d25){return _0x27deb4['define'](_0x25ab('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x668f=['moment','bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x27fb10,_0x1a125f){var _0x567e0c=function(_0x14e4d3){while(--_0x14e4d3){_0x27fb10['push'](_0x27fb10['shift']());}};_0x567e0c(++_0x1a125f);}(_0x668f,0x154));var _0xf668=function(_0x548bc7,_0x34515b){_0x548bc7=_0x548bc7-0x0;var _0x4a7392=_0x668f[_0x548bc7];return _0x4a7392;};'use strict';var _=require(_0xf668('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf668('0x1'));var BPromise=require(_0xf668('0x2'));var rp=require(_0xf668('0x3'));var fs=require('fs');var path=require(_0xf668('0x4'));var rimraf=require(_0xf668('0x5'));var config=require('../../config/environment');var attributes=require(_0xf668('0x6'));module[_0xf668('0x7')]=function(_0x4ee015,_0x346cae){return _0x4ee015[_0xf668('0x8')](_0xf668('0x9'),attributes,{'tableName':_0xf668('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 7849167..cc9ac53 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 _0xe75b=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x24b116,_0x4478fb){var _0x4ca8d2=function(_0x193d50){while(--_0x193d50){_0x24b116['push'](_0x24b116['shift']());}};_0x4ca8d2(++_0x4478fb);}(_0xe75b,0x186));var _0xbe75=function(_0x1bf033,_0xd847fe){_0x1bf033=_0x1bf033-0x0;var _0x37075b=_0xe75b[_0x1bf033];return _0x37075b;};'use strict';var _=require(_0xbe75('0x0'));var util=require(_0xbe75('0x1'));var moment=require(_0xbe75('0x2'));var BPromise=require(_0xbe75('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe75('0x4'));var db=require(_0xbe75('0x5'))['db'];var utils=require(_0xbe75('0x6'));var logger=require(_0xbe75('0x7'))(_0xbe75('0x8'));var config=require(_0xbe75('0x9'));var jayson=require(_0xbe75('0xa'));var client=jayson[_0xbe75('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x493d1a,_0x2883bd,_0x43735b){return new BPromise(function(_0x4b616d,_0x325595){return client[_0xbe75('0xc')](_0x493d1a,_0x43735b)[_0xbe75('0xd')](function(_0x2e977c){logger[_0xbe75('0xe')](_0xbe75('0xf'),_0x2883bd,_0xbe75('0x10'));logger[_0xbe75('0x11')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x2883bd,_0xbe75('0x10'),JSON[_0xbe75('0x12')](_0x2e977c));if(_0x2e977c[_0xbe75('0x13')]){if(_0x2e977c[_0xbe75('0x13')][_0xbe75('0x14')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x2883bd,_0x2e977c[_0xbe75('0x13')]['message']);return _0x325595(_0x2e977c[_0xbe75('0x13')][_0xbe75('0x15')]);}logger[_0xbe75('0x13')](_0xbe75('0xf'),_0x2883bd,_0x2e977c[_0xbe75('0x13')]['message']);return _0x4b616d(_0x2e977c[_0xbe75('0x13')][_0xbe75('0x15')]);}else{logger[_0xbe75('0xe')](_0xbe75('0xf'),_0x2883bd,_0xbe75('0x10'));_0x4b616d(_0x2e977c[_0xbe75('0x16')][_0xbe75('0x15')]);}})[_0xbe75('0x17')](function(_0x3c6566){logger[_0xbe75('0x13')](_0xbe75('0xf'),_0x2883bd,_0x3c6566);_0x325595(_0x3c6566);});});} \ No newline at end of file +var _0xac94=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent','debug','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','lodash','util','moment'];(function(_0x27fd1d,_0x2c7271){var _0x41b9af=function(_0x5cf451){while(--_0x5cf451){_0x27fd1d['push'](_0x27fd1d['shift']());}};_0x41b9af(++_0x2c7271);}(_0xac94,0x6b));var _0x4ac9=function(_0x4cab36,_0x27aa8f){_0x4cab36=_0x4cab36-0x0;var _0x1eca64=_0xac94[_0x4cab36];return _0x1eca64;};'use strict';var _=require(_0x4ac9('0x0'));var util=require(_0x4ac9('0x1'));var moment=require(_0x4ac9('0x2'));var BPromise=require(_0x4ac9('0x3'));var rs=require(_0x4ac9('0x4'));var fs=require('fs');var Redis=require(_0x4ac9('0x5'));var db=require(_0x4ac9('0x6'))['db'];var utils=require(_0x4ac9('0x7'));var logger=require(_0x4ac9('0x8'))(_0x4ac9('0x9'));var config=require(_0x4ac9('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4ac9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b0414,_0x160c68,_0xf46f8){return new BPromise(function(_0x3a5d58,_0x595c06){return client[_0x4ac9('0xc')](_0x4b0414,_0xf46f8)[_0x4ac9('0xd')](function(_0x5bfd42){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x160c68,_0x4ac9('0xe'));logger[_0x4ac9('0xf')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x160c68,_0x4ac9('0xe'),JSON[_0x4ac9('0x10')](_0x5bfd42));if(_0x5bfd42[_0x4ac9('0x11')]){if(_0x5bfd42[_0x4ac9('0x11')][_0x4ac9('0x12')]===0x1f4){logger[_0x4ac9('0x11')](_0x4ac9('0x13'),_0x160c68,_0x5bfd42[_0x4ac9('0x11')][_0x4ac9('0x14')]);return _0x595c06(_0x5bfd42[_0x4ac9('0x11')][_0x4ac9('0x14')]);}logger['error'](_0x4ac9('0x13'),_0x160c68,_0x5bfd42[_0x4ac9('0x11')][_0x4ac9('0x14')]);return _0x3a5d58(_0x5bfd42['error'][_0x4ac9('0x14')]);}else{logger[_0x4ac9('0x15')](_0x4ac9('0x13'),_0x160c68,_0x4ac9('0xe'));_0x3a5d58(_0x5bfd42['result'][_0x4ac9('0x14')]);}})['catch'](function(_0x4f1a8c){logger[_0x4ac9('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x160c68,_0x4f1a8c);_0x595c06(_0x4f1a8c);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 5fec88a..0d32597 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 _0x6a8b=['isAuthenticated','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./analyticCustomReport.controller','get','/:id'];(function(_0x5e5a3b,_0x4891a2){var _0x35b67d=function(_0x49aa86){while(--_0x49aa86){_0x5e5a3b['push'](_0x5e5a3b['shift']());}};_0x35b67d(++_0x4891a2);}(_0x6a8b,0x1f0));var _0xb6a8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6a8b[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xb6a8('0x0'));var util=require(_0xb6a8('0x1'));var path=require('path');var timeout=require(_0xb6a8('0x2'));var express=require(_0xb6a8('0x3'));var router=express[_0xb6a8('0x4')]();var fs_extra=require(_0xb6a8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb6a8('0x6'));var controller=require(_0xb6a8('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb6a8('0x8')](_0xb6a8('0x9'),auth[_0xb6a8('0xa')](),controller['show']);router['get'](_0xb6a8('0xb'),auth['isAuthenticated'](),controller[_0xb6a8('0xc')]);router[_0xb6a8('0x8')](_0xb6a8('0xd'),auth[_0xb6a8('0xa')](),controller[_0xb6a8('0xe')]);router[_0xb6a8('0x8')](_0xb6a8('0xf'),auth['isAuthenticated'](),controller['query']);router[_0xb6a8('0x10')]('/',auth[_0xb6a8('0xa')](),controller[_0xb6a8('0x11')]);router[_0xb6a8('0x12')](_0xb6a8('0x9'),auth['isAuthenticated'](),controller[_0xb6a8('0x13')]);router['delete'](_0xb6a8('0x9'),auth[_0xb6a8('0xa')](),controller[_0xb6a8('0x14')]);module[_0xb6a8('0x15')]=router; \ No newline at end of file +var _0xdde8=['/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdde8,0x1a8));var _0x8dde=function(_0x2095a6,_0x3585ed){_0x2095a6=_0x2095a6-0x0;var _0x22e3c2=_0xdde8[_0x2095a6];return _0x22e3c2;};'use strict';var multer=require(_0x8dde('0x0'));var util=require(_0x8dde('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8dde('0x2')]();var fs_extra=require(_0x8dde('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8dde('0x4'));var config=require(_0x8dde('0x5'));var controller=require(_0x8dde('0x6'));router[_0x8dde('0x7')]('/',auth[_0x8dde('0x8')](),controller['index']);router['get'](_0x8dde('0x9'),auth[_0x8dde('0x8')](),controller[_0x8dde('0xa')]);router[_0x8dde('0x7')](_0x8dde('0xb'),auth[_0x8dde('0x8')](),controller[_0x8dde('0xc')]);router[_0x8dde('0x7')](_0x8dde('0xd'),auth['isAuthenticated'](),controller[_0x8dde('0xe')]);router[_0x8dde('0x7')](_0x8dde('0xf'),auth[_0x8dde('0x8')](),controller[_0x8dde('0x10')]);router[_0x8dde('0x11')]('/',auth[_0x8dde('0x8')](),controller[_0x8dde('0x12')]);router[_0x8dde('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x8dde('0x14')]);router[_0x8dde('0x15')](_0x8dde('0x9'),auth[_0x8dde('0x8')](),controller[_0x8dde('0x16')]);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 624f076..34d2887 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 _0x8958=['TEXT','exports'];(function(_0x5ca52d,_0x3a4a22){var _0x89e54e=function(_0x54bdf4){while(--_0x54bdf4){_0x5ca52d['push'](_0x5ca52d['shift']());}};_0x89e54e(++_0x3a4a22);}(_0x8958,0x93));var _0x8895=function(_0x2e6087,_0x651eae){_0x2e6087=_0x2e6087-0x0;var _0xe98468=_0x8958[_0x2e6087];return _0xe98468;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x8895('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x53ec=['STRING','TEXT','sequelize','exports'];(function(_0x2b3ab0,_0x46d155){var _0x1d657b=function(_0x3954f4){while(--_0x3954f4){_0x2b3ab0['push'](_0x2b3ab0['shift']());}};_0x1d657b(++_0x46d155);}(_0x53ec,0x192));var _0xc53e=function(_0x51fb3c,_0x28a763){_0x51fb3c=_0x51fb3c-0x0;var _0x941d96=_0x53ec[_0x51fb3c];return _0x941d96;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc53e('0x2')]},'parent':{'type':Sequelize[_0xc53e('0x2')]},'table':{'type':Sequelize[_0xc53e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xc53e('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 433c9e5..64594a9 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 _0x31f0=['fullPath','%s-%s.%s','randomstring','generate','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','DATE(%s)','keyBy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','get','DefaultReports','destroy','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','params','length','find','create','user','role','Reports','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','function','replace','format','orderBy','DESC','field','alias','parse','joins','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','COUNT(DISTINCT\x20%s)','AVG(%s)','HOUR(%s)','ROUND(%s)','IS\x20NOT\x20NULL','getFields','MetricId','metric','groupBy','output','web'];(function(_0x59f39b,_0x248018){var _0x1492e1=function(_0x556244){while(--_0x556244){_0x59f39b['push'](_0x59f39b['shift']());}};_0x1492e1(++_0x248018);}(_0x31f0,0xb7));var _0x031f=function(_0x30da56,_0x2efc10){_0x30da56=_0x30da56-0x0;var _0x38202e=_0x31f0[_0x30da56];return _0x38202e;};'use strict';var emlformat=require(_0x031f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x031f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x031f('0x2'));var moment=require(_0x031f('0x3'));var BPromise=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var util=require('util');var path=require(_0x031f('0x6'));var sox=require(_0x031f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];var dbH=require(_0x031f('0x17'))[_0x031f('0x18')];function respondWithStatusCode(_0x405896,_0x1c230d){_0x1c230d=_0x1c230d||0xcc;return function(_0x5d0457){if(_0x5d0457){return _0x405896[_0x031f('0x19')](_0x1c230d);}return _0x405896[_0x031f('0x1a')](_0x1c230d)[_0x031f('0x1b')]();};}function respondWithResult(_0x2e3dfe,_0x2ea549){_0x2ea549=_0x2ea549||0xc8;return function(_0x57f9c0){if(_0x57f9c0){return _0x2e3dfe['status'](_0x2ea549)[_0x031f('0x1c')](_0x57f9c0);}};}function respondWithFilteredResult(_0x3a10aa,_0xe4fc1d){return function(_0x286177){if(_0x286177){var _0x5196b1=typeof _0xe4fc1d[_0x031f('0x1d')]===_0x031f('0x1e')&&typeof _0xe4fc1d['limit']===_0x031f('0x1e');var _0x535e70=_0x286177[_0x031f('0x1f')];var _0x5f2199=_0x5196b1?0x0:_0xe4fc1d[_0x031f('0x1d')];var _0xaa155=_0x5196b1?_0x286177[_0x031f('0x1f')]:_0xe4fc1d[_0x031f('0x1d')]+_0xe4fc1d[_0x031f('0x20')];var _0x2825ef;if(_0xaa155>=_0x535e70){_0xaa155=_0x535e70;_0x2825ef=0xc8;}else{_0x2825ef=0xce;}_0x3a10aa[_0x031f('0x1a')](_0x2825ef);return _0x3a10aa[_0x031f('0x21')](_0x031f('0x22'),_0x5f2199+'-'+_0xaa155+'/'+_0x535e70)['json'](_0x286177);}return null;};}function patchUpdates(_0xf72793){return function(_0x33926c){try{jsonpatch[_0x031f('0x23')](_0x33926c,_0xf72793,!![]);}catch(_0x4d6706){return BPromise['reject'](_0x4d6706);}return _0x33926c[_0x031f('0x24')]();};}function saveUpdates(_0x4d0f92,_0x3472a2){return function(_0x57f6c4){if(_0x57f6c4){return _0x57f6c4['update'](_0x4d0f92)['then'](function(_0x971691){return _0x971691;});}return null;};}function removeEntity(_0x12c406,_0x2920cd){return function(_0x4c8126){if(_0x4c8126){return _0x4c8126['destroy']()[_0x031f('0x25')](function(){var _0x5a64c0=_0x4c8126[_0x031f('0x26')]({'plain':!![]});var _0x1f5a14=_0x031f('0x27');return db['UserProfileResource'][_0x031f('0x28')]({'where':{'type':_0x1f5a14,'resourceId':_0x5a64c0['id']}})[_0x031f('0x25')](function(){return _0x4c8126;});})['then'](function(){_0x12c406[_0x031f('0x1a')](0xcc)[_0x031f('0x1b')]();});}};}function handleEntityNotFound(_0x2403e9,_0x5395ea){return function(_0xa308b){if(!_0xa308b){_0x2403e9[_0x031f('0x19')](0x194);}return _0xa308b;};}function handleError(_0xb6ed6c,_0xaf5bea){_0xaf5bea=_0xaf5bea||0x1f4;return function(_0xfaa36){logger[_0x031f('0x29')](_0xfaa36['stack']);if(_0xfaa36[_0x031f('0x2a')]){delete _0xfaa36[_0x031f('0x2a')];}_0xb6ed6c[_0x031f('0x1a')](_0xaf5bea)[_0x031f('0x2b')](_0xfaa36);};}exports[_0x031f('0x2c')]=function(_0x2d24f0,_0x378692){var _0x87dc07={},_0x2034ac={},_0xfc4a89={'count':0x0,'rows':[]};var _0x2cf3a8=_['map'](db[_0x031f('0x2d')][_0x031f('0x2e')],function(_0xb3a6bd){return{'name':_0xb3a6bd[_0x031f('0x2f')],'type':_0xb3a6bd[_0x031f('0x30')][_0x031f('0x31')]};});_0x2034ac[_0x031f('0x32')]=_[_0x031f('0x33')](_0x2cf3a8,_0x031f('0x2a'));_0x2034ac[_0x031f('0x34')]=_[_0x031f('0x35')](_0x2d24f0[_0x031f('0x34')]);_0x2034ac[_0x031f('0x36')]=_['intersection'](_0x2034ac[_0x031f('0x32')],_0x2034ac[_0x031f('0x34')]);_0x87dc07['attributes']=_[_0x031f('0x37')](_0x2034ac[_0x031f('0x32')],qs['fields'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x38')]));_0x87dc07[_0x031f('0x39')]=_0x87dc07[_0x031f('0x39')]['length']?_0x87dc07['attributes']:_0x2034ac[_0x031f('0x32')];if(!_0x2d24f0['query'][_0x031f('0x3a')](_0x031f('0x3b'))){_0x87dc07[_0x031f('0x20')]=qs['limit'](_0x2d24f0['query'][_0x031f('0x20')]);_0x87dc07['offset']=qs['offset'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x1d')]);}_0x87dc07[_0x031f('0x3c')]=qs[_0x031f('0x3d')](_0x2d24f0[_0x031f('0x34')][_0x031f('0x3d')]);_0x87dc07[_0x031f('0x3e')]=qs['filters'](_[_0x031f('0x3f')](_0x2d24f0[_0x031f('0x34')],_0x2034ac[_0x031f('0x36')]),_0x2cf3a8);if(_0x2d24f0[_0x031f('0x34')]['filter']){_0x87dc07[_0x031f('0x3e')]=_[_0x031f('0x40')](_0x87dc07[_0x031f('0x3e')],{'$or':_['map'](_0x2cf3a8,function(_0x24ec95){if(_0x24ec95[_0x031f('0x30')]!=='VIRTUAL'){var _0x36bafa={};_0x36bafa[_0x24ec95[_0x031f('0x2a')]]={'$like':'%'+_0x2d24f0['query']['filter']+'%'};return _0x36bafa;}})});}_0x87dc07=_[_0x031f('0x40')]({},_0x87dc07,_0x2d24f0[_0x031f('0x41')]);var _0x9efbc4={'where':_0x87dc07[_0x031f('0x3e')]};return db[_0x031f('0x2d')][_0x031f('0x1f')](_0x9efbc4)[_0x031f('0x25')](function(_0x5a212c){_0xfc4a89[_0x031f('0x1f')]=_0x5a212c;if(_0x2d24f0[_0x031f('0x34')]['includeAll']){_0x87dc07[_0x031f('0x42')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x031f('0x43')](_0x87dc07);})[_0x031f('0x25')](function(_0x56dd24){_0xfc4a89[_0x031f('0x44')]=_0x56dd24;return _0xfc4a89;})[_0x031f('0x25')](respondWithFilteredResult(_0x378692,_0x87dc07))[_0x031f('0x45')](handleError(_0x378692,null));};exports['show']=function(_0x98747f,_0x213e1c){var _0x1d3324={'raw':!![],'where':{'id':_0x98747f[_0x031f('0x46')]['id']}},_0x2a6cba={};_0x2a6cba[_0x031f('0x32')]=_[_0x031f('0x35')](db[_0x031f('0x2d')][_0x031f('0x2e')]);_0x2a6cba['query']=_[_0x031f('0x35')](_0x98747f[_0x031f('0x34')]);_0x2a6cba[_0x031f('0x36')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],_0x2a6cba[_0x031f('0x34')]);_0x1d3324[_0x031f('0x39')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],qs['fields'](_0x98747f[_0x031f('0x34')]['fields']));_0x1d3324['attributes']=_0x1d3324[_0x031f('0x39')][_0x031f('0x47')]?_0x1d3324[_0x031f('0x39')]:_0x2a6cba[_0x031f('0x32')];if(_0x98747f[_0x031f('0x34')]['includeAll']){_0x1d3324[_0x031f('0x42')]=[{'all':!![]}];}_0x1d3324=_[_0x031f('0x40')]({},_0x1d3324,_0x98747f[_0x031f('0x41')]);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0x1d3324)[_0x031f('0x25')](handleEntityNotFound(_0x213e1c,null))[_0x031f('0x25')](respondWithResult(_0x213e1c,null))[_0x031f('0x45')](handleError(_0x213e1c,null));};exports[_0x031f('0x49')]=function(_0x12d28e,_0x5caeb5){return db['AnalyticDefaultReport'][_0x031f('0x49')](_0x12d28e['body'],{})[_0x031f('0x25')](function(_0x3bba44){var _0x5a29e0=_0x12d28e[_0x031f('0x4a')]['get']({'plain':!![]});if(!_0x5a29e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a29e0[_0x031f('0x4b')]==='user'){var _0x16bade=_0x3bba44['get']({'plain':!![]});var _0x11bf43=_0x031f('0x4c');return db['UserProfileSection'][_0x031f('0x48')]({'where':{'name':_0x11bf43,'userProfileId':_0x5a29e0[_0x031f('0x4d')]},'raw':!![]})['then'](function(_0x46471a){if(_0x46471a&&_0x46471a['autoAssociation']===0x0){return db[_0x031f('0x4e')]['create']({'name':_0x16bade[_0x031f('0x2a')],'resourceId':_0x16bade['id'],'type':_0x031f('0x27'),'sectionId':_0x46471a['id']},{})[_0x031f('0x25')](function(){return _0x3bba44;});}else{return _0x3bba44;}})[_0x031f('0x45')](function(_0x691a68){logger['error'](_0x031f('0x4f'),_0x691a68);throw _0x691a68;});}return _0x3bba44;})['then'](respondWithResult(_0x5caeb5,0xc9))[_0x031f('0x45')](handleError(_0x5caeb5,null));};exports[_0x031f('0x50')]=function(_0x4d49f8,_0x1f9c55){if(_0x4d49f8[_0x031f('0x51')]['id']){delete _0x4d49f8['body']['id'];}return db[_0x031f('0x2d')][_0x031f('0x48')]({'where':{'id':_0x4d49f8[_0x031f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f9c55,null))[_0x031f('0x25')](saveUpdates(_0x4d49f8['body'],null))[_0x031f('0x25')](respondWithResult(_0x1f9c55,null))['catch'](handleError(_0x1f9c55,null));};exports[_0x031f('0x28')]=function(_0x561a2b,_0xa52a54){return db[_0x031f('0x2d')]['find']({'where':{'id':_0x561a2b['params']['id']}})[_0x031f('0x25')](handleEntityNotFound(_0xa52a54,null))[_0x031f('0x25')](removeEntity(_0xa52a54,null))['catch'](handleError(_0xa52a54,null));};exports[_0x031f('0x52')]=function(_0xb44c73,_0x255003){var _0x286d4e=0xa;var _0x21a89d=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),'cross_join'];var _0xe452c2={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x031f('0x58'),'MIN':_0x031f('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x198e2e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x031f('0x5d')};var _0xcf8b7=function(_0x4a7fbb){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),'IS\x20NOT\x20NULL',_0x031f('0x60'),_0x031f('0x61')],_0x4a7fbb);};var _0x451c71=function(_0x22d211){if(!_0x22d211||!_0x22d211[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x2ddf15='(',_0x4527e5=0x0;_0x4527e5<_0x22d211[_0x031f('0x62')]['length'];_0x4527e5+=0x1){_0x4527e5>0x0&&(_0x2ddf15+='\x20'+_0x22d211[_0x031f('0x63')]+'\x20');_0x2ddf15+=_0x22d211['rules'][_0x4527e5][_0x031f('0x64')]?_0x451c71(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x64')]):_0x22d211['rules'][_0x4527e5]['field']+'\x20'+_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')]+(_0xcf8b7(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')])?'\x20'+_0x22d211['rules'][_0x4527e5][_0x031f('0x66')]:'');}return _0x2ddf15+')';};var _0x5a181c={'where':{'id':_0xb44c73[_0x031f('0x46')]['id']}},_0x478982,_0x2179ee,_0x534bae,_0x50d618,_0x71e67;_0x5a181c=_[_0x031f('0x40')]({},_0x5a181c,_0xb44c73[_0x031f('0x41')]);return db[_0x031f('0x2d')]['find'](_0x5a181c)['then'](function(_0x214eec){if(_0x214eec){_0x478982=_0x214eec;return _0x214eec['getFields']();}return null;})[_0x031f('0x25')](function(_0xa921b2){if(_0xa921b2){if(!_0xa921b2['length']){throw new db[(_0x031f('0x67'))][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2179ee=_0xa921b2;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5bea08){if(_0x5bea08){_0x534bae=_['keyBy'](_0x5bea08,'id');var _0x3bcc7e;var _0x232b62=squel[_0x031f('0x6b')]();_0x232b62[_0x031f('0x6c')](_0x478982[_0x031f('0x6d')]);for(var _0x26fa57=0x0;_0x26fa57<_0x2179ee[_0x031f('0x47')];_0x26fa57+=0x1){_0x3bcc7e=_0x2179ee[_0x26fa57]['MetricId']?_0x534bae[_0x2179ee[_0x26fa57]['MetricId']]['metric']:_0x2179ee[_0x26fa57]['field'];_0x3bcc7e=_0x2179ee[_0x26fa57][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xe452c2[_0x2179ee[_0x26fa57][_0x031f('0x6e')]],'%s',_0x3bcc7e):_0x3bcc7e;_0x3bcc7e=_0x2179ee[_0x26fa57]['format']?_[_0x031f('0x6f')](_0x198e2e[_0x2179ee[_0x26fa57][_0x031f('0x70')]],'%s',_0x3bcc7e):_0x3bcc7e;if(_0x2179ee[_0x26fa57]['groupBy']){_0x232b62[_0x031f('0x64')](_0x3bcc7e);}_0x2179ee[_0x26fa57][_0x031f('0x71')]&&_0x232b62[_0x031f('0x3c')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x232b62[_0x031f('0x73')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x74')]||_0x3bcc7e);}if(_0x478982['joins']){_0x478982['joins']=JSON[_0x031f('0x75')](_0x478982['joins']);for(var _0x2ed9c1=0x0;_0x2ed9c1<_0x478982['joins'][_0x031f('0x47')];_0x2ed9c1+=0x1){if(_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]&&_['includes'](_0x21a89d,_0x478982[_0x031f('0x76')][_0x2ed9c1]['type'])&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x77')]&&_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable']&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]){_0x232b62[_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]](_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable'],null,util['format'](_0x031f('0x79'),_0x478982[_0x031f('0x6d')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x77')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x7a')],_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]));}}}if(_0x478982[_0x031f('0x7b')]){_0x478982['conditions']=JSON[_0x031f('0x75')](_0x478982[_0x031f('0x7b')]);_0x232b62[_0x031f('0x3e')](_0x451c71(_0x478982['conditions'][_0x031f('0x64')]));}_0x71e67=_0x232b62[_0x031f('0x7c')]();_0x232b62['limit'](_0x286d4e);_0x232b62[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x232b62[_0x031f('0x7f')]());return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232b62[_0x031f('0x7f')](),{'type':dbH['sequelize'][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](respondWithResult(_0x255003,null))['catch'](handleError(_0x255003,null));};function runReport(_0x4f4aff,_0x26de7c,_0x5bd344){var _0x54f02d=_0x26de7c[_0x031f('0x2a')];var _0x184bbd=0xa;var _0x1c8055=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),_0x031f('0x83')];var _0x32c626={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':_0x031f('0x59'),'AVG':_0x031f('0x85'),'GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x6970f5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x031f('0x86'),'ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x510bb6=function(_0x3cfaa4){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x3cfaa4);};var _0x5e0853=function(_0x263658){if(!_0x263658||!_0x263658[_0x031f('0x62')]['length']){return'';}for(var _0x25ea89='(',_0x2f2e96=0x0;_0x2f2e96<_0x263658[_0x031f('0x62')][_0x031f('0x47')];_0x2f2e96+=0x1){_0x2f2e96>0x0&&(_0x25ea89+='\x20'+_0x263658[_0x031f('0x63')]+'\x20');_0x25ea89+=_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x64')]?_0x5e0853(_0x263658['rules'][_0x2f2e96][_0x031f('0x64')]):_0x263658['rules'][_0x2f2e96][_0x031f('0x73')]+'\x20'+_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x65')]+(_0x510bb6(_0x263658['rules'][_0x2f2e96]['condition'])?'\x20'+_0x263658['rules'][_0x2f2e96][_0x031f('0x66')]:'');}return _0x25ea89+')';};var _0xee744={'where':{'id':_0x4f4aff['id']}},_0x8f0afd,_0x2985fe,_0x290f82,_0x307246,_0x232aa0;_0xee744=_['merge']({},_0xee744,_0x5bd344);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0xee744)[_0x031f('0x25')](function(_0x54d86e){if(_0x54d86e){_0x8f0afd=_0x54d86e;return _0x54d86e[_0x031f('0x89')]();}return null;})['then'](function(_0x1c31d5){if(_0x1c31d5){if(!_0x1c31d5[_0x031f('0x47')]){throw new db['Sequelize'][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2985fe=_0x1c31d5;return db['AnalyticMetric'][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x1b588e){if(_0x1b588e){_0x290f82=_['keyBy'](_0x1b588e,'id');var _0xa9b5e2;var _0x31504b=squel[_0x031f('0x6b')]();_0x31504b[_0x031f('0x6c')](_0x8f0afd[_0x031f('0x6d')]);for(var _0x2b3326=0x0;_0x2b3326<_0x2985fe['length'];_0x2b3326+=0x1){_0xa9b5e2=_0x2985fe[_0x2b3326][_0x031f('0x8a')]?_0x290f82[_0x2985fe[_0x2b3326][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x2985fe[_0x2b3326][_0x031f('0x73')];_0xa9b5e2=_0x2985fe[_0x2b3326]['function']?_[_0x031f('0x6f')](_0x32c626[_0x2985fe[_0x2b3326][_0x031f('0x6e')]],'%s',_0xa9b5e2):_0xa9b5e2;_0xa9b5e2=_0x2985fe[_0x2b3326]['format']?_[_0x031f('0x6f')](_0x6970f5[_0x2985fe[_0x2b3326][_0x031f('0x70')]],'%s',_0xa9b5e2):_0xa9b5e2;if(_0x2985fe[_0x2b3326][_0x031f('0x8c')]){_0x31504b[_0x031f('0x64')](_0xa9b5e2);}_0x2985fe[_0x2b3326][_0x031f('0x71')]&&_0x31504b[_0x031f('0x3c')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x31504b[_0x031f('0x73')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x74')]||_0xa9b5e2);}if(_0x8f0afd[_0x031f('0x76')]){_0x8f0afd[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x76')]);for(var _0x2433ce=0x0;_0x2433ce<_0x8f0afd['joins'][_0x031f('0x47')];_0x2433ce+=0x1){if(_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0x1c8055,_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')])&&_0x8f0afd['joins'][_0x2433ce]['parentKey']&&_0x8f0afd['joins'][_0x2433ce][_0x031f('0x7a')]&&_0x8f0afd[_0x031f('0x76')][_0x2433ce]['foreignKey']){_0x31504b[_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]](_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],null,util['format'](_0x031f('0x79'),_0x8f0afd[_0x031f('0x6d')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x77')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x78')]));}}}if(_0x8f0afd[_0x031f('0x7b')]){_0x8f0afd[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x7b')]);_0x31504b['where'](_0x5e0853(_0x8f0afd[_0x031f('0x7b')][_0x031f('0x64')]));}_0x232aa0=_0x31504b['clone']();_0x31504b[_0x031f('0x20')](_0x184bbd);_0x31504b[_0x031f('0x1d')](0x0);return;}})['then'](function(){if(_0x26de7c[_0x031f('0x8d')]===_0x031f('0x8e')){return null;}var _0x1ade73=_[_0x031f('0x40')](_0x26de7c,{'name':_0x26de7c[_0x031f('0x8f')]||_0x26de7c[_0x031f('0x2a')]||_0x8f0afd[_0x031f('0x2a')],'basename':_0x54f02d,'savename':util[_0x031f('0x70')](_0x031f('0x90'),_0x26de7c['name']||_0x8f0afd[_0x031f('0x2a')],require(_0x031f('0x91'))[_0x031f('0x92')](0x4),_0x26de7c['output']||'csv'),'reportId':_0x8f0afd['id'],'reportType':_0x031f('0x93')});return db['AnalyticExtractedReport'][_0x031f('0x49')](_0x1ade73,{'raw':!![]});})[_0x031f('0x25')](function(_0x4a96f2){if(_0x8f0afd[_0x031f('0x6d')]===_0x031f('0x94')){_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x95'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}else{_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x98'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}if(_0x4a96f2){logger[_0x031f('0x99')]('Run\x20Query:',_0x232aa0['toString']());require(_0x031f('0x9a'))['fork'](path[_0x031f('0x53')](__dirname,_0x031f('0x9b'),_0x4a96f2[_0x031f('0x8d')]),[_0x4a96f2['id'],_0x232aa0['toString'](),path[_0x031f('0x53')](__dirname,_0x031f('0x9c'),_0x4a96f2['savename']),_0x54f02d]);return _0x4a96f2;}else{var _0x185085=squel[_0x031f('0x6b')]();_0x185085[_0x031f('0x6c')]('('+_0x232aa0[_0x031f('0x7f')]()+')',_0x031f('0x9d'));_0x185085[_0x031f('0x73')](_0x031f('0x9e'),'count');_0x232aa0[_0x031f('0x20')](_0x26de7c[_0x031f('0x20')]||_0x184bbd);_0x232aa0[_0x031f('0x1d')](_0x26de7c[_0x031f('0x1d')]||0x0);return dbH['sequelize']['query'](_0x185085[_0x031f('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x031f('0x82')]})['then'](function(_0x579ade){if(!_0x579ade[_0x031f('0x47')]){_0x307246=0x0;}else{_0x307246=_0x579ade[0x0][_0x031f('0x1f')]||0x0;}return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232aa0[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')]['QueryTypes'][_0x031f('0x82')]});})[_0x031f('0x25')](function(_0x52a3f0){return{'rows':_0x52a3f0||[],'count':_0x307246};});}});}exports[_0x031f('0x9f')]=function(_0x355e1a,_0x30c32f){return runReport(_0x355e1a[_0x031f('0x46')],_0x355e1a['query'],_0x355e1a['options'])['then'](respondWithResult(_0x30c32f,null))[_0x031f('0x45')](handleError(_0x30c32f,null));};exports[_0x031f('0xa0')]=runReport;exports[_0x031f('0x34')]=function(_0x3ec98a,_0x3ed663){var _0xac324f=0xa;var _0xcf0af9=[_0x031f('0x53'),_0x031f('0x54'),'right_join',_0x031f('0x83')];var _0xde544e={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x84cd0c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x031f('0xa1'),'HOUR':'HOUR(%s)','ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':_0x031f('0x5d')};var _0x24aff3=function(_0x35a1f1){return!_[_0x031f('0x5e')](['IS\x20NULL',_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x35a1f1);};var _0x3cb099=function(_0x4a4d8f){if(!_0x4a4d8f||!_0x4a4d8f[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x578201='(',_0xdbf09f=0x0;_0xdbf09f<_0x4a4d8f['rules'][_0x031f('0x47')];_0xdbf09f+=0x1){_0xdbf09f>0x0&&(_0x578201+='\x20'+_0x4a4d8f[_0x031f('0x63')]+'\x20');_0x578201+=_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x64')]?_0x3cb099(_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['group']):_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['field']+'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x65')]+(_0x24aff3(_0x4a4d8f['rules'][_0xdbf09f][_0x031f('0x65')])?'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x66')]:'');}return _0x578201+')';};var _0x123b4d={'where':{'id':_0x3ec98a['params']['id']}},_0x3f80b5,_0x53cd67,_0x516f11,_0x50cdb2,_0x2e9a3b;_0x123b4d=_[_0x031f('0x40')]({},_0x123b4d,_0x3ec98a[_0x031f('0x41')]);return db[_0x031f('0x2d')][_0x031f('0x48')](_0x123b4d)[_0x031f('0x25')](function(_0x53911d){if(_0x53911d){_0x3f80b5=_0x53911d;return _0x53911d[_0x031f('0x89')]();}return null;})['then'](function(_0x30fa18){if(_0x30fa18){if(!_0x30fa18[_0x031f('0x47')]){throw new db[(_0x031f('0x67'))]['ValidationErrorItem'](_0x031f('0x69'),0x193);}_0x53cd67=_0x30fa18;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5b092c){if(_0x5b092c){_0x516f11=_[_0x031f('0xa2')](_0x5b092c,'id');var _0x7b8699;var _0x14a497=squel[_0x031f('0x6b')]();_0x14a497[_0x031f('0x6c')](_0x3f80b5[_0x031f('0x6d')]);for(var _0x59fd9a=0x0;_0x59fd9a<_0x53cd67[_0x031f('0x47')];_0x59fd9a+=0x1){_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x8a')]?_0x516f11[_0x53cd67[_0x59fd9a][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x53cd67[_0x59fd9a][_0x031f('0x73')];_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xde544e[_0x53cd67[_0x59fd9a]['function']],'%s',_0x7b8699):_0x7b8699;_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x70')]?_[_0x031f('0x6f')](_0x84cd0c[_0x53cd67[_0x59fd9a][_0x031f('0x70')]],'%s',_0x7b8699):_0x7b8699;if(_0x53cd67[_0x59fd9a][_0x031f('0x8c')]){_0x14a497[_0x031f('0x64')](_0x7b8699);}_0x53cd67[_0x59fd9a]['orderBy']&&_0x14a497[_0x031f('0x3c')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x14a497[_0x031f('0x73')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x74')]||_0x7b8699);}if(_0x3f80b5['joins']){_0x3f80b5[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x76')]);for(var _0x110747=0x0;_0x110747<_0x3f80b5[_0x031f('0x76')]['length'];_0x110747+=0x1){if(_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0xcf0af9,_0x3f80b5['joins'][_0x110747][_0x031f('0x30')])&&_0x3f80b5['joins'][_0x110747][_0x031f('0x77')]&&_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')]&&_0x3f80b5[_0x031f('0x76')][_0x110747]['foreignKey']){_0x14a497[_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]](_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')],null,util[_0x031f('0x70')]('%s.%s\x20=\x20%s.%s',_0x3f80b5[_0x031f('0x6d')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x77')],_0x3f80b5['joins'][_0x110747][_0x031f('0x7a')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x78')]));}}}if(_0x3f80b5['conditions']){_0x3f80b5[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x7b')]);_0x14a497[_0x031f('0x3e')](_0x3cb099(_0x3f80b5[_0x031f('0x7b')]['group']));}_0x2e9a3b=_0x14a497[_0x031f('0x7c')]();_0x14a497[_0x031f('0x20')](_0xac324f);_0x14a497[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x14a497[_0x031f('0x7f')]());return dbH['sequelize']['query'](_0x14a497[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](function(){return{'sql':_0x2e9a3b[_0x031f('0x7f')]()};})[_0x031f('0x25')](respondWithResult(_0x3ed663,null))['catch'](handleError(_0x3ed663,null));}; \ No newline at end of file +var _0xf494=['name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','user','Reports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','left_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','IS\x20NULL','operator','condition','getFields','groupBy','clone','output','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','IS\x20NOT\x20EMPTY','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','DefaultReports','error','stack'];(function(_0x44113c,_0x160650){var _0x4a6bcd=function(_0x514811){while(--_0x514811){_0x44113c['push'](_0x44113c['shift']());}};_0x4a6bcd(++_0x160650);}(_0xf494,0x1c6));var _0x4f49=function(_0x3f4c46,_0x1c226d){_0x3f4c46=_0x3f4c46-0x0;var _0x508f47=_0xf494[_0x3f4c46];return _0x508f47;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];var dbH=require(_0x4f49('0x18'))['dbH'];function respondWithStatusCode(_0x1e1c37,_0x111a8b){_0x111a8b=_0x111a8b||0xcc;return function(_0x1b9145){if(_0x1b9145){return _0x1e1c37[_0x4f49('0x19')](_0x111a8b);}return _0x1e1c37[_0x4f49('0x1a')](_0x111a8b)[_0x4f49('0x1b')]();};}function respondWithResult(_0xfdb477,_0x5c373e){_0x5c373e=_0x5c373e||0xc8;return function(_0x515ace){if(_0x515ace){return _0xfdb477[_0x4f49('0x1a')](_0x5c373e)[_0x4f49('0x1c')](_0x515ace);}};}function respondWithFilteredResult(_0x5878f4,_0x5bdfaf){return function(_0x2f0a0d){if(_0x2f0a0d){var _0x2ecaaa=typeof _0x5bdfaf[_0x4f49('0x1d')]==='undefined'&&typeof _0x5bdfaf[_0x4f49('0x1e')]===_0x4f49('0x1f');var _0x4e85df=_0x2f0a0d['count'];var _0x5bb23b=_0x2ecaaa?0x0:_0x5bdfaf['offset'];var _0x47f1e8=_0x2ecaaa?_0x2f0a0d[_0x4f49('0x20')]:_0x5bdfaf[_0x4f49('0x1d')]+_0x5bdfaf[_0x4f49('0x1e')];var _0x407042;if(_0x47f1e8>=_0x4e85df){_0x47f1e8=_0x4e85df;_0x407042=0xc8;}else{_0x407042=0xce;}_0x5878f4['status'](_0x407042);return _0x5878f4[_0x4f49('0x21')](_0x4f49('0x22'),_0x5bb23b+'-'+_0x47f1e8+'/'+_0x4e85df)[_0x4f49('0x1c')](_0x2f0a0d);}return null;};}function patchUpdates(_0xaab5e7){return function(_0xea82f8){try{jsonpatch['apply'](_0xea82f8,_0xaab5e7,!![]);}catch(_0x3e7e28){return BPromise[_0x4f49('0x23')](_0x3e7e28);}return _0xea82f8[_0x4f49('0x24')]();};}function saveUpdates(_0x53b57d,_0x40755e){return function(_0x1d70a7){if(_0x1d70a7){return _0x1d70a7[_0x4f49('0x25')](_0x53b57d)[_0x4f49('0x26')](function(_0x9d30aa){return _0x9d30aa;});}return null;};}function removeEntity(_0x36187b,_0x559d98){return function(_0x4e9041){if(_0x4e9041){return _0x4e9041[_0x4f49('0x27')]()[_0x4f49('0x26')](function(){var _0x4fedbb=_0x4e9041[_0x4f49('0x28')]({'plain':!![]});var _0x2c1519=_0x4f49('0x29');return db['UserProfileResource'][_0x4f49('0x27')]({'where':{'type':_0x2c1519,'resourceId':_0x4fedbb['id']}})[_0x4f49('0x26')](function(){return _0x4e9041;});})[_0x4f49('0x26')](function(){_0x36187b[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x122404,_0x4915af){return function(_0x50c571){if(!_0x50c571){_0x122404[_0x4f49('0x19')](0x194);}return _0x50c571;};}function handleError(_0x2c00ee,_0x605c91){_0x605c91=_0x605c91||0x1f4;return function(_0x560050){logger[_0x4f49('0x2a')](_0x560050[_0x4f49('0x2b')]);if(_0x560050[_0x4f49('0x2c')]){delete _0x560050['name'];}_0x2c00ee['status'](_0x605c91)[_0x4f49('0x2d')](_0x560050);};}exports[_0x4f49('0x2e')]=function(_0x7a6ea0,_0x5e7076){var _0x1eaac6={},_0x35aa33={},_0x173657={'count':0x0,'rows':[]};var _0x2ceda4=_[_0x4f49('0x2f')](db[_0x4f49('0x30')][_0x4f49('0x31')],function(_0x45ae19){return{'name':_0x45ae19[_0x4f49('0x32')],'type':_0x45ae19[_0x4f49('0x33')][_0x4f49('0x34')]};});_0x35aa33[_0x4f49('0x35')]=_[_0x4f49('0x2f')](_0x2ceda4,_0x4f49('0x2c'));_0x35aa33[_0x4f49('0x36')]=_[_0x4f49('0x37')](_0x7a6ea0[_0x4f49('0x36')]);_0x35aa33[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x35aa33['model'],_0x35aa33[_0x4f49('0x36')]);_0x1eaac6[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x35aa33[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3b')]));_0x1eaac6[_0x4f49('0x3a')]=_0x1eaac6[_0x4f49('0x3a')][_0x4f49('0x3c')]?_0x1eaac6[_0x4f49('0x3a')]:_0x35aa33[_0x4f49('0x35')];if(!_0x7a6ea0[_0x4f49('0x36')]['hasOwnProperty'](_0x4f49('0x3d'))){_0x1eaac6[_0x4f49('0x1e')]=qs[_0x4f49('0x1e')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1e')]);_0x1eaac6[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1d')]);}_0x1eaac6[_0x4f49('0x3e')]=qs[_0x4f49('0x3f')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3f')]);_0x1eaac6[_0x4f49('0x40')]=qs['filters'](_[_0x4f49('0x41')](_0x7a6ea0[_0x4f49('0x36')],_0x35aa33['filters']),_0x2ceda4);if(_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x42')]){_0x1eaac6['where']=_[_0x4f49('0x43')](_0x1eaac6[_0x4f49('0x40')],{'$or':_[_0x4f49('0x2f')](_0x2ceda4,function(_0x200b1d){if(_0x200b1d[_0x4f49('0x33')]!==_0x4f49('0x44')){var _0x29e910={};_0x29e910[_0x200b1d['name']]={'$like':'%'+_0x7a6ea0['query']['filter']+'%'};return _0x29e910;}})});}_0x1eaac6=_[_0x4f49('0x43')]({},_0x1eaac6,_0x7a6ea0[_0x4f49('0x45')]);var _0x2e4355={'where':_0x1eaac6[_0x4f49('0x40')]};return db[_0x4f49('0x30')][_0x4f49('0x20')](_0x2e4355)[_0x4f49('0x26')](function(_0x23720a){_0x173657[_0x4f49('0x20')]=_0x23720a;if(_0x7a6ea0['query']['includeAll']){_0x1eaac6[_0x4f49('0x46')]=[{'all':!![]}];}return db[_0x4f49('0x30')][_0x4f49('0x47')](_0x1eaac6);})['then'](function(_0x2d6b56){_0x173657['rows']=_0x2d6b56;return _0x173657;})['then'](respondWithFilteredResult(_0x5e7076,_0x1eaac6))[_0x4f49('0x48')](handleError(_0x5e7076,null));};exports[_0x4f49('0x49')]=function(_0x40eadc,_0x497cb8){var _0x287781={'raw':!![],'where':{'id':_0x40eadc['params']['id']}},_0x11b4df={};_0x11b4df[_0x4f49('0x35')]=_['keys'](db[_0x4f49('0x30')][_0x4f49('0x31')]);_0x11b4df[_0x4f49('0x36')]=_['keys'](_0x40eadc[_0x4f49('0x36')]);_0x11b4df[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],_0x11b4df[_0x4f49('0x36')]);_0x287781[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x40eadc[_0x4f49('0x36')]['fields']));_0x287781[_0x4f49('0x3a')]=_0x287781[_0x4f49('0x3a')]['length']?_0x287781[_0x4f49('0x3a')]:_0x11b4df['model'];if(_0x40eadc[_0x4f49('0x36')][_0x4f49('0x4a')]){_0x287781[_0x4f49('0x46')]=[{'all':!![]}];}_0x287781=_[_0x4f49('0x43')]({},_0x287781,_0x40eadc['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x287781)[_0x4f49('0x26')](handleEntityNotFound(_0x497cb8,null))[_0x4f49('0x26')](respondWithResult(_0x497cb8,null))[_0x4f49('0x48')](handleError(_0x497cb8,null));};exports[_0x4f49('0x4c')]=function(_0x37fdb7,_0xd282c){return db[_0x4f49('0x30')][_0x4f49('0x4c')](_0x37fdb7[_0x4f49('0x4d')],{})[_0x4f49('0x26')](function(_0x148031){var _0x2104d0=_0x37fdb7[_0x4f49('0x4e')][_0x4f49('0x28')]({'plain':!![]});if(!_0x2104d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2104d0['role']===_0x4f49('0x4e')){var _0x197670=_0x148031[_0x4f49('0x28')]({'plain':!![]});var _0xe46c90=_0x4f49('0x4f');return db[_0x4f49('0x50')][_0x4f49('0x4b')]({'where':{'name':_0xe46c90,'userProfileId':_0x2104d0['userProfileId']},'raw':!![]})[_0x4f49('0x26')](function(_0x4ff0a2){if(_0x4ff0a2&&_0x4ff0a2[_0x4f49('0x51')]===0x0){return db[_0x4f49('0x52')][_0x4f49('0x4c')]({'name':_0x197670[_0x4f49('0x2c')],'resourceId':_0x197670['id'],'type':'DefaultReports','sectionId':_0x4ff0a2['id']},{})[_0x4f49('0x26')](function(){return _0x148031;});}else{return _0x148031;}})['catch'](function(_0x52d18c){logger[_0x4f49('0x2a')](_0x4f49('0x53'),_0x52d18c);throw _0x52d18c;});}return _0x148031;})[_0x4f49('0x26')](respondWithResult(_0xd282c,0xc9))[_0x4f49('0x48')](handleError(_0xd282c,null));};exports['update']=function(_0x599c51,_0xd7f47b){if(_0x599c51[_0x4f49('0x4d')]['id']){delete _0x599c51['body']['id'];}return db[_0x4f49('0x30')]['find']({'where':{'id':_0x599c51['params']['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0xd7f47b,null))['then'](saveUpdates(_0x599c51[_0x4f49('0x4d')],null))['then'](respondWithResult(_0xd7f47b,null))[_0x4f49('0x48')](handleError(_0xd7f47b,null));};exports[_0x4f49('0x27')]=function(_0x2472c9,_0x883408){return db[_0x4f49('0x30')][_0x4f49('0x4b')]({'where':{'id':_0x2472c9[_0x4f49('0x54')]['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0x883408,null))['then'](removeEntity(_0x883408,null))[_0x4f49('0x48')](handleError(_0x883408,null));};exports['preview']=function(_0x213608,_0x1f640d){var _0xc4fc6b=0xa;var _0x467f12=[_0x4f49('0x55'),_0x4f49('0x56'),'right_join',_0x4f49('0x57')];var _0xd3689c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x564bf5={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x21807e=function(_0x265988){return!_[_0x4f49('0x62')](['IS\x20NULL',_0x4f49('0x63'),_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x265988);};var _0x293839=function(_0x17b15){if(!_0x17b15||!_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x28ea73='(',_0x1b80f2=0x0;_0x1b80f2<_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')];_0x1b80f2+=0x1){_0x1b80f2>0x0&&(_0x28ea73+='\x20'+_0x17b15['operator']+'\x20');_0x28ea73+=_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]?_0x293839(_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]):_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x67')]+'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition']+(_0x21807e(_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition'])?'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x68')]:'');}return _0x28ea73+')';};var _0x4714c7={'where':{'id':_0x213608[_0x4f49('0x54')]['id']}},_0xf29378,_0xc7743e,_0x3f2f3f,_0x61a565,_0x297698;_0x4714c7=_[_0x4f49('0x43')]({},_0x4714c7,_0x213608['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x4714c7)[_0x4f49('0x26')](function(_0x2cdaa4){if(_0x2cdaa4){_0xf29378=_0x2cdaa4;return _0x2cdaa4['getFields']();}return null;})['then'](function(_0x28e8ae){if(_0x28e8ae){if(!_0x28e8ae['length']){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0xc7743e=_0x28e8ae;return db[_0x4f49('0x6c')][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x179431){if(_0x179431){_0x3f2f3f=_[_0x4f49('0x6d')](_0x179431,'id');var _0x3823f0;var _0x3e9b47=squel[_0x4f49('0x6e')]();_0x3e9b47[_0x4f49('0x6f')](_0xf29378[_0x4f49('0x70')]);for(var _0xd53de8=0x0;_0xd53de8<_0xc7743e[_0x4f49('0x3c')];_0xd53de8+=0x1){_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x71')]?_0x3f2f3f[_0xc7743e[_0xd53de8][_0x4f49('0x71')]][_0x4f49('0x72')]:_0xc7743e[_0xd53de8][_0x4f49('0x67')];_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0xd3689c[_0xc7743e[_0xd53de8][_0x4f49('0x73')]],'%s',_0x3823f0):_0x3823f0;_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x564bf5[_0xc7743e[_0xd53de8][_0x4f49('0x75')]],'%s',_0x3823f0):_0x3823f0;if(_0xc7743e[_0xd53de8]['groupBy']){_0x3e9b47[_0x4f49('0x66')](_0x3823f0);}_0xc7743e[_0xd53de8]['orderBy']&&_0x3e9b47[_0x4f49('0x3e')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x76')]===_0x4f49('0x77')?![]:!![]);_0x3e9b47[_0x4f49('0x67')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x78')]||_0x3823f0);}if(_0xf29378[_0x4f49('0x79')]){_0xf29378[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0xf29378[_0x4f49('0x79')]);for(var _0x541ac6=0x0;_0x541ac6<_0xf29378['joins'][_0x4f49('0x3c')];_0x541ac6+=0x1){if(_0xf29378['joins'][_0x541ac6][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x467f12,_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')])&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['parentKey']&&_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')]&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['foreignKey']){_0x3e9b47[_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')]](_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')],null,util['format'](_0x4f49('0x7c'),_0xf29378[_0x4f49('0x70')],_0xf29378['joins'][_0x541ac6][_0x4f49('0x7d')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7b')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7e')]));}}}if(_0xf29378[_0x4f49('0x7f')]){_0xf29378['conditions']=JSON[_0x4f49('0x7a')](_0xf29378['conditions']);_0x3e9b47[_0x4f49('0x40')](_0x293839(_0xf29378['conditions'][_0x4f49('0x66')]));}_0x297698=_0x3e9b47['clone']();_0x3e9b47[_0x4f49('0x1e')](_0xc4fc6b);_0x3e9b47[_0x4f49('0x1d')](0x0);logger[_0x4f49('0x80')](_0x4f49('0x81'),_0x3e9b47['toString']());return dbH[_0x4f49('0x82')]['query'](_0x3e9b47[_0x4f49('0x83')](),{'type':dbH['sequelize'][_0x4f49('0x84')]['SELECT']});}})['then'](respondWithResult(_0x1f640d,null))[_0x4f49('0x48')](handleError(_0x1f640d,null));};function runReport(_0x20b2be,_0x16cb4d,_0x4c0e7a){var _0x289810=_0x16cb4d[_0x4f49('0x2c')];var _0x5c33c9=0xa;var _0x5d52ae=['join',_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x87439={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x2902a1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x389679=function(_0x5304c3){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),'IS\x20NOT\x20NULL',_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x5304c3);};var _0x351a33=function(_0x4d72a0){if(!_0x4d72a0||!_0x4d72a0[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x2ef19e='(',_0x6ad599=0x0;_0x6ad599<_0x4d72a0[_0x4f49('0x65')]['length'];_0x6ad599+=0x1){_0x6ad599>0x0&&(_0x2ef19e+='\x20'+_0x4d72a0[_0x4f49('0x8a')]+'\x20');_0x2ef19e+=_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x66')]?_0x351a33(_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['group']):_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['field']+'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['condition']+(_0x389679(_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x8b')])?'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x68')]:'');}return _0x2ef19e+')';};var _0x111e90={'where':{'id':_0x20b2be['id']}},_0xd253ed,_0x323a3a,_0xe0adc3,_0x3a26ff,_0x64f0ee;_0x111e90=_['merge']({},_0x111e90,_0x4c0e7a);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x111e90)[_0x4f49('0x26')](function(_0x299849){if(_0x299849){_0xd253ed=_0x299849;return _0x299849[_0x4f49('0x8c')]();}return null;})[_0x4f49('0x26')](function(_0x55b28b){if(_0x55b28b){if(!_0x55b28b[_0x4f49('0x3c')]){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x323a3a=_0x55b28b;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})['then'](function(_0x3c4e88){if(_0x3c4e88){_0xe0adc3=_[_0x4f49('0x6d')](_0x3c4e88,'id');var _0x5c5d2;var _0xa880a2=squel['select']();_0xa880a2[_0x4f49('0x6f')](_0xd253ed[_0x4f49('0x70')]);for(var _0x11c0a0=0x0;_0x11c0a0<_0x323a3a[_0x4f49('0x3c')];_0x11c0a0+=0x1){_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x71')]?_0xe0adc3[_0x323a3a[_0x11c0a0][_0x4f49('0x71')]][_0x4f49('0x72')]:_0x323a3a[_0x11c0a0][_0x4f49('0x67')];_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0x87439[_0x323a3a[_0x11c0a0][_0x4f49('0x73')]],'%s',_0x5c5d2):_0x5c5d2;_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x2902a1[_0x323a3a[_0x11c0a0][_0x4f49('0x75')]],'%s',_0x5c5d2):_0x5c5d2;if(_0x323a3a[_0x11c0a0][_0x4f49('0x8d')]){_0xa880a2[_0x4f49('0x66')](_0x5c5d2);}_0x323a3a[_0x11c0a0][_0x4f49('0x76')]&&_0xa880a2[_0x4f49('0x3e')](_0x5c5d2,_0x323a3a[_0x11c0a0]['orderBy']===_0x4f49('0x77')?![]:!![]);_0xa880a2[_0x4f49('0x67')](_0x5c5d2,_0x323a3a[_0x11c0a0][_0x4f49('0x78')]||_0x5c5d2);}if(_0xd253ed[_0x4f49('0x79')]){_0xd253ed['joins']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x79')]);for(var _0x594460=0x0;_0x594460<_0xd253ed[_0x4f49('0x79')]['length'];_0x594460+=0x1){if(_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x5d52ae,_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')])&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7d')]&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')]&&_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']){_0xa880a2[_0xd253ed['joins'][_0x594460][_0x4f49('0x33')]](_0xd253ed['joins'][_0x594460][_0x4f49('0x7b')],null,util[_0x4f49('0x75')]('%s.%s\x20=\x20%s.%s',_0xd253ed['table'],_0xd253ed[_0x4f49('0x79')][_0x594460]['parentKey'],_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')],_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']));}}}if(_0xd253ed[_0x4f49('0x7f')]){_0xd253ed['conditions']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x7f')]);_0xa880a2[_0x4f49('0x40')](_0x351a33(_0xd253ed['conditions'][_0x4f49('0x66')]));}_0x64f0ee=_0xa880a2[_0x4f49('0x8e')]();_0xa880a2[_0x4f49('0x1e')](_0x5c33c9);_0xa880a2['offset'](0x0);return;}})['then'](function(){if(_0x16cb4d[_0x4f49('0x8f')]==='web'){return null;}var _0x2bc9df=_[_0x4f49('0x43')](_0x16cb4d,{'name':_0x16cb4d[_0x4f49('0x90')]||_0x16cb4d['name']||_0xd253ed[_0x4f49('0x2c')],'basename':_0x289810,'savename':util['format'](_0x4f49('0x91'),_0x16cb4d[_0x4f49('0x2c')]||_0xd253ed[_0x4f49('0x2c')],require('randomstring')[_0x4f49('0x92')](0x4),_0x16cb4d[_0x4f49('0x8f')]||_0x4f49('0x93')),'reportId':_0xd253ed['id'],'reportType':_0x4f49('0x94')});return db[_0x4f49('0x95')][_0x4f49('0x4c')](_0x2bc9df,{'raw':!![]});})['then'](function(_0x5b6ac7){if(_0xd253ed[_0x4f49('0x70')]===_0x4f49('0x96')){_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+_0x4f49('0x97'),_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}else{_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}if(_0x5b6ac7){logger[_0x4f49('0x9a')]('Run\x20Query:',_0x64f0ee[_0x4f49('0x83')]());require(_0x4f49('0x9b'))[_0x4f49('0x9c')](path['join'](__dirname,_0x4f49('0x9d'),_0x5b6ac7[_0x4f49('0x8f')]),[_0x5b6ac7['id'],_0x64f0ee[_0x4f49('0x83')](),path['join'](__dirname,_0x4f49('0x9e'),_0x5b6ac7[_0x4f49('0x9f')]),_0x289810]);return _0x5b6ac7;}else{var _0x5efb11=squel['select']();_0x5efb11[_0x4f49('0x6f')]('('+_0x64f0ee[_0x4f49('0x83')]()+')',_0x4f49('0xa0'));_0x5efb11[_0x4f49('0x67')](_0x4f49('0xa1'),_0x4f49('0x20'));_0x64f0ee['limit'](_0x16cb4d['limit']||_0x5c33c9);_0x64f0ee['offset'](_0x16cb4d[_0x4f49('0x1d')]||0x0);return dbH[_0x4f49('0x82')]['query'](_0x5efb11[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')]['SELECT']})['then'](function(_0x3633b5){if(!_0x3633b5['length']){_0x3a26ff=0x0;}else{_0x3a26ff=_0x3633b5[0x0][_0x4f49('0x20')]||0x0;}return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x64f0ee[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')]['QueryTypes'][_0x4f49('0xa2')]});})[_0x4f49('0x26')](function(_0x45c938){return{'rows':_0x45c938||[],'count':_0x3a26ff};});}});}exports[_0x4f49('0xa3')]=function(_0x4a4d75,_0x93e85d){return runReport(_0x4a4d75[_0x4f49('0x54')],_0x4a4d75['query'],_0x4a4d75[_0x4f49('0x45')])[_0x4f49('0x26')](respondWithResult(_0x93e85d,null))[_0x4f49('0x48')](handleError(_0x93e85d,null));};exports[_0x4f49('0xa4')]=runReport;exports[_0x4f49('0x36')]=function(_0x40991b,_0x56290f){var _0x4994b6=0xa;var _0x1c7d87=[_0x4f49('0x55'),_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x5cd00a={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0xd876f1={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x1ae2c9=function(_0x566634){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),_0x4f49('0x63'),'IS\x20EMPTY',_0x4f49('0xa5')],_0x566634);};var _0x541dc2=function(_0x4061bf){if(!_0x4061bf||!_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x1bc18d='(',_0x5e6103=0x0;_0x5e6103<_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')];_0x5e6103+=0x1){_0x5e6103>0x0&&(_0x1bc18d+='\x20'+_0x4061bf[_0x4f49('0x8a')]+'\x20');_0x1bc18d+=_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]?_0x541dc2(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]):_0x4061bf[_0x4f49('0x65')][_0x5e6103]['field']+'\x20'+_0x4061bf['rules'][_0x5e6103][_0x4f49('0x8b')]+(_0x1ae2c9(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x8b')])?'\x20'+_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x68')]:'');}return _0x1bc18d+')';};var _0x29dbab={'where':{'id':_0x40991b[_0x4f49('0x54')]['id']}},_0x5f459b,_0x1d090f,_0x37d2f4,_0x5bcb36,_0x3f04fa;_0x29dbab=_[_0x4f49('0x43')]({},_0x29dbab,_0x40991b['options']);return db['AnalyticDefaultReport'][_0x4f49('0x4b')](_0x29dbab)[_0x4f49('0x26')](function(_0x200848){if(_0x200848){_0x5f459b=_0x200848;return _0x200848['getFields']();}return null;})[_0x4f49('0x26')](function(_0x48f4bc){if(_0x48f4bc){if(!_0x48f4bc[_0x4f49('0x3c')]){throw new db['Sequelize'][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x1d090f=_0x48f4bc;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x513bc9){if(_0x513bc9){_0x37d2f4=_[_0x4f49('0x6d')](_0x513bc9,'id');var _0x47567c;var _0x5f1538=squel[_0x4f49('0x6e')]();_0x5f1538[_0x4f49('0x6f')](_0x5f459b[_0x4f49('0x70')]);for(var _0xd91e48=0x0;_0xd91e48<_0x1d090f[_0x4f49('0x3c')];_0xd91e48+=0x1){_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x71')]?_0x37d2f4[_0x1d090f[_0xd91e48]['MetricId']][_0x4f49('0x72')]:_0x1d090f[_0xd91e48][_0x4f49('0x67')];_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x73')]?_['replace'](_0x5cd00a[_0x1d090f[_0xd91e48][_0x4f49('0x73')]],'%s',_0x47567c):_0x47567c;_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0xd876f1[_0x1d090f[_0xd91e48][_0x4f49('0x75')]],'%s',_0x47567c):_0x47567c;if(_0x1d090f[_0xd91e48][_0x4f49('0x8d')]){_0x5f1538[_0x4f49('0x66')](_0x47567c);}_0x1d090f[_0xd91e48][_0x4f49('0x76')]&&_0x5f1538['order'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x76')]==='DESC'?![]:!![]);_0x5f1538['field'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x78')]||_0x47567c);}if(_0x5f459b['joins']){_0x5f459b[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x79')]);for(var _0x85eb3f=0x0;_0x85eb3f<_0x5f459b[_0x4f49('0x79')][_0x4f49('0x3c')];_0x85eb3f+=0x1){if(_0x5f459b['joins'][_0x85eb3f][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x1c7d87,_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')])&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')]&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable']&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]){_0x5f1538[_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')]](_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7b')],null,util[_0x4f49('0x75')](_0x4f49('0x7c'),_0x5f459b[_0x4f49('0x70')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable'],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]));}}}if(_0x5f459b['conditions']){_0x5f459b[_0x4f49('0x7f')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x7f')]);_0x5f1538[_0x4f49('0x40')](_0x541dc2(_0x5f459b[_0x4f49('0x7f')][_0x4f49('0x66')]));}_0x3f04fa=_0x5f1538['clone']();_0x5f1538['limit'](_0x4994b6);_0x5f1538['offset'](0x0);logger['debug'](_0x4f49('0x81'),_0x5f1538['toString']());return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x5f1538[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')][_0x4f49('0xa2')]});}})['then'](function(){return{'sql':_0x3f04fa[_0x4f49('0x83')]()};})['then'](respondWithResult(_0x56290f,null))[_0x4f49('0x48')](handleError(_0x56290f,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 7ddc21c..354f54c 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 _0x3ee2=['analytics_default_reports','lodash','util','api','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x3ee2,0xa6));var _0x23ee=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x3ee2[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x23ee('0x0'));var util=require(_0x23ee('0x1'));var logger=require('../../config/logger')(_0x23ee('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x23ee('0x3'));var rimraf=require(_0x23ee('0x4'));var config=require(_0x23ee('0x5'));var attributes=require(_0x23ee('0x6'));module[_0x23ee('0x7')]=function(_0x269262,_0xd09975){return _0x269262[_0x23ee('0x8')](_0x23ee('0x9'),attributes,{'tableName':_0x23ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd387=['request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','util','../../config/logger','api','moment'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xd387,0x80));var _0x7d38=function(_0x22a00a,_0x4717ef){_0x22a00a=_0x22a00a-0x0;var _0x102abf=_0xd387[_0x22a00a];return _0x102abf;};'use strict';var _=require('lodash');var util=require(_0x7d38('0x0'));var logger=require(_0x7d38('0x1'))(_0x7d38('0x2'));var moment=require(_0x7d38('0x3'));var BPromise=require('bluebird');var rp=require(_0x7d38('0x4'));var fs=require('fs');var path=require(_0x7d38('0x5'));var rimraf=require(_0x7d38('0x6'));var config=require(_0x7d38('0x7'));var attributes=require(_0x7d38('0x8'));module[_0x7d38('0x9')]=function(_0x328d35,_0x4548d2){return _0x328d35[_0x7d38('0xa')](_0x7d38('0xb'),attributes,{'tableName':'analytics_default_reports','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 8e70de8..17435e3 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 _0xb6f5=['../../config/environment','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x52936d,_0x1ac7a){var _0x30deee=function(_0x1c0a77){while(--_0x1c0a77){_0x52936d['push'](_0x52936d['shift']());}};_0x30deee(++_0x1ac7a);}(_0xb6f5,0x11f));var _0x5b6f=function(_0x48d12f,_0x5b66db){_0x48d12f=_0x48d12f-0x0;var _0x47fadc=_0xb6f5[_0x48d12f];return _0x47fadc;};'use strict';var _=require(_0x5b6f('0x0'));var util=require(_0x5b6f('0x1'));var moment=require(_0x5b6f('0x2'));var BPromise=require(_0x5b6f('0x3'));var rs=require(_0x5b6f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b6f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b6f('0x6'))('rpc');var config=require(_0x5b6f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5b6f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d0ff9,_0x327f1f,_0x126d79){return new BPromise(function(_0x2a9ed7,_0x557552){return client[_0x5b6f('0x9')](_0x4d0ff9,_0x126d79)[_0x5b6f('0xa')](function(_0x148912){logger[_0x5b6f('0xb')](_0x5b6f('0xc'),_0x327f1f,'request\x20sent');logger[_0x5b6f('0xd')](_0x5b6f('0xe'),_0x327f1f,_0x5b6f('0xf'),JSON[_0x5b6f('0x10')](_0x148912));if(_0x148912[_0x5b6f('0x11')]){if(_0x148912[_0x5b6f('0x11')]['code']===0x1f4){logger[_0x5b6f('0x11')](_0x5b6f('0xc'),_0x327f1f,_0x148912[_0x5b6f('0x11')][_0x5b6f('0x12')]);return _0x557552(_0x148912[_0x5b6f('0x11')]['message']);}logger['error'](_0x5b6f('0xc'),_0x327f1f,_0x148912[_0x5b6f('0x11')][_0x5b6f('0x12')]);return _0x2a9ed7(_0x148912[_0x5b6f('0x11')][_0x5b6f('0x12')]);}else{logger[_0x5b6f('0xb')](_0x5b6f('0xc'),_0x327f1f,_0x5b6f('0xf'));_0x2a9ed7(_0x148912[_0x5b6f('0x13')][_0x5b6f('0x12')]);}})[_0x5b6f('0x14')](function(_0x82b8f5){logger[_0x5b6f('0x11')](_0x5b6f('0xc'),_0x327f1f,_0x82b8f5);_0x557552(_0x82b8f5);});});} \ No newline at end of file +var _0xe6de=['rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3d76a7,_0x3fbd62){var _0x2f7220=function(_0x15f006){while(--_0x15f006){_0x3d76a7['push'](_0x3d76a7['shift']());}};_0x2f7220(++_0x3fbd62);}(_0xe6de,0x190));var _0xee6d=function(_0x37d0d3,_0x21a65c){_0x37d0d3=_0x37d0d3-0x0;var _0x3ba775=_0xe6de[_0x37d0d3];return _0x3ba775;};'use strict';var _=require(_0xee6d('0x0'));var util=require(_0xee6d('0x1'));var moment=require(_0xee6d('0x2'));var BPromise=require(_0xee6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee6d('0x4'));var db=require(_0xee6d('0x5'))['db'];var utils=require(_0xee6d('0x6'));var logger=require(_0xee6d('0x7'))(_0xee6d('0x8'));var config=require(_0xee6d('0x9'));var jayson=require(_0xee6d('0xa'));var client=jayson[_0xee6d('0xb')][_0xee6d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x44a587,_0x1854cb,_0x46a1cd){return new BPromise(function(_0x66605e,_0x756f82){return client['request'](_0x44a587,_0x46a1cd)[_0xee6d('0xd')](function(_0x108af9){logger[_0xee6d('0xe')](_0xee6d('0xf'),_0x1854cb,_0xee6d('0x10'));logger['debug'](_0xee6d('0x11'),_0x1854cb,_0xee6d('0x10'),JSON[_0xee6d('0x12')](_0x108af9));if(_0x108af9[_0xee6d('0x13')]){if(_0x108af9['error'][_0xee6d('0x14')]===0x1f4){logger['error'](_0xee6d('0xf'),_0x1854cb,_0x108af9[_0xee6d('0x13')][_0xee6d('0x15')]);return _0x756f82(_0x108af9['error']['message']);}logger['error'](_0xee6d('0xf'),_0x1854cb,_0x108af9[_0xee6d('0x13')][_0xee6d('0x15')]);return _0x66605e(_0x108af9[_0xee6d('0x13')]['message']);}else{logger['info'](_0xee6d('0xf'),_0x1854cb,'request\x20sent');_0x66605e(_0x108af9[_0xee6d('0x16')][_0xee6d('0x15')]);}})[_0xee6d('0x17')](function(_0x23c8bb){logger[_0xee6d('0x13')](_0xee6d('0xf'),_0x1854cb,_0x23c8bb);_0x756f82(_0x23c8bb);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 0e0e60b..21622fa 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 _0xcba3=['preview','run','/:id/query','post','delete','multer','util','path','express','Router','../../components/interaction/service','./analyticDefaultReport.controller','get','index','/:id','show','/:id/preview','isAuthenticated'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xcba3,0x149));var _0x3cba=function(_0x49c2ac,_0x4d2826){_0x49c2ac=_0x49c2ac-0x0;var _0x185cbd=_0xcba3[_0x49c2ac];return _0x185cbd;};'use strict';var multer=require(_0x3cba('0x0'));var util=require(_0x3cba('0x1'));var path=require(_0x3cba('0x2'));var timeout=require('connect-timeout');var express=require(_0x3cba('0x3'));var router=express[_0x3cba('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3cba('0x5'));var config=require('../../config/environment');var controller=require(_0x3cba('0x6'));router[_0x3cba('0x7')]('/',auth['isAuthenticated'](),controller[_0x3cba('0x8')]);router[_0x3cba('0x7')](_0x3cba('0x9'),auth['isAuthenticated'](),controller[_0x3cba('0xa')]);router['get'](_0x3cba('0xb'),auth[_0x3cba('0xc')](),controller[_0x3cba('0xd')]);router[_0x3cba('0x7')]('/:id/run',auth[_0x3cba('0xc')](),controller[_0x3cba('0xe')]);router[_0x3cba('0x7')](_0x3cba('0xf'),auth['isAuthenticated'](),controller['query']);router[_0x3cba('0x10')]('/',auth[_0x3cba('0xc')](),controller['create']);router['put'](_0x3cba('0x9'),auth[_0x3cba('0xc')](),controller['update']);router[_0x3cba('0x11')](_0x3cba('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9192=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/preview','preview','query','post'];(function(_0x35a9a7,_0x5e8c7f){var _0x142c13=function(_0x6f2671){while(--_0x6f2671){_0x35a9a7['push'](_0x35a9a7['shift']());}};_0x142c13(++_0x5e8c7f);}(_0x9192,0x1a7));var _0x2919=function(_0x1db481,_0x1627b2){_0x1db481=_0x1db481-0x0;var _0x3db95b=_0x9192[_0x1db481];return _0x3db95b;};'use strict';var multer=require(_0x2919('0x0'));var util=require(_0x2919('0x1'));var path=require(_0x2919('0x2'));var timeout=require(_0x2919('0x3'));var express=require(_0x2919('0x4'));var router=express[_0x2919('0x5')]();var fs_extra=require(_0x2919('0x6'));var auth=require(_0x2919('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2919('0x8'));var controller=require('./analyticDefaultReport.controller');router[_0x2919('0x9')]('/',auth[_0x2919('0xa')](),controller['index']);router[_0x2919('0x9')](_0x2919('0xb'),auth[_0x2919('0xa')](),controller[_0x2919('0xc')]);router[_0x2919('0x9')](_0x2919('0xd'),auth['isAuthenticated'](),controller[_0x2919('0xe')]);router[_0x2919('0x9')]('/:id/run',auth[_0x2919('0xa')](),controller['run']);router[_0x2919('0x9')]('/:id/query',auth[_0x2919('0xa')](),controller[_0x2919('0xf')]);router[_0x2919('0x10')]('/',auth['isAuthenticated'](),controller[_0x2919('0x11')]);router['put']('/:id',auth[_0x2919('0xa')](),controller[_0x2919('0x12')]);router[_0x2919('0x13')](_0x2919('0xb'),auth['isAuthenticated'](),controller[_0x2919('0x14')]);module[_0x2919('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 5b8b5ae..f664993 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 _0x603b=['csv','pdf','xlsx','DATE','manual','scheduled','sequelize','exports','STRING','ENUM'];(function(_0x2cd4ae,_0x42598e){var _0x50f3e7=function(_0x4d19c5){while(--_0x4d19c5){_0x2cd4ae['push'](_0x2cd4ae['shift']());}};_0x50f3e7(++_0x42598e);}(_0x603b,0x150));var _0xb603=function(_0x1600a1,_0x470208){_0x1600a1=_0x1600a1-0x0;var _0x537101=_0x603b[_0x1600a1];return _0x537101;};'use strict';var Sequelize=require(_0xb603('0x0'));var moment=require('moment');module[_0xb603('0x1')]={'name':{'type':Sequelize[_0xb603('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xb603('0x3')](_0xb603('0x4'),_0xb603('0x5'),_0xb603('0x6')),'allowNull':![],'defaultValue':_0xb603('0x4')},'savename':{'type':Sequelize[_0xb603('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xb603('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xb603('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xb603('0x3')](_0xb603('0x8'),_0xb603('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xb603('0x2')]}}; \ No newline at end of file +var _0x3056=['csv','pdf','xlsx','DATE','Loading','scheduled','manual','INTEGER','sequelize','moment','exports','STRING','ENUM'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x3056,0x7d));var _0x6305=function(_0x594673,_0x406c0){_0x594673=_0x594673-0x0;var _0x3e9c33=_0x3056[_0x594673];return _0x3e9c33;};'use strict';var Sequelize=require(_0x6305('0x0'));var moment=require(_0x6305('0x1'));module[_0x6305('0x2')]={'name':{'type':Sequelize[_0x6305('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x6305('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x6305('0x4')](_0x6305('0x5'),_0x6305('0x6'),_0x6305('0x7')),'allowNull':![],'defaultValue':_0x6305('0x5')},'savename':{'type':Sequelize[_0x6305('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x6305('0x8')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0x6305('0x9')},'type':{'type':Sequelize[_0x6305('0x4')]('manual',_0x6305('0xa')),'allowNull':![],'defaultValue':_0x6305('0xb')},'reportId':{'type':Sequelize[_0x6305('0xc')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x6305('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index c72b87e..1c7edb8 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 _0xc22a=['create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','savename','output','join','root','server/files/reports','Report\x20not\x20found\x20or\x20empty','download','format','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','destroy','then','ExtractedReports','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','count','includeAll','findAll','rows','catch','show','keys','include','options','find'];(function(_0x486a30,_0x1ebf40){var _0x39520d=function(_0xb54c94){while(--_0xb54c94){_0x486a30['push'](_0x486a30['shift']());}};_0x39520d(++_0x1ebf40);}(_0xc22a,0x130));var _0xac22=function(_0x2f37eb,_0x2ba5cf){_0x2f37eb=_0x2f37eb-0x0;var _0x57ad1b=_0xc22a[_0x2f37eb];return _0x57ad1b;};'use strict';var emlformat=require(_0xac22('0x0'));var rimraf=require(_0xac22('0x1'));var zipdir=require(_0xac22('0x2'));var jsonpatch=require(_0xac22('0x3'));var rp=require(_0xac22('0x4'));var moment=require(_0xac22('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xac22('0x6'));var util=require(_0xac22('0x7'));var path=require(_0xac22('0x8'));var sox=require(_0xac22('0x9'));var csv=require(_0xac22('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac22('0xb'));var _=require(_0xac22('0xc'));var squel=require('squel');var crypto=require(_0xac22('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xac22('0xe'));var toCsv=require(_0xac22('0xa'));var querystring=require(_0xac22('0xf'));var Papa=require(_0xac22('0x10'));var Redis=require('ioredis');var authService=require(_0xac22('0x11'));var qs=require(_0xac22('0x12'));var as=require(_0xac22('0x13'));var hardwareService=require(_0xac22('0x14'));var logger=require(_0xac22('0x15'))(_0xac22('0x16'));var utils=require(_0xac22('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xac22('0x18'));var db=require(_0xac22('0x19'))['db'];function respondWithStatusCode(_0x16f68c,_0x321235){_0x321235=_0x321235||0xcc;return function(_0x42e188){if(_0x42e188){return _0x16f68c[_0xac22('0x1a')](_0x321235);}return _0x16f68c['status'](_0x321235)[_0xac22('0x1b')]();};}function respondWithResult(_0x5a801e,_0x1de6ce){_0x1de6ce=_0x1de6ce||0xc8;return function(_0x5c8c9c){if(_0x5c8c9c){return _0x5a801e[_0xac22('0x1c')](_0x1de6ce)[_0xac22('0x1d')](_0x5c8c9c);}};}function respondWithFilteredResult(_0x1977f0,_0x277704){return function(_0x2d41c8){if(_0x2d41c8){var _0x1e6c38=typeof _0x277704[_0xac22('0x1e')]===_0xac22('0x1f')&&typeof _0x277704['limit']===_0xac22('0x1f');var _0x324bce=_0x2d41c8['count'];var _0x4b0b4b=_0x1e6c38?0x0:_0x277704[_0xac22('0x1e')];var _0x4b4a97=_0x1e6c38?_0x2d41c8['count']:_0x277704[_0xac22('0x1e')]+_0x277704[_0xac22('0x20')];var _0x51fe72;if(_0x4b4a97>=_0x324bce){_0x4b4a97=_0x324bce;_0x51fe72=0xc8;}else{_0x51fe72=0xce;}_0x1977f0['status'](_0x51fe72);return _0x1977f0[_0xac22('0x21')](_0xac22('0x22'),_0x4b0b4b+'-'+_0x4b4a97+'/'+_0x324bce)[_0xac22('0x1d')](_0x2d41c8);}return null;};}function patchUpdates(_0x21323d){return function(_0x32ba0b){try{jsonpatch[_0xac22('0x23')](_0x32ba0b,_0x21323d,!![]);}catch(_0x251f14){return BPromise['reject'](_0x251f14);}return _0x32ba0b[_0xac22('0x24')]();};}function saveUpdates(_0x345be2,_0x4b1ce6){return function(_0x452ec0){if(_0x452ec0){return _0x452ec0[_0xac22('0x25')](_0x345be2)['then'](function(_0x425aca){return _0x425aca;});}return null;};}function removeEntity(_0x204639,_0x15742c){return function(_0x1873fb){if(_0x1873fb){return _0x1873fb[_0xac22('0x26')]()[_0xac22('0x27')](function(){var _0xf64813=_0x1873fb['get']({'plain':!![]});var _0x189b9c=_0xac22('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x189b9c,'resourceId':_0xf64813['id']}})[_0xac22('0x27')](function(){return _0x1873fb;});})['then'](function(){_0x204639[_0xac22('0x1c')](0xcc)[_0xac22('0x1b')]();});}};}function handleEntityNotFound(_0x51b356,_0x1d2cb1){return function(_0x395663){if(!_0x395663){_0x51b356[_0xac22('0x1a')](0x194);}return _0x395663;};}function handleError(_0x41331a,_0x4e83fa){_0x4e83fa=_0x4e83fa||0x1f4;return function(_0x466e08){logger[_0xac22('0x29')](_0x466e08[_0xac22('0x2a')]);if(_0x466e08['name']){delete _0x466e08[_0xac22('0x2b')];}_0x41331a[_0xac22('0x1c')](_0x4e83fa)[_0xac22('0x2c')](_0x466e08);};}exports[_0xac22('0x2d')]=function(_0x51b477,_0x312dda){var _0x51fb0d={},_0x250df0={},_0x2df3df={'count':0x0,'rows':[]};var _0x58020d=_['map'](db[_0xac22('0x2e')][_0xac22('0x2f')],function(_0x7e8f58){return{'name':_0x7e8f58[_0xac22('0x30')],'type':_0x7e8f58[_0xac22('0x31')][_0xac22('0x32')]};});_0x250df0['model']=_['map'](_0x58020d,_0xac22('0x2b'));_0x250df0[_0xac22('0x33')]=_['keys'](_0x51b477['query']);_0x250df0[_0xac22('0x34')]=_[_0xac22('0x35')](_0x250df0[_0xac22('0x36')],_0x250df0[_0xac22('0x33')]);_0x51fb0d[_0xac22('0x37')]=_[_0xac22('0x35')](_0x250df0[_0xac22('0x36')],qs['fields'](_0x51b477[_0xac22('0x33')][_0xac22('0x38')]));_0x51fb0d['attributes']=_0x51fb0d[_0xac22('0x37')]['length']?_0x51fb0d[_0xac22('0x37')]:_0x250df0['model'];if(!_0x51b477[_0xac22('0x33')][_0xac22('0x39')](_0xac22('0x3a'))){_0x51fb0d[_0xac22('0x20')]=qs[_0xac22('0x20')](_0x51b477[_0xac22('0x33')][_0xac22('0x20')]);_0x51fb0d[_0xac22('0x1e')]=qs[_0xac22('0x1e')](_0x51b477[_0xac22('0x33')][_0xac22('0x1e')]);}_0x51fb0d[_0xac22('0x3b')]=qs['sort'](_0x51b477[_0xac22('0x33')][_0xac22('0x3c')]);_0x51fb0d[_0xac22('0x3d')]=qs[_0xac22('0x34')](_['pick'](_0x51b477[_0xac22('0x33')],_0x250df0[_0xac22('0x34')]),_0x58020d);if(_0x51b477[_0xac22('0x33')][_0xac22('0x3e')]){_0x51fb0d[_0xac22('0x3d')]=_[_0xac22('0x3f')](_0x51fb0d[_0xac22('0x3d')],{'$or':_[_0xac22('0x40')](_0x58020d,function(_0x273902){if(_0x273902[_0xac22('0x31')]!==_0xac22('0x41')){var _0x36c4ab={};_0x36c4ab[_0x273902[_0xac22('0x2b')]]={'$like':'%'+_0x51b477['query'][_0xac22('0x3e')]+'%'};return _0x36c4ab;}})});}_0x51fb0d=_['merge']({},_0x51fb0d,_0x51b477['options']);var _0x4efabf={'where':_0x51fb0d[_0xac22('0x3d')]};return db[_0xac22('0x2e')]['count'](_0x4efabf)['then'](function(_0x538ca0){_0x2df3df[_0xac22('0x42')]=_0x538ca0;if(_0x51b477[_0xac22('0x33')][_0xac22('0x43')]){_0x51fb0d['include']=[{'all':!![]}];}return db[_0xac22('0x2e')][_0xac22('0x44')](_0x51fb0d);})[_0xac22('0x27')](function(_0x7f2e9e){_0x2df3df[_0xac22('0x45')]=_0x7f2e9e;return _0x2df3df;})[_0xac22('0x27')](respondWithFilteredResult(_0x312dda,_0x51fb0d))[_0xac22('0x46')](handleError(_0x312dda,null));};exports[_0xac22('0x47')]=function(_0x504b76,_0x307d38){var _0x1979b1={'raw':!![],'where':{'id':_0x504b76['params']['id']}},_0x36b9c1={};_0x36b9c1[_0xac22('0x36')]=_[_0xac22('0x48')](db[_0xac22('0x2e')]['rawAttributes']);_0x36b9c1[_0xac22('0x33')]=_['keys'](_0x504b76[_0xac22('0x33')]);_0x36b9c1['filters']=_[_0xac22('0x35')](_0x36b9c1[_0xac22('0x36')],_0x36b9c1[_0xac22('0x33')]);_0x1979b1['attributes']=_['intersection'](_0x36b9c1['model'],qs['fields'](_0x504b76['query'][_0xac22('0x38')]));_0x1979b1[_0xac22('0x37')]=_0x1979b1['attributes']['length']?_0x1979b1[_0xac22('0x37')]:_0x36b9c1['model'];if(_0x504b76[_0xac22('0x33')][_0xac22('0x43')]){_0x1979b1[_0xac22('0x49')]=[{'all':!![]}];}_0x1979b1=_[_0xac22('0x3f')]({},_0x1979b1,_0x504b76[_0xac22('0x4a')]);return db[_0xac22('0x2e')][_0xac22('0x4b')](_0x1979b1)['then'](handleEntityNotFound(_0x307d38,null))['then'](respondWithResult(_0x307d38,null))['catch'](handleError(_0x307d38,null));};exports[_0xac22('0x4c')]=function(_0x1bbb4f,_0x557f3f){return db[_0xac22('0x2e')][_0xac22('0x4c')](_0x1bbb4f[_0xac22('0x4d')],{})[_0xac22('0x27')](function(_0x2e024a){var _0x501d3f=_0x1bbb4f['user']['get']({'plain':!![]});if(!_0x501d3f)throw new Error(_0xac22('0x4e'));if(_0x501d3f['role']===_0xac22('0x4f')){var _0x17a149=_0x2e024a[_0xac22('0x50')]({'plain':!![]});var _0x42f071=_0xac22('0x28');return db[_0xac22('0x51')][_0xac22('0x4b')]({'where':{'name':_0x42f071,'userProfileId':_0x501d3f[_0xac22('0x52')]},'raw':!![]})[_0xac22('0x27')](function(_0x2a5173){if(_0x2a5173&&_0x2a5173['autoAssociation']===0x0){return db[_0xac22('0x53')][_0xac22('0x4c')]({'name':_0x17a149[_0xac22('0x2b')],'resourceId':_0x17a149['id'],'type':_0x2a5173[_0xac22('0x2b')],'sectionId':_0x2a5173['id']},{})[_0xac22('0x27')](function(){return _0x2e024a;});}else{return _0x2e024a;}})[_0xac22('0x46')](function(_0x4bbd06){logger['error'](_0xac22('0x54'),_0x4bbd06);throw _0x4bbd06;});}return _0x2e024a;})[_0xac22('0x27')](respondWithResult(_0x557f3f,0xc9))['catch'](handleError(_0x557f3f,null));};exports[_0xac22('0x25')]=function(_0x3beb52,_0x4f4645){if(_0x3beb52['body']['id']){delete _0x3beb52[_0xac22('0x4d')]['id'];}return db[_0xac22('0x2e')][_0xac22('0x4b')]({'where':{'id':_0x3beb52['params']['id']}})[_0xac22('0x27')](handleEntityNotFound(_0x4f4645,null))[_0xac22('0x27')](saveUpdates(_0x3beb52[_0xac22('0x4d')],null))[_0xac22('0x27')](respondWithResult(_0x4f4645,null))[_0xac22('0x46')](handleError(_0x4f4645,null));};exports[_0xac22('0x26')]=function(_0x5d5b93,_0x11c9d9){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x5d5b93['params']['id']}})[_0xac22('0x27')](handleEntityNotFound(_0x11c9d9,null))['then'](removeEntity(_0x11c9d9,null))[_0xac22('0x46')](handleError(_0x11c9d9,null));};exports['download']=function(_0x4a3759,_0x3602e1,_0x38d7bc){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x4a3759[_0xac22('0x55')]['id']},'attributes':[_0xac22('0x2b'),'basename',_0xac22('0x56'),_0xac22('0x57')],'raw':!![]})['then'](handleEntityNotFound(_0x3602e1,null))[_0xac22('0x27')](function(_0x5a982d){if(_0x5a982d){if(!fs['existsSync'](path[_0xac22('0x58')](config[_0xac22('0x59')],_0xac22('0x5a'),_0x5a982d[_0xac22('0x56')]))){throw new db['Sequelize']['ValidationError'](_0xac22('0x5b'));}if(_0x4a3759['query']['exists']){return _0x3602e1[_0xac22('0x1a')](0xc8);}return _0x3602e1[_0xac22('0x5c')](path[_0xac22('0x58')](config['root'],_0xac22('0x5a'),_0x5a982d[_0xac22('0x56')]),util[_0xac22('0x5d')]('%s.%s',_0x5a982d[_0xac22('0x5e')]||_0x5a982d[_0xac22('0x2b')],_0x5a982d[_0xac22('0x57')]['toLowerCase']()));}})['catch'](handleError(_0x3602e1,null));}; \ No newline at end of file +var _0x942c=['offset','set','Content-Range','apply','reject','then','UserProfileResource','destroy','sendStatus','error','name','index','AnalyticExtractedReport','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','savename','join','ValidationError','Report\x20not\x20found\x20or\x20empty','server/files/reports','format','%s.%s','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count'];(function(_0x173f35,_0x2260b6){var _0xf033c6=function(_0x3d9b51){while(--_0x3d9b51){_0x173f35['push'](_0x173f35['shift']());}};_0xf033c6(++_0x2260b6);}(_0x942c,0x19c));var _0xc942=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x942c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc942('0x0'));var rimraf=require(_0xc942('0x1'));var zipdir=require(_0xc942('0x2'));var jsonpatch=require(_0xc942('0x3'));var rp=require('request-promise');var moment=require(_0xc942('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc942('0x5'));var util=require(_0xc942('0x6'));var path=require(_0xc942('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc942('0x8'));var fs=require('fs');var fs_extra=require(_0xc942('0x9'));var _=require('lodash');var squel=require(_0xc942('0xa'));var crypto=require(_0xc942('0xb'));var jsforce=require(_0xc942('0xc'));var deskjs=require(_0xc942('0xd'));var toCsv=require(_0xc942('0xe'));var querystring=require(_0xc942('0xf'));var Papa=require(_0xc942('0x10'));var Redis=require('ioredis');var authService=require(_0xc942('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc942('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc942('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc942('0x14'));var db=require(_0xc942('0x15'))['db'];function respondWithStatusCode(_0x3fa026,_0x42adbd){_0x42adbd=_0x42adbd||0xcc;return function(_0x104c8d){if(_0x104c8d){return _0x3fa026['sendStatus'](_0x42adbd);}return _0x3fa026[_0xc942('0x16')](_0x42adbd)[_0xc942('0x17')]();};}function respondWithResult(_0x49057a,_0x48d4ab){_0x48d4ab=_0x48d4ab||0xc8;return function(_0x3c3405){if(_0x3c3405){return _0x49057a[_0xc942('0x16')](_0x48d4ab)[_0xc942('0x18')](_0x3c3405);}};}function respondWithFilteredResult(_0x264c71,_0x231fe6){return function(_0x5e7be7){if(_0x5e7be7){var _0x4ba58c=typeof _0x231fe6['offset']===_0xc942('0x19')&&typeof _0x231fe6[_0xc942('0x1a')]===_0xc942('0x19');var _0x2044c8=_0x5e7be7[_0xc942('0x1b')];var _0xb1a802=_0x4ba58c?0x0:_0x231fe6[_0xc942('0x1c')];var _0x4899c5=_0x4ba58c?_0x5e7be7[_0xc942('0x1b')]:_0x231fe6[_0xc942('0x1c')]+_0x231fe6['limit'];var _0x5f3415;if(_0x4899c5>=_0x2044c8){_0x4899c5=_0x2044c8;_0x5f3415=0xc8;}else{_0x5f3415=0xce;}_0x264c71[_0xc942('0x16')](_0x5f3415);return _0x264c71[_0xc942('0x1d')](_0xc942('0x1e'),_0xb1a802+'-'+_0x4899c5+'/'+_0x2044c8)['json'](_0x5e7be7);}return null;};}function patchUpdates(_0x14b50c){return function(_0x5cfa3c){try{jsonpatch[_0xc942('0x1f')](_0x5cfa3c,_0x14b50c,!![]);}catch(_0x5843a6){return BPromise[_0xc942('0x20')](_0x5843a6);}return _0x5cfa3c['save']();};}function saveUpdates(_0x42a529,_0x4c171c){return function(_0x4495ed){if(_0x4495ed){return _0x4495ed['update'](_0x42a529)[_0xc942('0x21')](function(_0x19d1d){return _0x19d1d;});}return null;};}function removeEntity(_0x4b0905,_0x4292c3){return function(_0x1843f5){if(_0x1843f5){return _0x1843f5['destroy']()[_0xc942('0x21')](function(){var _0x408bce=_0x1843f5['get']({'plain':!![]});var _0x3336ed='ExtractedReports';return db[_0xc942('0x22')][_0xc942('0x23')]({'where':{'type':_0x3336ed,'resourceId':_0x408bce['id']}})[_0xc942('0x21')](function(){return _0x1843f5;});})[_0xc942('0x21')](function(){_0x4b0905[_0xc942('0x16')](0xcc)[_0xc942('0x17')]();});}};}function handleEntityNotFound(_0x25f7a0,_0x2f9090){return function(_0x274934){if(!_0x274934){_0x25f7a0[_0xc942('0x24')](0x194);}return _0x274934;};}function handleError(_0x52ba5e,_0x5ef4e6){_0x5ef4e6=_0x5ef4e6||0x1f4;return function(_0x2f6226){logger[_0xc942('0x25')](_0x2f6226['stack']);if(_0x2f6226[_0xc942('0x26')]){delete _0x2f6226[_0xc942('0x26')];}_0x52ba5e[_0xc942('0x16')](_0x5ef4e6)['send'](_0x2f6226);};}exports[_0xc942('0x27')]=function(_0x4a7592,_0x564e94){var _0x1d73d7={},_0x3a7d65={},_0x245f7e={'count':0x0,'rows':[]};var _0x2e3eaa=_['map'](db[_0xc942('0x28')][_0xc942('0x29')],function(_0x3f4429){return{'name':_0x3f4429[_0xc942('0x2a')],'type':_0x3f4429['type'][_0xc942('0x2b')]};});_0x3a7d65[_0xc942('0x2c')]=_[_0xc942('0x2d')](_0x2e3eaa,_0xc942('0x26'));_0x3a7d65[_0xc942('0x2e')]=_[_0xc942('0x2f')](_0x4a7592['query']);_0x3a7d65['filters']=_[_0xc942('0x30')](_0x3a7d65['model'],_0x3a7d65['query']);_0x1d73d7[_0xc942('0x31')]=_[_0xc942('0x30')](_0x3a7d65[_0xc942('0x2c')],qs[_0xc942('0x32')](_0x4a7592[_0xc942('0x2e')]['fields']));_0x1d73d7[_0xc942('0x31')]=_0x1d73d7[_0xc942('0x31')]['length']?_0x1d73d7[_0xc942('0x31')]:_0x3a7d65[_0xc942('0x2c')];if(!_0x4a7592[_0xc942('0x2e')][_0xc942('0x33')](_0xc942('0x34'))){_0x1d73d7[_0xc942('0x1a')]=qs[_0xc942('0x1a')](_0x4a7592[_0xc942('0x2e')][_0xc942('0x1a')]);_0x1d73d7['offset']=qs[_0xc942('0x1c')](_0x4a7592[_0xc942('0x2e')][_0xc942('0x1c')]);}_0x1d73d7['order']=qs[_0xc942('0x35')](_0x4a7592[_0xc942('0x2e')][_0xc942('0x35')]);_0x1d73d7[_0xc942('0x36')]=qs[_0xc942('0x37')](_[_0xc942('0x38')](_0x4a7592['query'],_0x3a7d65['filters']),_0x2e3eaa);if(_0x4a7592[_0xc942('0x2e')][_0xc942('0x39')]){_0x1d73d7[_0xc942('0x36')]=_[_0xc942('0x3a')](_0x1d73d7[_0xc942('0x36')],{'$or':_[_0xc942('0x2d')](_0x2e3eaa,function(_0x5da774){if(_0x5da774[_0xc942('0x3b')]!==_0xc942('0x3c')){var _0x5e3a64={};_0x5e3a64[_0x5da774['name']]={'$like':'%'+_0x4a7592[_0xc942('0x2e')]['filter']+'%'};return _0x5e3a64;}})});}_0x1d73d7=_[_0xc942('0x3a')]({},_0x1d73d7,_0x4a7592[_0xc942('0x3d')]);var _0xbf81e0={'where':_0x1d73d7['where']};return db[_0xc942('0x28')]['count'](_0xbf81e0)['then'](function(_0x56379b){_0x245f7e['count']=_0x56379b;if(_0x4a7592[_0xc942('0x2e')][_0xc942('0x3e')]){_0x1d73d7[_0xc942('0x3f')]=[{'all':!![]}];}return db[_0xc942('0x28')][_0xc942('0x40')](_0x1d73d7);})['then'](function(_0x4351dd){_0x245f7e['rows']=_0x4351dd;return _0x245f7e;})[_0xc942('0x21')](respondWithFilteredResult(_0x564e94,_0x1d73d7))[_0xc942('0x41')](handleError(_0x564e94,null));};exports[_0xc942('0x42')]=function(_0x37ebec,_0x3d34a4){var _0x11f4f9={'raw':!![],'where':{'id':_0x37ebec[_0xc942('0x43')]['id']}},_0x4078d3={};_0x4078d3[_0xc942('0x2c')]=_[_0xc942('0x2f')](db[_0xc942('0x28')][_0xc942('0x29')]);_0x4078d3['query']=_[_0xc942('0x2f')](_0x37ebec[_0xc942('0x2e')]);_0x4078d3[_0xc942('0x37')]=_[_0xc942('0x30')](_0x4078d3['model'],_0x4078d3['query']);_0x11f4f9[_0xc942('0x31')]=_[_0xc942('0x30')](_0x4078d3[_0xc942('0x2c')],qs[_0xc942('0x32')](_0x37ebec[_0xc942('0x2e')]['fields']));_0x11f4f9[_0xc942('0x31')]=_0x11f4f9[_0xc942('0x31')][_0xc942('0x44')]?_0x11f4f9[_0xc942('0x31')]:_0x4078d3['model'];if(_0x37ebec[_0xc942('0x2e')][_0xc942('0x3e')]){_0x11f4f9[_0xc942('0x3f')]=[{'all':!![]}];}_0x11f4f9=_[_0xc942('0x3a')]({},_0x11f4f9,_0x37ebec[_0xc942('0x3d')]);return db[_0xc942('0x28')]['find'](_0x11f4f9)[_0xc942('0x21')](handleEntityNotFound(_0x3d34a4,null))['then'](respondWithResult(_0x3d34a4,null))['catch'](handleError(_0x3d34a4,null));};exports[_0xc942('0x45')]=function(_0x56248d,_0x24ab3d){return db[_0xc942('0x28')]['create'](_0x56248d[_0xc942('0x46')],{})[_0xc942('0x21')](function(_0x34b66e){var _0x30d5b6=_0x56248d[_0xc942('0x47')]['get']({'plain':!![]});if(!_0x30d5b6)throw new Error(_0xc942('0x48'));if(_0x30d5b6['role']===_0xc942('0x47')){var _0x2d606d=_0x34b66e[_0xc942('0x49')]({'plain':!![]});var _0x54b87d='ExtractedReports';return db[_0xc942('0x4a')][_0xc942('0x4b')]({'where':{'name':_0x54b87d,'userProfileId':_0x30d5b6['userProfileId']},'raw':!![]})[_0xc942('0x21')](function(_0x20ed23){if(_0x20ed23&&_0x20ed23[_0xc942('0x4c')]===0x0){return db[_0xc942('0x22')]['create']({'name':_0x2d606d['name'],'resourceId':_0x2d606d['id'],'type':_0x20ed23['name'],'sectionId':_0x20ed23['id']},{})[_0xc942('0x21')](function(){return _0x34b66e;});}else{return _0x34b66e;}})[_0xc942('0x41')](function(_0x469ecb){logger['error'](_0xc942('0x4d'),_0x469ecb);throw _0x469ecb;});}return _0x34b66e;})[_0xc942('0x21')](respondWithResult(_0x24ab3d,0xc9))[_0xc942('0x41')](handleError(_0x24ab3d,null));};exports['update']=function(_0x49b0de,_0x46d70d){if(_0x49b0de[_0xc942('0x46')]['id']){delete _0x49b0de[_0xc942('0x46')]['id'];}return db['AnalyticExtractedReport'][_0xc942('0x4b')]({'where':{'id':_0x49b0de[_0xc942('0x43')]['id']}})[_0xc942('0x21')](handleEntityNotFound(_0x46d70d,null))[_0xc942('0x21')](saveUpdates(_0x49b0de[_0xc942('0x46')],null))[_0xc942('0x21')](respondWithResult(_0x46d70d,null))[_0xc942('0x41')](handleError(_0x46d70d,null));};exports['destroy']=function(_0x217b16,_0x292003){return db['AnalyticExtractedReport'][_0xc942('0x4b')]({'where':{'id':_0x217b16[_0xc942('0x43')]['id']}})[_0xc942('0x21')](handleEntityNotFound(_0x292003,null))['then'](removeEntity(_0x292003,null))[_0xc942('0x41')](handleError(_0x292003,null));};exports[_0xc942('0x4e')]=function(_0x5547da,_0x1ecc23,_0x130752){return db['AnalyticExtractedReport'][_0xc942('0x4b')]({'where':{'id':_0x5547da['params']['id']},'attributes':['name','basename',_0xc942('0x4f'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x1ecc23,null))[_0xc942('0x21')](function(_0x8cd3f3){if(_0x8cd3f3){if(!fs['existsSync'](path[_0xc942('0x50')](config['root'],'server/files/reports',_0x8cd3f3[_0xc942('0x4f')]))){throw new db['Sequelize'][(_0xc942('0x51'))](_0xc942('0x52'));}if(_0x5547da[_0xc942('0x2e')]['exists']){return _0x1ecc23[_0xc942('0x24')](0xc8);}return _0x1ecc23[_0xc942('0x4e')](path[_0xc942('0x50')](config['root'],_0xc942('0x53'),_0x8cd3f3[_0xc942('0x4f')]),util[_0xc942('0x54')](_0xc942('0x55'),_0x8cd3f3['basename']||_0x8cd3f3[_0xc942('0x26')],_0x8cd3f3[_0xc942('0x56')][_0xc942('0x57')]()));}})[_0xc942('0x41')](handleError(_0x1ecc23,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 72cec42..42755a5 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 _0xe7c2=['api','bluebird','request-promise','rimraf','../../config/environment','exports','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger'];(function(_0x564c2a,_0x18ba4b){var _0x3f9137=function(_0x5362c0){while(--_0x5362c0){_0x564c2a['push'](_0x564c2a['shift']());}};_0x3f9137(++_0x18ba4b);}(_0xe7c2,0x152));var _0x2e7c=function(_0x37a320,_0x2bda8d){_0x37a320=_0x37a320-0x0;var _0x49b4a4=_0xe7c2[_0x37a320];return _0x49b4a4;};'use strict';var _=require('lodash');var util=require(_0x2e7c('0x0'));var logger=require(_0x2e7c('0x1'))(_0x2e7c('0x2'));var moment=require('moment');var BPromise=require(_0x2e7c('0x3'));var rp=require(_0x2e7c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e7c('0x5'));var config=require(_0x2e7c('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0x2e7c('0x7')]=function(_0x3c2900,_0x2fd503){return _0x3c2900['define'](_0x2e7c('0x8'),attributes,{'tableName':_0x2e7c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfda9=['request-promise','../../config/environment','./analyticExtractedReport.attributes','exports','analytics_extracted_reports','lodash','../../config/logger','api','moment','bluebird'];(function(_0x340781,_0x32b659){var _0x1a6ab9=function(_0x17823c){while(--_0x17823c){_0x340781['push'](_0x340781['shift']());}};_0x1a6ab9(++_0x32b659);}(_0xfda9,0x91));var _0x9fda=function(_0x1139e6,_0xb76977){_0x1139e6=_0x1139e6-0x0;var _0x50da18=_0xfda9[_0x1139e6];return _0x50da18;};'use strict';var _=require(_0x9fda('0x0'));var util=require('util');var logger=require(_0x9fda('0x1'))(_0x9fda('0x2'));var moment=require(_0x9fda('0x3'));var BPromise=require(_0x9fda('0x4'));var rp=require(_0x9fda('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9fda('0x6'));var attributes=require(_0x9fda('0x7'));module[_0x9fda('0x8')]=function(_0x1f6799,_0x2ffb49){return _0x1f6799['define']('AnalyticExtractedReport',attributes,{'tableName':_0x9fda('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 51f5299..e8c1483 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 _0x7033=['client','http','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x55814d,_0x1668b8){var _0x54812e=function(_0x43df36){while(--_0x43df36){_0x55814d['push'](_0x55814d['shift']());}};_0x54812e(++_0x1668b8);}(_0x7033,0x19e));var _0x3703=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7033[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x3703('0x0'));var util=require(_0x3703('0x1'));var moment=require(_0x3703('0x2'));var BPromise=require(_0x3703('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3703('0x4'));var db=require(_0x3703('0x5'))['db'];var utils=require(_0x3703('0x6'));var logger=require(_0x3703('0x7'))(_0x3703('0x8'));var config=require(_0x3703('0x9'));var jayson=require(_0x3703('0xa'));var client=jayson[_0x3703('0xb')][_0x3703('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb3a377,_0x49f22c,_0x5df816){return new BPromise(function(_0x4ca371,_0x12c111){return client[_0x3703('0xd')](_0xb3a377,_0x5df816)[_0x3703('0xe')](function(_0x41ba6e){logger[_0x3703('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x49f22c,_0x3703('0x10'));logger[_0x3703('0x11')](_0x3703('0x12'),_0x49f22c,'request\x20sent',JSON['stringify'](_0x41ba6e));if(_0x41ba6e[_0x3703('0x13')]){if(_0x41ba6e['error'][_0x3703('0x14')]===0x1f4){logger[_0x3703('0x13')](_0x3703('0x15'),_0x49f22c,_0x41ba6e[_0x3703('0x13')]['message']);return _0x12c111(_0x41ba6e['error'][_0x3703('0x16')]);}logger[_0x3703('0x13')](_0x3703('0x15'),_0x49f22c,_0x41ba6e[_0x3703('0x13')][_0x3703('0x16')]);return _0x4ca371(_0x41ba6e[_0x3703('0x13')][_0x3703('0x16')]);}else{logger[_0x3703('0xf')](_0x3703('0x15'),_0x49f22c,_0x3703('0x10'));_0x4ca371(_0x41ba6e[_0x3703('0x17')][_0x3703('0x16')]);}})[_0x3703('0x18')](function(_0x407b4){logger['error'](_0x3703('0x15'),_0x49f22c,_0x407b4);_0x12c111(_0x407b4);});});} \ No newline at end of file +var _0x62b7=['AnalyticExtractedReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1183cb,_0x4eb5d8){var _0x2930d6=function(_0x4b2297){while(--_0x4b2297){_0x1183cb['push'](_0x1183cb['shift']());}};_0x2930d6(++_0x4eb5d8);}(_0x62b7,0x179));var _0x762b=function(_0xb4cc12,_0x41436e){_0xb4cc12=_0xb4cc12-0x0;var _0x8593b5=_0x62b7[_0xb4cc12];return _0x8593b5;};'use strict';var _=require(_0x762b('0x0'));var util=require(_0x762b('0x1'));var moment=require(_0x762b('0x2'));var BPromise=require(_0x762b('0x3'));var rs=require(_0x762b('0x4'));var fs=require('fs');var Redis=require(_0x762b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x762b('0x6'));var logger=require('../../config/logger')(_0x762b('0x7'));var config=require(_0x762b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x762b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48ff9b,_0x3e26a9,_0x27554f){return new BPromise(function(_0x3bf174,_0x11a460){return client[_0x762b('0xa')](_0x48ff9b,_0x27554f)[_0x762b('0xb')](function(_0x1b7697){logger[_0x762b('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3e26a9,_0x762b('0xd'));logger[_0x762b('0xe')](_0x762b('0xf'),_0x3e26a9,_0x762b('0xd'),JSON[_0x762b('0x10')](_0x1b7697));if(_0x1b7697[_0x762b('0x11')]){if(_0x1b7697[_0x762b('0x11')][_0x762b('0x12')]===0x1f4){logger[_0x762b('0x11')](_0x762b('0x13'),_0x3e26a9,_0x1b7697[_0x762b('0x11')]['message']);return _0x11a460(_0x1b7697[_0x762b('0x11')][_0x762b('0x14')]);}logger[_0x762b('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3e26a9,_0x1b7697['error']['message']);return _0x3bf174(_0x1b7697[_0x762b('0x11')]['message']);}else{logger[_0x762b('0xc')](_0x762b('0x13'),_0x3e26a9,'request\x20sent');_0x3bf174(_0x1b7697[_0x762b('0x15')][_0x762b('0x14')]);}})['catch'](function(_0x4f5a5f){logger[_0x762b('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3e26a9,_0x4f5a5f);_0x11a460(_0x4f5a5f);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 6a003ae..9c6f8df 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 _0x016f=['update','delete','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','create','put'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x016f,0xdb));var _0xf016=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x016f[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xf016('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf016('0x1'));var router=express[_0xf016('0x2')]();var fs_extra=require(_0xf016('0x3'));var auth=require(_0xf016('0x4'));var interaction=require(_0xf016('0x5'));var config=require('../../config/environment');var controller=require(_0xf016('0x6'));router[_0xf016('0x7')]('/',auth[_0xf016('0x8')](),controller[_0xf016('0x9')]);router[_0xf016('0x7')](_0xf016('0xa'),auth[_0xf016('0x8')](),controller[_0xf016('0xb')]);router['get'](_0xf016('0xc'),auth[_0xf016('0x8')](),controller['download']);router['post']('/',auth[_0xf016('0x8')](),controller[_0xf016('0xd')]);router[_0xf016('0xe')](_0xf016('0xa'),auth[_0xf016('0x8')](),controller[_0xf016('0xf')]);router[_0xf016('0x10')](_0xf016('0xa'),auth[_0xf016('0x8')](),controller['destroy']);module[_0xf016('0x11')]=router; \ No newline at end of file +var _0x1fb3=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','delete','destroy'];(function(_0x292d01,_0x4d8d28){var _0x1b76d4=function(_0x346ec8){while(--_0x346ec8){_0x292d01['push'](_0x292d01['shift']());}};_0x1b76d4(++_0x4d8d28);}(_0x1fb3,0x1b9));var _0x31fb=function(_0x1b4e5d,_0x559929){_0x1b4e5d=_0x1b4e5d-0x0;var _0x5d5818=_0x1fb3[_0x1b4e5d];return _0x5d5818;};'use strict';var multer=require('multer');var util=require(_0x31fb('0x0'));var path=require(_0x31fb('0x1'));var timeout=require(_0x31fb('0x2'));var express=require('express');var router=express[_0x31fb('0x3')]();var fs_extra=require(_0x31fb('0x4'));var auth=require(_0x31fb('0x5'));var interaction=require(_0x31fb('0x6'));var config=require(_0x31fb('0x7'));var controller=require(_0x31fb('0x8'));router[_0x31fb('0x9')]('/',auth[_0x31fb('0xa')](),controller[_0x31fb('0xb')]);router['get'](_0x31fb('0xc'),auth[_0x31fb('0xa')](),controller[_0x31fb('0xd')]);router[_0x31fb('0x9')](_0x31fb('0xe'),auth[_0x31fb('0xa')](),controller[_0x31fb('0xf')]);router[_0x31fb('0x10')]('/',auth[_0x31fb('0xa')](),controller[_0x31fb('0x11')]);router['put'](_0x31fb('0xc'),auth[_0x31fb('0xa')](),controller[_0x31fb('0x12')]);router[_0x31fb('0x13')](_0x31fb('0xc'),auth[_0x31fb('0xa')](),controller[_0x31fb('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 548276c..2222fae 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 _0x4f5c=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0x335afa,_0x59265d){var _0xb567da=function(_0x412e7b){while(--_0x412e7b){_0x335afa['push'](_0x335afa['shift']());}};_0xb567da(++_0x59265d);}(_0x4f5c,0x18b));var _0xc4f5=function(_0x389c88,_0x46d30a){_0x389c88=_0x389c88-0x0;var _0x32b899=_0x4f5c[_0x389c88];return _0x32b899;};'use strict';var Sequelize=require(_0xc4f5('0x0'));module['exports']={'field':{'type':Sequelize[_0xc4f5('0x1')]},'alias':{'type':Sequelize[_0xc4f5('0x2')]},'function':{'type':Sequelize[_0xc4f5('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xc4f5('0x2')]},'custom':{'type':Sequelize[_0xc4f5('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xde80=['sequelize','exports','TEXT','STRING'];(function(_0x21aea8,_0x39c115){var _0x1de839=function(_0x3a757e){while(--_0x3a757e){_0x21aea8['push'](_0x21aea8['shift']());}};_0x1de839(++_0x39c115);}(_0xde80,0x1f0));var _0x0de8=function(_0x3a4312,_0x406668){_0x3a4312=_0x3a4312-0x0;var _0x4ab57a=_0xde80[_0x3a4312];return _0x4ab57a;};'use strict';var Sequelize=require(_0x0de8('0x0'));module[_0x0de8('0x1')]={'field':{'type':Sequelize[_0x0de8('0x2')]},'alias':{'type':Sequelize[_0x0de8('0x3')]},'function':{'type':Sequelize[_0x0de8('0x3')]},'format':{'type':Sequelize[_0x0de8('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x0de8('0x3')]},'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 c5f91b9..2902a7c 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 _0x8628=['filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','AnalyticFieldReport','includeAll','include','catch','show','params','length','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','findAll','eml-format','rimraf','request-promise','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys'];(function(_0x2221cf,_0x3fd538){var _0x5f0269=function(_0x344647){while(--_0x344647){_0x2221cf['push'](_0x2221cf['shift']());}};_0x5f0269(++_0x3fd538);}(_0x8628,0x160));var _0x8862=function(_0x3145cc,_0x5a0439){_0x3145cc=_0x3145cc-0x0;var _0x3f2e2f=_0x8628[_0x3145cc];return _0x3f2e2f;};'use strict';var emlformat=require(_0x8862('0x0'));var rimraf=require(_0x8862('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8862('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8862('0x3'));var csv=require(_0x8862('0x4'));var ejs=require(_0x8862('0x5'));var fs=require('fs');var fs_extra=require(_0x8862('0x6'));var _=require(_0x8862('0x7'));var squel=require(_0x8862('0x8'));var crypto=require(_0x8862('0x9'));var jsforce=require(_0x8862('0xa'));var deskjs=require(_0x8862('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8862('0xc'));var Papa=require(_0x8862('0xd'));var Redis=require(_0x8862('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8862('0xf'));var as=require(_0x8862('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8862('0x11'));var utils=require(_0x8862('0x12'));var config=require(_0x8862('0x13'));var licenseUtil=require(_0x8862('0x14'));var db=require(_0x8862('0x15'))['db'];function respondWithStatusCode(_0x1256d8,_0x45dffa){_0x45dffa=_0x45dffa||0xcc;return function(_0x32e843){if(_0x32e843){return _0x1256d8[_0x8862('0x16')](_0x45dffa);}return _0x1256d8[_0x8862('0x17')](_0x45dffa)[_0x8862('0x18')]();};}function respondWithResult(_0x1f9c30,_0x35fe5a){_0x35fe5a=_0x35fe5a||0xc8;return function(_0x2328b8){if(_0x2328b8){return _0x1f9c30[_0x8862('0x17')](_0x35fe5a)[_0x8862('0x19')](_0x2328b8);}};}function respondWithFilteredResult(_0x4dd764,_0x1ac4a8){return function(_0x34f48d){if(_0x34f48d){var _0x5509a5=typeof _0x1ac4a8['offset']===_0x8862('0x1a')&&typeof _0x1ac4a8['limit']===_0x8862('0x1a');var _0x1dd069=_0x34f48d[_0x8862('0x1b')];var _0x5eb10e=_0x5509a5?0x0:_0x1ac4a8[_0x8862('0x1c')];var _0x3afc28=_0x5509a5?_0x34f48d[_0x8862('0x1b')]:_0x1ac4a8[_0x8862('0x1c')]+_0x1ac4a8['limit'];var _0x55f94a;if(_0x3afc28>=_0x1dd069){_0x3afc28=_0x1dd069;_0x55f94a=0xc8;}else{_0x55f94a=0xce;}_0x4dd764[_0x8862('0x17')](_0x55f94a);return _0x4dd764[_0x8862('0x1d')]('Content-Range',_0x5eb10e+'-'+_0x3afc28+'/'+_0x1dd069)['json'](_0x34f48d);}return null;};}function patchUpdates(_0x329ccd){return function(_0x3be043){try{jsonpatch[_0x8862('0x1e')](_0x3be043,_0x329ccd,!![]);}catch(_0x44b5a2){return BPromise['reject'](_0x44b5a2);}return _0x3be043[_0x8862('0x1f')]();};}function saveUpdates(_0x5b34de,_0x568132){return function(_0x5702de){if(_0x5702de){return _0x5702de[_0x8862('0x20')](_0x5b34de)[_0x8862('0x21')](function(_0xf3d430){return _0xf3d430;});}return null;};}function removeEntity(_0x51c89d,_0x364ddb){return function(_0x5bd46f){if(_0x5bd46f){return _0x5bd46f[_0x8862('0x22')]()[_0x8862('0x21')](function(){_0x51c89d['status'](0xcc)[_0x8862('0x18')]();});}};}function handleEntityNotFound(_0x34f321,_0xbb6115){return function(_0x4e5049){if(!_0x4e5049){_0x34f321['sendStatus'](0x194);}return _0x4e5049;};}function handleError(_0x38f2b6,_0xde7ad5){_0xde7ad5=_0xde7ad5||0x1f4;return function(_0x34fdf6){logger[_0x8862('0x23')](_0x34fdf6[_0x8862('0x24')]);if(_0x34fdf6['name']){delete _0x34fdf6[_0x8862('0x25')];}_0x38f2b6[_0x8862('0x17')](_0xde7ad5)[_0x8862('0x26')](_0x34fdf6);};}exports[_0x8862('0x27')]=function(_0x5f2a8a,_0x2b9eb9){var _0x2a4fec={},_0x187c75={},_0x27279d={'count':0x0,'rows':[]};var _0x24c8d3=_['map'](db['AnalyticFieldReport'][_0x8862('0x28')],function(_0x5141b2){return{'name':_0x5141b2[_0x8862('0x29')],'type':_0x5141b2[_0x8862('0x2a')][_0x8862('0x2b')]};});_0x187c75[_0x8862('0x2c')]=_[_0x8862('0x2d')](_0x24c8d3,'name');_0x187c75[_0x8862('0x2e')]=_[_0x8862('0x2f')](_0x5f2a8a[_0x8862('0x2e')]);_0x187c75[_0x8862('0x30')]=_[_0x8862('0x31')](_0x187c75[_0x8862('0x2c')],_0x187c75[_0x8862('0x2e')]);_0x2a4fec[_0x8862('0x32')]=_[_0x8862('0x31')](_0x187c75[_0x8862('0x2c')],qs['fields'](_0x5f2a8a[_0x8862('0x2e')][_0x8862('0x33')]));_0x2a4fec[_0x8862('0x32')]=_0x2a4fec['attributes']['length']?_0x2a4fec[_0x8862('0x32')]:_0x187c75['model'];if(!_0x5f2a8a[_0x8862('0x2e')][_0x8862('0x34')](_0x8862('0x35'))){_0x2a4fec['limit']=qs[_0x8862('0x36')](_0x5f2a8a['query'][_0x8862('0x36')]);_0x2a4fec['offset']=qs[_0x8862('0x1c')](_0x5f2a8a[_0x8862('0x2e')][_0x8862('0x1c')]);}_0x2a4fec['order']=qs[_0x8862('0x37')](_0x5f2a8a[_0x8862('0x2e')]['sort']);_0x2a4fec[_0x8862('0x38')]=qs[_0x8862('0x30')](_[_0x8862('0x39')](_0x5f2a8a[_0x8862('0x2e')],_0x187c75['filters']),_0x24c8d3);if(_0x5f2a8a[_0x8862('0x2e')][_0x8862('0x3a')]){_0x2a4fec[_0x8862('0x38')]=_[_0x8862('0x3b')](_0x2a4fec[_0x8862('0x38')],{'$or':_[_0x8862('0x2d')](_0x24c8d3,function(_0x503205){if(_0x503205['type']!=='VIRTUAL'){var _0x54a4e9={};_0x54a4e9[_0x503205['name']]={'$like':'%'+_0x5f2a8a['query'][_0x8862('0x3a')]+'%'};return _0x54a4e9;}})});}_0x2a4fec=_['merge']({},_0x2a4fec,_0x5f2a8a[_0x8862('0x3c')]);var _0x4311c7={'where':_0x2a4fec[_0x8862('0x38')]};return db[_0x8862('0x3d')]['count'](_0x4311c7)[_0x8862('0x21')](function(_0x468244){_0x27279d['count']=_0x468244;if(_0x5f2a8a[_0x8862('0x2e')][_0x8862('0x3e')]){_0x2a4fec[_0x8862('0x3f')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x2a4fec);})['then'](function(_0x4473dc){_0x27279d['rows']=_0x4473dc;return _0x27279d;})[_0x8862('0x21')](respondWithFilteredResult(_0x2b9eb9,_0x2a4fec))[_0x8862('0x40')](handleError(_0x2b9eb9,null));};exports[_0x8862('0x41')]=function(_0x2a31a6,_0x4907f6){var _0x54a815={'raw':![],'where':{'id':_0x2a31a6[_0x8862('0x42')]['id']}},_0x39ef18={};_0x39ef18[_0x8862('0x2c')]=_['keys'](db[_0x8862('0x3d')]['rawAttributes']);_0x39ef18[_0x8862('0x2e')]=_[_0x8862('0x2f')](_0x2a31a6[_0x8862('0x2e')]);_0x39ef18[_0x8862('0x30')]=_['intersection'](_0x39ef18[_0x8862('0x2c')],_0x39ef18[_0x8862('0x2e')]);_0x54a815[_0x8862('0x32')]=_[_0x8862('0x31')](_0x39ef18[_0x8862('0x2c')],qs[_0x8862('0x33')](_0x2a31a6['query']['fields']));_0x54a815[_0x8862('0x32')]=_0x54a815['attributes'][_0x8862('0x43')]?_0x54a815[_0x8862('0x32')]:_0x39ef18[_0x8862('0x2c')];if(_0x2a31a6['query'][_0x8862('0x3e')]){_0x54a815[_0x8862('0x3f')]=[{'all':!![]}];}_0x54a815=_[_0x8862('0x3b')]({},_0x54a815,_0x2a31a6['options']);return db[_0x8862('0x3d')][_0x8862('0x44')](_0x54a815)['then'](handleEntityNotFound(_0x4907f6,null))['then'](respondWithResult(_0x4907f6,null))[_0x8862('0x40')](handleError(_0x4907f6,null));};exports[_0x8862('0x45')]=function(_0x294c8e,_0xab96c){return db[_0x8862('0x3d')][_0x8862('0x45')](_0x294c8e[_0x8862('0x46')],{})['then'](respondWithResult(_0xab96c,0xc9))['catch'](handleError(_0xab96c,null));};exports[_0x8862('0x47')]=function(_0x2505e0,_0x332cce){return db['AnalyticFieldReport'][_0x8862('0x47')](_0x2505e0[_0x8862('0x46')],{'raw':![],'individualHooks':!![]})[_0x8862('0x21')](respondWithResult(_0x332cce,0xc9))[_0x8862('0x40')](handleError(_0x332cce,null));};exports['update']=function(_0x1c1d02,_0x2f17a9){if(_0x1c1d02[_0x8862('0x46')]['id']){delete _0x1c1d02['body']['id'];}return db[_0x8862('0x3d')][_0x8862('0x44')]({'where':{'id':_0x1c1d02[_0x8862('0x42')]['id']}})[_0x8862('0x21')](handleEntityNotFound(_0x2f17a9,null))[_0x8862('0x21')](saveUpdates(_0x1c1d02[_0x8862('0x46')],null))[_0x8862('0x21')](respondWithResult(_0x2f17a9,null))['catch'](handleError(_0x2f17a9,null));};exports['destroy']=function(_0x1222e5,_0x587006){return db[_0x8862('0x3d')][_0x8862('0x44')]({'where':{'id':_0x1222e5[_0x8862('0x42')]['id']}})[_0x8862('0x21')](handleEntityNotFound(_0x587006,null))['then'](removeEntity(_0x587006,null))[_0x8862('0x40')](handleError(_0x587006,null));};exports[_0x8862('0x48')]=function(_0xa0ff5d,_0x13c3ff){return db[_0x8862('0x3d')][_0x8862('0x22')]({'where':{'id':_0xa0ff5d[_0x8862('0x2e')][_0x8862('0x49')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x13c3ff,0xcc))[_0x8862('0x40')](handleError(_0x13c3ff,null));};exports[_0x8862('0x4a')]=function(_0x1bf502,_0x3ca0c9,_0x251643){return db[_0x8862('0x4b')][_0x8862('0x4c')]({'where':{'id':_0x1bf502[_0x8862('0x42')]['id']}})[_0x8862('0x21')](handleEntityNotFound(_0x3ca0c9,null))[_0x8862('0x21')](function(_0xe41e72){if(_0xe41e72){return db['sequelize'][_0x8862('0x4d')](function(_0xc50714){return db['AnalyticFieldReport'][_0x8862('0x22')]({'where':{'CustomReportId':_0x1bf502[_0x8862('0x42')]['id']},'transaction':_0xc50714})[_0x8862('0x21')](function(_0x56a992){var _0x4082d9=_[_0x8862('0x2d')](_0x1bf502[_0x8862('0x46')],function(_0x31b741){delete _0x31b741['id'];_0x31b741[_0x8862('0x4e')]=_0x1bf502['params']['id'];return _0x31b741;});return db[_0x8862('0x3d')]['bulkCreate'](_0x4082d9,{'transaction':_0xc50714});});})[_0x8862('0x21')](function(){return db['AnalyticFieldReport'][_0x8862('0x4f')]({'where':{'CustomReportId':_0x1bf502['params']['id']}});});}})[_0x8862('0x21')](respondWithResult(_0x3ca0c9,null))[_0x8862('0x40')](handleError(_0x3ca0c9,null));}; \ No newline at end of file +var _0xfd69=['keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','includeAll','AnalyticFieldReport','findAll','rows','catch','show','params','include','merge','find','create','bulkCreate','body','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd69,0x124));var _0x9fd6=function(_0x1ef85b,_0x4a01d3){_0x1ef85b=_0x1ef85b-0x0;var _0x400bfd=_0xfd69[_0x1ef85b];return _0x400bfd;};'use strict';var emlformat=require(_0x9fd6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9fd6('0x1'));var jsonpatch=require(_0x9fd6('0x2'));var rp=require(_0x9fd6('0x3'));var moment=require(_0x9fd6('0x4'));var BPromise=require(_0x9fd6('0x5'));var Mustache=require(_0x9fd6('0x6'));var util=require(_0x9fd6('0x7'));var path=require(_0x9fd6('0x8'));var sox=require(_0x9fd6('0x9'));var csv=require(_0x9fd6('0xa'));var ejs=require(_0x9fd6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9fd6('0xc'));var squel=require('squel');var crypto=require(_0x9fd6('0xd'));var jsforce=require(_0x9fd6('0xe'));var deskjs=require(_0x9fd6('0xf'));var toCsv=require(_0x9fd6('0xa'));var querystring=require(_0x9fd6('0x10'));var Papa=require(_0x9fd6('0x11'));var Redis=require(_0x9fd6('0x12'));var authService=require(_0x9fd6('0x13'));var qs=require(_0x9fd6('0x14'));var as=require(_0x9fd6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9fd6('0x16'))(_0x9fd6('0x17'));var utils=require(_0x9fd6('0x18'));var config=require(_0x9fd6('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bfb43,_0x572f3a){_0x572f3a=_0x572f3a||0xcc;return function(_0x1ee2be){if(_0x1ee2be){return _0x3bfb43['sendStatus'](_0x572f3a);}return _0x3bfb43[_0x9fd6('0x1a')](_0x572f3a)[_0x9fd6('0x1b')]();};}function respondWithResult(_0x4d816a,_0x250014){_0x250014=_0x250014||0xc8;return function(_0x1ef892){if(_0x1ef892){return _0x4d816a[_0x9fd6('0x1a')](_0x250014)[_0x9fd6('0x1c')](_0x1ef892);}};}function respondWithFilteredResult(_0x335990,_0x255b8d){return function(_0x181685){if(_0x181685){var _0x5e3b91=typeof _0x255b8d[_0x9fd6('0x1d')]===_0x9fd6('0x1e')&&typeof _0x255b8d['limit']===_0x9fd6('0x1e');var _0x1ab9ee=_0x181685[_0x9fd6('0x1f')];var _0x35d80e=_0x5e3b91?0x0:_0x255b8d[_0x9fd6('0x1d')];var _0x320331=_0x5e3b91?_0x181685[_0x9fd6('0x1f')]:_0x255b8d[_0x9fd6('0x1d')]+_0x255b8d[_0x9fd6('0x20')];var _0x112912;if(_0x320331>=_0x1ab9ee){_0x320331=_0x1ab9ee;_0x112912=0xc8;}else{_0x112912=0xce;}_0x335990[_0x9fd6('0x1a')](_0x112912);return _0x335990[_0x9fd6('0x21')](_0x9fd6('0x22'),_0x35d80e+'-'+_0x320331+'/'+_0x1ab9ee)[_0x9fd6('0x1c')](_0x181685);}return null;};}function patchUpdates(_0x2ac670){return function(_0x2a089b){try{jsonpatch['apply'](_0x2a089b,_0x2ac670,!![]);}catch(_0x195409){return BPromise[_0x9fd6('0x23')](_0x195409);}return _0x2a089b[_0x9fd6('0x24')]();};}function saveUpdates(_0x1a746,_0x4fe9ac){return function(_0x38e718){if(_0x38e718){return _0x38e718[_0x9fd6('0x25')](_0x1a746)['then'](function(_0x2bbf1b){return _0x2bbf1b;});}return null;};}function removeEntity(_0x4fd2f4,_0x2ce8b0){return function(_0x1755d5){if(_0x1755d5){return _0x1755d5[_0x9fd6('0x26')]()[_0x9fd6('0x27')](function(){_0x4fd2f4['status'](0xcc)[_0x9fd6('0x1b')]();});}};}function handleEntityNotFound(_0x453f13,_0x3c2fa1){return function(_0x288200){if(!_0x288200){_0x453f13[_0x9fd6('0x28')](0x194);}return _0x288200;};}function handleError(_0x2d9a8d,_0xf84976){_0xf84976=_0xf84976||0x1f4;return function(_0x41ed43){logger[_0x9fd6('0x29')](_0x41ed43[_0x9fd6('0x2a')]);if(_0x41ed43[_0x9fd6('0x2b')]){delete _0x41ed43[_0x9fd6('0x2b')];}_0x2d9a8d['status'](_0xf84976)[_0x9fd6('0x2c')](_0x41ed43);};}exports[_0x9fd6('0x2d')]=function(_0x500957,_0x3e180b){var _0xc8d85d={},_0x51dbdb={},_0x47cca5={'count':0x0,'rows':[]};var _0x56485b=_[_0x9fd6('0x2e')](db['AnalyticFieldReport'][_0x9fd6('0x2f')],function(_0x25e251){return{'name':_0x25e251[_0x9fd6('0x30')],'type':_0x25e251[_0x9fd6('0x31')][_0x9fd6('0x32')]};});_0x51dbdb[_0x9fd6('0x33')]=_['map'](_0x56485b,_0x9fd6('0x2b'));_0x51dbdb['query']=_[_0x9fd6('0x34')](_0x500957[_0x9fd6('0x35')]);_0x51dbdb[_0x9fd6('0x36')]=_[_0x9fd6('0x37')](_0x51dbdb[_0x9fd6('0x33')],_0x51dbdb[_0x9fd6('0x35')]);_0xc8d85d[_0x9fd6('0x38')]=_[_0x9fd6('0x37')](_0x51dbdb[_0x9fd6('0x33')],qs[_0x9fd6('0x39')](_0x500957[_0x9fd6('0x35')][_0x9fd6('0x39')]));_0xc8d85d[_0x9fd6('0x38')]=_0xc8d85d[_0x9fd6('0x38')][_0x9fd6('0x3a')]?_0xc8d85d['attributes']:_0x51dbdb[_0x9fd6('0x33')];if(!_0x500957[_0x9fd6('0x35')][_0x9fd6('0x3b')](_0x9fd6('0x3c'))){_0xc8d85d[_0x9fd6('0x20')]=qs['limit'](_0x500957['query']['limit']);_0xc8d85d[_0x9fd6('0x1d')]=qs[_0x9fd6('0x1d')](_0x500957['query'][_0x9fd6('0x1d')]);}_0xc8d85d[_0x9fd6('0x3d')]=qs[_0x9fd6('0x3e')](_0x500957[_0x9fd6('0x35')][_0x9fd6('0x3e')]);_0xc8d85d['where']=qs[_0x9fd6('0x36')](_['pick'](_0x500957[_0x9fd6('0x35')],_0x51dbdb[_0x9fd6('0x36')]),_0x56485b);if(_0x500957[_0x9fd6('0x35')][_0x9fd6('0x3f')]){_0xc8d85d[_0x9fd6('0x40')]=_['merge'](_0xc8d85d[_0x9fd6('0x40')],{'$or':_['map'](_0x56485b,function(_0xc7972a){if(_0xc7972a[_0x9fd6('0x31')]!==_0x9fd6('0x41')){var _0x1affc5={};_0x1affc5[_0xc7972a[_0x9fd6('0x2b')]]={'$like':'%'+_0x500957[_0x9fd6('0x35')][_0x9fd6('0x3f')]+'%'};return _0x1affc5;}})});}_0xc8d85d=_['merge']({},_0xc8d85d,_0x500957['options']);var _0x3cecd7={'where':_0xc8d85d[_0x9fd6('0x40')]};return db['AnalyticFieldReport'][_0x9fd6('0x1f')](_0x3cecd7)[_0x9fd6('0x27')](function(_0x568638){_0x47cca5[_0x9fd6('0x1f')]=_0x568638;if(_0x500957[_0x9fd6('0x35')][_0x9fd6('0x42')]){_0xc8d85d['include']=[{'all':!![]}];}return db[_0x9fd6('0x43')][_0x9fd6('0x44')](_0xc8d85d);})[_0x9fd6('0x27')](function(_0x3a77be){_0x47cca5[_0x9fd6('0x45')]=_0x3a77be;return _0x47cca5;})[_0x9fd6('0x27')](respondWithFilteredResult(_0x3e180b,_0xc8d85d))[_0x9fd6('0x46')](handleError(_0x3e180b,null));};exports[_0x9fd6('0x47')]=function(_0x28e518,_0x377ffd){var _0x5b0d03={'raw':![],'where':{'id':_0x28e518[_0x9fd6('0x48')]['id']}},_0x933b5d={};_0x933b5d[_0x9fd6('0x33')]=_['keys'](db[_0x9fd6('0x43')][_0x9fd6('0x2f')]);_0x933b5d[_0x9fd6('0x35')]=_[_0x9fd6('0x34')](_0x28e518[_0x9fd6('0x35')]);_0x933b5d[_0x9fd6('0x36')]=_[_0x9fd6('0x37')](_0x933b5d['model'],_0x933b5d[_0x9fd6('0x35')]);_0x5b0d03['attributes']=_[_0x9fd6('0x37')](_0x933b5d[_0x9fd6('0x33')],qs['fields'](_0x28e518['query']['fields']));_0x5b0d03['attributes']=_0x5b0d03[_0x9fd6('0x38')][_0x9fd6('0x3a')]?_0x5b0d03[_0x9fd6('0x38')]:_0x933b5d[_0x9fd6('0x33')];if(_0x28e518['query'][_0x9fd6('0x42')]){_0x5b0d03[_0x9fd6('0x49')]=[{'all':!![]}];}_0x5b0d03=_[_0x9fd6('0x4a')]({},_0x5b0d03,_0x28e518['options']);return db[_0x9fd6('0x43')][_0x9fd6('0x4b')](_0x5b0d03)[_0x9fd6('0x27')](handleEntityNotFound(_0x377ffd,null))[_0x9fd6('0x27')](respondWithResult(_0x377ffd,null))[_0x9fd6('0x46')](handleError(_0x377ffd,null));};exports[_0x9fd6('0x4c')]=function(_0x121ce9,_0x87007b){return db[_0x9fd6('0x43')][_0x9fd6('0x4c')](_0x121ce9['body'],{})[_0x9fd6('0x27')](respondWithResult(_0x87007b,0xc9))[_0x9fd6('0x46')](handleError(_0x87007b,null));};exports[_0x9fd6('0x4d')]=function(_0x1f395c,_0x3cee99){return db['AnalyticFieldReport']['bulkCreate'](_0x1f395c[_0x9fd6('0x4e')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3cee99,0xc9))[_0x9fd6('0x46')](handleError(_0x3cee99,null));};exports['update']=function(_0x2ccff2,_0x53ec04){if(_0x2ccff2['body']['id']){delete _0x2ccff2[_0x9fd6('0x4e')]['id'];}return db[_0x9fd6('0x43')]['find']({'where':{'id':_0x2ccff2['params']['id']}})[_0x9fd6('0x27')](handleEntityNotFound(_0x53ec04,null))['then'](saveUpdates(_0x2ccff2['body'],null))[_0x9fd6('0x27')](respondWithResult(_0x53ec04,null))[_0x9fd6('0x46')](handleError(_0x53ec04,null));};exports['destroy']=function(_0x102d81,_0x489736){return db[_0x9fd6('0x43')][_0x9fd6('0x4b')]({'where':{'id':_0x102d81[_0x9fd6('0x48')]['id']}})['then'](handleEntityNotFound(_0x489736,null))[_0x9fd6('0x27')](removeEntity(_0x489736,null))[_0x9fd6('0x46')](handleError(_0x489736,null));};exports[_0x9fd6('0x4f')]=function(_0x3ee535,_0x3f883e){return db['AnalyticFieldReport'][_0x9fd6('0x26')]({'where':{'id':_0x3ee535[_0x9fd6('0x35')][_0x9fd6('0x50')]||[]},'raw':![],'individualHooks':!![]})[_0x9fd6('0x27')](respondWithResult(_0x3f883e,0xcc))[_0x9fd6('0x46')](handleError(_0x3f883e,null));};exports[_0x9fd6('0x51')]=function(_0x236eda,_0x2283c8,_0x46018a){return db[_0x9fd6('0x52')][_0x9fd6('0x53')]({'where':{'id':_0x236eda[_0x9fd6('0x48')]['id']}})[_0x9fd6('0x27')](handleEntityNotFound(_0x2283c8,null))[_0x9fd6('0x27')](function(_0x1d738c){if(_0x1d738c){return db[_0x9fd6('0x54')][_0x9fd6('0x55')](function(_0xf79e3b){return db['AnalyticFieldReport'][_0x9fd6('0x26')]({'where':{'CustomReportId':_0x236eda[_0x9fd6('0x48')]['id']},'transaction':_0xf79e3b})[_0x9fd6('0x27')](function(_0x270154){var _0x43388a=_['map'](_0x236eda['body'],function(_0x6ac63a){delete _0x6ac63a['id'];_0x6ac63a['CustomReportId']=_0x236eda[_0x9fd6('0x48')]['id'];return _0x6ac63a;});return db[_0x9fd6('0x43')][_0x9fd6('0x4d')](_0x43388a,{'transaction':_0xf79e3b});});})['then'](function(){return db[_0x9fd6('0x43')][_0x9fd6('0x44')]({'where':{'CustomReportId':_0x236eda['params']['id']}});});}})[_0x9fd6('0x27')](respondWithResult(_0x2283c8,null))[_0x9fd6('0x46')](handleError(_0x2283c8,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index ea79fac..d10212e 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 _0x575e=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x575e,0x1f2));var _0xe575=function(_0x3e4e5c,_0x4d2966){_0x3e4e5c=_0x3e4e5c-0x0;var _0x46f0bf=_0x575e[_0x3e4e5c];return _0x46f0bf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe575('0x0'))(_0xe575('0x1'));var moment=require(_0xe575('0x2'));var BPromise=require(_0xe575('0x3'));var rp=require(_0xe575('0x4'));var fs=require('fs');var path=require(_0xe575('0x5'));var rimraf=require(_0xe575('0x6'));var config=require(_0xe575('0x7'));var attributes=require(_0xe575('0x8'));module[_0xe575('0x9')]=function(_0xc40620,_0x3301f2){return _0xc40620['define'](_0xe575('0xa'),attributes,{'tableName':_0xe575('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaefc=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','lodash'];(function(_0x32dc61,_0x263571){var _0x48ddc6=function(_0x381735){while(--_0x381735){_0x32dc61['push'](_0x32dc61['shift']());}};_0x48ddc6(++_0x263571);}(_0xaefc,0xe3));var _0xcaef=function(_0x6a9297,_0x5487ad){_0x6a9297=_0x6a9297-0x0;var _0x5ee147=_0xaefc[_0x6a9297];return _0x5ee147;};'use strict';var _=require(_0xcaef('0x0'));var util=require(_0xcaef('0x1'));var logger=require(_0xcaef('0x2'))('api');var moment=require(_0xcaef('0x3'));var BPromise=require(_0xcaef('0x4'));var rp=require(_0xcaef('0x5'));var fs=require('fs');var path=require(_0xcaef('0x6'));var rimraf=require(_0xcaef('0x7'));var config=require(_0xcaef('0x8'));var attributes=require(_0xcaef('0x9'));module[_0xcaef('0xa')]=function(_0x28e33d,_0x98e3ca){return _0x28e33d['define'](_0xcaef('0xb'),attributes,{'tableName':'analytics_report_fields','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 40b1916..e8bcd4d 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 _0xe2ee=['code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x1af150,_0x151d7b){var _0x1b3bf0=function(_0x5c04aa){while(--_0x5c04aa){_0x1af150['push'](_0x1af150['shift']());}};_0x1b3bf0(++_0x151d7b);}(_0xe2ee,0x193));var _0xee2e=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xe2ee[_0x1992f1];return _0x413dfe;};'use strict';var _=require(_0xee2e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2e('0x1'));var rs=require(_0xee2e('0x2'));var fs=require('fs');var Redis=require(_0xee2e('0x3'));var db=require(_0xee2e('0x4'))['db'];var utils=require(_0xee2e('0x5'));var logger=require('../../config/logger')(_0xee2e('0x6'));var config=require(_0xee2e('0x7'));var jayson=require(_0xee2e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2edf9a,_0x53bd92,_0x233d83){return new BPromise(function(_0x2fae76,_0x5b7f52){return client[_0xee2e('0x9')](_0x2edf9a,_0x233d83)['then'](function(_0x4540bd){logger[_0xee2e('0xa')](_0xee2e('0xb'),_0x53bd92,_0xee2e('0xc'));logger[_0xee2e('0xd')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x53bd92,'request\x20sent',JSON['stringify'](_0x4540bd));if(_0x4540bd[_0xee2e('0xe')]){if(_0x4540bd[_0xee2e('0xe')][_0xee2e('0xf')]===0x1f4){logger[_0xee2e('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x53bd92,_0x4540bd[_0xee2e('0xe')][_0xee2e('0x10')]);return _0x5b7f52(_0x4540bd[_0xee2e('0xe')][_0xee2e('0x10')]);}logger['error'](_0xee2e('0xb'),_0x53bd92,_0x4540bd['error'][_0xee2e('0x10')]);return _0x2fae76(_0x4540bd[_0xee2e('0xe')][_0xee2e('0x10')]);}else{logger[_0xee2e('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x53bd92,_0xee2e('0xc'));_0x2fae76(_0x4540bd[_0xee2e('0x11')][_0xee2e('0x10')]);}})[_0xee2e('0x12')](function(_0x212546){logger[_0xee2e('0xe')](_0xee2e('0xb'),_0x53bd92,_0x212546);_0x5b7f52(_0x212546);});});} \ No newline at end of file +var _0x17ca=['stringify','code','error','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s'];(function(_0x2356fd,_0x534a5f){var _0x378de9=function(_0x902e6e){while(--_0x902e6e){_0x2356fd['push'](_0x2356fd['shift']());}};_0x378de9(++_0x534a5f);}(_0x17ca,0x1e7));var _0xa17c=function(_0x229ccc,_0x4b6bdd){_0x229ccc=_0x229ccc-0x0;var _0x387995=_0x17ca[_0x229ccc];return _0x387995;};'use strict';var _=require(_0xa17c('0x0'));var util=require(_0xa17c('0x1'));var moment=require(_0xa17c('0x2'));var BPromise=require('bluebird');var rs=require(_0xa17c('0x3'));var fs=require('fs');var Redis=require(_0xa17c('0x4'));var db=require(_0xa17c('0x5'))['db'];var utils=require(_0xa17c('0x6'));var logger=require('../../config/logger')(_0xa17c('0x7'));var config=require(_0xa17c('0x8'));var jayson=require(_0xa17c('0x9'));var client=jayson[_0xa17c('0xa')][_0xa17c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c13f6,_0x4ac9d6,_0x587290){return new BPromise(function(_0x8991f1,_0x55ce33){return client[_0xa17c('0xc')](_0x1c13f6,_0x587290)['then'](function(_0x59f392){logger[_0xa17c('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4ac9d6,_0xa17c('0xe'));logger[_0xa17c('0xf')](_0xa17c('0x10'),_0x4ac9d6,_0xa17c('0xe'),JSON[_0xa17c('0x11')](_0x59f392));if(_0x59f392['error']){if(_0x59f392['error'][_0xa17c('0x12')]===0x1f4){logger[_0xa17c('0x13')](_0xa17c('0x14'),_0x4ac9d6,_0x59f392['error'][_0xa17c('0x15')]);return _0x55ce33(_0x59f392[_0xa17c('0x13')][_0xa17c('0x15')]);}logger[_0xa17c('0x13')](_0xa17c('0x14'),_0x4ac9d6,_0x59f392['error'][_0xa17c('0x15')]);return _0x8991f1(_0x59f392[_0xa17c('0x13')][_0xa17c('0x15')]);}else{logger[_0xa17c('0xd')](_0xa17c('0x14'),_0x4ac9d6,_0xa17c('0xe'));_0x8991f1(_0x59f392[_0xa17c('0x16')][_0xa17c('0x15')]);}})[_0xa17c('0x17')](function(_0x29771d){logger[_0xa17c('0x13')](_0xa17c('0x14'),_0x4ac9d6,_0x29771d);_0x55ce33(_0x29771d);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index a9da656..a516965 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x2c8ef9,_0x15d2e3){var _0x3682ce=function(_0x2aca59){while(--_0x2aca59){_0x2c8ef9['push'](_0x2c8ef9['shift']());}};_0x3682ce(++_0x15d2e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x497123,_0x14b6a8){var _0x5e5f40=function(_0x425605){while(--_0x425605){_0x497123['push'](_0x497123['shift']());}};_0x5e5f40(++_0x14b6a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 16c62b0..5f10cdd 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 _0x9354=['exports','STRING','TEXT'];(function(_0x3702ba,_0x460951){var _0x115695=function(_0x13d972){while(--_0x13d972){_0x3702ba['push'](_0x3702ba['shift']());}};_0x115695(++_0x460951);}(_0x9354,0x96));var _0x4935=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0x9354[_0x15d18f];return _0xd12bf7;};'use strict';var Sequelize=require('sequelize');module[_0x4935('0x0')]={'name':{'type':Sequelize[_0x4935('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x4935('0x1')]},'metric':{'type':Sequelize[_0x4935('0x2')]},'description':{'type':Sequelize[_0x4935('0x1')]}}; \ No newline at end of file +var _0x9bc3=['exports','STRING','TEXT','sequelize'];(function(_0x243b96,_0x509d27){var _0x32b392=function(_0x4b7eb9){while(--_0x4b7eb9){_0x243b96['push'](_0x243b96['shift']());}};_0x32b392(++_0x509d27);}(_0x9bc3,0x137));var _0x39bc=function(_0x429536,_0x3d6d0a){_0x429536=_0x429536-0x0;var _0xb20867=_0x9bc3[_0x429536];return _0xb20867;};'use strict';var Sequelize=require(_0x39bc('0x0'));module[_0x39bc('0x1')]={'name':{'type':Sequelize[_0x39bc('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x39bc('0x2')]},'metric':{'type':Sequelize[_0x39bc('0x3')]},'description':{'type':Sequelize[_0x39bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 1ddfad7..650011d 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 _0x7da7=['model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','merge','options','where','AnalyticMetric','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','json','apply','reject','update','then','destroy','get','Metrics','UserProfileResource','end','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x7da7,0x10d));var _0x77da=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x7da7[_0x40220a];return _0x3903cc;};'use strict';var emlformat=require(_0x77da('0x0'));var rimraf=require(_0x77da('0x1'));var zipdir=require(_0x77da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77da('0x3'));var BPromise=require(_0x77da('0x4'));var Mustache=require('mustache');var util=require(_0x77da('0x5'));var path=require(_0x77da('0x6'));var sox=require('sox');var csv=require(_0x77da('0x7'));var ejs=require(_0x77da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x7'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];function respondWithStatusCode(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xcc;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0x17')](_0x5d6e2f);}return _0x2acc65[_0x77da('0x18')](_0x5d6e2f)['end']();};}function respondWithResult(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0xc8;return function(_0x355719){if(_0x355719){return _0x3b0ff2[_0x77da('0x18')](_0x369df0)['json'](_0x355719);}};}function respondWithFilteredResult(_0x2172d0,_0x4e130c){return function(_0x29cd7b){if(_0x29cd7b){var _0x366443=typeof _0x4e130c[_0x77da('0x19')]===_0x77da('0x1a')&&typeof _0x4e130c['limit']==='undefined';var _0x514016=_0x29cd7b['count'];var _0x103e46=_0x366443?0x0:_0x4e130c[_0x77da('0x19')];var _0x289887=_0x366443?_0x29cd7b[_0x77da('0x1b')]:_0x4e130c[_0x77da('0x19')]+_0x4e130c[_0x77da('0x1c')];var _0x1d325c;if(_0x289887>=_0x514016){_0x289887=_0x514016;_0x1d325c=0xc8;}else{_0x1d325c=0xce;}_0x2172d0[_0x77da('0x18')](_0x1d325c);return _0x2172d0['set']('Content-Range',_0x103e46+'-'+_0x289887+'/'+_0x514016)[_0x77da('0x1d')](_0x29cd7b);}return null;};}function patchUpdates(_0x4d1512){return function(_0x507979){try{jsonpatch[_0x77da('0x1e')](_0x507979,_0x4d1512,!![]);}catch(_0x304a2b){return BPromise[_0x77da('0x1f')](_0x304a2b);}return _0x507979['save']();};}function saveUpdates(_0x58270c,_0x3e6cfe){return function(_0x58f6c1){if(_0x58f6c1){return _0x58f6c1[_0x77da('0x20')](_0x58270c)[_0x77da('0x21')](function(_0xc52f0e){return _0xc52f0e;});}return null;};}function removeEntity(_0x27b6c7,_0x10399a){return function(_0x270318){if(_0x270318){return _0x270318[_0x77da('0x22')]()['then'](function(){var _0x4885ec=_0x270318[_0x77da('0x23')]({'plain':!![]});var _0x2d009f=_0x77da('0x24');return db[_0x77da('0x25')]['destroy']({'where':{'type':_0x2d009f,'resourceId':_0x4885ec['id']}})[_0x77da('0x21')](function(){return _0x270318;});})[_0x77da('0x21')](function(){_0x27b6c7[_0x77da('0x18')](0xcc)[_0x77da('0x26')]();});}};}function handleEntityNotFound(_0x446ae7,_0x5997b6){return function(_0xce24b8){if(!_0xce24b8){_0x446ae7[_0x77da('0x17')](0x194);}return _0xce24b8;};}function handleError(_0x1f2279,_0x2913f7){_0x2913f7=_0x2913f7||0x1f4;return function(_0x496ecd){logger['error'](_0x496ecd['stack']);if(_0x496ecd[_0x77da('0x27')]){delete _0x496ecd[_0x77da('0x27')];}_0x1f2279[_0x77da('0x18')](_0x2913f7)[_0x77da('0x28')](_0x496ecd);};}exports[_0x77da('0x29')]=function(_0x4eeb99,_0x350b4e){var _0x26f5a0={},_0x356bfb={},_0x1d381b={'count':0x0,'rows':[]};var _0x1e7853=_[_0x77da('0x2a')](db['AnalyticMetric'][_0x77da('0x2b')],function(_0x228851){return{'name':_0x228851[_0x77da('0x2c')],'type':_0x228851[_0x77da('0x2d')][_0x77da('0x2e')]};});_0x356bfb[_0x77da('0x2f')]=_[_0x77da('0x2a')](_0x1e7853,_0x77da('0x27'));_0x356bfb['query']=_['keys'](_0x4eeb99[_0x77da('0x30')]);_0x356bfb[_0x77da('0x31')]=_['intersection'](_0x356bfb[_0x77da('0x2f')],_0x356bfb[_0x77da('0x30')]);_0x26f5a0[_0x77da('0x32')]=_[_0x77da('0x33')](_0x356bfb[_0x77da('0x2f')],qs[_0x77da('0x34')](_0x4eeb99[_0x77da('0x30')]['fields']));_0x26f5a0[_0x77da('0x32')]=_0x26f5a0['attributes']['length']?_0x26f5a0['attributes']:_0x356bfb[_0x77da('0x2f')];if(!_0x4eeb99['query'][_0x77da('0x35')](_0x77da('0x36'))){_0x26f5a0[_0x77da('0x1c')]=qs[_0x77da('0x1c')](_0x4eeb99[_0x77da('0x30')][_0x77da('0x1c')]);_0x26f5a0[_0x77da('0x19')]=qs['offset'](_0x4eeb99[_0x77da('0x30')][_0x77da('0x19')]);}_0x26f5a0[_0x77da('0x37')]=qs[_0x77da('0x38')](_0x4eeb99[_0x77da('0x30')][_0x77da('0x38')]);_0x26f5a0['where']=qs[_0x77da('0x31')](_[_0x77da('0x39')](_0x4eeb99[_0x77da('0x30')],_0x356bfb['filters']),_0x1e7853);if(_0x4eeb99[_0x77da('0x30')]['filter']){_0x26f5a0['where']=_['merge'](_0x26f5a0['where'],{'$or':_[_0x77da('0x2a')](_0x1e7853,function(_0x1adba5){if(_0x1adba5[_0x77da('0x2d')]!=='VIRTUAL'){var _0x21d337={};_0x21d337[_0x1adba5['name']]={'$like':'%'+_0x4eeb99[_0x77da('0x30')]['filter']+'%'};return _0x21d337;}})});}_0x26f5a0=_[_0x77da('0x3a')]({},_0x26f5a0,_0x4eeb99[_0x77da('0x3b')]);var _0x290667={'where':_0x26f5a0[_0x77da('0x3c')]};return db[_0x77da('0x3d')]['count'](_0x290667)[_0x77da('0x21')](function(_0x1f48bd){_0x1d381b[_0x77da('0x1b')]=_0x1f48bd;if(_0x4eeb99[_0x77da('0x30')][_0x77da('0x3e')]){_0x26f5a0[_0x77da('0x3f')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x77da('0x40')](_0x26f5a0);})[_0x77da('0x21')](function(_0x21de41){_0x1d381b[_0x77da('0x41')]=_0x21de41;return _0x1d381b;})[_0x77da('0x21')](respondWithFilteredResult(_0x350b4e,_0x26f5a0))[_0x77da('0x42')](handleError(_0x350b4e,null));};exports['show']=function(_0x10957b,_0x5abcd9){var _0x1ae806={'raw':!![],'where':{'id':_0x10957b[_0x77da('0x43')]['id']}},_0x373fb2={};_0x373fb2['model']=_[_0x77da('0x44')](db[_0x77da('0x3d')][_0x77da('0x2b')]);_0x373fb2[_0x77da('0x30')]=_[_0x77da('0x44')](_0x10957b[_0x77da('0x30')]);_0x373fb2[_0x77da('0x31')]=_[_0x77da('0x33')](_0x373fb2[_0x77da('0x2f')],_0x373fb2['query']);_0x1ae806[_0x77da('0x32')]=_[_0x77da('0x33')](_0x373fb2[_0x77da('0x2f')],qs[_0x77da('0x34')](_0x10957b[_0x77da('0x30')][_0x77da('0x34')]));_0x1ae806['attributes']=_0x1ae806['attributes'][_0x77da('0x45')]?_0x1ae806[_0x77da('0x32')]:_0x373fb2[_0x77da('0x2f')];if(_0x10957b[_0x77da('0x30')][_0x77da('0x3e')]){_0x1ae806[_0x77da('0x3f')]=[{'all':!![]}];}_0x1ae806=_['merge']({},_0x1ae806,_0x10957b[_0x77da('0x3b')]);return db[_0x77da('0x3d')][_0x77da('0x46')](_0x1ae806)[_0x77da('0x21')](handleEntityNotFound(_0x5abcd9,null))['then'](respondWithResult(_0x5abcd9,null))[_0x77da('0x42')](handleError(_0x5abcd9,null));};exports['create']=function(_0x518fd5,_0x36263b){return db[_0x77da('0x3d')][_0x77da('0x47')](_0x518fd5[_0x77da('0x48')],{})['then'](function(_0x16bf4b){var _0x1e36ee=_0x518fd5['user'][_0x77da('0x23')]({'plain':!![]});if(!_0x1e36ee)throw new Error(_0x77da('0x49'));if(_0x1e36ee['role']===_0x77da('0x4a')){var _0x3aaf5b=_0x16bf4b[_0x77da('0x23')]({'plain':!![]});var _0xef2496=_0x77da('0x24');return db[_0x77da('0x4b')][_0x77da('0x46')]({'where':{'name':_0xef2496,'userProfileId':_0x1e36ee[_0x77da('0x4c')]},'raw':!![]})[_0x77da('0x21')](function(_0x3a34a8){if(_0x3a34a8&&_0x3a34a8['autoAssociation']===0x0){return db[_0x77da('0x25')]['create']({'name':_0x3aaf5b[_0x77da('0x27')],'resourceId':_0x3aaf5b['id'],'type':_0x3a34a8[_0x77da('0x27')],'sectionId':_0x3a34a8['id']},{})[_0x77da('0x21')](function(){return _0x16bf4b;});}else{return _0x16bf4b;}})[_0x77da('0x42')](function(_0x374179){logger[_0x77da('0x4d')](_0x77da('0x4e'),_0x374179);throw _0x374179;});}return _0x16bf4b;})['then'](respondWithResult(_0x36263b,0xc9))[_0x77da('0x42')](handleError(_0x36263b,null));};exports[_0x77da('0x20')]=function(_0x1a7115,_0x353be9){if(_0x1a7115['body']['id']){delete _0x1a7115[_0x77da('0x48')]['id'];}return db[_0x77da('0x3d')][_0x77da('0x46')]({'where':{'id':_0x1a7115['params']['id']}})['then'](handleEntityNotFound(_0x353be9,null))[_0x77da('0x21')](saveUpdates(_0x1a7115[_0x77da('0x48')],null))[_0x77da('0x21')](respondWithResult(_0x353be9,null))[_0x77da('0x42')](handleError(_0x353be9,null));};exports[_0x77da('0x22')]=function(_0x528a32,_0x50437b){return db[_0x77da('0x3d')][_0x77da('0x46')]({'where':{'id':_0x528a32['params']['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x50437b,null))[_0x77da('0x21')](removeEntity(_0x50437b,null))[_0x77da('0x42')](handleError(_0x50437b,null));}; \ No newline at end of file +var _0x3e74=['status','set','Content-Range','apply','save','update','then','destroy','get','Metrics','sendStatus','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','rawAttributes','length','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count'];(function(_0xe2fbd,_0x1306a6){var _0x5b87c1=function(_0x164174){while(--_0x164174){_0xe2fbd['push'](_0xe2fbd['shift']());}};_0x5b87c1(++_0x1306a6);}(_0x3e74,0x175));var _0x43e7=function(_0x5ec4e1,_0x209943){_0x5ec4e1=_0x5ec4e1-0x0;var _0x4e6803=_0x3e74[_0x5ec4e1];return _0x4e6803;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){var _0x4b2b9f=_0x4c9df3[_0x43e7('0x23')]({'plain':!![]});var _0x4ca5cf=_0x43e7('0x24');return db['UserProfileResource'][_0x43e7('0x22')]({'where':{'type':_0x4ca5cf,'resourceId':_0x4b2b9f['id']}})[_0x43e7('0x21')](function(){return _0x4c9df3;});})[_0x43e7('0x21')](function(){_0x454359[_0x43e7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b7b3,_0x805b54){return function(_0x501551){if(!_0x501551){_0x52b7b3[_0x43e7('0x25')](0x194);}return _0x501551;};}function handleError(_0x40dc8f,_0x3565cf){_0x3565cf=_0x3565cf||0x1f4;return function(_0xb1fc63){logger['error'](_0xb1fc63[_0x43e7('0x26')]);if(_0xb1fc63[_0x43e7('0x27')]){delete _0xb1fc63[_0x43e7('0x27')];}_0x40dc8f[_0x43e7('0x1b')](_0x3565cf)[_0x43e7('0x28')](_0xb1fc63);};}exports[_0x43e7('0x29')]=function(_0x2b85a5,_0x31b2a6){var _0x3bf475={},_0x35dbcd={},_0x17df44={'count':0x0,'rows':[]};var _0x19725a=_[_0x43e7('0x2a')](db[_0x43e7('0x2b')]['rawAttributes'],function(_0x238321){return{'name':_0x238321[_0x43e7('0x2c')],'type':_0x238321[_0x43e7('0x2d')][_0x43e7('0x2e')]};});_0x35dbcd[_0x43e7('0x2f')]=_['map'](_0x19725a,_0x43e7('0x27'));_0x35dbcd[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x2b85a5[_0x43e7('0x30')]);_0x35dbcd['filters']=_['intersection'](_0x35dbcd['model'],_0x35dbcd[_0x43e7('0x30')]);_0x3bf475[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0x35dbcd[_0x43e7('0x2f')],qs[_0x43e7('0x34')](_0x2b85a5[_0x43e7('0x30')]['fields']));_0x3bf475['attributes']=_0x3bf475['attributes']['length']?_0x3bf475['attributes']:_0x35dbcd['model'];if(!_0x2b85a5['query'][_0x43e7('0x35')]('nolimit')){_0x3bf475[_0x43e7('0x18')]=qs[_0x43e7('0x18')](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x18')]);_0x3bf475[_0x43e7('0x19')]=qs[_0x43e7('0x19')](_0x2b85a5[_0x43e7('0x30')]['offset']);}_0x3bf475['order']=qs['sort'](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x36')]);_0x3bf475[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_[_0x43e7('0x39')](_0x2b85a5[_0x43e7('0x30')],_0x35dbcd[_0x43e7('0x38')]),_0x19725a);if(_0x2b85a5[_0x43e7('0x30')]['filter']){_0x3bf475[_0x43e7('0x37')]=_[_0x43e7('0x3a')](_0x3bf475['where'],{'$or':_[_0x43e7('0x2a')](_0x19725a,function(_0x4c0c7a){if(_0x4c0c7a[_0x43e7('0x2d')]!==_0x43e7('0x3b')){var _0x1c6f45={};_0x1c6f45[_0x4c0c7a[_0x43e7('0x27')]]={'$like':'%'+_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x3c')]+'%'};return _0x1c6f45;}})});}_0x3bf475=_['merge']({},_0x3bf475,_0x2b85a5['options']);var _0x30dfa9={'where':_0x3bf475[_0x43e7('0x37')]};return db[_0x43e7('0x2b')][_0x43e7('0x1a')](_0x30dfa9)[_0x43e7('0x21')](function(_0x4a4a85){_0x17df44[_0x43e7('0x1a')]=_0x4a4a85;if(_0x2b85a5[_0x43e7('0x30')]['includeAll']){_0x3bf475[_0x43e7('0x3d')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x43e7('0x3e')](_0x3bf475);})['then'](function(_0x3d81ae){_0x17df44[_0x43e7('0x3f')]=_0x3d81ae;return _0x17df44;})[_0x43e7('0x21')](respondWithFilteredResult(_0x31b2a6,_0x3bf475))[_0x43e7('0x40')](handleError(_0x31b2a6,null));};exports['show']=function(_0x47d6a1,_0x103393){var _0x40c509={'raw':!![],'where':{'id':_0x47d6a1[_0x43e7('0x41')]['id']}},_0xe979b5={};_0xe979b5['model']=_['keys'](db['AnalyticMetric'][_0x43e7('0x42')]);_0xe979b5['query']=_[_0x43e7('0x31')](_0x47d6a1['query']);_0xe979b5['filters']=_[_0x43e7('0x33')](_0xe979b5['model'],_0xe979b5[_0x43e7('0x30')]);_0x40c509[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0xe979b5[_0x43e7('0x2f')],qs['fields'](_0x47d6a1[_0x43e7('0x30')][_0x43e7('0x34')]));_0x40c509[_0x43e7('0x32')]=_0x40c509[_0x43e7('0x32')][_0x43e7('0x43')]?_0x40c509[_0x43e7('0x32')]:_0xe979b5['model'];if(_0x47d6a1['query'][_0x43e7('0x44')]){_0x40c509[_0x43e7('0x3d')]=[{'all':!![]}];}_0x40c509=_[_0x43e7('0x3a')]({},_0x40c509,_0x47d6a1['options']);return db['AnalyticMetric']['find'](_0x40c509)[_0x43e7('0x21')](handleEntityNotFound(_0x103393,null))[_0x43e7('0x21')](respondWithResult(_0x103393,null))['catch'](handleError(_0x103393,null));};exports[_0x43e7('0x45')]=function(_0x47686e,_0x3c96fe){return db['AnalyticMetric']['create'](_0x47686e['body'],{})['then'](function(_0x214e7e){var _0xe955fc=_0x47686e['user'][_0x43e7('0x23')]({'plain':!![]});if(!_0xe955fc)throw new Error(_0x43e7('0x46'));if(_0xe955fc[_0x43e7('0x47')]===_0x43e7('0x48')){var _0x4a0ce5=_0x214e7e[_0x43e7('0x23')]({'plain':!![]});var _0x483f20='Metrics';return db[_0x43e7('0x49')][_0x43e7('0x4a')]({'where':{'name':_0x483f20,'userProfileId':_0xe955fc[_0x43e7('0x4b')]},'raw':!![]})[_0x43e7('0x21')](function(_0x13503c){if(_0x13503c&&_0x13503c[_0x43e7('0x4c')]===0x0){return db[_0x43e7('0x4d')][_0x43e7('0x45')]({'name':_0x4a0ce5[_0x43e7('0x27')],'resourceId':_0x4a0ce5['id'],'type':_0x13503c[_0x43e7('0x27')],'sectionId':_0x13503c['id']},{})['then'](function(){return _0x214e7e;});}else{return _0x214e7e;}})[_0x43e7('0x40')](function(_0x46c910){logger['error'](_0x43e7('0x4e'),_0x46c910);throw _0x46c910;});}return _0x214e7e;})['then'](respondWithResult(_0x3c96fe,0xc9))[_0x43e7('0x40')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x20')]=function(_0x34e2ec,_0x1f561f){if(_0x34e2ec[_0x43e7('0x4f')]['id']){delete _0x34e2ec['body']['id'];}return db['AnalyticMetric'][_0x43e7('0x4a')]({'where':{'id':_0x34e2ec[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x1f561f,null))[_0x43e7('0x21')](saveUpdates(_0x34e2ec[_0x43e7('0x4f')],null))[_0x43e7('0x21')](respondWithResult(_0x1f561f,null))[_0x43e7('0x40')](handleError(_0x1f561f,null));};exports[_0x43e7('0x22')]=function(_0x26d86c,_0x24e758){return db[_0x43e7('0x2b')]['find']({'where':{'id':_0x26d86c[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x24e758,null))['then'](removeEntity(_0x24e758,null))[_0x43e7('0x40')](handleError(_0x24e758,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 64ffbd7..e0483c6 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 _0x66c7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger'];(function(_0x1aa85a,_0x51612b){var _0x16e394=function(_0xfc0f8b){while(--_0xfc0f8b){_0x1aa85a['push'](_0x1aa85a['shift']());}};_0x16e394(++_0x51612b);}(_0x66c7,0x15c));var _0x766c=function(_0x4da9cf,_0x5958f8){_0x4da9cf=_0x4da9cf-0x0;var _0x2a8ce7=_0x66c7[_0x4da9cf];return _0x2a8ce7;};'use strict';var _=require(_0x766c('0x0'));var util=require(_0x766c('0x1'));var logger=require(_0x766c('0x2'))('api');var moment=require(_0x766c('0x3'));var BPromise=require(_0x766c('0x4'));var rp=require(_0x766c('0x5'));var fs=require('fs');var path=require(_0x766c('0x6'));var rimraf=require(_0x766c('0x7'));var config=require(_0x766c('0x8'));var attributes=require('./analyticMetric.attributes');module[_0x766c('0x9')]=function(_0x80d91d,_0x6f94c3){return _0x80d91d[_0x766c('0xa')](_0x766c('0xb'),attributes,{'tableName':_0x766c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa48=['analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0xaa48,0x15a));var _0x8aa4=function(_0x23706f,_0x30a11a){_0x23706f=_0x23706f-0x0;var _0xb2549b=_0xaa48[_0x23706f];return _0xb2549b;};'use strict';var _=require(_0x8aa4('0x0'));var util=require(_0x8aa4('0x1'));var logger=require(_0x8aa4('0x2'))(_0x8aa4('0x3'));var moment=require(_0x8aa4('0x4'));var BPromise=require(_0x8aa4('0x5'));var rp=require(_0x8aa4('0x6'));var fs=require('fs');var path=require(_0x8aa4('0x7'));var rimraf=require(_0x8aa4('0x8'));var config=require(_0x8aa4('0x9'));var attributes=require(_0x8aa4('0xa'));module[_0x8aa4('0xb')]=function(_0x141d8b,_0x14614c){return _0x141d8b[_0x8aa4('0xc')](_0x8aa4('0xd'),attributes,{'tableName':_0x8aa4('0xe'),'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 3aa4b92..e3cc785 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 _0x372f=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','AnalyticMetric,\x20%s,\x20%s','message','info','catch'];(function(_0xb1d702,_0x2267ff){var _0x45f1e7=function(_0x31861f){while(--_0x31861f){_0xb1d702['push'](_0xb1d702['shift']());}};_0x45f1e7(++_0x2267ff);}(_0x372f,0x12c));var _0xf372=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x372f[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf372('0x0'));var BPromise=require(_0xf372('0x1'));var rs=require(_0xf372('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf372('0x3'))['db'];var utils=require(_0xf372('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf372('0x5'));var jayson=require(_0xf372('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d25bb,_0x4d861b,_0x2a1b85){return new BPromise(function(_0x6280ec,_0x54b19f){return client['request'](_0x1d25bb,_0x2a1b85)['then'](function(_0x424572){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x4d861b,_0xf372('0x7'));logger['debug'](_0xf372('0x8'),_0x4d861b,_0xf372('0x7'),JSON['stringify'](_0x424572));if(_0x424572[_0xf372('0x9')]){if(_0x424572[_0xf372('0x9')][_0xf372('0xa')]===0x1f4){logger['error'](_0xf372('0xb'),_0x4d861b,_0x424572[_0xf372('0x9')][_0xf372('0xc')]);return _0x54b19f(_0x424572['error'][_0xf372('0xc')]);}logger[_0xf372('0x9')]('AnalyticMetric,\x20%s,\x20%s',_0x4d861b,_0x424572[_0xf372('0x9')][_0xf372('0xc')]);return _0x6280ec(_0x424572[_0xf372('0x9')][_0xf372('0xc')]);}else{logger[_0xf372('0xd')](_0xf372('0xb'),_0x4d861b,_0xf372('0x7'));_0x6280ec(_0x424572['result'][_0xf372('0xc')]);}})[_0xf372('0xe')](function(_0x3910c6){logger[_0xf372('0x9')](_0xf372('0xb'),_0x4d861b,_0x3910c6);_0x54b19f(_0x3910c6);});});} \ No newline at end of file +var _0x60a6=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x4de9e8,_0x565ffa){var _0x4db0de=function(_0x12279d){while(--_0x12279d){_0x4de9e8['push'](_0x4de9e8['shift']());}};_0x4db0de(++_0x565ffa);}(_0x60a6,0x75));var _0x660a=function(_0x21d09f,_0x3cace1){_0x21d09f=_0x21d09f-0x0;var _0x1d121a=_0x60a6[_0x21d09f];return _0x1d121a;};'use strict';var _=require(_0x660a('0x0'));var util=require(_0x660a('0x1'));var moment=require(_0x660a('0x2'));var BPromise=require(_0x660a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x660a('0x4'));var db=require(_0x660a('0x5'))['db'];var utils=require(_0x660a('0x6'));var logger=require(_0x660a('0x7'))(_0x660a('0x8'));var config=require('../../config/environment');var jayson=require(_0x660a('0x9'));var client=jayson[_0x660a('0xa')][_0x660a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45dbda,_0x1fb77c,_0x2c2189){return new BPromise(function(_0x4146d6,_0x454404){return client[_0x660a('0xc')](_0x45dbda,_0x2c2189)[_0x660a('0xd')](function(_0x25e39c){logger['info'](_0x660a('0xe'),_0x1fb77c,_0x660a('0xf'));logger[_0x660a('0x10')](_0x660a('0x11'),_0x1fb77c,_0x660a('0xf'),JSON['stringify'](_0x25e39c));if(_0x25e39c['error']){if(_0x25e39c[_0x660a('0x12')]['code']===0x1f4){logger[_0x660a('0x12')](_0x660a('0xe'),_0x1fb77c,_0x25e39c['error'][_0x660a('0x13')]);return _0x454404(_0x25e39c[_0x660a('0x12')][_0x660a('0x13')]);}logger['error'](_0x660a('0xe'),_0x1fb77c,_0x25e39c[_0x660a('0x12')][_0x660a('0x13')]);return _0x4146d6(_0x25e39c[_0x660a('0x12')][_0x660a('0x13')]);}else{logger[_0x660a('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x1fb77c,_0x660a('0xf'));_0x4146d6(_0x25e39c[_0x660a('0x15')]['message']);}})[_0x660a('0x16')](function(_0x298e73){logger[_0x660a('0x12')](_0x660a('0xe'),_0x1fb77c,_0x298e73);_0x454404(_0x298e73);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 9584c87..5bbff30 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 _0x394e=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','update'];(function(_0x558602,_0x2e8d6f){var _0x4d1cd1=function(_0x52af84){while(--_0x52af84){_0x558602['push'](_0x558602['shift']());}};_0x4d1cd1(++_0x2e8d6f);}(_0x394e,0x88));var _0xe394=function(_0x259fca,_0x53360c){_0x259fca=_0x259fca-0x0;var _0x387fc5=_0x394e[_0x259fca];return _0x387fc5;};'use strict';var multer=require(_0xe394('0x0'));var util=require(_0xe394('0x1'));var path=require('path');var timeout=require(_0xe394('0x2'));var express=require(_0xe394('0x3'));var router=express[_0xe394('0x4')]();var fs_extra=require(_0xe394('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe394('0x6'));var config=require(_0xe394('0x7'));var controller=require(_0xe394('0x8'));router[_0xe394('0x9')]('/',auth[_0xe394('0xa')](),controller[_0xe394('0xb')]);router[_0xe394('0x9')](_0xe394('0xc'),auth[_0xe394('0xa')](),controller[_0xe394('0xd')]);router[_0xe394('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xe394('0xc'),auth[_0xe394('0xa')](),controller[_0xe394('0xf')]);router[_0xe394('0x10')](_0xe394('0xc'),auth[_0xe394('0xa')](),controller[_0xe394('0x11')]);module[_0xe394('0x12')]=router; \ No newline at end of file +var _0xb138=['./analyticMetric.controller','isAuthenticated','index','/:id','show','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x20f937,_0x123c4f){var _0x2d25d1=function(_0x1c36cb){while(--_0x1c36cb){_0x20f937['push'](_0x20f937['shift']());}};_0x2d25d1(++_0x123c4f);}(_0xb138,0x1dd));var _0x8b13=function(_0x1a5b50,_0x178c12){_0x1a5b50=_0x1a5b50-0x0;var _0x1c325f=_0xb138[_0x1a5b50];return _0x1c325f;};'use strict';var multer=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var timeout=require(_0x8b13('0x3'));var express=require(_0x8b13('0x4'));var router=express[_0x8b13('0x5')]();var fs_extra=require(_0x8b13('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var controller=require(_0x8b13('0x9'));router['get']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xb')]);router['get'](_0x8b13('0xc'),auth[_0x8b13('0xa')](),controller[_0x8b13('0xd')]);router['post']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xe')]);router['put']('/:id',auth[_0x8b13('0xa')](),controller[_0x8b13('0xf')]);router[_0x8b13('0x10')](_0x8b13('0xc'),auth[_0x8b13('0xa')](),controller['destroy']);module[_0x8b13('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index c575cf3..46e0c96 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 _0x84e3=['TEXT','sequelize','exports'];(function(_0x497ce5,_0x37ff88){var _0x5234f5=function(_0x4f2854){while(--_0x4f2854){_0x497ce5['push'](_0x497ce5['shift']());}};_0x5234f5(++_0x37ff88);}(_0x84e3,0x121));var _0x384e=function(_0x1306f3,_0x1da761){_0x1306f3=_0x1306f3-0x0;var _0xc1c7bf=_0x84e3[_0x1306f3];return _0xc1c7bf;};'use strict';var Sequelize=require(_0x384e('0x0'));module[_0x384e('0x1')]={'tree':{'type':Sequelize[_0x384e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xda45=['sequelize','exports','TEXT'];(function(_0x4c1b76,_0x2cdc2d){var _0x3ace6b=function(_0x40fac1){while(--_0x40fac1){_0x4c1b76['push'](_0x4c1b76['shift']());}};_0x3ace6b(++_0x2cdc2d);}(_0xda45,0x111));var _0x5da4=function(_0x30c26f,_0x330fd9){_0x30c26f=_0x30c26f-0x0;var _0xeb0850=_0xda45[_0x30c26f];return _0xeb0850;};'use strict';var Sequelize=require(_0x5da4('0x0'));module[_0x5da4('0x1')]={'tree':{'type':Sequelize[_0x5da4('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 31f8220..5f7979a 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 _0xdc3c=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','AnalyticTreeReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xdc3c,0x119));var _0xcdc3=function(_0x1fe0c8,_0x3494b7){_0x1fe0c8=_0x1fe0c8-0x0;var _0x24c406=_0xdc3c[_0x1fe0c8];return _0x24c406;};'use strict';var emlformat=require(_0xcdc3('0x0'));var rimraf=require(_0xcdc3('0x1'));var zipdir=require(_0xcdc3('0x2'));var jsonpatch=require(_0xcdc3('0x3'));var rp=require(_0xcdc3('0x4'));var moment=require('moment');var BPromise=require(_0xcdc3('0x5'));var Mustache=require('mustache');var util=require(_0xcdc3('0x6'));var path=require(_0xcdc3('0x7'));var sox=require(_0xcdc3('0x8'));var csv=require(_0xcdc3('0x9'));var ejs=require(_0xcdc3('0xa'));var fs=require('fs');var fs_extra=require(_0xcdc3('0xb'));var _=require(_0xcdc3('0xc'));var squel=require(_0xcdc3('0xd'));var crypto=require(_0xcdc3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcdc3('0xf'));var Papa=require('papaparse');var Redis=require(_0xcdc3('0x10'));var authService=require(_0xcdc3('0x11'));var qs=require(_0xcdc3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcdc3('0x13'));var logger=require(_0xcdc3('0x14'))(_0xcdc3('0x15'));var utils=require(_0xcdc3('0x16'));var config=require(_0xcdc3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcdc3('0x18'))['db'];function respondWithStatusCode(_0x5b1715,_0x390c79){_0x390c79=_0x390c79||0xcc;return function(_0x2c58d1){if(_0x2c58d1){return _0x5b1715[_0xcdc3('0x19')](_0x390c79);}return _0x5b1715[_0xcdc3('0x1a')](_0x390c79)[_0xcdc3('0x1b')]();};}function respondWithResult(_0xf0ad17,_0x215ace){_0x215ace=_0x215ace||0xc8;return function(_0xc18364){if(_0xc18364){return _0xf0ad17[_0xcdc3('0x1a')](_0x215ace)[_0xcdc3('0x1c')](_0xc18364);}};}function respondWithFilteredResult(_0x317d41,_0x31b782){return function(_0x16ba2d){if(_0x16ba2d){var _0x3f3e91=typeof _0x31b782[_0xcdc3('0x1d')]===_0xcdc3('0x1e')&&typeof _0x31b782[_0xcdc3('0x1f')]===_0xcdc3('0x1e');var _0x1dfa1e=_0x16ba2d[_0xcdc3('0x20')];var _0x33eef9=_0x3f3e91?0x0:_0x31b782[_0xcdc3('0x1d')];var _0x336dea=_0x3f3e91?_0x16ba2d[_0xcdc3('0x20')]:_0x31b782['offset']+_0x31b782[_0xcdc3('0x1f')];var _0x3af44a;if(_0x336dea>=_0x1dfa1e){_0x336dea=_0x1dfa1e;_0x3af44a=0xc8;}else{_0x3af44a=0xce;}_0x317d41['status'](_0x3af44a);return _0x317d41['set'](_0xcdc3('0x21'),_0x33eef9+'-'+_0x336dea+'/'+_0x1dfa1e)[_0xcdc3('0x1c')](_0x16ba2d);}return null;};}function patchUpdates(_0x5eb307){return function(_0x1f677a){try{jsonpatch[_0xcdc3('0x22')](_0x1f677a,_0x5eb307,!![]);}catch(_0x9804b2){return BPromise[_0xcdc3('0x23')](_0x9804b2);}return _0x1f677a[_0xcdc3('0x24')]();};}function saveUpdates(_0x241b37,_0x2b0572){return function(_0x475982){if(_0x475982){return _0x475982[_0xcdc3('0x25')](_0x241b37)[_0xcdc3('0x26')](function(_0x135380){return _0x135380;});}return null;};}function removeEntity(_0xb23b1f,_0x410572){return function(_0x3dbb92){if(_0x3dbb92){return _0x3dbb92[_0xcdc3('0x27')]()['then'](function(){_0xb23b1f[_0xcdc3('0x1a')](0xcc)[_0xcdc3('0x1b')]();});}};}function handleEntityNotFound(_0x2d2386,_0x2df3c6){return function(_0x1e5597){if(!_0x1e5597){_0x2d2386['sendStatus'](0x194);}return _0x1e5597;};}function handleError(_0x3abcd,_0x1e3e85){_0x1e3e85=_0x1e3e85||0x1f4;return function(_0x206ba0){logger[_0xcdc3('0x28')](_0x206ba0['stack']);if(_0x206ba0[_0xcdc3('0x29')]){delete _0x206ba0['name'];}_0x3abcd[_0xcdc3('0x1a')](_0x1e3e85)['send'](_0x206ba0);};}exports[_0xcdc3('0x2a')]=function(_0x39e391,_0x1a6245){var _0x1e65cf={},_0xea6db={},_0x102b9c={'count':0x0,'rows':[]};var _0x467fef=_[_0xcdc3('0x2b')](db[_0xcdc3('0x2c')][_0xcdc3('0x2d')],function(_0x1cd242){return{'name':_0x1cd242['fieldName'],'type':_0x1cd242[_0xcdc3('0x2e')]['key']};});_0xea6db[_0xcdc3('0x2f')]=_[_0xcdc3('0x2b')](_0x467fef,'name');_0xea6db[_0xcdc3('0x30')]=_[_0xcdc3('0x31')](_0x39e391[_0xcdc3('0x30')]);_0xea6db[_0xcdc3('0x32')]=_[_0xcdc3('0x33')](_0xea6db[_0xcdc3('0x2f')],_0xea6db[_0xcdc3('0x30')]);_0x1e65cf[_0xcdc3('0x34')]=_[_0xcdc3('0x33')](_0xea6db[_0xcdc3('0x2f')],qs[_0xcdc3('0x35')](_0x39e391['query'][_0xcdc3('0x35')]));_0x1e65cf['attributes']=_0x1e65cf[_0xcdc3('0x34')][_0xcdc3('0x36')]?_0x1e65cf['attributes']:_0xea6db[_0xcdc3('0x2f')];if(!_0x39e391['query'][_0xcdc3('0x37')](_0xcdc3('0x38'))){_0x1e65cf[_0xcdc3('0x1f')]=qs['limit'](_0x39e391[_0xcdc3('0x30')][_0xcdc3('0x1f')]);_0x1e65cf[_0xcdc3('0x1d')]=qs['offset'](_0x39e391[_0xcdc3('0x30')][_0xcdc3('0x1d')]);}_0x1e65cf[_0xcdc3('0x39')]=qs['sort'](_0x39e391[_0xcdc3('0x30')]['sort']);_0x1e65cf[_0xcdc3('0x3a')]=qs['filters'](_[_0xcdc3('0x3b')](_0x39e391['query'],_0xea6db['filters']),_0x467fef);if(_0x39e391[_0xcdc3('0x30')][_0xcdc3('0x3c')]){_0x1e65cf[_0xcdc3('0x3a')]=_[_0xcdc3('0x3d')](_0x1e65cf['where'],{'$or':_[_0xcdc3('0x2b')](_0x467fef,function(_0x341cc4){if(_0x341cc4[_0xcdc3('0x2e')]!==_0xcdc3('0x3e')){var _0x2999f2={};_0x2999f2[_0x341cc4['name']]={'$like':'%'+_0x39e391[_0xcdc3('0x30')][_0xcdc3('0x3c')]+'%'};return _0x2999f2;}})});}_0x1e65cf=_[_0xcdc3('0x3d')]({},_0x1e65cf,_0x39e391['options']);var _0x408e8c={'where':_0x1e65cf[_0xcdc3('0x3a')]};return db[_0xcdc3('0x2c')][_0xcdc3('0x20')](_0x408e8c)[_0xcdc3('0x26')](function(_0xe436){_0x102b9c[_0xcdc3('0x20')]=_0xe436;if(_0x39e391[_0xcdc3('0x30')][_0xcdc3('0x3f')]){_0x1e65cf['include']=[{'all':!![]}];}return db[_0xcdc3('0x2c')][_0xcdc3('0x40')](_0x1e65cf);})['then'](function(_0x144564){_0x102b9c['rows']=_0x144564;return _0x102b9c;})[_0xcdc3('0x26')](respondWithFilteredResult(_0x1a6245,_0x1e65cf))[_0xcdc3('0x41')](handleError(_0x1a6245,null));};exports[_0xcdc3('0x42')]=function(_0x4b299a,_0x30a8e5){var _0x4122f0={'raw':!![],'where':{'id':_0x4b299a[_0xcdc3('0x43')]['id']}},_0x39a01d={};_0x39a01d['model']=_[_0xcdc3('0x31')](db[_0xcdc3('0x2c')]['rawAttributes']);_0x39a01d[_0xcdc3('0x30')]=_[_0xcdc3('0x31')](_0x4b299a[_0xcdc3('0x30')]);_0x39a01d['filters']=_['intersection'](_0x39a01d['model'],_0x39a01d[_0xcdc3('0x30')]);_0x4122f0[_0xcdc3('0x34')]=_['intersection'](_0x39a01d[_0xcdc3('0x2f')],qs[_0xcdc3('0x35')](_0x4b299a[_0xcdc3('0x30')]['fields']));_0x4122f0['attributes']=_0x4122f0['attributes'][_0xcdc3('0x36')]?_0x4122f0[_0xcdc3('0x34')]:_0x39a01d['model'];if(_0x4b299a[_0xcdc3('0x30')]['includeAll']){_0x4122f0['include']=[{'all':!![]}];}_0x4122f0=_[_0xcdc3('0x3d')]({},_0x4122f0,_0x4b299a[_0xcdc3('0x44')]);return db[_0xcdc3('0x2c')][_0xcdc3('0x45')](_0x4122f0)[_0xcdc3('0x26')](handleEntityNotFound(_0x30a8e5,null))[_0xcdc3('0x26')](respondWithResult(_0x30a8e5,null))[_0xcdc3('0x41')](handleError(_0x30a8e5,null));};exports[_0xcdc3('0x46')]=function(_0x2f6966,_0xa12a14){return db[_0xcdc3('0x2c')][_0xcdc3('0x46')](_0x2f6966[_0xcdc3('0x47')],{})[_0xcdc3('0x26')](respondWithResult(_0xa12a14,0xc9))[_0xcdc3('0x41')](handleError(_0xa12a14,null));};exports['update']=function(_0x292bef,_0x22ff16){if(_0x292bef[_0xcdc3('0x47')]['id']){delete _0x292bef[_0xcdc3('0x47')]['id'];}return db[_0xcdc3('0x2c')][_0xcdc3('0x45')]({'where':{'id':_0x292bef['params']['id']}})[_0xcdc3('0x26')](handleEntityNotFound(_0x22ff16,null))[_0xcdc3('0x26')](saveUpdates(_0x292bef[_0xcdc3('0x47')],null))[_0xcdc3('0x26')](respondWithResult(_0x22ff16,null))[_0xcdc3('0x41')](handleError(_0x22ff16,null));};exports['destroy']=function(_0x100ca0,_0x4b4d00){return db[_0xcdc3('0x2c')][_0xcdc3('0x45')]({'where':{'id':_0x100ca0[_0xcdc3('0x43')]['id']}})[_0xcdc3('0x26')](handleEntityNotFound(_0x4b4d00,null))[_0xcdc3('0x26')](removeEntity(_0x4b4d00,null))[_0xcdc3('0x41')](handleError(_0x4b4d00,null));}; \ No newline at end of file +var _0x91c7=['body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','name','send','index','AnalyticTreeReport','rawAttributes','type','map','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','params','fields','find','catch','create'];(function(_0x4d9ab0,_0x1b3f7f){var _0x131472=function(_0x62c76){while(--_0x62c76){_0x4d9ab0['push'](_0x4d9ab0['shift']());}};_0x131472(++_0x1b3f7f);}(_0x91c7,0x94));var _0x791c=function(_0xf136bc,_0x4cb677){_0xf136bc=_0xf136bc-0x0;var _0x447aa6=_0x91c7[_0xf136bc];return _0x447aa6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x791c('0x0'));var zipdir=require(_0x791c('0x1'));var jsonpatch=require(_0x791c('0x2'));var rp=require(_0x791c('0x3'));var moment=require(_0x791c('0x4'));var BPromise=require(_0x791c('0x5'));var Mustache=require(_0x791c('0x6'));var util=require(_0x791c('0x7'));var path=require(_0x791c('0x8'));var sox=require('sox');var csv=require(_0x791c('0x9'));var ejs=require(_0x791c('0xa'));var fs=require('fs');var fs_extra=require(_0x791c('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x791c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x791c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x791c('0xe'));var Papa=require(_0x791c('0xf'));var Redis=require(_0x791c('0x10'));var authService=require(_0x791c('0x11'));var qs=require(_0x791c('0x12'));var as=require(_0x791c('0x13'));var hardwareService=require(_0x791c('0x14'));var logger=require(_0x791c('0x15'))(_0x791c('0x16'));var utils=require(_0x791c('0x17'));var config=require(_0x791c('0x18'));var licenseUtil=require(_0x791c('0x19'));var db=require(_0x791c('0x1a'))['db'];function respondWithStatusCode(_0x4a5f56,_0xd611cb){_0xd611cb=_0xd611cb||0xcc;return function(_0x39fddc){if(_0x39fddc){return _0x4a5f56[_0x791c('0x1b')](_0xd611cb);}return _0x4a5f56[_0x791c('0x1c')](_0xd611cb)[_0x791c('0x1d')]();};}function respondWithResult(_0x46e12d,_0x587db6){_0x587db6=_0x587db6||0xc8;return function(_0x3fb268){if(_0x3fb268){return _0x46e12d['status'](_0x587db6)[_0x791c('0x1e')](_0x3fb268);}};}function respondWithFilteredResult(_0x5c2d04,_0x1aeac4){return function(_0x1f4c85){if(_0x1f4c85){var _0x49c94f=typeof _0x1aeac4[_0x791c('0x1f')]===_0x791c('0x20')&&typeof _0x1aeac4[_0x791c('0x21')]===_0x791c('0x20');var _0x46d155=_0x1f4c85[_0x791c('0x22')];var _0x1cbf97=_0x49c94f?0x0:_0x1aeac4[_0x791c('0x1f')];var _0x4684e4=_0x49c94f?_0x1f4c85[_0x791c('0x22')]:_0x1aeac4[_0x791c('0x1f')]+_0x1aeac4['limit'];var _0x4c2019;if(_0x4684e4>=_0x46d155){_0x4684e4=_0x46d155;_0x4c2019=0xc8;}else{_0x4c2019=0xce;}_0x5c2d04[_0x791c('0x1c')](_0x4c2019);return _0x5c2d04[_0x791c('0x23')](_0x791c('0x24'),_0x1cbf97+'-'+_0x4684e4+'/'+_0x46d155)[_0x791c('0x1e')](_0x1f4c85);}return null;};}function patchUpdates(_0x3164b7){return function(_0x12d4ad){try{jsonpatch[_0x791c('0x25')](_0x12d4ad,_0x3164b7,!![]);}catch(_0xe6cde8){return BPromise[_0x791c('0x26')](_0xe6cde8);}return _0x12d4ad[_0x791c('0x27')]();};}function saveUpdates(_0x26bd5d,_0x287949){return function(_0x508c3e){if(_0x508c3e){return _0x508c3e[_0x791c('0x28')](_0x26bd5d)[_0x791c('0x29')](function(_0x5e8c75){return _0x5e8c75;});}return null;};}function removeEntity(_0x9ffd64,_0x5302b4){return function(_0x5bfc63){if(_0x5bfc63){return _0x5bfc63['destroy']()['then'](function(){_0x9ffd64[_0x791c('0x1c')](0xcc)[_0x791c('0x1d')]();});}};}function handleEntityNotFound(_0x28047a,_0x3f461b){return function(_0x29dc46){if(!_0x29dc46){_0x28047a[_0x791c('0x1b')](0x194);}return _0x29dc46;};}function handleError(_0xd3414,_0x25df17){_0x25df17=_0x25df17||0x1f4;return function(_0x68bfe4){logger['error'](_0x68bfe4['stack']);if(_0x68bfe4[_0x791c('0x2a')]){delete _0x68bfe4[_0x791c('0x2a')];}_0xd3414[_0x791c('0x1c')](_0x25df17)[_0x791c('0x2b')](_0x68bfe4);};}exports[_0x791c('0x2c')]=function(_0xd22de8,_0x169841){var _0x1e3b16={},_0x55efe3={},_0x2ba509={'count':0x0,'rows':[]};var _0x43ae75=_['map'](db[_0x791c('0x2d')][_0x791c('0x2e')],function(_0x1b547c){return{'name':_0x1b547c['fieldName'],'type':_0x1b547c[_0x791c('0x2f')]['key']};});_0x55efe3['model']=_[_0x791c('0x30')](_0x43ae75,'name');_0x55efe3[_0x791c('0x31')]=_[_0x791c('0x32')](_0xd22de8[_0x791c('0x31')]);_0x55efe3[_0x791c('0x33')]=_[_0x791c('0x34')](_0x55efe3[_0x791c('0x35')],_0x55efe3[_0x791c('0x31')]);_0x1e3b16[_0x791c('0x36')]=_[_0x791c('0x34')](_0x55efe3[_0x791c('0x35')],qs['fields'](_0xd22de8[_0x791c('0x31')]['fields']));_0x1e3b16[_0x791c('0x36')]=_0x1e3b16[_0x791c('0x36')][_0x791c('0x37')]?_0x1e3b16[_0x791c('0x36')]:_0x55efe3[_0x791c('0x35')];if(!_0xd22de8[_0x791c('0x31')]['hasOwnProperty'](_0x791c('0x38'))){_0x1e3b16[_0x791c('0x21')]=qs[_0x791c('0x21')](_0xd22de8['query'][_0x791c('0x21')]);_0x1e3b16['offset']=qs[_0x791c('0x1f')](_0xd22de8[_0x791c('0x31')]['offset']);}_0x1e3b16[_0x791c('0x39')]=qs[_0x791c('0x3a')](_0xd22de8[_0x791c('0x31')]['sort']);_0x1e3b16['where']=qs[_0x791c('0x33')](_[_0x791c('0x3b')](_0xd22de8[_0x791c('0x31')],_0x55efe3['filters']),_0x43ae75);if(_0xd22de8[_0x791c('0x31')][_0x791c('0x3c')]){_0x1e3b16[_0x791c('0x3d')]=_['merge'](_0x1e3b16[_0x791c('0x3d')],{'$or':_[_0x791c('0x30')](_0x43ae75,function(_0x27135e){if(_0x27135e[_0x791c('0x2f')]!==_0x791c('0x3e')){var _0x597c69={};_0x597c69[_0x27135e[_0x791c('0x2a')]]={'$like':'%'+_0xd22de8[_0x791c('0x31')][_0x791c('0x3c')]+'%'};return _0x597c69;}})});}_0x1e3b16=_[_0x791c('0x3f')]({},_0x1e3b16,_0xd22de8['options']);var _0x136cf0={'where':_0x1e3b16[_0x791c('0x3d')]};return db[_0x791c('0x2d')][_0x791c('0x22')](_0x136cf0)['then'](function(_0x56b9c0){_0x2ba509[_0x791c('0x22')]=_0x56b9c0;if(_0xd22de8[_0x791c('0x31')][_0x791c('0x40')]){_0x1e3b16[_0x791c('0x41')]=[{'all':!![]}];}return db[_0x791c('0x2d')]['findAll'](_0x1e3b16);})[_0x791c('0x29')](function(_0x4fded9){_0x2ba509['rows']=_0x4fded9;return _0x2ba509;})[_0x791c('0x29')](respondWithFilteredResult(_0x169841,_0x1e3b16))['catch'](handleError(_0x169841,null));};exports['show']=function(_0x5ed385,_0x2bce68){var _0x3b09be={'raw':!![],'where':{'id':_0x5ed385[_0x791c('0x42')]['id']}},_0x490d78={};_0x490d78['model']=_[_0x791c('0x32')](db['AnalyticTreeReport'][_0x791c('0x2e')]);_0x490d78[_0x791c('0x31')]=_[_0x791c('0x32')](_0x5ed385[_0x791c('0x31')]);_0x490d78['filters']=_[_0x791c('0x34')](_0x490d78[_0x791c('0x35')],_0x490d78[_0x791c('0x31')]);_0x3b09be[_0x791c('0x36')]=_[_0x791c('0x34')](_0x490d78[_0x791c('0x35')],qs[_0x791c('0x43')](_0x5ed385['query'][_0x791c('0x43')]));_0x3b09be[_0x791c('0x36')]=_0x3b09be[_0x791c('0x36')]['length']?_0x3b09be[_0x791c('0x36')]:_0x490d78['model'];if(_0x5ed385[_0x791c('0x31')]['includeAll']){_0x3b09be['include']=[{'all':!![]}];}_0x3b09be=_[_0x791c('0x3f')]({},_0x3b09be,_0x5ed385['options']);return db[_0x791c('0x2d')][_0x791c('0x44')](_0x3b09be)['then'](handleEntityNotFound(_0x2bce68,null))[_0x791c('0x29')](respondWithResult(_0x2bce68,null))[_0x791c('0x45')](handleError(_0x2bce68,null));};exports[_0x791c('0x46')]=function(_0x57697a,_0x4f814f){return db[_0x791c('0x2d')]['create'](_0x57697a[_0x791c('0x47')],{})[_0x791c('0x29')](respondWithResult(_0x4f814f,0xc9))[_0x791c('0x45')](handleError(_0x4f814f,null));};exports[_0x791c('0x28')]=function(_0x3a1bd2,_0x2351d8){if(_0x3a1bd2[_0x791c('0x47')]['id']){delete _0x3a1bd2[_0x791c('0x47')]['id'];}return db[_0x791c('0x2d')]['find']({'where':{'id':_0x3a1bd2[_0x791c('0x42')]['id']}})[_0x791c('0x29')](handleEntityNotFound(_0x2351d8,null))[_0x791c('0x29')](saveUpdates(_0x3a1bd2[_0x791c('0x47')],null))[_0x791c('0x29')](respondWithResult(_0x2351d8,null))['catch'](handleError(_0x2351d8,null));};exports[_0x791c('0x48')]=function(_0x1647ca,_0x19b138){return db['AnalyticTreeReport'][_0x791c('0x44')]({'where':{'id':_0x1647ca['params']['id']}})['then'](handleEntityNotFound(_0x19b138,null))[_0x791c('0x29')](removeEntity(_0x19b138,null))[_0x791c('0x45')](handleError(_0x19b138,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 1dbd99c..905e872 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 _0xc48c=['moment','path','rimraf','exports','define','analytics_report_trees','lodash'];(function(_0x46111d,_0x5d286b){var _0xe82586=function(_0x39551b){while(--_0x39551b){_0x46111d['push'](_0x46111d['shift']());}};_0xe82586(++_0x5d286b);}(_0xc48c,0x133));var _0xcc48=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xc48c[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xcc48('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcc48('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc48('0x2'));var rimraf=require(_0xcc48('0x3'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0xcc48('0x4')]=function(_0x2c0ba0,_0x4158a6){return _0x2c0ba0[_0xcc48('0x5')]('AnalyticTreeReport',attributes,{'tableName':_0xcc48('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0341=['../../config/environment','./analyticTreeReport.attributes','exports','define','lodash','util','api','moment','bluebird','rimraf'];(function(_0x29df9a,_0x42aff3){var _0x3a8e96=function(_0x70fbe7){while(--_0x70fbe7){_0x29df9a['push'](_0x29df9a['shift']());}};_0x3a8e96(++_0x42aff3);}(_0x0341,0xd6));var _0x1034=function(_0xb74394,_0x1ded95){_0xb74394=_0xb74394-0x0;var _0x200512=_0x0341[_0xb74394];return _0x200512;};'use strict';var _=require(_0x1034('0x0'));var util=require(_0x1034('0x1'));var logger=require('../../config/logger')(_0x1034('0x2'));var moment=require(_0x1034('0x3'));var BPromise=require(_0x1034('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1034('0x5'));var config=require(_0x1034('0x6'));var attributes=require(_0x1034('0x7'));module[_0x1034('0x8')]=function(_0x23ea5b,_0x3e5f02){return _0x23ea5b[_0x1034('0x9')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','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 dbc4020..8980b2a 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 _0x7a54=['info','AnalyticTreeReport,\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(_0x55079e,_0x220116){_0x55079e=_0x55079e-0x0;var _0x5ad1ee=_0x7a54[_0x55079e];return _0x5ad1ee;};'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')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x17d25b,_0x3f0a01){var _0x301afc=function(_0x1e212e){while(--_0x1e212e){_0x17d25b['push'](_0x17d25b['shift']());}};_0x301afc(++_0x3f0a01);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 4589099..dd6777b 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 _0x4245=['fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','show','create','update','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x4245,0x79));var _0x5424=function(_0x341f1e,_0x37deca){_0x341f1e=_0x341f1e-0x0;var _0x51bb21=_0x4245[_0x341f1e];return _0x51bb21;};'use strict';var multer=require(_0x5424('0x0'));var util=require('util');var path=require(_0x5424('0x1'));var timeout=require(_0x5424('0x2'));var express=require(_0x5424('0x3'));var router=express[_0x5424('0x4')]();var fs_extra=require(_0x5424('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5424('0x6'));var config=require(_0x5424('0x7'));var controller=require(_0x5424('0x8'));router['get']('/',auth[_0x5424('0x9')](),controller[_0x5424('0xa')]);router[_0x5424('0xb')](_0x5424('0xc'),auth[_0x5424('0x9')](),controller[_0x5424('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5424('0xe')]);router['put']('/:id',auth[_0x5424('0x9')](),controller[_0x5424('0xf')]);router[_0x5424('0x10')](_0x5424('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x5424('0x11')]=router; \ No newline at end of file +var _0x0611=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0611,0x1f1));var _0x1061=function(_0x26e986,_0x24cb67){_0x26e986=_0x26e986-0x0;var _0x5609e5=_0x0611[_0x26e986];return _0x5609e5;};'use strict';var multer=require(_0x1061('0x0'));var util=require('util');var path=require(_0x1061('0x1'));var timeout=require(_0x1061('0x2'));var express=require(_0x1061('0x3'));var router=express[_0x1061('0x4')]();var fs_extra=require(_0x1061('0x5'));var auth=require(_0x1061('0x6'));var interaction=require(_0x1061('0x7'));var config=require(_0x1061('0x8'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0x1061('0x9')](),controller[_0x1061('0xa')]);router[_0x1061('0xb')](_0x1061('0xc'),auth[_0x1061('0x9')](),controller['show']);router[_0x1061('0xd')]('/',auth[_0x1061('0x9')](),controller[_0x1061('0xe')]);router[_0x1061('0xf')](_0x1061('0xc'),auth['isAuthenticated'](),controller[_0x1061('0x10')]);router[_0x1061('0x11')](_0x1061('0xc'),auth['isAuthenticated'](),controller[_0x1061('0x12')]);module[_0x1061('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index d2e4d5a..6b4e72d 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 _0xbc17=['STRING','sequelize','exports'];(function(_0x4a5c08,_0x400097){var _0x4fa73f=function(_0x527054){while(--_0x527054){_0x4a5c08['push'](_0x4a5c08['shift']());}};_0x4fa73f(++_0x400097);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x339974,_0x318f2f){_0x339974=_0x339974-0x0;var _0x56dc65=_0xbc17[_0x339974];return _0x56dc65;};'use strict';var Sequelize=require(_0x7bc1('0x0'));module[_0x7bc1('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x7bc1('0x2')]},'type':{'type':Sequelize[_0x7bc1('0x2')]}}; \ No newline at end of file +var _0x0ef0=['exports','STRING','sequelize'];(function(_0x314e8a,_0x430404){var _0x5ab7d4=function(_0x2ccb69){while(--_0x2ccb69){_0x314e8a['push'](_0x314e8a['shift']());}};_0x5ab7d4(++_0x430404);}(_0x0ef0,0x80));var _0x00ef=function(_0x30a528,_0x1d04f2){_0x30a528=_0x30a528-0x0;var _0x3e029c=_0x0ef0[_0x30a528];return _0x3e029c;};'use strict';var Sequelize=require(_0x00ef('0x0'));module[_0x00ef('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x00ef('0x2')]},'type':{'type':Sequelize[_0x00ef('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 63c4035..4e5bb46 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 _0x10a0=['status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','send','index','map','Attachment','type','key','query','keys','filters','model','attributes','intersection','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','name','filter','options','include','rows','catch','show','params','fields','length','find','clone','rawAttributes','includeAll','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','download','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x10a0,0x142));var _0x010a=function(_0x1ae2d1,_0x4de735){_0x1ae2d1=_0x1ae2d1-0x0;var _0x38d99b=_0x10a0[_0x1ae2d1];return _0x38d99b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x010a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x010a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x010a('0x2'));var util=require(_0x010a('0x3'));var path=require(_0x010a('0x4'));var sox=require(_0x010a('0x5'));var csv=require(_0x010a('0x6'));var ejs=require(_0x010a('0x7'));var fs=require('fs');var fs_extra=require(_0x010a('0x8'));var _=require('lodash');var squel=require(_0x010a('0x9'));var crypto=require(_0x010a('0xa'));var jsforce=require(_0x010a('0xb'));var deskjs=require(_0x010a('0xc'));var toCsv=require(_0x010a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x010a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x010a('0xe'));var as=require(_0x010a('0xf'));var hardwareService=require(_0x010a('0x10'));var logger=require(_0x010a('0x11'))(_0x010a('0x12'));var utils=require(_0x010a('0x13'));var config=require(_0x010a('0x14'));var licenseUtil=require(_0x010a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14a910,_0x3c74dd){_0x3c74dd=_0x3c74dd||0xcc;return function(_0xafbf3b){if(_0xafbf3b){return _0x14a910['sendStatus'](_0x3c74dd);}return _0x14a910[_0x010a('0x16')](_0x3c74dd)[_0x010a('0x17')]();};}function respondWithResult(_0x208f32,_0x58a396){_0x58a396=_0x58a396||0xc8;return function(_0x4560d5){if(_0x4560d5){return _0x208f32[_0x010a('0x16')](_0x58a396)[_0x010a('0x18')](_0x4560d5);}};}function respondWithFilteredResult(_0xdd5a92,_0x3b55fa){return function(_0x41dffc){if(_0x41dffc){var _0x102548=typeof _0x3b55fa[_0x010a('0x19')]==='undefined'&&typeof _0x3b55fa['limit']===_0x010a('0x1a');var _0x4b3130=_0x41dffc[_0x010a('0x1b')];var _0x1532f1=_0x102548?0x0:_0x3b55fa[_0x010a('0x19')];var _0x2dbca6=_0x102548?_0x41dffc['count']:_0x3b55fa['offset']+_0x3b55fa[_0x010a('0x1c')];var _0x2ed8af;if(_0x2dbca6>=_0x4b3130){_0x2dbca6=_0x4b3130;_0x2ed8af=0xc8;}else{_0x2ed8af=0xce;}_0xdd5a92[_0x010a('0x16')](_0x2ed8af);return _0xdd5a92[_0x010a('0x1d')](_0x010a('0x1e'),_0x1532f1+'-'+_0x2dbca6+'/'+_0x4b3130)['json'](_0x41dffc);}return null;};}function patchUpdates(_0x27f645){return function(_0x2d7936){try{jsonpatch[_0x010a('0x1f')](_0x2d7936,_0x27f645,!![]);}catch(_0x3cbd05){return BPromise[_0x010a('0x20')](_0x3cbd05);}return _0x2d7936[_0x010a('0x21')]();};}function saveUpdates(_0x3821d3,_0x3739a0){return function(_0x594651){if(_0x594651){return _0x594651[_0x010a('0x22')](_0x3821d3)['then'](function(_0x1feb97){return _0x1feb97;});}return null;};}function removeEntity(_0x529573,_0x4a604c){return function(_0x1c2742){if(_0x1c2742){return _0x1c2742[_0x010a('0x23')]()[_0x010a('0x24')](function(){_0x529573['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c2247,_0x36795b){return function(_0x1bd658){if(!_0x1bd658){_0x3c2247['sendStatus'](0x194);}return _0x1bd658;};}function handleError(_0x1e5c43,_0x5bc623){_0x5bc623=_0x5bc623||0x1f4;return function(_0x4e15c3){logger[_0x010a('0x25')](_0x4e15c3['stack']);if(_0x4e15c3['name']){delete _0x4e15c3['name'];}_0x1e5c43[_0x010a('0x16')](_0x5bc623)[_0x010a('0x26')](_0x4e15c3);};}exports[_0x010a('0x27')]=function(_0x30cc65,_0x45dbff){var _0x4a93a4={},_0x4219eb={},_0x1a14c9={'count':0x0,'rows':[]};var _0x519295=_[_0x010a('0x28')](db[_0x010a('0x29')]['rawAttributes'],function(_0x2e072b){return{'name':_0x2e072b['fieldName'],'type':_0x2e072b[_0x010a('0x2a')][_0x010a('0x2b')]};});_0x4219eb['model']=_['map'](_0x519295,'name');_0x4219eb[_0x010a('0x2c')]=_[_0x010a('0x2d')](_0x30cc65['query']);_0x4219eb[_0x010a('0x2e')]=_['intersection'](_0x4219eb[_0x010a('0x2f')],_0x4219eb[_0x010a('0x2c')]);_0x4a93a4[_0x010a('0x30')]=_[_0x010a('0x31')](_0x4219eb[_0x010a('0x2f')],qs['fields'](_0x30cc65[_0x010a('0x2c')]['fields']));_0x4a93a4['attributes']=_0x4a93a4[_0x010a('0x30')]['length']?_0x4a93a4[_0x010a('0x30')]:_0x4219eb[_0x010a('0x2f')];if(!_0x30cc65[_0x010a('0x2c')][_0x010a('0x32')](_0x010a('0x33'))){_0x4a93a4['limit']=qs['limit'](_0x30cc65[_0x010a('0x2c')]['limit']);_0x4a93a4[_0x010a('0x19')]=qs[_0x010a('0x19')](_0x30cc65[_0x010a('0x2c')][_0x010a('0x19')]);}_0x4a93a4['order']=qs['sort'](_0x30cc65['query'][_0x010a('0x34')]);_0x4a93a4['where']=qs['filters'](_[_0x010a('0x35')](_0x30cc65[_0x010a('0x2c')],_0x4219eb[_0x010a('0x2e')]),_0x519295);if(_0x30cc65[_0x010a('0x2c')]['filter']){_0x4a93a4[_0x010a('0x36')]=_[_0x010a('0x37')](_0x4a93a4[_0x010a('0x36')],{'$or':_[_0x010a('0x28')](_0x519295,function(_0x2c392f){if(_0x2c392f[_0x010a('0x2a')]!==_0x010a('0x38')){var _0x4f34d4={};_0x4f34d4[_0x2c392f[_0x010a('0x39')]]={'$like':'%'+_0x30cc65['query'][_0x010a('0x3a')]+'%'};return _0x4f34d4;}})});}_0x4a93a4=_[_0x010a('0x37')]({},_0x4a93a4,_0x30cc65[_0x010a('0x3b')]);var _0x15cf05={'where':_0x4a93a4['where']};return db[_0x010a('0x29')]['count'](_0x15cf05)['then'](function(_0x54cae6){_0x1a14c9[_0x010a('0x1b')]=_0x54cae6;if(_0x30cc65[_0x010a('0x2c')]['includeAll']){_0x4a93a4[_0x010a('0x3c')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x4a93a4);})[_0x010a('0x24')](function(_0x409dba){_0x1a14c9[_0x010a('0x3d')]=_0x409dba;return _0x1a14c9;})[_0x010a('0x24')](respondWithFilteredResult(_0x45dbff,_0x4a93a4))[_0x010a('0x3e')](handleError(_0x45dbff,null));};exports[_0x010a('0x3f')]=function(_0x450878,_0x7a2847){var _0x5e6b91={'raw':!![],'where':{'id':_0x450878[_0x010a('0x40')]['id']}},_0x1b88a3={};_0x1b88a3[_0x010a('0x2f')]=_[_0x010a('0x2d')](db[_0x010a('0x29')]['rawAttributes']);_0x1b88a3[_0x010a('0x2c')]=_[_0x010a('0x2d')](_0x450878['query']);_0x1b88a3[_0x010a('0x2e')]=_['intersection'](_0x1b88a3[_0x010a('0x2f')],_0x1b88a3[_0x010a('0x2c')]);_0x5e6b91['attributes']=_[_0x010a('0x31')](_0x1b88a3[_0x010a('0x2f')],qs[_0x010a('0x41')](_0x450878[_0x010a('0x2c')][_0x010a('0x41')]));_0x5e6b91[_0x010a('0x30')]=_0x5e6b91[_0x010a('0x30')][_0x010a('0x42')]?_0x5e6b91[_0x010a('0x30')]:_0x1b88a3[_0x010a('0x2f')];if(_0x450878[_0x010a('0x2c')]['includeAll']){_0x5e6b91[_0x010a('0x3c')]=[{'all':!![]}];}_0x5e6b91=_[_0x010a('0x37')]({},_0x5e6b91,_0x450878[_0x010a('0x3b')]);return db['Attachment'][_0x010a('0x43')](_0x5e6b91)[_0x010a('0x24')](handleEntityNotFound(_0x7a2847,null))[_0x010a('0x24')](respondWithResult(_0x7a2847,null))[_0x010a('0x3e')](handleError(_0x7a2847,null));};exports[_0x010a('0x44')]=function(_0x59a0e3,_0x5c0f18){var _0xbd5f47={'where':{'id':_0x59a0e3['params']['id']}},_0x155875={};_0x155875['model']=_[_0x010a('0x2d')](db[_0x010a('0x29')][_0x010a('0x45')]);_0xbd5f47[_0x010a('0x30')]=_[_0x010a('0x31')](_0x155875[_0x010a('0x2f')],qs[_0x010a('0x41')](_0x59a0e3[_0x010a('0x2c')]['fields']));_0xbd5f47['attributes']=_0xbd5f47[_0x010a('0x30')][_0x010a('0x42')]?_0xbd5f47[_0x010a('0x30')]:_0x155875[_0x010a('0x2f')];if(_0x59a0e3[_0x010a('0x2c')][_0x010a('0x46')]){_0xbd5f47[_0x010a('0x3c')]=[{'all':!![]}];}_0xbd5f47=_[_0x010a('0x37')]({},_0xbd5f47,_0x59a0e3[_0x010a('0x3b')]);return db[_0x010a('0x29')][_0x010a('0x43')](_0xbd5f47)['then'](handleEntityNotFound(_0x5c0f18,null))[_0x010a('0x24')](function(_0x42466f){if(_0x42466f){var _0x2777ef=_0x42466f['get']({'plain':!![]});_0x2777ef=qs[_0x010a('0x47')](_0x2777ef,['id',_0x010a('0x48'),_0x010a('0x49')]);_0x59a0e3[_0x010a('0x4a')]=_['omit'](_0x59a0e3['body'],['id',_0x010a('0x48'),_0x010a('0x49')]);return db['Attachment'][_0x010a('0x4b')](_['merge'](_0x2777ef,_0x59a0e3[_0x010a('0x4a')]),{'include':_0x59a0e3[_0x010a('0x2c')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x010a('0x24')](respondWithResult(_0x5c0f18,0xc9))[_0x010a('0x3e')](handleError(_0x5c0f18,null));};exports[_0x010a('0x22')]=function(_0x514b9a,_0x24fecd){if(_0x514b9a[_0x010a('0x4a')]['id']){delete _0x514b9a[_0x010a('0x4a')]['id'];}return db[_0x010a('0x29')]['find']({'where':{'id':_0x514b9a[_0x010a('0x40')]['id']}})['then'](handleEntityNotFound(_0x24fecd,null))[_0x010a('0x24')](saveUpdates(_0x514b9a[_0x010a('0x4a')],null))[_0x010a('0x24')](respondWithResult(_0x24fecd,null))[_0x010a('0x3e')](handleError(_0x24fecd,null));};exports[_0x010a('0x23')]=function(_0x346b15,_0x563a1f){return db['Attachment'][_0x010a('0x43')]({'where':{'id':_0x346b15[_0x010a('0x40')]['id']}})[_0x010a('0x24')](handleEntityNotFound(_0x563a1f,null))[_0x010a('0x24')](removeEntity(_0x563a1f,null))[_0x010a('0x3e')](handleError(_0x563a1f,null));};exports[_0x010a('0x4b')]=function(_0x28333e,_0x45dddc,_0x386d7f){_0x28333e[_0x010a('0x4a')][_0x010a('0x39')]=_0x28333e[_0x010a('0x4c')][_0x010a('0x4d')];_0x28333e[_0x010a('0x4a')][_0x010a('0x4e')]=_0x28333e['file'][_0x010a('0x4f')];_0x28333e['body'][_0x010a('0x2a')]=_0x28333e[_0x010a('0x4c')]['mimetype'];return db[_0x010a('0x29')][_0x010a('0x4b')](_0x28333e[_0x010a('0x4a')])[_0x010a('0x24')](respondWithResult(_0x45dddc,0xc9))[_0x010a('0x3e')](handleError(_0x45dddc,null));};exports['download']=function(_0x3c6f12,_0x4a3d84,_0x52c174){return db['Attachment'][_0x010a('0x50')]({'where':{'id':_0x3c6f12[_0x010a('0x40')]['id']},'raw':!![]})[_0x010a('0x24')](handleEntityNotFound(_0x4a3d84,null))['then'](function(_0x3284bf){if(_0x3284bf){var _0x46df7e=_0x3284bf[_0x010a('0x51')]!==null;var _0x5b51b5=path[_0x010a('0x52')](config[_0x010a('0x53')],_0x010a('0x54'));if(_0x46df7e){_0x5b51b5=path[_0x010a('0x52')](_0x5b51b5,'offline-chat/');}var _0x4562b1=path[_0x010a('0x52')](_0x5b51b5,_0x3284bf[_0x010a('0x4e')]);return _0x4a3d84[_0x010a('0x55')](_0x4562b1);}})['catch'](handleError(_0x4a3d84,null));}; \ No newline at end of file +var _0x64ff=['filter','where','VIRTUAL','merge','options','include','Attachment','findAll','rows','catch','show','params','includeAll','find','clone','get','omit','createdAt','updatedAt','body','file','originalname','basename','mimetype','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x64ff,0x1db));var _0xf64f=function(_0x4b64f7,_0x129729){_0x4b64f7=_0x4b64f7-0x0;var _0x539ffb=_0x64ff[_0x4b64f7];return _0x539ffb;};'use strict';var emlformat=require(_0xf64f('0x0'));var rimraf=require(_0xf64f('0x1'));var zipdir=require(_0xf64f('0x2'));var jsonpatch=require(_0xf64f('0x3'));var rp=require(_0xf64f('0x4'));var moment=require('moment');var BPromise=require(_0xf64f('0x5'));var Mustache=require(_0xf64f('0x6'));var util=require(_0xf64f('0x7'));var path=require(_0xf64f('0x8'));var sox=require(_0xf64f('0x9'));var csv=require('to-csv');var ejs=require(_0xf64f('0xa'));var fs=require('fs');var fs_extra=require(_0xf64f('0xb'));var _=require('lodash');var squel=require(_0xf64f('0xc'));var crypto=require(_0xf64f('0xd'));var jsforce=require(_0xf64f('0xe'));var deskjs=require(_0xf64f('0xf'));var toCsv=require(_0xf64f('0x10'));var querystring=require(_0xf64f('0x11'));var Papa=require(_0xf64f('0x12'));var Redis=require(_0xf64f('0x13'));var authService=require(_0xf64f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xf64f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf64f('0x16'))(_0xf64f('0x17'));var utils=require(_0xf64f('0x18'));var config=require(_0xf64f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xf64f('0x1a'))['db'];function respondWithStatusCode(_0x21579d,_0x512231){_0x512231=_0x512231||0xcc;return function(_0x313309){if(_0x313309){return _0x21579d[_0xf64f('0x1b')](_0x512231);}return _0x21579d[_0xf64f('0x1c')](_0x512231)[_0xf64f('0x1d')]();};}function respondWithResult(_0x2f9b0c,_0x188f99){_0x188f99=_0x188f99||0xc8;return function(_0x26bbf6){if(_0x26bbf6){return _0x2f9b0c[_0xf64f('0x1c')](_0x188f99)['json'](_0x26bbf6);}};}function respondWithFilteredResult(_0x13c304,_0x508e6e){return function(_0x1af5d2){if(_0x1af5d2){var _0x48dbd0=typeof _0x508e6e[_0xf64f('0x1e')]==='undefined'&&typeof _0x508e6e[_0xf64f('0x1f')]===_0xf64f('0x20');var _0x7f668f=_0x1af5d2[_0xf64f('0x21')];var _0x4b87ea=_0x48dbd0?0x0:_0x508e6e[_0xf64f('0x1e')];var _0x4e48a7=_0x48dbd0?_0x1af5d2[_0xf64f('0x21')]:_0x508e6e['offset']+_0x508e6e[_0xf64f('0x1f')];var _0x26ab79;if(_0x4e48a7>=_0x7f668f){_0x4e48a7=_0x7f668f;_0x26ab79=0xc8;}else{_0x26ab79=0xce;}_0x13c304[_0xf64f('0x1c')](_0x26ab79);return _0x13c304['set'](_0xf64f('0x22'),_0x4b87ea+'-'+_0x4e48a7+'/'+_0x7f668f)['json'](_0x1af5d2);}return null;};}function patchUpdates(_0x40c6ae){return function(_0x1be126){try{jsonpatch[_0xf64f('0x23')](_0x1be126,_0x40c6ae,!![]);}catch(_0x2af9d2){return BPromise[_0xf64f('0x24')](_0x2af9d2);}return _0x1be126['save']();};}function saveUpdates(_0x28d1c1,_0xd61a5a){return function(_0x419db9){if(_0x419db9){return _0x419db9[_0xf64f('0x25')](_0x28d1c1)[_0xf64f('0x26')](function(_0x3b0d03){return _0x3b0d03;});}return null;};}function removeEntity(_0x2ed40a,_0x1a9d81){return function(_0xc385a5){if(_0xc385a5){return _0xc385a5[_0xf64f('0x27')]()[_0xf64f('0x26')](function(){_0x2ed40a[_0xf64f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbd02e1,_0x12b93c){return function(_0x488611){if(!_0x488611){_0xbd02e1['sendStatus'](0x194);}return _0x488611;};}function handleError(_0x3905ce,_0x802b10){_0x802b10=_0x802b10||0x1f4;return function(_0x51759c){logger[_0xf64f('0x28')](_0x51759c['stack']);if(_0x51759c[_0xf64f('0x29')]){delete _0x51759c[_0xf64f('0x29')];}_0x3905ce[_0xf64f('0x1c')](_0x802b10)[_0xf64f('0x2a')](_0x51759c);};}exports[_0xf64f('0x2b')]=function(_0x4fa6f9,_0x289421){var _0x3769ed={},_0x41e396={},_0x31f1e2={'count':0x0,'rows':[]};var _0x3aadb4=_[_0xf64f('0x2c')](db['Attachment'][_0xf64f('0x2d')],function(_0x38a422){return{'name':_0x38a422['fieldName'],'type':_0x38a422[_0xf64f('0x2e')][_0xf64f('0x2f')]};});_0x41e396['model']=_['map'](_0x3aadb4,_0xf64f('0x29'));_0x41e396[_0xf64f('0x30')]=_[_0xf64f('0x31')](_0x4fa6f9['query']);_0x41e396[_0xf64f('0x32')]=_[_0xf64f('0x33')](_0x41e396[_0xf64f('0x34')],_0x41e396[_0xf64f('0x30')]);_0x3769ed[_0xf64f('0x35')]=_[_0xf64f('0x33')](_0x41e396['model'],qs[_0xf64f('0x36')](_0x4fa6f9[_0xf64f('0x30')]['fields']));_0x3769ed[_0xf64f('0x35')]=_0x3769ed[_0xf64f('0x35')][_0xf64f('0x37')]?_0x3769ed['attributes']:_0x41e396[_0xf64f('0x34')];if(!_0x4fa6f9[_0xf64f('0x30')][_0xf64f('0x38')](_0xf64f('0x39'))){_0x3769ed[_0xf64f('0x1f')]=qs[_0xf64f('0x1f')](_0x4fa6f9[_0xf64f('0x30')]['limit']);_0x3769ed['offset']=qs[_0xf64f('0x1e')](_0x4fa6f9[_0xf64f('0x30')]['offset']);}_0x3769ed['order']=qs[_0xf64f('0x3a')](_0x4fa6f9[_0xf64f('0x30')]['sort']);_0x3769ed['where']=qs[_0xf64f('0x32')](_['pick'](_0x4fa6f9['query'],_0x41e396[_0xf64f('0x32')]),_0x3aadb4);if(_0x4fa6f9[_0xf64f('0x30')][_0xf64f('0x3b')]){_0x3769ed[_0xf64f('0x3c')]=_['merge'](_0x3769ed[_0xf64f('0x3c')],{'$or':_[_0xf64f('0x2c')](_0x3aadb4,function(_0x29064c){if(_0x29064c[_0xf64f('0x2e')]!==_0xf64f('0x3d')){var _0x2c71c7={};_0x2c71c7[_0x29064c[_0xf64f('0x29')]]={'$like':'%'+_0x4fa6f9['query'][_0xf64f('0x3b')]+'%'};return _0x2c71c7;}})});}_0x3769ed=_[_0xf64f('0x3e')]({},_0x3769ed,_0x4fa6f9[_0xf64f('0x3f')]);var _0x345e15={'where':_0x3769ed['where']};return db['Attachment'][_0xf64f('0x21')](_0x345e15)[_0xf64f('0x26')](function(_0x540451){_0x31f1e2[_0xf64f('0x21')]=_0x540451;if(_0x4fa6f9[_0xf64f('0x30')]['includeAll']){_0x3769ed[_0xf64f('0x40')]=[{'all':!![]}];}return db[_0xf64f('0x41')][_0xf64f('0x42')](_0x3769ed);})[_0xf64f('0x26')](function(_0x4d1ec2){_0x31f1e2[_0xf64f('0x43')]=_0x4d1ec2;return _0x31f1e2;})['then'](respondWithFilteredResult(_0x289421,_0x3769ed))[_0xf64f('0x44')](handleError(_0x289421,null));};exports[_0xf64f('0x45')]=function(_0x584a30,_0x1bfb07){var _0x1578dc={'raw':!![],'where':{'id':_0x584a30[_0xf64f('0x46')]['id']}},_0x30b559={};_0x30b559[_0xf64f('0x34')]=_[_0xf64f('0x31')](db[_0xf64f('0x41')][_0xf64f('0x2d')]);_0x30b559['query']=_[_0xf64f('0x31')](_0x584a30[_0xf64f('0x30')]);_0x30b559[_0xf64f('0x32')]=_['intersection'](_0x30b559['model'],_0x30b559[_0xf64f('0x30')]);_0x1578dc[_0xf64f('0x35')]=_[_0xf64f('0x33')](_0x30b559[_0xf64f('0x34')],qs['fields'](_0x584a30[_0xf64f('0x30')][_0xf64f('0x36')]));_0x1578dc[_0xf64f('0x35')]=_0x1578dc[_0xf64f('0x35')]['length']?_0x1578dc[_0xf64f('0x35')]:_0x30b559['model'];if(_0x584a30[_0xf64f('0x30')][_0xf64f('0x47')]){_0x1578dc['include']=[{'all':!![]}];}_0x1578dc=_[_0xf64f('0x3e')]({},_0x1578dc,_0x584a30[_0xf64f('0x3f')]);return db[_0xf64f('0x41')][_0xf64f('0x48')](_0x1578dc)[_0xf64f('0x26')](handleEntityNotFound(_0x1bfb07,null))['then'](respondWithResult(_0x1bfb07,null))[_0xf64f('0x44')](handleError(_0x1bfb07,null));};exports[_0xf64f('0x49')]=function(_0x5167ef,_0x45a58e){var _0xc97fe3={'where':{'id':_0x5167ef[_0xf64f('0x46')]['id']}},_0x390e80={};_0x390e80[_0xf64f('0x34')]=_[_0xf64f('0x31')](db['Attachment'][_0xf64f('0x2d')]);_0xc97fe3[_0xf64f('0x35')]=_['intersection'](_0x390e80[_0xf64f('0x34')],qs['fields'](_0x5167ef['query'][_0xf64f('0x36')]));_0xc97fe3['attributes']=_0xc97fe3[_0xf64f('0x35')][_0xf64f('0x37')]?_0xc97fe3[_0xf64f('0x35')]:_0x390e80['model'];if(_0x5167ef[_0xf64f('0x30')][_0xf64f('0x47')]){_0xc97fe3['include']=[{'all':!![]}];}_0xc97fe3=_[_0xf64f('0x3e')]({},_0xc97fe3,_0x5167ef['options']);return db[_0xf64f('0x41')][_0xf64f('0x48')](_0xc97fe3)[_0xf64f('0x26')](handleEntityNotFound(_0x45a58e,null))['then'](function(_0x4e6f0f){if(_0x4e6f0f){var _0x1ac98b=_0x4e6f0f[_0xf64f('0x4a')]({'plain':!![]});_0x1ac98b=qs[_0xf64f('0x4b')](_0x1ac98b,['id',_0xf64f('0x4c'),_0xf64f('0x4d')]);_0x5167ef['body']=_[_0xf64f('0x4b')](_0x5167ef[_0xf64f('0x4e')],['id',_0xf64f('0x4c'),_0xf64f('0x4d')]);return db[_0xf64f('0x41')]['create'](_[_0xf64f('0x3e')](_0x1ac98b,_0x5167ef['body']),{'include':_0x5167ef[_0xf64f('0x30')][_0xf64f('0x47')]?[{'all':!![]}]:undefined});}})[_0xf64f('0x26')](respondWithResult(_0x45a58e,0xc9))[_0xf64f('0x44')](handleError(_0x45a58e,null));};exports[_0xf64f('0x25')]=function(_0x1ab4e2,_0x4b4e69){if(_0x1ab4e2[_0xf64f('0x4e')]['id']){delete _0x1ab4e2[_0xf64f('0x4e')]['id'];}return db['Attachment'][_0xf64f('0x48')]({'where':{'id':_0x1ab4e2['params']['id']}})[_0xf64f('0x26')](handleEntityNotFound(_0x4b4e69,null))[_0xf64f('0x26')](saveUpdates(_0x1ab4e2[_0xf64f('0x4e')],null))[_0xf64f('0x26')](respondWithResult(_0x4b4e69,null))[_0xf64f('0x44')](handleError(_0x4b4e69,null));};exports[_0xf64f('0x27')]=function(_0x33bfbc,_0x59eef7){return db[_0xf64f('0x41')][_0xf64f('0x48')]({'where':{'id':_0x33bfbc[_0xf64f('0x46')]['id']}})[_0xf64f('0x26')](handleEntityNotFound(_0x59eef7,null))[_0xf64f('0x26')](removeEntity(_0x59eef7,null))['catch'](handleError(_0x59eef7,null));};exports['create']=function(_0x217ba5,_0x82579c,_0x44cbe2){_0x217ba5['body'][_0xf64f('0x29')]=_0x217ba5[_0xf64f('0x4f')][_0xf64f('0x50')];_0x217ba5[_0xf64f('0x4e')][_0xf64f('0x51')]=_0x217ba5[_0xf64f('0x4f')]['filename'];_0x217ba5[_0xf64f('0x4e')][_0xf64f('0x2e')]=_0x217ba5[_0xf64f('0x4f')][_0xf64f('0x52')];return db[_0xf64f('0x41')]['create'](_0x217ba5[_0xf64f('0x4e')])['then'](respondWithResult(_0x82579c,0xc9))[_0xf64f('0x44')](handleError(_0x82579c,null));};exports['download']=function(_0x1170fb,_0x25ce72,_0x48d44a){return db['Attachment']['findOne']({'where':{'id':_0x1170fb[_0xf64f('0x46')]['id']},'raw':!![]})[_0xf64f('0x26')](handleEntityNotFound(_0x25ce72,null))[_0xf64f('0x26')](function(_0x3154fd){if(_0x3154fd){var _0x104073=_0x3154fd[_0xf64f('0x53')]!==null;var _0x176c62=path[_0xf64f('0x54')](config[_0xf64f('0x55')],_0xf64f('0x56'));if(_0x104073){_0x176c62=path[_0xf64f('0x54')](_0x176c62,_0xf64f('0x57'));}var _0x52d1b9=path[_0xf64f('0x54')](_0x176c62,_0x3154fd[_0xf64f('0x51')]);return _0x25ce72[_0xf64f('0x58')](_0x52d1b9);}})[_0xf64f('0x44')](handleError(_0x25ce72,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index f9da88b..d646eed 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 _0xe576=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./attachment.attributes','exports','define','attachments','lodash','util'];(function(_0x151516,_0x2d96fa){var _0x58bcf8=function(_0x50946d){while(--_0x50946d){_0x151516['push'](_0x151516['shift']());}};_0x58bcf8(++_0x2d96fa);}(_0xe576,0xfa));var _0x6e57=function(_0x5d88be,_0x5a9a0d){_0x5d88be=_0x5d88be-0x0;var _0x27b2e7=_0xe576[_0x5d88be];return _0x27b2e7;};'use strict';var _=require(_0x6e57('0x0'));var util=require(_0x6e57('0x1'));var logger=require(_0x6e57('0x2'))('api');var moment=require(_0x6e57('0x3'));var BPromise=require(_0x6e57('0x4'));var rp=require(_0x6e57('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e57('0x6'));var config=require(_0x6e57('0x7'));var attributes=require(_0x6e57('0x8'));module[_0x6e57('0x9')]=function(_0x3d67aa,_0x8f3690){return _0x3d67aa[_0x6e57('0xa')]('Attachment',attributes,{'tableName':_0x6e57('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4adf=['path','rimraf','../../config/environment','./attachment.attributes','exports','Attachment','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x758cbe,_0x5798b1){var _0x245b21=function(_0x3e6a12){while(--_0x3e6a12){_0x758cbe['push'](_0x758cbe['shift']());}};_0x245b21(++_0x5798b1);}(_0x4adf,0x1e7));var _0xf4ad=function(_0xfa75c6,_0x25a05a){_0xfa75c6=_0xfa75c6-0x0;var _0x5f59dd=_0x4adf[_0xfa75c6];return _0x5f59dd;};'use strict';var _=require(_0xf4ad('0x0'));var util=require(_0xf4ad('0x1'));var logger=require(_0xf4ad('0x2'))(_0xf4ad('0x3'));var moment=require(_0xf4ad('0x4'));var BPromise=require(_0xf4ad('0x5'));var rp=require(_0xf4ad('0x6'));var fs=require('fs');var path=require(_0xf4ad('0x7'));var rimraf=require(_0xf4ad('0x8'));var config=require(_0xf4ad('0x9'));var attributes=require(_0xf4ad('0xa'));module[_0xf4ad('0xb')]=function(_0x43dcdb,_0x7a5b90){return _0x43dcdb['define'](_0xf4ad('0xc'),attributes,{'tableName':'attachments','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 4e95759..a91255c 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 _0x0e9f=['info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','catch','CreateAttachment','create','body','options','lodash','util','randomstring','../../config/utils','../../config/environment','jayson/promise','http','then'];(function(_0x15cf09,_0x954c4){var _0x1a8f9c=function(_0x4211ce){while(--_0x4211ce){_0x15cf09['push'](_0x15cf09['shift']());}};_0x1a8f9c(++_0x954c4);}(_0x0e9f,0x116));var _0xf0e9=function(_0x23bf3b,_0x1345d8){_0x23bf3b=_0x23bf3b-0x0;var _0x3b1cd4=_0x0e9f[_0x23bf3b];return _0x3b1cd4;};'use strict';var _=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf0e9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf0e9('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0e9('0x4'));var jayson=require(_0xf0e9('0x5'));var client=jayson['client'][_0xf0e9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4a35a3,_0x3f9792,_0x2fa08f){return new BPromise(function(_0x106ba0,_0x58edfe){return client['request'](_0x4a35a3,_0x2fa08f)[_0xf0e9('0x7')](function(_0x7b3146){logger[_0xf0e9('0x8')]('Attachment,\x20%s,\x20%s',_0x3f9792,_0xf0e9('0x9'));logger[_0xf0e9('0xa')](_0xf0e9('0xb'),_0x3f9792,'request\x20sent',JSON[_0xf0e9('0xc')](_0x7b3146));if(_0x7b3146[_0xf0e9('0xd')]){if(_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0xe')]===0x1f4){logger['error'](_0xf0e9('0xf'),_0x3f9792,_0x7b3146['error'][_0xf0e9('0x10')]);return _0x58edfe(_0x7b3146[_0xf0e9('0xd')]['message']);}logger[_0xf0e9('0xd')](_0xf0e9('0xf'),_0x3f9792,_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0x10')]);return _0x106ba0(_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0x10')]);}else{logger['info'](_0xf0e9('0xf'),_0x3f9792,_0xf0e9('0x9'));_0x106ba0(_0x7b3146['result'][_0xf0e9('0x10')]);}})[_0xf0e9('0x11')](function(_0x3d0b4d){logger[_0xf0e9('0xd')]('Attachment,\x20%s,\x20%s',_0x3f9792,_0x3d0b4d);_0x58edfe(_0x3d0b4d);});});}exports[_0xf0e9('0x12')]=function(_0x2f4ee3){var _0x232115=this;return new Promise(function(_0x2987a1,_0x5444bc){return db['Attachment'][_0xf0e9('0x13')](_0x2f4ee3[_0xf0e9('0x14')],{'raw':_0x2f4ee3[_0xf0e9('0x15')]?_0x2f4ee3['options']['raw']===undefined?!![]:![]:!![]})[_0xf0e9('0x7')](function(_0x1ac91f){logger['info'](_0xf0e9('0x12'),_0x2f4ee3);logger['debug'](_0xf0e9('0x12'),_0x2f4ee3,JSON[_0xf0e9('0xc')](_0x1ac91f));_0x2987a1(_0x1ac91f);})['catch'](function(_0x5dd652){logger[_0xf0e9('0xd')](_0xf0e9('0x12'),_0x5dd652['message'],_0x2f4ee3);_0x5444bc(_0x232115[_0xf0e9('0xd')](0x1f4,_0x5dd652[_0xf0e9('0x10')]));});});}; \ No newline at end of file +var _0x2dae=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Attachment','body','options','raw','info','CreateAttachment','lodash'];(function(_0x549fb4,_0x57140c){var _0xc64c37=function(_0x40e702){while(--_0x40e702){_0x549fb4['push'](_0x549fb4['shift']());}};_0xc64c37(++_0x57140c);}(_0x2dae,0xc3));var _0xe2da=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x2dae[_0x31a576];return _0x30b1d3;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var moment=require(_0xe2da('0x1'));var BPromise=require(_0xe2da('0x2'));var rs=require(_0xe2da('0x3'));var fs=require('fs');var Redis=require(_0xe2da('0x4'));var db=require(_0xe2da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2da('0x6'))(_0xe2da('0x7'));var config=require(_0xe2da('0x8'));var jayson=require(_0xe2da('0x9'));var client=jayson['client'][_0xe2da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x89c70b,_0x34cc98,_0x2efbd8){return new BPromise(function(_0x238da3,_0x1c71ea){return client[_0xe2da('0xb')](_0x89c70b,_0x2efbd8)[_0xe2da('0xc')](function(_0x68aa40){logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));logger[_0xe2da('0xf')](_0xe2da('0x10'),_0x34cc98,_0xe2da('0xe'),JSON[_0xe2da('0x11')](_0x68aa40));if(_0x68aa40[_0xe2da('0x12')]){if(_0x68aa40[_0xe2da('0x12')]['code']===0x1f4){logger[_0xe2da('0x12')]('Attachment,\x20%s,\x20%s',_0x34cc98,_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);return _0x1c71ea(_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);}logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x68aa40[_0xe2da('0x12')]['message']);return _0x238da3(_0x68aa40[_0xe2da('0x12')]['message']);}else{logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));_0x238da3(_0x68aa40[_0xe2da('0x14')]['message']);}})[_0xe2da('0x15')](function(_0x2c0353){logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x2c0353);_0x1c71ea(_0x2c0353);});});}exports['CreateAttachment']=function(_0x45bb92){var _0x1f7d33=this;return new Promise(function(_0x417363,_0x2e5730){return db[_0xe2da('0x16')]['create'](_0x45bb92[_0xe2da('0x17')],{'raw':_0x45bb92[_0xe2da('0x18')]?_0x45bb92['options'][_0xe2da('0x19')]===undefined?!![]:![]:!![]})[_0xe2da('0xc')](function(_0x332193){logger[_0xe2da('0x1a')](_0xe2da('0x1b'),_0x45bb92);logger[_0xe2da('0xf')]('CreateAttachment',_0x45bb92,JSON[_0xe2da('0x11')](_0x332193));_0x417363(_0x332193);})['catch'](function(_0x30efdc){logger[_0xe2da('0x12')](_0xe2da('0x1b'),_0x30efdc[_0xe2da('0x13')],_0x45bb92);_0x2e5730(_0x1f7d33[_0xe2da('0x12')](0x1f4,_0x30efdc[_0xe2da('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 448149b..4218107 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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x1fe624,_0x3e0bf9){_0x1fe624=_0x1fe624-0x0;var _0x30cc13=_0xdb28[_0x1fe624];return _0x30cc13;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file +var _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x4d703d,_0x2bc652){var _0x34de9d=function(_0x543132){while(--_0x543132){_0x4d703d['push'](_0x4d703d['shift']());}};_0x34de9d(++_0x2bc652);}(_0x757a,0xde));var _0xa757=function(_0x429005,_0x40506f){_0x429005=_0x429005-0x0;var _0x186789=_0x757a[_0x429005];return _0x186789;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 1f17bfa..6b2b8b0 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 _0x58ed=['use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','emails','admin','agent','disabled','blocked','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','profile','callback','/login'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0x58ed,0x1a8));var _0xd58e=function(_0x8e2094,_0x455517){_0x8e2094=_0x8e2094-0x0;var _0x2afe6c=_0x58ed[_0x8e2094];return _0x2afe6c;};'use strict';var _=require(_0xd58e('0x0'));var passport=require(_0xd58e('0x1'));var GoogleStrategy=require(_0xd58e('0x2'))[_0xd58e('0x3')];var moment=require(_0xd58e('0x4'));var db=require(_0xd58e('0x5'))['db'];var config=require(_0xd58e('0x6'));var signToken=require(_0xd58e('0x7'))[_0xd58e('0x8')];var utils=require(_0xd58e('0x9'));exports[_0xd58e('0xa')]=passport[_0xd58e('0xb')](_0xd58e('0xc'),{'failureRedirect':'/login','scope':[_0xd58e('0xd'),'email'],'session':![]});exports[_0xd58e('0xe')]=passport['authenticate']('google',{'failureRedirect':_0xd58e('0xf'),'session':![]});passport[_0xd58e('0x10')](new GoogleStrategy({'clientID':config['google']?config[_0xd58e('0xc')][_0xd58e('0x11')]:'id','clientSecret':config[_0xd58e('0xc')]?config[_0xd58e('0xc')][_0xd58e('0x12')]:_0xd58e('0x13'),'callbackURL':config[_0xd58e('0xc')]?config['google'][_0xd58e('0x14')]:''},function(_0x4ee6e4,_0x2d3394,_0x5ca461,_0x2858f5){var _0x56e0e9,_0x3d4fd5;return db[_0xd58e('0x15')][_0xd58e('0x16')]({'where':{'id':0x1},'attributes':[_0xd58e('0x17'),_0xd58e('0x18')],'raw':!![]})[_0xd58e('0x19')](function(_0x255f6b){_0x56e0e9=_0x255f6b;return db[_0xd58e('0x1a')][_0xd58e('0x1b')]({'where':{'email':_['map'](_0x5ca461[_0xd58e('0x1c')],'value'),'role':{'$or':[_0xd58e('0x1d'),'user',_0xd58e('0x1e')]}}});})['then'](function(_0x32fe04){_0x3d4fd5=_0x32fe04;if(_0x3d4fd5){if(_0x3d4fd5[_0xd58e('0x1f')]){return _0x2858f5('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x56e0e9[_0xd58e('0x18')]>0x0){if(_0x3d4fd5[_0xd58e('0x20')]){if(moment(_0x3d4fd5[_0xd58e('0x21')])[_0xd58e('0x22')](_0x56e0e9[_0xd58e('0x18')],_0xd58e('0x23'))>moment()){return _0x2858f5(_0xd58e('0x24'));}else{return utils[_0xd58e('0x25')](_0x3d4fd5,0x0,![],null)[_0xd58e('0x19')](function(){return utils[_0xd58e('0x26')](_0x3d4fd5);})[_0xd58e('0x19')](function(){return _0x2858f5(null,_0x3d4fd5);});}}else{return utils[_0xd58e('0x26')](_0x3d4fd5)['then'](function(){return _0x2858f5(null,_0x3d4fd5);});}}else{return utils[_0xd58e('0x26')](_0x3d4fd5)['then'](function(){return _0x2858f5(null,_0x3d4fd5);});}}return _0x2858f5(_0xd58e('0x24'));})[_0xd58e('0x27')](function(_0x473f74){_0x2858f5(_0x473f74);});})); \ No newline at end of file +var _0x46fa=['blocked','blockedAt','add','clearBlockUser','getLicense','catch','lodash','moment','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','login','authenticate','/login','profile','callback','use','google','clientID','clientSecret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','emails','value','admin','user','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x385417,_0x1d4e6d){var _0x328c65=function(_0x589c2e){while(--_0x589c2e){_0x385417['push'](_0x385417['shift']());}};_0x328c65(++_0x1d4e6d);}(_0x46fa,0xde));var _0xa46f=function(_0x4abb5e,_0x256b43){_0x4abb5e=_0x4abb5e-0x0;var _0x352062=_0x46fa[_0x4abb5e];return _0x352062;};'use strict';var _=require(_0xa46f('0x0'));var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')['Strategy'];var moment=require(_0xa46f('0x1'));var db=require(_0xa46f('0x2'))['db'];var config=require(_0xa46f('0x3'));var signToken=require(_0xa46f('0x4'))['signToken'];var utils=require(_0xa46f('0x5'));exports[_0xa46f('0x6')]=passport[_0xa46f('0x7')]('google',{'failureRedirect':_0xa46f('0x8'),'scope':[_0xa46f('0x9'),'email'],'session':![]});exports[_0xa46f('0xa')]=passport[_0xa46f('0x7')]('google',{'failureRedirect':_0xa46f('0x8'),'session':![]});passport[_0xa46f('0xb')](new GoogleStrategy({'clientID':config['google']?config[_0xa46f('0xc')][_0xa46f('0xd')]:'id','clientSecret':config[_0xa46f('0xc')]?config[_0xa46f('0xc')][_0xa46f('0xe')]:'secret','callbackURL':config['google']?config[_0xa46f('0xc')][_0xa46f('0xf')]:''},function(_0x487852,_0x41b11b,_0x5784ee,_0x5730c1){var _0x4eb0e0,_0xc3a74;return db[_0xa46f('0x10')][_0xa46f('0x11')]({'where':{'id':0x1},'attributes':[_0xa46f('0x12'),_0xa46f('0x13')],'raw':!![]})[_0xa46f('0x14')](function(_0x21daf7){_0x4eb0e0=_0x21daf7;return db[_0xa46f('0x15')][_0xa46f('0x16')]({'where':{'email':_[_0xa46f('0x17')](_0x5784ee[_0xa46f('0x18')],_0xa46f('0x19')),'role':{'$or':[_0xa46f('0x1a'),_0xa46f('0x1b'),'agent']}}});})[_0xa46f('0x14')](function(_0x2c7a4c){_0xc3a74=_0x2c7a4c;if(_0xc3a74){if(_0xc3a74[_0xa46f('0x1c')]){return _0x5730c1(_0xa46f('0x1d'));}else if(_0x4eb0e0[_0xa46f('0x13')]>0x0){if(_0xc3a74[_0xa46f('0x1e')]){if(moment(_0xc3a74[_0xa46f('0x1f')])[_0xa46f('0x20')](_0x4eb0e0['blockDuration'],'minutes')>moment()){return _0x5730c1(_0xa46f('0x1d'));}else{return utils[_0xa46f('0x21')](_0xc3a74,0x0,![],null)[_0xa46f('0x14')](function(){return utils[_0xa46f('0x22')](_0xc3a74);})[_0xa46f('0x14')](function(){return _0x5730c1(null,_0xc3a74);});}}else{return utils['getLicense'](_0xc3a74)['then'](function(){return _0x5730c1(null,_0xc3a74);});}}else{return utils[_0xa46f('0x22')](_0xc3a74)[_0xa46f('0x14')](function(){return _0x5730c1(null,_0xc3a74);});}}return _0x5730c1('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0xa46f('0x23')](function(_0x357f7c){_0x5730c1(_0x357f7c);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 7815469..ee94dd7 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 _0xc574=['callback','isMiddleware','exports','express','passport','Router','../user/user.controller.js','../../components/auth/service','get','login'];(function(_0x373a54,_0x1d1900){var _0x29f75b=function(_0x362b70){while(--_0x362b70){_0x373a54['push'](_0x373a54['shift']());}};_0x29f75b(++_0x1d1900);}(_0xc574,0x107));var _0x4c57=function(_0x53396e,_0x52a17f){_0x53396e=_0x53396e-0x0;var _0x1d10b9=_0xc574[_0x53396e];return _0x1d10b9;};'use strict';var express=require(_0x4c57('0x0'));var passport=require(_0x4c57('0x1'));var router=express[_0x4c57('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x4c57('0x3'));var authService=require(_0x4c57('0x4'));router[_0x4c57('0x5')]('/',controller[_0x4c57('0x6')]);router[_0x4c57('0x5')]('/callback',controller[_0x4c57('0x7')],authService[_0x4c57('0x8')],userController[_0x4c57('0x6')],authService['setTokenCookie']);module[_0x4c57('0x9')]=router; \ No newline at end of file +var _0xd4ba=['callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','login','get','/callback'];(function(_0x446e61,_0x27e680){var _0x4160a8=function(_0x1c9171){while(--_0x1c9171){_0x446e61['push'](_0x446e61['shift']());}};_0x4160a8(++_0x27e680);}(_0xd4ba,0x7c));var _0xad4b=function(_0x547211,_0x18e3e9){_0x547211=_0x547211-0x0;var _0x1a5d10=_0xd4ba[_0x547211];return _0x1a5d10;};'use strict';var express=require(_0xad4b('0x0'));var passport=require(_0xad4b('0x1'));var router=express[_0xad4b('0x2')]();var controller=require(_0xad4b('0x3'));var userController=require(_0xad4b('0x4'));var authService=require('../../components/auth/service');router['get']('/',controller[_0xad4b('0x5')]);router[_0xad4b('0x6')](_0xad4b('0x7'),controller[_0xad4b('0x8')],authService[_0xad4b('0x9')],userController[_0xad4b('0x5')],authService[_0xad4b('0xa')]);module[_0xad4b('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 589b34e..40259f4 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 _0x4b3e=['service','host','port','secure','auth','pass','merge','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','stringify','status','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','Strategy','randomstring','../../components/auth/service','../../config/utils','client','allowedLoginAttempts','blockDuration','then','findOne','name','password','salt','role','disabled','blocked','blockedAt','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','clearBlockUser','add','minutes','getLicense','catch','MailAccount','find','MailServerOut','Smtp'];(function(_0x34ef8d,_0x1d2572){var _0x25eaa3=function(_0x2e1c79){while(--_0x2e1c79){_0x34ef8d['push'](_0x34ef8d['shift']());}};_0x25eaa3(++_0x1d2572);}(_0x4b3e,0x1cc));var _0xe4b3=function(_0x2b9e8a,_0x7b21d4){_0x2b9e8a=_0x2b9e8a-0x0;var _0x520e67=_0x4b3e[_0x2b9e8a];return _0x520e67;};'use strict';var util=require(_0xe4b3('0x0'));var passport=require(_0xe4b3('0x1'));var LocalStrategy=require(_0xe4b3('0x2'))[_0xe4b3('0x3')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0xe4b3('0x4'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0xe4b3('0x5'));var utils=require(_0xe4b3('0x6'));var client=jayson[_0xe4b3('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x116905,_0x101ca9,_0x3c464d,_0x1aedea){var _0x56c8d6,_0xd1da4a;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xe4b3('0x8'),_0xe4b3('0x9')],'raw':!![]})[_0xe4b3('0xa')](function(_0x315103){_0x56c8d6=_0x315103;return _0x116905[_0xe4b3('0xb')]({'attributes':['id',_0xe4b3('0xc'),_0xe4b3('0xd'),_0xe4b3('0xe'),_0xe4b3('0xf'),_0xe4b3('0x10'),_0xe4b3('0x11'),_0xe4b3('0x12'),'loginAttempts'],'where':{'name':_0x101ca9,'role':{'$or':[_0xe4b3('0x13'),_0xe4b3('0x14'),'agent']}}});})[_0xe4b3('0xa')](function(_0xefe62){if(!_0xefe62||_0xefe62&&_0xefe62[_0xe4b3('0xc')]!==_0x101ca9){throw new Error(_0xe4b3('0x15'));}else{_0xd1da4a=_0xefe62;return _0xd1da4a;}})[_0xe4b3('0xa')](function(){_0xd1da4a['authenticate'](_0x3c464d,function(_0x51db0d,_0x3b2fd7){var _0x2a9cad=_0xd1da4a[_0xe4b3('0x16')]+0x1;if(_0x51db0d){return _0x1aedea(_0x51db0d);}else if(!_0x3b2fd7){if(_0xd1da4a[_0xe4b3('0x10')]){return _0x1aedea(null,![],{'message':_0xe4b3('0x15')});}else if(_0x56c8d6[_0xe4b3('0x8')]>0x0){if(_0xd1da4a[_0xe4b3('0x11')]){if(_0x56c8d6[_0xe4b3('0x9')]>0x0){if(moment(_0xd1da4a[_0xe4b3('0x12')])['add'](_0x56c8d6[_0xe4b3('0x9')],'minutes')>moment()){return _0x1aedea(null,![],{'message':_0xe4b3('0x15')});}else{return utils[_0xe4b3('0x17')](_0xd1da4a,_0x2a9cad,![],null)[_0xe4b3('0xa')](function(){return _0x1aedea(null,![],{'message':_0xe4b3('0x15')});});}}else{return _0x1aedea(null,![],{'message':_0xe4b3('0x15')});}}else{if(_0x2a9cad>=_0x56c8d6[_0xe4b3('0x8')]){return utils[_0xe4b3('0x17')](_0xd1da4a,0x0,!![],moment())[_0xe4b3('0xa')](function(){return _0x1aedea(null,![],{'message':_0xe4b3('0x15')});});}else{return utils['clearBlockUser'](_0xd1da4a,_0x2a9cad,![],null)[_0xe4b3('0xa')](function(){return _0x1aedea(null,![],{'message':_0xe4b3('0x15')});});}}}else{return _0x1aedea(null,![],{'message':_0xe4b3('0x15')});}}else{if(_0xd1da4a[_0xe4b3('0x10')]){return _0x1aedea(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x56c8d6[_0xe4b3('0x8')]>0x0){if(_0xd1da4a['blocked']){if(_0x56c8d6[_0xe4b3('0x9')]>0x0){if(moment(_0xd1da4a[_0xe4b3('0x12')])[_0xe4b3('0x18')](_0x56c8d6[_0xe4b3('0x9')],_0xe4b3('0x19'))>moment()){return _0x1aedea(null,![],{'message':_0xe4b3('0x15')});}else{return utils['clearBlockUser'](_0xd1da4a,0x0,![],null)[_0xe4b3('0xa')](function(){return utils[_0xe4b3('0x1a')](_0xd1da4a);})['then'](function(){return _0x1aedea(null,_0xd1da4a);});}}else{return _0x1aedea(null,![],{'message':_0xe4b3('0x15')});}}else{return utils[_0xe4b3('0x17')](_0xd1da4a,0x0,![],null)[_0xe4b3('0xa')](function(){return utils[_0xe4b3('0x1a')](_0xd1da4a);})[_0xe4b3('0xa')](function(){return _0x1aedea(null,_0xd1da4a);})['catch'](function(_0x267248){return _0x1aedea(null,![],_0x267248);});}}else{if(_0xd1da4a[_0xe4b3('0x11')]){return _0x1aedea(null,![],{'message':_0xe4b3('0x15')});}else{return utils['getLicense'](_0xd1da4a)[_0xe4b3('0xa')](function(){return _0x1aedea(null,_0xd1da4a);});}}}});})[_0xe4b3('0x1b')](function(_0x5012f7){return _0x1aedea(null,![],_0x5012f7);});}function sendServiceMail(_0x3b138e){return db[_0xe4b3('0x1c')][_0xe4b3('0x1d')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0xe4b3('0x1e')],'as':_0xe4b3('0x1f')}]})[_0xe4b3('0xa')](function(_0x3bb62d){if(!_0x3bb62d){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x25c671={'tls':{'rejectUnauthorized':![]}};if(_0x3bb62d[_0xe4b3('0x1f')][_0xe4b3('0x20')]){_0x25c671[_0xe4b3('0x20')]=_0x3bb62d['Smtp'][_0xe4b3('0x20')];}else{_0x25c671[_0xe4b3('0x21')]=_0x3bb62d[_0xe4b3('0x1f')]['host'];_0x25c671[_0xe4b3('0x22')]=_0x3bb62d['Smtp']['port'];_0x25c671[_0xe4b3('0x23')]=_0x3bb62d[_0xe4b3('0x1f')][_0xe4b3('0x23')];}if(_0x3bb62d[_0xe4b3('0x1f')]['authentication']){_0x25c671[_0xe4b3('0x24')]={'user':_0x3bb62d[_0xe4b3('0x1f')]['user'],'pass':_0x3bb62d[_0xe4b3('0x1f')][_0xe4b3('0x25')]};}var _0x4fe9c2={'account':_0x25c671,'message':_[_0xe4b3('0x26')]({'from':util[_0xe4b3('0x27')](_0xe4b3('0x28'),_0x3bb62d[_0xe4b3('0xc')],_0x3bb62d[_0xe4b3('0x29')]||_0x3bb62d['Smtp']['user'])},_0x3b138e)};return client[_0xe4b3('0x2a')](_0xe4b3('0x2b'),_0x4fe9c2);})['then'](function(_0x5f49bd){if(_0x5f49bd[_0xe4b3('0x2c')]){throw new Error(util[_0xe4b3('0x27')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x5f49bd[_0xe4b3('0x2c')]['message']||JSON[_0xe4b3('0x2d')](_0x5f49bd['error'])));}return!![];});}function handleError(_0x2b02cf,_0x5133b8,_0x3dbaa3){return _0x2b02cf[_0xe4b3('0x2e')](_0x5133b8||0x1f4)['send']({'message':_0x3dbaa3?_0x3dbaa3['message']||_0x3dbaa3:''});}exports[_0xe4b3('0x2f')]=function(_0x2bf1e9,_0x5b302b,_0x57967f){passport['authenticate'](_0xe4b3('0x30'),function(_0x3802ce,_0x15afbc,_0x17fdc5){var _0x2b3448=_0x3802ce||_0x17fdc5;if(_0x2b3448){return handleError(_0x5b302b,0x191,_0x2b3448);}if(!_0x15afbc){return handleError(_0x5b302b,0x194,{'message':_0xe4b3('0x31')});}else{var _0x49d1be={'payload':{'id':_0x15afbc['id'],'role':_0x15afbc[_0xe4b3('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0xe4b3('0x32')](_0x49d1be)[_0xe4b3('0xa')](function(_0x41e456){_0x5b302b[_0xe4b3('0x33')]({'id':_0x15afbc['id'],'token':_0x41e456,'statusCall':'','isAlreadyLogged':_0x15afbc[_0xe4b3('0x34')]});});}})(_0x2bf1e9,_0x5b302b,_0x57967f);};exports[_0xe4b3('0x35')]=function(_0x1edfa4,_0x3ad917,_0x3c8655){if(!_0x1edfa4[_0xe4b3('0x36')][_0xe4b3('0x29')]){return handleError(_0x3ad917,0x1f4,{'message':_0xe4b3('0x37')});}var _0x510d78=rs[_0xe4b3('0x38')]();_0x1edfa4['body']['email']=_0x1edfa4[_0xe4b3('0x36')][_0xe4b3('0x29')][_0xe4b3('0x39')]()[_0xe4b3('0x3a')]();var _0x3008b6;return db[_0xe4b3('0x3b')][_0xe4b3('0xb')]({'where':{'id':0x1},'attributes':[_0xe4b3('0x8'),_0xe4b3('0x9')],'raw':!![]})['then'](function(_0x137a72){_0x3008b6=_0x137a72;return db[_0xe4b3('0x3c')][_0xe4b3('0x1d')]({'where':{'email':_0x1edfa4['body'][_0xe4b3('0x29')]}});})[_0xe4b3('0xa')](function(_0x2647b){if(!_0x2647b){throw new Error(_0xe4b3('0x3d'));}if(_0x2647b['disabled']){throw new Error(_0xe4b3('0x3e'));}if(_0x2647b[_0xe4b3('0x11')]){if(moment(_0x2647b[_0xe4b3('0x12')])['add'](_0x3008b6['blockDuration'],_0xe4b3('0x19'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x2647b[_0xe4b3('0x11')]=![];_0x2647b[_0xe4b3('0x12')]=null;}}_0x2647b[_0xe4b3('0x3f')]=_0x510d78;_0x2647b['resetPasswordExpires']=Date[_0xe4b3('0x40')]()+0x36ee80;return _0x2647b['save']();})[_0xe4b3('0xa')](function(){return sendServiceMail({'to':_0x1edfa4['body']['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xe4b3('0x41')+_0xe4b3('0x42')+'https://'+_0x1edfa4[_0xe4b3('0x43')][_0xe4b3('0x21')]+_0xe4b3('0x44')+_0x510d78+'\x0a\x0a'+_0xe4b3('0x45')});})[_0xe4b3('0xa')](function(){_0x3ad917['status'](0xc8)[_0xe4b3('0x46')]({'message':_0xe4b3('0x47')});})[_0xe4b3('0x1b')](function(_0x379d44){return handleError(_0x3ad917,0x1f4,_0x379d44);});};exports[_0xe4b3('0x48')]=function(_0x5d56b1,_0x4c3cd1,_0x17044d){return db[_0xe4b3('0x3c')][_0xe4b3('0x1d')]({'where':{'resetPasswordToken':_0x5d56b1[_0xe4b3('0x49')][_0xe4b3('0x4a')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x3264e8){if(!_0x3264e8){throw new Error(_0xe4b3('0x4b'));}return db['Setting']['findOne']({'attributes':['id',_0xe4b3('0x4c'),'enforcePasswordHistory','passwordHistoryLimit']})['then'](function(_0x555e71){if(_0x555e71[_0xe4b3('0x4c')])authService[_0xe4b3('0x4d')](_0x5d56b1[_0xe4b3('0x36')][_0xe4b3('0xd')]);if(!_0x555e71[_0xe4b3('0x4e')]||!_0x3264e8['previousPasswords'])return _0x3264e8;authService[_0xe4b3('0x4f')](_0x5d56b1[_0xe4b3('0x36')][_0xe4b3('0xd')],_0x3264e8['previousPasswords'],_0x555e71['passwordHistoryLimit']);return _0x3264e8;})[_0xe4b3('0xa')](function(){_0x3264e8[_0xe4b3('0xd')]=_0x5d56b1[_0xe4b3('0x36')][_0xe4b3('0xd')];_0x3264e8[_0xe4b3('0x3f')]=null;_0x3264e8['resetPasswordExpires']=null;return _0x3264e8['save']();});})[_0xe4b3('0xa')](function(){_0x4c3cd1['status'](0xc8)[_0xe4b3('0x46')]({'message':_0xe4b3('0x50')});})[_0xe4b3('0x1b')](function(_0x4f2655){return handleError(_0x4c3cd1,0x1f4,_0x4f2655);});};passport[_0xe4b3('0x51')](new LocalStrategy({'usernameField':_0xe4b3('0xc'),'passwordField':_0xe4b3('0xd')},function(_0x838892,_0x1e9b05,_0x10f829){return localAuthenticate(db['User'],_0x838892,_0x1e9b05,_0x10f829);})); \ No newline at end of file +var _0x70bc=['trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','../../config/utils','http','findOne','allowedLoginAttempts','blockDuration','name','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','then','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','format','\x22%s\x22\x20<%s>','SendMail','error','message','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate'];(function(_0x3fa7d3,_0x37f83c){var _0x4c51bd=function(_0x59e85b){while(--_0x59e85b){_0x3fa7d3['push'](_0x3fa7d3['shift']());}};_0x4c51bd(++_0x37f83c);}(_0x70bc,0x72));var _0xc70b=function(_0x1b06dd,_0x19b70d){_0x1b06dd=_0x1b06dd-0x0;var _0x270972=_0x70bc[_0x1b06dd];return _0x270972;};'use strict';var util=require(_0xc70b('0x0'));var passport=require(_0xc70b('0x1'));var LocalStrategy=require(_0xc70b('0x2'))[_0xc70b('0x3')];var jayson=require(_0xc70b('0x4'));var _=require(_0xc70b('0x5'));var rs=require('randomstring');var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0xc70b('0x6'));var client=jayson['client'][_0xc70b('0x7')]({'port':0x232b});function localAuthenticate(_0x31aab7,_0x1a52c1,_0x338671,_0x39b2cb){var _0x65bb37,_0x513989;return db['Setting'][_0xc70b('0x8')]({'where':{'id':0x1},'attributes':[_0xc70b('0x9'),_0xc70b('0xa')],'raw':!![]})['then'](function(_0x46a396){_0x65bb37=_0x46a396;return _0x31aab7[_0xc70b('0x8')]({'attributes':['id',_0xc70b('0xb'),'password',_0xc70b('0xc'),_0xc70b('0xd'),_0xc70b('0xe'),_0xc70b('0xf'),_0xc70b('0x10'),_0xc70b('0x11')],'where':{'name':_0x1a52c1,'role':{'$or':[_0xc70b('0x12'),_0xc70b('0x13'),_0xc70b('0x14')]}}});})['then'](function(_0x280a46){if(!_0x280a46||_0x280a46&&_0x280a46['name']!==_0x1a52c1){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x513989=_0x280a46;return _0x513989;}})[_0xc70b('0x15')](function(){_0x513989[_0xc70b('0x16')](_0x338671,function(_0x34cf19,_0x1b0760){var _0x2ab350=_0x513989[_0xc70b('0x11')]+0x1;if(_0x34cf19){return _0x39b2cb(_0x34cf19);}else if(!_0x1b0760){if(_0x513989[_0xc70b('0xe')]){return _0x39b2cb(null,![],{'message':_0xc70b('0x17')});}else if(_0x65bb37[_0xc70b('0x9')]>0x0){if(_0x513989[_0xc70b('0xf')]){if(_0x65bb37[_0xc70b('0xa')]>0x0){if(moment(_0x513989[_0xc70b('0x10')])[_0xc70b('0x18')](_0x65bb37[_0xc70b('0xa')],_0xc70b('0x19'))>moment()){return _0x39b2cb(null,![],{'message':_0xc70b('0x17')});}else{return utils[_0xc70b('0x1a')](_0x513989,_0x2ab350,![],null)[_0xc70b('0x15')](function(){return _0x39b2cb(null,![],{'message':_0xc70b('0x17')});});}}else{return _0x39b2cb(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2ab350>=_0x65bb37[_0xc70b('0x9')]){return utils[_0xc70b('0x1a')](_0x513989,0x0,!![],moment())[_0xc70b('0x15')](function(){return _0x39b2cb(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x513989,_0x2ab350,![],null)['then'](function(){return _0x39b2cb(null,![],{'message':_0xc70b('0x17')});});}}}else{return _0x39b2cb(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x513989['disabled']){return _0x39b2cb(null,![],{'message':_0xc70b('0x17')});}else if(_0x65bb37[_0xc70b('0x9')]>0x0){if(_0x513989[_0xc70b('0xf')]){if(_0x65bb37[_0xc70b('0xa')]>0x0){if(moment(_0x513989[_0xc70b('0x10')])['add'](_0x65bb37[_0xc70b('0xa')],_0xc70b('0x19'))>moment()){return _0x39b2cb(null,![],{'message':_0xc70b('0x17')});}else{return utils[_0xc70b('0x1a')](_0x513989,0x0,![],null)[_0xc70b('0x15')](function(){return utils['getLicense'](_0x513989);})[_0xc70b('0x15')](function(){return _0x39b2cb(null,_0x513989);});}}else{return _0x39b2cb(null,![],{'message':_0xc70b('0x17')});}}else{return utils[_0xc70b('0x1a')](_0x513989,0x0,![],null)[_0xc70b('0x15')](function(){return utils[_0xc70b('0x1b')](_0x513989);})[_0xc70b('0x15')](function(){return _0x39b2cb(null,_0x513989);})[_0xc70b('0x1c')](function(_0x327240){return _0x39b2cb(null,![],_0x327240);});}}else{if(_0x513989[_0xc70b('0xf')]){return _0x39b2cb(null,![],{'message':_0xc70b('0x17')});}else{return utils[_0xc70b('0x1b')](_0x513989)[_0xc70b('0x15')](function(){return _0x39b2cb(null,_0x513989);});}}}});})['catch'](function(_0xa9b8bd){return _0x39b2cb(null,![],_0xa9b8bd);});}function sendServiceMail(_0x24ba02){return db[_0xc70b('0x1d')][_0xc70b('0x1e')]({'where':{'service':!![]},'attributes':['id',_0xc70b('0xb'),_0xc70b('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0xc70b('0x20')}]})[_0xc70b('0x15')](function(_0x348344){if(!_0x348344){throw new Error(_0xc70b('0x21'));}var _0x556487={'tls':{'rejectUnauthorized':![]}};if(_0x348344[_0xc70b('0x20')]['service']){_0x556487[_0xc70b('0x22')]=_0x348344['Smtp'][_0xc70b('0x22')];}else{_0x556487[_0xc70b('0x23')]=_0x348344['Smtp'][_0xc70b('0x23')];_0x556487['port']=_0x348344[_0xc70b('0x20')][_0xc70b('0x24')];_0x556487[_0xc70b('0x25')]=_0x348344[_0xc70b('0x20')][_0xc70b('0x25')];}if(_0x348344[_0xc70b('0x20')][_0xc70b('0x26')]){_0x556487[_0xc70b('0x27')]={'user':_0x348344[_0xc70b('0x20')][_0xc70b('0x13')],'pass':_0x348344[_0xc70b('0x20')]['pass']};}var _0x5bf51f={'account':_0x556487,'message':_['merge']({'from':util[_0xc70b('0x28')](_0xc70b('0x29'),_0x348344[_0xc70b('0xb')],_0x348344[_0xc70b('0x1f')]||_0x348344['Smtp'][_0xc70b('0x13')])},_0x24ba02)};return client['request'](_0xc70b('0x2a'),_0x5bf51f);})[_0xc70b('0x15')](function(_0x28c7d9){if(_0x28c7d9[_0xc70b('0x2b')]){throw new Error(util[_0xc70b('0x28')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x28c7d9['error'][_0xc70b('0x2c')]||JSON['stringify'](_0x28c7d9['error'])));}return!![];});}function handleError(_0x3c0d67,_0x4fb7da,_0x35dccb){return _0x3c0d67['status'](_0x4fb7da||0x1f4)[_0xc70b('0x2d')]({'message':_0x35dccb?_0x35dccb['message']||_0x35dccb:''});}exports[_0xc70b('0x2e')]=function(_0x107ff7,_0x552ff1,_0x58895a){passport[_0xc70b('0x16')](_0xc70b('0x2f'),function(_0x59c4a2,_0x555e66,_0x146f62){var _0x3375ce=_0x59c4a2||_0x146f62;if(_0x3375ce){return handleError(_0x552ff1,0x191,_0x3375ce);}if(!_0x555e66){return handleError(_0x552ff1,0x194,{'message':_0xc70b('0x30')});}else{var _0x2e5e9c={'payload':{'id':_0x555e66['id'],'role':_0x555e66[_0xc70b('0xd')]},'options':{'expiresIn':0x15180}};return authService[_0xc70b('0x31')](_0x2e5e9c)[_0xc70b('0x15')](function(_0x45c6e3){_0x552ff1[_0xc70b('0x32')]({'id':_0x555e66['id'],'token':_0x45c6e3,'statusCall':'','isAlreadyLogged':_0x555e66[_0xc70b('0x33')]});});}})(_0x107ff7,_0x552ff1,_0x58895a);};exports[_0xc70b('0x34')]=function(_0x369be9,_0x2d4bb0,_0x3f7aa1){if(!_0x369be9[_0xc70b('0x35')][_0xc70b('0x1f')]){return handleError(_0x2d4bb0,0x1f4,{'message':_0xc70b('0x36')});}var _0x2f8361=rs[_0xc70b('0x37')]();_0x369be9[_0xc70b('0x35')]['email']=_0x369be9[_0xc70b('0x35')]['email'][_0xc70b('0x38')]()[_0xc70b('0x39')]();var _0x3af695;return db[_0xc70b('0x3a')][_0xc70b('0x8')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x2b4957){_0x3af695=_0x2b4957;return db[_0xc70b('0x3b')]['find']({'where':{'email':_0x369be9[_0xc70b('0x35')]['email']}});})['then'](function(_0x33b224){if(!_0x33b224){throw new Error(_0xc70b('0x3c'));}if(_0x33b224['disabled']){throw new Error(_0xc70b('0x3d'));}if(_0x33b224[_0xc70b('0xf')]){if(moment(_0x33b224['blockedAt'])['add'](_0x3af695['blockDuration'],_0xc70b('0x19'))>moment()){throw new Error(_0xc70b('0x3e'));}else{_0x33b224[_0xc70b('0xf')]=![];_0x33b224['blockedAt']=null;}}_0x33b224[_0xc70b('0x3f')]=_0x2f8361;_0x33b224[_0xc70b('0x40')]=Date[_0xc70b('0x41')]()+0x36ee80;return _0x33b224[_0xc70b('0x42')]();})[_0xc70b('0x15')](function(){return sendServiceMail({'to':_0x369be9[_0xc70b('0x35')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xc70b('0x43')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xc70b('0x44')+_0x369be9[_0xc70b('0x45')]['host']+'/reset/'+_0x2f8361+'\x0a\x0a'+_0xc70b('0x46')});})[_0xc70b('0x15')](function(){_0x2d4bb0[_0xc70b('0x47')](0xc8)[_0xc70b('0x2d')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x2c52bb){return handleError(_0x2d4bb0,0x1f4,_0x2c52bb);});};exports[_0xc70b('0x48')]=function(_0x8e8399,_0x45ae70,_0x9f39b0){return db[_0xc70b('0x3b')]['find']({'where':{'resetPasswordToken':_0x8e8399[_0xc70b('0x49')][_0xc70b('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xc70b('0x41')]()}}})['then'](function(_0x22587c){if(!_0x22587c){throw new Error(_0xc70b('0x4b'));}return db[_0xc70b('0x3a')]['findOne']({'attributes':['id',_0xc70b('0x4c'),_0xc70b('0x4d'),_0xc70b('0x4e')]})[_0xc70b('0x15')](function(_0x952efc){if(_0x952efc[_0xc70b('0x4c')])authService[_0xc70b('0x4f')](_0x8e8399[_0xc70b('0x35')][_0xc70b('0x50')]);if(!_0x952efc['enforcePasswordHistory']||!_0x22587c[_0xc70b('0x51')])return _0x22587c;authService[_0xc70b('0x52')](_0x8e8399[_0xc70b('0x35')][_0xc70b('0x50')],_0x22587c['previousPasswords'],_0x952efc[_0xc70b('0x4e')]);return _0x22587c;})[_0xc70b('0x15')](function(){_0x22587c[_0xc70b('0x50')]=_0x8e8399[_0xc70b('0x35')][_0xc70b('0x50')];_0x22587c[_0xc70b('0x3f')]=null;_0x22587c[_0xc70b('0x40')]=null;return _0x22587c[_0xc70b('0x42')]();});})[_0xc70b('0x15')](function(){_0x45ae70[_0xc70b('0x47')](0xc8)[_0xc70b('0x2d')]({'message':_0xc70b('0x53')});})[_0xc70b('0x1c')](function(_0x156277){return handleError(_0x45ae70,0x1f4,_0x156277);});};passport[_0xc70b('0x54')](new LocalStrategy({'usernameField':_0xc70b('0xb'),'passwordField':_0xc70b('0x50')},function(_0x542eda,_0xffebbc,_0x292561){return localAuthenticate(db[_0xc70b('0x3b')],_0x542eda,_0xffebbc,_0x292561);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 3bf113d..58b53dd 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 _0x888e=['Router','post','login','forgot','/reset/:token','reset','exports','express'];(function(_0x445346,_0x3ff37a){var _0x1ce80d=function(_0x33ab3b){while(--_0x33ab3b){_0x445346['push'](_0x445346['shift']());}};_0x1ce80d(++_0x3ff37a);}(_0x888e,0x7f));var _0xe888=function(_0x1802cb,_0x6a0e4e){_0x1802cb=_0x1802cb-0x0;var _0x8753cd=_0x888e[_0x1802cb];return _0x8753cd;};'use strict';var express=require(_0xe888('0x0'));var router=express[_0xe888('0x1')]();var controller=require('./authLocal.controller');router[_0xe888('0x2')]('/',controller[_0xe888('0x3')]);router[_0xe888('0x2')]('/forgot',controller[_0xe888('0x4')]);router[_0xe888('0x2')](_0xe888('0x5'),controller[_0xe888('0x6')]);module[_0xe888('0x7')]=router; \ No newline at end of file +var _0xe7ba=['express','./authLocal.controller','post','reset'];(function(_0x475d32,_0x45102b){var _0x3adbd3=function(_0x466fa8){while(--_0x466fa8){_0x475d32['push'](_0x475d32['shift']());}};_0x3adbd3(++_0x45102b);}(_0xe7ba,0x184));var _0xae7b=function(_0x8030cd,_0x4fa096){_0x8030cd=_0x8030cd-0x0;var _0x39e53d=_0xe7ba[_0x8030cd];return _0x39e53d;};'use strict';var express=require(_0xae7b('0x0'));var router=express['Router']();var controller=require(_0xae7b('0x1'));router[_0xae7b('0x2')]('/',controller['login']);router[_0xae7b('0x2')]('/forgot',controller['forgot']);router['post']('/reset/:token',controller[_0xae7b('0x3')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index f41912d..597eb61 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 _0x6963=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0x6963,0x184));var _0x3696=function(_0x3f1779,_0x1329e5){_0x3f1779=_0x3f1779-0x0;var _0x6cc9b6=_0x6963[_0x3f1779];return _0x6cc9b6;};'use strict';var Sequelize=require(_0x3696('0x0'));module[_0x3696('0x1')]={'name':{'type':Sequelize[_0x3696('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x3696('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x3696('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x3696('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x8a04=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x1b00d0,_0x265b67){var _0x31446c=function(_0x4e4679){while(--_0x4e4679){_0x1b00d0['push'](_0x1b00d0['shift']());}};_0x31446c(++_0x265b67);}(_0x8a04,0x15f));var _0x48a0=function(_0x5dc074,_0x5f2710){_0x5dc074=_0x5dc074-0x0;var _0x4f466a=_0x8a04[_0x5dc074];return _0x4f466a;};'use strict';var Sequelize=require(_0x48a0('0x0'));module[_0x48a0('0x1')]={'name':{'type':Sequelize[_0x48a0('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x48a0('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x48a0('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 3977192..1b781cb 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 _0xdb7c=['model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','catch','show','includeAll','find','create','body','update','params','addConditions','ids','getConditions','length','hasOwnProperty','addActions','Action','getActions','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','Automation','rawAttributes','fieldName','type','key'];(function(_0x2694f6,_0x31b042){var _0x13ab43=function(_0x243a5e){while(--_0x243a5e){_0x2694f6['push'](_0x2694f6['shift']());}};_0x13ab43(++_0x31b042);}(_0xdb7c,0x173));var _0xcdb7=function(_0x3ad737,_0x300131){_0x3ad737=_0x3ad737-0x0;var _0x16c1e2=_0xdb7c[_0x3ad737];return _0x16c1e2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdb7('0x0'));var zipdir=require(_0xcdb7('0x1'));var jsonpatch=require(_0xcdb7('0x2'));var rp=require(_0xcdb7('0x3'));var moment=require(_0xcdb7('0x4'));var BPromise=require(_0xcdb7('0x5'));var Mustache=require(_0xcdb7('0x6'));var util=require(_0xcdb7('0x7'));var path=require('path');var sox=require(_0xcdb7('0x8'));var csv=require(_0xcdb7('0x9'));var ejs=require(_0xcdb7('0xa'));var fs=require('fs');var fs_extra=require(_0xcdb7('0xb'));var _=require('lodash');var squel=require(_0xcdb7('0xc'));var crypto=require(_0xcdb7('0xd'));var jsforce=require(_0xcdb7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcdb7('0x9'));var querystring=require(_0xcdb7('0xf'));var Papa=require('papaparse');var Redis=require(_0xcdb7('0x10'));var authService=require(_0xcdb7('0x11'));var qs=require(_0xcdb7('0x12'));var as=require(_0xcdb7('0x13'));var hardwareService=require(_0xcdb7('0x14'));var logger=require('../../config/logger')(_0xcdb7('0x15'));var utils=require(_0xcdb7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcdb7('0x17'));var db=require(_0xcdb7('0x18'))['db'];function respondWithStatusCode(_0x331a8e,_0x239c68){_0x239c68=_0x239c68||0xcc;return function(_0x554894){if(_0x554894){return _0x331a8e[_0xcdb7('0x19')](_0x239c68);}return _0x331a8e[_0xcdb7('0x1a')](_0x239c68)[_0xcdb7('0x1b')]();};}function respondWithResult(_0x8d69cd,_0x903fc0){_0x903fc0=_0x903fc0||0xc8;return function(_0x864dd2){if(_0x864dd2){return _0x8d69cd[_0xcdb7('0x1a')](_0x903fc0)[_0xcdb7('0x1c')](_0x864dd2);}};}function respondWithFilteredResult(_0x364286,_0x376f3e){return function(_0x40c0e8){if(_0x40c0e8){var _0x5d7254=typeof _0x376f3e['offset']==='undefined'&&typeof _0x376f3e[_0xcdb7('0x1d')]==='undefined';var _0x22b5f2=_0x40c0e8[_0xcdb7('0x1e')];var _0x16aa31=_0x5d7254?0x0:_0x376f3e[_0xcdb7('0x1f')];var _0x12cbdf=_0x5d7254?_0x40c0e8['count']:_0x376f3e['offset']+_0x376f3e[_0xcdb7('0x1d')];var _0x9d776;if(_0x12cbdf>=_0x22b5f2){_0x12cbdf=_0x22b5f2;_0x9d776=0xc8;}else{_0x9d776=0xce;}_0x364286[_0xcdb7('0x1a')](_0x9d776);return _0x364286[_0xcdb7('0x20')](_0xcdb7('0x21'),_0x16aa31+'-'+_0x12cbdf+'/'+_0x22b5f2)[_0xcdb7('0x1c')](_0x40c0e8);}return null;};}function patchUpdates(_0x16ba3c){return function(_0x1b0d06){try{jsonpatch[_0xcdb7('0x22')](_0x1b0d06,_0x16ba3c,!![]);}catch(_0x1b7502){return BPromise[_0xcdb7('0x23')](_0x1b7502);}return _0x1b0d06[_0xcdb7('0x24')]();};}function saveUpdates(_0x5d8da1,_0x5a3053){return function(_0x199362){if(_0x199362){return _0x199362['update'](_0x5d8da1)[_0xcdb7('0x25')](function(_0x48e41c){return _0x48e41c;});}return null;};}function removeEntity(_0x18d34c,_0x527422){return function(_0x1a1eff){if(_0x1a1eff){return _0x1a1eff[_0xcdb7('0x26')]()['then'](function(){_0x18d34c[_0xcdb7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33f616,_0x4c653a){return function(_0x261449){if(!_0x261449){_0x33f616[_0xcdb7('0x19')](0x194);}return _0x261449;};}function handleError(_0xe23990,_0x22ce13){_0x22ce13=_0x22ce13||0x1f4;return function(_0x35bde1){logger[_0xcdb7('0x27')](_0x35bde1[_0xcdb7('0x28')]);if(_0x35bde1[_0xcdb7('0x29')]){delete _0x35bde1[_0xcdb7('0x29')];}_0xe23990['status'](_0x22ce13)['send'](_0x35bde1);};}exports[_0xcdb7('0x2a')]=function(_0x8184f8,_0x33e811){var _0x119f62={},_0x5c7ba4={},_0x2d1971={'count':0x0,'rows':[]};var _0x2b7cf3=_[_0xcdb7('0x2b')](db[_0xcdb7('0x2c')][_0xcdb7('0x2d')],function(_0x327f04){return{'name':_0x327f04[_0xcdb7('0x2e')],'type':_0x327f04[_0xcdb7('0x2f')][_0xcdb7('0x30')]};});_0x5c7ba4[_0xcdb7('0x31')]=_['map'](_0x2b7cf3,_0xcdb7('0x29'));_0x5c7ba4[_0xcdb7('0x32')]=_[_0xcdb7('0x33')](_0x8184f8['query']);_0x5c7ba4[_0xcdb7('0x34')]=_[_0xcdb7('0x35')](_0x5c7ba4[_0xcdb7('0x31')],_0x5c7ba4[_0xcdb7('0x32')]);_0x119f62[_0xcdb7('0x36')]=_['intersection'](_0x5c7ba4[_0xcdb7('0x31')],qs[_0xcdb7('0x37')](_0x8184f8['query']['fields']));_0x119f62[_0xcdb7('0x36')]=_0x119f62[_0xcdb7('0x36')]['length']?_0x119f62[_0xcdb7('0x36')]:_0x5c7ba4[_0xcdb7('0x31')];if(!_0x8184f8[_0xcdb7('0x32')]['hasOwnProperty'](_0xcdb7('0x38'))){_0x119f62[_0xcdb7('0x1d')]=qs[_0xcdb7('0x1d')](_0x8184f8['query'][_0xcdb7('0x1d')]);_0x119f62[_0xcdb7('0x1f')]=qs['offset'](_0x8184f8[_0xcdb7('0x32')][_0xcdb7('0x1f')]);}_0x119f62[_0xcdb7('0x39')]=qs['sort'](_0x8184f8['query'][_0xcdb7('0x3a')]);_0x119f62[_0xcdb7('0x3b')]=qs[_0xcdb7('0x34')](_[_0xcdb7('0x3c')](_0x8184f8[_0xcdb7('0x32')],_0x5c7ba4[_0xcdb7('0x34')]),_0x2b7cf3);if(_0x8184f8[_0xcdb7('0x32')]['filter']){_0x119f62[_0xcdb7('0x3b')]=_['merge'](_0x119f62[_0xcdb7('0x3b')],{'$or':_[_0xcdb7('0x2b')](_0x2b7cf3,function(_0x4176ae){if(_0x4176ae[_0xcdb7('0x2f')]!==_0xcdb7('0x3d')){var _0x401231={};_0x401231[_0x4176ae[_0xcdb7('0x29')]]={'$like':'%'+_0x8184f8[_0xcdb7('0x32')][_0xcdb7('0x3e')]+'%'};return _0x401231;}})});}_0x119f62=_[_0xcdb7('0x3f')]({},_0x119f62,_0x8184f8[_0xcdb7('0x40')]);var _0x1f3b3d={'where':_0x119f62[_0xcdb7('0x3b')]};return db[_0xcdb7('0x2c')][_0xcdb7('0x1e')](_0x1f3b3d)['then'](function(_0x36b65f){_0x2d1971[_0xcdb7('0x1e')]=_0x36b65f;if(_0x8184f8['query']['includeAll']){_0x119f62[_0xcdb7('0x41')]=[{'all':!![]}];}return db[_0xcdb7('0x2c')][_0xcdb7('0x42')](_0x119f62);})[_0xcdb7('0x25')](function(_0x190946){_0x2d1971['rows']=_0x190946;return _0x2d1971;})['then'](respondWithFilteredResult(_0x33e811,_0x119f62))[_0xcdb7('0x43')](handleError(_0x33e811,null));};exports[_0xcdb7('0x44')]=function(_0x35b5c0,_0x3b060d){var _0x5832d3={'raw':![],'where':{'id':_0x35b5c0['params']['id']}},_0x5922ac={};_0x5922ac['model']=_[_0xcdb7('0x33')](db[_0xcdb7('0x2c')][_0xcdb7('0x2d')]);_0x5922ac[_0xcdb7('0x32')]=_[_0xcdb7('0x33')](_0x35b5c0['query']);_0x5922ac[_0xcdb7('0x34')]=_['intersection'](_0x5922ac[_0xcdb7('0x31')],_0x5922ac[_0xcdb7('0x32')]);_0x5832d3[_0xcdb7('0x36')]=_[_0xcdb7('0x35')](_0x5922ac[_0xcdb7('0x31')],qs['fields'](_0x35b5c0['query']['fields']));_0x5832d3['attributes']=_0x5832d3[_0xcdb7('0x36')]['length']?_0x5832d3['attributes']:_0x5922ac[_0xcdb7('0x31')];if(_0x35b5c0[_0xcdb7('0x32')][_0xcdb7('0x45')]){_0x5832d3[_0xcdb7('0x41')]=[{'all':!![]}];}_0x5832d3=_[_0xcdb7('0x3f')]({},_0x5832d3,_0x35b5c0[_0xcdb7('0x40')]);return db[_0xcdb7('0x2c')][_0xcdb7('0x46')](_0x5832d3)['then'](handleEntityNotFound(_0x3b060d,null))['then'](respondWithResult(_0x3b060d,null))[_0xcdb7('0x43')](handleError(_0x3b060d,null));};exports['create']=function(_0x310858,_0x45cd6b){return db[_0xcdb7('0x2c')][_0xcdb7('0x47')](_0x310858[_0xcdb7('0x48')],{})[_0xcdb7('0x25')](respondWithResult(_0x45cd6b,0xc9))[_0xcdb7('0x43')](handleError(_0x45cd6b,null));};exports[_0xcdb7('0x49')]=function(_0x3cc4e0,_0x4a0383){if(_0x3cc4e0[_0xcdb7('0x48')]['id']){delete _0x3cc4e0[_0xcdb7('0x48')]['id'];}return db[_0xcdb7('0x2c')]['find']({'where':{'id':_0x3cc4e0[_0xcdb7('0x4a')]['id']}})[_0xcdb7('0x25')](handleEntityNotFound(_0x4a0383,null))['then'](saveUpdates(_0x3cc4e0[_0xcdb7('0x48')],null))[_0xcdb7('0x25')](respondWithResult(_0x4a0383,null))['catch'](handleError(_0x4a0383,null));};exports[_0xcdb7('0x26')]=function(_0x267704,_0x49cab6){return db['Automation'][_0xcdb7('0x46')]({'where':{'id':_0x267704[_0xcdb7('0x4a')]['id']}})[_0xcdb7('0x25')](handleEntityNotFound(_0x49cab6,null))[_0xcdb7('0x25')](removeEntity(_0x49cab6,null))[_0xcdb7('0x43')](handleError(_0x49cab6,null));};exports[_0xcdb7('0x4b')]=function(_0x42f2c5,_0x9f2b80,_0x1aaa43){return db['Condition'][_0xcdb7('0x46')]({'where':{'id':_0x42f2c5[_0xcdb7('0x4a')]['id']}})[_0xcdb7('0x25')](handleEntityNotFound(_0x9f2b80,null))[_0xcdb7('0x25')](function(_0x5c4d0e){if(_0x5c4d0e){return _0x5c4d0e[_0xcdb7('0x4b')](_0x42f2c5[_0xcdb7('0x48')][_0xcdb7('0x4c')],_['omit'](_0x42f2c5[_0xcdb7('0x48')],[_0xcdb7('0x4c'),'id'])||{});}})[_0xcdb7('0x25')](respondWithResult(_0x9f2b80,null))[_0xcdb7('0x43')](handleError(_0x9f2b80,null));};exports[_0xcdb7('0x4d')]=function(_0x249fda,_0x195f04,_0x3ae1d3){var _0x576533={};var _0x2ca77a={};var _0x4c533f;var _0x47263b;return db[_0xcdb7('0x2c')]['findOne']({'where':{'id':_0x249fda[_0xcdb7('0x4a')]['id']}})[_0xcdb7('0x25')](handleEntityNotFound(_0x195f04,null))[_0xcdb7('0x25')](function(_0x45c96d){if(_0x45c96d){_0x4c533f=_0x45c96d;_0x2ca77a[_0xcdb7('0x31')]=_[_0xcdb7('0x33')](db['Condition'][_0xcdb7('0x2d')]);_0x2ca77a['query']=_[_0xcdb7('0x33')](_0x249fda[_0xcdb7('0x32')]);_0x2ca77a[_0xcdb7('0x34')]=_[_0xcdb7('0x35')](_0x2ca77a[_0xcdb7('0x31')],_0x2ca77a[_0xcdb7('0x32')]);_0x576533[_0xcdb7('0x36')]=_[_0xcdb7('0x35')](_0x2ca77a[_0xcdb7('0x31')],qs[_0xcdb7('0x37')](_0x249fda['query'][_0xcdb7('0x37')]));_0x576533[_0xcdb7('0x36')]=_0x576533[_0xcdb7('0x36')][_0xcdb7('0x4e')]?_0x576533[_0xcdb7('0x36')]:_0x2ca77a[_0xcdb7('0x31')];_0x576533[_0xcdb7('0x39')]=qs['sort'](_0x249fda['query'][_0xcdb7('0x3a')]);_0x576533[_0xcdb7('0x3b')]=qs[_0xcdb7('0x34')](_[_0xcdb7('0x3c')](_0x249fda[_0xcdb7('0x32')],_0x2ca77a['filters']));if(_0x249fda[_0xcdb7('0x32')][_0xcdb7('0x3e')]){_0x576533[_0xcdb7('0x3b')]=_[_0xcdb7('0x3f')](_0x576533[_0xcdb7('0x3b')],{'$or':_[_0xcdb7('0x2b')](_0x576533[_0xcdb7('0x36')],function(_0x420de8){var _0x5f4f45={};_0x5f4f45[_0x420de8]={'$like':'%'+_0x249fda[_0xcdb7('0x32')]['filter']+'%'};return _0x5f4f45;})});}_0x576533=_['merge']({},_0x576533,_0x249fda[_0xcdb7('0x40')]);return _0x4c533f['getConditions'](_0x576533);}})['then'](function(_0x4f89e6){if(_0x4f89e6){_0x47263b=_0x4f89e6[_0xcdb7('0x4e')];if(!_0x249fda[_0xcdb7('0x32')][_0xcdb7('0x4f')](_0xcdb7('0x38'))){_0x576533[_0xcdb7('0x1d')]=qs[_0xcdb7('0x1d')](_0x249fda[_0xcdb7('0x32')][_0xcdb7('0x1d')]);_0x576533[_0xcdb7('0x1f')]=qs[_0xcdb7('0x1f')](_0x249fda[_0xcdb7('0x32')][_0xcdb7('0x1f')]);}return _0x4c533f['getConditions'](_0x576533);}})[_0xcdb7('0x25')](function(_0x50003a){if(_0x50003a){return _0x50003a?{'count':_0x47263b,'rows':_0x50003a}:null;}})[_0xcdb7('0x25')](respondWithResult(_0x195f04,null))[_0xcdb7('0x43')](handleError(_0x195f04,null));};exports[_0xcdb7('0x50')]=function(_0x58282f,_0x291819,_0x5d6b5e){return db[_0xcdb7('0x51')]['find']({'where':{'id':_0x58282f[_0xcdb7('0x4a')]['id']}})[_0xcdb7('0x25')](handleEntityNotFound(_0x291819,null))[_0xcdb7('0x25')](function(_0x427bd3){if(_0x427bd3){return _0x427bd3[_0xcdb7('0x50')](_0x58282f[_0xcdb7('0x48')][_0xcdb7('0x4c')],_['omit'](_0x58282f[_0xcdb7('0x48')],[_0xcdb7('0x4c'),'id'])||{});}})[_0xcdb7('0x25')](respondWithResult(_0x291819,null))[_0xcdb7('0x43')](handleError(_0x291819,null));};exports[_0xcdb7('0x52')]=function(_0x259566,_0x28a75a,_0x3789cf){var _0x5a943a={};var _0x4ed33c={};var _0xfa241b;var _0x31e47c;return db[_0xcdb7('0x2c')][_0xcdb7('0x53')]({'where':{'id':_0x259566[_0xcdb7('0x4a')]['id']}})[_0xcdb7('0x25')](handleEntityNotFound(_0x28a75a,null))[_0xcdb7('0x25')](function(_0x688f93){if(_0x688f93){_0xfa241b=_0x688f93;_0x4ed33c[_0xcdb7('0x31')]=_[_0xcdb7('0x33')](db[_0xcdb7('0x51')][_0xcdb7('0x2d')]);_0x4ed33c['query']=_[_0xcdb7('0x33')](_0x259566[_0xcdb7('0x32')]);_0x4ed33c[_0xcdb7('0x34')]=_[_0xcdb7('0x35')](_0x4ed33c['model'],_0x4ed33c[_0xcdb7('0x32')]);_0x5a943a[_0xcdb7('0x36')]=_[_0xcdb7('0x35')](_0x4ed33c[_0xcdb7('0x31')],qs['fields'](_0x259566['query'][_0xcdb7('0x37')]));_0x5a943a[_0xcdb7('0x36')]=_0x5a943a[_0xcdb7('0x36')][_0xcdb7('0x4e')]?_0x5a943a[_0xcdb7('0x36')]:_0x4ed33c[_0xcdb7('0x31')];_0x5a943a[_0xcdb7('0x39')]=qs[_0xcdb7('0x3a')](_0x259566[_0xcdb7('0x32')][_0xcdb7('0x3a')]);_0x5a943a['where']=qs[_0xcdb7('0x34')](_[_0xcdb7('0x3c')](_0x259566[_0xcdb7('0x32')],_0x4ed33c['filters']));if(_0x259566[_0xcdb7('0x32')][_0xcdb7('0x3e')]){_0x5a943a[_0xcdb7('0x3b')]=_[_0xcdb7('0x3f')](_0x5a943a[_0xcdb7('0x3b')],{'$or':_['map'](_0x5a943a[_0xcdb7('0x36')],function(_0x4d17a8){var _0x1af055={};_0x1af055[_0x4d17a8]={'$like':'%'+_0x259566[_0xcdb7('0x32')]['filter']+'%'};return _0x1af055;})});}_0x5a943a=_['merge']({},_0x5a943a,_0x259566['options']);return _0xfa241b['getActions'](_0x5a943a);}})['then'](function(_0x41a049){if(_0x41a049){_0x31e47c=_0x41a049[_0xcdb7('0x4e')];if(!_0x259566[_0xcdb7('0x32')][_0xcdb7('0x4f')](_0xcdb7('0x38'))){_0x5a943a[_0xcdb7('0x1d')]=qs[_0xcdb7('0x1d')](_0x259566[_0xcdb7('0x32')][_0xcdb7('0x1d')]);_0x5a943a[_0xcdb7('0x1f')]=qs[_0xcdb7('0x1f')](_0x259566['query']['offset']);}return _0xfa241b['getActions'](_0x5a943a);}})['then'](function(_0x35c2a6){if(_0x35c2a6){return _0x35c2a6?{'count':_0x31e47c,'rows':_0x35c2a6}:null;}})[_0xcdb7('0x25')](respondWithResult(_0x28a75a,null))[_0xcdb7('0x43')](handleError(_0x28a75a,null));}; \ No newline at end of file +var _0x46db=['includeAll','findAll','catch','show','params','keys','rawAttributes','include','options','find','create','body','destroy','addConditions','Condition','omit','ids','getConditions','nolimit','addActions','Action','getActions','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','Automation','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x2f7e86,_0xe78eda){var _0x2340c5=function(_0x232848){while(--_0x232848){_0x2f7e86['push'](_0x2f7e86['shift']());}};_0x2340c5(++_0xe78eda);}(_0x46db,0x1d4));var _0xb46d=function(_0x1f60b3,_0xc99fdd){_0x1f60b3=_0x1f60b3-0x0;var _0x2ef138=_0x46db[_0x1f60b3];return _0x2ef138;};'use strict';var emlformat=require(_0xb46d('0x0'));var rimraf=require(_0xb46d('0x1'));var zipdir=require(_0xb46d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb46d('0x3'));var moment=require(_0xb46d('0x4'));var BPromise=require(_0xb46d('0x5'));var Mustache=require(_0xb46d('0x6'));var util=require(_0xb46d('0x7'));var path=require(_0xb46d('0x8'));var sox=require(_0xb46d('0x9'));var csv=require(_0xb46d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb46d('0xb'));var squel=require(_0xb46d('0xc'));var crypto=require(_0xb46d('0xd'));var jsforce=require(_0xb46d('0xe'));var deskjs=require(_0xb46d('0xf'));var toCsv=require(_0xb46d('0xa'));var querystring=require(_0xb46d('0x10'));var Papa=require(_0xb46d('0x11'));var Redis=require(_0xb46d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb46d('0x13'));var as=require(_0xb46d('0x14'));var hardwareService=require(_0xb46d('0x15'));var logger=require(_0xb46d('0x16'))(_0xb46d('0x17'));var utils=require(_0xb46d('0x18'));var config=require(_0xb46d('0x19'));var licenseUtil=require(_0xb46d('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55841c,_0x234edc){_0x234edc=_0x234edc||0xcc;return function(_0x12ae18){if(_0x12ae18){return _0x55841c[_0xb46d('0x1b')](_0x234edc);}return _0x55841c[_0xb46d('0x1c')](_0x234edc)[_0xb46d('0x1d')]();};}function respondWithResult(_0x297576,_0x3d3588){_0x3d3588=_0x3d3588||0xc8;return function(_0x3071a6){if(_0x3071a6){return _0x297576[_0xb46d('0x1c')](_0x3d3588)[_0xb46d('0x1e')](_0x3071a6);}};}function respondWithFilteredResult(_0x5b1cfc,_0x754357){return function(_0x25f862){if(_0x25f862){var _0x1bc63b=typeof _0x754357[_0xb46d('0x1f')]===_0xb46d('0x20')&&typeof _0x754357[_0xb46d('0x21')]===_0xb46d('0x20');var _0x3969cd=_0x25f862[_0xb46d('0x22')];var _0x386198=_0x1bc63b?0x0:_0x754357[_0xb46d('0x1f')];var _0x1f3fa1=_0x1bc63b?_0x25f862[_0xb46d('0x22')]:_0x754357['offset']+_0x754357[_0xb46d('0x21')];var _0x251343;if(_0x1f3fa1>=_0x3969cd){_0x1f3fa1=_0x3969cd;_0x251343=0xc8;}else{_0x251343=0xce;}_0x5b1cfc[_0xb46d('0x1c')](_0x251343);return _0x5b1cfc[_0xb46d('0x23')](_0xb46d('0x24'),_0x386198+'-'+_0x1f3fa1+'/'+_0x3969cd)['json'](_0x25f862);}return null;};}function patchUpdates(_0x104580){return function(_0x558593){try{jsonpatch['apply'](_0x558593,_0x104580,!![]);}catch(_0x5393eb){return BPromise[_0xb46d('0x25')](_0x5393eb);}return _0x558593[_0xb46d('0x26')]();};}function saveUpdates(_0x3c74c0,_0x5825cc){return function(_0x189cf2){if(_0x189cf2){return _0x189cf2[_0xb46d('0x27')](_0x3c74c0)[_0xb46d('0x28')](function(_0x2d1a73){return _0x2d1a73;});}return null;};}function removeEntity(_0x59f0ad,_0x449386){return function(_0x2e50c7){if(_0x2e50c7){return _0x2e50c7['destroy']()[_0xb46d('0x28')](function(){_0x59f0ad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40b221,_0xbaf1fd){return function(_0x3d8d1f){if(!_0x3d8d1f){_0x40b221[_0xb46d('0x1b')](0x194);}return _0x3d8d1f;};}function handleError(_0x52a2a1,_0x58c7e2){_0x58c7e2=_0x58c7e2||0x1f4;return function(_0x4e2a81){logger[_0xb46d('0x29')](_0x4e2a81[_0xb46d('0x2a')]);if(_0x4e2a81[_0xb46d('0x2b')]){delete _0x4e2a81[_0xb46d('0x2b')];}_0x52a2a1['status'](_0x58c7e2)[_0xb46d('0x2c')](_0x4e2a81);};}exports[_0xb46d('0x2d')]=function(_0x441e3e,_0x5d35c9){var _0x3b8f19={},_0x527984={},_0x4fc793={'count':0x0,'rows':[]};var _0x2238c3=_[_0xb46d('0x2e')](db[_0xb46d('0x2f')]['rawAttributes'],function(_0x4675ac){return{'name':_0x4675ac[_0xb46d('0x30')],'type':_0x4675ac[_0xb46d('0x31')][_0xb46d('0x32')]};});_0x527984[_0xb46d('0x33')]=_[_0xb46d('0x2e')](_0x2238c3,_0xb46d('0x2b'));_0x527984[_0xb46d('0x34')]=_['keys'](_0x441e3e['query']);_0x527984[_0xb46d('0x35')]=_[_0xb46d('0x36')](_0x527984[_0xb46d('0x33')],_0x527984[_0xb46d('0x34')]);_0x3b8f19[_0xb46d('0x37')]=_['intersection'](_0x527984[_0xb46d('0x33')],qs[_0xb46d('0x38')](_0x441e3e[_0xb46d('0x34')][_0xb46d('0x38')]));_0x3b8f19[_0xb46d('0x37')]=_0x3b8f19[_0xb46d('0x37')][_0xb46d('0x39')]?_0x3b8f19[_0xb46d('0x37')]:_0x527984[_0xb46d('0x33')];if(!_0x441e3e[_0xb46d('0x34')][_0xb46d('0x3a')]('nolimit')){_0x3b8f19[_0xb46d('0x21')]=qs[_0xb46d('0x21')](_0x441e3e['query'][_0xb46d('0x21')]);_0x3b8f19['offset']=qs[_0xb46d('0x1f')](_0x441e3e['query'][_0xb46d('0x1f')]);}_0x3b8f19[_0xb46d('0x3b')]=qs[_0xb46d('0x3c')](_0x441e3e[_0xb46d('0x34')][_0xb46d('0x3c')]);_0x3b8f19[_0xb46d('0x3d')]=qs['filters'](_[_0xb46d('0x3e')](_0x441e3e['query'],_0x527984[_0xb46d('0x35')]),_0x2238c3);if(_0x441e3e[_0xb46d('0x34')][_0xb46d('0x3f')]){_0x3b8f19['where']=_[_0xb46d('0x40')](_0x3b8f19['where'],{'$or':_[_0xb46d('0x2e')](_0x2238c3,function(_0x303db1){if(_0x303db1[_0xb46d('0x31')]!==_0xb46d('0x41')){var _0x5a4597={};_0x5a4597[_0x303db1['name']]={'$like':'%'+_0x441e3e[_0xb46d('0x34')][_0xb46d('0x3f')]+'%'};return _0x5a4597;}})});}_0x3b8f19=_[_0xb46d('0x40')]({},_0x3b8f19,_0x441e3e['options']);var _0x19280e={'where':_0x3b8f19[_0xb46d('0x3d')]};return db[_0xb46d('0x2f')][_0xb46d('0x22')](_0x19280e)['then'](function(_0x2d2dda){_0x4fc793[_0xb46d('0x22')]=_0x2d2dda;if(_0x441e3e[_0xb46d('0x34')][_0xb46d('0x42')]){_0x3b8f19['include']=[{'all':!![]}];}return db[_0xb46d('0x2f')][_0xb46d('0x43')](_0x3b8f19);})[_0xb46d('0x28')](function(_0x39ac3c){_0x4fc793['rows']=_0x39ac3c;return _0x4fc793;})[_0xb46d('0x28')](respondWithFilteredResult(_0x5d35c9,_0x3b8f19))[_0xb46d('0x44')](handleError(_0x5d35c9,null));};exports[_0xb46d('0x45')]=function(_0xf54fd,_0xf6ef35){var _0x314831={'raw':![],'where':{'id':_0xf54fd[_0xb46d('0x46')]['id']}},_0xb7ce77={};_0xb7ce77['model']=_[_0xb46d('0x47')](db[_0xb46d('0x2f')][_0xb46d('0x48')]);_0xb7ce77[_0xb46d('0x34')]=_[_0xb46d('0x47')](_0xf54fd[_0xb46d('0x34')]);_0xb7ce77[_0xb46d('0x35')]=_['intersection'](_0xb7ce77[_0xb46d('0x33')],_0xb7ce77[_0xb46d('0x34')]);_0x314831['attributes']=_[_0xb46d('0x36')](_0xb7ce77[_0xb46d('0x33')],qs[_0xb46d('0x38')](_0xf54fd[_0xb46d('0x34')][_0xb46d('0x38')]));_0x314831[_0xb46d('0x37')]=_0x314831[_0xb46d('0x37')][_0xb46d('0x39')]?_0x314831[_0xb46d('0x37')]:_0xb7ce77['model'];if(_0xf54fd['query'][_0xb46d('0x42')]){_0x314831[_0xb46d('0x49')]=[{'all':!![]}];}_0x314831=_[_0xb46d('0x40')]({},_0x314831,_0xf54fd[_0xb46d('0x4a')]);return db[_0xb46d('0x2f')][_0xb46d('0x4b')](_0x314831)[_0xb46d('0x28')](handleEntityNotFound(_0xf6ef35,null))[_0xb46d('0x28')](respondWithResult(_0xf6ef35,null))['catch'](handleError(_0xf6ef35,null));};exports['create']=function(_0x4835bf,_0x34460f){return db[_0xb46d('0x2f')][_0xb46d('0x4c')](_0x4835bf['body'],{})[_0xb46d('0x28')](respondWithResult(_0x34460f,0xc9))['catch'](handleError(_0x34460f,null));};exports['update']=function(_0x2397fe,_0x23907b){if(_0x2397fe[_0xb46d('0x4d')]['id']){delete _0x2397fe['body']['id'];}return db[_0xb46d('0x2f')][_0xb46d('0x4b')]({'where':{'id':_0x2397fe[_0xb46d('0x46')]['id']}})[_0xb46d('0x28')](handleEntityNotFound(_0x23907b,null))['then'](saveUpdates(_0x2397fe[_0xb46d('0x4d')],null))[_0xb46d('0x28')](respondWithResult(_0x23907b,null))[_0xb46d('0x44')](handleError(_0x23907b,null));};exports[_0xb46d('0x4e')]=function(_0x57d1b9,_0x1932a8){return db[_0xb46d('0x2f')][_0xb46d('0x4b')]({'where':{'id':_0x57d1b9['params']['id']}})[_0xb46d('0x28')](handleEntityNotFound(_0x1932a8,null))['then'](removeEntity(_0x1932a8,null))['catch'](handleError(_0x1932a8,null));};exports[_0xb46d('0x4f')]=function(_0xa06248,_0xaa2998,_0x41902b){return db[_0xb46d('0x50')][_0xb46d('0x4b')]({'where':{'id':_0xa06248[_0xb46d('0x46')]['id']}})[_0xb46d('0x28')](handleEntityNotFound(_0xaa2998,null))[_0xb46d('0x28')](function(_0x30dba4){if(_0x30dba4){return _0x30dba4[_0xb46d('0x4f')](_0xa06248['body']['ids'],_[_0xb46d('0x51')](_0xa06248[_0xb46d('0x4d')],[_0xb46d('0x52'),'id'])||{});}})[_0xb46d('0x28')](respondWithResult(_0xaa2998,null))[_0xb46d('0x44')](handleError(_0xaa2998,null));};exports[_0xb46d('0x53')]=function(_0x51206a,_0xd341e7,_0x576d63){var _0x30f9ed={};var _0x5c957b={};var _0x8238fe;var _0x1b4086;return db[_0xb46d('0x2f')]['findOne']({'where':{'id':_0x51206a[_0xb46d('0x46')]['id']}})[_0xb46d('0x28')](handleEntityNotFound(_0xd341e7,null))[_0xb46d('0x28')](function(_0x37fc39){if(_0x37fc39){_0x8238fe=_0x37fc39;_0x5c957b[_0xb46d('0x33')]=_[_0xb46d('0x47')](db[_0xb46d('0x50')][_0xb46d('0x48')]);_0x5c957b[_0xb46d('0x34')]=_[_0xb46d('0x47')](_0x51206a[_0xb46d('0x34')]);_0x5c957b['filters']=_[_0xb46d('0x36')](_0x5c957b['model'],_0x5c957b[_0xb46d('0x34')]);_0x30f9ed[_0xb46d('0x37')]=_[_0xb46d('0x36')](_0x5c957b[_0xb46d('0x33')],qs[_0xb46d('0x38')](_0x51206a[_0xb46d('0x34')]['fields']));_0x30f9ed[_0xb46d('0x37')]=_0x30f9ed[_0xb46d('0x37')][_0xb46d('0x39')]?_0x30f9ed[_0xb46d('0x37')]:_0x5c957b[_0xb46d('0x33')];_0x30f9ed[_0xb46d('0x3b')]=qs[_0xb46d('0x3c')](_0x51206a[_0xb46d('0x34')]['sort']);_0x30f9ed[_0xb46d('0x3d')]=qs[_0xb46d('0x35')](_[_0xb46d('0x3e')](_0x51206a[_0xb46d('0x34')],_0x5c957b[_0xb46d('0x35')]));if(_0x51206a[_0xb46d('0x34')][_0xb46d('0x3f')]){_0x30f9ed[_0xb46d('0x3d')]=_['merge'](_0x30f9ed[_0xb46d('0x3d')],{'$or':_[_0xb46d('0x2e')](_0x30f9ed['attributes'],function(_0xd6b36c){var _0x4ccc0f={};_0x4ccc0f[_0xd6b36c]={'$like':'%'+_0x51206a['query'][_0xb46d('0x3f')]+'%'};return _0x4ccc0f;})});}_0x30f9ed=_['merge']({},_0x30f9ed,_0x51206a['options']);return _0x8238fe['getConditions'](_0x30f9ed);}})[_0xb46d('0x28')](function(_0x539d6c){if(_0x539d6c){_0x1b4086=_0x539d6c[_0xb46d('0x39')];if(!_0x51206a[_0xb46d('0x34')]['hasOwnProperty'](_0xb46d('0x54'))){_0x30f9ed[_0xb46d('0x21')]=qs['limit'](_0x51206a[_0xb46d('0x34')]['limit']);_0x30f9ed[_0xb46d('0x1f')]=qs[_0xb46d('0x1f')](_0x51206a[_0xb46d('0x34')][_0xb46d('0x1f')]);}return _0x8238fe[_0xb46d('0x53')](_0x30f9ed);}})['then'](function(_0x20ddfd){if(_0x20ddfd){return _0x20ddfd?{'count':_0x1b4086,'rows':_0x20ddfd}:null;}})[_0xb46d('0x28')](respondWithResult(_0xd341e7,null))[_0xb46d('0x44')](handleError(_0xd341e7,null));};exports[_0xb46d('0x55')]=function(_0x21a932,_0x582775,_0x59918d){return db[_0xb46d('0x56')]['find']({'where':{'id':_0x21a932[_0xb46d('0x46')]['id']}})[_0xb46d('0x28')](handleEntityNotFound(_0x582775,null))[_0xb46d('0x28')](function(_0x27385d){if(_0x27385d){return _0x27385d['addActions'](_0x21a932[_0xb46d('0x4d')][_0xb46d('0x52')],_['omit'](_0x21a932[_0xb46d('0x4d')],[_0xb46d('0x52'),'id'])||{});}})[_0xb46d('0x28')](respondWithResult(_0x582775,null))[_0xb46d('0x44')](handleError(_0x582775,null));};exports[_0xb46d('0x57')]=function(_0x16c54f,_0x5b1820,_0x3867cd){var _0x1373cb={};var _0x278e36={};var _0x122859;var _0x4e8209;return db['Automation'][_0xb46d('0x58')]({'where':{'id':_0x16c54f['params']['id']}})[_0xb46d('0x28')](handleEntityNotFound(_0x5b1820,null))[_0xb46d('0x28')](function(_0x1b8ac0){if(_0x1b8ac0){_0x122859=_0x1b8ac0;_0x278e36['model']=_['keys'](db[_0xb46d('0x56')][_0xb46d('0x48')]);_0x278e36[_0xb46d('0x34')]=_[_0xb46d('0x47')](_0x16c54f['query']);_0x278e36[_0xb46d('0x35')]=_['intersection'](_0x278e36[_0xb46d('0x33')],_0x278e36[_0xb46d('0x34')]);_0x1373cb[_0xb46d('0x37')]=_[_0xb46d('0x36')](_0x278e36[_0xb46d('0x33')],qs[_0xb46d('0x38')](_0x16c54f['query'][_0xb46d('0x38')]));_0x1373cb[_0xb46d('0x37')]=_0x1373cb['attributes'][_0xb46d('0x39')]?_0x1373cb['attributes']:_0x278e36[_0xb46d('0x33')];_0x1373cb['order']=qs['sort'](_0x16c54f[_0xb46d('0x34')][_0xb46d('0x3c')]);_0x1373cb[_0xb46d('0x3d')]=qs[_0xb46d('0x35')](_[_0xb46d('0x3e')](_0x16c54f[_0xb46d('0x34')],_0x278e36[_0xb46d('0x35')]));if(_0x16c54f[_0xb46d('0x34')]['filter']){_0x1373cb[_0xb46d('0x3d')]=_['merge'](_0x1373cb['where'],{'$or':_[_0xb46d('0x2e')](_0x1373cb[_0xb46d('0x37')],function(_0x3a5457){var _0x29c895={};_0x29c895[_0x3a5457]={'$like':'%'+_0x16c54f[_0xb46d('0x34')][_0xb46d('0x3f')]+'%'};return _0x29c895;})});}_0x1373cb=_[_0xb46d('0x40')]({},_0x1373cb,_0x16c54f['options']);return _0x122859[_0xb46d('0x57')](_0x1373cb);}})[_0xb46d('0x28')](function(_0x47779f){if(_0x47779f){_0x4e8209=_0x47779f['length'];if(!_0x16c54f[_0xb46d('0x34')]['hasOwnProperty'](_0xb46d('0x54'))){_0x1373cb[_0xb46d('0x21')]=qs[_0xb46d('0x21')](_0x16c54f[_0xb46d('0x34')][_0xb46d('0x21')]);_0x1373cb[_0xb46d('0x1f')]=qs[_0xb46d('0x1f')](_0x16c54f[_0xb46d('0x34')]['offset']);}return _0x122859[_0xb46d('0x57')](_0x1373cb);}})[_0xb46d('0x28')](function(_0x124ac5){if(_0x124ac5){return _0x124ac5?{'count':_0x4e8209,'rows':_0x124ac5}:null;}})[_0xb46d('0x28')](respondWithResult(_0x5b1820,null))['catch'](handleError(_0x5b1820,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 82830d6..f905cab 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 _0xc7c9=['../../config/environment','./automation.attributes','define','Automation','tools_automations','lodash','../../config/logger','moment','bluebird','rimraf'];(function(_0x38ed42,_0x3d9a37){var _0x474931=function(_0x1fa601){while(--_0x1fa601){_0x38ed42['push'](_0x38ed42['shift']());}};_0x474931(++_0x3d9a37);}(_0xc7c9,0x159));var _0x9c7c=function(_0x249c30,_0x190df1){_0x249c30=_0x249c30-0x0;var _0x25c6a5=_0xc7c9[_0x249c30];return _0x25c6a5;};'use strict';var _=require(_0x9c7c('0x0'));var util=require('util');var logger=require(_0x9c7c('0x1'))('api');var moment=require(_0x9c7c('0x2'));var BPromise=require(_0x9c7c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9c7c('0x4'));var config=require(_0x9c7c('0x5'));var attributes=require(_0x9c7c('0x6'));module['exports']=function(_0x59a3f7,_0x591420){return _0x59a3f7[_0x9c7c('0x7')](_0x9c7c('0x8'),attributes,{'tableName':_0x9c7c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6df=['../../config/logger','api','moment','bluebird','path','./automation.attributes','define','Automation','tools_automations','lodash','util'];(function(_0x4fe3e2,_0xd96286){var _0x686c14=function(_0x48aa01){while(--_0x48aa01){_0x4fe3e2['push'](_0x4fe3e2['shift']());}};_0x686c14(++_0xd96286);}(_0xd6df,0x195));var _0xfd6d=function(_0x5c3f1b,_0x3d36fd){_0x5c3f1b=_0x5c3f1b-0x0;var _0x1088b6=_0xd6df[_0x5c3f1b];return _0x1088b6;};'use strict';var _=require(_0xfd6d('0x0'));var util=require(_0xfd6d('0x1'));var logger=require(_0xfd6d('0x2'))(_0xfd6d('0x3'));var moment=require(_0xfd6d('0x4'));var BPromise=require(_0xfd6d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd6d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfd6d('0x7'));module['exports']=function(_0x5bb0a5,_0x5eae7e){return _0x5bb0a5[_0xfd6d('0x8')](_0xfd6d('0x9'),attributes,{'tableName':_0xfd6d('0xa'),'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 64a62e2..5db5c6e 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 _0x7b77=['debug','stringify','error','code','Automation,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent'];(function(_0x350da6,_0xb920c5){var _0x23e036=function(_0x3f9941){while(--_0x3f9941){_0x350da6['push'](_0x350da6['shift']());}};_0x23e036(++_0xb920c5);}(_0x7b77,0x179));var _0x77b7=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x7b77[_0xfa634c];return _0x73e478;};'use strict';var _=require(_0x77b7('0x0'));var util=require(_0x77b7('0x1'));var moment=require(_0x77b7('0x2'));var BPromise=require(_0x77b7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77b7('0x4'));var db=require(_0x77b7('0x5'))['db'];var utils=require(_0x77b7('0x6'));var logger=require('../../config/logger')(_0x77b7('0x7'));var config=require(_0x77b7('0x8'));var jayson=require(_0x77b7('0x9'));var client=jayson[_0x77b7('0xa')][_0x77b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe3c16b,_0x5c9387,_0x39d8e4){return new BPromise(function(_0x32b8ab,_0x33d439){return client['request'](_0xe3c16b,_0x39d8e4)[_0x77b7('0xc')](function(_0x4cfd3f){logger['info']('Automation,\x20%s,\x20%s',_0x5c9387,_0x77b7('0xd'));logger[_0x77b7('0xe')]('Automation,\x20%s,\x20%s,\x20%s',_0x5c9387,_0x77b7('0xd'),JSON[_0x77b7('0xf')](_0x4cfd3f));if(_0x4cfd3f[_0x77b7('0x10')]){if(_0x4cfd3f[_0x77b7('0x10')][_0x77b7('0x11')]===0x1f4){logger[_0x77b7('0x10')](_0x77b7('0x12'),_0x5c9387,_0x4cfd3f['error'][_0x77b7('0x13')]);return _0x33d439(_0x4cfd3f[_0x77b7('0x10')]['message']);}logger['error']('Automation,\x20%s,\x20%s',_0x5c9387,_0x4cfd3f[_0x77b7('0x10')][_0x77b7('0x13')]);return _0x32b8ab(_0x4cfd3f[_0x77b7('0x10')][_0x77b7('0x13')]);}else{logger[_0x77b7('0x14')](_0x77b7('0x12'),_0x5c9387,'request\x20sent');_0x32b8ab(_0x4cfd3f[_0x77b7('0x15')][_0x77b7('0x13')]);}})[_0x77b7('0x16')](function(_0x2060df){logger[_0x77b7('0x10')](_0x77b7('0x12'),_0x5c9387,_0x2060df);_0x33d439(_0x2060df);});});} \ No newline at end of file +var _0x7033=['client','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x7d36a8,_0x2aefc6){var _0x4505ea=function(_0x2b4c19){while(--_0x2b4c19){_0x7d36a8['push'](_0x7d36a8['shift']());}};_0x4505ea(++_0x2aefc6);}(_0x7033,0x19e));var _0x3703=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7033[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3703('0x0'));var util=require(_0x3703('0x1'));var moment=require(_0x3703('0x2'));var BPromise=require(_0x3703('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3703('0x4'));var db=require(_0x3703('0x5'))['db'];var utils=require(_0x3703('0x6'));var logger=require(_0x3703('0x7'))(_0x3703('0x8'));var config=require(_0x3703('0x9'));var jayson=require(_0x3703('0xa'));var client=jayson[_0x3703('0xb')][_0x3703('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb3a377,_0x49f22c,_0x5df816){return new BPromise(function(_0x4ca371,_0x12c111){return client[_0x3703('0xd')](_0xb3a377,_0x5df816)[_0x3703('0xe')](function(_0x41ba6e){logger[_0x3703('0xf')]('Automation,\x20%s,\x20%s',_0x49f22c,_0x3703('0x10'));logger[_0x3703('0x11')](_0x3703('0x12'),_0x49f22c,'request\x20sent',JSON['stringify'](_0x41ba6e));if(_0x41ba6e[_0x3703('0x13')]){if(_0x41ba6e['error'][_0x3703('0x14')]===0x1f4){logger[_0x3703('0x13')](_0x3703('0x15'),_0x49f22c,_0x41ba6e[_0x3703('0x13')]['message']);return _0x12c111(_0x41ba6e['error'][_0x3703('0x16')]);}logger[_0x3703('0x13')](_0x3703('0x15'),_0x49f22c,_0x41ba6e[_0x3703('0x13')][_0x3703('0x16')]);return _0x4ca371(_0x41ba6e[_0x3703('0x13')][_0x3703('0x16')]);}else{logger[_0x3703('0xf')](_0x3703('0x15'),_0x49f22c,_0x3703('0x10'));_0x4ca371(_0x41ba6e[_0x3703('0x17')][_0x3703('0x16')]);}})[_0x3703('0x18')](function(_0x407b4){logger['error'](_0x3703('0x15'),_0x49f22c,_0x407b4);_0x12c111(_0x407b4);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 7a37e28..53b84b3 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 _0x9d92=['delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','/:id/conditions','getActions','post','addConditions','/:id/actions','update'];(function(_0x2fc31f,_0x489271){var _0x5ec613=function(_0x1cbd82){while(--_0x1cbd82){_0x2fc31f['push'](_0x2fc31f['shift']());}};_0x5ec613(++_0x489271);}(_0x9d92,0xdf));var _0x29d9=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0x9d92[_0x450bf9];return _0x268350;};'use strict';var multer=require(_0x29d9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x29d9('0x1'));var express=require(_0x29d9('0x2'));var router=express['Router']();var fs_extra=require(_0x29d9('0x3'));var auth=require(_0x29d9('0x4'));var interaction=require(_0x29d9('0x5'));var config=require(_0x29d9('0x6'));var controller=require(_0x29d9('0x7'));router[_0x29d9('0x8')]('/',auth[_0x29d9('0x9')](),controller['index']);router[_0x29d9('0x8')](_0x29d9('0xa'),auth[_0x29d9('0x9')](),controller['show']);router[_0x29d9('0x8')](_0x29d9('0xb'),auth[_0x29d9('0x9')](),controller['getConditions']);router['get']('/:id/actions',auth['isAuthenticated'](),controller[_0x29d9('0xc')]);router[_0x29d9('0xd')]('/',auth[_0x29d9('0x9')](),controller['create']);router[_0x29d9('0xd')](_0x29d9('0xb'),auth[_0x29d9('0x9')](),controller[_0x29d9('0xe')]);router['post'](_0x29d9('0xf'),auth['isAuthenticated'](),controller['addActions']);router['put'](_0x29d9('0xa'),auth[_0x29d9('0x9')](),controller[_0x29d9('0x10')]);router[_0x29d9('0x11')]('/:id',auth[_0x29d9('0x9')](),controller[_0x29d9('0x12')]);module[_0x29d9('0x13')]=router; \ No newline at end of file +var _0x1d86=['create','addConditions','addActions','update','delete','destroy','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','/:id','get','/:id/conditions','getConditions','/:id/actions','getActions','post'];(function(_0x3be4c3,_0x744645){var _0x56e78d=function(_0x143567){while(--_0x143567){_0x3be4c3['push'](_0x3be4c3['shift']());}};_0x56e78d(++_0x744645);}(_0x1d86,0x7e));var _0x61d8=function(_0x55e830,_0x415de5){_0x55e830=_0x55e830-0x0;var _0x5dee84=_0x1d86[_0x55e830];return _0x5dee84;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x61d8('0x0'));var express=require('express');var router=express[_0x61d8('0x1')]();var fs_extra=require(_0x61d8('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x61d8('0x3'));var config=require(_0x61d8('0x4'));var controller=require(_0x61d8('0x5'));router['get']('/',auth[_0x61d8('0x6')](),controller['index']);router['get'](_0x61d8('0x7'),auth[_0x61d8('0x6')](),controller['show']);router[_0x61d8('0x8')](_0x61d8('0x9'),auth[_0x61d8('0x6')](),controller[_0x61d8('0xa')]);router[_0x61d8('0x8')](_0x61d8('0xb'),auth[_0x61d8('0x6')](),controller[_0x61d8('0xc')]);router[_0x61d8('0xd')]('/',auth['isAuthenticated'](),controller[_0x61d8('0xe')]);router[_0x61d8('0xd')](_0x61d8('0x9'),auth[_0x61d8('0x6')](),controller[_0x61d8('0xf')]);router[_0x61d8('0xd')](_0x61d8('0xb'),auth[_0x61d8('0x6')](),controller[_0x61d8('0x10')]);router['put'](_0x61d8('0x7'),auth[_0x61d8('0x6')](),controller[_0x61d8('0x11')]);router[_0x61d8('0x12')](_0x61d8('0x7'),auth[_0x61d8('0x6')](),controller[_0x61d8('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 7adeb4d..4d16df6 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 _0xbd15=['#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#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)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence'];(function(_0x922dbd,_0x3c8b97){var _0x1934f5=function(_0x12249d){while(--_0x12249d){_0x922dbd['push'](_0x922dbd['shift']());}};_0x1934f5(++_0x3c8b97);}(_0xbd15,0x178));var _0x5bd1=function(_0x14309b,_0x31003c){_0x14309b=_0x14309b-0x0;var _0x279563=_0xbd15[_0x14309b];return _0x279563;};'use strict';var Sequelize=require(_0x5bd1('0x0'));module[_0x5bd1('0x1')]={'name':{'type':Sequelize[_0x5bd1('0x2')],'unique':_0x5bd1('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5bd1('0x4')](_0x5bd1('0x5')),'allowNull':![],'defaultValue':_0x5bd1('0x5')},'description':{'type':Sequelize[_0x5bd1('0x2')]},'active':{'type':Sequelize[_0x5bd1('0x6')],'defaultValue':0x0,'comment':_0x5bd1('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x5bd1('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x5bd1('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x5bd1('0x9')](0x3)[_0x5bd1('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5bd1('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5bd1('0x9')](0x3)[_0x5bd1('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5bd1('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5bd1('0x9')](0x5)[_0x5bd1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5bd1('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x5bd1('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x5bd1('0x9')](0x5)[_0x5bd1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5bd1('0x9')](0x3)[_0x5bd1('0x8')],'defaultValue':0x3,'comment':_0x5bd1('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5bd1('0x9')](0x5)[_0x5bd1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5bd1('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5bd1('0x9')](0x3)[_0x5bd1('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5bd1('0xf')},'dialTimezone':{'type':Sequelize[_0x5bd1('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5bd1('0x2')],'defaultValue':_0x5bd1('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x5bd1('0x4')](_0x5bd1('0x11'),_0x5bd1('0x12'),_0x5bd1('0x13')),'defaultValue':_0x5bd1('0x11')},'dialAMDActive':{'type':Sequelize[_0x5bd1('0x6')],'defaultValue':0x0,'comment':_0x5bd1('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x5bd1('0x9')](0x9)[_0x5bd1('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5bd1('0x15')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x5bd1('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5bd1('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5bd1('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5bd1('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x5bd1('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5bd1('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x5bd1('0x9')](0x9)[_0x5bd1('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5bd1('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5bd1('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5bd1('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5bd1('0x9')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5bd1('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5bd1('0x9')](0x5)[_0x5bd1('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5bd1('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5bd1('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5bd1('0x4')](_0x5bd1('0x1d'),_0x5bd1('0x1e')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x5bd1('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5bd1('0x9')](0x3)[_0x5bd1('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x5bd1('0x9')](0x3)[_0x5bd1('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5bd1('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5bd1('0x9')](0x3)[_0x5bd1('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5bd1('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5bd1('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5bd1('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0x5bd1('0x9')](0x3)[_0x5bd1('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5bd1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5bd1('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5bd1('0x9')](0x3)[_0x5bd1('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5bd1('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5bd1('0x9')](0x5)[_0x5bd1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5bd1('0x24')},'dialMachineMaxRetry':{'type':Sequelize[_0x5bd1('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5bd1('0x25')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5bd1('0x9')](0x5)[_0x5bd1('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5bd1('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5bd1('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5bd1('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5bd1('0x27')}}; \ No newline at end of file +var _0x1f29=['Active/Disactive\x20Campaign','INTEGER','UNSIGNED','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\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','name','ENUM','ivr','STRING','BOOLEAN'];(function(_0x28adad,_0x1865d5){var _0x36854c=function(_0x30ce52){while(--_0x30ce52){_0x28adad['push'](_0x28adad['shift']());}};_0x36854c(++_0x1865d5);}(_0x1f29,0x170));var _0x91f2=function(_0x5ab1f9,_0x2a6cbe){_0x5ab1f9=_0x5ab1f9-0x0;var _0x43e10e=_0x1f29[_0x5ab1f9];return _0x43e10e;};'use strict';var Sequelize=require(_0x91f2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x91f2('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x91f2('0x2')](_0x91f2('0x3')),'allowNull':![],'defaultValue':_0x91f2('0x3')},'description':{'type':Sequelize[_0x91f2('0x4')]},'active':{'type':Sequelize[_0x91f2('0x5')],'defaultValue':0x0,'comment':_0x91f2('0x6')},'limitCalls':{'type':Sequelize[_0x91f2('0x7')](0x4)[_0x91f2('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x91f2('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x91f2('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x91f2('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x91f2('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x91f2('0x7')](0x3)[_0x91f2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x91f2('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x91f2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x91f2('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x91f2('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x91f2('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x91f2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x91f2('0x7')](0x3)[_0x91f2('0x8')],'defaultValue':0x3,'comment':_0x91f2('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x91f2('0x7')](0x5)[_0x91f2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x91f2('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x91f2('0x7')](0x3)[_0x91f2('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x91f2('0xf')},'dialTimezone':{'type':Sequelize[_0x91f2('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x91f2('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x91f2('0x2')](_0x91f2('0x10'),'never',_0x91f2('0x11')),'defaultValue':_0x91f2('0x10')},'dialAMDActive':{'type':Sequelize[_0x91f2('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x91f2('0x7')](0x9)[_0x91f2('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x91f2('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x91f2('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x91f2('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x91f2('0x7')](0x9)[_0x91f2('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x91f2('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x91f2('0x14')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x91f2('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x91f2('0x7')](0x9)[_0x91f2('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x91f2('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x91f2('0x15')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x91f2('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x91f2('0x7')](0x9)[_0x91f2('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x91f2('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0x91f2('0x2')]('DESC',_0x91f2('0x18')),'defaultValue':_0x91f2('0x19')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x91f2('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x91f2('0x1a')},'dialCutDigit':{'type':Sequelize[_0x91f2('0x7')](0x3)[_0x91f2('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x91f2('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x91f2('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x91f2('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x91f2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x91f2('0x1d')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x91f2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x91f2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x91f2('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x91f2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x91f2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x91f2('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x91f2('0x7')](0x5)[_0x91f2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x91f2('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x91f2('0x7')](0x3)[_0x91f2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x91f2('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x91f2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 44ec57f..cf4c839 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 _0xd83d=['zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','IvrCampaigns','end','error','stack','name','index','map','Campaign','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','rawAttributes','omit','createdAt','updatedAt','update','destroy','getHoppers','findOne','nolimit','order','sort','CampaignId','CmHopper','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','cm_hopper','onlyIfOpen','CmListId','COALESCE(phone,\x27\x27)','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd83d,0x115));var _0xdd83=function(_0x446977,_0x2f6332){_0x446977=_0x446977-0x0;var _0x16e3f5=_0xd83d[_0x446977];return _0x16e3f5;};'use strict';var emlformat=require(_0xdd83('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd83('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd83('0x2'));var moment=require(_0xdd83('0x3'));var BPromise=require(_0xdd83('0x4'));var Mustache=require('mustache');var util=require(_0xdd83('0x5'));var path=require(_0xdd83('0x6'));var sox=require(_0xdd83('0x7'));var csv=require(_0xdd83('0x8'));var ejs=require(_0xdd83('0x9'));var fs=require('fs');var fs_extra=require(_0xdd83('0xa'));var _=require(_0xdd83('0xb'));var squel=require(_0xdd83('0xc'));var crypto=require(_0xdd83('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdd83('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdd83('0xf'));var Papa=require(_0xdd83('0x10'));var Redis=require(_0xdd83('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdd83('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd83('0x13'));var logger=require(_0xdd83('0x14'))(_0xdd83('0x15'));var utils=require(_0xdd83('0x16'));var config=require(_0xdd83('0x17'));var licenseUtil=require(_0xdd83('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c186c,_0x30aea3){_0x30aea3=_0x30aea3||0xcc;return function(_0x2cb8ab){if(_0x2cb8ab){return _0x3c186c[_0xdd83('0x19')](_0x30aea3);}return _0x3c186c[_0xdd83('0x1a')](_0x30aea3)['end']();};}function respondWithResult(_0x402965,_0x34f1b5){_0x34f1b5=_0x34f1b5||0xc8;return function(_0x3fcd95){if(_0x3fcd95){return _0x402965['status'](_0x34f1b5)[_0xdd83('0x1b')](_0x3fcd95);}};}function respondWithFilteredResult(_0x173868,_0x3beb9b){return function(_0xff347b){if(_0xff347b){var _0x30455a=typeof _0x3beb9b[_0xdd83('0x1c')]===_0xdd83('0x1d')&&typeof _0x3beb9b[_0xdd83('0x1e')]===_0xdd83('0x1d');var _0x7c31f5=_0xff347b[_0xdd83('0x1f')];var _0x3d48aa=_0x30455a?0x0:_0x3beb9b[_0xdd83('0x1c')];var _0x4755b7=_0x30455a?_0xff347b[_0xdd83('0x1f')]:_0x3beb9b[_0xdd83('0x1c')]+_0x3beb9b[_0xdd83('0x1e')];var _0x518155;if(_0x4755b7>=_0x7c31f5){_0x4755b7=_0x7c31f5;_0x518155=0xc8;}else{_0x518155=0xce;}_0x173868[_0xdd83('0x1a')](_0x518155);return _0x173868[_0xdd83('0x20')](_0xdd83('0x21'),_0x3d48aa+'-'+_0x4755b7+'/'+_0x7c31f5)['json'](_0xff347b);}return null;};}function patchUpdates(_0x52d7e3){return function(_0x312809){try{jsonpatch[_0xdd83('0x22')](_0x312809,_0x52d7e3,!![]);}catch(_0x466dd4){return BPromise[_0xdd83('0x23')](_0x466dd4);}return _0x312809[_0xdd83('0x24')]();};}function saveUpdates(_0x49532a,_0x1cf57a){return function(_0x28693f){if(_0x28693f){return _0x28693f['update'](_0x49532a)[_0xdd83('0x25')](function(_0x1e5de4){return _0x1e5de4;});}return null;};}function removeEntity(_0x2ad78b,_0xd83802){return function(_0x27a74a){if(_0x27a74a){return _0x27a74a['destroy']()['then'](function(){var _0x26f59c=_0x27a74a[_0xdd83('0x26')]({'plain':!![]});var _0x3fccf1=_0xdd83('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x3fccf1,'resourceId':_0x26f59c['id']}})[_0xdd83('0x25')](function(){return _0x27a74a;});})[_0xdd83('0x25')](function(){_0x2ad78b['status'](0xcc)[_0xdd83('0x28')]();});}};}function handleEntityNotFound(_0x3e20fa,_0x3fac7c){return function(_0x472982){if(!_0x472982){_0x3e20fa[_0xdd83('0x19')](0x194);}return _0x472982;};}function handleError(_0x5b2b15,_0xd0d4c2){_0xd0d4c2=_0xd0d4c2||0x1f4;return function(_0x318a81){logger[_0xdd83('0x29')](_0x318a81[_0xdd83('0x2a')]);if(_0x318a81[_0xdd83('0x2b')]){delete _0x318a81['name'];}_0x5b2b15[_0xdd83('0x1a')](_0xd0d4c2)['send'](_0x318a81);};}exports[_0xdd83('0x2c')]=function(_0x5c4efc,_0x54d367){var _0x4e9499={},_0x5edb58={},_0x3dd052={'count':0x0,'rows':[]};var _0x51120b=_[_0xdd83('0x2d')](db[_0xdd83('0x2e')]['rawAttributes'],function(_0x195ed4){return{'name':_0x195ed4[_0xdd83('0x2f')],'type':_0x195ed4[_0xdd83('0x30')]['key']};});_0x5edb58[_0xdd83('0x31')]=_[_0xdd83('0x2d')](_0x51120b,_0xdd83('0x2b'));_0x5edb58[_0xdd83('0x32')]=_[_0xdd83('0x33')](_0x5c4efc[_0xdd83('0x32')]);_0x5edb58[_0xdd83('0x34')]=_[_0xdd83('0x35')](_0x5edb58[_0xdd83('0x31')],_0x5edb58['query']);_0x4e9499[_0xdd83('0x36')]=_[_0xdd83('0x35')](_0x5edb58[_0xdd83('0x31')],qs[_0xdd83('0x37')](_0x5c4efc[_0xdd83('0x32')][_0xdd83('0x37')]));_0x4e9499[_0xdd83('0x36')]=_0x4e9499[_0xdd83('0x36')][_0xdd83('0x38')]?_0x4e9499[_0xdd83('0x36')]:_0x5edb58[_0xdd83('0x31')];if(!_0x5c4efc[_0xdd83('0x32')][_0xdd83('0x39')]('nolimit')){_0x4e9499['limit']=qs['limit'](_0x5c4efc[_0xdd83('0x32')][_0xdd83('0x1e')]);_0x4e9499[_0xdd83('0x1c')]=qs[_0xdd83('0x1c')](_0x5c4efc[_0xdd83('0x32')][_0xdd83('0x1c')]);}_0x4e9499['order']=qs['sort'](_0x5c4efc['query']['sort']);_0x4e9499[_0xdd83('0x3a')]=qs[_0xdd83('0x34')](_[_0xdd83('0x3b')](_0x5c4efc[_0xdd83('0x32')],_0x5edb58[_0xdd83('0x34')]),_0x51120b);if(_0x5c4efc[_0xdd83('0x32')][_0xdd83('0x3c')]){_0x4e9499['where']=_[_0xdd83('0x3d')](_0x4e9499[_0xdd83('0x3a')],{'$or':_[_0xdd83('0x2d')](_0x51120b,function(_0x2d7cd1){if(_0x2d7cd1['type']!==_0xdd83('0x3e')){var _0x533e97={};_0x533e97[_0x2d7cd1[_0xdd83('0x2b')]]={'$like':'%'+_0x5c4efc['query']['filter']+'%'};return _0x533e97;}})});}_0x4e9499=_[_0xdd83('0x3d')]({},_0x4e9499,_0x5c4efc[_0xdd83('0x3f')]);var _0x36b6b8={'where':_0x4e9499[_0xdd83('0x3a')]};return db[_0xdd83('0x2e')]['count'](_0x36b6b8)[_0xdd83('0x25')](function(_0x460758){_0x3dd052[_0xdd83('0x1f')]=_0x460758;if(_0x5c4efc[_0xdd83('0x32')][_0xdd83('0x40')]){_0x4e9499[_0xdd83('0x41')]=[{'all':!![]}];}return db['Campaign'][_0xdd83('0x42')](_0x4e9499);})[_0xdd83('0x25')](function(_0x16e429){_0x3dd052[_0xdd83('0x43')]=_0x16e429;return _0x3dd052;})['then'](respondWithFilteredResult(_0x54d367,_0x4e9499))[_0xdd83('0x44')](handleError(_0x54d367,null));};exports[_0xdd83('0x45')]=function(_0x9df78d,_0x387bd3){var _0x2e9eca={'raw':![],'where':{'id':_0x9df78d['params']['id']}},_0x27a5c6={};_0x27a5c6['model']=_[_0xdd83('0x33')](db[_0xdd83('0x2e')]['rawAttributes']);_0x27a5c6[_0xdd83('0x32')]=_[_0xdd83('0x33')](_0x9df78d[_0xdd83('0x32')]);_0x27a5c6[_0xdd83('0x34')]=_['intersection'](_0x27a5c6[_0xdd83('0x31')],_0x27a5c6['query']);_0x2e9eca['attributes']=_[_0xdd83('0x35')](_0x27a5c6[_0xdd83('0x31')],qs[_0xdd83('0x37')](_0x9df78d[_0xdd83('0x32')]['fields']));_0x2e9eca['attributes']=_0x2e9eca['attributes'][_0xdd83('0x38')]?_0x2e9eca[_0xdd83('0x36')]:_0x27a5c6[_0xdd83('0x31')];if(_0x9df78d[_0xdd83('0x32')]['includeAll']){_0x2e9eca[_0xdd83('0x41')]=[{'all':!![]}];}_0x2e9eca=_[_0xdd83('0x3d')]({},_0x2e9eca,_0x9df78d[_0xdd83('0x3f')]);return db[_0xdd83('0x2e')][_0xdd83('0x46')](_0x2e9eca)[_0xdd83('0x25')](handleEntityNotFound(_0x387bd3,null))[_0xdd83('0x25')](respondWithResult(_0x387bd3,null))[_0xdd83('0x44')](handleError(_0x387bd3,null));};exports[_0xdd83('0x47')]=function(_0x42c2b7,_0x143dd1){return db['Campaign']['create'](_0x42c2b7[_0xdd83('0x48')],{})[_0xdd83('0x25')](function(_0x1a1182){var _0x46da8d=_0x42c2b7[_0xdd83('0x49')]['get']({'plain':!![]});if(!_0x46da8d)throw new Error(_0xdd83('0x4a'));if(_0x46da8d[_0xdd83('0x4b')]===_0xdd83('0x49')){var _0x5f53a8=_0x1a1182[_0xdd83('0x26')]({'plain':!![]});var _0x3131c0=_0xdd83('0x27');return db[_0xdd83('0x4c')][_0xdd83('0x46')]({'where':{'name':_0x3131c0,'userProfileId':_0x46da8d[_0xdd83('0x4d')]},'raw':!![]})[_0xdd83('0x25')](function(_0x13a062){if(_0x13a062&&_0x13a062[_0xdd83('0x4e')]===0x0){return db['UserProfileResource'][_0xdd83('0x47')]({'name':_0x5f53a8[_0xdd83('0x2b')],'resourceId':_0x5f53a8['id'],'type':_0x13a062[_0xdd83('0x2b')],'sectionId':_0x13a062['id']},{})[_0xdd83('0x25')](function(){return _0x1a1182;});}else{return _0x1a1182;}})[_0xdd83('0x44')](function(_0x4b86b9){logger[_0xdd83('0x29')](_0xdd83('0x4f'),_0x4b86b9);throw _0x4b86b9;});}return _0x1a1182;})[_0xdd83('0x25')](respondWithResult(_0x143dd1,0xc9))[_0xdd83('0x44')](handleError(_0x143dd1,null));};exports[_0xdd83('0x50')]=function(_0x44e594,_0x1949f2){var _0x41ac4d={'where':{'id':_0x44e594[_0xdd83('0x51')]['id']}},_0x21689b={};_0x21689b[_0xdd83('0x31')]=_[_0xdd83('0x33')](db[_0xdd83('0x2e')][_0xdd83('0x52')]);_0x41ac4d[_0xdd83('0x36')]=_['intersection'](_0x21689b[_0xdd83('0x31')],qs['fields'](_0x44e594[_0xdd83('0x32')]['fields']));_0x41ac4d[_0xdd83('0x36')]=_0x41ac4d[_0xdd83('0x36')][_0xdd83('0x38')]?_0x41ac4d[_0xdd83('0x36')]:_0x21689b[_0xdd83('0x31')];if(_0x44e594[_0xdd83('0x32')][_0xdd83('0x40')]){_0x41ac4d['include']=[{'all':!![]}];}_0x41ac4d=_[_0xdd83('0x3d')]({},_0x41ac4d,_0x44e594['options']);return db[_0xdd83('0x2e')]['find'](_0x41ac4d)[_0xdd83('0x25')](handleEntityNotFound(_0x1949f2,null))[_0xdd83('0x25')](function(_0x52dce9){if(_0x52dce9){var _0x3e8244=_0x52dce9[_0xdd83('0x26')]({'plain':!![]});_0x3e8244=qs[_0xdd83('0x53')](_0x3e8244,['id',_0xdd83('0x54'),_0xdd83('0x55')]);_0x44e594[_0xdd83('0x48')]=_[_0xdd83('0x53')](_0x44e594[_0xdd83('0x48')],['id',_0xdd83('0x54'),_0xdd83('0x55')]);return db[_0xdd83('0x2e')]['create'](_[_0xdd83('0x3d')](_0x3e8244,_0x44e594['body']),{'include':_0x44e594['query'][_0xdd83('0x40')]?[{'all':!![]}]:undefined})[_0xdd83('0x25')](function(_0x19288f){var _0x34191f=_0x44e594[_0xdd83('0x49')][_0xdd83('0x26')]({'plain':!![]});if(!_0x34191f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34191f[_0xdd83('0x4b')]===_0xdd83('0x49')){var _0x2c2671=_0x19288f[_0xdd83('0x26')]({'plain':!![]});var _0x5da6c5=_0xdd83('0x27');return db[_0xdd83('0x4c')][_0xdd83('0x46')]({'where':{'name':_0x5da6c5,'userProfileId':_0x34191f['userProfileId']},'raw':!![]})[_0xdd83('0x25')](function(_0x496f08){if(_0x496f08&&_0x496f08['autoAssociation']===0x0){return db['UserProfileResource'][_0xdd83('0x47')]({'name':_0x2c2671['name'],'resourceId':_0x2c2671['id'],'type':_0x496f08[_0xdd83('0x2b')],'sectionId':_0x496f08['id']},{})[_0xdd83('0x25')](function(){return _0x19288f;});}else{return _0x19288f;}})[_0xdd83('0x44')](function(_0x3714e8){logger[_0xdd83('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3714e8);throw _0x3714e8;});}return _0x19288f;});}})['then'](respondWithResult(_0x1949f2,0xc9))[_0xdd83('0x44')](handleError(_0x1949f2,null));};exports[_0xdd83('0x56')]=function(_0x3f501e,_0x10d79d){if(_0x3f501e[_0xdd83('0x48')]['id']){delete _0x3f501e[_0xdd83('0x48')]['id'];}return db['Campaign'][_0xdd83('0x46')]({'where':{'id':_0x3f501e['params']['id']}})['then'](handleEntityNotFound(_0x10d79d,null))['then'](saveUpdates(_0x3f501e[_0xdd83('0x48')],null))[_0xdd83('0x25')](respondWithResult(_0x10d79d,null))[_0xdd83('0x44')](handleError(_0x10d79d,null));};exports[_0xdd83('0x57')]=function(_0x1333aa,_0x41e35c){return db[_0xdd83('0x2e')][_0xdd83('0x46')]({'where':{'id':_0x1333aa['params']['id']}})[_0xdd83('0x25')](handleEntityNotFound(_0x41e35c,null))[_0xdd83('0x25')](removeEntity(_0x41e35c,null))[_0xdd83('0x44')](handleError(_0x41e35c,null));};exports[_0xdd83('0x58')]=function(_0xeed29a,_0x2b3bc2,_0x34b19c){var _0x15a444={'raw':!![],'where':{}};var _0x529ad9={};var _0x48e25a={'count':0x0,'rows':[]};return db[_0xdd83('0x2e')][_0xdd83('0x59')]({'where':{'id':_0xeed29a[_0xdd83('0x51')]['id']}})[_0xdd83('0x25')](handleEntityNotFound(_0x2b3bc2,null))[_0xdd83('0x25')](function(_0x4035a9){if(_0x4035a9){_0x529ad9[_0xdd83('0x31')]=_['keys'](db['CmHopper'][_0xdd83('0x52')]);_0x529ad9[_0xdd83('0x32')]=_[_0xdd83('0x33')](_0xeed29a[_0xdd83('0x32')]);_0x529ad9[_0xdd83('0x34')]=_[_0xdd83('0x35')](_0x529ad9[_0xdd83('0x31')],_0x529ad9['query']);_0x15a444[_0xdd83('0x36')]=_[_0xdd83('0x35')](_0x529ad9[_0xdd83('0x31')],qs['fields'](_0xeed29a[_0xdd83('0x32')][_0xdd83('0x37')]));_0x15a444['attributes']=_0x15a444[_0xdd83('0x36')]['length']?_0x15a444['attributes']:_0x529ad9['model'];if(!_0xeed29a[_0xdd83('0x32')][_0xdd83('0x39')](_0xdd83('0x5a'))){_0x15a444[_0xdd83('0x1e')]=qs[_0xdd83('0x1e')](_0xeed29a[_0xdd83('0x32')][_0xdd83('0x1e')]);_0x15a444[_0xdd83('0x1c')]=qs['offset'](_0xeed29a[_0xdd83('0x32')][_0xdd83('0x1c')]);}_0x15a444[_0xdd83('0x5b')]=qs['sort'](_0xeed29a[_0xdd83('0x32')][_0xdd83('0x5c')]);_0x15a444[_0xdd83('0x3a')]=qs[_0xdd83('0x34')](_[_0xdd83('0x3b')](_0xeed29a[_0xdd83('0x32')],_0x529ad9[_0xdd83('0x34')]));_0x15a444['where'][_0xdd83('0x5d')]=_0x4035a9['id'];if(_0xeed29a[_0xdd83('0x32')][_0xdd83('0x3c')]){_0x15a444[_0xdd83('0x3a')]=_[_0xdd83('0x3d')](_0x15a444['where'],{'$or':_[_0xdd83('0x2d')](_0x15a444[_0xdd83('0x36')],function(_0x4d928d){var _0xb8a8a6={};_0xb8a8a6[_0x4d928d]={'$like':'%'+_0xeed29a['query'][_0xdd83('0x3c')]+'%'};return _0xb8a8a6;})});}_0x15a444=_[_0xdd83('0x3d')]({},_0x15a444,_0xeed29a['options']);return db[_0xdd83('0x5e')][_0xdd83('0x1f')]({'where':_0x15a444[_0xdd83('0x3a')]})['then'](function(_0x48a03c){_0x48e25a['count']=_0x48a03c;if(_0xeed29a['query']['includeAll']){_0x15a444[_0xdd83('0x41')]=[{'all':!![]}];}return db[_0xdd83('0x5e')][_0xdd83('0x42')](_0x15a444);})[_0xdd83('0x25')](function(_0x501661){_0x48e25a[_0xdd83('0x43')]=_0x501661;return _0x48e25a;});}})['then'](respondWithFilteredResult(_0x2b3bc2,_0x15a444))[_0xdd83('0x44')](handleError(_0x2b3bc2,null));};exports['getHopperHistories']=function(_0x107cd8,_0x278dfb,_0x8d2e0e){var _0x143a04={'raw':!![],'where':{}};var _0x340aaf={};var _0x1b461d={'count':0x0,'rows':[]};return db[_0xdd83('0x2e')][_0xdd83('0x59')]({'where':{'id':_0x107cd8['params']['id']}})[_0xdd83('0x25')](handleEntityNotFound(_0x278dfb,null))[_0xdd83('0x25')](function(_0x48f78c){if(_0x48f78c){_0x340aaf[_0xdd83('0x31')]=_['keys'](db[_0xdd83('0x5f')][_0xdd83('0x52')]);_0x340aaf[_0xdd83('0x32')]=_[_0xdd83('0x33')](_0x107cd8[_0xdd83('0x32')]);_0x340aaf['filters']=_[_0xdd83('0x35')](_0x340aaf[_0xdd83('0x31')],_0x340aaf[_0xdd83('0x32')]);_0x143a04[_0xdd83('0x36')]=_[_0xdd83('0x35')](_0x340aaf['model'],qs[_0xdd83('0x37')](_0x107cd8['query'][_0xdd83('0x37')]));_0x143a04['attributes']=_0x143a04['attributes'][_0xdd83('0x38')]?_0x143a04[_0xdd83('0x36')]:_0x340aaf[_0xdd83('0x31')];if(!_0x107cd8[_0xdd83('0x32')]['hasOwnProperty'](_0xdd83('0x5a'))){_0x143a04[_0xdd83('0x1e')]=qs['limit'](_0x107cd8[_0xdd83('0x32')][_0xdd83('0x1e')]);_0x143a04[_0xdd83('0x1c')]=qs[_0xdd83('0x1c')](_0x107cd8[_0xdd83('0x32')][_0xdd83('0x1c')]);}_0x143a04[_0xdd83('0x5b')]=qs[_0xdd83('0x5c')](_0x107cd8[_0xdd83('0x32')][_0xdd83('0x5c')]);_0x143a04[_0xdd83('0x3a')]=qs[_0xdd83('0x34')](_[_0xdd83('0x3b')](_0x107cd8['query'],_0x340aaf[_0xdd83('0x34')]));_0x143a04['where'][_0xdd83('0x5d')]=_0x48f78c['id'];if(_0x107cd8[_0xdd83('0x32')][_0xdd83('0x3c')]){_0x143a04[_0xdd83('0x3a')]=_['merge'](_0x143a04[_0xdd83('0x3a')],{'$or':_[_0xdd83('0x2d')](_0x143a04[_0xdd83('0x36')],function(_0x28df83){var _0x2408ab={};_0x2408ab[_0x28df83]={'$like':'%'+_0x107cd8['query'][_0xdd83('0x3c')]+'%'};return _0x2408ab;})});}_0x143a04=_[_0xdd83('0x3d')]({},_0x143a04,_0x107cd8[_0xdd83('0x3f')]);return db['CmHopperHistory']['count']({'where':_0x143a04['where']})[_0xdd83('0x25')](function(_0x2b0d69){_0x1b461d[_0xdd83('0x1f')]=_0x2b0d69;if(_0x107cd8[_0xdd83('0x32')]['includeAll']){_0x143a04[_0xdd83('0x41')]=[{'all':!![]}];}return db[_0xdd83('0x5f')][_0xdd83('0x42')](_0x143a04);})[_0xdd83('0x25')](function(_0x3e07bc){_0x1b461d[_0xdd83('0x43')]=_0x3e07bc;return _0x1b461d;});}})[_0xdd83('0x25')](respondWithFilteredResult(_0x278dfb,_0x143a04))[_0xdd83('0x44')](handleError(_0x278dfb,null));};exports[_0xdd83('0x60')]=function(_0x52ee26,_0x22d23a,_0xdd2a03){var _0xd2ed85={'raw':!![],'where':{}};var _0x58dcba={};var _0x3857df={'count':0x0,'rows':[]};return db[_0xdd83('0x2e')][_0xdd83('0x59')]({'where':{'id':_0x52ee26['params']['id']}})['then'](handleEntityNotFound(_0x22d23a,null))[_0xdd83('0x25')](function(_0x5306dc){if(_0x5306dc){_0x58dcba[_0xdd83('0x31')]=_[_0xdd83('0x33')](db['CmHopperFinal']['rawAttributes']);_0x58dcba[_0xdd83('0x32')]=_['keys'](_0x52ee26[_0xdd83('0x32')]);_0x58dcba[_0xdd83('0x34')]=_[_0xdd83('0x35')](_0x58dcba[_0xdd83('0x31')],_0x58dcba[_0xdd83('0x32')]);_0xd2ed85[_0xdd83('0x36')]=_[_0xdd83('0x35')](_0x58dcba['model'],qs[_0xdd83('0x37')](_0x52ee26['query'][_0xdd83('0x37')]));_0xd2ed85[_0xdd83('0x36')]=_0xd2ed85[_0xdd83('0x36')]['length']?_0xd2ed85['attributes']:_0x58dcba[_0xdd83('0x31')];if(!_0x52ee26[_0xdd83('0x32')][_0xdd83('0x39')](_0xdd83('0x5a'))){_0xd2ed85[_0xdd83('0x1e')]=qs[_0xdd83('0x1e')](_0x52ee26['query'][_0xdd83('0x1e')]);_0xd2ed85['offset']=qs[_0xdd83('0x1c')](_0x52ee26['query']['offset']);}_0xd2ed85[_0xdd83('0x5b')]=qs[_0xdd83('0x5c')](_0x52ee26[_0xdd83('0x32')][_0xdd83('0x5c')]);_0xd2ed85[_0xdd83('0x3a')]=qs[_0xdd83('0x34')](_['pick'](_0x52ee26[_0xdd83('0x32')],_0x58dcba[_0xdd83('0x34')]));_0xd2ed85[_0xdd83('0x3a')][_0xdd83('0x5d')]=_0x5306dc['id'];if(_0x52ee26[_0xdd83('0x32')][_0xdd83('0x3c')]){_0xd2ed85[_0xdd83('0x3a')]=_[_0xdd83('0x3d')](_0xd2ed85[_0xdd83('0x3a')],{'$or':_[_0xdd83('0x2d')](_0xd2ed85[_0xdd83('0x36')],function(_0x85a95c){var _0x39aef1={};_0x39aef1[_0x85a95c]={'$like':'%'+_0x52ee26[_0xdd83('0x32')]['filter']+'%'};return _0x39aef1;})});}_0xd2ed85=_[_0xdd83('0x3d')]({},_0xd2ed85,_0x52ee26[_0xdd83('0x3f')]);return db['CmHopperFinal'][_0xdd83('0x1f')]({'where':_0xd2ed85[_0xdd83('0x3a')]})[_0xdd83('0x25')](function(_0x129996){_0x3857df[_0xdd83('0x1f')]=_0x129996;if(_0x52ee26[_0xdd83('0x32')]['includeAll']){_0xd2ed85[_0xdd83('0x41')]=[{'all':!![]}];}return db[_0xdd83('0x61')][_0xdd83('0x42')](_0xd2ed85);})[_0xdd83('0x25')](function(_0x34fdef){_0x3857df[_0xdd83('0x43')]=_0x34fdef;return _0x3857df;});}})[_0xdd83('0x25')](respondWithFilteredResult(_0x22d23a,_0xd2ed85))['catch'](handleError(_0x22d23a,null));};exports[_0xdd83('0x62')]=function(_0x5736fd,_0x647966,_0x31c51e){var _0x38ed90={'raw':!![],'where':{}};var _0x15bd3d={};var _0xf1f353={'count':0x0,'rows':[]};return db[_0xdd83('0x2e')][_0xdd83('0x59')]({'where':{'id':_0x5736fd[_0xdd83('0x51')]['id']}})['then'](handleEntityNotFound(_0x647966,null))[_0xdd83('0x25')](function(_0x2a612b){if(_0x2a612b){_0x15bd3d[_0xdd83('0x31')]=_['keys'](db[_0xdd83('0x63')][_0xdd83('0x52')]);_0x15bd3d[_0xdd83('0x32')]=_['keys'](_0x5736fd[_0xdd83('0x32')]);_0x15bd3d[_0xdd83('0x34')]=_[_0xdd83('0x35')](_0x15bd3d[_0xdd83('0x31')],_0x15bd3d['query']);_0x38ed90[_0xdd83('0x36')]=_[_0xdd83('0x35')](_0x15bd3d['model'],qs['fields'](_0x5736fd[_0xdd83('0x32')]['fields']));_0x38ed90['attributes']=_0x38ed90[_0xdd83('0x36')][_0xdd83('0x38')]?_0x38ed90[_0xdd83('0x36')]:_0x15bd3d['model'];if(!_0x5736fd[_0xdd83('0x32')][_0xdd83('0x39')](_0xdd83('0x5a'))){_0x38ed90[_0xdd83('0x1e')]=qs['limit'](_0x5736fd['query'][_0xdd83('0x1e')]);_0x38ed90[_0xdd83('0x1c')]=qs[_0xdd83('0x1c')](_0x5736fd['query']['offset']);}_0x38ed90[_0xdd83('0x5b')]=qs['sort'](_0x5736fd['query'][_0xdd83('0x5c')]);_0x38ed90[_0xdd83('0x3a')]=qs['filters'](_[_0xdd83('0x3b')](_0x5736fd['query'],_0x15bd3d[_0xdd83('0x34')]));_0x38ed90['where'][_0xdd83('0x5d')]=_0x2a612b['id'];if(_0x5736fd[_0xdd83('0x32')][_0xdd83('0x3c')]){_0x38ed90['where']=_[_0xdd83('0x3d')](_0x38ed90[_0xdd83('0x3a')],{'$or':_['map'](_0x38ed90['attributes'],function(_0x37c5b5){var _0xcdec21={};_0xcdec21[_0x37c5b5]={'$like':'%'+_0x5736fd[_0xdd83('0x32')][_0xdd83('0x3c')]+'%'};return _0xcdec21;})});}_0x38ed90=_['merge']({},_0x38ed90,_0x5736fd[_0xdd83('0x3f')]);return db['CmHopperBlack'][_0xdd83('0x1f')]({'where':_0x38ed90[_0xdd83('0x3a')]})[_0xdd83('0x25')](function(_0x50a304){_0xf1f353[_0xdd83('0x1f')]=_0x50a304;if(_0x5736fd['query'][_0xdd83('0x40')]){_0x38ed90[_0xdd83('0x41')]=[{'all':!![]}];}return db[_0xdd83('0x63')][_0xdd83('0x42')](_0x38ed90);})[_0xdd83('0x25')](function(_0x8b830c){_0xf1f353[_0xdd83('0x43')]=_0x8b830c;return _0xf1f353;});}})['then'](respondWithFilteredResult(_0x647966,_0x38ed90))[_0xdd83('0x44')](handleError(_0x647966,null));};exports['getLists']=function(_0x302528,_0x25f142,_0x36970f){var _0x277dcd={};var _0xdcd8c8={};var _0x1f1631;var _0x395af9;return db[_0xdd83('0x2e')][_0xdd83('0x59')]({'where':{'id':_0x302528[_0xdd83('0x51')]['id']}})[_0xdd83('0x25')](handleEntityNotFound(_0x25f142,null))[_0xdd83('0x25')](function(_0x4b484a){if(_0x4b484a){_0x1f1631=_0x4b484a;_0xdcd8c8['model']=_[_0xdd83('0x33')](db[_0xdd83('0x64')][_0xdd83('0x52')]);_0xdcd8c8[_0xdd83('0x32')]=_[_0xdd83('0x33')](_0x302528[_0xdd83('0x32')]);_0xdcd8c8['filters']=_[_0xdd83('0x35')](_0xdcd8c8['model'],_0xdcd8c8[_0xdd83('0x32')]);_0x277dcd[_0xdd83('0x36')]=_[_0xdd83('0x35')](_0xdcd8c8[_0xdd83('0x31')],qs[_0xdd83('0x37')](_0x302528[_0xdd83('0x32')][_0xdd83('0x37')]));_0x277dcd[_0xdd83('0x36')]=_0x277dcd['attributes'][_0xdd83('0x38')]?_0x277dcd[_0xdd83('0x36')]:_0xdcd8c8[_0xdd83('0x31')];_0x277dcd[_0xdd83('0x5b')]=qs['sort'](_0x302528[_0xdd83('0x32')][_0xdd83('0x5c')]);_0x277dcd['where']=qs['filters'](_[_0xdd83('0x3b')](_0x302528['query'],_0xdcd8c8[_0xdd83('0x34')]));if(_0x302528['query'][_0xdd83('0x3c')]){_0x277dcd[_0xdd83('0x3a')]=_[_0xdd83('0x3d')](_0x277dcd['where'],{'$or':_[_0xdd83('0x2d')](_0x277dcd[_0xdd83('0x36')],function(_0x4fdc8f){var _0x59c447={};_0x59c447[_0x4fdc8f]={'$like':'%'+_0x302528['query']['filter']+'%'};return _0x59c447;})});}_0x277dcd=_[_0xdd83('0x3d')]({},_0x277dcd,_0x302528[_0xdd83('0x3f')]);return _0x1f1631[_0xdd83('0x65')](_0x277dcd);}})[_0xdd83('0x25')](function(_0x354507){if(_0x354507){_0x395af9=_0x354507['length'];if(!_0x302528[_0xdd83('0x32')][_0xdd83('0x39')]('nolimit')){_0x277dcd['limit']=qs['limit'](_0x302528[_0xdd83('0x32')]['limit']);_0x277dcd[_0xdd83('0x1c')]=qs[_0xdd83('0x1c')](_0x302528[_0xdd83('0x32')][_0xdd83('0x1c')]);}return _0x1f1631[_0xdd83('0x65')](_0x277dcd);}})[_0xdd83('0x25')](function(_0x399095){if(_0x399095){return _0x399095?{'count':_0x395af9,'rows':_0x399095}:null;}})[_0xdd83('0x25')](respondWithResult(_0x25f142,null))[_0xdd83('0x44')](handleError(_0x25f142,null));};exports[_0xdd83('0x66')]=function(_0x240092,_0x2fcc5b,_0xfea6bc){var _0xc36079,_0x7dec77;return db[_0xdd83('0x2e')]['find']({'where':{'id':_0x240092['params']['id']}})[_0xdd83('0x25')](handleEntityNotFound(_0x2fcc5b,null))[_0xdd83('0x25')](function(_0x2e0b22){if(_0x2e0b22){_0x7dec77=_0x2e0b22;return _0x2e0b22[_0xdd83('0x66')](_0x240092['body'][_0xdd83('0x67')],_[_0xdd83('0x53')](_0x240092[_0xdd83('0x48')],['ids','id'])||{});}return null;})[_0xdd83('0x68')](function(_0xe51960){var _0xdd1ee7;_0xc36079=_0xe51960||[];var _0x136c30=[];if(_0xe51960){for(var _0x39b8db=0x0;_0x39b8db<_0xe51960[_0xdd83('0x38')];_0x39b8db+=0x1){var _0x57d7de=_0xe51960[_0x39b8db]['get']({'plain':!![]});_0x7dec77[_0xdd83('0x69')]=_0x240092[_0xdd83('0x48')][_0xdd83('0x69')]?_0x240092[_0xdd83('0x48')][_0xdd83('0x69')]:_0x7dec77['dialCheckDuplicateType'];switch(_0x7dec77[_0xdd83('0x69')]){case _0xdd83('0x6a'):_0xdd1ee7=squel[_0xdd83('0x6b')]()[_0xdd83('0x6c')]('cm_hopper')[_0xdd83('0x6d')]([_0xdd83('0x6e'),_0xdd83('0x6f'),_0xdd83('0x70'),_0xdd83('0x71'),'CampaignId',_0xdd83('0x54'),'updatedAt'],squel[_0xdd83('0x72')]()[_0xdd83('0x73')](_0xdd83('0x6e'),'phone')[_0xdd83('0x73')](_0xdd83('0x74'),'scheduledAt')[_0xdd83('0x73')]('id',_0xdd83('0x70'))[_0xdd83('0x73')](_0x57d7de['CmListId'][_0xdd83('0x75')](),_0xdd83('0x71'))[_0xdd83('0x73')](_0x240092[_0xdd83('0x51')]['id'][_0xdd83('0x75')](),_0xdd83('0x5d'))['field']('NOW()',_0xdd83('0x54'))[_0xdd83('0x73')](_0xdd83('0x74'),_0xdd83('0x55'))[_0xdd83('0x76')](_0xdd83('0x77'))[_0xdd83('0x3a')](_0xdd83('0x78'))['where'](_0xdd83('0x79'),_0x57d7de['CmListId'][_0xdd83('0x75')]())[_0xdd83('0x3a')](_0xdd83('0x7a'))['where'](_0xdd83('0x7b'),squel[_0xdd83('0x72')]()[_0xdd83('0x73')](_0xdd83('0x7c'))[_0xdd83('0x76')](_0xdd83('0x7d'))[_0xdd83('0x3a')](_0xdd83('0x7e'),_0x240092['params']['id'][_0xdd83('0x75')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xdd83('0x72')]()[_0xdd83('0x73')]('COALESCE(phone,\x27\x27)')[_0xdd83('0x76')](_0xdd83('0x7f'))[_0xdd83('0x3a')](_0xdd83('0x7e'),_0x240092[_0xdd83('0x51')]['id'][_0xdd83('0x75')]())))['toString']();break;case _0xdd83('0x80'):_0xdd1ee7=squel[_0xdd83('0x6b')]()[_0xdd83('0x6c')](_0xdd83('0x7f'))[_0xdd83('0x6d')]([_0xdd83('0x6e'),'scheduledAt',_0xdd83('0x70'),_0xdd83('0x71'),_0xdd83('0x5d'),_0xdd83('0x54'),_0xdd83('0x55')],squel[_0xdd83('0x72')]()['field'](_0xdd83('0x6e'),_0xdd83('0x6e'))['field'](_0xdd83('0x74'),'scheduledAt')[_0xdd83('0x73')]('id',_0xdd83('0x70'))[_0xdd83('0x73')](_0x57d7de[_0xdd83('0x81')][_0xdd83('0x75')](),_0xdd83('0x71'))['field'](_0x240092[_0xdd83('0x51')]['id'][_0xdd83('0x75')](),_0xdd83('0x5d'))[_0xdd83('0x73')](_0xdd83('0x74'),_0xdd83('0x54'))[_0xdd83('0x73')]('NOW()',_0xdd83('0x55'))[_0xdd83('0x76')](_0xdd83('0x77'))[_0xdd83('0x3a')](_0xdd83('0x78'))[_0xdd83('0x3a')](_0xdd83('0x79'),_0x57d7de[_0xdd83('0x81')][_0xdd83('0x75')]())[_0xdd83('0x3a')](_0xdd83('0x7a'))[_0xdd83('0x3a')](_0xdd83('0x7b'),squel['select']()[_0xdd83('0x73')](_0xdd83('0x82'))[_0xdd83('0x76')](_0xdd83('0x7f'))['where'](_0xdd83('0x7e'),_0x240092[_0xdd83('0x51')]['id'][_0xdd83('0x75')]())))[_0xdd83('0x75')]();break;default:_0xdd1ee7=squel[_0xdd83('0x6b')]()[_0xdd83('0x6c')](_0xdd83('0x7f'))['fromQuery']([_0xdd83('0x6e'),_0xdd83('0x6f'),_0xdd83('0x70'),'ListId',_0xdd83('0x5d'),_0xdd83('0x54'),_0xdd83('0x55')],squel[_0xdd83('0x72')]()[_0xdd83('0x73')](_0xdd83('0x6e'),'phone')[_0xdd83('0x73')](_0xdd83('0x74'),_0xdd83('0x6f'))[_0xdd83('0x73')]('id','ContactId')[_0xdd83('0x73')](_0x57d7de[_0xdd83('0x81')][_0xdd83('0x75')](),_0xdd83('0x71'))[_0xdd83('0x73')](_0x240092[_0xdd83('0x51')]['id'][_0xdd83('0x75')](),_0xdd83('0x5d'))[_0xdd83('0x73')](_0xdd83('0x74'),_0xdd83('0x54'))[_0xdd83('0x73')](_0xdd83('0x74'),_0xdd83('0x55'))[_0xdd83('0x76')]('cm_contacts')[_0xdd83('0x3a')]('deletedAt\x20IS\x20NULL')['where'](_0xdd83('0x79'),_0x57d7de[_0xdd83('0x81')][_0xdd83('0x75')]())['where'](_0xdd83('0x7a')))[_0xdd83('0x75')]();}_0x136c30[_0xdd83('0x83')](db[_0xdd83('0x84')][_0xdd83('0x32')](_0xdd1ee7));}return BPromise[_0xdd83('0x85')](_0x136c30);}})[_0xdd83('0x25')](function(){return _0xc36079;})['then'](respondWithResult(_0x2fcc5b,null))['catch'](handleError(_0x2fcc5b,null));};exports[_0xdd83('0x86')]=function(_0x41198d,_0xd50a14,_0xa9297c){return db[_0xdd83('0x2e')][_0xdd83('0x46')]({'where':{'id':_0x41198d[_0xdd83('0x51')]['id']}})[_0xdd83('0x25')](handleEntityNotFound(_0xd50a14,null))[_0xdd83('0x25')](function(_0x5abd73){if(_0x5abd73){return _0x5abd73[_0xdd83('0x86')](_0x41198d[_0xdd83('0x32')][_0xdd83('0x67')]);}})[_0xdd83('0x25')](function(_0x38d908){if(_0x38d908){return db[_0xdd83('0x5e')][_0xdd83('0x57')]({'where':{'ListId':_0x41198d[_0xdd83('0x32')][_0xdd83('0x67')],'CampaignId':_0x41198d[_0xdd83('0x51')]['id']}})[_0xdd83('0x25')](function(){return _0x38d908;});}})[_0xdd83('0x25')](respondWithStatusCode(_0xd50a14,null))['catch'](handleError(_0xd50a14,null));};exports[_0xdd83('0x87')]=function(_0x547902,_0xc02890,_0x2e3b56){var _0x29580f={};var _0x1de98f={};var _0x3bfb80;var _0xae3cef;return db[_0xdd83('0x2e')]['findOne']({'where':{'id':_0x547902[_0xdd83('0x51')]['id']}})[_0xdd83('0x25')](handleEntityNotFound(_0xc02890,null))[_0xdd83('0x25')](function(_0x4613da){if(_0x4613da){_0x3bfb80=_0x4613da;_0x1de98f[_0xdd83('0x31')]=_[_0xdd83('0x33')](db[_0xdd83('0x64')]['rawAttributes']);_0x1de98f[_0xdd83('0x32')]=_[_0xdd83('0x33')](_0x547902[_0xdd83('0x32')]);_0x1de98f['filters']=_[_0xdd83('0x35')](_0x1de98f[_0xdd83('0x31')],_0x1de98f[_0xdd83('0x32')]);_0x29580f['attributes']=_[_0xdd83('0x35')](_0x1de98f['model'],qs[_0xdd83('0x37')](_0x547902[_0xdd83('0x32')][_0xdd83('0x37')]));_0x29580f[_0xdd83('0x36')]=_0x29580f[_0xdd83('0x36')]['length']?_0x29580f[_0xdd83('0x36')]:_0x1de98f[_0xdd83('0x31')];_0x29580f['order']=qs[_0xdd83('0x5c')](_0x547902[_0xdd83('0x32')]['sort']);_0x29580f[_0xdd83('0x3a')]=qs[_0xdd83('0x34')](_[_0xdd83('0x3b')](_0x547902[_0xdd83('0x32')],_0x1de98f['filters']));if(_0x547902[_0xdd83('0x32')][_0xdd83('0x3c')]){_0x29580f['where']=_['merge'](_0x29580f[_0xdd83('0x3a')],{'$or':_[_0xdd83('0x2d')](_0x29580f[_0xdd83('0x36')],function(_0x4c6937){var _0x58d922={};_0x58d922[_0x4c6937]={'$like':'%'+_0x547902['query']['filter']+'%'};return _0x58d922;})});}_0x29580f=_[_0xdd83('0x3d')]({},_0x29580f,_0x547902[_0xdd83('0x3f')]);return _0x3bfb80[_0xdd83('0x87')](_0x29580f);}})[_0xdd83('0x25')](function(_0xa76296){if(_0xa76296){_0xae3cef=_0xa76296['length'];if(!_0x547902[_0xdd83('0x32')][_0xdd83('0x39')](_0xdd83('0x5a'))){_0x29580f[_0xdd83('0x1e')]=qs[_0xdd83('0x1e')](_0x547902['query']['limit']);_0x29580f[_0xdd83('0x1c')]=qs[_0xdd83('0x1c')](_0x547902[_0xdd83('0x32')][_0xdd83('0x1c')]);}return _0x3bfb80['getBlackLists'](_0x29580f);}})[_0xdd83('0x25')](function(_0x8c005){if(_0x8c005){return _0x8c005?{'count':_0xae3cef,'rows':_0x8c005}:null;}})[_0xdd83('0x25')](respondWithResult(_0xc02890,null))[_0xdd83('0x44')](handleError(_0xc02890,null));};exports[_0xdd83('0x88')]=function(_0x5141d7,_0x223f0f,_0x581927){var _0x131f90,_0x261cc1;return db[_0xdd83('0x2e')][_0xdd83('0x46')]({'where':{'id':_0x5141d7[_0xdd83('0x51')]['id']}})[_0xdd83('0x25')](handleEntityNotFound(_0x223f0f,null))['then'](function(_0x4c625b){if(_0x4c625b){_0x261cc1=_0x4c625b;return _0x4c625b[_0xdd83('0x88')](_0x5141d7[_0xdd83('0x48')]['ids'],_[_0xdd83('0x53')](_0x5141d7['body'],[_0xdd83('0x67'),'id'])||{});}return null;})[_0xdd83('0x68')](function(_0x1a7d37){var _0x17d245;_0x131f90=_0x1a7d37||[];var _0x5c8dd0=[];if(_0x1a7d37){for(var _0x10af86=0x0;_0x10af86<_0x1a7d37['length'];_0x10af86+=0x1){var _0x172360=_0x1a7d37[_0x10af86][_0xdd83('0x26')]({'plain':!![]});_0x17d245=squel[_0xdd83('0x6b')]()['into'](_0xdd83('0x89'))[_0xdd83('0x6d')]([_0xdd83('0x6e'),_0xdd83('0x70'),_0xdd83('0x71'),'CampaignId',_0xdd83('0x54'),_0xdd83('0x55')],squel['select']()[_0xdd83('0x73')](_0xdd83('0x6e'),'phone')['field']('id',_0xdd83('0x70'))[_0xdd83('0x73')](_0x172360[_0xdd83('0x81')][_0xdd83('0x75')](),_0xdd83('0x71'))[_0xdd83('0x73')](_0x5141d7[_0xdd83('0x51')]['id']['toString'](),'CampaignId')[_0xdd83('0x73')](_0xdd83('0x74'),_0xdd83('0x54'))[_0xdd83('0x73')](_0xdd83('0x74'),_0xdd83('0x55'))[_0xdd83('0x76')]('cm_contacts')[_0xdd83('0x3a')]('deletedAt\x20IS\x20NULL')[_0xdd83('0x3a')]('ListId\x20=\x20?',_0x172360['CmListId'][_0xdd83('0x75')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x5c8dd0[_0xdd83('0x83')](db[_0xdd83('0x84')][_0xdd83('0x32')](_0x17d245));}return BPromise[_0xdd83('0x85')](_0x5c8dd0);}})[_0xdd83('0x25')](function(){return _0x131f90;})[_0xdd83('0x25')](respondWithResult(_0x223f0f,null))[_0xdd83('0x44')](handleError(_0x223f0f,null));};exports[_0xdd83('0x8a')]=function(_0x2a1bd1,_0x135697,_0x156ee9){return db[_0xdd83('0x2e')][_0xdd83('0x46')]({'where':{'id':_0x2a1bd1['params']['id']}})[_0xdd83('0x25')](handleEntityNotFound(_0x135697,null))[_0xdd83('0x25')](function(_0x31b2e0){if(_0x31b2e0){return _0x31b2e0['removeBlackLists'](_0x2a1bd1[_0xdd83('0x32')][_0xdd83('0x67')]);}})[_0xdd83('0x25')](function(_0x3326b8){if(_0x3326b8){return db[_0xdd83('0x63')]['destroy']({'where':{'ListId':_0x2a1bd1[_0xdd83('0x32')][_0xdd83('0x67')],'CampaignId':_0x2a1bd1['params']['id']}})[_0xdd83('0x25')](function(){return _0x3326b8;});}})[_0xdd83('0x25')](respondWithStatusCode(_0x135697,null))[_0xdd83('0x44')](handleError(_0x135697,null));}; \ No newline at end of file +var _0xda1f=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','userProfileId','destroy','findOne','CmHopper','order','sort','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','omit','ids','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','NOW()','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','cm_hopper','deletedAt\x20IS\x20NULL','cm_contacts','sequelize','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','push','all','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','squel','crypto','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','get','IvrCampaigns','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','Campaign','includeAll','findAll','rows','show','params','include','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda1f,0xc3));var _0xfda1=function(_0xf98c61,_0x1a48e0){_0xf98c61=_0xf98c61-0x0;var _0x326149=_0xda1f[_0xf98c61];return _0x326149;};'use strict';var emlformat=require(_0xfda1('0x0'));var rimraf=require(_0xfda1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfda1('0x2'));var rp=require(_0xfda1('0x3'));var moment=require(_0xfda1('0x4'));var BPromise=require(_0xfda1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xfda1('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda1('0x7'));var crypto=require(_0xfda1('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfda1('0x9'));var querystring=require('querystring');var Papa=require(_0xfda1('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfda1('0xb'));var as=require(_0xfda1('0xc'));var hardwareService=require(_0xfda1('0xd'));var logger=require(_0xfda1('0xe'))(_0xfda1('0xf'));var utils=require(_0xfda1('0x10'));var config=require(_0xfda1('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xfda1('0x12'))['db'];function respondWithStatusCode(_0x5ec183,_0x4456f2){_0x4456f2=_0x4456f2||0xcc;return function(_0x62ce66){if(_0x62ce66){return _0x5ec183[_0xfda1('0x13')](_0x4456f2);}return _0x5ec183[_0xfda1('0x14')](_0x4456f2)[_0xfda1('0x15')]();};}function respondWithResult(_0x291ad7,_0x4aa509){_0x4aa509=_0x4aa509||0xc8;return function(_0x303e17){if(_0x303e17){return _0x291ad7[_0xfda1('0x14')](_0x4aa509)[_0xfda1('0x16')](_0x303e17);}};}function respondWithFilteredResult(_0x4e3d93,_0x3f6298){return function(_0xa9ab21){if(_0xa9ab21){var _0x3a8602=typeof _0x3f6298[_0xfda1('0x17')]===_0xfda1('0x18')&&typeof _0x3f6298['limit']===_0xfda1('0x18');var _0x505035=_0xa9ab21[_0xfda1('0x19')];var _0x348af5=_0x3a8602?0x0:_0x3f6298[_0xfda1('0x17')];var _0x1bc03e=_0x3a8602?_0xa9ab21['count']:_0x3f6298[_0xfda1('0x17')]+_0x3f6298[_0xfda1('0x1a')];var _0xfcee14;if(_0x1bc03e>=_0x505035){_0x1bc03e=_0x505035;_0xfcee14=0xc8;}else{_0xfcee14=0xce;}_0x4e3d93[_0xfda1('0x14')](_0xfcee14);return _0x4e3d93[_0xfda1('0x1b')](_0xfda1('0x1c'),_0x348af5+'-'+_0x1bc03e+'/'+_0x505035)[_0xfda1('0x16')](_0xa9ab21);}return null;};}function patchUpdates(_0x22fb46){return function(_0x4e17fc){try{jsonpatch[_0xfda1('0x1d')](_0x4e17fc,_0x22fb46,!![]);}catch(_0x44916b){return BPromise['reject'](_0x44916b);}return _0x4e17fc[_0xfda1('0x1e')]();};}function saveUpdates(_0x571043,_0x54fd4c){return function(_0x25531d){if(_0x25531d){return _0x25531d[_0xfda1('0x1f')](_0x571043)[_0xfda1('0x20')](function(_0x152d34){return _0x152d34;});}return null;};}function removeEntity(_0x143aeb,_0x254481){return function(_0xdb3254){if(_0xdb3254){return _0xdb3254['destroy']()['then'](function(){var _0x3ad693=_0xdb3254[_0xfda1('0x21')]({'plain':!![]});var _0x383bc8=_0xfda1('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x383bc8,'resourceId':_0x3ad693['id']}})[_0xfda1('0x20')](function(){return _0xdb3254;});})[_0xfda1('0x20')](function(){_0x143aeb[_0xfda1('0x14')](0xcc)[_0xfda1('0x15')]();});}};}function handleEntityNotFound(_0x339354,_0x257a61){return function(_0x466530){if(!_0x466530){_0x339354[_0xfda1('0x13')](0x194);}return _0x466530;};}function handleError(_0x3e0945,_0x25b38d){_0x25b38d=_0x25b38d||0x1f4;return function(_0x5e19e0){logger[_0xfda1('0x23')](_0x5e19e0[_0xfda1('0x24')]);if(_0x5e19e0['name']){delete _0x5e19e0[_0xfda1('0x25')];}_0x3e0945[_0xfda1('0x14')](_0x25b38d)[_0xfda1('0x26')](_0x5e19e0);};}exports[_0xfda1('0x27')]=function(_0x39fa9f,_0x35c6ac){var _0x473273={},_0x25ad9d={},_0x272e5c={'count':0x0,'rows':[]};var _0x5ee652=_['map'](db['Campaign'][_0xfda1('0x28')],function(_0x305683){return{'name':_0x305683[_0xfda1('0x29')],'type':_0x305683[_0xfda1('0x2a')][_0xfda1('0x2b')]};});_0x25ad9d['model']=_[_0xfda1('0x2c')](_0x5ee652,_0xfda1('0x25'));_0x25ad9d[_0xfda1('0x2d')]=_[_0xfda1('0x2e')](_0x39fa9f[_0xfda1('0x2d')]);_0x25ad9d[_0xfda1('0x2f')]=_[_0xfda1('0x30')](_0x25ad9d[_0xfda1('0x31')],_0x25ad9d[_0xfda1('0x2d')]);_0x473273[_0xfda1('0x32')]=_[_0xfda1('0x30')](_0x25ad9d[_0xfda1('0x31')],qs[_0xfda1('0x33')](_0x39fa9f[_0xfda1('0x2d')][_0xfda1('0x33')]));_0x473273[_0xfda1('0x32')]=_0x473273['attributes'][_0xfda1('0x34')]?_0x473273[_0xfda1('0x32')]:_0x25ad9d[_0xfda1('0x31')];if(!_0x39fa9f[_0xfda1('0x2d')][_0xfda1('0x35')](_0xfda1('0x36'))){_0x473273[_0xfda1('0x1a')]=qs[_0xfda1('0x1a')](_0x39fa9f[_0xfda1('0x2d')][_0xfda1('0x1a')]);_0x473273['offset']=qs[_0xfda1('0x17')](_0x39fa9f[_0xfda1('0x2d')][_0xfda1('0x17')]);}_0x473273['order']=qs['sort'](_0x39fa9f['query']['sort']);_0x473273[_0xfda1('0x37')]=qs['filters'](_[_0xfda1('0x38')](_0x39fa9f['query'],_0x25ad9d[_0xfda1('0x2f')]),_0x5ee652);if(_0x39fa9f[_0xfda1('0x2d')][_0xfda1('0x39')]){_0x473273[_0xfda1('0x37')]=_[_0xfda1('0x3a')](_0x473273[_0xfda1('0x37')],{'$or':_[_0xfda1('0x2c')](_0x5ee652,function(_0x42a4cc){if(_0x42a4cc[_0xfda1('0x2a')]!==_0xfda1('0x3b')){var _0x45fca4={};_0x45fca4[_0x42a4cc[_0xfda1('0x25')]]={'$like':'%'+_0x39fa9f['query'][_0xfda1('0x39')]+'%'};return _0x45fca4;}})});}_0x473273=_['merge']({},_0x473273,_0x39fa9f[_0xfda1('0x3c')]);var _0x2761be={'where':_0x473273['where']};return db[_0xfda1('0x3d')][_0xfda1('0x19')](_0x2761be)[_0xfda1('0x20')](function(_0x319912){_0x272e5c['count']=_0x319912;if(_0x39fa9f[_0xfda1('0x2d')][_0xfda1('0x3e')]){_0x473273['include']=[{'all':!![]}];}return db[_0xfda1('0x3d')][_0xfda1('0x3f')](_0x473273);})[_0xfda1('0x20')](function(_0x33ba9b){_0x272e5c[_0xfda1('0x40')]=_0x33ba9b;return _0x272e5c;})[_0xfda1('0x20')](respondWithFilteredResult(_0x35c6ac,_0x473273))['catch'](handleError(_0x35c6ac,null));};exports[_0xfda1('0x41')]=function(_0x273c23,_0x1bc199){var _0x23ad7e={'raw':![],'where':{'id':_0x273c23[_0xfda1('0x42')]['id']}},_0x16faf7={};_0x16faf7['model']=_['keys'](db['Campaign']['rawAttributes']);_0x16faf7[_0xfda1('0x2d')]=_[_0xfda1('0x2e')](_0x273c23[_0xfda1('0x2d')]);_0x16faf7[_0xfda1('0x2f')]=_[_0xfda1('0x30')](_0x16faf7[_0xfda1('0x31')],_0x16faf7[_0xfda1('0x2d')]);_0x23ad7e[_0xfda1('0x32')]=_[_0xfda1('0x30')](_0x16faf7[_0xfda1('0x31')],qs[_0xfda1('0x33')](_0x273c23['query']['fields']));_0x23ad7e['attributes']=_0x23ad7e[_0xfda1('0x32')]['length']?_0x23ad7e['attributes']:_0x16faf7['model'];if(_0x273c23[_0xfda1('0x2d')][_0xfda1('0x3e')]){_0x23ad7e[_0xfda1('0x43')]=[{'all':!![]}];}_0x23ad7e=_[_0xfda1('0x3a')]({},_0x23ad7e,_0x273c23[_0xfda1('0x3c')]);return db[_0xfda1('0x3d')][_0xfda1('0x44')](_0x23ad7e)[_0xfda1('0x20')](handleEntityNotFound(_0x1bc199,null))[_0xfda1('0x20')](respondWithResult(_0x1bc199,null))['catch'](handleError(_0x1bc199,null));};exports[_0xfda1('0x45')]=function(_0x49b018,_0x8d68ef){return db['Campaign'][_0xfda1('0x45')](_0x49b018[_0xfda1('0x46')],{})[_0xfda1('0x20')](function(_0x1454c8){var _0x10a600=_0x49b018[_0xfda1('0x47')]['get']({'plain':!![]});if(!_0x10a600)throw new Error(_0xfda1('0x48'));if(_0x10a600[_0xfda1('0x49')]===_0xfda1('0x47')){var _0x503cb7=_0x1454c8[_0xfda1('0x21')]({'plain':!![]});var _0x1e6e08=_0xfda1('0x22');return db[_0xfda1('0x4a')][_0xfda1('0x44')]({'where':{'name':_0x1e6e08,'userProfileId':_0x10a600['userProfileId']},'raw':!![]})['then'](function(_0x4a2e3f){if(_0x4a2e3f&&_0x4a2e3f[_0xfda1('0x4b')]===0x0){return db[_0xfda1('0x4c')][_0xfda1('0x45')]({'name':_0x503cb7['name'],'resourceId':_0x503cb7['id'],'type':_0x4a2e3f[_0xfda1('0x25')],'sectionId':_0x4a2e3f['id']},{})[_0xfda1('0x20')](function(){return _0x1454c8;});}else{return _0x1454c8;}})[_0xfda1('0x4d')](function(_0x44e285){logger[_0xfda1('0x23')](_0xfda1('0x4e'),_0x44e285);throw _0x44e285;});}return _0x1454c8;})[_0xfda1('0x20')](respondWithResult(_0x8d68ef,0xc9))[_0xfda1('0x4d')](handleError(_0x8d68ef,null));};exports['clone']=function(_0x19abf2,_0x1c204b){var _0x1e88a7={'where':{'id':_0x19abf2[_0xfda1('0x42')]['id']}},_0x11d63f={};_0x11d63f[_0xfda1('0x31')]=_[_0xfda1('0x2e')](db[_0xfda1('0x3d')][_0xfda1('0x28')]);_0x1e88a7[_0xfda1('0x32')]=_[_0xfda1('0x30')](_0x11d63f[_0xfda1('0x31')],qs[_0xfda1('0x33')](_0x19abf2[_0xfda1('0x2d')][_0xfda1('0x33')]));_0x1e88a7['attributes']=_0x1e88a7[_0xfda1('0x32')][_0xfda1('0x34')]?_0x1e88a7[_0xfda1('0x32')]:_0x11d63f[_0xfda1('0x31')];if(_0x19abf2[_0xfda1('0x2d')][_0xfda1('0x3e')]){_0x1e88a7[_0xfda1('0x43')]=[{'all':!![]}];}_0x1e88a7=_[_0xfda1('0x3a')]({},_0x1e88a7,_0x19abf2[_0xfda1('0x3c')]);return db[_0xfda1('0x3d')][_0xfda1('0x44')](_0x1e88a7)[_0xfda1('0x20')](handleEntityNotFound(_0x1c204b,null))[_0xfda1('0x20')](function(_0x4ee48b){if(_0x4ee48b){var _0x48847b=_0x4ee48b[_0xfda1('0x21')]({'plain':!![]});_0x48847b=qs['omit'](_0x48847b,['id',_0xfda1('0x4f'),_0xfda1('0x50')]);_0x19abf2[_0xfda1('0x46')]=_['omit'](_0x19abf2[_0xfda1('0x46')],['id',_0xfda1('0x4f'),'updatedAt']);return db['Campaign'][_0xfda1('0x45')](_[_0xfda1('0x3a')](_0x48847b,_0x19abf2['body']),{'include':_0x19abf2[_0xfda1('0x2d')][_0xfda1('0x3e')]?[{'all':!![]}]:undefined})[_0xfda1('0x20')](function(_0x223a58){var _0x61ac28=_0x19abf2[_0xfda1('0x47')][_0xfda1('0x21')]({'plain':!![]});if(!_0x61ac28)throw new Error(_0xfda1('0x48'));if(_0x61ac28[_0xfda1('0x49')]===_0xfda1('0x47')){var _0x158864=_0x223a58[_0xfda1('0x21')]({'plain':!![]});var _0x262c8b=_0xfda1('0x22');return db[_0xfda1('0x4a')][_0xfda1('0x44')]({'where':{'name':_0x262c8b,'userProfileId':_0x61ac28[_0xfda1('0x51')]},'raw':!![]})[_0xfda1('0x20')](function(_0xa6cf29){if(_0xa6cf29&&_0xa6cf29[_0xfda1('0x4b')]===0x0){return db[_0xfda1('0x4c')][_0xfda1('0x45')]({'name':_0x158864[_0xfda1('0x25')],'resourceId':_0x158864['id'],'type':_0xa6cf29[_0xfda1('0x25')],'sectionId':_0xa6cf29['id']},{})[_0xfda1('0x20')](function(){return _0x223a58;});}else{return _0x223a58;}})[_0xfda1('0x4d')](function(_0x4a5a95){logger['error'](_0xfda1('0x4e'),_0x4a5a95);throw _0x4a5a95;});}return _0x223a58;});}})[_0xfda1('0x20')](respondWithResult(_0x1c204b,0xc9))[_0xfda1('0x4d')](handleError(_0x1c204b,null));};exports[_0xfda1('0x1f')]=function(_0x3c28a0,_0x501833){if(_0x3c28a0[_0xfda1('0x46')]['id']){delete _0x3c28a0['body']['id'];}return db['Campaign'][_0xfda1('0x44')]({'where':{'id':_0x3c28a0[_0xfda1('0x42')]['id']}})['then'](handleEntityNotFound(_0x501833,null))[_0xfda1('0x20')](saveUpdates(_0x3c28a0['body'],null))[_0xfda1('0x20')](respondWithResult(_0x501833,null))[_0xfda1('0x4d')](handleError(_0x501833,null));};exports[_0xfda1('0x52')]=function(_0x5a5644,_0x2027ab){return db[_0xfda1('0x3d')]['find']({'where':{'id':_0x5a5644[_0xfda1('0x42')]['id']}})[_0xfda1('0x20')](handleEntityNotFound(_0x2027ab,null))['then'](removeEntity(_0x2027ab,null))[_0xfda1('0x4d')](handleError(_0x2027ab,null));};exports['getHoppers']=function(_0x157e49,_0x49ff79,_0x17c46b){var _0x14fc67={'raw':!![],'where':{}};var _0x2d994c={};var _0x10331e={'count':0x0,'rows':[]};return db[_0xfda1('0x3d')][_0xfda1('0x53')]({'where':{'id':_0x157e49[_0xfda1('0x42')]['id']}})['then'](handleEntityNotFound(_0x49ff79,null))['then'](function(_0x13feeb){if(_0x13feeb){_0x2d994c[_0xfda1('0x31')]=_[_0xfda1('0x2e')](db[_0xfda1('0x54')]['rawAttributes']);_0x2d994c[_0xfda1('0x2d')]=_[_0xfda1('0x2e')](_0x157e49[_0xfda1('0x2d')]);_0x2d994c[_0xfda1('0x2f')]=_[_0xfda1('0x30')](_0x2d994c['model'],_0x2d994c[_0xfda1('0x2d')]);_0x14fc67[_0xfda1('0x32')]=_[_0xfda1('0x30')](_0x2d994c[_0xfda1('0x31')],qs[_0xfda1('0x33')](_0x157e49[_0xfda1('0x2d')]['fields']));_0x14fc67['attributes']=_0x14fc67['attributes'][_0xfda1('0x34')]?_0x14fc67[_0xfda1('0x32')]:_0x2d994c[_0xfda1('0x31')];if(!_0x157e49[_0xfda1('0x2d')][_0xfda1('0x35')](_0xfda1('0x36'))){_0x14fc67[_0xfda1('0x1a')]=qs['limit'](_0x157e49['query'][_0xfda1('0x1a')]);_0x14fc67[_0xfda1('0x17')]=qs[_0xfda1('0x17')](_0x157e49[_0xfda1('0x2d')][_0xfda1('0x17')]);}_0x14fc67[_0xfda1('0x55')]=qs[_0xfda1('0x56')](_0x157e49[_0xfda1('0x2d')][_0xfda1('0x56')]);_0x14fc67[_0xfda1('0x37')]=qs[_0xfda1('0x2f')](_[_0xfda1('0x38')](_0x157e49[_0xfda1('0x2d')],_0x2d994c['filters']));_0x14fc67[_0xfda1('0x37')][_0xfda1('0x57')]=_0x13feeb['id'];if(_0x157e49[_0xfda1('0x2d')][_0xfda1('0x39')]){_0x14fc67[_0xfda1('0x37')]=_['merge'](_0x14fc67[_0xfda1('0x37')],{'$or':_['map'](_0x14fc67[_0xfda1('0x32')],function(_0x8ad3de){var _0x14b325={};_0x14b325[_0x8ad3de]={'$like':'%'+_0x157e49[_0xfda1('0x2d')][_0xfda1('0x39')]+'%'};return _0x14b325;})});}_0x14fc67=_[_0xfda1('0x3a')]({},_0x14fc67,_0x157e49['options']);return db[_0xfda1('0x54')][_0xfda1('0x19')]({'where':_0x14fc67[_0xfda1('0x37')]})[_0xfda1('0x20')](function(_0x5eabeb){_0x10331e['count']=_0x5eabeb;if(_0x157e49[_0xfda1('0x2d')][_0xfda1('0x3e')]){_0x14fc67['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x14fc67);})[_0xfda1('0x20')](function(_0x532d18){_0x10331e[_0xfda1('0x40')]=_0x532d18;return _0x10331e;});}})['then'](respondWithFilteredResult(_0x49ff79,_0x14fc67))[_0xfda1('0x4d')](handleError(_0x49ff79,null));};exports[_0xfda1('0x58')]=function(_0x28f7b7,_0x5dabcb,_0x453ce6){var _0x1226d6={'raw':!![],'where':{}};var _0x442848={};var _0xc23e0d={'count':0x0,'rows':[]};return db[_0xfda1('0x3d')][_0xfda1('0x53')]({'where':{'id':_0x28f7b7[_0xfda1('0x42')]['id']}})['then'](handleEntityNotFound(_0x5dabcb,null))[_0xfda1('0x20')](function(_0xcf3528){if(_0xcf3528){_0x442848[_0xfda1('0x31')]=_[_0xfda1('0x2e')](db['CmHopperHistory'][_0xfda1('0x28')]);_0x442848[_0xfda1('0x2d')]=_[_0xfda1('0x2e')](_0x28f7b7[_0xfda1('0x2d')]);_0x442848[_0xfda1('0x2f')]=_[_0xfda1('0x30')](_0x442848['model'],_0x442848[_0xfda1('0x2d')]);_0x1226d6[_0xfda1('0x32')]=_[_0xfda1('0x30')](_0x442848[_0xfda1('0x31')],qs[_0xfda1('0x33')](_0x28f7b7[_0xfda1('0x2d')]['fields']));_0x1226d6[_0xfda1('0x32')]=_0x1226d6[_0xfda1('0x32')][_0xfda1('0x34')]?_0x1226d6['attributes']:_0x442848[_0xfda1('0x31')];if(!_0x28f7b7[_0xfda1('0x2d')][_0xfda1('0x35')](_0xfda1('0x36'))){_0x1226d6[_0xfda1('0x1a')]=qs['limit'](_0x28f7b7['query'][_0xfda1('0x1a')]);_0x1226d6[_0xfda1('0x17')]=qs[_0xfda1('0x17')](_0x28f7b7[_0xfda1('0x2d')][_0xfda1('0x17')]);}_0x1226d6[_0xfda1('0x55')]=qs[_0xfda1('0x56')](_0x28f7b7['query'][_0xfda1('0x56')]);_0x1226d6[_0xfda1('0x37')]=qs[_0xfda1('0x2f')](_[_0xfda1('0x38')](_0x28f7b7[_0xfda1('0x2d')],_0x442848[_0xfda1('0x2f')]));_0x1226d6[_0xfda1('0x37')]['CampaignId']=_0xcf3528['id'];if(_0x28f7b7[_0xfda1('0x2d')][_0xfda1('0x39')]){_0x1226d6[_0xfda1('0x37')]=_[_0xfda1('0x3a')](_0x1226d6['where'],{'$or':_[_0xfda1('0x2c')](_0x1226d6[_0xfda1('0x32')],function(_0x480820){var _0x50b19b={};_0x50b19b[_0x480820]={'$like':'%'+_0x28f7b7['query'][_0xfda1('0x39')]+'%'};return _0x50b19b;})});}_0x1226d6=_[_0xfda1('0x3a')]({},_0x1226d6,_0x28f7b7[_0xfda1('0x3c')]);return db[_0xfda1('0x59')][_0xfda1('0x19')]({'where':_0x1226d6[_0xfda1('0x37')]})['then'](function(_0x216034){_0xc23e0d[_0xfda1('0x19')]=_0x216034;if(_0x28f7b7[_0xfda1('0x2d')]['includeAll']){_0x1226d6['include']=[{'all':!![]}];}return db[_0xfda1('0x59')]['findAll'](_0x1226d6);})[_0xfda1('0x20')](function(_0x3bb722){_0xc23e0d['rows']=_0x3bb722;return _0xc23e0d;});}})[_0xfda1('0x20')](respondWithFilteredResult(_0x5dabcb,_0x1226d6))[_0xfda1('0x4d')](handleError(_0x5dabcb,null));};exports[_0xfda1('0x5a')]=function(_0x20656c,_0x3842f5,_0x2708e2){var _0x323733={'raw':!![],'where':{}};var _0x56e4dc={};var _0x2a1ee0={'count':0x0,'rows':[]};return db['Campaign'][_0xfda1('0x53')]({'where':{'id':_0x20656c[_0xfda1('0x42')]['id']}})['then'](handleEntityNotFound(_0x3842f5,null))['then'](function(_0xcac1d){if(_0xcac1d){_0x56e4dc[_0xfda1('0x31')]=_[_0xfda1('0x2e')](db[_0xfda1('0x5b')]['rawAttributes']);_0x56e4dc[_0xfda1('0x2d')]=_[_0xfda1('0x2e')](_0x20656c[_0xfda1('0x2d')]);_0x56e4dc[_0xfda1('0x2f')]=_[_0xfda1('0x30')](_0x56e4dc[_0xfda1('0x31')],_0x56e4dc[_0xfda1('0x2d')]);_0x323733['attributes']=_['intersection'](_0x56e4dc[_0xfda1('0x31')],qs['fields'](_0x20656c[_0xfda1('0x2d')][_0xfda1('0x33')]));_0x323733[_0xfda1('0x32')]=_0x323733['attributes'][_0xfda1('0x34')]?_0x323733[_0xfda1('0x32')]:_0x56e4dc[_0xfda1('0x31')];if(!_0x20656c[_0xfda1('0x2d')][_0xfda1('0x35')](_0xfda1('0x36'))){_0x323733[_0xfda1('0x1a')]=qs[_0xfda1('0x1a')](_0x20656c[_0xfda1('0x2d')][_0xfda1('0x1a')]);_0x323733['offset']=qs[_0xfda1('0x17')](_0x20656c[_0xfda1('0x2d')]['offset']);}_0x323733[_0xfda1('0x55')]=qs[_0xfda1('0x56')](_0x20656c[_0xfda1('0x2d')][_0xfda1('0x56')]);_0x323733['where']=qs[_0xfda1('0x2f')](_[_0xfda1('0x38')](_0x20656c[_0xfda1('0x2d')],_0x56e4dc[_0xfda1('0x2f')]));_0x323733['where'][_0xfda1('0x57')]=_0xcac1d['id'];if(_0x20656c[_0xfda1('0x2d')][_0xfda1('0x39')]){_0x323733['where']=_[_0xfda1('0x3a')](_0x323733[_0xfda1('0x37')],{'$or':_[_0xfda1('0x2c')](_0x323733[_0xfda1('0x32')],function(_0xff09fd){var _0x231e27={};_0x231e27[_0xff09fd]={'$like':'%'+_0x20656c[_0xfda1('0x2d')][_0xfda1('0x39')]+'%'};return _0x231e27;})});}_0x323733=_['merge']({},_0x323733,_0x20656c[_0xfda1('0x3c')]);return db[_0xfda1('0x5b')][_0xfda1('0x19')]({'where':_0x323733[_0xfda1('0x37')]})['then'](function(_0x346707){_0x2a1ee0[_0xfda1('0x19')]=_0x346707;if(_0x20656c['query']['includeAll']){_0x323733[_0xfda1('0x43')]=[{'all':!![]}];}return db[_0xfda1('0x5b')][_0xfda1('0x3f')](_0x323733);})[_0xfda1('0x20')](function(_0x366373){_0x2a1ee0[_0xfda1('0x40')]=_0x366373;return _0x2a1ee0;});}})[_0xfda1('0x20')](respondWithFilteredResult(_0x3842f5,_0x323733))[_0xfda1('0x4d')](handleError(_0x3842f5,null));};exports[_0xfda1('0x5c')]=function(_0x51e717,_0x2037e0,_0x3722b0){var _0x456090={'raw':!![],'where':{}};var _0x2358c7={};var _0x5317b0={'count':0x0,'rows':[]};return db['Campaign'][_0xfda1('0x53')]({'where':{'id':_0x51e717[_0xfda1('0x42')]['id']}})[_0xfda1('0x20')](handleEntityNotFound(_0x2037e0,null))[_0xfda1('0x20')](function(_0x175cd9){if(_0x175cd9){_0x2358c7[_0xfda1('0x31')]=_[_0xfda1('0x2e')](db[_0xfda1('0x5d')][_0xfda1('0x28')]);_0x2358c7[_0xfda1('0x2d')]=_['keys'](_0x51e717[_0xfda1('0x2d')]);_0x2358c7[_0xfda1('0x2f')]=_['intersection'](_0x2358c7[_0xfda1('0x31')],_0x2358c7[_0xfda1('0x2d')]);_0x456090[_0xfda1('0x32')]=_['intersection'](_0x2358c7[_0xfda1('0x31')],qs['fields'](_0x51e717[_0xfda1('0x2d')][_0xfda1('0x33')]));_0x456090[_0xfda1('0x32')]=_0x456090[_0xfda1('0x32')][_0xfda1('0x34')]?_0x456090[_0xfda1('0x32')]:_0x2358c7[_0xfda1('0x31')];if(!_0x51e717[_0xfda1('0x2d')]['hasOwnProperty'](_0xfda1('0x36'))){_0x456090[_0xfda1('0x1a')]=qs[_0xfda1('0x1a')](_0x51e717[_0xfda1('0x2d')]['limit']);_0x456090[_0xfda1('0x17')]=qs[_0xfda1('0x17')](_0x51e717['query']['offset']);}_0x456090[_0xfda1('0x55')]=qs[_0xfda1('0x56')](_0x51e717[_0xfda1('0x2d')][_0xfda1('0x56')]);_0x456090[_0xfda1('0x37')]=qs['filters'](_[_0xfda1('0x38')](_0x51e717[_0xfda1('0x2d')],_0x2358c7[_0xfda1('0x2f')]));_0x456090[_0xfda1('0x37')][_0xfda1('0x57')]=_0x175cd9['id'];if(_0x51e717[_0xfda1('0x2d')][_0xfda1('0x39')]){_0x456090[_0xfda1('0x37')]=_[_0xfda1('0x3a')](_0x456090[_0xfda1('0x37')],{'$or':_[_0xfda1('0x2c')](_0x456090[_0xfda1('0x32')],function(_0x3189d8){var _0x141356={};_0x141356[_0x3189d8]={'$like':'%'+_0x51e717[_0xfda1('0x2d')][_0xfda1('0x39')]+'%'};return _0x141356;})});}_0x456090=_[_0xfda1('0x3a')]({},_0x456090,_0x51e717[_0xfda1('0x3c')]);return db['CmHopperBlack'][_0xfda1('0x19')]({'where':_0x456090[_0xfda1('0x37')]})[_0xfda1('0x20')](function(_0x586045){_0x5317b0[_0xfda1('0x19')]=_0x586045;if(_0x51e717['query'][_0xfda1('0x3e')]){_0x456090['include']=[{'all':!![]}];}return db[_0xfda1('0x5d')]['findAll'](_0x456090);})[_0xfda1('0x20')](function(_0x371e68){_0x5317b0['rows']=_0x371e68;return _0x5317b0;});}})['then'](respondWithFilteredResult(_0x2037e0,_0x456090))[_0xfda1('0x4d')](handleError(_0x2037e0,null));};exports[_0xfda1('0x5e')]=function(_0x1a661a,_0x2da6ad,_0x4d2817){var _0x53bbbb={};var _0x186eca={};var _0x13c555;var _0xabcb6a;return db[_0xfda1('0x3d')]['findOne']({'where':{'id':_0x1a661a['params']['id']}})['then'](handleEntityNotFound(_0x2da6ad,null))[_0xfda1('0x20')](function(_0x1eb2bb){if(_0x1eb2bb){_0x13c555=_0x1eb2bb;_0x186eca[_0xfda1('0x31')]=_[_0xfda1('0x2e')](db[_0xfda1('0x5f')][_0xfda1('0x28')]);_0x186eca[_0xfda1('0x2d')]=_[_0xfda1('0x2e')](_0x1a661a[_0xfda1('0x2d')]);_0x186eca[_0xfda1('0x2f')]=_['intersection'](_0x186eca[_0xfda1('0x31')],_0x186eca[_0xfda1('0x2d')]);_0x53bbbb[_0xfda1('0x32')]=_[_0xfda1('0x30')](_0x186eca[_0xfda1('0x31')],qs[_0xfda1('0x33')](_0x1a661a[_0xfda1('0x2d')][_0xfda1('0x33')]));_0x53bbbb[_0xfda1('0x32')]=_0x53bbbb[_0xfda1('0x32')][_0xfda1('0x34')]?_0x53bbbb[_0xfda1('0x32')]:_0x186eca['model'];_0x53bbbb[_0xfda1('0x55')]=qs[_0xfda1('0x56')](_0x1a661a[_0xfda1('0x2d')][_0xfda1('0x56')]);_0x53bbbb[_0xfda1('0x37')]=qs['filters'](_[_0xfda1('0x38')](_0x1a661a[_0xfda1('0x2d')],_0x186eca[_0xfda1('0x2f')]));if(_0x1a661a[_0xfda1('0x2d')][_0xfda1('0x39')]){_0x53bbbb[_0xfda1('0x37')]=_[_0xfda1('0x3a')](_0x53bbbb[_0xfda1('0x37')],{'$or':_[_0xfda1('0x2c')](_0x53bbbb['attributes'],function(_0x41f1bd){var _0x2d7122={};_0x2d7122[_0x41f1bd]={'$like':'%'+_0x1a661a['query'][_0xfda1('0x39')]+'%'};return _0x2d7122;})});}_0x53bbbb=_[_0xfda1('0x3a')]({},_0x53bbbb,_0x1a661a['options']);return _0x13c555[_0xfda1('0x5e')](_0x53bbbb);}})[_0xfda1('0x20')](function(_0x3946c9){if(_0x3946c9){_0xabcb6a=_0x3946c9[_0xfda1('0x34')];if(!_0x1a661a['query'][_0xfda1('0x35')](_0xfda1('0x36'))){_0x53bbbb[_0xfda1('0x1a')]=qs[_0xfda1('0x1a')](_0x1a661a[_0xfda1('0x2d')][_0xfda1('0x1a')]);_0x53bbbb[_0xfda1('0x17')]=qs['offset'](_0x1a661a[_0xfda1('0x2d')]['offset']);}return _0x13c555['getLists'](_0x53bbbb);}})['then'](function(_0x13d9ad){if(_0x13d9ad){return _0x13d9ad?{'count':_0xabcb6a,'rows':_0x13d9ad}:null;}})['then'](respondWithResult(_0x2da6ad,null))['catch'](handleError(_0x2da6ad,null));};exports[_0xfda1('0x60')]=function(_0x49bd16,_0xa28285,_0xc79d45){var _0x1fcb57,_0x39e345;return db['Campaign'][_0xfda1('0x44')]({'where':{'id':_0x49bd16[_0xfda1('0x42')]['id']}})[_0xfda1('0x20')](handleEntityNotFound(_0xa28285,null))[_0xfda1('0x20')](function(_0x23999d){if(_0x23999d){_0x39e345=_0x23999d;return _0x23999d[_0xfda1('0x60')](_0x49bd16[_0xfda1('0x46')]['ids'],_[_0xfda1('0x61')](_0x49bd16[_0xfda1('0x46')],[_0xfda1('0x62'),'id'])||{});}return null;})['spread'](function(_0x1257fd){var _0x55fbc3;_0x1fcb57=_0x1257fd||[];var _0x3e9446=[];if(_0x1257fd){for(var _0x8f822=0x0;_0x8f822<_0x1257fd['length'];_0x8f822+=0x1){var _0x1a4a40=_0x1257fd[_0x8f822][_0xfda1('0x21')]({'plain':!![]});_0x39e345[_0xfda1('0x63')]=_0x49bd16[_0xfda1('0x46')]['dialCheckDuplicateType']?_0x49bd16[_0xfda1('0x46')][_0xfda1('0x63')]:_0x39e345['dialCheckDuplicateType'];switch(_0x39e345[_0xfda1('0x63')]){case _0xfda1('0x64'):_0x55fbc3=squel[_0xfda1('0x65')]()[_0xfda1('0x66')]('cm_hopper')[_0xfda1('0x67')]([_0xfda1('0x68'),_0xfda1('0x69'),_0xfda1('0x6a'),_0xfda1('0x6b'),_0xfda1('0x57'),_0xfda1('0x4f'),_0xfda1('0x50')],squel[_0xfda1('0x6c')]()[_0xfda1('0x6d')]('phone',_0xfda1('0x68'))['field']('NOW()',_0xfda1('0x69'))['field']('id',_0xfda1('0x6a'))[_0xfda1('0x6d')](_0x1a4a40[_0xfda1('0x6e')]['toString'](),'ListId')[_0xfda1('0x6d')](_0x49bd16[_0xfda1('0x42')]['id'][_0xfda1('0x6f')](),'CampaignId')[_0xfda1('0x6d')](_0xfda1('0x70'),'createdAt')['field'](_0xfda1('0x70'),'updatedAt')[_0xfda1('0x71')]('cm_contacts')[_0xfda1('0x37')]('deletedAt\x20IS\x20NULL')['where'](_0xfda1('0x72'),_0x1a4a40['CmListId'][_0xfda1('0x6f')]())[_0xfda1('0x37')](_0xfda1('0x73'))[_0xfda1('0x37')]('phone\x20NOT\x20IN\x20(?)',squel[_0xfda1('0x6c')]()[_0xfda1('0x6d')](_0xfda1('0x74'))[_0xfda1('0x71')]('cm_hopper_final')[_0xfda1('0x37')](_0xfda1('0x75'),_0x49bd16[_0xfda1('0x42')]['id'][_0xfda1('0x6f')]()))['where'](_0xfda1('0x76'),squel[_0xfda1('0x6c')]()[_0xfda1('0x6d')]('COALESCE(phone,\x27\x27)')[_0xfda1('0x71')]('cm_hopper')[_0xfda1('0x37')]('CampaignId\x20=\x20?',_0x49bd16[_0xfda1('0x42')]['id']['toString']())))['toString']();break;case _0xfda1('0x77'):_0x55fbc3=squel[_0xfda1('0x65')]()[_0xfda1('0x66')](_0xfda1('0x78'))[_0xfda1('0x67')]([_0xfda1('0x68'),_0xfda1('0x69'),_0xfda1('0x6a'),_0xfda1('0x6b'),_0xfda1('0x57'),_0xfda1('0x4f'),_0xfda1('0x50')],squel[_0xfda1('0x6c')]()['field'](_0xfda1('0x68'),_0xfda1('0x68'))['field']('NOW()',_0xfda1('0x69'))[_0xfda1('0x6d')]('id',_0xfda1('0x6a'))[_0xfda1('0x6d')](_0x1a4a40['CmListId'][_0xfda1('0x6f')](),_0xfda1('0x6b'))[_0xfda1('0x6d')](_0x49bd16[_0xfda1('0x42')]['id'][_0xfda1('0x6f')](),_0xfda1('0x57'))['field'](_0xfda1('0x70'),_0xfda1('0x4f'))['field'](_0xfda1('0x70'),'updatedAt')['from']('cm_contacts')['where'](_0xfda1('0x79'))['where'](_0xfda1('0x72'),_0x1a4a40[_0xfda1('0x6e')][_0xfda1('0x6f')]())['where'](_0xfda1('0x73'))[_0xfda1('0x37')](_0xfda1('0x76'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xfda1('0x71')]('cm_hopper')[_0xfda1('0x37')](_0xfda1('0x75'),_0x49bd16[_0xfda1('0x42')]['id']['toString']())))[_0xfda1('0x6f')]();break;default:_0x55fbc3=squel[_0xfda1('0x65')]()[_0xfda1('0x66')]('cm_hopper')[_0xfda1('0x67')]([_0xfda1('0x68'),_0xfda1('0x69'),'ContactId',_0xfda1('0x6b'),_0xfda1('0x57'),_0xfda1('0x4f'),_0xfda1('0x50')],squel[_0xfda1('0x6c')]()[_0xfda1('0x6d')](_0xfda1('0x68'),'phone')['field'](_0xfda1('0x70'),_0xfda1('0x69'))['field']('id',_0xfda1('0x6a'))['field'](_0x1a4a40['CmListId']['toString'](),_0xfda1('0x6b'))[_0xfda1('0x6d')](_0x49bd16[_0xfda1('0x42')]['id'][_0xfda1('0x6f')](),_0xfda1('0x57'))[_0xfda1('0x6d')](_0xfda1('0x70'),'createdAt')[_0xfda1('0x6d')](_0xfda1('0x70'),_0xfda1('0x50'))[_0xfda1('0x71')](_0xfda1('0x7a'))[_0xfda1('0x37')](_0xfda1('0x79'))[_0xfda1('0x37')](_0xfda1('0x72'),_0x1a4a40[_0xfda1('0x6e')][_0xfda1('0x6f')]())[_0xfda1('0x37')](_0xfda1('0x73')))['toString']();}_0x3e9446['push'](db[_0xfda1('0x7b')][_0xfda1('0x2d')](_0x55fbc3));}return BPromise['all'](_0x3e9446);}})[_0xfda1('0x20')](function(){return _0x1fcb57;})[_0xfda1('0x20')](respondWithResult(_0xa28285,null))[_0xfda1('0x4d')](handleError(_0xa28285,null));};exports[_0xfda1('0x7c')]=function(_0x896fd2,_0x463636,_0x4af225){return db['Campaign'][_0xfda1('0x44')]({'where':{'id':_0x896fd2[_0xfda1('0x42')]['id']}})[_0xfda1('0x20')](handleEntityNotFound(_0x463636,null))[_0xfda1('0x20')](function(_0x397b9f){if(_0x397b9f){return _0x397b9f[_0xfda1('0x7c')](_0x896fd2[_0xfda1('0x2d')][_0xfda1('0x62')]);}})['then'](function(_0x46d6e4){if(_0x46d6e4){return db[_0xfda1('0x54')][_0xfda1('0x52')]({'where':{'ListId':_0x896fd2[_0xfda1('0x2d')][_0xfda1('0x62')],'CampaignId':_0x896fd2[_0xfda1('0x42')]['id']}})['then'](function(){return _0x46d6e4;});}})[_0xfda1('0x20')](respondWithStatusCode(_0x463636,null))[_0xfda1('0x4d')](handleError(_0x463636,null));};exports[_0xfda1('0x7d')]=function(_0x5656d8,_0x28b816,_0x33e9a4){var _0x58acef={};var _0x175d00={};var _0x481301;var _0x1c61bc;return db['Campaign'][_0xfda1('0x53')]({'where':{'id':_0x5656d8[_0xfda1('0x42')]['id']}})['then'](handleEntityNotFound(_0x28b816,null))[_0xfda1('0x20')](function(_0x347c1a){if(_0x347c1a){_0x481301=_0x347c1a;_0x175d00['model']=_[_0xfda1('0x2e')](db[_0xfda1('0x5f')][_0xfda1('0x28')]);_0x175d00[_0xfda1('0x2d')]=_[_0xfda1('0x2e')](_0x5656d8[_0xfda1('0x2d')]);_0x175d00['filters']=_[_0xfda1('0x30')](_0x175d00[_0xfda1('0x31')],_0x175d00[_0xfda1('0x2d')]);_0x58acef[_0xfda1('0x32')]=_[_0xfda1('0x30')](_0x175d00[_0xfda1('0x31')],qs[_0xfda1('0x33')](_0x5656d8[_0xfda1('0x2d')][_0xfda1('0x33')]));_0x58acef[_0xfda1('0x32')]=_0x58acef[_0xfda1('0x32')][_0xfda1('0x34')]?_0x58acef[_0xfda1('0x32')]:_0x175d00[_0xfda1('0x31')];_0x58acef[_0xfda1('0x55')]=qs[_0xfda1('0x56')](_0x5656d8[_0xfda1('0x2d')]['sort']);_0x58acef[_0xfda1('0x37')]=qs[_0xfda1('0x2f')](_[_0xfda1('0x38')](_0x5656d8[_0xfda1('0x2d')],_0x175d00[_0xfda1('0x2f')]));if(_0x5656d8[_0xfda1('0x2d')][_0xfda1('0x39')]){_0x58acef[_0xfda1('0x37')]=_[_0xfda1('0x3a')](_0x58acef[_0xfda1('0x37')],{'$or':_[_0xfda1('0x2c')](_0x58acef['attributes'],function(_0x2cacee){var _0x298b94={};_0x298b94[_0x2cacee]={'$like':'%'+_0x5656d8['query'][_0xfda1('0x39')]+'%'};return _0x298b94;})});}_0x58acef=_['merge']({},_0x58acef,_0x5656d8['options']);return _0x481301[_0xfda1('0x7d')](_0x58acef);}})[_0xfda1('0x20')](function(_0x24f990){if(_0x24f990){_0x1c61bc=_0x24f990[_0xfda1('0x34')];if(!_0x5656d8[_0xfda1('0x2d')][_0xfda1('0x35')](_0xfda1('0x36'))){_0x58acef[_0xfda1('0x1a')]=qs[_0xfda1('0x1a')](_0x5656d8[_0xfda1('0x2d')][_0xfda1('0x1a')]);_0x58acef[_0xfda1('0x17')]=qs[_0xfda1('0x17')](_0x5656d8[_0xfda1('0x2d')]['offset']);}return _0x481301[_0xfda1('0x7d')](_0x58acef);}})[_0xfda1('0x20')](function(_0x2a82ee){if(_0x2a82ee){return _0x2a82ee?{'count':_0x1c61bc,'rows':_0x2a82ee}:null;}})['then'](respondWithResult(_0x28b816,null))[_0xfda1('0x4d')](handleError(_0x28b816,null));};exports[_0xfda1('0x7e')]=function(_0xeb06d0,_0x30151f,_0xe504c9){var _0x3771f6,_0x1d8b9e;return db[_0xfda1('0x3d')][_0xfda1('0x44')]({'where':{'id':_0xeb06d0[_0xfda1('0x42')]['id']}})['then'](handleEntityNotFound(_0x30151f,null))[_0xfda1('0x20')](function(_0x25edc5){if(_0x25edc5){_0x1d8b9e=_0x25edc5;return _0x25edc5[_0xfda1('0x7e')](_0xeb06d0['body'][_0xfda1('0x62')],_[_0xfda1('0x61')](_0xeb06d0['body'],['ids','id'])||{});}return null;})[_0xfda1('0x7f')](function(_0x52d3c0){var _0x6cfb86;_0x3771f6=_0x52d3c0||[];var _0x502366=[];if(_0x52d3c0){for(var _0x17d471=0x0;_0x17d471<_0x52d3c0[_0xfda1('0x34')];_0x17d471+=0x1){var _0x2ebe82=_0x52d3c0[_0x17d471][_0xfda1('0x21')]({'plain':!![]});_0x6cfb86=squel[_0xfda1('0x65')]()[_0xfda1('0x66')](_0xfda1('0x80'))[_0xfda1('0x67')]([_0xfda1('0x68'),_0xfda1('0x6a'),_0xfda1('0x6b'),'CampaignId','createdAt','updatedAt'],squel['select']()['field'](_0xfda1('0x68'),_0xfda1('0x68'))[_0xfda1('0x6d')]('id','ContactId')[_0xfda1('0x6d')](_0x2ebe82['CmListId'][_0xfda1('0x6f')](),_0xfda1('0x6b'))['field'](_0xeb06d0[_0xfda1('0x42')]['id'][_0xfda1('0x6f')](),'CampaignId')[_0xfda1('0x6d')](_0xfda1('0x70'),_0xfda1('0x4f'))[_0xfda1('0x6d')](_0xfda1('0x70'),_0xfda1('0x50'))[_0xfda1('0x71')](_0xfda1('0x7a'))['where'](_0xfda1('0x79'))[_0xfda1('0x37')](_0xfda1('0x72'),_0x2ebe82[_0xfda1('0x6e')][_0xfda1('0x6f')]())[_0xfda1('0x37')](_0xfda1('0x73')))[_0xfda1('0x6f')]();_0x502366[_0xfda1('0x81')](db[_0xfda1('0x7b')][_0xfda1('0x2d')](_0x6cfb86));}return BPromise[_0xfda1('0x82')](_0x502366);}})[_0xfda1('0x20')](function(){return _0x3771f6;})[_0xfda1('0x20')](respondWithResult(_0x30151f,null))[_0xfda1('0x4d')](handleError(_0x30151f,null));};exports['removeBlackLists']=function(_0x208d4f,_0x1a55c3,_0x35ec31){return db['Campaign']['find']({'where':{'id':_0x208d4f[_0xfda1('0x42')]['id']}})['then'](handleEntityNotFound(_0x1a55c3,null))[_0xfda1('0x20')](function(_0x4751f2){if(_0x4751f2){return _0x4751f2[_0xfda1('0x83')](_0x208d4f[_0xfda1('0x2d')][_0xfda1('0x62')]);}})[_0xfda1('0x20')](function(_0x308426){if(_0x308426){return db[_0xfda1('0x5d')][_0xfda1('0x52')]({'where':{'ListId':_0x208d4f[_0xfda1('0x2d')][_0xfda1('0x62')],'CampaignId':_0x208d4f['params']['id']}})['then'](function(){return _0x308426;});}})['then'](respondWithStatusCode(_0x1a55c3,null))[_0xfda1('0x4d')](handleError(_0x1a55c3,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 6cf95a8..e70c844 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x1fe559,_0x25fba7){var _0xb5b18c=function(_0x5ca09d){while(--_0x5ca09d){_0x1fe559['push'](_0x1fe559['shift']());}};_0xb5b18c(++_0x25fba7);}(_0x7a54,0x106));var _0x47a5=function(_0x2eb8da,_0x479034){_0x2eb8da=_0x2eb8da-0x0;var _0x199549=_0x7a54[_0x2eb8da];return _0x199549;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x29e314,_0x19d592){var _0x4c9fcb=function(_0xcb1c9){while(--_0xcb1c9){_0x29e314['push'](_0x29e314['shift']());}};_0x4c9fcb(++_0x19d592);}(_0x7a54,0x106));var _0x47a5=function(_0xefb616,_0x59ab51){_0xefb616=_0xefb616-0x0;var _0x73dc21=_0x7a54[_0xefb616];return _0x73dc21;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index ec51be9..702272d 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 _0x98b8=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','Campaign','findAll','options','raw','where','limit','include','map','model','attributes','GetCampaign','lodash'];(function(_0x252ef1,_0x2e0041){var _0x25817c=function(_0x243776){while(--_0x243776){_0x252ef1['push'](_0x252ef1['shift']());}};_0x25817c(++_0x2e0041);}(_0x98b8,0x93));var _0x898b=function(_0x5baa4e,_0x2f8166){_0x5baa4e=_0x5baa4e-0x0;var _0x29a9f8=_0x98b8[_0x5baa4e];return _0x29a9f8;};'use strict';var _=require(_0x898b('0x0'));var util=require(_0x898b('0x1'));var moment=require(_0x898b('0x2'));var BPromise=require(_0x898b('0x3'));var rs=require(_0x898b('0x4'));var fs=require('fs');var Redis=require(_0x898b('0x5'));var db=require(_0x898b('0x6'))['db'];var utils=require(_0x898b('0x7'));var logger=require(_0x898b('0x8'))(_0x898b('0x9'));var config=require(_0x898b('0xa'));var jayson=require(_0x898b('0xb'));var client=jayson[_0x898b('0xc')][_0x898b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x124030,_0x4e9410,_0x3989f9){return new BPromise(function(_0x32e2e,_0x4220a7){return client[_0x898b('0xe')](_0x124030,_0x3989f9)[_0x898b('0xf')](function(_0x46118b){logger[_0x898b('0x10')](_0x898b('0x11'),_0x4e9410,'request\x20sent');logger[_0x898b('0x12')]('Campaign,\x20%s,\x20%s,\x20%s',_0x4e9410,'request\x20sent',JSON[_0x898b('0x13')](_0x46118b));if(_0x46118b[_0x898b('0x14')]){if(_0x46118b[_0x898b('0x14')][_0x898b('0x15')]===0x1f4){logger[_0x898b('0x14')](_0x898b('0x11'),_0x4e9410,_0x46118b[_0x898b('0x14')][_0x898b('0x16')]);return _0x4220a7(_0x46118b[_0x898b('0x14')][_0x898b('0x16')]);}logger[_0x898b('0x14')](_0x898b('0x11'),_0x4e9410,_0x46118b['error'][_0x898b('0x16')]);return _0x32e2e(_0x46118b[_0x898b('0x14')][_0x898b('0x16')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x4e9410,_0x898b('0x17'));_0x32e2e(_0x46118b[_0x898b('0x18')][_0x898b('0x16')]);}})[_0x898b('0x19')](function(_0x54cd3b){logger[_0x898b('0x14')]('Campaign,\x20%s,\x20%s',_0x4e9410,_0x54cd3b);_0x4220a7(_0x54cd3b);});});}exports['GetCampaign']=function(_0x3ad191){var _0x250349=this;return new Promise(function(_0x3f001a,_0x4b1a40){return db[_0x898b('0x1a')][_0x898b('0x1b')]({'raw':_0x3ad191[_0x898b('0x1c')]?_0x3ad191[_0x898b('0x1c')][_0x898b('0x1d')]===undefined?!![]:![]:!![],'where':_0x3ad191[_0x898b('0x1c')]?_0x3ad191[_0x898b('0x1c')][_0x898b('0x1e')]||null:null,'attributes':_0x3ad191[_0x898b('0x1c')]?_0x3ad191[_0x898b('0x1c')]['attributes']||null:null,'limit':_0x3ad191['options']?_0x3ad191[_0x898b('0x1c')][_0x898b('0x1f')]||null:null,'include':_0x3ad191['options']?_0x3ad191[_0x898b('0x1c')][_0x898b('0x20')]?_[_0x898b('0x21')](_0x3ad191['options']['include'],function(_0x66101f){return{'model':db[_0x66101f[_0x898b('0x22')]],'as':_0x66101f['as'],'attributes':_0x66101f[_0x898b('0x23')],'include':_0x66101f[_0x898b('0x20')]?_[_0x898b('0x21')](_0x66101f[_0x898b('0x20')],function(_0x11c558){return{'model':db[_0x11c558[_0x898b('0x22')]],'as':_0x11c558['as'],'attributes':_0x11c558[_0x898b('0x23')],'include':_0x11c558[_0x898b('0x20')]?_[_0x898b('0x21')](_0x11c558[_0x898b('0x20')],function(_0x163a6c){return{'model':db[_0x163a6c['model']],'as':_0x163a6c['as'],'attributes':_0x163a6c['attributes']};}):[]};}):[]};}):[]:[]})[_0x898b('0xf')](function(_0xb5c11){logger[_0x898b('0x10')](_0x898b('0x24'),_0x3ad191);logger[_0x898b('0x12')](_0x898b('0x24'),_0x3ad191,JSON[_0x898b('0x13')](_0xb5c11));_0x3f001a(_0xb5c11);})[_0x898b('0x19')](function(_0x320237){logger[_0x898b('0x14')]('GetCampaign',_0x320237['message'],_0x3ad191);_0x4b1a40(_0x250349[_0x898b('0x14')](0x1f4,_0x320237[_0x898b('0x16')]));});});}; \ No newline at end of file +var _0x8b2b=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','stringify','error','code','Campaign,\x20%s,\x20%s','message','catch','Campaign','options','raw','where','attributes','limit','include','model','map','GetCampaign','debug'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x3b6a77,_0xfef86b){_0x3b6a77=_0x3b6a77-0x0;var _0x2c1e2a=_0x8b2b[_0x3b6a77];return _0x2c1e2a;};'use strict';var _=require(_0xb8b2('0x0'));var util=require(_0xb8b2('0x1'));var moment=require(_0xb8b2('0x2'));var BPromise=require('bluebird');var rs=require(_0xb8b2('0x3'));var fs=require('fs');var Redis=require(_0xb8b2('0x4'));var db=require(_0xb8b2('0x5'))['db'];var utils=require(_0xb8b2('0x6'));var logger=require(_0xb8b2('0x7'))(_0xb8b2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb8b2('0x9')][_0xb8b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0032,_0x3590c8,_0x4a4c69){return new BPromise(function(_0x541b1b,_0x310a57){return client[_0xb8b2('0xb')](_0x2f0032,_0x4a4c69)[_0xb8b2('0xc')](function(_0xe429f2){logger[_0xb8b2('0xd')]('Campaign,\x20%s,\x20%s',_0x3590c8,_0xb8b2('0xe'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x3590c8,_0xb8b2('0xe'),JSON[_0xb8b2('0xf')](_0xe429f2));if(_0xe429f2[_0xb8b2('0x10')]){if(_0xe429f2[_0xb8b2('0x10')][_0xb8b2('0x11')]===0x1f4){logger[_0xb8b2('0x10')]('Campaign,\x20%s,\x20%s',_0x3590c8,_0xe429f2[_0xb8b2('0x10')]['message']);return _0x310a57(_0xe429f2['error']['message']);}logger[_0xb8b2('0x10')](_0xb8b2('0x12'),_0x3590c8,_0xe429f2['error'][_0xb8b2('0x13')]);return _0x541b1b(_0xe429f2[_0xb8b2('0x10')][_0xb8b2('0x13')]);}else{logger[_0xb8b2('0xd')](_0xb8b2('0x12'),_0x3590c8,'request\x20sent');_0x541b1b(_0xe429f2['result'][_0xb8b2('0x13')]);}})[_0xb8b2('0x14')](function(_0x3fab0a){logger[_0xb8b2('0x10')](_0xb8b2('0x12'),_0x3590c8,_0x3fab0a);_0x310a57(_0x3fab0a);});});}exports['GetCampaign']=function(_0x47b94f){var _0x129341=this;return new Promise(function(_0x153b69,_0x18661d){return db[_0xb8b2('0x15')]['findAll']({'raw':_0x47b94f[_0xb8b2('0x16')]?_0x47b94f[_0xb8b2('0x16')][_0xb8b2('0x17')]===undefined?!![]:![]:!![],'where':_0x47b94f[_0xb8b2('0x16')]?_0x47b94f[_0xb8b2('0x16')][_0xb8b2('0x18')]||null:null,'attributes':_0x47b94f[_0xb8b2('0x16')]?_0x47b94f['options'][_0xb8b2('0x19')]||null:null,'limit':_0x47b94f[_0xb8b2('0x16')]?_0x47b94f[_0xb8b2('0x16')][_0xb8b2('0x1a')]||null:null,'include':_0x47b94f[_0xb8b2('0x16')]?_0x47b94f['options'][_0xb8b2('0x1b')]?_['map'](_0x47b94f[_0xb8b2('0x16')][_0xb8b2('0x1b')],function(_0x2b40f8){return{'model':db[_0x2b40f8[_0xb8b2('0x1c')]],'as':_0x2b40f8['as'],'attributes':_0x2b40f8['attributes'],'include':_0x2b40f8[_0xb8b2('0x1b')]?_[_0xb8b2('0x1d')](_0x2b40f8[_0xb8b2('0x1b')],function(_0x5a2afe){return{'model':db[_0x5a2afe['model']],'as':_0x5a2afe['as'],'attributes':_0x5a2afe['attributes'],'include':_0x5a2afe['include']?_[_0xb8b2('0x1d')](_0x5a2afe[_0xb8b2('0x1b')],function(_0x3bdb27){return{'model':db[_0x3bdb27[_0xb8b2('0x1c')]],'as':_0x3bdb27['as'],'attributes':_0x3bdb27[_0xb8b2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb8b2('0xc')](function(_0x3f3424){logger[_0xb8b2('0xd')](_0xb8b2('0x1e'),_0x47b94f);logger[_0xb8b2('0x1f')](_0xb8b2('0x1e'),_0x47b94f,JSON[_0xb8b2('0xf')](_0x3f3424));_0x153b69(_0x3f3424);})[_0xb8b2('0x14')](function(_0xeb28c8){logger[_0xb8b2('0x10')](_0xb8b2('0x1e'),_0xeb28c8[_0xb8b2('0x13')],_0x47b94f);_0x18661d(_0x129341['error'](0x1f4,_0xeb28c8[_0xb8b2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 5dcd7db..a7434c4 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 _0x5cd2=['update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','/:id/blacklists','post','create','clone','/:id/lists','addBlackLists'];(function(_0x3cb21e,_0x11849a){var _0xeacd6a=function(_0xef5a2e){while(--_0xef5a2e){_0x3cb21e['push'](_0x3cb21e['shift']());}};_0xeacd6a(++_0x11849a);}(_0x5cd2,0xee));var _0x25cd=function(_0x303cbf,_0x330533){_0x303cbf=_0x303cbf-0x0;var _0x5c3524=_0x5cd2[_0x303cbf];return _0x5c3524;};'use strict';var multer=require(_0x25cd('0x0'));var util=require(_0x25cd('0x1'));var path=require(_0x25cd('0x2'));var timeout=require(_0x25cd('0x3'));var express=require('express');var router=express[_0x25cd('0x4')]();var fs_extra=require(_0x25cd('0x5'));var auth=require(_0x25cd('0x6'));var interaction=require(_0x25cd('0x7'));var config=require('../../config/environment');var controller=require(_0x25cd('0x8'));router[_0x25cd('0x9')]('/',auth[_0x25cd('0xa')](),controller[_0x25cd('0xb')]);router[_0x25cd('0x9')](_0x25cd('0xc'),auth[_0x25cd('0xa')](),controller['show']);router[_0x25cd('0x9')]('/:id/hoppers',auth[_0x25cd('0xa')](),controller['getHoppers']);router[_0x25cd('0x9')](_0x25cd('0xd'),auth[_0x25cd('0xa')](),controller[_0x25cd('0xe')]);router['get'](_0x25cd('0xf'),auth[_0x25cd('0xa')](),controller['getHopperFinals']);router[_0x25cd('0x9')](_0x25cd('0x10'),auth[_0x25cd('0xa')](),controller['getHopperBlacks']);router[_0x25cd('0x9')]('/:id/lists',auth[_0x25cd('0xa')](),controller['getLists']);router[_0x25cd('0x9')](_0x25cd('0x11'),auth[_0x25cd('0xa')](),controller['getBlackLists']);router[_0x25cd('0x12')]('/',auth[_0x25cd('0xa')](),controller[_0x25cd('0x13')]);router[_0x25cd('0x12')]('/:id/clone',auth['isAuthenticated'](),controller[_0x25cd('0x14')]);router[_0x25cd('0x12')](_0x25cd('0x15'),auth['isAuthenticated'](),controller['addLists']);router[_0x25cd('0x12')](_0x25cd('0x11'),auth[_0x25cd('0xa')](),controller[_0x25cd('0x16')]);router['put'](_0x25cd('0xc'),auth[_0x25cd('0xa')](),controller[_0x25cd('0x17')]);router[_0x25cd('0x18')]('/:id',auth[_0x25cd('0xa')](),controller[_0x25cd('0x19')]);router[_0x25cd('0x18')](_0x25cd('0x15'),auth[_0x25cd('0xa')](),controller[_0x25cd('0x1a')]);router[_0x25cd('0x18')](_0x25cd('0x11'),auth[_0x25cd('0xa')](),controller[_0x25cd('0x1b')]);module[_0x25cd('0x1c')]=router; \ No newline at end of file +var _0xd06e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/blacklists','getBlackLists','/:id/clone','clone','post','/:id/lists','addLists','addBlackLists','put','delete','removeLists','exports','multer','util','path','connect-timeout','Router'];(function(_0x470e67,_0x4a596d){var _0x28bbde=function(_0x1bbf56){while(--_0x1bbf56){_0x470e67['push'](_0x470e67['shift']());}};_0x28bbde(++_0x4a596d);}(_0xd06e,0x124));var _0xed06=function(_0x407202,_0x510487){_0x407202=_0x407202-0x0;var _0x17d815=_0xd06e[_0x407202];return _0x17d815;};'use strict';var multer=require(_0xed06('0x0'));var util=require(_0xed06('0x1'));var path=require(_0xed06('0x2'));var timeout=require(_0xed06('0x3'));var express=require('express');var router=express[_0xed06('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xed06('0x5'));var interaction=require(_0xed06('0x6'));var config=require(_0xed06('0x7'));var controller=require(_0xed06('0x8'));router[_0xed06('0x9')]('/',auth[_0xed06('0xa')](),controller[_0xed06('0xb')]);router[_0xed06('0x9')](_0xed06('0xc'),auth[_0xed06('0xa')](),controller[_0xed06('0xd')]);router['get'](_0xed06('0xe'),auth[_0xed06('0xa')](),controller[_0xed06('0xf')]);router[_0xed06('0x9')](_0xed06('0x10'),auth['isAuthenticated'](),controller[_0xed06('0x11')]);router[_0xed06('0x9')](_0xed06('0x12'),auth[_0xed06('0xa')](),controller[_0xed06('0x13')]);router[_0xed06('0x9')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0xed06('0x14')]);router[_0xed06('0x9')]('/:id/lists',auth[_0xed06('0xa')](),controller['getLists']);router['get'](_0xed06('0x15'),auth['isAuthenticated'](),controller[_0xed06('0x16')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xed06('0x17'),auth[_0xed06('0xa')](),controller[_0xed06('0x18')]);router[_0xed06('0x19')](_0xed06('0x1a'),auth[_0xed06('0xa')](),controller[_0xed06('0x1b')]);router['post'](_0xed06('0x15'),auth[_0xed06('0xa')](),controller[_0xed06('0x1c')]);router[_0xed06('0x1d')]('/:id',auth[_0xed06('0xa')](),controller['update']);router[_0xed06('0x1e')](_0xed06('0xc'),auth[_0xed06('0xa')](),controller['destroy']);router[_0xed06('0x1e')]('/:id/lists',auth[_0xed06('0xa')](),controller[_0xed06('0x1f')]);router[_0xed06('0x1e')]('/:id/blacklists',auth[_0xed06('0xa')](),controller['removeBlackLists']);module[_0xed06('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 22ba9e6..450a483 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 _0xbe8f=['key','sequelize','STRING','VIRTUAL','getDataValue'];(function(_0x8dd419,_0x58acff){var _0x4fadf8=function(_0x47a697){while(--_0x47a697){_0x8dd419['push'](_0x8dd419['shift']());}};_0x4fadf8(++_0x58acff);}(_0xbe8f,0xd3));var _0xfbe8=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xbe8f[_0x15bc81];return _0x59440e;};'use strict';var Sequelize=require(_0xfbe8('0x0'));module['exports']={'key':{'type':Sequelize[_0xfbe8('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xfbe8('0x1')]},'name':{'type':Sequelize[_0xfbe8('0x2')],'get':function(){return this[_0xfbe8('0x3')](_0xfbe8('0x4'));}}}; \ No newline at end of file +var _0xd290=['STRING','TEXT','getDataValue','key','sequelize','exports'];(function(_0x1ff414,_0x12c95d){var _0x52c0fa=function(_0x57f936){while(--_0x57f936){_0x1ff414['push'](_0x1ff414['shift']());}};_0x52c0fa(++_0x12c95d);}(_0xd290,0x190));var _0x0d29=function(_0x5582ef,_0x17bc6a){_0x5582ef=_0x5582ef-0x0;var _0x234c35=_0xd290[_0x5582ef];return _0x234c35;};'use strict';var Sequelize=require(_0x0d29('0x0'));module[_0x0d29('0x1')]={'key':{'type':Sequelize[_0x0d29('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x0d29('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x0d29('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0d29('0x4')](_0x0d29('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index b4bf13b..d3cfc82 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 _0xa371=['CannedAnswer','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','includeAll','findAll','catch','show','include','find','body','create','MailAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','CannedAnswers','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map'];(function(_0x332c16,_0x25af6d){var _0x4d6143=function(_0x584b63){while(--_0x584b63){_0x332c16['push'](_0x332c16['shift']());}};_0x4d6143(++_0x25af6d);}(_0xa371,0x182));var _0x1a37=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xa371[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require(_0x1a37('0x0'));var rimraf=require(_0x1a37('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1a37('0x2'));var moment=require(_0x1a37('0x3'));var BPromise=require(_0x1a37('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1a37('0x5'));var csv=require(_0x1a37('0x6'));var ejs=require(_0x1a37('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1a37('0x8'));var squel=require(_0x1a37('0x9'));var crypto=require(_0x1a37('0xa'));var jsforce=require(_0x1a37('0xb'));var deskjs=require(_0x1a37('0xc'));var toCsv=require(_0x1a37('0x6'));var querystring=require(_0x1a37('0xd'));var Papa=require('papaparse');var Redis=require(_0x1a37('0xe'));var authService=require(_0x1a37('0xf'));var qs=require(_0x1a37('0x10'));var as=require(_0x1a37('0x11'));var hardwareService=require(_0x1a37('0x12'));var logger=require(_0x1a37('0x13'))('api');var utils=require(_0x1a37('0x14'));var config=require(_0x1a37('0x15'));var licenseUtil=require(_0x1a37('0x16'));var db=require(_0x1a37('0x17'))['db'];function respondWithStatusCode(_0x591064,_0xfc4d89){_0xfc4d89=_0xfc4d89||0xcc;return function(_0xa5308a){if(_0xa5308a){return _0x591064['sendStatus'](_0xfc4d89);}return _0x591064[_0x1a37('0x18')](_0xfc4d89)[_0x1a37('0x19')]();};}function respondWithResult(_0x315f94,_0x333711){_0x333711=_0x333711||0xc8;return function(_0x91fe38){if(_0x91fe38){return _0x315f94[_0x1a37('0x18')](_0x333711)['json'](_0x91fe38);}};}function respondWithFilteredResult(_0x195473,_0x3699e8){return function(_0x3c3000){if(_0x3c3000){var _0x2c0650=typeof _0x3699e8[_0x1a37('0x1a')]===_0x1a37('0x1b')&&typeof _0x3699e8[_0x1a37('0x1c')]==='undefined';var _0x185af2=_0x3c3000[_0x1a37('0x1d')];var _0x1c821c=_0x2c0650?0x0:_0x3699e8['offset'];var _0x2f9c99=_0x2c0650?_0x3c3000[_0x1a37('0x1d')]:_0x3699e8['offset']+_0x3699e8[_0x1a37('0x1c')];var _0x4c8ce7;if(_0x2f9c99>=_0x185af2){_0x2f9c99=_0x185af2;_0x4c8ce7=0xc8;}else{_0x4c8ce7=0xce;}_0x195473[_0x1a37('0x18')](_0x4c8ce7);return _0x195473[_0x1a37('0x1e')](_0x1a37('0x1f'),_0x1c821c+'-'+_0x2f9c99+'/'+_0x185af2)[_0x1a37('0x20')](_0x3c3000);}return null;};}function patchUpdates(_0xae1276){return function(_0x4de131){try{jsonpatch[_0x1a37('0x21')](_0x4de131,_0xae1276,!![]);}catch(_0x301c61){return BPromise[_0x1a37('0x22')](_0x301c61);}return _0x4de131[_0x1a37('0x23')]();};}function saveUpdates(_0x4cb909,_0x384a95){return function(_0xebdc93){if(_0xebdc93){return _0xebdc93[_0x1a37('0x24')](_0x4cb909)[_0x1a37('0x25')](function(_0x1318c0){return _0x1318c0;});}return null;};}function removeEntity(_0x34291f,_0x58d347){return function(_0x20b243){if(_0x20b243){return _0x20b243['destroy']()[_0x1a37('0x25')](function(){var _0x3ca25b=_0x20b243[_0x1a37('0x26')]({'plain':!![]});var _0x362bbe=_0x1a37('0x27');return db[_0x1a37('0x28')][_0x1a37('0x29')]({'where':{'type':_0x362bbe,'resourceId':_0x3ca25b['id']}})['then'](function(){return _0x20b243;});})[_0x1a37('0x25')](function(){_0x34291f[_0x1a37('0x18')](0xcc)[_0x1a37('0x19')]();});}};}function handleEntityNotFound(_0x505b40,_0x4663d9){return function(_0x2b4a7f){if(!_0x2b4a7f){_0x505b40[_0x1a37('0x2a')](0x194);}return _0x2b4a7f;};}function handleError(_0x1b1159,_0x2f6dca){_0x2f6dca=_0x2f6dca||0x1f4;return function(_0x4bc29a){logger[_0x1a37('0x2b')](_0x4bc29a[_0x1a37('0x2c')]);if(_0x4bc29a['name']){delete _0x4bc29a[_0x1a37('0x2d')];}_0x1b1159[_0x1a37('0x18')](_0x2f6dca)[_0x1a37('0x2e')](_0x4bc29a);};}exports[_0x1a37('0x2f')]=function(_0x311b2e,_0x2a065f){var _0x40049a={},_0x1261ba={},_0x540663={'count':0x0,'rows':[]};var _0x547d24=_[_0x1a37('0x30')](db[_0x1a37('0x31')][_0x1a37('0x32')],function(_0x26238f){return{'name':_0x26238f[_0x1a37('0x33')],'type':_0x26238f[_0x1a37('0x34')]['key']};});_0x1261ba[_0x1a37('0x35')]=_[_0x1a37('0x30')](_0x547d24,_0x1a37('0x2d'));_0x1261ba[_0x1a37('0x36')]=_[_0x1a37('0x37')](_0x311b2e[_0x1a37('0x36')]);_0x1261ba[_0x1a37('0x38')]=_[_0x1a37('0x39')](_0x1261ba[_0x1a37('0x35')],_0x1261ba['query']);_0x40049a[_0x1a37('0x3a')]=_['intersection'](_0x1261ba[_0x1a37('0x35')],qs[_0x1a37('0x3b')](_0x311b2e[_0x1a37('0x36')][_0x1a37('0x3b')]));_0x40049a[_0x1a37('0x3a')]=_0x40049a['attributes'][_0x1a37('0x3c')]?_0x40049a[_0x1a37('0x3a')]:_0x1261ba[_0x1a37('0x35')];if(!_0x311b2e[_0x1a37('0x36')][_0x1a37('0x3d')](_0x1a37('0x3e'))){_0x40049a[_0x1a37('0x1c')]=qs[_0x1a37('0x1c')](_0x311b2e[_0x1a37('0x36')][_0x1a37('0x1c')]);_0x40049a[_0x1a37('0x1a')]=qs[_0x1a37('0x1a')](_0x311b2e[_0x1a37('0x36')]['offset']);}_0x40049a[_0x1a37('0x3f')]=qs['sort'](_0x311b2e[_0x1a37('0x36')]['sort']);_0x40049a[_0x1a37('0x40')]=qs[_0x1a37('0x38')](_[_0x1a37('0x41')](_0x311b2e[_0x1a37('0x36')],_0x1261ba[_0x1a37('0x38')]),_0x547d24);if(_0x311b2e['query'][_0x1a37('0x42')]){_0x40049a['where']=_[_0x1a37('0x43')](_0x40049a[_0x1a37('0x40')],{'$or':[{'key':{'$like':'%'+_0x311b2e[_0x1a37('0x36')][_0x1a37('0x42')]+'%'}},{'value':{'$like':'%'+_0x311b2e[_0x1a37('0x36')][_0x1a37('0x42')]+'%'}}]});}_0x40049a=_[_0x1a37('0x43')]({},_0x40049a,_0x311b2e['options']);var _0x49c153={'where':_0x40049a[_0x1a37('0x40')]};return db[_0x1a37('0x31')][_0x1a37('0x1d')](_0x49c153)[_0x1a37('0x25')](function(_0x28fe9c){_0x540663[_0x1a37('0x1d')]=_0x28fe9c;if(_0x311b2e[_0x1a37('0x36')][_0x1a37('0x44')]){_0x40049a['include']=[{'all':!![]}];}return db[_0x1a37('0x31')][_0x1a37('0x45')](_0x40049a);})['then'](function(_0x119bb4){_0x540663['rows']=_0x119bb4;return _0x540663;})[_0x1a37('0x25')](respondWithFilteredResult(_0x2a065f,_0x40049a))[_0x1a37('0x46')](handleError(_0x2a065f,null));};exports[_0x1a37('0x47')]=function(_0x58840c,_0x5e803c){var _0x2609c3={'raw':!![],'where':{'id':_0x58840c['params']['id']}},_0x2a5934={};_0x2a5934[_0x1a37('0x35')]=_[_0x1a37('0x37')](db[_0x1a37('0x31')]['rawAttributes']);_0x2a5934[_0x1a37('0x36')]=_[_0x1a37('0x37')](_0x58840c[_0x1a37('0x36')]);_0x2a5934[_0x1a37('0x38')]=_['intersection'](_0x2a5934[_0x1a37('0x35')],_0x2a5934['query']);_0x2609c3[_0x1a37('0x3a')]=_[_0x1a37('0x39')](_0x2a5934[_0x1a37('0x35')],qs['fields'](_0x58840c['query'][_0x1a37('0x3b')]));_0x2609c3[_0x1a37('0x3a')]=_0x2609c3[_0x1a37('0x3a')][_0x1a37('0x3c')]?_0x2609c3[_0x1a37('0x3a')]:_0x2a5934[_0x1a37('0x35')];if(_0x58840c[_0x1a37('0x36')][_0x1a37('0x44')]){_0x2609c3[_0x1a37('0x48')]=[{'all':!![]}];}_0x2609c3=_['merge']({},_0x2609c3,_0x58840c['options']);return db[_0x1a37('0x31')][_0x1a37('0x49')](_0x2609c3)[_0x1a37('0x25')](handleEntityNotFound(_0x5e803c,null))[_0x1a37('0x25')](respondWithResult(_0x5e803c,null))['catch'](handleError(_0x5e803c,null));};exports['update']=function(_0x352fbe,_0x2e70b1){if(_0x352fbe[_0x1a37('0x4a')]['id']){delete _0x352fbe['body']['id'];}return db[_0x1a37('0x31')]['find']({'where':{'id':_0x352fbe['params']['id']}})['then'](handleEntityNotFound(_0x2e70b1,null))[_0x1a37('0x25')](saveUpdates(_0x352fbe[_0x1a37('0x4a')],null))[_0x1a37('0x25')](respondWithResult(_0x2e70b1,null))[_0x1a37('0x46')](handleError(_0x2e70b1,null));};exports[_0x1a37('0x29')]=function(_0xd6af2a,_0x2a2492){return db[_0x1a37('0x31')][_0x1a37('0x49')]({'where':{'id':_0xd6af2a['params']['id']}})['then'](handleEntityNotFound(_0x2a2492,null))['then'](removeEntity(_0x2a2492,null))[_0x1a37('0x46')](handleError(_0x2a2492,null));};exports[_0x1a37('0x4b')]=function(_0x47aa50,_0x3be833){var _0x4ea854={'key':_0x47aa50[_0x1a37('0x4a')]['key']};if(_0x47aa50['body']['MailAccountId']){_0x4ea854['MailAccountId']=_0x47aa50['body'][_0x1a37('0x4c')];}else if(_0x47aa50['body']['SmsAccountId']){_0x4ea854['SmsAccountId']=_0x47aa50['body']['SmsAccountId'];}else if(_0x47aa50[_0x1a37('0x4a')][_0x1a37('0x4d')]){_0x4ea854[_0x1a37('0x4d')]=_0x47aa50[_0x1a37('0x4a')][_0x1a37('0x4d')];}else if(_0x47aa50[_0x1a37('0x4a')]['ChatWebsiteId']){_0x4ea854[_0x1a37('0x4e')]=_0x47aa50[_0x1a37('0x4a')][_0x1a37('0x4e')];}return db[_0x1a37('0x31')][_0x1a37('0x49')]({'where':_0x4ea854})[_0x1a37('0x25')](function(_0xc77984){if(_0xc77984){throw new db['Sequelize'][(_0x1a37('0x4f'))](_0x1a37('0x50'));}return db[_0x1a37('0x31')][_0x1a37('0x4b')](_0x47aa50[_0x1a37('0x4a')]);})[_0x1a37('0x25')](function(_0x3084fe){var _0x804c18=_0x47aa50[_0x1a37('0x51')][_0x1a37('0x26')]({'plain':!![]});if(!_0x804c18)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x804c18[_0x1a37('0x52')]===_0x1a37('0x51')){var _0x5f4ba9=_0x3084fe['get']({'plain':!![]});return db[_0x1a37('0x53')][_0x1a37('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x804c18[_0x1a37('0x54')]},'raw':!![]})['then'](function(_0x10595e){if(_0x10595e&&_0x10595e[_0x1a37('0x55')]===0x0){return db[_0x1a37('0x28')][_0x1a37('0x4b')]({'name':_0x5f4ba9[_0x1a37('0x2d')],'resourceId':_0x5f4ba9['id'],'type':_0x10595e[_0x1a37('0x2d')],'sectionId':_0x10595e['id']},{})[_0x1a37('0x25')](function(){return _0x3084fe;});}else{return _0x3084fe;}})['catch'](function(_0x5f15b2){logger[_0x1a37('0x2b')](_0x1a37('0x56'),_0x5f15b2);throw _0x5f15b2;});}return _0x3084fe;})[_0x1a37('0x25')](respondWithResult(_0x3be833,0xc9))[_0x1a37('0x46')](handleError(_0x3be833,null));}; \ No newline at end of file +var _0xd5e7=['destroy','get','CannedAnswers','UserProfileResource','error','name','CannedAnswer','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then'];(function(_0x5b7366,_0x40db4c){var _0x4d5c98=function(_0x50086a){while(--_0x50086a){_0x5b7366['push'](_0x5b7366['shift']());}};_0x4d5c98(++_0x40db4c);}(_0xd5e7,0x180));var _0x7d5e=function(_0x32ea89,_0x46c6b7){_0x32ea89=_0x32ea89-0x0;var _0x120633=_0xd5e7[_0x32ea89];return _0x120633;};'use strict';var emlformat=require(_0x7d5e('0x0'));var rimraf=require(_0x7d5e('0x1'));var zipdir=require(_0x7d5e('0x2'));var jsonpatch=require(_0x7d5e('0x3'));var rp=require('request-promise');var moment=require(_0x7d5e('0x4'));var BPromise=require(_0x7d5e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7d5e('0x6'));var sox=require('sox');var csv=require(_0x7d5e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d5e('0x8'));var _=require('lodash');var squel=require(_0x7d5e('0x9'));var crypto=require(_0x7d5e('0xa'));var jsforce=require(_0x7d5e('0xb'));var deskjs=require(_0x7d5e('0xc'));var toCsv=require(_0x7d5e('0x7'));var querystring=require(_0x7d5e('0xd'));var Papa=require(_0x7d5e('0xe'));var Redis=require('ioredis');var authService=require(_0x7d5e('0xf'));var qs=require(_0x7d5e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d5e('0x11'));var utils=require(_0x7d5e('0x12'));var config=require(_0x7d5e('0x13'));var licenseUtil=require(_0x7d5e('0x14'));var db=require(_0x7d5e('0x15'))['db'];function respondWithStatusCode(_0x3c9a9f,_0x28c4aa){_0x28c4aa=_0x28c4aa||0xcc;return function(_0x132ce0){if(_0x132ce0){return _0x3c9a9f[_0x7d5e('0x16')](_0x28c4aa);}return _0x3c9a9f[_0x7d5e('0x17')](_0x28c4aa)[_0x7d5e('0x18')]();};}function respondWithResult(_0x100bcb,_0x58a0dd){_0x58a0dd=_0x58a0dd||0xc8;return function(_0x11339e){if(_0x11339e){return _0x100bcb[_0x7d5e('0x17')](_0x58a0dd)[_0x7d5e('0x19')](_0x11339e);}};}function respondWithFilteredResult(_0x18f67b,_0x3ddb53){return function(_0x4f6b8c){if(_0x4f6b8c){var _0x15262d=typeof _0x3ddb53['offset']==='undefined'&&typeof _0x3ddb53[_0x7d5e('0x1a')]===_0x7d5e('0x1b');var _0x2abdb8=_0x4f6b8c[_0x7d5e('0x1c')];var _0x292c05=_0x15262d?0x0:_0x3ddb53[_0x7d5e('0x1d')];var _0x33a6cb=_0x15262d?_0x4f6b8c[_0x7d5e('0x1c')]:_0x3ddb53['offset']+_0x3ddb53[_0x7d5e('0x1a')];var _0x3f0894;if(_0x33a6cb>=_0x2abdb8){_0x33a6cb=_0x2abdb8;_0x3f0894=0xc8;}else{_0x3f0894=0xce;}_0x18f67b[_0x7d5e('0x17')](_0x3f0894);return _0x18f67b[_0x7d5e('0x1e')](_0x7d5e('0x1f'),_0x292c05+'-'+_0x33a6cb+'/'+_0x2abdb8)['json'](_0x4f6b8c);}return null;};}function patchUpdates(_0x34aaf2){return function(_0xce32b0){try{jsonpatch[_0x7d5e('0x20')](_0xce32b0,_0x34aaf2,!![]);}catch(_0x44f3c9){return BPromise[_0x7d5e('0x21')](_0x44f3c9);}return _0xce32b0['save']();};}function saveUpdates(_0x2f5f56,_0x3fa260){return function(_0x325c86){if(_0x325c86){return _0x325c86[_0x7d5e('0x22')](_0x2f5f56)[_0x7d5e('0x23')](function(_0x5b9919){return _0x5b9919;});}return null;};}function removeEntity(_0x40fd0f,_0x335ca3){return function(_0x442aa9){if(_0x442aa9){return _0x442aa9[_0x7d5e('0x24')]()[_0x7d5e('0x23')](function(){var _0x81d47c=_0x442aa9[_0x7d5e('0x25')]({'plain':!![]});var _0x85dc0b=_0x7d5e('0x26');return db[_0x7d5e('0x27')][_0x7d5e('0x24')]({'where':{'type':_0x85dc0b,'resourceId':_0x81d47c['id']}})[_0x7d5e('0x23')](function(){return _0x442aa9;});})['then'](function(){_0x40fd0f[_0x7d5e('0x17')](0xcc)[_0x7d5e('0x18')]();});}};}function handleEntityNotFound(_0x22e00d,_0x316e39){return function(_0x58dd67){if(!_0x58dd67){_0x22e00d[_0x7d5e('0x16')](0x194);}return _0x58dd67;};}function handleError(_0xc8a708,_0x20d49b){_0x20d49b=_0x20d49b||0x1f4;return function(_0x49f2a0){logger[_0x7d5e('0x28')](_0x49f2a0['stack']);if(_0x49f2a0[_0x7d5e('0x29')]){delete _0x49f2a0[_0x7d5e('0x29')];}_0xc8a708['status'](_0x20d49b)['send'](_0x49f2a0);};}exports['index']=function(_0x4eb2fa,_0x25253d){var _0x4f2485={},_0x1f20cf={},_0x37108a={'count':0x0,'rows':[]};var _0x438012=_['map'](db[_0x7d5e('0x2a')][_0x7d5e('0x2b')],function(_0x18702f){return{'name':_0x18702f['fieldName'],'type':_0x18702f[_0x7d5e('0x2c')]['key']};});_0x1f20cf[_0x7d5e('0x2d')]=_['map'](_0x438012,_0x7d5e('0x29'));_0x1f20cf[_0x7d5e('0x2e')]=_['keys'](_0x4eb2fa[_0x7d5e('0x2e')]);_0x1f20cf[_0x7d5e('0x2f')]=_[_0x7d5e('0x30')](_0x1f20cf[_0x7d5e('0x2d')],_0x1f20cf[_0x7d5e('0x2e')]);_0x4f2485[_0x7d5e('0x31')]=_['intersection'](_0x1f20cf[_0x7d5e('0x2d')],qs[_0x7d5e('0x32')](_0x4eb2fa[_0x7d5e('0x2e')][_0x7d5e('0x32')]));_0x4f2485[_0x7d5e('0x31')]=_0x4f2485[_0x7d5e('0x31')][_0x7d5e('0x33')]?_0x4f2485[_0x7d5e('0x31')]:_0x1f20cf[_0x7d5e('0x2d')];if(!_0x4eb2fa[_0x7d5e('0x2e')][_0x7d5e('0x34')](_0x7d5e('0x35'))){_0x4f2485['limit']=qs[_0x7d5e('0x1a')](_0x4eb2fa[_0x7d5e('0x2e')][_0x7d5e('0x1a')]);_0x4f2485[_0x7d5e('0x1d')]=qs[_0x7d5e('0x1d')](_0x4eb2fa[_0x7d5e('0x2e')][_0x7d5e('0x1d')]);}_0x4f2485[_0x7d5e('0x36')]=qs['sort'](_0x4eb2fa[_0x7d5e('0x2e')][_0x7d5e('0x37')]);_0x4f2485[_0x7d5e('0x38')]=qs[_0x7d5e('0x2f')](_[_0x7d5e('0x39')](_0x4eb2fa['query'],_0x1f20cf[_0x7d5e('0x2f')]),_0x438012);if(_0x4eb2fa[_0x7d5e('0x2e')][_0x7d5e('0x3a')]){_0x4f2485['where']=_[_0x7d5e('0x3b')](_0x4f2485[_0x7d5e('0x38')],{'$or':[{'key':{'$like':'%'+_0x4eb2fa[_0x7d5e('0x2e')]['filter']+'%'}},{'value':{'$like':'%'+_0x4eb2fa[_0x7d5e('0x2e')]['filter']+'%'}}]});}_0x4f2485=_[_0x7d5e('0x3b')]({},_0x4f2485,_0x4eb2fa[_0x7d5e('0x3c')]);var _0x561078={'where':_0x4f2485[_0x7d5e('0x38')]};return db[_0x7d5e('0x2a')]['count'](_0x561078)[_0x7d5e('0x23')](function(_0x5699a7){_0x37108a[_0x7d5e('0x1c')]=_0x5699a7;if(_0x4eb2fa[_0x7d5e('0x2e')][_0x7d5e('0x3d')]){_0x4f2485['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x4f2485);})[_0x7d5e('0x23')](function(_0x4617fb){_0x37108a['rows']=_0x4617fb;return _0x37108a;})[_0x7d5e('0x23')](respondWithFilteredResult(_0x25253d,_0x4f2485))[_0x7d5e('0x3e')](handleError(_0x25253d,null));};exports[_0x7d5e('0x3f')]=function(_0x14d7db,_0x240332){var _0xa87c46={'raw':!![],'where':{'id':_0x14d7db[_0x7d5e('0x40')]['id']}},_0x10f8a2={};_0x10f8a2[_0x7d5e('0x2d')]=_[_0x7d5e('0x41')](db['CannedAnswer'][_0x7d5e('0x2b')]);_0x10f8a2[_0x7d5e('0x2e')]=_['keys'](_0x14d7db[_0x7d5e('0x2e')]);_0x10f8a2[_0x7d5e('0x2f')]=_[_0x7d5e('0x30')](_0x10f8a2[_0x7d5e('0x2d')],_0x10f8a2[_0x7d5e('0x2e')]);_0xa87c46[_0x7d5e('0x31')]=_[_0x7d5e('0x30')](_0x10f8a2[_0x7d5e('0x2d')],qs[_0x7d5e('0x32')](_0x14d7db[_0x7d5e('0x2e')][_0x7d5e('0x32')]));_0xa87c46[_0x7d5e('0x31')]=_0xa87c46[_0x7d5e('0x31')][_0x7d5e('0x33')]?_0xa87c46['attributes']:_0x10f8a2['model'];if(_0x14d7db[_0x7d5e('0x2e')]['includeAll']){_0xa87c46[_0x7d5e('0x42')]=[{'all':!![]}];}_0xa87c46=_[_0x7d5e('0x3b')]({},_0xa87c46,_0x14d7db[_0x7d5e('0x3c')]);return db[_0x7d5e('0x2a')][_0x7d5e('0x43')](_0xa87c46)[_0x7d5e('0x23')](handleEntityNotFound(_0x240332,null))['then'](respondWithResult(_0x240332,null))[_0x7d5e('0x3e')](handleError(_0x240332,null));};exports[_0x7d5e('0x22')]=function(_0x107102,_0x191b16){if(_0x107102[_0x7d5e('0x44')]['id']){delete _0x107102[_0x7d5e('0x44')]['id'];}return db[_0x7d5e('0x2a')][_0x7d5e('0x43')]({'where':{'id':_0x107102[_0x7d5e('0x40')]['id']}})[_0x7d5e('0x23')](handleEntityNotFound(_0x191b16,null))[_0x7d5e('0x23')](saveUpdates(_0x107102[_0x7d5e('0x44')],null))[_0x7d5e('0x23')](respondWithResult(_0x191b16,null))[_0x7d5e('0x3e')](handleError(_0x191b16,null));};exports['destroy']=function(_0x50090e,_0x424427){return db[_0x7d5e('0x2a')]['find']({'where':{'id':_0x50090e[_0x7d5e('0x40')]['id']}})[_0x7d5e('0x23')](handleEntityNotFound(_0x424427,null))[_0x7d5e('0x23')](removeEntity(_0x424427,null))[_0x7d5e('0x3e')](handleError(_0x424427,null));};exports[_0x7d5e('0x45')]=function(_0x3caa5c,_0x44f312){var _0x5e9def={'key':_0x3caa5c[_0x7d5e('0x44')][_0x7d5e('0x46')]};if(_0x3caa5c[_0x7d5e('0x44')][_0x7d5e('0x47')]){_0x5e9def[_0x7d5e('0x47')]=_0x3caa5c[_0x7d5e('0x44')][_0x7d5e('0x47')];}else if(_0x3caa5c[_0x7d5e('0x44')]['SmsAccountId']){_0x5e9def[_0x7d5e('0x48')]=_0x3caa5c[_0x7d5e('0x44')][_0x7d5e('0x48')];}else if(_0x3caa5c[_0x7d5e('0x44')]['OpenchannelAccountId']){_0x5e9def[_0x7d5e('0x49')]=_0x3caa5c[_0x7d5e('0x44')][_0x7d5e('0x49')];}else if(_0x3caa5c[_0x7d5e('0x44')][_0x7d5e('0x4a')]){_0x5e9def[_0x7d5e('0x4a')]=_0x3caa5c[_0x7d5e('0x44')][_0x7d5e('0x4a')];}return db['CannedAnswer'][_0x7d5e('0x43')]({'where':_0x5e9def})[_0x7d5e('0x23')](function(_0x1ff612){if(_0x1ff612){throw new db['Sequelize'][(_0x7d5e('0x4b'))](_0x7d5e('0x4c'));}return db['CannedAnswer']['create'](_0x3caa5c['body']);})[_0x7d5e('0x23')](function(_0x4c5274){var _0x4d9ac9=_0x3caa5c[_0x7d5e('0x4d')][_0x7d5e('0x25')]({'plain':!![]});if(!_0x4d9ac9)throw new Error(_0x7d5e('0x4e'));if(_0x4d9ac9[_0x7d5e('0x4f')]==='user'){var _0xf49358=_0x4c5274['get']({'plain':!![]});return db[_0x7d5e('0x50')][_0x7d5e('0x43')]({'where':{'name':_0x7d5e('0x26'),'userProfileId':_0x4d9ac9[_0x7d5e('0x51')]},'raw':!![]})['then'](function(_0x3b08f8){if(_0x3b08f8&&_0x3b08f8[_0x7d5e('0x52')]===0x0){return db[_0x7d5e('0x27')]['create']({'name':_0xf49358[_0x7d5e('0x29')],'resourceId':_0xf49358['id'],'type':_0x3b08f8[_0x7d5e('0x29')],'sectionId':_0x3b08f8['id']},{})['then'](function(){return _0x4c5274;});}else{return _0x4c5274;}})[_0x7d5e('0x3e')](function(_0x1e5dab){logger['error'](_0x7d5e('0x53'),_0x1e5dab);throw _0x1e5dab;});}return _0x4c5274;})[_0x7d5e('0x23')](respondWithResult(_0x44f312,0xc9))['catch'](handleError(_0x44f312,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 8070f41..24c64c7 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 _0xb522=['bluebird','path','../../config/environment','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_0xb522,0x188));var _0x2b52=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb522[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2b52('0x0'));var util=require(_0x2b52('0x1'));var logger=require(_0x2b52('0x2'))(_0x2b52('0x3'));var moment=require('moment');var BPromise=require(_0x2b52('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b52('0x5'));var rimraf=require('rimraf');var config=require(_0x2b52('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x2b52('0x7')]=function(_0x29f858,_0x22704d){return _0x29f858[_0x2b52('0x8')](_0x2b52('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2b52('0xa'),'collate':_0x2b52('0xb')});}; \ No newline at end of file +var _0x7866=['./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x344382,_0xcfa779){var _0x37f8f0=function(_0x5d60a1){while(--_0x5d60a1){_0x344382['push'](_0x344382['shift']());}};_0x37f8f0(++_0xcfa779);}(_0x7866,0x114));var _0x6786=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x7866[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0x6786('0x0'));var util=require(_0x6786('0x1'));var logger=require('../../config/logger')(_0x6786('0x2'));var moment=require(_0x6786('0x3'));var BPromise=require(_0x6786('0x4'));var rp=require(_0x6786('0x5'));var fs=require('fs');var path=require(_0x6786('0x6'));var rimraf=require(_0x6786('0x7'));var config=require(_0x6786('0x8'));var attributes=require(_0x6786('0x9'));module[_0x6786('0xa')]=function(_0xe13d3e,_0x408460){return _0xe13d3e[_0x6786('0xb')](_0x6786('0xc'),attributes,{'tableName':_0x6786('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6786('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index fca6980..7f48165 100644 --- a/server/api/cannedAnswer/cannedAnswer.rpc.js +++ b/server/api/cannedAnswer/cannedAnswer.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x148ede,_0x31b702){var _0x30e955=function(_0xcf7370){while(--_0xcf7370){_0x148ede['push'](_0x148ede['shift']());}};_0x30e955(++_0x31b702);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x52da09,_0xf43133){var _0x9f4b98=function(_0x5a9193){while(--_0x5a9193){_0x52da09['push'](_0x52da09['shift']());}};_0x9f4b98(++_0xf43133);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index a2d116d..746828f 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 _0xec38=['express','Router','../../config/environment','./cannedAnswer.controller','isAuthenticated','get','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3401ce,_0x5d1579){var _0x1bb79d=function(_0x46985e){while(--_0x46985e){_0x3401ce['push'](_0x3401ce['shift']());}};_0x1bb79d(++_0x5d1579);}(_0xec38,0x12e));var _0x8ec3=function(_0x1edea9,_0x4b9a1b){_0x1edea9=_0x1edea9-0x0;var _0xf0ac12=_0xec38[_0x1edea9];return _0xf0ac12;};'use strict';var multer=require(_0x8ec3('0x0'));var util=require(_0x8ec3('0x1'));var path=require(_0x8ec3('0x2'));var timeout=require(_0x8ec3('0x3'));var express=require(_0x8ec3('0x4'));var router=express[_0x8ec3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8ec3('0x6'));var controller=require(_0x8ec3('0x7'));router['get']('/',auth[_0x8ec3('0x8')](),controller['index']);router[_0x8ec3('0x9')]('/:id',auth[_0x8ec3('0x8')](),controller[_0x8ec3('0xa')]);router[_0x8ec3('0xb')]('/',auth[_0x8ec3('0x8')](),controller[_0x8ec3('0xc')]);router[_0x8ec3('0xd')](_0x8ec3('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x8ec3('0xf')](_0x8ec3('0xe'),auth[_0x8ec3('0x8')](),controller[_0x8ec3('0x10')]);module[_0x8ec3('0x11')]=router; \ No newline at end of file +var _0x0c32=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x5b0c14,_0x571c97){var _0x213a43=function(_0xf9aa60){while(--_0xf9aa60){_0x5b0c14['push'](_0x5b0c14['shift']());}};_0x213a43(++_0x571c97);}(_0x0c32,0x12e));var _0x20c3=function(_0x10970f,_0x2e4857){_0x10970f=_0x10970f-0x0;var _0x195f3a=_0x0c32[_0x10970f];return _0x195f3a;};'use strict';var multer=require(_0x20c3('0x0'));var util=require(_0x20c3('0x1'));var path=require(_0x20c3('0x2'));var timeout=require(_0x20c3('0x3'));var express=require('express');var router=express[_0x20c3('0x4')]();var fs_extra=require(_0x20c3('0x5'));var auth=require(_0x20c3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x20c3('0x7'));var controller=require(_0x20c3('0x8'));router['get']('/',auth[_0x20c3('0x9')](),controller[_0x20c3('0xa')]);router['get'](_0x20c3('0xb'),auth[_0x20c3('0x9')](),controller[_0x20c3('0xc')]);router[_0x20c3('0xd')]('/',auth[_0x20c3('0x9')](),controller[_0x20c3('0xe')]);router[_0x20c3('0xf')](_0x20c3('0xb'),auth[_0x20c3('0x9')](),controller[_0x20c3('0x10')]);router[_0x20c3('0x11')](_0x20c3('0xb'),auth['isAuthenticated'](),controller[_0x20c3('0x12')]);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 d6ba00c..23a029b 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 _0x10dc=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x12ca7a,_0x3295bf){var _0x2249df=function(_0x48b046){while(--_0x48b046){_0x12ca7a['push'](_0x12ca7a['shift']());}};_0x2249df(++_0x3295bf);}(_0x10dc,0x13f));var _0xc10d=function(_0x1db347,_0x50526b){_0x1db347=_0x1db347-0x0;var _0x4ec95f=_0x10dc[_0x1db347];return _0x4ec95f;};'use strict';var Sequelize=require(_0xc10d('0x0'));module[_0xc10d('0x1')]={'calldate':{'type':Sequelize[_0xc10d('0x2')],'allowNull':![],'defaultValue':_0xc10d('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc10d('0x4')]},'dstchannel':{'type':Sequelize[_0xc10d('0x4')]},'lastapp':{'type':Sequelize[_0xc10d('0x4')]},'lastdata':{'type':Sequelize[_0xc10d('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xc10d('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc10d('0x4')]},'amaflags':{'type':Sequelize[_0xc10d('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xc10d('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc10d('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xc10d('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xc10d('0x4')]}}; \ No newline at end of file +var _0xb48d=['sequelize','DATE','STRING','INTEGER'];(function(_0x50d3e0,_0x15a289){var _0x2ba9d1=function(_0x35344c){while(--_0x35344c){_0x50d3e0['push'](_0x50d3e0['shift']());}};_0x2ba9d1(++_0x15a289);}(_0xb48d,0x194));var _0xdb48=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xb48d[_0x2faddb];return _0x273c05;};'use strict';var Sequelize=require(_0xdb48('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xdb48('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xdb48('0x2')]},'src':{'type':Sequelize[_0xdb48('0x2')]},'dst':{'type':Sequelize[_0xdb48('0x2')]},'dcontext':{'type':Sequelize[_0xdb48('0x2')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xdb48('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xdb48('0x2')]},'duration':{'type':Sequelize[_0xdb48('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xdb48('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xdb48('0x2')]},'userfield':{'type':Sequelize[_0xdb48('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xdb48('0x2')]},'sequence':{'type':Sequelize[_0xdb48('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xdb48('0x2')]},'tag':{'type':Sequelize[_0xdb48('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 97614fb..6689fea 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 _0x0e85=['json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','Cdr','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end'];(function(_0x46fa97,_0x4b85af){var _0x12083a=function(_0x585134){while(--_0x585134){_0x46fa97['push'](_0x46fa97['shift']());}};_0x12083a(++_0x4b85af);}(_0x0e85,0x7c));var _0x50e8=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x0e85[_0x4ed520];return _0x4415a6;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];function respondWithStatusCode(_0x24d381,_0x508377){_0x508377=_0x508377||0xcc;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0x17')](_0x508377);}return _0x24d381[_0x50e8('0x18')](_0x508377)[_0x50e8('0x19')]();};}function respondWithResult(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0xc8;return function(_0x18596f){if(_0x18596f){return _0x473aa7[_0x50e8('0x18')](_0x54efd3)[_0x50e8('0x1a')](_0x18596f);}};}function respondWithFilteredResult(_0x5c3baa,_0x5524a3){return function(_0x30a872){if(_0x30a872){var _0xf02b48=typeof _0x5524a3[_0x50e8('0x1b')]===_0x50e8('0x1c')&&typeof _0x5524a3[_0x50e8('0x1d')]===_0x50e8('0x1c');var _0x5642bf=_0x30a872['count'];var _0x441f25=_0xf02b48?0x0:_0x5524a3[_0x50e8('0x1b')];var _0x40d060=_0xf02b48?_0x30a872[_0x50e8('0x1e')]:_0x5524a3[_0x50e8('0x1b')]+_0x5524a3[_0x50e8('0x1d')];var _0x1a451d;if(_0x40d060>=_0x5642bf){_0x40d060=_0x5642bf;_0x1a451d=0xc8;}else{_0x1a451d=0xce;}_0x5c3baa['status'](_0x1a451d);return _0x5c3baa[_0x50e8('0x1f')]('Content-Range',_0x441f25+'-'+_0x40d060+'/'+_0x5642bf)[_0x50e8('0x1a')](_0x30a872);}return null;};}function patchUpdates(_0xe04a5c){return function(_0xd263d){try{jsonpatch[_0x50e8('0x20')](_0xd263d,_0xe04a5c,!![]);}catch(_0x46af8e){return BPromise['reject'](_0x46af8e);}return _0xd263d[_0x50e8('0x21')]();};}function saveUpdates(_0x1e4e0d,_0x58110d){return function(_0x31d23c){if(_0x31d23c){return _0x31d23c[_0x50e8('0x22')](_0x1e4e0d)['then'](function(_0x1ce7fc){return _0x1ce7fc;});}return null;};}function removeEntity(_0xe7e56c,_0x4f56b7){return function(_0x47a3d8){if(_0x47a3d8){return _0x47a3d8['destroy']()[_0x50e8('0x23')](function(){_0xe7e56c[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();});}};}function handleEntityNotFound(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(!_0x13b6e9){_0x371a1f['sendStatus'](0x194);}return _0x13b6e9;};}function handleError(_0x3a6442,_0x396611){_0x396611=_0x396611||0x1f4;return function(_0x4b3a09){logger[_0x50e8('0x24')](_0x4b3a09[_0x50e8('0x25')]);if(_0x4b3a09[_0x50e8('0x26')]){delete _0x4b3a09[_0x50e8('0x26')];}_0x3a6442['status'](_0x396611)[_0x50e8('0x27')](_0x4b3a09);};}exports['index']=function(_0x30fedf,_0x39c0c6){var _0x42bbef={},_0x4f0b88={},_0x1041b9={'count':0x0,'rows':[]};var _0x126c99=_[_0x50e8('0x28')](db[_0x50e8('0x29')][_0x50e8('0x2a')],function(_0x18aa31){return{'name':_0x18aa31[_0x50e8('0x2b')],'type':_0x18aa31['type'][_0x50e8('0x2c')]};});_0x4f0b88[_0x50e8('0x2d')]=_['map'](_0x126c99,'name');_0x4f0b88[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x30fedf[_0x50e8('0x2e')]);_0x4f0b88['filters']=_['intersection'](_0x4f0b88[_0x50e8('0x2d')],_0x4f0b88[_0x50e8('0x2e')]);_0x42bbef['attributes']=_[_0x50e8('0x30')](_0x4f0b88[_0x50e8('0x2d')],qs[_0x50e8('0x31')](_0x30fedf[_0x50e8('0x2e')]['fields']));_0x42bbef[_0x50e8('0x32')]=_0x42bbef['attributes'][_0x50e8('0x33')]?_0x42bbef[_0x50e8('0x32')]:_0x4f0b88[_0x50e8('0x2d')];if(!_0x30fedf['query'][_0x50e8('0x34')](_0x50e8('0x35'))){_0x42bbef['limit']=qs[_0x50e8('0x1d')](_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x1d')]);_0x42bbef[_0x50e8('0x1b')]=qs['offset'](_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x1b')]);}_0x42bbef[_0x50e8('0x36')]=qs[_0x50e8('0x37')](_0x30fedf['query'][_0x50e8('0x37')]);_0x42bbef[_0x50e8('0x38')]=qs[_0x50e8('0x39')](_['pick'](_0x30fedf['query'],_0x4f0b88['filters']),_0x126c99);if(_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x3a')]){_0x42bbef[_0x50e8('0x38')]=_[_0x50e8('0x3b')](_0x42bbef[_0x50e8('0x38')],{'$or':_[_0x50e8('0x28')](_0x126c99,function(_0xb566c2){if(_0xb566c2[_0x50e8('0x3c')]!==_0x50e8('0x3d')){var _0x3a1b4d={};_0x3a1b4d[_0xb566c2['name']]={'$like':'%'+_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x3a')]+'%'};return _0x3a1b4d;}})});}_0x42bbef=_[_0x50e8('0x3b')]({},_0x42bbef,_0x30fedf[_0x50e8('0x3e')]);var _0x5dbbe1={'where':_0x42bbef[_0x50e8('0x38')]};return db[_0x50e8('0x29')][_0x50e8('0x1e')](_0x5dbbe1)[_0x50e8('0x23')](function(_0x8e8a97){_0x1041b9['count']=_0x8e8a97;if(_0x30fedf['query'][_0x50e8('0x3f')]){_0x42bbef[_0x50e8('0x40')]=[{'all':!![]}];}return db['Cdr'][_0x50e8('0x41')](_0x42bbef);})[_0x50e8('0x23')](function(_0x3db1ab){_0x1041b9[_0x50e8('0x42')]=_0x3db1ab;return _0x1041b9;})[_0x50e8('0x23')](respondWithFilteredResult(_0x39c0c6,_0x42bbef))[_0x50e8('0x43')](handleError(_0x39c0c6,null));};exports[_0x50e8('0x44')]=function(_0x172049,_0x5e9da3){var _0x3d26bd={'raw':!![],'where':{'id':_0x172049[_0x50e8('0x45')]['id']}},_0x44e0ca={};_0x44e0ca[_0x50e8('0x2d')]=_['keys'](db[_0x50e8('0x29')][_0x50e8('0x2a')]);_0x44e0ca[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x172049['query']);_0x44e0ca[_0x50e8('0x39')]=_['intersection'](_0x44e0ca['model'],_0x44e0ca['query']);_0x3d26bd[_0x50e8('0x32')]=_[_0x50e8('0x30')](_0x44e0ca['model'],qs[_0x50e8('0x31')](_0x172049[_0x50e8('0x2e')][_0x50e8('0x31')]));_0x3d26bd[_0x50e8('0x32')]=_0x3d26bd[_0x50e8('0x32')][_0x50e8('0x33')]?_0x3d26bd['attributes']:_0x44e0ca[_0x50e8('0x2d')];if(_0x172049['query'][_0x50e8('0x3f')]){_0x3d26bd[_0x50e8('0x40')]=[{'all':!![]}];}_0x3d26bd=_['merge']({},_0x3d26bd,_0x172049[_0x50e8('0x3e')]);return db['Cdr'][_0x50e8('0x46')](_0x3d26bd)[_0x50e8('0x23')](handleEntityNotFound(_0x5e9da3,null))[_0x50e8('0x23')](respondWithResult(_0x5e9da3,null))[_0x50e8('0x43')](handleError(_0x5e9da3,null));};exports[_0x50e8('0x47')]=function(_0x3f72ea,_0x229d60){return db[_0x50e8('0x29')][_0x50e8('0x47')](_0x3f72ea[_0x50e8('0x48')],{})[_0x50e8('0x23')](respondWithResult(_0x229d60,0xc9))['catch'](handleError(_0x229d60,null));};exports[_0x50e8('0x22')]=function(_0x275a1b,_0x479431){if(_0x275a1b[_0x50e8('0x48')]['id']){delete _0x275a1b['body']['id'];}return db[_0x50e8('0x29')]['find']({'where':{'id':_0x275a1b[_0x50e8('0x45')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x479431,null))[_0x50e8('0x23')](saveUpdates(_0x275a1b[_0x50e8('0x48')],null))[_0x50e8('0x23')](respondWithResult(_0x479431,null))[_0x50e8('0x43')](handleError(_0x479431,null));};exports[_0x50e8('0x49')]=function(_0x5f256a,_0x3410f3){return db[_0x50e8('0x29')][_0x50e8('0x46')]({'where':{'id':_0x5f256a[_0x50e8('0x45')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x3410f3,null))[_0x50e8('0x23')](removeEntity(_0x3410f3,null))['catch'](handleError(_0x3410f3,null));};exports[_0x50e8('0x4a')]=function(_0x250b28,_0xff2e24){return db[_0x50e8('0x29')]['describe']()[_0x50e8('0x23')](respondWithResult(_0xff2e24,null))[_0x50e8('0x43')](handleError(_0xff2e24,null));}; \ No newline at end of file +var _0xaa3f=['destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','Cdr','include','rows','show','params','includeAll','catch','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then'];(function(_0x2296fd,_0x449ea3){var _0x47a053=function(_0x807f69){while(--_0x807f69){_0x2296fd['push'](_0x2296fd['shift']());}};_0x47a053(++_0x449ea3);}(_0xaa3f,0xbb));var _0xfaa3=function(_0xd18105,_0x369399){_0xd18105=_0xd18105-0x0;var _0x2e1854=_0xaa3f[_0xd18105];return _0x2e1854;};'use strict';var emlformat=require(_0xfaa3('0x0'));var rimraf=require(_0xfaa3('0x1'));var zipdir=require(_0xfaa3('0x2'));var jsonpatch=require(_0xfaa3('0x3'));var rp=require(_0xfaa3('0x4'));var moment=require(_0xfaa3('0x5'));var BPromise=require(_0xfaa3('0x6'));var Mustache=require(_0xfaa3('0x7'));var util=require(_0xfaa3('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xfaa3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfaa3('0xa'));var _=require(_0xfaa3('0xb'));var squel=require(_0xfaa3('0xc'));var crypto=require(_0xfaa3('0xd'));var jsforce=require(_0xfaa3('0xe'));var deskjs=require(_0xfaa3('0xf'));var toCsv=require(_0xfaa3('0x9'));var querystring=require('querystring');var Papa=require(_0xfaa3('0x10'));var Redis=require(_0xfaa3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfaa3('0x12'));var hardwareService=require(_0xfaa3('0x13'));var logger=require(_0xfaa3('0x14'))(_0xfaa3('0x15'));var utils=require(_0xfaa3('0x16'));var config=require(_0xfaa3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfaa3('0x18'))['db'];function respondWithStatusCode(_0x5be067,_0x1aa8e8){_0x1aa8e8=_0x1aa8e8||0xcc;return function(_0x2b8935){if(_0x2b8935){return _0x5be067[_0xfaa3('0x19')](_0x1aa8e8);}return _0x5be067['status'](_0x1aa8e8)[_0xfaa3('0x1a')]();};}function respondWithResult(_0x5f121b,_0xdf7551){_0xdf7551=_0xdf7551||0xc8;return function(_0x84b465){if(_0x84b465){return _0x5f121b[_0xfaa3('0x1b')](_0xdf7551)[_0xfaa3('0x1c')](_0x84b465);}};}function respondWithFilteredResult(_0x1243ed,_0x40831f){return function(_0x4da250){if(_0x4da250){var _0x5f47dd=typeof _0x40831f[_0xfaa3('0x1d')]===_0xfaa3('0x1e')&&typeof _0x40831f[_0xfaa3('0x1f')]===_0xfaa3('0x1e');var _0x4e54e4=_0x4da250['count'];var _0x50f121=_0x5f47dd?0x0:_0x40831f['offset'];var _0x499148=_0x5f47dd?_0x4da250[_0xfaa3('0x20')]:_0x40831f['offset']+_0x40831f[_0xfaa3('0x1f')];var _0x42846e;if(_0x499148>=_0x4e54e4){_0x499148=_0x4e54e4;_0x42846e=0xc8;}else{_0x42846e=0xce;}_0x1243ed[_0xfaa3('0x1b')](_0x42846e);return _0x1243ed[_0xfaa3('0x21')](_0xfaa3('0x22'),_0x50f121+'-'+_0x499148+'/'+_0x4e54e4)[_0xfaa3('0x1c')](_0x4da250);}return null;};}function patchUpdates(_0x1dd053){return function(_0x1ab9cc){try{jsonpatch[_0xfaa3('0x23')](_0x1ab9cc,_0x1dd053,!![]);}catch(_0x39e91e){return BPromise['reject'](_0x39e91e);}return _0x1ab9cc[_0xfaa3('0x24')]();};}function saveUpdates(_0x755038,_0x26d9ef){return function(_0x42b214){if(_0x42b214){return _0x42b214['update'](_0x755038)[_0xfaa3('0x25')](function(_0x2d4087){return _0x2d4087;});}return null;};}function removeEntity(_0x2f077c,_0x22156a){return function(_0x16a3e3){if(_0x16a3e3){return _0x16a3e3[_0xfaa3('0x26')]()[_0xfaa3('0x25')](function(){_0x2f077c[_0xfaa3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe075fc,_0x2a1ace){return function(_0x699e72){if(!_0x699e72){_0xe075fc[_0xfaa3('0x19')](0x194);}return _0x699e72;};}function handleError(_0x31c5cd,_0xf83bbe){_0xf83bbe=_0xf83bbe||0x1f4;return function(_0x2416fe){logger[_0xfaa3('0x27')](_0x2416fe[_0xfaa3('0x28')]);if(_0x2416fe[_0xfaa3('0x29')]){delete _0x2416fe[_0xfaa3('0x29')];}_0x31c5cd[_0xfaa3('0x1b')](_0xf83bbe)[_0xfaa3('0x2a')](_0x2416fe);};}exports[_0xfaa3('0x2b')]=function(_0x2d7c43,_0x5b84cd){var _0x230430={},_0x104343={},_0xc2e71={'count':0x0,'rows':[]};var _0x54bc09=_[_0xfaa3('0x2c')](db['Cdr'][_0xfaa3('0x2d')],function(_0x5d37bb){return{'name':_0x5d37bb[_0xfaa3('0x2e')],'type':_0x5d37bb[_0xfaa3('0x2f')][_0xfaa3('0x30')]};});_0x104343[_0xfaa3('0x31')]=_[_0xfaa3('0x2c')](_0x54bc09,_0xfaa3('0x29'));_0x104343[_0xfaa3('0x32')]=_[_0xfaa3('0x33')](_0x2d7c43['query']);_0x104343[_0xfaa3('0x34')]=_[_0xfaa3('0x35')](_0x104343[_0xfaa3('0x31')],_0x104343[_0xfaa3('0x32')]);_0x230430[_0xfaa3('0x36')]=_[_0xfaa3('0x35')](_0x104343[_0xfaa3('0x31')],qs[_0xfaa3('0x37')](_0x2d7c43[_0xfaa3('0x32')][_0xfaa3('0x37')]));_0x230430[_0xfaa3('0x36')]=_0x230430[_0xfaa3('0x36')][_0xfaa3('0x38')]?_0x230430[_0xfaa3('0x36')]:_0x104343[_0xfaa3('0x31')];if(!_0x2d7c43[_0xfaa3('0x32')]['hasOwnProperty'](_0xfaa3('0x39'))){_0x230430[_0xfaa3('0x1f')]=qs[_0xfaa3('0x1f')](_0x2d7c43[_0xfaa3('0x32')][_0xfaa3('0x1f')]);_0x230430[_0xfaa3('0x1d')]=qs[_0xfaa3('0x1d')](_0x2d7c43[_0xfaa3('0x32')]['offset']);}_0x230430[_0xfaa3('0x3a')]=qs[_0xfaa3('0x3b')](_0x2d7c43[_0xfaa3('0x32')]['sort']);_0x230430[_0xfaa3('0x3c')]=qs[_0xfaa3('0x34')](_['pick'](_0x2d7c43[_0xfaa3('0x32')],_0x104343[_0xfaa3('0x34')]),_0x54bc09);if(_0x2d7c43[_0xfaa3('0x32')][_0xfaa3('0x3d')]){_0x230430[_0xfaa3('0x3c')]=_[_0xfaa3('0x3e')](_0x230430['where'],{'$or':_['map'](_0x54bc09,function(_0x41498d){if(_0x41498d[_0xfaa3('0x2f')]!=='VIRTUAL'){var _0x4ae1c3={};_0x4ae1c3[_0x41498d[_0xfaa3('0x29')]]={'$like':'%'+_0x2d7c43['query'][_0xfaa3('0x3d')]+'%'};return _0x4ae1c3;}})});}_0x230430=_[_0xfaa3('0x3e')]({},_0x230430,_0x2d7c43[_0xfaa3('0x3f')]);var _0x3fb71d={'where':_0x230430[_0xfaa3('0x3c')]};return db[_0xfaa3('0x40')][_0xfaa3('0x20')](_0x3fb71d)[_0xfaa3('0x25')](function(_0x551cd5){_0xc2e71['count']=_0x551cd5;if(_0x2d7c43['query']['includeAll']){_0x230430[_0xfaa3('0x41')]=[{'all':!![]}];}return db[_0xfaa3('0x40')]['findAll'](_0x230430);})[_0xfaa3('0x25')](function(_0xa83a03){_0xc2e71[_0xfaa3('0x42')]=_0xa83a03;return _0xc2e71;})['then'](respondWithFilteredResult(_0x5b84cd,_0x230430))['catch'](handleError(_0x5b84cd,null));};exports[_0xfaa3('0x43')]=function(_0x4c19fc,_0x1701bc){var _0x57b77c={'raw':!![],'where':{'id':_0x4c19fc[_0xfaa3('0x44')]['id']}},_0x59b4d7={};_0x59b4d7[_0xfaa3('0x31')]=_['keys'](db[_0xfaa3('0x40')]['rawAttributes']);_0x59b4d7[_0xfaa3('0x32')]=_['keys'](_0x4c19fc[_0xfaa3('0x32')]);_0x59b4d7[_0xfaa3('0x34')]=_[_0xfaa3('0x35')](_0x59b4d7['model'],_0x59b4d7[_0xfaa3('0x32')]);_0x57b77c[_0xfaa3('0x36')]=_['intersection'](_0x59b4d7[_0xfaa3('0x31')],qs[_0xfaa3('0x37')](_0x4c19fc[_0xfaa3('0x32')][_0xfaa3('0x37')]));_0x57b77c['attributes']=_0x57b77c[_0xfaa3('0x36')][_0xfaa3('0x38')]?_0x57b77c['attributes']:_0x59b4d7[_0xfaa3('0x31')];if(_0x4c19fc['query'][_0xfaa3('0x45')]){_0x57b77c[_0xfaa3('0x41')]=[{'all':!![]}];}_0x57b77c=_[_0xfaa3('0x3e')]({},_0x57b77c,_0x4c19fc['options']);return db[_0xfaa3('0x40')]['find'](_0x57b77c)['then'](handleEntityNotFound(_0x1701bc,null))[_0xfaa3('0x25')](respondWithResult(_0x1701bc,null))[_0xfaa3('0x46')](handleError(_0x1701bc,null));};exports[_0xfaa3('0x47')]=function(_0x27feb6,_0x1a4fa4){return db[_0xfaa3('0x40')][_0xfaa3('0x47')](_0x27feb6['body'],{})[_0xfaa3('0x25')](respondWithResult(_0x1a4fa4,0xc9))[_0xfaa3('0x46')](handleError(_0x1a4fa4,null));};exports[_0xfaa3('0x48')]=function(_0x72f502,_0x431725){if(_0x72f502[_0xfaa3('0x49')]['id']){delete _0x72f502[_0xfaa3('0x49')]['id'];}return db['Cdr']['find']({'where':{'id':_0x72f502['params']['id']}})[_0xfaa3('0x25')](handleEntityNotFound(_0x431725,null))[_0xfaa3('0x25')](saveUpdates(_0x72f502[_0xfaa3('0x49')],null))[_0xfaa3('0x25')](respondWithResult(_0x431725,null))['catch'](handleError(_0x431725,null));};exports[_0xfaa3('0x26')]=function(_0x50336d,_0x513d3e){return db['Cdr']['find']({'where':{'id':_0x50336d['params']['id']}})[_0xfaa3('0x25')](handleEntityNotFound(_0x513d3e,null))[_0xfaa3('0x25')](removeEntity(_0x513d3e,null))[_0xfaa3('0x46')](handleError(_0x513d3e,null));};exports[_0xfaa3('0x4a')]=function(_0x32ab8d,_0x1c856b){return db[_0xfaa3('0x40')][_0xfaa3('0x4a')]()['then'](respondWithResult(_0x1c856b,null))[_0xfaa3('0x46')](handleError(_0x1c856b,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 90e29e4..576b5a3 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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x4e5ea1,_0x397282){var _0x59cd85=function(_0x267bf0){while(--_0x267bf0){_0x4e5ea1['push'](_0x4e5ea1['shift']());}};_0x59cd85(++_0x397282);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0xb7644f,_0x2e53f9){var _0xc45bff=function(_0x56e186){while(--_0x56e186){_0xb7644f['push'](_0xb7644f['shift']());}};_0xc45bff(++_0x2e53f9);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 2e48a94..6ad63d2 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 _0xe613=['error','message','info','result','catch','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x17de94,_0x5ad3e4){var _0x22bdc6=function(_0x361fba){while(--_0x361fba){_0x17de94['push'](_0x17de94['shift']());}};_0x22bdc6(++_0x5ad3e4);}(_0xe613,0x1e8));var _0x3e61=function(_0x32b9aa,_0x33e0f7){_0x32b9aa=_0x32b9aa-0x0;var _0x3927c5=_0xe613[_0x32b9aa];return _0x3927c5;};'use strict';var _=require(_0x3e61('0x0'));var util=require(_0x3e61('0x1'));var moment=require(_0x3e61('0x2'));var BPromise=require('bluebird');var rs=require(_0x3e61('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3e61('0x4'));var logger=require('../../config/logger')(_0x3e61('0x5'));var config=require(_0x3e61('0x6'));var jayson=require(_0x3e61('0x7'));var client=jayson[_0x3e61('0x8')][_0x3e61('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14a650,_0x220010,_0x34144b){return new BPromise(function(_0x174f14,_0x5a7317){return client[_0x3e61('0xa')](_0x14a650,_0x34144b)[_0x3e61('0xb')](function(_0x19ef17){logger['info'](_0x3e61('0xc'),_0x220010,_0x3e61('0xd'));logger[_0x3e61('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x220010,_0x3e61('0xd'),JSON[_0x3e61('0xf')](_0x19ef17));if(_0x19ef17[_0x3e61('0x10')]){if(_0x19ef17[_0x3e61('0x10')]['code']===0x1f4){logger[_0x3e61('0x10')](_0x3e61('0xc'),_0x220010,_0x19ef17[_0x3e61('0x10')]['message']);return _0x5a7317(_0x19ef17[_0x3e61('0x10')][_0x3e61('0x11')]);}logger[_0x3e61('0x10')](_0x3e61('0xc'),_0x220010,_0x19ef17[_0x3e61('0x10')][_0x3e61('0x11')]);return _0x174f14(_0x19ef17[_0x3e61('0x10')][_0x3e61('0x11')]);}else{logger[_0x3e61('0x12')](_0x3e61('0xc'),_0x220010,_0x3e61('0xd'));_0x174f14(_0x19ef17[_0x3e61('0x13')][_0x3e61('0x11')]);}})[_0x3e61('0x14')](function(_0x43be83){logger[_0x3e61('0x10')](_0x3e61('0xc'),_0x220010,_0x43be83);_0x5a7317(_0x43be83);});});} \ No newline at end of file +var _0xcd50=['moment','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xcd50,0x10d));var _0x0cd5=function(_0x41ad88,_0xd30e35){_0x41ad88=_0x41ad88-0x0;var _0x40a65d=_0xcd50[_0x41ad88];return _0x40a65d;};'use strict';var _=require(_0x0cd5('0x0'));var util=require('util');var moment=require(_0x0cd5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0cd5('0x2'));var logger=require(_0x0cd5('0x3'))('rpc');var config=require(_0x0cd5('0x4'));var jayson=require(_0x0cd5('0x5'));var client=jayson['client'][_0x0cd5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xb8ebb0,_0x52b0c2,_0xf7e02b){return new BPromise(function(_0x21a76e,_0x1604bb){return client[_0x0cd5('0x7')](_0xb8ebb0,_0xf7e02b)[_0x0cd5('0x8')](function(_0x378ecc){logger[_0x0cd5('0x9')](_0x0cd5('0xa'),_0x52b0c2,_0x0cd5('0xb'));logger[_0x0cd5('0xc')](_0x0cd5('0xd'),_0x52b0c2,_0x0cd5('0xb'),JSON['stringify'](_0x378ecc));if(_0x378ecc[_0x0cd5('0xe')]){if(_0x378ecc[_0x0cd5('0xe')]['code']===0x1f4){logger[_0x0cd5('0xe')](_0x0cd5('0xa'),_0x52b0c2,_0x378ecc[_0x0cd5('0xe')]['message']);return _0x1604bb(_0x378ecc[_0x0cd5('0xe')][_0x0cd5('0xf')]);}logger[_0x0cd5('0xe')](_0x0cd5('0xa'),_0x52b0c2,_0x378ecc[_0x0cd5('0xe')][_0x0cd5('0xf')]);return _0x21a76e(_0x378ecc['error'][_0x0cd5('0xf')]);}else{logger[_0x0cd5('0x9')]('Cdr,\x20%s,\x20%s',_0x52b0c2,_0x0cd5('0xb'));_0x21a76e(_0x378ecc[_0x0cd5('0x10')]['message']);}})[_0x0cd5('0x11')](function(_0xd36aed){logger[_0x0cd5('0xe')](_0x0cd5('0xa'),_0x52b0c2,_0xd36aed);_0x1604bb(_0xd36aed);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index a41fd2d..4e4da51 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x24b78f,_0x22d90a){var _0x450887=function(_0x1d675a){while(--_0x1d675a){_0x24b78f['push'](_0x24b78f['shift']());}};_0x450887(++_0x22d90a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 4402a18..c56210b 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 _0x05a2=['INTEGER','STRING','TEXT','sequelize'];(function(_0xc2e0b4,_0x15b2b0){var _0x543b36=function(_0x12747c){while(--_0x12747c){_0xc2e0b4['push'](_0xc2e0b4['shift']());}};_0x543b36(++_0x15b2b0);}(_0x05a2,0x157));var _0x205a=function(_0x24368b,_0x64151e){_0x24368b=_0x24368b-0x0;var _0x5254f8=_0x05a2[_0x24368b];return _0x5254f8;};'use strict';var Sequelize=require(_0x205a('0x0'));module['exports']={'priority':{'type':Sequelize[_0x205a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x205a('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x205a('0x3')]()},'description':{'type':Sequelize[_0x205a('0x2')]},'interval':{'type':Sequelize[_0x205a('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x8dd0=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8dd0,0x6c));var _0x08dd=function(_0x4297b8,_0x594a56){_0x4297b8=_0x4297b8-0x0;var _0xa60c44=_0x8dd0[_0x4297b8];return _0xa60c44;};'use strict';var Sequelize=require(_0x08dd('0x0'));module[_0x08dd('0x1')]={'priority':{'type':Sequelize[_0x08dd('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x08dd('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x08dd('0x3')],'defaultValue':_0x08dd('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 7fc7057..ee5848f 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 _0xf45e=['end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','sendStatus','stack','show','params','keys','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','merge','ChatApplication','find','catch','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x318b35,_0x40902d){var _0x3e45c2=function(_0x107e72){while(--_0x107e72){_0x318b35['push'](_0x318b35['shift']());}};_0x3e45c2(++_0x40902d);}(_0xf45e,0x115));var _0xef45=function(_0x52d821,_0x60784e){_0x52d821=_0x52d821-0x0;var _0x2dfacc=_0xf45e[_0x52d821];return _0x2dfacc;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];function respondWithStatusCode(_0x30babb,_0x433be9){_0x433be9=_0x433be9||0xcc;return function(_0x476739){if(_0x476739){return _0x30babb['sendStatus'](_0x433be9);}return _0x30babb['status'](_0x433be9)[_0xef45('0x1c')]();};}function respondWithResult(_0x47fd96,_0x2ae89a){_0x2ae89a=_0x2ae89a||0xc8;return function(_0xb0fc43){if(_0xb0fc43){return _0x47fd96[_0xef45('0x1d')](_0x2ae89a)['json'](_0xb0fc43);}};}function respondWithFilteredResult(_0x5b3136,_0x29c0c4){return function(_0x5530e6){if(_0x5530e6){var _0x11cd3a=typeof _0x29c0c4[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x29c0c4[_0xef45('0x20')]==='undefined';var _0x560b2f=_0x5530e6[_0xef45('0x21')];var _0x219778=_0x11cd3a?0x0:_0x29c0c4[_0xef45('0x1e')];var _0x258785=_0x11cd3a?_0x5530e6['count']:_0x29c0c4['offset']+_0x29c0c4[_0xef45('0x20')];var _0x20ef26;if(_0x258785>=_0x560b2f){_0x258785=_0x560b2f;_0x20ef26=0xc8;}else{_0x20ef26=0xce;}_0x5b3136[_0xef45('0x1d')](_0x20ef26);return _0x5b3136[_0xef45('0x22')](_0xef45('0x23'),_0x219778+'-'+_0x258785+'/'+_0x560b2f)[_0xef45('0x24')](_0x5530e6);}return null;};}function patchUpdates(_0x375cbd){return function(_0x4a6217){try{jsonpatch[_0xef45('0x25')](_0x4a6217,_0x375cbd,!![]);}catch(_0x3e2a47){return BPromise[_0xef45('0x26')](_0x3e2a47);}return _0x4a6217[_0xef45('0x27')]();};}function saveUpdates(_0x27322f,_0x5205bf){return function(_0x40abc8){if(_0x40abc8){return _0x40abc8['update'](_0x27322f)['then'](function(_0x7707a1){return _0x7707a1;});}return null;};}function removeEntity(_0x2b41d8,_0xbb859b){return function(_0x7817d0){if(_0x7817d0){return _0x7817d0[_0xef45('0x28')]()[_0xef45('0x29')](function(){_0x2b41d8[_0xef45('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208b35,_0x5f0593){return function(_0x38b470){if(!_0x38b470){_0x208b35[_0xef45('0x2a')](0x194);}return _0x38b470;};}function handleError(_0x578f03,_0x46e423){_0x46e423=_0x46e423||0x1f4;return function(_0x2c356d){logger['error'](_0x2c356d[_0xef45('0x2b')]);if(_0x2c356d['name']){delete _0x2c356d['name'];}_0x578f03['status'](_0x46e423)['send'](_0x2c356d);};}exports[_0xef45('0x2c')]=function(_0x2f72ef,_0x217e8d){var _0x15ad38={'raw':!![],'where':{'id':_0x2f72ef[_0xef45('0x2d')]['id']}},_0x5782d0={};_0x5782d0['model']=_[_0xef45('0x2e')](db['ChatApplication'][_0xef45('0x2f')]);_0x5782d0['query']=_['keys'](_0x2f72ef[_0xef45('0x30')]);_0x5782d0[_0xef45('0x31')]=_[_0xef45('0x32')](_0x5782d0[_0xef45('0x33')],_0x5782d0[_0xef45('0x30')]);_0x15ad38['attributes']=_['intersection'](_0x5782d0['model'],qs[_0xef45('0x34')](_0x2f72ef[_0xef45('0x30')][_0xef45('0x34')]));_0x15ad38[_0xef45('0x35')]=_0x15ad38[_0xef45('0x35')][_0xef45('0x36')]?_0x15ad38[_0xef45('0x35')]:_0x5782d0['model'];if(_0x2f72ef['query'][_0xef45('0x37')]){_0x15ad38['include']=[{'all':!![]}];}_0x15ad38=_[_0xef45('0x38')]({},_0x15ad38,_0x2f72ef['options']);return db[_0xef45('0x39')][_0xef45('0x3a')](_0x15ad38)[_0xef45('0x29')](handleEntityNotFound(_0x217e8d,null))[_0xef45('0x29')](respondWithResult(_0x217e8d,null))[_0xef45('0x3b')](handleError(_0x217e8d,null));};exports['update']=function(_0x372689,_0x331fdb){if(_0x372689[_0xef45('0x3c')]['id']){delete _0x372689['body']['id'];}return db['ChatApplication'][_0xef45('0x3a')]({'where':{'id':_0x372689[_0xef45('0x2d')]['id']}})['then'](handleEntityNotFound(_0x331fdb,null))[_0xef45('0x29')](saveUpdates(_0x372689['body'],null))['then'](respondWithResult(_0x331fdb,null))[_0xef45('0x3b')](handleError(_0x331fdb,null));};exports[_0xef45('0x28')]=function(_0x2688c9,_0x573caf){return db[_0xef45('0x39')][_0xef45('0x3a')]({'where':{'id':_0x2688c9[_0xef45('0x2d')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x573caf,null))['then'](removeEntity(_0x573caf,null))['catch'](handleError(_0x573caf,null));}; \ No newline at end of file +var _0x544a=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','then','end','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','attributes','intersection','fields','includeAll','include','merge','find','catch','update','body','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','ejs','fs-extra','lodash'];(function(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_0x544a,0x118));var _0xa544=function(_0x4f9796,_0x7fb90e){_0x4f9796=_0x4f9796-0x0;var _0x5bf37a=_0x544a[_0x4f9796];return _0x5bf37a;};'use strict';var emlformat=require(_0xa544('0x0'));var rimraf=require(_0xa544('0x1'));var zipdir=require(_0xa544('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa544('0x3'));var BPromise=require(_0xa544('0x4'));var Mustache=require(_0xa544('0x5'));var util=require(_0xa544('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa544('0x7'));var fs=require('fs');var fs_extra=require(_0xa544('0x8'));var _=require(_0xa544('0x9'));var squel=require('squel');var crypto=require(_0xa544('0xa'));var jsforce=require(_0xa544('0xb'));var deskjs=require(_0xa544('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa544('0xd'));var Papa=require(_0xa544('0xe'));var Redis=require(_0xa544('0xf'));var authService=require(_0xa544('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa544('0x11'));var hardwareService=require(_0xa544('0x12'));var logger=require(_0xa544('0x13'))(_0xa544('0x14'));var utils=require(_0xa544('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa544('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c5388,_0x49bdea){_0x49bdea=_0x49bdea||0xcc;return function(_0x3de77b){if(_0x3de77b){return _0x5c5388[_0xa544('0x17')](_0x49bdea);}return _0x5c5388['status'](_0x49bdea)['end']();};}function respondWithResult(_0x53ed57,_0x3736e3){_0x3736e3=_0x3736e3||0xc8;return function(_0xe13644){if(_0xe13644){return _0x53ed57[_0xa544('0x18')](_0x3736e3)['json'](_0xe13644);}};}function respondWithFilteredResult(_0xd59245,_0xb9ecf7){return function(_0x8f8bfa){if(_0x8f8bfa){var _0x25c611=typeof _0xb9ecf7[_0xa544('0x19')]===_0xa544('0x1a')&&typeof _0xb9ecf7['limit']===_0xa544('0x1a');var _0x37c0c0=_0x8f8bfa['count'];var _0x5ddb99=_0x25c611?0x0:_0xb9ecf7[_0xa544('0x19')];var _0x3b423b=_0x25c611?_0x8f8bfa[_0xa544('0x1b')]:_0xb9ecf7[_0xa544('0x19')]+_0xb9ecf7[_0xa544('0x1c')];var _0x1a2dfb;if(_0x3b423b>=_0x37c0c0){_0x3b423b=_0x37c0c0;_0x1a2dfb=0xc8;}else{_0x1a2dfb=0xce;}_0xd59245[_0xa544('0x18')](_0x1a2dfb);return _0xd59245[_0xa544('0x1d')](_0xa544('0x1e'),_0x5ddb99+'-'+_0x3b423b+'/'+_0x37c0c0)[_0xa544('0x1f')](_0x8f8bfa);}return null;};}function patchUpdates(_0x19912e){return function(_0x317d10){try{jsonpatch[_0xa544('0x20')](_0x317d10,_0x19912e,!![]);}catch(_0xb6c18){return BPromise[_0xa544('0x21')](_0xb6c18);}return _0x317d10['save']();};}function saveUpdates(_0x4d9a8f,_0x463698){return function(_0x2fea4b){if(_0x2fea4b){return _0x2fea4b['update'](_0x4d9a8f)[_0xa544('0x22')](function(_0x272540){return _0x272540;});}return null;};}function removeEntity(_0xbda5ab,_0x12d6cf){return function(_0x3ad30a){if(_0x3ad30a){return _0x3ad30a['destroy']()['then'](function(){_0xbda5ab[_0xa544('0x18')](0xcc)[_0xa544('0x23')]();});}};}function handleEntityNotFound(_0x220cf9,_0xd55a63){return function(_0x20eee9){if(!_0x20eee9){_0x220cf9[_0xa544('0x17')](0x194);}return _0x20eee9;};}function handleError(_0x5b06f5,_0x3d23f2){_0x3d23f2=_0x3d23f2||0x1f4;return function(_0x3ec847){logger[_0xa544('0x24')](_0x3ec847[_0xa544('0x25')]);if(_0x3ec847[_0xa544('0x26')]){delete _0x3ec847[_0xa544('0x26')];}_0x5b06f5[_0xa544('0x18')](_0x3d23f2)[_0xa544('0x27')](_0x3ec847);};}exports[_0xa544('0x28')]=function(_0x17d6bb,_0x4ce5d5){var _0x53c071={'raw':!![],'where':{'id':_0x17d6bb[_0xa544('0x29')]['id']}},_0x1360e2={};_0x1360e2[_0xa544('0x2a')]=_[_0xa544('0x2b')](db[_0xa544('0x2c')][_0xa544('0x2d')]);_0x1360e2['query']=_[_0xa544('0x2b')](_0x17d6bb[_0xa544('0x2e')]);_0x1360e2['filters']=_['intersection'](_0x1360e2['model'],_0x1360e2[_0xa544('0x2e')]);_0x53c071[_0xa544('0x2f')]=_[_0xa544('0x30')](_0x1360e2[_0xa544('0x2a')],qs[_0xa544('0x31')](_0x17d6bb['query'][_0xa544('0x31')]));_0x53c071[_0xa544('0x2f')]=_0x53c071[_0xa544('0x2f')]['length']?_0x53c071[_0xa544('0x2f')]:_0x1360e2[_0xa544('0x2a')];if(_0x17d6bb[_0xa544('0x2e')][_0xa544('0x32')]){_0x53c071[_0xa544('0x33')]=[{'all':!![]}];}_0x53c071=_[_0xa544('0x34')]({},_0x53c071,_0x17d6bb['options']);return db[_0xa544('0x2c')][_0xa544('0x35')](_0x53c071)['then'](handleEntityNotFound(_0x4ce5d5,null))['then'](respondWithResult(_0x4ce5d5,null))[_0xa544('0x36')](handleError(_0x4ce5d5,null));};exports[_0xa544('0x37')]=function(_0x235e5a,_0x11d7d2){if(_0x235e5a[_0xa544('0x38')]['id']){delete _0x235e5a[_0xa544('0x38')]['id'];}return db[_0xa544('0x2c')][_0xa544('0x35')]({'where':{'id':_0x235e5a['params']['id']}})['then'](handleEntityNotFound(_0x11d7d2,null))[_0xa544('0x22')](saveUpdates(_0x235e5a[_0xa544('0x38')],null))[_0xa544('0x22')](respondWithResult(_0x11d7d2,null))[_0xa544('0x36')](handleError(_0x11d7d2,null));};exports[_0xa544('0x39')]=function(_0x30ea82,_0x21f6eb){return db[_0xa544('0x2c')][_0xa544('0x35')]({'where':{'id':_0x30ea82[_0xa544('0x29')]['id']}})['then'](handleEntityNotFound(_0x21f6eb,null))[_0xa544('0x22')](removeEntity(_0x21f6eb,null))['catch'](handleError(_0x21f6eb,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index ddc8028..a6a11db 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 _0x1312=['ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x378ea3,_0x310237){var _0x4f8ee3=function(_0x42906b){while(--_0x42906b){_0x378ea3['push'](_0x378ea3['shift']());}};_0x4f8ee3(++_0x310237);}(_0x1312,0x18c));var _0x2131=function(_0x2c763e,_0x4654de){_0x2c763e=_0x2c763e-0x0;var _0x53b5b8=_0x1312[_0x2c763e];return _0x53b5b8;};'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('./chatApplication.attributes');module[_0x2131('0x8')]=function(_0x530bcd,_0x2635c8){return _0x530bcd[_0x2131('0x9')](_0x2131('0xa'),attributes,{'tableName':_0x2131('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2131('0xc'),'collate':_0x2131('0xd')});}; \ No newline at end of file +var _0xabfc=['path','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xabfc,0x194));var _0xcabf=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0xabfc[_0x1911ed];return _0x11edaa;};'use strict';var _=require(_0xcabf('0x0'));var util=require(_0xcabf('0x1'));var logger=require(_0xcabf('0x2'))(_0xcabf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcabf('0x4'));var rimraf=require('rimraf');var config=require(_0xcabf('0x5'));var attributes=require(_0xcabf('0x6'));module[_0xcabf('0x7')]=function(_0x2a7a65,_0x73a9c6){return _0x2a7a65[_0xcabf('0x8')](_0xcabf('0x9'),attributes,{'tableName':_0xcabf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcabf('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 804890e..298a4cc 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 _0x8c87=['ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatApplication,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring'];(function(_0x1799d1,_0x15bab2){var _0x3ef261=function(_0x3ec083){while(--_0x3ec083){_0x1799d1['push'](_0x1799d1['shift']());}};_0x3ef261(++_0x15bab2);}(_0x8c87,0x1de));var _0x78c8=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8c87[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x78c8('0x0'));var util=require(_0x78c8('0x1'));var moment=require(_0x78c8('0x2'));var BPromise=require(_0x78c8('0x3'));var rs=require(_0x78c8('0x4'));var fs=require('fs');var Redis=require(_0x78c8('0x5'));var db=require(_0x78c8('0x6'))['db'];var utils=require(_0x78c8('0x7'));var logger=require(_0x78c8('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x78c8('0x9')][_0x78c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x331010,_0x520e9b,_0x478cb7){return new BPromise(function(_0x5b0799,_0x2f21ce){return client[_0x78c8('0xb')](_0x331010,_0x478cb7)['then'](function(_0x127062){logger[_0x78c8('0xc')]('ChatApplication,\x20%s,\x20%s',_0x520e9b,_0x78c8('0xd'));logger[_0x78c8('0xe')](_0x78c8('0xf'),_0x520e9b,_0x78c8('0xd'),JSON[_0x78c8('0x10')](_0x127062));if(_0x127062[_0x78c8('0x11')]){if(_0x127062[_0x78c8('0x11')]['code']===0x1f4){logger[_0x78c8('0x11')]('ChatApplication,\x20%s,\x20%s',_0x520e9b,_0x127062[_0x78c8('0x11')][_0x78c8('0x12')]);return _0x2f21ce(_0x127062[_0x78c8('0x11')][_0x78c8('0x12')]);}logger[_0x78c8('0x11')](_0x78c8('0x13'),_0x520e9b,_0x127062[_0x78c8('0x11')][_0x78c8('0x12')]);return _0x5b0799(_0x127062[_0x78c8('0x11')][_0x78c8('0x12')]);}else{logger[_0x78c8('0xc')](_0x78c8('0x13'),_0x520e9b,_0x78c8('0xd'));_0x5b0799(_0x127062[_0x78c8('0x14')][_0x78c8('0x12')]);}})['catch'](function(_0x23dec1){logger['error'](_0x78c8('0x13'),_0x520e9b,_0x23dec1);_0x2f21ce(_0x23dec1);});});} \ No newline at end of file +var _0x8253=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','message','result','catch','ChatApplication,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3cec45,_0x37d817){var _0x51d691=function(_0x2c671f){while(--_0x2c671f){_0x3cec45['push'](_0x3cec45['shift']());}};_0x51d691(++_0x37d817);}(_0x8253,0xc9));var _0x3825=function(_0x2cf683,_0x3213de){_0x2cf683=_0x2cf683-0x0;var _0x5cddff=_0x8253[_0x2cf683];return _0x5cddff;};'use strict';var _=require(_0x3825('0x0'));var util=require(_0x3825('0x1'));var moment=require(_0x3825('0x2'));var BPromise=require(_0x3825('0x3'));var rs=require(_0x3825('0x4'));var fs=require('fs');var Redis=require(_0x3825('0x5'));var db=require(_0x3825('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3825('0x7'))(_0x3825('0x8'));var config=require(_0x3825('0x9'));var jayson=require(_0x3825('0xa'));var client=jayson['client'][_0x3825('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11982f,_0xa2d048,_0x52c284){return new BPromise(function(_0x391ac2,_0x43a4c8){return client[_0x3825('0xc')](_0x11982f,_0x52c284)[_0x3825('0xd')](function(_0x380d57){logger[_0x3825('0xe')]('ChatApplication,\x20%s,\x20%s',_0xa2d048,_0x3825('0xf'));logger[_0x3825('0x10')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0xa2d048,_0x3825('0xf'),JSON[_0x3825('0x11')](_0x380d57));if(_0x380d57[_0x3825('0x12')]){if(_0x380d57['error']['code']===0x1f4){logger[_0x3825('0x12')]('ChatApplication,\x20%s,\x20%s',_0xa2d048,_0x380d57['error']['message']);return _0x43a4c8(_0x380d57[_0x3825('0x12')][_0x3825('0x13')]);}logger[_0x3825('0x12')]('ChatApplication,\x20%s,\x20%s',_0xa2d048,_0x380d57[_0x3825('0x12')][_0x3825('0x13')]);return _0x391ac2(_0x380d57[_0x3825('0x12')][_0x3825('0x13')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0xa2d048,'request\x20sent');_0x391ac2(_0x380d57[_0x3825('0x14')][_0x3825('0x13')]);}})[_0x3825('0x15')](function(_0x2858f5){logger[_0x3825('0x12')](_0x3825('0x16'),_0xa2d048,_0x2858f5);_0x43a4c8(_0x2858f5);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 8f85bb2..ec70793 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 _0x8906=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','put','update','delete'];(function(_0x56cfea,_0x39fe9f){var _0x2ce161=function(_0x815c77){while(--_0x815c77){_0x56cfea['push'](_0x56cfea['shift']());}};_0x2ce161(++_0x39fe9f);}(_0x8906,0x72));var _0x6890=function(_0x18252a,_0x29fb91){_0x18252a=_0x18252a-0x0;var _0x44dcb5=_0x8906[_0x18252a];return _0x44dcb5;};'use strict';var multer=require(_0x6890('0x0'));var util=require(_0x6890('0x1'));var path=require(_0x6890('0x2'));var timeout=require('connect-timeout');var express=require(_0x6890('0x3'));var router=express[_0x6890('0x4')]();var fs_extra=require(_0x6890('0x5'));var auth=require(_0x6890('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6890('0x7'));var controller=require('./chatApplication.controller');router[_0x6890('0x8')](_0x6890('0x9'),auth[_0x6890('0xa')](),controller['show']);router[_0x6890('0xb')](_0x6890('0x9'),auth[_0x6890('0xa')](),controller[_0x6890('0xc')]);router[_0x6890('0xd')](_0x6890('0x9'),auth[_0x6890('0xa')](),controller[_0x6890('0xe')]);module[_0x6890('0xf')]=router; \ No newline at end of file +var _0x0990=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','put','update','destroy','multer','util'];(function(_0x512e21,_0xcc6350){var _0x10c6f2=function(_0x188fb2){while(--_0x188fb2){_0x512e21['push'](_0x512e21['shift']());}};_0x10c6f2(++_0xcc6350);}(_0x0990,0x1be));var _0x0099=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x0990[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x0099('0x0'));var util=require(_0x0099('0x1'));var path=require(_0x0099('0x2'));var timeout=require(_0x0099('0x3'));var express=require(_0x0099('0x4'));var router=express[_0x0099('0x5')]();var fs_extra=require(_0x0099('0x6'));var auth=require(_0x0099('0x7'));var interaction=require(_0x0099('0x8'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0x0099('0x9')](_0x0099('0xa'),auth[_0x0099('0xb')](),controller[_0x0099('0xc')]);router[_0x0099('0xd')](_0x0099('0xa'),auth[_0x0099('0xb')](),controller[_0x0099('0xe')]);router['delete'](_0x0099('0xa'),auth[_0x0099('0xb')](),controller[_0x0099('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index d3d7053..40aae04 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 _0x83ff=['STRING','sequelize','exports'];(function(_0x56f4f0,_0x307961){var _0x86afb6=function(_0x2b6e5f){while(--_0x2b6e5f){_0x56f4f0['push'](_0x56f4f0['shift']());}};_0x86afb6(++_0x307961);}(_0x83ff,0x7c));var _0xf83f=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x83ff[_0x1f9f37];return _0x21c080;};'use strict';var Sequelize=require(_0xf83f('0x0'));module[_0xf83f('0x1')]={'name':{'type':Sequelize[_0xf83f('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x13f5=['sequelize','exports','STRING'];(function(_0x46d3a9,_0x5608a7){var _0x23f0f9=function(_0x15cc4c){while(--_0x15cc4c){_0x46d3a9['push'](_0x46d3a9['shift']());}};_0x23f0f9(++_0x5608a7);}(_0x13f5,0xc3));var _0x513f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x13f5[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x513f('0x0'));module[_0x513f('0x1')]={'name':{'type':Sequelize[_0x513f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x513f('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index e99612d..ac545c4 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 _0x4308=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','sendStatus','error','stack','name','send','index','ChatGroup','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','rawAttributes','create','body','find','describe','getUnread','params','user','toInteger','addMembers','ids','omit','findOne','User','order','getMembers','length','hasOwnProperty','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','ChatInternalMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format'];(function(_0x5bd98b,_0x22bf1c){var _0x49efe7=function(_0x2223e8){while(--_0x2223e8){_0x5bd98b['push'](_0x5bd98b['shift']());}};_0x49efe7(++_0x22bf1c);}(_0x4308,0xc7));var _0x8430=function(_0x45adf0,_0x33c79c){_0x45adf0=_0x45adf0-0x0;var _0x31134d=_0x4308[_0x45adf0];return _0x31134d;};'use strict';var emlformat=require(_0x8430('0x0'));var rimraf=require(_0x8430('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8430('0x2'));var rp=require(_0x8430('0x3'));var moment=require(_0x8430('0x4'));var BPromise=require(_0x8430('0x5'));var Mustache=require(_0x8430('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8430('0x7'));var csv=require('to-csv');var ejs=require(_0x8430('0x8'));var fs=require('fs');var fs_extra=require(_0x8430('0x9'));var _=require(_0x8430('0xa'));var squel=require(_0x8430('0xb'));var crypto=require(_0x8430('0xc'));var jsforce=require(_0x8430('0xd'));var deskjs=require(_0x8430('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8430('0xf'));var Papa=require(_0x8430('0x10'));var Redis=require(_0x8430('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8430('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8430('0x13'));var logger=require(_0x8430('0x14'))(_0x8430('0x15'));var utils=require(_0x8430('0x16'));var config=require(_0x8430('0x17'));var licenseUtil=require(_0x8430('0x18'));var db=require(_0x8430('0x19'))['db'];config[_0x8430('0x1a')]=_['defaults'](config[_0x8430('0x1a')],{'host':_0x8430('0x1b'),'port':0x18eb});var socket=require(_0x8430('0x1c'))(new Redis(config[_0x8430('0x1a')]));require(_0x8430('0x1d'))['register'](socket);function respondWithStatusCode(_0x388c9f,_0x5b1847){_0x5b1847=_0x5b1847||0xcc;return function(_0x3c93f8){if(_0x3c93f8){return _0x388c9f['sendStatus'](_0x5b1847);}return _0x388c9f[_0x8430('0x1e')](_0x5b1847)[_0x8430('0x1f')]();};}function respondWithResult(_0x362493,_0x1d48b6){_0x1d48b6=_0x1d48b6||0xc8;return function(_0x359ddc){if(_0x359ddc){return _0x362493['status'](_0x1d48b6)[_0x8430('0x20')](_0x359ddc);}};}function respondWithFilteredResult(_0x16e49c,_0x39b4a4){return function(_0x2e15ed){if(_0x2e15ed){var _0x20bb3d=typeof _0x39b4a4[_0x8430('0x21')]===_0x8430('0x22')&&typeof _0x39b4a4[_0x8430('0x23')]==='undefined';var _0x59c4aa=_0x2e15ed[_0x8430('0x24')];var _0xc584c8=_0x20bb3d?0x0:_0x39b4a4[_0x8430('0x21')];var _0x5def83=_0x20bb3d?_0x2e15ed[_0x8430('0x24')]:_0x39b4a4[_0x8430('0x21')]+_0x39b4a4['limit'];var _0x425c57;if(_0x5def83>=_0x59c4aa){_0x5def83=_0x59c4aa;_0x425c57=0xc8;}else{_0x425c57=0xce;}_0x16e49c['status'](_0x425c57);return _0x16e49c[_0x8430('0x25')](_0x8430('0x26'),_0xc584c8+'-'+_0x5def83+'/'+_0x59c4aa)['json'](_0x2e15ed);}return null;};}function patchUpdates(_0x196e18){return function(_0x3529b3){try{jsonpatch[_0x8430('0x27')](_0x3529b3,_0x196e18,!![]);}catch(_0x9a3e67){return BPromise['reject'](_0x9a3e67);}return _0x3529b3[_0x8430('0x28')]();};}function saveUpdates(_0x3e84ce,_0x3d8647){return function(_0x190a3b){if(_0x190a3b){return _0x190a3b['update'](_0x3e84ce)['then'](function(_0x138f3a){return _0x138f3a;});}return null;};}function removeEntity(_0x53c951,_0x19f7e7){return function(_0x387f74){if(_0x387f74){return _0x387f74[_0x8430('0x29')]()[_0x8430('0x2a')](function(){_0x53c951['status'](0xcc)[_0x8430('0x1f')]();});}};}function handleEntityNotFound(_0x45c7a4,_0x1f97be){return function(_0x226e24){if(!_0x226e24){_0x45c7a4[_0x8430('0x2b')](0x194);}return _0x226e24;};}function handleError(_0x23c46e,_0x4d2551){_0x4d2551=_0x4d2551||0x1f4;return function(_0xd49287){logger[_0x8430('0x2c')](_0xd49287[_0x8430('0x2d')]);if(_0xd49287[_0x8430('0x2e')]){delete _0xd49287[_0x8430('0x2e')];}_0x23c46e[_0x8430('0x1e')](_0x4d2551)[_0x8430('0x2f')](_0xd49287);};}exports[_0x8430('0x30')]=function(_0x48157b,_0x1fcfdb){var _0x8c150b={},_0x5c3506={},_0x150d20={'count':0x0,'rows':[]};var _0x33d4e6=_['map'](db[_0x8430('0x31')]['rawAttributes'],function(_0x3a5606){return{'name':_0x3a5606[_0x8430('0x32')],'type':_0x3a5606[_0x8430('0x33')][_0x8430('0x34')]};});_0x5c3506[_0x8430('0x35')]=_[_0x8430('0x36')](_0x33d4e6,_0x8430('0x2e'));_0x5c3506[_0x8430('0x37')]=_[_0x8430('0x38')](_0x48157b[_0x8430('0x37')]);_0x5c3506[_0x8430('0x39')]=_[_0x8430('0x3a')](_0x5c3506[_0x8430('0x35')],_0x5c3506[_0x8430('0x37')]);_0x8c150b['attributes']=_[_0x8430('0x3a')](_0x5c3506[_0x8430('0x35')],qs[_0x8430('0x3b')](_0x48157b[_0x8430('0x37')][_0x8430('0x3b')]));_0x8c150b['attributes']=_0x8c150b[_0x8430('0x3c')]['length']?_0x8c150b[_0x8430('0x3c')]:_0x5c3506[_0x8430('0x35')];if(!_0x48157b['query']['hasOwnProperty']('nolimit')){_0x8c150b[_0x8430('0x23')]=qs['limit'](_0x48157b[_0x8430('0x37')][_0x8430('0x23')]);_0x8c150b[_0x8430('0x21')]=qs[_0x8430('0x21')](_0x48157b[_0x8430('0x37')]['offset']);}_0x8c150b['order']=qs['sort'](_0x48157b[_0x8430('0x37')][_0x8430('0x3d')]);_0x8c150b[_0x8430('0x3e')]=qs[_0x8430('0x39')](_[_0x8430('0x3f')](_0x48157b['query'],_0x5c3506['filters']),_0x33d4e6);if(_0x48157b[_0x8430('0x37')]['filter']){_0x8c150b[_0x8430('0x3e')]=_['merge'](_0x8c150b[_0x8430('0x3e')],{'$or':_[_0x8430('0x36')](_0x33d4e6,function(_0x48aed4){if(_0x48aed4[_0x8430('0x33')]!==_0x8430('0x40')){var _0x152494={};_0x152494[_0x48aed4[_0x8430('0x2e')]]={'$like':'%'+_0x48157b[_0x8430('0x37')][_0x8430('0x41')]+'%'};return _0x152494;}})});}_0x8c150b=_[_0x8430('0x42')]({},_0x8c150b,_0x48157b[_0x8430('0x43')]);var _0x247ed0={'where':_0x8c150b[_0x8430('0x3e')]};return db[_0x8430('0x31')]['count'](_0x247ed0)[_0x8430('0x2a')](function(_0x322674){_0x150d20[_0x8430('0x24')]=_0x322674;if(_0x48157b[_0x8430('0x37')][_0x8430('0x44')]){_0x8c150b['include']=[{'all':!![]}];}return db[_0x8430('0x31')][_0x8430('0x45')](_0x8c150b);})[_0x8430('0x2a')](function(_0x2dbc6b){_0x150d20[_0x8430('0x46')]=_0x2dbc6b;return _0x150d20;})[_0x8430('0x2a')](respondWithFilteredResult(_0x1fcfdb,_0x8c150b))[_0x8430('0x47')](handleError(_0x1fcfdb,null));};exports[_0x8430('0x48')]=function(_0xb50f18,_0xcc9ad2){var _0x203c40={'raw':!![],'where':{'id':_0xb50f18['params']['id']}},_0x2d96ee={};_0x2d96ee['model']=_['keys'](db[_0x8430('0x31')][_0x8430('0x49')]);_0x2d96ee[_0x8430('0x37')]=_['keys'](_0xb50f18[_0x8430('0x37')]);_0x2d96ee[_0x8430('0x39')]=_[_0x8430('0x3a')](_0x2d96ee['model'],_0x2d96ee[_0x8430('0x37')]);_0x203c40[_0x8430('0x3c')]=_[_0x8430('0x3a')](_0x2d96ee[_0x8430('0x35')],qs[_0x8430('0x3b')](_0xb50f18['query'][_0x8430('0x3b')]));_0x203c40[_0x8430('0x3c')]=_0x203c40[_0x8430('0x3c')]['length']?_0x203c40[_0x8430('0x3c')]:_0x2d96ee[_0x8430('0x35')];if(_0xb50f18[_0x8430('0x37')][_0x8430('0x44')]){_0x203c40['include']=[{'all':!![]}];}_0x203c40=_['merge']({},_0x203c40,_0xb50f18['options']);return db['ChatGroup']['find'](_0x203c40)[_0x8430('0x2a')](handleEntityNotFound(_0xcc9ad2,null))['then'](respondWithResult(_0xcc9ad2,null))[_0x8430('0x47')](handleError(_0xcc9ad2,null));};exports[_0x8430('0x4a')]=function(_0x3b4a98,_0x49f24d){return db[_0x8430('0x31')][_0x8430('0x4a')](_0x3b4a98['body'],{})[_0x8430('0x2a')](respondWithResult(_0x49f24d,0xc9))[_0x8430('0x47')](handleError(_0x49f24d,null));};exports['update']=function(_0xa8102,_0x44708e){if(_0xa8102[_0x8430('0x4b')]['id']){delete _0xa8102[_0x8430('0x4b')]['id'];}return db[_0x8430('0x31')][_0x8430('0x4c')]({'where':{'id':_0xa8102['params']['id']}})[_0x8430('0x2a')](handleEntityNotFound(_0x44708e,null))[_0x8430('0x2a')](saveUpdates(_0xa8102[_0x8430('0x4b')],null))[_0x8430('0x2a')](respondWithResult(_0x44708e,null))[_0x8430('0x47')](handleError(_0x44708e,null));};exports[_0x8430('0x29')]=function(_0x5d8e82,_0x21b5cd){return db[_0x8430('0x31')]['find']({'where':{'id':_0x5d8e82['params']['id']}})[_0x8430('0x2a')](handleEntityNotFound(_0x21b5cd,null))[_0x8430('0x2a')](removeEntity(_0x21b5cd,null))[_0x8430('0x47')](handleError(_0x21b5cd,null));};exports[_0x8430('0x4d')]=function(_0x5cc79a,_0x356040){return db[_0x8430('0x31')][_0x8430('0x4d')]()['then'](respondWithResult(_0x356040,null))[_0x8430('0x47')](handleError(_0x356040,null));};exports[_0x8430('0x4e')]=function(_0x52a099,_0x463e8b,_0x5e67f3){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x52a099[_0x8430('0x4f')]['id'],'ToId':_0x52a099[_0x8430('0x50')]['id'],'read':![]}})['then'](function(_0x5cf6ce){return{'id':_[_0x8430('0x51')](_0x52a099['params']['id']),'count':_0x5cf6ce};})[_0x8430('0x2a')](respondWithResult(_0x463e8b,null))[_0x8430('0x47')](handleError(_0x463e8b,null));};exports[_0x8430('0x52')]=function(_0x2c499a,_0x2ac35b,_0x20a21f){return db[_0x8430('0x31')]['find']({'where':{'id':_0x2c499a[_0x8430('0x4f')]['id']}})[_0x8430('0x2a')](handleEntityNotFound(_0x2ac35b,null))[_0x8430('0x2a')](function(_0x42d588){if(_0x42d588){return _0x42d588['addMembers'](_0x2c499a['body'][_0x8430('0x53')],_[_0x8430('0x54')](_0x2c499a[_0x8430('0x4b')],[_0x8430('0x53'),'id'])||{});}})[_0x8430('0x2a')](respondWithResult(_0x2ac35b,null))[_0x8430('0x47')](handleError(_0x2ac35b,null));};exports['getMembers']=function(_0x5d621e,_0x3340fd,_0x280b49){var _0x5daaec={};var _0x1fd954={};var _0x39ce7c;var _0x208a4c;return db[_0x8430('0x31')][_0x8430('0x55')]({'where':{'id':_0x5d621e[_0x8430('0x4f')]['id']}})[_0x8430('0x2a')](handleEntityNotFound(_0x3340fd,null))[_0x8430('0x2a')](function(_0x31f41e){if(_0x31f41e){_0x39ce7c=_0x31f41e;_0x1fd954[_0x8430('0x35')]=_[_0x8430('0x38')](db[_0x8430('0x56')]['rawAttributes']);_0x1fd954[_0x8430('0x37')]=_[_0x8430('0x38')](_0x5d621e['query']);_0x1fd954[_0x8430('0x39')]=_[_0x8430('0x3a')](_0x1fd954['model'],_0x1fd954[_0x8430('0x37')]);_0x5daaec[_0x8430('0x3c')]=_[_0x8430('0x3a')](_0x1fd954[_0x8430('0x35')],qs[_0x8430('0x3b')](_0x5d621e[_0x8430('0x37')][_0x8430('0x3b')]));_0x5daaec['attributes']=_0x5daaec[_0x8430('0x3c')]['length']?_0x5daaec['attributes']:_0x1fd954['model'];_0x5daaec[_0x8430('0x57')]=qs[_0x8430('0x3d')](_0x5d621e['query'][_0x8430('0x3d')]);_0x5daaec['where']=qs['filters'](_[_0x8430('0x3f')](_0x5d621e[_0x8430('0x37')],_0x1fd954[_0x8430('0x39')]));if(_0x5d621e[_0x8430('0x37')][_0x8430('0x41')]){_0x5daaec[_0x8430('0x3e')]=_[_0x8430('0x42')](_0x5daaec[_0x8430('0x3e')],{'$or':_['map'](_0x5daaec[_0x8430('0x3c')],function(_0x5add82){var _0x5c0e7c={};_0x5c0e7c[_0x5add82]={'$like':'%'+_0x5d621e[_0x8430('0x37')]['filter']+'%'};return _0x5c0e7c;})});}_0x5daaec=_[_0x8430('0x42')]({},_0x5daaec,_0x5d621e[_0x8430('0x43')]);return _0x39ce7c[_0x8430('0x58')](_0x5daaec);}})[_0x8430('0x2a')](function(_0x522781){if(_0x522781){_0x208a4c=_0x522781[_0x8430('0x59')];if(!_0x5d621e[_0x8430('0x37')][_0x8430('0x5a')](_0x8430('0x5b'))){_0x5daaec['limit']=qs[_0x8430('0x23')](_0x5d621e[_0x8430('0x37')][_0x8430('0x23')]);_0x5daaec['offset']=qs['offset'](_0x5d621e['query'][_0x8430('0x21')]);}return _0x39ce7c[_0x8430('0x58')](_0x5daaec);}})[_0x8430('0x2a')](function(_0x395f9f){if(_0x395f9f){return _0x395f9f?{'count':_0x208a4c,'rows':_0x395f9f}:null;}})['then'](respondWithResult(_0x3340fd,null))['catch'](handleError(_0x3340fd,null));};exports[_0x8430('0x5c')]=function(_0x1852fa,_0x2a102e,_0x1fffc2){return db[_0x8430('0x31')][_0x8430('0x4c')]({'where':{'id':_0x1852fa[_0x8430('0x4f')]['id']}})[_0x8430('0x2a')](handleEntityNotFound(_0x2a102e,null))[_0x8430('0x2a')](function(_0x2b3cf0){if(_0x2b3cf0){return _0x2b3cf0[_0x8430('0x5c')](_0x1852fa[_0x8430('0x37')][_0x8430('0x53')]);}})[_0x8430('0x2a')](respondWithStatusCode(_0x2a102e,null))[_0x8430('0x47')](handleError(_0x2a102e,null));};exports[_0x8430('0x5d')]=function(_0x550d46,_0x319727,_0x571d3b){if(_0x550d46[_0x8430('0x4b')]['id']){delete _0x550d46['body']['id'];}return db['ChatGroup'][_0x8430('0x4c')]({'where':{'id':_0x550d46['params']['id']}})[_0x8430('0x2a')](handleEntityNotFound(_0x319727,null))[_0x8430('0x2a')](function(_0x221f1e){if(_0x221f1e){_0x550d46[_0x8430('0x4b')][_0x8430('0x5e')]=_0x221f1e['id'];return db['ChatInternalMessage'][_0x8430('0x4a')](_0x550d46[_0x8430('0x4b')]);}})['then'](respondWithResult(_0x319727,null))['catch'](handleError(_0x319727,null));};exports[_0x8430('0x5f')]=function(_0x1198dd,_0x1dca0c,_0x359f7a){var _0x33cf41={};var _0x187ec8={};var _0x188583;var _0xee8d3c;return db[_0x8430('0x31')][_0x8430('0x55')]({'where':{'id':_0x1198dd['params']['id']}})[_0x8430('0x2a')](handleEntityNotFound(_0x1dca0c,null))[_0x8430('0x2a')](function(_0x4774e1){if(_0x4774e1){_0x188583=_0x4774e1;_0x187ec8['model']=_[_0x8430('0x38')](db[_0x8430('0x60')][_0x8430('0x49')]);_0x187ec8[_0x8430('0x37')]=_[_0x8430('0x38')](_0x1198dd[_0x8430('0x37')]);_0x187ec8['filters']=_[_0x8430('0x3a')](_0x187ec8['model'],_0x187ec8[_0x8430('0x37')]);_0x33cf41[_0x8430('0x3c')]=_[_0x8430('0x3a')](_0x187ec8[_0x8430('0x35')],qs[_0x8430('0x3b')](_0x1198dd[_0x8430('0x37')][_0x8430('0x3b')]));_0x33cf41[_0x8430('0x3c')]=_0x33cf41[_0x8430('0x3c')][_0x8430('0x59')]?_0x33cf41[_0x8430('0x3c')]:_0x187ec8[_0x8430('0x35')];_0x33cf41[_0x8430('0x57')]=qs[_0x8430('0x3d')](_0x1198dd[_0x8430('0x37')]['sort']);_0x33cf41[_0x8430('0x3e')]=qs[_0x8430('0x39')](_[_0x8430('0x3f')](_0x1198dd[_0x8430('0x37')],_0x187ec8[_0x8430('0x39')]));if(_0x1198dd[_0x8430('0x37')][_0x8430('0x41')]){_0x33cf41[_0x8430('0x3e')]=_[_0x8430('0x42')](_0x33cf41[_0x8430('0x3e')],{'$or':_[_0x8430('0x36')](_0x33cf41['attributes'],function(_0x111f6b){var _0x31c009={};_0x31c009[_0x111f6b]={'$like':'%'+_0x1198dd[_0x8430('0x37')][_0x8430('0x41')]+'%'};return _0x31c009;})});}if(_0x1198dd[_0x8430('0x37')]['$gte']){var _0xa551f7=_0x1198dd['query'][_0x8430('0x61')][_0x8430('0x62')](',');var _0x1ee51d={};_0x1ee51d[_0xa551f7[0x0]]={'$gte':moment(_0xa551f7[0x1])['format'](_0x8430('0x63'))};_0x33cf41['where']=_['merge'](_0x33cf41['where'],_0x1ee51d);}_0x33cf41=_[_0x8430('0x42')]({},_0x33cf41,_0x1198dd['options']);return _0x188583[_0x8430('0x5f')](_0x33cf41);}})[_0x8430('0x2a')](function(_0x29faed){if(_0x29faed){_0xee8d3c=_0x29faed[_0x8430('0x59')];if(!_0x1198dd['query'][_0x8430('0x5a')]('nolimit')){_0x33cf41[_0x8430('0x23')]=qs['limit'](_0x1198dd[_0x8430('0x37')][_0x8430('0x23')]);_0x33cf41[_0x8430('0x21')]=qs[_0x8430('0x21')](_0x1198dd[_0x8430('0x37')][_0x8430('0x21')]);}return _0x188583[_0x8430('0x5f')](_0x33cf41);}})[_0x8430('0x2a')](function(_0x18f5e8){if(_0x18f5e8){return _0x18f5e8?{'count':_0xee8d3c,'rows':_0x18f5e8}:null;}})[_0x8430('0x2a')](respondWithResult(_0x1dca0c,null))[_0x8430('0x47')](handleError(_0x1dca0c,null));}; \ No newline at end of file +var _0x9abe=['ids','getMembers','findOne','User','pick','removeMembers','ChatGroupId','$gte','YYYY-MM-DD\x20HH:mm:ss','getMessages','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','end','status','json','limit','undefined','count','offset','Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','index','ChatGroup','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','findAll','show','include','catch','create','body','update','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','params','omit'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9abe,0x18a));var _0xe9ab=function(_0x37c67d,_0x434ef1){_0x37c67d=_0x37c67d-0x0;var _0x372e5e=_0x9abe[_0x37c67d];return _0x372e5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9ab('0x0'));var zipdir=require(_0xe9ab('0x1'));var jsonpatch=require(_0xe9ab('0x2'));var rp=require(_0xe9ab('0x3'));var moment=require(_0xe9ab('0x4'));var BPromise=require(_0xe9ab('0x5'));var Mustache=require('mustache');var util=require(_0xe9ab('0x6'));var path=require(_0xe9ab('0x7'));var sox=require(_0xe9ab('0x8'));var csv=require('to-csv');var ejs=require(_0xe9ab('0x9'));var fs=require('fs');var fs_extra=require(_0xe9ab('0xa'));var _=require(_0xe9ab('0xb'));var squel=require(_0xe9ab('0xc'));var crypto=require(_0xe9ab('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe9ab('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe9ab('0xf'));var Papa=require(_0xe9ab('0x10'));var Redis=require(_0xe9ab('0x11'));var authService=require(_0xe9ab('0x12'));var qs=require(_0xe9ab('0x13'));var as=require(_0xe9ab('0x14'));var hardwareService=require(_0xe9ab('0x15'));var logger=require('../../config/logger')(_0xe9ab('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe9ab('0x17'))['db'];config[_0xe9ab('0x18')]=_[_0xe9ab('0x19')](config['redis'],{'host':_0xe9ab('0x1a'),'port':0x18eb});var socket=require(_0xe9ab('0x1b'))(new Redis(config[_0xe9ab('0x18')]));require(_0xe9ab('0x1c'))[_0xe9ab('0x1d')](socket);function respondWithStatusCode(_0x25e650,_0x1ff09a){_0x1ff09a=_0x1ff09a||0xcc;return function(_0x4fa36a){if(_0x4fa36a){return _0x25e650['sendStatus'](_0x1ff09a);}return _0x25e650['status'](_0x1ff09a)[_0xe9ab('0x1e')]();};}function respondWithResult(_0x3b3fa4,_0x3bcf50){_0x3bcf50=_0x3bcf50||0xc8;return function(_0x469472){if(_0x469472){return _0x3b3fa4[_0xe9ab('0x1f')](_0x3bcf50)[_0xe9ab('0x20')](_0x469472);}};}function respondWithFilteredResult(_0x2fe581,_0x64271b){return function(_0x2eebcb){if(_0x2eebcb){var _0x1dedb0=typeof _0x64271b['offset']==='undefined'&&typeof _0x64271b[_0xe9ab('0x21')]===_0xe9ab('0x22');var _0x282e2d=_0x2eebcb[_0xe9ab('0x23')];var _0x2247bd=_0x1dedb0?0x0:_0x64271b[_0xe9ab('0x24')];var _0x21c4ab=_0x1dedb0?_0x2eebcb['count']:_0x64271b[_0xe9ab('0x24')]+_0x64271b[_0xe9ab('0x21')];var _0x33ddaa;if(_0x21c4ab>=_0x282e2d){_0x21c4ab=_0x282e2d;_0x33ddaa=0xc8;}else{_0x33ddaa=0xce;}_0x2fe581[_0xe9ab('0x1f')](_0x33ddaa);return _0x2fe581['set'](_0xe9ab('0x25'),_0x2247bd+'-'+_0x21c4ab+'/'+_0x282e2d)[_0xe9ab('0x20')](_0x2eebcb);}return null;};}function patchUpdates(_0x49b4c0){return function(_0x175d30){try{jsonpatch['apply'](_0x175d30,_0x49b4c0,!![]);}catch(_0x1ffe7a){return BPromise[_0xe9ab('0x26')](_0x1ffe7a);}return _0x175d30[_0xe9ab('0x27')]();};}function saveUpdates(_0x2440d5,_0x21e46c){return function(_0x355c7a){if(_0x355c7a){return _0x355c7a['update'](_0x2440d5)[_0xe9ab('0x28')](function(_0x52dc53){return _0x52dc53;});}return null;};}function removeEntity(_0x3caed6,_0xa43440){return function(_0x4fb770){if(_0x4fb770){return _0x4fb770[_0xe9ab('0x29')]()[_0xe9ab('0x28')](function(){_0x3caed6[_0xe9ab('0x1f')](0xcc)[_0xe9ab('0x1e')]();});}};}function handleEntityNotFound(_0x59db22,_0x3399cc){return function(_0x58b5f3){if(!_0x58b5f3){_0x59db22[_0xe9ab('0x2a')](0x194);}return _0x58b5f3;};}function handleError(_0x105b6f,_0x38c969){_0x38c969=_0x38c969||0x1f4;return function(_0x107547){logger['error'](_0x107547[_0xe9ab('0x2b')]);if(_0x107547[_0xe9ab('0x2c')]){delete _0x107547[_0xe9ab('0x2c')];}_0x105b6f[_0xe9ab('0x1f')](_0x38c969)[_0xe9ab('0x2d')](_0x107547);};}exports[_0xe9ab('0x2e')]=function(_0x45ccf0,_0x4ac7ed){var _0xea4562={},_0x43d086={},_0x16f3d1={'count':0x0,'rows':[]};var _0x5d2fb4=_['map'](db[_0xe9ab('0x2f')][_0xe9ab('0x30')],function(_0xb3c28f){return{'name':_0xb3c28f[_0xe9ab('0x31')],'type':_0xb3c28f[_0xe9ab('0x32')][_0xe9ab('0x33')]};});_0x43d086[_0xe9ab('0x34')]=_[_0xe9ab('0x35')](_0x5d2fb4,'name');_0x43d086[_0xe9ab('0x36')]=_[_0xe9ab('0x37')](_0x45ccf0[_0xe9ab('0x36')]);_0x43d086['filters']=_['intersection'](_0x43d086[_0xe9ab('0x34')],_0x43d086[_0xe9ab('0x36')]);_0xea4562['attributes']=_[_0xe9ab('0x38')](_0x43d086[_0xe9ab('0x34')],qs['fields'](_0x45ccf0[_0xe9ab('0x36')][_0xe9ab('0x39')]));_0xea4562[_0xe9ab('0x3a')]=_0xea4562[_0xe9ab('0x3a')][_0xe9ab('0x3b')]?_0xea4562[_0xe9ab('0x3a')]:_0x43d086[_0xe9ab('0x34')];if(!_0x45ccf0[_0xe9ab('0x36')][_0xe9ab('0x3c')](_0xe9ab('0x3d'))){_0xea4562[_0xe9ab('0x21')]=qs[_0xe9ab('0x21')](_0x45ccf0[_0xe9ab('0x36')][_0xe9ab('0x21')]);_0xea4562[_0xe9ab('0x24')]=qs[_0xe9ab('0x24')](_0x45ccf0[_0xe9ab('0x36')]['offset']);}_0xea4562[_0xe9ab('0x3e')]=qs[_0xe9ab('0x3f')](_0x45ccf0['query']['sort']);_0xea4562[_0xe9ab('0x40')]=qs[_0xe9ab('0x41')](_['pick'](_0x45ccf0[_0xe9ab('0x36')],_0x43d086[_0xe9ab('0x41')]),_0x5d2fb4);if(_0x45ccf0[_0xe9ab('0x36')][_0xe9ab('0x42')]){_0xea4562['where']=_['merge'](_0xea4562[_0xe9ab('0x40')],{'$or':_['map'](_0x5d2fb4,function(_0x43fbcd){if(_0x43fbcd[_0xe9ab('0x32')]!=='VIRTUAL'){var _0x413dcb={};_0x413dcb[_0x43fbcd[_0xe9ab('0x2c')]]={'$like':'%'+_0x45ccf0[_0xe9ab('0x36')]['filter']+'%'};return _0x413dcb;}})});}_0xea4562=_[_0xe9ab('0x43')]({},_0xea4562,_0x45ccf0[_0xe9ab('0x44')]);var _0x4c730c={'where':_0xea4562[_0xe9ab('0x40')]};return db[_0xe9ab('0x2f')][_0xe9ab('0x23')](_0x4c730c)['then'](function(_0xa5caac){_0x16f3d1[_0xe9ab('0x23')]=_0xa5caac;if(_0x45ccf0[_0xe9ab('0x36')][_0xe9ab('0x45')]){_0xea4562['include']=[{'all':!![]}];}return db[_0xe9ab('0x2f')][_0xe9ab('0x46')](_0xea4562);})['then'](function(_0x2ee864){_0x16f3d1['rows']=_0x2ee864;return _0x16f3d1;})[_0xe9ab('0x28')](respondWithFilteredResult(_0x4ac7ed,_0xea4562))['catch'](handleError(_0x4ac7ed,null));};exports[_0xe9ab('0x47')]=function(_0x483d15,_0x17d5b8){var _0xda82cf={'raw':!![],'where':{'id':_0x483d15['params']['id']}},_0x15102a={};_0x15102a[_0xe9ab('0x34')]=_[_0xe9ab('0x37')](db[_0xe9ab('0x2f')][_0xe9ab('0x30')]);_0x15102a[_0xe9ab('0x36')]=_['keys'](_0x483d15[_0xe9ab('0x36')]);_0x15102a[_0xe9ab('0x41')]=_[_0xe9ab('0x38')](_0x15102a[_0xe9ab('0x34')],_0x15102a[_0xe9ab('0x36')]);_0xda82cf[_0xe9ab('0x3a')]=_[_0xe9ab('0x38')](_0x15102a[_0xe9ab('0x34')],qs[_0xe9ab('0x39')](_0x483d15[_0xe9ab('0x36')][_0xe9ab('0x39')]));_0xda82cf[_0xe9ab('0x3a')]=_0xda82cf[_0xe9ab('0x3a')][_0xe9ab('0x3b')]?_0xda82cf['attributes']:_0x15102a['model'];if(_0x483d15[_0xe9ab('0x36')][_0xe9ab('0x45')]){_0xda82cf[_0xe9ab('0x48')]=[{'all':!![]}];}_0xda82cf=_[_0xe9ab('0x43')]({},_0xda82cf,_0x483d15[_0xe9ab('0x44')]);return db[_0xe9ab('0x2f')]['find'](_0xda82cf)[_0xe9ab('0x28')](handleEntityNotFound(_0x17d5b8,null))[_0xe9ab('0x28')](respondWithResult(_0x17d5b8,null))[_0xe9ab('0x49')](handleError(_0x17d5b8,null));};exports[_0xe9ab('0x4a')]=function(_0x35dcd0,_0x231f17){return db['ChatGroup'][_0xe9ab('0x4a')](_0x35dcd0[_0xe9ab('0x4b')],{})['then'](respondWithResult(_0x231f17,0xc9))[_0xe9ab('0x49')](handleError(_0x231f17,null));};exports[_0xe9ab('0x4c')]=function(_0x5213b2,_0x212d11){if(_0x5213b2[_0xe9ab('0x4b')]['id']){delete _0x5213b2['body']['id'];}return db[_0xe9ab('0x2f')][_0xe9ab('0x4d')]({'where':{'id':_0x5213b2['params']['id']}})[_0xe9ab('0x28')](handleEntityNotFound(_0x212d11,null))[_0xe9ab('0x28')](saveUpdates(_0x5213b2[_0xe9ab('0x4b')],null))[_0xe9ab('0x28')](respondWithResult(_0x212d11,null))[_0xe9ab('0x49')](handleError(_0x212d11,null));};exports[_0xe9ab('0x29')]=function(_0xb861ec,_0x4a1ada){return db[_0xe9ab('0x2f')]['find']({'where':{'id':_0xb861ec['params']['id']}})[_0xe9ab('0x28')](handleEntityNotFound(_0x4a1ada,null))['then'](removeEntity(_0x4a1ada,null))[_0xe9ab('0x49')](handleError(_0x4a1ada,null));};exports[_0xe9ab('0x4e')]=function(_0xb00936,_0x3c1a10){return db[_0xe9ab('0x2f')][_0xe9ab('0x4e')]()[_0xe9ab('0x28')](respondWithResult(_0x3c1a10,null))[_0xe9ab('0x49')](handleError(_0x3c1a10,null));};exports[_0xe9ab('0x4f')]=function(_0x7386c8,_0xf8972e,_0x265bc0){return db[_0xe9ab('0x50')][_0xe9ab('0x23')]({'where':{'ChatGroupId':_0x7386c8['params']['id'],'ToId':_0x7386c8[_0xe9ab('0x51')]['id'],'read':![]}})[_0xe9ab('0x28')](function(_0x5dc262){return{'id':_[_0xe9ab('0x52')](_0x7386c8['params']['id']),'count':_0x5dc262};})[_0xe9ab('0x28')](respondWithResult(_0xf8972e,null))[_0xe9ab('0x49')](handleError(_0xf8972e,null));};exports[_0xe9ab('0x53')]=function(_0x4b6609,_0x132203,_0x18fac5){return db['ChatGroup'][_0xe9ab('0x4d')]({'where':{'id':_0x4b6609[_0xe9ab('0x54')]['id']}})[_0xe9ab('0x28')](handleEntityNotFound(_0x132203,null))['then'](function(_0x4048b6){if(_0x4048b6){return _0x4048b6[_0xe9ab('0x53')](_0x4b6609[_0xe9ab('0x4b')]['ids'],_[_0xe9ab('0x55')](_0x4b6609[_0xe9ab('0x4b')],[_0xe9ab('0x56'),'id'])||{});}})['then'](respondWithResult(_0x132203,null))[_0xe9ab('0x49')](handleError(_0x132203,null));};exports[_0xe9ab('0x57')]=function(_0x1c8573,_0x3db793,_0x4bee1f){var _0x40779c={};var _0x119573={};var _0xce7507;var _0x453098;return db[_0xe9ab('0x2f')][_0xe9ab('0x58')]({'where':{'id':_0x1c8573[_0xe9ab('0x54')]['id']}})[_0xe9ab('0x28')](handleEntityNotFound(_0x3db793,null))[_0xe9ab('0x28')](function(_0x5244a3){if(_0x5244a3){_0xce7507=_0x5244a3;_0x119573[_0xe9ab('0x34')]=_[_0xe9ab('0x37')](db[_0xe9ab('0x59')][_0xe9ab('0x30')]);_0x119573[_0xe9ab('0x36')]=_[_0xe9ab('0x37')](_0x1c8573[_0xe9ab('0x36')]);_0x119573[_0xe9ab('0x41')]=_[_0xe9ab('0x38')](_0x119573[_0xe9ab('0x34')],_0x119573[_0xe9ab('0x36')]);_0x40779c[_0xe9ab('0x3a')]=_[_0xe9ab('0x38')](_0x119573[_0xe9ab('0x34')],qs[_0xe9ab('0x39')](_0x1c8573[_0xe9ab('0x36')][_0xe9ab('0x39')]));_0x40779c[_0xe9ab('0x3a')]=_0x40779c[_0xe9ab('0x3a')][_0xe9ab('0x3b')]?_0x40779c[_0xe9ab('0x3a')]:_0x119573[_0xe9ab('0x34')];_0x40779c[_0xe9ab('0x3e')]=qs[_0xe9ab('0x3f')](_0x1c8573[_0xe9ab('0x36')][_0xe9ab('0x3f')]);_0x40779c['where']=qs[_0xe9ab('0x41')](_[_0xe9ab('0x5a')](_0x1c8573[_0xe9ab('0x36')],_0x119573[_0xe9ab('0x41')]));if(_0x1c8573[_0xe9ab('0x36')]['filter']){_0x40779c[_0xe9ab('0x40')]=_[_0xe9ab('0x43')](_0x40779c[_0xe9ab('0x40')],{'$or':_[_0xe9ab('0x35')](_0x40779c[_0xe9ab('0x3a')],function(_0x30be6){var _0x17d39d={};_0x17d39d[_0x30be6]={'$like':'%'+_0x1c8573[_0xe9ab('0x36')]['filter']+'%'};return _0x17d39d;})});}_0x40779c=_[_0xe9ab('0x43')]({},_0x40779c,_0x1c8573[_0xe9ab('0x44')]);return _0xce7507[_0xe9ab('0x57')](_0x40779c);}})[_0xe9ab('0x28')](function(_0x50b27a){if(_0x50b27a){_0x453098=_0x50b27a['length'];if(!_0x1c8573['query'][_0xe9ab('0x3c')](_0xe9ab('0x3d'))){_0x40779c[_0xe9ab('0x21')]=qs[_0xe9ab('0x21')](_0x1c8573[_0xe9ab('0x36')][_0xe9ab('0x21')]);_0x40779c[_0xe9ab('0x24')]=qs[_0xe9ab('0x24')](_0x1c8573[_0xe9ab('0x36')][_0xe9ab('0x24')]);}return _0xce7507['getMembers'](_0x40779c);}})[_0xe9ab('0x28')](function(_0x1daf5a){if(_0x1daf5a){return _0x1daf5a?{'count':_0x453098,'rows':_0x1daf5a}:null;}})[_0xe9ab('0x28')](respondWithResult(_0x3db793,null))[_0xe9ab('0x49')](handleError(_0x3db793,null));};exports[_0xe9ab('0x5b')]=function(_0x5a06ec,_0x964d48,_0x36e841){return db[_0xe9ab('0x2f')][_0xe9ab('0x4d')]({'where':{'id':_0x5a06ec[_0xe9ab('0x54')]['id']}})[_0xe9ab('0x28')](handleEntityNotFound(_0x964d48,null))[_0xe9ab('0x28')](function(_0x4457cc){if(_0x4457cc){return _0x4457cc[_0xe9ab('0x5b')](_0x5a06ec[_0xe9ab('0x36')][_0xe9ab('0x56')]);}})[_0xe9ab('0x28')](respondWithStatusCode(_0x964d48,null))[_0xe9ab('0x49')](handleError(_0x964d48,null));};exports['addMessage']=function(_0x35bbc3,_0xa92a5e,_0x50e570){if(_0x35bbc3['body']['id']){delete _0x35bbc3[_0xe9ab('0x4b')]['id'];}return db['ChatGroup'][_0xe9ab('0x4d')]({'where':{'id':_0x35bbc3[_0xe9ab('0x54')]['id']}})['then'](handleEntityNotFound(_0xa92a5e,null))[_0xe9ab('0x28')](function(_0xbbfe45){if(_0xbbfe45){_0x35bbc3[_0xe9ab('0x4b')][_0xe9ab('0x5c')]=_0xbbfe45['id'];return db[_0xe9ab('0x50')][_0xe9ab('0x4a')](_0x35bbc3[_0xe9ab('0x4b')]);}})[_0xe9ab('0x28')](respondWithResult(_0xa92a5e,null))[_0xe9ab('0x49')](handleError(_0xa92a5e,null));};exports['getMessages']=function(_0x3fa49d,_0x55224d,_0x496f60){var _0x26c146={};var _0xc89b37={};var _0x44bacb;var _0x3e8255;return db[_0xe9ab('0x2f')]['findOne']({'where':{'id':_0x3fa49d[_0xe9ab('0x54')]['id']}})[_0xe9ab('0x28')](handleEntityNotFound(_0x55224d,null))['then'](function(_0x1041c6){if(_0x1041c6){_0x44bacb=_0x1041c6;_0xc89b37['model']=_[_0xe9ab('0x37')](db[_0xe9ab('0x50')][_0xe9ab('0x30')]);_0xc89b37[_0xe9ab('0x36')]=_[_0xe9ab('0x37')](_0x3fa49d[_0xe9ab('0x36')]);_0xc89b37[_0xe9ab('0x41')]=_[_0xe9ab('0x38')](_0xc89b37[_0xe9ab('0x34')],_0xc89b37[_0xe9ab('0x36')]);_0x26c146[_0xe9ab('0x3a')]=_['intersection'](_0xc89b37['model'],qs[_0xe9ab('0x39')](_0x3fa49d['query'][_0xe9ab('0x39')]));_0x26c146[_0xe9ab('0x3a')]=_0x26c146['attributes'][_0xe9ab('0x3b')]?_0x26c146[_0xe9ab('0x3a')]:_0xc89b37[_0xe9ab('0x34')];_0x26c146['order']=qs[_0xe9ab('0x3f')](_0x3fa49d['query'][_0xe9ab('0x3f')]);_0x26c146[_0xe9ab('0x40')]=qs[_0xe9ab('0x41')](_['pick'](_0x3fa49d[_0xe9ab('0x36')],_0xc89b37[_0xe9ab('0x41')]));if(_0x3fa49d[_0xe9ab('0x36')]['filter']){_0x26c146[_0xe9ab('0x40')]=_[_0xe9ab('0x43')](_0x26c146[_0xe9ab('0x40')],{'$or':_[_0xe9ab('0x35')](_0x26c146[_0xe9ab('0x3a')],function(_0x25b090){var _0x5623be={};_0x5623be[_0x25b090]={'$like':'%'+_0x3fa49d[_0xe9ab('0x36')][_0xe9ab('0x42')]+'%'};return _0x5623be;})});}if(_0x3fa49d[_0xe9ab('0x36')][_0xe9ab('0x5d')]){var _0x1ac17f=_0x3fa49d[_0xe9ab('0x36')][_0xe9ab('0x5d')]['split'](',');var _0x4faf12={};_0x4faf12[_0x1ac17f[0x0]]={'$gte':moment(_0x1ac17f[0x1])['format'](_0xe9ab('0x5e'))};_0x26c146['where']=_[_0xe9ab('0x43')](_0x26c146[_0xe9ab('0x40')],_0x4faf12);}_0x26c146=_[_0xe9ab('0x43')]({},_0x26c146,_0x3fa49d[_0xe9ab('0x44')]);return _0x44bacb[_0xe9ab('0x5f')](_0x26c146);}})[_0xe9ab('0x28')](function(_0x59027a){if(_0x59027a){_0x3e8255=_0x59027a[_0xe9ab('0x3b')];if(!_0x3fa49d[_0xe9ab('0x36')]['hasOwnProperty']('nolimit')){_0x26c146[_0xe9ab('0x21')]=qs[_0xe9ab('0x21')](_0x3fa49d[_0xe9ab('0x36')][_0xe9ab('0x21')]);_0x26c146[_0xe9ab('0x24')]=qs['offset'](_0x3fa49d['query'][_0xe9ab('0x24')]);}return _0x44bacb[_0xe9ab('0x5f')](_0x26c146);}})[_0xe9ab('0x28')](function(_0x3b3a4d){if(_0x3b3a4d){return _0x3b3a4d?{'count':_0x3e8255,'rows':_0x3b3a4d}:null;}})[_0xe9ab('0x28')](respondWithResult(_0x55224d,null))[_0xe9ab('0x49')](handleError(_0x55224d,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 9afd4b0..0c8ef9e 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 _0x848e=['exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','remove','emit','hook'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x848e,0x91));var _0xe848=function(_0x5e961f,_0x410eac){_0x5e961f=_0x5e961f-0x0;var _0x157371=_0x848e[_0x5e961f];return _0x157371;};'use strict';var EventEmitter=require(_0xe848('0x0'));var ChatGroup=require(_0xe848('0x1'))['db'][_0xe848('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xe848('0x3')](0x0);var events={'afterCreate':_0xe848('0x4'),'afterUpdate':'update','afterDestroy':_0xe848('0x5')};function emitEvent(_0x24f745){return function(_0x29f658,_0x5ed1b8,_0x11f497){ChatGroupEvents[_0xe848('0x6')](_0x24f745+':'+_0x29f658['id'],_0x29f658);ChatGroupEvents['emit'](_0x24f745,_0x29f658);_0x11f497(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xe848('0x7')](e,emitEvent(event));}}module[_0xe848('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xb725=['save','update','remove','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xb725,0x86));var _0x5b72=function(_0x1c5b14,_0x101ecd){_0x1c5b14=_0x1c5b14-0x0;var _0xa7c78e=_0xb725[_0x1c5b14];return _0xa7c78e;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5b72('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5b72('0x1')](0x0);var events={'afterCreate':_0x5b72('0x2'),'afterUpdate':_0x5b72('0x3'),'afterDestroy':_0x5b72('0x4')};function emitEvent(_0xde5e3a){return function(_0x3fa8ef,_0x1bf63a,_0x32e4e3){ChatGroupEvents[_0x5b72('0x5')](_0xde5e3a+':'+_0x3fa8ef['id'],_0x3fa8ef);ChatGroupEvents[_0x5b72('0x5')](_0xde5e3a,_0x3fa8ef);_0x32e4e3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x5b72('0x6')](e,emitEvent(event));}}module[_0x5b72('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 98c0f89..b15c179 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 _0x545c=['exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','moment','bluebird','./chatGroup.attributes'];(function(_0x60289f,_0x4f3377){var _0x36865f=function(_0x578c17){while(--_0x578c17){_0x60289f['push'](_0x60289f['shift']());}};_0x36865f(++_0x4f3377);}(_0x545c,0x7c));var _0xc545=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0x545c[_0x55fa03];return _0x2cd7cd;};'use strict';var _=require(_0xc545('0x0'));var util=require(_0xc545('0x1'));var logger=require(_0xc545('0x2'))('api');var moment=require(_0xc545('0x3'));var BPromise=require(_0xc545('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(_0xc545('0x5'));module[_0xc545('0x6')]=function(_0x2eb498,_0x5a9e02){return _0x2eb498[_0xc545('0x7')](_0xc545('0x8'),attributes,{'tableName':_0xc545('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc884=['bluebird','request-promise','path','rimraf','../../config/environment','define','lodash','util','../../config/logger','api','moment'];(function(_0x51f012,_0x629f0d){var _0x1e3e8f=function(_0x5f4175){while(--_0x5f4175){_0x51f012['push'](_0x51f012['shift']());}};_0x1e3e8f(++_0x629f0d);}(_0xc884,0x7f));var _0x4c88=function(_0x24b583,_0x40a7fb){_0x24b583=_0x24b583-0x0;var _0x3b1db6=_0xc884[_0x24b583];return _0x3b1db6;};'use strict';var _=require(_0x4c88('0x0'));var util=require(_0x4c88('0x1'));var logger=require(_0x4c88('0x2'))(_0x4c88('0x3'));var moment=require(_0x4c88('0x4'));var BPromise=require(_0x4c88('0x5'));var rp=require(_0x4c88('0x6'));var fs=require('fs');var path=require(_0x4c88('0x7'));var rimraf=require(_0x4c88('0x8'));var config=require(_0x4c88('0x9'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x4d6602,_0x4b6185){return _0x4d6602[_0x4c88('0xa')]('ChatGroup',attributes,{'tableName':'chat_groups','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 384db53..53e7c55 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 _0x1ef8=['../../config/utils','../../config/logger','rpc','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','ioredis','../../mysqldb'];(function(_0x28845d,_0x2daf95){var _0x307c44=function(_0x195e04){while(--_0x195e04){_0x28845d['push'](_0x28845d['shift']());}};_0x307c44(++_0x2daf95);}(_0x1ef8,0xd5));var _0x81ef=function(_0x275d1e,_0x43c255){_0x275d1e=_0x275d1e-0x0;var _0x2ac12d=_0x1ef8[_0x275d1e];return _0x2ac12d;};'use strict';var _=require(_0x81ef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81ef('0x1'));var db=require(_0x81ef('0x2'))['db'];var utils=require(_0x81ef('0x3'));var logger=require(_0x81ef('0x4'))(_0x81ef('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x81ef('0x6')]({'port':0x232a});config[_0x81ef('0x7')]=_[_0x81ef('0x8')](config[_0x81ef('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x81ef('0x9'))(new Redis(config[_0x81ef('0x7')]));require(_0x81ef('0xa'))[_0x81ef('0xb')](socket);function respondWithRpcPromise(_0x8483a8,_0x56cc41,_0x172a2b){return new BPromise(function(_0x162701,_0x536c5f){return client[_0x81ef('0xc')](_0x8483a8,_0x172a2b)[_0x81ef('0xd')](function(_0x2c7964){logger[_0x81ef('0xe')](_0x81ef('0xf'),_0x56cc41,_0x81ef('0x10'));logger[_0x81ef('0x11')](_0x81ef('0x12'),_0x56cc41,_0x81ef('0x10'),JSON[_0x81ef('0x13')](_0x2c7964));if(_0x2c7964[_0x81ef('0x14')]){if(_0x2c7964[_0x81ef('0x14')][_0x81ef('0x15')]===0x1f4){logger[_0x81ef('0x14')]('ChatGroup,\x20%s,\x20%s',_0x56cc41,_0x2c7964[_0x81ef('0x14')][_0x81ef('0x16')]);return _0x536c5f(_0x2c7964[_0x81ef('0x14')][_0x81ef('0x16')]);}logger[_0x81ef('0x14')](_0x81ef('0xf'),_0x56cc41,_0x2c7964[_0x81ef('0x14')][_0x81ef('0x16')]);return _0x162701(_0x2c7964[_0x81ef('0x14')]['message']);}else{logger[_0x81ef('0xe')]('ChatGroup,\x20%s,\x20%s',_0x56cc41,'request\x20sent');_0x162701(_0x2c7964[_0x81ef('0x17')][_0x81ef('0x16')]);}})['catch'](function(_0x5e8133){logger[_0x81ef('0x14')](_0x81ef('0xf'),_0x56cc41,_0x5e8133);_0x536c5f(_0x5e8133);});});} \ No newline at end of file +var _0x7e63=['http','redis','localhost','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7e63,0x74));var _0x37e6=function(_0x487def,_0x21f550){_0x487def=_0x487def-0x0;var _0xfc3c95=_0x7e63[_0x487def];return _0xfc3c95;};'use strict';var _=require(_0x37e6('0x0'));var util=require(_0x37e6('0x1'));var moment=require(_0x37e6('0x2'));var BPromise=require('bluebird');var rs=require(_0x37e6('0x3'));var fs=require('fs');var Redis=require(_0x37e6('0x4'));var db=require(_0x37e6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x37e6('0x6'))(_0x37e6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x37e6('0x8')][_0x37e6('0x9')]({'port':0x232a});config[_0x37e6('0xa')]=_['defaults'](config[_0x37e6('0xa')],{'host':_0x37e6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x37e6('0xa')]));require(_0x37e6('0xc'))[_0x37e6('0xd')](socket);function respondWithRpcPromise(_0xfdc255,_0x5ea219,_0x676035){return new BPromise(function(_0x1f5d30,_0x10eb16){return client['request'](_0xfdc255,_0x676035)[_0x37e6('0xe')](function(_0x3f3158){logger[_0x37e6('0xf')](_0x37e6('0x10'),_0x5ea219,_0x37e6('0x11'));logger[_0x37e6('0x12')](_0x37e6('0x13'),_0x5ea219,_0x37e6('0x11'),JSON[_0x37e6('0x14')](_0x3f3158));if(_0x3f3158[_0x37e6('0x15')]){if(_0x3f3158[_0x37e6('0x15')]['code']===0x1f4){logger[_0x37e6('0x15')]('ChatGroup,\x20%s,\x20%s',_0x5ea219,_0x3f3158['error'][_0x37e6('0x16')]);return _0x10eb16(_0x3f3158['error'][_0x37e6('0x16')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x5ea219,_0x3f3158[_0x37e6('0x15')][_0x37e6('0x16')]);return _0x1f5d30(_0x3f3158[_0x37e6('0x15')]['message']);}else{logger[_0x37e6('0xf')](_0x37e6('0x10'),_0x5ea219,_0x37e6('0x11'));_0x1f5d30(_0x3f3158[_0x37e6('0x17')][_0x37e6('0x16')]);}})[_0x37e6('0x18')](function(_0x3cfebd){logger[_0x37e6('0x15')](_0x37e6('0x10'),_0x5ea219,_0x3cfebd);_0x10eb16(_0x3cfebd);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 37ae6cb..196fd83 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 _0x81b9=['save','update','emit','./chatGroup.events'];(function(_0x555e6f,_0x4ed03d){var _0x9e1f68=function(_0x4b505c){while(--_0x4b505c){_0x555e6f['push'](_0x555e6f['shift']());}};_0x9e1f68(++_0x4ed03d);}(_0x81b9,0x1bb));var _0x981b=function(_0xed093e,_0x250201){_0xed093e=_0xed093e-0x0;var _0x335e1e=_0x81b9[_0xed093e];return _0x335e1e;};'use strict';var ChatGroupEvents=require(_0x981b('0x0'));var events=[_0x981b('0x1'),'remove',_0x981b('0x2')];function createListener(_0x1948b3,_0x4bea83){return function(_0x41769f){_0x4bea83[_0x981b('0x3')](_0x1948b3,_0x41769f);};}function removeListener(_0x66010a,_0x1f24cb){return function(){ChatGroupEvents['removeListener'](_0x66010a,_0x1f24cb);};}exports['register']=function(_0x11e070){for(var _0xab46d9=0x0,_0x5b9574=events['length'];_0xab46d9<_0x5b9574;_0xab46d9++){var _0x7cc619=events[_0xab46d9];var _0x21ea34=createListener('chatGroup:'+_0x7cc619,_0x11e070);ChatGroupEvents['on'](_0x7cc619,_0x21ea34);}}; \ No newline at end of file +var _0x4855=['remove','update','removeListener','chatGroup:','./chatGroup.events','save'];(function(_0xcb3db8,_0x323343){var _0x44bbc0=function(_0x409f0c){while(--_0x409f0c){_0xcb3db8['push'](_0xcb3db8['shift']());}};_0x44bbc0(++_0x323343);}(_0x4855,0xe8));var _0x5485=function(_0x302d0b,_0x2c7dbb){_0x302d0b=_0x302d0b-0x0;var _0x3b9e1d=_0x4855[_0x302d0b];return _0x3b9e1d;};'use strict';var ChatGroupEvents=require(_0x5485('0x0'));var events=[_0x5485('0x1'),_0x5485('0x2'),_0x5485('0x3')];function createListener(_0x11f7e9,_0x331f7c){return function(_0x578a0b){_0x331f7c['emit'](_0x11f7e9,_0x578a0b);};}function removeListener(_0x199e0a,_0x7b9047){return function(){ChatGroupEvents[_0x5485('0x4')](_0x199e0a,_0x7b9047);};}exports['register']=function(_0x23218f){for(var _0x52c7dd=0x0,_0x2998c0=events['length'];_0x52c7dd<_0x2998c0;_0x52c7dd++){var _0x225ba3=events[_0x52c7dd];var _0x284e60=createListener(_0x5485('0x5')+_0x225ba3,_0x23218f);ChatGroupEvents['on'](_0x225ba3,_0x284e60);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 1e0fb9d..6ec5f2e 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 _0x6110=['/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMessage','put','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','fs-extra','./chatGroup.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x6110,0x7b));var _0x0611=function(_0x3c404d,_0x5a7675){_0x3c404d=_0x3c404d-0x0;var _0x1c2389=_0x6110[_0x3c404d];return _0x1c2389;};'use strict';var multer=require(_0x0611('0x0'));var util=require(_0x0611('0x1'));var path=require(_0x0611('0x2'));var timeout=require(_0x0611('0x3'));var express=require(_0x0611('0x4'));var router=express['Router']();var fs_extra=require(_0x0611('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0611('0x6'));router[_0x0611('0x7')]('/',auth[_0x0611('0x8')](),controller[_0x0611('0x9')]);router[_0x0611('0x7')](_0x0611('0xa'),auth[_0x0611('0x8')](),controller[_0x0611('0xb')]);router[_0x0611('0x7')](_0x0611('0xc'),auth[_0x0611('0x8')](),controller[_0x0611('0xd')]);router[_0x0611('0x7')](_0x0611('0xe'),auth['isAuthenticated'](),controller[_0x0611('0xf')]);router[_0x0611('0x7')](_0x0611('0x10'),auth[_0x0611('0x8')](),controller[_0x0611('0x11')]);router['get'](_0x0611('0x12'),auth[_0x0611('0x8')](),controller['getMessages']);router[_0x0611('0x13')]('/',auth[_0x0611('0x8')](),controller[_0x0611('0x14')]);router['post'](_0x0611('0x10'),auth[_0x0611('0x8')](),controller['addMembers']);router[_0x0611('0x13')](_0x0611('0x12'),auth['isAuthenticated'](),controller[_0x0611('0x15')]);router[_0x0611('0x16')](_0x0611('0xc'),auth[_0x0611('0x8')](),controller['update']);router[_0x0611('0x17')](_0x0611('0xc'),auth[_0x0611('0x8')](),controller[_0x0611('0x18')]);router[_0x0611('0x17')]('/:id/members',auth[_0x0611('0x8')](),controller[_0x0611('0x19')]);module[_0x0611('0x1a')]=router; \ No newline at end of file +var _0x9010=['../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','/:id','update','delete','removeMembers','multer','util','path','connect-timeout','fs-extra'];(function(_0x27d6c5,_0x4c0e92){var _0x51fba6=function(_0xc58e1a){while(--_0xc58e1a){_0x27d6c5['push'](_0x27d6c5['shift']());}};_0x51fba6(++_0x4c0e92);}(_0x9010,0x119));var _0x0901=function(_0x128aad,_0x21772f){_0x128aad=_0x128aad-0x0;var _0x749813=_0x9010[_0x128aad];return _0x749813;};'use strict';var multer=require(_0x0901('0x0'));var util=require(_0x0901('0x1'));var path=require(_0x0901('0x2'));var timeout=require(_0x0901('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0901('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0901('0x5'));var controller=require('./chatGroup.controller');router[_0x0901('0x6')]('/',auth[_0x0901('0x7')](),controller['index']);router[_0x0901('0x6')](_0x0901('0x8'),auth['isAuthenticated'](),controller[_0x0901('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0901('0xa')]);router[_0x0901('0x6')](_0x0901('0xb'),auth[_0x0901('0x7')](),controller[_0x0901('0xc')]);router[_0x0901('0x6')](_0x0901('0xd'),auth[_0x0901('0x7')](),controller[_0x0901('0xe')]);router[_0x0901('0x6')](_0x0901('0xf'),auth['isAuthenticated'](),controller[_0x0901('0x10')]);router[_0x0901('0x11')]('/',auth[_0x0901('0x7')](),controller[_0x0901('0x12')]);router[_0x0901('0x11')]('/:id/members',auth[_0x0901('0x7')](),controller[_0x0901('0x13')]);router[_0x0901('0x11')](_0x0901('0xf'),auth['isAuthenticated'](),controller[_0x0901('0x14')]);router[_0x0901('0x15')](_0x0901('0x16'),auth[_0x0901('0x7')](),controller[_0x0901('0x17')]);router[_0x0901('0x18')]('/:id',auth[_0x0901('0x7')](),controller['destroy']);router[_0x0901('0x18')](_0x0901('0xd'),auth[_0x0901('0x7')](),controller[_0x0901('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 6078d3f..e51ae36 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 _0x750a=['TEXT','STRING','DATE','out','BOOLEAN','exports','ENUM','star','thumb'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x750a,0x140));var _0xa750=function(_0x161e1f,_0x1942db){_0x161e1f=_0x161e1f-0x0;var _0x3e44d9=_0x750a[_0x161e1f];return _0x3e44d9;};'use strict';var Sequelize=require('sequelize');module[_0xa750('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xa750('0x1')](_0xa750('0x2'),_0xa750('0x3')),'defaultValue':_0xa750('0x2')},'ratingMessage':{'type':Sequelize[_0xa750('0x4')]},'pathTranscript':{'type':Sequelize[_0xa750('0x4')]},'mailTranscript':{'type':Sequelize[_0xa750('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa750('0x6')]},'disposition':{'type':Sequelize[_0xa750('0x5')]},'secondDisposition':{'type':Sequelize[_0xa750('0x5')]},'thirdDisposition':{'type':Sequelize[_0xa750('0x5')]},'note':{'type':Sequelize[_0xa750('0x5')]},'browserName':{'type':Sequelize[_0xa750('0x5')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xa750('0x5')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xa750('0x5')]},'deviceType':{'type':Sequelize[_0xa750('0x5')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xa750('0x5')]},'formData':{'type':Sequelize[_0xa750('0x4')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xa750('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa750('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa750('0x5')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xa750('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xa750('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x6739=['DATE','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','TEXT','STRING','long'];(function(_0x512c83,_0x42a67a){var _0x1f7f25=function(_0x1e656c){while(--_0x1e656c){_0x512c83['push'](_0x512c83['shift']());}};_0x1f7f25(++_0x42a67a);}(_0x6739,0xd3));var _0x9673=function(_0x273f19,_0x5d7eef){_0x273f19=_0x273f19-0x0;var _0xc4a5ee=_0x6739[_0x273f19];return _0xc4a5ee;};'use strict';var Sequelize=require(_0x9673('0x0'));module[_0x9673('0x1')]={'closed':{'type':Sequelize[_0x9673('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x9673('0x3')]},'ratingType':{'type':Sequelize[_0x9673('0x4')](_0x9673('0x5'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x9673('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x9673('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9673('0x7')]},'thirdDisposition':{'type':Sequelize[_0x9673('0x7')]},'note':{'type':Sequelize[_0x9673('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x9673('0x7')]},'osVersion':{'type':Sequelize[_0x9673('0x7')]},'deviceModel':{'type':Sequelize[_0x9673('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x9673('0x7')]},'referer':{'type':Sequelize[_0x9673('0x6')]},'customerIp':{'type':Sequelize[_0x9673('0x7')]},'formData':{'type':Sequelize['TEXT'](_0x9673('0x8'))},'read1stAt':{'type':Sequelize[_0x9673('0x9')]},'lastMsgAt':{'type':Sequelize[_0x9673('0x9')]},'lastMsgDirection':{'type':Sequelize[_0x9673('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x9673('0x7')]},'customerPort':{'type':Sequelize[_0x9673('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x9673('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x9673('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 680f7ab..b8b8397 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 _0x5f2f=['vidaooMetadata','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','entity\x20not\x20found','sendStatus','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','basename','download','mailTranscript','format','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','System','customer','%s%d','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','MailAccount','MailServerOut','Smtp','service','host','port','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','omit','getMessages','pick','includeAll','findAll','getMyMessages','includeAgent','alias','setTags','ids','spread','color','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','direction','Account','Owner','get','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','status','end','limit','undefined','count','set','Content-Range','json','apply','save','update','name','merge','body','contact','account','Users','map','fullname','TagIds','Tags','split','forEach','push','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','select','field','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','find','ContactId','buildExpression','text','start','Tag','union','User','UserId','some','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','parse','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','contactName','DESC','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','keyBy','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','include','options','create','destroy','params','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow'];(function(_0x54a761,_0x431fd4){var _0x37d1da=function(_0x5ca617){while(--_0x5ca617){_0x54a761['push'](_0x54a761['shift']());}};_0x37d1da(++_0x431fd4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x11025b,_0x2e5cf5){_0x11025b=_0x11025b-0x0;var _0x54b836=_0x5f2f[_0x11025b];return _0x54b836;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5f2('0x14'))(_0xf5f2('0x15'));var utils=require('../../config/utils');var config=require(_0xf5f2('0x16'));var licenseUtil=require(_0xf5f2('0x17'));var db=require(_0xf5f2('0x18'))['db'];config[_0xf5f2('0x19')]=_[_0xf5f2('0x1a')](config[_0xf5f2('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xf5f2('0x1b'))(new Redis(config[_0xf5f2('0x19')]));require(_0xf5f2('0x1c'))[_0xf5f2('0x1d')](socket);var jayson=require(_0xf5f2('0x1e'));var client=jayson['client'][_0xf5f2('0x1f')]({'port':0x232b});var client9004=jayson[_0xf5f2('0x20')][_0xf5f2('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x1b6dd2,_0x23e23a,_0x3a9dbb,_0xdb61b3){return new BPromise(function(_0x395a5a,_0x11f702){var _0x228ace=_0xdb61b3||client;return _0x228ace[_0xf5f2('0x21')](_0x1b6dd2,_0x3a9dbb)[_0xf5f2('0x22')](function(_0x4ff59b){logger[_0xf5f2('0x23')](_0xf5f2('0x24'),_0x23e23a,_0xf5f2('0x25'));logger[_0xf5f2('0x26')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x23e23a,_0xf5f2('0x25'),JSON[_0xf5f2('0x27')](_0x4ff59b));if(_0x4ff59b['error']){if(_0x4ff59b['error'][_0xf5f2('0x28')]===0x1f4){logger[_0xf5f2('0x29')]('ChatInteraction,\x20%s,\x20%s',_0x23e23a,_0x4ff59b[_0xf5f2('0x29')][_0xf5f2('0x2a')]);return _0x11f702(_0x4ff59b[_0xf5f2('0x29')][_0xf5f2('0x2a')]);}logger[_0xf5f2('0x29')]('ChatInteraction,\x20%s,\x20%s',_0x23e23a,_0x4ff59b[_0xf5f2('0x29')][_0xf5f2('0x2a')]);return _0x395a5a(_0x4ff59b[_0xf5f2('0x29')][_0xf5f2('0x2a')]);}else{logger[_0xf5f2('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x23e23a,'request\x20sent');_0x395a5a(_0x4ff59b[_0xf5f2('0x2b')][_0xf5f2('0x2a')]);}})[_0xf5f2('0x2c')](function(_0x1a5bb3){logger[_0xf5f2('0x29')](_0xf5f2('0x24'),_0x23e23a,_0x1a5bb3);_0x11f702(_0x1a5bb3);});});}function respondWithStatusCode(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0xcc;return function(_0x294414){if(_0x294414){return _0x13a3be['sendStatus'](_0x281ec8);}return _0x13a3be[_0xf5f2('0x2d')](_0x281ec8)[_0xf5f2('0x2e')]();};}function respondWithResult(_0x375ca8,_0x31bfcb){_0x31bfcb=_0x31bfcb||0xc8;return function(_0x198c73){if(_0x198c73){return _0x375ca8[_0xf5f2('0x2d')](_0x31bfcb)['json'](_0x198c73);}};}function respondWithFilteredResult(_0x53cb96,_0x22c826){return function(_0x14c829){if(_0x14c829){var _0x11c771=typeof _0x22c826['offset']==='undefined'&&typeof _0x22c826[_0xf5f2('0x2f')]===_0xf5f2('0x30');var _0x17394a=_0x14c829[_0xf5f2('0x31')];var _0x1b381e=_0x11c771?0x0:_0x22c826['offset'];var _0x52e959=_0x11c771?_0x14c829[_0xf5f2('0x31')]:_0x22c826['offset']+_0x22c826[_0xf5f2('0x2f')];var _0x58a4df;if(_0x52e959>=_0x17394a){_0x52e959=_0x17394a;_0x58a4df=0xc8;}else{_0x58a4df=0xce;}_0x53cb96[_0xf5f2('0x2d')](_0x58a4df);return _0x53cb96[_0xf5f2('0x32')](_0xf5f2('0x33'),_0x1b381e+'-'+_0x52e959+'/'+_0x17394a)[_0xf5f2('0x34')](_0x14c829);}return null;};}function patchUpdates(_0x256bd9){return function(_0x277eee){try{jsonpatch[_0xf5f2('0x35')](_0x277eee,_0x256bd9,!![]);}catch(_0x2c0e05){return BPromise['reject'](_0x2c0e05);}return _0x277eee[_0xf5f2('0x36')]();};}function saveUpdates(_0x43e4ff,_0x4590ec){return function(_0x43c77d){if(_0x43c77d){return _0x43c77d[_0xf5f2('0x37')](_0x43e4ff)[_0xf5f2('0x22')](function(_0x297c0c){return _0x297c0c;});}return null;};}function removeEntity(_0x48d64d,_0x144646){return function(_0xf503e8){if(_0xf503e8){return _0xf503e8['destroy']()[_0xf5f2('0x22')](function(){_0x48d64d['status'](0xcc)[_0xf5f2('0x2e')]();});}};}function handleEntityNotFound(_0x3930fb,_0x2a2c31){return function(_0x2e3cca){if(!_0x2e3cca){_0x3930fb['sendStatus'](0x194);}return _0x2e3cca;};}function handleError(_0x5a98d7,_0x41088b){_0x41088b=_0x41088b||0x1f4;return function(_0x46ad4a){logger[_0xf5f2('0x29')](_0x46ad4a['stack']);if(_0x46ad4a[_0xf5f2('0x38')]){delete _0x46ad4a['name'];}_0x5a98d7[_0xf5f2('0x2d')](_0x41088b)['send'](_0x46ad4a);};}function getMustacheRender(_0x46f464,_0x456764){return Mustache['render'](_0x46f464,_[_0xf5f2('0x39')](_0x456764[_0xf5f2('0x3a')],{'contact':_0x456764[_0xf5f2('0x3b')],'message':_0x456764[_0xf5f2('0x2a')],'agent':_0x456764['agent'],'interaction':_0x456764['interaction'],'account':_0x456764[_0xf5f2('0x3c')]}))||'';}function getInteractionUsers(_0x140a11,_0x22b20c){return new BPromise(function(_0x2d4400,_0x2c7f65){try{if(_0x22b20c[_0x140a11['id']]){_0x140a11[_0xf5f2('0x3d')]=_[_0xf5f2('0x3e')](_0x22b20c[_0x140a11['id']],function(_0x4c0ac7){return{'id':_0x4c0ac7['id'],'fullname':_0x4c0ac7[_0xf5f2('0x3f')]};});}}catch(_0x3b4ea6){_0x2c7f65(_0x3b4ea6);}_0x2d4400(_0x140a11);});}function getInteractionTags(_0x536501,_0xc6a1ae){return new BPromise(function(_0x3f3895,_0x71b0e7){try{if(_0x536501[_0xf5f2('0x40')]){_0x536501[_0xf5f2('0x41')]=[];_0x536501[_0xf5f2('0x40')][_0xf5f2('0x42')](',')[_0xf5f2('0x43')](function(_0x574f24){_0x536501[_0xf5f2('0x41')][_0xf5f2('0x44')](_0xc6a1ae[_0x574f24]);});}delete _0x536501[_0xf5f2('0x40')];}catch(_0x4a8e39){_0x71b0e7(_0x4a8e39);}_0x3f3895(_0x536501);});}function updateChatInteraction(_0x509dbc,_0x59eb00,_0x76d21b){return new BPromise(function(_0x2ad13c,_0x4c8d8e){return getInteractionUsers(_0x509dbc,_0x76d21b)[_0xf5f2('0x22')](function(_0xeed03d){return getInteractionTags(_0xeed03d,_0x59eb00);})[_0xf5f2('0x22')](function(_0x31f86c){_0x2ad13c(_0x31f86c);})[_0xf5f2('0x2c')](function(_0x2b3b1c){_0x4c8d8e(_0x2b3b1c);});});}exports[_0xf5f2('0x45')]=function(_0x212e90,_0x40c322){var _0x106062={},_0x444317={},_0x4773cd={'count':0x0,'rows':[]};var _0x4252a3=_[_0xf5f2('0x3e')](db['ChatInteraction'][_0xf5f2('0x46')],function(_0x578c93){return{'name':_0x578c93[_0xf5f2('0x47')],'type':_0x578c93[_0xf5f2('0x48')][_0xf5f2('0x49')]};});_0x444317[_0xf5f2('0x4a')]=_[_0xf5f2('0x3e')](_0x4252a3,_0xf5f2('0x38'));_0x444317['query']=_[_0xf5f2('0x4b')](_0x212e90[_0xf5f2('0x4c')]);_0x444317[_0xf5f2('0x4d')]=_[_0xf5f2('0x4e')](_0x444317[_0xf5f2('0x4a')],_0x444317[_0xf5f2('0x4c')]);_0x106062[_0xf5f2('0x4f')]=_[_0xf5f2('0x4e')](_0x444317['model'],qs[_0xf5f2('0x50')](_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x50')]));_0x106062['attributes']=_0x106062[_0xf5f2('0x4f')][_0xf5f2('0x51')]?_0x106062[_0xf5f2('0x4f')]:_0x444317['model'];if(!_0x212e90['query'][_0xf5f2('0x52')](_0xf5f2('0x53'))){_0x106062['limit']=qs[_0xf5f2('0x2f')](_0x212e90['query'][_0xf5f2('0x2f')]);_0x106062['offset']=qs[_0xf5f2('0x54')](_0x212e90['query'][_0xf5f2('0x54')]);}_0x106062[_0xf5f2('0x55')]=qs[_0xf5f2('0x56')](_0x212e90[_0xf5f2('0x4c')]['sort']);_0x106062[_0xf5f2('0x57')]=qs[_0xf5f2('0x4d')](_['pick'](_0x212e90['query'],_0x444317[_0xf5f2('0x4d')]),_0x4252a3);var _0x3dc0c4=[];var _0x57782c=squel[_0xf5f2('0x58')]()[_0xf5f2('0x59')]('id')[_0xf5f2('0x59')](_0xf5f2('0x38'))['field']('color')[_0xf5f2('0x5a')](_0xf5f2('0x5b'));var _0x4b62fc=squel[_0xf5f2('0x58')]()[_0xf5f2('0x59')](_0xf5f2('0x5c'))[_0xf5f2('0x59')](_0xf5f2('0x5d'))[_0xf5f2('0x59')](_0xf5f2('0x5e'))['from']('user_has_chat_interactions','ui')[_0xf5f2('0x5f')](_0xf5f2('0x60'),'u',_0xf5f2('0x61'));var _0x46a905=squel[_0xf5f2('0x58')]()['from'](_0xf5f2('0x62'),'i')[_0xf5f2('0x5f')](_0xf5f2('0x63'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf5f2('0x5f')]('users','o',_0xf5f2('0x64'))[_0xf5f2('0x5f')](_0xf5f2('0x65'),'a',_0xf5f2('0x66'))['left_join']('chat_messages','me',_0xf5f2('0x67'))['left_join'](_0xf5f2('0x68'),'it',_0xf5f2('0x69'))['left_join'](_0xf5f2('0x5b'),'t',_0xf5f2('0x6a'));var _0x2a8f6d=squel['expr']();var _0x397b99=[];var _0xcf7a50=squel[_0xf5f2('0x6b')]();var _0x4579f4;if(_0x212e90['query'][_0xf5f2('0x6c')]){_0x4579f4=as['parseSearch'](_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x6c')]);var _0x2e6f5d=_0x4579f4[_0xf5f2('0x6d')];for(var _0x9f210e=0x0;_0x9f210e<_0x4579f4['conditions'][_0xf5f2('0x51')];_0x9f210e++){var _0xacd80=_0x4579f4[_0xf5f2('0x6e')][_0x9f210e];var _0x212639='i';var _0x2c5733=_['find'](_0x4252a3,[_0xf5f2('0x38'),_0xacd80['field']]);if(!_0x2c5733){switch(_0xacd80['field']){case _0xf5f2('0x6f'):if(_0xacd80['value']==0x1){_0x46a905[_0xf5f2('0x70')]('`'+_0xacd80[_0xf5f2('0x59')]+_0xf5f2('0x71'));}else{_0x46a905[_0xf5f2('0x70')]('`'+_0xacd80['field']+_0xf5f2('0x72'));}break;case _0xf5f2('0x73'):if(_0xacd80[_0xf5f2('0x74')]===_0xf5f2('0x75')){if(_0xacd80[_0xf5f2('0x76')][_0xf5f2('0x42')]('\x20')[_0xf5f2('0x51')]>0x1){_0x2a8f6d[_0x2e6f5d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf5f2('0x77')](_0xacd80[_0xf5f2('0x76')]),null);}else{var _0xb39a6e='%'+_0xacd80[_0xf5f2('0x76')]+'%';_0x2a8f6d[_0x2e6f5d]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xb39a6e,_0xb39a6e,_0xb39a6e);}}else{_0x2c5733=_[_0xf5f2('0x78')](_0x4252a3,['name',_0xf5f2('0x79')]);_0xacd80[_0xf5f2('0x59')]='ContactId';_0x5a143f=as[_0xf5f2('0x7a')](_0x212639,_0x2c5733[_0xf5f2('0x48')],_0xacd80);_0x2a8f6d[_0x2e6f5d](_0x5a143f[_0xf5f2('0x7b')],_0x5a143f[_0xf5f2('0x76')][_0xf5f2('0x7c')],_0x5a143f['value'][_0xf5f2('0x2e')]);}break;case _0xf5f2('0x7d'):var _0x3a0e75=_0xacd80[_0xf5f2('0x76')][_0xf5f2('0x42')](',')[_0xf5f2('0x3e')](function(_0x53284f){return Number(_0x53284f);});_0x3a0e75[_0xf5f2('0x43')](function(_0x3f475e){_0xcf7a50['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3f475e+',%');});_0x397b99=_[_0xf5f2('0x7e')](_0x397b99,_0x3a0e75);break;case _0xf5f2('0x7f'):if(_0xacd80[_0xf5f2('0x74')]==='$substring'){_0x2a8f6d[_0x2e6f5d]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xacd80['value']+'%',null);}else{_0x2c5733=_[_0xf5f2('0x78')](_0x4252a3,[_0xf5f2('0x38'),_0xf5f2('0x80')]);_0xacd80[_0xf5f2('0x59')]=_0xf5f2('0x80');_0x5a143f=as['buildExpression'](_0x212639,_0x2c5733[_0xf5f2('0x48')],_0xacd80);_0x2a8f6d[_0x2e6f5d](_0x5a143f[_0xf5f2('0x7b')],_0x5a143f[_0xf5f2('0x76')][_0xf5f2('0x7c')],_0x5a143f[_0xf5f2('0x76')][_0xf5f2('0x2e')]);}break;case _0xf5f2('0x3a'):_0x5a143f=as[_0xf5f2('0x7a')]('me',null,_0xacd80);_0x2a8f6d[_0x2e6f5d](_0x5a143f[_0xf5f2('0x7b')],_0x5a143f[_0xf5f2('0x76')][_0xf5f2('0x7c')],_0x5a143f['value']['end']);break;}}else{var _0x5a143f=as[_0xf5f2('0x7a')](_0x212639,_0x2c5733[_0xf5f2('0x48')],_0xacd80);_0x2a8f6d[_0x2e6f5d](_0x5a143f[_0xf5f2('0x7b')],_0x5a143f[_0xf5f2('0x76')][_0xf5f2('0x7c')],_0x5a143f['value'][_0xf5f2('0x2e')]);}}}else{var _0x43c732=_(_0x212e90[_0xf5f2('0x4c')])[_0xf5f2('0x4b')]()[_0xf5f2('0x3e')](function(_0x55748d){return _[_0xf5f2('0x81')](_0x4252a3,[_0xf5f2('0x38'),_0x55748d])?_0x55748d:undefined;})['compact']()[_0xf5f2('0x76')]();if(!_[_0xf5f2('0x82')](_0x43c732)){_0x43c732[_0xf5f2('0x43')](function(_0x30ac41){if(_0x30ac41==='ChatWebsiteId'){_0x46a905[_0xf5f2('0x57')](_0xf5f2('0x83'),[][_0xf5f2('0x84')](_0x212e90[_0xf5f2('0x4c')][_0x30ac41]));}else if(_0x30ac41===_0xf5f2('0x85')){var _0x4f47e1=JSON['parse'](_0x212e90[_0xf5f2('0x4c')][_0x30ac41])[_0xf5f2('0x86')];var _0x17eb69=JSON[_0xf5f2('0x87')](_0x212e90['query'][_0x30ac41])['$lte'];_0x46a905[_0xf5f2('0x57')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f47e1,_0x17eb69);}else{if(_0x212e90['query'][_0x30ac41]==='null'){_0x46a905['where']('i.'+_0x30ac41+_0xf5f2('0x88'));}else{_0x46a905[_0xf5f2('0x57')]('i.'+_0x30ac41+_0xf5f2('0x89'),_0x212e90[_0xf5f2('0x4c')][_0x30ac41]);}}});}if(_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x8a')]){if(_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x8a')]==0x1){_0x46a905[_0xf5f2('0x70')](_0xf5f2('0x8b'));}else{_0x46a905[_0xf5f2('0x70')](_0xf5f2('0x8c'));}}if(_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x8d')]){_0x397b99=_[_0xf5f2('0x8e')](_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x8d')])?_0x212e90[_0xf5f2('0x4c')]['tag']:new Array(_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x8d')]);_0x397b99[_0xf5f2('0x43')](function(_0x2811ad){_0xcf7a50['or'](_0xf5f2('0x8f'),'%,'+_0x2811ad+',%');});}if(_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x90')]){var _0xcf48eb=_0x212e90['query'][_0xf5f2('0x90')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0xcf48eb)){_0x2a8f6d['or']('i.id\x20LIKE\x20?',_0xcf48eb+'%');}else{_0x2a8f6d['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xcf48eb))['or'](_0xf5f2('0x91'),_0xcf48eb+'%');}}}_0x46a905[_0xf5f2('0x57')](_0x2a8f6d);_0x46a905[_0xf5f2('0x92')](_0xf5f2('0x93'));var _0x145d4d={'type':db[_0xf5f2('0x94')]['QueryTypes']['SELECT'],'raw':!![]};var _0x2fb1a6=_0x46a905['clone']();_0x2fb1a6[_0xf5f2('0x59')](_0xf5f2('0x93'));_0x2fb1a6['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf5f2('0x6f'));if(_0x106062[_0xf5f2('0x55')]){_0x106062['order'][_0xf5f2('0x43')](function(_0x388b32){var _0x49e363=_0x388b32[0x0]===_0xf5f2('0x95')?_0x388b32[0x0]:'i.'+_0x388b32[0x0];_0x46a905[_0xf5f2('0x55')](_0x49e363,_0x388b32[0x1]===_0xf5f2('0x96')?![]:!![]);});}if(!_['isEmpty'](_0x397b99)){_0x46a905[_0xf5f2('0x70')](_0xcf7a50);_0x2fb1a6[_0xf5f2('0x57')](_0xf5f2('0x97'),_0x397b99);}BPromise[_0xf5f2('0x98')]()[_0xf5f2('0x22')](function(){if(!_0x4579f4){if(_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x99')])return;_0x2fb1a6[_0xf5f2('0x57')](_0xf5f2('0x9a'));_0x46a905[_0xf5f2('0x57')](_0xf5f2('0x9a'));return;}if(_0x212e90[_0xf5f2('0x9b')][_0xf5f2('0x9c')]!==_0xf5f2('0x9d'))return;return _0x212e90[_0xf5f2('0x9b')][_0xf5f2('0x9e')]({'attributes':['id'],'raw':!![]})[_0xf5f2('0x22')](function(_0x29a9d4){if(_[_0xf5f2('0x82')](_0x29a9d4)){_0x2fb1a6[_0xf5f2('0x57')](_0xf5f2('0x9f'));_0x46a905['where'](_0xf5f2('0x9f'));}else{_0x2fb1a6[_0xf5f2('0x57')]('i.ChatWebsiteId\x20IN\x20?',_[_0xf5f2('0x3e')](_0x29a9d4,'id'));_0x46a905[_0xf5f2('0x57')]('i.ChatWebsiteId\x20IN\x20?',_[_0xf5f2('0x3e')](_0x29a9d4,'id'));}});})[_0xf5f2('0x22')](function(){if(_0x212e90[_0xf5f2('0x9b')]['role']==='agent'&&!_0x4579f4&&!_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x99')])return[];return db[_0xf5f2('0xa0')]['query'](_0x2fb1a6['toString'](),_0x145d4d);})[_0xf5f2('0x22')](function(_0xcdc6fd){_0x4773cd[_0xf5f2('0x31')]=_0xcdc6fd['length'];if(_0x4773cd['count']===0x0)return[];return db['sequelize']['query'](_0x57782c['toString'](),_0x145d4d)[_0xf5f2('0x22')](function(_0x561bab){_0x3dc0c4=_[_0xf5f2('0xa1')](_0x561bab,'id');_0x145d4d=_[_0xf5f2('0x39')](_0x145d4d,{'model':db[_0xf5f2('0xa2')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x212e90[_0xf5f2('0x4c')][_0xf5f2('0x50')]){_0x106062[_0xf5f2('0x4f')][_0xf5f2('0x43')](function(_0x40e921){_0x46a905[_0xf5f2('0x59')]('i.'+_0x40e921);});}else{_0x46a905[_0xf5f2('0x59')](_0xf5f2('0xa3'),_0xf5f2('0x6f'));_0x46a905[_0xf5f2('0x59')]('a.key',_0xf5f2('0xa4'));_0x46a905[_0xf5f2('0x59')]('a.mandatoryDisposition',_0xf5f2('0xa5'));_0x46a905[_0xf5f2('0x59')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xf5f2('0x95'));_0x46a905[_0xf5f2('0x59')](_0xf5f2('0xa6'));_0x46a905['field'](_0xf5f2('0xa7'),_0xf5f2('0xa8'));_0x46a905['field'](_0xf5f2('0xa9'),_0xf5f2('0xaa'));_0x46a905[_0xf5f2('0x59')]('c.email',_0xf5f2('0xab'));_0x46a905['field'](_0xf5f2('0xac'),'Contact.phone');_0x46a905[_0xf5f2('0x59')](_0xf5f2('0xad'),_0xf5f2('0xae'));_0x46a905[_0xf5f2('0x59')]('c.fax',_0xf5f2('0xaf'));_0x46a905['field']('o.fullname','Owner.fullname');_0x46a905[_0xf5f2('0x59')](_0xf5f2('0xb0'),'Owner.internal');_0x46a905[_0xf5f2('0x59')](_0xf5f2('0xb1'),_0xf5f2('0x40'));}if(_0x106062[_0xf5f2('0x2f')])_0x46a905[_0xf5f2('0x2f')](_0x106062[_0xf5f2('0x2f')]);if(_0x106062['offset'])_0x46a905[_0xf5f2('0x54')](_0x106062[_0xf5f2('0x54')]);return db['sequelize'][_0xf5f2('0x4c')](_0x46a905[_0xf5f2('0xb2')](),_0x145d4d);})['then'](function(_0x32301a){if(_0x32301a[_0xf5f2('0x51')]>0x0)_0x4b62fc[_0xf5f2('0x57')](_0xf5f2('0xb3'),_[_0xf5f2('0x3e')](_0x32301a,'id'));return db[_0xf5f2('0xa0')]['query'](_0x4b62fc[_0xf5f2('0xb2')](),_0x145d4d)[_0xf5f2('0x22')](function(_0x13fcb0){var _0x792c75=_[_0xf5f2('0xb4')](_0x13fcb0,_0xf5f2('0xb5'));var _0x162c13=[];_0x32301a[_0xf5f2('0x43')](function(_0x3e4e40){_0x162c13['push'](updateChatInteraction(_0x3e4e40,_0x3dc0c4,_0x792c75));});return BPromise[_0xf5f2('0xb6')](_0x162c13);});});})[_0xf5f2('0x22')](function(_0xdbb2cd){_0x4773cd[_0xf5f2('0xb7')]=_0xdbb2cd;return _0x4773cd;})[_0xf5f2('0x22')](respondWithFilteredResult(_0x40c322,_0x106062))[_0xf5f2('0x2c')](handleError(_0x40c322,null));};exports[_0xf5f2('0xb8')]=function(_0x56f4b4,_0x33cfe7){var _0x40d0eb={'raw':![],'where':{'id':_0x56f4b4['params']['id']}},_0x4c138c={};_0x4c138c[_0xf5f2('0x4a')]=_[_0xf5f2('0x4b')](db[_0xf5f2('0xa2')][_0xf5f2('0x46')]);_0x4c138c['query']=_[_0xf5f2('0x4b')](_0x56f4b4[_0xf5f2('0x4c')]);_0x4c138c[_0xf5f2('0x4d')]=_[_0xf5f2('0x4e')](_0x4c138c[_0xf5f2('0x4a')],_0x4c138c['query']);_0x40d0eb[_0xf5f2('0x4f')]=_[_0xf5f2('0x4e')](_0x4c138c['model'],qs[_0xf5f2('0x50')](_0x56f4b4[_0xf5f2('0x4c')][_0xf5f2('0x50')]));_0x40d0eb[_0xf5f2('0x4f')]=_0x40d0eb['attributes'][_0xf5f2('0x51')]?_0x40d0eb[_0xf5f2('0x4f')]:_0x4c138c[_0xf5f2('0x4a')];if(_0x56f4b4['query']['includeAll']){_0x40d0eb[_0xf5f2('0xb9')]=[{'all':!![]}];}_0x40d0eb=_[_0xf5f2('0x39')]({},_0x40d0eb,_0x56f4b4[_0xf5f2('0xba')]);return db[_0xf5f2('0xa2')][_0xf5f2('0x78')](_0x40d0eb)[_0xf5f2('0x22')](handleEntityNotFound(_0x33cfe7,null))['then'](respondWithResult(_0x33cfe7,null))[_0xf5f2('0x2c')](handleError(_0x33cfe7,null));};exports['create']=function(_0x151f13,_0x1624a4){return db[_0xf5f2('0xa2')][_0xf5f2('0xbb')](_0x151f13[_0xf5f2('0x3a')],{})[_0xf5f2('0x22')](respondWithResult(_0x1624a4,0xc9))['catch'](handleError(_0x1624a4,null));};exports[_0xf5f2('0x37')]=function(_0x409ed1,_0x457b53){if(_0x409ed1[_0xf5f2('0x3a')]['id']){delete _0x409ed1[_0xf5f2('0x3a')]['id'];}return db[_0xf5f2('0xa2')][_0xf5f2('0x78')]({'where':{'id':_0x409ed1['params']['id']}})[_0xf5f2('0x22')](handleEntityNotFound(_0x457b53,null))['then'](saveUpdates(_0x409ed1['body'],null))['then'](respondWithResult(_0x457b53,null))[_0xf5f2('0x2c')](handleError(_0x457b53,null));};exports[_0xf5f2('0xbc')]=function(_0x568806,_0x3487df){return db[_0xf5f2('0xa2')][_0xf5f2('0x78')]({'where':{'id':_0x568806[_0xf5f2('0xbd')]['id']}})['then'](handleEntityNotFound(_0x3487df,null))[_0xf5f2('0x22')](removeEntity(_0x3487df,null))[_0xf5f2('0x2c')](handleError(_0x3487df,null));};exports[_0xf5f2('0xbe')]=function(_0x5d3ca7,_0x29f7bd){return db[_0xf5f2('0xa2')]['describe']()[_0xf5f2('0x22')](respondWithResult(_0x29f7bd,null))[_0xf5f2('0x2c')](handleError(_0x29f7bd,null));};exports[_0xf5f2('0xbf')]=function(_0x1583bb,_0x176974){var _0x8b591c=_0x1583bb[_0xf5f2('0xbd')]['id'];var _0x2c242b;var _0x155007;var _0x4782da;return db[_0xf5f2('0xa2')]['findOne']({'where':{'id':_0x8b591c}})[_0xf5f2('0x22')](function(_0x31dbfa){_0x2c242b=_0x31dbfa;return db['ChatWebsite'][_0xf5f2('0xc0')]({'where':{'id':_0x31dbfa['ChatWebsiteId']},'attributes':['id',_0xf5f2('0xc1'),_0xf5f2('0xc2'),_0xf5f2('0xc3'),_0xf5f2('0xc4'),'vidaooMetadata'],'raw':!![]});})[_0xf5f2('0x22')](function(_0x5a104b){if(_0x5a104b&&_0x5a104b[_0xf5f2('0xc1')]&&_0x5a104b['vidaooEscalation']){_0x155007=_0x5a104b;var _0x3310cb={'interaction':{'id':_0x8b591c},'agent':{'id':_0x1583bb[_0xf5f2('0x9b')]['id'],'name':_0x1583bb['user'][_0xf5f2('0x38')],'fullname':_0x1583bb[_0xf5f2('0x9b')][_0xf5f2('0x3f')],'email':_0x1583bb[_0xf5f2('0x9b')][_0xf5f2('0xc5')]},'contact':_0x1583bb[_0xf5f2('0x3a')]['contact'],'account':_0x1583bb['body'][_0xf5f2('0x3c')]};var _0x17e1eb={'rejectUnauthorized':![],'method':'POST','url':_0xf5f2('0xc6'),'headers':{'X-APIKEY':_0x5a104b[_0xf5f2('0xc1')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1583bb[_0xf5f2('0x9b')][_0xf5f2('0xc5')]],'buttons':null,'topic':_0x155007[_0xf5f2('0xc3')],'note':_[_0xf5f2('0xc7')](_0x155007[_0xf5f2('0xc4')])?null:getMustacheRender(_0x155007['vidaooNote'],_0x3310cb),'metadata':null},'redirect':_0xf5f2('0xc8'),'json':!![]};try{if(!_['isNull'](_0x155007[_0xf5f2('0xc9')])){var _0x5ec0f3=getMustacheRender(_0x155007[_0xf5f2('0xc9')],_0x3310cb);var _0x4f2531=JSON[_0xf5f2('0x87')](_0x5ec0f3);_0x17e1eb['body']['metadata']=_0x4f2531;}}catch(_0x2c285c){throw new db[(_0xf5f2('0x94'))]['ValidationError'](_0xf5f2('0xca'));}return rp(_0x17e1eb);}else{throw new db[(_0xf5f2('0x94'))][(_0xf5f2('0xcb'))](_0xf5f2('0xcc'));}})[_0xf5f2('0x22')](function(_0x25af1e){_0x4782da=_0x25af1e;if(_0x4782da['id']){var _0xd0b5d={'body':_0x4782da[_0xf5f2('0xcd')],'ChatWebsiteId':_0x155007['id'],'ChatInteractionId':_0x2c242b['id'],'direction':'out','UserId':_0x1583bb['user']['id']};return db[_0xf5f2('0xce')]['create'](_0xd0b5d,{});}else{throw new db[(_0xf5f2('0x94'))][(_0xf5f2('0xcb'))](_0xf5f2('0xcf'));}})[_0xf5f2('0x22')](function(){return _0x2c242b[_0xf5f2('0xd0')]({'vidaooSessionId':_0x4782da['id']});})[_0xf5f2('0x22')](respondWithResult(_0x176974,null))[_0xf5f2('0x2c')](handleError(_0x176974,null));};exports[_0xf5f2('0xd1')]=function(_0x28f65b,_0x16cbd3){if(_0x28f65b[_0xf5f2('0x3a')]['id']){delete _0x28f65b[_0xf5f2('0x3a')]['id'];}return db['ChatInteraction'][_0xf5f2('0x78')]({'where':{'id':_0x28f65b['params']['id']},'include':[{'model':db[_0xf5f2('0xd2')],'as':_0xf5f2('0x73')}]})[_0xf5f2('0x22')](handleEntityNotFound(_0x16cbd3,null))[_0xf5f2('0x22')](saveUpdates(_0x28f65b[_0xf5f2('0x3a')],null))[_0xf5f2('0x22')](respondWithResult(_0x16cbd3,null))[_0xf5f2('0x2c')](handleError(_0x16cbd3,null));};exports[_0xf5f2('0xd3')]=function(_0x29db4f,_0x377c68,_0xe0f288){if(_0x29db4f['body']['id']){delete _0x29db4f[_0xf5f2('0x3a')]['id'];}return db[_0xf5f2('0xa2')][_0xf5f2('0x78')]({'where':{'id':_0x29db4f[_0xf5f2('0xbd')]['id']}})[_0xf5f2('0x22')](function(_0x3f8794){if(!_0x3f8794){logger[_0xf5f2('0x29')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xf5f2('0xd3'),0x194,_0xf5f2('0xd4'));_0x377c68[_0xf5f2('0xd5')](0x194);}else{if(_0x3f8794[_0xf5f2('0x80')]){throw new db[(_0xf5f2('0x94'))][(_0xf5f2('0xcb'))](_0xf5f2('0xd6'));}}return _0x3f8794;})[_0xf5f2('0x22')](function(_0x356155){if(_0x356155){return _0x356155[_0xf5f2('0x37')]({'closed':_0x29db4f[_0xf5f2('0x3a')][_0xf5f2('0xd7')],'disposition':_0x29db4f[_0xf5f2('0x3a')][_0xf5f2('0xd8')]})[_0xf5f2('0x22')](function(_0x654b1b){return _0x654b1b;});}})['then'](function(_0x25566a){return respondWithRpcPromise(_0xf5f2('0xd9'),'abandon',_0x29db4f['body'],client9004);})[_0xf5f2('0x22')](respondWithResult(_0x377c68,null))[_0xf5f2('0x2c')](handleError(_0x377c68,null));};exports[_0xf5f2('0xda')]=function(_0x2c8f4c,_0x529d6f,_0x28cc){_0x2c8f4c[_0xf5f2('0x3a')][_0xf5f2('0x38')]=_0x2c8f4c[_0xf5f2('0xdb')][_0xf5f2('0xdc')];_0x2c8f4c[_0xf5f2('0x3a')]['basename']=_0x2c8f4c[_0xf5f2('0xdb')]['filename'];_0x2c8f4c['body'][_0xf5f2('0x48')]=_0x2c8f4c[_0xf5f2('0xdb')][_0xf5f2('0xdd')];return db[_0xf5f2('0xde')][_0xf5f2('0xbb')](_0x2c8f4c[_0xf5f2('0x3a')])[_0xf5f2('0x22')](respondWithResult(_0x529d6f,0xc9))['catch'](handleError(_0x529d6f,null));};exports[_0xf5f2('0xdf')]=function(_0x3a2862,_0x2c1160,_0x5e6c83){return db[_0xf5f2('0xa2')]['findOne']({'where':{'id':_0x3a2862['params']['id']},'raw':!![]})[_0xf5f2('0x22')](handleEntityNotFound(_0x2c1160,null))['then'](function(_0x2389b7){if(_0x2389b7){if(_0x2389b7[_0xf5f2('0xd7')]){return _0x2c1160['status'](0x193)[_0xf5f2('0x34')]({'status':0x193,'message':_0xf5f2('0xe0')});}return db['Attachment'][_0xf5f2('0xc0')]({'where':{'id':_0x3a2862[_0xf5f2('0x4c')][_0xf5f2('0xe1')]},'raw':!![]})[_0xf5f2('0x22')](handleEntityNotFound(_0x2c1160,null));}})[_0xf5f2('0x22')](function(_0x47a28a){if(_0x47a28a){var _0x182fa7=_0x47a28a[_0xf5f2('0xe2')]!==null;var _0x4d9048=path['join'](config[_0xf5f2('0xe3')],_0xf5f2('0xe4'));if(_0x182fa7){_0x4d9048=path[_0xf5f2('0xe5')](_0x4d9048,_0xf5f2('0xe6'));}var _0x1f51d8=path[_0xf5f2('0xe5')](_0x4d9048,_0x47a28a[_0xf5f2('0xe7')]);return _0x2c1160[_0xf5f2('0xe8')](_0x1f51d8);}})['catch'](handleError(_0x2c1160,null));};exports['close']=function(_0xc86ed5,_0x5be398){var _0x34abb6=null;var _0x235c30=null;var _0x15b060=null;var _0x422e88=null;if(_0xc86ed5['body']['id']){delete _0xc86ed5[_0xf5f2('0x3a')]['id'];}if(_0xc86ed5[_0xf5f2('0x3a')][_0xf5f2('0xe9')]){_0x422e88=path[_0xf5f2('0xe5')](config[_0xf5f2('0xe3')],'server/files/chat/upload/',util[_0xf5f2('0xea')](_0xf5f2('0xeb'),Date[_0xf5f2('0xec')]()));_0xc86ed5[_0xf5f2('0x3a')][_0xf5f2('0xed')]=_0x422e88;}return db[_0xf5f2('0xa2')][_0xf5f2('0x78')]({'where':{'id':_0xc86ed5[_0xf5f2('0xbd')]['id']},'include':[{'model':db[_0xf5f2('0xce')],'as':_0xf5f2('0xee'),'include':[{'model':db[_0xf5f2('0x7f')],'as':_0xf5f2('0x7f')}]}]})['then'](handleEntityNotFound(_0x5be398,null))[_0xf5f2('0x22')](saveUpdates(_0xc86ed5['body'],null))[_0xf5f2('0x22')](function(_0x349efe){if(_0x349efe){_0x34abb6=_0x349efe;return db[_0xf5f2('0xef')][_0xf5f2('0x78')]({'where':{'id':_0x34abb6[_0xf5f2('0x99')]}});}})[_0xf5f2('0x22')](function(_0x2cd0b7){if(_0x2cd0b7){_0x15b060=_0x2cd0b7;return db[_0xf5f2('0xd2')][_0xf5f2('0x78')]({'where':{'id':_0x34abb6[_0xf5f2('0x79')]}});}})[_0xf5f2('0x22')](function(_0x2b6f46){if(_0x2b6f46){_0x235c30=_0x2b6f46;if(_0x422e88){var _0xf53f16=null;for(var _0xd45a63=0x1;_0xd45a63<_0x34abb6[_0xf5f2('0xee')][_0xf5f2('0x51')];++_0xd45a63){_0xf53f16=_0x34abb6[_0xf5f2('0xee')][_0xd45a63];var _0x33f987=_0xf53f16['UserId']?util[_0xf5f2('0xea')]('%s%d',_0x15b060['agentAlias'],_0xf53f16[_0xf5f2('0x80')]):_0xf5f2('0xf0');var _0x53e85c=_0xc86ed5[_0xf5f2('0x3a')][_0xf5f2('0xf1')]||util[_0xf5f2('0xea')](_0xf5f2('0xf2'),_0xf5f2('0xf3'),_0xf53f16[_0xf5f2('0x79')]);switch(_0x15b060[_0xf5f2('0xf4')]){case _0xf5f2('0xf5'):_0x33f987=_0xf53f16['UserId']?util[_0xf5f2('0xea')](_0xf5f2('0xf2'),_0x15b060[_0xf5f2('0xf6')],_0xf53f16['UserId']):_0xf5f2('0xf0');break;case _0xf5f2('0xf7'):_0x33f987=_0xf53f16[_0xf5f2('0x80')]?_0xf53f16[_0xf5f2('0x7f')]['alias']||_0xf53f16['User'][_0xf5f2('0x3f')]:_0xf5f2('0xf0');break;case _0xf5f2('0xf8'):_0x33f987=_0xf53f16[_0xf5f2('0x80')]?_0xf53f16[_0xf5f2('0x7f')][_0xf5f2('0x3f')]:_0xf5f2('0xf0');break;default:_0x33f987=_0xf53f16[_0xf5f2('0x80')]?util[_0xf5f2('0xea')](_0xf5f2('0xf2'),_0x15b060['agentAlias'],_0xf53f16[_0xf5f2('0x80')]):_0xf5f2('0xf0');}var _0x3881cd=util['format'](_0xf5f2('0xf9'),moment(_0xf53f16[_0xf5f2('0x85')])['format'](_0xf5f2('0xfa')),_0xf53f16['direction']==='in'?_0x53e85c:_0x33f987,_0xf53f16[_0xf5f2('0x3a')]);if(!_0xf53f16[_0xf5f2('0xfb')]){fs['appendFileSync'](_0x422e88,_0x3881cd);}}return db[_0xf5f2('0xfc')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xf5f2('0xfd')],'as':_0xf5f2('0xfe'),'raw':!![]}]});}}})['then'](function(_0x3971ee){if(_0x3971ee&&_0x3971ee[_0xf5f2('0xfe')]&&_0xc86ed5[_0xf5f2('0x3a')]){var _0xfeccdd={'tls':{'rejectUnauthorized':![]}};if(_0x3971ee[_0xf5f2('0xfe')]['service']){_0xfeccdd[_0xf5f2('0xff')]=_0x3971ee[_0xf5f2('0xfe')][_0xf5f2('0xff')];}else{_0xfeccdd[_0xf5f2('0x100')]=_0x3971ee[_0xf5f2('0xfe')][_0xf5f2('0x100')];_0xfeccdd[_0xf5f2('0x101')]=_0x3971ee[_0xf5f2('0xfe')][_0xf5f2('0x101')];_0xfeccdd['secure']=_0x3971ee[_0xf5f2('0xfe')]['secure'];}if(_0x3971ee['Smtp'][_0xf5f2('0x102')]){_0xfeccdd[_0xf5f2('0x103')]={'user':_0x3971ee[_0xf5f2('0xfe')][_0xf5f2('0x9b')],'pass':_0x3971ee[_0xf5f2('0xfe')][_0xf5f2('0x104')]};}return respondWithRpcPromise(_0xf5f2('0x105'),_0xf5f2('0x106'),{'account':_0xfeccdd,'message':{'from':util[_0xf5f2('0xea')](_0xf5f2('0x107'),_0x3971ee['name'],_0x3971ee['email']||_0x3971ee['Smtp'][_0xf5f2('0x9b')]),'to':_0xc86ed5['body'][_0xf5f2('0xe9')],'subject':_0xf5f2('0x108'),'text':util[_0xf5f2('0xea')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0xc86ed5[_0xf5f2('0x3a')][_0xf5f2('0xe9')]),'attachments':[{'path':_0x422e88}]}})['then'](function(){return _0x34abb6;})['catch'](function(_0x4d0709){console[_0xf5f2('0x29')](_0x4d0709);});}else{return _0x34abb6;}})[_0xf5f2('0x22')](respondWithStatusCode(_0x5be398,0xc8))[_0xf5f2('0x2c')](handleError(_0x5be398,null));};exports['addMessage']=function(_0x2cfa84,_0x4a22fb,_0x7cf1b6){return db[_0xf5f2('0xce')][_0xf5f2('0x78')]({'where':{'id':_0x2cfa84['params']['id']}})[_0xf5f2('0x22')](handleEntityNotFound(_0x4a22fb,null))['then'](function(_0x1b88b5){if(_0x1b88b5){return _0x1b88b5[_0xf5f2('0x109')](_0x2cfa84[_0xf5f2('0x3a')]['ids'],_[_0xf5f2('0x10a')](_0x2cfa84[_0xf5f2('0x3a')],['ids','id'])||{});}})[_0xf5f2('0x22')](respondWithResult(_0x4a22fb,null))[_0xf5f2('0x2c')](handleError(_0x4a22fb,null));};exports[_0xf5f2('0x10b')]=function(_0x29526c,_0x2a52e3,_0x439c9f){var _0x44adaa={'raw':![],'where':{}};var _0x3c7058={};var _0x3bcb44={'count':0x0,'rows':[]};return db[_0xf5f2('0xa2')][_0xf5f2('0xc0')]({'where':{'id':_0x29526c[_0xf5f2('0xbd')]['id']}})[_0xf5f2('0x22')](handleEntityNotFound(_0x2a52e3,null))[_0xf5f2('0x22')](function(_0x23675a){if(_0x23675a){_0x3c7058[_0xf5f2('0x4a')]=_[_0xf5f2('0x4b')](db[_0xf5f2('0xce')][_0xf5f2('0x46')]);_0x3c7058[_0xf5f2('0x4c')]=_[_0xf5f2('0x4b')](_0x29526c[_0xf5f2('0x4c')]);_0x3c7058['filters']=_[_0xf5f2('0x4e')](_0x3c7058[_0xf5f2('0x4a')],_0x3c7058[_0xf5f2('0x4c')]);_0x44adaa[_0xf5f2('0x4f')]=_['intersection'](_0x3c7058[_0xf5f2('0x4a')],qs['fields'](_0x29526c[_0xf5f2('0x4c')][_0xf5f2('0x50')]));_0x44adaa[_0xf5f2('0x4f')]=_0x44adaa[_0xf5f2('0x4f')][_0xf5f2('0x51')]?_0x44adaa[_0xf5f2('0x4f')]:_0x3c7058[_0xf5f2('0x4a')];if(!_0x29526c['query']['hasOwnProperty'](_0xf5f2('0x53'))){_0x44adaa[_0xf5f2('0x2f')]=qs[_0xf5f2('0x2f')](_0x29526c[_0xf5f2('0x4c')]['limit']);_0x44adaa[_0xf5f2('0x54')]=qs[_0xf5f2('0x54')](_0x29526c[_0xf5f2('0x4c')][_0xf5f2('0x54')]);}_0x44adaa[_0xf5f2('0x55')]=qs[_0xf5f2('0x56')](_0x29526c['query']['sort']);_0x44adaa['where']=qs[_0xf5f2('0x4d')](_[_0xf5f2('0x10c')](_0x29526c[_0xf5f2('0x4c')],_0x3c7058['filters']));_0x44adaa[_0xf5f2('0x57')]['ChatInteractionId']=_0x23675a['id'];if(_0x29526c[_0xf5f2('0x4c')][_0xf5f2('0x90')]){_0x44adaa[_0xf5f2('0x57')]=_[_0xf5f2('0x39')](_0x44adaa[_0xf5f2('0x57')],{'$or':_[_0xf5f2('0x3e')](_0x44adaa[_0xf5f2('0x4f')],function(_0xece862){var _0x3b4121={};_0x3b4121[_0xece862]={'$like':'%'+_0x29526c[_0xf5f2('0x4c')][_0xf5f2('0x90')]+'%'};return _0x3b4121;})});}if(_0x29526c[_0xf5f2('0x4c')][_0xf5f2('0x86')]){var _0x2fa70d=_0x29526c['query'][_0xf5f2('0x86')][_0xf5f2('0x42')](',');var _0x31f018={};_0x31f018[_0x2fa70d[0x0]]={'$gte':moment(_0x2fa70d[0x1])[_0xf5f2('0xea')]('YYYY-MM-DD\x20HH:mm:ss')};_0x44adaa[_0xf5f2('0x57')]=_[_0xf5f2('0x39')](_0x44adaa[_0xf5f2('0x57')],_0x31f018);}_0x44adaa=_[_0xf5f2('0x39')]({},_0x44adaa,_0x29526c['options']);return db[_0xf5f2('0xce')]['count']({'where':_0x44adaa[_0xf5f2('0x57')]})[_0xf5f2('0x22')](function(_0x20bb46){_0x3bcb44[_0xf5f2('0x31')]=_0x20bb46;if(_0x29526c['query'][_0xf5f2('0x10d')]){_0x44adaa[_0xf5f2('0xb9')]=[{'all':!![]}];}return db[_0xf5f2('0xce')][_0xf5f2('0x10e')](_0x44adaa);})[_0xf5f2('0x22')](function(_0x889f0e){_0x3bcb44['rows']=_0x889f0e;return _0x3bcb44;});}})[_0xf5f2('0x22')](respondWithFilteredResult(_0x2a52e3,_0x44adaa))[_0xf5f2('0x2c')](handleError(_0x2a52e3,null));};exports[_0xf5f2('0x10f')]=function(_0x3dcf4e,_0x4212d4,_0x2ebe4f){var _0x34fc35={'where':{}},_0x29c1ca={},_0x2cf93e={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf5f2('0xc0')]({'where':{'id':_0x3dcf4e[_0xf5f2('0xbd')]['id']}})[_0xf5f2('0x22')](handleEntityNotFound(_0x4212d4,null))[_0xf5f2('0x22')](function(_0x544db3){if(_0x544db3){_0x29c1ca['model']=_[_0xf5f2('0x4b')](db[_0xf5f2('0xce')][_0xf5f2('0x46')]);_0x29c1ca['query']=_['keys'](_0x3dcf4e[_0xf5f2('0x4c')]);_0x29c1ca[_0xf5f2('0x4d')]=_[_0xf5f2('0x4e')](_0x29c1ca[_0xf5f2('0x4a')],_0x29c1ca[_0xf5f2('0x4c')]);_0x34fc35[_0xf5f2('0x4f')]=_['intersection'](_0x29c1ca[_0xf5f2('0x4a')],qs[_0xf5f2('0x50')](_0x3dcf4e[_0xf5f2('0x4c')][_0xf5f2('0x50')]));_0x34fc35['attributes']=_0x34fc35['attributes'][_0xf5f2('0x51')]?_0x34fc35['attributes']:_0x29c1ca[_0xf5f2('0x4a')];if(!_0x3dcf4e[_0xf5f2('0x4c')][_0xf5f2('0x52')](_0xf5f2('0x53'))){_0x34fc35[_0xf5f2('0x2f')]=qs[_0xf5f2('0x2f')](_0x3dcf4e[_0xf5f2('0x4c')][_0xf5f2('0x2f')]);_0x34fc35[_0xf5f2('0x54')]=qs[_0xf5f2('0x54')](_0x3dcf4e[_0xf5f2('0x4c')][_0xf5f2('0x54')]);}_0x34fc35[_0xf5f2('0x55')]=qs[_0xf5f2('0x56')](_0x3dcf4e['query'][_0xf5f2('0x56')]);_0x34fc35[_0xf5f2('0x57')]=qs[_0xf5f2('0x4d')](_[_0xf5f2('0x10c')](_0x3dcf4e[_0xf5f2('0x4c')],_0x29c1ca['filters']));_0x34fc35[_0xf5f2('0x57')][_0xf5f2('0xb5')]=_0x544db3['id'];if(_0x3dcf4e['query'][_0xf5f2('0x90')]){_0x34fc35[_0xf5f2('0x57')]=_['merge'](_0x34fc35['where'],{'$or':_[_0xf5f2('0x3e')](_0x34fc35[_0xf5f2('0x4f')],function(_0x3e7f54){var _0x5e165c={};_0x5e165c[_0x3e7f54]={'$like':'%'+_0x3dcf4e['query'][_0xf5f2('0x90')]+'%'};return _0x5e165c;})});}_0x34fc35[_0xf5f2('0x57')][_0xf5f2('0xfb')]=![];if(_0x3dcf4e[_0xf5f2('0x4c')]['id']){_0x34fc35[_0xf5f2('0x57')]['id']={'$gt':_0x3dcf4e[_0xf5f2('0x4c')]['id']};}_0x34fc35=_[_0xf5f2('0x39')]({},_0x34fc35,_0x3dcf4e[_0xf5f2('0xba')]);return db[_0xf5f2('0xce')][_0xf5f2('0x31')]({'where':_0x34fc35['where']})[_0xf5f2('0x22')](function(_0x1c2842){_0x2cf93e['count']=_0x1c2842;_0x34fc35[_0xf5f2('0xb9')]=[];if(_0x3dcf4e[_0xf5f2('0x4c')][_0xf5f2('0x110')]){_0x34fc35[_0xf5f2('0xb9')][_0xf5f2('0x44')]({'model':db['User'],'as':'User','attributes':['id',_0xf5f2('0x3f'),_0xf5f2('0x111')]});}if(_0x3dcf4e[_0xf5f2('0x4c')][_0xf5f2('0x10d')]){_0x34fc35['include']=[{'all':!![]}];}return db[_0xf5f2('0xce')][_0xf5f2('0x10e')](_0x34fc35);})[_0xf5f2('0x22')](function(_0x3518f9){_0x2cf93e['rows']=_0x3518f9;return _0x2cf93e;});}})['then'](respondWithFilteredResult(_0x4212d4,_0x34fc35))['catch'](handleError(_0x4212d4,null));};exports['addTags']=function(_0x2e9d3b,_0x496802,_0x5be074){return db['ChatInteraction']['find']({'where':{'id':_0x2e9d3b[_0xf5f2('0xbd')]['id']}})['then'](handleEntityNotFound(_0x496802,null))['then'](function(_0x43150f){if(_0x43150f){return _0x43150f[_0xf5f2('0x112')](_0x2e9d3b[_0xf5f2('0x3a')][_0xf5f2('0x113')],_['omit'](_0x2e9d3b[_0xf5f2('0x3a')],[_0xf5f2('0x113'),'id'])||{})[_0xf5f2('0x114')](function(){return db[_0xf5f2('0x7d')][_0xf5f2('0x10e')]({'attributes':['id',_0xf5f2('0x38'),_0xf5f2('0x115')],'where':{'id':_0x2e9d3b['body'][_0xf5f2('0x113')]}});})[_0xf5f2('0x22')](function(_0x4f4af9){socket[_0xf5f2('0x116')](_0xf5f2('0x117'),{'id':Number(_0x2e9d3b[_0xf5f2('0xbd')]['id']),'tags':_0x4f4af9||[]});return{'id':Number(_0x2e9d3b[_0xf5f2('0xbd')]['id']),'tags':_0x4f4af9||[]};});}})[_0xf5f2('0x22')](respondWithResult(_0x496802,null))['catch'](handleError(_0x496802,null));};exports[_0xf5f2('0x118')]=function(_0x5f470f,_0x1f0a64,_0x2bbc23){return db[_0xf5f2('0xa2')][_0xf5f2('0x78')]({'where':{'id':_0x5f470f['params']['id']}})['then'](handleEntityNotFound(_0x1f0a64,null))[_0xf5f2('0x22')](function(_0x179901){if(_0x179901){return _0x179901[_0xf5f2('0x118')](_0x5f470f[_0xf5f2('0x4c')][_0xf5f2('0x113')]);}})[_0xf5f2('0x22')](respondWithStatusCode(_0x1f0a64,null))[_0xf5f2('0x2c')](handleError(_0x1f0a64,null));};exports[_0xf5f2('0xe8')]=function(_0x5d8c6a,_0x4f777b){var _0x26dc8c=moment()[_0xf5f2('0x119')]()['toString']();var _0xb8bcf3=path[_0xf5f2('0xe5')](config[_0xf5f2('0xe3')],_0xf5f2('0x11a'),_0xf5f2('0x11b'),_0xf5f2('0x11c'));var _0x2bc493=path[_0xf5f2('0xe5')](config[_0xf5f2('0xe3')],_0xf5f2('0x11a'),_0xf5f2('0x11b'),_0xf5f2('0x11d'));var _0x212d97=path[_0xf5f2('0xe5')](_0xb8bcf3,_0x26dc8c);var _0x8ee5fd=util[_0xf5f2('0xea')](_0xf5f2('0x11e'),_0x5d8c6a['params']['id'],_0x26dc8c);var _0x3712e3=path['join'](_0xb8bcf3,_0x8ee5fd);var _0x56a1c3=[];_0x56a1c3['push']({'model':db['User'],'as':_0xf5f2('0x7f'),'attributes':['id',_0xf5f2('0x3f')],'raw':!![]});_0x56a1c3[_0xf5f2('0x44')]({'model':db[_0xf5f2('0xd2')],'as':'Contact','attributes':['id',_0xf5f2('0x11f'),_0xf5f2('0x120')],'raw':!![]});if(_0x5d8c6a['query']['attachments']){_0x56a1c3['push']({'model':db[_0xf5f2('0xde')],'as':_0xf5f2('0xde'),'raw':!![]});}var _0x5a6da7=[{'model':db[_0xf5f2('0xce')],'as':_0xf5f2('0xee'),'attributes':['id',_0xf5f2('0x3a'),'createdAt',_0xf5f2('0x121'),_0xf5f2('0xfb'),_0xf5f2('0x8a')],'include':_0x56a1c3}];_0x5a6da7[_0xf5f2('0x44')]({'model':db[_0xf5f2('0xef')],'as':_0xf5f2('0x122'),'attributes':['id','name']});_0x5a6da7['push']({'model':db[_0xf5f2('0x7f')],'as':_0xf5f2('0x123'),'attributes':['id','fullname']});return db['ChatInteraction'][_0xf5f2('0x78')]({'where':{'id':_0x5d8c6a['params']['id']},'include':_0x5a6da7})[_0xf5f2('0x22')](handleEntityNotFound(_0x4f777b,null))[_0xf5f2('0x22')](function(_0x2ee55f){if(_0x2ee55f){var _0x43ca34=_0x2ee55f[_0xf5f2('0x124')]({'plain':!![]});fs[_0xf5f2('0x125')](_0x212d97);var _0x220300={'channel':_0xf5f2('0x126'),'account':_0x43ca34[_0xf5f2('0x122')][_0xf5f2('0x38')],'agent':_0x43ca34['Owner']?_0x43ca34[_0xf5f2('0x123')][_0xf5f2('0x3f')]:_0xf5f2('0x127'),'createdAt':moment(_0x43ca34[_0xf5f2('0x85')])['format'](_0xf5f2('0x128'))[_0xf5f2('0xb2')](),'closedAt':_0x43ca34['closed']?moment(_0x43ca34[_0xf5f2('0x129')])['format'](_0xf5f2('0x128'))[_0xf5f2('0xb2')]():'','disposition':_0x43ca34['disposition'],'chatInfo':{'browser':_0x43ca34[_0xf5f2('0x12a')],'os':_0x43ca34[_0xf5f2('0x12b')],'referer':_0x43ca34[_0xf5f2('0x12c')],'customerIp':_0x43ca34[_0xf5f2('0x12d')],'customerPort':_0x43ca34['customerPort']?_0x43ca34[_0xf5f2('0x12e')]:_0xf5f2('0x127')},'messages':_(_0x43ca34[_0xf5f2('0xee')])['tail']()[_0xf5f2('0x90')]({'secret':![]})[_0xf5f2('0x3e')](function(_0x5981bb){if(_0x5981bb[_0xf5f2('0xde')]){var _0x4586b5=path[_0xf5f2('0xe5')](_0x2bc493,_0x5981bb[_0xf5f2('0xde')][_0xf5f2('0xe7')]);if(fs[_0xf5f2('0x12f')](_0x4586b5)){fs[_0xf5f2('0x130')](_0x4586b5)[_0xf5f2('0x131')](fs[_0xf5f2('0x132')](path['join'](_0x212d97,_0x5981bb[_0xf5f2('0xde')][_0xf5f2('0xe7')])));}}return{'date':moment(_0x5981bb[_0xf5f2('0x85')])[_0xf5f2('0xea')](_0xf5f2('0x128'))[_0xf5f2('0xb2')](),'sender':_0x5981bb[_0xf5f2('0x121')]===_0xf5f2('0x133')?_0x5981bb[_0xf5f2('0x7f')]?_0x5981bb[_0xf5f2('0x7f')][_0xf5f2('0x3f')]:'System':_0x5981bb['Contact']['firstName']+(_0x5981bb[_0xf5f2('0x73')][_0xf5f2('0x120')]?'\x20'+_0x5981bb[_0xf5f2('0x73')]['lastName']:''),'body':_0x5981bb[_0xf5f2('0xde')]?_0x5981bb[_0xf5f2('0xde')][_0xf5f2('0xe7')]:_0x5981bb['body'],'direction':_0x5981bb[_0xf5f2('0x121')]===_0xf5f2('0x133')?'A':'C','secret':_0x5981bb[_0xf5f2('0xfb')],'read':_0x5981bb[_0xf5f2('0x8a')],'attachment':_0x5981bb[_0xf5f2('0xde')]};})[_0xf5f2('0x76')]()};return ejs[_0xf5f2('0x134')](path[_0xf5f2('0xe5')](config['root'],_0xf5f2('0x11a'),_0xf5f2('0x135'),_0xf5f2('0x136')),{'interaction':_0x220300})[_0xf5f2('0x22')](function(_0x510f56){var _0x319b39=path[_0xf5f2('0xe5')](_0x212d97,_0xf5f2('0x137')+_0x43ca34['id']+'-'+_0x26dc8c+'.pdf');var _0x346a95={'path':_0x319b39,'channel':_0xf5f2('0x126'),'interactionId':_0x43ca34['id']};return pdf[_0xf5f2('0x138')](_0x510f56,_0x346a95);})[_0xf5f2('0x22')](function(){return new BPromise(function(_0x249e9b,_0x56ab93){zipdir(_0x212d97,{'saveTo':_0x3712e3},function(_0x21fce7,_0x38a5e3){if(_0x21fce7)return _0x56ab93(_0x21fce7);return _0x249e9b(_0x38a5e3);});})[_0xf5f2('0x22')](function(){return new BPromise(function(_0x4d8a71,_0x1ca92b){rimraf(_0x212d97,function(_0x486c5e){if(_0x486c5e)_0x1ca92b(_0x486c5e);return _0x4d8a71();});});})[_0xf5f2('0x22')](function(){return _0x4f777b[_0xf5f2('0xe8')](_0x3712e3,_0x8ee5fd,function(_0x5089c1){if(_0x5089c1){console[_0xf5f2('0x139')](_0xf5f2('0x13a'),_0x5089c1);}else{fs[_0xf5f2('0x13b')](_0x3712e3);}});});});}else{return _0x4f777b['sendStatus'](0xc8);}})[_0xf5f2('0x2c')](handleError(_0x4f777b,null));}; \ No newline at end of file +var _0x2032=['nolimit','order','sort','pick','field','color','tools_tags','select','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','o.id\x20=\x20i.UserId','chat_websites','chat_messages','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','ChatWebsiteId','concat','createdAt','$gte','parse','where','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','role','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','fields','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.lastName','c.email','Contact.phone','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','rows','params','keys','include','options','create','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooMetadata','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','vidaooNote','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','join','root','server/files/attachments/','offline-chat/','download','close','format','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsite','%s%d','agentAlias','customer','Visitor','website_alias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','getMyMessages','includeAgent','addTags','ids','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','mkdirSync','Chat','N.A.','closedAt','browserName','customerIp','customerPort','tail','createReadStream','pipe','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','socket.io-emitter','register','jayson/promise','client','http','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','apply','save','update','destroy','end','name','send','merge','body','contact','agent','Users','map','fullname','TagIds','forEach','Tags','index','ChatInteraction','rawAttributes','type','model','query','filters','attributes','intersection','length','hasOwnProperty'];(function(_0x42963f,_0x39e710){var _0x1be879=function(_0x40a88e){while(--_0x40a88e){_0x42963f['push'](_0x42963f['shift']());}};_0x1be879(++_0x39e710);}(_0x2032,0xd9));var _0x2203=function(_0x47033c,_0x364112){_0x47033c=_0x47033c-0x0;var _0x5da0b4=_0x2032[_0x47033c];return _0x5da0b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x2203('0x14'));var logger=require('../../config/logger')(_0x2203('0x15'));var utils=require('../../config/utils');var config=require(_0x2203('0x16'));var licenseUtil=require(_0x2203('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2203('0x18'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x2203('0x19')](socket);var jayson=require(_0x2203('0x1a'));var client=jayson[_0x2203('0x1b')][_0x2203('0x1c')]({'port':0x232b});var client9004=jayson[_0x2203('0x1b')][_0x2203('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x2c36e6,_0x2c085c,_0xdf9d0b,_0x3053f3){return new BPromise(function(_0x5129fb,_0x280eda){var _0x2ee127=_0x3053f3||client;return _0x2ee127['request'](_0x2c36e6,_0xdf9d0b)[_0x2203('0x1d')](function(_0x8906e1){logger['info'](_0x2203('0x1e'),_0x2c085c,'request\x20sent');logger[_0x2203('0x1f')](_0x2203('0x20'),_0x2c085c,_0x2203('0x21'),JSON[_0x2203('0x22')](_0x8906e1));if(_0x8906e1[_0x2203('0x23')]){if(_0x8906e1[_0x2203('0x23')]['code']===0x1f4){logger[_0x2203('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x2c085c,_0x8906e1['error'][_0x2203('0x24')]);return _0x280eda(_0x8906e1['error'][_0x2203('0x24')]);}logger[_0x2203('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x2c085c,_0x8906e1[_0x2203('0x23')]['message']);return _0x5129fb(_0x8906e1['error'][_0x2203('0x24')]);}else{logger[_0x2203('0x25')](_0x2203('0x1e'),_0x2c085c,_0x2203('0x21'));_0x5129fb(_0x8906e1[_0x2203('0x26')][_0x2203('0x24')]);}})[_0x2203('0x27')](function(_0x250349){logger['error'](_0x2203('0x1e'),_0x2c085c,_0x250349);_0x280eda(_0x250349);});});}function respondWithStatusCode(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0xcc;return function(_0x5f11bf){if(_0x5f11bf){return _0x36b958[_0x2203('0x28')](_0x39a11a);}return _0x36b958[_0x2203('0x29')](_0x39a11a)['end']();};}function respondWithResult(_0xd6e109,_0xd91f5d){_0xd91f5d=_0xd91f5d||0xc8;return function(_0x1c6a77){if(_0x1c6a77){return _0xd6e109[_0x2203('0x29')](_0xd91f5d)[_0x2203('0x2a')](_0x1c6a77);}};}function respondWithFilteredResult(_0x1df508,_0x9c53f){return function(_0x5a95c1){if(_0x5a95c1){var _0x34b8ba=typeof _0x9c53f[_0x2203('0x2b')]===_0x2203('0x2c')&&typeof _0x9c53f[_0x2203('0x2d')]==='undefined';var _0x3a8e23=_0x5a95c1[_0x2203('0x2e')];var _0x287c95=_0x34b8ba?0x0:_0x9c53f[_0x2203('0x2b')];var _0x520602=_0x34b8ba?_0x5a95c1[_0x2203('0x2e')]:_0x9c53f[_0x2203('0x2b')]+_0x9c53f['limit'];var _0x5c0157;if(_0x520602>=_0x3a8e23){_0x520602=_0x3a8e23;_0x5c0157=0xc8;}else{_0x5c0157=0xce;}_0x1df508[_0x2203('0x29')](_0x5c0157);return _0x1df508['set']('Content-Range',_0x287c95+'-'+_0x520602+'/'+_0x3a8e23)[_0x2203('0x2a')](_0x5a95c1);}return null;};}function patchUpdates(_0x464c88){return function(_0x191894){try{jsonpatch[_0x2203('0x2f')](_0x191894,_0x464c88,!![]);}catch(_0xf2801d){return BPromise['reject'](_0xf2801d);}return _0x191894[_0x2203('0x30')]();};}function saveUpdates(_0x2324c0,_0x49caec){return function(_0x2a2ee7){if(_0x2a2ee7){return _0x2a2ee7[_0x2203('0x31')](_0x2324c0)[_0x2203('0x1d')](function(_0x4187b4){return _0x4187b4;});}return null;};}function removeEntity(_0x43fee1,_0x24d138){return function(_0x29da55){if(_0x29da55){return _0x29da55[_0x2203('0x32')]()[_0x2203('0x1d')](function(){_0x43fee1['status'](0xcc)[_0x2203('0x33')]();});}};}function handleEntityNotFound(_0x347d3e,_0x56f9b2){return function(_0x54b90b){if(!_0x54b90b){_0x347d3e[_0x2203('0x28')](0x194);}return _0x54b90b;};}function handleError(_0x5e9841,_0x25cc97){_0x25cc97=_0x25cc97||0x1f4;return function(_0x3b1eeb){logger[_0x2203('0x23')](_0x3b1eeb['stack']);if(_0x3b1eeb['name']){delete _0x3b1eeb[_0x2203('0x34')];}_0x5e9841['status'](_0x25cc97)[_0x2203('0x35')](_0x3b1eeb);};}function getMustacheRender(_0x5cfe5e,_0x11451e){return Mustache['render'](_0x5cfe5e,_[_0x2203('0x36')](_0x11451e[_0x2203('0x37')],{'contact':_0x11451e[_0x2203('0x38')],'message':_0x11451e[_0x2203('0x24')],'agent':_0x11451e[_0x2203('0x39')],'interaction':_0x11451e['interaction'],'account':_0x11451e['account']}))||'';}function getInteractionUsers(_0x4c0e9e,_0x7ea79b){return new BPromise(function(_0x25a2dc,_0x323798){try{if(_0x7ea79b[_0x4c0e9e['id']]){_0x4c0e9e[_0x2203('0x3a')]=_[_0x2203('0x3b')](_0x7ea79b[_0x4c0e9e['id']],function(_0x3b250a){return{'id':_0x3b250a['id'],'fullname':_0x3b250a[_0x2203('0x3c')]};});}}catch(_0x590b4e){_0x323798(_0x590b4e);}_0x25a2dc(_0x4c0e9e);});}function getInteractionTags(_0x175945,_0x1b12c3){return new BPromise(function(_0x108fde,_0x26be74){try{if(_0x175945['TagIds']){_0x175945['Tags']=[];_0x175945[_0x2203('0x3d')]['split'](',')[_0x2203('0x3e')](function(_0x446209){_0x175945[_0x2203('0x3f')]['push'](_0x1b12c3[_0x446209]);});}delete _0x175945['TagIds'];}catch(_0x1e7ebc){_0x26be74(_0x1e7ebc);}_0x108fde(_0x175945);});}function updateChatInteraction(_0x3739f6,_0x368444,_0x1e09f3){return new BPromise(function(_0x372709,_0x1fa734){return getInteractionUsers(_0x3739f6,_0x1e09f3)['then'](function(_0x15d3b6){return getInteractionTags(_0x15d3b6,_0x368444);})[_0x2203('0x1d')](function(_0x3a866c){_0x372709(_0x3a866c);})[_0x2203('0x27')](function(_0x16b452){_0x1fa734(_0x16b452);});});}exports[_0x2203('0x40')]=function(_0x5b4842,_0x23a6e8){var _0x36b8e4={},_0x1e34a0={},_0x595281={'count':0x0,'rows':[]};var _0x2e2ca5=_[_0x2203('0x3b')](db[_0x2203('0x41')][_0x2203('0x42')],function(_0x4c3259){return{'name':_0x4c3259['fieldName'],'type':_0x4c3259[_0x2203('0x43')]['key']};});_0x1e34a0[_0x2203('0x44')]=_[_0x2203('0x3b')](_0x2e2ca5,_0x2203('0x34'));_0x1e34a0[_0x2203('0x45')]=_['keys'](_0x5b4842[_0x2203('0x45')]);_0x1e34a0[_0x2203('0x46')]=_['intersection'](_0x1e34a0[_0x2203('0x44')],_0x1e34a0[_0x2203('0x45')]);_0x36b8e4[_0x2203('0x47')]=_[_0x2203('0x48')](_0x1e34a0['model'],qs['fields'](_0x5b4842[_0x2203('0x45')]['fields']));_0x36b8e4['attributes']=_0x36b8e4[_0x2203('0x47')][_0x2203('0x49')]?_0x36b8e4[_0x2203('0x47')]:_0x1e34a0['model'];if(!_0x5b4842['query'][_0x2203('0x4a')](_0x2203('0x4b'))){_0x36b8e4[_0x2203('0x2d')]=qs[_0x2203('0x2d')](_0x5b4842[_0x2203('0x45')][_0x2203('0x2d')]);_0x36b8e4['offset']=qs[_0x2203('0x2b')](_0x5b4842['query'][_0x2203('0x2b')]);}_0x36b8e4[_0x2203('0x4c')]=qs[_0x2203('0x4d')](_0x5b4842[_0x2203('0x45')]['sort']);_0x36b8e4['where']=qs[_0x2203('0x46')](_[_0x2203('0x4e')](_0x5b4842[_0x2203('0x45')],_0x1e34a0[_0x2203('0x46')]),_0x2e2ca5);var _0x559370=[];var _0x4de47a=squel['select']()[_0x2203('0x4f')]('id')[_0x2203('0x4f')]('name')[_0x2203('0x4f')](_0x2203('0x50'))['from'](_0x2203('0x51'));var _0xb47204=squel[_0x2203('0x52')]()[_0x2203('0x4f')]('u.id')[_0x2203('0x4f')]('u.fullname')[_0x2203('0x4f')](_0x2203('0x53'))['from'](_0x2203('0x54'),'ui')[_0x2203('0x55')](_0x2203('0x56'),'u',_0x2203('0x57'));var _0x3f335a=squel[_0x2203('0x52')]()['from']('chat_interactions','i')[_0x2203('0x55')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x2203('0x55')](_0x2203('0x56'),'o',_0x2203('0x58'))['left_join'](_0x2203('0x59'),'a','a.id\x20=\x20i.ChatWebsiteId')['left_join'](_0x2203('0x5a'),'me','me.ChatInteractionId\x20=\x20i.id')['left_join']('chat_interaction_has_tags','it',_0x2203('0x5b'))[_0x2203('0x55')](_0x2203('0x51'),'t',_0x2203('0x5c'));var _0x26d3d9=squel[_0x2203('0x5d')]();var _0x2baea2=[];var _0x91f70c=squel[_0x2203('0x5d')]();var _0x216641;if(_0x5b4842[_0x2203('0x45')][_0x2203('0x5e')]){_0x216641=as['parseSearch'](_0x5b4842['query'][_0x2203('0x5e')]);var _0x43d8c0=_0x216641[_0x2203('0x5f')];for(var _0x2446be=0x0;_0x2446be<_0x216641[_0x2203('0x60')][_0x2203('0x49')];_0x2446be++){var _0x4f8b8e=_0x216641['conditions'][_0x2446be];var _0xb49120='i';var _0x34358e=_[_0x2203('0x61')](_0x2e2ca5,[_0x2203('0x34'),_0x4f8b8e[_0x2203('0x4f')]]);if(!_0x34358e){switch(_0x4f8b8e[_0x2203('0x4f')]){case _0x2203('0x62'):if(_0x4f8b8e[_0x2203('0x63')]==0x1){_0x3f335a[_0x2203('0x64')]('`'+_0x4f8b8e[_0x2203('0x4f')]+_0x2203('0x65'));}else{_0x3f335a['having']('`'+_0x4f8b8e[_0x2203('0x4f')]+_0x2203('0x66'));}break;case _0x2203('0x67'):if(_0x4f8b8e[_0x2203('0x68')]===_0x2203('0x69')){if(_0x4f8b8e[_0x2203('0x63')][_0x2203('0x6a')]('\x20')[_0x2203('0x49')]>0x1){_0x26d3d9[_0x43d8c0](_0x2203('0x6b'),qs[_0x2203('0x6c')](_0x4f8b8e[_0x2203('0x63')]),null);}else{var _0x6ea7e8='%'+_0x4f8b8e[_0x2203('0x63')]+'%';_0x26d3d9[_0x43d8c0](_0x2203('0x6d'),_0x6ea7e8,_0x6ea7e8,_0x6ea7e8);}}else{_0x34358e=_[_0x2203('0x61')](_0x2e2ca5,[_0x2203('0x34'),_0x2203('0x6e')]);_0x4f8b8e[_0x2203('0x4f')]=_0x2203('0x6e');_0xf16e1d=as[_0x2203('0x6f')](_0xb49120,_0x34358e['type'],_0x4f8b8e);_0x26d3d9[_0x43d8c0](_0xf16e1d[_0x2203('0x70')],_0xf16e1d[_0x2203('0x63')][_0x2203('0x71')],_0xf16e1d['value'][_0x2203('0x33')]);}break;case _0x2203('0x72'):var _0x1b4f96=_0x4f8b8e[_0x2203('0x63')][_0x2203('0x6a')](',')['map'](function(_0x38b077){return Number(_0x38b077);});_0x1b4f96[_0x2203('0x3e')](function(_0x1c63bf){_0x91f70c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1c63bf+',%');});_0x2baea2=_['union'](_0x2baea2,_0x1b4f96);break;case'User':if(_0x4f8b8e['operator']==='$substring'){_0x26d3d9[_0x43d8c0](_0x2203('0x73'),'%'+_0x4f8b8e[_0x2203('0x63')]+'%',null);}else{_0x34358e=_[_0x2203('0x61')](_0x2e2ca5,[_0x2203('0x34'),_0x2203('0x74')]);_0x4f8b8e[_0x2203('0x4f')]=_0x2203('0x74');_0xf16e1d=as[_0x2203('0x6f')](_0xb49120,_0x34358e['type'],_0x4f8b8e);_0x26d3d9[_0x43d8c0](_0xf16e1d['text'],_0xf16e1d[_0x2203('0x63')][_0x2203('0x71')],_0xf16e1d[_0x2203('0x63')][_0x2203('0x33')]);}break;case _0x2203('0x37'):_0xf16e1d=as[_0x2203('0x6f')]('me',null,_0x4f8b8e);_0x26d3d9[_0x43d8c0](_0xf16e1d[_0x2203('0x70')],_0xf16e1d[_0x2203('0x63')][_0x2203('0x71')],_0xf16e1d[_0x2203('0x63')][_0x2203('0x33')]);break;}}else{var _0xf16e1d=as[_0x2203('0x6f')](_0xb49120,_0x34358e[_0x2203('0x43')],_0x4f8b8e);_0x26d3d9[_0x43d8c0](_0xf16e1d[_0x2203('0x70')],_0xf16e1d[_0x2203('0x63')][_0x2203('0x71')],_0xf16e1d[_0x2203('0x63')][_0x2203('0x33')]);}}}else{var _0x4b2e4f=_(_0x5b4842[_0x2203('0x45')])['keys']()[_0x2203('0x3b')](function(_0x55ecbb){return _[_0x2203('0x75')](_0x2e2ca5,[_0x2203('0x34'),_0x55ecbb])?_0x55ecbb:undefined;})[_0x2203('0x76')]()[_0x2203('0x63')]();if(!_[_0x2203('0x77')](_0x4b2e4f)){_0x4b2e4f[_0x2203('0x3e')](function(_0x3e1583){if(_0x3e1583===_0x2203('0x78')){_0x3f335a['where']('i.ChatWebsiteId\x20IN\x20?',[][_0x2203('0x79')](_0x5b4842[_0x2203('0x45')][_0x3e1583]));}else if(_0x3e1583===_0x2203('0x7a')){var _0x484549=JSON['parse'](_0x5b4842['query'][_0x3e1583])[_0x2203('0x7b')];var _0x2d26ba=JSON[_0x2203('0x7c')](_0x5b4842[_0x2203('0x45')][_0x3e1583])['$lte'];_0x3f335a[_0x2203('0x7d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x484549,_0x2d26ba);}else{if(_0x5b4842[_0x2203('0x45')][_0x3e1583]===_0x2203('0x7e')){_0x3f335a[_0x2203('0x7d')]('i.'+_0x3e1583+_0x2203('0x7f'));}else{_0x3f335a[_0x2203('0x7d')]('i.'+_0x3e1583+'\x20=\x20?',_0x5b4842[_0x2203('0x45')][_0x3e1583]);}}});}if(_0x5b4842[_0x2203('0x45')][_0x2203('0x80')]){if(_0x5b4842['query'][_0x2203('0x80')]==0x1){_0x3f335a[_0x2203('0x64')](_0x2203('0x81'));}else{_0x3f335a[_0x2203('0x64')](_0x2203('0x82'));}}if(_0x5b4842[_0x2203('0x45')][_0x2203('0x83')]){_0x2baea2=_[_0x2203('0x84')](_0x5b4842[_0x2203('0x45')][_0x2203('0x83')])?_0x5b4842[_0x2203('0x45')]['tag']:new Array(_0x5b4842[_0x2203('0x45')][_0x2203('0x83')]);_0x2baea2[_0x2203('0x3e')](function(_0x2da37c){_0x91f70c['or'](_0x2203('0x85'),'%,'+_0x2da37c+',%');});}if(_0x5b4842[_0x2203('0x45')][_0x2203('0x86')]){var _0x2a5a4b=_0x5b4842[_0x2203('0x45')][_0x2203('0x86')][_0x2203('0x87')]('\x5c','\x5c\x5c')[_0x2203('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2a5a4b)){_0x26d3d9['or']('i.id\x20LIKE\x20?',_0x2a5a4b+'%');}else{_0x26d3d9['or'](_0x2203('0x88'),qs[_0x2203('0x6c')](_0x2a5a4b))['or'](_0x2203('0x89'),_0x2a5a4b+'%');}}}_0x3f335a[_0x2203('0x7d')](_0x26d3d9);_0x3f335a[_0x2203('0x8a')]('i.id');var _0x16e518={'type':db[_0x2203('0x8b')]['QueryTypes']['SELECT'],'raw':!![]};var _0x4edac6=_0x3f335a['clone']();_0x4edac6['field'](_0x2203('0x8c'));_0x4edac6[_0x2203('0x4f')](_0x2203('0x8d'),'unreadMessages');if(_0x36b8e4['order']){_0x36b8e4['order'][_0x2203('0x3e')](function(_0x1e90c4){var _0x15d061=_0x1e90c4[0x0]===_0x2203('0x8e')?_0x1e90c4[0x0]:'i.'+_0x1e90c4[0x0];_0x3f335a[_0x2203('0x4c')](_0x15d061,_0x1e90c4[0x1]===_0x2203('0x8f')?![]:!![]);});}if(!_[_0x2203('0x77')](_0x2baea2)){_0x3f335a['having'](_0x91f70c);_0x4edac6[_0x2203('0x7d')](_0x2203('0x90'),_0x2baea2);}BPromise[_0x2203('0x91')]()[_0x2203('0x1d')](function(){if(!_0x216641){if(_0x5b4842[_0x2203('0x45')][_0x2203('0x78')])return;_0x4edac6[_0x2203('0x7d')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x3f335a[_0x2203('0x7d')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x5b4842['user'][_0x2203('0x92')]!=='agent')return;return _0x5b4842[_0x2203('0x93')][_0x2203('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x29d545){if(_[_0x2203('0x77')](_0x29d545)){_0x4edac6[_0x2203('0x7d')](_0x2203('0x95'));_0x3f335a[_0x2203('0x7d')](_0x2203('0x95'));}else{_0x4edac6['where'](_0x2203('0x96'),_[_0x2203('0x3b')](_0x29d545,'id'));_0x3f335a['where']('i.ChatWebsiteId\x20IN\x20?',_[_0x2203('0x3b')](_0x29d545,'id'));}});})[_0x2203('0x1d')](function(){if(_0x5b4842[_0x2203('0x93')][_0x2203('0x92')]===_0x2203('0x39')&&!_0x216641&&!_0x5b4842[_0x2203('0x45')][_0x2203('0x78')])return[];return db[_0x2203('0x97')][_0x2203('0x45')](_0x4edac6[_0x2203('0x98')](),_0x16e518);})[_0x2203('0x1d')](function(_0x413729){_0x595281[_0x2203('0x2e')]=_0x413729[_0x2203('0x49')];if(_0x595281[_0x2203('0x2e')]===0x0)return[];return db[_0x2203('0x97')]['query'](_0x4de47a['toString'](),_0x16e518)[_0x2203('0x1d')](function(_0x1295a3){_0x559370=_['keyBy'](_0x1295a3,'id');_0x16e518=_[_0x2203('0x36')](_0x16e518,{'model':db[_0x2203('0x41')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5b4842['query'][_0x2203('0x99')]){_0x36b8e4[_0x2203('0x47')]['forEach'](function(_0x21f357){_0x3f335a[_0x2203('0x4f')]('i.'+_0x21f357);});}else{_0x3f335a['field'](_0x2203('0x8d'),_0x2203('0x62'));_0x3f335a[_0x2203('0x4f')](_0x2203('0x9a'),'Account.key');_0x3f335a['field'](_0x2203('0x9b'),_0x2203('0x9c'));_0x3f335a[_0x2203('0x4f')]('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');_0x3f335a[_0x2203('0x4f')](_0x2203('0x9d'));_0x3f335a[_0x2203('0x4f')]('c.firstName','Contact.firstName');_0x3f335a[_0x2203('0x4f')](_0x2203('0x9e'),'Contact.lastName');_0x3f335a[_0x2203('0x4f')](_0x2203('0x9f'),'Contact.email');_0x3f335a[_0x2203('0x4f')]('c.phone',_0x2203('0xa0'));_0x3f335a['field']('c.mobile','Contact.mobile');_0x3f335a[_0x2203('0x4f')](_0x2203('0xa1'),'Contact.fax');_0x3f335a[_0x2203('0x4f')](_0x2203('0xa2'),_0x2203('0xa3'));_0x3f335a['field'](_0x2203('0xa4'),'Owner.internal');_0x3f335a[_0x2203('0x4f')](_0x2203('0xa5'),'TagIds');}if(_0x36b8e4[_0x2203('0x2d')])_0x3f335a[_0x2203('0x2d')](_0x36b8e4['limit']);if(_0x36b8e4[_0x2203('0x2b')])_0x3f335a[_0x2203('0x2b')](_0x36b8e4[_0x2203('0x2b')]);return db[_0x2203('0x97')][_0x2203('0x45')](_0x3f335a['toString'](),_0x16e518);})[_0x2203('0x1d')](function(_0x1b5185){if(_0x1b5185[_0x2203('0x49')]>0x0)_0xb47204[_0x2203('0x7d')](_0x2203('0xa6'),_[_0x2203('0x3b')](_0x1b5185,'id'));return db['sequelize'][_0x2203('0x45')](_0xb47204[_0x2203('0x98')](),_0x16e518)['then'](function(_0x13fc7b){var _0x5e0bff=_[_0x2203('0xa7')](_0x13fc7b,_0x2203('0xa8'));var _0xc611e8=[];_0x1b5185['forEach'](function(_0xab7f0b){_0xc611e8[_0x2203('0xa9')](updateChatInteraction(_0xab7f0b,_0x559370,_0x5e0bff));});return BPromise[_0x2203('0xaa')](_0xc611e8);});});})[_0x2203('0x1d')](function(_0x2c275f){_0x595281[_0x2203('0xab')]=_0x2c275f;return _0x595281;})[_0x2203('0x1d')](respondWithFilteredResult(_0x23a6e8,_0x36b8e4))['catch'](handleError(_0x23a6e8,null));};exports['show']=function(_0x106534,_0x41eb4c){var _0x25996c={'raw':![],'where':{'id':_0x106534[_0x2203('0xac')]['id']}},_0x4e1f55={};_0x4e1f55[_0x2203('0x44')]=_[_0x2203('0xad')](db['ChatInteraction'][_0x2203('0x42')]);_0x4e1f55[_0x2203('0x45')]=_['keys'](_0x106534[_0x2203('0x45')]);_0x4e1f55['filters']=_[_0x2203('0x48')](_0x4e1f55[_0x2203('0x44')],_0x4e1f55['query']);_0x25996c[_0x2203('0x47')]=_[_0x2203('0x48')](_0x4e1f55[_0x2203('0x44')],qs[_0x2203('0x99')](_0x106534[_0x2203('0x45')][_0x2203('0x99')]));_0x25996c[_0x2203('0x47')]=_0x25996c[_0x2203('0x47')][_0x2203('0x49')]?_0x25996c[_0x2203('0x47')]:_0x4e1f55[_0x2203('0x44')];if(_0x106534[_0x2203('0x45')]['includeAll']){_0x25996c[_0x2203('0xae')]=[{'all':!![]}];}_0x25996c=_['merge']({},_0x25996c,_0x106534[_0x2203('0xaf')]);return db[_0x2203('0x41')][_0x2203('0x61')](_0x25996c)[_0x2203('0x1d')](handleEntityNotFound(_0x41eb4c,null))[_0x2203('0x1d')](respondWithResult(_0x41eb4c,null))[_0x2203('0x27')](handleError(_0x41eb4c,null));};exports[_0x2203('0xb0')]=function(_0x8f9f98,_0x36205d){return db[_0x2203('0x41')][_0x2203('0xb0')](_0x8f9f98['body'],{})[_0x2203('0x1d')](respondWithResult(_0x36205d,0xc9))['catch'](handleError(_0x36205d,null));};exports[_0x2203('0x31')]=function(_0x3deb3b,_0x6b8ea4){if(_0x3deb3b['body']['id']){delete _0x3deb3b[_0x2203('0x37')]['id'];}return db[_0x2203('0x41')][_0x2203('0x61')]({'where':{'id':_0x3deb3b[_0x2203('0xac')]['id']}})[_0x2203('0x1d')](handleEntityNotFound(_0x6b8ea4,null))['then'](saveUpdates(_0x3deb3b[_0x2203('0x37')],null))['then'](respondWithResult(_0x6b8ea4,null))[_0x2203('0x27')](handleError(_0x6b8ea4,null));};exports[_0x2203('0x32')]=function(_0x5f5270,_0x376954){return db[_0x2203('0x41')][_0x2203('0x61')]({'where':{'id':_0x5f5270[_0x2203('0xac')]['id']}})['then'](handleEntityNotFound(_0x376954,null))[_0x2203('0x1d')](removeEntity(_0x376954,null))['catch'](handleError(_0x376954,null));};exports['describe']=function(_0x4055eb,_0x95b45a){return db[_0x2203('0x41')][_0x2203('0xb1')]()[_0x2203('0x1d')](respondWithResult(_0x95b45a,null))[_0x2203('0x27')](handleError(_0x95b45a,null));};exports[_0x2203('0xb2')]=function(_0x4b6d6f,_0xb40f2b){var _0x4769ee=_0x4b6d6f[_0x2203('0xac')]['id'];var _0x492179;var _0x4fc1cc;var _0x4d6ece;return db[_0x2203('0x41')][_0x2203('0xb3')]({'where':{'id':_0x4769ee}})[_0x2203('0x1d')](function(_0x2d1ee6){_0x492179=_0x2d1ee6;return db['ChatWebsite'][_0x2203('0xb3')]({'where':{'id':_0x2d1ee6[_0x2203('0x78')]},'attributes':['id',_0x2203('0xb4'),_0x2203('0xb5'),'vidaooTopic','vidaooNote',_0x2203('0xb6')],'raw':!![]});})[_0x2203('0x1d')](function(_0x1ed416){if(_0x1ed416&&_0x1ed416['vidaooApiKey']&&_0x1ed416[_0x2203('0xb5')]){_0x4fc1cc=_0x1ed416;var _0x28bf0a={'interaction':{'id':_0x4769ee},'agent':{'id':_0x4b6d6f[_0x2203('0x93')]['id'],'name':_0x4b6d6f[_0x2203('0x93')][_0x2203('0x34')],'fullname':_0x4b6d6f[_0x2203('0x93')][_0x2203('0x3c')],'email':_0x4b6d6f['user'][_0x2203('0xb7')]},'contact':_0x4b6d6f[_0x2203('0x37')][_0x2203('0x38')],'account':_0x4b6d6f[_0x2203('0x37')][_0x2203('0xb8')]};var _0x4457c9={'rejectUnauthorized':![],'method':_0x2203('0xb9'),'url':_0x2203('0xba'),'headers':{'X-APIKEY':_0x1ed416[_0x2203('0xb4')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4b6d6f['user'][_0x2203('0xb7')]],'buttons':null,'topic':_0x4fc1cc[_0x2203('0xbb')],'note':_[_0x2203('0xbc')](_0x4fc1cc[_0x2203('0xbd')])?null:getMustacheRender(_0x4fc1cc['vidaooNote'],_0x28bf0a),'metadata':null},'redirect':_0x2203('0xbe'),'json':!![]};try{if(!_[_0x2203('0xbc')](_0x4fc1cc[_0x2203('0xb6')])){var _0x19ef05=getMustacheRender(_0x4fc1cc[_0x2203('0xb6')],_0x28bf0a);var _0x3f3062=JSON[_0x2203('0x7c')](_0x19ef05);_0x4457c9[_0x2203('0x37')][_0x2203('0xbf')]=_0x3f3062;}}catch(_0x597e49){throw new db['Sequelize'][(_0x2203('0xc0'))](_0x2203('0xc1'));}return rp(_0x4457c9);}else{throw new db[(_0x2203('0x8b'))][(_0x2203('0xc0'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x2203('0x1d')](function(_0x289cde){_0x4d6ece=_0x289cde;if(_0x4d6ece['id']){var _0x5d5e8e={'body':_0x4d6ece[_0x2203('0xc2')],'ChatWebsiteId':_0x4fc1cc['id'],'ChatInteractionId':_0x492179['id'],'direction':_0x2203('0xc3'),'UserId':_0x4b6d6f[_0x2203('0x93')]['id']};return db[_0x2203('0xc4')]['create'](_0x5d5e8e,{});}else{throw new db[(_0x2203('0x8b'))][(_0x2203('0xc0'))](_0x2203('0xc5'));}})['then'](function(){return _0x492179[_0x2203('0xc6')]({'vidaooSessionId':_0x4d6ece['id']});})[_0x2203('0x1d')](respondWithResult(_0xb40f2b,null))[_0x2203('0x27')](handleError(_0xb40f2b,null));};exports['customUpdate']=function(_0x590035,_0x207c86){if(_0x590035[_0x2203('0x37')]['id']){delete _0x590035[_0x2203('0x37')]['id'];}return db[_0x2203('0x41')]['find']({'where':{'id':_0x590035[_0x2203('0xac')]['id']},'include':[{'model':db[_0x2203('0xc7')],'as':_0x2203('0x67')}]})['then'](handleEntityNotFound(_0x207c86,null))['then'](saveUpdates(_0x590035[_0x2203('0x37')],null))[_0x2203('0x1d')](respondWithResult(_0x207c86,null))[_0x2203('0x27')](handleError(_0x207c86,null));};exports[_0x2203('0xc8')]=function(_0x401831,_0x410894,_0x2b0d0b){if(_0x401831[_0x2203('0x37')]['id']){delete _0x401831[_0x2203('0x37')]['id'];}return db[_0x2203('0x41')][_0x2203('0x61')]({'where':{'id':_0x401831['params']['id']}})[_0x2203('0x1d')](function(_0x5edebd){if(!_0x5edebd){logger[_0x2203('0x23')](_0x2203('0xc9'),_0x2203('0xc8'),0x194,_0x2203('0xca'));_0x410894[_0x2203('0x28')](0x194);}else{if(_0x5edebd['UserId']){throw new db[(_0x2203('0x8b'))][(_0x2203('0xc0'))](_0x2203('0xcb'));}}return _0x5edebd;})['then'](function(_0xe9cd8f){if(_0xe9cd8f){return _0xe9cd8f[_0x2203('0x31')]({'closed':_0x401831[_0x2203('0x37')][_0x2203('0xcc')],'disposition':_0x401831['body'][_0x2203('0xcd')]})[_0x2203('0x1d')](function(_0x4508c3){return _0x4508c3;});}})[_0x2203('0x1d')](function(_0x4e3ea8){return respondWithRpcPromise(_0x2203('0xce'),_0x2203('0xc8'),_0x401831['body'],client9004);})[_0x2203('0x1d')](respondWithResult(_0x410894,null))[_0x2203('0x27')](handleError(_0x410894,null));};exports['attachmentUpload']=function(_0x5cb5be,_0x54f1a1,_0x5d21eb){_0x5cb5be[_0x2203('0x37')]['name']=_0x5cb5be[_0x2203('0xcf')]['originalname'];_0x5cb5be['body'][_0x2203('0xd0')]=_0x5cb5be['file'][_0x2203('0xd1')];_0x5cb5be['body'][_0x2203('0x43')]=_0x5cb5be[_0x2203('0xcf')][_0x2203('0xd2')];return db[_0x2203('0xd3')][_0x2203('0xb0')](_0x5cb5be[_0x2203('0x37')])[_0x2203('0x1d')](respondWithResult(_0x54f1a1,0xc9))[_0x2203('0x27')](handleError(_0x54f1a1,null));};exports[_0x2203('0xd4')]=function(_0xabe2eb,_0x453179,_0x359968){return db['ChatInteraction'][_0x2203('0xb3')]({'where':{'id':_0xabe2eb[_0x2203('0xac')]['id']},'raw':!![]})[_0x2203('0x1d')](handleEntityNotFound(_0x453179,null))[_0x2203('0x1d')](function(_0x3d2ba9){if(_0x3d2ba9){if(_0x3d2ba9[_0x2203('0xcc')]){return _0x453179['status'](0x193)[_0x2203('0x2a')]({'status':0x193,'message':_0x2203('0xd5')});}return db[_0x2203('0xd3')][_0x2203('0xb3')]({'where':{'id':_0xabe2eb[_0x2203('0x45')][_0x2203('0xd6')]},'raw':!![]})['then'](handleEntityNotFound(_0x453179,null));}})[_0x2203('0x1d')](function(_0x5a9d4e){if(_0x5a9d4e){var _0x3217a3=_0x5a9d4e['ChatOfflineMessageId']!==null;var _0x219e9d=path[_0x2203('0xd7')](config[_0x2203('0xd8')],_0x2203('0xd9'));if(_0x3217a3){_0x219e9d=path['join'](_0x219e9d,_0x2203('0xda'));}var _0x4598cb=path[_0x2203('0xd7')](_0x219e9d,_0x5a9d4e[_0x2203('0xd0')]);return _0x453179[_0x2203('0xdb')](_0x4598cb);}})[_0x2203('0x27')](handleError(_0x453179,null));};exports[_0x2203('0xdc')]=function(_0x38fb99,_0x5bcf17){var _0x581d9f=null;var _0x5ddb1a=null;var _0x358ab1=null;var _0x5b8c97=null;if(_0x38fb99[_0x2203('0x37')]['id']){delete _0x38fb99[_0x2203('0x37')]['id'];}if(_0x38fb99['body']['mailTranscript']){_0x5b8c97=path[_0x2203('0xd7')](config[_0x2203('0xd8')],'server/files/chat/upload/',util[_0x2203('0xdd')](_0x2203('0xde'),Date[_0x2203('0xdf')]()));_0x38fb99['body'][_0x2203('0xe0')]=_0x5b8c97;}return db['ChatInteraction'][_0x2203('0x61')]({'where':{'id':_0x38fb99['params']['id']},'include':[{'model':db[_0x2203('0xc4')],'as':_0x2203('0xe1'),'include':[{'model':db[_0x2203('0xe2')],'as':_0x2203('0xe2')}]}]})['then'](handleEntityNotFound(_0x5bcf17,null))[_0x2203('0x1d')](saveUpdates(_0x38fb99['body'],null))[_0x2203('0x1d')](function(_0x5f098d){if(_0x5f098d){_0x581d9f=_0x5f098d;return db[_0x2203('0xe3')][_0x2203('0x61')]({'where':{'id':_0x581d9f[_0x2203('0x78')]}});}})[_0x2203('0x1d')](function(_0x5c2159){if(_0x5c2159){_0x358ab1=_0x5c2159;return db[_0x2203('0xc7')][_0x2203('0x61')]({'where':{'id':_0x581d9f[_0x2203('0x6e')]}});}})[_0x2203('0x1d')](function(_0x23daeb){if(_0x23daeb){_0x5ddb1a=_0x23daeb;if(_0x5b8c97){var _0x2ad175=null;for(var _0x3ca475=0x1;_0x3ca475<_0x581d9f[_0x2203('0xe1')][_0x2203('0x49')];++_0x3ca475){_0x2ad175=_0x581d9f[_0x2203('0xe1')][_0x3ca475];var _0x199849=_0x2ad175[_0x2203('0x74')]?util[_0x2203('0xdd')](_0x2203('0xe4'),_0x358ab1[_0x2203('0xe5')],_0x2ad175['UserId']):'System';var _0x4cf298=_0x38fb99[_0x2203('0x37')][_0x2203('0xe6')]||util[_0x2203('0xdd')](_0x2203('0xe4'),_0x2203('0xe7'),_0x2ad175[_0x2203('0x6e')]);switch(_0x358ab1['agentIdentifier']){case _0x2203('0xe8'):_0x199849=_0x2ad175[_0x2203('0x74')]?util['format']('%s%d',_0x358ab1[_0x2203('0xe5')],_0x2ad175['UserId']):_0x2203('0xe9');break;case _0x2203('0xea'):_0x199849=_0x2ad175['UserId']?_0x2ad175[_0x2203('0xe2')][_0x2203('0xeb')]||_0x2ad175['User'][_0x2203('0x3c')]:'System';break;case _0x2203('0xec'):_0x199849=_0x2ad175[_0x2203('0x74')]?_0x2ad175[_0x2203('0xe2')]['fullname']:_0x2203('0xe9');break;default:_0x199849=_0x2ad175[_0x2203('0x74')]?util[_0x2203('0xdd')](_0x2203('0xe4'),_0x358ab1[_0x2203('0xe5')],_0x2ad175['UserId']):_0x2203('0xe9');}var _0x20f50b=util[_0x2203('0xdd')](_0x2203('0xed'),moment(_0x2ad175['createdAt'])[_0x2203('0xdd')](_0x2203('0xee')),_0x2ad175[_0x2203('0xef')]==='in'?_0x4cf298:_0x199849,_0x2ad175[_0x2203('0x37')]);if(!_0x2ad175[_0x2203('0xf0')]){fs['appendFileSync'](_0x5b8c97,_0x20f50b);}}return db[_0x2203('0xf1')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x2203('0xf2')],'as':_0x2203('0xf3'),'raw':!![]}]});}}})[_0x2203('0x1d')](function(_0x16686c){if(_0x16686c&&_0x16686c['Smtp']&&_0x38fb99[_0x2203('0x37')]){var _0x21dfbc={'tls':{'rejectUnauthorized':![]}};if(_0x16686c[_0x2203('0xf3')][_0x2203('0xf4')]){_0x21dfbc[_0x2203('0xf4')]=_0x16686c[_0x2203('0xf3')][_0x2203('0xf4')];}else{_0x21dfbc[_0x2203('0xf5')]=_0x16686c[_0x2203('0xf3')][_0x2203('0xf5')];_0x21dfbc[_0x2203('0xf6')]=_0x16686c[_0x2203('0xf3')][_0x2203('0xf6')];_0x21dfbc[_0x2203('0xf7')]=_0x16686c[_0x2203('0xf3')][_0x2203('0xf7')];}if(_0x16686c['Smtp']['authentication']){_0x21dfbc['auth']={'user':_0x16686c[_0x2203('0xf3')][_0x2203('0x93')],'pass':_0x16686c[_0x2203('0xf3')]['pass']};}return respondWithRpcPromise(_0x2203('0xf8'),_0x2203('0xf9'),{'account':_0x21dfbc,'message':{'from':util[_0x2203('0xdd')](_0x2203('0xfa'),_0x16686c[_0x2203('0x34')],_0x16686c['email']||_0x16686c[_0x2203('0xf3')][_0x2203('0x93')]),'to':_0x38fb99[_0x2203('0x37')][_0x2203('0xfb')],'subject':_0x2203('0xfc'),'text':util['format'](_0x2203('0xfd'),_0x38fb99[_0x2203('0x37')]['mailTranscript']),'attachments':[{'path':_0x5b8c97}]}})['then'](function(){return _0x581d9f;})[_0x2203('0x27')](function(_0xfd2832){console[_0x2203('0x23')](_0xfd2832);});}else{return _0x581d9f;}})[_0x2203('0x1d')](respondWithStatusCode(_0x5bcf17,0xc8))[_0x2203('0x27')](handleError(_0x5bcf17,null));};exports[_0x2203('0xfe')]=function(_0x50d583,_0x5f01c0,_0x30df28){return db[_0x2203('0xc4')][_0x2203('0x61')]({'where':{'id':_0x50d583[_0x2203('0xac')]['id']}})['then'](handleEntityNotFound(_0x5f01c0,null))[_0x2203('0x1d')](function(_0x3fa96f){if(_0x3fa96f){return _0x3fa96f['addMessage'](_0x50d583[_0x2203('0x37')]['ids'],_[_0x2203('0xff')](_0x50d583[_0x2203('0x37')],['ids','id'])||{});}})['then'](respondWithResult(_0x5f01c0,null))[_0x2203('0x27')](handleError(_0x5f01c0,null));};exports[_0x2203('0x100')]=function(_0x4dccbf,_0x2bc31c,_0x5807ef){var _0x45a460={'raw':![],'where':{}};var _0x59eb03={};var _0x2964d7={'count':0x0,'rows':[]};return db[_0x2203('0x41')][_0x2203('0xb3')]({'where':{'id':_0x4dccbf['params']['id']}})[_0x2203('0x1d')](handleEntityNotFound(_0x2bc31c,null))[_0x2203('0x1d')](function(_0x46d93b){if(_0x46d93b){_0x59eb03[_0x2203('0x44')]=_[_0x2203('0xad')](db[_0x2203('0xc4')][_0x2203('0x42')]);_0x59eb03[_0x2203('0x45')]=_[_0x2203('0xad')](_0x4dccbf[_0x2203('0x45')]);_0x59eb03['filters']=_[_0x2203('0x48')](_0x59eb03['model'],_0x59eb03[_0x2203('0x45')]);_0x45a460[_0x2203('0x47')]=_[_0x2203('0x48')](_0x59eb03[_0x2203('0x44')],qs['fields'](_0x4dccbf['query'][_0x2203('0x99')]));_0x45a460['attributes']=_0x45a460[_0x2203('0x47')]['length']?_0x45a460[_0x2203('0x47')]:_0x59eb03['model'];if(!_0x4dccbf['query'][_0x2203('0x4a')](_0x2203('0x4b'))){_0x45a460['limit']=qs[_0x2203('0x2d')](_0x4dccbf[_0x2203('0x45')][_0x2203('0x2d')]);_0x45a460[_0x2203('0x2b')]=qs[_0x2203('0x2b')](_0x4dccbf[_0x2203('0x45')][_0x2203('0x2b')]);}_0x45a460['order']=qs[_0x2203('0x4d')](_0x4dccbf[_0x2203('0x45')][_0x2203('0x4d')]);_0x45a460[_0x2203('0x7d')]=qs[_0x2203('0x46')](_[_0x2203('0x4e')](_0x4dccbf[_0x2203('0x45')],_0x59eb03[_0x2203('0x46')]));_0x45a460[_0x2203('0x7d')][_0x2203('0xa8')]=_0x46d93b['id'];if(_0x4dccbf['query'][_0x2203('0x86')]){_0x45a460[_0x2203('0x7d')]=_[_0x2203('0x36')](_0x45a460[_0x2203('0x7d')],{'$or':_[_0x2203('0x3b')](_0x45a460[_0x2203('0x47')],function(_0x36d988){var _0x36141a={};_0x36141a[_0x36d988]={'$like':'%'+_0x4dccbf[_0x2203('0x45')][_0x2203('0x86')]+'%'};return _0x36141a;})});}if(_0x4dccbf[_0x2203('0x45')][_0x2203('0x7b')]){var _0x2c7cc8=_0x4dccbf['query'][_0x2203('0x7b')][_0x2203('0x6a')](',');var _0x481a3e={};_0x481a3e[_0x2c7cc8[0x0]]={'$gte':moment(_0x2c7cc8[0x1])[_0x2203('0xdd')](_0x2203('0x101'))};_0x45a460[_0x2203('0x7d')]=_[_0x2203('0x36')](_0x45a460[_0x2203('0x7d')],_0x481a3e);}_0x45a460=_[_0x2203('0x36')]({},_0x45a460,_0x4dccbf[_0x2203('0xaf')]);return db[_0x2203('0xc4')][_0x2203('0x2e')]({'where':_0x45a460['where']})[_0x2203('0x1d')](function(_0x2485d3){_0x2964d7[_0x2203('0x2e')]=_0x2485d3;if(_0x4dccbf[_0x2203('0x45')][_0x2203('0x102')]){_0x45a460[_0x2203('0xae')]=[{'all':!![]}];}return db[_0x2203('0xc4')][_0x2203('0x103')](_0x45a460);})['then'](function(_0xc53b76){_0x2964d7['rows']=_0xc53b76;return _0x2964d7;});}})[_0x2203('0x1d')](respondWithFilteredResult(_0x2bc31c,_0x45a460))['catch'](handleError(_0x2bc31c,null));};exports[_0x2203('0x104')]=function(_0x581c4f,_0x3c279b,_0x4031b7){var _0xa9cf5a={'where':{}},_0x135b65={},_0x3c4bc3={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x2203('0xb3')]({'where':{'id':_0x581c4f[_0x2203('0xac')]['id']}})[_0x2203('0x1d')](handleEntityNotFound(_0x3c279b,null))[_0x2203('0x1d')](function(_0x203956){if(_0x203956){_0x135b65[_0x2203('0x44')]=_[_0x2203('0xad')](db[_0x2203('0xc4')]['rawAttributes']);_0x135b65['query']=_['keys'](_0x581c4f[_0x2203('0x45')]);_0x135b65['filters']=_['intersection'](_0x135b65[_0x2203('0x44')],_0x135b65[_0x2203('0x45')]);_0xa9cf5a['attributes']=_['intersection'](_0x135b65[_0x2203('0x44')],qs[_0x2203('0x99')](_0x581c4f[_0x2203('0x45')]['fields']));_0xa9cf5a[_0x2203('0x47')]=_0xa9cf5a[_0x2203('0x47')][_0x2203('0x49')]?_0xa9cf5a[_0x2203('0x47')]:_0x135b65[_0x2203('0x44')];if(!_0x581c4f[_0x2203('0x45')]['hasOwnProperty'](_0x2203('0x4b'))){_0xa9cf5a['limit']=qs[_0x2203('0x2d')](_0x581c4f[_0x2203('0x45')][_0x2203('0x2d')]);_0xa9cf5a[_0x2203('0x2b')]=qs[_0x2203('0x2b')](_0x581c4f[_0x2203('0x45')][_0x2203('0x2b')]);}_0xa9cf5a['order']=qs[_0x2203('0x4d')](_0x581c4f[_0x2203('0x45')]['sort']);_0xa9cf5a[_0x2203('0x7d')]=qs[_0x2203('0x46')](_[_0x2203('0x4e')](_0x581c4f[_0x2203('0x45')],_0x135b65[_0x2203('0x46')]));_0xa9cf5a[_0x2203('0x7d')][_0x2203('0xa8')]=_0x203956['id'];if(_0x581c4f[_0x2203('0x45')][_0x2203('0x86')]){_0xa9cf5a[_0x2203('0x7d')]=_['merge'](_0xa9cf5a[_0x2203('0x7d')],{'$or':_[_0x2203('0x3b')](_0xa9cf5a[_0x2203('0x47')],function(_0x4a6a84){var _0x361282={};_0x361282[_0x4a6a84]={'$like':'%'+_0x581c4f[_0x2203('0x45')][_0x2203('0x86')]+'%'};return _0x361282;})});}_0xa9cf5a[_0x2203('0x7d')][_0x2203('0xf0')]=![];if(_0x581c4f[_0x2203('0x45')]['id']){_0xa9cf5a[_0x2203('0x7d')]['id']={'$gt':_0x581c4f[_0x2203('0x45')]['id']};}_0xa9cf5a=_[_0x2203('0x36')]({},_0xa9cf5a,_0x581c4f[_0x2203('0xaf')]);return db[_0x2203('0xc4')]['count']({'where':_0xa9cf5a[_0x2203('0x7d')]})[_0x2203('0x1d')](function(_0x554450){_0x3c4bc3[_0x2203('0x2e')]=_0x554450;_0xa9cf5a[_0x2203('0xae')]=[];if(_0x581c4f[_0x2203('0x45')][_0x2203('0x105')]){_0xa9cf5a[_0x2203('0xae')][_0x2203('0xa9')]({'model':db[_0x2203('0xe2')],'as':_0x2203('0xe2'),'attributes':['id',_0x2203('0x3c'),'alias']});}if(_0x581c4f[_0x2203('0x45')][_0x2203('0x102')]){_0xa9cf5a['include']=[{'all':!![]}];}return db[_0x2203('0xc4')][_0x2203('0x103')](_0xa9cf5a);})[_0x2203('0x1d')](function(_0x291aef){_0x3c4bc3[_0x2203('0xab')]=_0x291aef;return _0x3c4bc3;});}})[_0x2203('0x1d')](respondWithFilteredResult(_0x3c279b,_0xa9cf5a))[_0x2203('0x27')](handleError(_0x3c279b,null));};exports[_0x2203('0x106')]=function(_0x3e2390,_0x44d30c,_0x46c088){return db[_0x2203('0x41')][_0x2203('0x61')]({'where':{'id':_0x3e2390[_0x2203('0xac')]['id']}})[_0x2203('0x1d')](handleEntityNotFound(_0x44d30c,null))['then'](function(_0x42669a){if(_0x42669a){return _0x42669a['setTags'](_0x3e2390['body'][_0x2203('0x107')],_['omit'](_0x3e2390['body'],['ids','id'])||{})['spread'](function(){return db[_0x2203('0x72')][_0x2203('0x103')]({'attributes':['id',_0x2203('0x34'),_0x2203('0x50')],'where':{'id':_0x3e2390['body'][_0x2203('0x107')]}});})[_0x2203('0x1d')](function(_0x44ff9f){socket['emit']('chatInteractionTags:save',{'id':Number(_0x3e2390[_0x2203('0xac')]['id']),'tags':_0x44ff9f||[]});return{'id':Number(_0x3e2390[_0x2203('0xac')]['id']),'tags':_0x44ff9f||[]};});}})[_0x2203('0x1d')](respondWithResult(_0x44d30c,null))[_0x2203('0x27')](handleError(_0x44d30c,null));};exports[_0x2203('0x108')]=function(_0x2c0df7,_0xdd4efc,_0x2481f5){return db[_0x2203('0x41')][_0x2203('0x61')]({'where':{'id':_0x2c0df7[_0x2203('0xac')]['id']}})['then'](handleEntityNotFound(_0xdd4efc,null))['then'](function(_0x135655){if(_0x135655){return _0x135655[_0x2203('0x108')](_0x2c0df7[_0x2203('0x45')][_0x2203('0x107')]);}})['then'](respondWithStatusCode(_0xdd4efc,null))[_0x2203('0x27')](handleError(_0xdd4efc,null));};exports[_0x2203('0xdb')]=function(_0x4718f4,_0x5b771e){var _0x3dd02d=moment()[_0x2203('0x109')]()[_0x2203('0x98')]();var _0x552a73=path[_0x2203('0xd7')](config['root'],_0x2203('0x10a'),_0x2203('0x10b'),_0x2203('0x10c'));var _0x2111b4=path[_0x2203('0xd7')](config[_0x2203('0xd8')],_0x2203('0x10a'),_0x2203('0x10b'),_0x2203('0x10d'));var _0x20a488=path[_0x2203('0xd7')](_0x552a73,_0x3dd02d);var _0x505c2a=util[_0x2203('0xdd')](_0x2203('0x10e'),_0x4718f4[_0x2203('0xac')]['id'],_0x3dd02d);var _0x44ae18=path[_0x2203('0xd7')](_0x552a73,_0x505c2a);var _0x3fbe4c=[];_0x3fbe4c[_0x2203('0xa9')]({'model':db[_0x2203('0xe2')],'as':_0x2203('0xe2'),'attributes':['id',_0x2203('0x3c')],'raw':!![]});_0x3fbe4c[_0x2203('0xa9')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x2203('0x10f'),_0x2203('0x110')],'raw':!![]});if(_0x4718f4[_0x2203('0x45')][_0x2203('0x10d')]){_0x3fbe4c[_0x2203('0xa9')]({'model':db[_0x2203('0xd3')],'as':_0x2203('0xd3'),'raw':!![]});}var _0x10081d=[{'model':db[_0x2203('0xc4')],'as':_0x2203('0xe1'),'attributes':['id',_0x2203('0x37'),_0x2203('0x7a'),'direction','secret',_0x2203('0x80')],'include':_0x3fbe4c}];_0x10081d['push']({'model':db['ChatWebsite'],'as':_0x2203('0x111'),'attributes':['id','name']});_0x10081d[_0x2203('0xa9')]({'model':db[_0x2203('0xe2')],'as':_0x2203('0x112'),'attributes':['id',_0x2203('0x3c')]});return db[_0x2203('0x41')][_0x2203('0x61')]({'where':{'id':_0x4718f4[_0x2203('0xac')]['id']},'include':_0x10081d})[_0x2203('0x1d')](handleEntityNotFound(_0x5b771e,null))[_0x2203('0x1d')](function(_0x51dbc8){if(_0x51dbc8){var _0xd584ee=_0x51dbc8['get']({'plain':!![]});fs[_0x2203('0x113')](_0x20a488);var _0x1c36d4={'channel':_0x2203('0x114'),'account':_0xd584ee[_0x2203('0x111')][_0x2203('0x34')],'agent':_0xd584ee['Owner']?_0xd584ee[_0x2203('0x112')]['fullname']:_0x2203('0x115'),'createdAt':moment(_0xd584ee['createdAt'])['format'](_0x2203('0x101'))[_0x2203('0x98')](),'closedAt':_0xd584ee[_0x2203('0xcc')]?moment(_0xd584ee[_0x2203('0x116')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x2203('0x98')]():'','disposition':_0xd584ee[_0x2203('0xcd')],'chatInfo':{'browser':_0xd584ee[_0x2203('0x117')],'os':_0xd584ee['osName'],'referer':_0xd584ee['referer'],'customerIp':_0xd584ee[_0x2203('0x118')],'customerPort':_0xd584ee[_0x2203('0x119')]?_0xd584ee[_0x2203('0x119')]:_0x2203('0x115')},'messages':_(_0xd584ee[_0x2203('0xe1')])[_0x2203('0x11a')]()[_0x2203('0x86')]({'secret':![]})[_0x2203('0x3b')](function(_0x2fc5cf){if(_0x2fc5cf[_0x2203('0xd3')]){var _0x2097be=path['join'](_0x2111b4,_0x2fc5cf['Attachment'][_0x2203('0xd0')]);if(fs['existsSync'](_0x2097be)){fs[_0x2203('0x11b')](_0x2097be)[_0x2203('0x11c')](fs['createWriteStream'](path['join'](_0x20a488,_0x2fc5cf[_0x2203('0xd3')][_0x2203('0xd0')])));}}return{'date':moment(_0x2fc5cf[_0x2203('0x7a')])[_0x2203('0xdd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2203('0x98')](),'sender':_0x2fc5cf[_0x2203('0xef')]==='out'?_0x2fc5cf[_0x2203('0xe2')]?_0x2fc5cf['User'][_0x2203('0x3c')]:'System':_0x2fc5cf[_0x2203('0x67')][_0x2203('0x10f')]+(_0x2fc5cf[_0x2203('0x67')][_0x2203('0x110')]?'\x20'+_0x2fc5cf[_0x2203('0x67')][_0x2203('0x110')]:''),'body':_0x2fc5cf[_0x2203('0xd3')]?_0x2fc5cf['Attachment'][_0x2203('0xd0')]:_0x2fc5cf['body'],'direction':_0x2fc5cf[_0x2203('0xef')]===_0x2203('0xc3')?'A':'C','secret':_0x2fc5cf[_0x2203('0xf0')],'read':_0x2fc5cf[_0x2203('0x80')],'attachment':_0x2fc5cf[_0x2203('0xd3')]};})[_0x2203('0x63')]()};return ejs['renderFile'](path['join'](config[_0x2203('0xd8')],_0x2203('0x10a'),_0x2203('0x11d'),'downloadInteraction.ejs'),{'interaction':_0x1c36d4})[_0x2203('0x1d')](function(_0x15260f){var _0x4419a8=path[_0x2203('0xd7')](_0x20a488,_0x2203('0x11e')+_0xd584ee['id']+'-'+_0x3dd02d+_0x2203('0x11f'));var _0x2af4f6={'path':_0x4419a8,'channel':'Chat','interactionId':_0xd584ee['id']};return pdf[_0x2203('0x120')](_0x15260f,_0x2af4f6);})[_0x2203('0x1d')](function(){return new BPromise(function(_0x3e8221,_0x16ccec){zipdir(_0x20a488,{'saveTo':_0x44ae18},function(_0x7da828,_0x29846d){if(_0x7da828)return _0x16ccec(_0x7da828);return _0x3e8221(_0x29846d);});})[_0x2203('0x1d')](function(){return new BPromise(function(_0x1c3684,_0x11c1db){rimraf(_0x20a488,function(_0x447a00){if(_0x447a00)_0x11c1db(_0x447a00);return _0x1c3684();});});})[_0x2203('0x1d')](function(){return _0x5b771e['download'](_0x44ae18,_0x505c2a,function(_0x2a679c){if(_0x2a679c){console[_0x2203('0x121')](_0x2203('0x122'),_0x2a679c);}else{fs[_0x2203('0x123')](_0x44ae18);}});});});}else{return _0x5b771e[_0x2203('0x28')](0xc8);}})['catch'](handleError(_0x5b771e,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 46b69c6..c7ebd8c 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 _0x6f62=['unreadMessages','emit','catch','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','map','findAll'];(function(_0x46b5d7,_0x4f5584){var _0x2c0824=function(_0x3786fd){while(--_0x3786fd){_0x46b5d7['push'](_0x46b5d7['shift']());}};_0x2c0824(++_0x4f5584);}(_0x6f62,0xc5));var _0x26f6=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x6f62[_0x20ef64];return _0x3707d8;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x26f6('0x0'))['db'][_0x26f6('0x1')];var ChatMessage=require(_0x26f6('0x0'))['db'][_0x26f6('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x26f6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x26f6('0x4'),'afterDestroy':_0x26f6('0x5')};function emitEvent(_0x214241){return function(_0x7c2186,_0x27cd57,_0x419c82){_0x7c2186[_0x26f6('0x6')]({'attributes':['id'],'raw':!![]})[_0x26f6('0x7')](function(_0x3640a6){_0x7c2186[_0x26f6('0x8')]('Users',_0x3640a6[_0x26f6('0x9')](function(_0x341523){return{'id':_0x341523['id']};}));return ChatMessage[_0x26f6('0xa')]({'where':{'ChatInteractionId':_0x7c2186['id'],'direction':'in','read':![]},'raw':!![]});})[_0x26f6('0x7')](function(_0x31b6bd){_0x7c2186[_0x26f6('0x8')](_0x26f6('0xb'),_0x31b6bd['length']);ChatInteractionEvents[_0x26f6('0xc')](_0x214241+':'+_0x7c2186['id'],_0x7c2186);ChatInteractionEvents[_0x26f6('0xc')](_0x214241,_0x7c2186);_0x419c82(null);})[_0x26f6('0xd')](_0x419c82(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x26f6('0xe')](e,emitEvent(event));}}module[_0x26f6('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x2f38=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2f38,0x171));var _0x82f3=function(_0x9dbf96,_0x59f40b){_0x9dbf96=_0x9dbf96-0x0;var _0x45bd17=_0x2f38[_0x9dbf96];return _0x45bd17;};'use strict';var EventEmitter=require(_0x82f3('0x0'));var ChatInteraction=require(_0x82f3('0x1'))['db'][_0x82f3('0x2')];var ChatMessage=require(_0x82f3('0x1'))['db'][_0x82f3('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x82f3('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x553305){return function(_0x472210,_0x432a72,_0x4016f2){_0x472210[_0x82f3('0x5')]({'attributes':['id'],'raw':!![]})[_0x82f3('0x6')](function(_0x17d577){_0x472210[_0x82f3('0x7')](_0x82f3('0x8'),_0x17d577[_0x82f3('0x9')](function(_0x19b416){return{'id':_0x19b416['id']};}));return ChatMessage[_0x82f3('0xa')]({'where':{'ChatInteractionId':_0x472210['id'],'direction':'in','read':![]},'raw':!![]});})[_0x82f3('0x6')](function(_0xa7e1e8){_0x472210['setDataValue'](_0x82f3('0xb'),_0xa7e1e8[_0x82f3('0xc')]);ChatInteractionEvents['emit'](_0x553305+':'+_0x472210['id'],_0x472210);ChatInteractionEvents[_0x82f3('0xd')](_0x553305,_0x472210);_0x4016f2(null);})[_0x82f3('0xe')](_0x4016f2(null));};}for(var e in events){if(events[_0x82f3('0xf')](e)){var event=events[e];ChatInteraction[_0x82f3('0x10')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index d163fd8..e26152b 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 _0xe10a=['exports','define','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./chatInteraction.attributes'];(function(_0x325909,_0x401026){var _0x265a0c=function(_0x2b7c52){while(--_0x2b7c52){_0x325909['push'](_0x325909['shift']());}};_0x265a0c(++_0x401026);}(_0xe10a,0xf4));var _0xae10=function(_0x2338ee,_0x5a9561){_0x2338ee=_0x2338ee-0x0;var _0x57c95d=_0xe10a[_0x2338ee];return _0x57c95d;};'use strict';var _=require(_0xae10('0x0'));var util=require(_0xae10('0x1'));var logger=require(_0xae10('0x2'))('api');var moment=require('moment');var BPromise=require(_0xae10('0x3'));var rp=require(_0xae10('0x4'));var fs=require('fs');var path=require(_0xae10('0x5'));var rimraf=require(_0xae10('0x6'));var config=require('../../config/environment');var attributes=require(_0xae10('0x7'));module[_0xae10('0x8')]=function(_0x271e14,_0x2b7a11){return _0x271e14[_0xae10('0x9')](_0xae10('0xa'),attributes,{'tableName':_0xae10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4c2e8b,_0x5a8677,_0x40ba2f){if(_0x4c2e8b[_0xae10('0xc')](_0xae10('0xd'))){_0x4c2e8b['closedAt']=moment()[_0xae10('0xe')](_0xae10('0xf'));}_0x40ba2f(null,_0x4c2e8b);}},'charset':_0xae10('0x10'),'collate':_0xae10('0x11')});}; \ No newline at end of file +var _0x1180=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','changed'];(function(_0x389b48,_0x2a1760){var _0x1cc751=function(_0x1f314d){while(--_0x1f314d){_0x389b48['push'](_0x389b48['shift']());}};_0x1cc751(++_0x2a1760);}(_0x1180,0x1a6));var _0x0118=function(_0xa592ba,_0xf357de){_0xa592ba=_0xa592ba-0x0;var _0x4abcf0=_0x1180[_0xa592ba];return _0x4abcf0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0118('0x0'))('api');var moment=require(_0x0118('0x1'));var BPromise=require(_0x0118('0x2'));var rp=require(_0x0118('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0118('0x4'));var config=require(_0x0118('0x5'));var attributes=require(_0x0118('0x6'));module['exports']=function(_0x2555b8,_0x1c27e1){return _0x2555b8[_0x0118('0x7')](_0x0118('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x170a3a,_0x1a9816,_0x5609ba){if(_0x170a3a[_0x0118('0x9')](_0x0118('0xa'))){_0x170a3a[_0x0118('0xb')]=moment()[_0x0118('0xc')](_0x0118('0xd'));}_0x5609ba(null,_0x170a3a);}},'charset':_0x0118('0xe'),'collate':_0x0118('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 0d4357f..d871a5c 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 _0x73aa=['error','code','message','result','ChatInteraction','update','body','options','where','UpdateChatInteraction','catch','AddTagsToChatInteraction','ids','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x40f356,_0x405d8f){var _0x2d7bac=function(_0x37381f){while(--_0x37381f){_0x40f356['push'](_0x40f356['shift']());}};_0x2d7bac(++_0x405d8f);}(_0x73aa,0x7b));var _0xa73a=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x73aa[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0xa73a('0x0'));var util=require(_0xa73a('0x1'));var moment=require(_0xa73a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa73a('0x3'));var db=require(_0xa73a('0x4'))['db'];var utils=require(_0xa73a('0x5'));var logger=require('../../config/logger')(_0xa73a('0x6'));var config=require(_0xa73a('0x7'));var jayson=require(_0xa73a('0x8'));var client=jayson['client'][_0xa73a('0x9')]({'port':0x232a});config[_0xa73a('0xa')]=_['defaults'](config[_0xa73a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa73a('0xb'))(new Redis(config[_0xa73a('0xa')]));require(_0xa73a('0xc'))[_0xa73a('0xd')](socket);function respondWithRpcPromise(_0x19617c,_0xa0068f,_0x638b14){return new BPromise(function(_0x1a407b,_0x4f1aae){return client[_0xa73a('0xe')](_0x19617c,_0x638b14)[_0xa73a('0xf')](function(_0x14184e){logger[_0xa73a('0x10')](_0xa73a('0x11'),_0xa0068f,_0xa73a('0x12'));logger[_0xa73a('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xa0068f,'request\x20sent',JSON[_0xa73a('0x14')](_0x14184e));if(_0x14184e['error']){if(_0x14184e[_0xa73a('0x15')][_0xa73a('0x16')]===0x1f4){logger[_0xa73a('0x15')](_0xa73a('0x11'),_0xa0068f,_0x14184e[_0xa73a('0x15')][_0xa73a('0x17')]);return _0x4f1aae(_0x14184e[_0xa73a('0x15')]['message']);}logger[_0xa73a('0x15')]('ChatInteraction,\x20%s,\x20%s',_0xa0068f,_0x14184e[_0xa73a('0x15')][_0xa73a('0x17')]);return _0x1a407b(_0x14184e[_0xa73a('0x15')][_0xa73a('0x17')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0xa0068f,_0xa73a('0x12'));_0x1a407b(_0x14184e[_0xa73a('0x18')]['message']);}})['catch'](function(_0x3d4d0e){logger['error'](_0xa73a('0x11'),_0xa0068f,_0x3d4d0e);_0x4f1aae(_0x3d4d0e);});});}exports['UpdateChatInteraction']=function(_0x5f42dc){var _0x289658=this;return new Promise(function(_0x845730,_0x10af7c){return db[_0xa73a('0x19')][_0xa73a('0x1a')](_0x5f42dc[_0xa73a('0x1b')],{'raw':_0x5f42dc['options']?_0x5f42dc[_0xa73a('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f42dc['options']?_0x5f42dc[_0xa73a('0x1c')][_0xa73a('0x1d')]||null:null,'attributes':_0x5f42dc[_0xa73a('0x1c')]?_0x5f42dc[_0xa73a('0x1c')]['attributes']||null:null,'limit':_0x5f42dc[_0xa73a('0x1c')]?_0x5f42dc[_0xa73a('0x1c')]['limit']||null:null})[_0xa73a('0xf')](function(_0x4615c1){logger[_0xa73a('0x10')](_0xa73a('0x1e'),_0x5f42dc);logger[_0xa73a('0x13')](_0xa73a('0x1e'),_0x5f42dc,JSON[_0xa73a('0x14')](_0x4615c1));_0x845730(_0x4615c1);})[_0xa73a('0x1f')](function(_0x4b2e07){logger['error'](_0xa73a('0x1e'),_0x4b2e07[_0xa73a('0x17')],_0x5f42dc);_0x10af7c(_0x289658[_0xa73a('0x15')](0x1f4,_0x4b2e07[_0xa73a('0x17')]));});});};exports[_0xa73a('0x20')]=function(_0x586abc){return new Promise(function(_0x4c208c,_0x187438){return db['ChatInteraction']['find']({'where':_0x586abc['options']?_0x586abc['options'][_0xa73a('0x1d')]||null:null})['then'](function(_0x40324d){if(_0x40324d){return _0x40324d['addTags'](_0x586abc[_0xa73a('0x1b')][_0xa73a('0x21')],_['omit'](_0x586abc[_0xa73a('0x1b')],[_0xa73a('0x21'),'id'])||{});}})[_0xa73a('0x22')](function(_0x64ff67){logger[_0xa73a('0x10')](_0xa73a('0x23'),_0x586abc);logger[_0xa73a('0x13')](_0xa73a('0x23'),_0x586abc,JSON[_0xa73a('0x14')](_0x64ff67));_0x4c208c(_0x64ff67);})['catch'](function(_0x25caea){logger[_0xa73a('0x15')](_0xa73a('0x23'),_0x25caea[_0xa73a('0x17')],_0x586abc);_0x187438(_this[_0xa73a('0x15')](0x1f4,_0x25caea['message']));});});}; \ No newline at end of file +var _0xd18b=['socket.io-emitter','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','attributes','limit','where','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost'];(function(_0x2d9c5f,_0x2aa057){var _0x1e99cb=function(_0x598f17){while(--_0x598f17){_0x2d9c5f['push'](_0x2d9c5f['shift']());}};_0x1e99cb(++_0x2aa057);}(_0xd18b,0x183));var _0xbd18=function(_0x18e830,_0x1963f1){_0x18e830=_0x18e830-0x0;var _0x145396=_0xd18b[_0x18e830];return _0x145396;};'use strict';var _=require(_0xbd18('0x0'));var util=require(_0xbd18('0x1'));var moment=require(_0xbd18('0x2'));var BPromise=require(_0xbd18('0x3'));var rs=require(_0xbd18('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd18('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd18('0x6'))('rpc');var config=require(_0xbd18('0x7'));var jayson=require(_0xbd18('0x8'));var client=jayson[_0xbd18('0x9')]['http']({'port':0x232a});config['redis']=_[_0xbd18('0xa')](config[_0xbd18('0xb')],{'host':_0xbd18('0xc'),'port':0x18eb});var socket=require(_0xbd18('0xd'))(new Redis(config[_0xbd18('0xb')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x26b28a,_0x1b0d84,_0x50c1af){return new BPromise(function(_0x4b6204,_0xf2eb13){return client[_0xbd18('0xe')](_0x26b28a,_0x50c1af)[_0xbd18('0xf')](function(_0xcf44e8){logger[_0xbd18('0x10')](_0xbd18('0x11'),_0x1b0d84,_0xbd18('0x12'));logger[_0xbd18('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x1b0d84,_0xbd18('0x12'),JSON[_0xbd18('0x14')](_0xcf44e8));if(_0xcf44e8[_0xbd18('0x15')]){if(_0xcf44e8[_0xbd18('0x15')][_0xbd18('0x16')]===0x1f4){logger[_0xbd18('0x15')](_0xbd18('0x11'),_0x1b0d84,_0xcf44e8[_0xbd18('0x15')][_0xbd18('0x17')]);return _0xf2eb13(_0xcf44e8['error']['message']);}logger[_0xbd18('0x15')](_0xbd18('0x11'),_0x1b0d84,_0xcf44e8[_0xbd18('0x15')][_0xbd18('0x17')]);return _0x4b6204(_0xcf44e8[_0xbd18('0x15')][_0xbd18('0x17')]);}else{logger[_0xbd18('0x10')](_0xbd18('0x11'),_0x1b0d84,'request\x20sent');_0x4b6204(_0xcf44e8[_0xbd18('0x18')][_0xbd18('0x17')]);}})[_0xbd18('0x19')](function(_0xca0817){logger[_0xbd18('0x15')](_0xbd18('0x11'),_0x1b0d84,_0xca0817);_0xf2eb13(_0xca0817);});});}exports[_0xbd18('0x1a')]=function(_0x3e0237){var _0x1bca3c=this;return new Promise(function(_0x91f00d,_0x32edd5){return db[_0xbd18('0x1b')][_0xbd18('0x1c')](_0x3e0237['body'],{'raw':_0x3e0237[_0xbd18('0x1d')]?_0x3e0237['options'][_0xbd18('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e0237[_0xbd18('0x1d')]?_0x3e0237[_0xbd18('0x1d')]['where']||null:null,'attributes':_0x3e0237[_0xbd18('0x1d')]?_0x3e0237[_0xbd18('0x1d')][_0xbd18('0x1f')]||null:null,'limit':_0x3e0237['options']?_0x3e0237[_0xbd18('0x1d')][_0xbd18('0x20')]||null:null})[_0xbd18('0xf')](function(_0x256c2e){logger[_0xbd18('0x10')](_0xbd18('0x1a'),_0x3e0237);logger[_0xbd18('0x13')](_0xbd18('0x1a'),_0x3e0237,JSON['stringify'](_0x256c2e));_0x91f00d(_0x256c2e);})[_0xbd18('0x19')](function(_0x1ae304){logger[_0xbd18('0x15')](_0xbd18('0x1a'),_0x1ae304[_0xbd18('0x17')],_0x3e0237);_0x32edd5(_0x1bca3c['error'](0x1f4,_0x1ae304[_0xbd18('0x17')]));});});};exports['AddTagsToChatInteraction']=function(_0x5b2eed){return new Promise(function(_0x556422,_0xa72234){return db[_0xbd18('0x1b')]['find']({'where':_0x5b2eed['options']?_0x5b2eed[_0xbd18('0x1d')][_0xbd18('0x21')]||null:null})[_0xbd18('0xf')](function(_0x514f4e){if(_0x514f4e){return _0x514f4e[_0xbd18('0x22')](_0x5b2eed[_0xbd18('0x23')][_0xbd18('0x24')],_[_0xbd18('0x25')](_0x5b2eed['body'],[_0xbd18('0x24'),'id'])||{});}})[_0xbd18('0x26')](function(_0x45ff4e){logger[_0xbd18('0x10')](_0xbd18('0x27'),_0x5b2eed);logger['debug'](_0xbd18('0x27'),_0x5b2eed,JSON['stringify'](_0x45ff4e));_0x556422(_0x45ff4e);})['catch'](function(_0x542c9d){logger[_0xbd18('0x15')](_0xbd18('0x27'),_0x542c9d[_0xbd18('0x17')],_0x5b2eed);_0xa72234(_this[_0xbd18('0x15')](0x1f4,_0x542c9d[_0xbd18('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index d47db91..02fbe04 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 _0x39bf=['register','chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x39bf,0x152));var _0xf39b=function(_0xf1f8d4,_0x28b8b0){_0xf1f8d4=_0xf1f8d4-0x0;var _0x17b287=_0x39bf[_0xf1f8d4];return _0x17b287;};'use strict';var ChatInteractionEvents=require(_0xf39b('0x0'));var events=[_0xf39b('0x1'),_0xf39b('0x2'),_0xf39b('0x3')];function createListener(_0x1b8f7d,_0x3d3fdc){return function(_0x1b2b0f){_0x3d3fdc[_0xf39b('0x4')](_0x1b8f7d,_0x1b2b0f);};}function removeListener(_0x1d22e1,_0x16edb3){return function(){ChatInteractionEvents[_0xf39b('0x5')](_0x1d22e1,_0x16edb3);};}exports[_0xf39b('0x6')]=function(_0x2e36b5){for(var _0xe171f0=0x0,_0xe7a16a=events['length'];_0xe171f0<_0xe7a16a;_0xe171f0++){var _0x42a16e=events[_0xe171f0];var _0x355efa=createListener(_0xf39b('0x7')+_0x42a16e,_0x2e36b5);ChatInteractionEvents['on'](_0x42a16e,_0x355efa);}}; \ No newline at end of file +var _0xac22=['emit','removeListener','register','chatInteraction:','save','remove','update'];(function(_0x27bcf5,_0x236765){var _0x4ce4cf=function(_0x4864ea){while(--_0x4864ea){_0x27bcf5['push'](_0x27bcf5['shift']());}};_0x4ce4cf(++_0x236765);}(_0xac22,0x138));var _0x2ac2=function(_0x310496,_0x485385){_0x310496=_0x310496-0x0;var _0x4fa329=_0xac22[_0x310496];return _0x4fa329;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x2ac2('0x0'),_0x2ac2('0x1'),_0x2ac2('0x2')];function createListener(_0x172308,_0x91c5ce){return function(_0x156423){_0x91c5ce[_0x2ac2('0x3')](_0x172308,_0x156423);};}function removeListener(_0x569df4,_0x37ea79){return function(){ChatInteractionEvents[_0x2ac2('0x4')](_0x569df4,_0x37ea79);};}exports[_0x2ac2('0x5')]=function(_0x54943c){for(var _0xd807b2=0x0,_0x210138=events['length'];_0xd807b2<_0x210138;_0xd807b2++){var _0x253f97=events[_0xd807b2];var _0x9bfab1=createListener(_0x2ac2('0x6')+_0x253f97,_0x54943c);ChatInteractionEvents['on'](_0x253f97,_0x9bfab1);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index cd17b31..3a849b2 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 _0x4c82=['download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','originalname','replace','/:id/attachment_upload','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','update','put','customUpdate','/:id/abandon','/:id/close','close','delete','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','/:id/download'];(function(_0x4b2b2c,_0x17cbcc){var _0x47c263=function(_0x42afd7){while(--_0x42afd7){_0x4b2b2c['push'](_0x4b2b2c['shift']());}};_0x47c263(++_0x17cbcc);}(_0x4c82,0x127));var _0x24c8=function(_0x1fbde3,_0x59da39){_0x1fbde3=_0x1fbde3-0x0;var _0x2b092f=_0x4c82[_0x1fbde3];return _0x2b092f;};'use strict';var multer=require('multer');var util=require(_0x24c8('0x0'));var path=require(_0x24c8('0x1'));var timeout=require(_0x24c8('0x2'));var express=require(_0x24c8('0x3'));var router=express[_0x24c8('0x4')]();var fs_extra=require(_0x24c8('0x5'));var auth=require(_0x24c8('0x6'));var interaction=require(_0x24c8('0x7'));var config=require(_0x24c8('0x8'));var controller=require(_0x24c8('0x9'));router[_0x24c8('0xa')]('/',auth['isAuthenticated'](),controller[_0x24c8('0xb')]);router[_0x24c8('0xa')](_0x24c8('0xc'),auth[_0x24c8('0xd')](),controller[_0x24c8('0xe')]);router[_0x24c8('0xa')](_0x24c8('0xf'),auth[_0x24c8('0x10')](),controller[_0x24c8('0x11')]);router[_0x24c8('0xa')](_0x24c8('0x12'),auth[_0x24c8('0x10')](),controller[_0x24c8('0x13')]);router[_0x24c8('0xa')](_0x24c8('0x14'),auth[_0x24c8('0xd')](),controller['getMessages']);router[_0x24c8('0xa')](_0x24c8('0x15'),auth[_0x24c8('0x10')](),controller['getMyMessages']);router[_0x24c8('0xa')](_0x24c8('0x16'),auth[_0x24c8('0xd')](),controller[_0x24c8('0x17')]);router[_0x24c8('0x18')]('/',auth[_0x24c8('0xd')](),controller[_0x24c8('0x19')]);router[_0x24c8('0x18')](_0x24c8('0x1a'),auth[_0x24c8('0xd')](),controller[_0x24c8('0x1b')]);var upload=multer({'storage':multer[_0x24c8('0x1c')]({'destination':function(_0x543a8b,_0xa2c60d,_0x761274){_0x761274(null,path[_0x24c8('0x1d')](config[_0x24c8('0x1e')],_0x24c8('0x1f')));},'filename':function(_0x20401e,_0x50be7c,_0x276025){_0x276025(null,util[_0x24c8('0x20')]('%s-%s',Date['now'](),_0x50be7c[_0x24c8('0x21')][_0x24c8('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x24c8('0x18')](_0x24c8('0x23'),upload['single'](_0x24c8('0x24')),controller[_0x24c8('0x25')]);router['post'](_0x24c8('0x14'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router['post'](_0x24c8('0x26'),auth['isAuthenticated'](),interaction[_0x24c8('0x27')](_0x24c8('0x28'),_0x24c8('0x29')),controller[_0x24c8('0x2a')]);router['put'](_0x24c8('0xf'),auth[_0x24c8('0xd')](),interaction[_0x24c8('0x27')](_0x24c8('0x28'),'chatinteraction:update'),controller[_0x24c8('0x2b')]);router[_0x24c8('0x2c')]('/:id/custom_update',controller[_0x24c8('0x2d')]);router['put'](_0x24c8('0x2e'),auth[_0x24c8('0x10')](),controller['abandon']);router[_0x24c8('0x2c')](_0x24c8('0x2f'),controller[_0x24c8('0x30')]);router[_0x24c8('0x31')](_0x24c8('0xf'),auth[_0x24c8('0xd')](),interaction[_0x24c8('0x27')](_0x24c8('0x28'),'chatinteraction:destroy'),controller[_0x24c8('0x32')]);router['delete'](_0x24c8('0x26'),auth[_0x24c8('0xd')](),controller[_0x24c8('0x33')]);module[_0x24c8('0x34')]=router; \ No newline at end of file +var _0x58be=['isChatInteractionAuthorized','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','create','post','createVidaooSession','root','replace','single','file','attachmentUpload','/:id/tags','chat','chatinteraction:addtags','tracked','chatinteraction:update','update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','delete','chatinteraction:destroy','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','index','isAuthenticated','/:id'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x58be,0x1c1));var _0xe58b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x58be[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xe58b('0x0'));var path=require(_0xe58b('0x1'));var timeout=require(_0xe58b('0x2'));var express=require(_0xe58b('0x3'));var router=express[_0xe58b('0x4')]();var fs_extra=require(_0xe58b('0x5'));var auth=require(_0xe58b('0x6'));var interaction=require(_0xe58b('0x7'));var config=require('../../config/environment');var controller=require(_0xe58b('0x8'));router[_0xe58b('0x9')]('/',auth['isAuthenticated'](),controller[_0xe58b('0xa')]);router[_0xe58b('0x9')]('/describe',auth[_0xe58b('0xb')](),controller['describe']);router[_0xe58b('0x9')](_0xe58b('0xc'),auth[_0xe58b('0xd')](),controller['show']);router[_0xe58b('0x9')]('/:id/attachment_download',auth[_0xe58b('0xd')](),controller['attachmentDownload']);router[_0xe58b('0x9')](_0xe58b('0xe'),auth[_0xe58b('0xb')](),controller[_0xe58b('0xf')]);router[_0xe58b('0x9')](_0xe58b('0x10'),auth[_0xe58b('0xd')](),controller[_0xe58b('0x11')]);router[_0xe58b('0x9')]('/:id/download',auth[_0xe58b('0xb')](),controller[_0xe58b('0x12')]);router['post']('/',auth[_0xe58b('0xb')](),controller[_0xe58b('0x13')]);router[_0xe58b('0x14')]('/:id/vidaoo',auth[_0xe58b('0xb')](),controller[_0xe58b('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x800e24,_0x28c2a4,_0x507584){_0x507584(null,path['join'](config[_0xe58b('0x16')],'server/files/attachments/'));},'filename':function(_0x59c4f0,_0x2c1ade,_0x318e30){_0x318e30(null,util['format']('%s-%s',Date['now'](),_0x2c1ade['originalname'][_0xe58b('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe58b('0x14')]('/:id/attachment_upload',upload[_0xe58b('0x18')](_0xe58b('0x19')),controller[_0xe58b('0x1a')]);router[_0xe58b('0x14')](_0xe58b('0xe'),auth[_0xe58b('0xd')](),controller['addMessage']);router[_0xe58b('0x14')](_0xe58b('0x1b'),auth[_0xe58b('0xb')](),interaction['tracked'](_0xe58b('0x1c'),_0xe58b('0x1d')),controller['addTags']);router['put'](_0xe58b('0xc'),auth[_0xe58b('0xb')](),interaction[_0xe58b('0x1e')](_0xe58b('0x1c'),_0xe58b('0x1f')),controller[_0xe58b('0x20')]);router[_0xe58b('0x21')](_0xe58b('0x22'),controller[_0xe58b('0x23')]);router[_0xe58b('0x21')](_0xe58b('0x24'),auth[_0xe58b('0xd')](),controller[_0xe58b('0x25')]);router['put']('/:id/close',controller[_0xe58b('0x26')]);router[_0xe58b('0x27')](_0xe58b('0xc'),auth['isAuthenticated'](),interaction[_0xe58b('0x1e')](_0xe58b('0x1c'),_0xe58b('0x28')),controller['destroy']);router['delete'](_0xe58b('0x1b'),auth['isAuthenticated'](),controller[_0xe58b('0x29')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 87601be..fd25d71 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 _0x9d43=['sequelize','exports','medium','BOOLEAN'];(function(_0x420295,_0x43a6d1){var _0x4a7d19=function(_0x375e74){while(--_0x375e74){_0x420295['push'](_0x420295['shift']());}};_0x4a7d19(++_0x43a6d1);}(_0x9d43,0x1d4));var _0x39d4=function(_0x227719,_0x89d7b0){_0x227719=_0x227719-0x0;var _0x17b62a=_0x9d43[_0x227719];return _0x17b62a;};'use strict';var Sequelize=require(_0x39d4('0x0'));module[_0x39d4('0x1')]={'body':{'type':Sequelize['TEXT'](_0x39d4('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x39d4('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xac1a=['TEXT','BOOLEAN','INTEGER','exports'];(function(_0x51b1f3,_0x21028b){var _0x1e53fd=function(_0x44477d){while(--_0x44477d){_0x51b1f3['push'](_0x51b1f3['shift']());}};_0x1e53fd(++_0x21028b);}(_0xac1a,0x1cf));var _0xaac1=function(_0x564363,_0x4039eb){_0x564363=_0x564363-0x0;var _0x240635=_0xac1a[_0x564363];return _0x240635;};'use strict';var Sequelize=require('sequelize');module[_0xaac1('0x0')]={'body':{'type':Sequelize[_0xaac1('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xaac1('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xaac1('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 108e26c..43925fd 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 _0x9bcc=['rows','catch','show','params','keys','find','body','get','messages','createdAt','lastMessage','format','getUsers','user','fullname','role','userpic','allowmessenger','showWebBar','-online','VoiceQueue','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll'];(function(_0x335a61,_0x21b879){var _0x48a02b=function(_0x2978a8){while(--_0x2978a8){_0x335a61['push'](_0x335a61['shift']());}};_0x48a02b(++_0x21b879);}(_0x9bcc,0x16d));var _0xc9bc=function(_0x251820,_0x38a118){_0x251820=_0x251820-0x0;var _0x4732b3=_0x9bcc[_0x251820];return _0x4732b3;};'use strict';var emlformat=require(_0xc9bc('0x0'));var rimraf=require(_0xc9bc('0x1'));var zipdir=require(_0xc9bc('0x2'));var jsonpatch=require(_0xc9bc('0x3'));var rp=require('request-promise');var moment=require(_0xc9bc('0x4'));var BPromise=require(_0xc9bc('0x5'));var Mustache=require(_0xc9bc('0x6'));var util=require(_0xc9bc('0x7'));var path=require('path');var sox=require(_0xc9bc('0x8'));var csv=require(_0xc9bc('0x9'));var ejs=require(_0xc9bc('0xa'));var fs=require('fs');var fs_extra=require(_0xc9bc('0xb'));var _=require(_0xc9bc('0xc'));var squel=require(_0xc9bc('0xd'));var crypto=require(_0xc9bc('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc9bc('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc9bc('0xf'));var authService=require(_0xc9bc('0x10'));var qs=require(_0xc9bc('0x11'));var as=require(_0xc9bc('0x12'));var hardwareService=require(_0xc9bc('0x13'));var logger=require(_0xc9bc('0x14'))(_0xc9bc('0x15'));var utils=require('../../config/utils');var config=require(_0xc9bc('0x16'));var licenseUtil=require(_0xc9bc('0x17'));var db=require(_0xc9bc('0x18'))['db'];config[_0xc9bc('0x19')]=_[_0xc9bc('0x1a')](config['redis'],{'host':_0xc9bc('0x1b'),'port':0x18eb});var socket=require(_0xc9bc('0x1c'))(new Redis(config['redis']));require(_0xc9bc('0x1d'))['register'](socket);function respondWithStatusCode(_0x4de18e,_0x546b44){_0x546b44=_0x546b44||0xcc;return function(_0x1970ab){if(_0x1970ab){return _0x4de18e[_0xc9bc('0x1e')](_0x546b44);}return _0x4de18e[_0xc9bc('0x1f')](_0x546b44)[_0xc9bc('0x20')]();};}function respondWithResult(_0x30a8bc,_0x5828e9){_0x5828e9=_0x5828e9||0xc8;return function(_0x13025d){if(_0x13025d){return _0x30a8bc[_0xc9bc('0x1f')](_0x5828e9)[_0xc9bc('0x21')](_0x13025d);}};}function respondWithFilteredResult(_0x132433,_0x4096fe){return function(_0x334aba){if(_0x334aba){var _0x5a3730=typeof _0x4096fe[_0xc9bc('0x22')]===_0xc9bc('0x23')&&typeof _0x4096fe[_0xc9bc('0x24')]===_0xc9bc('0x23');var _0x38b419=_0x334aba[_0xc9bc('0x25')];var _0x12af72=_0x5a3730?0x0:_0x4096fe['offset'];var _0x5cb169=_0x5a3730?_0x334aba[_0xc9bc('0x25')]:_0x4096fe[_0xc9bc('0x22')]+_0x4096fe[_0xc9bc('0x24')];var _0x4e1048;if(_0x5cb169>=_0x38b419){_0x5cb169=_0x38b419;_0x4e1048=0xc8;}else{_0x4e1048=0xce;}_0x132433[_0xc9bc('0x1f')](_0x4e1048);return _0x132433[_0xc9bc('0x26')](_0xc9bc('0x27'),_0x12af72+'-'+_0x5cb169+'/'+_0x38b419)[_0xc9bc('0x21')](_0x334aba);}return null;};}function patchUpdates(_0x12a010){return function(_0x5c3dfc){try{jsonpatch[_0xc9bc('0x28')](_0x5c3dfc,_0x12a010,!![]);}catch(_0x246756){return BPromise[_0xc9bc('0x29')](_0x246756);}return _0x5c3dfc[_0xc9bc('0x2a')]();};}function saveUpdates(_0x503b0e,_0x43106f){return function(_0x4e4ad0){if(_0x4e4ad0){return _0x4e4ad0[_0xc9bc('0x2b')](_0x503b0e)[_0xc9bc('0x2c')](function(_0x3b4e38){return _0x3b4e38;});}return null;};}function removeEntity(_0x547ea4,_0x2a4bf4){return function(_0x106c14){if(_0x106c14){return _0x106c14[_0xc9bc('0x2d')]()[_0xc9bc('0x2c')](function(){_0x547ea4[_0xc9bc('0x1f')](0xcc)[_0xc9bc('0x20')]();});}};}function handleEntityNotFound(_0x5afce7,_0x5d5a06){return function(_0x145a62){if(!_0x145a62){_0x5afce7['sendStatus'](0x194);}return _0x145a62;};}function handleError(_0x733fe1,_0x432c7f){_0x432c7f=_0x432c7f||0x1f4;return function(_0x197094){logger[_0xc9bc('0x2e')](_0x197094[_0xc9bc('0x2f')]);if(_0x197094[_0xc9bc('0x30')]){delete _0x197094['name'];}_0x733fe1[_0xc9bc('0x1f')](_0x432c7f)[_0xc9bc('0x31')](_0x197094);};}exports[_0xc9bc('0x32')]=function(_0x3b0390,_0x6055f4){var _0x233757={},_0x46f6c9={},_0x3a0096={'count':0x0,'rows':[]};var _0xe1a0a5=_['map'](db[_0xc9bc('0x33')][_0xc9bc('0x34')],function(_0xfd6572){return{'name':_0xfd6572[_0xc9bc('0x35')],'type':_0xfd6572[_0xc9bc('0x36')][_0xc9bc('0x37')]};});_0x46f6c9[_0xc9bc('0x38')]=_['map'](_0xe1a0a5,'name');_0x46f6c9[_0xc9bc('0x39')]=_['keys'](_0x3b0390[_0xc9bc('0x39')]);_0x46f6c9[_0xc9bc('0x3a')]=_[_0xc9bc('0x3b')](_0x46f6c9[_0xc9bc('0x38')],_0x46f6c9[_0xc9bc('0x39')]);_0x233757[_0xc9bc('0x3c')]=_[_0xc9bc('0x3b')](_0x46f6c9[_0xc9bc('0x38')],qs['fields'](_0x3b0390[_0xc9bc('0x39')][_0xc9bc('0x3d')]));_0x233757['attributes']=_0x233757[_0xc9bc('0x3c')][_0xc9bc('0x3e')]?_0x233757['attributes']:_0x46f6c9[_0xc9bc('0x38')];if(!_0x3b0390[_0xc9bc('0x39')][_0xc9bc('0x3f')]('nolimit')){_0x233757[_0xc9bc('0x24')]=qs[_0xc9bc('0x24')](_0x3b0390[_0xc9bc('0x39')][_0xc9bc('0x24')]);_0x233757[_0xc9bc('0x22')]=qs[_0xc9bc('0x22')](_0x3b0390[_0xc9bc('0x39')][_0xc9bc('0x22')]);}_0x233757[_0xc9bc('0x40')]=qs[_0xc9bc('0x41')](_0x3b0390[_0xc9bc('0x39')][_0xc9bc('0x41')]);_0x233757[_0xc9bc('0x42')]=qs['filters'](_[_0xc9bc('0x43')](_0x3b0390[_0xc9bc('0x39')],_0x46f6c9['filters']),_0xe1a0a5);if(_0x3b0390[_0xc9bc('0x39')][_0xc9bc('0x44')]){_0x233757[_0xc9bc('0x42')]=_[_0xc9bc('0x45')](_0x233757[_0xc9bc('0x42')],{'$or':_[_0xc9bc('0x46')](_0xe1a0a5,function(_0x9d1d02){if(_0x9d1d02['type']!=='VIRTUAL'){var _0x2980f7={};_0x2980f7[_0x9d1d02['name']]={'$like':'%'+_0x3b0390[_0xc9bc('0x39')][_0xc9bc('0x44')]+'%'};return _0x2980f7;}})});}_0x233757=_[_0xc9bc('0x45')]({},_0x233757,_0x3b0390[_0xc9bc('0x47')]);var _0xf452ca={'where':_0x233757[_0xc9bc('0x42')]};return db['ChatInternalMessage']['count'](_0xf452ca)['then'](function(_0x346321){_0x3a0096[_0xc9bc('0x25')]=_0x346321;if(_0x3b0390[_0xc9bc('0x39')][_0xc9bc('0x48')]){_0x233757[_0xc9bc('0x49')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xc9bc('0x4a')](_0x233757);})[_0xc9bc('0x2c')](function(_0x16689e){_0x3a0096[_0xc9bc('0x4b')]=_0x16689e;return _0x3a0096;})[_0xc9bc('0x2c')](respondWithFilteredResult(_0x6055f4,_0x233757))[_0xc9bc('0x4c')](handleError(_0x6055f4,null));};exports[_0xc9bc('0x4d')]=function(_0x5b795b,_0x56ac01){var _0x5e83a6={'raw':!![],'where':{'id':_0x5b795b[_0xc9bc('0x4e')]['id']}},_0x474570={};_0x474570[_0xc9bc('0x38')]=_[_0xc9bc('0x4f')](db['ChatInternalMessage'][_0xc9bc('0x34')]);_0x474570['query']=_[_0xc9bc('0x4f')](_0x5b795b[_0xc9bc('0x39')]);_0x474570[_0xc9bc('0x3a')]=_['intersection'](_0x474570[_0xc9bc('0x38')],_0x474570['query']);_0x5e83a6[_0xc9bc('0x3c')]=_[_0xc9bc('0x3b')](_0x474570[_0xc9bc('0x38')],qs['fields'](_0x5b795b['query']['fields']));_0x5e83a6[_0xc9bc('0x3c')]=_0x5e83a6[_0xc9bc('0x3c')]['length']?_0x5e83a6['attributes']:_0x474570[_0xc9bc('0x38')];if(_0x5b795b[_0xc9bc('0x39')][_0xc9bc('0x48')]){_0x5e83a6[_0xc9bc('0x49')]=[{'all':!![]}];}_0x5e83a6=_[_0xc9bc('0x45')]({},_0x5e83a6,_0x5b795b[_0xc9bc('0x47')]);return db[_0xc9bc('0x33')][_0xc9bc('0x50')](_0x5e83a6)[_0xc9bc('0x2c')](handleEntityNotFound(_0x56ac01,null))[_0xc9bc('0x2c')](respondWithResult(_0x56ac01,null))[_0xc9bc('0x4c')](handleError(_0x56ac01,null));};exports['create']=function(_0x1f60ef,_0x5e24e5){return db[_0xc9bc('0x33')]['create'](_0x1f60ef['body'],{})[_0xc9bc('0x2c')](respondWithResult(_0x5e24e5,0xc9))[_0xc9bc('0x4c')](handleError(_0x5e24e5,null));};exports['update']=function(_0x510152,_0x45c274){if(_0x510152[_0xc9bc('0x51')]['id']){delete _0x510152['body']['id'];}return db[_0xc9bc('0x33')][_0xc9bc('0x50')]({'where':{'id':_0x510152['params']['id']}})[_0xc9bc('0x2c')](handleEntityNotFound(_0x45c274,null))[_0xc9bc('0x2c')](saveUpdates(_0x510152['body'],null))[_0xc9bc('0x2c')](respondWithResult(_0x45c274,null))[_0xc9bc('0x4c')](handleError(_0x45c274,null));};exports[_0xc9bc('0x2d')]=function(_0x404015,_0x3d2d07){return db[_0xc9bc('0x33')][_0xc9bc('0x50')]({'where':{'id':_0x404015[_0xc9bc('0x4e')]['id']}})[_0xc9bc('0x2c')](handleEntityNotFound(_0x3d2d07,null))[_0xc9bc('0x2c')](removeEntity(_0x3d2d07,null))[_0xc9bc('0x4c')](handleError(_0x3d2d07,null));};exports['describe']=function(_0x54ce0b,_0x5a0c47){return db[_0xc9bc('0x33')]['describe']()['then'](respondWithResult(_0x5a0c47,null))[_0xc9bc('0x4c')](handleError(_0x5a0c47,null));};function wrapUser(_0xebc9e2){return function(_0x508f06){var _0x3b6b70=_0xebc9e2[_0xc9bc('0x52')]({'plain':!![]});_0x3b6b70[_0xc9bc('0x53')]=[];if(_0x508f06){_0x3b6b70['lastMessageAt']=_0x508f06[_0xc9bc('0x54')];_0x3b6b70[_0xc9bc('0x55')]=_0x508f06;}else{_0x3b6b70['lastMessageAt']=moment(0x0)[_0xc9bc('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b6b70[_0xc9bc('0x55')]={};}return _0x3b6b70;};}exports[_0xc9bc('0x57')]=function(_0x189b11,_0x1292af,_0x4e2e78){var _0x61a527=[];return db['User']['findAll']({'where':{'role':['agent','admin',_0xc9bc('0x58')]},'attributes':['id',_0xc9bc('0x59'),_0xc9bc('0x30'),_0xc9bc('0x5a'),_0xc9bc('0x5b'),'internal','online','lastLoginAt',_0xc9bc('0x5c'),_0xc9bc('0x5d')],'order':qs[_0xc9bc('0x41')](_0xc9bc('0x5e')),'include':[{'model':db[_0xc9bc('0x5f')],'as':'VoiceQueues','attributes':['id',_0xc9bc('0x30'),_0xc9bc('0x36')],'through':{'attributes':[]}}]})[_0xc9bc('0x2c')](function(_0x294ce8){if(_0x294ce8){var _0x95a557=_0x189b11[_0xc9bc('0x58')][_0xc9bc('0x52')]({'plain':!![]});if(!_0x95a557)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x95a557['role']===_0xc9bc('0x58')){return db[_0xc9bc('0x60')][_0xc9bc('0x50')]({'where':{'name':_0xc9bc('0x61'),'userProfileId':_0x95a557[_0xc9bc('0x62')]},'raw':!![]})[_0xc9bc('0x2c')](function(_0x2a4a85){if(_0x2a4a85){if(_0x2a4a85[_0xc9bc('0x63')]===0x0){return db[_0xc9bc('0x64')]['findAll']({'where':{'sectionId':_0x2a4a85['id']},'raw':!![]})['then'](function(_0x54d7e7){var _0x114644=[];if(_[_0xc9bc('0x65')](_0x54d7e7)){_0x114644=_[_0xc9bc('0x44')](_0x294ce8,function(_0x40658f){if(_0x40658f[_0xc9bc('0x5a')]!==_0xc9bc('0x66')){return _0x40658f;}});return _0x114644;}else{for(var _0xe21f24=0x0;_0xe21f24<_0x294ce8[_0xc9bc('0x3e')];_0xe21f24++){var _0x1a48b8=_0x294ce8[_0xe21f24];if(_0x1a48b8[_0xc9bc('0x5a')]==='agent'){var _0x3506c2=_['find'](_0x54d7e7,function(_0x4e7ce6){return _0x4e7ce6[_0xc9bc('0x67')]===_0x1a48b8['id'];});if(_0x3506c2)_0x114644['push'](_0x1a48b8);}else{_0x114644['push'](_0x1a48b8);}}return _0x114644;}});}else{return _0x294ce8;}}else{var _0x5d0f20=_['filter'](_0x294ce8,function(_0xb0c658){if(_0xb0c658[_0xc9bc('0x5a')]!==_0xc9bc('0x66')){return _0xb0c658;}});return _0x5d0f20;}});}else{return _0x294ce8;}}})['then'](function(_0x8e7a19){var _0x2dffda=[];if(_0x8e7a19){_0x61a527=_0x8e7a19;for(var _0x468ba7=0x0;_0x468ba7<_0x8e7a19[_0xc9bc('0x3e')];_0x468ba7+=0x1){_0x61a527[_0x468ba7][_0xc9bc('0x53')]=[];_0x2dffda[_0xc9bc('0x68')](db['ChatInternalMessage'][_0xc9bc('0x50')]({'where':{'FromId':[_0x189b11[_0xc9bc('0x58')]['id'],_0x8e7a19[_0x468ba7]['id']],'ToId':[_0x189b11[_0xc9bc('0x58')]['id'],_0x8e7a19[_0x468ba7]['id']],'ChatGroupId':null},'attributes':['id',_0xc9bc('0x54'),_0xc9bc('0x69'),_0xc9bc('0x6a'),_0xc9bc('0x6b'),'body'],'order':qs[_0xc9bc('0x41')](_0xc9bc('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x8e7a19[_0x468ba7])));}return BPromise[_0xc9bc('0x6d')](_0x2dffda);}return[];})['then'](function(_0x3ea137){return{'rows':_0x3ea137,'count':_0x3ea137[_0xc9bc('0x3e')]};})[_0xc9bc('0x2c')](respondWithResult(_0x1292af,null))[_0xc9bc('0x4c')](handleError(_0x1292af,null));}; \ No newline at end of file +var _0xd5ff=['messages','read','all','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','name','send','index','ChatInternalMessage','rawAttributes','fieldName','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','catch','show','params','keys','filters','intersection','includeAll','create','body','find','describe','get','lastMessageAt','createdAt','lastMessage','format','getUsers','User','agent','user','fullname','role','userpic','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push'];(function(_0x2a4095,_0x13f4f0){var _0x52eeab=function(_0x3950dd){while(--_0x3950dd){_0x2a4095['push'](_0x2a4095['shift']());}};_0x52eeab(++_0x13f4f0);}(_0xd5ff,0x197));var _0xfd5f=function(_0xe5d2d5,_0x33602d){_0xe5d2d5=_0xe5d2d5-0x0;var _0x557ede=_0xd5ff[_0xe5d2d5];return _0x557ede;};'use strict';var emlformat=require(_0xfd5f('0x0'));var rimraf=require(_0xfd5f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd5f('0x2'));var rp=require(_0xfd5f('0x3'));var moment=require(_0xfd5f('0x4'));var BPromise=require(_0xfd5f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfd5f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfd5f('0x7'));var _=require(_0xfd5f('0x8'));var squel=require(_0xfd5f('0x9'));var crypto=require(_0xfd5f('0xa'));var jsforce=require(_0xfd5f('0xb'));var deskjs=require(_0xfd5f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfd5f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfd5f('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd5f('0xf'))('api');var utils=require(_0xfd5f('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xfd5f('0x11'));var db=require(_0xfd5f('0x12'))['db'];config['redis']=_[_0xfd5f('0x13')](config['redis'],{'host':_0xfd5f('0x14'),'port':0x18eb});var socket=require(_0xfd5f('0x15'))(new Redis(config[_0xfd5f('0x16')]));require(_0xfd5f('0x17'))[_0xfd5f('0x18')](socket);function respondWithStatusCode(_0x1fbb45,_0x1477c9){_0x1477c9=_0x1477c9||0xcc;return function(_0x181271){if(_0x181271){return _0x1fbb45[_0xfd5f('0x19')](_0x1477c9);}return _0x1fbb45[_0xfd5f('0x1a')](_0x1477c9)[_0xfd5f('0x1b')]();};}function respondWithResult(_0x5be8a1,_0x3a805c){_0x3a805c=_0x3a805c||0xc8;return function(_0x1eea7f){if(_0x1eea7f){return _0x5be8a1[_0xfd5f('0x1a')](_0x3a805c)[_0xfd5f('0x1c')](_0x1eea7f);}};}function respondWithFilteredResult(_0x30fc2f,_0xe8ec69){return function(_0x38a80f){if(_0x38a80f){var _0x44a115=typeof _0xe8ec69[_0xfd5f('0x1d')]===_0xfd5f('0x1e')&&typeof _0xe8ec69[_0xfd5f('0x1f')]===_0xfd5f('0x1e');var _0x4a7bbf=_0x38a80f[_0xfd5f('0x20')];var _0x1a83de=_0x44a115?0x0:_0xe8ec69['offset'];var _0x4047cd=_0x44a115?_0x38a80f[_0xfd5f('0x20')]:_0xe8ec69[_0xfd5f('0x1d')]+_0xe8ec69['limit'];var _0x29de15;if(_0x4047cd>=_0x4a7bbf){_0x4047cd=_0x4a7bbf;_0x29de15=0xc8;}else{_0x29de15=0xce;}_0x30fc2f[_0xfd5f('0x1a')](_0x29de15);return _0x30fc2f[_0xfd5f('0x21')](_0xfd5f('0x22'),_0x1a83de+'-'+_0x4047cd+'/'+_0x4a7bbf)[_0xfd5f('0x1c')](_0x38a80f);}return null;};}function patchUpdates(_0x2414a6){return function(_0x3636ee){try{jsonpatch['apply'](_0x3636ee,_0x2414a6,!![]);}catch(_0x395ca5){return BPromise[_0xfd5f('0x23')](_0x395ca5);}return _0x3636ee['save']();};}function saveUpdates(_0x5151de,_0x187dca){return function(_0x1c2327){if(_0x1c2327){return _0x1c2327['update'](_0x5151de)[_0xfd5f('0x24')](function(_0x4e3d98){return _0x4e3d98;});}return null;};}function removeEntity(_0x32f236,_0x5dfdaf){return function(_0x263888){if(_0x263888){return _0x263888[_0xfd5f('0x25')]()[_0xfd5f('0x24')](function(){_0x32f236[_0xfd5f('0x1a')](0xcc)[_0xfd5f('0x1b')]();});}};}function handleEntityNotFound(_0x399d07,_0x43941a){return function(_0x314cc6){if(!_0x314cc6){_0x399d07[_0xfd5f('0x19')](0x194);}return _0x314cc6;};}function handleError(_0x411bd4,_0x2f49c3){_0x2f49c3=_0x2f49c3||0x1f4;return function(_0x25c17a){logger[_0xfd5f('0x26')](_0x25c17a['stack']);if(_0x25c17a[_0xfd5f('0x27')]){delete _0x25c17a['name'];}_0x411bd4[_0xfd5f('0x1a')](_0x2f49c3)[_0xfd5f('0x28')](_0x25c17a);};}exports[_0xfd5f('0x29')]=function(_0x30552a,_0x49b1c7){var _0x423b10={},_0x5bbc78={},_0x264a36={'count':0x0,'rows':[]};var _0x17b611=_['map'](db[_0xfd5f('0x2a')][_0xfd5f('0x2b')],function(_0x511f8b){return{'name':_0x511f8b[_0xfd5f('0x2c')],'type':_0x511f8b['type'][_0xfd5f('0x2d')]};});_0x5bbc78[_0xfd5f('0x2e')]=_['map'](_0x17b611,_0xfd5f('0x27'));_0x5bbc78[_0xfd5f('0x2f')]=_['keys'](_0x30552a[_0xfd5f('0x2f')]);_0x5bbc78['filters']=_['intersection'](_0x5bbc78[_0xfd5f('0x2e')],_0x5bbc78[_0xfd5f('0x2f')]);_0x423b10[_0xfd5f('0x30')]=_['intersection'](_0x5bbc78['model'],qs[_0xfd5f('0x31')](_0x30552a['query'][_0xfd5f('0x31')]));_0x423b10[_0xfd5f('0x30')]=_0x423b10['attributes'][_0xfd5f('0x32')]?_0x423b10[_0xfd5f('0x30')]:_0x5bbc78[_0xfd5f('0x2e')];if(!_0x30552a[_0xfd5f('0x2f')][_0xfd5f('0x33')]('nolimit')){_0x423b10['limit']=qs[_0xfd5f('0x1f')](_0x30552a[_0xfd5f('0x2f')][_0xfd5f('0x1f')]);_0x423b10[_0xfd5f('0x1d')]=qs['offset'](_0x30552a['query'][_0xfd5f('0x1d')]);}_0x423b10[_0xfd5f('0x34')]=qs[_0xfd5f('0x35')](_0x30552a[_0xfd5f('0x2f')]['sort']);_0x423b10[_0xfd5f('0x36')]=qs['filters'](_[_0xfd5f('0x37')](_0x30552a[_0xfd5f('0x2f')],_0x5bbc78['filters']),_0x17b611);if(_0x30552a[_0xfd5f('0x2f')]['filter']){_0x423b10['where']=_[_0xfd5f('0x38')](_0x423b10[_0xfd5f('0x36')],{'$or':_['map'](_0x17b611,function(_0x2ddbbd){if(_0x2ddbbd[_0xfd5f('0x39')]!==_0xfd5f('0x3a')){var _0x453006={};_0x453006[_0x2ddbbd[_0xfd5f('0x27')]]={'$like':'%'+_0x30552a[_0xfd5f('0x2f')][_0xfd5f('0x3b')]+'%'};return _0x453006;}})});}_0x423b10=_['merge']({},_0x423b10,_0x30552a[_0xfd5f('0x3c')]);var _0x501f8c={'where':_0x423b10['where']};return db['ChatInternalMessage'][_0xfd5f('0x20')](_0x501f8c)[_0xfd5f('0x24')](function(_0x3f9df2){_0x264a36['count']=_0x3f9df2;if(_0x30552a[_0xfd5f('0x2f')]['includeAll']){_0x423b10[_0xfd5f('0x3d')]=[{'all':!![]}];}return db[_0xfd5f('0x2a')][_0xfd5f('0x3e')](_0x423b10);})[_0xfd5f('0x24')](function(_0x268659){_0x264a36['rows']=_0x268659;return _0x264a36;})['then'](respondWithFilteredResult(_0x49b1c7,_0x423b10))[_0xfd5f('0x3f')](handleError(_0x49b1c7,null));};exports[_0xfd5f('0x40')]=function(_0x4ca580,_0x1742dd){var _0x4f30c8={'raw':!![],'where':{'id':_0x4ca580[_0xfd5f('0x41')]['id']}},_0x5a8548={};_0x5a8548[_0xfd5f('0x2e')]=_[_0xfd5f('0x42')](db['ChatInternalMessage'][_0xfd5f('0x2b')]);_0x5a8548[_0xfd5f('0x2f')]=_[_0xfd5f('0x42')](_0x4ca580[_0xfd5f('0x2f')]);_0x5a8548[_0xfd5f('0x43')]=_['intersection'](_0x5a8548['model'],_0x5a8548[_0xfd5f('0x2f')]);_0x4f30c8[_0xfd5f('0x30')]=_[_0xfd5f('0x44')](_0x5a8548[_0xfd5f('0x2e')],qs[_0xfd5f('0x31')](_0x4ca580[_0xfd5f('0x2f')][_0xfd5f('0x31')]));_0x4f30c8[_0xfd5f('0x30')]=_0x4f30c8[_0xfd5f('0x30')][_0xfd5f('0x32')]?_0x4f30c8[_0xfd5f('0x30')]:_0x5a8548[_0xfd5f('0x2e')];if(_0x4ca580['query'][_0xfd5f('0x45')]){_0x4f30c8[_0xfd5f('0x3d')]=[{'all':!![]}];}_0x4f30c8=_[_0xfd5f('0x38')]({},_0x4f30c8,_0x4ca580[_0xfd5f('0x3c')]);return db[_0xfd5f('0x2a')]['find'](_0x4f30c8)[_0xfd5f('0x24')](handleEntityNotFound(_0x1742dd,null))['then'](respondWithResult(_0x1742dd,null))['catch'](handleError(_0x1742dd,null));};exports[_0xfd5f('0x46')]=function(_0x43cc45,_0x288d6d){return db[_0xfd5f('0x2a')][_0xfd5f('0x46')](_0x43cc45['body'],{})[_0xfd5f('0x24')](respondWithResult(_0x288d6d,0xc9))[_0xfd5f('0x3f')](handleError(_0x288d6d,null));};exports['update']=function(_0x497ec7,_0x5edf51){if(_0x497ec7[_0xfd5f('0x47')]['id']){delete _0x497ec7[_0xfd5f('0x47')]['id'];}return db[_0xfd5f('0x2a')][_0xfd5f('0x48')]({'where':{'id':_0x497ec7[_0xfd5f('0x41')]['id']}})['then'](handleEntityNotFound(_0x5edf51,null))['then'](saveUpdates(_0x497ec7[_0xfd5f('0x47')],null))[_0xfd5f('0x24')](respondWithResult(_0x5edf51,null))[_0xfd5f('0x3f')](handleError(_0x5edf51,null));};exports[_0xfd5f('0x25')]=function(_0x2862e8,_0x4615d9){return db['ChatInternalMessage'][_0xfd5f('0x48')]({'where':{'id':_0x2862e8['params']['id']}})[_0xfd5f('0x24')](handleEntityNotFound(_0x4615d9,null))[_0xfd5f('0x24')](removeEntity(_0x4615d9,null))[_0xfd5f('0x3f')](handleError(_0x4615d9,null));};exports['describe']=function(_0x457eb8,_0x2dc817){return db['ChatInternalMessage'][_0xfd5f('0x49')]()[_0xfd5f('0x24')](respondWithResult(_0x2dc817,null))[_0xfd5f('0x3f')](handleError(_0x2dc817,null));};function wrapUser(_0x19de58){return function(_0x567afa){var _0x480650=_0x19de58[_0xfd5f('0x4a')]({'plain':!![]});_0x480650['messages']=[];if(_0x567afa){_0x480650[_0xfd5f('0x4b')]=_0x567afa[_0xfd5f('0x4c')];_0x480650[_0xfd5f('0x4d')]=_0x567afa;}else{_0x480650[_0xfd5f('0x4b')]=moment(0x0)[_0xfd5f('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x480650['lastMessage']={};}return _0x480650;};}exports[_0xfd5f('0x4f')]=function(_0x56606,_0x21c88c,_0x39ef50){var _0x4a9be5=[];return db[_0xfd5f('0x50')]['findAll']({'where':{'role':[_0xfd5f('0x51'),'admin',_0xfd5f('0x52')]},'attributes':['id',_0xfd5f('0x53'),_0xfd5f('0x27'),_0xfd5f('0x54'),_0xfd5f('0x55'),'internal','online',_0xfd5f('0x56'),_0xfd5f('0x57'),_0xfd5f('0x58')],'order':qs[_0xfd5f('0x35')]('-online'),'include':[{'model':db[_0xfd5f('0x59')],'as':'VoiceQueues','attributes':['id',_0xfd5f('0x27'),_0xfd5f('0x39')],'through':{'attributes':[]}}]})[_0xfd5f('0x24')](function(_0x57b810){if(_0x57b810){var _0x4e46c3=_0x56606['user'][_0xfd5f('0x4a')]({'plain':!![]});if(!_0x4e46c3)throw new Error(_0xfd5f('0x5a'));if(_0x4e46c3[_0xfd5f('0x54')]==='user'){return db[_0xfd5f('0x5b')][_0xfd5f('0x48')]({'where':{'name':'Agents','userProfileId':_0x4e46c3[_0xfd5f('0x5c')]},'raw':!![]})[_0xfd5f('0x24')](function(_0x190779){if(_0x190779){if(_0x190779[_0xfd5f('0x5d')]===0x0){return db[_0xfd5f('0x5e')]['findAll']({'where':{'sectionId':_0x190779['id']},'raw':!![]})['then'](function(_0x283feb){var _0x32568c=[];if(_[_0xfd5f('0x5f')](_0x283feb)){_0x32568c=_[_0xfd5f('0x3b')](_0x57b810,function(_0x1b7d99){if(_0x1b7d99[_0xfd5f('0x54')]!==_0xfd5f('0x51')){return _0x1b7d99;}});return _0x32568c;}else{for(var _0x5448a3=0x0;_0x5448a3<_0x57b810['length'];_0x5448a3++){var _0x339fb0=_0x57b810[_0x5448a3];if(_0x339fb0['role']===_0xfd5f('0x51')){var _0x61bed7=_['find'](_0x283feb,function(_0x749298){return _0x749298[_0xfd5f('0x60')]===_0x339fb0['id'];});if(_0x61bed7)_0x32568c['push'](_0x339fb0);}else{_0x32568c[_0xfd5f('0x61')](_0x339fb0);}}return _0x32568c;}});}else{return _0x57b810;}}else{var _0x44289e=_['filter'](_0x57b810,function(_0x27c197){if(_0x27c197[_0xfd5f('0x54')]!==_0xfd5f('0x51')){return _0x27c197;}});return _0x44289e;}});}else{return _0x57b810;}}})[_0xfd5f('0x24')](function(_0x4329d9){var _0x544c7e=[];if(_0x4329d9){_0x4a9be5=_0x4329d9;for(var _0x14a813=0x0;_0x14a813<_0x4329d9['length'];_0x14a813+=0x1){_0x4a9be5[_0x14a813][_0xfd5f('0x62')]=[];_0x544c7e[_0xfd5f('0x61')](db[_0xfd5f('0x2a')][_0xfd5f('0x48')]({'where':{'FromId':[_0x56606[_0xfd5f('0x52')]['id'],_0x4329d9[_0x14a813]['id']],'ToId':[_0x56606['user']['id'],_0x4329d9[_0x14a813]['id']],'ChatGroupId':null},'attributes':['id',_0xfd5f('0x4c'),'FromId','ToId',_0xfd5f('0x63'),_0xfd5f('0x47')],'order':qs[_0xfd5f('0x35')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xfd5f('0x24')](wrapUser(_0x4329d9[_0x14a813])));}return BPromise[_0xfd5f('0x64')](_0x544c7e);}return[];})['then'](function(_0x2401f7){return{'rows':_0x2401f7,'count':_0x2401f7[_0xfd5f('0x32')]};})['then'](respondWithResult(_0x21c88c,null))[_0xfd5f('0x3f')](handleError(_0x21c88c,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index f0074c6..e340e82 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 _0x8ca0=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update'];(function(_0x12c8f6,_0x1986f0){var _0x3be5cb=function(_0x29ed02){while(--_0x29ed02){_0x12c8f6['push'](_0x12c8f6['shift']());}};_0x3be5cb(++_0x1986f0);}(_0x8ca0,0x16c));var _0x08ca=function(_0x187734,_0x5ed730){_0x187734=_0x187734-0x0;var _0x454a01=_0x8ca0[_0x187734];return _0x454a01;};'use strict';var EventEmitter=require(_0x08ca('0x0'));var ChatInternalMessage=require(_0x08ca('0x1'))['db'][_0x08ca('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x08ca('0x3')](0x0);var events={'afterCreate':_0x08ca('0x4'),'afterUpdate':_0x08ca('0x5'),'afterDestroy':'remove'};function emitEvent(_0x254d42){return function(_0x229056,_0x2fa55c,_0x4e600f){ChatInternalMessageEvents[_0x08ca('0x6')](_0x254d42+':'+_0x229056['id'],_0x229056);ChatInternalMessageEvents['emit'](_0x254d42,_0x229056);_0x4e600f(null);};}for(var e in events){if(events[_0x08ca('0x7')](e)){var event=events[e];ChatInternalMessage[_0x08ca('0x8')](e,emitEvent(event));}}module[_0x08ca('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x96a0=['hook','events','../../mysqldb','ChatInternalMessage','remove','emit','hasOwnProperty'];(function(_0x478ed8,_0x21757e){var _0x2e2548=function(_0x1574f0){while(--_0x1574f0){_0x478ed8['push'](_0x478ed8['shift']());}};_0x2e2548(++_0x21757e);}(_0x96a0,0x1c1));var _0x096a=function(_0x1e077a,_0x5e1623){_0x1e077a=_0x1e077a-0x0;var _0x5deb5d=_0x96a0[_0x1e077a];return _0x5deb5d;};'use strict';var EventEmitter=require(_0x096a('0x0'));var ChatInternalMessage=require(_0x096a('0x1'))['db'][_0x096a('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x096a('0x3')};function emitEvent(_0xc55faa){return function(_0x12391e,_0x373dfc,_0x14351b){ChatInternalMessageEvents[_0x096a('0x4')](_0xc55faa+':'+_0x12391e['id'],_0x12391e);ChatInternalMessageEvents[_0x096a('0x4')](_0xc55faa,_0x12391e);_0x14351b(null);};}for(var e in events){if(events[_0x096a('0x5')](e)){var event=events[e];ChatInternalMessage[_0x096a('0x6')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 0a78b38..bc80a21 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 _0x9325=['rimraf','../../config/environment','exports','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5ccb3e,_0x816374){var _0xf8390d=function(_0x24a367){while(--_0x24a367){_0x5ccb3e['push'](_0x5ccb3e['shift']());}};_0xf8390d(++_0x816374);}(_0x9325,0x116));var _0x5932=function(_0x52ec34,_0x26d1c0){_0x52ec34=_0x52ec34-0x0;var _0x1538bb=_0x9325[_0x52ec34];return _0x1538bb;};'use strict';var _=require(_0x5932('0x0'));var util=require(_0x5932('0x1'));var logger=require(_0x5932('0x2'))(_0x5932('0x3'));var moment=require(_0x5932('0x4'));var BPromise=require(_0x5932('0x5'));var rp=require(_0x5932('0x6'));var fs=require('fs');var path=require(_0x5932('0x7'));var rimraf=require(_0x5932('0x8'));var config=require(_0x5932('0x9'));var attributes=require('./chatInternalMessage.attributes');module[_0x5932('0xa')]=function(_0x101bce,_0x267715){return _0x101bce['define']('ChatInternalMessage',attributes,{'tableName':_0x5932('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5932('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe437=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x190dcd,_0x645f8f){var _0x4c40f8=function(_0x59a5aa){while(--_0x59a5aa){_0x190dcd['push'](_0x190dcd['shift']());}};_0x4c40f8(++_0x645f8f);}(_0xe437,0x157));var _0x7e43=function(_0x377cc6,_0x153dc7){_0x377cc6=_0x377cc6-0x0;var _0x22fc9b=_0xe437[_0x377cc6];return _0x22fc9b;};'use strict';var _=require(_0x7e43('0x0'));var util=require(_0x7e43('0x1'));var logger=require(_0x7e43('0x2'))('api');var moment=require(_0x7e43('0x3'));var BPromise=require(_0x7e43('0x4'));var rp=require(_0x7e43('0x5'));var fs=require('fs');var path=require(_0x7e43('0x6'));var rimraf=require(_0x7e43('0x7'));var config=require(_0x7e43('0x8'));var attributes=require(_0x7e43('0x9'));module[_0x7e43('0xa')]=function(_0x160e83,_0x2a9ab0){return _0x160e83[_0x7e43('0xb')]('ChatInternalMessage',attributes,{'tableName':_0x7e43('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7e43('0xd'),'collate':_0x7e43('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 27e6a9c..e2b0ffe 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 _0x64c4=['request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./chatInternalMessage.socket','request','ChatInternalMessage,\x20%s,\x20%s'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x64c4,0x11b));var _0x464c=function(_0x2339d5,_0x3abe56){_0x2339d5=_0x2339d5-0x0;var _0x55a421=_0x64c4[_0x2339d5];return _0x55a421;};'use strict';var _=require(_0x464c('0x0'));var util=require(_0x464c('0x1'));var moment=require(_0x464c('0x2'));var BPromise=require(_0x464c('0x3'));var rs=require(_0x464c('0x4'));var fs=require('fs');var Redis=require(_0x464c('0x5'));var db=require(_0x464c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x464c('0x7'))(_0x464c('0x8'));var config=require(_0x464c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x464c('0xa')]({'port':0x232a});config[_0x464c('0xb')]=_[_0x464c('0xc')](config[_0x464c('0xb')],{'host':_0x464c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x464c('0xb')]));require(_0x464c('0xe'))['register'](socket);function respondWithRpcPromise(_0x200c31,_0x37da60,_0x1cfc66){return new BPromise(function(_0x4f8d5c,_0x48ba3b){return client[_0x464c('0xf')](_0x200c31,_0x1cfc66)['then'](function(_0x41ca89){logger['info'](_0x464c('0x10'),_0x37da60,_0x464c('0x11'));logger[_0x464c('0x12')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x37da60,'request\x20sent',JSON[_0x464c('0x13')](_0x41ca89));if(_0x41ca89[_0x464c('0x14')]){if(_0x41ca89['error'][_0x464c('0x15')]===0x1f4){logger['error'](_0x464c('0x10'),_0x37da60,_0x41ca89[_0x464c('0x14')][_0x464c('0x16')]);return _0x48ba3b(_0x41ca89[_0x464c('0x14')][_0x464c('0x16')]);}logger[_0x464c('0x14')](_0x464c('0x10'),_0x37da60,_0x41ca89[_0x464c('0x14')]['message']);return _0x4f8d5c(_0x41ca89[_0x464c('0x14')][_0x464c('0x16')]);}else{logger[_0x464c('0x17')](_0x464c('0x10'),_0x37da60,_0x464c('0x11'));_0x4f8d5c(_0x41ca89[_0x464c('0x18')][_0x464c('0x16')]);}})['catch'](function(_0x2edbfa){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x37da60,_0x2edbfa);_0x48ba3b(_0x2edbfa);});});} \ No newline at end of file +var _0x11f7=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x11f7,0xda));var _0x711f=function(_0x3e7c40,_0x5c4c60){_0x3e7c40=_0x3e7c40-0x0;var _0x477241=_0x11f7[_0x3e7c40];return _0x477241;};'use strict';var _=require('lodash');var util=require(_0x711f('0x0'));var moment=require('moment');var BPromise=require(_0x711f('0x1'));var rs=require(_0x711f('0x2'));var fs=require('fs');var Redis=require(_0x711f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x711f('0x4'));var logger=require(_0x711f('0x5'))('rpc');var config=require(_0x711f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x711f('0x7')]({'port':0x232a});config[_0x711f('0x8')]=_['defaults'](config[_0x711f('0x8')],{'host':_0x711f('0x9'),'port':0x18eb});var socket=require(_0x711f('0xa'))(new Redis(config[_0x711f('0x8')]));require(_0x711f('0xb'))['register'](socket);function respondWithRpcPromise(_0x461757,_0x4f76e3,_0x37f78d){return new BPromise(function(_0x453f2c,_0x217e54){return client['request'](_0x461757,_0x37f78d)['then'](function(_0x5d039d){logger[_0x711f('0xc')](_0x711f('0xd'),_0x4f76e3,_0x711f('0xe'));logger[_0x711f('0xf')](_0x711f('0x10'),_0x4f76e3,_0x711f('0xe'),JSON['stringify'](_0x5d039d));if(_0x5d039d[_0x711f('0x11')]){if(_0x5d039d['error'][_0x711f('0x12')]===0x1f4){logger[_0x711f('0x11')](_0x711f('0xd'),_0x4f76e3,_0x5d039d[_0x711f('0x11')]['message']);return _0x217e54(_0x5d039d[_0x711f('0x11')][_0x711f('0x13')]);}logger['error'](_0x711f('0xd'),_0x4f76e3,_0x5d039d[_0x711f('0x11')][_0x711f('0x13')]);return _0x453f2c(_0x5d039d['error']['message']);}else{logger[_0x711f('0xc')]('ChatInternalMessage,\x20%s,\x20%s',_0x4f76e3,'request\x20sent');_0x453f2c(_0x5d039d[_0x711f('0x14')][_0x711f('0x13')]);}})[_0x711f('0x15')](function(_0x2b56cd){logger[_0x711f('0x11')](_0x711f('0xd'),_0x4f76e3,_0x2b56cd);_0x217e54(_0x2b56cd);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index aa9781d..226121b 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 _0x605a=['emit','removeListener','register','./chatInternalMessage.events','save','remove'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x605a,0x189));var _0xa605=function(_0x4061d5,_0x59d934){_0x4061d5=_0x4061d5-0x0;var _0x5a994c=_0x605a[_0x4061d5];return _0x5a994c;};'use strict';var ChatInternalMessageEvents=require(_0xa605('0x0'));var events=[_0xa605('0x1'),_0xa605('0x2'),'update'];function createListener(_0x3e6c96,_0x12f9a){return function(_0x2eae75){_0x12f9a[_0xa605('0x3')](_0x3e6c96,_0x2eae75);};}function removeListener(_0x1d4497,_0x755f68){return function(){ChatInternalMessageEvents[_0xa605('0x4')](_0x1d4497,_0x755f68);};}exports[_0xa605('0x5')]=function(_0x1d620f){for(var _0x313d67=0x0,_0x244cc9=events['length'];_0x313d67<_0x244cc9;_0x313d67++){var _0x97e132=events[_0x313d67];var _0x54ebed=createListener('chatInternalMessage:'+_0x97e132,_0x1d620f);ChatInternalMessageEvents['on'](_0x97e132,_0x54ebed);}}; \ No newline at end of file +var _0xe540=['length','chatInternalMessage:','save','remove','emit','removeListener'];(function(_0x17d321,_0x40c2c2){var _0x2ee7d4=function(_0x23f711){while(--_0x23f711){_0x17d321['push'](_0x17d321['shift']());}};_0x2ee7d4(++_0x40c2c2);}(_0xe540,0x110));var _0x0e54=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe540[_0x5d6456];return _0x4d66c1;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x0e54('0x0'),_0x0e54('0x1'),'update'];function createListener(_0x14e73b,_0x6fa9a1){return function(_0x3f111a){_0x6fa9a1[_0x0e54('0x2')](_0x14e73b,_0x3f111a);};}function removeListener(_0x2423da,_0x2adf28){return function(){ChatInternalMessageEvents[_0x0e54('0x3')](_0x2423da,_0x2adf28);};}exports['register']=function(_0x27d90e){for(var _0x426ed7=0x0,_0x4aae6b=events[_0x0e54('0x4')];_0x426ed7<_0x4aae6b;_0x426ed7++){var _0x50105a=events[_0x426ed7];var _0x4e02d3=createListener(_0x0e54('0x5')+_0x50105a,_0x27d90e);ChatInternalMessageEvents['on'](_0x50105a,_0x4e02d3);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 7e67774..bc7d758 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 _0x4bee=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','/users','show','create','put','/:id','delete'];(function(_0x105dc1,_0x535ab7){var _0xc525fe=function(_0x25ef0e){while(--_0x25ef0e){_0x105dc1['push'](_0x105dc1['shift']());}};_0xc525fe(++_0x535ab7);}(_0x4bee,0x1e6));var _0xe4be=function(_0x3005d5,_0xf588c7){_0x3005d5=_0x3005d5-0x0;var _0x547c7e=_0x4bee[_0x3005d5];return _0x547c7e;};'use strict';var multer=require(_0xe4be('0x0'));var util=require(_0xe4be('0x1'));var path=require(_0xe4be('0x2'));var timeout=require(_0xe4be('0x3'));var express=require(_0xe4be('0x4'));var router=express['Router']();var fs_extra=require(_0xe4be('0x5'));var auth=require(_0xe4be('0x6'));var interaction=require(_0xe4be('0x7'));var config=require(_0xe4be('0x8'));var controller=require(_0xe4be('0x9'));router[_0xe4be('0xa')]('/',auth[_0xe4be('0xb')](),controller['index']);router[_0xe4be('0xa')](_0xe4be('0xc'),auth['isAuthenticated'](),controller[_0xe4be('0xd')]);router[_0xe4be('0xa')](_0xe4be('0xe'),auth[_0xe4be('0xb')](),controller['getUsers']);router[_0xe4be('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe4be('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe4be('0x10')]);router[_0xe4be('0x11')](_0xe4be('0x12'),controller['update']);router[_0xe4be('0x13')](_0xe4be('0x12'),auth[_0xe4be('0xb')](),controller[_0xe4be('0x14')]);module[_0xe4be('0x15')]=router; \ No newline at end of file +var _0xa722=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','getUsers','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1be446,_0x308671){var _0x14a4c6=function(_0x2a64b3){while(--_0x2a64b3){_0x1be446['push'](_0x1be446['shift']());}};_0x14a4c6(++_0x308671);}(_0xa722,0xb1));var _0x2a72=function(_0x36cb22,_0x340b23){_0x36cb22=_0x36cb22-0x0;var _0x5f8af7=_0xa722[_0x36cb22];return _0x5f8af7;};'use strict';var multer=require(_0x2a72('0x0'));var util=require(_0x2a72('0x1'));var path=require(_0x2a72('0x2'));var timeout=require(_0x2a72('0x3'));var express=require(_0x2a72('0x4'));var router=express[_0x2a72('0x5')]();var fs_extra=require(_0x2a72('0x6'));var auth=require(_0x2a72('0x7'));var interaction=require(_0x2a72('0x8'));var config=require(_0x2a72('0x9'));var controller=require(_0x2a72('0xa'));router[_0x2a72('0xb')]('/',auth[_0x2a72('0xc')](),controller['index']);router[_0x2a72('0xb')](_0x2a72('0xd'),auth[_0x2a72('0xc')](),controller[_0x2a72('0xe')]);router[_0x2a72('0xb')]('/users',auth[_0x2a72('0xc')](),controller[_0x2a72('0xf')]);router['get']('/:id',auth[_0x2a72('0xc')](),controller[_0x2a72('0x10')]);router[_0x2a72('0x11')]('/',auth[_0x2a72('0xc')](),controller['create']);router[_0x2a72('0x12')]('/:id',controller[_0x2a72('0x13')]);router[_0x2a72('0x14')]('/:id',auth[_0x2a72('0xc')](),controller[_0x2a72('0x15')]);module[_0x2a72('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 18bb70d..62fb292 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 _0x1c3d=['TEXT','medium','BOOLEAN','out','DATE','STRING','exports'];(function(_0x460a62,_0x5c1bbe){var _0x53c144=function(_0x6f1fcd){while(--_0x6f1fcd){_0x460a62['push'](_0x460a62['shift']());}};_0x53c144(++_0x5c1bbe);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0x2631bf,_0x5152b8){_0x2631bf=_0x2631bf-0x0;var _0x30a26d=_0x1c3d[_0x2631bf];return _0x30a26d;};'use strict';var Sequelize=require('sequelize');module[_0xd1c3('0x0')]={'body':{'type':Sequelize[_0xd1c3('0x1')](_0xd1c3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd1c3('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd1c3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xd1c3('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd1c3('0x5')]},'providerName':{'type':Sequelize[_0xd1c3('0x6')]},'providerResponse':{'type':Sequelize[_0xd1c3('0x1')]}}; \ No newline at end of file +var _0x6836=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x1c67a2,_0x599648){var _0x4fbd8e=function(_0x2e465b){while(--_0x2e465b){_0x1c67a2['push'](_0x1c67a2['shift']());}};_0x4fbd8e(++_0x599648);}(_0x6836,0x1c0));var _0x6683=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x6836[_0x1a36a5];return _0x746243;};'use strict';var Sequelize=require(_0x6683('0x0'));module[_0x6683('0x1')]={'body':{'type':Sequelize[_0x6683('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x6683('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6683('0x4')]('in','out'),'defaultValue':_0x6683('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x6683('0x6')]},'providerResponse':{'type':Sequelize[_0x6683('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index d6d215b..86503e6 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 _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x1dd3e5,_0x37dda1){var _0x88ad1a=function(_0x4bc6f1){while(--_0x4bc6f1){_0x1dd3e5['push'](_0x1dd3e5['shift']());}};_0x88ad1a(++_0x37dda1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file +var _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x3c832a,_0x3fd924){var _0x780451=function(_0x3ae4d6){while(--_0x3ae4d6){_0x3c832a['push'](_0x3c832a['shift']());}};_0x780451(++_0x3fd924);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 49e7c48..7501526 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 _0x3990=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x22f2c5,_0x31e5d2){var _0x75515f=function(_0x3af6bc){while(--_0x3af6bc){_0x22f2c5['push'](_0x22f2c5['shift']());}};_0x75515f(++_0x31e5d2);}(_0x3990,0x108));var _0x0399=function(_0x2a93f0,_0x1f8fb7){_0x2a93f0=_0x2a93f0-0x0;var _0x439217=_0x3990[_0x2a93f0];return _0x439217;};'use strict';var EventEmitter=require(_0x0399('0x0'));var ChatMessage=require(_0x0399('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0399('0x2'),'afterUpdate':'update','afterDestroy':_0x0399('0x3')};function emitEvent(_0x11b5e1){return function(_0x4eed6b,_0x43f3c1,_0x46df84){ChatMessageEvents['emit'](_0x11b5e1+':'+_0x4eed6b['id'],_0x4eed6b);ChatMessageEvents[_0x0399('0x4')](_0x11b5e1,_0x4eed6b);_0x46df84(null);};}for(var e in events){if(events[_0x0399('0x5')](e)){var event=events[e];ChatMessage[_0x0399('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xdcc8=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','save','update','remove'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xdcc8,0x7c));var _0x8dcc=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0xdcc8[_0x50e593];return _0x3821d0;};'use strict';var EventEmitter=require(_0x8dcc('0x0'));var ChatMessage=require(_0x8dcc('0x1'))['db'][_0x8dcc('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8dcc('0x3'),'afterUpdate':_0x8dcc('0x4'),'afterDestroy':_0x8dcc('0x5')};function emitEvent(_0x26d84c){return function(_0x49ba2f,_0x2ecd52,_0x4808c8){ChatMessageEvents[_0x8dcc('0x6')](_0x26d84c+':'+_0x49ba2f['id'],_0x49ba2f);ChatMessageEvents['emit'](_0x26d84c,_0x49ba2f);_0x4808c8(null);};}for(var e in events){if(events[_0x8dcc('0x7')](e)){var event=events[e];ChatMessage[_0x8dcc('0x8')](e,emitEvent(event));}}module[_0x8dcc('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index b0cf6d2..240482c 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 _0x6a24=['ChatMessage','chat_messages','body','get','direction','toLowerCase','secret','UserId','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','./chatMessage.attributes','define'];(function(_0x5298fe,_0x567e0c){var _0x47ad1f=function(_0x10b19e){while(--_0x10b19e){_0x5298fe['push'](_0x5298fe['shift']());}};_0x47ad1f(++_0x567e0c);}(_0x6a24,0xb7));var _0x46a2=function(_0x79ecad,_0x1d79e2){_0x79ecad=_0x79ecad-0x0;var _0x3ff5d5=_0x6a24[_0x79ecad];return _0x3ff5d5;};'use strict';var _=require(_0x46a2('0x0'));var util=require(_0x46a2('0x1'));var logger=require(_0x46a2('0x2'))(_0x46a2('0x3'));var moment=require(_0x46a2('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x46a2('0x5'));var rimraf=require(_0x46a2('0x6'));var config=require('../../config/environment');var attributes=require(_0x46a2('0x7'));module['exports']=function(_0x19d2a9,_0x5be9fc){return _0x19d2a9[_0x46a2('0x8')](_0x46a2('0x9'),attributes,{'tableName':_0x46a2('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x46a2('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1bd69a,_0x3af320,_0x599c8f){var _0x290603=_0x19d2a9['models'];var _0x192917=_0x1bd69a[_0x46a2('0xc')]({'plain':!![]});if(_0x192917[_0x46a2('0xd')][_0x46a2('0xe')]()==='in'||_0x192917['direction'][_0x46a2('0xe')]()==='out'&&!_0x192917[_0x46a2('0xf')]&&!_['isNil'](_0x192917[_0x46a2('0x10')])){_0x290603['ChatInteraction']['findOne']({'where':{'id':_0x192917[_0x46a2('0x11')]}})[_0x46a2('0x12')](function(_0x3dc2cf){if(_0x3dc2cf){_0x3dc2cf[_0x46a2('0x13')]({'lastMsgAt':_0x192917[_0x46a2('0x14')],'lastMsgDirection':_0x192917[_0x46a2('0xd')]['toLowerCase']()});}})[_0x46a2('0x15')](function(_0x54077d){console[_0x46a2('0x16')](_0x54077d);});}_0x599c8f();}},'charset':'utf8mb4','collate':_0x46a2('0x17')});}; \ No newline at end of file +var _0x61e6=['path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2f613b,_0x231b15){var _0x34e9cb=function(_0x329e5d){while(--_0x329e5d){_0x2f613b['push'](_0x2f613b['shift']());}};_0x34e9cb(++_0x231b15);}(_0x61e6,0x9a));var _0x661e=function(_0x1a0046,_0x57b2d1){_0x1a0046=_0x1a0046-0x0;var _0x1c1a65=_0x61e6[_0x1a0046];return _0x1c1a65;};'use strict';var _=require(_0x661e('0x0'));var util=require(_0x661e('0x1'));var logger=require(_0x661e('0x2'))('api');var moment=require(_0x661e('0x3'));var BPromise=require(_0x661e('0x4'));var rp=require(_0x661e('0x5'));var fs=require('fs');var path=require(_0x661e('0x6'));var rimraf=require(_0x661e('0x7'));var config=require(_0x661e('0x8'));var attributes=require(_0x661e('0x9'));module[_0x661e('0xa')]=function(_0x185cad,_0x381403){return _0x185cad[_0x661e('0xb')](_0x661e('0xc'),attributes,{'tableName':_0x661e('0xd'),'paranoid':![],'indexes':[{'name':_0x661e('0xe'),'fields':[_0x661e('0xf')],'type':_0x661e('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf0c0c9,_0x17fcd8,_0x33a5fd){var _0x14e283=_0x185cad[_0x661e('0x11')];var _0x396397=_0xf0c0c9['get']({'plain':!![]});if(_0x396397[_0x661e('0x12')]['toLowerCase']()==='in'||_0x396397[_0x661e('0x12')][_0x661e('0x13')]()===_0x661e('0x14')&&!_0x396397[_0x661e('0x15')]&&!_[_0x661e('0x16')](_0x396397[_0x661e('0x17')])){_0x14e283[_0x661e('0x18')][_0x661e('0x19')]({'where':{'id':_0x396397[_0x661e('0x1a')]}})[_0x661e('0x1b')](function(_0x3b3f4a){if(_0x3b3f4a){_0x3b3f4a[_0x661e('0x1c')]({'lastMsgAt':_0x396397[_0x661e('0x1d')],'lastMsgDirection':_0x396397['direction'][_0x661e('0x13')]()});}})[_0x661e('0x1e')](function(_0x327d7c){console[_0x661e('0x1f')](_0x327d7c);});}_0x33a5fd();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index bebe9e8..47d7dbd 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 _0x2c27=['register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ChatMessage','create','body','options','raw','CreateChatMessage','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatMessage.socket'];(function(_0x3fa85e,_0x43ab1f){var _0x310f42=function(_0x4b736a){while(--_0x4b736a){_0x3fa85e['push'](_0x3fa85e['shift']());}};_0x310f42(++_0x43ab1f);}(_0x2c27,0x9f));var _0x72c2=function(_0x19777a,_0x4d093d){_0x19777a=_0x19777a-0x0;var _0x26bbb8=_0x2c27[_0x19777a];return _0x26bbb8;};'use strict';var _=require(_0x72c2('0x0'));var util=require(_0x72c2('0x1'));var moment=require(_0x72c2('0x2'));var BPromise=require('bluebird');var rs=require(_0x72c2('0x3'));var fs=require('fs');var Redis=require(_0x72c2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x72c2('0x5'));var logger=require(_0x72c2('0x6'))(_0x72c2('0x7'));var config=require(_0x72c2('0x8'));var jayson=require(_0x72c2('0x9'));var client=jayson[_0x72c2('0xa')][_0x72c2('0xb')]({'port':0x232a});config['redis']=_[_0x72c2('0xc')](config[_0x72c2('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x72c2('0xe'))(new Redis(config[_0x72c2('0xd')]));require(_0x72c2('0xf'))[_0x72c2('0x10')](socket);function respondWithRpcPromise(_0x623278,_0xc263bb,_0x599db9){return new BPromise(function(_0xcf25c5,_0x1296f5){return client[_0x72c2('0x11')](_0x623278,_0x599db9)[_0x72c2('0x12')](function(_0xb36679){logger[_0x72c2('0x13')](_0x72c2('0x14'),_0xc263bb,'request\x20sent');logger[_0x72c2('0x15')](_0x72c2('0x16'),_0xc263bb,_0x72c2('0x17'),JSON[_0x72c2('0x18')](_0xb36679));if(_0xb36679[_0x72c2('0x19')]){if(_0xb36679[_0x72c2('0x19')]['code']===0x1f4){logger[_0x72c2('0x19')]('ChatMessage,\x20%s,\x20%s',_0xc263bb,_0xb36679[_0x72c2('0x19')][_0x72c2('0x1a')]);return _0x1296f5(_0xb36679[_0x72c2('0x19')]['message']);}logger[_0x72c2('0x19')](_0x72c2('0x14'),_0xc263bb,_0xb36679[_0x72c2('0x19')]['message']);return _0xcf25c5(_0xb36679[_0x72c2('0x19')][_0x72c2('0x1a')]);}else{logger[_0x72c2('0x13')]('ChatMessage,\x20%s,\x20%s',_0xc263bb,_0x72c2('0x17'));_0xcf25c5(_0xb36679[_0x72c2('0x1b')][_0x72c2('0x1a')]);}})[_0x72c2('0x1c')](function(_0x283956){logger[_0x72c2('0x19')]('ChatMessage,\x20%s,\x20%s',_0xc263bb,_0x283956);_0x1296f5(_0x283956);});});}exports['CreateChatMessage']=function(_0x56bfbf){var _0x5148f9=this;return new Promise(function(_0x5ffd18,_0x5509d9){return db[_0x72c2('0x1d')][_0x72c2('0x1e')](_0x56bfbf[_0x72c2('0x1f')],{'raw':_0x56bfbf[_0x72c2('0x20')]?_0x56bfbf[_0x72c2('0x20')][_0x72c2('0x21')]===undefined?!![]:![]:!![]})[_0x72c2('0x12')](function(_0x5254f7){logger[_0x72c2('0x13')](_0x72c2('0x22'),_0x56bfbf);logger[_0x72c2('0x15')]('CreateChatMessage',_0x56bfbf,JSON[_0x72c2('0x18')](_0x5254f7));_0x5ffd18(_0x5254f7);})['catch'](function(_0x1ce66c){logger[_0x72c2('0x19')](_0x72c2('0x22'),_0x1ce66c['message'],_0x56bfbf);_0x5509d9(_0x5148f9[_0x72c2('0x19')](0x1f4,_0x1ce66c['message']));});});}; \ No newline at end of file +var _0x76f2=['defaults','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis'];(function(_0x1413b5,_0xbfdb9){var _0x36e5eb=function(_0x425e14){while(--_0x425e14){_0x1413b5['push'](_0x1413b5['shift']());}};_0x36e5eb(++_0xbfdb9);}(_0x76f2,0x125));var _0x276f=function(_0x3bd416,_0x52dcda){_0x3bd416=_0x3bd416-0x0;var _0x6c4678=_0x76f2[_0x3bd416];return _0x6c4678;};'use strict';var _=require(_0x276f('0x0'));var util=require(_0x276f('0x1'));var moment=require(_0x276f('0x2'));var BPromise=require(_0x276f('0x3'));var rs=require(_0x276f('0x4'));var fs=require('fs');var Redis=require(_0x276f('0x5'));var db=require(_0x276f('0x6'))['db'];var utils=require(_0x276f('0x7'));var logger=require(_0x276f('0x8'))(_0x276f('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x276f('0xa')][_0x276f('0xb')]({'port':0x232a});config[_0x276f('0xc')]=_[_0x276f('0xd')](config[_0x276f('0xc')],{'host':_0x276f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x276f('0xc')]));require(_0x276f('0xf'))[_0x276f('0x10')](socket);function respondWithRpcPromise(_0x1cf6dc,_0x178ddb,_0x48d337){return new BPromise(function(_0x43520c,_0x558c35){return client[_0x276f('0x11')](_0x1cf6dc,_0x48d337)[_0x276f('0x12')](function(_0x2f7e11){logger[_0x276f('0x13')](_0x276f('0x14'),_0x178ddb,_0x276f('0x15'));logger['debug'](_0x276f('0x16'),_0x178ddb,_0x276f('0x15'),JSON[_0x276f('0x17')](_0x2f7e11));if(_0x2f7e11[_0x276f('0x18')]){if(_0x2f7e11[_0x276f('0x18')][_0x276f('0x19')]===0x1f4){logger[_0x276f('0x18')](_0x276f('0x14'),_0x178ddb,_0x2f7e11[_0x276f('0x18')][_0x276f('0x1a')]);return _0x558c35(_0x2f7e11[_0x276f('0x18')][_0x276f('0x1a')]);}logger[_0x276f('0x18')]('ChatMessage,\x20%s,\x20%s',_0x178ddb,_0x2f7e11[_0x276f('0x18')][_0x276f('0x1a')]);return _0x43520c(_0x2f7e11[_0x276f('0x18')][_0x276f('0x1a')]);}else{logger['info'](_0x276f('0x14'),_0x178ddb,'request\x20sent');_0x43520c(_0x2f7e11['result']['message']);}})[_0x276f('0x1b')](function(_0x15ba3a){logger[_0x276f('0x18')](_0x276f('0x14'),_0x178ddb,_0x15ba3a);_0x558c35(_0x15ba3a);});});}exports[_0x276f('0x1c')]=function(_0x5afc36){var _0xd9a0c1=this;return new Promise(function(_0x27bb24,_0x4c7799){return db[_0x276f('0x1d')][_0x276f('0x1e')](_0x5afc36[_0x276f('0x1f')],{'raw':_0x5afc36[_0x276f('0x20')]?_0x5afc36[_0x276f('0x20')][_0x276f('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0xaa6b1f){logger[_0x276f('0x13')](_0x276f('0x1c'),_0x5afc36);logger['debug'](_0x276f('0x1c'),_0x5afc36,JSON[_0x276f('0x17')](_0xaa6b1f));_0x27bb24(_0xaa6b1f);})[_0x276f('0x1b')](function(_0x46777e){logger[_0x276f('0x18')](_0x276f('0x1c'),_0x46777e[_0x276f('0x1a')],_0x5afc36);_0x4c7799(_0xd9a0c1[_0x276f('0x18')](0x1f4,_0x46777e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 519912f..360fc3d 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 _0x975f=['chatMessage:','./chatMessage.events','save','emit','removeListener','length'];(function(_0xed6361,_0x1dff87){var _0x1f2f68=function(_0x59b206){while(--_0x59b206){_0xed6361['push'](_0xed6361['shift']());}};_0x1f2f68(++_0x1dff87);}(_0x975f,0x109));var _0xf975=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x975f[_0x4b174a];return _0x3cd7bf;};'use strict';var ChatMessageEvents=require(_0xf975('0x0'));var events=[_0xf975('0x1'),'remove','update'];function createListener(_0x3d087b,_0x274f21){return function(_0x556f63){_0x274f21[_0xf975('0x2')](_0x3d087b,_0x556f63);};}function removeListener(_0x2d047c,_0x26c58b){return function(){ChatMessageEvents[_0xf975('0x3')](_0x2d047c,_0x26c58b);};}exports['register']=function(_0x356f71){for(var _0x5a9aca=0x0,_0x36f6cf=events[_0xf975('0x4')];_0x5a9aca<_0x36f6cf;_0x5a9aca++){var _0x51a37c=events[_0x5a9aca];var _0x194d30=createListener(_0xf975('0x5')+_0x51a37c,_0x356f71);ChatMessageEvents['on'](_0x51a37c,_0x194d30);}}; \ No newline at end of file +var _0x9879=['remove','emit','removeListener','register','chatMessage:','./chatMessage.events','save'];(function(_0x37dbbb,_0x1909de){var _0x10068f=function(_0x2464b0){while(--_0x2464b0){_0x37dbbb['push'](_0x37dbbb['shift']());}};_0x10068f(++_0x1909de);}(_0x9879,0x98));var _0x9987=function(_0x533350,_0x5e743e){_0x533350=_0x533350-0x0;var _0x26e86f=_0x9879[_0x533350];return _0x26e86f;};'use strict';var ChatMessageEvents=require(_0x9987('0x0'));var events=[_0x9987('0x1'),_0x9987('0x2'),'update'];function createListener(_0xadce9d,_0x525218){return function(_0x3a2473){_0x525218[_0x9987('0x3')](_0xadce9d,_0x3a2473);};}function removeListener(_0x1fd45d,_0xcc5722){return function(){ChatMessageEvents[_0x9987('0x4')](_0x1fd45d,_0xcc5722);};}exports[_0x9987('0x5')]=function(_0x4258df){for(var _0x4d479d=0x0,_0x34d2fd=events['length'];_0x4d479d<_0x34d2fd;_0x4d479d++){var _0x6cb988=events[_0x4d479d];var _0x3e5538=createListener(_0x9987('0x6')+_0x6cb988,_0x4258df);ChatMessageEvents['on'](_0x6cb988,_0x3e5538);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 1b6a653..23e60df 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 _0xb804=['create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','tracked','chat','chatmessage:create'];(function(_0x7d3a29,_0x5c399a){var _0x85521e=function(_0x59d065){while(--_0x59d065){_0x7d3a29['push'](_0x7d3a29['shift']());}};_0x85521e(++_0x5c399a);}(_0xb804,0x134));var _0x4b80=function(_0x422f1d,_0x28314c){_0x422f1d=_0x422f1d-0x0;var _0x4e5bc7=_0xb804[_0x422f1d];return _0x4e5bc7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4b80('0x0'));var timeout=require('connect-timeout');var express=require(_0x4b80('0x1'));var router=express['Router']();var fs_extra=require(_0x4b80('0x2'));var auth=require(_0x4b80('0x3'));var interaction=require(_0x4b80('0x4'));var config=require(_0x4b80('0x5'));var controller=require('./chatMessage.controller');router[_0x4b80('0x6')]('/',auth[_0x4b80('0x7')](),controller['index']);router[_0x4b80('0x6')](_0x4b80('0x8'),auth[_0x4b80('0x7')](),controller['describe']);router[_0x4b80('0x6')](_0x4b80('0x9'),auth[_0x4b80('0x7')](),controller[_0x4b80('0xa')]);router['post']('/',auth[_0x4b80('0x7')](),interaction[_0x4b80('0xb')](_0x4b80('0xc'),_0x4b80('0xd')),controller[_0x4b80('0xe')]);router[_0x4b80('0xf')](_0x4b80('0x9'),controller[_0x4b80('0x10')]);router[_0x4b80('0xf')](_0x4b80('0x11'),auth['isAuthenticated'](),controller['accept']);router[_0x4b80('0xf')](_0x4b80('0x12'),auth['isAuthenticated'](),controller[_0x4b80('0x13')]);router[_0x4b80('0x14')]('/:id',auth[_0x4b80('0x7')](),controller[_0x4b80('0x15')]);module[_0x4b80('0x16')]=router; \ No newline at end of file +var _0xd490=['destroy','exports','multer','util','path','Router','../../config/environment','./chatMessage.controller','get','isAuthenticated','describe','/:id','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','reject','delete'];(function(_0x261cc2,_0x3aa693){var _0x5d05c2=function(_0x4c328c){while(--_0x4c328c){_0x261cc2['push'](_0x261cc2['shift']());}};_0x5d05c2(++_0x3aa693);}(_0xd490,0x1ce));var _0x0d49=function(_0x6ff939,_0x55308e){_0x6ff939=_0x6ff939-0x0;var _0x1683f5=_0xd490[_0x6ff939];return _0x1683f5;};'use strict';var multer=require(_0x0d49('0x0'));var util=require(_0x0d49('0x1'));var path=require(_0x0d49('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d49('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0d49('0x4'));var controller=require(_0x0d49('0x5'));router[_0x0d49('0x6')]('/',auth[_0x0d49('0x7')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x0d49('0x8')]);router[_0x0d49('0x6')](_0x0d49('0x9'),auth[_0x0d49('0x7')](),controller['show']);router[_0x0d49('0xa')]('/',auth[_0x0d49('0x7')](),interaction[_0x0d49('0xb')](_0x0d49('0xc'),_0x0d49('0xd')),controller[_0x0d49('0xe')]);router[_0x0d49('0xf')](_0x0d49('0x9'),controller[_0x0d49('0x10')]);router[_0x0d49('0xf')](_0x0d49('0x11'),auth[_0x0d49('0x7')](),controller[_0x0d49('0x12')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x0d49('0x13')]);router[_0x0d49('0x14')](_0x0d49('0x9'),auth[_0x0d49('0x7')](),controller[_0x0d49('0x15')]);module[_0x0d49('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index d14633d..427bef6 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 _0xc17b=['medium','sequelize'];(function(_0x388ed3,_0x3c9229){var _0x22181c=function(_0x38f8f5){while(--_0x38f8f5){_0x388ed3['push'](_0x388ed3['shift']());}};_0x22181c(++_0x3c9229);}(_0xc17b,0x163));var _0xbc17=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xc17b[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0xbc17('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xbc17('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0xdee9=['TEXT','medium','sequelize','exports'];(function(_0x639b26,_0x368cb0){var _0x50b4df=function(_0x48c9d3){while(--_0x48c9d3){_0x639b26['push'](_0x639b26['shift']());}};_0x50b4df(++_0x368cb0);}(_0xdee9,0x1de));var _0x9dee=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xdee9[_0x1abb09];return _0xea1c07;};'use strict';var Sequelize=require(_0x9dee('0x0'));module[_0x9dee('0x1')]={'body':{'type':Sequelize[_0x9dee('0x2')](_0x9dee('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 65c44a0..0918352 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x7a54,0x106));var _0x47a5=function(_0x15eb09,_0x1bae46){_0x15eb09=_0x15eb09-0x0;var _0x36cea5=_0x7a54[_0x15eb09];return _0x36cea5;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x7a54,0x106));var _0x47a5=function(_0x45621a,_0x178c4e){_0x45621a=_0x45621a-0x0;var _0x392d46=_0x7a54[_0x45621a];return _0x392d46;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index c5632c6..1390ff1 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 _0xf31d=['../../config/environment','./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf31d,0x102));var _0xdf31=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0xf31d[_0x2307fa];return _0x496486;};'use strict';var _=require(_0xdf31('0x0'));var util=require('util');var logger=require(_0xdf31('0x1'))(_0xdf31('0x2'));var moment=require(_0xdf31('0x3'));var BPromise=require(_0xdf31('0x4'));var rp=require(_0xdf31('0x5'));var fs=require('fs');var path=require(_0xdf31('0x6'));var rimraf=require(_0xdf31('0x7'));var config=require(_0xdf31('0x8'));var attributes=require(_0xdf31('0x9'));module[_0xdf31('0xa')]=function(_0x4793bd,_0x19fb90){return _0x4793bd[_0xdf31('0xb')]('ChatOfflineMessage',attributes,{'tableName':_0xdf31('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdf31('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xaf48=['moment','request-promise','path','../../config/environment','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','lodash','api'];(function(_0x160f38,_0x14fdd4){var _0x3746f0=function(_0x114667){while(--_0x114667){_0x160f38['push'](_0x160f38['shift']());}};_0x3746f0(++_0x14fdd4);}(_0xaf48,0x9e));var _0x8af4=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xaf48[_0x9c2427];return _0x51984f;};'use strict';var _=require(_0x8af4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8af4('0x1'));var moment=require(_0x8af4('0x2'));var BPromise=require('bluebird');var rp=require(_0x8af4('0x3'));var fs=require('fs');var path=require(_0x8af4('0x4'));var rimraf=require('rimraf');var config=require(_0x8af4('0x5'));var attributes=require('./chatOfflineMessage.attributes');module[_0x8af4('0x6')]=function(_0x46ed7b,_0x36e0ab){return _0x46ed7b['define'](_0x8af4('0x7'),attributes,{'tableName':_0x8af4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8af4('0x9')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 123920a..2d01cae 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 _0x2135=['request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x5365f4,_0x485939){var _0x3b9c2a=function(_0x138293){while(--_0x138293){_0x5365f4['push'](_0x5365f4['shift']());}};_0x3b9c2a(++_0x485939);}(_0x2135,0x147));var _0x5213=function(_0x3c21a3,_0x521526){_0x3c21a3=_0x3c21a3-0x0;var _0x147b2b=_0x2135[_0x3c21a3];return _0x147b2b;};'use strict';var _=require(_0x5213('0x0'));var util=require('util');var moment=require(_0x5213('0x1'));var BPromise=require(_0x5213('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5213('0x3'))['db'];var utils=require(_0x5213('0x4'));var logger=require('../../config/logger')(_0x5213('0x5'));var config=require(_0x5213('0x6'));var jayson=require(_0x5213('0x7'));var client=jayson[_0x5213('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x117b78,_0x1b3916,_0x2d2075){return new BPromise(function(_0x2c9eb1,_0x5f361c){return client[_0x5213('0x9')](_0x117b78,_0x2d2075)['then'](function(_0x182153){logger[_0x5213('0xa')](_0x5213('0xb'),_0x1b3916,'request\x20sent');logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1b3916,_0x5213('0xc'),JSON['stringify'](_0x182153));if(_0x182153['error']){if(_0x182153['error']['code']===0x1f4){logger[_0x5213('0xd')](_0x5213('0xb'),_0x1b3916,_0x182153[_0x5213('0xd')][_0x5213('0xe')]);return _0x5f361c(_0x182153[_0x5213('0xd')][_0x5213('0xe')]);}logger[_0x5213('0xd')](_0x5213('0xb'),_0x1b3916,_0x182153[_0x5213('0xd')][_0x5213('0xe')]);return _0x2c9eb1(_0x182153[_0x5213('0xd')][_0x5213('0xe')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x1b3916,_0x5213('0xc'));_0x2c9eb1(_0x182153[_0x5213('0xf')]['message']);}})['catch'](function(_0x3110b5){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x1b3916,_0x3110b5);_0x5f361c(_0x3110b5);});});} \ No newline at end of file +var _0x6bc1=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0x6bc1,0x12b));var _0x16bc=function(_0x1124f5,_0xdba171){_0x1124f5=_0x1124f5-0x0;var _0x3134d7=_0x6bc1[_0x1124f5];return _0x3134d7;};'use strict';var _=require(_0x16bc('0x0'));var util=require(_0x16bc('0x1'));var moment=require(_0x16bc('0x2'));var BPromise=require(_0x16bc('0x3'));var rs=require(_0x16bc('0x4'));var fs=require('fs');var Redis=require(_0x16bc('0x5'));var db=require(_0x16bc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x16bc('0x7'))(_0x16bc('0x8'));var config=require(_0x16bc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x16bc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x629090,_0x29cdf8,_0x52e6fb){return new BPromise(function(_0x29425f,_0x2d2c31){return client[_0x16bc('0xb')](_0x629090,_0x52e6fb)['then'](function(_0xdb5794){logger[_0x16bc('0xc')](_0x16bc('0xd'),_0x29cdf8,_0x16bc('0xe'));logger[_0x16bc('0xf')](_0x16bc('0x10'),_0x29cdf8,_0x16bc('0xe'),JSON[_0x16bc('0x11')](_0xdb5794));if(_0xdb5794[_0x16bc('0x12')]){if(_0xdb5794['error'][_0x16bc('0x13')]===0x1f4){logger[_0x16bc('0x12')](_0x16bc('0xd'),_0x29cdf8,_0xdb5794['error'][_0x16bc('0x14')]);return _0x2d2c31(_0xdb5794[_0x16bc('0x12')][_0x16bc('0x14')]);}logger['error'](_0x16bc('0xd'),_0x29cdf8,_0xdb5794[_0x16bc('0x12')][_0x16bc('0x14')]);return _0x29425f(_0xdb5794[_0x16bc('0x12')][_0x16bc('0x14')]);}else{logger['info'](_0x16bc('0xd'),_0x29cdf8,_0x16bc('0xe'));_0x29425f(_0xdb5794[_0x16bc('0x15')]['message']);}})[_0x16bc('0x16')](function(_0x18e1ff){logger[_0x16bc('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x29cdf8,_0x18e1ff);_0x2d2c31(_0x18e1ff);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 74db6bd..b03f154 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 _0xd5a1=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer'];(function(_0x477598,_0x4dab5c){var _0x4c7ffb=function(_0x1be044){while(--_0x1be044){_0x477598['push'](_0x477598['shift']());}};_0x4c7ffb(++_0x4dab5c);}(_0xd5a1,0xef));var _0x1d5a=function(_0x21d92f,_0x524538){_0x21d92f=_0x21d92f-0x0;var _0x5c7fd8=_0xd5a1[_0x21d92f];return _0x5c7fd8;};'use strict';var multer=require(_0x1d5a('0x0'));var util=require('util');var path=require(_0x1d5a('0x1'));var timeout=require(_0x1d5a('0x2'));var express=require(_0x1d5a('0x3'));var router=express['Router']();var fs_extra=require(_0x1d5a('0x4'));var auth=require(_0x1d5a('0x5'));var interaction=require(_0x1d5a('0x6'));var config=require('../../config/environment');var controller=require(_0x1d5a('0x7'));router[_0x1d5a('0x8')]('/',auth[_0x1d5a('0x9')](),controller[_0x1d5a('0xa')]);router[_0x1d5a('0x8')](_0x1d5a('0xb'),auth['isAuthenticated'](),controller[_0x1d5a('0xc')]);router['get'](_0x1d5a('0xd'),auth['isAuthenticated'](),controller[_0x1d5a('0xe')]);router['post']('/',auth[_0x1d5a('0x9')](),controller[_0x1d5a('0xf')]);router['put'](_0x1d5a('0xd'),auth[_0x1d5a('0x9')](),controller[_0x1d5a('0x10')]);router[_0x1d5a('0x11')](_0x1d5a('0xd'),auth[_0x1d5a('0x9')](),controller[_0x1d5a('0x12')]);module[_0x1d5a('0x13')]=router; \ No newline at end of file +var _0x91aa=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','destroy'];(function(_0x3e1c73,_0x22e05c){var _0x5e17b6=function(_0xff9a7d){while(--_0xff9a7d){_0x3e1c73['push'](_0x3e1c73['shift']());}};_0x5e17b6(++_0x22e05c);}(_0x91aa,0x135));var _0xa91a=function(_0x3ae483,_0x392215){_0x3ae483=_0x3ae483-0x0;var _0x5051e4=_0x91aa[_0x3ae483];return _0x5051e4;};'use strict';var multer=require(_0xa91a('0x0'));var util=require(_0xa91a('0x1'));var path=require(_0xa91a('0x2'));var timeout=require(_0xa91a('0x3'));var express=require(_0xa91a('0x4'));var router=express[_0xa91a('0x5')]();var fs_extra=require(_0xa91a('0x6'));var auth=require(_0xa91a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa91a('0x8'));var controller=require(_0xa91a('0x9'));router[_0xa91a('0xa')]('/',auth[_0xa91a('0xb')](),controller[_0xa91a('0xc')]);router[_0xa91a('0xa')](_0xa91a('0xd'),auth[_0xa91a('0xb')](),controller[_0xa91a('0xe')]);router[_0xa91a('0xa')]('/:id',auth[_0xa91a('0xb')](),controller[_0xa91a('0xf')]);router[_0xa91a('0x10')]('/',auth[_0xa91a('0xb')](),controller[_0xa91a('0x11')]);router[_0xa91a('0x12')](_0xa91a('0x13'),auth[_0xa91a('0xb')](),controller['update']);router['delete'](_0xa91a('0x13'),auth['isAuthenticated'](),controller[_0xa91a('0x14')]);module[_0xa91a('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 47654fe..c2ca673 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 _0x4cc5=['STRING','mouseOver','INTEGER','sequelize','exports'];(function(_0x4855fa,_0x490cf3){var _0x4b7a91=function(_0x456ec7){while(--_0x456ec7){_0x4855fa['push'](_0x4855fa['shift']());}};_0x4b7a91(++_0x490cf3);}(_0x4cc5,0xa8));var _0x54cc=function(_0x3a305f,_0x454c3c){_0x3a305f=_0x3a305f-0x0;var _0x2e76b9=_0x4cc5[_0x3a305f];return _0x2e76b9;};'use strict';var Sequelize=require(_0x54cc('0x0'));module[_0x54cc('0x1')]={'name':{'type':Sequelize[_0x54cc('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver','timeout'),'defaultValue':_0x54cc('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x54cc('0x4')]}}; \ No newline at end of file +var _0x5bd9=['sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x442793,_0x2c6229){var _0x372fc0=function(_0x31cbe6){while(--_0x31cbe6){_0x442793['push'](_0x442793['shift']());}};_0x372fc0(++_0x2c6229);}(_0x5bd9,0x1f2));var _0x95bd=function(_0x10774b,_0x385f6d){_0x10774b=_0x10774b-0x0;var _0x334560=_0x5bd9[_0x10774b];return _0x334560;};'use strict';var Sequelize=require(_0x95bd('0x0'));module[_0x95bd('0x1')]={'name':{'type':Sequelize[_0x95bd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x95bd('0x3')](_0x95bd('0x4'),_0x95bd('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x95bd('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 3aab2af..4d958bd 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 _0x106f=['crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply','save','update','then','destroy','end','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x1a4df6,_0x14eaec){var _0x5ad958=function(_0x198206){while(--_0x198206){_0x1a4df6['push'](_0x1a4df6['shift']());}};_0x5ad958(++_0x14eaec);}(_0x106f,0x162));var _0xf106=function(_0x2ac613,_0x5b03a8){_0x2ac613=_0x2ac613-0x0;var _0x1ad18d=_0x106f[_0x2ac613];return _0x1ad18d;};'use strict';var emlformat=require(_0xf106('0x0'));var rimraf=require(_0xf106('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf106('0x2'));var rp=require(_0xf106('0x3'));var moment=require('moment');var BPromise=require(_0xf106('0x4'));var Mustache=require('mustache');var util=require(_0xf106('0x5'));var path=require(_0xf106('0x6'));var sox=require(_0xf106('0x7'));var csv=require(_0xf106('0x8'));var ejs=require(_0xf106('0x9'));var fs=require('fs');var fs_extra=require(_0xf106('0xa'));var _=require(_0xf106('0xb'));var squel=require('squel');var crypto=require(_0xf106('0xc'));var jsforce=require(_0xf106('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf106('0xe'));var qs=require(_0xf106('0xf'));var as=require(_0xf106('0x10'));var hardwareService=require(_0xf106('0x11'));var logger=require(_0xf106('0x12'))(_0xf106('0x13'));var utils=require(_0xf106('0x14'));var config=require(_0xf106('0x15'));var licenseUtil=require(_0xf106('0x16'));var db=require(_0xf106('0x17'))['db'];function respondWithStatusCode(_0x31eebf,_0x5e9da8){_0x5e9da8=_0x5e9da8||0xcc;return function(_0x2bd234){if(_0x2bd234){return _0x31eebf[_0xf106('0x18')](_0x5e9da8);}return _0x31eebf['status'](_0x5e9da8)['end']();};}function respondWithResult(_0x322351,_0x2cdbf6){_0x2cdbf6=_0x2cdbf6||0xc8;return function(_0x292a0d){if(_0x292a0d){return _0x322351['status'](_0x2cdbf6)[_0xf106('0x19')](_0x292a0d);}};}function respondWithFilteredResult(_0x26186f,_0xf05683){return function(_0x48bfdd){if(_0x48bfdd){var _0x1e17e6=typeof _0xf05683[_0xf106('0x1a')]==='undefined'&&typeof _0xf05683[_0xf106('0x1b')]===_0xf106('0x1c');var _0x62352=_0x48bfdd['count'];var _0x5d02c0=_0x1e17e6?0x0:_0xf05683[_0xf106('0x1a')];var _0x726d7c=_0x1e17e6?_0x48bfdd[_0xf106('0x1d')]:_0xf05683['offset']+_0xf05683[_0xf106('0x1b')];var _0x1a6816;if(_0x726d7c>=_0x62352){_0x726d7c=_0x62352;_0x1a6816=0xc8;}else{_0x1a6816=0xce;}_0x26186f[_0xf106('0x1e')](_0x1a6816);return _0x26186f[_0xf106('0x1f')](_0xf106('0x20'),_0x5d02c0+'-'+_0x726d7c+'/'+_0x62352)[_0xf106('0x19')](_0x48bfdd);}return null;};}function patchUpdates(_0x29ae70){return function(_0x232a54){try{jsonpatch[_0xf106('0x21')](_0x232a54,_0x29ae70,!![]);}catch(_0x4a9564){return BPromise['reject'](_0x4a9564);}return _0x232a54[_0xf106('0x22')]();};}function saveUpdates(_0x59abbc,_0x32ab30){return function(_0x3c729e){if(_0x3c729e){return _0x3c729e[_0xf106('0x23')](_0x59abbc)[_0xf106('0x24')](function(_0x450451){return _0x450451;});}return null;};}function removeEntity(_0x4f673f,_0x58febd){return function(_0x178890){if(_0x178890){return _0x178890[_0xf106('0x25')]()[_0xf106('0x24')](function(){_0x4f673f[_0xf106('0x1e')](0xcc)[_0xf106('0x26')]();});}};}function handleEntityNotFound(_0xf7de89,_0x9f99bb){return function(_0x118726){if(!_0x118726){_0xf7de89[_0xf106('0x18')](0x194);}return _0x118726;};}function handleError(_0x14b15e,_0x468fce){_0x468fce=_0x468fce||0x1f4;return function(_0x225c15){logger['error'](_0x225c15['stack']);if(_0x225c15['name']){delete _0x225c15[_0xf106('0x27')];}_0x14b15e[_0xf106('0x1e')](_0x468fce)[_0xf106('0x28')](_0x225c15);};}exports[_0xf106('0x29')]=function(_0x4265b3,_0x13b5d7){var _0x4f90d1={'raw':!![],'where':{'id':_0x4265b3[_0xf106('0x2a')]['id']}},_0x1394e8={};_0x1394e8[_0xf106('0x2b')]=_[_0xf106('0x2c')](db['ChatProactiveAction'][_0xf106('0x2d')]);_0x1394e8[_0xf106('0x2e')]=_[_0xf106('0x2c')](_0x4265b3[_0xf106('0x2e')]);_0x1394e8[_0xf106('0x2f')]=_[_0xf106('0x30')](_0x1394e8['model'],_0x1394e8[_0xf106('0x2e')]);_0x4f90d1[_0xf106('0x31')]=_[_0xf106('0x30')](_0x1394e8[_0xf106('0x2b')],qs['fields'](_0x4265b3[_0xf106('0x2e')][_0xf106('0x32')]));_0x4f90d1['attributes']=_0x4f90d1[_0xf106('0x31')][_0xf106('0x33')]?_0x4f90d1[_0xf106('0x31')]:_0x1394e8[_0xf106('0x2b')];if(_0x4265b3[_0xf106('0x2e')][_0xf106('0x34')]){_0x4f90d1[_0xf106('0x35')]=[{'all':!![]}];}_0x4f90d1=_[_0xf106('0x36')]({},_0x4f90d1,_0x4265b3[_0xf106('0x37')]);return db[_0xf106('0x38')][_0xf106('0x39')](_0x4f90d1)['then'](handleEntityNotFound(_0x13b5d7,null))['then'](respondWithResult(_0x13b5d7,null))[_0xf106('0x3a')](handleError(_0x13b5d7,null));};exports[_0xf106('0x3b')]=function(_0x1b6ffc,_0x58f5ac){return db[_0xf106('0x38')][_0xf106('0x3b')](_0x1b6ffc[_0xf106('0x3c')],{})[_0xf106('0x24')](respondWithResult(_0x58f5ac,0xc9))[_0xf106('0x3a')](handleError(_0x58f5ac,null));};exports['update']=function(_0x5921fe,_0x551ac1){if(_0x5921fe[_0xf106('0x3c')]['id']){delete _0x5921fe[_0xf106('0x3c')]['id'];}return db[_0xf106('0x38')][_0xf106('0x39')]({'where':{'id':_0x5921fe['params']['id']}})[_0xf106('0x24')](handleEntityNotFound(_0x551ac1,null))[_0xf106('0x24')](saveUpdates(_0x5921fe[_0xf106('0x3c')],null))['then'](respondWithResult(_0x551ac1,null))['catch'](handleError(_0x551ac1,null));};exports['destroy']=function(_0x4c0475,_0x58dba7){return db[_0xf106('0x38')]['find']({'where':{'id':_0x4c0475['params']['id']}})[_0xf106('0x24')](handleEntityNotFound(_0x58dba7,null))['then'](removeEntity(_0x58dba7,null))['catch'](handleError(_0x58dba7,null));}; \ No newline at end of file +var _0xab3f=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','params','model','keys','rawAttributes','query','filters','attributes','intersection','fields','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x53f37f,_0xfb0b18){var _0x2fe5f8=function(_0x76ef2d){while(--_0x76ef2d){_0x53f37f['push'](_0x53f37f['shift']());}};_0x2fe5f8(++_0xfb0b18);}(_0xab3f,0x72));var _0xfab3=function(_0x111f6b,_0x515482){_0x111f6b=_0x111f6b-0x0;var _0x6bdb9=_0xab3f[_0x111f6b];return _0x6bdb9;};'use strict';var emlformat=require(_0xfab3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfab3('0x1'));var jsonpatch=require(_0xfab3('0x2'));var rp=require(_0xfab3('0x3'));var moment=require(_0xfab3('0x4'));var BPromise=require(_0xfab3('0x5'));var Mustache=require(_0xfab3('0x6'));var util=require(_0xfab3('0x7'));var path=require(_0xfab3('0x8'));var sox=require(_0xfab3('0x9'));var csv=require(_0xfab3('0xa'));var ejs=require(_0xfab3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfab3('0xc'));var squel=require(_0xfab3('0xd'));var crypto=require(_0xfab3('0xe'));var jsforce=require(_0xfab3('0xf'));var deskjs=require(_0xfab3('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfab3('0x11'));var Redis=require('ioredis');var authService=require(_0xfab3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfab3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfab3('0x14'))(_0xfab3('0x15'));var utils=require(_0xfab3('0x16'));var config=require(_0xfab3('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bc573,_0x16d6aa){_0x16d6aa=_0x16d6aa||0xcc;return function(_0x25c7b2){if(_0x25c7b2){return _0x4bc573[_0xfab3('0x18')](_0x16d6aa);}return _0x4bc573[_0xfab3('0x19')](_0x16d6aa)['end']();};}function respondWithResult(_0x511a6e,_0x13932f){_0x13932f=_0x13932f||0xc8;return function(_0x21b629){if(_0x21b629){return _0x511a6e[_0xfab3('0x19')](_0x13932f)[_0xfab3('0x1a')](_0x21b629);}};}function respondWithFilteredResult(_0x2b7c7e,_0x403b93){return function(_0x403166){if(_0x403166){var _0xd76ff9=typeof _0x403b93['offset']==='undefined'&&typeof _0x403b93[_0xfab3('0x1b')]===_0xfab3('0x1c');var _0x3d3d77=_0x403166[_0xfab3('0x1d')];var _0x3d08b1=_0xd76ff9?0x0:_0x403b93[_0xfab3('0x1e')];var _0x183ead=_0xd76ff9?_0x403166[_0xfab3('0x1d')]:_0x403b93[_0xfab3('0x1e')]+_0x403b93['limit'];var _0x516fcc;if(_0x183ead>=_0x3d3d77){_0x183ead=_0x3d3d77;_0x516fcc=0xc8;}else{_0x516fcc=0xce;}_0x2b7c7e[_0xfab3('0x19')](_0x516fcc);return _0x2b7c7e[_0xfab3('0x1f')](_0xfab3('0x20'),_0x3d08b1+'-'+_0x183ead+'/'+_0x3d3d77)['json'](_0x403166);}return null;};}function patchUpdates(_0x43d66b){return function(_0x28f343){try{jsonpatch[_0xfab3('0x21')](_0x28f343,_0x43d66b,!![]);}catch(_0x1200f7){return BPromise[_0xfab3('0x22')](_0x1200f7);}return _0x28f343['save']();};}function saveUpdates(_0x4ed499,_0x5d739d){return function(_0x41f624){if(_0x41f624){return _0x41f624[_0xfab3('0x23')](_0x4ed499)[_0xfab3('0x24')](function(_0x2e6fd3){return _0x2e6fd3;});}return null;};}function removeEntity(_0x5c3bad,_0x3d7131){return function(_0x3f1688){if(_0x3f1688){return _0x3f1688[_0xfab3('0x25')]()[_0xfab3('0x24')](function(){_0x5c3bad[_0xfab3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56516e,_0x4765fb){return function(_0x1d6394){if(!_0x1d6394){_0x56516e['sendStatus'](0x194);}return _0x1d6394;};}function handleError(_0x50b7f0,_0x254316){_0x254316=_0x254316||0x1f4;return function(_0x1a7d60){logger[_0xfab3('0x26')](_0x1a7d60['stack']);if(_0x1a7d60[_0xfab3('0x27')]){delete _0x1a7d60[_0xfab3('0x27')];}_0x50b7f0[_0xfab3('0x19')](_0x254316)[_0xfab3('0x28')](_0x1a7d60);};}exports['show']=function(_0x215105,_0x28cd8b){var _0x5bcdaa={'raw':!![],'where':{'id':_0x215105[_0xfab3('0x29')]['id']}},_0x14aa2d={};_0x14aa2d[_0xfab3('0x2a')]=_[_0xfab3('0x2b')](db['ChatProactiveAction'][_0xfab3('0x2c')]);_0x14aa2d[_0xfab3('0x2d')]=_[_0xfab3('0x2b')](_0x215105[_0xfab3('0x2d')]);_0x14aa2d[_0xfab3('0x2e')]=_['intersection'](_0x14aa2d[_0xfab3('0x2a')],_0x14aa2d['query']);_0x5bcdaa[_0xfab3('0x2f')]=_[_0xfab3('0x30')](_0x14aa2d['model'],qs[_0xfab3('0x31')](_0x215105[_0xfab3('0x2d')][_0xfab3('0x31')]));_0x5bcdaa[_0xfab3('0x2f')]=_0x5bcdaa[_0xfab3('0x2f')]['length']?_0x5bcdaa[_0xfab3('0x2f')]:_0x14aa2d[_0xfab3('0x2a')];if(_0x215105[_0xfab3('0x2d')][_0xfab3('0x32')]){_0x5bcdaa[_0xfab3('0x33')]=[{'all':!![]}];}_0x5bcdaa=_[_0xfab3('0x34')]({},_0x5bcdaa,_0x215105[_0xfab3('0x35')]);return db[_0xfab3('0x36')][_0xfab3('0x37')](_0x5bcdaa)['then'](handleEntityNotFound(_0x28cd8b,null))['then'](respondWithResult(_0x28cd8b,null))[_0xfab3('0x38')](handleError(_0x28cd8b,null));};exports[_0xfab3('0x39')]=function(_0x53e13c,_0x47b2d2){return db[_0xfab3('0x36')][_0xfab3('0x39')](_0x53e13c[_0xfab3('0x3a')],{})[_0xfab3('0x24')](respondWithResult(_0x47b2d2,0xc9))['catch'](handleError(_0x47b2d2,null));};exports[_0xfab3('0x23')]=function(_0xcc2b6c,_0x6d9ba3){if(_0xcc2b6c['body']['id']){delete _0xcc2b6c['body']['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0xcc2b6c[_0xfab3('0x29')]['id']}})[_0xfab3('0x24')](handleEntityNotFound(_0x6d9ba3,null))[_0xfab3('0x24')](saveUpdates(_0xcc2b6c[_0xfab3('0x3a')],null))[_0xfab3('0x24')](respondWithResult(_0x6d9ba3,null))[_0xfab3('0x38')](handleError(_0x6d9ba3,null));};exports[_0xfab3('0x25')]=function(_0x336d43,_0x4146d9){return db[_0xfab3('0x36')][_0xfab3('0x37')]({'where':{'id':_0x336d43[_0xfab3('0x29')]['id']}})[_0xfab3('0x24')](handleEntityNotFound(_0x4146d9,null))[_0xfab3('0x24')](removeEntity(_0x4146d9,null))['catch'](handleError(_0x4146d9,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index d4882c4..ced61f7 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 _0x636d=['bluebird','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x636d,0xcc));var _0xd636=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x636d[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var util=require(_0xd636('0x0'));var logger=require(_0xd636('0x1'))(_0xd636('0x2'));var moment=require(_0xd636('0x3'));var BPromise=require(_0xd636('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd636('0x5'));var rimraf=require(_0xd636('0x6'));var config=require(_0xd636('0x7'));var attributes=require(_0xd636('0x8'));module[_0xd636('0x9')]=function(_0x24345e,_0x49fde8){return _0x24345e[_0xd636('0xa')](_0xd636('0xb'),attributes,{'tableName':_0xd636('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebb3=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x5bd42a,_0x3d625f){var _0x4daa51=function(_0x477d0d){while(--_0x477d0d){_0x5bd42a['push'](_0x5bd42a['shift']());}};_0x4daa51(++_0x3d625f);}(_0xebb3,0xb6));var _0x3ebb=function(_0x32e93e,_0x2c7db2){_0x32e93e=_0x32e93e-0x0;var _0x182712=_0xebb3[_0x32e93e];return _0x182712;};'use strict';var _=require(_0x3ebb('0x0'));var util=require(_0x3ebb('0x1'));var logger=require(_0x3ebb('0x2'))(_0x3ebb('0x3'));var moment=require('moment');var BPromise=require(_0x3ebb('0x4'));var rp=require(_0x3ebb('0x5'));var fs=require('fs');var path=require(_0x3ebb('0x6'));var rimraf=require(_0x3ebb('0x7'));var config=require('../../config/environment');var attributes=require(_0x3ebb('0x8'));module[_0x3ebb('0x9')]=function(_0x1a2b13,_0x5855b3){return _0x1a2b13[_0x3ebb('0xa')](_0x3ebb('0xb'),attributes,{'tableName':_0x3ebb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index bcae475..792ea4e 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 _0x18f8=['info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/environment','client','request','then'];(function(_0x47da9d,_0x49b756){var _0x12adf6=function(_0x479a2c){while(--_0x479a2c){_0x47da9d['push'](_0x47da9d['shift']());}};_0x12adf6(++_0x49b756);}(_0x18f8,0x1bf));var _0x818f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x18f8[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x818f('0x0'));var util=require('util');var moment=require(_0x818f('0x1'));var BPromise=require(_0x818f('0x2'));var rs=require(_0x818f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x818f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x818f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x818f('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27f03c,_0x458eba,_0x465054){return new BPromise(function(_0x36f511,_0xc9d7b9){return client[_0x818f('0x7')](_0x27f03c,_0x465054)[_0x818f('0x8')](function(_0x3448b9){logger[_0x818f('0x9')](_0x818f('0xa'),_0x458eba,_0x818f('0xb'));logger[_0x818f('0xc')](_0x818f('0xd'),_0x458eba,'request\x20sent',JSON[_0x818f('0xe')](_0x3448b9));if(_0x3448b9[_0x818f('0xf')]){if(_0x3448b9[_0x818f('0xf')][_0x818f('0x10')]===0x1f4){logger[_0x818f('0xf')](_0x818f('0xa'),_0x458eba,_0x3448b9[_0x818f('0xf')]['message']);return _0xc9d7b9(_0x3448b9[_0x818f('0xf')][_0x818f('0x11')]);}logger['error'](_0x818f('0xa'),_0x458eba,_0x3448b9[_0x818f('0xf')][_0x818f('0x11')]);return _0x36f511(_0x3448b9[_0x818f('0xf')][_0x818f('0x11')]);}else{logger[_0x818f('0x9')]('ChatProactiveAction,\x20%s,\x20%s',_0x458eba,'request\x20sent');_0x36f511(_0x3448b9[_0x818f('0x12')][_0x818f('0x11')]);}})['catch'](function(_0x5c04f7){logger[_0x818f('0xf')](_0x818f('0xa'),_0x458eba,_0x5c04f7);_0xc9d7b9(_0x5c04f7);});});} \ No newline at end of file +var _0x8d07=['ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5808cb,_0xca7d7d){var _0x4b7877=function(_0xa8bb6e){while(--_0xa8bb6e){_0x5808cb['push'](_0x5808cb['shift']());}};_0x4b7877(++_0xca7d7d);}(_0x8d07,0x92));var _0x78d0=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x8d07[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x78d0('0x0'));var util=require(_0x78d0('0x1'));var moment=require(_0x78d0('0x2'));var BPromise=require(_0x78d0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78d0('0x4'));var db=require(_0x78d0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x78d0('0x6'))(_0x78d0('0x7'));var config=require(_0x78d0('0x8'));var jayson=require(_0x78d0('0x9'));var client=jayson[_0x78d0('0xa')][_0x78d0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47c7cc,_0x264d52,_0x373cc6){return new BPromise(function(_0x50ec30,_0x528628){return client[_0x78d0('0xc')](_0x47c7cc,_0x373cc6)[_0x78d0('0xd')](function(_0x327cf9){logger[_0x78d0('0xe')](_0x78d0('0xf'),_0x264d52,_0x78d0('0x10'));logger[_0x78d0('0x11')](_0x78d0('0x12'),_0x264d52,'request\x20sent',JSON['stringify'](_0x327cf9));if(_0x327cf9['error']){if(_0x327cf9[_0x78d0('0x13')][_0x78d0('0x14')]===0x1f4){logger['error'](_0x78d0('0xf'),_0x264d52,_0x327cf9[_0x78d0('0x13')][_0x78d0('0x15')]);return _0x528628(_0x327cf9[_0x78d0('0x13')][_0x78d0('0x15')]);}logger[_0x78d0('0x13')](_0x78d0('0xf'),_0x264d52,_0x327cf9[_0x78d0('0x13')]['message']);return _0x50ec30(_0x327cf9[_0x78d0('0x13')][_0x78d0('0x15')]);}else{logger[_0x78d0('0xe')](_0x78d0('0xf'),_0x264d52,_0x78d0('0x10'));_0x50ec30(_0x327cf9[_0x78d0('0x16')][_0x78d0('0x15')]);}})['catch'](function(_0x44177e){logger[_0x78d0('0x13')](_0x78d0('0xf'),_0x264d52,_0x44177e);_0x528628(_0x44177e);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 2abd38f..8da65d2 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 _0x326f=['../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1624f2,_0x5480a8){var _0x2134d1=function(_0x17abdd){while(--_0x17abdd){_0x1624f2['push'](_0x1624f2['shift']());}};_0x2134d1(++_0x5480a8);}(_0x326f,0xd1));var _0xf326=function(_0x33ef19,_0x2ba9fa){_0x33ef19=_0x33ef19-0x0;var _0x30980f=_0x326f[_0x33ef19];return _0x30980f;};'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 fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')](_0xf326('0xa'),auth['isAuthenticated'](),controller[_0xf326('0xb')]);router[_0xf326('0xc')]('/',auth[_0xf326('0xd')](),controller[_0xf326('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xf')]);router[_0xf326('0x10')](_0xf326('0xa'),auth[_0xf326('0xd')](),controller[_0xf326('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5d58=['/:id','isAuthenticated','show','create','update','delete','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x484bf4,_0x2b975c){var _0x31c683=function(_0x1cdda2){while(--_0x1cdda2){_0x484bf4['push'](_0x484bf4['shift']());}};_0x31c683(++_0x2b975c);}(_0x5d58,0x187));var _0x85d5=function(_0x80568a,_0x2ed05f){_0x80568a=_0x80568a-0x0;var _0xc36ed=_0x5d58[_0x80568a];return _0xc36ed;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85d5('0x0')]();var fs_extra=require(_0x85d5('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var controller=require('./chatProactiveAction.controller');router[_0x85d5('0x4')](_0x85d5('0x5'),auth[_0x85d5('0x6')](),controller[_0x85d5('0x7')]);router['post']('/',auth[_0x85d5('0x6')](),controller[_0x85d5('0x8')]);router['put'](_0x85d5('0x5'),auth['isAuthenticated'](),controller[_0x85d5('0x9')]);router[_0x85d5('0xa')](_0x85d5('0x5'),auth['isAuthenticated'](),controller['destroy']);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 7c0b2e7..e0044a1 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 _0x8ba8=['roundrobin','exports','name','STRING','INTEGER','ENUM','beepall'];(function(_0x3e99c7,_0x3ee92f){var _0x104eac=function(_0x14be89){while(--_0x14be89){_0x3e99c7['push'](_0x3e99c7['shift']());}};_0x104eac(++_0x3ee92f);}(_0x8ba8,0x1c1));var _0x88ba=function(_0x116f87,_0x2b2877){_0x116f87=_0x116f87-0x0;var _0x3c0ebf=_0x8ba8[_0x116f87];return _0x3c0ebf;};'use strict';var Sequelize=require('sequelize');module[_0x88ba('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x88ba('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x88ba('0x2')]},'timeout':{'type':Sequelize[_0x88ba('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x88ba('0x4')]('rrmemory',_0x88ba('0x5'),_0x88ba('0x6'))}}; \ No newline at end of file +var _0x57d6=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x4705ed,_0xdc3910){var _0x1df0e9=function(_0x23930a){while(--_0x23930a){_0x4705ed['push'](_0x4705ed['shift']());}};_0x1df0e9(++_0xdc3910);}(_0x57d6,0x1ce));var _0x657d=function(_0xd1bd2b,_0x43ead3){_0xd1bd2b=_0xd1bd2b-0x0;var _0x466676=_0x57d6[_0xd1bd2b];return _0x466676;};'use strict';var Sequelize=require(_0x657d('0x0'));module['exports']={'name':{'type':Sequelize[_0x657d('0x1')],'unique':_0x657d('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x657d('0x1')]},'timeout':{'type':Sequelize[_0x657d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x657d('0x4')](_0x657d('0x5'),_0x657d('0x6'),_0x657d('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 3fe446d..825fa3d 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 _0x84df=['userChatQueue:save','removeTeams','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','value','isEmpty','removeAgents','addAgents','omit','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatQueue.socket','register','jayson/promise','client','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','get','destroy','sendStatus','name','index','map','ChatQueue','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','show','params','rawAttributes','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','pick','findAll','User','findAndCountAll','updatedAt','createdAt','format','SIP','chatPause','getTeams','Team','addTeams','ids','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit'];(function(_0x9921a5,_0x45aa9f){var _0x15e6d3=function(_0x5b1432){while(--_0x5b1432){_0x9921a5['push'](_0x9921a5['shift']());}};_0x15e6d3(++_0x45aa9f);}(_0x84df,0xad));var _0xf84d=function(_0x1f97e8,_0x445a4a){_0x1f97e8=_0x1f97e8-0x0;var _0x1ed77c=_0x84df[_0x1f97e8];return _0x1ed77c;};'use strict';var emlformat=require(_0xf84d('0x0'));var rimraf=require(_0xf84d('0x1'));var zipdir=require(_0xf84d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf84d('0x3'));var BPromise=require(_0xf84d('0x4'));var Mustache=require(_0xf84d('0x5'));var util=require(_0xf84d('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf84d('0x7'));var fs=require('fs');var fs_extra=require(_0xf84d('0x8'));var _=require(_0xf84d('0x9'));var squel=require(_0xf84d('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf84d('0xb'));var toCsv=require(_0xf84d('0xc'));var querystring=require(_0xf84d('0xd'));var Papa=require(_0xf84d('0xe'));var Redis=require(_0xf84d('0xf'));var authService=require(_0xf84d('0x10'));var qs=require(_0xf84d('0x11'));var as=require(_0xf84d('0x12'));var hardwareService=require(_0xf84d('0x13'));var logger=require(_0xf84d('0x14'))(_0xf84d('0x15'));var utils=require(_0xf84d('0x16'));var config=require(_0xf84d('0x17'));var licenseUtil=require(_0xf84d('0x18'));var db=require(_0xf84d('0x19'))['db'];config['redis']=_['defaults'](config[_0xf84d('0x1a')],{'host':_0xf84d('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf84d('0x1a')]));require(_0xf84d('0x1c'))[_0xf84d('0x1d')](socket);var jayson=require(_0xf84d('0x1e'));var client=jayson[_0xf84d('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ab07a,_0x15e00d,_0x54f43e,_0x560721){return new BPromise(function(_0x40b68b,_0x51e361){var _0xfd338a=_0x560721||client;return _0xfd338a[_0xf84d('0x20')](_0x4ab07a,_0x54f43e)['then'](function(_0x49f2ec){logger[_0xf84d('0x21')](_0xf84d('0x22'),_0x15e00d,_0xf84d('0x23'));logger[_0xf84d('0x24')](_0xf84d('0x25'),_0x15e00d,_0xf84d('0x23'),JSON[_0xf84d('0x26')](_0x49f2ec));if(_0x49f2ec[_0xf84d('0x27')]){if(_0x49f2ec[_0xf84d('0x27')][_0xf84d('0x28')]===0x1f4){logger[_0xf84d('0x27')](_0xf84d('0x22'),_0x15e00d,_0x49f2ec[_0xf84d('0x27')][_0xf84d('0x29')]);return _0x51e361(_0x49f2ec[_0xf84d('0x27')][_0xf84d('0x29')]);}logger[_0xf84d('0x27')]('ChatQueue,\x20%s,\x20%s',_0x15e00d,_0x49f2ec[_0xf84d('0x27')]['message']);return _0x40b68b(_0x49f2ec['error']['message']);}else{logger[_0xf84d('0x21')]('ChatQueue,\x20%s,\x20%s',_0x15e00d,_0xf84d('0x23'));_0x40b68b(_0x49f2ec[_0xf84d('0x2a')]['message']);}})[_0xf84d('0x2b')](function(_0x7594d){logger[_0xf84d('0x27')](_0xf84d('0x22'),_0x15e00d,_0x7594d);_0x51e361(_0x7594d);});});}function respondWithStatusCode(_0x4e137a,_0x50c402){_0x50c402=_0x50c402||0xcc;return function(_0x104e12){if(_0x104e12){return _0x4e137a['sendStatus'](_0x50c402);}return _0x4e137a[_0xf84d('0x2c')](_0x50c402)[_0xf84d('0x2d')]();};}function respondWithResult(_0x3b8ce5,_0x587369){_0x587369=_0x587369||0xc8;return function(_0x393320){if(_0x393320){return _0x3b8ce5[_0xf84d('0x2c')](_0x587369)['json'](_0x393320);}};}function respondWithFilteredResult(_0xa1a177,_0x2dec4a){return function(_0x5dcd44){if(_0x5dcd44){var _0x1c59a7=typeof _0x2dec4a[_0xf84d('0x2e')]===_0xf84d('0x2f')&&typeof _0x2dec4a[_0xf84d('0x30')]===_0xf84d('0x2f');var _0x34e1f0=_0x5dcd44[_0xf84d('0x31')];var _0x363612=_0x1c59a7?0x0:_0x2dec4a[_0xf84d('0x2e')];var _0x14d72c=_0x1c59a7?_0x5dcd44[_0xf84d('0x31')]:_0x2dec4a[_0xf84d('0x2e')]+_0x2dec4a[_0xf84d('0x30')];var _0x547fdf;if(_0x14d72c>=_0x34e1f0){_0x14d72c=_0x34e1f0;_0x547fdf=0xc8;}else{_0x547fdf=0xce;}_0xa1a177[_0xf84d('0x2c')](_0x547fdf);return _0xa1a177[_0xf84d('0x32')](_0xf84d('0x33'),_0x363612+'-'+_0x14d72c+'/'+_0x34e1f0)[_0xf84d('0x34')](_0x5dcd44);}return null;};}function patchUpdates(_0x180fd9){return function(_0x3e9e9a){try{jsonpatch['apply'](_0x3e9e9a,_0x180fd9,!![]);}catch(_0x3c74a8){return BPromise[_0xf84d('0x35')](_0x3c74a8);}return _0x3e9e9a['save']();};}function saveUpdates(_0x408ee3,_0x404a78){return function(_0x31c9f4){if(_0x31c9f4){return _0x31c9f4[_0xf84d('0x36')](_0x408ee3)[_0xf84d('0x37')](function(_0x533a92){return _0x533a92;});}return null;};}function removeEntity(_0x4fbeaf,_0x433dd4){return function(_0x228085){if(_0x228085){return _0x228085['destroy']()['then'](function(){var _0x27ebb9=_0x228085[_0xf84d('0x38')]({'plain':!![]});var _0x36f12e='ChatQueues';return db['UserProfileResource'][_0xf84d('0x39')]({'where':{'type':_0x36f12e,'resourceId':_0x27ebb9['id']}})[_0xf84d('0x37')](function(){return _0x228085;});})[_0xf84d('0x37')](function(){_0x4fbeaf[_0xf84d('0x2c')](0xcc)[_0xf84d('0x2d')]();});}};}function handleEntityNotFound(_0x2c755e,_0x3cc695){return function(_0x8735e9){if(!_0x8735e9){_0x2c755e[_0xf84d('0x3a')](0x194);}return _0x8735e9;};}function handleError(_0x1b8438,_0x4b3b23){_0x4b3b23=_0x4b3b23||0x1f4;return function(_0x1bd2ff){logger[_0xf84d('0x27')](_0x1bd2ff['stack']);if(_0x1bd2ff['name']){delete _0x1bd2ff[_0xf84d('0x3b')];}_0x1b8438[_0xf84d('0x2c')](_0x4b3b23)['send'](_0x1bd2ff);};}exports[_0xf84d('0x3c')]=function(_0x43ff60,_0x347bc2){var _0x2d4f1f={},_0x19748d={},_0x5e34f3={'count':0x0,'rows':[]};var _0x1caa41=_[_0xf84d('0x3d')](db[_0xf84d('0x3e')]['rawAttributes'],function(_0x4be88a){return{'name':_0x4be88a[_0xf84d('0x3f')],'type':_0x4be88a[_0xf84d('0x40')][_0xf84d('0x41')]};});_0x19748d['model']=_[_0xf84d('0x3d')](_0x1caa41,'name');_0x19748d['query']=_[_0xf84d('0x42')](_0x43ff60[_0xf84d('0x43')]);_0x19748d[_0xf84d('0x44')]=_[_0xf84d('0x45')](_0x19748d[_0xf84d('0x46')],_0x19748d[_0xf84d('0x43')]);_0x2d4f1f['attributes']=_[_0xf84d('0x45')](_0x19748d[_0xf84d('0x46')],qs['fields'](_0x43ff60['query'][_0xf84d('0x47')]));_0x2d4f1f[_0xf84d('0x48')]=_0x2d4f1f['attributes'][_0xf84d('0x49')]?_0x2d4f1f[_0xf84d('0x48')]:_0x19748d[_0xf84d('0x46')];if(!_0x43ff60[_0xf84d('0x43')][_0xf84d('0x4a')](_0xf84d('0x4b'))){_0x2d4f1f[_0xf84d('0x30')]=qs['limit'](_0x43ff60[_0xf84d('0x43')]['limit']);_0x2d4f1f[_0xf84d('0x2e')]=qs['offset'](_0x43ff60[_0xf84d('0x43')][_0xf84d('0x2e')]);}_0x2d4f1f[_0xf84d('0x4c')]=qs['sort'](_0x43ff60[_0xf84d('0x43')][_0xf84d('0x4d')]);_0x2d4f1f['where']=qs['filters'](_['pick'](_0x43ff60[_0xf84d('0x43')],_0x19748d[_0xf84d('0x44')]),_0x1caa41);if(_0x43ff60[_0xf84d('0x43')][_0xf84d('0x4e')]){_0x2d4f1f[_0xf84d('0x4f')]=_[_0xf84d('0x50')](_0x2d4f1f['where'],{'$or':_[_0xf84d('0x3d')](_0x1caa41,function(_0x4a85bc){if(_0x4a85bc['type']!==_0xf84d('0x51')){var _0x1eb933={};_0x1eb933[_0x4a85bc['name']]={'$like':'%'+_0x43ff60[_0xf84d('0x43')][_0xf84d('0x4e')]+'%'};return _0x1eb933;}})});}_0x2d4f1f=_['merge']({},_0x2d4f1f,_0x43ff60[_0xf84d('0x52')]);var _0x64f22b={'where':_0x2d4f1f[_0xf84d('0x4f')]};return db['ChatQueue'][_0xf84d('0x31')](_0x64f22b)['then'](function(_0x5c8b5a){_0x5e34f3[_0xf84d('0x31')]=_0x5c8b5a;if(_0x43ff60[_0xf84d('0x43')]['includeAll']){_0x2d4f1f[_0xf84d('0x53')]=[{'all':!![]}];}return db[_0xf84d('0x3e')]['findAll'](_0x2d4f1f);})[_0xf84d('0x37')](function(_0x151669){_0x5e34f3['rows']=_0x151669;return _0x5e34f3;})['then'](respondWithFilteredResult(_0x347bc2,_0x2d4f1f))[_0xf84d('0x2b')](handleError(_0x347bc2,null));};exports[_0xf84d('0x54')]=function(_0x398ec0,_0x3a3d46){var _0x20423f={'raw':!![],'where':{'id':_0x398ec0[_0xf84d('0x55')]['id']}},_0x50692e={};_0x50692e[_0xf84d('0x46')]=_['keys'](db[_0xf84d('0x3e')][_0xf84d('0x56')]);_0x50692e[_0xf84d('0x43')]=_[_0xf84d('0x42')](_0x398ec0[_0xf84d('0x43')]);_0x50692e[_0xf84d('0x44')]=_['intersection'](_0x50692e['model'],_0x50692e[_0xf84d('0x43')]);_0x20423f[_0xf84d('0x48')]=_['intersection'](_0x50692e[_0xf84d('0x46')],qs[_0xf84d('0x47')](_0x398ec0['query'][_0xf84d('0x47')]));_0x20423f[_0xf84d('0x48')]=_0x20423f['attributes'][_0xf84d('0x49')]?_0x20423f[_0xf84d('0x48')]:_0x50692e[_0xf84d('0x46')];if(_0x398ec0['query'][_0xf84d('0x57')]){_0x20423f[_0xf84d('0x53')]=[{'all':!![]}];}_0x20423f=_['merge']({},_0x20423f,_0x398ec0[_0xf84d('0x52')]);return db['ChatQueue']['find'](_0x20423f)[_0xf84d('0x37')](handleEntityNotFound(_0x3a3d46,null))[_0xf84d('0x37')](respondWithResult(_0x3a3d46,null))[_0xf84d('0x2b')](handleError(_0x3a3d46,null));};exports[_0xf84d('0x58')]=function(_0x3b2110,_0x1ddd2e){return db[_0xf84d('0x3e')][_0xf84d('0x58')](_0x3b2110[_0xf84d('0x59')],{})['then'](function(_0x58e5f7){var _0x2a4326=_0x3b2110['user'][_0xf84d('0x38')]({'plain':!![]});if(!_0x2a4326)throw new Error(_0xf84d('0x5a'));if(_0x2a4326[_0xf84d('0x5b')]===_0xf84d('0x5c')){var _0x341f2=_0x58e5f7[_0xf84d('0x38')]({'plain':!![]});var _0x16bf18='ChatQueues';return db[_0xf84d('0x5d')][_0xf84d('0x5e')]({'where':{'name':_0x16bf18,'userProfileId':_0x2a4326[_0xf84d('0x5f')]},'raw':!![]})[_0xf84d('0x37')](function(_0xb01279){if(_0xb01279&&_0xb01279['autoAssociation']===0x0){return db['UserProfileResource'][_0xf84d('0x58')]({'name':_0x341f2['name'],'resourceId':_0x341f2['id'],'type':_0xb01279[_0xf84d('0x3b')],'sectionId':_0xb01279['id']},{})['then'](function(){return _0x58e5f7;});}else{return _0x58e5f7;}})[_0xf84d('0x2b')](function(_0x4be4f4){logger[_0xf84d('0x27')](_0xf84d('0x60'),_0x4be4f4);throw _0x4be4f4;});}return _0x58e5f7;})[_0xf84d('0x37')](respondWithResult(_0x1ddd2e,0xc9))['catch'](handleError(_0x1ddd2e,null));};exports[_0xf84d('0x36')]=function(_0x3c3c6c,_0x780a6a){if(_0x3c3c6c['body']['id']){delete _0x3c3c6c[_0xf84d('0x59')]['id'];}return db[_0xf84d('0x3e')][_0xf84d('0x5e')]({'where':{'id':_0x3c3c6c['params']['id']}})['then'](handleEntityNotFound(_0x780a6a,null))[_0xf84d('0x37')](saveUpdates(_0x3c3c6c[_0xf84d('0x59')],null))[_0xf84d('0x37')](respondWithResult(_0x780a6a,null))[_0xf84d('0x2b')](handleError(_0x780a6a,null));};exports['destroy']=function(_0x1fae1f,_0x90d0b1){return db[_0xf84d('0x3e')]['find']({'where':{'id':_0x1fae1f[_0xf84d('0x55')]['id']}})['then'](handleEntityNotFound(_0x90d0b1,null))['then'](removeEntity(_0x90d0b1,null))[_0xf84d('0x2b')](handleError(_0x90d0b1,null));};exports[_0xf84d('0x61')]=function(_0x2a35c5,_0xf5fa2b){return db[_0xf84d('0x3e')][_0xf84d('0x61')]()['then'](respondWithResult(_0xf5fa2b,null))[_0xf84d('0x2b')](handleError(_0xf5fa2b,null));};exports[_0xf84d('0x62')]=function(_0x32ee08,_0x42d04a,_0x385824){var _0xc40dd5={'raw':!![],'where':{}},_0x5dc805={},_0x5cb5ef;return db['ChatQueue'][_0xf84d('0x63')]({'where':{'id':_0x32ee08['params']['id']}})[_0xf84d('0x37')](handleEntityNotFound(_0x42d04a,null))[_0xf84d('0x37')](function(_0x24c750){if(_0x24c750){_0x5cb5ef=_0x24c750[_0xf84d('0x38')]({'plain':!![]});_0x5dc805[_0xf84d('0x46')]=_[_0xf84d('0x42')](db[_0xf84d('0x64')]['rawAttributes']);_0x5dc805[_0xf84d('0x43')]=_[_0xf84d('0x42')](_0x32ee08[_0xf84d('0x43')]);_0x5dc805[_0xf84d('0x44')]=_[_0xf84d('0x45')](_0x5dc805[_0xf84d('0x46')],_0x5dc805[_0xf84d('0x43')]);_0xc40dd5[_0xf84d('0x48')]=_[_0xf84d('0x45')](_0x5dc805[_0xf84d('0x46')],qs['fields'](_0x32ee08[_0xf84d('0x43')][_0xf84d('0x47')]));_0xc40dd5[_0xf84d('0x48')]=_0xc40dd5[_0xf84d('0x48')]['length']?_0xc40dd5[_0xf84d('0x48')]:_0x5dc805[_0xf84d('0x46')];if(!_0x32ee08[_0xf84d('0x43')]['hasOwnProperty'](_0xf84d('0x4b'))){_0xc40dd5['limit']=qs[_0xf84d('0x30')](_0x32ee08[_0xf84d('0x43')][_0xf84d('0x30')]);_0xc40dd5[_0xf84d('0x2e')]=qs[_0xf84d('0x2e')](_0x32ee08[_0xf84d('0x43')][_0xf84d('0x2e')]);}_0xc40dd5[_0xf84d('0x4c')]=qs['sort'](_0x32ee08[_0xf84d('0x43')]['sort']);_0xc40dd5[_0xf84d('0x4f')]=qs[_0xf84d('0x44')](_[_0xf84d('0x65')](_0x32ee08[_0xf84d('0x43')],_0x5dc805[_0xf84d('0x44')]));_0xc40dd5['where']['ChatQueueId']=_0x24c750['id'];if(_0x32ee08[_0xf84d('0x43')]['filter']){_0xc40dd5['where']=_[_0xf84d('0x50')](_0xc40dd5[_0xf84d('0x4f')],{'$or':_[_0xf84d('0x3d')](_0xc40dd5[_0xf84d('0x48')],function(_0x5e7d9c){var _0xd58b0d={};_0xd58b0d[_0x5e7d9c]={'$like':'%'+_0x32ee08['query'][_0xf84d('0x4e')]+'%'};return _0xd58b0d;})});}_0xc40dd5=_[_0xf84d('0x50')]({},_0xc40dd5,_0x32ee08['options']);return db['UserChatQueue'][_0xf84d('0x66')](_0xc40dd5);}})[_0xf84d('0x37')](function(_0x50e64e){if(_0x50e64e){return db[_0xf84d('0x67')][_0xf84d('0x68')]({'where':{'id':_[_0xf84d('0x3d')](_0x50e64e,'UserId'),'role':'agent'},'attributes':['id',_0xf84d('0x3b'),'chatPause',_0xf84d('0x69'),_0xf84d('0x6a')]});}})['then'](function(_0x5d5056){if(_0x5d5056){return{'count':_0x5d5056[_0xf84d('0x31')],'rows':_[_0xf84d('0x3d')](_0x5d5056['rows'],function(_0x1dd524){return{'membername':_0x1dd524['name'],'UserId':_0x1dd524['id'],'queue_name':_0x5cb5ef['name'],'ChatQueueId':_0x5cb5ef['id'],'interface':util[_0xf84d('0x6b')]('%s/%s',_0xf84d('0x6c'),_0x1dd524[_0xf84d('0x3b')]),'penalty':0x0,'paused':_0x1dd524[_0xf84d('0x6d')],'createdAt':_0x1dd524[_0xf84d('0x6a')],'updatedAt':_0x1dd524[_0xf84d('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf84d('0x37')](respondWithFilteredResult(_0x42d04a,_0xc40dd5))[_0xf84d('0x2b')](handleError(_0x42d04a,null));};exports[_0xf84d('0x6e')]=function(_0x33e5d2,_0x1d54aa,_0x52e6ee){var _0x456694={};var _0x31c89f={};var _0xd177a3;var _0x3d3111;return db['ChatQueue'][_0xf84d('0x63')]({'where':{'id':_0x33e5d2['params']['id']}})[_0xf84d('0x37')](handleEntityNotFound(_0x1d54aa,null))[_0xf84d('0x37')](function(_0x32642a){if(_0x32642a){_0xd177a3=_0x32642a;_0x31c89f[_0xf84d('0x46')]=_[_0xf84d('0x42')](db[_0xf84d('0x6f')][_0xf84d('0x56')]);_0x31c89f[_0xf84d('0x43')]=_[_0xf84d('0x42')](_0x33e5d2[_0xf84d('0x43')]);_0x31c89f[_0xf84d('0x44')]=_[_0xf84d('0x45')](_0x31c89f['model'],_0x31c89f[_0xf84d('0x43')]);_0x456694[_0xf84d('0x48')]=_[_0xf84d('0x45')](_0x31c89f[_0xf84d('0x46')],qs['fields'](_0x33e5d2[_0xf84d('0x43')][_0xf84d('0x47')]));_0x456694[_0xf84d('0x48')]=_0x456694['attributes'][_0xf84d('0x49')]?_0x456694['attributes']:_0x31c89f[_0xf84d('0x46')];_0x456694[_0xf84d('0x4c')]=qs[_0xf84d('0x4d')](_0x33e5d2[_0xf84d('0x43')][_0xf84d('0x4d')]);_0x456694[_0xf84d('0x4f')]=qs[_0xf84d('0x44')](_[_0xf84d('0x65')](_0x33e5d2[_0xf84d('0x43')],_0x31c89f[_0xf84d('0x44')]));if(_0x33e5d2[_0xf84d('0x43')][_0xf84d('0x4e')]){_0x456694[_0xf84d('0x4f')]=_['merge'](_0x456694[_0xf84d('0x4f')],{'$or':_[_0xf84d('0x3d')](_0x456694[_0xf84d('0x48')],function(_0x3991c){var _0x1b5b10={};_0x1b5b10[_0x3991c]={'$like':'%'+_0x33e5d2['query']['filter']+'%'};return _0x1b5b10;})});}_0x456694=_[_0xf84d('0x50')]({},_0x456694,_0x33e5d2[_0xf84d('0x52')]);return _0xd177a3[_0xf84d('0x6e')](_0x456694);}})['then'](function(_0x309dce){if(_0x309dce){_0x3d3111=_0x309dce[_0xf84d('0x49')];if(!_0x33e5d2[_0xf84d('0x43')][_0xf84d('0x4a')](_0xf84d('0x4b'))){_0x456694[_0xf84d('0x30')]=qs['limit'](_0x33e5d2[_0xf84d('0x43')][_0xf84d('0x30')]);_0x456694[_0xf84d('0x2e')]=qs[_0xf84d('0x2e')](_0x33e5d2[_0xf84d('0x43')][_0xf84d('0x2e')]);}return _0xd177a3[_0xf84d('0x6e')](_0x456694);}})[_0xf84d('0x37')](function(_0x32e74c){if(_0x32e74c){return _0x32e74c?{'count':_0x3d3111,'rows':_0x32e74c}:null;}})['then'](respondWithResult(_0x1d54aa,null))[_0xf84d('0x2b')](handleError(_0x1d54aa,null));};exports[_0xf84d('0x70')]=function(_0xfadc18,_0x4e6a70,_0x353853){var _0x43de74=_0xfadc18['body'][_0xf84d('0x71')];return db[_0xf84d('0x6f')][_0xf84d('0x66')]({'where':{'id':_0x43de74},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf84d('0x72'),'attributes':['id',_0xf84d('0x3b'),'online',_0xf84d('0x73'),_0xf84d('0x74')],'raw':!![]}]})[_0xf84d('0x37')](function(_0x456035){if(_0x456035){var _0x4c55cb=_['flatMap'](_0x456035,function(_0x19d1b6){var _0x18d5d6=_0x19d1b6[_0xf84d('0x38')]({'plain':!![]});return _0x18d5d6['Agents'];});return db[_0xf84d('0x3e')][_0xf84d('0x5e')]({'where':{'id':_0xfadc18[_0xf84d('0x55')]['id']}})['then'](function(_0x335a91){return db[_0xf84d('0x75')][_0xf84d('0x76')](function(_0x165537){return _0x335a91[_0xf84d('0x70')](_0x43de74,{'transaction':_0x165537})[_0xf84d('0x37')](function(){return BPromise[_0xf84d('0x77')](_0x4c55cb,function(_0x486858){return db[_0xf84d('0x64')][_0xf84d('0x78')]({'where':{'UserId':_0x486858['id'],'ChatQueueId':_0xfadc18['params']['id']},'transaction':_0x165537});});})[_0xf84d('0x37')](function(){_0x4c55cb[_0xf84d('0x79')](function(_0xb3d8ee){socket[_0xf84d('0x7a')](_0xf84d('0x7b'),{'UserId':_0xb3d8ee['id'],'ChatQueueId':_0x335a91['id']});});});});});}})[_0xf84d('0x37')](respondWithStatusCode(_0x4e6a70,null))[_0xf84d('0x2b')](handleError(_0x4e6a70,null));};exports[_0xf84d('0x7c')]=function(_0x5efa9a,_0x53c24f,_0x32ab05){return db[_0xf84d('0x6f')][_0xf84d('0x66')]({'where':{'id':_0x5efa9a[_0xf84d('0x43')]['ids']},'attributes':['id'],'include':[{'model':db[_0xf84d('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf84d('0x37')](handleEntityNotFound(_0x53c24f,null))[_0xf84d('0x37')](function(_0x529d0c){var _0x535057=_['map'](_0x529d0c,'id');var _0x18f1ed=[];var _0x465c0a=[];var _0x32c1d4=squel['select']();_0x32c1d4[_0xf84d('0x7d')](_0xf84d('0x7e'))['from'](_0xf84d('0x7f'),'tq')[_0xf84d('0x80')](_0xf84d('0x81'),'ut',_0xf84d('0x82'))[_0xf84d('0x4f')](_0xf84d('0x83'),_0x5efa9a[_0xf84d('0x55')]['id']);for(var _0x2d276f=0x0;_0x2d276f<_0x529d0c['length'];_0x2d276f+=0x1){let _0x131142=_0x529d0c[_0x2d276f];for(var _0x2dcd10=0x0;_0x2dcd10<_0x131142['Agents']['length'];_0x2dcd10+=0x1){let _0x4e54e5=_0x131142[_0xf84d('0x72')][_0x2dcd10];var _0x1815e6=_0x32c1d4[_0xf84d('0x84')]();_0x1815e6[_0xf84d('0x4f')](_0xf84d('0x85'),_0x4e54e5['id']);_0x465c0a['push'](db['sequelize'][_0xf84d('0x43')](_0x1815e6[_0xf84d('0x86')](),{'type':db[_0xf84d('0x75')][_0xf84d('0x87')][_0xf84d('0x88')]})[_0xf84d('0x37')](function(_0x21d57d){if(_0x21d57d[_0xf84d('0x49')]===0x1){return _0x4e54e5['id'];}else{var _0x33269a=_['every'](_[_0xf84d('0x3d')](_0x21d57d,_0xf84d('0x89')),function(_0x10e43a){return _[_0xf84d('0x8a')](_0x535057,_0x10e43a);});if(_0x33269a){return _0x4e54e5['id'];}}}));}}return BPromise[_0xf84d('0x8b')](_0x465c0a)[_0xf84d('0x37')](function(_0x7aafed){_0x18f1ed=_(_0x18f1ed)['union'](_0x7aafed)['compact']()[_0xf84d('0x8c')]();return db[_0xf84d('0x3e')][_0xf84d('0x5e')]({'where':{'id':_0x5efa9a[_0xf84d('0x55')]['id']}})[_0xf84d('0x37')](function(_0x2fa043){return db[_0xf84d('0x75')]['transaction'](function(_0x4c403a){return _0x2fa043['removeTeams'](_0x5efa9a['query']['ids'],{'transaction':_0x4c403a})[_0xf84d('0x37')](function(){if(!_[_0xf84d('0x8d')](_0x18f1ed)){return _0x2fa043[_0xf84d('0x8e')](_0x18f1ed,{'transaction':_0x4c403a});}})[_0xf84d('0x37')](function(){_0x18f1ed[_0xf84d('0x79')](function(_0x273da0){socket[_0xf84d('0x7a')]('userChatQueue:remove',{'UserId':_0x273da0,'ChatQueueId':_0x2fa043['id']});});});});});});})['then'](respondWithStatusCode(_0x53c24f,null))['catch'](handleError(_0x53c24f,null));};exports['addAgents']=function(_0x281a9c,_0x3f354c,_0x4511ac){return db[_0xf84d('0x3e')][_0xf84d('0x5e')]({'where':{'id':_0x281a9c['params']['id']}})[_0xf84d('0x37')](handleEntityNotFound(_0x3f354c,null))[_0xf84d('0x37')](function(_0x1e7877){if(_0x1e7877){return _0x1e7877[_0xf84d('0x8f')](_0x281a9c[_0xf84d('0x59')][_0xf84d('0x71')],_[_0xf84d('0x90')](_0x281a9c[_0xf84d('0x59')],['ids','id'])||{})['spread'](function(_0x5163aa){for(var _0x134748=0x0;_0x134748<_0x281a9c[_0xf84d('0x59')][_0xf84d('0x71')][_0xf84d('0x49')];_0x134748+=0x1){socket['emit'](_0xf84d('0x7b'),{'UserId':Number(_0x281a9c[_0xf84d('0x59')][_0xf84d('0x71')][_0x134748]),'ChatQueueId':Number(_0x281a9c[_0xf84d('0x55')]['id'])});}return _0x5163aa;});}})[_0xf84d('0x37')](respondWithResult(_0x3f354c,null))['catch'](handleError(_0x3f354c,null));};exports[_0xf84d('0x8e')]=function(_0x1145d6,_0x2de88b,_0x2d6a5b){return db['ChatQueue'][_0xf84d('0x5e')]({'where':{'id':_0x1145d6['params']['id']}})[_0xf84d('0x37')](handleEntityNotFound(_0x2de88b,null))[_0xf84d('0x37')](function(_0x472081){if(_0x472081){return _0x472081[_0xf84d('0x8e')](_0x1145d6[_0xf84d('0x43')]['ids'])['then'](function(){if(_[_0xf84d('0x91')](_0x1145d6['query'][_0xf84d('0x71')])){for(var _0xc29319=0x0;_0xc29319<_0x1145d6[_0xf84d('0x43')][_0xf84d('0x71')][_0xf84d('0x49')];_0xc29319+=0x1){socket['emit'](_0xf84d('0x92'),{'UserId':Number(_0x1145d6['query']['ids'][_0xc29319]),'ChatQueueId':Number(_0x1145d6[_0xf84d('0x55')]['id'])});}}else{socket[_0xf84d('0x7a')](_0xf84d('0x92'),{'UserId':Number(_0x1145d6[_0xf84d('0x43')]['ids']),'ChatQueueId':Number(_0x1145d6['params']['id'])});}});}})[_0xf84d('0x37')](respondWithStatusCode(_0x2de88b,null))[_0xf84d('0x2b')](handleError(_0x2de88b,null));};exports['getAgents']=function(_0x4fd775,_0x4aa766,_0x51b3a1){var _0x54744f={};var _0x1dc67a={};var _0x4238c8;var _0x9cd907;return db[_0xf84d('0x3e')][_0xf84d('0x63')]({'where':{'id':_0x4fd775[_0xf84d('0x55')]['id']}})[_0xf84d('0x37')](handleEntityNotFound(_0x4aa766,null))[_0xf84d('0x37')](function(_0x13587d){if(_0x13587d){_0x4238c8=_0x13587d;_0x1dc67a[_0xf84d('0x46')]=_[_0xf84d('0x42')](db[_0xf84d('0x67')][_0xf84d('0x56')]);_0x1dc67a['query']=_[_0xf84d('0x42')](_0x4fd775[_0xf84d('0x43')]);_0x1dc67a[_0xf84d('0x44')]=_[_0xf84d('0x45')](_0x1dc67a[_0xf84d('0x46')],_0x1dc67a['query']);_0x54744f[_0xf84d('0x48')]=_[_0xf84d('0x45')](_0x1dc67a['model'],qs[_0xf84d('0x47')](_0x4fd775[_0xf84d('0x43')][_0xf84d('0x47')]));_0x54744f[_0xf84d('0x48')]=_0x54744f[_0xf84d('0x48')][_0xf84d('0x49')]?_0x54744f[_0xf84d('0x48')]:_0x1dc67a[_0xf84d('0x46')];_0x54744f[_0xf84d('0x4c')]=qs[_0xf84d('0x4d')](_0x4fd775[_0xf84d('0x43')][_0xf84d('0x4d')]);_0x54744f[_0xf84d('0x4f')]=qs[_0xf84d('0x44')](_[_0xf84d('0x65')](_0x4fd775[_0xf84d('0x43')],_0x1dc67a[_0xf84d('0x44')]));if(_0x4fd775[_0xf84d('0x43')]['filter']){_0x54744f[_0xf84d('0x4f')]=_[_0xf84d('0x50')](_0x54744f[_0xf84d('0x4f')],{'$or':_['map'](_0x54744f[_0xf84d('0x48')],function(_0x1a8da0){var _0x45a3b6={};_0x45a3b6[_0x1a8da0]={'$like':'%'+_0x4fd775[_0xf84d('0x43')][_0xf84d('0x4e')]+'%'};return _0x45a3b6;})});}_0x54744f=_[_0xf84d('0x50')]({},_0x54744f,_0x4fd775[_0xf84d('0x52')]);return _0x4238c8[_0xf84d('0x93')](_0x54744f);}})['then'](function(_0x37dadb){if(_0x37dadb){_0x9cd907=_0x37dadb[_0xf84d('0x49')];if(!_0x4fd775[_0xf84d('0x43')]['hasOwnProperty'](_0xf84d('0x4b'))){_0x54744f[_0xf84d('0x30')]=qs[_0xf84d('0x30')](_0x4fd775['query'][_0xf84d('0x30')]);_0x54744f[_0xf84d('0x2e')]=qs['offset'](_0x4fd775[_0xf84d('0x43')][_0xf84d('0x2e')]);}return _0x4238c8['getAgents'](_0x54744f);}})[_0xf84d('0x37')](function(_0xea36cf){if(_0xea36cf){return _0xea36cf?{'count':_0x9cd907,'rows':_0xea36cf}:null;}})['then'](respondWithResult(_0x4aa766,null))['catch'](handleError(_0x4aa766,null));}; \ No newline at end of file +var _0x609e=['getTeams','Team','addTeams','ids','Agents','interface','flatMap','transaction','each','forEach','emit','userChatQueue:save','removeTeams','select','tq.TeamId','team_has_chat_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','sequelize','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','addAgents','isArray','userChatQueue:remove','getAgents','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','get','ChatQueues','destroy','stack','name','ChatQueue','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','show','params','keys','length','find','create','body','role','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','UserChatQueue','pick','ChatQueueId','User','UserId','agent','chatPause','updatedAt','%s/%s','SIP','createdAt'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x609e,0x145));var _0xe609=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x609e[_0x33032e];return _0x13316b;};'use strict';var emlformat=require(_0xe609('0x0'));var rimraf=require(_0xe609('0x1'));var zipdir=require(_0xe609('0x2'));var jsonpatch=require(_0xe609('0x3'));var rp=require(_0xe609('0x4'));var moment=require(_0xe609('0x5'));var BPromise=require(_0xe609('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe609('0x7'));var sox=require(_0xe609('0x8'));var csv=require(_0xe609('0x9'));var ejs=require(_0xe609('0xa'));var fs=require('fs');var fs_extra=require(_0xe609('0xb'));var _=require('lodash');var squel=require(_0xe609('0xc'));var crypto=require(_0xe609('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe609('0xe'));var toCsv=require(_0xe609('0x9'));var querystring=require(_0xe609('0xf'));var Papa=require(_0xe609('0x10'));var Redis=require(_0xe609('0x11'));var authService=require(_0xe609('0x12'));var qs=require(_0xe609('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe609('0x14'));var logger=require(_0xe609('0x15'))(_0xe609('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe609('0x17'));var db=require(_0xe609('0x18'))['db'];config[_0xe609('0x19')]=_[_0xe609('0x1a')](config['redis'],{'host':_0xe609('0x1b'),'port':0x18eb});var socket=require(_0xe609('0x1c'))(new Redis(config['redis']));require(_0xe609('0x1d'))[_0xe609('0x1e')](socket);var jayson=require(_0xe609('0x1f'));var client=jayson[_0xe609('0x20')][_0xe609('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x58f012,_0x4366bf,_0x5ce4c3,_0x3751d8){return new BPromise(function(_0x3b62d2,_0x24100a){var _0x38f10c=_0x3751d8||client;return _0x38f10c[_0xe609('0x22')](_0x58f012,_0x5ce4c3)[_0xe609('0x23')](function(_0x2a5357){logger[_0xe609('0x24')]('ChatQueue,\x20%s,\x20%s',_0x4366bf,_0xe609('0x25'));logger[_0xe609('0x26')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x4366bf,_0xe609('0x25'),JSON[_0xe609('0x27')](_0x2a5357));if(_0x2a5357[_0xe609('0x28')]){if(_0x2a5357['error'][_0xe609('0x29')]===0x1f4){logger[_0xe609('0x28')](_0xe609('0x2a'),_0x4366bf,_0x2a5357[_0xe609('0x28')][_0xe609('0x2b')]);return _0x24100a(_0x2a5357[_0xe609('0x28')]['message']);}logger[_0xe609('0x28')](_0xe609('0x2a'),_0x4366bf,_0x2a5357['error'][_0xe609('0x2b')]);return _0x3b62d2(_0x2a5357[_0xe609('0x28')][_0xe609('0x2b')]);}else{logger[_0xe609('0x24')](_0xe609('0x2a'),_0x4366bf,_0xe609('0x25'));_0x3b62d2(_0x2a5357[_0xe609('0x2c')]['message']);}})[_0xe609('0x2d')](function(_0x5b4b01){logger[_0xe609('0x28')](_0xe609('0x2a'),_0x4366bf,_0x5b4b01);_0x24100a(_0x5b4b01);});});}function respondWithStatusCode(_0x3290a3,_0x35a7e9){_0x35a7e9=_0x35a7e9||0xcc;return function(_0x4d0094){if(_0x4d0094){return _0x3290a3[_0xe609('0x2e')](_0x35a7e9);}return _0x3290a3[_0xe609('0x2f')](_0x35a7e9)[_0xe609('0x30')]();};}function respondWithResult(_0x47dedc,_0x117c89){_0x117c89=_0x117c89||0xc8;return function(_0x124aef){if(_0x124aef){return _0x47dedc[_0xe609('0x2f')](_0x117c89)['json'](_0x124aef);}};}function respondWithFilteredResult(_0x4f7bad,_0xf69f5c){return function(_0x28eaff){if(_0x28eaff){var _0x3cd864=typeof _0xf69f5c[_0xe609('0x31')]===_0xe609('0x32')&&typeof _0xf69f5c[_0xe609('0x33')]===_0xe609('0x32');var _0x42685b=_0x28eaff[_0xe609('0x34')];var _0xf05f43=_0x3cd864?0x0:_0xf69f5c[_0xe609('0x31')];var _0x23ed15=_0x3cd864?_0x28eaff[_0xe609('0x34')]:_0xf69f5c[_0xe609('0x31')]+_0xf69f5c[_0xe609('0x33')];var _0x8a4f0d;if(_0x23ed15>=_0x42685b){_0x23ed15=_0x42685b;_0x8a4f0d=0xc8;}else{_0x8a4f0d=0xce;}_0x4f7bad[_0xe609('0x2f')](_0x8a4f0d);return _0x4f7bad[_0xe609('0x35')](_0xe609('0x36'),_0xf05f43+'-'+_0x23ed15+'/'+_0x42685b)[_0xe609('0x37')](_0x28eaff);}return null;};}function patchUpdates(_0x16ae7a){return function(_0x51f229){try{jsonpatch['apply'](_0x51f229,_0x16ae7a,!![]);}catch(_0x560b1c){return BPromise['reject'](_0x560b1c);}return _0x51f229['save']();};}function saveUpdates(_0x21b519,_0x5a8fe5){return function(_0x4db53f){if(_0x4db53f){return _0x4db53f[_0xe609('0x38')](_0x21b519)[_0xe609('0x23')](function(_0x39ea31){return _0x39ea31;});}return null;};}function removeEntity(_0x4524f3,_0x453efd){return function(_0x32d8c1){if(_0x32d8c1){return _0x32d8c1['destroy']()[_0xe609('0x23')](function(){var _0x32f7b0=_0x32d8c1[_0xe609('0x39')]({'plain':!![]});var _0x25101f=_0xe609('0x3a');return db['UserProfileResource'][_0xe609('0x3b')]({'where':{'type':_0x25101f,'resourceId':_0x32f7b0['id']}})['then'](function(){return _0x32d8c1;});})[_0xe609('0x23')](function(){_0x4524f3['status'](0xcc)[_0xe609('0x30')]();});}};}function handleEntityNotFound(_0x5a50f9,_0x1cfd5c){return function(_0x11fc9f){if(!_0x11fc9f){_0x5a50f9[_0xe609('0x2e')](0x194);}return _0x11fc9f;};}function handleError(_0x27e705,_0x59e089){_0x59e089=_0x59e089||0x1f4;return function(_0x5afa21){logger[_0xe609('0x28')](_0x5afa21[_0xe609('0x3c')]);if(_0x5afa21[_0xe609('0x3d')]){delete _0x5afa21['name'];}_0x27e705['status'](_0x59e089)['send'](_0x5afa21);};}exports['index']=function(_0xb0ee27,_0xb4f78d){var _0xda4ca6={},_0x3d0c21={},_0x41bbd4={'count':0x0,'rows':[]};var _0x53d854=_['map'](db[_0xe609('0x3e')][_0xe609('0x3f')],function(_0x52d5dc){return{'name':_0x52d5dc[_0xe609('0x40')],'type':_0x52d5dc[_0xe609('0x41')][_0xe609('0x42')]};});_0x3d0c21[_0xe609('0x43')]=_[_0xe609('0x44')](_0x53d854,'name');_0x3d0c21[_0xe609('0x45')]=_['keys'](_0xb0ee27['query']);_0x3d0c21[_0xe609('0x46')]=_[_0xe609('0x47')](_0x3d0c21[_0xe609('0x43')],_0x3d0c21[_0xe609('0x45')]);_0xda4ca6['attributes']=_[_0xe609('0x47')](_0x3d0c21[_0xe609('0x43')],qs[_0xe609('0x48')](_0xb0ee27[_0xe609('0x45')][_0xe609('0x48')]));_0xda4ca6[_0xe609('0x49')]=_0xda4ca6[_0xe609('0x49')]['length']?_0xda4ca6[_0xe609('0x49')]:_0x3d0c21[_0xe609('0x43')];if(!_0xb0ee27[_0xe609('0x45')][_0xe609('0x4a')](_0xe609('0x4b'))){_0xda4ca6[_0xe609('0x33')]=qs[_0xe609('0x33')](_0xb0ee27[_0xe609('0x45')][_0xe609('0x33')]);_0xda4ca6[_0xe609('0x31')]=qs[_0xe609('0x31')](_0xb0ee27[_0xe609('0x45')][_0xe609('0x31')]);}_0xda4ca6[_0xe609('0x4c')]=qs[_0xe609('0x4d')](_0xb0ee27[_0xe609('0x45')][_0xe609('0x4d')]);_0xda4ca6[_0xe609('0x4e')]=qs[_0xe609('0x46')](_['pick'](_0xb0ee27[_0xe609('0x45')],_0x3d0c21[_0xe609('0x46')]),_0x53d854);if(_0xb0ee27[_0xe609('0x45')]['filter']){_0xda4ca6[_0xe609('0x4e')]=_[_0xe609('0x4f')](_0xda4ca6[_0xe609('0x4e')],{'$or':_[_0xe609('0x44')](_0x53d854,function(_0x4a5993){if(_0x4a5993[_0xe609('0x41')]!=='VIRTUAL'){var _0x2ac550={};_0x2ac550[_0x4a5993[_0xe609('0x3d')]]={'$like':'%'+_0xb0ee27[_0xe609('0x45')][_0xe609('0x50')]+'%'};return _0x2ac550;}})});}_0xda4ca6=_['merge']({},_0xda4ca6,_0xb0ee27[_0xe609('0x51')]);var _0x24c03c={'where':_0xda4ca6[_0xe609('0x4e')]};return db[_0xe609('0x3e')][_0xe609('0x34')](_0x24c03c)[_0xe609('0x23')](function(_0xd33e35){_0x41bbd4[_0xe609('0x34')]=_0xd33e35;if(_0xb0ee27[_0xe609('0x45')][_0xe609('0x52')]){_0xda4ca6[_0xe609('0x53')]=[{'all':!![]}];}return db[_0xe609('0x3e')][_0xe609('0x54')](_0xda4ca6);})[_0xe609('0x23')](function(_0x1f1cca){_0x41bbd4[_0xe609('0x55')]=_0x1f1cca;return _0x41bbd4;})[_0xe609('0x23')](respondWithFilteredResult(_0xb4f78d,_0xda4ca6))[_0xe609('0x2d')](handleError(_0xb4f78d,null));};exports[_0xe609('0x56')]=function(_0x35a864,_0x54e787){var _0x148c83={'raw':!![],'where':{'id':_0x35a864[_0xe609('0x57')]['id']}},_0x541ed3={};_0x541ed3[_0xe609('0x43')]=_[_0xe609('0x58')](db[_0xe609('0x3e')][_0xe609('0x3f')]);_0x541ed3['query']=_[_0xe609('0x58')](_0x35a864[_0xe609('0x45')]);_0x541ed3['filters']=_[_0xe609('0x47')](_0x541ed3[_0xe609('0x43')],_0x541ed3[_0xe609('0x45')]);_0x148c83[_0xe609('0x49')]=_[_0xe609('0x47')](_0x541ed3[_0xe609('0x43')],qs[_0xe609('0x48')](_0x35a864[_0xe609('0x45')]['fields']));_0x148c83[_0xe609('0x49')]=_0x148c83[_0xe609('0x49')][_0xe609('0x59')]?_0x148c83[_0xe609('0x49')]:_0x541ed3['model'];if(_0x35a864[_0xe609('0x45')]['includeAll']){_0x148c83[_0xe609('0x53')]=[{'all':!![]}];}_0x148c83=_[_0xe609('0x4f')]({},_0x148c83,_0x35a864['options']);return db[_0xe609('0x3e')][_0xe609('0x5a')](_0x148c83)[_0xe609('0x23')](handleEntityNotFound(_0x54e787,null))['then'](respondWithResult(_0x54e787,null))['catch'](handleError(_0x54e787,null));};exports['create']=function(_0x213216,_0x3e67a5){return db[_0xe609('0x3e')][_0xe609('0x5b')](_0x213216[_0xe609('0x5c')],{})[_0xe609('0x23')](function(_0x2cd944){var _0x26f24f=_0x213216['user'][_0xe609('0x39')]({'plain':!![]});if(!_0x26f24f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26f24f[_0xe609('0x5d')]==='user'){var _0x341bb1=_0x2cd944[_0xe609('0x39')]({'plain':!![]});var _0xddbd9e='ChatQueues';return db['UserProfileSection'][_0xe609('0x5a')]({'where':{'name':_0xddbd9e,'userProfileId':_0x26f24f[_0xe609('0x5e')]},'raw':!![]})[_0xe609('0x23')](function(_0x20fb26){if(_0x20fb26&&_0x20fb26[_0xe609('0x5f')]===0x0){return db[_0xe609('0x60')][_0xe609('0x5b')]({'name':_0x341bb1[_0xe609('0x3d')],'resourceId':_0x341bb1['id'],'type':_0x20fb26[_0xe609('0x3d')],'sectionId':_0x20fb26['id']},{})[_0xe609('0x23')](function(){return _0x2cd944;});}else{return _0x2cd944;}})[_0xe609('0x2d')](function(_0x30f1fc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30f1fc);throw _0x30f1fc;});}return _0x2cd944;})[_0xe609('0x23')](respondWithResult(_0x3e67a5,0xc9))[_0xe609('0x2d')](handleError(_0x3e67a5,null));};exports['update']=function(_0x32d7c4,_0x31ff1f){if(_0x32d7c4[_0xe609('0x5c')]['id']){delete _0x32d7c4[_0xe609('0x5c')]['id'];}return db['ChatQueue']['find']({'where':{'id':_0x32d7c4['params']['id']}})[_0xe609('0x23')](handleEntityNotFound(_0x31ff1f,null))['then'](saveUpdates(_0x32d7c4[_0xe609('0x5c')],null))[_0xe609('0x23')](respondWithResult(_0x31ff1f,null))[_0xe609('0x2d')](handleError(_0x31ff1f,null));};exports[_0xe609('0x3b')]=function(_0x45df9f,_0x4505be){return db[_0xe609('0x3e')][_0xe609('0x5a')]({'where':{'id':_0x45df9f[_0xe609('0x57')]['id']}})[_0xe609('0x23')](handleEntityNotFound(_0x4505be,null))[_0xe609('0x23')](removeEntity(_0x4505be,null))[_0xe609('0x2d')](handleError(_0x4505be,null));};exports[_0xe609('0x61')]=function(_0x248ff8,_0x1b62fb){return db[_0xe609('0x3e')][_0xe609('0x61')]()['then'](respondWithResult(_0x1b62fb,null))[_0xe609('0x2d')](handleError(_0x1b62fb,null));};exports[_0xe609('0x62')]=function(_0x26a6bc,_0x3e31ff,_0x1e18ef){var _0x4c5364={'raw':!![],'where':{}},_0x2cb25f={},_0x564123;return db[_0xe609('0x3e')]['findOne']({'where':{'id':_0x26a6bc[_0xe609('0x57')]['id']}})['then'](handleEntityNotFound(_0x3e31ff,null))[_0xe609('0x23')](function(_0x4291c4){if(_0x4291c4){_0x564123=_0x4291c4[_0xe609('0x39')]({'plain':!![]});_0x2cb25f[_0xe609('0x43')]=_[_0xe609('0x58')](db[_0xe609('0x63')]['rawAttributes']);_0x2cb25f[_0xe609('0x45')]=_[_0xe609('0x58')](_0x26a6bc[_0xe609('0x45')]);_0x2cb25f[_0xe609('0x46')]=_[_0xe609('0x47')](_0x2cb25f[_0xe609('0x43')],_0x2cb25f[_0xe609('0x45')]);_0x4c5364['attributes']=_[_0xe609('0x47')](_0x2cb25f['model'],qs[_0xe609('0x48')](_0x26a6bc[_0xe609('0x45')][_0xe609('0x48')]));_0x4c5364[_0xe609('0x49')]=_0x4c5364[_0xe609('0x49')][_0xe609('0x59')]?_0x4c5364[_0xe609('0x49')]:_0x2cb25f['model'];if(!_0x26a6bc[_0xe609('0x45')][_0xe609('0x4a')]('nolimit')){_0x4c5364[_0xe609('0x33')]=qs['limit'](_0x26a6bc['query']['limit']);_0x4c5364['offset']=qs['offset'](_0x26a6bc[_0xe609('0x45')]['offset']);}_0x4c5364[_0xe609('0x4c')]=qs[_0xe609('0x4d')](_0x26a6bc[_0xe609('0x45')][_0xe609('0x4d')]);_0x4c5364[_0xe609('0x4e')]=qs[_0xe609('0x46')](_[_0xe609('0x64')](_0x26a6bc[_0xe609('0x45')],_0x2cb25f['filters']));_0x4c5364['where'][_0xe609('0x65')]=_0x4291c4['id'];if(_0x26a6bc[_0xe609('0x45')][_0xe609('0x50')]){_0x4c5364[_0xe609('0x4e')]=_[_0xe609('0x4f')](_0x4c5364[_0xe609('0x4e')],{'$or':_[_0xe609('0x44')](_0x4c5364[_0xe609('0x49')],function(_0x359a4a){var _0x28f72a={};_0x28f72a[_0x359a4a]={'$like':'%'+_0x26a6bc[_0xe609('0x45')][_0xe609('0x50')]+'%'};return _0x28f72a;})});}_0x4c5364=_[_0xe609('0x4f')]({},_0x4c5364,_0x26a6bc['options']);return db[_0xe609('0x63')][_0xe609('0x54')](_0x4c5364);}})[_0xe609('0x23')](function(_0x2e7ef2){if(_0x2e7ef2){return db[_0xe609('0x66')]['findAndCountAll']({'where':{'id':_[_0xe609('0x44')](_0x2e7ef2,_0xe609('0x67')),'role':_0xe609('0x68')},'attributes':['id',_0xe609('0x3d'),_0xe609('0x69'),_0xe609('0x6a'),'createdAt']});}})[_0xe609('0x23')](function(_0x8fc5db){if(_0x8fc5db){return{'count':_0x8fc5db[_0xe609('0x34')],'rows':_[_0xe609('0x44')](_0x8fc5db[_0xe609('0x55')],function(_0x39ef96){return{'membername':_0x39ef96[_0xe609('0x3d')],'UserId':_0x39ef96['id'],'queue_name':_0x564123[_0xe609('0x3d')],'ChatQueueId':_0x564123['id'],'interface':util['format'](_0xe609('0x6b'),_0xe609('0x6c'),_0x39ef96[_0xe609('0x3d')]),'penalty':0x0,'paused':_0x39ef96['chatPause'],'createdAt':_0x39ef96[_0xe609('0x6d')],'updatedAt':_0x39ef96['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe609('0x23')](respondWithFilteredResult(_0x3e31ff,_0x4c5364))[_0xe609('0x2d')](handleError(_0x3e31ff,null));};exports[_0xe609('0x6e')]=function(_0x39ce59,_0x17cabe,_0x1338e7){var _0x3da850={};var _0x586c87={};var _0x50e232;var _0x58e236;return db[_0xe609('0x3e')]['findOne']({'where':{'id':_0x39ce59[_0xe609('0x57')]['id']}})[_0xe609('0x23')](handleEntityNotFound(_0x17cabe,null))[_0xe609('0x23')](function(_0x5ee6df){if(_0x5ee6df){_0x50e232=_0x5ee6df;_0x586c87[_0xe609('0x43')]=_['keys'](db[_0xe609('0x6f')]['rawAttributes']);_0x586c87[_0xe609('0x45')]=_[_0xe609('0x58')](_0x39ce59[_0xe609('0x45')]);_0x586c87['filters']=_[_0xe609('0x47')](_0x586c87['model'],_0x586c87[_0xe609('0x45')]);_0x3da850[_0xe609('0x49')]=_[_0xe609('0x47')](_0x586c87[_0xe609('0x43')],qs[_0xe609('0x48')](_0x39ce59[_0xe609('0x45')]['fields']));_0x3da850[_0xe609('0x49')]=_0x3da850[_0xe609('0x49')][_0xe609('0x59')]?_0x3da850[_0xe609('0x49')]:_0x586c87[_0xe609('0x43')];_0x3da850[_0xe609('0x4c')]=qs[_0xe609('0x4d')](_0x39ce59['query'][_0xe609('0x4d')]);_0x3da850[_0xe609('0x4e')]=qs[_0xe609('0x46')](_[_0xe609('0x64')](_0x39ce59[_0xe609('0x45')],_0x586c87[_0xe609('0x46')]));if(_0x39ce59[_0xe609('0x45')][_0xe609('0x50')]){_0x3da850['where']=_[_0xe609('0x4f')](_0x3da850[_0xe609('0x4e')],{'$or':_[_0xe609('0x44')](_0x3da850['attributes'],function(_0x508e64){var _0x540b72={};_0x540b72[_0x508e64]={'$like':'%'+_0x39ce59[_0xe609('0x45')][_0xe609('0x50')]+'%'};return _0x540b72;})});}_0x3da850=_[_0xe609('0x4f')]({},_0x3da850,_0x39ce59[_0xe609('0x51')]);return _0x50e232[_0xe609('0x6e')](_0x3da850);}})[_0xe609('0x23')](function(_0x1a4a07){if(_0x1a4a07){_0x58e236=_0x1a4a07['length'];if(!_0x39ce59[_0xe609('0x45')][_0xe609('0x4a')](_0xe609('0x4b'))){_0x3da850[_0xe609('0x33')]=qs[_0xe609('0x33')](_0x39ce59[_0xe609('0x45')][_0xe609('0x33')]);_0x3da850[_0xe609('0x31')]=qs[_0xe609('0x31')](_0x39ce59[_0xe609('0x45')][_0xe609('0x31')]);}return _0x50e232[_0xe609('0x6e')](_0x3da850);}})[_0xe609('0x23')](function(_0xef4343){if(_0xef4343){return _0xef4343?{'count':_0x58e236,'rows':_0xef4343}:null;}})[_0xe609('0x23')](respondWithResult(_0x17cabe,null))[_0xe609('0x2d')](handleError(_0x17cabe,null));};exports[_0xe609('0x70')]=function(_0x456af8,_0x4f2e31,_0x5e2afd){var _0x585b93=_0x456af8[_0xe609('0x5c')][_0xe609('0x71')];return db['Team'][_0xe609('0x54')]({'where':{'id':_0x585b93},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe609('0x72'),'attributes':['id',_0xe609('0x3d'),'online','voicePause',_0xe609('0x73')],'raw':!![]}]})[_0xe609('0x23')](function(_0x1697d0){if(_0x1697d0){var _0x4317d1=_[_0xe609('0x74')](_0x1697d0,function(_0x43011c){var _0xbbbb48=_0x43011c['get']({'plain':!![]});return _0xbbbb48[_0xe609('0x72')];});return db['ChatQueue'][_0xe609('0x5a')]({'where':{'id':_0x456af8[_0xe609('0x57')]['id']}})[_0xe609('0x23')](function(_0x1cf071){return db['sequelize'][_0xe609('0x75')](function(_0x38dcd2){return _0x1cf071[_0xe609('0x70')](_0x585b93,{'transaction':_0x38dcd2})[_0xe609('0x23')](function(){return BPromise[_0xe609('0x76')](_0x4317d1,function(_0x11aebf){return db[_0xe609('0x63')]['findOrCreate']({'where':{'UserId':_0x11aebf['id'],'ChatQueueId':_0x456af8['params']['id']},'transaction':_0x38dcd2});});})[_0xe609('0x23')](function(){_0x4317d1[_0xe609('0x77')](function(_0x45baa4){socket[_0xe609('0x78')](_0xe609('0x79'),{'UserId':_0x45baa4['id'],'ChatQueueId':_0x1cf071['id']});});});});});}})['then'](respondWithStatusCode(_0x4f2e31,null))['catch'](handleError(_0x4f2e31,null));};exports[_0xe609('0x7a')]=function(_0x32f277,_0x510a4e,_0x393744){return db[_0xe609('0x6f')]['findAll']({'where':{'id':_0x32f277[_0xe609('0x45')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe609('0x23')](handleEntityNotFound(_0x510a4e,null))[_0xe609('0x23')](function(_0x25e123){var _0x3f03f7=_[_0xe609('0x44')](_0x25e123,'id');var _0x3878f7=[];var _0x383ab0=[];var _0x553ad1=squel[_0xe609('0x7b')]();_0x553ad1['field'](_0xe609('0x7c'))['from'](_0xe609('0x7d'),'tq')[_0xe609('0x7e')](_0xe609('0x7f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe609('0x4e')]('ChatQueueId\x20=\x20?',_0x32f277[_0xe609('0x57')]['id']);for(var _0x31335c=0x0;_0x31335c<_0x25e123[_0xe609('0x59')];_0x31335c+=0x1){let _0x51f9a1=_0x25e123[_0x31335c];for(var _0x2972e2=0x0;_0x2972e2<_0x51f9a1[_0xe609('0x72')][_0xe609('0x59')];_0x2972e2+=0x1){let _0x262ec6=_0x51f9a1[_0xe609('0x72')][_0x2972e2];var _0x1e55b2=_0x553ad1[_0xe609('0x80')]();_0x1e55b2[_0xe609('0x4e')](_0xe609('0x81'),_0x262ec6['id']);_0x383ab0[_0xe609('0x82')](db[_0xe609('0x83')][_0xe609('0x45')](_0x1e55b2['toString'](),{'type':db['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x462034){if(_0x462034[_0xe609('0x59')]===0x1){return _0x262ec6['id'];}else{var _0x5d4514=_[_0xe609('0x84')](_[_0xe609('0x44')](_0x462034,_0xe609('0x85')),function(_0x2d092b){return _[_0xe609('0x86')](_0x3f03f7,_0x2d092b);});if(_0x5d4514){return _0x262ec6['id'];}}}));}}return BPromise[_0xe609('0x87')](_0x383ab0)[_0xe609('0x23')](function(_0x3b538c){_0x3878f7=_(_0x3878f7)[_0xe609('0x88')](_0x3b538c)[_0xe609('0x89')]()['value']();return db['ChatQueue'][_0xe609('0x5a')]({'where':{'id':_0x32f277[_0xe609('0x57')]['id']}})[_0xe609('0x23')](function(_0x1462d4){return db[_0xe609('0x83')][_0xe609('0x75')](function(_0x13dcb8){return _0x1462d4['removeTeams'](_0x32f277[_0xe609('0x45')][_0xe609('0x71')],{'transaction':_0x13dcb8})[_0xe609('0x23')](function(){if(!_[_0xe609('0x8a')](_0x3878f7)){return _0x1462d4[_0xe609('0x8b')](_0x3878f7,{'transaction':_0x13dcb8});}})[_0xe609('0x23')](function(){_0x3878f7['forEach'](function(_0x296925){socket[_0xe609('0x78')]('userChatQueue:remove',{'UserId':_0x296925,'ChatQueueId':_0x1462d4['id']});});});});});});})[_0xe609('0x23')](respondWithStatusCode(_0x510a4e,null))[_0xe609('0x2d')](handleError(_0x510a4e,null));};exports[_0xe609('0x8c')]=function(_0x5dc4ce,_0x1d64a7,_0x22cfef){return db[_0xe609('0x3e')][_0xe609('0x5a')]({'where':{'id':_0x5dc4ce['params']['id']}})['then'](handleEntityNotFound(_0x1d64a7,null))['then'](function(_0x168a59){if(_0x168a59){return _0x168a59[_0xe609('0x8c')](_0x5dc4ce['body'][_0xe609('0x71')],_['omit'](_0x5dc4ce[_0xe609('0x5c')],['ids','id'])||{})['spread'](function(_0x37401f){for(var _0x3ac3fe=0x0;_0x3ac3fe<_0x5dc4ce[_0xe609('0x5c')]['ids'][_0xe609('0x59')];_0x3ac3fe+=0x1){socket[_0xe609('0x78')](_0xe609('0x79'),{'UserId':Number(_0x5dc4ce['body'][_0xe609('0x71')][_0x3ac3fe]),'ChatQueueId':Number(_0x5dc4ce[_0xe609('0x57')]['id'])});}return _0x37401f;});}})['then'](respondWithResult(_0x1d64a7,null))['catch'](handleError(_0x1d64a7,null));};exports[_0xe609('0x8b')]=function(_0x280879,_0x559a9b,_0x4338c6){return db['ChatQueue'][_0xe609('0x5a')]({'where':{'id':_0x280879['params']['id']}})[_0xe609('0x23')](handleEntityNotFound(_0x559a9b,null))[_0xe609('0x23')](function(_0x587373){if(_0x587373){return _0x587373[_0xe609('0x8b')](_0x280879[_0xe609('0x45')][_0xe609('0x71')])[_0xe609('0x23')](function(){if(_[_0xe609('0x8d')](_0x280879[_0xe609('0x45')][_0xe609('0x71')])){for(var _0x1e067f=0x0;_0x1e067f<_0x280879[_0xe609('0x45')]['ids']['length'];_0x1e067f+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x280879[_0xe609('0x45')]['ids'][_0x1e067f]),'ChatQueueId':Number(_0x280879[_0xe609('0x57')]['id'])});}}else{socket['emit'](_0xe609('0x8e'),{'UserId':Number(_0x280879[_0xe609('0x45')][_0xe609('0x71')]),'ChatQueueId':Number(_0x280879[_0xe609('0x57')]['id'])});}});}})[_0xe609('0x23')](respondWithStatusCode(_0x559a9b,null))[_0xe609('0x2d')](handleError(_0x559a9b,null));};exports[_0xe609('0x8f')]=function(_0x378d7f,_0x219914,_0x5af955){var _0x4be6a0={};var _0x1b0538={};var _0x1d6327;var _0x18b9f8;return db['ChatQueue'][_0xe609('0x90')]({'where':{'id':_0x378d7f[_0xe609('0x57')]['id']}})['then'](handleEntityNotFound(_0x219914,null))[_0xe609('0x23')](function(_0xa8e664){if(_0xa8e664){_0x1d6327=_0xa8e664;_0x1b0538['model']=_[_0xe609('0x58')](db[_0xe609('0x66')][_0xe609('0x3f')]);_0x1b0538[_0xe609('0x45')]=_['keys'](_0x378d7f[_0xe609('0x45')]);_0x1b0538[_0xe609('0x46')]=_[_0xe609('0x47')](_0x1b0538[_0xe609('0x43')],_0x1b0538['query']);_0x4be6a0['attributes']=_[_0xe609('0x47')](_0x1b0538['model'],qs[_0xe609('0x48')](_0x378d7f[_0xe609('0x45')][_0xe609('0x48')]));_0x4be6a0[_0xe609('0x49')]=_0x4be6a0[_0xe609('0x49')][_0xe609('0x59')]?_0x4be6a0[_0xe609('0x49')]:_0x1b0538['model'];_0x4be6a0[_0xe609('0x4c')]=qs[_0xe609('0x4d')](_0x378d7f['query'][_0xe609('0x4d')]);_0x4be6a0[_0xe609('0x4e')]=qs[_0xe609('0x46')](_[_0xe609('0x64')](_0x378d7f[_0xe609('0x45')],_0x1b0538[_0xe609('0x46')]));if(_0x378d7f['query']['filter']){_0x4be6a0[_0xe609('0x4e')]=_[_0xe609('0x4f')](_0x4be6a0[_0xe609('0x4e')],{'$or':_[_0xe609('0x44')](_0x4be6a0[_0xe609('0x49')],function(_0x4d19ca){var _0x7fd185={};_0x7fd185[_0x4d19ca]={'$like':'%'+_0x378d7f['query']['filter']+'%'};return _0x7fd185;})});}_0x4be6a0=_['merge']({},_0x4be6a0,_0x378d7f[_0xe609('0x51')]);return _0x1d6327[_0xe609('0x8f')](_0x4be6a0);}})[_0xe609('0x23')](function(_0x804bd1){if(_0x804bd1){_0x18b9f8=_0x804bd1[_0xe609('0x59')];if(!_0x378d7f[_0xe609('0x45')][_0xe609('0x4a')](_0xe609('0x4b'))){_0x4be6a0['limit']=qs[_0xe609('0x33')](_0x378d7f[_0xe609('0x45')]['limit']);_0x4be6a0[_0xe609('0x31')]=qs[_0xe609('0x31')](_0x378d7f['query'][_0xe609('0x31')]);}return _0x1d6327[_0xe609('0x8f')](_0x4be6a0);}})[_0xe609('0x23')](function(_0x3e2e0c){if(_0x3e2e0c){return _0x3e2e0c?{'count':_0x18b9f8,'rows':_0x3e2e0c}:null;}})[_0xe609('0x23')](respondWithResult(_0x219914,null))[_0xe609('0x2d')](handleError(_0x219914,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 5f578e3..dffbc5c 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 _0x3be5=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save'];(function(_0x5b3b6a,_0x906f49){var _0x4a9af7=function(_0x435c41){while(--_0x435c41){_0x5b3b6a['push'](_0x5b3b6a['shift']());}};_0x4a9af7(++_0x906f49);}(_0x3be5,0xd5));var _0x53be=function(_0x4f1196,_0x3165d3){_0x4f1196=_0x4f1196-0x0;var _0x1e13bf=_0x3be5[_0x4f1196];return _0x1e13bf;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x53be('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x53be('0x1')](0x0);var events={'afterCreate':_0x53be('0x2'),'afterUpdate':_0x53be('0x3'),'afterDestroy':_0x53be('0x4')};function emitEvent(_0x23be28){return function(_0x487ecd,_0xc4899b,_0x1ee311){ChatQueueEvents[_0x53be('0x5')](_0x23be28+':'+_0x487ecd['id'],_0x487ecd);ChatQueueEvents['emit'](_0x23be28,_0x487ecd);_0x1ee311(null);};}for(var e in events){if(events[_0x53be('0x6')](e)){var event=events[e];ChatQueue[_0x53be('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x6ab6=['hasOwnProperty','hook','events','../../mysqldb','ChatQueue','setMaxListeners','save','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6ab6,0x112));var _0x66ab=function(_0x50f255,_0x11f636){_0x50f255=_0x50f255-0x0;var _0x1f8ea3=_0x6ab6[_0x50f255];return _0x1f8ea3;};'use strict';var EventEmitter=require(_0x66ab('0x0'));var ChatQueue=require(_0x66ab('0x1'))['db'][_0x66ab('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x66ab('0x3')](0x0);var events={'afterCreate':_0x66ab('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3e3206){return function(_0x3a9608,_0x1ed480,_0x1345b6){ChatQueueEvents[_0x66ab('0x5')](_0x3e3206+':'+_0x3a9608['id'],_0x3a9608);ChatQueueEvents[_0x66ab('0x5')](_0x3e3206,_0x3a9608);_0x1345b6(null);};}for(var e in events){if(events[_0x66ab('0x6')](e)){var event=events[e];ChatQueue[_0x66ab('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 556a12a..7c051d2 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 _0xf7b8=['ChatQueue','chat_queues','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./chatQueue.attributes','define'];(function(_0x26bc26,_0x3f45ad){var _0x809c73=function(_0x12535c){while(--_0x12535c){_0x26bc26['push'](_0x26bc26['shift']());}};_0x809c73(++_0x3f45ad);}(_0xf7b8,0x14c));var _0x8f7b=function(_0x56434e,_0x2afa15){_0x56434e=_0x56434e-0x0;var _0x2e33f2=_0xf7b8[_0x56434e];return _0x2e33f2;};'use strict';var _=require(_0x8f7b('0x0'));var util=require('util');var logger=require(_0x8f7b('0x1'))(_0x8f7b('0x2'));var moment=require(_0x8f7b('0x3'));var BPromise=require(_0x8f7b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8f7b('0x5'));var config=require(_0x8f7b('0x6'));var attributes=require(_0x8f7b('0x7'));module['exports']=function(_0x50f0eb,_0x209a36){return _0x50f0eb[_0x8f7b('0x8')](_0x8f7b('0x9'),attributes,{'tableName':_0x8f7b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12c0=['bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util','../../config/logger','api'];(function(_0x18ea8a,_0x32f09f){var _0x19c99a=function(_0x21d8d6){while(--_0x21d8d6){_0x18ea8a['push'](_0x18ea8a['shift']());}};_0x19c99a(++_0x32f09f);}(_0x12c0,0x189));var _0x012c=function(_0x2d9bc6,_0x7fe421){_0x2d9bc6=_0x2d9bc6-0x0;var _0x474e97=_0x12c0[_0x2d9bc6];return _0x474e97;};'use strict';var _=require('lodash');var util=require(_0x012c('0x0'));var logger=require(_0x012c('0x1'))(_0x012c('0x2'));var moment=require('moment');var BPromise=require(_0x012c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x012c('0x4'));var rimraf=require(_0x012c('0x5'));var config=require(_0x012c('0x6'));var attributes=require(_0x012c('0x7'));module[_0x012c('0x8')]=function(_0x222b0a,_0x2dce84){return _0x222b0a[_0x012c('0x9')](_0x012c('0xa'),attributes,{'tableName':_0x012c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index b32d5eb..4429d03 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 _0x737e=['client','http','redis','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowChatQueue','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x737e,0x1cc));var _0xe737=function(_0x30f994,_0x43d93c){_0x30f994=_0x30f994-0x0;var _0x31e888=_0x737e[_0x30f994];return _0x31e888;};'use strict';var _=require(_0xe737('0x0'));var util=require(_0xe737('0x1'));var moment=require(_0xe737('0x2'));var BPromise=require(_0xe737('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe737('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe737('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe737('0x6'));var jayson=require(_0xe737('0x7'));var client=jayson[_0xe737('0x8')][_0xe737('0x9')]({'port':0x232a});config[_0xe737('0xa')]=_['defaults'](config[_0xe737('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe737('0xb'))(new Redis(config[_0xe737('0xa')]));require(_0xe737('0xc'))['register'](socket);function respondWithRpcPromise(_0x3a2d4e,_0x482ffc,_0x15d484){return new BPromise(function(_0x46f83a,_0x2124b4){return client[_0xe737('0xd')](_0x3a2d4e,_0x15d484)[_0xe737('0xe')](function(_0xfe5d98){logger[_0xe737('0xf')](_0xe737('0x10'),_0x482ffc,_0xe737('0x11'));logger[_0xe737('0x12')](_0xe737('0x13'),_0x482ffc,_0xe737('0x11'),JSON[_0xe737('0x14')](_0xfe5d98));if(_0xfe5d98['error']){if(_0xfe5d98[_0xe737('0x15')][_0xe737('0x16')]===0x1f4){logger[_0xe737('0x15')](_0xe737('0x10'),_0x482ffc,_0xfe5d98[_0xe737('0x15')][_0xe737('0x17')]);return _0x2124b4(_0xfe5d98[_0xe737('0x15')][_0xe737('0x17')]);}logger[_0xe737('0x15')](_0xe737('0x10'),_0x482ffc,_0xfe5d98[_0xe737('0x15')]['message']);return _0x46f83a(_0xfe5d98[_0xe737('0x15')][_0xe737('0x17')]);}else{logger['info'](_0xe737('0x10'),_0x482ffc,_0xe737('0x11'));_0x46f83a(_0xfe5d98[_0xe737('0x18')][_0xe737('0x17')]);}})['catch'](function(_0xaed278){logger[_0xe737('0x15')](_0xe737('0x10'),_0x482ffc,_0xaed278);_0x2124b4(_0xaed278);});});}exports[_0xe737('0x19')]=function(_0x1540eb){var _0x5de660=this;return new Promise(function(_0x28842a,_0x7d7d6f){return db[_0xe737('0x1a')][_0xe737('0x1b')]({'raw':_0x1540eb[_0xe737('0x1c')]?_0x1540eb[_0xe737('0x1c')][_0xe737('0x1d')]===undefined?!![]:![]:!![],'where':_0x1540eb[_0xe737('0x1c')]?_0x1540eb['options'][_0xe737('0x1e')]||null:null,'attributes':_0x1540eb[_0xe737('0x1c')]?_0x1540eb['options'][_0xe737('0x1f')]||null:null,'limit':_0x1540eb[_0xe737('0x1c')]?_0x1540eb[_0xe737('0x1c')][_0xe737('0x20')]||null:null,'include':_0x1540eb[_0xe737('0x1c')]?_0x1540eb[_0xe737('0x1c')][_0xe737('0x21')]?_['map'](_0x1540eb['options'][_0xe737('0x21')],function(_0x22bc8){return{'model':db[_0x22bc8[_0xe737('0x22')]],'as':_0x22bc8['as'],'attributes':_0x22bc8['attributes'],'include':_0x22bc8['include']?_[_0xe737('0x23')](_0x22bc8[_0xe737('0x21')],function(_0xab663){return{'model':db[_0xab663['model']],'as':_0xab663['as'],'attributes':_0xab663[_0xe737('0x1f')],'include':_0xab663[_0xe737('0x21')]?_[_0xe737('0x23')](_0xab663[_0xe737('0x21')],function(_0x35c4fa){return{'model':db[_0x35c4fa[_0xe737('0x22')]],'as':_0x35c4fa['as'],'attributes':_0x35c4fa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x113b1d){logger[_0xe737('0xf')](_0xe737('0x19'),_0x1540eb);logger[_0xe737('0x12')]('GetChatQueue',_0x1540eb,JSON[_0xe737('0x14')](_0x113b1d));_0x28842a(_0x113b1d);})[_0xe737('0x24')](function(_0x4a2ed9){logger['error'](_0xe737('0x19'),_0x4a2ed9[_0xe737('0x17')],_0x1540eb);_0x7d7d6f(_0x5de660[_0xe737('0x15')](0x1f4,_0x4a2ed9[_0xe737('0x17')]));});});};exports[_0xe737('0x25')]=function(_0x440f0c){var _0xca2c4d=this;return new Promise(function(_0xed8922,_0x410f74){return db['ChatQueue'][_0xe737('0x26')]({'raw':_0x440f0c[_0xe737('0x1c')]?_0x440f0c[_0xe737('0x1c')][_0xe737('0x1d')]===undefined?!![]:![]:!![],'where':_0x440f0c[_0xe737('0x1c')]?_0x440f0c[_0xe737('0x1c')][_0xe737('0x1e')]||null:null,'attributes':_0x440f0c['options']?_0x440f0c[_0xe737('0x1c')][_0xe737('0x1f')]||null:null,'include':_0x440f0c[_0xe737('0x1c')]?_0x440f0c['options'][_0xe737('0x21')]?_['map'](_0x440f0c[_0xe737('0x1c')][_0xe737('0x21')],function(_0x5281ab){return{'model':db[_0x5281ab['model']],'as':_0x5281ab['as'],'attributes':_0x5281ab[_0xe737('0x1f')],'include':_0x5281ab['include']?_[_0xe737('0x23')](_0x5281ab['include'],function(_0x32fb34){return{'model':db[_0x32fb34[_0xe737('0x22')]],'as':_0x32fb34['as'],'attributes':_0x32fb34[_0xe737('0x1f')],'include':_0x32fb34[_0xe737('0x21')]?_[_0xe737('0x23')](_0x32fb34['include'],function(_0x64829a){return{'model':db[_0x64829a[_0xe737('0x22')]],'as':_0x64829a['as'],'attributes':_0x64829a[_0xe737('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe737('0xe')](function(_0x3357a6){logger[_0xe737('0xf')](_0xe737('0x25'),_0x440f0c);logger[_0xe737('0x12')]('ShowChatQueue',_0x440f0c,JSON[_0xe737('0x14')](_0x3357a6));_0xed8922(_0x3357a6);})[_0xe737('0x24')](function(_0x2ab36b){logger['error'](_0xe737('0x25'),_0x2ab36b[_0xe737('0x17')],_0x440f0c);_0x410f74(_0xca2c4d[_0xe737('0x15')](0x1f4,_0x2ab36b[_0xe737('0x17')]));});});}; \ No newline at end of file +var _0x32e7=['model','attributes','then','ShowChatQueue','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','limit','include','map'];(function(_0x1aee35,_0x6c5b00){var _0x3dc2e1=function(_0x33c7bc){while(--_0x33c7bc){_0x1aee35['push'](_0x1aee35['shift']());}};_0x3dc2e1(++_0x6c5b00);}(_0x32e7,0xc3));var _0x732e=function(_0x11366d,_0x5a7453){_0x11366d=_0x11366d-0x0;var _0x438512=_0x32e7[_0x11366d];return _0x438512;};'use strict';var _=require(_0x732e('0x0'));var util=require('util');var moment=require(_0x732e('0x1'));var BPromise=require(_0x732e('0x2'));var rs=require(_0x732e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x732e('0x4'))['db'];var utils=require(_0x732e('0x5'));var logger=require(_0x732e('0x6'))(_0x732e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x732e('0x8')]['http']({'port':0x232a});config[_0x732e('0x9')]=_[_0x732e('0xa')](config['redis'],{'host':_0x732e('0xb'),'port':0x18eb});var socket=require(_0x732e('0xc'))(new Redis(config[_0x732e('0x9')]));require('./chatQueue.socket')[_0x732e('0xd')](socket);function respondWithRpcPromise(_0x4e0df5,_0x367a2c,_0x3facf4){return new BPromise(function(_0xf8c6f6,_0x264581){return client[_0x732e('0xe')](_0x4e0df5,_0x3facf4)['then'](function(_0x34c5b9){logger[_0x732e('0xf')](_0x732e('0x10'),_0x367a2c,_0x732e('0x11'));logger['debug'](_0x732e('0x12'),_0x367a2c,_0x732e('0x11'),JSON[_0x732e('0x13')](_0x34c5b9));if(_0x34c5b9['error']){if(_0x34c5b9[_0x732e('0x14')]['code']===0x1f4){logger[_0x732e('0x14')]('ChatQueue,\x20%s,\x20%s',_0x367a2c,_0x34c5b9[_0x732e('0x14')]['message']);return _0x264581(_0x34c5b9['error'][_0x732e('0x15')]);}logger[_0x732e('0x14')](_0x732e('0x10'),_0x367a2c,_0x34c5b9[_0x732e('0x14')][_0x732e('0x15')]);return _0xf8c6f6(_0x34c5b9[_0x732e('0x14')][_0x732e('0x15')]);}else{logger[_0x732e('0xf')](_0x732e('0x10'),_0x367a2c,_0x732e('0x11'));_0xf8c6f6(_0x34c5b9[_0x732e('0x16')][_0x732e('0x15')]);}})[_0x732e('0x17')](function(_0x1ffdff){logger['error']('ChatQueue,\x20%s,\x20%s',_0x367a2c,_0x1ffdff);_0x264581(_0x1ffdff);});});}exports[_0x732e('0x18')]=function(_0x2126ef){var _0x567239=this;return new Promise(function(_0x2f00c6,_0x3a901c){return db[_0x732e('0x19')][_0x732e('0x1a')]({'raw':_0x2126ef[_0x732e('0x1b')]?_0x2126ef[_0x732e('0x1b')][_0x732e('0x1c')]===undefined?!![]:![]:!![],'where':_0x2126ef[_0x732e('0x1b')]?_0x2126ef[_0x732e('0x1b')][_0x732e('0x1d')]||null:null,'attributes':_0x2126ef['options']?_0x2126ef[_0x732e('0x1b')]['attributes']||null:null,'limit':_0x2126ef['options']?_0x2126ef[_0x732e('0x1b')][_0x732e('0x1e')]||null:null,'include':_0x2126ef[_0x732e('0x1b')]?_0x2126ef[_0x732e('0x1b')][_0x732e('0x1f')]?_[_0x732e('0x20')](_0x2126ef[_0x732e('0x1b')][_0x732e('0x1f')],function(_0x553605){return{'model':db[_0x553605[_0x732e('0x21')]],'as':_0x553605['as'],'attributes':_0x553605[_0x732e('0x22')],'include':_0x553605[_0x732e('0x1f')]?_['map'](_0x553605[_0x732e('0x1f')],function(_0x22f38f){return{'model':db[_0x22f38f[_0x732e('0x21')]],'as':_0x22f38f['as'],'attributes':_0x22f38f[_0x732e('0x22')],'include':_0x22f38f[_0x732e('0x1f')]?_[_0x732e('0x20')](_0x22f38f[_0x732e('0x1f')],function(_0x123c3a){return{'model':db[_0x123c3a[_0x732e('0x21')]],'as':_0x123c3a['as'],'attributes':_0x123c3a[_0x732e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x732e('0x23')](function(_0x607101){logger[_0x732e('0xf')]('GetChatQueue',_0x2126ef);logger['debug']('GetChatQueue',_0x2126ef,JSON[_0x732e('0x13')](_0x607101));_0x2f00c6(_0x607101);})[_0x732e('0x17')](function(_0x301921){logger['error'](_0x732e('0x18'),_0x301921[_0x732e('0x15')],_0x2126ef);_0x3a901c(_0x567239[_0x732e('0x14')](0x1f4,_0x301921['message']));});});};exports[_0x732e('0x24')]=function(_0x43ccf9){var _0x44f749=this;return new Promise(function(_0x393cdc,_0x24a36d){return db['ChatQueue']['find']({'raw':_0x43ccf9['options']?_0x43ccf9['options']['raw']===undefined?!![]:![]:!![],'where':_0x43ccf9[_0x732e('0x1b')]?_0x43ccf9[_0x732e('0x1b')][_0x732e('0x1d')]||null:null,'attributes':_0x43ccf9['options']?_0x43ccf9[_0x732e('0x1b')][_0x732e('0x22')]||null:null,'include':_0x43ccf9[_0x732e('0x1b')]?_0x43ccf9[_0x732e('0x1b')][_0x732e('0x1f')]?_[_0x732e('0x20')](_0x43ccf9[_0x732e('0x1b')][_0x732e('0x1f')],function(_0x43d50a){return{'model':db[_0x43d50a[_0x732e('0x21')]],'as':_0x43d50a['as'],'attributes':_0x43d50a[_0x732e('0x22')],'include':_0x43d50a[_0x732e('0x1f')]?_[_0x732e('0x20')](_0x43d50a['include'],function(_0x717321){return{'model':db[_0x717321[_0x732e('0x21')]],'as':_0x717321['as'],'attributes':_0x717321['attributes'],'include':_0x717321['include']?_[_0x732e('0x20')](_0x717321[_0x732e('0x1f')],function(_0x2b980b){return{'model':db[_0x2b980b[_0x732e('0x21')]],'as':_0x2b980b['as'],'attributes':_0x2b980b[_0x732e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x732e('0x23')](function(_0x13f744){logger[_0x732e('0xf')](_0x732e('0x24'),_0x43ccf9);logger[_0x732e('0x25')](_0x732e('0x24'),_0x43ccf9,JSON[_0x732e('0x13')](_0x13f744));_0x393cdc(_0x13f744);})[_0x732e('0x17')](function(_0xd94c55){logger[_0x732e('0x14')](_0x732e('0x24'),_0xd94c55['message'],_0x43ccf9);_0x24a36d(_0x44f749[_0x732e('0x14')](0x1f4,_0xd94c55['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 6dbda36..b0b6814 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 _0x8ce3=['emit','removeListener','length','./chatQueue.events','save','update'];(function(_0x2286b8,_0x57d50e){var _0x591ecb=function(_0x532804){while(--_0x532804){_0x2286b8['push'](_0x2286b8['shift']());}};_0x591ecb(++_0x57d50e);}(_0x8ce3,0xc3));var _0x38ce=function(_0x57e212,_0xb2da96){_0x57e212=_0x57e212-0x0;var _0x1e9cf7=_0x8ce3[_0x57e212];return _0x1e9cf7;};'use strict';var ChatQueueEvents=require(_0x38ce('0x0'));var events=[_0x38ce('0x1'),'remove',_0x38ce('0x2')];function createListener(_0x2b99b0,_0xee1d0e){return function(_0x26ec48){_0xee1d0e[_0x38ce('0x3')](_0x2b99b0,_0x26ec48);};}function removeListener(_0x17b96d,_0x1efae3){return function(){ChatQueueEvents[_0x38ce('0x4')](_0x17b96d,_0x1efae3);};}exports['register']=function(_0x372f86){for(var _0xb24f4c=0x0,_0x58074c=events[_0x38ce('0x5')];_0xb24f4c<_0x58074c;_0xb24f4c++){var _0xbe7332=events[_0xb24f4c];var _0x3f8011=createListener('chatQueue:'+_0xbe7332,_0x372f86);ChatQueueEvents['on'](_0xbe7332,_0x3f8011);}}; \ No newline at end of file +var _0xcb99=['chatQueue:','./chatQueue.events','remove','emit','removeListener','length'];(function(_0x3ccfa0,_0x12b40c){var _0x1a6592=function(_0x495a15){while(--_0x495a15){_0x3ccfa0['push'](_0x3ccfa0['shift']());}};_0x1a6592(++_0x12b40c);}(_0xcb99,0x8b));var _0x9cb9=function(_0x5a766f,_0x135d23){_0x5a766f=_0x5a766f-0x0;var _0xebfcf3=_0xcb99[_0x5a766f];return _0xebfcf3;};'use strict';var ChatQueueEvents=require(_0x9cb9('0x0'));var events=['save',_0x9cb9('0x1'),'update'];function createListener(_0x480364,_0x3a2f21){return function(_0x1308a8){_0x3a2f21[_0x9cb9('0x2')](_0x480364,_0x1308a8);};}function removeListener(_0x51f2ee,_0x167735){return function(){ChatQueueEvents[_0x9cb9('0x3')](_0x51f2ee,_0x167735);};}exports['register']=function(_0x214b72){for(var _0x509cfc=0x0,_0x2ed26a=events[_0x9cb9('0x4')];_0x509cfc<_0x2ed26a;_0x509cfc++){var _0x1bf9b7=events[_0x509cfc];var _0x1dd62f=createListener(_0x9cb9('0x5')+_0x1bf9b7,_0x214b72);ChatQueueEvents['on'](_0x1bf9b7,_0x1dd62f);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 45120dc..4bf32da 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x58c704,_0x26ab7c){var _0x9cab51=function(_0x2cd0bd){while(--_0x2cd0bd){_0x58c704['push'](_0x58c704['shift']());}};_0x9cab51(++_0x26ab7c);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x3a0e08,_0x266b6b){var _0x5f23c3=function(_0xed3e3f){while(--_0xed3e3f){_0x3a0e08['push'](_0x3a0e08['shift']());}};_0x5f23c3(++_0x266b6b);}(_0xe14b,0x93));var _0xbe14=function(_0x4d7df6,_0x3f6139){_0x4d7df6=_0x4d7df6-0x0;var _0x4c0d29=_0xe14b[_0x4d7df6];return _0x4c0d29;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index c35160c..ed78ff4 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 _0x7573=['sequelize','exports','STRING','DATE','moment'];(function(_0x3cd1cc,_0x44494b){var _0x3db194=function(_0x1fcf3f){while(--_0x1fcf3f){_0x3cd1cc['push'](_0x3cd1cc['shift']());}};_0x3db194(++_0x44494b);}(_0x7573,0x72));var _0x3757=function(_0x2932f4,_0x14c82f){_0x2932f4=_0x2932f4-0x0;var _0x3ea6db=_0x7573[_0x2932f4];return _0x3ea6db;};'use strict';var moment=require(_0x3757('0x0'));var Sequelize=require(_0x3757('0x1'));module[_0x3757('0x2')]={'uniqueid':{'type':Sequelize[_0x3757('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x3757('0x3')]},'joinAt':{'type':Sequelize[_0x3757('0x4')]},'leaveAt':{'type':Sequelize[_0x3757('0x4')]},'acceptAt':{'type':Sequelize[_0x3757('0x4')]},'exitAt':{'type':Sequelize[_0x3757('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9e42=['exports','STRING','DATE','sequelize'];(function(_0x5a2ab9,_0x537ffd){var _0x4137c6=function(_0x4e8dfa){while(--_0x4e8dfa){_0x5a2ab9['push'](_0x5a2ab9['shift']());}};_0x4137c6(++_0x537ffd);}(_0x9e42,0x157));var _0x29e4=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x9e42[_0x725b8e];return _0x43ac45;};'use strict';var moment=require('moment');var Sequelize=require(_0x29e4('0x0'));module[_0x29e4('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x29e4('0x2')]},'joinAt':{'type':Sequelize[_0x29e4('0x3')]},'leaveAt':{'type':Sequelize[_0x29e4('0x3')]},'acceptAt':{'type':Sequelize[_0x29e4('0x3')]},'exitAt':{'type':Sequelize[_0x29e4('0x3')]},'reason':{'type':Sequelize[_0x29e4('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index aef1345..ee79cc4 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 _0x720b=['nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','ChatQueueReport','includeAll','include','findAll','rows','catch','params','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','send','index','rawAttributes','type','model','map','name','query','keys','intersection','fields','attributes','length'];(function(_0x594346,_0x540ce7){var _0xae6bdb=function(_0x331555){while(--_0x331555){_0x594346['push'](_0x594346['shift']());}};_0xae6bdb(++_0x540ce7);}(_0x720b,0x1d8));var _0xb720=function(_0x55c7ac,_0x2b6dcf){_0x55c7ac=_0x55c7ac-0x0;var _0x4498b5=_0x720b[_0x55c7ac];return _0x4498b5;};'use strict';var emlformat=require(_0xb720('0x0'));var rimraf=require(_0xb720('0x1'));var zipdir=require(_0xb720('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb720('0x3'));var moment=require(_0xb720('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb720('0x5'));var util=require(_0xb720('0x6'));var path=require(_0xb720('0x7'));var sox=require('sox');var csv=require(_0xb720('0x8'));var ejs=require(_0xb720('0x9'));var fs=require('fs');var fs_extra=require(_0xb720('0xa'));var _=require(_0xb720('0xb'));var squel=require(_0xb720('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb720('0xd'));var toCsv=require(_0xb720('0x8'));var querystring=require(_0xb720('0xe'));var Papa=require(_0xb720('0xf'));var Redis=require(_0xb720('0x10'));var authService=require(_0xb720('0x11'));var qs=require(_0xb720('0x12'));var as=require(_0xb720('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb720('0x14'))(_0xb720('0x15'));var utils=require('../../config/utils');var config=require(_0xb720('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb720('0x17'))['db'];function respondWithStatusCode(_0x4ab352,_0x62de2b){_0x62de2b=_0x62de2b||0xcc;return function(_0x12781c){if(_0x12781c){return _0x4ab352[_0xb720('0x18')](_0x62de2b);}return _0x4ab352[_0xb720('0x19')](_0x62de2b)[_0xb720('0x1a')]();};}function respondWithResult(_0x30a5dd,_0x1d29ce){_0x1d29ce=_0x1d29ce||0xc8;return function(_0x414216){if(_0x414216){return _0x30a5dd['status'](_0x1d29ce)[_0xb720('0x1b')](_0x414216);}};}function respondWithFilteredResult(_0x2749fd,_0x3e7e22){return function(_0x5a675d){if(_0x5a675d){var _0x4edde2=typeof _0x3e7e22[_0xb720('0x1c')]===_0xb720('0x1d')&&typeof _0x3e7e22[_0xb720('0x1e')]==='undefined';var _0x1bda26=_0x5a675d[_0xb720('0x1f')];var _0x453c43=_0x4edde2?0x0:_0x3e7e22[_0xb720('0x1c')];var _0x395d6a=_0x4edde2?_0x5a675d[_0xb720('0x1f')]:_0x3e7e22[_0xb720('0x1c')]+_0x3e7e22[_0xb720('0x1e')];var _0x3d8fa4;if(_0x395d6a>=_0x1bda26){_0x395d6a=_0x1bda26;_0x3d8fa4=0xc8;}else{_0x3d8fa4=0xce;}_0x2749fd[_0xb720('0x19')](_0x3d8fa4);return _0x2749fd[_0xb720('0x20')](_0xb720('0x21'),_0x453c43+'-'+_0x395d6a+'/'+_0x1bda26)[_0xb720('0x1b')](_0x5a675d);}return null;};}function patchUpdates(_0x3bcca2){return function(_0x38f815){try{jsonpatch[_0xb720('0x22')](_0x38f815,_0x3bcca2,!![]);}catch(_0x25acb4){return BPromise[_0xb720('0x23')](_0x25acb4);}return _0x38f815[_0xb720('0x24')]();};}function saveUpdates(_0x8b19ea,_0x4e366a){return function(_0x5359b5){if(_0x5359b5){return _0x5359b5['update'](_0x8b19ea)[_0xb720('0x25')](function(_0x5f47d5){return _0x5f47d5;});}return null;};}function removeEntity(_0x27d3cb,_0x20bec1){return function(_0x3b4f61){if(_0x3b4f61){return _0x3b4f61[_0xb720('0x26')]()[_0xb720('0x25')](function(){_0x27d3cb[_0xb720('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x498860,_0x5cb6aa){return function(_0x298cce){if(!_0x298cce){_0x498860[_0xb720('0x18')](0x194);}return _0x298cce;};}function handleError(_0x5f1e03,_0x508eb8){_0x508eb8=_0x508eb8||0x1f4;return function(_0x1c3805){logger['error'](_0x1c3805[_0xb720('0x27')]);if(_0x1c3805['name']){delete _0x1c3805['name'];}_0x5f1e03[_0xb720('0x19')](_0x508eb8)[_0xb720('0x28')](_0x1c3805);};}exports[_0xb720('0x29')]=function(_0x416161,_0x466405){var _0xd25825={},_0x732423={},_0x17faec={'count':0x0,'rows':[]};var _0x575738=_['map'](db['ChatQueueReport'][_0xb720('0x2a')],function(_0x70faef){return{'name':_0x70faef['fieldName'],'type':_0x70faef[_0xb720('0x2b')]['key']};});_0x732423[_0xb720('0x2c')]=_[_0xb720('0x2d')](_0x575738,_0xb720('0x2e'));_0x732423[_0xb720('0x2f')]=_[_0xb720('0x30')](_0x416161[_0xb720('0x2f')]);_0x732423['filters']=_[_0xb720('0x31')](_0x732423[_0xb720('0x2c')],_0x732423[_0xb720('0x2f')]);_0xd25825['attributes']=_[_0xb720('0x31')](_0x732423[_0xb720('0x2c')],qs['fields'](_0x416161['query'][_0xb720('0x32')]));_0xd25825['attributes']=_0xd25825[_0xb720('0x33')][_0xb720('0x34')]?_0xd25825[_0xb720('0x33')]:_0x732423[_0xb720('0x2c')];if(!_0x416161['query']['hasOwnProperty'](_0xb720('0x35'))){_0xd25825[_0xb720('0x1e')]=qs[_0xb720('0x1e')](_0x416161[_0xb720('0x2f')][_0xb720('0x1e')]);_0xd25825['offset']=qs['offset'](_0x416161[_0xb720('0x2f')][_0xb720('0x1c')]);}_0xd25825[_0xb720('0x36')]=qs[_0xb720('0x37')](_0x416161[_0xb720('0x2f')][_0xb720('0x37')]);_0xd25825[_0xb720('0x38')]=qs[_0xb720('0x39')](_[_0xb720('0x3a')](_0x416161['query'],_0x732423['filters']),_0x575738);if(_0x416161[_0xb720('0x2f')][_0xb720('0x3b')]){_0xd25825[_0xb720('0x38')]=_[_0xb720('0x3c')](_0xd25825[_0xb720('0x38')],{'$or':_[_0xb720('0x2d')](_0x575738,function(_0x1e8bc2){if(_0x1e8bc2[_0xb720('0x2b')]!==_0xb720('0x3d')){var _0x4aaa5f={};_0x4aaa5f[_0x1e8bc2[_0xb720('0x2e')]]={'$like':'%'+_0x416161[_0xb720('0x2f')][_0xb720('0x3b')]+'%'};return _0x4aaa5f;}})});}_0xd25825=_[_0xb720('0x3c')]({},_0xd25825,_0x416161['options']);var _0xb50cec={'where':_0xd25825[_0xb720('0x38')]};return db[_0xb720('0x3e')][_0xb720('0x1f')](_0xb50cec)[_0xb720('0x25')](function(_0x2ebd44){_0x17faec[_0xb720('0x1f')]=_0x2ebd44;if(_0x416161[_0xb720('0x2f')][_0xb720('0x3f')]){_0xd25825[_0xb720('0x40')]=[{'all':!![]}];}return db[_0xb720('0x3e')][_0xb720('0x41')](_0xd25825);})[_0xb720('0x25')](function(_0x48ab46){_0x17faec[_0xb720('0x42')]=_0x48ab46;return _0x17faec;})[_0xb720('0x25')](respondWithFilteredResult(_0x466405,_0xd25825))[_0xb720('0x43')](handleError(_0x466405,null));};exports['show']=function(_0xddf177,_0x5f1d85){var _0x4d0201={'raw':!![],'where':{'id':_0xddf177[_0xb720('0x44')]['id']}},_0x466a98={};_0x466a98[_0xb720('0x2c')]=_[_0xb720('0x30')](db['ChatQueueReport'][_0xb720('0x2a')]);_0x466a98[_0xb720('0x2f')]=_['keys'](_0xddf177[_0xb720('0x2f')]);_0x466a98[_0xb720('0x39')]=_[_0xb720('0x31')](_0x466a98[_0xb720('0x2c')],_0x466a98[_0xb720('0x2f')]);_0x4d0201[_0xb720('0x33')]=_[_0xb720('0x31')](_0x466a98[_0xb720('0x2c')],qs['fields'](_0xddf177[_0xb720('0x2f')][_0xb720('0x32')]));_0x4d0201['attributes']=_0x4d0201[_0xb720('0x33')]['length']?_0x4d0201[_0xb720('0x33')]:_0x466a98[_0xb720('0x2c')];if(_0xddf177[_0xb720('0x2f')][_0xb720('0x3f')]){_0x4d0201[_0xb720('0x40')]=[{'all':!![]}];}_0x4d0201=_[_0xb720('0x3c')]({},_0x4d0201,_0xddf177[_0xb720('0x45')]);return db['ChatQueueReport'][_0xb720('0x46')](_0x4d0201)['then'](handleEntityNotFound(_0x5f1d85,null))[_0xb720('0x25')](respondWithResult(_0x5f1d85,null))['catch'](handleError(_0x5f1d85,null));};exports[_0xb720('0x47')]=function(_0x10ff3f,_0x428f40){return db[_0xb720('0x3e')][_0xb720('0x47')](_0x10ff3f[_0xb720('0x48')],{})[_0xb720('0x25')](respondWithResult(_0x428f40,0xc9))[_0xb720('0x43')](handleError(_0x428f40,null));};exports[_0xb720('0x49')]=function(_0x4bd743,_0x5565c9){if(_0x4bd743[_0xb720('0x48')]['id']){delete _0x4bd743[_0xb720('0x48')]['id'];}return db[_0xb720('0x3e')][_0xb720('0x46')]({'where':{'id':_0x4bd743['params']['id']}})[_0xb720('0x25')](handleEntityNotFound(_0x5565c9,null))[_0xb720('0x25')](saveUpdates(_0x4bd743['body'],null))[_0xb720('0x25')](respondWithResult(_0x5565c9,null))[_0xb720('0x43')](handleError(_0x5565c9,null));};exports['destroy']=function(_0x3652ef,_0x4e6bce){return db['ChatQueueReport'][_0xb720('0x46')]({'where':{'id':_0x3652ef[_0xb720('0x44')]['id']}})[_0xb720('0x25')](handleEntityNotFound(_0x4e6bce,null))[_0xb720('0x25')](removeEntity(_0x4e6bce,null))[_0xb720('0x43')](handleError(_0x4e6bce,null));};exports[_0xb720('0x4a')]=function(_0x10938a,_0x3eefc1){return db[_0xb720('0x3e')][_0xb720('0x4a')]()[_0xb720('0x25')](respondWithResult(_0x3eefc1,null))[_0xb720('0x43')](handleError(_0x3eefc1,null));}; \ No newline at end of file +var _0x8daf=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','set','Content-Range','json','apply','save','update','then','error','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','model','filters','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','map','VIRTUAL','merge','count','includeAll','include','findAll','catch','show','params','keys','intersection','find','create','body','destroy','describe','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x58f457,_0x990c9b){var _0x2e8229=function(_0x53b2aa){while(--_0x53b2aa){_0x58f457['push'](_0x58f457['shift']());}};_0x2e8229(++_0x990c9b);}(_0x8daf,0x15c));var _0xf8da=function(_0x392a7b,_0x564932){_0x392a7b=_0x392a7b-0x0;var _0x1d866f=_0x8daf[_0x392a7b];return _0x1d866f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf8da('0x0'));var moment=require(_0xf8da('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xf8da('0x2'));var util=require(_0xf8da('0x3'));var path=require(_0xf8da('0x4'));var sox=require(_0xf8da('0x5'));var csv=require(_0xf8da('0x6'));var ejs=require(_0xf8da('0x7'));var fs=require('fs');var fs_extra=require(_0xf8da('0x8'));var _=require(_0xf8da('0x9'));var squel=require(_0xf8da('0xa'));var crypto=require('crypto');var jsforce=require(_0xf8da('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf8da('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf8da('0xc'));var authService=require(_0xf8da('0xd'));var qs=require(_0xf8da('0xe'));var as=require(_0xf8da('0xf'));var hardwareService=require(_0xf8da('0x10'));var logger=require(_0xf8da('0x11'))(_0xf8da('0x12'));var utils=require(_0xf8da('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf8da('0x14'));var db=require(_0xf8da('0x15'))['db'];function respondWithStatusCode(_0x3a436d,_0x1cfce2){_0x1cfce2=_0x1cfce2||0xcc;return function(_0x5cd714){if(_0x5cd714){return _0x3a436d[_0xf8da('0x16')](_0x1cfce2);}return _0x3a436d['status'](_0x1cfce2)[_0xf8da('0x17')]();};}function respondWithResult(_0x1a93ab,_0x259b96){_0x259b96=_0x259b96||0xc8;return function(_0x3e5413){if(_0x3e5413){return _0x1a93ab[_0xf8da('0x18')](_0x259b96)['json'](_0x3e5413);}};}function respondWithFilteredResult(_0x387c8e,_0x4296ff){return function(_0x36cee8){if(_0x36cee8){var _0x3fa368=typeof _0x4296ff[_0xf8da('0x19')]===_0xf8da('0x1a')&&typeof _0x4296ff[_0xf8da('0x1b')]==='undefined';var _0x1c9486=_0x36cee8['count'];var _0x5dc9db=_0x3fa368?0x0:_0x4296ff[_0xf8da('0x19')];var _0x2611c2=_0x3fa368?_0x36cee8['count']:_0x4296ff[_0xf8da('0x19')]+_0x4296ff[_0xf8da('0x1b')];var _0x30e1;if(_0x2611c2>=_0x1c9486){_0x2611c2=_0x1c9486;_0x30e1=0xc8;}else{_0x30e1=0xce;}_0x387c8e[_0xf8da('0x18')](_0x30e1);return _0x387c8e[_0xf8da('0x1c')](_0xf8da('0x1d'),_0x5dc9db+'-'+_0x2611c2+'/'+_0x1c9486)[_0xf8da('0x1e')](_0x36cee8);}return null;};}function patchUpdates(_0xfe5c73){return function(_0x5acd3f){try{jsonpatch[_0xf8da('0x1f')](_0x5acd3f,_0xfe5c73,!![]);}catch(_0x22adc7){return BPromise['reject'](_0x22adc7);}return _0x5acd3f[_0xf8da('0x20')]();};}function saveUpdates(_0x5361e7,_0x4ca909){return function(_0x5a295f){if(_0x5a295f){return _0x5a295f[_0xf8da('0x21')](_0x5361e7)[_0xf8da('0x22')](function(_0x2255b8){return _0x2255b8;});}return null;};}function removeEntity(_0x389391,_0x493d6c){return function(_0x4f7ceb){if(_0x4f7ceb){return _0x4f7ceb['destroy']()['then'](function(){_0x389391[_0xf8da('0x18')](0xcc)[_0xf8da('0x17')]();});}};}function handleEntityNotFound(_0x43934c,_0x2b403d){return function(_0x4b8d17){if(!_0x4b8d17){_0x43934c[_0xf8da('0x16')](0x194);}return _0x4b8d17;};}function handleError(_0x2ca340,_0x4326b1){_0x4326b1=_0x4326b1||0x1f4;return function(_0x550590){logger[_0xf8da('0x23')](_0x550590['stack']);if(_0x550590[_0xf8da('0x24')]){delete _0x550590[_0xf8da('0x24')];}_0x2ca340[_0xf8da('0x18')](_0x4326b1)[_0xf8da('0x25')](_0x550590);};}exports[_0xf8da('0x26')]=function(_0x3da568,_0x35544b){var _0x424f5d={},_0x51014c={},_0xd5780a={'count':0x0,'rows':[]};var _0x552ed3=_['map'](db[_0xf8da('0x27')][_0xf8da('0x28')],function(_0x16d7e9){return{'name':_0x16d7e9[_0xf8da('0x29')],'type':_0x16d7e9[_0xf8da('0x2a')]['key']};});_0x51014c[_0xf8da('0x2b')]=_['map'](_0x552ed3,'name');_0x51014c['query']=_['keys'](_0x3da568['query']);_0x51014c[_0xf8da('0x2c')]=_['intersection'](_0x51014c[_0xf8da('0x2b')],_0x51014c[_0xf8da('0x2d')]);_0x424f5d[_0xf8da('0x2e')]=_['intersection'](_0x51014c['model'],qs[_0xf8da('0x2f')](_0x3da568[_0xf8da('0x2d')][_0xf8da('0x2f')]));_0x424f5d[_0xf8da('0x2e')]=_0x424f5d[_0xf8da('0x2e')][_0xf8da('0x30')]?_0x424f5d['attributes']:_0x51014c[_0xf8da('0x2b')];if(!_0x3da568[_0xf8da('0x2d')][_0xf8da('0x31')](_0xf8da('0x32'))){_0x424f5d[_0xf8da('0x1b')]=qs[_0xf8da('0x1b')](_0x3da568['query'][_0xf8da('0x1b')]);_0x424f5d[_0xf8da('0x19')]=qs[_0xf8da('0x19')](_0x3da568[_0xf8da('0x2d')]['offset']);}_0x424f5d[_0xf8da('0x33')]=qs['sort'](_0x3da568[_0xf8da('0x2d')]['sort']);_0x424f5d[_0xf8da('0x34')]=qs['filters'](_[_0xf8da('0x35')](_0x3da568[_0xf8da('0x2d')],_0x51014c[_0xf8da('0x2c')]),_0x552ed3);if(_0x3da568[_0xf8da('0x2d')][_0xf8da('0x36')]){_0x424f5d[_0xf8da('0x34')]=_['merge'](_0x424f5d[_0xf8da('0x34')],{'$or':_[_0xf8da('0x37')](_0x552ed3,function(_0x235756){if(_0x235756['type']!==_0xf8da('0x38')){var _0x3eb5b1={};_0x3eb5b1[_0x235756[_0xf8da('0x24')]]={'$like':'%'+_0x3da568['query'][_0xf8da('0x36')]+'%'};return _0x3eb5b1;}})});}_0x424f5d=_[_0xf8da('0x39')]({},_0x424f5d,_0x3da568['options']);var _0x236244={'where':_0x424f5d[_0xf8da('0x34')]};return db[_0xf8da('0x27')]['count'](_0x236244)[_0xf8da('0x22')](function(_0xec8256){_0xd5780a[_0xf8da('0x3a')]=_0xec8256;if(_0x3da568[_0xf8da('0x2d')][_0xf8da('0x3b')]){_0x424f5d[_0xf8da('0x3c')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xf8da('0x3d')](_0x424f5d);})[_0xf8da('0x22')](function(_0x55c307){_0xd5780a['rows']=_0x55c307;return _0xd5780a;})[_0xf8da('0x22')](respondWithFilteredResult(_0x35544b,_0x424f5d))[_0xf8da('0x3e')](handleError(_0x35544b,null));};exports[_0xf8da('0x3f')]=function(_0x72f494,_0x555822){var _0x246192={'raw':!![],'where':{'id':_0x72f494[_0xf8da('0x40')]['id']}},_0x2807f9={};_0x2807f9[_0xf8da('0x2b')]=_['keys'](db['ChatQueueReport'][_0xf8da('0x28')]);_0x2807f9['query']=_[_0xf8da('0x41')](_0x72f494['query']);_0x2807f9[_0xf8da('0x2c')]=_[_0xf8da('0x42')](_0x2807f9[_0xf8da('0x2b')],_0x2807f9[_0xf8da('0x2d')]);_0x246192[_0xf8da('0x2e')]=_[_0xf8da('0x42')](_0x2807f9[_0xf8da('0x2b')],qs['fields'](_0x72f494[_0xf8da('0x2d')][_0xf8da('0x2f')]));_0x246192['attributes']=_0x246192[_0xf8da('0x2e')][_0xf8da('0x30')]?_0x246192['attributes']:_0x2807f9[_0xf8da('0x2b')];if(_0x72f494[_0xf8da('0x2d')][_0xf8da('0x3b')]){_0x246192[_0xf8da('0x3c')]=[{'all':!![]}];}_0x246192=_[_0xf8da('0x39')]({},_0x246192,_0x72f494['options']);return db['ChatQueueReport'][_0xf8da('0x43')](_0x246192)['then'](handleEntityNotFound(_0x555822,null))[_0xf8da('0x22')](respondWithResult(_0x555822,null))['catch'](handleError(_0x555822,null));};exports[_0xf8da('0x44')]=function(_0x3970b8,_0x1703a1){return db[_0xf8da('0x27')][_0xf8da('0x44')](_0x3970b8[_0xf8da('0x45')],{})[_0xf8da('0x22')](respondWithResult(_0x1703a1,0xc9))[_0xf8da('0x3e')](handleError(_0x1703a1,null));};exports['update']=function(_0x26db7f,_0x3decc8){if(_0x26db7f['body']['id']){delete _0x26db7f[_0xf8da('0x45')]['id'];}return db[_0xf8da('0x27')][_0xf8da('0x43')]({'where':{'id':_0x26db7f[_0xf8da('0x40')]['id']}})[_0xf8da('0x22')](handleEntityNotFound(_0x3decc8,null))['then'](saveUpdates(_0x26db7f['body'],null))['then'](respondWithResult(_0x3decc8,null))['catch'](handleError(_0x3decc8,null));};exports[_0xf8da('0x46')]=function(_0x2f8d1a,_0x5c9c5a){return db['ChatQueueReport'][_0xf8da('0x43')]({'where':{'id':_0x2f8d1a[_0xf8da('0x40')]['id']}})[_0xf8da('0x22')](handleEntityNotFound(_0x5c9c5a,null))[_0xf8da('0x22')](removeEntity(_0x5c9c5a,null))[_0xf8da('0x3e')](handleError(_0x5c9c5a,null));};exports[_0xf8da('0x47')]=function(_0x2780fe,_0x1b31bf){return db[_0xf8da('0x27')]['describe']()['then'](respondWithResult(_0x1b31bf,null))['catch'](handleError(_0x1b31bf,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 918808c..8e4b791 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x2e53e1,_0x12aed1){var _0x3a23de=function(_0xd84699){while(--_0xd84699){_0x2e53e1['push'](_0x2e53e1['shift']());}};_0x3a23de(++_0x12aed1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x5081c6,_0x599475){var _0x53c07c=function(_0x43e7a0){while(--_0x43e7a0){_0x5081c6['push'](_0x5081c6['shift']());}};_0x53c07c(++_0x599475);}(_0x757a,0xde));var _0xa757=function(_0x40aa18,_0x4f5763){_0x40aa18=_0x40aa18-0x0;var _0x26c734=_0x757a[_0x40aa18];return _0x26c734;};'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')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 71e7e39..75ea551 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 _0xd73d=['attributes','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where'];(function(_0x4c4d2d,_0x263b67){var _0x125e5a=function(_0x550f91){while(--_0x550f91){_0x4c4d2d['push'](_0x4c4d2d['shift']());}};_0x125e5a(++_0x263b67);}(_0xd73d,0xb5));var _0xdd73=function(_0x270eac,_0x5d3d11){_0x270eac=_0x270eac-0x0;var _0x54f346=_0xd73d[_0x270eac];return _0x54f346;};'use strict';var _=require(_0xdd73('0x0'));var util=require('util');var moment=require(_0xdd73('0x1'));var BPromise=require(_0xdd73('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd73('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd73('0x4'))(_0xdd73('0x5'));var config=require(_0xdd73('0x6'));var jayson=require(_0xdd73('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f3526,_0x34854c,_0x9aeae2){return new BPromise(function(_0x50a950,_0x106438){return client['request'](_0x3f3526,_0x9aeae2)[_0xdd73('0x8')](function(_0x5bb1e6){logger[_0xdd73('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x34854c,'request\x20sent');logger[_0xdd73('0xa')](_0xdd73('0xb'),_0x34854c,_0xdd73('0xc'),JSON[_0xdd73('0xd')](_0x5bb1e6));if(_0x5bb1e6[_0xdd73('0xe')]){if(_0x5bb1e6[_0xdd73('0xe')][_0xdd73('0xf')]===0x1f4){logger['error'](_0xdd73('0x10'),_0x34854c,_0x5bb1e6[_0xdd73('0xe')][_0xdd73('0x11')]);return _0x106438(_0x5bb1e6['error'][_0xdd73('0x11')]);}logger['error'](_0xdd73('0x10'),_0x34854c,_0x5bb1e6['error']['message']);return _0x50a950(_0x5bb1e6[_0xdd73('0xe')][_0xdd73('0x11')]);}else{logger['info'](_0xdd73('0x10'),_0x34854c,_0xdd73('0xc'));_0x50a950(_0x5bb1e6[_0xdd73('0x12')][_0xdd73('0x11')]);}})[_0xdd73('0x13')](function(_0x348f16){logger[_0xdd73('0xe')](_0xdd73('0x10'),_0x34854c,_0x348f16);_0x106438(_0x348f16);});});}exports[_0xdd73('0x14')]=function(_0x4aa97b){var _0x13647f=this;return new Promise(function(_0x31b93b,_0x528ca5){return db[_0xdd73('0x15')][_0xdd73('0x16')](_0x4aa97b[_0xdd73('0x17')],{'raw':_0x4aa97b[_0xdd73('0x18')]?_0x4aa97b[_0xdd73('0x18')][_0xdd73('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2d785d){logger[_0xdd73('0x9')]('CreateChatQueueReport',_0x4aa97b);logger[_0xdd73('0xa')]('CreateChatQueueReport',_0x4aa97b,JSON[_0xdd73('0xd')](_0x2d785d));_0x31b93b(_0x2d785d);})['catch'](function(_0x22abd7){logger['error'](_0xdd73('0x14'),_0x22abd7['message'],_0x4aa97b);_0x528ca5(_0x13647f['error'](0x1f4,_0x22abd7['message']));});});};exports[_0xdd73('0x1a')]=function(_0x4d1be6){var _0x5e5a8f=this;return new Promise(function(_0x4aba45,_0x29ade4){return db[_0xdd73('0x15')][_0xdd73('0x1b')](_0x4d1be6[_0xdd73('0x17')],{'raw':_0x4d1be6[_0xdd73('0x18')]?_0x4d1be6['options'][_0xdd73('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d1be6[_0xdd73('0x18')]?_0x4d1be6['options'][_0xdd73('0x1c')]||null:null,'attributes':_0x4d1be6[_0xdd73('0x18')]?_0x4d1be6['options'][_0xdd73('0x1d')]||null:null,'limit':_0x4d1be6[_0xdd73('0x18')]?_0x4d1be6[_0xdd73('0x18')]['limit']||null:null})['then'](function(_0x213a7e){logger[_0xdd73('0x9')](_0xdd73('0x1a'),_0x4d1be6);logger[_0xdd73('0xa')](_0xdd73('0x1a'),_0x4d1be6,JSON[_0xdd73('0xd')](_0x213a7e));_0x4aba45(_0x213a7e);})['catch'](function(_0x47ca73){logger['error'](_0xdd73('0x1a'),_0x47ca73[_0xdd73('0x11')],_0x4d1be6);_0x29ade4(_0x5e5a8f['error'](0x1f4,_0x47ca73[_0xdd73('0x11')]));});});}; \ No newline at end of file +var _0x99f5=['message','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','debug','UpdateChatQueueReport','update','where','limit','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0x99f5,0x16d));var _0x599f=function(_0x34727a,_0x5f2788){_0x34727a=_0x34727a-0x0;var _0x180163=_0x99f5[_0x34727a];return _0x180163;};'use strict';var _=require('lodash');var util=require(_0x599f('0x0'));var moment=require(_0x599f('0x1'));var BPromise=require(_0x599f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x599f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x599f('0x4'));var logger=require(_0x599f('0x5'))(_0x599f('0x6'));var config=require('../../config/environment');var jayson=require(_0x599f('0x7'));var client=jayson[_0x599f('0x8')][_0x599f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9f1a4b,_0x5ce52d,_0x61fea2){return new BPromise(function(_0x387f47,_0x1d50a4){return client[_0x599f('0xa')](_0x9f1a4b,_0x61fea2)[_0x599f('0xb')](function(_0x232767){logger[_0x599f('0xc')](_0x599f('0xd'),_0x5ce52d,_0x599f('0xe'));logger['debug'](_0x599f('0xf'),_0x5ce52d,_0x599f('0xe'),JSON[_0x599f('0x10')](_0x232767));if(_0x232767[_0x599f('0x11')]){if(_0x232767[_0x599f('0x11')][_0x599f('0x12')]===0x1f4){logger[_0x599f('0x11')](_0x599f('0xd'),_0x5ce52d,_0x232767[_0x599f('0x11')][_0x599f('0x13')]);return _0x1d50a4(_0x232767[_0x599f('0x11')][_0x599f('0x13')]);}logger[_0x599f('0x11')](_0x599f('0xd'),_0x5ce52d,_0x232767['error'][_0x599f('0x13')]);return _0x387f47(_0x232767[_0x599f('0x11')]['message']);}else{logger[_0x599f('0xc')](_0x599f('0xd'),_0x5ce52d,'request\x20sent');_0x387f47(_0x232767[_0x599f('0x14')][_0x599f('0x13')]);}})[_0x599f('0x15')](function(_0x4455b1){logger['error'](_0x599f('0xd'),_0x5ce52d,_0x4455b1);_0x1d50a4(_0x4455b1);});});}exports[_0x599f('0x16')]=function(_0x4aabe2){var _0x27c54a=this;return new Promise(function(_0x300851,_0xd4b16){return db[_0x599f('0x17')]['create'](_0x4aabe2[_0x599f('0x18')],{'raw':_0x4aabe2[_0x599f('0x19')]?_0x4aabe2[_0x599f('0x19')][_0x599f('0x1a')]===undefined?!![]:![]:!![]})[_0x599f('0xb')](function(_0x84cb67){logger[_0x599f('0xc')](_0x599f('0x16'),_0x4aabe2);logger[_0x599f('0x1b')](_0x599f('0x16'),_0x4aabe2,JSON[_0x599f('0x10')](_0x84cb67));_0x300851(_0x84cb67);})[_0x599f('0x15')](function(_0x3c59a9){logger['error'](_0x599f('0x16'),_0x3c59a9[_0x599f('0x13')],_0x4aabe2);_0xd4b16(_0x27c54a['error'](0x1f4,_0x3c59a9[_0x599f('0x13')]));});});};exports[_0x599f('0x1c')]=function(_0x1a3472){var _0x4c3452=this;return new Promise(function(_0x468805,_0x244589){return db[_0x599f('0x17')][_0x599f('0x1d')](_0x1a3472[_0x599f('0x18')],{'raw':_0x1a3472[_0x599f('0x19')]?_0x1a3472['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a3472['options']?_0x1a3472['options'][_0x599f('0x1e')]||null:null,'attributes':_0x1a3472[_0x599f('0x19')]?_0x1a3472['options']['attributes']||null:null,'limit':_0x1a3472['options']?_0x1a3472[_0x599f('0x19')][_0x599f('0x1f')]||null:null})['then'](function(_0x4ddcc9){logger[_0x599f('0xc')]('UpdateChatQueueReport',_0x1a3472);logger[_0x599f('0x1b')]('UpdateChatQueueReport',_0x1a3472,JSON[_0x599f('0x10')](_0x4ddcc9));_0x468805(_0x4ddcc9);})['catch'](function(_0x57cad3){logger[_0x599f('0x11')]('UpdateChatQueueReport',_0x57cad3[_0x599f('0x13')],_0x1a3472);_0x244589(_0x4c3452[_0x599f('0x11')](0x1f4,_0x57cad3[_0x599f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index c5a1cc0..165bb19 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 _0x6b4f=['../../config/environment','./chatQueueReport.controller','get','describe','/:id','isAuthenticated','show','post','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x6b4f,0x1ad));var _0xf6b4=function(_0x308493,_0x1eac48){_0x308493=_0x308493-0x0;var _0x2c0ff8=_0x6b4f[_0x308493];return _0x2c0ff8;};'use strict';var multer=require(_0xf6b4('0x0'));var util=require(_0xf6b4('0x1'));var path=require(_0xf6b4('0x2'));var timeout=require(_0xf6b4('0x3'));var express=require(_0xf6b4('0x4'));var router=express[_0xf6b4('0x5')]();var fs_extra=require(_0xf6b4('0x6'));var auth=require(_0xf6b4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf6b4('0x8'));var controller=require(_0xf6b4('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf6b4('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xf6b4('0xb')]);router['get'](_0xf6b4('0xc'),auth[_0xf6b4('0xd')](),controller[_0xf6b4('0xe')]);router[_0xf6b4('0xf')]('/',auth[_0xf6b4('0xd')](),controller['create']);router['put'](_0xf6b4('0xc'),auth[_0xf6b4('0xd')](),controller[_0xf6b4('0x10')]);router[_0xf6b4('0x11')](_0xf6b4('0xc'),auth['isAuthenticated'](),controller[_0xf6b4('0x12')]);module['exports']=router; \ No newline at end of file +var _0x84ec=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated'];(function(_0xf3d32c,_0xd29dcc){var _0x4516e6=function(_0x236a34){while(--_0x236a34){_0xf3d32c['push'](_0xf3d32c['shift']());}};_0x4516e6(++_0xd29dcc);}(_0x84ec,0x1ee));var _0xc84e=function(_0x5ec9db,_0x1fa59c){_0x5ec9db=_0x5ec9db-0x0;var _0x2437fc=_0x84ec[_0x5ec9db];return _0x2437fc;};'use strict';var multer=require(_0xc84e('0x0'));var util=require(_0xc84e('0x1'));var path=require(_0xc84e('0x2'));var timeout=require(_0xc84e('0x3'));var express=require(_0xc84e('0x4'));var router=express['Router']();var fs_extra=require(_0xc84e('0x5'));var auth=require(_0xc84e('0x6'));var interaction=require(_0xc84e('0x7'));var config=require(_0xc84e('0x8'));var controller=require(_0xc84e('0x9'));router[_0xc84e('0xa')]('/',auth[_0xc84e('0xb')](),controller[_0xc84e('0xc')]);router[_0xc84e('0xa')](_0xc84e('0xd'),auth[_0xc84e('0xb')](),controller[_0xc84e('0xe')]);router[_0xc84e('0xa')](_0xc84e('0xf'),auth[_0xc84e('0xb')](),controller[_0xc84e('0x10')]);router[_0xc84e('0x11')]('/',auth['isAuthenticated'](),controller[_0xc84e('0x12')]);router[_0xc84e('0x13')](_0xc84e('0xf'),auth[_0xc84e('0xb')](),controller[_0xc84e('0x14')]);router[_0xc84e('0x15')](_0xc84e('0xf'),auth[_0xc84e('0xb')](),controller[_0xc84e('0x16')]);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 5b546a2..8d28b64 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x573bc3,_0x168448){var _0x2c4b20=function(_0x5ded5f){while(--_0x5ded5f){_0x573bc3['push'](_0x573bc3['shift']());}};_0x2c4b20(++_0x168448);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x5dbb3e,_0x4b494d){var _0x138d23=function(_0x414fb4){while(--_0x414fb4){_0x5dbb3e['push'](_0x5dbb3e['shift']());}};_0x138d23(++_0x4b494d);}(_0x34e8,0x12c));var _0x834e=function(_0x5d1f25,_0x263230){_0x5d1f25=_0x5d1f25-0x0;var _0x5b9fc0=_0x34e8[_0x5d1f25];return _0x5b9fc0;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 6339b3a..11c5cb2 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 _0xf120=['send','index','map','ChatTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy'];(function(_0x5910ed,_0x2c5495){var _0x376d39=function(_0x4e4718){while(--_0x4e4718){_0x5910ed['push'](_0x5910ed['shift']());}};_0x376d39(++_0x2c5495);}(_0xf120,0x19a));var _0x0f12=function(_0x2a9f6c,_0x32940e){_0x2a9f6c=_0x2a9f6c-0x0;var _0x3037b2=_0xf120[_0x2a9f6c];return _0x3037b2;};'use strict';var emlformat=require(_0x0f12('0x0'));var rimraf=require(_0x0f12('0x1'));var zipdir=require(_0x0f12('0x2'));var jsonpatch=require(_0x0f12('0x3'));var rp=require(_0x0f12('0x4'));var moment=require('moment');var BPromise=require(_0x0f12('0x5'));var Mustache=require(_0x0f12('0x6'));var util=require(_0x0f12('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0f12('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f12('0x9'));var _=require(_0x0f12('0xa'));var squel=require(_0x0f12('0xb'));var crypto=require('crypto');var jsforce=require(_0x0f12('0xc'));var deskjs=require(_0x0f12('0xd'));var toCsv=require(_0x0f12('0x8'));var querystring=require(_0x0f12('0xe'));var Papa=require('papaparse');var Redis=require(_0x0f12('0xf'));var authService=require(_0x0f12('0x10'));var qs=require(_0x0f12('0x11'));var as=require(_0x0f12('0x12'));var hardwareService=require(_0x0f12('0x13'));var logger=require(_0x0f12('0x14'))(_0x0f12('0x15'));var utils=require(_0x0f12('0x16'));var config=require(_0x0f12('0x17'));var licenseUtil=require(_0x0f12('0x18'));var db=require(_0x0f12('0x19'))['db'];function respondWithStatusCode(_0x55fe32,_0x56672f){_0x56672f=_0x56672f||0xcc;return function(_0x59b5a6){if(_0x59b5a6){return _0x55fe32[_0x0f12('0x1a')](_0x56672f);}return _0x55fe32[_0x0f12('0x1b')](_0x56672f)[_0x0f12('0x1c')]();};}function respondWithResult(_0x5983e4,_0x449115){_0x449115=_0x449115||0xc8;return function(_0x18046f){if(_0x18046f){return _0x5983e4[_0x0f12('0x1b')](_0x449115)[_0x0f12('0x1d')](_0x18046f);}};}function respondWithFilteredResult(_0x20d21c,_0x8e0688){return function(_0x47dac7){if(_0x47dac7){var _0x532bb=typeof _0x8e0688[_0x0f12('0x1e')]===_0x0f12('0x1f')&&typeof _0x8e0688[_0x0f12('0x20')]==='undefined';var _0x5b9745=_0x47dac7['count'];var _0x2d414f=_0x532bb?0x0:_0x8e0688[_0x0f12('0x1e')];var _0x2c73bf=_0x532bb?_0x47dac7[_0x0f12('0x21')]:_0x8e0688[_0x0f12('0x1e')]+_0x8e0688[_0x0f12('0x20')];var _0x5b0bc8;if(_0x2c73bf>=_0x5b9745){_0x2c73bf=_0x5b9745;_0x5b0bc8=0xc8;}else{_0x5b0bc8=0xce;}_0x20d21c[_0x0f12('0x1b')](_0x5b0bc8);return _0x20d21c['set']('Content-Range',_0x2d414f+'-'+_0x2c73bf+'/'+_0x5b9745)[_0x0f12('0x1d')](_0x47dac7);}return null;};}function patchUpdates(_0x574239){return function(_0x16c751){try{jsonpatch[_0x0f12('0x22')](_0x16c751,_0x574239,!![]);}catch(_0xc7f294){return BPromise[_0x0f12('0x23')](_0xc7f294);}return _0x16c751[_0x0f12('0x24')]();};}function saveUpdates(_0x4f0454,_0x28ecc2){return function(_0x56b769){if(_0x56b769){return _0x56b769[_0x0f12('0x25')](_0x4f0454)[_0x0f12('0x26')](function(_0x49d992){return _0x49d992;});}return null;};}function removeEntity(_0x311ed6,_0x35d609){return function(_0x52e0c4){if(_0x52e0c4){return _0x52e0c4[_0x0f12('0x27')]()[_0x0f12('0x26')](function(){_0x311ed6[_0x0f12('0x1b')](0xcc)[_0x0f12('0x1c')]();});}};}function handleEntityNotFound(_0x48d040,_0x469ffa){return function(_0x3ed08f){if(!_0x3ed08f){_0x48d040[_0x0f12('0x1a')](0x194);}return _0x3ed08f;};}function handleError(_0x5a8df5,_0x8dd470){_0x8dd470=_0x8dd470||0x1f4;return function(_0xa69f89){logger['error'](_0xa69f89['stack']);if(_0xa69f89['name']){delete _0xa69f89['name'];}_0x5a8df5[_0x0f12('0x1b')](_0x8dd470)[_0x0f12('0x28')](_0xa69f89);};}exports[_0x0f12('0x29')]=function(_0x314c54,_0x27b95e){var _0x503076={},_0x3c27e6={},_0x7df17={'count':0x0,'rows':[]};var _0x2f4110=_[_0x0f12('0x2a')](db[_0x0f12('0x2b')][_0x0f12('0x2c')],function(_0x2feed2){return{'name':_0x2feed2['fieldName'],'type':_0x2feed2[_0x0f12('0x2d')][_0x0f12('0x2e')]};});_0x3c27e6['model']=_['map'](_0x2f4110,'name');_0x3c27e6[_0x0f12('0x2f')]=_[_0x0f12('0x30')](_0x314c54[_0x0f12('0x2f')]);_0x3c27e6[_0x0f12('0x31')]=_[_0x0f12('0x32')](_0x3c27e6[_0x0f12('0x33')],_0x3c27e6[_0x0f12('0x2f')]);_0x503076[_0x0f12('0x34')]=_['intersection'](_0x3c27e6[_0x0f12('0x33')],qs['fields'](_0x314c54[_0x0f12('0x2f')][_0x0f12('0x35')]));_0x503076[_0x0f12('0x34')]=_0x503076['attributes']['length']?_0x503076[_0x0f12('0x34')]:_0x3c27e6[_0x0f12('0x33')];if(!_0x314c54['query'][_0x0f12('0x36')](_0x0f12('0x37'))){_0x503076[_0x0f12('0x20')]=qs[_0x0f12('0x20')](_0x314c54['query']['limit']);_0x503076[_0x0f12('0x1e')]=qs[_0x0f12('0x1e')](_0x314c54[_0x0f12('0x2f')][_0x0f12('0x1e')]);}_0x503076[_0x0f12('0x38')]=qs[_0x0f12('0x39')](_0x314c54[_0x0f12('0x2f')]['sort']);_0x503076['where']=qs['filters'](_[_0x0f12('0x3a')](_0x314c54[_0x0f12('0x2f')],_0x3c27e6['filters']),_0x2f4110);if(_0x314c54[_0x0f12('0x2f')][_0x0f12('0x3b')]){_0x503076[_0x0f12('0x3c')]=_[_0x0f12('0x3d')](_0x503076[_0x0f12('0x3c')],{'$or':_[_0x0f12('0x2a')](_0x2f4110,function(_0x374bd0){if(_0x374bd0[_0x0f12('0x2d')]!==_0x0f12('0x3e')){var _0x9ea8f2={};_0x9ea8f2[_0x374bd0['name']]={'$like':'%'+_0x314c54[_0x0f12('0x2f')][_0x0f12('0x3b')]+'%'};return _0x9ea8f2;}})});}_0x503076=_['merge']({},_0x503076,_0x314c54[_0x0f12('0x3f')]);var _0x18851d={'where':_0x503076[_0x0f12('0x3c')]};return db['ChatTransferReport'][_0x0f12('0x21')](_0x18851d)[_0x0f12('0x26')](function(_0x489937){_0x7df17[_0x0f12('0x21')]=_0x489937;if(_0x314c54[_0x0f12('0x2f')][_0x0f12('0x40')]){_0x503076[_0x0f12('0x41')]=[{'all':!![]}];}return db[_0x0f12('0x2b')][_0x0f12('0x42')](_0x503076);})[_0x0f12('0x26')](function(_0x3b92cb){_0x7df17[_0x0f12('0x43')]=_0x3b92cb;return _0x7df17;})[_0x0f12('0x26')](respondWithFilteredResult(_0x27b95e,_0x503076))[_0x0f12('0x44')](handleError(_0x27b95e,null));};exports[_0x0f12('0x45')]=function(_0x58edea,_0x57710a){var _0xb9f7f6={'raw':!![],'where':{'id':_0x58edea['params']['id']}},_0x1c1116={};_0x1c1116[_0x0f12('0x33')]=_[_0x0f12('0x30')](db['ChatTransferReport'][_0x0f12('0x2c')]);_0x1c1116[_0x0f12('0x2f')]=_[_0x0f12('0x30')](_0x58edea[_0x0f12('0x2f')]);_0x1c1116[_0x0f12('0x31')]=_[_0x0f12('0x32')](_0x1c1116[_0x0f12('0x33')],_0x1c1116[_0x0f12('0x2f')]);_0xb9f7f6[_0x0f12('0x34')]=_[_0x0f12('0x32')](_0x1c1116[_0x0f12('0x33')],qs[_0x0f12('0x35')](_0x58edea[_0x0f12('0x2f')]['fields']));_0xb9f7f6['attributes']=_0xb9f7f6['attributes']['length']?_0xb9f7f6[_0x0f12('0x34')]:_0x1c1116['model'];if(_0x58edea[_0x0f12('0x2f')][_0x0f12('0x40')]){_0xb9f7f6[_0x0f12('0x41')]=[{'all':!![]}];}_0xb9f7f6=_[_0x0f12('0x3d')]({},_0xb9f7f6,_0x58edea['options']);return db[_0x0f12('0x2b')][_0x0f12('0x46')](_0xb9f7f6)[_0x0f12('0x26')](handleEntityNotFound(_0x57710a,null))['then'](respondWithResult(_0x57710a,null))[_0x0f12('0x44')](handleError(_0x57710a,null));};exports['create']=function(_0x5b9c26,_0x3c110e){return db[_0x0f12('0x2b')][_0x0f12('0x47')](_0x5b9c26[_0x0f12('0x48')],{})['then'](respondWithResult(_0x3c110e,0xc9))[_0x0f12('0x44')](handleError(_0x3c110e,null));};exports[_0x0f12('0x25')]=function(_0x5f11bd,_0x2fd16f){if(_0x5f11bd[_0x0f12('0x48')]['id']){delete _0x5f11bd[_0x0f12('0x48')]['id'];}return db[_0x0f12('0x2b')]['find']({'where':{'id':_0x5f11bd[_0x0f12('0x49')]['id']}})[_0x0f12('0x26')](handleEntityNotFound(_0x2fd16f,null))['then'](saveUpdates(_0x5f11bd[_0x0f12('0x48')],null))['then'](respondWithResult(_0x2fd16f,null))[_0x0f12('0x44')](handleError(_0x2fd16f,null));};exports['destroy']=function(_0x597161,_0x1699fc){return db['ChatTransferReport']['find']({'where':{'id':_0x597161[_0x0f12('0x49')]['id']}})[_0x0f12('0x26')](handleEntityNotFound(_0x1699fc,null))[_0x0f12('0x26')](removeEntity(_0x1699fc,null))[_0x0f12('0x44')](handleError(_0x1699fc,null));};exports[_0x0f12('0x4a')]=function(_0x182928,_0x2d9a14){return db['ChatTransferReport']['describe']()[_0x0f12('0x26')](respondWithResult(_0x2d9a14,null))[_0x0f12('0x44')](handleError(_0x2d9a14,null));}; \ No newline at end of file +var _0x327b=['query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','ChatTransferReport','findAll','catch','show','params','fields','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','count','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x3a09dc,_0x1a10a4){var _0x362cc2=function(_0x11a3f6){while(--_0x11a3f6){_0x3a09dc['push'](_0x3a09dc['shift']());}};_0x362cc2(++_0x1a10a4);}(_0x327b,0xfb));var _0xb327=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x327b[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0xb327('0x0'));var rimraf=require(_0xb327('0x1'));var zipdir=require(_0xb327('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb327('0x3'));var moment=require(_0xb327('0x4'));var BPromise=require(_0xb327('0x5'));var Mustache=require(_0xb327('0x6'));var util=require(_0xb327('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb327('0x8'));var _=require('lodash');var squel=require(_0xb327('0x9'));var crypto=require(_0xb327('0xa'));var jsforce=require(_0xb327('0xb'));var deskjs=require(_0xb327('0xc'));var toCsv=require(_0xb327('0xd'));var querystring=require(_0xb327('0xe'));var Papa=require(_0xb327('0xf'));var Redis=require(_0xb327('0x10'));var authService=require(_0xb327('0x11'));var qs=require(_0xb327('0x12'));var as=require(_0xb327('0x13'));var hardwareService=require(_0xb327('0x14'));var logger=require('../../config/logger')(_0xb327('0x15'));var utils=require(_0xb327('0x16'));var config=require(_0xb327('0x17'));var licenseUtil=require(_0xb327('0x18'));var db=require(_0xb327('0x19'))['db'];function respondWithStatusCode(_0x16dd49,_0x10635a){_0x10635a=_0x10635a||0xcc;return function(_0xc10db4){if(_0xc10db4){return _0x16dd49[_0xb327('0x1a')](_0x10635a);}return _0x16dd49['status'](_0x10635a)[_0xb327('0x1b')]();};}function respondWithResult(_0x4eae43,_0x297ea9){_0x297ea9=_0x297ea9||0xc8;return function(_0x19346c){if(_0x19346c){return _0x4eae43[_0xb327('0x1c')](_0x297ea9)['json'](_0x19346c);}};}function respondWithFilteredResult(_0x41510f,_0x5ea038){return function(_0x293ba9){if(_0x293ba9){var _0x5e2ead=typeof _0x5ea038[_0xb327('0x1d')]==='undefined'&&typeof _0x5ea038[_0xb327('0x1e')]==='undefined';var _0x5c6adb=_0x293ba9[_0xb327('0x1f')];var _0x50c76d=_0x5e2ead?0x0:_0x5ea038[_0xb327('0x1d')];var _0x380c6a=_0x5e2ead?_0x293ba9[_0xb327('0x1f')]:_0x5ea038[_0xb327('0x1d')]+_0x5ea038[_0xb327('0x1e')];var _0x3b1bab;if(_0x380c6a>=_0x5c6adb){_0x380c6a=_0x5c6adb;_0x3b1bab=0xc8;}else{_0x3b1bab=0xce;}_0x41510f[_0xb327('0x1c')](_0x3b1bab);return _0x41510f['set'](_0xb327('0x20'),_0x50c76d+'-'+_0x380c6a+'/'+_0x5c6adb)[_0xb327('0x21')](_0x293ba9);}return null;};}function patchUpdates(_0x823f85){return function(_0x539169){try{jsonpatch[_0xb327('0x22')](_0x539169,_0x823f85,!![]);}catch(_0x1aaad2){return BPromise['reject'](_0x1aaad2);}return _0x539169[_0xb327('0x23')]();};}function saveUpdates(_0x1f82e1,_0x250b6e){return function(_0x1b391d){if(_0x1b391d){return _0x1b391d[_0xb327('0x24')](_0x1f82e1)[_0xb327('0x25')](function(_0x3bd4fa){return _0x3bd4fa;});}return null;};}function removeEntity(_0x379639,_0x2a4380){return function(_0x173b0f){if(_0x173b0f){return _0x173b0f[_0xb327('0x26')]()[_0xb327('0x25')](function(){_0x379639[_0xb327('0x1c')](0xcc)[_0xb327('0x1b')]();});}};}function handleEntityNotFound(_0x15a379,_0x538e86){return function(_0x595122){if(!_0x595122){_0x15a379['sendStatus'](0x194);}return _0x595122;};}function handleError(_0x7a44f5,_0x30c929){_0x30c929=_0x30c929||0x1f4;return function(_0x241a6a){logger['error'](_0x241a6a[_0xb327('0x27')]);if(_0x241a6a[_0xb327('0x28')]){delete _0x241a6a[_0xb327('0x28')];}_0x7a44f5['status'](_0x30c929)[_0xb327('0x29')](_0x241a6a);};}exports[_0xb327('0x2a')]=function(_0xe887fc,_0x79686){var _0x8b4fd={},_0x23b0d6={},_0x5e8a1e={'count':0x0,'rows':[]};var _0x2b94c1=_[_0xb327('0x2b')](db['ChatTransferReport'][_0xb327('0x2c')],function(_0x2f29f8){return{'name':_0x2f29f8[_0xb327('0x2d')],'type':_0x2f29f8[_0xb327('0x2e')][_0xb327('0x2f')]};});_0x23b0d6[_0xb327('0x30')]=_[_0xb327('0x2b')](_0x2b94c1,_0xb327('0x28'));_0x23b0d6[_0xb327('0x31')]=_[_0xb327('0x32')](_0xe887fc[_0xb327('0x31')]);_0x23b0d6[_0xb327('0x33')]=_[_0xb327('0x34')](_0x23b0d6[_0xb327('0x30')],_0x23b0d6['query']);_0x8b4fd[_0xb327('0x35')]=_['intersection'](_0x23b0d6['model'],qs['fields'](_0xe887fc[_0xb327('0x31')]['fields']));_0x8b4fd['attributes']=_0x8b4fd[_0xb327('0x35')][_0xb327('0x36')]?_0x8b4fd[_0xb327('0x35')]:_0x23b0d6[_0xb327('0x30')];if(!_0xe887fc[_0xb327('0x31')][_0xb327('0x37')](_0xb327('0x38'))){_0x8b4fd['limit']=qs[_0xb327('0x1e')](_0xe887fc[_0xb327('0x31')]['limit']);_0x8b4fd[_0xb327('0x1d')]=qs[_0xb327('0x1d')](_0xe887fc[_0xb327('0x31')][_0xb327('0x1d')]);}_0x8b4fd['order']=qs[_0xb327('0x39')](_0xe887fc[_0xb327('0x31')][_0xb327('0x39')]);_0x8b4fd[_0xb327('0x3a')]=qs[_0xb327('0x33')](_['pick'](_0xe887fc[_0xb327('0x31')],_0x23b0d6[_0xb327('0x33')]),_0x2b94c1);if(_0xe887fc[_0xb327('0x31')][_0xb327('0x3b')]){_0x8b4fd[_0xb327('0x3a')]=_[_0xb327('0x3c')](_0x8b4fd['where'],{'$or':_[_0xb327('0x2b')](_0x2b94c1,function(_0x4c152e){if(_0x4c152e[_0xb327('0x2e')]!==_0xb327('0x3d')){var _0x1bb25c={};_0x1bb25c[_0x4c152e[_0xb327('0x28')]]={'$like':'%'+_0xe887fc[_0xb327('0x31')][_0xb327('0x3b')]+'%'};return _0x1bb25c;}})});}_0x8b4fd=_[_0xb327('0x3c')]({},_0x8b4fd,_0xe887fc[_0xb327('0x3e')]);var _0x1b2140={'where':_0x8b4fd[_0xb327('0x3a')]};return db['ChatTransferReport'][_0xb327('0x1f')](_0x1b2140)['then'](function(_0x105fb5){_0x5e8a1e['count']=_0x105fb5;if(_0xe887fc['query'][_0xb327('0x3f')]){_0x8b4fd[_0xb327('0x40')]=[{'all':!![]}];}return db[_0xb327('0x41')][_0xb327('0x42')](_0x8b4fd);})[_0xb327('0x25')](function(_0x4876b3){_0x5e8a1e['rows']=_0x4876b3;return _0x5e8a1e;})[_0xb327('0x25')](respondWithFilteredResult(_0x79686,_0x8b4fd))[_0xb327('0x43')](handleError(_0x79686,null));};exports[_0xb327('0x44')]=function(_0xcce206,_0x209308){var _0x4db639={'raw':!![],'where':{'id':_0xcce206[_0xb327('0x45')]['id']}},_0x1255d2={};_0x1255d2['model']=_[_0xb327('0x32')](db[_0xb327('0x41')][_0xb327('0x2c')]);_0x1255d2[_0xb327('0x31')]=_['keys'](_0xcce206[_0xb327('0x31')]);_0x1255d2[_0xb327('0x33')]=_[_0xb327('0x34')](_0x1255d2['model'],_0x1255d2[_0xb327('0x31')]);_0x4db639['attributes']=_[_0xb327('0x34')](_0x1255d2[_0xb327('0x30')],qs['fields'](_0xcce206[_0xb327('0x31')][_0xb327('0x46')]));_0x4db639[_0xb327('0x35')]=_0x4db639[_0xb327('0x35')]['length']?_0x4db639[_0xb327('0x35')]:_0x1255d2[_0xb327('0x30')];if(_0xcce206[_0xb327('0x31')][_0xb327('0x3f')]){_0x4db639['include']=[{'all':!![]}];}_0x4db639=_[_0xb327('0x3c')]({},_0x4db639,_0xcce206[_0xb327('0x3e')]);return db['ChatTransferReport'][_0xb327('0x47')](_0x4db639)['then'](handleEntityNotFound(_0x209308,null))['then'](respondWithResult(_0x209308,null))[_0xb327('0x43')](handleError(_0x209308,null));};exports[_0xb327('0x48')]=function(_0x48cb4a,_0x118578){return db[_0xb327('0x41')][_0xb327('0x48')](_0x48cb4a[_0xb327('0x49')],{})[_0xb327('0x25')](respondWithResult(_0x118578,0xc9))[_0xb327('0x43')](handleError(_0x118578,null));};exports['update']=function(_0x1e54dc,_0x54e868){if(_0x1e54dc[_0xb327('0x49')]['id']){delete _0x1e54dc['body']['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x1e54dc[_0xb327('0x45')]['id']}})[_0xb327('0x25')](handleEntityNotFound(_0x54e868,null))[_0xb327('0x25')](saveUpdates(_0x1e54dc[_0xb327('0x49')],null))[_0xb327('0x25')](respondWithResult(_0x54e868,null))[_0xb327('0x43')](handleError(_0x54e868,null));};exports[_0xb327('0x26')]=function(_0x2be5be,_0x2e1d7c){return db[_0xb327('0x41')][_0xb327('0x47')]({'where':{'id':_0x2be5be[_0xb327('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e1d7c,null))[_0xb327('0x25')](removeEntity(_0x2e1d7c,null))[_0xb327('0x43')](handleError(_0x2e1d7c,null));};exports['describe']=function(_0xf6351a,_0x33955c){return db['ChatTransferReport'][_0xb327('0x4a')]()[_0xb327('0x25')](respondWithResult(_0x33955c,null))[_0xb327('0x43')](handleError(_0x33955c,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 371678b..089b1b8 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 _0x9e87=['path','rimraf','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger','moment','bluebird'];(function(_0x3df8f4,_0x383ced){var _0x155cd3=function(_0x38618c){while(--_0x38618c){_0x3df8f4['push'](_0x3df8f4['shift']());}};_0x155cd3(++_0x383ced);}(_0x9e87,0x14c));var _0x79e8=function(_0x315b61,_0x4bb11e){_0x315b61=_0x315b61-0x0;var _0x3521e8=_0x9e87[_0x315b61];return _0x3521e8;};'use strict';var _=require('lodash');var util=require(_0x79e8('0x0'));var logger=require(_0x79e8('0x1'))('api');var moment=require(_0x79e8('0x2'));var BPromise=require(_0x79e8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79e8('0x4'));var rimraf=require(_0x79e8('0x5'));var config=require(_0x79e8('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0x79e8('0x7')]=function(_0x38f653,_0xa976dd){return _0x38f653[_0x79e8('0x8')](_0x79e8('0x9'),attributes,{'tableName':_0x79e8('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x79e8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe379=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0xe379,0x1d5));var _0x9e37=function(_0x43f3a9,_0x480a14){_0x43f3a9=_0x43f3a9-0x0;var _0x4551b9=_0xe379[_0x43f3a9];return _0x4551b9;};'use strict';var _=require(_0x9e37('0x0'));var util=require('util');var logger=require(_0x9e37('0x1'))(_0x9e37('0x2'));var moment=require(_0x9e37('0x3'));var BPromise=require(_0x9e37('0x4'));var rp=require(_0x9e37('0x5'));var fs=require('fs');var path=require(_0x9e37('0x6'));var rimraf=require(_0x9e37('0x7'));var config=require('../../config/environment');var attributes=require(_0x9e37('0x8'));module[_0x9e37('0x9')]=function(_0x445c4a,_0x259b92){return _0x445c4a['define'](_0x9e37('0xa'),attributes,{'tableName':_0x9e37('0xb'),'paranoid':![],'indexes':[{'name':_0x9e37('0xc'),'fields':[_0x9e37('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 8b08d69..034974b 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 _0x006c=['ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then'];(function(_0xdf4dd8,_0x32c17b){var _0x5c56db=function(_0x52e377){while(--_0x52e377){_0xdf4dd8['push'](_0xdf4dd8['shift']());}};_0x5c56db(++_0x32c17b);}(_0x006c,0xc6));var _0xc006=function(_0x428d47,_0x4709a9){_0x428d47=_0x428d47-0x0;var _0x18e3b0=_0x006c[_0x428d47];return _0x18e3b0;};'use strict';var _=require(_0xc006('0x0'));var util=require(_0xc006('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc006('0x2'));var fs=require('fs');var Redis=require(_0xc006('0x3'));var db=require(_0xc006('0x4'))['db'];var utils=require(_0xc006('0x5'));var logger=require(_0xc006('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc006('0x7'));var client=jayson[_0xc006('0x8')][_0xc006('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e081c,_0x1b0d2d,_0x8123ef){return new BPromise(function(_0x34efc9,_0x3df98b){return client[_0xc006('0xa')](_0x3e081c,_0x8123ef)[_0xc006('0xb')](function(_0x562a68){logger['info'](_0xc006('0xc'),_0x1b0d2d,'request\x20sent');logger[_0xc006('0xd')](_0xc006('0xe'),_0x1b0d2d,'request\x20sent',JSON[_0xc006('0xf')](_0x562a68));if(_0x562a68[_0xc006('0x10')]){if(_0x562a68['error'][_0xc006('0x11')]===0x1f4){logger[_0xc006('0x10')](_0xc006('0xc'),_0x1b0d2d,_0x562a68[_0xc006('0x10')]['message']);return _0x3df98b(_0x562a68['error'][_0xc006('0x12')]);}logger[_0xc006('0x10')](_0xc006('0xc'),_0x1b0d2d,_0x562a68[_0xc006('0x10')]['message']);return _0x34efc9(_0x562a68[_0xc006('0x10')]['message']);}else{logger[_0xc006('0x13')](_0xc006('0xc'),_0x1b0d2d,'request\x20sent');_0x34efc9(_0x562a68['result'][_0xc006('0x12')]);}})[_0xc006('0x14')](function(_0x4ba022){logger[_0xc006('0x10')](_0xc006('0xc'),_0x1b0d2d,_0x4ba022);_0x3df98b(_0x4ba022);});});} \ No newline at end of file +var _0x3b27=['message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s'];(function(_0x2b6bbd,_0xe22b83){var _0x5138f3=function(_0x5289f7){while(--_0x5289f7){_0x2b6bbd['push'](_0x2b6bbd['shift']());}};_0x5138f3(++_0xe22b83);}(_0x3b27,0x143));var _0x73b2=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x3b27[_0x62c958];return _0x57ec61;};'use strict';var _=require('lodash');var util=require(_0x73b2('0x0'));var moment=require('moment');var BPromise=require(_0x73b2('0x1'));var rs=require(_0x73b2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73b2('0x3'))['db'];var utils=require(_0x73b2('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x73b2('0x5'));var client=jayson[_0x73b2('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f312c,_0x33dc55,_0x429257){return new BPromise(function(_0x3c4e6b,_0x31c748){return client[_0x73b2('0x7')](_0x1f312c,_0x429257)[_0x73b2('0x8')](function(_0xf0f0aa){logger[_0x73b2('0x9')]('ChatTransferReport,\x20%s,\x20%s',_0x33dc55,_0x73b2('0xa'));logger[_0x73b2('0xb')](_0x73b2('0xc'),_0x33dc55,_0x73b2('0xa'),JSON[_0x73b2('0xd')](_0xf0f0aa));if(_0xf0f0aa[_0x73b2('0xe')]){if(_0xf0f0aa[_0x73b2('0xe')][_0x73b2('0xf')]===0x1f4){logger[_0x73b2('0xe')](_0x73b2('0x10'),_0x33dc55,_0xf0f0aa[_0x73b2('0xe')]['message']);return _0x31c748(_0xf0f0aa['error'][_0x73b2('0x11')]);}logger['error'](_0x73b2('0x10'),_0x33dc55,_0xf0f0aa['error'][_0x73b2('0x11')]);return _0x3c4e6b(_0xf0f0aa[_0x73b2('0xe')][_0x73b2('0x11')]);}else{logger[_0x73b2('0x9')](_0x73b2('0x10'),_0x33dc55,_0x73b2('0xa'));_0x3c4e6b(_0xf0f0aa[_0x73b2('0x12')][_0x73b2('0x11')]);}})[_0x73b2('0x13')](function(_0x437f32){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x33dc55,_0x437f32);_0x31c748(_0x437f32);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 1a856f8..1af63e7 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 _0x2fae=['Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x500a2f,_0xa72b31){var _0x3791cf=function(_0x17f9ce){while(--_0x17f9ce){_0x500a2f['push'](_0x500a2f['shift']());}};_0x3791cf(++_0xa72b31);}(_0x2fae,0x177));var _0xe2fa=function(_0x5c9b42,_0x4fce1d){_0x5c9b42=_0x5c9b42-0x0;var _0x2b1cb0=_0x2fae[_0x5c9b42];return _0x2b1cb0;};'use strict';var multer=require(_0xe2fa('0x0'));var util=require(_0xe2fa('0x1'));var path=require(_0xe2fa('0x2'));var timeout=require(_0xe2fa('0x3'));var express=require(_0xe2fa('0x4'));var router=express[_0xe2fa('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe2fa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe2fa('0x7'));var controller=require(_0xe2fa('0x8'));router['get']('/',auth[_0xe2fa('0x9')](),controller[_0xe2fa('0xa')]);router[_0xe2fa('0xb')]('/describe',auth[_0xe2fa('0x9')](),controller['describe']);router[_0xe2fa('0xb')](_0xe2fa('0xc'),auth[_0xe2fa('0x9')](),controller[_0xe2fa('0xd')]);router[_0xe2fa('0xe')]('/',auth['isAuthenticated'](),controller[_0xe2fa('0xf')]);router['put']('/:id',auth[_0xe2fa('0x9')](),controller['update']);router[_0xe2fa('0x10')](_0xe2fa('0xc'),auth[_0xe2fa('0x9')](),controller[_0xe2fa('0x11')]);module[_0xe2fa('0x12')]=router; \ No newline at end of file +var _0x82d4=['exports','util','connect-timeout','../../components/auth/service','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','destroy'];(function(_0x4f9e37,_0x29555c){var _0x59b563=function(_0x1fc569){while(--_0x1fc569){_0x4f9e37['push'](_0x4f9e37['shift']());}};_0x59b563(++_0x29555c);}(_0x82d4,0x9d));var _0x482d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x82d4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x482d('0x0'));var path=require('path');var timeout=require(_0x482d('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x482d('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x482d('0x3'));router[_0x482d('0x4')]('/',auth[_0x482d('0x5')](),controller['index']);router[_0x482d('0x4')](_0x482d('0x6'),auth[_0x482d('0x5')](),controller[_0x482d('0x7')]);router[_0x482d('0x4')](_0x482d('0x8'),auth[_0x482d('0x5')](),controller[_0x482d('0x9')]);router[_0x482d('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x482d('0x8'),auth[_0x482d('0x5')](),controller['update']);router['delete'](_0x482d('0x8'),auth[_0x482d('0x5')](),controller[_0x482d('0xb')]);module[_0x482d('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 57408f5..52d4658 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 _0x5ecb=['text','name','getDataValue','onlineForm','setDataValue','TEXT','textarea','Leave\x20your\x20comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','stringify','input'];(function(_0x589084,_0x251871){var _0x47f29d=function(_0x54a8fa){while(--_0x54a8fa){_0x589084['push'](_0x589084['shift']());}};_0x47f29d(++_0x251871);}(_0x5ecb,0xb6));var _0xb5ec=function(_0x1034ca,_0x14ecd6){_0x1034ca=_0x1034ca-0x0;var _0x1a023a=_0x5ecb[_0x1034ca];return _0x1a023a;};'use strict';var Sequelize=require(_0xb5ec('0x0'));var rs=require(_0xb5ec('0x1'));module['exports']={'name':{'type':Sequelize[_0xb5ec('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xb5ec('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xb5ec('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xb5ec('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0xb5ec('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':_0xb5ec('0x4')},'customerAlias':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xb5ec('0x2')],'allowNull':![],'defaultValue':_0xb5ec('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb5ec('0x2')],'allowNull':![],'defaultValue':_0xb5ec('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb5ec('0x2')],'allowNull':![],'defaultValue':_0xb5ec('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb5ec('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb5ec('0x2')]},'animation':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xb5ec('0x9')]('rounded',_0xb5ec('0xa')),'defaultValue':_0xb5ec('0xb')},'header_online':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':_0xb5ec('0xc')},'offline_chat_button':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':_0xb5ec('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xb5ec('0xe')},'download_transcript':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb5ec('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':_0xb5ec('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xb5ec('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb5ec('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':_0xb5ec('0x12')},'noteTitle':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb5ec('0x13')},'closingMessage':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':_0xb5ec('0x14')},'closingMessageButton':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':_0xb5ec('0xd')},'skipMessageButton':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':_0xb5ec('0x15')},'conditionAgreement':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xb5ec('0x9')](_0xb5ec('0x16'),_0xb5ec('0x17')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xb5ec('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xb5ec('0x18')]({'items':[{'type':_0xb5ec('0x19'),'variable':null,'config':{'placeholder':'name','type':_0xb5ec('0x1a'),'required':!![]},'props':{'title':_0xb5ec('0x1b'),'helpText':''}},{'type':_0xb5ec('0x19'),'props':{'title':_0xb5ec('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xb5ec('0x3'),'type':_0xb5ec('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xb5ec('0x1c')]('onlineForm')?JSON['parse'](this[_0xb5ec('0x1c')](_0xb5ec('0x1d'))):{};},'set':function(_0x683b5e){return this[_0xb5ec('0x1e')](_0xb5ec('0x1d'),JSON[_0xb5ec('0x18')](_0x683b5e));}},'offlineForm':{'type':Sequelize[_0xb5ec('0x1f')],'defaultValue':function(){return JSON[_0xb5ec('0x18')]({'items':[{'type':_0xb5ec('0x19'),'props':{'title':_0xb5ec('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xb5ec('0x3'),'type':'email'},'variable':null},{'type':_0xb5ec('0x20'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0xb5ec('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xb5ec('0x1c')](_0xb5ec('0x22'))?JSON[_0xb5ec('0x23')](this[_0xb5ec('0x1c')]('offlineForm')):{};},'set':function(_0x1ce6ca){return this[_0xb5ec('0x1e')]('offlineForm',JSON[_0xb5ec('0x18')](_0x1ce6ca));}},'token':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':function(){return rs[_0xb5ec('0x24')]();}},'autoclose':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb5ec('0x2')]},'forwardOffline':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':_0xb5ec('0x25')},'waitingMessage':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':_0xb5ec('0x26')},'offlineMessageSubject':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':_0xb5ec('0x27')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb5ec('0x28')},'skipUnmanaged':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':_0xb5ec('0x15')},'sendUnmanaged':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':_0xb5ec('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb5ec('0x1f')]},'showAgentAvatar':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xb5ec('0x2')]},'notificationTemplate':{'type':Sequelize[_0xb5ec('0x1f')],'defaultValue':function(){return _0xb5ec('0x29');}},'notificationSound':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':_0xb5ec('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0xb5ec('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':_0xb5ec('0x2b')},'verticalAlignment':{'type':Sequelize[_0xb5ec('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':_0xb5ec('0x2c')},'defaultTitle':{'type':Sequelize[_0xb5ec('0x2')]},'customerAvatar':{'type':Sequelize[_0xb5ec('0x1f')]},'showCustomerAvatar':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb5ec('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xb5ec('0x2')],'allowNull':![],'defaultValue':_0xb5ec('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb5ec('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb5ec('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':_0xb5ec('0x2e')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb5ec('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb5ec('0x30'),'set':function(_0x1d4270){if(!_0x1d4270)this[_0xb5ec('0x1e')](_0xb5ec('0x31'),null);this[_0xb5ec('0x1e')](_0xb5ec('0x32'),_0x1d4270);}},'vidaooEscalation':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xb5ec('0x2')]},'vidaooTopic':{'type':Sequelize[_0xb5ec('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xb5ec('0x2')],'defaultValue':function(){return _0xb5ec('0x33');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xb5ec('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5cf1=['Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','star','thumb','stringify','name','text','parse','getDataValue','onlineForm','input','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','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','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','STRING','address','email','Agent','#011F6A','INTEGER','BOOLEAN','squared','rounded','We\x20are\x20here!','Chat','Send'];(function(_0x5997e1,_0x2af0be){var _0x857bb=function(_0x6842d5){while(--_0x6842d5){_0x5997e1['push'](_0x5997e1['shift']());}};_0x857bb(++_0x2af0be);}(_0x5cf1,0x1b5));var _0x15cf=function(_0x1f3890,_0x2f9aad){_0x1f3890=_0x1f3890-0x0;var _0x4af351=_0x5cf1[_0x1f3890];return _0x4af351;};'use strict';var Sequelize=require(_0x15cf('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x15cf('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x15cf('0x1')],'allowNull':![],'unique':_0x15cf('0x2')},'description':{'type':Sequelize[_0x15cf('0x1')]},'mapKey':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':_0x15cf('0x3')},'mapKeyOffline':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':_0x15cf('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':_0x15cf('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x15cf('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x15cf('0x1')],'allowNull':![],'defaultValue':_0x15cf('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x15cf('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x15cf('0x1')]},'animation':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0x15cf('0x8')),'defaultValue':_0x15cf('0x9')},'header_online':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':_0x15cf('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x15cf('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x15cf('0xc')},'header_offline':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':_0x15cf('0xd')},'download_transcript':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x15cf('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x15cf('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x15cf('0xf')]},'closingQuestion':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':_0x15cf('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':_0x15cf('0x11')},'noteTitle':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':_0x15cf('0x12')},'placeholderMessage':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':_0x15cf('0x13')},'closingMessageButton':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':_0x15cf('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x15cf('0x14'),_0x15cf('0x15')),'defaultValue':_0x15cf('0x14')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x15cf('0xf')],'defaultValue':function(){return JSON[_0x15cf('0x16')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x15cf('0x17'),'type':_0x15cf('0x18'),'required':!![]},'props':{'title':_0x15cf('0x17'),'helpText':''}},{'type':'input','props':{'title':_0x15cf('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x15cf('0x3'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x15cf('0x19')](this[_0x15cf('0x1a')](_0x15cf('0x1b'))):{};},'set':function(_0x3798ec){return this['setDataValue'](_0x15cf('0x1b'),JSON['stringify'](_0x3798ec));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x15cf('0x16')]({'items':[{'type':_0x15cf('0x1c'),'props':{'title':_0x15cf('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x15cf('0x3'),'type':'email'},'variable':null},{'type':_0x15cf('0x1d'),'config':{'placeholder':_0x15cf('0x1e')},'props':{'title':'Comments','helpText':_0x15cf('0x1f')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x15cf('0x20'))?JSON[_0x15cf('0x19')](this['getDataValue'](_0x15cf('0x20'))):{};},'set':function(_0x1ecc12){return this[_0x15cf('0x21')](_0x15cf('0x20'),JSON[_0x15cf('0x16')](_0x1ecc12));}},'token':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x15cf('0x1')]},'forwardOffline':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x15cf('0x1')]},'waitingTitle':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':_0x15cf('0x22')},'waitingMessage':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':_0x15cf('0x23')},'offlineMessageSubject':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':_0x15cf('0x24')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':_0x15cf('0x25')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x15cf('0x26')},'sendUnmanaged':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':_0x15cf('0xc')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x15cf('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x15cf('0x1')]},'notificationTemplate':{'type':Sequelize[_0x15cf('0xf')],'defaultValue':function(){return _0x15cf('0x27');}},'notificationSound':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':_0x15cf('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x15cf('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':_0x15cf('0x29')},'verticalAlignment':{'type':Sequelize[_0x15cf('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':_0x15cf('0x2a')},'defaultTitle':{'type':Sequelize[_0x15cf('0x1')]},'customerAvatar':{'type':Sequelize[_0x15cf('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x15cf('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x15cf('0x1')],'allowNull':![],'defaultValue':_0x15cf('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x15cf('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x15cf('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x15cf('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x15cf('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':![],'comment':_0x15cf('0x2d'),'set':function(_0x211e47){if(!_0x211e47)this[_0x15cf('0x21')](_0x15cf('0x2e'),null);this[_0x15cf('0x21')](_0x15cf('0x2f'),_0x211e47);}},'vidaooEscalation':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x15cf('0x1')]},'vidaooTopic':{'type':Sequelize[_0x15cf('0x1')],'allowNull':![],'defaultValue':_0x15cf('0x30')},'vidaooNote':{'type':Sequelize[_0x15cf('0x1')],'defaultValue':function(){return _0x15cf('0x31');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x15cf('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x15cf('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 66c76e6..89d0ca6 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 _0x5bcf=['connection','replace','render','alignment','color','textColor','color_button','addApplications','sequelize','getApplications','addProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','addAgents','userChatWebsite:save','removeAgents','isArray','emit','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatWebsite.socket','jayson/promise','http','client','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','count','includeAll','include','findAll','show','params','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','order','Disposition','rows','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','addAvatar','agentAvatar','file','customerAvatar','filename','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','root','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','ChatApplication','account','applications','Applications','orderBy','priority','asc','Contacts','contact','headers','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','browser','version','%s\x20%s','unknown','device','vendor','format','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','difference','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','authentication','auth','pass','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','email','Chat','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','User','fullname','internal','Tag','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','chatLicenseExceeded','some','remote','x-real-ip'];(function(_0x18141a,_0x388808){var _0x5129a5=function(_0x56ad98){while(--_0x56ad98){_0x18141a['push'](_0x18141a['shift']());}};_0x5129a5(++_0x388808);}(_0x5bcf,0x145));var _0xf5bc=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x5bcf[_0x469a3c];return _0x968f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf5bc('0x0'));var zipdir=require(_0xf5bc('0x1'));var jsonpatch=require(_0xf5bc('0x2'));var rp=require('request-promise');var moment=require(_0xf5bc('0x3'));var BPromise=require(_0xf5bc('0x4'));var Mustache=require(_0xf5bc('0x5'));var util=require(_0xf5bc('0x6'));var path=require(_0xf5bc('0x7'));var sox=require(_0xf5bc('0x8'));var csv=require('to-csv');var ejs=require(_0xf5bc('0x9'));var fs=require('fs');var fs_extra=require(_0xf5bc('0xa'));var _=require('lodash');var squel=require(_0xf5bc('0xb'));var crypto=require(_0xf5bc('0xc'));var jsforce=require(_0xf5bc('0xd'));var deskjs=require(_0xf5bc('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf5bc('0xf'));var Papa=require(_0xf5bc('0x10'));var Redis=require(_0xf5bc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf5bc('0x12'));var as=require(_0xf5bc('0x13'));var hardwareService=require(_0xf5bc('0x14'));var logger=require('../../config/logger')(_0xf5bc('0x15'));var utils=require(_0xf5bc('0x16'));var config=require(_0xf5bc('0x17'));var licenseUtil=require(_0xf5bc('0x18'));var db=require('../../mysqldb')['db'];config[_0xf5bc('0x19')]=_[_0xf5bc('0x1a')](config[_0xf5bc('0x19')],{'host':_0xf5bc('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf5bc('0x1c'))['register'](socket);var jayson=require(_0xf5bc('0x1d'));var client=jayson['client'][_0xf5bc('0x1e')]({'port':0x232c});var client9002=jayson[_0xf5bc('0x1f')][_0xf5bc('0x1e')]({'port':0x232a});var client9003=jayson['client'][_0xf5bc('0x1e')]({'port':0x232b});var client9001=jayson[_0xf5bc('0x1f')][_0xf5bc('0x1e')]({'port':0x2329});function respondWithRpcPromise(_0x3c9939,_0x2496c1,_0xd1daca,_0x567746){return new BPromise(function(_0x59a576,_0x4fa27a){var _0x54146a=_0x567746||client;return _0x54146a['request'](_0x3c9939,_0xd1daca)[_0xf5bc('0x20')](function(_0x422069){logger[_0xf5bc('0x21')]('ChatWebsite,\x20%s,\x20%s',_0x2496c1,_0xf5bc('0x22'));logger[_0xf5bc('0x23')](_0xf5bc('0x24'),_0x2496c1,_0xf5bc('0x22'),JSON[_0xf5bc('0x25')](_0x422069));if(_0x422069['error']){if(_0x422069[_0xf5bc('0x26')][_0xf5bc('0x27')]===0x1f4){logger[_0xf5bc('0x26')](_0xf5bc('0x28'),_0x2496c1,_0x422069['error'][_0xf5bc('0x29')]);return _0x4fa27a(_0x422069[_0xf5bc('0x26')]['message']);}logger[_0xf5bc('0x26')](_0xf5bc('0x28'),_0x2496c1,_0x422069['error']['message']);return _0x59a576(_0x422069[_0xf5bc('0x26')][_0xf5bc('0x29')]);}else{logger[_0xf5bc('0x21')](_0xf5bc('0x28'),_0x2496c1,_0xf5bc('0x22'));_0x59a576(_0x422069[_0xf5bc('0x2a')][_0xf5bc('0x29')]);}})[_0xf5bc('0x2b')](function(_0x3e4552){logger[_0xf5bc('0x26')](_0xf5bc('0x28'),_0x2496c1,_0x3e4552);_0x4fa27a(_0x3e4552);});});}function respondWithStatusCode(_0x5a2103,_0x22f129){_0x22f129=_0x22f129||0xcc;return function(_0x53d1f9){if(_0x53d1f9){return _0x5a2103[_0xf5bc('0x2c')](_0x22f129);}return _0x5a2103['status'](_0x22f129)[_0xf5bc('0x2d')]();};}function respondWithResult(_0x22c3a9,_0x340086){_0x340086=_0x340086||0xc8;return function(_0xd0ccc6){if(_0xd0ccc6){return _0x22c3a9[_0xf5bc('0x2e')](_0x340086)[_0xf5bc('0x2f')](_0xd0ccc6);}};}function respondWithFilteredResult(_0x54f736,_0x184848){return function(_0x57d893){if(_0x57d893){var _0x58c8b1=typeof _0x184848[_0xf5bc('0x30')]===_0xf5bc('0x31')&&typeof _0x184848[_0xf5bc('0x32')]===_0xf5bc('0x31');var _0x27db71=_0x57d893['count'];var _0x16bf2b=_0x58c8b1?0x0:_0x184848[_0xf5bc('0x30')];var _0x369feb=_0x58c8b1?_0x57d893['count']:_0x184848['offset']+_0x184848['limit'];var _0x520d70;if(_0x369feb>=_0x27db71){_0x369feb=_0x27db71;_0x520d70=0xc8;}else{_0x520d70=0xce;}_0x54f736['status'](_0x520d70);return _0x54f736['set'](_0xf5bc('0x33'),_0x16bf2b+'-'+_0x369feb+'/'+_0x27db71)['json'](_0x57d893);}return null;};}function patchUpdates(_0x13381a){return function(_0x58be13){try{jsonpatch[_0xf5bc('0x34')](_0x58be13,_0x13381a,!![]);}catch(_0x2bf66a){return BPromise[_0xf5bc('0x35')](_0x2bf66a);}return _0x58be13[_0xf5bc('0x36')]();};}function saveUpdates(_0x47086f,_0x2d50d4){return function(_0x2e8279){if(_0x2e8279){return _0x2e8279[_0xf5bc('0x37')](_0x47086f)['then'](function(_0x3bd339){return _0x3bd339;});}return null;};}function removeEntity(_0x10ab48,_0x3f9fa8){return function(_0x6f3b6a){if(_0x6f3b6a){return _0x6f3b6a[_0xf5bc('0x38')]()[_0xf5bc('0x20')](function(){var _0xe4d4b9=_0x6f3b6a[_0xf5bc('0x39')]({'plain':!![]});var _0x46428a=_0xf5bc('0x3a');return db[_0xf5bc('0x3b')][_0xf5bc('0x38')]({'where':{'type':_0x46428a,'resourceId':_0xe4d4b9['id']}})[_0xf5bc('0x20')](function(){return _0x6f3b6a;});})[_0xf5bc('0x20')](function(){_0x10ab48[_0xf5bc('0x2e')](0xcc)[_0xf5bc('0x2d')]();});}};}function handleEntityNotFound(_0x38597d,_0xdabb6d){return function(_0x4ee916){if(!_0x4ee916){_0x38597d[_0xf5bc('0x2c')](0x194);}return _0x4ee916;};}function handleError(_0x394027,_0x13e26c){_0x13e26c=_0x13e26c||0x1f4;return function(_0x14a793){logger[_0xf5bc('0x26')](_0x14a793[_0xf5bc('0x3c')]);if(_0x14a793[_0xf5bc('0x3d')]){delete _0x14a793[_0xf5bc('0x3d')];}_0x394027[_0xf5bc('0x2e')](_0x13e26c)[_0xf5bc('0x3e')](_0x14a793);};}exports[_0xf5bc('0x3f')]=function(_0x3918e8,_0x4634d3){var _0x20c38d={'include':[{'model':db[_0xf5bc('0x40')],'as':_0xf5bc('0x41')}]},_0x9cd63c={},_0x944e1c={'count':0x0,'rows':[]};var _0x4d9902=_[_0xf5bc('0x42')](db[_0xf5bc('0x43')][_0xf5bc('0x44')],function(_0x6c7b11){return{'name':_0x6c7b11[_0xf5bc('0x45')],'type':_0x6c7b11[_0xf5bc('0x46')][_0xf5bc('0x47')]};});_0x9cd63c[_0xf5bc('0x48')]=_[_0xf5bc('0x42')](_0x4d9902,_0xf5bc('0x3d'));_0x9cd63c[_0xf5bc('0x49')]=_[_0xf5bc('0x4a')](_0x3918e8[_0xf5bc('0x49')]);_0x9cd63c[_0xf5bc('0x4b')]=_[_0xf5bc('0x4c')](_0x9cd63c['model'],_0x9cd63c[_0xf5bc('0x49')]);_0x20c38d['attributes']=_[_0xf5bc('0x4c')](_0x9cd63c[_0xf5bc('0x48')],qs[_0xf5bc('0x4d')](_0x3918e8['query'][_0xf5bc('0x4d')]));_0x20c38d[_0xf5bc('0x4e')]=_0x20c38d[_0xf5bc('0x4e')][_0xf5bc('0x4f')]?_0x20c38d[_0xf5bc('0x4e')]:_0x9cd63c['model'];if(!_0x3918e8[_0xf5bc('0x49')][_0xf5bc('0x50')](_0xf5bc('0x51'))){_0x20c38d[_0xf5bc('0x32')]=qs[_0xf5bc('0x32')](_0x3918e8[_0xf5bc('0x49')][_0xf5bc('0x32')]);_0x20c38d['offset']=qs[_0xf5bc('0x30')](_0x3918e8[_0xf5bc('0x49')][_0xf5bc('0x30')]);}_0x20c38d['order']=qs[_0xf5bc('0x52')](_0x3918e8['query']['sort']);_0x20c38d[_0xf5bc('0x53')]=qs[_0xf5bc('0x4b')](_[_0xf5bc('0x54')](_0x3918e8['query'],_0x9cd63c[_0xf5bc('0x4b')]),_0x4d9902);if(_0x3918e8[_0xf5bc('0x49')][_0xf5bc('0x55')]){_0x20c38d[_0xf5bc('0x53')]=_[_0xf5bc('0x56')](_0x20c38d[_0xf5bc('0x53')],{'$or':_[_0xf5bc('0x42')](_0x4d9902,function(_0x4a8796){if(_0x4a8796[_0xf5bc('0x46')]!=='VIRTUAL'){var _0x492ceb={};_0x492ceb[_0x4a8796[_0xf5bc('0x3d')]]={'$like':'%'+_0x3918e8[_0xf5bc('0x49')][_0xf5bc('0x55')]+'%'};return _0x492ceb;}})});}_0x20c38d=_['merge']({},_0x20c38d,_0x3918e8['options']);var _0x3c6911={'where':_0x20c38d[_0xf5bc('0x53')]};return db[_0xf5bc('0x43')][_0xf5bc('0x57')](_0x3c6911)[_0xf5bc('0x20')](function(_0x287542){_0x944e1c[_0xf5bc('0x57')]=_0x287542;if(_0x3918e8[_0xf5bc('0x49')][_0xf5bc('0x58')]){_0x20c38d[_0xf5bc('0x59')]=[{'all':!![]}];}return db[_0xf5bc('0x43')][_0xf5bc('0x5a')](_0x20c38d);})[_0xf5bc('0x20')](function(_0x38315c){_0x944e1c['rows']=_0x38315c;return _0x944e1c;})['then'](respondWithFilteredResult(_0x4634d3,_0x20c38d))[_0xf5bc('0x2b')](handleError(_0x4634d3,null));};exports[_0xf5bc('0x5b')]=function(_0x3d8852,_0x416f1b){var _0x3686e7={'raw':![],'where':{'id':_0x3d8852[_0xf5bc('0x5c')]['id']},'include':[{'model':db[_0xf5bc('0x40')],'as':'mandatoryDispositionPause'}]},_0x541566={};_0x541566[_0xf5bc('0x48')]=_[_0xf5bc('0x4a')](db[_0xf5bc('0x43')][_0xf5bc('0x44')]);_0x541566[_0xf5bc('0x49')]=_['keys'](_0x3d8852['query']);_0x541566['filters']=_['intersection'](_0x541566[_0xf5bc('0x48')],_0x541566[_0xf5bc('0x49')]);_0x3686e7[_0xf5bc('0x4e')]=_[_0xf5bc('0x4c')](_0x541566[_0xf5bc('0x48')],qs[_0xf5bc('0x4d')](_0x3d8852[_0xf5bc('0x49')][_0xf5bc('0x4d')]));_0x3686e7[_0xf5bc('0x4e')]=_0x3686e7[_0xf5bc('0x4e')][_0xf5bc('0x4f')]?_0x3686e7['attributes']:_0x541566[_0xf5bc('0x48')];if(_0x3d8852[_0xf5bc('0x49')][_0xf5bc('0x58')]){_0x3686e7[_0xf5bc('0x59')]=[{'all':!![]}];}_0x3686e7=_[_0xf5bc('0x56')]({},_0x3686e7,_0x3d8852[_0xf5bc('0x5d')]);return db[_0xf5bc('0x43')][_0xf5bc('0x5e')](_0x3686e7)[_0xf5bc('0x20')](handleEntityNotFound(_0x416f1b,null))['then'](respondWithResult(_0x416f1b,null))[_0xf5bc('0x2b')](handleError(_0x416f1b,null));};exports[_0xf5bc('0x5f')]=function(_0x28c42c,_0x1a75a8){return db[_0xf5bc('0x43')][_0xf5bc('0x5f')](_0x28c42c[_0xf5bc('0x60')],{})[_0xf5bc('0x20')](function(_0x2e7b9c){var _0x733b59=_0x28c42c[_0xf5bc('0x61')][_0xf5bc('0x39')]({'plain':!![]});if(!_0x733b59)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x733b59[_0xf5bc('0x62')]===_0xf5bc('0x61')){var _0x3ecbe5=_0x2e7b9c[_0xf5bc('0x39')]({'plain':!![]});var _0x1182d5=_0xf5bc('0x3a');return db[_0xf5bc('0x63')][_0xf5bc('0x5e')]({'where':{'name':_0x1182d5,'userProfileId':_0x733b59[_0xf5bc('0x64')]},'raw':!![]})[_0xf5bc('0x20')](function(_0x5e7225){if(_0x5e7225&&_0x5e7225[_0xf5bc('0x65')]===0x0){return db[_0xf5bc('0x3b')][_0xf5bc('0x5f')]({'name':_0x3ecbe5[_0xf5bc('0x3d')],'resourceId':_0x3ecbe5['id'],'type':_0x5e7225[_0xf5bc('0x3d')],'sectionId':_0x5e7225['id']},{})[_0xf5bc('0x20')](function(){return _0x2e7b9c;});}else{return _0x2e7b9c;}})['catch'](function(_0x153262){logger[_0xf5bc('0x26')](_0xf5bc('0x66'),_0x153262);throw _0x153262;});}return _0x2e7b9c;})['then'](respondWithResult(_0x1a75a8,0xc9))[_0xf5bc('0x2b')](handleError(_0x1a75a8,null));};exports[_0xf5bc('0x37')]=function(_0x3eae74,_0x2bd4a7){if(_0x3eae74[_0xf5bc('0x60')]['id']){delete _0x3eae74[_0xf5bc('0x60')]['id'];}return db[_0xf5bc('0x43')][_0xf5bc('0x5e')]({'where':{'id':_0x3eae74[_0xf5bc('0x5c')]['id']},'include':[{'model':db[_0xf5bc('0x40')],'as':_0xf5bc('0x41')}]})[_0xf5bc('0x20')](handleEntityNotFound(_0x2bd4a7,null))[_0xf5bc('0x20')](saveUpdates(_0x3eae74[_0xf5bc('0x60')],null))[_0xf5bc('0x20')](respondWithResult(_0x2bd4a7,null))[_0xf5bc('0x2b')](handleError(_0x2bd4a7,null));};exports[_0xf5bc('0x38')]=function(_0x58dde7,_0x74bc63){return db[_0xf5bc('0x43')][_0xf5bc('0x5e')]({'where':{'id':_0x58dde7[_0xf5bc('0x5c')]['id']}})[_0xf5bc('0x20')](handleEntityNotFound(_0x74bc63,null))[_0xf5bc('0x20')](removeEntity(_0x74bc63,null))[_0xf5bc('0x2b')](handleError(_0x74bc63,null));};exports[_0xf5bc('0x67')]=function(_0xd5cfd3,_0x3fcaee){return db[_0xf5bc('0x43')][_0xf5bc('0x67')]()['then'](respondWithResult(_0x3fcaee,null))[_0xf5bc('0x2b')](handleError(_0x3fcaee,null));};exports[_0xf5bc('0x68')]=function(_0x5ed160,_0x532deb,_0x381e64){if(_0x5ed160[_0xf5bc('0x60')]['id']){delete _0x5ed160['body']['id'];}return db[_0xf5bc('0x43')][_0xf5bc('0x5e')]({'where':{'id':_0x5ed160[_0xf5bc('0x5c')]['id']}})[_0xf5bc('0x20')](handleEntityNotFound(_0x532deb,null))[_0xf5bc('0x20')](function(_0x11a1b1){if(_0x11a1b1){_0x5ed160[_0xf5bc('0x60')][_0xf5bc('0x69')]=_0x11a1b1['id'];return db['Disposition'][_0xf5bc('0x5f')](_0x5ed160[_0xf5bc('0x60')]);}})[_0xf5bc('0x20')](respondWithResult(_0x532deb,null))[_0xf5bc('0x2b')](handleError(_0x532deb,null));};exports[_0xf5bc('0x6a')]=function(_0x5c2238,_0x12bb06,_0x1fe021){var _0x4b7a30={'raw':![],'where':{}};var _0x22db5a={};var _0x4ce199={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xf5bc('0x6b')]({'where':{'id':_0x5c2238[_0xf5bc('0x5c')]['id']}})[_0xf5bc('0x20')](handleEntityNotFound(_0x12bb06,null))[_0xf5bc('0x20')](function(_0x5833a7){if(_0x5833a7){_0x22db5a[_0xf5bc('0x48')]=_['keys'](db['Disposition'][_0xf5bc('0x44')]);_0x22db5a[_0xf5bc('0x49')]=_[_0xf5bc('0x4a')](_0x5c2238[_0xf5bc('0x49')]);_0x22db5a[_0xf5bc('0x4b')]=_[_0xf5bc('0x4c')](_0x22db5a[_0xf5bc('0x48')],_0x22db5a[_0xf5bc('0x49')]);_0x4b7a30[_0xf5bc('0x4e')]=_['intersection'](_0x22db5a['model'],qs[_0xf5bc('0x4d')](_0x5c2238[_0xf5bc('0x49')][_0xf5bc('0x4d')]));_0x4b7a30[_0xf5bc('0x4e')]=_0x4b7a30[_0xf5bc('0x4e')][_0xf5bc('0x4f')]?_0x4b7a30[_0xf5bc('0x4e')]:_0x22db5a['model'];if(!_0x5c2238[_0xf5bc('0x49')][_0xf5bc('0x50')](_0xf5bc('0x51'))){_0x4b7a30[_0xf5bc('0x32')]=qs['limit'](_0x5c2238[_0xf5bc('0x49')][_0xf5bc('0x32')]);_0x4b7a30[_0xf5bc('0x30')]=qs[_0xf5bc('0x30')](_0x5c2238['query']['offset']);}_0x4b7a30[_0xf5bc('0x6c')]=qs[_0xf5bc('0x52')](_0x5c2238[_0xf5bc('0x49')]['sort']);_0x4b7a30['where']=qs[_0xf5bc('0x4b')](_[_0xf5bc('0x54')](_0x5c2238['query'],_0x22db5a[_0xf5bc('0x4b')]));_0x4b7a30['where'][_0xf5bc('0x69')]=_0x5833a7['id'];if(_0x5c2238[_0xf5bc('0x49')]['filter']){_0x4b7a30[_0xf5bc('0x53')]=_[_0xf5bc('0x56')](_0x4b7a30['where'],{'$or':_[_0xf5bc('0x42')](_0x4b7a30['attributes'],function(_0x308759){var _0x1a1055={};_0x1a1055[_0x308759]={'$like':'%'+_0x5c2238[_0xf5bc('0x49')][_0xf5bc('0x55')]+'%'};return _0x1a1055;})});}_0x4b7a30=_[_0xf5bc('0x56')]({},_0x4b7a30,_0x5c2238['options']);return db['Disposition']['count']({'where':_0x4b7a30[_0xf5bc('0x53')]})['then'](function(_0x194b40){_0x4ce199[_0xf5bc('0x57')]=_0x194b40;if(_0x5c2238['query'][_0xf5bc('0x58')]){_0x4b7a30['include']=[{'all':!![]}];}return db[_0xf5bc('0x6d')][_0xf5bc('0x5a')](_0x4b7a30);})['then'](function(_0x3dfebb){_0x4ce199[_0xf5bc('0x6e')]=_0x3dfebb;return _0x4ce199;});}})[_0xf5bc('0x20')](respondWithFilteredResult(_0x12bb06,_0x4b7a30))[_0xf5bc('0x2b')](handleError(_0x12bb06,null));};exports[_0xf5bc('0x6f')]=function(_0xd0ecb8,_0x228447,_0x44dd81){return db[_0xf5bc('0x43')][_0xf5bc('0x5e')]({'where':{'id':_0xd0ecb8['params']['id']}})[_0xf5bc('0x20')](handleEntityNotFound(_0x228447,null))[_0xf5bc('0x20')](function(_0x9a882f){if(_0x9a882f){return _0x9a882f[_0xf5bc('0x6f')](_0xd0ecb8[_0xf5bc('0x49')][_0xf5bc('0x70')]);}})['then'](respondWithStatusCode(_0x228447,null))[_0xf5bc('0x2b')](handleError(_0x228447,null));};exports['addAnswer']=function(_0x3658d9,_0x22563c,_0x3699b8){if(_0x3658d9['body']['id']){delete _0x3658d9[_0xf5bc('0x60')]['id'];}return db[_0xf5bc('0x43')][_0xf5bc('0x5e')]({'where':{'id':_0x3658d9[_0xf5bc('0x5c')]['id']}})[_0xf5bc('0x20')](handleEntityNotFound(_0x22563c,null))[_0xf5bc('0x20')](function(_0x4863a7){if(_0x4863a7){_0x3658d9[_0xf5bc('0x60')]['ChatWebsiteId']=_0x4863a7['id'];return db['CannedAnswer']['create'](_0x3658d9[_0xf5bc('0x60')]);}})[_0xf5bc('0x20')](respondWithResult(_0x22563c,null))[_0xf5bc('0x2b')](handleError(_0x22563c,null));};exports[_0xf5bc('0x71')]=function(_0xb083a3,_0x2d5a1a,_0x56e9d2){var _0x418e3d={'raw':![],'where':{}};var _0x4ad841={};var _0x519332={'count':0x0,'rows':[]};return db[_0xf5bc('0x43')]['findOne']({'where':{'id':_0xb083a3[_0xf5bc('0x5c')]['id']}})[_0xf5bc('0x20')](handleEntityNotFound(_0x2d5a1a,null))[_0xf5bc('0x20')](function(_0x4e7c43){if(_0x4e7c43){_0x4ad841[_0xf5bc('0x48')]=_[_0xf5bc('0x4a')](db[_0xf5bc('0x72')][_0xf5bc('0x44')]);_0x4ad841[_0xf5bc('0x49')]=_[_0xf5bc('0x4a')](_0xb083a3[_0xf5bc('0x49')]);_0x4ad841['filters']=_['intersection'](_0x4ad841[_0xf5bc('0x48')],_0x4ad841[_0xf5bc('0x49')]);_0x418e3d['attributes']=_['intersection'](_0x4ad841[_0xf5bc('0x48')],qs[_0xf5bc('0x4d')](_0xb083a3[_0xf5bc('0x49')][_0xf5bc('0x4d')]));_0x418e3d['attributes']=_0x418e3d[_0xf5bc('0x4e')]['length']?_0x418e3d[_0xf5bc('0x4e')]:_0x4ad841[_0xf5bc('0x48')];if(!_0xb083a3[_0xf5bc('0x49')][_0xf5bc('0x50')]('nolimit')){_0x418e3d[_0xf5bc('0x32')]=qs['limit'](_0xb083a3[_0xf5bc('0x49')][_0xf5bc('0x32')]);_0x418e3d[_0xf5bc('0x30')]=qs[_0xf5bc('0x30')](_0xb083a3[_0xf5bc('0x49')][_0xf5bc('0x30')]);}_0x418e3d[_0xf5bc('0x6c')]=qs[_0xf5bc('0x52')](_0xb083a3[_0xf5bc('0x49')][_0xf5bc('0x52')]);_0x418e3d[_0xf5bc('0x53')]=qs[_0xf5bc('0x4b')](_[_0xf5bc('0x54')](_0xb083a3[_0xf5bc('0x49')],_0x4ad841[_0xf5bc('0x4b')]));_0x418e3d['where'][_0xf5bc('0x69')]=_0x4e7c43['id'];if(_0xb083a3[_0xf5bc('0x49')]['filter']){_0x418e3d['where']=_[_0xf5bc('0x56')](_0x418e3d[_0xf5bc('0x53')],{'$or':_[_0xf5bc('0x42')](_0x418e3d[_0xf5bc('0x4e')],function(_0x5e9480){var _0x396ffe={};_0x396ffe[_0x5e9480]={'$like':'%'+_0xb083a3[_0xf5bc('0x49')]['filter']+'%'};return _0x396ffe;})});}_0x418e3d=_[_0xf5bc('0x56')]({},_0x418e3d,_0xb083a3[_0xf5bc('0x5d')]);return db['CannedAnswer'][_0xf5bc('0x57')]({'where':_0x418e3d[_0xf5bc('0x53')]})['then'](function(_0x14d98b){_0x519332[_0xf5bc('0x57')]=_0x14d98b;if(_0xb083a3[_0xf5bc('0x49')][_0xf5bc('0x58')]){_0x418e3d[_0xf5bc('0x59')]=[{'all':!![]}];}return db[_0xf5bc('0x72')][_0xf5bc('0x5a')](_0x418e3d);})[_0xf5bc('0x20')](function(_0x604bf7){_0x519332[_0xf5bc('0x6e')]=_0x604bf7;return _0x519332;});}})[_0xf5bc('0x20')](respondWithFilteredResult(_0x2d5a1a,_0x418e3d))['catch'](handleError(_0x2d5a1a,null));};exports[_0xf5bc('0x73')]=function(_0x470610,_0x171de8,_0x2cdd33){return db[_0xf5bc('0x43')][_0xf5bc('0x5e')]({'where':{'id':_0x470610[_0xf5bc('0x5c')]['id']}})[_0xf5bc('0x20')](handleEntityNotFound(_0x171de8,null))[_0xf5bc('0x20')](function(_0x5cb693){if(_0x5cb693){return _0x5cb693[_0xf5bc('0x73')](_0x470610[_0xf5bc('0x49')]['ids']);}})[_0xf5bc('0x20')](respondWithStatusCode(_0x171de8,null))[_0xf5bc('0x2b')](handleError(_0x171de8,null));};exports[_0xf5bc('0x74')]=function(_0x402dd4,_0x234fe0,_0x23863e){_0x402dd4[_0xf5bc('0x60')][_0xf5bc('0x75')]=_0x402dd4['file']['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x402dd4[_0xf5bc('0x5c')]['id']}})[_0xf5bc('0x20')](handleEntityNotFound(_0x234fe0,null))['then'](saveUpdates(_0x402dd4[_0xf5bc('0x60')],null))['then'](respondWithResult(_0x234fe0,null))[_0xf5bc('0x2b')](handleError(_0x234fe0,null));};exports[_0xf5bc('0x76')]=function(_0x399323,_0x55fa45,_0x5e4c60){_0x399323[_0xf5bc('0x60')][_0xf5bc('0x77')]=_0x399323[_0xf5bc('0x78')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x399323[_0xf5bc('0x5c')]['id']}})['then'](handleEntityNotFound(_0x55fa45,null))[_0xf5bc('0x20')](saveUpdates(_0x399323[_0xf5bc('0x60')],null))[_0xf5bc('0x20')](respondWithResult(_0x55fa45,null))[_0xf5bc('0x2b')](handleError(_0x55fa45,null));};exports['addCustomerAvatar']=function(_0x4192cf,_0x5279cb,_0x1dd362){_0x4192cf[_0xf5bc('0x60')][_0xf5bc('0x79')]=_0x4192cf[_0xf5bc('0x78')][_0xf5bc('0x7a')];return db[_0xf5bc('0x43')]['find']({'where':{'id':_0x4192cf['params']['id']}})['then'](handleEntityNotFound(_0x5279cb,null))[_0xf5bc('0x20')](saveUpdates(_0x4192cf[_0xf5bc('0x60')],null))['then'](respondWithResult(_0x5279cb,null))[_0xf5bc('0x2b')](handleError(_0x5279cb,null));};exports[_0xf5bc('0x7b')]=function(_0x2a7609,_0x4605bd,_0x41d1af){_0x2a7609[_0xf5bc('0x60')][_0xf5bc('0x7c')]=_0x2a7609[_0xf5bc('0x78')][_0xf5bc('0x7a')];return db[_0xf5bc('0x43')][_0xf5bc('0x5e')]({'where':{'id':_0x2a7609[_0xf5bc('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4605bd,null))[_0xf5bc('0x20')](saveUpdates(_0x2a7609['body'],null))[_0xf5bc('0x20')](respondWithResult(_0x4605bd,null))[_0xf5bc('0x2b')](handleError(_0x4605bd,null));};exports[_0xf5bc('0x7d')]=function(_0x58ffbf,_0x537d8f,_0x9f11b2){var _0x41f9fa=path[_0xf5bc('0x7e')](config['root'],_0xf5bc('0x7f'));var _0x1917aa={'where':{'id':_0x58ffbf[_0xf5bc('0x5c')]['id']},'attributes':['id',_0xf5bc('0x75')],'raw':!![]};var _0x2b264b=![];return require(_0xf5bc('0x18'))[_0xf5bc('0x80')]()[_0xf5bc('0x20')](function(_0x3b53a3){if(_0x3b53a3){_0x2b264b=_0x3b53a3[_0xf5bc('0x81')];}})[_0xf5bc('0x20')](function(){return db['ChatWebsite'][_0xf5bc('0x5e')](_0x1917aa);})['then'](handleEntityNotFound(_0x537d8f,null))[_0xf5bc('0x20')](function(_0x46a45f){if(_0x46a45f){if(!_[_0xf5bc('0x82')](_0x46a45f[_0xf5bc('0x75')])){if(fs[_0xf5bc('0x83')](path[_0xf5bc('0x7e')](config[_0xf5bc('0x84')],_0xf5bc('0x85'),_0x46a45f[_0xf5bc('0x75')]))&&_0x2b264b){_0x41f9fa=path['join'](config[_0xf5bc('0x84')],'server/files/images/logos/',_0x46a45f[_0xf5bc('0x75')]);}}return _0x537d8f['download'](_0x41f9fa);}})[_0xf5bc('0x2b')](handleError(_0x537d8f,null));};exports[_0xf5bc('0x86')]=function(_0x3ded6f,_0x1fd1da,_0x16cfa2){var _0x428754=path[_0xf5bc('0x7e')](config['root'],_0xf5bc('0x87'));var _0xa82667={'where':{'id':_0x3ded6f[_0xf5bc('0x5c')]['id']},'attributes':['id',_0xf5bc('0x77')],'raw':!![]};return db[_0xf5bc('0x43')]['find'](_0xa82667)[_0xf5bc('0x20')](handleEntityNotFound(_0x1fd1da,null))['then'](function(_0x516a46){if(_0x516a46){if(!_[_0xf5bc('0x82')](_0x516a46[_0xf5bc('0x77')])){if(fs[_0xf5bc('0x83')](path[_0xf5bc('0x7e')](config['root'],'server/files/images/avatars/',_0x516a46[_0xf5bc('0x77')]))){_0x428754=path[_0xf5bc('0x7e')](config[_0xf5bc('0x84')],_0xf5bc('0x88'),_0x516a46[_0xf5bc('0x77')]);}}return _0x1fd1da[_0xf5bc('0x89')](_0x428754);}})['catch'](handleError(_0x1fd1da,null));};exports[_0xf5bc('0x8a')]=function(_0x29dc9e,_0x1dfad2,_0x19117b){var _0x43734a=path[_0xf5bc('0x7e')](config[_0xf5bc('0x84')],_0xf5bc('0x8b'));var _0x29dad6={'where':{'id':_0x29dc9e[_0xf5bc('0x5c')]['id']},'attributes':['id',_0xf5bc('0x79'),_0xf5bc('0x8c')],'raw':!![]};return db[_0xf5bc('0x43')][_0xf5bc('0x5e')](_0x29dad6)[_0xf5bc('0x20')](handleEntityNotFound(_0x1dfad2,null))[_0xf5bc('0x20')](function(_0x197d2d){if(_0x197d2d){if(!_[_0xf5bc('0x82')](_0x197d2d[_0xf5bc('0x79')])){if(fs[_0xf5bc('0x83')](path[_0xf5bc('0x7e')](config[_0xf5bc('0x84')],'server/files/images/avatars/',_0x197d2d[_0xf5bc('0x79')]))&&_0x197d2d[_0xf5bc('0x8c')]){_0x43734a=path['join'](config[_0xf5bc('0x84')],_0xf5bc('0x88'),_0x197d2d[_0xf5bc('0x79')]);}}return _0x1dfad2[_0xf5bc('0x89')](_0x43734a);}})[_0xf5bc('0x2b')](handleError(_0x1dfad2,null));};exports[_0xf5bc('0x8d')]=function(_0x26de6b,_0x298bf7,_0x415079){var _0x2dad37=path[_0xf5bc('0x7e')](config[_0xf5bc('0x84')],_0xf5bc('0x8e'));var _0x17a84d={'where':{'id':_0x26de6b[_0xf5bc('0x5c')]['id']},'attributes':['id',_0xf5bc('0x7c')],'raw':!![]};return db['ChatWebsite']['find'](_0x17a84d)[_0xf5bc('0x20')](handleEntityNotFound(_0x298bf7,null))[_0xf5bc('0x20')](function(_0x3059e5){if(_0x3059e5){if(!_['isNil'](_0x3059e5[_0xf5bc('0x7c')])){if(fs[_0xf5bc('0x83')](path[_0xf5bc('0x7e')](config[_0xf5bc('0x84')],_0xf5bc('0x88'),_0x3059e5[_0xf5bc('0x7c')]))){_0x2dad37=path['join'](config['root'],_0xf5bc('0x88'),_0x3059e5[_0xf5bc('0x7c')]);}}return _0x298bf7[_0xf5bc('0x89')](_0x2dad37);}})[_0xf5bc('0x2b')](handleError(_0x298bf7,null));};exports[_0xf5bc('0x8f')]=function(_0x42648e,_0x3cbd3d,_0x4e83ab){var _0x344528=require('user-agent-parser');var _0x2a757f=new _0x344528();var _0x50a6ad=_0x2a757f['setUA'](_0x42648e['headers']['user-agent'])[_0xf5bc('0x90')]();var _0x1d76cd={'body':_0x42648e[_0xf5bc('0x60')],'channel':_0xf5bc('0x91')};var _0x278093=[];var _0x3081f0=[];var _0x5649c0={};var _0x1d08a8=![];return db[_0xf5bc('0x92')][_0xf5bc('0x67')]()[_0xf5bc('0x20')](function(_0x33c634){if(!_0x33c634){throw new db[(_0xf5bc('0x93'))][(_0xf5bc('0x94'))](_0xf5bc('0x95'));}_0x278093=_['difference'](_[_0xf5bc('0x4a')](_0x33c634),[_0xf5bc('0x96'),_0xf5bc('0x97')]);_0x3081f0=_['difference'](_[_0xf5bc('0x4a')](_0x33c634),[_0xf5bc('0x96'),'updatedAt',_0xf5bc('0x98'),_0xf5bc('0x99')]);if(_0x42648e[_0xf5bc('0x60')]['id']){delete _0x42648e[_0xf5bc('0x60')]['id'];}if(_[_0xf5bc('0x82')](_0x42648e['body'][_0xf5bc('0x9a')])){throw new db['Sequelize']['ValidationError'](_0xf5bc('0x9b'));}if(_[_0xf5bc('0x82')](_0x42648e[_0xf5bc('0x60')][_0xf5bc('0x60')])||_0x42648e[_0xf5bc('0x60')][_0xf5bc('0x60')]===''){throw new db[(_0xf5bc('0x93'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf5bc('0x82')](_0x42648e[_0xf5bc('0x60')][_0xf5bc('0x9c')])){throw new db[(_0xf5bc('0x93'))][(_0xf5bc('0x94'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3081f0);}if(!_[_0xf5bc('0x9d')](_0x3081f0,_0x42648e[_0xf5bc('0x60')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xf5bc('0x9e')+_0x3081f0);}_0x5649c0[_0x42648e[_0xf5bc('0x60')]['mapKey']]=_0x42648e['body'][_0xf5bc('0x9a')];})['then'](function(){return db[_0xf5bc('0x43')][_0xf5bc('0x5e')]({'where':{'id':_0x42648e['params']['id']},'include':[{'model':db[_0xf5bc('0x9f')],'as':_0xf5bc('0xa0'),'include':[{'model':db[_0xf5bc('0x92')],'as':'Contacts','where':_0x5649c0,'limit':0x1,'order':[[_0xf5bc('0x97'),_0xf5bc('0xa1')]]}]},{'model':db[_0xf5bc('0xa2')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x3cbd3d,null))[_0xf5bc('0x20')](function(_0x525006){if(_0x525006&&_0x525006[_0xf5bc('0xa0')]){_0x1d76cd[_0xf5bc('0xa3')]=_0x525006;_0x1d76cd[_0xf5bc('0xa4')]=_0x525006[_0xf5bc('0xa5')];_0x1d76cd['list']=_0x525006[_0xf5bc('0xa0')];_0x1d76cd[_0xf5bc('0xa4')]=_[_0xf5bc('0xa6')](_0x1d76cd['applications'],[_0xf5bc('0xa7')],[_0xf5bc('0xa8')]);if(_0x1d76cd[_0xf5bc('0xa3')][_0xf5bc('0xa5')]){delete _0x1d76cd[_0xf5bc('0xa3')][_0xf5bc('0xa5')];}if(_0x1d76cd['account']['List']&&_0x1d76cd[_0xf5bc('0xa3')][_0xf5bc('0xa0')][_0xf5bc('0xa9')]['length']){return _0x1d76cd['account'][_0xf5bc('0xa0')]['Contacts'][0x0];}var _0x5a8b8d=_[_0xf5bc('0x1a')](_0x42648e['body'],{'firstName':_0x42648e[_0xf5bc('0x60')]['from'],'ListId':_0x525006[_0xf5bc('0x99')]});_0x5a8b8d[_0x42648e[_0xf5bc('0x60')]['mapKey']]=_0x42648e[_0xf5bc('0x60')]['from'];return db[_0xf5bc('0x92')][_0xf5bc('0x5f')](_0x5a8b8d,{'fields':_0x278093,'raw':!![]});}})[_0xf5bc('0x20')](handleEntityNotFound(_0x3cbd3d,null))[_0xf5bc('0x20')](function(_0x1a85bc){_0x1d76cd[_0xf5bc('0xaa')]=_0x1a85bc;var _0x5e773d=_0x42648e['body']['customerIp'];if(_0x42648e[_0xf5bc('0xab')][_0xf5bc('0xac')]){_0x5e773d=_0x42648e['headers']['cf-connecting-ip'];}else if(_0x42648e['headers'][_0xf5bc('0xad')]){_0x5e773d=_[_0xf5bc('0xae')](_0x42648e[_0xf5bc('0xab')][_0xf5bc('0xad')]['split'](','));}if(_0x1a85bc){var _0x2d1105={'ContactId':_0x1a85bc['id'],'ChatWebsiteId':_0x42648e[_0xf5bc('0x5c')]['id'],'from':(_0x1a85bc[_0xf5bc('0xaf')]||'')+'\x20'+(_0x1a85bc[_0xf5bc('0xb0')]||''),'customerIp':_0x5e773d,'customerPort':_0x42648e['headers'][_0xf5bc('0xb1')]?_0x42648e[_0xf5bc('0xab')]['x-real-port']:null,'referer':_0x42648e[_0xf5bc('0x60')]['referer'],'browserName':_0x50a6ad[_0xf5bc('0xb2')][_0xf5bc('0x3d')]&&_0x50a6ad['browser'][_0xf5bc('0xb3')]?util['format'](_0xf5bc('0xb4'),_0x50a6ad[_0xf5bc('0xb2')][_0xf5bc('0x3d')],_0x50a6ad['browser'][_0xf5bc('0xb3')]):_0xf5bc('0xb5'),'browserVersion':_0x50a6ad[_0xf5bc('0xb2')][_0xf5bc('0xb3')]||_0xf5bc('0xb5'),'osName':util['format'](_0xf5bc('0xb4'),_0x50a6ad['os']['name'],_0x50a6ad['os']['version']),'osVersion':_0x50a6ad['os'][_0xf5bc('0xb3')],'deviceModel':_0x50a6ad[_0xf5bc('0xb6')][_0xf5bc('0x48')]&&_0x50a6ad['device'][_0xf5bc('0xb7')]?util[_0xf5bc('0xb8')]('%s\x20%s\x20%s',_0x50a6ad[_0xf5bc('0xb6')][_0xf5bc('0x48')],_0x50a6ad[_0xf5bc('0xb6')][_0xf5bc('0xb7')],_0x50a6ad['device']['type']):null,'deviceVendor':_0x50a6ad[_0xf5bc('0xb6')][_0xf5bc('0xb7')],'deviceType':_0x50a6ad[_0xf5bc('0xb6')]['type'],'formData':JSON[_0xf5bc('0x25')](_0x42648e['body'])};var _0x203d63={'ChatWebsiteId':_0x42648e[_0xf5bc('0x5c')]['id'],'closed':![]};if(_0x42648e[_0xf5bc('0x60')][_0xf5bc('0xb9')]){_0x203d63[_0xf5bc('0xb9')]=_0x42648e['body']['threadId'];return db[_0xf5bc('0xba')]['find']({'where':_0x203d63})[_0xf5bc('0x20')](function(_0x49522b){if(_0x49522b){return[_0x49522b,![]];}_0x2d1105[_0xf5bc('0xb9')]=_0x42648e[_0xf5bc('0x60')]['threadId'];_0x2d1105[_0xf5bc('0xbb')]=_0x42648e[_0xf5bc('0x60')]['externalUrl'];return db[_0xf5bc('0xba')]['create'](_0x2d1105)[_0xf5bc('0x20')](function(_0x25ee14){return[_0x25ee14,!![]];});});}_0x203d63['ContactId']=_0x1a85bc['id'];if(_0x42648e['body'][_0xf5bc('0xbc')]&&_0x42648e[_0xf5bc('0x60')][_0xf5bc('0xbc')]['id']){_0x203d63['id']=_0x42648e['body'][_0xf5bc('0xbc')]['id'];return db[_0xf5bc('0xba')][_0xf5bc('0x5e')]({'where':_0x203d63})[_0xf5bc('0x20')](function(_0x1d142e){if(_0x1d142e){return[_0x1d142e,![]];}return db[_0xf5bc('0xba')]['create'](_0x2d1105)['then'](function(_0x2f9901){return[_0x2f9901,!![]];});});}return db[_0xf5bc('0xba')]['create'](_0x2d1105)[_0xf5bc('0x20')](function(_0x27ebde){return[_0x27ebde,!![]];});}})[_0xf5bc('0xbd')](function(_0x360355,_0x48cd35){if(_0x360355){_0x1d08a8=_0x48cd35;if(!_0x48cd35){var _0x136f6e={'from':(_0x1d76cd[_0xf5bc('0xaa')][_0xf5bc('0xaf')]||'')+'\x20'+(_0x1d76cd['contact'][_0xf5bc('0xb0')]||'')};if(_0x42648e[_0xf5bc('0x60')][_0xf5bc('0xb9')]&&_0x42648e[_0xf5bc('0x60')][_0xf5bc('0xbe')]&&_0x42648e[_0xf5bc('0x60')][_0xf5bc('0xb9')]!=_0x42648e[_0xf5bc('0x60')][_0xf5bc('0xbe')]){_0x136f6e['threadId']=_0x42648e[_0xf5bc('0x60')][_0xf5bc('0xbe')];}return _0x360355[_0xf5bc('0x37')](_0x136f6e);}else{return _0x360355;}}})[_0xf5bc('0x20')](function(_0x20de6f){_0x1d76cd[_0xf5bc('0xbc')]=_0x20de6f[_0xf5bc('0x39')]({'plain':!![]});_0x1d76cd[_0xf5bc('0xbc')][_0xf5bc('0xbf')]=_0x1d08a8;if(_0x1d76cd['interaction'][_0xf5bc('0xbf')]){if(_0x1d76cd[_0xf5bc('0xa3')][_0xf5bc('0xc0')]){_0x1d76cd[_0xf5bc('0xa4')][_0xf5bc('0xc1')]({'id':0x0,'priority':_0x1d76cd[_0xf5bc('0xa4')][_0xf5bc('0x4f')]+0x1,'app':'close','appdata':_0xf5bc('0xc2'),'interval':_0xf5bc('0xc3')});}}return db[_0xf5bc('0xc4')][_0xf5bc('0x5f')]({'body':_0x42648e['body'][_0xf5bc('0x60')],'ChatWebsiteId':_0x42648e[_0xf5bc('0x5c')]['id'],'ChatInteractionId':_0x20de6f['id'],'direction':'in','ContactId':_0x1d76cd[_0xf5bc('0xaa')]['id'],'AttachmentId':_0x42648e['body']['AttachmentId']});})[_0xf5bc('0x20')](function(_0xadc052){_0x1d76cd[_0xf5bc('0x29')]=_0xadc052;if(_0x1d76cd[_0xf5bc('0xbc')][_0xf5bc('0xc5')]){return db['User'][_0xf5bc('0x5e')]({'attributes':['id',_0xf5bc('0x3d')],'where':{'id':_0x1d76cd['interaction'][_0xf5bc('0xc5')]}})[_0xf5bc('0x20')](function(_0x505f83){if(_0x505f83){_0x1d76cd[_0xf5bc('0xa4')][_0xf5bc('0xc6')]({'id':0x0,'priority':0x0,'app':_0xf5bc('0xc7'),'appdata':_0x505f83[_0xf5bc('0x3d')]+','+(_0x1d76cd[_0xf5bc('0xa3')][_0xf5bc('0xc8')]||0xa),'interval':_0xf5bc('0xc3')});_0x1d76cd[_0xf5bc('0xc9')]=!![];}return respondWithRpcPromise(_0xf5bc('0xca'),_0xf5bc('0xcb'),_0x1d76cd);});}return respondWithRpcPromise('Start',_0xf5bc('0xcb'),_0x1d76cd);})['then'](function(_0x5984af){respondWithRpcPromise(_0xf5bc('0xcc'),_0xf5bc('0xcc'),{'event':_0xf5bc('0x8f'),'message':_0x5984af},client9002);return _0x5984af;})[_0xf5bc('0x20')](respondWithResult(_0x3cbd3d,null))['catch'](handleError(_0x3cbd3d,null));};exports[_0xf5bc('0xcd')]=function(_0x1dac05,_0x19a3a4,_0x49a15f){var _0x45c0f2,_0x44c530,_0x31c46c;var _0x1b5a95=[];var _0x26ed4a=[];var _0xb135af={};var _0x2bd185=_0x1dac05[_0xf5bc('0xce')]||[];var _0x3f1cf4=[];var _0x4d0785;return db[_0xf5bc('0x92')][_0xf5bc('0x67')]()['then'](function(_0x4808f1){if(!_0x4808f1){throw new db[(_0xf5bc('0x93'))][(_0xf5bc('0x94'))](_0xf5bc('0x95'));}_0x26ed4a=_['difference'](_[_0xf5bc('0x4a')](_0x4808f1),[_0xf5bc('0x96'),_0xf5bc('0x97')]);_0x1b5a95=_[_0xf5bc('0xcf')](_['keys'](_0x4808f1),[_0xf5bc('0x96'),_0xf5bc('0x97'),_0xf5bc('0x98'),_0xf5bc('0x99')]);if(_0x1dac05[_0xf5bc('0x60')]['id']){delete _0x1dac05[_0xf5bc('0x60')]['id'];}if(_['isNil'](_0x1dac05[_0xf5bc('0x60')][_0xf5bc('0x9a')])){throw _0x19a3a4[_0xf5bc('0x2e')](0x1f4)[_0xf5bc('0x3e')](new db['Sequelize']['ValidationError'](_0xf5bc('0x9b')));}if(_['isNil'](_0x1dac05[_0xf5bc('0x60')]['body'])||_0x1dac05[_0xf5bc('0x60')]['body']===''){throw _0x19a3a4['status'](0x1f4)[_0xf5bc('0x3e')](new db[(_0xf5bc('0x93'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xf5bc('0x82')](_0x1dac05['body'][_0xf5bc('0xd0')])){throw _0x19a3a4[_0xf5bc('0x2e')](0x1f4)[_0xf5bc('0x3e')](new db[(_0xf5bc('0x93'))][(_0xf5bc('0x94'))](_0xf5bc('0xd1')+_0x1b5a95));}if(!_[_0xf5bc('0x9d')](_0x1b5a95,_0x1dac05[_0xf5bc('0x60')]['mapKeyOffline'])){throw _0x19a3a4[_0xf5bc('0x2e')](0x1f4)[_0xf5bc('0x3e')](new db[(_0xf5bc('0x93'))][(_0xf5bc('0x94'))](_0xf5bc('0xd2')+_0x1b5a95));}_0xb135af[_0x1dac05[_0xf5bc('0x60')][_0xf5bc('0xd0')]]=_0x1dac05[_0xf5bc('0x60')][_0xf5bc('0x9a')];})[_0xf5bc('0x20')](function(){return db[_0xf5bc('0x43')][_0xf5bc('0x5e')]({'where':{'id':_0x1dac05[_0xf5bc('0x5c')]['id']},'include':[{'model':db[_0xf5bc('0x9f')],'as':_0xf5bc('0xa0')},{'model':db[_0xf5bc('0xd3')],'as':_0xf5bc('0xd3')}]});})[_0xf5bc('0x20')](handleEntityNotFound(_0x19a3a4,null))[_0xf5bc('0x20')](function(_0xd528cc){if(_0xd528cc&&_0xd528cc['List']){_0x44c530=_0xd528cc;var _0x1440d9=_[_0xf5bc('0x1a')](_0x1dac05['body'],{'firstName':_0x1dac05[_0xf5bc('0x60')][_0xf5bc('0x9a')],'phone':_0x1dac05[_0xf5bc('0x60')][_0xf5bc('0x9a')],'ListId':_0xd528cc[_0xf5bc('0x99')]});_0x1440d9[_0x1dac05['body'][_0xf5bc('0xd0')]]=_0x1dac05[_0xf5bc('0x60')][_0xf5bc('0x9a')];return db[_0xf5bc('0x92')][_0xf5bc('0xd4')]({'where':_0xb135af,'defaults':_0x1440d9});}})['spread'](function(_0x28776f){if(_0x28776f){_0x31c46c=_0x28776f;var _0x23c9c5=fs[_0xf5bc('0xd5')](path[_0xf5bc('0x7e')](config[_0xf5bc('0x84')],_0xf5bc('0xd6')),_0xf5bc('0xd7'));var _0xd01e65=ejs['render'](_0x23c9c5,{'body':_['toPairs'](_0x1dac05[_0xf5bc('0x60')]['body']),'bodyTitle':_0x44c530[_0xf5bc('0xd8')]});return db[_0xf5bc('0xd9')][_0xf5bc('0x5f')]({'body':_0xd01e65,'ContactId':_0x28776f['id'],'ChatWebsiteId':_0x44c530['id']});}})[_0xf5bc('0x20')](function(_0x35ad6c){_0x4d0785=_0x35ad6c;if(_0x2bd185[_0xf5bc('0x4f')]){var _0x4f4fba=_0x2bd185[_0xf5bc('0x42')](function(_0x2fc3f5){return{'name':_0x2fc3f5[_0xf5bc('0xda')],'basename':_0x2fc3f5[_0xf5bc('0x7a')],'type':_0x2fc3f5[_0xf5bc('0xdb')],'ChatOfflineMessageId':_0x35ad6c['id']};});_0x3f1cf4=_0x4f4fba[_0xf5bc('0x42')](_0x49856d=>{var _0x4d3360={'filename':_0x49856d[_0xf5bc('0x3d')],'path':path[_0xf5bc('0x7e')](config['root'],_0xf5bc('0xdc'),_0xf5bc('0xce'),_0xf5bc('0xdd'),_0xf5bc('0xde'),_0x49856d['basename'])};return _0x4d3360;});if(!_0x44c530[_0xf5bc('0xdf')]){return db['sequelize'][_0xf5bc('0xe0')](function(_0x172e25){return db[_0xf5bc('0xe1')][_0xf5bc('0xe2')](_0x4f4fba,{'transaction':_0x172e25});});}}})[_0xf5bc('0x20')](function(){if(_0x4d0785){_0x45c0f2=_0x4d0785;return db[_0xf5bc('0xd3')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0xf5bc('0xe3')],'as':_0xf5bc('0xe4'),'raw':!![]}]});}})['then'](function(_0x1f8c34){if(_0x1f8c34&&_0x1f8c34[_0xf5bc('0xe4')]&&_0x44c530[_0xf5bc('0xe5')]&&_0x44c530[_0xf5bc('0xe6')]){var _0x53cb9e={'tls':{'rejectUnauthorized':![]}};if(_0x1f8c34['Smtp'][_0xf5bc('0xe7')]){_0x53cb9e[_0xf5bc('0xe7')]=_0x1f8c34[_0xf5bc('0xe4')]['service'];}else{_0x53cb9e['host']=_0x1f8c34[_0xf5bc('0xe4')][_0xf5bc('0xe8')];_0x53cb9e[_0xf5bc('0xe9')]=_0x1f8c34[_0xf5bc('0xe4')][_0xf5bc('0xe9')];_0x53cb9e['secure']=_0x1f8c34['Smtp']['secure'];}if(_0x1f8c34[_0xf5bc('0xe4')][_0xf5bc('0xea')]){_0x53cb9e[_0xf5bc('0xeb')]={'user':_0x1f8c34[_0xf5bc('0xe4')][_0xf5bc('0x61')],'pass':_0x1f8c34['Smtp'][_0xf5bc('0xec')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x53cb9e,'message':{'from':util[_0xf5bc('0xb8')]('\x22%s\x22\x20<%s>',_0x1f8c34['name'],_0x1f8c34['email']||_0x1f8c34[_0xf5bc('0xe4')][_0xf5bc('0x61')]),'to':_0x44c530[_0xf5bc('0xe6')],'subject':_0x44c530[_0xf5bc('0xed')],'html':_0x45c0f2[_0xf5bc('0x60')],'attachments':_0x3f1cf4}},client9003)[_0xf5bc('0x20')](function(){return _0x45c0f2;})[_0xf5bc('0x2b')](function(_0x28d0e2){console[_0xf5bc('0x26')](_0x28d0e2);});}})[_0xf5bc('0x20')](function(){if(_0x44c530&&_0x44c530['openNewInteraction']&&_0x44c530[_0xf5bc('0xee')]){var _0x25fbfa=[];if(_0x2bd185[_0xf5bc('0x4f')]){_0x25fbfa=_0x2bd185[_0xf5bc('0x42')](function(_0x441512){return{'name':_0x441512[_0xf5bc('0xda')],'basename':_0x441512[_0xf5bc('0x7a')],'type':_0x441512[_0xf5bc('0xdb')],'ChatOfflineMessageId':_0x4d0785['id']};});}var _0x494c07;if(!_[_0xf5bc('0x82')](_0x44c530[_0xf5bc('0xef')])){var _0x4a4abb=_[_0xf5bc('0x42')](_0x1dac05[_0xf5bc('0x60')],function(_0x1d6e31){return _0x1d6e31;});var _0x26935b=_[_0xf5bc('0xf0')](_0x4a4abb)[0x0];var _0x45e80b=_[_0xf5bc('0xf1')](_0x26935b,function(_0x2e1fb3){return _0x2e1fb3;});_0x494c07=_0x45e80b[0x1][_0x44c530[_0xf5bc('0xef')]];}var _0x9bc083={'from':_0x31c46c[_0xf5bc('0xf2')],'firstName':_0x31c46c[_0xf5bc('0xaf')],'lastName':_0x31c46c[_0xf5bc('0xb0')],'mapKey':_0xf5bc('0xf2'),'message':{'from':_0x31c46c[_0xf5bc('0xf2')],'to':_0x44c530[_0xf5bc('0xd3')]['email'],'cc':'','subject':_[_0xf5bc('0x82')](_0x494c07)?_0x44c530[_0xf5bc('0xed')]:_0x494c07,'messageId':'','sentAt':new Date(),'attach':_0x25fbfa[_0xf5bc('0x4f')],'attachments':_0x25fbfa,'originChannel':_0xf5bc('0xf3'),'ChatWebsiteId':_0x44c530['id'],'ChatOfflineMessageId':_0x45c0f2['id'],'originTo':_0x44c530['MailAccount']['email']},'body':_0x45c0f2[_0xf5bc('0x60')]};var _0x4d94ee={'account':{'id':_0x44c530['MailAccountId']},'body':_0x9bc083,'log':_0xf5bc('0xf4')};return respondWithRpcPromise(_0xf5bc('0xf4'),'notifyMail',_0x4d94ee,client9001)[_0xf5bc('0x20')](function(){return _0x45c0f2;})[_0xf5bc('0x2b')](function(_0x457880){console['error'](_0x457880);});}return;})['then'](function(){if(_0x45c0f2){return _0x45c0f2;}})['then'](respondWithResult(_0x19a3a4,null))[_0xf5bc('0x2b')](function(_0xa37e4d){console[_0xf5bc('0x26')](_0xf5bc('0x2b'),_0xa37e4d);for(var _0x12f530 of _0x2bd185){var _0x3b7d4d=path[_0xf5bc('0x7e')](config[_0xf5bc('0x84')],_0xf5bc('0xdc'),'files','attachments',_0xf5bc('0xde'),_0x12f530[_0xf5bc('0x7a')]);fs_extra[_0xf5bc('0xf5')](_0x3b7d4d)['catch'](function(_0x183168){console[_0xf5bc('0x26')](_0xf5bc('0xf6'),_0x3b7d4d,_0x183168);});}});};exports[_0xf5bc('0xf7')]=function(_0x4786dd,_0x4ca845,_0x2ce8a4){return db[_0xf5bc('0xba')][_0xf5bc('0x5e')]({'where':{'id':_0x4786dd[_0xf5bc('0x5c')]['id']}})[_0xf5bc('0x20')](handleEntityNotFound(_0x4ca845,null))[_0xf5bc('0x20')](function(_0x3015c9){if(_0x3015c9){return _0x3015c9['addInteraction'](_0x4786dd[_0xf5bc('0x60')][_0xf5bc('0x70')],_[_0xf5bc('0xf8')](_0x4786dd[_0xf5bc('0x60')],[_0xf5bc('0x70'),'id'])||{});}})[_0xf5bc('0x20')](respondWithResult(_0x4ca845,null))[_0xf5bc('0x2b')](handleError(_0x4ca845,null));};exports[_0xf5bc('0xf9')]=function(_0x4b6aa1,_0x4c6888,_0x3ec8e4){var _0x5d8c90={'raw':![],'where':{}};var _0x5da82b={};var _0x4b493a={'count':0x0,'rows':[]};return db[_0xf5bc('0x43')][_0xf5bc('0x6b')]({'where':{'id':_0x4b6aa1[_0xf5bc('0x5c')]['id']}})[_0xf5bc('0x20')](handleEntityNotFound(_0x4c6888,null))[_0xf5bc('0x20')](function(_0x10aecc){if(_0x10aecc){_0x5da82b[_0xf5bc('0x48')]=_[_0xf5bc('0x4a')](db['ChatInteraction'][_0xf5bc('0x44')]);_0x5da82b[_0xf5bc('0x49')]=_[_0xf5bc('0x4a')](_0x4b6aa1[_0xf5bc('0x49')]);_0x5da82b['filters']=_[_0xf5bc('0x4c')](_0x5da82b[_0xf5bc('0x48')],_0x5da82b[_0xf5bc('0x49')]);_0x5d8c90[_0xf5bc('0x4e')]=_[_0xf5bc('0x4c')](_0x5da82b['model'],qs[_0xf5bc('0x4d')](_0x4b6aa1['query'][_0xf5bc('0x4d')]));_0x5d8c90[_0xf5bc('0x4e')]=_0x5d8c90[_0xf5bc('0x4e')]['length']?_0x5d8c90[_0xf5bc('0x4e')]:_0x5da82b['model'];if(!_0x4b6aa1[_0xf5bc('0x49')][_0xf5bc('0x50')](_0xf5bc('0x51'))){_0x5d8c90[_0xf5bc('0x32')]=qs['limit'](_0x4b6aa1[_0xf5bc('0x49')][_0xf5bc('0x32')]);_0x5d8c90[_0xf5bc('0x30')]=qs['offset'](_0x4b6aa1[_0xf5bc('0x49')][_0xf5bc('0x30')]);}_0x5d8c90[_0xf5bc('0x6c')]=qs[_0xf5bc('0x52')](_0x4b6aa1['query'][_0xf5bc('0x52')]);_0x5d8c90['where']=qs[_0xf5bc('0x4b')](_['pick'](_0x4b6aa1[_0xf5bc('0x49')],_0x5da82b['filters']));_0x5d8c90[_0xf5bc('0x53')]['ChatWebsiteId']=_0x10aecc['id'];if(_0x4b6aa1[_0xf5bc('0x49')][_0xf5bc('0x55')]){_0x5d8c90[_0xf5bc('0x53')]=_[_0xf5bc('0x56')](_0x5d8c90[_0xf5bc('0x53')],{'$or':_[_0xf5bc('0x42')](_0x5d8c90[_0xf5bc('0x4e')],function(_0x37cfdb){var _0x423485={};_0x423485[_0x37cfdb]={'$like':'%'+_0x4b6aa1[_0xf5bc('0x49')][_0xf5bc('0x55')]+'%'};return _0x423485;})});}_0x5d8c90=_[_0xf5bc('0x56')]({},_0x5d8c90,_0x4b6aa1['options']);return db[_0xf5bc('0xba')]['count']({'where':_0x5d8c90[_0xf5bc('0x53')]})['then'](function(_0x4c908e){_0x4b493a[_0xf5bc('0x57')]=_0x4c908e;if(_0x4b6aa1[_0xf5bc('0x49')][_0xf5bc('0x58')]){_0x5d8c90['include']=[{'model':db[_0xf5bc('0x92')],'as':_0xf5bc('0xfa'),'required':![]},{'model':db[_0xf5bc('0xfb')],'as':'Owner','attributes':[_0xf5bc('0x3d'),_0xf5bc('0xfc'),_0xf5bc('0xfd')],'required':![]},{'model':db[_0xf5bc('0xfe')],'as':'Tags','attributes':['id',_0xf5bc('0x3d'),'color'],'where':_0x4b6aa1['query'][_0xf5bc('0xff')]?{'id':_0x4b6aa1[_0xf5bc('0x49')][_0xf5bc('0xff')]}:undefined,'required':_0x4b6aa1[_0xf5bc('0x49')][_0xf5bc('0xff')]?!![]:![]}];}return db[_0xf5bc('0xba')][_0xf5bc('0x5a')](_0x5d8c90);})[_0xf5bc('0x20')](function(_0x22818b){_0x4b493a[_0xf5bc('0x6e')]=_0x22818b;return _0x4b493a;});}})['then'](respondWithFilteredResult(_0x4c6888,_0x5d8c90))[_0xf5bc('0x2b')](handleError(_0x4c6888,null));};function iftimePromise(_0x452cbe,_0x1095cd){return respondWithRpcPromise(_0xf5bc('0x100'),_0xf5bc('0x101'),{'command':_0x1095cd[_0xf5bc('0x102')]?util[_0xf5bc('0xb8')](_0xf5bc('0x103'),_0x452cbe[_0xf5bc('0x104')],_0x1095cd[_0xf5bc('0x102')]):util[_0xf5bc('0xb8')](_0xf5bc('0x105'),_0x452cbe[_0xf5bc('0x104')])},client9002)['then'](function(_0x1aaeba){var _0x1f01c8=_0x1aaeba&&_0x1aaeba[_0xf5bc('0x106')](_0xf5bc('0x107'))>=0x0?!![]:![];logger[_0xf5bc('0x21')](_0xf5bc('0x108'),_0x1095cd['id'],_0x452cbe['id'],_0x452cbe['interval'],_0x1f01c8?'ONLINE':_0xf5bc('0x109'),_0x1095cd[_0xf5bc('0x102')]?_0x1095cd[_0xf5bc('0x102')]:_0xf5bc('0x10a'));return _0x1f01c8;})['catch'](function(_0x4e69ee){logger[_0xf5bc('0x26')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1095cd['id'],_0x452cbe['id'],_0x452cbe[_0xf5bc('0x104')],util[_0xf5bc('0x10b')](_0x4e69ee,{'showHidden':![],'depth':null}),_0x1095cd[_0xf5bc('0x102')]?_0x1095cd[_0xf5bc('0x102')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x9b9896,_0x506eed,_0x19cbc1){var _0x3851d1=0x0;var _0x478346=0x0;var _0x46334f=![];var _0xb78497;var _0x49d5c0;return db[_0xf5bc('0x43')][_0xf5bc('0x5e')]({'where':{'id':_0x9b9896[_0xf5bc('0x5c')]['id']},'include':[{'model':db[_0xf5bc('0x10c')],'as':'Interval','include':[{'model':db['Interval'],'as':_0xf5bc('0x10d'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x506eed,null))['then'](function(_0x2e59b7){if(_0x2e59b7){_0xb78497=_0x2e59b7;return _0x2e59b7[_0xf5bc('0x10e')]({'raw':!![]});}})[_0xf5bc('0x20')](function(_0x5acc86){if(_0xb78497){if(_0x5acc86){_0x49d5c0=_0x5acc86;}}return require(_0xf5bc('0x18'))[_0xf5bc('0x80')]();})[_0xf5bc('0x20')](function(_0x3b16e3){if(_0x3b16e3){_0x478346=_0x3b16e3[_0xf5bc('0x10f')];_0x46334f=_0x3b16e3[_0xf5bc('0x81')];}})[_0xf5bc('0x20')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})['then'](function(_0x373762){_0x3851d1=_0x373762;if(_0x478346&&_0x373762>_0x478346){return db[_0xf5bc('0x110')][_0xf5bc('0x6b')]({'where':{'id':0x1}})[_0xf5bc('0x20')](function(_0x18e782){if(_0x18e782){_0x18e782['increment'](_0xf5bc('0x111'));}});}})[_0xf5bc('0x20')](function(){if(_0xb78497[_0xf5bc('0x10c')]&&_0xb78497[_0xf5bc('0x10c')]['Intervals']){var _0x8c6c90=[];for(var _0x2f38b0=0x0;_0x2f38b0<_0xb78497['Interval'][_0xf5bc('0x10d')][_0xf5bc('0x4f')];_0x2f38b0++){var _0x3dd703=_0xb78497[_0xf5bc('0x10c')][_0xf5bc('0x10d')][_0x2f38b0][_0xf5bc('0x39')]({'plain':!![]});_0x8c6c90[_0xf5bc('0xc1')](iftimePromise(_0x3dd703,_0xb78497));}return BPromise['all'](_0x8c6c90)[_0xf5bc('0x20')](function(_0x412577){return _[_0xf5bc('0x112')](_0x412577);});}else{return!![];}})[_0xf5bc('0x20')](function(_0xdbb9d8){var _0x2e3bb2=fs[_0xf5bc('0xd5')](path[_0xf5bc('0x7e')](config[_0xf5bc('0x84')],'server/files/chat/iframe.ejs'),'utf8');var _0x9f4d5f={'remote':_0xb78497[_0xf5bc('0x113')],'query':querystring[_0xf5bc('0x25')](_[_0xf5bc('0x56')](_0xb78497[_0xf5bc('0x39')]({'plain':!![]}),{'customerIp':_0x9b9896['headers'][_0xf5bc('0xad')]||_0x9b9896['headers'][_0xf5bc('0x114')]||_0x9b9896[_0xf5bc('0x115')]['remoteAddress']||_0x9b9896['ip'],'referer':_0x9b9896[_0xf5bc('0xab')]['referer'],'openedInteractions':_0x3851d1,'maxInteractions':_0x478346,'virtual':_0x46334f[_0xf5bc('0x10f')],'online':_0xdbb9d8,'custom':_0x46334f}))[_0xf5bc('0x116')](/'/g,'\x5c\x27')};_0x506eed['send'](ejs[_0xf5bc('0x117')](Mustache[_0xf5bc('0x117')](_0x2e3bb2,_0x9f4d5f),{'proactiveActions':_0x49d5c0,'alignment':_0xb78497[_0xf5bc('0x118')],'verticalAlignment':_0xb78497['verticalAlignment'],'div_color':_0xb78497[_0xf5bc('0x119')],'text_color':_0xb78497[_0xf5bc('0x11a')],'button_color':_0xb78497[_0xf5bc('0x11b')],'background_color':_0xb78497['backgroundColor']}));})[_0xf5bc('0x2b')](handleError(_0x506eed,null));};exports[_0xf5bc('0x11c')]=function(_0x3e8c44,_0x10662d,_0x19bf7c){return db[_0xf5bc('0x43')][_0xf5bc('0x6b')]({'where':{'id':_0x3e8c44[_0xf5bc('0x5c')]['id']}})[_0xf5bc('0x20')](handleEntityNotFound(_0x10662d,null))[_0xf5bc('0x20')](function(_0x212db8){if(_0x212db8){return db[_0xf5bc('0x11d')]['transaction'](function(_0x2dfb4a){return db[_0xf5bc('0xa2')][_0xf5bc('0x38')]({'where':{'ChatWebsiteId':_0x3e8c44['params']['id']},'transaction':_0x2dfb4a})[_0xf5bc('0x20')](function(_0x428551){var _0x43a2a8=_[_0xf5bc('0x42')](_0x3e8c44[_0xf5bc('0x60')],function(_0x29b980){_0x29b980[_0xf5bc('0x69')]=_0x3e8c44[_0xf5bc('0x5c')]['id'];return _0x29b980;});return db[_0xf5bc('0xa2')]['bulkCreate'](_0x43a2a8,{'transaction':_0x2dfb4a});});})[_0xf5bc('0x20')](function(){return db[_0xf5bc('0xa2')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x3e8c44[_0xf5bc('0x5c')]['id']},'order':_0xf5bc('0xa7')});});}})['then'](respondWithResult(_0x10662d,null))['catch'](handleError(_0x10662d,null));};exports[_0xf5bc('0x11e')]=function(_0x1b5c18,_0x17bc7d,_0x4b79f8){var _0x5a68d3={};var _0x1454e7={};var _0x1c45b4;var _0x5b5bc5;return db[_0xf5bc('0x43')][_0xf5bc('0x6b')]({'where':{'id':_0x1b5c18[_0xf5bc('0x5c')]['id']}})[_0xf5bc('0x20')](handleEntityNotFound(_0x17bc7d,null))['then'](function(_0x22b557){if(_0x22b557){_0x1c45b4=_0x22b557;_0x1454e7['model']=_['keys'](db[_0xf5bc('0xa2')]['rawAttributes']);_0x1454e7[_0xf5bc('0x49')]=_[_0xf5bc('0x4a')](_0x1b5c18[_0xf5bc('0x49')]);_0x1454e7['filters']=_[_0xf5bc('0x4c')](_0x1454e7['model'],_0x1454e7['query']);_0x5a68d3['attributes']=_[_0xf5bc('0x4c')](_0x1454e7['model'],qs[_0xf5bc('0x4d')](_0x1b5c18['query']['fields']));_0x5a68d3[_0xf5bc('0x4e')]=_0x5a68d3[_0xf5bc('0x4e')][_0xf5bc('0x4f')]?_0x5a68d3[_0xf5bc('0x4e')]:_0x1454e7[_0xf5bc('0x48')];_0x5a68d3[_0xf5bc('0x6c')]=qs[_0xf5bc('0x52')](_0x1b5c18[_0xf5bc('0x49')][_0xf5bc('0x52')]);_0x5a68d3['where']=qs[_0xf5bc('0x4b')](_[_0xf5bc('0x54')](_0x1b5c18['query'],_0x1454e7[_0xf5bc('0x4b')]));if(_0x1b5c18[_0xf5bc('0x49')][_0xf5bc('0x55')]){_0x5a68d3[_0xf5bc('0x53')]=_[_0xf5bc('0x56')](_0x5a68d3[_0xf5bc('0x53')],{'$or':_[_0xf5bc('0x42')](_0x5a68d3[_0xf5bc('0x4e')],function(_0x1c520c){var _0x1d36d8={};_0x1d36d8[_0x1c520c]={'$like':'%'+_0x1b5c18[_0xf5bc('0x49')][_0xf5bc('0x55')]+'%'};return _0x1d36d8;})});}_0x5a68d3=_[_0xf5bc('0x56')]({},_0x5a68d3,_0x1b5c18[_0xf5bc('0x5d')]);return _0x1c45b4[_0xf5bc('0x11e')](_0x5a68d3);}})[_0xf5bc('0x20')](function(_0x3ffd24){if(_0x3ffd24){_0x5b5bc5=_0x3ffd24[_0xf5bc('0x4f')];if(!_0x1b5c18[_0xf5bc('0x49')][_0xf5bc('0x50')](_0xf5bc('0x51'))){_0x5a68d3[_0xf5bc('0x32')]=qs[_0xf5bc('0x32')](_0x1b5c18[_0xf5bc('0x49')][_0xf5bc('0x32')]);_0x5a68d3['offset']=qs[_0xf5bc('0x30')](_0x1b5c18[_0xf5bc('0x49')][_0xf5bc('0x30')]);}return _0x1c45b4[_0xf5bc('0x11e')](_0x5a68d3);}})[_0xf5bc('0x20')](function(_0x3f6799){if(_0x3f6799){return _0x3f6799?{'count':_0x5b5bc5,'rows':_0x3f6799}:null;}})[_0xf5bc('0x20')](respondWithResult(_0x17bc7d,null))[_0xf5bc('0x2b')](handleError(_0x17bc7d,null));};exports[_0xf5bc('0x11f')]=function(_0x2a7ec7,_0x292c66,_0x3466d3){return db['chatProactiveAction'][_0xf5bc('0x5e')]({'where':{'id':_0x2a7ec7[_0xf5bc('0x5c')]['id']}})[_0xf5bc('0x20')](handleEntityNotFound(_0x292c66,null))[_0xf5bc('0x20')](function(_0x441d64){if(_0x441d64){return _0x441d64[_0xf5bc('0x11f')](_0x2a7ec7['body'][_0xf5bc('0x70')],_[_0xf5bc('0xf8')](_0x2a7ec7['body'],[_0xf5bc('0x70'),'id'])||{});}})['then'](respondWithResult(_0x292c66,null))[_0xf5bc('0x2b')](handleError(_0x292c66,null));};exports[_0xf5bc('0x10e')]=function(_0x4191d0,_0x3b565f,_0x1b98c0){var _0x4fd680={};var _0x4b34aa={};var _0x1ce117;var _0x379a62;return db[_0xf5bc('0x43')]['findOne']({'where':{'id':_0x4191d0['params']['id']}})[_0xf5bc('0x20')](handleEntityNotFound(_0x3b565f,null))['then'](function(_0x4b557d){if(_0x4b557d){_0x1ce117=_0x4b557d;_0x4b34aa[_0xf5bc('0x48')]=_[_0xf5bc('0x4a')](db['ChatProactiveAction'][_0xf5bc('0x44')]);_0x4b34aa[_0xf5bc('0x49')]=_[_0xf5bc('0x4a')](_0x4191d0[_0xf5bc('0x49')]);_0x4b34aa[_0xf5bc('0x4b')]=_['intersection'](_0x4b34aa[_0xf5bc('0x48')],_0x4b34aa[_0xf5bc('0x49')]);_0x4fd680[_0xf5bc('0x4e')]=_['intersection'](_0x4b34aa[_0xf5bc('0x48')],qs[_0xf5bc('0x4d')](_0x4191d0[_0xf5bc('0x49')][_0xf5bc('0x4d')]));_0x4fd680[_0xf5bc('0x4e')]=_0x4fd680[_0xf5bc('0x4e')]['length']?_0x4fd680[_0xf5bc('0x4e')]:_0x4b34aa[_0xf5bc('0x48')];_0x4fd680[_0xf5bc('0x6c')]=qs[_0xf5bc('0x52')](_0x4191d0['query'][_0xf5bc('0x52')]);_0x4fd680['where']=qs[_0xf5bc('0x4b')](_[_0xf5bc('0x54')](_0x4191d0[_0xf5bc('0x49')],_0x4b34aa[_0xf5bc('0x4b')]));if(_0x4191d0['query'][_0xf5bc('0x55')]){_0x4fd680[_0xf5bc('0x53')]=_['merge'](_0x4fd680[_0xf5bc('0x53')],{'$or':_['map'](_0x4fd680[_0xf5bc('0x4e')],function(_0x435b2e){var _0xbc7b2a={};_0xbc7b2a[_0x435b2e]={'$like':'%'+_0x4191d0[_0xf5bc('0x49')][_0xf5bc('0x55')]+'%'};return _0xbc7b2a;})});}_0x4fd680=_[_0xf5bc('0x56')]({},_0x4fd680,_0x4191d0[_0xf5bc('0x5d')]);return _0x1ce117['getProactiveActions'](_0x4fd680);}})[_0xf5bc('0x20')](function(_0x294100){if(_0x294100){_0x379a62=_0x294100[_0xf5bc('0x4f')];if(!_0x4191d0['query'][_0xf5bc('0x50')](_0xf5bc('0x51'))){_0x4fd680['limit']=qs[_0xf5bc('0x32')](_0x4191d0[_0xf5bc('0x49')][_0xf5bc('0x32')]);_0x4fd680[_0xf5bc('0x30')]=qs['offset'](_0x4191d0[_0xf5bc('0x49')][_0xf5bc('0x30')]);}return _0x1ce117['getProactiveActions'](_0x4fd680);}})['then'](function(_0x38747b){if(_0x38747b){return _0x38747b?{'count':_0x379a62,'rows':_0x38747b}:null;}})[_0xf5bc('0x20')](respondWithResult(_0x3b565f,null))[_0xf5bc('0x2b')](handleError(_0x3b565f,null));};exports[_0xf5bc('0x120')]=function(_0x4f91cd,_0x2ed098,_0x43c4ac){var _0x4ddbd1=_0x4f91cd[_0xf5bc('0x49')][_0xf5bc('0x121')]===_0xf5bc('0x122')?_0xf5bc('0x123'):_0xf5bc('0x124');return db['ChatWebsite'][_0xf5bc('0x5e')]({'attributes':['id',_0x4ddbd1],'where':{'id':_0x4f91cd[_0xf5bc('0x5c')]['id']}})[_0xf5bc('0x20')](handleEntityNotFound(_0x2ed098,null))['then'](function(_0x57bb7e){if(_0x57bb7e){var _0x5ea20b=_0x57bb7e[_0x4ddbd1];var _0x14d544=_0x5ea20b&&_0x5ea20b[_0xf5bc('0x125')]?_0x5ea20b[_0xf5bc('0x125')]:[];_0x2ed098[_0xf5bc('0x3e')]({'fromKey':_['isNil'](_0x5ea20b['fromKey'])?undefined:_0x5ea20b[_0xf5bc('0x126')],'count':_0x14d544['length'],'rows':_0x14d544});}})['catch'](handleError(_0x2ed098,null));};exports['getOfflineMessages']=function(_0x44738f,_0x104f38,_0x4f6cc6){var _0x3b4ee2={'raw':![],'where':{}};var _0x12c0e8={};var _0x55f81a={'count':0x0,'rows':[]};return db[_0xf5bc('0x43')][_0xf5bc('0x6b')]({'where':{'id':_0x44738f[_0xf5bc('0x5c')]['id']}})[_0xf5bc('0x20')](handleEntityNotFound(_0x104f38,null))[_0xf5bc('0x20')](function(_0x34c8ca){if(_0x34c8ca){_0x12c0e8['model']=_[_0xf5bc('0x4a')](db[_0xf5bc('0xd9')]['rawAttributes']);_0x12c0e8['query']=_[_0xf5bc('0x4a')](_0x44738f['query']);_0x12c0e8[_0xf5bc('0x4b')]=_[_0xf5bc('0x4c')](_0x12c0e8['model'],_0x12c0e8[_0xf5bc('0x49')]);_0x3b4ee2[_0xf5bc('0x4e')]=_[_0xf5bc('0x4c')](_0x12c0e8['model'],qs[_0xf5bc('0x4d')](_0x44738f[_0xf5bc('0x49')][_0xf5bc('0x4d')]));_0x3b4ee2[_0xf5bc('0x4e')]=_0x3b4ee2[_0xf5bc('0x4e')][_0xf5bc('0x4f')]?_0x3b4ee2[_0xf5bc('0x4e')]:_0x12c0e8[_0xf5bc('0x48')];if(!_0x44738f[_0xf5bc('0x49')][_0xf5bc('0x50')](_0xf5bc('0x51'))){_0x3b4ee2[_0xf5bc('0x32')]=qs[_0xf5bc('0x32')](_0x44738f[_0xf5bc('0x49')][_0xf5bc('0x32')]);_0x3b4ee2['offset']=qs[_0xf5bc('0x30')](_0x44738f[_0xf5bc('0x49')][_0xf5bc('0x30')]);}_0x3b4ee2[_0xf5bc('0x6c')]=qs[_0xf5bc('0x52')](_0x44738f[_0xf5bc('0x49')]['sort']);_0x3b4ee2['where']=qs[_0xf5bc('0x4b')](_['pick'](_0x44738f[_0xf5bc('0x49')],_0x12c0e8[_0xf5bc('0x4b')]));_0x3b4ee2[_0xf5bc('0x53')][_0xf5bc('0x69')]=_0x34c8ca['id'];if(_0x44738f['query'][_0xf5bc('0x55')]){_0x3b4ee2['where']=_['merge'](_0x3b4ee2[_0xf5bc('0x53')],{'$or':_[_0xf5bc('0x42')](_0x3b4ee2[_0xf5bc('0x4e')],function(_0x14e81a){var _0x83d8ab={};_0x83d8ab[_0x14e81a]={'$like':'%'+_0x44738f[_0xf5bc('0x49')][_0xf5bc('0x55')]+'%'};return _0x83d8ab;})});}_0x3b4ee2=_[_0xf5bc('0x56')]({},_0x3b4ee2,_0x44738f[_0xf5bc('0x5d')]);return db[_0xf5bc('0xd9')]['count']({'where':_0x3b4ee2[_0xf5bc('0x53')]})[_0xf5bc('0x20')](function(_0x208cd9){_0x55f81a[_0xf5bc('0x57')]=_0x208cd9;if(_0x44738f[_0xf5bc('0x49')][_0xf5bc('0x58')]){_0x3b4ee2[_0xf5bc('0x59')]=[{'all':!![]}];}else{_0x3b4ee2[_0xf5bc('0x59')]=[{'model':db[_0xf5bc('0x92')],'as':_0xf5bc('0xfa'),'required':![]},{'model':db[_0xf5bc('0xe1')],'as':'Attachments','required':![]}];}return db[_0xf5bc('0xd9')]['findAll'](_0x3b4ee2);})['then'](function(_0x591ad7){_0x55f81a[_0xf5bc('0x6e')]=_0x591ad7;return _0x55f81a;});}})[_0xf5bc('0x20')](respondWithFilteredResult(_0x104f38,_0x3b4ee2))['catch'](handleError(_0x104f38,null));};exports[_0xf5bc('0x127')]=function(_0x3d44bb,_0x544174,_0x1e5dcc){return db['ChatWebsite'][_0xf5bc('0x5e')]({'where':{'id':_0x3d44bb[_0xf5bc('0x5c')]['id']}})[_0xf5bc('0x20')](handleEntityNotFound(_0x544174,null))['then'](function(_0x33cdaf){if(_0x33cdaf){return _0x33cdaf[_0xf5bc('0x127')](_0x3d44bb[_0xf5bc('0x60')]['ids'],_['omit'](_0x3d44bb[_0xf5bc('0x60')],[_0xf5bc('0x70'),'id'])||{})[_0xf5bc('0xbd')](function(_0x4e58d0){for(var _0x5ac6c1=0x0;_0x5ac6c1<_0x3d44bb[_0xf5bc('0x60')][_0xf5bc('0x70')]['length'];_0x5ac6c1+=0x1){socket['emit'](_0xf5bc('0x128'),{'UserId':Number(_0x3d44bb[_0xf5bc('0x60')][_0xf5bc('0x70')][_0x5ac6c1]),'ChatWebsiteId':Number(_0x3d44bb[_0xf5bc('0x5c')]['id'])});}return _0x4e58d0;});}})[_0xf5bc('0x20')](respondWithResult(_0x544174,null))[_0xf5bc('0x2b')](handleError(_0x544174,null));};exports[_0xf5bc('0x129')]=function(_0x14cbc3,_0x572033,_0x1b5967){return db['ChatWebsite']['find']({'where':{'id':_0x14cbc3[_0xf5bc('0x5c')]['id']}})['then'](handleEntityNotFound(_0x572033,null))[_0xf5bc('0x20')](function(_0x205c58){if(_0x205c58){return _0x205c58[_0xf5bc('0x129')](_0x14cbc3[_0xf5bc('0x49')]['ids'])[_0xf5bc('0x20')](function(){if(_[_0xf5bc('0x12a')](_0x14cbc3['query'][_0xf5bc('0x70')])){for(var _0x190417=0x0;_0x190417<_0x14cbc3['query']['ids'][_0xf5bc('0x4f')];_0x190417+=0x1){socket[_0xf5bc('0x12b')]('userChatWebsite:remove',{'UserId':Number(_0x14cbc3['query']['ids'][_0x190417]),'ChatWebsiteId':Number(_0x14cbc3[_0xf5bc('0x5c')]['id'])});}}else{socket[_0xf5bc('0x12b')]('userChatWebsite:remove',{'UserId':Number(_0x14cbc3['query'][_0xf5bc('0x70')]),'ChatWebsiteId':Number(_0x14cbc3[_0xf5bc('0x5c')]['id'])});}});}})[_0xf5bc('0x20')](respondWithStatusCode(_0x572033,null))[_0xf5bc('0x2b')](handleError(_0x572033,null));};exports[_0xf5bc('0x12c')]=function(_0x76ec11,_0x3f2c77,_0x2846bc){var _0x3f2647={};var _0x597b5e={};var _0x2ca32e;var _0x4668f3;return db[_0xf5bc('0x43')]['findOne']({'where':{'id':_0x76ec11[_0xf5bc('0x5c')]['id']}})[_0xf5bc('0x20')](handleEntityNotFound(_0x3f2c77,null))[_0xf5bc('0x20')](function(_0x4f166a){if(_0x4f166a){_0x2ca32e=_0x4f166a;_0x597b5e[_0xf5bc('0x48')]=_[_0xf5bc('0x4a')](db[_0xf5bc('0xfb')][_0xf5bc('0x44')]);_0x597b5e[_0xf5bc('0x49')]=_[_0xf5bc('0x4a')](_0x76ec11[_0xf5bc('0x49')]);_0x597b5e[_0xf5bc('0x4b')]=_[_0xf5bc('0x4c')](_0x597b5e[_0xf5bc('0x48')],_0x597b5e[_0xf5bc('0x49')]);_0x3f2647[_0xf5bc('0x4e')]=_['intersection'](_0x597b5e[_0xf5bc('0x48')],qs['fields'](_0x76ec11[_0xf5bc('0x49')][_0xf5bc('0x4d')]));_0x3f2647['attributes']=_0x3f2647[_0xf5bc('0x4e')]['length']?_0x3f2647[_0xf5bc('0x4e')]:_0x597b5e[_0xf5bc('0x48')];_0x3f2647['order']=qs[_0xf5bc('0x52')](_0x76ec11[_0xf5bc('0x49')][_0xf5bc('0x52')]);_0x3f2647[_0xf5bc('0x53')]=qs[_0xf5bc('0x4b')](_[_0xf5bc('0x54')](_0x76ec11[_0xf5bc('0x49')],_0x597b5e[_0xf5bc('0x4b')]));if(_0x76ec11[_0xf5bc('0x49')][_0xf5bc('0x55')]){_0x3f2647[_0xf5bc('0x53')]=_['merge'](_0x3f2647['where'],{'$or':_[_0xf5bc('0x42')](_0x3f2647[_0xf5bc('0x4e')],function(_0x2a4be6){var _0x656356={};_0x656356[_0x2a4be6]={'$like':'%'+_0x76ec11[_0xf5bc('0x49')]['filter']+'%'};return _0x656356;})});}_0x3f2647=_[_0xf5bc('0x56')]({},_0x3f2647,_0x76ec11[_0xf5bc('0x5d')]);return _0x2ca32e['getAgents'](_0x3f2647);}})[_0xf5bc('0x20')](function(_0x238344){if(_0x238344){_0x4668f3=_0x238344[_0xf5bc('0x4f')];if(!_0x76ec11[_0xf5bc('0x49')]['hasOwnProperty'](_0xf5bc('0x51'))){_0x3f2647[_0xf5bc('0x32')]=qs[_0xf5bc('0x32')](_0x76ec11[_0xf5bc('0x49')][_0xf5bc('0x32')]);_0x3f2647[_0xf5bc('0x30')]=qs[_0xf5bc('0x30')](_0x76ec11[_0xf5bc('0x49')][_0xf5bc('0x30')]);}return _0x2ca32e[_0xf5bc('0x12c')](_0x3f2647);}})[_0xf5bc('0x20')](function(_0x1db161){if(_0x1db161){return _0x1db161?{'count':_0x4668f3,'rows':_0x1db161}:null;}})[_0xf5bc('0x20')](respondWithResult(_0x3f2c77,null))[_0xf5bc('0x2b')](handleError(_0x3f2c77,null));}; \ No newline at end of file +var _0x11c0=['isNil','existsSync','join','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','ChatApplication','Applications','account','list','applications','asc','Contacts','contact','x-forwarded-for','split','firstName','lastName','x-real-port','referer','version','%s\x20%s','browser','unknown','format','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','ContactId','interaction','messageId','update','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','startRouting','Start','EventManager','offline','files','difference','mapKeyOffline','MailAccount','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','basename','openNewInteraction','sequelize','transaction','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','subjectOffline','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','addInteraction','omit','getInteractions','User','fullname','internal','Tag','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','getProactiveActions','virtual','License','Intervals','all','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','replace','alignment','textColor','backgroundColor','addApplications','bulkCreate','findAndCountAll','getApplications','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachment','addAgents','emit','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','get','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x11c0,0x1da));var _0x011c=function(_0x474377,_0x3e0bb2){_0x474377=_0x474377-0x0;var _0xa554=_0x11c0[_0x474377];return _0xa554;};'use strict';var emlformat=require(_0x011c('0x0'));var rimraf=require(_0x011c('0x1'));var zipdir=require(_0x011c('0x2'));var jsonpatch=require(_0x011c('0x3'));var rp=require(_0x011c('0x4'));var moment=require('moment');var BPromise=require(_0x011c('0x5'));var Mustache=require(_0x011c('0x6'));var util=require('util');var path=require(_0x011c('0x7'));var sox=require('sox');var csv=require(_0x011c('0x8'));var ejs=require(_0x011c('0x9'));var fs=require('fs');var fs_extra=require(_0x011c('0xa'));var _=require('lodash');var squel=require(_0x011c('0xb'));var crypto=require(_0x011c('0xc'));var jsforce=require(_0x011c('0xd'));var deskjs=require(_0x011c('0xe'));var toCsv=require(_0x011c('0x8'));var querystring=require(_0x011c('0xf'));var Papa=require(_0x011c('0x10'));var Redis=require(_0x011c('0x11'));var authService=require(_0x011c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x011c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x011c('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x011c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x011c('0x16'))['db'];config[_0x011c('0x17')]=_[_0x011c('0x18')](config[_0x011c('0x17')],{'host':_0x011c('0x19'),'port':0x18eb});var socket=require(_0x011c('0x1a'))(new Redis(config['redis']));require(_0x011c('0x1b'))[_0x011c('0x1c')](socket);var jayson=require(_0x011c('0x1d'));var client=jayson['client'][_0x011c('0x1e')]({'port':0x232c});var client9002=jayson[_0x011c('0x1f')]['http']({'port':0x232a});var client9003=jayson[_0x011c('0x1f')][_0x011c('0x1e')]({'port':0x232b});var client9001=jayson[_0x011c('0x1f')]['http']({'port':0x2329});function respondWithRpcPromise(_0x3e92c4,_0x949bd3,_0x4a4515,_0x5b7ebe){return new BPromise(function(_0x5dc749,_0xb414b0){var _0x46130a=_0x5b7ebe||client;return _0x46130a[_0x011c('0x20')](_0x3e92c4,_0x4a4515)[_0x011c('0x21')](function(_0xcbfab3){logger[_0x011c('0x22')](_0x011c('0x23'),_0x949bd3,_0x011c('0x24'));logger[_0x011c('0x25')](_0x011c('0x26'),_0x949bd3,_0x011c('0x24'),JSON[_0x011c('0x27')](_0xcbfab3));if(_0xcbfab3['error']){if(_0xcbfab3[_0x011c('0x28')]['code']===0x1f4){logger[_0x011c('0x28')](_0x011c('0x23'),_0x949bd3,_0xcbfab3['error'][_0x011c('0x29')]);return _0xb414b0(_0xcbfab3[_0x011c('0x28')]['message']);}logger[_0x011c('0x28')](_0x011c('0x23'),_0x949bd3,_0xcbfab3['error'][_0x011c('0x29')]);return _0x5dc749(_0xcbfab3['error'][_0x011c('0x29')]);}else{logger[_0x011c('0x22')](_0x011c('0x23'),_0x949bd3,_0x011c('0x24'));_0x5dc749(_0xcbfab3['result']['message']);}})[_0x011c('0x2a')](function(_0x3cf91b){logger[_0x011c('0x28')](_0x011c('0x23'),_0x949bd3,_0x3cf91b);_0xb414b0(_0x3cf91b);});});}function respondWithStatusCode(_0x1de575,_0x2356af){_0x2356af=_0x2356af||0xcc;return function(_0xb6f9e8){if(_0xb6f9e8){return _0x1de575[_0x011c('0x2b')](_0x2356af);}return _0x1de575[_0x011c('0x2c')](_0x2356af)[_0x011c('0x2d')]();};}function respondWithResult(_0x133612,_0x240266){_0x240266=_0x240266||0xc8;return function(_0x4b7c87){if(_0x4b7c87){return _0x133612[_0x011c('0x2c')](_0x240266)[_0x011c('0x2e')](_0x4b7c87);}};}function respondWithFilteredResult(_0x5cd0d1,_0x34975d){return function(_0x3bdab0){if(_0x3bdab0){var _0xfd73af=typeof _0x34975d[_0x011c('0x2f')]===_0x011c('0x30')&&typeof _0x34975d[_0x011c('0x31')]===_0x011c('0x30');var _0x25fec3=_0x3bdab0[_0x011c('0x32')];var _0x430d03=_0xfd73af?0x0:_0x34975d[_0x011c('0x2f')];var _0x2de65b=_0xfd73af?_0x3bdab0['count']:_0x34975d[_0x011c('0x2f')]+_0x34975d[_0x011c('0x31')];var _0x40091c;if(_0x2de65b>=_0x25fec3){_0x2de65b=_0x25fec3;_0x40091c=0xc8;}else{_0x40091c=0xce;}_0x5cd0d1[_0x011c('0x2c')](_0x40091c);return _0x5cd0d1['set'](_0x011c('0x33'),_0x430d03+'-'+_0x2de65b+'/'+_0x25fec3)[_0x011c('0x2e')](_0x3bdab0);}return null;};}function patchUpdates(_0x769c23){return function(_0x205d0c){try{jsonpatch[_0x011c('0x34')](_0x205d0c,_0x769c23,!![]);}catch(_0x30c840){return BPromise[_0x011c('0x35')](_0x30c840);}return _0x205d0c['save']();};}function saveUpdates(_0x394c39,_0x49d854){return function(_0xc8c02f){if(_0xc8c02f){return _0xc8c02f['update'](_0x394c39)[_0x011c('0x21')](function(_0x3c19c8){return _0x3c19c8;});}return null;};}function removeEntity(_0x4772f1,_0x26d4db){return function(_0x335772){if(_0x335772){return _0x335772[_0x011c('0x36')]()[_0x011c('0x21')](function(){var _0x11c7ce=_0x335772[_0x011c('0x37')]({'plain':!![]});var _0x1012e1='ChatWebsites';return db['UserProfileResource']['destroy']({'where':{'type':_0x1012e1,'resourceId':_0x11c7ce['id']}})[_0x011c('0x21')](function(){return _0x335772;});})['then'](function(){_0x4772f1[_0x011c('0x2c')](0xcc)[_0x011c('0x2d')]();});}};}function handleEntityNotFound(_0x54e46b,_0x529d4f){return function(_0x1f9298){if(!_0x1f9298){_0x54e46b[_0x011c('0x2b')](0x194);}return _0x1f9298;};}function handleError(_0x175037,_0x247328){_0x247328=_0x247328||0x1f4;return function(_0x2b3b03){logger[_0x011c('0x28')](_0x2b3b03[_0x011c('0x38')]);if(_0x2b3b03[_0x011c('0x39')]){delete _0x2b3b03[_0x011c('0x39')];}_0x175037[_0x011c('0x2c')](_0x247328)[_0x011c('0x3a')](_0x2b3b03);};}exports[_0x011c('0x3b')]=function(_0x20ea8f,_0x194cea){var _0x18be58={'include':[{'model':db[_0x011c('0x3c')],'as':_0x011c('0x3d')}]},_0x30b6f3={},_0x5c6477={'count':0x0,'rows':[]};var _0x815e2a=_[_0x011c('0x3e')](db[_0x011c('0x3f')][_0x011c('0x40')],function(_0x54e127){return{'name':_0x54e127[_0x011c('0x41')],'type':_0x54e127['type']['key']};});_0x30b6f3[_0x011c('0x42')]=_[_0x011c('0x3e')](_0x815e2a,_0x011c('0x39'));_0x30b6f3[_0x011c('0x43')]=_[_0x011c('0x44')](_0x20ea8f[_0x011c('0x43')]);_0x30b6f3[_0x011c('0x45')]=_[_0x011c('0x46')](_0x30b6f3[_0x011c('0x42')],_0x30b6f3[_0x011c('0x43')]);_0x18be58[_0x011c('0x47')]=_[_0x011c('0x46')](_0x30b6f3[_0x011c('0x42')],qs[_0x011c('0x48')](_0x20ea8f[_0x011c('0x43')][_0x011c('0x48')]));_0x18be58[_0x011c('0x47')]=_0x18be58[_0x011c('0x47')][_0x011c('0x49')]?_0x18be58['attributes']:_0x30b6f3[_0x011c('0x42')];if(!_0x20ea8f[_0x011c('0x43')]['hasOwnProperty'](_0x011c('0x4a'))){_0x18be58[_0x011c('0x31')]=qs['limit'](_0x20ea8f[_0x011c('0x43')]['limit']);_0x18be58['offset']=qs['offset'](_0x20ea8f[_0x011c('0x43')][_0x011c('0x2f')]);}_0x18be58[_0x011c('0x4b')]=qs[_0x011c('0x4c')](_0x20ea8f['query']['sort']);_0x18be58['where']=qs[_0x011c('0x45')](_[_0x011c('0x4d')](_0x20ea8f[_0x011c('0x43')],_0x30b6f3[_0x011c('0x45')]),_0x815e2a);if(_0x20ea8f[_0x011c('0x43')][_0x011c('0x4e')]){_0x18be58[_0x011c('0x4f')]=_['merge'](_0x18be58['where'],{'$or':_[_0x011c('0x3e')](_0x815e2a,function(_0x2686ac){if(_0x2686ac[_0x011c('0x50')]!==_0x011c('0x51')){var _0x472996={};_0x472996[_0x2686ac[_0x011c('0x39')]]={'$like':'%'+_0x20ea8f['query']['filter']+'%'};return _0x472996;}})});}_0x18be58=_[_0x011c('0x52')]({},_0x18be58,_0x20ea8f[_0x011c('0x53')]);var _0x129add={'where':_0x18be58[_0x011c('0x4f')]};return db[_0x011c('0x3f')][_0x011c('0x32')](_0x129add)[_0x011c('0x21')](function(_0x340a14){_0x5c6477[_0x011c('0x32')]=_0x340a14;if(_0x20ea8f[_0x011c('0x43')][_0x011c('0x54')]){_0x18be58[_0x011c('0x55')]=[{'all':!![]}];}return db[_0x011c('0x3f')][_0x011c('0x56')](_0x18be58);})[_0x011c('0x21')](function(_0x43c9c1){_0x5c6477[_0x011c('0x57')]=_0x43c9c1;return _0x5c6477;})[_0x011c('0x21')](respondWithFilteredResult(_0x194cea,_0x18be58))[_0x011c('0x2a')](handleError(_0x194cea,null));};exports[_0x011c('0x58')]=function(_0x32f81a,_0x5e3e35){var _0x1f4c41={'raw':![],'where':{'id':_0x32f81a[_0x011c('0x59')]['id']},'include':[{'model':db[_0x011c('0x3c')],'as':_0x011c('0x3d')}]},_0x5e7c73={};_0x5e7c73[_0x011c('0x42')]=_[_0x011c('0x44')](db[_0x011c('0x3f')][_0x011c('0x40')]);_0x5e7c73[_0x011c('0x43')]=_['keys'](_0x32f81a['query']);_0x5e7c73['filters']=_['intersection'](_0x5e7c73[_0x011c('0x42')],_0x5e7c73[_0x011c('0x43')]);_0x1f4c41[_0x011c('0x47')]=_['intersection'](_0x5e7c73[_0x011c('0x42')],qs[_0x011c('0x48')](_0x32f81a['query'][_0x011c('0x48')]));_0x1f4c41[_0x011c('0x47')]=_0x1f4c41[_0x011c('0x47')][_0x011c('0x49')]?_0x1f4c41[_0x011c('0x47')]:_0x5e7c73[_0x011c('0x42')];if(_0x32f81a['query'][_0x011c('0x54')]){_0x1f4c41[_0x011c('0x55')]=[{'all':!![]}];}_0x1f4c41=_[_0x011c('0x52')]({},_0x1f4c41,_0x32f81a[_0x011c('0x53')]);return db[_0x011c('0x3f')][_0x011c('0x5a')](_0x1f4c41)[_0x011c('0x21')](handleEntityNotFound(_0x5e3e35,null))[_0x011c('0x21')](respondWithResult(_0x5e3e35,null))['catch'](handleError(_0x5e3e35,null));};exports[_0x011c('0x5b')]=function(_0x482566,_0x12d2bf){return db[_0x011c('0x3f')][_0x011c('0x5b')](_0x482566[_0x011c('0x5c')],{})[_0x011c('0x21')](function(_0x2396f5){var _0x4a3d4f=_0x482566[_0x011c('0x5d')][_0x011c('0x37')]({'plain':!![]});if(!_0x4a3d4f)throw new Error(_0x011c('0x5e'));if(_0x4a3d4f['role']==='user'){var _0x33e1ee=_0x2396f5[_0x011c('0x37')]({'plain':!![]});var _0x4be8fe=_0x011c('0x5f');return db[_0x011c('0x60')][_0x011c('0x5a')]({'where':{'name':_0x4be8fe,'userProfileId':_0x4a3d4f[_0x011c('0x61')]},'raw':!![]})['then'](function(_0x69135f){if(_0x69135f&&_0x69135f['autoAssociation']===0x0){return db[_0x011c('0x62')][_0x011c('0x5b')]({'name':_0x33e1ee['name'],'resourceId':_0x33e1ee['id'],'type':_0x69135f[_0x011c('0x39')],'sectionId':_0x69135f['id']},{})[_0x011c('0x21')](function(){return _0x2396f5;});}else{return _0x2396f5;}})[_0x011c('0x2a')](function(_0x4e66d6){logger[_0x011c('0x28')](_0x011c('0x63'),_0x4e66d6);throw _0x4e66d6;});}return _0x2396f5;})[_0x011c('0x21')](respondWithResult(_0x12d2bf,0xc9))[_0x011c('0x2a')](handleError(_0x12d2bf,null));};exports['update']=function(_0x190182,_0x3aafb5){if(_0x190182[_0x011c('0x5c')]['id']){delete _0x190182[_0x011c('0x5c')]['id'];}return db[_0x011c('0x3f')][_0x011c('0x5a')]({'where':{'id':_0x190182[_0x011c('0x59')]['id']},'include':[{'model':db[_0x011c('0x3c')],'as':_0x011c('0x3d')}]})[_0x011c('0x21')](handleEntityNotFound(_0x3aafb5,null))[_0x011c('0x21')](saveUpdates(_0x190182[_0x011c('0x5c')],null))['then'](respondWithResult(_0x3aafb5,null))['catch'](handleError(_0x3aafb5,null));};exports[_0x011c('0x36')]=function(_0x42cbfd,_0x33c12c){return db[_0x011c('0x3f')][_0x011c('0x5a')]({'where':{'id':_0x42cbfd[_0x011c('0x59')]['id']}})['then'](handleEntityNotFound(_0x33c12c,null))[_0x011c('0x21')](removeEntity(_0x33c12c,null))[_0x011c('0x2a')](handleError(_0x33c12c,null));};exports[_0x011c('0x64')]=function(_0x2d35f0,_0x1d3253){return db[_0x011c('0x3f')][_0x011c('0x64')]()[_0x011c('0x21')](respondWithResult(_0x1d3253,null))[_0x011c('0x2a')](handleError(_0x1d3253,null));};exports[_0x011c('0x65')]=function(_0xae30ac,_0x243d16,_0x30f7cd){if(_0xae30ac[_0x011c('0x5c')]['id']){delete _0xae30ac[_0x011c('0x5c')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0xae30ac[_0x011c('0x59')]['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x243d16,null))[_0x011c('0x21')](function(_0x42fdd5){if(_0x42fdd5){_0xae30ac[_0x011c('0x5c')][_0x011c('0x66')]=_0x42fdd5['id'];return db[_0x011c('0x67')][_0x011c('0x5b')](_0xae30ac[_0x011c('0x5c')]);}})[_0x011c('0x21')](respondWithResult(_0x243d16,null))[_0x011c('0x2a')](handleError(_0x243d16,null));};exports[_0x011c('0x68')]=function(_0x5dc501,_0x5233aa,_0x4609b8){var _0x2fba0c={'raw':![],'where':{}};var _0x5f55c2={};var _0x265183={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x011c('0x69')]({'where':{'id':_0x5dc501[_0x011c('0x59')]['id']}})['then'](handleEntityNotFound(_0x5233aa,null))[_0x011c('0x21')](function(_0x9cdf70){if(_0x9cdf70){_0x5f55c2[_0x011c('0x42')]=_['keys'](db['Disposition']['rawAttributes']);_0x5f55c2[_0x011c('0x43')]=_[_0x011c('0x44')](_0x5dc501['query']);_0x5f55c2[_0x011c('0x45')]=_['intersection'](_0x5f55c2['model'],_0x5f55c2[_0x011c('0x43')]);_0x2fba0c[_0x011c('0x47')]=_[_0x011c('0x46')](_0x5f55c2[_0x011c('0x42')],qs[_0x011c('0x48')](_0x5dc501['query'][_0x011c('0x48')]));_0x2fba0c[_0x011c('0x47')]=_0x2fba0c[_0x011c('0x47')][_0x011c('0x49')]?_0x2fba0c[_0x011c('0x47')]:_0x5f55c2[_0x011c('0x42')];if(!_0x5dc501['query']['hasOwnProperty']('nolimit')){_0x2fba0c[_0x011c('0x31')]=qs[_0x011c('0x31')](_0x5dc501['query'][_0x011c('0x31')]);_0x2fba0c[_0x011c('0x2f')]=qs[_0x011c('0x2f')](_0x5dc501[_0x011c('0x43')]['offset']);}_0x2fba0c[_0x011c('0x4b')]=qs[_0x011c('0x4c')](_0x5dc501[_0x011c('0x43')][_0x011c('0x4c')]);_0x2fba0c[_0x011c('0x4f')]=qs['filters'](_[_0x011c('0x4d')](_0x5dc501[_0x011c('0x43')],_0x5f55c2[_0x011c('0x45')]));_0x2fba0c[_0x011c('0x4f')][_0x011c('0x66')]=_0x9cdf70['id'];if(_0x5dc501[_0x011c('0x43')]['filter']){_0x2fba0c['where']=_['merge'](_0x2fba0c[_0x011c('0x4f')],{'$or':_[_0x011c('0x3e')](_0x2fba0c[_0x011c('0x47')],function(_0x486c19){var _0x528601={};_0x528601[_0x486c19]={'$like':'%'+_0x5dc501[_0x011c('0x43')][_0x011c('0x4e')]+'%'};return _0x528601;})});}_0x2fba0c=_[_0x011c('0x52')]({},_0x2fba0c,_0x5dc501[_0x011c('0x53')]);return db[_0x011c('0x67')]['count']({'where':_0x2fba0c[_0x011c('0x4f')]})[_0x011c('0x21')](function(_0x37bb2e){_0x265183[_0x011c('0x32')]=_0x37bb2e;if(_0x5dc501[_0x011c('0x43')][_0x011c('0x54')]){_0x2fba0c[_0x011c('0x55')]=[{'all':!![]}];}return db[_0x011c('0x67')][_0x011c('0x56')](_0x2fba0c);})[_0x011c('0x21')](function(_0x5d6ac6){_0x265183[_0x011c('0x57')]=_0x5d6ac6;return _0x265183;});}})[_0x011c('0x21')](respondWithFilteredResult(_0x5233aa,_0x2fba0c))[_0x011c('0x2a')](handleError(_0x5233aa,null));};exports[_0x011c('0x6a')]=function(_0x42eddd,_0x3e6098,_0x583e95){return db[_0x011c('0x3f')][_0x011c('0x5a')]({'where':{'id':_0x42eddd[_0x011c('0x59')]['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x3e6098,null))[_0x011c('0x21')](function(_0x1e9eb){if(_0x1e9eb){return _0x1e9eb['removeDispositions'](_0x42eddd['query'][_0x011c('0x6b')]);}})[_0x011c('0x21')](respondWithStatusCode(_0x3e6098,null))[_0x011c('0x2a')](handleError(_0x3e6098,null));};exports[_0x011c('0x6c')]=function(_0x4288f1,_0x9b823d,_0x35840){if(_0x4288f1[_0x011c('0x5c')]['id']){delete _0x4288f1['body']['id'];}return db[_0x011c('0x3f')]['find']({'where':{'id':_0x4288f1['params']['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x9b823d,null))[_0x011c('0x21')](function(_0x42e526){if(_0x42e526){_0x4288f1[_0x011c('0x5c')]['ChatWebsiteId']=_0x42e526['id'];return db[_0x011c('0x6d')][_0x011c('0x5b')](_0x4288f1[_0x011c('0x5c')]);}})['then'](respondWithResult(_0x9b823d,null))[_0x011c('0x2a')](handleError(_0x9b823d,null));};exports[_0x011c('0x6e')]=function(_0x57128e,_0x39e908,_0x12b5f9){var _0x4e943f={'raw':![],'where':{}};var _0x1f3584={};var _0x245469={'count':0x0,'rows':[]};return db[_0x011c('0x3f')][_0x011c('0x69')]({'where':{'id':_0x57128e[_0x011c('0x59')]['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x39e908,null))['then'](function(_0x3b11b3){if(_0x3b11b3){_0x1f3584['model']=_[_0x011c('0x44')](db['CannedAnswer'][_0x011c('0x40')]);_0x1f3584[_0x011c('0x43')]=_[_0x011c('0x44')](_0x57128e[_0x011c('0x43')]);_0x1f3584[_0x011c('0x45')]=_[_0x011c('0x46')](_0x1f3584[_0x011c('0x42')],_0x1f3584['query']);_0x4e943f[_0x011c('0x47')]=_[_0x011c('0x46')](_0x1f3584[_0x011c('0x42')],qs[_0x011c('0x48')](_0x57128e[_0x011c('0x43')][_0x011c('0x48')]));_0x4e943f[_0x011c('0x47')]=_0x4e943f[_0x011c('0x47')][_0x011c('0x49')]?_0x4e943f[_0x011c('0x47')]:_0x1f3584[_0x011c('0x42')];if(!_0x57128e['query'][_0x011c('0x6f')](_0x011c('0x4a'))){_0x4e943f[_0x011c('0x31')]=qs['limit'](_0x57128e[_0x011c('0x43')][_0x011c('0x31')]);_0x4e943f[_0x011c('0x2f')]=qs[_0x011c('0x2f')](_0x57128e[_0x011c('0x43')]['offset']);}_0x4e943f[_0x011c('0x4b')]=qs['sort'](_0x57128e[_0x011c('0x43')][_0x011c('0x4c')]);_0x4e943f[_0x011c('0x4f')]=qs[_0x011c('0x45')](_[_0x011c('0x4d')](_0x57128e['query'],_0x1f3584[_0x011c('0x45')]));_0x4e943f['where'][_0x011c('0x66')]=_0x3b11b3['id'];if(_0x57128e[_0x011c('0x43')][_0x011c('0x4e')]){_0x4e943f[_0x011c('0x4f')]=_[_0x011c('0x52')](_0x4e943f[_0x011c('0x4f')],{'$or':_[_0x011c('0x3e')](_0x4e943f[_0x011c('0x47')],function(_0x25bfe6){var _0x19d0ba={};_0x19d0ba[_0x25bfe6]={'$like':'%'+_0x57128e[_0x011c('0x43')][_0x011c('0x4e')]+'%'};return _0x19d0ba;})});}_0x4e943f=_[_0x011c('0x52')]({},_0x4e943f,_0x57128e[_0x011c('0x53')]);return db[_0x011c('0x6d')]['count']({'where':_0x4e943f[_0x011c('0x4f')]})['then'](function(_0x3c0466){_0x245469[_0x011c('0x32')]=_0x3c0466;if(_0x57128e['query'][_0x011c('0x54')]){_0x4e943f[_0x011c('0x55')]=[{'all':!![]}];}return db[_0x011c('0x6d')][_0x011c('0x56')](_0x4e943f);})[_0x011c('0x21')](function(_0x590e33){_0x245469[_0x011c('0x57')]=_0x590e33;return _0x245469;});}})[_0x011c('0x21')](respondWithFilteredResult(_0x39e908,_0x4e943f))[_0x011c('0x2a')](handleError(_0x39e908,null));};exports[_0x011c('0x70')]=function(_0x103e19,_0x3984c9,_0x4f4142){return db[_0x011c('0x3f')][_0x011c('0x5a')]({'where':{'id':_0x103e19[_0x011c('0x59')]['id']}})['then'](handleEntityNotFound(_0x3984c9,null))[_0x011c('0x21')](function(_0x4020e8){if(_0x4020e8){return _0x4020e8['removeAnswers'](_0x103e19[_0x011c('0x43')]['ids']);}})[_0x011c('0x21')](respondWithStatusCode(_0x3984c9,null))[_0x011c('0x2a')](handleError(_0x3984c9,null));};exports[_0x011c('0x71')]=function(_0x48e275,_0x3bfe46,_0x5f2522){_0x48e275[_0x011c('0x5c')][_0x011c('0x72')]=_0x48e275[_0x011c('0x73')][_0x011c('0x74')];return db[_0x011c('0x3f')][_0x011c('0x5a')]({'where':{'id':_0x48e275['params']['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x3bfe46,null))[_0x011c('0x21')](saveUpdates(_0x48e275['body'],null))[_0x011c('0x21')](respondWithResult(_0x3bfe46,null))['catch'](handleError(_0x3bfe46,null));};exports['addAvatar']=function(_0x197053,_0x52897d,_0x5d0f4b){_0x197053[_0x011c('0x5c')][_0x011c('0x75')]=_0x197053['file']['filename'];return db[_0x011c('0x3f')]['find']({'where':{'id':_0x197053[_0x011c('0x59')]['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x52897d,null))[_0x011c('0x21')](saveUpdates(_0x197053[_0x011c('0x5c')],null))[_0x011c('0x21')](respondWithResult(_0x52897d,null))[_0x011c('0x2a')](handleError(_0x52897d,null));};exports[_0x011c('0x76')]=function(_0x32f513,_0x1cb05f,_0x319ad9){_0x32f513['body'][_0x011c('0x77')]=_0x32f513[_0x011c('0x73')][_0x011c('0x74')];return db[_0x011c('0x3f')][_0x011c('0x5a')]({'where':{'id':_0x32f513['params']['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x1cb05f,null))[_0x011c('0x21')](saveUpdates(_0x32f513['body'],null))[_0x011c('0x21')](respondWithResult(_0x1cb05f,null))[_0x011c('0x2a')](handleError(_0x1cb05f,null));};exports[_0x011c('0x78')]=function(_0x3d0c80,_0x661328,_0x4315a8){_0x3d0c80[_0x011c('0x5c')][_0x011c('0x79')]=_0x3d0c80[_0x011c('0x73')][_0x011c('0x74')];return db[_0x011c('0x3f')][_0x011c('0x5a')]({'where':{'id':_0x3d0c80['params']['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x661328,null))['then'](saveUpdates(_0x3d0c80['body'],null))[_0x011c('0x21')](respondWithResult(_0x661328,null))[_0x011c('0x2a')](handleError(_0x661328,null));};exports[_0x011c('0x7a')]=function(_0xd30d6,_0x513a59,_0x30a7fd){var _0xc716=path['join'](config['root'],_0x011c('0x7b'));var _0x34a137={'where':{'id':_0xd30d6['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0xeafa2=![];return require(_0x011c('0x7c'))[_0x011c('0x7d')]()[_0x011c('0x21')](function(_0x303a1c){if(_0x303a1c){_0xeafa2=_0x303a1c['custom'];}})['then'](function(){return db['ChatWebsite'][_0x011c('0x5a')](_0x34a137);})[_0x011c('0x21')](handleEntityNotFound(_0x513a59,null))[_0x011c('0x21')](function(_0x4da737){if(_0x4da737){if(!_[_0x011c('0x7e')](_0x4da737[_0x011c('0x72')])){if(fs[_0x011c('0x7f')](path[_0x011c('0x80')](config[_0x011c('0x81')],_0x011c('0x82'),_0x4da737[_0x011c('0x72')]))&&_0xeafa2){_0xc716=path['join'](config[_0x011c('0x81')],_0x011c('0x82'),_0x4da737[_0x011c('0x72')]);}}return _0x513a59[_0x011c('0x83')](_0xc716);}})[_0x011c('0x2a')](handleError(_0x513a59,null));};exports[_0x011c('0x84')]=function(_0xb1d45a,_0x387908,_0x8448df){var _0x8a800c=path['join'](config[_0x011c('0x81')],_0x011c('0x85'));var _0x477cb7={'where':{'id':_0xb1d45a[_0x011c('0x59')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x011c('0x3f')]['find'](_0x477cb7)[_0x011c('0x21')](handleEntityNotFound(_0x387908,null))[_0x011c('0x21')](function(_0x4c8938){if(_0x4c8938){if(!_['isNil'](_0x4c8938[_0x011c('0x75')])){if(fs['existsSync'](path[_0x011c('0x80')](config[_0x011c('0x81')],_0x011c('0x86'),_0x4c8938[_0x011c('0x75')]))){_0x8a800c=path[_0x011c('0x80')](config[_0x011c('0x81')],_0x011c('0x86'),_0x4c8938[_0x011c('0x75')]);}}return _0x387908[_0x011c('0x83')](_0x8a800c);}})[_0x011c('0x2a')](handleError(_0x387908,null));};exports[_0x011c('0x87')]=function(_0x541958,_0x44a6d7,_0x195ac4){var _0x41ef20=path[_0x011c('0x80')](config['root'],_0x011c('0x88'));var _0x5cdeb1={'where':{'id':_0x541958[_0x011c('0x59')]['id']},'attributes':['id',_0x011c('0x77'),_0x011c('0x89')],'raw':!![]};return db[_0x011c('0x3f')][_0x011c('0x5a')](_0x5cdeb1)[_0x011c('0x21')](handleEntityNotFound(_0x44a6d7,null))['then'](function(_0x51c5ea){if(_0x51c5ea){if(!_[_0x011c('0x7e')](_0x51c5ea[_0x011c('0x77')])){if(fs[_0x011c('0x7f')](path[_0x011c('0x80')](config[_0x011c('0x81')],_0x011c('0x86'),_0x51c5ea[_0x011c('0x77')]))&&_0x51c5ea[_0x011c('0x89')]){_0x41ef20=path[_0x011c('0x80')](config['root'],'server/files/images/avatars/',_0x51c5ea['customerAvatar']);}}return _0x44a6d7['download'](_0x41ef20);}})[_0x011c('0x2a')](handleError(_0x44a6d7,null));};exports[_0x011c('0x8a')]=function(_0x387628,_0x44cc60,_0x48fcac){var _0x7abf8e=path[_0x011c('0x80')](config['root'],_0x011c('0x8b'));var _0x1444a5={'where':{'id':_0x387628[_0x011c('0x59')]['id']},'attributes':['id',_0x011c('0x79')],'raw':!![]};return db[_0x011c('0x3f')][_0x011c('0x5a')](_0x1444a5)[_0x011c('0x21')](handleEntityNotFound(_0x44cc60,null))[_0x011c('0x21')](function(_0x27dce8){if(_0x27dce8){if(!_['isNil'](_0x27dce8[_0x011c('0x79')])){if(fs[_0x011c('0x7f')](path[_0x011c('0x80')](config[_0x011c('0x81')],_0x011c('0x86'),_0x27dce8['systemAvatar']))){_0x7abf8e=path['join'](config[_0x011c('0x81')],_0x011c('0x86'),_0x27dce8[_0x011c('0x79')]);}}return _0x44cc60[_0x011c('0x83')](_0x7abf8e);}})[_0x011c('0x2a')](handleError(_0x44cc60,null));};exports[_0x011c('0x8c')]=function(_0xbf5cff,_0x37c8ea,_0x29c02b){var _0x4df0d9=require(_0x011c('0x8d'));var _0x1a6b32=new _0x4df0d9();var _0xdd9fab=_0x1a6b32[_0x011c('0x8e')](_0xbf5cff[_0x011c('0x8f')]['user-agent'])[_0x011c('0x90')]();var _0x236b40={'body':_0xbf5cff[_0x011c('0x5c')],'channel':_0x011c('0x91')};var _0x438672=[];var _0x4aed2f=[];var _0x331667={};var _0x1df898=![];return db[_0x011c('0x92')][_0x011c('0x64')]()[_0x011c('0x21')](function(_0x5b02b9){if(!_0x5b02b9){throw new db[(_0x011c('0x93'))][(_0x011c('0x94'))](_0x011c('0x95'));}_0x438672=_['difference'](_[_0x011c('0x44')](_0x5b02b9),['createdAt','updatedAt']);_0x4aed2f=_['difference'](_[_0x011c('0x44')](_0x5b02b9),[_0x011c('0x96'),_0x011c('0x97'),_0x011c('0x98'),_0x011c('0x99')]);if(_0xbf5cff[_0x011c('0x5c')]['id']){delete _0xbf5cff['body']['id'];}if(_[_0x011c('0x7e')](_0xbf5cff[_0x011c('0x5c')][_0x011c('0x9a')])){throw new db[(_0x011c('0x93'))][(_0x011c('0x94'))](_0x011c('0x9b'));}if(_[_0x011c('0x7e')](_0xbf5cff[_0x011c('0x5c')]['body'])||_0xbf5cff[_0x011c('0x5c')]['body']===''){throw new db[(_0x011c('0x93'))][(_0x011c('0x94'))](_0x011c('0x9c'));}if(_[_0x011c('0x7e')](_0xbf5cff[_0x011c('0x5c')][_0x011c('0x9d')])){throw new db['Sequelize'][(_0x011c('0x94'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4aed2f);}if(!_[_0x011c('0x9e')](_0x4aed2f,_0xbf5cff[_0x011c('0x5c')]['mapKey'])){throw new db[(_0x011c('0x93'))][(_0x011c('0x94'))](_0x011c('0x9f')+_0x4aed2f);}_0x331667[_0xbf5cff[_0x011c('0x5c')][_0x011c('0x9d')]]=_0xbf5cff['body'][_0x011c('0x9a')];})[_0x011c('0x21')](function(){return db[_0x011c('0x3f')][_0x011c('0x5a')]({'where':{'id':_0xbf5cff[_0x011c('0x59')]['id']},'include':[{'model':db[_0x011c('0xa0')],'as':_0x011c('0xa1'),'include':[{'model':db[_0x011c('0x92')],'as':'Contacts','where':_0x331667,'limit':0x1,'order':[[_0x011c('0x97'),_0x011c('0xa2')]]}]},{'model':db[_0x011c('0xa3')],'as':_0x011c('0xa4')}]});})[_0x011c('0x21')](handleEntityNotFound(_0x37c8ea,null))[_0x011c('0x21')](function(_0x287837){if(_0x287837&&_0x287837['List']){_0x236b40[_0x011c('0xa5')]=_0x287837;_0x236b40['applications']=_0x287837['Applications'];_0x236b40[_0x011c('0xa6')]=_0x287837['List'];_0x236b40[_0x011c('0xa7')]=_['orderBy'](_0x236b40[_0x011c('0xa7')],['priority'],[_0x011c('0xa8')]);if(_0x236b40['account'][_0x011c('0xa4')]){delete _0x236b40['account'][_0x011c('0xa4')];}if(_0x236b40[_0x011c('0xa5')]['List']&&_0x236b40[_0x011c('0xa5')]['List']['Contacts'][_0x011c('0x49')]){return _0x236b40[_0x011c('0xa5')][_0x011c('0xa1')][_0x011c('0xa9')][0x0];}var _0x492ed1=_[_0x011c('0x18')](_0xbf5cff[_0x011c('0x5c')],{'firstName':_0xbf5cff['body'][_0x011c('0x9a')],'ListId':_0x287837[_0x011c('0x99')]});_0x492ed1[_0xbf5cff[_0x011c('0x5c')][_0x011c('0x9d')]]=_0xbf5cff[_0x011c('0x5c')][_0x011c('0x9a')];return db['CmContact']['create'](_0x492ed1,{'fields':_0x438672,'raw':!![]});}})[_0x011c('0x21')](handleEntityNotFound(_0x37c8ea,null))[_0x011c('0x21')](function(_0x34a827){_0x236b40[_0x011c('0xaa')]=_0x34a827;var _0x26d518=_0xbf5cff[_0x011c('0x5c')]['customerIp'];if(_0xbf5cff[_0x011c('0x8f')]['cf-connecting-ip']){_0x26d518=_0xbf5cff[_0x011c('0x8f')]['cf-connecting-ip'];}else if(_0xbf5cff['headers'][_0x011c('0xab')]){_0x26d518=_['first'](_0xbf5cff[_0x011c('0x8f')][_0x011c('0xab')][_0x011c('0xac')](','));}if(_0x34a827){var _0x500bad={'ContactId':_0x34a827['id'],'ChatWebsiteId':_0xbf5cff[_0x011c('0x59')]['id'],'from':(_0x34a827[_0x011c('0xad')]||'')+'\x20'+(_0x34a827[_0x011c('0xae')]||''),'customerIp':_0x26d518,'customerPort':_0xbf5cff['headers'][_0x011c('0xaf')]?_0xbf5cff[_0x011c('0x8f')][_0x011c('0xaf')]:null,'referer':_0xbf5cff[_0x011c('0x5c')][_0x011c('0xb0')],'browserName':_0xdd9fab['browser']['name']&&_0xdd9fab['browser'][_0x011c('0xb1')]?util['format'](_0x011c('0xb2'),_0xdd9fab[_0x011c('0xb3')]['name'],_0xdd9fab['browser'][_0x011c('0xb1')]):'unknown','browserVersion':_0xdd9fab[_0x011c('0xb3')]['version']||_0x011c('0xb4'),'osName':util[_0x011c('0xb5')](_0x011c('0xb2'),_0xdd9fab['os'][_0x011c('0x39')],_0xdd9fab['os'][_0x011c('0xb1')]),'osVersion':_0xdd9fab['os']['version'],'deviceModel':_0xdd9fab[_0x011c('0xb6')][_0x011c('0x42')]&&_0xdd9fab[_0x011c('0xb6')][_0x011c('0xb7')]?util[_0x011c('0xb5')](_0x011c('0xb8'),_0xdd9fab['device'][_0x011c('0x42')],_0xdd9fab[_0x011c('0xb6')][_0x011c('0xb7')],_0xdd9fab[_0x011c('0xb6')][_0x011c('0x50')]):null,'deviceVendor':_0xdd9fab[_0x011c('0xb6')][_0x011c('0xb7')],'deviceType':_0xdd9fab[_0x011c('0xb6')][_0x011c('0x50')],'formData':JSON[_0x011c('0x27')](_0xbf5cff[_0x011c('0x5c')])};var _0x5a69f4={'ChatWebsiteId':_0xbf5cff[_0x011c('0x59')]['id'],'closed':![]};if(_0xbf5cff[_0x011c('0x5c')]['threadId']){_0x5a69f4[_0x011c('0xb9')]=_0xbf5cff[_0x011c('0x5c')][_0x011c('0xb9')];return db[_0x011c('0xba')][_0x011c('0x5a')]({'where':_0x5a69f4})[_0x011c('0x21')](function(_0x52b583){if(_0x52b583){return[_0x52b583,![]];}_0x500bad[_0x011c('0xb9')]=_0xbf5cff[_0x011c('0x5c')][_0x011c('0xb9')];_0x500bad['externalUrl']=_0xbf5cff[_0x011c('0x5c')]['externalUrl'];return db['ChatInteraction'][_0x011c('0x5b')](_0x500bad)[_0x011c('0x21')](function(_0x1b89f4){return[_0x1b89f4,!![]];});});}_0x5a69f4[_0x011c('0xbb')]=_0x34a827['id'];if(_0xbf5cff[_0x011c('0x5c')][_0x011c('0xbc')]&&_0xbf5cff[_0x011c('0x5c')][_0x011c('0xbc')]['id']){_0x5a69f4['id']=_0xbf5cff['body'][_0x011c('0xbc')]['id'];return db['ChatInteraction']['find']({'where':_0x5a69f4})[_0x011c('0x21')](function(_0x3c13c7){if(_0x3c13c7){return[_0x3c13c7,![]];}return db[_0x011c('0xba')][_0x011c('0x5b')](_0x500bad)[_0x011c('0x21')](function(_0x7efd4c){return[_0x7efd4c,!![]];});});}return db['ChatInteraction'][_0x011c('0x5b')](_0x500bad)[_0x011c('0x21')](function(_0x2a7be3){return[_0x2a7be3,!![]];});}})['spread'](function(_0x5aa174,_0x36b221){if(_0x5aa174){_0x1df898=_0x36b221;if(!_0x36b221){var _0xc00c2b={'from':(_0x236b40[_0x011c('0xaa')][_0x011c('0xad')]||'')+'\x20'+(_0x236b40[_0x011c('0xaa')][_0x011c('0xae')]||'')};if(_0xbf5cff['body'][_0x011c('0xb9')]&&_0xbf5cff[_0x011c('0x5c')][_0x011c('0xbd')]&&_0xbf5cff[_0x011c('0x5c')][_0x011c('0xb9')]!=_0xbf5cff[_0x011c('0x5c')][_0x011c('0xbd')]){_0xc00c2b[_0x011c('0xb9')]=_0xbf5cff[_0x011c('0x5c')][_0x011c('0xbd')];}return _0x5aa174[_0x011c('0xbe')](_0xc00c2b);}else{return _0x5aa174;}}})['then'](function(_0x2b399f){_0x236b40[_0x011c('0xbc')]=_0x2b399f[_0x011c('0x37')]({'plain':!![]});_0x236b40[_0x011c('0xbc')]['created']=_0x1df898;if(_0x236b40[_0x011c('0xbc')][_0x011c('0xbf')]){if(_0x236b40[_0x011c('0xa5')]['autoclose']){_0x236b40[_0x011c('0xa7')][_0x011c('0xc0')]({'id':0x0,'priority':_0x236b40[_0x011c('0xa7')][_0x011c('0x49')]+0x1,'app':_0x011c('0xc1'),'appdata':_0x011c('0xc2'),'interval':_0x011c('0xc3')});}}return db[_0x011c('0xc4')][_0x011c('0x5b')]({'body':_0xbf5cff[_0x011c('0x5c')]['body'],'ChatWebsiteId':_0xbf5cff[_0x011c('0x59')]['id'],'ChatInteractionId':_0x2b399f['id'],'direction':'in','ContactId':_0x236b40[_0x011c('0xaa')]['id'],'AttachmentId':_0xbf5cff['body'][_0x011c('0xc5')]});})[_0x011c('0x21')](function(_0x3ea6fd){_0x236b40[_0x011c('0x29')]=_0x3ea6fd;if(_0x236b40[_0x011c('0xbc')][_0x011c('0xc6')]){return db['User'][_0x011c('0x5a')]({'attributes':['id',_0x011c('0x39')],'where':{'id':_0x236b40[_0x011c('0xbc')][_0x011c('0xc6')]}})[_0x011c('0x21')](function(_0x21eb9b){if(_0x21eb9b){_0x236b40[_0x011c('0xa7')][_0x011c('0xc7')]({'id':0x0,'priority':0x0,'app':_0x011c('0xc8'),'appdata':_0x21eb9b[_0x011c('0x39')]+','+(_0x236b40[_0x011c('0xa5')]['waitForTheAssignedAgent']||0xa),'interval':_0x011c('0xc3')});_0x236b40['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0x011c('0xc9'),_0x236b40);});}return respondWithRpcPromise(_0x011c('0xca'),_0x011c('0xc9'),_0x236b40);})[_0x011c('0x21')](function(_0x3dc48e){respondWithRpcPromise(_0x011c('0xcb'),_0x011c('0xcb'),{'event':_0x011c('0x8c'),'message':_0x3dc48e},client9002);return _0x3dc48e;})[_0x011c('0x21')](respondWithResult(_0x37c8ea,null))[_0x011c('0x2a')](handleError(_0x37c8ea,null));};exports[_0x011c('0xcc')]=function(_0x449108,_0x204b5e,_0x17875b){var _0x3f7224,_0x362c8a,_0x5953e9;var _0x5e9d1f=[];var _0xf43e46=[];var _0x33d8ec={};var _0x241aa2=_0x449108[_0x011c('0xcd')]||[];var _0x28a609=[];var _0x31b16f;return db['CmContact'][_0x011c('0x64')]()['then'](function(_0x201078){if(!_0x201078){throw new db[(_0x011c('0x93'))][(_0x011c('0x94'))]('no\x20available\x20attributes');}_0xf43e46=_[_0x011c('0xce')](_[_0x011c('0x44')](_0x201078),[_0x011c('0x96'),_0x011c('0x97')]);_0x5e9d1f=_[_0x011c('0xce')](_[_0x011c('0x44')](_0x201078),[_0x011c('0x96'),_0x011c('0x97'),'CompanyId',_0x011c('0x99')]);if(_0x449108['body']['id']){delete _0x449108['body']['id'];}if(_['isNil'](_0x449108['body'][_0x011c('0x9a')])){throw _0x204b5e[_0x011c('0x2c')](0x1f4)[_0x011c('0x3a')](new db[(_0x011c('0x93'))][(_0x011c('0x94'))](_0x011c('0x9b')));}if(_[_0x011c('0x7e')](_0x449108[_0x011c('0x5c')]['body'])||_0x449108[_0x011c('0x5c')][_0x011c('0x5c')]===''){throw _0x204b5e['status'](0x1f4)['send'](new db[(_0x011c('0x93'))][(_0x011c('0x94'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x011c('0x7e')](_0x449108[_0x011c('0x5c')]['mapKeyOffline'])){throw _0x204b5e[_0x011c('0x2c')](0x1f4)['send'](new db[(_0x011c('0x93'))][(_0x011c('0x94'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5e9d1f));}if(!_['includes'](_0x5e9d1f,_0x449108[_0x011c('0x5c')][_0x011c('0xcf')])){throw _0x204b5e[_0x011c('0x2c')](0x1f4)[_0x011c('0x3a')](new db['Sequelize'][(_0x011c('0x94'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5e9d1f));}_0x33d8ec[_0x449108['body']['mapKeyOffline']]=_0x449108[_0x011c('0x5c')]['from'];})[_0x011c('0x21')](function(){return db[_0x011c('0x3f')][_0x011c('0x5a')]({'where':{'id':_0x449108['params']['id']},'include':[{'model':db[_0x011c('0xa0')],'as':_0x011c('0xa1')},{'model':db[_0x011c('0xd0')],'as':'MailAccount'}]});})[_0x011c('0x21')](handleEntityNotFound(_0x204b5e,null))['then'](function(_0x4273ac){if(_0x4273ac&&_0x4273ac[_0x011c('0xa1')]){_0x362c8a=_0x4273ac;var _0x360a56=_[_0x011c('0x18')](_0x449108[_0x011c('0x5c')],{'firstName':_0x449108['body'][_0x011c('0x9a')],'phone':_0x449108[_0x011c('0x5c')][_0x011c('0x9a')],'ListId':_0x4273ac[_0x011c('0x99')]});_0x360a56[_0x449108[_0x011c('0x5c')]['mapKeyOffline']]=_0x449108['body'][_0x011c('0x9a')];return db['CmContact']['findOrCreate']({'where':_0x33d8ec,'defaults':_0x360a56});}})[_0x011c('0xd1')](function(_0x5f04b7){if(_0x5f04b7){_0x5953e9=_0x5f04b7;var _0x2e6c77=fs[_0x011c('0xd2')](path[_0x011c('0x80')](config[_0x011c('0x81')],_0x011c('0xd3')),_0x011c('0xd4'));var _0x59fb3d=ejs[_0x011c('0xd5')](_0x2e6c77,{'body':_[_0x011c('0xd6')](_0x449108[_0x011c('0x5c')]['body']),'bodyTitle':_0x362c8a[_0x011c('0xd7')]});return db[_0x011c('0xd8')][_0x011c('0x5b')]({'body':_0x59fb3d,'ContactId':_0x5f04b7['id'],'ChatWebsiteId':_0x362c8a['id']});}})[_0x011c('0x21')](function(_0x5ae866){_0x31b16f=_0x5ae866;if(_0x241aa2['length']){var _0xd39796=_0x241aa2[_0x011c('0x3e')](function(_0x3fb296){return{'name':_0x3fb296[_0x011c('0xd9')],'basename':_0x3fb296[_0x011c('0x74')],'type':_0x3fb296[_0x011c('0xda')],'ChatOfflineMessageId':_0x5ae866['id']};});_0x28a609=_0xd39796[_0x011c('0x3e')](_0xb1bdae=>{var _0xcbbe67={'filename':_0xb1bdae[_0x011c('0x39')],'path':path[_0x011c('0x80')](config[_0x011c('0x81')],_0x011c('0xdb'),'files',_0x011c('0xdc'),'offline-chat',_0xb1bdae[_0x011c('0xdd')])};return _0xcbbe67;});if(!_0x362c8a[_0x011c('0xde')]){return db[_0x011c('0xdf')][_0x011c('0xe0')](function(_0x25a360){return db['Attachment']['bulkCreate'](_0xd39796,{'transaction':_0x25a360});});}}})[_0x011c('0x21')](function(){if(_0x31b16f){_0x3f7224=_0x31b16f;return db['MailAccount'][_0x011c('0x69')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':_0x011c('0xe1'),'raw':!![]}]});}})[_0x011c('0x21')](function(_0x5ae132){if(_0x5ae132&&_0x5ae132[_0x011c('0xe1')]&&_0x362c8a[_0x011c('0xe2')]&&_0x362c8a[_0x011c('0xe3')]){var _0x3e9483={'tls':{'rejectUnauthorized':![]}};if(_0x5ae132['Smtp'][_0x011c('0xe4')]){_0x3e9483[_0x011c('0xe4')]=_0x5ae132[_0x011c('0xe1')][_0x011c('0xe4')];}else{_0x3e9483[_0x011c('0xe5')]=_0x5ae132[_0x011c('0xe1')]['host'];_0x3e9483[_0x011c('0xe6')]=_0x5ae132[_0x011c('0xe1')]['port'];_0x3e9483[_0x011c('0xe7')]=_0x5ae132[_0x011c('0xe1')][_0x011c('0xe7')];}if(_0x5ae132[_0x011c('0xe1')][_0x011c('0xe8')]){_0x3e9483[_0x011c('0xe9')]={'user':_0x5ae132[_0x011c('0xe1')][_0x011c('0x5d')],'pass':_0x5ae132[_0x011c('0xe1')][_0x011c('0xea')]};}return respondWithRpcPromise('SendMail',_0x011c('0xeb'),{'account':_0x3e9483,'message':{'from':util['format'](_0x011c('0xec'),_0x5ae132['name'],_0x5ae132[_0x011c('0xed')]||_0x5ae132[_0x011c('0xe1')][_0x011c('0x5d')]),'to':_0x362c8a['forwardOfflineAddress'],'subject':_0x362c8a[_0x011c('0xee')],'html':_0x3f7224[_0x011c('0x5c')],'attachments':_0x28a609}},client9003)['then'](function(){return _0x3f7224;})[_0x011c('0x2a')](function(_0x3fa2e3){console[_0x011c('0x28')](_0x3fa2e3);});}})[_0x011c('0x21')](function(){if(_0x362c8a&&_0x362c8a[_0x011c('0xde')]&&_0x362c8a['MailAccountId']){var _0x3b654f=[];if(_0x241aa2['length']){_0x3b654f=_0x241aa2[_0x011c('0x3e')](function(_0xc9f5a1){return{'name':_0xc9f5a1[_0x011c('0xd9')],'basename':_0xc9f5a1['filename'],'type':_0xc9f5a1['mimetype'],'ChatOfflineMessageId':_0x31b16f['id']};});}var _0x253bfd;if(!_[_0x011c('0x7e')](_0x362c8a[_0x011c('0xef')])){var _0x485305=_['map'](_0x449108[_0x011c('0x5c')],function(_0x5e1134){return _0x5e1134;});var _0x1c4ff1=_['toPairsIn'](_0x485305)[0x0];var _0x51c162=_['mapValues'](_0x1c4ff1,function(_0x29bd93){return _0x29bd93;});_0x253bfd=_0x51c162[0x1][_0x362c8a[_0x011c('0xef')]];}var _0x39af93={'from':_0x5953e9[_0x011c('0xed')],'firstName':_0x5953e9[_0x011c('0xad')],'lastName':_0x5953e9[_0x011c('0xae')],'mapKey':_0x011c('0xed'),'message':{'from':_0x5953e9[_0x011c('0xed')],'to':_0x362c8a['MailAccount'][_0x011c('0xed')],'cc':'','subject':_[_0x011c('0x7e')](_0x253bfd)?_0x362c8a['offlineMessageSubject']:_0x253bfd,'messageId':'','sentAt':new Date(),'attach':_0x3b654f[_0x011c('0x49')],'attachments':_0x3b654f,'originChannel':_0x011c('0xf0'),'ChatWebsiteId':_0x362c8a['id'],'ChatOfflineMessageId':_0x3f7224['id'],'originTo':_0x362c8a[_0x011c('0xd0')]['email']},'body':_0x3f7224[_0x011c('0x5c')]};var _0x3fe1b7={'account':{'id':_0x362c8a['MailAccountId']},'body':_0x39af93,'log':_0x011c('0xf1')};return respondWithRpcPromise(_0x011c('0xf1'),_0x011c('0xf2'),_0x3fe1b7,client9001)[_0x011c('0x21')](function(){return _0x3f7224;})[_0x011c('0x2a')](function(_0x4245a6){console['error'](_0x4245a6);});}return;})[_0x011c('0x21')](function(){if(_0x3f7224){return _0x3f7224;}})[_0x011c('0x21')](respondWithResult(_0x204b5e,null))[_0x011c('0x2a')](function(_0x213237){console[_0x011c('0x28')](_0x011c('0x2a'),_0x213237);for(var _0x9b73cc of _0x241aa2){var _0x22f7fd=path[_0x011c('0x80')](config[_0x011c('0x81')],_0x011c('0xdb'),_0x011c('0xcd'),_0x011c('0xdc'),_0x011c('0xf3'),_0x9b73cc['filename']);fs_extra[_0x011c('0xf4')](_0x22f7fd)[_0x011c('0x2a')](function(_0x3f41ca){console[_0x011c('0x28')]('Could\x20not\x20remove\x20attachment\x20file',_0x22f7fd,_0x3f41ca);});}});};exports[_0x011c('0xf5')]=function(_0x3ebf9d,_0x242a0d,_0x82f605){return db[_0x011c('0xba')][_0x011c('0x5a')]({'where':{'id':_0x3ebf9d[_0x011c('0x59')]['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x242a0d,null))['then'](function(_0xdc0c98){if(_0xdc0c98){return _0xdc0c98[_0x011c('0xf5')](_0x3ebf9d[_0x011c('0x5c')][_0x011c('0x6b')],_[_0x011c('0xf6')](_0x3ebf9d['body'],[_0x011c('0x6b'),'id'])||{});}})[_0x011c('0x21')](respondWithResult(_0x242a0d,null))[_0x011c('0x2a')](handleError(_0x242a0d,null));};exports[_0x011c('0xf7')]=function(_0x276b20,_0x1d161e,_0x5e5ced){var _0x5ea521={'raw':![],'where':{}};var _0x3e0e18={};var _0x5aba94={'count':0x0,'rows':[]};return db[_0x011c('0x3f')][_0x011c('0x69')]({'where':{'id':_0x276b20[_0x011c('0x59')]['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x1d161e,null))[_0x011c('0x21')](function(_0x295e2f){if(_0x295e2f){_0x3e0e18['model']=_[_0x011c('0x44')](db['ChatInteraction'][_0x011c('0x40')]);_0x3e0e18[_0x011c('0x43')]=_[_0x011c('0x44')](_0x276b20[_0x011c('0x43')]);_0x3e0e18[_0x011c('0x45')]=_['intersection'](_0x3e0e18[_0x011c('0x42')],_0x3e0e18[_0x011c('0x43')]);_0x5ea521[_0x011c('0x47')]=_[_0x011c('0x46')](_0x3e0e18[_0x011c('0x42')],qs[_0x011c('0x48')](_0x276b20[_0x011c('0x43')][_0x011c('0x48')]));_0x5ea521[_0x011c('0x47')]=_0x5ea521[_0x011c('0x47')][_0x011c('0x49')]?_0x5ea521[_0x011c('0x47')]:_0x3e0e18[_0x011c('0x42')];if(!_0x276b20['query'][_0x011c('0x6f')](_0x011c('0x4a'))){_0x5ea521[_0x011c('0x31')]=qs[_0x011c('0x31')](_0x276b20[_0x011c('0x43')][_0x011c('0x31')]);_0x5ea521[_0x011c('0x2f')]=qs[_0x011c('0x2f')](_0x276b20['query']['offset']);}_0x5ea521[_0x011c('0x4b')]=qs[_0x011c('0x4c')](_0x276b20[_0x011c('0x43')][_0x011c('0x4c')]);_0x5ea521[_0x011c('0x4f')]=qs[_0x011c('0x45')](_['pick'](_0x276b20[_0x011c('0x43')],_0x3e0e18['filters']));_0x5ea521[_0x011c('0x4f')][_0x011c('0x66')]=_0x295e2f['id'];if(_0x276b20['query'][_0x011c('0x4e')]){_0x5ea521[_0x011c('0x4f')]=_['merge'](_0x5ea521[_0x011c('0x4f')],{'$or':_[_0x011c('0x3e')](_0x5ea521[_0x011c('0x47')],function(_0xecf338){var _0x2261f2={};_0x2261f2[_0xecf338]={'$like':'%'+_0x276b20[_0x011c('0x43')][_0x011c('0x4e')]+'%'};return _0x2261f2;})});}_0x5ea521=_[_0x011c('0x52')]({},_0x5ea521,_0x276b20[_0x011c('0x53')]);return db[_0x011c('0xba')]['count']({'where':_0x5ea521[_0x011c('0x4f')]})[_0x011c('0x21')](function(_0x409326){_0x5aba94[_0x011c('0x32')]=_0x409326;if(_0x276b20[_0x011c('0x43')][_0x011c('0x54')]){_0x5ea521['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x011c('0xf8')],'as':'Owner','attributes':[_0x011c('0x39'),_0x011c('0xf9'),_0x011c('0xfa')],'required':![]},{'model':db[_0x011c('0xfb')],'as':'Tags','attributes':['id',_0x011c('0x39'),_0x011c('0xfc')],'where':_0x276b20[_0x011c('0x43')][_0x011c('0xfd')]?{'id':_0x276b20[_0x011c('0x43')][_0x011c('0xfd')]}:undefined,'required':_0x276b20[_0x011c('0x43')]['tag']?!![]:![]}];}return db[_0x011c('0xba')]['findAll'](_0x5ea521);})[_0x011c('0x21')](function(_0x2e8ba6){_0x5aba94['rows']=_0x2e8ba6;return _0x5aba94;});}})['then'](respondWithFilteredResult(_0x1d161e,_0x5ea521))[_0x011c('0x2a')](handleError(_0x1d161e,null));};function iftimePromise(_0xe5b7cf,_0x486d54){return respondWithRpcPromise(_0x011c('0xfe'),_0x011c('0xff'),{'command':_0x486d54[_0x011c('0x100')]?util[_0x011c('0xb5')](_0x011c('0x101'),_0xe5b7cf[_0x011c('0x102')],_0x486d54['timezone']):util['format']('iftime\x20%s',_0xe5b7cf[_0x011c('0x102')])},client9002)['then'](function(_0x4f39b6){var _0x277429=_0x4f39b6&&_0x4f39b6['indexOf'](_0x011c('0x103'))>=0x0?!![]:![];logger[_0x011c('0x22')](_0x011c('0x104'),_0x486d54['id'],_0xe5b7cf['id'],_0xe5b7cf['interval'],_0x277429?_0x011c('0x105'):'OFFLINE',_0x486d54[_0x011c('0x100')]?_0x486d54['timezone']:_0x011c('0x106'));return _0x277429;})['catch'](function(_0x549eef){logger[_0x011c('0x28')](_0x011c('0x104'),_0x486d54['id'],_0xe5b7cf['id'],_0xe5b7cf[_0x011c('0x102')],util[_0x011c('0x107')](_0x549eef,{'showHidden':![],'depth':null}),_0x486d54['timezone']?_0x486d54[_0x011c('0x100')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0xbc6117,_0x40c9aa,_0x422173){var _0x252c2b=0x0;var _0x3c310d=0x0;var _0x1c00d4=![];var _0x417024;var _0x254adb;return db[_0x011c('0x3f')]['find']({'where':{'id':_0xbc6117['params']['id']},'include':[{'model':db[_0x011c('0x108')],'as':'Interval','include':[{'model':db[_0x011c('0x108')],'as':'Intervals','attributes':['id',_0x011c('0x102')],'raw':!![]}]}]})[_0x011c('0x21')](handleEntityNotFound(_0x40c9aa,null))[_0x011c('0x21')](function(_0x588649){if(_0x588649){_0x417024=_0x588649;return _0x588649[_0x011c('0x109')]({'raw':!![]});}})['then'](function(_0x60c983){if(_0x417024){if(_0x60c983){_0x254adb=_0x60c983;}}return require('../../config/license/util')[_0x011c('0x7d')]();})[_0x011c('0x21')](function(_0xf558c3){if(_0xf558c3){_0x3c310d=_0xf558c3[_0x011c('0x10a')];_0x1c00d4=_0xf558c3['custom'];}})[_0x011c('0x21')](function(){return db[_0x011c('0xba')][_0x011c('0x32')]({'where':{'closed':![]}});})[_0x011c('0x21')](function(_0x6a9bbc){_0x252c2b=_0x6a9bbc;if(_0x3c310d&&_0x6a9bbc>_0x3c310d){return db[_0x011c('0x10b')][_0x011c('0x69')]({'where':{'id':0x1}})[_0x011c('0x21')](function(_0xd1b784){if(_0xd1b784){_0xd1b784['increment']('chatLicenseExceeded');}});}})[_0x011c('0x21')](function(){if(_0x417024[_0x011c('0x108')]&&_0x417024[_0x011c('0x108')]['Intervals']){var _0x22dd5a=[];for(var _0x5a8da6=0x0;_0x5a8da6<_0x417024[_0x011c('0x108')][_0x011c('0x10c')]['length'];_0x5a8da6++){var _0x17873a=_0x417024[_0x011c('0x108')]['Intervals'][_0x5a8da6]['get']({'plain':!![]});_0x22dd5a[_0x011c('0xc0')](iftimePromise(_0x17873a,_0x417024));}return BPromise[_0x011c('0x10d')](_0x22dd5a)[_0x011c('0x21')](function(_0xe8edca){return _['some'](_0xe8edca);});}else{return!![];}})[_0x011c('0x21')](function(_0x35be99){var _0x20e587=fs[_0x011c('0xd2')](path[_0x011c('0x80')](config['root'],_0x011c('0x10e')),_0x011c('0xd4'));var _0x18ad97={'remote':_0x417024[_0x011c('0x10f')],'query':querystring[_0x011c('0x27')](_[_0x011c('0x52')](_0x417024['get']({'plain':!![]}),{'customerIp':_0xbc6117[_0x011c('0x8f')][_0x011c('0xab')]||_0xbc6117['headers'][_0x011c('0x110')]||_0xbc6117[_0x011c('0x111')][_0x011c('0x112')]||_0xbc6117['ip'],'referer':_0xbc6117[_0x011c('0x8f')][_0x011c('0xb0')],'openedInteractions':_0x252c2b,'maxInteractions':_0x3c310d,'virtual':_0x1c00d4['virtual'],'online':_0x35be99,'custom':_0x1c00d4}))[_0x011c('0x113')](/'/g,'\x5c\x27')};_0x40c9aa['send'](ejs[_0x011c('0xd5')](Mustache[_0x011c('0xd5')](_0x20e587,_0x18ad97),{'proactiveActions':_0x254adb,'alignment':_0x417024[_0x011c('0x114')],'verticalAlignment':_0x417024['verticalAlignment'],'div_color':_0x417024[_0x011c('0xfc')],'text_color':_0x417024[_0x011c('0x115')],'button_color':_0x417024['color_button'],'background_color':_0x417024[_0x011c('0x116')]}));})['catch'](handleError(_0x40c9aa,null));};exports[_0x011c('0x117')]=function(_0x57642d,_0x505588,_0x13b57f){return db[_0x011c('0x3f')]['findOne']({'where':{'id':_0x57642d[_0x011c('0x59')]['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x505588,null))['then'](function(_0x49111e){if(_0x49111e){return db['sequelize'][_0x011c('0xe0')](function(_0x102432){return db[_0x011c('0xa3')][_0x011c('0x36')]({'where':{'ChatWebsiteId':_0x57642d['params']['id']},'transaction':_0x102432})['then'](function(_0x29c5e8){var _0x497b4e=_[_0x011c('0x3e')](_0x57642d[_0x011c('0x5c')],function(_0x38067f){_0x38067f[_0x011c('0x66')]=_0x57642d[_0x011c('0x59')]['id'];return _0x38067f;});return db[_0x011c('0xa3')][_0x011c('0x118')](_0x497b4e,{'transaction':_0x102432});});})[_0x011c('0x21')](function(){return db[_0x011c('0xa3')][_0x011c('0x119')]({'where':{'ChatWebsiteId':_0x57642d[_0x011c('0x59')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x505588,null))[_0x011c('0x2a')](handleError(_0x505588,null));};exports[_0x011c('0x11a')]=function(_0xf9a53,_0x442d80,_0x9e4c12){var _0x371010={};var _0x3d6666={};var _0x6fc954;var _0x364a6a;return db[_0x011c('0x3f')][_0x011c('0x69')]({'where':{'id':_0xf9a53[_0x011c('0x59')]['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x442d80,null))[_0x011c('0x21')](function(_0x1f311a){if(_0x1f311a){_0x6fc954=_0x1f311a;_0x3d6666[_0x011c('0x42')]=_['keys'](db[_0x011c('0xa3')][_0x011c('0x40')]);_0x3d6666[_0x011c('0x43')]=_['keys'](_0xf9a53[_0x011c('0x43')]);_0x3d6666[_0x011c('0x45')]=_[_0x011c('0x46')](_0x3d6666[_0x011c('0x42')],_0x3d6666[_0x011c('0x43')]);_0x371010[_0x011c('0x47')]=_[_0x011c('0x46')](_0x3d6666[_0x011c('0x42')],qs['fields'](_0xf9a53[_0x011c('0x43')][_0x011c('0x48')]));_0x371010[_0x011c('0x47')]=_0x371010[_0x011c('0x47')][_0x011c('0x49')]?_0x371010[_0x011c('0x47')]:_0x3d6666['model'];_0x371010['order']=qs['sort'](_0xf9a53['query'][_0x011c('0x4c')]);_0x371010[_0x011c('0x4f')]=qs[_0x011c('0x45')](_[_0x011c('0x4d')](_0xf9a53[_0x011c('0x43')],_0x3d6666['filters']));if(_0xf9a53['query'][_0x011c('0x4e')]){_0x371010['where']=_[_0x011c('0x52')](_0x371010[_0x011c('0x4f')],{'$or':_['map'](_0x371010[_0x011c('0x47')],function(_0x251579){var _0xf9d568={};_0xf9d568[_0x251579]={'$like':'%'+_0xf9a53['query']['filter']+'%'};return _0xf9d568;})});}_0x371010=_[_0x011c('0x52')]({},_0x371010,_0xf9a53['options']);return _0x6fc954[_0x011c('0x11a')](_0x371010);}})[_0x011c('0x21')](function(_0x30b729){if(_0x30b729){_0x364a6a=_0x30b729[_0x011c('0x49')];if(!_0xf9a53[_0x011c('0x43')][_0x011c('0x6f')](_0x011c('0x4a'))){_0x371010['limit']=qs[_0x011c('0x31')](_0xf9a53[_0x011c('0x43')]['limit']);_0x371010[_0x011c('0x2f')]=qs['offset'](_0xf9a53['query'][_0x011c('0x2f')]);}return _0x6fc954['getApplications'](_0x371010);}})[_0x011c('0x21')](function(_0x549579){if(_0x549579){return _0x549579?{'count':_0x364a6a,'rows':_0x549579}:null;}})['then'](respondWithResult(_0x442d80,null))[_0x011c('0x2a')](handleError(_0x442d80,null));};exports['addProactiveActions']=function(_0x18fb2e,_0x5ce486,_0x38d9bf){return db[_0x011c('0x11b')]['find']({'where':{'id':_0x18fb2e[_0x011c('0x59')]['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x5ce486,null))[_0x011c('0x21')](function(_0x103385){if(_0x103385){return _0x103385['addProactiveActions'](_0x18fb2e[_0x011c('0x5c')][_0x011c('0x6b')],_[_0x011c('0xf6')](_0x18fb2e[_0x011c('0x5c')],['ids','id'])||{});}})[_0x011c('0x21')](respondWithResult(_0x5ce486,null))[_0x011c('0x2a')](handleError(_0x5ce486,null));};exports[_0x011c('0x109')]=function(_0x411344,_0x1241df,_0x55095d){var _0x1e7cef={};var _0x337f5c={};var _0x2a48df;var _0x9192fb;return db[_0x011c('0x3f')][_0x011c('0x69')]({'where':{'id':_0x411344['params']['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x1241df,null))['then'](function(_0xe6775f){if(_0xe6775f){_0x2a48df=_0xe6775f;_0x337f5c[_0x011c('0x42')]=_[_0x011c('0x44')](db[_0x011c('0x11c')][_0x011c('0x40')]);_0x337f5c[_0x011c('0x43')]=_[_0x011c('0x44')](_0x411344[_0x011c('0x43')]);_0x337f5c['filters']=_[_0x011c('0x46')](_0x337f5c[_0x011c('0x42')],_0x337f5c[_0x011c('0x43')]);_0x1e7cef['attributes']=_[_0x011c('0x46')](_0x337f5c[_0x011c('0x42')],qs[_0x011c('0x48')](_0x411344[_0x011c('0x43')][_0x011c('0x48')]));_0x1e7cef[_0x011c('0x47')]=_0x1e7cef[_0x011c('0x47')][_0x011c('0x49')]?_0x1e7cef[_0x011c('0x47')]:_0x337f5c[_0x011c('0x42')];_0x1e7cef[_0x011c('0x4b')]=qs[_0x011c('0x4c')](_0x411344[_0x011c('0x43')]['sort']);_0x1e7cef['where']=qs[_0x011c('0x45')](_[_0x011c('0x4d')](_0x411344[_0x011c('0x43')],_0x337f5c['filters']));if(_0x411344['query'][_0x011c('0x4e')]){_0x1e7cef[_0x011c('0x4f')]=_[_0x011c('0x52')](_0x1e7cef[_0x011c('0x4f')],{'$or':_[_0x011c('0x3e')](_0x1e7cef[_0x011c('0x47')],function(_0x52d876){var _0x1f1189={};_0x1f1189[_0x52d876]={'$like':'%'+_0x411344[_0x011c('0x43')][_0x011c('0x4e')]+'%'};return _0x1f1189;})});}_0x1e7cef=_[_0x011c('0x52')]({},_0x1e7cef,_0x411344['options']);return _0x2a48df[_0x011c('0x109')](_0x1e7cef);}})['then'](function(_0x5b7eb3){if(_0x5b7eb3){_0x9192fb=_0x5b7eb3[_0x011c('0x49')];if(!_0x411344[_0x011c('0x43')][_0x011c('0x6f')](_0x011c('0x4a'))){_0x1e7cef[_0x011c('0x31')]=qs['limit'](_0x411344['query'][_0x011c('0x31')]);_0x1e7cef[_0x011c('0x2f')]=qs[_0x011c('0x2f')](_0x411344[_0x011c('0x43')][_0x011c('0x2f')]);}return _0x2a48df[_0x011c('0x109')](_0x1e7cef);}})['then'](function(_0x54c88c){if(_0x54c88c){return _0x54c88c?{'count':_0x9192fb,'rows':_0x54c88c}:null;}})[_0x011c('0x21')](respondWithResult(_0x1241df,null))[_0x011c('0x2a')](handleError(_0x1241df,null));};exports[_0x011c('0x11d')]=function(_0x3dadd3,_0x81f767,_0x5c400e){var _0x1b64a3=_0x3dadd3['query']['online']===_0x011c('0x11e')?_0x011c('0x11f'):_0x011c('0x120');return db[_0x011c('0x3f')][_0x011c('0x5a')]({'attributes':['id',_0x1b64a3],'where':{'id':_0x3dadd3['params']['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x81f767,null))[_0x011c('0x21')](function(_0x63f84f){if(_0x63f84f){var _0x4a4d62=_0x63f84f[_0x1b64a3];var _0x49e375=_0x4a4d62&&_0x4a4d62[_0x011c('0x121')]?_0x4a4d62[_0x011c('0x121')]:[];_0x81f767['send']({'fromKey':_[_0x011c('0x7e')](_0x4a4d62[_0x011c('0x122')])?undefined:_0x4a4d62[_0x011c('0x122')],'count':_0x49e375[_0x011c('0x49')],'rows':_0x49e375});}})[_0x011c('0x2a')](handleError(_0x81f767,null));};exports[_0x011c('0x123')]=function(_0x1353ba,_0x45fb54,_0x5f1dff){var _0x582228={'raw':![],'where':{}};var _0x2c182e={};var _0xbd28b={'count':0x0,'rows':[]};return db[_0x011c('0x3f')][_0x011c('0x69')]({'where':{'id':_0x1353ba[_0x011c('0x59')]['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x45fb54,null))[_0x011c('0x21')](function(_0x60a402){if(_0x60a402){_0x2c182e[_0x011c('0x42')]=_[_0x011c('0x44')](db[_0x011c('0xd8')][_0x011c('0x40')]);_0x2c182e[_0x011c('0x43')]=_[_0x011c('0x44')](_0x1353ba['query']);_0x2c182e[_0x011c('0x45')]=_[_0x011c('0x46')](_0x2c182e[_0x011c('0x42')],_0x2c182e[_0x011c('0x43')]);_0x582228[_0x011c('0x47')]=_[_0x011c('0x46')](_0x2c182e['model'],qs[_0x011c('0x48')](_0x1353ba['query']['fields']));_0x582228[_0x011c('0x47')]=_0x582228['attributes'][_0x011c('0x49')]?_0x582228[_0x011c('0x47')]:_0x2c182e[_0x011c('0x42')];if(!_0x1353ba['query'][_0x011c('0x6f')]('nolimit')){_0x582228[_0x011c('0x31')]=qs['limit'](_0x1353ba[_0x011c('0x43')][_0x011c('0x31')]);_0x582228[_0x011c('0x2f')]=qs[_0x011c('0x2f')](_0x1353ba[_0x011c('0x43')]['offset']);}_0x582228[_0x011c('0x4b')]=qs[_0x011c('0x4c')](_0x1353ba['query'][_0x011c('0x4c')]);_0x582228['where']=qs[_0x011c('0x45')](_[_0x011c('0x4d')](_0x1353ba[_0x011c('0x43')],_0x2c182e[_0x011c('0x45')]));_0x582228[_0x011c('0x4f')][_0x011c('0x66')]=_0x60a402['id'];if(_0x1353ba[_0x011c('0x43')][_0x011c('0x4e')]){_0x582228[_0x011c('0x4f')]=_[_0x011c('0x52')](_0x582228[_0x011c('0x4f')],{'$or':_[_0x011c('0x3e')](_0x582228[_0x011c('0x47')],function(_0x39047a){var _0x5acd7e={};_0x5acd7e[_0x39047a]={'$like':'%'+_0x1353ba[_0x011c('0x43')][_0x011c('0x4e')]+'%'};return _0x5acd7e;})});}_0x582228=_[_0x011c('0x52')]({},_0x582228,_0x1353ba['options']);return db[_0x011c('0xd8')][_0x011c('0x32')]({'where':_0x582228['where']})[_0x011c('0x21')](function(_0x1d48b7){_0xbd28b[_0x011c('0x32')]=_0x1d48b7;if(_0x1353ba[_0x011c('0x43')][_0x011c('0x54')]){_0x582228[_0x011c('0x55')]=[{'all':!![]}];}else{_0x582228['include']=[{'model':db[_0x011c('0x92')],'as':_0x011c('0x124'),'required':![]},{'model':db[_0x011c('0x125')],'as':'Attachments','required':![]}];}return db[_0x011c('0xd8')]['findAll'](_0x582228);})['then'](function(_0x10b128){_0xbd28b[_0x011c('0x57')]=_0x10b128;return _0xbd28b;});}})['then'](respondWithFilteredResult(_0x45fb54,_0x582228))[_0x011c('0x2a')](handleError(_0x45fb54,null));};exports[_0x011c('0x126')]=function(_0x1e7d9c,_0x4b716e,_0x1c2bd2){return db[_0x011c('0x3f')]['find']({'where':{'id':_0x1e7d9c['params']['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x4b716e,null))[_0x011c('0x21')](function(_0x2c1d85){if(_0x2c1d85){return _0x2c1d85[_0x011c('0x126')](_0x1e7d9c[_0x011c('0x5c')][_0x011c('0x6b')],_[_0x011c('0xf6')](_0x1e7d9c['body'],[_0x011c('0x6b'),'id'])||{})[_0x011c('0xd1')](function(_0x63c9b7){for(var _0x4e9df9=0x0;_0x4e9df9<_0x1e7d9c['body'][_0x011c('0x6b')]['length'];_0x4e9df9+=0x1){socket[_0x011c('0x127')](_0x011c('0x128'),{'UserId':Number(_0x1e7d9c[_0x011c('0x5c')][_0x011c('0x6b')][_0x4e9df9]),'ChatWebsiteId':Number(_0x1e7d9c['params']['id'])});}return _0x63c9b7;});}})['then'](respondWithResult(_0x4b716e,null))[_0x011c('0x2a')](handleError(_0x4b716e,null));};exports['removeAgents']=function(_0x2aa631,_0x2b2538,_0x283e2d){return db[_0x011c('0x3f')][_0x011c('0x5a')]({'where':{'id':_0x2aa631[_0x011c('0x59')]['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x2b2538,null))[_0x011c('0x21')](function(_0x301692){if(_0x301692){return _0x301692['removeAgents'](_0x2aa631[_0x011c('0x43')][_0x011c('0x6b')])[_0x011c('0x21')](function(){if(_[_0x011c('0x129')](_0x2aa631[_0x011c('0x43')]['ids'])){for(var _0x34a5de=0x0;_0x34a5de<_0x2aa631['query'][_0x011c('0x6b')][_0x011c('0x49')];_0x34a5de+=0x1){socket[_0x011c('0x127')](_0x011c('0x12a'),{'UserId':Number(_0x2aa631[_0x011c('0x43')][_0x011c('0x6b')][_0x34a5de]),'ChatWebsiteId':Number(_0x2aa631[_0x011c('0x59')]['id'])});}}else{socket[_0x011c('0x127')](_0x011c('0x12a'),{'UserId':Number(_0x2aa631[_0x011c('0x43')][_0x011c('0x6b')]),'ChatWebsiteId':Number(_0x2aa631['params']['id'])});}});}})[_0x011c('0x21')](respondWithStatusCode(_0x2b2538,null))[_0x011c('0x2a')](handleError(_0x2b2538,null));};exports[_0x011c('0x12b')]=function(_0x395278,_0x14a6d8,_0x4beff2){var _0x5eac0d={};var _0x1b3dfc={};var _0x12fbeb;var _0x123369;return db[_0x011c('0x3f')][_0x011c('0x69')]({'where':{'id':_0x395278[_0x011c('0x59')]['id']}})[_0x011c('0x21')](handleEntityNotFound(_0x14a6d8,null))['then'](function(_0x58f14d){if(_0x58f14d){_0x12fbeb=_0x58f14d;_0x1b3dfc['model']=_[_0x011c('0x44')](db[_0x011c('0xf8')][_0x011c('0x40')]);_0x1b3dfc[_0x011c('0x43')]=_[_0x011c('0x44')](_0x395278[_0x011c('0x43')]);_0x1b3dfc[_0x011c('0x45')]=_['intersection'](_0x1b3dfc['model'],_0x1b3dfc[_0x011c('0x43')]);_0x5eac0d[_0x011c('0x47')]=_[_0x011c('0x46')](_0x1b3dfc[_0x011c('0x42')],qs[_0x011c('0x48')](_0x395278['query'][_0x011c('0x48')]));_0x5eac0d['attributes']=_0x5eac0d[_0x011c('0x47')]['length']?_0x5eac0d[_0x011c('0x47')]:_0x1b3dfc[_0x011c('0x42')];_0x5eac0d['order']=qs[_0x011c('0x4c')](_0x395278[_0x011c('0x43')][_0x011c('0x4c')]);_0x5eac0d[_0x011c('0x4f')]=qs['filters'](_[_0x011c('0x4d')](_0x395278[_0x011c('0x43')],_0x1b3dfc[_0x011c('0x45')]));if(_0x395278[_0x011c('0x43')][_0x011c('0x4e')]){_0x5eac0d[_0x011c('0x4f')]=_[_0x011c('0x52')](_0x5eac0d[_0x011c('0x4f')],{'$or':_[_0x011c('0x3e')](_0x5eac0d[_0x011c('0x47')],function(_0xa52241){var _0x419a3a={};_0x419a3a[_0xa52241]={'$like':'%'+_0x395278[_0x011c('0x43')][_0x011c('0x4e')]+'%'};return _0x419a3a;})});}_0x5eac0d=_[_0x011c('0x52')]({},_0x5eac0d,_0x395278['options']);return _0x12fbeb[_0x011c('0x12b')](_0x5eac0d);}})[_0x011c('0x21')](function(_0x4e6dd7){if(_0x4e6dd7){_0x123369=_0x4e6dd7['length'];if(!_0x395278[_0x011c('0x43')][_0x011c('0x6f')](_0x011c('0x4a'))){_0x5eac0d[_0x011c('0x31')]=qs['limit'](_0x395278[_0x011c('0x43')]['limit']);_0x5eac0d[_0x011c('0x2f')]=qs[_0x011c('0x2f')](_0x395278[_0x011c('0x43')][_0x011c('0x2f')]);}return _0x12fbeb[_0x011c('0x12b')](_0x5eac0d);}})[_0x011c('0x21')](function(_0x461d11){if(_0x461d11){return _0x461d11?{'count':_0x123369,'rows':_0x461d11}:null;}})[_0x011c('0x21')](respondWithResult(_0x14a6d8,null))['catch'](handleError(_0x14a6d8,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 807c312..0b39b62 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 _0x3468=['emit','hook','exports','events','setMaxListeners','remove'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0x3468,0x8d));var _0x8346=function(_0x32a043,_0x308531){_0x32a043=_0x32a043-0x0;var _0x2e1c32=_0x3468[_0x32a043];return _0x2e1c32;};'use strict';var EventEmitter=require(_0x8346('0x0'));var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8346('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8346('0x2')};function emitEvent(_0x1a7eb9){return function(_0x4082b5,_0x5a5f46,_0x491dd9){ChatWebsiteEvents['emit'](_0x1a7eb9+':'+_0x4082b5['id'],_0x4082b5);ChatWebsiteEvents[_0x8346('0x3')](_0x1a7eb9,_0x4082b5);_0x491dd9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x8346('0x4')](e,emitEvent(event));}}module[_0x8346('0x5')]=ChatWebsiteEvents; \ No newline at end of file +var _0x0c29=['save','update','remove','emit','hasOwnProperty','hook','exports','ChatWebsite'];(function(_0x13c81f,_0x34cefc){var _0x4cb3aa=function(_0x3ab366){while(--_0x3ab366){_0x13c81f['push'](_0x13c81f['shift']());}};_0x4cb3aa(++_0x34cefc);}(_0x0c29,0xb7));var _0x90c2=function(_0x33975c,_0x50d085){_0x33975c=_0x33975c-0x0;var _0x1c15ab=_0x0c29[_0x33975c];return _0x1c15ab;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0x90c2('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x90c2('0x1'),'afterUpdate':_0x90c2('0x2'),'afterDestroy':_0x90c2('0x3')};function emitEvent(_0x59a229){return function(_0x4a0464,_0x262121,_0x432049){ChatWebsiteEvents[_0x90c2('0x4')](_0x59a229+':'+_0x4a0464['id'],_0x4a0464);ChatWebsiteEvents[_0x90c2('0x4')](_0x59a229,_0x4a0464);_0x432049(null);};}for(var e in events){if(events[_0x90c2('0x5')](e)){var event=events[e];ChatWebsite[_0x90c2('0x6')](e,emitEvent(event));}}module[_0x90c2('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 74452ca..07031a0 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 _0xe610=['define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatWebsite.attributes'];(function(_0x906cb9,_0x4dd6e3){var _0x358030=function(_0x1ea50d){while(--_0x1ea50d){_0x906cb9['push'](_0x906cb9['shift']());}};_0x358030(++_0x4dd6e3);}(_0xe610,0x1e4));var _0x0e61=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe610[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x0e61('0x0'));var util=require(_0x0e61('0x1'));var logger=require(_0x0e61('0x2'))(_0x0e61('0x3'));var moment=require(_0x0e61('0x4'));var BPromise=require(_0x0e61('0x5'));var rp=require(_0x0e61('0x6'));var fs=require('fs');var path=require(_0x0e61('0x7'));var rimraf=require(_0x0e61('0x8'));var config=require('../../config/environment');var attributes=require(_0x0e61('0x9'));module['exports']=function(_0x2299fb,_0x161c69){return _0x2299fb[_0x0e61('0xa')](_0x0e61('0xb'),attributes,{'tableName':_0x0e61('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21c2=['moment','bluebird','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','api'];(function(_0x124708,_0x20063c){var _0x4795cc=function(_0x427649){while(--_0x427649){_0x124708['push'](_0x124708['shift']());}};_0x4795cc(++_0x20063c);}(_0x21c2,0x1e9));var _0x221c=function(_0x3ef8ad,_0x278994){_0x3ef8ad=_0x3ef8ad-0x0;var _0x205616=_0x21c2[_0x3ef8ad];return _0x205616;};'use strict';var _=require(_0x221c('0x0'));var util=require(_0x221c('0x1'));var logger=require('../../config/logger')(_0x221c('0x2'));var moment=require(_0x221c('0x3'));var BPromise=require(_0x221c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x221c('0x5'));var config=require(_0x221c('0x6'));var attributes=require(_0x221c('0x7'));module[_0x221c('0x8')]=function(_0x5aa072,_0x4f2805){return _0x5aa072[_0x221c('0x9')](_0x221c('0xa'),attributes,{'tableName':_0x221c('0xb'),'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 64b0d4a..164daa5 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 _0x555c=['request\x20sent','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s'];(function(_0x1c10ed,_0xe343ac){var _0x42322a=function(_0x5e80c2){while(--_0x5e80c2){_0x1c10ed['push'](_0x1c10ed['shift']());}};_0x42322a(++_0xe343ac);}(_0x555c,0x158));var _0xc555=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x555c[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require('lodash');var util=require(_0xc555('0x0'));var moment=require(_0xc555('0x1'));var BPromise=require(_0xc555('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc555('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc555('0x4'));var logger=require(_0xc555('0x5'))(_0xc555('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc555('0x7')]['http']({'port':0x232a});config[_0xc555('0x8')]=_[_0xc555('0x9')](config['redis'],{'host':_0xc555('0xa'),'port':0x18eb});var socket=require(_0xc555('0xb'))(new Redis(config[_0xc555('0x8')]));require(_0xc555('0xc'))[_0xc555('0xd')](socket);function respondWithRpcPromise(_0x25921c,_0x2e88c1,_0x4083ed){return new BPromise(function(_0x51174f,_0x51b6c5){return client[_0xc555('0xe')](_0x25921c,_0x4083ed)[_0xc555('0xf')](function(_0x135f12){logger[_0xc555('0x10')](_0xc555('0x11'),_0x2e88c1,'request\x20sent');logger[_0xc555('0x12')](_0xc555('0x13'),_0x2e88c1,_0xc555('0x14'),JSON['stringify'](_0x135f12));if(_0x135f12[_0xc555('0x15')]){if(_0x135f12[_0xc555('0x15')][_0xc555('0x16')]===0x1f4){logger[_0xc555('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x2e88c1,_0x135f12['error'][_0xc555('0x17')]);return _0x51b6c5(_0x135f12[_0xc555('0x15')][_0xc555('0x17')]);}logger[_0xc555('0x15')](_0xc555('0x11'),_0x2e88c1,_0x135f12[_0xc555('0x15')][_0xc555('0x17')]);return _0x51174f(_0x135f12[_0xc555('0x15')][_0xc555('0x17')]);}else{logger[_0xc555('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x2e88c1,_0xc555('0x14'));_0x51174f(_0x135f12[_0xc555('0x18')][_0xc555('0x17')]);}})[_0xc555('0x19')](function(_0x2ea289){logger['error'](_0xc555('0x11'),_0x2e88c1,_0x2ea289);_0x51b6c5(_0x2ea289);});});} \ No newline at end of file +var _0x50f2=['redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3a66d5,_0x15c20d){var _0x349a1c=function(_0xbca993){while(--_0xbca993){_0x3a66d5['push'](_0x3a66d5['shift']());}};_0x349a1c(++_0x15c20d);}(_0x50f2,0xdd));var _0x250f=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x50f2[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x250f('0x0'));var BPromise=require(_0x250f('0x1'));var rs=require(_0x250f('0x2'));var fs=require('fs');var Redis=require(_0x250f('0x3'));var db=require(_0x250f('0x4'))['db'];var utils=require(_0x250f('0x5'));var logger=require(_0x250f('0x6'))('rpc');var config=require(_0x250f('0x7'));var jayson=require(_0x250f('0x8'));var client=jayson[_0x250f('0x9')][_0x250f('0xa')]({'port':0x232a});config[_0x250f('0xb')]=_[_0x250f('0xc')](config[_0x250f('0xb')],{'host':_0x250f('0xd'),'port':0x18eb});var socket=require(_0x250f('0xe'))(new Redis(config[_0x250f('0xb')]));require(_0x250f('0xf'))[_0x250f('0x10')](socket);function respondWithRpcPromise(_0x10aeee,_0x433b45,_0x232aad){return new BPromise(function(_0xcba92d,_0x36e69c){return client[_0x250f('0x11')](_0x10aeee,_0x232aad)[_0x250f('0x12')](function(_0x563643){logger[_0x250f('0x13')](_0x250f('0x14'),_0x433b45,'request\x20sent');logger[_0x250f('0x15')](_0x250f('0x16'),_0x433b45,'request\x20sent',JSON[_0x250f('0x17')](_0x563643));if(_0x563643['error']){if(_0x563643[_0x250f('0x18')][_0x250f('0x19')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x433b45,_0x563643[_0x250f('0x18')][_0x250f('0x1a')]);return _0x36e69c(_0x563643['error'][_0x250f('0x1a')]);}logger[_0x250f('0x18')](_0x250f('0x14'),_0x433b45,_0x563643[_0x250f('0x18')][_0x250f('0x1a')]);return _0xcba92d(_0x563643[_0x250f('0x18')]['message']);}else{logger['info'](_0x250f('0x14'),_0x433b45,_0x250f('0x1b'));_0xcba92d(_0x563643[_0x250f('0x1c')][_0x250f('0x1a')]);}})['catch'](function(_0x305d0d){logger[_0x250f('0x18')](_0x250f('0x14'),_0x433b45,_0x305d0d);_0x36e69c(_0x305d0d);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 2182b65..3d7f6d9 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 _0xa6a5=['emit','register','length','chatWebsite:','./chatWebsite.events','save','update'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0xa6a5,0xf2));var _0x5a6a=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa6a5[_0x25bea7];return _0x175952;};'use strict';var ChatWebsiteEvents=require(_0x5a6a('0x0'));var events=[_0x5a6a('0x1'),'remove',_0x5a6a('0x2')];function createListener(_0x4b827c,_0x4f5ee4){return function(_0x5d09da){_0x4f5ee4[_0x5a6a('0x3')](_0x4b827c,_0x5d09da);};}function removeListener(_0x595257,_0x494cdd){return function(){ChatWebsiteEvents['removeListener'](_0x595257,_0x494cdd);};}exports[_0x5a6a('0x4')]=function(_0x5ccf28){for(var _0x10ca86=0x0,_0x4509a9=events[_0x5a6a('0x5')];_0x10ca86<_0x4509a9;_0x10ca86++){var _0x332df6=events[_0x10ca86];var _0x2e6362=createListener(_0x5a6a('0x6')+_0x332df6,_0x5ccf28);ChatWebsiteEvents['on'](_0x332df6,_0x2e6362);}}; \ No newline at end of file +var _0x1836=['remove','update','emit','register','length','chatWebsite:'];(function(_0x196e9f,_0x395fbf){var _0x4f8513=function(_0x55d6a4){while(--_0x55d6a4){_0x196e9f['push'](_0x196e9f['shift']());}};_0x4f8513(++_0x395fbf);}(_0x1836,0x102));var _0x6183=function(_0x2fdd6b,_0x45540c){_0x2fdd6b=_0x2fdd6b-0x0;var _0x5e4861=_0x1836[_0x2fdd6b];return _0x5e4861;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save',_0x6183('0x0'),_0x6183('0x1')];function createListener(_0x5bdb0a,_0x2a2cc2){return function(_0x5cad2d){_0x2a2cc2[_0x6183('0x2')](_0x5bdb0a,_0x5cad2d);};}function removeListener(_0x4da5e5,_0x40e7c8){return function(){ChatWebsiteEvents['removeListener'](_0x4da5e5,_0x40e7c8);};}exports[_0x6183('0x3')]=function(_0x144b3e){for(var _0x5db323=0x0,_0x5c6a3b=events[_0x6183('0x4')];_0x5db323<_0x5c6a3b;_0x5db323++){var _0x17b7e8=events[_0x5db323];var _0xbaf56e=createListener(_0x6183('0x5')+_0x17b7e8,_0x144b3e);ChatWebsiteEvents['on'](_0x17b7e8,_0xbaf56e);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index f54157a..6ab96df 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 _0xd31e=['/:id/offline','any','addInteraction','addApplications','addProactiveActions','update','delete','removeDispositions','removeAnswers','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','diskStorage','root','server/files/images/logos/','format','%s-%s','originalname','/:id/logo','single','file','addLogo','join','server/files/images/avatars/','now','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir'];(function(_0x36f284,_0x24cbd1){var _0x4ea099=function(_0xea729e){while(--_0xea729e){_0x36f284['push'](_0x36f284['shift']());}};_0x4ea099(++_0x24cbd1);}(_0xd31e,0x140));var _0xed31=function(_0x3a2d02,_0x9a42b4){_0x3a2d02=_0x3a2d02-0x0;var _0x1fae59=_0xd31e[_0x3a2d02];return _0x1fae59;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xed31('0x0'));var timeout=require(_0xed31('0x1'));var express=require(_0xed31('0x2'));var router=express['Router']();var fs_extra=require(_0xed31('0x3'));var auth=require(_0xed31('0x4'));var interaction=require(_0xed31('0x5'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0xed31('0x6')]('/',auth[_0xed31('0x7')](),controller['index']);router[_0xed31('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xed31('0x8')]);router[_0xed31('0x6')](_0xed31('0x9'),auth[_0xed31('0x7')](),controller['show']);router['get'](_0xed31('0xa'),auth[_0xed31('0x7')](),controller[_0xed31('0xb')]);router['get'](_0xed31('0xc'),auth[_0xed31('0x7')](),controller[_0xed31('0xd')]);router[_0xed31('0x6')]('/:id/logo',controller[_0xed31('0xe')]);router[_0xed31('0x6')]('/:id/avatar',controller['getAvatar']);router[_0xed31('0x6')](_0xed31('0xf'),controller['getCustomerAvatar']);router['get'](_0xed31('0x10'),controller[_0xed31('0x11')]);router[_0xed31('0x6')](_0xed31('0x12'),auth[_0xed31('0x7')](),controller[_0xed31('0x13')]);router['get'](_0xed31('0x14'),controller[_0xed31('0x15')]);router[_0xed31('0x6')](_0xed31('0x16'),auth[_0xed31('0x7')](),controller[_0xed31('0x17')]);router['get'](_0xed31('0x18'),auth[_0xed31('0x7')](),controller['getProactiveActions']);router[_0xed31('0x6')](_0xed31('0x19'),controller[_0xed31('0x1a')]);router['get'](_0xed31('0x1b'),auth[_0xed31('0x7')](),controller[_0xed31('0x1c')]);router['get'](_0xed31('0x1d'),auth[_0xed31('0x7')](),controller[_0xed31('0x1e')]);router['post']('/',auth[_0xed31('0x7')](),controller['create']);router[_0xed31('0x1f')](_0xed31('0xa'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xed31('0x1f')](_0xed31('0xc'),auth[_0xed31('0x7')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xed31('0x20')]({'destination':function(_0x4f2b37,_0x213b53,_0x556485){_0x556485(null,path['join'](config[_0xed31('0x21')],_0xed31('0x22')));},'filename':function(_0x560662,_0x368015,_0x5c6729){_0x5c6729(null,util[_0xed31('0x23')](_0xed31('0x24'),Date['now'](),_0x368015[_0xed31('0x25')]));}})});router[_0xed31('0x1f')](_0xed31('0x26'),upload[_0xed31('0x27')](_0xed31('0x28')),controller[_0xed31('0x29')]);var upload=multer({'storage':multer[_0xed31('0x20')]({'destination':function(_0x3e72b7,_0x7f48e6,_0xc39008){_0xc39008(null,path[_0xed31('0x2a')](config[_0xed31('0x21')],_0xed31('0x2b')));},'filename':function(_0x102c3a,_0x5b0d46,_0x2b4001){_0x2b4001(null,util['format'](_0xed31('0x24'),Date[_0xed31('0x2c')](),_0x5b0d46['originalname']));}})});router[_0xed31('0x1f')]('/:id/avatar',upload[_0xed31('0x27')](_0xed31('0x28')),controller['addAvatar']);var upload=multer({'storage':multer[_0xed31('0x20')]({'destination':function(_0x45a870,_0x214724,_0x4d85bd){_0x4d85bd(null,path[_0xed31('0x2a')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x2970b2,_0x15def2,_0x55c6a2){_0x55c6a2(null,util[_0xed31('0x23')](_0xed31('0x24'),Date[_0xed31('0x2c')](),_0x15def2[_0xed31('0x25')]));}})});router['post']('/:id/customer_avatar',upload[_0xed31('0x27')](_0xed31('0x28')),controller[_0xed31('0x2d')]);var upload=multer({'storage':multer[_0xed31('0x20')]({'destination':function(_0x49479d,_0xe234ce,_0x1f9804){_0x1f9804(null,path[_0xed31('0x2a')](config[_0xed31('0x21')],_0xed31('0x2b')));},'filename':function(_0x3540e6,_0x1cbe5e,_0x579b31){_0x579b31(null,util[_0xed31('0x23')](_0xed31('0x24'),Date[_0xed31('0x2c')](),_0x1cbe5e[_0xed31('0x25')]));}})});router[_0xed31('0x1f')](_0xed31('0x10'),upload[_0xed31('0x27')](_0xed31('0x28')),controller[_0xed31('0x2e')]);router[_0xed31('0x1f')](_0xed31('0x2f'),controller[_0xed31('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0xed31('0x20')]({'destination':function(_0x1e3f09,_0x2b1c89,_0x46064d){const _0x43724b=path[_0xed31('0x2a')](config[_0xed31('0x21')],_0xed31('0x31'),'attachments',_0xed31('0x32'));fs_extra[_0xed31('0x33')](_0x43724b,function(){_0x46064d(null,_0x43724b);});},'filename':function(_0x492907,_0x15954e,_0x5319a7){const _0x14e525=_0x15954e[_0xed31('0x25')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3819fc=path['extname'](_0x14e525);const _0x569d47=Date['now']()+'-'+_0x14e525['replace'](_0x3819fc,'')+_0x3819fc;_0x5319a7(null,_0x569d47);}})});router['post'](_0xed31('0x34'),offlineUploadMulter[_0xed31('0x35')](),controller['offline']);router['post'](_0xed31('0x12'),auth['isAuthenticated'](),controller[_0xed31('0x36')]);router[_0xed31('0x1f')](_0xed31('0x16'),auth[_0xed31('0x7')](),controller[_0xed31('0x37')]);router[_0xed31('0x1f')](_0xed31('0x18'),auth['isAuthenticated'](),controller[_0xed31('0x38')]);router[_0xed31('0x1f')](_0xed31('0x1d'),auth[_0xed31('0x7')](),controller['addAgents']);router['put'](_0xed31('0x9'),auth[_0xed31('0x7')](),controller[_0xed31('0x39')]);router[_0xed31('0x3a')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xed31('0x3a')]('/:id/dispositions',auth[_0xed31('0x7')](),controller[_0xed31('0x3b')]);router[_0xed31('0x3a')]('/:id/canned_answers',auth[_0xed31('0x7')](),controller[_0xed31('0x3c')]);router['delete']('/:id/users',auth[_0xed31('0x7')](),controller['removeAgents']);module[_0xed31('0x3d')]=router; \ No newline at end of file +var _0x3b85=['getOfflineMessages','getAgents','post','diskStorage','join','root','server/files/images/logos/','format','originalname','single','file','server/files/images/avatars/','%s-%s','now','addCustomerAvatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','replace','extname','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','addAgents','update','delete','destroy','removeDispositions','removeAnswers','/:id/users','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages'];(function(_0x4b36bd,_0x25a84a){var _0xb4a41f=function(_0x51b264){while(--_0x51b264){_0x4b36bd['push'](_0x4b36bd['shift']());}};_0xb4a41f(++_0x25a84a);}(_0x3b85,0x1c7));var _0x53b8=function(_0x28a097,_0x554a0c){_0x28a097=_0x28a097-0x0;var _0x32f2c4=_0x3b85[_0x28a097];return _0x32f2c4;};'use strict';var multer=require(_0x53b8('0x0'));var util=require(_0x53b8('0x1'));var path=require(_0x53b8('0x2'));var timeout=require('connect-timeout');var express=require(_0x53b8('0x3'));var router=express[_0x53b8('0x4')]();var fs_extra=require(_0x53b8('0x5'));var auth=require(_0x53b8('0x6'));var interaction=require(_0x53b8('0x7'));var config=require(_0x53b8('0x8'));var controller=require(_0x53b8('0x9'));router[_0x53b8('0xa')]('/',auth[_0x53b8('0xb')](),controller['index']);router[_0x53b8('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x53b8('0xc')]);router[_0x53b8('0xa')](_0x53b8('0xd'),auth['isAuthenticated'](),controller[_0x53b8('0xe')]);router[_0x53b8('0xa')](_0x53b8('0xf'),auth[_0x53b8('0xb')](),controller['getDispositions']);router[_0x53b8('0xa')](_0x53b8('0x10'),auth['isAuthenticated'](),controller[_0x53b8('0x11')]);router['get'](_0x53b8('0x12'),controller[_0x53b8('0x13')]);router[_0x53b8('0xa')](_0x53b8('0x14'),controller[_0x53b8('0x15')]);router[_0x53b8('0xa')](_0x53b8('0x16'),controller[_0x53b8('0x17')]);router[_0x53b8('0xa')](_0x53b8('0x18'),controller[_0x53b8('0x19')]);router[_0x53b8('0xa')](_0x53b8('0x1a'),auth['isAuthenticated'](),controller[_0x53b8('0x1b')]);router[_0x53b8('0xa')](_0x53b8('0x1c'),controller[_0x53b8('0x1d')]);router['get'](_0x53b8('0x1e'),auth['isAuthenticated'](),controller['getApplications']);router['get'](_0x53b8('0x1f'),auth[_0x53b8('0xb')](),controller[_0x53b8('0x20')]);router[_0x53b8('0xa')](_0x53b8('0x21'),controller['getFields']);router[_0x53b8('0xa')](_0x53b8('0x22'),auth[_0x53b8('0xb')](),controller[_0x53b8('0x23')]);router['get']('/:id/users',auth[_0x53b8('0xb')](),controller[_0x53b8('0x24')]);router[_0x53b8('0x25')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x53b8('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x53b8('0x25')](_0x53b8('0x10'),auth[_0x53b8('0xb')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x53b8('0x26')]({'destination':function(_0x1600f7,_0xe25a29,_0x5e608c){_0x5e608c(null,path[_0x53b8('0x27')](config[_0x53b8('0x28')],_0x53b8('0x29')));},'filename':function(_0x400bd3,_0x2687a,_0x1457ad){_0x1457ad(null,util[_0x53b8('0x2a')]('%s-%s',Date['now'](),_0x2687a[_0x53b8('0x2b')]));}})});router['post'](_0x53b8('0x12'),upload[_0x53b8('0x2c')](_0x53b8('0x2d')),controller['addLogo']);var upload=multer({'storage':multer[_0x53b8('0x26')]({'destination':function(_0x234eae,_0x5621d5,_0x54212c){_0x54212c(null,path[_0x53b8('0x27')](config[_0x53b8('0x28')],_0x53b8('0x2e')));},'filename':function(_0x1425c2,_0x1636e0,_0x3bb5ad){_0x3bb5ad(null,util[_0x53b8('0x2a')](_0x53b8('0x2f'),Date[_0x53b8('0x30')](),_0x1636e0['originalname']));}})});router['post'](_0x53b8('0x14'),upload[_0x53b8('0x2c')](_0x53b8('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3709b8,_0x551e36,_0xc50705){_0xc50705(null,path[_0x53b8('0x27')](config[_0x53b8('0x28')],_0x53b8('0x2e')));},'filename':function(_0x3219e9,_0x2bf624,_0x4294b2){_0x4294b2(null,util[_0x53b8('0x2a')](_0x53b8('0x2f'),Date[_0x53b8('0x30')](),_0x2bf624[_0x53b8('0x2b')]));}})});router[_0x53b8('0x25')]('/:id/customer_avatar',upload['single'](_0x53b8('0x2d')),controller[_0x53b8('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x20ffbc,_0x3f4844,_0x37b691){_0x37b691(null,path['join'](config[_0x53b8('0x28')],_0x53b8('0x2e')));},'filename':function(_0x280039,_0x498888,_0x1c4b0f){_0x1c4b0f(null,util['format']('%s-%s',Date[_0x53b8('0x30')](),_0x498888[_0x53b8('0x2b')]));}})});router[_0x53b8('0x25')](_0x53b8('0x18'),upload[_0x53b8('0x2c')]('file'),controller[_0x53b8('0x32')]);router[_0x53b8('0x25')](_0x53b8('0x33'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x53b8('0x26')]({'destination':function(_0x2b5628,_0x15c0c9,_0x40f561){const _0x5e8c7d=path['join'](config['root'],_0x53b8('0x34'),_0x53b8('0x35'),_0x53b8('0x36'));fs_extra['ensureDir'](_0x5e8c7d,function(){_0x40f561(null,_0x5e8c7d);});},'filename':function(_0x490bb9,_0x106829,_0x2e0669){const _0x1d5d42=_0x106829[_0x53b8('0x2b')][_0x53b8('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x577e00=path[_0x53b8('0x38')](_0x1d5d42);const _0x13e9e4=Date['now']()+'-'+_0x1d5d42['replace'](_0x577e00,'')+_0x577e00;_0x2e0669(null,_0x13e9e4);}})});router['post'](_0x53b8('0x39'),offlineUploadMulter['any'](),controller[_0x53b8('0x3a')]);router[_0x53b8('0x25')](_0x53b8('0x1a'),auth[_0x53b8('0xb')](),controller[_0x53b8('0x3b')]);router['post']('/:id/applications',auth[_0x53b8('0xb')](),controller[_0x53b8('0x3c')]);router[_0x53b8('0x25')](_0x53b8('0x1f'),auth['isAuthenticated'](),controller[_0x53b8('0x3d')]);router['post']('/:id/users',auth[_0x53b8('0xb')](),controller[_0x53b8('0x3e')]);router['put'](_0x53b8('0xd'),auth[_0x53b8('0xb')](),controller[_0x53b8('0x3f')]);router[_0x53b8('0x40')]('/:id',auth[_0x53b8('0xb')](),controller[_0x53b8('0x41')]);router[_0x53b8('0x40')](_0x53b8('0xf'),auth[_0x53b8('0xb')](),controller[_0x53b8('0x42')]);router[_0x53b8('0x40')](_0x53b8('0x10'),auth[_0x53b8('0xb')](),controller[_0x53b8('0x43')]);router[_0x53b8('0x40')](_0x53b8('0x44'),auth[_0x53b8('0xb')](),controller[_0x53b8('0x45')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 053d10e..e98872b 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 _0xad68=['STRING','ENUM'];(function(_0x5bc672,_0x5ccc7d){var _0x30123d=function(_0x27f4e6){while(--_0x27f4e6){_0x5bc672['push'](_0x5bc672['shift']());}};_0x30123d(++_0x5ccc7d);}(_0xad68,0x100));var _0x8ad6=function(_0x37f364,_0x56f6ae){_0x37f364=_0x37f364-0x0;var _0x1a97dd=_0xad68[_0x37f364];return _0x1a97dd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8ad6('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x8ad6('0x1')]('AmazonAWS','Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x8ad6('0x0')]},'data2':{'type':Sequelize[_0x8ad6('0x0')]}}; \ No newline at end of file +var _0x6d19=['STRING','ENUM','AmazonAWS','Google','sequelize','exports'];(function(_0x541d11,_0x43536b){var _0x229bfa=function(_0x494b39){while(--_0x494b39){_0x541d11['push'](_0x541d11['shift']());}};_0x229bfa(++_0x43536b);}(_0x6d19,0x160));var _0x96d1=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x6d19[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require(_0x96d1('0x0'));module[_0x96d1('0x1')]={'name':{'type':Sequelize[_0x96d1('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x96d1('0x3')](_0x96d1('0x4'),_0x96d1('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x96d1('0x2')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 96da113..5307932 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 _0xdb28=['error','stack','name','send','index','CloudProvider','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus'];(function(_0x1ba43c,_0x1734eb){var _0x21bc3d=function(_0x2394e7){while(--_0x2394e7){_0x1ba43c['push'](_0x1ba43c['shift']());}};_0x21bc3d(++_0x1734eb);}(_0xdb28,0x106));var _0x8db2=function(_0x10aef,_0x3aa2a6){_0x10aef=_0x10aef-0x0;var _0x5029d5=_0xdb28[_0x10aef];return _0x5029d5;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':!![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));}; \ No newline at end of file +var _0x5f66=['update','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','CloudProvider','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body'];(function(_0x334b04,_0x2c5ead){var _0x1096df=function(_0x19803a){while(--_0x19803a){_0x334b04['push'](_0x334b04['shift']());}};_0x1096df(++_0x2c5ead);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'all':!![]}];}return db[_0x65f6('0x27')][_0x65f6('0x3c')](_0x4ac04b);})[_0x65f6('0x21')](function(_0xed4c96){_0x266cfe[_0x65f6('0x3d')]=_0xed4c96;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))['catch'](handleError(_0x559330,null));};exports[_0x65f6('0x3e')]=function(_0x400ed2,_0x377ae5){var _0x181798={'raw':!![],'where':{'id':_0x400ed2[_0x65f6('0x3f')]['id']}},_0x83e2d9={};_0x83e2d9[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x83e2d9[_0x65f6('0x2c')]=_[_0x65f6('0x2b')](_0x400ed2[_0x65f6('0x2c')]);_0x83e2d9[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],_0x83e2d9['query']);_0x181798[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x400ed2['query'][_0x65f6('0x2f')]));_0x181798[_0x65f6('0x30')]=_0x181798[_0x65f6('0x30')]['length']?_0x181798[_0x65f6('0x30')]:_0x83e2d9[_0x65f6('0x2a')];if(_0x400ed2[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x181798['include']=[{'all':!![]}];}_0x181798=_[_0x65f6('0x37')]({},_0x181798,_0x400ed2['options']);return db[_0x65f6('0x27')][_0x65f6('0x40')](_0x181798)['then'](handleEntityNotFound(_0x377ae5,null))[_0x65f6('0x21')](respondWithResult(_0x377ae5,null))['catch'](handleError(_0x377ae5,null));};exports[_0x65f6('0x41')]=function(_0x4d9b76,_0x2d1706){return db[_0x65f6('0x27')][_0x65f6('0x41')](_0x4d9b76[_0x65f6('0x42')],{})['then'](respondWithResult(_0x2d1706,0xc9))['catch'](handleError(_0x2d1706,null));};exports[_0x65f6('0x43')]=function(_0x15d3ba,_0x3b647a){if(_0x15d3ba[_0x65f6('0x42')]['id']){delete _0x15d3ba[_0x65f6('0x42')]['id'];}return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x15d3ba[_0x65f6('0x3f')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b647a,null))['then'](saveUpdates(_0x15d3ba[_0x65f6('0x42')],null))[_0x65f6('0x21')](respondWithResult(_0x3b647a,null))[_0x65f6('0x44')](handleError(_0x3b647a,null));};exports['destroy']=function(_0x47e749,_0x42d453){return db['CloudProvider'][_0x65f6('0x40')]({'where':{'id':_0x47e749[_0x65f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x42d453,null))[_0x65f6('0x21')](removeEntity(_0x42d453,null))['catch'](handleError(_0x42d453,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index ce1b9a7..9389cc7 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 _0x6993=['rimraf','../../config/environment','./cloudProvider.attributes','exports','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x6993,0x9a));var _0x3699=function(_0x58bec1,_0x42c53f){_0x58bec1=_0x58bec1-0x0;var _0x16439f=_0x6993[_0x58bec1];return _0x16439f;};'use strict';var _=require(_0x3699('0x0'));var util=require('util');var logger=require(_0x3699('0x1'))(_0x3699('0x2'));var moment=require(_0x3699('0x3'));var BPromise=require(_0x3699('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3699('0x5'));var rimraf=require(_0x3699('0x6'));var config=require(_0x3699('0x7'));var attributes=require(_0x3699('0x8'));module[_0x3699('0x9')]=function(_0x4f55c1,_0x13bc7f){return _0x4f55c1['define']('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe929=['CloudProvider','cloud_providers','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./cloudProvider.attributes','define'];(function(_0x202b49,_0x4ffac8){var _0x4b1654=function(_0x2361eb){while(--_0x2361eb){_0x202b49['push'](_0x202b49['shift']());}};_0x4b1654(++_0x4ffac8);}(_0xe929,0x1d0));var _0x9e92=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0xe929[_0x28578d];return _0x524826;};'use strict';var _=require(_0x9e92('0x0'));var util=require(_0x9e92('0x1'));var logger=require(_0x9e92('0x2'))('api');var moment=require(_0x9e92('0x3'));var BPromise=require(_0x9e92('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9e92('0x5'));var config=require(_0x9e92('0x6'));var attributes=require(_0x9e92('0x7'));module['exports']=function(_0x138184,_0x53e7ed){return _0x138184[_0x9e92('0x8')](_0x9e92('0x9'),attributes,{'tableName':_0x9e92('0xa'),'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 7dd2bef..89fb86b 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 _0xe5fc=['http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x260b6f,_0x1edc36){var _0x3f672e=function(_0x4b536c){while(--_0x4b536c){_0x260b6f['push'](_0x260b6f['shift']());}};_0x3f672e(++_0x1edc36);}(_0xe5fc,0x109));var _0xce5f=function(_0x4a1059,_0x41d0fc){_0x4a1059=_0x4a1059-0x0;var _0x1eb89b=_0xe5fc[_0x4a1059];return _0x1eb89b;};'use strict';var _=require(_0xce5f('0x0'));var util=require('util');var moment=require(_0xce5f('0x1'));var BPromise=require(_0xce5f('0x2'));var rs=require(_0xce5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce5f('0x4'))('rpc');var config=require(_0xce5f('0x5'));var jayson=require(_0xce5f('0x6'));var client=jayson[_0xce5f('0x7')][_0xce5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b77ef,_0x30a150,_0x2b64dc){return new BPromise(function(_0x3451af,_0x4fa651){return client[_0xce5f('0x9')](_0x3b77ef,_0x2b64dc)[_0xce5f('0xa')](function(_0x29a7bf){logger[_0xce5f('0xb')](_0xce5f('0xc'),_0x30a150,_0xce5f('0xd'));logger[_0xce5f('0xe')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x30a150,_0xce5f('0xd'),JSON[_0xce5f('0xf')](_0x29a7bf));if(_0x29a7bf[_0xce5f('0x10')]){if(_0x29a7bf[_0xce5f('0x10')][_0xce5f('0x11')]===0x1f4){logger[_0xce5f('0x10')](_0xce5f('0xc'),_0x30a150,_0x29a7bf[_0xce5f('0x10')][_0xce5f('0x12')]);return _0x4fa651(_0x29a7bf['error']['message']);}logger['error'](_0xce5f('0xc'),_0x30a150,_0x29a7bf[_0xce5f('0x10')][_0xce5f('0x12')]);return _0x3451af(_0x29a7bf[_0xce5f('0x10')]['message']);}else{logger[_0xce5f('0xb')](_0xce5f('0xc'),_0x30a150,_0xce5f('0xd'));_0x3451af(_0x29a7bf[_0xce5f('0x13')][_0xce5f('0x12')]);}})[_0xce5f('0x14')](function(_0x1544ba){logger[_0xce5f('0x10')](_0xce5f('0xc'),_0x30a150,_0x1544ba);_0x4fa651(_0x1544ba);});});} \ No newline at end of file +var _0x1681=['../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','code','message','CloudProvider,\x20%s,\x20%s','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1681,0x12c));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1168('0x0'));var BPromise=require(_0x1168('0x1'));var rs=require(_0x1168('0x2'));var fs=require('fs');var Redis=require(_0x1168('0x3'));var db=require(_0x1168('0x4'))['db'];var utils=require(_0x1168('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1168('0x6'));var jayson=require(_0x1168('0x7'));var client=jayson['client'][_0x1168('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d0634,_0x5e6752,_0x27309b){return new BPromise(function(_0x53baca,_0x262f80){return client[_0x1168('0x9')](_0x1d0634,_0x27309b)['then'](function(_0x38096f){logger[_0x1168('0xa')]('CloudProvider,\x20%s,\x20%s',_0x5e6752,_0x1168('0xb'));logger[_0x1168('0xc')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x5e6752,'request\x20sent',JSON[_0x1168('0xd')](_0x38096f));if(_0x38096f[_0x1168('0xe')]){if(_0x38096f[_0x1168('0xe')][_0x1168('0xf')]===0x1f4){logger[_0x1168('0xe')]('CloudProvider,\x20%s,\x20%s',_0x5e6752,_0x38096f[_0x1168('0xe')][_0x1168('0x10')]);return _0x262f80(_0x38096f[_0x1168('0xe')][_0x1168('0x10')]);}logger[_0x1168('0xe')]('CloudProvider,\x20%s,\x20%s',_0x5e6752,_0x38096f[_0x1168('0xe')]['message']);return _0x53baca(_0x38096f[_0x1168('0xe')][_0x1168('0x10')]);}else{logger['info'](_0x1168('0x11'),_0x5e6752,_0x1168('0xb'));_0x53baca(_0x38096f['result'][_0x1168('0x10')]);}})['catch'](function(_0x45e07e){logger[_0x1168('0xe')]('CloudProvider,\x20%s,\x20%s',_0x5e6752,_0x45e07e);_0x262f80(_0x45e07e);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index b556547..c86d2b1 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 _0x3f2e=['update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cloudProvider.controller','isAuthenticated','index','show','post','create'];(function(_0x262d44,_0x5e8536){var _0x17339c=function(_0x2accfa){while(--_0x2accfa){_0x262d44['push'](_0x262d44['shift']());}};_0x17339c(++_0x5e8536);}(_0x3f2e,0x9d));var _0xe3f2=function(_0x420513,_0x30eae3){_0x420513=_0x420513-0x0;var _0x1b44ec=_0x3f2e[_0x420513];return _0x1b44ec;};'use strict';var multer=require(_0xe3f2('0x0'));var util=require('util');var path=require(_0xe3f2('0x1'));var timeout=require(_0xe3f2('0x2'));var express=require(_0xe3f2('0x3'));var router=express[_0xe3f2('0x4')]();var fs_extra=require(_0xe3f2('0x5'));var auth=require(_0xe3f2('0x6'));var interaction=require(_0xe3f2('0x7'));var config=require('../../config/environment');var controller=require(_0xe3f2('0x8'));router['get']('/',auth[_0xe3f2('0x9')](),controller[_0xe3f2('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe3f2('0xb')]);router[_0xe3f2('0xc')]('/',auth[_0xe3f2('0x9')](),controller[_0xe3f2('0xd')]);router['put']('/:id',auth[_0xe3f2('0x9')](),controller[_0xe3f2('0xe')]);router[_0xe3f2('0xf')](_0xe3f2('0x10'),auth[_0xe3f2('0x9')](),controller[_0xe3f2('0x11')]);module[_0xe3f2('0x12')]=router; \ No newline at end of file +var _0x426b=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create','put'];(function(_0x56eb04,_0x587702){var _0x3d58e8=function(_0x35782a){while(--_0x35782a){_0x56eb04['push'](_0x56eb04['shift']());}};_0x3d58e8(++_0x587702);}(_0x426b,0x193));var _0xb426=function(_0x5e5f5a,_0x5cb19a){_0x5e5f5a=_0x5e5f5a-0x0;var _0x4141ae=_0x426b[_0x5e5f5a];return _0x4141ae;};'use strict';var multer=require(_0xb426('0x0'));var util=require(_0xb426('0x1'));var path=require('path');var timeout=require(_0xb426('0x2'));var express=require(_0xb426('0x3'));var router=express[_0xb426('0x4')]();var fs_extra=require(_0xb426('0x5'));var auth=require(_0xb426('0x6'));var interaction=require(_0xb426('0x7'));var config=require(_0xb426('0x8'));var controller=require('./cloudProvider.controller');router[_0xb426('0x9')]('/',auth[_0xb426('0xa')](),controller[_0xb426('0xb')]);router['get'](_0xb426('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xb426('0xa')](),controller[_0xb426('0xd')]);router[_0xb426('0xe')](_0xb426('0xc'),auth[_0xb426('0xa')](),controller[_0xb426('0xf')]);router[_0xb426('0x10')](_0xb426('0xc'),auth['isAuthenticated'](),controller[_0xb426('0x11')]);module[_0xb426('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 1ae7375..22f70f2 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 _0x0f9a=['sequelize','exports','STRING','name'];(function(_0x3a78e1,_0x215da7){var _0x34a3d8=function(_0x2ddc0b){while(--_0x2ddc0b){_0x3a78e1['push'](_0x3a78e1['shift']());}};_0x34a3d8(++_0x215da7);}(_0x0f9a,0x174));var _0xa0f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f9a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa0f9('0x0'));module[_0xa0f9('0x1')]={'name':{'type':Sequelize[_0xa0f9('0x2')],'unique':_0xa0f9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xa0f9('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xa0f9('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xa0f9('0x2')]},'postalCode':{'type':Sequelize[_0xa0f9('0x2')]},'city':{'type':Sequelize[_0xa0f9('0x2')]},'country':{'type':Sequelize[_0xa0f9('0x2')]},'email':{'type':Sequelize[_0xa0f9('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xa0f9('0x2')]},'sStreet':{'type':Sequelize[_0xa0f9('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xa0f9('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdc88=['STRING','name','sequelize'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xdc88,0x7a));var _0x8dc8=function(_0x487d64,_0x1bc8cc){_0x487d64=_0x487d64-0x0;var _0x5bef89=_0xdc88[_0x487d64];return _0x5bef89;};'use strict';var Sequelize=require(_0x8dc8('0x0'));module['exports']={'name':{'type':Sequelize[_0x8dc8('0x1')],'unique':_0x8dc8('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x8dc8('0x1')]},'phone':{'type':Sequelize[_0x8dc8('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x8dc8('0x1')]},'city':{'type':Sequelize[_0x8dc8('0x1')]},'country':{'type':Sequelize[_0x8dc8('0x1')]},'email':{'type':Sequelize[_0x8dc8('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8dc8('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x8dc8('0x1')]},'description':{'type':Sequelize[_0x8dc8('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 62829ef..58663ad 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 _0xe760=['merge','map','options','CmCompany','includeAll','include','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','addContacts','ids','omit','getContacts','findOne','hasOwnProperty','rimraf','zip-dir','request-promise','moment','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','Companies','UserProfileResource','destroy','error','stack','name','send','index','describe','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','pick','filter','where'];(function(_0x715596,_0x59b621){var _0x1d9b7e=function(_0x2c366e){while(--_0x2c366e){_0x715596['push'](_0x715596['shift']());}};_0x1d9b7e(++_0x59b621);}(_0xe760,0x114));var _0x0e76=function(_0x86238a,_0x33e0cb){_0x86238a=_0x86238a-0x0;var _0x155816=_0xe760[_0x86238a];return _0x155816;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e76('0x0'));var zipdir=require(_0x0e76('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e76('0x2'));var moment=require(_0x0e76('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0e76('0x4'));var path=require(_0x0e76('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0e76('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e76('0x7'));var squel=require(_0x0e76('0x8'));var crypto=require(_0x0e76('0x9'));var jsforce=require(_0x0e76('0xa'));var deskjs=require(_0x0e76('0xb'));var toCsv=require(_0x0e76('0xc'));var querystring=require(_0x0e76('0xd'));var Papa=require(_0x0e76('0xe'));var Redis=require(_0x0e76('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0e76('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e76('0x11'));var logger=require(_0x0e76('0x12'))(_0x0e76('0x13'));var utils=require(_0x0e76('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0e76('0x15'))['db'];function respondWithStatusCode(_0x4881b1,_0x4009c3){_0x4009c3=_0x4009c3||0xcc;return function(_0x5e2c41){if(_0x5e2c41){return _0x4881b1[_0x0e76('0x16')](_0x4009c3);}return _0x4881b1[_0x0e76('0x17')](_0x4009c3)[_0x0e76('0x18')]();};}function respondWithResult(_0x35488e,_0x23fc4f){_0x23fc4f=_0x23fc4f||0xc8;return function(_0x41b70f){if(_0x41b70f){return _0x35488e[_0x0e76('0x17')](_0x23fc4f)[_0x0e76('0x19')](_0x41b70f);}};}function respondWithFilteredResult(_0x4babae,_0x2c0b17){return function(_0x453a92){if(_0x453a92){var _0x16630e=typeof _0x2c0b17[_0x0e76('0x1a')]===_0x0e76('0x1b')&&typeof _0x2c0b17[_0x0e76('0x1c')]===_0x0e76('0x1b');var _0x52b27a=_0x453a92[_0x0e76('0x1d')];var _0x3f625a=_0x16630e?0x0:_0x2c0b17[_0x0e76('0x1a')];var _0xaffac8=_0x16630e?_0x453a92[_0x0e76('0x1d')]:_0x2c0b17[_0x0e76('0x1a')]+_0x2c0b17['limit'];var _0x44a691;if(_0xaffac8>=_0x52b27a){_0xaffac8=_0x52b27a;_0x44a691=0xc8;}else{_0x44a691=0xce;}_0x4babae['status'](_0x44a691);return _0x4babae[_0x0e76('0x1e')](_0x0e76('0x1f'),_0x3f625a+'-'+_0xaffac8+'/'+_0x52b27a)['json'](_0x453a92);}return null;};}function patchUpdates(_0x571786){return function(_0xb73474){try{jsonpatch['apply'](_0xb73474,_0x571786,!![]);}catch(_0x1c21ae){return BPromise[_0x0e76('0x20')](_0x1c21ae);}return _0xb73474[_0x0e76('0x21')]();};}function saveUpdates(_0x3bdf73,_0x21aeed){return function(_0x350d2a){if(_0x350d2a){return _0x350d2a[_0x0e76('0x22')](_0x3bdf73)[_0x0e76('0x23')](function(_0x4f696b){return _0x4f696b;});}return null;};}function removeEntity(_0x368728,_0x1d3460){return function(_0x1d114a){if(_0x1d114a){return _0x1d114a['destroy']()[_0x0e76('0x23')](function(){var _0x15ee5a=_0x1d114a[_0x0e76('0x24')]({'plain':!![]});var _0x230f29=_0x0e76('0x25');return db[_0x0e76('0x26')][_0x0e76('0x27')]({'where':{'type':_0x230f29,'resourceId':_0x15ee5a['id']}})['then'](function(){return _0x1d114a;});})[_0x0e76('0x23')](function(){_0x368728[_0x0e76('0x17')](0xcc)[_0x0e76('0x18')]();});}};}function handleEntityNotFound(_0x266122,_0x28ba12){return function(_0x577956){if(!_0x577956){_0x266122[_0x0e76('0x16')](0x194);}return _0x577956;};}function handleError(_0x3a5bad,_0x150f69){_0x150f69=_0x150f69||0x1f4;return function(_0x4fc3e9){logger[_0x0e76('0x28')](_0x4fc3e9[_0x0e76('0x29')]);if(_0x4fc3e9['name']){delete _0x4fc3e9[_0x0e76('0x2a')];}_0x3a5bad[_0x0e76('0x17')](_0x150f69)[_0x0e76('0x2b')](_0x4fc3e9);};}exports[_0x0e76('0x2c')]=function(_0x15d5af,_0x581f7f){var _0x165159={},_0xfacfae={},_0xacece7={'count':0x0,'rows':[]};return db['CmCompany'][_0x0e76('0x2d')]()[_0x0e76('0x23')](function(_0x26cfe5){_0xfacfae[_0x0e76('0x2e')]=_[_0x0e76('0x2f')](_0x26cfe5);_0xfacfae['query']=_[_0x0e76('0x2f')](_0x15d5af['query']);_0xfacfae[_0x0e76('0x30')]=_[_0x0e76('0x31')](_0xfacfae['model'],_0xfacfae[_0x0e76('0x32')]);_0x165159[_0x0e76('0x33')]=_[_0x0e76('0x31')](_0xfacfae[_0x0e76('0x2e')],qs[_0x0e76('0x34')](_0x15d5af[_0x0e76('0x32')][_0x0e76('0x34')]));_0x165159[_0x0e76('0x33')]=_0x165159[_0x0e76('0x33')][_0x0e76('0x35')]?_0x165159[_0x0e76('0x33')]:_0xfacfae[_0x0e76('0x2e')];if(!_0x15d5af[_0x0e76('0x32')]['hasOwnProperty'](_0x0e76('0x36'))){_0x165159['limit']=qs[_0x0e76('0x1c')](_0x15d5af[_0x0e76('0x32')]['limit']);_0x165159[_0x0e76('0x1a')]=qs[_0x0e76('0x1a')](_0x15d5af[_0x0e76('0x32')][_0x0e76('0x1a')]);}_0x165159[_0x0e76('0x37')]=qs[_0x0e76('0x38')](_0x15d5af['query'][_0x0e76('0x38')]);_0x165159['where']=qs[_0x0e76('0x30')](_[_0x0e76('0x39')](_0x15d5af[_0x0e76('0x32')],_0xfacfae['filters']),_0x26cfe5);if(_0x15d5af['query'][_0x0e76('0x3a')]){_0x165159[_0x0e76('0x3b')]=_[_0x0e76('0x3c')](_0x165159[_0x0e76('0x3b')],{'$or':_[_0x0e76('0x3d')](_0x165159[_0x0e76('0x33')],function(_0x12d09d){var _0x7700f5={};_0x7700f5[_0x12d09d]={'$like':'%'+_0x15d5af[_0x0e76('0x32')][_0x0e76('0x3a')]+'%'};return _0x7700f5;})});}_0x165159=_[_0x0e76('0x3c')]({},_0x165159,_0x15d5af[_0x0e76('0x3e')]);var _0x38aaef={'where':_0x165159[_0x0e76('0x3b')]};return db[_0x0e76('0x3f')][_0x0e76('0x1d')](_0x38aaef)[_0x0e76('0x23')](function(_0xb7c5e4){_0xacece7[_0x0e76('0x1d')]=_0xb7c5e4;if(_0x15d5af[_0x0e76('0x32')][_0x0e76('0x40')]){_0x165159[_0x0e76('0x41')]=[{'all':!![]}];}return db[_0x0e76('0x3f')]['findAll'](_0x165159);})[_0x0e76('0x23')](function(_0x45e8d1){_0xacece7['rows']=_0x45e8d1;return _0xacece7;})[_0x0e76('0x23')](respondWithFilteredResult(_0x581f7f,_0x165159))['catch'](handleError(_0x581f7f,null));})[_0x0e76('0x42')](handleError(_0x581f7f,null));};exports[_0x0e76('0x43')]=function(_0x4e9b5f,_0x4afabb){var _0x485890={'raw':![],'where':{'id':_0x4e9b5f[_0x0e76('0x44')]['id']}},_0x37b936={};_0x37b936[_0x0e76('0x2e')]=_['keys'](db['CmCompany'][_0x0e76('0x45')]);_0x37b936[_0x0e76('0x32')]=_['keys'](_0x4e9b5f[_0x0e76('0x32')]);_0x37b936[_0x0e76('0x30')]=_['intersection'](_0x37b936[_0x0e76('0x2e')],_0x37b936['query']);_0x485890['attributes']=_[_0x0e76('0x31')](_0x37b936[_0x0e76('0x2e')],qs['fields'](_0x4e9b5f[_0x0e76('0x32')][_0x0e76('0x34')]));_0x485890[_0x0e76('0x33')]=_0x485890['attributes'][_0x0e76('0x35')]?_0x485890[_0x0e76('0x33')]:_0x37b936[_0x0e76('0x2e')];if(_0x4e9b5f[_0x0e76('0x32')][_0x0e76('0x40')]){_0x485890[_0x0e76('0x41')]=[{'all':!![]}];}_0x485890=_[_0x0e76('0x3c')]({},_0x485890,_0x4e9b5f[_0x0e76('0x3e')]);return db[_0x0e76('0x3f')][_0x0e76('0x46')](_0x485890)['then'](handleEntityNotFound(_0x4afabb,null))[_0x0e76('0x23')](respondWithResult(_0x4afabb,null))[_0x0e76('0x42')](handleError(_0x4afabb,null));};exports[_0x0e76('0x47')]=function(_0x3365c9,_0x213249){return db[_0x0e76('0x3f')][_0x0e76('0x47')](_0x3365c9['body'],{})[_0x0e76('0x23')](function(_0x4dadee){var _0xb5e0ea=_0x3365c9[_0x0e76('0x48')][_0x0e76('0x24')]({'plain':!![]});if(!_0xb5e0ea)throw new Error(_0x0e76('0x49'));if(_0xb5e0ea['role']==='user'){var _0x14a9f0=_0x4dadee[_0x0e76('0x24')]({'plain':!![]});var _0x190dc1='Companies';return db[_0x0e76('0x4a')]['find']({'where':{'name':_0x190dc1,'userProfileId':_0xb5e0ea[_0x0e76('0x4b')]},'raw':!![]})[_0x0e76('0x23')](function(_0x21335d){if(_0x21335d&&_0x21335d[_0x0e76('0x4c')]===0x0){return db[_0x0e76('0x26')][_0x0e76('0x47')]({'name':_0x14a9f0[_0x0e76('0x2a')],'resourceId':_0x14a9f0['id'],'type':_0x21335d['name'],'sectionId':_0x21335d['id']},{})['then'](function(){return _0x4dadee;});}else{return _0x4dadee;}})['catch'](function(_0xbc6eb1){logger[_0x0e76('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbc6eb1);throw _0xbc6eb1;});}return _0x4dadee;})['then'](respondWithResult(_0x213249,0xc9))['catch'](handleError(_0x213249,null));};exports['update']=function(_0x4dca1a,_0x2dfa6c){if(_0x4dca1a[_0x0e76('0x4d')]['id']){delete _0x4dca1a[_0x0e76('0x4d')]['id'];}return db['CmCompany'][_0x0e76('0x46')]({'where':{'id':_0x4dca1a[_0x0e76('0x44')]['id']}})[_0x0e76('0x23')](handleEntityNotFound(_0x2dfa6c,null))['then'](saveUpdates(_0x4dca1a[_0x0e76('0x4d')],null))[_0x0e76('0x23')](respondWithResult(_0x2dfa6c,null))[_0x0e76('0x42')](handleError(_0x2dfa6c,null));};exports[_0x0e76('0x27')]=function(_0x17b538,_0x18d052){return db[_0x0e76('0x3f')]['find']({'where':{'id':_0x17b538[_0x0e76('0x44')]['id']}})[_0x0e76('0x23')](handleEntityNotFound(_0x18d052,null))[_0x0e76('0x23')](removeEntity(_0x18d052,null))[_0x0e76('0x42')](handleError(_0x18d052,null));};exports[_0x0e76('0x2d')]=function(_0x351af2,_0x408195){return db[_0x0e76('0x3f')][_0x0e76('0x2d')]()[_0x0e76('0x23')](respondWithResult(_0x408195,null))[_0x0e76('0x42')](handleError(_0x408195,null));};exports['addContacts']=function(_0x1ec75c,_0x58d7bd,_0x27f81f){return db['CmContact'][_0x0e76('0x46')]({'where':{'id':_0x1ec75c['params']['id']}})[_0x0e76('0x23')](handleEntityNotFound(_0x58d7bd,null))['then'](function(_0x4fc69d){if(_0x4fc69d){return _0x4fc69d[_0x0e76('0x4e')](_0x1ec75c['body'][_0x0e76('0x4f')],_[_0x0e76('0x50')](_0x1ec75c[_0x0e76('0x4d')],[_0x0e76('0x4f'),'id'])||{});}})[_0x0e76('0x23')](respondWithResult(_0x58d7bd,null))[_0x0e76('0x42')](handleError(_0x58d7bd,null));};exports[_0x0e76('0x51')]=function(_0x286588,_0x28a5e6,_0x50c634){var _0x519088={};var _0x13dc20={};var _0x493010;var _0x295b3a;return db['CmCompany'][_0x0e76('0x52')]({'where':{'id':_0x286588[_0x0e76('0x44')]['id']}})['then'](handleEntityNotFound(_0x28a5e6,null))['then'](function(_0x22f5e2){if(_0x22f5e2){_0x493010=_0x22f5e2;_0x13dc20['model']=_['keys'](db['CmContact']['rawAttributes']);_0x13dc20['query']=_['keys'](_0x286588[_0x0e76('0x32')]);_0x13dc20[_0x0e76('0x30')]=_[_0x0e76('0x31')](_0x13dc20['model'],_0x13dc20[_0x0e76('0x32')]);_0x519088['attributes']=_[_0x0e76('0x31')](_0x13dc20[_0x0e76('0x2e')],qs['fields'](_0x286588[_0x0e76('0x32')][_0x0e76('0x34')]));_0x519088[_0x0e76('0x33')]=_0x519088[_0x0e76('0x33')][_0x0e76('0x35')]?_0x519088[_0x0e76('0x33')]:_0x13dc20[_0x0e76('0x2e')];_0x519088[_0x0e76('0x37')]=qs[_0x0e76('0x38')](_0x286588[_0x0e76('0x32')][_0x0e76('0x38')]);_0x519088[_0x0e76('0x3b')]=qs['filters'](_['pick'](_0x286588[_0x0e76('0x32')],_0x13dc20[_0x0e76('0x30')]));if(_0x286588[_0x0e76('0x32')][_0x0e76('0x3a')]){_0x519088[_0x0e76('0x3b')]=_[_0x0e76('0x3c')](_0x519088[_0x0e76('0x3b')],{'$or':_[_0x0e76('0x3d')](_0x519088[_0x0e76('0x33')],function(_0x5a33cf){var _0x2ad97f={};_0x2ad97f[_0x5a33cf]={'$like':'%'+_0x286588['query'][_0x0e76('0x3a')]+'%'};return _0x2ad97f;})});}_0x519088=_[_0x0e76('0x3c')]({},_0x519088,_0x286588[_0x0e76('0x3e')]);return _0x493010[_0x0e76('0x51')](_0x519088);}})['then'](function(_0x1ad0c1){if(_0x1ad0c1){_0x295b3a=_0x1ad0c1['length'];if(!_0x286588[_0x0e76('0x32')][_0x0e76('0x53')]('nolimit')){_0x519088['limit']=qs[_0x0e76('0x1c')](_0x286588[_0x0e76('0x32')]['limit']);_0x519088[_0x0e76('0x1a')]=qs[_0x0e76('0x1a')](_0x286588[_0x0e76('0x32')]['offset']);}return _0x493010[_0x0e76('0x51')](_0x519088);}})[_0x0e76('0x23')](function(_0x38ff62){if(_0x38ff62){return _0x38ff62?{'count':_0x295b3a,'rows':_0x38ff62}:null;}})[_0x0e76('0x23')](respondWithResult(_0x28a5e6,null))[_0x0e76('0x42')](handleError(_0x28a5e6,null));}; \ No newline at end of file +var _0xd65e=['rawAttributes','order','pick','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','get','Companies','UserProfileResource','error','stack','name','send','CmCompany','describe','keys','query','filters','intersection','attributes','model','fields','length','sort','where','merge','map','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','getContacts','CmContact'];(function(_0x20d434,_0x3fb64f){var _0x1d90f1=function(_0x3af405){while(--_0x3af405){_0x20d434['push'](_0x20d434['shift']());}};_0x1d90f1(++_0x3fb64f);}(_0xd65e,0xfa));var _0xed65=function(_0x21aac6,_0x3dbe44){_0x21aac6=_0x21aac6-0x0;var _0x5daf40=_0xd65e[_0x21aac6];return _0x5daf40;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed65('0x0'));var zipdir=require(_0xed65('0x1'));var jsonpatch=require(_0xed65('0x2'));var rp=require(_0xed65('0x3'));var moment=require(_0xed65('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xed65('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xed65('0x6'));var ejs=require(_0xed65('0x7'));var fs=require('fs');var fs_extra=require(_0xed65('0x8'));var _=require('lodash');var squel=require(_0xed65('0x9'));var crypto=require(_0xed65('0xa'));var jsforce=require(_0xed65('0xb'));var deskjs=require(_0xed65('0xc'));var toCsv=require(_0xed65('0x6'));var querystring=require('querystring');var Papa=require(_0xed65('0xd'));var Redis=require('ioredis');var authService=require(_0xed65('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xed65('0xf'));var hardwareService=require(_0xed65('0x10'));var logger=require(_0xed65('0x11'))(_0xed65('0x12'));var utils=require(_0xed65('0x13'));var config=require(_0xed65('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1699f2,_0x5d57eb){_0x5d57eb=_0x5d57eb||0xcc;return function(_0x347410){if(_0x347410){return _0x1699f2['sendStatus'](_0x5d57eb);}return _0x1699f2[_0xed65('0x15')](_0x5d57eb)[_0xed65('0x16')]();};}function respondWithResult(_0x467bc6,_0x2c4219){_0x2c4219=_0x2c4219||0xc8;return function(_0x574cfa){if(_0x574cfa){return _0x467bc6[_0xed65('0x15')](_0x2c4219)[_0xed65('0x17')](_0x574cfa);}};}function respondWithFilteredResult(_0x1f638f,_0x56ee47){return function(_0x31dc36){if(_0x31dc36){var _0x47bf1a=typeof _0x56ee47[_0xed65('0x18')]==='undefined'&&typeof _0x56ee47[_0xed65('0x19')]===_0xed65('0x1a');var _0x466f3f=_0x31dc36[_0xed65('0x1b')];var _0x4858f2=_0x47bf1a?0x0:_0x56ee47['offset'];var _0x3078d3=_0x47bf1a?_0x31dc36[_0xed65('0x1b')]:_0x56ee47[_0xed65('0x18')]+_0x56ee47[_0xed65('0x19')];var _0x3d834b;if(_0x3078d3>=_0x466f3f){_0x3078d3=_0x466f3f;_0x3d834b=0xc8;}else{_0x3d834b=0xce;}_0x1f638f[_0xed65('0x15')](_0x3d834b);return _0x1f638f[_0xed65('0x1c')]('Content-Range',_0x4858f2+'-'+_0x3078d3+'/'+_0x466f3f)[_0xed65('0x17')](_0x31dc36);}return null;};}function patchUpdates(_0xa4df13){return function(_0x5b95b7){try{jsonpatch[_0xed65('0x1d')](_0x5b95b7,_0xa4df13,!![]);}catch(_0x2090a0){return BPromise[_0xed65('0x1e')](_0x2090a0);}return _0x5b95b7[_0xed65('0x1f')]();};}function saveUpdates(_0x28186c,_0x42e8cc){return function(_0x32576e){if(_0x32576e){return _0x32576e[_0xed65('0x20')](_0x28186c)['then'](function(_0x57f20a){return _0x57f20a;});}return null;};}function removeEntity(_0x21743d,_0x39b25b){return function(_0x223f76){if(_0x223f76){return _0x223f76[_0xed65('0x21')]()[_0xed65('0x22')](function(){var _0x76e8c2=_0x223f76[_0xed65('0x23')]({'plain':!![]});var _0x2bc217=_0xed65('0x24');return db[_0xed65('0x25')]['destroy']({'where':{'type':_0x2bc217,'resourceId':_0x76e8c2['id']}})[_0xed65('0x22')](function(){return _0x223f76;});})[_0xed65('0x22')](function(){_0x21743d['status'](0xcc)[_0xed65('0x16')]();});}};}function handleEntityNotFound(_0x3dec8a,_0xa9952d){return function(_0x4a22d5){if(!_0x4a22d5){_0x3dec8a['sendStatus'](0x194);}return _0x4a22d5;};}function handleError(_0x36f587,_0x49e009){_0x49e009=_0x49e009||0x1f4;return function(_0x480144){logger[_0xed65('0x26')](_0x480144[_0xed65('0x27')]);if(_0x480144[_0xed65('0x28')]){delete _0x480144[_0xed65('0x28')];}_0x36f587[_0xed65('0x15')](_0x49e009)[_0xed65('0x29')](_0x480144);};}exports['index']=function(_0x3ef6b1,_0x3dd418){var _0x2cc40c={},_0x433255={},_0x572797={'count':0x0,'rows':[]};return db[_0xed65('0x2a')][_0xed65('0x2b')]()[_0xed65('0x22')](function(_0x3377f1){_0x433255['model']=_[_0xed65('0x2c')](_0x3377f1);_0x433255[_0xed65('0x2d')]=_[_0xed65('0x2c')](_0x3ef6b1[_0xed65('0x2d')]);_0x433255[_0xed65('0x2e')]=_[_0xed65('0x2f')](_0x433255['model'],_0x433255[_0xed65('0x2d')]);_0x2cc40c[_0xed65('0x30')]=_[_0xed65('0x2f')](_0x433255[_0xed65('0x31')],qs[_0xed65('0x32')](_0x3ef6b1[_0xed65('0x2d')][_0xed65('0x32')]));_0x2cc40c[_0xed65('0x30')]=_0x2cc40c[_0xed65('0x30')][_0xed65('0x33')]?_0x2cc40c[_0xed65('0x30')]:_0x433255[_0xed65('0x31')];if(!_0x3ef6b1[_0xed65('0x2d')]['hasOwnProperty']('nolimit')){_0x2cc40c[_0xed65('0x19')]=qs[_0xed65('0x19')](_0x3ef6b1[_0xed65('0x2d')][_0xed65('0x19')]);_0x2cc40c['offset']=qs['offset'](_0x3ef6b1['query'][_0xed65('0x18')]);}_0x2cc40c['order']=qs[_0xed65('0x34')](_0x3ef6b1[_0xed65('0x2d')][_0xed65('0x34')]);_0x2cc40c[_0xed65('0x35')]=qs[_0xed65('0x2e')](_['pick'](_0x3ef6b1[_0xed65('0x2d')],_0x433255['filters']),_0x3377f1);if(_0x3ef6b1['query']['filter']){_0x2cc40c['where']=_[_0xed65('0x36')](_0x2cc40c[_0xed65('0x35')],{'$or':_[_0xed65('0x37')](_0x2cc40c[_0xed65('0x30')],function(_0x5b2958){var _0x43ff94={};_0x43ff94[_0x5b2958]={'$like':'%'+_0x3ef6b1['query'][_0xed65('0x38')]+'%'};return _0x43ff94;})});}_0x2cc40c=_[_0xed65('0x36')]({},_0x2cc40c,_0x3ef6b1[_0xed65('0x39')]);var _0x4eeaae={'where':_0x2cc40c[_0xed65('0x35')]};return db['CmCompany'][_0xed65('0x1b')](_0x4eeaae)[_0xed65('0x22')](function(_0x34ed6a){_0x572797[_0xed65('0x1b')]=_0x34ed6a;if(_0x3ef6b1[_0xed65('0x2d')][_0xed65('0x3a')]){_0x2cc40c[_0xed65('0x3b')]=[{'all':!![]}];}return db[_0xed65('0x2a')][_0xed65('0x3c')](_0x2cc40c);})[_0xed65('0x22')](function(_0x3ce60a){_0x572797[_0xed65('0x3d')]=_0x3ce60a;return _0x572797;})[_0xed65('0x22')](respondWithFilteredResult(_0x3dd418,_0x2cc40c))[_0xed65('0x3e')](handleError(_0x3dd418,null));})[_0xed65('0x3e')](handleError(_0x3dd418,null));};exports[_0xed65('0x3f')]=function(_0x7ba081,_0x4b153d){var _0x5a6167={'raw':![],'where':{'id':_0x7ba081[_0xed65('0x40')]['id']}},_0xbc0234={};_0xbc0234[_0xed65('0x31')]=_[_0xed65('0x2c')](db[_0xed65('0x2a')]['rawAttributes']);_0xbc0234[_0xed65('0x2d')]=_[_0xed65('0x2c')](_0x7ba081[_0xed65('0x2d')]);_0xbc0234[_0xed65('0x2e')]=_['intersection'](_0xbc0234[_0xed65('0x31')],_0xbc0234[_0xed65('0x2d')]);_0x5a6167[_0xed65('0x30')]=_[_0xed65('0x2f')](_0xbc0234['model'],qs[_0xed65('0x32')](_0x7ba081[_0xed65('0x2d')][_0xed65('0x32')]));_0x5a6167[_0xed65('0x30')]=_0x5a6167[_0xed65('0x30')]['length']?_0x5a6167[_0xed65('0x30')]:_0xbc0234[_0xed65('0x31')];if(_0x7ba081[_0xed65('0x2d')]['includeAll']){_0x5a6167[_0xed65('0x3b')]=[{'all':!![]}];}_0x5a6167=_[_0xed65('0x36')]({},_0x5a6167,_0x7ba081['options']);return db['CmCompany'][_0xed65('0x41')](_0x5a6167)[_0xed65('0x22')](handleEntityNotFound(_0x4b153d,null))['then'](respondWithResult(_0x4b153d,null))[_0xed65('0x3e')](handleError(_0x4b153d,null));};exports[_0xed65('0x42')]=function(_0x345a8a,_0x36e3be){return db[_0xed65('0x2a')][_0xed65('0x42')](_0x345a8a[_0xed65('0x43')],{})[_0xed65('0x22')](function(_0x1cb42f){var _0x115050=_0x345a8a['user']['get']({'plain':!![]});if(!_0x115050)throw new Error(_0xed65('0x44'));if(_0x115050['role']===_0xed65('0x45')){var _0x1a4af=_0x1cb42f[_0xed65('0x23')]({'plain':!![]});var _0x5558c9=_0xed65('0x24');return db[_0xed65('0x46')]['find']({'where':{'name':_0x5558c9,'userProfileId':_0x115050[_0xed65('0x47')]},'raw':!![]})[_0xed65('0x22')](function(_0x404566){if(_0x404566&&_0x404566[_0xed65('0x48')]===0x0){return db[_0xed65('0x25')][_0xed65('0x42')]({'name':_0x1a4af[_0xed65('0x28')],'resourceId':_0x1a4af['id'],'type':_0x404566[_0xed65('0x28')],'sectionId':_0x404566['id']},{})['then'](function(){return _0x1cb42f;});}else{return _0x1cb42f;}})[_0xed65('0x3e')](function(_0x26946a){logger[_0xed65('0x26')](_0xed65('0x49'),_0x26946a);throw _0x26946a;});}return _0x1cb42f;})['then'](respondWithResult(_0x36e3be,0xc9))[_0xed65('0x3e')](handleError(_0x36e3be,null));};exports[_0xed65('0x20')]=function(_0x58d844,_0x3cfac4){if(_0x58d844['body']['id']){delete _0x58d844['body']['id'];}return db['CmCompany'][_0xed65('0x41')]({'where':{'id':_0x58d844[_0xed65('0x40')]['id']}})[_0xed65('0x22')](handleEntityNotFound(_0x3cfac4,null))[_0xed65('0x22')](saveUpdates(_0x58d844[_0xed65('0x43')],null))[_0xed65('0x22')](respondWithResult(_0x3cfac4,null))[_0xed65('0x3e')](handleError(_0x3cfac4,null));};exports[_0xed65('0x21')]=function(_0x3ebf81,_0xab3eb8){return db['CmCompany'][_0xed65('0x41')]({'where':{'id':_0x3ebf81[_0xed65('0x40')]['id']}})[_0xed65('0x22')](handleEntityNotFound(_0xab3eb8,null))[_0xed65('0x22')](removeEntity(_0xab3eb8,null))[_0xed65('0x3e')](handleError(_0xab3eb8,null));};exports[_0xed65('0x2b')]=function(_0x242053,_0x568a0d){return db[_0xed65('0x2a')][_0xed65('0x2b')]()[_0xed65('0x22')](respondWithResult(_0x568a0d,null))['catch'](handleError(_0x568a0d,null));};exports[_0xed65('0x4a')]=function(_0x506024,_0x4d2541,_0x57db0e){return db['CmContact'][_0xed65('0x41')]({'where':{'id':_0x506024[_0xed65('0x40')]['id']}})[_0xed65('0x22')](handleEntityNotFound(_0x4d2541,null))[_0xed65('0x22')](function(_0x4b1f9d){if(_0x4b1f9d){return _0x4b1f9d['addContacts'](_0x506024[_0xed65('0x43')][_0xed65('0x4b')],_['omit'](_0x506024[_0xed65('0x43')],[_0xed65('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x4d2541,null))['catch'](handleError(_0x4d2541,null));};exports[_0xed65('0x4c')]=function(_0x510ac8,_0x1e31a8,_0xd5e267){var _0x1c240e={};var _0x317950={};var _0x3fd37c;var _0x8e9f22;return db[_0xed65('0x2a')]['findOne']({'where':{'id':_0x510ac8[_0xed65('0x40')]['id']}})['then'](handleEntityNotFound(_0x1e31a8,null))[_0xed65('0x22')](function(_0x5cbe08){if(_0x5cbe08){_0x3fd37c=_0x5cbe08;_0x317950[_0xed65('0x31')]=_[_0xed65('0x2c')](db[_0xed65('0x4d')][_0xed65('0x4e')]);_0x317950[_0xed65('0x2d')]=_[_0xed65('0x2c')](_0x510ac8[_0xed65('0x2d')]);_0x317950['filters']=_[_0xed65('0x2f')](_0x317950[_0xed65('0x31')],_0x317950['query']);_0x1c240e[_0xed65('0x30')]=_[_0xed65('0x2f')](_0x317950[_0xed65('0x31')],qs[_0xed65('0x32')](_0x510ac8['query'][_0xed65('0x32')]));_0x1c240e[_0xed65('0x30')]=_0x1c240e[_0xed65('0x30')][_0xed65('0x33')]?_0x1c240e[_0xed65('0x30')]:_0x317950[_0xed65('0x31')];_0x1c240e[_0xed65('0x4f')]=qs[_0xed65('0x34')](_0x510ac8[_0xed65('0x2d')][_0xed65('0x34')]);_0x1c240e[_0xed65('0x35')]=qs[_0xed65('0x2e')](_[_0xed65('0x50')](_0x510ac8[_0xed65('0x2d')],_0x317950['filters']));if(_0x510ac8[_0xed65('0x2d')][_0xed65('0x38')]){_0x1c240e['where']=_[_0xed65('0x36')](_0x1c240e['where'],{'$or':_[_0xed65('0x37')](_0x1c240e['attributes'],function(_0x469a8a){var _0x538e5={};_0x538e5[_0x469a8a]={'$like':'%'+_0x510ac8[_0xed65('0x2d')][_0xed65('0x38')]+'%'};return _0x538e5;})});}_0x1c240e=_[_0xed65('0x36')]({},_0x1c240e,_0x510ac8[_0xed65('0x39')]);return _0x3fd37c[_0xed65('0x4c')](_0x1c240e);}})['then'](function(_0x187bdb){if(_0x187bdb){_0x8e9f22=_0x187bdb[_0xed65('0x33')];if(!_0x510ac8['query']['hasOwnProperty'](_0xed65('0x51'))){_0x1c240e[_0xed65('0x19')]=qs[_0xed65('0x19')](_0x510ac8[_0xed65('0x2d')][_0xed65('0x19')]);_0x1c240e[_0xed65('0x18')]=qs[_0xed65('0x18')](_0x510ac8[_0xed65('0x2d')][_0xed65('0x18')]);}return _0x3fd37c[_0xed65('0x4c')](_0x1c240e);}})[_0xed65('0x22')](function(_0xd7d55e){if(_0xd7d55e){return _0xd7d55e?{'count':_0x8e9f22,'rows':_0xd7d55e}:null;}})[_0xed65('0x22')](respondWithResult(_0x1e31a8,null))[_0xed65('0x3e')](handleError(_0x1e31a8,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index ec76bb6..f8969ac 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 _0xbce0=['exports','define','cm_companies','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x207811,_0x3420a6){var _0x170d56=function(_0x4340b7){while(--_0x4340b7){_0x207811['push'](_0x207811['shift']());}};_0x170d56(++_0x3420a6);}(_0xbce0,0x8f));var _0x0bce=function(_0x45e3aa,_0x54ed77){_0x45e3aa=_0x45e3aa-0x0;var _0x2e1753=_0xbce0[_0x45e3aa];return _0x2e1753;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0bce('0x0'))(_0x0bce('0x1'));var moment=require('moment');var BPromise=require(_0x0bce('0x2'));var rp=require(_0x0bce('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0bce('0x4'));var config=require(_0x0bce('0x5'));var attributes=require(_0x0bce('0x6'));module[_0x0bce('0x7')]=function(_0x21793f,_0x262a0e){return _0x21793f[_0x0bce('0x8')]('CmCompany',attributes,{'tableName':_0x0bce('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c98=['request-promise','path','./cmCompany.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1bccc6,_0x2c4c93){var _0x2a6443=function(_0x218b56){while(--_0x218b56){_0x1bccc6['push'](_0x1bccc6['shift']());}};_0x2a6443(++_0x2c4c93);}(_0x1c98,0x1b2));var _0x81c9=function(_0x875f59,_0x40aa8d){_0x875f59=_0x875f59-0x0;var _0x30f778=_0x1c98[_0x875f59];return _0x30f778;};'use strict';var _=require(_0x81c9('0x0'));var util=require(_0x81c9('0x1'));var logger=require(_0x81c9('0x2'))(_0x81c9('0x3'));var moment=require(_0x81c9('0x4'));var BPromise=require(_0x81c9('0x5'));var rp=require(_0x81c9('0x6'));var fs=require('fs');var path=require(_0x81c9('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x81c9('0x8'));module[_0x81c9('0x9')]=function(_0x26ad20,_0x2fa006){return _0x26ad20[_0x81c9('0xa')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 2eabf8a..9508837 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 _0x852d=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x204706,_0x299b1d){var _0x397322=function(_0x3a0320){while(--_0x3a0320){_0x204706['push'](_0x204706['shift']());}};_0x397322(++_0x299b1d);}(_0x852d,0x128));var _0xd852=function(_0x5313bf,_0x5ae17b){_0x5313bf=_0x5313bf-0x0;var _0x5913b2=_0x852d[_0x5313bf];return _0x5913b2;};'use strict';var _=require('lodash');var util=require(_0xd852('0x0'));var moment=require(_0xd852('0x1'));var BPromise=require(_0xd852('0x2'));var rs=require(_0xd852('0x3'));var fs=require('fs');var Redis=require(_0xd852('0x4'));var db=require(_0xd852('0x5'))['db'];var utils=require(_0xd852('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd852('0x7'));var client=jayson['client'][_0xd852('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10d087,_0x377a5b,_0x7129c1){return new BPromise(function(_0x3b5c59,_0x2f1db){return client[_0xd852('0x9')](_0x10d087,_0x7129c1)[_0xd852('0xa')](function(_0x3d9aff){logger[_0xd852('0xb')](_0xd852('0xc'),_0x377a5b,_0xd852('0xd'));logger[_0xd852('0xe')](_0xd852('0xf'),_0x377a5b,_0xd852('0xd'),JSON[_0xd852('0x10')](_0x3d9aff));if(_0x3d9aff['error']){if(_0x3d9aff['error']['code']===0x1f4){logger[_0xd852('0x11')](_0xd852('0xc'),_0x377a5b,_0x3d9aff[_0xd852('0x11')][_0xd852('0x12')]);return _0x2f1db(_0x3d9aff['error']['message']);}logger[_0xd852('0x11')]('CmCompany,\x20%s,\x20%s',_0x377a5b,_0x3d9aff[_0xd852('0x11')][_0xd852('0x12')]);return _0x3b5c59(_0x3d9aff[_0xd852('0x11')][_0xd852('0x12')]);}else{logger[_0xd852('0xb')](_0xd852('0xc'),_0x377a5b,_0xd852('0xd'));_0x3b5c59(_0x3d9aff[_0xd852('0x13')][_0xd852('0x12')]);}})[_0xd852('0x14')](function(_0x2e31ad){logger['error'](_0xd852('0xc'),_0x377a5b,_0x2e31ad);_0x2f1db(_0x2e31ad);});});} \ No newline at end of file +var _0xce06=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xce06,0x64));var _0x6ce0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xce06[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6ce0('0x0'));var util=require(_0x6ce0('0x1'));var moment=require(_0x6ce0('0x2'));var BPromise=require(_0x6ce0('0x3'));var rs=require(_0x6ce0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ce0('0x5'))['db'];var utils=require(_0x6ce0('0x6'));var logger=require('../../config/logger')(_0x6ce0('0x7'));var config=require(_0x6ce0('0x8'));var jayson=require(_0x6ce0('0x9'));var client=jayson['client'][_0x6ce0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17a647,_0x4a6de7,_0x4ca3e7){return new BPromise(function(_0x502424,_0x38c707){return client[_0x6ce0('0xb')](_0x17a647,_0x4ca3e7)['then'](function(_0x19aa2b){logger['info'](_0x6ce0('0xc'),_0x4a6de7,_0x6ce0('0xd'));logger[_0x6ce0('0xe')](_0x6ce0('0xf'),_0x4a6de7,_0x6ce0('0xd'),JSON[_0x6ce0('0x10')](_0x19aa2b));if(_0x19aa2b[_0x6ce0('0x11')]){if(_0x19aa2b['error']['code']===0x1f4){logger[_0x6ce0('0x11')](_0x6ce0('0xc'),_0x4a6de7,_0x19aa2b[_0x6ce0('0x11')][_0x6ce0('0x12')]);return _0x38c707(_0x19aa2b[_0x6ce0('0x11')][_0x6ce0('0x12')]);}logger[_0x6ce0('0x11')](_0x6ce0('0xc'),_0x4a6de7,_0x19aa2b['error']['message']);return _0x502424(_0x19aa2b[_0x6ce0('0x11')][_0x6ce0('0x12')]);}else{logger[_0x6ce0('0x13')]('CmCompany,\x20%s,\x20%s',_0x4a6de7,'request\x20sent');_0x502424(_0x19aa2b[_0x6ce0('0x14')][_0x6ce0('0x12')]);}})['catch'](function(_0x5a09bf){logger['error'](_0x6ce0('0xc'),_0x4a6de7,_0x5a09bf);_0x38c707(_0x5a09bf);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index a19c40f..e9e534c 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 _0xee4c=['/:id','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','show','/:id/contacts','getContacts','create','addContacts','put'];(function(_0x39d7ce,_0x53e242){var _0x49f81e=function(_0x178b9e){while(--_0x178b9e){_0x39d7ce['push'](_0x39d7ce['shift']());}};_0x49f81e(++_0x53e242);}(_0xee4c,0x193));var _0xcee4=function(_0x3c4cac,_0x5f57c1){_0x3c4cac=_0x3c4cac-0x0;var _0x395e6f=_0xee4c[_0x3c4cac];return _0x395e6f;};'use strict';var multer=require(_0xcee4('0x0'));var util=require(_0xcee4('0x1'));var path=require(_0xcee4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcee4('0x3')]();var fs_extra=require(_0xcee4('0x4'));var auth=require(_0xcee4('0x5'));var interaction=require(_0xcee4('0x6'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router['get']('/',auth[_0xcee4('0x7')](),controller[_0xcee4('0x8')]);router[_0xcee4('0x9')](_0xcee4('0xa'),auth[_0xcee4('0x7')](),controller['describe']);router[_0xcee4('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xcee4('0xb')]);router[_0xcee4('0x9')](_0xcee4('0xc'),auth[_0xcee4('0x7')](),controller[_0xcee4('0xd')]);router['post']('/',auth[_0xcee4('0x7')](),controller[_0xcee4('0xe')]);router['post']('/:id/contacts',auth[_0xcee4('0x7')](),controller[_0xcee4('0xf')]);router[_0xcee4('0x10')](_0xcee4('0x11'),auth[_0xcee4('0x7')](),controller['update']);router[_0xcee4('0x12')](_0xcee4('0x11'),auth[_0xcee4('0x7')](),controller[_0xcee4('0x13')]);module[_0xcee4('0x14')]=router; \ No newline at end of file +var _0x34dd=['getContacts','post','create','/:id/contacts','addContacts','put','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x52c2bc,_0x5beba9){var _0x223927=function(_0x20a69e){while(--_0x20a69e){_0x52c2bc['push'](_0x52c2bc['shift']());}};_0x223927(++_0x5beba9);}(_0x34dd,0xa2));var _0xd34d=function(_0x567ef1,_0x67a493){_0x567ef1=_0x567ef1-0x0;var _0x3234c2=_0x34dd[_0x567ef1];return _0x3234c2;};'use strict';var multer=require(_0xd34d('0x0'));var util=require(_0xd34d('0x1'));var path=require(_0xd34d('0x2'));var timeout=require('connect-timeout');var express=require(_0xd34d('0x3'));var router=express[_0xd34d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd34d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd34d('0x6'));var controller=require(_0xd34d('0x7'));router[_0xd34d('0x8')]('/',auth[_0xd34d('0x9')](),controller[_0xd34d('0xa')]);router[_0xd34d('0x8')]('/describe',auth[_0xd34d('0x9')](),controller[_0xd34d('0xb')]);router[_0xd34d('0x8')](_0xd34d('0xc'),auth['isAuthenticated'](),controller[_0xd34d('0xd')]);router[_0xd34d('0x8')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xd34d('0xe')]);router[_0xd34d('0xf')]('/',auth[_0xd34d('0x9')](),controller[_0xd34d('0x10')]);router[_0xd34d('0xf')](_0xd34d('0x11'),auth['isAuthenticated'](),controller[_0xd34d('0x12')]);router[_0xd34d('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd34d('0x14')](_0xd34d('0xc'),auth[_0xd34d('0x9')](),controller[_0xd34d('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 2af70c9..66c77f0 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 _0xee24=['UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','INTEGER'];(function(_0x253c92,_0x12b7c7){var _0x530d4a=function(_0x935403){while(--_0x935403){_0x253c92['push'](_0x253c92['shift']());}};_0x530d4a(++_0x12b7c7);}(_0xee24,0x183));var _0x4ee2=function(_0x34bf03,_0x7ebc65){_0x34bf03=_0x34bf03-0x0;var _0x478925=_0xee24[_0x34bf03];return _0x478925;};'use strict';var _=require(_0x4ee2('0x0'));var Sequelize=require(_0x4ee2('0x1'));module[_0x4ee2('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x4ee2('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x4ee2('0x3')]},'city':{'type':Sequelize[_0x4ee2('0x3')]},'country':{'type':Sequelize[_0x4ee2('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x4ee2('0x3')]},'fax':{'type':Sequelize[_0x4ee2('0x3')]},'email':{'type':Sequelize[_0x4ee2('0x3')]},'url':{'type':Sequelize[_0x4ee2('0x3')]},'facebook':{'type':Sequelize[_0x4ee2('0x3')]},'fb_data':{'type':Sequelize[_0x4ee2('0x3')]},'twitter':{'type':Sequelize[_0x4ee2('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x4ee2('0x3')]},'viber':{'type':Sequelize[_0x4ee2('0x3')]},'line':{'type':Sequelize[_0x4ee2('0x3')]},'wechat':{'type':Sequelize[_0x4ee2('0x3')]},'telegram':{'type':Sequelize[_0x4ee2('0x3')]},'UserId':{'type':Sequelize[_0x4ee2('0x4')]},'priority':{'type':Sequelize[_0x4ee2('0x4')](0x2)[_0x4ee2('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x4ee2('0x6')],'defaultValue':Sequelize[_0x4ee2('0x7')]}}; \ No newline at end of file +var _0xdf19=['STRING','INTEGER','DATE','lodash','exports'];(function(_0x37c1bc,_0x40ea8b){var _0x3f3b6e=function(_0x44778e){while(--_0x44778e){_0x37c1bc['push'](_0x37c1bc['shift']());}};_0x3f3b6e(++_0x40ea8b);}(_0xdf19,0x1ed));var _0x9df1=function(_0x2512fd,_0x5f5bfd){_0x2512fd=_0x2512fd-0x0;var _0x576639=_0xdf19[_0x2512fd];return _0x576639;};'use strict';var _=require(_0x9df1('0x0'));var Sequelize=require('sequelize');module[_0x9df1('0x1')]={'firstName':{'type':Sequelize[_0x9df1('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x9df1('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x9df1('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x9df1('0x2')]},'facebook':{'type':Sequelize[_0x9df1('0x2')]},'fb_data':{'type':Sequelize[_0x9df1('0x2')]},'twitter':{'type':Sequelize[_0x9df1('0x2')]},'skype':{'type':Sequelize[_0x9df1('0x2')]},'teams':{'type':Sequelize[_0x9df1('0x2')]},'viber':{'type':Sequelize[_0x9df1('0x2')]},'line':{'type':Sequelize[_0x9df1('0x2')]},'wechat':{'type':Sequelize[_0x9df1('0x2')]},'telegram':{'type':Sequelize[_0x9df1('0x2')]},'UserId':{'type':Sequelize[_0x9df1('0x3')]},'priority':{'type':Sequelize[_0x9df1('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9df1('0x4')],'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 4e62e2d..e98a633 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 _0x8710=['binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','import','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','getJourney','mail','chat','sms','fax','whatsapp','voice','-createdAt','channel','Invalid\x20channel','toLowerCase','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','startCase','Website','closed','secondDisposition','thirdDisposition','Account','browserName','osName','ratingMessage','ratingType','ratingValue','referer','subject','openchannel','externalUrl','threadId','findAndCountAll','Owner','flatten','sortBy','reverse','slice','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','CmContact','describe','length','keys','startsWith','push','findOne','cf_','all','fieldType','type','model','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','select','field','color','from','tools_tags','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','find','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','dateOfBirth','datetime','castTo','text','start','filter','isNil','Contact','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','isArray','tag','replace','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','group','c.id','Sequelize','SELECT','DESC','having','t.id\x20IN\x20?','resolve','user','role','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','agent','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','params','tags','columnName','displayName','CmCustomField','findAll','alias','values','catch','body','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappQueueReport','bulkCreate','duplicates','$or','findOrCreate','$and','omit','format','cf_%d','pickBy','cm_contacts','id\x20=\x20?','phone','getTags','pick','options','setTags','ids','getHoppers','rawAttributes','includeAll','include','getHopperHistories','CmHopperHistory','ContactId','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed'];(function(_0x4a2995,_0x3644c9){var _0x5141dd=function(_0x30dcfc){while(--_0x30dcfc){_0x4a2995['push'](_0x4a2995['shift']());}};_0x5141dd(++_0x3644c9);}(_0x8710,0x16d));var _0x0871=function(_0x3b525b,_0x43cd){_0x3b525b=_0x3b525b-0x0;var _0x5474b4=_0x8710[_0x3b525b];return _0x5474b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0871('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0871('0x1'));var moment=require(_0x0871('0x2'));var BPromise=require(_0x0871('0x3'));var Mustache=require(_0x0871('0x4'));var util=require(_0x0871('0x5'));var path=require(_0x0871('0x6'));var sox=require('sox');var csv=require(_0x0871('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0871('0x8'));var _=require(_0x0871('0x9'));var squel=require(_0x0871('0xa'));var crypto=require(_0x0871('0xb'));var jsforce=require(_0x0871('0xc'));var deskjs=require(_0x0871('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0871('0xe'));var Papa=require('papaparse');var Redis=require(_0x0871('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0871('0x10'));var as=require(_0x0871('0x11'));var hardwareService=require(_0x0871('0x12'));var logger=require('../../config/logger')(_0x0871('0x13'));var utils=require(_0x0871('0x14'));var config=require(_0x0871('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0871('0x16'))['db'];config[_0x0871('0x17')]=_[_0x0871('0x18')](config[_0x0871('0x17')],{'host':_0x0871('0x19'),'port':0x18eb});var socket=require(_0x0871('0x1a'))(new Redis(config[_0x0871('0x17')]));require('./cmContact.socket')['register'](socket);function respondWithStatusCode(_0x3314d9,_0x1a5f69){_0x1a5f69=_0x1a5f69||0xcc;return function(_0x532a44){if(_0x532a44){return _0x3314d9['sendStatus'](_0x1a5f69);}return _0x3314d9['status'](_0x1a5f69)['end']();};}function respondWithResult(_0x426d73,_0x269373){_0x269373=_0x269373||0xc8;return function(_0x2f49a2){if(_0x2f49a2){return _0x426d73['status'](_0x269373)[_0x0871('0x1b')](_0x2f49a2);}};}function respondWithFilteredResult(_0x439c1e,_0x93a51a){return function(_0x27ac22){if(_0x27ac22){var _0x22f46e=typeof _0x93a51a[_0x0871('0x1c')]===_0x0871('0x1d')&&typeof _0x93a51a[_0x0871('0x1e')]===_0x0871('0x1d');var _0x2d16cc=_0x27ac22[_0x0871('0x1f')];var _0xda897f=_0x22f46e?0x0:_0x93a51a[_0x0871('0x1c')];var _0x5c0c46=_0x22f46e?_0x27ac22[_0x0871('0x1f')]:_0x93a51a[_0x0871('0x1c')]+_0x93a51a['limit'];var _0x468898;if(_0x5c0c46>=_0x2d16cc){_0x5c0c46=_0x2d16cc;_0x468898=0xc8;}else{_0x468898=0xce;}_0x439c1e[_0x0871('0x20')](_0x468898);return _0x439c1e['set'](_0x0871('0x21'),_0xda897f+'-'+_0x5c0c46+'/'+_0x2d16cc)[_0x0871('0x1b')](_0x27ac22);}return null;};}function patchUpdates(_0x2cbe02){return function(_0x50ee89){try{jsonpatch[_0x0871('0x22')](_0x50ee89,_0x2cbe02,!![]);}catch(_0x5807a7){return BPromise[_0x0871('0x23')](_0x5807a7);}return _0x50ee89[_0x0871('0x24')]();};}function saveUpdates(_0x5e1227,_0x1f5313){return function(_0x1a88e1){if(_0x1a88e1){return _0x1a88e1[_0x0871('0x25')](_0x5e1227)[_0x0871('0x26')](function(_0x56fe14){return _0x56fe14;});}return null;};}function removeEntity(_0x1a0bd1,_0x5708af){return function(_0x7aec58){if(_0x7aec58){return _0x7aec58[_0x0871('0x27')]()[_0x0871('0x26')](function(){_0x1a0bd1[_0x0871('0x20')](0xcc)[_0x0871('0x28')]();});}};}function handleEntityNotFound(_0x10b9ea,_0x41726f){return function(_0x585571){if(!_0x585571){_0x10b9ea[_0x0871('0x29')](0x194);}return _0x585571;};}function handleError(_0x4f6f1b,_0x260107){_0x260107=_0x260107||0x1f4;return function(_0x4e695d){logger['error'](_0x4e695d[_0x0871('0x2a')]);if(_0x4e695d[_0x0871('0x2b')]){delete _0x4e695d[_0x0871('0x2b')];}_0x4f6f1b['status'](_0x260107)[_0x0871('0x2c')](_0x4e695d);};}exports[_0x0871('0x2d')]=function(_0x1cb3ff,_0x3ec97b){var _0x29eeee={},_0x164e01={},_0x333010={'count':0x0,'rows':[]};return db[_0x0871('0x2e')][_0x0871('0x2f')]()['then'](function(_0x456904){var _0x2bf7f5=[];for(var _0x38be8b=0x0;_0x38be8b0x1){_0x32951e['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5654c5),null);}else{if(qs[_0x0871('0x6d')](_0x5654c5)){_0x32951e['or'](_0x0871('0x6e'),_0x5654c5+'%');_0x32951e['or'](_0x0871('0x6f'),_0x5654c5+'%');_0x32951e['or'](_0x0871('0x70'),_0x5654c5+'%');_0x32951e['or'](_0x0871('0x71'),_0x5654c5+'%');}else if(qs['isEmail'](_0x5654c5)){_0x32951e['or'](_0x0871('0x72'),_0x5654c5+'%');}else{_0x32951e['or']('c.firstName\x20LIKE\x20?','%'+_0x5654c5+'%');_0x32951e['or']('c.lastName\x20LIKE\x20?','%'+_0x5654c5+'%');_0x32951e['or']('c.email\x20LIKE\x20?','%'+_0x5654c5+'%');}}}}_0x495f09['where'](_0x32951e);_0x495f09[_0x0871('0x73')](_0x0871('0x74'));var _0x59d8ae={'type':db[_0x0871('0x75')]['QueryTypes'][_0x0871('0x76')],'raw':!![]};var _0x544ea0=_0x495f09['clone']()[_0x0871('0x45')](_0x0871('0x74'));if(_0x29eeee[_0x0871('0x40')]){_0x29eeee[_0x0871('0x40')][_0x0871('0x59')](function(_0x75418b){_0x495f09[_0x0871('0x40')]('c.'+_0x75418b[0x0],_0x75418b[0x1]===_0x0871('0x77')?![]:!![]);});}if(!_[_0x0871('0x66')](_0x48fdc4)){_0x495f09[_0x0871('0x78')](_0x5cf513);_0x544ea0[_0x0871('0x42')](_0x0871('0x79'),_0x48fdc4);}BPromise[_0x0871('0x7a')]()[_0x0871('0x26')](function(){if(!_0x48a6e1)return;if(_0x1cb3ff[_0x0871('0x7b')][_0x0871('0x7c')]!=='agent')return;if(!_['some'](_0x48a6e1['conditions'],['field','User'])){return _0x1cb3ff[_0x0871('0x7b')]['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x26ee57){if(_[_0x0871('0x66')](_0x26ee57)){_0x544ea0[_0x0871('0x42')](_0x0871('0x7d'));_0x495f09[_0x0871('0x42')](_0x0871('0x7d'));}else{_0x544ea0[_0x0871('0x42')](_0x0871('0x7e'),_[_0x0871('0x58')](_0x26ee57,'id'));_0x495f09[_0x0871('0x42')](_0x0871('0x7e'),_['map'](_0x26ee57,'id'));}});}})[_0x0871('0x26')](function(){if(_0x1cb3ff['user'][_0x0871('0x7c')]===_0x0871('0x7f')&&!_0x48a6e1&&!_0x1cb3ff['query'][_0x0871('0x67')])return[];return db[_0x0871('0x80')][_0x0871('0x3b')](_0x544ea0[_0x0871('0x81')](),_0x59d8ae);})[_0x0871('0x26')](function(_0x3c5e38){_0x333010['count']=_0x3c5e38[_0x0871('0x30')];if(_0x333010['count']===0x0)return[];return db[_0x0871('0x80')][_0x0871('0x3b')](_0xb8f913[_0x0871('0x81')](),_0x59d8ae)[_0x0871('0x26')](function(_0x3183e6){_0x335a93=_[_0x0871('0x82')](_0x3183e6,'id');_0x59d8ae=_[_0x0871('0x83')](_0x59d8ae,{'model':db[_0x0871('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1cb3ff[_0x0871('0x3b')][_0x0871('0x3d')]){_0x29eeee['attributes'][_0x0871('0x59')](function(_0x86e9b2){_0x495f09[_0x0871('0x45')]('c.'+_0x86e9b2);});}else{_0x495f09[_0x0871('0x45')]('c.id');_0x495f09['field'](_0x0871('0x84'));_0x495f09['field'](_0x0871('0x85'));_0x495f09[_0x0871('0x45')](_0x0871('0x86'));_0x495f09[_0x0871('0x45')](_0x0871('0x87'));_0x495f09[_0x0871('0x45')](_0x0871('0x88'));_0x495f09['field'](_0x0871('0x89'));_0x495f09[_0x0871('0x45')](_0x0871('0x8a'));_0x495f09[_0x0871('0x45')]('c.createdAt');_0x495f09[_0x0871('0x45')]('c.deletedAt');_0x495f09[_0x0871('0x45')](_0x0871('0x8b'));_0x495f09['field'](_0x0871('0x8c'),'TagIds');}if(_0x29eeee[_0x0871('0x1e')])_0x495f09[_0x0871('0x1e')](_0x29eeee[_0x0871('0x1e')]);if(_0x29eeee[_0x0871('0x1c')])_0x495f09['offset'](_0x29eeee[_0x0871('0x1c')]);return db['sequelize']['query'](_0x495f09['toString'](),_0x59d8ae);});})[_0x0871('0x26')](function(_0x1d40ee){_0x1d40ee[_0x0871('0x59')](function(_0x42c7bc){if(_0x42c7bc[_0x0871('0x8d')]){_0x42c7bc[_0x0871('0x8e')]=[];_0x42c7bc[_0x0871('0x8d')][_0x0871('0x57')](',')['forEach'](function(_0x92fd8a){_0x42c7bc[_0x0871('0x8e')][_0x0871('0x33')](_0x335a93[_0x92fd8a]);});}delete _0x42c7bc[_0x0871('0x8d')];});_0x333010[_0x0871('0x8f')]=_0x1d40ee;return _0x333010;})['then'](respondWithFilteredResult(_0x3ec97b,_0x29eeee));})['catch'](handleError(_0x3ec97b,null));};exports['destroy']=function(_0x2536d7,_0x571107){return db[_0x0871('0x2e')][_0x0871('0x54')]({'where':{'id':_0x2536d7[_0x0871('0x90')]['id']}})[_0x0871('0x26')](handleEntityNotFound(_0x571107,null))['then'](removeEntity(_0x571107,null))['catch'](handleError(_0x571107,null));};exports[_0x0871('0x2f')]=function(_0x4bdfc5,_0x131542){return db[_0x0871('0x2e')][_0x0871('0x2f')]()[_0x0871('0x26')](function(_0x17a120){delete _0x17a120[_0x0871('0x91')];for(var _0x1be482=0x0;_0x1be482=_0x63b6ff){_0x33a13d=_0x63b6ff;_0x4be09a=0xc8;}else{_0x4be09a=0xce;}_0x57de0a[_0x6449('0x1e')](_0x4be09a);return _0x57de0a[_0x6449('0x24')](_0x6449('0x25'),_0xc62124+'-'+_0x33a13d+'/'+_0x63b6ff)[_0x6449('0x26')](_0x47b1ef);}return null;};}function patchUpdates(_0x1dfb35){return function(_0x2bf83c){try{jsonpatch[_0x6449('0x27')](_0x2bf83c,_0x1dfb35,!![]);}catch(_0x570550){return BPromise[_0x6449('0x28')](_0x570550);}return _0x2bf83c[_0x6449('0x29')]();};}function saveUpdates(_0x54c7a0,_0x1b2d13){return function(_0x410db9){if(_0x410db9){return _0x410db9[_0x6449('0x2a')](_0x54c7a0)[_0x6449('0x2b')](function(_0x373d34){return _0x373d34;});}return null;};}function removeEntity(_0x2c5c06,_0x48746f){return function(_0x27fa1f){if(_0x27fa1f){return _0x27fa1f['destroy']()[_0x6449('0x2b')](function(){_0x2c5c06[_0x6449('0x1e')](0xcc)[_0x6449('0x1f')]();});}};}function handleEntityNotFound(_0x352589,_0x1a0c52){return function(_0x50e8b2){if(!_0x50e8b2){_0x352589['sendStatus'](0x194);}return _0x50e8b2;};}function handleError(_0x1f0eec,_0x14ab16){_0x14ab16=_0x14ab16||0x1f4;return function(_0x40b3eb){logger[_0x6449('0x2c')](_0x40b3eb[_0x6449('0x2d')]);if(_0x40b3eb[_0x6449('0x2e')]){delete _0x40b3eb['name'];}_0x1f0eec[_0x6449('0x1e')](_0x14ab16)[_0x6449('0x2f')](_0x40b3eb);};}exports[_0x6449('0x30')]=function(_0x1acd0f,_0x583d82){var _0x1bfe69={},_0x59b9ab={},_0x3e36e7={'count':0x0,'rows':[]};return db[_0x6449('0x31')][_0x6449('0x32')]()[_0x6449('0x2b')](function(_0x5a443a){var _0x18d231=[];for(var _0x32d705=0x0;_0x32d7050x1){_0xefe09e['or'](_0x6449('0x71'),qs[_0x6449('0x72')](_0x2d1b48),null);}else{if(qs[_0x6449('0x73')](_0x2d1b48)){_0xefe09e['or'](_0x6449('0x74'),_0x2d1b48+'%');_0xefe09e['or'](_0x6449('0x75'),_0x2d1b48+'%');_0xefe09e['or'](_0x6449('0x76'),_0x2d1b48+'%');_0xefe09e['or'](_0x6449('0x77'),_0x2d1b48+'%');}else if(qs['isEmail'](_0x2d1b48)){_0xefe09e['or'](_0x6449('0x78'),_0x2d1b48+'%');}else{_0xefe09e['or'](_0x6449('0x79'),'%'+_0x2d1b48+'%');_0xefe09e['or'](_0x6449('0x7a'),'%'+_0x2d1b48+'%');_0xefe09e['or'](_0x6449('0x78'),'%'+_0x2d1b48+'%');}}}}_0x4721b3[_0x6449('0x52')](_0xefe09e);_0x4721b3[_0x6449('0x7b')](_0x6449('0x7c'));var _0x554faa={'type':db['Sequelize'][_0x6449('0x7d')][_0x6449('0x7e')],'raw':!![]};var _0x5c5260=_0x4721b3[_0x6449('0x7f')]()[_0x6449('0x47')](_0x6449('0x7c'));if(_0x1bfe69[_0x6449('0x43')]){_0x1bfe69[_0x6449('0x43')][_0x6449('0x5d')](function(_0x18857f){_0x4721b3[_0x6449('0x43')]('c.'+_0x18857f[0x0],_0x18857f[0x1]===_0x6449('0x80')?![]:!![]);});}if(!_[_0x6449('0x68')](_0x432534)){_0x4721b3[_0x6449('0x81')](_0x4330c1);_0x5c5260[_0x6449('0x52')]('t.id\x20IN\x20?',_0x432534);}BPromise[_0x6449('0x82')]()[_0x6449('0x2b')](function(){if(!_0x568a03)return;if(_0x1acd0f['user']['role']!==_0x6449('0x83'))return;if(!_[_0x6449('0x84')](_0x568a03[_0x6449('0x58')],['field','User'])){return _0x1acd0f['user']['getLists']({'attributes':['id'],'raw':!![]})[_0x6449('0x2b')](function(_0x2f7075){if(_[_0x6449('0x68')](_0x2f7075)){_0x5c5260[_0x6449('0x52')](_0x6449('0x85'));_0x4721b3[_0x6449('0x52')](_0x6449('0x85'));}else{_0x5c5260[_0x6449('0x52')](_0x6449('0x6a'),_['map'](_0x2f7075,'id'));_0x4721b3['where'](_0x6449('0x6a'),_[_0x6449('0x5c')](_0x2f7075,'id'));}});}})['then'](function(){if(_0x1acd0f[_0x6449('0x86')][_0x6449('0x87')]===_0x6449('0x83')&&!_0x568a03&&!_0x1acd0f['query'][_0x6449('0x69')])return[];return db['sequelize'][_0x6449('0x3d')](_0x5c5260[_0x6449('0x88')](),_0x554faa);})['then'](function(_0x32c630){_0x3e36e7[_0x6449('0x23')]=_0x32c630[_0x6449('0x34')];if(_0x3e36e7[_0x6449('0x23')]===0x0)return[];return db['sequelize'][_0x6449('0x3d')](_0x5a037d[_0x6449('0x88')](),_0x554faa)[_0x6449('0x2b')](function(_0xdbdb86){_0x4feb5b=_[_0x6449('0x89')](_0xdbdb86,'id');_0x554faa=_[_0x6449('0x8a')](_0x554faa,{'model':db[_0x6449('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1acd0f[_0x6449('0x3d')][_0x6449('0x3f')]){_0x1bfe69['attributes'][_0x6449('0x5d')](function(_0x252f8c){_0x4721b3[_0x6449('0x47')]('c.'+_0x252f8c);});}else{_0x4721b3[_0x6449('0x47')](_0x6449('0x7c'));_0x4721b3[_0x6449('0x47')](_0x6449('0x8b'));_0x4721b3[_0x6449('0x47')](_0x6449('0x8c'));_0x4721b3[_0x6449('0x47')](_0x6449('0x8d'));_0x4721b3[_0x6449('0x47')](_0x6449('0x8e'));_0x4721b3[_0x6449('0x47')]('c.fax');_0x4721b3[_0x6449('0x47')](_0x6449('0x8f'));_0x4721b3[_0x6449('0x47')](_0x6449('0x90'));_0x4721b3[_0x6449('0x47')](_0x6449('0x91'));_0x4721b3[_0x6449('0x47')]('c.deletedAt');_0x4721b3[_0x6449('0x47')]('c.CompanyId');_0x4721b3[_0x6449('0x47')](_0x6449('0x92'),_0x6449('0x93'));}if(_0x1bfe69['limit'])_0x4721b3[_0x6449('0x21')](_0x1bfe69[_0x6449('0x21')]);if(_0x1bfe69['offset'])_0x4721b3['offset'](_0x1bfe69[_0x6449('0x20')]);return db['sequelize']['query'](_0x4721b3[_0x6449('0x88')](),_0x554faa);});})[_0x6449('0x2b')](function(_0x4b25ff){_0x4b25ff[_0x6449('0x5d')](function(_0x30df63){if(_0x30df63[_0x6449('0x93')]){_0x30df63[_0x6449('0x94')]=[];_0x30df63[_0x6449('0x93')][_0x6449('0x5b')](',')[_0x6449('0x5d')](function(_0x43dbbb){_0x30df63[_0x6449('0x94')]['push'](_0x4feb5b[_0x43dbbb]);});}delete _0x30df63[_0x6449('0x93')];});_0x3e36e7[_0x6449('0x95')]=_0x4b25ff;return _0x3e36e7;})[_0x6449('0x2b')](respondWithFilteredResult(_0x583d82,_0x1bfe69));})[_0x6449('0x96')](handleError(_0x583d82,null));};exports[_0x6449('0x97')]=function(_0x3495e9,_0x31214b){return db[_0x6449('0x31')][_0x6449('0x59')]({'where':{'id':_0x3495e9[_0x6449('0x98')]['id']}})['then'](handleEntityNotFound(_0x31214b,null))[_0x6449('0x2b')](removeEntity(_0x31214b,null))['catch'](handleError(_0x31214b,null));};exports['describe']=function(_0x55ed5a,_0x1e46c8){return db[_0x6449('0x31')][_0x6449('0x32')]()[_0x6449('0x2b')](function(_0x43a0b6){delete _0x43a0b6[_0x6449('0x99')];for(var _0x3a0268=0x0;_0x3a0268{}\s\\|]/g,'-');_0x3b1d4b(null,util[_0xb42c('0x22')](_0xb42c('0x23'),path[_0xb42c('0x24')](_0x495c09['originalname'],path['extname'](_0x495c09['originalname'])),Date[_0xb42c('0x25')](),path['extname'](_0x495c09[_0xb42c('0x21')])));}})});router['post'](_0xb42c('0x26'),upload[_0xb42c('0x27')]('file'),controller[_0xb42c('0x28')]);var upload=multer({'storage':multer[_0xb42c('0x1f')]({'destination':function(_0x3c5f4d,_0x463ca3,_0xb29ae){_0xb29ae(null,path[_0xb42c('0x29')](config[_0xb42c('0x20')],'server/files/tmp'));},'filename':function(_0x4137cf,_0x24ad8c,_0x5899de){_0x24ad8c[_0xb42c('0x21')]=_0x24ad8c['originalname'][_0xb42c('0x2a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5899de(null,util[_0xb42c('0x22')](_0xb42c('0x23'),path[_0xb42c('0x24')](_0x24ad8c[_0xb42c('0x21')],path[_0xb42c('0x2b')](_0x24ad8c[_0xb42c('0x21')])),Date[_0xb42c('0x25')](),path[_0xb42c('0x2b')](_0x24ad8c[_0xb42c('0x21')])));}})});router[_0xb42c('0x1a')]('/upload',upload[_0xb42c('0x27')](_0xb42c('0x2c')),controller[_0xb42c('0x2d')]);router[_0xb42c('0x1a')](_0xb42c('0x2e'),auth['isAuthenticated'](),controller[_0xb42c('0x2f')]);router[_0xb42c('0x30')]('/:id',auth[_0xb42c('0x9')](),controller[_0xb42c('0x31')]);router[_0xb42c('0x32')]('/:id',auth[_0xb42c('0x9')](),controller['destroy']);module[_0xb42c('0x33')]=router; \ No newline at end of file +var _0x481b=['/:id','getTags','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getJscriptySessions','/:id/journey','post','/merge','merge','create','bulkCreate','/:id/tags','setTags','diskStorage','join','server/files/tmp','originalname','replace','format','basename','extname','/csv','single','uploadCsv','root','%s-%s%s','now','/upload','file','upload','/upload/:id','import','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0x481b,0x1dd));var _0xb481=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x481b[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0xb481('0x0'));var util=require(_0xb481('0x1'));var path=require('path');var timeout=require(_0xb481('0x2'));var express=require(_0xb481('0x3'));var router=express[_0xb481('0x4')]();var fs_extra=require(_0xb481('0x5'));var auth=require(_0xb481('0x6'));var interaction=require(_0xb481('0x7'));var config=require('../../config/environment');var controller=require('./cmContact.controller');router[_0xb481('0x8')]('/',auth[_0xb481('0x9')](),controller[_0xb481('0xa')]);router[_0xb481('0x8')](_0xb481('0xb'),auth['isAuthenticated'](),controller[_0xb481('0xc')]);router[_0xb481('0x8')](_0xb481('0xd'),auth[_0xb481('0x9')](),controller['show']);router['get']('/:id/tags',auth[_0xb481('0x9')](),controller[_0xb481('0xe')]);router[_0xb481('0x8')]('/:id/hoppers',auth[_0xb481('0x9')](),controller[_0xb481('0xf')]);router[_0xb481('0x8')](_0xb481('0x10'),auth[_0xb481('0x9')](),controller['getHopperHistories']);router[_0xb481('0x8')](_0xb481('0x11'),auth[_0xb481('0x9')](),controller[_0xb481('0x12')]);router[_0xb481('0x8')]('/:id/jscripty_sessions',auth[_0xb481('0x9')](),controller[_0xb481('0x13')]);router['get'](_0xb481('0x14'),auth[_0xb481('0x9')](),controller['getJourney']);router[_0xb481('0x15')](_0xb481('0x16'),auth[_0xb481('0x9')](),controller[_0xb481('0x17')]);router[_0xb481('0x15')]('/',auth[_0xb481('0x9')](),controller[_0xb481('0x18')]);router[_0xb481('0x15')]('/create_many',auth[_0xb481('0x9')](),controller[_0xb481('0x19')]);router[_0xb481('0x15')](_0xb481('0x1a'),auth[_0xb481('0x9')](),controller[_0xb481('0x1b')]);var upload=multer({'storage':multer[_0xb481('0x1c')]({'destination':function(_0x4a2e49,_0x47e64d,_0x58a0a5){_0x58a0a5(null,path[_0xb481('0x1d')](config['root'],_0xb481('0x1e')));},'filename':function(_0x1070e0,_0x368806,_0x23aec1){_0x368806[_0xb481('0x1f')]=_0x368806[_0xb481('0x1f')][_0xb481('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x23aec1(null,util[_0xb481('0x21')]('%s-%s%s',path[_0xb481('0x22')](_0x368806[_0xb481('0x1f')],path[_0xb481('0x23')](_0x368806[_0xb481('0x1f')])),Date['now'](),path[_0xb481('0x23')](_0x368806[_0xb481('0x1f')])));}})});router[_0xb481('0x15')](_0xb481('0x24'),upload[_0xb481('0x25')]('file'),controller[_0xb481('0x26')]);var upload=multer({'storage':multer[_0xb481('0x1c')]({'destination':function(_0x59332c,_0x11ce91,_0x3bea3b){_0x3bea3b(null,path[_0xb481('0x1d')](config[_0xb481('0x27')],'server/files/tmp'));},'filename':function(_0x547570,_0x3c1714,_0x517331){_0x3c1714['originalname']=_0x3c1714[_0xb481('0x1f')][_0xb481('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x517331(null,util[_0xb481('0x21')](_0xb481('0x28'),path[_0xb481('0x22')](_0x3c1714[_0xb481('0x1f')],path['extname'](_0x3c1714[_0xb481('0x1f')])),Date[_0xb481('0x29')](),path[_0xb481('0x23')](_0x3c1714[_0xb481('0x1f')])));}})});router[_0xb481('0x15')](_0xb481('0x2a'),upload[_0xb481('0x25')](_0xb481('0x2b')),controller[_0xb481('0x2c')]);router[_0xb481('0x15')](_0xb481('0x2d'),auth[_0xb481('0x9')](),controller[_0xb481('0x2e')]);router['put'](_0xb481('0xd'),auth[_0xb481('0x9')](),controller['update']);router[_0xb481('0x2f')](_0xb481('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xb481('0x30')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 299be2d..1a7a287 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 _0xbe46=['isArray','BOOLEAN','ENUM','lodash','exports','VIRTUAL','getDataValue','setDataValue','alias','name','STRING','type','parse','values'];(function(_0x5ef161,_0x27d16c){var _0x1c6e9e=function(_0x8fc2a6){while(--_0x8fc2a6){_0x5ef161['push'](_0x5ef161['shift']());}};_0x1c6e9e(++_0x27d16c);}(_0xbe46,0x129));var _0x6be4=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xbe46[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require('sequelize');var _=require(_0x6be4('0x0'));module[_0x6be4('0x1')]={'name':{'type':Sequelize[_0x6be4('0x2')],'get':function(_0x520b90){return this[_0x6be4('0x3')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x323934){this[_0x6be4('0x4')](_0x6be4('0x5'),_0x323934?_0x323934:this[_0x6be4('0x3')](_0x6be4('0x6')));}},'type':{'type':Sequelize[_0x6be4('0x7')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0x6be4('0x3')](_0x6be4('0x8'))==='select'){return JSON[_0x6be4('0x9')](this['getDataValue'](_0x6be4('0xa')));}else{return this[_0x6be4('0x3')](_0x6be4('0xa'));}},'set':function(_0x4929bd){if(Array[_0x6be4('0xb')](_0x4929bd)){this[_0x6be4('0x4')]('values',JSON['stringify'](_0x4929bd));}else{this['setDataValue']('values',_0x4929bd);}}},'required':{'type':Sequelize[_0x6be4('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x6be4('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x6be4('0xd')]('voice')}}; \ No newline at end of file +var _0x49e8=['isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','STRING','setDataValue','alias','getDataValue','name','TEXT','long','select','values'];(function(_0x111821,_0x44bcd5){var _0x5b2400=function(_0x7ac0e7){while(--_0x7ac0e7){_0x111821['push'](_0x111821['shift']());}};_0x5b2400(++_0x44bcd5);}(_0x49e8,0x71));var _0x849e=function(_0xfa3280,_0x42246f){_0xfa3280=_0xfa3280-0x0;var _0x1d6b04=_0x49e8[_0xfa3280];return _0x1d6b04;};'use strict';var Sequelize=require(_0x849e('0x0'));var _=require(_0x849e('0x1'));module[_0x849e('0x2')]={'name':{'type':Sequelize[_0x849e('0x3')],'get':function(_0x1a4e11){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x849e('0x4')],'allowNull':![],'set':function(_0x4a2f94){this[_0x849e('0x5')](_0x849e('0x6'),_0x4a2f94?_0x4a2f94:this[_0x849e('0x7')](_0x849e('0x8')));}},'type':{'type':Sequelize[_0x849e('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x849e('0x9')](_0x849e('0xa')),'get':function(){if(this[_0x849e('0x7')]('type')===_0x849e('0xb')){return JSON['parse'](this[_0x849e('0x7')]('values'));}else{return this[_0x849e('0x7')](_0x849e('0xc'));}},'set':function(_0x3b8f7f){if(Array[_0x849e('0xd')](_0x3b8f7f)){this[_0x849e('0x5')](_0x849e('0xc'),JSON[_0x849e('0xe')](_0x3b8f7f));}else{this[_0x849e('0x5')](_0x849e('0xc'),_0x3b8f7f);}}},'required':{'type':Sequelize[_0x849e('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x849e('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x849e('0x10')](_0x849e('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 809a3ad..94be7f1 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 _0x64f8=['lodash','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','body','create','number','Sequelize','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','fast-json-patch','moment','bluebird','util','ejs','fs-extra'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x64f8,0x140));var _0x864f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x64f8[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x864f('0x0'));var rimraf=require(_0x864f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x864f('0x2'));var rp=require('request-promise');var moment=require(_0x864f('0x3'));var BPromise=require(_0x864f('0x4'));var Mustache=require('mustache');var util=require(_0x864f('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x864f('0x6'));var fs=require('fs');var fs_extra=require(_0x864f('0x7'));var _=require(_0x864f('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x864f('0x9'));var toCsv=require(_0x864f('0xa'));var querystring=require(_0x864f('0xb'));var Papa=require('papaparse');var Redis=require(_0x864f('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x864f('0xd'));var as=require(_0x864f('0xe'));var hardwareService=require(_0x864f('0xf'));var logger=require(_0x864f('0x10'))('api');var utils=require(_0x864f('0x11'));var config=require(_0x864f('0x12'));var licenseUtil=require(_0x864f('0x13'));var db=require(_0x864f('0x14'))['db'];function respondWithStatusCode(_0x531c2c,_0x5e80b0){_0x5e80b0=_0x5e80b0||0xcc;return function(_0x17e458){if(_0x17e458){return _0x531c2c['sendStatus'](_0x5e80b0);}return _0x531c2c[_0x864f('0x15')](_0x5e80b0)[_0x864f('0x16')]();};}function respondWithResult(_0x6a0b68,_0x4773c2){_0x4773c2=_0x4773c2||0xc8;return function(_0x30a67a){if(_0x30a67a){return _0x6a0b68['status'](_0x4773c2)[_0x864f('0x17')](_0x30a67a);}};}function respondWithFilteredResult(_0x2eb31a,_0xb25142){return function(_0x29ecca){if(_0x29ecca){var _0x1630e4=typeof _0xb25142[_0x864f('0x18')]===_0x864f('0x19')&&typeof _0xb25142[_0x864f('0x1a')]===_0x864f('0x19');var _0x475326=_0x29ecca['count'];var _0x26331f=_0x1630e4?0x0:_0xb25142[_0x864f('0x18')];var _0x31d737=_0x1630e4?_0x29ecca[_0x864f('0x1b')]:_0xb25142['offset']+_0xb25142[_0x864f('0x1a')];var _0x2cbe1e;if(_0x31d737>=_0x475326){_0x31d737=_0x475326;_0x2cbe1e=0xc8;}else{_0x2cbe1e=0xce;}_0x2eb31a[_0x864f('0x15')](_0x2cbe1e);return _0x2eb31a[_0x864f('0x1c')](_0x864f('0x1d'),_0x26331f+'-'+_0x31d737+'/'+_0x475326)[_0x864f('0x17')](_0x29ecca);}return null;};}function patchUpdates(_0x53b0ea){return function(_0x4a8784){try{jsonpatch[_0x864f('0x1e')](_0x4a8784,_0x53b0ea,!![]);}catch(_0x2a1f99){return BPromise[_0x864f('0x1f')](_0x2a1f99);}return _0x4a8784[_0x864f('0x20')]();};}function saveUpdates(_0x4bbc6d,_0x44e9cf){return function(_0x22b7a3){if(_0x22b7a3){return _0x22b7a3[_0x864f('0x21')](_0x4bbc6d)[_0x864f('0x22')](function(_0x11bdae){return _0x11bdae;});}return null;};}function removeEntity(_0x5ca693,_0x101801){return function(_0x14a48d){if(_0x14a48d){return _0x14a48d[_0x864f('0x23')]()[_0x864f('0x22')](function(){_0x5ca693[_0x864f('0x15')](0xcc)[_0x864f('0x16')]();});}};}function handleEntityNotFound(_0x13a539,_0x58abf5){return function(_0x2d3867){if(!_0x2d3867){_0x13a539[_0x864f('0x24')](0x194);}return _0x2d3867;};}function handleError(_0x29f0a9,_0x5edaf9){_0x5edaf9=_0x5edaf9||0x1f4;return function(_0x32ff83){logger[_0x864f('0x25')](_0x32ff83['stack']);if(_0x32ff83[_0x864f('0x26')]){delete _0x32ff83['name'];}_0x29f0a9[_0x864f('0x15')](_0x5edaf9)[_0x864f('0x27')](_0x32ff83);};}exports[_0x864f('0x28')]=function(_0x3a8c6e,_0x4571b4){var _0x3e38a2={},_0x5bcc35={},_0x9daaca={'count':0x0,'rows':[]};var _0x30a2af=_[_0x864f('0x29')](db[_0x864f('0x2a')][_0x864f('0x2b')],function(_0x3db32e){return{'name':_0x3db32e[_0x864f('0x2c')],'type':_0x3db32e[_0x864f('0x2d')][_0x864f('0x2e')]};});_0x5bcc35[_0x864f('0x2f')]=_['differenceBy'](_[_0x864f('0x29')](_0x30a2af,_0x864f('0x26')),['name']);_0x5bcc35[_0x864f('0x30')]=_['keys'](_0x3a8c6e['query']);_0x5bcc35[_0x864f('0x31')]=_[_0x864f('0x32')](_0x5bcc35[_0x864f('0x2f')],_0x5bcc35['query']);_0x3e38a2[_0x864f('0x33')]=_[_0x864f('0x32')](_0x5bcc35[_0x864f('0x2f')],qs['fields'](_0x3a8c6e[_0x864f('0x30')][_0x864f('0x34')]));_0x3e38a2['attributes']=_0x3e38a2[_0x864f('0x33')][_0x864f('0x35')]?_0x3e38a2[_0x864f('0x33')]:_0x5bcc35['model'];if(!_0x3a8c6e['query'][_0x864f('0x36')]('nolimit')){_0x3e38a2[_0x864f('0x1a')]=qs[_0x864f('0x1a')](_0x3a8c6e[_0x864f('0x30')][_0x864f('0x1a')]);_0x3e38a2[_0x864f('0x18')]=qs[_0x864f('0x18')](_0x3a8c6e[_0x864f('0x30')]['offset']);}_0x3e38a2[_0x864f('0x37')]=qs[_0x864f('0x38')](_0x3a8c6e[_0x864f('0x30')][_0x864f('0x38')]);_0x3e38a2[_0x864f('0x39')]=qs[_0x864f('0x31')](_[_0x864f('0x3a')](_0x3a8c6e[_0x864f('0x30')],_0x5bcc35['filters']),_0x30a2af);if(_0x3a8c6e[_0x864f('0x30')][_0x864f('0x3b')]){_0x3e38a2['where']=_[_0x864f('0x3c')](_0x3e38a2[_0x864f('0x39')],{'$or':_[_0x864f('0x29')](_0x30a2af,function(_0x4bab85){if(_0x4bab85['type']!==_0x864f('0x3d')){var _0x505832={};_0x505832[_0x4bab85[_0x864f('0x26')]]={'$like':'%'+_0x3a8c6e[_0x864f('0x30')]['filter']+'%'};return _0x505832;}})});}_0x3e38a2=_['merge']({},_0x3e38a2,_0x3a8c6e[_0x864f('0x3e')]);var _0x14f36e={'where':_0x3e38a2['where']};return db[_0x864f('0x2a')][_0x864f('0x1b')](_0x14f36e)[_0x864f('0x22')](function(_0x1779ec){_0x9daaca[_0x864f('0x1b')]=_0x1779ec;if(_0x3a8c6e[_0x864f('0x30')][_0x864f('0x3f')]){_0x3e38a2[_0x864f('0x40')]=[{'all':!![]}];}return db[_0x864f('0x2a')][_0x864f('0x41')](_0x3e38a2);})[_0x864f('0x22')](function(_0x37c4e6){_0x9daaca['rows']=_0x37c4e6;return _0x9daaca;})[_0x864f('0x22')](respondWithFilteredResult(_0x4571b4,_0x3e38a2))[_0x864f('0x42')](handleError(_0x4571b4,null));};exports[_0x864f('0x43')]=function(_0x51a874,_0x164048){var _0x5d9b03={'raw':!![],'where':{'id':_0x51a874[_0x864f('0x44')]['id']}},_0x67b91a={};_0x67b91a[_0x864f('0x2f')]=_[_0x864f('0x45')](db[_0x864f('0x2a')][_0x864f('0x2b')]);_0x67b91a['query']=_[_0x864f('0x45')](_0x51a874[_0x864f('0x30')]);_0x67b91a['filters']=_[_0x864f('0x32')](_0x67b91a[_0x864f('0x2f')],_0x67b91a[_0x864f('0x30')]);_0x5d9b03[_0x864f('0x33')]=_[_0x864f('0x32')](_0x67b91a[_0x864f('0x2f')],qs['fields'](_0x51a874[_0x864f('0x30')][_0x864f('0x34')]));_0x5d9b03['attributes']=_0x5d9b03[_0x864f('0x33')][_0x864f('0x35')]?_0x5d9b03[_0x864f('0x33')]:_0x67b91a[_0x864f('0x2f')];if(_0x51a874[_0x864f('0x30')][_0x864f('0x3f')]){_0x5d9b03['include']=[{'all':!![]}];}_0x5d9b03=_[_0x864f('0x3c')]({},_0x5d9b03,_0x51a874['options']);return db[_0x864f('0x2a')][_0x864f('0x46')](_0x5d9b03)['then'](handleEntityNotFound(_0x164048,null))[_0x864f('0x22')](respondWithResult(_0x164048,null))[_0x864f('0x42')](handleError(_0x164048,null));};exports[_0x864f('0x21')]=function(_0x47cb1b,_0xbb6263){if(_0x47cb1b[_0x864f('0x47')]['id']){delete _0x47cb1b[_0x864f('0x47')]['id'];}return db[_0x864f('0x2a')][_0x864f('0x46')]({'where':{'id':_0x47cb1b[_0x864f('0x44')]['id']}})[_0x864f('0x22')](handleEntityNotFound(_0xbb6263,null))[_0x864f('0x22')](saveUpdates(_0x47cb1b[_0x864f('0x47')],null))[_0x864f('0x22')](respondWithResult(_0xbb6263,null))[_0x864f('0x42')](handleError(_0xbb6263,null));};exports[_0x864f('0x23')]=function(_0x572a92,_0x44a61f){return db[_0x864f('0x2a')]['find']({'where':{'id':_0x572a92[_0x864f('0x44')]['id']}})[_0x864f('0x22')](handleEntityNotFound(_0x44a61f,null))['then'](removeEntity(_0x44a61f,null))[_0x864f('0x42')](handleError(_0x44a61f,null));};exports['create']=function(_0x233058,_0x359e4b){var _0xf26430;return db['sequelize']['transaction'](function(_0x6ade36){return db[_0x864f('0x2a')][_0x864f('0x48')](_0x233058[_0x864f('0x47')],{'transaction':_0x6ade36})[_0x864f('0x22')](function(_0x52f3a1){_0xf26430=_0x52f3a1;var _0x419714={'type':db['Sequelize']['TEXT'],'transaction':_0x6ade36};switch(_0x233058['body'][_0x864f('0x2d')]){case'text':_0x419714[_0x864f('0x2d')]=db['Sequelize']['TEXT'];break;case _0x864f('0x49'):_0x419714['type']=db[_0x864f('0x4a')]['INTEGER'];break;case _0x864f('0x4b'):_0x419714[_0x864f('0x2d')]=db[_0x864f('0x4a')][_0x864f('0x4c')];_0x419714['defaultValue']=![];break;default:}return db['sequelize'][_0x864f('0x4d')][_0x864f('0x4e')](_0x864f('0x4f'),util[_0x864f('0x50')](_0x864f('0x51'),_0xf26430['id']),_0x419714);})[_0x864f('0x22')](function(){return _0xf26430;});})[_0x864f('0x22')](respondWithResult(_0x359e4b,0xc9))[_0x864f('0x42')](handleError(_0x359e4b,null));}; \ No newline at end of file +var _0x745e=['cf_%d','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','then','includeAll','findAll','rows','catch','params','include','options','find','body','create','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts'];(function(_0x19044c,_0x36e84c){var _0x5b4e19=function(_0x148211){while(--_0x148211){_0x19044c['push'](_0x19044c['shift']());}};_0x5b4e19(++_0x36e84c);}(_0x745e,0xa9));var _0xe745=function(_0xb7b878,_0x5c3b92){_0xb7b878=_0xb7b878-0x0;var _0x3c84b9=_0x745e[_0xb7b878];return _0x3c84b9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe745('0x0'));var jsonpatch=require(_0xe745('0x1'));var rp=require(_0xe745('0x2'));var moment=require(_0xe745('0x3'));var BPromise=require(_0xe745('0x4'));var Mustache=require(_0xe745('0x5'));var util=require(_0xe745('0x6'));var path=require(_0xe745('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe745('0x8'));var _=require(_0xe745('0x9'));var squel=require(_0xe745('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe745('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe745('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe745('0xd'));var as=require(_0xe745('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe745('0xf'))(_0xe745('0x10'));var utils=require('../../config/utils');var config=require(_0xe745('0x11'));var licenseUtil=require(_0xe745('0x12'));var db=require(_0xe745('0x13'))['db'];function respondWithStatusCode(_0x5d6fb8,_0x183613){_0x183613=_0x183613||0xcc;return function(_0x1a4840){if(_0x1a4840){return _0x5d6fb8[_0xe745('0x14')](_0x183613);}return _0x5d6fb8[_0xe745('0x15')](_0x183613)[_0xe745('0x16')]();};}function respondWithResult(_0x154f48,_0xfc5e2b){_0xfc5e2b=_0xfc5e2b||0xc8;return function(_0x20bf87){if(_0x20bf87){return _0x154f48[_0xe745('0x15')](_0xfc5e2b)[_0xe745('0x17')](_0x20bf87);}};}function respondWithFilteredResult(_0x31eb86,_0x11c88f){return function(_0x541895){if(_0x541895){var _0xdefac3=typeof _0x11c88f['offset']===_0xe745('0x18')&&typeof _0x11c88f[_0xe745('0x19')]===_0xe745('0x18');var _0x17e43d=_0x541895[_0xe745('0x1a')];var _0x2b02d7=_0xdefac3?0x0:_0x11c88f[_0xe745('0x1b')];var _0x5f1584=_0xdefac3?_0x541895[_0xe745('0x1a')]:_0x11c88f[_0xe745('0x1b')]+_0x11c88f[_0xe745('0x19')];var _0x138fab;if(_0x5f1584>=_0x17e43d){_0x5f1584=_0x17e43d;_0x138fab=0xc8;}else{_0x138fab=0xce;}_0x31eb86[_0xe745('0x15')](_0x138fab);return _0x31eb86[_0xe745('0x1c')](_0xe745('0x1d'),_0x2b02d7+'-'+_0x5f1584+'/'+_0x17e43d)['json'](_0x541895);}return null;};}function patchUpdates(_0x10c9ef){return function(_0x3cc55d){try{jsonpatch['apply'](_0x3cc55d,_0x10c9ef,!![]);}catch(_0x27f4b5){return BPromise[_0xe745('0x1e')](_0x27f4b5);}return _0x3cc55d[_0xe745('0x1f')]();};}function saveUpdates(_0x375bf3,_0x357e8a){return function(_0x506435){if(_0x506435){return _0x506435[_0xe745('0x20')](_0x375bf3)['then'](function(_0x1d84f6){return _0x1d84f6;});}return null;};}function removeEntity(_0x4b957a,_0x264aed){return function(_0x1365c9){if(_0x1365c9){return _0x1365c9[_0xe745('0x21')]()['then'](function(){_0x4b957a[_0xe745('0x15')](0xcc)[_0xe745('0x16')]();});}};}function handleEntityNotFound(_0x31800e,_0x16ca6d){return function(_0x2cff36){if(!_0x2cff36){_0x31800e[_0xe745('0x14')](0x194);}return _0x2cff36;};}function handleError(_0x2f5714,_0x272b03){_0x272b03=_0x272b03||0x1f4;return function(_0x38bfda){logger[_0xe745('0x22')](_0x38bfda[_0xe745('0x23')]);if(_0x38bfda['name']){delete _0x38bfda[_0xe745('0x24')];}_0x2f5714[_0xe745('0x15')](_0x272b03)[_0xe745('0x25')](_0x38bfda);};}exports['index']=function(_0x958d0d,_0x200b47){var _0x3108ab={},_0x2e7f89={},_0x5c5500={'count':0x0,'rows':[]};var _0xfc2950=_[_0xe745('0x26')](db[_0xe745('0x27')][_0xe745('0x28')],function(_0x56e6a4){return{'name':_0x56e6a4[_0xe745('0x29')],'type':_0x56e6a4['type'][_0xe745('0x2a')]};});_0x2e7f89[_0xe745('0x2b')]=_['differenceBy'](_[_0xe745('0x26')](_0xfc2950,_0xe745('0x24')),[_0xe745('0x24')]);_0x2e7f89[_0xe745('0x2c')]=_[_0xe745('0x2d')](_0x958d0d['query']);_0x2e7f89[_0xe745('0x2e')]=_[_0xe745('0x2f')](_0x2e7f89['model'],_0x2e7f89['query']);_0x3108ab[_0xe745('0x30')]=_[_0xe745('0x2f')](_0x2e7f89[_0xe745('0x2b')],qs['fields'](_0x958d0d[_0xe745('0x2c')][_0xe745('0x31')]));_0x3108ab['attributes']=_0x3108ab[_0xe745('0x30')]['length']?_0x3108ab[_0xe745('0x30')]:_0x2e7f89[_0xe745('0x2b')];if(!_0x958d0d['query'][_0xe745('0x32')](_0xe745('0x33'))){_0x3108ab[_0xe745('0x19')]=qs[_0xe745('0x19')](_0x958d0d[_0xe745('0x2c')][_0xe745('0x19')]);_0x3108ab['offset']=qs['offset'](_0x958d0d[_0xe745('0x2c')][_0xe745('0x1b')]);}_0x3108ab[_0xe745('0x34')]=qs[_0xe745('0x35')](_0x958d0d[_0xe745('0x2c')]['sort']);_0x3108ab[_0xe745('0x36')]=qs[_0xe745('0x2e')](_[_0xe745('0x37')](_0x958d0d[_0xe745('0x2c')],_0x2e7f89[_0xe745('0x2e')]),_0xfc2950);if(_0x958d0d['query'][_0xe745('0x38')]){_0x3108ab['where']=_['merge'](_0x3108ab[_0xe745('0x36')],{'$or':_[_0xe745('0x26')](_0xfc2950,function(_0x292bf4){if(_0x292bf4[_0xe745('0x39')]!==_0xe745('0x3a')){var _0x3b7619={};_0x3b7619[_0x292bf4[_0xe745('0x24')]]={'$like':'%'+_0x958d0d['query'][_0xe745('0x38')]+'%'};return _0x3b7619;}})});}_0x3108ab=_[_0xe745('0x3b')]({},_0x3108ab,_0x958d0d['options']);var _0x52a0c6={'where':_0x3108ab[_0xe745('0x36')]};return db[_0xe745('0x27')][_0xe745('0x1a')](_0x52a0c6)[_0xe745('0x3c')](function(_0x317838){_0x5c5500[_0xe745('0x1a')]=_0x317838;if(_0x958d0d['query'][_0xe745('0x3d')]){_0x3108ab['include']=[{'all':!![]}];}return db[_0xe745('0x27')][_0xe745('0x3e')](_0x3108ab);})[_0xe745('0x3c')](function(_0x1cd523){_0x5c5500[_0xe745('0x3f')]=_0x1cd523;return _0x5c5500;})[_0xe745('0x3c')](respondWithFilteredResult(_0x200b47,_0x3108ab))[_0xe745('0x40')](handleError(_0x200b47,null));};exports['show']=function(_0x61f2b,_0x1abd91){var _0x1d3ecc={'raw':!![],'where':{'id':_0x61f2b[_0xe745('0x41')]['id']}},_0x1a378e={};_0x1a378e['model']=_[_0xe745('0x2d')](db[_0xe745('0x27')][_0xe745('0x28')]);_0x1a378e['query']=_[_0xe745('0x2d')](_0x61f2b['query']);_0x1a378e[_0xe745('0x2e')]=_[_0xe745('0x2f')](_0x1a378e['model'],_0x1a378e[_0xe745('0x2c')]);_0x1d3ecc[_0xe745('0x30')]=_[_0xe745('0x2f')](_0x1a378e[_0xe745('0x2b')],qs['fields'](_0x61f2b[_0xe745('0x2c')][_0xe745('0x31')]));_0x1d3ecc[_0xe745('0x30')]=_0x1d3ecc[_0xe745('0x30')]['length']?_0x1d3ecc[_0xe745('0x30')]:_0x1a378e['model'];if(_0x61f2b[_0xe745('0x2c')][_0xe745('0x3d')]){_0x1d3ecc[_0xe745('0x42')]=[{'all':!![]}];}_0x1d3ecc=_[_0xe745('0x3b')]({},_0x1d3ecc,_0x61f2b[_0xe745('0x43')]);return db['CmCustomField'][_0xe745('0x44')](_0x1d3ecc)[_0xe745('0x3c')](handleEntityNotFound(_0x1abd91,null))[_0xe745('0x3c')](respondWithResult(_0x1abd91,null))[_0xe745('0x40')](handleError(_0x1abd91,null));};exports[_0xe745('0x20')]=function(_0x59a6a7,_0x579246){if(_0x59a6a7[_0xe745('0x45')]['id']){delete _0x59a6a7[_0xe745('0x45')]['id'];}return db[_0xe745('0x27')][_0xe745('0x44')]({'where':{'id':_0x59a6a7[_0xe745('0x41')]['id']}})[_0xe745('0x3c')](handleEntityNotFound(_0x579246,null))[_0xe745('0x3c')](saveUpdates(_0x59a6a7[_0xe745('0x45')],null))['then'](respondWithResult(_0x579246,null))[_0xe745('0x40')](handleError(_0x579246,null));};exports[_0xe745('0x21')]=function(_0x1560eb,_0xbd75be){return db[_0xe745('0x27')][_0xe745('0x44')]({'where':{'id':_0x1560eb[_0xe745('0x41')]['id']}})[_0xe745('0x3c')](handleEntityNotFound(_0xbd75be,null))[_0xe745('0x3c')](removeEntity(_0xbd75be,null))['catch'](handleError(_0xbd75be,null));};exports[_0xe745('0x46')]=function(_0x44a9cd,_0x1172e5){var _0x354d54;return db[_0xe745('0x47')][_0xe745('0x48')](function(_0x35450e){return db['CmCustomField'][_0xe745('0x46')](_0x44a9cd[_0xe745('0x45')],{'transaction':_0x35450e})[_0xe745('0x3c')](function(_0x3cf458){_0x354d54=_0x3cf458;var _0x296315={'type':db[_0xe745('0x49')]['TEXT'],'transaction':_0x35450e};switch(_0x44a9cd[_0xe745('0x45')][_0xe745('0x39')]){case _0xe745('0x4a'):_0x296315['type']=db[_0xe745('0x49')][_0xe745('0x4b')];break;case _0xe745('0x4c'):_0x296315['type']=db['Sequelize'][_0xe745('0x4d')];break;case _0xe745('0x4e'):_0x296315['type']=db[_0xe745('0x49')][_0xe745('0x4f')];_0x296315[_0xe745('0x50')]=![];break;default:}return db[_0xe745('0x47')]['queryInterface'][_0xe745('0x51')](_0xe745('0x52'),util['format'](_0xe745('0x53'),_0x354d54['id']),_0x296315);})[_0xe745('0x3c')](function(){return _0x354d54;});})['then'](respondWithResult(_0x1172e5,0xc9))[_0xe745('0x40')](handleError(_0x1172e5,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index f711b82..9ddc744 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 _0x2810=['cm_custom_fields','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x1496b9,_0x362c62){var _0x5de295=function(_0x1699dc){while(--_0x1699dc){_0x1496b9['push'](_0x1496b9['shift']());}};_0x5de295(++_0x362c62);}(_0x2810,0x153));var _0x0281=function(_0x4329b4,_0x385751){_0x4329b4=_0x4329b4-0x0;var _0x2b53eb=_0x2810[_0x4329b4];return _0x2b53eb;};'use strict';var _=require(_0x0281('0x0'));var util=require('util');var logger=require(_0x0281('0x1'))('api');var moment=require(_0x0281('0x2'));var BPromise=require(_0x0281('0x3'));var rp=require(_0x0281('0x4'));var fs=require('fs');var path=require(_0x0281('0x5'));var rimraf=require(_0x0281('0x6'));var config=require(_0x0281('0x7'));var attributes=require(_0x0281('0x8'));module[_0x0281('0x9')]=function(_0x5b9dda,_0xc106a6){return _0x5b9dda[_0x0281('0xa')](_0x0281('0xb'),attributes,{'tableName':_0x0281('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4823=['lodash','util','../../config/logger','api','moment','path','rimraf','./cmCustomField.attributes','define','CmCustomField'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x4823,0xa0));var _0x3482=function(_0x7b173,_0x539d7f){_0x7b173=_0x7b173-0x0;var _0x1c598c=_0x4823[_0x7b173];return _0x1c598c;};'use strict';var _=require(_0x3482('0x0'));var util=require(_0x3482('0x1'));var logger=require(_0x3482('0x2'))(_0x3482('0x3'));var moment=require(_0x3482('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3482('0x5'));var rimraf=require(_0x3482('0x6'));var config=require('../../config/environment');var attributes=require(_0x3482('0x7'));module['exports']=function(_0x1c0a85,_0x5e6813){return _0x1c0a85[_0x3482('0x8')](_0x3482('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index a91982c..b662e87 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 _0x7ee2=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4c896c,_0x5eee9f){var _0x3fffa1=function(_0x522d23){while(--_0x522d23){_0x4c896c['push'](_0x4c896c['shift']());}};_0x3fffa1(++_0x5eee9f);}(_0x7ee2,0xfc));var _0x27ee=function(_0x307165,_0x186dca){_0x307165=_0x307165-0x0;var _0x5caf15=_0x7ee2[_0x307165];return _0x5caf15;};'use strict';var _=require(_0x27ee('0x0'));var util=require(_0x27ee('0x1'));var moment=require('moment');var BPromise=require(_0x27ee('0x2'));var rs=require(_0x27ee('0x3'));var fs=require('fs');var Redis=require(_0x27ee('0x4'));var db=require(_0x27ee('0x5'))['db'];var utils=require(_0x27ee('0x6'));var logger=require(_0x27ee('0x7'))('rpc');var config=require(_0x27ee('0x8'));var jayson=require(_0x27ee('0x9'));var client=jayson['client'][_0x27ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x234426,_0x3ce8e0,_0x3cd356){return new BPromise(function(_0x1b4a66,_0x130b66){return client['request'](_0x234426,_0x3cd356)['then'](function(_0x252edf){logger['info'](_0x27ee('0xb'),_0x3ce8e0,_0x27ee('0xc'));logger[_0x27ee('0xd')](_0x27ee('0xe'),_0x3ce8e0,_0x27ee('0xc'),JSON[_0x27ee('0xf')](_0x252edf));if(_0x252edf[_0x27ee('0x10')]){if(_0x252edf[_0x27ee('0x10')]['code']===0x1f4){logger[_0x27ee('0x10')](_0x27ee('0xb'),_0x3ce8e0,_0x252edf[_0x27ee('0x10')][_0x27ee('0x11')]);return _0x130b66(_0x252edf[_0x27ee('0x10')][_0x27ee('0x11')]);}logger[_0x27ee('0x10')](_0x27ee('0xb'),_0x3ce8e0,_0x252edf['error'][_0x27ee('0x11')]);return _0x1b4a66(_0x252edf['error']['message']);}else{logger[_0x27ee('0x12')](_0x27ee('0xb'),_0x3ce8e0,'request\x20sent');_0x1b4a66(_0x252edf['result'][_0x27ee('0x11')]);}})['catch'](function(_0x5c8f3d){logger[_0x27ee('0x10')](_0x27ee('0xb'),_0x3ce8e0,_0x5c8f3d);_0x130b66(_0x5c8f3d);});});} \ No newline at end of file +var _0xd16c=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','CmCustomField,\x20%s,\x20%s'];(function(_0x45a3df,_0xb20577){var _0x330f36=function(_0x4487de){while(--_0x4487de){_0x45a3df['push'](_0x45a3df['shift']());}};_0x330f36(++_0xb20577);}(_0xd16c,0xfe));var _0xcd16=function(_0x2e6a59,_0x2ace0a){_0x2e6a59=_0x2e6a59-0x0;var _0x18a7cd=_0xd16c[_0x2e6a59];return _0x18a7cd;};'use strict';var _=require(_0xcd16('0x0'));var util=require(_0xcd16('0x1'));var moment=require(_0xcd16('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd16('0x3'));var db=require(_0xcd16('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcd16('0x5'));var config=require('../../config/environment');var jayson=require(_0xcd16('0x6'));var client=jayson[_0xcd16('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d8e9c,_0x557ffd,_0x575455){return new BPromise(function(_0x168760,_0x155ea3){return client[_0xcd16('0x8')](_0x1d8e9c,_0x575455)[_0xcd16('0x9')](function(_0x8d3672){logger[_0xcd16('0xa')](_0xcd16('0xb'),_0x557ffd,'request\x20sent');logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x557ffd,_0xcd16('0xc'),JSON[_0xcd16('0xd')](_0x8d3672));if(_0x8d3672['error']){if(_0x8d3672[_0xcd16('0xe')][_0xcd16('0xf')]===0x1f4){logger['error'](_0xcd16('0xb'),_0x557ffd,_0x8d3672[_0xcd16('0xe')][_0xcd16('0x10')]);return _0x155ea3(_0x8d3672['error']['message']);}logger[_0xcd16('0xe')](_0xcd16('0xb'),_0x557ffd,_0x8d3672[_0xcd16('0xe')][_0xcd16('0x10')]);return _0x168760(_0x8d3672[_0xcd16('0xe')][_0xcd16('0x10')]);}else{logger[_0xcd16('0xa')](_0xcd16('0xb'),_0x557ffd,_0xcd16('0xc'));_0x168760(_0x8d3672[_0xcd16('0x11')][_0xcd16('0x10')]);}})[_0xcd16('0x12')](function(_0x383671){logger[_0xcd16('0xe')](_0xcd16('0xb'),_0x557ffd,_0x383671);_0x155ea3(_0x383671);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 72bd146..eedf692 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 _0x5398=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x412342,_0x180734){var _0x3e62cb=function(_0x501fc6){while(--_0x501fc6){_0x412342['push'](_0x412342['shift']());}};_0x3e62cb(++_0x180734);}(_0x5398,0xe2));var _0x8539=function(_0x256279,_0x10e2e6){_0x256279=_0x256279-0x0;var _0x523804=_0x5398[_0x256279];return _0x523804;};'use strict';var multer=require('multer');var util=require(_0x8539('0x0'));var path=require(_0x8539('0x1'));var timeout=require(_0x8539('0x2'));var express=require(_0x8539('0x3'));var router=express[_0x8539('0x4')]();var fs_extra=require(_0x8539('0x5'));var auth=require(_0x8539('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8539('0x7'));router[_0x8539('0x8')]('/',auth[_0x8539('0x9')](),controller[_0x8539('0xa')]);router[_0x8539('0x8')](_0x8539('0xb'),auth['isAuthenticated'](),controller[_0x8539('0xc')]);router[_0x8539('0xd')]('/',auth[_0x8539('0x9')](),controller[_0x8539('0xe')]);router[_0x8539('0xf')](_0x8539('0xb'),auth[_0x8539('0x9')](),controller[_0x8539('0x10')]);router[_0x8539('0x11')](_0x8539('0xb'),auth['isAuthenticated'](),controller[_0x8539('0x12')]);module[_0x8539('0x13')]=router; \ No newline at end of file +var _0x29d4=['put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x3cffb3,_0x284b2d){var _0x57a846=function(_0x32a354){while(--_0x32a354){_0x3cffb3['push'](_0x3cffb3['shift']());}};_0x57a846(++_0x284b2d);}(_0x29d4,0x1a1));var _0x429d=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x29d4[_0x1ddedd];return _0xa3e1ac;};'use strict';var multer=require(_0x429d('0x0'));var util=require('util');var path=require(_0x429d('0x1'));var timeout=require(_0x429d('0x2'));var express=require(_0x429d('0x3'));var router=express[_0x429d('0x4')]();var fs_extra=require(_0x429d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var controller=require(_0x429d('0x8'));router[_0x429d('0x9')]('/',auth[_0x429d('0xa')](),controller[_0x429d('0xb')]);router[_0x429d('0x9')](_0x429d('0xc'),auth['isAuthenticated'](),controller[_0x429d('0xd')]);router['post']('/',auth[_0x429d('0xa')](),controller[_0x429d('0xe')]);router[_0x429d('0xf')]('/:id',auth[_0x429d('0xa')](),controller[_0x429d('0x10')]);router['delete'](_0x429d('0xc'),auth[_0x429d('0xa')](),controller[_0x429d('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 0759070..e47b9d2 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 _0x0093=['sequelize','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment'];(function(_0x269d9c,_0x3c8281){var _0x3d21d1=function(_0x5afec4){while(--_0x5afec4){_0x269d9c['push'](_0x269d9c['shift']());}};_0x3d21d1(++_0x3c8281);}(_0x0093,0xe0));var _0x3009=function(_0x51ee3c,_0x1074a1){_0x51ee3c=_0x51ee3c-0x0;var _0xc0f27f=_0x0093[_0x51ee3c];return _0xc0f27f;};'use strict';var moment=require(_0x3009('0x0'));var Sequelize=require(_0x3009('0x1'));module['exports']={'phone':{'type':Sequelize[_0x3009('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x3009('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x3009('0x4')],'defaultValue':moment()['format'](_0x3009('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x3009('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3009('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3009('0x4')]},'priority':{'type':Sequelize[_0x3009('0x6')](0x2)[_0x3009('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x3009('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x3009('0x6')],'unique':_0x3009('0x8')},'ListId':{'type':Sequelize[_0x3009('0x6')],'unique':_0x3009('0x8')},'UserId':{'type':Sequelize[_0x3009('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x3009('0x8')},'CampaignId':{'type':Sequelize[_0x3009('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3009('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3009('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7710=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','moment','sequelize','exports','BOOLEAN'];(function(_0xc3fa83,_0x1a9afd){var _0x34054e=function(_0x565601){while(--_0x565601){_0xc3fa83['push'](_0xc3fa83['shift']());}};_0x34054e(++_0x1a9afd);}(_0x7710,0x125));var _0x0771=function(_0xea1bcd,_0x465e08){_0xea1bcd=_0xea1bcd-0x0;var _0xfbe4c6=_0x7710[_0xea1bcd];return _0xfbe4c6;};'use strict';var moment=require(_0x0771('0x0'));var Sequelize=require(_0x0771('0x1'));module[_0x0771('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x0771('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x0771('0x4')],'defaultValue':moment()[_0x0771('0x5')](_0x0771('0x6'))},'countbusyretry':{'type':Sequelize[_0x0771('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0771('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0771('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x0771('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0771('0x8')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0771('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x0771('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x0771('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x0771('0x7')],'unique':_0x0771('0xa')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x0771('0xa')},'UserId':{'type':Sequelize[_0x0771('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x0771('0xa')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x0771('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0771('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0771('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0771('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 9c36e46..82fc528 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 _0xf855=['zip-dir','fast-json-patch','moment','bluebird','path','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','update','then','destroy','name','send','index','map','CmHopper','fieldName','type','key','model','query','intersection','filters','$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','create','body','find','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','updatedAt','state','statedesc','deleted','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','outbound','preview','dialOrderByScheduledAt','sequelize','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','dialActive','getOpenContacts','getVoiceQueues','json','error','rimraf'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0xf855,0x8b));var _0x5f85=function(_0x55164f,_0x3bfbed){_0x55164f=_0x55164f-0x0;var _0x1d2493=_0xf855[_0x55164f];return _0x1d2493;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f85('0x0'));var zipdir=require(_0x5f85('0x1'));var jsonpatch=require(_0x5f85('0x2'));var rp=require('request-promise');var moment=require(_0x5f85('0x3'));var BPromise=require(_0x5f85('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5f85('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f85('0x6'));var _=require('lodash');var squel=require(_0x5f85('0x7'));var crypto=require('crypto');var jsforce=require(_0x5f85('0x8'));var deskjs=require(_0x5f85('0x9'));var toCsv=require(_0x5f85('0xa'));var querystring=require(_0x5f85('0xb'));var Papa=require(_0x5f85('0xc'));var Redis=require(_0x5f85('0xd'));var authService=require(_0x5f85('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5f85('0xf'));var hardwareService=require(_0x5f85('0x10'));var logger=require('../../config/logger')(_0x5f85('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5f85('0x12'))['db'];function respondWithStatusCode(_0x52c6b0,_0x19fae7){_0x19fae7=_0x19fae7||0xcc;return function(_0x1d3fd8){if(_0x1d3fd8){return _0x52c6b0[_0x5f85('0x13')](_0x19fae7);}return _0x52c6b0['status'](_0x19fae7)[_0x5f85('0x14')]();};}function respondWithResult(_0x44a9e0,_0xe4ccff){_0xe4ccff=_0xe4ccff||0xc8;return function(_0x31a738){if(_0x31a738){return _0x44a9e0[_0x5f85('0x15')](_0xe4ccff)['json'](_0x31a738);}};}function respondWithFilteredResult(_0x5232fc,_0x248b8a){return function(_0x1a7cba){if(_0x1a7cba){var _0x386dcf=typeof _0x248b8a[_0x5f85('0x16')]===_0x5f85('0x17')&&typeof _0x248b8a[_0x5f85('0x18')]===_0x5f85('0x17');var _0x1a6118=_0x1a7cba[_0x5f85('0x19')];var _0x286808=_0x386dcf?0x0:_0x248b8a[_0x5f85('0x16')];var _0x1a334d=_0x386dcf?_0x1a7cba[_0x5f85('0x19')]:_0x248b8a[_0x5f85('0x16')]+_0x248b8a[_0x5f85('0x18')];var _0x5ea519;if(_0x1a334d>=_0x1a6118){_0x1a334d=_0x1a6118;_0x5ea519=0xc8;}else{_0x5ea519=0xce;}_0x5232fc[_0x5f85('0x15')](_0x5ea519);return _0x5232fc[_0x5f85('0x1a')](_0x5f85('0x1b'),_0x286808+'-'+_0x1a334d+'/'+_0x1a6118)['json'](_0x1a7cba);}return null;};}function patchUpdates(_0x330634){return function(_0x511d76){try{jsonpatch['apply'](_0x511d76,_0x330634,!![]);}catch(_0x405791){return BPromise['reject'](_0x405791);}return _0x511d76['save']();};}function saveUpdates(_0x45c536,_0x3a5f5d){return function(_0x24cbb0){if(_0x24cbb0){return _0x24cbb0[_0x5f85('0x1c')](_0x45c536)[_0x5f85('0x1d')](function(_0x3d7964){return _0x3d7964;});}return null;};}function removeEntity(_0x1badd2,_0x17a809){return function(_0x8a9847){if(_0x8a9847){return _0x8a9847[_0x5f85('0x1e')]()['then'](function(){_0x1badd2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3acb4b,_0x4723f2){return function(_0xc58b39){if(!_0xc58b39){_0x3acb4b[_0x5f85('0x13')](0x194);}return _0xc58b39;};}function handleError(_0x58428c,_0x5a000e){_0x5a000e=_0x5a000e||0x1f4;return function(_0x85fb53){logger['error'](_0x85fb53['stack']);if(_0x85fb53[_0x5f85('0x1f')]){delete _0x85fb53[_0x5f85('0x1f')];}_0x58428c['status'](_0x5a000e)[_0x5f85('0x20')](_0x85fb53);};}exports[_0x5f85('0x21')]=function(_0x1c3061,_0x5f4b48){var _0x1d6786={},_0x59ec88={},_0x20e1e8={'count':0x0,'rows':[]};var _0x183c29=_[_0x5f85('0x22')](db[_0x5f85('0x23')]['rawAttributes'],function(_0x1aa37a){return{'name':_0x1aa37a[_0x5f85('0x24')],'type':_0x1aa37a[_0x5f85('0x25')][_0x5f85('0x26')]};});_0x59ec88[_0x5f85('0x27')]=_['map'](_0x183c29,_0x5f85('0x1f'));_0x59ec88[_0x5f85('0x28')]=_['keys'](_0x1c3061[_0x5f85('0x28')]);_0x59ec88['filters']=_[_0x5f85('0x29')](_0x59ec88[_0x5f85('0x27')],_0x59ec88[_0x5f85('0x28')]);_0x59ec88[_0x5f85('0x2a')]=_['concat'](_0x59ec88[_0x5f85('0x2a')],[_0x5f85('0x2b'),'$or',_0x5f85('0x2c'),_0x5f85('0x2d'),_0x5f85('0x2e'),_0x5f85('0x2f'),_0x5f85('0x30'),_0x5f85('0x31'),_0x5f85('0x32'),_0x5f85('0x33'),_0x5f85('0x34'),'$in',_0x5f85('0x35'),'$like',_0x5f85('0x36'),_0x5f85('0x37'),_0x5f85('0x38'),'$like',_0x5f85('0x39'),_0x5f85('0x3a'),_0x5f85('0x3b'),_0x5f85('0x3c')]);_0x1d6786['attributes']=_[_0x5f85('0x29')](_0x59ec88['model'],qs[_0x5f85('0x3d')](_0x1c3061[_0x5f85('0x28')]['fields']));_0x1d6786[_0x5f85('0x3e')]=_0x1d6786['attributes'][_0x5f85('0x3f')]?_0x1d6786['attributes']:_0x59ec88[_0x5f85('0x27')];if(!_0x1c3061[_0x5f85('0x28')][_0x5f85('0x40')](_0x5f85('0x41'))){_0x1d6786[_0x5f85('0x18')]=qs[_0x5f85('0x18')](_0x1c3061[_0x5f85('0x28')][_0x5f85('0x18')]);_0x1d6786[_0x5f85('0x16')]=qs[_0x5f85('0x16')](_0x1c3061['query'][_0x5f85('0x16')]);}_0x1d6786[_0x5f85('0x42')]=qs[_0x5f85('0x43')](_0x1c3061[_0x5f85('0x28')][_0x5f85('0x43')]);_0x1d6786[_0x5f85('0x44')]=qs[_0x5f85('0x2a')](_[_0x5f85('0x45')](_0x1c3061[_0x5f85('0x28')],_0x59ec88[_0x5f85('0x2a')]),_0x183c29);if(_0x1c3061[_0x5f85('0x28')][_0x5f85('0x46')]){_0x1d6786[_0x5f85('0x44')]=_[_0x5f85('0x47')](_0x1d6786[_0x5f85('0x44')],{'$or':_[_0x5f85('0x22')](_0x183c29,function(_0x230a4e){if(_0x230a4e['type']!==_0x5f85('0x48')){var _0x12d8ea={};_0x12d8ea[_0x230a4e[_0x5f85('0x1f')]]={'$like':'%'+_0x1c3061[_0x5f85('0x28')][_0x5f85('0x46')]+'%'};return _0x12d8ea;}})});}_0x1d6786=_[_0x5f85('0x47')]({},_0x1d6786,_0x1c3061[_0x5f85('0x49')]);var _0x1b6933={'where':_0x1d6786[_0x5f85('0x44')]};return db[_0x5f85('0x23')][_0x5f85('0x19')](_0x1b6933)[_0x5f85('0x1d')](function(_0x4a3b03){_0x20e1e8['count']=_0x4a3b03;if(_0x1c3061[_0x5f85('0x28')][_0x5f85('0x4a')]){_0x1d6786[_0x5f85('0x4b')]=[{'all':!![]}];}return db[_0x5f85('0x23')][_0x5f85('0x4c')](_0x1d6786);})['then'](function(_0x198600){_0x20e1e8[_0x5f85('0x4d')]=_0x198600;return _0x20e1e8;})['then'](respondWithFilteredResult(_0x5f4b48,_0x1d6786))[_0x5f85('0x4e')](handleError(_0x5f4b48,null));};exports['show']=function(_0xce91bb,_0x1a5d7b){var _0xb2c718={'raw':!![],'where':{'id':_0xce91bb[_0x5f85('0x4f')]['id']}},_0x37ec8f={};_0x37ec8f[_0x5f85('0x27')]=_[_0x5f85('0x50')](db[_0x5f85('0x23')]['rawAttributes']);_0x37ec8f['query']=_[_0x5f85('0x50')](_0xce91bb[_0x5f85('0x28')]);_0x37ec8f[_0x5f85('0x2a')]=_[_0x5f85('0x29')](_0x37ec8f[_0x5f85('0x27')],_0x37ec8f['query']);_0xb2c718['attributes']=_[_0x5f85('0x29')](_0x37ec8f[_0x5f85('0x27')],qs[_0x5f85('0x3d')](_0xce91bb[_0x5f85('0x28')][_0x5f85('0x3d')]));_0xb2c718['attributes']=_0xb2c718['attributes'][_0x5f85('0x3f')]?_0xb2c718[_0x5f85('0x3e')]:_0x37ec8f['model'];if(_0xce91bb[_0x5f85('0x28')][_0x5f85('0x4a')]){_0xb2c718[_0x5f85('0x4b')]=[{'all':!![]}];}_0xb2c718=_[_0x5f85('0x47')]({},_0xb2c718,_0xce91bb[_0x5f85('0x49')]);return db[_0x5f85('0x23')]['find'](_0xb2c718)[_0x5f85('0x1d')](handleEntityNotFound(_0x1a5d7b,null))[_0x5f85('0x1d')](respondWithResult(_0x1a5d7b,null))[_0x5f85('0x4e')](handleError(_0x1a5d7b,null));};exports[_0x5f85('0x51')]=function(_0x533596,_0x2cffba){return db[_0x5f85('0x23')][_0x5f85('0x51')](_0x533596[_0x5f85('0x52')],{})['then'](respondWithResult(_0x2cffba,0xc9))[_0x5f85('0x4e')](handleError(_0x2cffba,null));};exports[_0x5f85('0x1c')]=function(_0x15c298,_0x840415){if(_0x15c298[_0x5f85('0x52')]['id']){delete _0x15c298[_0x5f85('0x52')]['id'];}return db[_0x5f85('0x23')][_0x5f85('0x53')]({'where':{'id':_0x15c298[_0x5f85('0x4f')]['id']}})[_0x5f85('0x1d')](handleEntityNotFound(_0x840415,null))[_0x5f85('0x1d')](saveUpdates(_0x15c298['body'],null))[_0x5f85('0x1d')](respondWithResult(_0x840415,null))[_0x5f85('0x4e')](handleError(_0x840415,null));};exports[_0x5f85('0x54')]=function(_0x4f75ee,_0x4a5267){return db[_0x5f85('0x23')][_0x5f85('0x54')]()[_0x5f85('0x1d')](respondWithResult(_0x4a5267,null))['catch'](handleError(_0x4a5267,null));};exports[_0x5f85('0x1e')]=function(_0x47acd0,_0x111ffe){var _0x5020c3;return db[_0x5f85('0x23')][_0x5f85('0x53')]({'where':{'id':_0x47acd0[_0x5f85('0x4f')]['id']}})['then'](handleEntityNotFound(_0x111ffe,null))[_0x5f85('0x1d')](function(_0x4e6432){if(_0x4e6432){return _0x4e6432[_0x5f85('0x1e')]()[_0x5f85('0x1d')](function(_0x331e67){return _0x331e67;});}})[_0x5f85('0x1d')](function(_0x3dbea9){_0x5020c3=_0x3dbea9;if(_0x3dbea9){if(_0x3dbea9[_0x5f85('0x55')]||_0x3dbea9[_0x5f85('0x56')]){return db[_0x3dbea9[_0x5f85('0x55')]?_0x5f85('0x57'):_0x5f85('0x58')][_0x5f85('0x53')]({'where':{'id':_0x3dbea9[_0x5f85('0x55')]?_0x3dbea9[_0x5f85('0x55')]:_0x3dbea9['CampaignId']},'attributes':['id',_0x5f85('0x1f')],'raw':!![]});}}})[_0x5f85('0x1d')](function(_0xb8667b){var _0x10e463={};if(_0xb8667b){_[_0x5f85('0x47')](_0x10e463,_[_0x5f85('0x59')](_0x5020c3['dataValues'],['createdAt',_0x5f85('0x5a'),'id']));_0x10e463[_0x5f85('0x5b')]=0x15;_0x10e463[_0x5f85('0x5c')]=_0x5f85('0x5d');_0x10e463['campaign']=_0xb8667b[_0x5f85('0x1f')];_0x10e463[_0x5f85('0x5e')]=_0x47acd0[_0x5f85('0x5f')][_0x5f85('0x1f')];_0x10e463[_0x5f85('0x60')]=_0x47acd0['user']['id'];_0x10e463[_0x5f85('0x5d')]=!![];_0x10e463['deletedat']=moment()[_0x5f85('0x61')](_0x5f85('0x62'));_0x10e463[_0x5f85('0x63')]=_0x5020c3[_0x5f85('0x64')];_0x10e463[_0x5f85('0x65')]=_0x5020c3[_0x5f85('0x55')]?_0x5f85('0x66'):'ivr';return db[_0x5f85('0x67')]['find']({'where':{'id':_0x10e463[_0x5f85('0x68')]},'attributes':[_0x5f85('0x69'),_0x5f85('0x6a')]})[_0x5f85('0x1d')](function(_0x26e4be){if(!_[_0x5f85('0x6b')](_0x111ffe)&&!_['isNil'](_0x26e4be[_0x5f85('0x69')])){_0x10e463[_0x5f85('0x6c')]=_0x26e4be[_0x5f85('0x69')];if(!_[_0x5f85('0x6b')](_0x26e4be[_0x5f85('0x6a')])){_0x10e463[_0x5f85('0x6c')]+='\x20'+_0x26e4be[_0x5f85('0x6a')];}}})[_0x5f85('0x6d')](function(){return db[_0x5f85('0x6e')][_0x5f85('0x51')](_0x10e463);});}})[_0x5f85('0x1d')](function(){return _0x111ffe[_0x5f85('0x15')](0xcc)[_0x5f85('0x14')]();})[_0x5f85('0x4e')](handleError(_0x111ffe,null));};exports[_0x5f85('0x6f')]=function(_0x17a233,_0x52f921,_0x308176){var _0x4164fd=[];return db[_0x5f85('0x67')][_0x5f85('0x54')]()[_0x5f85('0x1d')](function(_0x5e933d){_0x4164fd=_['keys'](_0x5e933d);return _0x17a233[_0x5f85('0x5f')]['getVoiceQueues']({'where':{'type':_0x5f85('0x70'),'dialActive':!![],'dialMethod':_0x5f85('0x71')},'attributes':['id',_0x5f85('0x72')],'raw':!![]});})[_0x5f85('0x1d')](function(_0x4e1be9){if(_0x4e1be9&&_0x4e1be9['length']){return db[_0x5f85('0x73')]['transaction'](function(_0x152989){var _0x3ef659={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5f85('0x61')](_0x5f85('0x62'))},'VoiceQueueId':{'$in':_['map'](_0x4e1be9,'id')},'$or':[{'UserId':null},{'UserId':_0x17a233[_0x5f85('0x5f')]['id']}]};var _0x59c635=[];if(_0x17a233[_0x5f85('0x52')][_0x5f85('0x74')]&&_0x17a233['body'][_0x5f85('0x74')]===_0x5f85('0x75')){if(!_['isEmpty'](_0x17a233[_0x5f85('0x52')][_0x5f85('0x76')])){_0x3ef659['id']={'$in':_0x17a233[_0x5f85('0x52')][_0x5f85('0x76')]};}_0x59c635=[[_0x5f85('0x77'),_0x5f85('0x78')],[_0x5f85('0x79'),_0x4e1be9[0x0][_0x5f85('0x72')]===_0x5f85('0x78')?_0x5f85('0x7a'):_0x5f85('0x78')],db[_0x5f85('0x73')][_0x5f85('0x7b')](_0x5f85('0x7c')),['id','DESC']];}else{if(!_[_0x5f85('0x7d')](_0x17a233[_0x5f85('0x52')][_0x5f85('0x76')])){_0x3ef659['id']={'$notIn':_0x17a233[_0x5f85('0x52')][_0x5f85('0x76')]};}_0x59c635=[['priority',_0x5f85('0x7a')],[_0x5f85('0x79'),_0x4e1be9[0x0]['dialOrderByScheduledAt']],db[_0x5f85('0x73')][_0x5f85('0x7b')](_0x5f85('0x7e')),['id',_0x5f85('0x78')]];}return db['CmHopper'][_0x5f85('0x7f')]({'attributes':['id','scheduledat'],'where':_0x3ef659,'order':_0x59c635,'transaction':_0x152989,'lock':_0x152989[_0x5f85('0x80')][_0x5f85('0x81')],'include':[{'model':db['CmContact'],'as':_0x5f85('0x82'),'attributes':_0x4164fd,'include':[{'model':db[_0x5f85('0x83')],'as':_0x5f85('0x84'),'attributes':['id',_0x5f85('0x1f')]}]},{'model':db[_0x5f85('0x85')],'as':_0x5f85('0x86'),'attributes':['id','name']},{'model':db[_0x5f85('0x57')],'as':'Queue','attributes':['id','name',_0x5f85('0x87')]}]})[_0x5f85('0x1d')](function(_0x3295bc){if(_0x3295bc){return _0x3295bc[_0x5f85('0x1c')]({'UserId':_0x17a233[_0x5f85('0x5f')]['id']},{'transaction':_0x152989});}});});}})[_0x5f85('0x1d')](handleEntityNotFound(_0x52f921,null))[_0x5f85('0x1d')](respondWithResult(_0x52f921,null))[_0x5f85('0x4e')](handleError(_0x52f921,null));};exports[_0x5f85('0x88')]=function(_0x7a8ea1,_0x50cb29,_0x6b9fd8){return _0x7a8ea1[_0x5f85('0x5f')][_0x5f85('0x89')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x5f85('0x71')},'attributes':['id'],'raw':!![]})['then'](function(_0x4b60ff){if(_0x4b60ff&&_0x4b60ff['length']){return db[_0x5f85('0x23')][_0x5f85('0x19')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x5f85('0x62'))},'VoiceQueueId':{'$in':_[_0x5f85('0x22')](_0x4b60ff,'id')},'$or':[{'UserId':null},{'UserId':_0x7a8ea1[_0x5f85('0x5f')]['id']}]}});}return 0x0;})[_0x5f85('0x1d')](function(_0x1feaf6){if(!_[_0x5f85('0x6b')](_0x1feaf6)&&_['isNumber'](_0x1feaf6)){return _0x50cb29['status'](0xc8)[_0x5f85('0x8a')]({'contacts':_0x1feaf6});}else{logger[_0x5f85('0x8b')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x5f85('0x88'),0x194,'entity\x20not\x20found');_0x50cb29[_0x5f85('0x13')](0x194);}})[_0x5f85('0x4e')](handleError(_0x50cb29,null));}; \ No newline at end of file +var _0x9246=['$notILike','$like','$overlap','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','VoiceQueueId','CampaignId','omit','createdAt','updatedAt','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','CmContact','firstName','lastName','isNil','calleridname','finally','getVoiceQueues','outbound','preview','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','dialOrderByScheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','literal','findOne','scheduledat','LOCK','Contact','CmCompany','Company','CmList','List','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','intersection','model','filters','concat','$and','$or','$gt','$gte','$lte','$between','$notBetween','$notIn','$iLike'];(function(_0x2b5f98,_0xacdd1e){var _0x4764a8=function(_0x83fecc){while(--_0x83fecc){_0x2b5f98['push'](_0x2b5f98['shift']());}};_0x4764a8(++_0xacdd1e);}(_0x9246,0xdb));var _0x6924=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x9246[_0x1da527];return _0x40fc7c;};'use strict';var emlformat=require(_0x6924('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6924('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6924('0x2'));var util=require(_0x6924('0x3'));var path=require('path');var sox=require(_0x6924('0x4'));var csv=require(_0x6924('0x5'));var ejs=require(_0x6924('0x6'));var fs=require('fs');var fs_extra=require(_0x6924('0x7'));var _=require('lodash');var squel=require(_0x6924('0x8'));var crypto=require(_0x6924('0x9'));var jsforce=require(_0x6924('0xa'));var deskjs=require(_0x6924('0xb'));var toCsv=require(_0x6924('0x5'));var querystring=require(_0x6924('0xc'));var Papa=require(_0x6924('0xd'));var Redis=require(_0x6924('0xe'));var authService=require(_0x6924('0xf'));var qs=require(_0x6924('0x10'));var as=require(_0x6924('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6924('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6924('0x13'))['db'];function respondWithStatusCode(_0x2f918e,_0x4744ad){_0x4744ad=_0x4744ad||0xcc;return function(_0x67c80a){if(_0x67c80a){return _0x2f918e[_0x6924('0x14')](_0x4744ad);}return _0x2f918e['status'](_0x4744ad)[_0x6924('0x15')]();};}function respondWithResult(_0x4d74b3,_0x8e696b){_0x8e696b=_0x8e696b||0xc8;return function(_0x3c11fd){if(_0x3c11fd){return _0x4d74b3[_0x6924('0x16')](_0x8e696b)[_0x6924('0x17')](_0x3c11fd);}};}function respondWithFilteredResult(_0x2bb148,_0x3cec34){return function(_0x7c5042){if(_0x7c5042){var _0x4add90=typeof _0x3cec34['offset']===_0x6924('0x18')&&typeof _0x3cec34[_0x6924('0x19')]===_0x6924('0x18');var _0x4ada25=_0x7c5042[_0x6924('0x1a')];var _0x273ad5=_0x4add90?0x0:_0x3cec34[_0x6924('0x1b')];var _0x105ec9=_0x4add90?_0x7c5042[_0x6924('0x1a')]:_0x3cec34['offset']+_0x3cec34[_0x6924('0x19')];var _0x14d20c;if(_0x105ec9>=_0x4ada25){_0x105ec9=_0x4ada25;_0x14d20c=0xc8;}else{_0x14d20c=0xce;}_0x2bb148['status'](_0x14d20c);return _0x2bb148[_0x6924('0x1c')](_0x6924('0x1d'),_0x273ad5+'-'+_0x105ec9+'/'+_0x4ada25)[_0x6924('0x17')](_0x7c5042);}return null;};}function patchUpdates(_0x177f34){return function(_0x387af4){try{jsonpatch[_0x6924('0x1e')](_0x387af4,_0x177f34,!![]);}catch(_0x11db34){return BPromise[_0x6924('0x1f')](_0x11db34);}return _0x387af4[_0x6924('0x20')]();};}function saveUpdates(_0x3f8a59,_0x4a4edc){return function(_0x279753){if(_0x279753){return _0x279753[_0x6924('0x21')](_0x3f8a59)[_0x6924('0x22')](function(_0x725c2a){return _0x725c2a;});}return null;};}function removeEntity(_0x1bc63b,_0x181592){return function(_0x1d2e07){if(_0x1d2e07){return _0x1d2e07[_0x6924('0x23')]()['then'](function(){_0x1bc63b[_0x6924('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19b1c9,_0x1985d6){return function(_0x3c15cd){if(!_0x3c15cd){_0x19b1c9['sendStatus'](0x194);}return _0x3c15cd;};}function handleError(_0x5abaa6,_0x484a3f){_0x484a3f=_0x484a3f||0x1f4;return function(_0x573c2d){logger[_0x6924('0x24')](_0x573c2d['stack']);if(_0x573c2d[_0x6924('0x25')]){delete _0x573c2d[_0x6924('0x25')];}_0x5abaa6[_0x6924('0x16')](_0x484a3f)['send'](_0x573c2d);};}exports['index']=function(_0x2f9eab,_0x5b03a0){var _0x2f7b3e={},_0x22d443={},_0x1805af={'count':0x0,'rows':[]};var _0x10afa8=_[_0x6924('0x26')](db[_0x6924('0x27')][_0x6924('0x28')],function(_0x51952b){return{'name':_0x51952b[_0x6924('0x29')],'type':_0x51952b[_0x6924('0x2a')][_0x6924('0x2b')]};});_0x22d443['model']=_[_0x6924('0x26')](_0x10afa8,'name');_0x22d443[_0x6924('0x2c')]=_[_0x6924('0x2d')](_0x2f9eab[_0x6924('0x2c')]);_0x22d443['filters']=_[_0x6924('0x2e')](_0x22d443[_0x6924('0x2f')],_0x22d443[_0x6924('0x2c')]);_0x22d443[_0x6924('0x30')]=_[_0x6924('0x31')](_0x22d443[_0x6924('0x30')],[_0x6924('0x32'),_0x6924('0x33'),_0x6924('0x34'),_0x6924('0x35'),'$lt',_0x6924('0x36'),'$ne','$eq','$not',_0x6924('0x37'),_0x6924('0x38'),'$in',_0x6924('0x39'),'$like','$notLike',_0x6924('0x3a'),_0x6924('0x3b'),_0x6924('0x3c'),_0x6924('0x3d'),'$contains',_0x6924('0x3e'),_0x6924('0x3f')]);_0x2f7b3e['attributes']=_[_0x6924('0x2e')](_0x22d443[_0x6924('0x2f')],qs[_0x6924('0x40')](_0x2f9eab[_0x6924('0x2c')]['fields']));_0x2f7b3e[_0x6924('0x41')]=_0x2f7b3e[_0x6924('0x41')][_0x6924('0x42')]?_0x2f7b3e['attributes']:_0x22d443[_0x6924('0x2f')];if(!_0x2f9eab[_0x6924('0x2c')][_0x6924('0x43')](_0x6924('0x44'))){_0x2f7b3e[_0x6924('0x19')]=qs[_0x6924('0x19')](_0x2f9eab[_0x6924('0x2c')][_0x6924('0x19')]);_0x2f7b3e[_0x6924('0x1b')]=qs[_0x6924('0x1b')](_0x2f9eab['query'][_0x6924('0x1b')]);}_0x2f7b3e['order']=qs['sort'](_0x2f9eab[_0x6924('0x2c')][_0x6924('0x45')]);_0x2f7b3e[_0x6924('0x46')]=qs['filters'](_[_0x6924('0x47')](_0x2f9eab[_0x6924('0x2c')],_0x22d443[_0x6924('0x30')]),_0x10afa8);if(_0x2f9eab['query'][_0x6924('0x48')]){_0x2f7b3e[_0x6924('0x46')]=_[_0x6924('0x49')](_0x2f7b3e['where'],{'$or':_[_0x6924('0x26')](_0x10afa8,function(_0x1f326a){if(_0x1f326a[_0x6924('0x2a')]!==_0x6924('0x4a')){var _0xe5d78d={};_0xe5d78d[_0x1f326a[_0x6924('0x25')]]={'$like':'%'+_0x2f9eab['query'][_0x6924('0x48')]+'%'};return _0xe5d78d;}})});}_0x2f7b3e=_[_0x6924('0x49')]({},_0x2f7b3e,_0x2f9eab[_0x6924('0x4b')]);var _0x501569={'where':_0x2f7b3e['where']};return db[_0x6924('0x27')][_0x6924('0x1a')](_0x501569)[_0x6924('0x22')](function(_0x59bda4){_0x1805af[_0x6924('0x1a')]=_0x59bda4;if(_0x2f9eab[_0x6924('0x2c')]['includeAll']){_0x2f7b3e[_0x6924('0x4c')]=[{'all':!![]}];}return db[_0x6924('0x27')][_0x6924('0x4d')](_0x2f7b3e);})[_0x6924('0x22')](function(_0x4a9e75){_0x1805af[_0x6924('0x4e')]=_0x4a9e75;return _0x1805af;})['then'](respondWithFilteredResult(_0x5b03a0,_0x2f7b3e))[_0x6924('0x4f')](handleError(_0x5b03a0,null));};exports[_0x6924('0x50')]=function(_0x1a20fc,_0x1eeb05){var _0x266cb8={'raw':!![],'where':{'id':_0x1a20fc[_0x6924('0x51')]['id']}},_0x5daa1a={};_0x5daa1a[_0x6924('0x2f')]=_['keys'](db[_0x6924('0x27')][_0x6924('0x28')]);_0x5daa1a[_0x6924('0x2c')]=_[_0x6924('0x2d')](_0x1a20fc[_0x6924('0x2c')]);_0x5daa1a[_0x6924('0x30')]=_[_0x6924('0x2e')](_0x5daa1a[_0x6924('0x2f')],_0x5daa1a[_0x6924('0x2c')]);_0x266cb8[_0x6924('0x41')]=_[_0x6924('0x2e')](_0x5daa1a[_0x6924('0x2f')],qs['fields'](_0x1a20fc['query']['fields']));_0x266cb8[_0x6924('0x41')]=_0x266cb8['attributes'][_0x6924('0x42')]?_0x266cb8[_0x6924('0x41')]:_0x5daa1a[_0x6924('0x2f')];if(_0x1a20fc[_0x6924('0x2c')][_0x6924('0x52')]){_0x266cb8[_0x6924('0x4c')]=[{'all':!![]}];}_0x266cb8=_[_0x6924('0x49')]({},_0x266cb8,_0x1a20fc[_0x6924('0x4b')]);return db[_0x6924('0x27')][_0x6924('0x53')](_0x266cb8)['then'](handleEntityNotFound(_0x1eeb05,null))[_0x6924('0x22')](respondWithResult(_0x1eeb05,null))[_0x6924('0x4f')](handleError(_0x1eeb05,null));};exports[_0x6924('0x54')]=function(_0x4c46da,_0x52aa4a){return db[_0x6924('0x27')][_0x6924('0x54')](_0x4c46da[_0x6924('0x55')],{})[_0x6924('0x22')](respondWithResult(_0x52aa4a,0xc9))['catch'](handleError(_0x52aa4a,null));};exports[_0x6924('0x21')]=function(_0x7cf973,_0x14059e){if(_0x7cf973[_0x6924('0x55')]['id']){delete _0x7cf973[_0x6924('0x55')]['id'];}return db[_0x6924('0x27')]['find']({'where':{'id':_0x7cf973[_0x6924('0x51')]['id']}})[_0x6924('0x22')](handleEntityNotFound(_0x14059e,null))[_0x6924('0x22')](saveUpdates(_0x7cf973[_0x6924('0x55')],null))[_0x6924('0x22')](respondWithResult(_0x14059e,null))[_0x6924('0x4f')](handleError(_0x14059e,null));};exports[_0x6924('0x56')]=function(_0x298430,_0x1675b8){return db[_0x6924('0x27')][_0x6924('0x56')]()[_0x6924('0x22')](respondWithResult(_0x1675b8,null))[_0x6924('0x4f')](handleError(_0x1675b8,null));};exports[_0x6924('0x23')]=function(_0x4b3a44,_0xdefc6){var _0x2c7049;return db[_0x6924('0x27')][_0x6924('0x53')]({'where':{'id':_0x4b3a44[_0x6924('0x51')]['id']}})[_0x6924('0x22')](handleEntityNotFound(_0xdefc6,null))[_0x6924('0x22')](function(_0x402697){if(_0x402697){return _0x402697[_0x6924('0x23')]()['then'](function(_0x5953b3){return _0x5953b3;});}})[_0x6924('0x22')](function(_0x4b9ff3){_0x2c7049=_0x4b9ff3;if(_0x4b9ff3){if(_0x4b9ff3[_0x6924('0x57')]||_0x4b9ff3[_0x6924('0x58')]){return db[_0x4b9ff3[_0x6924('0x57')]?'VoiceQueue':'Campaign']['find']({'where':{'id':_0x4b9ff3['VoiceQueueId']?_0x4b9ff3['VoiceQueueId']:_0x4b9ff3['CampaignId']},'attributes':['id',_0x6924('0x25')],'raw':!![]});}}})[_0x6924('0x22')](function(_0x531697){var _0x44edf4={};if(_0x531697){_[_0x6924('0x49')](_0x44edf4,_[_0x6924('0x59')](_0x2c7049['dataValues'],[_0x6924('0x5a'),_0x6924('0x5b'),'id']));_0x44edf4['state']=0x15;_0x44edf4[_0x6924('0x5c')]='deleted';_0x44edf4[_0x6924('0x5d')]=_0x531697[_0x6924('0x25')];_0x44edf4[_0x6924('0x5e')]=_0x4b3a44[_0x6924('0x5f')][_0x6924('0x25')];_0x44edf4[_0x6924('0x60')]=_0x4b3a44[_0x6924('0x5f')]['id'];_0x44edf4[_0x6924('0x61')]=!![];_0x44edf4[_0x6924('0x62')]=moment()[_0x6924('0x63')](_0x6924('0x64'));_0x44edf4[_0x6924('0x65')]=_0x2c7049[_0x6924('0x66')];_0x44edf4[_0x6924('0x67')]=_0x2c7049[_0x6924('0x57')]?'queue':'ivr';return db[_0x6924('0x68')][_0x6924('0x53')]({'where':{'id':_0x44edf4['ContactId']},'attributes':[_0x6924('0x69'),_0x6924('0x6a')]})[_0x6924('0x22')](function(_0x33783a){if(!_['isNil'](_0xdefc6)&&!_[_0x6924('0x6b')](_0x33783a[_0x6924('0x69')])){_0x44edf4['calleridname']=_0x33783a[_0x6924('0x69')];if(!_['isNil'](_0x33783a[_0x6924('0x6a')])){_0x44edf4[_0x6924('0x6c')]+='\x20'+_0x33783a[_0x6924('0x6a')];}}})[_0x6924('0x6d')](function(){return db['CmHopperFinal']['create'](_0x44edf4);});}})[_0x6924('0x22')](function(){return _0xdefc6[_0x6924('0x16')](0xcc)[_0x6924('0x15')]();})['catch'](handleError(_0xdefc6,null));};exports['getPreview']=function(_0x1520e1,_0x1e3541,_0x90485a){var _0x158ea4=[];return db[_0x6924('0x68')][_0x6924('0x56')]()[_0x6924('0x22')](function(_0x3d25a8){_0x158ea4=_[_0x6924('0x2d')](_0x3d25a8);return _0x1520e1[_0x6924('0x5f')][_0x6924('0x6e')]({'where':{'type':_0x6924('0x6f'),'dialActive':!![],'dialMethod':_0x6924('0x70')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x6924('0x22')](function(_0x570087){if(_0x570087&&_0x570087[_0x6924('0x42')]){return db[_0x6924('0x71')][_0x6924('0x72')](function(_0x5b947f){var _0x33715b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6924('0x63')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x570087,'id')},'$or':[{'UserId':null},{'UserId':_0x1520e1[_0x6924('0x5f')]['id']}]};var _0x3d8078=[];if(_0x1520e1['body']['direction']&&_0x1520e1['body'][_0x6924('0x73')]===_0x6924('0x74')){if(!_[_0x6924('0x75')](_0x1520e1['body']['hopperIds'])){_0x33715b['id']={'$in':_0x1520e1['body'][_0x6924('0x76')]};}_0x3d8078=[[_0x6924('0x77'),_0x6924('0x78')],['scheduledAt',_0x570087[0x0][_0x6924('0x79')]===_0x6924('0x78')?_0x6924('0x7a'):_0x6924('0x78')],db[_0x6924('0x71')]['literal'](_0x6924('0x7b')),['id',_0x6924('0x7a')]];}else{if(!_[_0x6924('0x75')](_0x1520e1[_0x6924('0x55')][_0x6924('0x76')])){_0x33715b['id']={'$notIn':_0x1520e1[_0x6924('0x55')][_0x6924('0x76')]};}_0x3d8078=[[_0x6924('0x77'),_0x6924('0x7a')],[_0x6924('0x7c'),_0x570087[0x0][_0x6924('0x79')]],db['sequelize'][_0x6924('0x7d')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x6924('0x78')]];}return db[_0x6924('0x27')][_0x6924('0x7e')]({'attributes':['id',_0x6924('0x7f')],'where':_0x33715b,'order':_0x3d8078,'transaction':_0x5b947f,'lock':_0x5b947f[_0x6924('0x80')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x6924('0x81'),'attributes':_0x158ea4,'include':[{'model':db[_0x6924('0x82')],'as':_0x6924('0x83'),'attributes':['id',_0x6924('0x25')]}]},{'model':db[_0x6924('0x84')],'as':_0x6924('0x85'),'attributes':['id',_0x6924('0x25')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name',_0x6924('0x86')]}]})['then'](function(_0x113576){if(_0x113576){return _0x113576['update']({'UserId':_0x1520e1[_0x6924('0x5f')]['id']},{'transaction':_0x5b947f});}});});}})['then'](handleEntityNotFound(_0x1e3541,null))[_0x6924('0x22')](respondWithResult(_0x1e3541,null))['catch'](handleError(_0x1e3541,null));};exports[_0x6924('0x87')]=function(_0x1d3561,_0x5c2dcd,_0x53a98a){return _0x1d3561[_0x6924('0x5f')]['getVoiceQueues']({'where':{'type':_0x6924('0x6f'),'dialActive':!![],'dialMethod':_0x6924('0x70')},'attributes':['id'],'raw':!![]})[_0x6924('0x22')](function(_0x4c1513){if(_0x4c1513&&_0x4c1513['length']){return db[_0x6924('0x27')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x6924('0x64'))},'VoiceQueueId':{'$in':_[_0x6924('0x26')](_0x4c1513,'id')},'$or':[{'UserId':null},{'UserId':_0x1d3561[_0x6924('0x5f')]['id']}]}});}return 0x0;})[_0x6924('0x22')](function(_0x194bf0){if(!_[_0x6924('0x6b')](_0x194bf0)&&_[_0x6924('0x88')](_0x194bf0)){return _0x5c2dcd[_0x6924('0x16')](0xc8)[_0x6924('0x17')]({'contacts':_0x194bf0});}else{logger[_0x6924('0x24')](_0x6924('0x89'),_0x6924('0x87'),0x194,_0x6924('0x8a'));_0x5c2dcd[_0x6924('0x14')](0x194);}})['catch'](handleError(_0x5c2dcd,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index b28a056..6b04ae2 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 _0x4819=['request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','CmHopper','cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird'];(function(_0x326c77,_0x45a49a){var _0x5d0197=function(_0x2327da){while(--_0x2327da){_0x326c77['push'](_0x326c77['shift']());}};_0x5d0197(++_0x45a49a);}(_0x4819,0xcd));var _0x9481=function(_0x5f1d74,_0x33e095){_0x5f1d74=_0x5f1d74-0x0;var _0xab75f5=_0x4819[_0x5f1d74];return _0xab75f5;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[{'name':_0x9481('0xc'),'fields':[_0x9481('0xc')]},{'name':_0x9481('0xd'),'fields':['phone']},{'name':_0x9481('0xe'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x383c70,_0x9ac1e3){var _0x303696=function(_0x2f51fb){while(--_0x2f51fb){_0x383c70['push'](_0x383c70['shift']());}};_0x303696(++_0x9ac1e3);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x1846d0,_0x550727){_0x1846d0=_0x1846d0-0x0;var _0x46bba0=_0xc1c6[_0x1846d0];return _0x46bba0;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[{'name':_0x6c1c('0xa'),'fields':[_0x6c1c('0xa')]},{'name':'phone','fields':[_0x6c1c('0xb')]},{'name':_0x6c1c('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index fac724b..9872c48 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 _0xb969=['map','model','ShowCmHopper','where','CreateCmHopper','create','body','info','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','voicePause','UserId','push','includes','all','MoveContactManagedDialer','CmHopperFinal','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','length','GetContactRecallMe','GetCmHopperPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetCmHopper','CmHopper','findAll','options','raw','attributes','limit','include'];(function(_0x5da2c2,_0x4e00f1){var _0x1fb68f=function(_0x5d9b54){while(--_0x5d9b54){_0x5da2c2['push'](_0x5da2c2['shift']());}};_0x1fb68f(++_0x4e00f1);}(_0xb969,0x104));var _0x9b96=function(_0x55235d,_0x12846c){_0x55235d=_0x55235d-0x0;var _0x31642e=_0xb969[_0x55235d];return _0x31642e;};'use strict';var _=require(_0x9b96('0x0'));var util=require(_0x9b96('0x1'));var moment=require(_0x9b96('0x2'));var BPromise=require(_0x9b96('0x3'));var rs=require(_0x9b96('0x4'));var fs=require('fs');var Redis=require(_0x9b96('0x5'));var db=require(_0x9b96('0x6'))['db'];var utils=require(_0x9b96('0x7'));var logger=require(_0x9b96('0x8'))(_0x9b96('0x9'));var config=require(_0x9b96('0xa'));var jayson=require(_0x9b96('0xb'));var client=jayson[_0x9b96('0xc')][_0x9b96('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4f61ef,_0xfce189,_0x19b112){return new BPromise(function(_0x129e66,_0x393205){return client[_0x9b96('0xe')](_0x4f61ef,_0x19b112)[_0x9b96('0xf')](function(_0x8a03bd){logger['info'](_0x9b96('0x10'),_0xfce189,_0x9b96('0x11'));logger[_0x9b96('0x12')](_0x9b96('0x13'),_0xfce189,_0x9b96('0x11'),JSON[_0x9b96('0x14')](_0x8a03bd));if(_0x8a03bd[_0x9b96('0x15')]){if(_0x8a03bd['error']['code']===0x1f4){logger[_0x9b96('0x15')](_0x9b96('0x10'),_0xfce189,_0x8a03bd[_0x9b96('0x15')][_0x9b96('0x16')]);return _0x393205(_0x8a03bd[_0x9b96('0x15')]['message']);}logger[_0x9b96('0x15')](_0x9b96('0x10'),_0xfce189,_0x8a03bd[_0x9b96('0x15')][_0x9b96('0x16')]);return _0x129e66(_0x8a03bd[_0x9b96('0x15')]['message']);}else{logger['info'](_0x9b96('0x10'),_0xfce189,_0x9b96('0x11'));_0x129e66(_0x8a03bd['result']['message']);}})[_0x9b96('0x17')](function(_0x583a7b){logger[_0x9b96('0x15')](_0x9b96('0x10'),_0xfce189,_0x583a7b);_0x393205(_0x583a7b);});});}exports[_0x9b96('0x18')]=function(_0x2a2b3a){var _0x260938=this;return new Promise(function(_0x2b1a84,_0x26a75b){return db[_0x9b96('0x19')][_0x9b96('0x1a')]({'raw':_0x2a2b3a[_0x9b96('0x1b')]?_0x2a2b3a['options'][_0x9b96('0x1c')]===undefined?!![]:![]:!![],'where':_0x2a2b3a[_0x9b96('0x1b')]?_0x2a2b3a[_0x9b96('0x1b')]['where']||null:null,'attributes':_0x2a2b3a[_0x9b96('0x1b')]?_0x2a2b3a['options'][_0x9b96('0x1d')]||null:null,'limit':_0x2a2b3a[_0x9b96('0x1b')]?_0x2a2b3a[_0x9b96('0x1b')][_0x9b96('0x1e')]||null:null,'include':_0x2a2b3a['options']?_0x2a2b3a[_0x9b96('0x1b')][_0x9b96('0x1f')]?_[_0x9b96('0x20')](_0x2a2b3a[_0x9b96('0x1b')]['include'],function(_0x423e62){return{'model':db[_0x423e62['model']],'as':_0x423e62['as'],'attributes':_0x423e62[_0x9b96('0x1d')],'include':_0x423e62[_0x9b96('0x1f')]?_['map'](_0x423e62[_0x9b96('0x1f')],function(_0x1fd7b5){return{'model':db[_0x1fd7b5[_0x9b96('0x21')]],'as':_0x1fd7b5['as'],'attributes':_0x1fd7b5[_0x9b96('0x1d')],'include':_0x1fd7b5['include']?_[_0x9b96('0x20')](_0x1fd7b5[_0x9b96('0x1f')],function(_0x488836){return{'model':db[_0x488836[_0x9b96('0x21')]],'as':_0x488836['as'],'attributes':_0x488836[_0x9b96('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9b96('0xf')](function(_0x1c5e7f){logger['info']('GetCmHopper',_0x2a2b3a);logger[_0x9b96('0x12')]('GetCmHopper',_0x2a2b3a,JSON[_0x9b96('0x14')](_0x1c5e7f));_0x2b1a84(_0x1c5e7f);})[_0x9b96('0x17')](function(_0x453dd1){logger[_0x9b96('0x15')](_0x9b96('0x18'),_0x453dd1[_0x9b96('0x16')],_0x2a2b3a);_0x26a75b(_0x260938[_0x9b96('0x15')](0x1f4,_0x453dd1[_0x9b96('0x16')]));});});};exports[_0x9b96('0x22')]=function(_0x240ccf){var _0xbc07e7=this;return new Promise(function(_0x583237,_0x581005){return db[_0x9b96('0x19')]['find']({'raw':_0x240ccf[_0x9b96('0x1b')]?_0x240ccf[_0x9b96('0x1b')][_0x9b96('0x1c')]===undefined?!![]:![]:!![],'where':_0x240ccf[_0x9b96('0x1b')]?_0x240ccf['options'][_0x9b96('0x23')]||null:null,'attributes':_0x240ccf[_0x9b96('0x1b')]?_0x240ccf[_0x9b96('0x1b')][_0x9b96('0x1d')]||null:null,'include':_0x240ccf[_0x9b96('0x1b')]?_0x240ccf[_0x9b96('0x1b')][_0x9b96('0x1f')]?_['map'](_0x240ccf[_0x9b96('0x1b')][_0x9b96('0x1f')],function(_0x33bcb3){return{'model':db[_0x33bcb3[_0x9b96('0x21')]],'as':_0x33bcb3['as'],'attributes':_0x33bcb3[_0x9b96('0x1d')],'include':_0x33bcb3[_0x9b96('0x1f')]?_[_0x9b96('0x20')](_0x33bcb3[_0x9b96('0x1f')],function(_0x128c90){return{'model':db[_0x128c90[_0x9b96('0x21')]],'as':_0x128c90['as'],'attributes':_0x128c90[_0x9b96('0x1d')],'include':_0x128c90[_0x9b96('0x1f')]?_[_0x9b96('0x20')](_0x128c90[_0x9b96('0x1f')],function(_0xca8575){return{'model':db[_0xca8575['model']],'as':_0xca8575['as'],'attributes':_0xca8575[_0x9b96('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9b96('0xf')](function(_0xd29068){logger['info'](_0x9b96('0x22'),_0x240ccf);logger[_0x9b96('0x12')](_0x9b96('0x22'),_0x240ccf,JSON[_0x9b96('0x14')](_0xd29068));_0x583237(_0xd29068);})[_0x9b96('0x17')](function(_0x72c11c){logger[_0x9b96('0x15')]('ShowCmHopper',_0x72c11c[_0x9b96('0x16')],_0x240ccf);_0x581005(_0xbc07e7['error'](0x1f4,_0x72c11c[_0x9b96('0x16')]));});});};exports[_0x9b96('0x24')]=function(_0x161ff5){var _0x1001f4=this;return new Promise(function(_0x35f3a2,_0x38195d){return db[_0x9b96('0x19')][_0x9b96('0x25')](_0x161ff5[_0x9b96('0x26')],{'raw':_0x161ff5[_0x9b96('0x1b')]?_0x161ff5[_0x9b96('0x1b')][_0x9b96('0x1c')]===undefined?!![]:![]:!![]})[_0x9b96('0xf')](function(_0x2271d9){logger[_0x9b96('0x27')](_0x9b96('0x24'),_0x161ff5);logger['debug'](_0x9b96('0x24'),_0x161ff5,JSON[_0x9b96('0x14')](_0x2271d9));_0x35f3a2(_0x2271d9);})[_0x9b96('0x17')](function(_0x4486a6){logger[_0x9b96('0x15')](_0x9b96('0x24'),_0x4486a6['message'],_0x161ff5);_0x38195d(_0x1001f4[_0x9b96('0x15')](0x1f4,_0x4486a6[_0x9b96('0x16')]));});});};exports[_0x9b96('0x28')]=function(_0x539b5a){var _0x3fa72a=this;return new Promise(function(_0x5368c6,_0x525643){return db['CmHopper'][_0x9b96('0x29')](_0x539b5a[_0x9b96('0x26')],{'raw':_0x539b5a['options']?_0x539b5a[_0x9b96('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x539b5a['options']?_0x539b5a[_0x9b96('0x1b')]['where']||null:null,'attributes':_0x539b5a[_0x9b96('0x1b')]?_0x539b5a[_0x9b96('0x1b')][_0x9b96('0x1d')]||null:null,'limit':_0x539b5a['options']?_0x539b5a[_0x9b96('0x1b')]['limit']||null:null})[_0x9b96('0xf')](function(_0x38d425){logger[_0x9b96('0x27')]('UpdateCmHopper',_0x539b5a);logger[_0x9b96('0x12')](_0x9b96('0x28'),_0x539b5a,JSON[_0x9b96('0x14')](_0x38d425));_0x5368c6(_0x38d425);})[_0x9b96('0x17')](function(_0x3f688d){logger['error']('UpdateCmHopper',_0x3f688d[_0x9b96('0x16')],_0x539b5a);_0x525643(_0x3fa72a[_0x9b96('0x15')](0x1f4,_0x3f688d[_0x9b96('0x16')]));});});};exports[_0x9b96('0x2a')]=function(_0x3875c4){var _0x13e62d=this;return new Promise(function(_0x431f7,_0x50c322){return db[_0x9b96('0x19')][_0x9b96('0x2b')]({'where':_0x3875c4[_0x9b96('0x1b')]?_0x3875c4[_0x9b96('0x1b')][_0x9b96('0x23')]||null:null})[_0x9b96('0xf')](function(_0x1ba50b){logger[_0x9b96('0x27')]('DestroyCmHopper',_0x3875c4);logger['debug'](_0x9b96('0x2a'),_0x3875c4,JSON[_0x9b96('0x14')](_0x1ba50b));_0x431f7(_0x1ba50b);})['catch'](function(_0x16dc9d){logger[_0x9b96('0x15')](_0x9b96('0x2a'),_0x16dc9d['message'],_0x3875c4);_0x50c322(_0x13e62d[_0x9b96('0x15')](0x1f4,_0x16dc9d[_0x9b96('0x16')]));});});};exports[_0x9b96('0x2c')]=function(_0x1d1543){var _0x34651f=this;return new Promise(function(_0x53ba8e,_0x13c7f4){return db[_0x9b96('0x2d')][_0x9b96('0x2e')]()['then'](function(_0xef82e3){return db[_0x9b96('0x2f')][_0x9b96('0x30')](function(_0x5c49e1){return db[_0x9b96('0x19')][_0x9b96('0x1a')]({'where':_0x1d1543['options']?_0x1d1543[_0x9b96('0x1b')][_0x9b96('0x23')]||null:null,'attributes':_0x1d1543['options']?_0x1d1543['options'][_0x9b96('0x1d')]||null:null,'limit':_0x1d1543['options']?_0x1d1543[_0x9b96('0x1b')][_0x9b96('0x1e')]||null:null,'order':_0x1d1543[_0x9b96('0x1b')]?_0x1d1543[_0x9b96('0x1b')][_0x9b96('0x31')]||null:null,'transaction':_0x5c49e1,'lock':_0x5c49e1[_0x9b96('0x32')][_0x9b96('0x33')],'include':[{'model':db['CmContact'],'as':_0x9b96('0x34'),'attributes':_[_0x9b96('0x35')](_0xef82e3)},{'model':db[_0x9b96('0x36')],'as':_0x9b96('0x37'),'attributes':['id','name',_0x9b96('0x38')]}]})[_0x9b96('0xf')](function(_0x1a2665){var _0xe0eb1a=[];var _0x39b320=[];for(var _0x563f2e=0x0;_0x563f2e<_0x1a2665['length'];_0x563f2e+=0x1){var _0x4b20dd=_0x1a2665[_0x563f2e][_0x9b96('0x39')];if(_0x4b20dd===null){_0xe0eb1a[_0x9b96('0x3a')](_0x1a2665[_0x563f2e][_0x9b96('0x29')](_0x1d1543['body'],{'transaction':_0x5c49e1}));}else if(!_0x39b320[_0x9b96('0x3b')](_0x4b20dd)){_0x39b320[_0x9b96('0x3a')](_0x4b20dd);_0xe0eb1a[_0x9b96('0x3a')](_0x1a2665[_0x563f2e]['update'](_0x1d1543[_0x9b96('0x26')],{'transaction':_0x5c49e1}));}}return BPromise[_0x9b96('0x3c')](_0xe0eb1a);});})[_0x9b96('0xf')](function(_0x210ff1){logger[_0x9b96('0x27')](_0x9b96('0x2c'),_0x1d1543);logger[_0x9b96('0x12')](_0x9b96('0x2c'),_0x1d1543,JSON[_0x9b96('0x14')](_0x210ff1));_0x53ba8e(_0x210ff1);})['catch'](function(_0x3d8611){logger[_0x9b96('0x15')](_0x9b96('0x2c'),_0x3d8611[_0x9b96('0x16')],_0x1d1543);_0x13c7f4(_0x34651f[_0x9b96('0x15')](0x1f4,_0x3d8611[_0x9b96('0x16')]));});});});};exports[_0x9b96('0x3d')]=function(_0x19105f){var _0x4b0e31=this;return new Promise(function(_0x4b4039,_0xbbd8d2){return db[_0x9b96('0x2f')]['transaction'](function(_0x4b51eb){return db[_0x9b96('0x3e')][_0x9b96('0x25')](_0x19105f[_0x9b96('0x26')],{'raw':_0x19105f[_0x9b96('0x1b')]?_0x19105f[_0x9b96('0x1b')][_0x9b96('0x1c')]===undefined?!![]:![]:!![],'transaction':_0x4b51eb})[_0x9b96('0xf')](function(){return db['CmHopper']['destroy']({'where':_0x19105f[_0x9b96('0x1b')]?_0x19105f['options']['where']||null:null,'transaction':_0x4b51eb});});})['then'](function(_0x2458ee){logger[_0x9b96('0x27')](_0x9b96('0x3d'),_0x19105f);logger[_0x9b96('0x12')](_0x9b96('0x3d'),_0x19105f,JSON[_0x9b96('0x14')](_0x2458ee));_0x4b4039(_0x2458ee);})['catch'](function(_0x2d5e28){logger[_0x9b96('0x15')](_0x9b96('0x3d'),_0x2d5e28[_0x9b96('0x16')],_0x19105f);_0xbbd8d2(_0x4b0e31[_0x9b96('0x15')](0x1f4,_0x2d5e28[_0x9b96('0x16')]));});});};exports['CountReScheduled']=function(_0x1af3f3){var _0x3b95e8=this;return new Promise(function(_0x4d1f32,_0x161e19){return db[_0x9b96('0x19')][_0x9b96('0x1a')]({'raw':_0x1af3f3['options']?_0x1af3f3[_0x9b96('0x1b')][_0x9b96('0x1c')]===undefined?!![]:![]:!![],'where':_0x1af3f3['options']?_0x1af3f3[_0x9b96('0x1b')][_0x9b96('0x23')]||null:null,'attributes':[[db[_0x9b96('0x2f')]['fn'](_0x9b96('0x3f'),db['sequelize']['fn']('IF',db['sequelize'][_0x9b96('0x40')](_0x9b96('0x41')+util[_0x9b96('0x42')]('\x22%s\x22',moment()['format'](_0x9b96('0x43')))+_0x9b96('0x44')))),'contactsRescheduled']]})[_0x9b96('0xf')](function(_0x44bb52){logger[_0x9b96('0x27')]('CountReScheduled',_0x1af3f3);logger[_0x9b96('0x12')]('CountReScheduled',_0x1af3f3,JSON[_0x9b96('0x14')](_0x44bb52));_0x4d1f32(_0x44bb52);})[_0x9b96('0x17')](function(_0x1497fe){logger[_0x9b96('0x15')](_0x9b96('0x45'),_0x1497fe['message'],_0x1af3f3);_0x161e19(_0x3b95e8['error'](0x1f4,_0x1497fe[_0x9b96('0x16')]));});});};exports['GetContactRecallMe']=function(_0x2562d1){var _0x53878a=this;return new Promise(function(_0x3333b6,_0x5f3dff){return db[_0x9b96('0x2d')]['describe']()[_0x9b96('0xf')](function(_0x255bd0){return db[_0x9b96('0x2f')][_0x9b96('0x30')](function(_0x3d9045){return db['CmHopper'][_0x9b96('0x1a')]({'where':_0x2562d1['options']?_0x2562d1[_0x9b96('0x1b')][_0x9b96('0x23')]||null:null,'attributes':_0x2562d1[_0x9b96('0x1b')]?_0x2562d1[_0x9b96('0x1b')][_0x9b96('0x1d')]||null:null,'limit':0x1,'order':_0x2562d1[_0x9b96('0x1b')]?_0x2562d1[_0x9b96('0x1b')][_0x9b96('0x31')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x3d9045,'lock':_0x3d9045[_0x9b96('0x32')][_0x9b96('0x33')],'include':_0x2562d1[_0x9b96('0x1b')]?_0x2562d1[_0x9b96('0x1b')][_0x9b96('0x1f')]?_[_0x9b96('0x20')](_0x2562d1[_0x9b96('0x1b')]['include'],function(_0x5ab493){return{'model':db[_0x5ab493['model']],'as':_0x5ab493['as'],'attributes':_0x5ab493['attributes'],'include':_0x5ab493[_0x9b96('0x1f')]?_[_0x9b96('0x20')](_0x5ab493[_0x9b96('0x1f')],function(_0x1ecaf9){return{'model':db[_0x1ecaf9[_0x9b96('0x21')]],'as':_0x1ecaf9['as'],'attributes':_0x1ecaf9['attributes'],'include':_0x1ecaf9[_0x9b96('0x1f')]?_['map'](_0x1ecaf9['include'],function(_0x510582){return{'model':db[_0x510582[_0x9b96('0x21')]],'as':_0x510582['as'],'attributes':_0x510582['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5eb17c){var _0xe2194d=[];for(var _0x53db34=0x0;_0x53db34<_0x5eb17c[_0x9b96('0x46')];_0x53db34+=0x1){_0xe2194d[_0x9b96('0x3a')](_0x5eb17c[_0x53db34][_0x9b96('0x29')](_0x2562d1[_0x9b96('0x26')],{'transaction':_0x3d9045}));}return BPromise['all'](_0xe2194d);});})[_0x9b96('0xf')](function(_0x457902){logger[_0x9b96('0x27')]('GetContactRecallMe',_0x2562d1);logger[_0x9b96('0x12')](_0x9b96('0x47'),_0x2562d1,JSON[_0x9b96('0x14')](_0x457902));_0x3333b6(_0x457902);})[_0x9b96('0x17')](function(_0x22b639){logger[_0x9b96('0x15')](_0x9b96('0x47'),_0x22b639[_0x9b96('0x16')],_0x2562d1);_0x5f3dff(_0x53878a[_0x9b96('0x15')](0x1f4,_0x22b639[_0x9b96('0x16')]));});});});};exports[_0x9b96('0x48')]=function(_0x154094){var _0x54b857=this;return new Promise(function(_0x22e687,_0x1f6580){db[_0x9b96('0x2d')][_0x9b96('0x2e')]()['then'](function(_0x5cb344){return db['CmHopper']['findAll']({'raw':_0x154094[_0x9b96('0x1b')]?_0x154094['options'][_0x9b96('0x1c')]===undefined?!![]:![]:!![],'where':_0x154094[_0x9b96('0x1b')]?_0x154094[_0x9b96('0x1b')][_0x9b96('0x23')]||null:null,'attributes':_0x154094[_0x9b96('0x1b')]?_0x154094[_0x9b96('0x1b')][_0x9b96('0x1d')]||null:null,'limit':_0x154094['options']?_0x154094[_0x9b96('0x1b')][_0x9b96('0x1e')]||null:null,'include':_0x154094[_0x9b96('0x1b')]?_0x154094[_0x9b96('0x1b')]['include']?_[_0x9b96('0x20')](_0x154094[_0x9b96('0x1b')][_0x9b96('0x1f')],function(_0x57d54e){return{'model':db[_0x57d54e[_0x9b96('0x21')]],'as':_0x57d54e['as'],'attributes':_0x57d54e['as']===_0x9b96('0x34')?_[_0x9b96('0x35')](_0x5cb344):_0x57d54e[_0x9b96('0x1d')],'include':_0x57d54e[_0x9b96('0x1f')]?_[_0x9b96('0x20')](_0x57d54e[_0x9b96('0x1f')],function(_0x54d0cb){return{'model':db[_0x54d0cb[_0x9b96('0x21')]],'as':_0x54d0cb['as'],'attributes':_0x54d0cb[_0x9b96('0x1d')],'include':_0x54d0cb['include']?_[_0x9b96('0x20')](_0x54d0cb['include'],function(_0x3cfa30){return{'model':db[_0x3cfa30[_0x9b96('0x21')]],'as':_0x3cfa30['as'],'attributes':_0x3cfa30['attributes']};}):[]};}):[]};}):[]:[]})[_0x9b96('0xf')](function(_0x56a2f1){logger[_0x9b96('0x27')](_0x9b96('0x18'),_0x154094);logger[_0x9b96('0x12')](_0x9b96('0x18'),_0x154094,JSON[_0x9b96('0x14')](_0x56a2f1));_0x22e687(_0x56a2f1);})[_0x9b96('0x17')](function(_0x425802){logger[_0x9b96('0x15')](_0x9b96('0x18'),_0x425802[_0x9b96('0x16')],_0x154094);_0x1f6580(_0x54b857[_0x9b96('0x15')](0x1f4,_0x425802[_0x9b96('0x16')]));});});});}; \ No newline at end of file +var _0x10ea=['GetContactRecallMe','order','GetCmHopperPreview','Contact','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','info','result','catch','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','model','map','then','find','raw','ShowCmHopper','CreateCmHopper','body','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','describe','LOCK','UPDATE','CmContact','keys','User','Agent','name','voicePause','length','UserId','includes','push','all','sequelize','transaction','create','MoveContactManagedDialer','CountReScheduled','literal','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x10ea,0x1ba));var _0xa10e=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0x10ea[_0x510b98];return _0x45e775;};'use strict';var _=require(_0xa10e('0x0'));var util=require(_0xa10e('0x1'));var moment=require(_0xa10e('0x2'));var BPromise=require(_0xa10e('0x3'));var rs=require(_0xa10e('0x4'));var fs=require('fs');var Redis=require(_0xa10e('0x5'));var db=require(_0xa10e('0x6'))['db'];var utils=require(_0xa10e('0x7'));var logger=require(_0xa10e('0x8'))(_0xa10e('0x9'));var config=require(_0xa10e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa10e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29de5c,_0x203a52,_0x1f29da){return new BPromise(function(_0x5a7322,_0x4e54a9){return client[_0xa10e('0xc')](_0x29de5c,_0x1f29da)['then'](function(_0x28be7f){logger['info']('CmHopper,\x20%s,\x20%s',_0x203a52,_0xa10e('0xd'));logger[_0xa10e('0xe')](_0xa10e('0xf'),_0x203a52,_0xa10e('0xd'),JSON[_0xa10e('0x10')](_0x28be7f));if(_0x28be7f['error']){if(_0x28be7f[_0xa10e('0x11')][_0xa10e('0x12')]===0x1f4){logger['error'](_0xa10e('0x13'),_0x203a52,_0x28be7f[_0xa10e('0x11')][_0xa10e('0x14')]);return _0x4e54a9(_0x28be7f[_0xa10e('0x11')]['message']);}logger[_0xa10e('0x11')](_0xa10e('0x13'),_0x203a52,_0x28be7f[_0xa10e('0x11')]['message']);return _0x5a7322(_0x28be7f[_0xa10e('0x11')][_0xa10e('0x14')]);}else{logger[_0xa10e('0x15')]('CmHopper,\x20%s,\x20%s',_0x203a52,'request\x20sent');_0x5a7322(_0x28be7f[_0xa10e('0x16')][_0xa10e('0x14')]);}})[_0xa10e('0x17')](function(_0xaf516b){logger[_0xa10e('0x11')](_0xa10e('0x13'),_0x203a52,_0xaf516b);_0x4e54a9(_0xaf516b);});});}exports[_0xa10e('0x18')]=function(_0x283780){var _0x344aab=this;return new Promise(function(_0xfd27b7,_0x1643b0){return db[_0xa10e('0x19')][_0xa10e('0x1a')]({'raw':_0x283780[_0xa10e('0x1b')]?_0x283780[_0xa10e('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x283780[_0xa10e('0x1b')]?_0x283780[_0xa10e('0x1b')][_0xa10e('0x1c')]||null:null,'attributes':_0x283780['options']?_0x283780[_0xa10e('0x1b')][_0xa10e('0x1d')]||null:null,'limit':_0x283780[_0xa10e('0x1b')]?_0x283780[_0xa10e('0x1b')][_0xa10e('0x1e')]||null:null,'include':_0x283780['options']?_0x283780[_0xa10e('0x1b')][_0xa10e('0x1f')]?_['map'](_0x283780[_0xa10e('0x1b')][_0xa10e('0x1f')],function(_0x546f13){return{'model':db[_0x546f13[_0xa10e('0x20')]],'as':_0x546f13['as'],'attributes':_0x546f13[_0xa10e('0x1d')],'include':_0x546f13[_0xa10e('0x1f')]?_[_0xa10e('0x21')](_0x546f13[_0xa10e('0x1f')],function(_0x357dc7){return{'model':db[_0x357dc7[_0xa10e('0x20')]],'as':_0x357dc7['as'],'attributes':_0x357dc7[_0xa10e('0x1d')],'include':_0x357dc7[_0xa10e('0x1f')]?_[_0xa10e('0x21')](_0x357dc7[_0xa10e('0x1f')],function(_0x3c6210){return{'model':db[_0x3c6210['model']],'as':_0x3c6210['as'],'attributes':_0x3c6210['attributes']};}):[]};}):[]};}):[]:[]})[_0xa10e('0x22')](function(_0x375a21){logger[_0xa10e('0x15')](_0xa10e('0x18'),_0x283780);logger['debug']('GetCmHopper',_0x283780,JSON[_0xa10e('0x10')](_0x375a21));_0xfd27b7(_0x375a21);})[_0xa10e('0x17')](function(_0x53c390){logger[_0xa10e('0x11')](_0xa10e('0x18'),_0x53c390['message'],_0x283780);_0x1643b0(_0x344aab[_0xa10e('0x11')](0x1f4,_0x53c390[_0xa10e('0x14')]));});});};exports['ShowCmHopper']=function(_0x197729){var _0x299de0=this;return new Promise(function(_0x444598,_0x40e18f){return db[_0xa10e('0x19')][_0xa10e('0x23')]({'raw':_0x197729[_0xa10e('0x1b')]?_0x197729[_0xa10e('0x1b')][_0xa10e('0x24')]===undefined?!![]:![]:!![],'where':_0x197729['options']?_0x197729[_0xa10e('0x1b')]['where']||null:null,'attributes':_0x197729[_0xa10e('0x1b')]?_0x197729[_0xa10e('0x1b')][_0xa10e('0x1d')]||null:null,'include':_0x197729['options']?_0x197729[_0xa10e('0x1b')]['include']?_[_0xa10e('0x21')](_0x197729[_0xa10e('0x1b')]['include'],function(_0x5dd481){return{'model':db[_0x5dd481[_0xa10e('0x20')]],'as':_0x5dd481['as'],'attributes':_0x5dd481[_0xa10e('0x1d')],'include':_0x5dd481[_0xa10e('0x1f')]?_[_0xa10e('0x21')](_0x5dd481[_0xa10e('0x1f')],function(_0x6501b){return{'model':db[_0x6501b[_0xa10e('0x20')]],'as':_0x6501b['as'],'attributes':_0x6501b[_0xa10e('0x1d')],'include':_0x6501b[_0xa10e('0x1f')]?_['map'](_0x6501b[_0xa10e('0x1f')],function(_0x4feaf6){return{'model':db[_0x4feaf6[_0xa10e('0x20')]],'as':_0x4feaf6['as'],'attributes':_0x4feaf6['attributes']};}):[]};}):[]};}):[]:[]})[_0xa10e('0x22')](function(_0x7b8f7d){logger['info']('ShowCmHopper',_0x197729);logger['debug'](_0xa10e('0x25'),_0x197729,JSON[_0xa10e('0x10')](_0x7b8f7d));_0x444598(_0x7b8f7d);})[_0xa10e('0x17')](function(_0x126964){logger['error'](_0xa10e('0x25'),_0x126964[_0xa10e('0x14')],_0x197729);_0x40e18f(_0x299de0[_0xa10e('0x11')](0x1f4,_0x126964[_0xa10e('0x14')]));});});};exports[_0xa10e('0x26')]=function(_0x3452d5){var _0xf8f9f5=this;return new Promise(function(_0x256534,_0x7d594c){return db['CmHopper']['create'](_0x3452d5[_0xa10e('0x27')],{'raw':_0x3452d5[_0xa10e('0x1b')]?_0x3452d5['options'][_0xa10e('0x24')]===undefined?!![]:![]:!![]})[_0xa10e('0x22')](function(_0x196bec){logger[_0xa10e('0x15')](_0xa10e('0x26'),_0x3452d5);logger[_0xa10e('0xe')](_0xa10e('0x26'),_0x3452d5,JSON[_0xa10e('0x10')](_0x196bec));_0x256534(_0x196bec);})[_0xa10e('0x17')](function(_0x33f5b2){logger['error'](_0xa10e('0x26'),_0x33f5b2[_0xa10e('0x14')],_0x3452d5);_0x7d594c(_0xf8f9f5['error'](0x1f4,_0x33f5b2['message']));});});};exports[_0xa10e('0x28')]=function(_0x227f47){var _0x574462=this;return new Promise(function(_0x243e02,_0x403299){return db[_0xa10e('0x19')][_0xa10e('0x29')](_0x227f47[_0xa10e('0x27')],{'raw':_0x227f47[_0xa10e('0x1b')]?_0x227f47['options'][_0xa10e('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x227f47['options']?_0x227f47[_0xa10e('0x1b')]['where']||null:null,'attributes':_0x227f47[_0xa10e('0x1b')]?_0x227f47['options']['attributes']||null:null,'limit':_0x227f47['options']?_0x227f47[_0xa10e('0x1b')][_0xa10e('0x1e')]||null:null})['then'](function(_0x3ab73b){logger[_0xa10e('0x15')]('UpdateCmHopper',_0x227f47);logger[_0xa10e('0xe')](_0xa10e('0x28'),_0x227f47,JSON[_0xa10e('0x10')](_0x3ab73b));_0x243e02(_0x3ab73b);})[_0xa10e('0x17')](function(_0xcb0fe5){logger[_0xa10e('0x11')](_0xa10e('0x28'),_0xcb0fe5['message'],_0x227f47);_0x403299(_0x574462[_0xa10e('0x11')](0x1f4,_0xcb0fe5[_0xa10e('0x14')]));});});};exports[_0xa10e('0x2a')]=function(_0x44854b){var _0x5d7f6d=this;return new Promise(function(_0x454dad,_0x233b7f){return db[_0xa10e('0x19')][_0xa10e('0x2b')]({'where':_0x44854b[_0xa10e('0x1b')]?_0x44854b[_0xa10e('0x1b')][_0xa10e('0x1c')]||null:null})[_0xa10e('0x22')](function(_0x41b893){logger['info'](_0xa10e('0x2a'),_0x44854b);logger[_0xa10e('0xe')](_0xa10e('0x2a'),_0x44854b,JSON[_0xa10e('0x10')](_0x41b893));_0x454dad(_0x41b893);})[_0xa10e('0x17')](function(_0x56bd92){logger[_0xa10e('0x11')](_0xa10e('0x2a'),_0x56bd92[_0xa10e('0x14')],_0x44854b);_0x233b7f(_0x5d7f6d[_0xa10e('0x11')](0x1f4,_0x56bd92[_0xa10e('0x14')]));});});};exports[_0xa10e('0x2c')]=function(_0x530061){var _0xd2008a=this;return new Promise(function(_0x564aeb,_0xff4816){return db['CmContact'][_0xa10e('0x2d')]()[_0xa10e('0x22')](function(_0x5b772e){return db['sequelize']['transaction'](function(_0x1a2969){return db[_0xa10e('0x19')][_0xa10e('0x1a')]({'where':_0x530061[_0xa10e('0x1b')]?_0x530061[_0xa10e('0x1b')]['where']||null:null,'attributes':_0x530061[_0xa10e('0x1b')]?_0x530061[_0xa10e('0x1b')][_0xa10e('0x1d')]||null:null,'limit':_0x530061[_0xa10e('0x1b')]?_0x530061[_0xa10e('0x1b')][_0xa10e('0x1e')]||null:null,'order':_0x530061[_0xa10e('0x1b')]?_0x530061[_0xa10e('0x1b')]['order']||null:null,'transaction':_0x1a2969,'lock':_0x1a2969[_0xa10e('0x2e')][_0xa10e('0x2f')],'include':[{'model':db[_0xa10e('0x30')],'as':'Contact','attributes':_[_0xa10e('0x31')](_0x5b772e)},{'model':db[_0xa10e('0x32')],'as':_0xa10e('0x33'),'attributes':['id',_0xa10e('0x34'),_0xa10e('0x35')]}]})['then'](function(_0x40057){var _0x25abba=[];var _0x2245ae=[];for(var _0x131dd7=0x0;_0x131dd7<_0x40057[_0xa10e('0x36')];_0x131dd7+=0x1){var _0x3d5dde=_0x40057[_0x131dd7][_0xa10e('0x37')];if(_0x3d5dde===null){_0x25abba['push'](_0x40057[_0x131dd7][_0xa10e('0x29')](_0x530061[_0xa10e('0x27')],{'transaction':_0x1a2969}));}else if(!_0x2245ae[_0xa10e('0x38')](_0x3d5dde)){_0x2245ae[_0xa10e('0x39')](_0x3d5dde);_0x25abba[_0xa10e('0x39')](_0x40057[_0x131dd7][_0xa10e('0x29')](_0x530061['body'],{'transaction':_0x1a2969}));}}return BPromise[_0xa10e('0x3a')](_0x25abba);});})['then'](function(_0xa67169){logger['info']('GetContactDialer',_0x530061);logger[_0xa10e('0xe')](_0xa10e('0x2c'),_0x530061,JSON['stringify'](_0xa67169));_0x564aeb(_0xa67169);})['catch'](function(_0x499e57){logger['error'](_0xa10e('0x2c'),_0x499e57[_0xa10e('0x14')],_0x530061);_0xff4816(_0xd2008a['error'](0x1f4,_0x499e57[_0xa10e('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x2b9255){var _0x1a34d5=this;return new Promise(function(_0xb80b95,_0x1023e9){return db[_0xa10e('0x3b')][_0xa10e('0x3c')](function(_0x45d5da){return db['CmHopperFinal'][_0xa10e('0x3d')](_0x2b9255['body'],{'raw':_0x2b9255[_0xa10e('0x1b')]?_0x2b9255[_0xa10e('0x1b')][_0xa10e('0x24')]===undefined?!![]:![]:!![],'transaction':_0x45d5da})[_0xa10e('0x22')](function(){return db[_0xa10e('0x19')]['destroy']({'where':_0x2b9255[_0xa10e('0x1b')]?_0x2b9255[_0xa10e('0x1b')][_0xa10e('0x1c')]||null:null,'transaction':_0x45d5da});});})[_0xa10e('0x22')](function(_0x16bba8){logger[_0xa10e('0x15')](_0xa10e('0x3e'),_0x2b9255);logger[_0xa10e('0xe')]('MoveContactManagedDialer',_0x2b9255,JSON[_0xa10e('0x10')](_0x16bba8));_0xb80b95(_0x16bba8);})[_0xa10e('0x17')](function(_0x35e35d){logger[_0xa10e('0x11')](_0xa10e('0x3e'),_0x35e35d[_0xa10e('0x14')],_0x2b9255);_0x1023e9(_0x1a34d5[_0xa10e('0x11')](0x1f4,_0x35e35d[_0xa10e('0x14')]));});});};exports[_0xa10e('0x3f')]=function(_0x2def5e){var _0x207aa7=this;return new Promise(function(_0x52dcb7,_0x295919){return db['CmHopper'][_0xa10e('0x1a')]({'raw':_0x2def5e[_0xa10e('0x1b')]?_0x2def5e[_0xa10e('0x1b')][_0xa10e('0x24')]===undefined?!![]:![]:!![],'where':_0x2def5e[_0xa10e('0x1b')]?_0x2def5e[_0xa10e('0x1b')][_0xa10e('0x1c')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xa10e('0x3b')]['fn']('IF',db['sequelize'][_0xa10e('0x40')]('`scheduledat`\x20>=\x20'+util['format'](_0xa10e('0x41'),moment()[_0xa10e('0x42')](_0xa10e('0x43')))+'\x20,\x201,\x20null'))),_0xa10e('0x44')]]})[_0xa10e('0x22')](function(_0x246733){logger['info'](_0xa10e('0x3f'),_0x2def5e);logger[_0xa10e('0xe')](_0xa10e('0x3f'),_0x2def5e,JSON[_0xa10e('0x10')](_0x246733));_0x52dcb7(_0x246733);})['catch'](function(_0x12add2){logger[_0xa10e('0x11')](_0xa10e('0x3f'),_0x12add2[_0xa10e('0x14')],_0x2def5e);_0x295919(_0x207aa7[_0xa10e('0x11')](0x1f4,_0x12add2['message']));});});};exports[_0xa10e('0x45')]=function(_0x4fd34a){var _0x2fd214=this;return new Promise(function(_0x1f287f,_0x32912a){return db[_0xa10e('0x30')][_0xa10e('0x2d')]()[_0xa10e('0x22')](function(_0x52ed73){return db['sequelize'][_0xa10e('0x3c')](function(_0x3792c9){return db['CmHopper'][_0xa10e('0x1a')]({'where':_0x4fd34a[_0xa10e('0x1b')]?_0x4fd34a['options']['where']||null:null,'attributes':_0x4fd34a[_0xa10e('0x1b')]?_0x4fd34a[_0xa10e('0x1b')][_0xa10e('0x1d')]||null:null,'limit':0x1,'order':_0x4fd34a['options']?_0x4fd34a[_0xa10e('0x1b')][_0xa10e('0x46')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x3792c9,'lock':_0x3792c9[_0xa10e('0x2e')]['UPDATE'],'include':_0x4fd34a[_0xa10e('0x1b')]?_0x4fd34a[_0xa10e('0x1b')]['include']?_[_0xa10e('0x21')](_0x4fd34a['options'][_0xa10e('0x1f')],function(_0x5a3ac3){return{'model':db[_0x5a3ac3[_0xa10e('0x20')]],'as':_0x5a3ac3['as'],'attributes':_0x5a3ac3[_0xa10e('0x1d')],'include':_0x5a3ac3[_0xa10e('0x1f')]?_[_0xa10e('0x21')](_0x5a3ac3['include'],function(_0x4554b0){return{'model':db[_0x4554b0['model']],'as':_0x4554b0['as'],'attributes':_0x4554b0[_0xa10e('0x1d')],'include':_0x4554b0[_0xa10e('0x1f')]?_['map'](_0x4554b0[_0xa10e('0x1f')],function(_0x389960){return{'model':db[_0x389960[_0xa10e('0x20')]],'as':_0x389960['as'],'attributes':_0x389960['attributes']};}):[]};}):[]};}):[]:[]})[_0xa10e('0x22')](function(_0x178890){var _0x2574b4=[];for(var _0x2cbccf=0x0;_0x2cbccf<_0x178890['length'];_0x2cbccf+=0x1){_0x2574b4[_0xa10e('0x39')](_0x178890[_0x2cbccf][_0xa10e('0x29')](_0x4fd34a[_0xa10e('0x27')],{'transaction':_0x3792c9}));}return BPromise[_0xa10e('0x3a')](_0x2574b4);});})['then'](function(_0x3b33a1){logger[_0xa10e('0x15')](_0xa10e('0x45'),_0x4fd34a);logger[_0xa10e('0xe')]('GetContactRecallMe',_0x4fd34a,JSON['stringify'](_0x3b33a1));_0x1f287f(_0x3b33a1);})[_0xa10e('0x17')](function(_0x4a4219){logger[_0xa10e('0x11')](_0xa10e('0x45'),_0x4a4219[_0xa10e('0x14')],_0x4fd34a);_0x32912a(_0x2fd214[_0xa10e('0x11')](0x1f4,_0x4a4219[_0xa10e('0x14')]));});});});};exports[_0xa10e('0x47')]=function(_0x45177c){var _0x231673=this;return new Promise(function(_0x53df96,_0x334f18){db[_0xa10e('0x30')]['describe']()[_0xa10e('0x22')](function(_0x582c4c){return db['CmHopper']['findAll']({'raw':_0x45177c[_0xa10e('0x1b')]?_0x45177c[_0xa10e('0x1b')][_0xa10e('0x24')]===undefined?!![]:![]:!![],'where':_0x45177c[_0xa10e('0x1b')]?_0x45177c['options'][_0xa10e('0x1c')]||null:null,'attributes':_0x45177c['options']?_0x45177c[_0xa10e('0x1b')][_0xa10e('0x1d')]||null:null,'limit':_0x45177c[_0xa10e('0x1b')]?_0x45177c[_0xa10e('0x1b')][_0xa10e('0x1e')]||null:null,'include':_0x45177c[_0xa10e('0x1b')]?_0x45177c[_0xa10e('0x1b')][_0xa10e('0x1f')]?_[_0xa10e('0x21')](_0x45177c[_0xa10e('0x1b')][_0xa10e('0x1f')],function(_0x345d9d){return{'model':db[_0x345d9d[_0xa10e('0x20')]],'as':_0x345d9d['as'],'attributes':_0x345d9d['as']===_0xa10e('0x48')?_[_0xa10e('0x31')](_0x582c4c):_0x345d9d[_0xa10e('0x1d')],'include':_0x345d9d[_0xa10e('0x1f')]?_[_0xa10e('0x21')](_0x345d9d[_0xa10e('0x1f')],function(_0xc8463a){return{'model':db[_0xc8463a[_0xa10e('0x20')]],'as':_0xc8463a['as'],'attributes':_0xc8463a[_0xa10e('0x1d')],'include':_0xc8463a[_0xa10e('0x1f')]?_[_0xa10e('0x21')](_0xc8463a[_0xa10e('0x1f')],function(_0x46016b){return{'model':db[_0x46016b[_0xa10e('0x20')]],'as':_0x46016b['as'],'attributes':_0x46016b[_0xa10e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13ae5c){logger[_0xa10e('0x15')](_0xa10e('0x18'),_0x45177c);logger[_0xa10e('0xe')](_0xa10e('0x18'),_0x45177c,JSON[_0xa10e('0x10')](_0x13ae5c));_0x53df96(_0x13ae5c);})['catch'](function(_0xcbb698){logger[_0xa10e('0x11')](_0xa10e('0x18'),_0xcbb698['message'],_0x45177c);_0x334f18(_0x231673[_0xa10e('0x11')](0x1f4,_0xcbb698[_0xa10e('0x14')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 019127c..813689a 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 _0xd691=['exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','/describe','describe','show','create','post','/preview','getPreview','put','/:id','update'];(function(_0xd5d8da,_0xf598a0){var _0x3d1707=function(_0x4be7b1){while(--_0x4be7b1){_0xd5d8da['push'](_0xd5d8da['shift']());}};_0x3d1707(++_0xf598a0);}(_0xd691,0x169));var _0x1d69=function(_0x1f0213,_0x3c3c9e){_0x1f0213=_0x1f0213-0x0;var _0x2048c4=_0xd691[_0x1f0213];return _0x2048c4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1d69('0x0'));var timeout=require('connect-timeout');var express=require(_0x1d69('0x1'));var router=express[_0x1d69('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1d69('0x3'));var interaction=require(_0x1d69('0x4'));var config=require(_0x1d69('0x5'));var controller=require(_0x1d69('0x6'));router[_0x1d69('0x7')]('/',auth[_0x1d69('0x8')](),controller['index']);router['get'](_0x1d69('0x9'),auth[_0x1d69('0x8')](),controller[_0x1d69('0xa')]);router['get']('/opencontacts',auth[_0x1d69('0x8')](),controller['getOpenContacts']);router[_0x1d69('0x7')]('/:id',auth[_0x1d69('0x8')](),controller[_0x1d69('0xb')]);router['post']('/',auth[_0x1d69('0x8')](),controller[_0x1d69('0xc')]);router[_0x1d69('0xd')](_0x1d69('0xe'),auth['isAuthenticated'](),controller[_0x1d69('0xf')]);router[_0x1d69('0x10')](_0x1d69('0x11'),auth[_0x1d69('0x8')](),controller[_0x1d69('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1d69('0x13')]=router; \ No newline at end of file +var _0xa622=['create','getPreview','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','/describe','describe','get','/opencontacts','getOpenContacts','/:id','show','post'];(function(_0x562d6b,_0x14e2a2){var _0x1f2f28=function(_0xab63f6){while(--_0xab63f6){_0x562d6b['push'](_0x562d6b['shift']());}};_0x1f2f28(++_0x14e2a2);}(_0xa622,0x1cd));var _0x2a62=function(_0x802470,_0x3faaff){_0x802470=_0x802470-0x0;var _0x2b341f=_0xa622[_0x802470];return _0x2b341f;};'use strict';var multer=require(_0x2a62('0x0'));var util=require(_0x2a62('0x1'));var path=require('path');var timeout=require(_0x2a62('0x2'));var express=require(_0x2a62('0x3'));var router=express[_0x2a62('0x4')]();var fs_extra=require(_0x2a62('0x5'));var auth=require(_0x2a62('0x6'));var interaction=require(_0x2a62('0x7'));var config=require(_0x2a62('0x8'));var controller=require(_0x2a62('0x9'));router['get']('/',auth[_0x2a62('0xa')](),controller['index']);router['get'](_0x2a62('0xb'),auth[_0x2a62('0xa')](),controller[_0x2a62('0xc')]);router[_0x2a62('0xd')](_0x2a62('0xe'),auth[_0x2a62('0xa')](),controller[_0x2a62('0xf')]);router[_0x2a62('0xd')](_0x2a62('0x10'),auth[_0x2a62('0xa')](),controller[_0x2a62('0x11')]);router[_0x2a62('0x12')]('/',auth[_0x2a62('0xa')](),controller[_0x2a62('0x13')]);router['post']('/preview',auth[_0x2a62('0xa')](),controller[_0x2a62('0x14')]);router['put'](_0x2a62('0x10'),auth['isAuthenticated'](),controller[_0x2a62('0x15')]);router['delete'](_0x2a62('0x10'),auth[_0x2a62('0xa')](),controller[_0x2a62('0x16')]);module[_0x2a62('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index aacbee0..b50fac1 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 _0x1a54=['INTEGER','contactListQueue','moment','STRING'];(function(_0x4f9fca,_0x266b46){var _0x175ce=function(_0x1e62c1){while(--_0x1e62c1){_0x4f9fca['push'](_0x4f9fca['shift']());}};_0x175ce(++_0x266b46);}(_0x1a54,0x12e));var _0x41a5=function(_0x1770b4,_0x3b75a4){_0x1770b4=_0x1770b4-0x0;var _0x48347e=_0x1a54[_0x1770b4];return _0x48347e;};'use strict';var moment=require(_0x41a5('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x41a5('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x41a5('0x2')],'unique':_0x41a5('0x3')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x41a5('0x3')},'VoiceQueueId':{'type':Sequelize[_0x41a5('0x2')],'unique':_0x41a5('0x3')}}; \ No newline at end of file +var _0x741c=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x4996d5,_0x123daf){var _0x4793f9=function(_0x30c7ec){while(--_0x30c7ec){_0x4996d5['push'](_0x4996d5['shift']());}};_0x4793f9(++_0x123daf);}(_0x741c,0x196));var _0xc741=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x741c[_0x57b54c];return _0x59cc19;};'use strict';var moment=require(_0xc741('0x0'));var Sequelize=require(_0xc741('0x1'));module[_0xc741('0x2')]={'phone':{'type':Sequelize[_0xc741('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xc741('0x4')],'unique':_0xc741('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xc741('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 5085e23..d82b18a 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 _0xa6a4=['find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','end','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','show','params','catch','update','body'];(function(_0x239bc8,_0x48b821){var _0xff4a4b=function(_0x382e09){while(--_0x382e09){_0x239bc8['push'](_0x239bc8['shift']());}};_0xff4a4b(++_0x48b821);}(_0xa6a4,0x9e));var _0x4a6a=function(_0x3e8b25,_0x578d1c){_0x3e8b25=_0x3e8b25-0x0;var _0x1a6570=_0xa6a4[_0x3e8b25];return _0x1a6570;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a6a('0x0'));var zipdir=require(_0x4a6a('0x1'));var jsonpatch=require(_0x4a6a('0x2'));var rp=require(_0x4a6a('0x3'));var moment=require(_0x4a6a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4a6a('0x5'));var path=require(_0x4a6a('0x6'));var sox=require(_0x4a6a('0x7'));var csv=require('to-csv');var ejs=require(_0x4a6a('0x8'));var fs=require('fs');var fs_extra=require(_0x4a6a('0x9'));var _=require(_0x4a6a('0xa'));var squel=require(_0x4a6a('0xb'));var crypto=require(_0x4a6a('0xc'));var jsforce=require(_0x4a6a('0xd'));var deskjs=require(_0x4a6a('0xe'));var toCsv=require(_0x4a6a('0xf'));var querystring=require(_0x4a6a('0x10'));var Papa=require(_0x4a6a('0x11'));var Redis=require(_0x4a6a('0x12'));var authService=require(_0x4a6a('0x13'));var qs=require(_0x4a6a('0x14'));var as=require(_0x4a6a('0x15'));var hardwareService=require(_0x4a6a('0x16'));var logger=require(_0x4a6a('0x17'))(_0x4a6a('0x18'));var utils=require(_0x4a6a('0x19'));var config=require(_0x4a6a('0x1a'));var licenseUtil=require(_0x4a6a('0x1b'));var db=require(_0x4a6a('0x1c'))['db'];function respondWithStatusCode(_0x2c8a97,_0x1b4aae){_0x1b4aae=_0x1b4aae||0xcc;return function(_0x1a353c){if(_0x1a353c){return _0x2c8a97[_0x4a6a('0x1d')](_0x1b4aae);}return _0x2c8a97[_0x4a6a('0x1e')](_0x1b4aae)['end']();};}function respondWithResult(_0x1c27a1,_0x4ec2f9){_0x4ec2f9=_0x4ec2f9||0xc8;return function(_0x62b73b){if(_0x62b73b){return _0x1c27a1['status'](_0x4ec2f9)[_0x4a6a('0x1f')](_0x62b73b);}};}function respondWithFilteredResult(_0x101cad,_0x23bd9d){return function(_0x26967d){if(_0x26967d){var _0x4b3103=typeof _0x23bd9d[_0x4a6a('0x20')]===_0x4a6a('0x21')&&typeof _0x23bd9d[_0x4a6a('0x22')]==='undefined';var _0x161d4d=_0x26967d[_0x4a6a('0x23')];var _0x14624a=_0x4b3103?0x0:_0x23bd9d[_0x4a6a('0x20')];var _0x258b10=_0x4b3103?_0x26967d[_0x4a6a('0x23')]:_0x23bd9d[_0x4a6a('0x20')]+_0x23bd9d[_0x4a6a('0x22')];var _0x292075;if(_0x258b10>=_0x161d4d){_0x258b10=_0x161d4d;_0x292075=0xc8;}else{_0x292075=0xce;}_0x101cad['status'](_0x292075);return _0x101cad[_0x4a6a('0x24')](_0x4a6a('0x25'),_0x14624a+'-'+_0x258b10+'/'+_0x161d4d)[_0x4a6a('0x1f')](_0x26967d);}return null;};}function patchUpdates(_0x7d1d0b){return function(_0x2b7175){try{jsonpatch[_0x4a6a('0x26')](_0x2b7175,_0x7d1d0b,!![]);}catch(_0x4f2497){return BPromise[_0x4a6a('0x27')](_0x4f2497);}return _0x2b7175['save']();};}function saveUpdates(_0x48f31d,_0x40cff4){return function(_0xd0343a){if(_0xd0343a){return _0xd0343a['update'](_0x48f31d)[_0x4a6a('0x28')](function(_0x3b7053){return _0x3b7053;});}return null;};}function removeEntity(_0x1799ec,_0x1f1ae7){return function(_0x2e591a){if(_0x2e591a){return _0x2e591a[_0x4a6a('0x29')]()[_0x4a6a('0x28')](function(){_0x1799ec[_0x4a6a('0x1e')](0xcc)[_0x4a6a('0x2a')]();});}};}function handleEntityNotFound(_0x14f28e,_0xe2a077){return function(_0x586297){if(!_0x586297){_0x14f28e[_0x4a6a('0x1d')](0x194);}return _0x586297;};}function handleError(_0x5b709c,_0x33a570){_0x33a570=_0x33a570||0x1f4;return function(_0x38fbac){logger['error'](_0x38fbac[_0x4a6a('0x2b')]);if(_0x38fbac[_0x4a6a('0x2c')]){delete _0x38fbac['name'];}_0x5b709c[_0x4a6a('0x1e')](_0x33a570)['send'](_0x38fbac);};}exports[_0x4a6a('0x2d')]=function(_0x278122,_0x34ecf9){var _0x5bfd70={},_0x4b358d={},_0x24d6bc={'count':0x0,'rows':[]};var _0x27c2fb=_[_0x4a6a('0x2e')](db[_0x4a6a('0x2f')][_0x4a6a('0x30')],function(_0x5c2980){return{'name':_0x5c2980[_0x4a6a('0x31')],'type':_0x5c2980['type']['key']};});_0x4b358d[_0x4a6a('0x32')]=_[_0x4a6a('0x2e')](_0x27c2fb,_0x4a6a('0x2c'));_0x4b358d[_0x4a6a('0x33')]=_[_0x4a6a('0x34')](_0x278122['query']);_0x4b358d[_0x4a6a('0x35')]=_[_0x4a6a('0x36')](_0x4b358d[_0x4a6a('0x32')],_0x4b358d['query']);_0x5bfd70[_0x4a6a('0x37')]=_[_0x4a6a('0x36')](_0x4b358d[_0x4a6a('0x32')],qs[_0x4a6a('0x38')](_0x278122['query'][_0x4a6a('0x38')]));_0x5bfd70[_0x4a6a('0x37')]=_0x5bfd70[_0x4a6a('0x37')][_0x4a6a('0x39')]?_0x5bfd70[_0x4a6a('0x37')]:_0x4b358d['model'];if(!_0x278122[_0x4a6a('0x33')][_0x4a6a('0x3a')](_0x4a6a('0x3b'))){_0x5bfd70[_0x4a6a('0x22')]=qs[_0x4a6a('0x22')](_0x278122['query']['limit']);_0x5bfd70[_0x4a6a('0x20')]=qs['offset'](_0x278122[_0x4a6a('0x33')]['offset']);}_0x5bfd70['order']=qs[_0x4a6a('0x3c')](_0x278122['query'][_0x4a6a('0x3c')]);_0x5bfd70[_0x4a6a('0x3d')]=qs[_0x4a6a('0x35')](_[_0x4a6a('0x3e')](_0x278122[_0x4a6a('0x33')],_0x4b358d[_0x4a6a('0x35')]),_0x27c2fb);if(_0x278122[_0x4a6a('0x33')]['filter']){_0x5bfd70['where']=_[_0x4a6a('0x3f')](_0x5bfd70[_0x4a6a('0x3d')],{'$or':_['map'](_0x27c2fb,function(_0x2f6207){if(_0x2f6207[_0x4a6a('0x40')]!=='VIRTUAL'){var _0x44fba7={};_0x44fba7[_0x2f6207['name']]={'$like':'%'+_0x278122['query'][_0x4a6a('0x41')]+'%'};return _0x44fba7;}})});}_0x5bfd70=_[_0x4a6a('0x3f')]({},_0x5bfd70,_0x278122[_0x4a6a('0x42')]);var _0x410ae4={'where':_0x5bfd70['where']};return db[_0x4a6a('0x2f')][_0x4a6a('0x23')](_0x410ae4)[_0x4a6a('0x28')](function(_0x54bcc0){_0x24d6bc[_0x4a6a('0x23')]=_0x54bcc0;if(_0x278122[_0x4a6a('0x33')][_0x4a6a('0x43')]){_0x5bfd70[_0x4a6a('0x44')]=[{'all':!![]}];}return db[_0x4a6a('0x2f')][_0x4a6a('0x45')](_0x5bfd70);})[_0x4a6a('0x28')](function(_0x487b8d){_0x24d6bc[_0x4a6a('0x46')]=_0x487b8d;return _0x24d6bc;})[_0x4a6a('0x28')](respondWithFilteredResult(_0x34ecf9,_0x5bfd70))['catch'](handleError(_0x34ecf9,null));};exports[_0x4a6a('0x47')]=function(_0x55cbcf,_0xf9e281){var _0x46673c={'raw':!![],'where':{'id':_0x55cbcf[_0x4a6a('0x48')]['id']}},_0x5ce76b={};_0x5ce76b[_0x4a6a('0x32')]=_[_0x4a6a('0x34')](db['CmHopperBlack']['rawAttributes']);_0x5ce76b[_0x4a6a('0x33')]=_[_0x4a6a('0x34')](_0x55cbcf[_0x4a6a('0x33')]);_0x5ce76b[_0x4a6a('0x35')]=_[_0x4a6a('0x36')](_0x5ce76b[_0x4a6a('0x32')],_0x5ce76b[_0x4a6a('0x33')]);_0x46673c[_0x4a6a('0x37')]=_[_0x4a6a('0x36')](_0x5ce76b['model'],qs['fields'](_0x55cbcf[_0x4a6a('0x33')]['fields']));_0x46673c['attributes']=_0x46673c[_0x4a6a('0x37')][_0x4a6a('0x39')]?_0x46673c[_0x4a6a('0x37')]:_0x5ce76b['model'];if(_0x55cbcf[_0x4a6a('0x33')][_0x4a6a('0x43')]){_0x46673c[_0x4a6a('0x44')]=[{'all':!![]}];}_0x46673c=_[_0x4a6a('0x3f')]({},_0x46673c,_0x55cbcf[_0x4a6a('0x42')]);return db['CmHopperBlack']['find'](_0x46673c)[_0x4a6a('0x28')](handleEntityNotFound(_0xf9e281,null))[_0x4a6a('0x28')](respondWithResult(_0xf9e281,null))[_0x4a6a('0x49')](handleError(_0xf9e281,null));};exports[_0x4a6a('0x4a')]=function(_0xe570d4,_0x480646){if(_0xe570d4[_0x4a6a('0x4b')]['id']){delete _0xe570d4[_0x4a6a('0x4b')]['id'];}return db[_0x4a6a('0x2f')][_0x4a6a('0x4c')]({'where':{'id':_0xe570d4[_0x4a6a('0x48')]['id']}})[_0x4a6a('0x28')](handleEntityNotFound(_0x480646,null))['then'](saveUpdates(_0xe570d4[_0x4a6a('0x4b')],null))['then'](respondWithResult(_0x480646,null))[_0x4a6a('0x49')](handleError(_0x480646,null));};exports[_0x4a6a('0x29')]=function(_0x458de7,_0x336054){return db[_0x4a6a('0x2f')][_0x4a6a('0x4c')]({'where':{'id':_0x458de7[_0x4a6a('0x48')]['id']}})[_0x4a6a('0x28')](handleEntityNotFound(_0x336054,null))[_0x4a6a('0x28')](removeEntity(_0x336054,null))[_0x4a6a('0x49')](handleError(_0x336054,null));};exports[_0x4a6a('0x4d')]=function(_0x5012da,_0x5ee30a){return db[_0x4a6a('0x2f')]['describe']()[_0x4a6a('0x28')](respondWithResult(_0x5ee30a,null))[_0x4a6a('0x49')](handleError(_0x5ee30a,null));}; \ No newline at end of file +var _0xf094=['moment','bluebird','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','CmHopperBlack','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','body','describe','eml-format','zip-dir','fast-json-patch'];(function(_0x347a26,_0x285e33){var _0x11a2a7=function(_0xa522e4){while(--_0xa522e4){_0x347a26['push'](_0x347a26['shift']());}};_0x11a2a7(++_0x285e33);}(_0xf094,0x1ee));var _0x4f09=function(_0x28d7b5,_0x1305a4){_0x28d7b5=_0x28d7b5-0x0;var _0x1ed035=_0xf094[_0x28d7b5];return _0x1ed035;};'use strict';var emlformat=require(_0x4f09('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4f09('0x1'));var jsonpatch=require(_0x4f09('0x2'));var rp=require('request-promise');var moment=require(_0x4f09('0x3'));var BPromise=require(_0x4f09('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4f09('0x5'));var csv=require(_0x4f09('0x6'));var ejs=require(_0x4f09('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4f09('0x8'));var crypto=require(_0x4f09('0x9'));var jsforce=require(_0x4f09('0xa'));var deskjs=require(_0x4f09('0xb'));var toCsv=require(_0x4f09('0x6'));var querystring=require(_0x4f09('0xc'));var Papa=require(_0x4f09('0xd'));var Redis=require(_0x4f09('0xe'));var authService=require(_0x4f09('0xf'));var qs=require(_0x4f09('0x10'));var as=require(_0x4f09('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f09('0x12'))(_0x4f09('0x13'));var utils=require(_0x4f09('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f09('0x15'))['db'];function respondWithStatusCode(_0x348384,_0x220a06){_0x220a06=_0x220a06||0xcc;return function(_0x525322){if(_0x525322){return _0x348384[_0x4f09('0x16')](_0x220a06);}return _0x348384['status'](_0x220a06)[_0x4f09('0x17')]();};}function respondWithResult(_0x404d2f,_0x5e2d28){_0x5e2d28=_0x5e2d28||0xc8;return function(_0x2d7abd){if(_0x2d7abd){return _0x404d2f['status'](_0x5e2d28)[_0x4f09('0x18')](_0x2d7abd);}};}function respondWithFilteredResult(_0x59a4fa,_0x1ce16b){return function(_0x216eb5){if(_0x216eb5){var _0x131b91=typeof _0x1ce16b[_0x4f09('0x19')]===_0x4f09('0x1a')&&typeof _0x1ce16b[_0x4f09('0x1b')]===_0x4f09('0x1a');var _0x4b891c=_0x216eb5[_0x4f09('0x1c')];var _0x295609=_0x131b91?0x0:_0x1ce16b['offset'];var _0x27a999=_0x131b91?_0x216eb5[_0x4f09('0x1c')]:_0x1ce16b[_0x4f09('0x19')]+_0x1ce16b[_0x4f09('0x1b')];var _0x185437;if(_0x27a999>=_0x4b891c){_0x27a999=_0x4b891c;_0x185437=0xc8;}else{_0x185437=0xce;}_0x59a4fa[_0x4f09('0x1d')](_0x185437);return _0x59a4fa[_0x4f09('0x1e')](_0x4f09('0x1f'),_0x295609+'-'+_0x27a999+'/'+_0x4b891c)['json'](_0x216eb5);}return null;};}function patchUpdates(_0x1c9e77){return function(_0xeebc3b){try{jsonpatch[_0x4f09('0x20')](_0xeebc3b,_0x1c9e77,!![]);}catch(_0x60586e){return BPromise[_0x4f09('0x21')](_0x60586e);}return _0xeebc3b[_0x4f09('0x22')]();};}function saveUpdates(_0x4846b5,_0x54970d){return function(_0xf30ee3){if(_0xf30ee3){return _0xf30ee3[_0x4f09('0x23')](_0x4846b5)[_0x4f09('0x24')](function(_0x3b483f){return _0x3b483f;});}return null;};}function removeEntity(_0x5091ee,_0x49824d){return function(_0x4967c6){if(_0x4967c6){return _0x4967c6[_0x4f09('0x25')]()['then'](function(){_0x5091ee[_0x4f09('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11026e,_0x2c8d05){return function(_0x47d9a2){if(!_0x47d9a2){_0x11026e[_0x4f09('0x16')](0x194);}return _0x47d9a2;};}function handleError(_0x6bb1cf,_0x1bcab6){_0x1bcab6=_0x1bcab6||0x1f4;return function(_0x15329e){logger[_0x4f09('0x26')](_0x15329e[_0x4f09('0x27')]);if(_0x15329e[_0x4f09('0x28')]){delete _0x15329e['name'];}_0x6bb1cf['status'](_0x1bcab6)[_0x4f09('0x29')](_0x15329e);};}exports['index']=function(_0x51d748,_0x42ece4){var _0xb193d3={},_0x557c11={},_0x48e424={'count':0x0,'rows':[]};var _0x331469=_[_0x4f09('0x2a')](db[_0x4f09('0x2b')]['rawAttributes'],function(_0x39adf9){return{'name':_0x39adf9[_0x4f09('0x2c')],'type':_0x39adf9[_0x4f09('0x2d')][_0x4f09('0x2e')]};});_0x557c11[_0x4f09('0x2f')]=_['map'](_0x331469,_0x4f09('0x28'));_0x557c11[_0x4f09('0x30')]=_[_0x4f09('0x31')](_0x51d748[_0x4f09('0x30')]);_0x557c11[_0x4f09('0x32')]=_['intersection'](_0x557c11['model'],_0x557c11[_0x4f09('0x30')]);_0xb193d3['attributes']=_[_0x4f09('0x33')](_0x557c11[_0x4f09('0x2f')],qs['fields'](_0x51d748[_0x4f09('0x30')][_0x4f09('0x34')]));_0xb193d3[_0x4f09('0x35')]=_0xb193d3[_0x4f09('0x35')]['length']?_0xb193d3['attributes']:_0x557c11[_0x4f09('0x2f')];if(!_0x51d748[_0x4f09('0x30')][_0x4f09('0x36')]('nolimit')){_0xb193d3[_0x4f09('0x1b')]=qs[_0x4f09('0x1b')](_0x51d748[_0x4f09('0x30')]['limit']);_0xb193d3[_0x4f09('0x19')]=qs[_0x4f09('0x19')](_0x51d748[_0x4f09('0x30')][_0x4f09('0x19')]);}_0xb193d3[_0x4f09('0x37')]=qs['sort'](_0x51d748[_0x4f09('0x30')]['sort']);_0xb193d3[_0x4f09('0x38')]=qs['filters'](_['pick'](_0x51d748['query'],_0x557c11[_0x4f09('0x32')]),_0x331469);if(_0x51d748[_0x4f09('0x30')][_0x4f09('0x39')]){_0xb193d3[_0x4f09('0x38')]=_['merge'](_0xb193d3[_0x4f09('0x38')],{'$or':_[_0x4f09('0x2a')](_0x331469,function(_0x14452b){if(_0x14452b[_0x4f09('0x2d')]!==_0x4f09('0x3a')){var _0x4e71b7={};_0x4e71b7[_0x14452b[_0x4f09('0x28')]]={'$like':'%'+_0x51d748['query'][_0x4f09('0x39')]+'%'};return _0x4e71b7;}})});}_0xb193d3=_[_0x4f09('0x3b')]({},_0xb193d3,_0x51d748[_0x4f09('0x3c')]);var _0x280dfc={'where':_0xb193d3[_0x4f09('0x38')]};return db[_0x4f09('0x2b')][_0x4f09('0x1c')](_0x280dfc)['then'](function(_0x23499a){_0x48e424[_0x4f09('0x1c')]=_0x23499a;if(_0x51d748['query'][_0x4f09('0x3d')]){_0xb193d3['include']=[{'all':!![]}];}return db[_0x4f09('0x2b')][_0x4f09('0x3e')](_0xb193d3);})['then'](function(_0x31e552){_0x48e424[_0x4f09('0x3f')]=_0x31e552;return _0x48e424;})[_0x4f09('0x24')](respondWithFilteredResult(_0x42ece4,_0xb193d3))[_0x4f09('0x40')](handleError(_0x42ece4,null));};exports[_0x4f09('0x41')]=function(_0x4c0cb5,_0xf07d17){var _0x2a7c85={'raw':!![],'where':{'id':_0x4c0cb5[_0x4f09('0x42')]['id']}},_0x4477dc={};_0x4477dc[_0x4f09('0x2f')]=_['keys'](db['CmHopperBlack']['rawAttributes']);_0x4477dc[_0x4f09('0x30')]=_[_0x4f09('0x31')](_0x4c0cb5[_0x4f09('0x30')]);_0x4477dc['filters']=_[_0x4f09('0x33')](_0x4477dc[_0x4f09('0x2f')],_0x4477dc[_0x4f09('0x30')]);_0x2a7c85[_0x4f09('0x35')]=_[_0x4f09('0x33')](_0x4477dc[_0x4f09('0x2f')],qs[_0x4f09('0x34')](_0x4c0cb5['query'][_0x4f09('0x34')]));_0x2a7c85[_0x4f09('0x35')]=_0x2a7c85[_0x4f09('0x35')]['length']?_0x2a7c85['attributes']:_0x4477dc['model'];if(_0x4c0cb5[_0x4f09('0x30')][_0x4f09('0x3d')]){_0x2a7c85[_0x4f09('0x43')]=[{'all':!![]}];}_0x2a7c85=_[_0x4f09('0x3b')]({},_0x2a7c85,_0x4c0cb5[_0x4f09('0x3c')]);return db[_0x4f09('0x2b')][_0x4f09('0x44')](_0x2a7c85)[_0x4f09('0x24')](handleEntityNotFound(_0xf07d17,null))[_0x4f09('0x24')](respondWithResult(_0xf07d17,null))[_0x4f09('0x40')](handleError(_0xf07d17,null));};exports['update']=function(_0x25695e,_0x22da8a){if(_0x25695e[_0x4f09('0x45')]['id']){delete _0x25695e['body']['id'];}return db[_0x4f09('0x2b')][_0x4f09('0x44')]({'where':{'id':_0x25695e['params']['id']}})[_0x4f09('0x24')](handleEntityNotFound(_0x22da8a,null))[_0x4f09('0x24')](saveUpdates(_0x25695e['body'],null))['then'](respondWithResult(_0x22da8a,null))['catch'](handleError(_0x22da8a,null));};exports[_0x4f09('0x25')]=function(_0x2f36c4,_0x485f31){return db[_0x4f09('0x2b')][_0x4f09('0x44')]({'where':{'id':_0x2f36c4[_0x4f09('0x42')]['id']}})[_0x4f09('0x24')](handleEntityNotFound(_0x485f31,null))[_0x4f09('0x24')](removeEntity(_0x485f31,null))[_0x4f09('0x40')](handleError(_0x485f31,null));};exports[_0x4f09('0x46')]=function(_0x42e43a,_0x563c84){return db[_0x4f09('0x2b')][_0x4f09('0x46')]()[_0x4f09('0x24')](respondWithResult(_0x563c84,null))[_0x4f09('0x40')](handleError(_0x563c84,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index bb70518..f75e5aa 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 _0x558c=['cm_hopper_black','lodash','util','bluebird','request-promise','rimraf','../../config/environment','exports','CmHopperBlack'];(function(_0x2d9aec,_0x262442){var _0x4a8574=function(_0x55237d){while(--_0x55237d){_0x2d9aec['push'](_0x2d9aec['shift']());}};_0x4a8574(++_0x262442);}(_0x558c,0xfd));var _0xc558=function(_0x5e5a8e,_0x2a832f){_0x5e5a8e=_0x5e5a8e-0x0;var _0x2c3c1b=_0x558c[_0x5e5a8e];return _0x2c3c1b;};'use strict';var _=require(_0xc558('0x0'));var util=require(_0xc558('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc558('0x2'));var rp=require(_0xc558('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc558('0x4'));var config=require(_0xc558('0x5'));var attributes=require('./cmHopperBlack.attributes');module[_0xc558('0x6')]=function(_0x290bd9,_0x251420){return _0x290bd9['define'](_0xc558('0x7'),attributes,{'tableName':_0xc558('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3e4=['api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xc3e4,0x99));var _0x4c3e=function(_0x5a3367,_0x1636a3){_0x5a3367=_0x5a3367-0x0;var _0x495d74=_0xc3e4[_0x5a3367];return _0x495d74;};'use strict';var _=require(_0x4c3e('0x0'));var util=require(_0x4c3e('0x1'));var logger=require(_0x4c3e('0x2'))(_0x4c3e('0x3'));var moment=require(_0x4c3e('0x4'));var BPromise=require(_0x4c3e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c3e('0x6'));var rimraf=require(_0x4c3e('0x7'));var config=require(_0x4c3e('0x8'));var attributes=require(_0x4c3e('0x9'));module[_0x4c3e('0xa')]=function(_0x3d2ad7,_0x2c5f87){return _0x3d2ad7[_0x4c3e('0xb')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index a27b540..834e0f7 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 _0x8668=['result','catch','GetCmHopperBlack','findAll','raw','options','where','attributes','limit','include','model','map','UpdateCmHopperBlack','CmHopperBlack','update','body','DestroyCmHopperBlack','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../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(_0x495bf3,_0x1beb0f){var _0x5b99c5=function(_0x4d4721){while(--_0x4d4721){_0x495bf3['push'](_0x495bf3['shift']());}};_0x5b99c5(++_0x1beb0f);}(_0x8668,0x1b3));var _0x8866=function(_0xf2928,_0x3046af){_0xf2928=_0xf2928-0x0;var _0xc0c34b=_0x8668[_0xf2928];return _0xc0c34b;};'use strict';var _=require('lodash');var util=require(_0x8866('0x0'));var moment=require(_0x8866('0x1'));var BPromise=require(_0x8866('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8866('0x3'));var db=require(_0x8866('0x4'))['db'];var utils=require(_0x8866('0x5'));var logger=require(_0x8866('0x6'))('rpc');var config=require(_0x8866('0x7'));var jayson=require(_0x8866('0x8'));var client=jayson[_0x8866('0x9')][_0x8866('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34c4ba,_0x265ba0,_0x351e7d){return new BPromise(function(_0x5b5178,_0x4dcfd9){return client['request'](_0x34c4ba,_0x351e7d)[_0x8866('0xb')](function(_0x3f3252){logger[_0x8866('0xc')](_0x8866('0xd'),_0x265ba0,_0x8866('0xe'));logger[_0x8866('0xf')](_0x8866('0x10'),_0x265ba0,_0x8866('0xe'),JSON[_0x8866('0x11')](_0x3f3252));if(_0x3f3252['error']){if(_0x3f3252[_0x8866('0x12')][_0x8866('0x13')]===0x1f4){logger[_0x8866('0x12')](_0x8866('0xd'),_0x265ba0,_0x3f3252[_0x8866('0x12')][_0x8866('0x14')]);return _0x4dcfd9(_0x3f3252[_0x8866('0x12')][_0x8866('0x14')]);}logger[_0x8866('0x12')](_0x8866('0xd'),_0x265ba0,_0x3f3252[_0x8866('0x12')][_0x8866('0x14')]);return _0x5b5178(_0x3f3252[_0x8866('0x12')]['message']);}else{logger['info'](_0x8866('0xd'),_0x265ba0,_0x8866('0xe'));_0x5b5178(_0x3f3252[_0x8866('0x15')][_0x8866('0x14')]);}})[_0x8866('0x16')](function(_0x46b171){logger['error'](_0x8866('0xd'),_0x265ba0,_0x46b171);_0x4dcfd9(_0x46b171);});});}exports[_0x8866('0x17')]=function(_0x55d12d){var _0x17e53a=this;return new Promise(function(_0x238b29,_0x922980){return db['CmHopperBlack'][_0x8866('0x18')]({'raw':_0x55d12d['options']?_0x55d12d['options'][_0x8866('0x19')]===undefined?!![]:![]:!![],'where':_0x55d12d[_0x8866('0x1a')]?_0x55d12d[_0x8866('0x1a')][_0x8866('0x1b')]||null:null,'attributes':_0x55d12d[_0x8866('0x1a')]?_0x55d12d[_0x8866('0x1a')][_0x8866('0x1c')]||null:null,'limit':_0x55d12d[_0x8866('0x1a')]?_0x55d12d[_0x8866('0x1a')][_0x8866('0x1d')]||null:null,'include':_0x55d12d[_0x8866('0x1a')]?_0x55d12d[_0x8866('0x1a')][_0x8866('0x1e')]?_['map'](_0x55d12d[_0x8866('0x1a')]['include'],function(_0x29665b){return{'model':db[_0x29665b['model']],'as':_0x29665b['as'],'attributes':_0x29665b[_0x8866('0x1c')],'include':_0x29665b['include']?_['map'](_0x29665b[_0x8866('0x1e')],function(_0x2eb479){return{'model':db[_0x2eb479[_0x8866('0x1f')]],'as':_0x2eb479['as'],'attributes':_0x2eb479[_0x8866('0x1c')],'include':_0x2eb479[_0x8866('0x1e')]?_[_0x8866('0x20')](_0x2eb479[_0x8866('0x1e')],function(_0x428459){return{'model':db[_0x428459[_0x8866('0x1f')]],'as':_0x428459['as'],'attributes':_0x428459[_0x8866('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8866('0xb')](function(_0x4d3469){logger[_0x8866('0xc')](_0x8866('0x17'),_0x55d12d);logger[_0x8866('0xf')](_0x8866('0x17'),_0x55d12d,JSON[_0x8866('0x11')](_0x4d3469));_0x238b29(_0x4d3469);})[_0x8866('0x16')](function(_0x57c21d){logger['error'](_0x8866('0x17'),_0x57c21d[_0x8866('0x14')],_0x55d12d);_0x922980(_0x17e53a[_0x8866('0x12')](0x1f4,_0x57c21d[_0x8866('0x14')]));});});};exports[_0x8866('0x21')]=function(_0x3a9c22){var _0x18f626=this;return new Promise(function(_0x37263a,_0x5b6fe5){return db[_0x8866('0x22')][_0x8866('0x23')](_0x3a9c22[_0x8866('0x24')],{'raw':_0x3a9c22[_0x8866('0x1a')]?_0x3a9c22[_0x8866('0x1a')][_0x8866('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a9c22[_0x8866('0x1a')]?_0x3a9c22[_0x8866('0x1a')][_0x8866('0x1b')]||null:null,'attributes':_0x3a9c22[_0x8866('0x1a')]?_0x3a9c22[_0x8866('0x1a')]['attributes']||null:null,'limit':_0x3a9c22['options']?_0x3a9c22[_0x8866('0x1a')][_0x8866('0x1d')]||null:null})[_0x8866('0xb')](function(_0xb6b530){logger[_0x8866('0xc')](_0x8866('0x21'),_0x3a9c22);logger[_0x8866('0xf')](_0x8866('0x21'),_0x3a9c22,JSON[_0x8866('0x11')](_0xb6b530));_0x37263a(_0xb6b530);})['catch'](function(_0x5c0428){logger[_0x8866('0x12')](_0x8866('0x21'),_0x5c0428[_0x8866('0x14')],_0x3a9c22);_0x5b6fe5(_0x18f626['error'](0x1f4,_0x5c0428[_0x8866('0x14')]));});});};exports[_0x8866('0x25')]=function(_0x1816ce){var _0x2d3618=this;return new Promise(function(_0x2ac1c0,_0xc5d689){return db[_0x8866('0x22')]['destroy']({'where':_0x1816ce[_0x8866('0x1a')]?_0x1816ce['options']['where']||null:null})[_0x8866('0xb')](function(_0x11b897){logger[_0x8866('0xc')]('DestroyCmHopperBlack',_0x1816ce);logger[_0x8866('0xf')](_0x8866('0x25'),_0x1816ce,JSON[_0x8866('0x11')](_0x11b897));_0x2ac1c0(_0x11b897);})[_0x8866('0x16')](function(_0x101dba){logger[_0x8866('0x12')](_0x8866('0x25'),_0x101dba[_0x8866('0x14')],_0x1816ce);_0xc5d689(_0x2d3618['error'](0x1f4,_0x101dba['message']));});});}; \ No newline at end of file +var _0xb3db=['findAll','options','raw','where','attributes','limit','include','map','model','CmHopperBlack','update','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCmHopperBlack'];(function(_0x2413f4,_0x2ca232){var _0x3213cc=function(_0x12178a){while(--_0x12178a){_0x2413f4['push'](_0x2413f4['shift']());}};_0x3213cc(++_0x2ca232);}(_0xb3db,0x1ef));var _0xbb3d=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0xb3db[_0x14a862];return _0x245eb5;};'use strict';var _=require('lodash');var util=require(_0xbb3d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbb3d('0x1'));var fs=require('fs');var Redis=require(_0xbb3d('0x2'));var db=require(_0xbb3d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb3d('0x4'))(_0xbb3d('0x5'));var config=require(_0xbb3d('0x6'));var jayson=require(_0xbb3d('0x7'));var client=jayson[_0xbb3d('0x8')][_0xbb3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54980e,_0xf12a53,_0x4e9552){return new BPromise(function(_0x487eb9,_0x16423b){return client[_0xbb3d('0xa')](_0x54980e,_0x4e9552)[_0xbb3d('0xb')](function(_0x320913){logger[_0xbb3d('0xc')](_0xbb3d('0xd'),_0xf12a53,_0xbb3d('0xe'));logger[_0xbb3d('0xf')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0xf12a53,_0xbb3d('0xe'),JSON[_0xbb3d('0x10')](_0x320913));if(_0x320913[_0xbb3d('0x11')]){if(_0x320913[_0xbb3d('0x11')][_0xbb3d('0x12')]===0x1f4){logger[_0xbb3d('0x11')](_0xbb3d('0xd'),_0xf12a53,_0x320913[_0xbb3d('0x11')]['message']);return _0x16423b(_0x320913[_0xbb3d('0x11')]['message']);}logger[_0xbb3d('0x11')](_0xbb3d('0xd'),_0xf12a53,_0x320913[_0xbb3d('0x11')][_0xbb3d('0x13')]);return _0x487eb9(_0x320913['error'][_0xbb3d('0x13')]);}else{logger['info'](_0xbb3d('0xd'),_0xf12a53,_0xbb3d('0xe'));_0x487eb9(_0x320913[_0xbb3d('0x14')][_0xbb3d('0x13')]);}})[_0xbb3d('0x15')](function(_0xf1cd7d){logger[_0xbb3d('0x11')](_0xbb3d('0xd'),_0xf12a53,_0xf1cd7d);_0x16423b(_0xf1cd7d);});});}exports[_0xbb3d('0x16')]=function(_0x10c347){var _0x246607=this;return new Promise(function(_0x5f121c,_0x10dc21){return db['CmHopperBlack'][_0xbb3d('0x17')]({'raw':_0x10c347[_0xbb3d('0x18')]?_0x10c347['options'][_0xbb3d('0x19')]===undefined?!![]:![]:!![],'where':_0x10c347['options']?_0x10c347[_0xbb3d('0x18')][_0xbb3d('0x1a')]||null:null,'attributes':_0x10c347[_0xbb3d('0x18')]?_0x10c347['options'][_0xbb3d('0x1b')]||null:null,'limit':_0x10c347[_0xbb3d('0x18')]?_0x10c347[_0xbb3d('0x18')][_0xbb3d('0x1c')]||null:null,'include':_0x10c347[_0xbb3d('0x18')]?_0x10c347[_0xbb3d('0x18')][_0xbb3d('0x1d')]?_[_0xbb3d('0x1e')](_0x10c347['options']['include'],function(_0x1ee22e){return{'model':db[_0x1ee22e['model']],'as':_0x1ee22e['as'],'attributes':_0x1ee22e[_0xbb3d('0x1b')],'include':_0x1ee22e[_0xbb3d('0x1d')]?_['map'](_0x1ee22e[_0xbb3d('0x1d')],function(_0x201738){return{'model':db[_0x201738[_0xbb3d('0x1f')]],'as':_0x201738['as'],'attributes':_0x201738[_0xbb3d('0x1b')],'include':_0x201738['include']?_[_0xbb3d('0x1e')](_0x201738['include'],function(_0x292c55){return{'model':db[_0x292c55['model']],'as':_0x292c55['as'],'attributes':_0x292c55[_0xbb3d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d7f92){logger[_0xbb3d('0xc')](_0xbb3d('0x16'),_0x10c347);logger[_0xbb3d('0xf')]('GetCmHopperBlack',_0x10c347,JSON[_0xbb3d('0x10')](_0x5d7f92));_0x5f121c(_0x5d7f92);})[_0xbb3d('0x15')](function(_0x271b22){logger['error']('GetCmHopperBlack',_0x271b22['message'],_0x10c347);_0x10dc21(_0x246607[_0xbb3d('0x11')](0x1f4,_0x271b22[_0xbb3d('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x3dfa5e){var _0x2788cb=this;return new Promise(function(_0x1cfc56,_0x37327f){return db[_0xbb3d('0x20')][_0xbb3d('0x21')](_0x3dfa5e['body'],{'raw':_0x3dfa5e[_0xbb3d('0x18')]?_0x3dfa5e[_0xbb3d('0x18')][_0xbb3d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dfa5e[_0xbb3d('0x18')]?_0x3dfa5e['options'][_0xbb3d('0x1a')]||null:null,'attributes':_0x3dfa5e[_0xbb3d('0x18')]?_0x3dfa5e[_0xbb3d('0x18')][_0xbb3d('0x1b')]||null:null,'limit':_0x3dfa5e[_0xbb3d('0x18')]?_0x3dfa5e['options'][_0xbb3d('0x1c')]||null:null})[_0xbb3d('0xb')](function(_0x3db029){logger[_0xbb3d('0xc')]('UpdateCmHopperBlack',_0x3dfa5e);logger[_0xbb3d('0xf')]('UpdateCmHopperBlack',_0x3dfa5e,JSON[_0xbb3d('0x10')](_0x3db029));_0x1cfc56(_0x3db029);})[_0xbb3d('0x15')](function(_0x582288){logger['error'](_0xbb3d('0x22'),_0x582288['message'],_0x3dfa5e);_0x37327f(_0x2788cb['error'](0x1f4,_0x582288[_0xbb3d('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x32557f){var _0x223578=this;return new Promise(function(_0x46c838,_0x3afc6a){return db[_0xbb3d('0x20')][_0xbb3d('0x23')]({'where':_0x32557f[_0xbb3d('0x18')]?_0x32557f[_0xbb3d('0x18')][_0xbb3d('0x1a')]||null:null})[_0xbb3d('0xb')](function(_0xcd9592){logger[_0xbb3d('0xc')](_0xbb3d('0x24'),_0x32557f);logger[_0xbb3d('0xf')](_0xbb3d('0x24'),_0x32557f,JSON[_0xbb3d('0x10')](_0xcd9592));_0x46c838(_0xcd9592);})[_0xbb3d('0x15')](function(_0x158724){logger['error'](_0xbb3d('0x24'),_0x158724['message'],_0x32557f);_0x3afc6a(_0x223578[_0xbb3d('0x11')](0x1f4,_0x158724[_0xbb3d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 05c86db..4690d20 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 _0xb145=['update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put'];(function(_0x267444,_0x1767e7){var _0x220aab=function(_0x493296){while(--_0x493296){_0x267444['push'](_0x267444['shift']());}};_0x220aab(++_0x1767e7);}(_0xb145,0xa3));var _0x5b14=function(_0x273575,_0x4f7144){_0x273575=_0x273575-0x0;var _0x342960=_0xb145[_0x273575];return _0x342960;};'use strict';var multer=require('multer');var util=require(_0x5b14('0x0'));var path=require(_0x5b14('0x1'));var timeout=require(_0x5b14('0x2'));var express=require(_0x5b14('0x3'));var router=express[_0x5b14('0x4')]();var fs_extra=require(_0x5b14('0x5'));var auth=require(_0x5b14('0x6'));var interaction=require(_0x5b14('0x7'));var config=require('../../config/environment');var controller=require(_0x5b14('0x8'));router[_0x5b14('0x9')]('/',auth[_0x5b14('0xa')](),controller[_0x5b14('0xb')]);router['get'](_0x5b14('0xc'),auth[_0x5b14('0xa')](),controller[_0x5b14('0xd')]);router[_0x5b14('0x9')](_0x5b14('0xe'),auth['isAuthenticated'](),controller[_0x5b14('0xf')]);router[_0x5b14('0x10')]('/:id',auth[_0x5b14('0xa')](),controller[_0x5b14('0x11')]);router[_0x5b14('0x12')](_0x5b14('0xe'),auth[_0x5b14('0xa')](),controller['destroy']);module[_0x5b14('0x13')]=router; \ No newline at end of file +var _0x90b1=['index','get','/describe','isAuthenticated','describe','/:id','show','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2f4abf,_0x35a6c7){var _0x42644b=function(_0x30c7e9){while(--_0x30c7e9){_0x2f4abf['push'](_0x2f4abf['shift']());}};_0x42644b(++_0x35a6c7);}(_0x90b1,0x1bb));var _0x190b=function(_0x1666f3,_0x2f7109){_0x1666f3=_0x1666f3-0x0;var _0x4a5749=_0x90b1[_0x1666f3];return _0x4a5749;};'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 fs_extra=require(_0x190b('0x4'));var auth=require(_0x190b('0x5'));var interaction=require(_0x190b('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x190b('0x7')]);router[_0x190b('0x8')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0xb')]);router[_0x190b('0x8')](_0x190b('0xc'),auth['isAuthenticated'](),controller[_0x190b('0xd')]);router[_0x190b('0xe')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller[_0x190b('0xf')]);router[_0x190b('0x10')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller['destroy']);module[_0x190b('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 67fbb7c..7138384 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 _0x68b8=['BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','dispositionat'];(function(_0x2fe341,_0x7aa0db){var _0xcfe232=function(_0x1462f6){while(--_0x1462f6){_0x2fe341['push'](_0x2fe341['shift']());}};_0xcfe232(++_0x7aa0db);}(_0x68b8,0x199));var _0x868b=function(_0xf43cb,_0x465374){_0xf43cb=_0xf43cb-0x0;var _0x14e869=_0x68b8[_0xf43cb];return _0x14e869;};'use strict';var Sequelize=require(_0x868b('0x0'));var moment=require(_0x868b('0x1'));module['exports']={'state':{'type':Sequelize[_0x868b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x868b('0x3')]},'scheduledat':{'type':Sequelize[_0x868b('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x868b('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x868b('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x868b('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x868b('0x3')]},'originatecalleridname':{'type':Sequelize[_0x868b('0x3')]},'calleridnum':{'type':Sequelize[_0x868b('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x868b('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x868b('0x4')]},'droptime':{'type':Sequelize[_0x868b('0x4')]},'endtime':{'type':Sequelize[_0x868b('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x868b('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x868b('0x3')]},'campaign':{'type':Sequelize[_0x868b('0x3')]},'campaigntype':{'type':Sequelize[_0x868b('0x3')]},'membername':{'type':Sequelize[_0x868b('0x3')]},'reason':{'type':Sequelize[_0x868b('0x3')]},'disposition':{'type':Sequelize[_0x868b('0x3')]},'secondDisposition':{'type':Sequelize[_0x868b('0x3')]},'thirdDisposition':{'type':Sequelize[_0x868b('0x3')]},'dispositionat':{'type':Sequelize[_0x868b('0x4')],'set':function(_0x57e343){var _0x521b06=this[_0x868b('0x5')](_0x868b('0x6'));if(_0x521b06&&_0x57e343){this[_0x868b('0x7')](_0x868b('0x8'),moment(_0x57e343)[_0x868b('0x9')](moment(_0x521b06),'seconds'));}return this[_0x868b('0x7')](_0x868b('0xa'),_0x57e343);}},'amd':{'type':Sequelize[_0x868b('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x868b('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x868b('0x4')]},'callback':{'type':Sequelize[_0x868b('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x868b('0x4')]},'deleted':{'type':Sequelize[_0x868b('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x868b('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x868b('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x868b('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x868b('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x868b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3c56=['DATE','INTEGER','getDataValue','followuptime','setDataValue','dispositionat','BOOLEAN','sequelize','exports','STRING'];(function(_0x193b59,_0x1d3454){var _0x339e71=function(_0x401922){while(--_0x401922){_0x193b59['push'](_0x193b59['shift']());}};_0x339e71(++_0x1d3454);}(_0x3c56,0x133));var _0x63c5=function(_0x4c0ec6,_0x34efa9){_0x4c0ec6=_0x4c0ec6-0x0;var _0x21feab=_0x3c56[_0x4c0ec6];return _0x21feab;};'use strict';var Sequelize=require(_0x63c5('0x0'));var moment=require('moment');module[_0x63c5('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x63c5('0x2')]},'scheduledat':{'type':Sequelize[_0x63c5('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x63c5('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x63c5('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x63c5('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x63c5('0x2')]},'originatecalleridname':{'type':Sequelize[_0x63c5('0x2')]},'calleridnum':{'type':Sequelize[_0x63c5('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x63c5('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x63c5('0x3')]},'droptime':{'type':Sequelize[_0x63c5('0x3')]},'endtime':{'type':Sequelize[_0x63c5('0x3')]},'ringtime':{'type':Sequelize[_0x63c5('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x63c5('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x63c5('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x63c5('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x63c5('0x2')]},'campaigntype':{'type':Sequelize[_0x63c5('0x2')]},'membername':{'type':Sequelize[_0x63c5('0x2')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x63c5('0x2')]},'secondDisposition':{'type':Sequelize[_0x63c5('0x2')]},'thirdDisposition':{'type':Sequelize[_0x63c5('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4e1e0a){var _0x264aac=this[_0x63c5('0x5')]('endtime');if(_0x264aac&&_0x4e1e0a){this['setDataValue'](_0x63c5('0x6'),moment(_0x4e1e0a)['diff'](moment(_0x264aac),'seconds'));}return this[_0x63c5('0x7')](_0x63c5('0x8'),_0x4e1e0a);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x63c5('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x63c5('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x63c5('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x63c5('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x63c5('0x3')]},'deleted':{'type':Sequelize[_0x63c5('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x63c5('0x3')]},'recallme':{'type':Sequelize[_0x63c5('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x63c5('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x63c5('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x63c5('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x63c5('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x63c5('0x4')],'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 af38d4e..553278a 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 _0xacf4=['reject','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','select','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','NOW()','CampaignId\x20=\x20?','checkContactHopper','CmHopper','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x3b6ee4,_0x157700){var _0x1cfe72=function(_0x9c490b){while(--_0x9c490b){_0x3b6ee4['push'](_0x3b6ee4['shift']());}};_0x1cfe72(++_0x157700);}(_0xacf4,0xe7));var _0x4acf=function(_0x2b330e,_0xda6026){_0x2b330e=_0x2b330e-0x0;var _0x15228d=_0xacf4[_0x2b330e];return _0x15228d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['CmHopperFinal'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':!![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['CmHopperFinal']['describe']()[_0x4acf('0x21')](respondWithResult(_0x2d946c,null))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x33bc52,_0x287406){if(_0x33bc52[_0x4acf('0x47')][_0x4acf('0x48')]){delete _0x33bc52[_0x4acf('0x47')][_0x4acf('0x48')];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'uniqueid':_0x33bc52[_0x4acf('0x41')]['id']}})['then'](handleEntityNotFound(_0x287406,null))[_0x4acf('0x21')](saveUpdates(_0x33bc52[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x287406,null))[_0x4acf('0x3f')](handleError(_0x287406,null));};exports[_0x4acf('0x49')]=function(_0x3cf54a,_0x2785b9,_0x2d0561){return db[_0x4acf('0x29')][_0x4acf('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x3cf54a[_0x4acf('0x41')]['id']},'attributes':[[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),_0x4acf('0x4d')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x4e')))),_0x4acf('0x4f')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x50')))),'busyContacts'],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x51')))),_0x4acf('0x52')],[db['sequelize']['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4acf('0x53')],[db['sequelize']['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x54')))),_0x4acf('0x55')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x2022,\x201,\x20null'))),_0x4acf('0x56')],[db[_0x4acf('0x4a')]['fn']('COUNT',db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal'](_0x4acf('0x57')))),_0x4acf('0x58')]]})[_0x4acf('0x21')](handleEntityNotFound(_0x2785b9,null))['then'](respondWithResult(_0x2785b9,null))[_0x4acf('0x3f')](handleError(_0x2785b9,null));};exports[_0x4acf('0x59')]=function(_0xb5bd81,_0x452ee6,_0x54b093){return db[_0x4acf('0x29')][_0x4acf('0x3d')]({'raw':![],'where':{'CampaignId':_0xb5bd81[_0x4acf('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x5a')))),_0x4acf('0x4d')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x4e')))),_0x4acf('0x4f')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x50')))),_0x4acf('0x5b')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x4acf('0x52')],[db['sequelize']['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x4acf('0x5c')))),_0x4acf('0x53')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db['sequelize'][_0x4acf('0x4c')](_0x4acf('0x5d')))),_0x4acf('0x56')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db['sequelize'][_0x4acf('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0x4acf('0x58')]]})[_0x4acf('0x21')](handleEntityNotFound(_0x452ee6,null))[_0x4acf('0x21')](respondWithResult(_0x452ee6,null))[_0x4acf('0x3f')](handleError(_0x452ee6,null));};exports[_0x4acf('0x5e')]=function(_0x173655,_0x1f2dbc,_0xc0d942){return db[_0x4acf('0x5f')][_0x4acf('0x45')]({'where':{'id':_0x173655[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x1f2dbc,null))['then'](function(_0x11f356){var _0xacca91;if(_0x11f356){_0xacca91=squel[_0x4acf('0x60')]()[_0x4acf('0x61')](_0x4acf('0x62'))[_0x4acf('0x63')]([_0x4acf('0x64'),_0x4acf('0x65'),_0x4acf('0x66'),_0x4acf('0x67'),'VoiceQueueId',_0x4acf('0x68'),_0x4acf('0x69')],squel['select']()[_0x4acf('0x6a')](_0x4acf('0x6b'),'phone')[_0x4acf('0x6a')]('NOW()','scheduledAt')[_0x4acf('0x6a')]('ANY_VALUE(ContactId)',_0x4acf('0x66'))[_0x4acf('0x6a')](_0x4acf('0x6c'),_0x4acf('0x67'))['field'](_0x4acf('0x6d'),_0x4acf('0x6e'))['field']('NOW()','createdAt')[_0x4acf('0x6a')]('NOW()',_0x4acf('0x69'))[_0x4acf('0x6f')](_0x4acf('0x70'))['where'](_0x4acf('0x71'),_0x173655[_0x4acf('0x41')]['id']['toString']())[_0x4acf('0x35')](_0x4acf('0x72'),_0x173655['body'][_0x4acf('0x73')][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x75'))[_0x4acf('0x35')](_0x4acf('0x76'),squel['select']()[_0x4acf('0x6a')]('phone')[_0x4acf('0x6f')](_0x4acf('0x62'))['where']('VoiceQueueId\x20=\x20?',_0x173655['params']['id'][_0x4acf('0x74')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x4acf('0x6a')]('calleridnum')[_0x4acf('0x6f')](_0x4acf('0x70'))[_0x4acf('0x35')](_0x4acf('0x71'),_0x173655[_0x4acf('0x41')]['id']['toString']())['where'](_0x4acf('0x77')))[_0x4acf('0x78')](_0x4acf('0x66')))[_0x4acf('0x74')]();return db[_0x4acf('0x4a')]['query'](_0xacca91);}return[];})[_0x4acf('0x21')](respondWithResult(_0x1f2dbc,null))[_0x4acf('0x3f')](handleError(_0x1f2dbc,null));};exports[_0x4acf('0x79')]=function(_0x453c6d,_0x1a82e7,_0x3d02c7){return db[_0x4acf('0x7a')]['find']({'where':{'id':_0x453c6d[_0x4acf('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a82e7,null))[_0x4acf('0x21')](function(_0x1bbe6d){var _0x2a36e2;if(_0x1bbe6d){_0x2a36e2=squel[_0x4acf('0x60')]()[_0x4acf('0x61')]('cm_hopper')[_0x4acf('0x63')](['phone',_0x4acf('0x65'),_0x4acf('0x66'),'ListId',_0x4acf('0x7b'),_0x4acf('0x68'),_0x4acf('0x69')],squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')]('ANY_VALUE(calleridnum)',_0x4acf('0x64'))['field']('NOW()',_0x4acf('0x65'))[_0x4acf('0x6a')](_0x4acf('0x7d'),_0x4acf('0x66'))['field']('ANY_VALUE(ListId)',_0x4acf('0x67'))[_0x4acf('0x6a')](_0x4acf('0x7e'),_0x4acf('0x7b'))[_0x4acf('0x6a')](_0x4acf('0x7f'),_0x4acf('0x68'))[_0x4acf('0x6a')]('NOW()','updatedAt')[_0x4acf('0x6f')](_0x4acf('0x70'))[_0x4acf('0x35')](_0x4acf('0x80'),_0x453c6d[_0x4acf('0x41')]['id'][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x72'),_0x453c6d[_0x4acf('0x47')]['state'][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x75'))[_0x4acf('0x35')](_0x4acf('0x76'),squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')](_0x4acf('0x64'))[_0x4acf('0x6f')](_0x4acf('0x62'))[_0x4acf('0x35')](_0x4acf('0x80'),_0x453c6d[_0x4acf('0x41')]['id']['toString']()))[_0x4acf('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')]('calleridnum')[_0x4acf('0x6f')](_0x4acf('0x70'))['where']('CampaignId\x20=\x20?',_0x453c6d[_0x4acf('0x41')]['id'][_0x4acf('0x74')]())['where']('state\x20=\x204'))[_0x4acf('0x78')](_0x4acf('0x66')))[_0x4acf('0x74')]();return db[_0x4acf('0x4a')]['query'](_0x2a36e2);}return[];})[_0x4acf('0x21')](respondWithResult(_0x1a82e7,null))[_0x4acf('0x3f')](handleError(_0x1a82e7,null));};exports[_0x4acf('0x81')]=function(_0x34e1ea,_0x43e9bf,_0x367ad4){return db[_0x4acf('0x82')]['findOne']({'where':{'VoiceQueueId':_0x34e1ea[_0x4acf('0x47')][_0x4acf('0x6e')],'CampaignId':_0x34e1ea[_0x4acf('0x47')]['CampaignId'],'ContactId':_0x34e1ea[_0x4acf('0x47')][_0x4acf('0x66')]}})[_0x4acf('0x21')](handleEntityNotFound(_0x43e9bf,null))[_0x4acf('0x21')](function(_0x37ffab){if(_0x37ffab){return _0x37ffab;}return null;})[_0x4acf('0x21')](respondWithResult(_0x43e9bf,null))[_0x4acf('0x3f')](handleError(_0x43e9bf,null));}; \ No newline at end of file +var _0xc2c7=['`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','group','moveContactsIvrCampaignHopperFinal','Campaign','ANY_VALUE(calleridnum)','CampaignId','CampaignId\x20=\x20?','calleridnum','state\x20=\x204','checkContactHopper','CmHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','uniqueid','params','body','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal'];(function(_0x1556ff,_0x27a1d0){var _0x125562=function(_0x4d59c7){while(--_0x4d59c7){_0x1556ff['push'](_0x1556ff['shift']());}};_0x125562(++_0x27a1d0);}(_0xc2c7,0x134));var _0x7c2c=function(_0xb0c9df,_0x2b1e54){_0xb0c9df=_0xb0c9df-0x0;var _0x4dd03c=_0xc2c7[_0xb0c9df];return _0x4dd03c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':!![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['CmHopperFinal'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['describe']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['describe']()['then'](respondWithResult(_0x3091bd,null))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x39d5af,_0x2b79d5){if(_0x39d5af['body']['uniqueid']){delete _0x39d5af['body'][_0x7c2c('0x48')];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'uniqueid':_0x39d5af[_0x7c2c('0x49')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x2b79d5,null))['then'](saveUpdates(_0x39d5af[_0x7c2c('0x4a')],null))[_0x7c2c('0x26')](respondWithResult(_0x2b79d5,null))['catch'](handleError(_0x2b79d5,null));};exports[_0x7c2c('0x4b')]=function(_0x56e09d,_0xfba6a7,_0x3806f4){return db[_0x7c2c('0x2c')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x56e09d['params']['id']},'attributes':[[db[_0x7c2c('0x4c')]['fn']('COUNT',db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x4d')))),_0x7c2c('0x4e')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize'][_0x7c2c('0x50')](_0x7c2c('0x51')))),_0x7c2c('0x52')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x7c2c('0x53')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize'][_0x7c2c('0x50')](_0x7c2c('0x54')))),'congestionContacts'],[db[_0x7c2c('0x4c')]['fn']('COUNT',db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x55')))),_0x7c2c('0x56')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7c2c('0x57')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x58')))),_0x7c2c('0x59')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x7c2c('0x26')](handleEntityNotFound(_0xfba6a7,null))[_0x7c2c('0x26')](respondWithResult(_0xfba6a7,null))[_0x7c2c('0x45')](handleError(_0xfba6a7,null));};exports[_0x7c2c('0x5a')]=function(_0x44602a,_0x1ad537,_0x2d04da){return db[_0x7c2c('0x2c')]['findAll']({'raw':![],'where':{'CampaignId':_0x44602a['params']['id']},'attributes':[[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x7c2c('0x4e')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x51')))),_0x7c2c('0x52')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x5b')))),'busyContacts'],[db[_0x7c2c('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x7c2c('0x54')))),_0x7c2c('0x5c')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x55')))),_0x7c2c('0x56')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x5d')))),_0x7c2c('0x57')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize'][_0x7c2c('0x50')](_0x7c2c('0x58')))),'reCallContacts'],[db['sequelize']['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x5e')))),_0x7c2c('0x5f')]]})['then'](handleEntityNotFound(_0x1ad537,null))[_0x7c2c('0x26')](respondWithResult(_0x1ad537,null))['catch'](handleError(_0x1ad537,null));};exports[_0x7c2c('0x60')]=function(_0x2b597d,_0x20eb63,_0x56f737){return db[_0x7c2c('0x61')][_0x7c2c('0x47')]({'where':{'id':_0x2b597d[_0x7c2c('0x49')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x20eb63,null))['then'](function(_0x158352){var _0x1e711e;if(_0x158352){_0x1e711e=squel[_0x7c2c('0x62')]()[_0x7c2c('0x63')](_0x7c2c('0x64'))[_0x7c2c('0x65')]([_0x7c2c('0x66'),_0x7c2c('0x67'),_0x7c2c('0x68'),'ListId',_0x7c2c('0x69'),_0x7c2c('0x6a'),'updatedAt'],squel[_0x7c2c('0x6b')]()['field']('ANY_VALUE(calleridnum)',_0x7c2c('0x66'))[_0x7c2c('0x6c')](_0x7c2c('0x6d'),'scheduledAt')[_0x7c2c('0x6c')](_0x7c2c('0x6e'),_0x7c2c('0x68'))['field'](_0x7c2c('0x6f'),_0x7c2c('0x70'))[_0x7c2c('0x6c')](_0x7c2c('0x71'),'VoiceQueueId')[_0x7c2c('0x6c')]('NOW()',_0x7c2c('0x6a'))['field'](_0x7c2c('0x6d'),_0x7c2c('0x72'))[_0x7c2c('0x73')](_0x7c2c('0x74'))[_0x7c2c('0x3d')](_0x7c2c('0x75'),_0x2b597d[_0x7c2c('0x49')]['id']['toString']())[_0x7c2c('0x3d')](_0x7c2c('0x76'),_0x2b597d[_0x7c2c('0x4a')][_0x7c2c('0x77')][_0x7c2c('0x78')]())[_0x7c2c('0x3d')](_0x7c2c('0x79'))[_0x7c2c('0x3d')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x7c2c('0x6b')]()[_0x7c2c('0x6c')](_0x7c2c('0x66'))[_0x7c2c('0x73')](_0x7c2c('0x64'))['where'](_0x7c2c('0x75'),_0x2b597d[_0x7c2c('0x49')]['id']['toString']()))[_0x7c2c('0x3d')](_0x7c2c('0x7a'),squel['select']()[_0x7c2c('0x6c')]('calleridnum')[_0x7c2c('0x73')](_0x7c2c('0x74'))[_0x7c2c('0x3d')](_0x7c2c('0x75'),_0x2b597d[_0x7c2c('0x49')]['id'][_0x7c2c('0x78')]())[_0x7c2c('0x3d')]('state\x20=\x204'))[_0x7c2c('0x7b')](_0x7c2c('0x68')))['toString']();return db[_0x7c2c('0x4c')][_0x7c2c('0x32')](_0x1e711e);}return[];})[_0x7c2c('0x26')](respondWithResult(_0x20eb63,null))[_0x7c2c('0x45')](handleError(_0x20eb63,null));};exports[_0x7c2c('0x7c')]=function(_0x2f249d,_0x136226,_0x354236){return db[_0x7c2c('0x7d')][_0x7c2c('0x47')]({'where':{'id':_0x2f249d[_0x7c2c('0x49')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x136226,null))[_0x7c2c('0x26')](function(_0xb47bf0){var _0x4d0922;if(_0xb47bf0){_0x4d0922=squel[_0x7c2c('0x62')]()[_0x7c2c('0x63')]('cm_hopper')[_0x7c2c('0x65')]([_0x7c2c('0x66'),_0x7c2c('0x67'),_0x7c2c('0x68'),_0x7c2c('0x70'),'CampaignId',_0x7c2c('0x6a'),_0x7c2c('0x72')],squel[_0x7c2c('0x6b')]()['field'](_0x7c2c('0x7e'),_0x7c2c('0x66'))[_0x7c2c('0x6c')]('NOW()',_0x7c2c('0x67'))['field'](_0x7c2c('0x6e'),'ContactId')['field'](_0x7c2c('0x6f'),_0x7c2c('0x70'))[_0x7c2c('0x6c')]('ANY_VALUE(CampaignId)',_0x7c2c('0x7f'))[_0x7c2c('0x6c')](_0x7c2c('0x6d'),_0x7c2c('0x6a'))['field'](_0x7c2c('0x6d'),'updatedAt')['from']('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x2f249d[_0x7c2c('0x49')]['id'][_0x7c2c('0x78')]())[_0x7c2c('0x3d')](_0x7c2c('0x76'),_0x2f249d[_0x7c2c('0x4a')]['state'][_0x7c2c('0x78')]())[_0x7c2c('0x3d')](_0x7c2c('0x79'))[_0x7c2c('0x3d')](_0x7c2c('0x7a'),squel[_0x7c2c('0x6b')]()['field']('phone')[_0x7c2c('0x73')](_0x7c2c('0x64'))[_0x7c2c('0x3d')](_0x7c2c('0x80'),_0x2f249d['params']['id'][_0x7c2c('0x78')]()))[_0x7c2c('0x3d')](_0x7c2c('0x7a'),squel[_0x7c2c('0x6b')]()[_0x7c2c('0x6c')](_0x7c2c('0x81'))[_0x7c2c('0x73')](_0x7c2c('0x74'))[_0x7c2c('0x3d')]('CampaignId\x20=\x20?',_0x2f249d[_0x7c2c('0x49')]['id'][_0x7c2c('0x78')]())['where'](_0x7c2c('0x82')))['group'](_0x7c2c('0x68')))['toString']();return db[_0x7c2c('0x4c')][_0x7c2c('0x32')](_0x4d0922);}return[];})[_0x7c2c('0x26')](respondWithResult(_0x136226,null))[_0x7c2c('0x45')](handleError(_0x136226,null));};exports[_0x7c2c('0x83')]=function(_0x309051,_0x3f8683,_0x1eeb00){return db[_0x7c2c('0x84')]['findOne']({'where':{'VoiceQueueId':_0x309051[_0x7c2c('0x4a')][_0x7c2c('0x69')],'CampaignId':_0x309051[_0x7c2c('0x4a')]['CampaignId'],'ContactId':_0x309051[_0x7c2c('0x4a')][_0x7c2c('0x68')]}})['then'](handleEntityNotFound(_0x3f8683,null))[_0x7c2c('0x26')](function(_0x511158){if(_0x511158){return _0x511158;}return null;})[_0x7c2c('0x26')](respondWithResult(_0x3f8683,null))['catch'](handleError(_0x3f8683,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 0cdc469..f2c71c8 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 _0x8fdd=['api','bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid'];(function(_0x3afef7,_0xcbc59){var _0x2bf40c=function(_0x5d8979){while(--_0x5d8979){_0x3afef7['push'](_0x3afef7['shift']());}};_0x2bf40c(++_0xcbc59);}(_0x8fdd,0x90));var _0xd8fd=function(_0x1476ba,_0x446421){_0x1476ba=_0x1476ba-0x0;var _0x5e7bc1=_0x8fdd[_0x1476ba];return _0x5e7bc1;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd8fd('0x0'));var moment=require('moment');var BPromise=require(_0xd8fd('0x1'));var rp=require(_0xd8fd('0x2'));var fs=require('fs');var path=require(_0xd8fd('0x3'));var rimraf=require('rimraf');var config=require(_0xd8fd('0x4'));var attributes=require(_0xd8fd('0x5'));module[_0xd8fd('0x6')]=function(_0x266777,_0x12c59f){return _0x266777[_0xd8fd('0x7')](_0xd8fd('0x8'),attributes,{'tableName':_0xd8fd('0x9'),'paranoid':![],'indexes':[{'name':_0xd8fd('0xa'),'fields':[_0xd8fd('0xa')]},{'name':_0xd8fd('0xb'),'fields':[_0xd8fd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x740b=['moment','bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x2efe86,_0x4b6c3f){var _0x48e01c=function(_0x5b1412){while(--_0x5b1412){_0x2efe86['push'](_0x2efe86['shift']());}};_0x48e01c(++_0x4b6c3f);}(_0x740b,0x9a));var _0xb740=function(_0x1959fc,_0x4c2d46){_0x1959fc=_0x1959fc-0x0;var _0x1da674=_0x740b[_0x1959fc];return _0x1da674;};'use strict';var _=require(_0xb740('0x0'));var util=require(_0xb740('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb740('0x2'));var BPromise=require(_0xb740('0x3'));var rp=require(_0xb740('0x4'));var fs=require('fs');var path=require(_0xb740('0x5'));var rimraf=require('rimraf');var config=require(_0xb740('0x6'));var attributes=require(_0xb740('0x7'));module['exports']=function(_0x173a46,_0xc41b3){return _0x173a46[_0xb740('0x8')](_0xb740('0x9'),attributes,{'tableName':_0xb740('0xa'),'paranoid':![],'indexes':[{'name':_0xb740('0xb'),'fields':[_0xb740('0xb')]},{'name':_0xb740('0xc'),'fields':[_0xb740('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index b343c9c..237a168 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x5153a1,_0x2a8421){var _0xba2a90=function(_0x534062){while(--_0x534062){_0x5153a1['push'](_0x5153a1['shift']());}};_0xba2a90(++_0x2a8421);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a27fd,_0x5357ea){_0x3a27fd=_0x3a27fd-0x0;var _0x2e519=_0xb10b[_0x3a27fd];return _0x2e519;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x9d2cd,_0x488585){var _0x550d9f=function(_0xd48a05){while(--_0xd48a05){_0x9d2cd['push'](_0x9d2cd['shift']());}};_0x550d9f(++_0x488585);}(_0x7a54,0x106));var _0x47a5=function(_0x56a8da,_0x4e4860){_0x56a8da=_0x56a8da-0x0;var _0x5eaea8=_0x7a54[_0x56a8da];return _0x5eaea8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 03b6406..401fba2 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 _0x5c96=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id','update','exports','multer','util','path','connect-timeout','Router'];(function(_0x5be3e8,_0x2c5c15){var _0x55f67d=function(_0x489b8d){while(--_0x489b8d){_0x5be3e8['push'](_0x5be3e8['shift']());}};_0x55f67d(++_0x2c5c15);}(_0x5c96,0x133));var _0x65c9=function(_0x469ad2,_0x7548a5){_0x469ad2=_0x469ad2-0x0;var _0x3ea60d=_0x5c96[_0x469ad2];return _0x3ea60d;};'use strict';var multer=require(_0x65c9('0x0'));var util=require(_0x65c9('0x1'));var path=require(_0x65c9('0x2'));var timeout=require(_0x65c9('0x3'));var express=require('express');var router=express[_0x65c9('0x4')]();var fs_extra=require(_0x65c9('0x5'));var auth=require(_0x65c9('0x6'));var interaction=require(_0x65c9('0x7'));var config=require(_0x65c9('0x8'));var controller=require(_0x65c9('0x9'));router[_0x65c9('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x65c9('0xb')](),controller[_0x65c9('0xc')]);router[_0x65c9('0xa')]('/:id',auth[_0x65c9('0xb')](),controller[_0x65c9('0xd')]);router[_0x65c9('0xa')](_0x65c9('0xe'),auth[_0x65c9('0xb')](),controller[_0x65c9('0xf')]);router[_0x65c9('0xa')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0x65c9('0x10')](_0x65c9('0x11'),auth[_0x65c9('0xb')](),controller[_0x65c9('0x12')]);router[_0x65c9('0x10')]('/voice/campaign/moveContacts/:id',auth[_0x65c9('0xb')](),controller[_0x65c9('0x13')]);router[_0x65c9('0x10')](_0x65c9('0x14'),auth['isAuthenticated'](),controller[_0x65c9('0x15')]);router[_0x65c9('0x16')](_0x65c9('0x17'),auth[_0x65c9('0xb')](),controller[_0x65c9('0x18')]);module[_0x65c9('0x19')]=router; \ No newline at end of file +var _0xf132=['countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','/:id','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','/describe','isAuthenticated','describe','show','/voice/queue/countAttributes/:id'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xf132,0xaa));var _0x2f13=function(_0x4b27a3,_0x50c86e){_0x4b27a3=_0x4b27a3-0x0;var _0x19b768=_0xf132[_0x4b27a3];return _0x19b768;};'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 fs_extra=require(_0x2f13('0x4'));var auth=require(_0x2f13('0x5'));var interaction=require(_0x2f13('0x6'));var config=require('../../config/environment');var controller=require(_0x2f13('0x7'));router[_0x2f13('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2f13('0x8')](_0x2f13('0x9'),auth[_0x2f13('0xa')](),controller[_0x2f13('0xb')]);router[_0x2f13('0x8')]('/:id',auth[_0x2f13('0xa')](),controller[_0x2f13('0xc')]);router[_0x2f13('0x8')](_0x2f13('0xd'),auth[_0x2f13('0xa')](),controller[_0x2f13('0xe')]);router['get'](_0x2f13('0xf'),auth[_0x2f13('0xa')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0x2f13('0x10'),auth[_0x2f13('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x2f13('0x11')](_0x2f13('0x12'),auth[_0x2f13('0xa')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x2f13('0x11')](_0x2f13('0x13'),auth[_0x2f13('0xa')](),controller[_0x2f13('0x14')]);router[_0x2f13('0x15')](_0x2f13('0x16'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 412c82e..181f87b 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 _0x943e=['INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x53023a,_0x5be9f3){var _0x1cfb5b=function(_0x2bc4e2){while(--_0x2bc4e2){_0x53023a['push'](_0x53023a['shift']());}};_0x1cfb5b(++_0x5be9f3);}(_0x943e,0xc2));var _0xe943=function(_0x3310e6,_0x4e4ede){_0x3310e6=_0x3310e6-0x0;var _0x1806dc=_0x943e[_0x3310e6];return _0x1806dc;};'use strict';var Sequelize=require(_0xe943('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xe943('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe943('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe943('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe943('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe943('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xe943('0x2')]},'originatecalleridname':{'type':Sequelize[_0xe943('0x2')]},'calleridnum':{'type':Sequelize[_0xe943('0x2')]},'calleridname':{'type':Sequelize[_0xe943('0x2')]},'starttime':{'type':Sequelize[_0xe943('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe943('0x3')]},'droptime':{'type':Sequelize[_0xe943('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xe943('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe943('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe943('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe943('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe943('0x2')]},'campaign':{'type':Sequelize[_0xe943('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xe943('0x2')]},'amd':{'type':Sequelize[_0xe943('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe943('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xe943('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe943('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe943('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xe943('0x3')]},'edited':{'type':Sequelize[_0xe943('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xe943('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe943('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe943('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe943('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc700=['DATE','BOOLEAN','exports','INTEGER','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc700,0x17e));var _0x0c70=function(_0x1331ba,_0x1229b1){_0x1331ba=_0x1331ba-0x0;var _0x38b684=_0xc700[_0x1331ba];return _0x38b684;};'use strict';var Sequelize=require('sequelize');module[_0x0c70('0x0')]={'state':{'type':Sequelize[_0x0c70('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0c70('0x2')]},'scheduledat':{'type':Sequelize[_0x0c70('0x3')]},'countbusyretry':{'type':Sequelize[_0x0c70('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0c70('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0c70('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0c70('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x0c70('0x2')]},'originatecalleridname':{'type':Sequelize[_0x0c70('0x2')]},'calleridnum':{'type':Sequelize[_0x0c70('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0c70('0x3')]},'answertime':{'type':Sequelize[_0x0c70('0x3')]},'droptime':{'type':Sequelize[_0x0c70('0x3')]},'endtime':{'type':Sequelize[_0x0c70('0x3')]},'ringtime':{'type':Sequelize[_0x0c70('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0c70('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0c70('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0c70('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x0c70('0x2')]},'membername':{'type':Sequelize[_0x0c70('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x0c70('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0c70('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x0c70('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0c70('0x3')]},'recallme':{'type':Sequelize[_0x0c70('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x0c70('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0c70('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0c70('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0c70('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 7f88424..a423623 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 _0xe65c=['util','path','to-csv','ejs','fs-extra','lodash','squel','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','status','json','offset','limit','undefined','count','set','reject','update','then','error','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','include','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe65c,0x19e));var _0xce65=function(_0x1c8c07,_0x2579af){_0x1c8c07=_0x1c8c07-0x0;var _0x4aa88f=_0xe65c[_0x1c8c07];return _0x4aa88f;};'use strict';var emlformat=require(_0xce65('0x0'));var rimraf=require(_0xce65('0x1'));var zipdir=require(_0xce65('0x2'));var jsonpatch=require(_0xce65('0x3'));var rp=require(_0xce65('0x4'));var moment=require('moment');var BPromise=require(_0xce65('0x5'));var Mustache=require('mustache');var util=require(_0xce65('0x6'));var path=require(_0xce65('0x7'));var sox=require('sox');var csv=require(_0xce65('0x8'));var ejs=require(_0xce65('0x9'));var fs=require('fs');var fs_extra=require(_0xce65('0xa'));var _=require(_0xce65('0xb'));var squel=require(_0xce65('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xce65('0xd'));var toCsv=require(_0xce65('0x8'));var querystring=require(_0xce65('0xe'));var Papa=require(_0xce65('0xf'));var Redis=require(_0xce65('0x10'));var authService=require(_0xce65('0x11'));var qs=require(_0xce65('0x12'));var as=require(_0xce65('0x13'));var hardwareService=require(_0xce65('0x14'));var logger=require(_0xce65('0x15'))('api');var utils=require(_0xce65('0x16'));var config=require(_0xce65('0x17'));var licenseUtil=require(_0xce65('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5caa71,_0x2d8252){_0x2d8252=_0x2d8252||0xcc;return function(_0x4b9072){if(_0x4b9072){return _0x5caa71['sendStatus'](_0x2d8252);}return _0x5caa71['status'](_0x2d8252)['end']();};}function respondWithResult(_0x47d1eb,_0xf6ba1b){_0xf6ba1b=_0xf6ba1b||0xc8;return function(_0x385f11){if(_0x385f11){return _0x47d1eb[_0xce65('0x19')](_0xf6ba1b)[_0xce65('0x1a')](_0x385f11);}};}function respondWithFilteredResult(_0x367d5c,_0x5a9a1b){return function(_0x1ba62b){if(_0x1ba62b){var _0x4a10a1=typeof _0x5a9a1b[_0xce65('0x1b')]==='undefined'&&typeof _0x5a9a1b[_0xce65('0x1c')]===_0xce65('0x1d');var _0x49c53c=_0x1ba62b[_0xce65('0x1e')];var _0xae97da=_0x4a10a1?0x0:_0x5a9a1b[_0xce65('0x1b')];var _0x416fc0=_0x4a10a1?_0x1ba62b[_0xce65('0x1e')]:_0x5a9a1b[_0xce65('0x1b')]+_0x5a9a1b[_0xce65('0x1c')];var _0x42bdf2;if(_0x416fc0>=_0x49c53c){_0x416fc0=_0x49c53c;_0x42bdf2=0xc8;}else{_0x42bdf2=0xce;}_0x367d5c['status'](_0x42bdf2);return _0x367d5c[_0xce65('0x1f')]('Content-Range',_0xae97da+'-'+_0x416fc0+'/'+_0x49c53c)['json'](_0x1ba62b);}return null;};}function patchUpdates(_0x1115f6){return function(_0x17f9d1){try{jsonpatch['apply'](_0x17f9d1,_0x1115f6,!![]);}catch(_0x4d8396){return BPromise[_0xce65('0x20')](_0x4d8396);}return _0x17f9d1['save']();};}function saveUpdates(_0x123ecb,_0x30423a){return function(_0x4d7f40){if(_0x4d7f40){return _0x4d7f40[_0xce65('0x21')](_0x123ecb)[_0xce65('0x22')](function(_0x5152e2){return _0x5152e2;});}return null;};}function removeEntity(_0x4c96f5,_0x54491d){return function(_0xd8dcb7){if(_0xd8dcb7){return _0xd8dcb7['destroy']()[_0xce65('0x22')](function(){_0x4c96f5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a88a9,_0x5a8b89){return function(_0x254d26){if(!_0x254d26){_0x3a88a9['sendStatus'](0x194);}return _0x254d26;};}function handleError(_0x5a0d32,_0x20777d){_0x20777d=_0x20777d||0x1f4;return function(_0x14a329){logger[_0xce65('0x23')](_0x14a329['stack']);if(_0x14a329[_0xce65('0x24')]){delete _0x14a329[_0xce65('0x24')];}_0x5a0d32[_0xce65('0x19')](_0x20777d)[_0xce65('0x25')](_0x14a329);};}exports[_0xce65('0x26')]=function(_0x5cd38c,_0x1076ef){var _0x589b26={},_0x1058ec={},_0x276764={'count':0x0,'rows':[]};var _0x125d9c=_[_0xce65('0x27')](db[_0xce65('0x28')][_0xce65('0x29')],function(_0x2a4ce3){return{'name':_0x2a4ce3[_0xce65('0x2a')],'type':_0x2a4ce3[_0xce65('0x2b')]['key']};});_0x1058ec[_0xce65('0x2c')]=_[_0xce65('0x27')](_0x125d9c,_0xce65('0x24'));_0x1058ec['query']=_['keys'](_0x5cd38c['query']);_0x1058ec[_0xce65('0x2d')]=_[_0xce65('0x2e')](_0x1058ec[_0xce65('0x2c')],_0x1058ec[_0xce65('0x2f')]);_0x589b26['attributes']=_['intersection'](_0x1058ec[_0xce65('0x2c')],qs['fields'](_0x5cd38c[_0xce65('0x2f')][_0xce65('0x30')]));_0x589b26[_0xce65('0x31')]=_0x589b26['attributes'][_0xce65('0x32')]?_0x589b26['attributes']:_0x1058ec[_0xce65('0x2c')];if(!_0x5cd38c[_0xce65('0x2f')][_0xce65('0x33')](_0xce65('0x34'))){_0x589b26[_0xce65('0x1c')]=qs[_0xce65('0x1c')](_0x5cd38c[_0xce65('0x2f')][_0xce65('0x1c')]);_0x589b26[_0xce65('0x1b')]=qs[_0xce65('0x1b')](_0x5cd38c['query']['offset']);}_0x589b26['order']=qs[_0xce65('0x35')](_0x5cd38c['query'][_0xce65('0x35')]);_0x589b26[_0xce65('0x36')]=qs[_0xce65('0x2d')](_['pick'](_0x5cd38c['query'],_0x1058ec['filters']),_0x125d9c);if(_0x5cd38c[_0xce65('0x2f')]['filter']){_0x589b26[_0xce65('0x36')]=_[_0xce65('0x37')](_0x589b26['where'],{'$or':_[_0xce65('0x27')](_0x125d9c,function(_0x6ae0b2){if(_0x6ae0b2['type']!==_0xce65('0x38')){var _0x39f4f1={};_0x39f4f1[_0x6ae0b2[_0xce65('0x24')]]={'$like':'%'+_0x5cd38c[_0xce65('0x2f')]['filter']+'%'};return _0x39f4f1;}})});}_0x589b26=_[_0xce65('0x37')]({},_0x589b26,_0x5cd38c['options']);var _0x50e46f={'where':_0x589b26[_0xce65('0x36')]};return db['CmHopperHistory'][_0xce65('0x1e')](_0x50e46f)[_0xce65('0x22')](function(_0x18ebe3){_0x276764[_0xce65('0x1e')]=_0x18ebe3;if(_0x5cd38c['query'][_0xce65('0x39')]){_0x589b26['include']=[{'all':!![]}];}return db[_0xce65('0x28')][_0xce65('0x3a')](_0x589b26);})[_0xce65('0x22')](function(_0x571f4c){_0x276764[_0xce65('0x3b')]=_0x571f4c;return _0x276764;})[_0xce65('0x22')](respondWithFilteredResult(_0x1076ef,_0x589b26))[_0xce65('0x3c')](handleError(_0x1076ef,null));};exports[_0xce65('0x3d')]=function(_0xdd6e84,_0x39a17e){var _0x839cb8={'raw':!![],'where':{'id':_0xdd6e84[_0xce65('0x3e')]['id']}},_0x3c073a={};_0x3c073a[_0xce65('0x2c')]=_[_0xce65('0x3f')](db['CmHopperHistory']['rawAttributes']);_0x3c073a[_0xce65('0x2f')]=_[_0xce65('0x3f')](_0xdd6e84['query']);_0x3c073a['filters']=_[_0xce65('0x2e')](_0x3c073a[_0xce65('0x2c')],_0x3c073a['query']);_0x839cb8[_0xce65('0x31')]=_[_0xce65('0x2e')](_0x3c073a['model'],qs[_0xce65('0x30')](_0xdd6e84['query'][_0xce65('0x30')]));_0x839cb8[_0xce65('0x31')]=_0x839cb8[_0xce65('0x31')][_0xce65('0x32')]?_0x839cb8['attributes']:_0x3c073a['model'];if(_0xdd6e84[_0xce65('0x2f')]['includeAll']){_0x839cb8[_0xce65('0x40')]=[{'all':!![]}];}_0x839cb8=_['merge']({},_0x839cb8,_0xdd6e84['options']);return db[_0xce65('0x28')]['find'](_0x839cb8)[_0xce65('0x22')](handleEntityNotFound(_0x39a17e,null))[_0xce65('0x22')](respondWithResult(_0x39a17e,null))[_0xce65('0x3c')](handleError(_0x39a17e,null));};exports[_0xce65('0x41')]=function(_0x33d2f1,_0x5823de){return db[_0xce65('0x28')][_0xce65('0x41')](_0x33d2f1[_0xce65('0x42')],{})[_0xce65('0x22')](respondWithResult(_0x5823de,0xc9))[_0xce65('0x3c')](handleError(_0x5823de,null));};exports[_0xce65('0x43')]=function(_0x4d0f17,_0x3f5aba){return db[_0xce65('0x28')][_0xce65('0x43')]()[_0xce65('0x22')](respondWithResult(_0x3f5aba,null))[_0xce65('0x3c')](handleError(_0x3f5aba,null));};exports['update']=function(_0x23bbcf,_0x480603){if(_0x23bbcf[_0xce65('0x42')][_0xce65('0x44')]){delete _0x23bbcf[_0xce65('0x42')]['uniqueid'];}return db[_0xce65('0x28')][_0xce65('0x45')]({'where':{'uniqueid':_0x23bbcf['params']['id']}})[_0xce65('0x22')](handleEntityNotFound(_0x480603,null))[_0xce65('0x22')](saveUpdates(_0x23bbcf[_0xce65('0x42')],null))['then'](respondWithResult(_0x480603,null))['catch'](handleError(_0x480603,null));}; \ No newline at end of file +var _0x246b=['fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','update','then','error','stack','name','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','describe','body','uniqueid','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x128976,_0x47e7d3){var _0x5b4ca4=function(_0x40ef21){while(--_0x40ef21){_0x128976['push'](_0x128976['shift']());}};_0x5b4ca4(++_0x47e7d3);}(_0x246b,0x1bd));var _0xb246=function(_0x2f2866,_0x58c23c){_0x2f2866=_0x2f2866-0x0;var _0x8dcd6a=_0x246b[_0x2f2866];return _0x8dcd6a;};'use strict';var emlformat=require(_0xb246('0x0'));var rimraf=require(_0xb246('0x1'));var zipdir=require(_0xb246('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb246('0x3'));var moment=require(_0xb246('0x4'));var BPromise=require(_0xb246('0x5'));var Mustache=require(_0xb246('0x6'));var util=require('util');var path=require(_0xb246('0x7'));var sox=require(_0xb246('0x8'));var csv=require(_0xb246('0x9'));var ejs=require(_0xb246('0xa'));var fs=require('fs');var fs_extra=require(_0xb246('0xb'));var _=require(_0xb246('0xc'));var squel=require(_0xb246('0xd'));var crypto=require(_0xb246('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb246('0xf'));var toCsv=require(_0xb246('0x9'));var querystring=require('querystring');var Papa=require(_0xb246('0x10'));var Redis=require(_0xb246('0x11'));var authService=require(_0xb246('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb246('0x13'));var logger=require(_0xb246('0x14'))(_0xb246('0x15'));var utils=require(_0xb246('0x16'));var config=require(_0xb246('0x17'));var licenseUtil=require(_0xb246('0x18'));var db=require(_0xb246('0x19'))['db'];function respondWithStatusCode(_0x1ad523,_0x2d3190){_0x2d3190=_0x2d3190||0xcc;return function(_0x4ca4e7){if(_0x4ca4e7){return _0x1ad523[_0xb246('0x1a')](_0x2d3190);}return _0x1ad523[_0xb246('0x1b')](_0x2d3190)[_0xb246('0x1c')]();};}function respondWithResult(_0x4ab0aa,_0x3d13bc){_0x3d13bc=_0x3d13bc||0xc8;return function(_0x52c963){if(_0x52c963){return _0x4ab0aa[_0xb246('0x1b')](_0x3d13bc)[_0xb246('0x1d')](_0x52c963);}};}function respondWithFilteredResult(_0x59dadb,_0x3cad3b){return function(_0x53eb23){if(_0x53eb23){var _0x5f02b0=typeof _0x3cad3b['offset']===_0xb246('0x1e')&&typeof _0x3cad3b['limit']===_0xb246('0x1e');var _0x226142=_0x53eb23['count'];var _0x183a4a=_0x5f02b0?0x0:_0x3cad3b['offset'];var _0x3cffd8=_0x5f02b0?_0x53eb23[_0xb246('0x1f')]:_0x3cad3b[_0xb246('0x20')]+_0x3cad3b[_0xb246('0x21')];var _0x211e6d;if(_0x3cffd8>=_0x226142){_0x3cffd8=_0x226142;_0x211e6d=0xc8;}else{_0x211e6d=0xce;}_0x59dadb[_0xb246('0x1b')](_0x211e6d);return _0x59dadb['set'](_0xb246('0x22'),_0x183a4a+'-'+_0x3cffd8+'/'+_0x226142)[_0xb246('0x1d')](_0x53eb23);}return null;};}function patchUpdates(_0x5777f8){return function(_0x4a40fc){try{jsonpatch[_0xb246('0x23')](_0x4a40fc,_0x5777f8,!![]);}catch(_0x4297a6){return BPromise['reject'](_0x4297a6);}return _0x4a40fc[_0xb246('0x24')]();};}function saveUpdates(_0x1fed52,_0x3d5d0e){return function(_0x439b03){if(_0x439b03){return _0x439b03[_0xb246('0x25')](_0x1fed52)[_0xb246('0x26')](function(_0x5b272d){return _0x5b272d;});}return null;};}function removeEntity(_0x52c0c2,_0x445618){return function(_0x3f94cf){if(_0x3f94cf){return _0x3f94cf['destroy']()[_0xb246('0x26')](function(){_0x52c0c2[_0xb246('0x1b')](0xcc)[_0xb246('0x1c')]();});}};}function handleEntityNotFound(_0x532306,_0x587489){return function(_0x218873){if(!_0x218873){_0x532306[_0xb246('0x1a')](0x194);}return _0x218873;};}function handleError(_0xa03836,_0xda7331){_0xda7331=_0xda7331||0x1f4;return function(_0x42cb07){logger[_0xb246('0x27')](_0x42cb07[_0xb246('0x28')]);if(_0x42cb07['name']){delete _0x42cb07[_0xb246('0x29')];}_0xa03836[_0xb246('0x1b')](_0xda7331)['send'](_0x42cb07);};}exports['index']=function(_0x199453,_0x5e9f75){var _0x510966={},_0x2512c3={},_0x19fb08={'count':0x0,'rows':[]};var _0x49efe7=_[_0xb246('0x2a')](db[_0xb246('0x2b')][_0xb246('0x2c')],function(_0x35724a){return{'name':_0x35724a[_0xb246('0x2d')],'type':_0x35724a[_0xb246('0x2e')][_0xb246('0x2f')]};});_0x2512c3[_0xb246('0x30')]=_[_0xb246('0x2a')](_0x49efe7,_0xb246('0x29'));_0x2512c3[_0xb246('0x31')]=_[_0xb246('0x32')](_0x199453[_0xb246('0x31')]);_0x2512c3[_0xb246('0x33')]=_[_0xb246('0x34')](_0x2512c3[_0xb246('0x30')],_0x2512c3[_0xb246('0x31')]);_0x510966['attributes']=_[_0xb246('0x34')](_0x2512c3[_0xb246('0x30')],qs[_0xb246('0x35')](_0x199453[_0xb246('0x31')][_0xb246('0x35')]));_0x510966[_0xb246('0x36')]=_0x510966['attributes'][_0xb246('0x37')]?_0x510966[_0xb246('0x36')]:_0x2512c3[_0xb246('0x30')];if(!_0x199453[_0xb246('0x31')]['hasOwnProperty'](_0xb246('0x38'))){_0x510966[_0xb246('0x21')]=qs['limit'](_0x199453[_0xb246('0x31')]['limit']);_0x510966[_0xb246('0x20')]=qs[_0xb246('0x20')](_0x199453[_0xb246('0x31')]['offset']);}_0x510966[_0xb246('0x39')]=qs['sort'](_0x199453['query'][_0xb246('0x3a')]);_0x510966[_0xb246('0x3b')]=qs[_0xb246('0x33')](_['pick'](_0x199453[_0xb246('0x31')],_0x2512c3[_0xb246('0x33')]),_0x49efe7);if(_0x199453['query'][_0xb246('0x3c')]){_0x510966['where']=_[_0xb246('0x3d')](_0x510966[_0xb246('0x3b')],{'$or':_['map'](_0x49efe7,function(_0x3f5b00){if(_0x3f5b00[_0xb246('0x2e')]!==_0xb246('0x3e')){var _0x360d00={};_0x360d00[_0x3f5b00[_0xb246('0x29')]]={'$like':'%'+_0x199453[_0xb246('0x31')]['filter']+'%'};return _0x360d00;}})});}_0x510966=_['merge']({},_0x510966,_0x199453[_0xb246('0x3f')]);var _0x2b1848={'where':_0x510966[_0xb246('0x3b')]};return db[_0xb246('0x2b')][_0xb246('0x1f')](_0x2b1848)[_0xb246('0x26')](function(_0x2ab12c){_0x19fb08[_0xb246('0x1f')]=_0x2ab12c;if(_0x199453[_0xb246('0x31')][_0xb246('0x40')]){_0x510966[_0xb246('0x41')]=[{'all':!![]}];}return db[_0xb246('0x2b')][_0xb246('0x42')](_0x510966);})[_0xb246('0x26')](function(_0x484bc2){_0x19fb08[_0xb246('0x43')]=_0x484bc2;return _0x19fb08;})['then'](respondWithFilteredResult(_0x5e9f75,_0x510966))[_0xb246('0x44')](handleError(_0x5e9f75,null));};exports[_0xb246('0x45')]=function(_0x45d633,_0x2db118){var _0x5b96d3={'raw':!![],'where':{'id':_0x45d633[_0xb246('0x46')]['id']}},_0x51be3e={};_0x51be3e[_0xb246('0x30')]=_[_0xb246('0x32')](db[_0xb246('0x2b')]['rawAttributes']);_0x51be3e[_0xb246('0x31')]=_[_0xb246('0x32')](_0x45d633['query']);_0x51be3e[_0xb246('0x33')]=_[_0xb246('0x34')](_0x51be3e[_0xb246('0x30')],_0x51be3e[_0xb246('0x31')]);_0x5b96d3[_0xb246('0x36')]=_[_0xb246('0x34')](_0x51be3e[_0xb246('0x30')],qs[_0xb246('0x35')](_0x45d633[_0xb246('0x31')]['fields']));_0x5b96d3['attributes']=_0x5b96d3[_0xb246('0x36')]['length']?_0x5b96d3[_0xb246('0x36')]:_0x51be3e[_0xb246('0x30')];if(_0x45d633[_0xb246('0x31')]['includeAll']){_0x5b96d3[_0xb246('0x41')]=[{'all':!![]}];}_0x5b96d3=_[_0xb246('0x3d')]({},_0x5b96d3,_0x45d633[_0xb246('0x3f')]);return db[_0xb246('0x2b')][_0xb246('0x47')](_0x5b96d3)[_0xb246('0x26')](handleEntityNotFound(_0x2db118,null))[_0xb246('0x26')](respondWithResult(_0x2db118,null))[_0xb246('0x44')](handleError(_0x2db118,null));};exports['create']=function(_0x4dcf1b,_0x3da474){return db[_0xb246('0x2b')][_0xb246('0x48')](_0x4dcf1b['body'],{})[_0xb246('0x26')](respondWithResult(_0x3da474,0xc9))[_0xb246('0x44')](handleError(_0x3da474,null));};exports['describe']=function(_0x1aa69,_0x26cdc3){return db[_0xb246('0x2b')][_0xb246('0x49')]()[_0xb246('0x26')](respondWithResult(_0x26cdc3,null))[_0xb246('0x44')](handleError(_0x26cdc3,null));};exports[_0xb246('0x25')]=function(_0x24658b,_0x36d54d){if(_0x24658b[_0xb246('0x4a')][_0xb246('0x4b')]){delete _0x24658b[_0xb246('0x4a')][_0xb246('0x4b')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x24658b[_0xb246('0x46')]['id']}})['then'](handleEntityNotFound(_0x36d54d,null))[_0xb246('0x26')](saveUpdates(_0x24658b[_0xb246('0x4a')],null))[_0xb246('0x26')](respondWithResult(_0x36d54d,null))['catch'](handleError(_0x36d54d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 265b04f..7b1b140 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 _0x2678=['../../config/logger','api','path','rimraf','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util'];(function(_0x529d8e,_0x2df8c6){var _0x316796=function(_0x57cefe){while(--_0x57cefe){_0x529d8e['push'](_0x529d8e['shift']());}};_0x316796(++_0x2df8c6);}(_0x2678,0x1bb));var _0x8267=function(_0x59fa1b,_0x13aabe){_0x59fa1b=_0x59fa1b-0x0;var _0xc21e4c=_0x2678[_0x59fa1b];return _0xc21e4c;};'use strict';var _=require('lodash');var util=require(_0x8267('0x0'));var logger=require(_0x8267('0x1'))(_0x8267('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8267('0x3'));var rimraf=require(_0x8267('0x4'));var config=require(_0x8267('0x5'));var attributes=require('./cmHopperHistory.attributes');module[_0x8267('0x6')]=function(_0x26b816,_0xc759e2){return _0x26b816[_0x8267('0x7')](_0x8267('0x8'),attributes,{'tableName':_0x8267('0x9'),'paranoid':![],'indexes':[{'name':_0x8267('0xa'),'fields':[_0x8267('0xa')]},{'name':'uniqueid','fields':[_0x8267('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8506=['endtime','uniqueid','util','api','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x501f32,_0xfc7d27){var _0xa6997f=function(_0x572798){while(--_0x572798){_0x501f32['push'](_0x501f32['shift']());}};_0xa6997f(++_0xfc7d27);}(_0x8506,0xe8));var _0x6850=function(_0x4633a4,_0x37bd2e){_0x4633a4=_0x4633a4-0x0;var _0xc75c=_0x8506[_0x4633a4];return _0xc75c;};'use strict';var _=require('lodash');var util=require(_0x6850('0x0'));var logger=require('../../config/logger')(_0x6850('0x1'));var moment=require('moment');var BPromise=require(_0x6850('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6850('0x3'));var rimraf=require(_0x6850('0x4'));var config=require(_0x6850('0x5'));var attributes=require('./cmHopperHistory.attributes');module[_0x6850('0x6')]=function(_0x372f0b,_0x232459){return _0x372f0b[_0x6850('0x7')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x6850('0x8')]},{'name':_0x6850('0x9'),'fields':[_0x6850('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index cce3039..e47e8d5 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 _0x34ab=['catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','predictiveIntervalDroppedCallsTimeout','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','AvgHandleTime','GetVoiceQueueHopperHistory','name','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','ivrTotalCallsDays','campaign','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result'];(function(_0x1678c8,_0x1c32f4){var _0x387aa9=function(_0x2803bd){while(--_0x2803bd){_0x1678c8['push'](_0x1678c8['shift']());}};_0x387aa9(++_0x1c32f4);}(_0x34ab,0x169));var _0xb34a=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0x34ab[_0xd22d95];return _0x15d7a3;};'use strict';var _=require(_0xb34a('0x0'));var util=require(_0xb34a('0x1'));var moment=require(_0xb34a('0x2'));var BPromise=require(_0xb34a('0x3'));var rs=require(_0xb34a('0x4'));var fs=require('fs');var Redis=require(_0xb34a('0x5'));var db=require(_0xb34a('0x6'))['db'];var utils=require(_0xb34a('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xb34a('0x8'));var jayson=require(_0xb34a('0x9'));var client=jayson[_0xb34a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b8d3e,_0x492c6d,_0x14c0d2){return new BPromise(function(_0xb915fb,_0x3afc6d){return client[_0xb34a('0xb')](_0x2b8d3e,_0x14c0d2)[_0xb34a('0xc')](function(_0x286281){logger[_0xb34a('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x492c6d,_0xb34a('0xe'));logger[_0xb34a('0xf')](_0xb34a('0x10'),_0x492c6d,'request\x20sent',JSON[_0xb34a('0x11')](_0x286281));if(_0x286281[_0xb34a('0x12')]){if(_0x286281[_0xb34a('0x12')][_0xb34a('0x13')]===0x1f4){logger[_0xb34a('0x12')](_0xb34a('0x14'),_0x492c6d,_0x286281['error']['message']);return _0x3afc6d(_0x286281['error']['message']);}logger[_0xb34a('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x492c6d,_0x286281['error'][_0xb34a('0x15')]);return _0xb915fb(_0x286281[_0xb34a('0x12')][_0xb34a('0x15')]);}else{logger['info'](_0xb34a('0x14'),_0x492c6d,_0xb34a('0xe'));_0xb915fb(_0x286281[_0xb34a('0x16')]['message']);}})[_0xb34a('0x17')](function(_0x4f4abe){logger[_0xb34a('0x12')](_0xb34a('0x14'),_0x492c6d,_0x4f4abe);_0x3afc6d(_0x4f4abe);});});}exports[_0xb34a('0x18')]=function(_0x1ede11){var _0x407255=this;return new Promise(function(_0x45e7da,_0x51ea5f){return db[_0xb34a('0x19')][_0xb34a('0x1a')](_0x1ede11[_0xb34a('0x1b')],{'raw':_0x1ede11[_0xb34a('0x1c')]?_0x1ede11['options'][_0xb34a('0x1d')]===undefined?!![]:![]:!![]})[_0xb34a('0xc')](function(_0x2d88e8){logger[_0xb34a('0xd')](_0xb34a('0x18'),_0x1ede11);logger[_0xb34a('0xf')](_0xb34a('0x18'),_0x1ede11,JSON[_0xb34a('0x11')](_0x2d88e8));_0x45e7da(_0x2d88e8);})[_0xb34a('0x17')](function(_0x5a9d7f){logger[_0xb34a('0x12')](_0xb34a('0x18'),_0x5a9d7f['message'],_0x1ede11);_0x51ea5f(_0x407255[_0xb34a('0x12')](0x1f4,_0x5a9d7f[_0xb34a('0x15')]));});});};exports['AvgHandleTime']=function(_0xadc5d5){var _0x41c197=this;return new Promise(function(_0x30c701,_0x455852){return db[_0xb34a('0x19')][_0xb34a('0x1e')]({'raw':_0xadc5d5[_0xb34a('0x1c')]?_0xadc5d5[_0xb34a('0x1c')][_0xb34a('0x1d')]===undefined?!![]:![]:!![],'where':_0xadc5d5[_0xb34a('0x1c')]?_0xadc5d5[_0xb34a('0x1c')][_0xb34a('0x1f')]||null:null,'attributes':[[db[_0xb34a('0x20')]['fn']('COUNT',db['sequelize'][_0xb34a('0x21')]('id')),_0xb34a('0x22')],[db[_0xb34a('0x20')]['fn'](_0xb34a('0x23'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xb34a('0x24')))),_0xb34a('0x25')],[db[_0xb34a('0x20')]['fn'](_0xb34a('0x23'),db[_0xb34a('0x20')]['fn']('IF',db[_0xb34a('0x20')][_0xb34a('0x26')]('`state`\x20=\x2010,\x201,\x20null'))),_0xb34a('0x27')],[db[_0xb34a('0x20')]['fn'](_0xb34a('0x23'),db[_0xb34a('0x20')]['fn']('IF',db[_0xb34a('0x20')][_0xb34a('0x26')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0xb34a('0x28'),db['sequelize']['fn']('IF',db[_0xb34a('0x20')][_0xb34a('0x26')](_0xb34a('0x29')))),'predictiveIntervalAvgHoldtime'],[db[_0xb34a('0x20')]['fn'](_0xb34a('0x28'),db[_0xb34a('0x20')]['fn']('IF',db[_0xb34a('0x20')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0xb34a('0xc')](function(_0x19f0ea){logger[_0xb34a('0xd')]('AvgHandleTime',_0xadc5d5);logger[_0xb34a('0xf')](_0xb34a('0x2a'),_0xadc5d5,JSON[_0xb34a('0x11')](_0x19f0ea));_0x30c701(_0x19f0ea);})[_0xb34a('0x17')](function(_0x4f7fdc){logger[_0xb34a('0x12')](_0xb34a('0x2a'),_0x4f7fdc[_0xb34a('0x15')],_0xadc5d5);_0x455852(_0x41c197[_0xb34a('0x12')](0x1f4,_0x4f7fdc[_0xb34a('0x15')]));});});};exports[_0xb34a('0x2b')]=function(_0x55e99b){var _0x231fc=this;return new Promise(function(_0x514c0c,_0x345352){return db[_0xb34a('0x19')]['findAll']({'raw':_0x55e99b['options']?_0x55e99b[_0xb34a('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x55e99b[_0xb34a('0x1c')]?_0x55e99b[_0xb34a('0x1c')][_0xb34a('0x1f')]||null:null,'attributes':[['campaign',_0xb34a('0x2c')],[db['sequelize']['fn'](_0xb34a('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0xb34a('0x26')]('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xb34a('0x20')]['fn']('IF',db[_0xb34a('0x20')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xb34a('0x2d')],[db[_0xb34a('0x20')]['fn']('COUNT',db[_0xb34a('0x20')]['fn']('IF',db[_0xb34a('0x20')][_0xb34a('0x26')](_0xb34a('0x24')))),_0xb34a('0x2e')],[db[_0xb34a('0x20')]['fn'](_0xb34a('0x23'),db[_0xb34a('0x20')]['fn']('IF',db['sequelize'][_0xb34a('0x26')]('`state`\x20=\x205,\x201,\x20null'))),_0xb34a('0x2f')],[db[_0xb34a('0x20')]['fn'](_0xb34a('0x23'),db['sequelize']['fn']('IF',db[_0xb34a('0x20')][_0xb34a('0x26')]('`state`\x20=\x208,\x201,\x20null'))),_0xb34a('0x30')],[db['sequelize']['fn'](_0xb34a('0x23'),db[_0xb34a('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb34a('0x31')],[db[_0xb34a('0x20')]['fn'](_0xb34a('0x23'),db[_0xb34a('0x20')]['fn']('IF',db[_0xb34a('0x20')][_0xb34a('0x26')](_0xb34a('0x32')))),_0xb34a('0x33')],[db[_0xb34a('0x20')]['fn'](_0xb34a('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0xb34a('0x26')]('`state`\x20=\x2012,\x201,\x20null'))),_0xb34a('0x34')],[db[_0xb34a('0x20')]['fn']('COUNT',db[_0xb34a('0x20')]['fn']('IF',db[_0xb34a('0x20')][_0xb34a('0x26')](_0xb34a('0x35')))),_0xb34a('0x36')],[db[_0xb34a('0x20')]['fn'](_0xb34a('0x23'),db[_0xb34a('0x20')]['fn']('IF',db['sequelize'][_0xb34a('0x26')](_0xb34a('0x37')))),_0xb34a('0x38')],[db[_0xb34a('0x20')]['fn'](_0xb34a('0x23'),db[_0xb34a('0x20')]['fn']('IF',db['sequelize']['literal'](_0xb34a('0x39')))),'outboundRejectCallsDay'],[db[_0xb34a('0x20')]['fn'](_0xb34a('0x23'),db[_0xb34a('0x20')]['fn']('IF',db[_0xb34a('0x20')][_0xb34a('0x26')](_0xb34a('0x3a')))),_0xb34a('0x3b')],[db[_0xb34a('0x20')]['fn'](_0xb34a('0x23'),db[_0xb34a('0x20')]['fn']('IF',db[_0xb34a('0x20')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0xb34a('0x3c')],[db['sequelize']['fn'](_0xb34a('0x23'),db[_0xb34a('0x20')]['fn']('IF',db[_0xb34a('0x20')][_0xb34a('0x26')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':['campaign']})['then'](function(_0xb52644){logger[_0xb34a('0xd')](_0xb34a('0x2b'),_0x55e99b);logger[_0xb34a('0xf')](_0xb34a('0x2b'),_0x55e99b,JSON[_0xb34a('0x11')](_0xb52644));_0x514c0c(_0xb52644);})[_0xb34a('0x17')](function(_0x51f546){logger[_0xb34a('0x12')](_0xb34a('0x2b'),_0x51f546[_0xb34a('0x15')],_0x55e99b);_0x345352(_0x231fc[_0xb34a('0x12')](0x1f4,_0x51f546[_0xb34a('0x15')]));});});};exports['GetCampaignHopperHistory']=function(_0x4eec0a){var _0xbe42d7=this;return new Promise(function(_0x215cdf,_0x356b46){return db['CmHopperHistory'][_0xb34a('0x1e')]({'raw':_0x4eec0a[_0xb34a('0x1c')]?_0x4eec0a[_0xb34a('0x1c')][_0xb34a('0x1d')]===undefined?!![]:![]:!![],'where':_0x4eec0a[_0xb34a('0x1c')]?_0x4eec0a['options']['where']||null:null,'attributes':[['campaign',_0xb34a('0x2c')],[db[_0xb34a('0x20')]['fn']('COUNT',db[_0xb34a('0x20')][_0xb34a('0x21')]('id')),_0xb34a('0x3d')],[db[_0xb34a('0x20')]['fn'](_0xb34a('0x23'),db[_0xb34a('0x20')]['fn']('IF',db[_0xb34a('0x20')][_0xb34a('0x26')](_0xb34a('0x24')))),'ivrAnswerCallsDay']],'group':[_0xb34a('0x3e')]})['then'](function(_0x25cbf7){logger[_0xb34a('0xd')](_0xb34a('0x3f'),_0x4eec0a);logger[_0xb34a('0xf')](_0xb34a('0x3f'),_0x4eec0a,JSON['stringify'](_0x25cbf7));_0x215cdf(_0x25cbf7);})[_0xb34a('0x17')](function(_0x3ed7b3){logger[_0xb34a('0x12')](_0xb34a('0x3f'),_0x3ed7b3[_0xb34a('0x15')],_0x4eec0a);_0x356b46(_0xbe42d7[_0xb34a('0x12')](0x1f4,_0x3ed7b3['message']));});});}; \ No newline at end of file +var _0xd8ea=['literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','stringify','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','CmHopperHistory','body','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','sequelize','col','predictiveIntervalTotalCalls'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0xd8ea,0x1bd));var _0xad8e=function(_0xdb6fe8,_0x2ef81e){_0xdb6fe8=_0xdb6fe8-0x0;var _0x3d235d=_0xd8ea[_0xdb6fe8];return _0x3d235d;};'use strict';var _=require(_0xad8e('0x0'));var util=require(_0xad8e('0x1'));var moment=require(_0xad8e('0x2'));var BPromise=require(_0xad8e('0x3'));var rs=require(_0xad8e('0x4'));var fs=require('fs');var Redis=require(_0xad8e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xad8e('0x6'));var logger=require(_0xad8e('0x7'))(_0xad8e('0x8'));var config=require('../../config/environment');var jayson=require(_0xad8e('0x9'));var client=jayson[_0xad8e('0xa')][_0xad8e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27bbcb,_0x5141d5,_0x5313f4){return new BPromise(function(_0x396cc6,_0x47627c){return client[_0xad8e('0xc')](_0x27bbcb,_0x5313f4)[_0xad8e('0xd')](function(_0xbef199){logger[_0xad8e('0xe')](_0xad8e('0xf'),_0x5141d5,_0xad8e('0x10'));logger[_0xad8e('0x11')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x5141d5,_0xad8e('0x10'),JSON['stringify'](_0xbef199));if(_0xbef199[_0xad8e('0x12')]){if(_0xbef199[_0xad8e('0x12')]['code']===0x1f4){logger[_0xad8e('0x12')](_0xad8e('0xf'),_0x5141d5,_0xbef199[_0xad8e('0x12')]['message']);return _0x47627c(_0xbef199[_0xad8e('0x12')][_0xad8e('0x13')]);}logger[_0xad8e('0x12')](_0xad8e('0xf'),_0x5141d5,_0xbef199[_0xad8e('0x12')][_0xad8e('0x13')]);return _0x396cc6(_0xbef199[_0xad8e('0x12')][_0xad8e('0x13')]);}else{logger[_0xad8e('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x5141d5,_0xad8e('0x10'));_0x396cc6(_0xbef199['result'][_0xad8e('0x13')]);}})[_0xad8e('0x14')](function(_0x14eb38){logger[_0xad8e('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x5141d5,_0x14eb38);_0x47627c(_0x14eb38);});});}exports['CreateCmHopperHistory']=function(_0x4e7e83){var _0x6f2b1d=this;return new Promise(function(_0x549aa3,_0xba837b){return db[_0xad8e('0x15')]['create'](_0x4e7e83[_0xad8e('0x16')],{'raw':_0x4e7e83[_0xad8e('0x17')]?_0x4e7e83[_0xad8e('0x17')][_0xad8e('0x18')]===undefined?!![]:![]:!![]})[_0xad8e('0xd')](function(_0x4b3a6a){logger[_0xad8e('0xe')](_0xad8e('0x19'),_0x4e7e83);logger[_0xad8e('0x11')](_0xad8e('0x19'),_0x4e7e83,JSON['stringify'](_0x4b3a6a));_0x549aa3(_0x4b3a6a);})[_0xad8e('0x14')](function(_0x34a269){logger[_0xad8e('0x12')](_0xad8e('0x19'),_0x34a269[_0xad8e('0x13')],_0x4e7e83);_0xba837b(_0x6f2b1d[_0xad8e('0x12')](0x1f4,_0x34a269[_0xad8e('0x13')]));});});};exports[_0xad8e('0x1a')]=function(_0x39372e){var _0x22dd2a=this;return new Promise(function(_0x30aa07,_0x556ed7){return db[_0xad8e('0x15')][_0xad8e('0x1b')]({'raw':_0x39372e['options']?_0x39372e[_0xad8e('0x17')][_0xad8e('0x18')]===undefined?!![]:![]:!![],'where':_0x39372e[_0xad8e('0x17')]?_0x39372e['options']['where']||null:null,'attributes':[[db[_0xad8e('0x1c')]['fn']('COUNT',db[_0xad8e('0x1c')][_0xad8e('0x1d')]('id')),_0xad8e('0x1e')],[db[_0xad8e('0x1c')]['fn']('COUNT',db[_0xad8e('0x1c')]['fn']('IF',db['sequelize'][_0xad8e('0x1f')](_0xad8e('0x20')))),_0xad8e('0x21')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0xad8e('0x23')],[db[_0xad8e('0x1c')]['fn']('COUNT',db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x24')))),_0xad8e('0x25')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x26'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xad8e('0x27')))),_0xad8e('0x28')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x26'),db['sequelize']['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x29')))),_0xad8e('0x2a')]]})['then'](function(_0x2951a8){logger[_0xad8e('0xe')](_0xad8e('0x1a'),_0x39372e);logger['debug']('AvgHandleTime',_0x39372e,JSON[_0xad8e('0x2b')](_0x2951a8));_0x30aa07(_0x2951a8);})[_0xad8e('0x14')](function(_0x4be6d0){logger[_0xad8e('0x12')](_0xad8e('0x1a'),_0x4be6d0['message'],_0x39372e);_0x556ed7(_0x22dd2a['error'](0x1f4,_0x4be6d0['message']));});});};exports[_0xad8e('0x2c')]=function(_0x5c92c7){var _0x3ab613=this;return new Promise(function(_0x18462d,_0x1afbd5){return db['CmHopperHistory'][_0xad8e('0x1b')]({'raw':_0x5c92c7[_0xad8e('0x17')]?_0x5c92c7[_0xad8e('0x17')][_0xad8e('0x18')]===undefined?!![]:![]:!![],'where':_0x5c92c7[_0xad8e('0x17')]?_0x5c92c7[_0xad8e('0x17')]['where']||null:null,'attributes':[[_0xad8e('0x2d'),_0xad8e('0x2e')],[db['sequelize']['fn'](_0xad8e('0x22'),db['sequelize']['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')]('`state`\x20=\x200,\x201,\x20null'))),_0xad8e('0x2f')],[db['sequelize']['fn']('COUNT',db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x30')))),_0xad8e('0x31')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db['sequelize'][_0xad8e('0x1f')](_0xad8e('0x20')))),_0xad8e('0x32')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x33')))),_0xad8e('0x34')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xad8e('0x35')))),'outboundCongestionCallsDay'],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0xad8e('0x1f')](_0xad8e('0x36')))),_0xad8e('0x37')],[db['sequelize']['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x38')))),_0xad8e('0x39')],[db[_0xad8e('0x1c')]['fn']('COUNT',db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x3a')))),'outboundUnknownCallsDay'],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x3b')))),_0xad8e('0x3c')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db['sequelize']['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x3d')))),'outboundOriginateFailureCallsDay'],[db[_0xad8e('0x1c')]['fn']('COUNT',db[_0xad8e('0x1c')]['fn']('IF',db['sequelize'][_0xad8e('0x1f')](_0xad8e('0x3e')))),_0xad8e('0x3f')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0xad8e('0x1c')]['fn']('COUNT',db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x40')))),_0xad8e('0x41')]],'group':[_0xad8e('0x2d')]})['then'](function(_0x5158d0){logger[_0xad8e('0xe')](_0xad8e('0x2c'),_0x5c92c7);logger[_0xad8e('0x11')](_0xad8e('0x2c'),_0x5c92c7,JSON[_0xad8e('0x2b')](_0x5158d0));_0x18462d(_0x5158d0);})[_0xad8e('0x14')](function(_0x22f2b6){logger[_0xad8e('0x12')](_0xad8e('0x2c'),_0x22f2b6[_0xad8e('0x13')],_0x5c92c7);_0x1afbd5(_0x3ab613[_0xad8e('0x12')](0x1f4,_0x22f2b6[_0xad8e('0x13')]));});});};exports[_0xad8e('0x42')]=function(_0x44a4b8){var _0x4e48b1=this;return new Promise(function(_0x406e74,_0x2f561d){return db[_0xad8e('0x15')][_0xad8e('0x1b')]({'raw':_0x44a4b8[_0xad8e('0x17')]?_0x44a4b8[_0xad8e('0x17')][_0xad8e('0x18')]===undefined?!![]:![]:!![],'where':_0x44a4b8['options']?_0x44a4b8['options']['where']||null:null,'attributes':[[_0xad8e('0x2d'),_0xad8e('0x2e')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['col']('id')),_0xad8e('0x43')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')]['literal'](_0xad8e('0x20')))),'ivrAnswerCallsDay']],'group':[_0xad8e('0x2d')]})[_0xad8e('0xd')](function(_0x4a8927){logger['info'](_0xad8e('0x42'),_0x44a4b8);logger[_0xad8e('0x11')](_0xad8e('0x42'),_0x44a4b8,JSON['stringify'](_0x4a8927));_0x406e74(_0x4a8927);})[_0xad8e('0x14')](function(_0x485f37){logger[_0xad8e('0x12')](_0xad8e('0x42'),_0x485f37['message'],_0x44a4b8);_0x2f561d(_0x4e48b1['error'](0x1f4,_0x485f37[_0xad8e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index ae0ca3d..0a59394 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 _0x6882=['get','index','/describe','isAuthenticated','/:id','show','post','create','put','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x519f39,_0x3ebac5){var _0x520ea0=function(_0x338ef){while(--_0x338ef){_0x519f39['push'](_0x519f39['shift']());}};_0x520ea0(++_0x3ebac5);}(_0x6882,0x8a));var _0x2688=function(_0x5b389,_0x4a0550){_0x5b389=_0x5b389-0x0;var _0x3f5f4e=_0x6882[_0x5b389];return _0x3f5f4e;};'use strict';var multer=require('multer');var util=require(_0x2688('0x0'));var path=require(_0x2688('0x1'));var timeout=require(_0x2688('0x2'));var express=require(_0x2688('0x3'));var router=express[_0x2688('0x4')]();var fs_extra=require(_0x2688('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0x2688('0x6')]('/',auth['isAuthenticated'](),controller[_0x2688('0x7')]);router[_0x2688('0x6')](_0x2688('0x8'),auth[_0x2688('0x9')](),controller['describe']);router[_0x2688('0x6')](_0x2688('0xa'),auth[_0x2688('0x9')](),controller[_0x2688('0xb')]);router[_0x2688('0xc')]('/',auth[_0x2688('0x9')](),controller[_0x2688('0xd')]);router[_0x2688('0xe')](_0x2688('0xa'),auth['isAuthenticated'](),controller['update']);module[_0x2688('0xf')]=router; \ No newline at end of file +var _0x6ac0=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','exports'];(function(_0x180b9f,_0x406736){var _0x25c59c=function(_0x41f54f){while(--_0x41f54f){_0x180b9f['push'](_0x180b9f['shift']());}};_0x25c59c(++_0x406736);}(_0x6ac0,0x72));var _0x06ac=function(_0x311a6b,_0x118f28){_0x311a6b=_0x311a6b-0x0;var _0x1377d0=_0x6ac0[_0x311a6b];return _0x1377d0;};'use strict';var multer=require(_0x06ac('0x0'));var util=require(_0x06ac('0x1'));var path=require('path');var timeout=require(_0x06ac('0x2'));var express=require(_0x06ac('0x3'));var router=express['Router']();var fs_extra=require(_0x06ac('0x4'));var auth=require(_0x06ac('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x06ac('0x6'));var controller=require(_0x06ac('0x7'));router[_0x06ac('0x8')]('/',auth[_0x06ac('0x9')](),controller['index']);router[_0x06ac('0x8')](_0x06ac('0xa'),auth[_0x06ac('0x9')](),controller[_0x06ac('0xb')]);router[_0x06ac('0x8')](_0x06ac('0xc'),auth['isAuthenticated'](),controller[_0x06ac('0xd')]);router[_0x06ac('0xe')]('/',auth[_0x06ac('0x9')](),controller[_0x06ac('0xf')]);router[_0x06ac('0x10')](_0x06ac('0xc'),auth[_0x06ac('0x9')](),controller[_0x06ac('0x11')]);module[_0x06ac('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 76fb5b4..e9102df 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 _0x6631=['sequelize','exports','STRING','name'];(function(_0x22dbbf,_0xec067a){var _0x5174fb=function(_0x2dc3be){while(--_0x2dc3be){_0x22dbbf['push'](_0x22dbbf['shift']());}};_0x5174fb(++_0xec067a);}(_0x6631,0x134));var _0x1663=function(_0x49f495,_0x31fb07){_0x49f495=_0x49f495-0x0;var _0x15a537=_0x6631[_0x49f495];return _0x15a537;};'use strict';var Sequelize=require(_0x1663('0x0'));module[_0x1663('0x1')]={'name':{'type':Sequelize[_0x1663('0x2')],'unique':_0x1663('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1663('0x2')]},'dialPrefix':{'type':Sequelize[_0x1663('0x2')]}}; \ No newline at end of file +var _0x9c5a=['exports','name','STRING','sequelize'];(function(_0x2377a3,_0x7b4522){var _0x538284=function(_0x8c6a36){while(--_0x8c6a36){_0x2377a3['push'](_0x2377a3['shift']());}};_0x538284(++_0x7b4522);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x446727,_0x51f459){_0x446727=_0x446727-0x0;var _0xb770f9=_0x9c5a[_0x446727];return _0xb770f9;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa9c5('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa9c5('0x3')]},'dialPrefix':{'type':Sequelize[_0xa9c5('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 30736bb..df64ad8 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 _0xe0d5=['index','map','CmList','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','ListId','Disposition','findOne','length','rows','removeDispositions','addContacts','CmContact','tags','isArray','join','push','each','omit','ids','success','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','cf_%d','order','raw','getContactsCsv','getContacts','now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','end','json','offset','undefined','limit','count','status','set','apply','update','then','get','Lists','UserProfileResource','destroy','sendStatus','error','name','send'];(function(_0x31a9d7,_0x5dc83f){var _0x11787d=function(_0xb16879){while(--_0xb16879){_0x31a9d7['push'](_0x31a9d7['shift']());}};_0x11787d(++_0x5dc83f);}(_0xe0d5,0xf9));var _0x5e0d=function(_0x186fe2,_0x5d525c){_0x186fe2=_0x186fe2-0x0;var _0x581dac=_0xe0d5[_0x186fe2];return _0x581dac;};'use strict';var emlformat=require(_0x5e0d('0x0'));var rimraf=require(_0x5e0d('0x1'));var zipdir=require(_0x5e0d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e0d('0x3'));var moment=require(_0x5e0d('0x4'));var BPromise=require(_0x5e0d('0x5'));var Mustache=require(_0x5e0d('0x6'));var util=require('util');var path=require(_0x5e0d('0x7'));var sox=require(_0x5e0d('0x8'));var csv=require('to-csv');var ejs=require(_0x5e0d('0x9'));var fs=require('fs');var fs_extra=require(_0x5e0d('0xa'));var _=require(_0x5e0d('0xb'));var squel=require(_0x5e0d('0xc'));var crypto=require(_0x5e0d('0xd'));var jsforce=require(_0x5e0d('0xe'));var deskjs=require(_0x5e0d('0xf'));var toCsv=require(_0x5e0d('0x10'));var querystring=require(_0x5e0d('0x11'));var Papa=require(_0x5e0d('0x12'));var Redis=require(_0x5e0d('0x13'));var authService=require(_0x5e0d('0x14'));var qs=require(_0x5e0d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e0d('0x16'));var logger=require(_0x5e0d('0x17'))('api');var utils=require(_0x5e0d('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5e0d('0x19'))['db'];config[_0x5e0d('0x1a')]=_[_0x5e0d('0x1b')](config[_0x5e0d('0x1a')],{'host':_0x5e0d('0x1c'),'port':0x18eb});var socket=require(_0x5e0d('0x1d'))(new Redis(config[_0x5e0d('0x1a')]));require(_0x5e0d('0x1e'))[_0x5e0d('0x1f')](socket);function respondWithStatusCode(_0x51af63,_0x3c9565){_0x3c9565=_0x3c9565||0xcc;return function(_0x4125f4){if(_0x4125f4){return _0x51af63['sendStatus'](_0x3c9565);}return _0x51af63['status'](_0x3c9565)[_0x5e0d('0x20')]();};}function respondWithResult(_0x401586,_0x510234){_0x510234=_0x510234||0xc8;return function(_0x4cd9e7){if(_0x4cd9e7){return _0x401586['status'](_0x510234)[_0x5e0d('0x21')](_0x4cd9e7);}};}function respondWithFilteredResult(_0x2c80cb,_0x5266c8){return function(_0x4b7650){if(_0x4b7650){var _0x3483fd=typeof _0x5266c8[_0x5e0d('0x22')]===_0x5e0d('0x23')&&typeof _0x5266c8[_0x5e0d('0x24')]==='undefined';var _0xdea5c2=_0x4b7650[_0x5e0d('0x25')];var _0x137f11=_0x3483fd?0x0:_0x5266c8[_0x5e0d('0x22')];var _0x4b1442=_0x3483fd?_0x4b7650[_0x5e0d('0x25')]:_0x5266c8[_0x5e0d('0x22')]+_0x5266c8['limit'];var _0x2570e5;if(_0x4b1442>=_0xdea5c2){_0x4b1442=_0xdea5c2;_0x2570e5=0xc8;}else{_0x2570e5=0xce;}_0x2c80cb[_0x5e0d('0x26')](_0x2570e5);return _0x2c80cb[_0x5e0d('0x27')]('Content-Range',_0x137f11+'-'+_0x4b1442+'/'+_0xdea5c2)[_0x5e0d('0x21')](_0x4b7650);}return null;};}function patchUpdates(_0xd29595){return function(_0x3ceed1){try{jsonpatch[_0x5e0d('0x28')](_0x3ceed1,_0xd29595,!![]);}catch(_0x41c9c0){return BPromise['reject'](_0x41c9c0);}return _0x3ceed1['save']();};}function saveUpdates(_0x1263e6,_0x245d79){return function(_0xa0eeea){if(_0xa0eeea){return _0xa0eeea[_0x5e0d('0x29')](_0x1263e6)[_0x5e0d('0x2a')](function(_0x491eae){return _0x491eae;});}return null;};}function removeEntity(_0x4952a3,_0x43c872){return function(_0x572890){if(_0x572890){return _0x572890['destroy']()[_0x5e0d('0x2a')](function(){var _0x1c4a26=_0x572890[_0x5e0d('0x2b')]({'plain':!![]});var _0x3ecc05=_0x5e0d('0x2c');return db[_0x5e0d('0x2d')][_0x5e0d('0x2e')]({'where':{'type':_0x3ecc05,'resourceId':_0x1c4a26['id']}})[_0x5e0d('0x2a')](function(){return _0x572890;});})[_0x5e0d('0x2a')](function(){_0x4952a3[_0x5e0d('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x677077,_0xdfc62a){return function(_0x2c3eeb){if(!_0x2c3eeb){_0x677077[_0x5e0d('0x2f')](0x194);}return _0x2c3eeb;};}function handleError(_0x3c9813,_0x478f6a){_0x478f6a=_0x478f6a||0x1f4;return function(_0x1ee1f7){logger[_0x5e0d('0x30')](_0x1ee1f7['stack']);if(_0x1ee1f7[_0x5e0d('0x31')]){delete _0x1ee1f7['name'];}_0x3c9813['status'](_0x478f6a)[_0x5e0d('0x32')](_0x1ee1f7);};}exports[_0x5e0d('0x33')]=function(_0x116bc6,_0x4c37b9){var _0x2ba3e1={},_0x38f6e7={},_0x78d5e={'count':0x0,'rows':[]};var _0x515161=_[_0x5e0d('0x34')](db[_0x5e0d('0x35')][_0x5e0d('0x36')],function(_0x466a14){return{'name':_0x466a14[_0x5e0d('0x37')],'type':_0x466a14['type'][_0x5e0d('0x38')]};});_0x38f6e7['model']=_[_0x5e0d('0x34')](_0x515161,'name');_0x38f6e7[_0x5e0d('0x39')]=_[_0x5e0d('0x3a')](_0x116bc6[_0x5e0d('0x39')]);_0x38f6e7[_0x5e0d('0x3b')]=_[_0x5e0d('0x3c')](_0x38f6e7[_0x5e0d('0x3d')],_0x38f6e7[_0x5e0d('0x39')]);_0x2ba3e1[_0x5e0d('0x3e')]=_[_0x5e0d('0x3c')](_0x38f6e7[_0x5e0d('0x3d')],qs[_0x5e0d('0x3f')](_0x116bc6[_0x5e0d('0x39')][_0x5e0d('0x3f')]));_0x2ba3e1[_0x5e0d('0x3e')]=_0x2ba3e1[_0x5e0d('0x3e')]['length']?_0x2ba3e1['attributes']:_0x38f6e7['model'];if(!_0x116bc6['query'][_0x5e0d('0x40')](_0x5e0d('0x41'))){_0x2ba3e1['limit']=qs[_0x5e0d('0x24')](_0x116bc6['query'][_0x5e0d('0x24')]);_0x2ba3e1[_0x5e0d('0x22')]=qs['offset'](_0x116bc6[_0x5e0d('0x39')][_0x5e0d('0x22')]);}_0x2ba3e1['order']=qs[_0x5e0d('0x42')](_0x116bc6[_0x5e0d('0x39')][_0x5e0d('0x42')]);_0x2ba3e1['where']=qs[_0x5e0d('0x3b')](_[_0x5e0d('0x43')](_0x116bc6[_0x5e0d('0x39')],_0x38f6e7['filters']),_0x515161);if(_0x116bc6[_0x5e0d('0x39')][_0x5e0d('0x44')]){_0x2ba3e1[_0x5e0d('0x45')]=_['merge'](_0x2ba3e1[_0x5e0d('0x45')],{'$or':_[_0x5e0d('0x34')](_0x515161,function(_0x1b1ead){if(_0x1b1ead[_0x5e0d('0x46')]!==_0x5e0d('0x47')){var _0x21554c={};_0x21554c[_0x1b1ead[_0x5e0d('0x31')]]={'$like':'%'+_0x116bc6[_0x5e0d('0x39')][_0x5e0d('0x44')]+'%'};return _0x21554c;}})});}_0x2ba3e1=_[_0x5e0d('0x48')]({},_0x2ba3e1,_0x116bc6[_0x5e0d('0x49')]);var _0x2a0e95={'where':_0x2ba3e1[_0x5e0d('0x45')]};return db[_0x5e0d('0x35')]['count'](_0x2a0e95)[_0x5e0d('0x2a')](function(_0x3bdc44){_0x78d5e['count']=_0x3bdc44;if(_0x116bc6[_0x5e0d('0x39')][_0x5e0d('0x4a')]){_0x2ba3e1[_0x5e0d('0x4b')]=[{'all':!![]}];}return db[_0x5e0d('0x35')][_0x5e0d('0x4c')](_0x2ba3e1);})['then'](function(_0x1dd0d){_0x78d5e['rows']=_0x1dd0d;return _0x78d5e;})[_0x5e0d('0x2a')](respondWithFilteredResult(_0x4c37b9,_0x2ba3e1))[_0x5e0d('0x4d')](handleError(_0x4c37b9,null));};exports[_0x5e0d('0x4e')]=function(_0x3f64dd,_0x127419){var _0x562852={'raw':![],'where':{'id':_0x3f64dd['params']['id']}},_0x2550e3={};_0x2550e3[_0x5e0d('0x3d')]=_[_0x5e0d('0x3a')](db['CmList'][_0x5e0d('0x36')]);_0x2550e3[_0x5e0d('0x39')]=_[_0x5e0d('0x3a')](_0x3f64dd[_0x5e0d('0x39')]);_0x2550e3[_0x5e0d('0x3b')]=_[_0x5e0d('0x3c')](_0x2550e3[_0x5e0d('0x3d')],_0x2550e3[_0x5e0d('0x39')]);_0x562852[_0x5e0d('0x3e')]=_[_0x5e0d('0x3c')](_0x2550e3[_0x5e0d('0x3d')],qs[_0x5e0d('0x3f')](_0x3f64dd[_0x5e0d('0x39')][_0x5e0d('0x3f')]));_0x562852[_0x5e0d('0x3e')]=_0x562852['attributes']['length']?_0x562852['attributes']:_0x2550e3['model'];if(_0x3f64dd['query'][_0x5e0d('0x4a')]){_0x562852[_0x5e0d('0x4b')]=[{'all':!![]}];}_0x562852=_[_0x5e0d('0x48')]({},_0x562852,_0x3f64dd[_0x5e0d('0x49')]);return db[_0x5e0d('0x35')][_0x5e0d('0x4f')](_0x562852)[_0x5e0d('0x2a')](handleEntityNotFound(_0x127419,null))['then'](respondWithResult(_0x127419,null))[_0x5e0d('0x4d')](handleError(_0x127419,null));};exports[_0x5e0d('0x50')]=function(_0x15ef00,_0xc2ee81){return db[_0x5e0d('0x35')][_0x5e0d('0x50')](_0x15ef00['body'],{})['then'](function(_0x37a830){var _0x408d7f=_0x15ef00[_0x5e0d('0x51')][_0x5e0d('0x2b')]({'plain':!![]});if(!_0x408d7f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x408d7f[_0x5e0d('0x52')]===_0x5e0d('0x51')){var _0x298a8a=_0x37a830[_0x5e0d('0x2b')]({'plain':!![]});var _0x17c265=_0x5e0d('0x2c');return db[_0x5e0d('0x53')]['find']({'where':{'name':_0x17c265,'userProfileId':_0x408d7f['userProfileId']},'raw':!![]})['then'](function(_0x3219f2){if(_0x3219f2&&_0x3219f2[_0x5e0d('0x54')]===0x0){return db[_0x5e0d('0x2d')]['create']({'name':_0x298a8a['name'],'resourceId':_0x298a8a['id'],'type':_0x3219f2[_0x5e0d('0x31')],'sectionId':_0x3219f2['id']},{})[_0x5e0d('0x2a')](function(){return _0x37a830;});}else{return _0x37a830;}})[_0x5e0d('0x4d')](function(_0x1803e9){logger['error'](_0x5e0d('0x55'),_0x1803e9);throw _0x1803e9;});}return _0x37a830;})[_0x5e0d('0x2a')](respondWithResult(_0xc2ee81,0xc9))['catch'](handleError(_0xc2ee81,null));};exports[_0x5e0d('0x29')]=function(_0x4fbba2,_0x26105c){if(_0x4fbba2['body']['id']){delete _0x4fbba2[_0x5e0d('0x56')]['id'];}return db[_0x5e0d('0x35')][_0x5e0d('0x4f')]({'where':{'id':_0x4fbba2[_0x5e0d('0x57')]['id']}})[_0x5e0d('0x2a')](handleEntityNotFound(_0x26105c,null))[_0x5e0d('0x2a')](saveUpdates(_0x4fbba2['body'],null))[_0x5e0d('0x2a')](respondWithResult(_0x26105c,null))[_0x5e0d('0x4d')](handleError(_0x26105c,null));};exports[_0x5e0d('0x2e')]=function(_0x133ae6,_0x396f5f){return db[_0x5e0d('0x35')][_0x5e0d('0x4f')]({'where':{'id':_0x133ae6[_0x5e0d('0x57')]['id']}})['then'](handleEntityNotFound(_0x396f5f,null))[_0x5e0d('0x2a')](removeEntity(_0x396f5f,null))['catch'](handleError(_0x396f5f,null));};exports['describe']=function(_0x3ef705,_0x339c4e){return db[_0x5e0d('0x35')][_0x5e0d('0x58')]()[_0x5e0d('0x2a')](respondWithResult(_0x339c4e,null))[_0x5e0d('0x4d')](handleError(_0x339c4e,null));};exports['addDisposition']=function(_0x93fe,_0x372a83,_0x15d13d){if(_0x93fe[_0x5e0d('0x56')]['id']){delete _0x93fe['body']['id'];}return db['CmList'][_0x5e0d('0x4f')]({'where':{'id':_0x93fe[_0x5e0d('0x57')]['id']}})[_0x5e0d('0x2a')](handleEntityNotFound(_0x372a83,null))[_0x5e0d('0x2a')](function(_0x31a645){if(_0x31a645){_0x93fe['body'][_0x5e0d('0x59')]=_0x31a645['id'];return db[_0x5e0d('0x5a')]['create'](_0x93fe[_0x5e0d('0x56')]);}})[_0x5e0d('0x2a')](respondWithResult(_0x372a83,null))[_0x5e0d('0x4d')](handleError(_0x372a83,null));};exports['getDispositions']=function(_0x285ca0,_0x2c3c8d,_0x16fe72){var _0x163b71={'raw':![],'where':{}};var _0x465186={};var _0x55ab6e={'count':0x0,'rows':[]};return db[_0x5e0d('0x35')][_0x5e0d('0x5b')]({'where':{'id':_0x285ca0[_0x5e0d('0x57')]['id']}})[_0x5e0d('0x2a')](handleEntityNotFound(_0x2c3c8d,null))[_0x5e0d('0x2a')](function(_0x308124){if(_0x308124){_0x465186[_0x5e0d('0x3d')]=_[_0x5e0d('0x3a')](db[_0x5e0d('0x5a')][_0x5e0d('0x36')]);_0x465186[_0x5e0d('0x39')]=_[_0x5e0d('0x3a')](_0x285ca0[_0x5e0d('0x39')]);_0x465186['filters']=_[_0x5e0d('0x3c')](_0x465186[_0x5e0d('0x3d')],_0x465186['query']);_0x163b71['attributes']=_[_0x5e0d('0x3c')](_0x465186[_0x5e0d('0x3d')],qs[_0x5e0d('0x3f')](_0x285ca0['query'][_0x5e0d('0x3f')]));_0x163b71[_0x5e0d('0x3e')]=_0x163b71[_0x5e0d('0x3e')][_0x5e0d('0x5c')]?_0x163b71[_0x5e0d('0x3e')]:_0x465186[_0x5e0d('0x3d')];if(!_0x285ca0[_0x5e0d('0x39')][_0x5e0d('0x40')]('nolimit')){_0x163b71[_0x5e0d('0x24')]=qs[_0x5e0d('0x24')](_0x285ca0[_0x5e0d('0x39')][_0x5e0d('0x24')]);_0x163b71['offset']=qs[_0x5e0d('0x22')](_0x285ca0[_0x5e0d('0x39')][_0x5e0d('0x22')]);}_0x163b71['order']=qs[_0x5e0d('0x42')](_0x285ca0[_0x5e0d('0x39')][_0x5e0d('0x42')]);_0x163b71['where']=qs[_0x5e0d('0x3b')](_[_0x5e0d('0x43')](_0x285ca0[_0x5e0d('0x39')],_0x465186[_0x5e0d('0x3b')]));_0x163b71[_0x5e0d('0x45')]['ListId']=_0x308124['id'];if(_0x285ca0[_0x5e0d('0x39')][_0x5e0d('0x44')]){_0x163b71[_0x5e0d('0x45')]=_['merge'](_0x163b71[_0x5e0d('0x45')],{'$or':_[_0x5e0d('0x34')](_0x163b71[_0x5e0d('0x3e')],function(_0x3d3e12){var _0x3234ae={};_0x3234ae[_0x3d3e12]={'$like':'%'+_0x285ca0[_0x5e0d('0x39')][_0x5e0d('0x44')]+'%'};return _0x3234ae;})});}_0x163b71=_['merge']({},_0x163b71,_0x285ca0[_0x5e0d('0x49')]);return db['Disposition'][_0x5e0d('0x25')]({'where':_0x163b71[_0x5e0d('0x45')]})[_0x5e0d('0x2a')](function(_0x11dfdd){_0x55ab6e[_0x5e0d('0x25')]=_0x11dfdd;if(_0x285ca0['query'][_0x5e0d('0x4a')]){_0x163b71[_0x5e0d('0x4b')]=[{'all':!![]}];}return db[_0x5e0d('0x5a')][_0x5e0d('0x4c')](_0x163b71);})[_0x5e0d('0x2a')](function(_0x5c609){_0x55ab6e[_0x5e0d('0x5d')]=_0x5c609;return _0x55ab6e;});}})[_0x5e0d('0x2a')](respondWithFilteredResult(_0x2c3c8d,_0x163b71))[_0x5e0d('0x4d')](handleError(_0x2c3c8d,null));};exports[_0x5e0d('0x5e')]=function(_0x46d54d,_0x24f513,_0x4f65e7){return db[_0x5e0d('0x35')][_0x5e0d('0x4f')]({'where':{'id':_0x46d54d[_0x5e0d('0x57')]['id']}})[_0x5e0d('0x2a')](handleEntityNotFound(_0x24f513,null))[_0x5e0d('0x2a')](function(_0x2307cb){if(_0x2307cb){return _0x2307cb[_0x5e0d('0x5e')](_0x46d54d[_0x5e0d('0x39')]['ids']);}})[_0x5e0d('0x2a')](respondWithStatusCode(_0x24f513,null))['catch'](handleError(_0x24f513,null));};exports[_0x5e0d('0x5f')]=function(_0x1facf2,_0x18410f,_0x10d18a){return db['CmList'][_0x5e0d('0x4f')]({'where':{'id':_0x1facf2[_0x5e0d('0x57')]['id']}})[_0x5e0d('0x2a')](handleEntityNotFound(_0x18410f,null))[_0x5e0d('0x2a')](function(_0x189498){if(_0x189498){var _0x91db07=[];var _0x47fe55={'success':[],'errors':[]};return db[_0x5e0d('0x60')][_0x5e0d('0x58')]()[_0x5e0d('0x2a')](function(_0x4d8e32){if(_0x1facf2[_0x5e0d('0x56')][_0x5e0d('0x61')]&&_[_0x5e0d('0x62')](_0x1facf2['body'][_0x5e0d('0x61')])){if(_0x1facf2[_0x5e0d('0x56')][_0x5e0d('0x61')][_0x5e0d('0x5c')]){_0x1facf2[_0x5e0d('0x56')][_0x5e0d('0x61')]=_0x1facf2[_0x5e0d('0x56')][_0x5e0d('0x61')][_0x5e0d('0x63')](';')+';';}else{_0x1facf2[_0x5e0d('0x56')][_0x5e0d('0x61')]=null;}}else{_0x1facf2[_0x5e0d('0x56')][_0x5e0d('0x61')]=null;}if(_0x1facf2[_0x5e0d('0x56')]&&_[_0x5e0d('0x62')](_0x1facf2[_0x5e0d('0x56')])){for(var _0x5b8b91=0x0;_0x5b8b91<_0x1facf2['body'][_0x5e0d('0x5c')];_0x5b8b91+=0x1){_0x1facf2[_0x5e0d('0x56')][_0x5b8b91][_0x5e0d('0x59')]=_0x1facf2[_0x5e0d('0x57')]['id'];_0x91db07[_0x5e0d('0x64')](_0x1facf2[_0x5e0d('0x56')][_0x5b8b91]);}return BPromise[_0x5e0d('0x65')](_0x91db07,function(_0x53b5d2){return db['CmContact'][_0x5e0d('0x50')](_[_0x5e0d('0x66')](_0x53b5d2,[_0x5e0d('0x67'),'id'])||{},{'fields':_['keys'](_0x4d8e32),'raw':!![]})['then'](function(_0x20b03c){_0x47fe55[_0x5e0d('0x68')][_0x5e0d('0x64')](_0x20b03c['dataValues']);})[_0x5e0d('0x4d')](function(_0x93cabf){_0x47fe55[_0x5e0d('0x69')][_0x5e0d('0x64')]({'data':_0x53b5d2,'error':_0x93cabf[_0x5e0d('0x6a')]});});})['then'](function(_0x5f528d){return _0x47fe55;})[_0x5e0d('0x4d')](function(_0xdb88ff){return _0xdb88ff;});}else{_0x18410f[_0x5e0d('0x26')](0x190)[_0x5e0d('0x21')]({'message':_0x5e0d('0x6b')});}});}})['then'](respondWithResult(_0x18410f,null))['catch'](handleError(_0x18410f,null));};exports['getContacts']=function(_0x3c3f9a,_0x4c9459,_0x57c14d){var _0x84f64e;return db[_0x5e0d('0x35')][_0x5e0d('0x4f')]({'where':{'id':_0x3c3f9a[_0x5e0d('0x57')]['id']},'include':[{'model':db[_0x5e0d('0x6c')],'as':_0x5e0d('0x6d')}]})[_0x5e0d('0x2a')](handleEntityNotFound(_0x4c9459,null))['then'](function(_0x8f5010){if(_0x8f5010){_0x84f64e=_0x8f5010;return db[_0x5e0d('0x60')][_0x5e0d('0x36')];}})['then'](function(_0x465e9e){if(_0x465e9e){var _0x2c42d5={};var _0x368d73={};_0x368d73[_0x5e0d('0x3d')]=_[_0x5e0d('0x6e')](_[_0x5e0d('0x3a')](_0x465e9e),_[_0x5e0d('0x34')](_0x84f64e[_0x5e0d('0x6d')],function(_0x2f2ff2){return util['format'](_0x5e0d('0x6f'),_0x2f2ff2['id']);}));_0x368d73[_0x5e0d('0x39')]=_[_0x5e0d('0x3a')](_0x3c3f9a[_0x5e0d('0x39')]);_0x368d73['filters']=_[_0x5e0d('0x3c')](_0x368d73['model'],_0x368d73[_0x5e0d('0x39')]);_0x2c42d5[_0x5e0d('0x3e')]=_[_0x5e0d('0x3c')](_0x368d73[_0x5e0d('0x3d')],qs[_0x5e0d('0x3f')](_0x3c3f9a['query']['fields']));_0x2c42d5[_0x5e0d('0x3e')]=_0x2c42d5['attributes']['length']?_0x2c42d5[_0x5e0d('0x3e')]:_0x368d73[_0x5e0d('0x3d')];if(!_0x3c3f9a['query'][_0x5e0d('0x40')]('nolimit')){_0x2c42d5[_0x5e0d('0x24')]=qs['limit'](_0x3c3f9a[_0x5e0d('0x39')][_0x5e0d('0x24')]);_0x2c42d5[_0x5e0d('0x22')]=qs[_0x5e0d('0x22')](_0x3c3f9a[_0x5e0d('0x39')][_0x5e0d('0x22')]);}_0x2c42d5[_0x5e0d('0x70')]=qs['sort'](_0x3c3f9a[_0x5e0d('0x39')][_0x5e0d('0x42')]);_0x2c42d5['where']=qs[_0x5e0d('0x3b')](_[_0x5e0d('0x43')](_0x3c3f9a[_0x5e0d('0x39')],_0x368d73['filters']));_0x2c42d5[_0x5e0d('0x71')]=!![];if(_0x3c3f9a['query'][_0x5e0d('0x44')]){_0x2c42d5[_0x5e0d('0x45')]=_[_0x5e0d('0x48')](_0x2c42d5['where'],{'$or':_['map'](_0x2c42d5[_0x5e0d('0x3e')],function(_0x5b92b0){var _0x4f91fe={};_0x4f91fe[_0x5b92b0]={'$like':'%'+_0x3c3f9a[_0x5e0d('0x39')]['filter']+'%'};return _0x4f91fe;})});}_0x2c42d5=_['merge']({},_0x2c42d5,_0x3c3f9a[_0x5e0d('0x49')]);return _0x84f64e['getContacts'](_0x2c42d5);}})[_0x5e0d('0x2a')](respondWithResult(_0x4c9459,null))[_0x5e0d('0x4d')](handleError(_0x4c9459,null));};exports[_0x5e0d('0x72')]=function(_0x58d8cd,_0x111967,_0x30bb2f){var _0xbe2530;return db[_0x5e0d('0x35')][_0x5e0d('0x4f')]({'where':{'id':_0x58d8cd[_0x5e0d('0x57')]['id']},'include':[{'model':db[_0x5e0d('0x6c')],'as':_0x5e0d('0x6d')}]})[_0x5e0d('0x2a')](handleEntityNotFound(_0x111967,null))['then'](function(_0x2359a3){if(_0x2359a3){_0xbe2530=_0x2359a3;return db[_0x5e0d('0x60')]['rawAttributes'];}})[_0x5e0d('0x2a')](function(_0x47c5f7){if(_0x47c5f7){var _0x4aa530={};var _0xff93f0={};_0xff93f0[_0x5e0d('0x3d')]=_[_0x5e0d('0x6e')](_[_0x5e0d('0x3a')](_0x47c5f7),_[_0x5e0d('0x34')](_0xbe2530['CustomFields'],function(_0x56ee99){return util['format'](_0x5e0d('0x6f'),_0x56ee99['id']);}));_0xff93f0[_0x5e0d('0x39')]=_[_0x5e0d('0x3a')](_0x58d8cd[_0x5e0d('0x39')]);_0xff93f0['filters']=_[_0x5e0d('0x3c')](_0xff93f0[_0x5e0d('0x3d')],_0xff93f0['query']);_0x4aa530[_0x5e0d('0x3e')]=_['intersection'](_0xff93f0[_0x5e0d('0x3d')],qs[_0x5e0d('0x3f')](_0x58d8cd[_0x5e0d('0x39')]['fields']));_0x4aa530[_0x5e0d('0x3e')]=_0x4aa530[_0x5e0d('0x3e')][_0x5e0d('0x5c')]?_0x4aa530[_0x5e0d('0x3e')]:_0xff93f0[_0x5e0d('0x3d')];if(!_0x58d8cd[_0x5e0d('0x39')][_0x5e0d('0x40')](_0x5e0d('0x41'))){_0x4aa530['limit']=qs[_0x5e0d('0x24')](_0x58d8cd[_0x5e0d('0x39')][_0x5e0d('0x24')]);_0x4aa530['offset']=qs[_0x5e0d('0x22')](_0x58d8cd[_0x5e0d('0x39')][_0x5e0d('0x22')]);}_0x4aa530[_0x5e0d('0x70')]=qs[_0x5e0d('0x42')](_0x58d8cd['query'][_0x5e0d('0x42')]);_0x4aa530[_0x5e0d('0x45')]=qs[_0x5e0d('0x3b')](_[_0x5e0d('0x43')](_0x58d8cd[_0x5e0d('0x39')],_0xff93f0[_0x5e0d('0x3b')]));_0x4aa530[_0x5e0d('0x71')]=!![];if(_0x58d8cd[_0x5e0d('0x39')][_0x5e0d('0x44')]){_0x4aa530[_0x5e0d('0x45')]=_[_0x5e0d('0x48')](_0x4aa530[_0x5e0d('0x45')],{'$or':_[_0x5e0d('0x34')](_0x4aa530[_0x5e0d('0x3e')],function(_0x22ac08){var _0x5d1a8e={};_0x5d1a8e[_0x22ac08]={'$like':'%'+_0x58d8cd['query']['filter']+'%'};return _0x5d1a8e;})});}_0x4aa530=_[_0x5e0d('0x48')]({},_0x4aa530,_0x58d8cd['options']);return _0xbe2530[_0x5e0d('0x73')](_0x4aa530);}})[_0x5e0d('0x2a')](function(_0x5a84d2){if(!_['isEmpty'](_0x5a84d2)){var _0x4ee71d=toCsv(_0x5a84d2);var _0x1024c3=Date[_0x5e0d('0x74')]();fs[_0x5e0d('0x75')](util[_0x5e0d('0x76')](_0x5e0d('0x77'),_0xbe2530['id'],_0x1024c3),_0x4ee71d);_0x111967[_0x5e0d('0x78')](_0x5e0d('0x79'),_0x5e0d('0x7a')+util[_0x5e0d('0x76')](_0x5e0d('0x7b'),_0xbe2530['id'],_0x1024c3));_0x111967[_0x5e0d('0x78')](_0x5e0d('0x7c'),'text/csv');return _0x111967[_0x5e0d('0x7d')](util[_0x5e0d('0x76')](_0x5e0d('0x77'),_0xbe2530['id'],_0x1024c3));}else{return _0x111967[_0x5e0d('0x2f')](0xcc);}})[_0x5e0d('0x4d')](handleError(_0x111967,null));};exports[_0x5e0d('0x7e')]=function(_0x2b3d0c,_0x4b3448,_0x1b4b36){var _0xbb8770;delete _0x2b3d0c[_0x5e0d('0x56')]['id'];return db['CmList'][_0x5e0d('0x5b')]({'where':{'id':_0x2b3d0c[_0x5e0d('0x57')]['id']}})[_0x5e0d('0x2a')](handleEntityNotFound(_0x4b3448,null))[_0x5e0d('0x2a')](function(_0x50bcd4){if(_0x50bcd4){return db[_0x5e0d('0x7f')][_0x5e0d('0x80')](function(_0x179334){return db[_0x5e0d('0x6c')]['create'](_0x2b3d0c[_0x5e0d('0x56')],{'transaction':_0x179334})[_0x5e0d('0x2a')](function(_0x54ec9c){_0xbb8770=_0x54ec9c;return _0x50bcd4[_0x5e0d('0x81')](_0x54ec9c,{'transaction':_0x179334});})[_0x5e0d('0x2a')](function(){var _0x5f4968={'type':db[_0x5e0d('0x82')][_0x5e0d('0x83')],'transaction':_0x179334};switch(_0x2b3d0c[_0x5e0d('0x56')][_0x5e0d('0x46')]){case'text':_0x5f4968[_0x5e0d('0x46')]=db[_0x5e0d('0x82')][_0x5e0d('0x83')];break;case _0x5e0d('0x84'):_0x5f4968['type']=db[_0x5e0d('0x82')][_0x5e0d('0x85')];break;case _0x5e0d('0x86'):_0x5f4968[_0x5e0d('0x46')]=db[_0x5e0d('0x82')][_0x5e0d('0x87')];_0x5f4968[_0x5e0d('0x88')]=![];break;default:}return db['sequelize'][_0x5e0d('0x89')]['addColumn'](_0x5e0d('0x8a'),util[_0x5e0d('0x76')](_0x5e0d('0x8b'),_0xbb8770['id']),_0x5f4968);})[_0x5e0d('0x2a')](function(){return _0xbb8770;});});}})[_0x5e0d('0x2a')](respondWithResult(_0x4b3448,null))['catch'](handleError(_0x4b3448,null));};exports[_0x5e0d('0x8c')]=function(_0x381718,_0x217696,_0x37bbfb){var _0x28bf85={};var _0x54b6b4={};var _0x498cd6;var _0x3797a2;return db[_0x5e0d('0x35')][_0x5e0d('0x5b')]({'where':{'id':_0x381718['params']['id']}})[_0x5e0d('0x2a')](handleEntityNotFound(_0x217696,null))['then'](function(_0x3e1008){if(_0x3e1008){_0x498cd6=_0x3e1008;_0x54b6b4[_0x5e0d('0x3d')]=_[_0x5e0d('0x3a')](db['CmCustomField'][_0x5e0d('0x36')]);_0x54b6b4[_0x5e0d('0x39')]=_[_0x5e0d('0x3a')](_0x381718[_0x5e0d('0x39')]);_0x54b6b4[_0x5e0d('0x3b')]=_[_0x5e0d('0x3c')](_0x54b6b4['model'],_0x54b6b4[_0x5e0d('0x39')]);_0x28bf85[_0x5e0d('0x3e')]=_[_0x5e0d('0x3c')](_0x54b6b4[_0x5e0d('0x3d')],qs[_0x5e0d('0x3f')](_0x381718[_0x5e0d('0x39')][_0x5e0d('0x3f')]));_0x28bf85[_0x5e0d('0x3e')]=_0x28bf85[_0x5e0d('0x3e')]['length']?_0x28bf85['attributes']:_0x54b6b4[_0x5e0d('0x3d')];_0x28bf85['order']=qs[_0x5e0d('0x42')](_0x381718[_0x5e0d('0x39')][_0x5e0d('0x42')]);_0x28bf85[_0x5e0d('0x45')]=qs[_0x5e0d('0x3b')](_[_0x5e0d('0x43')](_0x381718[_0x5e0d('0x39')],_0x54b6b4[_0x5e0d('0x3b')]));_0x28bf85['where']=_['merge'](_0x28bf85[_0x5e0d('0x45')],{'$or':[{'ListId':_0x3e1008['id']},{'ListId':null}]});if(_0x381718[_0x5e0d('0x39')][_0x5e0d('0x44')]){_0x28bf85[_0x5e0d('0x45')]=_[_0x5e0d('0x48')](_0x28bf85['where'],{'$or':_['map'](_0x28bf85['attributes'],function(_0x40e30c){var _0x22433f={};_0x22433f[_0x40e30c]={'$like':'%'+_0x381718[_0x5e0d('0x39')]['filter']+'%'};return _0x22433f;})});}_0x28bf85=_[_0x5e0d('0x48')]({},_0x28bf85,_0x381718['options']);return db[_0x5e0d('0x6c')][_0x5e0d('0x8d')](_0x28bf85);}})[_0x5e0d('0x2a')](respondWithResult(_0x217696,null))[_0x5e0d('0x4d')](handleError(_0x217696,null));};exports['addAgents']=function(_0x10509b,_0x369d2d,_0x18448a){return db[_0x5e0d('0x35')][_0x5e0d('0x4f')]({'where':{'id':_0x10509b[_0x5e0d('0x57')]['id']}})[_0x5e0d('0x2a')](handleEntityNotFound(_0x369d2d,null))[_0x5e0d('0x2a')](function(_0x434c8b){if(_0x434c8b){return _0x434c8b[_0x5e0d('0x8e')](_0x10509b[_0x5e0d('0x56')][_0x5e0d('0x67')],_[_0x5e0d('0x66')](_0x10509b[_0x5e0d('0x56')],['ids','id'])||{})[_0x5e0d('0x8f')](function(_0xfcd3fc){for(var _0x185ea4=0x0;_0x185ea4<_0x10509b['body'][_0x5e0d('0x67')][_0x5e0d('0x5c')];_0x185ea4+=0x1){socket[_0x5e0d('0x90')](_0x5e0d('0x91'),{'UserId':Number(_0x10509b[_0x5e0d('0x56')]['ids'][_0x185ea4]),'CmListId':Number(_0x10509b[_0x5e0d('0x57')]['id'])});}return _0xfcd3fc;});}})['then'](respondWithResult(_0x369d2d,null))[_0x5e0d('0x4d')](handleError(_0x369d2d,null));};exports[_0x5e0d('0x92')]=function(_0x39f261,_0x5dccc8,_0x5ce1e5){return db['CmList'][_0x5e0d('0x4f')]({'where':{'id':_0x39f261[_0x5e0d('0x57')]['id']}})[_0x5e0d('0x2a')](handleEntityNotFound(_0x5dccc8,null))[_0x5e0d('0x2a')](function(_0x16a410){if(_0x16a410){return _0x16a410[_0x5e0d('0x92')](_0x39f261['query'][_0x5e0d('0x67')])['then'](function(){if(_['isArray'](_0x39f261[_0x5e0d('0x39')]['ids'])){for(var _0x15c4f2=0x0;_0x15c4f2<_0x39f261['query'][_0x5e0d('0x67')]['length'];_0x15c4f2+=0x1){socket[_0x5e0d('0x90')](_0x5e0d('0x93'),{'UserId':Number(_0x39f261[_0x5e0d('0x39')][_0x5e0d('0x67')][_0x15c4f2]),'CmListId':Number(_0x39f261[_0x5e0d('0x57')]['id'])});}}else{socket['emit'](_0x5e0d('0x93'),{'UserId':Number(_0x39f261[_0x5e0d('0x39')]['ids']),'CmListId':Number(_0x39f261['params']['id'])});}});}})[_0x5e0d('0x2a')](respondWithStatusCode(_0x5dccc8,null))['catch'](handleError(_0x5dccc8,null));};exports['getAgents']=function(_0xd3a278,_0x384408,_0xe457ee){var _0xcf2e09={};var _0x3adc91={};var _0x1b6862;var _0x5ad46f;return db['CmList']['findOne']({'where':{'id':_0xd3a278['params']['id']}})[_0x5e0d('0x2a')](handleEntityNotFound(_0x384408,null))[_0x5e0d('0x2a')](function(_0x3c5599){if(_0x3c5599){_0x1b6862=_0x3c5599;_0x3adc91[_0x5e0d('0x3d')]=_['keys'](db[_0x5e0d('0x94')][_0x5e0d('0x36')]);_0x3adc91[_0x5e0d('0x39')]=_[_0x5e0d('0x3a')](_0xd3a278[_0x5e0d('0x39')]);_0x3adc91[_0x5e0d('0x3b')]=_[_0x5e0d('0x3c')](_0x3adc91[_0x5e0d('0x3d')],_0x3adc91[_0x5e0d('0x39')]);_0xcf2e09[_0x5e0d('0x3e')]=_[_0x5e0d('0x3c')](_0x3adc91[_0x5e0d('0x3d')],qs['fields'](_0xd3a278[_0x5e0d('0x39')][_0x5e0d('0x3f')]));_0xcf2e09[_0x5e0d('0x3e')]=_0xcf2e09[_0x5e0d('0x3e')]['length']?_0xcf2e09['attributes']:_0x3adc91[_0x5e0d('0x3d')];_0xcf2e09[_0x5e0d('0x70')]=qs[_0x5e0d('0x42')](_0xd3a278[_0x5e0d('0x39')][_0x5e0d('0x42')]);_0xcf2e09['where']=qs[_0x5e0d('0x3b')](_[_0x5e0d('0x43')](_0xd3a278[_0x5e0d('0x39')],_0x3adc91['filters']));if(_0xd3a278[_0x5e0d('0x39')][_0x5e0d('0x44')]){_0xcf2e09[_0x5e0d('0x45')]=_[_0x5e0d('0x48')](_0xcf2e09['where'],{'$or':_[_0x5e0d('0x34')](_0xcf2e09[_0x5e0d('0x3e')],function(_0x19e164){var _0x3fcea8={};_0x3fcea8[_0x19e164]={'$like':'%'+_0xd3a278[_0x5e0d('0x39')][_0x5e0d('0x44')]+'%'};return _0x3fcea8;})});}_0xcf2e09=_['merge']({},_0xcf2e09,_0xd3a278[_0x5e0d('0x49')]);return _0x1b6862[_0x5e0d('0x95')](_0xcf2e09);}})[_0x5e0d('0x2a')](function(_0x5737f3){if(_0x5737f3){_0x5ad46f=_0x5737f3[_0x5e0d('0x5c')];if(!_0xd3a278[_0x5e0d('0x39')][_0x5e0d('0x40')]('nolimit')){_0xcf2e09[_0x5e0d('0x24')]=qs[_0x5e0d('0x24')](_0xd3a278[_0x5e0d('0x39')][_0x5e0d('0x24')]);_0xcf2e09[_0x5e0d('0x22')]=qs[_0x5e0d('0x22')](_0xd3a278[_0x5e0d('0x39')]['offset']);}return _0x1b6862['getAgents'](_0xcf2e09);}})[_0x5e0d('0x2a')](function(_0x39a451){if(_0x39a451){return _0x39a451?{'count':_0x5ad46f,'rows':_0x39a451}:null;}})['then'](respondWithResult(_0x384408,null))[_0x5e0d('0x4d')](handleError(_0x384408,null));}; \ No newline at end of file +var _0x84ed=['userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','end','json','offset','undefined','limit','count','set','apply','reject','then','get','UserProfileResource','destroy','sendStatus','error','stack','send','index','map','CmList','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','nolimit','order','sort','where','VIRTUAL','name','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','find','userProfileId','autoAssociation','body','describe','addDisposition','Disposition','getDispositions','findOne','length','hasOwnProperty','pick','ListId','removeDispositions','ids','addContacts','tags','join','isArray','push','each','CmContact','omit','success','dataValues','errors','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','cf_%d','raw','getContacts','format','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','download','sequelize','Sequelize','TEXT','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','spread'];(function(_0x185dc7,_0x209880){var _0x1aec2f=function(_0x1634a8){while(--_0x1634a8){_0x185dc7['push'](_0x185dc7['shift']());}};_0x1aec2f(++_0x209880);}(_0x84ed,0x1bc));var _0xd84e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x84ed[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require(_0xd84e('0x0'));var rimraf=require(_0xd84e('0x1'));var zipdir=require(_0xd84e('0x2'));var jsonpatch=require(_0xd84e('0x3'));var rp=require(_0xd84e('0x4'));var moment=require(_0xd84e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd84e('0x6'));var util=require(_0xd84e('0x7'));var path=require('path');var sox=require(_0xd84e('0x8'));var csv=require(_0xd84e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd84e('0xa'));var _=require(_0xd84e('0xb'));var squel=require(_0xd84e('0xc'));var crypto=require('crypto');var jsforce=require(_0xd84e('0xd'));var deskjs=require(_0xd84e('0xe'));var toCsv=require(_0xd84e('0x9'));var querystring=require(_0xd84e('0xf'));var Papa=require(_0xd84e('0x10'));var Redis=require(_0xd84e('0x11'));var authService=require(_0xd84e('0x12'));var qs=require(_0xd84e('0x13'));var as=require(_0xd84e('0x14'));var hardwareService=require(_0xd84e('0x15'));var logger=require(_0xd84e('0x16'))('api');var utils=require(_0xd84e('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd84e('0x18'))['db'];config[_0xd84e('0x19')]=_[_0xd84e('0x1a')](config[_0xd84e('0x19')],{'host':_0xd84e('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd84e('0x19')]));require(_0xd84e('0x1c'))[_0xd84e('0x1d')](socket);function respondWithStatusCode(_0x4ac3a7,_0x4bb15f){_0x4bb15f=_0x4bb15f||0xcc;return function(_0x23687e){if(_0x23687e){return _0x4ac3a7['sendStatus'](_0x4bb15f);}return _0x4ac3a7[_0xd84e('0x1e')](_0x4bb15f)[_0xd84e('0x1f')]();};}function respondWithResult(_0x46710e,_0x382587){_0x382587=_0x382587||0xc8;return function(_0x862266){if(_0x862266){return _0x46710e[_0xd84e('0x1e')](_0x382587)[_0xd84e('0x20')](_0x862266);}};}function respondWithFilteredResult(_0x4a516e,_0x30a9fb){return function(_0x46a543){if(_0x46a543){var _0x16a86d=typeof _0x30a9fb[_0xd84e('0x21')]===_0xd84e('0x22')&&typeof _0x30a9fb[_0xd84e('0x23')]===_0xd84e('0x22');var _0x42e9c7=_0x46a543[_0xd84e('0x24')];var _0x15c528=_0x16a86d?0x0:_0x30a9fb['offset'];var _0x1b92a9=_0x16a86d?_0x46a543[_0xd84e('0x24')]:_0x30a9fb[_0xd84e('0x21')]+_0x30a9fb['limit'];var _0x580b28;if(_0x1b92a9>=_0x42e9c7){_0x1b92a9=_0x42e9c7;_0x580b28=0xc8;}else{_0x580b28=0xce;}_0x4a516e[_0xd84e('0x1e')](_0x580b28);return _0x4a516e[_0xd84e('0x25')]('Content-Range',_0x15c528+'-'+_0x1b92a9+'/'+_0x42e9c7)['json'](_0x46a543);}return null;};}function patchUpdates(_0x13bd21){return function(_0x3e6e8c){try{jsonpatch[_0xd84e('0x26')](_0x3e6e8c,_0x13bd21,!![]);}catch(_0x4f6890){return BPromise[_0xd84e('0x27')](_0x4f6890);}return _0x3e6e8c['save']();};}function saveUpdates(_0x2c90be,_0x17f22b){return function(_0x3720e5){if(_0x3720e5){return _0x3720e5['update'](_0x2c90be)[_0xd84e('0x28')](function(_0x285beb){return _0x285beb;});}return null;};}function removeEntity(_0x3d48f2,_0x51ccbb){return function(_0x2df883){if(_0x2df883){return _0x2df883['destroy']()[_0xd84e('0x28')](function(){var _0x70ec2e=_0x2df883[_0xd84e('0x29')]({'plain':!![]});var _0x2b6a55='Lists';return db[_0xd84e('0x2a')][_0xd84e('0x2b')]({'where':{'type':_0x2b6a55,'resourceId':_0x70ec2e['id']}})[_0xd84e('0x28')](function(){return _0x2df883;});})[_0xd84e('0x28')](function(){_0x3d48f2[_0xd84e('0x1e')](0xcc)[_0xd84e('0x1f')]();});}};}function handleEntityNotFound(_0x5939ac,_0x2c2fb6){return function(_0x539884){if(!_0x539884){_0x5939ac[_0xd84e('0x2c')](0x194);}return _0x539884;};}function handleError(_0x591944,_0x434aeb){_0x434aeb=_0x434aeb||0x1f4;return function(_0x23234b){logger[_0xd84e('0x2d')](_0x23234b[_0xd84e('0x2e')]);if(_0x23234b['name']){delete _0x23234b['name'];}_0x591944[_0xd84e('0x1e')](_0x434aeb)[_0xd84e('0x2f')](_0x23234b);};}exports[_0xd84e('0x30')]=function(_0x38b99a,_0x222aeb){var _0x1386e2={},_0x35323d={},_0x58d7c2={'count':0x0,'rows':[]};var _0x5482f8=_[_0xd84e('0x31')](db[_0xd84e('0x32')]['rawAttributes'],function(_0x4a4ac3){return{'name':_0x4a4ac3[_0xd84e('0x33')],'type':_0x4a4ac3[_0xd84e('0x34')][_0xd84e('0x35')]};});_0x35323d[_0xd84e('0x36')]=_[_0xd84e('0x31')](_0x5482f8,'name');_0x35323d['query']=_[_0xd84e('0x37')](_0x38b99a[_0xd84e('0x38')]);_0x35323d[_0xd84e('0x39')]=_['intersection'](_0x35323d[_0xd84e('0x36')],_0x35323d[_0xd84e('0x38')]);_0x1386e2[_0xd84e('0x3a')]=_[_0xd84e('0x3b')](_0x35323d[_0xd84e('0x36')],qs['fields'](_0x38b99a[_0xd84e('0x38')][_0xd84e('0x3c')]));_0x1386e2['attributes']=_0x1386e2[_0xd84e('0x3a')]['length']?_0x1386e2[_0xd84e('0x3a')]:_0x35323d['model'];if(!_0x38b99a[_0xd84e('0x38')]['hasOwnProperty'](_0xd84e('0x3d'))){_0x1386e2[_0xd84e('0x23')]=qs[_0xd84e('0x23')](_0x38b99a['query'][_0xd84e('0x23')]);_0x1386e2[_0xd84e('0x21')]=qs[_0xd84e('0x21')](_0x38b99a[_0xd84e('0x38')]['offset']);}_0x1386e2[_0xd84e('0x3e')]=qs['sort'](_0x38b99a[_0xd84e('0x38')][_0xd84e('0x3f')]);_0x1386e2[_0xd84e('0x40')]=qs[_0xd84e('0x39')](_['pick'](_0x38b99a[_0xd84e('0x38')],_0x35323d[_0xd84e('0x39')]),_0x5482f8);if(_0x38b99a[_0xd84e('0x38')]['filter']){_0x1386e2[_0xd84e('0x40')]=_['merge'](_0x1386e2['where'],{'$or':_[_0xd84e('0x31')](_0x5482f8,function(_0x472179){if(_0x472179['type']!==_0xd84e('0x41')){var _0x12a233={};_0x12a233[_0x472179[_0xd84e('0x42')]]={'$like':'%'+_0x38b99a['query'][_0xd84e('0x43')]+'%'};return _0x12a233;}})});}_0x1386e2=_[_0xd84e('0x44')]({},_0x1386e2,_0x38b99a[_0xd84e('0x45')]);var _0x1d91ab={'where':_0x1386e2['where']};return db[_0xd84e('0x32')]['count'](_0x1d91ab)[_0xd84e('0x28')](function(_0x4b4034){_0x58d7c2[_0xd84e('0x24')]=_0x4b4034;if(_0x38b99a[_0xd84e('0x38')][_0xd84e('0x46')]){_0x1386e2[_0xd84e('0x47')]=[{'all':!![]}];}return db['CmList'][_0xd84e('0x48')](_0x1386e2);})[_0xd84e('0x28')](function(_0x39d967){_0x58d7c2[_0xd84e('0x49')]=_0x39d967;return _0x58d7c2;})['then'](respondWithFilteredResult(_0x222aeb,_0x1386e2))[_0xd84e('0x4a')](handleError(_0x222aeb,null));};exports[_0xd84e('0x4b')]=function(_0x19d83b,_0x2eaf1c){var _0x5b2b8d={'raw':![],'where':{'id':_0x19d83b[_0xd84e('0x4c')]['id']}},_0x191c69={};_0x191c69[_0xd84e('0x36')]=_[_0xd84e('0x37')](db[_0xd84e('0x32')][_0xd84e('0x4d')]);_0x191c69[_0xd84e('0x38')]=_[_0xd84e('0x37')](_0x19d83b[_0xd84e('0x38')]);_0x191c69[_0xd84e('0x39')]=_[_0xd84e('0x3b')](_0x191c69['model'],_0x191c69['query']);_0x5b2b8d[_0xd84e('0x3a')]=_[_0xd84e('0x3b')](_0x191c69[_0xd84e('0x36')],qs['fields'](_0x19d83b['query'][_0xd84e('0x3c')]));_0x5b2b8d[_0xd84e('0x3a')]=_0x5b2b8d[_0xd84e('0x3a')]['length']?_0x5b2b8d['attributes']:_0x191c69[_0xd84e('0x36')];if(_0x19d83b[_0xd84e('0x38')]['includeAll']){_0x5b2b8d[_0xd84e('0x47')]=[{'all':!![]}];}_0x5b2b8d=_['merge']({},_0x5b2b8d,_0x19d83b[_0xd84e('0x45')]);return db[_0xd84e('0x32')]['find'](_0x5b2b8d)[_0xd84e('0x28')](handleEntityNotFound(_0x2eaf1c,null))[_0xd84e('0x28')](respondWithResult(_0x2eaf1c,null))['catch'](handleError(_0x2eaf1c,null));};exports[_0xd84e('0x4e')]=function(_0x5b4054,_0x262506){return db[_0xd84e('0x32')][_0xd84e('0x4e')](_0x5b4054['body'],{})[_0xd84e('0x28')](function(_0x2a3d6c){var _0x2f104d=_0x5b4054[_0xd84e('0x4f')][_0xd84e('0x29')]({'plain':!![]});if(!_0x2f104d)throw new Error(_0xd84e('0x50'));if(_0x2f104d[_0xd84e('0x51')]===_0xd84e('0x4f')){var _0x1cc4ed=_0x2a3d6c[_0xd84e('0x29')]({'plain':!![]});var _0x348a25=_0xd84e('0x52');return db[_0xd84e('0x53')][_0xd84e('0x54')]({'where':{'name':_0x348a25,'userProfileId':_0x2f104d[_0xd84e('0x55')]},'raw':!![]})['then'](function(_0x27d605){if(_0x27d605&&_0x27d605[_0xd84e('0x56')]===0x0){return db[_0xd84e('0x2a')][_0xd84e('0x4e')]({'name':_0x1cc4ed[_0xd84e('0x42')],'resourceId':_0x1cc4ed['id'],'type':_0x27d605['name'],'sectionId':_0x27d605['id']},{})[_0xd84e('0x28')](function(){return _0x2a3d6c;});}else{return _0x2a3d6c;}})[_0xd84e('0x4a')](function(_0x1c4f98){logger[_0xd84e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c4f98);throw _0x1c4f98;});}return _0x2a3d6c;})[_0xd84e('0x28')](respondWithResult(_0x262506,0xc9))[_0xd84e('0x4a')](handleError(_0x262506,null));};exports['update']=function(_0x5b6fb5,_0x2655d2){if(_0x5b6fb5[_0xd84e('0x57')]['id']){delete _0x5b6fb5[_0xd84e('0x57')]['id'];}return db['CmList'][_0xd84e('0x54')]({'where':{'id':_0x5b6fb5[_0xd84e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2655d2,null))['then'](saveUpdates(_0x5b6fb5[_0xd84e('0x57')],null))[_0xd84e('0x28')](respondWithResult(_0x2655d2,null))[_0xd84e('0x4a')](handleError(_0x2655d2,null));};exports[_0xd84e('0x2b')]=function(_0x4ff21e,_0x4866bc){return db[_0xd84e('0x32')]['find']({'where':{'id':_0x4ff21e['params']['id']}})['then'](handleEntityNotFound(_0x4866bc,null))[_0xd84e('0x28')](removeEntity(_0x4866bc,null))[_0xd84e('0x4a')](handleError(_0x4866bc,null));};exports[_0xd84e('0x58')]=function(_0x13de70,_0x39c4ad){return db[_0xd84e('0x32')][_0xd84e('0x58')]()[_0xd84e('0x28')](respondWithResult(_0x39c4ad,null))['catch'](handleError(_0x39c4ad,null));};exports[_0xd84e('0x59')]=function(_0x27e6a4,_0x37df41,_0x2b6c37){if(_0x27e6a4['body']['id']){delete _0x27e6a4['body']['id'];}return db['CmList'][_0xd84e('0x54')]({'where':{'id':_0x27e6a4[_0xd84e('0x4c')]['id']}})[_0xd84e('0x28')](handleEntityNotFound(_0x37df41,null))[_0xd84e('0x28')](function(_0x7b0568){if(_0x7b0568){_0x27e6a4[_0xd84e('0x57')]['ListId']=_0x7b0568['id'];return db[_0xd84e('0x5a')][_0xd84e('0x4e')](_0x27e6a4[_0xd84e('0x57')]);}})[_0xd84e('0x28')](respondWithResult(_0x37df41,null))[_0xd84e('0x4a')](handleError(_0x37df41,null));};exports[_0xd84e('0x5b')]=function(_0x5f378e,_0x586895,_0x1f232f){var _0x5d7676={'raw':![],'where':{}};var _0x1ada0f={};var _0x348e15={'count':0x0,'rows':[]};return db[_0xd84e('0x32')][_0xd84e('0x5c')]({'where':{'id':_0x5f378e[_0xd84e('0x4c')]['id']}})[_0xd84e('0x28')](handleEntityNotFound(_0x586895,null))['then'](function(_0x6f7bda){if(_0x6f7bda){_0x1ada0f[_0xd84e('0x36')]=_[_0xd84e('0x37')](db[_0xd84e('0x5a')][_0xd84e('0x4d')]);_0x1ada0f[_0xd84e('0x38')]=_[_0xd84e('0x37')](_0x5f378e['query']);_0x1ada0f['filters']=_[_0xd84e('0x3b')](_0x1ada0f['model'],_0x1ada0f['query']);_0x5d7676[_0xd84e('0x3a')]=_['intersection'](_0x1ada0f[_0xd84e('0x36')],qs['fields'](_0x5f378e[_0xd84e('0x38')]['fields']));_0x5d7676[_0xd84e('0x3a')]=_0x5d7676[_0xd84e('0x3a')][_0xd84e('0x5d')]?_0x5d7676[_0xd84e('0x3a')]:_0x1ada0f[_0xd84e('0x36')];if(!_0x5f378e[_0xd84e('0x38')][_0xd84e('0x5e')]('nolimit')){_0x5d7676[_0xd84e('0x23')]=qs['limit'](_0x5f378e[_0xd84e('0x38')][_0xd84e('0x23')]);_0x5d7676[_0xd84e('0x21')]=qs['offset'](_0x5f378e[_0xd84e('0x38')]['offset']);}_0x5d7676[_0xd84e('0x3e')]=qs[_0xd84e('0x3f')](_0x5f378e[_0xd84e('0x38')][_0xd84e('0x3f')]);_0x5d7676['where']=qs[_0xd84e('0x39')](_[_0xd84e('0x5f')](_0x5f378e[_0xd84e('0x38')],_0x1ada0f['filters']));_0x5d7676[_0xd84e('0x40')][_0xd84e('0x60')]=_0x6f7bda['id'];if(_0x5f378e[_0xd84e('0x38')][_0xd84e('0x43')]){_0x5d7676[_0xd84e('0x40')]=_[_0xd84e('0x44')](_0x5d7676[_0xd84e('0x40')],{'$or':_[_0xd84e('0x31')](_0x5d7676[_0xd84e('0x3a')],function(_0x293d37){var _0x26724b={};_0x26724b[_0x293d37]={'$like':'%'+_0x5f378e['query'][_0xd84e('0x43')]+'%'};return _0x26724b;})});}_0x5d7676=_[_0xd84e('0x44')]({},_0x5d7676,_0x5f378e[_0xd84e('0x45')]);return db[_0xd84e('0x5a')][_0xd84e('0x24')]({'where':_0x5d7676[_0xd84e('0x40')]})[_0xd84e('0x28')](function(_0x521b36){_0x348e15[_0xd84e('0x24')]=_0x521b36;if(_0x5f378e[_0xd84e('0x38')][_0xd84e('0x46')]){_0x5d7676['include']=[{'all':!![]}];}return db[_0xd84e('0x5a')][_0xd84e('0x48')](_0x5d7676);})[_0xd84e('0x28')](function(_0xc45ce){_0x348e15[_0xd84e('0x49')]=_0xc45ce;return _0x348e15;});}})[_0xd84e('0x28')](respondWithFilteredResult(_0x586895,_0x5d7676))[_0xd84e('0x4a')](handleError(_0x586895,null));};exports[_0xd84e('0x61')]=function(_0x26dffb,_0x187b2e,_0xaccebb){return db['CmList'][_0xd84e('0x54')]({'where':{'id':_0x26dffb[_0xd84e('0x4c')]['id']}})[_0xd84e('0x28')](handleEntityNotFound(_0x187b2e,null))[_0xd84e('0x28')](function(_0x449f05){if(_0x449f05){return _0x449f05['removeDispositions'](_0x26dffb[_0xd84e('0x38')][_0xd84e('0x62')]);}})[_0xd84e('0x28')](respondWithStatusCode(_0x187b2e,null))['catch'](handleError(_0x187b2e,null));};exports[_0xd84e('0x63')]=function(_0x35b10b,_0x3016fe,_0x2d0ca6){return db[_0xd84e('0x32')]['find']({'where':{'id':_0x35b10b[_0xd84e('0x4c')]['id']}})[_0xd84e('0x28')](handleEntityNotFound(_0x3016fe,null))[_0xd84e('0x28')](function(_0x19a664){if(_0x19a664){var _0x22fb2e=[];var _0x1fe1cf={'success':[],'errors':[]};return db['CmContact'][_0xd84e('0x58')]()[_0xd84e('0x28')](function(_0x5a5fb3){if(_0x35b10b[_0xd84e('0x57')][_0xd84e('0x64')]&&_['isArray'](_0x35b10b[_0xd84e('0x57')][_0xd84e('0x64')])){if(_0x35b10b[_0xd84e('0x57')][_0xd84e('0x64')][_0xd84e('0x5d')]){_0x35b10b[_0xd84e('0x57')][_0xd84e('0x64')]=_0x35b10b['body'][_0xd84e('0x64')][_0xd84e('0x65')](';')+';';}else{_0x35b10b[_0xd84e('0x57')][_0xd84e('0x64')]=null;}}else{_0x35b10b[_0xd84e('0x57')][_0xd84e('0x64')]=null;}if(_0x35b10b[_0xd84e('0x57')]&&_[_0xd84e('0x66')](_0x35b10b['body'])){for(var _0x31f7c6=0x0;_0x31f7c6<_0x35b10b[_0xd84e('0x57')]['length'];_0x31f7c6+=0x1){_0x35b10b['body'][_0x31f7c6][_0xd84e('0x60')]=_0x35b10b[_0xd84e('0x4c')]['id'];_0x22fb2e[_0xd84e('0x67')](_0x35b10b[_0xd84e('0x57')][_0x31f7c6]);}return BPromise[_0xd84e('0x68')](_0x22fb2e,function(_0x529893){return db[_0xd84e('0x69')][_0xd84e('0x4e')](_[_0xd84e('0x6a')](_0x529893,[_0xd84e('0x62'),'id'])||{},{'fields':_['keys'](_0x5a5fb3),'raw':!![]})[_0xd84e('0x28')](function(_0x432cb2){_0x1fe1cf[_0xd84e('0x6b')][_0xd84e('0x67')](_0x432cb2[_0xd84e('0x6c')]);})[_0xd84e('0x4a')](function(_0x54d3da){_0x1fe1cf[_0xd84e('0x6d')]['push']({'data':_0x529893,'error':_0x54d3da['message']});});})['then'](function(_0x2516a7){return _0x1fe1cf;})[_0xd84e('0x4a')](function(_0x21092a){return _0x21092a;});}else{_0x3016fe['status'](0x190)[_0xd84e('0x20')]({'message':_0xd84e('0x6e')});}});}})['then'](respondWithResult(_0x3016fe,null))[_0xd84e('0x4a')](handleError(_0x3016fe,null));};exports['getContacts']=function(_0x113529,_0x2a44a1,_0x527fe1){var _0x8b891;return db['CmList'][_0xd84e('0x54')]({'where':{'id':_0x113529['params']['id']},'include':[{'model':db[_0xd84e('0x6f')],'as':_0xd84e('0x70')}]})[_0xd84e('0x28')](handleEntityNotFound(_0x2a44a1,null))[_0xd84e('0x28')](function(_0x440f58){if(_0x440f58){_0x8b891=_0x440f58;return db[_0xd84e('0x69')][_0xd84e('0x4d')];}})[_0xd84e('0x28')](function(_0x3078b3){if(_0x3078b3){var _0x301de6={};var _0x4ca1ac={};_0x4ca1ac['model']=_[_0xd84e('0x71')](_[_0xd84e('0x37')](_0x3078b3),_[_0xd84e('0x31')](_0x8b891[_0xd84e('0x70')],function(_0x5e01b7){return util['format'](_0xd84e('0x72'),_0x5e01b7['id']);}));_0x4ca1ac['query']=_[_0xd84e('0x37')](_0x113529[_0xd84e('0x38')]);_0x4ca1ac['filters']=_[_0xd84e('0x3b')](_0x4ca1ac[_0xd84e('0x36')],_0x4ca1ac['query']);_0x301de6[_0xd84e('0x3a')]=_[_0xd84e('0x3b')](_0x4ca1ac[_0xd84e('0x36')],qs[_0xd84e('0x3c')](_0x113529['query'][_0xd84e('0x3c')]));_0x301de6['attributes']=_0x301de6[_0xd84e('0x3a')][_0xd84e('0x5d')]?_0x301de6[_0xd84e('0x3a')]:_0x4ca1ac['model'];if(!_0x113529['query'][_0xd84e('0x5e')](_0xd84e('0x3d'))){_0x301de6[_0xd84e('0x23')]=qs[_0xd84e('0x23')](_0x113529[_0xd84e('0x38')][_0xd84e('0x23')]);_0x301de6['offset']=qs[_0xd84e('0x21')](_0x113529[_0xd84e('0x38')][_0xd84e('0x21')]);}_0x301de6[_0xd84e('0x3e')]=qs[_0xd84e('0x3f')](_0x113529[_0xd84e('0x38')][_0xd84e('0x3f')]);_0x301de6[_0xd84e('0x40')]=qs['filters'](_[_0xd84e('0x5f')](_0x113529['query'],_0x4ca1ac[_0xd84e('0x39')]));_0x301de6[_0xd84e('0x73')]=!![];if(_0x113529[_0xd84e('0x38')][_0xd84e('0x43')]){_0x301de6[_0xd84e('0x40')]=_[_0xd84e('0x44')](_0x301de6['where'],{'$or':_[_0xd84e('0x31')](_0x301de6[_0xd84e('0x3a')],function(_0x12c37f){var _0x4cdf92={};_0x4cdf92[_0x12c37f]={'$like':'%'+_0x113529[_0xd84e('0x38')][_0xd84e('0x43')]+'%'};return _0x4cdf92;})});}_0x301de6=_['merge']({},_0x301de6,_0x113529[_0xd84e('0x45')]);return _0x8b891[_0xd84e('0x74')](_0x301de6);}})['then'](respondWithResult(_0x2a44a1,null))[_0xd84e('0x4a')](handleError(_0x2a44a1,null));};exports['getContactsCsv']=function(_0x1c01ed,_0x5c6474,_0x1f58ce){var _0x3a998f;return db[_0xd84e('0x32')][_0xd84e('0x54')]({'where':{'id':_0x1c01ed[_0xd84e('0x4c')]['id']},'include':[{'model':db[_0xd84e('0x6f')],'as':_0xd84e('0x70')}]})[_0xd84e('0x28')](handleEntityNotFound(_0x5c6474,null))[_0xd84e('0x28')](function(_0x3650ba){if(_0x3650ba){_0x3a998f=_0x3650ba;return db['CmContact'][_0xd84e('0x4d')];}})[_0xd84e('0x28')](function(_0x3a8bfa){if(_0x3a8bfa){var _0x45084b={};var _0x5792f5={};_0x5792f5[_0xd84e('0x36')]=_['concat'](_['keys'](_0x3a8bfa),_[_0xd84e('0x31')](_0x3a998f['CustomFields'],function(_0x1b75f9){return util[_0xd84e('0x75')](_0xd84e('0x72'),_0x1b75f9['id']);}));_0x5792f5['query']=_[_0xd84e('0x37')](_0x1c01ed[_0xd84e('0x38')]);_0x5792f5[_0xd84e('0x39')]=_['intersection'](_0x5792f5[_0xd84e('0x36')],_0x5792f5[_0xd84e('0x38')]);_0x45084b[_0xd84e('0x3a')]=_[_0xd84e('0x3b')](_0x5792f5[_0xd84e('0x36')],qs[_0xd84e('0x3c')](_0x1c01ed['query'][_0xd84e('0x3c')]));_0x45084b['attributes']=_0x45084b[_0xd84e('0x3a')][_0xd84e('0x5d')]?_0x45084b['attributes']:_0x5792f5[_0xd84e('0x36')];if(!_0x1c01ed['query'][_0xd84e('0x5e')]('nolimit')){_0x45084b[_0xd84e('0x23')]=qs[_0xd84e('0x23')](_0x1c01ed['query'][_0xd84e('0x23')]);_0x45084b[_0xd84e('0x21')]=qs['offset'](_0x1c01ed['query']['offset']);}_0x45084b[_0xd84e('0x3e')]=qs[_0xd84e('0x3f')](_0x1c01ed[_0xd84e('0x38')][_0xd84e('0x3f')]);_0x45084b['where']=qs['filters'](_[_0xd84e('0x5f')](_0x1c01ed[_0xd84e('0x38')],_0x5792f5[_0xd84e('0x39')]));_0x45084b[_0xd84e('0x73')]=!![];if(_0x1c01ed[_0xd84e('0x38')][_0xd84e('0x43')]){_0x45084b[_0xd84e('0x40')]=_[_0xd84e('0x44')](_0x45084b[_0xd84e('0x40')],{'$or':_[_0xd84e('0x31')](_0x45084b['attributes'],function(_0x16e28a){var _0x506d73={};_0x506d73[_0x16e28a]={'$like':'%'+_0x1c01ed['query'][_0xd84e('0x43')]+'%'};return _0x506d73;})});}_0x45084b=_[_0xd84e('0x44')]({},_0x45084b,_0x1c01ed['options']);return _0x3a998f[_0xd84e('0x74')](_0x45084b);}})[_0xd84e('0x28')](function(_0x2b1db7){if(!_[_0xd84e('0x76')](_0x2b1db7)){var _0x42c4e7=toCsv(_0x2b1db7);var _0x5c87b6=Date[_0xd84e('0x77')]();fs[_0xd84e('0x78')](util[_0xd84e('0x75')](_0xd84e('0x79'),_0x3a998f['id'],_0x5c87b6),_0x42c4e7);_0x5c6474[_0xd84e('0x7a')]('Content-disposition',_0xd84e('0x7b')+util[_0xd84e('0x75')](_0xd84e('0x7c'),_0x3a998f['id'],_0x5c87b6));_0x5c6474[_0xd84e('0x7a')]('Content-type','text/csv');return _0x5c6474[_0xd84e('0x7d')](util[_0xd84e('0x75')](_0xd84e('0x79'),_0x3a998f['id'],_0x5c87b6));}else{return _0x5c6474[_0xd84e('0x2c')](0xcc);}})[_0xd84e('0x4a')](handleError(_0x5c6474,null));};exports['addCustomField']=function(_0x11dcb2,_0x3daa76,_0x40937b){var _0x17b165;delete _0x11dcb2['body']['id'];return db[_0xd84e('0x32')][_0xd84e('0x5c')]({'where':{'id':_0x11dcb2[_0xd84e('0x4c')]['id']}})[_0xd84e('0x28')](handleEntityNotFound(_0x3daa76,null))[_0xd84e('0x28')](function(_0x477fd0){if(_0x477fd0){return db[_0xd84e('0x7e')]['transaction'](function(_0x4848b7){return db[_0xd84e('0x6f')]['create'](_0x11dcb2[_0xd84e('0x57')],{'transaction':_0x4848b7})['then'](function(_0x484621){_0x17b165=_0x484621;return _0x477fd0['addCustomFields'](_0x484621,{'transaction':_0x4848b7});})[_0xd84e('0x28')](function(){var _0x5b2409={'type':db[_0xd84e('0x7f')][_0xd84e('0x80')],'transaction':_0x4848b7};switch(_0x11dcb2['body'][_0xd84e('0x34')]){case'text':_0x5b2409[_0xd84e('0x34')]=db[_0xd84e('0x7f')]['TEXT'];break;case _0xd84e('0x81'):_0x5b2409[_0xd84e('0x34')]=db[_0xd84e('0x7f')]['INTEGER'];break;case _0xd84e('0x82'):_0x5b2409[_0xd84e('0x34')]=db['Sequelize'][_0xd84e('0x83')];_0x5b2409[_0xd84e('0x84')]=![];break;default:}return db[_0xd84e('0x7e')][_0xd84e('0x85')][_0xd84e('0x86')]('cm_contacts',util[_0xd84e('0x75')](_0xd84e('0x87'),_0x17b165['id']),_0x5b2409);})[_0xd84e('0x28')](function(){return _0x17b165;});});}})['then'](respondWithResult(_0x3daa76,null))[_0xd84e('0x4a')](handleError(_0x3daa76,null));};exports[_0xd84e('0x88')]=function(_0x33d32e,_0x3fb996,_0x3f02cf){var _0x5088b7={};var _0xaafa85={};var _0x11c317;var _0x3c68d5;return db['CmList'][_0xd84e('0x5c')]({'where':{'id':_0x33d32e[_0xd84e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3fb996,null))[_0xd84e('0x28')](function(_0x3c3af8){if(_0x3c3af8){_0x11c317=_0x3c3af8;_0xaafa85[_0xd84e('0x36')]=_[_0xd84e('0x37')](db[_0xd84e('0x6f')][_0xd84e('0x4d')]);_0xaafa85[_0xd84e('0x38')]=_['keys'](_0x33d32e['query']);_0xaafa85[_0xd84e('0x39')]=_[_0xd84e('0x3b')](_0xaafa85[_0xd84e('0x36')],_0xaafa85['query']);_0x5088b7[_0xd84e('0x3a')]=_[_0xd84e('0x3b')](_0xaafa85[_0xd84e('0x36')],qs[_0xd84e('0x3c')](_0x33d32e[_0xd84e('0x38')][_0xd84e('0x3c')]));_0x5088b7[_0xd84e('0x3a')]=_0x5088b7[_0xd84e('0x3a')]['length']?_0x5088b7['attributes']:_0xaafa85[_0xd84e('0x36')];_0x5088b7[_0xd84e('0x3e')]=qs[_0xd84e('0x3f')](_0x33d32e[_0xd84e('0x38')]['sort']);_0x5088b7['where']=qs[_0xd84e('0x39')](_[_0xd84e('0x5f')](_0x33d32e[_0xd84e('0x38')],_0xaafa85['filters']));_0x5088b7[_0xd84e('0x40')]=_[_0xd84e('0x44')](_0x5088b7[_0xd84e('0x40')],{'$or':[{'ListId':_0x3c3af8['id']},{'ListId':null}]});if(_0x33d32e[_0xd84e('0x38')]['filter']){_0x5088b7[_0xd84e('0x40')]=_[_0xd84e('0x44')](_0x5088b7[_0xd84e('0x40')],{'$or':_['map'](_0x5088b7[_0xd84e('0x3a')],function(_0x4b7af3){var _0x24c3d8={};_0x24c3d8[_0x4b7af3]={'$like':'%'+_0x33d32e['query'][_0xd84e('0x43')]+'%'};return _0x24c3d8;})});}_0x5088b7=_[_0xd84e('0x44')]({},_0x5088b7,_0x33d32e[_0xd84e('0x45')]);return db[_0xd84e('0x6f')][_0xd84e('0x89')](_0x5088b7);}})[_0xd84e('0x28')](respondWithResult(_0x3fb996,null))[_0xd84e('0x4a')](handleError(_0x3fb996,null));};exports[_0xd84e('0x8a')]=function(_0x5ad3d5,_0x76bf30,_0x221e46){return db[_0xd84e('0x32')][_0xd84e('0x54')]({'where':{'id':_0x5ad3d5[_0xd84e('0x4c')]['id']}})[_0xd84e('0x28')](handleEntityNotFound(_0x76bf30,null))[_0xd84e('0x28')](function(_0x371f72){if(_0x371f72){return _0x371f72[_0xd84e('0x8a')](_0x5ad3d5[_0xd84e('0x57')][_0xd84e('0x62')],_[_0xd84e('0x6a')](_0x5ad3d5[_0xd84e('0x57')],[_0xd84e('0x62'),'id'])||{})[_0xd84e('0x8b')](function(_0x507a09){for(var _0x4f7c42=0x0;_0x4f7c42<_0x5ad3d5['body'][_0xd84e('0x62')][_0xd84e('0x5d')];_0x4f7c42+=0x1){socket['emit'](_0xd84e('0x8c'),{'UserId':Number(_0x5ad3d5[_0xd84e('0x57')][_0xd84e('0x62')][_0x4f7c42]),'CmListId':Number(_0x5ad3d5['params']['id'])});}return _0x507a09;});}})[_0xd84e('0x28')](respondWithResult(_0x76bf30,null))[_0xd84e('0x4a')](handleError(_0x76bf30,null));};exports['removeAgents']=function(_0x550741,_0x2aa49d,_0x2241b1){return db[_0xd84e('0x32')][_0xd84e('0x54')]({'where':{'id':_0x550741['params']['id']}})[_0xd84e('0x28')](handleEntityNotFound(_0x2aa49d,null))[_0xd84e('0x28')](function(_0x1d4157){if(_0x1d4157){return _0x1d4157[_0xd84e('0x8d')](_0x550741[_0xd84e('0x38')][_0xd84e('0x62')])[_0xd84e('0x28')](function(){if(_[_0xd84e('0x66')](_0x550741['query']['ids'])){for(var _0x8de9f2=0x0;_0x8de9f2<_0x550741[_0xd84e('0x38')][_0xd84e('0x62')][_0xd84e('0x5d')];_0x8de9f2+=0x1){socket[_0xd84e('0x8e')](_0xd84e('0x8f'),{'UserId':Number(_0x550741[_0xd84e('0x38')][_0xd84e('0x62')][_0x8de9f2]),'CmListId':Number(_0x550741[_0xd84e('0x4c')]['id'])});}}else{socket['emit'](_0xd84e('0x8f'),{'UserId':Number(_0x550741[_0xd84e('0x38')][_0xd84e('0x62')]),'CmListId':Number(_0x550741['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2aa49d,null))['catch'](handleError(_0x2aa49d,null));};exports[_0xd84e('0x90')]=function(_0x4d43e2,_0xf97e3b,_0x8d1abf){var _0x321181={};var _0x1a6ad0={};var _0xe4a86a;var _0x18d938;return db['CmList'][_0xd84e('0x5c')]({'where':{'id':_0x4d43e2[_0xd84e('0x4c')]['id']}})[_0xd84e('0x28')](handleEntityNotFound(_0xf97e3b,null))[_0xd84e('0x28')](function(_0x179cf4){if(_0x179cf4){_0xe4a86a=_0x179cf4;_0x1a6ad0['model']=_[_0xd84e('0x37')](db[_0xd84e('0x91')]['rawAttributes']);_0x1a6ad0['query']=_['keys'](_0x4d43e2[_0xd84e('0x38')]);_0x1a6ad0[_0xd84e('0x39')]=_[_0xd84e('0x3b')](_0x1a6ad0[_0xd84e('0x36')],_0x1a6ad0[_0xd84e('0x38')]);_0x321181[_0xd84e('0x3a')]=_['intersection'](_0x1a6ad0[_0xd84e('0x36')],qs[_0xd84e('0x3c')](_0x4d43e2[_0xd84e('0x38')][_0xd84e('0x3c')]));_0x321181[_0xd84e('0x3a')]=_0x321181[_0xd84e('0x3a')][_0xd84e('0x5d')]?_0x321181[_0xd84e('0x3a')]:_0x1a6ad0['model'];_0x321181['order']=qs[_0xd84e('0x3f')](_0x4d43e2[_0xd84e('0x38')]['sort']);_0x321181[_0xd84e('0x40')]=qs[_0xd84e('0x39')](_[_0xd84e('0x5f')](_0x4d43e2[_0xd84e('0x38')],_0x1a6ad0[_0xd84e('0x39')]));if(_0x4d43e2[_0xd84e('0x38')][_0xd84e('0x43')]){_0x321181[_0xd84e('0x40')]=_[_0xd84e('0x44')](_0x321181[_0xd84e('0x40')],{'$or':_[_0xd84e('0x31')](_0x321181[_0xd84e('0x3a')],function(_0x8554e5){var _0x3e6004={};_0x3e6004[_0x8554e5]={'$like':'%'+_0x4d43e2[_0xd84e('0x38')][_0xd84e('0x43')]+'%'};return _0x3e6004;})});}_0x321181=_[_0xd84e('0x44')]({},_0x321181,_0x4d43e2[_0xd84e('0x45')]);return _0xe4a86a['getAgents'](_0x321181);}})[_0xd84e('0x28')](function(_0x10b69f){if(_0x10b69f){_0x18d938=_0x10b69f[_0xd84e('0x5d')];if(!_0x4d43e2[_0xd84e('0x38')]['hasOwnProperty'](_0xd84e('0x3d'))){_0x321181['limit']=qs[_0xd84e('0x23')](_0x4d43e2[_0xd84e('0x38')][_0xd84e('0x23')]);_0x321181['offset']=qs[_0xd84e('0x21')](_0x4d43e2[_0xd84e('0x38')][_0xd84e('0x21')]);}return _0xe4a86a[_0xd84e('0x90')](_0x321181);}})[_0xd84e('0x28')](function(_0x56e34f){if(_0x56e34f){return _0x56e34f?{'count':_0x18d938,'rows':_0x56e34f}:null;}})[_0xd84e('0x28')](respondWithResult(_0xf97e3b,null))[_0xd84e('0x4a')](handleError(_0xf97e3b,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index f1d8b61..639a961 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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0x55ca,0x126));var _0xa55c=function(_0x1c1509,_0x2dfa81){_0x1c1509=_0x1c1509-0x0;var _0xf11b7=_0x55ca[_0x1c1509];return _0xf11b7;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x22431e,_0x5af0a3){_0x22431e=_0x22431e-0x0;var _0xd978e9=_0x5fc3[_0x22431e];return _0xd978e9;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 8c7a455..e71975a 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 _0x6324=['define','cm_lists','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports'];(function(_0x10e334,_0x30ccca){var _0x199374=function(_0x1ef813){while(--_0x1ef813){_0x10e334['push'](_0x10e334['shift']());}};_0x199374(++_0x30ccca);}(_0x6324,0x142));var _0x4632=function(_0xc587ed,_0x11cbc2){_0xc587ed=_0xc587ed-0x0;var _0x41d137=_0x6324[_0xc587ed];return _0x41d137;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var logger=require(_0x4632('0x2'))(_0x4632('0x3'));var moment=require('moment');var BPromise=require(_0x4632('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4632('0x5'));var rimraf=require('rimraf');var config=require(_0x4632('0x6'));var attributes=require('./cmList.attributes');module[_0x4632('0x7')]=function(_0x24aba6,_0x1f3077){return _0x24aba6[_0x4632('0x8')]('CmList',attributes,{'tableName':_0x4632('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3cd=['path','rimraf','../../config/environment','exports','define','CmList','cm_lists','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x35823b,_0x1ccb9a){var _0x2dd1ee=function(_0x40e32a){while(--_0x40e32a){_0x35823b['push'](_0x35823b['shift']());}};_0x2dd1ee(++_0x1ccb9a);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0xf3cd[_0x496333];return _0x44256e;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./cmList.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 762803c..ce45375 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 _0x8d71=['client','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','request\x20sent','stringify','error','code','message','CmList,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x12254f,_0x100cfe){var _0x3a4fa2=function(_0x1ce891){while(--_0x1ce891){_0x12254f['push'](_0x12254f['shift']());}};_0x3a4fa2(++_0x100cfe);}(_0x8d71,0xec));var _0x18d7=function(_0x13d4ef,_0x36ac0a){_0x13d4ef=_0x13d4ef-0x0;var _0x292efc=_0x8d71[_0x13d4ef];return _0x292efc;};'use strict';var _=require(_0x18d7('0x0'));var util=require(_0x18d7('0x1'));var moment=require(_0x18d7('0x2'));var BPromise=require(_0x18d7('0x3'));var rs=require(_0x18d7('0x4'));var fs=require('fs');var Redis=require(_0x18d7('0x5'));var db=require(_0x18d7('0x6'))['db'];var utils=require(_0x18d7('0x7'));var logger=require(_0x18d7('0x8'))(_0x18d7('0x9'));var config=require(_0x18d7('0xa'));var jayson=require(_0x18d7('0xb'));var client=jayson[_0x18d7('0xc')][_0x18d7('0xd')]({'port':0x232a});config['redis']=_[_0x18d7('0xe')](config[_0x18d7('0xf')],{'host':_0x18d7('0x10'),'port':0x18eb});var socket=require(_0x18d7('0x11'))(new Redis(config['redis']));require(_0x18d7('0x12'))[_0x18d7('0x13')](socket);function respondWithRpcPromise(_0xbfab40,_0x1ca152,_0x2f811c){return new BPromise(function(_0x359fbf,_0x11f40c){return client[_0x18d7('0x14')](_0xbfab40,_0x2f811c)[_0x18d7('0x15')](function(_0x250859){logger['info']('CmList,\x20%s,\x20%s',_0x1ca152,_0x18d7('0x16'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x1ca152,_0x18d7('0x16'),JSON[_0x18d7('0x17')](_0x250859));if(_0x250859[_0x18d7('0x18')]){if(_0x250859['error'][_0x18d7('0x19')]===0x1f4){logger[_0x18d7('0x18')]('CmList,\x20%s,\x20%s',_0x1ca152,_0x250859[_0x18d7('0x18')][_0x18d7('0x1a')]);return _0x11f40c(_0x250859[_0x18d7('0x18')][_0x18d7('0x1a')]);}logger[_0x18d7('0x18')](_0x18d7('0x1b'),_0x1ca152,_0x250859['error'][_0x18d7('0x1a')]);return _0x359fbf(_0x250859[_0x18d7('0x18')][_0x18d7('0x1a')]);}else{logger[_0x18d7('0x1c')](_0x18d7('0x1b'),_0x1ca152,_0x18d7('0x16'));_0x359fbf(_0x250859[_0x18d7('0x1d')][_0x18d7('0x1a')]);}})[_0x18d7('0x1e')](function(_0x3d6041){logger[_0x18d7('0x18')](_0x18d7('0x1b'),_0x1ca152,_0x3d6041);_0x11f40c(_0x3d6041);});});} \ No newline at end of file +var _0x67cb=['request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./cmList.socket','register'];(function(_0x28afa8,_0x2ddf7b){var _0x384304=function(_0x3fff20){while(--_0x3fff20){_0x28afa8['push'](_0x28afa8['shift']());}};_0x384304(++_0x2ddf7b);}(_0x67cb,0x177));var _0xb67c=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x67cb[_0x31a371];return _0x2a5bd6;};'use strict';var _=require('lodash');var util=require(_0xb67c('0x0'));var moment=require('moment');var BPromise=require(_0xb67c('0x1'));var rs=require(_0xb67c('0x2'));var fs=require('fs');var Redis=require(_0xb67c('0x3'));var db=require(_0xb67c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb67c('0x5'))(_0xb67c('0x6'));var config=require(_0xb67c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb67c('0x8')][_0xb67c('0x9')]({'port':0x232a});config[_0xb67c('0xa')]=_['defaults'](config[_0xb67c('0xa')],{'host':_0xb67c('0xb'),'port':0x18eb});var socket=require(_0xb67c('0xc'))(new Redis(config[_0xb67c('0xa')]));require(_0xb67c('0xd'))[_0xb67c('0xe')](socket);function respondWithRpcPromise(_0x46479d,_0x463525,_0x246626){return new BPromise(function(_0xc079b,_0x2d99c8){return client[_0xb67c('0xf')](_0x46479d,_0x246626)['then'](function(_0xaab718){logger[_0xb67c('0x10')](_0xb67c('0x11'),_0x463525,_0xb67c('0x12'));logger[_0xb67c('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x463525,_0xb67c('0x12'),JSON[_0xb67c('0x14')](_0xaab718));if(_0xaab718[_0xb67c('0x15')]){if(_0xaab718[_0xb67c('0x15')][_0xb67c('0x16')]===0x1f4){logger[_0xb67c('0x15')](_0xb67c('0x11'),_0x463525,_0xaab718[_0xb67c('0x15')][_0xb67c('0x17')]);return _0x2d99c8(_0xaab718[_0xb67c('0x15')]['message']);}logger[_0xb67c('0x15')](_0xb67c('0x11'),_0x463525,_0xaab718[_0xb67c('0x15')]['message']);return _0xc079b(_0xaab718[_0xb67c('0x15')][_0xb67c('0x17')]);}else{logger[_0xb67c('0x10')]('CmList,\x20%s,\x20%s',_0x463525,'request\x20sent');_0xc079b(_0xaab718[_0xb67c('0x18')]['message']);}})[_0xb67c('0x19')](function(_0x14e59e){logger[_0xb67c('0x15')](_0xb67c('0x11'),_0x463525,_0x14e59e);_0x2d99c8(_0x14e59e);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 7ba3914..f917949 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 _0x6753=['./cmList.events','save','remove','emit','register','length'];(function(_0xdf7c27,_0x25182a){var _0x1f8430=function(_0x33199a){while(--_0x33199a){_0xdf7c27['push'](_0xdf7c27['shift']());}};_0x1f8430(++_0x25182a);}(_0x6753,0x66));var _0x3675=function(_0x1d5957,_0x565d13){_0x1d5957=_0x1d5957-0x0;var _0x3234f8=_0x6753[_0x1d5957];return _0x3234f8;};'use strict';var CmListEvents=require(_0x3675('0x0'));var events=[_0x3675('0x1'),_0x3675('0x2'),'update'];function createListener(_0xab8e48,_0x4d98c7){return function(_0x4839cf){_0x4d98c7[_0x3675('0x3')](_0xab8e48,_0x4839cf);};}function removeListener(_0x560161,_0x5654b4){return function(){CmListEvents['removeListener'](_0x560161,_0x5654b4);};}exports[_0x3675('0x4')]=function(_0x33ce54){for(var _0x440921=0x0,_0x401add=events[_0x3675('0x5')];_0x440921<_0x401add;_0x440921++){var _0x22609f=events[_0x440921];var _0x298c4c=createListener('cmList:'+_0x22609f,_0x33ce54);CmListEvents['on'](_0x22609f,_0x298c4c);}}; \ No newline at end of file +var _0xad9d=['removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x283324,_0x4f7606){var _0x54ed22=function(_0x113347){while(--_0x113347){_0x283324['push'](_0x283324['shift']());}};_0x54ed22(++_0x4f7606);}(_0xad9d,0x136));var _0xdad9=function(_0x255cac,_0x1ea20b){_0x255cac=_0x255cac-0x0;var _0x37d931=_0xad9d[_0x255cac];return _0x37d931;};'use strict';var CmListEvents=require(_0xdad9('0x0'));var events=[_0xdad9('0x1'),'remove','update'];function createListener(_0x485847,_0x246b2d){return function(_0x4280c1){_0x246b2d['emit'](_0x485847,_0x4280c1);};}function removeListener(_0x475ccd,_0x1e9b03){return function(){CmListEvents[_0xdad9('0x2')](_0x475ccd,_0x1e9b03);};}exports[_0xdad9('0x3')]=function(_0x46db57){for(var _0x263da8=0x0,_0xc71682=events[_0xdad9('0x4')];_0x263da8<_0xc71682;_0x263da8++){var _0x5dc234=events[_0x263da8];var _0x16f21e=createListener(_0xdad9('0x5')+_0x5dc234,_0x46db57);CmListEvents['on'](_0x5dc234,_0x16f21e);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 899eb1b..d59dbd8 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 _0x1bbb=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','./cmList.controller','get','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','post','addDisposition','addContacts','/:id/users','addAgents','put','delete','destroy','removeAgents'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x1bbb,0x97));var _0xb1bb=function(_0x1f2837,_0x190b0e){_0x1f2837=_0x1f2837-0x0;var _0x266a41=_0x1bbb[_0x1f2837];return _0x266a41;};'use strict';var multer=require('multer');var util=require(_0xb1bb('0x0'));var path=require(_0xb1bb('0x1'));var timeout=require(_0xb1bb('0x2'));var express=require(_0xb1bb('0x3'));var router=express[_0xb1bb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb1bb('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb1bb('0x6'));router[_0xb1bb('0x7')]('/',auth[_0xb1bb('0x8')](),controller['index']);router['get']('/describe',auth[_0xb1bb('0x8')](),controller[_0xb1bb('0x9')]);router[_0xb1bb('0x7')](_0xb1bb('0xa'),auth[_0xb1bb('0x8')](),controller[_0xb1bb('0xb')]);router[_0xb1bb('0x7')](_0xb1bb('0xc'),auth[_0xb1bb('0x8')](),controller[_0xb1bb('0xd')]);router[_0xb1bb('0x7')](_0xb1bb('0xe'),auth['isAuthenticated'](),controller[_0xb1bb('0xf')]);router[_0xb1bb('0x7')](_0xb1bb('0x10'),auth[_0xb1bb('0x8')](),controller[_0xb1bb('0x11')]);router[_0xb1bb('0x7')](_0xb1bb('0x12'),auth[_0xb1bb('0x8')](),controller[_0xb1bb('0x13')]);router['get']('/:id/users',auth[_0xb1bb('0x8')](),controller['getAgents']);router[_0xb1bb('0x14')]('/',auth[_0xb1bb('0x8')](),controller['create']);router[_0xb1bb('0x14')](_0xb1bb('0xc'),auth[_0xb1bb('0x8')](),controller[_0xb1bb('0x15')]);router[_0xb1bb('0x14')](_0xb1bb('0xe'),auth[_0xb1bb('0x8')](),controller[_0xb1bb('0x16')]);router[_0xb1bb('0x14')]('/:id/fields',auth[_0xb1bb('0x8')](),controller['addCustomField']);router[_0xb1bb('0x14')](_0xb1bb('0x17'),auth[_0xb1bb('0x8')](),controller[_0xb1bb('0x18')]);router[_0xb1bb('0x19')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb1bb('0x1a')](_0xb1bb('0xa'),auth[_0xb1bb('0x8')](),controller[_0xb1bb('0x1b')]);router[_0xb1bb('0x1a')](_0xb1bb('0xc'),auth[_0xb1bb('0x8')](),controller['removeDispositions']);router[_0xb1bb('0x1a')]('/:id/users',auth[_0xb1bb('0x8')](),controller[_0xb1bb('0x1c')]);module[_0xb1bb('0x1d')]=router; \ No newline at end of file +var _0x0b73=['/:id','/:id/dispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe'];(function(_0x4e8401,_0x51b328){var _0x17269f=function(_0x35ac65){while(--_0x35ac65){_0x4e8401['push'](_0x4e8401['shift']());}};_0x17269f(++_0x51b328);}(_0x0b73,0xe8));var _0x30b7=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x0b73[_0x3740fe];return _0x55492b;};'use strict';var multer=require('multer');var util=require(_0x30b7('0x0'));var path=require(_0x30b7('0x1'));var timeout=require(_0x30b7('0x2'));var express=require('express');var router=express[_0x30b7('0x3')]();var fs_extra=require(_0x30b7('0x4'));var auth=require(_0x30b7('0x5'));var interaction=require(_0x30b7('0x6'));var config=require(_0x30b7('0x7'));var controller=require(_0x30b7('0x8'));router[_0x30b7('0x9')]('/',auth[_0x30b7('0xa')](),controller[_0x30b7('0xb')]);router[_0x30b7('0x9')](_0x30b7('0xc'),auth[_0x30b7('0xa')](),controller['describe']);router[_0x30b7('0x9')](_0x30b7('0xd'),auth[_0x30b7('0xa')](),controller['show']);router[_0x30b7('0x9')](_0x30b7('0xe'),auth[_0x30b7('0xa')](),controller['getDispositions']);router['get'](_0x30b7('0xf'),auth[_0x30b7('0xa')](),controller['getContacts']);router['get'](_0x30b7('0x10'),auth[_0x30b7('0xa')](),controller[_0x30b7('0x11')]);router[_0x30b7('0x9')](_0x30b7('0x12'),auth['isAuthenticated'](),controller[_0x30b7('0x13')]);router[_0x30b7('0x9')](_0x30b7('0x14'),auth[_0x30b7('0xa')](),controller[_0x30b7('0x15')]);router[_0x30b7('0x16')]('/',auth['isAuthenticated'](),controller[_0x30b7('0x17')]);router[_0x30b7('0x16')](_0x30b7('0xe'),auth[_0x30b7('0xa')](),controller[_0x30b7('0x18')]);router[_0x30b7('0x16')]('/:id/contacts',auth[_0x30b7('0xa')](),controller[_0x30b7('0x19')]);router[_0x30b7('0x16')](_0x30b7('0x12'),auth['isAuthenticated'](),controller[_0x30b7('0x1a')]);router[_0x30b7('0x16')](_0x30b7('0x14'),auth[_0x30b7('0xa')](),controller[_0x30b7('0x1b')]);router[_0x30b7('0x1c')](_0x30b7('0xd'),auth[_0x30b7('0xa')](),controller[_0x30b7('0x1d')]);router[_0x30b7('0x1e')](_0x30b7('0xd'),auth[_0x30b7('0xa')](),controller[_0x30b7('0x1f')]);router[_0x30b7('0x1e')](_0x30b7('0xe'),auth['isAuthenticated'](),controller[_0x30b7('0x20')]);router[_0x30b7('0x1e')](_0x30b7('0x14'),auth['isAuthenticated'](),controller[_0x30b7('0x21')]);module[_0x30b7('0x22')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 4e537f5..5200ac2 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 _0x3267=['getDataValue','field','STRING','sequelize','exports','VIRTUAL'];(function(_0x95d5,_0x286dfd){var _0x2bc20a=function(_0xf64ef3){while(--_0xf64ef3){_0x95d5['push'](_0x95d5['shift']());}};_0x2bc20a(++_0x286dfd);}(_0x3267,0x1b9));var _0x7326=function(_0x7275e9,_0x321fa5){_0x7275e9=_0x7275e9-0x0;var _0x17b99d=_0x3267[_0x7275e9];return _0x17b99d;};'use strict';var Sequelize=require(_0x7326('0x0'));module[_0x7326('0x1')]={'name':{'type':Sequelize[_0x7326('0x2')],'get':function(_0x18133c){return this[_0x7326('0x3')](_0x7326('0x4'));}},'field':{'type':Sequelize[_0x7326('0x5')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x7326('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x870e=['sequelize','exports','field','STRING'];(function(_0xfd5f37,_0x24a79c){var _0x11bd01=function(_0x4ae9bd){while(--_0x4ae9bd){_0xfd5f37['push'](_0xfd5f37['shift']());}};_0x11bd01(++_0x24a79c);}(_0x870e,0x114));var _0xe870=function(_0x1ca407,_0x239fa5){_0x1ca407=_0x1ca407-0x0;var _0x5dabdc=_0x870e[_0x1ca407];return _0x5dabdc;};'use strict';var Sequelize=require(_0xe870('0x0'));module[_0xe870('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x25d4a3){return this['getDataValue'](_0xe870('0x2'));}},'field':{'type':Sequelize[_0xe870('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xe870('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 86c21da..6199a2a 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 _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0xff72e6,_0x22660f){var _0x11253b=function(_0x46e250){while(--_0x46e250){_0xff72e6['push'](_0xff72e6['shift']());}};_0x11253b(++_0x22660f);}(_0x7a54,0x106));var _0x47a5=function(_0x390f6b,_0x288766){_0x390f6b=_0x390f6b-0x0;var _0x139555=_0x7a54[_0x390f6b];return _0x139555;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x1eb06f,_0x193fcb){var _0x22e7f0=function(_0x55c601){while(--_0x55c601){_0x1eb06f['push'](_0x1eb06f['shift']());}};_0x22e7f0(++_0x193fcb);}(_0x7a54,0x106));var _0x47a5=function(_0xcbd9d0,_0x33e61d){_0xcbd9d0=_0xcbd9d0-0x0;var _0x14e063=_0x7a54[_0xcbd9d0];return _0x14e063;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index efee182..12c9436 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 _0xc133=['exports','define','lodash','../../config/logger','api','bluebird','request-promise','./condition.attributes'];(function(_0x5e9f0b,_0x11c4a9){var _0x2fecf3=function(_0x26f616){while(--_0x26f616){_0x5e9f0b['push'](_0x5e9f0b['shift']());}};_0x2fecf3(++_0x11c4a9);}(_0xc133,0x142));var _0x3c13=function(_0x440f62,_0x3a8f99){_0x440f62=_0x440f62-0x0;var _0x1d6c50=_0xc133[_0x440f62];return _0x1d6c50;};'use strict';var _=require(_0x3c13('0x0'));var util=require('util');var logger=require(_0x3c13('0x1'))(_0x3c13('0x2'));var moment=require('moment');var BPromise=require(_0x3c13('0x3'));var rp=require(_0x3c13('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3c13('0x5'));module[_0x3c13('0x6')]=function(_0x7dc570,_0x496e75){return _0x7dc570[_0x3c13('0x7')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80b1=['request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','Condition','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x517601,_0x173b35){var _0x1d470a=function(_0x324bae){while(--_0x324bae){_0x517601['push'](_0x517601['shift']());}};_0x1d470a(++_0x173b35);}(_0x80b1,0x6f));var _0x180b=function(_0x34db21,_0x4256bb){_0x34db21=_0x34db21-0x0;var _0x5e7d82=_0x80b1[_0x34db21];return _0x5e7d82;};'use strict';var _=require(_0x180b('0x0'));var util=require(_0x180b('0x1'));var logger=require(_0x180b('0x2'))(_0x180b('0x3'));var moment=require(_0x180b('0x4'));var BPromise=require(_0x180b('0x5'));var rp=require(_0x180b('0x6'));var fs=require('fs');var path=require(_0x180b('0x7'));var rimraf=require(_0x180b('0x8'));var config=require(_0x180b('0x9'));var attributes=require(_0x180b('0xa'));module[_0x180b('0xb')]=function(_0x33ea2d,_0x29680f){return _0x33ea2d['define'](_0x180b('0xc'),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 4f01191..6370278 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 _0x4c7c=['util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x3e6d0f,_0x2d6184){var _0x84f3e6=function(_0x45ca51){while(--_0x45ca51){_0x3e6d0f['push'](_0x3e6d0f['shift']());}};_0x84f3e6(++_0x2d6184);}(_0x4c7c,0x13a));var _0xc4c7=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0x4c7c[_0x361d3f];return _0x320229;};'use strict';var _=require(_0xc4c7('0x0'));var util=require(_0xc4c7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc4c7('0x2'));var fs=require('fs');var Redis=require(_0xc4c7('0x3'));var db=require(_0xc4c7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc4c7('0x5'))(_0xc4c7('0x6'));var config=require(_0xc4c7('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc4c7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13117b,_0x5c0148,_0x566748){return new BPromise(function(_0x5175de,_0x4da81a){return client[_0xc4c7('0x9')](_0x13117b,_0x566748)['then'](function(_0x2812e4){logger[_0xc4c7('0xa')](_0xc4c7('0xb'),_0x5c0148,'request\x20sent');logger[_0xc4c7('0xc')](_0xc4c7('0xd'),_0x5c0148,_0xc4c7('0xe'),JSON[_0xc4c7('0xf')](_0x2812e4));if(_0x2812e4['error']){if(_0x2812e4[_0xc4c7('0x10')][_0xc4c7('0x11')]===0x1f4){logger[_0xc4c7('0x10')](_0xc4c7('0xb'),_0x5c0148,_0x2812e4[_0xc4c7('0x10')][_0xc4c7('0x12')]);return _0x4da81a(_0x2812e4[_0xc4c7('0x10')]['message']);}logger[_0xc4c7('0x10')](_0xc4c7('0xb'),_0x5c0148,_0x2812e4[_0xc4c7('0x10')][_0xc4c7('0x12')]);return _0x5175de(_0x2812e4[_0xc4c7('0x10')][_0xc4c7('0x12')]);}else{logger[_0xc4c7('0xa')]('Condition,\x20%s,\x20%s',_0x5c0148,_0xc4c7('0xe'));_0x5175de(_0x2812e4[_0xc4c7('0x13')][_0xc4c7('0x12')]);}})[_0xc4c7('0x14')](function(_0x1a8536){logger[_0xc4c7('0x10')]('Condition,\x20%s,\x20%s',_0x5c0148,_0x1a8536);_0x4da81a(_0x1a8536);});});} \ No newline at end of file +var _0x05eb=['catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Condition,\x20%s,\x20%s','result'];(function(_0x11a846,_0x2c29cb){var _0x2b8c28=function(_0x2b8a43){while(--_0x2b8a43){_0x11a846['push'](_0x11a846['shift']());}};_0x2b8c28(++_0x2c29cb);}(_0x05eb,0x135));var _0xb05e=function(_0x3a86b1,_0x4c3aaa){_0x3a86b1=_0x3a86b1-0x0;var _0x2726c7=_0x05eb[_0x3a86b1];return _0x2726c7;};'use strict';var _=require(_0xb05e('0x0'));var util=require(_0xb05e('0x1'));var moment=require(_0xb05e('0x2'));var BPromise=require(_0xb05e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb05e('0x4'));var logger=require(_0xb05e('0x5'))(_0xb05e('0x6'));var config=require('../../config/environment');var jayson=require(_0xb05e('0x7'));var client=jayson['client'][_0xb05e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23b1c6,_0x22e1a6,_0x107d00){return new BPromise(function(_0x4aee1b,_0x1ae328){return client[_0xb05e('0x9')](_0x23b1c6,_0x107d00)[_0xb05e('0xa')](function(_0x444041){logger[_0xb05e('0xb')]('Condition,\x20%s,\x20%s',_0x22e1a6,_0xb05e('0xc'));logger[_0xb05e('0xd')](_0xb05e('0xe'),_0x22e1a6,'request\x20sent',JSON[_0xb05e('0xf')](_0x444041));if(_0x444041[_0xb05e('0x10')]){if(_0x444041['error'][_0xb05e('0x11')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x22e1a6,_0x444041[_0xb05e('0x10')][_0xb05e('0x12')]);return _0x1ae328(_0x444041[_0xb05e('0x10')][_0xb05e('0x12')]);}logger[_0xb05e('0x10')](_0xb05e('0x13'),_0x22e1a6,_0x444041[_0xb05e('0x10')]['message']);return _0x4aee1b(_0x444041[_0xb05e('0x10')]['message']);}else{logger[_0xb05e('0xb')](_0xb05e('0x13'),_0x22e1a6,'request\x20sent');_0x4aee1b(_0x444041[_0xb05e('0x14')]['message']);}})[_0xb05e('0x15')](function(_0x18e63f){logger[_0xb05e('0x10')](_0xb05e('0x13'),_0x22e1a6,_0x18e63f);_0x1ae328(_0x18e63f);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 49ba29a..7ccd58d 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 _0x6bcc=['isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete'];(function(_0x168737,_0x2a8004){var _0xd3d920=function(_0x1ccddf){while(--_0x1ccddf){_0x168737['push'](_0x168737['shift']());}};_0xd3d920(++_0x2a8004);}(_0x6bcc,0x18f));var _0xc6bc=function(_0x5c127a,_0x19f73d){_0x5c127a=_0x5c127a-0x0;var _0x368ad7=_0x6bcc[_0x5c127a];return _0x368ad7;};'use strict';var multer=require(_0xc6bc('0x0'));var util=require(_0xc6bc('0x1'));var path=require(_0xc6bc('0x2'));var timeout=require(_0xc6bc('0x3'));var express=require(_0xc6bc('0x4'));var router=express[_0xc6bc('0x5')]();var fs_extra=require(_0xc6bc('0x6'));var auth=require(_0xc6bc('0x7'));var interaction=require(_0xc6bc('0x8'));var config=require(_0xc6bc('0x9'));var controller=require(_0xc6bc('0xa'));router[_0xc6bc('0xb')](_0xc6bc('0xc'),auth['isAuthenticated'](),controller[_0xc6bc('0xd')]);router[_0xc6bc('0xe')](_0xc6bc('0xc'),auth[_0xc6bc('0xf')](),controller[_0xc6bc('0x10')]);module[_0xc6bc('0x11')]=router; \ No newline at end of file +var _0x22c6=['fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','delete','destroy','multer','path','connect-timeout','express','Router'];(function(_0x23daa7,_0x4241f7){var _0x160b90=function(_0x30c5e5){while(--_0x30c5e5){_0x23daa7['push'](_0x23daa7['shift']());}};_0x160b90(++_0x4241f7);}(_0x22c6,0xb1));var _0x622c=function(_0x255622,_0x17d4e2){_0x255622=_0x255622-0x0;var _0xd190df=_0x22c6[_0x255622];return _0xd190df;};'use strict';var multer=require(_0x622c('0x0'));var util=require('util');var path=require(_0x622c('0x1'));var timeout=require(_0x622c('0x2'));var express=require(_0x622c('0x3'));var router=express[_0x622c('0x4')]();var fs_extra=require(_0x622c('0x5'));var auth=require(_0x622c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x622c('0x7'));var controller=require(_0x622c('0x8'));router[_0x622c('0x9')](_0x622c('0xa'),auth[_0x622c('0xb')](),controller['update']);router[_0x622c('0xc')](_0x622c('0xa'),auth[_0x622c('0xb')](),controller[_0x622c('0xd')]);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 e7f8d4c..3bbbfa0 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 _0xb7e7=['STRING','sequelize'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xb7e7[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x132fe4,_0x456195){var _0x201aec=function(_0x2610f1){while(--_0x2610f1){_0x132fe4['push'](_0x132fe4['shift']());}};_0x201aec(++_0x456195);}(_0x757a,0xde));var _0xa757=function(_0x38f22d,_0x28c94c){_0x38f22d=_0x38f22d-0x0;var _0x3cec70=_0x757a[_0x38f22d];return _0x3cec70;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b58a491..f343b0c 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 _0x83a1=['where','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','params','intersection','create','user','CustomDashboards','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','body','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','DashboardItem','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','get','UserProfileResource','then','name','send','Dashboard','rawAttributes','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick'];(function(_0x49ca75,_0x41a8d7){var _0x21fa7d=function(_0x56cecc){while(--_0x56cecc){_0x49ca75['push'](_0x49ca75['shift']());}};_0x21fa7d(++_0x41a8d7);}(_0x83a1,0x11f));var _0x183a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x83a1[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x183a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x183a('0x1'));var jsonpatch=require(_0x183a('0x2'));var rp=require(_0x183a('0x3'));var moment=require(_0x183a('0x4'));var BPromise=require(_0x183a('0x5'));var Mustache=require('mustache');var util=require(_0x183a('0x6'));var path=require(_0x183a('0x7'));var sox=require(_0x183a('0x8'));var csv=require(_0x183a('0x9'));var ejs=require(_0x183a('0xa'));var fs=require('fs');var fs_extra=require(_0x183a('0xb'));var _=require(_0x183a('0xc'));var squel=require(_0x183a('0xd'));var crypto=require('crypto');var jsforce=require(_0x183a('0xe'));var deskjs=require(_0x183a('0xf'));var toCsv=require(_0x183a('0x9'));var querystring=require(_0x183a('0x10'));var Papa=require(_0x183a('0x11'));var Redis=require('ioredis');var authService=require(_0x183a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x183a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x183a('0x14'))(_0x183a('0x15'));var utils=require(_0x183a('0x16'));var config=require(_0x183a('0x17'));var licenseUtil=require(_0x183a('0x18'));var db=require('../../mysqldb')['db'];config[_0x183a('0x19')]=_[_0x183a('0x1a')](config['redis'],{'host':_0x183a('0x1b'),'port':0x18eb});var socket=require(_0x183a('0x1c'))(new Redis(config[_0x183a('0x19')]));require('./dashboard.socket')[_0x183a('0x1d')](socket);function respondWithStatusCode(_0x49dd65,_0x52b793){_0x52b793=_0x52b793||0xcc;return function(_0x347662){if(_0x347662){return _0x49dd65[_0x183a('0x1e')](_0x52b793);}return _0x49dd65['status'](_0x52b793)['end']();};}function respondWithResult(_0x1d0e3d,_0x39bbd7){_0x39bbd7=_0x39bbd7||0xc8;return function(_0x1c4809){if(_0x1c4809){return _0x1d0e3d[_0x183a('0x1f')](_0x39bbd7)[_0x183a('0x20')](_0x1c4809);}};}function respondWithFilteredResult(_0x43b5fa,_0x37f15c){return function(_0x1fd5df){if(_0x1fd5df){var _0x3dccaa=typeof _0x37f15c[_0x183a('0x21')]===_0x183a('0x22')&&typeof _0x37f15c['limit']===_0x183a('0x22');var _0x43251d=_0x1fd5df[_0x183a('0x23')];var _0x1a836f=_0x3dccaa?0x0:_0x37f15c[_0x183a('0x21')];var _0x40b0f0=_0x3dccaa?_0x1fd5df[_0x183a('0x23')]:_0x37f15c[_0x183a('0x21')]+_0x37f15c[_0x183a('0x24')];var _0x407a88;if(_0x40b0f0>=_0x43251d){_0x40b0f0=_0x43251d;_0x407a88=0xc8;}else{_0x407a88=0xce;}_0x43b5fa[_0x183a('0x1f')](_0x407a88);return _0x43b5fa[_0x183a('0x25')](_0x183a('0x26'),_0x1a836f+'-'+_0x40b0f0+'/'+_0x43251d)[_0x183a('0x20')](_0x1fd5df);}return null;};}function patchUpdates(_0x49e16e){return function(_0x23be0b){try{jsonpatch[_0x183a('0x27')](_0x23be0b,_0x49e16e,!![]);}catch(_0x5530e6){return BPromise[_0x183a('0x28')](_0x5530e6);}return _0x23be0b[_0x183a('0x29')]();};}function saveUpdates(_0x458e02,_0x454cab){return function(_0x324659){if(_0x324659){return _0x324659[_0x183a('0x2a')](_0x458e02)['then'](function(_0x4792b0){return _0x4792b0;});}return null;};}function removeEntity(_0x2c4a71,_0x185113){return function(_0x115182){if(_0x115182){return _0x115182['destroy']()['then'](function(){var _0x1e0157=_0x115182[_0x183a('0x2b')]({'plain':!![]});var _0x35c82a='CustomDashboards';return db[_0x183a('0x2c')]['destroy']({'where':{'type':_0x35c82a,'resourceId':_0x1e0157['id']}})[_0x183a('0x2d')](function(){return _0x115182;});})[_0x183a('0x2d')](function(){_0x2c4a71[_0x183a('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x306e7b,_0x3a3eb7){return function(_0x271ee9){if(!_0x271ee9){_0x306e7b[_0x183a('0x1e')](0x194);}return _0x271ee9;};}function handleError(_0x3db671,_0x275796){_0x275796=_0x275796||0x1f4;return function(_0x5c772f){logger['error'](_0x5c772f['stack']);if(_0x5c772f[_0x183a('0x2e')]){delete _0x5c772f[_0x183a('0x2e')];}_0x3db671['status'](_0x275796)[_0x183a('0x2f')](_0x5c772f);};}exports['index']=function(_0x549922,_0x34953d){var _0x1b3568={},_0x12176c={},_0x44fc06={'count':0x0,'rows':[]};var _0x3f7e5f=_['map'](db[_0x183a('0x30')][_0x183a('0x31')],function(_0x10d286){return{'name':_0x10d286['fieldName'],'type':_0x10d286[_0x183a('0x32')][_0x183a('0x33')]};});_0x12176c['model']=_['map'](_0x3f7e5f,'name');_0x12176c[_0x183a('0x34')]=_[_0x183a('0x35')](_0x549922['query']);_0x12176c['filters']=_['intersection'](_0x12176c[_0x183a('0x36')],_0x12176c[_0x183a('0x34')]);_0x1b3568[_0x183a('0x37')]=_['intersection'](_0x12176c[_0x183a('0x36')],qs[_0x183a('0x38')](_0x549922[_0x183a('0x34')]['fields']));_0x1b3568[_0x183a('0x37')]=_0x1b3568[_0x183a('0x37')][_0x183a('0x39')]?_0x1b3568['attributes']:_0x12176c[_0x183a('0x36')];if(!_0x549922[_0x183a('0x34')][_0x183a('0x3a')](_0x183a('0x3b'))){_0x1b3568[_0x183a('0x24')]=qs[_0x183a('0x24')](_0x549922[_0x183a('0x34')][_0x183a('0x24')]);_0x1b3568[_0x183a('0x21')]=qs[_0x183a('0x21')](_0x549922[_0x183a('0x34')][_0x183a('0x21')]);}_0x1b3568[_0x183a('0x3c')]=qs[_0x183a('0x3d')](_0x549922[_0x183a('0x34')][_0x183a('0x3d')]);_0x1b3568['where']=qs[_0x183a('0x3e')](_[_0x183a('0x3f')](_0x549922[_0x183a('0x34')],_0x12176c['filters']),_0x3f7e5f);if(_0x549922[_0x183a('0x34')]['filter']){_0x1b3568[_0x183a('0x40')]=_['merge'](_0x1b3568[_0x183a('0x40')],{'$or':_[_0x183a('0x41')](_0x3f7e5f,function(_0x52cbf3){if(_0x52cbf3[_0x183a('0x32')]!==_0x183a('0x42')){var _0x235184={};_0x235184[_0x52cbf3[_0x183a('0x2e')]]={'$like':'%'+_0x549922[_0x183a('0x34')][_0x183a('0x43')]+'%'};return _0x235184;}})});}_0x1b3568=_[_0x183a('0x44')]({},_0x1b3568,_0x549922[_0x183a('0x45')]);var _0x1a516a={'where':_0x1b3568[_0x183a('0x40')]};return db[_0x183a('0x30')][_0x183a('0x23')](_0x1a516a)[_0x183a('0x2d')](function(_0x45559e){_0x44fc06['count']=_0x45559e;if(_0x549922['query'][_0x183a('0x46')]){_0x1b3568[_0x183a('0x47')]=[{'all':!![]}];}return db[_0x183a('0x30')][_0x183a('0x48')](_0x1b3568);})[_0x183a('0x2d')](function(_0x856c57){_0x44fc06['rows']=_0x856c57;return _0x44fc06;})[_0x183a('0x2d')](respondWithFilteredResult(_0x34953d,_0x1b3568))[_0x183a('0x49')](handleError(_0x34953d,null));};exports['show']=function(_0x44749e,_0x361dbb){var _0x31ed35={'raw':![],'where':{'id':_0x44749e[_0x183a('0x4a')]['id']}},_0x1d95c9={};_0x1d95c9[_0x183a('0x36')]=_[_0x183a('0x35')](db[_0x183a('0x30')][_0x183a('0x31')]);_0x1d95c9[_0x183a('0x34')]=_[_0x183a('0x35')](_0x44749e[_0x183a('0x34')]);_0x1d95c9[_0x183a('0x3e')]=_[_0x183a('0x4b')](_0x1d95c9['model'],_0x1d95c9[_0x183a('0x34')]);_0x31ed35[_0x183a('0x37')]=_['intersection'](_0x1d95c9[_0x183a('0x36')],qs[_0x183a('0x38')](_0x44749e[_0x183a('0x34')][_0x183a('0x38')]));_0x31ed35[_0x183a('0x37')]=_0x31ed35[_0x183a('0x37')][_0x183a('0x39')]?_0x31ed35[_0x183a('0x37')]:_0x1d95c9[_0x183a('0x36')];if(_0x44749e[_0x183a('0x34')][_0x183a('0x46')]){_0x31ed35['include']=[{'all':!![]}];}_0x31ed35=_[_0x183a('0x44')]({},_0x31ed35,_0x44749e[_0x183a('0x45')]);return db[_0x183a('0x30')]['find'](_0x31ed35)[_0x183a('0x2d')](handleEntityNotFound(_0x361dbb,null))[_0x183a('0x2d')](respondWithResult(_0x361dbb,null))[_0x183a('0x49')](handleError(_0x361dbb,null));};exports[_0x183a('0x4c')]=function(_0x4e4a8f,_0x39ab07){return db[_0x183a('0x30')][_0x183a('0x4c')](_0x4e4a8f['body'],{})[_0x183a('0x2d')](function(_0xb19f18){var _0x45f879=_0x4e4a8f['user'][_0x183a('0x2b')]({'plain':!![]});if(!_0x45f879)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45f879['role']===_0x183a('0x4d')){var _0x514422=_0xb19f18[_0x183a('0x2b')]({'plain':!![]});var _0x46c372=_0x183a('0x4e');return db[_0x183a('0x4f')][_0x183a('0x50')]({'where':{'name':_0x46c372,'userProfileId':_0x45f879[_0x183a('0x51')]},'raw':!![]})[_0x183a('0x2d')](function(_0xff9ae5){if(_0xff9ae5&&_0xff9ae5[_0x183a('0x52')]===0x0){return db[_0x183a('0x2c')][_0x183a('0x4c')]({'name':_0x514422[_0x183a('0x2e')],'resourceId':_0x514422['id'],'type':_0xff9ae5[_0x183a('0x2e')],'sectionId':_0xff9ae5['id']},{})['then'](function(){return _0xb19f18;});}else{return _0xb19f18;}})[_0x183a('0x49')](function(_0x4efa9d){logger[_0x183a('0x53')](_0x183a('0x54'),_0x4efa9d);throw _0x4efa9d;});}return _0xb19f18;})[_0x183a('0x2d')](respondWithResult(_0x39ab07,0xc9))[_0x183a('0x49')](handleError(_0x39ab07,null));};exports['clone']=function(_0x1f3d48,_0x1666f9){var _0x5eb2f2={'where':{'id':_0x1f3d48[_0x183a('0x4a')]['id']}},_0x53c640={};_0x53c640['model']=_['keys'](db[_0x183a('0x30')]['rawAttributes']);_0x5eb2f2[_0x183a('0x37')]=_[_0x183a('0x4b')](_0x53c640['model'],qs[_0x183a('0x38')](_0x1f3d48[_0x183a('0x34')][_0x183a('0x38')]));_0x5eb2f2['attributes']=_0x5eb2f2[_0x183a('0x37')][_0x183a('0x39')]?_0x5eb2f2['attributes']:_0x53c640[_0x183a('0x36')];if(_0x1f3d48[_0x183a('0x34')][_0x183a('0x46')]){_0x5eb2f2[_0x183a('0x47')]=[{'all':!![]}];}_0x5eb2f2=_['merge']({},_0x5eb2f2,_0x1f3d48[_0x183a('0x45')]);return db[_0x183a('0x30')][_0x183a('0x50')](_0x5eb2f2)[_0x183a('0x2d')](handleEntityNotFound(_0x1666f9,null))['then'](function(_0x29d5f0){if(_0x29d5f0){var _0x4faab5=_0x29d5f0[_0x183a('0x2b')]({'plain':!![]});_0x4faab5=qs[_0x183a('0x55')](_0x4faab5,['id','createdAt',_0x183a('0x56')]);_0x1f3d48[_0x183a('0x57')]=_[_0x183a('0x55')](_0x1f3d48['body'],['id',_0x183a('0x58'),'updatedAt']);return db[_0x183a('0x30')][_0x183a('0x4c')](_[_0x183a('0x44')](_0x4faab5,_0x1f3d48[_0x183a('0x57')]),{'include':_0x1f3d48[_0x183a('0x34')][_0x183a('0x46')]?[{'all':!![]}]:undefined})[_0x183a('0x2d')](function(_0x2c18c6){var _0x5dc3e8=_0x1f3d48[_0x183a('0x4d')][_0x183a('0x2b')]({'plain':!![]});if(!_0x5dc3e8)throw new Error(_0x183a('0x59'));if(_0x5dc3e8[_0x183a('0x5a')]==='user'){var _0x1f6e10=_0x2c18c6[_0x183a('0x2b')]({'plain':!![]});var _0x21c380='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0x21c380,'userProfileId':_0x5dc3e8[_0x183a('0x51')]},'raw':!![]})[_0x183a('0x2d')](function(_0x1d83fc){if(_0x1d83fc&&_0x1d83fc[_0x183a('0x52')]===0x0){return db[_0x183a('0x2c')][_0x183a('0x4c')]({'name':_0x1f6e10[_0x183a('0x2e')],'resourceId':_0x1f6e10['id'],'type':_0x1d83fc[_0x183a('0x2e')],'sectionId':_0x1d83fc['id']},{})['then'](function(){return _0x2c18c6;});}else{return _0x2c18c6;}})[_0x183a('0x49')](function(_0x39ac30){logger['error'](_0x183a('0x54'),_0x39ac30);throw _0x39ac30;});}return _0x2c18c6;});}})['then'](respondWithResult(_0x1666f9,0xc9))[_0x183a('0x49')](handleError(_0x1666f9,null));};exports[_0x183a('0x2a')]=function(_0x1ec854,_0x5c5986){if(_0x1ec854[_0x183a('0x57')]['id']){delete _0x1ec854['body']['id'];}return db[_0x183a('0x30')]['find']({'where':{'id':_0x1ec854[_0x183a('0x4a')]['id']}})[_0x183a('0x2d')](handleEntityNotFound(_0x5c5986,null))[_0x183a('0x2d')](saveUpdates(_0x1ec854[_0x183a('0x57')],null))[_0x183a('0x2d')](respondWithResult(_0x5c5986,null))[_0x183a('0x49')](handleError(_0x5c5986,null));};exports['destroy']=function(_0x367aac,_0x59cc40){return db[_0x183a('0x30')]['find']({'where':{'id':_0x367aac[_0x183a('0x4a')]['id']}})[_0x183a('0x2d')](handleEntityNotFound(_0x59cc40,null))[_0x183a('0x2d')](removeEntity(_0x59cc40,null))[_0x183a('0x49')](handleError(_0x59cc40,null));};function widgetAttributes(_0xfaa9a){try{switch(_0xfaa9a[_0x183a('0x32')]){case _0x183a('0x5b'):return[{'name':'attrUrl','value':_0xfaa9a[_0x183a('0x5c')]||(_0xfaa9a[_0x183a('0x5d')]&&_0xfaa9a[_0x183a('0x5d')][0x0]?_0xfaa9a['attrs'][0x0][_0x183a('0x5e')]:undefined)||_0x183a('0x5f')}];case _0x183a('0x60'):return[{'name':_0x183a('0x61'),'value':_0xfaa9a[_0x183a('0x61')]||(_0xfaa9a[_0x183a('0x5d')]&&_0xfaa9a[_0x183a('0x5d')][0x0]?_0xfaa9a[_0x183a('0x5d')][0x0][_0x183a('0x5e')]:undefined)||''}];case'clock':return[{'name':_0x183a('0x62'),'value':_0xfaa9a['attrHourFormat']||(_0xfaa9a[_0x183a('0x5d')]&&_0xfaa9a['attrs'][0x0]?_0xfaa9a['attrs'][0x0][_0x183a('0x5e')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0xfaa9a[_0x183a('0x63')]||(_0xfaa9a[_0x183a('0x5d')]&&_0xfaa9a[_0x183a('0x5d')][0x1]?_0xfaa9a[_0x183a('0x5d')][0x1][_0x183a('0x5e')]:undefined)||'0.00'},{'name':_0x183a('0x64'),'value':_0xfaa9a['attrFontSize']||(_0xfaa9a[_0x183a('0x5d')]&&_0xfaa9a[_0x183a('0x5d')][0x2]?_0xfaa9a['attrs'][0x2][_0x183a('0x5e')]:undefined)||0xc}];case _0x183a('0x65'):return[{'name':_0x183a('0x66'),'value':_0xfaa9a[_0x183a('0x66')]||(_0xfaa9a[_0x183a('0x5d')]&&_0xfaa9a[_0x183a('0x5d')][0x0]?_0xfaa9a[_0x183a('0x5d')][0x0][_0x183a('0x5e')]:undefined)||_0x183a('0x67')},{'name':_0x183a('0x68'),'value':_0xfaa9a[_0x183a('0x68')]||(_0xfaa9a['attrs']&&_0xfaa9a['attrs'][0x1]?_0xfaa9a['attrs'][0x1]['value']:undefined)||[]},{'name':_0x183a('0x64'),'value':_0xfaa9a[_0x183a('0x64')]||(_0xfaa9a[_0x183a('0x5d')]&&_0xfaa9a[_0x183a('0x5d')][0x2]?_0xfaa9a[_0x183a('0x5d')][0x2][_0x183a('0x5e')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0x183a('0x69'),'value':_0xfaa9a[_0x183a('0x69')]||(_0xfaa9a[_0x183a('0x5d')]&&_0xfaa9a['attrs'][0x0]?_0xfaa9a[_0x183a('0x5d')][0x0][_0x183a('0x5e')]:undefined)||_0x183a('0x67')},{'name':'attrSerie2','value':_0xfaa9a[_0x183a('0x6a')]||(_0xfaa9a[_0x183a('0x5d')]&&_0xfaa9a[_0x183a('0x5d')][0x1]?_0xfaa9a['attrs'][0x1][_0x183a('0x5e')]:undefined)||null},{'name':_0x183a('0x6b'),'value':_0xfaa9a[_0x183a('0x6b')]||(_0xfaa9a[_0x183a('0x5d')]&&_0xfaa9a[_0x183a('0x5d')][0x2]?_0xfaa9a[_0x183a('0x5d')][0x2]['value']:undefined)||null},{'name':_0x183a('0x68'),'value':_0xfaa9a[_0x183a('0x68')]||(_0xfaa9a[_0x183a('0x5d')]&&_0xfaa9a[_0x183a('0x5d')][0x3]?_0xfaa9a['attrs'][0x3]['value']:undefined)||[]}];case _0x183a('0x6c'):return[{'name':_0x183a('0x6d'),'type':_0xfaa9a['reportType']||(_0xfaa9a['attrs']&&_0xfaa9a['attrs'][0x0]?_0xfaa9a[_0x183a('0x5d')][0x0][_0x183a('0x32')]:undefined)||null,'value':_0xfaa9a['attrReport']||(_0xfaa9a[_0x183a('0x5d')]&&_0xfaa9a['attrs'][0x0]?_0xfaa9a[_0x183a('0x5d')][0x0]['value']:undefined)||null},{'name':_0x183a('0x6e'),'value':_0xfaa9a[_0x183a('0x6e')]||(_0xfaa9a[_0x183a('0x5d')]&&_0xfaa9a[_0x183a('0x5d')][0x1]?_0xfaa9a[_0x183a('0x5d')][0x1][_0x183a('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x386452){logger[_0x183a('0x53')](_0x183a('0x6f'),JSON[_0x183a('0x70')](_0x386452));return[];}}exports[_0x183a('0x71')]=function(_0x1525c8,_0x5d327c,_0x2b2eac){if(_0x1525c8[_0x183a('0x57')]['id']){delete _0x1525c8[_0x183a('0x57')]['id'];}return db[_0x183a('0x30')][_0x183a('0x50')]({'where':{'id':_0x1525c8[_0x183a('0x4a')]['id']}})[_0x183a('0x2d')](handleEntityNotFound(_0x5d327c,null))[_0x183a('0x2d')](function(_0xb618eb){if(_0xb618eb){_0x1525c8[_0x183a('0x57')][_0x183a('0x72')]=_0xb618eb['id'];_0x1525c8['body'][_0x183a('0x5d')]=widgetAttributes(_0x1525c8[_0x183a('0x57')]);return db['DashboardItem'][_0x183a('0x4c')](_0x1525c8['body']);}})[_0x183a('0x2d')](respondWithResult(_0x5d327c,null))[_0x183a('0x49')](handleError(_0x5d327c,null));};exports[_0x183a('0x73')]=function(_0x30bf49,_0x52a426,_0x96fbed){var _0x3ea333={};var _0x40f6bf={};var _0x256440;var _0x3fd85d;return db[_0x183a('0x30')]['findOne']({'where':{'id':_0x30bf49['params']['id']}})[_0x183a('0x2d')](handleEntityNotFound(_0x52a426,null))[_0x183a('0x2d')](function(_0x2c8960){if(_0x2c8960){_0x256440=_0x2c8960;_0x40f6bf[_0x183a('0x36')]=_[_0x183a('0x35')](db[_0x183a('0x74')][_0x183a('0x31')]);_0x40f6bf[_0x183a('0x34')]=_[_0x183a('0x35')](_0x30bf49['query']);_0x40f6bf['filters']=_['intersection'](_0x40f6bf[_0x183a('0x36')],_0x40f6bf[_0x183a('0x34')]);_0x3ea333[_0x183a('0x37')]=_[_0x183a('0x4b')](_0x40f6bf[_0x183a('0x36')],qs['fields'](_0x30bf49['query'][_0x183a('0x38')]));_0x3ea333['attributes']=_0x3ea333[_0x183a('0x37')]['length']?_0x3ea333[_0x183a('0x37')]:_0x40f6bf['model'];_0x3ea333[_0x183a('0x3c')]=qs[_0x183a('0x3d')](_0x30bf49['query'][_0x183a('0x3d')]);_0x3ea333[_0x183a('0x40')]=qs[_0x183a('0x3e')](_['pick'](_0x30bf49['query'],_0x40f6bf['filters']));if(_0x30bf49[_0x183a('0x34')]['filter']){_0x3ea333[_0x183a('0x40')]=_[_0x183a('0x44')](_0x3ea333[_0x183a('0x40')],{'$or':_[_0x183a('0x41')](_0x3ea333[_0x183a('0x37')],function(_0x1bbdb3){var _0x4e0206={};_0x4e0206[_0x1bbdb3]={'$like':'%'+_0x30bf49[_0x183a('0x34')][_0x183a('0x43')]+'%'};return _0x4e0206;})});}_0x3ea333=_[_0x183a('0x44')]({},_0x3ea333,_0x30bf49[_0x183a('0x45')]);return _0x256440[_0x183a('0x73')](_0x3ea333);}})[_0x183a('0x2d')](function(_0x5841da){if(_0x5841da){_0x3fd85d=_0x5841da[_0x183a('0x39')];if(!_0x30bf49[_0x183a('0x34')][_0x183a('0x3a')](_0x183a('0x3b'))){_0x3ea333[_0x183a('0x24')]=qs[_0x183a('0x24')](_0x30bf49[_0x183a('0x34')][_0x183a('0x24')]);_0x3ea333['offset']=qs['offset'](_0x30bf49[_0x183a('0x34')][_0x183a('0x21')]);}return _0x256440[_0x183a('0x73')](_0x3ea333);}})[_0x183a('0x2d')](function(_0x41cd1e){if(_0x41cd1e){return _0x41cd1e?{'count':_0x3fd85d,'rows':_0x41cd1e}:null;}})[_0x183a('0x2d')](respondWithResult(_0x52a426,null))[_0x183a('0x49')](handleError(_0x52a426,null));}; \ No newline at end of file +var _0x93ff=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','Dashboard','includeAll','findAll','catch','params','length','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','omit','createdAt','updatedAt','user','autoAssociation','iframe','attrUrl','attrs','https://','value','clock','attrHourFormat','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','reportType','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','DashboardItem','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','socket.io-emitter','./dashboard.socket','sendStatus'];(function(_0x28e44b,_0x11a3ec){var _0x35723a=function(_0x22b915){while(--_0x22b915){_0x28e44b['push'](_0x28e44b['shift']());}};_0x35723a(++_0x11a3ec);}(_0x93ff,0xd1));var _0xf93f=function(_0x26ec1c,_0x274d1b){_0x26ec1c=_0x26ec1c-0x0;var _0x3759c0=_0x93ff[_0x26ec1c];return _0x3759c0;};'use strict';var emlformat=require(_0xf93f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf93f('0x1'));var jsonpatch=require(_0xf93f('0x2'));var rp=require(_0xf93f('0x3'));var moment=require('moment');var BPromise=require(_0xf93f('0x4'));var Mustache=require(_0xf93f('0x5'));var util=require(_0xf93f('0x6'));var path=require('path');var sox=require(_0xf93f('0x7'));var csv=require(_0xf93f('0x8'));var ejs=require(_0xf93f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf93f('0xa'));var crypto=require(_0xf93f('0xb'));var jsforce=require(_0xf93f('0xc'));var deskjs=require(_0xf93f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf93f('0xe'));var Redis=require(_0xf93f('0xf'));var authService=require(_0xf93f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf93f('0x11'));var logger=require(_0xf93f('0x12'))(_0xf93f('0x13'));var utils=require(_0xf93f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf93f('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf93f('0x16')](config[_0xf93f('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xf93f('0x18'))(new Redis(config[_0xf93f('0x17')]));require(_0xf93f('0x19'))['register'](socket);function respondWithStatusCode(_0x4ce5eb,_0x1f930a){_0x1f930a=_0x1f930a||0xcc;return function(_0x17bb06){if(_0x17bb06){return _0x4ce5eb[_0xf93f('0x1a')](_0x1f930a);}return _0x4ce5eb[_0xf93f('0x1b')](_0x1f930a)[_0xf93f('0x1c')]();};}function respondWithResult(_0x3a8dc8,_0x422d63){_0x422d63=_0x422d63||0xc8;return function(_0x275b44){if(_0x275b44){return _0x3a8dc8[_0xf93f('0x1b')](_0x422d63)[_0xf93f('0x1d')](_0x275b44);}};}function respondWithFilteredResult(_0x431629,_0x47bceb){return function(_0xf3f945){if(_0xf3f945){var _0x161774=typeof _0x47bceb[_0xf93f('0x1e')]===_0xf93f('0x1f')&&typeof _0x47bceb[_0xf93f('0x20')]===_0xf93f('0x1f');var _0x33aa7b=_0xf3f945[_0xf93f('0x21')];var _0x16f11e=_0x161774?0x0:_0x47bceb[_0xf93f('0x1e')];var _0x12322c=_0x161774?_0xf3f945[_0xf93f('0x21')]:_0x47bceb['offset']+_0x47bceb[_0xf93f('0x20')];var _0x557fd6;if(_0x12322c>=_0x33aa7b){_0x12322c=_0x33aa7b;_0x557fd6=0xc8;}else{_0x557fd6=0xce;}_0x431629['status'](_0x557fd6);return _0x431629[_0xf93f('0x22')](_0xf93f('0x23'),_0x16f11e+'-'+_0x12322c+'/'+_0x33aa7b)[_0xf93f('0x1d')](_0xf3f945);}return null;};}function patchUpdates(_0x24d82e){return function(_0x6e9d6a){try{jsonpatch[_0xf93f('0x24')](_0x6e9d6a,_0x24d82e,!![]);}catch(_0x4c751b){return BPromise[_0xf93f('0x25')](_0x4c751b);}return _0x6e9d6a['save']();};}function saveUpdates(_0x55126d,_0x37fd61){return function(_0x17d898){if(_0x17d898){return _0x17d898[_0xf93f('0x26')](_0x55126d)['then'](function(_0x378c71){return _0x378c71;});}return null;};}function removeEntity(_0x415966,_0x4d7e14){return function(_0x281666){if(_0x281666){return _0x281666[_0xf93f('0x27')]()[_0xf93f('0x28')](function(){var _0x4a3d2b=_0x281666[_0xf93f('0x29')]({'plain':!![]});var _0xc6150c=_0xf93f('0x2a');return db[_0xf93f('0x2b')][_0xf93f('0x27')]({'where':{'type':_0xc6150c,'resourceId':_0x4a3d2b['id']}})['then'](function(){return _0x281666;});})[_0xf93f('0x28')](function(){_0x415966[_0xf93f('0x1b')](0xcc)[_0xf93f('0x1c')]();});}};}function handleEntityNotFound(_0x16fbc0,_0x5c59be){return function(_0x2b6fb0){if(!_0x2b6fb0){_0x16fbc0[_0xf93f('0x1a')](0x194);}return _0x2b6fb0;};}function handleError(_0x25a2e9,_0x5888ff){_0x5888ff=_0x5888ff||0x1f4;return function(_0x4f492d){logger[_0xf93f('0x2c')](_0x4f492d[_0xf93f('0x2d')]);if(_0x4f492d['name']){delete _0x4f492d[_0xf93f('0x2e')];}_0x25a2e9[_0xf93f('0x1b')](_0x5888ff)[_0xf93f('0x2f')](_0x4f492d);};}exports[_0xf93f('0x30')]=function(_0x82e212,_0x146d27){var _0x46c0df={},_0x3e5708={},_0x2b8a74={'count':0x0,'rows':[]};var _0x4f653d=_[_0xf93f('0x31')](db['Dashboard']['rawAttributes'],function(_0x594fa7){return{'name':_0x594fa7[_0xf93f('0x32')],'type':_0x594fa7[_0xf93f('0x33')][_0xf93f('0x34')]};});_0x3e5708[_0xf93f('0x35')]=_[_0xf93f('0x31')](_0x4f653d,_0xf93f('0x2e'));_0x3e5708[_0xf93f('0x36')]=_[_0xf93f('0x37')](_0x82e212[_0xf93f('0x36')]);_0x3e5708['filters']=_[_0xf93f('0x38')](_0x3e5708[_0xf93f('0x35')],_0x3e5708[_0xf93f('0x36')]);_0x46c0df[_0xf93f('0x39')]=_['intersection'](_0x3e5708[_0xf93f('0x35')],qs[_0xf93f('0x3a')](_0x82e212['query']['fields']));_0x46c0df[_0xf93f('0x39')]=_0x46c0df[_0xf93f('0x39')]['length']?_0x46c0df['attributes']:_0x3e5708[_0xf93f('0x35')];if(!_0x82e212[_0xf93f('0x36')]['hasOwnProperty'](_0xf93f('0x3b'))){_0x46c0df[_0xf93f('0x20')]=qs['limit'](_0x82e212[_0xf93f('0x36')][_0xf93f('0x20')]);_0x46c0df[_0xf93f('0x1e')]=qs[_0xf93f('0x1e')](_0x82e212[_0xf93f('0x36')][_0xf93f('0x1e')]);}_0x46c0df[_0xf93f('0x3c')]=qs[_0xf93f('0x3d')](_0x82e212[_0xf93f('0x36')]['sort']);_0x46c0df[_0xf93f('0x3e')]=qs[_0xf93f('0x3f')](_[_0xf93f('0x40')](_0x82e212[_0xf93f('0x36')],_0x3e5708[_0xf93f('0x3f')]),_0x4f653d);if(_0x82e212[_0xf93f('0x36')][_0xf93f('0x41')]){_0x46c0df[_0xf93f('0x3e')]=_[_0xf93f('0x42')](_0x46c0df[_0xf93f('0x3e')],{'$or':_[_0xf93f('0x31')](_0x4f653d,function(_0x549c5b){if(_0x549c5b[_0xf93f('0x33')]!==_0xf93f('0x43')){var _0x2de699={};_0x2de699[_0x549c5b[_0xf93f('0x2e')]]={'$like':'%'+_0x82e212[_0xf93f('0x36')]['filter']+'%'};return _0x2de699;}})});}_0x46c0df=_[_0xf93f('0x42')]({},_0x46c0df,_0x82e212['options']);var _0x58a942={'where':_0x46c0df['where']};return db[_0xf93f('0x44')][_0xf93f('0x21')](_0x58a942)[_0xf93f('0x28')](function(_0x4554a9){_0x2b8a74[_0xf93f('0x21')]=_0x4554a9;if(_0x82e212[_0xf93f('0x36')][_0xf93f('0x45')]){_0x46c0df['include']=[{'all':!![]}];}return db[_0xf93f('0x44')][_0xf93f('0x46')](_0x46c0df);})[_0xf93f('0x28')](function(_0x4a8654){_0x2b8a74['rows']=_0x4a8654;return _0x2b8a74;})[_0xf93f('0x28')](respondWithFilteredResult(_0x146d27,_0x46c0df))[_0xf93f('0x47')](handleError(_0x146d27,null));};exports['show']=function(_0xeaf2b8,_0x2a1146){var _0xfdb2fe={'raw':![],'where':{'id':_0xeaf2b8[_0xf93f('0x48')]['id']}},_0x441a67={};_0x441a67[_0xf93f('0x35')]=_[_0xf93f('0x37')](db['Dashboard']['rawAttributes']);_0x441a67[_0xf93f('0x36')]=_['keys'](_0xeaf2b8['query']);_0x441a67[_0xf93f('0x3f')]=_['intersection'](_0x441a67[_0xf93f('0x35')],_0x441a67['query']);_0xfdb2fe[_0xf93f('0x39')]=_[_0xf93f('0x38')](_0x441a67[_0xf93f('0x35')],qs[_0xf93f('0x3a')](_0xeaf2b8[_0xf93f('0x36')][_0xf93f('0x3a')]));_0xfdb2fe['attributes']=_0xfdb2fe['attributes'][_0xf93f('0x49')]?_0xfdb2fe[_0xf93f('0x39')]:_0x441a67[_0xf93f('0x35')];if(_0xeaf2b8[_0xf93f('0x36')][_0xf93f('0x45')]){_0xfdb2fe[_0xf93f('0x4a')]=[{'all':!![]}];}_0xfdb2fe=_[_0xf93f('0x42')]({},_0xfdb2fe,_0xeaf2b8[_0xf93f('0x4b')]);return db[_0xf93f('0x44')][_0xf93f('0x4c')](_0xfdb2fe)[_0xf93f('0x28')](handleEntityNotFound(_0x2a1146,null))[_0xf93f('0x28')](respondWithResult(_0x2a1146,null))[_0xf93f('0x47')](handleError(_0x2a1146,null));};exports[_0xf93f('0x4d')]=function(_0x4291fb,_0x58766a){return db[_0xf93f('0x44')]['create'](_0x4291fb[_0xf93f('0x4e')],{})[_0xf93f('0x28')](function(_0x1eb7be){var _0x3d6d62=_0x4291fb['user'][_0xf93f('0x29')]({'plain':!![]});if(!_0x3d6d62)throw new Error(_0xf93f('0x4f'));if(_0x3d6d62[_0xf93f('0x50')]==='user'){var _0xf06ce8=_0x1eb7be[_0xf93f('0x29')]({'plain':!![]});var _0x137ec5=_0xf93f('0x2a');return db[_0xf93f('0x51')][_0xf93f('0x4c')]({'where':{'name':_0x137ec5,'userProfileId':_0x3d6d62[_0xf93f('0x52')]},'raw':!![]})[_0xf93f('0x28')](function(_0x17923f){if(_0x17923f&&_0x17923f['autoAssociation']===0x0){return db[_0xf93f('0x2b')]['create']({'name':_0xf06ce8[_0xf93f('0x2e')],'resourceId':_0xf06ce8['id'],'type':_0x17923f['name'],'sectionId':_0x17923f['id']},{})[_0xf93f('0x28')](function(){return _0x1eb7be;});}else{return _0x1eb7be;}})['catch'](function(_0x362754){logger[_0xf93f('0x2c')](_0xf93f('0x53'),_0x362754);throw _0x362754;});}return _0x1eb7be;})['then'](respondWithResult(_0x58766a,0xc9))[_0xf93f('0x47')](handleError(_0x58766a,null));};exports[_0xf93f('0x54')]=function(_0x1893de,_0x378294){var _0x4ce648={'where':{'id':_0x1893de[_0xf93f('0x48')]['id']}},_0x14991b={};_0x14991b[_0xf93f('0x35')]=_[_0xf93f('0x37')](db[_0xf93f('0x44')][_0xf93f('0x55')]);_0x4ce648[_0xf93f('0x39')]=_['intersection'](_0x14991b['model'],qs[_0xf93f('0x3a')](_0x1893de[_0xf93f('0x36')][_0xf93f('0x3a')]));_0x4ce648[_0xf93f('0x39')]=_0x4ce648[_0xf93f('0x39')][_0xf93f('0x49')]?_0x4ce648[_0xf93f('0x39')]:_0x14991b[_0xf93f('0x35')];if(_0x1893de[_0xf93f('0x36')][_0xf93f('0x45')]){_0x4ce648[_0xf93f('0x4a')]=[{'all':!![]}];}_0x4ce648=_[_0xf93f('0x42')]({},_0x4ce648,_0x1893de['options']);return db[_0xf93f('0x44')][_0xf93f('0x4c')](_0x4ce648)[_0xf93f('0x28')](handleEntityNotFound(_0x378294,null))[_0xf93f('0x28')](function(_0x270f45){if(_0x270f45){var _0x1ca412=_0x270f45[_0xf93f('0x29')]({'plain':!![]});_0x1ca412=qs[_0xf93f('0x56')](_0x1ca412,['id',_0xf93f('0x57'),_0xf93f('0x58')]);_0x1893de[_0xf93f('0x4e')]=_[_0xf93f('0x56')](_0x1893de['body'],['id',_0xf93f('0x57'),_0xf93f('0x58')]);return db[_0xf93f('0x44')][_0xf93f('0x4d')](_['merge'](_0x1ca412,_0x1893de[_0xf93f('0x4e')]),{'include':_0x1893de[_0xf93f('0x36')][_0xf93f('0x45')]?[{'all':!![]}]:undefined})[_0xf93f('0x28')](function(_0x4b7184){var _0x3691de=_0x1893de[_0xf93f('0x59')][_0xf93f('0x29')]({'plain':!![]});if(!_0x3691de)throw new Error(_0xf93f('0x4f'));if(_0x3691de[_0xf93f('0x50')]===_0xf93f('0x59')){var _0x509768=_0x4b7184[_0xf93f('0x29')]({'plain':!![]});var _0x40f63d=_0xf93f('0x2a');return db[_0xf93f('0x51')][_0xf93f('0x4c')]({'where':{'name':_0x40f63d,'userProfileId':_0x3691de[_0xf93f('0x52')]},'raw':!![]})['then'](function(_0x4f6258){if(_0x4f6258&&_0x4f6258[_0xf93f('0x5a')]===0x0){return db['UserProfileResource'][_0xf93f('0x4d')]({'name':_0x509768[_0xf93f('0x2e')],'resourceId':_0x509768['id'],'type':_0x4f6258['name'],'sectionId':_0x4f6258['id']},{})['then'](function(){return _0x4b7184;});}else{return _0x4b7184;}})[_0xf93f('0x47')](function(_0x1ede00){logger['error'](_0xf93f('0x53'),_0x1ede00);throw _0x1ede00;});}return _0x4b7184;});}})[_0xf93f('0x28')](respondWithResult(_0x378294,0xc9))[_0xf93f('0x47')](handleError(_0x378294,null));};exports[_0xf93f('0x26')]=function(_0x17423e,_0x263dcd){if(_0x17423e['body']['id']){delete _0x17423e[_0xf93f('0x4e')]['id'];}return db[_0xf93f('0x44')][_0xf93f('0x4c')]({'where':{'id':_0x17423e['params']['id']}})[_0xf93f('0x28')](handleEntityNotFound(_0x263dcd,null))[_0xf93f('0x28')](saveUpdates(_0x17423e[_0xf93f('0x4e')],null))[_0xf93f('0x28')](respondWithResult(_0x263dcd,null))[_0xf93f('0x47')](handleError(_0x263dcd,null));};exports[_0xf93f('0x27')]=function(_0x2fc439,_0x2f3a92){return db[_0xf93f('0x44')][_0xf93f('0x4c')]({'where':{'id':_0x2fc439[_0xf93f('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f3a92,null))['then'](removeEntity(_0x2f3a92,null))[_0xf93f('0x47')](handleError(_0x2f3a92,null));};function widgetAttributes(_0x1bcc5){try{switch(_0x1bcc5[_0xf93f('0x33')]){case _0xf93f('0x5b'):return[{'name':'attrUrl','value':_0x1bcc5[_0xf93f('0x5c')]||(_0x1bcc5[_0xf93f('0x5d')]&&_0x1bcc5[_0xf93f('0x5d')][0x0]?_0x1bcc5[_0xf93f('0x5d')][0x0]['value']:undefined)||_0xf93f('0x5e')}];case'custom':return[{'name':'attrPath','value':_0x1bcc5['attrPath']||(_0x1bcc5['attrs']&&_0x1bcc5[_0xf93f('0x5d')][0x0]?_0x1bcc5['attrs'][0x0][_0xf93f('0x5f')]:undefined)||''}];case _0xf93f('0x60'):return[{'name':_0xf93f('0x61'),'value':_0x1bcc5[_0xf93f('0x61')]||(_0x1bcc5[_0xf93f('0x5d')]&&_0x1bcc5[_0xf93f('0x5d')][0x0]?_0x1bcc5['attrs'][0x0][_0xf93f('0x5f')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x1bcc5['attrTimezone']||(_0x1bcc5[_0xf93f('0x5d')]&&_0x1bcc5[_0xf93f('0x5d')][0x1]?_0x1bcc5[_0xf93f('0x5d')][0x1]['value']:undefined)||_0xf93f('0x62')},{'name':_0xf93f('0x63'),'value':_0x1bcc5['attrFontSize']||(_0x1bcc5[_0xf93f('0x5d')]&&_0x1bcc5[_0xf93f('0x5d')][0x2]?_0x1bcc5[_0xf93f('0x5d')][0x2][_0xf93f('0x5f')]:undefined)||0xc}];case _0xf93f('0x64'):return[{'name':_0xf93f('0x65'),'value':_0x1bcc5[_0xf93f('0x65')]||(_0x1bcc5[_0xf93f('0x5d')]&&_0x1bcc5[_0xf93f('0x5d')][0x0]?_0x1bcc5['attrs'][0x0][_0xf93f('0x5f')]:undefined)||'total'},{'name':_0xf93f('0x66'),'value':_0x1bcc5[_0xf93f('0x66')]||(_0x1bcc5[_0xf93f('0x5d')]&&_0x1bcc5['attrs'][0x1]?_0x1bcc5[_0xf93f('0x5d')][0x1]['value']:undefined)||[]},{'name':_0xf93f('0x63'),'value':_0x1bcc5[_0xf93f('0x63')]||(_0x1bcc5[_0xf93f('0x5d')]&&_0x1bcc5[_0xf93f('0x5d')][0x2]?_0x1bcc5[_0xf93f('0x5d')][0x2]['value']:undefined)||0x14}];case _0xf93f('0x67'):case'pie-chart':return[{'name':_0xf93f('0x68'),'value':_0x1bcc5[_0xf93f('0x68')]||(_0x1bcc5['attrs']&&_0x1bcc5['attrs'][0x0]?_0x1bcc5[_0xf93f('0x5d')][0x0]['value']:undefined)||_0xf93f('0x69')},{'name':_0xf93f('0x6a'),'value':_0x1bcc5[_0xf93f('0x6a')]||(_0x1bcc5[_0xf93f('0x5d')]&&_0x1bcc5[_0xf93f('0x5d')][0x1]?_0x1bcc5[_0xf93f('0x5d')][0x1][_0xf93f('0x5f')]:undefined)||null},{'name':_0xf93f('0x6b'),'value':_0x1bcc5[_0xf93f('0x6b')]||(_0x1bcc5[_0xf93f('0x5d')]&&_0x1bcc5[_0xf93f('0x5d')][0x2]?_0x1bcc5['attrs'][0x2]['value']:undefined)||null},{'name':_0xf93f('0x66'),'value':_0x1bcc5[_0xf93f('0x66')]||(_0x1bcc5[_0xf93f('0x5d')]&&_0x1bcc5[_0xf93f('0x5d')][0x3]?_0x1bcc5[_0xf93f('0x5d')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0xf93f('0x6c'),'type':_0x1bcc5[_0xf93f('0x6d')]||(_0x1bcc5[_0xf93f('0x5d')]&&_0x1bcc5['attrs'][0x0]?_0x1bcc5[_0xf93f('0x5d')][0x0][_0xf93f('0x33')]:undefined)||null,'value':_0x1bcc5[_0xf93f('0x6c')]||(_0x1bcc5[_0xf93f('0x5d')]&&_0x1bcc5[_0xf93f('0x5d')][0x0]?_0x1bcc5[_0xf93f('0x5d')][0x0][_0xf93f('0x5f')]:undefined)||null},{'name':'attrRefresh','value':_0x1bcc5['attrRefresh']||(_0x1bcc5[_0xf93f('0x5d')]&&_0x1bcc5[_0xf93f('0x5d')][0x1]?_0x1bcc5[_0xf93f('0x5d')][0x1][_0xf93f('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x56bc5c){logger[_0xf93f('0x2c')](_0xf93f('0x6e'),JSON[_0xf93f('0x6f')](_0x56bc5c));return[];}}exports[_0xf93f('0x70')]=function(_0x16bcb5,_0x2d0b53,_0x20ab9a){if(_0x16bcb5['body']['id']){delete _0x16bcb5[_0xf93f('0x4e')]['id'];}return db[_0xf93f('0x44')]['find']({'where':{'id':_0x16bcb5[_0xf93f('0x48')]['id']}})[_0xf93f('0x28')](handleEntityNotFound(_0x2d0b53,null))[_0xf93f('0x28')](function(_0x1effef){if(_0x1effef){_0x16bcb5[_0xf93f('0x4e')][_0xf93f('0x71')]=_0x1effef['id'];_0x16bcb5['body'][_0xf93f('0x5d')]=widgetAttributes(_0x16bcb5[_0xf93f('0x4e')]);return db['DashboardItem'][_0xf93f('0x4d')](_0x16bcb5[_0xf93f('0x4e')]);}})['then'](respondWithResult(_0x2d0b53,null))['catch'](handleError(_0x2d0b53,null));};exports[_0xf93f('0x72')]=function(_0x20822f,_0x4ae1f4,_0xa77f80){var _0x5aebfb={};var _0x270c99={};var _0x612143;var _0x5ad704;return db[_0xf93f('0x44')][_0xf93f('0x73')]({'where':{'id':_0x20822f[_0xf93f('0x48')]['id']}})[_0xf93f('0x28')](handleEntityNotFound(_0x4ae1f4,null))['then'](function(_0x2a2ac2){if(_0x2a2ac2){_0x612143=_0x2a2ac2;_0x270c99['model']=_[_0xf93f('0x37')](db[_0xf93f('0x74')]['rawAttributes']);_0x270c99[_0xf93f('0x36')]=_[_0xf93f('0x37')](_0x20822f[_0xf93f('0x36')]);_0x270c99[_0xf93f('0x3f')]=_[_0xf93f('0x38')](_0x270c99['model'],_0x270c99['query']);_0x5aebfb[_0xf93f('0x39')]=_[_0xf93f('0x38')](_0x270c99[_0xf93f('0x35')],qs[_0xf93f('0x3a')](_0x20822f[_0xf93f('0x36')]['fields']));_0x5aebfb['attributes']=_0x5aebfb[_0xf93f('0x39')]['length']?_0x5aebfb[_0xf93f('0x39')]:_0x270c99[_0xf93f('0x35')];_0x5aebfb[_0xf93f('0x3c')]=qs[_0xf93f('0x3d')](_0x20822f[_0xf93f('0x36')][_0xf93f('0x3d')]);_0x5aebfb[_0xf93f('0x3e')]=qs[_0xf93f('0x3f')](_[_0xf93f('0x40')](_0x20822f[_0xf93f('0x36')],_0x270c99[_0xf93f('0x3f')]));if(_0x20822f[_0xf93f('0x36')]['filter']){_0x5aebfb[_0xf93f('0x3e')]=_[_0xf93f('0x42')](_0x5aebfb[_0xf93f('0x3e')],{'$or':_[_0xf93f('0x31')](_0x5aebfb['attributes'],function(_0x4e21f5){var _0x5375c4={};_0x5375c4[_0x4e21f5]={'$like':'%'+_0x20822f[_0xf93f('0x36')][_0xf93f('0x41')]+'%'};return _0x5375c4;})});}_0x5aebfb=_[_0xf93f('0x42')]({},_0x5aebfb,_0x20822f[_0xf93f('0x4b')]);return _0x612143[_0xf93f('0x72')](_0x5aebfb);}})[_0xf93f('0x28')](function(_0xd9b986){if(_0xd9b986){_0x5ad704=_0xd9b986[_0xf93f('0x49')];if(!_0x20822f[_0xf93f('0x36')][_0xf93f('0x75')](_0xf93f('0x3b'))){_0x5aebfb[_0xf93f('0x20')]=qs[_0xf93f('0x20')](_0x20822f['query']['limit']);_0x5aebfb[_0xf93f('0x1e')]=qs[_0xf93f('0x1e')](_0x20822f[_0xf93f('0x36')][_0xf93f('0x1e')]);}return _0x612143['getItems'](_0x5aebfb);}})[_0xf93f('0x28')](function(_0x511017){if(_0x511017){return _0x511017?{'count':_0x5ad704,'rows':_0x511017}:null;}})['then'](respondWithResult(_0x4ae1f4,null))[_0xf93f('0x47')](handleError(_0x4ae1f4,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index e444ddd..07d5f37 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 _0x0402=['remove','emit','hasOwnProperty','hook','exports','events','Dashboard','save','update'];(function(_0x6d5bde,_0x2b5572){var _0x154772=function(_0x1fb40f){while(--_0x1fb40f){_0x6d5bde['push'](_0x6d5bde['shift']());}};_0x154772(++_0x2b5572);}(_0x0402,0x176));var _0x2040=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x0402[_0x2a6809];return _0x11c371;};'use strict';var EventEmitter=require(_0x2040('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x2040('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2040('0x2'),'afterUpdate':_0x2040('0x3'),'afterDestroy':_0x2040('0x4')};function emitEvent(_0x323cc1){return function(_0x84e88f,_0x31792e,_0x9d55f3){DashboardEvents[_0x2040('0x5')](_0x323cc1+':'+_0x84e88f['id'],_0x84e88f);DashboardEvents[_0x2040('0x5')](_0x323cc1,_0x84e88f);_0x9d55f3(null);};}for(var e in events){if(events[_0x2040('0x6')](e)){var event=events[e];Dashboard[_0x2040('0x7')](e,emitEvent(event));}}module[_0x2040('0x8')]=DashboardEvents; \ No newline at end of file +var _0x5880=['emit','hasOwnProperty','exports','events','../../mysqldb','Dashboard','setMaxListeners','update','remove'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x5880,0x186));var _0x0588=function(_0x11114d,_0x34fbba){_0x11114d=_0x11114d-0x0;var _0xbcdbfb=_0x5880[_0x11114d];return _0xbcdbfb;};'use strict';var EventEmitter=require(_0x0588('0x0'));var Dashboard=require(_0x0588('0x1'))['db'][_0x0588('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x0588('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0588('0x4'),'afterDestroy':_0x0588('0x5')};function emitEvent(_0x15f47b){return function(_0x2eab9f,_0x25143e,_0x38819d){DashboardEvents[_0x0588('0x6')](_0x15f47b+':'+_0x2eab9f['id'],_0x2eab9f);DashboardEvents[_0x0588('0x6')](_0x15f47b,_0x2eab9f);_0x38819d(null);};}for(var e in events){if(events[_0x0588('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x0588('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 74225d8..6f5f5c8 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 _0x1c7d=['define','Dashboard','dashboards','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports'];(function(_0x1df7b8,_0x2fe5e5){var _0x29d911=function(_0x340121){while(--_0x340121){_0x1df7b8['push'](_0x1df7b8['shift']());}};_0x29d911(++_0x2fe5e5);}(_0x1c7d,0xe3));var _0xd1c7=function(_0x524143,_0x519f09){_0x524143=_0x524143-0x0;var _0x18db3a=_0x1c7d[_0x524143];return _0x18db3a;};'use strict';var _=require(_0xd1c7('0x0'));var util=require(_0xd1c7('0x1'));var logger=require(_0xd1c7('0x2'))(_0xd1c7('0x3'));var moment=require(_0xd1c7('0x4'));var BPromise=require('bluebird');var rp=require(_0xd1c7('0x5'));var fs=require('fs');var path=require(_0xd1c7('0x6'));var rimraf=require(_0xd1c7('0x7'));var config=require(_0xd1c7('0x8'));var attributes=require(_0xd1c7('0x9'));module[_0xd1c7('0xa')]=function(_0x1bd423,_0x2111f8){return _0x1bd423[_0xd1c7('0xb')](_0xd1c7('0xc'),attributes,{'tableName':_0xd1c7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x620f=['lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','exports','define','Dashboard','dashboards'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0x620f,0x160));var _0xf620=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x620f[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xf620('0x0'));var util=require(_0xf620('0x1'));var logger=require(_0xf620('0x2'))('api');var moment=require(_0xf620('0x3'));var BPromise=require(_0xf620('0x4'));var rp=require(_0xf620('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf620('0x6'));var attributes=require('./dashboard.attributes');module[_0xf620('0x7')]=function(_0x2cf552,_0x238009){return _0x2cf552[_0xf620('0x8')](_0xf620('0x9'),attributes,{'tableName':_0xf620('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 6b97159..87120cf 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 _0xfd2f=['message','result','catch','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3249ab,_0x53459d){var _0x2eddfc=function(_0x413c83){while(--_0x413c83){_0x3249ab['push'](_0x3249ab['shift']());}};_0x2eddfc(++_0x53459d);}(_0xfd2f,0x147));var _0xffd2=function(_0x37d8e2,_0x4ed598){_0x37d8e2=_0x37d8e2-0x0;var _0xa184ee=_0xfd2f[_0x37d8e2];return _0xa184ee;};'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(_0xffd2('0x0'));var db=require(_0xffd2('0x1'))['db'];var utils=require(_0xffd2('0x2'));var logger=require(_0xffd2('0x3'))(_0xffd2('0x4'));var config=require(_0xffd2('0x5'));var jayson=require(_0xffd2('0x6'));var client=jayson[_0xffd2('0x7')][_0xffd2('0x8')]({'port':0x232a});config[_0xffd2('0x9')]=_['defaults'](config['redis'],{'host':_0xffd2('0xa'),'port':0x18eb});var socket=require(_0xffd2('0xb'))(new Redis(config[_0xffd2('0x9')]));require(_0xffd2('0xc'))[_0xffd2('0xd')](socket);function respondWithRpcPromise(_0x362335,_0x166b52,_0x10e8c6){return new BPromise(function(_0x5be3f5,_0xea568e){return client[_0xffd2('0xe')](_0x362335,_0x10e8c6)[_0xffd2('0xf')](function(_0x4e32b7){logger[_0xffd2('0x10')](_0xffd2('0x11'),_0x166b52,'request\x20sent');logger[_0xffd2('0x12')](_0xffd2('0x13'),_0x166b52,_0xffd2('0x14'),JSON[_0xffd2('0x15')](_0x4e32b7));if(_0x4e32b7[_0xffd2('0x16')]){if(_0x4e32b7[_0xffd2('0x16')][_0xffd2('0x17')]===0x1f4){logger[_0xffd2('0x16')](_0xffd2('0x11'),_0x166b52,_0x4e32b7[_0xffd2('0x16')][_0xffd2('0x18')]);return _0xea568e(_0x4e32b7['error'][_0xffd2('0x18')]);}logger[_0xffd2('0x16')](_0xffd2('0x11'),_0x166b52,_0x4e32b7[_0xffd2('0x16')]['message']);return _0x5be3f5(_0x4e32b7[_0xffd2('0x16')]['message']);}else{logger['info'](_0xffd2('0x11'),_0x166b52,_0xffd2('0x14'));_0x5be3f5(_0x4e32b7[_0xffd2('0x19')][_0xffd2('0x18')]);}})[_0xffd2('0x1a')](function(_0x9e0ff7){logger[_0xffd2('0x16')](_0xffd2('0x11'),_0x166b52,_0x9e0ff7);_0xea568e(_0x9e0ff7);});});} \ No newline at end of file +var _0xf091=['then','info','request\x20sent','debug','stringify','error','code','message','Dashboard,\x20%s,\x20%s','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request'];(function(_0x2d16d8,_0x295ba2){var _0x40e2bf=function(_0x45c1cf){while(--_0x45c1cf){_0x2d16d8['push'](_0x2d16d8['shift']());}};_0x40e2bf(++_0x295ba2);}(_0xf091,0xc1));var _0x1f09=function(_0x5505dd,_0x362ed6){_0x5505dd=_0x5505dd-0x0;var _0x1c0b53=_0xf091[_0x5505dd];return _0x1c0b53;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1f09('0x0'));var rs=require(_0x1f09('0x1'));var fs=require('fs');var Redis=require(_0x1f09('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1f09('0x3'))(_0x1f09('0x4'));var config=require(_0x1f09('0x5'));var jayson=require(_0x1f09('0x6'));var client=jayson[_0x1f09('0x7')][_0x1f09('0x8')]({'port':0x232a});config[_0x1f09('0x9')]=_[_0x1f09('0xa')](config[_0x1f09('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x1f09('0xb'))(new Redis(config['redis']));require('./dashboard.socket')[_0x1f09('0xc')](socket);function respondWithRpcPromise(_0x31d2da,_0xf2d52d,_0x3cb00d){return new BPromise(function(_0x1f8bc7,_0xf93f62){return client[_0x1f09('0xd')](_0x31d2da,_0x3cb00d)[_0x1f09('0xe')](function(_0x235b83){logger[_0x1f09('0xf')]('Dashboard,\x20%s,\x20%s',_0xf2d52d,_0x1f09('0x10'));logger[_0x1f09('0x11')]('Dashboard,\x20%s,\x20%s,\x20%s',_0xf2d52d,_0x1f09('0x10'),JSON[_0x1f09('0x12')](_0x235b83));if(_0x235b83[_0x1f09('0x13')]){if(_0x235b83['error'][_0x1f09('0x14')]===0x1f4){logger[_0x1f09('0x13')]('Dashboard,\x20%s,\x20%s',_0xf2d52d,_0x235b83['error'][_0x1f09('0x15')]);return _0xf93f62(_0x235b83[_0x1f09('0x13')][_0x1f09('0x15')]);}logger[_0x1f09('0x13')](_0x1f09('0x16'),_0xf2d52d,_0x235b83[_0x1f09('0x13')][_0x1f09('0x15')]);return _0x1f8bc7(_0x235b83[_0x1f09('0x13')][_0x1f09('0x15')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0xf2d52d,_0x1f09('0x10'));_0x1f8bc7(_0x235b83['result'][_0x1f09('0x15')]);}})['catch'](function(_0x4b9cf4){logger[_0x1f09('0x13')](_0x1f09('0x16'),_0xf2d52d,_0x4b9cf4);_0xf93f62(_0x4b9cf4);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index fbbd42f..50c212d 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 _0x4d94=['register','length','dashboard:','save','remove','update','emit','removeListener'];(function(_0x1233d1,_0x15cf04){var _0x56ee5e=function(_0x470ed9){while(--_0x470ed9){_0x1233d1['push'](_0x1233d1['shift']());}};_0x56ee5e(++_0x15cf04);}(_0x4d94,0xab));var _0x44d9=function(_0x58ef9c,_0x14c067){_0x58ef9c=_0x58ef9c-0x0;var _0x5de0b2=_0x4d94[_0x58ef9c];return _0x5de0b2;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x44d9('0x0'),_0x44d9('0x1'),_0x44d9('0x2')];function createListener(_0x4d4427,_0x144221){return function(_0x46a854){_0x144221[_0x44d9('0x3')](_0x4d4427,_0x46a854);};}function removeListener(_0x2c930a,_0x4961ec){return function(){DashboardEvents[_0x44d9('0x4')](_0x2c930a,_0x4961ec);};}exports[_0x44d9('0x5')]=function(_0x136245){for(var _0x94dd41=0x0,_0x255121=events[_0x44d9('0x6')];_0x94dd41<_0x255121;_0x94dd41++){var _0x51c5d7=events[_0x94dd41];var _0x2e52ae=createListener(_0x44d9('0x7')+_0x51c5d7,_0x136245);DashboardEvents['on'](_0x51c5d7,_0x2e52ae);}}; \ No newline at end of file +var _0x1e34=['dashboard:','./dashboard.events','save','remove','update','emit','length'];(function(_0x851d8a,_0xf3e2ce){var _0x4e2776=function(_0x424b00){while(--_0x424b00){_0x851d8a['push'](_0x851d8a['shift']());}};_0x4e2776(++_0xf3e2ce);}(_0x1e34,0x13c));var _0x41e3=function(_0x2395c7,_0x32c4a6){_0x2395c7=_0x2395c7-0x0;var _0x5ec0ff=_0x1e34[_0x2395c7];return _0x5ec0ff;};'use strict';var DashboardEvents=require(_0x41e3('0x0'));var events=[_0x41e3('0x1'),_0x41e3('0x2'),_0x41e3('0x3')];function createListener(_0x21867c,_0x3c904e){return function(_0xc22820){_0x3c904e[_0x41e3('0x4')](_0x21867c,_0xc22820);};}function removeListener(_0x2c4304,_0x5bd427){return function(){DashboardEvents['removeListener'](_0x2c4304,_0x5bd427);};}exports['register']=function(_0xc75bf4){for(var _0x5dd09a=0x0,_0x19e667=events[_0x41e3('0x5')];_0x5dd09a<_0x19e667;_0x5dd09a++){var _0x25154c=events[_0x5dd09a];var _0x2fd71d=createListener(_0x41e3('0x6')+_0x25154c,_0xc75bf4);DashboardEvents['on'](_0x25154c,_0x2fd71d);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 3a383fb..0be76d8 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 _0xe255=['delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','/:id/items','post','create','/:id/clone','clone','addItem','put'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xe255,0x112));var _0x5e25=function(_0x2b8a6f,_0xdb4817){_0x2b8a6f=_0x2b8a6f-0x0;var _0x2224a2=_0xe255[_0x2b8a6f];return _0x2224a2;};'use strict';var multer=require(_0x5e25('0x0'));var util=require(_0x5e25('0x1'));var path=require(_0x5e25('0x2'));var timeout=require(_0x5e25('0x3'));var express=require('express');var router=express[_0x5e25('0x4')]();var fs_extra=require(_0x5e25('0x5'));var auth=require(_0x5e25('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5e25('0x7'));var controller=require(_0x5e25('0x8'));router[_0x5e25('0x9')]('/',auth[_0x5e25('0xa')](),controller[_0x5e25('0xb')]);router[_0x5e25('0x9')](_0x5e25('0xc'),auth[_0x5e25('0xa')](),controller['show']);router[_0x5e25('0x9')](_0x5e25('0xd'),auth[_0x5e25('0xa')](),controller['getItems']);router[_0x5e25('0xe')]('/',auth[_0x5e25('0xa')](),controller[_0x5e25('0xf')]);router[_0x5e25('0xe')](_0x5e25('0x10'),auth[_0x5e25('0xa')](),controller[_0x5e25('0x11')]);router[_0x5e25('0xe')](_0x5e25('0xd'),auth[_0x5e25('0xa')](),controller[_0x5e25('0x12')]);router[_0x5e25('0x13')](_0x5e25('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x5e25('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3622=['../../components/interaction/service','../../config/environment','./dashboard.controller','index','show','get','/:id/items','isAuthenticated','getItems','post','create','/:id/clone','clone','addItem','put','/:id','update','delete','destroy','multer','util','express','Router'];(function(_0x3d29a8,_0x267f15){var _0x411bf5=function(_0x559ab1){while(--_0x559ab1){_0x3d29a8['push'](_0x3d29a8['shift']());}};_0x411bf5(++_0x267f15);}(_0x3622,0x127));var _0x2362=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0x3622[_0x9cfe28];return _0x54a1d0;};'use strict';var multer=require(_0x2362('0x0'));var util=require(_0x2362('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2362('0x2'));var router=express[_0x2362('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2362('0x4'));var config=require(_0x2362('0x5'));var controller=require(_0x2362('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x2362('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2362('0x8')]);router[_0x2362('0x9')](_0x2362('0xa'),auth[_0x2362('0xb')](),controller[_0x2362('0xc')]);router[_0x2362('0xd')]('/',auth['isAuthenticated'](),controller[_0x2362('0xe')]);router[_0x2362('0xd')](_0x2362('0xf'),auth['isAuthenticated'](),controller[_0x2362('0x10')]);router[_0x2362('0xd')](_0x2362('0xa'),auth[_0x2362('0xb')](),controller[_0x2362('0x11')]);router[_0x2362('0x12')](_0x2362('0x13'),auth['isAuthenticated'](),controller[_0x2362('0x14')]);router[_0x2362('0x15')](_0x2362('0x13'),auth[_0x2362('0xb')](),controller[_0x2362('0x16')]);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 c35619f..34a5088 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 _0xbd51=['setDataValue','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports','STRING','attrs','stringify'];(function(_0x178307,_0x57a662){var _0x47d971=function(_0x5afa47){while(--_0x5afa47){_0x178307['push'](_0x178307['shift']());}};_0x47d971(++_0x57a662);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x32c6a4,_0x434af2){_0x32c6a4=_0x32c6a4-0x0;var _0x3a70c1=_0xbd51[_0x32c6a4];return _0x3a70c1;};'use strict';var Sequelize=require(_0x1bd5('0x0'));var squel=require('squel');var _=require(_0x1bd5('0x1'));module[_0x1bd5('0x2')]={'title':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1bd5('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x1bd5('0x4')));}catch(_0x362b24){return[];}},'set':function(_0x43e6b6){try{this['setDataValue'](_0x1bd5('0x4'),JSON[_0x1bd5('0x5')](_0x43e6b6));}catch(_0x19077c){this[_0x1bd5('0x6')](_0x1bd5('0x4'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x1bd5('0x7')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1bd5('0x7')]},'col':{'type':Sequelize[_0x1bd5('0x7')]},'background':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![],'defaultValue':_0x1bd5('0x8'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![],'defaultValue':_0x1bd5('0x9'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1bd5('0x7')],'defaultValue':0xc}}; \ No newline at end of file +var _0xba34=['attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','parse','getDataValue'];(function(_0x5ca52d,_0x3a4a22){var _0x89e54e=function(_0x54bdf4){while(--_0x54bdf4){_0x5ca52d['push'](_0x5ca52d['shift']());}};_0x89e54e(++_0x3a4a22);}(_0xba34,0x119));var _0x4ba3=function(_0x1cea98,_0x4cb58b){_0x1cea98=_0x1cea98-0x0;var _0x458c4d=_0xba34[_0x1cea98];return _0x458c4d;};'use strict';var Sequelize=require(_0x4ba3('0x0'));var squel=require(_0x4ba3('0x1'));var _=require(_0x4ba3('0x2'));module[_0x4ba3('0x3')]={'title':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON[_0x4ba3('0x5')](this[_0x4ba3('0x6')](_0x4ba3('0x7')));}catch(_0x1011ec){return[];}},'set':function(_0x3590a1){try{this[_0x4ba3('0x8')](_0x4ba3('0x7'),JSON['stringify'](_0x3590a1));}catch(_0x6254fb){this[_0x4ba3('0x8')](_0x4ba3('0x7'),JSON[_0x4ba3('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x4ba3('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4ba3('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4ba3('0xa')]},'col':{'type':Sequelize[_0x4ba3('0xa')]},'background':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![],'defaultValue':_0x4ba3('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x4ba3('0x4')]},'titleFontSize':{'type':Sequelize[_0x4ba3('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 ce3b446..2c9c812 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 _0xe35f=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','redis','socket.io-emitter','./dashboardItem.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','query','filters','intersection','attributes','fields','merge','DashboardItem','catch','find','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie2','attrSerie3','attrReport','reportType','widgetAttributes:\x20%s','stringify','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x2edf8d,_0xadbeba){var _0x515ab3=function(_0xcec6a4){while(--_0xcec6a4){_0x2edf8d['push'](_0x2edf8d['shift']());}};_0x515ab3(++_0xadbeba);}(_0xe35f,0x140));var _0xfe35=function(_0x48bbec,_0x52ace7){_0x48bbec=_0x48bbec-0x0;var _0x10e105=_0xe35f[_0x48bbec];return _0x10e105;};'use strict';var emlformat=require(_0xfe35('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe35('0x1'));var jsonpatch=require(_0xfe35('0x2'));var rp=require('request-promise');var moment=require(_0xfe35('0x3'));var BPromise=require(_0xfe35('0x4'));var Mustache=require(_0xfe35('0x5'));var util=require('util');var path=require('path');var sox=require(_0xfe35('0x6'));var csv=require(_0xfe35('0x7'));var ejs=require(_0xfe35('0x8'));var fs=require('fs');var fs_extra=require(_0xfe35('0x9'));var _=require(_0xfe35('0xa'));var squel=require('squel');var crypto=require(_0xfe35('0xb'));var jsforce=require(_0xfe35('0xc'));var deskjs=require(_0xfe35('0xd'));var toCsv=require(_0xfe35('0x7'));var querystring=require(_0xfe35('0xe'));var Papa=require('papaparse');var Redis=require(_0xfe35('0xf'));var authService=require(_0xfe35('0x10'));var qs=require(_0xfe35('0x11'));var as=require(_0xfe35('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfe35('0x13'))('api');var utils=require(_0xfe35('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xfe35('0x15')]=_['defaults'](config[_0xfe35('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xfe35('0x16'))(new Redis(config[_0xfe35('0x15')]));require(_0xfe35('0x17'))[_0xfe35('0x18')](socket);function respondWithStatusCode(_0x482bbc,_0x2faddd){_0x2faddd=_0x2faddd||0xcc;return function(_0x45aa5f){if(_0x45aa5f){return _0x482bbc['sendStatus'](_0x2faddd);}return _0x482bbc[_0xfe35('0x19')](_0x2faddd)[_0xfe35('0x1a')]();};}function respondWithResult(_0x43bb4f,_0x41fd41){_0x41fd41=_0x41fd41||0xc8;return function(_0x470157){if(_0x470157){return _0x43bb4f[_0xfe35('0x19')](_0x41fd41)[_0xfe35('0x1b')](_0x470157);}};}function respondWithFilteredResult(_0x448b1f,_0x559949){return function(_0x383210){if(_0x383210){var _0x12d13b=typeof _0x559949[_0xfe35('0x1c')]==='undefined'&&typeof _0x559949[_0xfe35('0x1d')]===_0xfe35('0x1e');var _0x25c27c=_0x383210[_0xfe35('0x1f')];var _0x54823e=_0x12d13b?0x0:_0x559949[_0xfe35('0x1c')];var _0x39d74f=_0x12d13b?_0x383210[_0xfe35('0x1f')]:_0x559949[_0xfe35('0x1c')]+_0x559949[_0xfe35('0x1d')];var _0xc79096;if(_0x39d74f>=_0x25c27c){_0x39d74f=_0x25c27c;_0xc79096=0xc8;}else{_0xc79096=0xce;}_0x448b1f['status'](_0xc79096);return _0x448b1f[_0xfe35('0x20')](_0xfe35('0x21'),_0x54823e+'-'+_0x39d74f+'/'+_0x25c27c)[_0xfe35('0x1b')](_0x383210);}return null;};}function patchUpdates(_0x1ba0a8){return function(_0x1fefd1){try{jsonpatch[_0xfe35('0x22')](_0x1fefd1,_0x1ba0a8,!![]);}catch(_0x5902b6){return BPromise[_0xfe35('0x23')](_0x5902b6);}return _0x1fefd1[_0xfe35('0x24')]();};}function saveUpdates(_0x5b26b8,_0x30fc35){return function(_0x111133){if(_0x111133){return _0x111133[_0xfe35('0x25')](_0x5b26b8)[_0xfe35('0x26')](function(_0x822364){return _0x822364;});}return null;};}function removeEntity(_0x4b3eb5,_0x2c991f){return function(_0x306064){if(_0x306064){return _0x306064[_0xfe35('0x27')]()[_0xfe35('0x26')](function(){_0x4b3eb5[_0xfe35('0x19')](0xcc)[_0xfe35('0x1a')]();});}};}function handleEntityNotFound(_0x29e828,_0xaefa20){return function(_0x508bba){if(!_0x508bba){_0x29e828['sendStatus'](0x194);}return _0x508bba;};}function handleError(_0x1c5060,_0x15d83a){_0x15d83a=_0x15d83a||0x1f4;return function(_0x384964){logger[_0xfe35('0x28')](_0x384964[_0xfe35('0x29')]);if(_0x384964[_0xfe35('0x2a')]){delete _0x384964[_0xfe35('0x2a')];}_0x1c5060['status'](_0x15d83a)[_0xfe35('0x2b')](_0x384964);};}exports[_0xfe35('0x2c')]=function(_0x3c7689,_0x172e03){var _0x3c1875={'raw':![],'where':{'id':_0x3c7689[_0xfe35('0x2d')]['id']}},_0x342588={};_0x342588[_0xfe35('0x2e')]=_[_0xfe35('0x2f')](db['DashboardItem']['rawAttributes']);_0x342588[_0xfe35('0x30')]=_[_0xfe35('0x2f')](_0x3c7689[_0xfe35('0x30')]);_0x342588[_0xfe35('0x31')]=_[_0xfe35('0x32')](_0x342588['model'],_0x342588['query']);_0x3c1875[_0xfe35('0x33')]=_['intersection'](_0x342588[_0xfe35('0x2e')],qs[_0xfe35('0x34')](_0x3c7689['query'][_0xfe35('0x34')]));_0x3c1875[_0xfe35('0x33')]=_0x3c1875['attributes']['length']?_0x3c1875[_0xfe35('0x33')]:_0x342588[_0xfe35('0x2e')];if(_0x3c7689[_0xfe35('0x30')]['includeAll']){_0x3c1875['include']=[{'all':!![]}];}_0x3c1875=_[_0xfe35('0x35')]({},_0x3c1875,_0x3c7689['options']);return db[_0xfe35('0x36')]['find'](_0x3c1875)[_0xfe35('0x26')](handleEntityNotFound(_0x172e03,null))[_0xfe35('0x26')](respondWithResult(_0x172e03,null))[_0xfe35('0x37')](handleError(_0x172e03,null));};exports[_0xfe35('0x27')]=function(_0x2d1a14,_0x4584c7){return db[_0xfe35('0x36')][_0xfe35('0x38')]({'where':{'id':_0x2d1a14[_0xfe35('0x2d')]['id']}})['then'](handleEntityNotFound(_0x4584c7,null))[_0xfe35('0x26')](removeEntity(_0x4584c7,null))[_0xfe35('0x37')](handleError(_0x4584c7,null));};function widgetAttributes(_0x2b9a55){try{switch(_0x2b9a55['type']){case _0xfe35('0x39'):return[{'name':_0xfe35('0x3a'),'value':_0x2b9a55[_0xfe35('0x3a')]||(_0x2b9a55[_0xfe35('0x3b')]&&_0x2b9a55['attrs'][0x0]?_0x2b9a55[_0xfe35('0x3b')][0x0][_0xfe35('0x3c')]:undefined)||_0xfe35('0x3d')}];case _0xfe35('0x3e'):return[{'name':_0xfe35('0x3f'),'value':_0x2b9a55['attrPath']||(_0x2b9a55[_0xfe35('0x3b')]&&_0x2b9a55['attrs'][0x0]?_0x2b9a55[_0xfe35('0x3b')][0x0][_0xfe35('0x3c')]:undefined)||''}];case _0xfe35('0x40'):return[{'name':_0xfe35('0x41'),'value':_0x2b9a55[_0xfe35('0x41')]||(_0x2b9a55['attrs']&&_0x2b9a55[_0xfe35('0x3b')][0x0]?_0x2b9a55[_0xfe35('0x3b')][0x0][_0xfe35('0x3c')]:undefined)||'HH:mm:ss'},{'name':_0xfe35('0x42'),'value':_0x2b9a55['attrTimezone']||(_0x2b9a55[_0xfe35('0x3b')]&&_0x2b9a55[_0xfe35('0x3b')][0x1]?_0x2b9a55[_0xfe35('0x3b')][0x1][_0xfe35('0x3c')]:undefined)||_0xfe35('0x43')},{'name':'attrFontSize','value':_0x2b9a55[_0xfe35('0x44')]||(_0x2b9a55['attrs']&&_0x2b9a55[_0xfe35('0x3b')][0x2]?_0x2b9a55[_0xfe35('0x3b')][0x2][_0xfe35('0x3c')]:undefined)||0xc}];case _0xfe35('0x45'):return[{'name':_0xfe35('0x46'),'value':_0x2b9a55[_0xfe35('0x46')]||(_0x2b9a55[_0xfe35('0x3b')]&&_0x2b9a55[_0xfe35('0x3b')][0x0]?_0x2b9a55[_0xfe35('0x3b')][0x0][_0xfe35('0x3c')]:undefined)||_0xfe35('0x47')},{'name':_0xfe35('0x48'),'value':_0x2b9a55['attrVoiceQueues']||(_0x2b9a55['attrs']&&_0x2b9a55['attrs'][0x1]?_0x2b9a55[_0xfe35('0x3b')][0x1][_0xfe35('0x3c')]:undefined)||[]},{'name':_0xfe35('0x44'),'value':_0x2b9a55['attrFontSize']||(_0x2b9a55['attrs']&&_0x2b9a55[_0xfe35('0x3b')][0x2]?_0x2b9a55[_0xfe35('0x3b')][0x2][_0xfe35('0x3c')]:undefined)||0x14}];case _0xfe35('0x49'):case _0xfe35('0x4a'):return[{'name':'attrSerie1','value':_0x2b9a55['attrSerie1']||(_0x2b9a55['attrs']&&_0x2b9a55['attrs'][0x0]?_0x2b9a55[_0xfe35('0x3b')][0x0][_0xfe35('0x3c')]:undefined)||_0xfe35('0x47')},{'name':_0xfe35('0x4b'),'value':_0x2b9a55[_0xfe35('0x4b')]||(_0x2b9a55[_0xfe35('0x3b')]&&_0x2b9a55[_0xfe35('0x3b')][0x1]?_0x2b9a55[_0xfe35('0x3b')][0x1][_0xfe35('0x3c')]:undefined)||null},{'name':_0xfe35('0x4c'),'value':_0x2b9a55['attrSerie3']||(_0x2b9a55[_0xfe35('0x3b')]&&_0x2b9a55[_0xfe35('0x3b')][0x2]?_0x2b9a55['attrs'][0x2][_0xfe35('0x3c')]:undefined)||null},{'name':_0xfe35('0x48'),'value':_0x2b9a55[_0xfe35('0x48')]||(_0x2b9a55[_0xfe35('0x3b')]&&_0x2b9a55[_0xfe35('0x3b')][0x3]?_0x2b9a55['attrs'][0x3][_0xfe35('0x3c')]:undefined)||[]}];case'web-report':return[{'name':_0xfe35('0x4d'),'type':_0x2b9a55[_0xfe35('0x4e')]||(_0x2b9a55[_0xfe35('0x3b')]&&_0x2b9a55['attrs'][0x0]?_0x2b9a55['attrs'][0x0]['type']:undefined)||null,'value':_0x2b9a55[_0xfe35('0x4d')]||(_0x2b9a55[_0xfe35('0x3b')]&&_0x2b9a55[_0xfe35('0x3b')][0x0]?_0x2b9a55[_0xfe35('0x3b')][0x0][_0xfe35('0x3c')]:undefined)||null},{'name':'attrRefresh','value':_0x2b9a55['attrRefresh']||(_0x2b9a55[_0xfe35('0x3b')]&&_0x2b9a55['attrs'][0x1]?_0x2b9a55['attrs'][0x1][_0xfe35('0x3c')]:undefined)||0x0}];default:return[];}}catch(_0x31efbb){logger[_0xfe35('0x28')](_0xfe35('0x4f'),JSON[_0xfe35('0x50')](_0x31efbb));return[];}}exports[_0xfe35('0x51')]=function(_0x3658f4,_0x5e10aa){if(_0x3658f4[_0xfe35('0x52')]){_0x3658f4[_0xfe35('0x52')][_0xfe35('0x3b')]=widgetAttributes(_0x3658f4[_0xfe35('0x52')]);}return db['DashboardItem'][_0xfe35('0x51')](_0x3658f4[_0xfe35('0x52')],{})['then'](respondWithResult(_0x5e10aa,0xc9))['catch'](handleError(_0x5e10aa,null));};exports[_0xfe35('0x25')]=function(_0x117045,_0x252dd8){if(_0x117045[_0xfe35('0x52')]['id']){delete _0x117045['body']['id'];}_0x117045[_0xfe35('0x52')][_0xfe35('0x3b')]=widgetAttributes(_0x117045['body']);return db['DashboardItem'][_0xfe35('0x38')]({'where':{'id':_0x117045[_0xfe35('0x2d')]['id']}})[_0xfe35('0x26')](handleEntityNotFound(_0x252dd8,null))[_0xfe35('0x26')](saveUpdates(_0x117045[_0xfe35('0x52')],null))[_0xfe35('0x26')](respondWithResult(_0x252dd8,null))[_0xfe35('0x37')](handleError(_0x252dd8,null));}; \ No newline at end of file +var _0xd72b=['localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','show','model','keys','DashboardItem','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','find','catch','params','iframe','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie2','attrSerie3','web-report','attrReport','type','attrRefresh','stringify','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0xd72b,0x1ba));var _0xbd72=function(_0x535c88,_0x5437bf){_0x535c88=_0x535c88-0x0;var _0xceab9=_0xd72b[_0x535c88];return _0xceab9;};'use strict';var emlformat=require(_0xbd72('0x0'));var rimraf=require(_0xbd72('0x1'));var zipdir=require(_0xbd72('0x2'));var jsonpatch=require(_0xbd72('0x3'));var rp=require(_0xbd72('0x4'));var moment=require(_0xbd72('0x5'));var BPromise=require(_0xbd72('0x6'));var Mustache=require('mustache');var util=require(_0xbd72('0x7'));var path=require(_0xbd72('0x8'));var sox=require('sox');var csv=require(_0xbd72('0x9'));var ejs=require(_0xbd72('0xa'));var fs=require('fs');var fs_extra=require(_0xbd72('0xb'));var _=require(_0xbd72('0xc'));var squel=require(_0xbd72('0xd'));var crypto=require('crypto');var jsforce=require(_0xbd72('0xe'));var deskjs=require(_0xbd72('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbd72('0x10'));var Papa=require('papaparse');var Redis=require(_0xbd72('0x11'));var authService=require(_0xbd72('0x12'));var qs=require(_0xbd72('0x13'));var as=require(_0xbd72('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd72('0x15'))(_0xbd72('0x16'));var utils=require(_0xbd72('0x17'));var config=require(_0xbd72('0x18'));var licenseUtil=require(_0xbd72('0x19'));var db=require('../../mysqldb')['db'];config[_0xbd72('0x1a')]=_[_0xbd72('0x1b')](config['redis'],{'host':_0xbd72('0x1c'),'port':0x18eb});var socket=require(_0xbd72('0x1d'))(new Redis(config[_0xbd72('0x1a')]));require(_0xbd72('0x1e'))['register'](socket);function respondWithStatusCode(_0x5cd756,_0x42fc88){_0x42fc88=_0x42fc88||0xcc;return function(_0xb11c86){if(_0xb11c86){return _0x5cd756[_0xbd72('0x1f')](_0x42fc88);}return _0x5cd756[_0xbd72('0x20')](_0x42fc88)['end']();};}function respondWithResult(_0x5b2d08,_0x19490f){_0x19490f=_0x19490f||0xc8;return function(_0x4ea6a5){if(_0x4ea6a5){return _0x5b2d08['status'](_0x19490f)[_0xbd72('0x21')](_0x4ea6a5);}};}function respondWithFilteredResult(_0xb7076d,_0x4cd04b){return function(_0x398745){if(_0x398745){var _0x4cfd1a=typeof _0x4cd04b[_0xbd72('0x22')]==='undefined'&&typeof _0x4cd04b['limit']===_0xbd72('0x23');var _0x170ede=_0x398745[_0xbd72('0x24')];var _0x4bad06=_0x4cfd1a?0x0:_0x4cd04b[_0xbd72('0x22')];var _0x2bf050=_0x4cfd1a?_0x398745[_0xbd72('0x24')]:_0x4cd04b[_0xbd72('0x22')]+_0x4cd04b[_0xbd72('0x25')];var _0x137bdd;if(_0x2bf050>=_0x170ede){_0x2bf050=_0x170ede;_0x137bdd=0xc8;}else{_0x137bdd=0xce;}_0xb7076d[_0xbd72('0x20')](_0x137bdd);return _0xb7076d[_0xbd72('0x26')](_0xbd72('0x27'),_0x4bad06+'-'+_0x2bf050+'/'+_0x170ede)['json'](_0x398745);}return null;};}function patchUpdates(_0x4edaf7){return function(_0x46eafa){try{jsonpatch[_0xbd72('0x28')](_0x46eafa,_0x4edaf7,!![]);}catch(_0x5f1c7e){return BPromise[_0xbd72('0x29')](_0x5f1c7e);}return _0x46eafa[_0xbd72('0x2a')]();};}function saveUpdates(_0x1d1a27,_0x1dc8d0){return function(_0x585981){if(_0x585981){return _0x585981['update'](_0x1d1a27)[_0xbd72('0x2b')](function(_0x33d6d3){return _0x33d6d3;});}return null;};}function removeEntity(_0x1042df,_0x427b29){return function(_0x1ce08d){if(_0x1ce08d){return _0x1ce08d[_0xbd72('0x2c')]()['then'](function(){_0x1042df[_0xbd72('0x20')](0xcc)[_0xbd72('0x2d')]();});}};}function handleEntityNotFound(_0x11d740,_0x5a3468){return function(_0x332ace){if(!_0x332ace){_0x11d740[_0xbd72('0x1f')](0x194);}return _0x332ace;};}function handleError(_0x5055c4,_0x98dfb0){_0x98dfb0=_0x98dfb0||0x1f4;return function(_0x2493b6){logger[_0xbd72('0x2e')](_0x2493b6[_0xbd72('0x2f')]);if(_0x2493b6[_0xbd72('0x30')]){delete _0x2493b6[_0xbd72('0x30')];}_0x5055c4[_0xbd72('0x20')](_0x98dfb0)[_0xbd72('0x31')](_0x2493b6);};}exports[_0xbd72('0x32')]=function(_0x166136,_0x217e94){var _0x8367f9={'raw':![],'where':{'id':_0x166136['params']['id']}},_0x79da7c={};_0x79da7c[_0xbd72('0x33')]=_[_0xbd72('0x34')](db[_0xbd72('0x35')][_0xbd72('0x36')]);_0x79da7c[_0xbd72('0x37')]=_[_0xbd72('0x34')](_0x166136[_0xbd72('0x37')]);_0x79da7c['filters']=_['intersection'](_0x79da7c['model'],_0x79da7c['query']);_0x8367f9[_0xbd72('0x38')]=_[_0xbd72('0x39')](_0x79da7c[_0xbd72('0x33')],qs['fields'](_0x166136[_0xbd72('0x37')][_0xbd72('0x3a')]));_0x8367f9[_0xbd72('0x38')]=_0x8367f9[_0xbd72('0x38')][_0xbd72('0x3b')]?_0x8367f9['attributes']:_0x79da7c['model'];if(_0x166136['query'][_0xbd72('0x3c')]){_0x8367f9[_0xbd72('0x3d')]=[{'all':!![]}];}_0x8367f9=_['merge']({},_0x8367f9,_0x166136['options']);return db[_0xbd72('0x35')][_0xbd72('0x3e')](_0x8367f9)[_0xbd72('0x2b')](handleEntityNotFound(_0x217e94,null))['then'](respondWithResult(_0x217e94,null))[_0xbd72('0x3f')](handleError(_0x217e94,null));};exports[_0xbd72('0x2c')]=function(_0x455135,_0x49dc7c){return db[_0xbd72('0x35')]['find']({'where':{'id':_0x455135[_0xbd72('0x40')]['id']}})[_0xbd72('0x2b')](handleEntityNotFound(_0x49dc7c,null))[_0xbd72('0x2b')](removeEntity(_0x49dc7c,null))[_0xbd72('0x3f')](handleError(_0x49dc7c,null));};function widgetAttributes(_0x4b1e3b){try{switch(_0x4b1e3b['type']){case _0xbd72('0x41'):return[{'name':_0xbd72('0x42'),'value':_0x4b1e3b[_0xbd72('0x42')]||(_0x4b1e3b[_0xbd72('0x43')]&&_0x4b1e3b[_0xbd72('0x43')][0x0]?_0x4b1e3b[_0xbd72('0x43')][0x0]['value']:undefined)||_0xbd72('0x44')}];case _0xbd72('0x45'):return[{'name':_0xbd72('0x46'),'value':_0x4b1e3b[_0xbd72('0x46')]||(_0x4b1e3b['attrs']&&_0x4b1e3b[_0xbd72('0x43')][0x0]?_0x4b1e3b[_0xbd72('0x43')][0x0]['value']:undefined)||''}];case _0xbd72('0x47'):return[{'name':'attrHourFormat','value':_0x4b1e3b[_0xbd72('0x48')]||(_0x4b1e3b[_0xbd72('0x43')]&&_0x4b1e3b[_0xbd72('0x43')][0x0]?_0x4b1e3b[_0xbd72('0x43')][0x0][_0xbd72('0x49')]:undefined)||_0xbd72('0x4a')},{'name':_0xbd72('0x4b'),'value':_0x4b1e3b[_0xbd72('0x4b')]||(_0x4b1e3b[_0xbd72('0x43')]&&_0x4b1e3b[_0xbd72('0x43')][0x1]?_0x4b1e3b[_0xbd72('0x43')][0x1][_0xbd72('0x49')]:undefined)||_0xbd72('0x4c')},{'name':_0xbd72('0x4d'),'value':_0x4b1e3b[_0xbd72('0x4d')]||(_0x4b1e3b[_0xbd72('0x43')]&&_0x4b1e3b[_0xbd72('0x43')][0x2]?_0x4b1e3b[_0xbd72('0x43')][0x2]['value']:undefined)||0xc}];case _0xbd72('0x4e'):return[{'name':_0xbd72('0x4f'),'value':_0x4b1e3b['attrMetric']||(_0x4b1e3b[_0xbd72('0x43')]&&_0x4b1e3b[_0xbd72('0x43')][0x0]?_0x4b1e3b['attrs'][0x0][_0xbd72('0x49')]:undefined)||_0xbd72('0x50')},{'name':_0xbd72('0x51'),'value':_0x4b1e3b[_0xbd72('0x51')]||(_0x4b1e3b[_0xbd72('0x43')]&&_0x4b1e3b[_0xbd72('0x43')][0x1]?_0x4b1e3b['attrs'][0x1]['value']:undefined)||[]},{'name':_0xbd72('0x4d'),'value':_0x4b1e3b[_0xbd72('0x4d')]||(_0x4b1e3b[_0xbd72('0x43')]&&_0x4b1e3b[_0xbd72('0x43')][0x2]?_0x4b1e3b[_0xbd72('0x43')][0x2]['value']:undefined)||0x14}];case _0xbd72('0x52'):case _0xbd72('0x53'):return[{'name':'attrSerie1','value':_0x4b1e3b['attrSerie1']||(_0x4b1e3b[_0xbd72('0x43')]&&_0x4b1e3b['attrs'][0x0]?_0x4b1e3b['attrs'][0x0][_0xbd72('0x49')]:undefined)||_0xbd72('0x50')},{'name':_0xbd72('0x54'),'value':_0x4b1e3b[_0xbd72('0x54')]||(_0x4b1e3b[_0xbd72('0x43')]&&_0x4b1e3b['attrs'][0x1]?_0x4b1e3b[_0xbd72('0x43')][0x1][_0xbd72('0x49')]:undefined)||null},{'name':_0xbd72('0x55'),'value':_0x4b1e3b['attrSerie3']||(_0x4b1e3b[_0xbd72('0x43')]&&_0x4b1e3b[_0xbd72('0x43')][0x2]?_0x4b1e3b[_0xbd72('0x43')][0x2][_0xbd72('0x49')]:undefined)||null},{'name':_0xbd72('0x51'),'value':_0x4b1e3b[_0xbd72('0x51')]||(_0x4b1e3b['attrs']&&_0x4b1e3b[_0xbd72('0x43')][0x3]?_0x4b1e3b['attrs'][0x3][_0xbd72('0x49')]:undefined)||[]}];case _0xbd72('0x56'):return[{'name':_0xbd72('0x57'),'type':_0x4b1e3b['reportType']||(_0x4b1e3b['attrs']&&_0x4b1e3b[_0xbd72('0x43')][0x0]?_0x4b1e3b[_0xbd72('0x43')][0x0][_0xbd72('0x58')]:undefined)||null,'value':_0x4b1e3b[_0xbd72('0x57')]||(_0x4b1e3b['attrs']&&_0x4b1e3b[_0xbd72('0x43')][0x0]?_0x4b1e3b[_0xbd72('0x43')][0x0]['value']:undefined)||null},{'name':_0xbd72('0x59'),'value':_0x4b1e3b[_0xbd72('0x59')]||(_0x4b1e3b[_0xbd72('0x43')]&&_0x4b1e3b[_0xbd72('0x43')][0x1]?_0x4b1e3b[_0xbd72('0x43')][0x1][_0xbd72('0x49')]:undefined)||0x0}];default:return[];}}catch(_0x2137b2){logger['error']('widgetAttributes:\x20%s',JSON[_0xbd72('0x5a')](_0x2137b2));return[];}}exports[_0xbd72('0x5b')]=function(_0x1ae66e,_0x464e1b){if(_0x1ae66e['body']){_0x1ae66e['body'][_0xbd72('0x43')]=widgetAttributes(_0x1ae66e[_0xbd72('0x5c')]);}return db[_0xbd72('0x35')][_0xbd72('0x5b')](_0x1ae66e['body'],{})[_0xbd72('0x2b')](respondWithResult(_0x464e1b,0xc9))[_0xbd72('0x3f')](handleError(_0x464e1b,null));};exports[_0xbd72('0x5d')]=function(_0x345878,_0xaadf4){if(_0x345878[_0xbd72('0x5c')]['id']){delete _0x345878[_0xbd72('0x5c')]['id'];}_0x345878[_0xbd72('0x5c')][_0xbd72('0x43')]=widgetAttributes(_0x345878['body']);return db[_0xbd72('0x35')][_0xbd72('0x3e')]({'where':{'id':_0x345878[_0xbd72('0x40')]['id']}})[_0xbd72('0x2b')](handleEntityNotFound(_0xaadf4,null))[_0xbd72('0x2b')](saveUpdates(_0x345878[_0xbd72('0x5c')],null))[_0xbd72('0x2b')](respondWithResult(_0xaadf4,null))[_0xbd72('0x3f')](handleError(_0xaadf4,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index a7491c8..36357c0 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 _0x740d=['hasOwnProperty','hook','exports','events','../../mysqldb','save','remove','emit'];(function(_0x289842,_0x2d9db4){var _0x16155a=function(_0x1d0510){while(--_0x1d0510){_0x289842['push'](_0x289842['shift']());}};_0x16155a(++_0x2d9db4);}(_0x740d,0x193));var _0xd740=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x740d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd740('0x0'));var DashboardItem=require(_0xd740('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd740('0x2'),'afterUpdate':'update','afterDestroy':_0xd740('0x3')};function emitEvent(_0x49a64f){return function(_0x1348cf,_0x2179f7,_0x2f7164){DashboardItemEvents[_0xd740('0x4')](_0x49a64f+':'+_0x1348cf['id'],_0x1348cf);DashboardItemEvents[_0xd740('0x4')](_0x49a64f,_0x1348cf);_0x2f7164(null);};}for(var e in events){if(events[_0xd740('0x5')](e)){var event=events[e];DashboardItem[_0xd740('0x6')](e,emitEvent(event));}}module[_0xd740('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xb838=['DashboardItem','setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0xb838,0x14b));var _0x8b83=function(_0x5d96bd,_0x44696e){_0x5d96bd=_0x5d96bd-0x0;var _0x7f23f7=_0xb838[_0x5d96bd];return _0x7f23f7;};'use strict';var EventEmitter=require(_0x8b83('0x0'));var DashboardItem=require(_0x8b83('0x1'))['db'][_0x8b83('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x8b83('0x3')](0x0);var events={'afterCreate':_0x8b83('0x4'),'afterUpdate':_0x8b83('0x5'),'afterDestroy':_0x8b83('0x6')};function emitEvent(_0x180860){return function(_0x469d40,_0x1f685b,_0x886666){DashboardItemEvents[_0x8b83('0x7')](_0x180860+':'+_0x469d40['id'],_0x469d40);DashboardItemEvents[_0x8b83('0x7')](_0x180860,_0x469d40);_0x886666(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x8b83('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index f01b772..68b3f14 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 _0x3d9c=['request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','lodash','../../config/logger','api','moment'];(function(_0xecafad,_0x67899f){var _0x1c578e=function(_0x4a8a45){while(--_0x4a8a45){_0xecafad['push'](_0xecafad['shift']());}};_0x1c578e(++_0x67899f);}(_0x3d9c,0x134));var _0xc3d9=function(_0x2d7e4b,_0x4d65e2){_0x2d7e4b=_0x2d7e4b-0x0;var _0xe8c230=_0x3d9c[_0x2d7e4b];return _0xe8c230;};'use strict';var _=require(_0xc3d9('0x0'));var util=require('util');var logger=require(_0xc3d9('0x1'))(_0xc3d9('0x2'));var moment=require(_0xc3d9('0x3'));var BPromise=require('bluebird');var rp=require(_0xc3d9('0x4'));var fs=require('fs');var path=require(_0xc3d9('0x5'));var rimraf=require(_0xc3d9('0x6'));var config=require(_0xc3d9('0x7'));var attributes=require(_0xc3d9('0x8'));module[_0xc3d9('0x9')]=function(_0x137aaf,_0x492577){return _0x137aaf[_0xc3d9('0xa')](_0xc3d9('0xb'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e9f=['util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','DashboardItem','dashboard_items'];(function(_0x1b9308,_0x4518be){var _0x4c2cf5=function(_0x1ad59e){while(--_0x1ad59e){_0x1b9308['push'](_0x1b9308['shift']());}};_0x4c2cf5(++_0x4518be);}(_0x7e9f,0xf2));var _0xf7e9=function(_0x7695ad,_0x4d6402){_0x7695ad=_0x7695ad-0x0;var _0x4f4cef=_0x7e9f[_0x7695ad];return _0x4f4cef;};'use strict';var _=require('lodash');var util=require(_0xf7e9('0x0'));var logger=require('../../config/logger')(_0xf7e9('0x1'));var moment=require(_0xf7e9('0x2'));var BPromise=require(_0xf7e9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf7e9('0x4'));var rimraf=require(_0xf7e9('0x5'));var config=require(_0xf7e9('0x6'));var attributes=require('./dashboardItem.attributes');module[_0xf7e9('0x7')]=function(_0x51d539,_0x2c04cb){return _0x51d539[_0xf7e9('0x8')](_0xf7e9('0x9'),attributes,{'tableName':_0xf7e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 47aec16..b54e50a 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 _0x5d62=['request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','request','info','DashboardItem,\x20%s,\x20%s'];(function(_0x1eddad,_0x7ca030){var _0x40104c=function(_0x194163){while(--_0x194163){_0x1eddad['push'](_0x1eddad['shift']());}};_0x40104c(++_0x7ca030);}(_0x5d62,0x115));var _0x25d6=function(_0x520552,_0x568c01){_0x520552=_0x520552-0x0;var _0x545f39=_0x5d62[_0x520552];return _0x545f39;};'use strict';var _=require(_0x25d6('0x0'));var util=require(_0x25d6('0x1'));var moment=require(_0x25d6('0x2'));var BPromise=require(_0x25d6('0x3'));var rs=require(_0x25d6('0x4'));var fs=require('fs');var Redis=require(_0x25d6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x25d6('0x6'));var logger=require(_0x25d6('0x7'))(_0x25d6('0x8'));var config=require(_0x25d6('0x9'));var jayson=require(_0x25d6('0xa'));var client=jayson[_0x25d6('0xb')][_0x25d6('0xc')]({'port':0x232a});config['redis']=_[_0x25d6('0xd')](config[_0x25d6('0xe')],{'host':_0x25d6('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboardItem.socket')[_0x25d6('0x10')](socket);function respondWithRpcPromise(_0x25c8f0,_0x1ead04,_0x36420b){return new BPromise(function(_0x1bef0c,_0x398692){return client[_0x25d6('0x11')](_0x25c8f0,_0x36420b)['then'](function(_0x461b30){logger[_0x25d6('0x12')](_0x25d6('0x13'),_0x1ead04,_0x25d6('0x14'));logger[_0x25d6('0x15')](_0x25d6('0x16'),_0x1ead04,_0x25d6('0x14'),JSON[_0x25d6('0x17')](_0x461b30));if(_0x461b30['error']){if(_0x461b30[_0x25d6('0x18')]['code']===0x1f4){logger['error'](_0x25d6('0x13'),_0x1ead04,_0x461b30['error'][_0x25d6('0x19')]);return _0x398692(_0x461b30[_0x25d6('0x18')][_0x25d6('0x19')]);}logger[_0x25d6('0x18')](_0x25d6('0x13'),_0x1ead04,_0x461b30[_0x25d6('0x18')][_0x25d6('0x19')]);return _0x1bef0c(_0x461b30[_0x25d6('0x18')]['message']);}else{logger[_0x25d6('0x12')]('DashboardItem,\x20%s,\x20%s',_0x1ead04,'request\x20sent');_0x1bef0c(_0x461b30['result'][_0x25d6('0x19')]);}})[_0x25d6('0x1a')](function(_0x3e5dd8){logger['error'](_0x25d6('0x13'),_0x1ead04,_0x3e5dd8);_0x398692(_0x3e5dd8);});});} \ No newline at end of file +var _0xde4d=['error','code','message','DashboardItem,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5d2ea7,_0x14bb82){var _0xae9a8e=function(_0x4116d0){while(--_0x4116d0){_0x5d2ea7['push'](_0x5d2ea7['shift']());}};_0xae9a8e(++_0x14bb82);}(_0xde4d,0x17b));var _0xdde4=function(_0x1a6d71,_0x51861e){_0x1a6d71=_0x1a6d71-0x0;var _0x357ad7=_0xde4d[_0x1a6d71];return _0x357ad7;};'use strict';var _=require(_0xdde4('0x0'));var util=require(_0xdde4('0x1'));var moment=require(_0xdde4('0x2'));var BPromise=require(_0xdde4('0x3'));var rs=require(_0xdde4('0x4'));var fs=require('fs');var Redis=require(_0xdde4('0x5'));var db=require(_0xdde4('0x6'))['db'];var utils=require(_0xdde4('0x7'));var logger=require(_0xdde4('0x8'))(_0xdde4('0x9'));var config=require('../../config/environment');var jayson=require(_0xdde4('0xa'));var client=jayson[_0xdde4('0xb')][_0xdde4('0xc')]({'port':0x232a});config[_0xdde4('0xd')]=_[_0xdde4('0xe')](config['redis'],{'host':_0xdde4('0xf'),'port':0x18eb});var socket=require(_0xdde4('0x10'))(new Redis(config[_0xdde4('0xd')]));require(_0xdde4('0x11'))[_0xdde4('0x12')](socket);function respondWithRpcPromise(_0x473633,_0x197d63,_0x46eceb){return new BPromise(function(_0x582ef5,_0x19cd2d){return client[_0xdde4('0x13')](_0x473633,_0x46eceb)[_0xdde4('0x14')](function(_0x47a442){logger['info']('DashboardItem,\x20%s,\x20%s',_0x197d63,_0xdde4('0x15'));logger['debug'](_0xdde4('0x16'),_0x197d63,'request\x20sent',JSON[_0xdde4('0x17')](_0x47a442));if(_0x47a442[_0xdde4('0x18')]){if(_0x47a442[_0xdde4('0x18')][_0xdde4('0x19')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x197d63,_0x47a442[_0xdde4('0x18')][_0xdde4('0x1a')]);return _0x19cd2d(_0x47a442[_0xdde4('0x18')][_0xdde4('0x1a')]);}logger[_0xdde4('0x18')](_0xdde4('0x1b'),_0x197d63,_0x47a442['error'][_0xdde4('0x1a')]);return _0x582ef5(_0x47a442['error'][_0xdde4('0x1a')]);}else{logger[_0xdde4('0x1c')](_0xdde4('0x1b'),_0x197d63,_0xdde4('0x15'));_0x582ef5(_0x47a442[_0xdde4('0x1d')][_0xdde4('0x1a')]);}})[_0xdde4('0x1e')](function(_0x538be9){logger[_0xdde4('0x18')](_0xdde4('0x1b'),_0x197d63,_0x538be9);_0x19cd2d(_0x538be9);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 3fc0063..1727916 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 _0x6474=['remove','update','removeListener','dashboardItem:'];(function(_0x554eff,_0x515dd9){var _0x416215=function(_0x5a0921){while(--_0x5a0921){_0x554eff['push'](_0x554eff['shift']());}};_0x416215(++_0x515dd9);}(_0x6474,0x1e8));var _0x4647=function(_0x19a383,_0x4d9250){_0x19a383=_0x19a383-0x0;var _0x326f2d=_0x6474[_0x19a383];return _0x326f2d;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save',_0x4647('0x0'),_0x4647('0x1')];function createListener(_0x41b268,_0x588ef2){return function(_0x1b53b8){_0x588ef2['emit'](_0x41b268,_0x1b53b8);};}function removeListener(_0x5be160,_0x1069b0){return function(){DashboardItemEvents[_0x4647('0x2')](_0x5be160,_0x1069b0);};}exports['register']=function(_0x3ac5fd){for(var _0x38d593=0x0,_0x14398d=events['length'];_0x38d593<_0x14398d;_0x38d593++){var _0x22d95e=events[_0x38d593];var _0x478595=createListener(_0x4647('0x3')+_0x22d95e,_0x3ac5fd);DashboardItemEvents['on'](_0x22d95e,_0x478595);}}; \ No newline at end of file +var _0x92e9=['./dashboardItem.events','save','remove','update','removeListener','register','dashboardItem:'];(function(_0x270443,_0x4bac89){var _0x38c6b2=function(_0x2a19a6){while(--_0x2a19a6){_0x270443['push'](_0x270443['shift']());}};_0x38c6b2(++_0x4bac89);}(_0x92e9,0x103));var _0x992e=function(_0x5831df,_0x340484){_0x5831df=_0x5831df-0x0;var _0x16a39e=_0x92e9[_0x5831df];return _0x16a39e;};'use strict';var DashboardItemEvents=require(_0x992e('0x0'));var events=[_0x992e('0x1'),_0x992e('0x2'),_0x992e('0x3')];function createListener(_0x3686a1,_0x4074cb){return function(_0x11e3f9){_0x4074cb['emit'](_0x3686a1,_0x11e3f9);};}function removeListener(_0x2cdac6,_0x5c7a93){return function(){DashboardItemEvents[_0x992e('0x4')](_0x2cdac6,_0x5c7a93);};}exports[_0x992e('0x5')]=function(_0x3a08cf){for(var _0x2fc3b7=0x0,_0x4aa2dd=events['length'];_0x2fc3b7<_0x4aa2dd;_0x2fc3b7++){var _0x2015cd=events[_0x2fc3b7];var _0x2a4549=createListener(_0x992e('0x6')+_0x2015cd,_0x3a08cf);DashboardItemEvents['on'](_0x2015cd,_0x2a4549);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 5ee7f56..ea07353 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 _0xbd71=['delete','destroy','multer','express','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','update'];(function(_0x2420d3,_0x3cb202){var _0x438bee=function(_0x8db748){while(--_0x8db748){_0x2420d3['push'](_0x2420d3['shift']());}};_0x438bee(++_0x3cb202);}(_0xbd71,0x160));var _0x1bd7=function(_0x6bda29,_0x2b1686){_0x6bda29=_0x6bda29-0x0;var _0x47a5cc=_0xbd71[_0x6bda29];return _0x47a5cc;};'use strict';var multer=require(_0x1bd7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1bd7('0x1'));var router=express['Router']();var fs_extra=require(_0x1bd7('0x2'));var auth=require(_0x1bd7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1bd7('0x4'));var controller=require(_0x1bd7('0x5'));router[_0x1bd7('0x6')](_0x1bd7('0x7'),auth[_0x1bd7('0x8')](),controller[_0x1bd7('0x9')]);router[_0x1bd7('0xa')]('/',auth[_0x1bd7('0x8')](),controller['create']);router['put'](_0x1bd7('0x7'),auth[_0x1bd7('0x8')](),controller[_0x1bd7('0xb')]);router[_0x1bd7('0xc')](_0x1bd7('0x7'),auth[_0x1bd7('0x8')](),controller[_0x1bd7('0xd')]);module['exports']=router; \ No newline at end of file +var _0x35f1=['exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','isAuthenticated','post','create','put','/:id','delete','destroy'];(function(_0x28bb5a,_0xa2396d){var _0x4580a4=function(_0x1c1082){while(--_0x1c1082){_0x28bb5a['push'](_0x28bb5a['shift']());}};_0x4580a4(++_0xa2396d);}(_0x35f1,0x178));var _0x135f=function(_0x49c524,_0x2f91e8){_0x49c524=_0x49c524-0x0;var _0xf98507=_0x35f1[_0x49c524];return _0xf98507;};'use strict';var multer=require('multer');var util=require(_0x135f('0x0'));var path=require('path');var timeout=require(_0x135f('0x1'));var express=require(_0x135f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x135f('0x3'));var interaction=require(_0x135f('0x4'));var config=require('../../config/environment');var controller=require(_0x135f('0x5'));router[_0x135f('0x6')]('/:id',auth[_0x135f('0x7')](),controller['show']);router[_0x135f('0x8')]('/',auth[_0x135f('0x7')](),controller[_0x135f('0x9')]);router[_0x135f('0xa')](_0x135f('0xb'),auth[_0x135f('0x7')](),controller['update']);router[_0x135f('0xc')](_0x135f('0xb'),auth[_0x135f('0x7')](),controller[_0x135f('0xd')]);module[_0x135f('0xe')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 4e7feab..36647e0 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 _0x2e64=['ENUM','first','STRING'];(function(_0x3d4a6b,_0x20dbcb){var _0x55d64a=function(_0x220a50){while(--_0x220a50){_0x3d4a6b['push'](_0x3d4a6b['shift']());}};_0x55d64a(++_0x20dbcb);}(_0x2e64,0x1dc));var _0x42e6=function(_0x4d3e79,_0x124e0d){_0x4d3e79=_0x4d3e79-0x0;var _0x15d9d5=_0x2e64[_0x4d3e79];return _0x15d9d5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x42e6('0x0')],'allowNull':![]},'level':{'type':Sequelize[_0x42e6('0x1')](_0x42e6('0x2'),'second','third'),'allowNull':![],'defaultValue':_0x42e6('0x2')},'description':{'type':Sequelize[_0x42e6('0x0')]}}; \ No newline at end of file +var _0xba7d=['STRING','first','third','sequelize','exports'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xba7d,0xcb));var _0xdba7=function(_0x34e49e,_0x1ce696){_0x34e49e=_0x34e49e-0x0;var _0x5dfdfa=_0xba7d[_0x34e49e];return _0x5dfdfa;};'use strict';var Sequelize=require(_0xdba7('0x0'));module[_0xdba7('0x1')]={'name':{'type':Sequelize[_0xdba7('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xdba7('0x3'),'second',_0xdba7('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xdba7('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index a89fcf1..82a3fcf 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 _0x19af=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','reject','save','update','destroy','Dispositions','UserProfileResource','then','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','nolimit','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','util','to-csv','ejs','crypto','jsforce'];(function(_0x25664f,_0x1c2bda){var _0x13aa8a=function(_0x5200ff){while(--_0x5200ff){_0x25664f['push'](_0x25664f['shift']());}};_0x13aa8a(++_0x1c2bda);}(_0x19af,0xe6));var _0xf19a=function(_0x54c17a,_0x480446){_0x54c17a=_0x54c17a-0x0;var _0x5f0254=_0x19af[_0x54c17a];return _0x5f0254;};'use strict';var emlformat=require(_0xf19a('0x0'));var rimraf=require(_0xf19a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf19a('0x2'));var rp=require(_0xf19a('0x3'));var moment=require(_0xf19a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf19a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xf19a('0x6'));var ejs=require(_0xf19a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf19a('0x8'));var jsforce=require(_0xf19a('0x9'));var deskjs=require(_0xf19a('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf19a('0xb'));var Papa=require(_0xf19a('0xc'));var Redis=require(_0xf19a('0xd'));var authService=require(_0xf19a('0xe'));var qs=require(_0xf19a('0xf'));var as=require(_0xf19a('0x10'));var hardwareService=require(_0xf19a('0x11'));var logger=require(_0xf19a('0x12'))(_0xf19a('0x13'));var utils=require(_0xf19a('0x14'));var config=require(_0xf19a('0x15'));var licenseUtil=require(_0xf19a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e3714,_0x1aad07){_0x1aad07=_0x1aad07||0xcc;return function(_0x5c74d3){if(_0x5c74d3){return _0x4e3714[_0xf19a('0x17')](_0x1aad07);}return _0x4e3714[_0xf19a('0x18')](_0x1aad07)[_0xf19a('0x19')]();};}function respondWithResult(_0x2e40b8,_0x406bb3){_0x406bb3=_0x406bb3||0xc8;return function(_0x3e61d8){if(_0x3e61d8){return _0x2e40b8[_0xf19a('0x18')](_0x406bb3)[_0xf19a('0x1a')](_0x3e61d8);}};}function respondWithFilteredResult(_0x481706,_0x2b416d){return function(_0x5612a9){if(_0x5612a9){var _0x49585a=typeof _0x2b416d['offset']===_0xf19a('0x1b')&&typeof _0x2b416d[_0xf19a('0x1c')]===_0xf19a('0x1b');var _0x179487=_0x5612a9['count'];var _0x36be58=_0x49585a?0x0:_0x2b416d[_0xf19a('0x1d')];var _0x5864a2=_0x49585a?_0x5612a9[_0xf19a('0x1e')]:_0x2b416d[_0xf19a('0x1d')]+_0x2b416d[_0xf19a('0x1c')];var _0x4aa82d;if(_0x5864a2>=_0x179487){_0x5864a2=_0x179487;_0x4aa82d=0xc8;}else{_0x4aa82d=0xce;}_0x481706['status'](_0x4aa82d);return _0x481706[_0xf19a('0x1f')]('Content-Range',_0x36be58+'-'+_0x5864a2+'/'+_0x179487)[_0xf19a('0x1a')](_0x5612a9);}return null;};}function patchUpdates(_0xadd58b){return function(_0x29a9f0){try{jsonpatch['apply'](_0x29a9f0,_0xadd58b,!![]);}catch(_0x4ad0d3){return BPromise[_0xf19a('0x20')](_0x4ad0d3);}return _0x29a9f0[_0xf19a('0x21')]();};}function saveUpdates(_0x2ed019,_0x4cf907){return function(_0x4b4daa){if(_0x4b4daa){return _0x4b4daa[_0xf19a('0x22')](_0x2ed019)['then'](function(_0x2687de){return _0x2687de;});}return null;};}function removeEntity(_0x5653b8,_0x5db06a){return function(_0x357416){if(_0x357416){return _0x357416[_0xf19a('0x23')]()['then'](function(){var _0x4070bd=_0x357416['get']({'plain':!![]});var _0x374f5d=_0xf19a('0x24');return db[_0xf19a('0x25')][_0xf19a('0x23')]({'where':{'type':_0x374f5d,'resourceId':_0x4070bd['id']}})['then'](function(){return _0x357416;});})[_0xf19a('0x26')](function(){_0x5653b8['status'](0xcc)[_0xf19a('0x19')]();});}};}function handleEntityNotFound(_0x142d66,_0x4a3070){return function(_0x350773){if(!_0x350773){_0x142d66[_0xf19a('0x17')](0x194);}return _0x350773;};}function handleError(_0x26070d,_0x1c091f){_0x1c091f=_0x1c091f||0x1f4;return function(_0xfdfdf7){logger[_0xf19a('0x27')](_0xfdfdf7[_0xf19a('0x28')]);if(_0xfdfdf7[_0xf19a('0x29')]){delete _0xfdfdf7[_0xf19a('0x29')];}_0x26070d[_0xf19a('0x18')](_0x1c091f)[_0xf19a('0x2a')](_0xfdfdf7);};}exports[_0xf19a('0x2b')]=function(_0x1f3958,_0x5215ed){var _0x52d524={},_0x43ba2f={},_0x40bcc2={'count':0x0,'rows':[]};var _0x3f741c=_[_0xf19a('0x2c')](db[_0xf19a('0x2d')][_0xf19a('0x2e')],function(_0x10979b){return{'name':_0x10979b[_0xf19a('0x2f')],'type':_0x10979b['type'][_0xf19a('0x30')]};});_0x43ba2f[_0xf19a('0x31')]=_[_0xf19a('0x2c')](_0x3f741c,_0xf19a('0x29'));_0x43ba2f[_0xf19a('0x32')]=_[_0xf19a('0x33')](_0x1f3958['query']);_0x43ba2f['filters']=_['intersection'](_0x43ba2f[_0xf19a('0x31')],_0x43ba2f[_0xf19a('0x32')]);_0x52d524[_0xf19a('0x34')]=_[_0xf19a('0x35')](_0x43ba2f[_0xf19a('0x31')],qs['fields'](_0x1f3958[_0xf19a('0x32')][_0xf19a('0x36')]));_0x52d524[_0xf19a('0x34')]=_0x52d524[_0xf19a('0x34')][_0xf19a('0x37')]?_0x52d524[_0xf19a('0x34')]:_0x43ba2f[_0xf19a('0x31')];if(!_0x1f3958['query']['hasOwnProperty'](_0xf19a('0x38'))){_0x52d524['limit']=qs[_0xf19a('0x1c')](_0x1f3958[_0xf19a('0x32')][_0xf19a('0x1c')]);_0x52d524['offset']=qs[_0xf19a('0x1d')](_0x1f3958['query'][_0xf19a('0x1d')]);}_0x52d524['order']=qs['sort'](_0x1f3958[_0xf19a('0x32')]['sort']);_0x52d524[_0xf19a('0x39')]=qs[_0xf19a('0x3a')](_['pick'](_0x1f3958[_0xf19a('0x32')],_0x43ba2f[_0xf19a('0x3a')]),_0x3f741c);if(_0x1f3958[_0xf19a('0x32')][_0xf19a('0x3b')]){_0x52d524['where']=_[_0xf19a('0x3c')](_0x52d524['where'],{'$or':_[_0xf19a('0x2c')](_0x3f741c,function(_0x5e7155){if(_0x5e7155[_0xf19a('0x3d')]!==_0xf19a('0x3e')){var _0xce96c4={};_0xce96c4[_0x5e7155['name']]={'$like':'%'+_0x1f3958[_0xf19a('0x32')]['filter']+'%'};return _0xce96c4;}})});}_0x52d524=_['merge']({},_0x52d524,_0x1f3958[_0xf19a('0x3f')]);var _0x4293b3={'where':_0x52d524[_0xf19a('0x39')]};return db[_0xf19a('0x2d')][_0xf19a('0x1e')](_0x4293b3)[_0xf19a('0x26')](function(_0x184e9e){_0x40bcc2[_0xf19a('0x1e')]=_0x184e9e;if(_0x1f3958[_0xf19a('0x32')][_0xf19a('0x40')]){_0x52d524['include']=[{'all':!![]}];}return db[_0xf19a('0x2d')][_0xf19a('0x41')](_0x52d524);})['then'](function(_0x337230){_0x40bcc2[_0xf19a('0x42')]=_0x337230;return _0x40bcc2;})[_0xf19a('0x26')](respondWithFilteredResult(_0x5215ed,_0x52d524))[_0xf19a('0x43')](handleError(_0x5215ed,null));};exports[_0xf19a('0x44')]=function(_0x2b979c,_0x2270c8){var _0x2e58bc={'raw':!![],'where':{'id':_0x2b979c[_0xf19a('0x45')]['id']}},_0x136ce7={};_0x136ce7[_0xf19a('0x31')]=_[_0xf19a('0x33')](db[_0xf19a('0x2d')]['rawAttributes']);_0x136ce7[_0xf19a('0x32')]=_[_0xf19a('0x33')](_0x2b979c[_0xf19a('0x32')]);_0x136ce7[_0xf19a('0x3a')]=_[_0xf19a('0x35')](_0x136ce7[_0xf19a('0x31')],_0x136ce7[_0xf19a('0x32')]);_0x2e58bc[_0xf19a('0x34')]=_[_0xf19a('0x35')](_0x136ce7[_0xf19a('0x31')],qs[_0xf19a('0x36')](_0x2b979c[_0xf19a('0x32')][_0xf19a('0x36')]));_0x2e58bc['attributes']=_0x2e58bc[_0xf19a('0x34')]['length']?_0x2e58bc[_0xf19a('0x34')]:_0x136ce7['model'];if(_0x2b979c[_0xf19a('0x32')][_0xf19a('0x40')]){_0x2e58bc[_0xf19a('0x46')]=[{'all':!![]}];}_0x2e58bc=_[_0xf19a('0x3c')]({},_0x2e58bc,_0x2b979c[_0xf19a('0x3f')]);return db[_0xf19a('0x2d')][_0xf19a('0x47')](_0x2e58bc)['then'](handleEntityNotFound(_0x2270c8,null))[_0xf19a('0x26')](respondWithResult(_0x2270c8,null))[_0xf19a('0x43')](handleError(_0x2270c8,null));};exports[_0xf19a('0x48')]=function(_0x40f2b7,_0x22adbf){return db[_0xf19a('0x2d')][_0xf19a('0x48')](_0x40f2b7[_0xf19a('0x49')],{})[_0xf19a('0x26')](function(_0x14c454){var _0x32cfac=_0x40f2b7[_0xf19a('0x4a')][_0xf19a('0x4b')]({'plain':!![]});if(!_0x32cfac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32cfac['role']===_0xf19a('0x4a')){var _0x297733=_0x14c454['get']({'plain':!![]});var _0x562f80=_0xf19a('0x24');return db[_0xf19a('0x4c')][_0xf19a('0x47')]({'where':{'name':_0x562f80,'userProfileId':_0x32cfac[_0xf19a('0x4d')]},'raw':!![]})[_0xf19a('0x26')](function(_0x3eea31){if(_0x3eea31&&_0x3eea31[_0xf19a('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x297733['name'],'resourceId':_0x297733['id'],'type':_0x3eea31[_0xf19a('0x29')],'sectionId':_0x3eea31['id']},{})['then'](function(){return _0x14c454;});}else{return _0x14c454;}})['catch'](function(_0x5afcd6){logger[_0xf19a('0x27')](_0xf19a('0x4f'),_0x5afcd6);throw _0x5afcd6;});}return _0x14c454;})['then'](respondWithResult(_0x22adbf,0xc9))[_0xf19a('0x43')](handleError(_0x22adbf,null));};exports[_0xf19a('0x22')]=function(_0x1e2e44,_0x322e01){if(_0x1e2e44[_0xf19a('0x49')]['id']){delete _0x1e2e44[_0xf19a('0x49')]['id'];}return db[_0xf19a('0x2d')][_0xf19a('0x47')]({'where':{'id':_0x1e2e44[_0xf19a('0x45')]['id']}})['then'](handleEntityNotFound(_0x322e01,null))[_0xf19a('0x26')](saveUpdates(_0x1e2e44[_0xf19a('0x49')],null))[_0xf19a('0x26')](respondWithResult(_0x322e01,null))[_0xf19a('0x43')](handleError(_0x322e01,null));};exports[_0xf19a('0x23')]=function(_0x12cc08,_0x53254c){return db[_0xf19a('0x2d')]['find']({'where':{'id':_0x12cc08[_0xf19a('0x45')]['id']}})['then'](handleEntityNotFound(_0x53254c,null))[_0xf19a('0x26')](removeEntity(_0x53254c,null))[_0xf19a('0x43')](handleError(_0x53254c,null));}; \ No newline at end of file +var _0x444f=['includeAll','include','rows','catch','show','keys','Disposition','intersection','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','save','update','destroy','then','Dispositions','UserProfileResource','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options'];(function(_0x26224c,_0x1a354c){var _0x4c2bc5=function(_0x179343){while(--_0x179343){_0x26224c['push'](_0x26224c['shift']());}};_0x4c2bc5(++_0x1a354c);}(_0x444f,0xb5));var _0xf444=function(_0x27c0f8,_0xd1bd2f){_0x27c0f8=_0x27c0f8-0x0;var _0x426b4e=_0x444f[_0x27c0f8];return _0x426b4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf444('0x0'));var zipdir=require(_0xf444('0x1'));var jsonpatch=require(_0xf444('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf444('0x3'));var Mustache=require(_0xf444('0x4'));var util=require(_0xf444('0x5'));var path=require(_0xf444('0x6'));var sox=require(_0xf444('0x7'));var csv=require(_0xf444('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf444('0x9'));var _=require(_0xf444('0xa'));var squel=require(_0xf444('0xb'));var crypto=require(_0xf444('0xc'));var jsforce=require(_0xf444('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf444('0x8'));var querystring=require(_0xf444('0xe'));var Papa=require(_0xf444('0xf'));var Redis=require(_0xf444('0x10'));var authService=require(_0xf444('0x11'));var qs=require(_0xf444('0x12'));var as=require(_0xf444('0x13'));var hardwareService=require(_0xf444('0x14'));var logger=require(_0xf444('0x15'))(_0xf444('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf444('0x17'));var db=require(_0xf444('0x18'))['db'];function respondWithStatusCode(_0x27fcee,_0x3f9362){_0x3f9362=_0x3f9362||0xcc;return function(_0x30ef4c){if(_0x30ef4c){return _0x27fcee[_0xf444('0x19')](_0x3f9362);}return _0x27fcee[_0xf444('0x1a')](_0x3f9362)['end']();};}function respondWithResult(_0x4b080a,_0x4117d5){_0x4117d5=_0x4117d5||0xc8;return function(_0x2e766c){if(_0x2e766c){return _0x4b080a[_0xf444('0x1a')](_0x4117d5)[_0xf444('0x1b')](_0x2e766c);}};}function respondWithFilteredResult(_0x43fcd4,_0x3d30c2){return function(_0x73aa89){if(_0x73aa89){var _0x45813d=typeof _0x3d30c2[_0xf444('0x1c')]===_0xf444('0x1d')&&typeof _0x3d30c2[_0xf444('0x1e')]===_0xf444('0x1d');var _0x30f02a=_0x73aa89[_0xf444('0x1f')];var _0x223a8f=_0x45813d?0x0:_0x3d30c2[_0xf444('0x1c')];var _0x3adebf=_0x45813d?_0x73aa89[_0xf444('0x1f')]:_0x3d30c2['offset']+_0x3d30c2['limit'];var _0x55a193;if(_0x3adebf>=_0x30f02a){_0x3adebf=_0x30f02a;_0x55a193=0xc8;}else{_0x55a193=0xce;}_0x43fcd4[_0xf444('0x1a')](_0x55a193);return _0x43fcd4[_0xf444('0x20')]('Content-Range',_0x223a8f+'-'+_0x3adebf+'/'+_0x30f02a)[_0xf444('0x1b')](_0x73aa89);}return null;};}function patchUpdates(_0x42b6fe){return function(_0x3bdbeb){try{jsonpatch['apply'](_0x3bdbeb,_0x42b6fe,!![]);}catch(_0xfce4a0){return BPromise['reject'](_0xfce4a0);}return _0x3bdbeb[_0xf444('0x21')]();};}function saveUpdates(_0x4fcf10,_0x485ea4){return function(_0x47298f){if(_0x47298f){return _0x47298f[_0xf444('0x22')](_0x4fcf10)['then'](function(_0x30549f){return _0x30549f;});}return null;};}function removeEntity(_0x5f1dc6,_0x2b6156){return function(_0x1f7625){if(_0x1f7625){return _0x1f7625[_0xf444('0x23')]()[_0xf444('0x24')](function(){var _0x5b6fa9=_0x1f7625['get']({'plain':!![]});var _0x2821fc=_0xf444('0x25');return db[_0xf444('0x26')][_0xf444('0x23')]({'where':{'type':_0x2821fc,'resourceId':_0x5b6fa9['id']}})['then'](function(){return _0x1f7625;});})[_0xf444('0x24')](function(){_0x5f1dc6[_0xf444('0x1a')](0xcc)[_0xf444('0x27')]();});}};}function handleEntityNotFound(_0x1093ca,_0x4e260c){return function(_0x1f95ca){if(!_0x1f95ca){_0x1093ca[_0xf444('0x19')](0x194);}return _0x1f95ca;};}function handleError(_0x61b174,_0x103a20){_0x103a20=_0x103a20||0x1f4;return function(_0x510f54){logger[_0xf444('0x28')](_0x510f54[_0xf444('0x29')]);if(_0x510f54[_0xf444('0x2a')]){delete _0x510f54[_0xf444('0x2a')];}_0x61b174[_0xf444('0x1a')](_0x103a20)['send'](_0x510f54);};}exports[_0xf444('0x2b')]=function(_0x47720c,_0x3dd8a3){var _0x42245a={},_0x4b22a9={},_0x23bbb1={'count':0x0,'rows':[]};var _0x37d1ca=_[_0xf444('0x2c')](db['Disposition'][_0xf444('0x2d')],function(_0x22ac8e){return{'name':_0x22ac8e[_0xf444('0x2e')],'type':_0x22ac8e[_0xf444('0x2f')][_0xf444('0x30')]};});_0x4b22a9[_0xf444('0x31')]=_[_0xf444('0x2c')](_0x37d1ca,'name');_0x4b22a9[_0xf444('0x32')]=_['keys'](_0x47720c[_0xf444('0x32')]);_0x4b22a9['filters']=_['intersection'](_0x4b22a9[_0xf444('0x31')],_0x4b22a9[_0xf444('0x32')]);_0x42245a[_0xf444('0x33')]=_['intersection'](_0x4b22a9[_0xf444('0x31')],qs[_0xf444('0x34')](_0x47720c[_0xf444('0x32')][_0xf444('0x34')]));_0x42245a['attributes']=_0x42245a[_0xf444('0x33')][_0xf444('0x35')]?_0x42245a[_0xf444('0x33')]:_0x4b22a9[_0xf444('0x31')];if(!_0x47720c[_0xf444('0x32')][_0xf444('0x36')](_0xf444('0x37'))){_0x42245a['limit']=qs['limit'](_0x47720c['query'][_0xf444('0x1e')]);_0x42245a[_0xf444('0x1c')]=qs[_0xf444('0x1c')](_0x47720c[_0xf444('0x32')]['offset']);}_0x42245a[_0xf444('0x38')]=qs[_0xf444('0x39')](_0x47720c[_0xf444('0x32')][_0xf444('0x39')]);_0x42245a[_0xf444('0x3a')]=qs[_0xf444('0x3b')](_[_0xf444('0x3c')](_0x47720c[_0xf444('0x32')],_0x4b22a9['filters']),_0x37d1ca);if(_0x47720c[_0xf444('0x32')][_0xf444('0x3d')]){_0x42245a[_0xf444('0x3a')]=_['merge'](_0x42245a['where'],{'$or':_[_0xf444('0x2c')](_0x37d1ca,function(_0x5562a6){if(_0x5562a6[_0xf444('0x2f')]!==_0xf444('0x3e')){var _0x95842e={};_0x95842e[_0x5562a6[_0xf444('0x2a')]]={'$like':'%'+_0x47720c[_0xf444('0x32')][_0xf444('0x3d')]+'%'};return _0x95842e;}})});}_0x42245a=_[_0xf444('0x3f')]({},_0x42245a,_0x47720c[_0xf444('0x40')]);var _0x279ed7={'where':_0x42245a['where']};return db['Disposition'][_0xf444('0x1f')](_0x279ed7)[_0xf444('0x24')](function(_0xeae951){_0x23bbb1[_0xf444('0x1f')]=_0xeae951;if(_0x47720c[_0xf444('0x32')][_0xf444('0x41')]){_0x42245a[_0xf444('0x42')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x42245a);})[_0xf444('0x24')](function(_0x12fa70){_0x23bbb1[_0xf444('0x43')]=_0x12fa70;return _0x23bbb1;})[_0xf444('0x24')](respondWithFilteredResult(_0x3dd8a3,_0x42245a))[_0xf444('0x44')](handleError(_0x3dd8a3,null));};exports[_0xf444('0x45')]=function(_0x544580,_0x1f4ca8){var _0x2b68a5={'raw':!![],'where':{'id':_0x544580['params']['id']}},_0x1734b4={};_0x1734b4[_0xf444('0x31')]=_[_0xf444('0x46')](db[_0xf444('0x47')]['rawAttributes']);_0x1734b4[_0xf444('0x32')]=_['keys'](_0x544580[_0xf444('0x32')]);_0x1734b4['filters']=_[_0xf444('0x48')](_0x1734b4[_0xf444('0x31')],_0x1734b4['query']);_0x2b68a5[_0xf444('0x33')]=_[_0xf444('0x48')](_0x1734b4[_0xf444('0x31')],qs[_0xf444('0x34')](_0x544580[_0xf444('0x32')][_0xf444('0x34')]));_0x2b68a5[_0xf444('0x33')]=_0x2b68a5['attributes']['length']?_0x2b68a5['attributes']:_0x1734b4[_0xf444('0x31')];if(_0x544580[_0xf444('0x32')][_0xf444('0x41')]){_0x2b68a5[_0xf444('0x42')]=[{'all':!![]}];}_0x2b68a5=_[_0xf444('0x3f')]({},_0x2b68a5,_0x544580[_0xf444('0x40')]);return db[_0xf444('0x47')]['find'](_0x2b68a5)[_0xf444('0x24')](handleEntityNotFound(_0x1f4ca8,null))[_0xf444('0x24')](respondWithResult(_0x1f4ca8,null))[_0xf444('0x44')](handleError(_0x1f4ca8,null));};exports[_0xf444('0x49')]=function(_0x433e1a,_0x4cafc9){return db[_0xf444('0x47')]['create'](_0x433e1a[_0xf444('0x4a')],{})[_0xf444('0x24')](function(_0x47c79e){var _0x2f274b=_0x433e1a[_0xf444('0x4b')][_0xf444('0x4c')]({'plain':!![]});if(!_0x2f274b)throw new Error(_0xf444('0x4d'));if(_0x2f274b[_0xf444('0x4e')]===_0xf444('0x4b')){var _0x641be7=_0x47c79e[_0xf444('0x4c')]({'plain':!![]});var _0x1c1bb6='Dispositions';return db[_0xf444('0x4f')][_0xf444('0x50')]({'where':{'name':_0x1c1bb6,'userProfileId':_0x2f274b['userProfileId']},'raw':!![]})['then'](function(_0x1c6078){if(_0x1c6078&&_0x1c6078[_0xf444('0x51')]===0x0){return db[_0xf444('0x26')][_0xf444('0x49')]({'name':_0x641be7[_0xf444('0x2a')],'resourceId':_0x641be7['id'],'type':_0x1c6078[_0xf444('0x2a')],'sectionId':_0x1c6078['id']},{})[_0xf444('0x24')](function(){return _0x47c79e;});}else{return _0x47c79e;}})[_0xf444('0x44')](function(_0x162620){logger[_0xf444('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x162620);throw _0x162620;});}return _0x47c79e;})[_0xf444('0x24')](respondWithResult(_0x4cafc9,0xc9))[_0xf444('0x44')](handleError(_0x4cafc9,null));};exports['update']=function(_0x33bafc,_0x393e31){if(_0x33bafc['body']['id']){delete _0x33bafc[_0xf444('0x4a')]['id'];}return db[_0xf444('0x47')][_0xf444('0x50')]({'where':{'id':_0x33bafc['params']['id']}})[_0xf444('0x24')](handleEntityNotFound(_0x393e31,null))[_0xf444('0x24')](saveUpdates(_0x33bafc['body'],null))[_0xf444('0x24')](respondWithResult(_0x393e31,null))['catch'](handleError(_0x393e31,null));};exports[_0xf444('0x23')]=function(_0x1aaa3e,_0x749311){return db[_0xf444('0x47')]['find']({'where':{'id':_0x1aaa3e['params']['id']}})['then'](handleEntityNotFound(_0x749311,null))['then'](removeEntity(_0x749311,null))[_0xf444('0x44')](handleError(_0x749311,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 98a8938..901d0a9 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 _0x0994=['SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./disposition.attributes','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0994,0x1af));var _0x4099=function(_0x4390dc,_0x35fbae){_0x4390dc=_0x4390dc-0x0;var _0x115339=_0x0994[_0x4390dc];return _0x115339;};'use strict';var _=require(_0x4099('0x0'));var util=require(_0x4099('0x1'));var logger=require(_0x4099('0x2'))('api');var moment=require(_0x4099('0x3'));var BPromise=require(_0x4099('0x4'));var rp=require(_0x4099('0x5'));var fs=require('fs');var path=require(_0x4099('0x6'));var rimraf=require(_0x4099('0x7'));var config=require('../../config/environment');var attributes=require(_0x4099('0x8'));module['exports']=function(_0x3139e3,_0x5ef1e8){return _0x3139e3['define'](_0x4099('0x9'),attributes,{'tableName':_0x4099('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x4099('0xb'),'fields':[_0x4099('0xc'),_0x4099('0xd')]},{'unique':!![],'name':_0x4099('0xe'),'fields':['name',_0x4099('0xf')]},{'unique':!![],'name':_0x4099('0x10'),'fields':[_0x4099('0xc'),_0x4099('0x11')]},{'unique':!![],'name':_0x4099('0x12'),'fields':[_0x4099('0xc'),_0x4099('0x13')]},{'unique':!![],'name':_0x4099('0x14'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0x4099('0x15'),'fields':[_0x4099('0xc'),_0x4099('0x16')]},{'unique':!![],'name':_0x4099('0x17'),'fields':[_0x4099('0xc'),_0x4099('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4414=['name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','ListId','name_chat','name','name_mail','MailAccountId','name_sms'];(function(_0x714bc3,_0x136b86){var _0x20fe7a=function(_0x53295c){while(--_0x53295c){_0x714bc3['push'](_0x714bc3['shift']());}};_0x20fe7a(++_0x136b86);}(_0x4414,0x1b5));var _0x4441=function(_0x32776a,_0x592b3b){_0x32776a=_0x32776a-0x0;var _0x4e4c3f=_0x4414[_0x32776a];return _0x4e4c3f;};'use strict';var _=require(_0x4441('0x0'));var util=require(_0x4441('0x1'));var logger=require(_0x4441('0x2'))(_0x4441('0x3'));var moment=require(_0x4441('0x4'));var BPromise=require(_0x4441('0x5'));var rp=require(_0x4441('0x6'));var fs=require('fs');var path=require(_0x4441('0x7'));var rimraf=require(_0x4441('0x8'));var config=require(_0x4441('0x9'));var attributes=require(_0x4441('0xa'));module[_0x4441('0xb')]=function(_0x139f70,_0x5a348a){return _0x139f70[_0x4441('0xc')](_0x4441('0xd'),attributes,{'tableName':_0x4441('0xe'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x4441('0xf'),'fields':['name',_0x4441('0x10')]},{'unique':!![],'name':_0x4441('0x11'),'fields':[_0x4441('0x12'),'ChatWebsiteId']},{'unique':!![],'name':_0x4441('0x13'),'fields':[_0x4441('0x12'),_0x4441('0x14')]},{'unique':!![],'name':_0x4441('0x15'),'fields':[_0x4441('0x12'),'SmsAccountId']},{'unique':!![],'name':_0x4441('0x16'),'fields':[_0x4441('0x12'),_0x4441('0x17')]},{'unique':!![],'name':_0x4441('0x18'),'fields':['name',_0x4441('0x19')]},{'unique':!![],'name':_0x4441('0x1a'),'fields':[_0x4441('0x12'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index e5dab02..d706784 100644 --- a/server/api/disposition/disposition.rpc.js +++ b/server/api/disposition/disposition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5dcd1c,_0x8a3074){var _0x379f1e=function(_0x1fc8e2){while(--_0x1fc8e2){_0x5dcd1c['push'](_0x5dcd1c['shift']());}};_0x379f1e(++_0x8a3074);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5ae8dc,_0x194af7){var _0x350583=function(_0x4603a8){while(--_0x4603a8){_0x5ae8dc['push'](_0x5ae8dc['shift']());}};_0x350583(++_0x194af7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 6c7950c..de3311b 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 _0x0741=['post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','index','/:id','show'];(function(_0x37474c,_0x526f99){var _0x100f11=function(_0x2848a0){while(--_0x2848a0){_0x37474c['push'](_0x37474c['shift']());}};_0x100f11(++_0x526f99);}(_0x0741,0x1bc));var _0x1074=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x0741[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x1074('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1074('0x1'));var express=require(_0x1074('0x2'));var router=express[_0x1074('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1074('0x4'));var interaction=require(_0x1074('0x5'));var config=require('../../config/environment');var controller=require(_0x1074('0x6'));router[_0x1074('0x7')]('/',auth[_0x1074('0x8')](),controller[_0x1074('0x9')]);router['get'](_0x1074('0xa'),auth[_0x1074('0x8')](),controller[_0x1074('0xb')]);router[_0x1074('0xc')]('/',auth['isAuthenticated'](),controller[_0x1074('0xd')]);router[_0x1074('0xe')](_0x1074('0xa'),auth[_0x1074('0x8')](),controller[_0x1074('0xf')]);router[_0x1074('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1074('0x11')]);module[_0x1074('0x12')]=router; \ No newline at end of file +var _0x62c6=['put','/:id','destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','isAuthenticated','get','post','create'];(function(_0x494102,_0x40755e){var _0x47e458=function(_0x149c0e){while(--_0x149c0e){_0x494102['push'](_0x494102['shift']());}};_0x47e458(++_0x40755e);}(_0x62c6,0x100));var _0x662c=function(_0x5e4a7d,_0x263779){_0x5e4a7d=_0x5e4a7d-0x0;var _0x4e766d=_0x62c6[_0x5e4a7d];return _0x4e766d;};'use strict';var multer=require('multer');var util=require(_0x662c('0x0'));var path=require('path');var timeout=require(_0x662c('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x662c('0x2'));var auth=require(_0x662c('0x3'));var interaction=require(_0x662c('0x4'));var config=require('../../config/environment');var controller=require(_0x662c('0x5'));router['get']('/',auth[_0x662c('0x6')](),controller['index']);router[_0x662c('0x7')]('/:id',auth[_0x662c('0x6')](),controller['show']);router[_0x662c('0x8')]('/',auth[_0x662c('0x6')](),controller[_0x662c('0x9')]);router[_0x662c('0xa')](_0x662c('0xb'),auth[_0x662c('0x6')](),controller['update']);router['delete']('/:id',auth[_0x662c('0x6')](),controller[_0x662c('0xc')]);module[_0x662c('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index e801530..62df33b 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 _0x36ac=['yes','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36ac,0x1d0));var _0xc36a=function(_0x2beea5,_0x36e054){_0x2beea5=_0x2beea5-0x0;var _0x25eef8=_0x36ac[_0x2beea5];return _0x25eef8;};'use strict';var Sequelize=require(_0xc36a('0x0'));module[_0xc36a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc36a('0x2')]},'ecm':{'type':Sequelize[_0xc36a('0x3')](_0xc36a('0x4'),'no'),'defaultValue':_0xc36a('0x4')},'headerinfo':{'type':Sequelize[_0xc36a('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xc36a('0x2')],'unique':_0xc36a('0x5')},'minrate':{'type':Sequelize[_0xc36a('0x3')](_0xc36a('0x6'),_0xc36a('0x7'),_0xc36a('0x8'),_0xc36a('0x9'),_0xc36a('0xa'),'14400'),'defaultValue':_0xc36a('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0xc36a('0x6'),_0xc36a('0x7'),_0xc36a('0x8'),_0xc36a('0x9'),_0xc36a('0xa'),_0xc36a('0xb')),'defaultValue':_0xc36a('0xb')},'modem':{'type':Sequelize[_0xc36a('0x2')],'defaultValue':_0xc36a('0xc')},'gateway':{'type':Sequelize[_0xc36a('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xc36a('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xc36a('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xc36a('0x3')]('SIP',_0xc36a('0xe'),_0xc36a('0xf'),_0xc36a('0x10')),'defaultValue':_0xc36a('0x11')},'key':{'type':Sequelize[_0xc36a('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc36a('0x12')],'defaultValue':function(){return _0xc36a('0x13');}},'notificationSound':{'type':Sequelize[_0xc36a('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc36a('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc36a('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc36a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc36a('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc36a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc36a('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xc36a('0x15')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc36a('0x16'),'set':function(_0x22f3e8){if(!_0x22f3e8)this[_0xc36a('0x17')](_0xc36a('0x18'),null);this[_0xc36a('0x17')](_0xc36a('0x19'),_0x22f3e8);}}}; \ No newline at end of file +var _0x4d52=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200','9600','12000','4800','14400','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x4d52,0x153));var _0x24d5=function(_0x3de690,_0x511cd1){_0x3de690=_0x3de690-0x0;var _0x3c9c44=_0x4d52[_0x3de690];return _0x3c9c44;};'use strict';var Sequelize=require(_0x24d5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x24d5('0x1')]},'ecm':{'type':Sequelize[_0x24d5('0x2')](_0x24d5('0x3'),'no'),'defaultValue':_0x24d5('0x3')},'headerinfo':{'type':Sequelize[_0x24d5('0x1')],'defaultValue':_0x24d5('0x4')},'localstationid':{'type':Sequelize[_0x24d5('0x1')],'unique':_0x24d5('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x24d5('0x6'),'4800',_0x24d5('0x7'),_0x24d5('0x8'),_0x24d5('0x9'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x24d5('0x2')](_0x24d5('0x6'),_0x24d5('0xa'),'7200',_0x24d5('0x8'),'12000','14400'),'defaultValue':_0x24d5('0xb')},'modem':{'type':Sequelize[_0x24d5('0x1')],'defaultValue':_0x24d5('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x24d5('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x24d5('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x24d5('0xe'),'IAX',_0x24d5('0xf'),_0x24d5('0x10')),'defaultValue':_0x24d5('0xe')},'key':{'type':Sequelize[_0x24d5('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x24d5('0x11')],'defaultValue':function(){return _0x24d5('0x12');}},'notificationSound':{'type':Sequelize[_0x24d5('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x24d5('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x24d5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x24d5('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x24d5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x24d5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x24d5('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x24d5('0x14'),'set':function(_0x215158){if(!_0x215158)this[_0x24d5('0x15')](_0x24d5('0x16'),null);this[_0x24d5('0x15')](_0x24d5('0x17'),_0x215158);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 4f1aabd..e16dad3 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 _0xf55d=['Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','FaxAccounts','end','stack','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','name','filter','options','includeAll','findAll','rows','show','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','FaxAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','description','Fax\x20Extension','appdata','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','push','FAXOPT(','Wait','addAccountApplications','VoiceExtension','updateAccountApplications','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages'];(function(_0x354611,_0x5184ec){var _0xbfb8d8=function(_0xdb508){while(--_0xdb508){_0x354611['push'](_0x354611['shift']());}};_0xbfb8d8(++_0x5184ec);}(_0xf55d,0x19d));var _0xdf55=function(_0x5ed72f,_0x449ae6){_0x5ed72f=_0x5ed72f-0x0;var _0x8ab105=_0xf55d[_0x5ed72f];return _0x8ab105;};'use strict';var emlformat=require(_0xdf55('0x0'));var rimraf=require(_0xdf55('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf55('0x2'));var rp=require(_0xdf55('0x3'));var moment=require(_0xdf55('0x4'));var BPromise=require(_0xdf55('0x5'));var Mustache=require(_0xdf55('0x6'));var util=require('util');var path=require(_0xdf55('0x7'));var sox=require(_0xdf55('0x8'));var csv=require(_0xdf55('0x9'));var ejs=require(_0xdf55('0xa'));var fs=require('fs');var fs_extra=require(_0xdf55('0xb'));var _=require(_0xdf55('0xc'));var squel=require(_0xdf55('0xd'));var crypto=require(_0xdf55('0xe'));var jsforce=require(_0xdf55('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdf55('0x9'));var querystring=require(_0xdf55('0x10'));var Papa=require(_0xdf55('0x11'));var Redis=require(_0xdf55('0x12'));var authService=require(_0xdf55('0x13'));var qs=require(_0xdf55('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf55('0x15'));var logger=require(_0xdf55('0x16'))(_0xdf55('0x17'));var utils=require(_0xdf55('0x18'));var config=require(_0xdf55('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf55('0x1a'))['db'];config[_0xdf55('0x1b')]=_['defaults'](config[_0xdf55('0x1b')],{'host':_0xdf55('0x1c'),'port':0x18eb});var socket=require(_0xdf55('0x1d'))(new Redis(config['redis']));require(_0xdf55('0x1e'))[_0xdf55('0x1f')](socket);var jayson=require(_0xdf55('0x20'));var client=jayson[_0xdf55('0x21')][_0xdf55('0x22')]({'port':0x232c});var client9002=jayson[_0xdf55('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd5e817,_0x1d623e,_0x190f52,_0x5340f9){return new BPromise(function(_0x23f376,_0x5d257d){var _0x2c0225=_0x5340f9||client;return _0x2c0225['request'](_0xd5e817,_0x190f52)['then'](function(_0x568f00){logger[_0xdf55('0x23')](_0xdf55('0x24'),_0x1d623e,_0xdf55('0x25'));logger[_0xdf55('0x26')](_0xdf55('0x27'),_0x1d623e,'request\x20sent',JSON[_0xdf55('0x28')](_0x568f00));if(_0x568f00[_0xdf55('0x29')]){if(_0x568f00[_0xdf55('0x29')][_0xdf55('0x2a')]===0x1f4){logger['error'](_0xdf55('0x24'),_0x1d623e,_0x568f00[_0xdf55('0x29')][_0xdf55('0x2b')]);return _0x5d257d(_0x568f00[_0xdf55('0x29')]['message']);}logger['error'](_0xdf55('0x24'),_0x1d623e,_0x568f00[_0xdf55('0x29')][_0xdf55('0x2b')]);return _0x23f376(_0x568f00[_0xdf55('0x29')][_0xdf55('0x2b')]);}else{logger['info'](_0xdf55('0x24'),_0x1d623e,_0xdf55('0x25'));_0x23f376(_0x568f00[_0xdf55('0x2c')][_0xdf55('0x2b')]);}})[_0xdf55('0x2d')](function(_0x4cb5d9){logger[_0xdf55('0x29')]('FaxAccount,\x20%s,\x20%s',_0x1d623e,_0x4cb5d9);_0x5d257d(_0x4cb5d9);});});}function respondWithStatusCode(_0x36d91e,_0x1b8089){_0x1b8089=_0x1b8089||0xcc;return function(_0x530c68){if(_0x530c68){return _0x36d91e[_0xdf55('0x2e')](_0x1b8089);}return _0x36d91e['status'](_0x1b8089)['end']();};}function respondWithResult(_0x233cb2,_0x14cc1c){_0x14cc1c=_0x14cc1c||0xc8;return function(_0x148c54){if(_0x148c54){return _0x233cb2[_0xdf55('0x2f')](_0x14cc1c)[_0xdf55('0x30')](_0x148c54);}};}function respondWithFilteredResult(_0x367548,_0x36ff3f){return function(_0x32987f){if(_0x32987f){var _0x1f7400=typeof _0x36ff3f[_0xdf55('0x31')]==='undefined'&&typeof _0x36ff3f[_0xdf55('0x32')]===_0xdf55('0x33');var _0xdbd775=_0x32987f[_0xdf55('0x34')];var _0x570857=_0x1f7400?0x0:_0x36ff3f[_0xdf55('0x31')];var _0x17b7b1=_0x1f7400?_0x32987f['count']:_0x36ff3f['offset']+_0x36ff3f[_0xdf55('0x32')];var _0x3729ab;if(_0x17b7b1>=_0xdbd775){_0x17b7b1=_0xdbd775;_0x3729ab=0xc8;}else{_0x3729ab=0xce;}_0x367548[_0xdf55('0x2f')](_0x3729ab);return _0x367548[_0xdf55('0x35')](_0xdf55('0x36'),_0x570857+'-'+_0x17b7b1+'/'+_0xdbd775)[_0xdf55('0x30')](_0x32987f);}return null;};}function patchUpdates(_0x4468da){return function(_0x329ec9){try{jsonpatch[_0xdf55('0x37')](_0x329ec9,_0x4468da,!![]);}catch(_0x54de9d){return BPromise[_0xdf55('0x38')](_0x54de9d);}return _0x329ec9['save']();};}function saveUpdates(_0x392411,_0x2b01c5){return function(_0x30a0f2){if(_0x30a0f2){return _0x30a0f2[_0xdf55('0x39')](_0x392411)['then'](function(_0x51fd6d){return _0x51fd6d;});}return null;};}function removeEntity(_0x5e4d80,_0x513af3){return function(_0x5b4f13){if(_0x5b4f13){return _0x5b4f13[_0xdf55('0x3a')]()[_0xdf55('0x3b')](function(){var _0x30c275=_0x5b4f13['get']({'plain':!![]});var _0x1c1e89=_0xdf55('0x3c');return db['UserProfileResource'][_0xdf55('0x3a')]({'where':{'type':_0x1c1e89,'resourceId':_0x30c275['id']}})['then'](function(){return _0x5b4f13;});})[_0xdf55('0x3b')](function(){_0x5e4d80['status'](0xcc)[_0xdf55('0x3d')]();});}};}function handleEntityNotFound(_0x4b7565,_0x3cc0f6){return function(_0x5e937f){if(!_0x5e937f){_0x4b7565[_0xdf55('0x2e')](0x194);}return _0x5e937f;};}function handleError(_0x42e71a,_0x174c87){_0x174c87=_0x174c87||0x1f4;return function(_0x3c0cb0){logger[_0xdf55('0x29')](_0x3c0cb0[_0xdf55('0x3e')]);if(_0x3c0cb0['name']){delete _0x3c0cb0['name'];}_0x42e71a[_0xdf55('0x2f')](_0x174c87)[_0xdf55('0x3f')](_0x3c0cb0);};}exports[_0xdf55('0x40')]=function(_0x276ba6,_0x37324b){var _0x501c6c={'include':[{'model':db[_0xdf55('0x41')],'as':_0xdf55('0x42')}]},_0x525a6e={},_0x1cbc12={'count':0x0,'rows':[]};var _0x300163=_[_0xdf55('0x43')](db[_0xdf55('0x44')][_0xdf55('0x45')],function(_0x5eed84){return{'name':_0x5eed84[_0xdf55('0x46')],'type':_0x5eed84[_0xdf55('0x47')][_0xdf55('0x48')]};});_0x525a6e[_0xdf55('0x49')]=_[_0xdf55('0x43')](_0x300163,'name');_0x525a6e[_0xdf55('0x4a')]=_[_0xdf55('0x4b')](_0x276ba6['query']);_0x525a6e[_0xdf55('0x4c')]=_[_0xdf55('0x4d')](_0x525a6e[_0xdf55('0x49')],_0x525a6e[_0xdf55('0x4a')]);_0x501c6c[_0xdf55('0x4e')]=_[_0xdf55('0x4d')](_0x525a6e[_0xdf55('0x49')],qs[_0xdf55('0x4f')](_0x276ba6[_0xdf55('0x4a')]['fields']));_0x501c6c[_0xdf55('0x4e')]=_0x501c6c[_0xdf55('0x4e')]['length']?_0x501c6c[_0xdf55('0x4e')]:_0x525a6e['model'];if(!_0x276ba6[_0xdf55('0x4a')][_0xdf55('0x50')]('nolimit')){_0x501c6c[_0xdf55('0x32')]=qs[_0xdf55('0x32')](_0x276ba6[_0xdf55('0x4a')][_0xdf55('0x32')]);_0x501c6c[_0xdf55('0x31')]=qs[_0xdf55('0x31')](_0x276ba6[_0xdf55('0x4a')]['offset']);}_0x501c6c[_0xdf55('0x51')]=qs[_0xdf55('0x52')](_0x276ba6[_0xdf55('0x4a')][_0xdf55('0x52')]);_0x501c6c[_0xdf55('0x53')]=qs[_0xdf55('0x4c')](_[_0xdf55('0x54')](_0x276ba6[_0xdf55('0x4a')],_0x525a6e[_0xdf55('0x4c')]),_0x300163);if(_0x276ba6[_0xdf55('0x4a')]['filter']){_0x501c6c[_0xdf55('0x53')]=_[_0xdf55('0x55')](_0x501c6c[_0xdf55('0x53')],{'$or':_[_0xdf55('0x43')](_0x300163,function(_0x231382){if(_0x231382['type']!=='VIRTUAL'){var _0x2e2bfb={};_0x2e2bfb[_0x231382[_0xdf55('0x56')]]={'$like':'%'+_0x276ba6[_0xdf55('0x4a')][_0xdf55('0x57')]+'%'};return _0x2e2bfb;}})});}_0x501c6c=_[_0xdf55('0x55')]({},_0x501c6c,_0x276ba6[_0xdf55('0x58')]);var _0x351fb2={'where':_0x501c6c['where']};return db[_0xdf55('0x44')][_0xdf55('0x34')](_0x351fb2)[_0xdf55('0x3b')](function(_0x1321d1){_0x1cbc12[_0xdf55('0x34')]=_0x1321d1;if(_0x276ba6[_0xdf55('0x4a')][_0xdf55('0x59')]){_0x501c6c['include']=[{'all':!![]}];}return db[_0xdf55('0x44')][_0xdf55('0x5a')](_0x501c6c);})[_0xdf55('0x3b')](function(_0xa5e0aa){_0x1cbc12[_0xdf55('0x5b')]=_0xa5e0aa;return _0x1cbc12;})['then'](respondWithFilteredResult(_0x37324b,_0x501c6c))[_0xdf55('0x2d')](handleError(_0x37324b,null));};exports[_0xdf55('0x5c')]=function(_0x9949f9,_0x127598){var _0x329a18={'raw':![],'where':{'id':_0x9949f9[_0xdf55('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0xdf55('0x42')}]},_0x47f19a={};_0x47f19a['model']=_['keys'](db['FaxAccount'][_0xdf55('0x45')]);_0x47f19a[_0xdf55('0x4a')]=_[_0xdf55('0x4b')](_0x9949f9[_0xdf55('0x4a')]);_0x47f19a['filters']=_[_0xdf55('0x4d')](_0x47f19a['model'],_0x47f19a['query']);_0x329a18[_0xdf55('0x4e')]=_[_0xdf55('0x4d')](_0x47f19a[_0xdf55('0x49')],qs[_0xdf55('0x4f')](_0x9949f9[_0xdf55('0x4a')][_0xdf55('0x4f')]));_0x329a18[_0xdf55('0x4e')]=_0x329a18[_0xdf55('0x4e')][_0xdf55('0x5e')]?_0x329a18['attributes']:_0x47f19a[_0xdf55('0x49')];if(_0x9949f9[_0xdf55('0x4a')][_0xdf55('0x59')]){_0x329a18[_0xdf55('0x5f')]=[{'all':!![]}];}_0x329a18=_[_0xdf55('0x55')]({},_0x329a18,_0x9949f9[_0xdf55('0x58')]);return db[_0xdf55('0x44')][_0xdf55('0x60')](_0x329a18)[_0xdf55('0x3b')](handleEntityNotFound(_0x127598,null))['then'](respondWithResult(_0x127598,null))[_0xdf55('0x2d')](handleError(_0x127598,null));};exports[_0xdf55('0x61')]=function(_0x4818e6,_0x53c310){return db['FaxAccount'][_0xdf55('0x61')](_0x4818e6[_0xdf55('0x62')],{})[_0xdf55('0x3b')](function(_0x4b1141){var _0x553d6a=_0x4818e6[_0xdf55('0x63')]['get']({'plain':!![]});if(!_0x553d6a)throw new Error(_0xdf55('0x64'));if(_0x553d6a['role']==='user'){var _0x34139a=_0x4b1141[_0xdf55('0x65')]({'plain':!![]});var _0x38f4c4='FaxAccounts';return db[_0xdf55('0x66')][_0xdf55('0x60')]({'where':{'name':_0x38f4c4,'userProfileId':_0x553d6a[_0xdf55('0x67')]},'raw':!![]})[_0xdf55('0x3b')](function(_0xda55aa){if(_0xda55aa&&_0xda55aa[_0xdf55('0x68')]===0x0){return db[_0xdf55('0x69')][_0xdf55('0x61')]({'name':_0x34139a['name'],'resourceId':_0x34139a['id'],'type':_0xda55aa[_0xdf55('0x56')],'sectionId':_0xda55aa['id']},{})[_0xdf55('0x3b')](function(){return _0x4b1141;});}else{return _0x4b1141;}})[_0xdf55('0x2d')](function(_0x8b6331){logger[_0xdf55('0x29')](_0xdf55('0x6a'),_0x8b6331);throw _0x8b6331;});}return _0x4b1141;})[_0xdf55('0x3b')](respondWithResult(_0x53c310,0xc9))[_0xdf55('0x2d')](handleError(_0x53c310,null));};exports[_0xdf55('0x39')]=function(_0x143220,_0x2dbd44){if(_0x143220[_0xdf55('0x62')]['id']){delete _0x143220[_0xdf55('0x62')]['id'];}return db[_0xdf55('0x44')][_0xdf55('0x60')]({'where':{'id':_0x143220['params']['id']},'include':[{'model':db[_0xdf55('0x41')],'as':_0xdf55('0x42')}]})['then'](handleEntityNotFound(_0x2dbd44,null))[_0xdf55('0x3b')](saveUpdates(_0x143220[_0xdf55('0x62')],null))[_0xdf55('0x3b')](respondWithResult(_0x2dbd44,null))[_0xdf55('0x2d')](handleError(_0x2dbd44,null));};exports[_0xdf55('0x3a')]=function(_0x959e04,_0xd3647d){return db['FaxAccount'][_0xdf55('0x60')]({'where':{'id':_0x959e04[_0xdf55('0x5d')]['id']}})['then'](handleEntityNotFound(_0xd3647d,null))[_0xdf55('0x3b')](removeEntity(_0xd3647d,null))[_0xdf55('0x2d')](handleError(_0xd3647d,null));};exports[_0xdf55('0x6b')]=function(_0x141892,_0x1ef2c8){return db[_0xdf55('0x44')][_0xdf55('0x6b')]()[_0xdf55('0x3b')](respondWithResult(_0x1ef2c8,null))[_0xdf55('0x2d')](handleError(_0x1ef2c8,null));};exports[_0xdf55('0x6c')]=function(_0x9df4f0,_0x3a46a3,_0x5df740){if(_0x9df4f0[_0xdf55('0x62')]['id']){delete _0x9df4f0[_0xdf55('0x62')]['id'];}return db[_0xdf55('0x44')][_0xdf55('0x60')]({'where':{'id':_0x9df4f0[_0xdf55('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3a46a3,null))[_0xdf55('0x3b')](function(_0x101d01){if(_0x101d01){_0x9df4f0[_0xdf55('0x62')]['FaxAccountId']=_0x101d01['id'];return db['Disposition'][_0xdf55('0x61')](_0x9df4f0[_0xdf55('0x62')]);}})[_0xdf55('0x3b')](respondWithResult(_0x3a46a3,null))[_0xdf55('0x2d')](handleError(_0x3a46a3,null));};exports[_0xdf55('0x6d')]=function(_0x4fb68b,_0x43f6cf,_0x123a29){var _0x55a3cd={'raw':![],'where':{}};var _0x586eed={};var _0x50c07e={'count':0x0,'rows':[]};return db[_0xdf55('0x44')][_0xdf55('0x6e')]({'where':{'id':_0x4fb68b['params']['id']}})[_0xdf55('0x3b')](handleEntityNotFound(_0x43f6cf,null))[_0xdf55('0x3b')](function(_0x2b1ee){if(_0x2b1ee){_0x586eed[_0xdf55('0x49')]=_[_0xdf55('0x4b')](db[_0xdf55('0x6f')][_0xdf55('0x45')]);_0x586eed[_0xdf55('0x4a')]=_[_0xdf55('0x4b')](_0x4fb68b[_0xdf55('0x4a')]);_0x586eed['filters']=_[_0xdf55('0x4d')](_0x586eed[_0xdf55('0x49')],_0x586eed[_0xdf55('0x4a')]);_0x55a3cd[_0xdf55('0x4e')]=_[_0xdf55('0x4d')](_0x586eed[_0xdf55('0x49')],qs[_0xdf55('0x4f')](_0x4fb68b[_0xdf55('0x4a')][_0xdf55('0x4f')]));_0x55a3cd[_0xdf55('0x4e')]=_0x55a3cd[_0xdf55('0x4e')][_0xdf55('0x5e')]?_0x55a3cd[_0xdf55('0x4e')]:_0x586eed['model'];if(!_0x4fb68b[_0xdf55('0x4a')][_0xdf55('0x50')]('nolimit')){_0x55a3cd['limit']=qs[_0xdf55('0x32')](_0x4fb68b[_0xdf55('0x4a')][_0xdf55('0x32')]);_0x55a3cd['offset']=qs[_0xdf55('0x31')](_0x4fb68b[_0xdf55('0x4a')][_0xdf55('0x31')]);}_0x55a3cd['order']=qs[_0xdf55('0x52')](_0x4fb68b['query'][_0xdf55('0x52')]);_0x55a3cd['where']=qs['filters'](_[_0xdf55('0x54')](_0x4fb68b['query'],_0x586eed[_0xdf55('0x4c')]));_0x55a3cd['where'][_0xdf55('0x70')]=_0x2b1ee['id'];if(_0x4fb68b[_0xdf55('0x4a')][_0xdf55('0x57')]){_0x55a3cd[_0xdf55('0x53')]=_['merge'](_0x55a3cd['where'],{'$or':_[_0xdf55('0x43')](_0x55a3cd[_0xdf55('0x4e')],function(_0x1a08a6){var _0x3cd647={};_0x3cd647[_0x1a08a6]={'$like':'%'+_0x4fb68b['query'][_0xdf55('0x57')]+'%'};return _0x3cd647;})});}_0x55a3cd=_[_0xdf55('0x55')]({},_0x55a3cd,_0x4fb68b[_0xdf55('0x58')]);return db['Disposition']['count']({'where':_0x55a3cd[_0xdf55('0x53')]})['then'](function(_0x292b76){_0x50c07e[_0xdf55('0x34')]=_0x292b76;if(_0x4fb68b[_0xdf55('0x4a')][_0xdf55('0x59')]){_0x55a3cd[_0xdf55('0x5f')]=[{'all':!![]}];}return db[_0xdf55('0x6f')][_0xdf55('0x5a')](_0x55a3cd);})[_0xdf55('0x3b')](function(_0x11fa39){_0x50c07e[_0xdf55('0x5b')]=_0x11fa39;return _0x50c07e;});}})[_0xdf55('0x3b')](respondWithFilteredResult(_0x43f6cf,_0x55a3cd))[_0xdf55('0x2d')](handleError(_0x43f6cf,null));};exports[_0xdf55('0x71')]=function(_0x10c2ab,_0x10f353,_0x3f8ed5){return db['FaxAccount'][_0xdf55('0x60')]({'where':{'id':_0x10c2ab[_0xdf55('0x5d')]['id']}})[_0xdf55('0x3b')](handleEntityNotFound(_0x10f353,null))[_0xdf55('0x3b')](function(_0x4b3c98){if(_0x4b3c98){return _0x4b3c98[_0xdf55('0x71')](_0x10c2ab[_0xdf55('0x4a')][_0xdf55('0x72')]);}})[_0xdf55('0x3b')](respondWithStatusCode(_0x10f353,null))[_0xdf55('0x2d')](handleError(_0x10f353,null));};exports[_0xdf55('0x73')]=function(_0x496c2f,_0x3d7b66,_0x2a6e61){if(_0x496c2f[_0xdf55('0x62')]['id']){delete _0x496c2f['body']['id'];}return db[_0xdf55('0x44')][_0xdf55('0x60')]({'where':{'id':_0x496c2f['params']['id']}})[_0xdf55('0x3b')](handleEntityNotFound(_0x3d7b66,null))[_0xdf55('0x3b')](function(_0x8e90bd){if(_0x8e90bd){_0x496c2f[_0xdf55('0x62')][_0xdf55('0x70')]=_0x8e90bd['id'];return db[_0xdf55('0x74')][_0xdf55('0x61')](_0x496c2f[_0xdf55('0x62')]);}})[_0xdf55('0x3b')](respondWithResult(_0x3d7b66,null))[_0xdf55('0x2d')](handleError(_0x3d7b66,null));};exports[_0xdf55('0x75')]=function(_0x466bbe,_0x325498,_0x143977){var _0x2abb1d={'raw':![],'where':{}};var _0x19334f={};var _0x202941={'count':0x0,'rows':[]};return db[_0xdf55('0x44')][_0xdf55('0x6e')]({'where':{'id':_0x466bbe['params']['id']}})[_0xdf55('0x3b')](handleEntityNotFound(_0x325498,null))[_0xdf55('0x3b')](function(_0x1ffcfa){if(_0x1ffcfa){_0x19334f[_0xdf55('0x49')]=_['keys'](db[_0xdf55('0x74')][_0xdf55('0x45')]);_0x19334f['query']=_[_0xdf55('0x4b')](_0x466bbe[_0xdf55('0x4a')]);_0x19334f[_0xdf55('0x4c')]=_[_0xdf55('0x4d')](_0x19334f[_0xdf55('0x49')],_0x19334f[_0xdf55('0x4a')]);_0x2abb1d[_0xdf55('0x4e')]=_[_0xdf55('0x4d')](_0x19334f['model'],qs[_0xdf55('0x4f')](_0x466bbe['query']['fields']));_0x2abb1d[_0xdf55('0x4e')]=_0x2abb1d['attributes'][_0xdf55('0x5e')]?_0x2abb1d['attributes']:_0x19334f[_0xdf55('0x49')];if(!_0x466bbe[_0xdf55('0x4a')]['hasOwnProperty'](_0xdf55('0x76'))){_0x2abb1d['limit']=qs['limit'](_0x466bbe['query']['limit']);_0x2abb1d[_0xdf55('0x31')]=qs[_0xdf55('0x31')](_0x466bbe['query']['offset']);}_0x2abb1d[_0xdf55('0x51')]=qs[_0xdf55('0x52')](_0x466bbe[_0xdf55('0x4a')][_0xdf55('0x52')]);_0x2abb1d[_0xdf55('0x53')]=qs[_0xdf55('0x4c')](_[_0xdf55('0x54')](_0x466bbe[_0xdf55('0x4a')],_0x19334f['filters']));_0x2abb1d['where'][_0xdf55('0x70')]=_0x1ffcfa['id'];if(_0x466bbe[_0xdf55('0x4a')][_0xdf55('0x57')]){_0x2abb1d[_0xdf55('0x53')]=_[_0xdf55('0x55')](_0x2abb1d[_0xdf55('0x53')],{'$or':_[_0xdf55('0x43')](_0x2abb1d[_0xdf55('0x4e')],function(_0x33105b){var _0x5bc1b3={};_0x5bc1b3[_0x33105b]={'$like':'%'+_0x466bbe[_0xdf55('0x4a')]['filter']+'%'};return _0x5bc1b3;})});}_0x2abb1d=_[_0xdf55('0x55')]({},_0x2abb1d,_0x466bbe['options']);return db[_0xdf55('0x74')]['count']({'where':_0x2abb1d[_0xdf55('0x53')]})[_0xdf55('0x3b')](function(_0x44efc3){_0x202941[_0xdf55('0x34')]=_0x44efc3;if(_0x466bbe[_0xdf55('0x4a')][_0xdf55('0x59')]){_0x2abb1d[_0xdf55('0x5f')]=[{'all':!![]}];}return db[_0xdf55('0x74')][_0xdf55('0x5a')](_0x2abb1d);})['then'](function(_0x531bdc){_0x202941['rows']=_0x531bdc;return _0x202941;});}})[_0xdf55('0x3b')](respondWithFilteredResult(_0x325498,_0x2abb1d))['catch'](handleError(_0x325498,null));};exports[_0xdf55('0x77')]=function(_0x5a5a65,_0x511281,_0xba7871){return db[_0xdf55('0x44')][_0xdf55('0x60')]({'where':{'id':_0x5a5a65[_0xdf55('0x5d')]['id']}})[_0xdf55('0x3b')](handleEntityNotFound(_0x511281,null))[_0xdf55('0x3b')](function(_0x23ea4b){if(_0x23ea4b){return _0x23ea4b[_0xdf55('0x77')](_0x5a5a65[_0xdf55('0x4a')][_0xdf55('0x72')]);}})[_0xdf55('0x3b')](respondWithStatusCode(_0x511281,null))[_0xdf55('0x2d')](handleError(_0x511281,null));};exports['addInteraction']=function(_0x2576fe,_0x44d99e,_0x566ee6){return db[_0xdf55('0x78')]['find']({'where':{'id':_0x2576fe['params']['id']}})[_0xdf55('0x3b')](handleEntityNotFound(_0x44d99e,null))[_0xdf55('0x3b')](function(_0x5ebebc){if(_0x5ebebc){return _0x5ebebc[_0xdf55('0x79')](_0x2576fe[_0xdf55('0x62')][_0xdf55('0x72')],_[_0xdf55('0x7a')](_0x2576fe[_0xdf55('0x62')],[_0xdf55('0x72'),'id'])||{});}})[_0xdf55('0x3b')](respondWithResult(_0x44d99e,null))[_0xdf55('0x2d')](handleError(_0x44d99e,null));};exports[_0xdf55('0x7b')]=function(_0x1bb3d4,_0x44e24d,_0x90cd6f){var _0x155fea={'raw':![],'where':{}};var _0x156aa7={};var _0x11f929={'count':0x0,'rows':[]};return db[_0xdf55('0x44')][_0xdf55('0x6e')]({'where':{'id':_0x1bb3d4[_0xdf55('0x5d')]['id']}})[_0xdf55('0x3b')](handleEntityNotFound(_0x44e24d,null))[_0xdf55('0x3b')](function(_0x2a1158){if(_0x2a1158){_0x156aa7[_0xdf55('0x49')]=_['keys'](db[_0xdf55('0x78')][_0xdf55('0x45')]);_0x156aa7[_0xdf55('0x4a')]=_[_0xdf55('0x4b')](_0x1bb3d4[_0xdf55('0x4a')]);_0x156aa7[_0xdf55('0x4c')]=_[_0xdf55('0x4d')](_0x156aa7[_0xdf55('0x49')],_0x156aa7['query']);_0x155fea['attributes']=_[_0xdf55('0x4d')](_0x156aa7['model'],qs[_0xdf55('0x4f')](_0x1bb3d4[_0xdf55('0x4a')][_0xdf55('0x4f')]));_0x155fea[_0xdf55('0x4e')]=_0x155fea['attributes'][_0xdf55('0x5e')]?_0x155fea[_0xdf55('0x4e')]:_0x156aa7['model'];if(!_0x1bb3d4[_0xdf55('0x4a')]['hasOwnProperty']('nolimit')){_0x155fea[_0xdf55('0x32')]=qs['limit'](_0x1bb3d4[_0xdf55('0x4a')][_0xdf55('0x32')]);_0x155fea[_0xdf55('0x31')]=qs[_0xdf55('0x31')](_0x1bb3d4[_0xdf55('0x4a')][_0xdf55('0x31')]);}_0x155fea[_0xdf55('0x51')]=qs[_0xdf55('0x52')](_0x1bb3d4[_0xdf55('0x4a')][_0xdf55('0x52')]);_0x155fea[_0xdf55('0x53')]=qs[_0xdf55('0x4c')](_[_0xdf55('0x54')](_0x1bb3d4[_0xdf55('0x4a')],_0x156aa7[_0xdf55('0x4c')]));_0x155fea[_0xdf55('0x53')][_0xdf55('0x70')]=_0x2a1158['id'];if(_0x1bb3d4[_0xdf55('0x4a')][_0xdf55('0x57')]){_0x155fea[_0xdf55('0x53')]=_[_0xdf55('0x55')](_0x155fea[_0xdf55('0x53')],{'$or':_[_0xdf55('0x43')](_0x155fea[_0xdf55('0x4e')],function(_0x3531ff){var _0x174d76={};_0x174d76[_0x3531ff]={'$like':'%'+_0x1bb3d4[_0xdf55('0x4a')][_0xdf55('0x57')]+'%'};return _0x174d76;})});}_0x155fea=_[_0xdf55('0x55')]({},_0x155fea,_0x1bb3d4[_0xdf55('0x58')]);return db['FaxInteraction'][_0xdf55('0x34')]({'where':_0x155fea[_0xdf55('0x53')]})[_0xdf55('0x3b')](function(_0x1c2475){_0x11f929[_0xdf55('0x34')]=_0x1c2475;if(_0x1bb3d4['query'][_0xdf55('0x59')]){_0x155fea[_0xdf55('0x5f')]=[{'model':db[_0xdf55('0x7c')],'as':'Contact','required':![]},{'model':db[_0xdf55('0x7d')],'as':_0xdf55('0x7e'),'attributes':['name',_0xdf55('0x7f'),_0xdf55('0x80')],'required':![]},{'model':db[_0xdf55('0x81')],'as':'Tags','attributes':['id',_0xdf55('0x56'),_0xdf55('0x82')],'where':_0x1bb3d4['query'][_0xdf55('0x83')]?{'id':_0x1bb3d4['query']['tag']}:undefined,'required':_0x1bb3d4['query'][_0xdf55('0x83')]?!![]:![]}];}return db[_0xdf55('0x78')][_0xdf55('0x5a')](_0x155fea);})[_0xdf55('0x3b')](function(_0x164b08){_0x11f929['rows']=_0x164b08;return _0x11f929;});}})[_0xdf55('0x3b')](respondWithFilteredResult(_0x44e24d,_0x155fea))[_0xdf55('0x2d')](handleError(_0x44e24d,null));};exports[_0xdf55('0x84')]=function(_0x231529,_0x5372a8,_0x528e30){return db[_0xdf55('0x44')][_0xdf55('0x6e')]({'where':{'id':_0x231529[_0xdf55('0x5d')]['id']}})[_0xdf55('0x3b')](handleEntityNotFound(_0x5372a8,null))[_0xdf55('0x3b')](function(_0x16ece0){if(_0x16ece0){return db[_0xdf55('0x85')]['transaction'](function(_0x414757){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x231529[_0xdf55('0x5d')]['id']},'transaction':_0x414757})[_0xdf55('0x3b')](function(_0xe6fd87){var _0xf8bdf1=_[_0xdf55('0x43')](_0x231529[_0xdf55('0x62')],function(_0x5c45c1){_0x5c45c1[_0xdf55('0x70')]=_0x231529['params']['id'];return _0x5c45c1;});return db[_0xdf55('0x86')][_0xdf55('0x87')](_0xf8bdf1,{'transaction':_0x414757});});})[_0xdf55('0x3b')](function(){return db[_0xdf55('0x86')][_0xdf55('0x88')]({'where':{'FaxAccountId':_0x231529[_0xdf55('0x5d')]['id']},'order':_0xdf55('0x89')});});}})['then'](respondWithResult(_0x5372a8,null))[_0xdf55('0x2d')](handleError(_0x5372a8,null));};exports[_0xdf55('0x8a')]=function(_0x262b01,_0x5e1eee,_0x4c4b1b){var _0x12c232={};var _0x3d0136={};var _0x31bcce;var _0x251edf;return db[_0xdf55('0x44')][_0xdf55('0x6e')]({'where':{'id':_0x262b01[_0xdf55('0x5d')]['id']}})[_0xdf55('0x3b')](handleEntityNotFound(_0x5e1eee,null))['then'](function(_0x49fd7e){if(_0x49fd7e){_0x31bcce=_0x49fd7e;_0x3d0136[_0xdf55('0x49')]=_['keys'](db['FaxApplication'][_0xdf55('0x45')]);_0x3d0136[_0xdf55('0x4a')]=_[_0xdf55('0x4b')](_0x262b01[_0xdf55('0x4a')]);_0x3d0136[_0xdf55('0x4c')]=_[_0xdf55('0x4d')](_0x3d0136[_0xdf55('0x49')],_0x3d0136[_0xdf55('0x4a')]);_0x12c232[_0xdf55('0x4e')]=_['intersection'](_0x3d0136[_0xdf55('0x49')],qs['fields'](_0x262b01[_0xdf55('0x4a')][_0xdf55('0x4f')]));_0x12c232['attributes']=_0x12c232['attributes'][_0xdf55('0x5e')]?_0x12c232['attributes']:_0x3d0136[_0xdf55('0x49')];_0x12c232[_0xdf55('0x51')]=qs[_0xdf55('0x52')](_0x262b01[_0xdf55('0x4a')]['sort']);_0x12c232[_0xdf55('0x53')]=qs[_0xdf55('0x4c')](_[_0xdf55('0x54')](_0x262b01['query'],_0x3d0136[_0xdf55('0x4c')]));if(_0x262b01[_0xdf55('0x4a')][_0xdf55('0x57')]){_0x12c232[_0xdf55('0x53')]=_[_0xdf55('0x55')](_0x12c232[_0xdf55('0x53')],{'$or':_[_0xdf55('0x43')](_0x12c232[_0xdf55('0x4e')],function(_0x4183ec){var _0x101b9f={};_0x101b9f[_0x4183ec]={'$like':'%'+_0x262b01[_0xdf55('0x4a')][_0xdf55('0x57')]+'%'};return _0x101b9f;})});}_0x12c232=_[_0xdf55('0x55')]({},_0x12c232,_0x262b01[_0xdf55('0x58')]);return _0x31bcce[_0xdf55('0x8a')](_0x12c232);}})['then'](function(_0x4faaa7){if(_0x4faaa7){_0x251edf=_0x4faaa7[_0xdf55('0x5e')];if(!_0x262b01['query']['hasOwnProperty']('nolimit')){_0x12c232['limit']=qs[_0xdf55('0x32')](_0x262b01[_0xdf55('0x4a')]['limit']);_0x12c232['offset']=qs[_0xdf55('0x31')](_0x262b01['query'][_0xdf55('0x31')]);}return _0x31bcce[_0xdf55('0x8a')](_0x12c232);}})[_0xdf55('0x3b')](function(_0xa5b932){if(_0xa5b932){return _0xa5b932?{'count':_0x251edf,'rows':_0xa5b932}:null;}})[_0xdf55('0x3b')](respondWithResult(_0x5e1eee,null))['catch'](handleError(_0x5e1eee,null));};function Extension(_0x146a48,_0x5aa48d,_0x40a34d,_0x105217){this[_0xdf55('0x8b')]=_0xdf55('0x8c');this[_0xdf55('0x8d')]=_0x146a48[_0xdf55('0x8e')];this[_0xdf55('0x8f')]=_0x105217;this['type']='system';this[_0xdf55('0x90')]=_0xdf55('0x91');this['FaxAccountId']=_0x146a48['id'];this[_0xdf55('0x89')]=_0x5aa48d;this[_0xdf55('0x92')]=_0x40a34d;}function createExtensionsReciveFax(_0x38e68b){var _0x201067=0x1;var _0x36c1ce=[];_0x36c1ce['push'](new Extension(_0x38e68b,_0x201067,'',_0xdf55('0x93')));_0x201067+=0x1;_0x36c1ce['push'](new Extension(_0x38e68b,_0x201067,_0xdf55('0x94'),_0xdf55('0x95')));_0x201067+=0x1;for(var _0x1180cf in _0x38e68b){if(_0x38e68b['hasOwnProperty'](_0x1180cf)&&(_0x1180cf===_0xdf55('0x96')||_0x1180cf==='localstationid'||_0x1180cf===_0xdf55('0x97')||_0x1180cf===_0xdf55('0x98')||_0x1180cf===_0xdf55('0x99')||_0x1180cf===_0xdf55('0x9a')||_0x1180cf===_0xdf55('0x9b')||_0x1180cf==='modem'||_0x1180cf==='t38timeout')){_0x36c1ce[_0xdf55('0x9c')](new Extension(_0x38e68b,_0x201067,_0xdf55('0x9d')+_0x1180cf+')='+_0x38e68b[_0x1180cf],_0xdf55('0x95')));_0x201067+=0x1;}}_0x36c1ce[_0xdf55('0x9c')](new Extension(_0x38e68b,_0x201067,'6',_0xdf55('0x9e')));_0x201067+=0x1;_0x36c1ce[_0xdf55('0x9c')](new Extension(_0x38e68b,_0x201067,'/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'));_0x201067=0x0;return _0x36c1ce;}exports[_0xdf55('0x9f')]=function(_0x570623,_0x3e4cfc,_0xa0f455){var _0x2edb7d;return db[_0xdf55('0x85')]['transaction'](function(_0x434e77){return db['FaxAccount'][_0xdf55('0x61')](_0x570623['body'],{'transaction':_0x434e77})[_0xdf55('0x3b')](function(_0x12bb21){_0x2edb7d=_0x12bb21['get']({'plain':!![]});return db[_0xdf55('0xa0')]['bulkCreate'](createExtensionsReciveFax(_0x2edb7d),{'transaction':_0x434e77});});})['then'](function(){return _0x2edb7d;})[_0xdf55('0x3b')](respondWithResult(_0x3e4cfc,null))[_0xdf55('0x2d')](handleError(_0x3e4cfc,null));};exports[_0xdf55('0xa1')]=function(_0xcb8222,_0xb176f0,_0x20c3ea){var _0x11b27f;return db[_0xdf55('0x85')]['transaction'](function(_0x28df50){return db['FaxAccount']['update'](_0xcb8222['body'],{'where':{'id':_0xcb8222[_0xdf55('0x62')]['id']},'transaction':_0x28df50})['then'](function(_0x5942b1){return db[_0xdf55('0xa0')][_0xdf55('0x3a')]({'where':{'FaxAccountId':_0xcb8222[_0xdf55('0x62')]['id']},'transaction':_0x28df50})['then'](function(_0x2e8867){return db[_0xdf55('0xa0')][_0xdf55('0x87')](createExtensionsReciveFax(_[_0xdf55('0x7a')](_0xcb8222[_0xdf55('0x62')],['tech',_0xdf55('0x48'),_0xdf55('0xa2'),_0xdf55('0xa3'),_0xdf55('0xa4'),_0xdf55('0xa5')])),{'transaction':_0x28df50});});});})[_0xdf55('0x3b')](function(){return db[_0xdf55('0x44')][_0xdf55('0xa6')](_0xcb8222['body']['id']);})[_0xdf55('0x3b')](respondWithResult(_0xb176f0,null))[_0xdf55('0x2d')](handleError(_0xb176f0,null));};exports[_0xdf55('0xa7')]=function(_0x31fac1,_0x37c67d,_0x3d1abc){var _0x320c8e={'raw':!![],'where':{}};var _0x573d12={};var _0x14afb9={'count':0x0,'rows':[]};return db[_0xdf55('0x44')]['findOne']({'where':{'id':_0x31fac1[_0xdf55('0x5d')]['id']}})[_0xdf55('0x3b')](handleEntityNotFound(_0x37c67d,null))[_0xdf55('0x3b')](function(_0x125a37){if(_0x125a37){_0x573d12[_0xdf55('0x49')]=_[_0xdf55('0x4b')](db[_0xdf55('0xa8')]['rawAttributes']);_0x573d12[_0xdf55('0x4a')]=_[_0xdf55('0x4b')](_0x31fac1[_0xdf55('0x4a')]);_0x573d12[_0xdf55('0x4c')]=_[_0xdf55('0x4d')](_0x573d12[_0xdf55('0x49')],_0x573d12[_0xdf55('0x4a')]);_0x320c8e[_0xdf55('0x4e')]=_[_0xdf55('0x4d')](_0x573d12['model'],qs['fields'](_0x31fac1[_0xdf55('0x4a')][_0xdf55('0x4f')]));_0x320c8e[_0xdf55('0x4e')]=_0x320c8e[_0xdf55('0x4e')][_0xdf55('0x5e')]?_0x320c8e[_0xdf55('0x4e')]:_0x573d12[_0xdf55('0x49')];if(!_0x31fac1[_0xdf55('0x4a')][_0xdf55('0x50')](_0xdf55('0x76'))){_0x320c8e[_0xdf55('0x32')]=qs[_0xdf55('0x32')](_0x31fac1[_0xdf55('0x4a')][_0xdf55('0x32')]);_0x320c8e[_0xdf55('0x31')]=qs[_0xdf55('0x31')](_0x31fac1[_0xdf55('0x4a')][_0xdf55('0x31')]);}_0x320c8e[_0xdf55('0x51')]=qs['sort'](_0x31fac1[_0xdf55('0x4a')]['sort']);_0x320c8e[_0xdf55('0x53')]=qs[_0xdf55('0x4c')](_[_0xdf55('0x54')](_0x31fac1[_0xdf55('0x4a')],_0x573d12[_0xdf55('0x4c')]));_0x320c8e[_0xdf55('0x53')][_0xdf55('0x70')]=_0x125a37['id'];if(_0x31fac1[_0xdf55('0x4a')]['filter']){_0x320c8e['where']=_[_0xdf55('0x55')](_0x320c8e[_0xdf55('0x53')],{'$or':_[_0xdf55('0x43')](_0x320c8e['attributes'],function(_0x3bf805){var _0x1a15ad={};_0x1a15ad[_0x3bf805]={'$like':'%'+_0x31fac1[_0xdf55('0x4a')][_0xdf55('0x57')]+'%'};return _0x1a15ad;})});}if(_0x31fac1[_0xdf55('0x4a')][_0xdf55('0xa9')]){var _0x42031b=_0x31fac1[_0xdf55('0x4a')][_0xdf55('0xa9')][_0xdf55('0xaa')](',');var _0xb5b3e5={};_0xb5b3e5[_0x42031b[0x0]]={'$gte':moment(_0x42031b[0x1])[_0xdf55('0xab')](_0xdf55('0xac'))};_0x320c8e[_0xdf55('0x53')]=_[_0xdf55('0x55')](_0x320c8e[_0xdf55('0x53')],_0xb5b3e5);}_0x320c8e=_['merge']({},_0x320c8e,_0x31fac1['options']);return db[_0xdf55('0xa8')][_0xdf55('0x34')]({'where':_0x320c8e[_0xdf55('0x53')]})[_0xdf55('0x3b')](function(_0x11bc26){_0x14afb9[_0xdf55('0x34')]=_0x11bc26;if(_0x31fac1[_0xdf55('0x4a')]['includeAll']){_0x320c8e['include']=[{'all':!![]}];}return db[_0xdf55('0xa8')][_0xdf55('0x5a')](_0x320c8e);})[_0xdf55('0x3b')](function(_0x3c516e){_0x14afb9[_0xdf55('0x5b')]=_0x3c516e;return _0x14afb9;});}})[_0xdf55('0x3b')](respondWithFilteredResult(_0x37c67d,_0x320c8e))['catch'](handleError(_0x37c67d,null));};exports['send']=function(_0x5d678a,_0x31c474,_0x2bdac6){var _0x1b58fe,_0x15c996={},_0x11bfb9;if(_0x5d678a[_0xdf55('0x62')]['to']){_0x11bfb9=_0x5d678a[_0xdf55('0x62')]['to'][0x0];}return db[_0xdf55('0x44')][_0xdf55('0x60')]({'where':{'id':_0x5d678a['params']['id']},'include':[{'model':db[_0xdf55('0xad')],'as':_0xdf55('0xae'),'include':[{'model':db['CmContact'],'as':_0xdf55('0xaf'),'where':{'fax':_0x11bfb9},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xdf55('0x3b')](handleEntityNotFound(_0x31c474,null))[_0xdf55('0x3b')](function(_0x260ee7){_0x1b58fe=_0x260ee7;if(_0x5d678a[_0xdf55('0x62')]['attachments']&&_0x5d678a['body']['attachments']['length']){for(var _0x3ac585=0x0;_0x3ac585<_0x5d678a[_0xdf55('0x62')][_0xdf55('0xb0')][_0xdf55('0x5e')];_0x3ac585+=0x1){_0x5d678a['body']['attachments'][_0x3ac585]={'filename':_0x5d678a[_0xdf55('0x62')]['attachments'][_0x3ac585]['name'],'id':_0x5d678a[_0xdf55('0x62')][_0xdf55('0xb0')][_0x3ac585]['id'],'path':path[_0xdf55('0xb1')](config[_0xdf55('0xb2')],_0xdf55('0xb3'),_0x5d678a[_0xdf55('0x62')]['attachments'][_0x3ac585][_0xdf55('0xb4')])};}}return respondWithRpcPromise(_0xdf55('0xb5'),_0xdf55('0xb5'),{'FaxAccountId':_[_0xdf55('0xb6')](_0x5d678a[_0xdf55('0x5d')]['id'])?undefined:_0x5d678a[_0xdf55('0x5d')]['id'],'path':_[_0xdf55('0xb6')](_0x5d678a[_0xdf55('0x62')]['attachments'][0x0][_0xdf55('0x7')])?undefined:_0x5d678a[_0xdf55('0x62')][_0xdf55('0xb0')][0x0]['path'],'fax':_[_0xdf55('0xb6')](_0x5d678a[_0xdf55('0x62')]['to'][0x0])?undefined:_0x5d678a[_0xdf55('0x62')]['to'][0x0]},client9002);})[_0xdf55('0x3b')](function(){if(_0x1b58fe){if(_[_0xdf55('0xb6')](_0x5d678a[_0xdf55('0x62')][_0xdf55('0xb7')])){_0x5d678a['body'][_0xdf55('0xb7')]=util[_0xdf55('0xab')](_0xdf55('0xb8'),_0x1b58fe[_0xdf55('0x56')],_0x1b58fe[_0xdf55('0xb9')]);}if(_0x1b58fe[_0xdf55('0xae')]){if(_0x1b58fe['List'][_0xdf55('0xaf')][_0xdf55('0x5e')]){return _0x1b58fe[_0xdf55('0xae')]['Contacts'][0x0];}else{return db[_0xdf55('0x7c')][_0xdf55('0x61')](_['defaults'](_0x5d678a['body'],{'firstName':_0x5d678a['body']['to'][0x0],'phone':_0x5d678a[_0xdf55('0x62')]['to'][0x0],'fax':_0x5d678a['body']['to'][0x0],'ListId':_0x1b58fe[_0xdf55('0xa5')]}));}}else{throw new Error(_0xdf55('0xba'));}}else{throw new Error(_0xdf55('0xbb'));}})['then'](function(_0x578285){if(_0x578285){return db[_0xdf55('0x78')][_0xdf55('0x60')]({'where':{'ContactId':_0x578285['id'],'closed':![],'FaxAccountId':_0x1b58fe['id']}})[_0xdf55('0x3b')](function(_0x4ea336){if(_0x4ea336){return[_0x4ea336,![]];}return db[_0xdf55('0x78')][_0xdf55('0x61')]({'UserId':_0x5d678a['user']['id'],'ContactId':_0x578285['id'],'FaxAccountId':_0x1b58fe['id'],'fax':_0x5d678a[_0xdf55('0x62')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x5d678a[_0xdf55('0x62')],{'read':![],'body':_0x5d678a[_0xdf55('0x62')][_0xdf55('0xb0')][0x0][_0xdf55('0xbc')],'FaxAccountId':_0x1b58fe['id'],'UserId':_0x5d678a[_0xdf55('0x63')]['id'],'ContactId':_0x578285['id'],'AttachmentId':_0x5d678a[_0xdf55('0x62')][_0xdf55('0xb0')][0x0]['id']})]},{'include':[{'model':db[_0xdf55('0xa8')],'as':_0xdf55('0xbd')}]})['then'](function(_0x51d91f){return[_0x51d91f,!![]];});});}else{throw new Error(_0xdf55('0xbe'));}})[_0xdf55('0xbf')](function(_0x3f75ac,_0x55e5e8){if(_0x55e5e8){return _0x3f75ac;}return db[_0xdf55('0xa8')][_0xdf55('0x61')]({'direction':'out','read':![],'body':_0x5d678a[_0xdf55('0x62')][_0xdf55('0xb0')][0x0][_0xdf55('0xbc')],'FaxAccountId':_0x1b58fe['id'],'FaxInteractionId':_0x3f75ac['id'],'UserId':_0x5d678a[_0xdf55('0x63')]['id'],'ContactId':_0x3f75ac[_0xdf55('0xc0')],'AttachmentId':_0x5d678a[_0xdf55('0x62')][_0xdf55('0xb0')][0x0]['id']})['then'](function(_0x275217){_0x3f75ac['dataValues'][_0xdf55('0xbd')]=[];_0x3f75ac[_0xdf55('0xc1')][_0xdf55('0xbd')][_0xdf55('0x9c')](_0x275217['dataValues']);return _0x3f75ac;});})[_0xdf55('0x3b')](function(_0x47bc78){respondWithRpcPromise('SendFax',_0xdf55('0xc2'),{'FaxAccountId':_[_0xdf55('0xb6')](_0x5d678a[_0xdf55('0x5d')]['id'])?undefined:_0x5d678a[_0xdf55('0x5d')]['id'],'path':_[_0xdf55('0xb6')](_0x5d678a[_0xdf55('0x62')][_0xdf55('0xb0')][0x0][_0xdf55('0x7')])?undefined:_0x5d678a[_0xdf55('0x62')][_0xdf55('0xb0')][0x0][_0xdf55('0x7')],'fax':_[_0xdf55('0xb6')](_0x5d678a[_0xdf55('0x62')]['to'][0x0])?undefined:_0x5d678a[_0xdf55('0x62')]['to'][0x0],'AttachmentId':_0x5d678a[_0xdf55('0x62')][_0xdf55('0xb0')][0x0]['id']},client9002)['then'](function(_0x360118){logger[_0xdf55('0x23')]('SendFaxRpc,\x20%s',_0x360118);})['catch'](function(_0x3234a6){logger[_0xdf55('0x23')]('SendFaxRpc,\x20%s',_0x3234a6);});return _0x47bc78;})[_0xdf55('0x3b')](respondWithResult(_0x31c474,null))[_0xdf55('0x2d')](handleError(_0x31c474,null));};exports[_0xdf55('0xc3')]=function(_0x355e4b,_0xa1e2df,_0x1454f5){return db[_0xdf55('0x44')]['find']({'where':{'id':_0x355e4b[_0xdf55('0x5d')]['id']}})[_0xdf55('0x3b')](handleEntityNotFound(_0xa1e2df,null))[_0xdf55('0x3b')](function(_0x4e6e47){if(_0x4e6e47){return _0x4e6e47[_0xdf55('0xc3')](_0x355e4b[_0xdf55('0x62')][_0xdf55('0x72')],_['omit'](_0x355e4b[_0xdf55('0x62')],[_0xdf55('0x72'),'id'])||{})[_0xdf55('0xbf')](function(_0x177b79){for(var _0x5154b1=0x0;_0x5154b1<_0x355e4b[_0xdf55('0x62')]['ids'][_0xdf55('0x5e')];_0x5154b1+=0x1){socket[_0xdf55('0xc4')](_0xdf55('0xc5'),{'UserId':Number(_0x355e4b['body']['ids'][_0x5154b1]),'FaxAccountId':Number(_0x355e4b[_0xdf55('0x5d')]['id'])});}return _0x177b79;});}})[_0xdf55('0x3b')](respondWithResult(_0xa1e2df,null))[_0xdf55('0x2d')](handleError(_0xa1e2df,null));};exports['removeAgents']=function(_0x214df1,_0x45ff28,_0x1819b3){return db[_0xdf55('0x44')][_0xdf55('0x60')]({'where':{'id':_0x214df1[_0xdf55('0x5d')]['id']}})[_0xdf55('0x3b')](handleEntityNotFound(_0x45ff28,null))[_0xdf55('0x3b')](function(_0x82fd6a){if(_0x82fd6a){return _0x82fd6a[_0xdf55('0xc6')](_0x214df1[_0xdf55('0x4a')][_0xdf55('0x72')])[_0xdf55('0x3b')](function(){if(_['isArray'](_0x214df1[_0xdf55('0x4a')]['ids'])){for(var _0x1a1b7f=0x0;_0x1a1b7f<_0x214df1[_0xdf55('0x4a')][_0xdf55('0x72')]['length'];_0x1a1b7f+=0x1){socket[_0xdf55('0xc4')](_0xdf55('0xc7'),{'UserId':Number(_0x214df1[_0xdf55('0x4a')][_0xdf55('0x72')][_0x1a1b7f]),'FaxAccountId':Number(_0x214df1[_0xdf55('0x5d')]['id'])});}}else{socket[_0xdf55('0xc4')](_0xdf55('0xc7'),{'UserId':Number(_0x214df1[_0xdf55('0x4a')][_0xdf55('0x72')]),'FaxAccountId':Number(_0x214df1[_0xdf55('0x5d')]['id'])});}});}})[_0xdf55('0x3b')](respondWithStatusCode(_0x45ff28,null))['catch'](handleError(_0x45ff28,null));};exports[_0xdf55('0xc8')]=function(_0x50bd34,_0x5815d6,_0x47505c){var _0x255624={};var _0x1f751c={};var _0x3a4b9f;var _0x31800f;return db[_0xdf55('0x44')][_0xdf55('0x6e')]({'where':{'id':_0x50bd34[_0xdf55('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5815d6,null))[_0xdf55('0x3b')](function(_0x1486f6){if(_0x1486f6){_0x3a4b9f=_0x1486f6;_0x1f751c[_0xdf55('0x49')]=_[_0xdf55('0x4b')](db[_0xdf55('0x7d')]['rawAttributes']);_0x1f751c[_0xdf55('0x4a')]=_[_0xdf55('0x4b')](_0x50bd34[_0xdf55('0x4a')]);_0x1f751c[_0xdf55('0x4c')]=_['intersection'](_0x1f751c['model'],_0x1f751c[_0xdf55('0x4a')]);_0x255624[_0xdf55('0x4e')]=_['intersection'](_0x1f751c['model'],qs[_0xdf55('0x4f')](_0x50bd34['query'][_0xdf55('0x4f')]));_0x255624[_0xdf55('0x4e')]=_0x255624[_0xdf55('0x4e')]['length']?_0x255624[_0xdf55('0x4e')]:_0x1f751c['model'];_0x255624['order']=qs[_0xdf55('0x52')](_0x50bd34['query'][_0xdf55('0x52')]);_0x255624[_0xdf55('0x53')]=qs[_0xdf55('0x4c')](_[_0xdf55('0x54')](_0x50bd34[_0xdf55('0x4a')],_0x1f751c[_0xdf55('0x4c')]));if(_0x50bd34[_0xdf55('0x4a')][_0xdf55('0x57')]){_0x255624['where']=_[_0xdf55('0x55')](_0x255624[_0xdf55('0x53')],{'$or':_['map'](_0x255624['attributes'],function(_0x551462){var _0x25a0bb={};_0x25a0bb[_0x551462]={'$like':'%'+_0x50bd34[_0xdf55('0x4a')][_0xdf55('0x57')]+'%'};return _0x25a0bb;})});}_0x255624=_[_0xdf55('0x55')]({},_0x255624,_0x50bd34[_0xdf55('0x58')]);return _0x3a4b9f['getAgents'](_0x255624);}})[_0xdf55('0x3b')](function(_0x320d96){if(_0x320d96){_0x31800f=_0x320d96[_0xdf55('0x5e')];if(!_0x50bd34['query'][_0xdf55('0x50')](_0xdf55('0x76'))){_0x255624['limit']=qs[_0xdf55('0x32')](_0x50bd34['query'][_0xdf55('0x32')]);_0x255624[_0xdf55('0x31')]=qs[_0xdf55('0x31')](_0x50bd34[_0xdf55('0x4a')]['offset']);}return _0x3a4b9f['getAgents'](_0x255624);}})[_0xdf55('0x3b')](function(_0x57768a){if(_0x57768a){return _0x57768a?{'count':_0x31800f,'rows':_0x57768a}:null;}})[_0xdf55('0x3b')](respondWithResult(_0x5815d6,null))[_0xdf55('0x2d')](handleError(_0x5815d6,null));}; \ No newline at end of file +var _0x28da=['createdAt','updatedAt','TrunkId','ListId','findById','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','defaults','List\x20not\x20found','Send\x20Fax\x20failed','filename','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','get','FaxAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','length','options','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','order','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','FaxInteraction','addInteraction','omit','getInteractions','findOne','CmContact','Contact','User','Owner','fullname','Tag','Tags','tag','addApplications','sequelize','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','faxdetect','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','transaction','VoiceExtension','key'];(function(_0x5daa6a,_0x18b7f5){var _0x4d06ae=function(_0x1e3cff){while(--_0x1e3cff){_0x5daa6a['push'](_0x5daa6a['shift']());}};_0x4d06ae(++_0x18b7f5);}(_0x28da,0x1aa));var _0xa28d=function(_0x5a76f5,_0x88da14){_0x5a76f5=_0x5a76f5-0x0;var _0x10e2ec=_0x28da[_0x5a76f5];return _0x10e2ec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa28d('0x0'));var zipdir=require(_0xa28d('0x1'));var jsonpatch=require(_0xa28d('0x2'));var rp=require(_0xa28d('0x3'));var moment=require(_0xa28d('0x4'));var BPromise=require(_0xa28d('0x5'));var Mustache=require(_0xa28d('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa28d('0x7'));var csv=require(_0xa28d('0x8'));var ejs=require(_0xa28d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa28d('0xa'));var squel=require(_0xa28d('0xb'));var crypto=require(_0xa28d('0xc'));var jsforce=require(_0xa28d('0xd'));var deskjs=require(_0xa28d('0xe'));var toCsv=require(_0xa28d('0x8'));var querystring=require(_0xa28d('0xf'));var Papa=require(_0xa28d('0x10'));var Redis=require(_0xa28d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa28d('0x12'));var as=require(_0xa28d('0x13'));var hardwareService=require(_0xa28d('0x14'));var logger=require(_0xa28d('0x15'))(_0xa28d('0x16'));var utils=require(_0xa28d('0x17'));var config=require(_0xa28d('0x18'));var licenseUtil=require(_0xa28d('0x19'));var db=require(_0xa28d('0x1a'))['db'];config[_0xa28d('0x1b')]=_['defaults'](config[_0xa28d('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xa28d('0x1c'))(new Redis(config[_0xa28d('0x1b')]));require(_0xa28d('0x1d'))[_0xa28d('0x1e')](socket);var jayson=require(_0xa28d('0x1f'));var client=jayson[_0xa28d('0x20')][_0xa28d('0x21')]({'port':0x232c});var client9002=jayson['client'][_0xa28d('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x38688d,_0x372e57,_0x27ede5,_0x4b4ca1){return new BPromise(function(_0x3f6fc8,_0x24bb76){var _0x484ce3=_0x4b4ca1||client;return _0x484ce3['request'](_0x38688d,_0x27ede5)[_0xa28d('0x22')](function(_0x204c4d){logger[_0xa28d('0x23')]('FaxAccount,\x20%s,\x20%s',_0x372e57,_0xa28d('0x24'));logger['debug'](_0xa28d('0x25'),_0x372e57,_0xa28d('0x24'),JSON[_0xa28d('0x26')](_0x204c4d));if(_0x204c4d['error']){if(_0x204c4d['error']['code']===0x1f4){logger[_0xa28d('0x27')](_0xa28d('0x28'),_0x372e57,_0x204c4d['error'][_0xa28d('0x29')]);return _0x24bb76(_0x204c4d[_0xa28d('0x27')]['message']);}logger[_0xa28d('0x27')](_0xa28d('0x28'),_0x372e57,_0x204c4d[_0xa28d('0x27')][_0xa28d('0x29')]);return _0x3f6fc8(_0x204c4d[_0xa28d('0x27')][_0xa28d('0x29')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x372e57,_0xa28d('0x24'));_0x3f6fc8(_0x204c4d[_0xa28d('0x2a')][_0xa28d('0x29')]);}})[_0xa28d('0x2b')](function(_0x308589){logger[_0xa28d('0x27')](_0xa28d('0x28'),_0x372e57,_0x308589);_0x24bb76(_0x308589);});});}function respondWithStatusCode(_0x553d1d,_0xcf6ee8){_0xcf6ee8=_0xcf6ee8||0xcc;return function(_0x21f709){if(_0x21f709){return _0x553d1d[_0xa28d('0x2c')](_0xcf6ee8);}return _0x553d1d[_0xa28d('0x2d')](_0xcf6ee8)[_0xa28d('0x2e')]();};}function respondWithResult(_0x32207c,_0x12f1c3){_0x12f1c3=_0x12f1c3||0xc8;return function(_0x38ce01){if(_0x38ce01){return _0x32207c[_0xa28d('0x2d')](_0x12f1c3)[_0xa28d('0x2f')](_0x38ce01);}};}function respondWithFilteredResult(_0xdff114,_0xe241b7){return function(_0x229b0d){if(_0x229b0d){var _0x4ad3e2=typeof _0xe241b7['offset']===_0xa28d('0x30')&&typeof _0xe241b7[_0xa28d('0x31')]===_0xa28d('0x30');var _0x294465=_0x229b0d[_0xa28d('0x32')];var _0x1f0fa4=_0x4ad3e2?0x0:_0xe241b7['offset'];var _0x680018=_0x4ad3e2?_0x229b0d[_0xa28d('0x32')]:_0xe241b7[_0xa28d('0x33')]+_0xe241b7[_0xa28d('0x31')];var _0x27326b;if(_0x680018>=_0x294465){_0x680018=_0x294465;_0x27326b=0xc8;}else{_0x27326b=0xce;}_0xdff114['status'](_0x27326b);return _0xdff114['set'](_0xa28d('0x34'),_0x1f0fa4+'-'+_0x680018+'/'+_0x294465)[_0xa28d('0x2f')](_0x229b0d);}return null;};}function patchUpdates(_0xb6e4d7){return function(_0x1f6320){try{jsonpatch[_0xa28d('0x35')](_0x1f6320,_0xb6e4d7,!![]);}catch(_0x2b8708){return BPromise['reject'](_0x2b8708);}return _0x1f6320['save']();};}function saveUpdates(_0x30f611,_0x2610d1){return function(_0x57da43){if(_0x57da43){return _0x57da43[_0xa28d('0x36')](_0x30f611)['then'](function(_0xb65485){return _0xb65485;});}return null;};}function removeEntity(_0x115377,_0x28f7c0){return function(_0x5032c7){if(_0x5032c7){return _0x5032c7['destroy']()['then'](function(){var _0x2126d4=_0x5032c7[_0xa28d('0x37')]({'plain':!![]});var _0x23c20c=_0xa28d('0x38');return db[_0xa28d('0x39')][_0xa28d('0x3a')]({'where':{'type':_0x23c20c,'resourceId':_0x2126d4['id']}})['then'](function(){return _0x5032c7;});})[_0xa28d('0x22')](function(){_0x115377[_0xa28d('0x2d')](0xcc)[_0xa28d('0x2e')]();});}};}function handleEntityNotFound(_0x47016d,_0x219c20){return function(_0x9cae30){if(!_0x9cae30){_0x47016d['sendStatus'](0x194);}return _0x9cae30;};}function handleError(_0x4e77a1,_0x321617){_0x321617=_0x321617||0x1f4;return function(_0x1873f4){logger[_0xa28d('0x27')](_0x1873f4[_0xa28d('0x3b')]);if(_0x1873f4[_0xa28d('0x3c')]){delete _0x1873f4['name'];}_0x4e77a1[_0xa28d('0x2d')](_0x321617)[_0xa28d('0x3d')](_0x1873f4);};}exports['index']=function(_0x4e5f44,_0x3fae76){var _0x1f5b35={'include':[{'model':db[_0xa28d('0x3e')],'as':_0xa28d('0x3f')}]},_0x321beb={},_0x298177={'count':0x0,'rows':[]};var _0x4a6348=_[_0xa28d('0x40')](db[_0xa28d('0x41')][_0xa28d('0x42')],function(_0x2ebd43){return{'name':_0x2ebd43[_0xa28d('0x43')],'type':_0x2ebd43[_0xa28d('0x44')]['key']};});_0x321beb[_0xa28d('0x45')]=_[_0xa28d('0x40')](_0x4a6348,_0xa28d('0x3c'));_0x321beb['query']=_['keys'](_0x4e5f44[_0xa28d('0x46')]);_0x321beb[_0xa28d('0x47')]=_[_0xa28d('0x48')](_0x321beb[_0xa28d('0x45')],_0x321beb['query']);_0x1f5b35['attributes']=_[_0xa28d('0x48')](_0x321beb[_0xa28d('0x45')],qs[_0xa28d('0x49')](_0x4e5f44[_0xa28d('0x46')][_0xa28d('0x49')]));_0x1f5b35[_0xa28d('0x4a')]=_0x1f5b35[_0xa28d('0x4a')]['length']?_0x1f5b35['attributes']:_0x321beb['model'];if(!_0x4e5f44[_0xa28d('0x46')][_0xa28d('0x4b')](_0xa28d('0x4c'))){_0x1f5b35[_0xa28d('0x31')]=qs[_0xa28d('0x31')](_0x4e5f44[_0xa28d('0x46')]['limit']);_0x1f5b35[_0xa28d('0x33')]=qs[_0xa28d('0x33')](_0x4e5f44[_0xa28d('0x46')][_0xa28d('0x33')]);}_0x1f5b35['order']=qs[_0xa28d('0x4d')](_0x4e5f44['query']['sort']);_0x1f5b35['where']=qs[_0xa28d('0x47')](_[_0xa28d('0x4e')](_0x4e5f44['query'],_0x321beb[_0xa28d('0x47')]),_0x4a6348);if(_0x4e5f44[_0xa28d('0x46')][_0xa28d('0x4f')]){_0x1f5b35[_0xa28d('0x50')]=_[_0xa28d('0x51')](_0x1f5b35['where'],{'$or':_[_0xa28d('0x40')](_0x4a6348,function(_0x18e37e){if(_0x18e37e[_0xa28d('0x44')]!==_0xa28d('0x52')){var _0x389a93={};_0x389a93[_0x18e37e['name']]={'$like':'%'+_0x4e5f44['query'][_0xa28d('0x4f')]+'%'};return _0x389a93;}})});}_0x1f5b35=_[_0xa28d('0x51')]({},_0x1f5b35,_0x4e5f44['options']);var _0x72fa21={'where':_0x1f5b35[_0xa28d('0x50')]};return db['FaxAccount'][_0xa28d('0x32')](_0x72fa21)[_0xa28d('0x22')](function(_0x5e6deb){_0x298177['count']=_0x5e6deb;if(_0x4e5f44['query'][_0xa28d('0x53')]){_0x1f5b35[_0xa28d('0x54')]=[{'all':!![]}];}return db[_0xa28d('0x41')][_0xa28d('0x55')](_0x1f5b35);})[_0xa28d('0x22')](function(_0x3a2bde){_0x298177[_0xa28d('0x56')]=_0x3a2bde;return _0x298177;})[_0xa28d('0x22')](respondWithFilteredResult(_0x3fae76,_0x1f5b35))[_0xa28d('0x2b')](handleError(_0x3fae76,null));};exports[_0xa28d('0x57')]=function(_0x5c17fa,_0x4f2dca){var _0x15af84={'raw':![],'where':{'id':_0x5c17fa[_0xa28d('0x58')]['id']},'include':[{'model':db[_0xa28d('0x3e')],'as':_0xa28d('0x3f')}]},_0xbbf9ac={};_0xbbf9ac['model']=_[_0xa28d('0x59')](db[_0xa28d('0x41')][_0xa28d('0x42')]);_0xbbf9ac[_0xa28d('0x46')]=_[_0xa28d('0x59')](_0x5c17fa['query']);_0xbbf9ac[_0xa28d('0x47')]=_[_0xa28d('0x48')](_0xbbf9ac[_0xa28d('0x45')],_0xbbf9ac[_0xa28d('0x46')]);_0x15af84[_0xa28d('0x4a')]=_[_0xa28d('0x48')](_0xbbf9ac[_0xa28d('0x45')],qs[_0xa28d('0x49')](_0x5c17fa[_0xa28d('0x46')]['fields']));_0x15af84[_0xa28d('0x4a')]=_0x15af84['attributes'][_0xa28d('0x5a')]?_0x15af84[_0xa28d('0x4a')]:_0xbbf9ac[_0xa28d('0x45')];if(_0x5c17fa[_0xa28d('0x46')]['includeAll']){_0x15af84[_0xa28d('0x54')]=[{'all':!![]}];}_0x15af84=_[_0xa28d('0x51')]({},_0x15af84,_0x5c17fa[_0xa28d('0x5b')]);return db[_0xa28d('0x41')][_0xa28d('0x5c')](_0x15af84)[_0xa28d('0x22')](handleEntityNotFound(_0x4f2dca,null))['then'](respondWithResult(_0x4f2dca,null))[_0xa28d('0x2b')](handleError(_0x4f2dca,null));};exports['create']=function(_0x59ed41,_0x2fda96){return db[_0xa28d('0x41')][_0xa28d('0x5d')](_0x59ed41['body'],{})[_0xa28d('0x22')](function(_0x39d837){var _0x5a8a67=_0x59ed41[_0xa28d('0x5e')][_0xa28d('0x37')]({'plain':!![]});if(!_0x5a8a67)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a8a67[_0xa28d('0x5f')]===_0xa28d('0x5e')){var _0x266329=_0x39d837['get']({'plain':!![]});var _0x5aa8bd=_0xa28d('0x38');return db[_0xa28d('0x60')][_0xa28d('0x5c')]({'where':{'name':_0x5aa8bd,'userProfileId':_0x5a8a67[_0xa28d('0x61')]},'raw':!![]})[_0xa28d('0x22')](function(_0x2d5fd6){if(_0x2d5fd6&&_0x2d5fd6[_0xa28d('0x62')]===0x0){return db[_0xa28d('0x39')][_0xa28d('0x5d')]({'name':_0x266329[_0xa28d('0x3c')],'resourceId':_0x266329['id'],'type':_0x2d5fd6[_0xa28d('0x3c')],'sectionId':_0x2d5fd6['id']},{})['then'](function(){return _0x39d837;});}else{return _0x39d837;}})['catch'](function(_0x22876d){logger[_0xa28d('0x27')](_0xa28d('0x63'),_0x22876d);throw _0x22876d;});}return _0x39d837;})[_0xa28d('0x22')](respondWithResult(_0x2fda96,0xc9))['catch'](handleError(_0x2fda96,null));};exports[_0xa28d('0x36')]=function(_0x5a9308,_0x348f7e){if(_0x5a9308[_0xa28d('0x64')]['id']){delete _0x5a9308[_0xa28d('0x64')]['id'];}return db['FaxAccount'][_0xa28d('0x5c')]({'where':{'id':_0x5a9308[_0xa28d('0x58')]['id']},'include':[{'model':db[_0xa28d('0x3e')],'as':'mandatoryDispositionPause'}]})[_0xa28d('0x22')](handleEntityNotFound(_0x348f7e,null))['then'](saveUpdates(_0x5a9308['body'],null))[_0xa28d('0x22')](respondWithResult(_0x348f7e,null))[_0xa28d('0x2b')](handleError(_0x348f7e,null));};exports[_0xa28d('0x3a')]=function(_0xdb9424,_0x99446c){return db[_0xa28d('0x41')][_0xa28d('0x5c')]({'where':{'id':_0xdb9424[_0xa28d('0x58')]['id']}})[_0xa28d('0x22')](handleEntityNotFound(_0x99446c,null))[_0xa28d('0x22')](removeEntity(_0x99446c,null))[_0xa28d('0x2b')](handleError(_0x99446c,null));};exports[_0xa28d('0x65')]=function(_0x8f0b7e,_0x15115e){return db[_0xa28d('0x41')][_0xa28d('0x65')]()[_0xa28d('0x22')](respondWithResult(_0x15115e,null))['catch'](handleError(_0x15115e,null));};exports[_0xa28d('0x66')]=function(_0x3063e,_0x2e9a79,_0x53857d){if(_0x3063e['body']['id']){delete _0x3063e[_0xa28d('0x64')]['id'];}return db[_0xa28d('0x41')][_0xa28d('0x5c')]({'where':{'id':_0x3063e[_0xa28d('0x58')]['id']}})[_0xa28d('0x22')](handleEntityNotFound(_0x2e9a79,null))[_0xa28d('0x22')](function(_0x328d9a){if(_0x328d9a){_0x3063e[_0xa28d('0x64')][_0xa28d('0x67')]=_0x328d9a['id'];return db[_0xa28d('0x68')][_0xa28d('0x5d')](_0x3063e[_0xa28d('0x64')]);}})['then'](respondWithResult(_0x2e9a79,null))['catch'](handleError(_0x2e9a79,null));};exports['getDispositions']=function(_0x52ef0e,_0x35cb30,_0x206f6f){var _0x3c6067={'raw':![],'where':{}};var _0x59c749={};var _0x17bf8b={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x52ef0e[_0xa28d('0x58')]['id']}})['then'](handleEntityNotFound(_0x35cb30,null))[_0xa28d('0x22')](function(_0x3b976f){if(_0x3b976f){_0x59c749[_0xa28d('0x45')]=_['keys'](db[_0xa28d('0x68')][_0xa28d('0x42')]);_0x59c749[_0xa28d('0x46')]=_['keys'](_0x52ef0e[_0xa28d('0x46')]);_0x59c749[_0xa28d('0x47')]=_[_0xa28d('0x48')](_0x59c749[_0xa28d('0x45')],_0x59c749[_0xa28d('0x46')]);_0x3c6067[_0xa28d('0x4a')]=_['intersection'](_0x59c749['model'],qs[_0xa28d('0x49')](_0x52ef0e[_0xa28d('0x46')]['fields']));_0x3c6067[_0xa28d('0x4a')]=_0x3c6067[_0xa28d('0x4a')][_0xa28d('0x5a')]?_0x3c6067[_0xa28d('0x4a')]:_0x59c749['model'];if(!_0x52ef0e['query'][_0xa28d('0x4b')](_0xa28d('0x4c'))){_0x3c6067['limit']=qs['limit'](_0x52ef0e[_0xa28d('0x46')]['limit']);_0x3c6067['offset']=qs[_0xa28d('0x33')](_0x52ef0e[_0xa28d('0x46')][_0xa28d('0x33')]);}_0x3c6067[_0xa28d('0x69')]=qs[_0xa28d('0x4d')](_0x52ef0e[_0xa28d('0x46')]['sort']);_0x3c6067[_0xa28d('0x50')]=qs[_0xa28d('0x47')](_[_0xa28d('0x4e')](_0x52ef0e[_0xa28d('0x46')],_0x59c749[_0xa28d('0x47')]));_0x3c6067[_0xa28d('0x50')][_0xa28d('0x67')]=_0x3b976f['id'];if(_0x52ef0e[_0xa28d('0x46')][_0xa28d('0x4f')]){_0x3c6067['where']=_[_0xa28d('0x51')](_0x3c6067[_0xa28d('0x50')],{'$or':_[_0xa28d('0x40')](_0x3c6067[_0xa28d('0x4a')],function(_0x102a8e){var _0x1107f3={};_0x1107f3[_0x102a8e]={'$like':'%'+_0x52ef0e[_0xa28d('0x46')][_0xa28d('0x4f')]+'%'};return _0x1107f3;})});}_0x3c6067=_[_0xa28d('0x51')]({},_0x3c6067,_0x52ef0e[_0xa28d('0x5b')]);return db[_0xa28d('0x68')][_0xa28d('0x32')]({'where':_0x3c6067[_0xa28d('0x50')]})['then'](function(_0x4b3e78){_0x17bf8b['count']=_0x4b3e78;if(_0x52ef0e[_0xa28d('0x46')][_0xa28d('0x53')]){_0x3c6067['include']=[{'all':!![]}];}return db[_0xa28d('0x68')][_0xa28d('0x55')](_0x3c6067);})[_0xa28d('0x22')](function(_0x564b35){_0x17bf8b['rows']=_0x564b35;return _0x17bf8b;});}})[_0xa28d('0x22')](respondWithFilteredResult(_0x35cb30,_0x3c6067))['catch'](handleError(_0x35cb30,null));};exports['removeDispositions']=function(_0x53b139,_0x6e4b94,_0x2e2b22){return db[_0xa28d('0x41')][_0xa28d('0x5c')]({'where':{'id':_0x53b139[_0xa28d('0x58')]['id']}})[_0xa28d('0x22')](handleEntityNotFound(_0x6e4b94,null))[_0xa28d('0x22')](function(_0x28892b){if(_0x28892b){return _0x28892b[_0xa28d('0x6a')](_0x53b139[_0xa28d('0x46')]['ids']);}})[_0xa28d('0x22')](respondWithStatusCode(_0x6e4b94,null))['catch'](handleError(_0x6e4b94,null));};exports['addAnswer']=function(_0x3b2178,_0x119228,_0x3cc7c5){if(_0x3b2178[_0xa28d('0x64')]['id']){delete _0x3b2178[_0xa28d('0x64')]['id'];}return db[_0xa28d('0x41')]['find']({'where':{'id':_0x3b2178[_0xa28d('0x58')]['id']}})['then'](handleEntityNotFound(_0x119228,null))[_0xa28d('0x22')](function(_0x44adbf){if(_0x44adbf){_0x3b2178[_0xa28d('0x64')][_0xa28d('0x67')]=_0x44adbf['id'];return db[_0xa28d('0x6b')][_0xa28d('0x5d')](_0x3b2178['body']);}})['then'](respondWithResult(_0x119228,null))['catch'](handleError(_0x119228,null));};exports[_0xa28d('0x6c')]=function(_0x2341d3,_0x5e3578,_0x372380){var _0x246f46={'raw':![],'where':{}};var _0xf05875={};var _0x22e22f={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x2341d3[_0xa28d('0x58')]['id']}})[_0xa28d('0x22')](handleEntityNotFound(_0x5e3578,null))[_0xa28d('0x22')](function(_0x484913){if(_0x484913){_0xf05875['model']=_[_0xa28d('0x59')](db['CannedAnswer'][_0xa28d('0x42')]);_0xf05875[_0xa28d('0x46')]=_[_0xa28d('0x59')](_0x2341d3['query']);_0xf05875[_0xa28d('0x47')]=_[_0xa28d('0x48')](_0xf05875['model'],_0xf05875['query']);_0x246f46['attributes']=_['intersection'](_0xf05875[_0xa28d('0x45')],qs[_0xa28d('0x49')](_0x2341d3['query'][_0xa28d('0x49')]));_0x246f46['attributes']=_0x246f46[_0xa28d('0x4a')]['length']?_0x246f46[_0xa28d('0x4a')]:_0xf05875[_0xa28d('0x45')];if(!_0x2341d3[_0xa28d('0x46')]['hasOwnProperty'](_0xa28d('0x4c'))){_0x246f46[_0xa28d('0x31')]=qs['limit'](_0x2341d3[_0xa28d('0x46')][_0xa28d('0x31')]);_0x246f46[_0xa28d('0x33')]=qs['offset'](_0x2341d3[_0xa28d('0x46')][_0xa28d('0x33')]);}_0x246f46['order']=qs[_0xa28d('0x4d')](_0x2341d3[_0xa28d('0x46')][_0xa28d('0x4d')]);_0x246f46[_0xa28d('0x50')]=qs[_0xa28d('0x47')](_[_0xa28d('0x4e')](_0x2341d3[_0xa28d('0x46')],_0xf05875[_0xa28d('0x47')]));_0x246f46[_0xa28d('0x50')]['FaxAccountId']=_0x484913['id'];if(_0x2341d3[_0xa28d('0x46')][_0xa28d('0x4f')]){_0x246f46[_0xa28d('0x50')]=_[_0xa28d('0x51')](_0x246f46[_0xa28d('0x50')],{'$or':_[_0xa28d('0x40')](_0x246f46[_0xa28d('0x4a')],function(_0x28a542){var _0x55318c={};_0x55318c[_0x28a542]={'$like':'%'+_0x2341d3[_0xa28d('0x46')]['filter']+'%'};return _0x55318c;})});}_0x246f46=_[_0xa28d('0x51')]({},_0x246f46,_0x2341d3[_0xa28d('0x5b')]);return db[_0xa28d('0x6b')][_0xa28d('0x32')]({'where':_0x246f46[_0xa28d('0x50')]})[_0xa28d('0x22')](function(_0x283dd3){_0x22e22f[_0xa28d('0x32')]=_0x283dd3;if(_0x2341d3[_0xa28d('0x46')][_0xa28d('0x53')]){_0x246f46[_0xa28d('0x54')]=[{'all':!![]}];}return db[_0xa28d('0x6b')][_0xa28d('0x55')](_0x246f46);})[_0xa28d('0x22')](function(_0x46ec61){_0x22e22f[_0xa28d('0x56')]=_0x46ec61;return _0x22e22f;});}})[_0xa28d('0x22')](respondWithFilteredResult(_0x5e3578,_0x246f46))[_0xa28d('0x2b')](handleError(_0x5e3578,null));};exports[_0xa28d('0x6d')]=function(_0x3b0626,_0x10edfa,_0x486c68){return db[_0xa28d('0x41')][_0xa28d('0x5c')]({'where':{'id':_0x3b0626[_0xa28d('0x58')]['id']}})[_0xa28d('0x22')](handleEntityNotFound(_0x10edfa,null))['then'](function(_0x51f5d9){if(_0x51f5d9){return _0x51f5d9[_0xa28d('0x6d')](_0x3b0626[_0xa28d('0x46')][_0xa28d('0x6e')]);}})[_0xa28d('0x22')](respondWithStatusCode(_0x10edfa,null))[_0xa28d('0x2b')](handleError(_0x10edfa,null));};exports['addInteraction']=function(_0x1c254a,_0x25fd16,_0x342a90){return db[_0xa28d('0x6f')][_0xa28d('0x5c')]({'where':{'id':_0x1c254a['params']['id']}})[_0xa28d('0x22')](handleEntityNotFound(_0x25fd16,null))[_0xa28d('0x22')](function(_0x59c59c){if(_0x59c59c){return _0x59c59c[_0xa28d('0x70')](_0x1c254a[_0xa28d('0x64')][_0xa28d('0x6e')],_[_0xa28d('0x71')](_0x1c254a[_0xa28d('0x64')],[_0xa28d('0x6e'),'id'])||{});}})[_0xa28d('0x22')](respondWithResult(_0x25fd16,null))[_0xa28d('0x2b')](handleError(_0x25fd16,null));};exports[_0xa28d('0x72')]=function(_0x54d372,_0xe873cf,_0x366b65){var _0x248875={'raw':![],'where':{}};var _0x25fa36={};var _0x560ed1={'count':0x0,'rows':[]};return db[_0xa28d('0x41')][_0xa28d('0x73')]({'where':{'id':_0x54d372[_0xa28d('0x58')]['id']}})['then'](handleEntityNotFound(_0xe873cf,null))[_0xa28d('0x22')](function(_0x42c560){if(_0x42c560){_0x25fa36[_0xa28d('0x45')]=_[_0xa28d('0x59')](db[_0xa28d('0x6f')][_0xa28d('0x42')]);_0x25fa36[_0xa28d('0x46')]=_[_0xa28d('0x59')](_0x54d372[_0xa28d('0x46')]);_0x25fa36[_0xa28d('0x47')]=_[_0xa28d('0x48')](_0x25fa36['model'],_0x25fa36[_0xa28d('0x46')]);_0x248875[_0xa28d('0x4a')]=_[_0xa28d('0x48')](_0x25fa36['model'],qs[_0xa28d('0x49')](_0x54d372['query'][_0xa28d('0x49')]));_0x248875['attributes']=_0x248875[_0xa28d('0x4a')][_0xa28d('0x5a')]?_0x248875[_0xa28d('0x4a')]:_0x25fa36[_0xa28d('0x45')];if(!_0x54d372[_0xa28d('0x46')]['hasOwnProperty'](_0xa28d('0x4c'))){_0x248875[_0xa28d('0x31')]=qs[_0xa28d('0x31')](_0x54d372[_0xa28d('0x46')]['limit']);_0x248875['offset']=qs[_0xa28d('0x33')](_0x54d372['query']['offset']);}_0x248875[_0xa28d('0x69')]=qs[_0xa28d('0x4d')](_0x54d372[_0xa28d('0x46')][_0xa28d('0x4d')]);_0x248875[_0xa28d('0x50')]=qs[_0xa28d('0x47')](_['pick'](_0x54d372[_0xa28d('0x46')],_0x25fa36[_0xa28d('0x47')]));_0x248875[_0xa28d('0x50')][_0xa28d('0x67')]=_0x42c560['id'];if(_0x54d372['query'][_0xa28d('0x4f')]){_0x248875[_0xa28d('0x50')]=_[_0xa28d('0x51')](_0x248875[_0xa28d('0x50')],{'$or':_[_0xa28d('0x40')](_0x248875[_0xa28d('0x4a')],function(_0x2b4afa){var _0x35bac3={};_0x35bac3[_0x2b4afa]={'$like':'%'+_0x54d372['query'][_0xa28d('0x4f')]+'%'};return _0x35bac3;})});}_0x248875=_['merge']({},_0x248875,_0x54d372[_0xa28d('0x5b')]);return db['FaxInteraction'][_0xa28d('0x32')]({'where':_0x248875[_0xa28d('0x50')]})[_0xa28d('0x22')](function(_0x1d4ccc){_0x560ed1[_0xa28d('0x32')]=_0x1d4ccc;if(_0x54d372[_0xa28d('0x46')][_0xa28d('0x53')]){_0x248875[_0xa28d('0x54')]=[{'model':db[_0xa28d('0x74')],'as':_0xa28d('0x75'),'required':![]},{'model':db[_0xa28d('0x76')],'as':_0xa28d('0x77'),'attributes':[_0xa28d('0x3c'),_0xa28d('0x78'),'internal'],'required':![]},{'model':db[_0xa28d('0x79')],'as':_0xa28d('0x7a'),'attributes':['id','name','color'],'where':_0x54d372[_0xa28d('0x46')]['tag']?{'id':_0x54d372[_0xa28d('0x46')][_0xa28d('0x7b')]}:undefined,'required':_0x54d372[_0xa28d('0x46')][_0xa28d('0x7b')]?!![]:![]}];}return db[_0xa28d('0x6f')]['findAll'](_0x248875);})['then'](function(_0x1c5a84){_0x560ed1[_0xa28d('0x56')]=_0x1c5a84;return _0x560ed1;});}})[_0xa28d('0x22')](respondWithFilteredResult(_0xe873cf,_0x248875))[_0xa28d('0x2b')](handleError(_0xe873cf,null));};exports[_0xa28d('0x7c')]=function(_0x4febd2,_0x1320c2,_0x3ab17d){return db[_0xa28d('0x41')][_0xa28d('0x73')]({'where':{'id':_0x4febd2[_0xa28d('0x58')]['id']}})[_0xa28d('0x22')](handleEntityNotFound(_0x1320c2,null))[_0xa28d('0x22')](function(_0x4dd3ed){if(_0x4dd3ed){return db[_0xa28d('0x7d')]['transaction'](function(_0x4fc7b9){return db[_0xa28d('0x7e')][_0xa28d('0x3a')]({'where':{'FaxAccountId':_0x4febd2['params']['id']},'transaction':_0x4fc7b9})['then'](function(_0x10c40a){var _0x43a5e8=_[_0xa28d('0x40')](_0x4febd2[_0xa28d('0x64')],function(_0x4ad03a){_0x4ad03a[_0xa28d('0x67')]=_0x4febd2[_0xa28d('0x58')]['id'];return _0x4ad03a;});return db[_0xa28d('0x7e')][_0xa28d('0x7f')](_0x43a5e8,{'transaction':_0x4fc7b9});});})[_0xa28d('0x22')](function(){return db[_0xa28d('0x7e')][_0xa28d('0x80')]({'where':{'FaxAccountId':_0x4febd2[_0xa28d('0x58')]['id']},'order':_0xa28d('0x81')});});}})[_0xa28d('0x22')](respondWithResult(_0x1320c2,null))[_0xa28d('0x2b')](handleError(_0x1320c2,null));};exports[_0xa28d('0x82')]=function(_0xe3c622,_0x5e10d4,_0x234063){var _0x5410eb={};var _0x483d10={};var _0x4be205;var _0x4932de;return db[_0xa28d('0x41')][_0xa28d('0x73')]({'where':{'id':_0xe3c622['params']['id']}})[_0xa28d('0x22')](handleEntityNotFound(_0x5e10d4,null))[_0xa28d('0x22')](function(_0x15c549){if(_0x15c549){_0x4be205=_0x15c549;_0x483d10[_0xa28d('0x45')]=_[_0xa28d('0x59')](db[_0xa28d('0x7e')][_0xa28d('0x42')]);_0x483d10[_0xa28d('0x46')]=_[_0xa28d('0x59')](_0xe3c622[_0xa28d('0x46')]);_0x483d10['filters']=_[_0xa28d('0x48')](_0x483d10['model'],_0x483d10[_0xa28d('0x46')]);_0x5410eb[_0xa28d('0x4a')]=_[_0xa28d('0x48')](_0x483d10['model'],qs['fields'](_0xe3c622[_0xa28d('0x46')]['fields']));_0x5410eb[_0xa28d('0x4a')]=_0x5410eb['attributes'][_0xa28d('0x5a')]?_0x5410eb['attributes']:_0x483d10[_0xa28d('0x45')];_0x5410eb[_0xa28d('0x69')]=qs['sort'](_0xe3c622[_0xa28d('0x46')]['sort']);_0x5410eb[_0xa28d('0x50')]=qs[_0xa28d('0x47')](_[_0xa28d('0x4e')](_0xe3c622[_0xa28d('0x46')],_0x483d10[_0xa28d('0x47')]));if(_0xe3c622[_0xa28d('0x46')][_0xa28d('0x4f')]){_0x5410eb[_0xa28d('0x50')]=_[_0xa28d('0x51')](_0x5410eb[_0xa28d('0x50')],{'$or':_[_0xa28d('0x40')](_0x5410eb['attributes'],function(_0xa1051d){var _0x2fa92f={};_0x2fa92f[_0xa1051d]={'$like':'%'+_0xe3c622[_0xa28d('0x46')]['filter']+'%'};return _0x2fa92f;})});}_0x5410eb=_[_0xa28d('0x51')]({},_0x5410eb,_0xe3c622['options']);return _0x4be205[_0xa28d('0x82')](_0x5410eb);}})[_0xa28d('0x22')](function(_0x57ce18){if(_0x57ce18){_0x4932de=_0x57ce18[_0xa28d('0x5a')];if(!_0xe3c622['query'][_0xa28d('0x4b')](_0xa28d('0x4c'))){_0x5410eb[_0xa28d('0x31')]=qs[_0xa28d('0x31')](_0xe3c622[_0xa28d('0x46')]['limit']);_0x5410eb[_0xa28d('0x33')]=qs[_0xa28d('0x33')](_0xe3c622[_0xa28d('0x46')][_0xa28d('0x33')]);}return _0x4be205['getApplications'](_0x5410eb);}})[_0xa28d('0x22')](function(_0x1817b7){if(_0x1817b7){return _0x1817b7?{'count':_0x4932de,'rows':_0x1817b7}:null;}})[_0xa28d('0x22')](respondWithResult(_0x5e10d4,null))['catch'](handleError(_0x5e10d4,null));};function Extension(_0x499cbf,_0x4c97ce,_0x50f7f7,_0x19022a){this['context']=_0xa28d('0x83');this[_0xa28d('0x84')]=_0x499cbf[_0xa28d('0x85')];this[_0xa28d('0x86')]=_0x19022a;this[_0xa28d('0x44')]=_0xa28d('0x87');this['description']=_0xa28d('0x88');this[_0xa28d('0x67')]=_0x499cbf['id'];this[_0xa28d('0x81')]=_0x4c97ce;this[_0xa28d('0x89')]=_0x50f7f7;}function createExtensionsReciveFax(_0x94f05f){var _0x48541b=0x1;var _0xd4194d=[];_0xd4194d[_0xa28d('0x8a')](new Extension(_0x94f05f,_0x48541b,'',_0xa28d('0x8b')));_0x48541b+=0x1;_0xd4194d[_0xa28d('0x8a')](new Extension(_0x94f05f,_0x48541b,_0xa28d('0x8c'),_0xa28d('0x8d')));_0x48541b+=0x1;for(var _0x25ddac in _0x94f05f){if(_0x94f05f[_0xa28d('0x4b')](_0x25ddac)&&(_0x25ddac===_0xa28d('0x8e')||_0x25ddac===_0xa28d('0x85')||_0x25ddac==='gateway'||_0x25ddac===_0xa28d('0x8f')||_0x25ddac==='headerinfo'||_0x25ddac==='maxrate'||_0x25ddac===_0xa28d('0x90')||_0x25ddac===_0xa28d('0x91')||_0x25ddac===_0xa28d('0x92'))){_0xd4194d[_0xa28d('0x8a')](new Extension(_0x94f05f,_0x48541b,_0xa28d('0x93')+_0x25ddac+')='+_0x94f05f[_0x25ddac],_0xa28d('0x8d')));_0x48541b+=0x1;}}_0xd4194d['push'](new Extension(_0x94f05f,_0x48541b,'6',_0xa28d('0x94')));_0x48541b+=0x1;_0xd4194d[_0xa28d('0x8a')](new Extension(_0x94f05f,_0x48541b,'/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',_0xa28d('0x95')));_0x48541b=0x0;return _0xd4194d;}exports['addAccountApplications']=function(_0x592814,_0x2fee49,_0x1e3568){var _0x541d11;return db[_0xa28d('0x7d')][_0xa28d('0x96')](function(_0x35f5bf){return db[_0xa28d('0x41')][_0xa28d('0x5d')](_0x592814[_0xa28d('0x64')],{'transaction':_0x35f5bf})[_0xa28d('0x22')](function(_0xaf258){_0x541d11=_0xaf258['get']({'plain':!![]});return db[_0xa28d('0x97')][_0xa28d('0x7f')](createExtensionsReciveFax(_0x541d11),{'transaction':_0x35f5bf});});})[_0xa28d('0x22')](function(){return _0x541d11;})[_0xa28d('0x22')](respondWithResult(_0x2fee49,null))[_0xa28d('0x2b')](handleError(_0x2fee49,null));};exports['updateAccountApplications']=function(_0x4e9b54,_0x133660,_0x55f363){var _0x34dfd7;return db[_0xa28d('0x7d')]['transaction'](function(_0x332d5b){return db[_0xa28d('0x41')][_0xa28d('0x36')](_0x4e9b54[_0xa28d('0x64')],{'where':{'id':_0x4e9b54['body']['id']},'transaction':_0x332d5b})[_0xa28d('0x22')](function(_0x183501){return db[_0xa28d('0x97')][_0xa28d('0x3a')]({'where':{'FaxAccountId':_0x4e9b54[_0xa28d('0x64')]['id']},'transaction':_0x332d5b})[_0xa28d('0x22')](function(_0x3e39f6){return db[_0xa28d('0x97')][_0xa28d('0x7f')](createExtensionsReciveFax(_[_0xa28d('0x71')](_0x4e9b54[_0xa28d('0x64')],['tech',_0xa28d('0x98'),_0xa28d('0x99'),_0xa28d('0x9a'),_0xa28d('0x9b'),_0xa28d('0x9c')])),{'transaction':_0x332d5b});});});})[_0xa28d('0x22')](function(){return db['FaxAccount'][_0xa28d('0x9d')](_0x4e9b54['body']['id']);})[_0xa28d('0x22')](respondWithResult(_0x133660,null))[_0xa28d('0x2b')](handleError(_0x133660,null));};exports['getMessages']=function(_0x3856e9,_0x5de6fc,_0x5b8222){var _0x46b94d={'raw':!![],'where':{}};var _0x40f421={};var _0x23ae55={'count':0x0,'rows':[]};return db[_0xa28d('0x41')][_0xa28d('0x73')]({'where':{'id':_0x3856e9['params']['id']}})[_0xa28d('0x22')](handleEntityNotFound(_0x5de6fc,null))[_0xa28d('0x22')](function(_0x51cfe5){if(_0x51cfe5){_0x40f421['model']=_[_0xa28d('0x59')](db['FaxMessage'][_0xa28d('0x42')]);_0x40f421[_0xa28d('0x46')]=_[_0xa28d('0x59')](_0x3856e9[_0xa28d('0x46')]);_0x40f421[_0xa28d('0x47')]=_[_0xa28d('0x48')](_0x40f421[_0xa28d('0x45')],_0x40f421[_0xa28d('0x46')]);_0x46b94d[_0xa28d('0x4a')]=_[_0xa28d('0x48')](_0x40f421[_0xa28d('0x45')],qs['fields'](_0x3856e9[_0xa28d('0x46')]['fields']));_0x46b94d[_0xa28d('0x4a')]=_0x46b94d[_0xa28d('0x4a')][_0xa28d('0x5a')]?_0x46b94d[_0xa28d('0x4a')]:_0x40f421[_0xa28d('0x45')];if(!_0x3856e9[_0xa28d('0x46')][_0xa28d('0x4b')](_0xa28d('0x4c'))){_0x46b94d[_0xa28d('0x31')]=qs['limit'](_0x3856e9[_0xa28d('0x46')][_0xa28d('0x31')]);_0x46b94d[_0xa28d('0x33')]=qs['offset'](_0x3856e9['query'][_0xa28d('0x33')]);}_0x46b94d['order']=qs[_0xa28d('0x4d')](_0x3856e9['query'][_0xa28d('0x4d')]);_0x46b94d[_0xa28d('0x50')]=qs[_0xa28d('0x47')](_['pick'](_0x3856e9[_0xa28d('0x46')],_0x40f421[_0xa28d('0x47')]));_0x46b94d[_0xa28d('0x50')][_0xa28d('0x67')]=_0x51cfe5['id'];if(_0x3856e9[_0xa28d('0x46')][_0xa28d('0x4f')]){_0x46b94d[_0xa28d('0x50')]=_[_0xa28d('0x51')](_0x46b94d[_0xa28d('0x50')],{'$or':_[_0xa28d('0x40')](_0x46b94d['attributes'],function(_0x31a508){var _0x480ed6={};_0x480ed6[_0x31a508]={'$like':'%'+_0x3856e9[_0xa28d('0x46')][_0xa28d('0x4f')]+'%'};return _0x480ed6;})});}if(_0x3856e9[_0xa28d('0x46')][_0xa28d('0x9e')]){var _0x13ac64=_0x3856e9[_0xa28d('0x46')][_0xa28d('0x9e')][_0xa28d('0x9f')](',');var _0x1a0fcc={};_0x1a0fcc[_0x13ac64[0x0]]={'$gte':moment(_0x13ac64[0x1])[_0xa28d('0xa0')](_0xa28d('0xa1'))};_0x46b94d[_0xa28d('0x50')]=_[_0xa28d('0x51')](_0x46b94d[_0xa28d('0x50')],_0x1a0fcc);}_0x46b94d=_['merge']({},_0x46b94d,_0x3856e9[_0xa28d('0x5b')]);return db[_0xa28d('0xa2')][_0xa28d('0x32')]({'where':_0x46b94d[_0xa28d('0x50')]})['then'](function(_0x5eaecf){_0x23ae55[_0xa28d('0x32')]=_0x5eaecf;if(_0x3856e9[_0xa28d('0x46')][_0xa28d('0x53')]){_0x46b94d['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x46b94d);})[_0xa28d('0x22')](function(_0x2d63ba){_0x23ae55['rows']=_0x2d63ba;return _0x23ae55;});}})[_0xa28d('0x22')](respondWithFilteredResult(_0x5de6fc,_0x46b94d))[_0xa28d('0x2b')](handleError(_0x5de6fc,null));};exports[_0xa28d('0x3d')]=function(_0x20403f,_0x15504b,_0x106eb7){var _0x1ce786,_0x751a3d={},_0x4d5fad;if(_0x20403f[_0xa28d('0x64')]['to']){_0x4d5fad=_0x20403f[_0xa28d('0x64')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x20403f['params']['id']},'include':[{'model':db['CmList'],'as':_0xa28d('0xa3'),'include':[{'model':db[_0xa28d('0x74')],'as':_0xa28d('0xa4'),'where':{'fax':_0x4d5fad},'limit':0x1,'order':[[_0xa28d('0x9a'),_0xa28d('0xa5')]]}]}]})[_0xa28d('0x22')](handleEntityNotFound(_0x15504b,null))[_0xa28d('0x22')](function(_0x47d54d){_0x1ce786=_0x47d54d;if(_0x20403f[_0xa28d('0x64')][_0xa28d('0xa6')]&&_0x20403f[_0xa28d('0x64')][_0xa28d('0xa6')]['length']){for(var _0x5e3199=0x0;_0x5e3199<_0x20403f[_0xa28d('0x64')]['attachments'][_0xa28d('0x5a')];_0x5e3199+=0x1){_0x20403f[_0xa28d('0x64')][_0xa28d('0xa6')][_0x5e3199]={'filename':_0x20403f[_0xa28d('0x64')][_0xa28d('0xa6')][_0x5e3199][_0xa28d('0x3c')],'id':_0x20403f[_0xa28d('0x64')][_0xa28d('0xa6')][_0x5e3199]['id'],'path':path[_0xa28d('0xa7')](config[_0xa28d('0xa8')],_0xa28d('0xa9'),_0x20403f[_0xa28d('0x64')][_0xa28d('0xa6')][_0x5e3199][_0xa28d('0xaa')])};}}return respondWithRpcPromise('CheckAfterSend',_0xa28d('0xab'),{'FaxAccountId':_[_0xa28d('0xac')](_0x20403f[_0xa28d('0x58')]['id'])?undefined:_0x20403f[_0xa28d('0x58')]['id'],'path':_[_0xa28d('0xac')](_0x20403f[_0xa28d('0x64')]['attachments'][0x0][_0xa28d('0xad')])?undefined:_0x20403f['body'][_0xa28d('0xa6')][0x0][_0xa28d('0xad')],'fax':_[_0xa28d('0xac')](_0x20403f[_0xa28d('0x64')]['to'][0x0])?undefined:_0x20403f[_0xa28d('0x64')]['to'][0x0]},client9002);})[_0xa28d('0x22')](function(){if(_0x1ce786){if(_[_0xa28d('0xac')](_0x20403f['body'][_0xa28d('0xae')])){_0x20403f[_0xa28d('0x64')][_0xa28d('0xae')]=util['format'](_0xa28d('0xaf'),_0x1ce786[_0xa28d('0x3c')],_0x1ce786['fax']);}if(_0x1ce786[_0xa28d('0xa3')]){if(_0x1ce786['List'][_0xa28d('0xa4')]['length']){return _0x1ce786[_0xa28d('0xa3')][_0xa28d('0xa4')][0x0];}else{return db[_0xa28d('0x74')][_0xa28d('0x5d')](_[_0xa28d('0xb0')](_0x20403f['body'],{'firstName':_0x20403f[_0xa28d('0x64')]['to'][0x0],'phone':_0x20403f[_0xa28d('0x64')]['to'][0x0],'fax':_0x20403f['body']['to'][0x0],'ListId':_0x1ce786['ListId']}));}}else{throw new Error(_0xa28d('0xb1'));}}else{throw new Error(_0xa28d('0xb2'));}})[_0xa28d('0x22')](function(_0x55daa5){if(_0x55daa5){return db[_0xa28d('0x6f')][_0xa28d('0x5c')]({'where':{'ContactId':_0x55daa5['id'],'closed':![],'FaxAccountId':_0x1ce786['id']}})[_0xa28d('0x22')](function(_0x22e592){if(_0x22e592){return[_0x22e592,![]];}return db['FaxInteraction'][_0xa28d('0x5d')]({'UserId':_0x20403f['user']['id'],'ContactId':_0x55daa5['id'],'FaxAccountId':_0x1ce786['id'],'fax':_0x20403f[_0xa28d('0x64')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xa28d('0x51')](_0x20403f[_0xa28d('0x64')],{'read':![],'body':_0x20403f['body']['attachments'][0x0][_0xa28d('0xb3')],'FaxAccountId':_0x1ce786['id'],'UserId':_0x20403f[_0xa28d('0x5e')]['id'],'ContactId':_0x55daa5['id'],'AttachmentId':_0x20403f[_0xa28d('0x64')][_0xa28d('0xa6')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})['then'](function(_0x365c3e){return[_0x365c3e,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xa28d('0xb4')](function(_0x2d16e2,_0x59255f){if(_0x59255f){return _0x2d16e2;}return db[_0xa28d('0xa2')]['create']({'direction':_0xa28d('0xb5'),'read':![],'body':_0x20403f[_0xa28d('0x64')][_0xa28d('0xa6')][0x0][_0xa28d('0xb3')],'FaxAccountId':_0x1ce786['id'],'FaxInteractionId':_0x2d16e2['id'],'UserId':_0x20403f[_0xa28d('0x5e')]['id'],'ContactId':_0x2d16e2[_0xa28d('0xb6')],'AttachmentId':_0x20403f[_0xa28d('0x64')][_0xa28d('0xa6')][0x0]['id']})['then'](function(_0x394eb8){_0x2d16e2[_0xa28d('0xb7')]['Messages']=[];_0x2d16e2[_0xa28d('0xb7')]['Messages'][_0xa28d('0x8a')](_0x394eb8[_0xa28d('0xb7')]);return _0x2d16e2;});})[_0xa28d('0x22')](function(_0x9df176){respondWithRpcPromise(_0xa28d('0xb8'),_0xa28d('0xb8'),{'FaxAccountId':_['isNil'](_0x20403f['params']['id'])?undefined:_0x20403f[_0xa28d('0x58')]['id'],'path':_[_0xa28d('0xac')](_0x20403f[_0xa28d('0x64')][_0xa28d('0xa6')][0x0][_0xa28d('0xad')])?undefined:_0x20403f[_0xa28d('0x64')][_0xa28d('0xa6')][0x0][_0xa28d('0xad')],'fax':_[_0xa28d('0xac')](_0x20403f[_0xa28d('0x64')]['to'][0x0])?undefined:_0x20403f[_0xa28d('0x64')]['to'][0x0],'AttachmentId':_0x20403f['body'][_0xa28d('0xa6')][0x0]['id']},client9002)['then'](function(_0x3d515a){logger[_0xa28d('0x23')]('SendFaxRpc,\x20%s',_0x3d515a);})[_0xa28d('0x2b')](function(_0x1ae3e4){logger['info'](_0xa28d('0xb9'),_0x1ae3e4);});return _0x9df176;})[_0xa28d('0x22')](respondWithResult(_0x15504b,null))['catch'](handleError(_0x15504b,null));};exports['addAgents']=function(_0x497a65,_0x16e7b2,_0x479d12){return db[_0xa28d('0x41')][_0xa28d('0x5c')]({'where':{'id':_0x497a65[_0xa28d('0x58')]['id']}})['then'](handleEntityNotFound(_0x16e7b2,null))['then'](function(_0x2be539){if(_0x2be539){return _0x2be539[_0xa28d('0xba')](_0x497a65[_0xa28d('0x64')][_0xa28d('0x6e')],_[_0xa28d('0x71')](_0x497a65[_0xa28d('0x64')],[_0xa28d('0x6e'),'id'])||{})['spread'](function(_0x289df0){for(var _0x1c3c87=0x0;_0x1c3c87<_0x497a65[_0xa28d('0x64')][_0xa28d('0x6e')][_0xa28d('0x5a')];_0x1c3c87+=0x1){socket[_0xa28d('0xbb')](_0xa28d('0xbc'),{'UserId':Number(_0x497a65[_0xa28d('0x64')]['ids'][_0x1c3c87]),'FaxAccountId':Number(_0x497a65[_0xa28d('0x58')]['id'])});}return _0x289df0;});}})[_0xa28d('0x22')](respondWithResult(_0x16e7b2,null))[_0xa28d('0x2b')](handleError(_0x16e7b2,null));};exports[_0xa28d('0xbd')]=function(_0x2f7b1b,_0x212cad,_0x578aac){return db[_0xa28d('0x41')][_0xa28d('0x5c')]({'where':{'id':_0x2f7b1b[_0xa28d('0x58')]['id']}})[_0xa28d('0x22')](handleEntityNotFound(_0x212cad,null))['then'](function(_0x4a1824){if(_0x4a1824){return _0x4a1824[_0xa28d('0xbd')](_0x2f7b1b[_0xa28d('0x46')]['ids'])['then'](function(){if(_[_0xa28d('0xbe')](_0x2f7b1b[_0xa28d('0x46')][_0xa28d('0x6e')])){for(var _0x4acee8=0x0;_0x4acee8<_0x2f7b1b['query']['ids']['length'];_0x4acee8+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x2f7b1b[_0xa28d('0x46')]['ids'][_0x4acee8]),'FaxAccountId':Number(_0x2f7b1b['params']['id'])});}}else{socket[_0xa28d('0xbb')](_0xa28d('0xbf'),{'UserId':Number(_0x2f7b1b['query'][_0xa28d('0x6e')]),'FaxAccountId':Number(_0x2f7b1b[_0xa28d('0x58')]['id'])});}});}})[_0xa28d('0x22')](respondWithStatusCode(_0x212cad,null))['catch'](handleError(_0x212cad,null));};exports[_0xa28d('0xc0')]=function(_0x10f24b,_0x5b9085,_0x18249d){var _0x179682={};var _0x41f104={};var _0x3519eb;var _0x1c4c31;return db[_0xa28d('0x41')][_0xa28d('0x73')]({'where':{'id':_0x10f24b[_0xa28d('0x58')]['id']}})[_0xa28d('0x22')](handleEntityNotFound(_0x5b9085,null))[_0xa28d('0x22')](function(_0x5b8afd){if(_0x5b8afd){_0x3519eb=_0x5b8afd;_0x41f104[_0xa28d('0x45')]=_[_0xa28d('0x59')](db['User'][_0xa28d('0x42')]);_0x41f104[_0xa28d('0x46')]=_[_0xa28d('0x59')](_0x10f24b[_0xa28d('0x46')]);_0x41f104[_0xa28d('0x47')]=_[_0xa28d('0x48')](_0x41f104['model'],_0x41f104['query']);_0x179682[_0xa28d('0x4a')]=_[_0xa28d('0x48')](_0x41f104[_0xa28d('0x45')],qs[_0xa28d('0x49')](_0x10f24b[_0xa28d('0x46')][_0xa28d('0x49')]));_0x179682[_0xa28d('0x4a')]=_0x179682[_0xa28d('0x4a')][_0xa28d('0x5a')]?_0x179682[_0xa28d('0x4a')]:_0x41f104[_0xa28d('0x45')];_0x179682[_0xa28d('0x69')]=qs[_0xa28d('0x4d')](_0x10f24b[_0xa28d('0x46')][_0xa28d('0x4d')]);_0x179682[_0xa28d('0x50')]=qs['filters'](_[_0xa28d('0x4e')](_0x10f24b[_0xa28d('0x46')],_0x41f104[_0xa28d('0x47')]));if(_0x10f24b['query'][_0xa28d('0x4f')]){_0x179682['where']=_['merge'](_0x179682[_0xa28d('0x50')],{'$or':_[_0xa28d('0x40')](_0x179682[_0xa28d('0x4a')],function(_0x1844a3){var _0x2aa383={};_0x2aa383[_0x1844a3]={'$like':'%'+_0x10f24b[_0xa28d('0x46')][_0xa28d('0x4f')]+'%'};return _0x2aa383;})});}_0x179682=_[_0xa28d('0x51')]({},_0x179682,_0x10f24b[_0xa28d('0x5b')]);return _0x3519eb['getAgents'](_0x179682);}})[_0xa28d('0x22')](function(_0x2a34b3){if(_0x2a34b3){_0x1c4c31=_0x2a34b3[_0xa28d('0x5a')];if(!_0x10f24b[_0xa28d('0x46')][_0xa28d('0x4b')](_0xa28d('0x4c'))){_0x179682[_0xa28d('0x31')]=qs[_0xa28d('0x31')](_0x10f24b[_0xa28d('0x46')]['limit']);_0x179682[_0xa28d('0x33')]=qs[_0xa28d('0x33')](_0x10f24b[_0xa28d('0x46')]['offset']);}return _0x3519eb[_0xa28d('0xc0')](_0x179682);}})[_0xa28d('0x22')](function(_0x1ff960){if(_0x1ff960){return _0x1ff960?{'count':_0x1c4c31,'rows':_0x1ff960}:null;}})['then'](respondWithResult(_0x5b9085,null))[_0xa28d('0x2b')](handleError(_0x5b9085,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index ad5b0e8..15dbc12 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 _0x9dbe=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x5d1800,_0x5ef97c){var _0x3f650e=function(_0x3f120e){while(--_0x3f120e){_0x5d1800['push'](_0x5d1800['shift']());}};_0x3f650e(++_0x5ef97c);}(_0x9dbe,0x150));var _0xe9db=function(_0x5a43ad,_0x36407d){_0x5a43ad=_0x5a43ad-0x0;var _0x1b72ee=_0x9dbe[_0x5a43ad];return _0x1b72ee;};'use strict';var EventEmitter=require(_0xe9db('0x0'));var FaxAccount=require(_0xe9db('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xe9db('0x2')](0x0);var events={'afterCreate':_0xe9db('0x3'),'afterUpdate':'update','afterDestroy':_0xe9db('0x4')};function emitEvent(_0x585e0d){return function(_0x19ec98,_0x23950e,_0x1d11a8){FaxAccountEvents[_0xe9db('0x5')](_0x585e0d+':'+_0x19ec98['id'],_0x19ec98);FaxAccountEvents[_0xe9db('0x5')](_0x585e0d,_0x19ec98);_0x1d11a8(null);};}for(var e in events){if(events[_0xe9db('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x0037=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x562980,_0x3fcbac){var _0x384f5f=function(_0x2fd5e9){while(--_0x2fd5e9){_0x562980['push'](_0x562980['shift']());}};_0x384f5f(++_0x3fcbac);}(_0x0037,0x127));var _0x7003=function(_0x11dea0,_0x3d2b94){_0x11dea0=_0x11dea0-0x0;var _0x32023c=_0x0037[_0x11dea0];return _0x32023c;};'use strict';var EventEmitter=require(_0x7003('0x0'));var FaxAccount=require(_0x7003('0x1'))['db'][_0x7003('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x7003('0x3')](0x0);var events={'afterCreate':_0x7003('0x4'),'afterUpdate':_0x7003('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5384a6){return function(_0x402081,_0x44f911,_0x35a820){FaxAccountEvents[_0x7003('0x6')](_0x5384a6+':'+_0x402081['id'],_0x402081);FaxAccountEvents[_0x7003('0x6')](_0x5384a6,_0x402081);_0x35a820(null);};}for(var e in events){if(events[_0x7003('0x7')](e)){var event=events[e];FaxAccount[_0x7003('0x8')](e,emitEvent(event));}}module[_0x7003('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index a261fb9..f17dea1 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 _0xa609=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts'];(function(_0x53892e,_0x2524ac){var _0x3bdf5e=function(_0x42f260){while(--_0x42f260){_0x53892e['push'](_0x53892e['shift']());}};_0x3bdf5e(++_0x2524ac);}(_0xa609,0x82));var _0x9a60=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa609[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9a60('0x0'));var util=require(_0x9a60('0x1'));var logger=require(_0x9a60('0x2'))(_0x9a60('0x3'));var moment=require(_0x9a60('0x4'));var BPromise=require(_0x9a60('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a60('0x6'));var rimraf=require(_0x9a60('0x7'));var config=require(_0x9a60('0x8'));var attributes=require(_0x9a60('0x9'));module[_0x9a60('0xa')]=function(_0x127953,_0x58fe7b){return _0x127953[_0x9a60('0xb')]('FaxAccount',attributes,{'tableName':_0x9a60('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7898=['exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./faxAccount.attributes'];(function(_0x5ccd44,_0x7c6701){var _0x761288=function(_0x3a841a){while(--_0x3a841a){_0x5ccd44['push'](_0x5ccd44['shift']());}};_0x761288(++_0x7c6701);}(_0x7898,0x178));var _0x8789=function(_0x16dd98,_0x11d346){_0x16dd98=_0x16dd98-0x0;var _0xfc7fb3=_0x7898[_0x16dd98];return _0xfc7fb3;};'use strict';var _=require(_0x8789('0x0'));var util=require(_0x8789('0x1'));var logger=require(_0x8789('0x2'))(_0x8789('0x3'));var moment=require(_0x8789('0x4'));var BPromise=require(_0x8789('0x5'));var rp=require(_0x8789('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8789('0x7'));module[_0x8789('0x8')]=function(_0x768dc4,_0x43a4dd){return _0x768dc4[_0x8789('0x9')](_0x8789('0xa'),attributes,{'tableName':_0x8789('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 3b17b24..8eafa0a 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 _0x93c5=['from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','FaxAccount','find','account','List','Contacts','Applications','get','list','orderBy','applications','priority','asc','length','CmContact','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','UserId','User','interaction','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','request\x20sent','debug','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','catch','GetFaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','NotifyFaxAccount','body','fax','ValidationError','createdAt','keys','updatedAt','CompanyId','ListId','from','Sequelize'];(function(_0x4ec8ef,_0x3fb840){var _0x5c66d1=function(_0x3568fd){while(--_0x3568fd){_0x4ec8ef['push'](_0x4ec8ef['shift']());}};_0x5c66d1(++_0x3fb840);}(_0x93c5,0x81));var _0x593c=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x93c5[_0x45783c];return _0x1161da;};'use strict';var _=require(_0x593c('0x0'));var util=require(_0x593c('0x1'));var moment=require(_0x593c('0x2'));var BPromise=require(_0x593c('0x3'));var rs=require(_0x593c('0x4'));var fs=require('fs');var Redis=require(_0x593c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x593c('0x6'));var logger=require('../../config/logger')(_0x593c('0x7'));var config=require(_0x593c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x593c('0x9')][_0x593c('0xa')]({'port':0x232c});config[_0x593c('0xb')]=_[_0x593c('0xc')](config['redis'],{'host':_0x593c('0xd'),'port':0x18eb});var socket=require(_0x593c('0xe'))(new Redis(config[_0x593c('0xb')]));require(_0x593c('0xf'))[_0x593c('0x10')](socket);function respondWithRpcPromise(_0x109385,_0x9bf36c,_0x4bab29){return new BPromise(function(_0x45f943,_0x47848b){return client[_0x593c('0x11')](_0x109385,_0x4bab29)['then'](function(_0x3fd677){logger[_0x593c('0x12')]('FaxAccount,\x20%s,\x20%s',_0x9bf36c,_0x593c('0x13'));logger[_0x593c('0x14')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x9bf36c,_0x593c('0x13'),JSON[_0x593c('0x15')](_0x3fd677));if(_0x3fd677[_0x593c('0x16')]){if(_0x3fd677[_0x593c('0x16')][_0x593c('0x17')]===0x1f4){logger[_0x593c('0x16')]('FaxAccount,\x20%s,\x20%s',_0x9bf36c,_0x3fd677[_0x593c('0x16')][_0x593c('0x18')]);return _0x47848b(_0x3fd677[_0x593c('0x16')]['message']);}logger[_0x593c('0x16')](_0x593c('0x19'),_0x9bf36c,_0x3fd677[_0x593c('0x16')][_0x593c('0x18')]);return _0x45f943(_0x3fd677['error'][_0x593c('0x18')]);}else{logger[_0x593c('0x12')](_0x593c('0x19'),_0x9bf36c,_0x593c('0x13'));_0x45f943(_0x3fd677['result']['message']);}})[_0x593c('0x1a')](function(_0x4e583f){logger['error'](_0x593c('0x19'),_0x9bf36c,_0x4e583f);_0x47848b(_0x4e583f);});});}exports[_0x593c('0x1b')]=function(_0x566dce){var _0x1c400e=this;return new Promise(function(_0x5cd96c,_0x66b2c1){return db['FaxAccount'][_0x593c('0x1c')]({'raw':_0x566dce[_0x593c('0x1d')]?_0x566dce[_0x593c('0x1d')][_0x593c('0x1e')]===undefined?!![]:![]:!![],'where':_0x566dce['options']?_0x566dce[_0x593c('0x1d')][_0x593c('0x1f')]||null:null,'attributes':_0x566dce[_0x593c('0x1d')]?_0x566dce['options'][_0x593c('0x20')]||null:null,'limit':_0x566dce[_0x593c('0x1d')]?_0x566dce['options'][_0x593c('0x21')]||null:null,'include':_0x566dce[_0x593c('0x1d')]?_0x566dce[_0x593c('0x1d')]['include']?_['map'](_0x566dce[_0x593c('0x1d')][_0x593c('0x22')],function(_0x5a5e15){return{'model':db[_0x5a5e15['model']],'as':_0x5a5e15['as'],'attributes':_0x5a5e15['attributes'],'include':_0x5a5e15[_0x593c('0x22')]?_[_0x593c('0x23')](_0x5a5e15[_0x593c('0x22')],function(_0x3f9821){return{'model':db[_0x3f9821[_0x593c('0x24')]],'as':_0x3f9821['as'],'attributes':_0x3f9821[_0x593c('0x20')],'include':_0x3f9821[_0x593c('0x22')]?_['map'](_0x3f9821['include'],function(_0x33793d){return{'model':db[_0x33793d[_0x593c('0x24')]],'as':_0x33793d['as'],'attributes':_0x33793d[_0x593c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x593c('0x25')](function(_0x111271){logger[_0x593c('0x12')]('GetFaxAccount',_0x566dce);logger[_0x593c('0x14')]('GetFaxAccount',_0x566dce,JSON[_0x593c('0x15')](_0x111271));_0x5cd96c(_0x111271);})['catch'](function(_0x351322){logger[_0x593c('0x16')](_0x593c('0x1b'),_0x351322[_0x593c('0x18')],_0x566dce);_0x66b2c1(_0x1c400e[_0x593c('0x16')](0x1f4,_0x351322['message']));});});};exports[_0x593c('0x26')]=function(_0x4e71f6,_0x6b6b53,_0x196aa6){var _0x29fcb7=this;return new Promise(function(_0xb1a6a,_0x1ce8df){var _0x3532aa={'body':_0x4e71f6[_0x593c('0x27')],'channel':_0x593c('0x28')};var _0x2e754c=[];var _0x4bad29=[];var _0x376663={};return db['CmContact']['describe']()[_0x593c('0x25')](function(_0x266f5b){if(!_0x266f5b){throw new db['Sequelize'][(_0x593c('0x29'))]('no\x20available\x20attributes');}_0x2e754c=_['difference'](_['keys'](_0x266f5b),[_0x593c('0x2a'),'updatedAt']);_0x4bad29=_['difference'](_[_0x593c('0x2b')](_0x266f5b),['createdAt',_0x593c('0x2c'),_0x593c('0x2d'),_0x593c('0x2e')]);if(_0x4e71f6['body']['id']){delete _0x4e71f6[_0x593c('0x27')]['id'];}if(_['isNil'](_0x4e71f6[_0x593c('0x27')][_0x593c('0x2f')])){throw new db[(_0x593c('0x30'))][(_0x593c('0x29'))](_0x593c('0x31'));}if(_[_0x593c('0x32')](_0x4e71f6['body']['body'])||_0x4e71f6[_0x593c('0x27')]['body']===''){throw new db['Sequelize'][(_0x593c('0x29'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x593c('0x32')](_0x4e71f6[_0x593c('0x27')]['mapKey'])){throw new db[(_0x593c('0x30'))][(_0x593c('0x29'))](_0x593c('0x33')+_0x4bad29);}if(!_['includes'](_0x4bad29,_0x4e71f6[_0x593c('0x27')][_0x593c('0x34')])){throw new db[(_0x593c('0x30'))][(_0x593c('0x29'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4bad29);}_0x376663[_0x4e71f6['body'][_0x593c('0x34')]]=_0x4e71f6[_0x593c('0x27')][_0x593c('0x2f')];})[_0x593c('0x25')](function(){return db[_0x593c('0x35')][_0x593c('0x36')]({'where':{'id':_0x4e71f6[_0x593c('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0x593c('0x38'),'include':[{'model':db['CmContact'],'as':_0x593c('0x39'),'where':_0x376663,'limit':0x1,'order':[[_0x593c('0x2c'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0x593c('0x3a')}]});})[_0x593c('0x25')](function(_0x48b481){if(_0x48b481&&_0x48b481['List']){var _0x483f7d=_0x48b481[_0x593c('0x3b')]({'plain':!![]});_0x3532aa[_0x593c('0x37')]=_0x483f7d;_0x3532aa['applications']=_0x483f7d[_0x593c('0x3a')];_0x3532aa[_0x593c('0x3c')]=_0x483f7d[_0x593c('0x38')];_0x3532aa['applications']=_[_0x593c('0x3d')](_0x3532aa[_0x593c('0x3e')],[_0x593c('0x3f')],[_0x593c('0x40')]);if(_0x3532aa[_0x593c('0x37')][_0x593c('0x3a')]){delete _0x3532aa['account'][_0x593c('0x3a')];}if(_0x3532aa[_0x593c('0x37')][_0x593c('0x38')]&&_0x3532aa[_0x593c('0x37')][_0x593c('0x38')]['Contacts'][_0x593c('0x41')]){return _0x3532aa[_0x593c('0x37')][_0x593c('0x38')]['Contacts'][0x0];}var _0x35b32e=_[_0x593c('0xc')](_0x4e71f6[_0x593c('0x27')],{'firstName':_0x4e71f6[_0x593c('0x27')][_0x593c('0x2f')],'ListId':_0x483f7d[_0x593c('0x2e')]});_0x35b32e[_0x4e71f6['body'][_0x593c('0x34')]]=_0x4e71f6[_0x593c('0x27')][_0x593c('0x2f')];return db[_0x593c('0x42')][_0x593c('0x43')](_0x35b32e,{'fields':_0x2e754c,'raw':!![]});}})['then'](function(_0x234179){_0x3532aa[_0x593c('0x44')]=_0x234179;if(_0x234179){var _0x336e9a={'ContactId':_0x234179['id'],'FaxAccountId':_0x4e71f6[_0x593c('0x37')]['id'],'fax':_0x234179[_0x593c('0x28')]};return db['FaxInteraction'][_0x593c('0x36')]({'where':{'ContactId':_0x234179['id'],'closed':![],'FaxAccountId':_0x4e71f6[_0x593c('0x37')]['id']}})[_0x593c('0x25')](function(_0x10b0b7){if(_0x10b0b7){return[_0x10b0b7,![]];}return db[_0x593c('0x45')][_0x593c('0x43')](_0x336e9a)[_0x593c('0x25')](function(_0x303573){return[_0x303573,!![]];});});}else{throw new Error(_0x593c('0x46'));}})[_0x593c('0x47')](function(_0xad0ff3,_0x546ba9){var _0x960031=_0xad0ff3[_0x593c('0x3b')]({'plain':!![]});if(_0x546ba9){if(_0x3532aa[_0x593c('0x37')][_0x593c('0x48')]){_0x3532aa[_0x593c('0x3e')][_0x593c('0x49')]({'id':0x0,'priority':_0x3532aa[_0x593c('0x3e')][_0x593c('0x41')]+0x1,'app':_0x593c('0x4a'),'appdata':_0x593c('0x4b'),'interval':_0x593c('0x4c')});}_0x960031[_0x593c('0x4d')]=!![];}else{_0x960031[_0x593c('0x4d')]=![];}_0x3532aa['interaction']=_0x960031;return db[_0x593c('0x4e')]['create']({'body':_0x4e71f6[_0x593c('0x27')][_0x593c('0x27')],'FaxAccountId':_0x4e71f6[_0x593c('0x37')]['id'],'FaxInteractionId':_0xad0ff3['id'],'direction':'in','ContactId':_0xad0ff3[_0x593c('0x4f')],'AttachmentId':_0x4e71f6['body'][_0x593c('0x50')]});})['then'](function(_0x2420f4){_0x3532aa['message']=_0x2420f4;if(_0x3532aa['interaction'][_0x593c('0x51')]){return db[_0x593c('0x52')][_0x593c('0x36')]({'attributes':['id','name'],'where':{'id':_0x3532aa[_0x593c('0x53')]['UserId']}})[_0x593c('0x25')](function(_0x1b2ff2){if(_0x1b2ff2){_0x3532aa['applications'][_0x593c('0x54')]({'id':0x0,'priority':0x0,'app':_0x593c('0x55'),'appdata':_0x1b2ff2['name']+','+(_0x3532aa['account'][_0x593c('0x56')]||0xa),'interval':_0x593c('0x4c')});}return respondWithRpcPromise(_0x593c('0x57'),_0x593c('0x58'),_0x3532aa);});}return respondWithRpcPromise('Start',_0x593c('0x58'),_0x3532aa);})[_0x593c('0x25')](function(_0x420275){_0xb1a6a(_0x420275);})[_0x593c('0x1a')](function(_0x43ab13){_0x1ce8df(_0x29fcb7[_0x593c('0x16')](0x1f4,_0x43ab13['message']));});});}; \ No newline at end of file +var _0x3620=['mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','length','defaults','contact','find','Contact\x20not\x20found','push','unmanaged','*,*,*,*','created','FaxMessage','create','AttachmentId','interaction','User','name','waitForTheAssignedAgent','Start','startRouting','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','then','Sequelize','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','mapKey'];(function(_0x55342e,_0x8958be){var _0x22c24a=function(_0x52f69c){while(--_0x52f69c){_0x55342e['push'](_0x55342e['shift']());}};_0x22c24a(++_0x8958be);}(_0x3620,0x126));var _0x0362=function(_0x8ab6c4,_0x4cc93b){_0x8ab6c4=_0x8ab6c4-0x0;var _0x4ee16c=_0x3620[_0x8ab6c4];return _0x4ee16c;};'use strict';var _=require('lodash');var util=require(_0x0362('0x0'));var moment=require(_0x0362('0x1'));var BPromise=require('bluebird');var rs=require(_0x0362('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0362('0x3'))['db'];var utils=require(_0x0362('0x4'));var logger=require(_0x0362('0x5'))(_0x0362('0x6'));var config=require(_0x0362('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0362('0x8')][_0x0362('0x9')]({'port':0x232c});config[_0x0362('0xa')]=_['defaults'](config[_0x0362('0xa')],{'host':_0x0362('0xb'),'port':0x18eb});var socket=require(_0x0362('0xc'))(new Redis(config[_0x0362('0xa')]));require(_0x0362('0xd'))[_0x0362('0xe')](socket);function respondWithRpcPromise(_0x27fbad,_0xb73087,_0xf0528c){return new BPromise(function(_0x2633ac,_0x29cd10){return client[_0x0362('0xf')](_0x27fbad,_0xf0528c)['then'](function(_0x2d6ec5){logger[_0x0362('0x10')]('FaxAccount,\x20%s,\x20%s',_0xb73087,_0x0362('0x11'));logger[_0x0362('0x12')](_0x0362('0x13'),_0xb73087,'request\x20sent',JSON[_0x0362('0x14')](_0x2d6ec5));if(_0x2d6ec5[_0x0362('0x15')]){if(_0x2d6ec5[_0x0362('0x15')]['code']===0x1f4){logger[_0x0362('0x15')](_0x0362('0x16'),_0xb73087,_0x2d6ec5[_0x0362('0x15')]['message']);return _0x29cd10(_0x2d6ec5[_0x0362('0x15')][_0x0362('0x17')]);}logger[_0x0362('0x15')](_0x0362('0x16'),_0xb73087,_0x2d6ec5[_0x0362('0x15')][_0x0362('0x17')]);return _0x2633ac(_0x2d6ec5['error'][_0x0362('0x17')]);}else{logger[_0x0362('0x10')](_0x0362('0x16'),_0xb73087,_0x0362('0x11'));_0x2633ac(_0x2d6ec5[_0x0362('0x18')]['message']);}})[_0x0362('0x19')](function(_0x490209){logger['error'](_0x0362('0x16'),_0xb73087,_0x490209);_0x29cd10(_0x490209);});});}exports[_0x0362('0x1a')]=function(_0x25ee69){var _0x66f9ff=this;return new Promise(function(_0xf4d01d,_0x4ff013){return db[_0x0362('0x1b')][_0x0362('0x1c')]({'raw':_0x25ee69[_0x0362('0x1d')]?_0x25ee69[_0x0362('0x1d')][_0x0362('0x1e')]===undefined?!![]:![]:!![],'where':_0x25ee69[_0x0362('0x1d')]?_0x25ee69['options'][_0x0362('0x1f')]||null:null,'attributes':_0x25ee69['options']?_0x25ee69[_0x0362('0x1d')][_0x0362('0x20')]||null:null,'limit':_0x25ee69[_0x0362('0x1d')]?_0x25ee69[_0x0362('0x1d')]['limit']||null:null,'include':_0x25ee69['options']?_0x25ee69['options'][_0x0362('0x21')]?_[_0x0362('0x22')](_0x25ee69[_0x0362('0x1d')][_0x0362('0x21')],function(_0x1bbe2e){return{'model':db[_0x1bbe2e[_0x0362('0x23')]],'as':_0x1bbe2e['as'],'attributes':_0x1bbe2e['attributes'],'include':_0x1bbe2e[_0x0362('0x21')]?_[_0x0362('0x22')](_0x1bbe2e[_0x0362('0x21')],function(_0x4ec7f8){return{'model':db[_0x4ec7f8[_0x0362('0x23')]],'as':_0x4ec7f8['as'],'attributes':_0x4ec7f8['attributes'],'include':_0x4ec7f8[_0x0362('0x21')]?_[_0x0362('0x22')](_0x4ec7f8[_0x0362('0x21')],function(_0x5a90b5){return{'model':db[_0x5a90b5[_0x0362('0x23')]],'as':_0x5a90b5['as'],'attributes':_0x5a90b5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x253d57){logger[_0x0362('0x10')](_0x0362('0x1a'),_0x25ee69);logger[_0x0362('0x12')](_0x0362('0x1a'),_0x25ee69,JSON[_0x0362('0x14')](_0x253d57));_0xf4d01d(_0x253d57);})[_0x0362('0x19')](function(_0x25970c){logger['error'](_0x0362('0x1a'),_0x25970c[_0x0362('0x17')],_0x25ee69);_0x4ff013(_0x66f9ff['error'](0x1f4,_0x25970c['message']));});});};exports[_0x0362('0x24')]=function(_0x579855,_0x2c89e3,_0x4579b9){var _0x1e1454=this;return new Promise(function(_0x205844,_0xabfd2f){var _0x2723f9={'body':_0x579855[_0x0362('0x25')],'channel':_0x0362('0x26')};var _0x39ba10=[];var _0x52a0c2=[];var _0x4bd79d={};return db[_0x0362('0x27')][_0x0362('0x28')]()[_0x0362('0x29')](function(_0x4b8ac3){if(!_0x4b8ac3){throw new db[(_0x0362('0x2a'))]['ValidationError']('no\x20available\x20attributes');}_0x39ba10=_[_0x0362('0x2b')](_[_0x0362('0x2c')](_0x4b8ac3),[_0x0362('0x2d'),_0x0362('0x2e')]);_0x52a0c2=_[_0x0362('0x2b')](_[_0x0362('0x2c')](_0x4b8ac3),[_0x0362('0x2d'),'updatedAt',_0x0362('0x2f'),_0x0362('0x30')]);if(_0x579855[_0x0362('0x25')]['id']){delete _0x579855[_0x0362('0x25')]['id'];}if(_[_0x0362('0x31')](_0x579855['body'][_0x0362('0x32')])){throw new db[(_0x0362('0x2a'))][(_0x0362('0x33'))](_0x0362('0x34'));}if(_[_0x0362('0x31')](_0x579855['body'][_0x0362('0x25')])||_0x579855[_0x0362('0x25')]['body']===''){throw new db[(_0x0362('0x2a'))][(_0x0362('0x33'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0362('0x31')](_0x579855['body'][_0x0362('0x35')])){throw new db['Sequelize'][(_0x0362('0x33'))](_0x0362('0x36')+_0x52a0c2);}if(!_[_0x0362('0x37')](_0x52a0c2,_0x579855[_0x0362('0x25')]['mapKey'])){throw new db['Sequelize'][(_0x0362('0x33'))](_0x0362('0x38')+_0x52a0c2);}_0x4bd79d[_0x579855[_0x0362('0x25')][_0x0362('0x35')]]=_0x579855[_0x0362('0x25')][_0x0362('0x32')];})[_0x0362('0x29')](function(){return db[_0x0362('0x1b')]['find']({'where':{'id':_0x579855[_0x0362('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0x0362('0x3a'),'include':[{'model':db['CmContact'],'as':_0x0362('0x3b'),'where':_0x4bd79d,'limit':0x1,'order':[[_0x0362('0x2e'),_0x0362('0x3c')]]}]},{'model':db[_0x0362('0x3d')],'as':_0x0362('0x3e')}]});})[_0x0362('0x29')](function(_0x34a574){if(_0x34a574&&_0x34a574['List']){var _0x2c7497=_0x34a574[_0x0362('0x3f')]({'plain':!![]});_0x2723f9[_0x0362('0x39')]=_0x2c7497;_0x2723f9[_0x0362('0x40')]=_0x2c7497['Applications'];_0x2723f9[_0x0362('0x41')]=_0x2c7497[_0x0362('0x3a')];_0x2723f9[_0x0362('0x40')]=_[_0x0362('0x42')](_0x2723f9['applications'],[_0x0362('0x43')],[_0x0362('0x44')]);if(_0x2723f9[_0x0362('0x39')]['Applications']){delete _0x2723f9[_0x0362('0x39')][_0x0362('0x3e')];}if(_0x2723f9['account'][_0x0362('0x3a')]&&_0x2723f9[_0x0362('0x39')][_0x0362('0x3a')]['Contacts'][_0x0362('0x45')]){return _0x2723f9['account'][_0x0362('0x3a')][_0x0362('0x3b')][0x0];}var _0x39620f=_[_0x0362('0x46')](_0x579855[_0x0362('0x25')],{'firstName':_0x579855[_0x0362('0x25')][_0x0362('0x32')],'ListId':_0x2c7497[_0x0362('0x30')]});_0x39620f[_0x579855[_0x0362('0x25')][_0x0362('0x35')]]=_0x579855[_0x0362('0x25')][_0x0362('0x32')];return db['CmContact']['create'](_0x39620f,{'fields':_0x39ba10,'raw':!![]});}})['then'](function(_0x1307f6){_0x2723f9[_0x0362('0x47')]=_0x1307f6;if(_0x1307f6){var _0x290134={'ContactId':_0x1307f6['id'],'FaxAccountId':_0x579855[_0x0362('0x39')]['id'],'fax':_0x1307f6[_0x0362('0x26')]};return db['FaxInteraction'][_0x0362('0x48')]({'where':{'ContactId':_0x1307f6['id'],'closed':![],'FaxAccountId':_0x579855[_0x0362('0x39')]['id']}})[_0x0362('0x29')](function(_0x16e9c4){if(_0x16e9c4){return[_0x16e9c4,![]];}return db['FaxInteraction']['create'](_0x290134)[_0x0362('0x29')](function(_0x5dd376){return[_0x5dd376,!![]];});});}else{throw new Error(_0x0362('0x49'));}})['spread'](function(_0x35b65d,_0x134fc6){var _0x5d3400=_0x35b65d['get']({'plain':!![]});if(_0x134fc6){if(_0x2723f9[_0x0362('0x39')]['autoclose']){_0x2723f9[_0x0362('0x40')][_0x0362('0x4a')]({'id':0x0,'priority':_0x2723f9[_0x0362('0x40')]['length']+0x1,'app':'close','appdata':_0x0362('0x4b'),'interval':_0x0362('0x4c')});}_0x5d3400['created']=!![];}else{_0x5d3400[_0x0362('0x4d')]=![];}_0x2723f9['interaction']=_0x5d3400;return db[_0x0362('0x4e')][_0x0362('0x4f')]({'body':_0x579855[_0x0362('0x25')][_0x0362('0x25')],'FaxAccountId':_0x579855[_0x0362('0x39')]['id'],'FaxInteractionId':_0x35b65d['id'],'direction':'in','ContactId':_0x35b65d['ContactId'],'AttachmentId':_0x579855[_0x0362('0x25')][_0x0362('0x50')]});})[_0x0362('0x29')](function(_0x2ca5f9){_0x2723f9['message']=_0x2ca5f9;if(_0x2723f9[_0x0362('0x51')]['UserId']){return db[_0x0362('0x52')][_0x0362('0x48')]({'attributes':['id',_0x0362('0x53')],'where':{'id':_0x2723f9['interaction']['UserId']}})['then'](function(_0x2b3280){if(_0x2b3280){_0x2723f9[_0x0362('0x40')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2b3280[_0x0362('0x53')]+','+(_0x2723f9[_0x0362('0x39')][_0x0362('0x54')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x0362('0x55'),_0x0362('0x56'),_0x2723f9);});}return respondWithRpcPromise(_0x0362('0x55'),_0x0362('0x56'),_0x2723f9);})[_0x0362('0x29')](function(_0x1d0b89){_0x205844(_0x1d0b89);})[_0x0362('0x19')](function(_0x536a8c){_0xabfd2f(_0x1e1454[_0x0362('0x15')](0x1f4,_0x536a8c[_0x0362('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 6bb75a1..e4cd8be 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 _0x39fc=['register','length','faxAccount:','./faxAccount.events','save','emit','removeListener'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x39fc,0x106));var _0xc39f=function(_0x32f05c,_0x273aef){_0x32f05c=_0x32f05c-0x0;var _0x4307ed=_0x39fc[_0x32f05c];return _0x4307ed;};'use strict';var FaxAccountEvents=require(_0xc39f('0x0'));var events=[_0xc39f('0x1'),'remove','update'];function createListener(_0x56399a,_0x4dda0e){return function(_0x72b429){_0x4dda0e[_0xc39f('0x2')](_0x56399a,_0x72b429);};}function removeListener(_0x37ef32,_0x56fe91){return function(){FaxAccountEvents[_0xc39f('0x3')](_0x37ef32,_0x56fe91);};}exports[_0xc39f('0x4')]=function(_0x58b0a7){for(var _0x1f929c=0x0,_0x330828=events[_0xc39f('0x5')];_0x1f929c<_0x330828;_0x1f929c++){var _0x3cd645=events[_0x1f929c];var _0x51efac=createListener(_0xc39f('0x6')+_0x3cd645,_0x58b0a7);FaxAccountEvents['on'](_0x3cd645,_0x51efac);}}; \ No newline at end of file +var _0x345e=['remove','emit','removeListener','register','faxAccount:','save'];(function(_0x4858cf,_0x45cc07){var _0x461702=function(_0x17399c){while(--_0x17399c){_0x4858cf['push'](_0x4858cf['shift']());}};_0x461702(++_0x45cc07);}(_0x345e,0xbf));var _0xe345=function(_0x262f0d,_0x51e151){_0x262f0d=_0x262f0d-0x0;var _0x21dc30=_0x345e[_0x262f0d];return _0x21dc30;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xe345('0x0'),_0xe345('0x1'),'update'];function createListener(_0x54ab32,_0x5737cd){return function(_0x2c76df){_0x5737cd[_0xe345('0x2')](_0x54ab32,_0x2c76df);};}function removeListener(_0x522eb3,_0x4235e6){return function(){FaxAccountEvents[_0xe345('0x3')](_0x522eb3,_0x4235e6);};}exports[_0xe345('0x4')]=function(_0x45e761){for(var _0x294bb6=0x0,_0xb4e57d=events['length'];_0x294bb6<_0xb4e57d;_0x294bb6++){var _0x5431d6=events[_0x294bb6];var _0x2a037d=createListener(_0xe345('0x5')+_0x5431d6,_0x45e761);FaxAccountEvents['on'](_0x5431d6,_0x2a037d);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index c1f30c5..23892fd 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x2140ae,_0x276645){var _0x33ccc7=function(_0xedb37c){while(--_0xedb37c){_0x2140ae['push'](_0x2140ae['shift']());}};_0x33ccc7(++_0x276645);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x2d37b7,_0x3bf618){var _0x4dfbdb=function(_0x18fc40){while(--_0x18fc40){_0x2d37b7['push'](_0x2d37b7['shift']());}};_0x4dfbdb(++_0x3bf618);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 06d3996..1ba78cc 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 _0x5d98=['STRING','noop','*,*,*,*','sequelize'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x5d98,0x1af));var _0x85d9=function(_0x344764,_0x54b272){_0x344764=_0x344764-0x0;var _0x440b98=_0x5d98[_0x344764];return _0x440b98;};'use strict';var Sequelize=require(_0x85d9('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x85d9('0x1')],'allowNull':![],'defaultValue':_0x85d9('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x85d9('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x85d9('0x3')}}; \ No newline at end of file +var _0x32be=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x32be,0xcc));var _0xe32b=function(_0x5a5f47,_0x42ea38){_0x5a5f47=_0x5a5f47-0x0;var _0xb679af=_0x32be[_0x5a5f47];return _0xb679af;};'use strict';var Sequelize=require(_0xe32b('0x0'));module[_0xe32b('0x1')]={'priority':{'type':Sequelize[_0xe32b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe32b('0x3')],'allowNull':![],'defaultValue':_0xe32b('0x4')},'appdata':{'type':Sequelize[_0xe32b('0x5')]()},'description':{'type':Sequelize[_0xe32b('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xe32b('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 5432231..25971af 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 _0x0c2a=['undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','show','params','intersection','include','find','catch','create','body','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x4b48b1,_0x3231cb){var _0x42e5e0=function(_0x58e360){while(--_0x58e360){_0x4b48b1['push'](_0x4b48b1['shift']());}};_0x42e5e0(++_0x3231cb);}(_0x0c2a,0x149));var _0xa0c2=function(_0x7d2113,_0x26f50b){_0x7d2113=_0x7d2113-0x0;var _0x76bdc=_0x0c2a[_0x7d2113];return _0x76bdc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa0c2('0x0'));var zipdir=require(_0xa0c2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa0c2('0x2'));var BPromise=require(_0xa0c2('0x3'));var Mustache=require('mustache');var util=require(_0xa0c2('0x4'));var path=require('path');var sox=require(_0xa0c2('0x5'));var csv=require(_0xa0c2('0x6'));var ejs=require(_0xa0c2('0x7'));var fs=require('fs');var fs_extra=require(_0xa0c2('0x8'));var _=require(_0xa0c2('0x9'));var squel=require(_0xa0c2('0xa'));var crypto=require(_0xa0c2('0xb'));var jsforce=require(_0xa0c2('0xc'));var deskjs=require(_0xa0c2('0xd'));var toCsv=require(_0xa0c2('0x6'));var querystring=require(_0xa0c2('0xe'));var Papa=require('papaparse');var Redis=require(_0xa0c2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa0c2('0x10'));var as=require(_0xa0c2('0x11'));var hardwareService=require(_0xa0c2('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa0c2('0x13'));var db=require(_0xa0c2('0x14'))['db'];function respondWithStatusCode(_0x3ebfcd,_0x58c4a1){_0x58c4a1=_0x58c4a1||0xcc;return function(_0x25dee9){if(_0x25dee9){return _0x3ebfcd[_0xa0c2('0x15')](_0x58c4a1);}return _0x3ebfcd[_0xa0c2('0x16')](_0x58c4a1)[_0xa0c2('0x17')]();};}function respondWithResult(_0x5922d4,_0x128dca){_0x128dca=_0x128dca||0xc8;return function(_0x279c01){if(_0x279c01){return _0x5922d4['status'](_0x128dca)[_0xa0c2('0x18')](_0x279c01);}};}function respondWithFilteredResult(_0x458699,_0x5e62a4){return function(_0x5812a5){if(_0x5812a5){var _0x5d8eff=typeof _0x5e62a4[_0xa0c2('0x19')]===_0xa0c2('0x1a')&&typeof _0x5e62a4[_0xa0c2('0x1b')]==='undefined';var _0x39fa46=_0x5812a5['count'];var _0x165dcc=_0x5d8eff?0x0:_0x5e62a4['offset'];var _0x23a901=_0x5d8eff?_0x5812a5[_0xa0c2('0x1c')]:_0x5e62a4[_0xa0c2('0x19')]+_0x5e62a4[_0xa0c2('0x1b')];var _0x5c6952;if(_0x23a901>=_0x39fa46){_0x23a901=_0x39fa46;_0x5c6952=0xc8;}else{_0x5c6952=0xce;}_0x458699[_0xa0c2('0x16')](_0x5c6952);return _0x458699[_0xa0c2('0x1d')](_0xa0c2('0x1e'),_0x165dcc+'-'+_0x23a901+'/'+_0x39fa46)[_0xa0c2('0x18')](_0x5812a5);}return null;};}function patchUpdates(_0x32c8a5){return function(_0x1c26ab){try{jsonpatch[_0xa0c2('0x1f')](_0x1c26ab,_0x32c8a5,!![]);}catch(_0x280ec8){return BPromise[_0xa0c2('0x20')](_0x280ec8);}return _0x1c26ab['save']();};}function saveUpdates(_0x4e4557,_0x1b8b56){return function(_0x576120){if(_0x576120){return _0x576120[_0xa0c2('0x21')](_0x4e4557)[_0xa0c2('0x22')](function(_0x243619){return _0x243619;});}return null;};}function removeEntity(_0x5e334a,_0x285c18){return function(_0x98f185){if(_0x98f185){return _0x98f185[_0xa0c2('0x23')]()[_0xa0c2('0x22')](function(){_0x5e334a[_0xa0c2('0x16')](0xcc)[_0xa0c2('0x17')]();});}};}function handleEntityNotFound(_0x20f860,_0x138673){return function(_0x2fbab6){if(!_0x2fbab6){_0x20f860[_0xa0c2('0x15')](0x194);}return _0x2fbab6;};}function handleError(_0x5a406e,_0x280e20){_0x280e20=_0x280e20||0x1f4;return function(_0x2cb287){logger[_0xa0c2('0x24')](_0x2cb287[_0xa0c2('0x25')]);if(_0x2cb287[_0xa0c2('0x26')]){delete _0x2cb287[_0xa0c2('0x26')];}_0x5a406e[_0xa0c2('0x16')](_0x280e20)['send'](_0x2cb287);};}exports[_0xa0c2('0x27')]=function(_0x87eccc,_0x5e8730){var _0x482376={},_0x1abf7b={},_0x4ed891={'count':0x0,'rows':[]};var _0x26d351=_[_0xa0c2('0x28')](db[_0xa0c2('0x29')][_0xa0c2('0x2a')],function(_0x102e94){return{'name':_0x102e94[_0xa0c2('0x2b')],'type':_0x102e94[_0xa0c2('0x2c')][_0xa0c2('0x2d')]};});_0x1abf7b['model']=_[_0xa0c2('0x28')](_0x26d351,_0xa0c2('0x26'));_0x1abf7b['query']=_[_0xa0c2('0x2e')](_0x87eccc[_0xa0c2('0x2f')]);_0x1abf7b[_0xa0c2('0x30')]=_['intersection'](_0x1abf7b[_0xa0c2('0x31')],_0x1abf7b[_0xa0c2('0x2f')]);_0x482376[_0xa0c2('0x32')]=_['intersection'](_0x1abf7b[_0xa0c2('0x31')],qs[_0xa0c2('0x33')](_0x87eccc['query']['fields']));_0x482376[_0xa0c2('0x32')]=_0x482376[_0xa0c2('0x32')]['length']?_0x482376[_0xa0c2('0x32')]:_0x1abf7b[_0xa0c2('0x31')];if(!_0x87eccc[_0xa0c2('0x2f')][_0xa0c2('0x34')](_0xa0c2('0x35'))){_0x482376[_0xa0c2('0x1b')]=qs['limit'](_0x87eccc[_0xa0c2('0x2f')][_0xa0c2('0x1b')]);_0x482376['offset']=qs[_0xa0c2('0x19')](_0x87eccc['query']['offset']);}_0x482376[_0xa0c2('0x36')]=qs[_0xa0c2('0x37')](_0x87eccc[_0xa0c2('0x2f')][_0xa0c2('0x37')]);_0x482376[_0xa0c2('0x38')]=qs[_0xa0c2('0x30')](_[_0xa0c2('0x39')](_0x87eccc['query'],_0x1abf7b[_0xa0c2('0x30')]),_0x26d351);if(_0x87eccc[_0xa0c2('0x2f')][_0xa0c2('0x3a')]){_0x482376['where']=_[_0xa0c2('0x3b')](_0x482376['where'],{'$or':_[_0xa0c2('0x28')](_0x26d351,function(_0x4efb9f){if(_0x4efb9f[_0xa0c2('0x2c')]!=='VIRTUAL'){var _0x3bf602={};_0x3bf602[_0x4efb9f['name']]={'$like':'%'+_0x87eccc[_0xa0c2('0x2f')]['filter']+'%'};return _0x3bf602;}})});}_0x482376=_['merge']({},_0x482376,_0x87eccc[_0xa0c2('0x3c')]);var _0xe1213d={'where':_0x482376[_0xa0c2('0x38')]};return db['FaxApplication'][_0xa0c2('0x1c')](_0xe1213d)[_0xa0c2('0x22')](function(_0x159045){_0x4ed891[_0xa0c2('0x1c')]=_0x159045;if(_0x87eccc[_0xa0c2('0x2f')][_0xa0c2('0x3d')]){_0x482376['include']=[{'all':!![]}];}return db[_0xa0c2('0x29')][_0xa0c2('0x3e')](_0x482376);})[_0xa0c2('0x22')](function(_0x4b5593){_0x4ed891['rows']=_0x4b5593;return _0x4ed891;})[_0xa0c2('0x22')](respondWithFilteredResult(_0x5e8730,_0x482376))['catch'](handleError(_0x5e8730,null));};exports[_0xa0c2('0x3f')]=function(_0x376ab0,_0x282f23){var _0x46e3d4={'raw':!![],'where':{'id':_0x376ab0[_0xa0c2('0x40')]['id']}},_0x1c6fe0={};_0x1c6fe0[_0xa0c2('0x31')]=_['keys'](db[_0xa0c2('0x29')]['rawAttributes']);_0x1c6fe0[_0xa0c2('0x2f')]=_['keys'](_0x376ab0[_0xa0c2('0x2f')]);_0x1c6fe0[_0xa0c2('0x30')]=_[_0xa0c2('0x41')](_0x1c6fe0['model'],_0x1c6fe0[_0xa0c2('0x2f')]);_0x46e3d4[_0xa0c2('0x32')]=_[_0xa0c2('0x41')](_0x1c6fe0['model'],qs[_0xa0c2('0x33')](_0x376ab0[_0xa0c2('0x2f')][_0xa0c2('0x33')]));_0x46e3d4[_0xa0c2('0x32')]=_0x46e3d4[_0xa0c2('0x32')]['length']?_0x46e3d4[_0xa0c2('0x32')]:_0x1c6fe0[_0xa0c2('0x31')];if(_0x376ab0['query'][_0xa0c2('0x3d')]){_0x46e3d4[_0xa0c2('0x42')]=[{'all':!![]}];}_0x46e3d4=_['merge']({},_0x46e3d4,_0x376ab0[_0xa0c2('0x3c')]);return db['FaxApplication'][_0xa0c2('0x43')](_0x46e3d4)[_0xa0c2('0x22')](handleEntityNotFound(_0x282f23,null))[_0xa0c2('0x22')](respondWithResult(_0x282f23,null))[_0xa0c2('0x44')](handleError(_0x282f23,null));};exports[_0xa0c2('0x45')]=function(_0x4d1b60,_0xe8b8b2){return db[_0xa0c2('0x29')][_0xa0c2('0x45')](_0x4d1b60[_0xa0c2('0x46')],{})[_0xa0c2('0x22')](respondWithResult(_0xe8b8b2,0xc9))['catch'](handleError(_0xe8b8b2,null));};exports[_0xa0c2('0x21')]=function(_0x32674e,_0x166aa9){if(_0x32674e[_0xa0c2('0x46')]['id']){delete _0x32674e[_0xa0c2('0x46')]['id'];}return db[_0xa0c2('0x29')]['find']({'where':{'id':_0x32674e[_0xa0c2('0x40')]['id']}})[_0xa0c2('0x22')](handleEntityNotFound(_0x166aa9,null))[_0xa0c2('0x22')](saveUpdates(_0x32674e['body'],null))['then'](respondWithResult(_0x166aa9,null))[_0xa0c2('0x44')](handleError(_0x166aa9,null));};exports[_0xa0c2('0x23')]=function(_0x525867,_0xa2cba7){return db[_0xa0c2('0x29')][_0xa0c2('0x43')]({'where':{'id':_0x525867['params']['id']}})[_0xa0c2('0x22')](handleEntityNotFound(_0xa2cba7,null))[_0xa0c2('0x22')](removeEntity(_0xa2cba7,null))[_0xa0c2('0x44')](handleError(_0xa2cba7,null));}; \ No newline at end of file +var _0x5d30=['zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','undefined','count','offset','limit','Content-Range','json','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','options','find','create','body','eml-format','rimraf'];(function(_0x2b9ebf,_0x3a9f0e){var _0x1cacf2=function(_0x1494c1){while(--_0x1494c1){_0x2b9ebf['push'](_0x2b9ebf['shift']());}};_0x1cacf2(++_0x3a9f0e);}(_0x5d30,0x126));var _0x05d3=function(_0x2ee790,_0x5a8661){_0x2ee790=_0x2ee790-0x0;var _0x5a54a5=_0x5d30[_0x2ee790];return _0x5a54a5;};'use strict';var emlformat=require(_0x05d3('0x0'));var rimraf=require(_0x05d3('0x1'));var zipdir=require(_0x05d3('0x2'));var jsonpatch=require(_0x05d3('0x3'));var rp=require(_0x05d3('0x4'));var moment=require(_0x05d3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x05d3('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x05d3('0x7'));var ejs=require(_0x05d3('0x8'));var fs=require('fs');var fs_extra=require(_0x05d3('0x9'));var _=require('lodash');var squel=require(_0x05d3('0xa'));var crypto=require(_0x05d3('0xb'));var jsforce=require(_0x05d3('0xc'));var deskjs=require(_0x05d3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x05d3('0xe'));var Papa=require('papaparse');var Redis=require(_0x05d3('0xf'));var authService=require(_0x05d3('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05d3('0x11'));var logger=require(_0x05d3('0x12'))(_0x05d3('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x05d3('0x14'));var db=require(_0x05d3('0x15'))['db'];function respondWithStatusCode(_0x328eb9,_0x4cffa7){_0x4cffa7=_0x4cffa7||0xcc;return function(_0x10dd98){if(_0x10dd98){return _0x328eb9['sendStatus'](_0x4cffa7);}return _0x328eb9[_0x05d3('0x16')](_0x4cffa7)['end']();};}function respondWithResult(_0x26fe08,_0x76d9f1){_0x76d9f1=_0x76d9f1||0xc8;return function(_0x21eee7){if(_0x21eee7){return _0x26fe08[_0x05d3('0x16')](_0x76d9f1)['json'](_0x21eee7);}};}function respondWithFilteredResult(_0x19edc3,_0xa7199e){return function(_0x1ccfec){if(_0x1ccfec){var _0x3c24d3=typeof _0xa7199e['offset']===_0x05d3('0x17')&&typeof _0xa7199e['limit']===_0x05d3('0x17');var _0x1efa34=_0x1ccfec[_0x05d3('0x18')];var _0x2bc4ba=_0x3c24d3?0x0:_0xa7199e[_0x05d3('0x19')];var _0x52df4f=_0x3c24d3?_0x1ccfec[_0x05d3('0x18')]:_0xa7199e[_0x05d3('0x19')]+_0xa7199e[_0x05d3('0x1a')];var _0xbde724;if(_0x52df4f>=_0x1efa34){_0x52df4f=_0x1efa34;_0xbde724=0xc8;}else{_0xbde724=0xce;}_0x19edc3['status'](_0xbde724);return _0x19edc3['set'](_0x05d3('0x1b'),_0x2bc4ba+'-'+_0x52df4f+'/'+_0x1efa34)[_0x05d3('0x1c')](_0x1ccfec);}return null;};}function patchUpdates(_0x394f34){return function(_0xae13e3){try{jsonpatch[_0x05d3('0x1d')](_0xae13e3,_0x394f34,!![]);}catch(_0x31d9c4){return BPromise[_0x05d3('0x1e')](_0x31d9c4);}return _0xae13e3['save']();};}function saveUpdates(_0x275031,_0x3a27b6){return function(_0x1eac86){if(_0x1eac86){return _0x1eac86[_0x05d3('0x1f')](_0x275031)[_0x05d3('0x20')](function(_0xb3dfa9){return _0xb3dfa9;});}return null;};}function removeEntity(_0x161e1a,_0x3d4ff7){return function(_0x11bf07){if(_0x11bf07){return _0x11bf07[_0x05d3('0x21')]()[_0x05d3('0x20')](function(){_0x161e1a[_0x05d3('0x16')](0xcc)[_0x05d3('0x22')]();});}};}function handleEntityNotFound(_0x22549f,_0x153410){return function(_0x11add9){if(!_0x11add9){_0x22549f[_0x05d3('0x23')](0x194);}return _0x11add9;};}function handleError(_0xef92c9,_0x3873b7){_0x3873b7=_0x3873b7||0x1f4;return function(_0x235e3f){logger[_0x05d3('0x24')](_0x235e3f[_0x05d3('0x25')]);if(_0x235e3f[_0x05d3('0x26')]){delete _0x235e3f[_0x05d3('0x26')];}_0xef92c9[_0x05d3('0x16')](_0x3873b7)['send'](_0x235e3f);};}exports[_0x05d3('0x27')]=function(_0x6eab7a,_0x3c882a){var _0x1bf20e={},_0xd3ff35={},_0x5db059={'count':0x0,'rows':[]};var _0x126093=_[_0x05d3('0x28')](db[_0x05d3('0x29')][_0x05d3('0x2a')],function(_0xb7ac94){return{'name':_0xb7ac94[_0x05d3('0x2b')],'type':_0xb7ac94[_0x05d3('0x2c')][_0x05d3('0x2d')]};});_0xd3ff35[_0x05d3('0x2e')]=_[_0x05d3('0x28')](_0x126093,_0x05d3('0x26'));_0xd3ff35['query']=_[_0x05d3('0x2f')](_0x6eab7a[_0x05d3('0x30')]);_0xd3ff35[_0x05d3('0x31')]=_[_0x05d3('0x32')](_0xd3ff35[_0x05d3('0x2e')],_0xd3ff35[_0x05d3('0x30')]);_0x1bf20e[_0x05d3('0x33')]=_[_0x05d3('0x32')](_0xd3ff35[_0x05d3('0x2e')],qs['fields'](_0x6eab7a[_0x05d3('0x30')]['fields']));_0x1bf20e['attributes']=_0x1bf20e[_0x05d3('0x33')][_0x05d3('0x34')]?_0x1bf20e['attributes']:_0xd3ff35['model'];if(!_0x6eab7a[_0x05d3('0x30')][_0x05d3('0x35')](_0x05d3('0x36'))){_0x1bf20e[_0x05d3('0x1a')]=qs[_0x05d3('0x1a')](_0x6eab7a['query'][_0x05d3('0x1a')]);_0x1bf20e[_0x05d3('0x19')]=qs[_0x05d3('0x19')](_0x6eab7a[_0x05d3('0x30')][_0x05d3('0x19')]);}_0x1bf20e[_0x05d3('0x37')]=qs[_0x05d3('0x38')](_0x6eab7a[_0x05d3('0x30')]['sort']);_0x1bf20e['where']=qs[_0x05d3('0x31')](_[_0x05d3('0x39')](_0x6eab7a[_0x05d3('0x30')],_0xd3ff35[_0x05d3('0x31')]),_0x126093);if(_0x6eab7a['query'][_0x05d3('0x3a')]){_0x1bf20e[_0x05d3('0x3b')]=_[_0x05d3('0x3c')](_0x1bf20e[_0x05d3('0x3b')],{'$or':_[_0x05d3('0x28')](_0x126093,function(_0x2cad24){if(_0x2cad24['type']!==_0x05d3('0x3d')){var _0xf26bfd={};_0xf26bfd[_0x2cad24[_0x05d3('0x26')]]={'$like':'%'+_0x6eab7a[_0x05d3('0x30')][_0x05d3('0x3a')]+'%'};return _0xf26bfd;}})});}_0x1bf20e=_[_0x05d3('0x3c')]({},_0x1bf20e,_0x6eab7a['options']);var _0x3cd0c6={'where':_0x1bf20e['where']};return db[_0x05d3('0x29')][_0x05d3('0x18')](_0x3cd0c6)['then'](function(_0x15fbf4){_0x5db059[_0x05d3('0x18')]=_0x15fbf4;if(_0x6eab7a[_0x05d3('0x30')][_0x05d3('0x3e')]){_0x1bf20e[_0x05d3('0x3f')]=[{'all':!![]}];}return db[_0x05d3('0x29')][_0x05d3('0x40')](_0x1bf20e);})['then'](function(_0x4f4c08){_0x5db059[_0x05d3('0x41')]=_0x4f4c08;return _0x5db059;})[_0x05d3('0x20')](respondWithFilteredResult(_0x3c882a,_0x1bf20e))[_0x05d3('0x42')](handleError(_0x3c882a,null));};exports[_0x05d3('0x43')]=function(_0x4fe954,_0x5addcf){var _0x11829a={'raw':!![],'where':{'id':_0x4fe954[_0x05d3('0x44')]['id']}},_0x36a21d={};_0x36a21d['model']=_['keys'](db[_0x05d3('0x29')][_0x05d3('0x2a')]);_0x36a21d[_0x05d3('0x30')]=_[_0x05d3('0x2f')](_0x4fe954['query']);_0x36a21d[_0x05d3('0x31')]=_[_0x05d3('0x32')](_0x36a21d[_0x05d3('0x2e')],_0x36a21d[_0x05d3('0x30')]);_0x11829a[_0x05d3('0x33')]=_['intersection'](_0x36a21d['model'],qs['fields'](_0x4fe954['query'][_0x05d3('0x45')]));_0x11829a['attributes']=_0x11829a['attributes'][_0x05d3('0x34')]?_0x11829a[_0x05d3('0x33')]:_0x36a21d[_0x05d3('0x2e')];if(_0x4fe954[_0x05d3('0x30')][_0x05d3('0x3e')]){_0x11829a['include']=[{'all':!![]}];}_0x11829a=_['merge']({},_0x11829a,_0x4fe954[_0x05d3('0x46')]);return db['FaxApplication'][_0x05d3('0x47')](_0x11829a)['then'](handleEntityNotFound(_0x5addcf,null))[_0x05d3('0x20')](respondWithResult(_0x5addcf,null))['catch'](handleError(_0x5addcf,null));};exports[_0x05d3('0x48')]=function(_0x59fd4c,_0x719fa9){return db[_0x05d3('0x29')][_0x05d3('0x48')](_0x59fd4c[_0x05d3('0x49')],{})[_0x05d3('0x20')](respondWithResult(_0x719fa9,0xc9))['catch'](handleError(_0x719fa9,null));};exports['update']=function(_0x350e8a,_0x2892ea){if(_0x350e8a[_0x05d3('0x49')]['id']){delete _0x350e8a['body']['id'];}return db[_0x05d3('0x29')]['find']({'where':{'id':_0x350e8a[_0x05d3('0x44')]['id']}})['then'](handleEntityNotFound(_0x2892ea,null))[_0x05d3('0x20')](saveUpdates(_0x350e8a[_0x05d3('0x49')],null))[_0x05d3('0x20')](respondWithResult(_0x2892ea,null))['catch'](handleError(_0x2892ea,null));};exports[_0x05d3('0x21')]=function(_0x9b9c9d,_0x4106f3){return db[_0x05d3('0x29')]['find']({'where':{'id':_0x9b9c9d['params']['id']}})[_0x05d3('0x20')](handleEntityNotFound(_0x4106f3,null))[_0x05d3('0x20')](removeEntity(_0x4106f3,null))['catch'](handleError(_0x4106f3,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index dc848fb..00c6881 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 _0x27fc=['rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x27fc,0xb0));var _0xc27f=function(_0x56bce4,_0x176888){_0x56bce4=_0x56bce4-0x0;var _0x4eca32=_0x27fc[_0x56bce4];return _0x4eca32;};'use strict';var _=require('lodash');var util=require(_0xc27f('0x0'));var logger=require(_0xc27f('0x1'))(_0xc27f('0x2'));var moment=require(_0xc27f('0x3'));var BPromise=require('bluebird');var rp=require(_0xc27f('0x4'));var fs=require('fs');var path=require(_0xc27f('0x5'));var rimraf=require(_0xc27f('0x6'));var config=require(_0xc27f('0x7'));var attributes=require('./faxApplication.attributes');module[_0xc27f('0x8')]=function(_0x1dd48a,_0x518197){return _0x1dd48a[_0xc27f('0x9')](_0xc27f('0xa'),attributes,{'tableName':_0xc27f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc27f('0xc'),'collate':_0xc27f('0xd')});}; \ No newline at end of file +var _0x9f66=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0xdb0316,_0x1699ee){var _0xe43c0d=function(_0x104299){while(--_0x104299){_0xdb0316['push'](_0xdb0316['shift']());}};_0xe43c0d(++_0x1699ee);}(_0x9f66,0xa8));var _0x69f6=function(_0x3e85d4,_0x59f01d){_0x3e85d4=_0x3e85d4-0x0;var _0x497787=_0x9f66[_0x3e85d4];return _0x497787;};'use strict';var _=require(_0x69f6('0x0'));var util=require(_0x69f6('0x1'));var logger=require('../../config/logger')(_0x69f6('0x2'));var moment=require('moment');var BPromise=require(_0x69f6('0x3'));var rp=require(_0x69f6('0x4'));var fs=require('fs');var path=require(_0x69f6('0x5'));var rimraf=require(_0x69f6('0x6'));var config=require(_0x69f6('0x7'));var attributes=require('./faxApplication.attributes');module[_0x69f6('0x8')]=function(_0x3e1e81,_0x1ca503){return _0x3e1e81['define'](_0x69f6('0x9'),attributes,{'tableName':_0x69f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x69f6('0xb'),'collate':_0x69f6('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 19ad6ac..339ef66 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 _0xdd19=['rpc','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','error','code','message','FaxApplication,\x20%s,\x20%s','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4d9202,_0x169fe5){var _0x1973c7=function(_0x322f1c){while(--_0x322f1c){_0x4d9202['push'](_0x4d9202['shift']());}};_0x1973c7(++_0x169fe5);}(_0xdd19,0xc5));var _0x9dd1=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xdd19[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x9dd1('0x0'));var util=require('util');var moment=require(_0x9dd1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9dd1('0x2'));var fs=require('fs');var Redis=require(_0x9dd1('0x3'));var db=require(_0x9dd1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9dd1('0x5'))(_0x9dd1('0x6'));var config=require(_0x9dd1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9dd1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eb634,_0x2b41f9,_0x5d72b8){return new BPromise(function(_0x1209cc,_0x1597ae){return client[_0x9dd1('0x9')](_0x5eb634,_0x5d72b8)[_0x9dd1('0xa')](function(_0x50b0ee){logger[_0x9dd1('0xb')]('FaxApplication,\x20%s,\x20%s',_0x2b41f9,_0x9dd1('0xc'));logger[_0x9dd1('0xd')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2b41f9,'request\x20sent',JSON[_0x9dd1('0xe')](_0x50b0ee));if(_0x50b0ee[_0x9dd1('0xf')]){if(_0x50b0ee[_0x9dd1('0xf')][_0x9dd1('0x10')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x2b41f9,_0x50b0ee[_0x9dd1('0xf')][_0x9dd1('0x11')]);return _0x1597ae(_0x50b0ee[_0x9dd1('0xf')][_0x9dd1('0x11')]);}logger[_0x9dd1('0xf')]('FaxApplication,\x20%s,\x20%s',_0x2b41f9,_0x50b0ee[_0x9dd1('0xf')]['message']);return _0x1209cc(_0x50b0ee[_0x9dd1('0xf')]['message']);}else{logger[_0x9dd1('0xb')](_0x9dd1('0x12'),_0x2b41f9,_0x9dd1('0xc'));_0x1209cc(_0x50b0ee[_0x9dd1('0x13')][_0x9dd1('0x11')]);}})[_0x9dd1('0x14')](function(_0x53490c){logger['error'](_0x9dd1('0x12'),_0x2b41f9,_0x53490c);_0x1597ae(_0x53490c);});});}exports[_0x9dd1('0x15')]=function(_0xc99121){var _0x5099e9=this;return new Promise(function(_0x2076eb,_0x369964){return db[_0x9dd1('0x16')][_0x9dd1('0x17')](_0xc99121[_0x9dd1('0x18')],{'raw':_0xc99121[_0x9dd1('0x19')]?_0xc99121[_0x9dd1('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc99121[_0x9dd1('0x19')]?_0xc99121[_0x9dd1('0x19')][_0x9dd1('0x1a')]||null:null,'attributes':_0xc99121['options']?_0xc99121[_0x9dd1('0x19')][_0x9dd1('0x1b')]||null:null,'limit':_0xc99121[_0x9dd1('0x19')]?_0xc99121['options'][_0x9dd1('0x1c')]||null:null})[_0x9dd1('0xa')](function(_0x4d9f3b){logger['info'](_0x9dd1('0x15'),_0xc99121);logger[_0x9dd1('0xd')]('UpdateFaxApplication',_0xc99121,JSON[_0x9dd1('0xe')](_0x4d9f3b));_0x2076eb(_0x4d9f3b);})['catch'](function(_0x1997d6){logger[_0x9dd1('0xf')]('UpdateFaxApplication',_0x1997d6[_0x9dd1('0x11')],_0xc99121);_0x369964(_0x5099e9['error'](0x1f4,_0x1997d6[_0x9dd1('0x11')]));});});}; \ No newline at end of file +var _0xde51=['client','request','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','FaxApplication','update','options','attributes','limit','then','UpdateFaxApplication','debug','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise'];(function(_0x494965,_0x48ace5){var _0x3e682e=function(_0x463373){while(--_0x463373){_0x494965['push'](_0x494965['shift']());}};_0x3e682e(++_0x48ace5);}(_0xde51,0x9b));var _0x1de5=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0xde51[_0x3e6b2f];return _0x323215;};'use strict';var _=require('lodash');var util=require(_0x1de5('0x0'));var moment=require(_0x1de5('0x1'));var BPromise=require('bluebird');var rs=require(_0x1de5('0x2'));var fs=require('fs');var Redis=require(_0x1de5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1de5('0x4'))('rpc');var config=require(_0x1de5('0x5'));var jayson=require(_0x1de5('0x6'));var client=jayson[_0x1de5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc6e38e,_0x1cff35,_0x2ba820){return new BPromise(function(_0x172769,_0x2cb5e5){return client[_0x1de5('0x8')](_0xc6e38e,_0x2ba820)['then'](function(_0x226407){logger['info'](_0x1de5('0x9'),_0x1cff35,'request\x20sent');logger['debug'](_0x1de5('0xa'),_0x1cff35,_0x1de5('0xb'),JSON[_0x1de5('0xc')](_0x226407));if(_0x226407[_0x1de5('0xd')]){if(_0x226407[_0x1de5('0xd')][_0x1de5('0xe')]===0x1f4){logger['error'](_0x1de5('0x9'),_0x1cff35,_0x226407[_0x1de5('0xd')]['message']);return _0x2cb5e5(_0x226407['error']['message']);}logger[_0x1de5('0xd')](_0x1de5('0x9'),_0x1cff35,_0x226407['error'][_0x1de5('0xf')]);return _0x172769(_0x226407['error'][_0x1de5('0xf')]);}else{logger[_0x1de5('0x10')](_0x1de5('0x9'),_0x1cff35,_0x1de5('0xb'));_0x172769(_0x226407[_0x1de5('0x11')][_0x1de5('0xf')]);}})[_0x1de5('0x12')](function(_0x4f9ca4){logger['error'](_0x1de5('0x9'),_0x1cff35,_0x4f9ca4);_0x2cb5e5(_0x4f9ca4);});});}exports['UpdateFaxApplication']=function(_0x5d27a7){var _0x3f4500=this;return new Promise(function(_0x7f1c0b,_0xa17890){return db[_0x1de5('0x13')][_0x1de5('0x14')](_0x5d27a7['body'],{'raw':_0x5d27a7['options']?_0x5d27a7[_0x1de5('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d27a7[_0x1de5('0x15')]?_0x5d27a7[_0x1de5('0x15')]['where']||null:null,'attributes':_0x5d27a7[_0x1de5('0x15')]?_0x5d27a7['options'][_0x1de5('0x16')]||null:null,'limit':_0x5d27a7[_0x1de5('0x15')]?_0x5d27a7[_0x1de5('0x15')][_0x1de5('0x17')]||null:null})[_0x1de5('0x18')](function(_0x5b8add){logger[_0x1de5('0x10')](_0x1de5('0x19'),_0x5d27a7);logger[_0x1de5('0x1a')](_0x1de5('0x19'),_0x5d27a7,JSON[_0x1de5('0xc')](_0x5b8add));_0x7f1c0b(_0x5b8add);})[_0x1de5('0x12')](function(_0x511ad6){logger[_0x1de5('0xd')](_0x1de5('0x19'),_0x511ad6[_0x1de5('0xf')],_0x5d27a7);_0xa17890(_0x3f4500[_0x1de5('0xd')](0x1f4,_0x511ad6['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 376a377..7707eed 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 _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2b7312,_0x599b03){var _0x2a72c9=function(_0x94cc67){while(--_0x94cc67){_0x2b7312['push'](_0x2b7312['shift']());}};_0x2a72c9(++_0x599b03);}(_0xac4a,0x13f));var _0xaac4=function(_0x4791a0,_0x484c47){_0x4791a0=_0x4791a0-0x0;var _0x436c6e=_0xac4a[_0x4791a0];return _0x436c6e;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router; \ No newline at end of file +var _0xb03e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x55260d,_0x340b49){var _0x3d27c2=function(_0x2efeb4){while(--_0x2efeb4){_0x55260d['push'](_0x55260d['shift']());}};_0x3d27c2(++_0x340b49);}(_0xb03e,0x1eb));var _0xeb03=function(_0x4a9e43,_0x5db671){_0x4a9e43=_0x4a9e43-0x0;var _0x68aeb5=_0xb03e[_0x4a9e43];return _0x68aeb5;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xe')]('/',auth[_0xeb03('0xb')](),controller['create']);router[_0xeb03('0xf')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller['update']);router[_0xeb03('0x10')]('/:id',auth[_0xeb03('0xb')](),controller[_0xeb03('0x11')]);module[_0xeb03('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 4855aa8..4c761b2 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 _0xadbd=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x42f452,_0x427052){var _0x1523ad=function(_0x432f32){while(--_0x432f32){_0x42f452['push'](_0x42f452['shift']());}};_0x1523ad(++_0x427052);}(_0xadbd,0x9c));var _0xdadb=function(_0x636bd7,_0x3f5d1e){_0x636bd7=_0x636bd7-0x0;var _0x16d442=_0xadbd[_0x636bd7];return _0x16d442;};'use strict';var Sequelize=require(_0xdadb('0x0'));module[_0xdadb('0x1')]={'closed':{'type':Sequelize[_0xdadb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdadb('0x3')]},'disposition':{'type':Sequelize[_0xdadb('0x4')]},'secondDisposition':{'type':Sequelize[_0xdadb('0x4')]},'thirdDisposition':{'type':Sequelize[_0xdadb('0x4')]},'note':{'type':Sequelize[_0xdadb('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xdadb('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xdadb('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdadb('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xdadb('0x5')]('in',_0xdadb('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x266b=['out','ENUM','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x266b,0xcd));var _0xb266=function(_0x2e8f3a,_0x2a89fd){_0x2e8f3a=_0x2e8f3a-0x0;var _0xcac0cf=_0x266b[_0x2e8f3a];return _0xcac0cf;};'use strict';var Sequelize=require(_0xb266('0x0'));module[_0xb266('0x1')]={'closed':{'type':Sequelize[_0xb266('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb266('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb266('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb266('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb266('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb266('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb266('0x6')]('in',_0xb266('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 3818558..9a88a30 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 _0xf671=['User','$substring','UserId','keys','some','compact','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','isEmpty','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','user','sequelize','toString','a.key','Account.key','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','rows','catch','show','params','includeAll','include','merge','options','create','body','describe','FaxMessage','ids','omit','findOne','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','faxInteractionTags:save','removeTags','download','unix','root','server','tmp','join','attachments','format','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','end','error','name','Users','map','TagIds','Tags','split','forEach','push','then','index','FaxInteraction','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union'];(function(_0x2531e9,_0x295ccc){var _0x15c3ea=function(_0x5d4054){while(--_0x5d4054){_0x2531e9['push'](_0x2531e9['shift']());}};_0x15c3ea(++_0x295ccc);}(_0xf671,0x6a));var _0x1f67=function(_0x12908b,_0x2abc84){_0x12908b=_0x12908b-0x0;var _0x5e6384=_0xf671[_0x12908b];return _0x5e6384;};'use strict';var emlformat=require(_0x1f67('0x0'));var rimraf=require(_0x1f67('0x1'));var zipdir=require(_0x1f67('0x2'));var jsonpatch=require(_0x1f67('0x3'));var rp=require(_0x1f67('0x4'));var moment=require(_0x1f67('0x5'));var BPromise=require(_0x1f67('0x6'));var Mustache=require('mustache');var util=require(_0x1f67('0x7'));var path=require(_0x1f67('0x8'));var sox=require(_0x1f67('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f67('0xa'));var _=require(_0x1f67('0xb'));var squel=require(_0x1f67('0xc'));var crypto=require(_0x1f67('0xd'));var jsforce=require(_0x1f67('0xe'));var deskjs=require(_0x1f67('0xf'));var toCsv=require(_0x1f67('0x10'));var querystring=require(_0x1f67('0x11'));var Papa=require(_0x1f67('0x12'));var Redis=require(_0x1f67('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1f67('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f67('0x15'))(_0x1f67('0x16'));var utils=require(_0x1f67('0x17'));var config=require(_0x1f67('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1f67('0x19'))['db'];config[_0x1f67('0x1a')]=_['defaults'](config['redis'],{'host':_0x1f67('0x1b'),'port':0x18eb});var socket=require(_0x1f67('0x1c'))(new Redis(config['redis']));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x2aee18,_0x37979e){_0x37979e=_0x37979e||0xcc;return function(_0x6385eb){if(_0x6385eb){return _0x2aee18[_0x1f67('0x1d')](_0x37979e);}return _0x2aee18[_0x1f67('0x1e')](_0x37979e)['end']();};}function respondWithResult(_0x5796b8,_0x44d68e){_0x44d68e=_0x44d68e||0xc8;return function(_0x11c717){if(_0x11c717){return _0x5796b8[_0x1f67('0x1e')](_0x44d68e)[_0x1f67('0x1f')](_0x11c717);}};}function respondWithFilteredResult(_0x38d77a,_0x5625d9){return function(_0x5e8110){if(_0x5e8110){var _0x3e5872=typeof _0x5625d9[_0x1f67('0x20')]===_0x1f67('0x21')&&typeof _0x5625d9[_0x1f67('0x22')]===_0x1f67('0x21');var _0x594105=_0x5e8110[_0x1f67('0x23')];var _0x2d15da=_0x3e5872?0x0:_0x5625d9[_0x1f67('0x20')];var _0x435545=_0x3e5872?_0x5e8110[_0x1f67('0x23')]:_0x5625d9[_0x1f67('0x20')]+_0x5625d9[_0x1f67('0x22')];var _0x55dce3;if(_0x435545>=_0x594105){_0x435545=_0x594105;_0x55dce3=0xc8;}else{_0x55dce3=0xce;}_0x38d77a[_0x1f67('0x1e')](_0x55dce3);return _0x38d77a[_0x1f67('0x24')]('Content-Range',_0x2d15da+'-'+_0x435545+'/'+_0x594105)['json'](_0x5e8110);}return null;};}function patchUpdates(_0x249d20){return function(_0x301223){try{jsonpatch[_0x1f67('0x25')](_0x301223,_0x249d20,!![]);}catch(_0x50b54f){return BPromise[_0x1f67('0x26')](_0x50b54f);}return _0x301223[_0x1f67('0x27')]();};}function saveUpdates(_0x275de3,_0x44608e){return function(_0x55e0c5){if(_0x55e0c5){return _0x55e0c5[_0x1f67('0x28')](_0x275de3)['then'](function(_0xee4684){return _0xee4684;});}return null;};}function removeEntity(_0x3688ed,_0x23eb8b){return function(_0x353ba5){if(_0x353ba5){return _0x353ba5[_0x1f67('0x29')]()['then'](function(){_0x3688ed[_0x1f67('0x1e')](0xcc)[_0x1f67('0x2a')]();});}};}function handleEntityNotFound(_0x190fdb,_0x52362e){return function(_0x4f4994){if(!_0x4f4994){_0x190fdb[_0x1f67('0x1d')](0x194);}return _0x4f4994;};}function handleError(_0x1339b0,_0x3c4902){_0x3c4902=_0x3c4902||0x1f4;return function(_0xb68ac1){logger[_0x1f67('0x2b')](_0xb68ac1['stack']);if(_0xb68ac1[_0x1f67('0x2c')]){delete _0xb68ac1['name'];}_0x1339b0[_0x1f67('0x1e')](_0x3c4902)['send'](_0xb68ac1);};}function getInteractionUsers(_0x44f3e8,_0x524414){return new BPromise(function(_0x4c0d93,_0x3e756f){try{if(_0x524414[_0x44f3e8['id']]){_0x44f3e8[_0x1f67('0x2d')]=_[_0x1f67('0x2e')](_0x524414[_0x44f3e8['id']],function(_0x495661){return{'id':_0x495661['id'],'fullname':_0x495661['fullname']};});}}catch(_0x5852ab){_0x3e756f(_0x5852ab);}_0x4c0d93(_0x44f3e8);});}function getInteractionTags(_0x1e9cff,_0x132235){return new BPromise(function(_0x190f7b,_0x1ccd62){try{if(_0x1e9cff[_0x1f67('0x2f')]){_0x1e9cff[_0x1f67('0x30')]=[];_0x1e9cff[_0x1f67('0x2f')][_0x1f67('0x31')](',')[_0x1f67('0x32')](function(_0x101038){_0x1e9cff[_0x1f67('0x30')][_0x1f67('0x33')](_0x132235[_0x101038]);});}delete _0x1e9cff['TagIds'];}catch(_0x235f9d){_0x1ccd62(_0x235f9d);}_0x190f7b(_0x1e9cff);});}function updateFaxInteraction(_0xbfff25,_0xf772f6,_0x2d425f){return new BPromise(function(_0x214ab0,_0x29103f){return getInteractionUsers(_0xbfff25,_0x2d425f)['then'](function(_0x365ef6){return getInteractionTags(_0x365ef6,_0xf772f6);})[_0x1f67('0x34')](function(_0x30e333){_0x214ab0(_0x30e333);})['catch'](function(_0x4749cc){_0x29103f(_0x4749cc);});});}exports[_0x1f67('0x35')]=function(_0x4fce0a,_0xb49862){var _0x4af23f={},_0x437a88={},_0x4ca8b2={'count':0x0,'rows':[]};var _0x4ab74a=_[_0x1f67('0x2e')](db[_0x1f67('0x36')][_0x1f67('0x37')],function(_0x406f36){return{'name':_0x406f36[_0x1f67('0x38')],'type':_0x406f36[_0x1f67('0x39')]['key']};});_0x437a88[_0x1f67('0x3a')]=_[_0x1f67('0x2e')](_0x4ab74a,_0x1f67('0x2c'));_0x437a88[_0x1f67('0x3b')]=_['keys'](_0x4fce0a[_0x1f67('0x3b')]);_0x437a88[_0x1f67('0x3c')]=_[_0x1f67('0x3d')](_0x437a88['model'],_0x437a88[_0x1f67('0x3b')]);_0x4af23f[_0x1f67('0x3e')]=_[_0x1f67('0x3d')](_0x437a88['model'],qs[_0x1f67('0x3f')](_0x4fce0a[_0x1f67('0x3b')]['fields']));_0x4af23f[_0x1f67('0x3e')]=_0x4af23f[_0x1f67('0x3e')][_0x1f67('0x40')]?_0x4af23f['attributes']:_0x437a88['model'];if(!_0x4fce0a['query'][_0x1f67('0x41')](_0x1f67('0x42'))){_0x4af23f['limit']=qs[_0x1f67('0x22')](_0x4fce0a['query'][_0x1f67('0x22')]);_0x4af23f[_0x1f67('0x20')]=qs[_0x1f67('0x20')](_0x4fce0a[_0x1f67('0x3b')][_0x1f67('0x20')]);}_0x4af23f[_0x1f67('0x43')]=qs[_0x1f67('0x44')](_0x4fce0a[_0x1f67('0x3b')]['sort']);_0x4af23f[_0x1f67('0x45')]=qs[_0x1f67('0x3c')](_[_0x1f67('0x46')](_0x4fce0a[_0x1f67('0x3b')],_0x437a88['filters']),_0x4ab74a);var _0x1902d5=[];var _0x243074=squel[_0x1f67('0x47')]()[_0x1f67('0x48')]('id')['field'](_0x1f67('0x2c'))[_0x1f67('0x48')](_0x1f67('0x49'))['from'](_0x1f67('0x4a'));var _0x2e884e=squel[_0x1f67('0x47')]()[_0x1f67('0x48')]('u.id')[_0x1f67('0x48')](_0x1f67('0x4b'))['field'](_0x1f67('0x4c'))['from'](_0x1f67('0x4d'),'ui')[_0x1f67('0x4e')](_0x1f67('0x4f'),'u',_0x1f67('0x50'));var _0x77b90a=squel[_0x1f67('0x47')]()['from'](_0x1f67('0x51'),'i')[_0x1f67('0x4e')](_0x1f67('0x52'),'c',_0x1f67('0x53'))[_0x1f67('0x4e')]('users','o',_0x1f67('0x54'))['left_join'](_0x1f67('0x55'),'a',_0x1f67('0x56'))[_0x1f67('0x4e')]('fax_messages','me',_0x1f67('0x57'))[_0x1f67('0x4e')](_0x1f67('0x58'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x1f67('0x4e')](_0x1f67('0x4a'),'t',_0x1f67('0x59'));var _0x322dec=squel[_0x1f67('0x5a')]();var _0x8b8574=[];var _0x1261b3=squel[_0x1f67('0x5a')]();var _0x4674da;if(_0x4fce0a[_0x1f67('0x3b')][_0x1f67('0x5b')]){_0x4674da=as[_0x1f67('0x5c')](_0x4fce0a['query'][_0x1f67('0x5b')]);var _0x1b1c9a=_0x4674da[_0x1f67('0x5d')];for(var _0x5e5782=0x0;_0x5e5782<_0x4674da[_0x1f67('0x5e')][_0x1f67('0x40')];_0x5e5782++){var _0x482a64=_0x4674da['conditions'][_0x5e5782];var _0x2ff226='i';var _0x404669=_[_0x1f67('0x5f')](_0x4ab74a,[_0x1f67('0x2c'),_0x482a64['field']]);if(!_0x404669){switch(_0x482a64[_0x1f67('0x48')]){case _0x1f67('0x60'):if(_0x482a64['value']==0x1){_0x77b90a[_0x1f67('0x61')]('`'+_0x482a64['field']+_0x1f67('0x62'));}else{_0x77b90a[_0x1f67('0x61')]('`'+_0x482a64['field']+_0x1f67('0x63'));}break;case _0x1f67('0x64'):if(_0x482a64[_0x1f67('0x65')]==='$substring'){if(_0x482a64[_0x1f67('0x66')][_0x1f67('0x31')]('\x20')[_0x1f67('0x40')]>0x1){_0x322dec[_0x1b1c9a](_0x1f67('0x67'),qs['getFullTextValue'](_0x482a64[_0x1f67('0x66')]),null);}else{var _0x95744b='%'+_0x482a64[_0x1f67('0x66')]+'%';_0x322dec[_0x1b1c9a](_0x1f67('0x68'),_0x95744b,_0x95744b,_0x95744b);}}else{_0x404669=_[_0x1f67('0x5f')](_0x4ab74a,[_0x1f67('0x2c'),_0x1f67('0x69')]);_0x482a64[_0x1f67('0x48')]=_0x1f67('0x69');_0x4c98ec=as[_0x1f67('0x6a')](_0x2ff226,_0x404669[_0x1f67('0x39')],_0x482a64);_0x322dec[_0x1b1c9a](_0x4c98ec[_0x1f67('0x6b')],_0x4c98ec['value'][_0x1f67('0x6c')],_0x4c98ec[_0x1f67('0x66')][_0x1f67('0x2a')]);}break;case _0x1f67('0x6d'):var _0x5c5f3e=_0x482a64[_0x1f67('0x66')][_0x1f67('0x31')](',')[_0x1f67('0x2e')](function(_0x895f4c){return Number(_0x895f4c);});_0x5c5f3e[_0x1f67('0x32')](function(_0x4a27fd){_0x1261b3['or'](_0x1f67('0x6e'),'%,'+_0x4a27fd+',%');});_0x8b8574=_[_0x1f67('0x6f')](_0x8b8574,_0x5c5f3e);break;case _0x1f67('0x70'):if(_0x482a64[_0x1f67('0x65')]===_0x1f67('0x71')){_0x322dec[_0x1b1c9a]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x482a64['value']+'%',null);}else{_0x404669=_[_0x1f67('0x5f')](_0x4ab74a,['name',_0x1f67('0x72')]);_0x482a64[_0x1f67('0x48')]='UserId';_0x4c98ec=as[_0x1f67('0x6a')](_0x2ff226,_0x404669['type'],_0x482a64);_0x322dec[_0x1b1c9a](_0x4c98ec['text'],_0x4c98ec['value']['start'],_0x4c98ec['value'][_0x1f67('0x2a')]);}break;case'body':_0x4c98ec=as[_0x1f67('0x6a')]('me',null,_0x482a64);_0x322dec[_0x1b1c9a](_0x4c98ec[_0x1f67('0x6b')],_0x4c98ec[_0x1f67('0x66')][_0x1f67('0x6c')],_0x4c98ec[_0x1f67('0x66')]['end']);break;}}else{var _0x4c98ec=as[_0x1f67('0x6a')](_0x2ff226,_0x404669[_0x1f67('0x39')],_0x482a64);_0x322dec[_0x1b1c9a](_0x4c98ec[_0x1f67('0x6b')],_0x4c98ec[_0x1f67('0x66')][_0x1f67('0x6c')],_0x4c98ec[_0x1f67('0x66')][_0x1f67('0x2a')]);}}}else{var _0xa830e4=_(_0x4fce0a['query'])[_0x1f67('0x73')]()['map'](function(_0x5279a1){return _[_0x1f67('0x74')](_0x4ab74a,[_0x1f67('0x2c'),_0x5279a1])?_0x5279a1:undefined;})[_0x1f67('0x75')]()['value']();if(!_['isEmpty'](_0xa830e4)){_0xa830e4[_0x1f67('0x32')](function(_0x4444af){if(_0x4444af==='FaxAccountId'){_0x77b90a['where'](_0x1f67('0x76'),[][_0x1f67('0x77')](_0x4fce0a[_0x1f67('0x3b')][_0x4444af]));}else if(_0x4444af===_0x1f67('0x78')){var _0x5d507a=JSON[_0x1f67('0x79')](_0x4fce0a[_0x1f67('0x3b')][_0x4444af])[_0x1f67('0x7a')];var _0x19a692=JSON[_0x1f67('0x79')](_0x4fce0a[_0x1f67('0x3b')][_0x4444af])[_0x1f67('0x7b')];_0x77b90a[_0x1f67('0x45')](_0x1f67('0x7c'),_0x5d507a,_0x19a692);}else{if(_0x4fce0a[_0x1f67('0x3b')][_0x4444af]==='null'){_0x77b90a[_0x1f67('0x45')]('i.'+_0x4444af+_0x1f67('0x7d'));}else{_0x77b90a[_0x1f67('0x45')]('i.'+_0x4444af+'\x20=\x20?',_0x4fce0a['query'][_0x4444af]);}}});}if(_0x4fce0a[_0x1f67('0x3b')]['read']){if(_0x4fce0a[_0x1f67('0x3b')]['read']==0x1){_0x77b90a[_0x1f67('0x61')](_0x1f67('0x7e'));}else{_0x77b90a[_0x1f67('0x61')](_0x1f67('0x7f'));}}if(_0x4fce0a[_0x1f67('0x3b')]['tag']){_0x8b8574=_[_0x1f67('0x80')](_0x4fce0a['query'][_0x1f67('0x81')])?_0x4fce0a[_0x1f67('0x3b')][_0x1f67('0x81')]:new Array(_0x4fce0a[_0x1f67('0x3b')][_0x1f67('0x81')]);_0x8b8574['forEach'](function(_0x25cfbb){_0x1261b3['or'](_0x1f67('0x6e'),'%,'+_0x25cfbb+',%');});}if(_0x4fce0a[_0x1f67('0x3b')][_0x1f67('0x82')]){var _0x4c03b0=_0x4fce0a[_0x1f67('0x3b')][_0x1f67('0x82')]['replace']('\x5c','\x5c\x5c')[_0x1f67('0x83')](/'/g,'\x27\x27');if(qs[_0x1f67('0x84')](_0x4c03b0)){_0x322dec['or'](_0x1f67('0x85'),_0x4c03b0+'%')['or'](_0x1f67('0x86'),_0x4c03b0+'%');}_0x322dec['or'](_0x1f67('0x87'),_0x4c03b0+'%');}}_0x77b90a['where'](_0x322dec);_0x77b90a[_0x1f67('0x88')](_0x1f67('0x89'));var _0x20afd3={'type':db[_0x1f67('0x8a')][_0x1f67('0x8b')][_0x1f67('0x8c')],'raw':!![]};var _0x472d28=_0x77b90a[_0x1f67('0x8d')]();_0x472d28[_0x1f67('0x48')](_0x1f67('0x89'));_0x472d28[_0x1f67('0x48')](_0x1f67('0x8e'),_0x1f67('0x60'));if(_0x4af23f['order']){_0x4af23f['order'][_0x1f67('0x32')](function(_0x114ac0){var _0x42fee9=_0x114ac0[0x0]===_0x1f67('0x8f')?_0x114ac0[0x0]:'i.'+_0x114ac0[0x0];_0x77b90a[_0x1f67('0x43')](_0x42fee9,_0x114ac0[0x1]==='DESC'?![]:!![]);});}if(!_[_0x1f67('0x90')](_0x8b8574)){_0x77b90a[_0x1f67('0x61')](_0x1261b3);_0x472d28['where'](_0x1f67('0x91'),_0x8b8574);}BPromise[_0x1f67('0x92')]()[_0x1f67('0x34')](function(){if(!_0x4674da){if(_0x4fce0a['query'][_0x1f67('0x93')])return;_0x472d28[_0x1f67('0x45')](_0x1f67('0x94'));_0x77b90a['where'](_0x1f67('0x94'));return;}if(_0x4fce0a['user'][_0x1f67('0x95')]!==_0x1f67('0x96'))return;return _0x4fce0a['user'][_0x1f67('0x97')]({'attributes':['id'],'raw':!![]})[_0x1f67('0x34')](function(_0x2a3201){if(_[_0x1f67('0x90')](_0x2a3201)){_0x472d28['where']('i.FaxAccountId\x20IS\x20NULL');_0x77b90a[_0x1f67('0x45')](_0x1f67('0x98'));}else{_0x472d28[_0x1f67('0x45')](_0x1f67('0x76'),_[_0x1f67('0x2e')](_0x2a3201,'id'));_0x77b90a['where']('i.FaxAccountId\x20IN\x20?',_[_0x1f67('0x2e')](_0x2a3201,'id'));}});})[_0x1f67('0x34')](function(){if(_0x4fce0a[_0x1f67('0x99')]['role']===_0x1f67('0x96')&&!_0x4674da&&!_0x4fce0a[_0x1f67('0x3b')][_0x1f67('0x93')])return[];return db[_0x1f67('0x9a')][_0x1f67('0x3b')](_0x472d28[_0x1f67('0x9b')](),_0x20afd3);})[_0x1f67('0x34')](function(_0x53f0f1){_0x4ca8b2[_0x1f67('0x23')]=_0x53f0f1[_0x1f67('0x40')];if(_0x4ca8b2[_0x1f67('0x23')]===0x0)return[];return db[_0x1f67('0x9a')]['query'](_0x243074[_0x1f67('0x9b')](),_0x20afd3)['then'](function(_0x20e01f){_0x1902d5=_['keyBy'](_0x20e01f,'id');_0x20afd3=_['merge'](_0x20afd3,{'model':db[_0x1f67('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4fce0a['query']['fields']){_0x4af23f[_0x1f67('0x3e')]['forEach'](function(_0x4aab2f){_0x77b90a[_0x1f67('0x48')]('i.'+_0x4aab2f);});}else{_0x77b90a[_0x1f67('0x48')](_0x1f67('0x8e'),_0x1f67('0x60'));_0x77b90a['field'](_0x1f67('0x9c'),_0x1f67('0x9d'));_0x77b90a[_0x1f67('0x48')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x77b90a[_0x1f67('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',_0x1f67('0x8f'));_0x77b90a['field'](_0x1f67('0x9e'));_0x77b90a['field'](_0x1f67('0x9f'),_0x1f67('0xa0'));_0x77b90a['field'](_0x1f67('0xa1'),_0x1f67('0xa2'));_0x77b90a[_0x1f67('0x48')](_0x1f67('0xa3'),_0x1f67('0xa4'));_0x77b90a[_0x1f67('0x48')](_0x1f67('0xa5'),_0x1f67('0xa6'));_0x77b90a[_0x1f67('0x48')]('c.mobile',_0x1f67('0xa7'));_0x77b90a[_0x1f67('0x48')](_0x1f67('0xa8'),_0x1f67('0xa9'));_0x77b90a[_0x1f67('0x48')](_0x1f67('0xaa'),_0x1f67('0xab'));_0x77b90a[_0x1f67('0x48')](_0x1f67('0xac'),_0x1f67('0xad'));_0x77b90a[_0x1f67('0x48')](_0x1f67('0xae'),_0x1f67('0x2f'));}if(_0x4af23f[_0x1f67('0x22')])_0x77b90a[_0x1f67('0x22')](_0x4af23f[_0x1f67('0x22')]);if(_0x4af23f[_0x1f67('0x20')])_0x77b90a[_0x1f67('0x20')](_0x4af23f[_0x1f67('0x20')]);return db[_0x1f67('0x9a')]['query'](_0x77b90a[_0x1f67('0x9b')](),_0x20afd3);})[_0x1f67('0x34')](function(_0x289277){if(_0x289277[_0x1f67('0x40')]>0x0)_0x2e884e[_0x1f67('0x45')](_0x1f67('0xaf'),_[_0x1f67('0x2e')](_0x289277,'id'));return db[_0x1f67('0x9a')]['query'](_0x2e884e[_0x1f67('0x9b')](),_0x20afd3)[_0x1f67('0x34')](function(_0x585900){var _0x558694=_[_0x1f67('0xb0')](_0x585900,_0x1f67('0xb1'));var _0xc6e136=[];_0x289277[_0x1f67('0x32')](function(_0x278c48){_0xc6e136['push'](updateFaxInteraction(_0x278c48,_0x1902d5,_0x558694));});return BPromise['all'](_0xc6e136);});});})[_0x1f67('0x34')](function(_0x4729a8){_0x4ca8b2[_0x1f67('0xb2')]=_0x4729a8;return _0x4ca8b2;})[_0x1f67('0x34')](respondWithFilteredResult(_0xb49862,_0x4af23f))[_0x1f67('0xb3')](handleError(_0xb49862,null));};exports[_0x1f67('0xb4')]=function(_0x4c092a,_0x464a0f){var _0x46048c={'raw':![],'where':{'id':_0x4c092a[_0x1f67('0xb5')]['id']}},_0x202ff2={};_0x202ff2[_0x1f67('0x3a')]=_[_0x1f67('0x73')](db[_0x1f67('0x36')][_0x1f67('0x37')]);_0x202ff2['query']=_['keys'](_0x4c092a[_0x1f67('0x3b')]);_0x202ff2['filters']=_[_0x1f67('0x3d')](_0x202ff2[_0x1f67('0x3a')],_0x202ff2[_0x1f67('0x3b')]);_0x46048c['attributes']=_[_0x1f67('0x3d')](_0x202ff2['model'],qs[_0x1f67('0x3f')](_0x4c092a[_0x1f67('0x3b')][_0x1f67('0x3f')]));_0x46048c['attributes']=_0x46048c['attributes']['length']?_0x46048c[_0x1f67('0x3e')]:_0x202ff2[_0x1f67('0x3a')];if(_0x4c092a[_0x1f67('0x3b')][_0x1f67('0xb6')]){_0x46048c[_0x1f67('0xb7')]=[{'all':!![]}];}_0x46048c=_[_0x1f67('0xb8')]({},_0x46048c,_0x4c092a[_0x1f67('0xb9')]);return db[_0x1f67('0x36')]['find'](_0x46048c)[_0x1f67('0x34')](handleEntityNotFound(_0x464a0f,null))[_0x1f67('0x34')](respondWithResult(_0x464a0f,null))[_0x1f67('0xb3')](handleError(_0x464a0f,null));};exports[_0x1f67('0xba')]=function(_0x431eeb,_0x49d649){return db[_0x1f67('0x36')][_0x1f67('0xba')](_0x431eeb[_0x1f67('0xbb')],{})[_0x1f67('0x34')](respondWithResult(_0x49d649,0xc9))[_0x1f67('0xb3')](handleError(_0x49d649,null));};exports['update']=function(_0x367f47,_0x4032c2){if(_0x367f47['body']['id']){delete _0x367f47[_0x1f67('0xbb')]['id'];}return db['FaxInteraction'][_0x1f67('0x5f')]({'where':{'id':_0x367f47[_0x1f67('0xb5')]['id']}})[_0x1f67('0x34')](handleEntityNotFound(_0x4032c2,null))['then'](saveUpdates(_0x367f47[_0x1f67('0xbb')],null))[_0x1f67('0x34')](respondWithResult(_0x4032c2,null))[_0x1f67('0xb3')](handleError(_0x4032c2,null));};exports[_0x1f67('0x29')]=function(_0x189721,_0x43eda8){return db[_0x1f67('0x36')]['find']({'where':{'id':_0x189721['params']['id']}})[_0x1f67('0x34')](handleEntityNotFound(_0x43eda8,null))[_0x1f67('0x34')](removeEntity(_0x43eda8,null))[_0x1f67('0xb3')](handleError(_0x43eda8,null));};exports[_0x1f67('0xbc')]=function(_0x3fa5e3,_0x5ea349){return db[_0x1f67('0x36')][_0x1f67('0xbc')]()[_0x1f67('0x34')](respondWithResult(_0x5ea349,null))['catch'](handleError(_0x5ea349,null));};exports['addMessage']=function(_0x2d36df,_0x32968e,_0x4af6b2){return db[_0x1f67('0xbd')][_0x1f67('0x5f')]({'where':{'id':_0x2d36df[_0x1f67('0xb5')]['id']}})['then'](handleEntityNotFound(_0x32968e,null))[_0x1f67('0x34')](function(_0x5229df){if(_0x5229df){return _0x5229df['addMessage'](_0x2d36df[_0x1f67('0xbb')][_0x1f67('0xbe')],_[_0x1f67('0xbf')](_0x2d36df[_0x1f67('0xbb')],[_0x1f67('0xbe'),'id'])||{});}})[_0x1f67('0x34')](respondWithResult(_0x32968e,null))[_0x1f67('0xb3')](handleError(_0x32968e,null));};exports['getMessages']=function(_0x33ed58,_0x54c459,_0x40191a){var _0x29c6c5={'raw':![],'where':{}};var _0x4382f8={};var _0x523c8d={'count':0x0,'rows':[]};return db[_0x1f67('0x36')][_0x1f67('0xc0')]({'where':{'id':_0x33ed58[_0x1f67('0xb5')]['id']}})[_0x1f67('0x34')](handleEntityNotFound(_0x54c459,null))[_0x1f67('0x34')](function(_0x1771a2){if(_0x1771a2){_0x4382f8[_0x1f67('0x3a')]=_[_0x1f67('0x73')](db[_0x1f67('0xbd')][_0x1f67('0x37')]);_0x4382f8['query']=_[_0x1f67('0x73')](_0x33ed58['query']);_0x4382f8['filters']=_[_0x1f67('0x3d')](_0x4382f8[_0x1f67('0x3a')],_0x4382f8[_0x1f67('0x3b')]);_0x29c6c5[_0x1f67('0x3e')]=_[_0x1f67('0x3d')](_0x4382f8[_0x1f67('0x3a')],qs[_0x1f67('0x3f')](_0x33ed58['query']['fields']));_0x29c6c5[_0x1f67('0x3e')]=_0x29c6c5[_0x1f67('0x3e')][_0x1f67('0x40')]?_0x29c6c5['attributes']:_0x4382f8[_0x1f67('0x3a')];if(!_0x33ed58['query']['hasOwnProperty'](_0x1f67('0x42'))){_0x29c6c5['limit']=qs[_0x1f67('0x22')](_0x33ed58['query']['limit']);_0x29c6c5[_0x1f67('0x20')]=qs[_0x1f67('0x20')](_0x33ed58[_0x1f67('0x3b')]['offset']);}_0x29c6c5['order']=qs[_0x1f67('0x44')](_0x33ed58['query'][_0x1f67('0x44')]);_0x29c6c5[_0x1f67('0x45')]=qs[_0x1f67('0x3c')](_[_0x1f67('0x46')](_0x33ed58[_0x1f67('0x3b')],_0x4382f8[_0x1f67('0x3c')]));_0x29c6c5[_0x1f67('0x45')]['FaxInteractionId']=_0x1771a2['id'];if(_0x33ed58[_0x1f67('0x3b')][_0x1f67('0x82')]){_0x29c6c5['where']=_[_0x1f67('0xb8')](_0x29c6c5[_0x1f67('0x45')],{'$or':_[_0x1f67('0x2e')](_0x29c6c5['attributes'],function(_0x3bc753){var _0x37ddf7={};_0x37ddf7[_0x3bc753]={'$like':'%'+_0x33ed58[_0x1f67('0x3b')]['filter']+'%'};return _0x37ddf7;})});}if(_0x33ed58[_0x1f67('0x3b')]['$gte']){var _0x50d988=_0x33ed58[_0x1f67('0x3b')][_0x1f67('0x7a')][_0x1f67('0x31')](',');var _0x95e45a={};_0x95e45a[_0x50d988[0x0]]={'$gte':moment(_0x50d988[0x1])['format'](_0x1f67('0xc1'))};_0x29c6c5[_0x1f67('0x45')]=_[_0x1f67('0xb8')](_0x29c6c5[_0x1f67('0x45')],_0x95e45a);}_0x29c6c5=_[_0x1f67('0xb8')]({},_0x29c6c5,_0x33ed58[_0x1f67('0xb9')]);return db[_0x1f67('0xbd')]['count']({'where':_0x29c6c5[_0x1f67('0x45')]})[_0x1f67('0x34')](function(_0x7ad056){_0x523c8d['count']=_0x7ad056;if(_0x33ed58[_0x1f67('0x3b')][_0x1f67('0xb6')]){_0x29c6c5['include']=[{'all':!![]}];}return db[_0x1f67('0xbd')][_0x1f67('0xc2')](_0x29c6c5);})[_0x1f67('0x34')](function(_0xf202b9){_0x523c8d[_0x1f67('0xb2')]=_0xf202b9;return _0x523c8d;});}})[_0x1f67('0x34')](respondWithFilteredResult(_0x54c459,_0x29c6c5))['catch'](handleError(_0x54c459,null));};exports[_0x1f67('0xc3')]=function(_0x9bc248,_0xf98c35,_0x485ed7){return db[_0x1f67('0x36')][_0x1f67('0x5f')]({'where':{'id':_0x9bc248[_0x1f67('0xb5')]['id']}})[_0x1f67('0x34')](handleEntityNotFound(_0xf98c35,null))[_0x1f67('0x34')](function(_0x19a96c){if(_0x19a96c){return _0x19a96c[_0x1f67('0xc4')](_0x9bc248[_0x1f67('0xbb')]['ids'],_[_0x1f67('0xbf')](_0x9bc248['body'],[_0x1f67('0xbe'),'id'])||{})[_0x1f67('0xc5')](function(){return db['Tag']['findAll']({'attributes':['id',_0x1f67('0x2c'),_0x1f67('0x49')],'where':{'id':_0x9bc248[_0x1f67('0xbb')][_0x1f67('0xbe')]}});})[_0x1f67('0x34')](function(_0x4a461e){socket['emit'](_0x1f67('0xc6'),{'id':Number(_0x9bc248[_0x1f67('0xb5')]['id']),'tags':_0x4a461e||[]});return{'id':Number(_0x9bc248['params']['id']),'tags':_0x4a461e||[]};});}})[_0x1f67('0x34')](respondWithResult(_0xf98c35,null))[_0x1f67('0xb3')](handleError(_0xf98c35,null));};exports[_0x1f67('0xc7')]=function(_0x4e1816,_0x5660dc,_0x1013c2){return db['FaxInteraction'][_0x1f67('0x5f')]({'where':{'id':_0x4e1816['params']['id']}})['then'](handleEntityNotFound(_0x5660dc,null))[_0x1f67('0x34')](function(_0x327fa6){if(_0x327fa6){return _0x327fa6['removeTags'](_0x4e1816[_0x1f67('0x3b')][_0x1f67('0xbe')]);}})['then'](respondWithStatusCode(_0x5660dc,null))[_0x1f67('0xb3')](handleError(_0x5660dc,null));};exports[_0x1f67('0xc8')]=function(_0x291b0d,_0x132bd4){var _0x37c321=moment()[_0x1f67('0xc9')]()['toString']();var _0x4a5b9e=path['join'](config[_0x1f67('0xca')],_0x1f67('0xcb'),'files',_0x1f67('0xcc'));var _0x370bb9=path[_0x1f67('0xcd')](config['root'],_0x1f67('0xcb'),'files',_0x1f67('0xce'));var _0x3e155a=path[_0x1f67('0xcd')](_0x4a5b9e,_0x37c321);var _0x2125d4=util[_0x1f67('0xcf')]('transcript-%d-%s.zip',_0x291b0d[_0x1f67('0xb5')]['id'],_0x37c321);var _0x11141c=path[_0x1f67('0xcd')](_0x4a5b9e,_0x2125d4);var _0x8cf486=[];_0x8cf486[_0x1f67('0x33')]({'model':db[_0x1f67('0xd0')],'as':_0x1f67('0xd0'),'raw':!![]});var _0x2d48a5=[{'model':db[_0x1f67('0xbd')],'as':_0x1f67('0xd1'),'attributes':['id',_0x1f67('0xbb'),_0x1f67('0x78')],'include':_0x8cf486}];return db['FaxInteraction'][_0x1f67('0x5f')]({'where':{'id':_0x291b0d[_0x1f67('0xb5')]['id']},'include':_0x2d48a5})[_0x1f67('0x34')](handleEntityNotFound(_0x132bd4,null))['then'](function(_0xf7a3d){if(_0xf7a3d&&_0xf7a3d['Messages']){var _0x47b887=_0xf7a3d[_0x1f67('0xd2')]({'plain':!![]});fs[_0x1f67('0xd3')](_0x3e155a);for(var _0x54f6f8=0x0;_0x54f6f8<_0x47b887[_0x1f67('0xd1')]['length'];_0x54f6f8++){var _0x3310a2=_0x47b887[_0x1f67('0xd1')][_0x54f6f8][_0x1f67('0xd0')];if(_0x3310a2){var _0x3d77c4=path[_0x1f67('0xcd')](_0x370bb9,_0x3310a2[_0x1f67('0xd4')]);if(fs[_0x1f67('0xd5')](_0x3d77c4)){fs[_0x1f67('0xd6')](_0x3d77c4)[_0x1f67('0xd7')](fs[_0x1f67('0xd8')](path[_0x1f67('0xcd')](_0x3e155a,_0x3310a2[_0x1f67('0xd4')])));}}}return BPromise[_0x1f67('0x92')]()[_0x1f67('0x34')](function(){return new BPromise(function(_0x3847b6,_0x1c30ef){zipdir(_0x3e155a,{'saveTo':_0x11141c},function(_0x44d693,_0x577e6a){if(_0x44d693)return _0x1c30ef(_0x44d693);return _0x3847b6(_0x577e6a);});})[_0x1f67('0x34')](function(){return new BPromise(function(_0x2dca08,_0x168f25){rimraf(_0x3e155a,function(_0x125f95){if(_0x125f95)_0x168f25(_0x125f95);return _0x2dca08();});});})[_0x1f67('0x34')](function(){return _0x132bd4[_0x1f67('0xc8')](_0x11141c,_0x2125d4,function(_0x3d7b65){if(_0x3d7b65){console['log']('err',_0x3d7b65);}else{fs[_0x1f67('0xd9')](_0x11141c);}});});});}else{return _0x132bd4['sendStatus'](0xc8);}})['catch'](handleError(_0x132bd4,null));}; \ No newline at end of file +var _0x6c57=['update','params','describe','addMessage','FaxMessage','ids','omit','findOne','FaxInteractionId','$gte','options','includeAll','setTags','spread','findAll','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','format','Attachment','Messages','basename','existsSync','createReadStream','createWriteStream','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../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','register','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','length','value','`\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','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','find','UserId','body','some','compact','i.FaxAccountId\x20IN\x20?','concat','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','isEmpty','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','fields','include','create','FaxInteraction'];(function(_0x4d2993,_0x1c9473){var _0x427374=function(_0x149dfd){while(--_0x149dfd){_0x4d2993['push'](_0x4d2993['shift']());}};_0x427374(++_0x1c9473);}(_0x6c57,0xfe));var _0x76c5=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x6c57[_0x550d12];return _0x12103d;};'use strict';var emlformat=require(_0x76c5('0x0'));var rimraf=require(_0x76c5('0x1'));var zipdir=require(_0x76c5('0x2'));var jsonpatch=require(_0x76c5('0x3'));var rp=require(_0x76c5('0x4'));var moment=require(_0x76c5('0x5'));var BPromise=require(_0x76c5('0x6'));var Mustache=require(_0x76c5('0x7'));var util=require(_0x76c5('0x8'));var path=require('path');var sox=require(_0x76c5('0x9'));var csv=require(_0x76c5('0xa'));var ejs=require(_0x76c5('0xb'));var fs=require('fs');var fs_extra=require(_0x76c5('0xc'));var _=require(_0x76c5('0xd'));var squel=require(_0x76c5('0xe'));var crypto=require('crypto');var jsforce=require(_0x76c5('0xf'));var deskjs=require(_0x76c5('0x10'));var toCsv=require(_0x76c5('0xa'));var querystring=require(_0x76c5('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76c5('0x12'));var as=require(_0x76c5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x76c5('0x14'))(_0x76c5('0x15'));var utils=require(_0x76c5('0x16'));var config=require(_0x76c5('0x17'));var licenseUtil=require(_0x76c5('0x18'));var db=require(_0x76c5('0x19'))['db'];config[_0x76c5('0x1a')]=_[_0x76c5('0x1b')](config[_0x76c5('0x1a')],{'host':_0x76c5('0x1c'),'port':0x18eb});var socket=require(_0x76c5('0x1d'))(new Redis(config[_0x76c5('0x1a')]));require(_0x76c5('0x1e'))[_0x76c5('0x1f')](socket);function respondWithStatusCode(_0x5dcdec,_0x237c48){_0x237c48=_0x237c48||0xcc;return function(_0x1b0e6d){if(_0x1b0e6d){return _0x5dcdec[_0x76c5('0x20')](_0x237c48);}return _0x5dcdec[_0x76c5('0x21')](_0x237c48)[_0x76c5('0x22')]();};}function respondWithResult(_0x374b96,_0x4b1b60){_0x4b1b60=_0x4b1b60||0xc8;return function(_0x20849a){if(_0x20849a){return _0x374b96[_0x76c5('0x21')](_0x4b1b60)['json'](_0x20849a);}};}function respondWithFilteredResult(_0x5e4590,_0x35a525){return function(_0x28dc40){if(_0x28dc40){var _0x583b9d=typeof _0x35a525[_0x76c5('0x23')]==='undefined'&&typeof _0x35a525[_0x76c5('0x24')]==='undefined';var _0x387e2b=_0x28dc40[_0x76c5('0x25')];var _0x3424a0=_0x583b9d?0x0:_0x35a525[_0x76c5('0x23')];var _0x4a1763=_0x583b9d?_0x28dc40[_0x76c5('0x25')]:_0x35a525[_0x76c5('0x23')]+_0x35a525[_0x76c5('0x24')];var _0x1d98cd;if(_0x4a1763>=_0x387e2b){_0x4a1763=_0x387e2b;_0x1d98cd=0xc8;}else{_0x1d98cd=0xce;}_0x5e4590['status'](_0x1d98cd);return _0x5e4590[_0x76c5('0x26')](_0x76c5('0x27'),_0x3424a0+'-'+_0x4a1763+'/'+_0x387e2b)[_0x76c5('0x28')](_0x28dc40);}return null;};}function patchUpdates(_0x513267){return function(_0x52b00a){try{jsonpatch[_0x76c5('0x29')](_0x52b00a,_0x513267,!![]);}catch(_0x1ab095){return BPromise['reject'](_0x1ab095);}return _0x52b00a[_0x76c5('0x2a')]();};}function saveUpdates(_0x547b1e,_0x1a499a){return function(_0x3879df){if(_0x3879df){return _0x3879df['update'](_0x547b1e)[_0x76c5('0x2b')](function(_0x3f882b){return _0x3f882b;});}return null;};}function removeEntity(_0x3616e6,_0x3741c3){return function(_0x2d3a38){if(_0x2d3a38){return _0x2d3a38[_0x76c5('0x2c')]()['then'](function(){_0x3616e6[_0x76c5('0x21')](0xcc)[_0x76c5('0x22')]();});}};}function handleEntityNotFound(_0x114e7b,_0x13b36b){return function(_0x5d1640){if(!_0x5d1640){_0x114e7b[_0x76c5('0x20')](0x194);}return _0x5d1640;};}function handleError(_0x25cf9b,_0x499742){_0x499742=_0x499742||0x1f4;return function(_0x359cc1){logger[_0x76c5('0x2d')](_0x359cc1[_0x76c5('0x2e')]);if(_0x359cc1['name']){delete _0x359cc1[_0x76c5('0x2f')];}_0x25cf9b[_0x76c5('0x21')](_0x499742)[_0x76c5('0x30')](_0x359cc1);};}function getInteractionUsers(_0x326787,_0x3d5ce3){return new BPromise(function(_0x1f03c9,_0x2f9e86){try{if(_0x3d5ce3[_0x326787['id']]){_0x326787[_0x76c5('0x31')]=_[_0x76c5('0x32')](_0x3d5ce3[_0x326787['id']],function(_0x584c30){return{'id':_0x584c30['id'],'fullname':_0x584c30[_0x76c5('0x33')]};});}}catch(_0x23466b){_0x2f9e86(_0x23466b);}_0x1f03c9(_0x326787);});}function getInteractionTags(_0x53b178,_0x33a9e9){return new BPromise(function(_0x5b3fcf,_0xe641cb){try{if(_0x53b178[_0x76c5('0x34')]){_0x53b178[_0x76c5('0x35')]=[];_0x53b178[_0x76c5('0x34')][_0x76c5('0x36')](',')[_0x76c5('0x37')](function(_0x4361d6){_0x53b178['Tags'][_0x76c5('0x38')](_0x33a9e9[_0x4361d6]);});}delete _0x53b178[_0x76c5('0x34')];}catch(_0x4b6576){_0xe641cb(_0x4b6576);}_0x5b3fcf(_0x53b178);});}function updateFaxInteraction(_0x59063d,_0x5ea211,_0x3ccd7e){return new BPromise(function(_0x3f2daf,_0x575db0){return getInteractionUsers(_0x59063d,_0x3ccd7e)[_0x76c5('0x2b')](function(_0x22a469){return getInteractionTags(_0x22a469,_0x5ea211);})[_0x76c5('0x2b')](function(_0x199024){_0x3f2daf(_0x199024);})[_0x76c5('0x39')](function(_0x8e64eb){_0x575db0(_0x8e64eb);});});}exports[_0x76c5('0x3a')]=function(_0x17d454,_0x23ecab){var _0x112601={},_0x34ba04={},_0x288b09={'count':0x0,'rows':[]};var _0x5a09bf=_[_0x76c5('0x32')](db['FaxInteraction'][_0x76c5('0x3b')],function(_0xa580d8){return{'name':_0xa580d8[_0x76c5('0x3c')],'type':_0xa580d8[_0x76c5('0x3d')][_0x76c5('0x3e')]};});_0x34ba04[_0x76c5('0x3f')]=_[_0x76c5('0x32')](_0x5a09bf,'name');_0x34ba04[_0x76c5('0x40')]=_[_0x76c5('0x41')](_0x17d454[_0x76c5('0x40')]);_0x34ba04[_0x76c5('0x42')]=_[_0x76c5('0x43')](_0x34ba04['model'],_0x34ba04['query']);_0x112601[_0x76c5('0x44')]=_[_0x76c5('0x43')](_0x34ba04['model'],qs['fields'](_0x17d454[_0x76c5('0x40')]['fields']));_0x112601[_0x76c5('0x44')]=_0x112601[_0x76c5('0x44')]['length']?_0x112601[_0x76c5('0x44')]:_0x34ba04[_0x76c5('0x3f')];if(!_0x17d454[_0x76c5('0x40')][_0x76c5('0x45')](_0x76c5('0x46'))){_0x112601[_0x76c5('0x24')]=qs[_0x76c5('0x24')](_0x17d454[_0x76c5('0x40')][_0x76c5('0x24')]);_0x112601[_0x76c5('0x23')]=qs[_0x76c5('0x23')](_0x17d454[_0x76c5('0x40')][_0x76c5('0x23')]);}_0x112601[_0x76c5('0x47')]=qs['sort'](_0x17d454['query'][_0x76c5('0x48')]);_0x112601[_0x76c5('0x49')]=qs[_0x76c5('0x42')](_[_0x76c5('0x4a')](_0x17d454[_0x76c5('0x40')],_0x34ba04[_0x76c5('0x42')]),_0x5a09bf);var _0xee6624=[];var _0x2e897e=squel['select']()[_0x76c5('0x4b')]('id')[_0x76c5('0x4b')](_0x76c5('0x2f'))[_0x76c5('0x4b')](_0x76c5('0x4c'))[_0x76c5('0x4d')](_0x76c5('0x4e'));var _0x455877=squel['select']()['field'](_0x76c5('0x4f'))[_0x76c5('0x4b')](_0x76c5('0x50'))[_0x76c5('0x4b')](_0x76c5('0x51'))['from'](_0x76c5('0x52'),'ui')[_0x76c5('0x53')]('users','u',_0x76c5('0x54'));var _0x41f7c7=squel['select']()[_0x76c5('0x4d')](_0x76c5('0x55'),'i')[_0x76c5('0x53')](_0x76c5('0x56'),'c',_0x76c5('0x57'))[_0x76c5('0x53')](_0x76c5('0x58'),'o',_0x76c5('0x59'))[_0x76c5('0x53')]('fax_accounts','a',_0x76c5('0x5a'))[_0x76c5('0x53')](_0x76c5('0x5b'),'me','me.FaxInteractionId\x20=\x20i.id')['left_join'](_0x76c5('0x5c'),'it','it.FaxInteractionId\x20=\x20i.id')['left_join'](_0x76c5('0x4e'),'t',_0x76c5('0x5d'));var _0x370310=squel['expr']();var _0x679795=[];var _0x20ad21=squel[_0x76c5('0x5e')]();var _0xc43361;if(_0x17d454['query'][_0x76c5('0x5f')]){_0xc43361=as['parseSearch'](_0x17d454[_0x76c5('0x40')][_0x76c5('0x5f')]);var _0x5c0927=_0xc43361['sqlOperator'];for(var _0x2b05af=0x0;_0x2b05af<_0xc43361['conditions'][_0x76c5('0x60')];_0x2b05af++){var _0x3b803b=_0xc43361['conditions'][_0x2b05af];var _0x3ba91d='i';var _0x40e4f2=_['find'](_0x5a09bf,[_0x76c5('0x2f'),_0x3b803b[_0x76c5('0x4b')]]);if(!_0x40e4f2){switch(_0x3b803b[_0x76c5('0x4b')]){case'unreadMessages':if(_0x3b803b[_0x76c5('0x61')]==0x1){_0x41f7c7['having']('`'+_0x3b803b[_0x76c5('0x4b')]+_0x76c5('0x62'));}else{_0x41f7c7['having']('`'+_0x3b803b['field']+_0x76c5('0x63'));}break;case _0x76c5('0x64'):if(_0x3b803b[_0x76c5('0x65')]===_0x76c5('0x66')){if(_0x3b803b[_0x76c5('0x61')][_0x76c5('0x36')]('\x20')[_0x76c5('0x60')]>0x1){_0x370310[_0x5c0927](_0x76c5('0x67'),qs[_0x76c5('0x68')](_0x3b803b['value']),null);}else{var _0x3db212='%'+_0x3b803b[_0x76c5('0x61')]+'%';_0x370310[_0x5c0927](_0x76c5('0x69'),_0x3db212,_0x3db212,_0x3db212);}}else{_0x40e4f2=_['find'](_0x5a09bf,[_0x76c5('0x2f'),_0x76c5('0x6a')]);_0x3b803b[_0x76c5('0x4b')]=_0x76c5('0x6a');_0x235ff2=as[_0x76c5('0x6b')](_0x3ba91d,_0x40e4f2[_0x76c5('0x3d')],_0x3b803b);_0x370310[_0x5c0927](_0x235ff2[_0x76c5('0x6c')],_0x235ff2[_0x76c5('0x61')][_0x76c5('0x6d')],_0x235ff2[_0x76c5('0x61')][_0x76c5('0x22')]);}break;case _0x76c5('0x6e'):var _0x466219=_0x3b803b[_0x76c5('0x61')][_0x76c5('0x36')](',')[_0x76c5('0x32')](function(_0x4bf5da){return Number(_0x4bf5da);});_0x466219[_0x76c5('0x37')](function(_0x5176f2){_0x20ad21['or'](_0x76c5('0x6f'),'%,'+_0x5176f2+',%');});_0x679795=_['union'](_0x679795,_0x466219);break;case _0x76c5('0x70'):if(_0x3b803b[_0x76c5('0x65')]===_0x76c5('0x66')){_0x370310[_0x5c0927]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3b803b[_0x76c5('0x61')]+'%',null);}else{_0x40e4f2=_[_0x76c5('0x71')](_0x5a09bf,[_0x76c5('0x2f'),_0x76c5('0x72')]);_0x3b803b[_0x76c5('0x4b')]='UserId';_0x235ff2=as['buildExpression'](_0x3ba91d,_0x40e4f2['type'],_0x3b803b);_0x370310[_0x5c0927](_0x235ff2[_0x76c5('0x6c')],_0x235ff2[_0x76c5('0x61')][_0x76c5('0x6d')],_0x235ff2['value'][_0x76c5('0x22')]);}break;case _0x76c5('0x73'):_0x235ff2=as[_0x76c5('0x6b')]('me',null,_0x3b803b);_0x370310[_0x5c0927](_0x235ff2[_0x76c5('0x6c')],_0x235ff2[_0x76c5('0x61')][_0x76c5('0x6d')],_0x235ff2[_0x76c5('0x61')]['end']);break;}}else{var _0x235ff2=as[_0x76c5('0x6b')](_0x3ba91d,_0x40e4f2[_0x76c5('0x3d')],_0x3b803b);_0x370310[_0x5c0927](_0x235ff2['text'],_0x235ff2[_0x76c5('0x61')][_0x76c5('0x6d')],_0x235ff2[_0x76c5('0x61')][_0x76c5('0x22')]);}}}else{var _0x2f1678=_(_0x17d454['query'])['keys']()[_0x76c5('0x32')](function(_0xb4ff02){return _[_0x76c5('0x74')](_0x5a09bf,['name',_0xb4ff02])?_0xb4ff02:undefined;})[_0x76c5('0x75')]()[_0x76c5('0x61')]();if(!_['isEmpty'](_0x2f1678)){_0x2f1678[_0x76c5('0x37')](function(_0xcb9fa2){if(_0xcb9fa2==='FaxAccountId'){_0x41f7c7['where'](_0x76c5('0x76'),[][_0x76c5('0x77')](_0x17d454[_0x76c5('0x40')][_0xcb9fa2]));}else if(_0xcb9fa2===_0x76c5('0x78')){var _0x4c7990=JSON['parse'](_0x17d454[_0x76c5('0x40')][_0xcb9fa2])['$gte'];var _0x15ab54=JSON['parse'](_0x17d454[_0x76c5('0x40')][_0xcb9fa2])[_0x76c5('0x79')];_0x41f7c7['where'](_0x76c5('0x7a'),_0x4c7990,_0x15ab54);}else{if(_0x17d454[_0x76c5('0x40')][_0xcb9fa2]===_0x76c5('0x7b')){_0x41f7c7['where']('i.'+_0xcb9fa2+_0x76c5('0x7c'));}else{_0x41f7c7[_0x76c5('0x49')]('i.'+_0xcb9fa2+_0x76c5('0x7d'),_0x17d454['query'][_0xcb9fa2]);}}});}if(_0x17d454[_0x76c5('0x40')][_0x76c5('0x7e')]){if(_0x17d454[_0x76c5('0x40')][_0x76c5('0x7e')]==0x1){_0x41f7c7[_0x76c5('0x7f')](_0x76c5('0x80'));}else{_0x41f7c7[_0x76c5('0x7f')](_0x76c5('0x81'));}}if(_0x17d454['query'][_0x76c5('0x82')]){_0x679795=_['isArray'](_0x17d454[_0x76c5('0x40')][_0x76c5('0x82')])?_0x17d454['query'][_0x76c5('0x82')]:new Array(_0x17d454['query']['tag']);_0x679795[_0x76c5('0x37')](function(_0x2cc172){_0x20ad21['or'](_0x76c5('0x6f'),'%,'+_0x2cc172+',%');});}if(_0x17d454[_0x76c5('0x40')][_0x76c5('0x83')]){var _0x217694=_0x17d454[_0x76c5('0x40')][_0x76c5('0x83')]['replace']('\x5c','\x5c\x5c')[_0x76c5('0x84')](/'/g,'\x27\x27');if(qs[_0x76c5('0x85')](_0x217694)){_0x370310['or'](_0x76c5('0x86'),_0x217694+'%')['or'](_0x76c5('0x87'),_0x217694+'%');}_0x370310['or'](_0x76c5('0x88'),_0x217694+'%');}}_0x41f7c7[_0x76c5('0x49')](_0x370310);_0x41f7c7['group'](_0x76c5('0x89'));var _0x50b9df={'type':db[_0x76c5('0x8a')][_0x76c5('0x8b')][_0x76c5('0x8c')],'raw':!![]};var _0x52c433=_0x41f7c7['clone']();_0x52c433[_0x76c5('0x4b')](_0x76c5('0x89'));_0x52c433['field'](_0x76c5('0x8d'),_0x76c5('0x8e'));if(_0x112601[_0x76c5('0x47')]){_0x112601[_0x76c5('0x47')][_0x76c5('0x37')](function(_0x5f1f3f){var _0x5b88f4=_0x5f1f3f[0x0]===_0x76c5('0x8f')?_0x5f1f3f[0x0]:'i.'+_0x5f1f3f[0x0];_0x41f7c7[_0x76c5('0x47')](_0x5b88f4,_0x5f1f3f[0x1]===_0x76c5('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x679795)){_0x41f7c7['having'](_0x20ad21);_0x52c433[_0x76c5('0x49')](_0x76c5('0x91'),_0x679795);}BPromise[_0x76c5('0x92')]()[_0x76c5('0x2b')](function(){if(!_0xc43361){if(_0x17d454[_0x76c5('0x40')][_0x76c5('0x93')])return;_0x52c433[_0x76c5('0x49')](_0x76c5('0x94'));_0x41f7c7[_0x76c5('0x49')](_0x76c5('0x94'));return;}if(_0x17d454[_0x76c5('0x95')][_0x76c5('0x96')]!==_0x76c5('0x97'))return;return _0x17d454[_0x76c5('0x95')][_0x76c5('0x98')]({'attributes':['id'],'raw':!![]})[_0x76c5('0x2b')](function(_0xf6789b){if(_[_0x76c5('0x99')](_0xf6789b)){_0x52c433[_0x76c5('0x49')](_0x76c5('0x9a'));_0x41f7c7['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x52c433[_0x76c5('0x49')](_0x76c5('0x76'),_['map'](_0xf6789b,'id'));_0x41f7c7[_0x76c5('0x49')](_0x76c5('0x76'),_[_0x76c5('0x32')](_0xf6789b,'id'));}});})[_0x76c5('0x2b')](function(){if(_0x17d454[_0x76c5('0x95')][_0x76c5('0x96')]==='agent'&&!_0xc43361&&!_0x17d454[_0x76c5('0x40')][_0x76c5('0x93')])return[];return db[_0x76c5('0x9b')]['query'](_0x52c433['toString'](),_0x50b9df);})['then'](function(_0x40bd68){_0x288b09[_0x76c5('0x25')]=_0x40bd68[_0x76c5('0x60')];if(_0x288b09[_0x76c5('0x25')]===0x0)return[];return db[_0x76c5('0x9b')][_0x76c5('0x40')](_0x2e897e[_0x76c5('0x9c')](),_0x50b9df)['then'](function(_0x235377){_0xee6624=_[_0x76c5('0x9d')](_0x235377,'id');_0x50b9df=_[_0x76c5('0x9e')](_0x50b9df,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x17d454[_0x76c5('0x40')]['fields']){_0x112601[_0x76c5('0x44')][_0x76c5('0x37')](function(_0x593466){_0x41f7c7[_0x76c5('0x4b')]('i.'+_0x593466);});}else{_0x41f7c7['field'](_0x76c5('0x8d'),_0x76c5('0x8e'));_0x41f7c7['field'](_0x76c5('0x9f'),_0x76c5('0xa0'));_0x41f7c7[_0x76c5('0x4b')](_0x76c5('0xa1'),'Account.mandatoryDisposition');_0x41f7c7[_0x76c5('0x4b')](_0x76c5('0xa2'),'contactName');_0x41f7c7['field'](_0x76c5('0xa3'));_0x41f7c7[_0x76c5('0x4b')](_0x76c5('0xa4'),_0x76c5('0xa5'));_0x41f7c7[_0x76c5('0x4b')]('c.lastName','Contact.lastName');_0x41f7c7[_0x76c5('0x4b')](_0x76c5('0xa6'),_0x76c5('0xa7'));_0x41f7c7[_0x76c5('0x4b')](_0x76c5('0xa8'),'Contact.phone');_0x41f7c7[_0x76c5('0x4b')]('c.mobile',_0x76c5('0xa9'));_0x41f7c7[_0x76c5('0x4b')](_0x76c5('0xaa'),'Contact.fax');_0x41f7c7['field'](_0x76c5('0xab'),_0x76c5('0xac'));_0x41f7c7['field'](_0x76c5('0xad'),_0x76c5('0xae'));_0x41f7c7[_0x76c5('0x4b')](_0x76c5('0xaf'),_0x76c5('0x34'));}if(_0x112601[_0x76c5('0x24')])_0x41f7c7[_0x76c5('0x24')](_0x112601[_0x76c5('0x24')]);if(_0x112601['offset'])_0x41f7c7['offset'](_0x112601[_0x76c5('0x23')]);return db['sequelize'][_0x76c5('0x40')](_0x41f7c7[_0x76c5('0x9c')](),_0x50b9df);})['then'](function(_0x46d0bd){if(_0x46d0bd[_0x76c5('0x60')]>0x0)_0x455877[_0x76c5('0x49')](_0x76c5('0xb0'),_['map'](_0x46d0bd,'id'));return db['sequelize']['query'](_0x455877[_0x76c5('0x9c')](),_0x50b9df)['then'](function(_0x341c95){var _0x2a147a=_[_0x76c5('0xb1')](_0x341c95,'FaxInteractionId');var _0x3c3a6d=[];_0x46d0bd['forEach'](function(_0x467b1e){_0x3c3a6d[_0x76c5('0x38')](updateFaxInteraction(_0x467b1e,_0xee6624,_0x2a147a));});return BPromise[_0x76c5('0xb2')](_0x3c3a6d);});});})[_0x76c5('0x2b')](function(_0x3d8104){_0x288b09[_0x76c5('0xb3')]=_0x3d8104;return _0x288b09;})[_0x76c5('0x2b')](respondWithFilteredResult(_0x23ecab,_0x112601))[_0x76c5('0x39')](handleError(_0x23ecab,null));};exports['show']=function(_0x59e130,_0x57d824){var _0x4a5de7={'raw':![],'where':{'id':_0x59e130['params']['id']}},_0x371ab1={};_0x371ab1[_0x76c5('0x3f')]=_[_0x76c5('0x41')](db['FaxInteraction'][_0x76c5('0x3b')]);_0x371ab1[_0x76c5('0x40')]=_[_0x76c5('0x41')](_0x59e130[_0x76c5('0x40')]);_0x371ab1[_0x76c5('0x42')]=_[_0x76c5('0x43')](_0x371ab1[_0x76c5('0x3f')],_0x371ab1[_0x76c5('0x40')]);_0x4a5de7[_0x76c5('0x44')]=_['intersection'](_0x371ab1[_0x76c5('0x3f')],qs[_0x76c5('0xb4')](_0x59e130[_0x76c5('0x40')]['fields']));_0x4a5de7[_0x76c5('0x44')]=_0x4a5de7['attributes'][_0x76c5('0x60')]?_0x4a5de7[_0x76c5('0x44')]:_0x371ab1[_0x76c5('0x3f')];if(_0x59e130['query']['includeAll']){_0x4a5de7[_0x76c5('0xb5')]=[{'all':!![]}];}_0x4a5de7=_[_0x76c5('0x9e')]({},_0x4a5de7,_0x59e130['options']);return db['FaxInteraction'][_0x76c5('0x71')](_0x4a5de7)['then'](handleEntityNotFound(_0x57d824,null))[_0x76c5('0x2b')](respondWithResult(_0x57d824,null))[_0x76c5('0x39')](handleError(_0x57d824,null));};exports[_0x76c5('0xb6')]=function(_0x3956ae,_0x39077c){return db[_0x76c5('0xb7')][_0x76c5('0xb6')](_0x3956ae['body'],{})[_0x76c5('0x2b')](respondWithResult(_0x39077c,0xc9))[_0x76c5('0x39')](handleError(_0x39077c,null));};exports[_0x76c5('0xb8')]=function(_0xf4567a,_0x414d1e){if(_0xf4567a[_0x76c5('0x73')]['id']){delete _0xf4567a[_0x76c5('0x73')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0xf4567a[_0x76c5('0xb9')]['id']}})[_0x76c5('0x2b')](handleEntityNotFound(_0x414d1e,null))['then'](saveUpdates(_0xf4567a[_0x76c5('0x73')],null))[_0x76c5('0x2b')](respondWithResult(_0x414d1e,null))[_0x76c5('0x39')](handleError(_0x414d1e,null));};exports[_0x76c5('0x2c')]=function(_0x258169,_0x2ce5ec){return db[_0x76c5('0xb7')][_0x76c5('0x71')]({'where':{'id':_0x258169[_0x76c5('0xb9')]['id']}})[_0x76c5('0x2b')](handleEntityNotFound(_0x2ce5ec,null))[_0x76c5('0x2b')](removeEntity(_0x2ce5ec,null))[_0x76c5('0x39')](handleError(_0x2ce5ec,null));};exports['describe']=function(_0x1c1c53,_0x2b1930){return db[_0x76c5('0xb7')][_0x76c5('0xba')]()[_0x76c5('0x2b')](respondWithResult(_0x2b1930,null))[_0x76c5('0x39')](handleError(_0x2b1930,null));};exports[_0x76c5('0xbb')]=function(_0x42e98e,_0x5d8dfe,_0x444799){return db[_0x76c5('0xbc')]['find']({'where':{'id':_0x42e98e[_0x76c5('0xb9')]['id']}})['then'](handleEntityNotFound(_0x5d8dfe,null))[_0x76c5('0x2b')](function(_0x461fdb){if(_0x461fdb){return _0x461fdb[_0x76c5('0xbb')](_0x42e98e['body'][_0x76c5('0xbd')],_[_0x76c5('0xbe')](_0x42e98e[_0x76c5('0x73')],['ids','id'])||{});}})[_0x76c5('0x2b')](respondWithResult(_0x5d8dfe,null))['catch'](handleError(_0x5d8dfe,null));};exports['getMessages']=function(_0xa87d69,_0x13ec7f,_0x13ad51){var _0x40a6c9={'raw':![],'where':{}};var _0x1a26ff={};var _0x3b0aca={'count':0x0,'rows':[]};return db[_0x76c5('0xb7')][_0x76c5('0xbf')]({'where':{'id':_0xa87d69['params']['id']}})[_0x76c5('0x2b')](handleEntityNotFound(_0x13ec7f,null))['then'](function(_0x22e6d9){if(_0x22e6d9){_0x1a26ff[_0x76c5('0x3f')]=_[_0x76c5('0x41')](db[_0x76c5('0xbc')]['rawAttributes']);_0x1a26ff[_0x76c5('0x40')]=_[_0x76c5('0x41')](_0xa87d69[_0x76c5('0x40')]);_0x1a26ff['filters']=_['intersection'](_0x1a26ff[_0x76c5('0x3f')],_0x1a26ff[_0x76c5('0x40')]);_0x40a6c9[_0x76c5('0x44')]=_[_0x76c5('0x43')](_0x1a26ff[_0x76c5('0x3f')],qs[_0x76c5('0xb4')](_0xa87d69['query'][_0x76c5('0xb4')]));_0x40a6c9[_0x76c5('0x44')]=_0x40a6c9['attributes'][_0x76c5('0x60')]?_0x40a6c9[_0x76c5('0x44')]:_0x1a26ff['model'];if(!_0xa87d69['query'][_0x76c5('0x45')](_0x76c5('0x46'))){_0x40a6c9[_0x76c5('0x24')]=qs['limit'](_0xa87d69['query'][_0x76c5('0x24')]);_0x40a6c9[_0x76c5('0x23')]=qs[_0x76c5('0x23')](_0xa87d69[_0x76c5('0x40')][_0x76c5('0x23')]);}_0x40a6c9[_0x76c5('0x47')]=qs[_0x76c5('0x48')](_0xa87d69[_0x76c5('0x40')][_0x76c5('0x48')]);_0x40a6c9['where']=qs[_0x76c5('0x42')](_[_0x76c5('0x4a')](_0xa87d69[_0x76c5('0x40')],_0x1a26ff[_0x76c5('0x42')]));_0x40a6c9['where'][_0x76c5('0xc0')]=_0x22e6d9['id'];if(_0xa87d69['query'][_0x76c5('0x83')]){_0x40a6c9['where']=_['merge'](_0x40a6c9[_0x76c5('0x49')],{'$or':_[_0x76c5('0x32')](_0x40a6c9[_0x76c5('0x44')],function(_0x4e8620){var _0x4ece1e={};_0x4ece1e[_0x4e8620]={'$like':'%'+_0xa87d69[_0x76c5('0x40')][_0x76c5('0x83')]+'%'};return _0x4ece1e;})});}if(_0xa87d69[_0x76c5('0x40')][_0x76c5('0xc1')]){var _0x2b7fb0=_0xa87d69[_0x76c5('0x40')]['$gte'][_0x76c5('0x36')](',');var _0x2eb7f8={};_0x2eb7f8[_0x2b7fb0[0x0]]={'$gte':moment(_0x2b7fb0[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x40a6c9[_0x76c5('0x49')]=_[_0x76c5('0x9e')](_0x40a6c9[_0x76c5('0x49')],_0x2eb7f8);}_0x40a6c9=_[_0x76c5('0x9e')]({},_0x40a6c9,_0xa87d69[_0x76c5('0xc2')]);return db[_0x76c5('0xbc')][_0x76c5('0x25')]({'where':_0x40a6c9['where']})[_0x76c5('0x2b')](function(_0x2551c4){_0x3b0aca[_0x76c5('0x25')]=_0x2551c4;if(_0xa87d69[_0x76c5('0x40')][_0x76c5('0xc3')]){_0x40a6c9['include']=[{'all':!![]}];}return db[_0x76c5('0xbc')]['findAll'](_0x40a6c9);})[_0x76c5('0x2b')](function(_0x559e96){_0x3b0aca[_0x76c5('0xb3')]=_0x559e96;return _0x3b0aca;});}})[_0x76c5('0x2b')](respondWithFilteredResult(_0x13ec7f,_0x40a6c9))['catch'](handleError(_0x13ec7f,null));};exports['addTags']=function(_0x15a7a6,_0x3a5571,_0x5405a4){return db[_0x76c5('0xb7')][_0x76c5('0x71')]({'where':{'id':_0x15a7a6[_0x76c5('0xb9')]['id']}})['then'](handleEntityNotFound(_0x3a5571,null))['then'](function(_0x12d9ed){if(_0x12d9ed){return _0x12d9ed[_0x76c5('0xc4')](_0x15a7a6[_0x76c5('0x73')][_0x76c5('0xbd')],_['omit'](_0x15a7a6[_0x76c5('0x73')],[_0x76c5('0xbd'),'id'])||{})[_0x76c5('0xc5')](function(){return db[_0x76c5('0x6e')][_0x76c5('0xc6')]({'attributes':['id',_0x76c5('0x2f'),'color'],'where':{'id':_0x15a7a6[_0x76c5('0x73')][_0x76c5('0xbd')]}});})[_0x76c5('0x2b')](function(_0x3136d8){socket[_0x76c5('0xc7')]('faxInteractionTags:save',{'id':Number(_0x15a7a6[_0x76c5('0xb9')]['id']),'tags':_0x3136d8||[]});return{'id':Number(_0x15a7a6[_0x76c5('0xb9')]['id']),'tags':_0x3136d8||[]};});}})[_0x76c5('0x2b')](respondWithResult(_0x3a5571,null))[_0x76c5('0x39')](handleError(_0x3a5571,null));};exports['removeTags']=function(_0x580ebd,_0x362998,_0x358a55){return db[_0x76c5('0xb7')][_0x76c5('0x71')]({'where':{'id':_0x580ebd[_0x76c5('0xb9')]['id']}})['then'](handleEntityNotFound(_0x362998,null))[_0x76c5('0x2b')](function(_0x5dfce9){if(_0x5dfce9){return _0x5dfce9[_0x76c5('0xc8')](_0x580ebd[_0x76c5('0x40')]['ids']);}})[_0x76c5('0x2b')](respondWithStatusCode(_0x362998,null))['catch'](handleError(_0x362998,null));};exports[_0x76c5('0xc9')]=function(_0x45a61d,_0x3f12d8){var _0x391393=moment()[_0x76c5('0xca')]()[_0x76c5('0x9c')]();var _0x25d3e7=path[_0x76c5('0xcb')](config[_0x76c5('0xcc')],_0x76c5('0xcd'),_0x76c5('0xce'),_0x76c5('0xcf'));var _0x500a25=path['join'](config[_0x76c5('0xcc')],_0x76c5('0xcd'),_0x76c5('0xce'),_0x76c5('0xd0'));var _0x8fabcd=path['join'](_0x25d3e7,_0x391393);var _0x363dac=util[_0x76c5('0xd1')]('transcript-%d-%s.zip',_0x45a61d[_0x76c5('0xb9')]['id'],_0x391393);var _0x2e3350=path[_0x76c5('0xcb')](_0x25d3e7,_0x363dac);var _0x1d9a44=[];_0x1d9a44['push']({'model':db[_0x76c5('0xd2')],'as':_0x76c5('0xd2'),'raw':!![]});var _0x271735=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id','body','createdAt'],'include':_0x1d9a44}];return db[_0x76c5('0xb7')][_0x76c5('0x71')]({'where':{'id':_0x45a61d[_0x76c5('0xb9')]['id']},'include':_0x271735})['then'](handleEntityNotFound(_0x3f12d8,null))[_0x76c5('0x2b')](function(_0x4d100e){if(_0x4d100e&&_0x4d100e[_0x76c5('0xd3')]){var _0xaee970=_0x4d100e['get']({'plain':!![]});fs['mkdirSync'](_0x8fabcd);for(var _0x4da339=0x0;_0x4da339<_0xaee970[_0x76c5('0xd3')][_0x76c5('0x60')];_0x4da339++){var _0x34fb9a=_0xaee970['Messages'][_0x4da339][_0x76c5('0xd2')];if(_0x34fb9a){var _0x490c45=path[_0x76c5('0xcb')](_0x500a25,_0x34fb9a[_0x76c5('0xd4')]);if(fs[_0x76c5('0xd5')](_0x490c45)){fs[_0x76c5('0xd6')](_0x490c45)['pipe'](fs[_0x76c5('0xd7')](path[_0x76c5('0xcb')](_0x8fabcd,_0x34fb9a[_0x76c5('0xd4')])));}}}return BPromise[_0x76c5('0x92')]()[_0x76c5('0x2b')](function(){return new BPromise(function(_0x34a992,_0x4545e3){zipdir(_0x8fabcd,{'saveTo':_0x2e3350},function(_0x13aa6b,_0x11ef63){if(_0x13aa6b)return _0x4545e3(_0x13aa6b);return _0x34a992(_0x11ef63);});})[_0x76c5('0x2b')](function(){return new BPromise(function(_0xb52877,_0x188f42){rimraf(_0x8fabcd,function(_0x383955){if(_0x383955)_0x188f42(_0x383955);return _0xb52877();});});})[_0x76c5('0x2b')](function(){return _0x3f12d8[_0x76c5('0xc9')](_0x2e3350,_0x363dac,function(_0x5dc710){if(_0x5dc710){console[_0x76c5('0xd8')](_0x76c5('0xd9'),_0x5dc710);}else{fs[_0x76c5('0xda')](_0x2e3350);}});});});}else{return _0x3f12d8['sendStatus'](0xc8);}})['catch'](handleError(_0x3f12d8,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index e848261..8b377b9 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 _0x5c74=['hook','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','map','findAll','then','unreadMessages','length','emit','catch'];(function(_0x324277,_0xa7681f){var _0x42965e=function(_0x5689e6){while(--_0x5689e6){_0x324277['push'](_0x324277['shift']());}};_0x42965e(++_0xa7681f);}(_0x5c74,0xc7));var _0x45c7=function(_0x29b324,_0x8546c){_0x29b324=_0x29b324-0x0;var _0x46f204=_0x5c74[_0x29b324];return _0x46f204;};'use strict';var EventEmitter=require(_0x45c7('0x0'));var FaxInteraction=require(_0x45c7('0x1'))['db'][_0x45c7('0x2')];var FaxMessage=require(_0x45c7('0x1'))['db'][_0x45c7('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x45c7('0x4')](0x0);var events={'afterCreate':_0x45c7('0x5'),'afterUpdate':_0x45c7('0x6'),'afterDestroy':_0x45c7('0x7')};function emitEvent(_0x545420){return function(_0x279acb,_0xb76a25,_0x2f9004){_0x279acb[_0x45c7('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x45663b){_0x279acb[_0x45c7('0x9')]('Users',_0x45663b[_0x45c7('0xa')](function(_0x4050de){return{'id':_0x4050de['id']};}));return FaxMessage[_0x45c7('0xb')]({'where':{'FaxInteractionId':_0x279acb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x45c7('0xc')](function(_0x50301a){_0x279acb[_0x45c7('0x9')](_0x45c7('0xd'),_0x50301a[_0x45c7('0xe')]);FaxInteractionEvents[_0x45c7('0xf')](_0x545420+':'+_0x279acb['id'],_0x279acb);FaxInteractionEvents[_0x45c7('0xf')](_0x545420,_0x279acb);_0x2f9004(null);})[_0x45c7('0x10')](_0x2f9004(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x45c7('0x11')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xba9d=['exports','../../mysqldb','FaxMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','catch','hasOwnProperty','hook'];(function(_0xbdf9ba,_0x3fe7b9){var _0x404cf3=function(_0x5e7dbf){while(--_0x5e7dbf){_0xbdf9ba['push'](_0xbdf9ba['shift']());}};_0x404cf3(++_0x3fe7b9);}(_0xba9d,0x1b1));var _0xdba9=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xba9d[_0x5d2803];return _0xdcad2c;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xdba9('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0xdba9('0x0'))['db'][_0xdba9('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xdba9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdba9('0x3'),'afterDestroy':_0xdba9('0x4')};function emitEvent(_0x5b92cd){return function(_0x40baf5,_0x575fc4,_0x4232b5){_0x40baf5[_0xdba9('0x5')]({'attributes':['id'],'raw':!![]})[_0xdba9('0x6')](function(_0x5af619){_0x40baf5[_0xdba9('0x7')](_0xdba9('0x8'),_0x5af619[_0xdba9('0x9')](function(_0x4ad9d1){return{'id':_0x4ad9d1['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x40baf5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdba9('0x6')](function(_0x19b208){_0x40baf5[_0xdba9('0x7')](_0xdba9('0xa'),_0x19b208[_0xdba9('0xb')]);FaxInteractionEvents['emit'](_0x5b92cd+':'+_0x40baf5['id'],_0x40baf5);FaxInteractionEvents['emit'](_0x5b92cd,_0x40baf5);_0x4232b5(null);})[_0xdba9('0xc')](_0x4232b5(null));};}for(var e in events){if(events[_0xdba9('0xd')](e)){var event=events[e];FaxInteraction[_0xdba9('0xe')](e,emitEvent(event));}}module[_0xdba9('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 3db2fdc..6569e46 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 _0x5ef5=['fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction'];(function(_0x890f0b,_0x253118){var _0x2ae2c9=function(_0x2682fe){while(--_0x2682fe){_0x890f0b['push'](_0x890f0b['shift']());}};_0x2ae2c9(++_0x253118);}(_0x5ef5,0x1d6));var _0x55ef=function(_0x1f8a3b,_0x3e6445){_0x1f8a3b=_0x1f8a3b-0x0;var _0x30a14=_0x5ef5[_0x1f8a3b];return _0x30a14;};'use strict';var _=require(_0x55ef('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x55ef('0x1'));var moment=require(_0x55ef('0x2'));var BPromise=require(_0x55ef('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x55ef('0x4'));var config=require(_0x55ef('0x5'));var attributes=require(_0x55ef('0x6'));module[_0x55ef('0x7')]=function(_0x12e7eb,_0x3770b){return _0x12e7eb[_0x55ef('0x8')](_0x55ef('0x9'),attributes,{'tableName':_0x55ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2342de,_0x42c886,_0x3583d5){if(_0x2342de[_0x55ef('0xb')](_0x55ef('0xc'))){_0x2342de[_0x55ef('0xd')]=moment()[_0x55ef('0xe')](_0x55ef('0xf'));}_0x3583d5(null,_0x2342de);}}});}; \ No newline at end of file +var _0x9820=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','FaxInteraction','fax_interactions'];(function(_0x352c02,_0x30c14e){var _0x1956a8=function(_0x5065e5){while(--_0x5065e5){_0x352c02['push'](_0x352c02['shift']());}};_0x1956a8(++_0x30c14e);}(_0x9820,0x137));var _0x0982=function(_0x2d31ff,_0x4c90b9){_0x2d31ff=_0x2d31ff-0x0;var _0x3d6e74=_0x9820[_0x2d31ff];return _0x3d6e74;};'use strict';var _=require(_0x0982('0x0'));var util=require(_0x0982('0x1'));var logger=require(_0x0982('0x2'))(_0x0982('0x3'));var moment=require('moment');var BPromise=require(_0x0982('0x4'));var rp=require(_0x0982('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0982('0x6'));var config=require(_0x0982('0x7'));var attributes=require('./faxInteraction.attributes');module[_0x0982('0x8')]=function(_0x2a3dfc,_0x4a9055){return _0x2a3dfc[_0x0982('0x9')](_0x0982('0xa'),attributes,{'tableName':_0x0982('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb9be50,_0x4c6c1b,_0x3136ce){if(_0xb9be50[_0x0982('0xc')](_0x0982('0xd'))){_0xb9be50[_0x0982('0xe')]=moment()[_0x0982('0xf')](_0x0982('0x10'));}_0x3136ce(null,_0xb9be50);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 7709b28..6cde11f 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 _0xe75e=['defaults','./faxInteraction.socket','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxInteraction','update','body','options','raw','attributes','limit','UpdateFaxInteraction','debug','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis'];(function(_0x2a25cf,_0x2bc090){var _0x479173=function(_0x55e5b8){while(--_0x55e5b8){_0x2a25cf['push'](_0x2a25cf['shift']());}};_0x479173(++_0x2bc090);}(_0xe75e,0x1e0));var _0xee75=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0xe75e[_0x136619];return _0x38c4a5;};'use strict';var _=require(_0xee75('0x0'));var util=require(_0xee75('0x1'));var moment=require(_0xee75('0x2'));var BPromise=require(_0xee75('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee75('0x4'));var db=require(_0xee75('0x5'))['db'];var utils=require(_0xee75('0x6'));var logger=require(_0xee75('0x7'))('rpc');var config=require(_0xee75('0x8'));var jayson=require(_0xee75('0x9'));var client=jayson[_0xee75('0xa')]['http']({'port':0x232a});config[_0xee75('0xb')]=_[_0xee75('0xc')](config[_0xee75('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xee75('0xb')]));require(_0xee75('0xd'))['register'](socket);function respondWithRpcPromise(_0x498a57,_0x32e528,_0x416fd7){return new BPromise(function(_0x3c10fc,_0x2c7a6f){return client['request'](_0x498a57,_0x416fd7)[_0xee75('0xe')](function(_0x21c684){logger[_0xee75('0xf')](_0xee75('0x10'),_0x32e528,_0xee75('0x11'));logger['debug'](_0xee75('0x12'),_0x32e528,_0xee75('0x11'),JSON[_0xee75('0x13')](_0x21c684));if(_0x21c684[_0xee75('0x14')]){if(_0x21c684['error'][_0xee75('0x15')]===0x1f4){logger['error'](_0xee75('0x10'),_0x32e528,_0x21c684['error'][_0xee75('0x16')]);return _0x2c7a6f(_0x21c684[_0xee75('0x14')][_0xee75('0x16')]);}logger[_0xee75('0x14')](_0xee75('0x10'),_0x32e528,_0x21c684[_0xee75('0x14')]['message']);return _0x3c10fc(_0x21c684['error'][_0xee75('0x16')]);}else{logger[_0xee75('0xf')](_0xee75('0x10'),_0x32e528,'request\x20sent');_0x3c10fc(_0x21c684[_0xee75('0x17')][_0xee75('0x16')]);}})[_0xee75('0x18')](function(_0x2e1a6e){logger[_0xee75('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x32e528,_0x2e1a6e);_0x2c7a6f(_0x2e1a6e);});});}exports['UpdateFaxInteraction']=function(_0x2e34ef){var _0x21edb4=this;return new Promise(function(_0x2158b7,_0x134614){return db[_0xee75('0x19')][_0xee75('0x1a')](_0x2e34ef[_0xee75('0x1b')],{'raw':_0x2e34ef[_0xee75('0x1c')]?_0x2e34ef[_0xee75('0x1c')][_0xee75('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e34ef[_0xee75('0x1c')]?_0x2e34ef[_0xee75('0x1c')]['where']||null:null,'attributes':_0x2e34ef[_0xee75('0x1c')]?_0x2e34ef[_0xee75('0x1c')][_0xee75('0x1e')]||null:null,'limit':_0x2e34ef[_0xee75('0x1c')]?_0x2e34ef[_0xee75('0x1c')][_0xee75('0x1f')]||null:null})[_0xee75('0xe')](function(_0x12049f){logger[_0xee75('0xf')](_0xee75('0x20'),_0x2e34ef);logger[_0xee75('0x21')](_0xee75('0x20'),_0x2e34ef,JSON[_0xee75('0x13')](_0x12049f));_0x2158b7(_0x12049f);})['catch'](function(_0x5465d6){logger['error'](_0xee75('0x20'),_0x5465d6[_0xee75('0x16')],_0x2e34ef);_0x134614(_0x21edb4['error'](0x1f4,_0x5465d6[_0xee75('0x16')]));});});};exports['AddTagsToFaxInteraction']=function(_0x5237d3){return new Promise(function(_0x4e6782,_0x23dd7e){return db[_0xee75('0x19')][_0xee75('0x22')]({'where':_0x5237d3['options']?_0x5237d3['options'][_0xee75('0x23')]||null:null})[_0xee75('0xe')](function(_0x27ed89){if(_0x27ed89){return _0x27ed89[_0xee75('0x24')](_0x5237d3[_0xee75('0x1b')][_0xee75('0x25')],_[_0xee75('0x26')](_0x5237d3[_0xee75('0x1b')],[_0xee75('0x25'),'id'])||{});}})[_0xee75('0x27')](function(_0x5a5d58){logger[_0xee75('0xf')](_0xee75('0x28'),_0x5237d3);logger[_0xee75('0x21')](_0xee75('0x28'),_0x5237d3,JSON[_0xee75('0x13')](_0x5a5d58));_0x4e6782(_0x5a5d58);})['catch'](function(_0x3ad1ad){logger['error'](_0xee75('0x28'),_0x3ad1ad['message'],_0x5237d3);_0x23dd7e(_this[_0xee75('0x14')](0x1f4,_0x3ad1ad[_0xee75('0x16')]));});});}; \ No newline at end of file +var _0x79ea=['util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','update','options','where','attributes','limit','AddTagsToFaxInteraction','FaxInteraction','find','addTags','body','omit','ids','spread','AddTags'];(function(_0x4bcd2f,_0x1cee22){var _0x4276cf=function(_0x362465){while(--_0x362465){_0x4bcd2f['push'](_0x4bcd2f['shift']());}};_0x4276cf(++_0x1cee22);}(_0x79ea,0x17a));var _0xa79e=function(_0x325bc4,_0x4df462){_0x325bc4=_0x325bc4-0x0;var _0x330091=_0x79ea[_0x325bc4];return _0x330091;};'use strict';var _=require('lodash');var util=require(_0xa79e('0x0'));var moment=require(_0xa79e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa79e('0x2'))['db'];var utils=require(_0xa79e('0x3'));var logger=require(_0xa79e('0x4'))(_0xa79e('0x5'));var config=require(_0xa79e('0x6'));var jayson=require(_0xa79e('0x7'));var client=jayson[_0xa79e('0x8')][_0xa79e('0x9')]({'port':0x232a});config[_0xa79e('0xa')]=_['defaults'](config[_0xa79e('0xa')],{'host':_0xa79e('0xb'),'port':0x18eb});var socket=require(_0xa79e('0xc'))(new Redis(config[_0xa79e('0xa')]));require(_0xa79e('0xd'))[_0xa79e('0xe')](socket);function respondWithRpcPromise(_0x592414,_0x2af548,_0x5f414b){return new BPromise(function(_0x23ff3f,_0x27084d){return client['request'](_0x592414,_0x5f414b)[_0xa79e('0xf')](function(_0x244696){logger[_0xa79e('0x10')](_0xa79e('0x11'),_0x2af548,_0xa79e('0x12'));logger[_0xa79e('0x13')](_0xa79e('0x14'),_0x2af548,_0xa79e('0x12'),JSON[_0xa79e('0x15')](_0x244696));if(_0x244696[_0xa79e('0x16')]){if(_0x244696['error'][_0xa79e('0x17')]===0x1f4){logger['error'](_0xa79e('0x11'),_0x2af548,_0x244696[_0xa79e('0x16')][_0xa79e('0x18')]);return _0x27084d(_0x244696[_0xa79e('0x16')][_0xa79e('0x18')]);}logger[_0xa79e('0x16')](_0xa79e('0x11'),_0x2af548,_0x244696['error']['message']);return _0x23ff3f(_0x244696[_0xa79e('0x16')][_0xa79e('0x18')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x2af548,_0xa79e('0x12'));_0x23ff3f(_0x244696[_0xa79e('0x19')][_0xa79e('0x18')]);}})[_0xa79e('0x1a')](function(_0x10566e){logger[_0xa79e('0x16')](_0xa79e('0x11'),_0x2af548,_0x10566e);_0x27084d(_0x10566e);});});}exports[_0xa79e('0x1b')]=function(_0x34e9af){var _0x511e62=this;return new Promise(function(_0x4a3124,_0x1e6927){return db['FaxInteraction'][_0xa79e('0x1c')](_0x34e9af['body'],{'raw':_0x34e9af[_0xa79e('0x1d')]?_0x34e9af[_0xa79e('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34e9af[_0xa79e('0x1d')]?_0x34e9af[_0xa79e('0x1d')][_0xa79e('0x1e')]||null:null,'attributes':_0x34e9af[_0xa79e('0x1d')]?_0x34e9af['options'][_0xa79e('0x1f')]||null:null,'limit':_0x34e9af['options']?_0x34e9af['options'][_0xa79e('0x20')]||null:null})[_0xa79e('0xf')](function(_0x5e9d27){logger[_0xa79e('0x10')](_0xa79e('0x1b'),_0x34e9af);logger[_0xa79e('0x13')](_0xa79e('0x1b'),_0x34e9af,JSON[_0xa79e('0x15')](_0x5e9d27));_0x4a3124(_0x5e9d27);})[_0xa79e('0x1a')](function(_0x562a5f){logger[_0xa79e('0x16')](_0xa79e('0x1b'),_0x562a5f['message'],_0x34e9af);_0x1e6927(_0x511e62[_0xa79e('0x16')](0x1f4,_0x562a5f[_0xa79e('0x18')]));});});};exports[_0xa79e('0x21')]=function(_0x54fe84){return new Promise(function(_0x3e9179,_0x49d428){return db[_0xa79e('0x22')][_0xa79e('0x23')]({'where':_0x54fe84['options']?_0x54fe84[_0xa79e('0x1d')][_0xa79e('0x1e')]||null:null})[_0xa79e('0xf')](function(_0x48a17a){if(_0x48a17a){return _0x48a17a[_0xa79e('0x24')](_0x54fe84[_0xa79e('0x25')]['ids'],_[_0xa79e('0x26')](_0x54fe84[_0xa79e('0x25')],[_0xa79e('0x27'),'id'])||{});}})[_0xa79e('0x28')](function(_0x2bf12b){logger[_0xa79e('0x10')](_0xa79e('0x29'),_0x54fe84);logger['debug'](_0xa79e('0x29'),_0x54fe84,JSON['stringify'](_0x2bf12b));_0x3e9179(_0x2bf12b);})[_0xa79e('0x1a')](function(_0x3c08b2){logger[_0xa79e('0x16')](_0xa79e('0x29'),_0x3c08b2[_0xa79e('0x18')],_0x54fe84);_0x49d428(_this[_0xa79e('0x16')](0x1f4,_0x3c08b2[_0xa79e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 961b7f6..bb8a9dc 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 _0x0aa9=['removeListener','register','length','save','remove','update','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0aa9,0xb9));var _0x90aa=function(_0x470711,_0x415ae0){_0x470711=_0x470711-0x0;var _0x33b3aa=_0x0aa9[_0x470711];return _0x33b3aa;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x90aa('0x0'),_0x90aa('0x1'),_0x90aa('0x2')];function createListener(_0x25bc50,_0x330b4f){return function(_0x5bd635){_0x330b4f[_0x90aa('0x3')](_0x25bc50,_0x5bd635);};}function removeListener(_0x3912b8,_0xed3928){return function(){FaxInteractionEvents[_0x90aa('0x4')](_0x3912b8,_0xed3928);};}exports[_0x90aa('0x5')]=function(_0x5362a0){for(var _0x50d01c=0x0,_0x5dffc4=events[_0x90aa('0x6')];_0x50d01c<_0x5dffc4;_0x50d01c++){var _0x2f768e=events[_0x50d01c];var _0x43f32e=createListener('faxInteraction:'+_0x2f768e,_0x5362a0);FaxInteractionEvents['on'](_0x2f768e,_0x43f32e);}}; \ No newline at end of file +var _0x9137=['save','remove','update','emit','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x1b198c,_0x57cbbb){var _0x117a2f=function(_0x1da0ca){while(--_0x1da0ca){_0x1b198c['push'](_0x1b198c['shift']());}};_0x117a2f(++_0x57cbbb);}(_0x9137,0xf7));var _0x7913=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0x9137[_0x21f931];return _0x3f083c;};'use strict';var FaxInteractionEvents=require(_0x7913('0x0'));var events=[_0x7913('0x1'),_0x7913('0x2'),_0x7913('0x3')];function createListener(_0x4e87bb,_0x4ad83e){return function(_0x1c4c87){_0x4ad83e[_0x7913('0x4')](_0x4e87bb,_0x1c4c87);};}function removeListener(_0x1e0ab9,_0x5f28ce){return function(){FaxInteractionEvents['removeListener'](_0x1e0ab9,_0x5f28ce);};}exports[_0x7913('0x5')]=function(_0x1fbe94){for(var _0x2196e7=0x0,_0xcf0173=events[_0x7913('0x6')];_0x2196e7<_0xcf0173;_0x2196e7++){var _0x184aa6=events[_0x2196e7];var _0x36e092=createListener(_0x7913('0x7')+_0x184aa6,_0x1fbe94);FaxInteractionEvents['on'](_0x184aa6,_0x36e092);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index e388290..fb15cba 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 _0x3f1f=['update','delete','faxinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax'];(function(_0x3fd96c,_0x2b65d5){var _0x545827=function(_0x2e567f){while(--_0x2e567f){_0x3fd96c['push'](_0x3fd96c['shift']());}};_0x545827(++_0x2b65d5);}(_0x3f1f,0x1e6));var _0xf3f1=function(_0x1731c5,_0x5a9942){_0x1731c5=_0x1731c5-0x0;var _0x4c716c=_0x3f1f[_0x1731c5];return _0x4c716c;};'use strict';var multer=require('multer');var util=require(_0xf3f1('0x0'));var path=require(_0xf3f1('0x1'));var timeout=require(_0xf3f1('0x2'));var express=require(_0xf3f1('0x3'));var router=express[_0xf3f1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf3f1('0x5'));var interaction=require(_0xf3f1('0x6'));var config=require(_0xf3f1('0x7'));var controller=require(_0xf3f1('0x8'));router[_0xf3f1('0x9')]('/',auth['isAuthenticated'](),controller[_0xf3f1('0xa')]);router['get'](_0xf3f1('0xb'),auth[_0xf3f1('0xc')](),controller[_0xf3f1('0xd')]);router[_0xf3f1('0x9')](_0xf3f1('0xe'),auth[_0xf3f1('0xc')](),controller['show']);router[_0xf3f1('0x9')]('/:id/messages',auth[_0xf3f1('0xc')](),controller[_0xf3f1('0xf')]);router['get'](_0xf3f1('0x10'),auth['isAuthenticated'](),controller[_0xf3f1('0x11')]);router[_0xf3f1('0x12')]('/',auth[_0xf3f1('0xc')](),controller[_0xf3f1('0x13')]);router['post']('/:id/messages',auth[_0xf3f1('0xc')](),controller[_0xf3f1('0x14')]);router[_0xf3f1('0x12')](_0xf3f1('0x15'),auth[_0xf3f1('0xc')](),interaction[_0xf3f1('0x16')](_0xf3f1('0x17'),'faxinteraction:addtags'),controller['addTags']);router['put']('/:id',auth[_0xf3f1('0xc')](),interaction[_0xf3f1('0x16')](_0xf3f1('0x17'),'faxinteraction:update'),controller[_0xf3f1('0x18')]);router[_0xf3f1('0x19')](_0xf3f1('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0xf3f1('0x17'),_0xf3f1('0x1a')),controller[_0xf3f1('0x1b')]);router['delete'](_0xf3f1('0x15'),auth[_0xf3f1('0xc')](),controller[_0xf3f1('0x1c')]);module[_0xf3f1('0x1d')]=router; \ No newline at end of file +var _0x44b0=['addTags','faxinteraction:update','update','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','tracked','fax'];(function(_0x342a10,_0x4e1be0){var _0x4b0975=function(_0x2dfae0){while(--_0x2dfae0){_0x342a10['push'](_0x342a10['shift']());}};_0x4b0975(++_0x4e1be0);}(_0x44b0,0x1a6));var _0x044b=function(_0x19a47e,_0x444359){_0x19a47e=_0x19a47e-0x0;var _0x1a99c1=_0x44b0[_0x19a47e];return _0x1a99c1;};'use strict';var multer=require(_0x044b('0x0'));var util=require(_0x044b('0x1'));var path=require(_0x044b('0x2'));var timeout=require(_0x044b('0x3'));var express=require(_0x044b('0x4'));var router=express[_0x044b('0x5')]();var fs_extra=require(_0x044b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x044b('0x7'));var config=require(_0x044b('0x8'));var controller=require(_0x044b('0x9'));router[_0x044b('0xa')]('/',auth['isAuthenticated'](),controller[_0x044b('0xb')]);router['get'](_0x044b('0xc'),auth[_0x044b('0xd')](),controller[_0x044b('0xe')]);router[_0x044b('0xa')](_0x044b('0xf'),auth[_0x044b('0xd')](),controller['show']);router[_0x044b('0xa')](_0x044b('0x10'),auth['isAuthenticated'](),controller[_0x044b('0x11')]);router[_0x044b('0xa')](_0x044b('0x12'),auth['isAuthenticated'](),controller[_0x044b('0x13')]);router['post']('/',auth[_0x044b('0xd')](),controller[_0x044b('0x14')]);router['post'](_0x044b('0x10'),auth[_0x044b('0xd')](),controller[_0x044b('0x15')]);router[_0x044b('0x16')](_0x044b('0x17'),auth[_0x044b('0xd')](),interaction[_0x044b('0x18')](_0x044b('0x19'),'faxinteraction:addtags'),controller[_0x044b('0x1a')]);router['put'](_0x044b('0xf'),auth[_0x044b('0xd')](),interaction[_0x044b('0x18')]('fax',_0x044b('0x1b')),controller[_0x044b('0x1c')]);router['delete'](_0x044b('0xf'),auth[_0x044b('0xd')](),interaction[_0x044b('0x18')](_0x044b('0x19'),'faxinteraction:destroy'),controller[_0x044b('0x1d')]);router['delete'](_0x044b('0x17'),auth[_0x044b('0xd')](),controller[_0x044b('0x1e')]);module[_0x044b('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 5d94caf..dc41e94 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 _0xfaa4=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x3f12ad,_0x5dd191){var _0x62ec4=function(_0x1050de){while(--_0x1050de){_0x3f12ad['push'](_0x3f12ad['shift']());}};_0x62ec4(++_0x5dd191);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x30a2eb,_0x354f5c){_0x30a2eb=_0x30a2eb-0x0;var _0x457e37=_0xfaa4[_0x30a2eb];return _0x457e37;};'use strict';var Sequelize=require(_0x4faa('0x0'));module[_0x4faa('0x1')]={'body':{'type':Sequelize[_0x4faa('0x2')](_0x4faa('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4faa('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4faa('0x5')]('in','out'),'defaultValue':_0x4faa('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x4faa('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x4faa('0x7')]}}; \ No newline at end of file +var _0x60c2=['ENUM','out','DATE','exports','TEXT','medium','BOOLEAN'];(function(_0x449061,_0x3faca2){var _0x29ac38=function(_0x214bd7){while(--_0x214bd7){_0x449061['push'](_0x449061['shift']());}};_0x29ac38(++_0x3faca2);}(_0x60c2,0x8f));var _0x260c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x60c2[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x260c('0x0')]={'body':{'type':Sequelize[_0x260c('0x1')](_0x260c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x260c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x260c('0x4')]('in',_0x260c('0x5')),'defaultValue':_0x260c('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x260c('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x260c('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 1962690..03484e1 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 _0xc084=['read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','EventManager','acceptmessage','role','rejectMessage','ContactId','QueryTypes','rejectmessage','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','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','socket.io-emitter','./faxMessage.socket','register','client','http','request','info','request\x20sent','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','result','catch','sendStatus','status','undefined','limit','count','offset','set','apply','reject','update','then','end','stack','name','index','map','FaxMessage','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','keys','length','include','find','body','destroy','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil'];(function(_0x5824a0,_0x3af4e2){var _0x5b3381=function(_0x4d1e7e){while(--_0x4d1e7e){_0x5824a0['push'](_0x5824a0['shift']());}};_0x5b3381(++_0x3af4e2);}(_0xc084,0xb1));var _0x4c08=function(_0x2e9f48,_0x4386a6){_0x2e9f48=_0x2e9f48-0x0;var _0x333df0=_0xc084[_0x2e9f48];return _0x333df0;};'use strict';var emlformat=require(_0x4c08('0x0'));var rimraf=require(_0x4c08('0x1'));var zipdir=require(_0x4c08('0x2'));var jsonpatch=require(_0x4c08('0x3'));var rp=require(_0x4c08('0x4'));var moment=require(_0x4c08('0x5'));var BPromise=require(_0x4c08('0x6'));var Mustache=require(_0x4c08('0x7'));var util=require(_0x4c08('0x8'));var path=require('path');var sox=require(_0x4c08('0x9'));var csv=require(_0x4c08('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c08('0xb'));var squel=require(_0x4c08('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4c08('0xd'));var toCsv=require(_0x4c08('0xa'));var querystring=require(_0x4c08('0xe'));var Papa=require(_0x4c08('0xf'));var Redis=require('ioredis');var authService=require(_0x4c08('0x10'));var qs=require(_0x4c08('0x11'));var as=require(_0x4c08('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c08('0x13'))(_0x4c08('0x14'));var utils=require(_0x4c08('0x15'));var config=require(_0x4c08('0x16'));var licenseUtil=require(_0x4c08('0x17'));var db=require(_0x4c08('0x18'))['db'];config[_0x4c08('0x19')]=_[_0x4c08('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4c08('0x1b'))(new Redis(config[_0x4c08('0x19')]));require(_0x4c08('0x1c'))[_0x4c08('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4c08('0x1e')][_0x4c08('0x1f')]({'port':0x232c});var client9002=jayson[_0x4c08('0x1e')][_0x4c08('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x28f5f2,_0x5f53c5,_0x5d3cd0,_0x56b750){return new BPromise(function(_0x54b886,_0x29c93c){var _0x3a4587=_0x56b750||client;return _0x3a4587[_0x4c08('0x20')](_0x28f5f2,_0x5d3cd0)['then'](function(_0x15ce3e){logger[_0x4c08('0x21')]('FaxMessage,\x20%s,\x20%s',_0x5f53c5,_0x4c08('0x22'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5f53c5,'request\x20sent',JSON[_0x4c08('0x23')](_0x15ce3e));if(_0x15ce3e[_0x4c08('0x24')]){if(_0x15ce3e[_0x4c08('0x24')][_0x4c08('0x25')]===0x1f4){logger[_0x4c08('0x24')]('FaxMessage,\x20%s,\x20%s',_0x5f53c5,_0x15ce3e['error']['message']);return _0x29c93c(_0x15ce3e[_0x4c08('0x24')][_0x4c08('0x26')]);}logger[_0x4c08('0x24')](_0x4c08('0x27'),_0x5f53c5,_0x15ce3e[_0x4c08('0x24')][_0x4c08('0x26')]);return _0x54b886(_0x15ce3e[_0x4c08('0x24')][_0x4c08('0x26')]);}else{logger[_0x4c08('0x21')](_0x4c08('0x27'),_0x5f53c5,_0x4c08('0x22'));_0x54b886(_0x15ce3e[_0x4c08('0x28')]['message']);}})[_0x4c08('0x29')](function(_0x29c4b2){logger[_0x4c08('0x24')](_0x4c08('0x27'),_0x5f53c5,_0x29c4b2);_0x29c93c(_0x29c4b2);});});}function respondWithStatusCode(_0x20c929,_0x219f36){_0x219f36=_0x219f36||0xcc;return function(_0x3f554c){if(_0x3f554c){return _0x20c929[_0x4c08('0x2a')](_0x219f36);}return _0x20c929[_0x4c08('0x2b')](_0x219f36)['end']();};}function respondWithResult(_0x2502d0,_0x5d26bd){_0x5d26bd=_0x5d26bd||0xc8;return function(_0x4da3a4){if(_0x4da3a4){return _0x2502d0[_0x4c08('0x2b')](_0x5d26bd)['json'](_0x4da3a4);}};}function respondWithFilteredResult(_0x7e7cad,_0x5778e3){return function(_0x5c562d){if(_0x5c562d){var _0x2299d3=typeof _0x5778e3['offset']===_0x4c08('0x2c')&&typeof _0x5778e3[_0x4c08('0x2d')]===_0x4c08('0x2c');var _0x8c17db=_0x5c562d[_0x4c08('0x2e')];var _0x49eaf7=_0x2299d3?0x0:_0x5778e3[_0x4c08('0x2f')];var _0x293fec=_0x2299d3?_0x5c562d[_0x4c08('0x2e')]:_0x5778e3['offset']+_0x5778e3[_0x4c08('0x2d')];var _0x5054ff;if(_0x293fec>=_0x8c17db){_0x293fec=_0x8c17db;_0x5054ff=0xc8;}else{_0x5054ff=0xce;}_0x7e7cad['status'](_0x5054ff);return _0x7e7cad[_0x4c08('0x30')]('Content-Range',_0x49eaf7+'-'+_0x293fec+'/'+_0x8c17db)['json'](_0x5c562d);}return null;};}function patchUpdates(_0x65a9fd){return function(_0x2f526f){try{jsonpatch[_0x4c08('0x31')](_0x2f526f,_0x65a9fd,!![]);}catch(_0x324da7){return BPromise[_0x4c08('0x32')](_0x324da7);}return _0x2f526f['save']();};}function saveUpdates(_0x40c84e,_0x3fa523){return function(_0x5318cf){if(_0x5318cf){return _0x5318cf[_0x4c08('0x33')](_0x40c84e)[_0x4c08('0x34')](function(_0x69cf81){return _0x69cf81;});}return null;};}function removeEntity(_0x3d7507,_0x1803e2){return function(_0x2adf28){if(_0x2adf28){return _0x2adf28['destroy']()[_0x4c08('0x34')](function(){_0x3d7507[_0x4c08('0x2b')](0xcc)[_0x4c08('0x35')]();});}};}function handleEntityNotFound(_0x1cc0f3,_0xaf920b){return function(_0x514fd3){if(!_0x514fd3){_0x1cc0f3[_0x4c08('0x2a')](0x194);}return _0x514fd3;};}function handleError(_0x943757,_0x4f4644){_0x4f4644=_0x4f4644||0x1f4;return function(_0x1c43d3){logger[_0x4c08('0x24')](_0x1c43d3[_0x4c08('0x36')]);if(_0x1c43d3['name']){delete _0x1c43d3[_0x4c08('0x37')];}_0x943757[_0x4c08('0x2b')](_0x4f4644)['send'](_0x1c43d3);};}exports[_0x4c08('0x38')]=function(_0x3ffe1a,_0x56962e){var _0x197392={},_0x3bf470={},_0x59df66={'count':0x0,'rows':[]};var _0x124f91=_[_0x4c08('0x39')](db[_0x4c08('0x3a')]['rawAttributes'],function(_0x4c29e9){return{'name':_0x4c29e9[_0x4c08('0x3b')],'type':_0x4c29e9[_0x4c08('0x3c')]['key']};});_0x3bf470[_0x4c08('0x3d')]=_[_0x4c08('0x39')](_0x124f91,'name');_0x3bf470[_0x4c08('0x3e')]=_['keys'](_0x3ffe1a[_0x4c08('0x3e')]);_0x3bf470[_0x4c08('0x3f')]=_['intersection'](_0x3bf470['model'],_0x3bf470['query']);_0x197392['attributes']=_[_0x4c08('0x40')](_0x3bf470['model'],qs['fields'](_0x3ffe1a[_0x4c08('0x3e')][_0x4c08('0x41')]));_0x197392['attributes']=_0x197392['attributes']['length']?_0x197392[_0x4c08('0x42')]:_0x3bf470[_0x4c08('0x3d')];if(!_0x3ffe1a[_0x4c08('0x3e')][_0x4c08('0x43')]('nolimit')){_0x197392[_0x4c08('0x2d')]=qs['limit'](_0x3ffe1a[_0x4c08('0x3e')]['limit']);_0x197392['offset']=qs[_0x4c08('0x2f')](_0x3ffe1a[_0x4c08('0x3e')]['offset']);}_0x197392['order']=qs[_0x4c08('0x44')](_0x3ffe1a['query'][_0x4c08('0x44')]);_0x197392[_0x4c08('0x45')]=qs['filters'](_[_0x4c08('0x46')](_0x3ffe1a[_0x4c08('0x3e')],_0x3bf470[_0x4c08('0x3f')]),_0x124f91);if(_0x3ffe1a[_0x4c08('0x3e')][_0x4c08('0x47')]){_0x197392[_0x4c08('0x45')]=_[_0x4c08('0x48')](_0x197392[_0x4c08('0x45')],{'$or':_[_0x4c08('0x39')](_0x124f91,function(_0x245748){if(_0x245748[_0x4c08('0x3c')]!==_0x4c08('0x49')){var _0x475b29={};_0x475b29[_0x245748[_0x4c08('0x37')]]={'$like':'%'+_0x3ffe1a[_0x4c08('0x3e')][_0x4c08('0x47')]+'%'};return _0x475b29;}})});}_0x197392=_[_0x4c08('0x48')]({},_0x197392,_0x3ffe1a[_0x4c08('0x4a')]);var _0x2c60df={'where':_0x197392['where']};return db['FaxMessage'][_0x4c08('0x2e')](_0x2c60df)[_0x4c08('0x34')](function(_0x223d6c){_0x59df66[_0x4c08('0x2e')]=_0x223d6c;if(_0x3ffe1a['query'][_0x4c08('0x4b')]){_0x197392['include']=[{'all':!![]}];}return db[_0x4c08('0x3a')][_0x4c08('0x4c')](_0x197392);})[_0x4c08('0x34')](function(_0x4a4d6f){_0x59df66['rows']=_0x4a4d6f;return _0x59df66;})[_0x4c08('0x34')](respondWithFilteredResult(_0x56962e,_0x197392))[_0x4c08('0x29')](handleError(_0x56962e,null));};exports[_0x4c08('0x4d')]=function(_0x15a8e7,_0x3dd93e){var _0x5f2974={'raw':!![],'where':{'id':_0x15a8e7[_0x4c08('0x4e')]['id']}},_0x1420f9={};_0x1420f9[_0x4c08('0x3d')]=_['keys'](db[_0x4c08('0x3a')][_0x4c08('0x4f')]);_0x1420f9[_0x4c08('0x3e')]=_[_0x4c08('0x50')](_0x15a8e7['query']);_0x1420f9[_0x4c08('0x3f')]=_[_0x4c08('0x40')](_0x1420f9[_0x4c08('0x3d')],_0x1420f9['query']);_0x5f2974[_0x4c08('0x42')]=_['intersection'](_0x1420f9['model'],qs[_0x4c08('0x41')](_0x15a8e7['query']['fields']));_0x5f2974[_0x4c08('0x42')]=_0x5f2974[_0x4c08('0x42')][_0x4c08('0x51')]?_0x5f2974[_0x4c08('0x42')]:_0x1420f9[_0x4c08('0x3d')];if(_0x15a8e7[_0x4c08('0x3e')][_0x4c08('0x4b')]){_0x5f2974[_0x4c08('0x52')]=[{'all':!![]}];}_0x5f2974=_[_0x4c08('0x48')]({},_0x5f2974,_0x15a8e7['options']);return db[_0x4c08('0x3a')][_0x4c08('0x53')](_0x5f2974)[_0x4c08('0x34')](handleEntityNotFound(_0x3dd93e,null))['then'](respondWithResult(_0x3dd93e,null))[_0x4c08('0x29')](handleError(_0x3dd93e,null));};exports[_0x4c08('0x33')]=function(_0x261532,_0x2c0315){if(_0x261532[_0x4c08('0x54')]['id']){delete _0x261532[_0x4c08('0x54')]['id'];}return db[_0x4c08('0x3a')][_0x4c08('0x53')]({'where':{'id':_0x261532[_0x4c08('0x4e')]['id']}})[_0x4c08('0x34')](handleEntityNotFound(_0x2c0315,null))[_0x4c08('0x34')](saveUpdates(_0x261532['body'],null))[_0x4c08('0x34')](respondWithResult(_0x2c0315,null))[_0x4c08('0x29')](handleError(_0x2c0315,null));};exports[_0x4c08('0x55')]=function(_0x13423f,_0x2654da){return db[_0x4c08('0x3a')]['find']({'where':{'id':_0x13423f['params']['id']}})[_0x4c08('0x34')](handleEntityNotFound(_0x2654da,null))['then'](removeEntity(_0x2654da,null))['catch'](handleError(_0x2654da,null));};exports['describe']=function(_0x2edd31,_0x68e81e){return db['FaxMessage'][_0x4c08('0x56')]()[_0x4c08('0x34')](respondWithResult(_0x68e81e,null))['catch'](handleError(_0x68e81e,null));};var interaction_log=require('../../config/logger')(_0x4c08('0x57'));exports[_0x4c08('0x58')]=function(_0x5911d2,_0x14b7ac,_0x41a35d){var _0x26cb8e={'agent':{},'channel':_0x4c08('0x59')};if(_0x5911d2[_0x4c08('0x54')]['id']){delete _0x5911d2[_0x4c08('0x54')]['id'];}_0x5911d2[_0x4c08('0x54')][_0x4c08('0x5a')]=!![];_0x5911d2[_0x4c08('0x54')][_0x4c08('0x5b')]=moment()[_0x4c08('0x5c')](_0x4c08('0x5d'));_0x5911d2[_0x4c08('0x54')][_0x4c08('0x5e')]=_0x5911d2[_0x4c08('0x54')][_0x4c08('0x5e')]||_0x5911d2[_0x4c08('0x5f')]['id'];_0x26cb8e[_0x4c08('0x60')]['id']=_0x5911d2[_0x4c08('0x54')][_0x4c08('0x5e')];return db[_0x4c08('0x3a')]['find']({'where':{'id':_0x5911d2['params']['id'],'UserId':null}})[_0x4c08('0x34')](handleEntityNotFound(_0x14b7ac,null))['then'](saveUpdates(_0x5911d2[_0x4c08('0x54')],null))['then'](function(_0x4e25e6){if(_0x4e25e6){_0x26cb8e[_0x4c08('0x26')]=_0x4e25e6[_0x4c08('0x61')]({'plain':!![]});return db[_0x4c08('0x62')][_0x4c08('0x53')]({'where':{'id':_0x4e25e6[_0x4c08('0x63')]}});}return null;})[_0x4c08('0x34')](handleEntityNotFound(_0x14b7ac,null))[_0x4c08('0x34')](function(_0x402363){if(_0x402363){return _0x402363[_0x4c08('0x33')]({'UserId':_0x5911d2[_0x4c08('0x54')][_0x4c08('0x5e')],'read1stAt':_[_0x4c08('0x64')](_0x402363[_0x4c08('0x65')])?moment()[_0x4c08('0x5c')](_0x4c08('0x5d')):undefined});}return null;})['then'](function(_0x45fa51){if(_0x45fa51){_0x26cb8e[_0x4c08('0x66')]=_0x45fa51['get']({'plain':!![]});interaction_log[_0x4c08('0x21')](_0x4c08('0x67'),_0x5911d2[_0x4c08('0x5f')]['id'],_0x5911d2[_0x4c08('0x5f')][_0x4c08('0x37')],_0x5911d2[_0x4c08('0x5f')]['role'],_0x26cb8e[_0x4c08('0x66')]['id'],_0x5911d2[_0x4c08('0x54')]?JSON[_0x4c08('0x23')](_0x5911d2['body']):_0x4c08('0x68'));return respondWithRpcPromise('AcceptMessage',_0x4c08('0x69'),_0x26cb8e);}return null;})[_0x4c08('0x34')](function(_0x204b8b){var _0x36b832=_0x4c08('0x6a')+_0x204b8b[_0x4c08('0x26')]['ContactId'];return db[_0x4c08('0x6b')]['query'](_0x36b832,{'type':db[_0x4c08('0x6c')]['QueryTypes'][_0x4c08('0x6d')],'raw':!![]})[_0x4c08('0x34')](function(_0x1c552f){return _0x1c552f;});})['then'](function(_0x2cb498){if(_0x2cb498){_0x26cb8e['message'][_0x4c08('0x6e')]=_0x2cb498[0x0];if(!_0x5911d2[_0x4c08('0x54')][_0x4c08('0x5e')])return;return db[_0x4c08('0x6f')][_0x4c08('0x53')]({'where':{'id':_0x5911d2['body'][_0x4c08('0x5e')],'role':_0x4c08('0x60')},'attributes':['id',_0x4c08('0x37'),_0x4c08('0x70'),'email',_0x4c08('0x71')],'raw':!![]});}return null;})[_0x4c08('0x34')](function(_0x49f937){if(!_0x49f937)return null;_0x26cb8e[_0x4c08('0x26')][_0x4c08('0x60')]=_0x49f937;return _0x26cb8e;})[_0x4c08('0x34')](function(_0x499336){if(_0x499336){if(_0x5911d2['body'][_0x4c08('0x72')]){_0x26cb8e['message'][_0x4c08('0x73')]=util['format'](_0x4c08('0x74'),_0x5911d2[_0x4c08('0x5f')]['name']);_0x26cb8e[_0x4c08('0x26')]['channel']=_0x26cb8e[_0x4c08('0x75')];_0x26cb8e['message']['event']=_0x4c08('0x58');return respondWithRpcPromise(_0x4c08('0x76'),'EventManager',{'event':_0x4c08('0x77'),'message':_0x26cb8e[_0x4c08('0x26')]},client9002)[_0x4c08('0x34')](function(){return _0x26cb8e;});}return _0x26cb8e;}return null;})['then'](respondWithResult(_0x14b7ac,null))[_0x4c08('0x29')](handleError(_0x14b7ac,null));};var interaction_log=require(_0x4c08('0x13'))('fax-interactions');exports[_0x4c08('0x32')]=function(_0x2a5fd7,_0xf713b8,_0x1714bb){var _0x1c1fe8={'agent':{},'channel':_0x4c08('0x59')};if(_0x2a5fd7['body']['id']){delete _0x2a5fd7[_0x4c08('0x54')]['id'];}_0x2a5fd7[_0x4c08('0x54')]['UserId']=_0x2a5fd7['body'][_0x4c08('0x5e')]||_0x2a5fd7['user']['id'];_0x1c1fe8[_0x4c08('0x60')]['id']=_0x2a5fd7[_0x4c08('0x54')]['UserId'];return db[_0x4c08('0x3a')]['find']({'where':{'id':_0x2a5fd7[_0x4c08('0x4e')]['id'],'UserId':null}})[_0x4c08('0x34')](handleEntityNotFound(_0xf713b8,null))[_0x4c08('0x34')](function(_0x25c3f5){if(_0x25c3f5){_0x1c1fe8[_0x4c08('0x26')]=_0x25c3f5['get']({'plain':!![]});return db['FaxInteraction'][_0x4c08('0x53')]({'where':{'id':_0x25c3f5[_0x4c08('0x63')]}});}return null;})['then'](handleEntityNotFound(_0xf713b8,null))[_0x4c08('0x34')](function(_0x39e3f3){if(_0x39e3f3){_0x1c1fe8['interaction']=_0x39e3f3[_0x4c08('0x61')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2a5fd7[_0x4c08('0x5f')]['id'],_0x2a5fd7['user'][_0x4c08('0x37')],_0x2a5fd7[_0x4c08('0x5f')][_0x4c08('0x78')],_0x1c1fe8[_0x4c08('0x66')]['id'],_0x2a5fd7[_0x4c08('0x54')]?JSON[_0x4c08('0x23')](_0x2a5fd7['body']):'null');return respondWithRpcPromise('RejectMessage',_0x4c08('0x79'),_0x1c1fe8);}return null;})[_0x4c08('0x34')](function(_0x1d435b){var _0x30de62=_0x4c08('0x6a')+_0x1d435b[_0x4c08('0x26')][_0x4c08('0x7a')];return db[_0x4c08('0x6b')][_0x4c08('0x3e')](_0x30de62,{'type':db['Sequelize'][_0x4c08('0x7b')][_0x4c08('0x6d')],'raw':!![]})[_0x4c08('0x34')](function(_0x49fc28){return _0x49fc28;});})['then'](function(_0x3336f6){if(_0x3336f6){_0x1c1fe8[_0x4c08('0x26')][_0x4c08('0x6e')]=_0x3336f6[0x0];if(!_0x2a5fd7[_0x4c08('0x54')][_0x4c08('0x5e')])return;return db[_0x4c08('0x6f')][_0x4c08('0x53')]({'where':{'id':_0x2a5fd7[_0x4c08('0x54')][_0x4c08('0x5e')],'role':_0x4c08('0x60')},'attributes':['id','name','fullname','email',_0x4c08('0x71')],'raw':!![]});}return null;})['then'](function(_0x46a2be){if(!_0x46a2be)return null;_0x1c1fe8[_0x4c08('0x26')][_0x4c08('0x60')]=_0x46a2be;return _0x1c1fe8;})[_0x4c08('0x34')](function(_0x255023){if(_0x255023){_0x255023[_0x4c08('0x26')]['interface']=util['format']('SIP/%s',_0x2a5fd7[_0x4c08('0x5f')]['name']);_0x255023[_0x4c08('0x26')]['channel']=_0x1c1fe8['channel'];_0x255023[_0x4c08('0x26')]['event']=_0x4c08('0x32');respondWithRpcPromise(_0x4c08('0x76'),_0x4c08('0x76'),{'event':_0x4c08('0x7c'),'message':_0x255023[_0x4c08('0x26')]},client9002);return _0x1c1fe8;}return null;})[_0x4c08('0x34')](respondWithResult(_0xf713b8,null))[_0x4c08('0x29')](handleError(_0xf713b8,null));};exports['create']=function(_0x4b69c6,_0x1a4e9b){var _0x12ed29;return db[_0x4c08('0x3a')]['create'](_0x4b69c6[_0x4c08('0x54')],{})[_0x4c08('0x34')](function(_0xdd41cd){_0x12ed29=_0xdd41cd;return db[_0x4c08('0x7d')][_0x4c08('0x7e')]({'where':{'id':_0x12ed29[_0x4c08('0x7a')]}});})[_0x4c08('0x34')](function(_0x49d3a4){if(_[_0x4c08('0x64')](_0x49d3a4)){return;}else{_0x12ed29[_0x4c08('0x59')]=_0x49d3a4[_0x4c08('0x59')];return db[_0x4c08('0x7f')][_0x4c08('0x7e')]({'where':{'id':_0x12ed29[_0x4c08('0x80')]}});}})[_0x4c08('0x34')](function(_0xf900b7){return respondWithRpcPromise(_0x4c08('0x81'),_0x4c08('0x81'),{'FaxAccountId':_[_0x4c08('0x64')](_0x4b69c6[_0x4c08('0x54')])?undefined:_0x4b69c6[_0x4c08('0x54')][_0x4c08('0x82')],'path':_['isNil'](_0xf900b7)?undefined:util['format'](_0x4c08('0x83'),_0xf900b7[_0x4c08('0x84')]),'fax':_[_0x4c08('0x64')](_0x12ed29[_0x4c08('0x59')])?undefined:_0x12ed29['fax'],'AttachmentId':_0x12ed29['AttachmentId']},client9002);})['then'](respondWithResult(_0x1a4e9b,0xc9))['catch'](handleError(_0x1a4e9b,null));};exports[_0x4c08('0x85')]=function(_0xcb23ba,_0x5a53a0){var _0x4085fc=path[_0x4c08('0x86')](config[_0x4c08('0x87')],_0x4c08('0x88'),_0x4c08('0x89'),_0x4c08('0x8a'));return db[_0x4c08('0x3a')][_0x4c08('0x53')]({'where':{'id':_0xcb23ba[_0x4c08('0x4e')]['id']},'include':[{'model':db[_0x4c08('0x7f')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x5a53a0,null))['then'](function(_0x4172fb){if(_0x4172fb){return _0x5a53a0['download'](path['join'](_0x4085fc,_0x4172fb[_0x4c08('0x7f')][_0x4c08('0x84')]));}})[_0x4c08('0x29')](handleError(_0x5a53a0,null));}; \ No newline at end of file +var _0xfee9=['YYYY-MM-DD\x20HH:mm:ss','interaction','info','user','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','channel','EventManager','acceptmessage','fax','FaxInteraction','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','User','event','reject','rejectmessage','create','CmContact','findOne','isNil','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','attachments','Attachment','join','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./faxMessage.socket','jayson/promise','client','http','request','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','sendStatus','status','end','json','offset','undefined','set','Content-Range','save','update','stack','name','send','index','map','FaxMessage','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','rawAttributes','body','find','params','destroy','describe','../../config/logger','fax-interactions','accept','read','readAt','format','UserId','agent','get','read1stAt'];(function(_0x1d5077,_0x195b14){var _0x410ea9=function(_0xd878b8){while(--_0xd878b8){_0x1d5077['push'](_0x1d5077['shift']());}};_0x410ea9(++_0x195b14);}(_0xfee9,0x1ea));var _0x9fee=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xfee9[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9fee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fee('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9fee('0x2'));var Mustache=require(_0x9fee('0x3'));var util=require(_0x9fee('0x4'));var path=require(_0x9fee('0x5'));var sox=require(_0x9fee('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9fee('0x7'));var squel=require('squel');var crypto=require(_0x9fee('0x8'));var jsforce=require(_0x9fee('0x9'));var deskjs=require(_0x9fee('0xa'));var toCsv=require(_0x9fee('0xb'));var querystring=require(_0x9fee('0xc'));var Papa=require('papaparse');var Redis=require(_0x9fee('0xd'));var authService=require(_0x9fee('0xe'));var qs=require(_0x9fee('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9fee('0x10'));var logger=require('../../config/logger')(_0x9fee('0x11'));var utils=require(_0x9fee('0x12'));var config=require(_0x9fee('0x13'));var licenseUtil=require(_0x9fee('0x14'));var db=require(_0x9fee('0x15'))['db'];config['redis']=_[_0x9fee('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9fee('0x17'))(new Redis(config[_0x9fee('0x18')]));require(_0x9fee('0x19'))['register'](socket);var jayson=require(_0x9fee('0x1a'));var client=jayson[_0x9fee('0x1b')][_0x9fee('0x1c')]({'port':0x232c});var client9002=jayson[_0x9fee('0x1b')][_0x9fee('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x13e720,_0x44ab72,_0x55829b,_0x19cb18){return new BPromise(function(_0x12cff6,_0x3b3eaa){var _0x48a2e0=_0x19cb18||client;return _0x48a2e0[_0x9fee('0x1d')](_0x13e720,_0x55829b)[_0x9fee('0x1e')](function(_0x44ec0d){logger['info']('FaxMessage,\x20%s,\x20%s',_0x44ab72,_0x9fee('0x1f'));logger[_0x9fee('0x20')](_0x9fee('0x21'),_0x44ab72,_0x9fee('0x1f'),JSON[_0x9fee('0x22')](_0x44ec0d));if(_0x44ec0d[_0x9fee('0x23')]){if(_0x44ec0d['error'][_0x9fee('0x24')]===0x1f4){logger[_0x9fee('0x23')](_0x9fee('0x25'),_0x44ab72,_0x44ec0d[_0x9fee('0x23')][_0x9fee('0x26')]);return _0x3b3eaa(_0x44ec0d[_0x9fee('0x23')][_0x9fee('0x26')]);}logger[_0x9fee('0x23')](_0x9fee('0x25'),_0x44ab72,_0x44ec0d['error'][_0x9fee('0x26')]);return _0x12cff6(_0x44ec0d[_0x9fee('0x23')][_0x9fee('0x26')]);}else{logger['info'](_0x9fee('0x25'),_0x44ab72,_0x9fee('0x1f'));_0x12cff6(_0x44ec0d['result'][_0x9fee('0x26')]);}})['catch'](function(_0x299f2d){logger['error'](_0x9fee('0x25'),_0x44ab72,_0x299f2d);_0x3b3eaa(_0x299f2d);});});}function respondWithStatusCode(_0x168a50,_0x2db0e4){_0x2db0e4=_0x2db0e4||0xcc;return function(_0x1050fa){if(_0x1050fa){return _0x168a50[_0x9fee('0x27')](_0x2db0e4);}return _0x168a50[_0x9fee('0x28')](_0x2db0e4)[_0x9fee('0x29')]();};}function respondWithResult(_0x3a9509,_0x15a5ae){_0x15a5ae=_0x15a5ae||0xc8;return function(_0x534914){if(_0x534914){return _0x3a9509[_0x9fee('0x28')](_0x15a5ae)[_0x9fee('0x2a')](_0x534914);}};}function respondWithFilteredResult(_0x6fd52c,_0x54db55){return function(_0x1db1ca){if(_0x1db1ca){var _0x47eafe=typeof _0x54db55[_0x9fee('0x2b')]===_0x9fee('0x2c')&&typeof _0x54db55['limit']===_0x9fee('0x2c');var _0x5865c9=_0x1db1ca['count'];var _0x15fc7e=_0x47eafe?0x0:_0x54db55[_0x9fee('0x2b')];var _0x2f7d89=_0x47eafe?_0x1db1ca['count']:_0x54db55[_0x9fee('0x2b')]+_0x54db55['limit'];var _0x469014;if(_0x2f7d89>=_0x5865c9){_0x2f7d89=_0x5865c9;_0x469014=0xc8;}else{_0x469014=0xce;}_0x6fd52c['status'](_0x469014);return _0x6fd52c[_0x9fee('0x2d')](_0x9fee('0x2e'),_0x15fc7e+'-'+_0x2f7d89+'/'+_0x5865c9)['json'](_0x1db1ca);}return null;};}function patchUpdates(_0x286f5d){return function(_0x43fb84){try{jsonpatch['apply'](_0x43fb84,_0x286f5d,!![]);}catch(_0x2dce29){return BPromise['reject'](_0x2dce29);}return _0x43fb84[_0x9fee('0x2f')]();};}function saveUpdates(_0xb1eb4d,_0x5f5666){return function(_0x52084c){if(_0x52084c){return _0x52084c[_0x9fee('0x30')](_0xb1eb4d)[_0x9fee('0x1e')](function(_0x3a2f74){return _0x3a2f74;});}return null;};}function removeEntity(_0x5ec0ac,_0x16b5f7){return function(_0xce1caf){if(_0xce1caf){return _0xce1caf['destroy']()[_0x9fee('0x1e')](function(){_0x5ec0ac[_0x9fee('0x28')](0xcc)[_0x9fee('0x29')]();});}};}function handleEntityNotFound(_0x44041d,_0xc44b21){return function(_0x14db2f){if(!_0x14db2f){_0x44041d['sendStatus'](0x194);}return _0x14db2f;};}function handleError(_0x183016,_0x23f757){_0x23f757=_0x23f757||0x1f4;return function(_0x5f51fd){logger['error'](_0x5f51fd[_0x9fee('0x31')]);if(_0x5f51fd[_0x9fee('0x32')]){delete _0x5f51fd[_0x9fee('0x32')];}_0x183016['status'](_0x23f757)[_0x9fee('0x33')](_0x5f51fd);};}exports[_0x9fee('0x34')]=function(_0x63e16,_0x45cf94){var _0x50a7b8={},_0x53114b={},_0x22b17b={'count':0x0,'rows':[]};var _0x3dfa54=_[_0x9fee('0x35')](db[_0x9fee('0x36')]['rawAttributes'],function(_0x41ab46){return{'name':_0x41ab46[_0x9fee('0x37')],'type':_0x41ab46[_0x9fee('0x38')][_0x9fee('0x39')]};});_0x53114b['model']=_[_0x9fee('0x35')](_0x3dfa54,_0x9fee('0x32'));_0x53114b['query']=_[_0x9fee('0x3a')](_0x63e16[_0x9fee('0x3b')]);_0x53114b[_0x9fee('0x3c')]=_[_0x9fee('0x3d')](_0x53114b[_0x9fee('0x3e')],_0x53114b[_0x9fee('0x3b')]);_0x50a7b8['attributes']=_['intersection'](_0x53114b[_0x9fee('0x3e')],qs[_0x9fee('0x3f')](_0x63e16[_0x9fee('0x3b')][_0x9fee('0x3f')]));_0x50a7b8[_0x9fee('0x40')]=_0x50a7b8[_0x9fee('0x40')][_0x9fee('0x41')]?_0x50a7b8[_0x9fee('0x40')]:_0x53114b[_0x9fee('0x3e')];if(!_0x63e16[_0x9fee('0x3b')]['hasOwnProperty'](_0x9fee('0x42'))){_0x50a7b8[_0x9fee('0x43')]=qs[_0x9fee('0x43')](_0x63e16[_0x9fee('0x3b')][_0x9fee('0x43')]);_0x50a7b8['offset']=qs[_0x9fee('0x2b')](_0x63e16[_0x9fee('0x3b')][_0x9fee('0x2b')]);}_0x50a7b8[_0x9fee('0x44')]=qs['sort'](_0x63e16[_0x9fee('0x3b')][_0x9fee('0x45')]);_0x50a7b8[_0x9fee('0x46')]=qs[_0x9fee('0x3c')](_[_0x9fee('0x47')](_0x63e16['query'],_0x53114b[_0x9fee('0x3c')]),_0x3dfa54);if(_0x63e16['query'][_0x9fee('0x48')]){_0x50a7b8[_0x9fee('0x46')]=_[_0x9fee('0x49')](_0x50a7b8['where'],{'$or':_[_0x9fee('0x35')](_0x3dfa54,function(_0xec7014){if(_0xec7014[_0x9fee('0x38')]!==_0x9fee('0x4a')){var _0x3b92d4={};_0x3b92d4[_0xec7014[_0x9fee('0x32')]]={'$like':'%'+_0x63e16[_0x9fee('0x3b')][_0x9fee('0x48')]+'%'};return _0x3b92d4;}})});}_0x50a7b8=_['merge']({},_0x50a7b8,_0x63e16[_0x9fee('0x4b')]);var _0x232ca5={'where':_0x50a7b8['where']};return db[_0x9fee('0x36')][_0x9fee('0x4c')](_0x232ca5)['then'](function(_0x43d07b){_0x22b17b['count']=_0x43d07b;if(_0x63e16[_0x9fee('0x3b')][_0x9fee('0x4d')]){_0x50a7b8[_0x9fee('0x4e')]=[{'all':!![]}];}return db[_0x9fee('0x36')]['findAll'](_0x50a7b8);})['then'](function(_0x56367a){_0x22b17b[_0x9fee('0x4f')]=_0x56367a;return _0x22b17b;})[_0x9fee('0x1e')](respondWithFilteredResult(_0x45cf94,_0x50a7b8))[_0x9fee('0x50')](handleError(_0x45cf94,null));};exports[_0x9fee('0x51')]=function(_0x1b5cd6,_0x1664a1){var _0x5b5ffc={'raw':!![],'where':{'id':_0x1b5cd6['params']['id']}},_0x8252d5={};_0x8252d5[_0x9fee('0x3e')]=_[_0x9fee('0x3a')](db['FaxMessage'][_0x9fee('0x52')]);_0x8252d5['query']=_['keys'](_0x1b5cd6[_0x9fee('0x3b')]);_0x8252d5['filters']=_[_0x9fee('0x3d')](_0x8252d5['model'],_0x8252d5['query']);_0x5b5ffc[_0x9fee('0x40')]=_['intersection'](_0x8252d5[_0x9fee('0x3e')],qs[_0x9fee('0x3f')](_0x1b5cd6[_0x9fee('0x3b')][_0x9fee('0x3f')]));_0x5b5ffc[_0x9fee('0x40')]=_0x5b5ffc[_0x9fee('0x40')][_0x9fee('0x41')]?_0x5b5ffc[_0x9fee('0x40')]:_0x8252d5[_0x9fee('0x3e')];if(_0x1b5cd6[_0x9fee('0x3b')][_0x9fee('0x4d')]){_0x5b5ffc[_0x9fee('0x4e')]=[{'all':!![]}];}_0x5b5ffc=_['merge']({},_0x5b5ffc,_0x1b5cd6[_0x9fee('0x4b')]);return db[_0x9fee('0x36')]['find'](_0x5b5ffc)[_0x9fee('0x1e')](handleEntityNotFound(_0x1664a1,null))[_0x9fee('0x1e')](respondWithResult(_0x1664a1,null))[_0x9fee('0x50')](handleError(_0x1664a1,null));};exports[_0x9fee('0x30')]=function(_0x2db122,_0x3ec03e){if(_0x2db122[_0x9fee('0x53')]['id']){delete _0x2db122['body']['id'];}return db[_0x9fee('0x36')][_0x9fee('0x54')]({'where':{'id':_0x2db122[_0x9fee('0x55')]['id']}})[_0x9fee('0x1e')](handleEntityNotFound(_0x3ec03e,null))['then'](saveUpdates(_0x2db122[_0x9fee('0x53')],null))[_0x9fee('0x1e')](respondWithResult(_0x3ec03e,null))[_0x9fee('0x50')](handleError(_0x3ec03e,null));};exports[_0x9fee('0x56')]=function(_0x1b53ab,_0x555c14){return db['FaxMessage'][_0x9fee('0x54')]({'where':{'id':_0x1b53ab[_0x9fee('0x55')]['id']}})['then'](handleEntityNotFound(_0x555c14,null))[_0x9fee('0x1e')](removeEntity(_0x555c14,null))[_0x9fee('0x50')](handleError(_0x555c14,null));};exports[_0x9fee('0x57')]=function(_0x3d6ee8,_0x13e626){return db[_0x9fee('0x36')][_0x9fee('0x57')]()[_0x9fee('0x1e')](respondWithResult(_0x13e626,null))['catch'](handleError(_0x13e626,null));};var interaction_log=require(_0x9fee('0x58'))(_0x9fee('0x59'));exports[_0x9fee('0x5a')]=function(_0x3e7019,_0x4cb735,_0x4b7c0b){var _0x3233dd={'agent':{},'channel':'fax'};if(_0x3e7019['body']['id']){delete _0x3e7019['body']['id'];}_0x3e7019['body'][_0x9fee('0x5b')]=!![];_0x3e7019[_0x9fee('0x53')][_0x9fee('0x5c')]=moment()[_0x9fee('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e7019[_0x9fee('0x53')]['UserId']=_0x3e7019[_0x9fee('0x53')][_0x9fee('0x5e')]||_0x3e7019['user']['id'];_0x3233dd[_0x9fee('0x5f')]['id']=_0x3e7019['body'][_0x9fee('0x5e')];return db[_0x9fee('0x36')][_0x9fee('0x54')]({'where':{'id':_0x3e7019[_0x9fee('0x55')]['id'],'UserId':null}})[_0x9fee('0x1e')](handleEntityNotFound(_0x4cb735,null))[_0x9fee('0x1e')](saveUpdates(_0x3e7019[_0x9fee('0x53')],null))[_0x9fee('0x1e')](function(_0x4e81fb){if(_0x4e81fb){_0x3233dd[_0x9fee('0x26')]=_0x4e81fb[_0x9fee('0x60')]({'plain':!![]});return db['FaxInteraction'][_0x9fee('0x54')]({'where':{'id':_0x4e81fb['FaxInteractionId']}});}return null;})[_0x9fee('0x1e')](handleEntityNotFound(_0x4cb735,null))[_0x9fee('0x1e')](function(_0x3d3afa){if(_0x3d3afa){return _0x3d3afa[_0x9fee('0x30')]({'UserId':_0x3e7019[_0x9fee('0x53')][_0x9fee('0x5e')],'read1stAt':_['isNil'](_0x3d3afa[_0x9fee('0x61')])?moment()['format'](_0x9fee('0x62')):undefined});}return null;})[_0x9fee('0x1e')](function(_0x5d5716){if(_0x5d5716){_0x3233dd[_0x9fee('0x63')]=_0x5d5716[_0x9fee('0x60')]({'plain':!![]});interaction_log[_0x9fee('0x64')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3e7019['user']['id'],_0x3e7019['user'][_0x9fee('0x32')],_0x3e7019[_0x9fee('0x65')]['role'],_0x3233dd[_0x9fee('0x63')]['id'],_0x3e7019[_0x9fee('0x53')]?JSON[_0x9fee('0x22')](_0x3e7019[_0x9fee('0x53')]):_0x9fee('0x66'));return respondWithRpcPromise(_0x9fee('0x67'),_0x9fee('0x68'),_0x3233dd);}return null;})['then'](function(_0x4c6dca){var _0x426662='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4c6dca[_0x9fee('0x26')]['ContactId'];return db[_0x9fee('0x69')][_0x9fee('0x3b')](_0x426662,{'type':db[_0x9fee('0x6a')][_0x9fee('0x6b')][_0x9fee('0x6c')],'raw':!![]})['then'](function(_0x957a7e){return _0x957a7e;});})[_0x9fee('0x1e')](function(_0x43d93c){if(_0x43d93c){_0x3233dd[_0x9fee('0x26')][_0x9fee('0x6d')]=_0x43d93c[0x0];if(!_0x3e7019[_0x9fee('0x53')][_0x9fee('0x5e')])return;return db['User'][_0x9fee('0x54')]({'where':{'id':_0x3e7019[_0x9fee('0x53')][_0x9fee('0x5e')],'role':'agent'},'attributes':['id',_0x9fee('0x32'),_0x9fee('0x6e'),_0x9fee('0x6f'),_0x9fee('0x70')],'raw':!![]});}return null;})[_0x9fee('0x1e')](function(_0x121a36){if(!_0x121a36)return null;_0x3233dd['message'][_0x9fee('0x5f')]=_0x121a36;return _0x3233dd;})[_0x9fee('0x1e')](function(_0x3638a1){if(_0x3638a1){if(_0x3e7019[_0x9fee('0x53')][_0x9fee('0x71')]){_0x3233dd[_0x9fee('0x26')][_0x9fee('0x72')]=util['format']('SIP/%s',_0x3e7019[_0x9fee('0x65')]['name']);_0x3233dd[_0x9fee('0x26')][_0x9fee('0x73')]=_0x3233dd[_0x9fee('0x73')];_0x3233dd['message']['event']=_0x9fee('0x5a');return respondWithRpcPromise(_0x9fee('0x74'),_0x9fee('0x74'),{'event':_0x9fee('0x75'),'message':_0x3233dd[_0x9fee('0x26')]},client9002)[_0x9fee('0x1e')](function(){return _0x3233dd;});}return _0x3233dd;}return null;})['then'](respondWithResult(_0x4cb735,null))[_0x9fee('0x50')](handleError(_0x4cb735,null));};var interaction_log=require(_0x9fee('0x58'))('fax-interactions');exports['reject']=function(_0x4d8913,_0x5ba25e,_0x4d4693){var _0x3f61ce={'agent':{},'channel':_0x9fee('0x76')};if(_0x4d8913[_0x9fee('0x53')]['id']){delete _0x4d8913['body']['id'];}_0x4d8913[_0x9fee('0x53')][_0x9fee('0x5e')]=_0x4d8913[_0x9fee('0x53')][_0x9fee('0x5e')]||_0x4d8913[_0x9fee('0x65')]['id'];_0x3f61ce[_0x9fee('0x5f')]['id']=_0x4d8913[_0x9fee('0x53')][_0x9fee('0x5e')];return db['FaxMessage'][_0x9fee('0x54')]({'where':{'id':_0x4d8913['params']['id'],'UserId':null}})[_0x9fee('0x1e')](handleEntityNotFound(_0x5ba25e,null))['then'](function(_0xeedbe4){if(_0xeedbe4){_0x3f61ce[_0x9fee('0x26')]=_0xeedbe4[_0x9fee('0x60')]({'plain':!![]});return db[_0x9fee('0x77')]['find']({'where':{'id':_0xeedbe4[_0x9fee('0x78')]}});}return null;})[_0x9fee('0x1e')](handleEntityNotFound(_0x5ba25e,null))[_0x9fee('0x1e')](function(_0x2a75ad){if(_0x2a75ad){_0x3f61ce[_0x9fee('0x63')]=_0x2a75ad[_0x9fee('0x60')]({'plain':!![]});interaction_log[_0x9fee('0x64')](_0x9fee('0x79'),_0x4d8913[_0x9fee('0x65')]['id'],_0x4d8913[_0x9fee('0x65')][_0x9fee('0x32')],_0x4d8913[_0x9fee('0x65')][_0x9fee('0x7a')],_0x3f61ce[_0x9fee('0x63')]['id'],_0x4d8913[_0x9fee('0x53')]?JSON['stringify'](_0x4d8913[_0x9fee('0x53')]):_0x9fee('0x66'));return respondWithRpcPromise(_0x9fee('0x7b'),_0x9fee('0x7c'),_0x3f61ce);}return null;})[_0x9fee('0x1e')](function(_0x3a1799){var _0xe42b16=_0x9fee('0x7d')+_0x3a1799[_0x9fee('0x26')][_0x9fee('0x7e')];return db[_0x9fee('0x69')]['query'](_0xe42b16,{'type':db[_0x9fee('0x6a')][_0x9fee('0x6b')][_0x9fee('0x6c')],'raw':!![]})[_0x9fee('0x1e')](function(_0x41db4c){return _0x41db4c;});})[_0x9fee('0x1e')](function(_0x231f3e){if(_0x231f3e){_0x3f61ce['message']['contact']=_0x231f3e[0x0];if(!_0x4d8913[_0x9fee('0x53')][_0x9fee('0x5e')])return;return db[_0x9fee('0x7f')][_0x9fee('0x54')]({'where':{'id':_0x4d8913[_0x9fee('0x53')][_0x9fee('0x5e')],'role':_0x9fee('0x5f')},'attributes':['id','name','fullname',_0x9fee('0x6f'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3c5c3c){if(!_0x3c5c3c)return null;_0x3f61ce[_0x9fee('0x26')][_0x9fee('0x5f')]=_0x3c5c3c;return _0x3f61ce;})['then'](function(_0x367460){if(_0x367460){_0x367460['message'][_0x9fee('0x72')]=util[_0x9fee('0x5d')]('SIP/%s',_0x4d8913['user'][_0x9fee('0x32')]);_0x367460[_0x9fee('0x26')]['channel']=_0x3f61ce[_0x9fee('0x73')];_0x367460[_0x9fee('0x26')][_0x9fee('0x80')]=_0x9fee('0x81');respondWithRpcPromise(_0x9fee('0x74'),_0x9fee('0x74'),{'event':_0x9fee('0x82'),'message':_0x367460[_0x9fee('0x26')]},client9002);return _0x3f61ce;}return null;})[_0x9fee('0x1e')](respondWithResult(_0x5ba25e,null))[_0x9fee('0x50')](handleError(_0x5ba25e,null));};exports[_0x9fee('0x83')]=function(_0x2f2f7e,_0x3288ec){var _0x54917d;return db[_0x9fee('0x36')][_0x9fee('0x83')](_0x2f2f7e['body'],{})[_0x9fee('0x1e')](function(_0x23898a){_0x54917d=_0x23898a;return db[_0x9fee('0x84')][_0x9fee('0x85')]({'where':{'id':_0x54917d['ContactId']}});})[_0x9fee('0x1e')](function(_0x1431e5){if(_[_0x9fee('0x86')](_0x1431e5)){return;}else{_0x54917d[_0x9fee('0x76')]=_0x1431e5['fax'];return db['Attachment']['findOne']({'where':{'id':_0x54917d[_0x9fee('0x87')]}});}})['then'](function(_0x84c33a){return respondWithRpcPromise('SendFax',_0x9fee('0x88'),{'FaxAccountId':_[_0x9fee('0x86')](_0x2f2f7e['body'])?undefined:_0x2f2f7e[_0x9fee('0x53')][_0x9fee('0x89')],'path':_[_0x9fee('0x86')](_0x84c33a)?undefined:util[_0x9fee('0x5d')](_0x9fee('0x8a'),_0x84c33a[_0x9fee('0x8b')]),'fax':_[_0x9fee('0x86')](_0x54917d['fax'])?undefined:_0x54917d[_0x9fee('0x76')],'AttachmentId':_0x54917d[_0x9fee('0x87')]},client9002);})[_0x9fee('0x1e')](respondWithResult(_0x3288ec,0xc9))['catch'](handleError(_0x3288ec,null));};exports[_0x9fee('0x8c')]=function(_0x11e78f,_0x23a16d){var _0x2f71cd=path['join'](config[_0x9fee('0x8d')],_0x9fee('0x8e'),_0x9fee('0x8f'),_0x9fee('0x90'));return db[_0x9fee('0x36')][_0x9fee('0x54')]({'where':{'id':_0x11e78f[_0x9fee('0x55')]['id']},'include':[{'model':db[_0x9fee('0x91')],'as':_0x9fee('0x91')}]})[_0x9fee('0x1e')](handleEntityNotFound(_0x23a16d,null))[_0x9fee('0x1e')](function(_0x431f91){if(_0x431f91){return _0x23a16d[_0x9fee('0x8c')](path[_0x9fee('0x92')](_0x2f71cd,_0x431f91['Attachment'][_0x9fee('0x8b')]));}})[_0x9fee('0x50')](handleError(_0x23a16d,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 29f6447..e8c9234 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 _0x1893=['FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5a187b,_0x1f64fe){var _0x14d601=function(_0x45fd29){while(--_0x45fd29){_0x5a187b['push'](_0x5a187b['shift']());}};_0x14d601(++_0x1f64fe);}(_0x1893,0xa2));var _0x3189=function(_0x5b0bc8,_0x3f86b0){_0x5b0bc8=_0x5b0bc8-0x0;var _0x1626a5=_0x1893[_0x5b0bc8];return _0x1626a5;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x3189('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x3189('0x1')](0x0);var events={'afterCreate':_0x3189('0x2'),'afterUpdate':_0x3189('0x3'),'afterDestroy':_0x3189('0x4')};function emitEvent(_0x36a7b0){return function(_0x3953a2,_0x5371db,_0x27445){FaxMessageEvents[_0x3189('0x5')](_0x36a7b0+':'+_0x3953a2['id'],_0x3953a2);FaxMessageEvents[_0x3189('0x5')](_0x36a7b0,_0x3953a2);_0x27445(null);};}for(var e in events){if(events[_0x3189('0x6')](e)){var event=events[e];FaxMessage[_0x3189('0x7')](e,emitEvent(event));}}module[_0x3189('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x9120=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','remove','emit'];(function(_0x513c06,_0x3b6f47){var _0x4dce1e=function(_0x387641){while(--_0x387641){_0x513c06['push'](_0x513c06['shift']());}};_0x4dce1e(++_0x3b6f47);}(_0x9120,0x1b3));var _0x0912=function(_0x1985f7,_0x286c47){_0x1985f7=_0x1985f7-0x0;var _0x1abf7c=_0x9120[_0x1985f7];return _0x1abf7c;};'use strict';var EventEmitter=require(_0x0912('0x0'));var FaxMessage=require(_0x0912('0x1'))['db'][_0x0912('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x0912('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0912('0x4')};function emitEvent(_0x3f15a8){return function(_0x24fc0a,_0x217a2e,_0x3c1cdb){FaxMessageEvents[_0x0912('0x5')](_0x3f15a8+':'+_0x24fc0a['id'],_0x24fc0a);FaxMessageEvents['emit'](_0x3f15a8,_0x24fc0a);_0x3c1cdb(null);};}for(var e in events){if(events[_0x0912('0x6')](e)){var event=events[e];FaxMessage[_0x0912('0x7')](e,emitEvent(event));}}module[_0x0912('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 5d9dee5..7c0f214 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 _0x2f10=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x57a20e,_0x5438d8){var _0x5cb788=function(_0x5fb05f){while(--_0x5fb05f){_0x57a20e['push'](_0x57a20e['shift']());}};_0x5cb788(++_0x5438d8);}(_0x2f10,0x1f1));var _0x02f1=function(_0x5d047f,_0x25eb99){_0x5d047f=_0x5d047f-0x0;var _0x4b6d30=_0x2f10[_0x5d047f];return _0x4b6d30;};'use strict';var _=require(_0x02f1('0x0'));var util=require('util');var logger=require(_0x02f1('0x1'))(_0x02f1('0x2'));var moment=require(_0x02f1('0x3'));var BPromise=require(_0x02f1('0x4'));var rp=require(_0x02f1('0x5'));var fs=require('fs');var path=require(_0x02f1('0x6'));var rimraf=require(_0x02f1('0x7'));var config=require(_0x02f1('0x8'));var attributes=require(_0x02f1('0x9'));module['exports']=function(_0x442ebc,_0x1495d9){return _0x442ebc[_0x02f1('0xa')](_0x02f1('0xb'),attributes,{'tableName':_0x02f1('0xc'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x02f1('0xd')],'type':_0x02f1('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e9512,_0x4a54cb,_0x148728){var _0x2cc883=_0x442ebc[_0x02f1('0xf')];var _0x22a471=_0x2e9512[_0x02f1('0x10')]({'plain':!![]});if(_0x22a471[_0x02f1('0x11')][_0x02f1('0x12')]()==='in'||_0x22a471[_0x02f1('0x11')][_0x02f1('0x12')]()===_0x02f1('0x13')&&!_0x22a471[_0x02f1('0x14')]&&!_['isNil'](_0x22a471[_0x02f1('0x15')])){_0x2cc883[_0x02f1('0x16')][_0x02f1('0x17')]({'where':{'id':_0x22a471['FaxInteractionId']}})['then'](function(_0x34a87e){if(_0x34a87e){_0x34a87e['update']({'lastMsgAt':_0x22a471['createdAt'],'lastMsgDirection':_0x22a471['direction'][_0x02f1('0x12')]()});}})['catch'](function(_0x4e0ea8){console['error'](_0x4e0ea8);});}_0x148728();}},'charset':'utf8mb4','collate':_0x02f1('0x18')});}; \ No newline at end of file +var _0xfea2=['catch','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','models','get','direction','toLowerCase','out','secret','UserId','FaxInteraction','then','createdAt'];(function(_0xce93c,_0x555be5){var _0x230720=function(_0x6d5428){while(--_0x6d5428){_0xce93c['push'](_0xce93c['shift']());}};_0x230720(++_0x555be5);}(_0xfea2,0x10a));var _0x2fea=function(_0x2ce286,_0x4104e4){_0x2ce286=_0x2ce286-0x0;var _0x4c471f=_0xfea2[_0x2ce286];return _0x4c471f;};'use strict';var _=require(_0x2fea('0x0'));var util=require('util');var logger=require(_0x2fea('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2fea('0x2'));var rp=require(_0x2fea('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2fea('0x4'));module[_0x2fea('0x5')]=function(_0x514233,_0x3aae35){return _0x514233['define'](_0x2fea('0x6'),attributes,{'tableName':_0x2fea('0x7'),'paranoid':![],'indexes':[{'name':_0x2fea('0x8'),'fields':[_0x2fea('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f60d1,_0x4198ff,_0x4d1ca7){var _0x27ebdd=_0x514233[_0x2fea('0xa')];var _0x4ca092=_0x1f60d1[_0x2fea('0xb')]({'plain':!![]});if(_0x4ca092[_0x2fea('0xc')][_0x2fea('0xd')]()==='in'||_0x4ca092[_0x2fea('0xc')][_0x2fea('0xd')]()===_0x2fea('0xe')&&!_0x4ca092[_0x2fea('0xf')]&&!_['isNil'](_0x4ca092[_0x2fea('0x10')])){_0x27ebdd[_0x2fea('0x11')]['findOne']({'where':{'id':_0x4ca092['FaxInteractionId']}})[_0x2fea('0x12')](function(_0x5b0784){if(_0x5b0784){_0x5b0784['update']({'lastMsgAt':_0x4ca092[_0x2fea('0x13')],'lastMsgDirection':_0x4ca092['direction'][_0x2fea('0xd')]()});}})[_0x2fea('0x14')](function(_0x19fb3a){console['error'](_0x19fb3a);});}_0x4d1ca7();}},'charset':'utf8mb4','collate':_0x2fea('0x15')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 3978df1..56e0743 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 _0x98a8=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./faxMessage.socket','register','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','UpdateFaxMessage','update','raw','attributes','limit','stringify','lodash','util','moment','bluebird'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x98a8,0x12c));var _0x898a=function(_0x57a788,_0x4026ac){_0x57a788=_0x57a788-0x0;var _0x34b568=_0x98a8[_0x57a788];return _0x34b568;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});config[_0x898a('0xc')]=_['defaults'](config[_0x898a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x898a('0xd'))(new Redis(config[_0x898a('0xc')]));require(_0x898a('0xe'))[_0x898a('0xf')](socket);function respondWithRpcPromise(_0x3150df,_0x388a47,_0x42faa4){return new BPromise(function(_0x1a92de,_0x3806cb){return client['request'](_0x3150df,_0x42faa4)[_0x898a('0x10')](function(_0x502e95){logger[_0x898a('0x11')]('FaxMessage,\x20%s,\x20%s',_0x388a47,_0x898a('0x12'));logger[_0x898a('0x13')](_0x898a('0x14'),_0x388a47,'request\x20sent',JSON['stringify'](_0x502e95));if(_0x502e95['error']){if(_0x502e95[_0x898a('0x15')][_0x898a('0x16')]===0x1f4){logger[_0x898a('0x15')](_0x898a('0x17'),_0x388a47,_0x502e95[_0x898a('0x15')][_0x898a('0x18')]);return _0x3806cb(_0x502e95['error'][_0x898a('0x18')]);}logger['error'](_0x898a('0x17'),_0x388a47,_0x502e95['error'][_0x898a('0x18')]);return _0x1a92de(_0x502e95['error'][_0x898a('0x18')]);}else{logger['info'](_0x898a('0x17'),_0x388a47,_0x898a('0x12'));_0x1a92de(_0x502e95[_0x898a('0x19')]['message']);}})[_0x898a('0x1a')](function(_0x5960e0){logger['error'](_0x898a('0x17'),_0x388a47,_0x5960e0);_0x3806cb(_0x5960e0);});});}exports[_0x898a('0x1b')]=function(_0x58c3ab){var _0x4d374b=this;return new Promise(function(_0x12bc0f,_0x26449a){return db[_0x898a('0x1c')][_0x898a('0x1d')](_0x58c3ab[_0x898a('0x1e')],{'raw':_0x58c3ab[_0x898a('0x1f')]?_0x58c3ab[_0x898a('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x898a('0x10')](function(_0x50718e){logger[_0x898a('0x11')](_0x898a('0x1b'),_0x58c3ab);logger[_0x898a('0x13')](_0x898a('0x1b'),_0x58c3ab,JSON['stringify'](_0x50718e));_0x12bc0f(_0x50718e);})[_0x898a('0x1a')](function(_0x16c318){logger[_0x898a('0x15')](_0x898a('0x1b'),_0x16c318[_0x898a('0x18')],_0x58c3ab);_0x26449a(_0x4d374b[_0x898a('0x15')](0x1f4,_0x16c318['message']));});});};exports[_0x898a('0x20')]=function(_0x51d501){var _0x513c6b=this;return new Promise(function(_0x53ddb2,_0x3678be){return db[_0x898a('0x1c')][_0x898a('0x21')](_0x51d501[_0x898a('0x1e')],{'raw':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')][_0x898a('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')]['where']||null:null,'attributes':_0x51d501['options']?_0x51d501['options'][_0x898a('0x23')]||null:null,'limit':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')][_0x898a('0x24')]||null:null})[_0x898a('0x10')](function(_0x560000){logger[_0x898a('0x11')](_0x898a('0x20'),_0x51d501);logger[_0x898a('0x13')](_0x898a('0x20'),_0x51d501,JSON[_0x898a('0x25')](_0x560000));_0x53ddb2(_0x560000);})[_0x898a('0x1a')](function(_0x494127){logger[_0x898a('0x15')](_0x898a('0x20'),_0x494127[_0x898a('0x18')],_0x51d501);_0x3678be(_0x513c6b[_0x898a('0x15')](0x1f4,_0x494127[_0x898a('0x18')]));});});}; \ No newline at end of file +var _0x4bc3=['CreateFaxMessage','FaxMessage','create','body','options','raw','then','stringify','catch','UpdateFaxMessage','update','where','attributes','limit','info','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4bc3,0x16e));var _0x34bc=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x4bc3[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var moment=require('moment');var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var jayson=require(_0x34bc('0x9'));var client=jayson[_0x34bc('0xa')]['http']({'port':0x232a});config[_0x34bc('0xb')]=_['defaults'](config['redis'],{'host':_0x34bc('0xc'),'port':0x18eb});var socket=require(_0x34bc('0xd'))(new Redis(config[_0x34bc('0xb')]));require(_0x34bc('0xe'))[_0x34bc('0xf')](socket);function respondWithRpcPromise(_0x41b2ff,_0x5de8b5,_0x5a478d){return new BPromise(function(_0x2b8112,_0x33025c){return client[_0x34bc('0x10')](_0x41b2ff,_0x5a478d)['then'](function(_0x41960e){logger['info'](_0x34bc('0x11'),_0x5de8b5,_0x34bc('0x12'));logger[_0x34bc('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5de8b5,_0x34bc('0x12'),JSON['stringify'](_0x41960e));if(_0x41960e[_0x34bc('0x14')]){if(_0x41960e[_0x34bc('0x14')][_0x34bc('0x15')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x5de8b5,_0x41960e[_0x34bc('0x14')]['message']);return _0x33025c(_0x41960e[_0x34bc('0x14')][_0x34bc('0x16')]);}logger[_0x34bc('0x14')](_0x34bc('0x11'),_0x5de8b5,_0x41960e[_0x34bc('0x14')][_0x34bc('0x16')]);return _0x2b8112(_0x41960e['error']['message']);}else{logger['info'](_0x34bc('0x11'),_0x5de8b5,_0x34bc('0x12'));_0x2b8112(_0x41960e[_0x34bc('0x17')][_0x34bc('0x16')]);}})['catch'](function(_0x46aa24){logger[_0x34bc('0x14')]('FaxMessage,\x20%s,\x20%s',_0x5de8b5,_0x46aa24);_0x33025c(_0x46aa24);});});}exports[_0x34bc('0x18')]=function(_0x9e9f14){var _0x4d2d5e=this;return new Promise(function(_0x14cec8,_0x26cdec){return db[_0x34bc('0x19')][_0x34bc('0x1a')](_0x9e9f14[_0x34bc('0x1b')],{'raw':_0x9e9f14[_0x34bc('0x1c')]?_0x9e9f14['options'][_0x34bc('0x1d')]===undefined?!![]:![]:!![]})[_0x34bc('0x1e')](function(_0x38882c){logger['info']('CreateFaxMessage',_0x9e9f14);logger[_0x34bc('0x13')](_0x34bc('0x18'),_0x9e9f14,JSON[_0x34bc('0x1f')](_0x38882c));_0x14cec8(_0x38882c);})[_0x34bc('0x20')](function(_0x13094a){logger[_0x34bc('0x14')](_0x34bc('0x18'),_0x13094a[_0x34bc('0x16')],_0x9e9f14);_0x26cdec(_0x4d2d5e[_0x34bc('0x14')](0x1f4,_0x13094a[_0x34bc('0x16')]));});});};exports[_0x34bc('0x21')]=function(_0x1edcb0){var _0x4fd589=this;return new Promise(function(_0x43e527,_0x48ec13){return db['FaxMessage'][_0x34bc('0x22')](_0x1edcb0['body'],{'raw':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1edcb0['options']?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x23')]||null:null,'attributes':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x24')]||null:null,'limit':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0['options'][_0x34bc('0x25')]||null:null})[_0x34bc('0x1e')](function(_0x22aacc){logger[_0x34bc('0x26')](_0x34bc('0x21'),_0x1edcb0);logger[_0x34bc('0x13')]('UpdateFaxMessage',_0x1edcb0,JSON[_0x34bc('0x1f')](_0x22aacc));_0x43e527(_0x22aacc);})['catch'](function(_0x530748){logger[_0x34bc('0x14')]('UpdateFaxMessage',_0x530748[_0x34bc('0x16')],_0x1edcb0);_0x48ec13(_0x4fd589[_0x34bc('0x14')](0x1f4,_0x530748[_0x34bc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 3bfa320..ee94cdb 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 _0xc2ad=['removeListener','length','faxMessage:','./faxMessage.events','save','update','emit'];(function(_0x3af5ab,_0x167210){var _0x46861c=function(_0x536180){while(--_0x536180){_0x3af5ab['push'](_0x3af5ab['shift']());}};_0x46861c(++_0x167210);}(_0xc2ad,0x96));var _0xdc2a=function(_0xf6250e,_0x23015a){_0xf6250e=_0xf6250e-0x0;var _0x3d4dff=_0xc2ad[_0xf6250e];return _0x3d4dff;};'use strict';var FaxMessageEvents=require(_0xdc2a('0x0'));var events=[_0xdc2a('0x1'),'remove',_0xdc2a('0x2')];function createListener(_0xb4c014,_0x867113){return function(_0x17b054){_0x867113[_0xdc2a('0x3')](_0xb4c014,_0x17b054);};}function removeListener(_0xc504de,_0x8fead6){return function(){FaxMessageEvents[_0xdc2a('0x4')](_0xc504de,_0x8fead6);};}exports['register']=function(_0x26d991){for(var _0x46a332=0x0,_0x5c13f1=events[_0xdc2a('0x5')];_0x46a332<_0x5c13f1;_0x46a332++){var _0x32b213=events[_0x46a332];var _0x58261e=createListener(_0xdc2a('0x6')+_0x32b213,_0x26d991);FaxMessageEvents['on'](_0x32b213,_0x58261e);}}; \ No newline at end of file +var _0xc349=['removeListener','register','save','remove','update','emit'];(function(_0x17be35,_0x216466){var _0x1bbb1f=function(_0x3fb931){while(--_0x3fb931){_0x17be35['push'](_0x17be35['shift']());}};_0x1bbb1f(++_0x216466);}(_0xc349,0x1ee));var _0x9c34=function(_0xc334b5,_0x8058b6){_0xc334b5=_0xc334b5-0x0;var _0x328723=_0xc349[_0xc334b5];return _0x328723;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x9c34('0x0'),_0x9c34('0x1'),_0x9c34('0x2')];function createListener(_0x3c4bbc,_0x43e420){return function(_0x40c579){_0x43e420[_0x9c34('0x3')](_0x3c4bbc,_0x40c579);};}function removeListener(_0x1ee704,_0x3017be){return function(){FaxMessageEvents[_0x9c34('0x4')](_0x1ee704,_0x3017be);};}exports[_0x9c34('0x5')]=function(_0x23219d){for(var _0x428703=0x0,_0x28aeb1=events['length'];_0x428703<_0x28aeb1;_0x428703++){var _0x5d7188=events[_0x428703];var _0x202293=createListener('faxMessage:'+_0x5d7188,_0x23219d);FaxMessageEvents['on'](_0x5d7188,_0x202293);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index db370a0..4092670 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 _0xb49a=['put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','show','download','post','tracked','fax','create'];(function(_0x2445eb,_0x2f4822){var _0x2e4130=function(_0x3c9b92){while(--_0x3c9b92){_0x2445eb['push'](_0x2445eb['shift']());}};_0x2e4130(++_0x2f4822);}(_0xb49a,0xfb));var _0xab49=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0xb49a[_0x219d87];return _0x22823d;};'use strict';var multer=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var path=require(_0xab49('0x2'));var timeout=require(_0xab49('0x3'));var express=require(_0xab49('0x4'));var router=express['Router']();var fs_extra=require(_0xab49('0x5'));var auth=require(_0xab49('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xab49('0x7'));router[_0xab49('0x8')]('/',auth[_0xab49('0x9')](),controller[_0xab49('0xa')]);router[_0xab49('0x8')](_0xab49('0xb'),auth[_0xab49('0x9')](),controller['describe']);router[_0xab49('0x8')](_0xab49('0xc'),auth[_0xab49('0x9')](),controller[_0xab49('0xd')]);router[_0xab49('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xab49('0xe')]);router[_0xab49('0xf')]('/',auth[_0xab49('0x9')](),interaction[_0xab49('0x10')](_0xab49('0x11'),'faxmessage:create'),controller[_0xab49('0x12')]);router[_0xab49('0x13')](_0xab49('0xc'),auth[_0xab49('0x9')](),controller[_0xab49('0x14')]);router[_0xab49('0x13')](_0xab49('0x15'),auth[_0xab49('0x9')](),controller[_0xab49('0x16')]);router[_0xab49('0x13')](_0xab49('0x17'),auth['isAuthenticated'](),controller[_0xab49('0x18')]);router[_0xab49('0x19')](_0xab49('0xc'),auth[_0xab49('0x9')](),controller[_0xab49('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xda3f=['create','put','/:id/accept','/:id/reject','destroy','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create'];(function(_0x30fb3d,_0x246528){var _0x4e3adf=function(_0x5834cc){while(--_0x5834cc){_0x30fb3d['push'](_0x30fb3d['shift']());}};_0x4e3adf(++_0x246528);}(_0xda3f,0xec));var _0xfda3=function(_0x4045a0,_0x45c81e){_0x4045a0=_0x4045a0-0x0;var _0x4cfa18=_0xda3f[_0x4045a0];return _0x4cfa18;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./faxMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')]('/',auth['isAuthenticated'](),interaction[_0xfda3('0xe')](_0xfda3('0xf'),_0xfda3('0x10')),controller[_0xfda3('0x11')]);router[_0xfda3('0x12')]('/:id',auth[_0xfda3('0x6')](),controller['update']);router[_0xfda3('0x12')](_0xfda3('0x13'),auth['isAuthenticated'](),controller['accept']);router['put'](_0xfda3('0x14'),auth[_0xfda3('0x6')](),controller['reject']);router['delete']('/:id',auth[_0xfda3('0x6')](),controller[_0xfda3('0x15')]);module[_0xfda3('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a00f4e5..dc5676c 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 _0x788c=['roundrobin','exports','name','INTEGER','beepall'];(function(_0x19d19c,_0x1f05da){var _0x849751=function(_0x11d43a){while(--_0x11d43a){_0x19d19c['push'](_0x19d19c['shift']());}};_0x849751(++_0x1f05da);}(_0x788c,0xf6));var _0xc788=function(_0x41a294,_0x2b27a2){_0x41a294=_0x41a294-0x0;var _0x5d1bcd=_0x788c[_0x41a294];return _0x5d1bcd;};'use strict';var Sequelize=require('sequelize');module[_0xc788('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xc788('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xc788('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xc788('0x3'),_0xc788('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc788('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c57=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x28622a,_0x3c712c){var _0x51ac3e=function(_0x2456a1){while(--_0x2456a1){_0x28622a['push'](_0x28622a['shift']());}};_0x51ac3e(++_0x3c712c);}(_0x9c57,0x99));var _0x79c5=function(_0x1fde60,_0xff7dd5){_0x1fde60=_0x1fde60-0x0;var _0x265ced=_0x9c57[_0x1fde60];return _0x265ced;};'use strict';var Sequelize=require(_0x79c5('0x0'));module[_0x79c5('0x1')]={'name':{'type':Sequelize[_0x79c5('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x79c5('0x2')]},'timeout':{'type':Sequelize[_0x79c5('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x79c5('0x4')](_0x79c5('0x5'),_0x79c5('0x6'),_0x79c5('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x79c5('0x3')],'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 d5569ac..b30a69f 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 _0x5173=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','FaxQueue','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','user','get','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserFaxQueue','FaxQueueId','User','UserId','faxPause','updatedAt','format','%s/%s','SIP','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','emit','removeTeams','Team','select','tq.TeamId','from','team_has_fax_queues','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','all','compact','removeAgents','forEach','userFaxQueue:remove','addAgents','spread','userFaxQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','sendStatus','status','end','undefined','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','query'];(function(_0x55bf78,_0x8d7da1){var _0x484e78=function(_0x80446b){while(--_0x80446b){_0x55bf78['push'](_0x55bf78['shift']());}};_0x484e78(++_0x8d7da1);}(_0x5173,0xd8));var _0x3517=function(_0x4ac067,_0x2c3eae){_0x4ac067=_0x4ac067-0x0;var _0x44bc38=_0x5173[_0x4ac067];return _0x44bc38;};'use strict';var emlformat=require(_0x3517('0x0'));var rimraf=require(_0x3517('0x1'));var zipdir=require(_0x3517('0x2'));var jsonpatch=require(_0x3517('0x3'));var rp=require(_0x3517('0x4'));var moment=require('moment');var BPromise=require(_0x3517('0x5'));var Mustache=require(_0x3517('0x6'));var util=require(_0x3517('0x7'));var path=require(_0x3517('0x8'));var sox=require(_0x3517('0x9'));var csv=require(_0x3517('0xa'));var ejs=require(_0x3517('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3517('0xc'));var squel=require(_0x3517('0xd'));var crypto=require('crypto');var jsforce=require(_0x3517('0xe'));var deskjs=require(_0x3517('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3517('0x10'));var Redis=require('ioredis');var authService=require(_0x3517('0x11'));var qs=require(_0x3517('0x12'));var as=require(_0x3517('0x13'));var hardwareService=require(_0x3517('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x3517('0x15'));var config=require(_0x3517('0x16'));var licenseUtil=require(_0x3517('0x17'));var db=require(_0x3517('0x18'))['db'];config[_0x3517('0x19')]=_[_0x3517('0x1a')](config['redis'],{'host':_0x3517('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3517('0x1c'))['register'](socket);function respondWithStatusCode(_0x21c5d3,_0x10f984){_0x10f984=_0x10f984||0xcc;return function(_0x1ec3a6){if(_0x1ec3a6){return _0x21c5d3[_0x3517('0x1d')](_0x10f984);}return _0x21c5d3[_0x3517('0x1e')](_0x10f984)[_0x3517('0x1f')]();};}function respondWithResult(_0xf95dc1,_0x52701c){_0x52701c=_0x52701c||0xc8;return function(_0x54efc5){if(_0x54efc5){return _0xf95dc1['status'](_0x52701c)['json'](_0x54efc5);}};}function respondWithFilteredResult(_0x3b0096,_0x348c56){return function(_0x57d120){if(_0x57d120){var _0x30c3f9=typeof _0x348c56['offset']==='undefined'&&typeof _0x348c56['limit']===_0x3517('0x20');var _0x5320b6=_0x57d120[_0x3517('0x21')];var _0x591f41=_0x30c3f9?0x0:_0x348c56[_0x3517('0x22')];var _0x5ef2f0=_0x30c3f9?_0x57d120['count']:_0x348c56[_0x3517('0x22')]+_0x348c56[_0x3517('0x23')];var _0x59cb75;if(_0x5ef2f0>=_0x5320b6){_0x5ef2f0=_0x5320b6;_0x59cb75=0xc8;}else{_0x59cb75=0xce;}_0x3b0096[_0x3517('0x1e')](_0x59cb75);return _0x3b0096[_0x3517('0x24')]('Content-Range',_0x591f41+'-'+_0x5ef2f0+'/'+_0x5320b6)[_0x3517('0x25')](_0x57d120);}return null;};}function patchUpdates(_0x4278ad){return function(_0x41e0fd){try{jsonpatch[_0x3517('0x26')](_0x41e0fd,_0x4278ad,!![]);}catch(_0x2b8774){return BPromise[_0x3517('0x27')](_0x2b8774);}return _0x41e0fd[_0x3517('0x28')]();};}function saveUpdates(_0x4042a1,_0x2f6814){return function(_0x468b14){if(_0x468b14){return _0x468b14[_0x3517('0x29')](_0x4042a1)[_0x3517('0x2a')](function(_0x28dec5){return _0x28dec5;});}return null;};}function removeEntity(_0x27f247,_0x2b90f0){return function(_0x2bf1e2){if(_0x2bf1e2){return _0x2bf1e2[_0x3517('0x2b')]()[_0x3517('0x2a')](function(){var _0x2ba92f=_0x2bf1e2['get']({'plain':!![]});var _0x38eaeb='FaxQueues';return db['UserProfileResource'][_0x3517('0x2b')]({'where':{'type':_0x38eaeb,'resourceId':_0x2ba92f['id']}})[_0x3517('0x2a')](function(){return _0x2bf1e2;});})[_0x3517('0x2a')](function(){_0x27f247[_0x3517('0x1e')](0xcc)[_0x3517('0x1f')]();});}};}function handleEntityNotFound(_0x545f80,_0x584ce0){return function(_0x36a8a1){if(!_0x36a8a1){_0x545f80[_0x3517('0x1d')](0x194);}return _0x36a8a1;};}function handleError(_0x3eaa2b,_0x415c85){_0x415c85=_0x415c85||0x1f4;return function(_0x4502dd){logger[_0x3517('0x2c')](_0x4502dd['stack']);if(_0x4502dd[_0x3517('0x2d')]){delete _0x4502dd[_0x3517('0x2d')];}_0x3eaa2b['status'](_0x415c85)[_0x3517('0x2e')](_0x4502dd);};}exports[_0x3517('0x2f')]=function(_0x58e705,_0x57d2f9){var _0x154f29={},_0x125665={},_0x3ef46a={'count':0x0,'rows':[]};var _0x67861e=_[_0x3517('0x30')](db['FaxQueue'][_0x3517('0x31')],function(_0x314d88){return{'name':_0x314d88[_0x3517('0x32')],'type':_0x314d88['type'][_0x3517('0x33')]};});_0x125665[_0x3517('0x34')]=_[_0x3517('0x30')](_0x67861e,_0x3517('0x2d'));_0x125665[_0x3517('0x35')]=_['keys'](_0x58e705['query']);_0x125665[_0x3517('0x36')]=_[_0x3517('0x37')](_0x125665[_0x3517('0x34')],_0x125665[_0x3517('0x35')]);_0x154f29['attributes']=_['intersection'](_0x125665[_0x3517('0x34')],qs[_0x3517('0x38')](_0x58e705[_0x3517('0x35')][_0x3517('0x38')]));_0x154f29[_0x3517('0x39')]=_0x154f29['attributes'][_0x3517('0x3a')]?_0x154f29['attributes']:_0x125665[_0x3517('0x34')];if(!_0x58e705[_0x3517('0x35')][_0x3517('0x3b')](_0x3517('0x3c'))){_0x154f29[_0x3517('0x23')]=qs['limit'](_0x58e705[_0x3517('0x35')]['limit']);_0x154f29['offset']=qs[_0x3517('0x22')](_0x58e705[_0x3517('0x35')][_0x3517('0x22')]);}_0x154f29[_0x3517('0x3d')]=qs[_0x3517('0x3e')](_0x58e705['query'][_0x3517('0x3e')]);_0x154f29[_0x3517('0x3f')]=qs[_0x3517('0x36')](_[_0x3517('0x40')](_0x58e705[_0x3517('0x35')],_0x125665[_0x3517('0x36')]),_0x67861e);if(_0x58e705[_0x3517('0x35')][_0x3517('0x41')]){_0x154f29[_0x3517('0x3f')]=_[_0x3517('0x42')](_0x154f29[_0x3517('0x3f')],{'$or':_['map'](_0x67861e,function(_0x20e7ed){if(_0x20e7ed[_0x3517('0x43')]!==_0x3517('0x44')){var _0x1ead12={};_0x1ead12[_0x20e7ed[_0x3517('0x2d')]]={'$like':'%'+_0x58e705['query']['filter']+'%'};return _0x1ead12;}})});}_0x154f29=_[_0x3517('0x42')]({},_0x154f29,_0x58e705['options']);var _0x1a44aa={'where':_0x154f29['where']};return db[_0x3517('0x45')]['count'](_0x1a44aa)['then'](function(_0x49edd9){_0x3ef46a['count']=_0x49edd9;if(_0x58e705[_0x3517('0x35')]['includeAll']){_0x154f29[_0x3517('0x46')]=[{'all':!![]}];}return db[_0x3517('0x45')][_0x3517('0x47')](_0x154f29);})[_0x3517('0x2a')](function(_0x4765e8){_0x3ef46a[_0x3517('0x48')]=_0x4765e8;return _0x3ef46a;})[_0x3517('0x2a')](respondWithFilteredResult(_0x57d2f9,_0x154f29))[_0x3517('0x49')](handleError(_0x57d2f9,null));};exports[_0x3517('0x4a')]=function(_0x4834ee,_0x3e3a81){var _0x4e6173={'raw':!![],'where':{'id':_0x4834ee[_0x3517('0x4b')]['id']}},_0x2654a2={};_0x2654a2[_0x3517('0x34')]=_[_0x3517('0x4c')](db[_0x3517('0x45')]['rawAttributes']);_0x2654a2['query']=_['keys'](_0x4834ee[_0x3517('0x35')]);_0x2654a2[_0x3517('0x36')]=_[_0x3517('0x37')](_0x2654a2[_0x3517('0x34')],_0x2654a2[_0x3517('0x35')]);_0x4e6173[_0x3517('0x39')]=_[_0x3517('0x37')](_0x2654a2[_0x3517('0x34')],qs[_0x3517('0x38')](_0x4834ee['query'][_0x3517('0x38')]));_0x4e6173[_0x3517('0x39')]=_0x4e6173[_0x3517('0x39')][_0x3517('0x3a')]?_0x4e6173['attributes']:_0x2654a2[_0x3517('0x34')];if(_0x4834ee[_0x3517('0x35')][_0x3517('0x4d')]){_0x4e6173[_0x3517('0x46')]=[{'all':!![]}];}_0x4e6173=_[_0x3517('0x42')]({},_0x4e6173,_0x4834ee[_0x3517('0x4e')]);return db[_0x3517('0x45')][_0x3517('0x4f')](_0x4e6173)[_0x3517('0x2a')](handleEntityNotFound(_0x3e3a81,null))[_0x3517('0x2a')](respondWithResult(_0x3e3a81,null))['catch'](handleError(_0x3e3a81,null));};exports[_0x3517('0x50')]=function(_0x10be13,_0x51e765){return db['FaxQueue'][_0x3517('0x50')](_0x10be13[_0x3517('0x51')],{})['then'](function(_0x425766){var _0x4a5d73=_0x10be13[_0x3517('0x52')][_0x3517('0x53')]({'plain':!![]});if(!_0x4a5d73)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a5d73[_0x3517('0x54')]===_0x3517('0x52')){var _0x49d581=_0x425766[_0x3517('0x53')]({'plain':!![]});var _0x3ea6b1='FaxQueues';return db['UserProfileSection'][_0x3517('0x4f')]({'where':{'name':_0x3ea6b1,'userProfileId':_0x4a5d73[_0x3517('0x55')]},'raw':!![]})[_0x3517('0x2a')](function(_0x2bd70c){if(_0x2bd70c&&_0x2bd70c['autoAssociation']===0x0){return db[_0x3517('0x56')][_0x3517('0x50')]({'name':_0x49d581[_0x3517('0x2d')],'resourceId':_0x49d581['id'],'type':_0x2bd70c[_0x3517('0x2d')],'sectionId':_0x2bd70c['id']},{})['then'](function(){return _0x425766;});}else{return _0x425766;}})['catch'](function(_0xd8d8cc){logger[_0x3517('0x2c')](_0x3517('0x57'),_0xd8d8cc);throw _0xd8d8cc;});}return _0x425766;})[_0x3517('0x2a')](respondWithResult(_0x51e765,0xc9))['catch'](handleError(_0x51e765,null));};exports['update']=function(_0x3f9f34,_0x47c412){if(_0x3f9f34[_0x3517('0x51')]['id']){delete _0x3f9f34[_0x3517('0x51')]['id'];}return db[_0x3517('0x45')][_0x3517('0x4f')]({'where':{'id':_0x3f9f34[_0x3517('0x4b')]['id']}})['then'](handleEntityNotFound(_0x47c412,null))[_0x3517('0x2a')](saveUpdates(_0x3f9f34['body'],null))[_0x3517('0x2a')](respondWithResult(_0x47c412,null))[_0x3517('0x49')](handleError(_0x47c412,null));};exports['destroy']=function(_0x1b1737,_0x55d415){return db[_0x3517('0x45')][_0x3517('0x4f')]({'where':{'id':_0x1b1737[_0x3517('0x4b')]['id']}})[_0x3517('0x2a')](handleEntityNotFound(_0x55d415,null))['then'](removeEntity(_0x55d415,null))[_0x3517('0x49')](handleError(_0x55d415,null));};exports[_0x3517('0x58')]=function(_0x157984,_0x35beab){return db['FaxQueue'][_0x3517('0x58')]()[_0x3517('0x2a')](respondWithResult(_0x35beab,null))[_0x3517('0x49')](handleError(_0x35beab,null));};exports['getMembers']=function(_0x45afb0,_0x56ed48,_0x4d925c){var _0x19f859={'raw':!![],'where':{}},_0x4d66b0={},_0x1d0245;return db[_0x3517('0x45')][_0x3517('0x59')]({'where':{'id':_0x45afb0[_0x3517('0x4b')]['id']}})[_0x3517('0x2a')](handleEntityNotFound(_0x56ed48,null))['then'](function(_0x41736b){if(_0x41736b){_0x1d0245=_0x41736b['get']({'plain':!![]});_0x4d66b0[_0x3517('0x34')]=_['keys'](db[_0x3517('0x5a')][_0x3517('0x31')]);_0x4d66b0[_0x3517('0x35')]=_[_0x3517('0x4c')](_0x45afb0[_0x3517('0x35')]);_0x4d66b0[_0x3517('0x36')]=_[_0x3517('0x37')](_0x4d66b0['model'],_0x4d66b0[_0x3517('0x35')]);_0x19f859[_0x3517('0x39')]=_['intersection'](_0x4d66b0['model'],qs['fields'](_0x45afb0[_0x3517('0x35')][_0x3517('0x38')]));_0x19f859[_0x3517('0x39')]=_0x19f859['attributes'][_0x3517('0x3a')]?_0x19f859[_0x3517('0x39')]:_0x4d66b0[_0x3517('0x34')];if(!_0x45afb0['query'][_0x3517('0x3b')]('nolimit')){_0x19f859[_0x3517('0x23')]=qs[_0x3517('0x23')](_0x45afb0[_0x3517('0x35')]['limit']);_0x19f859[_0x3517('0x22')]=qs[_0x3517('0x22')](_0x45afb0[_0x3517('0x35')][_0x3517('0x22')]);}_0x19f859[_0x3517('0x3d')]=qs[_0x3517('0x3e')](_0x45afb0['query'][_0x3517('0x3e')]);_0x19f859['where']=qs[_0x3517('0x36')](_[_0x3517('0x40')](_0x45afb0[_0x3517('0x35')],_0x4d66b0['filters']));_0x19f859[_0x3517('0x3f')][_0x3517('0x5b')]=_0x41736b['id'];if(_0x45afb0[_0x3517('0x35')][_0x3517('0x41')]){_0x19f859[_0x3517('0x3f')]=_[_0x3517('0x42')](_0x19f859[_0x3517('0x3f')],{'$or':_[_0x3517('0x30')](_0x19f859[_0x3517('0x39')],function(_0x392023){var _0x7f8e6e={};_0x7f8e6e[_0x392023]={'$like':'%'+_0x45afb0[_0x3517('0x35')]['filter']+'%'};return _0x7f8e6e;})});}_0x19f859=_[_0x3517('0x42')]({},_0x19f859,_0x45afb0['options']);return db[_0x3517('0x5a')][_0x3517('0x47')](_0x19f859);}})[_0x3517('0x2a')](function(_0x3134ce){if(_0x3134ce){return db[_0x3517('0x5c')]['findAndCountAll']({'where':{'id':_[_0x3517('0x30')](_0x3134ce,_0x3517('0x5d')),'role':'agent'},'attributes':['id','name',_0x3517('0x5e'),_0x3517('0x5f'),'createdAt']});}})[_0x3517('0x2a')](function(_0x4c44a7){if(_0x4c44a7){return{'count':_0x4c44a7[_0x3517('0x21')],'rows':_[_0x3517('0x30')](_0x4c44a7[_0x3517('0x48')],function(_0x3d95ea){return{'membername':_0x3d95ea[_0x3517('0x2d')],'UserId':_0x3d95ea['id'],'queue_name':_0x1d0245[_0x3517('0x2d')],'FaxQueueId':_0x1d0245['id'],'interface':util[_0x3517('0x60')](_0x3517('0x61'),_0x3517('0x62'),_0x3d95ea[_0x3517('0x2d')]),'penalty':0x0,'paused':_0x3d95ea[_0x3517('0x5e')],'createdAt':_0x3d95ea['createdAt'],'updatedAt':_0x3d95ea[_0x3517('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x56ed48,_0x19f859))[_0x3517('0x49')](handleError(_0x56ed48,null));};exports[_0x3517('0x63')]=function(_0x24ef4b,_0x3c6fd5,_0x5b1ef7){var _0x132d0a={};var _0x271362={};var _0x57872f;var _0x23a8ec;return db[_0x3517('0x45')]['findOne']({'where':{'id':_0x24ef4b[_0x3517('0x4b')]['id']}})[_0x3517('0x2a')](handleEntityNotFound(_0x3c6fd5,null))['then'](function(_0x873613){if(_0x873613){_0x57872f=_0x873613;_0x271362['model']=_[_0x3517('0x4c')](db['Team'][_0x3517('0x31')]);_0x271362[_0x3517('0x35')]=_[_0x3517('0x4c')](_0x24ef4b[_0x3517('0x35')]);_0x271362[_0x3517('0x36')]=_[_0x3517('0x37')](_0x271362[_0x3517('0x34')],_0x271362[_0x3517('0x35')]);_0x132d0a[_0x3517('0x39')]=_[_0x3517('0x37')](_0x271362[_0x3517('0x34')],qs[_0x3517('0x38')](_0x24ef4b[_0x3517('0x35')]['fields']));_0x132d0a['attributes']=_0x132d0a[_0x3517('0x39')][_0x3517('0x3a')]?_0x132d0a['attributes']:_0x271362[_0x3517('0x34')];_0x132d0a['order']=qs['sort'](_0x24ef4b['query'][_0x3517('0x3e')]);_0x132d0a['where']=qs['filters'](_[_0x3517('0x40')](_0x24ef4b['query'],_0x271362[_0x3517('0x36')]));if(_0x24ef4b['query']['filter']){_0x132d0a[_0x3517('0x3f')]=_[_0x3517('0x42')](_0x132d0a[_0x3517('0x3f')],{'$or':_[_0x3517('0x30')](_0x132d0a['attributes'],function(_0x5638f9){var _0x251c1e={};_0x251c1e[_0x5638f9]={'$like':'%'+_0x24ef4b[_0x3517('0x35')][_0x3517('0x41')]+'%'};return _0x251c1e;})});}_0x132d0a=_['merge']({},_0x132d0a,_0x24ef4b[_0x3517('0x4e')]);return _0x57872f[_0x3517('0x63')](_0x132d0a);}})['then'](function(_0x3aede6){if(_0x3aede6){_0x23a8ec=_0x3aede6[_0x3517('0x3a')];if(!_0x24ef4b[_0x3517('0x35')][_0x3517('0x3b')](_0x3517('0x3c'))){_0x132d0a[_0x3517('0x23')]=qs[_0x3517('0x23')](_0x24ef4b[_0x3517('0x35')][_0x3517('0x23')]);_0x132d0a[_0x3517('0x22')]=qs[_0x3517('0x22')](_0x24ef4b[_0x3517('0x35')][_0x3517('0x22')]);}return _0x57872f['getTeams'](_0x132d0a);}})['then'](function(_0x37b756){if(_0x37b756){return _0x37b756?{'count':_0x23a8ec,'rows':_0x37b756}:null;}})['then'](respondWithResult(_0x3c6fd5,null))[_0x3517('0x49')](handleError(_0x3c6fd5,null));};exports[_0x3517('0x64')]=function(_0x88eab,_0x29017b,_0xc56f8c){var _0x18a6d4=_0x88eab[_0x3517('0x51')][_0x3517('0x65')];return db['Team']['findAll']({'where':{'id':_0x18a6d4},'attributes':['id'],'include':[{'model':db[_0x3517('0x5c')],'as':_0x3517('0x66'),'attributes':['id',_0x3517('0x2d'),_0x3517('0x67'),_0x3517('0x68'),_0x3517('0x69')],'raw':!![]}]})[_0x3517('0x2a')](function(_0xe533fc){if(_0xe533fc){var _0x2a1d85=_[_0x3517('0x6a')](_0xe533fc,function(_0x19de20){var _0x24de97=_0x19de20[_0x3517('0x53')]({'plain':!![]});return _0x24de97['Agents'];});return db[_0x3517('0x45')][_0x3517('0x4f')]({'where':{'id':_0x88eab[_0x3517('0x4b')]['id']}})['then'](function(_0xae873f){return db['sequelize'][_0x3517('0x6b')](function(_0x156d02){return _0xae873f[_0x3517('0x64')](_0x18a6d4,{'transaction':_0x156d02})[_0x3517('0x2a')](function(){return BPromise[_0x3517('0x6c')](_0x2a1d85,function(_0x2b04f4){return db[_0x3517('0x5a')]['findOrCreate']({'where':{'UserId':_0x2b04f4['id'],'FaxQueueId':_0x88eab[_0x3517('0x4b')]['id']},'transaction':_0x156d02});});})['then'](function(){_0x2a1d85['forEach'](function(_0x28bde3){socket[_0x3517('0x6d')]('userFaxQueue:save',{'UserId':_0x28bde3['id'],'FaxQueueId':_0xae873f['id']});});});});});}})['then'](respondWithStatusCode(_0x29017b,null))[_0x3517('0x49')](handleError(_0x29017b,null));};exports[_0x3517('0x6e')]=function(_0x2ed05c,_0x3c4d42,_0x9e894e){return db[_0x3517('0x6f')][_0x3517('0x47')]({'where':{'id':_0x2ed05c[_0x3517('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3517('0x5c')],'as':_0x3517('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3c4d42,null))[_0x3517('0x2a')](function(_0x23770f){var _0x2aac4c=_[_0x3517('0x30')](_0x23770f,'id');var _0x2d6d37=[];var _0x2bc8d2=[];var _0xc71975=squel[_0x3517('0x70')]();_0xc71975['field'](_0x3517('0x71'))[_0x3517('0x72')](_0x3517('0x73'),'tq')['join'](_0x3517('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3517('0x3f')]('FaxQueueId\x20=\x20?',_0x2ed05c[_0x3517('0x4b')]['id']);for(var _0x51ca7f=0x0;_0x51ca7f<_0x23770f[_0x3517('0x3a')];_0x51ca7f+=0x1){let _0x596f92=_0x23770f[_0x51ca7f];for(var _0x3d8dbc=0x0;_0x3d8dbc<_0x596f92[_0x3517('0x66')][_0x3517('0x3a')];_0x3d8dbc+=0x1){let _0x2a18ed=_0x596f92[_0x3517('0x66')][_0x3d8dbc];var _0xd08657=_0xc71975[_0x3517('0x75')]();_0xd08657['where'](_0x3517('0x76'),_0x2a18ed['id']);_0x2bc8d2[_0x3517('0x77')](db['sequelize'][_0x3517('0x35')](_0xd08657[_0x3517('0x78')](),{'type':db[_0x3517('0x79')][_0x3517('0x7a')][_0x3517('0x7b')]})['then'](function(_0x49f112){if(_0x49f112['length']===0x1){return _0x2a18ed['id'];}else{var _0x4f0efa=_[_0x3517('0x7c')](_[_0x3517('0x30')](_0x49f112,'TeamId'),function(_0x54650a){return _['includes'](_0x2aac4c,_0x54650a);});if(_0x4f0efa){return _0x2a18ed['id'];}}}));}}return BPromise[_0x3517('0x7d')](_0x2bc8d2)[_0x3517('0x2a')](function(_0x47843f){_0x2d6d37=_(_0x2d6d37)['union'](_0x47843f)[_0x3517('0x7e')]()['value']();return db[_0x3517('0x45')]['find']({'where':{'id':_0x2ed05c[_0x3517('0x4b')]['id']}})[_0x3517('0x2a')](function(_0x50a69a){return db[_0x3517('0x79')][_0x3517('0x6b')](function(_0x2ce38e){return _0x50a69a[_0x3517('0x6e')](_0x2ed05c[_0x3517('0x35')]['ids'],{'transaction':_0x2ce38e})['then'](function(){if(!_['isEmpty'](_0x2d6d37)){return _0x50a69a[_0x3517('0x7f')](_0x2d6d37,{'transaction':_0x2ce38e});}})['then'](function(){_0x2d6d37[_0x3517('0x80')](function(_0x2fe60b){socket[_0x3517('0x6d')](_0x3517('0x81'),{'UserId':_0x2fe60b,'FaxQueueId':_0x50a69a['id']});});});});});});})[_0x3517('0x2a')](respondWithStatusCode(_0x3c4d42,null))['catch'](handleError(_0x3c4d42,null));};exports[_0x3517('0x82')]=function(_0x1b1cb0,_0x41bf47,_0x15c7d6){return db[_0x3517('0x45')][_0x3517('0x4f')]({'where':{'id':_0x1b1cb0[_0x3517('0x4b')]['id']}})[_0x3517('0x2a')](handleEntityNotFound(_0x41bf47,null))[_0x3517('0x2a')](function(_0x2acc65){if(_0x2acc65){return _0x2acc65['addAgents'](_0x1b1cb0['body'][_0x3517('0x65')],_['omit'](_0x1b1cb0['body'],[_0x3517('0x65'),'id'])||{})[_0x3517('0x83')](function(_0x8e5f8f){for(var _0xf532f7=0x0;_0xf532f7<_0x1b1cb0['body'][_0x3517('0x65')][_0x3517('0x3a')];_0xf532f7+=0x1){socket[_0x3517('0x6d')](_0x3517('0x84'),{'UserId':Number(_0x1b1cb0['body']['ids'][_0xf532f7]),'FaxQueueId':Number(_0x1b1cb0[_0x3517('0x4b')]['id'])});}return _0x8e5f8f;});}})[_0x3517('0x2a')](respondWithResult(_0x41bf47,null))[_0x3517('0x49')](handleError(_0x41bf47,null));};exports['removeAgents']=function(_0x368656,_0x5a5407,_0x4db1e2){return db[_0x3517('0x45')]['find']({'where':{'id':_0x368656[_0x3517('0x4b')]['id']}})[_0x3517('0x2a')](handleEntityNotFound(_0x5a5407,null))[_0x3517('0x2a')](function(_0x45c30c){if(_0x45c30c){return _0x45c30c[_0x3517('0x7f')](_0x368656[_0x3517('0x35')]['ids'])[_0x3517('0x2a')](function(){if(_[_0x3517('0x85')](_0x368656[_0x3517('0x35')]['ids'])){for(var _0x25d907=0x0;_0x25d907<_0x368656[_0x3517('0x35')][_0x3517('0x65')][_0x3517('0x3a')];_0x25d907+=0x1){socket[_0x3517('0x6d')](_0x3517('0x81'),{'UserId':Number(_0x368656['query'][_0x3517('0x65')][_0x25d907]),'FaxQueueId':Number(_0x368656[_0x3517('0x4b')]['id'])});}}else{socket['emit'](_0x3517('0x81'),{'UserId':Number(_0x368656[_0x3517('0x35')][_0x3517('0x65')]),'FaxQueueId':Number(_0x368656['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5a5407,null))[_0x3517('0x49')](handleError(_0x5a5407,null));};exports[_0x3517('0x86')]=function(_0x49d81e,_0x5e6d7,_0xf4ea89){var _0x4ba61b={};var _0x36cb39={};var _0x97ba22;var _0x54ce77;return db['FaxQueue'][_0x3517('0x59')]({'where':{'id':_0x49d81e['params']['id']}})[_0x3517('0x2a')](handleEntityNotFound(_0x5e6d7,null))[_0x3517('0x2a')](function(_0x2f1dd2){if(_0x2f1dd2){_0x97ba22=_0x2f1dd2;_0x36cb39[_0x3517('0x34')]=_[_0x3517('0x4c')](db[_0x3517('0x5c')][_0x3517('0x31')]);_0x36cb39[_0x3517('0x35')]=_[_0x3517('0x4c')](_0x49d81e['query']);_0x36cb39['filters']=_[_0x3517('0x37')](_0x36cb39['model'],_0x36cb39[_0x3517('0x35')]);_0x4ba61b[_0x3517('0x39')]=_[_0x3517('0x37')](_0x36cb39[_0x3517('0x34')],qs[_0x3517('0x38')](_0x49d81e['query'][_0x3517('0x38')]));_0x4ba61b[_0x3517('0x39')]=_0x4ba61b[_0x3517('0x39')][_0x3517('0x3a')]?_0x4ba61b[_0x3517('0x39')]:_0x36cb39[_0x3517('0x34')];_0x4ba61b[_0x3517('0x3d')]=qs[_0x3517('0x3e')](_0x49d81e[_0x3517('0x35')]['sort']);_0x4ba61b[_0x3517('0x3f')]=qs['filters'](_[_0x3517('0x40')](_0x49d81e['query'],_0x36cb39[_0x3517('0x36')]));if(_0x49d81e['query'][_0x3517('0x41')]){_0x4ba61b[_0x3517('0x3f')]=_[_0x3517('0x42')](_0x4ba61b['where'],{'$or':_[_0x3517('0x30')](_0x4ba61b[_0x3517('0x39')],function(_0x764587){var _0x3fc533={};_0x3fc533[_0x764587]={'$like':'%'+_0x49d81e[_0x3517('0x35')]['filter']+'%'};return _0x3fc533;})});}_0x4ba61b=_[_0x3517('0x42')]({},_0x4ba61b,_0x49d81e['options']);return _0x97ba22[_0x3517('0x86')](_0x4ba61b);}})[_0x3517('0x2a')](function(_0x2938e5){if(_0x2938e5){_0x54ce77=_0x2938e5[_0x3517('0x3a')];if(!_0x49d81e[_0x3517('0x35')][_0x3517('0x3b')]('nolimit')){_0x4ba61b[_0x3517('0x23')]=qs['limit'](_0x49d81e['query'][_0x3517('0x23')]);_0x4ba61b[_0x3517('0x22')]=qs[_0x3517('0x22')](_0x49d81e[_0x3517('0x35')][_0x3517('0x22')]);}return _0x97ba22[_0x3517('0x86')](_0x4ba61b);}})[_0x3517('0x2a')](function(_0x49df7b){if(_0x49df7b){return _0x49df7b?{'count':_0x54ce77,'rows':_0x49df7b}:null;}})[_0x3517('0x2a')](respondWithResult(_0x5e6d7,null))[_0x3517('0x49')](handleError(_0x5e6d7,null));}; \ No newline at end of file +var _0xa200=['set','reject','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','FaxQueue','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','pick','FaxQueueId','UserFaxQueue','User','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','nolimit','ids','Team','online','voicePause','interface','flatMap','Agents','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','QueryTypes','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x373e27,_0x527f8d){var _0x4a336f=function(_0x2cf6c0){while(--_0x2cf6c0){_0x373e27['push'](_0x373e27['shift']());}};_0x4a336f(++_0x527f8d);}(_0xa200,0x16a));var _0x0a20=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa200[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x0a20('0x0'));var rimraf=require(_0x0a20('0x1'));var zipdir=require(_0x0a20('0x2'));var jsonpatch=require(_0x0a20('0x3'));var rp=require('request-promise');var moment=require(_0x0a20('0x4'));var BPromise=require(_0x0a20('0x5'));var Mustache=require(_0x0a20('0x6'));var util=require(_0x0a20('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0a20('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a20('0x9'));var squel=require(_0x0a20('0xa'));var crypto=require('crypto');var jsforce=require(_0x0a20('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0a20('0x8'));var querystring=require(_0x0a20('0xc'));var Papa=require(_0x0a20('0xd'));var Redis=require(_0x0a20('0xe'));var authService=require(_0x0a20('0xf'));var qs=require(_0x0a20('0x10'));var as=require(_0x0a20('0x11'));var hardwareService=require(_0x0a20('0x12'));var logger=require('../../config/logger')(_0x0a20('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a20('0x14'));var db=require('../../mysqldb')['db'];config[_0x0a20('0x15')]=_['defaults'](config[_0x0a20('0x15')],{'host':_0x0a20('0x16'),'port':0x18eb});var socket=require(_0x0a20('0x17'))(new Redis(config[_0x0a20('0x15')]));require(_0x0a20('0x18'))[_0x0a20('0x19')](socket);function respondWithStatusCode(_0x4dadf4,_0x511e12){_0x511e12=_0x511e12||0xcc;return function(_0x2efb22){if(_0x2efb22){return _0x4dadf4[_0x0a20('0x1a')](_0x511e12);}return _0x4dadf4[_0x0a20('0x1b')](_0x511e12)[_0x0a20('0x1c')]();};}function respondWithResult(_0x2a0468,_0x35c8ae){_0x35c8ae=_0x35c8ae||0xc8;return function(_0x224236){if(_0x224236){return _0x2a0468[_0x0a20('0x1b')](_0x35c8ae)[_0x0a20('0x1d')](_0x224236);}};}function respondWithFilteredResult(_0x594fbe,_0x429e76){return function(_0x2a6b4f){if(_0x2a6b4f){var _0x5477d9=typeof _0x429e76[_0x0a20('0x1e')]===_0x0a20('0x1f')&&typeof _0x429e76[_0x0a20('0x20')]===_0x0a20('0x1f');var _0x493f59=_0x2a6b4f[_0x0a20('0x21')];var _0x2f721d=_0x5477d9?0x0:_0x429e76['offset'];var _0x9efd25=_0x5477d9?_0x2a6b4f['count']:_0x429e76[_0x0a20('0x1e')]+_0x429e76[_0x0a20('0x20')];var _0x2b8007;if(_0x9efd25>=_0x493f59){_0x9efd25=_0x493f59;_0x2b8007=0xc8;}else{_0x2b8007=0xce;}_0x594fbe[_0x0a20('0x1b')](_0x2b8007);return _0x594fbe[_0x0a20('0x22')]('Content-Range',_0x2f721d+'-'+_0x9efd25+'/'+_0x493f59)[_0x0a20('0x1d')](_0x2a6b4f);}return null;};}function patchUpdates(_0xae1051){return function(_0x312a68){try{jsonpatch['apply'](_0x312a68,_0xae1051,!![]);}catch(_0x52bdd1){return BPromise[_0x0a20('0x23')](_0x52bdd1);}return _0x312a68['save']();};}function saveUpdates(_0xdd6319,_0x3170d5){return function(_0xf0ad1b){if(_0xf0ad1b){return _0xf0ad1b[_0x0a20('0x24')](_0xdd6319)['then'](function(_0xe85c0c){return _0xe85c0c;});}return null;};}function removeEntity(_0x49b9e7,_0x2cc8f8){return function(_0x2a3d73){if(_0x2a3d73){return _0x2a3d73['destroy']()[_0x0a20('0x25')](function(){var _0x176534=_0x2a3d73[_0x0a20('0x26')]({'plain':!![]});var _0x517f11='FaxQueues';return db[_0x0a20('0x27')][_0x0a20('0x28')]({'where':{'type':_0x517f11,'resourceId':_0x176534['id']}})[_0x0a20('0x25')](function(){return _0x2a3d73;});})['then'](function(){_0x49b9e7[_0x0a20('0x1b')](0xcc)[_0x0a20('0x1c')]();});}};}function handleEntityNotFound(_0x355f20,_0x240472){return function(_0x4bfa3f){if(!_0x4bfa3f){_0x355f20[_0x0a20('0x1a')](0x194);}return _0x4bfa3f;};}function handleError(_0x46f472,_0x28166c){_0x28166c=_0x28166c||0x1f4;return function(_0x36dfd6){logger[_0x0a20('0x29')](_0x36dfd6[_0x0a20('0x2a')]);if(_0x36dfd6[_0x0a20('0x2b')]){delete _0x36dfd6[_0x0a20('0x2b')];}_0x46f472[_0x0a20('0x1b')](_0x28166c)[_0x0a20('0x2c')](_0x36dfd6);};}exports[_0x0a20('0x2d')]=function(_0xc965c3,_0x34dca0){var _0x365c5a={},_0x3b012b={},_0x3d6c1e={'count':0x0,'rows':[]};var _0xddf4d8=_['map'](db[_0x0a20('0x2e')][_0x0a20('0x2f')],function(_0x1672e3){return{'name':_0x1672e3['fieldName'],'type':_0x1672e3[_0x0a20('0x30')][_0x0a20('0x31')]};});_0x3b012b[_0x0a20('0x32')]=_[_0x0a20('0x33')](_0xddf4d8,_0x0a20('0x2b'));_0x3b012b[_0x0a20('0x34')]=_[_0x0a20('0x35')](_0xc965c3['query']);_0x3b012b[_0x0a20('0x36')]=_['intersection'](_0x3b012b[_0x0a20('0x32')],_0x3b012b['query']);_0x365c5a[_0x0a20('0x37')]=_[_0x0a20('0x38')](_0x3b012b[_0x0a20('0x32')],qs[_0x0a20('0x39')](_0xc965c3[_0x0a20('0x34')][_0x0a20('0x39')]));_0x365c5a[_0x0a20('0x37')]=_0x365c5a[_0x0a20('0x37')]['length']?_0x365c5a[_0x0a20('0x37')]:_0x3b012b['model'];if(!_0xc965c3[_0x0a20('0x34')][_0x0a20('0x3a')]('nolimit')){_0x365c5a[_0x0a20('0x20')]=qs[_0x0a20('0x20')](_0xc965c3[_0x0a20('0x34')][_0x0a20('0x20')]);_0x365c5a[_0x0a20('0x1e')]=qs[_0x0a20('0x1e')](_0xc965c3[_0x0a20('0x34')][_0x0a20('0x1e')]);}_0x365c5a[_0x0a20('0x3b')]=qs[_0x0a20('0x3c')](_0xc965c3[_0x0a20('0x34')]['sort']);_0x365c5a[_0x0a20('0x3d')]=qs[_0x0a20('0x36')](_['pick'](_0xc965c3[_0x0a20('0x34')],_0x3b012b[_0x0a20('0x36')]),_0xddf4d8);if(_0xc965c3[_0x0a20('0x34')][_0x0a20('0x3e')]){_0x365c5a[_0x0a20('0x3d')]=_['merge'](_0x365c5a[_0x0a20('0x3d')],{'$or':_[_0x0a20('0x33')](_0xddf4d8,function(_0x43c16){if(_0x43c16[_0x0a20('0x30')]!==_0x0a20('0x3f')){var _0x48800c={};_0x48800c[_0x43c16['name']]={'$like':'%'+_0xc965c3[_0x0a20('0x34')][_0x0a20('0x3e')]+'%'};return _0x48800c;}})});}_0x365c5a=_['merge']({},_0x365c5a,_0xc965c3[_0x0a20('0x40')]);var _0x328db9={'where':_0x365c5a[_0x0a20('0x3d')]};return db[_0x0a20('0x2e')][_0x0a20('0x21')](_0x328db9)[_0x0a20('0x25')](function(_0x4c3ec3){_0x3d6c1e[_0x0a20('0x21')]=_0x4c3ec3;if(_0xc965c3[_0x0a20('0x34')][_0x0a20('0x41')]){_0x365c5a[_0x0a20('0x42')]=[{'all':!![]}];}return db[_0x0a20('0x2e')][_0x0a20('0x43')](_0x365c5a);})[_0x0a20('0x25')](function(_0x2e77cf){_0x3d6c1e[_0x0a20('0x44')]=_0x2e77cf;return _0x3d6c1e;})[_0x0a20('0x25')](respondWithFilteredResult(_0x34dca0,_0x365c5a))[_0x0a20('0x45')](handleError(_0x34dca0,null));};exports['show']=function(_0x5da979,_0xde72d1){var _0x286cf3={'raw':!![],'where':{'id':_0x5da979[_0x0a20('0x46')]['id']}},_0x444973={};_0x444973[_0x0a20('0x32')]=_[_0x0a20('0x35')](db['FaxQueue']['rawAttributes']);_0x444973[_0x0a20('0x34')]=_['keys'](_0x5da979['query']);_0x444973['filters']=_['intersection'](_0x444973['model'],_0x444973[_0x0a20('0x34')]);_0x286cf3[_0x0a20('0x37')]=_[_0x0a20('0x38')](_0x444973[_0x0a20('0x32')],qs['fields'](_0x5da979[_0x0a20('0x34')][_0x0a20('0x39')]));_0x286cf3['attributes']=_0x286cf3['attributes'][_0x0a20('0x47')]?_0x286cf3[_0x0a20('0x37')]:_0x444973[_0x0a20('0x32')];if(_0x5da979['query']['includeAll']){_0x286cf3[_0x0a20('0x42')]=[{'all':!![]}];}_0x286cf3=_[_0x0a20('0x48')]({},_0x286cf3,_0x5da979['options']);return db[_0x0a20('0x2e')][_0x0a20('0x49')](_0x286cf3)[_0x0a20('0x25')](handleEntityNotFound(_0xde72d1,null))[_0x0a20('0x25')](respondWithResult(_0xde72d1,null))[_0x0a20('0x45')](handleError(_0xde72d1,null));};exports[_0x0a20('0x4a')]=function(_0x3857e3,_0x3a79b0){return db[_0x0a20('0x2e')]['create'](_0x3857e3[_0x0a20('0x4b')],{})[_0x0a20('0x25')](function(_0x524a6b){var _0x3205d3=_0x3857e3[_0x0a20('0x4c')][_0x0a20('0x26')]({'plain':!![]});if(!_0x3205d3)throw new Error(_0x0a20('0x4d'));if(_0x3205d3[_0x0a20('0x4e')]===_0x0a20('0x4c')){var _0x43c82b=_0x524a6b[_0x0a20('0x26')]({'plain':!![]});var _0x44a5bc=_0x0a20('0x4f');return db['UserProfileSection'][_0x0a20('0x49')]({'where':{'name':_0x44a5bc,'userProfileId':_0x3205d3[_0x0a20('0x50')]},'raw':!![]})[_0x0a20('0x25')](function(_0x50b48f){if(_0x50b48f&&_0x50b48f[_0x0a20('0x51')]===0x0){return db[_0x0a20('0x27')][_0x0a20('0x4a')]({'name':_0x43c82b[_0x0a20('0x2b')],'resourceId':_0x43c82b['id'],'type':_0x50b48f[_0x0a20('0x2b')],'sectionId':_0x50b48f['id']},{})[_0x0a20('0x25')](function(){return _0x524a6b;});}else{return _0x524a6b;}})[_0x0a20('0x45')](function(_0x4248c8){logger[_0x0a20('0x29')](_0x0a20('0x52'),_0x4248c8);throw _0x4248c8;});}return _0x524a6b;})[_0x0a20('0x25')](respondWithResult(_0x3a79b0,0xc9))['catch'](handleError(_0x3a79b0,null));};exports['update']=function(_0xf55eb0,_0x248650){if(_0xf55eb0['body']['id']){delete _0xf55eb0['body']['id'];}return db[_0x0a20('0x2e')][_0x0a20('0x49')]({'where':{'id':_0xf55eb0[_0x0a20('0x46')]['id']}})['then'](handleEntityNotFound(_0x248650,null))[_0x0a20('0x25')](saveUpdates(_0xf55eb0[_0x0a20('0x4b')],null))['then'](respondWithResult(_0x248650,null))[_0x0a20('0x45')](handleError(_0x248650,null));};exports[_0x0a20('0x28')]=function(_0x4709da,_0x279b0b){return db[_0x0a20('0x2e')][_0x0a20('0x49')]({'where':{'id':_0x4709da[_0x0a20('0x46')]['id']}})[_0x0a20('0x25')](handleEntityNotFound(_0x279b0b,null))[_0x0a20('0x25')](removeEntity(_0x279b0b,null))[_0x0a20('0x45')](handleError(_0x279b0b,null));};exports[_0x0a20('0x53')]=function(_0x5b8504,_0x4fe077){return db['FaxQueue'][_0x0a20('0x53')]()[_0x0a20('0x25')](respondWithResult(_0x4fe077,null))['catch'](handleError(_0x4fe077,null));};exports[_0x0a20('0x54')]=function(_0x221a8a,_0x4f7934,_0x33e150){var _0x2d05b7={'raw':!![],'where':{}},_0x4a7089={},_0x32f374;return db[_0x0a20('0x2e')][_0x0a20('0x55')]({'where':{'id':_0x221a8a['params']['id']}})[_0x0a20('0x25')](handleEntityNotFound(_0x4f7934,null))[_0x0a20('0x25')](function(_0x3c0d13){if(_0x3c0d13){_0x32f374=_0x3c0d13[_0x0a20('0x26')]({'plain':!![]});_0x4a7089[_0x0a20('0x32')]=_['keys'](db['UserFaxQueue'][_0x0a20('0x2f')]);_0x4a7089[_0x0a20('0x34')]=_['keys'](_0x221a8a[_0x0a20('0x34')]);_0x4a7089['filters']=_[_0x0a20('0x38')](_0x4a7089[_0x0a20('0x32')],_0x4a7089[_0x0a20('0x34')]);_0x2d05b7[_0x0a20('0x37')]=_[_0x0a20('0x38')](_0x4a7089[_0x0a20('0x32')],qs['fields'](_0x221a8a['query'][_0x0a20('0x39')]));_0x2d05b7[_0x0a20('0x37')]=_0x2d05b7[_0x0a20('0x37')][_0x0a20('0x47')]?_0x2d05b7[_0x0a20('0x37')]:_0x4a7089[_0x0a20('0x32')];if(!_0x221a8a['query'][_0x0a20('0x3a')]('nolimit')){_0x2d05b7[_0x0a20('0x20')]=qs[_0x0a20('0x20')](_0x221a8a[_0x0a20('0x34')][_0x0a20('0x20')]);_0x2d05b7[_0x0a20('0x1e')]=qs['offset'](_0x221a8a['query'][_0x0a20('0x1e')]);}_0x2d05b7[_0x0a20('0x3b')]=qs['sort'](_0x221a8a[_0x0a20('0x34')][_0x0a20('0x3c')]);_0x2d05b7[_0x0a20('0x3d')]=qs[_0x0a20('0x36')](_[_0x0a20('0x56')](_0x221a8a['query'],_0x4a7089['filters']));_0x2d05b7[_0x0a20('0x3d')][_0x0a20('0x57')]=_0x3c0d13['id'];if(_0x221a8a[_0x0a20('0x34')][_0x0a20('0x3e')]){_0x2d05b7[_0x0a20('0x3d')]=_['merge'](_0x2d05b7[_0x0a20('0x3d')],{'$or':_[_0x0a20('0x33')](_0x2d05b7[_0x0a20('0x37')],function(_0x467ee5){var _0x13bdf4={};_0x13bdf4[_0x467ee5]={'$like':'%'+_0x221a8a[_0x0a20('0x34')][_0x0a20('0x3e')]+'%'};return _0x13bdf4;})});}_0x2d05b7=_['merge']({},_0x2d05b7,_0x221a8a[_0x0a20('0x40')]);return db[_0x0a20('0x58')][_0x0a20('0x43')](_0x2d05b7);}})[_0x0a20('0x25')](function(_0x338f6e){if(_0x338f6e){return db[_0x0a20('0x59')]['findAndCountAll']({'where':{'id':_[_0x0a20('0x33')](_0x338f6e,'UserId'),'role':_0x0a20('0x5a')},'attributes':['id',_0x0a20('0x2b'),_0x0a20('0x5b'),_0x0a20('0x5c'),_0x0a20('0x5d')]});}})[_0x0a20('0x25')](function(_0x425739){if(_0x425739){return{'count':_0x425739[_0x0a20('0x21')],'rows':_[_0x0a20('0x33')](_0x425739[_0x0a20('0x44')],function(_0x5655f4){return{'membername':_0x5655f4[_0x0a20('0x2b')],'UserId':_0x5655f4['id'],'queue_name':_0x32f374[_0x0a20('0x2b')],'FaxQueueId':_0x32f374['id'],'interface':util['format'](_0x0a20('0x5e'),_0x0a20('0x5f'),_0x5655f4[_0x0a20('0x2b')]),'penalty':0x0,'paused':_0x5655f4[_0x0a20('0x5b')],'createdAt':_0x5655f4['createdAt'],'updatedAt':_0x5655f4[_0x0a20('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0a20('0x25')](respondWithFilteredResult(_0x4f7934,_0x2d05b7))['catch'](handleError(_0x4f7934,null));};exports[_0x0a20('0x60')]=function(_0x32a696,_0x2ca82e,_0x2f202b){var _0x3edc7c={};var _0x496fe3={};var _0x29af08;var _0x126e53;return db[_0x0a20('0x2e')]['findOne']({'where':{'id':_0x32a696[_0x0a20('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ca82e,null))[_0x0a20('0x25')](function(_0x1ae589){if(_0x1ae589){_0x29af08=_0x1ae589;_0x496fe3[_0x0a20('0x32')]=_[_0x0a20('0x35')](db['Team'][_0x0a20('0x2f')]);_0x496fe3[_0x0a20('0x34')]=_[_0x0a20('0x35')](_0x32a696[_0x0a20('0x34')]);_0x496fe3[_0x0a20('0x36')]=_[_0x0a20('0x38')](_0x496fe3[_0x0a20('0x32')],_0x496fe3[_0x0a20('0x34')]);_0x3edc7c[_0x0a20('0x37')]=_[_0x0a20('0x38')](_0x496fe3[_0x0a20('0x32')],qs[_0x0a20('0x39')](_0x32a696[_0x0a20('0x34')][_0x0a20('0x39')]));_0x3edc7c['attributes']=_0x3edc7c[_0x0a20('0x37')][_0x0a20('0x47')]?_0x3edc7c[_0x0a20('0x37')]:_0x496fe3[_0x0a20('0x32')];_0x3edc7c['order']=qs[_0x0a20('0x3c')](_0x32a696['query'][_0x0a20('0x3c')]);_0x3edc7c[_0x0a20('0x3d')]=qs[_0x0a20('0x36')](_['pick'](_0x32a696[_0x0a20('0x34')],_0x496fe3[_0x0a20('0x36')]));if(_0x32a696[_0x0a20('0x34')]['filter']){_0x3edc7c[_0x0a20('0x3d')]=_['merge'](_0x3edc7c[_0x0a20('0x3d')],{'$or':_[_0x0a20('0x33')](_0x3edc7c[_0x0a20('0x37')],function(_0x5ca3cf){var _0x17ce29={};_0x17ce29[_0x5ca3cf]={'$like':'%'+_0x32a696[_0x0a20('0x34')][_0x0a20('0x3e')]+'%'};return _0x17ce29;})});}_0x3edc7c=_[_0x0a20('0x48')]({},_0x3edc7c,_0x32a696[_0x0a20('0x40')]);return _0x29af08['getTeams'](_0x3edc7c);}})[_0x0a20('0x25')](function(_0x493688){if(_0x493688){_0x126e53=_0x493688['length'];if(!_0x32a696[_0x0a20('0x34')][_0x0a20('0x3a')](_0x0a20('0x61'))){_0x3edc7c['limit']=qs[_0x0a20('0x20')](_0x32a696[_0x0a20('0x34')][_0x0a20('0x20')]);_0x3edc7c[_0x0a20('0x1e')]=qs[_0x0a20('0x1e')](_0x32a696['query'][_0x0a20('0x1e')]);}return _0x29af08['getTeams'](_0x3edc7c);}})['then'](function(_0x106390){if(_0x106390){return _0x106390?{'count':_0x126e53,'rows':_0x106390}:null;}})[_0x0a20('0x25')](respondWithResult(_0x2ca82e,null))[_0x0a20('0x45')](handleError(_0x2ca82e,null));};exports['addTeams']=function(_0x2d772c,_0x4d8894,_0x32f741){var _0x3f3032=_0x2d772c[_0x0a20('0x4b')][_0x0a20('0x62')];return db[_0x0a20('0x63')][_0x0a20('0x43')]({'where':{'id':_0x3f3032},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x0a20('0x2b'),_0x0a20('0x64'),_0x0a20('0x65'),_0x0a20('0x66')],'raw':!![]}]})[_0x0a20('0x25')](function(_0x391dc8){if(_0x391dc8){var _0x255e54=_[_0x0a20('0x67')](_0x391dc8,function(_0x486874){var _0x54241f=_0x486874[_0x0a20('0x26')]({'plain':!![]});return _0x54241f[_0x0a20('0x68')];});return db[_0x0a20('0x2e')][_0x0a20('0x49')]({'where':{'id':_0x2d772c[_0x0a20('0x46')]['id']}})[_0x0a20('0x25')](function(_0x4e877c){return db[_0x0a20('0x69')][_0x0a20('0x6a')](function(_0x27f74c){return _0x4e877c[_0x0a20('0x6b')](_0x3f3032,{'transaction':_0x27f74c})[_0x0a20('0x25')](function(){return BPromise[_0x0a20('0x6c')](_0x255e54,function(_0x257fba){return db[_0x0a20('0x58')][_0x0a20('0x6d')]({'where':{'UserId':_0x257fba['id'],'FaxQueueId':_0x2d772c['params']['id']},'transaction':_0x27f74c});});})[_0x0a20('0x25')](function(){_0x255e54[_0x0a20('0x6e')](function(_0x2e7c51){socket[_0x0a20('0x6f')](_0x0a20('0x70'),{'UserId':_0x2e7c51['id'],'FaxQueueId':_0x4e877c['id']});});});});});}})['then'](respondWithStatusCode(_0x4d8894,null))[_0x0a20('0x45')](handleError(_0x4d8894,null));};exports[_0x0a20('0x71')]=function(_0x2073e7,_0xa9a91c,_0x333eb0){return db['Team'][_0x0a20('0x43')]({'where':{'id':_0x2073e7[_0x0a20('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0a20('0x59')],'as':_0x0a20('0x68'),'attributes':['id'],'raw':!![]}]})[_0x0a20('0x25')](handleEntityNotFound(_0xa9a91c,null))[_0x0a20('0x25')](function(_0x4910b7){var _0x3d6247=_['map'](_0x4910b7,'id');var _0x2ed90c=[];var _0x4d6cb0=[];var _0x38831c=squel[_0x0a20('0x72')]();_0x38831c['field'](_0x0a20('0x73'))['from']('team_has_fax_queues','tq')['join']('user_has_teams','ut',_0x0a20('0x74'))['where'](_0x0a20('0x75'),_0x2073e7[_0x0a20('0x46')]['id']);for(var _0xf17cfc=0x0;_0xf17cfc<_0x4910b7[_0x0a20('0x47')];_0xf17cfc+=0x1){let _0x2b4e0c=_0x4910b7[_0xf17cfc];for(var _0x47a043=0x0;_0x47a043<_0x2b4e0c[_0x0a20('0x68')]['length'];_0x47a043+=0x1){let _0x3afe21=_0x2b4e0c[_0x0a20('0x68')][_0x47a043];var _0x35aad5=_0x38831c[_0x0a20('0x76')]();_0x35aad5[_0x0a20('0x3d')]('ut.UserId\x20=\x20?',_0x3afe21['id']);_0x4d6cb0['push'](db['sequelize']['query'](_0x35aad5['toString'](),{'type':db['sequelize'][_0x0a20('0x77')]['SELECT']})[_0x0a20('0x25')](function(_0x47a63b){if(_0x47a63b[_0x0a20('0x47')]===0x1){return _0x3afe21['id'];}else{var _0x162b0d=_['every'](_[_0x0a20('0x33')](_0x47a63b,_0x0a20('0x78')),function(_0x467a93){return _[_0x0a20('0x79')](_0x3d6247,_0x467a93);});if(_0x162b0d){return _0x3afe21['id'];}}}));}}return BPromise[_0x0a20('0x7a')](_0x4d6cb0)['then'](function(_0x491d91){_0x2ed90c=_(_0x2ed90c)[_0x0a20('0x7b')](_0x491d91)[_0x0a20('0x7c')]()[_0x0a20('0x7d')]();return db['FaxQueue'][_0x0a20('0x49')]({'where':{'id':_0x2073e7['params']['id']}})[_0x0a20('0x25')](function(_0xf25ded){return db[_0x0a20('0x69')][_0x0a20('0x6a')](function(_0x1f2702){return _0xf25ded['removeTeams'](_0x2073e7[_0x0a20('0x34')][_0x0a20('0x62')],{'transaction':_0x1f2702})['then'](function(){if(!_[_0x0a20('0x7e')](_0x2ed90c)){return _0xf25ded[_0x0a20('0x7f')](_0x2ed90c,{'transaction':_0x1f2702});}})[_0x0a20('0x25')](function(){_0x2ed90c[_0x0a20('0x6e')](function(_0x3fb647){socket[_0x0a20('0x6f')](_0x0a20('0x80'),{'UserId':_0x3fb647,'FaxQueueId':_0xf25ded['id']});});});});});});})[_0x0a20('0x25')](respondWithStatusCode(_0xa9a91c,null))[_0x0a20('0x45')](handleError(_0xa9a91c,null));};exports[_0x0a20('0x81')]=function(_0x4f6c7f,_0x42cb73,_0x1ec9c1){return db[_0x0a20('0x2e')]['find']({'where':{'id':_0x4f6c7f[_0x0a20('0x46')]['id']}})[_0x0a20('0x25')](handleEntityNotFound(_0x42cb73,null))[_0x0a20('0x25')](function(_0x19b0c7){if(_0x19b0c7){return _0x19b0c7['addAgents'](_0x4f6c7f['body'][_0x0a20('0x62')],_[_0x0a20('0x82')](_0x4f6c7f[_0x0a20('0x4b')],[_0x0a20('0x62'),'id'])||{})['spread'](function(_0x5bc6df){for(var _0x13ac9f=0x0;_0x13ac9f<_0x4f6c7f[_0x0a20('0x4b')][_0x0a20('0x62')][_0x0a20('0x47')];_0x13ac9f+=0x1){socket[_0x0a20('0x6f')](_0x0a20('0x70'),{'UserId':Number(_0x4f6c7f['body']['ids'][_0x13ac9f]),'FaxQueueId':Number(_0x4f6c7f['params']['id'])});}return _0x5bc6df;});}})['then'](respondWithResult(_0x42cb73,null))[_0x0a20('0x45')](handleError(_0x42cb73,null));};exports['removeAgents']=function(_0x138c3,_0xf5ebcd,_0x28bd84){return db[_0x0a20('0x2e')][_0x0a20('0x49')]({'where':{'id':_0x138c3[_0x0a20('0x46')]['id']}})[_0x0a20('0x25')](handleEntityNotFound(_0xf5ebcd,null))[_0x0a20('0x25')](function(_0x2047d7){if(_0x2047d7){return _0x2047d7[_0x0a20('0x7f')](_0x138c3[_0x0a20('0x34')][_0x0a20('0x62')])[_0x0a20('0x25')](function(){if(_['isArray'](_0x138c3[_0x0a20('0x34')][_0x0a20('0x62')])){for(var _0x2878bc=0x0;_0x2878bc<_0x138c3[_0x0a20('0x34')][_0x0a20('0x62')][_0x0a20('0x47')];_0x2878bc+=0x1){socket[_0x0a20('0x6f')]('userFaxQueue:remove',{'UserId':Number(_0x138c3['query'][_0x0a20('0x62')][_0x2878bc]),'FaxQueueId':Number(_0x138c3[_0x0a20('0x46')]['id'])});}}else{socket[_0x0a20('0x6f')](_0x0a20('0x80'),{'UserId':Number(_0x138c3[_0x0a20('0x34')]['ids']),'FaxQueueId':Number(_0x138c3[_0x0a20('0x46')]['id'])});}});}})[_0x0a20('0x25')](respondWithStatusCode(_0xf5ebcd,null))[_0x0a20('0x45')](handleError(_0xf5ebcd,null));};exports[_0x0a20('0x83')]=function(_0x467c72,_0x4aa711,_0x3c0c47){var _0x5e593b={};var _0x5eb3f6={};var _0x19e68f;var _0x2903e9;return db[_0x0a20('0x2e')]['findOne']({'where':{'id':_0x467c72[_0x0a20('0x46')]['id']}})[_0x0a20('0x25')](handleEntityNotFound(_0x4aa711,null))[_0x0a20('0x25')](function(_0x4d0b14){if(_0x4d0b14){_0x19e68f=_0x4d0b14;_0x5eb3f6['model']=_[_0x0a20('0x35')](db[_0x0a20('0x59')][_0x0a20('0x2f')]);_0x5eb3f6[_0x0a20('0x34')]=_[_0x0a20('0x35')](_0x467c72['query']);_0x5eb3f6['filters']=_[_0x0a20('0x38')](_0x5eb3f6['model'],_0x5eb3f6[_0x0a20('0x34')]);_0x5e593b[_0x0a20('0x37')]=_['intersection'](_0x5eb3f6[_0x0a20('0x32')],qs[_0x0a20('0x39')](_0x467c72[_0x0a20('0x34')][_0x0a20('0x39')]));_0x5e593b['attributes']=_0x5e593b[_0x0a20('0x37')][_0x0a20('0x47')]?_0x5e593b[_0x0a20('0x37')]:_0x5eb3f6[_0x0a20('0x32')];_0x5e593b[_0x0a20('0x3b')]=qs[_0x0a20('0x3c')](_0x467c72[_0x0a20('0x34')][_0x0a20('0x3c')]);_0x5e593b['where']=qs[_0x0a20('0x36')](_[_0x0a20('0x56')](_0x467c72[_0x0a20('0x34')],_0x5eb3f6['filters']));if(_0x467c72[_0x0a20('0x34')][_0x0a20('0x3e')]){_0x5e593b[_0x0a20('0x3d')]=_['merge'](_0x5e593b['where'],{'$or':_[_0x0a20('0x33')](_0x5e593b['attributes'],function(_0x509171){var _0x483bbc={};_0x483bbc[_0x509171]={'$like':'%'+_0x467c72['query']['filter']+'%'};return _0x483bbc;})});}_0x5e593b=_[_0x0a20('0x48')]({},_0x5e593b,_0x467c72[_0x0a20('0x40')]);return _0x19e68f[_0x0a20('0x83')](_0x5e593b);}})[_0x0a20('0x25')](function(_0x1af681){if(_0x1af681){_0x2903e9=_0x1af681['length'];if(!_0x467c72[_0x0a20('0x34')][_0x0a20('0x3a')]('nolimit')){_0x5e593b[_0x0a20('0x20')]=qs[_0x0a20('0x20')](_0x467c72[_0x0a20('0x34')][_0x0a20('0x20')]);_0x5e593b[_0x0a20('0x1e')]=qs[_0x0a20('0x1e')](_0x467c72['query'][_0x0a20('0x1e')]);}return _0x19e68f[_0x0a20('0x83')](_0x5e593b);}})[_0x0a20('0x25')](function(_0x1a6496){if(_0x1a6496){return _0x1a6496?{'count':_0x2903e9,'rows':_0x1a6496}:null;}})[_0x0a20('0x25')](respondWithResult(_0x4aa711,null))[_0x0a20('0x45')](handleError(_0x4aa711,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 22d3b71..6b1ffa8 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 _0x6bb2=['events','../../mysqldb','FaxQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x2bb406,_0x8bbea7){var _0x49342b=function(_0x1a3663){while(--_0x1a3663){_0x2bb406['push'](_0x2bb406['shift']());}};_0x49342b(++_0x8bbea7);}(_0x6bb2,0x1e0));var _0x26bb=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x6bb2[_0x31cb5f];return _0x586042;};'use strict';var EventEmitter=require(_0x26bb('0x0'));var FaxQueue=require(_0x26bb('0x1'))['db'][_0x26bb('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x26bb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x26bb('0x4'),'afterDestroy':_0x26bb('0x5')};function emitEvent(_0x16588c){return function(_0x38835d,_0x3a4a38,_0xe71fbb){FaxQueueEvents[_0x26bb('0x6')](_0x16588c+':'+_0x38835d['id'],_0x38835d);FaxQueueEvents[_0x26bb('0x6')](_0x16588c,_0x38835d);_0xe71fbb(null);};}for(var e in events){if(events[_0x26bb('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x2ec1=['hasOwnProperty','hook','../../mysqldb','FaxQueue','setMaxListeners','save','emit'];(function(_0xceb38b,_0x5d6bdb){var _0x4ba6f2=function(_0x3ddf0a){while(--_0x3ddf0a){_0xceb38b['push'](_0xceb38b['shift']());}};_0x4ba6f2(++_0x5d6bdb);}(_0x2ec1,0x10c));var _0x12ec=function(_0x36a974,_0x381b74){_0x36a974=_0x36a974-0x0;var _0x2d0781=_0x2ec1[_0x36a974];return _0x2d0781;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x12ec('0x0'))['db'][_0x12ec('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x12ec('0x2')](0x0);var events={'afterCreate':_0x12ec('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x424574){return function(_0x4c7b86,_0x2b8d0e,_0x4e1fe8){FaxQueueEvents[_0x12ec('0x4')](_0x424574+':'+_0x4c7b86['id'],_0x4c7b86);FaxQueueEvents[_0x12ec('0x4')](_0x424574,_0x4c7b86);_0x4e1fe8(null);};}for(var e in events){if(events[_0x12ec('0x5')](e)){var event=events[e];FaxQueue[_0x12ec('0x6')](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 2c90a64..3a7a9aa 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 _0xe351=['../../config/environment','./faxQueue.attributes','exports','FaxQueue','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x481c8e,_0x222a9a){var _0x17476e=function(_0x2fd0af){while(--_0x2fd0af){_0x481c8e['push'](_0x481c8e['shift']());}};_0x17476e(++_0x222a9a);}(_0xe351,0x159));var _0x1e35=function(_0x55e883,_0x2cf8f9){_0x55e883=_0x55e883-0x0;var _0x3df9bd=_0xe351[_0x55e883];return _0x3df9bd;};'use strict';var _=require(_0x1e35('0x0'));var util=require(_0x1e35('0x1'));var logger=require(_0x1e35('0x2'))(_0x1e35('0x3'));var moment=require(_0x1e35('0x4'));var BPromise=require('bluebird');var rp=require(_0x1e35('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e35('0x6'));var config=require(_0x1e35('0x7'));var attributes=require(_0x1e35('0x8'));module[_0x1e35('0x9')]=function(_0x3e8bb8,_0xfa334d){return _0x3e8bb8['define'](_0x1e35('0xa'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f8e=['../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues','lodash','util','api','moment','path','rimraf'];(function(_0x474a72,_0x439f5a){var _0x304966=function(_0x1466eb){while(--_0x1466eb){_0x474a72['push'](_0x474a72['shift']());}};_0x304966(++_0x439f5a);}(_0x6f8e,0x73));var _0xe6f8=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6f8e[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xe6f8('0x0'));var util=require(_0xe6f8('0x1'));var logger=require('../../config/logger')(_0xe6f8('0x2'));var moment=require(_0xe6f8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe6f8('0x4'));var rimraf=require(_0xe6f8('0x5'));var config=require(_0xe6f8('0x6'));var attributes=require(_0xe6f8('0x7'));module['exports']=function(_0x1433f1,_0x18a258){return _0x1433f1[_0xe6f8('0x8')](_0xe6f8('0x9'),attributes,{'tableName':_0xe6f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 915ffb8..5ee1054 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 _0x71c8=['FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','map','model','include','ShowFaxQueue','lodash','util','moment','ioredis','../../mysqldb','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x71c8,0x119));var _0x871c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x71c8[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x871c('0x0'));var util=require(_0x871c('0x1'));var moment=require(_0x871c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x871c('0x3'));var db=require(_0x871c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x871c('0x5'));var client=jayson[_0x871c('0x6')][_0x871c('0x7')]({'port':0x232a});config['redis']=_[_0x871c('0x8')](config[_0x871c('0x9')],{'host':_0x871c('0xa'),'port':0x18eb});var socket=require(_0x871c('0xb'))(new Redis(config['redis']));require(_0x871c('0xc'))[_0x871c('0xd')](socket);function respondWithRpcPromise(_0x3e9306,_0x14e751,_0x18013f){return new BPromise(function(_0x6b323d,_0x5d6ed6){return client[_0x871c('0xe')](_0x3e9306,_0x18013f)[_0x871c('0xf')](function(_0x4576e1){logger[_0x871c('0x10')]('FaxQueue,\x20%s,\x20%s',_0x14e751,_0x871c('0x11'));logger[_0x871c('0x12')](_0x871c('0x13'),_0x14e751,_0x871c('0x11'),JSON[_0x871c('0x14')](_0x4576e1));if(_0x4576e1['error']){if(_0x4576e1[_0x871c('0x15')][_0x871c('0x16')]===0x1f4){logger[_0x871c('0x15')](_0x871c('0x17'),_0x14e751,_0x4576e1[_0x871c('0x15')][_0x871c('0x18')]);return _0x5d6ed6(_0x4576e1['error']['message']);}logger[_0x871c('0x15')](_0x871c('0x17'),_0x14e751,_0x4576e1[_0x871c('0x15')][_0x871c('0x18')]);return _0x6b323d(_0x4576e1[_0x871c('0x15')][_0x871c('0x18')]);}else{logger[_0x871c('0x10')](_0x871c('0x17'),_0x14e751,'request\x20sent');_0x6b323d(_0x4576e1[_0x871c('0x19')]['message']);}})[_0x871c('0x1a')](function(_0x138efd){logger[_0x871c('0x15')]('FaxQueue,\x20%s,\x20%s',_0x14e751,_0x138efd);_0x5d6ed6(_0x138efd);});});}exports[_0x871c('0x1b')]=function(_0x5d40b4){var _0x4ac924=this;return new Promise(function(_0x3d5376,_0x3aa238){return db[_0x871c('0x1c')]['findAll']({'raw':_0x5d40b4[_0x871c('0x1d')]?_0x5d40b4[_0x871c('0x1d')][_0x871c('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d40b4['options']?_0x5d40b4['options'][_0x871c('0x1f')]||null:null,'attributes':_0x5d40b4[_0x871c('0x1d')]?_0x5d40b4['options'][_0x871c('0x20')]||null:null,'limit':_0x5d40b4['options']?_0x5d40b4[_0x871c('0x1d')][_0x871c('0x21')]||null:null,'include':_0x5d40b4[_0x871c('0x1d')]?_0x5d40b4['options']['include']?_[_0x871c('0x22')](_0x5d40b4[_0x871c('0x1d')]['include'],function(_0x5b8b89){return{'model':db[_0x5b8b89[_0x871c('0x23')]],'as':_0x5b8b89['as'],'attributes':_0x5b8b89[_0x871c('0x20')],'include':_0x5b8b89[_0x871c('0x24')]?_[_0x871c('0x22')](_0x5b8b89[_0x871c('0x24')],function(_0x20bf9d){return{'model':db[_0x20bf9d['model']],'as':_0x20bf9d['as'],'attributes':_0x20bf9d['attributes'],'include':_0x20bf9d[_0x871c('0x24')]?_[_0x871c('0x22')](_0x20bf9d[_0x871c('0x24')],function(_0x1b4790){return{'model':db[_0x1b4790[_0x871c('0x23')]],'as':_0x1b4790['as'],'attributes':_0x1b4790[_0x871c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x871c('0xf')](function(_0x33d613){logger['info']('GetFaxQueue',_0x5d40b4);logger['debug'](_0x871c('0x1b'),_0x5d40b4,JSON[_0x871c('0x14')](_0x33d613));_0x3d5376(_0x33d613);})[_0x871c('0x1a')](function(_0x5b2da7){logger[_0x871c('0x15')](_0x871c('0x1b'),_0x5b2da7[_0x871c('0x18')],_0x5d40b4);_0x3aa238(_0x4ac924['error'](0x1f4,_0x5b2da7[_0x871c('0x18')]));});});};exports['ShowFaxQueue']=function(_0x4f3f74){var _0x4284ed=this;return new Promise(function(_0x443fb3,_0x1dbf6c){return db['FaxQueue']['find']({'raw':_0x4f3f74[_0x871c('0x1d')]?_0x4f3f74[_0x871c('0x1d')][_0x871c('0x1e')]===undefined?!![]:![]:!![],'where':_0x4f3f74[_0x871c('0x1d')]?_0x4f3f74[_0x871c('0x1d')][_0x871c('0x1f')]||null:null,'attributes':_0x4f3f74[_0x871c('0x1d')]?_0x4f3f74[_0x871c('0x1d')][_0x871c('0x20')]||null:null,'include':_0x4f3f74[_0x871c('0x1d')]?_0x4f3f74[_0x871c('0x1d')][_0x871c('0x24')]?_['map'](_0x4f3f74[_0x871c('0x1d')][_0x871c('0x24')],function(_0x45c2b1){return{'model':db[_0x45c2b1['model']],'as':_0x45c2b1['as'],'attributes':_0x45c2b1[_0x871c('0x20')],'include':_0x45c2b1[_0x871c('0x24')]?_['map'](_0x45c2b1[_0x871c('0x24')],function(_0x329aae){return{'model':db[_0x329aae[_0x871c('0x23')]],'as':_0x329aae['as'],'attributes':_0x329aae[_0x871c('0x20')],'include':_0x329aae[_0x871c('0x24')]?_[_0x871c('0x22')](_0x329aae['include'],function(_0x12e5a6){return{'model':db[_0x12e5a6['model']],'as':_0x12e5a6['as'],'attributes':_0x12e5a6[_0x871c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x871c('0xf')](function(_0xbd3cc4){logger[_0x871c('0x10')]('ShowFaxQueue',_0x4f3f74);logger[_0x871c('0x12')](_0x871c('0x25'),_0x4f3f74,JSON['stringify'](_0xbd3cc4));_0x443fb3(_0xbd3cc4);})['catch'](function(_0x41dc4e){logger['error'](_0x871c('0x25'),_0x41dc4e[_0x871c('0x18')],_0x4f3f74);_0x1dbf6c(_0x4284ed[_0x871c('0x15')](0x1f4,_0x41dc4e[_0x871c('0x18')]));});});}; \ No newline at end of file +var _0x4aa2=['where','attributes','limit','include','map','model','find','ShowFaxQueue','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxQueue','FaxQueue','findAll','options','raw'];(function(_0xb77dfe,_0x39c4c7){var _0x5e4f5d=function(_0x49f1){while(--_0x49f1){_0xb77dfe['push'](_0xb77dfe['shift']());}};_0x5e4f5d(++_0x39c4c7);}(_0x4aa2,0xbd));var _0x24aa=function(_0x47f218,_0x35281c){_0x47f218=_0x47f218-0x0;var _0x22c16c=_0x4aa2[_0x47f218];return _0x22c16c;};'use strict';var _=require(_0x24aa('0x0'));var util=require(_0x24aa('0x1'));var moment=require(_0x24aa('0x2'));var BPromise=require(_0x24aa('0x3'));var rs=require(_0x24aa('0x4'));var fs=require('fs');var Redis=require(_0x24aa('0x5'));var db=require(_0x24aa('0x6'))['db'];var utils=require(_0x24aa('0x7'));var logger=require(_0x24aa('0x8'))(_0x24aa('0x9'));var config=require(_0x24aa('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x24aa('0xb')][_0x24aa('0xc')]({'port':0x232a});config[_0x24aa('0xd')]=_[_0x24aa('0xe')](config['redis'],{'host':_0x24aa('0xf'),'port':0x18eb});var socket=require(_0x24aa('0x10'))(new Redis(config[_0x24aa('0xd')]));require(_0x24aa('0x11'))[_0x24aa('0x12')](socket);function respondWithRpcPromise(_0x454e47,_0x3723a9,_0x2de573){return new BPromise(function(_0x381bf3,_0x452e8c){return client[_0x24aa('0x13')](_0x454e47,_0x2de573)[_0x24aa('0x14')](function(_0x30cdfa){logger[_0x24aa('0x15')](_0x24aa('0x16'),_0x3723a9,_0x24aa('0x17'));logger[_0x24aa('0x18')](_0x24aa('0x19'),_0x3723a9,_0x24aa('0x17'),JSON[_0x24aa('0x1a')](_0x30cdfa));if(_0x30cdfa[_0x24aa('0x1b')]){if(_0x30cdfa[_0x24aa('0x1b')][_0x24aa('0x1c')]===0x1f4){logger[_0x24aa('0x1b')](_0x24aa('0x16'),_0x3723a9,_0x30cdfa[_0x24aa('0x1b')][_0x24aa('0x1d')]);return _0x452e8c(_0x30cdfa[_0x24aa('0x1b')][_0x24aa('0x1d')]);}logger[_0x24aa('0x1b')]('FaxQueue,\x20%s,\x20%s',_0x3723a9,_0x30cdfa[_0x24aa('0x1b')][_0x24aa('0x1d')]);return _0x381bf3(_0x30cdfa['error'][_0x24aa('0x1d')]);}else{logger[_0x24aa('0x15')](_0x24aa('0x16'),_0x3723a9,'request\x20sent');_0x381bf3(_0x30cdfa[_0x24aa('0x1e')][_0x24aa('0x1d')]);}})['catch'](function(_0x4fbbd1){logger[_0x24aa('0x1b')](_0x24aa('0x16'),_0x3723a9,_0x4fbbd1);_0x452e8c(_0x4fbbd1);});});}exports[_0x24aa('0x1f')]=function(_0x22def7){var _0x436f15=this;return new Promise(function(_0x2a2705,_0x42b107){return db[_0x24aa('0x20')][_0x24aa('0x21')]({'raw':_0x22def7[_0x24aa('0x22')]?_0x22def7[_0x24aa('0x22')][_0x24aa('0x23')]===undefined?!![]:![]:!![],'where':_0x22def7[_0x24aa('0x22')]?_0x22def7[_0x24aa('0x22')][_0x24aa('0x24')]||null:null,'attributes':_0x22def7[_0x24aa('0x22')]?_0x22def7[_0x24aa('0x22')][_0x24aa('0x25')]||null:null,'limit':_0x22def7[_0x24aa('0x22')]?_0x22def7[_0x24aa('0x22')][_0x24aa('0x26')]||null:null,'include':_0x22def7[_0x24aa('0x22')]?_0x22def7[_0x24aa('0x22')][_0x24aa('0x27')]?_[_0x24aa('0x28')](_0x22def7[_0x24aa('0x22')][_0x24aa('0x27')],function(_0x3e4cf0){return{'model':db[_0x3e4cf0[_0x24aa('0x29')]],'as':_0x3e4cf0['as'],'attributes':_0x3e4cf0[_0x24aa('0x25')],'include':_0x3e4cf0[_0x24aa('0x27')]?_['map'](_0x3e4cf0[_0x24aa('0x27')],function(_0x2a6501){return{'model':db[_0x2a6501[_0x24aa('0x29')]],'as':_0x2a6501['as'],'attributes':_0x2a6501[_0x24aa('0x25')],'include':_0x2a6501[_0x24aa('0x27')]?_['map'](_0x2a6501['include'],function(_0x4c463a){return{'model':db[_0x4c463a['model']],'as':_0x4c463a['as'],'attributes':_0x4c463a[_0x24aa('0x25')]};}):[]};}):[]};}):[]:[]})[_0x24aa('0x14')](function(_0x5ae791){logger[_0x24aa('0x15')](_0x24aa('0x1f'),_0x22def7);logger[_0x24aa('0x18')]('GetFaxQueue',_0x22def7,JSON[_0x24aa('0x1a')](_0x5ae791));_0x2a2705(_0x5ae791);})['catch'](function(_0x5457e1){logger[_0x24aa('0x1b')]('GetFaxQueue',_0x5457e1[_0x24aa('0x1d')],_0x22def7);_0x42b107(_0x436f15[_0x24aa('0x1b')](0x1f4,_0x5457e1[_0x24aa('0x1d')]));});});};exports['ShowFaxQueue']=function(_0x3913a0){var _0x486bae=this;return new Promise(function(_0x111610,_0x1931ec){return db['FaxQueue'][_0x24aa('0x2a')]({'raw':_0x3913a0['options']?_0x3913a0[_0x24aa('0x22')][_0x24aa('0x23')]===undefined?!![]:![]:!![],'where':_0x3913a0[_0x24aa('0x22')]?_0x3913a0[_0x24aa('0x22')]['where']||null:null,'attributes':_0x3913a0[_0x24aa('0x22')]?_0x3913a0[_0x24aa('0x22')][_0x24aa('0x25')]||null:null,'include':_0x3913a0[_0x24aa('0x22')]?_0x3913a0[_0x24aa('0x22')]['include']?_[_0x24aa('0x28')](_0x3913a0[_0x24aa('0x22')]['include'],function(_0x23778a){return{'model':db[_0x23778a[_0x24aa('0x29')]],'as':_0x23778a['as'],'attributes':_0x23778a[_0x24aa('0x25')],'include':_0x23778a[_0x24aa('0x27')]?_['map'](_0x23778a[_0x24aa('0x27')],function(_0x20ae57){return{'model':db[_0x20ae57[_0x24aa('0x29')]],'as':_0x20ae57['as'],'attributes':_0x20ae57[_0x24aa('0x25')],'include':_0x20ae57[_0x24aa('0x27')]?_[_0x24aa('0x28')](_0x20ae57[_0x24aa('0x27')],function(_0x1db8e2){return{'model':db[_0x1db8e2[_0x24aa('0x29')]],'as':_0x1db8e2['as'],'attributes':_0x1db8e2[_0x24aa('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dc46b){logger['info']('ShowFaxQueue',_0x3913a0);logger[_0x24aa('0x18')](_0x24aa('0x2b'),_0x3913a0,JSON[_0x24aa('0x1a')](_0x3dc46b));_0x111610(_0x3dc46b);})[_0x24aa('0x2c')](function(_0x36b0a1){logger[_0x24aa('0x1b')](_0x24aa('0x2b'),_0x36b0a1[_0x24aa('0x1d')],_0x3913a0);_0x1931ec(_0x486bae[_0x24aa('0x1b')](0x1f4,_0x36b0a1[_0x24aa('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 16ab864..326699e 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 _0x9576=['save','remove','update','emit','removeListener','register','length','faxQueue:','./faxQueue.events'];(function(_0x556b59,_0x2f90b1){var _0x57d8a2=function(_0x15eea9){while(--_0x15eea9){_0x556b59['push'](_0x556b59['shift']());}};_0x57d8a2(++_0x2f90b1);}(_0x9576,0x182));var _0x6957=function(_0x20bd84,_0x3e2675){_0x20bd84=_0x20bd84-0x0;var _0x49bdf3=_0x9576[_0x20bd84];return _0x49bdf3;};'use strict';var FaxQueueEvents=require(_0x6957('0x0'));var events=[_0x6957('0x1'),_0x6957('0x2'),_0x6957('0x3')];function createListener(_0x47fd53,_0x4ee0d8){return function(_0xf9d8fc){_0x4ee0d8[_0x6957('0x4')](_0x47fd53,_0xf9d8fc);};}function removeListener(_0x9e834,_0x10ed80){return function(){FaxQueueEvents[_0x6957('0x5')](_0x9e834,_0x10ed80);};}exports[_0x6957('0x6')]=function(_0x2eb79e){for(var _0x49e08a=0x0,_0x6d8af8=events[_0x6957('0x7')];_0x49e08a<_0x6d8af8;_0x49e08a++){var _0x70b8c4=events[_0x49e08a];var _0x2e5727=createListener(_0x6957('0x8')+_0x70b8c4,_0x2eb79e);FaxQueueEvents['on'](_0x70b8c4,_0x2e5727);}}; \ No newline at end of file +var _0x24ba=['register','length','./faxQueue.events','remove','emit'];(function(_0x2fa9f7,_0x1ab581){var _0xd18cec=function(_0x4d43f2){while(--_0x4d43f2){_0x2fa9f7['push'](_0x2fa9f7['shift']());}};_0xd18cec(++_0x1ab581);}(_0x24ba,0xf2));var _0xa24b=function(_0x2f89c5,_0x2000e4){_0x2f89c5=_0x2f89c5-0x0;var _0x506b12=_0x24ba[_0x2f89c5];return _0x506b12;};'use strict';var FaxQueueEvents=require(_0xa24b('0x0'));var events=['save',_0xa24b('0x1'),'update'];function createListener(_0x15b77d,_0xdacd1a){return function(_0xb9bd9){_0xdacd1a[_0xa24b('0x2')](_0x15b77d,_0xb9bd9);};}function removeListener(_0x2974aa,_0x4b86d4){return function(){FaxQueueEvents['removeListener'](_0x2974aa,_0x4b86d4);};}exports[_0xa24b('0x3')]=function(_0x3bf103){for(var _0x5f37fb=0x0,_0x527b57=events[_0xa24b('0x4')];_0x5f37fb<_0x527b57;_0x5f37fb++){var _0x4a2e5f=events[_0x5f37fb];var _0x5ed953=createListener('faxQueue:'+_0x4a2e5f,_0x3bf103);FaxQueueEvents['on'](_0x4a2e5f,_0x5ed953);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index fcd3088..1f9f1cb 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 _0xfcf0=['/:id/teams','getTeams','getAgents','create','post','/:id/users','put','update','destroy','delete','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers'];(function(_0x4f2363,_0x3b306c){var _0x17f3c2=function(_0xce81be){while(--_0xce81be){_0x4f2363['push'](_0x4f2363['shift']());}};_0x17f3c2(++_0x3b306c);}(_0xfcf0,0x138));var _0x0fcf=function(_0x5d6e35,_0x4d1ac0){_0x5d6e35=_0x5d6e35-0x0;var _0x5d7ada=_0xfcf0[_0x5d6e35];return _0x5d7ada;};'use strict';var multer=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var path=require('path');var timeout=require(_0x0fcf('0x2'));var express=require(_0x0fcf('0x3'));var router=express[_0x0fcf('0x4')]();var fs_extra=require(_0x0fcf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var controller=require(_0x0fcf('0x8'));router[_0x0fcf('0x9')]('/',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0xb')]);router[_0x0fcf('0x9')](_0x0fcf('0xc'),auth['isAuthenticated'](),controller[_0x0fcf('0xd')]);router[_0x0fcf('0x9')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0xf')]);router[_0x0fcf('0x9')](_0x0fcf('0x10'),auth['isAuthenticated'](),controller[_0x0fcf('0x11')]);router['get'](_0x0fcf('0x12'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x13')]);router['get']('/:id/users',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x14')]);router['post']('/',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x15')]);router[_0x0fcf('0x16')](_0x0fcf('0x12'),auth[_0x0fcf('0xa')](),controller['addTeams']);router[_0x0fcf('0x16')](_0x0fcf('0x17'),auth[_0x0fcf('0xa')](),controller['addAgents']);router[_0x0fcf('0x18')](_0x0fcf('0xe'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x19')]);router['delete'](_0x0fcf('0xe'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x1a')]);router[_0x0fcf('0x1b')](_0x0fcf('0x12'),auth['isAuthenticated'](),controller[_0x0fcf('0x1c')]);router[_0x0fcf('0x1b')]('/:id/users',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x3f8a=['delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addAgents','update'];(function(_0x836ca,_0x4545ec){var _0x250d05=function(_0x252b3a){while(--_0x252b3a){_0x836ca['push'](_0x836ca['shift']());}};_0x250d05(++_0x4545ec);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0xf2f76c,_0xbb16ed){_0xf2f76c=_0xf2f76c-0x0;var _0x518dfd=_0x3f8a[_0xf2f76c];return _0x518dfd;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var fs_extra=require(_0xa3f8('0x5'));var auth=require(_0xa3f8('0x6'));var interaction=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var controller=require(_0xa3f8('0x9'));router[_0xa3f8('0xa')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xc')]);router[_0xa3f8('0xa')](_0xa3f8('0xd'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xe')]);router[_0xa3f8('0xa')](_0xa3f8('0xf'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x10')]);router['get'](_0xa3f8('0x11'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x12')]);router[_0xa3f8('0xa')]('/:id/teams',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x13')]);router[_0xa3f8('0xa')](_0xa3f8('0x14'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x15')]);router[_0xa3f8('0x16')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x17')]);router[_0xa3f8('0x16')](_0xa3f8('0x18'),auth[_0xa3f8('0xb')](),controller['addTeams']);router[_0xa3f8('0x16')](_0xa3f8('0x14'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x19')]);router['put'](_0xa3f8('0xf'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x1a')]);router[_0xa3f8('0x1b')](_0xa3f8('0xf'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x1c')]);router[_0xa3f8('0x1b')](_0xa3f8('0x18'),auth[_0xa3f8('0xb')](),controller['removeTeams']);router[_0xa3f8('0x1b')]('/:id/users',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x1d')]);module[_0xa3f8('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index b5f7115..b5e8a95 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 _0x5f2b=['exports','STRING','DATE','moment','sequelize'];(function(_0x53578d,_0x11d2be){var _0x1534ae=function(_0x17c3e2){while(--_0x17c3e2){_0x53578d['push'](_0x53578d['shift']());}};_0x1534ae(++_0x11d2be);}(_0x5f2b,0x17a));var _0xb5f2=function(_0x17f0cc,_0x31ef05){_0x17f0cc=_0x17f0cc-0x0;var _0x51c1ac=_0x5f2b[_0x17f0cc];return _0x51c1ac;};'use strict';var moment=require(_0xb5f2('0x0'));var Sequelize=require(_0xb5f2('0x1'));module[_0xb5f2('0x2')]={'uniqueid':{'type':Sequelize[_0xb5f2('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb5f2('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb5f2('0x4')]},'acceptAt':{'type':Sequelize[_0xb5f2('0x4')]},'exitAt':{'type':Sequelize[_0xb5f2('0x4')]},'reason':{'type':Sequelize[_0xb5f2('0x3')]}}; \ No newline at end of file +var _0x089c=['exports','STRING','DATE','moment'];(function(_0x57ace,_0x2064e8){var _0x36a220=function(_0x40c33b){while(--_0x40c33b){_0x57ace['push'](_0x57ace['shift']());}};_0x36a220(++_0x2064e8);}(_0x089c,0x7b));var _0xc089=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x089c[_0x5a95fa];return _0x1a61b8;};'use strict';var moment=require(_0xc089('0x0'));var Sequelize=require('sequelize');module[_0xc089('0x1')]={'uniqueid':{'type':Sequelize[_0xc089('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc089('0x3')]},'leaveAt':{'type':Sequelize[_0xc089('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc089('0x3')]},'reason':{'type':Sequelize[_0xc089('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 69b8b34..96c0417 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 _0x9e9b=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','index','FaxQueueReport','fieldName','type','key','keys','intersection','model','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x9e9b,0x1a7));var _0xb9e9=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0x9e9b[_0x231a47];return _0x48d7c9;};'use strict';var emlformat=require(_0xb9e9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb9e9('0x1'));var rp=require(_0xb9e9('0x2'));var moment=require(_0xb9e9('0x3'));var BPromise=require(_0xb9e9('0x4'));var Mustache=require('mustache');var util=require(_0xb9e9('0x5'));var path=require(_0xb9e9('0x6'));var sox=require('sox');var csv=require(_0xb9e9('0x7'));var ejs=require(_0xb9e9('0x8'));var fs=require('fs');var fs_extra=require(_0xb9e9('0x9'));var _=require(_0xb9e9('0xa'));var squel=require(_0xb9e9('0xb'));var crypto=require(_0xb9e9('0xc'));var jsforce=require(_0xb9e9('0xd'));var deskjs=require(_0xb9e9('0xe'));var toCsv=require(_0xb9e9('0x7'));var querystring=require(_0xb9e9('0xf'));var Papa=require(_0xb9e9('0x10'));var Redis=require(_0xb9e9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb9e9('0x12'));var as=require(_0xb9e9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9e9('0x14'))(_0xb9e9('0x15'));var utils=require(_0xb9e9('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb9e9('0x17'))['db'];function respondWithStatusCode(_0x393cc5,_0x1b15f9){_0x1b15f9=_0x1b15f9||0xcc;return function(_0x1c0b64){if(_0x1c0b64){return _0x393cc5[_0xb9e9('0x18')](_0x1b15f9);}return _0x393cc5['status'](_0x1b15f9)['end']();};}function respondWithResult(_0x3af79d,_0xac8104){_0xac8104=_0xac8104||0xc8;return function(_0x52b6bf){if(_0x52b6bf){return _0x3af79d[_0xb9e9('0x19')](_0xac8104)[_0xb9e9('0x1a')](_0x52b6bf);}};}function respondWithFilteredResult(_0x13b48f,_0x3a3b0e){return function(_0x4a141f){if(_0x4a141f){var _0xf3d58f=typeof _0x3a3b0e[_0xb9e9('0x1b')]===_0xb9e9('0x1c')&&typeof _0x3a3b0e['limit']===_0xb9e9('0x1c');var _0x107be6=_0x4a141f[_0xb9e9('0x1d')];var _0x3f3a27=_0xf3d58f?0x0:_0x3a3b0e[_0xb9e9('0x1b')];var _0x258791=_0xf3d58f?_0x4a141f[_0xb9e9('0x1d')]:_0x3a3b0e[_0xb9e9('0x1b')]+_0x3a3b0e[_0xb9e9('0x1e')];var _0x142694;if(_0x258791>=_0x107be6){_0x258791=_0x107be6;_0x142694=0xc8;}else{_0x142694=0xce;}_0x13b48f[_0xb9e9('0x19')](_0x142694);return _0x13b48f[_0xb9e9('0x1f')](_0xb9e9('0x20'),_0x3f3a27+'-'+_0x258791+'/'+_0x107be6)[_0xb9e9('0x1a')](_0x4a141f);}return null;};}function patchUpdates(_0x1183e2){return function(_0x45b9b0){try{jsonpatch[_0xb9e9('0x21')](_0x45b9b0,_0x1183e2,!![]);}catch(_0x39e10c){return BPromise[_0xb9e9('0x22')](_0x39e10c);}return _0x45b9b0[_0xb9e9('0x23')]();};}function saveUpdates(_0x52a8b9,_0x25b5ed){return function(_0x524afc){if(_0x524afc){return _0x524afc[_0xb9e9('0x24')](_0x52a8b9)[_0xb9e9('0x25')](function(_0x876b4d){return _0x876b4d;});}return null;};}function removeEntity(_0x2cb451,_0x84c9e3){return function(_0x143654){if(_0x143654){return _0x143654[_0xb9e9('0x26')]()[_0xb9e9('0x25')](function(){_0x2cb451['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36b8f8,_0x20466b){return function(_0x15b831){if(!_0x15b831){_0x36b8f8[_0xb9e9('0x18')](0x194);}return _0x15b831;};}function handleError(_0x39a59b,_0x35e403){_0x35e403=_0x35e403||0x1f4;return function(_0x4af501){logger['error'](_0x4af501['stack']);if(_0x4af501['name']){delete _0x4af501[_0xb9e9('0x27')];}_0x39a59b['status'](_0x35e403)['send'](_0x4af501);};}exports[_0xb9e9('0x28')]=function(_0x51bd72,_0x3ffa10){var _0x9a28b8={},_0x4d451f={},_0x4e2ecd={'count':0x0,'rows':[]};var _0x16e873=_['map'](db[_0xb9e9('0x29')]['rawAttributes'],function(_0x5a1992){return{'name':_0x5a1992[_0xb9e9('0x2a')],'type':_0x5a1992[_0xb9e9('0x2b')][_0xb9e9('0x2c')]};});_0x4d451f['model']=_['map'](_0x16e873,_0xb9e9('0x27'));_0x4d451f['query']=_[_0xb9e9('0x2d')](_0x51bd72['query']);_0x4d451f['filters']=_[_0xb9e9('0x2e')](_0x4d451f[_0xb9e9('0x2f')],_0x4d451f['query']);_0x9a28b8[_0xb9e9('0x30')]=_[_0xb9e9('0x2e')](_0x4d451f[_0xb9e9('0x2f')],qs['fields'](_0x51bd72[_0xb9e9('0x31')][_0xb9e9('0x32')]));_0x9a28b8['attributes']=_0x9a28b8[_0xb9e9('0x30')][_0xb9e9('0x33')]?_0x9a28b8[_0xb9e9('0x30')]:_0x4d451f[_0xb9e9('0x2f')];if(!_0x51bd72[_0xb9e9('0x31')][_0xb9e9('0x34')](_0xb9e9('0x35'))){_0x9a28b8['limit']=qs[_0xb9e9('0x1e')](_0x51bd72[_0xb9e9('0x31')]['limit']);_0x9a28b8[_0xb9e9('0x1b')]=qs[_0xb9e9('0x1b')](_0x51bd72[_0xb9e9('0x31')][_0xb9e9('0x1b')]);}_0x9a28b8[_0xb9e9('0x36')]=qs[_0xb9e9('0x37')](_0x51bd72[_0xb9e9('0x31')]['sort']);_0x9a28b8[_0xb9e9('0x38')]=qs[_0xb9e9('0x39')](_[_0xb9e9('0x3a')](_0x51bd72[_0xb9e9('0x31')],_0x4d451f[_0xb9e9('0x39')]),_0x16e873);if(_0x51bd72[_0xb9e9('0x31')][_0xb9e9('0x3b')]){_0x9a28b8['where']=_[_0xb9e9('0x3c')](_0x9a28b8[_0xb9e9('0x38')],{'$or':_['map'](_0x16e873,function(_0x246842){if(_0x246842['type']!==_0xb9e9('0x3d')){var _0x275628={};_0x275628[_0x246842['name']]={'$like':'%'+_0x51bd72[_0xb9e9('0x31')][_0xb9e9('0x3b')]+'%'};return _0x275628;}})});}_0x9a28b8=_[_0xb9e9('0x3c')]({},_0x9a28b8,_0x51bd72['options']);var _0x57b575={'where':_0x9a28b8['where']};return db[_0xb9e9('0x29')][_0xb9e9('0x1d')](_0x57b575)[_0xb9e9('0x25')](function(_0x2bb4b0){_0x4e2ecd[_0xb9e9('0x1d')]=_0x2bb4b0;if(_0x51bd72[_0xb9e9('0x31')][_0xb9e9('0x3e')]){_0x9a28b8[_0xb9e9('0x3f')]=[{'all':!![]}];}return db[_0xb9e9('0x29')]['findAll'](_0x9a28b8);})['then'](function(_0x42553){_0x4e2ecd['rows']=_0x42553;return _0x4e2ecd;})[_0xb9e9('0x25')](respondWithFilteredResult(_0x3ffa10,_0x9a28b8))[_0xb9e9('0x40')](handleError(_0x3ffa10,null));};exports[_0xb9e9('0x41')]=function(_0x474c93,_0x44bb30){var _0x17b887={'raw':!![],'where':{'id':_0x474c93[_0xb9e9('0x42')]['id']}},_0x4e6e48={};_0x4e6e48[_0xb9e9('0x2f')]=_[_0xb9e9('0x2d')](db[_0xb9e9('0x29')][_0xb9e9('0x43')]);_0x4e6e48['query']=_[_0xb9e9('0x2d')](_0x474c93[_0xb9e9('0x31')]);_0x4e6e48['filters']=_[_0xb9e9('0x2e')](_0x4e6e48[_0xb9e9('0x2f')],_0x4e6e48['query']);_0x17b887['attributes']=_[_0xb9e9('0x2e')](_0x4e6e48['model'],qs[_0xb9e9('0x32')](_0x474c93[_0xb9e9('0x31')]['fields']));_0x17b887['attributes']=_0x17b887['attributes'][_0xb9e9('0x33')]?_0x17b887['attributes']:_0x4e6e48[_0xb9e9('0x2f')];if(_0x474c93[_0xb9e9('0x31')]['includeAll']){_0x17b887[_0xb9e9('0x3f')]=[{'all':!![]}];}_0x17b887=_['merge']({},_0x17b887,_0x474c93[_0xb9e9('0x44')]);return db['FaxQueueReport'][_0xb9e9('0x45')](_0x17b887)[_0xb9e9('0x25')](handleEntityNotFound(_0x44bb30,null))[_0xb9e9('0x25')](respondWithResult(_0x44bb30,null))[_0xb9e9('0x40')](handleError(_0x44bb30,null));};exports[_0xb9e9('0x46')]=function(_0x432c60,_0xf8be9e){return db[_0xb9e9('0x29')]['create'](_0x432c60[_0xb9e9('0x47')],{})['then'](respondWithResult(_0xf8be9e,0xc9))[_0xb9e9('0x40')](handleError(_0xf8be9e,null));};exports[_0xb9e9('0x24')]=function(_0x4640a0,_0x315620){if(_0x4640a0[_0xb9e9('0x47')]['id']){delete _0x4640a0['body']['id'];}return db[_0xb9e9('0x29')][_0xb9e9('0x45')]({'where':{'id':_0x4640a0[_0xb9e9('0x42')]['id']}})[_0xb9e9('0x25')](handleEntityNotFound(_0x315620,null))[_0xb9e9('0x25')](saveUpdates(_0x4640a0[_0xb9e9('0x47')],null))['then'](respondWithResult(_0x315620,null))[_0xb9e9('0x40')](handleError(_0x315620,null));};exports[_0xb9e9('0x26')]=function(_0x5a61bf,_0x4f315d){return db['FaxQueueReport'][_0xb9e9('0x45')]({'where':{'id':_0x5a61bf['params']['id']}})['then'](handleEntityNotFound(_0x4f315d,null))[_0xb9e9('0x25')](removeEntity(_0x4f315d,null))[_0xb9e9('0x40')](handleError(_0x4f315d,null));};exports[_0xb9e9('0x48')]=function(_0xbffc66,_0x2226c8){return db['FaxQueueReport'][_0xb9e9('0x48')]()[_0xb9e9('0x25')](respondWithResult(_0x2226c8,null))[_0xb9e9('0x40')](handleError(_0x2226c8,null));}; \ No newline at end of file +var _0xcf95=['hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','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','offset','undefined','limit','count','Content-Range','json','reject','save','update','destroy','then','error','stack','name','index','map','FaxQueueReport','fieldName','type','model','query','keys','intersection','attributes','fields','length'];(function(_0x5aa674,_0x357216){var _0x16ceb2=function(_0x2be8f9){while(--_0x2be8f9){_0x5aa674['push'](_0x5aa674['shift']());}};_0x16ceb2(++_0x357216);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5cf9('0x0'));var rimraf=require(_0x5cf9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5cf9('0x2'));var BPromise=require(_0x5cf9('0x3'));var Mustache=require(_0x5cf9('0x4'));var util=require(_0x5cf9('0x5'));var path=require('path');var sox=require(_0x5cf9('0x6'));var csv=require(_0x5cf9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5cf9('0x8'));var squel=require(_0x5cf9('0x9'));var crypto=require('crypto');var jsforce=require(_0x5cf9('0xa'));var deskjs=require(_0x5cf9('0xb'));var toCsv=require(_0x5cf9('0x7'));var querystring=require(_0x5cf9('0xc'));var Papa=require(_0x5cf9('0xd'));var Redis=require(_0x5cf9('0xe'));var authService=require(_0x5cf9('0xf'));var qs=require(_0x5cf9('0x10'));var as=require(_0x5cf9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5cf9('0x12'))(_0x5cf9('0x13'));var utils=require(_0x5cf9('0x14'));var config=require(_0x5cf9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5cf9('0x16'))['db'];function respondWithStatusCode(_0x191b90,_0x3094d9){_0x3094d9=_0x3094d9||0xcc;return function(_0x565b32){if(_0x565b32){return _0x191b90[_0x5cf9('0x17')](_0x3094d9);}return _0x191b90[_0x5cf9('0x18')](_0x3094d9)[_0x5cf9('0x19')]();};}function respondWithResult(_0x141c9e,_0x5f132e){_0x5f132e=_0x5f132e||0xc8;return function(_0xe787ae){if(_0xe787ae){return _0x141c9e[_0x5cf9('0x18')](_0x5f132e)['json'](_0xe787ae);}};}function respondWithFilteredResult(_0x576855,_0x5b8bf8){return function(_0x4cb11d){if(_0x4cb11d){var _0x184461=typeof _0x5b8bf8[_0x5cf9('0x1a')]===_0x5cf9('0x1b')&&typeof _0x5b8bf8[_0x5cf9('0x1c')]==='undefined';var _0x2fe568=_0x4cb11d[_0x5cf9('0x1d')];var _0x4ef361=_0x184461?0x0:_0x5b8bf8['offset'];var _0x17e526=_0x184461?_0x4cb11d[_0x5cf9('0x1d')]:_0x5b8bf8[_0x5cf9('0x1a')]+_0x5b8bf8[_0x5cf9('0x1c')];var _0x1b55cd;if(_0x17e526>=_0x2fe568){_0x17e526=_0x2fe568;_0x1b55cd=0xc8;}else{_0x1b55cd=0xce;}_0x576855['status'](_0x1b55cd);return _0x576855['set'](_0x5cf9('0x1e'),_0x4ef361+'-'+_0x17e526+'/'+_0x2fe568)[_0x5cf9('0x1f')](_0x4cb11d);}return null;};}function patchUpdates(_0x1f4da8){return function(_0x2865c6){try{jsonpatch['apply'](_0x2865c6,_0x1f4da8,!![]);}catch(_0x2e28c7){return BPromise[_0x5cf9('0x20')](_0x2e28c7);}return _0x2865c6[_0x5cf9('0x21')]();};}function saveUpdates(_0x3510cc,_0x5d1f80){return function(_0x2ee22a){if(_0x2ee22a){return _0x2ee22a[_0x5cf9('0x22')](_0x3510cc)['then'](function(_0x12f478){return _0x12f478;});}return null;};}function removeEntity(_0x2d153e,_0x17d689){return function(_0x2fe5f1){if(_0x2fe5f1){return _0x2fe5f1[_0x5cf9('0x23')]()[_0x5cf9('0x24')](function(){_0x2d153e[_0x5cf9('0x18')](0xcc)[_0x5cf9('0x19')]();});}};}function handleEntityNotFound(_0x2bc8c6,_0x4de284){return function(_0x46d31c){if(!_0x46d31c){_0x2bc8c6['sendStatus'](0x194);}return _0x46d31c;};}function handleError(_0x30b294,_0x1a976e){_0x1a976e=_0x1a976e||0x1f4;return function(_0x2831af){logger[_0x5cf9('0x25')](_0x2831af[_0x5cf9('0x26')]);if(_0x2831af[_0x5cf9('0x27')]){delete _0x2831af[_0x5cf9('0x27')];}_0x30b294[_0x5cf9('0x18')](_0x1a976e)['send'](_0x2831af);};}exports[_0x5cf9('0x28')]=function(_0x382c62,_0x11a939){var _0x4e029c={},_0x57fde4={},_0x2793b5={'count':0x0,'rows':[]};var _0x59b15e=_[_0x5cf9('0x29')](db[_0x5cf9('0x2a')]['rawAttributes'],function(_0x376446){return{'name':_0x376446[_0x5cf9('0x2b')],'type':_0x376446[_0x5cf9('0x2c')]['key']};});_0x57fde4[_0x5cf9('0x2d')]=_[_0x5cf9('0x29')](_0x59b15e,_0x5cf9('0x27'));_0x57fde4[_0x5cf9('0x2e')]=_[_0x5cf9('0x2f')](_0x382c62[_0x5cf9('0x2e')]);_0x57fde4['filters']=_[_0x5cf9('0x30')](_0x57fde4[_0x5cf9('0x2d')],_0x57fde4['query']);_0x4e029c[_0x5cf9('0x31')]=_['intersection'](_0x57fde4['model'],qs['fields'](_0x382c62['query'][_0x5cf9('0x32')]));_0x4e029c[_0x5cf9('0x31')]=_0x4e029c[_0x5cf9('0x31')][_0x5cf9('0x33')]?_0x4e029c[_0x5cf9('0x31')]:_0x57fde4[_0x5cf9('0x2d')];if(!_0x382c62[_0x5cf9('0x2e')][_0x5cf9('0x34')](_0x5cf9('0x35'))){_0x4e029c[_0x5cf9('0x1c')]=qs[_0x5cf9('0x1c')](_0x382c62['query'][_0x5cf9('0x1c')]);_0x4e029c[_0x5cf9('0x1a')]=qs[_0x5cf9('0x1a')](_0x382c62[_0x5cf9('0x2e')][_0x5cf9('0x1a')]);}_0x4e029c['order']=qs[_0x5cf9('0x36')](_0x382c62[_0x5cf9('0x2e')][_0x5cf9('0x36')]);_0x4e029c[_0x5cf9('0x37')]=qs['filters'](_[_0x5cf9('0x38')](_0x382c62['query'],_0x57fde4[_0x5cf9('0x39')]),_0x59b15e);if(_0x382c62[_0x5cf9('0x2e')][_0x5cf9('0x3a')]){_0x4e029c[_0x5cf9('0x37')]=_[_0x5cf9('0x3b')](_0x4e029c[_0x5cf9('0x37')],{'$or':_[_0x5cf9('0x29')](_0x59b15e,function(_0x732390){if(_0x732390['type']!=='VIRTUAL'){var _0x577478={};_0x577478[_0x732390[_0x5cf9('0x27')]]={'$like':'%'+_0x382c62[_0x5cf9('0x2e')]['filter']+'%'};return _0x577478;}})});}_0x4e029c=_[_0x5cf9('0x3b')]({},_0x4e029c,_0x382c62[_0x5cf9('0x3c')]);var _0x367e7a={'where':_0x4e029c['where']};return db[_0x5cf9('0x2a')]['count'](_0x367e7a)[_0x5cf9('0x24')](function(_0x19cdeb){_0x2793b5[_0x5cf9('0x1d')]=_0x19cdeb;if(_0x382c62[_0x5cf9('0x2e')][_0x5cf9('0x3d')]){_0x4e029c[_0x5cf9('0x3e')]=[{'all':!![]}];}return db[_0x5cf9('0x2a')]['findAll'](_0x4e029c);})[_0x5cf9('0x24')](function(_0x23e863){_0x2793b5[_0x5cf9('0x3f')]=_0x23e863;return _0x2793b5;})[_0x5cf9('0x24')](respondWithFilteredResult(_0x11a939,_0x4e029c))[_0x5cf9('0x40')](handleError(_0x11a939,null));};exports['show']=function(_0x3c8da8,_0x43d199){var _0x4b960e={'raw':!![],'where':{'id':_0x3c8da8[_0x5cf9('0x41')]['id']}},_0x5cb2c0={};_0x5cb2c0[_0x5cf9('0x2d')]=_[_0x5cf9('0x2f')](db[_0x5cf9('0x2a')][_0x5cf9('0x42')]);_0x5cb2c0['query']=_[_0x5cf9('0x2f')](_0x3c8da8['query']);_0x5cb2c0[_0x5cf9('0x39')]=_['intersection'](_0x5cb2c0[_0x5cf9('0x2d')],_0x5cb2c0['query']);_0x4b960e[_0x5cf9('0x31')]=_['intersection'](_0x5cb2c0[_0x5cf9('0x2d')],qs['fields'](_0x3c8da8[_0x5cf9('0x2e')][_0x5cf9('0x32')]));_0x4b960e[_0x5cf9('0x31')]=_0x4b960e[_0x5cf9('0x31')][_0x5cf9('0x33')]?_0x4b960e[_0x5cf9('0x31')]:_0x5cb2c0[_0x5cf9('0x2d')];if(_0x3c8da8[_0x5cf9('0x2e')][_0x5cf9('0x3d')]){_0x4b960e[_0x5cf9('0x3e')]=[{'all':!![]}];}_0x4b960e=_[_0x5cf9('0x3b')]({},_0x4b960e,_0x3c8da8[_0x5cf9('0x3c')]);return db[_0x5cf9('0x2a')][_0x5cf9('0x43')](_0x4b960e)['then'](handleEntityNotFound(_0x43d199,null))['then'](respondWithResult(_0x43d199,null))[_0x5cf9('0x40')](handleError(_0x43d199,null));};exports[_0x5cf9('0x44')]=function(_0x1b7c85,_0xdcd9ba){return db[_0x5cf9('0x2a')]['create'](_0x1b7c85[_0x5cf9('0x45')],{})['then'](respondWithResult(_0xdcd9ba,0xc9))['catch'](handleError(_0xdcd9ba,null));};exports['update']=function(_0x2390a8,_0x4f6830){if(_0x2390a8[_0x5cf9('0x45')]['id']){delete _0x2390a8[_0x5cf9('0x45')]['id'];}return db[_0x5cf9('0x2a')]['find']({'where':{'id':_0x2390a8[_0x5cf9('0x41')]['id']}})[_0x5cf9('0x24')](handleEntityNotFound(_0x4f6830,null))['then'](saveUpdates(_0x2390a8[_0x5cf9('0x45')],null))['then'](respondWithResult(_0x4f6830,null))[_0x5cf9('0x40')](handleError(_0x4f6830,null));};exports['destroy']=function(_0x8dd4fe,_0x4e5769){return db['FaxQueueReport'][_0x5cf9('0x43')]({'where':{'id':_0x8dd4fe['params']['id']}})[_0x5cf9('0x24')](handleEntityNotFound(_0x4e5769,null))[_0x5cf9('0x24')](removeEntity(_0x4e5769,null))[_0x5cf9('0x40')](handleError(_0x4e5769,null));};exports[_0x5cf9('0x46')]=function(_0x487f9b,_0x5993d1){return db[_0x5cf9('0x2a')][_0x5cf9('0x46')]()[_0x5cf9('0x24')](respondWithResult(_0x5993d1,null))[_0x5cf9('0x40')](handleError(_0x5993d1,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 5c877e6..ae436ef 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 _0x5fab=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api'];(function(_0x41ff71,_0x304266){var _0x1e6dd5=function(_0x4101db){while(--_0x4101db){_0x41ff71['push'](_0x41ff71['shift']());}};_0x1e6dd5(++_0x304266);}(_0x5fab,0x177));var _0xb5fa=function(_0x34afe8,_0x255fde){_0x34afe8=_0x34afe8-0x0;var _0x14c5d2=_0x5fab[_0x34afe8];return _0x14c5d2;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x261571,_0x46a91b){var _0x5137e6=function(_0x57ae1c){while(--_0x57ae1c){_0x261571['push'](_0x261571['shift']());}};_0x5137e6(++_0x46a91b);}(_0xf494,0x1c6));var _0x4f49=function(_0x3f6273,_0x570fa4){_0x3f6273=_0x3f6273-0x0;var _0x3978b0=_0xf494[_0x3f6273];return _0x3978b0;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('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 1a0f030..59c5ce2 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 _0x47c1=['UpdateFaxQueueReport','where','attributes','limit','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport'];(function(_0x2d994d,_0x168a27){var _0xd54be4=function(_0x1db925){while(--_0x1db925){_0x2d994d['push'](_0x2d994d['shift']());}};_0xd54be4(++_0x168a27);}(_0x47c1,0xb2));var _0x147c=function(_0x1aa4fd,_0x265057){_0x1aa4fd=_0x1aa4fd-0x0;var _0x289290=_0x47c1[_0x1aa4fd];return _0x289290;};'use strict';var _=require(_0x147c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x147c('0x1'));var rs=require(_0x147c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x147c('0x3'))['db'];var utils=require(_0x147c('0x4'));var logger=require(_0x147c('0x5'))('rpc');var config=require(_0x147c('0x6'));var jayson=require(_0x147c('0x7'));var client=jayson['client'][_0x147c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x49abfb,_0x198c76,_0xbfebb6){return new BPromise(function(_0x5e8338,_0x164474){return client['request'](_0x49abfb,_0xbfebb6)[_0x147c('0x9')](function(_0x5de9a2){logger[_0x147c('0xa')](_0x147c('0xb'),_0x198c76,_0x147c('0xc'));logger[_0x147c('0xd')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x198c76,_0x147c('0xc'),JSON[_0x147c('0xe')](_0x5de9a2));if(_0x5de9a2[_0x147c('0xf')]){if(_0x5de9a2['error'][_0x147c('0x10')]===0x1f4){logger[_0x147c('0xf')](_0x147c('0xb'),_0x198c76,_0x5de9a2[_0x147c('0xf')][_0x147c('0x11')]);return _0x164474(_0x5de9a2[_0x147c('0xf')][_0x147c('0x11')]);}logger[_0x147c('0xf')](_0x147c('0xb'),_0x198c76,_0x5de9a2[_0x147c('0xf')][_0x147c('0x11')]);return _0x5e8338(_0x5de9a2['error']['message']);}else{logger[_0x147c('0xa')](_0x147c('0xb'),_0x198c76,_0x147c('0xc'));_0x5e8338(_0x5de9a2['result'][_0x147c('0x11')]);}})[_0x147c('0x12')](function(_0x1713bd){logger[_0x147c('0xf')](_0x147c('0xb'),_0x198c76,_0x1713bd);_0x164474(_0x1713bd);});});}exports['CreateFaxQueueReport']=function(_0x2cf548){var _0xd68bb5=this;return new Promise(function(_0x26bafb,_0x4dab59){return db[_0x147c('0x13')][_0x147c('0x14')](_0x2cf548[_0x147c('0x15')],{'raw':_0x2cf548[_0x147c('0x16')]?_0x2cf548[_0x147c('0x16')][_0x147c('0x17')]===undefined?!![]:![]:!![]})[_0x147c('0x9')](function(_0x39a4dc){logger[_0x147c('0xa')](_0x147c('0x18'),_0x2cf548);logger[_0x147c('0xd')]('CreateFaxQueueReport',_0x2cf548,JSON[_0x147c('0xe')](_0x39a4dc));_0x26bafb(_0x39a4dc);})['catch'](function(_0x5a675f){logger['error'](_0x147c('0x18'),_0x5a675f[_0x147c('0x11')],_0x2cf548);_0x4dab59(_0xd68bb5[_0x147c('0xf')](0x1f4,_0x5a675f[_0x147c('0x11')]));});});};exports[_0x147c('0x19')]=function(_0x5c96ec){var _0x83fde=this;return new Promise(function(_0xe542f2,_0x5a2e34){return db[_0x147c('0x13')]['update'](_0x5c96ec[_0x147c('0x15')],{'raw':_0x5c96ec[_0x147c('0x16')]?_0x5c96ec[_0x147c('0x16')][_0x147c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c96ec[_0x147c('0x16')]?_0x5c96ec[_0x147c('0x16')][_0x147c('0x1a')]||null:null,'attributes':_0x5c96ec[_0x147c('0x16')]?_0x5c96ec[_0x147c('0x16')][_0x147c('0x1b')]||null:null,'limit':_0x5c96ec['options']?_0x5c96ec[_0x147c('0x16')][_0x147c('0x1c')]||null:null})[_0x147c('0x9')](function(_0xcb090a){logger['info'](_0x147c('0x19'),_0x5c96ec);logger[_0x147c('0xd')](_0x147c('0x19'),_0x5c96ec,JSON[_0x147c('0xe')](_0xcb090a));_0xe542f2(_0xcb090a);})[_0x147c('0x12')](function(_0xdb4808){logger[_0x147c('0xf')](_0x147c('0x19'),_0xdb4808[_0x147c('0x11')],_0x5c96ec);_0x5a2e34(_0x83fde[_0x147c('0xf')](0x1f4,_0xdb4808['message']));});});}; \ No newline at end of file +var _0x9f8a=['FaxQueueReport,\x20%s,\x20%s','request\x20sent','error','message','info','result','FaxQueueReport','options','raw','debug','stringify','catch','CreateFaxQueueReport','UpdateFaxQueueReport','body','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x2fa570,_0x19cf7f){var _0x3bb6ed=function(_0xaa9a27){while(--_0xaa9a27){_0x2fa570['push'](_0x2fa570['shift']());}};_0x3bb6ed(++_0x19cf7f);}(_0x9f8a,0x1a5));var _0xa9f8=function(_0x1eca85,_0x4cc100){_0x1eca85=_0x1eca85-0x0;var _0xe33ddc=_0x9f8a[_0x1eca85];return _0xe33ddc;};'use strict';var _=require(_0xa9f8('0x0'));var util=require(_0xa9f8('0x1'));var moment=require('moment');var BPromise=require(_0xa9f8('0x2'));var rs=require(_0xa9f8('0x3'));var fs=require('fs');var Redis=require(_0xa9f8('0x4'));var db=require(_0xa9f8('0x5'))['db'];var utils=require(_0xa9f8('0x6'));var logger=require(_0xa9f8('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa9f8('0x8'));var client=jayson[_0xa9f8('0x9')][_0xa9f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a3533,_0x11a5d8,_0xcf5d98){return new BPromise(function(_0x2c39c1,_0x3bd654){return client[_0xa9f8('0xb')](_0x2a3533,_0xcf5d98)[_0xa9f8('0xc')](function(_0x2d9403){logger['info'](_0xa9f8('0xd'),_0x11a5d8,_0xa9f8('0xe'));logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x11a5d8,_0xa9f8('0xe'),JSON['stringify'](_0x2d9403));if(_0x2d9403['error']){if(_0x2d9403[_0xa9f8('0xf')]['code']===0x1f4){logger[_0xa9f8('0xf')](_0xa9f8('0xd'),_0x11a5d8,_0x2d9403[_0xa9f8('0xf')][_0xa9f8('0x10')]);return _0x3bd654(_0x2d9403[_0xa9f8('0xf')][_0xa9f8('0x10')]);}logger[_0xa9f8('0xf')](_0xa9f8('0xd'),_0x11a5d8,_0x2d9403[_0xa9f8('0xf')][_0xa9f8('0x10')]);return _0x2c39c1(_0x2d9403[_0xa9f8('0xf')][_0xa9f8('0x10')]);}else{logger[_0xa9f8('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x11a5d8,'request\x20sent');_0x2c39c1(_0x2d9403[_0xa9f8('0x12')][_0xa9f8('0x10')]);}})['catch'](function(_0x20d23e){logger[_0xa9f8('0xf')](_0xa9f8('0xd'),_0x11a5d8,_0x20d23e);_0x3bd654(_0x20d23e);});});}exports['CreateFaxQueueReport']=function(_0x58dce2){var _0x5cf072=this;return new Promise(function(_0x132274,_0x55d32){return db[_0xa9f8('0x13')]['create'](_0x58dce2['body'],{'raw':_0x58dce2[_0xa9f8('0x14')]?_0x58dce2[_0xa9f8('0x14')][_0xa9f8('0x15')]===undefined?!![]:![]:!![]})[_0xa9f8('0xc')](function(_0x1aafe9){logger[_0xa9f8('0x11')]('CreateFaxQueueReport',_0x58dce2);logger[_0xa9f8('0x16')]('CreateFaxQueueReport',_0x58dce2,JSON[_0xa9f8('0x17')](_0x1aafe9));_0x132274(_0x1aafe9);})[_0xa9f8('0x18')](function(_0x3c4b4a){logger[_0xa9f8('0xf')](_0xa9f8('0x19'),_0x3c4b4a[_0xa9f8('0x10')],_0x58dce2);_0x55d32(_0x5cf072[_0xa9f8('0xf')](0x1f4,_0x3c4b4a['message']));});});};exports[_0xa9f8('0x1a')]=function(_0x2826d7){var _0x55f390=this;return new Promise(function(_0x1a9a44,_0x5687c7){return db['FaxQueueReport']['update'](_0x2826d7[_0xa9f8('0x1b')],{'raw':_0x2826d7[_0xa9f8('0x14')]?_0x2826d7[_0xa9f8('0x14')][_0xa9f8('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2826d7[_0xa9f8('0x14')]?_0x2826d7[_0xa9f8('0x14')][_0xa9f8('0x1c')]||null:null,'attributes':_0x2826d7[_0xa9f8('0x14')]?_0x2826d7[_0xa9f8('0x14')][_0xa9f8('0x1d')]||null:null,'limit':_0x2826d7[_0xa9f8('0x14')]?_0x2826d7[_0xa9f8('0x14')][_0xa9f8('0x1e')]||null:null})[_0xa9f8('0xc')](function(_0x277867){logger[_0xa9f8('0x11')]('UpdateFaxQueueReport',_0x2826d7);logger['debug']('UpdateFaxQueueReport',_0x2826d7,JSON[_0xa9f8('0x17')](_0x277867));_0x1a9a44(_0x277867);})['catch'](function(_0x4df650){logger[_0xa9f8('0xf')](_0xa9f8('0x1a'),_0x4df650[_0xa9f8('0x10')],_0x2826d7);_0x5687c7(_0x55f390[_0xa9f8('0xf')](0x1f4,_0x4df650[_0xa9f8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 9fc5368..d7ab94f 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 _0x52d4=['/describe','describe','show','post','create','/:id','update','exports','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get'];(function(_0x2f2764,_0x3b8b18){var _0x4694bb=function(_0x217e2b){while(--_0x217e2b){_0x2f2764['push'](_0x2f2764['shift']());}};_0x4694bb(++_0x3b8b18);}(_0x52d4,0x1c2));var _0x452d=function(_0x366195,_0x50da84){_0x366195=_0x366195-0x0;var _0xf37646=_0x52d4[_0x366195];return _0xf37646;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x452d('0x0'));var timeout=require('connect-timeout');var express=require(_0x452d('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x452d('0x2'));var interaction=require(_0x452d('0x3'));var config=require(_0x452d('0x4'));var controller=require(_0x452d('0x5'));router['get']('/',auth[_0x452d('0x6')](),controller[_0x452d('0x7')]);router[_0x452d('0x8')](_0x452d('0x9'),auth['isAuthenticated'](),controller[_0x452d('0xa')]);router[_0x452d('0x8')]('/:id',auth[_0x452d('0x6')](),controller[_0x452d('0xb')]);router[_0x452d('0xc')]('/',auth[_0x452d('0x6')](),controller[_0x452d('0xd')]);router['put'](_0x452d('0xe'),auth[_0x452d('0x6')](),controller[_0x452d('0xf')]);router['delete'](_0x452d('0xe'),auth[_0x452d('0x6')](),controller['destroy']);module[_0x452d('0x10')]=router; \ No newline at end of file +var _0xa806=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','/describe','isAuthenticated','describe','get','create','put','/:id','update','delete','destroy','multer'];(function(_0x2eb15c,_0x21c769){var _0x523ed4=function(_0x1e816b){while(--_0x1e816b){_0x2eb15c['push'](_0x2eb15c['shift']());}};_0x523ed4(++_0x21c769);}(_0xa806,0xbd));var _0x6a80=function(_0x13eec2,_0xe78b42){_0x13eec2=_0x13eec2-0x0;var _0x46c367=_0xa806[_0x13eec2];return _0x46c367;};'use strict';var multer=require(_0x6a80('0x0'));var util=require(_0x6a80('0x1'));var path=require(_0x6a80('0x2'));var timeout=require(_0x6a80('0x3'));var express=require(_0x6a80('0x4'));var router=express[_0x6a80('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6a80('0x6'));var config=require(_0x6a80('0x7'));var controller=require(_0x6a80('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6a80('0x9'),auth[_0x6a80('0xa')](),controller[_0x6a80('0xb')]);router[_0x6a80('0xc')]('/:id',auth[_0x6a80('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x6a80('0xd')]);router[_0x6a80('0xe')](_0x6a80('0xf'),auth[_0x6a80('0xa')](),controller[_0x6a80('0x10')]);router[_0x6a80('0x11')](_0x6a80('0xf'),auth[_0x6a80('0xa')](),controller[_0x6a80('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 0159ee3..5d54a7f 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x3b16e1,_0x3bda3e){var _0x311d1b=function(_0x2a979b){while(--_0x2a979b){_0x3b16e1['push'](_0x3b16e1['shift']());}};_0x311d1b(++_0x3bda3e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x9e90ce,_0x29be51){_0x9e90ce=_0x9e90ce-0x0;var _0xf98d7b=_0xb43b[_0x9e90ce];return _0xf98d7b;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x5a2e17,_0x2b8e2d){var _0x2464c6=function(_0x200577){while(--_0x200577){_0x5a2e17['push'](_0x5a2e17['shift']());}};_0x2464c6(++_0x2b8e2d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0xcb91[_0x386525];return _0x14d015;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index cd5e431..c272caa 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 _0x2462=['FaxTransferReport','includeAll','include','findAll','catch','show','create','body','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options'];(function(_0x1b31a1,_0x2a8b9a){var _0x26c40e=function(_0x2230a6){while(--_0x2230a6){_0x1b31a1['push'](_0x1b31a1['shift']());}};_0x26c40e(++_0x2a8b9a);}(_0x2462,0xe5));var _0x2246=function(_0x2ad146,_0x2c5f64){_0x2ad146=_0x2ad146-0x0;var _0x69b633=_0x2462[_0x2ad146];return _0x69b633;};'use strict';var emlformat=require(_0x2246('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2246('0x1'));var jsonpatch=require(_0x2246('0x2'));var rp=require(_0x2246('0x3'));var moment=require(_0x2246('0x4'));var BPromise=require(_0x2246('0x5'));var Mustache=require(_0x2246('0x6'));var util=require(_0x2246('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2246('0x8'));var ejs=require(_0x2246('0x9'));var fs=require('fs');var fs_extra=require(_0x2246('0xa'));var _=require(_0x2246('0xb'));var squel=require(_0x2246('0xc'));var crypto=require(_0x2246('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2246('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2246('0xf'));var Papa=require('papaparse');var Redis=require(_0x2246('0x10'));var authService=require(_0x2246('0x11'));var qs=require(_0x2246('0x12'));var as=require(_0x2246('0x13'));var hardwareService=require(_0x2246('0x14'));var logger=require('../../config/logger')(_0x2246('0x15'));var utils=require(_0x2246('0x16'));var config=require(_0x2246('0x17'));var licenseUtil=require(_0x2246('0x18'));var db=require(_0x2246('0x19'))['db'];function respondWithStatusCode(_0x55ab76,_0x896319){_0x896319=_0x896319||0xcc;return function(_0xdeed4e){if(_0xdeed4e){return _0x55ab76['sendStatus'](_0x896319);}return _0x55ab76[_0x2246('0x1a')](_0x896319)[_0x2246('0x1b')]();};}function respondWithResult(_0x1146bd,_0x2168cf){_0x2168cf=_0x2168cf||0xc8;return function(_0x85e111){if(_0x85e111){return _0x1146bd['status'](_0x2168cf)[_0x2246('0x1c')](_0x85e111);}};}function respondWithFilteredResult(_0x46475d,_0x4b1a4f){return function(_0x5f56ba){if(_0x5f56ba){var _0x96608f=typeof _0x4b1a4f['offset']===_0x2246('0x1d')&&typeof _0x4b1a4f[_0x2246('0x1e')]===_0x2246('0x1d');var _0x10715e=_0x5f56ba[_0x2246('0x1f')];var _0x18f790=_0x96608f?0x0:_0x4b1a4f[_0x2246('0x20')];var _0x278857=_0x96608f?_0x5f56ba[_0x2246('0x1f')]:_0x4b1a4f[_0x2246('0x20')]+_0x4b1a4f['limit'];var _0x11cb17;if(_0x278857>=_0x10715e){_0x278857=_0x10715e;_0x11cb17=0xc8;}else{_0x11cb17=0xce;}_0x46475d[_0x2246('0x1a')](_0x11cb17);return _0x46475d[_0x2246('0x21')](_0x2246('0x22'),_0x18f790+'-'+_0x278857+'/'+_0x10715e)['json'](_0x5f56ba);}return null;};}function patchUpdates(_0x128d88){return function(_0x5bd247){try{jsonpatch[_0x2246('0x23')](_0x5bd247,_0x128d88,!![]);}catch(_0x28b796){return BPromise[_0x2246('0x24')](_0x28b796);}return _0x5bd247['save']();};}function saveUpdates(_0x4ac370,_0x2014e0){return function(_0x292c6b){if(_0x292c6b){return _0x292c6b[_0x2246('0x25')](_0x4ac370)[_0x2246('0x26')](function(_0x3b758e){return _0x3b758e;});}return null;};}function removeEntity(_0x137955,_0x567560){return function(_0x58dad4){if(_0x58dad4){return _0x58dad4[_0x2246('0x27')]()['then'](function(){_0x137955[_0x2246('0x1a')](0xcc)[_0x2246('0x1b')]();});}};}function handleEntityNotFound(_0x228ac0,_0x5b78d7){return function(_0x39428b){if(!_0x39428b){_0x228ac0['sendStatus'](0x194);}return _0x39428b;};}function handleError(_0x560c6e,_0xd0162c){_0xd0162c=_0xd0162c||0x1f4;return function(_0x115373){logger['error'](_0x115373[_0x2246('0x28')]);if(_0x115373[_0x2246('0x29')]){delete _0x115373[_0x2246('0x29')];}_0x560c6e[_0x2246('0x1a')](_0xd0162c)['send'](_0x115373);};}exports[_0x2246('0x2a')]=function(_0x4ff02d,_0x42f821){var _0x197b30={},_0x2f372f={},_0x175d7c={'count':0x0,'rows':[]};var _0x2709bf=_[_0x2246('0x2b')](db['FaxTransferReport'][_0x2246('0x2c')],function(_0x1f3855){return{'name':_0x1f3855['fieldName'],'type':_0x1f3855[_0x2246('0x2d')]['key']};});_0x2f372f[_0x2246('0x2e')]=_[_0x2246('0x2b')](_0x2709bf,_0x2246('0x29'));_0x2f372f[_0x2246('0x2f')]=_[_0x2246('0x30')](_0x4ff02d['query']);_0x2f372f[_0x2246('0x31')]=_['intersection'](_0x2f372f[_0x2246('0x2e')],_0x2f372f[_0x2246('0x2f')]);_0x197b30[_0x2246('0x32')]=_[_0x2246('0x33')](_0x2f372f[_0x2246('0x2e')],qs[_0x2246('0x34')](_0x4ff02d[_0x2246('0x2f')][_0x2246('0x34')]));_0x197b30[_0x2246('0x32')]=_0x197b30[_0x2246('0x32')][_0x2246('0x35')]?_0x197b30[_0x2246('0x32')]:_0x2f372f[_0x2246('0x2e')];if(!_0x4ff02d[_0x2246('0x2f')][_0x2246('0x36')](_0x2246('0x37'))){_0x197b30[_0x2246('0x1e')]=qs[_0x2246('0x1e')](_0x4ff02d[_0x2246('0x2f')][_0x2246('0x1e')]);_0x197b30[_0x2246('0x20')]=qs[_0x2246('0x20')](_0x4ff02d['query'][_0x2246('0x20')]);}_0x197b30[_0x2246('0x38')]=qs[_0x2246('0x39')](_0x4ff02d['query'][_0x2246('0x39')]);_0x197b30[_0x2246('0x3a')]=qs[_0x2246('0x31')](_['pick'](_0x4ff02d[_0x2246('0x2f')],_0x2f372f['filters']),_0x2709bf);if(_0x4ff02d[_0x2246('0x2f')][_0x2246('0x3b')]){_0x197b30[_0x2246('0x3a')]=_['merge'](_0x197b30[_0x2246('0x3a')],{'$or':_[_0x2246('0x2b')](_0x2709bf,function(_0x243a85){if(_0x243a85[_0x2246('0x2d')]!==_0x2246('0x3c')){var _0x265f27={};_0x265f27[_0x243a85[_0x2246('0x29')]]={'$like':'%'+_0x4ff02d[_0x2246('0x2f')][_0x2246('0x3b')]+'%'};return _0x265f27;}})});}_0x197b30=_[_0x2246('0x3d')]({},_0x197b30,_0x4ff02d[_0x2246('0x3e')]);var _0x18111c={'where':_0x197b30['where']};return db[_0x2246('0x3f')][_0x2246('0x1f')](_0x18111c)['then'](function(_0x507473){_0x175d7c['count']=_0x507473;if(_0x4ff02d['query'][_0x2246('0x40')]){_0x197b30[_0x2246('0x41')]=[{'all':!![]}];}return db[_0x2246('0x3f')][_0x2246('0x42')](_0x197b30);})[_0x2246('0x26')](function(_0x597ec3){_0x175d7c['rows']=_0x597ec3;return _0x175d7c;})['then'](respondWithFilteredResult(_0x42f821,_0x197b30))[_0x2246('0x43')](handleError(_0x42f821,null));};exports[_0x2246('0x44')]=function(_0x365017,_0x151297){var _0x241b2f={'raw':!![],'where':{'id':_0x365017['params']['id']}},_0x39e7a5={};_0x39e7a5[_0x2246('0x2e')]=_[_0x2246('0x30')](db['FaxTransferReport'][_0x2246('0x2c')]);_0x39e7a5[_0x2246('0x2f')]=_[_0x2246('0x30')](_0x365017[_0x2246('0x2f')]);_0x39e7a5['filters']=_[_0x2246('0x33')](_0x39e7a5[_0x2246('0x2e')],_0x39e7a5['query']);_0x241b2f['attributes']=_['intersection'](_0x39e7a5[_0x2246('0x2e')],qs[_0x2246('0x34')](_0x365017[_0x2246('0x2f')][_0x2246('0x34')]));_0x241b2f[_0x2246('0x32')]=_0x241b2f['attributes'][_0x2246('0x35')]?_0x241b2f[_0x2246('0x32')]:_0x39e7a5[_0x2246('0x2e')];if(_0x365017['query'][_0x2246('0x40')]){_0x241b2f[_0x2246('0x41')]=[{'all':!![]}];}_0x241b2f=_[_0x2246('0x3d')]({},_0x241b2f,_0x365017[_0x2246('0x3e')]);return db[_0x2246('0x3f')]['find'](_0x241b2f)[_0x2246('0x26')](handleEntityNotFound(_0x151297,null))[_0x2246('0x26')](respondWithResult(_0x151297,null))[_0x2246('0x43')](handleError(_0x151297,null));};exports[_0x2246('0x45')]=function(_0x3776f8,_0x5ccf99){return db['FaxTransferReport'][_0x2246('0x45')](_0x3776f8[_0x2246('0x46')],{})['then'](respondWithResult(_0x5ccf99,0xc9))['catch'](handleError(_0x5ccf99,null));};exports['update']=function(_0xa9baed,_0x1ba852){if(_0xa9baed[_0x2246('0x46')]['id']){delete _0xa9baed['body']['id'];}return db[_0x2246('0x3f')][_0x2246('0x47')]({'where':{'id':_0xa9baed[_0x2246('0x48')]['id']}})[_0x2246('0x26')](handleEntityNotFound(_0x1ba852,null))[_0x2246('0x26')](saveUpdates(_0xa9baed['body'],null))[_0x2246('0x26')](respondWithResult(_0x1ba852,null))[_0x2246('0x43')](handleError(_0x1ba852,null));};exports[_0x2246('0x27')]=function(_0x5ea8db,_0x10db2b){return db['FaxTransferReport'][_0x2246('0x47')]({'where':{'id':_0x5ea8db[_0x2246('0x48')]['id']}})[_0x2246('0x26')](handleEntityNotFound(_0x10db2b,null))[_0x2246('0x26')](removeEntity(_0x10db2b,null))[_0x2246('0x43')](handleError(_0x10db2b,null));};exports['describe']=function(_0x114481,_0x350fa5){return db[_0x2246('0x3f')]['describe']()[_0x2246('0x26')](respondWithResult(_0x350fa5,null))[_0x2246('0x43')](handleError(_0x350fa5,null));}; \ No newline at end of file +var _0x18eb=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','FaxTransferReport','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','body','update','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','limit','undefined','set','json','apply','reject','save','destroy','then','error','stack','name','index','map','fieldName','type','key','model','query','keys'];(function(_0x1dda48,_0x54d6f7){var _0x7caaf4=function(_0x2b6b1a){while(--_0x2b6b1a){_0x1dda48['push'](_0x1dda48['shift']());}};_0x7caaf4(++_0x54d6f7);}(_0x18eb,0x1c0));var _0xb18e=function(_0x2b815a,_0x32a0da){_0x2b815a=_0x2b815a-0x0;var _0x4e9126=_0x18eb[_0x2b815a];return _0x4e9126;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb18e('0x0'));var zipdir=require(_0xb18e('0x1'));var jsonpatch=require(_0xb18e('0x2'));var rp=require('request-promise');var moment=require(_0xb18e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb18e('0x4'));var util=require('util');var path=require(_0xb18e('0x5'));var sox=require(_0xb18e('0x6'));var csv=require(_0xb18e('0x7'));var ejs=require(_0xb18e('0x8'));var fs=require('fs');var fs_extra=require(_0xb18e('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb18e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb18e('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb18e('0xc'));var Papa=require(_0xb18e('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb18e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb18e('0xf'))(_0xb18e('0x10'));var utils=require(_0xb18e('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28042c,_0xa9df83){_0xa9df83=_0xa9df83||0xcc;return function(_0x7606b6){if(_0x7606b6){return _0x28042c[_0xb18e('0x12')](_0xa9df83);}return _0x28042c[_0xb18e('0x13')](_0xa9df83)[_0xb18e('0x14')]();};}function respondWithResult(_0x4a0af2,_0x1921da){_0x1921da=_0x1921da||0xc8;return function(_0x5b9b41){if(_0x5b9b41){return _0x4a0af2[_0xb18e('0x13')](_0x1921da)['json'](_0x5b9b41);}};}function respondWithFilteredResult(_0x5174ee,_0x4ad034){return function(_0x1f171e){if(_0x1f171e){var _0x16bbfc=typeof _0x4ad034[_0xb18e('0x15')]==='undefined'&&typeof _0x4ad034[_0xb18e('0x16')]===_0xb18e('0x17');var _0x5cae87=_0x1f171e['count'];var _0x439369=_0x16bbfc?0x0:_0x4ad034['offset'];var _0x46d577=_0x16bbfc?_0x1f171e['count']:_0x4ad034['offset']+_0x4ad034['limit'];var _0x35408b;if(_0x46d577>=_0x5cae87){_0x46d577=_0x5cae87;_0x35408b=0xc8;}else{_0x35408b=0xce;}_0x5174ee[_0xb18e('0x13')](_0x35408b);return _0x5174ee[_0xb18e('0x18')]('Content-Range',_0x439369+'-'+_0x46d577+'/'+_0x5cae87)[_0xb18e('0x19')](_0x1f171e);}return null;};}function patchUpdates(_0x2d6099){return function(_0x525470){try{jsonpatch[_0xb18e('0x1a')](_0x525470,_0x2d6099,!![]);}catch(_0x528ea0){return BPromise[_0xb18e('0x1b')](_0x528ea0);}return _0x525470[_0xb18e('0x1c')]();};}function saveUpdates(_0x3a87a2,_0xcff0a4){return function(_0x39cbb0){if(_0x39cbb0){return _0x39cbb0['update'](_0x3a87a2)['then'](function(_0x3e17e0){return _0x3e17e0;});}return null;};}function removeEntity(_0x351a79,_0x3f9032){return function(_0x27f96b){if(_0x27f96b){return _0x27f96b[_0xb18e('0x1d')]()[_0xb18e('0x1e')](function(){_0x351a79[_0xb18e('0x13')](0xcc)[_0xb18e('0x14')]();});}};}function handleEntityNotFound(_0x355a2d,_0x5d98cf){return function(_0x3cd6cd){if(!_0x3cd6cd){_0x355a2d['sendStatus'](0x194);}return _0x3cd6cd;};}function handleError(_0x7a9a31,_0x2c9c5f){_0x2c9c5f=_0x2c9c5f||0x1f4;return function(_0x13b80c){logger[_0xb18e('0x1f')](_0x13b80c[_0xb18e('0x20')]);if(_0x13b80c['name']){delete _0x13b80c[_0xb18e('0x21')];}_0x7a9a31[_0xb18e('0x13')](_0x2c9c5f)['send'](_0x13b80c);};}exports[_0xb18e('0x22')]=function(_0x155b47,_0x4a3349){var _0x194eaa={},_0x3a9bf1={},_0x526358={'count':0x0,'rows':[]};var _0x2caaa5=_[_0xb18e('0x23')](db['FaxTransferReport']['rawAttributes'],function(_0x8cfeaf){return{'name':_0x8cfeaf[_0xb18e('0x24')],'type':_0x8cfeaf[_0xb18e('0x25')][_0xb18e('0x26')]};});_0x3a9bf1[_0xb18e('0x27')]=_[_0xb18e('0x23')](_0x2caaa5,'name');_0x3a9bf1[_0xb18e('0x28')]=_[_0xb18e('0x29')](_0x155b47['query']);_0x3a9bf1[_0xb18e('0x2a')]=_[_0xb18e('0x2b')](_0x3a9bf1['model'],_0x3a9bf1[_0xb18e('0x28')]);_0x194eaa['attributes']=_['intersection'](_0x3a9bf1['model'],qs[_0xb18e('0x2c')](_0x155b47['query'][_0xb18e('0x2c')]));_0x194eaa['attributes']=_0x194eaa[_0xb18e('0x2d')][_0xb18e('0x2e')]?_0x194eaa[_0xb18e('0x2d')]:_0x3a9bf1[_0xb18e('0x27')];if(!_0x155b47[_0xb18e('0x28')][_0xb18e('0x2f')](_0xb18e('0x30'))){_0x194eaa[_0xb18e('0x16')]=qs[_0xb18e('0x16')](_0x155b47[_0xb18e('0x28')][_0xb18e('0x16')]);_0x194eaa[_0xb18e('0x15')]=qs[_0xb18e('0x15')](_0x155b47[_0xb18e('0x28')][_0xb18e('0x15')]);}_0x194eaa[_0xb18e('0x31')]=qs[_0xb18e('0x32')](_0x155b47[_0xb18e('0x28')][_0xb18e('0x32')]);_0x194eaa[_0xb18e('0x33')]=qs[_0xb18e('0x2a')](_['pick'](_0x155b47[_0xb18e('0x28')],_0x3a9bf1[_0xb18e('0x2a')]),_0x2caaa5);if(_0x155b47[_0xb18e('0x28')]['filter']){_0x194eaa['where']=_[_0xb18e('0x34')](_0x194eaa[_0xb18e('0x33')],{'$or':_['map'](_0x2caaa5,function(_0x487c6f){if(_0x487c6f['type']!==_0xb18e('0x35')){var _0x31b24d={};_0x31b24d[_0x487c6f['name']]={'$like':'%'+_0x155b47[_0xb18e('0x28')][_0xb18e('0x36')]+'%'};return _0x31b24d;}})});}_0x194eaa=_[_0xb18e('0x34')]({},_0x194eaa,_0x155b47[_0xb18e('0x37')]);var _0x5ad7b2={'where':_0x194eaa['where']};return db[_0xb18e('0x38')]['count'](_0x5ad7b2)[_0xb18e('0x1e')](function(_0x19e60e){_0x526358[_0xb18e('0x39')]=_0x19e60e;if(_0x155b47[_0xb18e('0x28')][_0xb18e('0x3a')]){_0x194eaa['include']=[{'all':!![]}];}return db[_0xb18e('0x38')][_0xb18e('0x3b')](_0x194eaa);})['then'](function(_0x3fd859){_0x526358[_0xb18e('0x3c')]=_0x3fd859;return _0x526358;})[_0xb18e('0x1e')](respondWithFilteredResult(_0x4a3349,_0x194eaa))[_0xb18e('0x3d')](handleError(_0x4a3349,null));};exports[_0xb18e('0x3e')]=function(_0x35a1ff,_0x293636){var _0xb1604e={'raw':!![],'where':{'id':_0x35a1ff[_0xb18e('0x3f')]['id']}},_0x404008={};_0x404008[_0xb18e('0x27')]=_[_0xb18e('0x29')](db[_0xb18e('0x38')][_0xb18e('0x40')]);_0x404008[_0xb18e('0x28')]=_[_0xb18e('0x29')](_0x35a1ff['query']);_0x404008['filters']=_[_0xb18e('0x2b')](_0x404008['model'],_0x404008[_0xb18e('0x28')]);_0xb1604e[_0xb18e('0x2d')]=_['intersection'](_0x404008[_0xb18e('0x27')],qs[_0xb18e('0x2c')](_0x35a1ff['query'][_0xb18e('0x2c')]));_0xb1604e['attributes']=_0xb1604e['attributes'][_0xb18e('0x2e')]?_0xb1604e[_0xb18e('0x2d')]:_0x404008[_0xb18e('0x27')];if(_0x35a1ff[_0xb18e('0x28')][_0xb18e('0x3a')]){_0xb1604e[_0xb18e('0x41')]=[{'all':!![]}];}_0xb1604e=_['merge']({},_0xb1604e,_0x35a1ff[_0xb18e('0x37')]);return db[_0xb18e('0x38')][_0xb18e('0x42')](_0xb1604e)[_0xb18e('0x1e')](handleEntityNotFound(_0x293636,null))[_0xb18e('0x1e')](respondWithResult(_0x293636,null))[_0xb18e('0x3d')](handleError(_0x293636,null));};exports['create']=function(_0x1ae5d8,_0x590ed9){return db[_0xb18e('0x38')]['create'](_0x1ae5d8[_0xb18e('0x43')],{})['then'](respondWithResult(_0x590ed9,0xc9))[_0xb18e('0x3d')](handleError(_0x590ed9,null));};exports[_0xb18e('0x44')]=function(_0x1955a3,_0x51176f){if(_0x1955a3[_0xb18e('0x43')]['id']){delete _0x1955a3[_0xb18e('0x43')]['id'];}return db['FaxTransferReport'][_0xb18e('0x42')]({'where':{'id':_0x1955a3[_0xb18e('0x3f')]['id']}})[_0xb18e('0x1e')](handleEntityNotFound(_0x51176f,null))[_0xb18e('0x1e')](saveUpdates(_0x1955a3[_0xb18e('0x43')],null))['then'](respondWithResult(_0x51176f,null))[_0xb18e('0x3d')](handleError(_0x51176f,null));};exports['destroy']=function(_0x59cd08,_0x483acc){return db[_0xb18e('0x38')][_0xb18e('0x42')]({'where':{'id':_0x59cd08[_0xb18e('0x3f')]['id']}})[_0xb18e('0x1e')](handleEntityNotFound(_0x483acc,null))[_0xb18e('0x1e')](removeEntity(_0x483acc,null))[_0xb18e('0x3d')](handleError(_0x483acc,null));};exports['describe']=function(_0x581b58,_0x3672df){return db[_0xb18e('0x38')][_0xb18e('0x45')]()[_0xb18e('0x1e')](respondWithResult(_0x3672df,null))['catch'](handleError(_0x3672df,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 53f4c98..662feee 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 _0xa062=['../../config/environment','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x226a55,_0x139e1b){var _0x168497=function(_0x5e50ac){while(--_0x5e50ac){_0x226a55['push'](_0x226a55['shift']());}};_0x168497(++_0x139e1b);}(_0xa062,0x101));var _0x2a06=function(_0x3bc1f0,_0x23ed37){_0x3bc1f0=_0x3bc1f0-0x0;var _0x2c77b0=_0xa062[_0x3bc1f0];return _0x2c77b0;};'use strict';var _=require(_0x2a06('0x0'));var util=require(_0x2a06('0x1'));var logger=require(_0x2a06('0x2'))('api');var moment=require(_0x2a06('0x3'));var BPromise=require(_0x2a06('0x4'));var rp=require(_0x2a06('0x5'));var fs=require('fs');var path=require(_0x2a06('0x6'));var rimraf=require('rimraf');var config=require(_0x2a06('0x7'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x1376ba,_0x1ba42f){return _0x1376ba[_0x2a06('0x8')](_0x2a06('0x9'),attributes,{'tableName':_0x2a06('0xa'),'paranoid':![],'indexes':[{'name':_0x2a06('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x49b9=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util'];(function(_0x39c3ce,_0x3de24f){var _0x2f8aab=function(_0x47423e){while(--_0x47423e){_0x39c3ce['push'](_0x39c3ce['shift']());}};_0x2f8aab(++_0x3de24f);}(_0x49b9,0x1da));var _0x949b=function(_0x51fef3,_0x20358f){_0x51fef3=_0x51fef3-0x0;var _0xd1db16=_0x49b9[_0x51fef3];return _0xd1db16;};'use strict';var _=require(_0x949b('0x0'));var util=require(_0x949b('0x1'));var logger=require(_0x949b('0x2'))(_0x949b('0x3'));var moment=require(_0x949b('0x4'));var BPromise=require(_0x949b('0x5'));var rp=require(_0x949b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x949b('0x7'));var config=require(_0x949b('0x8'));var attributes=require(_0x949b('0x9'));module[_0x949b('0xa')]=function(_0x261abb,_0xcddbbf){return _0x261abb[_0x949b('0xb')](_0x949b('0xc'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x949b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 5844e3d..4fc471d 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 _0x77f6=['client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x1f34e2,_0x57d81c){var _0x34600c=function(_0x2dd22a){while(--_0x2dd22a){_0x1f34e2['push'](_0x1f34e2['shift']());}};_0x34600c(++_0x57d81c);}(_0x77f6,0xf3));var _0x677f=function(_0x1a981e,_0x1f24bb){_0x1a981e=_0x1a981e-0x0;var _0x40211f=_0x77f6[_0x1a981e];return _0x40211f;};'use strict';var _=require(_0x677f('0x0'));var util=require(_0x677f('0x1'));var moment=require('moment');var BPromise=require(_0x677f('0x2'));var rs=require(_0x677f('0x3'));var fs=require('fs');var Redis=require(_0x677f('0x4'));var db=require(_0x677f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x677f('0x6'));var config=require(_0x677f('0x7'));var jayson=require(_0x677f('0x8'));var client=jayson[_0x677f('0x9')][_0x677f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bf69a,_0x122af0,_0x22b0e5){return new BPromise(function(_0x2c4062,_0x52bcae){return client['request'](_0x4bf69a,_0x22b0e5)[_0x677f('0xb')](function(_0x930c8b){logger[_0x677f('0xc')](_0x677f('0xd'),_0x122af0,_0x677f('0xe'));logger[_0x677f('0xf')](_0x677f('0x10'),_0x122af0,_0x677f('0xe'),JSON[_0x677f('0x11')](_0x930c8b));if(_0x930c8b[_0x677f('0x12')]){if(_0x930c8b[_0x677f('0x12')]['code']===0x1f4){logger[_0x677f('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x122af0,_0x930c8b[_0x677f('0x12')]['message']);return _0x52bcae(_0x930c8b[_0x677f('0x12')][_0x677f('0x13')]);}logger[_0x677f('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x122af0,_0x930c8b[_0x677f('0x12')][_0x677f('0x13')]);return _0x2c4062(_0x930c8b[_0x677f('0x12')][_0x677f('0x13')]);}else{logger[_0x677f('0xc')](_0x677f('0xd'),_0x122af0,'request\x20sent');_0x2c4062(_0x930c8b['result'][_0x677f('0x13')]);}})[_0x677f('0x14')](function(_0x453963){logger[_0x677f('0x12')](_0x677f('0xd'),_0x122af0,_0x453963);_0x52bcae(_0x453963);});});} \ No newline at end of file +var _0x0e9e=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0x0e9e,0x70));var _0xe0e9=function(_0x2fe2a0,_0x4cb972){_0x2fe2a0=_0x2fe2a0-0x0;var _0x4a59f9=_0x0e9e[_0x2fe2a0];return _0x4a59f9;};'use strict';var _=require(_0xe0e9('0x0'));var util=require(_0xe0e9('0x1'));var moment=require('moment');var BPromise=require(_0xe0e9('0x2'));var rs=require(_0xe0e9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe0e9('0x4'))['db'];var utils=require(_0xe0e9('0x5'));var logger=require(_0xe0e9('0x6'))(_0xe0e9('0x7'));var config=require(_0xe0e9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe0e9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1689ba,_0x4bf197,_0x550464){return new BPromise(function(_0x4b6328,_0x326cf6){return client[_0xe0e9('0xa')](_0x1689ba,_0x550464)[_0xe0e9('0xb')](function(_0x19337a){logger[_0xe0e9('0xc')](_0xe0e9('0xd'),_0x4bf197,_0xe0e9('0xe'));logger[_0xe0e9('0xf')](_0xe0e9('0x10'),_0x4bf197,_0xe0e9('0xe'),JSON[_0xe0e9('0x11')](_0x19337a));if(_0x19337a['error']){if(_0x19337a[_0xe0e9('0x12')][_0xe0e9('0x13')]===0x1f4){logger[_0xe0e9('0x12')](_0xe0e9('0xd'),_0x4bf197,_0x19337a['error']['message']);return _0x326cf6(_0x19337a['error'][_0xe0e9('0x14')]);}logger[_0xe0e9('0x12')](_0xe0e9('0xd'),_0x4bf197,_0x19337a[_0xe0e9('0x12')][_0xe0e9('0x14')]);return _0x4b6328(_0x19337a[_0xe0e9('0x12')][_0xe0e9('0x14')]);}else{logger[_0xe0e9('0xc')](_0xe0e9('0xd'),_0x4bf197,_0xe0e9('0xe'));_0x4b6328(_0x19337a[_0xe0e9('0x15')][_0xe0e9('0x14')]);}})[_0xe0e9('0x16')](function(_0x239b97){logger[_0xe0e9('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x4bf197,_0x239b97);_0x326cf6(_0x239b97);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index ab806a7..e9771e1 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 _0xa7fb=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','update','delete','destroy','exports','multer','express','Router'];(function(_0x1b58b8,_0x3e1c2a){var _0x479502=function(_0x3af2ae){while(--_0x3af2ae){_0x1b58b8['push'](_0x1b58b8['shift']());}};_0x479502(++_0x3e1c2a);}(_0xa7fb,0x162));var _0xba7f=function(_0x11bff5,_0x25af29){_0x11bff5=_0x11bff5-0x0;var _0x847029=_0xa7fb[_0x11bff5];return _0x847029;};'use strict';var multer=require(_0xba7f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xba7f('0x1'));var router=express[_0xba7f('0x2')]();var fs_extra=require(_0xba7f('0x3'));var auth=require(_0xba7f('0x4'));var interaction=require(_0xba7f('0x5'));var config=require(_0xba7f('0x6'));var controller=require(_0xba7f('0x7'));router[_0xba7f('0x8')]('/',auth[_0xba7f('0x9')](),controller[_0xba7f('0xa')]);router[_0xba7f('0x8')](_0xba7f('0xb'),auth[_0xba7f('0x9')](),controller[_0xba7f('0xc')]);router['get']('/:id',auth[_0xba7f('0x9')](),controller[_0xba7f('0xd')]);router[_0xba7f('0xe')]('/',auth[_0xba7f('0x9')](),controller[_0xba7f('0xf')]);router['put'](_0xba7f('0x10'),auth[_0xba7f('0x9')](),controller[_0xba7f('0x11')]);router[_0xba7f('0x12')](_0xba7f('0x10'),auth['isAuthenticated'](),controller[_0xba7f('0x13')]);module[_0xba7f('0x14')]=router; \ No newline at end of file +var _0x3f16=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','destroy'];(function(_0x3a765c,_0x5ca0af){var _0x1661f9=function(_0x2ab26b){while(--_0x2ab26b){_0x3a765c['push'](_0x3a765c['shift']());}};_0x1661f9(++_0x5ca0af);}(_0x3f16,0x1e4));var _0x63f1=function(_0x31aaeb,_0x6194ef){_0x31aaeb=_0x31aaeb-0x0;var _0x2e97da=_0x3f16[_0x31aaeb];return _0x2e97da;};'use strict';var multer=require(_0x63f1('0x0'));var util=require('util');var path=require(_0x63f1('0x1'));var timeout=require(_0x63f1('0x2'));var express=require(_0x63f1('0x3'));var router=express[_0x63f1('0x4')]();var fs_extra=require(_0x63f1('0x5'));var auth=require(_0x63f1('0x6'));var interaction=require(_0x63f1('0x7'));var config=require(_0x63f1('0x8'));var controller=require(_0x63f1('0x9'));router['get']('/',auth[_0x63f1('0xa')](),controller[_0x63f1('0xb')]);router[_0x63f1('0xc')]('/describe',auth['isAuthenticated'](),controller[_0x63f1('0xd')]);router[_0x63f1('0xc')](_0x63f1('0xe'),auth[_0x63f1('0xa')](),controller[_0x63f1('0xf')]);router[_0x63f1('0x10')]('/',auth[_0x63f1('0xa')](),controller[_0x63f1('0x11')]);router[_0x63f1('0x12')](_0x63f1('0xe'),auth[_0x63f1('0xa')](),controller['update']);router['delete'](_0x63f1('0xe'),auth[_0x63f1('0xa')](),controller[_0x63f1('0x13')]);module[_0x63f1('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index d440ae9..de32dac 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 _0xf5f4=['util','path','connect-timeout','Router','../../components/auth/service','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','post','create','put','update','delete','destroy','exports'];(function(_0x4379be,_0x19d175){var _0x30e4e7=function(_0x587343){while(--_0x587343){_0x4379be['push'](_0x4379be['shift']());}};_0x30e4e7(++_0x19d175);}(_0xf5f4,0x1a2));var _0x4f5f=function(_0x292c07,_0x53023f){_0x292c07=_0x292c07-0x0;var _0x8e9d3b=_0xf5f4[_0x292c07];return _0x8e9d3b;};'use strict';var multer=require('multer');var util=require(_0x4f5f('0x0'));var path=require(_0x4f5f('0x1'));var timeout=require(_0x4f5f('0x2'));var express=require('express');var router=express[_0x4f5f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4f5f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4f5f('0x5'));router[_0x4f5f('0x6')]('/',auth[_0x4f5f('0x7')](),controller['index']);router[_0x4f5f('0x6')](_0x4f5f('0x8'),auth[_0x4f5f('0x7')](),controller[_0x4f5f('0x9')]);router[_0x4f5f('0x6')](_0x4f5f('0xa'),auth[_0x4f5f('0x7')](),controller['getConfigurations']);router[_0x4f5f('0x6')](_0x4f5f('0xb'),auth[_0x4f5f('0x7')](),controller['getFields']);router[_0x4f5f('0xc')]('/',auth[_0x4f5f('0x7')](),controller[_0x4f5f('0xd')]);router[_0x4f5f('0xc')]('/:id/configurations',auth[_0x4f5f('0x7')](),controller['addConfiguration']);router[_0x4f5f('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x4f5f('0xf')]);router[_0x4f5f('0x10')](_0x4f5f('0x8'),auth[_0x4f5f('0x7')](),controller[_0x4f5f('0x11')]);module[_0x4f5f('0x12')]=router; \ No newline at end of file +var _0x9b27=['getFields','post','addConfiguration','put','/:id','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x32c3ce,_0x3ba144){var _0x30ec2a=function(_0x4a9b58){while(--_0x4a9b58){_0x32c3ce['push'](_0x32c3ce['shift']());}};_0x30ec2a(++_0x3ba144);}(_0x9b27,0x14e));var _0x79b2=function(_0x2cfc8c,_0x5472df){_0x2cfc8c=_0x2cfc8c-0x0;var _0x1de813=_0x9b27[_0x2cfc8c];return _0x1de813;};'use strict';var multer=require('multer');var util=require(_0x79b2('0x0'));var path=require(_0x79b2('0x1'));var timeout=require('connect-timeout');var express=require(_0x79b2('0x2'));var router=express[_0x79b2('0x3')]();var fs_extra=require(_0x79b2('0x4'));var auth=require(_0x79b2('0x5'));var interaction=require(_0x79b2('0x6'));var config=require(_0x79b2('0x7'));var controller=require(_0x79b2('0x8'));router[_0x79b2('0x9')]('/',auth[_0x79b2('0xa')](),controller[_0x79b2('0xb')]);router['get']('/:id',auth[_0x79b2('0xa')](),controller[_0x79b2('0xc')]);router[_0x79b2('0x9')](_0x79b2('0xd'),auth['isAuthenticated'](),controller[_0x79b2('0xe')]);router[_0x79b2('0x9')](_0x79b2('0xf'),auth[_0x79b2('0xa')](),controller[_0x79b2('0x10')]);router[_0x79b2('0x11')]('/',auth[_0x79b2('0xa')](),controller['create']);router['post'](_0x79b2('0xd'),auth[_0x79b2('0xa')](),controller[_0x79b2('0x12')]);router[_0x79b2('0x13')](_0x79b2('0x14'),auth['isAuthenticated'](),controller[_0x79b2('0x15')]);router[_0x79b2('0x16')](_0x79b2('0x14'),auth[_0x79b2('0xa')](),controller[_0x79b2('0x17')]);module[_0x79b2('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 8c9b351..5800197 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 _0x4908=['newTab','sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x5cc561,_0x200cf6){var _0x2af04b=function(_0x4005b9){while(--_0x4005b9){_0x5cc561['push'](_0x5cc561['shift']());}};_0x2af04b(++_0x200cf6);}(_0x4908,0xd3));var _0x8490=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x4908[_0x50007c];return _0x5c1ec7;};'use strict';var Sequelize=require(_0x8490('0x0'));module[_0x8490('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8490('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8490('0x2')]},'authType':{'type':Sequelize[_0x8490('0x3')](_0x8490('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x8490('0x2')]},'consumerKey':{'type':Sequelize[_0x8490('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x8490('0x2')]},'serverUrl':{'type':Sequelize[_0x8490('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8490('0x5'),_0x8490('0x6')),'defaultValue':_0x8490('0x5')}}; \ No newline at end of file +var _0xc353=['newTab','integrationTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x2d8eac,_0x4d2f89){var _0x4af6a7=function(_0x1519da){while(--_0x1519da){_0x2d8eac['push'](_0x2d8eac['shift']());}};_0x4af6a7(++_0x4d2f89);}(_0xc353,0x191));var _0x3c35=function(_0x185b1f,_0x2181c6){_0x185b1f=_0x185b1f-0x0;var _0x33e964=_0xc353[_0x185b1f];return _0x33e964;};'use strict';var Sequelize=require(_0x3c35('0x0'));module[_0x3c35('0x1')]={'name':{'type':Sequelize[_0x3c35('0x2')]},'description':{'type':Sequelize[_0x3c35('0x2')]},'username':{'type':Sequelize[_0x3c35('0x2')]},'remoteUri':{'type':Sequelize[_0x3c35('0x2')]},'authType':{'type':Sequelize[_0x3c35('0x3')]('basic'),'defaultValue':_0x3c35('0x4')},'password':{'type':Sequelize[_0x3c35('0x2')]},'consumerKey':{'type':Sequelize[_0x3c35('0x2')]},'consumerSecret':{'type':Sequelize[_0x3c35('0x2')]},'token':{'type':Sequelize[_0x3c35('0x2')]},'tokenSecret':{'type':Sequelize[_0x3c35('0x2')]},'serverUrl':{'type':Sequelize[_0x3c35('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3c35('0x3')]('integrationTab',_0x3c35('0x5')),'defaultValue':_0x3c35('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index f8b826c..a9ac469 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 _0x5f9d=['zip-dir','fast-json-patch','moment','bluebird','util','sox','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','Content-Range','save','update','then','end','error','name','send','index','rawAttributes','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','DeskAccount','include','findAll','rows','show','params','includeAll','find','catch','create','body','destroy','getConfigurations','filter','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','username','tokenSecret','slice','substring','lastIndexOf','format','application/json','basic','headers','Authorization','%s:%s','password','toString','concat','_embedded','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf'];(function(_0x3ade01,_0x127952){var _0xdab88f=function(_0x1058d3){while(--_0x1058d3){_0x3ade01['push'](_0x3ade01['shift']());}};_0xdab88f(++_0x127952);}(_0x5f9d,0xd6));var _0xd5f9=function(_0x2eb4fa,_0x5a8f32){_0x2eb4fa=_0x2eb4fa-0x0;var _0x50fe88=_0x5f9d[_0x2eb4fa];return _0x50fe88;};'use strict';var emlformat=require(_0xd5f9('0x0'));var rimraf=require(_0xd5f9('0x1'));var zipdir=require(_0xd5f9('0x2'));var jsonpatch=require(_0xd5f9('0x3'));var rp=require('request-promise');var moment=require(_0xd5f9('0x4'));var BPromise=require(_0xd5f9('0x5'));var Mustache=require('mustache');var util=require(_0xd5f9('0x6'));var path=require('path');var sox=require(_0xd5f9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd5f9('0x8'));var _=require(_0xd5f9('0x9'));var squel=require(_0xd5f9('0xa'));var crypto=require('crypto');var jsforce=require(_0xd5f9('0xb'));var deskjs=require(_0xd5f9('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd5f9('0xd'));var Papa=require(_0xd5f9('0xe'));var Redis=require(_0xd5f9('0xf'));var authService=require(_0xd5f9('0x10'));var qs=require(_0xd5f9('0x11'));var as=require(_0xd5f9('0x12'));var hardwareService=require(_0xd5f9('0x13'));var logger=require(_0xd5f9('0x14'))('api');var utils=require(_0xd5f9('0x15'));var config=require(_0xd5f9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd5f9('0x17'))['db'];var integrations=require(_0xd5f9('0x18'));function respondWithStatusCode(_0x519354,_0x1f37d9){_0x1f37d9=_0x1f37d9||0xcc;return function(_0x3167d2){if(_0x3167d2){return _0x519354[_0xd5f9('0x19')](_0x1f37d9);}return _0x519354[_0xd5f9('0x1a')](_0x1f37d9)['end']();};}function respondWithResult(_0x2a778d,_0x176094){_0x176094=_0x176094||0xc8;return function(_0x296986){if(_0x296986){return _0x2a778d[_0xd5f9('0x1a')](_0x176094)[_0xd5f9('0x1b')](_0x296986);}};}function respondWithFilteredResult(_0x2476cc,_0x35047b){return function(_0x2ecd91){if(_0x2ecd91){var _0x512100=typeof _0x35047b[_0xd5f9('0x1c')]===_0xd5f9('0x1d')&&typeof _0x35047b['limit']===_0xd5f9('0x1d');var _0x3096c4=_0x2ecd91[_0xd5f9('0x1e')];var _0xb75d3e=_0x512100?0x0:_0x35047b[_0xd5f9('0x1c')];var _0x4ad591=_0x512100?_0x2ecd91[_0xd5f9('0x1e')]:_0x35047b[_0xd5f9('0x1c')]+_0x35047b[_0xd5f9('0x1f')];var _0x37ba78;if(_0x4ad591>=_0x3096c4){_0x4ad591=_0x3096c4;_0x37ba78=0xc8;}else{_0x37ba78=0xce;}_0x2476cc['status'](_0x37ba78);return _0x2476cc['set'](_0xd5f9('0x20'),_0xb75d3e+'-'+_0x4ad591+'/'+_0x3096c4)[_0xd5f9('0x1b')](_0x2ecd91);}return null;};}function patchUpdates(_0x55ac46){return function(_0x25921f){try{jsonpatch['apply'](_0x25921f,_0x55ac46,!![]);}catch(_0x1b615f){return BPromise['reject'](_0x1b615f);}return _0x25921f[_0xd5f9('0x21')]();};}function saveUpdates(_0x50e698,_0x5da4c6){return function(_0x3d9f78){if(_0x3d9f78){return _0x3d9f78[_0xd5f9('0x22')](_0x50e698)[_0xd5f9('0x23')](function(_0x2b173f){return _0x2b173f;});}return null;};}function removeEntity(_0xbe8363,_0x3b00e4){return function(_0x4fe1f8){if(_0x4fe1f8){return _0x4fe1f8['destroy']()['then'](function(){_0xbe8363[_0xd5f9('0x1a')](0xcc)[_0xd5f9('0x24')]();});}};}function handleEntityNotFound(_0x249cff,_0x4ddbb9){return function(_0x4881a4){if(!_0x4881a4){_0x249cff[_0xd5f9('0x19')](0x194);}return _0x4881a4;};}function handleError(_0x1df055,_0x28f18e){_0x28f18e=_0x28f18e||0x1f4;return function(_0x15fe45){logger[_0xd5f9('0x25')](_0x15fe45['stack']);if(_0x15fe45[_0xd5f9('0x26')]){delete _0x15fe45[_0xd5f9('0x26')];}_0x1df055[_0xd5f9('0x1a')](_0x28f18e)[_0xd5f9('0x27')](_0x15fe45);};}exports[_0xd5f9('0x28')]=function(_0x301011,_0xd33fcd){var _0x5e2264={},_0x2a284f={},_0x21b9b6={'count':0x0,'rows':[]};var _0x5a2fb9=_['map'](db['DeskAccount'][_0xd5f9('0x29')],function(_0x2c9760){return{'name':_0x2c9760[_0xd5f9('0x2a')],'type':_0x2c9760[_0xd5f9('0x2b')]['key']};});_0x2a284f['model']=_[_0xd5f9('0x2c')](_0x5a2fb9,'name');_0x2a284f[_0xd5f9('0x2d')]=_[_0xd5f9('0x2e')](_0x301011['query']);_0x2a284f['filters']=_[_0xd5f9('0x2f')](_0x2a284f[_0xd5f9('0x30')],_0x2a284f[_0xd5f9('0x2d')]);_0x5e2264[_0xd5f9('0x31')]=_[_0xd5f9('0x2f')](_0x2a284f['model'],qs[_0xd5f9('0x32')](_0x301011[_0xd5f9('0x2d')][_0xd5f9('0x32')]));_0x5e2264[_0xd5f9('0x31')]=_0x5e2264[_0xd5f9('0x31')][_0xd5f9('0x33')]?_0x5e2264[_0xd5f9('0x31')]:_0x2a284f['model'];if(!_0x301011[_0xd5f9('0x2d')]['hasOwnProperty'](_0xd5f9('0x34'))){_0x5e2264[_0xd5f9('0x1f')]=qs[_0xd5f9('0x1f')](_0x301011['query'][_0xd5f9('0x1f')]);_0x5e2264[_0xd5f9('0x1c')]=qs['offset'](_0x301011[_0xd5f9('0x2d')]['offset']);}_0x5e2264[_0xd5f9('0x35')]=qs[_0xd5f9('0x36')](_0x301011[_0xd5f9('0x2d')]['sort']);_0x5e2264[_0xd5f9('0x37')]=qs[_0xd5f9('0x38')](_[_0xd5f9('0x39')](_0x301011[_0xd5f9('0x2d')],_0x2a284f[_0xd5f9('0x38')]),_0x5a2fb9);if(_0x301011['query']['filter']){_0x5e2264[_0xd5f9('0x37')]=_[_0xd5f9('0x3a')](_0x5e2264['where'],{'$or':_[_0xd5f9('0x2c')](_0x5a2fb9,function(_0x1f5d5e){if(_0x1f5d5e[_0xd5f9('0x2b')]!==_0xd5f9('0x3b')){var _0x124fdb={};_0x124fdb[_0x1f5d5e['name']]={'$like':'%'+_0x301011[_0xd5f9('0x2d')]['filter']+'%'};return _0x124fdb;}})});}_0x5e2264=_['merge']({},_0x5e2264,_0x301011[_0xd5f9('0x3c')]);var _0xa6453c={'where':_0x5e2264[_0xd5f9('0x37')]};return db[_0xd5f9('0x3d')][_0xd5f9('0x1e')](_0xa6453c)[_0xd5f9('0x23')](function(_0x553e7d){_0x21b9b6['count']=_0x553e7d;if(_0x301011[_0xd5f9('0x2d')]['includeAll']){_0x5e2264[_0xd5f9('0x3e')]=[{'all':!![]}];}return db[_0xd5f9('0x3d')][_0xd5f9('0x3f')](_0x5e2264);})[_0xd5f9('0x23')](function(_0x2bcdc7){_0x21b9b6[_0xd5f9('0x40')]=_0x2bcdc7;return _0x21b9b6;})['then'](respondWithFilteredResult(_0xd33fcd,_0x5e2264))['catch'](handleError(_0xd33fcd,null));};exports[_0xd5f9('0x41')]=function(_0x235783,_0x1fd800){var _0x304f0c={'raw':![],'where':{'id':_0x235783[_0xd5f9('0x42')]['id']}},_0xdabf02={};_0xdabf02[_0xd5f9('0x30')]=_[_0xd5f9('0x2e')](db['DeskAccount'][_0xd5f9('0x29')]);_0xdabf02[_0xd5f9('0x2d')]=_[_0xd5f9('0x2e')](_0x235783[_0xd5f9('0x2d')]);_0xdabf02[_0xd5f9('0x38')]=_[_0xd5f9('0x2f')](_0xdabf02[_0xd5f9('0x30')],_0xdabf02[_0xd5f9('0x2d')]);_0x304f0c[_0xd5f9('0x31')]=_[_0xd5f9('0x2f')](_0xdabf02[_0xd5f9('0x30')],qs['fields'](_0x235783[_0xd5f9('0x2d')][_0xd5f9('0x32')]));_0x304f0c[_0xd5f9('0x31')]=_0x304f0c['attributes'][_0xd5f9('0x33')]?_0x304f0c[_0xd5f9('0x31')]:_0xdabf02['model'];if(_0x235783['query'][_0xd5f9('0x43')]){_0x304f0c[_0xd5f9('0x3e')]=[{'all':!![]}];}_0x304f0c=_[_0xd5f9('0x3a')]({},_0x304f0c,_0x235783[_0xd5f9('0x3c')]);return db[_0xd5f9('0x3d')][_0xd5f9('0x44')](_0x304f0c)[_0xd5f9('0x23')](handleEntityNotFound(_0x1fd800,null))[_0xd5f9('0x23')](respondWithResult(_0x1fd800,null))[_0xd5f9('0x45')](handleError(_0x1fd800,null));};exports[_0xd5f9('0x46')]=function(_0x52f921,_0x3b3ae2){return db[_0xd5f9('0x3d')][_0xd5f9('0x46')](_0x52f921[_0xd5f9('0x47')],{})[_0xd5f9('0x23')](respondWithResult(_0x3b3ae2,0xc9))[_0xd5f9('0x45')](handleError(_0x3b3ae2,null));};exports[_0xd5f9('0x22')]=function(_0x15a4e3,_0x3bf1d8){if(_0x15a4e3['body']['id']){delete _0x15a4e3[_0xd5f9('0x47')]['id'];}return db['DeskAccount'][_0xd5f9('0x44')]({'where':{'id':_0x15a4e3[_0xd5f9('0x42')]['id']}})[_0xd5f9('0x23')](handleEntityNotFound(_0x3bf1d8,null))[_0xd5f9('0x23')](saveUpdates(_0x15a4e3[_0xd5f9('0x47')],null))[_0xd5f9('0x23')](respondWithResult(_0x3bf1d8,null))[_0xd5f9('0x45')](handleError(_0x3bf1d8,null));};exports[_0xd5f9('0x48')]=function(_0xad9adf,_0x3064f6){return db[_0xd5f9('0x3d')][_0xd5f9('0x44')]({'where':{'id':_0xad9adf['params']['id']}})['then'](handleEntityNotFound(_0x3064f6,null))[_0xd5f9('0x23')](removeEntity(_0x3064f6,null))[_0xd5f9('0x45')](handleError(_0x3064f6,null));};exports[_0xd5f9('0x49')]=function(_0xa9b6b8,_0x449b74,_0x5cf782){var _0x518982={};var _0x229f9c={};var _0x1e9841;var _0x14d5ac;return db['DeskAccount']['findOne']({'where':{'id':_0xa9b6b8['params']['id']}})[_0xd5f9('0x23')](handleEntityNotFound(_0x449b74,null))[_0xd5f9('0x23')](function(_0x33b8a1){if(_0x33b8a1){_0x1e9841=_0x33b8a1;_0x229f9c[_0xd5f9('0x30')]=_[_0xd5f9('0x2e')](db['DeskConfiguration'][_0xd5f9('0x29')]);_0x229f9c[_0xd5f9('0x2d')]=_[_0xd5f9('0x2e')](_0xa9b6b8[_0xd5f9('0x2d')]);_0x229f9c[_0xd5f9('0x38')]=_[_0xd5f9('0x2f')](_0x229f9c[_0xd5f9('0x30')],_0x229f9c['query']);_0x518982[_0xd5f9('0x31')]=_[_0xd5f9('0x2f')](_0x229f9c[_0xd5f9('0x30')],qs[_0xd5f9('0x32')](_0xa9b6b8['query'][_0xd5f9('0x32')]));_0x518982['attributes']=_0x518982[_0xd5f9('0x31')][_0xd5f9('0x33')]?_0x518982['attributes']:_0x229f9c[_0xd5f9('0x30')];_0x518982[_0xd5f9('0x35')]=qs[_0xd5f9('0x36')](_0xa9b6b8[_0xd5f9('0x2d')][_0xd5f9('0x36')]);_0x518982[_0xd5f9('0x37')]=qs[_0xd5f9('0x38')](_['pick'](_0xa9b6b8[_0xd5f9('0x2d')],_0x229f9c['filters']));if(_0xa9b6b8[_0xd5f9('0x2d')]['filter']){_0x518982[_0xd5f9('0x37')]=_[_0xd5f9('0x3a')](_0x518982[_0xd5f9('0x37')],{'$or':_[_0xd5f9('0x2c')](_0x518982[_0xd5f9('0x31')],function(_0x4c1722){var _0x596b59={};_0x596b59[_0x4c1722]={'$like':'%'+_0xa9b6b8[_0xd5f9('0x2d')][_0xd5f9('0x4a')]+'%'};return _0x596b59;})});}_0x518982=_[_0xd5f9('0x3a')]({},_0x518982,_0xa9b6b8[_0xd5f9('0x3c')]);return _0x1e9841[_0xd5f9('0x49')](_0x518982);}})[_0xd5f9('0x23')](function(_0x582c8a){if(_0x582c8a){_0x14d5ac=_0x582c8a[_0xd5f9('0x33')];if(!_0xa9b6b8['query'][_0xd5f9('0x4b')](_0xd5f9('0x34'))){_0x518982[_0xd5f9('0x1f')]=qs[_0xd5f9('0x1f')](_0xa9b6b8[_0xd5f9('0x2d')]['limit']);_0x518982[_0xd5f9('0x1c')]=qs[_0xd5f9('0x1c')](_0xa9b6b8[_0xd5f9('0x2d')][_0xd5f9('0x1c')]);}return _0x1e9841[_0xd5f9('0x49')](_0x518982);}})['then'](function(_0x149938){if(_0x149938){return _0x149938?{'count':_0x14d5ac,'rows':_0x149938}:null;}})[_0xd5f9('0x23')](respondWithResult(_0x449b74,null))[_0xd5f9('0x45')](handleError(_0x449b74,null));};exports[_0xd5f9('0x4c')]=function(_0x27a48a,_0x3f9000,_0x1e3ea6){if(_0x27a48a[_0xd5f9('0x47')]['id']){delete _0x27a48a[_0xd5f9('0x47')]['id'];}return db[_0xd5f9('0x3d')][_0xd5f9('0x4d')]({'where':{'id':_0x27a48a['params']['id']}})[_0xd5f9('0x23')](handleEntityNotFound(_0x3f9000,null))[_0xd5f9('0x23')](function(_0x41927d){if(_0x41927d){_0x27a48a[_0xd5f9('0x47')][_0xd5f9('0x4e')]=_0x41927d['id'];_0x27a48a[_0xd5f9('0x47')][_0xd5f9('0x4f')]=integrations['getSubjects'](_0x27a48a[_0xd5f9('0x47')]['channel'],_0x27a48a['body'][_0xd5f9('0x2b')]);_0x27a48a[_0xd5f9('0x47')]['Descriptions']=integrations[_0xd5f9('0x50')](_0x27a48a[_0xd5f9('0x47')]['channel'],_0x27a48a[_0xd5f9('0x47')][_0xd5f9('0x2b')]);return db[_0xd5f9('0x51')][_0xd5f9('0x46')](_0x27a48a['body'],{'include':[{'model':db['DeskField'],'as':_0xd5f9('0x4f')},{'model':db[_0xd5f9('0x52')],'as':'Descriptions'}]});}return null;})[_0xd5f9('0x23')](respondWithResult(_0x3f9000,null))[_0xd5f9('0x45')](handleError(_0x3f9000,null));};exports[_0xd5f9('0x53')]=function(_0x3a5488,_0x30a8c6,_0x150c15){var _0x316d0f=[{'name':_0xd5f9('0x54'),'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 _0x1b2b73='';return db[_0xd5f9('0x3d')][_0xd5f9('0x4d')]({'where':{'id':_0x3a5488[_0xd5f9('0x42')]['id']},'attributes':['id',_0xd5f9('0x55'),_0xd5f9('0x56'),_0xd5f9('0x57'),'password','consumerKey','consumerSecret','token',_0xd5f9('0x58')]})[_0xd5f9('0x23')](handleEntityNotFound(_0x30a8c6,null))[_0xd5f9('0x23')](function(_0x316cb2){if(_0x316cb2){_0x1b2b73=_0x316cb2[_0xd5f9('0x55')];var _0x3e3edb=_0x1b2b73[_0xd5f9('0x59')](-0x1);if(_0x3e3edb==='/'){_0x1b2b73=_0x1b2b73[_0xd5f9('0x5a')](0x0,_0x1b2b73[_0xd5f9('0x5b')](_0x3e3edb));}var _0x23fc81={'method':'GET','uri':util[_0xd5f9('0x5c')]('%s/custom_fields',_0x1b2b73),'headers':{'Content-Type':_0xd5f9('0x5d'),'Accept':'application/json'},'json':!![]};if(_0x316cb2[_0xd5f9('0x56')]===_0xd5f9('0x5e')){_0x23fc81[_0xd5f9('0x5f')][_0xd5f9('0x60')]=util['format']('Basic\x20%s',new Buffer(util[_0xd5f9('0x5c')](_0xd5f9('0x61'),_0x316cb2[_0xd5f9('0x57')],_0x316cb2[_0xd5f9('0x62')]))[_0xd5f9('0x63')]('base64'));}return rp(_0x23fc81)[_0xd5f9('0x23')](function(_0x42ba78){return _0x316d0f[_0xd5f9('0x64')](_[_0xd5f9('0x2c')](_0x42ba78[_0xd5f9('0x65')][_0xd5f9('0x66')],function(_0x26d38d){return{'id':_0x26d38d['name'],'name':_0x26d38d[_0xd5f9('0x26')],'type':_0x26d38d[_0xd5f9('0x2b')],'active':_0x26d38d[_0xd5f9('0x67')],'label':_0x26d38d['label'],'custom':!![]};}));});}})[_0xd5f9('0x23')](function(_0x3e697f){return{'count':_0x3e697f[_0xd5f9('0x33')],'rows':_0x3e697f};})[_0xd5f9('0x23')](respondWithResult(_0x30a8c6,null))['catch'](function(_0x4fc116){var _0x5983c0=_0x3a5488[_0xd5f9('0x2d')][_0xd5f9('0x68')]?0x1f4:_0x4fc116[_0xd5f9('0x69')]||0x1f4;logger['error'](_0xd5f9('0x6a'),_0xd5f9('0x53'),_0x5983c0,JSON[_0xd5f9('0x6b')](_0x4fc116));delete _0x4fc116[_0xd5f9('0x26')];if(_0x5983c0===0x191){_0x5983c0=0x190;}_0x30a8c6[_0xd5f9('0x1a')](_0x5983c0)[_0xd5f9('0x27')](_0x3a5488[_0xd5f9('0x2d')][_0xd5f9('0x68')]?{'message':'Wrong\x20credentials','statusCode':_0x4fc116[_0xd5f9('0x69')]}:_0x4fc116);});}; \ No newline at end of file +var _0x5af0=['error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','limit','count','set','json','apply','reject','save','update','then','destroy','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','map','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','options','find','create','body','getConfigurations','findOne','DeskConfiguration','filter','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','DeskField','getFields','priority','remoteUri','username','password','consumerSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','authType','basic','headers','Authorization','format','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','test','statusCode'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x5af0,0x1bf));var _0x05af=function(_0x158c79,_0x412a71){_0x158c79=_0x158c79-0x0;var _0x334515=_0x5af0[_0x158c79];return _0x334515;};'use strict';var emlformat=require(_0x05af('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x05af('0x1'));var jsonpatch=require(_0x05af('0x2'));var rp=require(_0x05af('0x3'));var moment=require('moment');var BPromise=require(_0x05af('0x4'));var Mustache=require('mustache');var util=require(_0x05af('0x5'));var path=require(_0x05af('0x6'));var sox=require(_0x05af('0x7'));var csv=require(_0x05af('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x05af('0x9'));var jsforce=require(_0x05af('0xa'));var deskjs=require(_0x05af('0xb'));var toCsv=require('to-csv');var querystring=require(_0x05af('0xc'));var Papa=require(_0x05af('0xd'));var Redis=require('ioredis');var authService=require(_0x05af('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x05af('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x05af('0x10'))(_0x05af('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x05af('0x12'));var db=require(_0x05af('0x13'))['db'];var integrations=require(_0x05af('0x14'));function respondWithStatusCode(_0x2a64d4,_0xaa0a97){_0xaa0a97=_0xaa0a97||0xcc;return function(_0x182f1b){if(_0x182f1b){return _0x2a64d4[_0x05af('0x15')](_0xaa0a97);}return _0x2a64d4['status'](_0xaa0a97)[_0x05af('0x16')]();};}function respondWithResult(_0x45ce39,_0x38a78f){_0x38a78f=_0x38a78f||0xc8;return function(_0x86e89){if(_0x86e89){return _0x45ce39[_0x05af('0x17')](_0x38a78f)['json'](_0x86e89);}};}function respondWithFilteredResult(_0x29281a,_0x3184f8){return function(_0x2655ca){if(_0x2655ca){var _0x112e74=typeof _0x3184f8[_0x05af('0x18')]==='undefined'&&typeof _0x3184f8[_0x05af('0x19')]==='undefined';var _0x1cbefe=_0x2655ca[_0x05af('0x1a')];var _0x3794d3=_0x112e74?0x0:_0x3184f8[_0x05af('0x18')];var _0x1bd2a8=_0x112e74?_0x2655ca['count']:_0x3184f8[_0x05af('0x18')]+_0x3184f8[_0x05af('0x19')];var _0x19d879;if(_0x1bd2a8>=_0x1cbefe){_0x1bd2a8=_0x1cbefe;_0x19d879=0xc8;}else{_0x19d879=0xce;}_0x29281a['status'](_0x19d879);return _0x29281a[_0x05af('0x1b')]('Content-Range',_0x3794d3+'-'+_0x1bd2a8+'/'+_0x1cbefe)[_0x05af('0x1c')](_0x2655ca);}return null;};}function patchUpdates(_0x3afee3){return function(_0x41f425){try{jsonpatch[_0x05af('0x1d')](_0x41f425,_0x3afee3,!![]);}catch(_0x143d3d){return BPromise[_0x05af('0x1e')](_0x143d3d);}return _0x41f425[_0x05af('0x1f')]();};}function saveUpdates(_0x432ba2,_0x18e489){return function(_0x5ae239){if(_0x5ae239){return _0x5ae239[_0x05af('0x20')](_0x432ba2)[_0x05af('0x21')](function(_0x50076a){return _0x50076a;});}return null;};}function removeEntity(_0x1922ed,_0x193a08){return function(_0x4bb479){if(_0x4bb479){return _0x4bb479[_0x05af('0x22')]()[_0x05af('0x21')](function(){_0x1922ed[_0x05af('0x17')](0xcc)[_0x05af('0x16')]();});}};}function handleEntityNotFound(_0x3fc1fd,_0x3b1718){return function(_0x54524c){if(!_0x54524c){_0x3fc1fd['sendStatus'](0x194);}return _0x54524c;};}function handleError(_0x3a8463,_0x921bb2){_0x921bb2=_0x921bb2||0x1f4;return function(_0x2016b4){logger['error'](_0x2016b4[_0x05af('0x23')]);if(_0x2016b4['name']){delete _0x2016b4[_0x05af('0x24')];}_0x3a8463[_0x05af('0x17')](_0x921bb2)[_0x05af('0x25')](_0x2016b4);};}exports[_0x05af('0x26')]=function(_0x2e0457,_0x10e6b6){var _0x4ac892={},_0xe154d5={},_0x4509a9={'count':0x0,'rows':[]};var _0x1701a1=_['map'](db[_0x05af('0x27')][_0x05af('0x28')],function(_0x12fbf6){return{'name':_0x12fbf6[_0x05af('0x29')],'type':_0x12fbf6[_0x05af('0x2a')][_0x05af('0x2b')]};});_0xe154d5['model']=_['map'](_0x1701a1,'name');_0xe154d5[_0x05af('0x2c')]=_[_0x05af('0x2d')](_0x2e0457['query']);_0xe154d5[_0x05af('0x2e')]=_[_0x05af('0x2f')](_0xe154d5[_0x05af('0x30')],_0xe154d5[_0x05af('0x2c')]);_0x4ac892[_0x05af('0x31')]=_[_0x05af('0x2f')](_0xe154d5[_0x05af('0x30')],qs['fields'](_0x2e0457[_0x05af('0x2c')][_0x05af('0x32')]));_0x4ac892[_0x05af('0x31')]=_0x4ac892[_0x05af('0x31')][_0x05af('0x33')]?_0x4ac892['attributes']:_0xe154d5['model'];if(!_0x2e0457['query']['hasOwnProperty'](_0x05af('0x34'))){_0x4ac892['limit']=qs[_0x05af('0x19')](_0x2e0457[_0x05af('0x2c')][_0x05af('0x19')]);_0x4ac892[_0x05af('0x18')]=qs[_0x05af('0x18')](_0x2e0457[_0x05af('0x2c')][_0x05af('0x18')]);}_0x4ac892[_0x05af('0x35')]=qs[_0x05af('0x36')](_0x2e0457[_0x05af('0x2c')][_0x05af('0x36')]);_0x4ac892[_0x05af('0x37')]=qs[_0x05af('0x2e')](_[_0x05af('0x38')](_0x2e0457[_0x05af('0x2c')],_0xe154d5[_0x05af('0x2e')]),_0x1701a1);if(_0x2e0457[_0x05af('0x2c')]['filter']){_0x4ac892[_0x05af('0x37')]=_['merge'](_0x4ac892[_0x05af('0x37')],{'$or':_[_0x05af('0x39')](_0x1701a1,function(_0x1825f2){if(_0x1825f2['type']!==_0x05af('0x3a')){var _0x1abecc={};_0x1abecc[_0x1825f2['name']]={'$like':'%'+_0x2e0457['query']['filter']+'%'};return _0x1abecc;}})});}_0x4ac892=_[_0x05af('0x3b')]({},_0x4ac892,_0x2e0457['options']);var _0x21bcc3={'where':_0x4ac892[_0x05af('0x37')]};return db[_0x05af('0x27')][_0x05af('0x1a')](_0x21bcc3)[_0x05af('0x21')](function(_0xbf068b){_0x4509a9[_0x05af('0x1a')]=_0xbf068b;if(_0x2e0457['query'][_0x05af('0x3c')]){_0x4ac892['include']=[{'all':!![]}];}return db[_0x05af('0x27')][_0x05af('0x3d')](_0x4ac892);})[_0x05af('0x21')](function(_0x15374){_0x4509a9[_0x05af('0x3e')]=_0x15374;return _0x4509a9;})[_0x05af('0x21')](respondWithFilteredResult(_0x10e6b6,_0x4ac892))[_0x05af('0x3f')](handleError(_0x10e6b6,null));};exports[_0x05af('0x40')]=function(_0xf59619,_0x4b47fa){var _0x1307cf={'raw':![],'where':{'id':_0xf59619[_0x05af('0x41')]['id']}},_0xf1ee64={};_0xf1ee64[_0x05af('0x30')]=_[_0x05af('0x2d')](db['DeskAccount'][_0x05af('0x28')]);_0xf1ee64['query']=_[_0x05af('0x2d')](_0xf59619[_0x05af('0x2c')]);_0xf1ee64[_0x05af('0x2e')]=_[_0x05af('0x2f')](_0xf1ee64['model'],_0xf1ee64[_0x05af('0x2c')]);_0x1307cf[_0x05af('0x31')]=_['intersection'](_0xf1ee64['model'],qs[_0x05af('0x32')](_0xf59619['query'][_0x05af('0x32')]));_0x1307cf[_0x05af('0x31')]=_0x1307cf[_0x05af('0x31')][_0x05af('0x33')]?_0x1307cf['attributes']:_0xf1ee64[_0x05af('0x30')];if(_0xf59619['query'][_0x05af('0x3c')]){_0x1307cf['include']=[{'all':!![]}];}_0x1307cf=_[_0x05af('0x3b')]({},_0x1307cf,_0xf59619[_0x05af('0x42')]);return db[_0x05af('0x27')][_0x05af('0x43')](_0x1307cf)[_0x05af('0x21')](handleEntityNotFound(_0x4b47fa,null))[_0x05af('0x21')](respondWithResult(_0x4b47fa,null))[_0x05af('0x3f')](handleError(_0x4b47fa,null));};exports[_0x05af('0x44')]=function(_0x389a46,_0x1e61e7){return db[_0x05af('0x27')]['create'](_0x389a46[_0x05af('0x45')],{})[_0x05af('0x21')](respondWithResult(_0x1e61e7,0xc9))[_0x05af('0x3f')](handleError(_0x1e61e7,null));};exports[_0x05af('0x20')]=function(_0x15d171,_0x5daa79){if(_0x15d171[_0x05af('0x45')]['id']){delete _0x15d171[_0x05af('0x45')]['id'];}return db[_0x05af('0x27')][_0x05af('0x43')]({'where':{'id':_0x15d171[_0x05af('0x41')]['id']}})['then'](handleEntityNotFound(_0x5daa79,null))[_0x05af('0x21')](saveUpdates(_0x15d171[_0x05af('0x45')],null))[_0x05af('0x21')](respondWithResult(_0x5daa79,null))[_0x05af('0x3f')](handleError(_0x5daa79,null));};exports[_0x05af('0x22')]=function(_0x51822a,_0x2feb5a){return db['DeskAccount'][_0x05af('0x43')]({'where':{'id':_0x51822a[_0x05af('0x41')]['id']}})[_0x05af('0x21')](handleEntityNotFound(_0x2feb5a,null))[_0x05af('0x21')](removeEntity(_0x2feb5a,null))[_0x05af('0x3f')](handleError(_0x2feb5a,null));};exports[_0x05af('0x46')]=function(_0x282a83,_0x34326b,_0x12252a){var _0x5c1b85={};var _0x1652b5={};var _0x591e79;var _0x26df28;return db[_0x05af('0x27')][_0x05af('0x47')]({'where':{'id':_0x282a83[_0x05af('0x41')]['id']}})[_0x05af('0x21')](handleEntityNotFound(_0x34326b,null))[_0x05af('0x21')](function(_0x32e68f){if(_0x32e68f){_0x591e79=_0x32e68f;_0x1652b5[_0x05af('0x30')]=_['keys'](db[_0x05af('0x48')][_0x05af('0x28')]);_0x1652b5['query']=_[_0x05af('0x2d')](_0x282a83['query']);_0x1652b5[_0x05af('0x2e')]=_[_0x05af('0x2f')](_0x1652b5[_0x05af('0x30')],_0x1652b5[_0x05af('0x2c')]);_0x5c1b85[_0x05af('0x31')]=_[_0x05af('0x2f')](_0x1652b5[_0x05af('0x30')],qs[_0x05af('0x32')](_0x282a83[_0x05af('0x2c')][_0x05af('0x32')]));_0x5c1b85[_0x05af('0x31')]=_0x5c1b85[_0x05af('0x31')]['length']?_0x5c1b85[_0x05af('0x31')]:_0x1652b5[_0x05af('0x30')];_0x5c1b85[_0x05af('0x35')]=qs[_0x05af('0x36')](_0x282a83[_0x05af('0x2c')][_0x05af('0x36')]);_0x5c1b85[_0x05af('0x37')]=qs[_0x05af('0x2e')](_[_0x05af('0x38')](_0x282a83['query'],_0x1652b5['filters']));if(_0x282a83[_0x05af('0x2c')][_0x05af('0x49')]){_0x5c1b85['where']=_[_0x05af('0x3b')](_0x5c1b85[_0x05af('0x37')],{'$or':_[_0x05af('0x39')](_0x5c1b85['attributes'],function(_0x24fbc5){var _0x1fa2e1={};_0x1fa2e1[_0x24fbc5]={'$like':'%'+_0x282a83[_0x05af('0x2c')]['filter']+'%'};return _0x1fa2e1;})});}_0x5c1b85=_[_0x05af('0x3b')]({},_0x5c1b85,_0x282a83['options']);return _0x591e79[_0x05af('0x46')](_0x5c1b85);}})[_0x05af('0x21')](function(_0xd7b3f9){if(_0xd7b3f9){_0x26df28=_0xd7b3f9[_0x05af('0x33')];if(!_0x282a83['query']['hasOwnProperty'](_0x05af('0x34'))){_0x5c1b85[_0x05af('0x19')]=qs['limit'](_0x282a83[_0x05af('0x2c')][_0x05af('0x19')]);_0x5c1b85[_0x05af('0x18')]=qs['offset'](_0x282a83[_0x05af('0x2c')][_0x05af('0x18')]);}return _0x591e79['getConfigurations'](_0x5c1b85);}})[_0x05af('0x21')](function(_0x245d5f){if(_0x245d5f){return _0x245d5f?{'count':_0x26df28,'rows':_0x245d5f}:null;}})['then'](respondWithResult(_0x34326b,null))[_0x05af('0x3f')](handleError(_0x34326b,null));};exports[_0x05af('0x4a')]=function(_0x1f152d,_0x27760e,_0x1c94ee){if(_0x1f152d[_0x05af('0x45')]['id']){delete _0x1f152d[_0x05af('0x45')]['id'];}return db[_0x05af('0x27')][_0x05af('0x47')]({'where':{'id':_0x1f152d[_0x05af('0x41')]['id']}})['then'](handleEntityNotFound(_0x27760e,null))[_0x05af('0x21')](function(_0x260ab4){if(_0x260ab4){_0x1f152d[_0x05af('0x45')][_0x05af('0x4b')]=_0x260ab4['id'];_0x1f152d[_0x05af('0x45')][_0x05af('0x4c')]=integrations[_0x05af('0x4d')](_0x1f152d[_0x05af('0x45')]['channel'],_0x1f152d[_0x05af('0x45')][_0x05af('0x2a')]);_0x1f152d[_0x05af('0x45')][_0x05af('0x4e')]=integrations['getDescriptions'](_0x1f152d[_0x05af('0x45')][_0x05af('0x4f')],_0x1f152d[_0x05af('0x45')]['type']);return db[_0x05af('0x48')][_0x05af('0x44')](_0x1f152d[_0x05af('0x45')],{'include':[{'model':db[_0x05af('0x50')],'as':_0x05af('0x4c')},{'model':db[_0x05af('0x50')],'as':'Descriptions'}]});}return null;})[_0x05af('0x21')](respondWithResult(_0x27760e,null))[_0x05af('0x3f')](handleError(_0x27760e,null));};exports[_0x05af('0x51')]=function(_0x7e5e61,_0x3177db,_0x2455ba){var _0x1da380=[{'name':'priority','label':_0x05af('0x52'),'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 _0x22c4bd='';return db[_0x05af('0x27')][_0x05af('0x47')]({'where':{'id':_0x7e5e61['params']['id']},'attributes':['id',_0x05af('0x53'),'authType',_0x05af('0x54'),_0x05af('0x55'),'consumerKey',_0x05af('0x56'),'token','tokenSecret']})[_0x05af('0x21')](handleEntityNotFound(_0x3177db,null))[_0x05af('0x21')](function(_0x128f89){if(_0x128f89){_0x22c4bd=_0x128f89[_0x05af('0x53')];var _0x484260=_0x22c4bd[_0x05af('0x57')](-0x1);if(_0x484260==='/'){_0x22c4bd=_0x22c4bd[_0x05af('0x58')](0x0,_0x22c4bd[_0x05af('0x59')](_0x484260));}var _0x5d8248={'method':_0x05af('0x5a'),'uri':util['format'](_0x05af('0x5b'),_0x22c4bd),'headers':{'Content-Type':_0x05af('0x5c'),'Accept':_0x05af('0x5c')},'json':!![]};if(_0x128f89[_0x05af('0x5d')]===_0x05af('0x5e')){_0x5d8248[_0x05af('0x5f')][_0x05af('0x60')]=util[_0x05af('0x61')](_0x05af('0x62'),new Buffer(util[_0x05af('0x61')](_0x05af('0x63'),_0x128f89[_0x05af('0x54')],_0x128f89[_0x05af('0x55')]))[_0x05af('0x64')](_0x05af('0x65')));}return rp(_0x5d8248)['then'](function(_0x491911){return _0x1da380[_0x05af('0x66')](_['map'](_0x491911[_0x05af('0x67')][_0x05af('0x68')],function(_0x5e659e){return{'id':_0x5e659e[_0x05af('0x24')],'name':_0x5e659e[_0x05af('0x24')],'type':_0x5e659e[_0x05af('0x2a')],'active':_0x5e659e[_0x05af('0x69')],'label':_0x5e659e['label'],'custom':!![]};}));});}})[_0x05af('0x21')](function(_0x48dda1){return{'count':_0x48dda1['length'],'rows':_0x48dda1};})[_0x05af('0x21')](respondWithResult(_0x3177db,null))[_0x05af('0x3f')](function(_0x59ca69){var _0x250094=_0x7e5e61['query'][_0x05af('0x6a')]?0x1f4:_0x59ca69[_0x05af('0x6b')]||0x1f4;logger[_0x05af('0x6c')](_0x05af('0x6d'),'getFields',_0x250094,JSON['stringify'](_0x59ca69));delete _0x59ca69['name'];if(_0x250094===0x191){_0x250094=0x190;}_0x3177db[_0x05af('0x17')](_0x250094)[_0x05af('0x25')](_0x7e5e61['query'][_0x05af('0x6a')]?{'message':_0x05af('0x6e'),'statusCode':_0x59ca69[_0x05af('0x6b')]}:_0x59ca69);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index c8b92c1..ff7b6fb 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 _0x8e98=['rimraf','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x35e884,_0x53b7e7){var _0x24c027=function(_0x3770ee){while(--_0x3770ee){_0x35e884['push'](_0x35e884['shift']());}};_0x24c027(++_0x53b7e7);}(_0x8e98,0x1db));var _0x88e9=function(_0x254316,_0x2b205c){_0x254316=_0x254316-0x0;var _0x249799=_0x8e98[_0x254316];return _0x249799;};'use strict';var _=require(_0x88e9('0x0'));var util=require('util');var logger=require(_0x88e9('0x1'))(_0x88e9('0x2'));var moment=require('moment');var BPromise=require(_0x88e9('0x3'));var rp=require(_0x88e9('0x4'));var fs=require('fs');var path=require(_0x88e9('0x5'));var rimraf=require(_0x88e9('0x6'));var config=require(_0x88e9('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x88e9('0x8'));module[_0x88e9('0x9')]=function(_0x4a750b,_0x149bed){return _0x4a750b[_0x88e9('0xa')](_0x88e9('0xb'),attributes,{'tableName':_0x88e9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0755=['DeskAccount','int_desk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','exports','define'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0755,0x113));var _0x5075=function(_0x456fdd,_0x2547f3){_0x456fdd=_0x456fdd-0x0;var _0x30d1d8=_0x0755[_0x456fdd];return _0x30d1d8;};'use strict';var _=require(_0x5075('0x0'));var util=require(_0x5075('0x1'));var logger=require(_0x5075('0x2'))('api');var moment=require(_0x5075('0x3'));var BPromise=require(_0x5075('0x4'));var rp=require(_0x5075('0x5'));var fs=require('fs');var path=require(_0x5075('0x6'));var rimraf=require(_0x5075('0x7'));var config=require('../../config/environment');var attributes=require(_0x5075('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x5075('0x9')]=function(_0x3d50bb,_0x4fc2f4){return _0x3d50bb[_0x5075('0xa')](_0x5075('0xb'),attributes,{'tableName':_0x5075('0xc'),'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 0355c5f..7d89098 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 _0xab6b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit','include','map','model','then','ShowDeskAccount','find','raw','lodash','util'];(function(_0x3bad26,_0x1cf013){var _0x42e1ff=function(_0xb53d84){while(--_0xb53d84){_0x3bad26['push'](_0x3bad26['shift']());}};_0x42e1ff(++_0x1cf013);}(_0xab6b,0xc6));var _0xbab6=function(_0xab68d7,_0x2c55c0){_0xab68d7=_0xab68d7-0x0;var _0x3f7154=_0xab6b[_0xab68d7];return _0x3f7154;};'use strict';var _=require(_0xbab6('0x0'));var util=require(_0xbab6('0x1'));var moment=require(_0xbab6('0x2'));var BPromise=require(_0xbab6('0x3'));var rs=require(_0xbab6('0x4'));var fs=require('fs');var Redis=require(_0xbab6('0x5'));var db=require(_0xbab6('0x6'))['db'];var utils=require(_0xbab6('0x7'));var logger=require(_0xbab6('0x8'))(_0xbab6('0x9'));var config=require(_0xbab6('0xa'));var jayson=require(_0xbab6('0xb'));var client=jayson[_0xbab6('0xc')][_0xbab6('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x28532b,_0x3a549b,_0x483666){return new BPromise(function(_0x553749,_0x226030){return client[_0xbab6('0xe')](_0x28532b,_0x483666)['then'](function(_0x586e95){logger[_0xbab6('0xf')](_0xbab6('0x10'),_0x3a549b,'request\x20sent');logger[_0xbab6('0x11')](_0xbab6('0x12'),_0x3a549b,_0xbab6('0x13'),JSON[_0xbab6('0x14')](_0x586e95));if(_0x586e95['error']){if(_0x586e95[_0xbab6('0x15')][_0xbab6('0x16')]===0x1f4){logger[_0xbab6('0x15')](_0xbab6('0x10'),_0x3a549b,_0x586e95['error'][_0xbab6('0x17')]);return _0x226030(_0x586e95['error'][_0xbab6('0x17')]);}logger[_0xbab6('0x15')](_0xbab6('0x10'),_0x3a549b,_0x586e95[_0xbab6('0x15')][_0xbab6('0x17')]);return _0x553749(_0x586e95[_0xbab6('0x15')][_0xbab6('0x17')]);}else{logger[_0xbab6('0xf')]('DeskAccount,\x20%s,\x20%s',_0x3a549b,_0xbab6('0x13'));_0x553749(_0x586e95[_0xbab6('0x18')]['message']);}})[_0xbab6('0x19')](function(_0x218dcc){logger['error'](_0xbab6('0x10'),_0x3a549b,_0x218dcc);_0x226030(_0x218dcc);});});}exports[_0xbab6('0x1a')]=function(_0xfe9b3a){var _0x9040b6=this;return new Promise(function(_0x3ccbde,_0x19d08b){return db[_0xbab6('0x1b')][_0xbab6('0x1c')]({'raw':_0xfe9b3a['options']?_0xfe9b3a[_0xbab6('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xfe9b3a[_0xbab6('0x1d')]?_0xfe9b3a[_0xbab6('0x1d')][_0xbab6('0x1e')]||null:null,'attributes':_0xfe9b3a['options']?_0xfe9b3a['options'][_0xbab6('0x1f')]||null:null,'limit':_0xfe9b3a[_0xbab6('0x1d')]?_0xfe9b3a[_0xbab6('0x1d')][_0xbab6('0x20')]||null:null,'include':_0xfe9b3a['options']?_0xfe9b3a[_0xbab6('0x1d')][_0xbab6('0x21')]?_[_0xbab6('0x22')](_0xfe9b3a[_0xbab6('0x1d')]['include'],function(_0x562be0){return{'model':db[_0x562be0[_0xbab6('0x23')]],'as':_0x562be0['as'],'attributes':_0x562be0[_0xbab6('0x1f')],'include':_0x562be0['include']?_[_0xbab6('0x22')](_0x562be0['include'],function(_0x248b8f){return{'model':db[_0x248b8f[_0xbab6('0x23')]],'as':_0x248b8f['as'],'attributes':_0x248b8f[_0xbab6('0x1f')],'include':_0x248b8f[_0xbab6('0x21')]?_['map'](_0x248b8f[_0xbab6('0x21')],function(_0x4c799f){return{'model':db[_0x4c799f[_0xbab6('0x23')]],'as':_0x4c799f['as'],'attributes':_0x4c799f[_0xbab6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbab6('0x24')](function(_0x52946d){logger[_0xbab6('0xf')](_0xbab6('0x1a'),_0xfe9b3a);logger[_0xbab6('0x11')](_0xbab6('0x1a'),_0xfe9b3a,JSON['stringify'](_0x52946d));_0x3ccbde(_0x52946d);})[_0xbab6('0x19')](function(_0x3d7015){logger[_0xbab6('0x15')](_0xbab6('0x1a'),_0x3d7015[_0xbab6('0x17')],_0xfe9b3a);_0x19d08b(_0x9040b6[_0xbab6('0x15')](0x1f4,_0x3d7015['message']));});});};exports[_0xbab6('0x25')]=function(_0x46214d){var _0x55a0c4=this;return new Promise(function(_0x39eee8,_0x1f564c){return db[_0xbab6('0x1b')][_0xbab6('0x26')]({'raw':_0x46214d[_0xbab6('0x1d')]?_0x46214d[_0xbab6('0x1d')][_0xbab6('0x27')]===undefined?!![]:![]:!![],'where':_0x46214d[_0xbab6('0x1d')]?_0x46214d[_0xbab6('0x1d')][_0xbab6('0x1e')]||null:null,'attributes':_0x46214d[_0xbab6('0x1d')]?_0x46214d[_0xbab6('0x1d')][_0xbab6('0x1f')]||null:null,'include':_0x46214d[_0xbab6('0x1d')]?_0x46214d['options'][_0xbab6('0x21')]?_[_0xbab6('0x22')](_0x46214d[_0xbab6('0x1d')][_0xbab6('0x21')],function(_0x7aae88){return{'model':db[_0x7aae88[_0xbab6('0x23')]],'as':_0x7aae88['as'],'attributes':_0x7aae88[_0xbab6('0x1f')],'include':_0x7aae88[_0xbab6('0x21')]?_['map'](_0x7aae88[_0xbab6('0x21')],function(_0x13f49b){return{'model':db[_0x13f49b[_0xbab6('0x23')]],'as':_0x13f49b['as'],'attributes':_0x13f49b[_0xbab6('0x1f')],'include':_0x13f49b[_0xbab6('0x21')]?_[_0xbab6('0x22')](_0x13f49b[_0xbab6('0x21')],function(_0x369715){return{'model':db[_0x369715[_0xbab6('0x23')]],'as':_0x369715['as'],'attributes':_0x369715[_0xbab6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbab6('0x24')](function(_0x20f41b){logger['info'](_0xbab6('0x25'),_0x46214d);logger[_0xbab6('0x11')](_0xbab6('0x25'),_0x46214d,JSON[_0xbab6('0x14')](_0x20f41b));_0x39eee8(_0x20f41b);})[_0xbab6('0x19')](function(_0x2e0bfd){logger[_0xbab6('0x15')](_0xbab6('0x25'),_0x2e0bfd[_0xbab6('0x17')],_0x46214d);_0x1f564c(_0x55a0c4[_0xbab6('0x15')](0x1f4,_0x2e0bfd[_0xbab6('0x17')]));});});}; \ No newline at end of file +var _0xc7a4=['catch','findAll','options','raw','where','attributes','limit','map','include','model','GetDeskAccount','ShowDeskAccount','DeskAccount','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x44add5,_0x283b3a){var _0x529156=function(_0x5b0f0a){while(--_0x5b0f0a){_0x44add5['push'](_0x44add5['shift']());}};_0x529156(++_0x283b3a);}(_0xc7a4,0x7a));var _0x4c7a=function(_0x5a5a66,_0x51c660){_0x5a5a66=_0x5a5a66-0x0;var _0x530598=_0xc7a4[_0x5a5a66];return _0x530598;};'use strict';var _=require(_0x4c7a('0x0'));var util=require('util');var moment=require(_0x4c7a('0x1'));var BPromise=require(_0x4c7a('0x2'));var rs=require(_0x4c7a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c7a('0x4'))['db'];var utils=require(_0x4c7a('0x5'));var logger=require(_0x4c7a('0x6'))(_0x4c7a('0x7'));var config=require(_0x4c7a('0x8'));var jayson=require(_0x4c7a('0x9'));var client=jayson[_0x4c7a('0xa')][_0x4c7a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x278014,_0x36c198,_0x4e6498){return new BPromise(function(_0x25749d,_0xb2f699){return client[_0x4c7a('0xc')](_0x278014,_0x4e6498)[_0x4c7a('0xd')](function(_0x3ce903){logger[_0x4c7a('0xe')](_0x4c7a('0xf'),_0x36c198,'request\x20sent');logger[_0x4c7a('0x10')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x36c198,_0x4c7a('0x11'),JSON[_0x4c7a('0x12')](_0x3ce903));if(_0x3ce903[_0x4c7a('0x13')]){if(_0x3ce903[_0x4c7a('0x13')][_0x4c7a('0x14')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x36c198,_0x3ce903['error'][_0x4c7a('0x15')]);return _0xb2f699(_0x3ce903['error'][_0x4c7a('0x15')]);}logger[_0x4c7a('0x13')](_0x4c7a('0xf'),_0x36c198,_0x3ce903[_0x4c7a('0x13')][_0x4c7a('0x15')]);return _0x25749d(_0x3ce903[_0x4c7a('0x13')][_0x4c7a('0x15')]);}else{logger[_0x4c7a('0xe')]('DeskAccount,\x20%s,\x20%s',_0x36c198,_0x4c7a('0x11'));_0x25749d(_0x3ce903['result'][_0x4c7a('0x15')]);}})[_0x4c7a('0x16')](function(_0x534b0f){logger[_0x4c7a('0x13')](_0x4c7a('0xf'),_0x36c198,_0x534b0f);_0xb2f699(_0x534b0f);});});}exports['GetDeskAccount']=function(_0x551040){var _0x10e351=this;return new Promise(function(_0x1dd101,_0x5b5417){return db['DeskAccount'][_0x4c7a('0x17')]({'raw':_0x551040[_0x4c7a('0x18')]?_0x551040[_0x4c7a('0x18')][_0x4c7a('0x19')]===undefined?!![]:![]:!![],'where':_0x551040[_0x4c7a('0x18')]?_0x551040['options'][_0x4c7a('0x1a')]||null:null,'attributes':_0x551040['options']?_0x551040[_0x4c7a('0x18')][_0x4c7a('0x1b')]||null:null,'limit':_0x551040[_0x4c7a('0x18')]?_0x551040[_0x4c7a('0x18')][_0x4c7a('0x1c')]||null:null,'include':_0x551040['options']?_0x551040[_0x4c7a('0x18')]['include']?_[_0x4c7a('0x1d')](_0x551040[_0x4c7a('0x18')]['include'],function(_0x4009b5){return{'model':db[_0x4009b5['model']],'as':_0x4009b5['as'],'attributes':_0x4009b5[_0x4c7a('0x1b')],'include':_0x4009b5[_0x4c7a('0x1e')]?_[_0x4c7a('0x1d')](_0x4009b5['include'],function(_0x19a80d){return{'model':db[_0x19a80d[_0x4c7a('0x1f')]],'as':_0x19a80d['as'],'attributes':_0x19a80d[_0x4c7a('0x1b')],'include':_0x19a80d[_0x4c7a('0x1e')]?_['map'](_0x19a80d[_0x4c7a('0x1e')],function(_0x3c5f6e){return{'model':db[_0x3c5f6e[_0x4c7a('0x1f')]],'as':_0x3c5f6e['as'],'attributes':_0x3c5f6e[_0x4c7a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfaa603){logger[_0x4c7a('0xe')](_0x4c7a('0x20'),_0x551040);logger[_0x4c7a('0x10')](_0x4c7a('0x20'),_0x551040,JSON[_0x4c7a('0x12')](_0xfaa603));_0x1dd101(_0xfaa603);})[_0x4c7a('0x16')](function(_0x3c3a01){logger['error'](_0x4c7a('0x20'),_0x3c3a01['message'],_0x551040);_0x5b5417(_0x10e351[_0x4c7a('0x13')](0x1f4,_0x3c3a01[_0x4c7a('0x15')]));});});};exports[_0x4c7a('0x21')]=function(_0x194c3f){var _0x281415=this;return new Promise(function(_0x3050b8,_0x2b9a48){return db[_0x4c7a('0x22')][_0x4c7a('0x23')]({'raw':_0x194c3f['options']?_0x194c3f[_0x4c7a('0x18')][_0x4c7a('0x19')]===undefined?!![]:![]:!![],'where':_0x194c3f[_0x4c7a('0x18')]?_0x194c3f[_0x4c7a('0x18')][_0x4c7a('0x1a')]||null:null,'attributes':_0x194c3f[_0x4c7a('0x18')]?_0x194c3f['options'][_0x4c7a('0x1b')]||null:null,'include':_0x194c3f[_0x4c7a('0x18')]?_0x194c3f[_0x4c7a('0x18')][_0x4c7a('0x1e')]?_['map'](_0x194c3f[_0x4c7a('0x18')][_0x4c7a('0x1e')],function(_0x34ec65){return{'model':db[_0x34ec65[_0x4c7a('0x1f')]],'as':_0x34ec65['as'],'attributes':_0x34ec65[_0x4c7a('0x1b')],'include':_0x34ec65['include']?_[_0x4c7a('0x1d')](_0x34ec65[_0x4c7a('0x1e')],function(_0x4286bc){return{'model':db[_0x4286bc[_0x4c7a('0x1f')]],'as':_0x4286bc['as'],'attributes':_0x4286bc[_0x4c7a('0x1b')],'include':_0x4286bc[_0x4c7a('0x1e')]?_[_0x4c7a('0x1d')](_0x4286bc['include'],function(_0x2f82b0){return{'model':db[_0x2f82b0[_0x4c7a('0x1f')]],'as':_0x2f82b0['as'],'attributes':_0x2f82b0[_0x4c7a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40b074){logger[_0x4c7a('0xe')](_0x4c7a('0x21'),_0x194c3f);logger['debug']('ShowDeskAccount',_0x194c3f,JSON[_0x4c7a('0x12')](_0x40b074));_0x3050b8(_0x40b074);})['catch'](function(_0x36af87){logger['error'](_0x4c7a('0x21'),_0x36af87['message'],_0x194c3f);_0x2b9a48(_0x281415['error'](0x1f4,_0x36af87[_0x4c7a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 821ea4e..d11cc71 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x5951e8,_0x42b9a7){var _0x20a1f5=function(_0x2bc968){while(--_0x2bc968){_0x5951e8['push'](_0x5951e8['shift']());}};_0x20a1f5(++_0x42b9a7);}(_0x55ca,0x126));var _0xa55c=function(_0xf852,_0x4ddd76){_0xf852=_0xf852-0x0;var _0x5b2550=_0x55ca[_0xf852];return _0x5b2550;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x43b5e5,_0x307cb0){var _0x327e24=function(_0x52fcc4){while(--_0x52fcc4){_0x43b5e5['push'](_0x43b5e5['shift']());}};_0x327e24(++_0x307cb0);}(_0x008c,0x188));var _0xc008=function(_0xa2c6c9,_0x383b47){_0xa2c6c9=_0xa2c6c9-0x0;var _0x10ba06=_0x008c[_0xa2c6c9];return _0x10ba06;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('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 bddd972..1214139 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 _0xaad8=['STRING','sequelize','exports'];(function(_0x380e21,_0x3782a7){var _0x46b982=function(_0x1cd82b){while(--_0x1cd82b){_0x380e21['push'](_0x380e21['shift']());}};_0x46b982(++_0x3782a7);}(_0xaad8,0x18a));var _0x8aad=function(_0xf00054,_0x4c3d31){_0xf00054=_0xf00054-0x0;var _0x138e40=_0xaad8[_0xf00054];return _0x138e40;};'use strict';var Sequelize=require(_0x8aad('0x0'));module[_0x8aad('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8aad('0x2')]}}; \ No newline at end of file +var _0x5846=['STRING','sequelize','exports'];(function(_0x253c82,_0x37df37){var _0x3efa41=function(_0x1de993){while(--_0x1de993){_0x253c82['push'](_0x253c82['shift']());}};_0x3efa41(++_0x37df37);}(_0x5846,0x1c0));var _0x6584=function(_0x198cad,_0x312d9a){_0x198cad=_0x198cad-0x0;var _0x513211=_0x5846[_0x198cad];return _0x513211;};'use strict';var Sequelize=require(_0x6584('0x0'));module[_0x6584('0x1')]={'name':{'type':Sequelize[_0x6584('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index efb964a..780fb21 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 _0x8a22=['sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','rows','catch','params','find','create','body','findOne','DeskField','pick','getFields','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','count','Content-Range','json','save','update','then','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a22,0x7c));var _0x28a2=function(_0x4a93c6,_0x1550ea){_0x4a93c6=_0x4a93c6-0x0;var _0x2102d3=_0x8a22[_0x4a93c6];return _0x2102d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x28a2('0x0'));var zipdir=require(_0x28a2('0x1'));var jsonpatch=require(_0x28a2('0x2'));var rp=require(_0x28a2('0x3'));var moment=require(_0x28a2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x28a2('0x5'));var util=require(_0x28a2('0x6'));var path=require(_0x28a2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x28a2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x28a2('0x9'));var squel=require('squel');var crypto=require(_0x28a2('0xa'));var jsforce=require(_0x28a2('0xb'));var deskjs=require(_0x28a2('0xc'));var toCsv=require(_0x28a2('0xd'));var querystring=require('querystring');var Papa=require(_0x28a2('0xe'));var Redis=require(_0x28a2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x28a2('0x10'));var as=require(_0x28a2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x28a2('0x12'));var config=require(_0x28a2('0x13'));var licenseUtil=require(_0x28a2('0x14'));var db=require(_0x28a2('0x15'))['db'];function respondWithStatusCode(_0x52e6be,_0x57dc97){_0x57dc97=_0x57dc97||0xcc;return function(_0x2bb4f4){if(_0x2bb4f4){return _0x52e6be['sendStatus'](_0x57dc97);}return _0x52e6be[_0x28a2('0x16')](_0x57dc97)['end']();};}function respondWithResult(_0x137287,_0x175cb3){_0x175cb3=_0x175cb3||0xc8;return function(_0x1fda16){if(_0x1fda16){return _0x137287['status'](_0x175cb3)['json'](_0x1fda16);}};}function respondWithFilteredResult(_0x21e316,_0x137f7a){return function(_0x3b98a3){if(_0x3b98a3){var _0xaa0165=typeof _0x137f7a[_0x28a2('0x17')]==='undefined'&&typeof _0x137f7a[_0x28a2('0x18')]==='undefined';var _0x37631e=_0x3b98a3[_0x28a2('0x19')];var _0x1829fa=_0xaa0165?0x0:_0x137f7a['offset'];var _0x15693b=_0xaa0165?_0x3b98a3['count']:_0x137f7a[_0x28a2('0x17')]+_0x137f7a[_0x28a2('0x18')];var _0x641467;if(_0x15693b>=_0x37631e){_0x15693b=_0x37631e;_0x641467=0xc8;}else{_0x641467=0xce;}_0x21e316[_0x28a2('0x16')](_0x641467);return _0x21e316['set'](_0x28a2('0x1a'),_0x1829fa+'-'+_0x15693b+'/'+_0x37631e)[_0x28a2('0x1b')](_0x3b98a3);}return null;};}function patchUpdates(_0x41002f){return function(_0x2ed9bd){try{jsonpatch['apply'](_0x2ed9bd,_0x41002f,!![]);}catch(_0x2c2814){return BPromise['reject'](_0x2c2814);}return _0x2ed9bd[_0x28a2('0x1c')]();};}function saveUpdates(_0x1f594b,_0x3d752b){return function(_0x4565ad){if(_0x4565ad){return _0x4565ad[_0x28a2('0x1d')](_0x1f594b)[_0x28a2('0x1e')](function(_0x1b84d0){return _0x1b84d0;});}return null;};}function removeEntity(_0x26c937,_0x1339f8){return function(_0xd165db){if(_0xd165db){return _0xd165db[_0x28a2('0x1f')]()[_0x28a2('0x1e')](function(){_0x26c937[_0x28a2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d7aa9,_0x2532f4){return function(_0x158f8e){if(!_0x158f8e){_0x4d7aa9[_0x28a2('0x20')](0x194);}return _0x158f8e;};}function handleError(_0x111b78,_0x3ad4cf){_0x3ad4cf=_0x3ad4cf||0x1f4;return function(_0x453fe4){logger['error'](_0x453fe4[_0x28a2('0x21')]);if(_0x453fe4[_0x28a2('0x22')]){delete _0x453fe4[_0x28a2('0x22')];}_0x111b78[_0x28a2('0x16')](_0x3ad4cf)[_0x28a2('0x23')](_0x453fe4);};}exports[_0x28a2('0x24')]=function(_0x2d8d5c,_0xaf81fe){var _0x2198e2={},_0x36948e={},_0x34097d={'count':0x0,'rows':[]};var _0x5e70ee=_[_0x28a2('0x25')](db['DeskConfiguration'][_0x28a2('0x26')],function(_0x2e60ad){return{'name':_0x2e60ad['fieldName'],'type':_0x2e60ad[_0x28a2('0x27')][_0x28a2('0x28')]};});_0x36948e[_0x28a2('0x29')]=_[_0x28a2('0x25')](_0x5e70ee,_0x28a2('0x22'));_0x36948e[_0x28a2('0x2a')]=_[_0x28a2('0x2b')](_0x2d8d5c[_0x28a2('0x2a')]);_0x36948e[_0x28a2('0x2c')]=_[_0x28a2('0x2d')](_0x36948e[_0x28a2('0x29')],_0x36948e[_0x28a2('0x2a')]);_0x2198e2['attributes']=_['intersection'](_0x36948e[_0x28a2('0x29')],qs[_0x28a2('0x2e')](_0x2d8d5c['query'][_0x28a2('0x2e')]));_0x2198e2[_0x28a2('0x2f')]=_0x2198e2[_0x28a2('0x2f')][_0x28a2('0x30')]?_0x2198e2[_0x28a2('0x2f')]:_0x36948e[_0x28a2('0x29')];if(!_0x2d8d5c[_0x28a2('0x2a')][_0x28a2('0x31')]('nolimit')){_0x2198e2[_0x28a2('0x18')]=qs['limit'](_0x2d8d5c[_0x28a2('0x2a')]['limit']);_0x2198e2[_0x28a2('0x17')]=qs[_0x28a2('0x17')](_0x2d8d5c[_0x28a2('0x2a')][_0x28a2('0x17')]);}_0x2198e2[_0x28a2('0x32')]=qs[_0x28a2('0x33')](_0x2d8d5c[_0x28a2('0x2a')]['sort']);_0x2198e2['where']=qs[_0x28a2('0x2c')](_['pick'](_0x2d8d5c[_0x28a2('0x2a')],_0x36948e['filters']),_0x5e70ee);if(_0x2d8d5c[_0x28a2('0x2a')][_0x28a2('0x34')]){_0x2198e2['where']=_[_0x28a2('0x35')](_0x2198e2[_0x28a2('0x36')],{'$or':_[_0x28a2('0x25')](_0x5e70ee,function(_0x274192){if(_0x274192[_0x28a2('0x27')]!==_0x28a2('0x37')){var _0x44acb5={};_0x44acb5[_0x274192[_0x28a2('0x22')]]={'$like':'%'+_0x2d8d5c['query']['filter']+'%'};return _0x44acb5;}})});}_0x2198e2=_['merge']({},_0x2198e2,_0x2d8d5c[_0x28a2('0x38')]);var _0x1fc936={'where':_0x2198e2[_0x28a2('0x36')]};return db[_0x28a2('0x39')][_0x28a2('0x19')](_0x1fc936)['then'](function(_0x5edfd5){_0x34097d['count']=_0x5edfd5;if(_0x2d8d5c[_0x28a2('0x2a')][_0x28a2('0x3a')]){_0x2198e2[_0x28a2('0x3b')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x28a2('0x3c')](_0x2198e2);})[_0x28a2('0x1e')](function(_0x4ca730){_0x34097d[_0x28a2('0x3d')]=_0x4ca730;return _0x34097d;})[_0x28a2('0x1e')](respondWithFilteredResult(_0xaf81fe,_0x2198e2))[_0x28a2('0x3e')](handleError(_0xaf81fe,null));};exports['show']=function(_0xf61483,_0x4104e7){var _0x4cf41b={'raw':![],'where':{'id':_0xf61483[_0x28a2('0x3f')]['id']}},_0xbd808d={};_0xbd808d['model']=_[_0x28a2('0x2b')](db['DeskConfiguration']['rawAttributes']);_0xbd808d[_0x28a2('0x2a')]=_[_0x28a2('0x2b')](_0xf61483[_0x28a2('0x2a')]);_0xbd808d[_0x28a2('0x2c')]=_[_0x28a2('0x2d')](_0xbd808d[_0x28a2('0x29')],_0xbd808d[_0x28a2('0x2a')]);_0x4cf41b[_0x28a2('0x2f')]=_['intersection'](_0xbd808d[_0x28a2('0x29')],qs['fields'](_0xf61483[_0x28a2('0x2a')][_0x28a2('0x2e')]));_0x4cf41b['attributes']=_0x4cf41b[_0x28a2('0x2f')]['length']?_0x4cf41b['attributes']:_0xbd808d[_0x28a2('0x29')];if(_0xf61483[_0x28a2('0x2a')][_0x28a2('0x3a')]){_0x4cf41b[_0x28a2('0x3b')]=[{'all':!![]}];}_0x4cf41b=_[_0x28a2('0x35')]({},_0x4cf41b,_0xf61483[_0x28a2('0x38')]);return db[_0x28a2('0x39')][_0x28a2('0x40')](_0x4cf41b)[_0x28a2('0x1e')](handleEntityNotFound(_0x4104e7,null))[_0x28a2('0x1e')](respondWithResult(_0x4104e7,null))[_0x28a2('0x3e')](handleError(_0x4104e7,null));};exports[_0x28a2('0x41')]=function(_0x29ab8d,_0x68e19c){return db[_0x28a2('0x39')][_0x28a2('0x41')](_0x29ab8d[_0x28a2('0x42')],{})[_0x28a2('0x1e')](respondWithResult(_0x68e19c,0xc9))[_0x28a2('0x3e')](handleError(_0x68e19c,null));};exports[_0x28a2('0x1d')]=function(_0x2147f0,_0x24d28c){if(_0x2147f0[_0x28a2('0x42')]['id']){delete _0x2147f0[_0x28a2('0x42')]['id'];}return db[_0x28a2('0x39')][_0x28a2('0x40')]({'where':{'id':_0x2147f0['params']['id']}})['then'](handleEntityNotFound(_0x24d28c,null))[_0x28a2('0x1e')](saveUpdates(_0x2147f0['body'],null))[_0x28a2('0x1e')](respondWithResult(_0x24d28c,null))[_0x28a2('0x3e')](handleError(_0x24d28c,null));};exports['destroy']=function(_0x4c30cb,_0x25aa34){return db[_0x28a2('0x39')]['find']({'where':{'id':_0x4c30cb[_0x28a2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x25aa34,null))['then'](removeEntity(_0x25aa34,null))['catch'](handleError(_0x25aa34,null));};exports['getFields']=function(_0x3f1541,_0x3329fb,_0x288bac){var _0x4fe53a={};var _0x492103={};var _0x29a043;var _0x16aec3;return db[_0x28a2('0x39')][_0x28a2('0x43')]({'where':{'id':_0x3f1541[_0x28a2('0x3f')]['id']}})[_0x28a2('0x1e')](handleEntityNotFound(_0x3329fb,null))[_0x28a2('0x1e')](function(_0x5db1eb){if(_0x5db1eb){_0x29a043=_0x5db1eb;_0x492103[_0x28a2('0x29')]=_[_0x28a2('0x2b')](db[_0x28a2('0x44')][_0x28a2('0x26')]);_0x492103[_0x28a2('0x2a')]=_[_0x28a2('0x2b')](_0x3f1541['query']);_0x492103[_0x28a2('0x2c')]=_[_0x28a2('0x2d')](_0x492103[_0x28a2('0x29')],_0x492103[_0x28a2('0x2a')]);_0x4fe53a[_0x28a2('0x2f')]=_[_0x28a2('0x2d')](_0x492103[_0x28a2('0x29')],qs[_0x28a2('0x2e')](_0x3f1541[_0x28a2('0x2a')][_0x28a2('0x2e')]));_0x4fe53a['attributes']=_0x4fe53a[_0x28a2('0x2f')][_0x28a2('0x30')]?_0x4fe53a[_0x28a2('0x2f')]:_0x492103[_0x28a2('0x29')];_0x4fe53a[_0x28a2('0x32')]=qs[_0x28a2('0x33')](_0x3f1541[_0x28a2('0x2a')][_0x28a2('0x33')]);_0x4fe53a[_0x28a2('0x36')]=qs[_0x28a2('0x2c')](_[_0x28a2('0x45')](_0x3f1541[_0x28a2('0x2a')],_0x492103[_0x28a2('0x2c')]));if(_0x3f1541['query']['filter']){_0x4fe53a[_0x28a2('0x36')]=_['merge'](_0x4fe53a[_0x28a2('0x36')],{'$or':_['map'](_0x4fe53a[_0x28a2('0x2f')],function(_0x45ffa0){var _0x322e65={};_0x322e65[_0x45ffa0]={'$like':'%'+_0x3f1541[_0x28a2('0x2a')][_0x28a2('0x34')]+'%'};return _0x322e65;})});}_0x4fe53a=_[_0x28a2('0x35')]({},_0x4fe53a,_0x3f1541[_0x28a2('0x38')]);return _0x29a043[_0x28a2('0x46')](_0x4fe53a);}})['then'](function(_0xed2480){if(_0xed2480){_0x16aec3=_0xed2480['length'];if(!_0x3f1541[_0x28a2('0x2a')][_0x28a2('0x31')](_0x28a2('0x47'))){_0x4fe53a[_0x28a2('0x18')]=qs[_0x28a2('0x18')](_0x3f1541[_0x28a2('0x2a')]['limit']);_0x4fe53a['offset']=qs['offset'](_0x3f1541['query'][_0x28a2('0x17')]);}return _0x29a043[_0x28a2('0x46')](_0x4fe53a);}})[_0x28a2('0x1e')](function(_0x5067ab){if(_0x5067ab){return _0x5067ab?{'count':_0x16aec3,'rows':_0x5067ab}:null;}})[_0x28a2('0x1e')](respondWithResult(_0x3329fb,null))[_0x28a2('0x3e')](handleError(_0x3329fb,null));};exports['getSubjects']=function(_0x504395,_0x77ce96,_0x335322){var _0xd5ea11={};var _0x5dee60={};var _0x49581d;var _0x19c3db;return db[_0x28a2('0x39')][_0x28a2('0x43')]({'where':{'id':_0x504395['params']['id']}})['then'](handleEntityNotFound(_0x77ce96,null))[_0x28a2('0x1e')](function(_0x5d0cd2){if(_0x5d0cd2){_0x49581d=_0x5d0cd2;_0x5dee60[_0x28a2('0x29')]=_['keys'](db[_0x28a2('0x44')][_0x28a2('0x26')]);_0x5dee60[_0x28a2('0x2a')]=_['keys'](_0x504395[_0x28a2('0x2a')]);_0x5dee60[_0x28a2('0x2c')]=_['intersection'](_0x5dee60[_0x28a2('0x29')],_0x5dee60[_0x28a2('0x2a')]);_0xd5ea11[_0x28a2('0x2f')]=_[_0x28a2('0x2d')](_0x5dee60[_0x28a2('0x29')],qs['fields'](_0x504395[_0x28a2('0x2a')][_0x28a2('0x2e')]));_0xd5ea11[_0x28a2('0x2f')]=_0xd5ea11[_0x28a2('0x2f')]['length']?_0xd5ea11[_0x28a2('0x2f')]:_0x5dee60[_0x28a2('0x29')];_0xd5ea11[_0x28a2('0x32')]=qs[_0x28a2('0x33')](_0x504395['query']['sort']);_0xd5ea11[_0x28a2('0x36')]=qs[_0x28a2('0x2c')](_[_0x28a2('0x45')](_0x504395[_0x28a2('0x2a')],_0x5dee60[_0x28a2('0x2c')]));if(_0x504395[_0x28a2('0x2a')][_0x28a2('0x34')]){_0xd5ea11[_0x28a2('0x36')]=_[_0x28a2('0x35')](_0xd5ea11[_0x28a2('0x36')],{'$or':_[_0x28a2('0x25')](_0xd5ea11['attributes'],function(_0x21dae9){var _0x2c74cf={};_0x2c74cf[_0x21dae9]={'$like':'%'+_0x504395[_0x28a2('0x2a')][_0x28a2('0x34')]+'%'};return _0x2c74cf;})});}_0xd5ea11=_[_0x28a2('0x35')]({},_0xd5ea11,_0x504395['options']);return _0x49581d[_0x28a2('0x48')](_0xd5ea11);}})['then'](function(_0xdc93e0){if(_0xdc93e0){_0x19c3db=_0xdc93e0[_0x28a2('0x30')];if(!_0x504395[_0x28a2('0x2a')][_0x28a2('0x31')](_0x28a2('0x47'))){_0xd5ea11[_0x28a2('0x18')]=qs['limit'](_0x504395[_0x28a2('0x2a')][_0x28a2('0x18')]);_0xd5ea11[_0x28a2('0x17')]=qs[_0x28a2('0x17')](_0x504395[_0x28a2('0x2a')][_0x28a2('0x17')]);}return _0x49581d[_0x28a2('0x48')](_0xd5ea11);}})[_0x28a2('0x1e')](function(_0x39bf47){if(_0x39bf47){return _0x39bf47?{'count':_0x19c3db,'rows':_0x39bf47}:null;}})['then'](respondWithResult(_0x77ce96,null))['catch'](handleError(_0x77ce96,null));};exports[_0x28a2('0x49')]=function(_0x3d1ebb,_0x181a5c,_0x4394ef){var _0x1d8104={};var _0x19cbf5={};var _0x3f6487;var _0x521f0c;return db[_0x28a2('0x39')]['findOne']({'where':{'id':_0x3d1ebb[_0x28a2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x181a5c,null))[_0x28a2('0x1e')](function(_0x969647){if(_0x969647){_0x3f6487=_0x969647;_0x19cbf5[_0x28a2('0x29')]=_[_0x28a2('0x2b')](db[_0x28a2('0x44')][_0x28a2('0x26')]);_0x19cbf5[_0x28a2('0x2a')]=_[_0x28a2('0x2b')](_0x3d1ebb[_0x28a2('0x2a')]);_0x19cbf5[_0x28a2('0x2c')]=_[_0x28a2('0x2d')](_0x19cbf5['model'],_0x19cbf5[_0x28a2('0x2a')]);_0x1d8104['attributes']=_['intersection'](_0x19cbf5[_0x28a2('0x29')],qs[_0x28a2('0x2e')](_0x3d1ebb[_0x28a2('0x2a')][_0x28a2('0x2e')]));_0x1d8104[_0x28a2('0x2f')]=_0x1d8104[_0x28a2('0x2f')][_0x28a2('0x30')]?_0x1d8104[_0x28a2('0x2f')]:_0x19cbf5[_0x28a2('0x29')];_0x1d8104['order']=qs[_0x28a2('0x33')](_0x3d1ebb[_0x28a2('0x2a')][_0x28a2('0x33')]);_0x1d8104[_0x28a2('0x36')]=qs['filters'](_[_0x28a2('0x45')](_0x3d1ebb[_0x28a2('0x2a')],_0x19cbf5[_0x28a2('0x2c')]));if(_0x3d1ebb['query']['filter']){_0x1d8104['where']=_[_0x28a2('0x35')](_0x1d8104[_0x28a2('0x36')],{'$or':_['map'](_0x1d8104[_0x28a2('0x2f')],function(_0x6c8614){var _0x387c34={};_0x387c34[_0x6c8614]={'$like':'%'+_0x3d1ebb[_0x28a2('0x2a')][_0x28a2('0x34')]+'%'};return _0x387c34;})});}_0x1d8104=_[_0x28a2('0x35')]({},_0x1d8104,_0x3d1ebb[_0x28a2('0x38')]);return _0x3f6487['getDescriptions'](_0x1d8104);}})[_0x28a2('0x1e')](function(_0x58b224){if(_0x58b224){_0x521f0c=_0x58b224[_0x28a2('0x30')];if(!_0x3d1ebb[_0x28a2('0x2a')][_0x28a2('0x31')]('nolimit')){_0x1d8104[_0x28a2('0x18')]=qs['limit'](_0x3d1ebb[_0x28a2('0x2a')][_0x28a2('0x18')]);_0x1d8104['offset']=qs[_0x28a2('0x17')](_0x3d1ebb[_0x28a2('0x2a')]['offset']);}return _0x3f6487['getDescriptions'](_0x1d8104);}})['then'](function(_0x2b40a4){if(_0x2b40a4){return _0x2b40a4?{'count':_0x521f0c,'rows':_0x2b40a4}:null;}})[_0x28a2('0x1e')](respondWithResult(_0x181a5c,null))['catch'](handleError(_0x181a5c,null));};exports[_0x28a2('0x4a')]=function(_0x2af724,_0x5303b7,_0xd56463){var _0x2db427={};var _0x1be4ec={};var _0xf13ba8;var _0xfe6f8a;return db[_0x28a2('0x39')][_0x28a2('0x43')]({'where':{'id':_0x2af724['params']['id']}})[_0x28a2('0x1e')](handleEntityNotFound(_0x5303b7,null))['then'](function(_0x1add9d){if(_0x1add9d){_0xf13ba8=_0x1add9d;_0x1be4ec[_0x28a2('0x29')]=_['keys'](db[_0x28a2('0x4b')]['rawAttributes']);_0x1be4ec[_0x28a2('0x2a')]=_[_0x28a2('0x2b')](_0x2af724[_0x28a2('0x2a')]);_0x1be4ec[_0x28a2('0x2c')]=_[_0x28a2('0x2d')](_0x1be4ec[_0x28a2('0x29')],_0x1be4ec[_0x28a2('0x2a')]);_0x2db427[_0x28a2('0x2f')]=_[_0x28a2('0x2d')](_0x1be4ec['model'],qs[_0x28a2('0x2e')](_0x2af724[_0x28a2('0x2a')][_0x28a2('0x2e')]));_0x2db427[_0x28a2('0x2f')]=_0x2db427['attributes'][_0x28a2('0x30')]?_0x2db427[_0x28a2('0x2f')]:_0x1be4ec[_0x28a2('0x29')];_0x2db427[_0x28a2('0x32')]=qs[_0x28a2('0x33')](_0x2af724['query'][_0x28a2('0x33')]);_0x2db427[_0x28a2('0x36')]=qs['filters'](_['pick'](_0x2af724[_0x28a2('0x2a')],_0x1be4ec[_0x28a2('0x2c')]));if(_0x2af724[_0x28a2('0x2a')]['filter']){_0x2db427[_0x28a2('0x36')]=_['merge'](_0x2db427[_0x28a2('0x36')],{'$or':_['map'](_0x2db427[_0x28a2('0x2f')],function(_0x2c64d3){var _0x37f869={};_0x37f869[_0x2c64d3]={'$like':'%'+_0x2af724[_0x28a2('0x2a')][_0x28a2('0x34')]+'%'};return _0x37f869;})});}_0x2db427=_[_0x28a2('0x35')]({},_0x2db427,_0x2af724['options']);return _0xf13ba8[_0x28a2('0x4a')](_0x2db427);}})[_0x28a2('0x1e')](function(_0x535b47){if(_0x535b47){_0xfe6f8a=_0x535b47[_0x28a2('0x30')];if(!_0x2af724['query']['hasOwnProperty'](_0x28a2('0x47'))){_0x2db427[_0x28a2('0x18')]=qs['limit'](_0x2af724[_0x28a2('0x2a')][_0x28a2('0x18')]);_0x2db427['offset']=qs[_0x28a2('0x17')](_0x2af724[_0x28a2('0x2a')][_0x28a2('0x17')]);}return _0xf13ba8[_0x28a2('0x4a')](_0x2db427);}})[_0x28a2('0x1e')](function(_0xe96784){if(_0xe96784){return _0xe96784?{'count':_0xfe6f8a,'rows':_0xe96784}:null;}})[_0x28a2('0x1e')](respondWithResult(_0x5303b7,null))[_0x28a2('0x3e')](handleError(_0x5303b7,null));};exports[_0x28a2('0x4c')]=function(_0x5c66ef,_0x471d02,_0x3ce80b){if(_0x5c66ef[_0x28a2('0x42')]['id']){delete _0x5c66ef[_0x28a2('0x42')]['id'];}return db[_0x28a2('0x39')][_0x28a2('0x43')]({'where':{'id':_0x5c66ef[_0x28a2('0x3f')]['id']}})[_0x28a2('0x1e')](handleEntityNotFound(_0x471d02,null))[_0x28a2('0x1e')](function(_0x1d9198){if(_0x1d9198){return _0x1d9198['setTags'](_0x5c66ef['body'][_0x28a2('0x4d')]||[]);}return null;})[_0x28a2('0x1e')](respondWithResult(_0x471d02,null))[_0x28a2('0x3e')](handleError(_0x471d02,null));}; \ No newline at end of file +var _0x9417=['findOne','DeskField','length','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','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','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskConfiguration','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','include','find','body'];(function(_0x47b54a,_0x914027){var _0x3e40ee=function(_0x6b6cc4){while(--_0x6b6cc4){_0x47b54a['push'](_0x47b54a['shift']());}};_0x3e40ee(++_0x914027);}(_0x9417,0xb4));var _0x7941=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x9417[_0x1a89a1];return _0x3d5b46;};'use strict';var emlformat=require(_0x7941('0x0'));var rimraf=require(_0x7941('0x1'));var zipdir=require(_0x7941('0x2'));var jsonpatch=require(_0x7941('0x3'));var rp=require('request-promise');var moment=require(_0x7941('0x4'));var BPromise=require(_0x7941('0x5'));var Mustache=require(_0x7941('0x6'));var util=require(_0x7941('0x7'));var path=require(_0x7941('0x8'));var sox=require(_0x7941('0x9'));var csv=require(_0x7941('0xa'));var ejs=require(_0x7941('0xb'));var fs=require('fs');var fs_extra=require(_0x7941('0xc'));var _=require(_0x7941('0xd'));var squel=require('squel');var crypto=require(_0x7941('0xe'));var jsforce=require(_0x7941('0xf'));var deskjs=require(_0x7941('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7941('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7941('0x12'));var qs=require(_0x7941('0x13'));var as=require(_0x7941('0x14'));var hardwareService=require(_0x7941('0x15'));var logger=require(_0x7941('0x16'))(_0x7941('0x17'));var utils=require(_0x7941('0x18'));var config=require(_0x7941('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7941('0x1a'))['db'];function respondWithStatusCode(_0x51aab8,_0x12b674){_0x12b674=_0x12b674||0xcc;return function(_0x46a86a){if(_0x46a86a){return _0x51aab8['sendStatus'](_0x12b674);}return _0x51aab8['status'](_0x12b674)[_0x7941('0x1b')]();};}function respondWithResult(_0x59f371,_0x18936d){_0x18936d=_0x18936d||0xc8;return function(_0x45c08f){if(_0x45c08f){return _0x59f371[_0x7941('0x1c')](_0x18936d)[_0x7941('0x1d')](_0x45c08f);}};}function respondWithFilteredResult(_0x1da410,_0x41b098){return function(_0x55320b){if(_0x55320b){var _0x11623c=typeof _0x41b098[_0x7941('0x1e')]===_0x7941('0x1f')&&typeof _0x41b098[_0x7941('0x20')]===_0x7941('0x1f');var _0x256f45=_0x55320b[_0x7941('0x21')];var _0x573b44=_0x11623c?0x0:_0x41b098[_0x7941('0x1e')];var _0x533559=_0x11623c?_0x55320b['count']:_0x41b098[_0x7941('0x1e')]+_0x41b098['limit'];var _0x17442f;if(_0x533559>=_0x256f45){_0x533559=_0x256f45;_0x17442f=0xc8;}else{_0x17442f=0xce;}_0x1da410[_0x7941('0x1c')](_0x17442f);return _0x1da410[_0x7941('0x22')]('Content-Range',_0x573b44+'-'+_0x533559+'/'+_0x256f45)['json'](_0x55320b);}return null;};}function patchUpdates(_0x645e4c){return function(_0x4d3b28){try{jsonpatch[_0x7941('0x23')](_0x4d3b28,_0x645e4c,!![]);}catch(_0x57809b){return BPromise[_0x7941('0x24')](_0x57809b);}return _0x4d3b28[_0x7941('0x25')]();};}function saveUpdates(_0x42ff1f,_0x45ae78){return function(_0x3c2ae5){if(_0x3c2ae5){return _0x3c2ae5[_0x7941('0x26')](_0x42ff1f)[_0x7941('0x27')](function(_0x5287e0){return _0x5287e0;});}return null;};}function removeEntity(_0x20dd64,_0x531f20){return function(_0x36ff77){if(_0x36ff77){return _0x36ff77[_0x7941('0x28')]()[_0x7941('0x27')](function(){_0x20dd64[_0x7941('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55f679,_0x1e61e0){return function(_0x5ad836){if(!_0x5ad836){_0x55f679['sendStatus'](0x194);}return _0x5ad836;};}function handleError(_0x5f09c1,_0x43caf0){_0x43caf0=_0x43caf0||0x1f4;return function(_0x1b59e2){logger[_0x7941('0x29')](_0x1b59e2[_0x7941('0x2a')]);if(_0x1b59e2[_0x7941('0x2b')]){delete _0x1b59e2['name'];}_0x5f09c1[_0x7941('0x1c')](_0x43caf0)[_0x7941('0x2c')](_0x1b59e2);};}exports[_0x7941('0x2d')]=function(_0x240052,_0x23f617){var _0x24cc75={},_0xd2b022={},_0x47e5be={'count':0x0,'rows':[]};var _0x335c48=_[_0x7941('0x2e')](db[_0x7941('0x2f')]['rawAttributes'],function(_0x34b140){return{'name':_0x34b140['fieldName'],'type':_0x34b140[_0x7941('0x30')][_0x7941('0x31')]};});_0xd2b022[_0x7941('0x32')]=_['map'](_0x335c48,_0x7941('0x2b'));_0xd2b022[_0x7941('0x33')]=_['keys'](_0x240052[_0x7941('0x33')]);_0xd2b022[_0x7941('0x34')]=_['intersection'](_0xd2b022[_0x7941('0x32')],_0xd2b022[_0x7941('0x33')]);_0x24cc75['attributes']=_[_0x7941('0x35')](_0xd2b022[_0x7941('0x32')],qs[_0x7941('0x36')](_0x240052[_0x7941('0x33')][_0x7941('0x36')]));_0x24cc75[_0x7941('0x37')]=_0x24cc75[_0x7941('0x37')]['length']?_0x24cc75[_0x7941('0x37')]:_0xd2b022[_0x7941('0x32')];if(!_0x240052['query'][_0x7941('0x38')](_0x7941('0x39'))){_0x24cc75[_0x7941('0x20')]=qs[_0x7941('0x20')](_0x240052[_0x7941('0x33')][_0x7941('0x20')]);_0x24cc75['offset']=qs[_0x7941('0x1e')](_0x240052[_0x7941('0x33')][_0x7941('0x1e')]);}_0x24cc75[_0x7941('0x3a')]=qs[_0x7941('0x3b')](_0x240052[_0x7941('0x33')][_0x7941('0x3b')]);_0x24cc75['where']=qs[_0x7941('0x34')](_[_0x7941('0x3c')](_0x240052['query'],_0xd2b022['filters']),_0x335c48);if(_0x240052[_0x7941('0x33')][_0x7941('0x3d')]){_0x24cc75[_0x7941('0x3e')]=_[_0x7941('0x3f')](_0x24cc75[_0x7941('0x3e')],{'$or':_[_0x7941('0x2e')](_0x335c48,function(_0x234554){if(_0x234554[_0x7941('0x30')]!=='VIRTUAL'){var _0x36cb98={};_0x36cb98[_0x234554['name']]={'$like':'%'+_0x240052[_0x7941('0x33')][_0x7941('0x3d')]+'%'};return _0x36cb98;}})});}_0x24cc75=_[_0x7941('0x3f')]({},_0x24cc75,_0x240052[_0x7941('0x40')]);var _0x2bb30d={'where':_0x24cc75['where']};return db['DeskConfiguration'][_0x7941('0x21')](_0x2bb30d)[_0x7941('0x27')](function(_0x4bc788){_0x47e5be['count']=_0x4bc788;if(_0x240052['query'][_0x7941('0x41')]){_0x24cc75['include']=[{'all':!![]}];}return db[_0x7941('0x2f')][_0x7941('0x42')](_0x24cc75);})[_0x7941('0x27')](function(_0x5ecb03){_0x47e5be[_0x7941('0x43')]=_0x5ecb03;return _0x47e5be;})['then'](respondWithFilteredResult(_0x23f617,_0x24cc75))[_0x7941('0x44')](handleError(_0x23f617,null));};exports['show']=function(_0x259d76,_0x4fe6e3){var _0x5bdf19={'raw':![],'where':{'id':_0x259d76[_0x7941('0x45')]['id']}},_0x42abb7={};_0x42abb7[_0x7941('0x32')]=_[_0x7941('0x46')](db[_0x7941('0x2f')][_0x7941('0x47')]);_0x42abb7[_0x7941('0x33')]=_[_0x7941('0x46')](_0x259d76[_0x7941('0x33')]);_0x42abb7[_0x7941('0x34')]=_[_0x7941('0x35')](_0x42abb7[_0x7941('0x32')],_0x42abb7[_0x7941('0x33')]);_0x5bdf19['attributes']=_[_0x7941('0x35')](_0x42abb7[_0x7941('0x32')],qs[_0x7941('0x36')](_0x259d76[_0x7941('0x33')][_0x7941('0x36')]));_0x5bdf19['attributes']=_0x5bdf19['attributes']['length']?_0x5bdf19[_0x7941('0x37')]:_0x42abb7[_0x7941('0x32')];if(_0x259d76['query'][_0x7941('0x41')]){_0x5bdf19[_0x7941('0x48')]=[{'all':!![]}];}_0x5bdf19=_[_0x7941('0x3f')]({},_0x5bdf19,_0x259d76['options']);return db[_0x7941('0x2f')][_0x7941('0x49')](_0x5bdf19)[_0x7941('0x27')](handleEntityNotFound(_0x4fe6e3,null))[_0x7941('0x27')](respondWithResult(_0x4fe6e3,null))[_0x7941('0x44')](handleError(_0x4fe6e3,null));};exports['create']=function(_0x108444,_0x308334){return db['DeskConfiguration']['create'](_0x108444[_0x7941('0x4a')],{})[_0x7941('0x27')](respondWithResult(_0x308334,0xc9))['catch'](handleError(_0x308334,null));};exports[_0x7941('0x26')]=function(_0x1da6c2,_0x223784){if(_0x1da6c2[_0x7941('0x4a')]['id']){delete _0x1da6c2[_0x7941('0x4a')]['id'];}return db[_0x7941('0x2f')][_0x7941('0x49')]({'where':{'id':_0x1da6c2[_0x7941('0x45')]['id']}})[_0x7941('0x27')](handleEntityNotFound(_0x223784,null))['then'](saveUpdates(_0x1da6c2[_0x7941('0x4a')],null))['then'](respondWithResult(_0x223784,null))[_0x7941('0x44')](handleError(_0x223784,null));};exports[_0x7941('0x28')]=function(_0x29df60,_0x18e14b){return db[_0x7941('0x2f')][_0x7941('0x49')]({'where':{'id':_0x29df60['params']['id']}})[_0x7941('0x27')](handleEntityNotFound(_0x18e14b,null))[_0x7941('0x27')](removeEntity(_0x18e14b,null))[_0x7941('0x44')](handleError(_0x18e14b,null));};exports['getFields']=function(_0x2b9301,_0x66d3b4,_0x41ba40){var _0x1dd924={};var _0x462ac4={};var _0x138727;var _0x3b5998;return db[_0x7941('0x2f')][_0x7941('0x4b')]({'where':{'id':_0x2b9301[_0x7941('0x45')]['id']}})[_0x7941('0x27')](handleEntityNotFound(_0x66d3b4,null))['then'](function(_0x438080){if(_0x438080){_0x138727=_0x438080;_0x462ac4['model']=_['keys'](db[_0x7941('0x4c')][_0x7941('0x47')]);_0x462ac4['query']=_[_0x7941('0x46')](_0x2b9301[_0x7941('0x33')]);_0x462ac4['filters']=_[_0x7941('0x35')](_0x462ac4['model'],_0x462ac4['query']);_0x1dd924[_0x7941('0x37')]=_[_0x7941('0x35')](_0x462ac4[_0x7941('0x32')],qs[_0x7941('0x36')](_0x2b9301[_0x7941('0x33')]['fields']));_0x1dd924[_0x7941('0x37')]=_0x1dd924['attributes'][_0x7941('0x4d')]?_0x1dd924[_0x7941('0x37')]:_0x462ac4[_0x7941('0x32')];_0x1dd924[_0x7941('0x3a')]=qs[_0x7941('0x3b')](_0x2b9301[_0x7941('0x33')][_0x7941('0x3b')]);_0x1dd924[_0x7941('0x3e')]=qs[_0x7941('0x34')](_[_0x7941('0x3c')](_0x2b9301[_0x7941('0x33')],_0x462ac4['filters']));if(_0x2b9301[_0x7941('0x33')]['filter']){_0x1dd924[_0x7941('0x3e')]=_[_0x7941('0x3f')](_0x1dd924[_0x7941('0x3e')],{'$or':_[_0x7941('0x2e')](_0x1dd924['attributes'],function(_0x5a03ad){var _0x5dc69a={};_0x5dc69a[_0x5a03ad]={'$like':'%'+_0x2b9301[_0x7941('0x33')][_0x7941('0x3d')]+'%'};return _0x5dc69a;})});}_0x1dd924=_[_0x7941('0x3f')]({},_0x1dd924,_0x2b9301[_0x7941('0x40')]);return _0x138727[_0x7941('0x4e')](_0x1dd924);}})[_0x7941('0x27')](function(_0x20b42b){if(_0x20b42b){_0x3b5998=_0x20b42b[_0x7941('0x4d')];if(!_0x2b9301[_0x7941('0x33')][_0x7941('0x38')]('nolimit')){_0x1dd924[_0x7941('0x20')]=qs[_0x7941('0x20')](_0x2b9301[_0x7941('0x33')][_0x7941('0x20')]);_0x1dd924[_0x7941('0x1e')]=qs[_0x7941('0x1e')](_0x2b9301[_0x7941('0x33')]['offset']);}return _0x138727[_0x7941('0x4e')](_0x1dd924);}})[_0x7941('0x27')](function(_0x48e93c){if(_0x48e93c){return _0x48e93c?{'count':_0x3b5998,'rows':_0x48e93c}:null;}})[_0x7941('0x27')](respondWithResult(_0x66d3b4,null))[_0x7941('0x44')](handleError(_0x66d3b4,null));};exports[_0x7941('0x4f')]=function(_0x3e0889,_0x2fd43a,_0x2d65f4){var _0x537ea3={};var _0x52457f={};var _0x63318e;var _0x21e31;return db[_0x7941('0x2f')][_0x7941('0x4b')]({'where':{'id':_0x3e0889[_0x7941('0x45')]['id']}})['then'](handleEntityNotFound(_0x2fd43a,null))[_0x7941('0x27')](function(_0x46f630){if(_0x46f630){_0x63318e=_0x46f630;_0x52457f[_0x7941('0x32')]=_[_0x7941('0x46')](db[_0x7941('0x4c')][_0x7941('0x47')]);_0x52457f[_0x7941('0x33')]=_['keys'](_0x3e0889[_0x7941('0x33')]);_0x52457f[_0x7941('0x34')]=_['intersection'](_0x52457f[_0x7941('0x32')],_0x52457f[_0x7941('0x33')]);_0x537ea3[_0x7941('0x37')]=_[_0x7941('0x35')](_0x52457f[_0x7941('0x32')],qs[_0x7941('0x36')](_0x3e0889[_0x7941('0x33')][_0x7941('0x36')]));_0x537ea3[_0x7941('0x37')]=_0x537ea3['attributes'][_0x7941('0x4d')]?_0x537ea3[_0x7941('0x37')]:_0x52457f[_0x7941('0x32')];_0x537ea3[_0x7941('0x3a')]=qs['sort'](_0x3e0889['query'][_0x7941('0x3b')]);_0x537ea3['where']=qs[_0x7941('0x34')](_['pick'](_0x3e0889['query'],_0x52457f[_0x7941('0x34')]));if(_0x3e0889[_0x7941('0x33')][_0x7941('0x3d')]){_0x537ea3[_0x7941('0x3e')]=_['merge'](_0x537ea3[_0x7941('0x3e')],{'$or':_['map'](_0x537ea3['attributes'],function(_0x51d811){var _0x1b1902={};_0x1b1902[_0x51d811]={'$like':'%'+_0x3e0889[_0x7941('0x33')][_0x7941('0x3d')]+'%'};return _0x1b1902;})});}_0x537ea3=_['merge']({},_0x537ea3,_0x3e0889[_0x7941('0x40')]);return _0x63318e[_0x7941('0x4f')](_0x537ea3);}})[_0x7941('0x27')](function(_0x174d75){if(_0x174d75){_0x21e31=_0x174d75[_0x7941('0x4d')];if(!_0x3e0889[_0x7941('0x33')][_0x7941('0x38')]('nolimit')){_0x537ea3[_0x7941('0x20')]=qs[_0x7941('0x20')](_0x3e0889['query'][_0x7941('0x20')]);_0x537ea3[_0x7941('0x1e')]=qs['offset'](_0x3e0889[_0x7941('0x33')][_0x7941('0x1e')]);}return _0x63318e['getSubjects'](_0x537ea3);}})['then'](function(_0x218e70){if(_0x218e70){return _0x218e70?{'count':_0x21e31,'rows':_0x218e70}:null;}})[_0x7941('0x27')](respondWithResult(_0x2fd43a,null))[_0x7941('0x44')](handleError(_0x2fd43a,null));};exports[_0x7941('0x50')]=function(_0x11e1e6,_0x1592ee,_0x1590c6){var _0x3477e3={};var _0x5d9acb={};var _0x5ba22c;var _0x911d40;return db[_0x7941('0x2f')][_0x7941('0x4b')]({'where':{'id':_0x11e1e6['params']['id']}})[_0x7941('0x27')](handleEntityNotFound(_0x1592ee,null))['then'](function(_0x45de91){if(_0x45de91){_0x5ba22c=_0x45de91;_0x5d9acb[_0x7941('0x32')]=_[_0x7941('0x46')](db['DeskField']['rawAttributes']);_0x5d9acb[_0x7941('0x33')]=_[_0x7941('0x46')](_0x11e1e6['query']);_0x5d9acb[_0x7941('0x34')]=_[_0x7941('0x35')](_0x5d9acb[_0x7941('0x32')],_0x5d9acb['query']);_0x3477e3[_0x7941('0x37')]=_['intersection'](_0x5d9acb[_0x7941('0x32')],qs['fields'](_0x11e1e6['query']['fields']));_0x3477e3[_0x7941('0x37')]=_0x3477e3[_0x7941('0x37')][_0x7941('0x4d')]?_0x3477e3['attributes']:_0x5d9acb[_0x7941('0x32')];_0x3477e3[_0x7941('0x3a')]=qs[_0x7941('0x3b')](_0x11e1e6[_0x7941('0x33')]['sort']);_0x3477e3[_0x7941('0x3e')]=qs['filters'](_[_0x7941('0x3c')](_0x11e1e6[_0x7941('0x33')],_0x5d9acb['filters']));if(_0x11e1e6[_0x7941('0x33')]['filter']){_0x3477e3[_0x7941('0x3e')]=_[_0x7941('0x3f')](_0x3477e3[_0x7941('0x3e')],{'$or':_[_0x7941('0x2e')](_0x3477e3['attributes'],function(_0x8f0c55){var _0xdcacb={};_0xdcacb[_0x8f0c55]={'$like':'%'+_0x11e1e6[_0x7941('0x33')]['filter']+'%'};return _0xdcacb;})});}_0x3477e3=_[_0x7941('0x3f')]({},_0x3477e3,_0x11e1e6[_0x7941('0x40')]);return _0x5ba22c[_0x7941('0x50')](_0x3477e3);}})['then'](function(_0x95b752){if(_0x95b752){_0x911d40=_0x95b752[_0x7941('0x4d')];if(!_0x11e1e6['query'][_0x7941('0x38')]('nolimit')){_0x3477e3[_0x7941('0x20')]=qs['limit'](_0x11e1e6[_0x7941('0x33')][_0x7941('0x20')]);_0x3477e3['offset']=qs[_0x7941('0x1e')](_0x11e1e6[_0x7941('0x33')][_0x7941('0x1e')]);}return _0x5ba22c[_0x7941('0x50')](_0x3477e3);}})[_0x7941('0x27')](function(_0x6ab553){if(_0x6ab553){return _0x6ab553?{'count':_0x911d40,'rows':_0x6ab553}:null;}})['then'](respondWithResult(_0x1592ee,null))[_0x7941('0x44')](handleError(_0x1592ee,null));};exports[_0x7941('0x51')]=function(_0x18cb11,_0x57991c,_0x2c71f7){var _0x1361ec={};var _0x90ca68={};var _0xe3f9a3;var _0x3b91a3;return db[_0x7941('0x2f')]['findOne']({'where':{'id':_0x18cb11['params']['id']}})[_0x7941('0x27')](handleEntityNotFound(_0x57991c,null))[_0x7941('0x27')](function(_0x34fa43){if(_0x34fa43){_0xe3f9a3=_0x34fa43;_0x90ca68[_0x7941('0x32')]=_[_0x7941('0x46')](db[_0x7941('0x52')][_0x7941('0x47')]);_0x90ca68[_0x7941('0x33')]=_[_0x7941('0x46')](_0x18cb11[_0x7941('0x33')]);_0x90ca68[_0x7941('0x34')]=_[_0x7941('0x35')](_0x90ca68['model'],_0x90ca68['query']);_0x1361ec['attributes']=_[_0x7941('0x35')](_0x90ca68[_0x7941('0x32')],qs['fields'](_0x18cb11[_0x7941('0x33')][_0x7941('0x36')]));_0x1361ec[_0x7941('0x37')]=_0x1361ec[_0x7941('0x37')][_0x7941('0x4d')]?_0x1361ec[_0x7941('0x37')]:_0x90ca68[_0x7941('0x32')];_0x1361ec[_0x7941('0x3a')]=qs['sort'](_0x18cb11[_0x7941('0x33')][_0x7941('0x3b')]);_0x1361ec[_0x7941('0x3e')]=qs[_0x7941('0x34')](_[_0x7941('0x3c')](_0x18cb11['query'],_0x90ca68[_0x7941('0x34')]));if(_0x18cb11[_0x7941('0x33')]['filter']){_0x1361ec[_0x7941('0x3e')]=_[_0x7941('0x3f')](_0x1361ec[_0x7941('0x3e')],{'$or':_['map'](_0x1361ec[_0x7941('0x37')],function(_0x2305ad){var _0x4a0900={};_0x4a0900[_0x2305ad]={'$like':'%'+_0x18cb11['query'][_0x7941('0x3d')]+'%'};return _0x4a0900;})});}_0x1361ec=_[_0x7941('0x3f')]({},_0x1361ec,_0x18cb11[_0x7941('0x40')]);return _0xe3f9a3[_0x7941('0x51')](_0x1361ec);}})[_0x7941('0x27')](function(_0x2e2db1){if(_0x2e2db1){_0x3b91a3=_0x2e2db1[_0x7941('0x4d')];if(!_0x18cb11[_0x7941('0x33')]['hasOwnProperty'](_0x7941('0x39'))){_0x1361ec[_0x7941('0x20')]=qs[_0x7941('0x20')](_0x18cb11['query'][_0x7941('0x20')]);_0x1361ec[_0x7941('0x1e')]=qs[_0x7941('0x1e')](_0x18cb11[_0x7941('0x33')][_0x7941('0x1e')]);}return _0xe3f9a3[_0x7941('0x51')](_0x1361ec);}})[_0x7941('0x27')](function(_0x461bfb){if(_0x461bfb){return _0x461bfb?{'count':_0x3b91a3,'rows':_0x461bfb}:null;}})[_0x7941('0x27')](respondWithResult(_0x57991c,null))[_0x7941('0x44')](handleError(_0x57991c,null));};exports[_0x7941('0x53')]=function(_0x1fe2ef,_0x3ed75f,_0x2d9c97){if(_0x1fe2ef[_0x7941('0x4a')]['id']){delete _0x1fe2ef[_0x7941('0x4a')]['id'];}return db[_0x7941('0x2f')]['findOne']({'where':{'id':_0x1fe2ef['params']['id']}})[_0x7941('0x27')](handleEntityNotFound(_0x3ed75f,null))[_0x7941('0x27')](function(_0x4fb15a){if(_0x4fb15a){return _0x4fb15a[_0x7941('0x53')](_0x1fe2ef['body'][_0x7941('0x54')]||[]);}return null;})[_0x7941('0x27')](respondWithResult(_0x3ed75f,null))['catch'](handleError(_0x3ed75f,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 59f0946..114982d 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 _0xbbdd=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','DeskConfiguration','int_desk_configurations'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xbbdd,0x120));var _0xdbbd=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xbbdd[_0xc8a931];return _0x28bd27;};'use strict';var _=require(_0xdbbd('0x0'));var util=require(_0xdbbd('0x1'));var logger=require(_0xdbbd('0x2'))('api');var moment=require(_0xdbbd('0x3'));var BPromise=require(_0xdbbd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdbbd('0x5'));var rimraf=require(_0xdbbd('0x6'));var config=require(_0xdbbd('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0xdbbd('0x8')]=function(_0x1b1f26,_0x4c8540){return _0x1b1f26[_0xdbbd('0x9')](_0xdbbd('0xa'),attributes,{'tableName':_0xdbbd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c5e=['./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4fa9d4,_0x4788b7){var _0x1f765e=function(_0x4dce34){while(--_0x4dce34){_0x4fa9d4['push'](_0x4fa9d4['shift']());}};_0x1f765e(++_0x4788b7);}(_0x7c5e,0x11d));var _0xe7c5=function(_0x85b2b8,_0xc2bd8f){_0x85b2b8=_0x85b2b8-0x0;var _0x1fe129=_0x7c5e[_0x85b2b8];return _0x1fe129;};'use strict';var _=require(_0xe7c5('0x0'));var util=require(_0xe7c5('0x1'));var logger=require(_0xe7c5('0x2'))(_0xe7c5('0x3'));var moment=require(_0xe7c5('0x4'));var BPromise=require(_0xe7c5('0x5'));var rp=require(_0xe7c5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7c5('0x7'));var config=require(_0xe7c5('0x8'));var attributes=require(_0xe7c5('0x9'));module[_0xe7c5('0xa')]=function(_0xc6c33,_0x30800f){return _0xc6c33[_0xe7c5('0xb')](_0xe7c5('0xc'),attributes,{'tableName':_0xe7c5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 02036da..74de9a1 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 _0xeb0f=['../../config/utils','rpc','client','http','request','then','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','DeskConfiguration,\x20%s,\x20%s','message','request\x20sent','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x82158f,_0x4e103e){var _0x5f475f=function(_0x473255){while(--_0x473255){_0x82158f['push'](_0x82158f['shift']());}};_0x5f475f(++_0x4e103e);}(_0xeb0f,0x176));var _0xfeb0=function(_0x3fa98b,_0x5b805c){_0x3fa98b=_0x3fa98b-0x0;var _0x339bb8=_0xeb0f[_0x3fa98b];return _0x339bb8;};'use strict';var _=require(_0xfeb0('0x0'));var util=require('util');var moment=require(_0xfeb0('0x1'));var BPromise=require(_0xfeb0('0x2'));var rs=require(_0xfeb0('0x3'));var fs=require('fs');var Redis=require(_0xfeb0('0x4'));var db=require(_0xfeb0('0x5'))['db'];var utils=require(_0xfeb0('0x6'));var logger=require('../../config/logger')(_0xfeb0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfeb0('0x8')][_0xfeb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ec46d,_0x3ec5f2,_0x433bd3){return new BPromise(function(_0x11a5c5,_0x38a24f){return client[_0xfeb0('0xa')](_0x3ec46d,_0x433bd3)[_0xfeb0('0xb')](function(_0x4220cd){logger[_0xfeb0('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x3ec5f2,'request\x20sent');logger[_0xfeb0('0xd')](_0xfeb0('0xe'),_0x3ec5f2,'request\x20sent',JSON['stringify'](_0x4220cd));if(_0x4220cd[_0xfeb0('0xf')]){if(_0x4220cd[_0xfeb0('0xf')][_0xfeb0('0x10')]===0x1f4){logger[_0xfeb0('0xf')](_0xfeb0('0x11'),_0x3ec5f2,_0x4220cd['error'][_0xfeb0('0x12')]);return _0x38a24f(_0x4220cd[_0xfeb0('0xf')][_0xfeb0('0x12')]);}logger[_0xfeb0('0xf')](_0xfeb0('0x11'),_0x3ec5f2,_0x4220cd[_0xfeb0('0xf')][_0xfeb0('0x12')]);return _0x11a5c5(_0x4220cd[_0xfeb0('0xf')]['message']);}else{logger[_0xfeb0('0xc')](_0xfeb0('0x11'),_0x3ec5f2,_0xfeb0('0x13'));_0x11a5c5(_0x4220cd['result']['message']);}})['catch'](function(_0x1aa982){logger[_0xfeb0('0xf')](_0xfeb0('0x11'),_0x3ec5f2,_0x1aa982);_0x38a24f(_0x1aa982);});});} \ No newline at end of file +var _0x9931=['stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9931,0x1b6));var _0x1993=function(_0x2561a9,_0x5a4bcb){_0x2561a9=_0x2561a9-0x0;var _0x6f27e8=_0x9931[_0x2561a9];return _0x6f27e8;};'use strict';var _=require('lodash');var util=require(_0x1993('0x0'));var moment=require('moment');var BPromise=require(_0x1993('0x1'));var rs=require(_0x1993('0x2'));var fs=require('fs');var Redis=require(_0x1993('0x3'));var db=require(_0x1993('0x4'))['db'];var utils=require(_0x1993('0x5'));var logger=require(_0x1993('0x6'))(_0x1993('0x7'));var config=require(_0x1993('0x8'));var jayson=require(_0x1993('0x9'));var client=jayson[_0x1993('0xa')][_0x1993('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x75d9c,_0x223be3,_0x3ccd96){return new BPromise(function(_0x15227a,_0x9643a8){return client[_0x1993('0xc')](_0x75d9c,_0x3ccd96)['then'](function(_0x58b0fe){logger[_0x1993('0xd')](_0x1993('0xe'),_0x223be3,_0x1993('0xf'));logger[_0x1993('0x10')](_0x1993('0x11'),_0x223be3,_0x1993('0xf'),JSON[_0x1993('0x12')](_0x58b0fe));if(_0x58b0fe[_0x1993('0x13')]){if(_0x58b0fe[_0x1993('0x13')][_0x1993('0x14')]===0x1f4){logger[_0x1993('0x13')](_0x1993('0xe'),_0x223be3,_0x58b0fe['error']['message']);return _0x9643a8(_0x58b0fe[_0x1993('0x13')][_0x1993('0x15')]);}logger[_0x1993('0x13')](_0x1993('0xe'),_0x223be3,_0x58b0fe['error'][_0x1993('0x15')]);return _0x15227a(_0x58b0fe[_0x1993('0x13')][_0x1993('0x15')]);}else{logger[_0x1993('0xd')](_0x1993('0xe'),_0x223be3,_0x1993('0xf'));_0x15227a(_0x58b0fe[_0x1993('0x16')]['message']);}})[_0x1993('0x17')](function(_0x58162c){logger[_0x1993('0x13')](_0x1993('0xe'),_0x223be3,_0x58162c);_0x9643a8(_0x58162c);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 4a6ac2d..89f970a 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 _0xe4e0=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4208eb,_0x1104b6){var _0x1ffc06=function(_0x5e475f){while(--_0x5e475f){_0x4208eb['push'](_0x4208eb['shift']());}};_0x1ffc06(++_0x1104b6);}(_0xe4e0,0xf3));var _0x0e4e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xe4e0[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x0e4e('0x0'));var util=require(_0x0e4e('0x1'));var path=require(_0x0e4e('0x2'));var timeout=require(_0x0e4e('0x3'));var express=require(_0x0e4e('0x4'));var router=express[_0x0e4e('0x5')]();var fs_extra=require(_0x0e4e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0e4e('0x7'));var config=require(_0x0e4e('0x8'));var controller=require('./intDeskField.controller');router[_0x0e4e('0x9')]('/',auth[_0x0e4e('0xa')](),controller['index']);router[_0x0e4e('0x9')](_0x0e4e('0xb'),auth[_0x0e4e('0xa')](),controller[_0x0e4e('0xc')]);router[_0x0e4e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0e4e('0xe')](_0x0e4e('0xb'),auth[_0x0e4e('0xa')](),controller[_0x0e4e('0xf')]);router[_0x0e4e('0x10')](_0x0e4e('0xb'),auth['isAuthenticated'](),controller[_0x0e4e('0x11')]);module[_0x0e4e('0x12')]=router; \ No newline at end of file +var _0xa7c8=['put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index','/:id','isAuthenticated','show','create'];(function(_0x35405f,_0x2fc5c1){var _0x1479e0=function(_0x52b9bb){while(--_0x52b9bb){_0x35405f['push'](_0x35405f['shift']());}};_0x1479e0(++_0x2fc5c1);}(_0xa7c8,0x82));var _0x8a7c=function(_0x355f8a,_0x2d50a9){_0x355f8a=_0x355f8a-0x0;var _0x1fd8b4=_0xa7c8[_0x355f8a];return _0x1fd8b4;};'use strict';var multer=require(_0x8a7c('0x0'));var util=require('util');var path=require(_0x8a7c('0x1'));var timeout=require(_0x8a7c('0x2'));var express=require(_0x8a7c('0x3'));var router=express['Router']();var fs_extra=require(_0x8a7c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8a7c('0x5'));var config=require(_0x8a7c('0x6'));var controller=require(_0x8a7c('0x7'));router[_0x8a7c('0x8')]('/',auth['isAuthenticated'](),controller[_0x8a7c('0x9')]);router['get'](_0x8a7c('0xa'),auth[_0x8a7c('0xb')](),controller[_0x8a7c('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8a7c('0xd')]);router[_0x8a7c('0xe')](_0x8a7c('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x8a7c('0xf')](_0x8a7c('0xa'),auth[_0x8a7c('0xb')](),controller[_0x8a7c('0x10')]);module[_0x8a7c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 3cbf0ef..ec39b17 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 _0x0d89=['STRING','ENUM','BOOLEAN','string','variable','customVariable','keyValue','picklist'];(function(_0xabdbbf,_0x2c14b2){var _0x56f00a=function(_0x5506d8){while(--_0x5506d8){_0xabdbbf['push'](_0xabdbbf['shift']());}};_0x56f00a(++_0x2c14b2);}(_0x0d89,0x113));var _0x90d8=function(_0x5c7107,_0x3c9e3a){_0x5c7107=_0x5c7107-0x0;var _0x52d2cb=_0x0d89[_0x5c7107];return _0x52d2cb;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x90d8('0x0'),_0x90d8('0x1'),_0x90d8('0x2'),_0x90d8('0x3'),_0x90d8('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x90d8('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x90d8('0x6')](_0x90d8('0x0'),'variable',_0x90d8('0x2'))},'keyContent':{'type':Sequelize[_0x90d8('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x90d8('0x5')]},'customField':{'type':Sequelize[_0x90d8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x90d8('0x5')]}}; \ No newline at end of file +var _0x97cc=['customVariable','keyValue','string','STRING','BOOLEAN','exports','ENUM','variable'];(function(_0x3b0675,_0x3ae044){var _0x34155d=function(_0x1039be){while(--_0x1039be){_0x3b0675['push'](_0x3b0675['shift']());}};_0x34155d(++_0x3ae044);}(_0x97cc,0xf5));var _0xc97c=function(_0x46b1ac,_0x3b7b93){_0x46b1ac=_0x46b1ac-0x0;var _0x145723=_0x97cc[_0x46b1ac];return _0x145723;};'use strict';var Sequelize=require('sequelize');module[_0xc97c('0x0')]={'type':{'type':Sequelize[_0xc97c('0x1')]('string',_0xc97c('0x2'),_0xc97c('0x3'),_0xc97c('0x4'),'picklist'),'defaultValue':_0xc97c('0x5')},'content':{'type':Sequelize[_0xc97c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xc97c('0x5'),_0xc97c('0x2'),_0xc97c('0x3'))},'keyContent':{'type':Sequelize[_0xc97c('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc97c('0x6')]},'customField':{'type':Sequelize[_0xc97c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc97c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 34e8836..b11be63 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 _0x4813=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','DeskField','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','show','params','keys','catch','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4a7577,_0x210bf0){var _0x5235d6=function(_0x30e194){while(--_0x30e194){_0x4a7577['push'](_0x4a7577['shift']());}};_0x5235d6(++_0x210bf0);}(_0x4813,0x14e));var _0x3481=function(_0x2eac6a,_0x5e9377){_0x2eac6a=_0x2eac6a-0x0;var _0x2c05e3=_0x4813[_0x2eac6a];return _0x2c05e3;};'use strict';var emlformat=require(_0x3481('0x0'));var rimraf=require(_0x3481('0x1'));var zipdir=require(_0x3481('0x2'));var jsonpatch=require(_0x3481('0x3'));var rp=require(_0x3481('0x4'));var moment=require(_0x3481('0x5'));var BPromise=require(_0x3481('0x6'));var Mustache=require('mustache');var util=require(_0x3481('0x7'));var path=require(_0x3481('0x8'));var sox=require(_0x3481('0x9'));var csv=require(_0x3481('0xa'));var ejs=require(_0x3481('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3481('0xc'));var crypto=require('crypto');var jsforce=require(_0x3481('0xd'));var deskjs=require(_0x3481('0xe'));var toCsv=require(_0x3481('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3481('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3481('0x10'));var logger=require(_0x3481('0x11'))(_0x3481('0x12'));var utils=require(_0x3481('0x13'));var config=require(_0x3481('0x14'));var licenseUtil=require(_0x3481('0x15'));var db=require(_0x3481('0x16'))['db'];function respondWithStatusCode(_0x3f1376,_0x37cc2b){_0x37cc2b=_0x37cc2b||0xcc;return function(_0x22b89b){if(_0x22b89b){return _0x3f1376[_0x3481('0x17')](_0x37cc2b);}return _0x3f1376[_0x3481('0x18')](_0x37cc2b)['end']();};}function respondWithResult(_0x16358e,_0xb77c75){_0xb77c75=_0xb77c75||0xc8;return function(_0x1bcfad){if(_0x1bcfad){return _0x16358e[_0x3481('0x18')](_0xb77c75)[_0x3481('0x19')](_0x1bcfad);}};}function respondWithFilteredResult(_0x39e581,_0x4a1d09){return function(_0x1bb126){if(_0x1bb126){var _0x41c2aa=typeof _0x4a1d09['offset']==='undefined'&&typeof _0x4a1d09['limit']==='undefined';var _0x4f5d1b=_0x1bb126['count'];var _0x32a315=_0x41c2aa?0x0:_0x4a1d09[_0x3481('0x1a')];var _0x5a8e65=_0x41c2aa?_0x1bb126['count']:_0x4a1d09[_0x3481('0x1a')]+_0x4a1d09[_0x3481('0x1b')];var _0x3b43dc;if(_0x5a8e65>=_0x4f5d1b){_0x5a8e65=_0x4f5d1b;_0x3b43dc=0xc8;}else{_0x3b43dc=0xce;}_0x39e581['status'](_0x3b43dc);return _0x39e581['set'](_0x3481('0x1c'),_0x32a315+'-'+_0x5a8e65+'/'+_0x4f5d1b)[_0x3481('0x19')](_0x1bb126);}return null;};}function patchUpdates(_0x1e0aa0){return function(_0x1ba743){try{jsonpatch[_0x3481('0x1d')](_0x1ba743,_0x1e0aa0,!![]);}catch(_0x4469d4){return BPromise['reject'](_0x4469d4);}return _0x1ba743[_0x3481('0x1e')]();};}function saveUpdates(_0x3cdb98,_0x162305){return function(_0xea1072){if(_0xea1072){return _0xea1072['update'](_0x3cdb98)[_0x3481('0x1f')](function(_0x48eb64){return _0x48eb64;});}return null;};}function removeEntity(_0x2185ba,_0x33c6fa){return function(_0x418a7d){if(_0x418a7d){return _0x418a7d[_0x3481('0x20')]()['then'](function(){_0x2185ba['status'](0xcc)[_0x3481('0x21')]();});}};}function handleEntityNotFound(_0x3e5963,_0x249754){return function(_0x405816){if(!_0x405816){_0x3e5963['sendStatus'](0x194);}return _0x405816;};}function handleError(_0x2e837a,_0x6ce3f3){_0x6ce3f3=_0x6ce3f3||0x1f4;return function(_0x1181e1){logger[_0x3481('0x22')](_0x1181e1[_0x3481('0x23')]);if(_0x1181e1[_0x3481('0x24')]){delete _0x1181e1[_0x3481('0x24')];}_0x2e837a[_0x3481('0x18')](_0x6ce3f3)[_0x3481('0x25')](_0x1181e1);};}exports[_0x3481('0x26')]=function(_0x4a20d5,_0x131363){var _0x4a8492={},_0xdcacba={},_0x1f079a={'count':0x0,'rows':[]};var _0x2864f1=_['map'](db[_0x3481('0x27')][_0x3481('0x28')],function(_0x2df894){return{'name':_0x2df894[_0x3481('0x29')],'type':_0x2df894[_0x3481('0x2a')]['key']};});_0xdcacba[_0x3481('0x2b')]=_[_0x3481('0x2c')](_0x2864f1,_0x3481('0x24'));_0xdcacba[_0x3481('0x2d')]=_['keys'](_0x4a20d5[_0x3481('0x2d')]);_0xdcacba[_0x3481('0x2e')]=_[_0x3481('0x2f')](_0xdcacba[_0x3481('0x2b')],_0xdcacba[_0x3481('0x2d')]);_0x4a8492[_0x3481('0x30')]=_[_0x3481('0x2f')](_0xdcacba[_0x3481('0x2b')],qs['fields'](_0x4a20d5[_0x3481('0x2d')][_0x3481('0x31')]));_0x4a8492[_0x3481('0x30')]=_0x4a8492['attributes'][_0x3481('0x32')]?_0x4a8492['attributes']:_0xdcacba[_0x3481('0x2b')];if(!_0x4a20d5['query'][_0x3481('0x33')]('nolimit')){_0x4a8492[_0x3481('0x1b')]=qs[_0x3481('0x1b')](_0x4a20d5[_0x3481('0x2d')]['limit']);_0x4a8492[_0x3481('0x1a')]=qs['offset'](_0x4a20d5[_0x3481('0x2d')]['offset']);}_0x4a8492[_0x3481('0x34')]=qs[_0x3481('0x35')](_0x4a20d5[_0x3481('0x2d')][_0x3481('0x35')]);_0x4a8492[_0x3481('0x36')]=qs[_0x3481('0x2e')](_[_0x3481('0x37')](_0x4a20d5[_0x3481('0x2d')],_0xdcacba[_0x3481('0x2e')]),_0x2864f1);if(_0x4a20d5['query'][_0x3481('0x38')]){_0x4a8492['where']=_[_0x3481('0x39')](_0x4a8492[_0x3481('0x36')],{'$or':_[_0x3481('0x2c')](_0x2864f1,function(_0x40fd6f){if(_0x40fd6f['type']!=='VIRTUAL'){var _0x2207fb={};_0x2207fb[_0x40fd6f[_0x3481('0x24')]]={'$like':'%'+_0x4a20d5[_0x3481('0x2d')][_0x3481('0x38')]+'%'};return _0x2207fb;}})});}_0x4a8492=_['merge']({},_0x4a8492,_0x4a20d5[_0x3481('0x3a')]);var _0x3c7874={'where':_0x4a8492[_0x3481('0x36')]};return db[_0x3481('0x27')][_0x3481('0x3b')](_0x3c7874)[_0x3481('0x1f')](function(_0x33c33f){_0x1f079a['count']=_0x33c33f;if(_0x4a20d5[_0x3481('0x2d')][_0x3481('0x3c')]){_0x4a8492[_0x3481('0x3d')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0x4a8492);})[_0x3481('0x1f')](function(_0x420b8c){_0x1f079a[_0x3481('0x3e')]=_0x420b8c;return _0x1f079a;})['then'](respondWithFilteredResult(_0x131363,_0x4a8492))['catch'](handleError(_0x131363,null));};exports[_0x3481('0x3f')]=function(_0x335292,_0x3fc0e7){var _0xbccc9e={'raw':!![],'where':{'id':_0x335292[_0x3481('0x40')]['id']}},_0x5c4928={};_0x5c4928['model']=_[_0x3481('0x41')](db[_0x3481('0x27')][_0x3481('0x28')]);_0x5c4928[_0x3481('0x2d')]=_['keys'](_0x335292['query']);_0x5c4928['filters']=_['intersection'](_0x5c4928[_0x3481('0x2b')],_0x5c4928[_0x3481('0x2d')]);_0xbccc9e[_0x3481('0x30')]=_[_0x3481('0x2f')](_0x5c4928[_0x3481('0x2b')],qs[_0x3481('0x31')](_0x335292[_0x3481('0x2d')][_0x3481('0x31')]));_0xbccc9e[_0x3481('0x30')]=_0xbccc9e[_0x3481('0x30')][_0x3481('0x32')]?_0xbccc9e['attributes']:_0x5c4928['model'];if(_0x335292[_0x3481('0x2d')][_0x3481('0x3c')]){_0xbccc9e[_0x3481('0x3d')]=[{'all':!![]}];}_0xbccc9e=_[_0x3481('0x39')]({},_0xbccc9e,_0x335292['options']);return db[_0x3481('0x27')]['find'](_0xbccc9e)[_0x3481('0x1f')](handleEntityNotFound(_0x3fc0e7,null))[_0x3481('0x1f')](respondWithResult(_0x3fc0e7,null))[_0x3481('0x42')](handleError(_0x3fc0e7,null));};exports[_0x3481('0x43')]=function(_0x30f54e,_0x50dd72){return db[_0x3481('0x27')]['create'](_0x30f54e[_0x3481('0x44')],{})[_0x3481('0x1f')](respondWithResult(_0x50dd72,0xc9))['catch'](handleError(_0x50dd72,null));};exports[_0x3481('0x45')]=function(_0x54ec34,_0x27e106){if(_0x54ec34[_0x3481('0x44')]['id']){delete _0x54ec34[_0x3481('0x44')]['id'];}return db['DeskField']['find']({'where':{'id':_0x54ec34[_0x3481('0x40')]['id']}})[_0x3481('0x1f')](handleEntityNotFound(_0x27e106,null))[_0x3481('0x1f')](saveUpdates(_0x54ec34[_0x3481('0x44')],null))['then'](respondWithResult(_0x27e106,null))[_0x3481('0x42')](handleError(_0x27e106,null));};exports[_0x3481('0x20')]=function(_0xdd5422,_0x4b7598){return db['DeskField'][_0x3481('0x46')]({'where':{'id':_0xdd5422[_0x3481('0x40')]['id']}})['then'](handleEntityNotFound(_0x4b7598,null))[_0x3481('0x1f')](removeEntity(_0x4b7598,null))[_0x3481('0x42')](handleError(_0x4b7598,null));}; \ No newline at end of file +var _0x458a=['to-csv','squel','crypto','jsforce','desk.js','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','merge','where','options','includeAll','include','catch','show','params','create','body','find','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x1a7e14,_0x100435){var _0x53abf8=function(_0x4767ab){while(--_0x4767ab){_0x1a7e14['push'](_0x1a7e14['shift']());}};_0x53abf8(++_0x100435);}(_0x458a,0x110));var _0xa458=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x458a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa458('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa458('0x1'));var rp=require(_0xa458('0x2'));var moment=require('moment');var BPromise=require(_0xa458('0x3'));var Mustache=require(_0xa458('0x4'));var util=require(_0xa458('0x5'));var path=require(_0xa458('0x6'));var sox=require(_0xa458('0x7'));var csv=require(_0xa458('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa458('0x9'));var crypto=require(_0xa458('0xa'));var jsforce=require(_0xa458('0xb'));var deskjs=require(_0xa458('0xc'));var toCsv=require(_0xa458('0x8'));var querystring=require('querystring');var Papa=require(_0xa458('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa458('0xe'))(_0xa458('0xf'));var utils=require(_0xa458('0x10'));var config=require(_0xa458('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xa458('0x12'))['db'];function respondWithStatusCode(_0x4a9294,_0x467897){_0x467897=_0x467897||0xcc;return function(_0x4432c0){if(_0x4432c0){return _0x4a9294[_0xa458('0x13')](_0x467897);}return _0x4a9294[_0xa458('0x14')](_0x467897)[_0xa458('0x15')]();};}function respondWithResult(_0x4bf6e1,_0x160e1b){_0x160e1b=_0x160e1b||0xc8;return function(_0x594171){if(_0x594171){return _0x4bf6e1['status'](_0x160e1b)[_0xa458('0x16')](_0x594171);}};}function respondWithFilteredResult(_0x35d30e,_0x2e3406){return function(_0x509d01){if(_0x509d01){var _0x4b72fd=typeof _0x2e3406[_0xa458('0x17')]===_0xa458('0x18')&&typeof _0x2e3406[_0xa458('0x19')]===_0xa458('0x18');var _0x5b3e77=_0x509d01[_0xa458('0x1a')];var _0x42e015=_0x4b72fd?0x0:_0x2e3406[_0xa458('0x17')];var _0x1c5ad7=_0x4b72fd?_0x509d01[_0xa458('0x1a')]:_0x2e3406['offset']+_0x2e3406[_0xa458('0x19')];var _0x2dd02e;if(_0x1c5ad7>=_0x5b3e77){_0x1c5ad7=_0x5b3e77;_0x2dd02e=0xc8;}else{_0x2dd02e=0xce;}_0x35d30e[_0xa458('0x14')](_0x2dd02e);return _0x35d30e[_0xa458('0x1b')](_0xa458('0x1c'),_0x42e015+'-'+_0x1c5ad7+'/'+_0x5b3e77)['json'](_0x509d01);}return null;};}function patchUpdates(_0x29b4f1){return function(_0x29b298){try{jsonpatch[_0xa458('0x1d')](_0x29b298,_0x29b4f1,!![]);}catch(_0x48f01a){return BPromise[_0xa458('0x1e')](_0x48f01a);}return _0x29b298[_0xa458('0x1f')]();};}function saveUpdates(_0x32657c,_0x2a3b24){return function(_0xa70f6d){if(_0xa70f6d){return _0xa70f6d[_0xa458('0x20')](_0x32657c)['then'](function(_0x5e44d4){return _0x5e44d4;});}return null;};}function removeEntity(_0x4abcad,_0x160889){return function(_0x51031e){if(_0x51031e){return _0x51031e[_0xa458('0x21')]()[_0xa458('0x22')](function(){_0x4abcad[_0xa458('0x14')](0xcc)[_0xa458('0x15')]();});}};}function handleEntityNotFound(_0x49bd8c,_0x461279){return function(_0x6b2530){if(!_0x6b2530){_0x49bd8c['sendStatus'](0x194);}return _0x6b2530;};}function handleError(_0x1cb898,_0x407be8){_0x407be8=_0x407be8||0x1f4;return function(_0x392429){logger[_0xa458('0x23')](_0x392429[_0xa458('0x24')]);if(_0x392429[_0xa458('0x25')]){delete _0x392429['name'];}_0x1cb898[_0xa458('0x14')](_0x407be8)[_0xa458('0x26')](_0x392429);};}exports[_0xa458('0x27')]=function(_0x51f6c6,_0x51a5a0){var _0x4b0984={},_0x5b73d1={},_0x30c396={'count':0x0,'rows':[]};var _0x113b3d=_[_0xa458('0x28')](db[_0xa458('0x29')][_0xa458('0x2a')],function(_0x3309e1){return{'name':_0x3309e1[_0xa458('0x2b')],'type':_0x3309e1[_0xa458('0x2c')][_0xa458('0x2d')]};});_0x5b73d1[_0xa458('0x2e')]=_[_0xa458('0x28')](_0x113b3d,_0xa458('0x25'));_0x5b73d1[_0xa458('0x2f')]=_[_0xa458('0x30')](_0x51f6c6[_0xa458('0x2f')]);_0x5b73d1['filters']=_[_0xa458('0x31')](_0x5b73d1[_0xa458('0x2e')],_0x5b73d1[_0xa458('0x2f')]);_0x4b0984['attributes']=_[_0xa458('0x31')](_0x5b73d1[_0xa458('0x2e')],qs['fields'](_0x51f6c6[_0xa458('0x2f')][_0xa458('0x32')]));_0x4b0984[_0xa458('0x33')]=_0x4b0984[_0xa458('0x33')][_0xa458('0x34')]?_0x4b0984[_0xa458('0x33')]:_0x5b73d1[_0xa458('0x2e')];if(!_0x51f6c6[_0xa458('0x2f')]['hasOwnProperty'](_0xa458('0x35'))){_0x4b0984[_0xa458('0x19')]=qs[_0xa458('0x19')](_0x51f6c6[_0xa458('0x2f')][_0xa458('0x19')]);_0x4b0984['offset']=qs[_0xa458('0x17')](_0x51f6c6[_0xa458('0x2f')][_0xa458('0x17')]);}_0x4b0984[_0xa458('0x36')]=qs[_0xa458('0x37')](_0x51f6c6[_0xa458('0x2f')][_0xa458('0x37')]);_0x4b0984['where']=qs[_0xa458('0x38')](_[_0xa458('0x39')](_0x51f6c6[_0xa458('0x2f')],_0x5b73d1[_0xa458('0x38')]),_0x113b3d);if(_0x51f6c6['query'][_0xa458('0x3a')]){_0x4b0984['where']=_[_0xa458('0x3b')](_0x4b0984[_0xa458('0x3c')],{'$or':_[_0xa458('0x28')](_0x113b3d,function(_0x1f00fc){if(_0x1f00fc['type']!=='VIRTUAL'){var _0x35e171={};_0x35e171[_0x1f00fc[_0xa458('0x25')]]={'$like':'%'+_0x51f6c6[_0xa458('0x2f')][_0xa458('0x3a')]+'%'};return _0x35e171;}})});}_0x4b0984=_[_0xa458('0x3b')]({},_0x4b0984,_0x51f6c6[_0xa458('0x3d')]);var _0x4f1843={'where':_0x4b0984[_0xa458('0x3c')]};return db['DeskField']['count'](_0x4f1843)[_0xa458('0x22')](function(_0x281b40){_0x30c396[_0xa458('0x1a')]=_0x281b40;if(_0x51f6c6[_0xa458('0x2f')][_0xa458('0x3e')]){_0x4b0984[_0xa458('0x3f')]=[{'all':!![]}];}return db[_0xa458('0x29')]['findAll'](_0x4b0984);})[_0xa458('0x22')](function(_0x3d9fd6){_0x30c396['rows']=_0x3d9fd6;return _0x30c396;})[_0xa458('0x22')](respondWithFilteredResult(_0x51a5a0,_0x4b0984))[_0xa458('0x40')](handleError(_0x51a5a0,null));};exports[_0xa458('0x41')]=function(_0x2a0071,_0x245ec2){var _0x414dd6={'raw':!![],'where':{'id':_0x2a0071[_0xa458('0x42')]['id']}},_0x4c2b61={};_0x4c2b61[_0xa458('0x2e')]=_['keys'](db[_0xa458('0x29')]['rawAttributes']);_0x4c2b61['query']=_[_0xa458('0x30')](_0x2a0071[_0xa458('0x2f')]);_0x4c2b61[_0xa458('0x38')]=_[_0xa458('0x31')](_0x4c2b61['model'],_0x4c2b61[_0xa458('0x2f')]);_0x414dd6[_0xa458('0x33')]=_[_0xa458('0x31')](_0x4c2b61[_0xa458('0x2e')],qs['fields'](_0x2a0071['query'][_0xa458('0x32')]));_0x414dd6[_0xa458('0x33')]=_0x414dd6[_0xa458('0x33')]['length']?_0x414dd6[_0xa458('0x33')]:_0x4c2b61['model'];if(_0x2a0071['query'][_0xa458('0x3e')]){_0x414dd6[_0xa458('0x3f')]=[{'all':!![]}];}_0x414dd6=_[_0xa458('0x3b')]({},_0x414dd6,_0x2a0071[_0xa458('0x3d')]);return db[_0xa458('0x29')]['find'](_0x414dd6)[_0xa458('0x22')](handleEntityNotFound(_0x245ec2,null))[_0xa458('0x22')](respondWithResult(_0x245ec2,null))[_0xa458('0x40')](handleError(_0x245ec2,null));};exports['create']=function(_0x4556ee,_0x9156e7){return db[_0xa458('0x29')][_0xa458('0x43')](_0x4556ee['body'],{})[_0xa458('0x22')](respondWithResult(_0x9156e7,0xc9))[_0xa458('0x40')](handleError(_0x9156e7,null));};exports[_0xa458('0x20')]=function(_0x1ce3f4,_0x4f8f9a){if(_0x1ce3f4[_0xa458('0x44')]['id']){delete _0x1ce3f4[_0xa458('0x44')]['id'];}return db[_0xa458('0x29')][_0xa458('0x45')]({'where':{'id':_0x1ce3f4[_0xa458('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f8f9a,null))['then'](saveUpdates(_0x1ce3f4['body'],null))[_0xa458('0x22')](respondWithResult(_0x4f8f9a,null))[_0xa458('0x40')](handleError(_0x4f8f9a,null));};exports[_0xa458('0x21')]=function(_0x492959,_0x3b2e60){return db[_0xa458('0x29')][_0xa458('0x45')]({'where':{'id':_0x492959['params']['id']}})['then'](handleEntityNotFound(_0x3b2e60,null))[_0xa458('0x22')](removeEntity(_0x3b2e60,null))[_0xa458('0x40')](handleError(_0x3b2e60,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 2f676c4..f9924a1 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 _0x5371=['request-promise','../../config/environment','./intDeskField.attributes','define','DeskField','int_desk_fields','desk_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x424e04,_0x44c3d9){var _0x5e08a0=function(_0x3d8d4c){while(--_0x3d8d4c){_0x424e04['push'](_0x424e04['shift']());}};_0x5e08a0(++_0x44c3d9);}(_0x5371,0x68));var _0x1537=function(_0x140dad,_0x1d8c55){_0x140dad=_0x140dad-0x0;var _0x1a3bd4=_0x5371[_0x140dad];return _0x1a3bd4;};'use strict';var _=require(_0x1537('0x0'));var util=require(_0x1537('0x1'));var logger=require(_0x1537('0x2'))(_0x1537('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1537('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1537('0x5'));var attributes=require(_0x1537('0x6'));module['exports']=function(_0x240636,_0x556d50){return _0x240636[_0x1537('0x7')](_0x1537('0x8'),attributes,{'tableName':_0x1537('0x9'),'paranoid':![],'indexes':[{'name':_0x1537('0xa'),'fields':[_0x1537('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x67b4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','DeskField','int_desk_fields','desk_unique_index','idField','FieldId'];(function(_0x789179,_0x455e5f){var _0x10878f=function(_0x450629){while(--_0x450629){_0x789179['push'](_0x789179['shift']());}};_0x10878f(++_0x455e5f);}(_0x67b4,0x168));var _0x467b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x67b4[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x467b('0x0'));var util=require(_0x467b('0x1'));var logger=require(_0x467b('0x2'))(_0x467b('0x3'));var moment=require(_0x467b('0x4'));var BPromise=require(_0x467b('0x5'));var rp=require(_0x467b('0x6'));var fs=require('fs');var path=require(_0x467b('0x7'));var rimraf=require(_0x467b('0x8'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x467b('0x9')]=function(_0x24664d,_0x907655){return _0x24664d['define'](_0x467b('0xa'),attributes,{'tableName':_0x467b('0xb'),'paranoid':![],'indexes':[{'name':_0x467b('0xc'),'fields':[_0x467b('0xd'),_0x467b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 45ac258..ed0278c 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 _0x3ea2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','DeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','DeskField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment'];(function(_0x47415b,_0x578910){var _0x3473e3=function(_0x193f6c){while(--_0x193f6c){_0x47415b['push'](_0x47415b['shift']());}};_0x3473e3(++_0x578910);}(_0x3ea2,0x128));var _0x23ea=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x3ea2[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require(_0x23ea('0x0'));var util=require(_0x23ea('0x1'));var moment=require(_0x23ea('0x2'));var BPromise=require(_0x23ea('0x3'));var rs=require(_0x23ea('0x4'));var fs=require('fs');var Redis=require(_0x23ea('0x5'));var db=require(_0x23ea('0x6'))['db'];var utils=require(_0x23ea('0x7'));var logger=require(_0x23ea('0x8'))(_0x23ea('0x9'));var config=require(_0x23ea('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x23ea('0xb')][_0x23ea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3da1d4,_0x48a170,_0x474c7c){return new BPromise(function(_0x20ac5f,_0x4d6b86){return client['request'](_0x3da1d4,_0x474c7c)[_0x23ea('0xd')](function(_0x43b318){logger['info']('DeskField,\x20%s,\x20%s',_0x48a170,'request\x20sent');logger['debug'](_0x23ea('0xe'),_0x48a170,'request\x20sent',JSON[_0x23ea('0xf')](_0x43b318));if(_0x43b318['error']){if(_0x43b318['error'][_0x23ea('0x10')]===0x1f4){logger[_0x23ea('0x11')](_0x23ea('0x12'),_0x48a170,_0x43b318[_0x23ea('0x11')][_0x23ea('0x13')]);return _0x4d6b86(_0x43b318['error'][_0x23ea('0x13')]);}logger[_0x23ea('0x11')](_0x23ea('0x12'),_0x48a170,_0x43b318[_0x23ea('0x11')][_0x23ea('0x13')]);return _0x20ac5f(_0x43b318['error'][_0x23ea('0x13')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x48a170,_0x23ea('0x14'));_0x20ac5f(_0x43b318[_0x23ea('0x15')][_0x23ea('0x13')]);}})[_0x23ea('0x16')](function(_0x494af9){logger[_0x23ea('0x11')](_0x23ea('0x12'),_0x48a170,_0x494af9);_0x4d6b86(_0x494af9);});});} \ No newline at end of file +var _0x791f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','DeskField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','randomstring'];(function(_0x42ab87,_0x32a18a){var _0x4d51f4=function(_0x2b2351){while(--_0x2b2351){_0x42ab87['push'](_0x42ab87['shift']());}};_0x4d51f4(++_0x32a18a);}(_0x791f,0x139));var _0xf791=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x791f[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require(_0xf791('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf791('0x1'));var fs=require('fs');var Redis=require(_0xf791('0x2'));var db=require(_0xf791('0x3'))['db'];var utils=require(_0xf791('0x4'));var logger=require(_0xf791('0x5'))(_0xf791('0x6'));var config=require(_0xf791('0x7'));var jayson=require(_0xf791('0x8'));var client=jayson[_0xf791('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x416456,_0x90cc9e,_0x48bdb5){return new BPromise(function(_0x5434c5,_0x2ad28a){return client[_0xf791('0xa')](_0x416456,_0x48bdb5)[_0xf791('0xb')](function(_0x329082){logger['info']('DeskField,\x20%s,\x20%s',_0x90cc9e,'request\x20sent');logger[_0xf791('0xc')](_0xf791('0xd'),_0x90cc9e,'request\x20sent',JSON['stringify'](_0x329082));if(_0x329082[_0xf791('0xe')]){if(_0x329082[_0xf791('0xe')][_0xf791('0xf')]===0x1f4){logger[_0xf791('0xe')](_0xf791('0x10'),_0x90cc9e,_0x329082['error'][_0xf791('0x11')]);return _0x2ad28a(_0x329082[_0xf791('0xe')][_0xf791('0x11')]);}logger[_0xf791('0xe')](_0xf791('0x10'),_0x90cc9e,_0x329082['error'][_0xf791('0x11')]);return _0x5434c5(_0x329082[_0xf791('0xe')][_0xf791('0x11')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x90cc9e,_0xf791('0x12'));_0x5434c5(_0x329082[_0xf791('0x13')]['message']);}})[_0xf791('0x14')](function(_0x37af0e){logger[_0xf791('0xe')](_0xf791('0x10'),_0x90cc9e,_0x37af0e);_0x2ad28a(_0x37af0e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index e407feb..b70b3a3 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 _0xe3f4=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','put'];(function(_0x303b2f,_0x86d5d8){var _0x2dd064=function(_0x181252){while(--_0x181252){_0x303b2f['push'](_0x303b2f['shift']());}};_0x2dd064(++_0x86d5d8);}(_0xe3f4,0x163));var _0x4e3f=function(_0x46283c,_0x5b5369){_0x46283c=_0x46283c-0x0;var _0x1360de=_0xe3f4[_0x46283c];return _0x1360de;};'use strict';var multer=require(_0x4e3f('0x0'));var util=require(_0x4e3f('0x1'));var path=require(_0x4e3f('0x2'));var timeout=require(_0x4e3f('0x3'));var express=require(_0x4e3f('0x4'));var router=express[_0x4e3f('0x5')]();var fs_extra=require(_0x4e3f('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4e3f('0x7'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0x4e3f('0x8')](),controller[_0x4e3f('0x9')]);router[_0x4e3f('0xa')](_0x4e3f('0xb'),auth[_0x4e3f('0x8')](),controller[_0x4e3f('0xc')]);router[_0x4e3f('0xa')](_0x4e3f('0xd'),auth[_0x4e3f('0x8')](),controller[_0x4e3f('0xe')]);router[_0x4e3f('0xa')](_0x4e3f('0xf'),auth[_0x4e3f('0x8')](),controller[_0x4e3f('0x10')]);router['post']('/',auth[_0x4e3f('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x4e3f('0x11')]);router[_0x4e3f('0x12')](_0x4e3f('0xb'),auth[_0x4e3f('0x8')](),controller[_0x4e3f('0x13')]);router[_0x4e3f('0x14')](_0x4e3f('0xb'),auth['isAuthenticated'](),controller[_0x4e3f('0x15')]);module['exports']=router; \ No newline at end of file +var _0x8a6b=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','multer','util','path','express','Router'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x8a6b,0xcc));var _0xb8a6=function(_0x3ba908,_0x34ba49){_0x3ba908=_0x3ba908-0x0;var _0x243559=_0x8a6b[_0x3ba908];return _0x243559;};'use strict';var multer=require(_0xb8a6('0x0'));var util=require(_0xb8a6('0x1'));var path=require(_0xb8a6('0x2'));var timeout=require('connect-timeout');var express=require(_0xb8a6('0x3'));var router=express[_0xb8a6('0x4')]();var fs_extra=require(_0xb8a6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb8a6('0x6'));var config=require(_0xb8a6('0x7'));var controller=require('./intDynamics365Account.controller');router[_0xb8a6('0x8')]('/',auth[_0xb8a6('0x9')](),controller[_0xb8a6('0xa')]);router['get']('/:id',auth[_0xb8a6('0x9')](),controller['show']);router[_0xb8a6('0x8')](_0xb8a6('0xb'),auth[_0xb8a6('0x9')](),controller[_0xb8a6('0xc')]);router[_0xb8a6('0x8')](_0xb8a6('0xd'),auth[_0xb8a6('0x9')](),controller[_0xb8a6('0xe')]);router[_0xb8a6('0xf')]('/',auth[_0xb8a6('0x9')](),controller['create']);router[_0xb8a6('0xf')](_0xb8a6('0xb'),auth[_0xb8a6('0x9')](),controller[_0xb8a6('0x10')]);router[_0xb8a6('0x11')](_0xb8a6('0x12'),auth[_0xb8a6('0x9')](),controller['update']);router['delete']('/:id',auth[_0xb8a6('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 3a5c8b9..a5614f0 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 _0xaa64=['STRING','sequelize','exports'];(function(_0x1f898a,_0x40d6c0){var _0x35c3e4=function(_0x12ae6c){while(--_0x12ae6c){_0x1f898a['push'](_0x1f898a['shift']());}};_0x35c3e4(++_0x40d6c0);}(_0xaa64,0xf7));var _0x4aa6=function(_0x112f55,_0x1ea99b){_0x112f55=_0x112f55-0x0;var _0x1f9bee=_0xaa64[_0x112f55];return _0x1f9bee;};'use strict';var Sequelize=require(_0x4aa6('0x0'));module[_0x4aa6('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4aa6('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4aa6('0x2')]},'tenantId':{'type':Sequelize[_0x4aa6('0x2')]},'clientId':{'type':Sequelize[_0x4aa6('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x4aa6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4aa6('0x2')]}}; \ No newline at end of file +var _0xbd1c=['exports','STRING'];(function(_0x13460e,_0x896dd){var _0x272a39=function(_0x260a59){while(--_0x260a59){_0x13460e['push'](_0x13460e['shift']());}};_0x272a39(++_0x896dd);}(_0xbd1c,0x144));var _0xcbd1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbd1c[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0xcbd1('0x0')]={'name':{'type':Sequelize[_0xcbd1('0x1')]},'username':{'type':Sequelize[_0xcbd1('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xcbd1('0x1')]},'tenantId':{'type':Sequelize[_0xcbd1('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xcbd1('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xcbd1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 6480871..1f33ca9 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 _0x28e3=['subjectidname','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','tenantId','clientId','slice','substring','lastIndexOf','format','POST','/oauth2/token','clientSecret','GET','Bearer\x20','4.0','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','forEach','BooleanAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','error','stack','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','fields','attributes','length','order','sort','filters','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','getConfigurations','findOne','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','ticketType','Incident','title','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode'];(function(_0x4753b7,_0x2660d1){var _0x3e6fa9=function(_0x4877c1){while(--_0x4877c1){_0x4753b7['push'](_0x4753b7['shift']());}};_0x3e6fa9(++_0x2660d1);}(_0x28e3,0x106));var _0x328e=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0x28e3[_0x57add2];return _0x4e3670;};'use strict';var emlformat=require(_0x328e('0x0'));var rimraf=require(_0x328e('0x1'));var zipdir=require(_0x328e('0x2'));var jsonpatch=require(_0x328e('0x3'));var rp=require('request-promise');var moment=require(_0x328e('0x4'));var BPromise=require(_0x328e('0x5'));var Mustache=require(_0x328e('0x6'));var util=require(_0x328e('0x7'));var path=require(_0x328e('0x8'));var sox=require(_0x328e('0x9'));var csv=require(_0x328e('0xa'));var ejs=require(_0x328e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x328e('0xc'));var jsforce=require(_0x328e('0xd'));var deskjs=require(_0x328e('0xe'));var toCsv=require(_0x328e('0xa'));var querystring=require(_0x328e('0xf'));var Papa=require('papaparse');var Redis=require(_0x328e('0x10'));var authService=require(_0x328e('0x11'));var qs=require(_0x328e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x328e('0x13'));var utils=require(_0x328e('0x14'));var config=require(_0x328e('0x15'));var licenseUtil=require(_0x328e('0x16'));var db=require(_0x328e('0x17'))['db'];var integrations=require(_0x328e('0x18'));function respondWithStatusCode(_0x4699ec,_0x39338e){_0x39338e=_0x39338e||0xcc;return function(_0x1d3e4a){if(_0x1d3e4a){return _0x4699ec[_0x328e('0x19')](_0x39338e);}return _0x4699ec[_0x328e('0x1a')](_0x39338e)['end']();};}function respondWithResult(_0x89600b,_0x1cddc3){_0x1cddc3=_0x1cddc3||0xc8;return function(_0x1552ce){if(_0x1552ce){return _0x89600b[_0x328e('0x1a')](_0x1cddc3)[_0x328e('0x1b')](_0x1552ce);}};}function respondWithFilteredResult(_0x397b16,_0x2a8096){return function(_0x3c5b37){if(_0x3c5b37){var _0x20901e=typeof _0x2a8096['offset']===_0x328e('0x1c')&&typeof _0x2a8096[_0x328e('0x1d')]===_0x328e('0x1c');var _0x1adadc=_0x3c5b37[_0x328e('0x1e')];var _0x32c7c8=_0x20901e?0x0:_0x2a8096[_0x328e('0x1f')];var _0x47b194=_0x20901e?_0x3c5b37[_0x328e('0x1e')]:_0x2a8096[_0x328e('0x1f')]+_0x2a8096[_0x328e('0x1d')];var _0x39e3c1;if(_0x47b194>=_0x1adadc){_0x47b194=_0x1adadc;_0x39e3c1=0xc8;}else{_0x39e3c1=0xce;}_0x397b16[_0x328e('0x1a')](_0x39e3c1);return _0x397b16['set'](_0x328e('0x20'),_0x32c7c8+'-'+_0x47b194+'/'+_0x1adadc)[_0x328e('0x1b')](_0x3c5b37);}return null;};}function patchUpdates(_0x3d876b){return function(_0x5dcfaa){try{jsonpatch[_0x328e('0x21')](_0x5dcfaa,_0x3d876b,!![]);}catch(_0x3bafb1){return BPromise[_0x328e('0x22')](_0x3bafb1);}return _0x5dcfaa[_0x328e('0x23')]();};}function saveUpdates(_0x233bd3,_0x1c43f8){return function(_0x725a1){if(_0x725a1){return _0x725a1[_0x328e('0x24')](_0x233bd3)[_0x328e('0x25')](function(_0x5cbc7f){return _0x5cbc7f;});}return null;};}function removeEntity(_0x4e1d4c,_0x139ef3){return function(_0x388bc0){if(_0x388bc0){return _0x388bc0[_0x328e('0x26')]()[_0x328e('0x25')](function(){_0x4e1d4c[_0x328e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23fda2,_0x48a854){return function(_0x1cc449){if(!_0x1cc449){_0x23fda2[_0x328e('0x19')](0x194);}return _0x1cc449;};}function handleError(_0x28da22,_0x2fab5a){_0x2fab5a=_0x2fab5a||0x1f4;return function(_0x108f0d){logger['error'](_0x108f0d['stack']);if(_0x108f0d[_0x328e('0x27')]){delete _0x108f0d['name'];}_0x28da22['status'](_0x2fab5a)[_0x328e('0x28')](_0x108f0d);};}exports[_0x328e('0x29')]=function(_0x5873d1,_0x232ec7){var _0x1fdc4d={},_0x4bdadc={},_0x26a204={'count':0x0,'rows':[]};var _0x2448bc=_[_0x328e('0x2a')](db[_0x328e('0x2b')][_0x328e('0x2c')],function(_0x490fa7){return{'name':_0x490fa7[_0x328e('0x2d')],'type':_0x490fa7[_0x328e('0x2e')][_0x328e('0x2f')]};});_0x4bdadc[_0x328e('0x30')]=_[_0x328e('0x2a')](_0x2448bc,_0x328e('0x27'));_0x4bdadc[_0x328e('0x31')]=_[_0x328e('0x32')](_0x5873d1[_0x328e('0x31')]);_0x4bdadc['filters']=_['intersection'](_0x4bdadc[_0x328e('0x30')],_0x4bdadc[_0x328e('0x31')]);_0x1fdc4d['attributes']=_['intersection'](_0x4bdadc['model'],qs[_0x328e('0x33')](_0x5873d1[_0x328e('0x31')][_0x328e('0x33')]));_0x1fdc4d[_0x328e('0x34')]=_0x1fdc4d[_0x328e('0x34')][_0x328e('0x35')]?_0x1fdc4d[_0x328e('0x34')]:_0x4bdadc['model'];if(!_0x5873d1[_0x328e('0x31')]['hasOwnProperty']('nolimit')){_0x1fdc4d[_0x328e('0x1d')]=qs['limit'](_0x5873d1[_0x328e('0x31')][_0x328e('0x1d')]);_0x1fdc4d[_0x328e('0x1f')]=qs['offset'](_0x5873d1[_0x328e('0x31')]['offset']);}_0x1fdc4d[_0x328e('0x36')]=qs[_0x328e('0x37')](_0x5873d1[_0x328e('0x31')][_0x328e('0x37')]);_0x1fdc4d['where']=qs[_0x328e('0x38')](_['pick'](_0x5873d1[_0x328e('0x31')],_0x4bdadc['filters']),_0x2448bc);if(_0x5873d1['query'][_0x328e('0x39')]){_0x1fdc4d['where']=_[_0x328e('0x3a')](_0x1fdc4d[_0x328e('0x3b')],{'$or':_[_0x328e('0x2a')](_0x2448bc,function(_0x467a0b){if(_0x467a0b['type']!==_0x328e('0x3c')){var _0x387941={};_0x387941[_0x467a0b[_0x328e('0x27')]]={'$like':'%'+_0x5873d1[_0x328e('0x31')][_0x328e('0x39')]+'%'};return _0x387941;}})});}_0x1fdc4d=_['merge']({},_0x1fdc4d,_0x5873d1[_0x328e('0x3d')]);var _0x2be20c={'where':_0x1fdc4d[_0x328e('0x3b')]};return db['Dynamics365Account']['count'](_0x2be20c)['then'](function(_0x2e0d9d){_0x26a204['count']=_0x2e0d9d;if(_0x5873d1[_0x328e('0x31')][_0x328e('0x3e')]){_0x1fdc4d['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0x328e('0x3f')](_0x1fdc4d);})[_0x328e('0x25')](function(_0x32fea8){_0x26a204[_0x328e('0x40')]=_0x32fea8;return _0x26a204;})[_0x328e('0x25')](respondWithFilteredResult(_0x232ec7,_0x1fdc4d))[_0x328e('0x41')](handleError(_0x232ec7,null));};exports[_0x328e('0x42')]=function(_0x1c94e9,_0x2a823e){var _0xdf4229={'raw':![],'where':{'id':_0x1c94e9[_0x328e('0x43')]['id']}},_0x27049f={};_0x27049f['model']=_[_0x328e('0x32')](db['Dynamics365Account']['rawAttributes']);_0x27049f[_0x328e('0x31')]=_[_0x328e('0x32')](_0x1c94e9[_0x328e('0x31')]);_0x27049f['filters']=_[_0x328e('0x44')](_0x27049f[_0x328e('0x30')],_0x27049f[_0x328e('0x31')]);_0xdf4229[_0x328e('0x34')]=_[_0x328e('0x44')](_0x27049f[_0x328e('0x30')],qs[_0x328e('0x33')](_0x1c94e9['query']['fields']));_0xdf4229[_0x328e('0x34')]=_0xdf4229[_0x328e('0x34')]['length']?_0xdf4229[_0x328e('0x34')]:_0x27049f[_0x328e('0x30')];if(_0x1c94e9[_0x328e('0x31')]['includeAll']){_0xdf4229[_0x328e('0x45')]=[{'all':!![]}];}_0xdf4229=_[_0x328e('0x3a')]({},_0xdf4229,_0x1c94e9[_0x328e('0x3d')]);return db[_0x328e('0x2b')][_0x328e('0x46')](_0xdf4229)[_0x328e('0x25')](handleEntityNotFound(_0x2a823e,null))[_0x328e('0x25')](respondWithResult(_0x2a823e,null))['catch'](handleError(_0x2a823e,null));};exports[_0x328e('0x47')]=function(_0x13ac38,_0x44470b){return db['Dynamics365Account'][_0x328e('0x47')](_0x13ac38[_0x328e('0x48')],{})[_0x328e('0x25')](respondWithResult(_0x44470b,0xc9))[_0x328e('0x41')](handleError(_0x44470b,null));};exports[_0x328e('0x24')]=function(_0x294945,_0x2b83bd){if(_0x294945['body']['id']){delete _0x294945[_0x328e('0x48')]['id'];}return db[_0x328e('0x2b')][_0x328e('0x46')]({'where':{'id':_0x294945[_0x328e('0x43')]['id']}})[_0x328e('0x25')](handleEntityNotFound(_0x2b83bd,null))[_0x328e('0x25')](saveUpdates(_0x294945[_0x328e('0x48')],null))['then'](respondWithResult(_0x2b83bd,null))['catch'](handleError(_0x2b83bd,null));};exports['destroy']=function(_0xcad004,_0x25b8a6){return db[_0x328e('0x2b')][_0x328e('0x46')]({'where':{'id':_0xcad004['params']['id']}})[_0x328e('0x25')](handleEntityNotFound(_0x25b8a6,null))['then'](removeEntity(_0x25b8a6,null))[_0x328e('0x41')](handleError(_0x25b8a6,null));};exports[_0x328e('0x49')]=function(_0x287ea4,_0x30064b,_0x2d07ae){var _0x310098={};var _0x5c5408={};var _0x1bdc0c;var _0x3b78c3;return db[_0x328e('0x2b')][_0x328e('0x4a')]({'where':{'id':_0x287ea4['params']['id']}})['then'](handleEntityNotFound(_0x30064b,null))[_0x328e('0x25')](function(_0x167e7e){if(_0x167e7e){_0x1bdc0c=_0x167e7e;_0x5c5408[_0x328e('0x30')]=_[_0x328e('0x32')](db['Dynamics365Configuration']['rawAttributes']);_0x5c5408['query']=_[_0x328e('0x32')](_0x287ea4[_0x328e('0x31')]);_0x5c5408[_0x328e('0x38')]=_[_0x328e('0x44')](_0x5c5408[_0x328e('0x30')],_0x5c5408[_0x328e('0x31')]);_0x310098[_0x328e('0x34')]=_[_0x328e('0x44')](_0x5c5408[_0x328e('0x30')],qs[_0x328e('0x33')](_0x287ea4[_0x328e('0x31')][_0x328e('0x33')]));_0x310098[_0x328e('0x34')]=_0x310098[_0x328e('0x34')]['length']?_0x310098['attributes']:_0x5c5408['model'];_0x310098[_0x328e('0x36')]=qs[_0x328e('0x37')](_0x287ea4[_0x328e('0x31')]['sort']);_0x310098[_0x328e('0x3b')]=qs[_0x328e('0x38')](_[_0x328e('0x4b')](_0x287ea4[_0x328e('0x31')],_0x5c5408[_0x328e('0x38')]));if(_0x287ea4[_0x328e('0x31')][_0x328e('0x39')]){_0x310098[_0x328e('0x3b')]=_[_0x328e('0x3a')](_0x310098[_0x328e('0x3b')],{'$or':_[_0x328e('0x2a')](_0x310098[_0x328e('0x34')],function(_0x48312a){var _0x518b28={};_0x518b28[_0x48312a]={'$like':'%'+_0x287ea4['query'][_0x328e('0x39')]+'%'};return _0x518b28;})});}_0x310098=_['merge']({},_0x310098,_0x287ea4[_0x328e('0x3d')]);return _0x1bdc0c[_0x328e('0x49')](_0x310098);}})[_0x328e('0x25')](function(_0x334807){if(_0x334807){_0x3b78c3=_0x334807[_0x328e('0x35')];if(!_0x287ea4[_0x328e('0x31')]['hasOwnProperty'](_0x328e('0x4c'))){_0x310098[_0x328e('0x1d')]=qs[_0x328e('0x1d')](_0x287ea4['query'][_0x328e('0x1d')]);_0x310098[_0x328e('0x1f')]=qs[_0x328e('0x1f')](_0x287ea4['query'][_0x328e('0x1f')]);}return _0x1bdc0c[_0x328e('0x49')](_0x310098);}})[_0x328e('0x25')](function(_0x2bc0c8){if(_0x2bc0c8){return _0x2bc0c8?{'count':_0x3b78c3,'rows':_0x2bc0c8}:null;}})[_0x328e('0x25')](respondWithResult(_0x30064b,null))['catch'](handleError(_0x30064b,null));};exports[_0x328e('0x4d')]=function(_0x305f66,_0x128c9f,_0xda6eaa){if(_0x305f66[_0x328e('0x48')]['id']){delete _0x305f66[_0x328e('0x48')]['id'];}return db[_0x328e('0x2b')]['findOne']({'where':{'id':_0x305f66[_0x328e('0x43')]['id']}})['then'](handleEntityNotFound(_0x128c9f,null))['then'](function(_0x191bf9){if(_0x191bf9){_0x305f66[_0x328e('0x48')][_0x328e('0x4e')]=_0x191bf9['id'];_0x305f66[_0x328e('0x48')][_0x328e('0x4f')]=integrations[_0x328e('0x50')](_0x305f66['body'][_0x328e('0x51')],_0x305f66[_0x328e('0x48')]['type']);_0x305f66[_0x328e('0x48')][_0x328e('0x52')]=integrations['getDescriptions'](_0x305f66[_0x328e('0x48')][_0x328e('0x51')],_0x305f66[_0x328e('0x48')][_0x328e('0x2e')]);return db['Dynamics365Configuration'][_0x328e('0x47')](_0x305f66[_0x328e('0x48')],{'include':[{'model':db[_0x328e('0x53')],'as':_0x328e('0x4f')},{'model':db[_0x328e('0x53')],'as':_0x328e('0x52')}]});}return null;})[_0x328e('0x25')](respondWithResult(_0x128c9f,null))[_0x328e('0x41')](handleError(_0x128c9f,null));};exports['getFields']=function(_0x22e4ce,_0x5e6999,_0x5b6edb){var _0x1e4744=_0x22e4ce[_0x328e('0x31')][_0x328e('0x54')];var _0x31ceb3=_0x1e4744==='incident'?_0x328e('0x55'):'PhoneCall';var _0x4b9417='';var _0x42e047='';var _0xcb0d44='';var _0x3df494='';var _0x3cf16f='';var _0x1dd3a7='';var _0x4c4d31='';var _0x5553f5='';var _0x4d5d15=[_0x328e('0x56'),'description',_0x328e('0x57'),_0x328e('0x58'),_0x328e('0x59'),_0x328e('0x5a'),_0x328e('0x5b'),_0x328e('0x5c'),_0x328e('0x5d'),'phonecall_activity_parties'];var _0x3085d4=[_0x328e('0x5e'),_0x328e('0x5f'),_0x328e('0x60'),'billedserviceunits',_0x328e('0x61'),_0x328e('0x62'),_0x328e('0x63'),'contractidname',_0x328e('0x64'),_0x328e('0x65'),'createdbyname',_0x328e('0x66'),_0x328e('0x67'),_0x328e('0x68'),_0x328e('0x69'),_0x328e('0x6a'),_0x328e('0x6b'),_0x328e('0x6c'),_0x328e('0x6d'),'entitlementidname',_0x328e('0x6e'),_0x328e('0x6f'),_0x328e('0x70'),'exchangerate',_0x328e('0x71'),_0x328e('0x72'),_0x328e('0x73'),_0x328e('0x74'),_0x328e('0x75'),_0x328e('0x76'),_0x328e('0x77'),_0x328e('0x78'),'modifiedbyexternalpartyyominame',_0x328e('0x79'),_0x328e('0x7a'),_0x328e('0x7b'),_0x328e('0x7c'),'modifiedonbehalfbyyominame',_0x328e('0x7d'),_0x328e('0x7e'),_0x328e('0x7f'),'onholdtime',_0x328e('0x80'),_0x328e('0x81'),_0x328e('0x82'),'owneridyominame',_0x328e('0x83'),_0x328e('0x84'),_0x328e('0x85'),_0x328e('0x86'),_0x328e('0x87'),'productserialnumber','resolveby','resolvebykpiidname','responseby',_0x328e('0x88'),_0x328e('0x89'),_0x328e('0x8a'),_0x328e('0x8b'),_0x328e('0x8c'),_0x328e('0x8d'),_0x328e('0x8e'),_0x328e('0x8f'),_0x328e('0x90'),'ticketnumber',_0x328e('0x91'),_0x328e('0x92'),'traversedpath',_0x328e('0x93'),_0x328e('0x94')];var _0x15895f=_0x4d5d15[_0x328e('0x95')](_0x3085d4);return db[_0x328e('0x2b')][_0x328e('0x4a')]({'where':{'id':_0x22e4ce[_0x328e('0x43')]['id']},'attributes':['id',_0x328e('0x96'),_0x328e('0x97'),'remoteUri',_0x328e('0x98'),_0x328e('0x99'),'clientSecret']})[_0x328e('0x25')](handleEntityNotFound(_0x5e6999,null))['then'](function(_0x5d650e){if(_0x5d650e){_0x5553f5=_0x5d650e['remoteUri'];var _0x3ab8ca=_0x5553f5[_0x328e('0x9a')](-0x1);if(_0x3ab8ca==='/'){_0x5553f5=_0x5553f5[_0x328e('0x9b')](0x0,_0x5553f5[_0x328e('0x9c')](_0x3ab8ca));}_0x4c4d31=util[_0x328e('0x9d')]('%s/api/data/v9.0/',_0x5553f5);var _0x69191b={'method':_0x328e('0x9e'),'uri':'https://login.microsoftonline.com/'+_0x5d650e[_0x328e('0x98')]+_0x328e('0x9f'),'form':{'client_id':_0x5d650e[_0x328e('0x99')],'resource':_0x5553f5,'username':_0x5d650e[_0x328e('0x96')],'password':_0x5d650e[_0x328e('0x97')],'grant_type':'password','client_secret':_0x5d650e[_0x328e('0xa0')]},'json':!![]};return rp(_0x69191b);}})[_0x328e('0x25')](function(_0x3c5a6e){_0x1dd3a7=_0x3c5a6e['access_token'];var _0x387366={'method':_0x328e('0xa1'),'uri':encodeURI(_0x4c4d31+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x31ceb3+'\x27'),'headers':{'Authorization':_0x328e('0xa2')+_0x1dd3a7,'If-None-Match':null,'OData-Version':_0x328e('0xa3')},'json':!![]};return rp(_0x387366);})['then'](function(_0x50c33f){var _0x397643=_0x50c33f[_0x328e('0xa4')][0x0];var _0x1be85b=_0x397643['MetadataId'];var _0x48b095={'method':'GET','uri':_0x4c4d31+_0x328e('0xa5')+_0x1be85b+_0x328e('0xa6'),'headers':{'Authorization':_0x328e('0xa2')+_0x1dd3a7,'If-None-Match':null,'OData-Version':_0x328e('0xa3')},'json':!![]};return rp(_0x48b095);})[_0x328e('0x25')](function(_0x5103b1){_0x4b9417=_0x5103b1;_0x42e047=_0x4b9417[_0x328e('0xa7')];_0x42e047=_[_0x328e('0xa8')](_0x42e047,function(_0x21bfe1){return!_0x15895f[_0x328e('0xa9')](_0x21bfe1[_0x328e('0xaa')]);});var _0x4f72b0=[];var _0x48333e=[];_0x42e047['forEach'](function(_0x3688d1){if(_0x3688d1[_0x328e('0xab')]){var _0x18afde=_0x3688d1[_0x328e('0xab')][_0x328e('0x9b')](_0x3688d1[_0x328e('0xab')][_0x328e('0x9c')]('.')+0x1);if(_0x18afde===_0x328e('0xac')){_0x4f72b0[_0x328e('0xad')](getSelectList(_0x4c4d31,_0x1e4744,_0x48333e,_0x4b9417[_0x328e('0xae')],_0x3688d1[_0x328e('0xae')],_0x1dd3a7));}}});return Promise[_0x328e('0xaf')](_0x4f72b0);})[_0x328e('0x25')](function(_0x1225c8){_0xcb0d44=_0x1225c8[0x0];var _0x4bec11=[];var _0x5267a4=[];_0x42e047[_0x328e('0xb0')](function(_0x5b35a4){if(!_['isNil'](_0x5b35a4[_0x328e('0xab')])){var _0x37f391=_0x5b35a4[_0x328e('0xab')]['substring'](_0x5b35a4['@odata.type'][_0x328e('0x9c')]('.')+0x1);if(_0x37f391===_0x328e('0xb1')){_0x4bec11[_0x328e('0xad')](getBooleanList(_0x4c4d31,_0x1e4744,_0x5267a4,_0x4b9417['MetadataId'],_0x5b35a4['MetadataId'],_0x1dd3a7));}}});return Promise['all'](_0x4bec11);})['then'](function(_0x19f7d3){_0x3df494=_0x19f7d3[0x0];var _0x1fd2c1=[];var _0x1c17ea=[];_0x42e047[_0x328e('0xb0')](function(_0x15a100){if(_0x15a100[_0x328e('0xab')]){var _0x9bb78d=_0x15a100[_0x328e('0xab')][_0x328e('0x9b')](_0x15a100[_0x328e('0xab')][_0x328e('0x9c')]('.')+0x1);if(_0x9bb78d==='StringAttributeMetadata'||_0x9bb78d==='DoubleAttributeMetadata'||_0x9bb78d===_0x328e('0xb2')||_0x9bb78d===_0x328e('0xb3')||_0x9bb78d===_0x328e('0xb4')||_0x9bb78d===_0x328e('0xb5')||_0x9bb78d===_0x328e('0xb6')||_0x9bb78d===_0x328e('0xb7')||_0x9bb78d===_0x328e('0xb8')||_0x9bb78d===_0x328e('0xb9')){_0x1fd2c1['push'](getInputList(_0x4c4d31,_0x1e4744,_0x9bb78d,_0x1c17ea,_0x4b9417[_0x328e('0xae')],_0x15a100[_0x328e('0xae')],_0x1dd3a7));}}});return Promise[_0x328e('0xaf')](_0x1fd2c1);})[_0x328e('0x25')](function(_0x26fc84){_0x3cf16f=_0x26fc84[0x0];var _0x189567=_0xcb0d44[_0x328e('0x95')](_0x3df494)[_0x328e('0x95')](_0x3cf16f);var _0x3a9cc1={'count':_0x189567[_0x328e('0x35')],'rows':_0x189567};return _0x3a9cc1;})['then'](respondWithResult(_0x5e6999,null))['catch'](function(_0x5812e5){var _0x39e43d=_0x22e4ce[_0x328e('0x31')]['test']?0x1f4:_0x5812e5[_0x328e('0xba')]||0x1f4;logger[_0x328e('0xbb')](_0x5812e5[_0x328e('0xbc')]);delete _0x5812e5[_0x328e('0x27')];if(_0x39e43d===0x191){_0x39e43d=0x190;}_0x5e6999[_0x328e('0x1a')](_0x39e43d)[_0x328e('0x28')](_0x22e4ce[_0x328e('0x31')]['test']?{'message':_0x328e('0xbd'),'statusCode':_0x5812e5[_0x328e('0xba')]}:_0x5812e5);});};function getSelectList(_0x234276,_0x305cee,_0x10df7f,_0x3125b2,_0x5ad3ea,_0x26e5f0){var _0xaba678={'method':_0x328e('0xa1'),'uri':_0x234276+_0x328e('0xa5')+_0x3125b2+_0x328e('0xbe')+_0x5ad3ea+_0x328e('0xbf')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x328e('0xa2')+_0x26e5f0,'If-None-Match':null,'OData-Version':_0x328e('0xa3')},'json':!![]};return rp(_0xaba678)[_0x328e('0x25')](function(_0x2f839d){var _0x5c4e82=[];var _0x3f2614=_0x2f839d['OptionSet'][_0x328e('0xc0')];_0x3f2614[_0x328e('0xb0')](function(_0x279a86){_0x5c4e82[_0x328e('0xad')]({'name':_0x279a86[_0x328e('0xc1')][_0x328e('0xc2')]['Label'],'value':String(_0x279a86['Value'])});});var _0x255f75={'id':_0x305cee+'_'+_0x2f839d['LogicalName'],'name':_0x2f839d[_0x328e('0xc3')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x5c4e82};_0x10df7f['push'](_0x255f75);return _0x10df7f;});}function getBooleanList(_0x578050,_0x278cb2,_0x2a2b13,_0x27086c,_0xc33855,_0x260712){var _0x172b4b={'method':_0x328e('0xa1'),'uri':_0x578050+_0x328e('0xa5')+_0x27086c+_0x328e('0xbe')+_0xc33855+_0x328e('0xc4'),'headers':{'Authorization':_0x328e('0xa2')+_0x260712,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x172b4b)[_0x328e('0x25')](function(_0x5206db){var _0x2b9993=[];_0x2b9993['push']({'name':_0x5206db[_0x328e('0xc5')]['TrueOption'][_0x328e('0xc1')][_0x328e('0xc2')][_0x328e('0xc1')],'value':_0x328e('0xc6')},{'name':_0x5206db[_0x328e('0xc5')][_0x328e('0xc7')]['Label'][_0x328e('0xc2')]['Label'],'value':_0x328e('0xc8')});var _0x50a937={'id':_0x278cb2+'_'+_0x5206db[_0x328e('0xaa')],'name':_0x5206db[_0x328e('0xc3')][_0x328e('0xc2')][_0x328e('0xc1')],'custom':![],'options':_0x2b9993};_0x2a2b13['push'](_0x50a937);return _0x2a2b13;});}function getInputList(_0x1e5bc2,_0x3942cb,_0x11918f,_0x29568e,_0x5be9d8,_0x3d8a80,_0xa384ca){var _0x5366c6={'method':_0x328e('0xa1'),'uri':_0x1e5bc2+_0x328e('0xa5')+_0x5be9d8+_0x328e('0xbe')+_0x3d8a80+_0x328e('0xc9')+_0x11918f+_0x328e('0xca'),'headers':{'Authorization':'Bearer\x20'+_0xa384ca,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5366c6)[_0x328e('0x25')](function(_0x373266){var _0x46c072={'id':_0x3942cb+'_'+_0x373266[_0x328e('0xaa')],'name':_0x373266['DisplayName'][_0x328e('0xc2')]?_0x373266['DisplayName'][_0x328e('0xc2')][_0x328e('0xc1')]:_0x373266[_0x328e('0xaa')],'custom':![],'options':[]};_0x29568e[_0x328e('0xad')](_0x46c072);return _0x29568e;});} \ No newline at end of file +var _0xcabc=['nolimit','order','sort','where','filters','pick','filter','merge','options','Dynamics365Account','includeAll','include','findAll','rows','params','keys','intersection','length','find','create','catch','body','getConfigurations','Dynamics365Configuration','hasOwnProperty','addConfiguration','findOne','AccountId','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','caseorigincode','subject','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','password','remoteUri','tenantId','clientId','slice','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','username','clientSecret','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','concat','test','statusCode','Wrong\x20credentials','GET','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','DisplayName','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false','LogicalName',')/Microsoft.Dynamics.CRM.','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','attributes','fields'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0xcabc,0x16a));var _0xccab=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xcabc[_0x46698a];return _0x356db0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xccab('0x0'));var zipdir=require(_0xccab('0x1'));var jsonpatch=require(_0xccab('0x2'));var rp=require(_0xccab('0x3'));var moment=require(_0xccab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xccab('0x5'));var util=require(_0xccab('0x6'));var path=require('path');var sox=require(_0xccab('0x7'));var csv=require(_0xccab('0x8'));var ejs=require(_0xccab('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xccab('0xa'));var squel=require(_0xccab('0xb'));var crypto=require(_0xccab('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xccab('0xd'));var toCsv=require(_0xccab('0x8'));var querystring=require('querystring');var Papa=require(_0xccab('0xe'));var Redis=require(_0xccab('0xf'));var authService=require(_0xccab('0x10'));var qs=require(_0xccab('0x11'));var as=require(_0xccab('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xccab('0x13'));var utils=require(_0xccab('0x14'));var config=require(_0xccab('0x15'));var licenseUtil=require(_0xccab('0x16'));var db=require(_0xccab('0x17'))['db'];var integrations=require(_0xccab('0x18'));function respondWithStatusCode(_0xe41548,_0x5a70ab){_0x5a70ab=_0x5a70ab||0xcc;return function(_0x100bc8){if(_0x100bc8){return _0xe41548[_0xccab('0x19')](_0x5a70ab);}return _0xe41548['status'](_0x5a70ab)[_0xccab('0x1a')]();};}function respondWithResult(_0x4f0643,_0x55c22c){_0x55c22c=_0x55c22c||0xc8;return function(_0x2c2cc8){if(_0x2c2cc8){return _0x4f0643[_0xccab('0x1b')](_0x55c22c)[_0xccab('0x1c')](_0x2c2cc8);}};}function respondWithFilteredResult(_0x48b567,_0x3c3be9){return function(_0x45bdec){if(_0x45bdec){var _0x5afd11=typeof _0x3c3be9[_0xccab('0x1d')]===_0xccab('0x1e')&&typeof _0x3c3be9[_0xccab('0x1f')]===_0xccab('0x1e');var _0x13409f=_0x45bdec['count'];var _0x4ba1c2=_0x5afd11?0x0:_0x3c3be9[_0xccab('0x1d')];var _0x5e1eeb=_0x5afd11?_0x45bdec[_0xccab('0x20')]:_0x3c3be9[_0xccab('0x1d')]+_0x3c3be9[_0xccab('0x1f')];var _0x4ab126;if(_0x5e1eeb>=_0x13409f){_0x5e1eeb=_0x13409f;_0x4ab126=0xc8;}else{_0x4ab126=0xce;}_0x48b567['status'](_0x4ab126);return _0x48b567[_0xccab('0x21')](_0xccab('0x22'),_0x4ba1c2+'-'+_0x5e1eeb+'/'+_0x13409f)[_0xccab('0x1c')](_0x45bdec);}return null;};}function patchUpdates(_0x4bd8d4){return function(_0x3b2e0){try{jsonpatch['apply'](_0x3b2e0,_0x4bd8d4,!![]);}catch(_0x333e25){return BPromise[_0xccab('0x23')](_0x333e25);}return _0x3b2e0['save']();};}function saveUpdates(_0x32c852,_0x1fbb90){return function(_0x436675){if(_0x436675){return _0x436675[_0xccab('0x24')](_0x32c852)[_0xccab('0x25')](function(_0x111fde){return _0x111fde;});}return null;};}function removeEntity(_0x21c81d,_0x427654){return function(_0x325683){if(_0x325683){return _0x325683[_0xccab('0x26')]()['then'](function(){_0x21c81d[_0xccab('0x1b')](0xcc)[_0xccab('0x1a')]();});}};}function handleEntityNotFound(_0x58e32b,_0x41370b){return function(_0x40b88c){if(!_0x40b88c){_0x58e32b[_0xccab('0x19')](0x194);}return _0x40b88c;};}function handleError(_0x1a4e43,_0x3a6b2e){_0x3a6b2e=_0x3a6b2e||0x1f4;return function(_0x41a9ff){logger[_0xccab('0x27')](_0x41a9ff[_0xccab('0x28')]);if(_0x41a9ff[_0xccab('0x29')]){delete _0x41a9ff[_0xccab('0x29')];}_0x1a4e43[_0xccab('0x1b')](_0x3a6b2e)[_0xccab('0x2a')](_0x41a9ff);};}exports[_0xccab('0x2b')]=function(_0x381550,_0x2edd0e){var _0x523ca8={},_0x164b7f={},_0x3bbed1={'count':0x0,'rows':[]};var _0x55da33=_[_0xccab('0x2c')](db['Dynamics365Account'][_0xccab('0x2d')],function(_0x2c13b1){return{'name':_0x2c13b1[_0xccab('0x2e')],'type':_0x2c13b1[_0xccab('0x2f')]['key']};});_0x164b7f[_0xccab('0x30')]=_[_0xccab('0x2c')](_0x55da33,_0xccab('0x29'));_0x164b7f[_0xccab('0x31')]=_['keys'](_0x381550[_0xccab('0x31')]);_0x164b7f['filters']=_['intersection'](_0x164b7f[_0xccab('0x30')],_0x164b7f['query']);_0x523ca8[_0xccab('0x32')]=_['intersection'](_0x164b7f[_0xccab('0x30')],qs['fields'](_0x381550[_0xccab('0x31')][_0xccab('0x33')]));_0x523ca8[_0xccab('0x32')]=_0x523ca8[_0xccab('0x32')]['length']?_0x523ca8[_0xccab('0x32')]:_0x164b7f[_0xccab('0x30')];if(!_0x381550[_0xccab('0x31')]['hasOwnProperty'](_0xccab('0x34'))){_0x523ca8[_0xccab('0x1f')]=qs[_0xccab('0x1f')](_0x381550['query'][_0xccab('0x1f')]);_0x523ca8['offset']=qs[_0xccab('0x1d')](_0x381550['query'][_0xccab('0x1d')]);}_0x523ca8[_0xccab('0x35')]=qs['sort'](_0x381550[_0xccab('0x31')][_0xccab('0x36')]);_0x523ca8[_0xccab('0x37')]=qs[_0xccab('0x38')](_[_0xccab('0x39')](_0x381550[_0xccab('0x31')],_0x164b7f[_0xccab('0x38')]),_0x55da33);if(_0x381550['query'][_0xccab('0x3a')]){_0x523ca8['where']=_['merge'](_0x523ca8['where'],{'$or':_[_0xccab('0x2c')](_0x55da33,function(_0xf807e5){if(_0xf807e5[_0xccab('0x2f')]!=='VIRTUAL'){var _0x1623d2={};_0x1623d2[_0xf807e5[_0xccab('0x29')]]={'$like':'%'+_0x381550[_0xccab('0x31')][_0xccab('0x3a')]+'%'};return _0x1623d2;}})});}_0x523ca8=_[_0xccab('0x3b')]({},_0x523ca8,_0x381550[_0xccab('0x3c')]);var _0x4bc9be={'where':_0x523ca8['where']};return db[_0xccab('0x3d')][_0xccab('0x20')](_0x4bc9be)[_0xccab('0x25')](function(_0x80f764){_0x3bbed1['count']=_0x80f764;if(_0x381550[_0xccab('0x31')][_0xccab('0x3e')]){_0x523ca8[_0xccab('0x3f')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xccab('0x40')](_0x523ca8);})[_0xccab('0x25')](function(_0x254acf){_0x3bbed1[_0xccab('0x41')]=_0x254acf;return _0x3bbed1;})[_0xccab('0x25')](respondWithFilteredResult(_0x2edd0e,_0x523ca8))['catch'](handleError(_0x2edd0e,null));};exports['show']=function(_0x488f2e,_0x159d25){var _0xbb708c={'raw':![],'where':{'id':_0x488f2e[_0xccab('0x42')]['id']}},_0x53ab13={};_0x53ab13[_0xccab('0x30')]=_[_0xccab('0x43')](db[_0xccab('0x3d')][_0xccab('0x2d')]);_0x53ab13['query']=_[_0xccab('0x43')](_0x488f2e[_0xccab('0x31')]);_0x53ab13['filters']=_[_0xccab('0x44')](_0x53ab13[_0xccab('0x30')],_0x53ab13['query']);_0xbb708c['attributes']=_[_0xccab('0x44')](_0x53ab13[_0xccab('0x30')],qs[_0xccab('0x33')](_0x488f2e[_0xccab('0x31')]['fields']));_0xbb708c['attributes']=_0xbb708c[_0xccab('0x32')][_0xccab('0x45')]?_0xbb708c['attributes']:_0x53ab13['model'];if(_0x488f2e['query'][_0xccab('0x3e')]){_0xbb708c[_0xccab('0x3f')]=[{'all':!![]}];}_0xbb708c=_['merge']({},_0xbb708c,_0x488f2e[_0xccab('0x3c')]);return db[_0xccab('0x3d')][_0xccab('0x46')](_0xbb708c)['then'](handleEntityNotFound(_0x159d25,null))[_0xccab('0x25')](respondWithResult(_0x159d25,null))['catch'](handleError(_0x159d25,null));};exports[_0xccab('0x47')]=function(_0xe3a3b8,_0x49a9bc){return db[_0xccab('0x3d')][_0xccab('0x47')](_0xe3a3b8['body'],{})[_0xccab('0x25')](respondWithResult(_0x49a9bc,0xc9))[_0xccab('0x48')](handleError(_0x49a9bc,null));};exports[_0xccab('0x24')]=function(_0x1c56fb,_0x28130b){if(_0x1c56fb[_0xccab('0x49')]['id']){delete _0x1c56fb['body']['id'];}return db[_0xccab('0x3d')]['find']({'where':{'id':_0x1c56fb[_0xccab('0x42')]['id']}})[_0xccab('0x25')](handleEntityNotFound(_0x28130b,null))[_0xccab('0x25')](saveUpdates(_0x1c56fb[_0xccab('0x49')],null))[_0xccab('0x25')](respondWithResult(_0x28130b,null))[_0xccab('0x48')](handleError(_0x28130b,null));};exports['destroy']=function(_0x2ca8c6,_0xff5097){return db['Dynamics365Account'][_0xccab('0x46')]({'where':{'id':_0x2ca8c6[_0xccab('0x42')]['id']}})[_0xccab('0x25')](handleEntityNotFound(_0xff5097,null))['then'](removeEntity(_0xff5097,null))['catch'](handleError(_0xff5097,null));};exports[_0xccab('0x4a')]=function(_0x1804f5,_0x21a0e8,_0x4f3631){var _0x30db8c={};var _0x521c6f={};var _0x342c00;var _0x46a4b8;return db['Dynamics365Account']['findOne']({'where':{'id':_0x1804f5['params']['id']}})['then'](handleEntityNotFound(_0x21a0e8,null))['then'](function(_0x59bb17){if(_0x59bb17){_0x342c00=_0x59bb17;_0x521c6f[_0xccab('0x30')]=_[_0xccab('0x43')](db[_0xccab('0x4b')]['rawAttributes']);_0x521c6f[_0xccab('0x31')]=_[_0xccab('0x43')](_0x1804f5[_0xccab('0x31')]);_0x521c6f[_0xccab('0x38')]=_[_0xccab('0x44')](_0x521c6f[_0xccab('0x30')],_0x521c6f[_0xccab('0x31')]);_0x30db8c[_0xccab('0x32')]=_[_0xccab('0x44')](_0x521c6f[_0xccab('0x30')],qs[_0xccab('0x33')](_0x1804f5[_0xccab('0x31')]['fields']));_0x30db8c[_0xccab('0x32')]=_0x30db8c['attributes'][_0xccab('0x45')]?_0x30db8c[_0xccab('0x32')]:_0x521c6f['model'];_0x30db8c['order']=qs[_0xccab('0x36')](_0x1804f5[_0xccab('0x31')][_0xccab('0x36')]);_0x30db8c['where']=qs[_0xccab('0x38')](_[_0xccab('0x39')](_0x1804f5[_0xccab('0x31')],_0x521c6f[_0xccab('0x38')]));if(_0x1804f5[_0xccab('0x31')][_0xccab('0x3a')]){_0x30db8c['where']=_[_0xccab('0x3b')](_0x30db8c[_0xccab('0x37')],{'$or':_[_0xccab('0x2c')](_0x30db8c[_0xccab('0x32')],function(_0x1790d7){var _0x5100cf={};_0x5100cf[_0x1790d7]={'$like':'%'+_0x1804f5[_0xccab('0x31')][_0xccab('0x3a')]+'%'};return _0x5100cf;})});}_0x30db8c=_[_0xccab('0x3b')]({},_0x30db8c,_0x1804f5[_0xccab('0x3c')]);return _0x342c00[_0xccab('0x4a')](_0x30db8c);}})[_0xccab('0x25')](function(_0x186881){if(_0x186881){_0x46a4b8=_0x186881[_0xccab('0x45')];if(!_0x1804f5['query'][_0xccab('0x4c')](_0xccab('0x34'))){_0x30db8c[_0xccab('0x1f')]=qs[_0xccab('0x1f')](_0x1804f5['query']['limit']);_0x30db8c[_0xccab('0x1d')]=qs[_0xccab('0x1d')](_0x1804f5['query'][_0xccab('0x1d')]);}return _0x342c00[_0xccab('0x4a')](_0x30db8c);}})['then'](function(_0x5b52c7){if(_0x5b52c7){return _0x5b52c7?{'count':_0x46a4b8,'rows':_0x5b52c7}:null;}})[_0xccab('0x25')](respondWithResult(_0x21a0e8,null))[_0xccab('0x48')](handleError(_0x21a0e8,null));};exports[_0xccab('0x4d')]=function(_0x5982f4,_0x213ce9,_0x1976b0){if(_0x5982f4[_0xccab('0x49')]['id']){delete _0x5982f4[_0xccab('0x49')]['id'];}return db[_0xccab('0x3d')][_0xccab('0x4e')]({'where':{'id':_0x5982f4[_0xccab('0x42')]['id']}})[_0xccab('0x25')](handleEntityNotFound(_0x213ce9,null))[_0xccab('0x25')](function(_0x2f27a0){if(_0x2f27a0){_0x5982f4['body'][_0xccab('0x4f')]=_0x2f27a0['id'];_0x5982f4[_0xccab('0x49')]['Subjects']=integrations[_0xccab('0x50')](_0x5982f4[_0xccab('0x49')][_0xccab('0x51')],_0x5982f4['body'][_0xccab('0x2f')]);_0x5982f4['body']['Descriptions']=integrations[_0xccab('0x52')](_0x5982f4[_0xccab('0x49')][_0xccab('0x51')],_0x5982f4['body'][_0xccab('0x2f')]);return db[_0xccab('0x4b')]['create'](_0x5982f4[_0xccab('0x49')],{'include':[{'model':db[_0xccab('0x53')],'as':'Subjects'},{'model':db[_0xccab('0x53')],'as':_0xccab('0x54')}]});}return null;})['then'](respondWithResult(_0x213ce9,null))[_0xccab('0x48')](handleError(_0x213ce9,null));};exports[_0xccab('0x55')]=function(_0x2fbda6,_0xa6f85,_0x5bc1a1){var _0x4d6d49=_0x2fbda6['query'][_0xccab('0x56')];var _0x327a67=_0x4d6d49===_0xccab('0x57')?_0xccab('0x58'):_0xccab('0x59');var _0x1bd47f='';var _0x1e4a89='';var _0x41fa9d='';var _0x46e806='';var _0x592834='';var _0x2d172c='';var _0x1730e0='';var _0x258ed1='';var _0x3cdaac=[_0xccab('0x5a'),_0xccab('0x5b'),_0xccab('0x5c'),'ownerid',_0xccab('0x5d'),_0xccab('0x5e'),'phonenumber','regardingobjectid',_0xccab('0x5f'),_0xccab('0x60')];var _0x3c4b7d=[_0xccab('0x61'),_0xccab('0x62'),_0xccab('0x63'),'billedserviceunits',_0xccab('0x64'),_0xccab('0x65'),_0xccab('0x66'),_0xccab('0x67'),_0xccab('0x68'),_0xccab('0x69'),_0xccab('0x6a'),'createdbyyominame',_0xccab('0x6b'),'createdonbehalfbyname',_0xccab('0x6c'),_0xccab('0x6d'),_0xccab('0x6e'),'customeridyominame',_0xccab('0x6f'),_0xccab('0x70'),_0xccab('0x71'),_0xccab('0x72'),_0xccab('0x73'),'exchangerate',_0xccab('0x74'),'followupby',_0xccab('0x75'),_0xccab('0x76'),'kbarticleidname',_0xccab('0x77'),_0xccab('0x78'),_0xccab('0x79'),_0xccab('0x7a'),_0xccab('0x7b'),_0xccab('0x7c'),_0xccab('0x7d'),_0xccab('0x7e'),_0xccab('0x7f'),'msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents',_0xccab('0x80'),_0xccab('0x81'),_0xccab('0x82'),_0xccab('0x83'),_0xccab('0x84'),_0xccab('0x85'),_0xccab('0x86'),_0xccab('0x87'),_0xccab('0x88'),'productidname',_0xccab('0x89'),_0xccab('0x8a'),'resolvebykpiidname',_0xccab('0x8b'),_0xccab('0x8c'),_0xccab('0x8d'),_0xccab('0x8e'),'slainvokedidname',_0xccab('0x8f'),_0xccab('0x90'),_0xccab('0x91'),_0xccab('0x92'),_0xccab('0x93'),_0xccab('0x94'),_0xccab('0x95'),'transactioncurrencyidname',_0xccab('0x96'),_0xccab('0x97'),_0xccab('0x98')];var _0x14f918=_0x3cdaac['concat'](_0x3c4b7d);return db[_0xccab('0x3d')][_0xccab('0x4e')]({'where':{'id':_0x2fbda6['params']['id']},'attributes':['id','username',_0xccab('0x99'),_0xccab('0x9a'),_0xccab('0x9b'),_0xccab('0x9c'),'clientSecret']})[_0xccab('0x25')](handleEntityNotFound(_0xa6f85,null))[_0xccab('0x25')](function(_0x388604){if(_0x388604){_0x258ed1=_0x388604['remoteUri'];var _0x1e214d=_0x258ed1[_0xccab('0x9d')](-0x1);if(_0x1e214d==='/'){_0x258ed1=_0x258ed1['substring'](0x0,_0x258ed1[_0xccab('0x9e')](_0x1e214d));}_0x1730e0=util[_0xccab('0x9f')](_0xccab('0xa0'),_0x258ed1);var _0x3fed57={'method':_0xccab('0xa1'),'uri':_0xccab('0xa2')+_0x388604[_0xccab('0x9b')]+'/oauth2/token','form':{'client_id':_0x388604[_0xccab('0x9c')],'resource':_0x258ed1,'username':_0x388604[_0xccab('0xa3')],'password':_0x388604[_0xccab('0x99')],'grant_type':'password','client_secret':_0x388604[_0xccab('0xa4')]},'json':!![]};return rp(_0x3fed57);}})[_0xccab('0x25')](function(_0x45d1a5){_0x2d172c=_0x45d1a5[_0xccab('0xa5')];var _0x38d668={'method':'GET','uri':encodeURI(_0x1730e0+_0xccab('0xa6')+_0x327a67+'\x27'),'headers':{'Authorization':_0xccab('0xa7')+_0x2d172c,'If-None-Match':null,'OData-Version':_0xccab('0xa8')},'json':!![]};return rp(_0x38d668);})['then'](function(_0x531b8e){var _0x27937e=_0x531b8e[_0xccab('0xa9')][0x0];var _0x16212b=_0x27937e[_0xccab('0xaa')];var _0x3d82fa={'method':'GET','uri':_0x1730e0+_0xccab('0xab')+_0x16212b+_0xccab('0xac'),'headers':{'Authorization':_0xccab('0xa7')+_0x2d172c,'If-None-Match':null,'OData-Version':_0xccab('0xa8')},'json':!![]};return rp(_0x3d82fa);})[_0xccab('0x25')](function(_0x3e812d){_0x1bd47f=_0x3e812d;_0x1e4a89=_0x1bd47f[_0xccab('0xad')];_0x1e4a89=_[_0xccab('0xae')](_0x1e4a89,function(_0x1898e5){return!_0x14f918[_0xccab('0xaf')](_0x1898e5['LogicalName']);});var _0x57ad0a=[];var _0x316478=[];_0x1e4a89[_0xccab('0xb0')](function(_0x291fc3){if(_0x291fc3[_0xccab('0xb1')]){var _0x12dd75=_0x291fc3['@odata.type']['substring'](_0x291fc3[_0xccab('0xb1')][_0xccab('0x9e')]('.')+0x1);if(_0x12dd75===_0xccab('0xb2')){_0x57ad0a['push'](getSelectList(_0x1730e0,_0x4d6d49,_0x316478,_0x1bd47f[_0xccab('0xaa')],_0x291fc3['MetadataId'],_0x2d172c));}}});return Promise[_0xccab('0xb3')](_0x57ad0a);})['then'](function(_0xde7b99){_0x41fa9d=_0xde7b99[0x0];var _0xf4df0b=[];var _0x8b02ea=[];_0x1e4a89[_0xccab('0xb0')](function(_0x5e879a){if(!_[_0xccab('0xb4')](_0x5e879a[_0xccab('0xb1')])){var _0x13eabd=_0x5e879a['@odata.type']['substring'](_0x5e879a['@odata.type'][_0xccab('0x9e')]('.')+0x1);if(_0x13eabd===_0xccab('0xb5')){_0xf4df0b[_0xccab('0xb6')](getBooleanList(_0x1730e0,_0x4d6d49,_0x8b02ea,_0x1bd47f[_0xccab('0xaa')],_0x5e879a[_0xccab('0xaa')],_0x2d172c));}}});return Promise['all'](_0xf4df0b);})[_0xccab('0x25')](function(_0x3aaea9){_0x46e806=_0x3aaea9[0x0];var _0x4b5161=[];var _0x1e52d6=[];_0x1e4a89['forEach'](function(_0x5d8d3f){if(_0x5d8d3f[_0xccab('0xb1')]){var _0x412713=_0x5d8d3f['@odata.type']['substring'](_0x5d8d3f[_0xccab('0xb1')]['lastIndexOf']('.')+0x1);if(_0x412713===_0xccab('0xb7')||_0x412713==='DoubleAttributeMetadata'||_0x412713==='BigIntAttributeMetadata'||_0x412713===_0xccab('0xb8')||_0x412713===_0xccab('0xb9')||_0x412713===_0xccab('0xba')||_0x412713===_0xccab('0xbb')||_0x412713===_0xccab('0xbc')||_0x412713===_0xccab('0xbd')||_0x412713==='DecimalAttributeMetadata'){_0x4b5161[_0xccab('0xb6')](getInputList(_0x1730e0,_0x4d6d49,_0x412713,_0x1e52d6,_0x1bd47f[_0xccab('0xaa')],_0x5d8d3f[_0xccab('0xaa')],_0x2d172c));}}});return Promise[_0xccab('0xb3')](_0x4b5161);})['then'](function(_0x4b4586){_0x592834=_0x4b4586[0x0];var _0x40c125=_0x41fa9d[_0xccab('0xbe')](_0x46e806)[_0xccab('0xbe')](_0x592834);var _0x590b8c={'count':_0x40c125[_0xccab('0x45')],'rows':_0x40c125};return _0x590b8c;})[_0xccab('0x25')](respondWithResult(_0xa6f85,null))[_0xccab('0x48')](function(_0x462460){var _0x3f2092=_0x2fbda6[_0xccab('0x31')][_0xccab('0xbf')]?0x1f4:_0x462460[_0xccab('0xc0')]||0x1f4;logger[_0xccab('0x27')](_0x462460[_0xccab('0x28')]);delete _0x462460[_0xccab('0x29')];if(_0x3f2092===0x191){_0x3f2092=0x190;}_0xa6f85['status'](_0x3f2092)[_0xccab('0x2a')](_0x2fbda6['query'][_0xccab('0xbf')]?{'message':_0xccab('0xc1'),'statusCode':_0x462460['statusCode']}:_0x462460);});};function getSelectList(_0x5d828f,_0x12a289,_0x68ee8d,_0x74f09,_0x7d1760,_0x31058a){var _0x45242a={'method':_0xccab('0xc2'),'uri':_0x5d828f+'EntityDefinitions('+_0x74f09+')/Attributes('+_0x7d1760+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xccab('0xc3'),'headers':{'Authorization':'Bearer\x20'+_0x31058a,'If-None-Match':null,'OData-Version':_0xccab('0xa8')},'json':!![]};return rp(_0x45242a)[_0xccab('0x25')](function(_0x40d192){var _0x5238ae=[];var _0x4d05f5=_0x40d192[_0xccab('0xc4')]['Options'];_0x4d05f5[_0xccab('0xb0')](function(_0x445733){_0x5238ae[_0xccab('0xb6')]({'name':_0x445733[_0xccab('0xc5')]['UserLocalizedLabel'][_0xccab('0xc5')],'value':String(_0x445733['Value'])});});var _0x540024={'id':_0x12a289+'_'+_0x40d192['LogicalName'],'name':_0x40d192[_0xccab('0xc6')][_0xccab('0xc7')][_0xccab('0xc5')],'custom':![],'options':_0x5238ae};_0x68ee8d[_0xccab('0xb6')](_0x540024);return _0x68ee8d;});}function getBooleanList(_0x34a505,_0x21e91f,_0x201871,_0x38e549,_0x1dde9b,_0x30f108){var _0x1ff3cc={'method':_0xccab('0xc2'),'uri':_0x34a505+_0xccab('0xab')+_0x38e549+_0xccab('0xc8')+_0x1dde9b+_0xccab('0xc9'),'headers':{'Authorization':'Bearer\x20'+_0x30f108,'If-None-Match':null,'OData-Version':_0xccab('0xa8')},'json':!![]};return rp(_0x1ff3cc)[_0xccab('0x25')](function(_0x345080){var _0x281003=[];_0x281003[_0xccab('0xb6')]({'name':_0x345080[_0xccab('0xc4')]['TrueOption']['Label'][_0xccab('0xc7')][_0xccab('0xc5')],'value':_0xccab('0xca')},{'name':_0x345080[_0xccab('0xc4')][_0xccab('0xcb')][_0xccab('0xc5')][_0xccab('0xc7')][_0xccab('0xc5')],'value':_0xccab('0xcc')});var _0x335f49={'id':_0x21e91f+'_'+_0x345080[_0xccab('0xcd')],'name':_0x345080['DisplayName']['UserLocalizedLabel'][_0xccab('0xc5')],'custom':![],'options':_0x281003};_0x201871['push'](_0x335f49);return _0x201871;});}function getInputList(_0x41cfa9,_0x413cfe,_0x401c74,_0x3f6d5e,_0xe707d5,_0x506947,_0x5a3bb4){var _0x400007={'method':_0xccab('0xc2'),'uri':_0x41cfa9+_0xccab('0xab')+_0xe707d5+_0xccab('0xc8')+_0x506947+_0xccab('0xce')+_0x401c74+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xccab('0xa7')+_0x5a3bb4,'If-None-Match':null,'OData-Version':_0xccab('0xa8')},'json':!![]};return rp(_0x400007)[_0xccab('0x25')](function(_0x4b7ba8){var _0xee5e09={'id':_0x413cfe+'_'+_0x4b7ba8[_0xccab('0xcd')],'name':_0x4b7ba8['DisplayName']['UserLocalizedLabel']?_0x4b7ba8[_0xccab('0xc6')][_0xccab('0xc7')][_0xccab('0xc5')]:_0x4b7ba8[_0xccab('0xcd')],'custom':![],'options':[]};_0x3f6d5e[_0xccab('0xb6')](_0xee5e09);return _0x3f6d5e;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 2bd46d1..db8e692 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x4d5d6c,_0x2381d8){var _0x443c98=function(_0x476df0){while(--_0x476df0){_0x4d5d6c['push'](_0x4d5d6c['shift']());}};_0x443c98(++_0x2381d8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 2593276..f862ede 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 _0xa973=['error','Dynamics365Account,\x20%s,\x20%s','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','model','attributes','include','map','debug','ShowDynamics365Account','find','stringify','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0x443b4a,_0x2f28f9){var _0x455ee9=function(_0x41973c){while(--_0x41973c){_0x443b4a['push'](_0x443b4a['shift']());}};_0x455ee9(++_0x2f28f9);}(_0xa973,0x73));var _0x3a97=function(_0x486562,_0x13eb52){_0x486562=_0x486562-0x0;var _0x35eeb9=_0xa973[_0x486562];return _0x35eeb9;};'use strict';var _=require(_0x3a97('0x0'));var util=require(_0x3a97('0x1'));var moment=require(_0x3a97('0x2'));var BPromise=require(_0x3a97('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3a97('0x4'));var logger=require('../../config/logger')(_0x3a97('0x5'));var config=require(_0x3a97('0x6'));var jayson=require(_0x3a97('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ee088,_0x54b301,_0x530a8b){return new BPromise(function(_0x3690fe,_0x4a6787){return client[_0x3a97('0x8')](_0x2ee088,_0x530a8b)[_0x3a97('0x9')](function(_0x30c2e6){logger[_0x3a97('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x54b301,_0x3a97('0xb'));logger['debug'](_0x3a97('0xc'),_0x54b301,_0x3a97('0xb'),JSON['stringify'](_0x30c2e6));if(_0x30c2e6[_0x3a97('0xd')]){if(_0x30c2e6[_0x3a97('0xd')]['code']===0x1f4){logger[_0x3a97('0xd')](_0x3a97('0xe'),_0x54b301,_0x30c2e6[_0x3a97('0xd')][_0x3a97('0xf')]);return _0x4a6787(_0x30c2e6['error'][_0x3a97('0xf')]);}logger[_0x3a97('0xd')](_0x3a97('0xe'),_0x54b301,_0x30c2e6[_0x3a97('0xd')][_0x3a97('0xf')]);return _0x3690fe(_0x30c2e6[_0x3a97('0xd')][_0x3a97('0xf')]);}else{logger[_0x3a97('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x54b301,'request\x20sent');_0x3690fe(_0x30c2e6['result']['message']);}})[_0x3a97('0x10')](function(_0x4feff6){logger[_0x3a97('0xd')](_0x3a97('0xe'),_0x54b301,_0x4feff6);_0x4a6787(_0x4feff6);});});}exports[_0x3a97('0x11')]=function(_0x56ffa6){var _0x26d86d=this;return new Promise(function(_0x4f916c,_0x3e39c8){return db[_0x3a97('0x12')][_0x3a97('0x13')]({'raw':_0x56ffa6[_0x3a97('0x14')]?_0x56ffa6[_0x3a97('0x14')][_0x3a97('0x15')]===undefined?!![]:![]:!![],'where':_0x56ffa6['options']?_0x56ffa6['options'][_0x3a97('0x16')]||null:null,'attributes':_0x56ffa6[_0x3a97('0x14')]?_0x56ffa6[_0x3a97('0x14')]['attributes']||null:null,'limit':_0x56ffa6[_0x3a97('0x14')]?_0x56ffa6['options'][_0x3a97('0x17')]||null:null,'include':_0x56ffa6[_0x3a97('0x14')]?_0x56ffa6['options']['include']?_['map'](_0x56ffa6[_0x3a97('0x14')]['include'],function(_0x23238b){return{'model':db[_0x23238b[_0x3a97('0x18')]],'as':_0x23238b['as'],'attributes':_0x23238b[_0x3a97('0x19')],'include':_0x23238b[_0x3a97('0x1a')]?_[_0x3a97('0x1b')](_0x23238b[_0x3a97('0x1a')],function(_0xb9f3c7){return{'model':db[_0xb9f3c7[_0x3a97('0x18')]],'as':_0xb9f3c7['as'],'attributes':_0xb9f3c7['attributes'],'include':_0xb9f3c7[_0x3a97('0x1a')]?_['map'](_0xb9f3c7[_0x3a97('0x1a')],function(_0x25b80c){return{'model':db[_0x25b80c[_0x3a97('0x18')]],'as':_0x25b80c['as'],'attributes':_0x25b80c[_0x3a97('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3a97('0x9')](function(_0x15a29f){logger['info'](_0x3a97('0x11'),_0x56ffa6);logger[_0x3a97('0x1c')](_0x3a97('0x11'),_0x56ffa6,JSON['stringify'](_0x15a29f));_0x4f916c(_0x15a29f);})[_0x3a97('0x10')](function(_0x530099){logger[_0x3a97('0xd')]('GetDynamics365Account',_0x530099[_0x3a97('0xf')],_0x56ffa6);_0x3e39c8(_0x26d86d[_0x3a97('0xd')](0x1f4,_0x530099['message']));});});};exports[_0x3a97('0x1d')]=function(_0x5cedf2){var _0x5e7e60=this;return new Promise(function(_0x93fb6a,_0x436531){return db[_0x3a97('0x12')][_0x3a97('0x1e')]({'raw':_0x5cedf2[_0x3a97('0x14')]?_0x5cedf2['options']['raw']===undefined?!![]:![]:!![],'where':_0x5cedf2['options']?_0x5cedf2[_0x3a97('0x14')]['where']||null:null,'attributes':_0x5cedf2['options']?_0x5cedf2[_0x3a97('0x14')][_0x3a97('0x19')]||null:null,'include':_0x5cedf2[_0x3a97('0x14')]?_0x5cedf2[_0x3a97('0x14')][_0x3a97('0x1a')]?_[_0x3a97('0x1b')](_0x5cedf2[_0x3a97('0x14')][_0x3a97('0x1a')],function(_0x1fdb0b){return{'model':db[_0x1fdb0b[_0x3a97('0x18')]],'as':_0x1fdb0b['as'],'attributes':_0x1fdb0b[_0x3a97('0x19')],'include':_0x1fdb0b[_0x3a97('0x1a')]?_['map'](_0x1fdb0b['include'],function(_0x22443a){return{'model':db[_0x22443a[_0x3a97('0x18')]],'as':_0x22443a['as'],'attributes':_0x22443a[_0x3a97('0x19')],'include':_0x22443a[_0x3a97('0x1a')]?_[_0x3a97('0x1b')](_0x22443a[_0x3a97('0x1a')],function(_0x431a66){return{'model':db[_0x431a66[_0x3a97('0x18')]],'as':_0x431a66['as'],'attributes':_0x431a66['attributes']};}):[]};}):[]};}):[]:[]})[_0x3a97('0x9')](function(_0x32090e){logger[_0x3a97('0xa')](_0x3a97('0x1d'),_0x5cedf2);logger['debug'](_0x3a97('0x1d'),_0x5cedf2,JSON[_0x3a97('0x1f')](_0x32090e));_0x93fb6a(_0x32090e);})['catch'](function(_0x54ec4a){logger[_0x3a97('0xd')](_0x3a97('0x1d'),_0x54ec4a[_0x3a97('0xf')],_0x5cedf2);_0x436531(_0x5e7e60[_0x3a97('0xd')](0x1f4,_0x54ec4a['message']));});});}; \ No newline at end of file +var _0x78a7=['bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowDynamics365Account','lodash','util','moment'];(function(_0x14f17c,_0x1c5cfa){var _0x5b3b85=function(_0xcdff58){while(--_0xcdff58){_0x14f17c['push'](_0x14f17c['shift']());}};_0x5b3b85(++_0x1c5cfa);}(_0x78a7,0x1bd));var _0x778a=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x78a7[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x778a('0x0'));var util=require(_0x778a('0x1'));var moment=require(_0x778a('0x2'));var BPromise=require(_0x778a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x778a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x778a('0x5'));var logger=require(_0x778a('0x6'))('rpc');var config=require(_0x778a('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x108b95,_0x481ec4,_0x165391){return new BPromise(function(_0x3c00e1,_0xa0c346){return client[_0x778a('0x8')](_0x108b95,_0x165391)['then'](function(_0x5b43c3){logger[_0x778a('0x9')](_0x778a('0xa'),_0x481ec4,_0x778a('0xb'));logger[_0x778a('0xc')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x481ec4,'request\x20sent',JSON[_0x778a('0xd')](_0x5b43c3));if(_0x5b43c3['error']){if(_0x5b43c3[_0x778a('0xe')][_0x778a('0xf')]===0x1f4){logger['error'](_0x778a('0xa'),_0x481ec4,_0x5b43c3[_0x778a('0xe')][_0x778a('0x10')]);return _0xa0c346(_0x5b43c3[_0x778a('0xe')]['message']);}logger[_0x778a('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x481ec4,_0x5b43c3['error'][_0x778a('0x10')]);return _0x3c00e1(_0x5b43c3[_0x778a('0xe')][_0x778a('0x10')]);}else{logger[_0x778a('0x9')](_0x778a('0xa'),_0x481ec4,'request\x20sent');_0x3c00e1(_0x5b43c3[_0x778a('0x11')][_0x778a('0x10')]);}})[_0x778a('0x12')](function(_0x51b3ca){logger[_0x778a('0xe')](_0x778a('0xa'),_0x481ec4,_0x51b3ca);_0xa0c346(_0x51b3ca);});});}exports[_0x778a('0x13')]=function(_0x426f38){var _0x1926ab=this;return new Promise(function(_0x3216b9,_0x27e7ee){return db[_0x778a('0x14')][_0x778a('0x15')]({'raw':_0x426f38[_0x778a('0x16')]?_0x426f38[_0x778a('0x16')][_0x778a('0x17')]===undefined?!![]:![]:!![],'where':_0x426f38[_0x778a('0x16')]?_0x426f38[_0x778a('0x16')][_0x778a('0x18')]||null:null,'attributes':_0x426f38[_0x778a('0x16')]?_0x426f38[_0x778a('0x16')][_0x778a('0x19')]||null:null,'limit':_0x426f38['options']?_0x426f38[_0x778a('0x16')][_0x778a('0x1a')]||null:null,'include':_0x426f38[_0x778a('0x16')]?_0x426f38[_0x778a('0x16')]['include']?_[_0x778a('0x1b')](_0x426f38[_0x778a('0x16')][_0x778a('0x1c')],function(_0x417ce7){return{'model':db[_0x417ce7[_0x778a('0x1d')]],'as':_0x417ce7['as'],'attributes':_0x417ce7[_0x778a('0x19')],'include':_0x417ce7[_0x778a('0x1c')]?_['map'](_0x417ce7[_0x778a('0x1c')],function(_0x6da04c){return{'model':db[_0x6da04c[_0x778a('0x1d')]],'as':_0x6da04c['as'],'attributes':_0x6da04c['attributes'],'include':_0x6da04c['include']?_['map'](_0x6da04c[_0x778a('0x1c')],function(_0x56c611){return{'model':db[_0x56c611['model']],'as':_0x56c611['as'],'attributes':_0x56c611['attributes']};}):[]};}):[]};}):[]:[]})[_0x778a('0x1e')](function(_0xf043b8){logger[_0x778a('0x9')](_0x778a('0x13'),_0x426f38);logger[_0x778a('0xc')](_0x778a('0x13'),_0x426f38,JSON[_0x778a('0xd')](_0xf043b8));_0x3216b9(_0xf043b8);})[_0x778a('0x12')](function(_0x57fc9b){logger[_0x778a('0xe')](_0x778a('0x13'),_0x57fc9b['message'],_0x426f38);_0x27e7ee(_0x1926ab[_0x778a('0xe')](0x1f4,_0x57fc9b[_0x778a('0x10')]));});});};exports[_0x778a('0x1f')]=function(_0x38d913){var _0x26d564=this;return new Promise(function(_0x34ba29,_0x28d151){return db[_0x778a('0x14')]['find']({'raw':_0x38d913[_0x778a('0x16')]?_0x38d913[_0x778a('0x16')][_0x778a('0x17')]===undefined?!![]:![]:!![],'where':_0x38d913['options']?_0x38d913[_0x778a('0x16')]['where']||null:null,'attributes':_0x38d913[_0x778a('0x16')]?_0x38d913[_0x778a('0x16')][_0x778a('0x19')]||null:null,'include':_0x38d913[_0x778a('0x16')]?_0x38d913[_0x778a('0x16')]['include']?_[_0x778a('0x1b')](_0x38d913[_0x778a('0x16')][_0x778a('0x1c')],function(_0x24f599){return{'model':db[_0x24f599[_0x778a('0x1d')]],'as':_0x24f599['as'],'attributes':_0x24f599[_0x778a('0x19')],'include':_0x24f599['include']?_[_0x778a('0x1b')](_0x24f599[_0x778a('0x1c')],function(_0x4579d7){return{'model':db[_0x4579d7[_0x778a('0x1d')]],'as':_0x4579d7['as'],'attributes':_0x4579d7[_0x778a('0x19')],'include':_0x4579d7['include']?_['map'](_0x4579d7['include'],function(_0x3cef85){return{'model':db[_0x3cef85[_0x778a('0x1d')]],'as':_0x3cef85['as'],'attributes':_0x3cef85[_0x778a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x778a('0x1e')](function(_0x394f53){logger[_0x778a('0x9')](_0x778a('0x1f'),_0x38d913);logger[_0x778a('0xc')](_0x778a('0x1f'),_0x38d913,JSON[_0x778a('0xd')](_0x394f53));_0x34ba29(_0x394f53);})[_0x778a('0x12')](function(_0x363230){logger[_0x778a('0xe')](_0x778a('0x1f'),_0x363230[_0x778a('0x10')],_0x38d913);_0x28d151(_0x26d564[_0x778a('0xe')](0x1f4,_0x363230[_0x778a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index a85860c..beea2fc 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 _0x2f56=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','delete','/:id','destroy','multer','util','path'];(function(_0x4829c1,_0x1eab61){var _0x4e6948=function(_0x485cca){while(--_0x485cca){_0x4829c1['push'](_0x4829c1['shift']());}};_0x4e6948(++_0x1eab61);}(_0x2f56,0xb5));var _0x62f5=function(_0x3022e1,_0x4e45dd){_0x3022e1=_0x3022e1-0x0;var _0x321dad=_0x2f56[_0x3022e1];return _0x321dad;};'use strict';var multer=require(_0x62f5('0x0'));var util=require(_0x62f5('0x1'));var path=require(_0x62f5('0x2'));var timeout=require(_0x62f5('0x3'));var express=require('express');var router=express[_0x62f5('0x4')]();var fs_extra=require(_0x62f5('0x5'));var auth=require(_0x62f5('0x6'));var interaction=require(_0x62f5('0x7'));var config=require(_0x62f5('0x8'));var controller=require('./intDynamics365Configuration.controller');router[_0x62f5('0x9')]('/',auth[_0x62f5('0xa')](),controller[_0x62f5('0xb')]);router[_0x62f5('0x9')]('/:id',auth[_0x62f5('0xa')](),controller[_0x62f5('0xc')]);router['get'](_0x62f5('0xd'),auth[_0x62f5('0xa')](),controller['getFields']);router[_0x62f5('0x9')](_0x62f5('0xe'),auth[_0x62f5('0xa')](),controller['getSubjects']);router['get'](_0x62f5('0xf'),auth[_0x62f5('0xa')](),controller[_0x62f5('0x10')]);router[_0x62f5('0x11')]('/',auth[_0x62f5('0xa')](),controller[_0x62f5('0x12')]);router[_0x62f5('0x13')]('/:id',auth[_0x62f5('0xa')](),controller['update']);router[_0x62f5('0x14')](_0x62f5('0x15'),auth[_0x62f5('0xa')](),controller[_0x62f5('0x16')]);module['exports']=router; \ No newline at end of file +var _0x8425=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update'];(function(_0x3bafae,_0x44ab3d){var _0x44a8b5=function(_0x37a7c4){while(--_0x37a7c4){_0x3bafae['push'](_0x3bafae['shift']());}};_0x44a8b5(++_0x44ab3d);}(_0x8425,0x13b));var _0x5842=function(_0x44c297,_0x25053e){_0x44c297=_0x44c297-0x0;var _0x1ea5d3=_0x8425[_0x44c297];return _0x1ea5d3;};'use strict';var multer=require(_0x5842('0x0'));var util=require(_0x5842('0x1'));var path=require(_0x5842('0x2'));var timeout=require(_0x5842('0x3'));var express=require('express');var router=express[_0x5842('0x4')]();var fs_extra=require(_0x5842('0x5'));var auth=require(_0x5842('0x6'));var interaction=require(_0x5842('0x7'));var config=require(_0x5842('0x8'));var controller=require(_0x5842('0x9'));router[_0x5842('0xa')]('/',auth['isAuthenticated'](),controller[_0x5842('0xb')]);router[_0x5842('0xa')](_0x5842('0xc'),auth[_0x5842('0xd')](),controller[_0x5842('0xe')]);router['get']('/:id/fields',auth[_0x5842('0xd')](),controller['getFields']);router[_0x5842('0xa')](_0x5842('0xf'),auth[_0x5842('0xd')](),controller[_0x5842('0x10')]);router[_0x5842('0xa')](_0x5842('0x11'),auth[_0x5842('0xd')](),controller[_0x5842('0x12')]);router[_0x5842('0x13')]('/',auth[_0x5842('0xd')](),controller[_0x5842('0x14')]);router[_0x5842('0x15')]('/:id',auth[_0x5842('0xd')](),controller[_0x5842('0x16')]);router[_0x5842('0x17')](_0x5842('0xc'),auth[_0x5842('0xd')](),controller[_0x5842('0x18')]);module[_0x5842('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index b69d3e3..f6d950b 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 _0x7c8d=['exports','STRING','incident','phonecall','sequelize'];(function(_0x1e364b,_0x3a26d4){var _0x3d6005=function(_0xe821b2){while(--_0xe821b2){_0x1e364b['push'](_0x1e364b['shift']());}};_0x3d6005(++_0x3a26d4);}(_0x7c8d,0x1da));var _0xd7c8=function(_0x1dcbcc,_0x31a0fc){_0x1dcbcc=_0x1dcbcc-0x0;var _0x38590e=_0x7c8d[_0x1dcbcc];return _0x38590e;};'use strict';var Sequelize=require(_0xd7c8('0x0'));module[_0xd7c8('0x1')]={'name':{'type':Sequelize[_0xd7c8('0x2')]},'description':{'type':Sequelize[_0xd7c8('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xd7c8('0x3'),_0xd7c8('0x4')),'defaultValue':'incident'}}; \ No newline at end of file +var _0xf407=['incident','phonecall','sequelize','exports','ENUM'];(function(_0x157181,_0x1471da){var _0x864640=function(_0x9de696){while(--_0x9de696){_0x157181['push'](_0x157181['shift']());}};_0x864640(++_0x1471da);}(_0xf407,0x192));var _0x7f40=function(_0x189500,_0x174937){_0x189500=_0x189500-0x0;var _0x457f5b=_0xf407[_0x189500];return _0x457f5b;};'use strict';var Sequelize=require(_0x7f40('0x0'));module[_0x7f40('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x7f40('0x2')](_0x7f40('0x3'),_0x7f40('0x4')),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 71e3132..658c044 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 _0x7382=['reject','then','error','stack','name','send','Dynamics365Configuration','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','update','destroy','findOne','Dynamics365Field','map','nolimit','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x1803da,_0x4ce0e7){var _0x395ed3=function(_0x3423de){while(--_0x3423de){_0x1803da['push'](_0x1803da['shift']());}};_0x395ed3(++_0x4ce0e7);}(_0x7382,0x122));var _0x2738=function(_0x569043,_0x5d326d){_0x569043=_0x569043-0x0;var _0x2ad5a0=_0x7382[_0x569043];return _0x2ad5a0;};'use strict';var emlformat=require(_0x2738('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2738('0x1'));var jsonpatch=require(_0x2738('0x2'));var rp=require(_0x2738('0x3'));var moment=require('moment');var BPromise=require(_0x2738('0x4'));var Mustache=require(_0x2738('0x5'));var util=require(_0x2738('0x6'));var path=require(_0x2738('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2738('0x8'));var fs=require('fs');var fs_extra=require(_0x2738('0x9'));var _=require(_0x2738('0xa'));var squel=require(_0x2738('0xb'));var crypto=require(_0x2738('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2738('0xd'));var toCsv=require(_0x2738('0xe'));var querystring=require(_0x2738('0xf'));var Papa=require(_0x2738('0x10'));var Redis=require(_0x2738('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2738('0x12'));var as=require(_0x2738('0x13'));var hardwareService=require(_0x2738('0x14'));var logger=require(_0x2738('0x15'))(_0x2738('0x16'));var utils=require(_0x2738('0x17'));var config=require(_0x2738('0x18'));var licenseUtil=require(_0x2738('0x19'));var db=require(_0x2738('0x1a'))['db'];function respondWithStatusCode(_0x246979,_0x1203d4){_0x1203d4=_0x1203d4||0xcc;return function(_0x293ba3){if(_0x293ba3){return _0x246979[_0x2738('0x1b')](_0x1203d4);}return _0x246979[_0x2738('0x1c')](_0x1203d4)[_0x2738('0x1d')]();};}function respondWithResult(_0x28549b,_0x506121){_0x506121=_0x506121||0xc8;return function(_0x5e91c4){if(_0x5e91c4){return _0x28549b[_0x2738('0x1c')](_0x506121)[_0x2738('0x1e')](_0x5e91c4);}};}function respondWithFilteredResult(_0x14737c,_0x43bb76){return function(_0x5b584b){if(_0x5b584b){var _0x13dd21=typeof _0x43bb76[_0x2738('0x1f')]===_0x2738('0x20')&&typeof _0x43bb76[_0x2738('0x21')]===_0x2738('0x20');var _0x43d963=_0x5b584b[_0x2738('0x22')];var _0x3ff55f=_0x13dd21?0x0:_0x43bb76[_0x2738('0x1f')];var _0x110a53=_0x13dd21?_0x5b584b[_0x2738('0x22')]:_0x43bb76[_0x2738('0x1f')]+_0x43bb76[_0x2738('0x21')];var _0x2d94ce;if(_0x110a53>=_0x43d963){_0x110a53=_0x43d963;_0x2d94ce=0xc8;}else{_0x2d94ce=0xce;}_0x14737c[_0x2738('0x1c')](_0x2d94ce);return _0x14737c[_0x2738('0x23')](_0x2738('0x24'),_0x3ff55f+'-'+_0x110a53+'/'+_0x43d963)['json'](_0x5b584b);}return null;};}function patchUpdates(_0x6f2f31){return function(_0x3b20eb){try{jsonpatch[_0x2738('0x25')](_0x3b20eb,_0x6f2f31,!![]);}catch(_0x1e7112){return BPromise[_0x2738('0x26')](_0x1e7112);}return _0x3b20eb['save']();};}function saveUpdates(_0x176497,_0x22841d){return function(_0x269911){if(_0x269911){return _0x269911['update'](_0x176497)[_0x2738('0x27')](function(_0x1d085e){return _0x1d085e;});}return null;};}function removeEntity(_0x41dd14,_0xc76a7e){return function(_0x3849ad){if(_0x3849ad){return _0x3849ad['destroy']()[_0x2738('0x27')](function(){_0x41dd14[_0x2738('0x1c')](0xcc)[_0x2738('0x1d')]();});}};}function handleEntityNotFound(_0x215df2,_0x49b382){return function(_0x368a26){if(!_0x368a26){_0x215df2[_0x2738('0x1b')](0x194);}return _0x368a26;};}function handleError(_0x537a3b,_0x5f20f8){_0x5f20f8=_0x5f20f8||0x1f4;return function(_0x423742){logger[_0x2738('0x28')](_0x423742[_0x2738('0x29')]);if(_0x423742[_0x2738('0x2a')]){delete _0x423742[_0x2738('0x2a')];}_0x537a3b[_0x2738('0x1c')](_0x5f20f8)[_0x2738('0x2b')](_0x423742);};}exports['index']=function(_0x13e362,_0x313370){var _0x2b2457={},_0x184dd8={},_0x17543e={'count':0x0,'rows':[]};var _0x30bb99=_['map'](db[_0x2738('0x2c')][_0x2738('0x2d')],function(_0x5be260){return{'name':_0x5be260['fieldName'],'type':_0x5be260['type']['key']};});_0x184dd8[_0x2738('0x2e')]=_['map'](_0x30bb99,_0x2738('0x2a'));_0x184dd8[_0x2738('0x2f')]=_[_0x2738('0x30')](_0x13e362[_0x2738('0x2f')]);_0x184dd8[_0x2738('0x31')]=_[_0x2738('0x32')](_0x184dd8[_0x2738('0x2e')],_0x184dd8['query']);_0x2b2457[_0x2738('0x33')]=_[_0x2738('0x32')](_0x184dd8['model'],qs['fields'](_0x13e362[_0x2738('0x2f')][_0x2738('0x34')]));_0x2b2457[_0x2738('0x33')]=_0x2b2457[_0x2738('0x33')][_0x2738('0x35')]?_0x2b2457[_0x2738('0x33')]:_0x184dd8[_0x2738('0x2e')];if(!_0x13e362[_0x2738('0x2f')][_0x2738('0x36')]('nolimit')){_0x2b2457[_0x2738('0x21')]=qs[_0x2738('0x21')](_0x13e362[_0x2738('0x2f')]['limit']);_0x2b2457[_0x2738('0x1f')]=qs['offset'](_0x13e362[_0x2738('0x2f')][_0x2738('0x1f')]);}_0x2b2457[_0x2738('0x37')]=qs[_0x2738('0x38')](_0x13e362['query']['sort']);_0x2b2457[_0x2738('0x39')]=qs['filters'](_[_0x2738('0x3a')](_0x13e362[_0x2738('0x2f')],_0x184dd8[_0x2738('0x31')]),_0x30bb99);if(_0x13e362[_0x2738('0x2f')][_0x2738('0x3b')]){_0x2b2457[_0x2738('0x39')]=_[_0x2738('0x3c')](_0x2b2457[_0x2738('0x39')],{'$or':_['map'](_0x30bb99,function(_0x249d88){if(_0x249d88[_0x2738('0x3d')]!==_0x2738('0x3e')){var _0xddb06b={};_0xddb06b[_0x249d88[_0x2738('0x2a')]]={'$like':'%'+_0x13e362['query']['filter']+'%'};return _0xddb06b;}})});}_0x2b2457=_['merge']({},_0x2b2457,_0x13e362['options']);var _0x3cfcdc={'where':_0x2b2457['where']};return db[_0x2738('0x2c')][_0x2738('0x22')](_0x3cfcdc)[_0x2738('0x27')](function(_0x1ec7d3){_0x17543e['count']=_0x1ec7d3;if(_0x13e362[_0x2738('0x2f')][_0x2738('0x3f')]){_0x2b2457[_0x2738('0x40')]=[{'all':!![]}];}return db[_0x2738('0x2c')][_0x2738('0x41')](_0x2b2457);})['then'](function(_0x2ffc81){_0x17543e[_0x2738('0x42')]=_0x2ffc81;return _0x17543e;})[_0x2738('0x27')](respondWithFilteredResult(_0x313370,_0x2b2457))[_0x2738('0x43')](handleError(_0x313370,null));};exports['show']=function(_0x1b2a38,_0x423c29){var _0x5ec9cc={'raw':![],'where':{'id':_0x1b2a38[_0x2738('0x44')]['id']}},_0x11ac0c={};_0x11ac0c[_0x2738('0x2e')]=_['keys'](db[_0x2738('0x2c')]['rawAttributes']);_0x11ac0c[_0x2738('0x2f')]=_[_0x2738('0x30')](_0x1b2a38['query']);_0x11ac0c['filters']=_[_0x2738('0x32')](_0x11ac0c[_0x2738('0x2e')],_0x11ac0c['query']);_0x5ec9cc[_0x2738('0x33')]=_[_0x2738('0x32')](_0x11ac0c[_0x2738('0x2e')],qs[_0x2738('0x34')](_0x1b2a38[_0x2738('0x2f')][_0x2738('0x34')]));_0x5ec9cc[_0x2738('0x33')]=_0x5ec9cc[_0x2738('0x33')]['length']?_0x5ec9cc['attributes']:_0x11ac0c[_0x2738('0x2e')];if(_0x1b2a38[_0x2738('0x2f')][_0x2738('0x3f')]){_0x5ec9cc[_0x2738('0x40')]=[{'all':!![]}];}_0x5ec9cc=_['merge']({},_0x5ec9cc,_0x1b2a38[_0x2738('0x45')]);return db[_0x2738('0x2c')][_0x2738('0x46')](_0x5ec9cc)[_0x2738('0x27')](handleEntityNotFound(_0x423c29,null))[_0x2738('0x27')](respondWithResult(_0x423c29,null))[_0x2738('0x43')](handleError(_0x423c29,null));};exports[_0x2738('0x47')]=function(_0x2e8b1e,_0x28a1d8){return db[_0x2738('0x2c')][_0x2738('0x47')](_0x2e8b1e[_0x2738('0x48')],{})[_0x2738('0x27')](respondWithResult(_0x28a1d8,0xc9))[_0x2738('0x43')](handleError(_0x28a1d8,null));};exports[_0x2738('0x49')]=function(_0x3a09fb,_0x253d11){if(_0x3a09fb[_0x2738('0x48')]['id']){delete _0x3a09fb[_0x2738('0x48')]['id'];}return db[_0x2738('0x2c')][_0x2738('0x46')]({'where':{'id':_0x3a09fb[_0x2738('0x44')]['id']}})[_0x2738('0x27')](handleEntityNotFound(_0x253d11,null))[_0x2738('0x27')](saveUpdates(_0x3a09fb[_0x2738('0x48')],null))[_0x2738('0x27')](respondWithResult(_0x253d11,null))[_0x2738('0x43')](handleError(_0x253d11,null));};exports[_0x2738('0x4a')]=function(_0x3d9075,_0x16e63c){return db[_0x2738('0x2c')][_0x2738('0x46')]({'where':{'id':_0x3d9075[_0x2738('0x44')]['id']}})[_0x2738('0x27')](handleEntityNotFound(_0x16e63c,null))[_0x2738('0x27')](removeEntity(_0x16e63c,null))[_0x2738('0x43')](handleError(_0x16e63c,null));};exports['getFields']=function(_0x31c387,_0x16adbb,_0x4f4570){var _0x3093df={};var _0x36a4bd={};var _0x341fe1;var _0x132ce0;return db[_0x2738('0x2c')][_0x2738('0x4b')]({'where':{'id':_0x31c387[_0x2738('0x44')]['id']}})[_0x2738('0x27')](handleEntityNotFound(_0x16adbb,null))[_0x2738('0x27')](function(_0x3f493c){if(_0x3f493c){_0x341fe1=_0x3f493c;_0x36a4bd[_0x2738('0x2e')]=_[_0x2738('0x30')](db[_0x2738('0x4c')]['rawAttributes']);_0x36a4bd[_0x2738('0x2f')]=_[_0x2738('0x30')](_0x31c387['query']);_0x36a4bd[_0x2738('0x31')]=_['intersection'](_0x36a4bd[_0x2738('0x2e')],_0x36a4bd[_0x2738('0x2f')]);_0x3093df[_0x2738('0x33')]=_[_0x2738('0x32')](_0x36a4bd[_0x2738('0x2e')],qs[_0x2738('0x34')](_0x31c387[_0x2738('0x2f')][_0x2738('0x34')]));_0x3093df[_0x2738('0x33')]=_0x3093df[_0x2738('0x33')][_0x2738('0x35')]?_0x3093df['attributes']:_0x36a4bd[_0x2738('0x2e')];_0x3093df[_0x2738('0x37')]=qs[_0x2738('0x38')](_0x31c387['query'][_0x2738('0x38')]);_0x3093df[_0x2738('0x39')]=qs[_0x2738('0x31')](_[_0x2738('0x3a')](_0x31c387['query'],_0x36a4bd[_0x2738('0x31')]));if(_0x31c387[_0x2738('0x2f')]['filter']){_0x3093df[_0x2738('0x39')]=_['merge'](_0x3093df['where'],{'$or':_[_0x2738('0x4d')](_0x3093df['attributes'],function(_0x308669){var _0x2526c5={};_0x2526c5[_0x308669]={'$like':'%'+_0x31c387[_0x2738('0x2f')][_0x2738('0x3b')]+'%'};return _0x2526c5;})});}_0x3093df=_[_0x2738('0x3c')]({},_0x3093df,_0x31c387[_0x2738('0x45')]);return _0x341fe1['getFields'](_0x3093df);}})[_0x2738('0x27')](function(_0x7ebe78){if(_0x7ebe78){_0x132ce0=_0x7ebe78[_0x2738('0x35')];if(!_0x31c387['query'][_0x2738('0x36')](_0x2738('0x4e'))){_0x3093df[_0x2738('0x21')]=qs[_0x2738('0x21')](_0x31c387[_0x2738('0x2f')][_0x2738('0x21')]);_0x3093df[_0x2738('0x1f')]=qs[_0x2738('0x1f')](_0x31c387[_0x2738('0x2f')][_0x2738('0x1f')]);}return _0x341fe1[_0x2738('0x4f')](_0x3093df);}})['then'](function(_0x36e88a){if(_0x36e88a){return _0x36e88a?{'count':_0x132ce0,'rows':_0x36e88a}:null;}})[_0x2738('0x27')](respondWithResult(_0x16adbb,null))['catch'](handleError(_0x16adbb,null));};exports[_0x2738('0x50')]=function(_0x2c541e,_0x3ad7fd,_0x3e8c2c){var _0xbc8502={};var _0x137697={};var _0x19b162;var _0x534d9b;return db['Dynamics365Configuration'][_0x2738('0x4b')]({'where':{'id':_0x2c541e['params']['id']}})[_0x2738('0x27')](handleEntityNotFound(_0x3ad7fd,null))[_0x2738('0x27')](function(_0x28d452){if(_0x28d452){_0x19b162=_0x28d452;_0x137697[_0x2738('0x2e')]=_[_0x2738('0x30')](db[_0x2738('0x4c')][_0x2738('0x2d')]);_0x137697[_0x2738('0x2f')]=_[_0x2738('0x30')](_0x2c541e[_0x2738('0x2f')]);_0x137697[_0x2738('0x31')]=_[_0x2738('0x32')](_0x137697[_0x2738('0x2e')],_0x137697[_0x2738('0x2f')]);_0xbc8502[_0x2738('0x33')]=_[_0x2738('0x32')](_0x137697[_0x2738('0x2e')],qs[_0x2738('0x34')](_0x2c541e[_0x2738('0x2f')][_0x2738('0x34')]));_0xbc8502[_0x2738('0x33')]=_0xbc8502[_0x2738('0x33')][_0x2738('0x35')]?_0xbc8502[_0x2738('0x33')]:_0x137697[_0x2738('0x2e')];_0xbc8502[_0x2738('0x37')]=qs[_0x2738('0x38')](_0x2c541e[_0x2738('0x2f')][_0x2738('0x38')]);_0xbc8502[_0x2738('0x39')]=qs[_0x2738('0x31')](_['pick'](_0x2c541e[_0x2738('0x2f')],_0x137697[_0x2738('0x31')]));if(_0x2c541e[_0x2738('0x2f')]['filter']){_0xbc8502[_0x2738('0x39')]=_[_0x2738('0x3c')](_0xbc8502[_0x2738('0x39')],{'$or':_[_0x2738('0x4d')](_0xbc8502['attributes'],function(_0x51358e){var _0x33de59={};_0x33de59[_0x51358e]={'$like':'%'+_0x2c541e[_0x2738('0x2f')][_0x2738('0x3b')]+'%'};return _0x33de59;})});}_0xbc8502=_[_0x2738('0x3c')]({},_0xbc8502,_0x2c541e[_0x2738('0x45')]);return _0x19b162['getSubjects'](_0xbc8502);}})[_0x2738('0x27')](function(_0xd7a34f){if(_0xd7a34f){_0x534d9b=_0xd7a34f[_0x2738('0x35')];if(!_0x2c541e[_0x2738('0x2f')][_0x2738('0x36')]('nolimit')){_0xbc8502[_0x2738('0x21')]=qs[_0x2738('0x21')](_0x2c541e['query'][_0x2738('0x21')]);_0xbc8502[_0x2738('0x1f')]=qs[_0x2738('0x1f')](_0x2c541e[_0x2738('0x2f')]['offset']);}return _0x19b162[_0x2738('0x50')](_0xbc8502);}})[_0x2738('0x27')](function(_0x2d8309){if(_0x2d8309){return _0x2d8309?{'count':_0x534d9b,'rows':_0x2d8309}:null;}})[_0x2738('0x27')](respondWithResult(_0x3ad7fd,null))[_0x2738('0x43')](handleError(_0x3ad7fd,null));};exports['getDescriptions']=function(_0x399db0,_0x2f3818,_0x4f1aec){var _0x26856a={};var _0x44c648={};var _0x48175b;var _0xc8c3d3;return db[_0x2738('0x2c')][_0x2738('0x4b')]({'where':{'id':_0x399db0['params']['id']}})[_0x2738('0x27')](handleEntityNotFound(_0x2f3818,null))['then'](function(_0x35bd44){if(_0x35bd44){_0x48175b=_0x35bd44;_0x44c648['model']=_[_0x2738('0x30')](db['Dynamics365Field'][_0x2738('0x2d')]);_0x44c648[_0x2738('0x2f')]=_[_0x2738('0x30')](_0x399db0[_0x2738('0x2f')]);_0x44c648['filters']=_[_0x2738('0x32')](_0x44c648[_0x2738('0x2e')],_0x44c648[_0x2738('0x2f')]);_0x26856a[_0x2738('0x33')]=_['intersection'](_0x44c648[_0x2738('0x2e')],qs[_0x2738('0x34')](_0x399db0[_0x2738('0x2f')][_0x2738('0x34')]));_0x26856a[_0x2738('0x33')]=_0x26856a[_0x2738('0x33')][_0x2738('0x35')]?_0x26856a['attributes']:_0x44c648[_0x2738('0x2e')];_0x26856a[_0x2738('0x37')]=qs[_0x2738('0x38')](_0x399db0['query'][_0x2738('0x38')]);_0x26856a['where']=qs[_0x2738('0x31')](_[_0x2738('0x3a')](_0x399db0['query'],_0x44c648[_0x2738('0x31')]));if(_0x399db0[_0x2738('0x2f')]['filter']){_0x26856a['where']=_['merge'](_0x26856a[_0x2738('0x39')],{'$or':_[_0x2738('0x4d')](_0x26856a['attributes'],function(_0x539682){var _0x15436c={};_0x15436c[_0x539682]={'$like':'%'+_0x399db0['query'][_0x2738('0x3b')]+'%'};return _0x15436c;})});}_0x26856a=_['merge']({},_0x26856a,_0x399db0['options']);return _0x48175b[_0x2738('0x51')](_0x26856a);}})[_0x2738('0x27')](function(_0x5c06ef){if(_0x5c06ef){_0xc8c3d3=_0x5c06ef[_0x2738('0x35')];if(!_0x399db0[_0x2738('0x2f')][_0x2738('0x36')](_0x2738('0x4e'))){_0x26856a['limit']=qs[_0x2738('0x21')](_0x399db0[_0x2738('0x2f')][_0x2738('0x21')]);_0x26856a['offset']=qs[_0x2738('0x1f')](_0x399db0[_0x2738('0x2f')][_0x2738('0x1f')]);}return _0x48175b['getDescriptions'](_0x26856a);}})['then'](function(_0x4add3){if(_0x4add3){return _0x4add3?{'count':_0xc8c3d3,'rows':_0x4add3}:null;}})['then'](respondWithResult(_0x2f3818,null))[_0x2738('0x43')](handleError(_0x2f3818,null));}; \ No newline at end of file +var _0xd336=['findAll','catch','show','params','rawAttributes','include','find','create','body','getFields','Dynamics365Field','getSubjects','findOne','getDescriptions','hasOwnProperty','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','map','Dynamics365Configuration','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll'];(function(_0x4781a7,_0x1a7ac6){var _0x4acb6d=function(_0x461007){while(--_0x461007){_0x4781a7['push'](_0x4781a7['shift']());}};_0x4acb6d(++_0x1a7ac6);}(_0xd336,0x19f));var _0x6d33=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0xd336[_0x1265ed];return _0x5ac459;};'use strict';var emlformat=require(_0x6d33('0x0'));var rimraf=require(_0x6d33('0x1'));var zipdir=require(_0x6d33('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6d33('0x3'));var BPromise=require(_0x6d33('0x4'));var Mustache=require('mustache');var util=require(_0x6d33('0x5'));var path=require(_0x6d33('0x6'));var sox=require('sox');var csv=require(_0x6d33('0x7'));var ejs=require(_0x6d33('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d33('0x9'));var squel=require(_0x6d33('0xa'));var crypto=require(_0x6d33('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6d33('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6d33('0xd'));var Papa=require(_0x6d33('0xe'));var Redis=require(_0x6d33('0xf'));var authService=require(_0x6d33('0x10'));var qs=require(_0x6d33('0x11'));var as=require(_0x6d33('0x12'));var hardwareService=require(_0x6d33('0x13'));var logger=require('../../config/logger')(_0x6d33('0x14'));var utils=require(_0x6d33('0x15'));var config=require(_0x6d33('0x16'));var licenseUtil=require(_0x6d33('0x17'));var db=require(_0x6d33('0x18'))['db'];function respondWithStatusCode(_0x54b49a,_0x8e5f78){_0x8e5f78=_0x8e5f78||0xcc;return function(_0xf1c916){if(_0xf1c916){return _0x54b49a[_0x6d33('0x19')](_0x8e5f78);}return _0x54b49a[_0x6d33('0x1a')](_0x8e5f78)[_0x6d33('0x1b')]();};}function respondWithResult(_0x538da2,_0x2b0142){_0x2b0142=_0x2b0142||0xc8;return function(_0x45d47c){if(_0x45d47c){return _0x538da2[_0x6d33('0x1a')](_0x2b0142)[_0x6d33('0x1c')](_0x45d47c);}};}function respondWithFilteredResult(_0x12f7a3,_0x4f7774){return function(_0x3111d3){if(_0x3111d3){var _0x3b192b=typeof _0x4f7774[_0x6d33('0x1d')]==='undefined'&&typeof _0x4f7774[_0x6d33('0x1e')]===_0x6d33('0x1f');var _0x35fdcb=_0x3111d3[_0x6d33('0x20')];var _0x2634a7=_0x3b192b?0x0:_0x4f7774['offset'];var _0x33fd9e=_0x3b192b?_0x3111d3[_0x6d33('0x20')]:_0x4f7774[_0x6d33('0x1d')]+_0x4f7774[_0x6d33('0x1e')];var _0x523ce5;if(_0x33fd9e>=_0x35fdcb){_0x33fd9e=_0x35fdcb;_0x523ce5=0xc8;}else{_0x523ce5=0xce;}_0x12f7a3['status'](_0x523ce5);return _0x12f7a3[_0x6d33('0x21')](_0x6d33('0x22'),_0x2634a7+'-'+_0x33fd9e+'/'+_0x35fdcb)['json'](_0x3111d3);}return null;};}function patchUpdates(_0x3c8ca6){return function(_0x4c0ed7){try{jsonpatch[_0x6d33('0x23')](_0x4c0ed7,_0x3c8ca6,!![]);}catch(_0x3d1da5){return BPromise[_0x6d33('0x24')](_0x3d1da5);}return _0x4c0ed7['save']();};}function saveUpdates(_0x139b98,_0x2931b3){return function(_0x5a071f){if(_0x5a071f){return _0x5a071f['update'](_0x139b98)[_0x6d33('0x25')](function(_0x2b9edc){return _0x2b9edc;});}return null;};}function removeEntity(_0x2001fd,_0xbe30f1){return function(_0x210c2b){if(_0x210c2b){return _0x210c2b[_0x6d33('0x26')]()[_0x6d33('0x25')](function(){_0x2001fd[_0x6d33('0x1a')](0xcc)[_0x6d33('0x1b')]();});}};}function handleEntityNotFound(_0x4fd2c8,_0x40e87){return function(_0x38031b){if(!_0x38031b){_0x4fd2c8[_0x6d33('0x19')](0x194);}return _0x38031b;};}function handleError(_0x4d4b8a,_0xc83f3b){_0xc83f3b=_0xc83f3b||0x1f4;return function(_0x5dd378){logger[_0x6d33('0x27')](_0x5dd378[_0x6d33('0x28')]);if(_0x5dd378[_0x6d33('0x29')]){delete _0x5dd378['name'];}_0x4d4b8a['status'](_0xc83f3b)[_0x6d33('0x2a')](_0x5dd378);};}exports['index']=function(_0x208292,_0x1df84b){var _0x4d0da2={},_0x59ae48={},_0x17d984={'count':0x0,'rows':[]};var _0x5eb253=_[_0x6d33('0x2b')](db[_0x6d33('0x2c')]['rawAttributes'],function(_0x1294b4){return{'name':_0x1294b4[_0x6d33('0x2d')],'type':_0x1294b4[_0x6d33('0x2e')]['key']};});_0x59ae48[_0x6d33('0x2f')]=_[_0x6d33('0x2b')](_0x5eb253,_0x6d33('0x29'));_0x59ae48[_0x6d33('0x30')]=_[_0x6d33('0x31')](_0x208292[_0x6d33('0x30')]);_0x59ae48[_0x6d33('0x32')]=_[_0x6d33('0x33')](_0x59ae48[_0x6d33('0x2f')],_0x59ae48[_0x6d33('0x30')]);_0x4d0da2['attributes']=_[_0x6d33('0x33')](_0x59ae48[_0x6d33('0x2f')],qs[_0x6d33('0x34')](_0x208292[_0x6d33('0x30')]['fields']));_0x4d0da2[_0x6d33('0x35')]=_0x4d0da2[_0x6d33('0x35')][_0x6d33('0x36')]?_0x4d0da2[_0x6d33('0x35')]:_0x59ae48[_0x6d33('0x2f')];if(!_0x208292['query']['hasOwnProperty'](_0x6d33('0x37'))){_0x4d0da2[_0x6d33('0x1e')]=qs[_0x6d33('0x1e')](_0x208292[_0x6d33('0x30')]['limit']);_0x4d0da2[_0x6d33('0x1d')]=qs[_0x6d33('0x1d')](_0x208292['query'][_0x6d33('0x1d')]);}_0x4d0da2[_0x6d33('0x38')]=qs[_0x6d33('0x39')](_0x208292['query'][_0x6d33('0x39')]);_0x4d0da2[_0x6d33('0x3a')]=qs['filters'](_[_0x6d33('0x3b')](_0x208292[_0x6d33('0x30')],_0x59ae48[_0x6d33('0x32')]),_0x5eb253);if(_0x208292[_0x6d33('0x30')]['filter']){_0x4d0da2['where']=_[_0x6d33('0x3c')](_0x4d0da2['where'],{'$or':_[_0x6d33('0x2b')](_0x5eb253,function(_0x3d17fb){if(_0x3d17fb[_0x6d33('0x2e')]!==_0x6d33('0x3d')){var _0x457f08={};_0x457f08[_0x3d17fb[_0x6d33('0x29')]]={'$like':'%'+_0x208292[_0x6d33('0x30')][_0x6d33('0x3e')]+'%'};return _0x457f08;}})});}_0x4d0da2=_[_0x6d33('0x3c')]({},_0x4d0da2,_0x208292[_0x6d33('0x3f')]);var _0x150784={'where':_0x4d0da2[_0x6d33('0x3a')]};return db[_0x6d33('0x2c')][_0x6d33('0x20')](_0x150784)[_0x6d33('0x25')](function(_0x11f463){_0x17d984[_0x6d33('0x20')]=_0x11f463;if(_0x208292[_0x6d33('0x30')][_0x6d33('0x40')]){_0x4d0da2['include']=[{'all':!![]}];}return db[_0x6d33('0x2c')][_0x6d33('0x41')](_0x4d0da2);})[_0x6d33('0x25')](function(_0x42d1dd){_0x17d984['rows']=_0x42d1dd;return _0x17d984;})[_0x6d33('0x25')](respondWithFilteredResult(_0x1df84b,_0x4d0da2))[_0x6d33('0x42')](handleError(_0x1df84b,null));};exports[_0x6d33('0x43')]=function(_0x41ee1f,_0x543950){var _0x139071={'raw':![],'where':{'id':_0x41ee1f[_0x6d33('0x44')]['id']}},_0x1949b2={};_0x1949b2[_0x6d33('0x2f')]=_[_0x6d33('0x31')](db[_0x6d33('0x2c')][_0x6d33('0x45')]);_0x1949b2[_0x6d33('0x30')]=_[_0x6d33('0x31')](_0x41ee1f[_0x6d33('0x30')]);_0x1949b2[_0x6d33('0x32')]=_[_0x6d33('0x33')](_0x1949b2[_0x6d33('0x2f')],_0x1949b2[_0x6d33('0x30')]);_0x139071[_0x6d33('0x35')]=_[_0x6d33('0x33')](_0x1949b2[_0x6d33('0x2f')],qs[_0x6d33('0x34')](_0x41ee1f[_0x6d33('0x30')][_0x6d33('0x34')]));_0x139071[_0x6d33('0x35')]=_0x139071[_0x6d33('0x35')][_0x6d33('0x36')]?_0x139071['attributes']:_0x1949b2[_0x6d33('0x2f')];if(_0x41ee1f[_0x6d33('0x30')][_0x6d33('0x40')]){_0x139071[_0x6d33('0x46')]=[{'all':!![]}];}_0x139071=_[_0x6d33('0x3c')]({},_0x139071,_0x41ee1f[_0x6d33('0x3f')]);return db[_0x6d33('0x2c')][_0x6d33('0x47')](_0x139071)[_0x6d33('0x25')](handleEntityNotFound(_0x543950,null))[_0x6d33('0x25')](respondWithResult(_0x543950,null))[_0x6d33('0x42')](handleError(_0x543950,null));};exports['create']=function(_0x592b86,_0x4b5ea4){return db[_0x6d33('0x2c')][_0x6d33('0x48')](_0x592b86['body'],{})['then'](respondWithResult(_0x4b5ea4,0xc9))['catch'](handleError(_0x4b5ea4,null));};exports['update']=function(_0x7d79,_0x53527b){if(_0x7d79[_0x6d33('0x49')]['id']){delete _0x7d79['body']['id'];}return db[_0x6d33('0x2c')][_0x6d33('0x47')]({'where':{'id':_0x7d79[_0x6d33('0x44')]['id']}})[_0x6d33('0x25')](handleEntityNotFound(_0x53527b,null))[_0x6d33('0x25')](saveUpdates(_0x7d79[_0x6d33('0x49')],null))[_0x6d33('0x25')](respondWithResult(_0x53527b,null))['catch'](handleError(_0x53527b,null));};exports['destroy']=function(_0x593e33,_0x587937){return db[_0x6d33('0x2c')][_0x6d33('0x47')]({'where':{'id':_0x593e33[_0x6d33('0x44')]['id']}})[_0x6d33('0x25')](handleEntityNotFound(_0x587937,null))['then'](removeEntity(_0x587937,null))[_0x6d33('0x42')](handleError(_0x587937,null));};exports[_0x6d33('0x4a')]=function(_0x1dcecb,_0x54a89d,_0x1f2a76){var _0x41241a={};var _0x2d0972={};var _0x393fb2;var _0x578f3e;return db[_0x6d33('0x2c')]['findOne']({'where':{'id':_0x1dcecb[_0x6d33('0x44')]['id']}})[_0x6d33('0x25')](handleEntityNotFound(_0x54a89d,null))[_0x6d33('0x25')](function(_0x6b6391){if(_0x6b6391){_0x393fb2=_0x6b6391;_0x2d0972['model']=_[_0x6d33('0x31')](db[_0x6d33('0x4b')][_0x6d33('0x45')]);_0x2d0972['query']=_[_0x6d33('0x31')](_0x1dcecb[_0x6d33('0x30')]);_0x2d0972[_0x6d33('0x32')]=_[_0x6d33('0x33')](_0x2d0972[_0x6d33('0x2f')],_0x2d0972[_0x6d33('0x30')]);_0x41241a['attributes']=_[_0x6d33('0x33')](_0x2d0972[_0x6d33('0x2f')],qs[_0x6d33('0x34')](_0x1dcecb[_0x6d33('0x30')][_0x6d33('0x34')]));_0x41241a[_0x6d33('0x35')]=_0x41241a['attributes'][_0x6d33('0x36')]?_0x41241a[_0x6d33('0x35')]:_0x2d0972[_0x6d33('0x2f')];_0x41241a[_0x6d33('0x38')]=qs[_0x6d33('0x39')](_0x1dcecb[_0x6d33('0x30')]['sort']);_0x41241a[_0x6d33('0x3a')]=qs[_0x6d33('0x32')](_[_0x6d33('0x3b')](_0x1dcecb[_0x6d33('0x30')],_0x2d0972[_0x6d33('0x32')]));if(_0x1dcecb[_0x6d33('0x30')][_0x6d33('0x3e')]){_0x41241a['where']=_['merge'](_0x41241a[_0x6d33('0x3a')],{'$or':_['map'](_0x41241a[_0x6d33('0x35')],function(_0x2901b8){var _0x38db7c={};_0x38db7c[_0x2901b8]={'$like':'%'+_0x1dcecb['query'][_0x6d33('0x3e')]+'%'};return _0x38db7c;})});}_0x41241a=_[_0x6d33('0x3c')]({},_0x41241a,_0x1dcecb[_0x6d33('0x3f')]);return _0x393fb2[_0x6d33('0x4a')](_0x41241a);}})['then'](function(_0x5be7e){if(_0x5be7e){_0x578f3e=_0x5be7e[_0x6d33('0x36')];if(!_0x1dcecb[_0x6d33('0x30')]['hasOwnProperty'](_0x6d33('0x37'))){_0x41241a[_0x6d33('0x1e')]=qs[_0x6d33('0x1e')](_0x1dcecb[_0x6d33('0x30')][_0x6d33('0x1e')]);_0x41241a[_0x6d33('0x1d')]=qs[_0x6d33('0x1d')](_0x1dcecb[_0x6d33('0x30')][_0x6d33('0x1d')]);}return _0x393fb2[_0x6d33('0x4a')](_0x41241a);}})[_0x6d33('0x25')](function(_0xf70868){if(_0xf70868){return _0xf70868?{'count':_0x578f3e,'rows':_0xf70868}:null;}})['then'](respondWithResult(_0x54a89d,null))[_0x6d33('0x42')](handleError(_0x54a89d,null));};exports[_0x6d33('0x4c')]=function(_0xedebd4,_0x3be2cc,_0x5e2098){var _0x55f73e={};var _0x48cd6e={};var _0x82f748;var _0x19bde9;return db[_0x6d33('0x2c')][_0x6d33('0x4d')]({'where':{'id':_0xedebd4[_0x6d33('0x44')]['id']}})['then'](handleEntityNotFound(_0x3be2cc,null))[_0x6d33('0x25')](function(_0x5cc615){if(_0x5cc615){_0x82f748=_0x5cc615;_0x48cd6e[_0x6d33('0x2f')]=_[_0x6d33('0x31')](db[_0x6d33('0x4b')][_0x6d33('0x45')]);_0x48cd6e[_0x6d33('0x30')]=_[_0x6d33('0x31')](_0xedebd4[_0x6d33('0x30')]);_0x48cd6e[_0x6d33('0x32')]=_[_0x6d33('0x33')](_0x48cd6e['model'],_0x48cd6e['query']);_0x55f73e['attributes']=_[_0x6d33('0x33')](_0x48cd6e['model'],qs['fields'](_0xedebd4[_0x6d33('0x30')][_0x6d33('0x34')]));_0x55f73e['attributes']=_0x55f73e[_0x6d33('0x35')][_0x6d33('0x36')]?_0x55f73e[_0x6d33('0x35')]:_0x48cd6e['model'];_0x55f73e[_0x6d33('0x38')]=qs[_0x6d33('0x39')](_0xedebd4[_0x6d33('0x30')][_0x6d33('0x39')]);_0x55f73e[_0x6d33('0x3a')]=qs[_0x6d33('0x32')](_[_0x6d33('0x3b')](_0xedebd4[_0x6d33('0x30')],_0x48cd6e[_0x6d33('0x32')]));if(_0xedebd4[_0x6d33('0x30')][_0x6d33('0x3e')]){_0x55f73e['where']=_['merge'](_0x55f73e[_0x6d33('0x3a')],{'$or':_[_0x6d33('0x2b')](_0x55f73e[_0x6d33('0x35')],function(_0x27ca4a){var _0x2ef81d={};_0x2ef81d[_0x27ca4a]={'$like':'%'+_0xedebd4[_0x6d33('0x30')][_0x6d33('0x3e')]+'%'};return _0x2ef81d;})});}_0x55f73e=_[_0x6d33('0x3c')]({},_0x55f73e,_0xedebd4[_0x6d33('0x3f')]);return _0x82f748['getSubjects'](_0x55f73e);}})[_0x6d33('0x25')](function(_0x138120){if(_0x138120){_0x19bde9=_0x138120[_0x6d33('0x36')];if(!_0xedebd4[_0x6d33('0x30')]['hasOwnProperty'](_0x6d33('0x37'))){_0x55f73e[_0x6d33('0x1e')]=qs[_0x6d33('0x1e')](_0xedebd4['query'][_0x6d33('0x1e')]);_0x55f73e[_0x6d33('0x1d')]=qs[_0x6d33('0x1d')](_0xedebd4[_0x6d33('0x30')][_0x6d33('0x1d')]);}return _0x82f748[_0x6d33('0x4c')](_0x55f73e);}})[_0x6d33('0x25')](function(_0x190e7c){if(_0x190e7c){return _0x190e7c?{'count':_0x19bde9,'rows':_0x190e7c}:null;}})[_0x6d33('0x25')](respondWithResult(_0x3be2cc,null))[_0x6d33('0x42')](handleError(_0x3be2cc,null));};exports['getDescriptions']=function(_0x1cdc9f,_0x4bed0a,_0x34c095){var _0x3d3f11={};var _0x3b5457={};var _0x4e2b8c;var _0x1ab687;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x1cdc9f[_0x6d33('0x44')]['id']}})['then'](handleEntityNotFound(_0x4bed0a,null))[_0x6d33('0x25')](function(_0x7f1473){if(_0x7f1473){_0x4e2b8c=_0x7f1473;_0x3b5457[_0x6d33('0x2f')]=_[_0x6d33('0x31')](db[_0x6d33('0x4b')][_0x6d33('0x45')]);_0x3b5457[_0x6d33('0x30')]=_[_0x6d33('0x31')](_0x1cdc9f[_0x6d33('0x30')]);_0x3b5457['filters']=_[_0x6d33('0x33')](_0x3b5457['model'],_0x3b5457[_0x6d33('0x30')]);_0x3d3f11[_0x6d33('0x35')]=_[_0x6d33('0x33')](_0x3b5457[_0x6d33('0x2f')],qs[_0x6d33('0x34')](_0x1cdc9f[_0x6d33('0x30')][_0x6d33('0x34')]));_0x3d3f11[_0x6d33('0x35')]=_0x3d3f11[_0x6d33('0x35')][_0x6d33('0x36')]?_0x3d3f11[_0x6d33('0x35')]:_0x3b5457[_0x6d33('0x2f')];_0x3d3f11['order']=qs[_0x6d33('0x39')](_0x1cdc9f[_0x6d33('0x30')]['sort']);_0x3d3f11['where']=qs[_0x6d33('0x32')](_[_0x6d33('0x3b')](_0x1cdc9f[_0x6d33('0x30')],_0x3b5457['filters']));if(_0x1cdc9f[_0x6d33('0x30')][_0x6d33('0x3e')]){_0x3d3f11['where']=_['merge'](_0x3d3f11[_0x6d33('0x3a')],{'$or':_[_0x6d33('0x2b')](_0x3d3f11[_0x6d33('0x35')],function(_0xe576d9){var _0x814c82={};_0x814c82[_0xe576d9]={'$like':'%'+_0x1cdc9f['query']['filter']+'%'};return _0x814c82;})});}_0x3d3f11=_[_0x6d33('0x3c')]({},_0x3d3f11,_0x1cdc9f[_0x6d33('0x3f')]);return _0x4e2b8c[_0x6d33('0x4e')](_0x3d3f11);}})[_0x6d33('0x25')](function(_0x55640b){if(_0x55640b){_0x1ab687=_0x55640b[_0x6d33('0x36')];if(!_0x1cdc9f[_0x6d33('0x30')][_0x6d33('0x4f')](_0x6d33('0x37'))){_0x3d3f11[_0x6d33('0x1e')]=qs[_0x6d33('0x1e')](_0x1cdc9f['query'][_0x6d33('0x1e')]);_0x3d3f11[_0x6d33('0x1d')]=qs[_0x6d33('0x1d')](_0x1cdc9f['query'][_0x6d33('0x1d')]);}return _0x4e2b8c[_0x6d33('0x4e')](_0x3d3f11);}})['then'](function(_0x5c9fef){if(_0x5c9fef){return _0x5c9fef?{'count':_0x1ab687,'rows':_0x5c9fef}:null;}})[_0x6d33('0x25')](respondWithResult(_0x4bed0a,null))[_0x6d33('0x42')](handleError(_0x4bed0a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 9d26598..6befb22 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 _0x55ca=['./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x58f245,_0x3e4f31){var _0x1f0cfb=function(_0x515942){while(--_0x515942){_0x58f245['push'](_0x58f245['shift']());}};_0x1f0cfb(++_0x3e4f31);}(_0x55ca,0x126));var _0xa55c=function(_0x2a5160,_0x5f068d){_0x2a5160=_0x2a5160-0x0;var _0x2b42c5=_0x55ca[_0x2a5160];return _0x2b42c5;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Dynamics365Configuration',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['int_dynamics365_configurations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x151ae3,_0x3a9195){var _0x564680=function(_0x244bf7){while(--_0x244bf7){_0x151ae3['push'](_0x151ae3['shift']());}};_0x564680(++_0x3a9195);}(_0x70e0,0x17b));var _0x070e=function(_0x339101,_0xeaba92){_0x339101=_0x339101-0x0;var _0x433321=_0x70e0[_0x339101];return _0x433321;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('Dynamics365Configuration',attributes,{'tableName':_0x070e('0x8'),'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 4de483e..e874129 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 _0xa512=['info','Dynamics365Configuration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x397f34,_0x3ac328){var _0x272cda=function(_0x2c9756){while(--_0x2c9756){_0x397f34['push'](_0x397f34['shift']());}};_0x272cda(++_0x3ac328);}(_0xa512,0x111));var _0x2a51=function(_0x4756a1,_0x3f8d1){_0x4756a1=_0x4756a1-0x0;var _0x177c4f=_0xa512[_0x4756a1];return _0x177c4f;};'use strict';var _=require(_0x2a51('0x0'));var util=require(_0x2a51('0x1'));var moment=require(_0x2a51('0x2'));var BPromise=require(_0x2a51('0x3'));var rs=require(_0x2a51('0x4'));var fs=require('fs');var Redis=require(_0x2a51('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a51('0x6'));var logger=require(_0x2a51('0x7'))('rpc');var config=require(_0x2a51('0x8'));var jayson=require(_0x2a51('0x9'));var client=jayson[_0x2a51('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5633bd,_0x451c4c,_0x3b7431){return new BPromise(function(_0x26aaaf,_0x271a6d){return client[_0x2a51('0xb')](_0x5633bd,_0x3b7431)[_0x2a51('0xc')](function(_0x431bbf){logger[_0x2a51('0xd')](_0x2a51('0xe'),_0x451c4c,'request\x20sent');logger[_0x2a51('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x451c4c,_0x2a51('0x10'),JSON[_0x2a51('0x11')](_0x431bbf));if(_0x431bbf['error']){if(_0x431bbf[_0x2a51('0x12')][_0x2a51('0x13')]===0x1f4){logger[_0x2a51('0x12')](_0x2a51('0xe'),_0x451c4c,_0x431bbf[_0x2a51('0x12')][_0x2a51('0x14')]);return _0x271a6d(_0x431bbf[_0x2a51('0x12')]['message']);}logger[_0x2a51('0x12')](_0x2a51('0xe'),_0x451c4c,_0x431bbf[_0x2a51('0x12')][_0x2a51('0x14')]);return _0x26aaaf(_0x431bbf[_0x2a51('0x12')][_0x2a51('0x14')]);}else{logger[_0x2a51('0xd')](_0x2a51('0xe'),_0x451c4c,_0x2a51('0x10'));_0x26aaaf(_0x431bbf[_0x2a51('0x15')][_0x2a51('0x14')]);}})['catch'](function(_0x208cce){logger[_0x2a51('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x451c4c,_0x208cce);_0x271a6d(_0x208cce);});});} \ No newline at end of file +var _0xdae3=['message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xdae3,0x153));var _0x3dae=function(_0x207f8f,_0x201568){_0x207f8f=_0x207f8f-0x0;var _0x43b0de=_0xdae3[_0x207f8f];return _0x43b0de;};'use strict';var _=require('lodash');var util=require(_0x3dae('0x0'));var moment=require('moment');var BPromise=require(_0x3dae('0x1'));var rs=require(_0x3dae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3dae('0x3'))['db'];var utils=require(_0x3dae('0x4'));var logger=require(_0x3dae('0x5'))(_0x3dae('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3dae('0x7')][_0x3dae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x161cff,_0x40024a,_0xcd93e0){return new BPromise(function(_0x22cf60,_0x4aa7f9){return client[_0x3dae('0x9')](_0x161cff,_0xcd93e0)['then'](function(_0x467429){logger[_0x3dae('0xa')](_0x3dae('0xb'),_0x40024a,_0x3dae('0xc'));logger[_0x3dae('0xd')](_0x3dae('0xe'),_0x40024a,_0x3dae('0xc'),JSON[_0x3dae('0xf')](_0x467429));if(_0x467429[_0x3dae('0x10')]){if(_0x467429[_0x3dae('0x10')][_0x3dae('0x11')]===0x1f4){logger[_0x3dae('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x40024a,_0x467429[_0x3dae('0x10')][_0x3dae('0x12')]);return _0x4aa7f9(_0x467429[_0x3dae('0x10')][_0x3dae('0x12')]);}logger[_0x3dae('0x10')](_0x3dae('0xb'),_0x40024a,_0x467429[_0x3dae('0x10')][_0x3dae('0x12')]);return _0x22cf60(_0x467429[_0x3dae('0x10')][_0x3dae('0x12')]);}else{logger[_0x3dae('0xa')](_0x3dae('0xb'),_0x40024a,'request\x20sent');_0x22cf60(_0x467429[_0x3dae('0x13')]['message']);}})[_0x3dae('0x14')](function(_0x279b6a){logger[_0x3dae('0x10')](_0x3dae('0xb'),_0x40024a,_0x279b6a);_0x4aa7f9(_0x279b6a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 8fa2bcc..4da4662 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 _0xb570=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x1e5ad1,_0x109a16){var _0x5aa0ce=function(_0x3f919b){while(--_0x3f919b){_0x1e5ad1['push'](_0x1e5ad1['shift']());}};_0x5aa0ce(++_0x109a16);}(_0xb570,0x79));var _0x0b57=function(_0x2d3746,_0x3c93db){_0x2d3746=_0x2d3746-0x0;var _0x41516a=_0xb570[_0x2d3746];return _0x41516a;};'use strict';var multer=require(_0x0b57('0x0'));var util=require(_0x0b57('0x1'));var path=require(_0x0b57('0x2'));var timeout=require(_0x0b57('0x3'));var express=require(_0x0b57('0x4'));var router=express[_0x0b57('0x5')]();var fs_extra=require(_0x0b57('0x6'));var auth=require(_0x0b57('0x7'));var interaction=require(_0x0b57('0x8'));var config=require(_0x0b57('0x9'));var controller=require(_0x0b57('0xa'));router[_0x0b57('0xb')]('/',auth['isAuthenticated'](),controller[_0x0b57('0xc')]);router[_0x0b57('0xb')](_0x0b57('0xd'),auth[_0x0b57('0xe')](),controller[_0x0b57('0xf')]);router[_0x0b57('0x10')]('/',auth['isAuthenticated'](),controller[_0x0b57('0x11')]);router[_0x0b57('0x12')]('/:id',auth[_0x0b57('0xe')](),controller[_0x0b57('0x13')]);router[_0x0b57('0x14')](_0x0b57('0xd'),auth[_0x0b57('0xe')](),controller[_0x0b57('0x15')]);module[_0x0b57('0x16')]=router; \ No newline at end of file +var _0x3790=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intDynamics365Field.controller'];(function(_0x21b293,_0x352a44){var _0xd73e84=function(_0x16916b){while(--_0x16916b){_0x21b293['push'](_0x21b293['shift']());}};_0xd73e84(++_0x352a44);}(_0x3790,0x19a));var _0x0379=function(_0x297797,_0x426c59){_0x297797=_0x297797-0x0;var _0x2cd7e9=_0x3790[_0x297797];return _0x2cd7e9;};'use strict';var multer=require(_0x0379('0x0'));var util=require(_0x0379('0x1'));var path=require(_0x0379('0x2'));var timeout=require(_0x0379('0x3'));var express=require(_0x0379('0x4'));var router=express['Router']();var fs_extra=require(_0x0379('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0379('0x6'));var config=require('../../config/environment');var controller=require(_0x0379('0x7'));router[_0x0379('0x8')]('/',auth[_0x0379('0x9')](),controller[_0x0379('0xa')]);router[_0x0379('0x8')](_0x0379('0xb'),auth[_0x0379('0x9')](),controller[_0x0379('0xc')]);router[_0x0379('0xd')]('/',auth['isAuthenticated'](),controller[_0x0379('0xe')]);router[_0x0379('0xf')](_0x0379('0xb'),auth[_0x0379('0x9')](),controller[_0x0379('0x10')]);router['delete'](_0x0379('0xb'),auth[_0x0379('0x9')](),controller[_0x0379('0x11')]);module[_0x0379('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 75d9232..ccc47e0 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 _0x8871=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x4951db,_0x392e26){var _0x2ade73=function(_0x49e0f0){while(--_0x49e0f0){_0x4951db['push'](_0x4951db['shift']());}};_0x2ade73(++_0x392e26);}(_0x8871,0x1d6));var _0x1887=function(_0x1dacd4,_0x4259f7){_0x1dacd4=_0x1dacd4-0x0;var _0x5c29c5=_0x8871[_0x1dacd4];return _0x5c29c5;};'use strict';var Sequelize=require(_0x1887('0x0'));module[_0x1887('0x1')]={'type':{'type':Sequelize[_0x1887('0x2')](_0x1887('0x3'),_0x1887('0x4'),_0x1887('0x5'),'keyValue',_0x1887('0x6')),'defaultValue':_0x1887('0x3')},'content':{'type':Sequelize[_0x1887('0x7')]},'key':{'type':Sequelize[_0x1887('0x7')]},'keyType':{'type':Sequelize[_0x1887('0x2')]('string','variable',_0x1887('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1887('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1887('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5b72=['string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','exports'];(function(_0x512640,_0x58390d){var _0x107ba7=function(_0x10dc90){while(--_0x10dc90){_0x512640['push'](_0x512640['shift']());}};_0x107ba7(++_0x58390d);}(_0x5b72,0xa9));var _0x25b7=function(_0x59d98a,_0x190c6c){_0x59d98a=_0x59d98a-0x0;var _0x5e1d08=_0x5b72[_0x59d98a];return _0x5e1d08;};'use strict';var Sequelize=require(_0x25b7('0x0'));module[_0x25b7('0x1')]={'type':{'type':Sequelize['ENUM'](_0x25b7('0x2'),_0x25b7('0x3'),_0x25b7('0x4'),_0x25b7('0x5'),'picklist'),'defaultValue':_0x25b7('0x2')},'content':{'type':Sequelize[_0x25b7('0x6')]},'key':{'type':Sequelize[_0x25b7('0x6')]},'keyType':{'type':Sequelize[_0x25b7('0x7')]('string','variable',_0x25b7('0x4'))},'keyContent':{'type':Sequelize[_0x25b7('0x6')]},'idField':{'type':Sequelize[_0x25b7('0x6')]},'nameField':{'type':Sequelize[_0x25b7('0x6')]},'customField':{'type':Sequelize[_0x25b7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index e3fee1c..851af33 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 _0x2afd=['type','filter','options','includeAll','include','show','params','keys','length','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x2afd,0x135));var _0xd2af=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2afd[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xd2af('0x0'));var rimraf=require(_0xd2af('0x1'));var zipdir=require(_0xd2af('0x2'));var jsonpatch=require(_0xd2af('0x3'));var rp=require('request-promise');var moment=require(_0xd2af('0x4'));var BPromise=require(_0xd2af('0x5'));var Mustache=require(_0xd2af('0x6'));var util=require(_0xd2af('0x7'));var path=require(_0xd2af('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd2af('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd2af('0xa'));var squel=require(_0xd2af('0xb'));var crypto=require(_0xd2af('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd2af('0xd'));var toCsv=require(_0xd2af('0xe'));var querystring=require(_0xd2af('0xf'));var Papa=require('papaparse');var Redis=require(_0xd2af('0x10'));var authService=require(_0xd2af('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd2af('0x12'));var hardwareService=require(_0xd2af('0x13'));var logger=require(_0xd2af('0x14'))(_0xd2af('0x15'));var utils=require(_0xd2af('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd2af('0x17'));var db=require(_0xd2af('0x18'))['db'];function respondWithStatusCode(_0x509c9f,_0x2940e2){_0x2940e2=_0x2940e2||0xcc;return function(_0x170a59){if(_0x170a59){return _0x509c9f['sendStatus'](_0x2940e2);}return _0x509c9f[_0xd2af('0x19')](_0x2940e2)[_0xd2af('0x1a')]();};}function respondWithResult(_0x274175,_0x4ad28e){_0x4ad28e=_0x4ad28e||0xc8;return function(_0x342a6a){if(_0x342a6a){return _0x274175[_0xd2af('0x19')](_0x4ad28e)[_0xd2af('0x1b')](_0x342a6a);}};}function respondWithFilteredResult(_0x1b73d8,_0x1468af){return function(_0x5b2ef8){if(_0x5b2ef8){var _0x3b3e4b=typeof _0x1468af[_0xd2af('0x1c')]===_0xd2af('0x1d')&&typeof _0x1468af['limit']==='undefined';var _0x3b36bf=_0x5b2ef8[_0xd2af('0x1e')];var _0x26d33b=_0x3b3e4b?0x0:_0x1468af[_0xd2af('0x1c')];var _0x318bc1=_0x3b3e4b?_0x5b2ef8[_0xd2af('0x1e')]:_0x1468af['offset']+_0x1468af[_0xd2af('0x1f')];var _0x42e7f5;if(_0x318bc1>=_0x3b36bf){_0x318bc1=_0x3b36bf;_0x42e7f5=0xc8;}else{_0x42e7f5=0xce;}_0x1b73d8['status'](_0x42e7f5);return _0x1b73d8[_0xd2af('0x20')](_0xd2af('0x21'),_0x26d33b+'-'+_0x318bc1+'/'+_0x3b36bf)[_0xd2af('0x1b')](_0x5b2ef8);}return null;};}function patchUpdates(_0x28dbd5){return function(_0x3bfc81){try{jsonpatch[_0xd2af('0x22')](_0x3bfc81,_0x28dbd5,!![]);}catch(_0x2a9624){return BPromise[_0xd2af('0x23')](_0x2a9624);}return _0x3bfc81[_0xd2af('0x24')]();};}function saveUpdates(_0x43a441,_0x27e26f){return function(_0x54613){if(_0x54613){return _0x54613[_0xd2af('0x25')](_0x43a441)[_0xd2af('0x26')](function(_0x5addac){return _0x5addac;});}return null;};}function removeEntity(_0x47a0c4,_0x5582e5){return function(_0x34c15c){if(_0x34c15c){return _0x34c15c[_0xd2af('0x27')]()[_0xd2af('0x26')](function(){_0x47a0c4[_0xd2af('0x19')](0xcc)[_0xd2af('0x1a')]();});}};}function handleEntityNotFound(_0x5c4cf2,_0x1993c8){return function(_0x1a06f4){if(!_0x1a06f4){_0x5c4cf2['sendStatus'](0x194);}return _0x1a06f4;};}function handleError(_0x2753d6,_0x5588ac){_0x5588ac=_0x5588ac||0x1f4;return function(_0x29afcd){logger['error'](_0x29afcd[_0xd2af('0x28')]);if(_0x29afcd[_0xd2af('0x29')]){delete _0x29afcd['name'];}_0x2753d6[_0xd2af('0x19')](_0x5588ac)[_0xd2af('0x2a')](_0x29afcd);};}exports[_0xd2af('0x2b')]=function(_0x29ee21,_0x5ce33e){var _0x52ff14={},_0x38ccca={},_0x22cfc2={'count':0x0,'rows':[]};var _0x5848f7=_['map'](db[_0xd2af('0x2c')][_0xd2af('0x2d')],function(_0x330884){return{'name':_0x330884[_0xd2af('0x2e')],'type':_0x330884['type'][_0xd2af('0x2f')]};});_0x38ccca[_0xd2af('0x30')]=_[_0xd2af('0x31')](_0x5848f7,'name');_0x38ccca[_0xd2af('0x32')]=_['keys'](_0x29ee21[_0xd2af('0x32')]);_0x38ccca[_0xd2af('0x33')]=_[_0xd2af('0x34')](_0x38ccca[_0xd2af('0x30')],_0x38ccca['query']);_0x52ff14['attributes']=_[_0xd2af('0x34')](_0x38ccca[_0xd2af('0x30')],qs[_0xd2af('0x35')](_0x29ee21[_0xd2af('0x32')][_0xd2af('0x35')]));_0x52ff14['attributes']=_0x52ff14[_0xd2af('0x36')]['length']?_0x52ff14[_0xd2af('0x36')]:_0x38ccca[_0xd2af('0x30')];if(!_0x29ee21[_0xd2af('0x32')][_0xd2af('0x37')](_0xd2af('0x38'))){_0x52ff14[_0xd2af('0x1f')]=qs[_0xd2af('0x1f')](_0x29ee21[_0xd2af('0x32')]['limit']);_0x52ff14[_0xd2af('0x1c')]=qs[_0xd2af('0x1c')](_0x29ee21[_0xd2af('0x32')]['offset']);}_0x52ff14[_0xd2af('0x39')]=qs[_0xd2af('0x3a')](_0x29ee21[_0xd2af('0x32')][_0xd2af('0x3a')]);_0x52ff14['where']=qs[_0xd2af('0x33')](_['pick'](_0x29ee21[_0xd2af('0x32')],_0x38ccca[_0xd2af('0x33')]),_0x5848f7);if(_0x29ee21[_0xd2af('0x32')]['filter']){_0x52ff14[_0xd2af('0x3b')]=_[_0xd2af('0x3c')](_0x52ff14[_0xd2af('0x3b')],{'$or':_[_0xd2af('0x31')](_0x5848f7,function(_0x392537){if(_0x392537[_0xd2af('0x3d')]!=='VIRTUAL'){var _0x1f8466={};_0x1f8466[_0x392537[_0xd2af('0x29')]]={'$like':'%'+_0x29ee21[_0xd2af('0x32')][_0xd2af('0x3e')]+'%'};return _0x1f8466;}})});}_0x52ff14=_[_0xd2af('0x3c')]({},_0x52ff14,_0x29ee21[_0xd2af('0x3f')]);var _0xa39708={'where':_0x52ff14['where']};return db[_0xd2af('0x2c')][_0xd2af('0x1e')](_0xa39708)[_0xd2af('0x26')](function(_0x1ececb){_0x22cfc2['count']=_0x1ececb;if(_0x29ee21[_0xd2af('0x32')][_0xd2af('0x40')]){_0x52ff14[_0xd2af('0x41')]=[{'all':!![]}];}return db[_0xd2af('0x2c')]['findAll'](_0x52ff14);})[_0xd2af('0x26')](function(_0x11041f){_0x22cfc2['rows']=_0x11041f;return _0x22cfc2;})['then'](respondWithFilteredResult(_0x5ce33e,_0x52ff14))['catch'](handleError(_0x5ce33e,null));};exports[_0xd2af('0x42')]=function(_0x468621,_0x27a860){var _0x4ba69a={'raw':!![],'where':{'id':_0x468621[_0xd2af('0x43')]['id']}},_0x1a5fcd={};_0x1a5fcd[_0xd2af('0x30')]=_[_0xd2af('0x44')](db[_0xd2af('0x2c')][_0xd2af('0x2d')]);_0x1a5fcd[_0xd2af('0x32')]=_[_0xd2af('0x44')](_0x468621[_0xd2af('0x32')]);_0x1a5fcd['filters']=_[_0xd2af('0x34')](_0x1a5fcd['model'],_0x1a5fcd[_0xd2af('0x32')]);_0x4ba69a[_0xd2af('0x36')]=_[_0xd2af('0x34')](_0x1a5fcd[_0xd2af('0x30')],qs[_0xd2af('0x35')](_0x468621['query']['fields']));_0x4ba69a[_0xd2af('0x36')]=_0x4ba69a['attributes'][_0xd2af('0x45')]?_0x4ba69a['attributes']:_0x1a5fcd[_0xd2af('0x30')];if(_0x468621[_0xd2af('0x32')][_0xd2af('0x40')]){_0x4ba69a[_0xd2af('0x41')]=[{'all':!![]}];}_0x4ba69a=_[_0xd2af('0x3c')]({},_0x4ba69a,_0x468621['options']);return db[_0xd2af('0x2c')][_0xd2af('0x46')](_0x4ba69a)['then'](handleEntityNotFound(_0x27a860,null))[_0xd2af('0x26')](respondWithResult(_0x27a860,null))['catch'](handleError(_0x27a860,null));};exports['create']=function(_0x4af84f,_0x44c7d2){return db[_0xd2af('0x2c')][_0xd2af('0x47')](_0x4af84f[_0xd2af('0x48')],{})[_0xd2af('0x26')](respondWithResult(_0x44c7d2,0xc9))[_0xd2af('0x49')](handleError(_0x44c7d2,null));};exports[_0xd2af('0x25')]=function(_0x432783,_0x4a7c2e){if(_0x432783[_0xd2af('0x48')]['id']){delete _0x432783['body']['id'];}return db[_0xd2af('0x2c')][_0xd2af('0x46')]({'where':{'id':_0x432783[_0xd2af('0x43')]['id']}})[_0xd2af('0x26')](handleEntityNotFound(_0x4a7c2e,null))[_0xd2af('0x26')](saveUpdates(_0x432783['body'],null))[_0xd2af('0x26')](respondWithResult(_0x4a7c2e,null))[_0xd2af('0x49')](handleError(_0x4a7c2e,null));};exports[_0xd2af('0x27')]=function(_0x5f1596,_0x5c6ae4){return db['Dynamics365Field']['find']({'where':{'id':_0x5f1596[_0xd2af('0x43')]['id']}})[_0xd2af('0x26')](handleEntityNotFound(_0x5c6ae4,null))[_0xd2af('0x26')](removeEntity(_0x5c6ae4,null))[_0xd2af('0x49')](handleError(_0x5c6ae4,null));}; \ No newline at end of file +var _0x56dc=['filter','merge','Dynamics365Field','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','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/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x22338e,_0x24d42d){var _0x3d9668=function(_0x16bea9){while(--_0x16bea9){_0x22338e['push'](_0x22338e['shift']());}};_0x3d9668(++_0x24d42d);}(_0x56dc,0xe9));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc56d('0x0'));var zipdir=require(_0xc56d('0x1'));var jsonpatch=require(_0xc56d('0x2'));var rp=require(_0xc56d('0x3'));var moment=require(_0xc56d('0x4'));var BPromise=require(_0xc56d('0x5'));var Mustache=require(_0xc56d('0x6'));var util=require(_0xc56d('0x7'));var path=require(_0xc56d('0x8'));var sox=require(_0xc56d('0x9'));var csv=require(_0xc56d('0xa'));var ejs=require(_0xc56d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc56d('0xc'));var squel=require(_0xc56d('0xd'));var crypto=require('crypto');var jsforce=require(_0xc56d('0xe'));var deskjs=require(_0xc56d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc56d('0x10'));var Redis=require(_0xc56d('0x11'));var authService=require(_0xc56d('0x12'));var qs=require(_0xc56d('0x13'));var as=require(_0xc56d('0x14'));var hardwareService=require(_0xc56d('0x15'));var logger=require(_0xc56d('0x16'))(_0xc56d('0x17'));var utils=require('../../config/utils');var config=require(_0xc56d('0x18'));var licenseUtil=require(_0xc56d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b66b8,_0x3ace28){_0x3ace28=_0x3ace28||0xcc;return function(_0x2588fc){if(_0x2588fc){return _0x4b66b8[_0xc56d('0x1a')](_0x3ace28);}return _0x4b66b8['status'](_0x3ace28)[_0xc56d('0x1b')]();};}function respondWithResult(_0x38af89,_0x54da8c){_0x54da8c=_0x54da8c||0xc8;return function(_0x2050b5){if(_0x2050b5){return _0x38af89[_0xc56d('0x1c')](_0x54da8c)[_0xc56d('0x1d')](_0x2050b5);}};}function respondWithFilteredResult(_0x10853a,_0x274df2){return function(_0x2b3378){if(_0x2b3378){var _0x38fb07=typeof _0x274df2[_0xc56d('0x1e')]==='undefined'&&typeof _0x274df2['limit']===_0xc56d('0x1f');var _0x15a6e9=_0x2b3378[_0xc56d('0x20')];var _0x3ffe9e=_0x38fb07?0x0:_0x274df2['offset'];var _0x1dead0=_0x38fb07?_0x2b3378[_0xc56d('0x20')]:_0x274df2[_0xc56d('0x1e')]+_0x274df2[_0xc56d('0x21')];var _0x131f97;if(_0x1dead0>=_0x15a6e9){_0x1dead0=_0x15a6e9;_0x131f97=0xc8;}else{_0x131f97=0xce;}_0x10853a[_0xc56d('0x1c')](_0x131f97);return _0x10853a['set'](_0xc56d('0x22'),_0x3ffe9e+'-'+_0x1dead0+'/'+_0x15a6e9)['json'](_0x2b3378);}return null;};}function patchUpdates(_0x4f4c6e){return function(_0x344860){try{jsonpatch[_0xc56d('0x23')](_0x344860,_0x4f4c6e,!![]);}catch(_0x229f4a){return BPromise['reject'](_0x229f4a);}return _0x344860['save']();};}function saveUpdates(_0x494cf0,_0x3bc773){return function(_0x864f7f){if(_0x864f7f){return _0x864f7f[_0xc56d('0x24')](_0x494cf0)[_0xc56d('0x25')](function(_0x45f0ef){return _0x45f0ef;});}return null;};}function removeEntity(_0x4edd0f,_0x177019){return function(_0x1e7bac){if(_0x1e7bac){return _0x1e7bac[_0xc56d('0x26')]()[_0xc56d('0x25')](function(){_0x4edd0f[_0xc56d('0x1c')](0xcc)[_0xc56d('0x1b')]();});}};}function handleEntityNotFound(_0x43df36,_0x572f0c){return function(_0x4776f5){if(!_0x4776f5){_0x43df36['sendStatus'](0x194);}return _0x4776f5;};}function handleError(_0xfe174d,_0x2284c8){_0x2284c8=_0x2284c8||0x1f4;return function(_0x46ccf7){logger[_0xc56d('0x27')](_0x46ccf7['stack']);if(_0x46ccf7[_0xc56d('0x28')]){delete _0x46ccf7[_0xc56d('0x28')];}_0xfe174d['status'](_0x2284c8)['send'](_0x46ccf7);};}exports[_0xc56d('0x29')]=function(_0x59e944,_0x2240aa){var _0x32d10b={},_0x596cee={},_0x23ac01={'count':0x0,'rows':[]};var _0x28bc60=_[_0xc56d('0x2a')](db['Dynamics365Field'][_0xc56d('0x2b')],function(_0x3db968){return{'name':_0x3db968[_0xc56d('0x2c')],'type':_0x3db968[_0xc56d('0x2d')][_0xc56d('0x2e')]};});_0x596cee[_0xc56d('0x2f')]=_[_0xc56d('0x2a')](_0x28bc60,'name');_0x596cee[_0xc56d('0x30')]=_[_0xc56d('0x31')](_0x59e944['query']);_0x596cee['filters']=_[_0xc56d('0x32')](_0x596cee[_0xc56d('0x2f')],_0x596cee[_0xc56d('0x30')]);_0x32d10b['attributes']=_['intersection'](_0x596cee[_0xc56d('0x2f')],qs[_0xc56d('0x33')](_0x59e944[_0xc56d('0x30')]['fields']));_0x32d10b[_0xc56d('0x34')]=_0x32d10b[_0xc56d('0x34')]['length']?_0x32d10b['attributes']:_0x596cee[_0xc56d('0x2f')];if(!_0x59e944['query'][_0xc56d('0x35')](_0xc56d('0x36'))){_0x32d10b[_0xc56d('0x21')]=qs[_0xc56d('0x21')](_0x59e944[_0xc56d('0x30')][_0xc56d('0x21')]);_0x32d10b[_0xc56d('0x1e')]=qs['offset'](_0x59e944['query'][_0xc56d('0x1e')]);}_0x32d10b['order']=qs[_0xc56d('0x37')](_0x59e944[_0xc56d('0x30')][_0xc56d('0x37')]);_0x32d10b[_0xc56d('0x38')]=qs['filters'](_[_0xc56d('0x39')](_0x59e944[_0xc56d('0x30')],_0x596cee[_0xc56d('0x3a')]),_0x28bc60);if(_0x59e944[_0xc56d('0x30')][_0xc56d('0x3b')]){_0x32d10b['where']=_[_0xc56d('0x3c')](_0x32d10b[_0xc56d('0x38')],{'$or':_[_0xc56d('0x2a')](_0x28bc60,function(_0xeaebf8){if(_0xeaebf8[_0xc56d('0x2d')]!=='VIRTUAL'){var _0x168684={};_0x168684[_0xeaebf8[_0xc56d('0x28')]]={'$like':'%'+_0x59e944[_0xc56d('0x30')]['filter']+'%'};return _0x168684;}})});}_0x32d10b=_[_0xc56d('0x3c')]({},_0x32d10b,_0x59e944['options']);var _0x8ea636={'where':_0x32d10b[_0xc56d('0x38')]};return db[_0xc56d('0x3d')]['count'](_0x8ea636)[_0xc56d('0x25')](function(_0x23c9ee){_0x23ac01[_0xc56d('0x20')]=_0x23c9ee;if(_0x59e944[_0xc56d('0x30')][_0xc56d('0x3e')]){_0x32d10b[_0xc56d('0x3f')]=[{'all':!![]}];}return db[_0xc56d('0x3d')][_0xc56d('0x40')](_0x32d10b);})[_0xc56d('0x25')](function(_0x351518){_0x23ac01[_0xc56d('0x41')]=_0x351518;return _0x23ac01;})['then'](respondWithFilteredResult(_0x2240aa,_0x32d10b))[_0xc56d('0x42')](handleError(_0x2240aa,null));};exports[_0xc56d('0x43')]=function(_0x311c60,_0x1d44c6){var _0x552d9a={'raw':!![],'where':{'id':_0x311c60['params']['id']}},_0x22d87d={};_0x22d87d[_0xc56d('0x2f')]=_[_0xc56d('0x31')](db[_0xc56d('0x3d')]['rawAttributes']);_0x22d87d['query']=_[_0xc56d('0x31')](_0x311c60[_0xc56d('0x30')]);_0x22d87d[_0xc56d('0x3a')]=_[_0xc56d('0x32')](_0x22d87d[_0xc56d('0x2f')],_0x22d87d['query']);_0x552d9a[_0xc56d('0x34')]=_[_0xc56d('0x32')](_0x22d87d['model'],qs[_0xc56d('0x33')](_0x311c60[_0xc56d('0x30')][_0xc56d('0x33')]));_0x552d9a[_0xc56d('0x34')]=_0x552d9a[_0xc56d('0x34')][_0xc56d('0x44')]?_0x552d9a[_0xc56d('0x34')]:_0x22d87d['model'];if(_0x311c60[_0xc56d('0x30')][_0xc56d('0x3e')]){_0x552d9a[_0xc56d('0x3f')]=[{'all':!![]}];}_0x552d9a=_[_0xc56d('0x3c')]({},_0x552d9a,_0x311c60['options']);return db[_0xc56d('0x3d')][_0xc56d('0x45')](_0x552d9a)[_0xc56d('0x25')](handleEntityNotFound(_0x1d44c6,null))[_0xc56d('0x25')](respondWithResult(_0x1d44c6,null))[_0xc56d('0x42')](handleError(_0x1d44c6,null));};exports['create']=function(_0xb4e2ad,_0x569cd0){return db[_0xc56d('0x3d')][_0xc56d('0x46')](_0xb4e2ad[_0xc56d('0x47')],{})['then'](respondWithResult(_0x569cd0,0xc9))[_0xc56d('0x42')](handleError(_0x569cd0,null));};exports['update']=function(_0x47dd13,_0x16c1b4){if(_0x47dd13['body']['id']){delete _0x47dd13['body']['id'];}return db['Dynamics365Field'][_0xc56d('0x45')]({'where':{'id':_0x47dd13[_0xc56d('0x48')]['id']}})[_0xc56d('0x25')](handleEntityNotFound(_0x16c1b4,null))[_0xc56d('0x25')](saveUpdates(_0x47dd13[_0xc56d('0x47')],null))['then'](respondWithResult(_0x16c1b4,null))[_0xc56d('0x42')](handleError(_0x16c1b4,null));};exports[_0xc56d('0x26')]=function(_0x2fe190,_0x317732){return db[_0xc56d('0x3d')]['find']({'where':{'id':_0x2fe190[_0xc56d('0x48')]['id']}})['then'](handleEntityNotFound(_0x317732,null))[_0xc56d('0x25')](removeEntity(_0x317732,null))[_0xc56d('0x42')](handleError(_0x317732,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 2c50cee..6525a67 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 _0x756a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId'];(function(_0x74546b,_0x5b11cc){var _0x2d689b=function(_0x5ab840){while(--_0x5ab840){_0x74546b['push'](_0x74546b['shift']());}};_0x2d689b(++_0x5b11cc);}(_0x756a,0x150));var _0xa756=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x756a[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0xa756('0x0'));var util=require(_0xa756('0x1'));var logger=require(_0xa756('0x2'))(_0xa756('0x3'));var moment=require(_0xa756('0x4'));var BPromise=require(_0xa756('0x5'));var rp=require(_0xa756('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa756('0x7'));var config=require(_0xa756('0x8'));var attributes=require(_0xa756('0x9'));module[_0xa756('0xa')]=function(_0x1b6706,_0x582231){return _0x1b6706[_0xa756('0xb')](_0xa756('0xc'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xa756('0xd'),'fields':[_0xa756('0xe'),_0xa756('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9870=['request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','idField','util','moment','bluebird'];(function(_0x591cc3,_0x351865){var _0x58419c=function(_0x3fab30){while(--_0x3fab30){_0x591cc3['push'](_0x591cc3['shift']());}};_0x58419c(++_0x351865);}(_0x9870,0x1e1));var _0x0987=function(_0x1dad7a,_0x30ffd5){_0x1dad7a=_0x1dad7a-0x0;var _0x3f0088=_0x9870[_0x1dad7a];return _0x3f0088;};'use strict';var _=require('lodash');var util=require(_0x0987('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0987('0x1'));var BPromise=require(_0x0987('0x2'));var rp=require(_0x0987('0x3'));var fs=require('fs');var path=require(_0x0987('0x4'));var rimraf=require(_0x0987('0x5'));var config=require('../../config/environment');var attributes=require(_0x0987('0x6'));module[_0x0987('0x7')]=function(_0x26fd3a,_0x1d12df){return _0x26fd3a[_0x0987('0x8')](_0x0987('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x0987('0xa'),'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 6f7e34b..392cbac 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 _0x781b=['message','info','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','Dynamics365Field,\x20%s,\x20%s','stringify','error','code'];(function(_0x5de97c,_0xc02d9f){var _0x5e17dd=function(_0x4c423c){while(--_0x4c423c){_0x5de97c['push'](_0x5de97c['shift']());}};_0x5e17dd(++_0xc02d9f);}(_0x781b,0x1d1));var _0xb781=function(_0x149db1,_0x25f28b){_0x149db1=_0x149db1-0x0;var _0x2059a8=_0x781b[_0x149db1];return _0x2059a8;};'use strict';var _=require(_0xb781('0x0'));var util=require(_0xb781('0x1'));var moment=require('moment');var BPromise=require(_0xb781('0x2'));var rs=require(_0xb781('0x3'));var fs=require('fs');var Redis=require(_0xb781('0x4'));var db=require(_0xb781('0x5'))['db'];var utils=require(_0xb781('0x6'));var logger=require(_0xb781('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb781('0x8')][_0xb781('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18e6d3,_0x3c9afc,_0x1dd1e5){return new BPromise(function(_0x7da52c,_0x432639){return client['request'](_0x18e6d3,_0x1dd1e5)[_0xb781('0xa')](function(_0x2c6f3b){logger['info'](_0xb781('0xb'),_0x3c9afc,'request\x20sent');logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3c9afc,'request\x20sent',JSON[_0xb781('0xc')](_0x2c6f3b));if(_0x2c6f3b[_0xb781('0xd')]){if(_0x2c6f3b[_0xb781('0xd')][_0xb781('0xe')]===0x1f4){logger['error'](_0xb781('0xb'),_0x3c9afc,_0x2c6f3b['error'][_0xb781('0xf')]);return _0x432639(_0x2c6f3b[_0xb781('0xd')]['message']);}logger[_0xb781('0xd')](_0xb781('0xb'),_0x3c9afc,_0x2c6f3b[_0xb781('0xd')][_0xb781('0xf')]);return _0x7da52c(_0x2c6f3b[_0xb781('0xd')][_0xb781('0xf')]);}else{logger[_0xb781('0x10')](_0xb781('0xb'),_0x3c9afc,_0xb781('0x11'));_0x7da52c(_0x2c6f3b[_0xb781('0x12')][_0xb781('0xf')]);}})[_0xb781('0x13')](function(_0x170928){logger[_0xb781('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x3c9afc,_0x170928);_0x432639(_0x170928);});});} \ No newline at end of file +var _0x0b2c=['Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','request\x20sent','debug','stringify','error','code'];(function(_0xea53b5,_0x266bce){var _0x361f94=function(_0x18bd23){while(--_0x18bd23){_0xea53b5['push'](_0xea53b5['shift']());}};_0x361f94(++_0x266bce);}(_0x0b2c,0x88));var _0xc0b2=function(_0x292320,_0x23a37f){_0x292320=_0x292320-0x0;var _0x22ee81=_0x0b2c[_0x292320];return _0x22ee81;};'use strict';var _=require(_0xc0b2('0x0'));var util=require(_0xc0b2('0x1'));var moment=require(_0xc0b2('0x2'));var BPromise=require(_0xc0b2('0x3'));var rs=require(_0xc0b2('0x4'));var fs=require('fs');var Redis=require(_0xc0b2('0x5'));var db=require(_0xc0b2('0x6'))['db'];var utils=require(_0xc0b2('0x7'));var logger=require(_0xc0b2('0x8'))(_0xc0b2('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc0b2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd7f901,_0x1014a0,_0x33f897){return new BPromise(function(_0x5390c5,_0x3eba15){return client['request'](_0xd7f901,_0x33f897)[_0xc0b2('0xb')](function(_0x3e3c04){logger[_0xc0b2('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x1014a0,_0xc0b2('0xd'));logger[_0xc0b2('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x1014a0,_0xc0b2('0xd'),JSON[_0xc0b2('0xf')](_0x3e3c04));if(_0x3e3c04[_0xc0b2('0x10')]){if(_0x3e3c04[_0xc0b2('0x10')][_0xc0b2('0x11')]===0x1f4){logger['error'](_0xc0b2('0x12'),_0x1014a0,_0x3e3c04[_0xc0b2('0x10')]['message']);return _0x3eba15(_0x3e3c04[_0xc0b2('0x10')][_0xc0b2('0x13')]);}logger[_0xc0b2('0x10')](_0xc0b2('0x12'),_0x1014a0,_0x3e3c04[_0xc0b2('0x10')][_0xc0b2('0x13')]);return _0x5390c5(_0x3e3c04['error']['message']);}else{logger[_0xc0b2('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x1014a0,_0xc0b2('0xd'));_0x5390c5(_0x3e3c04[_0xc0b2('0x14')][_0xc0b2('0x13')]);}})[_0xc0b2('0x15')](function(_0xf4f35d){logger[_0xc0b2('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x1014a0,_0xf4f35d);_0x3eba15(_0xf4f35d);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 90fe5b6..ed4322d 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 _0x9c94=['update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c94,0xcb));var _0x49c9=function(_0x2e0443,_0x7e5974){_0x2e0443=_0x2e0443-0x0;var _0x52d450=_0x9c94[_0x2e0443];return _0x52d450;};'use strict';var multer=require(_0x49c9('0x0'));var util=require(_0x49c9('0x1'));var path=require(_0x49c9('0x2'));var timeout=require(_0x49c9('0x3'));var express=require(_0x49c9('0x4'));var router=express['Router']();var fs_extra=require(_0x49c9('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x49c9('0x6'));var controller=require('./intFreshdeskAccount.controller');router[_0x49c9('0x7')]('/',auth[_0x49c9('0x8')](),controller[_0x49c9('0x9')]);router[_0x49c9('0x7')](_0x49c9('0xa'),auth[_0x49c9('0x8')](),controller['show']);router[_0x49c9('0x7')](_0x49c9('0xb'),auth[_0x49c9('0x8')](),controller[_0x49c9('0xc')]);router[_0x49c9('0x7')]('/:id/fields',auth[_0x49c9('0x8')](),controller[_0x49c9('0xd')]);router[_0x49c9('0xe')]('/',auth[_0x49c9('0x8')](),controller[_0x49c9('0xf')]);router[_0x49c9('0xe')](_0x49c9('0xb'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x49c9('0x10')](_0x49c9('0xa'),auth[_0x49c9('0x8')](),controller[_0x49c9('0x11')]);router[_0x49c9('0x12')](_0x49c9('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x49c9('0x13')]=router; \ No newline at end of file +var _0x1865=['/:id/configurations','addConfiguration','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x416cdc,_0x213b87){var _0x1931ce=function(_0x1dc762){while(--_0x1dc762){_0x416cdc['push'](_0x416cdc['shift']());}};_0x1931ce(++_0x213b87);}(_0x1865,0x101));var _0x5186=function(_0x36c0df,_0x401fe4){_0x36c0df=_0x36c0df-0x0;var _0x13bf6c=_0x1865[_0x36c0df];return _0x13bf6c;};'use strict';var multer=require(_0x5186('0x0'));var util=require(_0x5186('0x1'));var path=require(_0x5186('0x2'));var timeout=require(_0x5186('0x3'));var express=require(_0x5186('0x4'));var router=express['Router']();var fs_extra=require(_0x5186('0x5'));var auth=require(_0x5186('0x6'));var interaction=require(_0x5186('0x7'));var config=require(_0x5186('0x8'));var controller=require(_0x5186('0x9'));router['get']('/',auth[_0x5186('0xa')](),controller[_0x5186('0xb')]);router[_0x5186('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth[_0x5186('0xa')](),controller[_0x5186('0xd')]);router[_0x5186('0xc')](_0x5186('0xe'),auth['isAuthenticated'](),controller[_0x5186('0xf')]);router[_0x5186('0x10')]('/',auth['isAuthenticated'](),controller[_0x5186('0x11')]);router[_0x5186('0x10')](_0x5186('0x12'),auth[_0x5186('0xa')](),controller[_0x5186('0x13')]);router['put']('/:id',auth[_0x5186('0xa')](),controller[_0x5186('0x14')]);router[_0x5186('0x15')](_0x5186('0x16'),auth['isAuthenticated'](),controller[_0x5186('0x17')]);module[_0x5186('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 2529dee..21f1600 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 _0xef0f=['sequelize','STRING','remoteUri'];(function(_0x53949f,_0x3b0d57){var _0x110b6e=function(_0x5834b2){while(--_0x5834b2){_0x53949f['push'](_0x53949f['shift']());}};_0x110b6e(++_0x3b0d57);}(_0xef0f,0x168));var _0xfef0=function(_0x39ddfb,_0x156bac){_0x39ddfb=_0x39ddfb-0x0;var _0x1b0653=_0xef0f[_0x39ddfb];return _0x1b0653;};'use strict';var Sequelize=require(_0xfef0('0x0'));module['exports']={'name':{'type':Sequelize[_0xfef0('0x1')]},'description':{'type':Sequelize[_0xfef0('0x1')]},'username':{'type':Sequelize[_0xfef0('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xfef0('0x1')]},'remoteUri':{'type':Sequelize[_0xfef0('0x1')],'unique':_0xfef0('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['remoteUri','sequelize','STRING'];(function(_0xc587ed,_0x11cbc2){var _0x41d137=function(_0x2d288f){while(--_0x2d288f){_0xc587ed['push'](_0xc587ed['shift']());}};_0x41d137(++_0x11cbc2);}(_0xb10b,0x12a));var _0xbb10=function(_0x339702,_0x465d98){_0x339702=_0x339702-0x0;var _0x55cc03=_0xb10b[_0x339702];return _0x55cc03;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')]},'description':{'type':Sequelize[_0xbb10('0x1')]},'username':{'type':Sequelize[_0xbb10('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xbb10('0x1')]},'remoteUri':{'type':Sequelize[_0xbb10('0x1')],'unique':_0xbb10('0x2')},'serverUrl':{'type':Sequelize[_0xbb10('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 f860bf7..6ccb660 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 _0x0f88=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','end','stack','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','then','findAll','rows','params','keys','rawAttributes','includeAll','include','find','catch','create','body','getConfigurations','order','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','GET','format','%s/%s','Basic\x20%s','toString','base64','requester','subject','agent','description','source','group','company','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x10eae1,_0x2af2f1){var _0x6beba5=function(_0x29dcf3){while(--_0x29dcf3){_0x10eae1['push'](_0x10eae1['shift']());}};_0x6beba5(++_0x2af2f1);}(_0x0f88,0x1d9));var _0x80f8=function(_0x31080a,_0x55b5cd){_0x31080a=_0x31080a-0x0;var _0x58d2fc=_0x0f88[_0x31080a];return _0x58d2fc;};'use strict';var emlformat=require(_0x80f8('0x0'));var rimraf=require(_0x80f8('0x1'));var zipdir=require(_0x80f8('0x2'));var jsonpatch=require(_0x80f8('0x3'));var rp=require(_0x80f8('0x4'));var moment=require(_0x80f8('0x5'));var BPromise=require(_0x80f8('0x6'));var Mustache=require(_0x80f8('0x7'));var util=require('util');var path=require(_0x80f8('0x8'));var sox=require('sox');var csv=require(_0x80f8('0x9'));var ejs=require(_0x80f8('0xa'));var fs=require('fs');var fs_extra=require(_0x80f8('0xb'));var _=require(_0x80f8('0xc'));var squel=require(_0x80f8('0xd'));var crypto=require(_0x80f8('0xe'));var jsforce=require(_0x80f8('0xf'));var deskjs=require(_0x80f8('0x10'));var toCsv=require(_0x80f8('0x9'));var querystring=require(_0x80f8('0x11'));var Papa=require(_0x80f8('0x12'));var Redis=require(_0x80f8('0x13'));var authService=require(_0x80f8('0x14'));var qs=require(_0x80f8('0x15'));var as=require(_0x80f8('0x16'));var hardwareService=require(_0x80f8('0x17'));var logger=require(_0x80f8('0x18'))(_0x80f8('0x19'));var utils=require(_0x80f8('0x1a'));var config=require(_0x80f8('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x80f8('0x1c'))['db'];var integrations=require(_0x80f8('0x1d'));function respondWithStatusCode(_0x35538b,_0x5e6020){_0x5e6020=_0x5e6020||0xcc;return function(_0x280db2){if(_0x280db2){return _0x35538b[_0x80f8('0x1e')](_0x5e6020);}return _0x35538b[_0x80f8('0x1f')](_0x5e6020)['end']();};}function respondWithResult(_0x4887d3,_0x4f8755){_0x4f8755=_0x4f8755||0xc8;return function(_0x5e29bf){if(_0x5e29bf){return _0x4887d3[_0x80f8('0x1f')](_0x4f8755)['json'](_0x5e29bf);}};}function respondWithFilteredResult(_0x2c9b94,_0x25c36b){return function(_0x381355){if(_0x381355){var _0x3817be=typeof _0x25c36b[_0x80f8('0x20')]===_0x80f8('0x21')&&typeof _0x25c36b[_0x80f8('0x22')]===_0x80f8('0x21');var _0x375f42=_0x381355[_0x80f8('0x23')];var _0x581196=_0x3817be?0x0:_0x25c36b[_0x80f8('0x20')];var _0x981e13=_0x3817be?_0x381355[_0x80f8('0x23')]:_0x25c36b[_0x80f8('0x20')]+_0x25c36b[_0x80f8('0x22')];var _0x538e77;if(_0x981e13>=_0x375f42){_0x981e13=_0x375f42;_0x538e77=0xc8;}else{_0x538e77=0xce;}_0x2c9b94[_0x80f8('0x1f')](_0x538e77);return _0x2c9b94[_0x80f8('0x24')]('Content-Range',_0x581196+'-'+_0x981e13+'/'+_0x375f42)[_0x80f8('0x25')](_0x381355);}return null;};}function patchUpdates(_0x3d23b5){return function(_0x50d3b9){try{jsonpatch[_0x80f8('0x26')](_0x50d3b9,_0x3d23b5,!![]);}catch(_0x29c71c){return BPromise[_0x80f8('0x27')](_0x29c71c);}return _0x50d3b9[_0x80f8('0x28')]();};}function saveUpdates(_0x214dc7,_0x1a4988){return function(_0x168009){if(_0x168009){return _0x168009[_0x80f8('0x29')](_0x214dc7)['then'](function(_0x26c62a){return _0x26c62a;});}return null;};}function removeEntity(_0x530350,_0x192ae5){return function(_0x5336ad){if(_0x5336ad){return _0x5336ad[_0x80f8('0x2a')]()['then'](function(){_0x530350[_0x80f8('0x1f')](0xcc)[_0x80f8('0x2b')]();});}};}function handleEntityNotFound(_0x5e3f76,_0x57fad1){return function(_0x53be8e){if(!_0x53be8e){_0x5e3f76[_0x80f8('0x1e')](0x194);}return _0x53be8e;};}function handleError(_0x3032bb,_0x4ae1a6){_0x4ae1a6=_0x4ae1a6||0x1f4;return function(_0x40ed3e){logger['error'](_0x40ed3e[_0x80f8('0x2c')]);if(_0x40ed3e['name']){delete _0x40ed3e[_0x80f8('0x2d')];}_0x3032bb['status'](_0x4ae1a6)[_0x80f8('0x2e')](_0x40ed3e);};}exports[_0x80f8('0x2f')]=function(_0x109ea3,_0x46d379){var _0x42e871={},_0x14fcce={},_0x436d24={'count':0x0,'rows':[]};var _0x1bd039=_[_0x80f8('0x30')](db[_0x80f8('0x31')]['rawAttributes'],function(_0x545f3c){return{'name':_0x545f3c[_0x80f8('0x32')],'type':_0x545f3c[_0x80f8('0x33')][_0x80f8('0x34')]};});_0x14fcce[_0x80f8('0x35')]=_['map'](_0x1bd039,_0x80f8('0x2d'));_0x14fcce[_0x80f8('0x36')]=_['keys'](_0x109ea3[_0x80f8('0x36')]);_0x14fcce['filters']=_[_0x80f8('0x37')](_0x14fcce['model'],_0x14fcce[_0x80f8('0x36')]);_0x42e871[_0x80f8('0x38')]=_['intersection'](_0x14fcce['model'],qs[_0x80f8('0x39')](_0x109ea3[_0x80f8('0x36')][_0x80f8('0x39')]));_0x42e871[_0x80f8('0x38')]=_0x42e871[_0x80f8('0x38')][_0x80f8('0x3a')]?_0x42e871[_0x80f8('0x38')]:_0x14fcce['model'];if(!_0x109ea3[_0x80f8('0x36')][_0x80f8('0x3b')](_0x80f8('0x3c'))){_0x42e871[_0x80f8('0x22')]=qs['limit'](_0x109ea3[_0x80f8('0x36')][_0x80f8('0x22')]);_0x42e871[_0x80f8('0x20')]=qs[_0x80f8('0x20')](_0x109ea3['query'][_0x80f8('0x20')]);}_0x42e871['order']=qs['sort'](_0x109ea3[_0x80f8('0x36')][_0x80f8('0x3d')]);_0x42e871[_0x80f8('0x3e')]=qs[_0x80f8('0x3f')](_['pick'](_0x109ea3[_0x80f8('0x36')],_0x14fcce[_0x80f8('0x3f')]),_0x1bd039);if(_0x109ea3[_0x80f8('0x36')][_0x80f8('0x40')]){_0x42e871[_0x80f8('0x3e')]=_[_0x80f8('0x41')](_0x42e871[_0x80f8('0x3e')],{'$or':_[_0x80f8('0x30')](_0x1bd039,function(_0x173c61){if(_0x173c61[_0x80f8('0x33')]!==_0x80f8('0x42')){var _0x592de={};_0x592de[_0x173c61[_0x80f8('0x2d')]]={'$like':'%'+_0x109ea3[_0x80f8('0x36')][_0x80f8('0x40')]+'%'};return _0x592de;}})});}_0x42e871=_[_0x80f8('0x41')]({},_0x42e871,_0x109ea3[_0x80f8('0x43')]);var _0x3940f1={'where':_0x42e871[_0x80f8('0x3e')]};return db['FreshdeskAccount'][_0x80f8('0x23')](_0x3940f1)[_0x80f8('0x44')](function(_0x4365a4){_0x436d24['count']=_0x4365a4;if(_0x109ea3['query']['includeAll']){_0x42e871['include']=[{'all':!![]}];}return db[_0x80f8('0x31')][_0x80f8('0x45')](_0x42e871);})[_0x80f8('0x44')](function(_0x1a9eb9){_0x436d24[_0x80f8('0x46')]=_0x1a9eb9;return _0x436d24;})[_0x80f8('0x44')](respondWithFilteredResult(_0x46d379,_0x42e871))['catch'](handleError(_0x46d379,null));};exports['show']=function(_0x3c6b03,_0x38a9c2){var _0x75feef={'raw':![],'where':{'id':_0x3c6b03[_0x80f8('0x47')]['id']}},_0x5ae1d={};_0x5ae1d['model']=_[_0x80f8('0x48')](db[_0x80f8('0x31')][_0x80f8('0x49')]);_0x5ae1d[_0x80f8('0x36')]=_[_0x80f8('0x48')](_0x3c6b03[_0x80f8('0x36')]);_0x5ae1d[_0x80f8('0x3f')]=_[_0x80f8('0x37')](_0x5ae1d[_0x80f8('0x35')],_0x5ae1d[_0x80f8('0x36')]);_0x75feef[_0x80f8('0x38')]=_[_0x80f8('0x37')](_0x5ae1d[_0x80f8('0x35')],qs[_0x80f8('0x39')](_0x3c6b03[_0x80f8('0x36')][_0x80f8('0x39')]));_0x75feef[_0x80f8('0x38')]=_0x75feef['attributes'][_0x80f8('0x3a')]?_0x75feef[_0x80f8('0x38')]:_0x5ae1d['model'];if(_0x3c6b03['query'][_0x80f8('0x4a')]){_0x75feef[_0x80f8('0x4b')]=[{'all':!![]}];}_0x75feef=_[_0x80f8('0x41')]({},_0x75feef,_0x3c6b03[_0x80f8('0x43')]);return db['FreshdeskAccount'][_0x80f8('0x4c')](_0x75feef)[_0x80f8('0x44')](handleEntityNotFound(_0x38a9c2,null))['then'](respondWithResult(_0x38a9c2,null))[_0x80f8('0x4d')](handleError(_0x38a9c2,null));};exports[_0x80f8('0x4e')]=function(_0x5be18f,_0x181487){return db[_0x80f8('0x31')]['create'](_0x5be18f[_0x80f8('0x4f')],{})['then'](respondWithResult(_0x181487,0xc9))[_0x80f8('0x4d')](handleError(_0x181487,null));};exports['update']=function(_0x3d73ac,_0xf2eb0){if(_0x3d73ac[_0x80f8('0x4f')]['id']){delete _0x3d73ac[_0x80f8('0x4f')]['id'];}return db[_0x80f8('0x31')][_0x80f8('0x4c')]({'where':{'id':_0x3d73ac[_0x80f8('0x47')]['id']}})[_0x80f8('0x44')](handleEntityNotFound(_0xf2eb0,null))['then'](saveUpdates(_0x3d73ac[_0x80f8('0x4f')],null))['then'](respondWithResult(_0xf2eb0,null))[_0x80f8('0x4d')](handleError(_0xf2eb0,null));};exports[_0x80f8('0x2a')]=function(_0x46135b,_0x2ba4c2){return db[_0x80f8('0x31')][_0x80f8('0x4c')]({'where':{'id':_0x46135b[_0x80f8('0x47')]['id']}})[_0x80f8('0x44')](handleEntityNotFound(_0x2ba4c2,null))[_0x80f8('0x44')](removeEntity(_0x2ba4c2,null))[_0x80f8('0x4d')](handleError(_0x2ba4c2,null));};exports[_0x80f8('0x50')]=function(_0x3aa28f,_0xb1204c,_0x133229){var _0x5848ca={};var _0x177e8d={};var _0x8c589f;var _0x87bb6a;return db[_0x80f8('0x31')]['findOne']({'where':{'id':_0x3aa28f[_0x80f8('0x47')]['id']}})['then'](handleEntityNotFound(_0xb1204c,null))[_0x80f8('0x44')](function(_0x3b886b){if(_0x3b886b){_0x8c589f=_0x3b886b;_0x177e8d[_0x80f8('0x35')]=_['keys'](db['FreshdeskConfiguration']['rawAttributes']);_0x177e8d[_0x80f8('0x36')]=_[_0x80f8('0x48')](_0x3aa28f[_0x80f8('0x36')]);_0x177e8d[_0x80f8('0x3f')]=_[_0x80f8('0x37')](_0x177e8d[_0x80f8('0x35')],_0x177e8d[_0x80f8('0x36')]);_0x5848ca['attributes']=_[_0x80f8('0x37')](_0x177e8d[_0x80f8('0x35')],qs[_0x80f8('0x39')](_0x3aa28f[_0x80f8('0x36')]['fields']));_0x5848ca[_0x80f8('0x38')]=_0x5848ca['attributes'][_0x80f8('0x3a')]?_0x5848ca[_0x80f8('0x38')]:_0x177e8d['model'];_0x5848ca[_0x80f8('0x51')]=qs[_0x80f8('0x3d')](_0x3aa28f[_0x80f8('0x36')]['sort']);_0x5848ca[_0x80f8('0x3e')]=qs['filters'](_[_0x80f8('0x52')](_0x3aa28f[_0x80f8('0x36')],_0x177e8d['filters']));if(_0x3aa28f[_0x80f8('0x36')][_0x80f8('0x40')]){_0x5848ca[_0x80f8('0x3e')]=_[_0x80f8('0x41')](_0x5848ca['where'],{'$or':_[_0x80f8('0x30')](_0x5848ca[_0x80f8('0x38')],function(_0x1735ea){var _0x40e717={};_0x40e717[_0x1735ea]={'$like':'%'+_0x3aa28f[_0x80f8('0x36')][_0x80f8('0x40')]+'%'};return _0x40e717;})});}_0x5848ca=_[_0x80f8('0x41')]({},_0x5848ca,_0x3aa28f[_0x80f8('0x43')]);return _0x8c589f[_0x80f8('0x50')](_0x5848ca);}})[_0x80f8('0x44')](function(_0x2a580){if(_0x2a580){_0x87bb6a=_0x2a580[_0x80f8('0x3a')];if(!_0x3aa28f['query'][_0x80f8('0x3b')](_0x80f8('0x3c'))){_0x5848ca[_0x80f8('0x22')]=qs[_0x80f8('0x22')](_0x3aa28f[_0x80f8('0x36')][_0x80f8('0x22')]);_0x5848ca[_0x80f8('0x20')]=qs[_0x80f8('0x20')](_0x3aa28f[_0x80f8('0x36')][_0x80f8('0x20')]);}return _0x8c589f[_0x80f8('0x50')](_0x5848ca);}})['then'](function(_0x522587){if(_0x522587){return _0x522587?{'count':_0x87bb6a,'rows':_0x522587}:null;}})['then'](respondWithResult(_0xb1204c,null))[_0x80f8('0x4d')](handleError(_0xb1204c,null));};exports[_0x80f8('0x53')]=function(_0x52e5e6,_0xebf443,_0x49100e){if(_0x52e5e6[_0x80f8('0x4f')]['id']){delete _0x52e5e6[_0x80f8('0x4f')]['id'];}return db['FreshdeskAccount'][_0x80f8('0x54')]({'where':{'id':_0x52e5e6[_0x80f8('0x47')]['id']}})[_0x80f8('0x44')](handleEntityNotFound(_0xebf443,null))[_0x80f8('0x44')](function(_0x138e34){if(_0x138e34){_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x55')]=_0x138e34['id'];_0x52e5e6['body'][_0x80f8('0x56')]=integrations[_0x80f8('0x57')](_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x58')],_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x33')]);_0x52e5e6[_0x80f8('0x4f')]['Descriptions']=integrations[_0x80f8('0x59')](_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x58')],_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x33')]);return db['FreshdeskConfiguration'][_0x80f8('0x4e')](_0x52e5e6[_0x80f8('0x4f')],{'include':[{'model':db[_0x80f8('0x5a')],'as':_0x80f8('0x56')},{'model':db[_0x80f8('0x5a')],'as':_0x80f8('0x5b')}]});}return null;})[_0x80f8('0x44')](respondWithResult(_0xebf443,null))[_0x80f8('0x4d')](handleError(_0xebf443,null));};exports[_0x80f8('0x5c')]=function(_0x4e6839,_0x100470,_0x1bfa2b){var _0x186d8c='';return db[_0x80f8('0x31')][_0x80f8('0x54')]({'where':{'id':_0x4e6839[_0x80f8('0x47')]['id']},'attributes':['id',_0x80f8('0x5d'),_0x80f8('0x5e')]})['then'](handleEntityNotFound(_0x100470,null))['then'](function(_0x22b786){if(_0x22b786){_0x186d8c=_0x22b786['remoteUri'];var _0xd4ba91=_0x186d8c[_0x80f8('0x5f')](-0x1);if(_0xd4ba91==='/'){_0x186d8c=_0x186d8c[_0x80f8('0x60')](0x0,_0x186d8c['lastIndexOf'](_0xd4ba91));}return rp({'method':_0x80f8('0x61'),'uri':util[_0x80f8('0x62')](_0x80f8('0x63'),_0x186d8c,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x80f8('0x62')](_0x80f8('0x64'),new Buffer(util['format']('%s:X',_0x22b786[_0x80f8('0x5e')]))[_0x80f8('0x65')](_0x80f8('0x66')))},'json':!![]});}})['then'](function(_0x59edbd){if(_0x59edbd){var _0x307a57=[_0x80f8('0x67'),_0x80f8('0x68'),_0x80f8('0x69'),_0x80f8('0x6a'),'status','priority','group',_0x80f8('0x6b'),'ticket_type',_0x80f8('0x6c'),_0x80f8('0x6d')];_['remove'](_0x59edbd,function(_0x1621b5){return _0x307a57[_0x80f8('0x6e')](_0x1621b5[_0x80f8('0x2d')])||!_0x1621b5[_0x80f8('0x6f')]&&_0x1621b5[_0x80f8('0x33')]!==_0x80f8('0x70')&&_0x1621b5[_0x80f8('0x33')]!==_0x80f8('0x71');});return{'count':_0x59edbd[_0x80f8('0x3a')],'rows':_[_0x80f8('0x30')](_0x59edbd,function(_0x554b5c){return{'id':_0x554b5c[_0x80f8('0x2d')],'name':_0x554b5c[_0x80f8('0x72')],'custom':!_0x554b5c[_0x80f8('0x6f')],'options':_0x554b5c[_0x80f8('0x73')]?_[_0x80f8('0x30')](_0x554b5c[_0x80f8('0x73')],function(_0x28d1d0){return{'name':_[_0x80f8('0x74')](_0x28d1d0),'value':_0x28d1d0};}):[]};})};}})[_0x80f8('0x44')](respondWithResult(_0x100470,null))['catch'](function(_0x2fdfe0){var _0x25af09=_0x4e6839[_0x80f8('0x36')][_0x80f8('0x75')]?0x1f4:_0x2fdfe0[_0x80f8('0x76')]||0x1f4;logger[_0x80f8('0x77')](_0x80f8('0x78'),_0x80f8('0x5c'),_0x25af09,JSON[_0x80f8('0x79')](_0x2fdfe0));delete _0x2fdfe0[_0x80f8('0x2d')];if(_0x25af09===0x191){_0x25af09=0x190;}_0x100470[_0x80f8('0x1f')](_0x25af09)[_0x80f8('0x2e')](_0x4e6839['query'][_0x80f8('0x75')]?{'message':_0x80f8('0x7a'),'statusCode':_0x2fdfe0[_0x80f8('0x76')]}:_0x2fdfe0);});}; \ No newline at end of file +var _0xd23d=['rows','show','params','keys','include','create','catch','body','find','findOne','FreshdeskConfiguration','order','filter','getConfigurations','hasOwnProperty','nolimit','addConfiguration','AccountId','getSubjects','getDescriptions','FreshdeskField','Subjects','Descriptions','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','Basic\x20%s','toString','base64','requester','description','priority','group','ticket_type','remove','includes','default','custom_dropdown','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','name','index','map','FreshdeskAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','sort','where','pick','merge','type','VIRTUAL','options','includeAll'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd23d,0xa0));var _0xdd23=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0xd23d[_0x3e182f];return _0x23edc9;};'use strict';var emlformat=require(_0xdd23('0x0'));var rimraf=require(_0xdd23('0x1'));var zipdir=require(_0xdd23('0x2'));var jsonpatch=require(_0xdd23('0x3'));var rp=require(_0xdd23('0x4'));var moment=require(_0xdd23('0x5'));var BPromise=require(_0xdd23('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xdd23('0x7'));var csv=require(_0xdd23('0x8'));var ejs=require(_0xdd23('0x9'));var fs=require('fs');var fs_extra=require(_0xdd23('0xa'));var _=require(_0xdd23('0xb'));var squel=require(_0xdd23('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdd23('0xd'));var toCsv=require(_0xdd23('0x8'));var querystring=require(_0xdd23('0xe'));var Papa=require(_0xdd23('0xf'));var Redis=require(_0xdd23('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdd23('0x11'));var as=require(_0xdd23('0x12'));var hardwareService=require(_0xdd23('0x13'));var logger=require('../../config/logger')(_0xdd23('0x14'));var utils=require(_0xdd23('0x15'));var config=require(_0xdd23('0x16'));var licenseUtil=require(_0xdd23('0x17'));var db=require(_0xdd23('0x18'))['db'];var integrations=require(_0xdd23('0x19'));function respondWithStatusCode(_0x1484d7,_0x1e4739){_0x1e4739=_0x1e4739||0xcc;return function(_0x450d35){if(_0x450d35){return _0x1484d7['sendStatus'](_0x1e4739);}return _0x1484d7['status'](_0x1e4739)[_0xdd23('0x1a')]();};}function respondWithResult(_0x27a280,_0x2f2869){_0x2f2869=_0x2f2869||0xc8;return function(_0x5355ab){if(_0x5355ab){return _0x27a280[_0xdd23('0x1b')](_0x2f2869)[_0xdd23('0x1c')](_0x5355ab);}};}function respondWithFilteredResult(_0x2abcd7,_0x3743cf){return function(_0x5d0087){if(_0x5d0087){var _0x3e9c8b=typeof _0x3743cf[_0xdd23('0x1d')]===_0xdd23('0x1e')&&typeof _0x3743cf[_0xdd23('0x1f')]===_0xdd23('0x1e');var _0x394f63=_0x5d0087['count'];var _0x580db2=_0x3e9c8b?0x0:_0x3743cf[_0xdd23('0x1d')];var _0x30dc01=_0x3e9c8b?_0x5d0087[_0xdd23('0x20')]:_0x3743cf[_0xdd23('0x1d')]+_0x3743cf[_0xdd23('0x1f')];var _0x3f9a47;if(_0x30dc01>=_0x394f63){_0x30dc01=_0x394f63;_0x3f9a47=0xc8;}else{_0x3f9a47=0xce;}_0x2abcd7[_0xdd23('0x1b')](_0x3f9a47);return _0x2abcd7[_0xdd23('0x21')](_0xdd23('0x22'),_0x580db2+'-'+_0x30dc01+'/'+_0x394f63)[_0xdd23('0x1c')](_0x5d0087);}return null;};}function patchUpdates(_0x7d557d){return function(_0x412090){try{jsonpatch[_0xdd23('0x23')](_0x412090,_0x7d557d,!![]);}catch(_0x4906fe){return BPromise['reject'](_0x4906fe);}return _0x412090['save']();};}function saveUpdates(_0x5b874b,_0x4ee5e3){return function(_0xce27fb){if(_0xce27fb){return _0xce27fb[_0xdd23('0x24')](_0x5b874b)[_0xdd23('0x25')](function(_0x151dd5){return _0x151dd5;});}return null;};}function removeEntity(_0x65feab,_0x15d80c){return function(_0x42268c){if(_0x42268c){return _0x42268c[_0xdd23('0x26')]()[_0xdd23('0x25')](function(){_0x65feab[_0xdd23('0x1b')](0xcc)[_0xdd23('0x1a')]();});}};}function handleEntityNotFound(_0x21e672,_0x151e5f){return function(_0x1e143f){if(!_0x1e143f){_0x21e672['sendStatus'](0x194);}return _0x1e143f;};}function handleError(_0x4bfa4d,_0xa02e2b){_0xa02e2b=_0xa02e2b||0x1f4;return function(_0x553321){logger[_0xdd23('0x27')](_0x553321['stack']);if(_0x553321['name']){delete _0x553321[_0xdd23('0x28')];}_0x4bfa4d[_0xdd23('0x1b')](_0xa02e2b)['send'](_0x553321);};}exports[_0xdd23('0x29')]=function(_0x205d4f,_0x2fa220){var _0x57b8b9={},_0x36d274={},_0x8ee9b2={'count':0x0,'rows':[]};var _0xc3e4ff=_[_0xdd23('0x2a')](db[_0xdd23('0x2b')][_0xdd23('0x2c')],function(_0x1bca59){return{'name':_0x1bca59[_0xdd23('0x2d')],'type':_0x1bca59['type'][_0xdd23('0x2e')]};});_0x36d274[_0xdd23('0x2f')]=_['map'](_0xc3e4ff,'name');_0x36d274[_0xdd23('0x30')]=_['keys'](_0x205d4f[_0xdd23('0x30')]);_0x36d274[_0xdd23('0x31')]=_[_0xdd23('0x32')](_0x36d274[_0xdd23('0x2f')],_0x36d274[_0xdd23('0x30')]);_0x57b8b9[_0xdd23('0x33')]=_[_0xdd23('0x32')](_0x36d274['model'],qs[_0xdd23('0x34')](_0x205d4f[_0xdd23('0x30')][_0xdd23('0x34')]));_0x57b8b9[_0xdd23('0x33')]=_0x57b8b9['attributes'][_0xdd23('0x35')]?_0x57b8b9[_0xdd23('0x33')]:_0x36d274['model'];if(!_0x205d4f[_0xdd23('0x30')]['hasOwnProperty']('nolimit')){_0x57b8b9[_0xdd23('0x1f')]=qs['limit'](_0x205d4f[_0xdd23('0x30')][_0xdd23('0x1f')]);_0x57b8b9[_0xdd23('0x1d')]=qs[_0xdd23('0x1d')](_0x205d4f[_0xdd23('0x30')]['offset']);}_0x57b8b9['order']=qs[_0xdd23('0x36')](_0x205d4f[_0xdd23('0x30')][_0xdd23('0x36')]);_0x57b8b9[_0xdd23('0x37')]=qs['filters'](_[_0xdd23('0x38')](_0x205d4f[_0xdd23('0x30')],_0x36d274[_0xdd23('0x31')]),_0xc3e4ff);if(_0x205d4f[_0xdd23('0x30')]['filter']){_0x57b8b9[_0xdd23('0x37')]=_[_0xdd23('0x39')](_0x57b8b9[_0xdd23('0x37')],{'$or':_[_0xdd23('0x2a')](_0xc3e4ff,function(_0x7e59bf){if(_0x7e59bf[_0xdd23('0x3a')]!==_0xdd23('0x3b')){var _0x177ff8={};_0x177ff8[_0x7e59bf[_0xdd23('0x28')]]={'$like':'%'+_0x205d4f[_0xdd23('0x30')]['filter']+'%'};return _0x177ff8;}})});}_0x57b8b9=_[_0xdd23('0x39')]({},_0x57b8b9,_0x205d4f[_0xdd23('0x3c')]);var _0x49f185={'where':_0x57b8b9[_0xdd23('0x37')]};return db[_0xdd23('0x2b')][_0xdd23('0x20')](_0x49f185)[_0xdd23('0x25')](function(_0x504836){_0x8ee9b2[_0xdd23('0x20')]=_0x504836;if(_0x205d4f['query'][_0xdd23('0x3d')]){_0x57b8b9['include']=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x57b8b9);})['then'](function(_0x34f9c4){_0x8ee9b2[_0xdd23('0x3e')]=_0x34f9c4;return _0x8ee9b2;})[_0xdd23('0x25')](respondWithFilteredResult(_0x2fa220,_0x57b8b9))['catch'](handleError(_0x2fa220,null));};exports[_0xdd23('0x3f')]=function(_0x2e3484,_0x445e47){var _0x32cb33={'raw':![],'where':{'id':_0x2e3484[_0xdd23('0x40')]['id']}},_0x44e132={};_0x44e132[_0xdd23('0x2f')]=_[_0xdd23('0x41')](db[_0xdd23('0x2b')][_0xdd23('0x2c')]);_0x44e132[_0xdd23('0x30')]=_['keys'](_0x2e3484[_0xdd23('0x30')]);_0x44e132[_0xdd23('0x31')]=_[_0xdd23('0x32')](_0x44e132[_0xdd23('0x2f')],_0x44e132[_0xdd23('0x30')]);_0x32cb33[_0xdd23('0x33')]=_[_0xdd23('0x32')](_0x44e132[_0xdd23('0x2f')],qs[_0xdd23('0x34')](_0x2e3484['query']['fields']));_0x32cb33['attributes']=_0x32cb33[_0xdd23('0x33')][_0xdd23('0x35')]?_0x32cb33[_0xdd23('0x33')]:_0x44e132[_0xdd23('0x2f')];if(_0x2e3484['query'][_0xdd23('0x3d')]){_0x32cb33[_0xdd23('0x42')]=[{'all':!![]}];}_0x32cb33=_[_0xdd23('0x39')]({},_0x32cb33,_0x2e3484[_0xdd23('0x3c')]);return db[_0xdd23('0x2b')]['find'](_0x32cb33)[_0xdd23('0x25')](handleEntityNotFound(_0x445e47,null))[_0xdd23('0x25')](respondWithResult(_0x445e47,null))['catch'](handleError(_0x445e47,null));};exports[_0xdd23('0x43')]=function(_0x4c4f01,_0x1d688f){return db[_0xdd23('0x2b')][_0xdd23('0x43')](_0x4c4f01['body'],{})['then'](respondWithResult(_0x1d688f,0xc9))[_0xdd23('0x44')](handleError(_0x1d688f,null));};exports[_0xdd23('0x24')]=function(_0x298a17,_0x305b73){if(_0x298a17[_0xdd23('0x45')]['id']){delete _0x298a17[_0xdd23('0x45')]['id'];}return db[_0xdd23('0x2b')][_0xdd23('0x46')]({'where':{'id':_0x298a17[_0xdd23('0x40')]['id']}})['then'](handleEntityNotFound(_0x305b73,null))[_0xdd23('0x25')](saveUpdates(_0x298a17[_0xdd23('0x45')],null))[_0xdd23('0x25')](respondWithResult(_0x305b73,null))[_0xdd23('0x44')](handleError(_0x305b73,null));};exports['destroy']=function(_0x180781,_0x3a9039){return db[_0xdd23('0x2b')][_0xdd23('0x46')]({'where':{'id':_0x180781[_0xdd23('0x40')]['id']}})[_0xdd23('0x25')](handleEntityNotFound(_0x3a9039,null))['then'](removeEntity(_0x3a9039,null))['catch'](handleError(_0x3a9039,null));};exports['getConfigurations']=function(_0x5de536,_0x4d8f5e,_0x57b3b7){var _0x3c56b7={};var _0x34cfdb={};var _0x5494e6;var _0x4b3020;return db[_0xdd23('0x2b')][_0xdd23('0x47')]({'where':{'id':_0x5de536[_0xdd23('0x40')]['id']}})[_0xdd23('0x25')](handleEntityNotFound(_0x4d8f5e,null))[_0xdd23('0x25')](function(_0x1eb8a8){if(_0x1eb8a8){_0x5494e6=_0x1eb8a8;_0x34cfdb[_0xdd23('0x2f')]=_[_0xdd23('0x41')](db[_0xdd23('0x48')][_0xdd23('0x2c')]);_0x34cfdb[_0xdd23('0x30')]=_[_0xdd23('0x41')](_0x5de536[_0xdd23('0x30')]);_0x34cfdb['filters']=_[_0xdd23('0x32')](_0x34cfdb['model'],_0x34cfdb[_0xdd23('0x30')]);_0x3c56b7['attributes']=_[_0xdd23('0x32')](_0x34cfdb[_0xdd23('0x2f')],qs[_0xdd23('0x34')](_0x5de536[_0xdd23('0x30')][_0xdd23('0x34')]));_0x3c56b7[_0xdd23('0x33')]=_0x3c56b7[_0xdd23('0x33')][_0xdd23('0x35')]?_0x3c56b7[_0xdd23('0x33')]:_0x34cfdb[_0xdd23('0x2f')];_0x3c56b7[_0xdd23('0x49')]=qs[_0xdd23('0x36')](_0x5de536[_0xdd23('0x30')][_0xdd23('0x36')]);_0x3c56b7[_0xdd23('0x37')]=qs[_0xdd23('0x31')](_[_0xdd23('0x38')](_0x5de536[_0xdd23('0x30')],_0x34cfdb[_0xdd23('0x31')]));if(_0x5de536['query'][_0xdd23('0x4a')]){_0x3c56b7['where']=_[_0xdd23('0x39')](_0x3c56b7['where'],{'$or':_[_0xdd23('0x2a')](_0x3c56b7[_0xdd23('0x33')],function(_0x2f528e){var _0x3de045={};_0x3de045[_0x2f528e]={'$like':'%'+_0x5de536[_0xdd23('0x30')][_0xdd23('0x4a')]+'%'};return _0x3de045;})});}_0x3c56b7=_[_0xdd23('0x39')]({},_0x3c56b7,_0x5de536[_0xdd23('0x3c')]);return _0x5494e6[_0xdd23('0x4b')](_0x3c56b7);}})[_0xdd23('0x25')](function(_0x37ed33){if(_0x37ed33){_0x4b3020=_0x37ed33['length'];if(!_0x5de536[_0xdd23('0x30')][_0xdd23('0x4c')](_0xdd23('0x4d'))){_0x3c56b7[_0xdd23('0x1f')]=qs[_0xdd23('0x1f')](_0x5de536[_0xdd23('0x30')]['limit']);_0x3c56b7[_0xdd23('0x1d')]=qs['offset'](_0x5de536[_0xdd23('0x30')][_0xdd23('0x1d')]);}return _0x5494e6[_0xdd23('0x4b')](_0x3c56b7);}})[_0xdd23('0x25')](function(_0x34ab17){if(_0x34ab17){return _0x34ab17?{'count':_0x4b3020,'rows':_0x34ab17}:null;}})[_0xdd23('0x25')](respondWithResult(_0x4d8f5e,null))['catch'](handleError(_0x4d8f5e,null));};exports[_0xdd23('0x4e')]=function(_0x2213ec,_0x5660d8,_0x1418e0){if(_0x2213ec['body']['id']){delete _0x2213ec[_0xdd23('0x45')]['id'];}return db[_0xdd23('0x2b')][_0xdd23('0x47')]({'where':{'id':_0x2213ec[_0xdd23('0x40')]['id']}})[_0xdd23('0x25')](handleEntityNotFound(_0x5660d8,null))[_0xdd23('0x25')](function(_0x1aebe8){if(_0x1aebe8){_0x2213ec['body'][_0xdd23('0x4f')]=_0x1aebe8['id'];_0x2213ec['body']['Subjects']=integrations[_0xdd23('0x50')](_0x2213ec[_0xdd23('0x45')]['channel'],_0x2213ec[_0xdd23('0x45')][_0xdd23('0x3a')]);_0x2213ec['body']['Descriptions']=integrations[_0xdd23('0x51')](_0x2213ec[_0xdd23('0x45')]['channel'],_0x2213ec[_0xdd23('0x45')]['type']);return db[_0xdd23('0x48')][_0xdd23('0x43')](_0x2213ec[_0xdd23('0x45')],{'include':[{'model':db[_0xdd23('0x52')],'as':_0xdd23('0x53')},{'model':db[_0xdd23('0x52')],'as':_0xdd23('0x54')}]});}return null;})[_0xdd23('0x25')](respondWithResult(_0x5660d8,null))[_0xdd23('0x44')](handleError(_0x5660d8,null));};exports['getFields']=function(_0x4fc65c,_0x453b28,_0x188f99){var _0x221540='';return db['FreshdeskAccount'][_0xdd23('0x47')]({'where':{'id':_0x4fc65c[_0xdd23('0x40')]['id']},'attributes':['id',_0xdd23('0x55'),_0xdd23('0x56')]})['then'](handleEntityNotFound(_0x453b28,null))[_0xdd23('0x25')](function(_0x1fee6f){if(_0x1fee6f){_0x221540=_0x1fee6f[_0xdd23('0x55')];var _0x1de2dd=_0x221540[_0xdd23('0x57')](-0x1);if(_0x1de2dd==='/'){_0x221540=_0x221540[_0xdd23('0x58')](0x0,_0x221540[_0xdd23('0x59')](_0x1de2dd));}return rp({'method':'GET','uri':util[_0xdd23('0x5a')](_0xdd23('0x5b'),_0x221540,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xdd23('0x5a')](_0xdd23('0x5c'),new Buffer(util[_0xdd23('0x5a')]('%s:X',_0x1fee6f[_0xdd23('0x56')]))[_0xdd23('0x5d')](_0xdd23('0x5e')))},'json':!![]});}})[_0xdd23('0x25')](function(_0x214845){if(_0x214845){var _0x18ed4d=[_0xdd23('0x5f'),'subject','agent',_0xdd23('0x60'),_0xdd23('0x1b'),_0xdd23('0x61'),_0xdd23('0x62'),'source',_0xdd23('0x63'),_0xdd23('0x62'),'company'];_[_0xdd23('0x64')](_0x214845,function(_0x41b0c9){return _0x18ed4d[_0xdd23('0x65')](_0x41b0c9['name'])||!_0x41b0c9[_0xdd23('0x66')]&&_0x41b0c9[_0xdd23('0x3a')]!=='custom_text'&&_0x41b0c9['type']!==_0xdd23('0x67');});return{'count':_0x214845[_0xdd23('0x35')],'rows':_[_0xdd23('0x2a')](_0x214845,function(_0x8e0ea2){return{'id':_0x8e0ea2[_0xdd23('0x28')],'name':_0x8e0ea2[_0xdd23('0x68')],'custom':!_0x8e0ea2[_0xdd23('0x66')],'options':_0x8e0ea2['choices']?_[_0xdd23('0x2a')](_0x8e0ea2['choices'],function(_0x2166f4){return{'name':_['capitalize'](_0x2166f4),'value':_0x2166f4};}):[]};})};}})[_0xdd23('0x25')](respondWithResult(_0x453b28,null))[_0xdd23('0x44')](function(_0x480a7d){var _0x4c0e0e=_0x4fc65c[_0xdd23('0x30')][_0xdd23('0x69')]?0x1f4:_0x480a7d[_0xdd23('0x6a')]||0x1f4;logger[_0xdd23('0x27')](_0xdd23('0x6b'),'getFields',_0x4c0e0e,JSON[_0xdd23('0x6c')](_0x480a7d));delete _0x480a7d[_0xdd23('0x28')];if(_0x4c0e0e===0x191){_0x4c0e0e=0x190;}_0x453b28[_0xdd23('0x1b')](_0x4c0e0e)[_0xdd23('0x6d')](_0x4fc65c[_0xdd23('0x30')]['test']?{'message':_0xdd23('0x6e'),'statusCode':_0x480a7d[_0xdd23('0x6a')]}:_0x480a7d);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 6958a57..7886dfe 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 _0x648c=['../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x532d78,_0x25b6a8){var _0x5990c4=function(_0x3f23fe){while(--_0x3f23fe){_0x532d78['push'](_0x532d78['shift']());}};_0x5990c4(++_0x25b6a8);}(_0x648c,0x1c5));var _0xc648=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x648c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc648('0x0'));var util=require(_0xc648('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc648('0x2'));var BPromise=require(_0xc648('0x3'));var rp=require(_0xc648('0x4'));var fs=require('fs');var path=require(_0xc648('0x5'));var rimraf=require(_0xc648('0x6'));var config=require(_0xc648('0x7'));var attributes=require(_0xc648('0x8'));var integrations=require(_0xc648('0x9'));module[_0xc648('0xa')]=function(_0xa38a5c,_0x462745){return _0xa38a5c[_0xc648('0xb')](_0xc648('0xc'),attributes,{'tableName':_0xc648('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8df8=['moment','bluebird','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','int_freshdesk_accounts','lodash','util','api'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8df8,0x6b));var _0x88df=function(_0x5b012e,_0x5cb94c){_0x5b012e=_0x5b012e-0x0;var _0xd6daf0=_0x8df8[_0x5b012e];return _0xd6daf0;};'use strict';var _=require(_0x88df('0x0'));var util=require(_0x88df('0x1'));var logger=require('../../config/logger')(_0x88df('0x2'));var moment=require(_0x88df('0x3'));var BPromise=require(_0x88df('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x88df('0x5'));var attributes=require(_0x88df('0x6'));var integrations=require(_0x88df('0x7'));module[_0x88df('0x8')]=function(_0xeb6ebc,_0x554041){return _0xeb6ebc[_0x88df('0x9')]('FreshdeskAccount',attributes,{'tableName':_0x88df('0xa'),'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 6ca7924..f515ea6 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 _0x0f4b=['raw','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','options','where','limit','include','map','model','attributes','info','stringify','ShowFreshdeskAccount','find'];(function(_0x37d2a1,_0x264698){var _0x5f2767=function(_0x3ae114){while(--_0x3ae114){_0x37d2a1['push'](_0x37d2a1['shift']());}};_0x5f2767(++_0x264698);}(_0x0f4b,0x178));var _0xb0f4=function(_0x5ed2b6,_0x5d1c60){_0x5ed2b6=_0x5ed2b6-0x0;var _0x241424=_0x0f4b[_0x5ed2b6];return _0x241424;};'use strict';var _=require(_0xb0f4('0x0'));var util=require(_0xb0f4('0x1'));var moment=require('moment');var BPromise=require(_0xb0f4('0x2'));var rs=require(_0xb0f4('0x3'));var fs=require('fs');var Redis=require(_0xb0f4('0x4'));var db=require(_0xb0f4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb0f4('0x6'))(_0xb0f4('0x7'));var config=require(_0xb0f4('0x8'));var jayson=require(_0xb0f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x108f3f,_0x2ec63e,_0x4c47b8){return new BPromise(function(_0x2af20c,_0x3c5c71){return client[_0xb0f4('0xa')](_0x108f3f,_0x4c47b8)[_0xb0f4('0xb')](function(_0x33d9b5){logger['info'](_0xb0f4('0xc'),_0x2ec63e,_0xb0f4('0xd'));logger[_0xb0f4('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2ec63e,_0xb0f4('0xd'),JSON['stringify'](_0x33d9b5));if(_0x33d9b5[_0xb0f4('0xf')]){if(_0x33d9b5[_0xb0f4('0xf')][_0xb0f4('0x10')]===0x1f4){logger['error'](_0xb0f4('0xc'),_0x2ec63e,_0x33d9b5[_0xb0f4('0xf')][_0xb0f4('0x11')]);return _0x3c5c71(_0x33d9b5['error'][_0xb0f4('0x11')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x2ec63e,_0x33d9b5[_0xb0f4('0xf')][_0xb0f4('0x11')]);return _0x2af20c(_0x33d9b5['error'][_0xb0f4('0x11')]);}else{logger['info'](_0xb0f4('0xc'),_0x2ec63e,_0xb0f4('0xd'));_0x2af20c(_0x33d9b5[_0xb0f4('0x12')]['message']);}})['catch'](function(_0x4887a6){logger[_0xb0f4('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x2ec63e,_0x4887a6);_0x3c5c71(_0x4887a6);});});}exports[_0xb0f4('0x13')]=function(_0x2fded1){var _0x35c9e4=this;return new Promise(function(_0x314ed6,_0x4df0f7){return db[_0xb0f4('0x14')]['findAll']({'raw':_0x2fded1['options']?_0x2fded1[_0xb0f4('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2fded1[_0xb0f4('0x15')]?_0x2fded1[_0xb0f4('0x15')][_0xb0f4('0x16')]||null:null,'attributes':_0x2fded1[_0xb0f4('0x15')]?_0x2fded1[_0xb0f4('0x15')]['attributes']||null:null,'limit':_0x2fded1[_0xb0f4('0x15')]?_0x2fded1[_0xb0f4('0x15')][_0xb0f4('0x17')]||null:null,'include':_0x2fded1[_0xb0f4('0x15')]?_0x2fded1['options'][_0xb0f4('0x18')]?_[_0xb0f4('0x19')](_0x2fded1[_0xb0f4('0x15')][_0xb0f4('0x18')],function(_0x294b60){return{'model':db[_0x294b60[_0xb0f4('0x1a')]],'as':_0x294b60['as'],'attributes':_0x294b60['attributes'],'include':_0x294b60[_0xb0f4('0x18')]?_['map'](_0x294b60['include'],function(_0x368940){return{'model':db[_0x368940[_0xb0f4('0x1a')]],'as':_0x368940['as'],'attributes':_0x368940[_0xb0f4('0x1b')],'include':_0x368940[_0xb0f4('0x18')]?_[_0xb0f4('0x19')](_0x368940['include'],function(_0x4f0437){return{'model':db[_0x4f0437[_0xb0f4('0x1a')]],'as':_0x4f0437['as'],'attributes':_0x4f0437['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0f4('0xb')](function(_0x40bb90){logger[_0xb0f4('0x1c')](_0xb0f4('0x13'),_0x2fded1);logger[_0xb0f4('0xe')](_0xb0f4('0x13'),_0x2fded1,JSON[_0xb0f4('0x1d')](_0x40bb90));_0x314ed6(_0x40bb90);})['catch'](function(_0x371d70){logger['error'](_0xb0f4('0x13'),_0x371d70[_0xb0f4('0x11')],_0x2fded1);_0x4df0f7(_0x35c9e4[_0xb0f4('0xf')](0x1f4,_0x371d70['message']));});});};exports[_0xb0f4('0x1e')]=function(_0x38722a){var _0x3e9813=this;return new Promise(function(_0x125417,_0x5e6d20){return db[_0xb0f4('0x14')][_0xb0f4('0x1f')]({'raw':_0x38722a[_0xb0f4('0x15')]?_0x38722a['options'][_0xb0f4('0x20')]===undefined?!![]:![]:!![],'where':_0x38722a[_0xb0f4('0x15')]?_0x38722a['options'][_0xb0f4('0x16')]||null:null,'attributes':_0x38722a[_0xb0f4('0x15')]?_0x38722a[_0xb0f4('0x15')][_0xb0f4('0x1b')]||null:null,'include':_0x38722a[_0xb0f4('0x15')]?_0x38722a['options']['include']?_[_0xb0f4('0x19')](_0x38722a[_0xb0f4('0x15')][_0xb0f4('0x18')],function(_0x1852ab){return{'model':db[_0x1852ab[_0xb0f4('0x1a')]],'as':_0x1852ab['as'],'attributes':_0x1852ab[_0xb0f4('0x1b')],'include':_0x1852ab[_0xb0f4('0x18')]?_[_0xb0f4('0x19')](_0x1852ab[_0xb0f4('0x18')],function(_0x2e225b){return{'model':db[_0x2e225b[_0xb0f4('0x1a')]],'as':_0x2e225b['as'],'attributes':_0x2e225b[_0xb0f4('0x1b')],'include':_0x2e225b[_0xb0f4('0x18')]?_['map'](_0x2e225b[_0xb0f4('0x18')],function(_0x1eab41){return{'model':db[_0x1eab41[_0xb0f4('0x1a')]],'as':_0x1eab41['as'],'attributes':_0x1eab41[_0xb0f4('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27cc39){logger[_0xb0f4('0x1c')](_0xb0f4('0x1e'),_0x38722a);logger['debug']('ShowFreshdeskAccount',_0x38722a,JSON['stringify'](_0x27cc39));_0x125417(_0x27cc39);})[_0xb0f4('0x21')](function(_0x12d3d9){logger['error'](_0xb0f4('0x1e'),_0x12d3d9[_0xb0f4('0x11')],_0x38722a);_0x5e6d20(_0x3e9813[_0xb0f4('0xf')](0x1f4,_0x12d3d9[_0xb0f4('0x11')]));});});}; \ No newline at end of file +var _0x406a=['catch','FreshdeskAccount','find','then','ShowFreshdeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','info','request\x20sent','debug','error','FreshdeskAccount,\x20%s,\x20%s','message','GetFreshdeskAccount','options','raw','where','attributes','limit','include','map','model','stringify'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x406a,0xfd));var _0xa406=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x406a[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xa406('0x0'));var util=require('util');var moment=require(_0xa406('0x1'));var BPromise=require(_0xa406('0x2'));var rs=require(_0xa406('0x3'));var fs=require('fs');var Redis=require(_0xa406('0x4'));var db=require(_0xa406('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa406('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa406('0x7'));var client=jayson[_0xa406('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x244ac7,_0x55c963,_0x4c0857){return new BPromise(function(_0x58937c,_0x3d15d9){return client[_0xa406('0x9')](_0x244ac7,_0x4c0857)['then'](function(_0x13f26c){logger[_0xa406('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x55c963,_0xa406('0xb'));logger[_0xa406('0xc')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x55c963,'request\x20sent',JSON['stringify'](_0x13f26c));if(_0x13f26c['error']){if(_0x13f26c[_0xa406('0xd')]['code']===0x1f4){logger[_0xa406('0xd')](_0xa406('0xe'),_0x55c963,_0x13f26c[_0xa406('0xd')][_0xa406('0xf')]);return _0x3d15d9(_0x13f26c[_0xa406('0xd')]['message']);}logger[_0xa406('0xd')](_0xa406('0xe'),_0x55c963,_0x13f26c[_0xa406('0xd')][_0xa406('0xf')]);return _0x58937c(_0x13f26c[_0xa406('0xd')][_0xa406('0xf')]);}else{logger[_0xa406('0xa')](_0xa406('0xe'),_0x55c963,'request\x20sent');_0x58937c(_0x13f26c['result'][_0xa406('0xf')]);}})['catch'](function(_0x321a88){logger[_0xa406('0xd')](_0xa406('0xe'),_0x55c963,_0x321a88);_0x3d15d9(_0x321a88);});});}exports[_0xa406('0x10')]=function(_0x5b9a64){var _0x2aefa8=this;return new Promise(function(_0x12581c,_0x16a743){return db['FreshdeskAccount']['findAll']({'raw':_0x5b9a64[_0xa406('0x11')]?_0x5b9a64['options'][_0xa406('0x12')]===undefined?!![]:![]:!![],'where':_0x5b9a64['options']?_0x5b9a64[_0xa406('0x11')][_0xa406('0x13')]||null:null,'attributes':_0x5b9a64[_0xa406('0x11')]?_0x5b9a64[_0xa406('0x11')][_0xa406('0x14')]||null:null,'limit':_0x5b9a64[_0xa406('0x11')]?_0x5b9a64['options'][_0xa406('0x15')]||null:null,'include':_0x5b9a64['options']?_0x5b9a64[_0xa406('0x11')][_0xa406('0x16')]?_[_0xa406('0x17')](_0x5b9a64[_0xa406('0x11')]['include'],function(_0x36da7d){return{'model':db[_0x36da7d[_0xa406('0x18')]],'as':_0x36da7d['as'],'attributes':_0x36da7d[_0xa406('0x14')],'include':_0x36da7d[_0xa406('0x16')]?_[_0xa406('0x17')](_0x36da7d[_0xa406('0x16')],function(_0x4aff59){return{'model':db[_0x4aff59['model']],'as':_0x4aff59['as'],'attributes':_0x4aff59['attributes'],'include':_0x4aff59[_0xa406('0x16')]?_[_0xa406('0x17')](_0x4aff59[_0xa406('0x16')],function(_0x1cfe20){return{'model':db[_0x1cfe20[_0xa406('0x18')]],'as':_0x1cfe20['as'],'attributes':_0x1cfe20[_0xa406('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x75cf3f){logger[_0xa406('0xa')](_0xa406('0x10'),_0x5b9a64);logger['debug'](_0xa406('0x10'),_0x5b9a64,JSON[_0xa406('0x19')](_0x75cf3f));_0x12581c(_0x75cf3f);})[_0xa406('0x1a')](function(_0x3966c4){logger[_0xa406('0xd')](_0xa406('0x10'),_0x3966c4['message'],_0x5b9a64);_0x16a743(_0x2aefa8['error'](0x1f4,_0x3966c4[_0xa406('0xf')]));});});};exports['ShowFreshdeskAccount']=function(_0x369d62){var _0x5d3abf=this;return new Promise(function(_0x41f0ac,_0x34fb1c){return db[_0xa406('0x1b')][_0xa406('0x1c')]({'raw':_0x369d62[_0xa406('0x11')]?_0x369d62[_0xa406('0x11')][_0xa406('0x12')]===undefined?!![]:![]:!![],'where':_0x369d62[_0xa406('0x11')]?_0x369d62[_0xa406('0x11')][_0xa406('0x13')]||null:null,'attributes':_0x369d62[_0xa406('0x11')]?_0x369d62[_0xa406('0x11')][_0xa406('0x14')]||null:null,'include':_0x369d62[_0xa406('0x11')]?_0x369d62[_0xa406('0x11')][_0xa406('0x16')]?_[_0xa406('0x17')](_0x369d62['options']['include'],function(_0x292dc3){return{'model':db[_0x292dc3[_0xa406('0x18')]],'as':_0x292dc3['as'],'attributes':_0x292dc3['attributes'],'include':_0x292dc3[_0xa406('0x16')]?_[_0xa406('0x17')](_0x292dc3[_0xa406('0x16')],function(_0x8f5e78){return{'model':db[_0x8f5e78['model']],'as':_0x8f5e78['as'],'attributes':_0x8f5e78[_0xa406('0x14')],'include':_0x8f5e78[_0xa406('0x16')]?_['map'](_0x8f5e78[_0xa406('0x16')],function(_0x5c8369){return{'model':db[_0x5c8369[_0xa406('0x18')]],'as':_0x5c8369['as'],'attributes':_0x5c8369[_0xa406('0x14')]};}):[]};}):[]};}):[]:[]})[_0xa406('0x1d')](function(_0x5c5766){logger[_0xa406('0xa')](_0xa406('0x1e'),_0x369d62);logger[_0xa406('0xc')]('ShowFreshdeskAccount',_0x369d62,JSON[_0xa406('0x19')](_0x5c5766));_0x41f0ac(_0x5c5766);})['catch'](function(_0x22fc97){logger['error'](_0xa406('0x1e'),_0x22fc97[_0xa406('0xf')],_0x369d62);_0x34fb1c(_0x5d3abf['error'](0x1f4,_0x22fc97[_0xa406('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index e016141..ffd360e 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 _0x6adb=['getDescriptions','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0xbe51b8,_0x23240a){var _0x51eea1=function(_0xc1ea73){while(--_0xc1ea73){_0xbe51b8['push'](_0xbe51b8['shift']());}};_0x51eea1(++_0x23240a);}(_0x6adb,0x190));var _0xb6ad=function(_0x1f2552,_0x50927f){_0x1f2552=_0x1f2552-0x0;var _0x466d72=_0x6adb[_0x1f2552];return _0x466d72;};'use strict';var multer=require(_0xb6ad('0x0'));var util=require('util');var path=require(_0xb6ad('0x1'));var timeout=require(_0xb6ad('0x2'));var express=require('express');var router=express[_0xb6ad('0x3')]();var fs_extra=require(_0xb6ad('0x4'));var auth=require(_0xb6ad('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb6ad('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0xb6ad('0x7')]('/',auth[_0xb6ad('0x8')](),controller['index']);router[_0xb6ad('0x7')](_0xb6ad('0x9'),auth[_0xb6ad('0x8')](),controller[_0xb6ad('0xa')]);router['get'](_0xb6ad('0xb'),auth['isAuthenticated'](),controller[_0xb6ad('0xc')]);router[_0xb6ad('0x7')](_0xb6ad('0xd'),auth[_0xb6ad('0x8')](),controller[_0xb6ad('0xe')]);router['get'](_0xb6ad('0xf'),auth[_0xb6ad('0x8')](),controller[_0xb6ad('0x10')]);router[_0xb6ad('0x7')]('/:id/tags',auth[_0xb6ad('0x8')](),controller[_0xb6ad('0x11')]);router[_0xb6ad('0x12')]('/',auth[_0xb6ad('0x8')](),controller[_0xb6ad('0x13')]);router['post']('/:id/tags',auth[_0xb6ad('0x8')](),controller[_0xb6ad('0x14')]);router[_0xb6ad('0x15')](_0xb6ad('0x9'),auth['isAuthenticated'](),controller[_0xb6ad('0x16')]);router[_0xb6ad('0x17')]('/:id',auth[_0xb6ad('0x8')](),controller[_0xb6ad('0x18')]);module[_0xb6ad('0x19')]=router; \ No newline at end of file +var _0x6eea=['update','delete','destroy','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','getFields','getSubjects','getTags','post','/:id/tags','setTags','put'];(function(_0x454589,_0x3e852e){var _0x468c5c=function(_0xa5b1f5){while(--_0xa5b1f5){_0x454589['push'](_0x454589['shift']());}};_0x468c5c(++_0x3e852e);}(_0x6eea,0x1bb));var _0xa6ee=function(_0x523a67,_0x11ea07){_0x523a67=_0x523a67-0x0;var _0x3e5b9d=_0x6eea[_0x523a67];return _0x3e5b9d;};'use strict';var multer=require(_0xa6ee('0x0'));var util=require('util');var path=require(_0xa6ee('0x1'));var timeout=require('connect-timeout');var express=require(_0xa6ee('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa6ee('0x3'));var interaction=require(_0xa6ee('0x4'));var config=require(_0xa6ee('0x5'));var controller=require('./intFreshdeskConfiguration.controller');router[_0xa6ee('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa6ee('0x6')](_0xa6ee('0x7'),auth[_0xa6ee('0x8')](),controller[_0xa6ee('0x9')]);router[_0xa6ee('0x6')]('/:id/fields',auth[_0xa6ee('0x8')](),controller[_0xa6ee('0xa')]);router[_0xa6ee('0x6')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xa6ee('0xb')]);router['get']('/:id/descriptions',auth[_0xa6ee('0x8')](),controller['getDescriptions']);router[_0xa6ee('0x6')]('/:id/tags',auth[_0xa6ee('0x8')](),controller[_0xa6ee('0xc')]);router['post']('/',auth[_0xa6ee('0x8')](),controller['create']);router[_0xa6ee('0xd')](_0xa6ee('0xe'),auth[_0xa6ee('0x8')](),controller[_0xa6ee('0xf')]);router[_0xa6ee('0x10')](_0xa6ee('0x7'),auth[_0xa6ee('0x8')](),controller[_0xa6ee('0x11')]);router[_0xa6ee('0x12')](_0xa6ee('0x7'),auth[_0xa6ee('0x8')](),controller[_0xa6ee('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 7a435f0..fc1f69c 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 _0xe73f=['STRING','sequelize'];(function(_0x188ee6,_0x4282c4){var _0x3995e8=function(_0x1afc55){while(--_0x1afc55){_0x188ee6['push'](_0x188ee6['shift']());}};_0x3995e8(++_0x4282c4);}(_0xe73f,0x175));var _0xfe73=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xe73f[_0x24061a];return _0x82054e;};'use strict';var Sequelize=require(_0xfe73('0x0'));module['exports']={'name':{'type':Sequelize[_0xfe73('0x1')]},'description':{'type':Sequelize[_0xfe73('0x1')]}}; \ No newline at end of file +var _0x4256=['STRING','sequelize','exports'];(function(_0x1c61af,_0x1025fc){var _0x21524c=function(_0x21f2ad){while(--_0x21f2ad){_0x1c61af['push'](_0x1c61af['shift']());}};_0x21524c(++_0x1025fc);}(_0x4256,0x124));var _0x6425=function(_0x547e20,_0x284545){_0x547e20=_0x547e20-0x0;var _0x359171=_0x4256[_0x547e20];return _0x359171;};'use strict';var Sequelize=require(_0x6425('0x0'));module[_0x6425('0x1')]={'name':{'type':Sequelize[_0x6425('0x2')]},'description':{'type':Sequelize[_0x6425('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index b9db2e5..7889729 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 _0xef39=['pick','filter','merge','VIRTUAL','then','findAll','rows','catch','show','params','includeAll','include','find','create','body','getFields','findOne','FreshdeskField','options','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x4c39f4,_0x4dd067){var _0x290dda=function(_0x1536e5){while(--_0x1536e5){_0x4c39f4['push'](_0x4c39f4['shift']());}};_0x290dda(++_0x4dd067);}(_0xef39,0x1bc));var _0x9ef3=function(_0x43d885,_0x4f25d6){_0x43d885=_0x43d885-0x0;var _0x306f89=_0xef39[_0x43d885];return _0x306f89;};'use strict';var emlformat=require(_0x9ef3('0x0'));var rimraf=require(_0x9ef3('0x1'));var zipdir=require(_0x9ef3('0x2'));var jsonpatch=require(_0x9ef3('0x3'));var rp=require(_0x9ef3('0x4'));var moment=require(_0x9ef3('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9ef3('0x6'));var path=require(_0x9ef3('0x7'));var sox=require(_0x9ef3('0x8'));var csv=require(_0x9ef3('0x9'));var ejs=require(_0x9ef3('0xa'));var fs=require('fs');var fs_extra=require(_0x9ef3('0xb'));var _=require(_0x9ef3('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9ef3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9ef3('0x9'));var querystring=require('querystring');var Papa=require(_0x9ef3('0xe'));var Redis=require(_0x9ef3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9ef3('0x10'));var as=require(_0x9ef3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ef3('0x12'))('api');var utils=require(_0x9ef3('0x13'));var config=require(_0x9ef3('0x14'));var licenseUtil=require(_0x9ef3('0x15'));var db=require(_0x9ef3('0x16'))['db'];function respondWithStatusCode(_0x44535b,_0x18f986){_0x18f986=_0x18f986||0xcc;return function(_0x7557d7){if(_0x7557d7){return _0x44535b[_0x9ef3('0x17')](_0x18f986);}return _0x44535b[_0x9ef3('0x18')](_0x18f986)[_0x9ef3('0x19')]();};}function respondWithResult(_0x5dcbbb,_0x4ef1f4){_0x4ef1f4=_0x4ef1f4||0xc8;return function(_0x13b0ec){if(_0x13b0ec){return _0x5dcbbb[_0x9ef3('0x18')](_0x4ef1f4)['json'](_0x13b0ec);}};}function respondWithFilteredResult(_0x53054c,_0x573513){return function(_0x26b43b){if(_0x26b43b){var _0x2ec002=typeof _0x573513[_0x9ef3('0x1a')]===_0x9ef3('0x1b')&&typeof _0x573513[_0x9ef3('0x1c')]===_0x9ef3('0x1b');var _0x6aefe5=_0x26b43b[_0x9ef3('0x1d')];var _0x654719=_0x2ec002?0x0:_0x573513[_0x9ef3('0x1a')];var _0x383898=_0x2ec002?_0x26b43b[_0x9ef3('0x1d')]:_0x573513['offset']+_0x573513[_0x9ef3('0x1c')];var _0x265f29;if(_0x383898>=_0x6aefe5){_0x383898=_0x6aefe5;_0x265f29=0xc8;}else{_0x265f29=0xce;}_0x53054c['status'](_0x265f29);return _0x53054c[_0x9ef3('0x1e')]('Content-Range',_0x654719+'-'+_0x383898+'/'+_0x6aefe5)[_0x9ef3('0x1f')](_0x26b43b);}return null;};}function patchUpdates(_0xd8d7ac){return function(_0x59ca0d){try{jsonpatch[_0x9ef3('0x20')](_0x59ca0d,_0xd8d7ac,!![]);}catch(_0x491327){return BPromise[_0x9ef3('0x21')](_0x491327);}return _0x59ca0d[_0x9ef3('0x22')]();};}function saveUpdates(_0x4f638c,_0x1eab28){return function(_0x29823d){if(_0x29823d){return _0x29823d[_0x9ef3('0x23')](_0x4f638c)['then'](function(_0x29c9ef){return _0x29c9ef;});}return null;};}function removeEntity(_0x10fa7b,_0x52a143){return function(_0x176233){if(_0x176233){return _0x176233[_0x9ef3('0x24')]()['then'](function(){_0x10fa7b[_0x9ef3('0x18')](0xcc)[_0x9ef3('0x19')]();});}};}function handleEntityNotFound(_0x5d910a,_0x33a2a6){return function(_0x112a6f){if(!_0x112a6f){_0x5d910a[_0x9ef3('0x17')](0x194);}return _0x112a6f;};}function handleError(_0x516e33,_0x28d86d){_0x28d86d=_0x28d86d||0x1f4;return function(_0x447d7d){logger['error'](_0x447d7d[_0x9ef3('0x25')]);if(_0x447d7d[_0x9ef3('0x26')]){delete _0x447d7d[_0x9ef3('0x26')];}_0x516e33['status'](_0x28d86d)[_0x9ef3('0x27')](_0x447d7d);};}exports[_0x9ef3('0x28')]=function(_0x252d4c,_0x5c8c9a){var _0x16416e={},_0x5aa167={},_0x1ed92c={'count':0x0,'rows':[]};var _0x1237bb=_[_0x9ef3('0x29')](db[_0x9ef3('0x2a')][_0x9ef3('0x2b')],function(_0x2783fe){return{'name':_0x2783fe[_0x9ef3('0x2c')],'type':_0x2783fe[_0x9ef3('0x2d')][_0x9ef3('0x2e')]};});_0x5aa167[_0x9ef3('0x2f')]=_['map'](_0x1237bb,'name');_0x5aa167['query']=_[_0x9ef3('0x30')](_0x252d4c['query']);_0x5aa167['filters']=_[_0x9ef3('0x31')](_0x5aa167['model'],_0x5aa167[_0x9ef3('0x32')]);_0x16416e[_0x9ef3('0x33')]=_[_0x9ef3('0x31')](_0x5aa167['model'],qs[_0x9ef3('0x34')](_0x252d4c[_0x9ef3('0x32')]['fields']));_0x16416e[_0x9ef3('0x33')]=_0x16416e[_0x9ef3('0x33')][_0x9ef3('0x35')]?_0x16416e[_0x9ef3('0x33')]:_0x5aa167[_0x9ef3('0x2f')];if(!_0x252d4c[_0x9ef3('0x32')][_0x9ef3('0x36')](_0x9ef3('0x37'))){_0x16416e[_0x9ef3('0x1c')]=qs['limit'](_0x252d4c[_0x9ef3('0x32')][_0x9ef3('0x1c')]);_0x16416e[_0x9ef3('0x1a')]=qs['offset'](_0x252d4c[_0x9ef3('0x32')]['offset']);}_0x16416e[_0x9ef3('0x38')]=qs[_0x9ef3('0x39')](_0x252d4c[_0x9ef3('0x32')][_0x9ef3('0x39')]);_0x16416e[_0x9ef3('0x3a')]=qs[_0x9ef3('0x3b')](_[_0x9ef3('0x3c')](_0x252d4c[_0x9ef3('0x32')],_0x5aa167['filters']),_0x1237bb);if(_0x252d4c[_0x9ef3('0x32')][_0x9ef3('0x3d')]){_0x16416e[_0x9ef3('0x3a')]=_[_0x9ef3('0x3e')](_0x16416e[_0x9ef3('0x3a')],{'$or':_[_0x9ef3('0x29')](_0x1237bb,function(_0x298225){if(_0x298225[_0x9ef3('0x2d')]!==_0x9ef3('0x3f')){var _0x5715bf={};_0x5715bf[_0x298225[_0x9ef3('0x26')]]={'$like':'%'+_0x252d4c[_0x9ef3('0x32')][_0x9ef3('0x3d')]+'%'};return _0x5715bf;}})});}_0x16416e=_[_0x9ef3('0x3e')]({},_0x16416e,_0x252d4c['options']);var _0x1db970={'where':_0x16416e[_0x9ef3('0x3a')]};return db['FreshdeskConfiguration'][_0x9ef3('0x1d')](_0x1db970)[_0x9ef3('0x40')](function(_0x4a9185){_0x1ed92c[_0x9ef3('0x1d')]=_0x4a9185;if(_0x252d4c[_0x9ef3('0x32')]['includeAll']){_0x16416e['include']=[{'all':!![]}];}return db[_0x9ef3('0x2a')][_0x9ef3('0x41')](_0x16416e);})[_0x9ef3('0x40')](function(_0x1daebb){_0x1ed92c[_0x9ef3('0x42')]=_0x1daebb;return _0x1ed92c;})['then'](respondWithFilteredResult(_0x5c8c9a,_0x16416e))[_0x9ef3('0x43')](handleError(_0x5c8c9a,null));};exports[_0x9ef3('0x44')]=function(_0x473e25,_0x446efd){var _0xa07a1={'raw':![],'where':{'id':_0x473e25[_0x9ef3('0x45')]['id']}},_0x59cd24={};_0x59cd24[_0x9ef3('0x2f')]=_[_0x9ef3('0x30')](db['FreshdeskConfiguration']['rawAttributes']);_0x59cd24[_0x9ef3('0x32')]=_['keys'](_0x473e25['query']);_0x59cd24[_0x9ef3('0x3b')]=_['intersection'](_0x59cd24['model'],_0x59cd24['query']);_0xa07a1[_0x9ef3('0x33')]=_['intersection'](_0x59cd24['model'],qs[_0x9ef3('0x34')](_0x473e25[_0x9ef3('0x32')][_0x9ef3('0x34')]));_0xa07a1[_0x9ef3('0x33')]=_0xa07a1[_0x9ef3('0x33')][_0x9ef3('0x35')]?_0xa07a1['attributes']:_0x59cd24['model'];if(_0x473e25[_0x9ef3('0x32')][_0x9ef3('0x46')]){_0xa07a1[_0x9ef3('0x47')]=[{'all':!![]}];}_0xa07a1=_[_0x9ef3('0x3e')]({},_0xa07a1,_0x473e25['options']);return db[_0x9ef3('0x2a')][_0x9ef3('0x48')](_0xa07a1)[_0x9ef3('0x40')](handleEntityNotFound(_0x446efd,null))[_0x9ef3('0x40')](respondWithResult(_0x446efd,null))[_0x9ef3('0x43')](handleError(_0x446efd,null));};exports[_0x9ef3('0x49')]=function(_0x4093fc,_0x4a6343){return db[_0x9ef3('0x2a')]['create'](_0x4093fc[_0x9ef3('0x4a')],{})[_0x9ef3('0x40')](respondWithResult(_0x4a6343,0xc9))[_0x9ef3('0x43')](handleError(_0x4a6343,null));};exports[_0x9ef3('0x23')]=function(_0x520bdb,_0xd40ebd){if(_0x520bdb['body']['id']){delete _0x520bdb[_0x9ef3('0x4a')]['id'];}return db[_0x9ef3('0x2a')][_0x9ef3('0x48')]({'where':{'id':_0x520bdb[_0x9ef3('0x45')]['id']}})[_0x9ef3('0x40')](handleEntityNotFound(_0xd40ebd,null))[_0x9ef3('0x40')](saveUpdates(_0x520bdb[_0x9ef3('0x4a')],null))[_0x9ef3('0x40')](respondWithResult(_0xd40ebd,null))['catch'](handleError(_0xd40ebd,null));};exports[_0x9ef3('0x24')]=function(_0x5e801f,_0xed804c){return db[_0x9ef3('0x2a')][_0x9ef3('0x48')]({'where':{'id':_0x5e801f[_0x9ef3('0x45')]['id']}})[_0x9ef3('0x40')](handleEntityNotFound(_0xed804c,null))[_0x9ef3('0x40')](removeEntity(_0xed804c,null))[_0x9ef3('0x43')](handleError(_0xed804c,null));};exports[_0x9ef3('0x4b')]=function(_0x26c00c,_0x2738c8,_0xcff4b6){var _0x1a5a58={};var _0x1ccb9={};var _0xccbe21;var _0x39b8fd;return db[_0x9ef3('0x2a')][_0x9ef3('0x4c')]({'where':{'id':_0x26c00c[_0x9ef3('0x45')]['id']}})['then'](handleEntityNotFound(_0x2738c8,null))[_0x9ef3('0x40')](function(_0x2c93a6){if(_0x2c93a6){_0xccbe21=_0x2c93a6;_0x1ccb9[_0x9ef3('0x2f')]=_[_0x9ef3('0x30')](db[_0x9ef3('0x4d')][_0x9ef3('0x2b')]);_0x1ccb9[_0x9ef3('0x32')]=_[_0x9ef3('0x30')](_0x26c00c['query']);_0x1ccb9[_0x9ef3('0x3b')]=_[_0x9ef3('0x31')](_0x1ccb9['model'],_0x1ccb9[_0x9ef3('0x32')]);_0x1a5a58[_0x9ef3('0x33')]=_[_0x9ef3('0x31')](_0x1ccb9['model'],qs[_0x9ef3('0x34')](_0x26c00c[_0x9ef3('0x32')]['fields']));_0x1a5a58[_0x9ef3('0x33')]=_0x1a5a58[_0x9ef3('0x33')][_0x9ef3('0x35')]?_0x1a5a58[_0x9ef3('0x33')]:_0x1ccb9[_0x9ef3('0x2f')];_0x1a5a58[_0x9ef3('0x38')]=qs[_0x9ef3('0x39')](_0x26c00c[_0x9ef3('0x32')][_0x9ef3('0x39')]);_0x1a5a58[_0x9ef3('0x3a')]=qs[_0x9ef3('0x3b')](_[_0x9ef3('0x3c')](_0x26c00c[_0x9ef3('0x32')],_0x1ccb9['filters']));if(_0x26c00c[_0x9ef3('0x32')][_0x9ef3('0x3d')]){_0x1a5a58[_0x9ef3('0x3a')]=_[_0x9ef3('0x3e')](_0x1a5a58[_0x9ef3('0x3a')],{'$or':_[_0x9ef3('0x29')](_0x1a5a58[_0x9ef3('0x33')],function(_0x28c2e1){var _0x39c71b={};_0x39c71b[_0x28c2e1]={'$like':'%'+_0x26c00c[_0x9ef3('0x32')][_0x9ef3('0x3d')]+'%'};return _0x39c71b;})});}_0x1a5a58=_[_0x9ef3('0x3e')]({},_0x1a5a58,_0x26c00c[_0x9ef3('0x4e')]);return _0xccbe21['getFields'](_0x1a5a58);}})['then'](function(_0x83bb84){if(_0x83bb84){_0x39b8fd=_0x83bb84[_0x9ef3('0x35')];if(!_0x26c00c['query'][_0x9ef3('0x36')](_0x9ef3('0x37'))){_0x1a5a58['limit']=qs[_0x9ef3('0x1c')](_0x26c00c[_0x9ef3('0x32')][_0x9ef3('0x1c')]);_0x1a5a58[_0x9ef3('0x1a')]=qs[_0x9ef3('0x1a')](_0x26c00c[_0x9ef3('0x32')]['offset']);}return _0xccbe21['getFields'](_0x1a5a58);}})[_0x9ef3('0x40')](function(_0x2c491e){if(_0x2c491e){return _0x2c491e?{'count':_0x39b8fd,'rows':_0x2c491e}:null;}})['then'](respondWithResult(_0x2738c8,null))[_0x9ef3('0x43')](handleError(_0x2738c8,null));};exports[_0x9ef3('0x4f')]=function(_0x1f10f5,_0x52f024,_0x2cf6df){var _0x1baae4={};var _0x4f14fc={};var _0x3bd27a;var _0x56e39b;return db[_0x9ef3('0x2a')][_0x9ef3('0x4c')]({'where':{'id':_0x1f10f5[_0x9ef3('0x45')]['id']}})[_0x9ef3('0x40')](handleEntityNotFound(_0x52f024,null))['then'](function(_0x5abca9){if(_0x5abca9){_0x3bd27a=_0x5abca9;_0x4f14fc['model']=_[_0x9ef3('0x30')](db[_0x9ef3('0x4d')][_0x9ef3('0x2b')]);_0x4f14fc[_0x9ef3('0x32')]=_[_0x9ef3('0x30')](_0x1f10f5[_0x9ef3('0x32')]);_0x4f14fc[_0x9ef3('0x3b')]=_[_0x9ef3('0x31')](_0x4f14fc[_0x9ef3('0x2f')],_0x4f14fc[_0x9ef3('0x32')]);_0x1baae4[_0x9ef3('0x33')]=_['intersection'](_0x4f14fc[_0x9ef3('0x2f')],qs[_0x9ef3('0x34')](_0x1f10f5[_0x9ef3('0x32')]['fields']));_0x1baae4['attributes']=_0x1baae4['attributes'][_0x9ef3('0x35')]?_0x1baae4['attributes']:_0x4f14fc[_0x9ef3('0x2f')];_0x1baae4[_0x9ef3('0x38')]=qs['sort'](_0x1f10f5['query'][_0x9ef3('0x39')]);_0x1baae4[_0x9ef3('0x3a')]=qs[_0x9ef3('0x3b')](_['pick'](_0x1f10f5[_0x9ef3('0x32')],_0x4f14fc['filters']));if(_0x1f10f5[_0x9ef3('0x32')]['filter']){_0x1baae4['where']=_[_0x9ef3('0x3e')](_0x1baae4[_0x9ef3('0x3a')],{'$or':_['map'](_0x1baae4[_0x9ef3('0x33')],function(_0x59d077){var _0x9a7aef={};_0x9a7aef[_0x59d077]={'$like':'%'+_0x1f10f5[_0x9ef3('0x32')][_0x9ef3('0x3d')]+'%'};return _0x9a7aef;})});}_0x1baae4=_[_0x9ef3('0x3e')]({},_0x1baae4,_0x1f10f5[_0x9ef3('0x4e')]);return _0x3bd27a[_0x9ef3('0x4f')](_0x1baae4);}})[_0x9ef3('0x40')](function(_0x366cfb){if(_0x366cfb){_0x56e39b=_0x366cfb[_0x9ef3('0x35')];if(!_0x1f10f5['query'][_0x9ef3('0x36')](_0x9ef3('0x37'))){_0x1baae4['limit']=qs[_0x9ef3('0x1c')](_0x1f10f5[_0x9ef3('0x32')]['limit']);_0x1baae4[_0x9ef3('0x1a')]=qs[_0x9ef3('0x1a')](_0x1f10f5[_0x9ef3('0x32')]['offset']);}return _0x3bd27a['getSubjects'](_0x1baae4);}})[_0x9ef3('0x40')](function(_0x2d1217){if(_0x2d1217){return _0x2d1217?{'count':_0x56e39b,'rows':_0x2d1217}:null;}})[_0x9ef3('0x40')](respondWithResult(_0x52f024,null))['catch'](handleError(_0x52f024,null));};exports['getDescriptions']=function(_0x475322,_0x49dde0,_0x337a17){var _0x5758a5={};var _0x5a54b0={};var _0x58a5cc;var _0x55350b;return db['FreshdeskConfiguration'][_0x9ef3('0x4c')]({'where':{'id':_0x475322[_0x9ef3('0x45')]['id']}})[_0x9ef3('0x40')](handleEntityNotFound(_0x49dde0,null))['then'](function(_0x45eb25){if(_0x45eb25){_0x58a5cc=_0x45eb25;_0x5a54b0[_0x9ef3('0x2f')]=_['keys'](db[_0x9ef3('0x4d')][_0x9ef3('0x2b')]);_0x5a54b0[_0x9ef3('0x32')]=_[_0x9ef3('0x30')](_0x475322[_0x9ef3('0x32')]);_0x5a54b0['filters']=_[_0x9ef3('0x31')](_0x5a54b0[_0x9ef3('0x2f')],_0x5a54b0['query']);_0x5758a5[_0x9ef3('0x33')]=_[_0x9ef3('0x31')](_0x5a54b0[_0x9ef3('0x2f')],qs[_0x9ef3('0x34')](_0x475322[_0x9ef3('0x32')][_0x9ef3('0x34')]));_0x5758a5[_0x9ef3('0x33')]=_0x5758a5['attributes'][_0x9ef3('0x35')]?_0x5758a5[_0x9ef3('0x33')]:_0x5a54b0[_0x9ef3('0x2f')];_0x5758a5[_0x9ef3('0x38')]=qs[_0x9ef3('0x39')](_0x475322[_0x9ef3('0x32')][_0x9ef3('0x39')]);_0x5758a5[_0x9ef3('0x3a')]=qs['filters'](_[_0x9ef3('0x3c')](_0x475322['query'],_0x5a54b0[_0x9ef3('0x3b')]));if(_0x475322['query']['filter']){_0x5758a5['where']=_[_0x9ef3('0x3e')](_0x5758a5[_0x9ef3('0x3a')],{'$or':_[_0x9ef3('0x29')](_0x5758a5[_0x9ef3('0x33')],function(_0x1a9cc1){var _0x407f43={};_0x407f43[_0x1a9cc1]={'$like':'%'+_0x475322[_0x9ef3('0x32')][_0x9ef3('0x3d')]+'%'};return _0x407f43;})});}_0x5758a5=_[_0x9ef3('0x3e')]({},_0x5758a5,_0x475322[_0x9ef3('0x4e')]);return _0x58a5cc[_0x9ef3('0x50')](_0x5758a5);}})[_0x9ef3('0x40')](function(_0x30d465){if(_0x30d465){_0x55350b=_0x30d465[_0x9ef3('0x35')];if(!_0x475322['query']['hasOwnProperty']('nolimit')){_0x5758a5[_0x9ef3('0x1c')]=qs[_0x9ef3('0x1c')](_0x475322['query']['limit']);_0x5758a5[_0x9ef3('0x1a')]=qs[_0x9ef3('0x1a')](_0x475322[_0x9ef3('0x32')]['offset']);}return _0x58a5cc[_0x9ef3('0x50')](_0x5758a5);}})[_0x9ef3('0x40')](function(_0xa3eb96){if(_0xa3eb96){return _0xa3eb96?{'count':_0x55350b,'rows':_0xa3eb96}:null;}})['then'](respondWithResult(_0x49dde0,null))['catch'](handleError(_0x49dde0,null));};exports[_0x9ef3('0x51')]=function(_0x129786,_0x2036a4,_0x4f605a){var _0x30d5b5={};var _0x4b7c4b={};var _0x2f4034;var _0x46d7d1;return db[_0x9ef3('0x2a')][_0x9ef3('0x4c')]({'where':{'id':_0x129786['params']['id']}})[_0x9ef3('0x40')](handleEntityNotFound(_0x2036a4,null))[_0x9ef3('0x40')](function(_0x140b65){if(_0x140b65){_0x2f4034=_0x140b65;_0x4b7c4b[_0x9ef3('0x2f')]=_[_0x9ef3('0x30')](db[_0x9ef3('0x52')][_0x9ef3('0x2b')]);_0x4b7c4b[_0x9ef3('0x32')]=_[_0x9ef3('0x30')](_0x129786[_0x9ef3('0x32')]);_0x4b7c4b[_0x9ef3('0x3b')]=_[_0x9ef3('0x31')](_0x4b7c4b[_0x9ef3('0x2f')],_0x4b7c4b[_0x9ef3('0x32')]);_0x30d5b5[_0x9ef3('0x33')]=_[_0x9ef3('0x31')](_0x4b7c4b[_0x9ef3('0x2f')],qs[_0x9ef3('0x34')](_0x129786[_0x9ef3('0x32')][_0x9ef3('0x34')]));_0x30d5b5[_0x9ef3('0x33')]=_0x30d5b5[_0x9ef3('0x33')][_0x9ef3('0x35')]?_0x30d5b5[_0x9ef3('0x33')]:_0x4b7c4b[_0x9ef3('0x2f')];_0x30d5b5[_0x9ef3('0x38')]=qs[_0x9ef3('0x39')](_0x129786[_0x9ef3('0x32')][_0x9ef3('0x39')]);_0x30d5b5[_0x9ef3('0x3a')]=qs[_0x9ef3('0x3b')](_['pick'](_0x129786[_0x9ef3('0x32')],_0x4b7c4b[_0x9ef3('0x3b')]));if(_0x129786['query'][_0x9ef3('0x3d')]){_0x30d5b5[_0x9ef3('0x3a')]=_[_0x9ef3('0x3e')](_0x30d5b5[_0x9ef3('0x3a')],{'$or':_[_0x9ef3('0x29')](_0x30d5b5[_0x9ef3('0x33')],function(_0x151838){var _0x5985f0={};_0x5985f0[_0x151838]={'$like':'%'+_0x129786[_0x9ef3('0x32')][_0x9ef3('0x3d')]+'%'};return _0x5985f0;})});}_0x30d5b5=_[_0x9ef3('0x3e')]({},_0x30d5b5,_0x129786['options']);return _0x2f4034[_0x9ef3('0x51')](_0x30d5b5);}})[_0x9ef3('0x40')](function(_0x2a6e7b){if(_0x2a6e7b){_0x46d7d1=_0x2a6e7b[_0x9ef3('0x35')];if(!_0x129786[_0x9ef3('0x32')]['hasOwnProperty'](_0x9ef3('0x37'))){_0x30d5b5[_0x9ef3('0x1c')]=qs[_0x9ef3('0x1c')](_0x129786[_0x9ef3('0x32')][_0x9ef3('0x1c')]);_0x30d5b5[_0x9ef3('0x1a')]=qs[_0x9ef3('0x1a')](_0x129786[_0x9ef3('0x32')][_0x9ef3('0x1a')]);}return _0x2f4034[_0x9ef3('0x51')](_0x30d5b5);}})[_0x9ef3('0x40')](function(_0x42c4af){if(_0x42c4af){return _0x42c4af?{'count':_0x46d7d1,'rows':_0x42c4af}:null;}})[_0x9ef3('0x40')](respondWithResult(_0x2036a4,null))['catch'](handleError(_0x2036a4,null));};exports['setTags']=function(_0x2793a3,_0x446819,_0x373852){if(_0x2793a3[_0x9ef3('0x4a')]['id']){delete _0x2793a3[_0x9ef3('0x4a')]['id'];}return db[_0x9ef3('0x2a')][_0x9ef3('0x4c')]({'where':{'id':_0x2793a3[_0x9ef3('0x45')]['id']}})[_0x9ef3('0x40')](handleEntityNotFound(_0x446819,null))[_0x9ef3('0x40')](function(_0x6d5b8){if(_0x6d5b8){return _0x6d5b8[_0x9ef3('0x53')](_0x2793a3[_0x9ef3('0x4a')]['ids']||[]);}return null;})[_0x9ef3('0x40')](respondWithResult(_0x446819,null))[_0x9ef3('0x43')](handleError(_0x446819,null));}; \ No newline at end of file +var _0xa695=['apply','reject','save','destroy','then','error','name','send','index','map','rawAttributes','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','FreshdeskConfiguration','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','getFields','findOne','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range'];(function(_0x2d72ab,_0x5a97f5){var _0x256423=function(_0x94ed46){while(--_0x94ed46){_0x2d72ab['push'](_0x2d72ab['shift']());}};_0x256423(++_0x5a97f5);}(_0xa695,0x87));var _0x5a69=function(_0xa9bc3,_0x638f64){_0xa9bc3=_0xa9bc3-0x0;var _0x343651=_0xa695[_0xa9bc3];return _0x343651;};'use strict';var emlformat=require(_0x5a69('0x0'));var rimraf=require(_0x5a69('0x1'));var zipdir=require(_0x5a69('0x2'));var jsonpatch=require(_0x5a69('0x3'));var rp=require(_0x5a69('0x4'));var moment=require(_0x5a69('0x5'));var BPromise=require(_0x5a69('0x6'));var Mustache=require('mustache');var util=require(_0x5a69('0x7'));var path=require(_0x5a69('0x8'));var sox=require(_0x5a69('0x9'));var csv=require(_0x5a69('0xa'));var ejs=require(_0x5a69('0xb'));var fs=require('fs');var fs_extra=require(_0x5a69('0xc'));var _=require('lodash');var squel=require(_0x5a69('0xd'));var crypto=require('crypto');var jsforce=require(_0x5a69('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5a69('0xf'));var Papa=require(_0x5a69('0x10'));var Redis=require(_0x5a69('0x11'));var authService=require(_0x5a69('0x12'));var qs=require(_0x5a69('0x13'));var as=require(_0x5a69('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5a69('0x15'));var licenseUtil=require(_0x5a69('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226813,_0x1bd878){_0x1bd878=_0x1bd878||0xcc;return function(_0x1f8df0){if(_0x1f8df0){return _0x226813[_0x5a69('0x17')](_0x1bd878);}return _0x226813[_0x5a69('0x18')](_0x1bd878)[_0x5a69('0x19')]();};}function respondWithResult(_0x4e9721,_0x27e2a1){_0x27e2a1=_0x27e2a1||0xc8;return function(_0x36e7e1){if(_0x36e7e1){return _0x4e9721[_0x5a69('0x18')](_0x27e2a1)[_0x5a69('0x1a')](_0x36e7e1);}};}function respondWithFilteredResult(_0x40003b,_0x3303a3){return function(_0x414cd0){if(_0x414cd0){var _0x4e8abf=typeof _0x3303a3['offset']===_0x5a69('0x1b')&&typeof _0x3303a3[_0x5a69('0x1c')]===_0x5a69('0x1b');var _0x2c5dcd=_0x414cd0['count'];var _0x19182f=_0x4e8abf?0x0:_0x3303a3[_0x5a69('0x1d')];var _0xedcadf=_0x4e8abf?_0x414cd0[_0x5a69('0x1e')]:_0x3303a3['offset']+_0x3303a3[_0x5a69('0x1c')];var _0x49b32d;if(_0xedcadf>=_0x2c5dcd){_0xedcadf=_0x2c5dcd;_0x49b32d=0xc8;}else{_0x49b32d=0xce;}_0x40003b['status'](_0x49b32d);return _0x40003b[_0x5a69('0x1f')](_0x5a69('0x20'),_0x19182f+'-'+_0xedcadf+'/'+_0x2c5dcd)[_0x5a69('0x1a')](_0x414cd0);}return null;};}function patchUpdates(_0x533587){return function(_0x3d702e){try{jsonpatch[_0x5a69('0x21')](_0x3d702e,_0x533587,!![]);}catch(_0x2077a1){return BPromise[_0x5a69('0x22')](_0x2077a1);}return _0x3d702e[_0x5a69('0x23')]();};}function saveUpdates(_0x11c12e,_0x4cf04b){return function(_0x157fda){if(_0x157fda){return _0x157fda['update'](_0x11c12e)['then'](function(_0x4e07ba){return _0x4e07ba;});}return null;};}function removeEntity(_0x41ebbc,_0x272bff){return function(_0x4caa71){if(_0x4caa71){return _0x4caa71[_0x5a69('0x24')]()[_0x5a69('0x25')](function(){_0x41ebbc['status'](0xcc)[_0x5a69('0x19')]();});}};}function handleEntityNotFound(_0x937b93,_0x4d56da){return function(_0x4cdf2e){if(!_0x4cdf2e){_0x937b93[_0x5a69('0x17')](0x194);}return _0x4cdf2e;};}function handleError(_0x18bd92,_0x31d73f){_0x31d73f=_0x31d73f||0x1f4;return function(_0x2b9805){logger[_0x5a69('0x26')](_0x2b9805['stack']);if(_0x2b9805[_0x5a69('0x27')]){delete _0x2b9805[_0x5a69('0x27')];}_0x18bd92[_0x5a69('0x18')](_0x31d73f)[_0x5a69('0x28')](_0x2b9805);};}exports[_0x5a69('0x29')]=function(_0x44c1c5,_0x51418e){var _0x118680={},_0x455446={},_0x137ffe={'count':0x0,'rows':[]};var _0x1aa2a3=_[_0x5a69('0x2a')](db['FreshdeskConfiguration'][_0x5a69('0x2b')],function(_0x10727a){return{'name':_0x10727a['fieldName'],'type':_0x10727a[_0x5a69('0x2c')][_0x5a69('0x2d')]};});_0x455446['model']=_[_0x5a69('0x2a')](_0x1aa2a3,_0x5a69('0x27'));_0x455446[_0x5a69('0x2e')]=_['keys'](_0x44c1c5[_0x5a69('0x2e')]);_0x455446[_0x5a69('0x2f')]=_[_0x5a69('0x30')](_0x455446['model'],_0x455446['query']);_0x118680[_0x5a69('0x31')]=_['intersection'](_0x455446[_0x5a69('0x32')],qs[_0x5a69('0x33')](_0x44c1c5[_0x5a69('0x2e')]['fields']));_0x118680[_0x5a69('0x31')]=_0x118680['attributes'][_0x5a69('0x34')]?_0x118680[_0x5a69('0x31')]:_0x455446['model'];if(!_0x44c1c5[_0x5a69('0x2e')][_0x5a69('0x35')](_0x5a69('0x36'))){_0x118680[_0x5a69('0x1c')]=qs[_0x5a69('0x1c')](_0x44c1c5[_0x5a69('0x2e')][_0x5a69('0x1c')]);_0x118680[_0x5a69('0x1d')]=qs[_0x5a69('0x1d')](_0x44c1c5[_0x5a69('0x2e')][_0x5a69('0x1d')]);}_0x118680[_0x5a69('0x37')]=qs[_0x5a69('0x38')](_0x44c1c5['query']['sort']);_0x118680[_0x5a69('0x39')]=qs['filters'](_[_0x5a69('0x3a')](_0x44c1c5[_0x5a69('0x2e')],_0x455446[_0x5a69('0x2f')]),_0x1aa2a3);if(_0x44c1c5[_0x5a69('0x2e')]['filter']){_0x118680[_0x5a69('0x39')]=_[_0x5a69('0x3b')](_0x118680[_0x5a69('0x39')],{'$or':_[_0x5a69('0x2a')](_0x1aa2a3,function(_0x23940d){if(_0x23940d[_0x5a69('0x2c')]!==_0x5a69('0x3c')){var _0x4e852e={};_0x4e852e[_0x23940d[_0x5a69('0x27')]]={'$like':'%'+_0x44c1c5[_0x5a69('0x2e')][_0x5a69('0x3d')]+'%'};return _0x4e852e;}})});}_0x118680=_[_0x5a69('0x3b')]({},_0x118680,_0x44c1c5[_0x5a69('0x3e')]);var _0x32e607={'where':_0x118680[_0x5a69('0x39')]};return db[_0x5a69('0x3f')][_0x5a69('0x1e')](_0x32e607)['then'](function(_0x27b857){_0x137ffe['count']=_0x27b857;if(_0x44c1c5[_0x5a69('0x2e')][_0x5a69('0x40')]){_0x118680[_0x5a69('0x41')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x5a69('0x42')](_0x118680);})[_0x5a69('0x25')](function(_0xc4b5ec){_0x137ffe['rows']=_0xc4b5ec;return _0x137ffe;})[_0x5a69('0x25')](respondWithFilteredResult(_0x51418e,_0x118680))[_0x5a69('0x43')](handleError(_0x51418e,null));};exports[_0x5a69('0x44')]=function(_0x3eb9b6,_0x1f9bae){var _0x2a9208={'raw':![],'where':{'id':_0x3eb9b6[_0x5a69('0x45')]['id']}},_0x2b4530={};_0x2b4530[_0x5a69('0x32')]=_['keys'](db[_0x5a69('0x3f')][_0x5a69('0x2b')]);_0x2b4530['query']=_[_0x5a69('0x46')](_0x3eb9b6[_0x5a69('0x2e')]);_0x2b4530['filters']=_[_0x5a69('0x30')](_0x2b4530[_0x5a69('0x32')],_0x2b4530[_0x5a69('0x2e')]);_0x2a9208[_0x5a69('0x31')]=_[_0x5a69('0x30')](_0x2b4530[_0x5a69('0x32')],qs['fields'](_0x3eb9b6[_0x5a69('0x2e')][_0x5a69('0x33')]));_0x2a9208[_0x5a69('0x31')]=_0x2a9208[_0x5a69('0x31')]['length']?_0x2a9208[_0x5a69('0x31')]:_0x2b4530[_0x5a69('0x32')];if(_0x3eb9b6['query'][_0x5a69('0x40')]){_0x2a9208[_0x5a69('0x41')]=[{'all':!![]}];}_0x2a9208=_[_0x5a69('0x3b')]({},_0x2a9208,_0x3eb9b6[_0x5a69('0x3e')]);return db[_0x5a69('0x3f')][_0x5a69('0x47')](_0x2a9208)['then'](handleEntityNotFound(_0x1f9bae,null))[_0x5a69('0x25')](respondWithResult(_0x1f9bae,null))[_0x5a69('0x43')](handleError(_0x1f9bae,null));};exports[_0x5a69('0x48')]=function(_0xc244ec,_0x1b981a){return db[_0x5a69('0x3f')]['create'](_0xc244ec[_0x5a69('0x49')],{})[_0x5a69('0x25')](respondWithResult(_0x1b981a,0xc9))[_0x5a69('0x43')](handleError(_0x1b981a,null));};exports[_0x5a69('0x4a')]=function(_0x4b0823,_0x32ed2f){if(_0x4b0823['body']['id']){delete _0x4b0823['body']['id'];}return db[_0x5a69('0x3f')][_0x5a69('0x47')]({'where':{'id':_0x4b0823['params']['id']}})[_0x5a69('0x25')](handleEntityNotFound(_0x32ed2f,null))[_0x5a69('0x25')](saveUpdates(_0x4b0823[_0x5a69('0x49')],null))[_0x5a69('0x25')](respondWithResult(_0x32ed2f,null))['catch'](handleError(_0x32ed2f,null));};exports[_0x5a69('0x24')]=function(_0xe1a0b6,_0x1f8528){return db['FreshdeskConfiguration']['find']({'where':{'id':_0xe1a0b6[_0x5a69('0x45')]['id']}})[_0x5a69('0x25')](handleEntityNotFound(_0x1f8528,null))['then'](removeEntity(_0x1f8528,null))[_0x5a69('0x43')](handleError(_0x1f8528,null));};exports[_0x5a69('0x4b')]=function(_0x5ed1ec,_0x15ee7c,_0x11a6af){var _0x3cfe28={};var _0x36c277={};var _0x429e73;var _0x53e3d7;return db[_0x5a69('0x3f')][_0x5a69('0x4c')]({'where':{'id':_0x5ed1ec[_0x5a69('0x45')]['id']}})[_0x5a69('0x25')](handleEntityNotFound(_0x15ee7c,null))['then'](function(_0x28ba67){if(_0x28ba67){_0x429e73=_0x28ba67;_0x36c277['model']=_[_0x5a69('0x46')](db['FreshdeskField'][_0x5a69('0x2b')]);_0x36c277[_0x5a69('0x2e')]=_[_0x5a69('0x46')](_0x5ed1ec[_0x5a69('0x2e')]);_0x36c277[_0x5a69('0x2f')]=_[_0x5a69('0x30')](_0x36c277[_0x5a69('0x32')],_0x36c277['query']);_0x3cfe28[_0x5a69('0x31')]=_[_0x5a69('0x30')](_0x36c277[_0x5a69('0x32')],qs[_0x5a69('0x33')](_0x5ed1ec[_0x5a69('0x2e')]['fields']));_0x3cfe28['attributes']=_0x3cfe28[_0x5a69('0x31')][_0x5a69('0x34')]?_0x3cfe28['attributes']:_0x36c277['model'];_0x3cfe28[_0x5a69('0x37')]=qs[_0x5a69('0x38')](_0x5ed1ec[_0x5a69('0x2e')]['sort']);_0x3cfe28[_0x5a69('0x39')]=qs[_0x5a69('0x2f')](_[_0x5a69('0x3a')](_0x5ed1ec[_0x5a69('0x2e')],_0x36c277['filters']));if(_0x5ed1ec[_0x5a69('0x2e')]['filter']){_0x3cfe28[_0x5a69('0x39')]=_['merge'](_0x3cfe28[_0x5a69('0x39')],{'$or':_[_0x5a69('0x2a')](_0x3cfe28['attributes'],function(_0x33e6ec){var _0x3db590={};_0x3db590[_0x33e6ec]={'$like':'%'+_0x5ed1ec[_0x5a69('0x2e')]['filter']+'%'};return _0x3db590;})});}_0x3cfe28=_[_0x5a69('0x3b')]({},_0x3cfe28,_0x5ed1ec['options']);return _0x429e73[_0x5a69('0x4b')](_0x3cfe28);}})[_0x5a69('0x25')](function(_0x46d57d){if(_0x46d57d){_0x53e3d7=_0x46d57d[_0x5a69('0x34')];if(!_0x5ed1ec['query'][_0x5a69('0x35')](_0x5a69('0x36'))){_0x3cfe28[_0x5a69('0x1c')]=qs[_0x5a69('0x1c')](_0x5ed1ec[_0x5a69('0x2e')][_0x5a69('0x1c')]);_0x3cfe28[_0x5a69('0x1d')]=qs['offset'](_0x5ed1ec['query'][_0x5a69('0x1d')]);}return _0x429e73[_0x5a69('0x4b')](_0x3cfe28);}})[_0x5a69('0x25')](function(_0x40ff46){if(_0x40ff46){return _0x40ff46?{'count':_0x53e3d7,'rows':_0x40ff46}:null;}})[_0x5a69('0x25')](respondWithResult(_0x15ee7c,null))[_0x5a69('0x43')](handleError(_0x15ee7c,null));};exports[_0x5a69('0x4d')]=function(_0x5abd7d,_0x392696,_0x106b6d){var _0x47712f={};var _0x1ad4a6={};var _0x473985;var _0xef6290;return db[_0x5a69('0x3f')][_0x5a69('0x4c')]({'where':{'id':_0x5abd7d[_0x5a69('0x45')]['id']}})[_0x5a69('0x25')](handleEntityNotFound(_0x392696,null))['then'](function(_0x57f63c){if(_0x57f63c){_0x473985=_0x57f63c;_0x1ad4a6[_0x5a69('0x32')]=_[_0x5a69('0x46')](db['FreshdeskField'][_0x5a69('0x2b')]);_0x1ad4a6[_0x5a69('0x2e')]=_['keys'](_0x5abd7d[_0x5a69('0x2e')]);_0x1ad4a6[_0x5a69('0x2f')]=_['intersection'](_0x1ad4a6['model'],_0x1ad4a6[_0x5a69('0x2e')]);_0x47712f[_0x5a69('0x31')]=_[_0x5a69('0x30')](_0x1ad4a6[_0x5a69('0x32')],qs[_0x5a69('0x33')](_0x5abd7d['query']['fields']));_0x47712f['attributes']=_0x47712f['attributes']['length']?_0x47712f[_0x5a69('0x31')]:_0x1ad4a6[_0x5a69('0x32')];_0x47712f[_0x5a69('0x37')]=qs[_0x5a69('0x38')](_0x5abd7d[_0x5a69('0x2e')][_0x5a69('0x38')]);_0x47712f[_0x5a69('0x39')]=qs['filters'](_['pick'](_0x5abd7d['query'],_0x1ad4a6['filters']));if(_0x5abd7d[_0x5a69('0x2e')][_0x5a69('0x3d')]){_0x47712f[_0x5a69('0x39')]=_['merge'](_0x47712f[_0x5a69('0x39')],{'$or':_[_0x5a69('0x2a')](_0x47712f[_0x5a69('0x31')],function(_0x5c843c){var _0x2f697a={};_0x2f697a[_0x5c843c]={'$like':'%'+_0x5abd7d[_0x5a69('0x2e')]['filter']+'%'};return _0x2f697a;})});}_0x47712f=_[_0x5a69('0x3b')]({},_0x47712f,_0x5abd7d[_0x5a69('0x3e')]);return _0x473985[_0x5a69('0x4d')](_0x47712f);}})[_0x5a69('0x25')](function(_0x112b9d){if(_0x112b9d){_0xef6290=_0x112b9d[_0x5a69('0x34')];if(!_0x5abd7d['query'][_0x5a69('0x35')](_0x5a69('0x36'))){_0x47712f[_0x5a69('0x1c')]=qs['limit'](_0x5abd7d[_0x5a69('0x2e')]['limit']);_0x47712f[_0x5a69('0x1d')]=qs[_0x5a69('0x1d')](_0x5abd7d['query'][_0x5a69('0x1d')]);}return _0x473985['getSubjects'](_0x47712f);}})[_0x5a69('0x25')](function(_0x59d309){if(_0x59d309){return _0x59d309?{'count':_0xef6290,'rows':_0x59d309}:null;}})['then'](respondWithResult(_0x392696,null))[_0x5a69('0x43')](handleError(_0x392696,null));};exports['getDescriptions']=function(_0x624f35,_0x5613cc,_0x1a2b33){var _0x3bac5a={};var _0x569c56={};var _0x1c655c;var _0x1dee96;return db['FreshdeskConfiguration'][_0x5a69('0x4c')]({'where':{'id':_0x624f35[_0x5a69('0x45')]['id']}})[_0x5a69('0x25')](handleEntityNotFound(_0x5613cc,null))[_0x5a69('0x25')](function(_0x17eacd){if(_0x17eacd){_0x1c655c=_0x17eacd;_0x569c56[_0x5a69('0x32')]=_[_0x5a69('0x46')](db[_0x5a69('0x4e')][_0x5a69('0x2b')]);_0x569c56[_0x5a69('0x2e')]=_[_0x5a69('0x46')](_0x624f35['query']);_0x569c56[_0x5a69('0x2f')]=_[_0x5a69('0x30')](_0x569c56[_0x5a69('0x32')],_0x569c56['query']);_0x3bac5a['attributes']=_[_0x5a69('0x30')](_0x569c56[_0x5a69('0x32')],qs['fields'](_0x624f35[_0x5a69('0x2e')][_0x5a69('0x33')]));_0x3bac5a[_0x5a69('0x31')]=_0x3bac5a[_0x5a69('0x31')]['length']?_0x3bac5a[_0x5a69('0x31')]:_0x569c56[_0x5a69('0x32')];_0x3bac5a[_0x5a69('0x37')]=qs['sort'](_0x624f35[_0x5a69('0x2e')]['sort']);_0x3bac5a[_0x5a69('0x39')]=qs[_0x5a69('0x2f')](_[_0x5a69('0x3a')](_0x624f35[_0x5a69('0x2e')],_0x569c56[_0x5a69('0x2f')]));if(_0x624f35['query']['filter']){_0x3bac5a[_0x5a69('0x39')]=_[_0x5a69('0x3b')](_0x3bac5a['where'],{'$or':_['map'](_0x3bac5a[_0x5a69('0x31')],function(_0x3f6eed){var _0x45b2d4={};_0x45b2d4[_0x3f6eed]={'$like':'%'+_0x624f35['query'][_0x5a69('0x3d')]+'%'};return _0x45b2d4;})});}_0x3bac5a=_[_0x5a69('0x3b')]({},_0x3bac5a,_0x624f35[_0x5a69('0x3e')]);return _0x1c655c[_0x5a69('0x4f')](_0x3bac5a);}})[_0x5a69('0x25')](function(_0x468dc5){if(_0x468dc5){_0x1dee96=_0x468dc5[_0x5a69('0x34')];if(!_0x624f35['query'][_0x5a69('0x35')](_0x5a69('0x36'))){_0x3bac5a['limit']=qs[_0x5a69('0x1c')](_0x624f35[_0x5a69('0x2e')][_0x5a69('0x1c')]);_0x3bac5a[_0x5a69('0x1d')]=qs[_0x5a69('0x1d')](_0x624f35[_0x5a69('0x2e')]['offset']);}return _0x1c655c['getDescriptions'](_0x3bac5a);}})[_0x5a69('0x25')](function(_0x2fcc3b){if(_0x2fcc3b){return _0x2fcc3b?{'count':_0x1dee96,'rows':_0x2fcc3b}:null;}})[_0x5a69('0x25')](respondWithResult(_0x5613cc,null))[_0x5a69('0x43')](handleError(_0x5613cc,null));};exports[_0x5a69('0x50')]=function(_0x556603,_0x4735c6,_0x2556fb){var _0x3915f5={};var _0x2d5001={};var _0x3cbb42;var _0x3a7d67;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x556603['params']['id']}})[_0x5a69('0x25')](handleEntityNotFound(_0x4735c6,null))[_0x5a69('0x25')](function(_0x13fa87){if(_0x13fa87){_0x3cbb42=_0x13fa87;_0x2d5001[_0x5a69('0x32')]=_[_0x5a69('0x46')](db[_0x5a69('0x51')]['rawAttributes']);_0x2d5001[_0x5a69('0x2e')]=_[_0x5a69('0x46')](_0x556603[_0x5a69('0x2e')]);_0x2d5001['filters']=_['intersection'](_0x2d5001[_0x5a69('0x32')],_0x2d5001[_0x5a69('0x2e')]);_0x3915f5[_0x5a69('0x31')]=_['intersection'](_0x2d5001[_0x5a69('0x32')],qs[_0x5a69('0x33')](_0x556603['query'][_0x5a69('0x33')]));_0x3915f5['attributes']=_0x3915f5['attributes'][_0x5a69('0x34')]?_0x3915f5[_0x5a69('0x31')]:_0x2d5001[_0x5a69('0x32')];_0x3915f5[_0x5a69('0x37')]=qs[_0x5a69('0x38')](_0x556603['query'][_0x5a69('0x38')]);_0x3915f5[_0x5a69('0x39')]=qs['filters'](_['pick'](_0x556603['query'],_0x2d5001['filters']));if(_0x556603[_0x5a69('0x2e')][_0x5a69('0x3d')]){_0x3915f5['where']=_['merge'](_0x3915f5[_0x5a69('0x39')],{'$or':_[_0x5a69('0x2a')](_0x3915f5[_0x5a69('0x31')],function(_0x516d7d){var _0x8ae6c8={};_0x8ae6c8[_0x516d7d]={'$like':'%'+_0x556603[_0x5a69('0x2e')]['filter']+'%'};return _0x8ae6c8;})});}_0x3915f5=_[_0x5a69('0x3b')]({},_0x3915f5,_0x556603[_0x5a69('0x3e')]);return _0x3cbb42[_0x5a69('0x50')](_0x3915f5);}})[_0x5a69('0x25')](function(_0x55ad4c){if(_0x55ad4c){_0x3a7d67=_0x55ad4c['length'];if(!_0x556603[_0x5a69('0x2e')][_0x5a69('0x35')](_0x5a69('0x36'))){_0x3915f5['limit']=qs[_0x5a69('0x1c')](_0x556603[_0x5a69('0x2e')][_0x5a69('0x1c')]);_0x3915f5[_0x5a69('0x1d')]=qs[_0x5a69('0x1d')](_0x556603[_0x5a69('0x2e')]['offset']);}return _0x3cbb42[_0x5a69('0x50')](_0x3915f5);}})[_0x5a69('0x25')](function(_0x118caf){if(_0x118caf){return _0x118caf?{'count':_0x3a7d67,'rows':_0x118caf}:null;}})[_0x5a69('0x25')](respondWithResult(_0x4735c6,null))['catch'](handleError(_0x4735c6,null));};exports[_0x5a69('0x52')]=function(_0x174823,_0x3a08d9,_0x473df4){if(_0x174823['body']['id']){delete _0x174823[_0x5a69('0x49')]['id'];}return db[_0x5a69('0x3f')]['findOne']({'where':{'id':_0x174823[_0x5a69('0x45')]['id']}})[_0x5a69('0x25')](handleEntityNotFound(_0x3a08d9,null))[_0x5a69('0x25')](function(_0x4d1687){if(_0x4d1687){return _0x4d1687[_0x5a69('0x52')](_0x174823[_0x5a69('0x49')][_0x5a69('0x53')]||[]);}return null;})[_0x5a69('0x25')](respondWithResult(_0x3a08d9,null))[_0x5a69('0x43')](handleError(_0x3a08d9,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 59d0e92..88cb68b 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 _0x1020=['bluebird','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash','../../config/logger','api','moment'];(function(_0x91e3cb,_0x356cbd){var _0x178182=function(_0x241946){while(--_0x241946){_0x91e3cb['push'](_0x91e3cb['shift']());}};_0x178182(++_0x356cbd);}(_0x1020,0x75));var _0x0102=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0x1020[_0x393d69];return _0x3cee37;};'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('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0102('0x5'));var config=require(_0x0102('0x6'));var attributes=require(_0x0102('0x7'));module[_0x0102('0x8')]=function(_0x13ba9d,_0x5490c7){return _0x13ba9d[_0x0102('0x9')](_0x0102('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bee=['../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x332a4f,_0x2a5f94){var _0x41c8fd=function(_0x4a0f27){while(--_0x4a0f27){_0x332a4f['push'](_0x332a4f['shift']());}};_0x41c8fd(++_0x2a5f94);}(_0x9bee,0xd1));var _0xe9be=function(_0x1f57fd,_0x32c183){_0x1f57fd=_0x1f57fd-0x0;var _0x236734=_0x9bee[_0x1f57fd];return _0x236734;};'use strict';var _=require(_0xe9be('0x0'));var util=require(_0xe9be('0x1'));var logger=require(_0xe9be('0x2'))(_0xe9be('0x3'));var moment=require(_0xe9be('0x4'));var BPromise=require(_0xe9be('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe9be('0x6'));var config=require(_0xe9be('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xe9be('0x8')]=function(_0x3f7128,_0x5e31a8){return _0x3f7128[_0xe9be('0x9')](_0xe9be('0xa'),attributes,{'tableName':_0xe9be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index c8e8860..0847a9d 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 _0x1cee=['debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x2e2bd9,_0x3c365e){var _0x3a8512=function(_0x56d599){while(--_0x56d599){_0x2e2bd9['push'](_0x2e2bd9['shift']());}};_0x3a8512(++_0x3c365e);}(_0x1cee,0x16f));var _0xe1ce=function(_0x2850ef,_0x2799aa){_0x2850ef=_0x2850ef-0x0;var _0x30eee8=_0x1cee[_0x2850ef];return _0x30eee8;};'use strict';var _=require(_0xe1ce('0x0'));var util=require(_0xe1ce('0x1'));var moment=require(_0xe1ce('0x2'));var BPromise=require(_0xe1ce('0x3'));var rs=require(_0xe1ce('0x4'));var fs=require('fs');var Redis=require(_0xe1ce('0x5'));var db=require(_0xe1ce('0x6'))['db'];var utils=require(_0xe1ce('0x7'));var logger=require(_0xe1ce('0x8'))(_0xe1ce('0x9'));var config=require(_0xe1ce('0xa'));var jayson=require(_0xe1ce('0xb'));var client=jayson[_0xe1ce('0xc')][_0xe1ce('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5cc928,_0x1fe903,_0x1da87b){return new BPromise(function(_0x23aa93,_0x2597e1){return client[_0xe1ce('0xe')](_0x5cc928,_0x1da87b)[_0xe1ce('0xf')](function(_0x1de890){logger['info'](_0xe1ce('0x10'),_0x1fe903,'request\x20sent');logger[_0xe1ce('0x11')](_0xe1ce('0x12'),_0x1fe903,_0xe1ce('0x13'),JSON[_0xe1ce('0x14')](_0x1de890));if(_0x1de890[_0xe1ce('0x15')]){if(_0x1de890[_0xe1ce('0x15')]['code']===0x1f4){logger[_0xe1ce('0x15')](_0xe1ce('0x10'),_0x1fe903,_0x1de890['error']['message']);return _0x2597e1(_0x1de890[_0xe1ce('0x15')][_0xe1ce('0x16')]);}logger['error'](_0xe1ce('0x10'),_0x1fe903,_0x1de890[_0xe1ce('0x15')][_0xe1ce('0x16')]);return _0x23aa93(_0x1de890[_0xe1ce('0x15')][_0xe1ce('0x16')]);}else{logger['info'](_0xe1ce('0x10'),_0x1fe903,'request\x20sent');_0x23aa93(_0x1de890['result']['message']);}})[_0xe1ce('0x17')](function(_0x40c4fe){logger[_0xe1ce('0x15')](_0xe1ce('0x10'),_0x1fe903,_0x40c4fe);_0x2597e1(_0x40c4fe);});});} \ No newline at end of file +var _0x02a3=['stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x17968b,_0xd64399){var _0x4eabd9=function(_0x33d186){while(--_0x33d186){_0x17968b['push'](_0x17968b['shift']());}};_0x4eabd9(++_0xd64399);}(_0x02a3,0x77));var _0x302a=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x02a3[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require(_0x302a('0x0'));var util=require(_0x302a('0x1'));var moment=require(_0x302a('0x2'));var BPromise=require(_0x302a('0x3'));var rs=require(_0x302a('0x4'));var fs=require('fs');var Redis=require(_0x302a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x302a('0x6'));var logger=require(_0x302a('0x7'))('rpc');var config=require(_0x302a('0x8'));var jayson=require(_0x302a('0x9'));var client=jayson[_0x302a('0xa')][_0x302a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x430cc1,_0x1478a9,_0x348baa){return new BPromise(function(_0xdc11c3,_0x95b966){return client[_0x302a('0xc')](_0x430cc1,_0x348baa)[_0x302a('0xd')](function(_0x110790){logger[_0x302a('0xe')](_0x302a('0xf'),_0x1478a9,'request\x20sent');logger[_0x302a('0x10')](_0x302a('0x11'),_0x1478a9,_0x302a('0x12'),JSON[_0x302a('0x13')](_0x110790));if(_0x110790[_0x302a('0x14')]){if(_0x110790[_0x302a('0x14')]['code']===0x1f4){logger['error'](_0x302a('0xf'),_0x1478a9,_0x110790[_0x302a('0x14')][_0x302a('0x15')]);return _0x95b966(_0x110790['error']['message']);}logger[_0x302a('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1478a9,_0x110790[_0x302a('0x14')]['message']);return _0xdc11c3(_0x110790[_0x302a('0x14')]['message']);}else{logger[_0x302a('0xe')](_0x302a('0xf'),_0x1478a9,_0x302a('0x12'));_0xdc11c3(_0x110790[_0x302a('0x16')][_0x302a('0x15')]);}})['catch'](function(_0x3c5b44){logger[_0x302a('0x14')](_0x302a('0xf'),_0x1478a9,_0x3c5b44);_0x95b966(_0x3c5b44);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index f870ffc..9f76918 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 _0x1585=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer'];(function(_0x567312,_0x33020e){var _0xea4df1=function(_0x4a9ada){while(--_0x4a9ada){_0x567312['push'](_0x567312['shift']());}};_0xea4df1(++_0x33020e);}(_0x1585,0x142));var _0x5158=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1585[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x5158('0x0'));var util=require('util');var path=require(_0x5158('0x1'));var timeout=require(_0x5158('0x2'));var express=require('express');var router=express[_0x5158('0x3')]();var fs_extra=require(_0x5158('0x4'));var auth=require(_0x5158('0x5'));var interaction=require(_0x5158('0x6'));var config=require(_0x5158('0x7'));var controller=require(_0x5158('0x8'));router[_0x5158('0x9')]('/',auth[_0x5158('0xa')](),controller[_0x5158('0xb')]);router[_0x5158('0x9')](_0x5158('0xc'),auth[_0x5158('0xa')](),controller[_0x5158('0xd')]);router[_0x5158('0xe')]('/',auth[_0x5158('0xa')](),controller[_0x5158('0xf')]);router[_0x5158('0x10')](_0x5158('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5158('0xc'),auth[_0x5158('0xa')](),controller[_0x5158('0x11')]);module[_0x5158('0x12')]=router; \ No newline at end of file +var _0x38f3=['show','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','index','get','/:id','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x38f3,0x96));var _0x338f=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x38f3[_0xf2628e];return _0x13863a;};'use strict';var multer=require(_0x338f('0x0'));var util=require(_0x338f('0x1'));var path=require(_0x338f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x338f('0x3')]();var fs_extra=require(_0x338f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x338f('0x5'));var config=require(_0x338f('0x6'));var controller=require(_0x338f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x338f('0x8')]);router[_0x338f('0x9')](_0x338f('0xa'),auth[_0x338f('0xb')](),controller[_0x338f('0xc')]);router['post']('/',auth[_0x338f('0xb')](),controller['create']);router[_0x338f('0xd')](_0x338f('0xa'),auth[_0x338f('0xb')](),controller[_0x338f('0xe')]);router[_0x338f('0xf')]('/:id',auth[_0x338f('0xb')](),controller[_0x338f('0x10')]);module[_0x338f('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 303c57a..1fc69a4 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 _0x2bc2=['customVariable','picklist','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x53f2d7,_0x24db99){var _0x3478a=function(_0x47b65c){while(--_0x47b65c){_0x53f2d7['push'](_0x53f2d7['shift']());}};_0x3478a(++_0x24db99);}(_0x2bc2,0x1b4));var _0x22bc=function(_0x430c14,_0x3afe0b){_0x430c14=_0x430c14-0x0;var _0xbceb21=_0x2bc2[_0x430c14];return _0xbceb21;};'use strict';var Sequelize=require('sequelize');module[_0x22bc('0x0')]={'type':{'type':Sequelize[_0x22bc('0x1')](_0x22bc('0x2'),_0x22bc('0x3'),_0x22bc('0x4'),'keyValue',_0x22bc('0x5')),'defaultValue':_0x22bc('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x22bc('0x6')]},'keyType':{'type':Sequelize[_0x22bc('0x1')](_0x22bc('0x2'),'variable',_0x22bc('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x22bc('0x6')]},'nameField':{'type':Sequelize[_0x22bc('0x6')]},'customField':{'type':Sequelize[_0x22bc('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x22bc('0x6')]}}; \ No newline at end of file +var _0xf928=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf928,0x179));var _0x8f92=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf928[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x8f92('0x0'));module[_0x8f92('0x1')]={'type':{'type':Sequelize[_0x8f92('0x2')](_0x8f92('0x3'),_0x8f92('0x4'),_0x8f92('0x5'),_0x8f92('0x6'),_0x8f92('0x7')),'defaultValue':_0x8f92('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8f92('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x8f92('0x3'),_0x8f92('0x4'),_0x8f92('0x5'))},'keyContent':{'type':Sequelize[_0x8f92('0x8')]},'idField':{'type':Sequelize[_0x8f92('0x8')]},'nameField':{'type':Sequelize[_0x8f92('0x8')]},'customField':{'type':Sequelize[_0x8f92('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index ba77256..32f867f 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 _0x777d=['send','index','map','FreshdeskField','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','limit','sort','pick','merge','where','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','ejs','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','count','offset','Content-Range','apply','update','then','destroy','error','name'];(function(_0x39b0f2,_0x51d267){var _0x11850d=function(_0x85acdf){while(--_0x85acdf){_0x39b0f2['push'](_0x39b0f2['shift']());}};_0x11850d(++_0x51d267);}(_0x777d,0xe9));var _0xd777=function(_0x4e4519,_0x392ae){_0x4e4519=_0x4e4519-0x0;var _0x340044=_0x777d[_0x4e4519];return _0x340044;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd777('0x0'));var zipdir=require(_0xd777('0x1'));var jsonpatch=require(_0xd777('0x2'));var rp=require('request-promise');var moment=require(_0xd777('0x3'));var BPromise=require(_0xd777('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd777('0x5'));var csv=require('to-csv');var ejs=require(_0xd777('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd777('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd777('0x8'));var toCsv=require(_0xd777('0x9'));var querystring=require(_0xd777('0xa'));var Papa=require(_0xd777('0xb'));var Redis=require(_0xd777('0xc'));var authService=require(_0xd777('0xd'));var qs=require(_0xd777('0xe'));var as=require(_0xd777('0xf'));var hardwareService=require(_0xd777('0x10'));var logger=require(_0xd777('0x11'))(_0xd777('0x12'));var utils=require(_0xd777('0x13'));var config=require(_0xd777('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25f574,_0x560778){_0x560778=_0x560778||0xcc;return function(_0x2cc3e7){if(_0x2cc3e7){return _0x25f574[_0xd777('0x15')](_0x560778);}return _0x25f574[_0xd777('0x16')](_0x560778)[_0xd777('0x17')]();};}function respondWithResult(_0x2ac82f,_0x5d0ded){_0x5d0ded=_0x5d0ded||0xc8;return function(_0x84141c){if(_0x84141c){return _0x2ac82f['status'](_0x5d0ded)[_0xd777('0x18')](_0x84141c);}};}function respondWithFilteredResult(_0x2cd014,_0x1e5ecb){return function(_0x1ef016){if(_0x1ef016){var _0x25e3f2=typeof _0x1e5ecb['offset']===_0xd777('0x19')&&typeof _0x1e5ecb['limit']===_0xd777('0x19');var _0x4dcaed=_0x1ef016[_0xd777('0x1a')];var _0x386f1a=_0x25e3f2?0x0:_0x1e5ecb[_0xd777('0x1b')];var _0x13b63b=_0x25e3f2?_0x1ef016[_0xd777('0x1a')]:_0x1e5ecb[_0xd777('0x1b')]+_0x1e5ecb['limit'];var _0x4d6100;if(_0x13b63b>=_0x4dcaed){_0x13b63b=_0x4dcaed;_0x4d6100=0xc8;}else{_0x4d6100=0xce;}_0x2cd014[_0xd777('0x16')](_0x4d6100);return _0x2cd014['set'](_0xd777('0x1c'),_0x386f1a+'-'+_0x13b63b+'/'+_0x4dcaed)['json'](_0x1ef016);}return null;};}function patchUpdates(_0x58a079){return function(_0x5b2204){try{jsonpatch[_0xd777('0x1d')](_0x5b2204,_0x58a079,!![]);}catch(_0x4e53ed){return BPromise['reject'](_0x4e53ed);}return _0x5b2204['save']();};}function saveUpdates(_0x48d18c,_0x55b975){return function(_0x8cfb5a){if(_0x8cfb5a){return _0x8cfb5a[_0xd777('0x1e')](_0x48d18c)[_0xd777('0x1f')](function(_0x343405){return _0x343405;});}return null;};}function removeEntity(_0xfebc2f,_0x33c3d4){return function(_0x2ff8d3){if(_0x2ff8d3){return _0x2ff8d3[_0xd777('0x20')]()[_0xd777('0x1f')](function(){_0xfebc2f[_0xd777('0x16')](0xcc)[_0xd777('0x17')]();});}};}function handleEntityNotFound(_0x56af61,_0x373646){return function(_0x63e5c1){if(!_0x63e5c1){_0x56af61[_0xd777('0x15')](0x194);}return _0x63e5c1;};}function handleError(_0x15f1fd,_0x184ff6){_0x184ff6=_0x184ff6||0x1f4;return function(_0x5e32de){logger[_0xd777('0x21')](_0x5e32de['stack']);if(_0x5e32de['name']){delete _0x5e32de[_0xd777('0x22')];}_0x15f1fd[_0xd777('0x16')](_0x184ff6)[_0xd777('0x23')](_0x5e32de);};}exports[_0xd777('0x24')]=function(_0x4c941c,_0x453b45){var _0x141baa={},_0x4f93eb={},_0x1975e2={'count':0x0,'rows':[]};var _0xb63cf7=_[_0xd777('0x25')](db[_0xd777('0x26')][_0xd777('0x27')],function(_0x508587){return{'name':_0x508587[_0xd777('0x28')],'type':_0x508587['type']['key']};});_0x4f93eb[_0xd777('0x29')]=_[_0xd777('0x25')](_0xb63cf7,_0xd777('0x22'));_0x4f93eb[_0xd777('0x2a')]=_['keys'](_0x4c941c['query']);_0x4f93eb[_0xd777('0x2b')]=_[_0xd777('0x2c')](_0x4f93eb[_0xd777('0x29')],_0x4f93eb[_0xd777('0x2a')]);_0x141baa[_0xd777('0x2d')]=_[_0xd777('0x2c')](_0x4f93eb['model'],qs['fields'](_0x4c941c[_0xd777('0x2a')][_0xd777('0x2e')]));_0x141baa[_0xd777('0x2d')]=_0x141baa[_0xd777('0x2d')][_0xd777('0x2f')]?_0x141baa[_0xd777('0x2d')]:_0x4f93eb[_0xd777('0x29')];if(!_0x4c941c[_0xd777('0x2a')]['hasOwnProperty']('nolimit')){_0x141baa[_0xd777('0x30')]=qs['limit'](_0x4c941c[_0xd777('0x2a')][_0xd777('0x30')]);_0x141baa[_0xd777('0x1b')]=qs[_0xd777('0x1b')](_0x4c941c['query'][_0xd777('0x1b')]);}_0x141baa['order']=qs[_0xd777('0x31')](_0x4c941c['query']['sort']);_0x141baa['where']=qs['filters'](_[_0xd777('0x32')](_0x4c941c[_0xd777('0x2a')],_0x4f93eb[_0xd777('0x2b')]),_0xb63cf7);if(_0x4c941c['query']['filter']){_0x141baa['where']=_[_0xd777('0x33')](_0x141baa[_0xd777('0x34')],{'$or':_[_0xd777('0x25')](_0xb63cf7,function(_0x471bfd){if(_0x471bfd[_0xd777('0x35')]!==_0xd777('0x36')){var _0xf496bb={};_0xf496bb[_0x471bfd[_0xd777('0x22')]]={'$like':'%'+_0x4c941c[_0xd777('0x2a')][_0xd777('0x37')]+'%'};return _0xf496bb;}})});}_0x141baa=_['merge']({},_0x141baa,_0x4c941c[_0xd777('0x38')]);var _0x11a5f7={'where':_0x141baa[_0xd777('0x34')]};return db[_0xd777('0x26')][_0xd777('0x1a')](_0x11a5f7)[_0xd777('0x1f')](function(_0x3356c2){_0x1975e2[_0xd777('0x1a')]=_0x3356c2;if(_0x4c941c[_0xd777('0x2a')][_0xd777('0x39')]){_0x141baa[_0xd777('0x3a')]=[{'all':!![]}];}return db[_0xd777('0x26')]['findAll'](_0x141baa);})[_0xd777('0x1f')](function(_0x52b3d0){_0x1975e2[_0xd777('0x3b')]=_0x52b3d0;return _0x1975e2;})[_0xd777('0x1f')](respondWithFilteredResult(_0x453b45,_0x141baa))[_0xd777('0x3c')](handleError(_0x453b45,null));};exports[_0xd777('0x3d')]=function(_0x149329,_0x11d654){var _0x4af057={'raw':!![],'where':{'id':_0x149329[_0xd777('0x3e')]['id']}},_0x3dd8af={};_0x3dd8af[_0xd777('0x29')]=_['keys'](db[_0xd777('0x26')][_0xd777('0x27')]);_0x3dd8af[_0xd777('0x2a')]=_[_0xd777('0x3f')](_0x149329[_0xd777('0x2a')]);_0x3dd8af[_0xd777('0x2b')]=_[_0xd777('0x2c')](_0x3dd8af['model'],_0x3dd8af[_0xd777('0x2a')]);_0x4af057[_0xd777('0x2d')]=_['intersection'](_0x3dd8af['model'],qs[_0xd777('0x2e')](_0x149329[_0xd777('0x2a')][_0xd777('0x2e')]));_0x4af057[_0xd777('0x2d')]=_0x4af057[_0xd777('0x2d')][_0xd777('0x2f')]?_0x4af057[_0xd777('0x2d')]:_0x3dd8af[_0xd777('0x29')];if(_0x149329[_0xd777('0x2a')][_0xd777('0x39')]){_0x4af057[_0xd777('0x3a')]=[{'all':!![]}];}_0x4af057=_['merge']({},_0x4af057,_0x149329[_0xd777('0x38')]);return db[_0xd777('0x26')][_0xd777('0x40')](_0x4af057)['then'](handleEntityNotFound(_0x11d654,null))['then'](respondWithResult(_0x11d654,null))[_0xd777('0x3c')](handleError(_0x11d654,null));};exports[_0xd777('0x41')]=function(_0x26d5d7,_0x281d1d){return db[_0xd777('0x26')][_0xd777('0x41')](_0x26d5d7[_0xd777('0x42')],{})[_0xd777('0x1f')](respondWithResult(_0x281d1d,0xc9))['catch'](handleError(_0x281d1d,null));};exports[_0xd777('0x1e')]=function(_0x559232,_0x4c059d){if(_0x559232[_0xd777('0x42')]['id']){delete _0x559232[_0xd777('0x42')]['id'];}return db['FreshdeskField'][_0xd777('0x40')]({'where':{'id':_0x559232[_0xd777('0x3e')]['id']}})[_0xd777('0x1f')](handleEntityNotFound(_0x4c059d,null))[_0xd777('0x1f')](saveUpdates(_0x559232['body'],null))['then'](respondWithResult(_0x4c059d,null))[_0xd777('0x3c')](handleError(_0x4c059d,null));};exports['destroy']=function(_0x45b806,_0x24779c){return db[_0xd777('0x26')][_0xd777('0x40')]({'where':{'id':_0x45b806[_0xd777('0x3e')]['id']}})['then'](handleEntityNotFound(_0x24779c,null))[_0xd777('0x1f')](removeEntity(_0x24779c,null))[_0xd777('0x3c')](handleError(_0x24779c,null));}; \ No newline at end of file +var _0xe605=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x3b32b1,_0x3e59bf){var _0x2506d0=function(_0x3d5a91){while(--_0x3d5a91){_0x3b32b1['push'](_0x3b32b1['shift']());}};_0x2506d0(++_0x3e59bf);}(_0xe605,0x92));var _0x5e60=function(_0xc2e770,_0x246bd3){_0xc2e770=_0xc2e770-0x0;var _0x548d49=_0xe605[_0xc2e770];return _0x548d49;};'use strict';var emlformat=require(_0x5e60('0x0'));var rimraf=require(_0x5e60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e60('0x2'));var rp=require(_0x5e60('0x3'));var moment=require(_0x5e60('0x4'));var BPromise=require(_0x5e60('0x5'));var Mustache=require(_0x5e60('0x6'));var util=require(_0x5e60('0x7'));var path=require(_0x5e60('0x8'));var sox=require(_0x5e60('0x9'));var csv=require(_0x5e60('0xa'));var ejs=require(_0x5e60('0xb'));var fs=require('fs');var fs_extra=require(_0x5e60('0xc'));var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var licenseUtil=require(_0x5e60('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x371df7,_0x178782){_0x178782=_0x178782||0xcc;return function(_0x1f4e14){if(_0x1f4e14){return _0x371df7[_0x5e60('0x19')](_0x178782);}return _0x371df7[_0x5e60('0x1a')](_0x178782)[_0x5e60('0x1b')]();};}function respondWithResult(_0x4fd10e,_0x209adb){_0x209adb=_0x209adb||0xc8;return function(_0x45304f){if(_0x45304f){return _0x4fd10e[_0x5e60('0x1a')](_0x209adb)[_0x5e60('0x1c')](_0x45304f);}};}function respondWithFilteredResult(_0x5b028f,_0x20af5f){return function(_0x529ffe){if(_0x529ffe){var _0x1ffd77=typeof _0x20af5f[_0x5e60('0x1d')]==='undefined'&&typeof _0x20af5f[_0x5e60('0x1e')]===_0x5e60('0x1f');var _0xaa7d05=_0x529ffe[_0x5e60('0x20')];var _0x5c485d=_0x1ffd77?0x0:_0x20af5f[_0x5e60('0x1d')];var _0x22d718=_0x1ffd77?_0x529ffe['count']:_0x20af5f[_0x5e60('0x1d')]+_0x20af5f[_0x5e60('0x1e')];var _0x17c630;if(_0x22d718>=_0xaa7d05){_0x22d718=_0xaa7d05;_0x17c630=0xc8;}else{_0x17c630=0xce;}_0x5b028f[_0x5e60('0x1a')](_0x17c630);return _0x5b028f[_0x5e60('0x21')](_0x5e60('0x22'),_0x5c485d+'-'+_0x22d718+'/'+_0xaa7d05)[_0x5e60('0x1c')](_0x529ffe);}return null;};}function patchUpdates(_0x524c93){return function(_0x3282e4){try{jsonpatch[_0x5e60('0x23')](_0x3282e4,_0x524c93,!![]);}catch(_0x228f13){return BPromise['reject'](_0x228f13);}return _0x3282e4[_0x5e60('0x24')]();};}function saveUpdates(_0x5d77dd,_0x376069){return function(_0x1a44e5){if(_0x1a44e5){return _0x1a44e5[_0x5e60('0x25')](_0x5d77dd)[_0x5e60('0x26')](function(_0x34e98d){return _0x34e98d;});}return null;};}function removeEntity(_0x2a499e,_0x2636f1){return function(_0x5d2c03){if(_0x5d2c03){return _0x5d2c03[_0x5e60('0x27')]()[_0x5e60('0x26')](function(){_0x2a499e[_0x5e60('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45cb62,_0x56e3a5){return function(_0x2d8aac){if(!_0x2d8aac){_0x45cb62[_0x5e60('0x19')](0x194);}return _0x2d8aac;};}function handleError(_0x4a0dbc,_0x3bedea){_0x3bedea=_0x3bedea||0x1f4;return function(_0x5712f7){logger[_0x5e60('0x28')](_0x5712f7[_0x5e60('0x29')]);if(_0x5712f7['name']){delete _0x5712f7[_0x5e60('0x2a')];}_0x4a0dbc[_0x5e60('0x1a')](_0x3bedea)['send'](_0x5712f7);};}exports[_0x5e60('0x2b')]=function(_0xac9c7a,_0x52c97c){var _0x5431a8={},_0x52f668={},_0xf25956={'count':0x0,'rows':[]};var _0x235cc7=_[_0x5e60('0x2c')](db[_0x5e60('0x2d')][_0x5e60('0x2e')],function(_0x558197){return{'name':_0x558197[_0x5e60('0x2f')],'type':_0x558197[_0x5e60('0x30')]['key']};});_0x52f668[_0x5e60('0x31')]=_['map'](_0x235cc7,'name');_0x52f668[_0x5e60('0x32')]=_[_0x5e60('0x33')](_0xac9c7a[_0x5e60('0x32')]);_0x52f668[_0x5e60('0x34')]=_[_0x5e60('0x35')](_0x52f668[_0x5e60('0x31')],_0x52f668[_0x5e60('0x32')]);_0x5431a8[_0x5e60('0x36')]=_[_0x5e60('0x35')](_0x52f668[_0x5e60('0x31')],qs['fields'](_0xac9c7a[_0x5e60('0x32')]['fields']));_0x5431a8['attributes']=_0x5431a8[_0x5e60('0x36')][_0x5e60('0x37')]?_0x5431a8['attributes']:_0x52f668[_0x5e60('0x31')];if(!_0xac9c7a['query'][_0x5e60('0x38')](_0x5e60('0x39'))){_0x5431a8[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x1e')]);_0x5431a8[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0xac9c7a['query'][_0x5e60('0x1d')]);}_0x5431a8[_0x5e60('0x3a')]=qs[_0x5e60('0x3b')](_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x3b')]);_0x5431a8[_0x5e60('0x3c')]=qs[_0x5e60('0x34')](_['pick'](_0xac9c7a[_0x5e60('0x32')],_0x52f668[_0x5e60('0x34')]),_0x235cc7);if(_0xac9c7a['query']['filter']){_0x5431a8[_0x5e60('0x3c')]=_[_0x5e60('0x3d')](_0x5431a8[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x2c')](_0x235cc7,function(_0x31b900){if(_0x31b900['type']!==_0x5e60('0x3e')){var _0x413bf0={};_0x413bf0[_0x31b900[_0x5e60('0x2a')]]={'$like':'%'+_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x3f')]+'%'};return _0x413bf0;}})});}_0x5431a8=_[_0x5e60('0x3d')]({},_0x5431a8,_0xac9c7a[_0x5e60('0x40')]);var _0x54022a={'where':_0x5431a8[_0x5e60('0x3c')]};return db[_0x5e60('0x2d')]['count'](_0x54022a)['then'](function(_0x47a6df){_0xf25956[_0x5e60('0x20')]=_0x47a6df;if(_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x41')]){_0x5431a8[_0x5e60('0x42')]=[{'all':!![]}];}return db['FreshdeskField'][_0x5e60('0x43')](_0x5431a8);})[_0x5e60('0x26')](function(_0x4b6192){_0xf25956['rows']=_0x4b6192;return _0xf25956;})[_0x5e60('0x26')](respondWithFilteredResult(_0x52c97c,_0x5431a8))[_0x5e60('0x44')](handleError(_0x52c97c,null));};exports[_0x5e60('0x45')]=function(_0x38ff1d,_0x39ab09){var _0x3899ae={'raw':!![],'where':{'id':_0x38ff1d[_0x5e60('0x46')]['id']}},_0x2522d2={};_0x2522d2[_0x5e60('0x31')]=_['keys'](db[_0x5e60('0x2d')][_0x5e60('0x2e')]);_0x2522d2['query']=_[_0x5e60('0x33')](_0x38ff1d[_0x5e60('0x32')]);_0x2522d2[_0x5e60('0x34')]=_[_0x5e60('0x35')](_0x2522d2[_0x5e60('0x31')],_0x2522d2['query']);_0x3899ae[_0x5e60('0x36')]=_[_0x5e60('0x35')](_0x2522d2[_0x5e60('0x31')],qs[_0x5e60('0x47')](_0x38ff1d['query']['fields']));_0x3899ae['attributes']=_0x3899ae[_0x5e60('0x36')][_0x5e60('0x37')]?_0x3899ae[_0x5e60('0x36')]:_0x2522d2[_0x5e60('0x31')];if(_0x38ff1d[_0x5e60('0x32')][_0x5e60('0x41')]){_0x3899ae['include']=[{'all':!![]}];}_0x3899ae=_[_0x5e60('0x3d')]({},_0x3899ae,_0x38ff1d[_0x5e60('0x40')]);return db[_0x5e60('0x2d')][_0x5e60('0x48')](_0x3899ae)[_0x5e60('0x26')](handleEntityNotFound(_0x39ab09,null))[_0x5e60('0x26')](respondWithResult(_0x39ab09,null))[_0x5e60('0x44')](handleError(_0x39ab09,null));};exports['create']=function(_0x24c757,_0x3ed45d){return db[_0x5e60('0x2d')][_0x5e60('0x49')](_0x24c757[_0x5e60('0x4a')],{})[_0x5e60('0x26')](respondWithResult(_0x3ed45d,0xc9))[_0x5e60('0x44')](handleError(_0x3ed45d,null));};exports[_0x5e60('0x25')]=function(_0x1518bd,_0x350d6d){if(_0x1518bd[_0x5e60('0x4a')]['id']){delete _0x1518bd[_0x5e60('0x4a')]['id'];}return db[_0x5e60('0x2d')][_0x5e60('0x48')]({'where':{'id':_0x1518bd[_0x5e60('0x46')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x350d6d,null))[_0x5e60('0x26')](saveUpdates(_0x1518bd[_0x5e60('0x4a')],null))['then'](respondWithResult(_0x350d6d,null))['catch'](handleError(_0x350d6d,null));};exports[_0x5e60('0x27')]=function(_0x4d3588,_0x3525d){return db[_0x5e60('0x2d')][_0x5e60('0x48')]({'where':{'id':_0x4d3588[_0x5e60('0x46')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x3525d,null))[_0x5e60('0x26')](removeEntity(_0x3525d,null))['catch'](handleError(_0x3525d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index f4d8ddf..debeee4 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 _0x89c4=['int_freshdesk_fields','freshdesk_unique_index','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x89c4,0xc6));var _0x489c=function(_0x36cf39,_0x3d0dd5){_0x36cf39=_0x36cf39-0x0;var _0x43b0b9=_0x89c4[_0x36cf39];return _0x43b0b9;};'use strict';var _=require(_0x489c('0x0'));var util=require(_0x489c('0x1'));var logger=require(_0x489c('0x2'))(_0x489c('0x3'));var moment=require(_0x489c('0x4'));var BPromise=require(_0x489c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x489c('0x6'));var rimraf=require(_0x489c('0x7'));var config=require('../../config/environment');var attributes=require(_0x489c('0x8'));module[_0x489c('0x9')]=function(_0x7689d0,_0x3b6d2c){return _0x7689d0[_0x489c('0xa')](_0x489c('0xb'),attributes,{'tableName':_0x489c('0xc'),'paranoid':![],'indexes':[{'name':_0x489c('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1235=['freshdesk_unique_index','idField','FieldId','lodash','api','moment','bluebird','./intFreshdeskField.attributes','exports','define','FreshdeskField'];(function(_0x17b4c4,_0x164d06){var _0x242e88=function(_0x51d0b1){while(--_0x51d0b1){_0x17b4c4['push'](_0x17b4c4['shift']());}};_0x242e88(++_0x164d06);}(_0x1235,0x71));var _0x5123=function(_0x111b76,_0x40e786){_0x111b76=_0x111b76-0x0;var _0x3fe1f2=_0x1235[_0x111b76];return _0x3fe1f2;};'use strict';var _=require(_0x5123('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5123('0x1'));var moment=require(_0x5123('0x2'));var BPromise=require(_0x5123('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(_0x5123('0x4'));module[_0x5123('0x5')]=function(_0x1a11c3,_0xf007b2){return _0x1a11c3[_0x5123('0x6')](_0x5123('0x7'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x5123('0x8'),'fields':[_0x5123('0x9'),_0x5123('0xa')],'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 31a9784..6a1c965 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 _0x657b=['FreshdeskField,\x20%s,\x20%s','info','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4ea215,_0x59af43){var _0x317663=function(_0x49a228){while(--_0x49a228){_0x4ea215['push'](_0x4ea215['shift']());}};_0x317663(++_0x59af43);}(_0x657b,0xcc));var _0xb657=function(_0x430edb,_0x367bcb){_0x430edb=_0x430edb-0x0;var _0xd4186=_0x657b[_0x430edb];return _0xd4186;};'use strict';var _=require(_0xb657('0x0'));var util=require('util');var moment=require(_0xb657('0x1'));var BPromise=require(_0xb657('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb657('0x3'))['db'];var utils=require(_0xb657('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb657('0x5'));var jayson=require(_0xb657('0x6'));var client=jayson['client'][_0xb657('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x414bad,_0x2e446b,_0x20fba8){return new BPromise(function(_0x4744fd,_0x339cc6){return client[_0xb657('0x8')](_0x414bad,_0x20fba8)[_0xb657('0x9')](function(_0x2397c8){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x2e446b,_0xb657('0xa'));logger['debug'](_0xb657('0xb'),_0x2e446b,_0xb657('0xa'),JSON[_0xb657('0xc')](_0x2397c8));if(_0x2397c8[_0xb657('0xd')]){if(_0x2397c8['error'][_0xb657('0xe')]===0x1f4){logger[_0xb657('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x2e446b,_0x2397c8[_0xb657('0xd')][_0xb657('0xf')]);return _0x339cc6(_0x2397c8['error'][_0xb657('0xf')]);}logger[_0xb657('0xd')](_0xb657('0x10'),_0x2e446b,_0x2397c8[_0xb657('0xd')][_0xb657('0xf')]);return _0x4744fd(_0x2397c8[_0xb657('0xd')][_0xb657('0xf')]);}else{logger[_0xb657('0x11')](_0xb657('0x10'),_0x2e446b,_0xb657('0xa'));_0x4744fd(_0x2397c8[_0xb657('0x12')][_0xb657('0xf')]);}})[_0xb657('0x13')](function(_0x150f74){logger[_0xb657('0xd')](_0xb657('0x10'),_0x2e446b,_0x150f74);_0x339cc6(_0x150f74);});});} \ No newline at end of file +var _0x35e2=['FreshdeskField,\x20%s,\x20%s,\x20%s','error','FreshdeskField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent'];(function(_0x287b4f,_0x59146d){var _0x1165e1=function(_0x32cd75){while(--_0x32cd75){_0x287b4f['push'](_0x287b4f['shift']());}};_0x1165e1(++_0x59146d);}(_0x35e2,0x122));var _0x235e=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x35e2[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x235e('0x0'));var util=require(_0x235e('0x1'));var moment=require(_0x235e('0x2'));var BPromise=require(_0x235e('0x3'));var rs=require(_0x235e('0x4'));var fs=require('fs');var Redis=require(_0x235e('0x5'));var db=require(_0x235e('0x6'))['db'];var utils=require(_0x235e('0x7'));var logger=require(_0x235e('0x8'))(_0x235e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x235e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x379592,_0x5045f3,_0x2893c1){return new BPromise(function(_0x25d9a3,_0x217674){return client['request'](_0x379592,_0x2893c1)[_0x235e('0xb')](function(_0x4d507f){logger[_0x235e('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x5045f3,_0x235e('0xd'));logger['debug'](_0x235e('0xe'),_0x5045f3,'request\x20sent',JSON['stringify'](_0x4d507f));if(_0x4d507f[_0x235e('0xf')]){if(_0x4d507f['error']['code']===0x1f4){logger[_0x235e('0xf')](_0x235e('0x10'),_0x5045f3,_0x4d507f[_0x235e('0xf')][_0x235e('0x11')]);return _0x217674(_0x4d507f['error'][_0x235e('0x11')]);}logger['error'](_0x235e('0x10'),_0x5045f3,_0x4d507f['error'][_0x235e('0x11')]);return _0x25d9a3(_0x4d507f[_0x235e('0xf')][_0x235e('0x11')]);}else{logger[_0x235e('0xc')](_0x235e('0x10'),_0x5045f3,_0x235e('0xd'));_0x25d9a3(_0x4d507f['result'][_0x235e('0x11')]);}})[_0x235e('0x12')](function(_0x2fd124){logger[_0x235e('0xf')](_0x235e('0x10'),_0x5045f3,_0x2fd124);_0x217674(_0x2fd124);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index cdd62c3..02c0d14 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 _0xf7b4=['destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put','update'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf7b4,0x152));var _0x4f7b=function(_0x141e0e,_0x280369){_0x141e0e=_0x141e0e-0x0;var _0x254337=_0xf7b4[_0x141e0e];return _0x254337;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0x7')](_0x4f7b('0xc'),auth['isAuthenticated'](),controller[_0x4f7b('0xd')]);router[_0x4f7b('0x7')]('/:id/fields',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0xf')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x10')]);router['post'](_0x4f7b('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4f7b('0x11')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x12')]);router['delete'](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x13')]);module[_0x4f7b('0x14')]=router; \ No newline at end of file +var _0x153f=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','update','delete','exports','multer','util','path'];(function(_0x10b1bb,_0x2a5815){var _0x2d4e05=function(_0xc13643){while(--_0xc13643){_0x10b1bb['push'](_0x10b1bb['shift']());}};_0x2d4e05(++_0x2a5815);}(_0x153f,0x15b));var _0xf153=function(_0x59a736,_0x15e915){_0x59a736=_0x59a736-0x0;var _0x1fff23=_0x153f[_0x59a736];return _0x1fff23;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var fs_extra=require(_0xf153('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf153('0x7'));var config=require('../../config/environment');var controller=require(_0xf153('0x8'));router[_0xf153('0x9')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0xb')]);router[_0xf153('0x9')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0xc')]);router[_0xf153('0x9')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0xe')]);router[_0xf153('0x9')](_0xf153('0xf'),auth[_0xf153('0xa')](),controller[_0xf153('0x10')]);router['post']('/',auth[_0xf153('0xa')](),controller[_0xf153('0x11')]);router[_0xf153('0x12')]('/:id/configurations',auth[_0xf153('0xa')](),controller[_0xf153('0x13')]);router[_0xf153('0x14')](_0xf153('0x15'),auth[_0xf153('0xa')](),controller[_0xf153('0x16')]);router[_0xf153('0x17')](_0xf153('0x15'),auth[_0xf153('0xa')](),controller['destroy']);module[_0xf153('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 6e97a06..cf256df 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 _0x7916=['sequelize','STRING','username','remoteUri'];(function(_0x1a3c28,_0x4d892e){var _0x259952=function(_0x201bd5){while(--_0x201bd5){_0x1a3c28['push'](_0x1a3c28['shift']());}};_0x259952(++_0x4d892e);}(_0x7916,0x128));var _0x6791=function(_0x51e4ed,_0x403638){_0x51e4ed=_0x51e4ed-0x0;var _0x36b7ef=_0x7916[_0x51e4ed];return _0x36b7ef;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')]},'description':{'type':Sequelize[_0x6791('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6791('0x2')},'apiKey':{'type':Sequelize[_0x6791('0x1')]},'remoteUri':{'type':Sequelize[_0x6791('0x1')],'unique':_0x6791('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4325=['exports','STRING','username','remoteUri','sequelize'];(function(_0x42ebf8,_0x274d5f){var _0x20ed08=function(_0x4c4eea){while(--_0x4c4eea){_0x42ebf8['push'](_0x42ebf8['shift']());}};_0x20ed08(++_0x274d5f);}(_0x4325,0x1da));var _0x5432=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4325[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x5432('0x0'));module[_0x5432('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5432('0x2')]},'username':{'type':Sequelize[_0x5432('0x2')],'unique':_0x5432('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x5432('0x4')},'serverUrl':{'type':Sequelize[_0x5432('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 1d99646..79ebb41 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 _0x9575=['apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','filter','where','merge','type','VIRTUAL','includeAll','include','rows','catch','params','options','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','GET','%s%s','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','set'];(function(_0x591a53,_0x1b931c){var _0x35902a=function(_0x3ee83b){while(--_0x3ee83b){_0x591a53['push'](_0x591a53['shift']());}};_0x35902a(++_0x1b931c);}(_0x9575,0x1d6));var _0x5957=function(_0x46b4aa,_0x303110){_0x46b4aa=_0x46b4aa-0x0;var _0x192019=_0x9575[_0x46b4aa];return _0x192019;};'use strict';var emlformat=require(_0x5957('0x0'));var rimraf=require(_0x5957('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5957('0x2'));var rp=require(_0x5957('0x3'));var moment=require(_0x5957('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5957('0x5'));var util=require(_0x5957('0x6'));var path=require(_0x5957('0x7'));var sox=require(_0x5957('0x8'));var csv=require(_0x5957('0x9'));var ejs=require(_0x5957('0xa'));var fs=require('fs');var fs_extra=require(_0x5957('0xb'));var _=require('lodash');var squel=require(_0x5957('0xc'));var crypto=require(_0x5957('0xd'));var jsforce=require(_0x5957('0xe'));var deskjs=require(_0x5957('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5957('0x10'));var Papa=require(_0x5957('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5957('0x12'));var utils=require(_0x5957('0x13'));var config=require(_0x5957('0x14'));var licenseUtil=require(_0x5957('0x15'));var db=require(_0x5957('0x16'))['db'];var integrations=require(_0x5957('0x17'));function respondWithStatusCode(_0x2c0b22,_0x1c21fc){_0x1c21fc=_0x1c21fc||0xcc;return function(_0x8e518b){if(_0x8e518b){return _0x2c0b22['sendStatus'](_0x1c21fc);}return _0x2c0b22[_0x5957('0x18')](_0x1c21fc)['end']();};}function respondWithResult(_0x5dd5e4,_0x15fbbd){_0x15fbbd=_0x15fbbd||0xc8;return function(_0x2eea8d){if(_0x2eea8d){return _0x5dd5e4[_0x5957('0x18')](_0x15fbbd)[_0x5957('0x19')](_0x2eea8d);}};}function respondWithFilteredResult(_0x362cab,_0x537764){return function(_0x358c3c){if(_0x358c3c){var _0x2e8ce6=typeof _0x537764[_0x5957('0x1a')]==='undefined'&&typeof _0x537764['limit']===_0x5957('0x1b');var _0x7cdf84=_0x358c3c[_0x5957('0x1c')];var _0xacc3=_0x2e8ce6?0x0:_0x537764[_0x5957('0x1a')];var _0x82b510=_0x2e8ce6?_0x358c3c[_0x5957('0x1c')]:_0x537764['offset']+_0x537764['limit'];var _0xa94fd3;if(_0x82b510>=_0x7cdf84){_0x82b510=_0x7cdf84;_0xa94fd3=0xc8;}else{_0xa94fd3=0xce;}_0x362cab[_0x5957('0x18')](_0xa94fd3);return _0x362cab[_0x5957('0x1d')]('Content-Range',_0xacc3+'-'+_0x82b510+'/'+_0x7cdf84)['json'](_0x358c3c);}return null;};}function patchUpdates(_0x209f2f){return function(_0x32d664){try{jsonpatch[_0x5957('0x1e')](_0x32d664,_0x209f2f,!![]);}catch(_0xf772c7){return BPromise[_0x5957('0x1f')](_0xf772c7);}return _0x32d664[_0x5957('0x20')]();};}function saveUpdates(_0x17bc99,_0x4d4ad5){return function(_0x46b4a9){if(_0x46b4a9){return _0x46b4a9[_0x5957('0x21')](_0x17bc99)[_0x5957('0x22')](function(_0x1edfbc){return _0x1edfbc;});}return null;};}function removeEntity(_0x49d082,_0x379bd6){return function(_0x49c92c){if(_0x49c92c){return _0x49c92c[_0x5957('0x23')]()[_0x5957('0x22')](function(){_0x49d082[_0x5957('0x18')](0xcc)[_0x5957('0x24')]();});}};}function handleEntityNotFound(_0x2dc80d,_0x17a558){return function(_0x455c48){if(!_0x455c48){_0x2dc80d[_0x5957('0x25')](0x194);}return _0x455c48;};}function handleError(_0x119d4f,_0x23d6a7){_0x23d6a7=_0x23d6a7||0x1f4;return function(_0x31577b){logger[_0x5957('0x26')](_0x31577b[_0x5957('0x27')]);if(_0x31577b[_0x5957('0x28')]){delete _0x31577b[_0x5957('0x28')];}_0x119d4f['status'](_0x23d6a7)[_0x5957('0x29')](_0x31577b);};}exports[_0x5957('0x2a')]=function(_0x1dc61a,_0x408581){var _0x10e321={},_0x52a379={},_0x2da15e={'count':0x0,'rows':[]};var _0x397477=_[_0x5957('0x2b')](db[_0x5957('0x2c')][_0x5957('0x2d')],function(_0x1cbae9){return{'name':_0x1cbae9[_0x5957('0x2e')],'type':_0x1cbae9['type'][_0x5957('0x2f')]};});_0x52a379[_0x5957('0x30')]=_['map'](_0x397477,_0x5957('0x28'));_0x52a379[_0x5957('0x31')]=_[_0x5957('0x32')](_0x1dc61a[_0x5957('0x31')]);_0x52a379[_0x5957('0x33')]=_[_0x5957('0x34')](_0x52a379[_0x5957('0x30')],_0x52a379[_0x5957('0x31')]);_0x10e321[_0x5957('0x35')]=_[_0x5957('0x34')](_0x52a379[_0x5957('0x30')],qs[_0x5957('0x36')](_0x1dc61a[_0x5957('0x31')][_0x5957('0x36')]));_0x10e321['attributes']=_0x10e321[_0x5957('0x35')][_0x5957('0x37')]?_0x10e321[_0x5957('0x35')]:_0x52a379[_0x5957('0x30')];if(!_0x1dc61a['query']['hasOwnProperty'](_0x5957('0x38'))){_0x10e321[_0x5957('0x39')]=qs[_0x5957('0x39')](_0x1dc61a['query'][_0x5957('0x39')]);_0x10e321[_0x5957('0x1a')]=qs[_0x5957('0x1a')](_0x1dc61a[_0x5957('0x31')][_0x5957('0x1a')]);}_0x10e321[_0x5957('0x3a')]=qs[_0x5957('0x3b')](_0x1dc61a[_0x5957('0x31')][_0x5957('0x3b')]);_0x10e321['where']=qs['filters'](_['pick'](_0x1dc61a[_0x5957('0x31')],_0x52a379[_0x5957('0x33')]),_0x397477);if(_0x1dc61a[_0x5957('0x31')][_0x5957('0x3c')]){_0x10e321[_0x5957('0x3d')]=_[_0x5957('0x3e')](_0x10e321[_0x5957('0x3d')],{'$or':_[_0x5957('0x2b')](_0x397477,function(_0x5ab4f7){if(_0x5ab4f7[_0x5957('0x3f')]!==_0x5957('0x40')){var _0x4153ea={};_0x4153ea[_0x5ab4f7['name']]={'$like':'%'+_0x1dc61a['query'][_0x5957('0x3c')]+'%'};return _0x4153ea;}})});}_0x10e321=_[_0x5957('0x3e')]({},_0x10e321,_0x1dc61a['options']);var _0x5afa27={'where':_0x10e321[_0x5957('0x3d')]};return db[_0x5957('0x2c')][_0x5957('0x1c')](_0x5afa27)[_0x5957('0x22')](function(_0x38ed8c){_0x2da15e[_0x5957('0x1c')]=_0x38ed8c;if(_0x1dc61a[_0x5957('0x31')][_0x5957('0x41')]){_0x10e321[_0x5957('0x42')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x10e321);})['then'](function(_0xc7e2ab){_0x2da15e[_0x5957('0x43')]=_0xc7e2ab;return _0x2da15e;})[_0x5957('0x22')](respondWithFilteredResult(_0x408581,_0x10e321))[_0x5957('0x44')](handleError(_0x408581,null));};exports['show']=function(_0x193fc2,_0x2921b8){var _0x17298f={'raw':![],'where':{'id':_0x193fc2[_0x5957('0x45')]['id']}},_0x3ff055={};_0x3ff055[_0x5957('0x30')]=_['keys'](db[_0x5957('0x2c')][_0x5957('0x2d')]);_0x3ff055['query']=_[_0x5957('0x32')](_0x193fc2[_0x5957('0x31')]);_0x3ff055['filters']=_[_0x5957('0x34')](_0x3ff055[_0x5957('0x30')],_0x3ff055['query']);_0x17298f[_0x5957('0x35')]=_['intersection'](_0x3ff055[_0x5957('0x30')],qs[_0x5957('0x36')](_0x193fc2['query'][_0x5957('0x36')]));_0x17298f['attributes']=_0x17298f[_0x5957('0x35')][_0x5957('0x37')]?_0x17298f[_0x5957('0x35')]:_0x3ff055[_0x5957('0x30')];if(_0x193fc2['query'][_0x5957('0x41')]){_0x17298f[_0x5957('0x42')]=[{'all':!![]}];}_0x17298f=_['merge']({},_0x17298f,_0x193fc2[_0x5957('0x46')]);return db[_0x5957('0x2c')]['find'](_0x17298f)['then'](handleEntityNotFound(_0x2921b8,null))[_0x5957('0x22')](respondWithResult(_0x2921b8,null))[_0x5957('0x44')](handleError(_0x2921b8,null));};exports['create']=function(_0x419bca,_0x4dbc4d){return db[_0x5957('0x2c')][_0x5957('0x47')](_0x419bca[_0x5957('0x48')],{})[_0x5957('0x22')](respondWithResult(_0x4dbc4d,0xc9))[_0x5957('0x44')](handleError(_0x4dbc4d,null));};exports[_0x5957('0x21')]=function(_0xb7de2e,_0x464894){if(_0xb7de2e['body']['id']){delete _0xb7de2e[_0x5957('0x48')]['id'];}return db[_0x5957('0x2c')]['find']({'where':{'id':_0xb7de2e[_0x5957('0x45')]['id']}})[_0x5957('0x22')](handleEntityNotFound(_0x464894,null))[_0x5957('0x22')](saveUpdates(_0xb7de2e[_0x5957('0x48')],null))['then'](respondWithResult(_0x464894,null))[_0x5957('0x44')](handleError(_0x464894,null));};exports[_0x5957('0x23')]=function(_0x322b3e,_0x38b4cd){return db[_0x5957('0x2c')][_0x5957('0x49')]({'where':{'id':_0x322b3e[_0x5957('0x45')]['id']}})[_0x5957('0x22')](handleEntityNotFound(_0x38b4cd,null))[_0x5957('0x22')](removeEntity(_0x38b4cd,null))['catch'](handleError(_0x38b4cd,null));};exports[_0x5957('0x4a')]=function(_0x5c0bfa,_0x2151a1,_0x235692){var _0x20a675={};var _0x38974d={};var _0x202f3e;var _0xe6ca76;return db['FreshsalesAccount'][_0x5957('0x4b')]({'where':{'id':_0x5c0bfa[_0x5957('0x45')]['id']}})[_0x5957('0x22')](handleEntityNotFound(_0x2151a1,null))[_0x5957('0x22')](function(_0x3c798f){if(_0x3c798f){_0x202f3e=_0x3c798f;_0x38974d[_0x5957('0x30')]=_[_0x5957('0x32')](db[_0x5957('0x4c')][_0x5957('0x2d')]);_0x38974d[_0x5957('0x31')]=_['keys'](_0x5c0bfa[_0x5957('0x31')]);_0x38974d[_0x5957('0x33')]=_[_0x5957('0x34')](_0x38974d[_0x5957('0x30')],_0x38974d[_0x5957('0x31')]);_0x20a675[_0x5957('0x35')]=_[_0x5957('0x34')](_0x38974d['model'],qs[_0x5957('0x36')](_0x5c0bfa['query'][_0x5957('0x36')]));_0x20a675[_0x5957('0x35')]=_0x20a675[_0x5957('0x35')][_0x5957('0x37')]?_0x20a675[_0x5957('0x35')]:_0x38974d[_0x5957('0x30')];_0x20a675['order']=qs[_0x5957('0x3b')](_0x5c0bfa[_0x5957('0x31')][_0x5957('0x3b')]);_0x20a675[_0x5957('0x3d')]=qs['filters'](_[_0x5957('0x4d')](_0x5c0bfa[_0x5957('0x31')],_0x38974d[_0x5957('0x33')]));if(_0x5c0bfa[_0x5957('0x31')][_0x5957('0x3c')]){_0x20a675[_0x5957('0x3d')]=_['merge'](_0x20a675[_0x5957('0x3d')],{'$or':_[_0x5957('0x2b')](_0x20a675[_0x5957('0x35')],function(_0x4ec833){var _0x11b87b={};_0x11b87b[_0x4ec833]={'$like':'%'+_0x5c0bfa[_0x5957('0x31')]['filter']+'%'};return _0x11b87b;})});}_0x20a675=_[_0x5957('0x3e')]({},_0x20a675,_0x5c0bfa[_0x5957('0x46')]);return _0x202f3e['getConfigurations'](_0x20a675);}})[_0x5957('0x22')](function(_0x209d21){if(_0x209d21){_0xe6ca76=_0x209d21[_0x5957('0x37')];if(!_0x5c0bfa[_0x5957('0x31')][_0x5957('0x4e')](_0x5957('0x38'))){_0x20a675[_0x5957('0x39')]=qs[_0x5957('0x39')](_0x5c0bfa['query']['limit']);_0x20a675[_0x5957('0x1a')]=qs[_0x5957('0x1a')](_0x5c0bfa[_0x5957('0x31')][_0x5957('0x1a')]);}return _0x202f3e[_0x5957('0x4a')](_0x20a675);}})['then'](function(_0x36468f){if(_0x36468f){return _0x36468f?{'count':_0xe6ca76,'rows':_0x36468f}:null;}})['then'](respondWithResult(_0x2151a1,null))['catch'](handleError(_0x2151a1,null));};exports[_0x5957('0x4f')]=function(_0x3861ad,_0x42dbc3,_0x10d334){if(_0x3861ad[_0x5957('0x48')]['id']){delete _0x3861ad[_0x5957('0x48')]['id'];}return db[_0x5957('0x2c')][_0x5957('0x4b')]({'where':{'id':_0x3861ad[_0x5957('0x45')]['id']}})[_0x5957('0x22')](handleEntityNotFound(_0x42dbc3,null))[_0x5957('0x22')](function(_0x50cd04){if(_0x50cd04){_0x3861ad['body'][_0x5957('0x50')]=_0x50cd04['id'];_0x3861ad[_0x5957('0x48')][_0x5957('0x51')]=integrations[_0x5957('0x52')](_0x3861ad[_0x5957('0x48')][_0x5957('0x53')],_0x3861ad[_0x5957('0x48')][_0x5957('0x3f')]);_0x3861ad[_0x5957('0x48')][_0x5957('0x54')]=integrations['getDescriptions'](_0x3861ad[_0x5957('0x48')][_0x5957('0x53')],_0x3861ad[_0x5957('0x48')][_0x5957('0x3f')]);return db[_0x5957('0x4c')]['create'](_0x3861ad[_0x5957('0x48')],{'include':[{'model':db[_0x5957('0x55')],'as':'Subjects'},{'model':db[_0x5957('0x55')],'as':'Descriptions'}]});}return null;})[_0x5957('0x22')](respondWithResult(_0x42dbc3,null))[_0x5957('0x44')](handleError(_0x42dbc3,null));};exports[_0x5957('0x56')]=function(_0x132765,_0x563370,_0x840311){var _0x211ed9='';var _0x50de11='';return db[_0x5957('0x2c')][_0x5957('0x4b')]({'where':{'id':_0x132765[_0x5957('0x45')]['id']},'attributes':['id',_0x5957('0x57'),_0x5957('0x58'),_0x5957('0x59')]})['then'](handleEntityNotFound(_0x563370,null))['then'](function(_0x372675){if(_0x372675){_0x50de11=_0x372675[_0x5957('0x57')];_0x211ed9=_0x372675[_0x5957('0x58')];var _0x3a0eac=_0x372675[_0x5957('0x58')][_0x5957('0x5a')](-0x1);if(_0x3a0eac==='/'){_0x211ed9=_0x211ed9[_0x5957('0x5b')](0x0,_0x211ed9['lastIndexOf'](_0x3a0eac));}return rp({'method':_0x5957('0x5c'),'uri':util['format'](_0x5957('0x5d'),_0x211ed9,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x372675[_0x5957('0x59')]},'json':!![]});}})[_0x5957('0x22')](function(_0x360fde){if(_0x360fde){var _0x35d25a=_0x360fde['users'];var _0x1f48f8=![];var _0xc0db55=null;for(_0xc0db55=0x0;_0xc0db55<_0x35d25a[_0x5957('0x37')];_0xc0db55++){if(_0x35d25a[_0xc0db55][_0x5957('0x5e')]===_0x50de11){_0x1f48f8=!![];}}if(_0x1f48f8){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x5957('0x22')](respondWithResult(_0x563370,null))[_0x5957('0x44')](function(_0x158a49){var _0x4dc3d0=_0x132765[_0x5957('0x31')][_0x5957('0x5f')]?0x1f4:_0x158a49[_0x5957('0x60')]||0x1f4;logger[_0x5957('0x26')](_0x5957('0x61'),_0x5957('0x56'),_0x4dc3d0,JSON[_0x5957('0x62')](_0x158a49));delete _0x158a49[_0x5957('0x28')];if(_0x4dc3d0===0x191){_0x4dc3d0=0x190;}_0x563370[_0x5957('0x18')](_0x4dc3d0)[_0x5957('0x29')](_0x132765[_0x5957('0x31')][_0x5957('0x5f')]?{'message':_0x5957('0x63'),'statusCode':_0x158a49[_0x5957('0x60')]}:_0x158a49);});}; \ No newline at end of file +var _0xbb01=['Subjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','FreshsalesAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getConfigurations','FreshsalesConfiguration','nolimit','findOne','AccountId'];(function(_0x39a3f4,_0x7f4ae8){var _0x4a894d=function(_0x190460){while(--_0x190460){_0x39a3f4['push'](_0x39a3f4['shift']());}};_0x4a894d(++_0x7f4ae8);}(_0xbb01,0xef));var _0x1bb0=function(_0xd8f7bd,_0x45dc8c){_0xd8f7bd=_0xd8f7bd-0x0;var _0x1bd5ee=_0xbb01[_0xd8f7bd];return _0x1bd5ee;};'use strict';var emlformat=require(_0x1bb0('0x0'));var rimraf=require(_0x1bb0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1bb0('0x2'));var rp=require(_0x1bb0('0x3'));var moment=require(_0x1bb0('0x4'));var BPromise=require(_0x1bb0('0x5'));var Mustache=require(_0x1bb0('0x6'));var util=require(_0x1bb0('0x7'));var path=require(_0x1bb0('0x8'));var sox=require(_0x1bb0('0x9'));var csv=require(_0x1bb0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1bb0('0xb'));var jsforce=require(_0x1bb0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1bb0('0xa'));var querystring=require(_0x1bb0('0xd'));var Papa=require(_0x1bb0('0xe'));var Redis=require(_0x1bb0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1bb0('0x10'));var as=require(_0x1bb0('0x11'));var hardwareService=require(_0x1bb0('0x12'));var logger=require(_0x1bb0('0x13'))(_0x1bb0('0x14'));var utils=require(_0x1bb0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1bb0('0x16'));var db=require(_0x1bb0('0x17'))['db'];var integrations=require(_0x1bb0('0x18'));function respondWithStatusCode(_0x5e340c,_0x47c5f1){_0x47c5f1=_0x47c5f1||0xcc;return function(_0x685c79){if(_0x685c79){return _0x5e340c[_0x1bb0('0x19')](_0x47c5f1);}return _0x5e340c[_0x1bb0('0x1a')](_0x47c5f1)[_0x1bb0('0x1b')]();};}function respondWithResult(_0x1d2e0b,_0x58bb88){_0x58bb88=_0x58bb88||0xc8;return function(_0x76a42){if(_0x76a42){return _0x1d2e0b[_0x1bb0('0x1a')](_0x58bb88)[_0x1bb0('0x1c')](_0x76a42);}};}function respondWithFilteredResult(_0xd5f00a,_0x9a76dd){return function(_0x4f3f5d){if(_0x4f3f5d){var _0x5b0158=typeof _0x9a76dd[_0x1bb0('0x1d')]==='undefined'&&typeof _0x9a76dd['limit']===_0x1bb0('0x1e');var _0x1c5368=_0x4f3f5d['count'];var _0x4f8057=_0x5b0158?0x0:_0x9a76dd[_0x1bb0('0x1d')];var _0x620f1a=_0x5b0158?_0x4f3f5d[_0x1bb0('0x1f')]:_0x9a76dd[_0x1bb0('0x1d')]+_0x9a76dd['limit'];var _0x50333e;if(_0x620f1a>=_0x1c5368){_0x620f1a=_0x1c5368;_0x50333e=0xc8;}else{_0x50333e=0xce;}_0xd5f00a[_0x1bb0('0x1a')](_0x50333e);return _0xd5f00a[_0x1bb0('0x20')](_0x1bb0('0x21'),_0x4f8057+'-'+_0x620f1a+'/'+_0x1c5368)[_0x1bb0('0x1c')](_0x4f3f5d);}return null;};}function patchUpdates(_0x4a362f){return function(_0x5643fb){try{jsonpatch['apply'](_0x5643fb,_0x4a362f,!![]);}catch(_0x2ef549){return BPromise[_0x1bb0('0x22')](_0x2ef549);}return _0x5643fb[_0x1bb0('0x23')]();};}function saveUpdates(_0x30e675,_0xcb98d8){return function(_0x4c4860){if(_0x4c4860){return _0x4c4860[_0x1bb0('0x24')](_0x30e675)[_0x1bb0('0x25')](function(_0x523f61){return _0x523f61;});}return null;};}function removeEntity(_0x1787a5,_0x2e4524){return function(_0xb0086b){if(_0xb0086b){return _0xb0086b[_0x1bb0('0x26')]()[_0x1bb0('0x25')](function(){_0x1787a5[_0x1bb0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dfef0,_0x4305dd){return function(_0x1eb336){if(!_0x1eb336){_0x3dfef0[_0x1bb0('0x19')](0x194);}return _0x1eb336;};}function handleError(_0x114e3b,_0x162e88){_0x162e88=_0x162e88||0x1f4;return function(_0x196704){logger[_0x1bb0('0x27')](_0x196704[_0x1bb0('0x28')]);if(_0x196704[_0x1bb0('0x29')]){delete _0x196704[_0x1bb0('0x29')];}_0x114e3b[_0x1bb0('0x1a')](_0x162e88)[_0x1bb0('0x2a')](_0x196704);};}exports['index']=function(_0x3a69a6,_0x25f372){var _0x2c5517={},_0x37a869={},_0x3098f9={'count':0x0,'rows':[]};var _0x5da25e=_['map'](db[_0x1bb0('0x2b')][_0x1bb0('0x2c')],function(_0x5cae78){return{'name':_0x5cae78[_0x1bb0('0x2d')],'type':_0x5cae78[_0x1bb0('0x2e')][_0x1bb0('0x2f')]};});_0x37a869['model']=_['map'](_0x5da25e,_0x1bb0('0x29'));_0x37a869[_0x1bb0('0x30')]=_[_0x1bb0('0x31')](_0x3a69a6[_0x1bb0('0x30')]);_0x37a869[_0x1bb0('0x32')]=_[_0x1bb0('0x33')](_0x37a869[_0x1bb0('0x34')],_0x37a869[_0x1bb0('0x30')]);_0x2c5517[_0x1bb0('0x35')]=_[_0x1bb0('0x33')](_0x37a869[_0x1bb0('0x34')],qs[_0x1bb0('0x36')](_0x3a69a6[_0x1bb0('0x30')][_0x1bb0('0x36')]));_0x2c5517[_0x1bb0('0x35')]=_0x2c5517[_0x1bb0('0x35')][_0x1bb0('0x37')]?_0x2c5517[_0x1bb0('0x35')]:_0x37a869[_0x1bb0('0x34')];if(!_0x3a69a6['query'][_0x1bb0('0x38')]('nolimit')){_0x2c5517[_0x1bb0('0x39')]=qs['limit'](_0x3a69a6['query']['limit']);_0x2c5517[_0x1bb0('0x1d')]=qs['offset'](_0x3a69a6[_0x1bb0('0x30')][_0x1bb0('0x1d')]);}_0x2c5517[_0x1bb0('0x3a')]=qs['sort'](_0x3a69a6[_0x1bb0('0x30')][_0x1bb0('0x3b')]);_0x2c5517[_0x1bb0('0x3c')]=qs[_0x1bb0('0x32')](_[_0x1bb0('0x3d')](_0x3a69a6[_0x1bb0('0x30')],_0x37a869['filters']),_0x5da25e);if(_0x3a69a6['query'][_0x1bb0('0x3e')]){_0x2c5517['where']=_[_0x1bb0('0x3f')](_0x2c5517[_0x1bb0('0x3c')],{'$or':_[_0x1bb0('0x40')](_0x5da25e,function(_0x5a4c86){if(_0x5a4c86[_0x1bb0('0x2e')]!==_0x1bb0('0x41')){var _0x30606e={};_0x30606e[_0x5a4c86[_0x1bb0('0x29')]]={'$like':'%'+_0x3a69a6['query']['filter']+'%'};return _0x30606e;}})});}_0x2c5517=_[_0x1bb0('0x3f')]({},_0x2c5517,_0x3a69a6[_0x1bb0('0x42')]);var _0x305773={'where':_0x2c5517['where']};return db[_0x1bb0('0x2b')][_0x1bb0('0x1f')](_0x305773)['then'](function(_0x14e36a){_0x3098f9['count']=_0x14e36a;if(_0x3a69a6['query'][_0x1bb0('0x43')]){_0x2c5517['include']=[{'all':!![]}];}return db[_0x1bb0('0x2b')][_0x1bb0('0x44')](_0x2c5517);})['then'](function(_0x133827){_0x3098f9[_0x1bb0('0x45')]=_0x133827;return _0x3098f9;})[_0x1bb0('0x25')](respondWithFilteredResult(_0x25f372,_0x2c5517))[_0x1bb0('0x46')](handleError(_0x25f372,null));};exports[_0x1bb0('0x47')]=function(_0x254e7d,_0x333e61){var _0x53e0d6={'raw':![],'where':{'id':_0x254e7d[_0x1bb0('0x48')]['id']}},_0x1e769a={};_0x1e769a[_0x1bb0('0x34')]=_['keys'](db[_0x1bb0('0x2b')]['rawAttributes']);_0x1e769a['query']=_[_0x1bb0('0x31')](_0x254e7d[_0x1bb0('0x30')]);_0x1e769a[_0x1bb0('0x32')]=_[_0x1bb0('0x33')](_0x1e769a[_0x1bb0('0x34')],_0x1e769a['query']);_0x53e0d6[_0x1bb0('0x35')]=_['intersection'](_0x1e769a[_0x1bb0('0x34')],qs[_0x1bb0('0x36')](_0x254e7d[_0x1bb0('0x30')]['fields']));_0x53e0d6[_0x1bb0('0x35')]=_0x53e0d6[_0x1bb0('0x35')][_0x1bb0('0x37')]?_0x53e0d6['attributes']:_0x1e769a[_0x1bb0('0x34')];if(_0x254e7d[_0x1bb0('0x30')][_0x1bb0('0x43')]){_0x53e0d6[_0x1bb0('0x49')]=[{'all':!![]}];}_0x53e0d6=_['merge']({},_0x53e0d6,_0x254e7d[_0x1bb0('0x42')]);return db['FreshsalesAccount'][_0x1bb0('0x4a')](_0x53e0d6)[_0x1bb0('0x25')](handleEntityNotFound(_0x333e61,null))[_0x1bb0('0x25')](respondWithResult(_0x333e61,null))[_0x1bb0('0x46')](handleError(_0x333e61,null));};exports[_0x1bb0('0x4b')]=function(_0x2bb5cb,_0xbf6d62){return db['FreshsalesAccount'][_0x1bb0('0x4b')](_0x2bb5cb[_0x1bb0('0x4c')],{})[_0x1bb0('0x25')](respondWithResult(_0xbf6d62,0xc9))['catch'](handleError(_0xbf6d62,null));};exports[_0x1bb0('0x24')]=function(_0x15cf56,_0x41c510){if(_0x15cf56[_0x1bb0('0x4c')]['id']){delete _0x15cf56[_0x1bb0('0x4c')]['id'];}return db[_0x1bb0('0x2b')][_0x1bb0('0x4a')]({'where':{'id':_0x15cf56[_0x1bb0('0x48')]['id']}})[_0x1bb0('0x25')](handleEntityNotFound(_0x41c510,null))['then'](saveUpdates(_0x15cf56[_0x1bb0('0x4c')],null))[_0x1bb0('0x25')](respondWithResult(_0x41c510,null))['catch'](handleError(_0x41c510,null));};exports[_0x1bb0('0x26')]=function(_0x2890bd,_0x51ba37){return db[_0x1bb0('0x2b')]['find']({'where':{'id':_0x2890bd[_0x1bb0('0x48')]['id']}})['then'](handleEntityNotFound(_0x51ba37,null))[_0x1bb0('0x25')](removeEntity(_0x51ba37,null))[_0x1bb0('0x46')](handleError(_0x51ba37,null));};exports[_0x1bb0('0x4d')]=function(_0x455668,_0xc01db2,_0x1ca55f){var _0x188f12={};var _0x43384e={};var _0xbfa998;var _0x2ca273;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x455668[_0x1bb0('0x48')]['id']}})[_0x1bb0('0x25')](handleEntityNotFound(_0xc01db2,null))['then'](function(_0x4e5a6b){if(_0x4e5a6b){_0xbfa998=_0x4e5a6b;_0x43384e['model']=_[_0x1bb0('0x31')](db[_0x1bb0('0x4e')][_0x1bb0('0x2c')]);_0x43384e['query']=_[_0x1bb0('0x31')](_0x455668[_0x1bb0('0x30')]);_0x43384e[_0x1bb0('0x32')]=_[_0x1bb0('0x33')](_0x43384e['model'],_0x43384e[_0x1bb0('0x30')]);_0x188f12[_0x1bb0('0x35')]=_[_0x1bb0('0x33')](_0x43384e[_0x1bb0('0x34')],qs[_0x1bb0('0x36')](_0x455668[_0x1bb0('0x30')][_0x1bb0('0x36')]));_0x188f12[_0x1bb0('0x35')]=_0x188f12[_0x1bb0('0x35')]['length']?_0x188f12[_0x1bb0('0x35')]:_0x43384e[_0x1bb0('0x34')];_0x188f12[_0x1bb0('0x3a')]=qs['sort'](_0x455668['query'][_0x1bb0('0x3b')]);_0x188f12['where']=qs[_0x1bb0('0x32')](_['pick'](_0x455668[_0x1bb0('0x30')],_0x43384e[_0x1bb0('0x32')]));if(_0x455668[_0x1bb0('0x30')]['filter']){_0x188f12[_0x1bb0('0x3c')]=_['merge'](_0x188f12[_0x1bb0('0x3c')],{'$or':_[_0x1bb0('0x40')](_0x188f12[_0x1bb0('0x35')],function(_0x25d564){var _0xaacac3={};_0xaacac3[_0x25d564]={'$like':'%'+_0x455668[_0x1bb0('0x30')][_0x1bb0('0x3e')]+'%'};return _0xaacac3;})});}_0x188f12=_[_0x1bb0('0x3f')]({},_0x188f12,_0x455668[_0x1bb0('0x42')]);return _0xbfa998[_0x1bb0('0x4d')](_0x188f12);}})[_0x1bb0('0x25')](function(_0x20c53d){if(_0x20c53d){_0x2ca273=_0x20c53d[_0x1bb0('0x37')];if(!_0x455668['query'][_0x1bb0('0x38')](_0x1bb0('0x4f'))){_0x188f12[_0x1bb0('0x39')]=qs[_0x1bb0('0x39')](_0x455668[_0x1bb0('0x30')][_0x1bb0('0x39')]);_0x188f12['offset']=qs[_0x1bb0('0x1d')](_0x455668['query'][_0x1bb0('0x1d')]);}return _0xbfa998['getConfigurations'](_0x188f12);}})[_0x1bb0('0x25')](function(_0x1d0743){if(_0x1d0743){return _0x1d0743?{'count':_0x2ca273,'rows':_0x1d0743}:null;}})[_0x1bb0('0x25')](respondWithResult(_0xc01db2,null))[_0x1bb0('0x46')](handleError(_0xc01db2,null));};exports['addConfiguration']=function(_0x42b79a,_0x1d1734,_0x1929f3){if(_0x42b79a[_0x1bb0('0x4c')]['id']){delete _0x42b79a[_0x1bb0('0x4c')]['id'];}return db[_0x1bb0('0x2b')][_0x1bb0('0x50')]({'where':{'id':_0x42b79a[_0x1bb0('0x48')]['id']}})[_0x1bb0('0x25')](handleEntityNotFound(_0x1d1734,null))[_0x1bb0('0x25')](function(_0x113b6d){if(_0x113b6d){_0x42b79a[_0x1bb0('0x4c')][_0x1bb0('0x51')]=_0x113b6d['id'];_0x42b79a[_0x1bb0('0x4c')][_0x1bb0('0x52')]=integrations['getSubjects'](_0x42b79a[_0x1bb0('0x4c')][_0x1bb0('0x53')],_0x42b79a[_0x1bb0('0x4c')][_0x1bb0('0x2e')]);_0x42b79a[_0x1bb0('0x4c')][_0x1bb0('0x54')]=integrations[_0x1bb0('0x55')](_0x42b79a[_0x1bb0('0x4c')][_0x1bb0('0x53')],_0x42b79a[_0x1bb0('0x4c')][_0x1bb0('0x2e')]);return db['FreshsalesConfiguration']['create'](_0x42b79a[_0x1bb0('0x4c')],{'include':[{'model':db['FreshsalesField'],'as':_0x1bb0('0x52')},{'model':db[_0x1bb0('0x56')],'as':_0x1bb0('0x54')}]});}return null;})['then'](respondWithResult(_0x1d1734,null))['catch'](handleError(_0x1d1734,null));};exports[_0x1bb0('0x57')]=function(_0x3cbfdd,_0x2baf9e,_0x3a9fec){var _0x103305='';var _0x20b370='';return db[_0x1bb0('0x2b')]['findOne']({'where':{'id':_0x3cbfdd[_0x1bb0('0x48')]['id']},'attributes':['id',_0x1bb0('0x58'),_0x1bb0('0x59'),'apiKey']})[_0x1bb0('0x25')](handleEntityNotFound(_0x2baf9e,null))['then'](function(_0x10db68){if(_0x10db68){_0x20b370=_0x10db68[_0x1bb0('0x58')];_0x103305=_0x10db68[_0x1bb0('0x59')];var _0x224e8f=_0x10db68[_0x1bb0('0x59')][_0x1bb0('0x5a')](-0x1);if(_0x224e8f==='/'){_0x103305=_0x103305[_0x1bb0('0x5b')](0x0,_0x103305[_0x1bb0('0x5c')](_0x224e8f));}return rp({'method':_0x1bb0('0x5d'),'uri':util[_0x1bb0('0x5e')](_0x1bb0('0x5f'),_0x103305,_0x1bb0('0x60')),'headers':{'Authorization':_0x1bb0('0x61')+_0x10db68[_0x1bb0('0x62')]},'json':!![]});}})['then'](function(_0x4be8ad){if(_0x4be8ad){var _0x14b6aa=_0x4be8ad[_0x1bb0('0x63')];var _0x41c611=![];var _0x2d4287=null;for(_0x2d4287=0x0;_0x2d4287<_0x14b6aa['length'];_0x2d4287++){if(_0x14b6aa[_0x2d4287][_0x1bb0('0x64')]===_0x20b370){_0x41c611=!![];}}if(_0x41c611){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1bb0('0x65')});}}})[_0x1bb0('0x25')](respondWithResult(_0x2baf9e,null))[_0x1bb0('0x46')](function(_0x9ccf53){var _0x4bd4db=_0x3cbfdd[_0x1bb0('0x30')]['test']?0x1f4:_0x9ccf53[_0x1bb0('0x66')]||0x1f4;logger['error'](_0x1bb0('0x67'),_0x1bb0('0x57'),_0x4bd4db,JSON[_0x1bb0('0x68')](_0x9ccf53));delete _0x9ccf53[_0x1bb0('0x29')];if(_0x4bd4db===0x191){_0x4bd4db=0x190;}_0x2baf9e['status'](_0x4bd4db)['send'](_0x3cbfdd[_0x1bb0('0x30')][_0x1bb0('0x69')]?{'message':_0x1bb0('0x6a'),'statusCode':_0x9ccf53[_0x1bb0('0x66')]}:_0x9ccf53);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index f4aeb33..d069c64 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 _0x7278=['rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0xbd60c1,_0x5c8e96){var _0x595ea3=function(_0x49d464){while(--_0x49d464){_0xbd60c1['push'](_0xbd60c1['shift']());}};_0x595ea3(++_0x5c8e96);}(_0x7278,0x161));var _0x8727=function(_0x6153b,_0x22d122){_0x6153b=_0x6153b-0x0;var _0x502bba=_0x7278[_0x6153b];return _0x502bba;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var fs=require('fs');var path=require(_0x8727('0x6'));var rimraf=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var attributes=require(_0x8727('0x9'));var integrations=require(_0x8727('0xa'));module[_0x8727('0xb')]=function(_0x5549d5,_0xfd1902){return _0x5549d5[_0x8727('0xc')](_0x8727('0xd'),attributes,{'tableName':_0x8727('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4819=['request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0xf7ef2e,_0x4e37b4){var _0x1c2f02=function(_0x1bd6f9){while(--_0x1bd6f9){_0xf7ef2e['push'](_0xf7ef2e['shift']());}};_0x1c2f02(++_0x4e37b4);}(_0x4819,0xcd));var _0x9481=function(_0x4a6362,_0x9e782a){_0x4a6362=_0x4a6362-0x0;var _0x2653a5=_0x4819[_0x4a6362];return _0x2653a5;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x9481('0xa')]=function(_0x5def07,_0x54cc78){return _0x5def07[_0x9481('0xb')](_0x9481('0xc'),attributes,{'tableName':_0x9481('0xd'),'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 33040b7..09cd5ea 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 _0x3e24=['limit','map','include','model','debug','stringify','ShowFreshsalesAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','options','where','attributes'];(function(_0x3fd95e,_0x161076){var _0x5f6c8c=function(_0xf79684){while(--_0xf79684){_0x3fd95e['push'](_0x3fd95e['shift']());}};_0x5f6c8c(++_0x161076);}(_0x3e24,0x167));var _0x43e2=function(_0x54516e,_0x5df54c){_0x54516e=_0x54516e-0x0;var _0x4d1e6f=_0x3e24[_0x54516e];return _0x4d1e6f;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var BPromise=require(_0x43e2('0x3'));var rs=require(_0x43e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43e2('0x5'))['db'];var utils=require(_0x43e2('0x6'));var logger=require('../../config/logger')(_0x43e2('0x7'));var config=require(_0x43e2('0x8'));var jayson=require(_0x43e2('0x9'));var client=jayson[_0x43e2('0xa')][_0x43e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x121e2e,_0x23b2d8,_0x59956d){return new BPromise(function(_0xb75b,_0x2357bc){return client['request'](_0x121e2e,_0x59956d)[_0x43e2('0xc')](function(_0x2fdf85){logger['info'](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));logger['debug'](_0x43e2('0xf'),_0x23b2d8,'request\x20sent',JSON['stringify'](_0x2fdf85));if(_0x2fdf85['error']){if(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x11')]===0x1f4){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0x2357bc(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);}logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0xb75b(_0x2fdf85['error'][_0x43e2('0x12')]);}else{logger[_0x43e2('0x13')](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));_0xb75b(_0x2fdf85['result']['message']);}})[_0x43e2('0x14')](function(_0x417ce5){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x417ce5);_0x2357bc(_0x417ce5);});});}exports[_0x43e2('0x15')]=function(_0x1b7cde){var _0x3ea010=this;return new Promise(function(_0x15ecb5,_0x3236b9){return db[_0x43e2('0x16')]['findAll']({'raw':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde[_0x43e2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde['options'][_0x43e2('0x18')]||null:null,'attributes':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde[_0x43e2('0x17')][_0x43e2('0x19')]||null:null,'limit':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde['options'][_0x43e2('0x1a')]||null:null,'include':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde[_0x43e2('0x17')]['include']?_[_0x43e2('0x1b')](_0x1b7cde[_0x43e2('0x17')][_0x43e2('0x1c')],function(_0x11b285){return{'model':db[_0x11b285['model']],'as':_0x11b285['as'],'attributes':_0x11b285[_0x43e2('0x19')],'include':_0x11b285[_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x11b285[_0x43e2('0x1c')],function(_0x178223){return{'model':db[_0x178223[_0x43e2('0x1d')]],'as':_0x178223['as'],'attributes':_0x178223[_0x43e2('0x19')],'include':_0x178223[_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x178223[_0x43e2('0x1c')],function(_0x1ea844){return{'model':db[_0x1ea844[_0x43e2('0x1d')]],'as':_0x1ea844['as'],'attributes':_0x1ea844['attributes']};}):[]};}):[]};}):[]:[]})[_0x43e2('0xc')](function(_0x2f2bd8){logger['info'](_0x43e2('0x15'),_0x1b7cde);logger[_0x43e2('0x1e')](_0x43e2('0x15'),_0x1b7cde,JSON[_0x43e2('0x1f')](_0x2f2bd8));_0x15ecb5(_0x2f2bd8);})[_0x43e2('0x14')](function(_0x5a896b){logger[_0x43e2('0x10')](_0x43e2('0x15'),_0x5a896b[_0x43e2('0x12')],_0x1b7cde);_0x3236b9(_0x3ea010[_0x43e2('0x10')](0x1f4,_0x5a896b[_0x43e2('0x12')]));});});};exports[_0x43e2('0x20')]=function(_0x53f797){var _0x51226b=this;return new Promise(function(_0xe09322,_0x1dcbc8){return db[_0x43e2('0x16')][_0x43e2('0x21')]({'raw':_0x53f797[_0x43e2('0x17')]?_0x53f797['options'][_0x43e2('0x22')]===undefined?!![]:![]:!![],'where':_0x53f797[_0x43e2('0x17')]?_0x53f797[_0x43e2('0x17')][_0x43e2('0x18')]||null:null,'attributes':_0x53f797[_0x43e2('0x17')]?_0x53f797[_0x43e2('0x17')][_0x43e2('0x19')]||null:null,'include':_0x53f797['options']?_0x53f797['options'][_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x53f797['options'][_0x43e2('0x1c')],function(_0x34effb){return{'model':db[_0x34effb['model']],'as':_0x34effb['as'],'attributes':_0x34effb[_0x43e2('0x19')],'include':_0x34effb['include']?_['map'](_0x34effb['include'],function(_0x2bb489){return{'model':db[_0x2bb489['model']],'as':_0x2bb489['as'],'attributes':_0x2bb489[_0x43e2('0x19')],'include':_0x2bb489[_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x2bb489[_0x43e2('0x1c')],function(_0x44670b){return{'model':db[_0x44670b[_0x43e2('0x1d')]],'as':_0x44670b['as'],'attributes':_0x44670b[_0x43e2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x43e2('0xc')](function(_0x1e9be1){logger[_0x43e2('0x13')](_0x43e2('0x20'),_0x53f797);logger[_0x43e2('0x1e')](_0x43e2('0x20'),_0x53f797,JSON[_0x43e2('0x1f')](_0x1e9be1));_0xe09322(_0x1e9be1);})[_0x43e2('0x14')](function(_0x40b39b){logger[_0x43e2('0x10')]('ShowFreshsalesAccount',_0x40b39b['message'],_0x53f797);_0x1dcbc8(_0x51226b['error'](0x1f4,_0x40b39b[_0x43e2('0x12')]));});});}; \ No newline at end of file +var _0xe3da=['then','GetFreshsalesAccount','catch','ShowFreshsalesAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FreshsalesAccount','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x55dbe5,_0x19842c){var _0x3a64c9=function(_0x47507c){while(--_0x47507c){_0x55dbe5['push'](_0x55dbe5['shift']());}};_0x3a64c9(++_0x19842c);}(_0xe3da,0x1cd));var _0xae3d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe3da[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});}exports['GetFreshsalesAccount']=function(_0x3f8cf9){var _0x4cbe4e=this;return new Promise(function(_0x558e42,_0x4d931d){return db[_0xae3d('0x18')][_0xae3d('0x19')]({'raw':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f8cf9['options']?_0x3f8cf9[_0xae3d('0x1a')]['where']||null:null,'attributes':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1c')]||null:null,'limit':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1d')]||null:null,'include':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1e')]?_[_0xae3d('0x1f')](_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1e')],function(_0x37f5ff){return{'model':db[_0x37f5ff[_0xae3d('0x20')]],'as':_0x37f5ff['as'],'attributes':_0x37f5ff[_0xae3d('0x1c')],'include':_0x37f5ff[_0xae3d('0x1e')]?_[_0xae3d('0x1f')](_0x37f5ff[_0xae3d('0x1e')],function(_0x2131e9){return{'model':db[_0x2131e9[_0xae3d('0x20')]],'as':_0x2131e9['as'],'attributes':_0x2131e9['attributes'],'include':_0x2131e9[_0xae3d('0x1e')]?_[_0xae3d('0x1f')](_0x2131e9[_0xae3d('0x1e')],function(_0x52df0f){return{'model':db[_0x52df0f[_0xae3d('0x20')]],'as':_0x52df0f['as'],'attributes':_0x52df0f[_0xae3d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xae3d('0x21')](function(_0x54c1e1){logger['info'](_0xae3d('0x22'),_0x3f8cf9);logger[_0xae3d('0x11')](_0xae3d('0x22'),_0x3f8cf9,JSON[_0xae3d('0x13')](_0x54c1e1));_0x558e42(_0x54c1e1);})[_0xae3d('0x23')](function(_0x561371){logger[_0xae3d('0x14')](_0xae3d('0x22'),_0x561371['message'],_0x3f8cf9);_0x4d931d(_0x4cbe4e[_0xae3d('0x14')](0x1f4,_0x561371[_0xae3d('0x16')]));});});};exports[_0xae3d('0x24')]=function(_0x46f484){var _0x432c04=this;return new Promise(function(_0x6ef13c,_0x5356d4){return db['FreshsalesAccount']['find']({'raw':_0x46f484[_0xae3d('0x1a')]?_0x46f484[_0xae3d('0x1a')][_0xae3d('0x1b')]===undefined?!![]:![]:!![],'where':_0x46f484[_0xae3d('0x1a')]?_0x46f484['options'][_0xae3d('0x25')]||null:null,'attributes':_0x46f484[_0xae3d('0x1a')]?_0x46f484[_0xae3d('0x1a')][_0xae3d('0x1c')]||null:null,'include':_0x46f484[_0xae3d('0x1a')]?_0x46f484[_0xae3d('0x1a')][_0xae3d('0x1e')]?_['map'](_0x46f484[_0xae3d('0x1a')]['include'],function(_0x55aae4){return{'model':db[_0x55aae4[_0xae3d('0x20')]],'as':_0x55aae4['as'],'attributes':_0x55aae4['attributes'],'include':_0x55aae4[_0xae3d('0x1e')]?_['map'](_0x55aae4['include'],function(_0x1a28b5){return{'model':db[_0x1a28b5[_0xae3d('0x20')]],'as':_0x1a28b5['as'],'attributes':_0x1a28b5[_0xae3d('0x1c')],'include':_0x1a28b5['include']?_[_0xae3d('0x1f')](_0x1a28b5['include'],function(_0xce647f){return{'model':db[_0xce647f[_0xae3d('0x20')]],'as':_0xce647f['as'],'attributes':_0xce647f[_0xae3d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xae3d('0x21')](function(_0x18c469){logger[_0xae3d('0xe')](_0xae3d('0x24'),_0x46f484);logger[_0xae3d('0x11')](_0xae3d('0x24'),_0x46f484,JSON[_0xae3d('0x13')](_0x18c469));_0x6ef13c(_0x18c469);})[_0xae3d('0x23')](function(_0x5543ee){logger['error'](_0xae3d('0x24'),_0x5543ee['message'],_0x46f484);_0x5356d4(_0x432c04[_0xae3d('0x14')](0x1f4,_0x5543ee[_0xae3d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 32e58ad..3499d47 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 _0x3040=['util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','/:id','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3040,0x1af));var _0x0304=function(_0x296e6e,_0x46f3c5){_0x296e6e=_0x296e6e-0x0;var _0x27c4dd=_0x3040[_0x296e6e];return _0x27c4dd;};'use strict';var multer=require(_0x0304('0x0'));var util=require(_0x0304('0x1'));var path=require(_0x0304('0x2'));var timeout=require('connect-timeout');var express=require(_0x0304('0x3'));var router=express['Router']();var fs_extra=require(_0x0304('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0304('0x5'));var config=require(_0x0304('0x6'));var controller=require(_0x0304('0x7'));router[_0x0304('0x8')]('/',auth[_0x0304('0x9')](),controller['index']);router['get']('/:id',auth[_0x0304('0x9')](),controller['show']);router['get'](_0x0304('0xa'),auth['isAuthenticated'](),controller[_0x0304('0xb')]);router[_0x0304('0x8')](_0x0304('0xc'),auth[_0x0304('0x9')](),controller[_0x0304('0xd')]);router['get'](_0x0304('0xe'),auth[_0x0304('0x9')](),controller[_0x0304('0xf')]);router[_0x0304('0x10')]('/',auth['isAuthenticated'](),controller[_0x0304('0x11')]);router[_0x0304('0x12')]('/:id',auth[_0x0304('0x9')](),controller[_0x0304('0x13')]);router[_0x0304('0x14')](_0x0304('0x15'),auth[_0x0304('0x9')](),controller[_0x0304('0x16')]);module[_0x0304('0x17')]=router; \ No newline at end of file +var _0x3dfa=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','put','update','delete','exports','multer','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x4caade,_0x549ce1){var _0x2041ff=function(_0x402f3a){while(--_0x402f3a){_0x4caade['push'](_0x4caade['shift']());}};_0x2041ff(++_0x549ce1);}(_0x3dfa,0x172));var _0xa3df=function(_0x3eb998,_0x4f5cee){_0x3eb998=_0x3eb998-0x0;var _0x272be1=_0x3dfa[_0x3eb998];return _0x272be1;};'use strict';var multer=require(_0xa3df('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa3df('0x1'));var router=express[_0xa3df('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa3df('0x3'));var config=require(_0xa3df('0x4'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xa3df('0x5')]('/',auth[_0xa3df('0x6')](),controller[_0xa3df('0x7')]);router[_0xa3df('0x5')](_0xa3df('0x8'),auth['isAuthenticated'](),controller[_0xa3df('0x9')]);router['get'](_0xa3df('0xa'),auth[_0xa3df('0x6')](),controller[_0xa3df('0xb')]);router[_0xa3df('0x5')](_0xa3df('0xc'),auth[_0xa3df('0x6')](),controller[_0xa3df('0xd')]);router['get'](_0xa3df('0xe'),auth[_0xa3df('0x6')](),controller['getFields']);router[_0xa3df('0xf')]('/',auth[_0xa3df('0x6')](),controller['create']);router[_0xa3df('0x10')](_0xa3df('0x8'),auth['isAuthenticated'](),controller[_0xa3df('0x11')]);router[_0xa3df('0x12')](_0xa3df('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xa3df('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index a119873..4ca1abc 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 _0xc945=['STRING','sequelize','exports'];(function(_0x56c5c0,_0x2901e6){var _0x3610b8=function(_0x3a1958){while(--_0x3a1958){_0x56c5c0['push'](_0x56c5c0['shift']());}};_0x3610b8(++_0x2901e6);}(_0xc945,0x193));var _0x5c94=function(_0x2aef4f,_0x4f12ee){_0x2aef4f=_0x2aef4f-0x0;var _0x599b78=_0xc945[_0x2aef4f];return _0x599b78;};'use strict';var Sequelize=require(_0x5c94('0x0'));module[_0x5c94('0x1')]={'name':{'type':Sequelize[_0x5c94('0x2')]},'description':{'type':Sequelize[_0x5c94('0x2')]}}; \ No newline at end of file +var _0xf4f1=['sequelize','exports','STRING'];(function(_0x2ca0f6,_0x557c90){var _0x54a14e=function(_0x1bca99){while(--_0x1bca99){_0x2ca0f6['push'](_0x2ca0f6['shift']());}};_0x54a14e(++_0x557c90);}(_0xf4f1,0xff));var _0x1f4f=function(_0x5772e2,_0xb6c5a8){_0x5772e2=_0x5772e2-0x0;var _0x24b3e5=_0xf4f1[_0x5772e2];return _0x24b3e5;};'use strict';var Sequelize=require(_0x1f4f('0x0'));module[_0x1f4f('0x1')]={'name':{'type':Sequelize[_0x1f4f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 77617ba..94ee177 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 _0x72e9=['include','catch','show','params','length','includeAll','create','body','find','destroy','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','end','sendStatus','error','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x72e9,0xf9));var _0x972e=function(_0x40c037,_0x2d1731){_0x40c037=_0x40c037-0x0;var _0x3b89f7=_0x72e9[_0x40c037];return _0x3b89f7;};'use strict';var emlformat=require(_0x972e('0x0'));var rimraf=require(_0x972e('0x1'));var zipdir=require(_0x972e('0x2'));var jsonpatch=require(_0x972e('0x3'));var rp=require(_0x972e('0x4'));var moment=require(_0x972e('0x5'));var BPromise=require(_0x972e('0x6'));var Mustache=require(_0x972e('0x7'));var util=require('util');var path=require(_0x972e('0x8'));var sox=require('sox');var csv=require(_0x972e('0x9'));var ejs=require(_0x972e('0xa'));var fs=require('fs');var fs_extra=require(_0x972e('0xb'));var _=require(_0x972e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x972e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x972e('0xe'));var Papa=require(_0x972e('0xf'));var Redis=require(_0x972e('0x10'));var authService=require(_0x972e('0x11'));var qs=require(_0x972e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x972e('0x13'))(_0x972e('0x14'));var utils=require(_0x972e('0x15'));var config=require(_0x972e('0x16'));var licenseUtil=require(_0x972e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x330381,_0x513458){_0x513458=_0x513458||0xcc;return function(_0x5e5d5e){if(_0x5e5d5e){return _0x330381['sendStatus'](_0x513458);}return _0x330381['status'](_0x513458)['end']();};}function respondWithResult(_0x4e9dea,_0x2b2759){_0x2b2759=_0x2b2759||0xc8;return function(_0x47349a){if(_0x47349a){return _0x4e9dea[_0x972e('0x18')](_0x2b2759)[_0x972e('0x19')](_0x47349a);}};}function respondWithFilteredResult(_0xc54760,_0x1140c8){return function(_0x40b2d5){if(_0x40b2d5){var _0xa1491d=typeof _0x1140c8[_0x972e('0x1a')]==='undefined'&&typeof _0x1140c8[_0x972e('0x1b')]===_0x972e('0x1c');var _0x565a00=_0x40b2d5[_0x972e('0x1d')];var _0x1443be=_0xa1491d?0x0:_0x1140c8[_0x972e('0x1a')];var _0x45c32e=_0xa1491d?_0x40b2d5[_0x972e('0x1d')]:_0x1140c8['offset']+_0x1140c8[_0x972e('0x1b')];var _0xe77e6d;if(_0x45c32e>=_0x565a00){_0x45c32e=_0x565a00;_0xe77e6d=0xc8;}else{_0xe77e6d=0xce;}_0xc54760['status'](_0xe77e6d);return _0xc54760['set'](_0x972e('0x1e'),_0x1443be+'-'+_0x45c32e+'/'+_0x565a00)['json'](_0x40b2d5);}return null;};}function patchUpdates(_0x5e58f8){return function(_0x13fadd){try{jsonpatch[_0x972e('0x1f')](_0x13fadd,_0x5e58f8,!![]);}catch(_0x4b68cb){return BPromise[_0x972e('0x20')](_0x4b68cb);}return _0x13fadd[_0x972e('0x21')]();};}function saveUpdates(_0x42cf5e,_0x46d31f){return function(_0x188c8b){if(_0x188c8b){return _0x188c8b[_0x972e('0x22')](_0x42cf5e)[_0x972e('0x23')](function(_0x286fdb){return _0x286fdb;});}return null;};}function removeEntity(_0xcb2998,_0x3ded74){return function(_0x1aabcb){if(_0x1aabcb){return _0x1aabcb['destroy']()[_0x972e('0x23')](function(){_0xcb2998[_0x972e('0x18')](0xcc)[_0x972e('0x24')]();});}};}function handleEntityNotFound(_0x30249b,_0x56ee27){return function(_0xb491ba){if(!_0xb491ba){_0x30249b[_0x972e('0x25')](0x194);}return _0xb491ba;};}function handleError(_0x2f089e,_0x13adf1){_0x13adf1=_0x13adf1||0x1f4;return function(_0x5001c9){logger[_0x972e('0x26')](_0x5001c9['stack']);if(_0x5001c9[_0x972e('0x27')]){delete _0x5001c9[_0x972e('0x27')];}_0x2f089e[_0x972e('0x18')](_0x13adf1)[_0x972e('0x28')](_0x5001c9);};}exports[_0x972e('0x29')]=function(_0x30e1ac,_0x4b949e){var _0x39169d={},_0x2ba8c2={},_0x1aeafa={'count':0x0,'rows':[]};var _0xe22fde=_[_0x972e('0x2a')](db[_0x972e('0x2b')][_0x972e('0x2c')],function(_0x3a00ca){return{'name':_0x3a00ca['fieldName'],'type':_0x3a00ca[_0x972e('0x2d')][_0x972e('0x2e')]};});_0x2ba8c2[_0x972e('0x2f')]=_['map'](_0xe22fde,_0x972e('0x27'));_0x2ba8c2[_0x972e('0x30')]=_[_0x972e('0x31')](_0x30e1ac[_0x972e('0x30')]);_0x2ba8c2[_0x972e('0x32')]=_[_0x972e('0x33')](_0x2ba8c2[_0x972e('0x2f')],_0x2ba8c2[_0x972e('0x30')]);_0x39169d[_0x972e('0x34')]=_['intersection'](_0x2ba8c2[_0x972e('0x2f')],qs['fields'](_0x30e1ac[_0x972e('0x30')][_0x972e('0x35')]));_0x39169d['attributes']=_0x39169d[_0x972e('0x34')]['length']?_0x39169d[_0x972e('0x34')]:_0x2ba8c2['model'];if(!_0x30e1ac[_0x972e('0x30')][_0x972e('0x36')](_0x972e('0x37'))){_0x39169d[_0x972e('0x1b')]=qs[_0x972e('0x1b')](_0x30e1ac['query'][_0x972e('0x1b')]);_0x39169d[_0x972e('0x1a')]=qs[_0x972e('0x1a')](_0x30e1ac[_0x972e('0x30')][_0x972e('0x1a')]);}_0x39169d[_0x972e('0x38')]=qs[_0x972e('0x39')](_0x30e1ac['query'][_0x972e('0x39')]);_0x39169d[_0x972e('0x3a')]=qs[_0x972e('0x32')](_[_0x972e('0x3b')](_0x30e1ac[_0x972e('0x30')],_0x2ba8c2[_0x972e('0x32')]),_0xe22fde);if(_0x30e1ac[_0x972e('0x30')][_0x972e('0x3c')]){_0x39169d[_0x972e('0x3a')]=_[_0x972e('0x3d')](_0x39169d['where'],{'$or':_[_0x972e('0x2a')](_0xe22fde,function(_0x36f711){if(_0x36f711[_0x972e('0x2d')]!=='VIRTUAL'){var _0x4c4d15={};_0x4c4d15[_0x36f711['name']]={'$like':'%'+_0x30e1ac[_0x972e('0x30')][_0x972e('0x3c')]+'%'};return _0x4c4d15;}})});}_0x39169d=_[_0x972e('0x3d')]({},_0x39169d,_0x30e1ac[_0x972e('0x3e')]);var _0x4d1e50={'where':_0x39169d[_0x972e('0x3a')]};return db[_0x972e('0x2b')][_0x972e('0x1d')](_0x4d1e50)['then'](function(_0x46fd20){_0x1aeafa[_0x972e('0x1d')]=_0x46fd20;if(_0x30e1ac[_0x972e('0x30')]['includeAll']){_0x39169d[_0x972e('0x3f')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x39169d);})[_0x972e('0x23')](function(_0x5896c6){_0x1aeafa['rows']=_0x5896c6;return _0x1aeafa;})[_0x972e('0x23')](respondWithFilteredResult(_0x4b949e,_0x39169d))[_0x972e('0x40')](handleError(_0x4b949e,null));};exports[_0x972e('0x41')]=function(_0x3ec2ba,_0x147f57){var _0x2ba82c={'raw':![],'where':{'id':_0x3ec2ba[_0x972e('0x42')]['id']}},_0x238497={};_0x238497[_0x972e('0x2f')]=_['keys'](db['FreshsalesConfiguration'][_0x972e('0x2c')]);_0x238497[_0x972e('0x30')]=_[_0x972e('0x31')](_0x3ec2ba['query']);_0x238497[_0x972e('0x32')]=_[_0x972e('0x33')](_0x238497[_0x972e('0x2f')],_0x238497[_0x972e('0x30')]);_0x2ba82c[_0x972e('0x34')]=_[_0x972e('0x33')](_0x238497['model'],qs[_0x972e('0x35')](_0x3ec2ba[_0x972e('0x30')]['fields']));_0x2ba82c[_0x972e('0x34')]=_0x2ba82c[_0x972e('0x34')][_0x972e('0x43')]?_0x2ba82c['attributes']:_0x238497['model'];if(_0x3ec2ba[_0x972e('0x30')][_0x972e('0x44')]){_0x2ba82c[_0x972e('0x3f')]=[{'all':!![]}];}_0x2ba82c=_['merge']({},_0x2ba82c,_0x3ec2ba[_0x972e('0x3e')]);return db[_0x972e('0x2b')]['find'](_0x2ba82c)[_0x972e('0x23')](handleEntityNotFound(_0x147f57,null))[_0x972e('0x23')](respondWithResult(_0x147f57,null))[_0x972e('0x40')](handleError(_0x147f57,null));};exports[_0x972e('0x45')]=function(_0x27637e,_0x342d25){return db[_0x972e('0x2b')][_0x972e('0x45')](_0x27637e[_0x972e('0x46')],{})[_0x972e('0x23')](respondWithResult(_0x342d25,0xc9))['catch'](handleError(_0x342d25,null));};exports[_0x972e('0x22')]=function(_0x19fcb9,_0x524ea2){if(_0x19fcb9['body']['id']){delete _0x19fcb9[_0x972e('0x46')]['id'];}return db[_0x972e('0x2b')][_0x972e('0x47')]({'where':{'id':_0x19fcb9[_0x972e('0x42')]['id']}})['then'](handleEntityNotFound(_0x524ea2,null))[_0x972e('0x23')](saveUpdates(_0x19fcb9['body'],null))[_0x972e('0x23')](respondWithResult(_0x524ea2,null))[_0x972e('0x40')](handleError(_0x524ea2,null));};exports[_0x972e('0x48')]=function(_0x56cc1a,_0x256e54){return db[_0x972e('0x2b')]['find']({'where':{'id':_0x56cc1a[_0x972e('0x42')]['id']}})[_0x972e('0x23')](handleEntityNotFound(_0x256e54,null))[_0x972e('0x23')](removeEntity(_0x256e54,null))[_0x972e('0x40')](handleError(_0x256e54,null));};exports[_0x972e('0x49')]=function(_0x5e5fd2,_0x377c6e,_0x2915cc){var _0xe28401={};var _0x457ee9={};var _0x1cee69;var _0x426879;return db['FreshsalesConfiguration'][_0x972e('0x4a')]({'where':{'id':_0x5e5fd2[_0x972e('0x42')]['id']}})['then'](handleEntityNotFound(_0x377c6e,null))[_0x972e('0x23')](function(_0x2c8e3d){if(_0x2c8e3d){_0x1cee69=_0x2c8e3d;_0x457ee9['model']=_[_0x972e('0x31')](db[_0x972e('0x4b')][_0x972e('0x2c')]);_0x457ee9['query']=_[_0x972e('0x31')](_0x5e5fd2[_0x972e('0x30')]);_0x457ee9[_0x972e('0x32')]=_[_0x972e('0x33')](_0x457ee9[_0x972e('0x2f')],_0x457ee9['query']);_0xe28401[_0x972e('0x34')]=_[_0x972e('0x33')](_0x457ee9[_0x972e('0x2f')],qs['fields'](_0x5e5fd2[_0x972e('0x30')]['fields']));_0xe28401[_0x972e('0x34')]=_0xe28401[_0x972e('0x34')]['length']?_0xe28401[_0x972e('0x34')]:_0x457ee9['model'];_0xe28401[_0x972e('0x38')]=qs[_0x972e('0x39')](_0x5e5fd2[_0x972e('0x30')][_0x972e('0x39')]);_0xe28401[_0x972e('0x3a')]=qs[_0x972e('0x32')](_[_0x972e('0x3b')](_0x5e5fd2[_0x972e('0x30')],_0x457ee9[_0x972e('0x32')]));if(_0x5e5fd2[_0x972e('0x30')]['filter']){_0xe28401[_0x972e('0x3a')]=_['merge'](_0xe28401[_0x972e('0x3a')],{'$or':_[_0x972e('0x2a')](_0xe28401[_0x972e('0x34')],function(_0x1d8970){var _0x55be60={};_0x55be60[_0x1d8970]={'$like':'%'+_0x5e5fd2[_0x972e('0x30')]['filter']+'%'};return _0x55be60;})});}_0xe28401=_['merge']({},_0xe28401,_0x5e5fd2[_0x972e('0x3e')]);return _0x1cee69[_0x972e('0x49')](_0xe28401);}})[_0x972e('0x23')](function(_0xe9845f){if(_0xe9845f){_0x426879=_0xe9845f['length'];if(!_0x5e5fd2[_0x972e('0x30')][_0x972e('0x36')](_0x972e('0x37'))){_0xe28401['limit']=qs[_0x972e('0x1b')](_0x5e5fd2[_0x972e('0x30')][_0x972e('0x1b')]);_0xe28401[_0x972e('0x1a')]=qs['offset'](_0x5e5fd2[_0x972e('0x30')][_0x972e('0x1a')]);}return _0x1cee69[_0x972e('0x49')](_0xe28401);}})['then'](function(_0x42e067){if(_0x42e067){return _0x42e067?{'count':_0x426879,'rows':_0x42e067}:null;}})['then'](respondWithResult(_0x377c6e,null))[_0x972e('0x40')](handleError(_0x377c6e,null));};exports['getDescriptions']=function(_0x5d8e65,_0x5966d4,_0x5b8bfc){var _0x4f9ffe={};var _0x4eec82={};var _0x4a7dd1;var _0x3da68e;return db[_0x972e('0x2b')][_0x972e('0x4a')]({'where':{'id':_0x5d8e65[_0x972e('0x42')]['id']}})['then'](handleEntityNotFound(_0x5966d4,null))[_0x972e('0x23')](function(_0x3d3267){if(_0x3d3267){_0x4a7dd1=_0x3d3267;_0x4eec82[_0x972e('0x2f')]=_[_0x972e('0x31')](db['FreshsalesField'][_0x972e('0x2c')]);_0x4eec82['query']=_[_0x972e('0x31')](_0x5d8e65[_0x972e('0x30')]);_0x4eec82['filters']=_[_0x972e('0x33')](_0x4eec82[_0x972e('0x2f')],_0x4eec82[_0x972e('0x30')]);_0x4f9ffe[_0x972e('0x34')]=_[_0x972e('0x33')](_0x4eec82[_0x972e('0x2f')],qs[_0x972e('0x35')](_0x5d8e65[_0x972e('0x30')][_0x972e('0x35')]));_0x4f9ffe[_0x972e('0x34')]=_0x4f9ffe[_0x972e('0x34')]['length']?_0x4f9ffe[_0x972e('0x34')]:_0x4eec82[_0x972e('0x2f')];_0x4f9ffe[_0x972e('0x38')]=qs[_0x972e('0x39')](_0x5d8e65[_0x972e('0x30')]['sort']);_0x4f9ffe[_0x972e('0x3a')]=qs[_0x972e('0x32')](_[_0x972e('0x3b')](_0x5d8e65[_0x972e('0x30')],_0x4eec82[_0x972e('0x32')]));if(_0x5d8e65[_0x972e('0x30')][_0x972e('0x3c')]){_0x4f9ffe[_0x972e('0x3a')]=_[_0x972e('0x3d')](_0x4f9ffe['where'],{'$or':_[_0x972e('0x2a')](_0x4f9ffe['attributes'],function(_0x2b14cd){var _0x585bf4={};_0x585bf4[_0x2b14cd]={'$like':'%'+_0x5d8e65['query']['filter']+'%'};return _0x585bf4;})});}_0x4f9ffe=_[_0x972e('0x3d')]({},_0x4f9ffe,_0x5d8e65[_0x972e('0x3e')]);return _0x4a7dd1['getDescriptions'](_0x4f9ffe);}})[_0x972e('0x23')](function(_0x31b2e6){if(_0x31b2e6){_0x3da68e=_0x31b2e6[_0x972e('0x43')];if(!_0x5d8e65[_0x972e('0x30')][_0x972e('0x36')]('nolimit')){_0x4f9ffe[_0x972e('0x1b')]=qs[_0x972e('0x1b')](_0x5d8e65[_0x972e('0x30')]['limit']);_0x4f9ffe[_0x972e('0x1a')]=qs[_0x972e('0x1a')](_0x5d8e65['query'][_0x972e('0x1a')]);}return _0x4a7dd1[_0x972e('0x4c')](_0x4f9ffe);}})[_0x972e('0x23')](function(_0x68b6e3){if(_0x68b6e3){return _0x68b6e3?{'count':_0x3da68e,'rows':_0x68b6e3}:null;}})['then'](respondWithResult(_0x5966d4,null))['catch'](handleError(_0x5966d4,null));};exports[_0x972e('0x4d')]=function(_0x1e72f1,_0x22baef,_0x2177de){var _0x300817={};var _0x3b7544={};var _0x570641;var _0x35e1e3;return db[_0x972e('0x2b')][_0x972e('0x4a')]({'where':{'id':_0x1e72f1['params']['id']}})['then'](handleEntityNotFound(_0x22baef,null))['then'](function(_0x58912b){if(_0x58912b){_0x570641=_0x58912b;_0x3b7544[_0x972e('0x2f')]=_['keys'](db[_0x972e('0x4b')][_0x972e('0x2c')]);_0x3b7544[_0x972e('0x30')]=_[_0x972e('0x31')](_0x1e72f1[_0x972e('0x30')]);_0x3b7544['filters']=_[_0x972e('0x33')](_0x3b7544['model'],_0x3b7544[_0x972e('0x30')]);_0x300817[_0x972e('0x34')]=_['intersection'](_0x3b7544[_0x972e('0x2f')],qs[_0x972e('0x35')](_0x1e72f1[_0x972e('0x30')][_0x972e('0x35')]));_0x300817[_0x972e('0x34')]=_0x300817[_0x972e('0x34')]['length']?_0x300817[_0x972e('0x34')]:_0x3b7544['model'];_0x300817[_0x972e('0x38')]=qs[_0x972e('0x39')](_0x1e72f1[_0x972e('0x30')][_0x972e('0x39')]);_0x300817[_0x972e('0x3a')]=qs[_0x972e('0x32')](_[_0x972e('0x3b')](_0x1e72f1[_0x972e('0x30')],_0x3b7544[_0x972e('0x32')]));if(_0x1e72f1['query'][_0x972e('0x3c')]){_0x300817['where']=_[_0x972e('0x3d')](_0x300817['where'],{'$or':_[_0x972e('0x2a')](_0x300817['attributes'],function(_0x3abadb){var _0x22b1d4={};_0x22b1d4[_0x3abadb]={'$like':'%'+_0x1e72f1[_0x972e('0x30')][_0x972e('0x3c')]+'%'};return _0x22b1d4;})});}_0x300817=_['merge']({},_0x300817,_0x1e72f1[_0x972e('0x3e')]);return _0x570641['getFields'](_0x300817);}})['then'](function(_0x3f6c8e){if(_0x3f6c8e){_0x35e1e3=_0x3f6c8e[_0x972e('0x43')];if(!_0x1e72f1[_0x972e('0x30')]['hasOwnProperty'](_0x972e('0x37'))){_0x300817[_0x972e('0x1b')]=qs['limit'](_0x1e72f1[_0x972e('0x30')][_0x972e('0x1b')]);_0x300817[_0x972e('0x1a')]=qs[_0x972e('0x1a')](_0x1e72f1[_0x972e('0x30')][_0x972e('0x1a')]);}return _0x570641[_0x972e('0x4d')](_0x300817);}})[_0x972e('0x23')](function(_0x521946){if(_0x521946){return _0x521946?{'count':_0x35e1e3,'rows':_0x521946}:null;}})[_0x972e('0x23')](respondWithResult(_0x22baef,null))['catch'](handleError(_0x22baef,null));}; \ No newline at end of file +var _0x71a7=['moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','stack','name','index','map','FreshsalesConfiguration','fieldName','key','model','keys','query','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','rawAttributes','intersection','find','catch','create','body','findOne','FreshsalesField','length','getSubjects','getDescriptions','params','getFields','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x71a7,0x1c4));var _0x771a=function(_0x2fe131,_0x639a61){_0x2fe131=_0x2fe131-0x0;var _0x39d363=_0x71a7[_0x2fe131];return _0x39d363;};'use strict';var emlformat=require(_0x771a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x771a('0x1'));var jsonpatch=require(_0x771a('0x2'));var rp=require(_0x771a('0x3'));var moment=require(_0x771a('0x4'));var BPromise=require(_0x771a('0x5'));var Mustache=require(_0x771a('0x6'));var util=require('util');var path=require(_0x771a('0x7'));var sox=require(_0x771a('0x8'));var csv=require(_0x771a('0x9'));var ejs=require(_0x771a('0xa'));var fs=require('fs');var fs_extra=require(_0x771a('0xb'));var _=require('lodash');var squel=require(_0x771a('0xc'));var crypto=require('crypto');var jsforce=require(_0x771a('0xd'));var deskjs=require(_0x771a('0xe'));var toCsv=require(_0x771a('0x9'));var querystring=require('querystring');var Papa=require(_0x771a('0xf'));var Redis=require(_0x771a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x771a('0x11'));var as=require(_0x771a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x771a('0x13'))(_0x771a('0x14'));var utils=require(_0x771a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x771a('0x16'));var db=require(_0x771a('0x17'))['db'];function respondWithStatusCode(_0x2a0a02,_0x5805f3){_0x5805f3=_0x5805f3||0xcc;return function(_0x3ecbc6){if(_0x3ecbc6){return _0x2a0a02[_0x771a('0x18')](_0x5805f3);}return _0x2a0a02[_0x771a('0x19')](_0x5805f3)[_0x771a('0x1a')]();};}function respondWithResult(_0x348838,_0x2f3f24){_0x2f3f24=_0x2f3f24||0xc8;return function(_0x4cddfd){if(_0x4cddfd){return _0x348838[_0x771a('0x19')](_0x2f3f24)[_0x771a('0x1b')](_0x4cddfd);}};}function respondWithFilteredResult(_0x873ef0,_0x8826ea){return function(_0x2461c2){if(_0x2461c2){var _0x43fa43=typeof _0x8826ea[_0x771a('0x1c')]===_0x771a('0x1d')&&typeof _0x8826ea[_0x771a('0x1e')]==='undefined';var _0x5c9d9b=_0x2461c2[_0x771a('0x1f')];var _0x562416=_0x43fa43?0x0:_0x8826ea[_0x771a('0x1c')];var _0x31eaf1=_0x43fa43?_0x2461c2[_0x771a('0x1f')]:_0x8826ea['offset']+_0x8826ea[_0x771a('0x1e')];var _0x45d4db;if(_0x31eaf1>=_0x5c9d9b){_0x31eaf1=_0x5c9d9b;_0x45d4db=0xc8;}else{_0x45d4db=0xce;}_0x873ef0[_0x771a('0x19')](_0x45d4db);return _0x873ef0['set']('Content-Range',_0x562416+'-'+_0x31eaf1+'/'+_0x5c9d9b)[_0x771a('0x1b')](_0x2461c2);}return null;};}function patchUpdates(_0x581d6c){return function(_0x5d3bf2){try{jsonpatch[_0x771a('0x20')](_0x5d3bf2,_0x581d6c,!![]);}catch(_0x2f6862){return BPromise['reject'](_0x2f6862);}return _0x5d3bf2[_0x771a('0x21')]();};}function saveUpdates(_0x4c62dd,_0x496951){return function(_0x200744){if(_0x200744){return _0x200744[_0x771a('0x22')](_0x4c62dd)[_0x771a('0x23')](function(_0x538948){return _0x538948;});}return null;};}function removeEntity(_0x12fea9,_0x3d2c85){return function(_0x29647c){if(_0x29647c){return _0x29647c[_0x771a('0x24')]()[_0x771a('0x23')](function(){_0x12fea9[_0x771a('0x19')](0xcc)[_0x771a('0x1a')]();});}};}function handleEntityNotFound(_0x2b32f7,_0x5a1bf3){return function(_0x3f957e){if(!_0x3f957e){_0x2b32f7['sendStatus'](0x194);}return _0x3f957e;};}function handleError(_0x3b3b08,_0x443895){_0x443895=_0x443895||0x1f4;return function(_0x5a73e1){logger['error'](_0x5a73e1[_0x771a('0x25')]);if(_0x5a73e1[_0x771a('0x26')]){delete _0x5a73e1['name'];}_0x3b3b08[_0x771a('0x19')](_0x443895)['send'](_0x5a73e1);};}exports[_0x771a('0x27')]=function(_0x4cf547,_0x4261b6){var _0x20fc23={},_0x4ae636={},_0x226e3b={'count':0x0,'rows':[]};var _0x269314=_[_0x771a('0x28')](db[_0x771a('0x29')]['rawAttributes'],function(_0x50b12b){return{'name':_0x50b12b[_0x771a('0x2a')],'type':_0x50b12b['type'][_0x771a('0x2b')]};});_0x4ae636[_0x771a('0x2c')]=_[_0x771a('0x28')](_0x269314,_0x771a('0x26'));_0x4ae636['query']=_[_0x771a('0x2d')](_0x4cf547[_0x771a('0x2e')]);_0x4ae636['filters']=_['intersection'](_0x4ae636[_0x771a('0x2c')],_0x4ae636[_0x771a('0x2e')]);_0x20fc23[_0x771a('0x2f')]=_['intersection'](_0x4ae636[_0x771a('0x2c')],qs[_0x771a('0x30')](_0x4cf547[_0x771a('0x2e')][_0x771a('0x30')]));_0x20fc23['attributes']=_0x20fc23[_0x771a('0x2f')]['length']?_0x20fc23[_0x771a('0x2f')]:_0x4ae636[_0x771a('0x2c')];if(!_0x4cf547['query'][_0x771a('0x31')](_0x771a('0x32'))){_0x20fc23['limit']=qs[_0x771a('0x1e')](_0x4cf547[_0x771a('0x2e')][_0x771a('0x1e')]);_0x20fc23['offset']=qs[_0x771a('0x1c')](_0x4cf547[_0x771a('0x2e')][_0x771a('0x1c')]);}_0x20fc23[_0x771a('0x33')]=qs[_0x771a('0x34')](_0x4cf547[_0x771a('0x2e')][_0x771a('0x34')]);_0x20fc23['where']=qs[_0x771a('0x35')](_[_0x771a('0x36')](_0x4cf547[_0x771a('0x2e')],_0x4ae636['filters']),_0x269314);if(_0x4cf547[_0x771a('0x2e')][_0x771a('0x37')]){_0x20fc23['where']=_[_0x771a('0x38')](_0x20fc23[_0x771a('0x39')],{'$or':_[_0x771a('0x28')](_0x269314,function(_0x398841){if(_0x398841['type']!==_0x771a('0x3a')){var _0x47dfa3={};_0x47dfa3[_0x398841['name']]={'$like':'%'+_0x4cf547[_0x771a('0x2e')][_0x771a('0x37')]+'%'};return _0x47dfa3;}})});}_0x20fc23=_[_0x771a('0x38')]({},_0x20fc23,_0x4cf547[_0x771a('0x3b')]);var _0x38b585={'where':_0x20fc23[_0x771a('0x39')]};return db[_0x771a('0x29')][_0x771a('0x1f')](_0x38b585)[_0x771a('0x23')](function(_0x9938e6){_0x226e3b['count']=_0x9938e6;if(_0x4cf547[_0x771a('0x2e')]['includeAll']){_0x20fc23[_0x771a('0x3c')]=[{'all':!![]}];}return db[_0x771a('0x29')][_0x771a('0x3d')](_0x20fc23);})['then'](function(_0x396a9f){_0x226e3b[_0x771a('0x3e')]=_0x396a9f;return _0x226e3b;})[_0x771a('0x23')](respondWithFilteredResult(_0x4261b6,_0x20fc23))['catch'](handleError(_0x4261b6,null));};exports['show']=function(_0x421ae6,_0x119253){var _0x519f65={'raw':![],'where':{'id':_0x421ae6['params']['id']}},_0x2618a2={};_0x2618a2[_0x771a('0x2c')]=_['keys'](db[_0x771a('0x29')][_0x771a('0x3f')]);_0x2618a2[_0x771a('0x2e')]=_['keys'](_0x421ae6[_0x771a('0x2e')]);_0x2618a2[_0x771a('0x35')]=_['intersection'](_0x2618a2['model'],_0x2618a2['query']);_0x519f65['attributes']=_[_0x771a('0x40')](_0x2618a2['model'],qs[_0x771a('0x30')](_0x421ae6[_0x771a('0x2e')][_0x771a('0x30')]));_0x519f65[_0x771a('0x2f')]=_0x519f65[_0x771a('0x2f')]['length']?_0x519f65[_0x771a('0x2f')]:_0x2618a2[_0x771a('0x2c')];if(_0x421ae6[_0x771a('0x2e')]['includeAll']){_0x519f65['include']=[{'all':!![]}];}_0x519f65=_[_0x771a('0x38')]({},_0x519f65,_0x421ae6[_0x771a('0x3b')]);return db['FreshsalesConfiguration'][_0x771a('0x41')](_0x519f65)[_0x771a('0x23')](handleEntityNotFound(_0x119253,null))[_0x771a('0x23')](respondWithResult(_0x119253,null))[_0x771a('0x42')](handleError(_0x119253,null));};exports['create']=function(_0xa76527,_0x87aa08){return db[_0x771a('0x29')][_0x771a('0x43')](_0xa76527['body'],{})['then'](respondWithResult(_0x87aa08,0xc9))[_0x771a('0x42')](handleError(_0x87aa08,null));};exports[_0x771a('0x22')]=function(_0x2ffbc9,_0x5265e5){if(_0x2ffbc9['body']['id']){delete _0x2ffbc9[_0x771a('0x44')]['id'];}return db[_0x771a('0x29')][_0x771a('0x41')]({'where':{'id':_0x2ffbc9['params']['id']}})[_0x771a('0x23')](handleEntityNotFound(_0x5265e5,null))['then'](saveUpdates(_0x2ffbc9[_0x771a('0x44')],null))[_0x771a('0x23')](respondWithResult(_0x5265e5,null))['catch'](handleError(_0x5265e5,null));};exports['destroy']=function(_0x40580f,_0x4eb4f4){return db[_0x771a('0x29')][_0x771a('0x41')]({'where':{'id':_0x40580f['params']['id']}})[_0x771a('0x23')](handleEntityNotFound(_0x4eb4f4,null))['then'](removeEntity(_0x4eb4f4,null))[_0x771a('0x42')](handleError(_0x4eb4f4,null));};exports['getSubjects']=function(_0x13a2b4,_0x2b9168,_0x431d60){var _0x59ba66={};var _0x8df115={};var _0x124259;var _0xbdc793;return db[_0x771a('0x29')][_0x771a('0x45')]({'where':{'id':_0x13a2b4['params']['id']}})[_0x771a('0x23')](handleEntityNotFound(_0x2b9168,null))[_0x771a('0x23')](function(_0x1b7844){if(_0x1b7844){_0x124259=_0x1b7844;_0x8df115[_0x771a('0x2c')]=_[_0x771a('0x2d')](db[_0x771a('0x46')][_0x771a('0x3f')]);_0x8df115[_0x771a('0x2e')]=_[_0x771a('0x2d')](_0x13a2b4[_0x771a('0x2e')]);_0x8df115['filters']=_['intersection'](_0x8df115['model'],_0x8df115[_0x771a('0x2e')]);_0x59ba66[_0x771a('0x2f')]=_[_0x771a('0x40')](_0x8df115[_0x771a('0x2c')],qs[_0x771a('0x30')](_0x13a2b4[_0x771a('0x2e')][_0x771a('0x30')]));_0x59ba66[_0x771a('0x2f')]=_0x59ba66[_0x771a('0x2f')][_0x771a('0x47')]?_0x59ba66[_0x771a('0x2f')]:_0x8df115[_0x771a('0x2c')];_0x59ba66['order']=qs['sort'](_0x13a2b4[_0x771a('0x2e')]['sort']);_0x59ba66[_0x771a('0x39')]=qs[_0x771a('0x35')](_['pick'](_0x13a2b4[_0x771a('0x2e')],_0x8df115[_0x771a('0x35')]));if(_0x13a2b4[_0x771a('0x2e')][_0x771a('0x37')]){_0x59ba66['where']=_[_0x771a('0x38')](_0x59ba66['where'],{'$or':_[_0x771a('0x28')](_0x59ba66[_0x771a('0x2f')],function(_0x5aa9d0){var _0x31b289={};_0x31b289[_0x5aa9d0]={'$like':'%'+_0x13a2b4[_0x771a('0x2e')][_0x771a('0x37')]+'%'};return _0x31b289;})});}_0x59ba66=_['merge']({},_0x59ba66,_0x13a2b4[_0x771a('0x3b')]);return _0x124259[_0x771a('0x48')](_0x59ba66);}})[_0x771a('0x23')](function(_0x3eb47c){if(_0x3eb47c){_0xbdc793=_0x3eb47c[_0x771a('0x47')];if(!_0x13a2b4[_0x771a('0x2e')][_0x771a('0x31')]('nolimit')){_0x59ba66[_0x771a('0x1e')]=qs[_0x771a('0x1e')](_0x13a2b4['query'][_0x771a('0x1e')]);_0x59ba66['offset']=qs[_0x771a('0x1c')](_0x13a2b4[_0x771a('0x2e')]['offset']);}return _0x124259[_0x771a('0x48')](_0x59ba66);}})[_0x771a('0x23')](function(_0x568fae){if(_0x568fae){return _0x568fae?{'count':_0xbdc793,'rows':_0x568fae}:null;}})[_0x771a('0x23')](respondWithResult(_0x2b9168,null))['catch'](handleError(_0x2b9168,null));};exports[_0x771a('0x49')]=function(_0x28d9d3,_0x1f24a6,_0x2fb63a){var _0x1002cd={};var _0x54e0fa={};var _0x2c6639;var _0x54ac7c;return db[_0x771a('0x29')][_0x771a('0x45')]({'where':{'id':_0x28d9d3[_0x771a('0x4a')]['id']}})[_0x771a('0x23')](handleEntityNotFound(_0x1f24a6,null))[_0x771a('0x23')](function(_0xab1ea5){if(_0xab1ea5){_0x2c6639=_0xab1ea5;_0x54e0fa[_0x771a('0x2c')]=_[_0x771a('0x2d')](db[_0x771a('0x46')][_0x771a('0x3f')]);_0x54e0fa[_0x771a('0x2e')]=_[_0x771a('0x2d')](_0x28d9d3[_0x771a('0x2e')]);_0x54e0fa['filters']=_['intersection'](_0x54e0fa[_0x771a('0x2c')],_0x54e0fa[_0x771a('0x2e')]);_0x1002cd[_0x771a('0x2f')]=_[_0x771a('0x40')](_0x54e0fa['model'],qs['fields'](_0x28d9d3[_0x771a('0x2e')]['fields']));_0x1002cd[_0x771a('0x2f')]=_0x1002cd['attributes'][_0x771a('0x47')]?_0x1002cd[_0x771a('0x2f')]:_0x54e0fa[_0x771a('0x2c')];_0x1002cd[_0x771a('0x33')]=qs[_0x771a('0x34')](_0x28d9d3[_0x771a('0x2e')]['sort']);_0x1002cd[_0x771a('0x39')]=qs[_0x771a('0x35')](_[_0x771a('0x36')](_0x28d9d3['query'],_0x54e0fa[_0x771a('0x35')]));if(_0x28d9d3[_0x771a('0x2e')][_0x771a('0x37')]){_0x1002cd[_0x771a('0x39')]=_[_0x771a('0x38')](_0x1002cd[_0x771a('0x39')],{'$or':_[_0x771a('0x28')](_0x1002cd[_0x771a('0x2f')],function(_0x1e8226){var _0x16e7c0={};_0x16e7c0[_0x1e8226]={'$like':'%'+_0x28d9d3[_0x771a('0x2e')]['filter']+'%'};return _0x16e7c0;})});}_0x1002cd=_['merge']({},_0x1002cd,_0x28d9d3['options']);return _0x2c6639['getDescriptions'](_0x1002cd);}})[_0x771a('0x23')](function(_0x17d2a3){if(_0x17d2a3){_0x54ac7c=_0x17d2a3['length'];if(!_0x28d9d3['query'][_0x771a('0x31')](_0x771a('0x32'))){_0x1002cd[_0x771a('0x1e')]=qs[_0x771a('0x1e')](_0x28d9d3[_0x771a('0x2e')][_0x771a('0x1e')]);_0x1002cd[_0x771a('0x1c')]=qs[_0x771a('0x1c')](_0x28d9d3[_0x771a('0x2e')][_0x771a('0x1c')]);}return _0x2c6639[_0x771a('0x49')](_0x1002cd);}})['then'](function(_0x170768){if(_0x170768){return _0x170768?{'count':_0x54ac7c,'rows':_0x170768}:null;}})[_0x771a('0x23')](respondWithResult(_0x1f24a6,null))[_0x771a('0x42')](handleError(_0x1f24a6,null));};exports[_0x771a('0x4b')]=function(_0x5173e3,_0x5e2fe3,_0x5c0d9b){var _0x357c14={};var _0x3d30f5={};var _0x243fd9;var _0x3f9ffb;return db[_0x771a('0x29')][_0x771a('0x45')]({'where':{'id':_0x5173e3[_0x771a('0x4a')]['id']}})[_0x771a('0x23')](handleEntityNotFound(_0x5e2fe3,null))['then'](function(_0x2c9041){if(_0x2c9041){_0x243fd9=_0x2c9041;_0x3d30f5[_0x771a('0x2c')]=_[_0x771a('0x2d')](db['FreshsalesField'][_0x771a('0x3f')]);_0x3d30f5[_0x771a('0x2e')]=_[_0x771a('0x2d')](_0x5173e3[_0x771a('0x2e')]);_0x3d30f5[_0x771a('0x35')]=_[_0x771a('0x40')](_0x3d30f5[_0x771a('0x2c')],_0x3d30f5[_0x771a('0x2e')]);_0x357c14[_0x771a('0x2f')]=_[_0x771a('0x40')](_0x3d30f5[_0x771a('0x2c')],qs['fields'](_0x5173e3[_0x771a('0x2e')][_0x771a('0x30')]));_0x357c14['attributes']=_0x357c14[_0x771a('0x2f')][_0x771a('0x47')]?_0x357c14[_0x771a('0x2f')]:_0x3d30f5[_0x771a('0x2c')];_0x357c14[_0x771a('0x33')]=qs[_0x771a('0x34')](_0x5173e3['query']['sort']);_0x357c14[_0x771a('0x39')]=qs['filters'](_[_0x771a('0x36')](_0x5173e3[_0x771a('0x2e')],_0x3d30f5[_0x771a('0x35')]));if(_0x5173e3[_0x771a('0x2e')][_0x771a('0x37')]){_0x357c14[_0x771a('0x39')]=_[_0x771a('0x38')](_0x357c14['where'],{'$or':_[_0x771a('0x28')](_0x357c14['attributes'],function(_0x4574e0){var _0x398acc={};_0x398acc[_0x4574e0]={'$like':'%'+_0x5173e3[_0x771a('0x2e')]['filter']+'%'};return _0x398acc;})});}_0x357c14=_[_0x771a('0x38')]({},_0x357c14,_0x5173e3[_0x771a('0x3b')]);return _0x243fd9[_0x771a('0x4b')](_0x357c14);}})[_0x771a('0x23')](function(_0x56bf07){if(_0x56bf07){_0x3f9ffb=_0x56bf07['length'];if(!_0x5173e3[_0x771a('0x2e')][_0x771a('0x31')](_0x771a('0x32'))){_0x357c14[_0x771a('0x1e')]=qs['limit'](_0x5173e3['query']['limit']);_0x357c14[_0x771a('0x1c')]=qs[_0x771a('0x1c')](_0x5173e3[_0x771a('0x2e')][_0x771a('0x1c')]);}return _0x243fd9[_0x771a('0x4b')](_0x357c14);}})[_0x771a('0x23')](function(_0x53e69f){if(_0x53e69f){return _0x53e69f?{'count':_0x3f9ffb,'rows':_0x53e69f}:null;}})['then'](respondWithResult(_0x5e2fe3,null))['catch'](handleError(_0x5e2fe3,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 501d20d..9eccd73 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 _0x3ea6=['define','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0x1d5c12,_0x3a49b0){var _0x56edd2=function(_0x5cdf71){while(--_0x5cdf71){_0x1d5c12['push'](_0x1d5c12['shift']());}};_0x56edd2(++_0x3a49b0);}(_0x3ea6,0x17b));var _0x63ea=function(_0x2d3a56,_0x1cea18){_0x2d3a56=_0x2d3a56-0x0;var _0x555fd8=_0x3ea6[_0x2d3a56];return _0x555fd8;};'use strict';var _=require(_0x63ea('0x0'));var util=require(_0x63ea('0x1'));var logger=require(_0x63ea('0x2'))(_0x63ea('0x3'));var moment=require(_0x63ea('0x4'));var BPromise=require(_0x63ea('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x63ea('0x6'));var rimraf=require(_0x63ea('0x7'));var config=require(_0x63ea('0x8'));var attributes=require(_0x63ea('0x9'));module[_0x63ea('0xa')]=function(_0xb642cc,_0x408b3f){return _0xb642cc[_0x63ea('0xb')]('FreshsalesConfiguration',attributes,{'tableName':_0x63ea('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e8c=['./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','api','bluebird','request-promise','path'];(function(_0x22cb5f,_0x2cdd63){var _0x274d36=function(_0x421472){while(--_0x421472){_0x22cb5f['push'](_0x22cb5f['shift']());}};_0x274d36(++_0x2cdd63);}(_0x1e8c,0x13f));var _0xc1e8=function(_0x2c1144,_0x5264a8){_0x2c1144=_0x2c1144-0x0;var _0x147bd2=_0x1e8c[_0x2c1144];return _0x147bd2;};'use strict';var _=require(_0xc1e8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc1e8('0x1'));var moment=require('moment');var BPromise=require(_0xc1e8('0x2'));var rp=require(_0xc1e8('0x3'));var fs=require('fs');var path=require(_0xc1e8('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc1e8('0x5'));module[_0xc1e8('0x6')]=function(_0x2afd01,_0x278332){return _0x2afd01['define'](_0xc1e8('0x7'),attributes,{'tableName':_0xc1e8('0x8'),'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 e4efa46..f565942 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 _0x15e7=['client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x5724b6,_0x16f0b7){var _0x21a96d=function(_0x39a33a){while(--_0x39a33a){_0x5724b6['push'](_0x5724b6['shift']());}};_0x21a96d(++_0x16f0b7);}(_0x15e7,0x1af));var _0x715e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x15e7[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x715e('0x0'));var util=require(_0x715e('0x1'));var moment=require(_0x715e('0x2'));var BPromise=require(_0x715e('0x3'));var rs=require(_0x715e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x715e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x715e('0x6'))(_0x715e('0x7'));var config=require(_0x715e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x715e('0x9')][_0x715e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x158647,_0x2f9b1e,_0x220a66){return new BPromise(function(_0x2cd0f1,_0x11fe96){return client[_0x715e('0xb')](_0x158647,_0x220a66)[_0x715e('0xc')](function(_0x403801){logger[_0x715e('0xd')](_0x715e('0xe'),_0x2f9b1e,'request\x20sent');logger[_0x715e('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x2f9b1e,'request\x20sent',JSON['stringify'](_0x403801));if(_0x403801[_0x715e('0x10')]){if(_0x403801[_0x715e('0x10')][_0x715e('0x11')]===0x1f4){logger[_0x715e('0x10')](_0x715e('0xe'),_0x2f9b1e,_0x403801[_0x715e('0x10')][_0x715e('0x12')]);return _0x11fe96(_0x403801[_0x715e('0x10')][_0x715e('0x12')]);}logger[_0x715e('0x10')](_0x715e('0xe'),_0x2f9b1e,_0x403801[_0x715e('0x10')][_0x715e('0x12')]);return _0x2cd0f1(_0x403801[_0x715e('0x10')]['message']);}else{logger[_0x715e('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2f9b1e,_0x715e('0x13'));_0x2cd0f1(_0x403801[_0x715e('0x14')][_0x715e('0x12')]);}})[_0x715e('0x15')](function(_0x1c8e9d){logger[_0x715e('0x10')](_0x715e('0xe'),_0x2f9b1e,_0x1c8e9d);_0x11fe96(_0x1c8e9d);});});} \ No newline at end of file +var _0x9224=['FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x40c8ec,_0xdd36e0){var _0x284fad=function(_0x292873){while(--_0x292873){_0x40c8ec['push'](_0x40c8ec['shift']());}};_0x284fad(++_0xdd36e0);}(_0x9224,0x144));var _0x4922=function(_0x39535e,_0x26926a){_0x39535e=_0x39535e-0x0;var _0x7e2c3f=_0x9224[_0x39535e];return _0x7e2c3f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4922('0x0'));var BPromise=require(_0x4922('0x1'));var rs=require(_0x4922('0x2'));var fs=require('fs');var Redis=require(_0x4922('0x3'));var db=require(_0x4922('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4922('0x5'))(_0x4922('0x6'));var config=require(_0x4922('0x7'));var jayson=require(_0x4922('0x8'));var client=jayson['client'][_0x4922('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b1176,_0x667244,_0x558b26){return new BPromise(function(_0x103823,_0x23cbcf){return client['request'](_0x5b1176,_0x558b26)[_0x4922('0xa')](function(_0x2c5134){logger[_0x4922('0xb')](_0x4922('0xc'),_0x667244,_0x4922('0xd'));logger['debug'](_0x4922('0xe'),_0x667244,'request\x20sent',JSON[_0x4922('0xf')](_0x2c5134));if(_0x2c5134[_0x4922('0x10')]){if(_0x2c5134[_0x4922('0x10')][_0x4922('0x11')]===0x1f4){logger[_0x4922('0x10')](_0x4922('0xc'),_0x667244,_0x2c5134['error'][_0x4922('0x12')]);return _0x23cbcf(_0x2c5134[_0x4922('0x10')][_0x4922('0x12')]);}logger[_0x4922('0x10')](_0x4922('0xc'),_0x667244,_0x2c5134[_0x4922('0x10')][_0x4922('0x12')]);return _0x103823(_0x2c5134[_0x4922('0x10')][_0x4922('0x12')]);}else{logger['info'](_0x4922('0xc'),_0x667244,_0x4922('0xd'));_0x103823(_0x2c5134[_0x4922('0x13')][_0x4922('0x12')]);}})[_0x4922('0x14')](function(_0x1e73d2){logger['error'](_0x4922('0xc'),_0x667244,_0x1e73d2);_0x23cbcf(_0x1e73d2);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index e9f67af..c63178a 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 _0x3098=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','post','/:id','update','delete','destroy'];(function(_0x53f04f,_0x419aa8){var _0x16a824=function(_0x5712c9){while(--_0x5712c9){_0x53f04f['push'](_0x53f04f['shift']());}};_0x16a824(++_0x419aa8);}(_0x3098,0x86));var _0x8309=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x3098[_0x2c0dc0];return _0x4c0990;};'use strict';var multer=require(_0x8309('0x0'));var util=require(_0x8309('0x1'));var path=require(_0x8309('0x2'));var timeout=require(_0x8309('0x3'));var express=require('express');var router=express[_0x8309('0x4')]();var fs_extra=require(_0x8309('0x5'));var auth=require(_0x8309('0x6'));var interaction=require(_0x8309('0x7'));var config=require(_0x8309('0x8'));var controller=require(_0x8309('0x9'));router[_0x8309('0xa')]('/',auth[_0x8309('0xb')](),controller[_0x8309('0xc')]);router[_0x8309('0xa')]('/:id',auth[_0x8309('0xb')](),controller['show']);router[_0x8309('0xd')]('/',auth[_0x8309('0xb')](),controller['create']);router['put'](_0x8309('0xe'),auth[_0x8309('0xb')](),controller[_0x8309('0xf')]);router[_0x8309('0x10')](_0x8309('0xe'),auth['isAuthenticated'](),controller[_0x8309('0x11')]);module[_0x8309('0x12')]=router; \ No newline at end of file +var _0xdab2=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x195e4a,_0x2e769a){var _0x650a3a=function(_0x24197e){while(--_0x24197e){_0x195e4a['push'](_0x195e4a['shift']());}};_0x650a3a(++_0x2e769a);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2dab('0x0'));var util=require(_0x2dab('0x1'));var path=require('path');var timeout=require(_0x2dab('0x2'));var express=require(_0x2dab('0x3'));var router=express[_0x2dab('0x4')]();var fs_extra=require(_0x2dab('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2dab('0x6'));var config=require(_0x2dab('0x7'));var controller=require(_0x2dab('0x8'));router[_0x2dab('0x9')]('/',auth[_0x2dab('0xa')](),controller[_0x2dab('0xb')]);router[_0x2dab('0x9')](_0x2dab('0xc'),auth[_0x2dab('0xa')](),controller[_0x2dab('0xd')]);router[_0x2dab('0xe')]('/',auth[_0x2dab('0xa')](),controller[_0x2dab('0xf')]);router['put']('/:id',auth[_0x2dab('0xa')](),controller[_0x2dab('0x10')]);router[_0x2dab('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x2dab('0x12')]);module[_0x2dab('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 0d5534e..1d9664f 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 _0x3a2e=['customVariable','keyValue','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x3a2e,0xf8));var _0xe3a2=function(_0x4252c1,_0x1e96c8){_0x4252c1=_0x4252c1-0x0;var _0x5d08d8=_0x3a2e[_0x4252c1];return _0x5d08d8;};'use strict';var Sequelize=require(_0xe3a2('0x0'));module[_0xe3a2('0x1')]={'type':{'type':Sequelize[_0xe3a2('0x2')]('string',_0xe3a2('0x3'),_0xe3a2('0x4'),_0xe3a2('0x5'),'picklist'),'defaultValue':_0xe3a2('0x6')},'content':{'type':Sequelize[_0xe3a2('0x7')]},'key':{'type':Sequelize[_0xe3a2('0x7')]},'keyType':{'type':Sequelize[_0xe3a2('0x2')]('string',_0xe3a2('0x3'),_0xe3a2('0x4'))},'keyContent':{'type':Sequelize[_0xe3a2('0x7')]},'idField':{'type':Sequelize[_0xe3a2('0x7')]},'nameField':{'type':Sequelize[_0xe3a2('0x7')]},'customField':{'type':Sequelize[_0xe3a2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe3a2('0x7')]}}; \ No newline at end of file +var _0x2266=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x1cf6f1,_0x31ee6b){var _0x2327b9=function(_0x1e4031){while(--_0x1e4031){_0x1cf6f1['push'](_0x1cf6f1['shift']());}};_0x2327b9(++_0x31ee6b);}(_0x2266,0xce));var _0x6226=function(_0x5318fc,_0x22b166){_0x5318fc=_0x5318fc-0x0;var _0x5537d6=_0x2266[_0x5318fc];return _0x5537d6;};'use strict';var Sequelize=require(_0x6226('0x0'));module[_0x6226('0x1')]={'type':{'type':Sequelize[_0x6226('0x2')]('string',_0x6226('0x3'),_0x6226('0x4'),_0x6226('0x5'),_0x6226('0x6')),'defaultValue':_0x6226('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6226('0x8')]},'keyType':{'type':Sequelize[_0x6226('0x2')](_0x6226('0x7'),_0x6226('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6226('0x8')]},'nameField':{'type':Sequelize[_0x6226('0x8')]},'customField':{'type':Sequelize[_0x6226('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6226('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 1bb84b5..69b7d2f 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 _0xbdaf=['save','update','then','destroy','end','error','stack','name','send','FreshsalesField','rawAttributes','type','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xbdaf,0x193));var _0xfbda=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xbdaf[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0xfbda('0x0'));var rimraf=require(_0xfbda('0x1'));var zipdir=require(_0xfbda('0x2'));var jsonpatch=require(_0xfbda('0x3'));var rp=require(_0xfbda('0x4'));var moment=require(_0xfbda('0x5'));var BPromise=require(_0xfbda('0x6'));var Mustache=require(_0xfbda('0x7'));var util=require(_0xfbda('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xfbda('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfbda('0xa'));var squel=require('squel');var crypto=require(_0xfbda('0xb'));var jsforce=require(_0xfbda('0xc'));var deskjs=require(_0xfbda('0xd'));var toCsv=require(_0xfbda('0x9'));var querystring=require(_0xfbda('0xe'));var Papa=require(_0xfbda('0xf'));var Redis=require(_0xfbda('0x10'));var authService=require(_0xfbda('0x11'));var qs=require(_0xfbda('0x12'));var as=require(_0xfbda('0x13'));var hardwareService=require(_0xfbda('0x14'));var logger=require('../../config/logger')(_0xfbda('0x15'));var utils=require('../../config/utils');var config=require(_0xfbda('0x16'));var licenseUtil=require(_0xfbda('0x17'));var db=require(_0xfbda('0x18'))['db'];function respondWithStatusCode(_0x16a3cd,_0x5ac589){_0x5ac589=_0x5ac589||0xcc;return function(_0x470069){if(_0x470069){return _0x16a3cd[_0xfbda('0x19')](_0x5ac589);}return _0x16a3cd[_0xfbda('0x1a')](_0x5ac589)['end']();};}function respondWithResult(_0x39dd86,_0x4ae594){_0x4ae594=_0x4ae594||0xc8;return function(_0x179041){if(_0x179041){return _0x39dd86[_0xfbda('0x1a')](_0x4ae594)[_0xfbda('0x1b')](_0x179041);}};}function respondWithFilteredResult(_0x48e01d,_0x27d0ad){return function(_0x4932c9){if(_0x4932c9){var _0xc835f0=typeof _0x27d0ad[_0xfbda('0x1c')]===_0xfbda('0x1d')&&typeof _0x27d0ad[_0xfbda('0x1e')]===_0xfbda('0x1d');var _0x1fe738=_0x4932c9[_0xfbda('0x1f')];var _0x1c056b=_0xc835f0?0x0:_0x27d0ad[_0xfbda('0x1c')];var _0x30c201=_0xc835f0?_0x4932c9['count']:_0x27d0ad[_0xfbda('0x1c')]+_0x27d0ad[_0xfbda('0x1e')];var _0x4947d4;if(_0x30c201>=_0x1fe738){_0x30c201=_0x1fe738;_0x4947d4=0xc8;}else{_0x4947d4=0xce;}_0x48e01d[_0xfbda('0x1a')](_0x4947d4);return _0x48e01d[_0xfbda('0x20')](_0xfbda('0x21'),_0x1c056b+'-'+_0x30c201+'/'+_0x1fe738)[_0xfbda('0x1b')](_0x4932c9);}return null;};}function patchUpdates(_0x4ef3dc){return function(_0x5bb120){try{jsonpatch['apply'](_0x5bb120,_0x4ef3dc,!![]);}catch(_0x2630ac){return BPromise[_0xfbda('0x22')](_0x2630ac);}return _0x5bb120[_0xfbda('0x23')]();};}function saveUpdates(_0x6a6406,_0x594300){return function(_0x4e0233){if(_0x4e0233){return _0x4e0233[_0xfbda('0x24')](_0x6a6406)[_0xfbda('0x25')](function(_0x38ef29){return _0x38ef29;});}return null;};}function removeEntity(_0x5969cf,_0x5e6f09){return function(_0x6ec6ee){if(_0x6ec6ee){return _0x6ec6ee[_0xfbda('0x26')]()['then'](function(){_0x5969cf['status'](0xcc)[_0xfbda('0x27')]();});}};}function handleEntityNotFound(_0x32c330,_0x563b78){return function(_0x338791){if(!_0x338791){_0x32c330[_0xfbda('0x19')](0x194);}return _0x338791;};}function handleError(_0x2ef573,_0x3415a5){_0x3415a5=_0x3415a5||0x1f4;return function(_0x49a6d6){logger[_0xfbda('0x28')](_0x49a6d6[_0xfbda('0x29')]);if(_0x49a6d6[_0xfbda('0x2a')]){delete _0x49a6d6['name'];}_0x2ef573[_0xfbda('0x1a')](_0x3415a5)[_0xfbda('0x2b')](_0x49a6d6);};}exports['index']=function(_0x42f9d4,_0xf4a350){var _0x1c1e51={},_0x185c2a={},_0x44b277={'count':0x0,'rows':[]};var _0x5e72f8=_['map'](db[_0xfbda('0x2c')][_0xfbda('0x2d')],function(_0x35c761){return{'name':_0x35c761['fieldName'],'type':_0x35c761[_0xfbda('0x2e')]['key']};});_0x185c2a['model']=_[_0xfbda('0x2f')](_0x5e72f8,_0xfbda('0x2a'));_0x185c2a[_0xfbda('0x30')]=_['keys'](_0x42f9d4[_0xfbda('0x30')]);_0x185c2a[_0xfbda('0x31')]=_[_0xfbda('0x32')](_0x185c2a[_0xfbda('0x33')],_0x185c2a['query']);_0x1c1e51[_0xfbda('0x34')]=_['intersection'](_0x185c2a['model'],qs[_0xfbda('0x35')](_0x42f9d4['query'][_0xfbda('0x35')]));_0x1c1e51[_0xfbda('0x34')]=_0x1c1e51[_0xfbda('0x34')]['length']?_0x1c1e51[_0xfbda('0x34')]:_0x185c2a['model'];if(!_0x42f9d4[_0xfbda('0x30')][_0xfbda('0x36')](_0xfbda('0x37'))){_0x1c1e51[_0xfbda('0x1e')]=qs[_0xfbda('0x1e')](_0x42f9d4['query'][_0xfbda('0x1e')]);_0x1c1e51[_0xfbda('0x1c')]=qs[_0xfbda('0x1c')](_0x42f9d4[_0xfbda('0x30')][_0xfbda('0x1c')]);}_0x1c1e51[_0xfbda('0x38')]=qs[_0xfbda('0x39')](_0x42f9d4[_0xfbda('0x30')]['sort']);_0x1c1e51[_0xfbda('0x3a')]=qs[_0xfbda('0x31')](_['pick'](_0x42f9d4['query'],_0x185c2a['filters']),_0x5e72f8);if(_0x42f9d4[_0xfbda('0x30')][_0xfbda('0x3b')]){_0x1c1e51[_0xfbda('0x3a')]=_[_0xfbda('0x3c')](_0x1c1e51[_0xfbda('0x3a')],{'$or':_[_0xfbda('0x2f')](_0x5e72f8,function(_0x1ea789){if(_0x1ea789[_0xfbda('0x2e')]!=='VIRTUAL'){var _0x25b9ec={};_0x25b9ec[_0x1ea789[_0xfbda('0x2a')]]={'$like':'%'+_0x42f9d4['query'][_0xfbda('0x3b')]+'%'};return _0x25b9ec;}})});}_0x1c1e51=_[_0xfbda('0x3c')]({},_0x1c1e51,_0x42f9d4[_0xfbda('0x3d')]);var _0x26fd23={'where':_0x1c1e51[_0xfbda('0x3a')]};return db[_0xfbda('0x2c')][_0xfbda('0x1f')](_0x26fd23)[_0xfbda('0x25')](function(_0x13bd8d){_0x44b277[_0xfbda('0x1f')]=_0x13bd8d;if(_0x42f9d4[_0xfbda('0x30')][_0xfbda('0x3e')]){_0x1c1e51[_0xfbda('0x3f')]=[{'all':!![]}];}return db[_0xfbda('0x2c')][_0xfbda('0x40')](_0x1c1e51);})[_0xfbda('0x25')](function(_0x4354ac){_0x44b277[_0xfbda('0x41')]=_0x4354ac;return _0x44b277;})[_0xfbda('0x25')](respondWithFilteredResult(_0xf4a350,_0x1c1e51))[_0xfbda('0x42')](handleError(_0xf4a350,null));};exports[_0xfbda('0x43')]=function(_0x4ce319,_0x4a6e1e){var _0xef1491={'raw':!![],'where':{'id':_0x4ce319['params']['id']}},_0x5608b9={};_0x5608b9[_0xfbda('0x33')]=_[_0xfbda('0x44')](db[_0xfbda('0x2c')][_0xfbda('0x2d')]);_0x5608b9[_0xfbda('0x30')]=_[_0xfbda('0x44')](_0x4ce319[_0xfbda('0x30')]);_0x5608b9[_0xfbda('0x31')]=_[_0xfbda('0x32')](_0x5608b9[_0xfbda('0x33')],_0x5608b9['query']);_0xef1491[_0xfbda('0x34')]=_[_0xfbda('0x32')](_0x5608b9[_0xfbda('0x33')],qs[_0xfbda('0x35')](_0x4ce319['query'][_0xfbda('0x35')]));_0xef1491[_0xfbda('0x34')]=_0xef1491['attributes']['length']?_0xef1491[_0xfbda('0x34')]:_0x5608b9[_0xfbda('0x33')];if(_0x4ce319['query'][_0xfbda('0x3e')]){_0xef1491[_0xfbda('0x3f')]=[{'all':!![]}];}_0xef1491=_[_0xfbda('0x3c')]({},_0xef1491,_0x4ce319[_0xfbda('0x3d')]);return db[_0xfbda('0x2c')][_0xfbda('0x45')](_0xef1491)[_0xfbda('0x25')](handleEntityNotFound(_0x4a6e1e,null))[_0xfbda('0x25')](respondWithResult(_0x4a6e1e,null))['catch'](handleError(_0x4a6e1e,null));};exports[_0xfbda('0x46')]=function(_0x36412c,_0x21037d){return db[_0xfbda('0x2c')][_0xfbda('0x46')](_0x36412c[_0xfbda('0x47')],{})[_0xfbda('0x25')](respondWithResult(_0x21037d,0xc9))['catch'](handleError(_0x21037d,null));};exports['update']=function(_0x481026,_0xf29643){if(_0x481026[_0xfbda('0x47')]['id']){delete _0x481026[_0xfbda('0x47')]['id'];}return db[_0xfbda('0x2c')][_0xfbda('0x45')]({'where':{'id':_0x481026[_0xfbda('0x48')]['id']}})[_0xfbda('0x25')](handleEntityNotFound(_0xf29643,null))['then'](saveUpdates(_0x481026[_0xfbda('0x47')],null))['then'](respondWithResult(_0xf29643,null))['catch'](handleError(_0xf29643,null));};exports[_0xfbda('0x26')]=function(_0x1f91fc,_0x5baf1a){return db[_0xfbda('0x2c')][_0xfbda('0x45')]({'where':{'id':_0x1f91fc['params']['id']}})[_0xfbda('0x25')](handleEntityNotFound(_0x5baf1a,null))[_0xfbda('0x25')](removeEntity(_0x5baf1a,null))[_0xfbda('0x42')](handleError(_0x5baf1a,null));}; \ No newline at end of file +var _0x5840=['include','find','create','body','eml-format','rimraf','request-promise','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','reject','save','update','then','destroy','error','stack','name','send','map','FreshsalesField','fieldName','type','key','model','query','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','fields'];(function(_0x4fb1b4,_0x7f1fb9){var _0x1cfdab=function(_0x44162d){while(--_0x44162d){_0x4fb1b4['push'](_0x4fb1b4['shift']());}};_0x1cfdab(++_0x7f1fb9);}(_0x5840,0x1a2));var _0x0584=function(_0x467f4c,_0x5c99e1){_0x467f4c=_0x467f4c-0x0;var _0x557ea7=_0x5840[_0x467f4c];return _0x557ea7;};'use strict';var emlformat=require(_0x0584('0x0'));var rimraf=require(_0x0584('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0584('0x2'));var moment=require('moment');var BPromise=require(_0x0584('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0584('0x4'));var csv=require(_0x0584('0x5'));var ejs=require(_0x0584('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0584('0x7'));var squel=require(_0x0584('0x8'));var crypto=require(_0x0584('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0584('0xa'));var toCsv=require('to-csv');var querystring=require(_0x0584('0xb'));var Papa=require(_0x0584('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0584('0xd'));var as=require(_0x0584('0xe'));var hardwareService=require(_0x0584('0xf'));var logger=require(_0x0584('0x10'))(_0x0584('0x11'));var utils=require('../../config/utils');var config=require(_0x0584('0x12'));var licenseUtil=require(_0x0584('0x13'));var db=require(_0x0584('0x14'))['db'];function respondWithStatusCode(_0x553192,_0x3db78f){_0x3db78f=_0x3db78f||0xcc;return function(_0x26f0f7){if(_0x26f0f7){return _0x553192[_0x0584('0x15')](_0x3db78f);}return _0x553192[_0x0584('0x16')](_0x3db78f)[_0x0584('0x17')]();};}function respondWithResult(_0xa38061,_0x323c45){_0x323c45=_0x323c45||0xc8;return function(_0x5c087e){if(_0x5c087e){return _0xa38061[_0x0584('0x16')](_0x323c45)['json'](_0x5c087e);}};}function respondWithFilteredResult(_0x103882,_0x31f468){return function(_0x5f2e55){if(_0x5f2e55){var _0x3f7c25=typeof _0x31f468[_0x0584('0x18')]===_0x0584('0x19')&&typeof _0x31f468[_0x0584('0x1a')]===_0x0584('0x19');var _0x26c3fd=_0x5f2e55[_0x0584('0x1b')];var _0x5dc607=_0x3f7c25?0x0:_0x31f468[_0x0584('0x18')];var _0x694871=_0x3f7c25?_0x5f2e55[_0x0584('0x1b')]:_0x31f468['offset']+_0x31f468[_0x0584('0x1a')];var _0x5bc89c;if(_0x694871>=_0x26c3fd){_0x694871=_0x26c3fd;_0x5bc89c=0xc8;}else{_0x5bc89c=0xce;}_0x103882['status'](_0x5bc89c);return _0x103882['set']('Content-Range',_0x5dc607+'-'+_0x694871+'/'+_0x26c3fd)[_0x0584('0x1c')](_0x5f2e55);}return null;};}function patchUpdates(_0x1cbe09){return function(_0x121944){try{jsonpatch['apply'](_0x121944,_0x1cbe09,!![]);}catch(_0x1928ae){return BPromise[_0x0584('0x1d')](_0x1928ae);}return _0x121944[_0x0584('0x1e')]();};}function saveUpdates(_0xb7a804,_0x53fba3){return function(_0x212972){if(_0x212972){return _0x212972[_0x0584('0x1f')](_0xb7a804)[_0x0584('0x20')](function(_0x2b9627){return _0x2b9627;});}return null;};}function removeEntity(_0x388ecc,_0x2dfb3b){return function(_0x101f54){if(_0x101f54){return _0x101f54[_0x0584('0x21')]()[_0x0584('0x20')](function(){_0x388ecc[_0x0584('0x16')](0xcc)[_0x0584('0x17')]();});}};}function handleEntityNotFound(_0x4a2214,_0x3d4020){return function(_0x44e696){if(!_0x44e696){_0x4a2214[_0x0584('0x15')](0x194);}return _0x44e696;};}function handleError(_0x1d1f7b,_0x920d54){_0x920d54=_0x920d54||0x1f4;return function(_0x1e7788){logger[_0x0584('0x22')](_0x1e7788[_0x0584('0x23')]);if(_0x1e7788[_0x0584('0x24')]){delete _0x1e7788[_0x0584('0x24')];}_0x1d1f7b[_0x0584('0x16')](_0x920d54)[_0x0584('0x25')](_0x1e7788);};}exports['index']=function(_0x1905e3,_0x2704a7){var _0x1d57f1={},_0x27f257={},_0x3667ff={'count':0x0,'rows':[]};var _0x32262b=_[_0x0584('0x26')](db[_0x0584('0x27')]['rawAttributes'],function(_0xfbb08b){return{'name':_0xfbb08b[_0x0584('0x28')],'type':_0xfbb08b[_0x0584('0x29')][_0x0584('0x2a')]};});_0x27f257[_0x0584('0x2b')]=_['map'](_0x32262b,'name');_0x27f257[_0x0584('0x2c')]=_['keys'](_0x1905e3[_0x0584('0x2c')]);_0x27f257['filters']=_[_0x0584('0x2d')](_0x27f257[_0x0584('0x2b')],_0x27f257[_0x0584('0x2c')]);_0x1d57f1[_0x0584('0x2e')]=_['intersection'](_0x27f257['model'],qs['fields'](_0x1905e3[_0x0584('0x2c')]['fields']));_0x1d57f1[_0x0584('0x2e')]=_0x1d57f1[_0x0584('0x2e')][_0x0584('0x2f')]?_0x1d57f1[_0x0584('0x2e')]:_0x27f257[_0x0584('0x2b')];if(!_0x1905e3[_0x0584('0x2c')]['hasOwnProperty']('nolimit')){_0x1d57f1[_0x0584('0x1a')]=qs[_0x0584('0x1a')](_0x1905e3[_0x0584('0x2c')]['limit']);_0x1d57f1['offset']=qs['offset'](_0x1905e3['query'][_0x0584('0x18')]);}_0x1d57f1[_0x0584('0x30')]=qs[_0x0584('0x31')](_0x1905e3[_0x0584('0x2c')][_0x0584('0x31')]);_0x1d57f1[_0x0584('0x32')]=qs['filters'](_[_0x0584('0x33')](_0x1905e3[_0x0584('0x2c')],_0x27f257['filters']),_0x32262b);if(_0x1905e3['query'][_0x0584('0x34')]){_0x1d57f1[_0x0584('0x32')]=_[_0x0584('0x35')](_0x1d57f1[_0x0584('0x32')],{'$or':_[_0x0584('0x26')](_0x32262b,function(_0x325b3d){if(_0x325b3d[_0x0584('0x29')]!==_0x0584('0x36')){var _0x411fb1={};_0x411fb1[_0x325b3d[_0x0584('0x24')]]={'$like':'%'+_0x1905e3[_0x0584('0x2c')][_0x0584('0x34')]+'%'};return _0x411fb1;}})});}_0x1d57f1=_[_0x0584('0x35')]({},_0x1d57f1,_0x1905e3[_0x0584('0x37')]);var _0x2fa151={'where':_0x1d57f1[_0x0584('0x32')]};return db[_0x0584('0x27')][_0x0584('0x1b')](_0x2fa151)['then'](function(_0x3d5cdb){_0x3667ff[_0x0584('0x1b')]=_0x3d5cdb;if(_0x1905e3[_0x0584('0x2c')][_0x0584('0x38')]){_0x1d57f1['include']=[{'all':!![]}];}return db['FreshsalesField'][_0x0584('0x39')](_0x1d57f1);})[_0x0584('0x20')](function(_0x43b23f){_0x3667ff[_0x0584('0x3a')]=_0x43b23f;return _0x3667ff;})['then'](respondWithFilteredResult(_0x2704a7,_0x1d57f1))[_0x0584('0x3b')](handleError(_0x2704a7,null));};exports[_0x0584('0x3c')]=function(_0x459e87,_0x294f4e){var _0xe4cdfd={'raw':!![],'where':{'id':_0x459e87[_0x0584('0x3d')]['id']}},_0x4728aa={};_0x4728aa['model']=_[_0x0584('0x3e')](db[_0x0584('0x27')][_0x0584('0x3f')]);_0x4728aa[_0x0584('0x2c')]=_['keys'](_0x459e87['query']);_0x4728aa['filters']=_[_0x0584('0x2d')](_0x4728aa[_0x0584('0x2b')],_0x4728aa[_0x0584('0x2c')]);_0xe4cdfd[_0x0584('0x2e')]=_['intersection'](_0x4728aa[_0x0584('0x2b')],qs[_0x0584('0x40')](_0x459e87[_0x0584('0x2c')][_0x0584('0x40')]));_0xe4cdfd[_0x0584('0x2e')]=_0xe4cdfd[_0x0584('0x2e')][_0x0584('0x2f')]?_0xe4cdfd[_0x0584('0x2e')]:_0x4728aa[_0x0584('0x2b')];if(_0x459e87[_0x0584('0x2c')][_0x0584('0x38')]){_0xe4cdfd[_0x0584('0x41')]=[{'all':!![]}];}_0xe4cdfd=_[_0x0584('0x35')]({},_0xe4cdfd,_0x459e87[_0x0584('0x37')]);return db['FreshsalesField'][_0x0584('0x42')](_0xe4cdfd)[_0x0584('0x20')](handleEntityNotFound(_0x294f4e,null))[_0x0584('0x20')](respondWithResult(_0x294f4e,null))[_0x0584('0x3b')](handleError(_0x294f4e,null));};exports['create']=function(_0x425d71,_0x3a9d90){return db[_0x0584('0x27')][_0x0584('0x43')](_0x425d71[_0x0584('0x44')],{})[_0x0584('0x20')](respondWithResult(_0x3a9d90,0xc9))[_0x0584('0x3b')](handleError(_0x3a9d90,null));};exports[_0x0584('0x1f')]=function(_0xa67bb3,_0x27af9e){if(_0xa67bb3[_0x0584('0x44')]['id']){delete _0xa67bb3[_0x0584('0x44')]['id'];}return db[_0x0584('0x27')][_0x0584('0x42')]({'where':{'id':_0xa67bb3[_0x0584('0x3d')]['id']}})[_0x0584('0x20')](handleEntityNotFound(_0x27af9e,null))['then'](saveUpdates(_0xa67bb3[_0x0584('0x44')],null))[_0x0584('0x20')](respondWithResult(_0x27af9e,null))[_0x0584('0x3b')](handleError(_0x27af9e,null));};exports[_0x0584('0x21')]=function(_0x3e80f8,_0x125a3f){return db['FreshsalesField'][_0x0584('0x42')]({'where':{'id':_0x3e80f8[_0x0584('0x3d')]['id']}})[_0x0584('0x20')](handleEntityNotFound(_0x125a3f,null))[_0x0584('0x20')](removeEntity(_0x125a3f,null))[_0x0584('0x3b')](handleError(_0x125a3f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 7782298..6343a2b 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 _0x6e1c=['idField','FieldId','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0xc708d,_0x47d061){var _0x2d365c=function(_0x54ed23){while(--_0x54ed23){_0xc708d['push'](_0xc708d['shift']());}};_0x2d365c(++_0x47d061);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e1c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc6e1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc6e1('0x1'));var moment=require(_0xc6e1('0x2'));var BPromise=require(_0xc6e1('0x3'));var rp=require(_0xc6e1('0x4'));var fs=require('fs');var path=require(_0xc6e1('0x5'));var rimraf=require(_0xc6e1('0x6'));var config=require(_0xc6e1('0x7'));var attributes=require(_0xc6e1('0x8'));module[_0xc6e1('0x9')]=function(_0x3e2d6c,_0x468a80){return _0x3e2d6c['define'](_0xc6e1('0xa'),attributes,{'tableName':_0xc6e1('0xb'),'paranoid':![],'indexes':[{'name':_0xc6e1('0xc'),'fields':[_0xc6e1('0xd'),_0xc6e1('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc2a2=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','idField'];(function(_0xa4ee36,_0x2a389c){var _0x455c5c=function(_0x3abaf9){while(--_0x3abaf9){_0xa4ee36['push'](_0xa4ee36['shift']());}};_0x455c5c(++_0x2a389c);}(_0xc2a2,0x84));var _0x2c2a=function(_0x36b210,_0x2e38f6){_0x36b210=_0x36b210-0x0;var _0x41fb37=_0xc2a2[_0x36b210];return _0x41fb37;};'use strict';var _=require(_0x2c2a('0x0'));var util=require(_0x2c2a('0x1'));var logger=require(_0x2c2a('0x2'))(_0x2c2a('0x3'));var moment=require('moment');var BPromise=require(_0x2c2a('0x4'));var rp=require(_0x2c2a('0x5'));var fs=require('fs');var path=require(_0x2c2a('0x6'));var rimraf=require('rimraf');var config=require(_0x2c2a('0x7'));var attributes=require(_0x2c2a('0x8'));module[_0x2c2a('0x9')]=function(_0x17db27,_0x51c919){return _0x17db27['define']('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x2c2a('0xa'),'FieldId'],'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 1e31688..d46267f 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 _0xf61e=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x12c4c4,_0xeda2c5){var _0x51256b=function(_0x4e853e){while(--_0x4e853e){_0x12c4c4['push'](_0x12c4c4['shift']());}};_0x51256b(++_0xeda2c5);}(_0xf61e,0x191));var _0xef61=function(_0xa95e56,_0x1fbc35){_0xa95e56=_0xa95e56-0x0;var _0x15ee4b=_0xf61e[_0xa95e56];return _0x15ee4b;};'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});function respondWithRpcPromise(_0x3e2f79,_0x4f0cc5,_0x2242a7){return new BPromise(function(_0x277fa1,_0x106e7f){return client['request'](_0x3e2f79,_0x2242a7)['then'](function(_0x188894){logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));logger[_0xef61('0x10')](_0xef61('0x11'),_0x4f0cc5,_0xef61('0xf'),JSON[_0xef61('0x12')](_0x188894));if(_0x188894[_0xef61('0x13')]){if(_0x188894[_0xef61('0x13')][_0xef61('0x14')]===0x1f4){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')]['message']);return _0x106e7f(_0x188894[_0xef61('0x13')]['message']);}logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')][_0xef61('0x15')]);return _0x277fa1(_0x188894['error'][_0xef61('0x15')]);}else{logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));_0x277fa1(_0x188894['result'][_0xef61('0x15')]);}})[_0xef61('0x16')](function(_0x4f7a62){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x4f7a62);_0x106e7f(_0x4f7a62);});});} \ No newline at end of file +var _0x2675=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis'];(function(_0x174651,_0x357588){var _0x26b458=function(_0x22c9ec){while(--_0x22c9ec){_0x174651['push'](_0x174651['shift']());}};_0x26b458(++_0x357588);}(_0x2675,0x75));var _0x5267=function(_0x2a8a6d,_0x8a0a90){_0x2a8a6d=_0x2a8a6d-0x0;var _0x506998=_0x2675[_0x2a8a6d];return _0x506998;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var Redis=require(_0x5267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('rpc');var config=require(_0x5267('0x5'));var jayson=require(_0x5267('0x6'));var client=jayson[_0x5267('0x7')][_0x5267('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){return client['request'](_0x20f065,_0x527c16)[_0x5267('0x9')](function(_0x5d6645){logger[_0x5267('0xa')](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));logger['debug'](_0x5267('0xd'),_0xc56cd5,'request\x20sent',JSON[_0x5267('0xe')](_0x5d6645));if(_0x5d6645['error']){if(_0x5d6645[_0x5267('0xf')][_0x5267('0x10')]===0x1f4){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x46bfdf(_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);}logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x9e0a27(_0x5d6645[_0x5267('0xf')]['message']);}else{logger['info'](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));_0x9e0a27(_0x5d6645[_0x5267('0x12')][_0x5267('0x11')]);}})[_0x5267('0x13')](function(_0x27e5c6){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x27e5c6);_0x46bfdf(_0x27e5c6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 1a925bd..1f0ee3c 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2bf0f0,_0x3f3e34){var _0x1ec43b=function(_0xbcfc3e){while(--_0xbcfc3e){_0x2bf0f0['push'](_0x2bf0f0['shift']());}};_0x1ec43b(++_0x3f3e34);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x27fbc9,_0x3f97dc){var _0x5b2886=function(_0x107475){while(--_0x107475){_0x27fbc9['push'](_0x27fbc9['shift']());}};_0x5b2886(++_0x3f97dc);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 9bc0ec2..e7769ae 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 _0x7a98=['STRING','username','ENUM','integrationTab','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a98,0x190));var _0x87a9=function(_0x397e33,_0x4ab15b){_0x397e33=_0x397e33-0x0;var _0x4c30f7=_0x7a98[_0x397e33];return _0x4c30f7;};'use strict';var Sequelize=require(_0x87a9('0x0'));module[_0x87a9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x87a9('0x2')],'unique':_0x87a9('0x3')},'remoteUri':{'type':Sequelize[_0x87a9('0x2')]},'password':{'type':Sequelize[_0x87a9('0x2')]},'clientId':{'type':Sequelize[_0x87a9('0x2')]},'clientSecret':{'type':Sequelize[_0x87a9('0x2')]},'securityToken':{'type':Sequelize[_0x87a9('0x2')]},'serverUrl':{'type':Sequelize[_0x87a9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x87a9('0x4')](_0x87a9('0x5'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x4ccb=['STRING','username','ENUM','integrationTab','sequelize','exports'];(function(_0x2e38cd,_0x446de2){var _0x5120c9=function(_0x18768e){while(--_0x18768e){_0x2e38cd['push'](_0x2e38cd['shift']());}};_0x5120c9(++_0x446de2);}(_0x4ccb,0x196));var _0xb4cc=function(_0x13c2a6,_0x418881){_0x13c2a6=_0x13c2a6-0x0;var _0x34279d=_0x4ccb[_0x13c2a6];return _0x34279d;};'use strict';var Sequelize=require(_0xb4cc('0x0'));module[_0xb4cc('0x1')]={'name':{'type':Sequelize[_0xb4cc('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb4cc('0x2')],'unique':_0xb4cc('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb4cc('0x2')]},'clientId':{'type':Sequelize[_0xb4cc('0x2')]},'clientSecret':{'type':Sequelize[_0xb4cc('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb4cc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb4cc('0x4')](_0xb4cc('0x5'),'newTab'),'defaultValue':_0xb4cc('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 0c065e3..f8f75f6 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 _0x21c3=['attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','catch','params','options','find','create','body','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Subjects','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','concat','ticketType','describe','ActivityDate','IsReminderSet','Subject','Description','string','int','picklist','email','textarea','phone','label','custom','picklistValues','value','boolean','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x21c3,0x1a8));var _0x321c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x21c3[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x321c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x321c('0x1'));var jsonpatch=require(_0x321c('0x2'));var rp=require(_0x321c('0x3'));var moment=require(_0x321c('0x4'));var BPromise=require(_0x321c('0x5'));var Mustache=require(_0x321c('0x6'));var util=require('util');var path=require(_0x321c('0x7'));var sox=require(_0x321c('0x8'));var csv=require(_0x321c('0x9'));var ejs=require(_0x321c('0xa'));var fs=require('fs');var fs_extra=require(_0x321c('0xb'));var _=require('lodash');var squel=require(_0x321c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x321c('0xd'));var toCsv=require(_0x321c('0x9'));var querystring=require(_0x321c('0xe'));var Papa=require(_0x321c('0xf'));var Redis=require(_0x321c('0x10'));var authService=require(_0x321c('0x11'));var qs=require(_0x321c('0x12'));var as=require(_0x321c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x321c('0x14'));var utils=require(_0x321c('0x15'));var config=require(_0x321c('0x16'));var licenseUtil=require(_0x321c('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3e9567,_0x2eb458){_0x2eb458=_0x2eb458||0xcc;return function(_0x125129){if(_0x125129){return _0x3e9567[_0x321c('0x18')](_0x2eb458);}return _0x3e9567[_0x321c('0x19')](_0x2eb458)['end']();};}function respondWithResult(_0x58a66a,_0x58afb0){_0x58afb0=_0x58afb0||0xc8;return function(_0x398307){if(_0x398307){return _0x58a66a[_0x321c('0x19')](_0x58afb0)[_0x321c('0x1a')](_0x398307);}};}function respondWithFilteredResult(_0x33c88a,_0x33a57){return function(_0x28f5d2){if(_0x28f5d2){var _0x5aeee1=typeof _0x33a57[_0x321c('0x1b')]==='undefined'&&typeof _0x33a57[_0x321c('0x1c')]===_0x321c('0x1d');var _0x5d1bbc=_0x28f5d2['count'];var _0x5323f5=_0x5aeee1?0x0:_0x33a57[_0x321c('0x1b')];var _0x48c188=_0x5aeee1?_0x28f5d2['count']:_0x33a57[_0x321c('0x1b')]+_0x33a57['limit'];var _0x2d5113;if(_0x48c188>=_0x5d1bbc){_0x48c188=_0x5d1bbc;_0x2d5113=0xc8;}else{_0x2d5113=0xce;}_0x33c88a[_0x321c('0x19')](_0x2d5113);return _0x33c88a['set'](_0x321c('0x1e'),_0x5323f5+'-'+_0x48c188+'/'+_0x5d1bbc)[_0x321c('0x1a')](_0x28f5d2);}return null;};}function patchUpdates(_0x8a4b99){return function(_0x522775){try{jsonpatch[_0x321c('0x1f')](_0x522775,_0x8a4b99,!![]);}catch(_0x465abc){return BPromise[_0x321c('0x20')](_0x465abc);}return _0x522775[_0x321c('0x21')]();};}function saveUpdates(_0x595393,_0x39c548){return function(_0x2b3161){if(_0x2b3161){return _0x2b3161[_0x321c('0x22')](_0x595393)[_0x321c('0x23')](function(_0x20f6fb){return _0x20f6fb;});}return null;};}function removeEntity(_0x5e07cd,_0x1c3f3e){return function(_0x1231b2){if(_0x1231b2){return _0x1231b2[_0x321c('0x24')]()['then'](function(){_0x5e07cd[_0x321c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a1b55,_0x591dd4){return function(_0x58e78){if(!_0x58e78){_0x3a1b55['sendStatus'](0x194);}return _0x58e78;};}function handleError(_0x17f80c,_0x16d15a){_0x16d15a=_0x16d15a||0x1f4;return function(_0x3a9373){logger[_0x321c('0x25')](_0x3a9373['stack']);if(_0x3a9373['name']){delete _0x3a9373[_0x321c('0x26')];}_0x17f80c[_0x321c('0x19')](_0x16d15a)[_0x321c('0x27')](_0x3a9373);};}exports[_0x321c('0x28')]=function(_0xe68328,_0x1d2a0c){var _0x198625={},_0x39194d={},_0x56dcca={'count':0x0,'rows':[]};var _0x3b2561=_[_0x321c('0x29')](db[_0x321c('0x2a')][_0x321c('0x2b')],function(_0x408406){return{'name':_0x408406[_0x321c('0x2c')],'type':_0x408406[_0x321c('0x2d')][_0x321c('0x2e')]};});_0x39194d[_0x321c('0x2f')]=_[_0x321c('0x29')](_0x3b2561,_0x321c('0x26'));_0x39194d[_0x321c('0x30')]=_[_0x321c('0x31')](_0xe68328['query']);_0x39194d[_0x321c('0x32')]=_[_0x321c('0x33')](_0x39194d[_0x321c('0x2f')],_0x39194d['query']);_0x198625[_0x321c('0x34')]=_['intersection'](_0x39194d[_0x321c('0x2f')],qs['fields'](_0xe68328[_0x321c('0x30')][_0x321c('0x35')]));_0x198625[_0x321c('0x34')]=_0x198625[_0x321c('0x34')][_0x321c('0x36')]?_0x198625[_0x321c('0x34')]:_0x39194d['model'];if(!_0xe68328[_0x321c('0x30')][_0x321c('0x37')]('nolimit')){_0x198625[_0x321c('0x1c')]=qs[_0x321c('0x1c')](_0xe68328['query']['limit']);_0x198625[_0x321c('0x1b')]=qs[_0x321c('0x1b')](_0xe68328[_0x321c('0x30')]['offset']);}_0x198625[_0x321c('0x38')]=qs['sort'](_0xe68328[_0x321c('0x30')][_0x321c('0x39')]);_0x198625[_0x321c('0x3a')]=qs['filters'](_[_0x321c('0x3b')](_0xe68328[_0x321c('0x30')],_0x39194d[_0x321c('0x32')]),_0x3b2561);if(_0xe68328[_0x321c('0x30')][_0x321c('0x3c')]){_0x198625[_0x321c('0x3a')]=_[_0x321c('0x3d')](_0x198625[_0x321c('0x3a')],{'$or':_[_0x321c('0x29')](_0x3b2561,function(_0xaecfa4){if(_0xaecfa4['type']!==_0x321c('0x3e')){var _0x2fc1b5={};_0x2fc1b5[_0xaecfa4[_0x321c('0x26')]]={'$like':'%'+_0xe68328[_0x321c('0x30')][_0x321c('0x3c')]+'%'};return _0x2fc1b5;}})});}_0x198625=_[_0x321c('0x3d')]({},_0x198625,_0xe68328['options']);var _0x5663ce={'where':_0x198625[_0x321c('0x3a')]};return db[_0x321c('0x2a')][_0x321c('0x3f')](_0x5663ce)[_0x321c('0x23')](function(_0x554328){_0x56dcca['count']=_0x554328;if(_0xe68328[_0x321c('0x30')][_0x321c('0x40')]){_0x198625[_0x321c('0x41')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x198625);})[_0x321c('0x23')](function(_0x27fd82){_0x56dcca[_0x321c('0x42')]=_0x27fd82;return _0x56dcca;})[_0x321c('0x23')](respondWithFilteredResult(_0x1d2a0c,_0x198625))[_0x321c('0x43')](handleError(_0x1d2a0c,null));};exports['show']=function(_0x20756d,_0x2dbbcb){var _0x29dd33={'raw':![],'where':{'id':_0x20756d[_0x321c('0x44')]['id']}},_0x336f28={};_0x336f28['model']=_[_0x321c('0x31')](db[_0x321c('0x2a')][_0x321c('0x2b')]);_0x336f28[_0x321c('0x30')]=_['keys'](_0x20756d[_0x321c('0x30')]);_0x336f28[_0x321c('0x32')]=_['intersection'](_0x336f28[_0x321c('0x2f')],_0x336f28[_0x321c('0x30')]);_0x29dd33[_0x321c('0x34')]=_[_0x321c('0x33')](_0x336f28[_0x321c('0x2f')],qs['fields'](_0x20756d[_0x321c('0x30')][_0x321c('0x35')]));_0x29dd33[_0x321c('0x34')]=_0x29dd33['attributes'][_0x321c('0x36')]?_0x29dd33[_0x321c('0x34')]:_0x336f28[_0x321c('0x2f')];if(_0x20756d[_0x321c('0x30')][_0x321c('0x40')]){_0x29dd33[_0x321c('0x41')]=[{'all':!![]}];}_0x29dd33=_[_0x321c('0x3d')]({},_0x29dd33,_0x20756d[_0x321c('0x45')]);return db[_0x321c('0x2a')][_0x321c('0x46')](_0x29dd33)[_0x321c('0x23')](handleEntityNotFound(_0x2dbbcb,null))[_0x321c('0x23')](respondWithResult(_0x2dbbcb,null))[_0x321c('0x43')](handleError(_0x2dbbcb,null));};exports[_0x321c('0x47')]=function(_0x375fe0,_0x5eff45){return db[_0x321c('0x2a')][_0x321c('0x47')](_0x375fe0[_0x321c('0x48')],{})[_0x321c('0x23')](respondWithResult(_0x5eff45,0xc9))[_0x321c('0x43')](handleError(_0x5eff45,null));};exports['update']=function(_0x51b179,_0x141d58){if(_0x51b179[_0x321c('0x48')]['id']){delete _0x51b179[_0x321c('0x48')]['id'];}return db['SalesforceAccount'][_0x321c('0x46')]({'where':{'id':_0x51b179[_0x321c('0x44')]['id']}})[_0x321c('0x23')](handleEntityNotFound(_0x141d58,null))[_0x321c('0x23')](saveUpdates(_0x51b179['body'],null))[_0x321c('0x23')](respondWithResult(_0x141d58,null))[_0x321c('0x43')](handleError(_0x141d58,null));};exports[_0x321c('0x24')]=function(_0x32375e,_0x25c726){return db[_0x321c('0x2a')]['find']({'where':{'id':_0x32375e[_0x321c('0x44')]['id']}})['then'](handleEntityNotFound(_0x25c726,null))[_0x321c('0x23')](removeEntity(_0x25c726,null))[_0x321c('0x43')](handleError(_0x25c726,null));};exports[_0x321c('0x49')]=function(_0x42e55b,_0x10df59,_0x8fed76){var _0x27ffbd={};var _0x2338fd={};var _0x3973ac;var _0x15278d;return db[_0x321c('0x2a')][_0x321c('0x4a')]({'where':{'id':_0x42e55b['params']['id']}})[_0x321c('0x23')](handleEntityNotFound(_0x10df59,null))['then'](function(_0x2d3881){if(_0x2d3881){_0x3973ac=_0x2d3881;_0x2338fd[_0x321c('0x2f')]=_['keys'](db[_0x321c('0x4b')]['rawAttributes']);_0x2338fd[_0x321c('0x30')]=_[_0x321c('0x31')](_0x42e55b[_0x321c('0x30')]);_0x2338fd[_0x321c('0x32')]=_[_0x321c('0x33')](_0x2338fd[_0x321c('0x2f')],_0x2338fd['query']);_0x27ffbd[_0x321c('0x34')]=_['intersection'](_0x2338fd[_0x321c('0x2f')],qs['fields'](_0x42e55b[_0x321c('0x30')][_0x321c('0x35')]));_0x27ffbd[_0x321c('0x34')]=_0x27ffbd[_0x321c('0x34')][_0x321c('0x36')]?_0x27ffbd[_0x321c('0x34')]:_0x2338fd[_0x321c('0x2f')];_0x27ffbd[_0x321c('0x38')]=qs['sort'](_0x42e55b[_0x321c('0x30')][_0x321c('0x39')]);_0x27ffbd['where']=qs['filters'](_[_0x321c('0x3b')](_0x42e55b[_0x321c('0x30')],_0x2338fd['filters']));if(_0x42e55b[_0x321c('0x30')]['filter']){_0x27ffbd[_0x321c('0x3a')]=_[_0x321c('0x3d')](_0x27ffbd[_0x321c('0x3a')],{'$or':_[_0x321c('0x29')](_0x27ffbd[_0x321c('0x34')],function(_0x157701){var _0xaa705d={};_0xaa705d[_0x157701]={'$like':'%'+_0x42e55b[_0x321c('0x30')][_0x321c('0x3c')]+'%'};return _0xaa705d;})});}_0x27ffbd=_[_0x321c('0x3d')]({},_0x27ffbd,_0x42e55b[_0x321c('0x45')]);return _0x3973ac[_0x321c('0x49')](_0x27ffbd);}})[_0x321c('0x23')](function(_0x49d56c){if(_0x49d56c){_0x15278d=_0x49d56c['length'];if(!_0x42e55b[_0x321c('0x30')]['hasOwnProperty']('nolimit')){_0x27ffbd[_0x321c('0x1c')]=qs[_0x321c('0x1c')](_0x42e55b[_0x321c('0x30')][_0x321c('0x1c')]);_0x27ffbd[_0x321c('0x1b')]=qs['offset'](_0x42e55b[_0x321c('0x30')][_0x321c('0x1b')]);}return _0x3973ac[_0x321c('0x49')](_0x27ffbd);}})[_0x321c('0x23')](function(_0x162e6b){if(_0x162e6b){return _0x162e6b?{'count':_0x15278d,'rows':_0x162e6b}:null;}})[_0x321c('0x23')](respondWithResult(_0x10df59,null))[_0x321c('0x43')](handleError(_0x10df59,null));};exports[_0x321c('0x4c')]=function(_0x3f54f9,_0x2d5d,_0x566bcf){if(_0x3f54f9[_0x321c('0x48')]['id']){delete _0x3f54f9[_0x321c('0x48')]['id'];}return db[_0x321c('0x2a')]['findOne']({'where':{'id':_0x3f54f9[_0x321c('0x44')]['id']}})[_0x321c('0x23')](handleEntityNotFound(_0x2d5d,null))[_0x321c('0x23')](function(_0x34565a){if(_0x34565a){_0x3f54f9['body']['AccountId']=_0x34565a['id'];_0x3f54f9[_0x321c('0x48')]['Subjects']=integrations[_0x321c('0x4d')](_0x3f54f9[_0x321c('0x48')][_0x321c('0x4e')],_0x3f54f9[_0x321c('0x48')][_0x321c('0x2d')]);_0x3f54f9[_0x321c('0x48')][_0x321c('0x4f')]=integrations[_0x321c('0x50')](_0x3f54f9['body'][_0x321c('0x4e')],_0x3f54f9['body'][_0x321c('0x2d')]);return db['SalesforceConfiguration']['create'](_0x3f54f9['body'],{'include':[{'model':db[_0x321c('0x51')],'as':_0x321c('0x52')},{'model':db[_0x321c('0x51')],'as':_0x321c('0x4f')}]});}return null;})[_0x321c('0x23')](respondWithResult(_0x2d5d,null))[_0x321c('0x43')](handleError(_0x2d5d,null));};exports['getFields']=function(_0x3f127d,_0x5dbb0a,_0x51c563){var _0xc73196;var _0x52b2f6='';var _0x48e6de=_0x321c('0x53');return db['SalesforceAccount'][_0x321c('0x4a')]({'where':{'id':_0x3f127d[_0x321c('0x44')]['id']},'attributes':['id',_0x321c('0x54'),_0x321c('0x55'),_0x321c('0x56'),_0x321c('0x57'),_0x321c('0x58'),_0x321c('0x59')]})['then'](handleEntityNotFound(_0x5dbb0a,null))['then'](function(_0x529c0d){if(_0x529c0d){_0x52b2f6=_0x529c0d['remoteUri'];var _0x1e5600=_0x52b2f6[_0x321c('0x5a')](-0x1);if(_0x1e5600==='/'){_0x52b2f6=_0x52b2f6[_0x321c('0x5b')](0x0,_0x52b2f6[_0x321c('0x5c')](_0x1e5600));}_0xc73196=new jsforce[(_0x321c('0x5d'))]({'oauth2':{'loginUrl':_0x52b2f6,'clientId':_0x529c0d[_0x321c('0x55')],'clientSecret':_0x529c0d[_0x321c('0x56')]}});return _0xc73196['login'](_0x529c0d['username'],_0x529c0d[_0x321c('0x58')][_0x321c('0x5e')](_0x529c0d[_0x321c('0x59')]));}})[_0x321c('0x23')](function(_0xedae3e){if(_0xedae3e){if(!_['isNil'](_0x3f127d[_0x321c('0x30')][_0x321c('0x5f')])){_0x48e6de=_0x3f127d[_0x321c('0x30')][_0x321c('0x5f')];}return _0xc73196['sobject'](_0x48e6de)[_0x321c('0x60')]();}})['then'](function(_0x52ba8b){var _0x3dbbc5=['OwnerId',_0x321c('0x61'),_0x321c('0x62'),'IsRecurrence',_0x321c('0x63'),_0x321c('0x64')];var _0x41a728=[_0x321c('0x65'),_0x321c('0x66'),_0x321c('0x67'),'boolean',_0x321c('0x68'),_0x321c('0x69'),_0x321c('0x6a')];if(_0x52ba8b){_['remove'](_0x52ba8b[_0x321c('0x35')],function(_0xd47388){return _0x3dbbc5['includes'](_0xd47388[_0x321c('0x26')])||!_0x41a728['includes'](_0xd47388['type']);});return{'count':_0x52ba8b[_0x321c('0x35')]['length'],'rows':_[_0x321c('0x29')](_0x52ba8b[_0x321c('0x35')],function(_0x1added){return{'id':_0x1added[_0x321c('0x26')],'name':_0x1added[_0x321c('0x6b')],'custom':_0x1added[_0x321c('0x6c')],'options':_0x1added[_0x321c('0x6d')][_0x321c('0x36')]>0x0?_[_0x321c('0x29')](_0x1added[_0x321c('0x6d')],function(_0x3773d8){return{'name':_0x3773d8[_0x321c('0x6b')],'value':_0x3773d8[_0x321c('0x6e')]};}):_0x1added[_0x321c('0x2d')]==_0x321c('0x6f')?[{'name':'True','value':_0x321c('0x70')},{'name':'False','value':_0x321c('0x71')}]:[]};})};}})[_0x321c('0x23')](respondWithResult(_0x5dbb0a,null))['catch'](function(_0x2a5ac2){var _0x8256b1=_0x3f127d[_0x321c('0x30')][_0x321c('0x72')]?0x1f4:_0x2a5ac2[_0x321c('0x73')]||0x1f4;logger[_0x321c('0x25')](_0x321c('0x74'),_0x321c('0x75'),_0x8256b1,JSON[_0x321c('0x76')](_0x2a5ac2));delete _0x2a5ac2[_0x321c('0x26')];if(_0x8256b1===0x191){_0x8256b1=0x190;}_0x5dbb0a['status'](_0x8256b1)[_0x321c('0x27')](_0x3f127d[_0x321c('0x30')][_0x321c('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x2a5ac2[_0x321c('0x73')]}:_0x2a5ac2);});}; \ No newline at end of file +var _0xcfff=['Task','remoteUri','clientId','clientSecret','password','securityToken','slice','substring','login','concat','ticketType','describe','OwnerId','IsReminderSet','IsRecurrence','string','picklist','boolean','email','textarea','phone','includes','custom','picklistValues','value','true','False','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','zip-dir','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','map','SalesforceAccount','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','fields','includeAll','find','catch','create','body','params','destroy','getConfigurations','findOne','SalesforceConfiguration','rawAttributes','length','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields'];(function(_0x14365e,_0x526d57){var _0x1a63b7=function(_0x53d702){while(--_0x53d702){_0x14365e['push'](_0x14365e['shift']());}};_0x1a63b7(++_0x526d57);}(_0xcfff,0x95));var _0xfcff=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xcfff[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xfcff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfcff('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfcff('0x2'));var Mustache=require(_0xfcff('0x3'));var util=require('util');var path=require('path');var sox=require(_0xfcff('0x4'));var csv=require(_0xfcff('0x5'));var ejs=require(_0xfcff('0x6'));var fs=require('fs');var fs_extra=require(_0xfcff('0x7'));var _=require(_0xfcff('0x8'));var squel=require(_0xfcff('0x9'));var crypto=require(_0xfcff('0xa'));var jsforce=require(_0xfcff('0xb'));var deskjs=require(_0xfcff('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfcff('0xd'));var Redis=require(_0xfcff('0xe'));var authService=require(_0xfcff('0xf'));var qs=require(_0xfcff('0x10'));var as=require(_0xfcff('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfcff('0x12'))(_0xfcff('0x13'));var utils=require(_0xfcff('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfcff('0x15'))['db'];var integrations=require(_0xfcff('0x16'));function respondWithStatusCode(_0x2d5210,_0x4967f2){_0x4967f2=_0x4967f2||0xcc;return function(_0x408dd4){if(_0x408dd4){return _0x2d5210['sendStatus'](_0x4967f2);}return _0x2d5210[_0xfcff('0x17')](_0x4967f2)[_0xfcff('0x18')]();};}function respondWithResult(_0x3c3c64,_0x2f4250){_0x2f4250=_0x2f4250||0xc8;return function(_0x1007d1){if(_0x1007d1){return _0x3c3c64['status'](_0x2f4250)[_0xfcff('0x19')](_0x1007d1);}};}function respondWithFilteredResult(_0x4a236d,_0x5f407e){return function(_0x4c08c4){if(_0x4c08c4){var _0x221ccb=typeof _0x5f407e['offset']===_0xfcff('0x1a')&&typeof _0x5f407e[_0xfcff('0x1b')]===_0xfcff('0x1a');var _0x243efb=_0x4c08c4[_0xfcff('0x1c')];var _0x38b752=_0x221ccb?0x0:_0x5f407e['offset'];var _0x24aad8=_0x221ccb?_0x4c08c4[_0xfcff('0x1c')]:_0x5f407e[_0xfcff('0x1d')]+_0x5f407e['limit'];var _0x5a8322;if(_0x24aad8>=_0x243efb){_0x24aad8=_0x243efb;_0x5a8322=0xc8;}else{_0x5a8322=0xce;}_0x4a236d[_0xfcff('0x17')](_0x5a8322);return _0x4a236d['set'](_0xfcff('0x1e'),_0x38b752+'-'+_0x24aad8+'/'+_0x243efb)[_0xfcff('0x19')](_0x4c08c4);}return null;};}function patchUpdates(_0x4fb0c6){return function(_0x5ca8df){try{jsonpatch[_0xfcff('0x1f')](_0x5ca8df,_0x4fb0c6,!![]);}catch(_0x772374){return BPromise[_0xfcff('0x20')](_0x772374);}return _0x5ca8df[_0xfcff('0x21')]();};}function saveUpdates(_0x143e4f,_0x5e8348){return function(_0x1b9148){if(_0x1b9148){return _0x1b9148[_0xfcff('0x22')](_0x143e4f)['then'](function(_0x3e2753){return _0x3e2753;});}return null;};}function removeEntity(_0x26ae47,_0x2e75a7){return function(_0x1ca687){if(_0x1ca687){return _0x1ca687['destroy']()[_0xfcff('0x23')](function(){_0x26ae47[_0xfcff('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7170f4,_0x466ae0){return function(_0x1142e3){if(!_0x1142e3){_0x7170f4[_0xfcff('0x24')](0x194);}return _0x1142e3;};}function handleError(_0x2dab86,_0xfa4920){_0xfa4920=_0xfa4920||0x1f4;return function(_0x489dde){logger[_0xfcff('0x25')](_0x489dde[_0xfcff('0x26')]);if(_0x489dde[_0xfcff('0x27')]){delete _0x489dde['name'];}_0x2dab86[_0xfcff('0x17')](_0xfa4920)['send'](_0x489dde);};}exports['index']=function(_0x34c68f,_0x1b76b2){var _0x4b04a8={},_0x1db23a={},_0x1700f2={'count':0x0,'rows':[]};var _0x1f2137=_[_0xfcff('0x28')](db[_0xfcff('0x29')]['rawAttributes'],function(_0x2237b4){return{'name':_0x2237b4[_0xfcff('0x2a')],'type':_0x2237b4[_0xfcff('0x2b')]['key']};});_0x1db23a[_0xfcff('0x2c')]=_[_0xfcff('0x28')](_0x1f2137,_0xfcff('0x27'));_0x1db23a[_0xfcff('0x2d')]=_[_0xfcff('0x2e')](_0x34c68f['query']);_0x1db23a[_0xfcff('0x2f')]=_[_0xfcff('0x30')](_0x1db23a[_0xfcff('0x2c')],_0x1db23a['query']);_0x4b04a8[_0xfcff('0x31')]=_[_0xfcff('0x30')](_0x1db23a[_0xfcff('0x2c')],qs['fields'](_0x34c68f[_0xfcff('0x2d')]['fields']));_0x4b04a8[_0xfcff('0x31')]=_0x4b04a8[_0xfcff('0x31')]['length']?_0x4b04a8['attributes']:_0x1db23a[_0xfcff('0x2c')];if(!_0x34c68f[_0xfcff('0x2d')][_0xfcff('0x32')](_0xfcff('0x33'))){_0x4b04a8[_0xfcff('0x1b')]=qs[_0xfcff('0x1b')](_0x34c68f['query']['limit']);_0x4b04a8['offset']=qs['offset'](_0x34c68f[_0xfcff('0x2d')][_0xfcff('0x1d')]);}_0x4b04a8[_0xfcff('0x34')]=qs[_0xfcff('0x35')](_0x34c68f[_0xfcff('0x2d')][_0xfcff('0x35')]);_0x4b04a8[_0xfcff('0x36')]=qs[_0xfcff('0x2f')](_['pick'](_0x34c68f[_0xfcff('0x2d')],_0x1db23a[_0xfcff('0x2f')]),_0x1f2137);if(_0x34c68f['query'][_0xfcff('0x37')]){_0x4b04a8['where']=_[_0xfcff('0x38')](_0x4b04a8['where'],{'$or':_[_0xfcff('0x28')](_0x1f2137,function(_0x134d6e){if(_0x134d6e['type']!==_0xfcff('0x39')){var _0x2196fb={};_0x2196fb[_0x134d6e[_0xfcff('0x27')]]={'$like':'%'+_0x34c68f[_0xfcff('0x2d')]['filter']+'%'};return _0x2196fb;}})});}_0x4b04a8=_[_0xfcff('0x38')]({},_0x4b04a8,_0x34c68f[_0xfcff('0x3a')]);var _0x426f06={'where':_0x4b04a8[_0xfcff('0x36')]};return db['SalesforceAccount'][_0xfcff('0x1c')](_0x426f06)['then'](function(_0x261262){_0x1700f2['count']=_0x261262;if(_0x34c68f[_0xfcff('0x2d')]['includeAll']){_0x4b04a8[_0xfcff('0x3b')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xfcff('0x3c')](_0x4b04a8);})[_0xfcff('0x23')](function(_0x1cc5fe){_0x1700f2[_0xfcff('0x3d')]=_0x1cc5fe;return _0x1700f2;})[_0xfcff('0x23')](respondWithFilteredResult(_0x1b76b2,_0x4b04a8))['catch'](handleError(_0x1b76b2,null));};exports[_0xfcff('0x3e')]=function(_0x529ec9,_0x52295c){var _0x503594={'raw':![],'where':{'id':_0x529ec9['params']['id']}},_0x188d93={};_0x188d93['model']=_[_0xfcff('0x2e')](db[_0xfcff('0x29')]['rawAttributes']);_0x188d93[_0xfcff('0x2d')]=_[_0xfcff('0x2e')](_0x529ec9['query']);_0x188d93['filters']=_[_0xfcff('0x30')](_0x188d93[_0xfcff('0x2c')],_0x188d93[_0xfcff('0x2d')]);_0x503594[_0xfcff('0x31')]=_[_0xfcff('0x30')](_0x188d93[_0xfcff('0x2c')],qs[_0xfcff('0x3f')](_0x529ec9[_0xfcff('0x2d')][_0xfcff('0x3f')]));_0x503594[_0xfcff('0x31')]=_0x503594[_0xfcff('0x31')]['length']?_0x503594['attributes']:_0x188d93[_0xfcff('0x2c')];if(_0x529ec9['query'][_0xfcff('0x40')]){_0x503594[_0xfcff('0x3b')]=[{'all':!![]}];}_0x503594=_['merge']({},_0x503594,_0x529ec9[_0xfcff('0x3a')]);return db[_0xfcff('0x29')][_0xfcff('0x41')](_0x503594)[_0xfcff('0x23')](handleEntityNotFound(_0x52295c,null))['then'](respondWithResult(_0x52295c,null))[_0xfcff('0x42')](handleError(_0x52295c,null));};exports[_0xfcff('0x43')]=function(_0x29d7ef,_0x12de6e){return db['SalesforceAccount'][_0xfcff('0x43')](_0x29d7ef[_0xfcff('0x44')],{})[_0xfcff('0x23')](respondWithResult(_0x12de6e,0xc9))['catch'](handleError(_0x12de6e,null));};exports[_0xfcff('0x22')]=function(_0x431103,_0x1d02f1){if(_0x431103[_0xfcff('0x44')]['id']){delete _0x431103['body']['id'];}return db[_0xfcff('0x29')]['find']({'where':{'id':_0x431103[_0xfcff('0x45')]['id']}})[_0xfcff('0x23')](handleEntityNotFound(_0x1d02f1,null))[_0xfcff('0x23')](saveUpdates(_0x431103[_0xfcff('0x44')],null))[_0xfcff('0x23')](respondWithResult(_0x1d02f1,null))[_0xfcff('0x42')](handleError(_0x1d02f1,null));};exports[_0xfcff('0x46')]=function(_0x28ae4c,_0x316a19){return db[_0xfcff('0x29')][_0xfcff('0x41')]({'where':{'id':_0x28ae4c['params']['id']}})[_0xfcff('0x23')](handleEntityNotFound(_0x316a19,null))[_0xfcff('0x23')](removeEntity(_0x316a19,null))['catch'](handleError(_0x316a19,null));};exports[_0xfcff('0x47')]=function(_0x222211,_0x1ba4e2,_0x841ee3){var _0x5641e1={};var _0x367176={};var _0x56d23e;var _0x34fd4c;return db[_0xfcff('0x29')][_0xfcff('0x48')]({'where':{'id':_0x222211[_0xfcff('0x45')]['id']}})[_0xfcff('0x23')](handleEntityNotFound(_0x1ba4e2,null))['then'](function(_0x3b2a91){if(_0x3b2a91){_0x56d23e=_0x3b2a91;_0x367176['model']=_[_0xfcff('0x2e')](db[_0xfcff('0x49')][_0xfcff('0x4a')]);_0x367176[_0xfcff('0x2d')]=_['keys'](_0x222211[_0xfcff('0x2d')]);_0x367176[_0xfcff('0x2f')]=_['intersection'](_0x367176[_0xfcff('0x2c')],_0x367176['query']);_0x5641e1['attributes']=_['intersection'](_0x367176[_0xfcff('0x2c')],qs[_0xfcff('0x3f')](_0x222211[_0xfcff('0x2d')][_0xfcff('0x3f')]));_0x5641e1['attributes']=_0x5641e1[_0xfcff('0x31')][_0xfcff('0x4b')]?_0x5641e1[_0xfcff('0x31')]:_0x367176[_0xfcff('0x2c')];_0x5641e1[_0xfcff('0x34')]=qs[_0xfcff('0x35')](_0x222211[_0xfcff('0x2d')][_0xfcff('0x35')]);_0x5641e1[_0xfcff('0x36')]=qs[_0xfcff('0x2f')](_[_0xfcff('0x4c')](_0x222211[_0xfcff('0x2d')],_0x367176[_0xfcff('0x2f')]));if(_0x222211[_0xfcff('0x2d')][_0xfcff('0x37')]){_0x5641e1['where']=_[_0xfcff('0x38')](_0x5641e1[_0xfcff('0x36')],{'$or':_[_0xfcff('0x28')](_0x5641e1[_0xfcff('0x31')],function(_0x4cf249){var _0x4aca58={};_0x4aca58[_0x4cf249]={'$like':'%'+_0x222211['query'][_0xfcff('0x37')]+'%'};return _0x4aca58;})});}_0x5641e1=_['merge']({},_0x5641e1,_0x222211[_0xfcff('0x3a')]);return _0x56d23e['getConfigurations'](_0x5641e1);}})[_0xfcff('0x23')](function(_0x2d4fd1){if(_0x2d4fd1){_0x34fd4c=_0x2d4fd1[_0xfcff('0x4b')];if(!_0x222211[_0xfcff('0x2d')][_0xfcff('0x32')]('nolimit')){_0x5641e1[_0xfcff('0x1b')]=qs['limit'](_0x222211[_0xfcff('0x2d')][_0xfcff('0x1b')]);_0x5641e1[_0xfcff('0x1d')]=qs[_0xfcff('0x1d')](_0x222211[_0xfcff('0x2d')][_0xfcff('0x1d')]);}return _0x56d23e[_0xfcff('0x47')](_0x5641e1);}})[_0xfcff('0x23')](function(_0x2704df){if(_0x2704df){return _0x2704df?{'count':_0x34fd4c,'rows':_0x2704df}:null;}})[_0xfcff('0x23')](respondWithResult(_0x1ba4e2,null))['catch'](handleError(_0x1ba4e2,null));};exports[_0xfcff('0x4d')]=function(_0x25c8bd,_0x19ab07,_0x5cf85f){if(_0x25c8bd['body']['id']){delete _0x25c8bd[_0xfcff('0x44')]['id'];}return db[_0xfcff('0x29')][_0xfcff('0x48')]({'where':{'id':_0x25c8bd[_0xfcff('0x45')]['id']}})[_0xfcff('0x23')](handleEntityNotFound(_0x19ab07,null))[_0xfcff('0x23')](function(_0x4c6863){if(_0x4c6863){_0x25c8bd[_0xfcff('0x44')][_0xfcff('0x4e')]=_0x4c6863['id'];_0x25c8bd[_0xfcff('0x44')][_0xfcff('0x4f')]=integrations[_0xfcff('0x50')](_0x25c8bd[_0xfcff('0x44')][_0xfcff('0x51')],_0x25c8bd[_0xfcff('0x44')][_0xfcff('0x2b')]);_0x25c8bd['body'][_0xfcff('0x52')]=integrations['getDescriptions'](_0x25c8bd['body'][_0xfcff('0x51')],_0x25c8bd[_0xfcff('0x44')][_0xfcff('0x2b')]);return db[_0xfcff('0x49')][_0xfcff('0x43')](_0x25c8bd[_0xfcff('0x44')],{'include':[{'model':db[_0xfcff('0x53')],'as':_0xfcff('0x4f')},{'model':db[_0xfcff('0x53')],'as':_0xfcff('0x52')}]});}return null;})[_0xfcff('0x23')](respondWithResult(_0x19ab07,null))[_0xfcff('0x42')](handleError(_0x19ab07,null));};exports[_0xfcff('0x54')]=function(_0x323f92,_0x67bd44,_0x252f4d){var _0x207b45;var _0x384571='';var _0x422f5b=_0xfcff('0x55');return db[_0xfcff('0x29')]['findOne']({'where':{'id':_0x323f92[_0xfcff('0x45')]['id']},'attributes':['id',_0xfcff('0x56'),_0xfcff('0x57'),_0xfcff('0x58'),'username',_0xfcff('0x59'),_0xfcff('0x5a')]})['then'](handleEntityNotFound(_0x67bd44,null))['then'](function(_0x158e16){if(_0x158e16){_0x384571=_0x158e16[_0xfcff('0x56')];var _0x3b4ef1=_0x384571[_0xfcff('0x5b')](-0x1);if(_0x3b4ef1==='/'){_0x384571=_0x384571[_0xfcff('0x5c')](0x0,_0x384571['lastIndexOf'](_0x3b4ef1));}_0x207b45=new jsforce['Connection']({'oauth2':{'loginUrl':_0x384571,'clientId':_0x158e16[_0xfcff('0x57')],'clientSecret':_0x158e16[_0xfcff('0x58')]}});return _0x207b45[_0xfcff('0x5d')](_0x158e16['username'],_0x158e16[_0xfcff('0x59')][_0xfcff('0x5e')](_0x158e16[_0xfcff('0x5a')]));}})[_0xfcff('0x23')](function(_0x489076){if(_0x489076){if(!_['isNil'](_0x323f92[_0xfcff('0x2d')][_0xfcff('0x5f')])){_0x422f5b=_0x323f92[_0xfcff('0x2d')][_0xfcff('0x5f')];}return _0x207b45['sobject'](_0x422f5b)[_0xfcff('0x60')]();}})['then'](function(_0x2df950){var _0x49baf7=[_0xfcff('0x61'),'ActivityDate',_0xfcff('0x62'),_0xfcff('0x63'),'Subject','Description'];var _0x18e643=[_0xfcff('0x64'),'int',_0xfcff('0x65'),_0xfcff('0x66'),_0xfcff('0x67'),_0xfcff('0x68'),_0xfcff('0x69')];if(_0x2df950){_['remove'](_0x2df950[_0xfcff('0x3f')],function(_0x4d60e1){return _0x49baf7[_0xfcff('0x6a')](_0x4d60e1['name'])||!_0x18e643[_0xfcff('0x6a')](_0x4d60e1['type']);});return{'count':_0x2df950[_0xfcff('0x3f')]['length'],'rows':_[_0xfcff('0x28')](_0x2df950[_0xfcff('0x3f')],function(_0x732713){return{'id':_0x732713[_0xfcff('0x27')],'name':_0x732713['label'],'custom':_0x732713[_0xfcff('0x6b')],'options':_0x732713[_0xfcff('0x6c')]['length']>0x0?_['map'](_0x732713[_0xfcff('0x6c')],function(_0x404f56){return{'name':_0x404f56['label'],'value':_0x404f56[_0xfcff('0x6d')]};}):_0x732713[_0xfcff('0x2b')]==_0xfcff('0x66')?[{'name':'True','value':_0xfcff('0x6e')},{'name':_0xfcff('0x6f'),'value':'false'}]:[]};})};}})[_0xfcff('0x23')](respondWithResult(_0x67bd44,null))[_0xfcff('0x42')](function(_0x4db4f7){var _0x25c1bb=_0x323f92[_0xfcff('0x2d')]['test']?0x1f4:_0x4db4f7[_0xfcff('0x70')]||0x1f4;logger[_0xfcff('0x25')](_0xfcff('0x71'),_0xfcff('0x54'),_0x25c1bb,JSON['stringify'](_0x4db4f7));delete _0x4db4f7[_0xfcff('0x27')];if(_0x25c1bb===0x191){_0x25c1bb=0x190;}_0x67bd44[_0xfcff('0x17')](_0x25c1bb)[_0xfcff('0x72')](_0x323f92[_0xfcff('0x2d')][_0xfcff('0x73')]?{'message':_0xfcff('0x74'),'statusCode':_0x4db4f7[_0xfcff('0x70')]}:_0x4db4f7);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 6243f18..962de05 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 _0x3a04=['exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x50f8e2,_0x26d472){var _0x36c552=function(_0x3b6a4f){while(--_0x3b6a4f){_0x50f8e2['push'](_0x50f8e2['shift']());}};_0x36c552(++_0x26d472);}(_0x3a04,0x15d));var _0x43a0=function(_0x153810,_0x4b3117){_0x153810=_0x153810-0x0;var _0x3df31a=_0x3a04[_0x153810];return _0x3df31a;};'use strict';var _=require(_0x43a0('0x0'));var util=require(_0x43a0('0x1'));var logger=require(_0x43a0('0x2'))(_0x43a0('0x3'));var moment=require(_0x43a0('0x4'));var BPromise=require(_0x43a0('0x5'));var rp=require(_0x43a0('0x6'));var fs=require('fs');var path=require(_0x43a0('0x7'));var rimraf=require('rimraf');var config=require(_0x43a0('0x8'));var attributes=require(_0x43a0('0x9'));var integrations=require(_0x43a0('0xa'));module[_0x43a0('0xb')]=function(_0x1a7714,_0x458d90){return _0x1a7714[_0x43a0('0xc')](_0x43a0('0xd'),attributes,{'tableName':_0x43a0('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x930e=['./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x15788a,_0xf1c230){var _0x8b6be3=function(_0x3d56fc){while(--_0x3d56fc){_0x15788a['push'](_0x15788a['shift']());}};_0x8b6be3(++_0xf1c230);}(_0x930e,0x185));var _0xe930=function(_0x3abaab,_0x318eab){_0x3abaab=_0x3abaab-0x0;var _0x37fce7=_0x930e[_0x3abaab];return _0x37fce7;};'use strict';var _=require(_0xe930('0x0'));var util=require('util');var logger=require(_0xe930('0x1'))('api');var moment=require(_0xe930('0x2'));var BPromise=require(_0xe930('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe930('0x4'));var rimraf=require(_0xe930('0x5'));var config=require(_0xe930('0x6'));var attributes=require(_0xe930('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xe930('0x8')]=function(_0xd4d873,_0x416c63){return _0xd4d873[_0xe930('0x9')](_0xe930('0xa'),attributes,{'tableName':_0xe930('0xb'),'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 694b7d1..61fbbc7 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 _0xd5f2=['error','message','catch','SalesforceAccount','options','raw','where','attributes','map','include','model','ShowSalesforceAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x36b3d5,_0x3b4df4){var _0x3fdaf1=function(_0x4bf977){while(--_0x4bf977){_0x36b3d5['push'](_0x36b3d5['shift']());}};_0x3fdaf1(++_0x3b4df4);}(_0xd5f2,0x114));var _0x2d5f=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xd5f2[_0xfa634c];return _0x73e478;};'use strict';var _=require(_0x2d5f('0x0'));var util=require(_0x2d5f('0x1'));var moment=require(_0x2d5f('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d5f('0x3'));var fs=require('fs');var Redis=require(_0x2d5f('0x4'));var db=require(_0x2d5f('0x5'))['db'];var utils=require(_0x2d5f('0x6'));var logger=require(_0x2d5f('0x7'))(_0x2d5f('0x8'));var config=require(_0x2d5f('0x9'));var jayson=require(_0x2d5f('0xa'));var client=jayson[_0x2d5f('0xb')][_0x2d5f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x48821a,_0x42d285,_0x4653b4){return new BPromise(function(_0x4b985f,_0x46f577){return client[_0x2d5f('0xd')](_0x48821a,_0x4653b4)[_0x2d5f('0xe')](function(_0x5ba2a6){logger[_0x2d5f('0xf')](_0x2d5f('0x10'),_0x42d285,_0x2d5f('0x11'));logger[_0x2d5f('0x12')](_0x2d5f('0x13'),_0x42d285,'request\x20sent',JSON[_0x2d5f('0x14')](_0x5ba2a6));if(_0x5ba2a6[_0x2d5f('0x15')]){if(_0x5ba2a6[_0x2d5f('0x15')]['code']===0x1f4){logger[_0x2d5f('0x15')](_0x2d5f('0x10'),_0x42d285,_0x5ba2a6[_0x2d5f('0x15')][_0x2d5f('0x16')]);return _0x46f577(_0x5ba2a6[_0x2d5f('0x15')]['message']);}logger['error'](_0x2d5f('0x10'),_0x42d285,_0x5ba2a6[_0x2d5f('0x15')][_0x2d5f('0x16')]);return _0x4b985f(_0x5ba2a6[_0x2d5f('0x15')][_0x2d5f('0x16')]);}else{logger['info'](_0x2d5f('0x10'),_0x42d285,_0x2d5f('0x11'));_0x4b985f(_0x5ba2a6['result']['message']);}})[_0x2d5f('0x17')](function(_0x2347c7){logger[_0x2d5f('0x15')](_0x2d5f('0x10'),_0x42d285,_0x2347c7);_0x46f577(_0x2347c7);});});}exports['GetSalesforceAccount']=function(_0x540003){var _0x13730a=this;return new Promise(function(_0x43229c,_0x500553){return db[_0x2d5f('0x18')]['findAll']({'raw':_0x540003[_0x2d5f('0x19')]?_0x540003[_0x2d5f('0x19')][_0x2d5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x540003[_0x2d5f('0x19')]?_0x540003[_0x2d5f('0x19')][_0x2d5f('0x1b')]||null:null,'attributes':_0x540003[_0x2d5f('0x19')]?_0x540003['options'][_0x2d5f('0x1c')]||null:null,'limit':_0x540003[_0x2d5f('0x19')]?_0x540003['options']['limit']||null:null,'include':_0x540003[_0x2d5f('0x19')]?_0x540003[_0x2d5f('0x19')]['include']?_[_0x2d5f('0x1d')](_0x540003['options'][_0x2d5f('0x1e')],function(_0x3b71fd){return{'model':db[_0x3b71fd['model']],'as':_0x3b71fd['as'],'attributes':_0x3b71fd[_0x2d5f('0x1c')],'include':_0x3b71fd[_0x2d5f('0x1e')]?_[_0x2d5f('0x1d')](_0x3b71fd[_0x2d5f('0x1e')],function(_0x3f0fe6){return{'model':db[_0x3f0fe6[_0x2d5f('0x1f')]],'as':_0x3f0fe6['as'],'attributes':_0x3f0fe6[_0x2d5f('0x1c')],'include':_0x3f0fe6['include']?_[_0x2d5f('0x1d')](_0x3f0fe6[_0x2d5f('0x1e')],function(_0x1b3d90){return{'model':db[_0x1b3d90['model']],'as':_0x1b3d90['as'],'attributes':_0x1b3d90[_0x2d5f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2d5f('0xe')](function(_0x538bd4){logger[_0x2d5f('0xf')]('GetSalesforceAccount',_0x540003);logger['debug']('GetSalesforceAccount',_0x540003,JSON[_0x2d5f('0x14')](_0x538bd4));_0x43229c(_0x538bd4);})[_0x2d5f('0x17')](function(_0x572fd9){logger[_0x2d5f('0x15')]('GetSalesforceAccount',_0x572fd9[_0x2d5f('0x16')],_0x540003);_0x500553(_0x13730a[_0x2d5f('0x15')](0x1f4,_0x572fd9[_0x2d5f('0x16')]));});});};exports['ShowSalesforceAccount']=function(_0x2744ed){var _0x57b3c2=this;return new Promise(function(_0x4f2f8b,_0x44215a){return db['SalesforceAccount']['find']({'raw':_0x2744ed['options']?_0x2744ed[_0x2d5f('0x19')][_0x2d5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x2744ed[_0x2d5f('0x19')]?_0x2744ed[_0x2d5f('0x19')]['where']||null:null,'attributes':_0x2744ed['options']?_0x2744ed['options'][_0x2d5f('0x1c')]||null:null,'include':_0x2744ed[_0x2d5f('0x19')]?_0x2744ed['options']['include']?_[_0x2d5f('0x1d')](_0x2744ed[_0x2d5f('0x19')][_0x2d5f('0x1e')],function(_0x17a864){return{'model':db[_0x17a864['model']],'as':_0x17a864['as'],'attributes':_0x17a864['attributes'],'include':_0x17a864[_0x2d5f('0x1e')]?_[_0x2d5f('0x1d')](_0x17a864[_0x2d5f('0x1e')],function(_0x23e2c0){return{'model':db[_0x23e2c0[_0x2d5f('0x1f')]],'as':_0x23e2c0['as'],'attributes':_0x23e2c0[_0x2d5f('0x1c')],'include':_0x23e2c0[_0x2d5f('0x1e')]?_['map'](_0x23e2c0[_0x2d5f('0x1e')],function(_0x3c8317){return{'model':db[_0x3c8317['model']],'as':_0x3c8317['as'],'attributes':_0x3c8317[_0x2d5f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30cf0e){logger[_0x2d5f('0xf')]('ShowSalesforceAccount',_0x2744ed);logger[_0x2d5f('0x12')]('ShowSalesforceAccount',_0x2744ed,JSON[_0x2d5f('0x14')](_0x30cf0e));_0x4f2f8b(_0x30cf0e);})[_0x2d5f('0x17')](function(_0x215f2a){logger[_0x2d5f('0x15')](_0x2d5f('0x20'),_0x215f2a[_0x2d5f('0x16')],_0x2744ed);_0x44215a(_0x57b3c2[_0x2d5f('0x15')](0x1f4,_0x215f2a[_0x2d5f('0x16')]));});});}; \ No newline at end of file +var _0x7f9c=['then','request\x20sent','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','client','request'];(function(_0x1d9313,_0x38cd03){var _0x66ea05=function(_0x532b96){while(--_0x532b96){_0x1d9313['push'](_0x1d9313['shift']());}};_0x66ea05(++_0x38cd03);}(_0x7f9c,0x9c));var _0xc7f9=function(_0x1d144f,_0x369d40){_0x1d144f=_0x1d144f-0x0;var _0x21b061=_0x7f9c[_0x1d144f];return _0x21b061;};'use strict';var _=require(_0xc7f9('0x0'));var util=require(_0xc7f9('0x1'));var moment=require(_0xc7f9('0x2'));var BPromise=require(_0xc7f9('0x3'));var rs=require(_0xc7f9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc7f9('0x5'));var config=require(_0xc7f9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc7f9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54f1f2,_0x153a92,_0x263f2d){return new BPromise(function(_0x5637fc,_0xfab036){return client[_0xc7f9('0x8')](_0x54f1f2,_0x263f2d)[_0xc7f9('0x9')](function(_0x399b92){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x153a92,_0xc7f9('0xa'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x153a92,_0xc7f9('0xa'),JSON[_0xc7f9('0xb')](_0x399b92));if(_0x399b92[_0xc7f9('0xc')]){if(_0x399b92[_0xc7f9('0xc')][_0xc7f9('0xd')]===0x1f4){logger[_0xc7f9('0xc')](_0xc7f9('0xe'),_0x153a92,_0x399b92['error'][_0xc7f9('0xf')]);return _0xfab036(_0x399b92[_0xc7f9('0xc')][_0xc7f9('0xf')]);}logger[_0xc7f9('0xc')](_0xc7f9('0xe'),_0x153a92,_0x399b92[_0xc7f9('0xc')][_0xc7f9('0xf')]);return _0x5637fc(_0x399b92[_0xc7f9('0xc')][_0xc7f9('0xf')]);}else{logger[_0xc7f9('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x153a92,'request\x20sent');_0x5637fc(_0x399b92[_0xc7f9('0x11')]['message']);}})[_0xc7f9('0x12')](function(_0xc2be79){logger[_0xc7f9('0xc')](_0xc7f9('0xe'),_0x153a92,_0xc2be79);_0xfab036(_0xc2be79);});});}exports[_0xc7f9('0x13')]=function(_0x5cd827){var _0x42ffc9=this;return new Promise(function(_0x1a3b8c,_0x27759a){return db[_0xc7f9('0x14')][_0xc7f9('0x15')]({'raw':_0x5cd827[_0xc7f9('0x16')]?_0x5cd827[_0xc7f9('0x16')][_0xc7f9('0x17')]===undefined?!![]:![]:!![],'where':_0x5cd827[_0xc7f9('0x16')]?_0x5cd827[_0xc7f9('0x16')][_0xc7f9('0x18')]||null:null,'attributes':_0x5cd827[_0xc7f9('0x16')]?_0x5cd827[_0xc7f9('0x16')][_0xc7f9('0x19')]||null:null,'limit':_0x5cd827[_0xc7f9('0x16')]?_0x5cd827[_0xc7f9('0x16')][_0xc7f9('0x1a')]||null:null,'include':_0x5cd827[_0xc7f9('0x16')]?_0x5cd827[_0xc7f9('0x16')][_0xc7f9('0x1b')]?_[_0xc7f9('0x1c')](_0x5cd827[_0xc7f9('0x16')][_0xc7f9('0x1b')],function(_0x1848a2){return{'model':db[_0x1848a2[_0xc7f9('0x1d')]],'as':_0x1848a2['as'],'attributes':_0x1848a2[_0xc7f9('0x19')],'include':_0x1848a2['include']?_[_0xc7f9('0x1c')](_0x1848a2['include'],function(_0x3b1f0c){return{'model':db[_0x3b1f0c['model']],'as':_0x3b1f0c['as'],'attributes':_0x3b1f0c[_0xc7f9('0x19')],'include':_0x3b1f0c[_0xc7f9('0x1b')]?_[_0xc7f9('0x1c')](_0x3b1f0c[_0xc7f9('0x1b')],function(_0x4730e9){return{'model':db[_0x4730e9[_0xc7f9('0x1d')]],'as':_0x4730e9['as'],'attributes':_0x4730e9[_0xc7f9('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36eb11){logger[_0xc7f9('0x10')](_0xc7f9('0x13'),_0x5cd827);logger[_0xc7f9('0x1e')](_0xc7f9('0x13'),_0x5cd827,JSON['stringify'](_0x36eb11));_0x1a3b8c(_0x36eb11);})[_0xc7f9('0x12')](function(_0xf3699b){logger[_0xc7f9('0xc')](_0xc7f9('0x13'),_0xf3699b[_0xc7f9('0xf')],_0x5cd827);_0x27759a(_0x42ffc9['error'](0x1f4,_0xf3699b[_0xc7f9('0xf')]));});});};exports['ShowSalesforceAccount']=function(_0xb06996){var _0x174dd7=this;return new Promise(function(_0x157456,_0x37a29c){return db[_0xc7f9('0x14')][_0xc7f9('0x1f')]({'raw':_0xb06996[_0xc7f9('0x16')]?_0xb06996[_0xc7f9('0x16')][_0xc7f9('0x17')]===undefined?!![]:![]:!![],'where':_0xb06996[_0xc7f9('0x16')]?_0xb06996['options']['where']||null:null,'attributes':_0xb06996[_0xc7f9('0x16')]?_0xb06996[_0xc7f9('0x16')][_0xc7f9('0x19')]||null:null,'include':_0xb06996[_0xc7f9('0x16')]?_0xb06996[_0xc7f9('0x16')][_0xc7f9('0x1b')]?_['map'](_0xb06996['options']['include'],function(_0x300453){return{'model':db[_0x300453[_0xc7f9('0x1d')]],'as':_0x300453['as'],'attributes':_0x300453[_0xc7f9('0x19')],'include':_0x300453[_0xc7f9('0x1b')]?_[_0xc7f9('0x1c')](_0x300453[_0xc7f9('0x1b')],function(_0x3db61a){return{'model':db[_0x3db61a[_0xc7f9('0x1d')]],'as':_0x3db61a['as'],'attributes':_0x3db61a['attributes'],'include':_0x3db61a[_0xc7f9('0x1b')]?_[_0xc7f9('0x1c')](_0x3db61a[_0xc7f9('0x1b')],function(_0x5a4fe0){return{'model':db[_0x5a4fe0[_0xc7f9('0x1d')]],'as':_0x5a4fe0['as'],'attributes':_0x5a4fe0[_0xc7f9('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22babf){logger[_0xc7f9('0x10')]('ShowSalesforceAccount',_0xb06996);logger[_0xc7f9('0x1e')](_0xc7f9('0x20'),_0xb06996,JSON[_0xc7f9('0xb')](_0x22babf));_0x157456(_0x22babf);})[_0xc7f9('0x12')](function(_0x4792ea){logger[_0xc7f9('0xc')](_0xc7f9('0x20'),_0x4792ea[_0xc7f9('0xf')],_0xb06996);_0x37a29c(_0x174dd7[_0xc7f9('0xc')](0x1f4,_0x4792ea[_0xc7f9('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 87f9af5..db55871 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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x494d52,_0x3205fe){var _0x4f5b5b=function(_0x3fcfc0){while(--_0x3fcfc0){_0x494d52['push'](_0x494d52['shift']());}};_0x4f5b5b(++_0x3205fe);}(_0xadb5,0xad));var _0x5adb=function(_0x4553b4,_0x5a5747){_0x4553b4=_0x4553b4-0x0;var _0x2d2bb9=_0xadb5[_0x4553b4];return _0x2d2bb9;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x114d26,_0x5a9e94){var _0x3d5f21=function(_0x354b98){while(--_0x354b98){_0x114d26['push'](_0x114d26['shift']());}};_0x3d5f21(++_0x5a9e94);}(_0x5f2f,0x73));var _0xf5f2=function(_0x12e1dd,_0x299547){_0x12e1dd=_0x12e1dd-0x0;var _0x4aa850=_0x5f2f[_0x12e1dd];return _0x4aa850;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index b76df5f..fc3988a 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 _0xccb8=['nothing','sequelize','STRING','ENUM','Task','Case','contact','lead','account_contact_lead','account','contact_lead'];(function(_0x26accd,_0x22fe1c){var _0x3ea86b=function(_0x590303){while(--_0x590303){_0x26accd['push'](_0x26accd['shift']());}};_0x3ea86b(++_0x22fe1c);}(_0xccb8,0xd2));var _0x8ccb=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xccb8[_0x565c49];return _0x20ca34;};'use strict';var Sequelize=require(_0x8ccb('0x0'));module['exports']={'name':{'type':Sequelize[_0x8ccb('0x1')]},'description':{'type':Sequelize[_0x8ccb('0x1')]},'ticketType':{'type':Sequelize[_0x8ccb('0x2')](_0x8ccb('0x3'),_0x8ccb('0x4')),'defaultValue':_0x8ccb('0x3')},'moduleSearch':{'type':Sequelize[_0x8ccb('0x2')]('contact_lead',_0x8ccb('0x5'),_0x8ccb('0x6'),_0x8ccb('0x7'),_0x8ccb('0x8')),'defaultValue':_0x8ccb('0x9')},'moduleCreate':{'type':Sequelize[_0x8ccb('0x2')](_0x8ccb('0xa'),_0x8ccb('0x5'),'lead',_0x8ccb('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x8ccb('0x1')]}}; \ No newline at end of file +var _0x5afb=['ENUM','contact_lead','contact','account','nothing','lead','sequelize','exports','STRING','Case','Task'];(function(_0x2b944c,_0x4dfd8a){var _0x2b44f1=function(_0x4886ed){while(--_0x4886ed){_0x2b944c['push'](_0x2b944c['shift']());}};_0x2b44f1(++_0x4dfd8a);}(_0x5afb,0x1c9));var _0xb5af=function(_0x35fb79,_0x47f0dc){_0x35fb79=_0x35fb79-0x0;var _0x1f6764=_0x5afb[_0x35fb79];return _0x1f6764;};'use strict';var Sequelize=require(_0xb5af('0x0'));module[_0xb5af('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb5af('0x2')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0xb5af('0x3')),'defaultValue':_0xb5af('0x4')},'moduleSearch':{'type':Sequelize[_0xb5af('0x5')](_0xb5af('0x6'),_0xb5af('0x7'),'lead','account_contact_lead',_0xb5af('0x8')),'defaultValue':_0xb5af('0x6')},'moduleCreate':{'type':Sequelize[_0xb5af('0x5')](_0xb5af('0x9'),_0xb5af('0x7'),_0xb5af('0xa'),_0xb5af('0x8')),'defaultValue':_0xb5af('0xa')},'leadId':{'type':Sequelize[_0xb5af('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xb5af('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xb5af('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 47ee554..ce464ea 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 _0xf51e=['sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','stack','name','send','map','fieldName','type','key','model','query','intersection','fields','attributes','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','SalesforceConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','destroy','getFields','findOne','SalesforceField','hasOwnProperty','getSubjects','rawAttributes','nolimit','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x1c4455,_0x1bc83c){var _0x254542=function(_0x231886){while(--_0x231886){_0x1c4455['push'](_0x1c4455['shift']());}};_0x254542(++_0x1bc83c);}(_0xf51e,0x9a));var _0xef51=function(_0x1db5b1,_0x47e9c8){_0x1db5b1=_0x1db5b1-0x0;var _0x13b139=_0xf51e[_0x1db5b1];return _0x13b139;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xef51('0x0'));var zipdir=require(_0xef51('0x1'));var jsonpatch=require(_0xef51('0x2'));var rp=require(_0xef51('0x3'));var moment=require(_0xef51('0x4'));var BPromise=require(_0xef51('0x5'));var Mustache=require(_0xef51('0x6'));var util=require('util');var path=require(_0xef51('0x7'));var sox=require(_0xef51('0x8'));var csv=require(_0xef51('0x9'));var ejs=require(_0xef51('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xef51('0xb'));var squel=require(_0xef51('0xc'));var crypto=require('crypto');var jsforce=require(_0xef51('0xd'));var deskjs=require(_0xef51('0xe'));var toCsv=require(_0xef51('0x9'));var querystring=require(_0xef51('0xf'));var Papa=require(_0xef51('0x10'));var Redis=require('ioredis');var authService=require(_0xef51('0x11'));var qs=require(_0xef51('0x12'));var as=require(_0xef51('0x13'));var hardwareService=require(_0xef51('0x14'));var logger=require(_0xef51('0x15'))(_0xef51('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xef51('0x17'));var db=require(_0xef51('0x18'))['db'];function respondWithStatusCode(_0x25a3ca,_0x31d5d0){_0x31d5d0=_0x31d5d0||0xcc;return function(_0x151806){if(_0x151806){return _0x25a3ca[_0xef51('0x19')](_0x31d5d0);}return _0x25a3ca[_0xef51('0x1a')](_0x31d5d0)[_0xef51('0x1b')]();};}function respondWithResult(_0x9efe16,_0x3fa2b4){_0x3fa2b4=_0x3fa2b4||0xc8;return function(_0x3d0ab6){if(_0x3d0ab6){return _0x9efe16[_0xef51('0x1a')](_0x3fa2b4)[_0xef51('0x1c')](_0x3d0ab6);}};}function respondWithFilteredResult(_0x5f10a7,_0x5a10f5){return function(_0x508aa2){if(_0x508aa2){var _0x4d21f7=typeof _0x5a10f5[_0xef51('0x1d')]===_0xef51('0x1e')&&typeof _0x5a10f5['limit']===_0xef51('0x1e');var _0x439174=_0x508aa2[_0xef51('0x1f')];var _0x1d1bfe=_0x4d21f7?0x0:_0x5a10f5[_0xef51('0x1d')];var _0x484d87=_0x4d21f7?_0x508aa2['count']:_0x5a10f5[_0xef51('0x1d')]+_0x5a10f5[_0xef51('0x20')];var _0x36624d;if(_0x484d87>=_0x439174){_0x484d87=_0x439174;_0x36624d=0xc8;}else{_0x36624d=0xce;}_0x5f10a7[_0xef51('0x1a')](_0x36624d);return _0x5f10a7[_0xef51('0x21')](_0xef51('0x22'),_0x1d1bfe+'-'+_0x484d87+'/'+_0x439174)[_0xef51('0x1c')](_0x508aa2);}return null;};}function patchUpdates(_0x17ae69){return function(_0xaf54b3){try{jsonpatch['apply'](_0xaf54b3,_0x17ae69,!![]);}catch(_0x3847cd){return BPromise[_0xef51('0x23')](_0x3847cd);}return _0xaf54b3[_0xef51('0x24')]();};}function saveUpdates(_0x58b927,_0x830b0c){return function(_0x148b19){if(_0x148b19){return _0x148b19['update'](_0x58b927)['then'](function(_0x105e14){return _0x105e14;});}return null;};}function removeEntity(_0x44e05b,_0x1d06b7){return function(_0x442b9d){if(_0x442b9d){return _0x442b9d['destroy']()[_0xef51('0x25')](function(){_0x44e05b[_0xef51('0x1a')](0xcc)[_0xef51('0x1b')]();});}};}function handleEntityNotFound(_0x402a58,_0x3534ce){return function(_0x42667b){if(!_0x42667b){_0x402a58[_0xef51('0x19')](0x194);}return _0x42667b;};}function handleError(_0x350565,_0x20e8af){_0x20e8af=_0x20e8af||0x1f4;return function(_0x2e9ad7){logger['error'](_0x2e9ad7[_0xef51('0x26')]);if(_0x2e9ad7[_0xef51('0x27')]){delete _0x2e9ad7['name'];}_0x350565['status'](_0x20e8af)[_0xef51('0x28')](_0x2e9ad7);};}exports['index']=function(_0x11ba57,_0x3cb7c1){var _0x4e1cf0={},_0x546e1c={},_0x2a9996={'count':0x0,'rows':[]};var _0x316407=_[_0xef51('0x29')](db['SalesforceConfiguration']['rawAttributes'],function(_0xdc824){return{'name':_0xdc824[_0xef51('0x2a')],'type':_0xdc824[_0xef51('0x2b')][_0xef51('0x2c')]};});_0x546e1c[_0xef51('0x2d')]=_['map'](_0x316407,_0xef51('0x27'));_0x546e1c['query']=_['keys'](_0x11ba57[_0xef51('0x2e')]);_0x546e1c['filters']=_['intersection'](_0x546e1c[_0xef51('0x2d')],_0x546e1c[_0xef51('0x2e')]);_0x4e1cf0['attributes']=_[_0xef51('0x2f')](_0x546e1c[_0xef51('0x2d')],qs['fields'](_0x11ba57[_0xef51('0x2e')][_0xef51('0x30')]));_0x4e1cf0[_0xef51('0x31')]=_0x4e1cf0['attributes'][_0xef51('0x32')]?_0x4e1cf0['attributes']:_0x546e1c[_0xef51('0x2d')];if(!_0x11ba57[_0xef51('0x2e')]['hasOwnProperty']('nolimit')){_0x4e1cf0[_0xef51('0x20')]=qs[_0xef51('0x20')](_0x11ba57[_0xef51('0x2e')][_0xef51('0x20')]);_0x4e1cf0[_0xef51('0x1d')]=qs[_0xef51('0x1d')](_0x11ba57[_0xef51('0x2e')][_0xef51('0x1d')]);}_0x4e1cf0[_0xef51('0x33')]=qs['sort'](_0x11ba57[_0xef51('0x2e')][_0xef51('0x34')]);_0x4e1cf0[_0xef51('0x35')]=qs['filters'](_[_0xef51('0x36')](_0x11ba57['query'],_0x546e1c[_0xef51('0x37')]),_0x316407);if(_0x11ba57[_0xef51('0x2e')][_0xef51('0x38')]){_0x4e1cf0[_0xef51('0x35')]=_[_0xef51('0x39')](_0x4e1cf0[_0xef51('0x35')],{'$or':_[_0xef51('0x29')](_0x316407,function(_0x56db30){if(_0x56db30[_0xef51('0x2b')]!==_0xef51('0x3a')){var _0x425aba={};_0x425aba[_0x56db30[_0xef51('0x27')]]={'$like':'%'+_0x11ba57[_0xef51('0x2e')][_0xef51('0x38')]+'%'};return _0x425aba;}})});}_0x4e1cf0=_['merge']({},_0x4e1cf0,_0x11ba57[_0xef51('0x3b')]);var _0x1d1559={'where':_0x4e1cf0[_0xef51('0x35')]};return db[_0xef51('0x3c')][_0xef51('0x1f')](_0x1d1559)[_0xef51('0x25')](function(_0x406907){_0x2a9996[_0xef51('0x1f')]=_0x406907;if(_0x11ba57[_0xef51('0x2e')][_0xef51('0x3d')]){_0x4e1cf0[_0xef51('0x3e')]=[{'all':!![]}];}return db[_0xef51('0x3c')][_0xef51('0x3f')](_0x4e1cf0);})[_0xef51('0x25')](function(_0x426ad5){_0x2a9996[_0xef51('0x40')]=_0x426ad5;return _0x2a9996;})[_0xef51('0x25')](respondWithFilteredResult(_0x3cb7c1,_0x4e1cf0))[_0xef51('0x41')](handleError(_0x3cb7c1,null));};exports[_0xef51('0x42')]=function(_0x1fd71,_0x34068a){var _0x30b606={'raw':![],'where':{'id':_0x1fd71[_0xef51('0x43')]['id']}},_0x4da9f2={};_0x4da9f2[_0xef51('0x2d')]=_['keys'](db[_0xef51('0x3c')]['rawAttributes']);_0x4da9f2[_0xef51('0x2e')]=_[_0xef51('0x44')](_0x1fd71[_0xef51('0x2e')]);_0x4da9f2[_0xef51('0x37')]=_[_0xef51('0x2f')](_0x4da9f2[_0xef51('0x2d')],_0x4da9f2[_0xef51('0x2e')]);_0x30b606[_0xef51('0x31')]=_[_0xef51('0x2f')](_0x4da9f2[_0xef51('0x2d')],qs[_0xef51('0x30')](_0x1fd71[_0xef51('0x2e')][_0xef51('0x30')]));_0x30b606[_0xef51('0x31')]=_0x30b606['attributes'][_0xef51('0x32')]?_0x30b606['attributes']:_0x4da9f2[_0xef51('0x2d')];if(_0x1fd71['query'][_0xef51('0x3d')]){_0x30b606[_0xef51('0x3e')]=[{'all':!![]}];}_0x30b606=_['merge']({},_0x30b606,_0x1fd71['options']);return db['SalesforceConfiguration']['find'](_0x30b606)[_0xef51('0x25')](handleEntityNotFound(_0x34068a,null))[_0xef51('0x25')](respondWithResult(_0x34068a,null))['catch'](handleError(_0x34068a,null));};exports[_0xef51('0x45')]=function(_0x5b9fed,_0x173a50){return db[_0xef51('0x3c')][_0xef51('0x45')](_0x5b9fed[_0xef51('0x46')],{})[_0xef51('0x25')](respondWithResult(_0x173a50,0xc9))['catch'](handleError(_0x173a50,null));};exports['update']=function(_0x329f1d,_0x3b8e5d){if(_0x329f1d['body']['id']){delete _0x329f1d[_0xef51('0x46')]['id'];}return db[_0xef51('0x3c')][_0xef51('0x47')]({'where':{'id':_0x329f1d[_0xef51('0x43')]['id']}})[_0xef51('0x25')](handleEntityNotFound(_0x3b8e5d,null))['then'](saveUpdates(_0x329f1d[_0xef51('0x46')],null))[_0xef51('0x25')](respondWithResult(_0x3b8e5d,null))[_0xef51('0x41')](handleError(_0x3b8e5d,null));};exports[_0xef51('0x48')]=function(_0x45c9b9,_0x4b9ca3){return db[_0xef51('0x3c')][_0xef51('0x47')]({'where':{'id':_0x45c9b9['params']['id']}})['then'](handleEntityNotFound(_0x4b9ca3,null))['then'](removeEntity(_0x4b9ca3,null))['catch'](handleError(_0x4b9ca3,null));};exports[_0xef51('0x49')]=function(_0xc45337,_0x10c063,_0x474e55){var _0x4fc820={};var _0x535f2d={};var _0x18d5fa;var _0xfb05b0;return db['SalesforceConfiguration'][_0xef51('0x4a')]({'where':{'id':_0xc45337[_0xef51('0x43')]['id']}})[_0xef51('0x25')](handleEntityNotFound(_0x10c063,null))[_0xef51('0x25')](function(_0x2d676c){if(_0x2d676c){_0x18d5fa=_0x2d676c;_0x535f2d[_0xef51('0x2d')]=_['keys'](db[_0xef51('0x4b')]['rawAttributes']);_0x535f2d[_0xef51('0x2e')]=_[_0xef51('0x44')](_0xc45337[_0xef51('0x2e')]);_0x535f2d[_0xef51('0x37')]=_['intersection'](_0x535f2d['model'],_0x535f2d[_0xef51('0x2e')]);_0x4fc820['attributes']=_[_0xef51('0x2f')](_0x535f2d['model'],qs[_0xef51('0x30')](_0xc45337['query']['fields']));_0x4fc820['attributes']=_0x4fc820[_0xef51('0x31')][_0xef51('0x32')]?_0x4fc820[_0xef51('0x31')]:_0x535f2d[_0xef51('0x2d')];_0x4fc820[_0xef51('0x33')]=qs[_0xef51('0x34')](_0xc45337[_0xef51('0x2e')][_0xef51('0x34')]);_0x4fc820[_0xef51('0x35')]=qs[_0xef51('0x37')](_[_0xef51('0x36')](_0xc45337[_0xef51('0x2e')],_0x535f2d[_0xef51('0x37')]));if(_0xc45337['query'][_0xef51('0x38')]){_0x4fc820['where']=_[_0xef51('0x39')](_0x4fc820[_0xef51('0x35')],{'$or':_[_0xef51('0x29')](_0x4fc820[_0xef51('0x31')],function(_0x1d66e6){var _0x447114={};_0x447114[_0x1d66e6]={'$like':'%'+_0xc45337['query'][_0xef51('0x38')]+'%'};return _0x447114;})});}_0x4fc820=_[_0xef51('0x39')]({},_0x4fc820,_0xc45337[_0xef51('0x3b')]);return _0x18d5fa[_0xef51('0x49')](_0x4fc820);}})['then'](function(_0x3de2b7){if(_0x3de2b7){_0xfb05b0=_0x3de2b7[_0xef51('0x32')];if(!_0xc45337[_0xef51('0x2e')][_0xef51('0x4c')]('nolimit')){_0x4fc820[_0xef51('0x20')]=qs[_0xef51('0x20')](_0xc45337[_0xef51('0x2e')][_0xef51('0x20')]);_0x4fc820['offset']=qs[_0xef51('0x1d')](_0xc45337[_0xef51('0x2e')][_0xef51('0x1d')]);}return _0x18d5fa[_0xef51('0x49')](_0x4fc820);}})[_0xef51('0x25')](function(_0x4b6fb7){if(_0x4b6fb7){return _0x4b6fb7?{'count':_0xfb05b0,'rows':_0x4b6fb7}:null;}})['then'](respondWithResult(_0x10c063,null))[_0xef51('0x41')](handleError(_0x10c063,null));};exports[_0xef51('0x4d')]=function(_0x417bcc,_0x292e1b,_0xe28e54){var _0x36ee3e={};var _0x8f0fd4={};var _0x5db19b;var _0x3c96c5;return db[_0xef51('0x3c')]['findOne']({'where':{'id':_0x417bcc[_0xef51('0x43')]['id']}})[_0xef51('0x25')](handleEntityNotFound(_0x292e1b,null))[_0xef51('0x25')](function(_0x166a50){if(_0x166a50){_0x5db19b=_0x166a50;_0x8f0fd4[_0xef51('0x2d')]=_[_0xef51('0x44')](db[_0xef51('0x4b')][_0xef51('0x4e')]);_0x8f0fd4[_0xef51('0x2e')]=_[_0xef51('0x44')](_0x417bcc[_0xef51('0x2e')]);_0x8f0fd4[_0xef51('0x37')]=_['intersection'](_0x8f0fd4['model'],_0x8f0fd4[_0xef51('0x2e')]);_0x36ee3e[_0xef51('0x31')]=_[_0xef51('0x2f')](_0x8f0fd4['model'],qs['fields'](_0x417bcc['query'][_0xef51('0x30')]));_0x36ee3e[_0xef51('0x31')]=_0x36ee3e[_0xef51('0x31')]['length']?_0x36ee3e['attributes']:_0x8f0fd4[_0xef51('0x2d')];_0x36ee3e[_0xef51('0x33')]=qs[_0xef51('0x34')](_0x417bcc[_0xef51('0x2e')][_0xef51('0x34')]);_0x36ee3e[_0xef51('0x35')]=qs['filters'](_[_0xef51('0x36')](_0x417bcc['query'],_0x8f0fd4[_0xef51('0x37')]));if(_0x417bcc['query'][_0xef51('0x38')]){_0x36ee3e[_0xef51('0x35')]=_[_0xef51('0x39')](_0x36ee3e[_0xef51('0x35')],{'$or':_['map'](_0x36ee3e[_0xef51('0x31')],function(_0x203771){var _0x520d8a={};_0x520d8a[_0x203771]={'$like':'%'+_0x417bcc[_0xef51('0x2e')][_0xef51('0x38')]+'%'};return _0x520d8a;})});}_0x36ee3e=_['merge']({},_0x36ee3e,_0x417bcc[_0xef51('0x3b')]);return _0x5db19b['getSubjects'](_0x36ee3e);}})['then'](function(_0x4fc9dd){if(_0x4fc9dd){_0x3c96c5=_0x4fc9dd[_0xef51('0x32')];if(!_0x417bcc[_0xef51('0x2e')][_0xef51('0x4c')](_0xef51('0x4f'))){_0x36ee3e[_0xef51('0x20')]=qs['limit'](_0x417bcc[_0xef51('0x2e')][_0xef51('0x20')]);_0x36ee3e['offset']=qs['offset'](_0x417bcc['query'][_0xef51('0x1d')]);}return _0x5db19b[_0xef51('0x4d')](_0x36ee3e);}})['then'](function(_0x473bf5){if(_0x473bf5){return _0x473bf5?{'count':_0x3c96c5,'rows':_0x473bf5}:null;}})[_0xef51('0x25')](respondWithResult(_0x292e1b,null))[_0xef51('0x41')](handleError(_0x292e1b,null));};exports[_0xef51('0x50')]=function(_0x43fe65,_0x574b24,_0x347821){var _0x2e1b06={};var _0x124ea1={};var _0x563166;var _0x4816a8;return db[_0xef51('0x3c')]['findOne']({'where':{'id':_0x43fe65[_0xef51('0x43')]['id']}})[_0xef51('0x25')](handleEntityNotFound(_0x574b24,null))['then'](function(_0x3b2268){if(_0x3b2268){_0x563166=_0x3b2268;_0x124ea1[_0xef51('0x2d')]=_[_0xef51('0x44')](db[_0xef51('0x4b')][_0xef51('0x4e')]);_0x124ea1[_0xef51('0x2e')]=_['keys'](_0x43fe65['query']);_0x124ea1['filters']=_[_0xef51('0x2f')](_0x124ea1[_0xef51('0x2d')],_0x124ea1[_0xef51('0x2e')]);_0x2e1b06[_0xef51('0x31')]=_['intersection'](_0x124ea1[_0xef51('0x2d')],qs[_0xef51('0x30')](_0x43fe65['query'][_0xef51('0x30')]));_0x2e1b06['attributes']=_0x2e1b06[_0xef51('0x31')][_0xef51('0x32')]?_0x2e1b06[_0xef51('0x31')]:_0x124ea1[_0xef51('0x2d')];_0x2e1b06[_0xef51('0x33')]=qs[_0xef51('0x34')](_0x43fe65['query']['sort']);_0x2e1b06[_0xef51('0x35')]=qs[_0xef51('0x37')](_['pick'](_0x43fe65[_0xef51('0x2e')],_0x124ea1['filters']));if(_0x43fe65[_0xef51('0x2e')][_0xef51('0x38')]){_0x2e1b06[_0xef51('0x35')]=_['merge'](_0x2e1b06[_0xef51('0x35')],{'$or':_[_0xef51('0x29')](_0x2e1b06[_0xef51('0x31')],function(_0x5e7e08){var _0x102121={};_0x102121[_0x5e7e08]={'$like':'%'+_0x43fe65['query']['filter']+'%'};return _0x102121;})});}_0x2e1b06=_['merge']({},_0x2e1b06,_0x43fe65[_0xef51('0x3b')]);return _0x563166['getDescriptions'](_0x2e1b06);}})[_0xef51('0x25')](function(_0x274f15){if(_0x274f15){_0x4816a8=_0x274f15[_0xef51('0x32')];if(!_0x43fe65[_0xef51('0x2e')][_0xef51('0x4c')](_0xef51('0x4f'))){_0x2e1b06[_0xef51('0x20')]=qs[_0xef51('0x20')](_0x43fe65[_0xef51('0x2e')]['limit']);_0x2e1b06['offset']=qs[_0xef51('0x1d')](_0x43fe65['query'][_0xef51('0x1d')]);}return _0x563166[_0xef51('0x50')](_0x2e1b06);}})['then'](function(_0x557c20){if(_0x557c20){return _0x557c20?{'count':_0x4816a8,'rows':_0x557c20}:null;}})[_0xef51('0x25')](respondWithResult(_0x574b24,null))[_0xef51('0x41')](handleError(_0x574b24,null));}; \ No newline at end of file +var _0x2c46=['filters','intersection','attributes','fields','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','catch','keys','find','create','body','params','getFields','findOne','SalesforceField','pick','length','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','query'];(function(_0x47f719,_0x2e559d){var _0x407f4e=function(_0x2be03a){while(--_0x2be03a){_0x47f719['push'](_0x47f719['shift']());}};_0x407f4e(++_0x2e559d);}(_0x2c46,0x6f));var _0x62c4=function(_0x2fdf82,_0x322e7c){_0x2fdf82=_0x2fdf82-0x0;var _0x2382f5=_0x2c46[_0x2fdf82];return _0x2382f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x62c4('0x0'));var zipdir=require(_0x62c4('0x1'));var jsonpatch=require(_0x62c4('0x2'));var rp=require(_0x62c4('0x3'));var moment=require(_0x62c4('0x4'));var BPromise=require(_0x62c4('0x5'));var Mustache=require(_0x62c4('0x6'));var util=require(_0x62c4('0x7'));var path=require(_0x62c4('0x8'));var sox=require(_0x62c4('0x9'));var csv=require(_0x62c4('0xa'));var ejs=require(_0x62c4('0xb'));var fs=require('fs');var fs_extra=require(_0x62c4('0xc'));var _=require(_0x62c4('0xd'));var squel=require(_0x62c4('0xe'));var crypto=require(_0x62c4('0xf'));var jsforce=require(_0x62c4('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x62c4('0xa'));var querystring=require('querystring');var Papa=require(_0x62c4('0x11'));var Redis=require('ioredis');var authService=require(_0x62c4('0x12'));var qs=require(_0x62c4('0x13'));var as=require(_0x62c4('0x14'));var hardwareService=require(_0x62c4('0x15'));var logger=require(_0x62c4('0x16'))(_0x62c4('0x17'));var utils=require(_0x62c4('0x18'));var config=require(_0x62c4('0x19'));var licenseUtil=require(_0x62c4('0x1a'));var db=require(_0x62c4('0x1b'))['db'];function respondWithStatusCode(_0x272644,_0x8e25d3){_0x8e25d3=_0x8e25d3||0xcc;return function(_0x52881f){if(_0x52881f){return _0x272644['sendStatus'](_0x8e25d3);}return _0x272644[_0x62c4('0x1c')](_0x8e25d3)[_0x62c4('0x1d')]();};}function respondWithResult(_0x43d2d6,_0x1e47ca){_0x1e47ca=_0x1e47ca||0xc8;return function(_0x4d0835){if(_0x4d0835){return _0x43d2d6[_0x62c4('0x1c')](_0x1e47ca)['json'](_0x4d0835);}};}function respondWithFilteredResult(_0x5dfbfa,_0x5236a3){return function(_0x589ed0){if(_0x589ed0){var _0x4ec1bf=typeof _0x5236a3[_0x62c4('0x1e')]===_0x62c4('0x1f')&&typeof _0x5236a3[_0x62c4('0x20')]===_0x62c4('0x1f');var _0x1a5bd3=_0x589ed0[_0x62c4('0x21')];var _0x116364=_0x4ec1bf?0x0:_0x5236a3[_0x62c4('0x1e')];var _0x8eb11f=_0x4ec1bf?_0x589ed0[_0x62c4('0x21')]:_0x5236a3[_0x62c4('0x1e')]+_0x5236a3[_0x62c4('0x20')];var _0x9fa380;if(_0x8eb11f>=_0x1a5bd3){_0x8eb11f=_0x1a5bd3;_0x9fa380=0xc8;}else{_0x9fa380=0xce;}_0x5dfbfa[_0x62c4('0x1c')](_0x9fa380);return _0x5dfbfa[_0x62c4('0x22')](_0x62c4('0x23'),_0x116364+'-'+_0x8eb11f+'/'+_0x1a5bd3)[_0x62c4('0x24')](_0x589ed0);}return null;};}function patchUpdates(_0x436851){return function(_0x5b5a4b){try{jsonpatch[_0x62c4('0x25')](_0x5b5a4b,_0x436851,!![]);}catch(_0x5dee87){return BPromise[_0x62c4('0x26')](_0x5dee87);}return _0x5b5a4b[_0x62c4('0x27')]();};}function saveUpdates(_0x469558,_0x3a61c9){return function(_0x2f55a7){if(_0x2f55a7){return _0x2f55a7[_0x62c4('0x28')](_0x469558)['then'](function(_0x33e122){return _0x33e122;});}return null;};}function removeEntity(_0x59d140,_0x1ae3f6){return function(_0x527680){if(_0x527680){return _0x527680[_0x62c4('0x29')]()[_0x62c4('0x2a')](function(){_0x59d140[_0x62c4('0x1c')](0xcc)[_0x62c4('0x1d')]();});}};}function handleEntityNotFound(_0x53ed46,_0x5da32f){return function(_0x56d0c4){if(!_0x56d0c4){_0x53ed46[_0x62c4('0x2b')](0x194);}return _0x56d0c4;};}function handleError(_0xeea508,_0xc9f750){_0xc9f750=_0xc9f750||0x1f4;return function(_0x34cb29){logger['error'](_0x34cb29[_0x62c4('0x2c')]);if(_0x34cb29['name']){delete _0x34cb29[_0x62c4('0x2d')];}_0xeea508[_0x62c4('0x1c')](_0xc9f750)[_0x62c4('0x2e')](_0x34cb29);};}exports[_0x62c4('0x2f')]=function(_0x49bf1c,_0x47ded7){var _0x5d4a5f={},_0x1f63ee={},_0x3bceda={'count':0x0,'rows':[]};var _0x321f2b=_[_0x62c4('0x30')](db[_0x62c4('0x31')][_0x62c4('0x32')],function(_0x27f536){return{'name':_0x27f536[_0x62c4('0x33')],'type':_0x27f536[_0x62c4('0x34')]['key']};});_0x1f63ee[_0x62c4('0x35')]=_[_0x62c4('0x30')](_0x321f2b,'name');_0x1f63ee[_0x62c4('0x36')]=_['keys'](_0x49bf1c[_0x62c4('0x36')]);_0x1f63ee[_0x62c4('0x37')]=_[_0x62c4('0x38')](_0x1f63ee['model'],_0x1f63ee[_0x62c4('0x36')]);_0x5d4a5f[_0x62c4('0x39')]=_[_0x62c4('0x38')](_0x1f63ee[_0x62c4('0x35')],qs[_0x62c4('0x3a')](_0x49bf1c['query'][_0x62c4('0x3a')]));_0x5d4a5f[_0x62c4('0x39')]=_0x5d4a5f[_0x62c4('0x39')]['length']?_0x5d4a5f['attributes']:_0x1f63ee['model'];if(!_0x49bf1c['query']['hasOwnProperty'](_0x62c4('0x3b'))){_0x5d4a5f[_0x62c4('0x20')]=qs[_0x62c4('0x20')](_0x49bf1c[_0x62c4('0x36')][_0x62c4('0x20')]);_0x5d4a5f[_0x62c4('0x1e')]=qs[_0x62c4('0x1e')](_0x49bf1c['query'][_0x62c4('0x1e')]);}_0x5d4a5f[_0x62c4('0x3c')]=qs[_0x62c4('0x3d')](_0x49bf1c[_0x62c4('0x36')][_0x62c4('0x3d')]);_0x5d4a5f[_0x62c4('0x3e')]=qs[_0x62c4('0x37')](_['pick'](_0x49bf1c[_0x62c4('0x36')],_0x1f63ee[_0x62c4('0x37')]),_0x321f2b);if(_0x49bf1c[_0x62c4('0x36')]['filter']){_0x5d4a5f[_0x62c4('0x3e')]=_['merge'](_0x5d4a5f[_0x62c4('0x3e')],{'$or':_['map'](_0x321f2b,function(_0x20c94b){if(_0x20c94b['type']!==_0x62c4('0x3f')){var _0x14c79f={};_0x14c79f[_0x20c94b['name']]={'$like':'%'+_0x49bf1c['query'][_0x62c4('0x40')]+'%'};return _0x14c79f;}})});}_0x5d4a5f=_[_0x62c4('0x41')]({},_0x5d4a5f,_0x49bf1c[_0x62c4('0x42')]);var _0x33a343={'where':_0x5d4a5f[_0x62c4('0x3e')]};return db['SalesforceConfiguration']['count'](_0x33a343)['then'](function(_0x52f732){_0x3bceda[_0x62c4('0x21')]=_0x52f732;if(_0x49bf1c[_0x62c4('0x36')][_0x62c4('0x43')]){_0x5d4a5f[_0x62c4('0x44')]=[{'all':!![]}];}return db[_0x62c4('0x31')]['findAll'](_0x5d4a5f);})[_0x62c4('0x2a')](function(_0x2a944a){_0x3bceda['rows']=_0x2a944a;return _0x3bceda;})[_0x62c4('0x2a')](respondWithFilteredResult(_0x47ded7,_0x5d4a5f))[_0x62c4('0x45')](handleError(_0x47ded7,null));};exports['show']=function(_0x565536,_0x1058af){var _0x511150={'raw':![],'where':{'id':_0x565536['params']['id']}},_0x5df23e={};_0x5df23e[_0x62c4('0x35')]=_[_0x62c4('0x46')](db[_0x62c4('0x31')]['rawAttributes']);_0x5df23e['query']=_[_0x62c4('0x46')](_0x565536[_0x62c4('0x36')]);_0x5df23e[_0x62c4('0x37')]=_[_0x62c4('0x38')](_0x5df23e[_0x62c4('0x35')],_0x5df23e[_0x62c4('0x36')]);_0x511150[_0x62c4('0x39')]=_[_0x62c4('0x38')](_0x5df23e[_0x62c4('0x35')],qs[_0x62c4('0x3a')](_0x565536[_0x62c4('0x36')][_0x62c4('0x3a')]));_0x511150[_0x62c4('0x39')]=_0x511150[_0x62c4('0x39')]['length']?_0x511150[_0x62c4('0x39')]:_0x5df23e[_0x62c4('0x35')];if(_0x565536[_0x62c4('0x36')][_0x62c4('0x43')]){_0x511150[_0x62c4('0x44')]=[{'all':!![]}];}_0x511150=_[_0x62c4('0x41')]({},_0x511150,_0x565536[_0x62c4('0x42')]);return db[_0x62c4('0x31')][_0x62c4('0x47')](_0x511150)[_0x62c4('0x2a')](handleEntityNotFound(_0x1058af,null))['then'](respondWithResult(_0x1058af,null))[_0x62c4('0x45')](handleError(_0x1058af,null));};exports[_0x62c4('0x48')]=function(_0x22d612,_0x1aef9d){return db[_0x62c4('0x31')]['create'](_0x22d612[_0x62c4('0x49')],{})[_0x62c4('0x2a')](respondWithResult(_0x1aef9d,0xc9))[_0x62c4('0x45')](handleError(_0x1aef9d,null));};exports['update']=function(_0x1a4478,_0x5f0b14){if(_0x1a4478[_0x62c4('0x49')]['id']){delete _0x1a4478[_0x62c4('0x49')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x1a4478[_0x62c4('0x4a')]['id']}})[_0x62c4('0x2a')](handleEntityNotFound(_0x5f0b14,null))[_0x62c4('0x2a')](saveUpdates(_0x1a4478[_0x62c4('0x49')],null))['then'](respondWithResult(_0x5f0b14,null))['catch'](handleError(_0x5f0b14,null));};exports[_0x62c4('0x29')]=function(_0x2358d9,_0x48741c){return db[_0x62c4('0x31')][_0x62c4('0x47')]({'where':{'id':_0x2358d9['params']['id']}})[_0x62c4('0x2a')](handleEntityNotFound(_0x48741c,null))[_0x62c4('0x2a')](removeEntity(_0x48741c,null))[_0x62c4('0x45')](handleError(_0x48741c,null));};exports[_0x62c4('0x4b')]=function(_0x5819ee,_0x10ae3a,_0x1b4fd4){var _0x26a5b2={};var _0x807b2={};var _0x1b3c65;var _0x2539dc;return db['SalesforceConfiguration'][_0x62c4('0x4c')]({'where':{'id':_0x5819ee[_0x62c4('0x4a')]['id']}})[_0x62c4('0x2a')](handleEntityNotFound(_0x10ae3a,null))[_0x62c4('0x2a')](function(_0x261170){if(_0x261170){_0x1b3c65=_0x261170;_0x807b2[_0x62c4('0x35')]=_['keys'](db[_0x62c4('0x4d')][_0x62c4('0x32')]);_0x807b2['query']=_[_0x62c4('0x46')](_0x5819ee['query']);_0x807b2[_0x62c4('0x37')]=_[_0x62c4('0x38')](_0x807b2[_0x62c4('0x35')],_0x807b2[_0x62c4('0x36')]);_0x26a5b2[_0x62c4('0x39')]=_[_0x62c4('0x38')](_0x807b2[_0x62c4('0x35')],qs[_0x62c4('0x3a')](_0x5819ee[_0x62c4('0x36')][_0x62c4('0x3a')]));_0x26a5b2['attributes']=_0x26a5b2[_0x62c4('0x39')]['length']?_0x26a5b2[_0x62c4('0x39')]:_0x807b2[_0x62c4('0x35')];_0x26a5b2[_0x62c4('0x3c')]=qs[_0x62c4('0x3d')](_0x5819ee[_0x62c4('0x36')][_0x62c4('0x3d')]);_0x26a5b2[_0x62c4('0x3e')]=qs[_0x62c4('0x37')](_[_0x62c4('0x4e')](_0x5819ee['query'],_0x807b2[_0x62c4('0x37')]));if(_0x5819ee[_0x62c4('0x36')][_0x62c4('0x40')]){_0x26a5b2[_0x62c4('0x3e')]=_['merge'](_0x26a5b2[_0x62c4('0x3e')],{'$or':_[_0x62c4('0x30')](_0x26a5b2[_0x62c4('0x39')],function(_0x112a41){var _0x8edb92={};_0x8edb92[_0x112a41]={'$like':'%'+_0x5819ee[_0x62c4('0x36')][_0x62c4('0x40')]+'%'};return _0x8edb92;})});}_0x26a5b2=_['merge']({},_0x26a5b2,_0x5819ee[_0x62c4('0x42')]);return _0x1b3c65[_0x62c4('0x4b')](_0x26a5b2);}})[_0x62c4('0x2a')](function(_0x4cd201){if(_0x4cd201){_0x2539dc=_0x4cd201[_0x62c4('0x4f')];if(!_0x5819ee[_0x62c4('0x36')][_0x62c4('0x50')]('nolimit')){_0x26a5b2[_0x62c4('0x20')]=qs['limit'](_0x5819ee[_0x62c4('0x36')][_0x62c4('0x20')]);_0x26a5b2[_0x62c4('0x1e')]=qs['offset'](_0x5819ee['query']['offset']);}return _0x1b3c65[_0x62c4('0x4b')](_0x26a5b2);}})[_0x62c4('0x2a')](function(_0x5c25a2){if(_0x5c25a2){return _0x5c25a2?{'count':_0x2539dc,'rows':_0x5c25a2}:null;}})[_0x62c4('0x2a')](respondWithResult(_0x10ae3a,null))['catch'](handleError(_0x10ae3a,null));};exports[_0x62c4('0x51')]=function(_0x446353,_0x3e5d87,_0x5d6c5c){var _0x2f81a0={};var _0x302b09={};var _0x374411;var _0xb88bdf;return db[_0x62c4('0x31')][_0x62c4('0x4c')]({'where':{'id':_0x446353['params']['id']}})['then'](handleEntityNotFound(_0x3e5d87,null))[_0x62c4('0x2a')](function(_0x2e1075){if(_0x2e1075){_0x374411=_0x2e1075;_0x302b09['model']=_[_0x62c4('0x46')](db['SalesforceField'][_0x62c4('0x32')]);_0x302b09[_0x62c4('0x36')]=_['keys'](_0x446353[_0x62c4('0x36')]);_0x302b09[_0x62c4('0x37')]=_[_0x62c4('0x38')](_0x302b09[_0x62c4('0x35')],_0x302b09['query']);_0x2f81a0[_0x62c4('0x39')]=_[_0x62c4('0x38')](_0x302b09['model'],qs[_0x62c4('0x3a')](_0x446353[_0x62c4('0x36')][_0x62c4('0x3a')]));_0x2f81a0[_0x62c4('0x39')]=_0x2f81a0[_0x62c4('0x39')]['length']?_0x2f81a0[_0x62c4('0x39')]:_0x302b09[_0x62c4('0x35')];_0x2f81a0[_0x62c4('0x3c')]=qs[_0x62c4('0x3d')](_0x446353[_0x62c4('0x36')][_0x62c4('0x3d')]);_0x2f81a0[_0x62c4('0x3e')]=qs[_0x62c4('0x37')](_['pick'](_0x446353[_0x62c4('0x36')],_0x302b09[_0x62c4('0x37')]));if(_0x446353['query'][_0x62c4('0x40')]){_0x2f81a0['where']=_[_0x62c4('0x41')](_0x2f81a0[_0x62c4('0x3e')],{'$or':_[_0x62c4('0x30')](_0x2f81a0[_0x62c4('0x39')],function(_0xa8d7ad){var _0x3b087e={};_0x3b087e[_0xa8d7ad]={'$like':'%'+_0x446353[_0x62c4('0x36')]['filter']+'%'};return _0x3b087e;})});}_0x2f81a0=_['merge']({},_0x2f81a0,_0x446353[_0x62c4('0x42')]);return _0x374411['getSubjects'](_0x2f81a0);}})[_0x62c4('0x2a')](function(_0x5da52c){if(_0x5da52c){_0xb88bdf=_0x5da52c['length'];if(!_0x446353['query'][_0x62c4('0x50')]('nolimit')){_0x2f81a0[_0x62c4('0x20')]=qs[_0x62c4('0x20')](_0x446353['query'][_0x62c4('0x20')]);_0x2f81a0['offset']=qs['offset'](_0x446353['query'][_0x62c4('0x1e')]);}return _0x374411[_0x62c4('0x51')](_0x2f81a0);}})['then'](function(_0x4f1b7a){if(_0x4f1b7a){return _0x4f1b7a?{'count':_0xb88bdf,'rows':_0x4f1b7a}:null;}})[_0x62c4('0x2a')](respondWithResult(_0x3e5d87,null))['catch'](handleError(_0x3e5d87,null));};exports[_0x62c4('0x52')]=function(_0x586493,_0x52dfa5,_0x1f1fae){var _0x29a16e={};var _0x1309d6={};var _0x522b6e;var _0x364077;return db[_0x62c4('0x31')][_0x62c4('0x4c')]({'where':{'id':_0x586493[_0x62c4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x52dfa5,null))[_0x62c4('0x2a')](function(_0x40a261){if(_0x40a261){_0x522b6e=_0x40a261;_0x1309d6[_0x62c4('0x35')]=_['keys'](db[_0x62c4('0x4d')][_0x62c4('0x32')]);_0x1309d6[_0x62c4('0x36')]=_['keys'](_0x586493[_0x62c4('0x36')]);_0x1309d6[_0x62c4('0x37')]=_[_0x62c4('0x38')](_0x1309d6['model'],_0x1309d6[_0x62c4('0x36')]);_0x29a16e[_0x62c4('0x39')]=_['intersection'](_0x1309d6[_0x62c4('0x35')],qs['fields'](_0x586493[_0x62c4('0x36')]['fields']));_0x29a16e[_0x62c4('0x39')]=_0x29a16e[_0x62c4('0x39')][_0x62c4('0x4f')]?_0x29a16e['attributes']:_0x1309d6['model'];_0x29a16e[_0x62c4('0x3c')]=qs[_0x62c4('0x3d')](_0x586493[_0x62c4('0x36')][_0x62c4('0x3d')]);_0x29a16e[_0x62c4('0x3e')]=qs[_0x62c4('0x37')](_[_0x62c4('0x4e')](_0x586493[_0x62c4('0x36')],_0x1309d6[_0x62c4('0x37')]));if(_0x586493['query'][_0x62c4('0x40')]){_0x29a16e['where']=_[_0x62c4('0x41')](_0x29a16e['where'],{'$or':_[_0x62c4('0x30')](_0x29a16e[_0x62c4('0x39')],function(_0x360693){var _0x44f7b7={};_0x44f7b7[_0x360693]={'$like':'%'+_0x586493[_0x62c4('0x36')][_0x62c4('0x40')]+'%'};return _0x44f7b7;})});}_0x29a16e=_['merge']({},_0x29a16e,_0x586493[_0x62c4('0x42')]);return _0x522b6e[_0x62c4('0x52')](_0x29a16e);}})[_0x62c4('0x2a')](function(_0x4723f3){if(_0x4723f3){_0x364077=_0x4723f3[_0x62c4('0x4f')];if(!_0x586493[_0x62c4('0x36')]['hasOwnProperty'](_0x62c4('0x3b'))){_0x29a16e[_0x62c4('0x20')]=qs['limit'](_0x586493[_0x62c4('0x36')][_0x62c4('0x20')]);_0x29a16e[_0x62c4('0x1e')]=qs['offset'](_0x586493[_0x62c4('0x36')]['offset']);}return _0x522b6e[_0x62c4('0x52')](_0x29a16e);}})[_0x62c4('0x2a')](function(_0xd9d3da){if(_0xd9d3da){return _0xd9d3da?{'count':_0x364077,'rows':_0xd9d3da}:null;}})[_0x62c4('0x2a')](respondWithResult(_0x52dfa5,null))[_0x62c4('0x45')](handleError(_0x52dfa5,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index dd7c260..c159d20 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 _0xb305=['request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x1990e7,_0x179602){var _0x3a9c46=function(_0x3d274c){while(--_0x3d274c){_0x1990e7['push'](_0x1990e7['shift']());}};_0x3a9c46(++_0x179602);}(_0xb305,0xaf));var _0x5b30=function(_0x2c34b6,_0x4083ea){_0x2c34b6=_0x2c34b6-0x0;var _0x18687c=_0xb305[_0x2c34b6];return _0x18687c;};'use strict';var _=require(_0x5b30('0x0'));var util=require(_0x5b30('0x1'));var logger=require(_0x5b30('0x2'))(_0x5b30('0x3'));var moment=require(_0x5b30('0x4'));var BPromise=require('bluebird');var rp=require(_0x5b30('0x5'));var fs=require('fs');var path=require(_0x5b30('0x6'));var rimraf=require('rimraf');var config=require(_0x5b30('0x7'));var attributes=require(_0x5b30('0x8'));module['exports']=function(_0x460617,_0x489e2b){return _0x460617[_0x5b30('0x9')](_0x5b30('0xa'),attributes,{'tableName':_0x5b30('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x700b=['../../config/logger','api','moment','bluebird','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash','util'];(function(_0x567d9f,_0x44354c){var _0x28ab37=function(_0x1870ad){while(--_0x1870ad){_0x567d9f['push'](_0x567d9f['shift']());}};_0x28ab37(++_0x44354c);}(_0x700b,0xee));var _0xb700=function(_0x3e79d7,_0x440fab){_0x3e79d7=_0x3e79d7-0x0;var _0x3dd264=_0x700b[_0x3e79d7];return _0x3dd264;};'use strict';var _=require(_0xb700('0x0'));var util=require(_0xb700('0x1'));var logger=require(_0xb700('0x2'))(_0xb700('0x3'));var moment=require(_0xb700('0x4'));var BPromise=require(_0xb700('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb700('0x6'));var rimraf=require(_0xb700('0x7'));var config=require('../../config/environment');var attributes=require(_0xb700('0x8'));module[_0xb700('0x9')]=function(_0x5f4850,_0x23ad25){return _0x5f4850[_0xb700('0xa')](_0xb700('0xb'),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 4b310cb..b8767ef 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 _0x86eb=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0xe65ac8,_0x2691be){var _0x202ba1=function(_0x4af6ff){while(--_0x4af6ff){_0xe65ac8['push'](_0xe65ac8['shift']());}};_0x202ba1(++_0x2691be);}(_0x86eb,0x1b0));var _0xb86e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x86eb[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xb86e('0x0'));var util=require(_0xb86e('0x1'));var moment=require('moment');var BPromise=require(_0xb86e('0x2'));var rs=require(_0xb86e('0x3'));var fs=require('fs');var Redis=require(_0xb86e('0x4'));var db=require(_0xb86e('0x5'))['db'];var utils=require(_0xb86e('0x6'));var logger=require(_0xb86e('0x7'))(_0xb86e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb86e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x210d95,_0x33ff16,_0xd11111){return new BPromise(function(_0x458e2d,_0x392360){return client[_0xb86e('0xa')](_0x210d95,_0xd11111)['then'](function(_0x1782ae){logger[_0xb86e('0xb')](_0xb86e('0xc'),_0x33ff16,_0xb86e('0xd'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x33ff16,_0xb86e('0xd'),JSON[_0xb86e('0xe')](_0x1782ae));if(_0x1782ae['error']){if(_0x1782ae['error'][_0xb86e('0xf')]===0x1f4){logger[_0xb86e('0x10')](_0xb86e('0xc'),_0x33ff16,_0x1782ae[_0xb86e('0x10')][_0xb86e('0x11')]);return _0x392360(_0x1782ae[_0xb86e('0x10')]['message']);}logger[_0xb86e('0x10')](_0xb86e('0xc'),_0x33ff16,_0x1782ae[_0xb86e('0x10')][_0xb86e('0x11')]);return _0x458e2d(_0x1782ae[_0xb86e('0x10')][_0xb86e('0x11')]);}else{logger[_0xb86e('0xb')](_0xb86e('0xc'),_0x33ff16,_0xb86e('0xd'));_0x458e2d(_0x1782ae[_0xb86e('0x12')][_0xb86e('0x11')]);}})['catch'](function(_0x33cb50){logger[_0xb86e('0x10')](_0xb86e('0xc'),_0x33ff16,_0x33cb50);_0x392360(_0x33cb50);});});} \ No newline at end of file +var _0x30ef=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x25f4b5,_0x19c597){var _0x370dda=function(_0x45e95e){while(--_0x45e95e){_0x25f4b5['push'](_0x25f4b5['shift']());}};_0x370dda(++_0x19c597);}(_0x30ef,0x1cf));var _0xf30e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30ef[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf30e('0x0'));var util=require(_0xf30e('0x1'));var moment=require(_0xf30e('0x2'));var BPromise=require(_0xf30e('0x3'));var rs=require(_0xf30e('0x4'));var fs=require('fs');var Redis=require(_0xf30e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf30e('0x6'))(_0xf30e('0x7'));var config=require(_0xf30e('0x8'));var jayson=require(_0xf30e('0x9'));var client=jayson['client'][_0xf30e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x216d30,_0xa714e6,_0x3e8747){return new BPromise(function(_0x2bb824,_0x1c865b){return client[_0xf30e('0xb')](_0x216d30,_0x3e8747)[_0xf30e('0xc')](function(_0xfb1f44){logger['info'](_0xf30e('0xd'),_0xa714e6,_0xf30e('0xe'));logger[_0xf30e('0xf')](_0xf30e('0x10'),_0xa714e6,_0xf30e('0xe'),JSON[_0xf30e('0x11')](_0xfb1f44));if(_0xfb1f44[_0xf30e('0x12')]){if(_0xfb1f44[_0xf30e('0x12')][_0xf30e('0x13')]===0x1f4){logger[_0xf30e('0x12')](_0xf30e('0xd'),_0xa714e6,_0xfb1f44[_0xf30e('0x12')][_0xf30e('0x14')]);return _0x1c865b(_0xfb1f44[_0xf30e('0x12')][_0xf30e('0x14')]);}logger[_0xf30e('0x12')](_0xf30e('0xd'),_0xa714e6,_0xfb1f44[_0xf30e('0x12')][_0xf30e('0x14')]);return _0x2bb824(_0xfb1f44[_0xf30e('0x12')]['message']);}else{logger['info'](_0xf30e('0xd'),_0xa714e6,_0xf30e('0xe'));_0x2bb824(_0xfb1f44[_0xf30e('0x15')][_0xf30e('0x14')]);}})[_0xf30e('0x16')](function(_0x3189b4){logger[_0xf30e('0x12')](_0xf30e('0xd'),_0xa714e6,_0x3189b4);_0x1c865b(_0x3189b4);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 8b2f7b6..58761ef 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 _0xe093=['get','isAuthenticated','index','/:id','show','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller'];(function(_0x2b6264,_0x2b2258){var _0x4b136c=function(_0x4082a2){while(--_0x4082a2){_0x2b6264['push'](_0x2b6264['shift']());}};_0x4b136c(++_0x2b2258);}(_0xe093,0x14b));var _0x3e09=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xe093[_0x40220a];return _0x3903cc;};'use strict';var multer=require(_0x3e09('0x0'));var util=require(_0x3e09('0x1'));var path=require(_0x3e09('0x2'));var timeout=require(_0x3e09('0x3'));var express=require('express');var router=express[_0x3e09('0x4')]();var fs_extra=require(_0x3e09('0x5'));var auth=require(_0x3e09('0x6'));var interaction=require(_0x3e09('0x7'));var config=require('../../config/environment');var controller=require(_0x3e09('0x8'));router[_0x3e09('0x9')]('/',auth[_0x3e09('0xa')](),controller[_0x3e09('0xb')]);router[_0x3e09('0x9')](_0x3e09('0xc'),auth[_0x3e09('0xa')](),controller[_0x3e09('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3e09('0xe')]('/:id',auth[_0x3e09('0xa')](),controller['update']);router['delete'](_0x3e09('0xc'),auth['isAuthenticated'](),controller[_0x3e09('0xf')]);module[_0x3e09('0x10')]=router; \ No newline at end of file +var _0x2cab=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x3d35ba,_0x5f30a){var _0x92602e=function(_0x4b9b1a){while(--_0x4b9b1a){_0x3d35ba['push'](_0x3d35ba['shift']());}};_0x92602e(++_0x5f30a);}(_0x2cab,0x78));var _0xb2ca=function(_0x2e4147,_0x1bf709){_0x2e4147=_0x2e4147-0x0;var _0x1b5d2f=_0x2cab[_0x2e4147];return _0x1b5d2f;};'use strict';var multer=require(_0xb2ca('0x0'));var util=require('util');var path=require(_0xb2ca('0x1'));var timeout=require(_0xb2ca('0x2'));var express=require(_0xb2ca('0x3'));var router=express[_0xb2ca('0x4')]();var fs_extra=require(_0xb2ca('0x5'));var auth=require(_0xb2ca('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb2ca('0x7'));var controller=require(_0xb2ca('0x8'));router[_0xb2ca('0x9')]('/',auth[_0xb2ca('0xa')](),controller[_0xb2ca('0xb')]);router[_0xb2ca('0x9')](_0xb2ca('0xc'),auth['isAuthenticated'](),controller[_0xb2ca('0xd')]);router[_0xb2ca('0xe')]('/',auth['isAuthenticated'](),controller[_0xb2ca('0xf')]);router[_0xb2ca('0x10')](_0xb2ca('0xc'),auth[_0xb2ca('0xa')](),controller[_0xb2ca('0x11')]);router[_0xb2ca('0x12')](_0xb2ca('0xc'),auth[_0xb2ca('0xa')](),controller[_0xb2ca('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 1df3944..0ae8d1c 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 _0x9835=['ENUM','variable','customVariable','sequelize','exports','string','keyValue','picklist','STRING'];(function(_0x1a1cdb,_0x234fb2){var _0x430b6b=function(_0x5208a9){while(--_0x5208a9){_0x1a1cdb['push'](_0x1a1cdb['shift']());}};_0x430b6b(++_0x234fb2);}(_0x9835,0x174));var _0x5983=function(_0x34a657,_0x297e2d){_0x34a657=_0x34a657-0x0;var _0x9ec6a=_0x9835[_0x34a657];return _0x9ec6a;};'use strict';var Sequelize=require(_0x5983('0x0'));module[_0x5983('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5983('0x2'),'variable','customVariable',_0x5983('0x3'),_0x5983('0x4')),'defaultValue':_0x5983('0x2')},'content':{'type':Sequelize[_0x5983('0x5')]},'key':{'type':Sequelize[_0x5983('0x5')]},'keyType':{'type':Sequelize[_0x5983('0x6')](_0x5983('0x2'),_0x5983('0x7'),_0x5983('0x8'))},'keyContent':{'type':Sequelize[_0x5983('0x5')]},'idField':{'type':Sequelize[_0x5983('0x5')]},'variableName':{'type':Sequelize[_0x5983('0x5')]}}; \ No newline at end of file +var _0x705a=['string','STRING','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x514ef6,_0x26d454){var _0x394c0b=function(_0x50de8f){while(--_0x50de8f){_0x514ef6['push'](_0x514ef6['shift']());}};_0x394c0b(++_0x26d454);}(_0x705a,0xd1));var _0xa705=function(_0x4f019f,_0x24c82e){_0x4f019f=_0x4f019f-0x0;var _0x43a474=_0x705a[_0x4f019f];return _0x43a474;};'use strict';var Sequelize=require(_0xa705('0x0'));module[_0xa705('0x1')]={'type':{'type':Sequelize[_0xa705('0x2')]('string',_0xa705('0x3'),_0xa705('0x4'),_0xa705('0x5'),_0xa705('0x6')),'defaultValue':_0xa705('0x7')},'content':{'type':Sequelize[_0xa705('0x8')]},'key':{'type':Sequelize[_0xa705('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xa705('0x7'),_0xa705('0x3'),_0xa705('0x4'))},'keyContent':{'type':Sequelize[_0xa705('0x8')]},'idField':{'type':Sequelize[_0xa705('0x8')]},'variableName':{'type':Sequelize[_0xa705('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index ab48fc8..40bbdd5 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 _0xdba3=['map','SalesforceField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','error','stack','name','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdba3,0x197));var _0x3dba=function(_0x4fb9f7,_0x539325){_0x4fb9f7=_0x4fb9f7-0x0;var _0x5d0355=_0xdba3[_0x4fb9f7];return _0x5d0355;};'use strict';var emlformat=require(_0x3dba('0x0'));var rimraf=require(_0x3dba('0x1'));var zipdir=require(_0x3dba('0x2'));var jsonpatch=require(_0x3dba('0x3'));var rp=require('request-promise');var moment=require(_0x3dba('0x4'));var BPromise=require(_0x3dba('0x5'));var Mustache=require(_0x3dba('0x6'));var util=require(_0x3dba('0x7'));var path=require(_0x3dba('0x8'));var sox=require(_0x3dba('0x9'));var csv=require(_0x3dba('0xa'));var ejs=require(_0x3dba('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3dba('0xc'));var squel=require(_0x3dba('0xd'));var crypto=require(_0x3dba('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3dba('0xa'));var querystring=require(_0x3dba('0xf'));var Papa=require(_0x3dba('0x10'));var Redis=require(_0x3dba('0x11'));var authService=require(_0x3dba('0x12'));var qs=require(_0x3dba('0x13'));var as=require(_0x3dba('0x14'));var hardwareService=require(_0x3dba('0x15'));var logger=require(_0x3dba('0x16'))(_0x3dba('0x17'));var utils=require('../../config/utils');var config=require(_0x3dba('0x18'));var licenseUtil=require(_0x3dba('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31cdbf,_0x4e710c){_0x4e710c=_0x4e710c||0xcc;return function(_0x587501){if(_0x587501){return _0x31cdbf['sendStatus'](_0x4e710c);}return _0x31cdbf[_0x3dba('0x1a')](_0x4e710c)[_0x3dba('0x1b')]();};}function respondWithResult(_0x3b4aa1,_0x46160d){_0x46160d=_0x46160d||0xc8;return function(_0x554924){if(_0x554924){return _0x3b4aa1['status'](_0x46160d)[_0x3dba('0x1c')](_0x554924);}};}function respondWithFilteredResult(_0x2fe4c9,_0x769070){return function(_0x56cb5a){if(_0x56cb5a){var _0x218219=typeof _0x769070[_0x3dba('0x1d')]===_0x3dba('0x1e')&&typeof _0x769070[_0x3dba('0x1f')]===_0x3dba('0x1e');var _0x2a44fa=_0x56cb5a[_0x3dba('0x20')];var _0x2678b2=_0x218219?0x0:_0x769070[_0x3dba('0x1d')];var _0x44c3e8=_0x218219?_0x56cb5a[_0x3dba('0x20')]:_0x769070[_0x3dba('0x1d')]+_0x769070['limit'];var _0x53dbdf;if(_0x44c3e8>=_0x2a44fa){_0x44c3e8=_0x2a44fa;_0x53dbdf=0xc8;}else{_0x53dbdf=0xce;}_0x2fe4c9[_0x3dba('0x1a')](_0x53dbdf);return _0x2fe4c9[_0x3dba('0x21')](_0x3dba('0x22'),_0x2678b2+'-'+_0x44c3e8+'/'+_0x2a44fa)[_0x3dba('0x1c')](_0x56cb5a);}return null;};}function patchUpdates(_0x5a8910){return function(_0x103bc5){try{jsonpatch['apply'](_0x103bc5,_0x5a8910,!![]);}catch(_0x10c355){return BPromise[_0x3dba('0x23')](_0x10c355);}return _0x103bc5[_0x3dba('0x24')]();};}function saveUpdates(_0x2d5846,_0x549374){return function(_0x5d5cfb){if(_0x5d5cfb){return _0x5d5cfb['update'](_0x2d5846)['then'](function(_0x4462c2){return _0x4462c2;});}return null;};}function removeEntity(_0x1a7ed9,_0x361778){return function(_0x4bb495){if(_0x4bb495){return _0x4bb495[_0x3dba('0x25')]()[_0x3dba('0x26')](function(){_0x1a7ed9[_0x3dba('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x161b88,_0x513163){return function(_0x4a7d79){if(!_0x4a7d79){_0x161b88['sendStatus'](0x194);}return _0x4a7d79;};}function handleError(_0x33a1bb,_0x1c7dde){_0x1c7dde=_0x1c7dde||0x1f4;return function(_0x2aead0){logger[_0x3dba('0x27')](_0x2aead0[_0x3dba('0x28')]);if(_0x2aead0[_0x3dba('0x29')]){delete _0x2aead0[_0x3dba('0x29')];}_0x33a1bb['status'](_0x1c7dde)['send'](_0x2aead0);};}exports[_0x3dba('0x2a')]=function(_0x13dfb2,_0x3bdc5d){var _0x426f1c={},_0x33a866={},_0x5b5c3a={'count':0x0,'rows':[]};var _0x56e698=_[_0x3dba('0x2b')](db[_0x3dba('0x2c')][_0x3dba('0x2d')],function(_0x2dde8a){return{'name':_0x2dde8a[_0x3dba('0x2e')],'type':_0x2dde8a[_0x3dba('0x2f')][_0x3dba('0x30')]};});_0x33a866['model']=_[_0x3dba('0x2b')](_0x56e698,_0x3dba('0x29'));_0x33a866[_0x3dba('0x31')]=_[_0x3dba('0x32')](_0x13dfb2['query']);_0x33a866[_0x3dba('0x33')]=_[_0x3dba('0x34')](_0x33a866[_0x3dba('0x35')],_0x33a866[_0x3dba('0x31')]);_0x426f1c[_0x3dba('0x36')]=_[_0x3dba('0x34')](_0x33a866[_0x3dba('0x35')],qs['fields'](_0x13dfb2['query'][_0x3dba('0x37')]));_0x426f1c['attributes']=_0x426f1c[_0x3dba('0x36')]['length']?_0x426f1c[_0x3dba('0x36')]:_0x33a866[_0x3dba('0x35')];if(!_0x13dfb2[_0x3dba('0x31')]['hasOwnProperty'](_0x3dba('0x38'))){_0x426f1c[_0x3dba('0x1f')]=qs[_0x3dba('0x1f')](_0x13dfb2[_0x3dba('0x31')][_0x3dba('0x1f')]);_0x426f1c[_0x3dba('0x1d')]=qs['offset'](_0x13dfb2['query']['offset']);}_0x426f1c[_0x3dba('0x39')]=qs[_0x3dba('0x3a')](_0x13dfb2[_0x3dba('0x31')][_0x3dba('0x3a')]);_0x426f1c[_0x3dba('0x3b')]=qs[_0x3dba('0x33')](_[_0x3dba('0x3c')](_0x13dfb2[_0x3dba('0x31')],_0x33a866[_0x3dba('0x33')]),_0x56e698);if(_0x13dfb2[_0x3dba('0x31')][_0x3dba('0x3d')]){_0x426f1c[_0x3dba('0x3b')]=_[_0x3dba('0x3e')](_0x426f1c[_0x3dba('0x3b')],{'$or':_[_0x3dba('0x2b')](_0x56e698,function(_0x129dc5){if(_0x129dc5[_0x3dba('0x2f')]!==_0x3dba('0x3f')){var _0x42b1df={};_0x42b1df[_0x129dc5['name']]={'$like':'%'+_0x13dfb2['query'][_0x3dba('0x3d')]+'%'};return _0x42b1df;}})});}_0x426f1c=_[_0x3dba('0x3e')]({},_0x426f1c,_0x13dfb2['options']);var _0x3f56e7={'where':_0x426f1c['where']};return db['SalesforceField'][_0x3dba('0x20')](_0x3f56e7)[_0x3dba('0x26')](function(_0x47a906){_0x5b5c3a['count']=_0x47a906;if(_0x13dfb2[_0x3dba('0x31')][_0x3dba('0x40')]){_0x426f1c[_0x3dba('0x41')]=[{'all':!![]}];}return db['SalesforceField'][_0x3dba('0x42')](_0x426f1c);})[_0x3dba('0x26')](function(_0x4243ec){_0x5b5c3a[_0x3dba('0x43')]=_0x4243ec;return _0x5b5c3a;})[_0x3dba('0x26')](respondWithFilteredResult(_0x3bdc5d,_0x426f1c))['catch'](handleError(_0x3bdc5d,null));};exports[_0x3dba('0x44')]=function(_0x1b8365,_0x1fd6b5){var _0x24e64b={'raw':!![],'where':{'id':_0x1b8365[_0x3dba('0x45')]['id']}},_0x3603b7={};_0x3603b7['model']=_[_0x3dba('0x32')](db['SalesforceField'][_0x3dba('0x2d')]);_0x3603b7['query']=_['keys'](_0x1b8365[_0x3dba('0x31')]);_0x3603b7['filters']=_[_0x3dba('0x34')](_0x3603b7['model'],_0x3603b7[_0x3dba('0x31')]);_0x24e64b['attributes']=_['intersection'](_0x3603b7[_0x3dba('0x35')],qs[_0x3dba('0x37')](_0x1b8365['query'][_0x3dba('0x37')]));_0x24e64b[_0x3dba('0x36')]=_0x24e64b[_0x3dba('0x36')][_0x3dba('0x46')]?_0x24e64b[_0x3dba('0x36')]:_0x3603b7[_0x3dba('0x35')];if(_0x1b8365[_0x3dba('0x31')]['includeAll']){_0x24e64b['include']=[{'all':!![]}];}_0x24e64b=_['merge']({},_0x24e64b,_0x1b8365['options']);return db[_0x3dba('0x2c')][_0x3dba('0x47')](_0x24e64b)['then'](handleEntityNotFound(_0x1fd6b5,null))[_0x3dba('0x26')](respondWithResult(_0x1fd6b5,null))[_0x3dba('0x48')](handleError(_0x1fd6b5,null));};exports[_0x3dba('0x49')]=function(_0x2cc942,_0x15d7ad){return db['SalesforceField']['create'](_0x2cc942[_0x3dba('0x4a')],{})[_0x3dba('0x26')](respondWithResult(_0x15d7ad,0xc9))[_0x3dba('0x48')](handleError(_0x15d7ad,null));};exports['update']=function(_0x2eac07,_0x9e5414){if(_0x2eac07['body']['id']){delete _0x2eac07[_0x3dba('0x4a')]['id'];}return db[_0x3dba('0x2c')][_0x3dba('0x47')]({'where':{'id':_0x2eac07[_0x3dba('0x45')]['id']}})[_0x3dba('0x26')](handleEntityNotFound(_0x9e5414,null))['then'](saveUpdates(_0x2eac07[_0x3dba('0x4a')],null))[_0x3dba('0x26')](respondWithResult(_0x9e5414,null))[_0x3dba('0x48')](handleError(_0x9e5414,null));};exports[_0x3dba('0x25')]=function(_0x25c9cb,_0x4b2825){return db['SalesforceField'][_0x3dba('0x47')]({'where':{'id':_0x25c9cb[_0x3dba('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b2825,null))[_0x3dba('0x26')](removeEntity(_0x4b2825,null))['catch'](handleError(_0x4b2825,null));}; \ No newline at end of file +var _0xb636=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xb636,0x194));var _0x6b63=function(_0x34131e,_0x58db07){_0x34131e=_0x34131e-0x0;var _0x5fa82b=_0xb636[_0x34131e];return _0x5fa82b;};'use strict';var emlformat=require(_0x6b63('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b63('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b63('0x2'));var moment=require(_0x6b63('0x3'));var BPromise=require(_0x6b63('0x4'));var Mustache=require(_0x6b63('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6b63('0x6'));var csv=require(_0x6b63('0x7'));var ejs=require(_0x6b63('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b63('0x9'));var squel=require('squel');var crypto=require(_0x6b63('0xa'));var jsforce=require(_0x6b63('0xb'));var deskjs=require(_0x6b63('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6b63('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6b63('0xe'));var qs=require(_0x6b63('0xf'));var as=require(_0x6b63('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b63('0x11'))(_0x6b63('0x12'));var utils=require('../../config/utils');var config=require(_0x6b63('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x105d96,_0x36de77){_0x36de77=_0x36de77||0xcc;return function(_0xae7fa1){if(_0xae7fa1){return _0x105d96[_0x6b63('0x14')](_0x36de77);}return _0x105d96['status'](_0x36de77)[_0x6b63('0x15')]();};}function respondWithResult(_0x5f0801,_0x4b3540){_0x4b3540=_0x4b3540||0xc8;return function(_0x301a0e){if(_0x301a0e){return _0x5f0801['status'](_0x4b3540)[_0x6b63('0x16')](_0x301a0e);}};}function respondWithFilteredResult(_0x57d150,_0x1396db){return function(_0x3f0d9c){if(_0x3f0d9c){var _0x15b1c8=typeof _0x1396db[_0x6b63('0x17')]==='undefined'&&typeof _0x1396db[_0x6b63('0x18')]==='undefined';var _0x1d08fb=_0x3f0d9c['count'];var _0x984231=_0x15b1c8?0x0:_0x1396db[_0x6b63('0x17')];var _0x328dff=_0x15b1c8?_0x3f0d9c['count']:_0x1396db[_0x6b63('0x17')]+_0x1396db['limit'];var _0x47745e;if(_0x328dff>=_0x1d08fb){_0x328dff=_0x1d08fb;_0x47745e=0xc8;}else{_0x47745e=0xce;}_0x57d150[_0x6b63('0x19')](_0x47745e);return _0x57d150[_0x6b63('0x1a')](_0x6b63('0x1b'),_0x984231+'-'+_0x328dff+'/'+_0x1d08fb)[_0x6b63('0x16')](_0x3f0d9c);}return null;};}function patchUpdates(_0x19828e){return function(_0x19ec2f){try{jsonpatch[_0x6b63('0x1c')](_0x19ec2f,_0x19828e,!![]);}catch(_0x40e0f6){return BPromise[_0x6b63('0x1d')](_0x40e0f6);}return _0x19ec2f[_0x6b63('0x1e')]();};}function saveUpdates(_0x9c9a41,_0x13ccaa){return function(_0x197c9f){if(_0x197c9f){return _0x197c9f[_0x6b63('0x1f')](_0x9c9a41)[_0x6b63('0x20')](function(_0x4b7303){return _0x4b7303;});}return null;};}function removeEntity(_0x3b1b14,_0x4b6ba7){return function(_0x472706){if(_0x472706){return _0x472706['destroy']()[_0x6b63('0x20')](function(){_0x3b1b14[_0x6b63('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8ff41f,_0x1aa2ed){return function(_0x18d231){if(!_0x18d231){_0x8ff41f[_0x6b63('0x14')](0x194);}return _0x18d231;};}function handleError(_0x4ff720,_0x37405a){_0x37405a=_0x37405a||0x1f4;return function(_0xf3b921){logger['error'](_0xf3b921[_0x6b63('0x21')]);if(_0xf3b921[_0x6b63('0x22')]){delete _0xf3b921[_0x6b63('0x22')];}_0x4ff720['status'](_0x37405a)[_0x6b63('0x23')](_0xf3b921);};}exports[_0x6b63('0x24')]=function(_0x439b2d,_0x4383e0){var _0x456056={},_0xb74e4e={},_0x5600e4={'count':0x0,'rows':[]};var _0x95125d=_[_0x6b63('0x25')](db[_0x6b63('0x26')][_0x6b63('0x27')],function(_0x2b7918){return{'name':_0x2b7918[_0x6b63('0x28')],'type':_0x2b7918['type'][_0x6b63('0x29')]};});_0xb74e4e[_0x6b63('0x2a')]=_[_0x6b63('0x25')](_0x95125d,'name');_0xb74e4e[_0x6b63('0x2b')]=_[_0x6b63('0x2c')](_0x439b2d[_0x6b63('0x2b')]);_0xb74e4e['filters']=_['intersection'](_0xb74e4e[_0x6b63('0x2a')],_0xb74e4e[_0x6b63('0x2b')]);_0x456056[_0x6b63('0x2d')]=_[_0x6b63('0x2e')](_0xb74e4e[_0x6b63('0x2a')],qs['fields'](_0x439b2d[_0x6b63('0x2b')][_0x6b63('0x2f')]));_0x456056[_0x6b63('0x2d')]=_0x456056['attributes']['length']?_0x456056[_0x6b63('0x2d')]:_0xb74e4e['model'];if(!_0x439b2d[_0x6b63('0x2b')][_0x6b63('0x30')](_0x6b63('0x31'))){_0x456056[_0x6b63('0x18')]=qs[_0x6b63('0x18')](_0x439b2d[_0x6b63('0x2b')]['limit']);_0x456056[_0x6b63('0x17')]=qs[_0x6b63('0x17')](_0x439b2d[_0x6b63('0x2b')][_0x6b63('0x17')]);}_0x456056[_0x6b63('0x32')]=qs[_0x6b63('0x33')](_0x439b2d[_0x6b63('0x2b')]['sort']);_0x456056[_0x6b63('0x34')]=qs[_0x6b63('0x35')](_[_0x6b63('0x36')](_0x439b2d[_0x6b63('0x2b')],_0xb74e4e[_0x6b63('0x35')]),_0x95125d);if(_0x439b2d['query'][_0x6b63('0x37')]){_0x456056[_0x6b63('0x34')]=_[_0x6b63('0x38')](_0x456056['where'],{'$or':_[_0x6b63('0x25')](_0x95125d,function(_0x4e8f78){if(_0x4e8f78['type']!==_0x6b63('0x39')){var _0x5dcfef={};_0x5dcfef[_0x4e8f78[_0x6b63('0x22')]]={'$like':'%'+_0x439b2d['query'][_0x6b63('0x37')]+'%'};return _0x5dcfef;}})});}_0x456056=_[_0x6b63('0x38')]({},_0x456056,_0x439b2d[_0x6b63('0x3a')]);var _0x4d4b32={'where':_0x456056['where']};return db[_0x6b63('0x26')][_0x6b63('0x3b')](_0x4d4b32)[_0x6b63('0x20')](function(_0x3ffcba){_0x5600e4[_0x6b63('0x3b')]=_0x3ffcba;if(_0x439b2d[_0x6b63('0x2b')][_0x6b63('0x3c')]){_0x456056[_0x6b63('0x3d')]=[{'all':!![]}];}return db[_0x6b63('0x26')][_0x6b63('0x3e')](_0x456056);})[_0x6b63('0x20')](function(_0x27808a){_0x5600e4[_0x6b63('0x3f')]=_0x27808a;return _0x5600e4;})[_0x6b63('0x20')](respondWithFilteredResult(_0x4383e0,_0x456056))[_0x6b63('0x40')](handleError(_0x4383e0,null));};exports[_0x6b63('0x41')]=function(_0x5239ea,_0x15ffe9){var _0x51828b={'raw':!![],'where':{'id':_0x5239ea[_0x6b63('0x42')]['id']}},_0x40f7aa={};_0x40f7aa[_0x6b63('0x2a')]=_[_0x6b63('0x2c')](db['SalesforceField'][_0x6b63('0x27')]);_0x40f7aa[_0x6b63('0x2b')]=_[_0x6b63('0x2c')](_0x5239ea[_0x6b63('0x2b')]);_0x40f7aa[_0x6b63('0x35')]=_[_0x6b63('0x2e')](_0x40f7aa['model'],_0x40f7aa[_0x6b63('0x2b')]);_0x51828b[_0x6b63('0x2d')]=_[_0x6b63('0x2e')](_0x40f7aa['model'],qs[_0x6b63('0x2f')](_0x5239ea[_0x6b63('0x2b')]['fields']));_0x51828b[_0x6b63('0x2d')]=_0x51828b[_0x6b63('0x2d')][_0x6b63('0x43')]?_0x51828b[_0x6b63('0x2d')]:_0x40f7aa[_0x6b63('0x2a')];if(_0x5239ea[_0x6b63('0x2b')]['includeAll']){_0x51828b[_0x6b63('0x3d')]=[{'all':!![]}];}_0x51828b=_['merge']({},_0x51828b,_0x5239ea[_0x6b63('0x3a')]);return db[_0x6b63('0x26')]['find'](_0x51828b)[_0x6b63('0x20')](handleEntityNotFound(_0x15ffe9,null))[_0x6b63('0x20')](respondWithResult(_0x15ffe9,null))[_0x6b63('0x40')](handleError(_0x15ffe9,null));};exports[_0x6b63('0x44')]=function(_0x11a167,_0x51ec7d){return db[_0x6b63('0x26')]['create'](_0x11a167[_0x6b63('0x45')],{})['then'](respondWithResult(_0x51ec7d,0xc9))[_0x6b63('0x40')](handleError(_0x51ec7d,null));};exports[_0x6b63('0x1f')]=function(_0xd1c29b,_0x2261b3){if(_0xd1c29b['body']['id']){delete _0xd1c29b[_0x6b63('0x45')]['id'];}return db[_0x6b63('0x26')]['find']({'where':{'id':_0xd1c29b['params']['id']}})[_0x6b63('0x20')](handleEntityNotFound(_0x2261b3,null))['then'](saveUpdates(_0xd1c29b['body'],null))[_0x6b63('0x20')](respondWithResult(_0x2261b3,null))['catch'](handleError(_0x2261b3,null));};exports['destroy']=function(_0x2e6906,_0x3825f7){return db[_0x6b63('0x26')]['find']({'where':{'id':_0x2e6906[_0x6b63('0x42')]['id']}})['then'](handleEntityNotFound(_0x3825f7,null))[_0x6b63('0x20')](removeEntity(_0x3825f7,null))[_0x6b63('0x40')](handleError(_0x3825f7,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 32437f0..3615ac4 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 _0x8a09=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash'];(function(_0x4e198a,_0x5a6bad){var _0xb84bfe=function(_0x58d2b2){while(--_0x58d2b2){_0x4e198a['push'](_0x4e198a['shift']());}};_0xb84bfe(++_0x5a6bad);}(_0x8a09,0xb3));var _0x98a0=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x8a09[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x98a0('0x0'));var util=require(_0x98a0('0x1'));var logger=require(_0x98a0('0x2'))(_0x98a0('0x3'));var moment=require('moment');var BPromise=require(_0x98a0('0x4'));var rp=require(_0x98a0('0x5'));var fs=require('fs');var path=require(_0x98a0('0x6'));var rimraf=require(_0x98a0('0x7'));var config=require(_0x98a0('0x8'));var attributes=require(_0x98a0('0x9'));module['exports']=function(_0x2c01b3,_0x433c69){return _0x2c01b3[_0x98a0('0xa')](_0x98a0('0xb'),attributes,{'tableName':_0x98a0('0xc'),'paranoid':![],'indexes':[{'name':_0x98a0('0xd'),'fields':['idField',_0x98a0('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2233=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','SalesforceField','salesforce_unique_index','FieldId','lodash','../../config/logger'];(function(_0x8ec72f,_0x4414b6){var _0xb449e6=function(_0x53545f){while(--_0x53545f){_0x8ec72f['push'](_0x8ec72f['shift']());}};_0xb449e6(++_0x4414b6);}(_0x2233,0x191));var _0x3223=function(_0x5a01f5,_0x21803a){_0x5a01f5=_0x5a01f5-0x0;var _0x5ecf7c=_0x2233[_0x5a01f5];return _0x5ecf7c;};'use strict';var _=require(_0x3223('0x0'));var util=require('util');var logger=require(_0x3223('0x1'))(_0x3223('0x2'));var moment=require(_0x3223('0x3'));var BPromise=require(_0x3223('0x4'));var rp=require(_0x3223('0x5'));var fs=require('fs');var path=require(_0x3223('0x6'));var rimraf=require(_0x3223('0x7'));var config=require(_0x3223('0x8'));var attributes=require(_0x3223('0x9'));module['exports']=function(_0x5abcc0,_0x24da36){return _0x5abcc0['define'](_0x3223('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x3223('0xb'),'fields':['idField',_0x3223('0xc')],'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 1f87f0d..5dac82c 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 _0xbb51=['http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x1dcdf3,_0x5e435c){var _0x172849=function(_0x2e85e8){while(--_0x2e85e8){_0x1dcdf3['push'](_0x1dcdf3['shift']());}};_0x172849(++_0x5e435c);}(_0xbb51,0x1bc));var _0x1bb5=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xbb51[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x1bb5('0x0'));var util=require(_0x1bb5('0x1'));var moment=require(_0x1bb5('0x2'));var BPromise=require(_0x1bb5('0x3'));var rs=require(_0x1bb5('0x4'));var fs=require('fs');var Redis=require(_0x1bb5('0x5'));var db=require(_0x1bb5('0x6'))['db'];var utils=require(_0x1bb5('0x7'));var logger=require(_0x1bb5('0x8'))(_0x1bb5('0x9'));var config=require('../../config/environment');var jayson=require(_0x1bb5('0xa'));var client=jayson[_0x1bb5('0xb')][_0x1bb5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ec334,_0x24670d,_0x31d36d){return new BPromise(function(_0x6d434d,_0x207210){return client[_0x1bb5('0xd')](_0x2ec334,_0x31d36d)[_0x1bb5('0xe')](function(_0x9c60f8){logger[_0x1bb5('0xf')](_0x1bb5('0x10'),_0x24670d,_0x1bb5('0x11'));logger[_0x1bb5('0x12')](_0x1bb5('0x13'),_0x24670d,_0x1bb5('0x11'),JSON['stringify'](_0x9c60f8));if(_0x9c60f8[_0x1bb5('0x14')]){if(_0x9c60f8[_0x1bb5('0x14')][_0x1bb5('0x15')]===0x1f4){logger[_0x1bb5('0x14')](_0x1bb5('0x10'),_0x24670d,_0x9c60f8['error'][_0x1bb5('0x16')]);return _0x207210(_0x9c60f8[_0x1bb5('0x14')][_0x1bb5('0x16')]);}logger[_0x1bb5('0x14')](_0x1bb5('0x10'),_0x24670d,_0x9c60f8[_0x1bb5('0x14')]['message']);return _0x6d434d(_0x9c60f8['error'][_0x1bb5('0x16')]);}else{logger['info'](_0x1bb5('0x10'),_0x24670d,_0x1bb5('0x11'));_0x6d434d(_0x9c60f8['result'][_0x1bb5('0x16')]);}})[_0x1bb5('0x17')](function(_0x4b9192){logger[_0x1bb5('0x14')]('SalesforceField,\x20%s,\x20%s',_0x24670d,_0x4b9192);_0x207210(_0x4b9192);});});} \ No newline at end of file +var _0x5a3e=['info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','SalesforceField,\x20%s,\x20%s','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0x54bf55,_0x11ed8c){var _0x151675=function(_0x8dcaf6){while(--_0x8dcaf6){_0x54bf55['push'](_0x54bf55['shift']());}};_0x151675(++_0x11ed8c);}(_0x5a3e,0x121));var _0xe5a3=function(_0x1d020d,_0x304dbd){_0x1d020d=_0x1d020d-0x0;var _0x20cf0e=_0x5a3e[_0x1d020d];return _0x20cf0e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe5a3('0x0'));var rs=require(_0xe5a3('0x1'));var fs=require('fs');var Redis=require(_0xe5a3('0x2'));var db=require(_0xe5a3('0x3'))['db'];var utils=require(_0xe5a3('0x4'));var logger=require(_0xe5a3('0x5'))(_0xe5a3('0x6'));var config=require(_0xe5a3('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe5a3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38732f,_0xcfb746,_0x5abae6){return new BPromise(function(_0x5b2972,_0x401e93){return client[_0xe5a3('0x9')](_0x38732f,_0x5abae6)[_0xe5a3('0xa')](function(_0x3cc2bd){logger[_0xe5a3('0xb')]('SalesforceField,\x20%s,\x20%s',_0xcfb746,_0xe5a3('0xc'));logger[_0xe5a3('0xd')](_0xe5a3('0xe'),_0xcfb746,'request\x20sent',JSON['stringify'](_0x3cc2bd));if(_0x3cc2bd[_0xe5a3('0xf')]){if(_0x3cc2bd[_0xe5a3('0xf')][_0xe5a3('0x10')]===0x1f4){logger['error'](_0xe5a3('0x11'),_0xcfb746,_0x3cc2bd['error'][_0xe5a3('0x12')]);return _0x401e93(_0x3cc2bd[_0xe5a3('0xf')][_0xe5a3('0x12')]);}logger['error'](_0xe5a3('0x11'),_0xcfb746,_0x3cc2bd['error'][_0xe5a3('0x12')]);return _0x5b2972(_0x3cc2bd['error'][_0xe5a3('0x12')]);}else{logger[_0xe5a3('0xb')]('SalesforceField,\x20%s,\x20%s',_0xcfb746,_0xe5a3('0xc'));_0x5b2972(_0x3cc2bd[_0xe5a3('0x13')][_0xe5a3('0x12')]);}})['catch'](function(_0x4ed0f2){logger['error']('SalesforceField,\x20%s,\x20%s',_0xcfb746,_0x4ed0f2);_0x401e93(_0x4ed0f2);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 9a51639..eabbac8 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 _0x03f5=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intServicenowAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','destroy','exports','multer','util'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x03f5,0x6c));var _0x503f=function(_0x253f59,_0x1aacab){_0x253f59=_0x253f59-0x0;var _0x83d494=_0x03f5[_0x253f59];return _0x83d494;};'use strict';var multer=require(_0x503f('0x0'));var util=require(_0x503f('0x1'));var path=require(_0x503f('0x2'));var timeout=require(_0x503f('0x3'));var express=require(_0x503f('0x4'));var router=express[_0x503f('0x5')]();var fs_extra=require(_0x503f('0x6'));var auth=require(_0x503f('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x503f('0x8'));router[_0x503f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x503f('0x9')](_0x503f('0xa'),auth[_0x503f('0xb')](),controller[_0x503f('0xc')]);router[_0x503f('0x9')](_0x503f('0xd'),auth[_0x503f('0xb')](),controller[_0x503f('0xe')]);router[_0x503f('0x9')](_0x503f('0xf'),auth[_0x503f('0xb')](),controller['getFields']);router[_0x503f('0x10')]('/',auth['isAuthenticated'](),controller[_0x503f('0x11')]);router[_0x503f('0x10')](_0x503f('0xd'),auth[_0x503f('0xb')](),controller['addConfiguration']);router[_0x503f('0x12')](_0x503f('0xa'),auth['isAuthenticated'](),controller[_0x503f('0x13')]);router['delete'](_0x503f('0xa'),auth[_0x503f('0xb')](),controller[_0x503f('0x14')]);module[_0x503f('0x15')]=router; \ No newline at end of file +var _0x0bff=['getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x0bff,0x1ce));var _0xf0bf=function(_0x170745,_0x397afc){_0x170745=_0x170745-0x0;var _0x70b1db=_0x0bff[_0x170745];return _0x70b1db;};'use strict';var multer=require(_0xf0bf('0x0'));var util=require('util');var path=require(_0xf0bf('0x1'));var timeout=require('connect-timeout');var express=require(_0xf0bf('0x2'));var router=express['Router']();var fs_extra=require(_0xf0bf('0x3'));var auth=require(_0xf0bf('0x4'));var interaction=require(_0xf0bf('0x5'));var config=require(_0xf0bf('0x6'));var controller=require(_0xf0bf('0x7'));router[_0xf0bf('0x8')]('/',auth[_0xf0bf('0x9')](),controller[_0xf0bf('0xa')]);router[_0xf0bf('0x8')]('/:id',auth[_0xf0bf('0x9')](),controller[_0xf0bf('0xb')]);router[_0xf0bf('0x8')](_0xf0bf('0xc'),auth[_0xf0bf('0x9')](),controller[_0xf0bf('0xd')]);router[_0xf0bf('0x8')](_0xf0bf('0xe'),auth['isAuthenticated'](),controller[_0xf0bf('0xf')]);router[_0xf0bf('0x10')]('/',auth['isAuthenticated'](),controller[_0xf0bf('0x11')]);router[_0xf0bf('0x10')](_0xf0bf('0xc'),auth['isAuthenticated'](),controller[_0xf0bf('0x12')]);router[_0xf0bf('0x13')](_0xf0bf('0x14'),auth['isAuthenticated'](),controller[_0xf0bf('0x15')]);router[_0xf0bf('0x16')](_0xf0bf('0x14'),auth[_0xf0bf('0x9')](),controller[_0xf0bf('0x17')]);module[_0xf0bf('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 50be2f4..c60c38b 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 _0x87ff=['username','remoteUri','exports','STRING'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x87ff,0x1ae));var _0xf87f=function(_0x18cad7,_0x4de03e){_0x18cad7=_0x18cad7-0x0;var _0x5a5920=_0x87ff[_0x18cad7];return _0x5a5920;};'use strict';var Sequelize=require('sequelize');module[_0xf87f('0x0')]={'name':{'type':Sequelize[_0xf87f('0x1')]},'description':{'type':Sequelize[_0xf87f('0x1')]},'username':{'type':Sequelize[_0xf87f('0x1')],'unique':_0xf87f('0x2')},'password':{'type':Sequelize[_0xf87f('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf87f('0x1')],'unique':_0xf87f('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xe2b2=['remoteUri','sequelize','exports','STRING','username'];(function(_0xd99b6e,_0x218653){var _0x566f73=function(_0x3e00ea){while(--_0x3e00ea){_0xd99b6e['push'](_0xd99b6e['shift']());}};_0x566f73(++_0x218653);}(_0xe2b2,0x15f));var _0x2e2b=function(_0x253910,_0x501628){_0x253910=_0x253910-0x0;var _0x5c6222=_0xe2b2[_0x253910];return _0x5c6222;};'use strict';var Sequelize=require(_0x2e2b('0x0'));module[_0x2e2b('0x1')]={'name':{'type':Sequelize[_0x2e2b('0x2')]},'description':{'type':Sequelize[_0x2e2b('0x2')]},'username':{'type':Sequelize[_0x2e2b('0x2')],'unique':_0x2e2b('0x3')},'password':{'type':Sequelize[_0x2e2b('0x2')]},'email':{'type':Sequelize[_0x2e2b('0x2')]},'remoteUri':{'type':Sequelize[_0x2e2b('0x2')],'unique':_0x2e2b('0x4')},'serverUrl':{'type':Sequelize[_0x2e2b('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 2d14876..694ff36 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 _0x7e77=['state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','password','email','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','send','Wrong\x20credentials','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ServicenowAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','getConfigurations','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain'];(function(_0x456bed,_0x53a16b){var _0x54f5ac=function(_0x311e36){while(--_0x311e36){_0x456bed['push'](_0x456bed['shift']());}};_0x54f5ac(++_0x53a16b);}(_0x7e77,0x121));var _0x77e7=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x7e77[_0x1deb03];return _0x189fe7;};'use strict';var emlformat=require(_0x77e7('0x0'));var rimraf=require(_0x77e7('0x1'));var zipdir=require(_0x77e7('0x2'));var jsonpatch=require(_0x77e7('0x3'));var rp=require(_0x77e7('0x4'));var moment=require('moment');var BPromise=require(_0x77e7('0x5'));var Mustache=require(_0x77e7('0x6'));var util=require(_0x77e7('0x7'));var path=require(_0x77e7('0x8'));var sox=require(_0x77e7('0x9'));var csv=require('to-csv');var ejs=require(_0x77e7('0xa'));var fs=require('fs');var fs_extra=require(_0x77e7('0xb'));var _=require(_0x77e7('0xc'));var squel=require(_0x77e7('0xd'));var crypto=require('crypto');var jsforce=require(_0x77e7('0xe'));var deskjs=require(_0x77e7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x77e7('0x10'));var Papa=require(_0x77e7('0x11'));var Redis=require(_0x77e7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x77e7('0x13'));var hardwareService=require(_0x77e7('0x14'));var logger=require(_0x77e7('0x15'))(_0x77e7('0x16'));var utils=require(_0x77e7('0x17'));var config=require(_0x77e7('0x18'));var licenseUtil=require(_0x77e7('0x19'));var db=require(_0x77e7('0x1a'))['db'];var integrations=require(_0x77e7('0x1b'));function respondWithStatusCode(_0x5031b7,_0x393f66){_0x393f66=_0x393f66||0xcc;return function(_0x43653e){if(_0x43653e){return _0x5031b7[_0x77e7('0x1c')](_0x393f66);}return _0x5031b7[_0x77e7('0x1d')](_0x393f66)[_0x77e7('0x1e')]();};}function respondWithResult(_0x3cb8fe,_0x5f5734){_0x5f5734=_0x5f5734||0xc8;return function(_0xc99f14){if(_0xc99f14){return _0x3cb8fe[_0x77e7('0x1d')](_0x5f5734)[_0x77e7('0x1f')](_0xc99f14);}};}function respondWithFilteredResult(_0x3826c6,_0x16d6f1){return function(_0xa6d7d4){if(_0xa6d7d4){var _0x14ea7d=typeof _0x16d6f1[_0x77e7('0x20')]==='undefined'&&typeof _0x16d6f1[_0x77e7('0x21')]===_0x77e7('0x22');var _0x2bcadd=_0xa6d7d4[_0x77e7('0x23')];var _0x35364f=_0x14ea7d?0x0:_0x16d6f1['offset'];var _0xbfb6f1=_0x14ea7d?_0xa6d7d4[_0x77e7('0x23')]:_0x16d6f1[_0x77e7('0x20')]+_0x16d6f1[_0x77e7('0x21')];var _0xe1bfdf;if(_0xbfb6f1>=_0x2bcadd){_0xbfb6f1=_0x2bcadd;_0xe1bfdf=0xc8;}else{_0xe1bfdf=0xce;}_0x3826c6[_0x77e7('0x1d')](_0xe1bfdf);return _0x3826c6[_0x77e7('0x24')](_0x77e7('0x25'),_0x35364f+'-'+_0xbfb6f1+'/'+_0x2bcadd)[_0x77e7('0x1f')](_0xa6d7d4);}return null;};}function patchUpdates(_0x2c6126){return function(_0x58ff5a){try{jsonpatch['apply'](_0x58ff5a,_0x2c6126,!![]);}catch(_0x4a519b){return BPromise['reject'](_0x4a519b);}return _0x58ff5a[_0x77e7('0x26')]();};}function saveUpdates(_0x27322f,_0x5370ae){return function(_0x52cac4){if(_0x52cac4){return _0x52cac4[_0x77e7('0x27')](_0x27322f)[_0x77e7('0x28')](function(_0x498d07){return _0x498d07;});}return null;};}function removeEntity(_0x1fa9f9,_0x47aca9){return function(_0x3c4cc1){if(_0x3c4cc1){return _0x3c4cc1[_0x77e7('0x29')]()[_0x77e7('0x28')](function(){_0x1fa9f9['status'](0xcc)[_0x77e7('0x1e')]();});}};}function handleEntityNotFound(_0x4e35cc,_0x1652be){return function(_0x3f5cf3){if(!_0x3f5cf3){_0x4e35cc['sendStatus'](0x194);}return _0x3f5cf3;};}function handleError(_0x2ce36e,_0x56601d){_0x56601d=_0x56601d||0x1f4;return function(_0x4814df){logger[_0x77e7('0x2a')](_0x4814df[_0x77e7('0x2b')]);if(_0x4814df[_0x77e7('0x2c')]){delete _0x4814df[_0x77e7('0x2c')];}_0x2ce36e['status'](_0x56601d)['send'](_0x4814df);};}exports[_0x77e7('0x2d')]=function(_0x501434,_0x139b7a){var _0x5b75d3={},_0x5313a8={},_0x31d5e7={'count':0x0,'rows':[]};var _0x476c91=_[_0x77e7('0x2e')](db['ServicenowAccount'][_0x77e7('0x2f')],function(_0x4d2460){return{'name':_0x4d2460[_0x77e7('0x30')],'type':_0x4d2460[_0x77e7('0x31')][_0x77e7('0x32')]};});_0x5313a8['model']=_['map'](_0x476c91,_0x77e7('0x2c'));_0x5313a8[_0x77e7('0x33')]=_[_0x77e7('0x34')](_0x501434[_0x77e7('0x33')]);_0x5313a8[_0x77e7('0x35')]=_[_0x77e7('0x36')](_0x5313a8[_0x77e7('0x37')],_0x5313a8['query']);_0x5b75d3['attributes']=_[_0x77e7('0x36')](_0x5313a8[_0x77e7('0x37')],qs['fields'](_0x501434[_0x77e7('0x33')][_0x77e7('0x38')]));_0x5b75d3[_0x77e7('0x39')]=_0x5b75d3[_0x77e7('0x39')][_0x77e7('0x3a')]?_0x5b75d3[_0x77e7('0x39')]:_0x5313a8['model'];if(!_0x501434[_0x77e7('0x33')][_0x77e7('0x3b')](_0x77e7('0x3c'))){_0x5b75d3[_0x77e7('0x21')]=qs[_0x77e7('0x21')](_0x501434['query']['limit']);_0x5b75d3['offset']=qs[_0x77e7('0x20')](_0x501434['query']['offset']);}_0x5b75d3[_0x77e7('0x3d')]=qs['sort'](_0x501434[_0x77e7('0x33')][_0x77e7('0x3e')]);_0x5b75d3[_0x77e7('0x3f')]=qs['filters'](_[_0x77e7('0x40')](_0x501434[_0x77e7('0x33')],_0x5313a8[_0x77e7('0x35')]),_0x476c91);if(_0x501434[_0x77e7('0x33')][_0x77e7('0x41')]){_0x5b75d3['where']=_[_0x77e7('0x42')](_0x5b75d3[_0x77e7('0x3f')],{'$or':_[_0x77e7('0x2e')](_0x476c91,function(_0x33e043){if(_0x33e043[_0x77e7('0x31')]!=='VIRTUAL'){var _0x36f5ce={};_0x36f5ce[_0x33e043[_0x77e7('0x2c')]]={'$like':'%'+_0x501434['query'][_0x77e7('0x41')]+'%'};return _0x36f5ce;}})});}_0x5b75d3=_[_0x77e7('0x42')]({},_0x5b75d3,_0x501434[_0x77e7('0x43')]);var _0x29c0c4={'where':_0x5b75d3[_0x77e7('0x3f')]};return db[_0x77e7('0x44')][_0x77e7('0x23')](_0x29c0c4)[_0x77e7('0x28')](function(_0x3b6b22){_0x31d5e7['count']=_0x3b6b22;if(_0x501434[_0x77e7('0x33')][_0x77e7('0x45')]){_0x5b75d3[_0x77e7('0x46')]=[{'all':!![]}];}return db[_0x77e7('0x44')][_0x77e7('0x47')](_0x5b75d3);})[_0x77e7('0x28')](function(_0x1e8985){_0x31d5e7[_0x77e7('0x48')]=_0x1e8985;return _0x31d5e7;})[_0x77e7('0x28')](respondWithFilteredResult(_0x139b7a,_0x5b75d3))[_0x77e7('0x49')](handleError(_0x139b7a,null));};exports[_0x77e7('0x4a')]=function(_0x58c2cf,_0x4f259c){var _0x2921ff={'raw':![],'where':{'id':_0x58c2cf[_0x77e7('0x4b')]['id']}},_0x25439e={};_0x25439e[_0x77e7('0x37')]=_[_0x77e7('0x34')](db['ServicenowAccount'][_0x77e7('0x2f')]);_0x25439e[_0x77e7('0x33')]=_[_0x77e7('0x34')](_0x58c2cf[_0x77e7('0x33')]);_0x25439e['filters']=_['intersection'](_0x25439e['model'],_0x25439e['query']);_0x2921ff['attributes']=_['intersection'](_0x25439e['model'],qs[_0x77e7('0x38')](_0x58c2cf[_0x77e7('0x33')]['fields']));_0x2921ff[_0x77e7('0x39')]=_0x2921ff[_0x77e7('0x39')][_0x77e7('0x3a')]?_0x2921ff['attributes']:_0x25439e[_0x77e7('0x37')];if(_0x58c2cf['query'][_0x77e7('0x45')]){_0x2921ff[_0x77e7('0x46')]=[{'all':!![]}];}_0x2921ff=_['merge']({},_0x2921ff,_0x58c2cf['options']);return db[_0x77e7('0x44')][_0x77e7('0x4c')](_0x2921ff)[_0x77e7('0x28')](handleEntityNotFound(_0x4f259c,null))['then'](respondWithResult(_0x4f259c,null))[_0x77e7('0x49')](handleError(_0x4f259c,null));};exports[_0x77e7('0x4d')]=function(_0x51b7f0,_0x3aea63){return db[_0x77e7('0x44')]['create'](_0x51b7f0['body'],{})[_0x77e7('0x28')](respondWithResult(_0x3aea63,0xc9))['catch'](handleError(_0x3aea63,null));};exports['update']=function(_0x506a66,_0x328e97){if(_0x506a66[_0x77e7('0x4e')]['id']){delete _0x506a66[_0x77e7('0x4e')]['id'];}return db[_0x77e7('0x44')][_0x77e7('0x4c')]({'where':{'id':_0x506a66[_0x77e7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x328e97,null))[_0x77e7('0x28')](saveUpdates(_0x506a66[_0x77e7('0x4e')],null))[_0x77e7('0x28')](respondWithResult(_0x328e97,null))['catch'](handleError(_0x328e97,null));};exports[_0x77e7('0x29')]=function(_0x124996,_0x15a639){return db[_0x77e7('0x44')]['find']({'where':{'id':_0x124996[_0x77e7('0x4b')]['id']}})[_0x77e7('0x28')](handleEntityNotFound(_0x15a639,null))[_0x77e7('0x28')](removeEntity(_0x15a639,null))[_0x77e7('0x49')](handleError(_0x15a639,null));};exports['getConfigurations']=function(_0xb8754e,_0x47d7be,_0x334441){var _0xeca843={};var _0x5d051c={};var _0x49c700;var _0x133521;return db[_0x77e7('0x44')][_0x77e7('0x4f')]({'where':{'id':_0xb8754e[_0x77e7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x47d7be,null))[_0x77e7('0x28')](function(_0x32b8f0){if(_0x32b8f0){_0x49c700=_0x32b8f0;_0x5d051c[_0x77e7('0x37')]=_['keys'](db['ServicenowConfiguration'][_0x77e7('0x2f')]);_0x5d051c[_0x77e7('0x33')]=_['keys'](_0xb8754e[_0x77e7('0x33')]);_0x5d051c[_0x77e7('0x35')]=_[_0x77e7('0x36')](_0x5d051c[_0x77e7('0x37')],_0x5d051c[_0x77e7('0x33')]);_0xeca843[_0x77e7('0x39')]=_[_0x77e7('0x36')](_0x5d051c[_0x77e7('0x37')],qs['fields'](_0xb8754e[_0x77e7('0x33')][_0x77e7('0x38')]));_0xeca843['attributes']=_0xeca843['attributes'][_0x77e7('0x3a')]?_0xeca843[_0x77e7('0x39')]:_0x5d051c[_0x77e7('0x37')];_0xeca843[_0x77e7('0x3d')]=qs['sort'](_0xb8754e['query'][_0x77e7('0x3e')]);_0xeca843[_0x77e7('0x3f')]=qs['filters'](_['pick'](_0xb8754e[_0x77e7('0x33')],_0x5d051c['filters']));if(_0xb8754e[_0x77e7('0x33')]['filter']){_0xeca843['where']=_[_0x77e7('0x42')](_0xeca843[_0x77e7('0x3f')],{'$or':_[_0x77e7('0x2e')](_0xeca843[_0x77e7('0x39')],function(_0x15ad62){var _0x2d827f={};_0x2d827f[_0x15ad62]={'$like':'%'+_0xb8754e['query'][_0x77e7('0x41')]+'%'};return _0x2d827f;})});}_0xeca843=_[_0x77e7('0x42')]({},_0xeca843,_0xb8754e[_0x77e7('0x43')]);return _0x49c700[_0x77e7('0x50')](_0xeca843);}})['then'](function(_0x30c6a7){if(_0x30c6a7){_0x133521=_0x30c6a7[_0x77e7('0x3a')];if(!_0xb8754e['query'][_0x77e7('0x3b')](_0x77e7('0x3c'))){_0xeca843[_0x77e7('0x21')]=qs['limit'](_0xb8754e[_0x77e7('0x33')][_0x77e7('0x21')]);_0xeca843[_0x77e7('0x20')]=qs[_0x77e7('0x20')](_0xb8754e['query'][_0x77e7('0x20')]);}return _0x49c700[_0x77e7('0x50')](_0xeca843);}})[_0x77e7('0x28')](function(_0x332cd9){if(_0x332cd9){return _0x332cd9?{'count':_0x133521,'rows':_0x332cd9}:null;}})[_0x77e7('0x28')](respondWithResult(_0x47d7be,null))[_0x77e7('0x49')](handleError(_0x47d7be,null));};exports[_0x77e7('0x51')]=function(_0x4c5da1,_0x4b1abe,_0x843a6d){if(_0x4c5da1[_0x77e7('0x4e')]['id']){delete _0x4c5da1['body']['id'];}return db[_0x77e7('0x44')][_0x77e7('0x4f')]({'where':{'id':_0x4c5da1[_0x77e7('0x4b')]['id']}})[_0x77e7('0x28')](handleEntityNotFound(_0x4b1abe,null))[_0x77e7('0x28')](function(_0x2d1082){if(_0x2d1082){_0x4c5da1[_0x77e7('0x4e')]['AccountId']=_0x2d1082['id'];_0x4c5da1['body'][_0x77e7('0x52')]=integrations[_0x77e7('0x53')](_0x4c5da1[_0x77e7('0x4e')][_0x77e7('0x54')],_0x4c5da1['body'][_0x77e7('0x31')]);_0x4c5da1['body']['Descriptions']=integrations[_0x77e7('0x55')](_0x4c5da1[_0x77e7('0x4e')]['channel'],_0x4c5da1[_0x77e7('0x4e')]['type']);return db['ServicenowConfiguration'][_0x77e7('0x4d')](_0x4c5da1[_0x77e7('0x4e')],{'include':[{'model':db[_0x77e7('0x56')],'as':'Subjects'},{'model':db[_0x77e7('0x56')],'as':_0x77e7('0x57')}]});}return null;})[_0x77e7('0x28')](respondWithResult(_0x4b1abe,null))[_0x77e7('0x49')](handleError(_0x4b1abe,null));};exports[_0x77e7('0x58')]=function(_0x321f86,_0x4ce110,_0x279370){var _0x2a485e=[_0x77e7('0x59'),_0x77e7('0x5a'),_0x77e7('0x5b'),_0x77e7('0x5c'),_0x77e7('0x5d'),_0x77e7('0x5e'),_0x77e7('0x5f'),_0x77e7('0x60'),_0x77e7('0x61')];var _0x26c331=[_0x77e7('0x62'),_0x77e7('0x59'),_0x77e7('0x63'),_0x77e7('0x64'),_0x77e7('0x65'),'sys_updated_on',_0x77e7('0x66'),_0x77e7('0x5a'),_0x77e7('0x67'),_0x77e7('0x68'),_0x77e7('0x69'),_0x77e7('0x6a'),_0x77e7('0x6b'),_0x77e7('0x6c'),_0x77e7('0x6d'),_0x77e7('0x6e'),_0x77e7('0x6f'),_0x77e7('0x70'),_0x77e7('0x5b'),_0x77e7('0x3d'),_0x77e7('0x71'),_0x77e7('0x72'),_0x77e7('0x73'),'delivery_plan',_0x77e7('0x74'),_0x77e7('0x75'),_0x77e7('0x76'),'business_service',_0x77e7('0x77'),_0x77e7('0x78'),_0x77e7('0x79'),_0x77e7('0x7a'),_0x77e7('0x7b'),_0x77e7('0x7c'),'business_duration','group_list',_0x77e7('0x7d'),_0x77e7('0x7e'),_0x77e7('0x7f'),_0x77e7('0x80'),_0x77e7('0x81'),'subcategory',_0x77e7('0x82'),_0x77e7('0x83'),'close_code',_0x77e7('0x84'),_0x77e7('0x85'),'work_start',_0x77e7('0x86'),_0x77e7('0x87'),_0x77e7('0x88'),_0x77e7('0x89'),_0x77e7('0x8a'),_0x77e7('0x5e'),_0x77e7('0x8b'),_0x77e7('0x8c'),_0x77e7('0x8d'),_0x77e7('0x8e'),'parent_incident',_0x77e7('0x8f'),_0x77e7('0x90'),_0x77e7('0x91'),_0x77e7('0x5f'),_0x77e7('0x92'),_0x77e7('0x93'),_0x77e7('0x94'),_0x77e7('0x95'),_0x77e7('0x96'),_0x77e7('0x97'),_0x77e7('0x60'),_0x77e7('0x98'),_0x77e7('0x99'),_0x77e7('0x9a'),_0x77e7('0x9b'),_0x77e7('0x9c'),_0x77e7('0x9d'),_0x77e7('0x9e'),_0x77e7('0x9f'),_0x77e7('0xa0'),_0x77e7('0xa1'),_0x77e7('0xa2'),_0x77e7('0xa3'),_0x77e7('0x61')];var _0x248f02='';var _0x57f4be='';var _0xb2840f=[];var _0xe222b3='';var _0x956def='';var _0x53519f=[];var _0x21a250='';var _0x429b37='';var _0x252878={};var _0x13d843='';return db[_0x77e7('0x44')][_0x77e7('0x4f')]({'where':{'id':_0x321f86[_0x77e7('0x4b')]['id']},'attributes':['id','username',_0x77e7('0xa4'),_0x77e7('0xa5'),'remoteUri','serverUrl']})['then'](handleEntityNotFound(_0x4ce110,null))['then'](function(_0xb7bf7){if(_0xb7bf7){_0x13d843=_0xb7bf7['remoteUri'];var _0x5f2afb=_0x13d843[_0x77e7('0xa6')](-0x1);if(_0x5f2afb==='/'){_0x13d843=_0x13d843[_0x77e7('0xa7')](0x0,_0x13d843[_0x77e7('0xa8')](_0x5f2afb));}_0x429b37=util['format']('%s/api/now/doc/table/schema/',_0x13d843);_0x21a250=util[_0x77e7('0xa9')](_0x77e7('0xaa'),_0x13d843);_0x252878={'user':_0xb7bf7['username'],'pass':_0xb7bf7[_0x77e7('0xa4')]};var _0x299e0d={'method':_0x77e7('0xab'),'uri':_0x429b37+_0x77e7('0xac'),'auth':_0x252878,'json':!![]};return rp(_0x299e0d);}})[_0x77e7('0x28')](function(_0x1573e8){if(_0x1573e8[_0x77e7('0xad')][_0x77e7('0x3a')]>0x0){_0x248f02=_0x1573e8[_0x77e7('0xad')];}console[_0x77e7('0xae')](_0x77e7('0xaf'),_0x248f02);_0x53519f=[];_0x57f4be=Object[_0x77e7('0xb0')]([],_0x248f02);_[_0x77e7('0xb1')](_0x57f4be,function(_0x36552b){return!_0x2a485e[_0x77e7('0xb2')](_0x36552b[_0x77e7('0x2c')]);});_0x57f4be[_0x77e7('0xb3')](function(_0x221408){var _0x5d964d=createFieldObject(_0x21a250,_0x252878,_0x221408[_0x77e7('0xb4')],_0x221408[_0x77e7('0x2c')],_0x221408[_0x77e7('0xb5')],![]);_0x53519f[_0x77e7('0xb6')](_0x5d964d);});return Promise[_0x77e7('0xb7')](_0x53519f);})[_0x77e7('0x28')](function(_0x2db271){_0xb2840f=_0x2db271;_0xe222b3=Object[_0x77e7('0xb0')]([],_0x248f02);console['log'](_0x77e7('0xb8'),_0x248f02);_['remove'](_0xe222b3,function(_0x10b7ad){return _0x26c331[_0x77e7('0xb2')](_0x10b7ad[_0x77e7('0x2c')]);});console[_0x77e7('0xae')](_0x77e7('0xb9'),_0xe222b3);_0x53519f=[];_0xe222b3[_0x77e7('0xb3')](function(_0x3a815f){var _0x35b311=createFieldObject(_0x21a250,_0x252878,_0x3a815f[_0x77e7('0xb4')],_0x3a815f[_0x77e7('0x2c')],_0x3a815f['label'],!![]);_0x53519f['push'](_0x35b311);});return Promise[_0x77e7('0xb7')](_0x53519f);})[_0x77e7('0x28')](function(_0x526111){_0x956def=_0x526111;var _0xe71f12=_0xb2840f[_0x77e7('0xba')](_0x956def);return{'count':_0xe71f12[_0x77e7('0x3a')],'rows':_0xe71f12};})[_0x77e7('0x28')](respondWithResult(_0x4ce110,null))[_0x77e7('0x49')](function(_0x5aba8e){console['log'](_0x77e7('0xbb')+_0x5aba8e);var _0x11842e=_0x321f86[_0x77e7('0x33')][_0x77e7('0xbc')]?0x1f4:_0x5aba8e[_0x77e7('0xbd')]||0x1f4;logger[_0x77e7('0x2a')](_0x5aba8e[_0x77e7('0x2b')]);delete _0x5aba8e['name'];if(_0x11842e===0x191){_0x11842e=0x190;}_0x4ce110[_0x77e7('0x1d')](_0x11842e)[_0x77e7('0xbe')](_0x321f86[_0x77e7('0x33')][_0x77e7('0xbc')]?{'message':_0x77e7('0xbf'),'statusCode':_0x5aba8e[_0x77e7('0xbd')]}:_0x5aba8e);});};function createFieldObject(_0x1a7cd2,_0x2aa9f8,_0x1e24db,_0x2cf588,_0x25c1b6,_0x3ec1bc){return new Promise(function(_0x48062e,_0x4d07c4){var _0x51ef71={'id':_0x2cf588,'name':_0x25c1b6,'custom':_0x3ec1bc};if(_0x1e24db===_0x77e7('0xc0')){_0x51ef71[_0x77e7('0x43')]=[{'name':_0x77e7('0xc1'),'value':_0x77e7('0xc2')},{'name':_0x77e7('0xc3'),'value':'false'}];_0x48062e(_0x51ef71);}else{var _0x30b4de={'method':'GET','uri':_0x1a7cd2+_0x77e7('0xc4')+_0x2cf588,'auth':_0x2aa9f8,'json':!![]};return rp(_0x30b4de)[_0x77e7('0x28')](function(_0x11f600){var _0x1563cd=[];if(_0x11f600[_0x77e7('0xad')][_0x77e7('0x3a')]>0x0){_0x11f600[_0x77e7('0xad')][_0x77e7('0xb3')](function(_0x28e878){if(_0x28e878[_0x77e7('0xc5')]===_0x77e7('0xc6')){var _0x466502={'name':_0x28e878['label'],'value':_0x28e878[_0x77e7('0xc7')]};_0x1563cd[_0x77e7('0xb6')](_0x466502);}});}_0x51ef71[_0x77e7('0x43')]=_0x1563cd;if(_0x51ef71[_0x77e7('0x43')][_0x77e7('0x3a')]>0x0){_0x48062e(_0x51ef71);}else{if(_0x3ec1bc==![]){_0x48062e();}else{_0x48062e(_0x51ef71);}}});}});} \ No newline at end of file +var _0x48cf=['remove','includes','forEach','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','options','True','true','False','false','GET','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ServicenowAccount','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','includeAll','include','rows','catch','params','find','create','body','getConfigurations','ServicenowConfiguration','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','rfc','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','problem_id','company','reassignment_count','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','location','category','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign'];(function(_0x1c0f41,_0x26d95d){var _0x369a9f=function(_0x251234){while(--_0x251234){_0x1c0f41['push'](_0x1c0f41['shift']());}};_0x369a9f(++_0x26d95d);}(_0x48cf,0x18a));var _0xf48c=function(_0x29a134,_0x194c27){_0x29a134=_0x29a134-0x0;var _0x136398=_0x48cf[_0x29a134];return _0x136398;};'use strict';var emlformat=require(_0xf48c('0x0'));var rimraf=require(_0xf48c('0x1'));var zipdir=require(_0xf48c('0x2'));var jsonpatch=require(_0xf48c('0x3'));var rp=require(_0xf48c('0x4'));var moment=require(_0xf48c('0x5'));var BPromise=require(_0xf48c('0x6'));var Mustache=require('mustache');var util=require(_0xf48c('0x7'));var path=require(_0xf48c('0x8'));var sox=require(_0xf48c('0x9'));var csv=require(_0xf48c('0xa'));var ejs=require(_0xf48c('0xb'));var fs=require('fs');var fs_extra=require(_0xf48c('0xc'));var _=require(_0xf48c('0xd'));var squel=require(_0xf48c('0xe'));var crypto=require(_0xf48c('0xf'));var jsforce=require(_0xf48c('0x10'));var deskjs=require(_0xf48c('0x11'));var toCsv=require(_0xf48c('0xa'));var querystring=require(_0xf48c('0x12'));var Papa=require(_0xf48c('0x13'));var Redis=require(_0xf48c('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf48c('0x15'));var hardwareService=require(_0xf48c('0x16'));var logger=require(_0xf48c('0x17'))(_0xf48c('0x18'));var utils=require('../../config/utils');var config=require(_0xf48c('0x19'));var licenseUtil=require(_0xf48c('0x1a'));var db=require(_0xf48c('0x1b'))['db'];var integrations=require(_0xf48c('0x1c'));function respondWithStatusCode(_0x52406c,_0x102186){_0x102186=_0x102186||0xcc;return function(_0x37e498){if(_0x37e498){return _0x52406c[_0xf48c('0x1d')](_0x102186);}return _0x52406c[_0xf48c('0x1e')](_0x102186)[_0xf48c('0x1f')]();};}function respondWithResult(_0x2bde69,_0x361da3){_0x361da3=_0x361da3||0xc8;return function(_0x2fc15f){if(_0x2fc15f){return _0x2bde69['status'](_0x361da3)[_0xf48c('0x20')](_0x2fc15f);}};}function respondWithFilteredResult(_0x37621f,_0x4bac31){return function(_0x3f2dc6){if(_0x3f2dc6){var _0x5f1320=typeof _0x4bac31['offset']==='undefined'&&typeof _0x4bac31[_0xf48c('0x21')]==='undefined';var _0xa1f7f7=_0x3f2dc6[_0xf48c('0x22')];var _0x441e94=_0x5f1320?0x0:_0x4bac31[_0xf48c('0x23')];var _0x404139=_0x5f1320?_0x3f2dc6[_0xf48c('0x22')]:_0x4bac31[_0xf48c('0x23')]+_0x4bac31['limit'];var _0x2b6c39;if(_0x404139>=_0xa1f7f7){_0x404139=_0xa1f7f7;_0x2b6c39=0xc8;}else{_0x2b6c39=0xce;}_0x37621f['status'](_0x2b6c39);return _0x37621f[_0xf48c('0x24')](_0xf48c('0x25'),_0x441e94+'-'+_0x404139+'/'+_0xa1f7f7)[_0xf48c('0x20')](_0x3f2dc6);}return null;};}function patchUpdates(_0x3a424f){return function(_0x5958c0){try{jsonpatch[_0xf48c('0x26')](_0x5958c0,_0x3a424f,!![]);}catch(_0x59746f){return BPromise[_0xf48c('0x27')](_0x59746f);}return _0x5958c0[_0xf48c('0x28')]();};}function saveUpdates(_0x243973,_0x1926ee){return function(_0x24ba47){if(_0x24ba47){return _0x24ba47[_0xf48c('0x29')](_0x243973)[_0xf48c('0x2a')](function(_0x3afa61){return _0x3afa61;});}return null;};}function removeEntity(_0x26026f,_0xade411){return function(_0x146856){if(_0x146856){return _0x146856[_0xf48c('0x2b')]()[_0xf48c('0x2a')](function(){_0x26026f[_0xf48c('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15b849,_0x5a0775){return function(_0x5c5019){if(!_0x5c5019){_0x15b849[_0xf48c('0x1d')](0x194);}return _0x5c5019;};}function handleError(_0x44c5f2,_0x53f01b){_0x53f01b=_0x53f01b||0x1f4;return function(_0x5de261){logger[_0xf48c('0x2c')](_0x5de261[_0xf48c('0x2d')]);if(_0x5de261[_0xf48c('0x2e')]){delete _0x5de261[_0xf48c('0x2e')];}_0x44c5f2[_0xf48c('0x1e')](_0x53f01b)[_0xf48c('0x2f')](_0x5de261);};}exports[_0xf48c('0x30')]=function(_0x76955e,_0x227d3f){var _0x42b7af={},_0x210d61={},_0x1f18c8={'count':0x0,'rows':[]};var _0x537ab5=_['map'](db[_0xf48c('0x31')][_0xf48c('0x32')],function(_0x2cb687){return{'name':_0x2cb687['fieldName'],'type':_0x2cb687['type']['key']};});_0x210d61[_0xf48c('0x33')]=_['map'](_0x537ab5,'name');_0x210d61[_0xf48c('0x34')]=_[_0xf48c('0x35')](_0x76955e[_0xf48c('0x34')]);_0x210d61[_0xf48c('0x36')]=_['intersection'](_0x210d61['model'],_0x210d61[_0xf48c('0x34')]);_0x42b7af[_0xf48c('0x37')]=_[_0xf48c('0x38')](_0x210d61[_0xf48c('0x33')],qs[_0xf48c('0x39')](_0x76955e[_0xf48c('0x34')][_0xf48c('0x39')]));_0x42b7af[_0xf48c('0x37')]=_0x42b7af[_0xf48c('0x37')][_0xf48c('0x3a')]?_0x42b7af[_0xf48c('0x37')]:_0x210d61[_0xf48c('0x33')];if(!_0x76955e[_0xf48c('0x34')][_0xf48c('0x3b')](_0xf48c('0x3c'))){_0x42b7af[_0xf48c('0x21')]=qs[_0xf48c('0x21')](_0x76955e[_0xf48c('0x34')][_0xf48c('0x21')]);_0x42b7af[_0xf48c('0x23')]=qs[_0xf48c('0x23')](_0x76955e[_0xf48c('0x34')][_0xf48c('0x23')]);}_0x42b7af[_0xf48c('0x3d')]=qs['sort'](_0x76955e[_0xf48c('0x34')][_0xf48c('0x3e')]);_0x42b7af[_0xf48c('0x3f')]=qs[_0xf48c('0x36')](_['pick'](_0x76955e[_0xf48c('0x34')],_0x210d61['filters']),_0x537ab5);if(_0x76955e[_0xf48c('0x34')][_0xf48c('0x40')]){_0x42b7af['where']=_[_0xf48c('0x41')](_0x42b7af[_0xf48c('0x3f')],{'$or':_[_0xf48c('0x42')](_0x537ab5,function(_0x412dbd){if(_0x412dbd[_0xf48c('0x43')]!=='VIRTUAL'){var _0x513b29={};_0x513b29[_0x412dbd[_0xf48c('0x2e')]]={'$like':'%'+_0x76955e[_0xf48c('0x34')][_0xf48c('0x40')]+'%'};return _0x513b29;}})});}_0x42b7af=_[_0xf48c('0x41')]({},_0x42b7af,_0x76955e['options']);var _0x127263={'where':_0x42b7af['where']};return db[_0xf48c('0x31')][_0xf48c('0x22')](_0x127263)[_0xf48c('0x2a')](function(_0x4dd03f){_0x1f18c8[_0xf48c('0x22')]=_0x4dd03f;if(_0x76955e['query'][_0xf48c('0x44')]){_0x42b7af[_0xf48c('0x45')]=[{'all':!![]}];}return db[_0xf48c('0x31')]['findAll'](_0x42b7af);})[_0xf48c('0x2a')](function(_0x4aceb6){_0x1f18c8[_0xf48c('0x46')]=_0x4aceb6;return _0x1f18c8;})[_0xf48c('0x2a')](respondWithFilteredResult(_0x227d3f,_0x42b7af))[_0xf48c('0x47')](handleError(_0x227d3f,null));};exports['show']=function(_0x5b7ff8,_0x12f06c){var _0xc9ddbd={'raw':![],'where':{'id':_0x5b7ff8[_0xf48c('0x48')]['id']}},_0x3bcf34={};_0x3bcf34[_0xf48c('0x33')]=_[_0xf48c('0x35')](db[_0xf48c('0x31')][_0xf48c('0x32')]);_0x3bcf34[_0xf48c('0x34')]=_[_0xf48c('0x35')](_0x5b7ff8[_0xf48c('0x34')]);_0x3bcf34[_0xf48c('0x36')]=_[_0xf48c('0x38')](_0x3bcf34[_0xf48c('0x33')],_0x3bcf34['query']);_0xc9ddbd[_0xf48c('0x37')]=_[_0xf48c('0x38')](_0x3bcf34['model'],qs[_0xf48c('0x39')](_0x5b7ff8['query']['fields']));_0xc9ddbd[_0xf48c('0x37')]=_0xc9ddbd[_0xf48c('0x37')][_0xf48c('0x3a')]?_0xc9ddbd[_0xf48c('0x37')]:_0x3bcf34[_0xf48c('0x33')];if(_0x5b7ff8[_0xf48c('0x34')][_0xf48c('0x44')]){_0xc9ddbd[_0xf48c('0x45')]=[{'all':!![]}];}_0xc9ddbd=_[_0xf48c('0x41')]({},_0xc9ddbd,_0x5b7ff8['options']);return db[_0xf48c('0x31')][_0xf48c('0x49')](_0xc9ddbd)['then'](handleEntityNotFound(_0x12f06c,null))['then'](respondWithResult(_0x12f06c,null))[_0xf48c('0x47')](handleError(_0x12f06c,null));};exports[_0xf48c('0x4a')]=function(_0x5816ef,_0x18d3fa){return db[_0xf48c('0x31')][_0xf48c('0x4a')](_0x5816ef[_0xf48c('0x4b')],{})['then'](respondWithResult(_0x18d3fa,0xc9))[_0xf48c('0x47')](handleError(_0x18d3fa,null));};exports['update']=function(_0x433bcf,_0x2c9e47){if(_0x433bcf['body']['id']){delete _0x433bcf['body']['id'];}return db[_0xf48c('0x31')]['find']({'where':{'id':_0x433bcf[_0xf48c('0x48')]['id']}})['then'](handleEntityNotFound(_0x2c9e47,null))[_0xf48c('0x2a')](saveUpdates(_0x433bcf[_0xf48c('0x4b')],null))['then'](respondWithResult(_0x2c9e47,null))[_0xf48c('0x47')](handleError(_0x2c9e47,null));};exports[_0xf48c('0x2b')]=function(_0x55ac8d,_0x23a745){return db['ServicenowAccount'][_0xf48c('0x49')]({'where':{'id':_0x55ac8d[_0xf48c('0x48')]['id']}})[_0xf48c('0x2a')](handleEntityNotFound(_0x23a745,null))[_0xf48c('0x2a')](removeEntity(_0x23a745,null))[_0xf48c('0x47')](handleError(_0x23a745,null));};exports[_0xf48c('0x4c')]=function(_0xb72b8c,_0x192e4d,_0x3781f2){var _0x43480a={};var _0x34f1c6={};var _0x3e1dcd;var _0xee1b82;return db[_0xf48c('0x31')]['findOne']({'where':{'id':_0xb72b8c[_0xf48c('0x48')]['id']}})[_0xf48c('0x2a')](handleEntityNotFound(_0x192e4d,null))[_0xf48c('0x2a')](function(_0x5e6f77){if(_0x5e6f77){_0x3e1dcd=_0x5e6f77;_0x34f1c6[_0xf48c('0x33')]=_[_0xf48c('0x35')](db[_0xf48c('0x4d')]['rawAttributes']);_0x34f1c6[_0xf48c('0x34')]=_['keys'](_0xb72b8c[_0xf48c('0x34')]);_0x34f1c6['filters']=_['intersection'](_0x34f1c6[_0xf48c('0x33')],_0x34f1c6['query']);_0x43480a[_0xf48c('0x37')]=_[_0xf48c('0x38')](_0x34f1c6[_0xf48c('0x33')],qs[_0xf48c('0x39')](_0xb72b8c[_0xf48c('0x34')]['fields']));_0x43480a[_0xf48c('0x37')]=_0x43480a[_0xf48c('0x37')][_0xf48c('0x3a')]?_0x43480a[_0xf48c('0x37')]:_0x34f1c6['model'];_0x43480a['order']=qs[_0xf48c('0x3e')](_0xb72b8c[_0xf48c('0x34')][_0xf48c('0x3e')]);_0x43480a[_0xf48c('0x3f')]=qs['filters'](_[_0xf48c('0x4e')](_0xb72b8c[_0xf48c('0x34')],_0x34f1c6['filters']));if(_0xb72b8c[_0xf48c('0x34')]['filter']){_0x43480a['where']=_['merge'](_0x43480a[_0xf48c('0x3f')],{'$or':_[_0xf48c('0x42')](_0x43480a[_0xf48c('0x37')],function(_0x5b8383){var _0x5eb722={};_0x5eb722[_0x5b8383]={'$like':'%'+_0xb72b8c[_0xf48c('0x34')]['filter']+'%'};return _0x5eb722;})});}_0x43480a=_['merge']({},_0x43480a,_0xb72b8c['options']);return _0x3e1dcd[_0xf48c('0x4c')](_0x43480a);}})[_0xf48c('0x2a')](function(_0x413eea){if(_0x413eea){_0xee1b82=_0x413eea[_0xf48c('0x3a')];if(!_0xb72b8c[_0xf48c('0x34')][_0xf48c('0x3b')](_0xf48c('0x3c'))){_0x43480a[_0xf48c('0x21')]=qs[_0xf48c('0x21')](_0xb72b8c[_0xf48c('0x34')]['limit']);_0x43480a[_0xf48c('0x23')]=qs[_0xf48c('0x23')](_0xb72b8c[_0xf48c('0x34')][_0xf48c('0x23')]);}return _0x3e1dcd['getConfigurations'](_0x43480a);}})['then'](function(_0x3ef186){if(_0x3ef186){return _0x3ef186?{'count':_0xee1b82,'rows':_0x3ef186}:null;}})[_0xf48c('0x2a')](respondWithResult(_0x192e4d,null))['catch'](handleError(_0x192e4d,null));};exports[_0xf48c('0x4f')]=function(_0x468550,_0x4bf77a,_0x33c42a){if(_0x468550['body']['id']){delete _0x468550[_0xf48c('0x4b')]['id'];}return db[_0xf48c('0x31')][_0xf48c('0x50')]({'where':{'id':_0x468550[_0xf48c('0x48')]['id']}})[_0xf48c('0x2a')](handleEntityNotFound(_0x4bf77a,null))[_0xf48c('0x2a')](function(_0x2068bc){if(_0x2068bc){_0x468550[_0xf48c('0x4b')][_0xf48c('0x51')]=_0x2068bc['id'];_0x468550[_0xf48c('0x4b')][_0xf48c('0x52')]=integrations[_0xf48c('0x53')](_0x468550['body']['channel'],_0x468550['body'][_0xf48c('0x43')]);_0x468550[_0xf48c('0x4b')][_0xf48c('0x54')]=integrations[_0xf48c('0x55')](_0x468550['body'][_0xf48c('0x56')],_0x468550['body'][_0xf48c('0x43')]);return db[_0xf48c('0x4d')][_0xf48c('0x4a')](_0x468550[_0xf48c('0x4b')],{'include':[{'model':db[_0xf48c('0x57')],'as':_0xf48c('0x52')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0xf48c('0x2a')](respondWithResult(_0x4bf77a,null))[_0xf48c('0x47')](handleError(_0x4bf77a,null));};exports['getFields']=function(_0x3a84ae,_0x52cd75,_0x408530){var _0x2fa3a4=[_0xf48c('0x58'),_0xf48c('0x59'),_0xf48c('0x5a'),_0xf48c('0x5b'),_0xf48c('0x5c'),_0xf48c('0x5d'),_0xf48c('0x5e'),_0xf48c('0x5f'),'category'];var _0xc72440=[_0xf48c('0x60'),_0xf48c('0x58'),_0xf48c('0x61'),_0xf48c('0x62'),_0xf48c('0x63'),_0xf48c('0x64'),_0xf48c('0x65'),_0xf48c('0x59'),_0xf48c('0x66'),_0xf48c('0x67'),_0xf48c('0x68'),_0xf48c('0x69'),_0xf48c('0x6a'),'user_input',_0xf48c('0x6b'),_0xf48c('0x6c'),'state','sys_created_by','knowledge',_0xf48c('0x3d'),_0xf48c('0x6d'),_0xf48c('0x6e'),_0xf48c('0x6f'),_0xf48c('0x70'),'impact',_0xf48c('0x71'),_0xf48c('0x72'),_0xf48c('0x73'),_0xf48c('0x74'),'sys_domain_path',_0xf48c('0x75'),'time_worked',_0xf48c('0x76'),_0xf48c('0x77'),_0xf48c('0x78'),'group_list',_0xf48c('0x79'),_0xf48c('0x7a'),_0xf48c('0x7b'),_0xf48c('0x7c'),_0xf48c('0x7d'),_0xf48c('0x5b'),_0xf48c('0x7e'),'short_description',_0xf48c('0x5c'),_0xf48c('0x7f'),'delivery_task',_0xf48c('0x80'),_0xf48c('0x81'),_0xf48c('0x82'),_0xf48c('0x83'),'description',_0xf48c('0x84'),'notify','sys_class_name',_0xf48c('0x85'),_0xf48c('0x86'),_0xf48c('0x87'),_0xf48c('0x88'),_0xf48c('0x89'),_0xf48c('0x8a'),'reopened_by',_0xf48c('0x5e'),'urgency',_0xf48c('0x8b'),_0xf48c('0x8c'),_0xf48c('0x8d'),'activity_due','assigned_to',_0xf48c('0x5f'),_0xf48c('0x8e'),_0xf48c('0x8f'),_0xf48c('0x90'),_0xf48c('0x91'),_0xf48c('0x92'),_0xf48c('0x93'),_0xf48c('0x94'),_0xf48c('0x95'),_0xf48c('0x96'),'upon_approval','correlation_id',_0xf48c('0x97'),_0xf48c('0x98')];var _0x5cc7b3='';var _0x191635='';var _0x3944ac=[];var _0x532d72='';var _0x126af5='';var _0x561256=[];var _0xd5d7d4='';var _0x3b92a1='';var _0x138a5b={};var _0x3257fe='';return db[_0xf48c('0x31')]['findOne']({'where':{'id':_0x3a84ae['params']['id']},'attributes':['id',_0xf48c('0x99'),_0xf48c('0x9a'),_0xf48c('0x9b'),_0xf48c('0x9c'),'serverUrl']})[_0xf48c('0x2a')](handleEntityNotFound(_0x52cd75,null))[_0xf48c('0x2a')](function(_0x2a8fd7){if(_0x2a8fd7){_0x3257fe=_0x2a8fd7['remoteUri'];var _0x11ab33=_0x3257fe[_0xf48c('0x9d')](-0x1);if(_0x11ab33==='/'){_0x3257fe=_0x3257fe[_0xf48c('0x9e')](0x0,_0x3257fe[_0xf48c('0x9f')](_0x11ab33));}_0x3b92a1=util[_0xf48c('0xa0')](_0xf48c('0xa1'),_0x3257fe);_0xd5d7d4=util[_0xf48c('0xa0')]('%s/api/now/table/',_0x3257fe);_0x138a5b={'user':_0x2a8fd7['username'],'pass':_0x2a8fd7[_0xf48c('0x9a')]};var _0x4625ab={'method':'GET','uri':_0x3b92a1+_0xf48c('0xa2'),'auth':_0x138a5b,'json':!![]};return rp(_0x4625ab);}})['then'](function(_0x411621){if(_0x411621[_0xf48c('0xa3')][_0xf48c('0x3a')]>0x0){_0x5cc7b3=_0x411621[_0xf48c('0xa3')];}console[_0xf48c('0xa4')](_0xf48c('0xa5'),_0x5cc7b3);_0x561256=[];_0x191635=Object[_0xf48c('0xa6')]([],_0x5cc7b3);_[_0xf48c('0xa7')](_0x191635,function(_0x26f1b9){return!_0x2fa3a4[_0xf48c('0xa8')](_0x26f1b9[_0xf48c('0x2e')]);});_0x191635[_0xf48c('0xa9')](function(_0x437390){var _0x23bbf0=createFieldObject(_0xd5d7d4,_0x138a5b,_0x437390['internalType'],_0x437390[_0xf48c('0x2e')],_0x437390[_0xf48c('0xaa')],![]);_0x561256[_0xf48c('0xab')](_0x23bbf0);});return Promise[_0xf48c('0xac')](_0x561256);})[_0xf48c('0x2a')](function(_0x2276bc){_0x3944ac=_0x2276bc;_0x532d72=Object['assign']([],_0x5cc7b3);console['log']('TCL:\x20_object',_0x5cc7b3);_['remove'](_0x532d72,function(_0x1bd63b){return _0xc72440[_0xf48c('0xa8')](_0x1bd63b[_0xf48c('0x2e')]);});console['log'](_0xf48c('0xad'),_0x532d72);_0x561256=[];_0x532d72[_0xf48c('0xa9')](function(_0x5f47c7){var _0x4169ca=createFieldObject(_0xd5d7d4,_0x138a5b,_0x5f47c7[_0xf48c('0xae')],_0x5f47c7['name'],_0x5f47c7[_0xf48c('0xaa')],!![]);_0x561256[_0xf48c('0xab')](_0x4169ca);});return Promise[_0xf48c('0xac')](_0x561256);})['then'](function(_0xae6fbb){_0x126af5=_0xae6fbb;var _0x3d2482=_0x3944ac['concat'](_0x126af5);return{'count':_0x3d2482[_0xf48c('0x3a')],'rows':_0x3d2482};})[_0xf48c('0x2a')](respondWithResult(_0x52cd75,null))[_0xf48c('0x47')](function(_0x24dcc0){console['log'](_0xf48c('0xaf')+_0x24dcc0);var _0xf9b7d9=_0x3a84ae[_0xf48c('0x34')][_0xf48c('0xb0')]?0x1f4:_0x24dcc0['statusCode']||0x1f4;logger[_0xf48c('0x2c')](_0x24dcc0[_0xf48c('0x2d')]);delete _0x24dcc0[_0xf48c('0x2e')];if(_0xf9b7d9===0x191){_0xf9b7d9=0x190;}_0x52cd75['status'](_0xf9b7d9)[_0xf48c('0x2f')](_0x3a84ae[_0xf48c('0x34')][_0xf48c('0xb0')]?{'message':_0xf48c('0xb1'),'statusCode':_0x24dcc0[_0xf48c('0xb2')]}:_0x24dcc0);});};function createFieldObject(_0x357be0,_0x41a9bd,_0x33393c,_0x3ba5af,_0x312178,_0x565ad0){return new Promise(function(_0x27d32e,_0x10a347){var _0x326896={'id':_0x3ba5af,'name':_0x312178,'custom':_0x565ad0};if(_0x33393c===_0xf48c('0xb3')){_0x326896[_0xf48c('0xb4')]=[{'name':_0xf48c('0xb5'),'value':_0xf48c('0xb6')},{'name':_0xf48c('0xb7'),'value':_0xf48c('0xb8')}];_0x27d32e(_0x326896);}else{var _0x42015d={'method':_0xf48c('0xb9'),'uri':_0x357be0+'sys_choice?sysparm_query=name=incident^element='+_0x3ba5af,'auth':_0x41a9bd,'json':!![]};return rp(_0x42015d)[_0xf48c('0x2a')](function(_0xe4ee92){var _0x2fc11f=[];if(_0xe4ee92[_0xf48c('0xa3')][_0xf48c('0x3a')]>0x0){_0xe4ee92[_0xf48c('0xa3')][_0xf48c('0xa9')](function(_0xad910){if(_0xad910['inactive']===_0xf48c('0xb8')){var _0x113374={'name':_0xad910[_0xf48c('0xaa')],'value':_0xad910[_0xf48c('0xba')]};_0x2fc11f[_0xf48c('0xab')](_0x113374);}});}_0x326896['options']=_0x2fc11f;if(_0x326896['options'][_0xf48c('0x3a')]>0x0){_0x27d32e(_0x326896);}else{if(_0x565ad0==![]){_0x27d32e();}else{_0x27d32e(_0x326896);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index feec61b..59319f9 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 _0x187d=['exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowAccount.attributes'];(function(_0x2b737c,_0x274adf){var _0x466ed5=function(_0x593124){while(--_0x593124){_0x2b737c['push'](_0x2b737c['shift']());}};_0x466ed5(++_0x274adf);}(_0x187d,0x93));var _0xd187=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x187d[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xd187('0x9')]=function(_0x58ee7,_0x444a60){return _0x58ee7[_0xd187('0xa')](_0xd187('0xb'),attributes,{'tableName':_0xd187('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbf5=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x498b9e,_0x453c71){var _0x18f808=function(_0x4fd9b4){while(--_0x4fd9b4){_0x498b9e['push'](_0x498b9e['shift']());}};_0x18f808(++_0x453c71);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x1b6e93,_0x370d7a){_0x1b6e93=_0x1b6e93-0x0;var _0x41c4c1=_0xdbf5[_0x1b6e93];return _0x41c4c1;};'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'));var integrations=require(_0x5dbf('0x8'));module[_0x5dbf('0x9')]=function(_0x3f8222,_0x209b7d){return _0x3f8222[_0x5dbf('0xa')](_0x5dbf('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index d38b677..b7187ef 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 _0xf063=['ServicenowAccount','find','raw','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','where','attributes','map','model','include','then','GetServicenowAccount','debug','ShowServicenowAccount'];(function(_0x4c7892,_0x1c2cb0){var _0x2a79c8=function(_0x523690){while(--_0x523690){_0x4c7892['push'](_0x4c7892['shift']());}};_0x2a79c8(++_0x1c2cb0);}(_0xf063,0xea));var _0x3f06=function(_0x1efd23,_0x6f0e76){_0x1efd23=_0x1efd23-0x0;var _0x1a0e9f=_0xf063[_0x1efd23];return _0x1a0e9f;};'use strict';var _=require(_0x3f06('0x0'));var util=require(_0x3f06('0x1'));var moment=require(_0x3f06('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f06('0x3'));var db=require(_0x3f06('0x4'))['db'];var utils=require(_0x3f06('0x5'));var logger=require('../../config/logger')(_0x3f06('0x6'));var config=require(_0x3f06('0x7'));var jayson=require(_0x3f06('0x8'));var client=jayson['client'][_0x3f06('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d384c,_0x302ee5,_0x2afb28){return new BPromise(function(_0x55de92,_0x317a82){return client['request'](_0x5d384c,_0x2afb28)['then'](function(_0x36769c){logger[_0x3f06('0xa')](_0x3f06('0xb'),_0x302ee5,_0x3f06('0xc'));logger['debug'](_0x3f06('0xd'),_0x302ee5,_0x3f06('0xc'),JSON[_0x3f06('0xe')](_0x36769c));if(_0x36769c[_0x3f06('0xf')]){if(_0x36769c[_0x3f06('0xf')][_0x3f06('0x10')]===0x1f4){logger[_0x3f06('0xf')](_0x3f06('0xb'),_0x302ee5,_0x36769c[_0x3f06('0xf')]['message']);return _0x317a82(_0x36769c[_0x3f06('0xf')][_0x3f06('0x11')]);}logger[_0x3f06('0xf')](_0x3f06('0xb'),_0x302ee5,_0x36769c[_0x3f06('0xf')]['message']);return _0x55de92(_0x36769c[_0x3f06('0xf')][_0x3f06('0x11')]);}else{logger[_0x3f06('0xa')](_0x3f06('0xb'),_0x302ee5,_0x3f06('0xc'));_0x55de92(_0x36769c[_0x3f06('0x12')][_0x3f06('0x11')]);}})[_0x3f06('0x13')](function(_0x294465){logger['error'](_0x3f06('0xb'),_0x302ee5,_0x294465);_0x317a82(_0x294465);});});}exports['GetServicenowAccount']=function(_0x52c4a8){var _0x2981d3=this;return new Promise(function(_0x8b7cb6,_0x9947a5){return db['ServicenowAccount']['findAll']({'raw':_0x52c4a8[_0x3f06('0x14')]?_0x52c4a8[_0x3f06('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x52c4a8[_0x3f06('0x14')]?_0x52c4a8['options'][_0x3f06('0x15')]||null:null,'attributes':_0x52c4a8[_0x3f06('0x14')]?_0x52c4a8[_0x3f06('0x14')][_0x3f06('0x16')]||null:null,'limit':_0x52c4a8[_0x3f06('0x14')]?_0x52c4a8[_0x3f06('0x14')]['limit']||null:null,'include':_0x52c4a8['options']?_0x52c4a8[_0x3f06('0x14')]['include']?_[_0x3f06('0x17')](_0x52c4a8[_0x3f06('0x14')]['include'],function(_0x42f9a7){return{'model':db[_0x42f9a7[_0x3f06('0x18')]],'as':_0x42f9a7['as'],'attributes':_0x42f9a7[_0x3f06('0x16')],'include':_0x42f9a7[_0x3f06('0x19')]?_[_0x3f06('0x17')](_0x42f9a7[_0x3f06('0x19')],function(_0x56c956){return{'model':db[_0x56c956['model']],'as':_0x56c956['as'],'attributes':_0x56c956[_0x3f06('0x16')],'include':_0x56c956[_0x3f06('0x19')]?_[_0x3f06('0x17')](_0x56c956[_0x3f06('0x19')],function(_0x1dc8ff){return{'model':db[_0x1dc8ff[_0x3f06('0x18')]],'as':_0x1dc8ff['as'],'attributes':_0x1dc8ff[_0x3f06('0x16')]};}):[]};}):[]};}):[]:[]})[_0x3f06('0x1a')](function(_0x5aca94){logger[_0x3f06('0xa')](_0x3f06('0x1b'),_0x52c4a8);logger[_0x3f06('0x1c')](_0x3f06('0x1b'),_0x52c4a8,JSON[_0x3f06('0xe')](_0x5aca94));_0x8b7cb6(_0x5aca94);})['catch'](function(_0x280375){logger[_0x3f06('0xf')](_0x3f06('0x1b'),_0x280375[_0x3f06('0x11')],_0x52c4a8);_0x9947a5(_0x2981d3[_0x3f06('0xf')](0x1f4,_0x280375['message']));});});};exports[_0x3f06('0x1d')]=function(_0x5a17a6){var _0x4a8f27=this;return new Promise(function(_0x2b5c96,_0x235904){return db[_0x3f06('0x1e')][_0x3f06('0x1f')]({'raw':_0x5a17a6['options']?_0x5a17a6['options'][_0x3f06('0x20')]===undefined?!![]:![]:!![],'where':_0x5a17a6['options']?_0x5a17a6[_0x3f06('0x14')][_0x3f06('0x15')]||null:null,'attributes':_0x5a17a6[_0x3f06('0x14')]?_0x5a17a6[_0x3f06('0x14')][_0x3f06('0x16')]||null:null,'include':_0x5a17a6[_0x3f06('0x14')]?_0x5a17a6[_0x3f06('0x14')][_0x3f06('0x19')]?_['map'](_0x5a17a6['options'][_0x3f06('0x19')],function(_0x3a0e4d){return{'model':db[_0x3a0e4d[_0x3f06('0x18')]],'as':_0x3a0e4d['as'],'attributes':_0x3a0e4d['attributes'],'include':_0x3a0e4d[_0x3f06('0x19')]?_[_0x3f06('0x17')](_0x3a0e4d[_0x3f06('0x19')],function(_0x57445d){return{'model':db[_0x57445d['model']],'as':_0x57445d['as'],'attributes':_0x57445d[_0x3f06('0x16')],'include':_0x57445d['include']?_[_0x3f06('0x17')](_0x57445d[_0x3f06('0x19')],function(_0x1e64eb){return{'model':db[_0x1e64eb[_0x3f06('0x18')]],'as':_0x1e64eb['as'],'attributes':_0x1e64eb[_0x3f06('0x16')]};}):[]};}):[]};}):[]:[]})[_0x3f06('0x1a')](function(_0x2d2793){logger[_0x3f06('0xa')](_0x3f06('0x1d'),_0x5a17a6);logger[_0x3f06('0x1c')](_0x3f06('0x1d'),_0x5a17a6,JSON[_0x3f06('0xe')](_0x2d2793));_0x2b5c96(_0x2d2793);})[_0x3f06('0x13')](function(_0x592d72){logger[_0x3f06('0xf')](_0x3f06('0x1d'),_0x592d72['message'],_0x5a17a6);_0x235904(_0x4a8f27['error'](0x1f4,_0x592d72['message']));});});}; \ No newline at end of file +var _0x184c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x53bcc3,_0x364374){var _0x47c959=function(_0x40ef7d){while(--_0x40ef7d){_0x53bcc3['push'](_0x53bcc3['shift']());}};_0x47c959(++_0x364374);}(_0x184c,0xdd));var _0xc184=function(_0x145399,_0x206fd3){_0x145399=_0x145399-0x0;var _0x2671eb=_0x184c[_0x145399];return _0x2671eb;};'use strict';var _=require(_0xc184('0x0'));var util=require(_0xc184('0x1'));var moment=require(_0xc184('0x2'));var BPromise=require(_0xc184('0x3'));var rs=require(_0xc184('0x4'));var fs=require('fs');var Redis=require(_0xc184('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc184('0x6'));var logger=require(_0xc184('0x7'))(_0xc184('0x8'));var config=require(_0xc184('0x9'));var jayson=require(_0xc184('0xa'));var client=jayson[_0xc184('0xb')][_0xc184('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x44ac8c,_0x508158,_0x39b504){return new BPromise(function(_0x4a11f7,_0x285a33){return client[_0xc184('0xd')](_0x44ac8c,_0x39b504)[_0xc184('0xe')](function(_0x1d39dc){logger[_0xc184('0xf')](_0xc184('0x10'),_0x508158,'request\x20sent');logger[_0xc184('0x11')](_0xc184('0x12'),_0x508158,_0xc184('0x13'),JSON[_0xc184('0x14')](_0x1d39dc));if(_0x1d39dc['error']){if(_0x1d39dc['error'][_0xc184('0x15')]===0x1f4){logger[_0xc184('0x16')]('ServicenowAccount,\x20%s,\x20%s',_0x508158,_0x1d39dc[_0xc184('0x16')]['message']);return _0x285a33(_0x1d39dc[_0xc184('0x16')][_0xc184('0x17')]);}logger['error'](_0xc184('0x10'),_0x508158,_0x1d39dc[_0xc184('0x16')]['message']);return _0x4a11f7(_0x1d39dc[_0xc184('0x16')][_0xc184('0x17')]);}else{logger[_0xc184('0xf')](_0xc184('0x10'),_0x508158,_0xc184('0x13'));_0x4a11f7(_0x1d39dc['result'][_0xc184('0x17')]);}})[_0xc184('0x18')](function(_0x567117){logger[_0xc184('0x16')](_0xc184('0x10'),_0x508158,_0x567117);_0x285a33(_0x567117);});});}exports[_0xc184('0x19')]=function(_0x110cd8){var _0x57f388=this;return new Promise(function(_0x57ad0a,_0x1ded0d){return db[_0xc184('0x1a')][_0xc184('0x1b')]({'raw':_0x110cd8[_0xc184('0x1c')]?_0x110cd8[_0xc184('0x1c')][_0xc184('0x1d')]===undefined?!![]:![]:!![],'where':_0x110cd8[_0xc184('0x1c')]?_0x110cd8['options'][_0xc184('0x1e')]||null:null,'attributes':_0x110cd8[_0xc184('0x1c')]?_0x110cd8[_0xc184('0x1c')][_0xc184('0x1f')]||null:null,'limit':_0x110cd8[_0xc184('0x1c')]?_0x110cd8['options'][_0xc184('0x20')]||null:null,'include':_0x110cd8['options']?_0x110cd8[_0xc184('0x1c')][_0xc184('0x21')]?_[_0xc184('0x22')](_0x110cd8[_0xc184('0x1c')][_0xc184('0x21')],function(_0xb57706){return{'model':db[_0xb57706[_0xc184('0x23')]],'as':_0xb57706['as'],'attributes':_0xb57706[_0xc184('0x1f')],'include':_0xb57706['include']?_[_0xc184('0x22')](_0xb57706['include'],function(_0x5bd693){return{'model':db[_0x5bd693['model']],'as':_0x5bd693['as'],'attributes':_0x5bd693[_0xc184('0x1f')],'include':_0x5bd693[_0xc184('0x21')]?_[_0xc184('0x22')](_0x5bd693[_0xc184('0x21')],function(_0x3cbd20){return{'model':db[_0x3cbd20[_0xc184('0x23')]],'as':_0x3cbd20['as'],'attributes':_0x3cbd20[_0xc184('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc184('0xe')](function(_0x44a45b){logger['info'](_0xc184('0x19'),_0x110cd8);logger[_0xc184('0x11')](_0xc184('0x19'),_0x110cd8,JSON[_0xc184('0x14')](_0x44a45b));_0x57ad0a(_0x44a45b);})['catch'](function(_0x5b860d){logger['error']('GetServicenowAccount',_0x5b860d[_0xc184('0x17')],_0x110cd8);_0x1ded0d(_0x57f388[_0xc184('0x16')](0x1f4,_0x5b860d['message']));});});};exports['ShowServicenowAccount']=function(_0xabe4ea){var _0x2357f3=this;return new Promise(function(_0x1cc000,_0x257b76){return db['ServicenowAccount'][_0xc184('0x24')]({'raw':_0xabe4ea[_0xc184('0x1c')]?_0xabe4ea[_0xc184('0x1c')][_0xc184('0x1d')]===undefined?!![]:![]:!![],'where':_0xabe4ea[_0xc184('0x1c')]?_0xabe4ea['options'][_0xc184('0x1e')]||null:null,'attributes':_0xabe4ea[_0xc184('0x1c')]?_0xabe4ea[_0xc184('0x1c')][_0xc184('0x1f')]||null:null,'include':_0xabe4ea[_0xc184('0x1c')]?_0xabe4ea[_0xc184('0x1c')][_0xc184('0x21')]?_[_0xc184('0x22')](_0xabe4ea[_0xc184('0x1c')][_0xc184('0x21')],function(_0x350bff){return{'model':db[_0x350bff[_0xc184('0x23')]],'as':_0x350bff['as'],'attributes':_0x350bff['attributes'],'include':_0x350bff[_0xc184('0x21')]?_[_0xc184('0x22')](_0x350bff['include'],function(_0x1d82eb){return{'model':db[_0x1d82eb[_0xc184('0x23')]],'as':_0x1d82eb['as'],'attributes':_0x1d82eb[_0xc184('0x1f')],'include':_0x1d82eb[_0xc184('0x21')]?_[_0xc184('0x22')](_0x1d82eb[_0xc184('0x21')],function(_0x49980d){return{'model':db[_0x49980d[_0xc184('0x23')]],'as':_0x49980d['as'],'attributes':_0x49980d[_0xc184('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc184('0xe')](function(_0x1cd5a5){logger[_0xc184('0xf')](_0xc184('0x25'),_0xabe4ea);logger[_0xc184('0x11')](_0xc184('0x25'),_0xabe4ea,JSON[_0xc184('0x14')](_0x1cd5a5));_0x1cc000(_0x1cd5a5);})[_0xc184('0x18')](function(_0x3ad8c2){logger[_0xc184('0x16')](_0xc184('0x25'),_0x3ad8c2[_0xc184('0x17')],_0xabe4ea);_0x257b76(_0x2357f3[_0xc184('0x16')](0x1f4,_0x3ad8c2[_0xc184('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 8844dd3..7871c37 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 _0xc01f=['getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','/:id/fields'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xc01f,0xe4));var _0xfc01=function(_0x4e0569,_0x315b0b){_0x4e0569=_0x4e0569-0x0;var _0x12f247=_0xc01f[_0x4e0569];return _0x12f247;};'use strict';var multer=require(_0xfc01('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfc01('0x1'));var express=require(_0xfc01('0x2'));var router=express[_0xfc01('0x3')]();var fs_extra=require(_0xfc01('0x4'));var auth=require(_0xfc01('0x5'));var interaction=require(_0xfc01('0x6'));var config=require('../../config/environment');var controller=require(_0xfc01('0x7'));router[_0xfc01('0x8')]('/',auth[_0xfc01('0x9')](),controller['index']);router[_0xfc01('0x8')](_0xfc01('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xfc01('0x8')](_0xfc01('0xb'),auth['isAuthenticated'](),controller[_0xfc01('0xc')]);router[_0xfc01('0x8')]('/:id/subjects',auth[_0xfc01('0x9')](),controller[_0xfc01('0xd')]);router['get'](_0xfc01('0xe'),auth['isAuthenticated'](),controller[_0xfc01('0xf')]);router[_0xfc01('0x10')]('/',auth[_0xfc01('0x9')](),controller['create']);router[_0xfc01('0x11')](_0xfc01('0xa'),auth['isAuthenticated'](),controller[_0xfc01('0x12')]);router['delete'](_0xfc01('0xa'),auth[_0xfc01('0x9')](),controller[_0xfc01('0x13')]);module['exports']=router; \ No newline at end of file +var _0x89ce=['post','create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','getDescriptions'];(function(_0x49bbf0,_0x3412f5){var _0x1e02f4=function(_0x44a6d4){while(--_0x44a6d4){_0x49bbf0['push'](_0x49bbf0['shift']());}};_0x1e02f4(++_0x3412f5);}(_0x89ce,0x18e));var _0xe89c=function(_0x326b55,_0x52a7f1){_0x326b55=_0x326b55-0x0;var _0x220dfb=_0x89ce[_0x326b55];return _0x220dfb;};'use strict';var multer=require('multer');var util=require(_0xe89c('0x0'));var path=require(_0xe89c('0x1'));var timeout=require('connect-timeout');var express=require(_0xe89c('0x2'));var router=express[_0xe89c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe89c('0x4'));var interaction=require(_0xe89c('0x5'));var config=require(_0xe89c('0x6'));var controller=require(_0xe89c('0x7'));router[_0xe89c('0x8')]('/',auth[_0xe89c('0x9')](),controller[_0xe89c('0xa')]);router['get'](_0xe89c('0xb'),auth[_0xe89c('0x9')](),controller['show']);router['get'](_0xe89c('0xc'),auth['isAuthenticated'](),controller[_0xe89c('0xd')]);router['get']('/:id/subjects',auth[_0xe89c('0x9')](),controller[_0xe89c('0xe')]);router[_0xe89c('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xe89c('0xf')]);router[_0xe89c('0x10')]('/',auth['isAuthenticated'](),controller[_0xe89c('0x11')]);router[_0xe89c('0x12')](_0xe89c('0xb'),auth[_0xe89c('0x9')](),controller[_0xe89c('0x13')]);router[_0xe89c('0x14')](_0xe89c('0xb'),auth[_0xe89c('0x9')](),controller[_0xe89c('0x15')]);module[_0xe89c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index c253601..d9d7f61 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 _0x0579=['STRING','sequelize'];(function(_0x585594,_0x4326ce){var _0x355ccd=function(_0x2d8d17){while(--_0x2d8d17){_0x585594['push'](_0x585594['shift']());}};_0x355ccd(++_0x4326ce);}(_0x0579,0x179));var _0x9057=function(_0x33af7a,_0xe836f){_0x33af7a=_0x33af7a-0x0;var _0x562309=_0x0579[_0x33af7a];return _0x562309;};'use strict';var Sequelize=require(_0x9057('0x0'));module['exports']={'name':{'type':Sequelize[_0x9057('0x1')]},'description':{'type':Sequelize[_0x9057('0x1')]}}; \ No newline at end of file +var _0x0c7b=['STRING','exports'];(function(_0x3e665d,_0xef863d){var _0x24a155=function(_0x1343e7){while(--_0x1343e7){_0x3e665d['push'](_0x3e665d['shift']());}};_0x24a155(++_0xef863d);}(_0x0c7b,0x101));var _0xb0c7=function(_0x3d7981,_0x31504a){_0x3d7981=_0x3d7981-0x0;var _0x55b9f3=_0x0c7b[_0x3d7981];return _0x55b9f3;};'use strict';var Sequelize=require('sequelize');module[_0xb0c7('0x0')]={'name':{'type':Sequelize[_0xb0c7('0x1')]},'description':{'type':Sequelize[_0xb0c7('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 8c97a48..3c025a3 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 _0x98f6=['querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','then','destroy','end','sendStatus','error','stack','name','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','include','catch','show','includeAll','merge','options','create','update','body','find','params','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x44c325,_0x19c625){var _0x55f09e=function(_0x322d1b){while(--_0x322d1b){_0x44c325['push'](_0x44c325['shift']());}};_0x55f09e(++_0x19c625);}(_0x98f6,0x1ca));var _0x698f=function(_0x2b01a2,_0x3b4040){_0x2b01a2=_0x2b01a2-0x0;var _0xcce4ab=_0x98f6[_0x2b01a2];return _0xcce4ab;};'use strict';var emlformat=require(_0x698f('0x0'));var rimraf=require(_0x698f('0x1'));var zipdir=require(_0x698f('0x2'));var jsonpatch=require(_0x698f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x698f('0x4'));var Mustache=require('mustache');var util=require(_0x698f('0x5'));var path=require(_0x698f('0x6'));var sox=require(_0x698f('0x7'));var csv=require(_0x698f('0x8'));var ejs=require(_0x698f('0x9'));var fs=require('fs');var fs_extra=require(_0x698f('0xa'));var _=require(_0x698f('0xb'));var squel=require(_0x698f('0xc'));var crypto=require(_0x698f('0xd'));var jsforce=require(_0x698f('0xe'));var deskjs=require(_0x698f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x698f('0x10'));var Papa=require(_0x698f('0x11'));var Redis=require(_0x698f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x698f('0x13'));var hardwareService=require(_0x698f('0x14'));var logger=require(_0x698f('0x15'))(_0x698f('0x16'));var utils=require('../../config/utils');var config=require(_0x698f('0x17'));var licenseUtil=require(_0x698f('0x18'));var db=require(_0x698f('0x19'))['db'];function respondWithStatusCode(_0x241bb0,_0x2db85e){_0x2db85e=_0x2db85e||0xcc;return function(_0x1071cd){if(_0x1071cd){return _0x241bb0['sendStatus'](_0x2db85e);}return _0x241bb0[_0x698f('0x1a')](_0x2db85e)['end']();};}function respondWithResult(_0x349b2e,_0x55b422){_0x55b422=_0x55b422||0xc8;return function(_0x372994){if(_0x372994){return _0x349b2e[_0x698f('0x1a')](_0x55b422)[_0x698f('0x1b')](_0x372994);}};}function respondWithFilteredResult(_0x5e52e7,_0x24db5e){return function(_0x50e8e4){if(_0x50e8e4){var _0x236cf3=typeof _0x24db5e[_0x698f('0x1c')]===_0x698f('0x1d')&&typeof _0x24db5e[_0x698f('0x1e')]===_0x698f('0x1d');var _0xca95b6=_0x50e8e4[_0x698f('0x1f')];var _0x1e56a3=_0x236cf3?0x0:_0x24db5e[_0x698f('0x1c')];var _0x35540a=_0x236cf3?_0x50e8e4[_0x698f('0x1f')]:_0x24db5e[_0x698f('0x1c')]+_0x24db5e[_0x698f('0x1e')];var _0x63f04c;if(_0x35540a>=_0xca95b6){_0x35540a=_0xca95b6;_0x63f04c=0xc8;}else{_0x63f04c=0xce;}_0x5e52e7[_0x698f('0x1a')](_0x63f04c);return _0x5e52e7[_0x698f('0x20')]('Content-Range',_0x1e56a3+'-'+_0x35540a+'/'+_0xca95b6)['json'](_0x50e8e4);}return null;};}function patchUpdates(_0x5560c0){return function(_0xbb7b79){try{jsonpatch[_0x698f('0x21')](_0xbb7b79,_0x5560c0,!![]);}catch(_0x57b60b){return BPromise['reject'](_0x57b60b);}return _0xbb7b79['save']();};}function saveUpdates(_0x1eaaa5,_0x3f1cfb){return function(_0x28face){if(_0x28face){return _0x28face['update'](_0x1eaaa5)[_0x698f('0x22')](function(_0x39c7b1){return _0x39c7b1;});}return null;};}function removeEntity(_0x4aa12d,_0x55fa9d){return function(_0x853a65){if(_0x853a65){return _0x853a65[_0x698f('0x23')]()[_0x698f('0x22')](function(){_0x4aa12d[_0x698f('0x1a')](0xcc)[_0x698f('0x24')]();});}};}function handleEntityNotFound(_0xf2fc2f,_0x45efdd){return function(_0x13bfd5){if(!_0x13bfd5){_0xf2fc2f[_0x698f('0x25')](0x194);}return _0x13bfd5;};}function handleError(_0x522795,_0x36d3b6){_0x36d3b6=_0x36d3b6||0x1f4;return function(_0x3beeb0){logger[_0x698f('0x26')](_0x3beeb0[_0x698f('0x27')]);if(_0x3beeb0[_0x698f('0x28')]){delete _0x3beeb0['name'];}_0x522795['status'](_0x36d3b6)['send'](_0x3beeb0);};}exports[_0x698f('0x29')]=function(_0x593f20,_0x3d07b0){var _0x3c32ad={},_0xcc4772={},_0x2c3e06={'count':0x0,'rows':[]};var _0x3c6768=_['map'](db[_0x698f('0x2a')][_0x698f('0x2b')],function(_0x402711){return{'name':_0x402711[_0x698f('0x2c')],'type':_0x402711[_0x698f('0x2d')][_0x698f('0x2e')]};});_0xcc4772[_0x698f('0x2f')]=_[_0x698f('0x30')](_0x3c6768,_0x698f('0x28'));_0xcc4772['query']=_[_0x698f('0x31')](_0x593f20[_0x698f('0x32')]);_0xcc4772[_0x698f('0x33')]=_['intersection'](_0xcc4772[_0x698f('0x2f')],_0xcc4772[_0x698f('0x32')]);_0x3c32ad['attributes']=_[_0x698f('0x34')](_0xcc4772[_0x698f('0x2f')],qs['fields'](_0x593f20[_0x698f('0x32')][_0x698f('0x35')]));_0x3c32ad[_0x698f('0x36')]=_0x3c32ad['attributes'][_0x698f('0x37')]?_0x3c32ad[_0x698f('0x36')]:_0xcc4772[_0x698f('0x2f')];if(!_0x593f20[_0x698f('0x32')][_0x698f('0x38')](_0x698f('0x39'))){_0x3c32ad[_0x698f('0x1e')]=qs[_0x698f('0x1e')](_0x593f20[_0x698f('0x32')]['limit']);_0x3c32ad['offset']=qs[_0x698f('0x1c')](_0x593f20[_0x698f('0x32')][_0x698f('0x1c')]);}_0x3c32ad[_0x698f('0x3a')]=qs[_0x698f('0x3b')](_0x593f20['query']['sort']);_0x3c32ad[_0x698f('0x3c')]=qs[_0x698f('0x33')](_[_0x698f('0x3d')](_0x593f20[_0x698f('0x32')],_0xcc4772[_0x698f('0x33')]),_0x3c6768);if(_0x593f20['query'][_0x698f('0x3e')]){_0x3c32ad['where']=_['merge'](_0x3c32ad['where'],{'$or':_[_0x698f('0x30')](_0x3c6768,function(_0x4bcb07){if(_0x4bcb07[_0x698f('0x2d')]!=='VIRTUAL'){var _0x33a484={};_0x33a484[_0x4bcb07['name']]={'$like':'%'+_0x593f20[_0x698f('0x32')][_0x698f('0x3e')]+'%'};return _0x33a484;}})});}_0x3c32ad=_['merge']({},_0x3c32ad,_0x593f20['options']);var _0x2d3ae6={'where':_0x3c32ad['where']};return db[_0x698f('0x2a')][_0x698f('0x1f')](_0x2d3ae6)[_0x698f('0x22')](function(_0xd62b28){_0x2c3e06['count']=_0xd62b28;if(_0x593f20[_0x698f('0x32')]['includeAll']){_0x3c32ad[_0x698f('0x3f')]=[{'all':!![]}];}return db[_0x698f('0x2a')]['findAll'](_0x3c32ad);})['then'](function(_0x264fd5){_0x2c3e06['rows']=_0x264fd5;return _0x2c3e06;})[_0x698f('0x22')](respondWithFilteredResult(_0x3d07b0,_0x3c32ad))[_0x698f('0x40')](handleError(_0x3d07b0,null));};exports[_0x698f('0x41')]=function(_0x5801e7,_0x54f06d){var _0x49c942={'raw':![],'where':{'id':_0x5801e7['params']['id']}},_0x1c425c={};_0x1c425c[_0x698f('0x2f')]=_[_0x698f('0x31')](db[_0x698f('0x2a')][_0x698f('0x2b')]);_0x1c425c[_0x698f('0x32')]=_[_0x698f('0x31')](_0x5801e7['query']);_0x1c425c[_0x698f('0x33')]=_[_0x698f('0x34')](_0x1c425c[_0x698f('0x2f')],_0x1c425c[_0x698f('0x32')]);_0x49c942[_0x698f('0x36')]=_[_0x698f('0x34')](_0x1c425c[_0x698f('0x2f')],qs[_0x698f('0x35')](_0x5801e7[_0x698f('0x32')]['fields']));_0x49c942['attributes']=_0x49c942[_0x698f('0x36')][_0x698f('0x37')]?_0x49c942[_0x698f('0x36')]:_0x1c425c['model'];if(_0x5801e7[_0x698f('0x32')][_0x698f('0x42')]){_0x49c942['include']=[{'all':!![]}];}_0x49c942=_[_0x698f('0x43')]({},_0x49c942,_0x5801e7[_0x698f('0x44')]);return db[_0x698f('0x2a')]['find'](_0x49c942)['then'](handleEntityNotFound(_0x54f06d,null))[_0x698f('0x22')](respondWithResult(_0x54f06d,null))[_0x698f('0x40')](handleError(_0x54f06d,null));};exports[_0x698f('0x45')]=function(_0x25db00,_0x1d82d5){return db['ServicenowConfiguration'][_0x698f('0x45')](_0x25db00['body'],{})[_0x698f('0x22')](respondWithResult(_0x1d82d5,0xc9))[_0x698f('0x40')](handleError(_0x1d82d5,null));};exports[_0x698f('0x46')]=function(_0x531057,_0x3e420c){if(_0x531057[_0x698f('0x47')]['id']){delete _0x531057[_0x698f('0x47')]['id'];}return db['ServicenowConfiguration'][_0x698f('0x48')]({'where':{'id':_0x531057[_0x698f('0x49')]['id']}})[_0x698f('0x22')](handleEntityNotFound(_0x3e420c,null))['then'](saveUpdates(_0x531057['body'],null))[_0x698f('0x22')](respondWithResult(_0x3e420c,null))['catch'](handleError(_0x3e420c,null));};exports[_0x698f('0x23')]=function(_0x10d05c,_0x46eb99){return db['ServicenowConfiguration']['find']({'where':{'id':_0x10d05c[_0x698f('0x49')]['id']}})[_0x698f('0x22')](handleEntityNotFound(_0x46eb99,null))[_0x698f('0x22')](removeEntity(_0x46eb99,null))[_0x698f('0x40')](handleError(_0x46eb99,null));};exports[_0x698f('0x4a')]=function(_0x5d42f8,_0x3e177a,_0x459fb9){var _0x371867={};var _0x2f2308={};var _0x45e83b;var _0x4ee3e4;return db['ServicenowConfiguration'][_0x698f('0x4b')]({'where':{'id':_0x5d42f8[_0x698f('0x49')]['id']}})[_0x698f('0x22')](handleEntityNotFound(_0x3e177a,null))[_0x698f('0x22')](function(_0x162825){if(_0x162825){_0x45e83b=_0x162825;_0x2f2308[_0x698f('0x2f')]=_[_0x698f('0x31')](db[_0x698f('0x4c')]['rawAttributes']);_0x2f2308['query']=_['keys'](_0x5d42f8[_0x698f('0x32')]);_0x2f2308[_0x698f('0x33')]=_[_0x698f('0x34')](_0x2f2308[_0x698f('0x2f')],_0x2f2308[_0x698f('0x32')]);_0x371867['attributes']=_['intersection'](_0x2f2308['model'],qs[_0x698f('0x35')](_0x5d42f8[_0x698f('0x32')][_0x698f('0x35')]));_0x371867[_0x698f('0x36')]=_0x371867['attributes'][_0x698f('0x37')]?_0x371867[_0x698f('0x36')]:_0x2f2308['model'];_0x371867[_0x698f('0x3a')]=qs[_0x698f('0x3b')](_0x5d42f8[_0x698f('0x32')][_0x698f('0x3b')]);_0x371867['where']=qs['filters'](_[_0x698f('0x3d')](_0x5d42f8['query'],_0x2f2308[_0x698f('0x33')]));if(_0x5d42f8[_0x698f('0x32')][_0x698f('0x3e')]){_0x371867[_0x698f('0x3c')]=_[_0x698f('0x43')](_0x371867[_0x698f('0x3c')],{'$or':_['map'](_0x371867[_0x698f('0x36')],function(_0x5576f5){var _0x367492={};_0x367492[_0x5576f5]={'$like':'%'+_0x5d42f8[_0x698f('0x32')][_0x698f('0x3e')]+'%'};return _0x367492;})});}_0x371867=_[_0x698f('0x43')]({},_0x371867,_0x5d42f8[_0x698f('0x44')]);return _0x45e83b['getFields'](_0x371867);}})[_0x698f('0x22')](function(_0x55d4da){if(_0x55d4da){_0x4ee3e4=_0x55d4da[_0x698f('0x37')];if(!_0x5d42f8['query'][_0x698f('0x38')](_0x698f('0x39'))){_0x371867[_0x698f('0x1e')]=qs['limit'](_0x5d42f8[_0x698f('0x32')]['limit']);_0x371867['offset']=qs[_0x698f('0x1c')](_0x5d42f8[_0x698f('0x32')][_0x698f('0x1c')]);}return _0x45e83b[_0x698f('0x4a')](_0x371867);}})[_0x698f('0x22')](function(_0x28471c){if(_0x28471c){return _0x28471c?{'count':_0x4ee3e4,'rows':_0x28471c}:null;}})[_0x698f('0x22')](respondWithResult(_0x3e177a,null))['catch'](handleError(_0x3e177a,null));};exports[_0x698f('0x4d')]=function(_0x20784d,_0x8d73d3,_0x21f71d){var _0x2d5bc5={};var _0x38803d={};var _0xa61895;var _0xf86bd5;return db['ServicenowConfiguration'][_0x698f('0x4b')]({'where':{'id':_0x20784d['params']['id']}})[_0x698f('0x22')](handleEntityNotFound(_0x8d73d3,null))[_0x698f('0x22')](function(_0x2d4390){if(_0x2d4390){_0xa61895=_0x2d4390;_0x38803d[_0x698f('0x2f')]=_[_0x698f('0x31')](db[_0x698f('0x4c')][_0x698f('0x2b')]);_0x38803d[_0x698f('0x32')]=_[_0x698f('0x31')](_0x20784d[_0x698f('0x32')]);_0x38803d[_0x698f('0x33')]=_[_0x698f('0x34')](_0x38803d[_0x698f('0x2f')],_0x38803d[_0x698f('0x32')]);_0x2d5bc5[_0x698f('0x36')]=_['intersection'](_0x38803d[_0x698f('0x2f')],qs['fields'](_0x20784d[_0x698f('0x32')]['fields']));_0x2d5bc5[_0x698f('0x36')]=_0x2d5bc5[_0x698f('0x36')]['length']?_0x2d5bc5[_0x698f('0x36')]:_0x38803d[_0x698f('0x2f')];_0x2d5bc5['order']=qs['sort'](_0x20784d[_0x698f('0x32')][_0x698f('0x3b')]);_0x2d5bc5[_0x698f('0x3c')]=qs['filters'](_[_0x698f('0x3d')](_0x20784d[_0x698f('0x32')],_0x38803d[_0x698f('0x33')]));if(_0x20784d[_0x698f('0x32')][_0x698f('0x3e')]){_0x2d5bc5[_0x698f('0x3c')]=_[_0x698f('0x43')](_0x2d5bc5[_0x698f('0x3c')],{'$or':_[_0x698f('0x30')](_0x2d5bc5[_0x698f('0x36')],function(_0x4afd84){var _0x5edbaf={};_0x5edbaf[_0x4afd84]={'$like':'%'+_0x20784d[_0x698f('0x32')][_0x698f('0x3e')]+'%'};return _0x5edbaf;})});}_0x2d5bc5=_[_0x698f('0x43')]({},_0x2d5bc5,_0x20784d[_0x698f('0x44')]);return _0xa61895[_0x698f('0x4d')](_0x2d5bc5);}})[_0x698f('0x22')](function(_0x38ef03){if(_0x38ef03){_0xf86bd5=_0x38ef03[_0x698f('0x37')];if(!_0x20784d[_0x698f('0x32')][_0x698f('0x38')](_0x698f('0x39'))){_0x2d5bc5[_0x698f('0x1e')]=qs[_0x698f('0x1e')](_0x20784d[_0x698f('0x32')][_0x698f('0x1e')]);_0x2d5bc5[_0x698f('0x1c')]=qs[_0x698f('0x1c')](_0x20784d[_0x698f('0x32')][_0x698f('0x1c')]);}return _0xa61895[_0x698f('0x4d')](_0x2d5bc5);}})[_0x698f('0x22')](function(_0x3f54cd){if(_0x3f54cd){return _0x3f54cd?{'count':_0xf86bd5,'rows':_0x3f54cd}:null;}})['then'](respondWithResult(_0x8d73d3,null))[_0x698f('0x40')](handleError(_0x8d73d3,null));};exports[_0x698f('0x4e')]=function(_0x3bd81b,_0x181f92,_0x5cbde8){var _0x1392b4={};var _0x316068={};var _0x43c50d;var _0x17ed5c;return db[_0x698f('0x2a')][_0x698f('0x4b')]({'where':{'id':_0x3bd81b[_0x698f('0x49')]['id']}})[_0x698f('0x22')](handleEntityNotFound(_0x181f92,null))['then'](function(_0xb2bc29){if(_0xb2bc29){_0x43c50d=_0xb2bc29;_0x316068[_0x698f('0x2f')]=_[_0x698f('0x31')](db[_0x698f('0x4c')]['rawAttributes']);_0x316068['query']=_['keys'](_0x3bd81b[_0x698f('0x32')]);_0x316068['filters']=_['intersection'](_0x316068[_0x698f('0x2f')],_0x316068[_0x698f('0x32')]);_0x1392b4[_0x698f('0x36')]=_['intersection'](_0x316068[_0x698f('0x2f')],qs[_0x698f('0x35')](_0x3bd81b[_0x698f('0x32')][_0x698f('0x35')]));_0x1392b4[_0x698f('0x36')]=_0x1392b4[_0x698f('0x36')]['length']?_0x1392b4['attributes']:_0x316068[_0x698f('0x2f')];_0x1392b4['order']=qs[_0x698f('0x3b')](_0x3bd81b['query'][_0x698f('0x3b')]);_0x1392b4['where']=qs['filters'](_['pick'](_0x3bd81b[_0x698f('0x32')],_0x316068[_0x698f('0x33')]));if(_0x3bd81b[_0x698f('0x32')][_0x698f('0x3e')]){_0x1392b4[_0x698f('0x3c')]=_[_0x698f('0x43')](_0x1392b4[_0x698f('0x3c')],{'$or':_[_0x698f('0x30')](_0x1392b4[_0x698f('0x36')],function(_0x513ce9){var _0x556b84={};_0x556b84[_0x513ce9]={'$like':'%'+_0x3bd81b[_0x698f('0x32')][_0x698f('0x3e')]+'%'};return _0x556b84;})});}_0x1392b4=_[_0x698f('0x43')]({},_0x1392b4,_0x3bd81b['options']);return _0x43c50d[_0x698f('0x4e')](_0x1392b4);}})[_0x698f('0x22')](function(_0x2a7007){if(_0x2a7007){_0x17ed5c=_0x2a7007[_0x698f('0x37')];if(!_0x3bd81b[_0x698f('0x32')][_0x698f('0x38')]('nolimit')){_0x1392b4['limit']=qs[_0x698f('0x1e')](_0x3bd81b[_0x698f('0x32')][_0x698f('0x1e')]);_0x1392b4[_0x698f('0x1c')]=qs[_0x698f('0x1c')](_0x3bd81b['query'][_0x698f('0x1c')]);}return _0x43c50d[_0x698f('0x4e')](_0x1392b4);}})['then'](function(_0x8b8334){if(_0x8b8334){return _0x8b8334?{'count':_0x17ed5c,'rows':_0x8b8334}:null;}})['then'](respondWithResult(_0x181f92,null))[_0x698f('0x40')](handleError(_0x181f92,null));}; \ No newline at end of file +var _0x3d4c=['map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','filter','options','ServicenowConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','findOne','getFields','nolimit','getSubjects','getDescriptions','ServicenowField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send'];(function(_0x2f4de2,_0x32af8a){var _0x4f5b1d=function(_0x2fdf8e){while(--_0x2fdf8e){_0x2f4de2['push'](_0x2f4de2['shift']());}};_0x4f5b1d(++_0x32af8a);}(_0x3d4c,0x7b));var _0xc3d4=function(_0x56e0b8,_0x272c35){_0x56e0b8=_0x56e0b8-0x0;var _0x57829f=_0x3d4c[_0x56e0b8];return _0x57829f;};'use strict';var emlformat=require(_0xc3d4('0x0'));var rimraf=require(_0xc3d4('0x1'));var zipdir=require(_0xc3d4('0x2'));var jsonpatch=require(_0xc3d4('0x3'));var rp=require(_0xc3d4('0x4'));var moment=require(_0xc3d4('0x5'));var BPromise=require(_0xc3d4('0x6'));var Mustache=require(_0xc3d4('0x7'));var util=require(_0xc3d4('0x8'));var path=require(_0xc3d4('0x9'));var sox=require(_0xc3d4('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3d4('0xb'));var squel=require(_0xc3d4('0xc'));var crypto=require(_0xc3d4('0xd'));var jsforce=require(_0xc3d4('0xe'));var deskjs=require(_0xc3d4('0xf'));var toCsv=require(_0xc3d4('0x10'));var querystring=require(_0xc3d4('0x11'));var Papa=require(_0xc3d4('0x12'));var Redis=require(_0xc3d4('0x13'));var authService=require(_0xc3d4('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc3d4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc3d4('0x16'));var utils=require(_0xc3d4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc3d4('0x18'));var db=require(_0xc3d4('0x19'))['db'];function respondWithStatusCode(_0x221651,_0x423f12){_0x423f12=_0x423f12||0xcc;return function(_0x5b9790){if(_0x5b9790){return _0x221651[_0xc3d4('0x1a')](_0x423f12);}return _0x221651[_0xc3d4('0x1b')](_0x423f12)[_0xc3d4('0x1c')]();};}function respondWithResult(_0x1e911e,_0x230224){_0x230224=_0x230224||0xc8;return function(_0x2b1910){if(_0x2b1910){return _0x1e911e[_0xc3d4('0x1b')](_0x230224)[_0xc3d4('0x1d')](_0x2b1910);}};}function respondWithFilteredResult(_0x169c52,_0x4c5fdb){return function(_0x4284c4){if(_0x4284c4){var _0x2cf9f0=typeof _0x4c5fdb['offset']===_0xc3d4('0x1e')&&typeof _0x4c5fdb[_0xc3d4('0x1f')]===_0xc3d4('0x1e');var _0xc7504a=_0x4284c4[_0xc3d4('0x20')];var _0x431f6a=_0x2cf9f0?0x0:_0x4c5fdb[_0xc3d4('0x21')];var _0x11f27f=_0x2cf9f0?_0x4284c4['count']:_0x4c5fdb[_0xc3d4('0x21')]+_0x4c5fdb['limit'];var _0xb004fd;if(_0x11f27f>=_0xc7504a){_0x11f27f=_0xc7504a;_0xb004fd=0xc8;}else{_0xb004fd=0xce;}_0x169c52[_0xc3d4('0x1b')](_0xb004fd);return _0x169c52[_0xc3d4('0x22')](_0xc3d4('0x23'),_0x431f6a+'-'+_0x11f27f+'/'+_0xc7504a)[_0xc3d4('0x1d')](_0x4284c4);}return null;};}function patchUpdates(_0x5979a4){return function(_0x140c60){try{jsonpatch[_0xc3d4('0x24')](_0x140c60,_0x5979a4,!![]);}catch(_0x5f3309){return BPromise[_0xc3d4('0x25')](_0x5f3309);}return _0x140c60[_0xc3d4('0x26')]();};}function saveUpdates(_0x39d901,_0xb335de){return function(_0x3f28dc){if(_0x3f28dc){return _0x3f28dc['update'](_0x39d901)[_0xc3d4('0x27')](function(_0x53f47c){return _0x53f47c;});}return null;};}function removeEntity(_0x24c866,_0x2a7592){return function(_0x4df51a){if(_0x4df51a){return _0x4df51a[_0xc3d4('0x28')]()[_0xc3d4('0x27')](function(){_0x24c866[_0xc3d4('0x1b')](0xcc)[_0xc3d4('0x1c')]();});}};}function handleEntityNotFound(_0x25ca97,_0x57b355){return function(_0x505dc4){if(!_0x505dc4){_0x25ca97[_0xc3d4('0x1a')](0x194);}return _0x505dc4;};}function handleError(_0x2567ca,_0x2c8f37){_0x2c8f37=_0x2c8f37||0x1f4;return function(_0x5b9bf7){logger[_0xc3d4('0x29')](_0x5b9bf7[_0xc3d4('0x2a')]);if(_0x5b9bf7[_0xc3d4('0x2b')]){delete _0x5b9bf7[_0xc3d4('0x2b')];}_0x2567ca[_0xc3d4('0x1b')](_0x2c8f37)[_0xc3d4('0x2c')](_0x5b9bf7);};}exports['index']=function(_0x9c8eb9,_0x2fa50b){var _0xc9cb1f={},_0x439bfd={},_0x554b21={'count':0x0,'rows':[]};var _0x11eb7f=_[_0xc3d4('0x2d')](db['ServicenowConfiguration'][_0xc3d4('0x2e')],function(_0x1f630c){return{'name':_0x1f630c[_0xc3d4('0x2f')],'type':_0x1f630c[_0xc3d4('0x30')][_0xc3d4('0x31')]};});_0x439bfd[_0xc3d4('0x32')]=_[_0xc3d4('0x2d')](_0x11eb7f,_0xc3d4('0x2b'));_0x439bfd[_0xc3d4('0x33')]=_['keys'](_0x9c8eb9[_0xc3d4('0x33')]);_0x439bfd[_0xc3d4('0x34')]=_[_0xc3d4('0x35')](_0x439bfd[_0xc3d4('0x32')],_0x439bfd[_0xc3d4('0x33')]);_0xc9cb1f[_0xc3d4('0x36')]=_[_0xc3d4('0x35')](_0x439bfd[_0xc3d4('0x32')],qs[_0xc3d4('0x37')](_0x9c8eb9[_0xc3d4('0x33')]['fields']));_0xc9cb1f['attributes']=_0xc9cb1f['attributes'][_0xc3d4('0x38')]?_0xc9cb1f[_0xc3d4('0x36')]:_0x439bfd[_0xc3d4('0x32')];if(!_0x9c8eb9[_0xc3d4('0x33')][_0xc3d4('0x39')]('nolimit')){_0xc9cb1f['limit']=qs['limit'](_0x9c8eb9['query'][_0xc3d4('0x1f')]);_0xc9cb1f['offset']=qs['offset'](_0x9c8eb9[_0xc3d4('0x33')][_0xc3d4('0x21')]);}_0xc9cb1f[_0xc3d4('0x3a')]=qs['sort'](_0x9c8eb9['query'][_0xc3d4('0x3b')]);_0xc9cb1f['where']=qs[_0xc3d4('0x34')](_[_0xc3d4('0x3c')](_0x9c8eb9[_0xc3d4('0x33')],_0x439bfd[_0xc3d4('0x34')]),_0x11eb7f);if(_0x9c8eb9[_0xc3d4('0x33')]['filter']){_0xc9cb1f['where']=_[_0xc3d4('0x3d')](_0xc9cb1f[_0xc3d4('0x3e')],{'$or':_[_0xc3d4('0x2d')](_0x11eb7f,function(_0x3065b9){if(_0x3065b9[_0xc3d4('0x30')]!==_0xc3d4('0x3f')){var _0x44b516={};_0x44b516[_0x3065b9['name']]={'$like':'%'+_0x9c8eb9[_0xc3d4('0x33')][_0xc3d4('0x40')]+'%'};return _0x44b516;}})});}_0xc9cb1f=_[_0xc3d4('0x3d')]({},_0xc9cb1f,_0x9c8eb9[_0xc3d4('0x41')]);var _0x4ec704={'where':_0xc9cb1f[_0xc3d4('0x3e')]};return db[_0xc3d4('0x42')][_0xc3d4('0x20')](_0x4ec704)['then'](function(_0x1b7447){_0x554b21['count']=_0x1b7447;if(_0x9c8eb9[_0xc3d4('0x33')][_0xc3d4('0x43')]){_0xc9cb1f[_0xc3d4('0x44')]=[{'all':!![]}];}return db[_0xc3d4('0x42')][_0xc3d4('0x45')](_0xc9cb1f);})['then'](function(_0x3441a0){_0x554b21[_0xc3d4('0x46')]=_0x3441a0;return _0x554b21;})[_0xc3d4('0x27')](respondWithFilteredResult(_0x2fa50b,_0xc9cb1f))[_0xc3d4('0x47')](handleError(_0x2fa50b,null));};exports[_0xc3d4('0x48')]=function(_0x1ee5f6,_0x41816f){var _0x4eb8f0={'raw':![],'where':{'id':_0x1ee5f6[_0xc3d4('0x49')]['id']}},_0x59aeeb={};_0x59aeeb[_0xc3d4('0x32')]=_[_0xc3d4('0x4a')](db[_0xc3d4('0x42')]['rawAttributes']);_0x59aeeb[_0xc3d4('0x33')]=_[_0xc3d4('0x4a')](_0x1ee5f6['query']);_0x59aeeb[_0xc3d4('0x34')]=_[_0xc3d4('0x35')](_0x59aeeb[_0xc3d4('0x32')],_0x59aeeb['query']);_0x4eb8f0[_0xc3d4('0x36')]=_[_0xc3d4('0x35')](_0x59aeeb[_0xc3d4('0x32')],qs[_0xc3d4('0x37')](_0x1ee5f6[_0xc3d4('0x33')][_0xc3d4('0x37')]));_0x4eb8f0[_0xc3d4('0x36')]=_0x4eb8f0[_0xc3d4('0x36')][_0xc3d4('0x38')]?_0x4eb8f0[_0xc3d4('0x36')]:_0x59aeeb['model'];if(_0x1ee5f6['query'][_0xc3d4('0x43')]){_0x4eb8f0[_0xc3d4('0x44')]=[{'all':!![]}];}_0x4eb8f0=_[_0xc3d4('0x3d')]({},_0x4eb8f0,_0x1ee5f6['options']);return db[_0xc3d4('0x42')]['find'](_0x4eb8f0)[_0xc3d4('0x27')](handleEntityNotFound(_0x41816f,null))[_0xc3d4('0x27')](respondWithResult(_0x41816f,null))[_0xc3d4('0x47')](handleError(_0x41816f,null));};exports[_0xc3d4('0x4b')]=function(_0x1ddaf8,_0x353aa5){return db[_0xc3d4('0x42')][_0xc3d4('0x4b')](_0x1ddaf8[_0xc3d4('0x4c')],{})[_0xc3d4('0x27')](respondWithResult(_0x353aa5,0xc9))[_0xc3d4('0x47')](handleError(_0x353aa5,null));};exports['update']=function(_0x52d938,_0x4ab9af){if(_0x52d938['body']['id']){delete _0x52d938[_0xc3d4('0x4c')]['id'];}return db[_0xc3d4('0x42')][_0xc3d4('0x4d')]({'where':{'id':_0x52d938[_0xc3d4('0x49')]['id']}})[_0xc3d4('0x27')](handleEntityNotFound(_0x4ab9af,null))[_0xc3d4('0x27')](saveUpdates(_0x52d938['body'],null))['then'](respondWithResult(_0x4ab9af,null))['catch'](handleError(_0x4ab9af,null));};exports[_0xc3d4('0x28')]=function(_0x32a56d,_0x56f5e3){return db[_0xc3d4('0x42')]['find']({'where':{'id':_0x32a56d[_0xc3d4('0x49')]['id']}})[_0xc3d4('0x27')](handleEntityNotFound(_0x56f5e3,null))[_0xc3d4('0x27')](removeEntity(_0x56f5e3,null))[_0xc3d4('0x47')](handleError(_0x56f5e3,null));};exports['getFields']=function(_0x3f8f20,_0xdc675b,_0x18c543){var _0x578d95={};var _0x7ed01a={};var _0x34e967;var _0x454b6f;return db[_0xc3d4('0x42')][_0xc3d4('0x4e')]({'where':{'id':_0x3f8f20[_0xc3d4('0x49')]['id']}})[_0xc3d4('0x27')](handleEntityNotFound(_0xdc675b,null))[_0xc3d4('0x27')](function(_0x247a39){if(_0x247a39){_0x34e967=_0x247a39;_0x7ed01a[_0xc3d4('0x32')]=_['keys'](db['ServicenowField'][_0xc3d4('0x2e')]);_0x7ed01a[_0xc3d4('0x33')]=_[_0xc3d4('0x4a')](_0x3f8f20[_0xc3d4('0x33')]);_0x7ed01a[_0xc3d4('0x34')]=_[_0xc3d4('0x35')](_0x7ed01a[_0xc3d4('0x32')],_0x7ed01a[_0xc3d4('0x33')]);_0x578d95['attributes']=_[_0xc3d4('0x35')](_0x7ed01a[_0xc3d4('0x32')],qs['fields'](_0x3f8f20[_0xc3d4('0x33')]['fields']));_0x578d95[_0xc3d4('0x36')]=_0x578d95[_0xc3d4('0x36')][_0xc3d4('0x38')]?_0x578d95[_0xc3d4('0x36')]:_0x7ed01a[_0xc3d4('0x32')];_0x578d95[_0xc3d4('0x3a')]=qs[_0xc3d4('0x3b')](_0x3f8f20['query'][_0xc3d4('0x3b')]);_0x578d95[_0xc3d4('0x3e')]=qs[_0xc3d4('0x34')](_['pick'](_0x3f8f20[_0xc3d4('0x33')],_0x7ed01a[_0xc3d4('0x34')]));if(_0x3f8f20[_0xc3d4('0x33')]['filter']){_0x578d95[_0xc3d4('0x3e')]=_[_0xc3d4('0x3d')](_0x578d95[_0xc3d4('0x3e')],{'$or':_['map'](_0x578d95[_0xc3d4('0x36')],function(_0x59ecad){var _0x51ef09={};_0x51ef09[_0x59ecad]={'$like':'%'+_0x3f8f20[_0xc3d4('0x33')]['filter']+'%'};return _0x51ef09;})});}_0x578d95=_[_0xc3d4('0x3d')]({},_0x578d95,_0x3f8f20[_0xc3d4('0x41')]);return _0x34e967[_0xc3d4('0x4f')](_0x578d95);}})['then'](function(_0x4a9de5){if(_0x4a9de5){_0x454b6f=_0x4a9de5[_0xc3d4('0x38')];if(!_0x3f8f20['query'][_0xc3d4('0x39')](_0xc3d4('0x50'))){_0x578d95['limit']=qs[_0xc3d4('0x1f')](_0x3f8f20[_0xc3d4('0x33')][_0xc3d4('0x1f')]);_0x578d95[_0xc3d4('0x21')]=qs[_0xc3d4('0x21')](_0x3f8f20[_0xc3d4('0x33')]['offset']);}return _0x34e967[_0xc3d4('0x4f')](_0x578d95);}})['then'](function(_0xb0c746){if(_0xb0c746){return _0xb0c746?{'count':_0x454b6f,'rows':_0xb0c746}:null;}})[_0xc3d4('0x27')](respondWithResult(_0xdc675b,null))[_0xc3d4('0x47')](handleError(_0xdc675b,null));};exports[_0xc3d4('0x51')]=function(_0x17e783,_0x5b6a17,_0x25f980){var _0x4d944e={};var _0x364302={};var _0x578c8d;var _0x39f467;return db[_0xc3d4('0x42')][_0xc3d4('0x4e')]({'where':{'id':_0x17e783[_0xc3d4('0x49')]['id']}})[_0xc3d4('0x27')](handleEntityNotFound(_0x5b6a17,null))[_0xc3d4('0x27')](function(_0x49cd89){if(_0x49cd89){_0x578c8d=_0x49cd89;_0x364302[_0xc3d4('0x32')]=_[_0xc3d4('0x4a')](db['ServicenowField'][_0xc3d4('0x2e')]);_0x364302['query']=_[_0xc3d4('0x4a')](_0x17e783[_0xc3d4('0x33')]);_0x364302[_0xc3d4('0x34')]=_[_0xc3d4('0x35')](_0x364302[_0xc3d4('0x32')],_0x364302['query']);_0x4d944e['attributes']=_[_0xc3d4('0x35')](_0x364302[_0xc3d4('0x32')],qs[_0xc3d4('0x37')](_0x17e783[_0xc3d4('0x33')][_0xc3d4('0x37')]));_0x4d944e[_0xc3d4('0x36')]=_0x4d944e[_0xc3d4('0x36')]['length']?_0x4d944e[_0xc3d4('0x36')]:_0x364302[_0xc3d4('0x32')];_0x4d944e[_0xc3d4('0x3a')]=qs[_0xc3d4('0x3b')](_0x17e783[_0xc3d4('0x33')]['sort']);_0x4d944e['where']=qs[_0xc3d4('0x34')](_[_0xc3d4('0x3c')](_0x17e783[_0xc3d4('0x33')],_0x364302['filters']));if(_0x17e783[_0xc3d4('0x33')][_0xc3d4('0x40')]){_0x4d944e['where']=_[_0xc3d4('0x3d')](_0x4d944e['where'],{'$or':_[_0xc3d4('0x2d')](_0x4d944e[_0xc3d4('0x36')],function(_0x505e58){var _0x474713={};_0x474713[_0x505e58]={'$like':'%'+_0x17e783[_0xc3d4('0x33')][_0xc3d4('0x40')]+'%'};return _0x474713;})});}_0x4d944e=_[_0xc3d4('0x3d')]({},_0x4d944e,_0x17e783[_0xc3d4('0x41')]);return _0x578c8d[_0xc3d4('0x51')](_0x4d944e);}})[_0xc3d4('0x27')](function(_0x56cbe1){if(_0x56cbe1){_0x39f467=_0x56cbe1[_0xc3d4('0x38')];if(!_0x17e783[_0xc3d4('0x33')][_0xc3d4('0x39')]('nolimit')){_0x4d944e['limit']=qs[_0xc3d4('0x1f')](_0x17e783[_0xc3d4('0x33')]['limit']);_0x4d944e['offset']=qs[_0xc3d4('0x21')](_0x17e783[_0xc3d4('0x33')][_0xc3d4('0x21')]);}return _0x578c8d['getSubjects'](_0x4d944e);}})[_0xc3d4('0x27')](function(_0x391395){if(_0x391395){return _0x391395?{'count':_0x39f467,'rows':_0x391395}:null;}})[_0xc3d4('0x27')](respondWithResult(_0x5b6a17,null))[_0xc3d4('0x47')](handleError(_0x5b6a17,null));};exports[_0xc3d4('0x52')]=function(_0x1ea858,_0x378dd7,_0x15895f){var _0x9ea371={};var _0x1c04dc={};var _0x1753db;var _0x53fec0;return db[_0xc3d4('0x42')][_0xc3d4('0x4e')]({'where':{'id':_0x1ea858[_0xc3d4('0x49')]['id']}})['then'](handleEntityNotFound(_0x378dd7,null))[_0xc3d4('0x27')](function(_0x3e6e47){if(_0x3e6e47){_0x1753db=_0x3e6e47;_0x1c04dc[_0xc3d4('0x32')]=_[_0xc3d4('0x4a')](db[_0xc3d4('0x53')][_0xc3d4('0x2e')]);_0x1c04dc['query']=_[_0xc3d4('0x4a')](_0x1ea858[_0xc3d4('0x33')]);_0x1c04dc[_0xc3d4('0x34')]=_[_0xc3d4('0x35')](_0x1c04dc[_0xc3d4('0x32')],_0x1c04dc['query']);_0x9ea371['attributes']=_[_0xc3d4('0x35')](_0x1c04dc['model'],qs[_0xc3d4('0x37')](_0x1ea858[_0xc3d4('0x33')][_0xc3d4('0x37')]));_0x9ea371[_0xc3d4('0x36')]=_0x9ea371[_0xc3d4('0x36')][_0xc3d4('0x38')]?_0x9ea371[_0xc3d4('0x36')]:_0x1c04dc[_0xc3d4('0x32')];_0x9ea371[_0xc3d4('0x3a')]=qs[_0xc3d4('0x3b')](_0x1ea858[_0xc3d4('0x33')][_0xc3d4('0x3b')]);_0x9ea371[_0xc3d4('0x3e')]=qs[_0xc3d4('0x34')](_[_0xc3d4('0x3c')](_0x1ea858[_0xc3d4('0x33')],_0x1c04dc[_0xc3d4('0x34')]));if(_0x1ea858[_0xc3d4('0x33')]['filter']){_0x9ea371[_0xc3d4('0x3e')]=_['merge'](_0x9ea371[_0xc3d4('0x3e')],{'$or':_[_0xc3d4('0x2d')](_0x9ea371[_0xc3d4('0x36')],function(_0x5ddf32){var _0x293ed5={};_0x293ed5[_0x5ddf32]={'$like':'%'+_0x1ea858[_0xc3d4('0x33')][_0xc3d4('0x40')]+'%'};return _0x293ed5;})});}_0x9ea371=_[_0xc3d4('0x3d')]({},_0x9ea371,_0x1ea858[_0xc3d4('0x41')]);return _0x1753db[_0xc3d4('0x52')](_0x9ea371);}})[_0xc3d4('0x27')](function(_0x4f6591){if(_0x4f6591){_0x53fec0=_0x4f6591[_0xc3d4('0x38')];if(!_0x1ea858[_0xc3d4('0x33')]['hasOwnProperty'](_0xc3d4('0x50'))){_0x9ea371['limit']=qs['limit'](_0x1ea858[_0xc3d4('0x33')]['limit']);_0x9ea371['offset']=qs[_0xc3d4('0x21')](_0x1ea858[_0xc3d4('0x33')][_0xc3d4('0x21')]);}return _0x1753db[_0xc3d4('0x52')](_0x9ea371);}})['then'](function(_0x415b8b){if(_0x415b8b){return _0x415b8b?{'count':_0x53fec0,'rows':_0x415b8b}:null;}})[_0xc3d4('0x27')](respondWithResult(_0x378dd7,null))[_0xc3d4('0x47')](handleError(_0x378dd7,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 0707c1c..12d736b 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 _0x988c=['bluebird','request-promise','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash','moment'];(function(_0x5c066a,_0xf8dc01){var _0x3ff772=function(_0x16830a){while(--_0x16830a){_0x5c066a['push'](_0x5c066a['shift']());}};_0x3ff772(++_0xf8dc01);}(_0x988c,0x19e));var _0xc988=function(_0x2f7df7,_0x2ae478){_0x2f7df7=_0x2f7df7-0x0;var _0x42bd5e=_0x988c[_0x2f7df7];return _0x42bd5e;};'use strict';var _=require(_0xc988('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc988('0x1'));var BPromise=require(_0xc988('0x2'));var rp=require(_0xc988('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc988('0x4'));module[_0xc988('0x5')]=function(_0x17fa32,_0x56317c){return _0x17fa32[_0xc988('0x6')](_0xc988('0x7'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3495=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','lodash','util'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x3495,0x1de));var _0x5349=function(_0x105bde,_0xb333d2){_0x105bde=_0x105bde-0x0;var _0x24dcab=_0x3495[_0x105bde];return _0x24dcab;};'use strict';var _=require(_0x5349('0x0'));var util=require(_0x5349('0x1'));var logger=require(_0x5349('0x2'))(_0x5349('0x3'));var moment=require(_0x5349('0x4'));var BPromise=require(_0x5349('0x5'));var rp=require(_0x5349('0x6'));var fs=require('fs');var path=require(_0x5349('0x7'));var rimraf=require(_0x5349('0x8'));var config=require('../../config/environment');var attributes=require(_0x5349('0x9'));module[_0x5349('0xa')]=function(_0x5ce2cd,_0xcb5a1){return _0x5ce2cd['define'](_0x5349('0xb'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 459eeda..5349a1b 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 _0x20de=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','moment','bluebird','randomstring'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x20de,0x134));var _0xe20d=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x20de[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0xe20d('0x0'));var util=require('util');var moment=require(_0xe20d('0x1'));var BPromise=require(_0xe20d('0x2'));var rs=require(_0xe20d('0x3'));var fs=require('fs');var Redis=require(_0xe20d('0x4'));var db=require(_0xe20d('0x5'))['db'];var utils=require(_0xe20d('0x6'));var logger=require(_0xe20d('0x7'))(_0xe20d('0x8'));var config=require(_0xe20d('0x9'));var jayson=require(_0xe20d('0xa'));var client=jayson[_0xe20d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x374faa,_0x5a5ac2,_0x4e1fb9){return new BPromise(function(_0x4909c9,_0x110ff5){return client[_0xe20d('0xc')](_0x374faa,_0x4e1fb9)[_0xe20d('0xd')](function(_0x50f487){logger[_0xe20d('0xe')](_0xe20d('0xf'),_0x5a5ac2,'request\x20sent');logger[_0xe20d('0x10')](_0xe20d('0x11'),_0x5a5ac2,'request\x20sent',JSON[_0xe20d('0x12')](_0x50f487));if(_0x50f487[_0xe20d('0x13')]){if(_0x50f487[_0xe20d('0x13')][_0xe20d('0x14')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x5a5ac2,_0x50f487[_0xe20d('0x13')][_0xe20d('0x15')]);return _0x110ff5(_0x50f487[_0xe20d('0x13')][_0xe20d('0x15')]);}logger[_0xe20d('0x13')](_0xe20d('0xf'),_0x5a5ac2,_0x50f487[_0xe20d('0x13')][_0xe20d('0x15')]);return _0x4909c9(_0x50f487[_0xe20d('0x13')]['message']);}else{logger[_0xe20d('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5a5ac2,_0xe20d('0x16'));_0x4909c9(_0x50f487[_0xe20d('0x17')][_0xe20d('0x15')]);}})['catch'](function(_0x1d6179){logger['error'](_0xe20d('0xf'),_0x5a5ac2,_0x1d6179);_0x110ff5(_0x1d6179);});});} \ No newline at end of file +var _0x1979=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird'];(function(_0x6993ba,_0x512ba2){var _0x1620db=function(_0x2bce35){while(--_0x2bce35){_0x6993ba['push'](_0x6993ba['shift']());}};_0x1620db(++_0x512ba2);}(_0x1979,0x156));var _0x9197=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x1979[_0x1e2321];return _0x1d346d;};'use strict';var _=require('lodash');var util=require(_0x9197('0x0'));var moment=require(_0x9197('0x1'));var BPromise=require(_0x9197('0x2'));var rs=require(_0x9197('0x3'));var fs=require('fs');var Redis=require(_0x9197('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9197('0x5'));var logger=require(_0x9197('0x6'))(_0x9197('0x7'));var config=require(_0x9197('0x8'));var jayson=require(_0x9197('0x9'));var client=jayson[_0x9197('0xa')][_0x9197('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22cccc,_0x2e6c8a,_0x586f1c){return new BPromise(function(_0xad1f77,_0x4bfa01){return client['request'](_0x22cccc,_0x586f1c)[_0x9197('0xc')](function(_0x5ae159){logger[_0x9197('0xd')](_0x9197('0xe'),_0x2e6c8a,_0x9197('0xf'));logger[_0x9197('0x10')](_0x9197('0x11'),_0x2e6c8a,_0x9197('0xf'),JSON[_0x9197('0x12')](_0x5ae159));if(_0x5ae159[_0x9197('0x13')]){if(_0x5ae159[_0x9197('0x13')][_0x9197('0x14')]===0x1f4){logger[_0x9197('0x13')](_0x9197('0xe'),_0x2e6c8a,_0x5ae159[_0x9197('0x13')][_0x9197('0x15')]);return _0x4bfa01(_0x5ae159[_0x9197('0x13')]['message']);}logger[_0x9197('0x13')](_0x9197('0xe'),_0x2e6c8a,_0x5ae159['error']['message']);return _0xad1f77(_0x5ae159[_0x9197('0x13')][_0x9197('0x15')]);}else{logger[_0x9197('0xd')](_0x9197('0xe'),_0x2e6c8a,_0x9197('0xf'));_0xad1f77(_0x5ae159['result'][_0x9197('0x15')]);}})[_0x9197('0x16')](function(_0x5b5700){logger['error'](_0x9197('0xe'),_0x2e6c8a,_0x5b5700);_0x4bfa01(_0x5b5700);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 2e8453d..3905d98 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 _0x8da4=['../../config/environment','get','isAuthenticated','show','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x38a4c1,_0x394c1f){var _0x801dc9=function(_0x514951){while(--_0x514951){_0x38a4c1['push'](_0x38a4c1['shift']());}};_0x801dc9(++_0x394c1f);}(_0x8da4,0xe7));var _0x48da=function(_0x476ab6,_0x3d38c7){_0x476ab6=_0x476ab6-0x0;var _0x4da910=_0x8da4[_0x476ab6];return _0x4da910;};'use strict';var multer=require(_0x48da('0x0'));var util=require(_0x48da('0x1'));var path=require(_0x48da('0x2'));var timeout=require(_0x48da('0x3'));var express=require(_0x48da('0x4'));var router=express[_0x48da('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x48da('0x6'));var config=require(_0x48da('0x7'));var controller=require('./intServicenowField.controller');router[_0x48da('0x8')]('/',auth[_0x48da('0x9')](),controller['index']);router[_0x48da('0x8')]('/:id',auth[_0x48da('0x9')](),controller[_0x48da('0xa')]);router['post']('/',auth[_0x48da('0x9')](),controller[_0x48da('0xb')]);router[_0x48da('0xc')](_0x48da('0xd'),auth[_0x48da('0x9')](),controller[_0x48da('0xe')]);router[_0x48da('0xf')](_0x48da('0xd'),auth['isAuthenticated'](),controller[_0x48da('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0fc5=['update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x170eb7,_0x1ac59b){var _0x4dfeac=function(_0x350592){while(--_0x350592){_0x170eb7['push'](_0x170eb7['shift']());}};_0x4dfeac(++_0x1ac59b);}(_0x0fc5,0xa3));var _0x50fc=function(_0x3a3a59,_0x1fe0be){_0x3a3a59=_0x3a3a59-0x0;var _0x44c14b=_0x0fc5[_0x3a3a59];return _0x44c14b;};'use strict';var multer=require(_0x50fc('0x0'));var util=require(_0x50fc('0x1'));var path=require('path');var timeout=require(_0x50fc('0x2'));var express=require('express');var router=express[_0x50fc('0x3')]();var fs_extra=require(_0x50fc('0x4'));var auth=require(_0x50fc('0x5'));var interaction=require(_0x50fc('0x6'));var config=require(_0x50fc('0x7'));var controller=require(_0x50fc('0x8'));router[_0x50fc('0x9')]('/',auth[_0x50fc('0xa')](),controller[_0x50fc('0xb')]);router[_0x50fc('0x9')](_0x50fc('0xc'),auth['isAuthenticated'](),controller[_0x50fc('0xd')]);router[_0x50fc('0xe')]('/',auth[_0x50fc('0xa')](),controller[_0x50fc('0xf')]);router[_0x50fc('0x10')](_0x50fc('0xc'),auth[_0x50fc('0xa')](),controller[_0x50fc('0x11')]);router[_0x50fc('0x12')](_0x50fc('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x50fc('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 4187253..14011b6 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 _0xc048=['keyValue','STRING','BOOLEAN','sequelize','ENUM','variable','customVariable'];(function(_0xa1c850,_0x2faaa8){var _0x1e45d4=function(_0x5b247b){while(--_0x5b247b){_0xa1c850['push'](_0xa1c850['shift']());}};_0x1e45d4(++_0x2faaa8);}(_0xc048,0x18b));var _0x8c04=function(_0x4265dd,_0x4603db){_0x4265dd=_0x4265dd-0x0;var _0x2724bc=_0xc048[_0x4265dd];return _0x2724bc;};'use strict';var Sequelize=require(_0x8c04('0x0'));module['exports']={'type':{'type':Sequelize[_0x8c04('0x1')]('string',_0x8c04('0x2'),_0x8c04('0x3'),_0x8c04('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x8c04('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8c04('0x1')]('string',_0x8c04('0x2'),_0x8c04('0x3'))},'keyContent':{'type':Sequelize[_0x8c04('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8c04('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x980b=['variable','customVariable','picklist','STRING','ENUM','string','BOOLEAN','sequelize','exports'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x980b,0x7c));var _0xb980=function(_0x524116,_0x7e4370){_0x524116=_0x524116-0x0;var _0x1b015a=_0x980b[_0x524116];return _0x1b015a;};'use strict';var Sequelize=require(_0xb980('0x0'));module[_0xb980('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xb980('0x2'),_0xb980('0x3'),'keyValue',_0xb980('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb980('0x5')]},'key':{'type':Sequelize[_0xb980('0x5')]},'keyType':{'type':Sequelize[_0xb980('0x6')](_0xb980('0x7'),_0xb980('0x2'),_0xb980('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb980('0x5')]},'nameField':{'type':Sequelize[_0xb980('0x5')]},'customField':{'type':Sequelize[_0xb980('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 0517e96..4a9dd84 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 _0xd507=['intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','include','find','body','params','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','index','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x487212,_0x34d5a8){var _0x4bbeac=function(_0x357c5b){while(--_0x357c5b){_0x487212['push'](_0x487212['shift']());}};_0x4bbeac(++_0x34d5a8);}(_0xd507,0xec));var _0x7d50=function(_0x49c66d,_0x39f4d4){_0x49c66d=_0x49c66d-0x0;var _0x2288b6=_0xd507[_0x49c66d];return _0x2288b6;};'use strict';var emlformat=require(_0x7d50('0x0'));var rimraf=require(_0x7d50('0x1'));var zipdir=require(_0x7d50('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7d50('0x3'));var moment=require(_0x7d50('0x4'));var BPromise=require(_0x7d50('0x5'));var Mustache=require(_0x7d50('0x6'));var util=require(_0x7d50('0x7'));var path=require(_0x7d50('0x8'));var sox=require(_0x7d50('0x9'));var csv=require(_0x7d50('0xa'));var ejs=require(_0x7d50('0xb'));var fs=require('fs');var fs_extra=require(_0x7d50('0xc'));var _=require(_0x7d50('0xd'));var squel=require(_0x7d50('0xe'));var crypto=require(_0x7d50('0xf'));var jsforce=require(_0x7d50('0x10'));var deskjs=require(_0x7d50('0x11'));var toCsv=require(_0x7d50('0xa'));var querystring=require(_0x7d50('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7d50('0x13'));var qs=require(_0x7d50('0x14'));var as=require(_0x7d50('0x15'));var hardwareService=require(_0x7d50('0x16'));var logger=require(_0x7d50('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x7d50('0x18'));var licenseUtil=require(_0x7d50('0x19'));var db=require(_0x7d50('0x1a'))['db'];function respondWithStatusCode(_0x220d00,_0x5783f6){_0x5783f6=_0x5783f6||0xcc;return function(_0x5da6f6){if(_0x5da6f6){return _0x220d00[_0x7d50('0x1b')](_0x5783f6);}return _0x220d00[_0x7d50('0x1c')](_0x5783f6)['end']();};}function respondWithResult(_0x52c083,_0x33117d){_0x33117d=_0x33117d||0xc8;return function(_0x1dfbc1){if(_0x1dfbc1){return _0x52c083[_0x7d50('0x1c')](_0x33117d)[_0x7d50('0x1d')](_0x1dfbc1);}};}function respondWithFilteredResult(_0x4d62d4,_0x50618f){return function(_0x22eccb){if(_0x22eccb){var _0x29cf7c=typeof _0x50618f[_0x7d50('0x1e')]===_0x7d50('0x1f')&&typeof _0x50618f[_0x7d50('0x20')]===_0x7d50('0x1f');var _0x418983=_0x22eccb[_0x7d50('0x21')];var _0x3e8a79=_0x29cf7c?0x0:_0x50618f[_0x7d50('0x1e')];var _0x3f860c=_0x29cf7c?_0x22eccb[_0x7d50('0x21')]:_0x50618f['offset']+_0x50618f[_0x7d50('0x20')];var _0x282e10;if(_0x3f860c>=_0x418983){_0x3f860c=_0x418983;_0x282e10=0xc8;}else{_0x282e10=0xce;}_0x4d62d4[_0x7d50('0x1c')](_0x282e10);return _0x4d62d4[_0x7d50('0x22')]('Content-Range',_0x3e8a79+'-'+_0x3f860c+'/'+_0x418983)[_0x7d50('0x1d')](_0x22eccb);}return null;};}function patchUpdates(_0x28b6b4){return function(_0x54eb66){try{jsonpatch[_0x7d50('0x23')](_0x54eb66,_0x28b6b4,!![]);}catch(_0x1e32c2){return BPromise['reject'](_0x1e32c2);}return _0x54eb66[_0x7d50('0x24')]();};}function saveUpdates(_0x2ac570,_0x1b69d9){return function(_0x52c6b8){if(_0x52c6b8){return _0x52c6b8[_0x7d50('0x25')](_0x2ac570)[_0x7d50('0x26')](function(_0x62e1d6){return _0x62e1d6;});}return null;};}function removeEntity(_0x803c54,_0x6299a){return function(_0x2956ce){if(_0x2956ce){return _0x2956ce['destroy']()[_0x7d50('0x26')](function(){_0x803c54[_0x7d50('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x516609,_0x3a29a8){return function(_0x1d4b64){if(!_0x1d4b64){_0x516609['sendStatus'](0x194);}return _0x1d4b64;};}function handleError(_0x116c59,_0x54b412){_0x54b412=_0x54b412||0x1f4;return function(_0x134219){logger[_0x7d50('0x27')](_0x134219[_0x7d50('0x28')]);if(_0x134219[_0x7d50('0x29')]){delete _0x134219[_0x7d50('0x29')];}_0x116c59[_0x7d50('0x1c')](_0x54b412)['send'](_0x134219);};}exports[_0x7d50('0x2a')]=function(_0x2e0b6f,_0x26d3c4){var _0x41de14={},_0x30b20e={},_0x2ca641={'count':0x0,'rows':[]};var _0x3b3a08=_['map'](db[_0x7d50('0x2b')][_0x7d50('0x2c')],function(_0x528a65){return{'name':_0x528a65[_0x7d50('0x2d')],'type':_0x528a65[_0x7d50('0x2e')][_0x7d50('0x2f')]};});_0x30b20e[_0x7d50('0x30')]=_['map'](_0x3b3a08,_0x7d50('0x29'));_0x30b20e[_0x7d50('0x31')]=_[_0x7d50('0x32')](_0x2e0b6f[_0x7d50('0x31')]);_0x30b20e[_0x7d50('0x33')]=_[_0x7d50('0x34')](_0x30b20e[_0x7d50('0x30')],_0x30b20e[_0x7d50('0x31')]);_0x41de14[_0x7d50('0x35')]=_['intersection'](_0x30b20e['model'],qs[_0x7d50('0x36')](_0x2e0b6f[_0x7d50('0x31')][_0x7d50('0x36')]));_0x41de14[_0x7d50('0x35')]=_0x41de14[_0x7d50('0x35')][_0x7d50('0x37')]?_0x41de14[_0x7d50('0x35')]:_0x30b20e['model'];if(!_0x2e0b6f[_0x7d50('0x31')]['hasOwnProperty'](_0x7d50('0x38'))){_0x41de14[_0x7d50('0x20')]=qs[_0x7d50('0x20')](_0x2e0b6f[_0x7d50('0x31')][_0x7d50('0x20')]);_0x41de14[_0x7d50('0x1e')]=qs[_0x7d50('0x1e')](_0x2e0b6f[_0x7d50('0x31')][_0x7d50('0x1e')]);}_0x41de14[_0x7d50('0x39')]=qs['sort'](_0x2e0b6f['query'][_0x7d50('0x3a')]);_0x41de14[_0x7d50('0x3b')]=qs[_0x7d50('0x33')](_[_0x7d50('0x3c')](_0x2e0b6f['query'],_0x30b20e[_0x7d50('0x33')]),_0x3b3a08);if(_0x2e0b6f[_0x7d50('0x31')][_0x7d50('0x3d')]){_0x41de14[_0x7d50('0x3b')]=_[_0x7d50('0x3e')](_0x41de14[_0x7d50('0x3b')],{'$or':_['map'](_0x3b3a08,function(_0x487ae8){if(_0x487ae8[_0x7d50('0x2e')]!=='VIRTUAL'){var _0x2a0f06={};_0x2a0f06[_0x487ae8[_0x7d50('0x29')]]={'$like':'%'+_0x2e0b6f['query']['filter']+'%'};return _0x2a0f06;}})});}_0x41de14=_['merge']({},_0x41de14,_0x2e0b6f[_0x7d50('0x3f')]);var _0x57ec4e={'where':_0x41de14[_0x7d50('0x3b')]};return db[_0x7d50('0x2b')][_0x7d50('0x21')](_0x57ec4e)['then'](function(_0x35f7d3){_0x2ca641[_0x7d50('0x21')]=_0x35f7d3;if(_0x2e0b6f[_0x7d50('0x31')][_0x7d50('0x40')]){_0x41de14['include']=[{'all':!![]}];}return db['ServicenowField'][_0x7d50('0x41')](_0x41de14);})['then'](function(_0x5ad69b){_0x2ca641['rows']=_0x5ad69b;return _0x2ca641;})[_0x7d50('0x26')](respondWithFilteredResult(_0x26d3c4,_0x41de14))[_0x7d50('0x42')](handleError(_0x26d3c4,null));};exports['show']=function(_0x574c8b,_0x4ebfc5){var _0x2955d2={'raw':!![],'where':{'id':_0x574c8b['params']['id']}},_0x4d731f={};_0x4d731f[_0x7d50('0x30')]=_[_0x7d50('0x32')](db[_0x7d50('0x2b')][_0x7d50('0x2c')]);_0x4d731f[_0x7d50('0x31')]=_[_0x7d50('0x32')](_0x574c8b['query']);_0x4d731f['filters']=_[_0x7d50('0x34')](_0x4d731f[_0x7d50('0x30')],_0x4d731f[_0x7d50('0x31')]);_0x2955d2[_0x7d50('0x35')]=_[_0x7d50('0x34')](_0x4d731f['model'],qs[_0x7d50('0x36')](_0x574c8b[_0x7d50('0x31')][_0x7d50('0x36')]));_0x2955d2[_0x7d50('0x35')]=_0x2955d2[_0x7d50('0x35')]['length']?_0x2955d2[_0x7d50('0x35')]:_0x4d731f[_0x7d50('0x30')];if(_0x574c8b[_0x7d50('0x31')][_0x7d50('0x40')]){_0x2955d2[_0x7d50('0x43')]=[{'all':!![]}];}_0x2955d2=_['merge']({},_0x2955d2,_0x574c8b[_0x7d50('0x3f')]);return db[_0x7d50('0x2b')][_0x7d50('0x44')](_0x2955d2)[_0x7d50('0x26')](handleEntityNotFound(_0x4ebfc5,null))['then'](respondWithResult(_0x4ebfc5,null))['catch'](handleError(_0x4ebfc5,null));};exports['create']=function(_0x207d90,_0x47d544){return db[_0x7d50('0x2b')]['create'](_0x207d90[_0x7d50('0x45')],{})[_0x7d50('0x26')](respondWithResult(_0x47d544,0xc9))[_0x7d50('0x42')](handleError(_0x47d544,null));};exports['update']=function(_0x116965,_0x2c368f){if(_0x116965[_0x7d50('0x45')]['id']){delete _0x116965[_0x7d50('0x45')]['id'];}return db['ServicenowField'][_0x7d50('0x44')]({'where':{'id':_0x116965[_0x7d50('0x46')]['id']}})['then'](handleEntityNotFound(_0x2c368f,null))[_0x7d50('0x26')](saveUpdates(_0x116965[_0x7d50('0x45')],null))[_0x7d50('0x26')](respondWithResult(_0x2c368f,null))[_0x7d50('0x42')](handleError(_0x2c368f,null));};exports[_0x7d50('0x47')]=function(_0x2d0d4e,_0xaebede){return db[_0x7d50('0x2b')][_0x7d50('0x44')]({'where':{'id':_0x2d0d4e[_0x7d50('0x46')]['id']}})['then'](handleEntityNotFound(_0xaebede,null))[_0x7d50('0x26')](removeEntity(_0xaebede,null))['catch'](handleError(_0xaebede,null));}; \ No newline at end of file +var _0x27b0=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','destroy','error','stack','name','send','index','ServicenowField','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','catch','rawAttributes','includeAll','include','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x379728,_0x551ed1){var _0x27a313=function(_0x315fba){while(--_0x315fba){_0x379728['push'](_0x379728['shift']());}};_0x27a313(++_0x551ed1);}(_0x27b0,0x1dd));var _0x027b=function(_0x52a749,_0xac2142){_0x52a749=_0x52a749-0x0;var _0x5326f7=_0x27b0[_0x52a749];return _0x5326f7;};'use strict';var emlformat=require(_0x027b('0x0'));var rimraf=require(_0x027b('0x1'));var zipdir=require(_0x027b('0x2'));var jsonpatch=require(_0x027b('0x3'));var rp=require(_0x027b('0x4'));var moment=require(_0x027b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x027b('0x6'));var util=require(_0x027b('0x7'));var path=require(_0x027b('0x8'));var sox=require('sox');var csv=require(_0x027b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x027b('0xa'));var _=require(_0x027b('0xb'));var squel=require(_0x027b('0xc'));var crypto=require(_0x027b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x027b('0xe'));var toCsv=require(_0x027b('0x9'));var querystring=require(_0x027b('0xf'));var Papa=require(_0x027b('0x10'));var Redis=require(_0x027b('0x11'));var authService=require(_0x027b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x027b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x027b('0x14'))('api');var utils=require(_0x027b('0x15'));var config=require(_0x027b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x027b('0x17'))['db'];function respondWithStatusCode(_0x37bd3a,_0x29969c){_0x29969c=_0x29969c||0xcc;return function(_0x7c2774){if(_0x7c2774){return _0x37bd3a[_0x027b('0x18')](_0x29969c);}return _0x37bd3a[_0x027b('0x19')](_0x29969c)[_0x027b('0x1a')]();};}function respondWithResult(_0x549607,_0x2224b4){_0x2224b4=_0x2224b4||0xc8;return function(_0x2dffc2){if(_0x2dffc2){return _0x549607[_0x027b('0x19')](_0x2224b4)[_0x027b('0x1b')](_0x2dffc2);}};}function respondWithFilteredResult(_0x54a8b8,_0x6b5be2){return function(_0x42f549){if(_0x42f549){var _0x572ce3=typeof _0x6b5be2[_0x027b('0x1c')]===_0x027b('0x1d')&&typeof _0x6b5be2[_0x027b('0x1e')]===_0x027b('0x1d');var _0x32616d=_0x42f549[_0x027b('0x1f')];var _0x48b021=_0x572ce3?0x0:_0x6b5be2[_0x027b('0x1c')];var _0x2b1e72=_0x572ce3?_0x42f549[_0x027b('0x1f')]:_0x6b5be2['offset']+_0x6b5be2[_0x027b('0x1e')];var _0x46ee35;if(_0x2b1e72>=_0x32616d){_0x2b1e72=_0x32616d;_0x46ee35=0xc8;}else{_0x46ee35=0xce;}_0x54a8b8[_0x027b('0x19')](_0x46ee35);return _0x54a8b8['set'](_0x027b('0x20'),_0x48b021+'-'+_0x2b1e72+'/'+_0x32616d)[_0x027b('0x1b')](_0x42f549);}return null;};}function patchUpdates(_0x4ac538){return function(_0x13073d){try{jsonpatch['apply'](_0x13073d,_0x4ac538,!![]);}catch(_0x2dfea2){return BPromise['reject'](_0x2dfea2);}return _0x13073d['save']();};}function saveUpdates(_0x258695,_0x5c2613){return function(_0xb173c8){if(_0xb173c8){return _0xb173c8['update'](_0x258695)[_0x027b('0x21')](function(_0xc00854){return _0xc00854;});}return null;};}function removeEntity(_0x3c01df,_0x43e9d5){return function(_0x3e7884){if(_0x3e7884){return _0x3e7884[_0x027b('0x22')]()[_0x027b('0x21')](function(){_0x3c01df[_0x027b('0x19')](0xcc)[_0x027b('0x1a')]();});}};}function handleEntityNotFound(_0x10b89f,_0x5597dd){return function(_0x15920c){if(!_0x15920c){_0x10b89f['sendStatus'](0x194);}return _0x15920c;};}function handleError(_0xdc8a84,_0x27405e){_0x27405e=_0x27405e||0x1f4;return function(_0x58dc34){logger[_0x027b('0x23')](_0x58dc34[_0x027b('0x24')]);if(_0x58dc34[_0x027b('0x25')]){delete _0x58dc34['name'];}_0xdc8a84['status'](_0x27405e)[_0x027b('0x26')](_0x58dc34);};}exports[_0x027b('0x27')]=function(_0x29226e,_0x37b52e){var _0x5322d3={},_0x1127a7={},_0x63ab18={'count':0x0,'rows':[]};var _0x8688f5=_['map'](db[_0x027b('0x28')]['rawAttributes'],function(_0x47014b){return{'name':_0x47014b[_0x027b('0x29')],'type':_0x47014b[_0x027b('0x2a')][_0x027b('0x2b')]};});_0x1127a7[_0x027b('0x2c')]=_[_0x027b('0x2d')](_0x8688f5,'name');_0x1127a7['query']=_[_0x027b('0x2e')](_0x29226e[_0x027b('0x2f')]);_0x1127a7[_0x027b('0x30')]=_[_0x027b('0x31')](_0x1127a7[_0x027b('0x2c')],_0x1127a7['query']);_0x5322d3[_0x027b('0x32')]=_[_0x027b('0x31')](_0x1127a7['model'],qs[_0x027b('0x33')](_0x29226e[_0x027b('0x2f')]['fields']));_0x5322d3[_0x027b('0x32')]=_0x5322d3['attributes'][_0x027b('0x34')]?_0x5322d3['attributes']:_0x1127a7[_0x027b('0x2c')];if(!_0x29226e['query'][_0x027b('0x35')](_0x027b('0x36'))){_0x5322d3[_0x027b('0x1e')]=qs[_0x027b('0x1e')](_0x29226e['query'][_0x027b('0x1e')]);_0x5322d3['offset']=qs['offset'](_0x29226e[_0x027b('0x2f')][_0x027b('0x1c')]);}_0x5322d3[_0x027b('0x37')]=qs['sort'](_0x29226e[_0x027b('0x2f')]['sort']);_0x5322d3[_0x027b('0x38')]=qs[_0x027b('0x30')](_[_0x027b('0x39')](_0x29226e['query'],_0x1127a7[_0x027b('0x30')]),_0x8688f5);if(_0x29226e[_0x027b('0x2f')][_0x027b('0x3a')]){_0x5322d3[_0x027b('0x38')]=_[_0x027b('0x3b')](_0x5322d3['where'],{'$or':_['map'](_0x8688f5,function(_0x57cab5){if(_0x57cab5[_0x027b('0x2a')]!==_0x027b('0x3c')){var _0x3751c1={};_0x3751c1[_0x57cab5['name']]={'$like':'%'+_0x29226e['query'][_0x027b('0x3a')]+'%'};return _0x3751c1;}})});}_0x5322d3=_[_0x027b('0x3b')]({},_0x5322d3,_0x29226e[_0x027b('0x3d')]);var _0x40ea37={'where':_0x5322d3[_0x027b('0x38')]};return db[_0x027b('0x28')]['count'](_0x40ea37)[_0x027b('0x21')](function(_0x517415){_0x63ab18[_0x027b('0x1f')]=_0x517415;if(_0x29226e[_0x027b('0x2f')]['includeAll']){_0x5322d3['include']=[{'all':!![]}];}return db[_0x027b('0x28')]['findAll'](_0x5322d3);})[_0x027b('0x21')](function(_0x2145b7){_0x63ab18['rows']=_0x2145b7;return _0x63ab18;})[_0x027b('0x21')](respondWithFilteredResult(_0x37b52e,_0x5322d3))[_0x027b('0x3e')](handleError(_0x37b52e,null));};exports['show']=function(_0x219f45,_0x1ac2e2){var _0x13e830={'raw':!![],'where':{'id':_0x219f45['params']['id']}},_0x220171={};_0x220171[_0x027b('0x2c')]=_[_0x027b('0x2e')](db[_0x027b('0x28')][_0x027b('0x3f')]);_0x220171[_0x027b('0x2f')]=_[_0x027b('0x2e')](_0x219f45[_0x027b('0x2f')]);_0x220171[_0x027b('0x30')]=_['intersection'](_0x220171['model'],_0x220171[_0x027b('0x2f')]);_0x13e830['attributes']=_[_0x027b('0x31')](_0x220171['model'],qs[_0x027b('0x33')](_0x219f45[_0x027b('0x2f')][_0x027b('0x33')]));_0x13e830[_0x027b('0x32')]=_0x13e830[_0x027b('0x32')][_0x027b('0x34')]?_0x13e830['attributes']:_0x220171[_0x027b('0x2c')];if(_0x219f45[_0x027b('0x2f')][_0x027b('0x40')]){_0x13e830[_0x027b('0x41')]=[{'all':!![]}];}_0x13e830=_[_0x027b('0x3b')]({},_0x13e830,_0x219f45[_0x027b('0x3d')]);return db['ServicenowField'][_0x027b('0x42')](_0x13e830)['then'](handleEntityNotFound(_0x1ac2e2,null))['then'](respondWithResult(_0x1ac2e2,null))[_0x027b('0x3e')](handleError(_0x1ac2e2,null));};exports[_0x027b('0x43')]=function(_0x365dba,_0x29cdcc){return db[_0x027b('0x28')][_0x027b('0x43')](_0x365dba[_0x027b('0x44')],{})[_0x027b('0x21')](respondWithResult(_0x29cdcc,0xc9))['catch'](handleError(_0x29cdcc,null));};exports[_0x027b('0x45')]=function(_0x1a2f6c,_0xbf1123){if(_0x1a2f6c[_0x027b('0x44')]['id']){delete _0x1a2f6c[_0x027b('0x44')]['id'];}return db[_0x027b('0x28')][_0x027b('0x42')]({'where':{'id':_0x1a2f6c[_0x027b('0x46')]['id']}})[_0x027b('0x21')](handleEntityNotFound(_0xbf1123,null))[_0x027b('0x21')](saveUpdates(_0x1a2f6c['body'],null))['then'](respondWithResult(_0xbf1123,null))[_0x027b('0x3e')](handleError(_0xbf1123,null));};exports[_0x027b('0x22')]=function(_0x2d92e5,_0x45de63){return db[_0x027b('0x28')][_0x027b('0x42')]({'where':{'id':_0x2d92e5[_0x027b('0x46')]['id']}})[_0x027b('0x21')](handleEntityNotFound(_0x45de63,null))['then'](removeEntity(_0x45de63,null))[_0x027b('0x3e')](handleError(_0x45de63,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 4985875..fdf18ec 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 _0x3e0f=['request-promise','../../config/environment','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x6b043f,_0x269493){var _0x2ac955=function(_0x2334ee){while(--_0x2334ee){_0x6b043f['push'](_0x6b043f['shift']());}};_0x2ac955(++_0x269493);}(_0x3e0f,0x113));var _0xf3e0=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x3e0f[_0x2ff238];return _0x204a56;};'use strict';var _=require(_0xf3e0('0x0'));var util=require(_0xf3e0('0x1'));var logger=require('../../config/logger')(_0xf3e0('0x2'));var moment=require(_0xf3e0('0x3'));var BPromise=require(_0xf3e0('0x4'));var rp=require(_0xf3e0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf3e0('0x6'));var attributes=require('./intServicenowField.attributes');module[_0xf3e0('0x7')]=function(_0x34c441,_0x4800dc){return _0x34c441[_0xf3e0('0x8')](_0xf3e0('0x9'),attributes,{'tableName':_0xf3e0('0xa'),'paranoid':![],'indexes':[{'name':_0xf3e0('0xb'),'fields':[_0xf3e0('0xc'),_0xf3e0('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x05d8=['servicenow_unique_index','idField','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intServicenowField.attributes','int_servicenow_fields'];(function(_0x16e9b5,_0x192142){var _0x206df0=function(_0x1a0a8f){while(--_0x1a0a8f){_0x16e9b5['push'](_0x16e9b5['shift']());}};_0x206df0(++_0x192142);}(_0x05d8,0x146));var _0x805d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x05d8[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x805d('0x0'));var util=require(_0x805d('0x1'));var logger=require(_0x805d('0x2'))(_0x805d('0x3'));var moment=require(_0x805d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x805d('0x5'));var rimraf=require(_0x805d('0x6'));var config=require(_0x805d('0x7'));var attributes=require(_0x805d('0x8'));module['exports']=function(_0xa32601,_0x374867){return _0xa32601['define']('ServicenowField',attributes,{'tableName':_0x805d('0x9'),'paranoid':![],'indexes':[{'name':_0x805d('0xa'),'fields':[_0x805d('0xb'),'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 1bb2304..1f34d25 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x65c337,_0x1179da){var _0x23fc2c=function(_0x4f49d6){while(--_0x4f49d6){_0x65c337['push'](_0x65c337['shift']());}};_0x23fc2c(++_0x1179da);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2d2b78,_0x5ae59a){_0x2d2b78=_0x2d2b78-0x0;var _0x211f39=_0x9ffd[_0x2d2b78];return _0x211f39;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x4d2993,_0x1c9473){var _0x427374=function(_0x149dfd){while(--_0x149dfd){_0x4d2993['push'](_0x4d2993['shift']());}};_0x427374(++_0x1c9473);}(_0xda3f,0xec));var _0xfda3=function(_0x4f1986,_0x48f543){_0x4f1986=_0x4f1986-0x0;var _0x2ec524=_0xda3f[_0x4f1986];return _0x2ec524;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 5dcc003..4291d9b 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x159796,_0x2fdb1b){var _0x746d52=function(_0x219223){while(--_0x219223){_0x159796['push'](_0x159796['shift']());}};_0x746d52(++_0x2fdb1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x31b1c9,_0x484ad6){var _0xb619ef=function(_0x5394d3){while(--_0x5394d3){_0x31b1c9['push'](_0x31b1c9['shift']());}};_0xb619ef(++_0x484ad6);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 1060ca9..71217b8 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x22e8af,_0xb7c10f){var _0x143085=function(_0x5cefc6){while(--_0x5cefc6){_0x22e8af['push'](_0x22e8af['shift']());}};_0x143085(++_0xb7c10f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4ea035,_0x2b6469){var _0x15da75=function(_0x1bbbd7){while(--_0x1bbbd7){_0x4ea035['push'](_0x4ea035['shift']());}};_0x15da75(++_0x2b6469);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 32aefbe..dcb9f37 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 _0xb793=['findAll','catch','params','fields','options','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','password','remoteUri','slice','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','username','PLAIN','xCALLY\x20Motion\x20Integration','get_module_fields','stringify','module_fields','remove','label','values','value','statusCode','send','test','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','includeAll','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb793,0x19f));var _0x3b79=function(_0x9bf2cc,_0x261477){_0x9bf2cc=_0x9bf2cc-0x0;var _0x3b52e5=_0xb793[_0x9bf2cc];return _0x3b52e5;};'use strict';var emlformat=require(_0x3b79('0x0'));var rimraf=require(_0x3b79('0x1'));var zipdir=require(_0x3b79('0x2'));var jsonpatch=require(_0x3b79('0x3'));var rp=require('request-promise');var moment=require(_0x3b79('0x4'));var BPromise=require(_0x3b79('0x5'));var Mustache=require(_0x3b79('0x6'));var util=require(_0x3b79('0x7'));var path=require(_0x3b79('0x8'));var sox=require(_0x3b79('0x9'));var csv=require('to-csv');var ejs=require(_0x3b79('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b79('0xb'));var squel=require(_0x3b79('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3b79('0xd'));var toCsv=require(_0x3b79('0xe'));var querystring=require('querystring');var Papa=require(_0x3b79('0xf'));var Redis=require(_0x3b79('0x10'));var authService=require(_0x3b79('0x11'));var qs=require(_0x3b79('0x12'));var as=require(_0x3b79('0x13'));var hardwareService=require(_0x3b79('0x14'));var logger=require(_0x3b79('0x15'))(_0x3b79('0x16'));var utils=require(_0x3b79('0x17'));var config=require(_0x3b79('0x18'));var licenseUtil=require(_0x3b79('0x19'));var db=require(_0x3b79('0x1a'))['db'];var integrations=require(_0x3b79('0x1b'));function respondWithStatusCode(_0x39f09c,_0x2793a7){_0x2793a7=_0x2793a7||0xcc;return function(_0x5a4fad){if(_0x5a4fad){return _0x39f09c['sendStatus'](_0x2793a7);}return _0x39f09c['status'](_0x2793a7)['end']();};}function respondWithResult(_0x1eeca8,_0x3f4820){_0x3f4820=_0x3f4820||0xc8;return function(_0x5ea9b3){if(_0x5ea9b3){return _0x1eeca8[_0x3b79('0x1c')](_0x3f4820)[_0x3b79('0x1d')](_0x5ea9b3);}};}function respondWithFilteredResult(_0x8d326,_0x271234){return function(_0x5141fc){if(_0x5141fc){var _0x47dfe2=typeof _0x271234[_0x3b79('0x1e')]===_0x3b79('0x1f')&&typeof _0x271234[_0x3b79('0x20')]===_0x3b79('0x1f');var _0x1ba83c=_0x5141fc[_0x3b79('0x21')];var _0x57f65e=_0x47dfe2?0x0:_0x271234[_0x3b79('0x1e')];var _0x350bb4=_0x47dfe2?_0x5141fc[_0x3b79('0x21')]:_0x271234['offset']+_0x271234[_0x3b79('0x20')];var _0x84e611;if(_0x350bb4>=_0x1ba83c){_0x350bb4=_0x1ba83c;_0x84e611=0xc8;}else{_0x84e611=0xce;}_0x8d326['status'](_0x84e611);return _0x8d326['set'](_0x3b79('0x22'),_0x57f65e+'-'+_0x350bb4+'/'+_0x1ba83c)['json'](_0x5141fc);}return null;};}function patchUpdates(_0x36a917){return function(_0x3f0438){try{jsonpatch['apply'](_0x3f0438,_0x36a917,!![]);}catch(_0x1b2955){return BPromise[_0x3b79('0x23')](_0x1b2955);}return _0x3f0438[_0x3b79('0x24')]();};}function saveUpdates(_0x13f564,_0x29760c){return function(_0xbc4a61){if(_0xbc4a61){return _0xbc4a61[_0x3b79('0x25')](_0x13f564)[_0x3b79('0x26')](function(_0x307494){return _0x307494;});}return null;};}function removeEntity(_0x568395,_0x493901){return function(_0x5d824a){if(_0x5d824a){return _0x5d824a[_0x3b79('0x27')]()['then'](function(){_0x568395[_0x3b79('0x1c')](0xcc)[_0x3b79('0x28')]();});}};}function handleEntityNotFound(_0x225263,_0x460fce){return function(_0x31893f){if(!_0x31893f){_0x225263[_0x3b79('0x29')](0x194);}return _0x31893f;};}function handleError(_0x20529d,_0x5cda79){_0x5cda79=_0x5cda79||0x1f4;return function(_0xe6488e){logger[_0x3b79('0x2a')](_0xe6488e[_0x3b79('0x2b')]);if(_0xe6488e[_0x3b79('0x2c')]){delete _0xe6488e[_0x3b79('0x2c')];}_0x20529d['status'](_0x5cda79)['send'](_0xe6488e);};}exports[_0x3b79('0x2d')]=function(_0x4eea41,_0x57522f){var _0x1c800d={},_0x416360={},_0x3dbd4a={'count':0x0,'rows':[]};var _0x234e09=_[_0x3b79('0x2e')](db[_0x3b79('0x2f')][_0x3b79('0x30')],function(_0x4832a4){return{'name':_0x4832a4[_0x3b79('0x31')],'type':_0x4832a4[_0x3b79('0x32')][_0x3b79('0x33')]};});_0x416360['model']=_[_0x3b79('0x2e')](_0x234e09,_0x3b79('0x2c'));_0x416360[_0x3b79('0x34')]=_[_0x3b79('0x35')](_0x4eea41[_0x3b79('0x34')]);_0x416360['filters']=_[_0x3b79('0x36')](_0x416360[_0x3b79('0x37')],_0x416360[_0x3b79('0x34')]);_0x1c800d[_0x3b79('0x38')]=_['intersection'](_0x416360[_0x3b79('0x37')],qs['fields'](_0x4eea41['query']['fields']));_0x1c800d[_0x3b79('0x38')]=_0x1c800d[_0x3b79('0x38')][_0x3b79('0x39')]?_0x1c800d[_0x3b79('0x38')]:_0x416360[_0x3b79('0x37')];if(!_0x4eea41[_0x3b79('0x34')][_0x3b79('0x3a')](_0x3b79('0x3b'))){_0x1c800d[_0x3b79('0x20')]=qs[_0x3b79('0x20')](_0x4eea41[_0x3b79('0x34')][_0x3b79('0x20')]);_0x1c800d[_0x3b79('0x1e')]=qs[_0x3b79('0x1e')](_0x4eea41[_0x3b79('0x34')][_0x3b79('0x1e')]);}_0x1c800d['order']=qs[_0x3b79('0x3c')](_0x4eea41['query']['sort']);_0x1c800d[_0x3b79('0x3d')]=qs['filters'](_[_0x3b79('0x3e')](_0x4eea41[_0x3b79('0x34')],_0x416360[_0x3b79('0x3f')]),_0x234e09);if(_0x4eea41['query'][_0x3b79('0x40')]){_0x1c800d['where']=_['merge'](_0x1c800d[_0x3b79('0x3d')],{'$or':_[_0x3b79('0x2e')](_0x234e09,function(_0x3e1ead){if(_0x3e1ead[_0x3b79('0x32')]!==_0x3b79('0x41')){var _0x149eb9={};_0x149eb9[_0x3e1ead[_0x3b79('0x2c')]]={'$like':'%'+_0x4eea41[_0x3b79('0x34')][_0x3b79('0x40')]+'%'};return _0x149eb9;}})});}_0x1c800d=_[_0x3b79('0x42')]({},_0x1c800d,_0x4eea41['options']);var _0x548975={'where':_0x1c800d['where']};return db[_0x3b79('0x2f')][_0x3b79('0x21')](_0x548975)[_0x3b79('0x26')](function(_0xe0df3e){_0x3dbd4a[_0x3b79('0x21')]=_0xe0df3e;if(_0x4eea41[_0x3b79('0x34')][_0x3b79('0x43')]){_0x1c800d[_0x3b79('0x44')]=[{'all':!![]}];}return db[_0x3b79('0x2f')][_0x3b79('0x45')](_0x1c800d);})[_0x3b79('0x26')](function(_0x2d3dc5){_0x3dbd4a['rows']=_0x2d3dc5;return _0x3dbd4a;})[_0x3b79('0x26')](respondWithFilteredResult(_0x57522f,_0x1c800d))[_0x3b79('0x46')](handleError(_0x57522f,null));};exports['show']=function(_0x2226ee,_0x3cf10e){var _0xa4447d={'raw':![],'where':{'id':_0x2226ee[_0x3b79('0x47')]['id']}},_0x2e4cab={};_0x2e4cab[_0x3b79('0x37')]=_['keys'](db[_0x3b79('0x2f')][_0x3b79('0x30')]);_0x2e4cab[_0x3b79('0x34')]=_[_0x3b79('0x35')](_0x2226ee[_0x3b79('0x34')]);_0x2e4cab['filters']=_[_0x3b79('0x36')](_0x2e4cab[_0x3b79('0x37')],_0x2e4cab[_0x3b79('0x34')]);_0xa4447d['attributes']=_[_0x3b79('0x36')](_0x2e4cab['model'],qs[_0x3b79('0x48')](_0x2226ee[_0x3b79('0x34')][_0x3b79('0x48')]));_0xa4447d[_0x3b79('0x38')]=_0xa4447d['attributes']['length']?_0xa4447d[_0x3b79('0x38')]:_0x2e4cab[_0x3b79('0x37')];if(_0x2226ee[_0x3b79('0x34')]['includeAll']){_0xa4447d[_0x3b79('0x44')]=[{'all':!![]}];}_0xa4447d=_[_0x3b79('0x42')]({},_0xa4447d,_0x2226ee[_0x3b79('0x49')]);return db[_0x3b79('0x2f')][_0x3b79('0x4a')](_0xa4447d)[_0x3b79('0x26')](handleEntityNotFound(_0x3cf10e,null))[_0x3b79('0x26')](respondWithResult(_0x3cf10e,null))[_0x3b79('0x46')](handleError(_0x3cf10e,null));};exports['create']=function(_0x2619b2,_0x59fd55){return db[_0x3b79('0x2f')][_0x3b79('0x4b')](_0x2619b2['body'],{})[_0x3b79('0x26')](respondWithResult(_0x59fd55,0xc9))[_0x3b79('0x46')](handleError(_0x59fd55,null));};exports['update']=function(_0x450d84,_0x1c48ed){if(_0x450d84[_0x3b79('0x4c')]['id']){delete _0x450d84['body']['id'];}return db[_0x3b79('0x2f')][_0x3b79('0x4a')]({'where':{'id':_0x450d84[_0x3b79('0x47')]['id']}})[_0x3b79('0x26')](handleEntityNotFound(_0x1c48ed,null))['then'](saveUpdates(_0x450d84['body'],null))[_0x3b79('0x26')](respondWithResult(_0x1c48ed,null))['catch'](handleError(_0x1c48ed,null));};exports[_0x3b79('0x27')]=function(_0x2c722f,_0x66144c){return db['SugarcrmAccount'][_0x3b79('0x4a')]({'where':{'id':_0x2c722f[_0x3b79('0x47')]['id']}})[_0x3b79('0x26')](handleEntityNotFound(_0x66144c,null))[_0x3b79('0x26')](removeEntity(_0x66144c,null))[_0x3b79('0x46')](handleError(_0x66144c,null));};exports[_0x3b79('0x4d')]=function(_0x37b691,_0x1e2ae6,_0x162707){var _0x59a560={};var _0x218262={};var _0x206efb;var _0x5ee760;return db[_0x3b79('0x2f')][_0x3b79('0x4e')]({'where':{'id':_0x37b691[_0x3b79('0x47')]['id']}})[_0x3b79('0x26')](handleEntityNotFound(_0x1e2ae6,null))[_0x3b79('0x26')](function(_0x29f064){if(_0x29f064){_0x206efb=_0x29f064;_0x218262[_0x3b79('0x37')]=_['keys'](db[_0x3b79('0x4f')][_0x3b79('0x30')]);_0x218262[_0x3b79('0x34')]=_[_0x3b79('0x35')](_0x37b691[_0x3b79('0x34')]);_0x218262[_0x3b79('0x3f')]=_[_0x3b79('0x36')](_0x218262[_0x3b79('0x37')],_0x218262['query']);_0x59a560[_0x3b79('0x38')]=_['intersection'](_0x218262['model'],qs[_0x3b79('0x48')](_0x37b691[_0x3b79('0x34')][_0x3b79('0x48')]));_0x59a560['attributes']=_0x59a560[_0x3b79('0x38')][_0x3b79('0x39')]?_0x59a560['attributes']:_0x218262[_0x3b79('0x37')];_0x59a560[_0x3b79('0x50')]=qs[_0x3b79('0x3c')](_0x37b691[_0x3b79('0x34')]['sort']);_0x59a560[_0x3b79('0x3d')]=qs[_0x3b79('0x3f')](_[_0x3b79('0x3e')](_0x37b691[_0x3b79('0x34')],_0x218262['filters']));if(_0x37b691[_0x3b79('0x34')]['filter']){_0x59a560[_0x3b79('0x3d')]=_[_0x3b79('0x42')](_0x59a560['where'],{'$or':_[_0x3b79('0x2e')](_0x59a560['attributes'],function(_0x55bb31){var _0x245594={};_0x245594[_0x55bb31]={'$like':'%'+_0x37b691['query'][_0x3b79('0x40')]+'%'};return _0x245594;})});}_0x59a560=_[_0x3b79('0x42')]({},_0x59a560,_0x37b691[_0x3b79('0x49')]);return _0x206efb['getConfigurations'](_0x59a560);}})['then'](function(_0x215ff3){if(_0x215ff3){_0x5ee760=_0x215ff3[_0x3b79('0x39')];if(!_0x37b691[_0x3b79('0x34')]['hasOwnProperty']('nolimit')){_0x59a560[_0x3b79('0x20')]=qs['limit'](_0x37b691['query'][_0x3b79('0x20')]);_0x59a560[_0x3b79('0x1e')]=qs[_0x3b79('0x1e')](_0x37b691[_0x3b79('0x34')][_0x3b79('0x1e')]);}return _0x206efb['getConfigurations'](_0x59a560);}})[_0x3b79('0x26')](function(_0x3c946a){if(_0x3c946a){return _0x3c946a?{'count':_0x5ee760,'rows':_0x3c946a}:null;}})[_0x3b79('0x26')](respondWithResult(_0x1e2ae6,null))[_0x3b79('0x46')](handleError(_0x1e2ae6,null));};exports[_0x3b79('0x51')]=function(_0x3cde4b,_0x1ba452,_0x49ace2){if(_0x3cde4b['body']['id']){delete _0x3cde4b[_0x3b79('0x4c')]['id'];}return db[_0x3b79('0x2f')][_0x3b79('0x4e')]({'where':{'id':_0x3cde4b[_0x3b79('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ba452,null))[_0x3b79('0x26')](function(_0x1c8903){if(_0x1c8903){_0x3cde4b['body'][_0x3b79('0x52')]=_0x1c8903['id'];_0x3cde4b[_0x3b79('0x4c')][_0x3b79('0x53')]=integrations[_0x3b79('0x54')](_0x3cde4b[_0x3b79('0x4c')]['channel'],_0x3cde4b['body']['type']);_0x3cde4b['body'][_0x3b79('0x55')]=integrations[_0x3b79('0x56')](_0x3cde4b[_0x3b79('0x4c')][_0x3b79('0x57')],_0x3cde4b['body']['type']);return db[_0x3b79('0x4f')][_0x3b79('0x4b')](_0x3cde4b[_0x3b79('0x4c')],{'include':[{'model':db[_0x3b79('0x58')],'as':_0x3b79('0x53')},{'model':db[_0x3b79('0x58')],'as':_0x3b79('0x55')}]});}return null;})[_0x3b79('0x26')](respondWithResult(_0x1ba452,null))[_0x3b79('0x46')](handleError(_0x1ba452,null));};exports[_0x3b79('0x59')]=function(_0x362fdc,_0x2ded33,_0x596691){var _0x43230c='';var _0x371edc=['id',_0x3b79('0x2c'),_0x3b79('0x5a'),_0x3b79('0x5b'),_0x3b79('0x5c'),_0x3b79('0x5d'),_0x3b79('0x5e'),_0x3b79('0x5f'),_0x3b79('0x60'),_0x3b79('0x61'),'parent_name',_0x3b79('0x62')];return db[_0x3b79('0x2f')][_0x3b79('0x4e')]({'where':{'id':_0x362fdc[_0x3b79('0x47')]['id']},'attributes':['id','username',_0x3b79('0x63'),_0x3b79('0x64')]})[_0x3b79('0x26')](handleEntityNotFound(_0x2ded33,null))[_0x3b79('0x26')](function(_0x1baa61){if(_0x1baa61){_0x43230c=_0x1baa61[_0x3b79('0x64')];var _0xe5bef=_0x43230c[_0x3b79('0x65')](-0x1);if(_0xe5bef==='/'){_0x43230c=_0x43230c['substring'](0x0,_0x43230c['lastIndexOf'](_0xe5bef));}return rp({'method':_0x3b79('0x66'),'uri':util[_0x3b79('0x67')](_0x3b79('0x68'),_0x43230c,_0x3b79('0x69')),'json':!![],'form':{'method':_0x3b79('0x6a'),'input_type':_0x3b79('0x6b'),'response_type':_0x3b79('0x6b'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1baa61[_0x3b79('0x6c')],'password':_0x1baa61[_0x3b79('0x63')],'encryption':_0x3b79('0x6d')},'application':_0x3b79('0x6e')})}});}})[_0x3b79('0x26')](function(_0x38e8a1){if(_0x38e8a1&&_0x38e8a1[_0x3b79('0x2c')]!=='Invalid\x20Login'&&_0x38e8a1[_0x3b79('0x2c')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util['format']('%s%s',_0x43230c,_0x3b79('0x69')),'json':!![],'form':{'method':_0x3b79('0x6f'),'input_type':_0x3b79('0x6b'),'response_type':_0x3b79('0x6b'),'rest_data':JSON[_0x3b79('0x70')]({'session':_0x38e8a1['id'],'module_name':'Calls'})}})[_0x3b79('0x26')](function(_0x26e1f8){if(_0x26e1f8){var _0x119995=_['values'](_0x26e1f8[_0x3b79('0x71')]);_[_0x3b79('0x72')](_0x119995,function(_0x5cd95e){return _0x371edc['includes'](_0x5cd95e[_0x3b79('0x2c')]);});return{'count':_0x119995['length'],'rows':_['map'](_0x119995,function(_0x58ee17){return{'id':_0x58ee17['name'],'name':_0x58ee17[_0x3b79('0x73')],'custom':_['endsWith'](_0x58ee17[_0x3b79('0x2c')],'_c')?!![]:![],'options':_0x58ee17['options']?_[_0x3b79('0x2e')](_[_0x3b79('0x74')](_0x58ee17[_0x3b79('0x49')]),function(_0x46faf9){return{'name':_0x46faf9[_0x3b79('0x75')],'value':_0x46faf9[_0x3b79('0x2c')]};}):[]};})};}})['then'](respondWithResult(_0x2ded33,null))[_0x3b79('0x46')](function(_0x279716){var _0xd30ef4=_0x362fdc[_0x3b79('0x34')]['test']?0x1f4:_0x279716[_0x3b79('0x76')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x3b79('0x59'),_0xd30ef4,JSON[_0x3b79('0x70')](_0x279716));delete _0x279716[_0x3b79('0x2c')];if(_0xd30ef4===0x191){_0xd30ef4=0x190;}_0x2ded33['status'](_0xd30ef4)[_0x3b79('0x77')](_0x362fdc[_0x3b79('0x34')][_0x3b79('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x279716['statusCode']}:_0x279716);});}else{var _0x27746d=0x1f4;_0x2ded33['status'](_0x27746d)[_0x3b79('0x77')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x85a9=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','status','undefined','limit','count','offset','set','Content-Range','json','apply','then','destroy','end','sendStatus','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find','getConfigurations','findOne','sort','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','stringify','values','module_fields','label','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','querystring'];(function(_0x34c23b,_0x52b447){var _0x2c4d47=function(_0x5bbd09){while(--_0x5bbd09){_0x34c23b['push'](_0x34c23b['shift']());}};_0x2c4d47(++_0x52b447);}(_0x85a9,0xdb));var _0x985a=function(_0x483e3a,_0x568361){_0x483e3a=_0x483e3a-0x0;var _0x43fca9=_0x85a9[_0x483e3a];return _0x43fca9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x985a('0x0'));var zipdir=require(_0x985a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x985a('0x2'));var moment=require('moment');var BPromise=require(_0x985a('0x3'));var Mustache=require(_0x985a('0x4'));var util=require(_0x985a('0x5'));var path=require('path');var sox=require(_0x985a('0x6'));var csv=require('to-csv');var ejs=require(_0x985a('0x7'));var fs=require('fs');var fs_extra=require(_0x985a('0x8'));var _=require('lodash');var squel=require(_0x985a('0x9'));var crypto=require('crypto');var jsforce=require(_0x985a('0xa'));var deskjs=require(_0x985a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x985a('0xc'));var Papa=require(_0x985a('0xd'));var Redis=require(_0x985a('0xe'));var authService=require(_0x985a('0xf'));var qs=require(_0x985a('0x10'));var as=require(_0x985a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x985a('0x12'));var utils=require('../../config/utils');var config=require(_0x985a('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4fef35,_0x426caa){_0x426caa=_0x426caa||0xcc;return function(_0x3b3b87){if(_0x3b3b87){return _0x4fef35['sendStatus'](_0x426caa);}return _0x4fef35[_0x985a('0x14')](_0x426caa)['end']();};}function respondWithResult(_0x2f4e2a,_0x2e8d9a){_0x2e8d9a=_0x2e8d9a||0xc8;return function(_0x3165bb){if(_0x3165bb){return _0x2f4e2a['status'](_0x2e8d9a)['json'](_0x3165bb);}};}function respondWithFilteredResult(_0x50b2e3,_0x2bd39a){return function(_0xd23ac0){if(_0xd23ac0){var _0x4fbfe3=typeof _0x2bd39a['offset']===_0x985a('0x15')&&typeof _0x2bd39a[_0x985a('0x16')]==='undefined';var _0x45ea64=_0xd23ac0[_0x985a('0x17')];var _0x42fc57=_0x4fbfe3?0x0:_0x2bd39a[_0x985a('0x18')];var _0x303119=_0x4fbfe3?_0xd23ac0[_0x985a('0x17')]:_0x2bd39a[_0x985a('0x18')]+_0x2bd39a[_0x985a('0x16')];var _0x2710e8;if(_0x303119>=_0x45ea64){_0x303119=_0x45ea64;_0x2710e8=0xc8;}else{_0x2710e8=0xce;}_0x50b2e3[_0x985a('0x14')](_0x2710e8);return _0x50b2e3[_0x985a('0x19')](_0x985a('0x1a'),_0x42fc57+'-'+_0x303119+'/'+_0x45ea64)[_0x985a('0x1b')](_0xd23ac0);}return null;};}function patchUpdates(_0x320975){return function(_0xf81a5b){try{jsonpatch[_0x985a('0x1c')](_0xf81a5b,_0x320975,!![]);}catch(_0x36d811){return BPromise['reject'](_0x36d811);}return _0xf81a5b['save']();};}function saveUpdates(_0x12e0e5,_0x54b815){return function(_0x3e4bbb){if(_0x3e4bbb){return _0x3e4bbb['update'](_0x12e0e5)[_0x985a('0x1d')](function(_0x179f02){return _0x179f02;});}return null;};}function removeEntity(_0x563db2,_0x4a3467){return function(_0x381dc4){if(_0x381dc4){return _0x381dc4[_0x985a('0x1e')]()['then'](function(){_0x563db2[_0x985a('0x14')](0xcc)[_0x985a('0x1f')]();});}};}function handleEntityNotFound(_0x252871,_0x3a1044){return function(_0x568fee){if(!_0x568fee){_0x252871[_0x985a('0x20')](0x194);}return _0x568fee;};}function handleError(_0x86edb,_0x2a18d9){_0x2a18d9=_0x2a18d9||0x1f4;return function(_0x3aaa50){logger[_0x985a('0x21')](_0x3aaa50[_0x985a('0x22')]);if(_0x3aaa50[_0x985a('0x23')]){delete _0x3aaa50['name'];}_0x86edb[_0x985a('0x14')](_0x2a18d9)[_0x985a('0x24')](_0x3aaa50);};}exports[_0x985a('0x25')]=function(_0x135a28,_0x14b510){var _0x16b9b5={},_0x552d58={},_0xd98e3={'count':0x0,'rows':[]};var _0x1989d5=_[_0x985a('0x26')](db[_0x985a('0x27')][_0x985a('0x28')],function(_0x4da67c){return{'name':_0x4da67c[_0x985a('0x29')],'type':_0x4da67c[_0x985a('0x2a')][_0x985a('0x2b')]};});_0x552d58[_0x985a('0x2c')]=_[_0x985a('0x26')](_0x1989d5,'name');_0x552d58[_0x985a('0x2d')]=_[_0x985a('0x2e')](_0x135a28[_0x985a('0x2d')]);_0x552d58['filters']=_[_0x985a('0x2f')](_0x552d58['model'],_0x552d58['query']);_0x16b9b5[_0x985a('0x30')]=_['intersection'](_0x552d58[_0x985a('0x2c')],qs['fields'](_0x135a28[_0x985a('0x2d')][_0x985a('0x31')]));_0x16b9b5[_0x985a('0x30')]=_0x16b9b5[_0x985a('0x30')][_0x985a('0x32')]?_0x16b9b5[_0x985a('0x30')]:_0x552d58[_0x985a('0x2c')];if(!_0x135a28[_0x985a('0x2d')][_0x985a('0x33')](_0x985a('0x34'))){_0x16b9b5[_0x985a('0x16')]=qs[_0x985a('0x16')](_0x135a28[_0x985a('0x2d')][_0x985a('0x16')]);_0x16b9b5[_0x985a('0x18')]=qs[_0x985a('0x18')](_0x135a28[_0x985a('0x2d')][_0x985a('0x18')]);}_0x16b9b5[_0x985a('0x35')]=qs['sort'](_0x135a28[_0x985a('0x2d')]['sort']);_0x16b9b5['where']=qs['filters'](_[_0x985a('0x36')](_0x135a28[_0x985a('0x2d')],_0x552d58[_0x985a('0x37')]),_0x1989d5);if(_0x135a28[_0x985a('0x2d')][_0x985a('0x38')]){_0x16b9b5[_0x985a('0x39')]=_[_0x985a('0x3a')](_0x16b9b5[_0x985a('0x39')],{'$or':_[_0x985a('0x26')](_0x1989d5,function(_0x274091){if(_0x274091[_0x985a('0x2a')]!==_0x985a('0x3b')){var _0x187347={};_0x187347[_0x274091[_0x985a('0x23')]]={'$like':'%'+_0x135a28[_0x985a('0x2d')][_0x985a('0x38')]+'%'};return _0x187347;}})});}_0x16b9b5=_['merge']({},_0x16b9b5,_0x135a28[_0x985a('0x3c')]);var _0x503122={'where':_0x16b9b5['where']};return db[_0x985a('0x27')]['count'](_0x503122)['then'](function(_0x3190e5){_0xd98e3[_0x985a('0x17')]=_0x3190e5;if(_0x135a28['query'][_0x985a('0x3d')]){_0x16b9b5[_0x985a('0x3e')]=[{'all':!![]}];}return db[_0x985a('0x27')]['findAll'](_0x16b9b5);})[_0x985a('0x1d')](function(_0x3bb80d){_0xd98e3[_0x985a('0x3f')]=_0x3bb80d;return _0xd98e3;})[_0x985a('0x1d')](respondWithFilteredResult(_0x14b510,_0x16b9b5))[_0x985a('0x40')](handleError(_0x14b510,null));};exports[_0x985a('0x41')]=function(_0x41eeeb,_0x1f3920){var _0x61e4cb={'raw':![],'where':{'id':_0x41eeeb[_0x985a('0x42')]['id']}},_0x3996e8={};_0x3996e8[_0x985a('0x2c')]=_[_0x985a('0x2e')](db[_0x985a('0x27')]['rawAttributes']);_0x3996e8[_0x985a('0x2d')]=_[_0x985a('0x2e')](_0x41eeeb[_0x985a('0x2d')]);_0x3996e8['filters']=_[_0x985a('0x2f')](_0x3996e8['model'],_0x3996e8[_0x985a('0x2d')]);_0x61e4cb[_0x985a('0x30')]=_[_0x985a('0x2f')](_0x3996e8[_0x985a('0x2c')],qs[_0x985a('0x31')](_0x41eeeb[_0x985a('0x2d')][_0x985a('0x31')]));_0x61e4cb[_0x985a('0x30')]=_0x61e4cb['attributes'][_0x985a('0x32')]?_0x61e4cb[_0x985a('0x30')]:_0x3996e8[_0x985a('0x2c')];if(_0x41eeeb[_0x985a('0x2d')][_0x985a('0x3d')]){_0x61e4cb[_0x985a('0x3e')]=[{'all':!![]}];}_0x61e4cb=_[_0x985a('0x3a')]({},_0x61e4cb,_0x41eeeb[_0x985a('0x3c')]);return db[_0x985a('0x27')]['find'](_0x61e4cb)[_0x985a('0x1d')](handleEntityNotFound(_0x1f3920,null))[_0x985a('0x1d')](respondWithResult(_0x1f3920,null))[_0x985a('0x40')](handleError(_0x1f3920,null));};exports[_0x985a('0x43')]=function(_0x315d60,_0x3cf110){return db['SugarcrmAccount']['create'](_0x315d60[_0x985a('0x44')],{})[_0x985a('0x1d')](respondWithResult(_0x3cf110,0xc9))[_0x985a('0x40')](handleError(_0x3cf110,null));};exports['update']=function(_0x18568b,_0x2884c0){if(_0x18568b['body']['id']){delete _0x18568b[_0x985a('0x44')]['id'];}return db[_0x985a('0x27')][_0x985a('0x45')]({'where':{'id':_0x18568b[_0x985a('0x42')]['id']}})[_0x985a('0x1d')](handleEntityNotFound(_0x2884c0,null))['then'](saveUpdates(_0x18568b['body'],null))[_0x985a('0x1d')](respondWithResult(_0x2884c0,null))[_0x985a('0x40')](handleError(_0x2884c0,null));};exports[_0x985a('0x1e')]=function(_0x3e66a2,_0x2c948c){return db['SugarcrmAccount'][_0x985a('0x45')]({'where':{'id':_0x3e66a2[_0x985a('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c948c,null))[_0x985a('0x1d')](removeEntity(_0x2c948c,null))['catch'](handleError(_0x2c948c,null));};exports[_0x985a('0x46')]=function(_0x161fb4,_0x437c21,_0x3cda3f){var _0x204b25={};var _0x5be704={};var _0x56e044;var _0x3b90c9;return db['SugarcrmAccount'][_0x985a('0x47')]({'where':{'id':_0x161fb4[_0x985a('0x42')]['id']}})['then'](handleEntityNotFound(_0x437c21,null))[_0x985a('0x1d')](function(_0x753668){if(_0x753668){_0x56e044=_0x753668;_0x5be704[_0x985a('0x2c')]=_['keys'](db['SugarcrmConfiguration']['rawAttributes']);_0x5be704[_0x985a('0x2d')]=_[_0x985a('0x2e')](_0x161fb4[_0x985a('0x2d')]);_0x5be704['filters']=_[_0x985a('0x2f')](_0x5be704[_0x985a('0x2c')],_0x5be704['query']);_0x204b25['attributes']=_[_0x985a('0x2f')](_0x5be704[_0x985a('0x2c')],qs[_0x985a('0x31')](_0x161fb4[_0x985a('0x2d')][_0x985a('0x31')]));_0x204b25['attributes']=_0x204b25[_0x985a('0x30')]['length']?_0x204b25['attributes']:_0x5be704[_0x985a('0x2c')];_0x204b25['order']=qs[_0x985a('0x48')](_0x161fb4[_0x985a('0x2d')][_0x985a('0x48')]);_0x204b25[_0x985a('0x39')]=qs['filters'](_['pick'](_0x161fb4['query'],_0x5be704[_0x985a('0x37')]));if(_0x161fb4['query'][_0x985a('0x38')]){_0x204b25['where']=_[_0x985a('0x3a')](_0x204b25[_0x985a('0x39')],{'$or':_[_0x985a('0x26')](_0x204b25[_0x985a('0x30')],function(_0x33a62d){var _0x36e374={};_0x36e374[_0x33a62d]={'$like':'%'+_0x161fb4[_0x985a('0x2d')]['filter']+'%'};return _0x36e374;})});}_0x204b25=_[_0x985a('0x3a')]({},_0x204b25,_0x161fb4[_0x985a('0x3c')]);return _0x56e044['getConfigurations'](_0x204b25);}})[_0x985a('0x1d')](function(_0x24d145){if(_0x24d145){_0x3b90c9=_0x24d145[_0x985a('0x32')];if(!_0x161fb4[_0x985a('0x2d')]['hasOwnProperty'](_0x985a('0x34'))){_0x204b25[_0x985a('0x16')]=qs[_0x985a('0x16')](_0x161fb4[_0x985a('0x2d')][_0x985a('0x16')]);_0x204b25['offset']=qs[_0x985a('0x18')](_0x161fb4[_0x985a('0x2d')][_0x985a('0x18')]);}return _0x56e044[_0x985a('0x46')](_0x204b25);}})[_0x985a('0x1d')](function(_0x480d3e){if(_0x480d3e){return _0x480d3e?{'count':_0x3b90c9,'rows':_0x480d3e}:null;}})[_0x985a('0x1d')](respondWithResult(_0x437c21,null))[_0x985a('0x40')](handleError(_0x437c21,null));};exports['addConfiguration']=function(_0x289606,_0x444263,_0x401a12){if(_0x289606[_0x985a('0x44')]['id']){delete _0x289606[_0x985a('0x44')]['id'];}return db[_0x985a('0x27')]['findOne']({'where':{'id':_0x289606[_0x985a('0x42')]['id']}})[_0x985a('0x1d')](handleEntityNotFound(_0x444263,null))[_0x985a('0x1d')](function(_0x1b95ae){if(_0x1b95ae){_0x289606[_0x985a('0x44')][_0x985a('0x49')]=_0x1b95ae['id'];_0x289606[_0x985a('0x44')][_0x985a('0x4a')]=integrations[_0x985a('0x4b')](_0x289606[_0x985a('0x44')][_0x985a('0x4c')],_0x289606[_0x985a('0x44')][_0x985a('0x2a')]);_0x289606[_0x985a('0x44')][_0x985a('0x4d')]=integrations[_0x985a('0x4e')](_0x289606[_0x985a('0x44')][_0x985a('0x4c')],_0x289606['body'][_0x985a('0x2a')]);return db[_0x985a('0x4f')][_0x985a('0x43')](_0x289606['body'],{'include':[{'model':db['SugarcrmField'],'as':_0x985a('0x4a')},{'model':db[_0x985a('0x50')],'as':'Descriptions'}]});}return null;})[_0x985a('0x1d')](respondWithResult(_0x444263,null))['catch'](handleError(_0x444263,null));};exports[_0x985a('0x51')]=function(_0xe24cb2,_0x4ff6fd,_0x2a7488){var _0xae7ced='';var _0x1e92a8=['id','name',_0x985a('0x52'),_0x985a('0x53'),_0x985a('0x54'),_0x985a('0x55'),_0x985a('0x56'),_0x985a('0x57'),'parent_id',_0x985a('0x58'),_0x985a('0x59'),_0x985a('0x5a')];return db[_0x985a('0x27')]['findOne']({'where':{'id':_0xe24cb2[_0x985a('0x42')]['id']},'attributes':['id','username',_0x985a('0x5b'),'remoteUri']})['then'](handleEntityNotFound(_0x4ff6fd,null))[_0x985a('0x1d')](function(_0x1ac952){if(_0x1ac952){_0xae7ced=_0x1ac952[_0x985a('0x5c')];var _0x113744=_0xae7ced[_0x985a('0x5d')](-0x1);if(_0x113744==='/'){_0xae7ced=_0xae7ced[_0x985a('0x5e')](0x0,_0xae7ced[_0x985a('0x5f')](_0x113744));}return rp({'method':_0x985a('0x60'),'uri':util[_0x985a('0x61')](_0x985a('0x62'),_0xae7ced,_0x985a('0x63')),'json':!![],'form':{'method':_0x985a('0x64'),'input_type':_0x985a('0x65'),'response_type':_0x985a('0x65'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1ac952[_0x985a('0x66')],'password':_0x1ac952[_0x985a('0x5b')],'encryption':_0x985a('0x67')},'application':_0x985a('0x68')})}});}})['then'](function(_0x16b2cd){if(_0x16b2cd&&_0x16b2cd[_0x985a('0x23')]!==_0x985a('0x69')&&_0x16b2cd['name']!==_0x985a('0x6a')){return rp({'method':_0x985a('0x60'),'uri':util['format']('%s%s',_0xae7ced,_0x985a('0x63')),'json':!![],'form':{'method':_0x985a('0x6b'),'input_type':_0x985a('0x65'),'response_type':_0x985a('0x65'),'rest_data':JSON[_0x985a('0x6c')]({'session':_0x16b2cd['id'],'module_name':'Calls'})}})[_0x985a('0x1d')](function(_0x19d58d){if(_0x19d58d){var _0x5c3dc4=_[_0x985a('0x6d')](_0x19d58d[_0x985a('0x6e')]);_['remove'](_0x5c3dc4,function(_0x32eca1){return _0x1e92a8['includes'](_0x32eca1[_0x985a('0x23')]);});return{'count':_0x5c3dc4['length'],'rows':_['map'](_0x5c3dc4,function(_0x9c7b64){return{'id':_0x9c7b64[_0x985a('0x23')],'name':_0x9c7b64[_0x985a('0x6f')],'custom':_['endsWith'](_0x9c7b64[_0x985a('0x23')],'_c')?!![]:![],'options':_0x9c7b64[_0x985a('0x3c')]?_[_0x985a('0x26')](_['values'](_0x9c7b64[_0x985a('0x3c')]),function(_0x2732ef){return{'name':_0x2732ef[_0x985a('0x70')],'value':_0x2732ef[_0x985a('0x23')]};}):[]};})};}})[_0x985a('0x1d')](respondWithResult(_0x4ff6fd,null))[_0x985a('0x40')](function(_0x4b98de){var _0x1705f0=_0xe24cb2['query']['test']?0x1f4:_0x4b98de[_0x985a('0x71')]||0x1f4;logger[_0x985a('0x21')](_0x985a('0x72'),_0x985a('0x51'),_0x1705f0,JSON[_0x985a('0x6c')](_0x4b98de));delete _0x4b98de['name'];if(_0x1705f0===0x191){_0x1705f0=0x190;}_0x4ff6fd[_0x985a('0x14')](_0x1705f0)[_0x985a('0x24')](_0xe24cb2['query']['test']?{'message':_0x985a('0x73'),'statusCode':_0x4b98de[_0x985a('0x71')]}:_0x4b98de);});}else{var _0x3f1441=0x1f4;_0x4ff6fd[_0x985a('0x14')](_0x3f1441)[_0x985a('0x24')]({'message':_0x985a('0x73'),'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 21313b4..b33bd84 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 _0x5074=['../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0xec3fa4,_0x45da){var _0x57e0d5=function(_0x5a58a2){while(--_0x5a58a2){_0xec3fa4['push'](_0xec3fa4['shift']());}};_0x57e0d5(++_0x45da);}(_0x5074,0x1e7));var _0x4507=function(_0x4c05da,_0x414720){_0x4c05da=_0x4c05da-0x0;var _0x1614db=_0x5074[_0x4c05da];return _0x1614db;};'use strict';var _=require('lodash');var util=require(_0x4507('0x0'));var logger=require(_0x4507('0x1'))('api');var moment=require(_0x4507('0x2'));var BPromise=require(_0x4507('0x3'));var rp=require(_0x4507('0x4'));var fs=require('fs');var path=require(_0x4507('0x5'));var rimraf=require(_0x4507('0x6'));var config=require(_0x4507('0x7'));var attributes=require(_0x4507('0x8'));var integrations=require(_0x4507('0x9'));module[_0x4507('0xa')]=function(_0x4a1134,_0x32401a){return _0x4a1134['define'](_0x4507('0xb'),attributes,{'tableName':_0x4507('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa269=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','SugarcrmAccount'];(function(_0x19e1da,_0x4e9bcb){var _0x4f637c=function(_0x431c1a){while(--_0x431c1a){_0x19e1da['push'](_0x19e1da['shift']());}};_0x4f637c(++_0x4e9bcb);}(_0xa269,0x1ef));var _0x9a26=function(_0x4304e2,_0x39779f){_0x4304e2=_0x4304e2-0x0;var _0x2d183d=_0xa269[_0x4304e2];return _0x2d183d;};'use strict';var _=require(_0x9a26('0x0'));var util=require(_0x9a26('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9a26('0x2'));var BPromise=require(_0x9a26('0x3'));var rp=require(_0x9a26('0x4'));var fs=require('fs');var path=require(_0x9a26('0x5'));var rimraf=require(_0x9a26('0x6'));var config=require(_0x9a26('0x7'));var attributes=require(_0x9a26('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x9a26('0x9')]=function(_0x2ca33d,_0x52f421){return _0x2ca33d['define'](_0x9a26('0xa'),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 c3c420e..c728c10 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 _0xe756=['catch','ShowSugarcrmAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetSugarcrmAccount','SugarcrmAccount','options','include','map','model','attributes'];(function(_0x571cf3,_0xeb2f1e){var _0x5d8336=function(_0x56f25a){while(--_0x56f25a){_0x571cf3['push'](_0x571cf3['shift']());}};_0x5d8336(++_0xeb2f1e);}(_0xe756,0x88));var _0x6e75=function(_0x4a2e32,_0x3cf854){_0x4a2e32=_0x4a2e32-0x0;var _0x4449e6=_0xe756[_0x4a2e32];return _0x4449e6;};'use strict';var _=require(_0x6e75('0x0'));var util=require(_0x6e75('0x1'));var moment=require(_0x6e75('0x2'));var BPromise=require(_0x6e75('0x3'));var rs=require(_0x6e75('0x4'));var fs=require('fs');var Redis=require(_0x6e75('0x5'));var db=require(_0x6e75('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6e75('0x7'));var config=require('../../config/environment');var jayson=require(_0x6e75('0x8'));var client=jayson['client'][_0x6e75('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd0c555,_0x446d1f,_0x122876){return new BPromise(function(_0x5027d7,_0x5c6329){return client[_0x6e75('0xa')](_0xd0c555,_0x122876)[_0x6e75('0xb')](function(_0x207dc7){logger['info'](_0x6e75('0xc'),_0x446d1f,'request\x20sent');logger[_0x6e75('0xd')](_0x6e75('0xe'),_0x446d1f,_0x6e75('0xf'),JSON[_0x6e75('0x10')](_0x207dc7));if(_0x207dc7[_0x6e75('0x11')]){if(_0x207dc7[_0x6e75('0x11')][_0x6e75('0x12')]===0x1f4){logger[_0x6e75('0x11')](_0x6e75('0xc'),_0x446d1f,_0x207dc7[_0x6e75('0x11')][_0x6e75('0x13')]);return _0x5c6329(_0x207dc7['error'][_0x6e75('0x13')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x446d1f,_0x207dc7['error'][_0x6e75('0x13')]);return _0x5027d7(_0x207dc7[_0x6e75('0x11')]['message']);}else{logger[_0x6e75('0x14')](_0x6e75('0xc'),_0x446d1f,'request\x20sent');_0x5027d7(_0x207dc7[_0x6e75('0x15')][_0x6e75('0x13')]);}})['catch'](function(_0xa915c5){logger[_0x6e75('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x446d1f,_0xa915c5);_0x5c6329(_0xa915c5);});});}exports[_0x6e75('0x16')]=function(_0x4be408){var _0x34c0d0=this;return new Promise(function(_0x1f270f,_0x2f8101){return db[_0x6e75('0x17')]['findAll']({'raw':_0x4be408[_0x6e75('0x18')]?_0x4be408[_0x6e75('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4be408['options']?_0x4be408[_0x6e75('0x18')]['where']||null:null,'attributes':_0x4be408[_0x6e75('0x18')]?_0x4be408[_0x6e75('0x18')]['attributes']||null:null,'limit':_0x4be408[_0x6e75('0x18')]?_0x4be408[_0x6e75('0x18')]['limit']||null:null,'include':_0x4be408['options']?_0x4be408[_0x6e75('0x18')][_0x6e75('0x19')]?_[_0x6e75('0x1a')](_0x4be408['options']['include'],function(_0x210bf2){return{'model':db[_0x210bf2[_0x6e75('0x1b')]],'as':_0x210bf2['as'],'attributes':_0x210bf2[_0x6e75('0x1c')],'include':_0x210bf2[_0x6e75('0x19')]?_[_0x6e75('0x1a')](_0x210bf2[_0x6e75('0x19')],function(_0x15d08a){return{'model':db[_0x15d08a['model']],'as':_0x15d08a['as'],'attributes':_0x15d08a[_0x6e75('0x1c')],'include':_0x15d08a['include']?_[_0x6e75('0x1a')](_0x15d08a[_0x6e75('0x19')],function(_0x589fe3){return{'model':db[_0x589fe3[_0x6e75('0x1b')]],'as':_0x589fe3['as'],'attributes':_0x589fe3['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e75('0xb')](function(_0x3f0f6b){logger[_0x6e75('0x14')](_0x6e75('0x16'),_0x4be408);logger[_0x6e75('0xd')](_0x6e75('0x16'),_0x4be408,JSON[_0x6e75('0x10')](_0x3f0f6b));_0x1f270f(_0x3f0f6b);})[_0x6e75('0x1d')](function(_0x2056f4){logger[_0x6e75('0x11')](_0x6e75('0x16'),_0x2056f4['message'],_0x4be408);_0x2f8101(_0x34c0d0[_0x6e75('0x11')](0x1f4,_0x2056f4[_0x6e75('0x13')]));});});};exports[_0x6e75('0x1e')]=function(_0xcb6069){var _0x396d95=this;return new Promise(function(_0x1af87d,_0x2b9340){return db[_0x6e75('0x17')][_0x6e75('0x1f')]({'raw':_0xcb6069[_0x6e75('0x18')]?_0xcb6069[_0x6e75('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xcb6069[_0x6e75('0x18')]?_0xcb6069['options'][_0x6e75('0x20')]||null:null,'attributes':_0xcb6069['options']?_0xcb6069[_0x6e75('0x18')]['attributes']||null:null,'include':_0xcb6069[_0x6e75('0x18')]?_0xcb6069['options'][_0x6e75('0x19')]?_['map'](_0xcb6069['options'][_0x6e75('0x19')],function(_0x310449){return{'model':db[_0x310449[_0x6e75('0x1b')]],'as':_0x310449['as'],'attributes':_0x310449[_0x6e75('0x1c')],'include':_0x310449['include']?_[_0x6e75('0x1a')](_0x310449[_0x6e75('0x19')],function(_0x3cdd74){return{'model':db[_0x3cdd74['model']],'as':_0x3cdd74['as'],'attributes':_0x3cdd74[_0x6e75('0x1c')],'include':_0x3cdd74[_0x6e75('0x19')]?_[_0x6e75('0x1a')](_0x3cdd74['include'],function(_0x2703f2){return{'model':db[_0x2703f2[_0x6e75('0x1b')]],'as':_0x2703f2['as'],'attributes':_0x2703f2['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e75('0xb')](function(_0x333f2c){logger['info']('ShowSugarcrmAccount',_0xcb6069);logger['debug'](_0x6e75('0x1e'),_0xcb6069,JSON['stringify'](_0x333f2c));_0x1af87d(_0x333f2c);})[_0x6e75('0x1d')](function(_0x452127){logger['error']('ShowSugarcrmAccount',_0x452127[_0x6e75('0x13')],_0xcb6069);_0x2b9340(_0x396d95[_0x6e75('0x11')](0x1f4,_0x452127['message']));});});}; \ No newline at end of file +var _0xcf0a=['GetSugarcrmAccount','SugarcrmAccount','options','raw','where','limit','model','attributes','include','debug','ShowSugarcrmAccount','find','map','lodash','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0xfd2dd2,_0x41e8d6){var _0x3f28f1=function(_0x563b97){while(--_0x563b97){_0xfd2dd2['push'](_0xfd2dd2['shift']());}};_0x3f28f1(++_0x41e8d6);}(_0xcf0a,0xc7));var _0xacf0=function(_0x3747bd,_0x30714e){_0x3747bd=_0x3747bd-0x0;var _0x5389a4=_0xcf0a[_0x3747bd];return _0x5389a4;};'use strict';var _=require(_0xacf0('0x0'));var util=require('util');var moment=require(_0xacf0('0x1'));var BPromise=require('bluebird');var rs=require(_0xacf0('0x2'));var fs=require('fs');var Redis=require(_0xacf0('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xacf0('0x4'))('rpc');var config=require(_0xacf0('0x5'));var jayson=require(_0xacf0('0x6'));var client=jayson[_0xacf0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b164c,_0x4f4127,_0x4903e4){return new BPromise(function(_0x36211,_0x114d81){return client[_0xacf0('0x8')](_0x4b164c,_0x4903e4)[_0xacf0('0x9')](function(_0x1652a1){logger[_0xacf0('0xa')](_0xacf0('0xb'),_0x4f4127,_0xacf0('0xc'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x4f4127,_0xacf0('0xc'),JSON[_0xacf0('0xd')](_0x1652a1));if(_0x1652a1[_0xacf0('0xe')]){if(_0x1652a1[_0xacf0('0xe')]['code']===0x1f4){logger[_0xacf0('0xe')](_0xacf0('0xb'),_0x4f4127,_0x1652a1['error']['message']);return _0x114d81(_0x1652a1[_0xacf0('0xe')][_0xacf0('0xf')]);}logger[_0xacf0('0xe')](_0xacf0('0xb'),_0x4f4127,_0x1652a1[_0xacf0('0xe')][_0xacf0('0xf')]);return _0x36211(_0x1652a1[_0xacf0('0xe')][_0xacf0('0xf')]);}else{logger['info'](_0xacf0('0xb'),_0x4f4127,'request\x20sent');_0x36211(_0x1652a1[_0xacf0('0x10')][_0xacf0('0xf')]);}})[_0xacf0('0x11')](function(_0x3b1702){logger[_0xacf0('0xe')](_0xacf0('0xb'),_0x4f4127,_0x3b1702);_0x114d81(_0x3b1702);});});}exports[_0xacf0('0x12')]=function(_0x1ca534){var _0x3ce4ca=this;return new Promise(function(_0x39e08c,_0x4a0a6f){return db[_0xacf0('0x13')]['findAll']({'raw':_0x1ca534[_0xacf0('0x14')]?_0x1ca534[_0xacf0('0x14')][_0xacf0('0x15')]===undefined?!![]:![]:!![],'where':_0x1ca534[_0xacf0('0x14')]?_0x1ca534[_0xacf0('0x14')][_0xacf0('0x16')]||null:null,'attributes':_0x1ca534[_0xacf0('0x14')]?_0x1ca534[_0xacf0('0x14')]['attributes']||null:null,'limit':_0x1ca534[_0xacf0('0x14')]?_0x1ca534[_0xacf0('0x14')][_0xacf0('0x17')]||null:null,'include':_0x1ca534[_0xacf0('0x14')]?_0x1ca534['options']['include']?_['map'](_0x1ca534[_0xacf0('0x14')]['include'],function(_0x4ee334){return{'model':db[_0x4ee334[_0xacf0('0x18')]],'as':_0x4ee334['as'],'attributes':_0x4ee334[_0xacf0('0x19')],'include':_0x4ee334[_0xacf0('0x1a')]?_['map'](_0x4ee334[_0xacf0('0x1a')],function(_0x465490){return{'model':db[_0x465490[_0xacf0('0x18')]],'as':_0x465490['as'],'attributes':_0x465490[_0xacf0('0x19')],'include':_0x465490[_0xacf0('0x1a')]?_['map'](_0x465490['include'],function(_0x20f0a6){return{'model':db[_0x20f0a6[_0xacf0('0x18')]],'as':_0x20f0a6['as'],'attributes':_0x20f0a6['attributes']};}):[]};}):[]};}):[]:[]})[_0xacf0('0x9')](function(_0x356f9d){logger[_0xacf0('0xa')]('GetSugarcrmAccount',_0x1ca534);logger[_0xacf0('0x1b')](_0xacf0('0x12'),_0x1ca534,JSON[_0xacf0('0xd')](_0x356f9d));_0x39e08c(_0x356f9d);})[_0xacf0('0x11')](function(_0x4791ea){logger[_0xacf0('0xe')](_0xacf0('0x12'),_0x4791ea['message'],_0x1ca534);_0x4a0a6f(_0x3ce4ca['error'](0x1f4,_0x4791ea[_0xacf0('0xf')]));});});};exports[_0xacf0('0x1c')]=function(_0x2ba227){var _0xce030a=this;return new Promise(function(_0x49b968,_0xfa8842){return db[_0xacf0('0x13')][_0xacf0('0x1d')]({'raw':_0x2ba227[_0xacf0('0x14')]?_0x2ba227['options'][_0xacf0('0x15')]===undefined?!![]:![]:!![],'where':_0x2ba227[_0xacf0('0x14')]?_0x2ba227[_0xacf0('0x14')][_0xacf0('0x16')]||null:null,'attributes':_0x2ba227[_0xacf0('0x14')]?_0x2ba227[_0xacf0('0x14')][_0xacf0('0x19')]||null:null,'include':_0x2ba227[_0xacf0('0x14')]?_0x2ba227['options'][_0xacf0('0x1a')]?_[_0xacf0('0x1e')](_0x2ba227[_0xacf0('0x14')]['include'],function(_0x424fac){return{'model':db[_0x424fac[_0xacf0('0x18')]],'as':_0x424fac['as'],'attributes':_0x424fac[_0xacf0('0x19')],'include':_0x424fac['include']?_[_0xacf0('0x1e')](_0x424fac['include'],function(_0x12f782){return{'model':db[_0x12f782[_0xacf0('0x18')]],'as':_0x12f782['as'],'attributes':_0x12f782[_0xacf0('0x19')],'include':_0x12f782['include']?_[_0xacf0('0x1e')](_0x12f782['include'],function(_0x290555){return{'model':db[_0x290555['model']],'as':_0x290555['as'],'attributes':_0x290555['attributes']};}):[]};}):[]};}):[]:[]})[_0xacf0('0x9')](function(_0x2f97c8){logger['info']('ShowSugarcrmAccount',_0x2ba227);logger[_0xacf0('0x1b')](_0xacf0('0x1c'),_0x2ba227,JSON[_0xacf0('0xd')](_0x2f97c8));_0x49b968(_0x2f97c8);})['catch'](function(_0x44c0e9){logger[_0xacf0('0xe')](_0xacf0('0x1c'),_0x44c0e9[_0xacf0('0xf')],_0x2ba227);_0xfa8842(_0xce030a[_0xacf0('0xe')](0x1f4,_0x44c0e9[_0xacf0('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 2935d75..973b83d 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 _0x1de6=['getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x7bc744,_0x3522cf){var _0x25535a=function(_0xfe5ff){while(--_0xfe5ff){_0x7bc744['push'](_0x7bc744['shift']());}};_0x25535a(++_0x3522cf);}(_0x1de6,0x1d5));var _0x61de=function(_0x3e151d,_0x5b96a8){_0x3e151d=_0x3e151d-0x0;var _0x10ad6a=_0x1de6[_0x3e151d];return _0x10ad6a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x61de('0x0'));var timeout=require(_0x61de('0x1'));var express=require(_0x61de('0x2'));var router=express[_0x61de('0x3')]();var fs_extra=require(_0x61de('0x4'));var auth=require(_0x61de('0x5'));var interaction=require(_0x61de('0x6'));var config=require(_0x61de('0x7'));var controller=require(_0x61de('0x8'));router[_0x61de('0x9')]('/',auth[_0x61de('0xa')](),controller[_0x61de('0xb')]);router[_0x61de('0x9')](_0x61de('0xc'),auth[_0x61de('0xa')](),controller[_0x61de('0xd')]);router[_0x61de('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x61de('0xe')]);router[_0x61de('0x9')]('/:id/subjects',auth[_0x61de('0xa')](),controller[_0x61de('0xf')]);router['get'](_0x61de('0x10'),auth['isAuthenticated'](),controller[_0x61de('0x11')]);router[_0x61de('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x61de('0x13')](_0x61de('0xc'),auth[_0x61de('0xa')](),controller[_0x61de('0x14')]);router[_0x61de('0x15')](_0x61de('0xc'),auth[_0x61de('0xa')](),controller[_0x61de('0x16')]);module['exports']=router; \ No newline at end of file +var _0x8a46=['../../config/environment','get','/:id','isAuthenticated','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x262d37,_0x3a053c){var _0x41304f=function(_0x52971d){while(--_0x52971d){_0x262d37['push'](_0x262d37['shift']());}};_0x41304f(++_0x3a053c);}(_0x8a46,0x1dc));var _0x68a4=function(_0x5380c7,_0x6f2162){_0x5380c7=_0x5380c7-0x0;var _0x352c52=_0x8a46[_0x5380c7];return _0x352c52;};'use strict';var multer=require(_0x68a4('0x0'));var util=require('util');var path=require(_0x68a4('0x1'));var timeout=require(_0x68a4('0x2'));var express=require(_0x68a4('0x3'));var router=express['Router']();var fs_extra=require(_0x68a4('0x4'));var auth=require(_0x68a4('0x5'));var interaction=require(_0x68a4('0x6'));var config=require(_0x68a4('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x68a4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68a4('0x8')](_0x68a4('0x9'),auth[_0x68a4('0xa')](),controller[_0x68a4('0xb')]);router['get']('/:id/fields',auth[_0x68a4('0xa')](),controller[_0x68a4('0xc')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x68a4('0xd')]);router['get'](_0x68a4('0xe'),auth[_0x68a4('0xa')](),controller[_0x68a4('0xf')]);router[_0x68a4('0x10')]('/',auth['isAuthenticated'](),controller[_0x68a4('0x11')]);router[_0x68a4('0x12')](_0x68a4('0x9'),auth[_0x68a4('0xa')](),controller[_0x68a4('0x13')]);router[_0x68a4('0x14')](_0x68a4('0x9'),auth['isAuthenticated'](),controller[_0x68a4('0x15')]);module[_0x68a4('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index cb979a2..0d3ac28 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 _0x8bcf=['sequelize','STRING'];(function(_0x581777,_0x47fb8f){var _0x540122=function(_0x390029){while(--_0x390029){_0x581777['push'](_0x581777['shift']());}};_0x540122(++_0x47fb8f);}(_0x8bcf,0x1c8));var _0xf8bc=function(_0x22b63c,_0x21784d){_0x22b63c=_0x22b63c-0x0;var _0x4a3224=_0x8bcf[_0x22b63c];return _0x4a3224;};'use strict';var Sequelize=require(_0xf8bc('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf8bc('0x1')]}}; \ No newline at end of file +var _0x24ce=['sequelize','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x24ce,0x15c));var _0xe24c=function(_0x2cb767,_0x3ccdc6){_0x2cb767=_0x2cb767-0x0;var _0x19ede4=_0x24ce[_0x2cb767];return _0x19ede4;};'use strict';var Sequelize=require(_0xe24c('0x0'));module['exports']={'name':{'type':Sequelize[_0xe24c('0x1')]},'description':{'type':Sequelize[_0xe24c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index bbc0352..76eca75 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 _0xdb59=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','body','getFields','findOne','order','getSubjects','SugarcrmField','rawAttributes','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','SugarcrmConfiguration','fieldName','type','map','query','keys','filters','intersection','model','attributes'];(function(_0x72607,_0x3a7bb5){var _0x177214=function(_0x28fbb8){while(--_0x28fbb8){_0x72607['push'](_0x72607['shift']());}};_0x177214(++_0x3a7bb5);}(_0xdb59,0xb5));var _0x9db5=function(_0x4b0c3e,_0x50754a){_0x4b0c3e=_0x4b0c3e-0x0;var _0xa99d4e=_0xdb59[_0x4b0c3e];return _0xa99d4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9db5('0x0'));var zipdir=require(_0x9db5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9db5('0x2'));var moment=require(_0x9db5('0x3'));var BPromise=require(_0x9db5('0x4'));var Mustache=require(_0x9db5('0x5'));var util=require(_0x9db5('0x6'));var path=require(_0x9db5('0x7'));var sox=require('sox');var csv=require(_0x9db5('0x8'));var ejs=require(_0x9db5('0x9'));var fs=require('fs');var fs_extra=require(_0x9db5('0xa'));var _=require(_0x9db5('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9db5('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9db5('0xc'));var authService=require(_0x9db5('0xd'));var qs=require(_0x9db5('0xe'));var as=require(_0x9db5('0xf'));var hardwareService=require(_0x9db5('0x10'));var logger=require('../../config/logger')(_0x9db5('0x11'));var utils=require(_0x9db5('0x12'));var config=require(_0x9db5('0x13'));var licenseUtil=require(_0x9db5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xae2758,_0x5efe6b){_0x5efe6b=_0x5efe6b||0xcc;return function(_0x4e5403){if(_0x4e5403){return _0xae2758[_0x9db5('0x15')](_0x5efe6b);}return _0xae2758[_0x9db5('0x16')](_0x5efe6b)[_0x9db5('0x17')]();};}function respondWithResult(_0x4a87c6,_0x2e11e0){_0x2e11e0=_0x2e11e0||0xc8;return function(_0xb83579){if(_0xb83579){return _0x4a87c6[_0x9db5('0x16')](_0x2e11e0)[_0x9db5('0x18')](_0xb83579);}};}function respondWithFilteredResult(_0x3e237f,_0x5125f0){return function(_0x35ddc4){if(_0x35ddc4){var _0x31d998=typeof _0x5125f0['offset']===_0x9db5('0x19')&&typeof _0x5125f0[_0x9db5('0x1a')]==='undefined';var _0x5105a4=_0x35ddc4['count'];var _0x2e8226=_0x31d998?0x0:_0x5125f0[_0x9db5('0x1b')];var _0x4f7c75=_0x31d998?_0x35ddc4[_0x9db5('0x1c')]:_0x5125f0[_0x9db5('0x1b')]+_0x5125f0[_0x9db5('0x1a')];var _0x7218d8;if(_0x4f7c75>=_0x5105a4){_0x4f7c75=_0x5105a4;_0x7218d8=0xc8;}else{_0x7218d8=0xce;}_0x3e237f[_0x9db5('0x16')](_0x7218d8);return _0x3e237f[_0x9db5('0x1d')](_0x9db5('0x1e'),_0x2e8226+'-'+_0x4f7c75+'/'+_0x5105a4)[_0x9db5('0x18')](_0x35ddc4);}return null;};}function patchUpdates(_0x434f50){return function(_0x43967e){try{jsonpatch[_0x9db5('0x1f')](_0x43967e,_0x434f50,!![]);}catch(_0x673b1c){return BPromise['reject'](_0x673b1c);}return _0x43967e[_0x9db5('0x20')]();};}function saveUpdates(_0x54a16a,_0x3ebb8f){return function(_0x38426f){if(_0x38426f){return _0x38426f[_0x9db5('0x21')](_0x54a16a)[_0x9db5('0x22')](function(_0x9f33c1){return _0x9f33c1;});}return null;};}function removeEntity(_0x542a11,_0x54b83d){return function(_0x4afc04){if(_0x4afc04){return _0x4afc04[_0x9db5('0x23')]()[_0x9db5('0x22')](function(){_0x542a11['status'](0xcc)[_0x9db5('0x17')]();});}};}function handleEntityNotFound(_0x4e58dc,_0x394abf){return function(_0x3534d7){if(!_0x3534d7){_0x4e58dc[_0x9db5('0x15')](0x194);}return _0x3534d7;};}function handleError(_0x254eef,_0x2dff5a){_0x2dff5a=_0x2dff5a||0x1f4;return function(_0x36a4e5){logger[_0x9db5('0x24')](_0x36a4e5[_0x9db5('0x25')]);if(_0x36a4e5[_0x9db5('0x26')]){delete _0x36a4e5[_0x9db5('0x26')];}_0x254eef[_0x9db5('0x16')](_0x2dff5a)[_0x9db5('0x27')](_0x36a4e5);};}exports['index']=function(_0x21dd5a,_0x3b177a){var _0x1bb251={},_0x4c450f={},_0x5040d6={'count':0x0,'rows':[]};var _0x142a65=_['map'](db[_0x9db5('0x28')]['rawAttributes'],function(_0x4c4d46){return{'name':_0x4c4d46[_0x9db5('0x29')],'type':_0x4c4d46[_0x9db5('0x2a')]['key']};});_0x4c450f['model']=_[_0x9db5('0x2b')](_0x142a65,_0x9db5('0x26'));_0x4c450f[_0x9db5('0x2c')]=_[_0x9db5('0x2d')](_0x21dd5a[_0x9db5('0x2c')]);_0x4c450f[_0x9db5('0x2e')]=_[_0x9db5('0x2f')](_0x4c450f[_0x9db5('0x30')],_0x4c450f[_0x9db5('0x2c')]);_0x1bb251[_0x9db5('0x31')]=_['intersection'](_0x4c450f[_0x9db5('0x30')],qs[_0x9db5('0x32')](_0x21dd5a[_0x9db5('0x2c')][_0x9db5('0x32')]));_0x1bb251[_0x9db5('0x31')]=_0x1bb251[_0x9db5('0x31')][_0x9db5('0x33')]?_0x1bb251[_0x9db5('0x31')]:_0x4c450f[_0x9db5('0x30')];if(!_0x21dd5a[_0x9db5('0x2c')][_0x9db5('0x34')](_0x9db5('0x35'))){_0x1bb251['limit']=qs['limit'](_0x21dd5a[_0x9db5('0x2c')][_0x9db5('0x1a')]);_0x1bb251[_0x9db5('0x1b')]=qs[_0x9db5('0x1b')](_0x21dd5a[_0x9db5('0x2c')][_0x9db5('0x1b')]);}_0x1bb251['order']=qs[_0x9db5('0x36')](_0x21dd5a[_0x9db5('0x2c')]['sort']);_0x1bb251[_0x9db5('0x37')]=qs['filters'](_[_0x9db5('0x38')](_0x21dd5a[_0x9db5('0x2c')],_0x4c450f[_0x9db5('0x2e')]),_0x142a65);if(_0x21dd5a['query'][_0x9db5('0x39')]){_0x1bb251[_0x9db5('0x37')]=_[_0x9db5('0x3a')](_0x1bb251[_0x9db5('0x37')],{'$or':_['map'](_0x142a65,function(_0xf212eb){if(_0xf212eb['type']!==_0x9db5('0x3b')){var _0x21b776={};_0x21b776[_0xf212eb['name']]={'$like':'%'+_0x21dd5a[_0x9db5('0x2c')]['filter']+'%'};return _0x21b776;}})});}_0x1bb251=_[_0x9db5('0x3a')]({},_0x1bb251,_0x21dd5a[_0x9db5('0x3c')]);var _0x30e845={'where':_0x1bb251['where']};return db[_0x9db5('0x28')][_0x9db5('0x1c')](_0x30e845)[_0x9db5('0x22')](function(_0x323391){_0x5040d6[_0x9db5('0x1c')]=_0x323391;if(_0x21dd5a[_0x9db5('0x2c')]['includeAll']){_0x1bb251[_0x9db5('0x3d')]=[{'all':!![]}];}return db[_0x9db5('0x28')][_0x9db5('0x3e')](_0x1bb251);})[_0x9db5('0x22')](function(_0x53cc7a){_0x5040d6[_0x9db5('0x3f')]=_0x53cc7a;return _0x5040d6;})[_0x9db5('0x22')](respondWithFilteredResult(_0x3b177a,_0x1bb251))[_0x9db5('0x40')](handleError(_0x3b177a,null));};exports[_0x9db5('0x41')]=function(_0x9cf933,_0x59a3af){var _0x37727e={'raw':![],'where':{'id':_0x9cf933[_0x9db5('0x42')]['id']}},_0x250b01={};_0x250b01[_0x9db5('0x30')]=_[_0x9db5('0x2d')](db[_0x9db5('0x28')]['rawAttributes']);_0x250b01['query']=_[_0x9db5('0x2d')](_0x9cf933[_0x9db5('0x2c')]);_0x250b01[_0x9db5('0x2e')]=_[_0x9db5('0x2f')](_0x250b01[_0x9db5('0x30')],_0x250b01['query']);_0x37727e['attributes']=_[_0x9db5('0x2f')](_0x250b01[_0x9db5('0x30')],qs[_0x9db5('0x32')](_0x9cf933[_0x9db5('0x2c')][_0x9db5('0x32')]));_0x37727e[_0x9db5('0x31')]=_0x37727e[_0x9db5('0x31')][_0x9db5('0x33')]?_0x37727e[_0x9db5('0x31')]:_0x250b01[_0x9db5('0x30')];if(_0x9cf933['query'][_0x9db5('0x43')]){_0x37727e[_0x9db5('0x3d')]=[{'all':!![]}];}_0x37727e=_['merge']({},_0x37727e,_0x9cf933[_0x9db5('0x3c')]);return db[_0x9db5('0x28')][_0x9db5('0x44')](_0x37727e)[_0x9db5('0x22')](handleEntityNotFound(_0x59a3af,null))[_0x9db5('0x22')](respondWithResult(_0x59a3af,null))[_0x9db5('0x40')](handleError(_0x59a3af,null));};exports['create']=function(_0x1b91f8,_0x1f3a99){return db[_0x9db5('0x28')]['create'](_0x1b91f8[_0x9db5('0x45')],{})['then'](respondWithResult(_0x1f3a99,0xc9))[_0x9db5('0x40')](handleError(_0x1f3a99,null));};exports[_0x9db5('0x21')]=function(_0x1bea14,_0x41e38e){if(_0x1bea14['body']['id']){delete _0x1bea14['body']['id'];}return db[_0x9db5('0x28')][_0x9db5('0x44')]({'where':{'id':_0x1bea14[_0x9db5('0x42')]['id']}})[_0x9db5('0x22')](handleEntityNotFound(_0x41e38e,null))[_0x9db5('0x22')](saveUpdates(_0x1bea14[_0x9db5('0x45')],null))['then'](respondWithResult(_0x41e38e,null))[_0x9db5('0x40')](handleError(_0x41e38e,null));};exports[_0x9db5('0x23')]=function(_0x5e9fb1,_0x10e6e2){return db[_0x9db5('0x28')][_0x9db5('0x44')]({'where':{'id':_0x5e9fb1[_0x9db5('0x42')]['id']}})[_0x9db5('0x22')](handleEntityNotFound(_0x10e6e2,null))['then'](removeEntity(_0x10e6e2,null))[_0x9db5('0x40')](handleError(_0x10e6e2,null));};exports[_0x9db5('0x46')]=function(_0x3fe3fc,_0x194a9f,_0x3c313){var _0x91ec1d={};var _0x3e55f3={};var _0x4d0236;var _0x10999d;return db[_0x9db5('0x28')][_0x9db5('0x47')]({'where':{'id':_0x3fe3fc[_0x9db5('0x42')]['id']}})[_0x9db5('0x22')](handleEntityNotFound(_0x194a9f,null))[_0x9db5('0x22')](function(_0xa1d7b7){if(_0xa1d7b7){_0x4d0236=_0xa1d7b7;_0x3e55f3['model']=_[_0x9db5('0x2d')](db['SugarcrmField']['rawAttributes']);_0x3e55f3['query']=_[_0x9db5('0x2d')](_0x3fe3fc[_0x9db5('0x2c')]);_0x3e55f3[_0x9db5('0x2e')]=_[_0x9db5('0x2f')](_0x3e55f3[_0x9db5('0x30')],_0x3e55f3[_0x9db5('0x2c')]);_0x91ec1d['attributes']=_[_0x9db5('0x2f')](_0x3e55f3['model'],qs[_0x9db5('0x32')](_0x3fe3fc[_0x9db5('0x2c')][_0x9db5('0x32')]));_0x91ec1d[_0x9db5('0x31')]=_0x91ec1d['attributes']['length']?_0x91ec1d[_0x9db5('0x31')]:_0x3e55f3[_0x9db5('0x30')];_0x91ec1d[_0x9db5('0x48')]=qs['sort'](_0x3fe3fc[_0x9db5('0x2c')]['sort']);_0x91ec1d['where']=qs[_0x9db5('0x2e')](_[_0x9db5('0x38')](_0x3fe3fc[_0x9db5('0x2c')],_0x3e55f3[_0x9db5('0x2e')]));if(_0x3fe3fc[_0x9db5('0x2c')]['filter']){_0x91ec1d[_0x9db5('0x37')]=_[_0x9db5('0x3a')](_0x91ec1d[_0x9db5('0x37')],{'$or':_['map'](_0x91ec1d['attributes'],function(_0xdf709f){var _0x4372b1={};_0x4372b1[_0xdf709f]={'$like':'%'+_0x3fe3fc['query'][_0x9db5('0x39')]+'%'};return _0x4372b1;})});}_0x91ec1d=_[_0x9db5('0x3a')]({},_0x91ec1d,_0x3fe3fc[_0x9db5('0x3c')]);return _0x4d0236[_0x9db5('0x46')](_0x91ec1d);}})[_0x9db5('0x22')](function(_0x597a03){if(_0x597a03){_0x10999d=_0x597a03[_0x9db5('0x33')];if(!_0x3fe3fc['query'][_0x9db5('0x34')](_0x9db5('0x35'))){_0x91ec1d['limit']=qs[_0x9db5('0x1a')](_0x3fe3fc['query'][_0x9db5('0x1a')]);_0x91ec1d[_0x9db5('0x1b')]=qs['offset'](_0x3fe3fc['query'][_0x9db5('0x1b')]);}return _0x4d0236[_0x9db5('0x46')](_0x91ec1d);}})[_0x9db5('0x22')](function(_0x179d96){if(_0x179d96){return _0x179d96?{'count':_0x10999d,'rows':_0x179d96}:null;}})[_0x9db5('0x22')](respondWithResult(_0x194a9f,null))[_0x9db5('0x40')](handleError(_0x194a9f,null));};exports[_0x9db5('0x49')]=function(_0x835e2c,_0x4fa438,_0x22b245){var _0x19c743={};var _0x4a8c96={};var _0x321635;var _0x1343e4;return db[_0x9db5('0x28')]['findOne']({'where':{'id':_0x835e2c[_0x9db5('0x42')]['id']}})[_0x9db5('0x22')](handleEntityNotFound(_0x4fa438,null))[_0x9db5('0x22')](function(_0x1ca7bd){if(_0x1ca7bd){_0x321635=_0x1ca7bd;_0x4a8c96[_0x9db5('0x30')]=_[_0x9db5('0x2d')](db[_0x9db5('0x4a')][_0x9db5('0x4b')]);_0x4a8c96[_0x9db5('0x2c')]=_[_0x9db5('0x2d')](_0x835e2c[_0x9db5('0x2c')]);_0x4a8c96[_0x9db5('0x2e')]=_[_0x9db5('0x2f')](_0x4a8c96[_0x9db5('0x30')],_0x4a8c96[_0x9db5('0x2c')]);_0x19c743['attributes']=_[_0x9db5('0x2f')](_0x4a8c96[_0x9db5('0x30')],qs[_0x9db5('0x32')](_0x835e2c[_0x9db5('0x2c')][_0x9db5('0x32')]));_0x19c743[_0x9db5('0x31')]=_0x19c743[_0x9db5('0x31')][_0x9db5('0x33')]?_0x19c743['attributes']:_0x4a8c96[_0x9db5('0x30')];_0x19c743[_0x9db5('0x48')]=qs[_0x9db5('0x36')](_0x835e2c[_0x9db5('0x2c')][_0x9db5('0x36')]);_0x19c743[_0x9db5('0x37')]=qs[_0x9db5('0x2e')](_[_0x9db5('0x38')](_0x835e2c[_0x9db5('0x2c')],_0x4a8c96['filters']));if(_0x835e2c[_0x9db5('0x2c')][_0x9db5('0x39')]){_0x19c743[_0x9db5('0x37')]=_[_0x9db5('0x3a')](_0x19c743[_0x9db5('0x37')],{'$or':_['map'](_0x19c743[_0x9db5('0x31')],function(_0x39cd56){var _0x2f0b97={};_0x2f0b97[_0x39cd56]={'$like':'%'+_0x835e2c[_0x9db5('0x2c')][_0x9db5('0x39')]+'%'};return _0x2f0b97;})});}_0x19c743=_[_0x9db5('0x3a')]({},_0x19c743,_0x835e2c[_0x9db5('0x3c')]);return _0x321635[_0x9db5('0x49')](_0x19c743);}})['then'](function(_0x5e1f91){if(_0x5e1f91){_0x1343e4=_0x5e1f91['length'];if(!_0x835e2c[_0x9db5('0x2c')]['hasOwnProperty'](_0x9db5('0x35'))){_0x19c743[_0x9db5('0x1a')]=qs[_0x9db5('0x1a')](_0x835e2c[_0x9db5('0x2c')][_0x9db5('0x1a')]);_0x19c743[_0x9db5('0x1b')]=qs['offset'](_0x835e2c[_0x9db5('0x2c')][_0x9db5('0x1b')]);}return _0x321635['getSubjects'](_0x19c743);}})['then'](function(_0x1b945d){if(_0x1b945d){return _0x1b945d?{'count':_0x1343e4,'rows':_0x1b945d}:null;}})['then'](respondWithResult(_0x4fa438,null))[_0x9db5('0x40')](handleError(_0x4fa438,null));};exports[_0x9db5('0x4c')]=function(_0xf755de,_0x423a39,_0x5c8425){var _0x3b3f2e={};var _0x5ea443={};var _0x3b1677;var _0x4492bc;return db[_0x9db5('0x28')][_0x9db5('0x47')]({'where':{'id':_0xf755de[_0x9db5('0x42')]['id']}})[_0x9db5('0x22')](handleEntityNotFound(_0x423a39,null))['then'](function(_0x3cd4ed){if(_0x3cd4ed){_0x3b1677=_0x3cd4ed;_0x5ea443[_0x9db5('0x30')]=_[_0x9db5('0x2d')](db[_0x9db5('0x4a')][_0x9db5('0x4b')]);_0x5ea443[_0x9db5('0x2c')]=_[_0x9db5('0x2d')](_0xf755de['query']);_0x5ea443[_0x9db5('0x2e')]=_[_0x9db5('0x2f')](_0x5ea443[_0x9db5('0x30')],_0x5ea443['query']);_0x3b3f2e[_0x9db5('0x31')]=_['intersection'](_0x5ea443[_0x9db5('0x30')],qs[_0x9db5('0x32')](_0xf755de['query'][_0x9db5('0x32')]));_0x3b3f2e[_0x9db5('0x31')]=_0x3b3f2e['attributes'][_0x9db5('0x33')]?_0x3b3f2e[_0x9db5('0x31')]:_0x5ea443['model'];_0x3b3f2e[_0x9db5('0x48')]=qs[_0x9db5('0x36')](_0xf755de['query']['sort']);_0x3b3f2e[_0x9db5('0x37')]=qs[_0x9db5('0x2e')](_['pick'](_0xf755de['query'],_0x5ea443[_0x9db5('0x2e')]));if(_0xf755de['query'][_0x9db5('0x39')]){_0x3b3f2e['where']=_[_0x9db5('0x3a')](_0x3b3f2e['where'],{'$or':_[_0x9db5('0x2b')](_0x3b3f2e[_0x9db5('0x31')],function(_0x2c7371){var _0x33a6de={};_0x33a6de[_0x2c7371]={'$like':'%'+_0xf755de[_0x9db5('0x2c')]['filter']+'%'};return _0x33a6de;})});}_0x3b3f2e=_[_0x9db5('0x3a')]({},_0x3b3f2e,_0xf755de[_0x9db5('0x3c')]);return _0x3b1677[_0x9db5('0x4c')](_0x3b3f2e);}})[_0x9db5('0x22')](function(_0x3c0f87){if(_0x3c0f87){_0x4492bc=_0x3c0f87[_0x9db5('0x33')];if(!_0xf755de['query'][_0x9db5('0x34')](_0x9db5('0x35'))){_0x3b3f2e[_0x9db5('0x1a')]=qs['limit'](_0xf755de[_0x9db5('0x2c')][_0x9db5('0x1a')]);_0x3b3f2e[_0x9db5('0x1b')]=qs[_0x9db5('0x1b')](_0xf755de[_0x9db5('0x2c')][_0x9db5('0x1b')]);}return _0x3b1677[_0x9db5('0x4c')](_0x3b3f2e);}})[_0x9db5('0x22')](function(_0x3ddcdb){if(_0x3ddcdb){return _0x3ddcdb?{'count':_0x4492bc,'rows':_0x3ddcdb}:null;}})[_0x9db5('0x22')](respondWithResult(_0x423a39,null))[_0x9db5('0x40')](handleError(_0x423a39,null));}; \ No newline at end of file +var _0xcfe2=['keys','intersection','model','query','attributes','fields','length','hasOwnProperty','order','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','update','getFields','findOne','sort','getSubjects','SugarcrmField','nolimit','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key'];(function(_0x217663,_0x3ccf32){var _0x452205=function(_0x414e3a){while(--_0x414e3a){_0x217663['push'](_0x217663['shift']());}};_0x452205(++_0x3ccf32);}(_0xcfe2,0xc0));var _0x2cfe=function(_0xabda11,_0x461518){_0xabda11=_0xabda11-0x0;var _0xda5e9f=_0xcfe2[_0xabda11];return _0xda5e9f;};'use strict';var emlformat=require(_0x2cfe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2cfe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cfe('0x2'));var moment=require(_0x2cfe('0x3'));var BPromise=require(_0x2cfe('0x4'));var Mustache=require('mustache');var util=require(_0x2cfe('0x5'));var path=require(_0x2cfe('0x6'));var sox=require(_0x2cfe('0x7'));var csv=require(_0x2cfe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2cfe('0x9'));var _=require(_0x2cfe('0xa'));var squel=require(_0x2cfe('0xb'));var crypto=require(_0x2cfe('0xc'));var jsforce=require(_0x2cfe('0xd'));var deskjs=require(_0x2cfe('0xe'));var toCsv=require(_0x2cfe('0x8'));var querystring=require(_0x2cfe('0xf'));var Papa=require('papaparse');var Redis=require(_0x2cfe('0x10'));var authService=require(_0x2cfe('0x11'));var qs=require(_0x2cfe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2cfe('0x13'))(_0x2cfe('0x14'));var utils=require('../../config/utils');var config=require(_0x2cfe('0x15'));var licenseUtil=require(_0x2cfe('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15eca2,_0xe38fac){_0xe38fac=_0xe38fac||0xcc;return function(_0x5a0016){if(_0x5a0016){return _0x15eca2[_0x2cfe('0x17')](_0xe38fac);}return _0x15eca2[_0x2cfe('0x18')](_0xe38fac)[_0x2cfe('0x19')]();};}function respondWithResult(_0xf23a39,_0x437078){_0x437078=_0x437078||0xc8;return function(_0x5234ea){if(_0x5234ea){return _0xf23a39[_0x2cfe('0x18')](_0x437078)[_0x2cfe('0x1a')](_0x5234ea);}};}function respondWithFilteredResult(_0x4952ab,_0x2099ea){return function(_0x39b76f){if(_0x39b76f){var _0x39e3d9=typeof _0x2099ea['offset']===_0x2cfe('0x1b')&&typeof _0x2099ea[_0x2cfe('0x1c')]===_0x2cfe('0x1b');var _0x4e80a4=_0x39b76f['count'];var _0x3e76db=_0x39e3d9?0x0:_0x2099ea[_0x2cfe('0x1d')];var _0x5a0bf4=_0x39e3d9?_0x39b76f[_0x2cfe('0x1e')]:_0x2099ea[_0x2cfe('0x1d')]+_0x2099ea[_0x2cfe('0x1c')];var _0x828f3a;if(_0x5a0bf4>=_0x4e80a4){_0x5a0bf4=_0x4e80a4;_0x828f3a=0xc8;}else{_0x828f3a=0xce;}_0x4952ab[_0x2cfe('0x18')](_0x828f3a);return _0x4952ab[_0x2cfe('0x1f')](_0x2cfe('0x20'),_0x3e76db+'-'+_0x5a0bf4+'/'+_0x4e80a4)[_0x2cfe('0x1a')](_0x39b76f);}return null;};}function patchUpdates(_0x2bf637){return function(_0x26e545){try{jsonpatch[_0x2cfe('0x21')](_0x26e545,_0x2bf637,!![]);}catch(_0x3f7b09){return BPromise[_0x2cfe('0x22')](_0x3f7b09);}return _0x26e545[_0x2cfe('0x23')]();};}function saveUpdates(_0x257f06,_0xf76583){return function(_0x295972){if(_0x295972){return _0x295972['update'](_0x257f06)[_0x2cfe('0x24')](function(_0x30076b){return _0x30076b;});}return null;};}function removeEntity(_0x322962,_0xc8dd18){return function(_0x332d49){if(_0x332d49){return _0x332d49[_0x2cfe('0x25')]()[_0x2cfe('0x24')](function(){_0x322962[_0x2cfe('0x18')](0xcc)[_0x2cfe('0x19')]();});}};}function handleEntityNotFound(_0x3740bd,_0x5bec4e){return function(_0x159de5){if(!_0x159de5){_0x3740bd[_0x2cfe('0x17')](0x194);}return _0x159de5;};}function handleError(_0x14ad79,_0x1da280){_0x1da280=_0x1da280||0x1f4;return function(_0x36afbc){logger[_0x2cfe('0x26')](_0x36afbc[_0x2cfe('0x27')]);if(_0x36afbc['name']){delete _0x36afbc[_0x2cfe('0x28')];}_0x14ad79[_0x2cfe('0x18')](_0x1da280)[_0x2cfe('0x29')](_0x36afbc);};}exports['index']=function(_0x309cb2,_0x4281d1){var _0x1a7943={},_0x3624fc={},_0x5d5d8a={'count':0x0,'rows':[]};var _0x4b5823=_[_0x2cfe('0x2a')](db[_0x2cfe('0x2b')][_0x2cfe('0x2c')],function(_0x20efae){return{'name':_0x20efae[_0x2cfe('0x2d')],'type':_0x20efae[_0x2cfe('0x2e')][_0x2cfe('0x2f')]};});_0x3624fc['model']=_[_0x2cfe('0x2a')](_0x4b5823,'name');_0x3624fc['query']=_[_0x2cfe('0x30')](_0x309cb2['query']);_0x3624fc['filters']=_[_0x2cfe('0x31')](_0x3624fc[_0x2cfe('0x32')],_0x3624fc[_0x2cfe('0x33')]);_0x1a7943[_0x2cfe('0x34')]=_['intersection'](_0x3624fc[_0x2cfe('0x32')],qs[_0x2cfe('0x35')](_0x309cb2['query'][_0x2cfe('0x35')]));_0x1a7943['attributes']=_0x1a7943[_0x2cfe('0x34')][_0x2cfe('0x36')]?_0x1a7943[_0x2cfe('0x34')]:_0x3624fc['model'];if(!_0x309cb2[_0x2cfe('0x33')][_0x2cfe('0x37')]('nolimit')){_0x1a7943[_0x2cfe('0x1c')]=qs[_0x2cfe('0x1c')](_0x309cb2[_0x2cfe('0x33')][_0x2cfe('0x1c')]);_0x1a7943[_0x2cfe('0x1d')]=qs[_0x2cfe('0x1d')](_0x309cb2['query'][_0x2cfe('0x1d')]);}_0x1a7943[_0x2cfe('0x38')]=qs['sort'](_0x309cb2[_0x2cfe('0x33')]['sort']);_0x1a7943[_0x2cfe('0x39')]=qs[_0x2cfe('0x3a')](_[_0x2cfe('0x3b')](_0x309cb2[_0x2cfe('0x33')],_0x3624fc[_0x2cfe('0x3a')]),_0x4b5823);if(_0x309cb2[_0x2cfe('0x33')][_0x2cfe('0x3c')]){_0x1a7943[_0x2cfe('0x39')]=_['merge'](_0x1a7943[_0x2cfe('0x39')],{'$or':_['map'](_0x4b5823,function(_0x1eced8){if(_0x1eced8['type']!=='VIRTUAL'){var _0x1b4e77={};_0x1b4e77[_0x1eced8[_0x2cfe('0x28')]]={'$like':'%'+_0x309cb2['query'][_0x2cfe('0x3c')]+'%'};return _0x1b4e77;}})});}_0x1a7943=_[_0x2cfe('0x3d')]({},_0x1a7943,_0x309cb2[_0x2cfe('0x3e')]);var _0x20bf03={'where':_0x1a7943[_0x2cfe('0x39')]};return db[_0x2cfe('0x2b')][_0x2cfe('0x1e')](_0x20bf03)['then'](function(_0x1bb40a){_0x5d5d8a[_0x2cfe('0x1e')]=_0x1bb40a;if(_0x309cb2[_0x2cfe('0x33')][_0x2cfe('0x3f')]){_0x1a7943[_0x2cfe('0x40')]=[{'all':!![]}];}return db[_0x2cfe('0x2b')]['findAll'](_0x1a7943);})[_0x2cfe('0x24')](function(_0x339c0a){_0x5d5d8a[_0x2cfe('0x41')]=_0x339c0a;return _0x5d5d8a;})[_0x2cfe('0x24')](respondWithFilteredResult(_0x4281d1,_0x1a7943))[_0x2cfe('0x42')](handleError(_0x4281d1,null));};exports[_0x2cfe('0x43')]=function(_0x1ddd00,_0x52b983){var _0x249484={'raw':![],'where':{'id':_0x1ddd00[_0x2cfe('0x44')]['id']}},_0x37251c={};_0x37251c[_0x2cfe('0x32')]=_[_0x2cfe('0x30')](db[_0x2cfe('0x2b')][_0x2cfe('0x2c')]);_0x37251c['query']=_['keys'](_0x1ddd00['query']);_0x37251c['filters']=_[_0x2cfe('0x31')](_0x37251c[_0x2cfe('0x32')],_0x37251c[_0x2cfe('0x33')]);_0x249484[_0x2cfe('0x34')]=_[_0x2cfe('0x31')](_0x37251c['model'],qs['fields'](_0x1ddd00[_0x2cfe('0x33')][_0x2cfe('0x35')]));_0x249484[_0x2cfe('0x34')]=_0x249484[_0x2cfe('0x34')][_0x2cfe('0x36')]?_0x249484['attributes']:_0x37251c['model'];if(_0x1ddd00['query'][_0x2cfe('0x3f')]){_0x249484[_0x2cfe('0x40')]=[{'all':!![]}];}_0x249484=_['merge']({},_0x249484,_0x1ddd00['options']);return db[_0x2cfe('0x2b')][_0x2cfe('0x45')](_0x249484)[_0x2cfe('0x24')](handleEntityNotFound(_0x52b983,null))[_0x2cfe('0x24')](respondWithResult(_0x52b983,null))[_0x2cfe('0x42')](handleError(_0x52b983,null));};exports['create']=function(_0x59ce7d,_0x321444){return db[_0x2cfe('0x2b')][_0x2cfe('0x46')](_0x59ce7d[_0x2cfe('0x47')],{})['then'](respondWithResult(_0x321444,0xc9))['catch'](handleError(_0x321444,null));};exports[_0x2cfe('0x48')]=function(_0x12ae7f,_0x592710){if(_0x12ae7f[_0x2cfe('0x47')]['id']){delete _0x12ae7f[_0x2cfe('0x47')]['id'];}return db['SugarcrmConfiguration'][_0x2cfe('0x45')]({'where':{'id':_0x12ae7f['params']['id']}})['then'](handleEntityNotFound(_0x592710,null))[_0x2cfe('0x24')](saveUpdates(_0x12ae7f[_0x2cfe('0x47')],null))[_0x2cfe('0x24')](respondWithResult(_0x592710,null))[_0x2cfe('0x42')](handleError(_0x592710,null));};exports[_0x2cfe('0x25')]=function(_0x1ae40e,_0x1a59c4){return db[_0x2cfe('0x2b')][_0x2cfe('0x45')]({'where':{'id':_0x1ae40e[_0x2cfe('0x44')]['id']}})[_0x2cfe('0x24')](handleEntityNotFound(_0x1a59c4,null))['then'](removeEntity(_0x1a59c4,null))[_0x2cfe('0x42')](handleError(_0x1a59c4,null));};exports[_0x2cfe('0x49')]=function(_0x47479e,_0x1b6635,_0x326228){var _0x5d9e8e={};var _0x251f57={};var _0x5d1cb;var _0x418526;return db[_0x2cfe('0x2b')][_0x2cfe('0x4a')]({'where':{'id':_0x47479e[_0x2cfe('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b6635,null))[_0x2cfe('0x24')](function(_0x13d924){if(_0x13d924){_0x5d1cb=_0x13d924;_0x251f57[_0x2cfe('0x32')]=_['keys'](db['SugarcrmField'][_0x2cfe('0x2c')]);_0x251f57[_0x2cfe('0x33')]=_[_0x2cfe('0x30')](_0x47479e[_0x2cfe('0x33')]);_0x251f57[_0x2cfe('0x3a')]=_['intersection'](_0x251f57['model'],_0x251f57['query']);_0x5d9e8e[_0x2cfe('0x34')]=_[_0x2cfe('0x31')](_0x251f57['model'],qs[_0x2cfe('0x35')](_0x47479e[_0x2cfe('0x33')][_0x2cfe('0x35')]));_0x5d9e8e['attributes']=_0x5d9e8e['attributes'][_0x2cfe('0x36')]?_0x5d9e8e['attributes']:_0x251f57[_0x2cfe('0x32')];_0x5d9e8e[_0x2cfe('0x38')]=qs[_0x2cfe('0x4b')](_0x47479e[_0x2cfe('0x33')]['sort']);_0x5d9e8e[_0x2cfe('0x39')]=qs[_0x2cfe('0x3a')](_[_0x2cfe('0x3b')](_0x47479e[_0x2cfe('0x33')],_0x251f57['filters']));if(_0x47479e['query']['filter']){_0x5d9e8e[_0x2cfe('0x39')]=_['merge'](_0x5d9e8e[_0x2cfe('0x39')],{'$or':_['map'](_0x5d9e8e[_0x2cfe('0x34')],function(_0x12916f){var _0x4a959c={};_0x4a959c[_0x12916f]={'$like':'%'+_0x47479e[_0x2cfe('0x33')][_0x2cfe('0x3c')]+'%'};return _0x4a959c;})});}_0x5d9e8e=_[_0x2cfe('0x3d')]({},_0x5d9e8e,_0x47479e[_0x2cfe('0x3e')]);return _0x5d1cb[_0x2cfe('0x49')](_0x5d9e8e);}})[_0x2cfe('0x24')](function(_0x27598d){if(_0x27598d){_0x418526=_0x27598d[_0x2cfe('0x36')];if(!_0x47479e[_0x2cfe('0x33')][_0x2cfe('0x37')]('nolimit')){_0x5d9e8e['limit']=qs[_0x2cfe('0x1c')](_0x47479e[_0x2cfe('0x33')][_0x2cfe('0x1c')]);_0x5d9e8e[_0x2cfe('0x1d')]=qs['offset'](_0x47479e['query']['offset']);}return _0x5d1cb[_0x2cfe('0x49')](_0x5d9e8e);}})['then'](function(_0x493987){if(_0x493987){return _0x493987?{'count':_0x418526,'rows':_0x493987}:null;}})[_0x2cfe('0x24')](respondWithResult(_0x1b6635,null))[_0x2cfe('0x42')](handleError(_0x1b6635,null));};exports[_0x2cfe('0x4c')]=function(_0x32905f,_0x5de3c2,_0x3cf573){var _0x3d1479={};var _0x222bc5={};var _0x1400ff;var _0xb8bf8c;return db[_0x2cfe('0x2b')]['findOne']({'where':{'id':_0x32905f[_0x2cfe('0x44')]['id']}})[_0x2cfe('0x24')](handleEntityNotFound(_0x5de3c2,null))[_0x2cfe('0x24')](function(_0x17ef80){if(_0x17ef80){_0x1400ff=_0x17ef80;_0x222bc5[_0x2cfe('0x32')]=_[_0x2cfe('0x30')](db[_0x2cfe('0x4d')][_0x2cfe('0x2c')]);_0x222bc5[_0x2cfe('0x33')]=_['keys'](_0x32905f[_0x2cfe('0x33')]);_0x222bc5['filters']=_[_0x2cfe('0x31')](_0x222bc5['model'],_0x222bc5[_0x2cfe('0x33')]);_0x3d1479[_0x2cfe('0x34')]=_['intersection'](_0x222bc5[_0x2cfe('0x32')],qs[_0x2cfe('0x35')](_0x32905f[_0x2cfe('0x33')][_0x2cfe('0x35')]));_0x3d1479[_0x2cfe('0x34')]=_0x3d1479[_0x2cfe('0x34')][_0x2cfe('0x36')]?_0x3d1479[_0x2cfe('0x34')]:_0x222bc5[_0x2cfe('0x32')];_0x3d1479[_0x2cfe('0x38')]=qs[_0x2cfe('0x4b')](_0x32905f[_0x2cfe('0x33')][_0x2cfe('0x4b')]);_0x3d1479[_0x2cfe('0x39')]=qs[_0x2cfe('0x3a')](_['pick'](_0x32905f[_0x2cfe('0x33')],_0x222bc5[_0x2cfe('0x3a')]));if(_0x32905f['query']['filter']){_0x3d1479['where']=_[_0x2cfe('0x3d')](_0x3d1479['where'],{'$or':_[_0x2cfe('0x2a')](_0x3d1479['attributes'],function(_0x443a67){var _0x2dacf3={};_0x2dacf3[_0x443a67]={'$like':'%'+_0x32905f[_0x2cfe('0x33')]['filter']+'%'};return _0x2dacf3;})});}_0x3d1479=_[_0x2cfe('0x3d')]({},_0x3d1479,_0x32905f['options']);return _0x1400ff[_0x2cfe('0x4c')](_0x3d1479);}})[_0x2cfe('0x24')](function(_0x1c0f34){if(_0x1c0f34){_0xb8bf8c=_0x1c0f34['length'];if(!_0x32905f[_0x2cfe('0x33')]['hasOwnProperty'](_0x2cfe('0x4e'))){_0x3d1479[_0x2cfe('0x1c')]=qs[_0x2cfe('0x1c')](_0x32905f[_0x2cfe('0x33')][_0x2cfe('0x1c')]);_0x3d1479[_0x2cfe('0x1d')]=qs[_0x2cfe('0x1d')](_0x32905f[_0x2cfe('0x33')][_0x2cfe('0x1d')]);}return _0x1400ff[_0x2cfe('0x4c')](_0x3d1479);}})['then'](function(_0x37ac41){if(_0x37ac41){return _0x37ac41?{'count':_0xb8bf8c,'rows':_0x37ac41}:null;}})[_0x2cfe('0x24')](respondWithResult(_0x5de3c2,null))[_0x2cfe('0x42')](handleError(_0x5de3c2,null));};exports[_0x2cfe('0x4f')]=function(_0x263ea8,_0x294bf1,_0x2c41c4){var _0x26dd33={};var _0x11aa19={};var _0x35989f;var _0x49a9d4;return db[_0x2cfe('0x2b')]['findOne']({'where':{'id':_0x263ea8[_0x2cfe('0x44')]['id']}})[_0x2cfe('0x24')](handleEntityNotFound(_0x294bf1,null))[_0x2cfe('0x24')](function(_0x2527fd){if(_0x2527fd){_0x35989f=_0x2527fd;_0x11aa19[_0x2cfe('0x32')]=_[_0x2cfe('0x30')](db[_0x2cfe('0x4d')][_0x2cfe('0x2c')]);_0x11aa19[_0x2cfe('0x33')]=_[_0x2cfe('0x30')](_0x263ea8[_0x2cfe('0x33')]);_0x11aa19[_0x2cfe('0x3a')]=_[_0x2cfe('0x31')](_0x11aa19[_0x2cfe('0x32')],_0x11aa19[_0x2cfe('0x33')]);_0x26dd33[_0x2cfe('0x34')]=_['intersection'](_0x11aa19[_0x2cfe('0x32')],qs[_0x2cfe('0x35')](_0x263ea8['query'][_0x2cfe('0x35')]));_0x26dd33['attributes']=_0x26dd33[_0x2cfe('0x34')][_0x2cfe('0x36')]?_0x26dd33[_0x2cfe('0x34')]:_0x11aa19[_0x2cfe('0x32')];_0x26dd33['order']=qs[_0x2cfe('0x4b')](_0x263ea8[_0x2cfe('0x33')][_0x2cfe('0x4b')]);_0x26dd33['where']=qs[_0x2cfe('0x3a')](_['pick'](_0x263ea8[_0x2cfe('0x33')],_0x11aa19[_0x2cfe('0x3a')]));if(_0x263ea8['query'][_0x2cfe('0x3c')]){_0x26dd33[_0x2cfe('0x39')]=_[_0x2cfe('0x3d')](_0x26dd33[_0x2cfe('0x39')],{'$or':_[_0x2cfe('0x2a')](_0x26dd33['attributes'],function(_0x5b5373){var _0x3cd9e4={};_0x3cd9e4[_0x5b5373]={'$like':'%'+_0x263ea8[_0x2cfe('0x33')]['filter']+'%'};return _0x3cd9e4;})});}_0x26dd33=_[_0x2cfe('0x3d')]({},_0x26dd33,_0x263ea8['options']);return _0x35989f[_0x2cfe('0x4f')](_0x26dd33);}})[_0x2cfe('0x24')](function(_0x2942fb){if(_0x2942fb){_0x49a9d4=_0x2942fb[_0x2cfe('0x36')];if(!_0x263ea8['query'][_0x2cfe('0x37')](_0x2cfe('0x4e'))){_0x26dd33[_0x2cfe('0x1c')]=qs[_0x2cfe('0x1c')](_0x263ea8[_0x2cfe('0x33')][_0x2cfe('0x1c')]);_0x26dd33['offset']=qs[_0x2cfe('0x1d')](_0x263ea8[_0x2cfe('0x33')][_0x2cfe('0x1d')]);}return _0x35989f[_0x2cfe('0x4f')](_0x26dd33);}})[_0x2cfe('0x24')](function(_0x3bca9d){if(_0x3bca9d){return _0x3bca9d?{'count':_0x49a9d4,'rows':_0x3bca9d}:null;}})[_0x2cfe('0x24')](respondWithResult(_0x294bf1,null))[_0x2cfe('0x42')](handleError(_0x294bf1,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index c8eed15..c05e23e 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 _0xa67a=['path','./intSugarcrmConfiguration.attributes','exports','define','lodash','util','bluebird','request-promise'];(function(_0x59dc02,_0x120477){var _0x556178=function(_0x583273){while(--_0x583273){_0x59dc02['push'](_0x59dc02['shift']());}};_0x556178(++_0x120477);}(_0xa67a,0xb4));var _0xaa67=function(_0x3cc91b,_0x250f20){_0x3cc91b=_0x3cc91b-0x0;var _0x1dafcc=_0xa67a[_0x3cc91b];return _0x1dafcc;};'use strict';var _=require(_0xaa67('0x0'));var util=require(_0xaa67('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xaa67('0x2'));var rp=require(_0xaa67('0x3'));var fs=require('fs');var path=require(_0xaa67('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaa67('0x5'));module[_0xaa67('0x6')]=function(_0x5cb915,_0xf70676){return _0x5cb915[_0xaa67('0x7')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd15f=['request-promise','./intSugarcrmConfiguration.attributes','define','int_sugarcrm_configurations','../../config/logger','api','moment'];(function(_0x3062cb,_0x44ca12){var _0xf29731=function(_0x11fc4b){while(--_0x11fc4b){_0x3062cb['push'](_0x3062cb['shift']());}};_0xf29731(++_0x44ca12);}(_0xd15f,0x1bd));var _0xfd15=function(_0x514c15,_0x486901){_0x514c15=_0x514c15-0x0;var _0x16283e=_0xd15f[_0x514c15];return _0x16283e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfd15('0x0'))(_0xfd15('0x1'));var moment=require(_0xfd15('0x2'));var BPromise=require('bluebird');var rp=require(_0xfd15('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfd15('0x4'));module['exports']=function(_0x222fdd,_0x5d4358){return _0x222fdd[_0xfd15('0x5')]('SugarcrmConfiguration',attributes,{'tableName':_0xfd15('0x6'),'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 6b660b2..48309ce 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 _0x7a9e=['client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5eddbf,_0x3208b4){var _0x2ec1d5=function(_0x508db0){while(--_0x508db0){_0x5eddbf['push'](_0x5eddbf['shift']());}};_0x2ec1d5(++_0x3208b4);}(_0x7a9e,0x1c2));var _0xe7a9=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x7a9e[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xe7a9('0x0'));var util=require('util');var moment=require(_0xe7a9('0x1'));var BPromise=require(_0xe7a9('0x2'));var rs=require(_0xe7a9('0x3'));var fs=require('fs');var Redis=require(_0xe7a9('0x4'));var db=require(_0xe7a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7a9('0x6'))(_0xe7a9('0x7'));var config=require(_0xe7a9('0x8'));var jayson=require(_0xe7a9('0x9'));var client=jayson[_0xe7a9('0xa')][_0xe7a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50531f,_0x3ec841,_0x6cd189){return new BPromise(function(_0x2ff746,_0x528bfa){return client[_0xe7a9('0xc')](_0x50531f,_0x6cd189)[_0xe7a9('0xd')](function(_0x186311){logger[_0xe7a9('0xe')](_0xe7a9('0xf'),_0x3ec841,_0xe7a9('0x10'));logger['debug'](_0xe7a9('0x11'),_0x3ec841,_0xe7a9('0x10'),JSON[_0xe7a9('0x12')](_0x186311));if(_0x186311['error']){if(_0x186311[_0xe7a9('0x13')][_0xe7a9('0x14')]===0x1f4){logger[_0xe7a9('0x13')](_0xe7a9('0xf'),_0x3ec841,_0x186311[_0xe7a9('0x13')][_0xe7a9('0x15')]);return _0x528bfa(_0x186311[_0xe7a9('0x13')]['message']);}logger['error'](_0xe7a9('0xf'),_0x3ec841,_0x186311['error'][_0xe7a9('0x15')]);return _0x2ff746(_0x186311[_0xe7a9('0x13')]['message']);}else{logger[_0xe7a9('0xe')](_0xe7a9('0xf'),_0x3ec841,_0xe7a9('0x10'));_0x2ff746(_0x186311[_0xe7a9('0x16')][_0xe7a9('0x15')]);}})['catch'](function(_0x47945f){logger[_0xe7a9('0x13')](_0xe7a9('0xf'),_0x3ec841,_0x47945f);_0x528bfa(_0x47945f);});});} \ No newline at end of file +var _0x6439=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','ioredis'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0x6439,0x1db));var _0x9643=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x6439[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0x9643('0x0'));var util=require(_0x9643('0x1'));var moment=require(_0x9643('0x2'));var BPromise=require(_0x9643('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9643('0x4'));var db=require(_0x9643('0x5'))['db'];var utils=require(_0x9643('0x6'));var logger=require(_0x9643('0x7'))(_0x9643('0x8'));var config=require('../../config/environment');var jayson=require(_0x9643('0x9'));var client=jayson['client'][_0x9643('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c423d,_0x47cf20,_0x1c9a1f){return new BPromise(function(_0x51e72e,_0x40de93){return client['request'](_0x1c423d,_0x1c9a1f)[_0x9643('0xb')](function(_0x58ce77){logger[_0x9643('0xc')](_0x9643('0xd'),_0x47cf20,_0x9643('0xe'));logger[_0x9643('0xf')](_0x9643('0x10'),_0x47cf20,'request\x20sent',JSON['stringify'](_0x58ce77));if(_0x58ce77[_0x9643('0x11')]){if(_0x58ce77[_0x9643('0x11')][_0x9643('0x12')]===0x1f4){logger[_0x9643('0x11')](_0x9643('0xd'),_0x47cf20,_0x58ce77['error'][_0x9643('0x13')]);return _0x40de93(_0x58ce77[_0x9643('0x11')][_0x9643('0x13')]);}logger['error'](_0x9643('0xd'),_0x47cf20,_0x58ce77[_0x9643('0x11')][_0x9643('0x13')]);return _0x51e72e(_0x58ce77[_0x9643('0x11')][_0x9643('0x13')]);}else{logger['info'](_0x9643('0xd'),_0x47cf20,_0x9643('0xe'));_0x51e72e(_0x58ce77['result'][_0x9643('0x13')]);}})['catch'](function(_0x352de5){logger['error'](_0x9643('0xd'),_0x47cf20,_0x352de5);_0x40de93(_0x352de5);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index c615ffe..709cc67 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 _0x4691=['index','show','post','create','update','delete','/:id','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x4691,0xf5));var _0x1469=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x4691[_0x5a79e2];return _0x266c45;};'use strict';var multer=require('multer');var util=require(_0x1469('0x0'));var path=require(_0x1469('0x1'));var timeout=require(_0x1469('0x2'));var express=require(_0x1469('0x3'));var router=express[_0x1469('0x4')]();var fs_extra=require(_0x1469('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1469('0x6'));var config=require('../../config/environment');var controller=require(_0x1469('0x7'));router[_0x1469('0x8')]('/',auth[_0x1469('0x9')](),controller[_0x1469('0xa')]);router[_0x1469('0x8')]('/:id',auth[_0x1469('0x9')](),controller[_0x1469('0xb')]);router[_0x1469('0xc')]('/',auth[_0x1469('0x9')](),controller[_0x1469('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1469('0xe')]);router[_0x1469('0xf')](_0x1469('0x10'),auth[_0x1469('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7332=['/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x2dc377,_0x126e94){var _0x1e7038=function(_0x5c35d3){while(--_0x5c35d3){_0x2dc377['push'](_0x2dc377['shift']());}};_0x1e7038(++_0x126e94);}(_0x7332,0x67));var _0x2733=function(_0xe25195,_0x82560b){_0xe25195=_0xe25195-0x0;var _0x39485b=_0x7332[_0xe25195];return _0x39485b;};'use strict';var multer=require(_0x2733('0x0'));var util=require('util');var path=require(_0x2733('0x1'));var timeout=require(_0x2733('0x2'));var express=require(_0x2733('0x3'));var router=express[_0x2733('0x4')]();var fs_extra=require(_0x2733('0x5'));var auth=require(_0x2733('0x6'));var interaction=require(_0x2733('0x7'));var config=require(_0x2733('0x8'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth[_0x2733('0x9')](),controller['index']);router[_0x2733('0xa')](_0x2733('0xb'),auth[_0x2733('0x9')](),controller[_0x2733('0xc')]);router[_0x2733('0xd')]('/',auth[_0x2733('0x9')](),controller['create']);router[_0x2733('0xe')]('/:id',auth[_0x2733('0x9')](),controller[_0x2733('0xf')]);router[_0x2733('0x10')](_0x2733('0xb'),auth[_0x2733('0x9')](),controller[_0x2733('0x11')]);module[_0x2733('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 680296a..b03e77f 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 _0x88bb=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x1ad557,_0x5b4159){var _0x54d556=function(_0x51ed71){while(--_0x51ed71){_0x1ad557['push'](_0x1ad557['shift']());}};_0x54d556(++_0x5b4159);}(_0x88bb,0x8a));var _0xb88b=function(_0x5902ff,_0x4d860b){_0x5902ff=_0x5902ff-0x0;var _0x5d1348=_0x88bb[_0x5902ff];return _0x5d1348;};'use strict';var Sequelize=require(_0xb88b('0x0'));module[_0xb88b('0x1')]={'type':{'type':Sequelize[_0xb88b('0x2')](_0xb88b('0x3'),'variable',_0xb88b('0x4'),_0xb88b('0x5'),_0xb88b('0x6')),'defaultValue':_0xb88b('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb88b('0x7')]},'keyType':{'type':Sequelize[_0xb88b('0x2')](_0xb88b('0x3'),_0xb88b('0x8'),_0xb88b('0x4'))},'keyContent':{'type':Sequelize[_0xb88b('0x7')]},'idField':{'type':Sequelize[_0xb88b('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb88b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb88b('0x7')]}}; \ No newline at end of file +var _0x7ed0=['STRING','sequelize','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x5e8d3e,_0x18ed2e){var _0x1348c0=function(_0x5a889f){while(--_0x5a889f){_0x5e8d3e['push'](_0x5e8d3e['shift']());}};_0x1348c0(++_0x18ed2e);}(_0x7ed0,0x161));var _0x07ed=function(_0x39afa4,_0x4188f3){_0x39afa4=_0x39afa4-0x0;var _0x2b1b80=_0x7ed0[_0x39afa4];return _0x2b1b80;};'use strict';var Sequelize=require(_0x07ed('0x0'));module[_0x07ed('0x1')]={'type':{'type':Sequelize[_0x07ed('0x2')](_0x07ed('0x3'),_0x07ed('0x4'),_0x07ed('0x5'),'keyValue',_0x07ed('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x07ed('0x7')]},'key':{'type':Sequelize[_0x07ed('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x07ed('0x4'),_0x07ed('0x5'))},'keyContent':{'type':Sequelize[_0x07ed('0x7')]},'idField':{'type':Sequelize[_0x07ed('0x7')]},'nameField':{'type':Sequelize[_0x07ed('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x07ed('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 551f13f..2575d92 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 _0x931b=['eml-format','fast-json-patch','request-promise','moment','mustache','util','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','apply','reject','save','then','error','stack','name','send','index','map','SugarcrmField','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','catch','params','keys','rawAttributes','find','create','update','body','destroy'];(function(_0x4c2bdc,_0x5915d7){var _0x5a3222=function(_0x2262dd){while(--_0x2262dd){_0x4c2bdc['push'](_0x4c2bdc['shift']());}};_0x5a3222(++_0x5915d7);}(_0x931b,0x1f1));var _0xb931=function(_0x205b8f,_0x3c47c8){_0x205b8f=_0x205b8f-0x0;var _0x43d043=_0x931b[_0x205b8f];return _0x43d043;};'use strict';var emlformat=require(_0xb931('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb931('0x1'));var rp=require(_0xb931('0x2'));var moment=require(_0xb931('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb931('0x4'));var util=require(_0xb931('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb931('0x6'));var _=require(_0xb931('0x7'));var squel=require(_0xb931('0x8'));var crypto=require(_0xb931('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb931('0xa'));var toCsv=require('to-csv');var querystring=require(_0xb931('0xb'));var Papa=require(_0xb931('0xc'));var Redis=require(_0xb931('0xd'));var authService=require(_0xb931('0xe'));var qs=require(_0xb931('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb931('0x10'));var logger=require(_0xb931('0x11'))(_0xb931('0x12'));var utils=require('../../config/utils');var config=require(_0xb931('0x13'));var licenseUtil=require(_0xb931('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22344a,_0x45bde9){_0x45bde9=_0x45bde9||0xcc;return function(_0x252680){if(_0x252680){return _0x22344a[_0xb931('0x15')](_0x45bde9);}return _0x22344a[_0xb931('0x16')](_0x45bde9)[_0xb931('0x17')]();};}function respondWithResult(_0x6d773a,_0x3b6014){_0x3b6014=_0x3b6014||0xc8;return function(_0xc3ed12){if(_0xc3ed12){return _0x6d773a[_0xb931('0x16')](_0x3b6014)['json'](_0xc3ed12);}};}function respondWithFilteredResult(_0x10ed45,_0x197f20){return function(_0x5bee3f){if(_0x5bee3f){var _0x593f18=typeof _0x197f20['offset']===_0xb931('0x18')&&typeof _0x197f20[_0xb931('0x19')]===_0xb931('0x18');var _0x107574=_0x5bee3f[_0xb931('0x1a')];var _0x31c8f0=_0x593f18?0x0:_0x197f20['offset'];var _0x499de9=_0x593f18?_0x5bee3f['count']:_0x197f20[_0xb931('0x1b')]+_0x197f20[_0xb931('0x19')];var _0x112227;if(_0x499de9>=_0x107574){_0x499de9=_0x107574;_0x112227=0xc8;}else{_0x112227=0xce;}_0x10ed45[_0xb931('0x16')](_0x112227);return _0x10ed45[_0xb931('0x1c')]('Content-Range',_0x31c8f0+'-'+_0x499de9+'/'+_0x107574)['json'](_0x5bee3f);}return null;};}function patchUpdates(_0xfa33a9){return function(_0x46ad61){try{jsonpatch[_0xb931('0x1d')](_0x46ad61,_0xfa33a9,!![]);}catch(_0x2a2e4b){return BPromise[_0xb931('0x1e')](_0x2a2e4b);}return _0x46ad61[_0xb931('0x1f')]();};}function saveUpdates(_0x40ea7c,_0x17eb81){return function(_0x58391d){if(_0x58391d){return _0x58391d['update'](_0x40ea7c)['then'](function(_0x22e09f){return _0x22e09f;});}return null;};}function removeEntity(_0x3257bb,_0x22fbfe){return function(_0x34c7fa){if(_0x34c7fa){return _0x34c7fa['destroy']()[_0xb931('0x20')](function(){_0x3257bb[_0xb931('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b2c0f,_0x5e529a){return function(_0x3fa850){if(!_0x3fa850){_0x3b2c0f[_0xb931('0x15')](0x194);}return _0x3fa850;};}function handleError(_0x5c72eb,_0x15f6b5){_0x15f6b5=_0x15f6b5||0x1f4;return function(_0x44575e){logger[_0xb931('0x21')](_0x44575e[_0xb931('0x22')]);if(_0x44575e[_0xb931('0x23')]){delete _0x44575e[_0xb931('0x23')];}_0x5c72eb[_0xb931('0x16')](_0x15f6b5)[_0xb931('0x24')](_0x44575e);};}exports[_0xb931('0x25')]=function(_0x5e2d6b,_0x2d8338){var _0x5b0c70={},_0x2bfc17={},_0x5f0db8={'count':0x0,'rows':[]};var _0x2e8881=_[_0xb931('0x26')](db[_0xb931('0x27')]['rawAttributes'],function(_0x181410){return{'name':_0x181410[_0xb931('0x28')],'type':_0x181410[_0xb931('0x29')][_0xb931('0x2a')]};});_0x2bfc17[_0xb931('0x2b')]=_[_0xb931('0x26')](_0x2e8881,_0xb931('0x23'));_0x2bfc17[_0xb931('0x2c')]=_['keys'](_0x5e2d6b['query']);_0x2bfc17[_0xb931('0x2d')]=_['intersection'](_0x2bfc17[_0xb931('0x2b')],_0x2bfc17[_0xb931('0x2c')]);_0x5b0c70[_0xb931('0x2e')]=_[_0xb931('0x2f')](_0x2bfc17[_0xb931('0x2b')],qs[_0xb931('0x30')](_0x5e2d6b['query']['fields']));_0x5b0c70[_0xb931('0x2e')]=_0x5b0c70[_0xb931('0x2e')][_0xb931('0x31')]?_0x5b0c70['attributes']:_0x2bfc17['model'];if(!_0x5e2d6b['query'][_0xb931('0x32')](_0xb931('0x33'))){_0x5b0c70[_0xb931('0x19')]=qs[_0xb931('0x19')](_0x5e2d6b[_0xb931('0x2c')][_0xb931('0x19')]);_0x5b0c70['offset']=qs[_0xb931('0x1b')](_0x5e2d6b[_0xb931('0x2c')]['offset']);}_0x5b0c70[_0xb931('0x34')]=qs[_0xb931('0x35')](_0x5e2d6b[_0xb931('0x2c')]['sort']);_0x5b0c70['where']=qs['filters'](_[_0xb931('0x36')](_0x5e2d6b[_0xb931('0x2c')],_0x2bfc17['filters']),_0x2e8881);if(_0x5e2d6b[_0xb931('0x2c')][_0xb931('0x37')]){_0x5b0c70[_0xb931('0x38')]=_['merge'](_0x5b0c70[_0xb931('0x38')],{'$or':_[_0xb931('0x26')](_0x2e8881,function(_0x26e451){if(_0x26e451[_0xb931('0x29')]!==_0xb931('0x39')){var _0x1fef4e={};_0x1fef4e[_0x26e451[_0xb931('0x23')]]={'$like':'%'+_0x5e2d6b['query'][_0xb931('0x37')]+'%'};return _0x1fef4e;}})});}_0x5b0c70=_[_0xb931('0x3a')]({},_0x5b0c70,_0x5e2d6b[_0xb931('0x3b')]);var _0x5f2cab={'where':_0x5b0c70[_0xb931('0x38')]};return db[_0xb931('0x27')][_0xb931('0x1a')](_0x5f2cab)['then'](function(_0x271f2e){_0x5f0db8[_0xb931('0x1a')]=_0x271f2e;if(_0x5e2d6b[_0xb931('0x2c')][_0xb931('0x3c')]){_0x5b0c70['include']=[{'all':!![]}];}return db[_0xb931('0x27')][_0xb931('0x3d')](_0x5b0c70);})[_0xb931('0x20')](function(_0x54862c){_0x5f0db8['rows']=_0x54862c;return _0x5f0db8;})['then'](respondWithFilteredResult(_0x2d8338,_0x5b0c70))[_0xb931('0x3e')](handleError(_0x2d8338,null));};exports['show']=function(_0x5c9dcb,_0x45ca87){var _0x25b7f5={'raw':!![],'where':{'id':_0x5c9dcb[_0xb931('0x3f')]['id']}},_0x4681be={};_0x4681be[_0xb931('0x2b')]=_[_0xb931('0x40')](db[_0xb931('0x27')][_0xb931('0x41')]);_0x4681be[_0xb931('0x2c')]=_[_0xb931('0x40')](_0x5c9dcb['query']);_0x4681be['filters']=_[_0xb931('0x2f')](_0x4681be[_0xb931('0x2b')],_0x4681be[_0xb931('0x2c')]);_0x25b7f5[_0xb931('0x2e')]=_[_0xb931('0x2f')](_0x4681be[_0xb931('0x2b')],qs['fields'](_0x5c9dcb[_0xb931('0x2c')][_0xb931('0x30')]));_0x25b7f5[_0xb931('0x2e')]=_0x25b7f5[_0xb931('0x2e')][_0xb931('0x31')]?_0x25b7f5['attributes']:_0x4681be[_0xb931('0x2b')];if(_0x5c9dcb[_0xb931('0x2c')][_0xb931('0x3c')]){_0x25b7f5['include']=[{'all':!![]}];}_0x25b7f5=_['merge']({},_0x25b7f5,_0x5c9dcb[_0xb931('0x3b')]);return db[_0xb931('0x27')][_0xb931('0x42')](_0x25b7f5)[_0xb931('0x20')](handleEntityNotFound(_0x45ca87,null))[_0xb931('0x20')](respondWithResult(_0x45ca87,null))['catch'](handleError(_0x45ca87,null));};exports['create']=function(_0x5f3177,_0x61ca00){return db[_0xb931('0x27')][_0xb931('0x43')](_0x5f3177['body'],{})[_0xb931('0x20')](respondWithResult(_0x61ca00,0xc9))[_0xb931('0x3e')](handleError(_0x61ca00,null));};exports[_0xb931('0x44')]=function(_0x256c14,_0x10cb25){if(_0x256c14[_0xb931('0x45')]['id']){delete _0x256c14[_0xb931('0x45')]['id'];}return db[_0xb931('0x27')]['find']({'where':{'id':_0x256c14[_0xb931('0x3f')]['id']}})[_0xb931('0x20')](handleEntityNotFound(_0x10cb25,null))[_0xb931('0x20')](saveUpdates(_0x256c14[_0xb931('0x45')],null))[_0xb931('0x20')](respondWithResult(_0x10cb25,null))[_0xb931('0x3e')](handleError(_0x10cb25,null));};exports[_0xb931('0x46')]=function(_0x1cc420,_0xa81fda){return db[_0xb931('0x27')]['find']({'where':{'id':_0x1cc420[_0xb931('0x3f')]['id']}})[_0xb931('0x20')](handleEntityNotFound(_0xa81fda,null))[_0xb931('0x20')](removeEntity(_0xa81fda,null))['catch'](handleError(_0xa81fda,null));}; \ No newline at end of file +var _0x72a6=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','status','set','Content-Range','apply','update','then','destroy','error','name','send','index','map','SugarcrmField','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x38ff2b,_0x3a0316){var _0x341f5e=function(_0x346368){while(--_0x346368){_0x38ff2b['push'](_0x38ff2b['shift']());}};_0x341f5e(++_0x3a0316);}(_0x72a6,0x1ee));var _0x672a=function(_0xe5028a,_0x2104ca){_0xe5028a=_0xe5028a-0x0;var _0x4954d0=_0x72a6[_0xe5028a];return _0x4954d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x672a('0x0'));var zipdir=require(_0x672a('0x1'));var jsonpatch=require(_0x672a('0x2'));var rp=require(_0x672a('0x3'));var moment=require('moment');var BPromise=require(_0x672a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x672a('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x672a('0x6'));var fs=require('fs');var fs_extra=require(_0x672a('0x7'));var _=require(_0x672a('0x8'));var squel=require(_0x672a('0x9'));var crypto=require(_0x672a('0xa'));var jsforce=require(_0x672a('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x672a('0xc'));var Redis=require(_0x672a('0xd'));var authService=require(_0x672a('0xe'));var qs=require(_0x672a('0xf'));var as=require(_0x672a('0x10'));var hardwareService=require(_0x672a('0x11'));var logger=require('../../config/logger')(_0x672a('0x12'));var utils=require(_0x672a('0x13'));var config=require(_0x672a('0x14'));var licenseUtil=require(_0x672a('0x15'));var db=require(_0x672a('0x16'))['db'];function respondWithStatusCode(_0x46760b,_0x5805fa){_0x5805fa=_0x5805fa||0xcc;return function(_0x51a8a1){if(_0x51a8a1){return _0x46760b[_0x672a('0x17')](_0x5805fa);}return _0x46760b['status'](_0x5805fa)[_0x672a('0x18')]();};}function respondWithResult(_0x4842f1,_0x5331d7){_0x5331d7=_0x5331d7||0xc8;return function(_0x9f9d5c){if(_0x9f9d5c){return _0x4842f1['status'](_0x5331d7)[_0x672a('0x19')](_0x9f9d5c);}};}function respondWithFilteredResult(_0xc19eda,_0x3f6e7f){return function(_0x131194){if(_0x131194){var _0x38fa8d=typeof _0x3f6e7f['offset']==='undefined'&&typeof _0x3f6e7f[_0x672a('0x1a')]===_0x672a('0x1b');var _0x392ac8=_0x131194[_0x672a('0x1c')];var _0x792831=_0x38fa8d?0x0:_0x3f6e7f[_0x672a('0x1d')];var _0x66e2b5=_0x38fa8d?_0x131194['count']:_0x3f6e7f[_0x672a('0x1d')]+_0x3f6e7f[_0x672a('0x1a')];var _0x325af3;if(_0x66e2b5>=_0x392ac8){_0x66e2b5=_0x392ac8;_0x325af3=0xc8;}else{_0x325af3=0xce;}_0xc19eda[_0x672a('0x1e')](_0x325af3);return _0xc19eda[_0x672a('0x1f')](_0x672a('0x20'),_0x792831+'-'+_0x66e2b5+'/'+_0x392ac8)[_0x672a('0x19')](_0x131194);}return null;};}function patchUpdates(_0x417ca4){return function(_0xcb0697){try{jsonpatch[_0x672a('0x21')](_0xcb0697,_0x417ca4,!![]);}catch(_0x849ee0){return BPromise['reject'](_0x849ee0);}return _0xcb0697['save']();};}function saveUpdates(_0x14c135,_0x2c8d55){return function(_0x46b0da){if(_0x46b0da){return _0x46b0da[_0x672a('0x22')](_0x14c135)[_0x672a('0x23')](function(_0x195454){return _0x195454;});}return null;};}function removeEntity(_0x513267,_0x564d8a){return function(_0x485b63){if(_0x485b63){return _0x485b63[_0x672a('0x24')]()[_0x672a('0x23')](function(){_0x513267[_0x672a('0x1e')](0xcc)[_0x672a('0x18')]();});}};}function handleEntityNotFound(_0x4ab019,_0x39cff5){return function(_0x4c13f9){if(!_0x4c13f9){_0x4ab019[_0x672a('0x17')](0x194);}return _0x4c13f9;};}function handleError(_0x33d291,_0x5de55d){_0x5de55d=_0x5de55d||0x1f4;return function(_0x296b5f){logger[_0x672a('0x25')](_0x296b5f['stack']);if(_0x296b5f[_0x672a('0x26')]){delete _0x296b5f[_0x672a('0x26')];}_0x33d291[_0x672a('0x1e')](_0x5de55d)[_0x672a('0x27')](_0x296b5f);};}exports[_0x672a('0x28')]=function(_0x57cc5c,_0x1fafb8){var _0x131933={},_0x1870e7={},_0x445509={'count':0x0,'rows':[]};var _0x16b403=_[_0x672a('0x29')](db[_0x672a('0x2a')][_0x672a('0x2b')],function(_0x20bc70){return{'name':_0x20bc70[_0x672a('0x2c')],'type':_0x20bc70['type']['key']};});_0x1870e7[_0x672a('0x2d')]=_[_0x672a('0x29')](_0x16b403,_0x672a('0x26'));_0x1870e7[_0x672a('0x2e')]=_[_0x672a('0x2f')](_0x57cc5c[_0x672a('0x2e')]);_0x1870e7['filters']=_[_0x672a('0x30')](_0x1870e7['model'],_0x1870e7[_0x672a('0x2e')]);_0x131933[_0x672a('0x31')]=_[_0x672a('0x30')](_0x1870e7['model'],qs[_0x672a('0x32')](_0x57cc5c['query'][_0x672a('0x32')]));_0x131933[_0x672a('0x31')]=_0x131933[_0x672a('0x31')]['length']?_0x131933[_0x672a('0x31')]:_0x1870e7['model'];if(!_0x57cc5c[_0x672a('0x2e')][_0x672a('0x33')](_0x672a('0x34'))){_0x131933[_0x672a('0x1a')]=qs[_0x672a('0x1a')](_0x57cc5c[_0x672a('0x2e')][_0x672a('0x1a')]);_0x131933[_0x672a('0x1d')]=qs[_0x672a('0x1d')](_0x57cc5c[_0x672a('0x2e')][_0x672a('0x1d')]);}_0x131933[_0x672a('0x35')]=qs[_0x672a('0x36')](_0x57cc5c[_0x672a('0x2e')][_0x672a('0x36')]);_0x131933[_0x672a('0x37')]=qs[_0x672a('0x38')](_[_0x672a('0x39')](_0x57cc5c['query'],_0x1870e7[_0x672a('0x38')]),_0x16b403);if(_0x57cc5c[_0x672a('0x2e')][_0x672a('0x3a')]){_0x131933[_0x672a('0x37')]=_[_0x672a('0x3b')](_0x131933[_0x672a('0x37')],{'$or':_[_0x672a('0x29')](_0x16b403,function(_0x104882){if(_0x104882['type']!==_0x672a('0x3c')){var _0x25a3ed={};_0x25a3ed[_0x104882[_0x672a('0x26')]]={'$like':'%'+_0x57cc5c['query'][_0x672a('0x3a')]+'%'};return _0x25a3ed;}})});}_0x131933=_[_0x672a('0x3b')]({},_0x131933,_0x57cc5c['options']);var _0x7c6d56={'where':_0x131933['where']};return db[_0x672a('0x2a')][_0x672a('0x1c')](_0x7c6d56)[_0x672a('0x23')](function(_0x5bc1a8){_0x445509['count']=_0x5bc1a8;if(_0x57cc5c[_0x672a('0x2e')][_0x672a('0x3d')]){_0x131933[_0x672a('0x3e')]=[{'all':!![]}];}return db[_0x672a('0x2a')][_0x672a('0x3f')](_0x131933);})[_0x672a('0x23')](function(_0x398452){_0x445509[_0x672a('0x40')]=_0x398452;return _0x445509;})['then'](respondWithFilteredResult(_0x1fafb8,_0x131933))[_0x672a('0x41')](handleError(_0x1fafb8,null));};exports[_0x672a('0x42')]=function(_0x47c59c,_0x158127){var _0x3aee6e={'raw':!![],'where':{'id':_0x47c59c[_0x672a('0x43')]['id']}},_0x4af386={};_0x4af386[_0x672a('0x2d')]=_[_0x672a('0x2f')](db[_0x672a('0x2a')][_0x672a('0x2b')]);_0x4af386[_0x672a('0x2e')]=_[_0x672a('0x2f')](_0x47c59c[_0x672a('0x2e')]);_0x4af386[_0x672a('0x38')]=_[_0x672a('0x30')](_0x4af386[_0x672a('0x2d')],_0x4af386['query']);_0x3aee6e[_0x672a('0x31')]=_[_0x672a('0x30')](_0x4af386['model'],qs[_0x672a('0x32')](_0x47c59c['query'][_0x672a('0x32')]));_0x3aee6e[_0x672a('0x31')]=_0x3aee6e['attributes'][_0x672a('0x44')]?_0x3aee6e['attributes']:_0x4af386[_0x672a('0x2d')];if(_0x47c59c['query'][_0x672a('0x3d')]){_0x3aee6e['include']=[{'all':!![]}];}_0x3aee6e=_[_0x672a('0x3b')]({},_0x3aee6e,_0x47c59c[_0x672a('0x45')]);return db[_0x672a('0x2a')]['find'](_0x3aee6e)[_0x672a('0x23')](handleEntityNotFound(_0x158127,null))['then'](respondWithResult(_0x158127,null))[_0x672a('0x41')](handleError(_0x158127,null));};exports[_0x672a('0x46')]=function(_0x2c6abe,_0x4f44c3){return db[_0x672a('0x2a')][_0x672a('0x46')](_0x2c6abe[_0x672a('0x47')],{})[_0x672a('0x23')](respondWithResult(_0x4f44c3,0xc9))[_0x672a('0x41')](handleError(_0x4f44c3,null));};exports['update']=function(_0x344b2b,_0x2b3a67){if(_0x344b2b[_0x672a('0x47')]['id']){delete _0x344b2b[_0x672a('0x47')]['id'];}return db['SugarcrmField'][_0x672a('0x48')]({'where':{'id':_0x344b2b[_0x672a('0x43')]['id']}})[_0x672a('0x23')](handleEntityNotFound(_0x2b3a67,null))['then'](saveUpdates(_0x344b2b[_0x672a('0x47')],null))[_0x672a('0x23')](respondWithResult(_0x2b3a67,null))[_0x672a('0x41')](handleError(_0x2b3a67,null));};exports['destroy']=function(_0x28142c,_0x1efdb6){return db[_0x672a('0x2a')][_0x672a('0x48')]({'where':{'id':_0x28142c[_0x672a('0x43')]['id']}})[_0x672a('0x23')](handleEntityNotFound(_0x1efdb6,null))[_0x672a('0x23')](removeEntity(_0x1efdb6,null))['catch'](handleError(_0x1efdb6,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index d687b8f..971a2e5 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 _0x2c47=['rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','idField','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x944bfd,_0x29d12c){var _0x5e7555=function(_0x47f006){while(--_0x47f006){_0x944bfd['push'](_0x944bfd['shift']());}};_0x5e7555(++_0x29d12c);}(_0x2c47,0xcb));var _0x72c4=function(_0x3e4a6d,_0x357234){_0x3e4a6d=_0x3e4a6d-0x0;var _0x10e20b=_0x2c47[_0x3e4a6d];return _0x10e20b;};'use strict';var _=require(_0x72c4('0x0'));var util=require(_0x72c4('0x1'));var logger=require(_0x72c4('0x2'))(_0x72c4('0x3'));var moment=require(_0x72c4('0x4'));var BPromise=require('bluebird');var rp=require(_0x72c4('0x5'));var fs=require('fs');var path=require(_0x72c4('0x6'));var rimraf=require(_0x72c4('0x7'));var config=require(_0x72c4('0x8'));var attributes=require(_0x72c4('0x9'));module[_0x72c4('0xa')]=function(_0x4df3e3,_0x2696bc){return _0x4df3e3[_0x72c4('0xb')](_0x72c4('0xc'),attributes,{'tableName':_0x72c4('0xd'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x72c4('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x68c2=['bluebird','request-promise','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','../../config/logger','api','moment'];(function(_0x487f90,_0x5253c5){var _0x34fb62=function(_0x33fc38){while(--_0x33fc38){_0x487f90['push'](_0x487f90['shift']());}};_0x34fb62(++_0x5253c5);}(_0x68c2,0xce));var _0x268c=function(_0x254f73,_0x532104){_0x254f73=_0x254f73-0x0;var _0x472f28=_0x68c2[_0x254f73];return _0x472f28;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x268c('0x0'))(_0x268c('0x1'));var moment=require(_0x268c('0x2'));var BPromise=require(_0x268c('0x3'));var rp=require(_0x268c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x268c('0x5'));var config=require('../../config/environment');var attributes=require(_0x268c('0x6'));module[_0x268c('0x7')]=function(_0x5253c7,_0x102b3d){return _0x5253c7[_0x268c('0x8')](_0x268c('0x9'),attributes,{'tableName':_0x268c('0xa'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 806c055..787bab5 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 _0xf098=['debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s'];(function(_0x3910f1,_0x421e2e){var _0xd06af4=function(_0x4b4232){while(--_0x4b4232){_0x3910f1['push'](_0x3910f1['shift']());}};_0xd06af4(++_0x421e2e);}(_0xf098,0x75));var _0x8f09=function(_0x24a591,_0x55c6a0){_0x24a591=_0x24a591-0x0;var _0x35cc83=_0xf098[_0x24a591];return _0x35cc83;};'use strict';var _=require(_0x8f09('0x0'));var util=require(_0x8f09('0x1'));var moment=require(_0x8f09('0x2'));var BPromise=require(_0x8f09('0x3'));var rs=require(_0x8f09('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f09('0x5'))['db'];var utils=require(_0x8f09('0x6'));var logger=require(_0x8f09('0x7'))('rpc');var config=require(_0x8f09('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8f09('0x9')][_0x8f09('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e8524,_0x3d27f9,_0x34c57d){return new BPromise(function(_0xdd8b9b,_0x518b96){return client[_0x8f09('0xb')](_0x4e8524,_0x34c57d)[_0x8f09('0xc')](function(_0x532eac){logger[_0x8f09('0xd')](_0x8f09('0xe'),_0x3d27f9,'request\x20sent');logger[_0x8f09('0xf')](_0x8f09('0x10'),_0x3d27f9,_0x8f09('0x11'),JSON['stringify'](_0x532eac));if(_0x532eac[_0x8f09('0x12')]){if(_0x532eac[_0x8f09('0x12')][_0x8f09('0x13')]===0x1f4){logger[_0x8f09('0x12')](_0x8f09('0xe'),_0x3d27f9,_0x532eac[_0x8f09('0x12')][_0x8f09('0x14')]);return _0x518b96(_0x532eac[_0x8f09('0x12')][_0x8f09('0x14')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x3d27f9,_0x532eac[_0x8f09('0x12')][_0x8f09('0x14')]);return _0xdd8b9b(_0x532eac['error'][_0x8f09('0x14')]);}else{logger[_0x8f09('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x3d27f9,'request\x20sent');_0xdd8b9b(_0x532eac[_0x8f09('0x15')][_0x8f09('0x14')]);}})['catch'](function(_0xf6229){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x3d27f9,_0xf6229);_0x518b96(_0xf6229);});});} \ No newline at end of file +var _0xbf06=['moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbf06,0x13e));var _0x6bf0=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xbf06[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x6bf0('0x0'));var util=require(_0x6bf0('0x1'));var moment=require(_0x6bf0('0x2'));var BPromise=require(_0x6bf0('0x3'));var rs=require(_0x6bf0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6bf0('0x5'));var logger=require(_0x6bf0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6bf0('0x7'));var client=jayson[_0x6bf0('0x8')][_0x6bf0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x562804,_0x1f3aac,_0x40a856){return new BPromise(function(_0x712988,_0x3704e1){return client[_0x6bf0('0xa')](_0x562804,_0x40a856)['then'](function(_0x5b9fae){logger[_0x6bf0('0xb')](_0x6bf0('0xc'),_0x1f3aac,_0x6bf0('0xd'));logger['debug'](_0x6bf0('0xe'),_0x1f3aac,'request\x20sent',JSON[_0x6bf0('0xf')](_0x5b9fae));if(_0x5b9fae[_0x6bf0('0x10')]){if(_0x5b9fae[_0x6bf0('0x10')][_0x6bf0('0x11')]===0x1f4){logger[_0x6bf0('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x1f3aac,_0x5b9fae[_0x6bf0('0x10')][_0x6bf0('0x12')]);return _0x3704e1(_0x5b9fae[_0x6bf0('0x10')]['message']);}logger[_0x6bf0('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x1f3aac,_0x5b9fae['error'][_0x6bf0('0x12')]);return _0x712988(_0x5b9fae['error'][_0x6bf0('0x12')]);}else{logger[_0x6bf0('0xb')](_0x6bf0('0xc'),_0x1f3aac,'request\x20sent');_0x712988(_0x5b9fae['result'][_0x6bf0('0x12')]);}})[_0x6bf0('0x13')](function(_0x2d6150){logger['error'](_0x6bf0('0xc'),_0x1f3aac,_0x2d6150);_0x3704e1(_0x2d6150);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 9688331..4162632 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 _0x6b1c=['isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0xab157d,_0x5bb448){var _0x19355e=function(_0x1b3d86){while(--_0x1b3d86){_0xab157d['push'](_0xab157d['shift']());}};_0x19355e(++_0x5bb448);}(_0x6b1c,0xf3));var _0xc6b1=function(_0x1eff80,_0x43b3f2){_0x1eff80=_0x1eff80-0x0;var _0x590b5c=_0x6b1c[_0x1eff80];return _0x590b5c;};'use strict';var multer=require(_0xc6b1('0x0'));var util=require('util');var path=require(_0xc6b1('0x1'));var timeout=require(_0xc6b1('0x2'));var express=require(_0xc6b1('0x3'));var router=express[_0xc6b1('0x4')]();var fs_extra=require(_0xc6b1('0x5'));var auth=require(_0xc6b1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc6b1('0x7'));var controller=require('./intVtigerAccount.controller');router[_0xc6b1('0x8')]('/',auth[_0xc6b1('0x9')](),controller['index']);router[_0xc6b1('0x8')](_0xc6b1('0xa'),auth[_0xc6b1('0x9')](),controller[_0xc6b1('0xb')]);router['get'](_0xc6b1('0xc'),auth[_0xc6b1('0x9')](),controller['getConfigurations']);router['get'](_0xc6b1('0xd'),auth[_0xc6b1('0x9')](),controller[_0xc6b1('0xe')]);router[_0xc6b1('0xf')]('/',auth[_0xc6b1('0x9')](),controller[_0xc6b1('0x10')]);router['post'](_0xc6b1('0xc'),auth[_0xc6b1('0x9')](),controller[_0xc6b1('0x11')]);router[_0xc6b1('0x12')](_0xc6b1('0xa'),auth['isAuthenticated'](),controller[_0xc6b1('0x13')]);router[_0xc6b1('0x14')](_0xc6b1('0xa'),auth[_0xc6b1('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1cbb=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0x5cbf0e,_0x4cd140){var _0x1c76f8=function(_0xcc9be4){while(--_0xcc9be4){_0x5cbf0e['push'](_0x5cbf0e['shift']());}};_0x1c76f8(++_0x4cd140);}(_0x1cbb,0x18f));var _0xb1cb=function(_0x429bcc,_0x30b65f){_0x429bcc=_0x429bcc-0x0;var _0x2f3c5d=_0x1cbb[_0x429bcc];return _0x2f3c5d;};'use strict';var multer=require(_0xb1cb('0x0'));var util=require(_0xb1cb('0x1'));var path=require('path');var timeout=require(_0xb1cb('0x2'));var express=require(_0xb1cb('0x3'));var router=express[_0xb1cb('0x4')]();var fs_extra=require(_0xb1cb('0x5'));var auth=require(_0xb1cb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb1cb('0x7'));var controller=require(_0xb1cb('0x8'));router[_0xb1cb('0x9')]('/',auth[_0xb1cb('0xa')](),controller[_0xb1cb('0xb')]);router[_0xb1cb('0x9')](_0xb1cb('0xc'),auth[_0xb1cb('0xa')](),controller['show']);router['get'](_0xb1cb('0xd'),auth[_0xb1cb('0xa')](),controller[_0xb1cb('0xe')]);router[_0xb1cb('0x9')](_0xb1cb('0xf'),auth[_0xb1cb('0xa')](),controller[_0xb1cb('0x10')]);router[_0xb1cb('0x11')]('/',auth[_0xb1cb('0xa')](),controller[_0xb1cb('0x12')]);router[_0xb1cb('0x11')]('/:id/configurations',auth[_0xb1cb('0xa')](),controller[_0xb1cb('0x13')]);router[_0xb1cb('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xb1cb('0x15')]);router[_0xb1cb('0x16')](_0xb1cb('0xc'),auth[_0xb1cb('0xa')](),controller[_0xb1cb('0x17')]);module[_0xb1cb('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index a4d2850..90f367c 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 _0x58b3=['HelpDesk','sequelize','exports','STRING'];(function(_0x534c1d,_0x1332e5){var _0x1c239f=function(_0x489ab4){while(--_0x489ab4){_0x534c1d['push'](_0x534c1d['shift']());}};_0x1c239f(++_0x1332e5);}(_0x58b3,0x1c1));var _0x358b=function(_0x4c3318,_0x3b0870){_0x4c3318=_0x4c3318-0x0;var _0x9c5860=_0x58b3[_0x4c3318];return _0x9c5860;};'use strict';var Sequelize=require(_0x358b('0x0'));module[_0x358b('0x1')]={'name':{'type':Sequelize[_0x358b('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x358b('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x358b('0x2')],'allowNull':![],'defaultValue':_0x358b('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x5b58=['STRING','HelpDesk','sequelize'];(function(_0xaaf2e2,_0x19d28a){var _0x28bc36=function(_0x53bdb5){while(--_0x53bdb5){_0xaaf2e2['push'](_0xaaf2e2['shift']());}};_0x28bc36(++_0x19d28a);}(_0x5b58,0x116));var _0x85b5=function(_0x228acb,_0x3d4196){_0x228acb=_0x228acb-0x0;var _0x294939=_0x5b58[_0x228acb];return _0x294939;};'use strict';var Sequelize=require(_0x85b5('0x0'));module['exports']={'name':{'type':Sequelize[_0x85b5('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x85b5('0x1')],'allowNull':![],'defaultValue':_0x85b5('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x85b5('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index f31dce0..b1552b3 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 _0x78f9=['options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','length','find','catch','create','body','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','getFields','username','description','moduleName','remoteUri','accessKey','slice','format','%s/webservice.php','getchallenge','POST','result','token','success','GET','describe','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklistValues','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','status','error','stack','name','send','index','map','VtigerAccount','fieldName','type','key','keys','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter'];(function(_0x5b7dec,_0x57ed87){var _0x289c58=function(_0x59acb7){while(--_0x59acb7){_0x5b7dec['push'](_0x5b7dec['shift']());}};_0x289c58(++_0x57ed87);}(_0x78f9,0x1ab));var _0x978f=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x78f9[_0x139a3c];return _0x2b375b;};'use strict';var emlformat=require(_0x978f('0x0'));var rimraf=require(_0x978f('0x1'));var zipdir=require(_0x978f('0x2'));var jsonpatch=require(_0x978f('0x3'));var rp=require(_0x978f('0x4'));var moment=require('moment');var BPromise=require(_0x978f('0x5'));var Mustache=require(_0x978f('0x6'));var util=require(_0x978f('0x7'));var path=require(_0x978f('0x8'));var sox=require(_0x978f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x978f('0xa'));var squel=require('squel');var crypto=require(_0x978f('0xb'));var jsforce=require(_0x978f('0xc'));var deskjs=require(_0x978f('0xd'));var toCsv=require(_0x978f('0xe'));var querystring=require(_0x978f('0xf'));var Papa=require(_0x978f('0x10'));var Redis=require('ioredis');var authService=require(_0x978f('0x11'));var qs=require(_0x978f('0x12'));var as=require(_0x978f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x978f('0x14'))(_0x978f('0x15'));var utils=require(_0x978f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x978f('0x17'));var db=require(_0x978f('0x18'))['db'];var integrations=require(_0x978f('0x19'));function respondWithStatusCode(_0x223c3a,_0x50f411){_0x50f411=_0x50f411||0xcc;return function(_0x51035f){if(_0x51035f){return _0x223c3a[_0x978f('0x1a')](_0x50f411);}return _0x223c3a['status'](_0x50f411)['end']();};}function respondWithResult(_0x46c01e,_0x51ee1f){_0x51ee1f=_0x51ee1f||0xc8;return function(_0x53ad11){if(_0x53ad11){return _0x46c01e['status'](_0x51ee1f)[_0x978f('0x1b')](_0x53ad11);}};}function respondWithFilteredResult(_0x2c4637,_0x22f25d){return function(_0x2773bd){if(_0x2773bd){var _0x28d31e=typeof _0x22f25d[_0x978f('0x1c')]===_0x978f('0x1d')&&typeof _0x22f25d[_0x978f('0x1e')]==='undefined';var _0x779e7c=_0x2773bd[_0x978f('0x1f')];var _0x201431=_0x28d31e?0x0:_0x22f25d[_0x978f('0x1c')];var _0x30e269=_0x28d31e?_0x2773bd[_0x978f('0x1f')]:_0x22f25d[_0x978f('0x1c')]+_0x22f25d['limit'];var _0x59c0de;if(_0x30e269>=_0x779e7c){_0x30e269=_0x779e7c;_0x59c0de=0xc8;}else{_0x59c0de=0xce;}_0x2c4637['status'](_0x59c0de);return _0x2c4637[_0x978f('0x20')](_0x978f('0x21'),_0x201431+'-'+_0x30e269+'/'+_0x779e7c)['json'](_0x2773bd);}return null;};}function patchUpdates(_0x104962){return function(_0x30064a){try{jsonpatch['apply'](_0x30064a,_0x104962,!![]);}catch(_0x5cf1b6){return BPromise[_0x978f('0x22')](_0x5cf1b6);}return _0x30064a[_0x978f('0x23')]();};}function saveUpdates(_0x6bf2cc,_0x39ed92){return function(_0x228b4e){if(_0x228b4e){return _0x228b4e[_0x978f('0x24')](_0x6bf2cc)[_0x978f('0x25')](function(_0xe2ce84){return _0xe2ce84;});}return null;};}function removeEntity(_0x36372b,_0x244d6b){return function(_0x3cd26b){if(_0x3cd26b){return _0x3cd26b[_0x978f('0x26')]()[_0x978f('0x25')](function(){_0x36372b[_0x978f('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x493cc0,_0x43b7e9){return function(_0x86bb55){if(!_0x86bb55){_0x493cc0['sendStatus'](0x194);}return _0x86bb55;};}function handleError(_0x153360,_0x5a459f){_0x5a459f=_0x5a459f||0x1f4;return function(_0x46ff8b){logger[_0x978f('0x28')](_0x46ff8b[_0x978f('0x29')]);if(_0x46ff8b[_0x978f('0x2a')]){delete _0x46ff8b[_0x978f('0x2a')];}_0x153360[_0x978f('0x27')](_0x5a459f)[_0x978f('0x2b')](_0x46ff8b);};}exports[_0x978f('0x2c')]=function(_0x387a02,_0x13a8dc){var _0x2c33f3={},_0x12fc6f={},_0x14b5c2={'count':0x0,'rows':[]};var _0xe1c45=_[_0x978f('0x2d')](db[_0x978f('0x2e')]['rawAttributes'],function(_0x152b46){return{'name':_0x152b46[_0x978f('0x2f')],'type':_0x152b46[_0x978f('0x30')][_0x978f('0x31')]};});_0x12fc6f['model']=_['map'](_0xe1c45,'name');_0x12fc6f['query']=_[_0x978f('0x32')](_0x387a02[_0x978f('0x33')]);_0x12fc6f[_0x978f('0x34')]=_[_0x978f('0x35')](_0x12fc6f[_0x978f('0x36')],_0x12fc6f[_0x978f('0x33')]);_0x2c33f3[_0x978f('0x37')]=_['intersection'](_0x12fc6f[_0x978f('0x36')],qs['fields'](_0x387a02[_0x978f('0x33')]['fields']));_0x2c33f3[_0x978f('0x37')]=_0x2c33f3[_0x978f('0x37')]['length']?_0x2c33f3[_0x978f('0x37')]:_0x12fc6f[_0x978f('0x36')];if(!_0x387a02[_0x978f('0x33')][_0x978f('0x38')](_0x978f('0x39'))){_0x2c33f3[_0x978f('0x1e')]=qs[_0x978f('0x1e')](_0x387a02[_0x978f('0x33')][_0x978f('0x1e')]);_0x2c33f3[_0x978f('0x1c')]=qs['offset'](_0x387a02[_0x978f('0x33')][_0x978f('0x1c')]);}_0x2c33f3[_0x978f('0x3a')]=qs[_0x978f('0x3b')](_0x387a02[_0x978f('0x33')][_0x978f('0x3b')]);_0x2c33f3[_0x978f('0x3c')]=qs[_0x978f('0x34')](_[_0x978f('0x3d')](_0x387a02['query'],_0x12fc6f[_0x978f('0x34')]),_0xe1c45);if(_0x387a02['query']['filter']){_0x2c33f3[_0x978f('0x3c')]=_[_0x978f('0x3e')](_0x2c33f3[_0x978f('0x3c')],{'$or':_[_0x978f('0x2d')](_0xe1c45,function(_0x177c5e){if(_0x177c5e['type']!==_0x978f('0x3f')){var _0xbf7fc0={};_0xbf7fc0[_0x177c5e['name']]={'$like':'%'+_0x387a02[_0x978f('0x33')][_0x978f('0x40')]+'%'};return _0xbf7fc0;}})});}_0x2c33f3=_['merge']({},_0x2c33f3,_0x387a02[_0x978f('0x41')]);var _0x3e80d1={'where':_0x2c33f3[_0x978f('0x3c')]};return db[_0x978f('0x2e')][_0x978f('0x1f')](_0x3e80d1)['then'](function(_0x2344d6){_0x14b5c2[_0x978f('0x1f')]=_0x2344d6;if(_0x387a02[_0x978f('0x33')][_0x978f('0x42')]){_0x2c33f3[_0x978f('0x43')]=[{'all':!![]}];}return db[_0x978f('0x2e')][_0x978f('0x44')](_0x2c33f3);})[_0x978f('0x25')](function(_0x38f938){_0x14b5c2[_0x978f('0x45')]=_0x38f938;return _0x14b5c2;})[_0x978f('0x25')](respondWithFilteredResult(_0x13a8dc,_0x2c33f3))['catch'](handleError(_0x13a8dc,null));};exports[_0x978f('0x46')]=function(_0x3db408,_0x17fce5){var _0x3ed948={'raw':![],'where':{'id':_0x3db408[_0x978f('0x47')]['id']}},_0xc8640f={};_0xc8640f['model']=_[_0x978f('0x32')](db[_0x978f('0x2e')][_0x978f('0x48')]);_0xc8640f[_0x978f('0x33')]=_[_0x978f('0x32')](_0x3db408[_0x978f('0x33')]);_0xc8640f['filters']=_['intersection'](_0xc8640f[_0x978f('0x36')],_0xc8640f[_0x978f('0x33')]);_0x3ed948[_0x978f('0x37')]=_[_0x978f('0x35')](_0xc8640f[_0x978f('0x36')],qs[_0x978f('0x49')](_0x3db408['query'][_0x978f('0x49')]));_0x3ed948[_0x978f('0x37')]=_0x3ed948[_0x978f('0x37')][_0x978f('0x4a')]?_0x3ed948[_0x978f('0x37')]:_0xc8640f[_0x978f('0x36')];if(_0x3db408['query'][_0x978f('0x42')]){_0x3ed948[_0x978f('0x43')]=[{'all':!![]}];}_0x3ed948=_['merge']({},_0x3ed948,_0x3db408['options']);return db[_0x978f('0x2e')][_0x978f('0x4b')](_0x3ed948)[_0x978f('0x25')](handleEntityNotFound(_0x17fce5,null))[_0x978f('0x25')](respondWithResult(_0x17fce5,null))[_0x978f('0x4c')](handleError(_0x17fce5,null));};exports[_0x978f('0x4d')]=function(_0x494a67,_0x48759c){return db['VtigerAccount'][_0x978f('0x4d')](_0x494a67[_0x978f('0x4e')],{})[_0x978f('0x25')](respondWithResult(_0x48759c,0xc9))[_0x978f('0x4c')](handleError(_0x48759c,null));};exports[_0x978f('0x24')]=function(_0x20186e,_0x7e5dc7){if(_0x20186e[_0x978f('0x4e')]['id']){delete _0x20186e[_0x978f('0x4e')]['id'];}return db['VtigerAccount'][_0x978f('0x4b')]({'where':{'id':_0x20186e[_0x978f('0x47')]['id']}})[_0x978f('0x25')](handleEntityNotFound(_0x7e5dc7,null))[_0x978f('0x25')](saveUpdates(_0x20186e[_0x978f('0x4e')],null))[_0x978f('0x25')](respondWithResult(_0x7e5dc7,null))[_0x978f('0x4c')](handleError(_0x7e5dc7,null));};exports[_0x978f('0x26')]=function(_0x3c7ddb,_0x5f5279){return db[_0x978f('0x2e')][_0x978f('0x4b')]({'where':{'id':_0x3c7ddb[_0x978f('0x47')]['id']}})['then'](handleEntityNotFound(_0x5f5279,null))['then'](removeEntity(_0x5f5279,null))[_0x978f('0x4c')](handleError(_0x5f5279,null));};exports['getConfigurations']=function(_0xa65209,_0x2a21f1,_0x50d4c8){var _0x1aae37={};var _0x6a3a04={};var _0x57f8f0;var _0xf23643;return db['VtigerAccount'][_0x978f('0x4f')]({'where':{'id':_0xa65209[_0x978f('0x47')]['id']}})[_0x978f('0x25')](handleEntityNotFound(_0x2a21f1,null))[_0x978f('0x25')](function(_0x316979){if(_0x316979){_0x57f8f0=_0x316979;_0x6a3a04['model']=_[_0x978f('0x32')](db['VtigerConfiguration']['rawAttributes']);_0x6a3a04[_0x978f('0x33')]=_['keys'](_0xa65209['query']);_0x6a3a04[_0x978f('0x34')]=_[_0x978f('0x35')](_0x6a3a04['model'],_0x6a3a04[_0x978f('0x33')]);_0x1aae37[_0x978f('0x37')]=_[_0x978f('0x35')](_0x6a3a04[_0x978f('0x36')],qs['fields'](_0xa65209[_0x978f('0x33')]['fields']));_0x1aae37[_0x978f('0x37')]=_0x1aae37[_0x978f('0x37')][_0x978f('0x4a')]?_0x1aae37[_0x978f('0x37')]:_0x6a3a04[_0x978f('0x36')];_0x1aae37[_0x978f('0x3a')]=qs['sort'](_0xa65209['query'][_0x978f('0x3b')]);_0x1aae37[_0x978f('0x3c')]=qs['filters'](_[_0x978f('0x3d')](_0xa65209['query'],_0x6a3a04[_0x978f('0x34')]));if(_0xa65209[_0x978f('0x33')][_0x978f('0x40')]){_0x1aae37[_0x978f('0x3c')]=_['merge'](_0x1aae37['where'],{'$or':_['map'](_0x1aae37[_0x978f('0x37')],function(_0x15ff14){var _0x4ae81e={};_0x4ae81e[_0x15ff14]={'$like':'%'+_0xa65209[_0x978f('0x33')][_0x978f('0x40')]+'%'};return _0x4ae81e;})});}_0x1aae37=_[_0x978f('0x3e')]({},_0x1aae37,_0xa65209[_0x978f('0x41')]);return _0x57f8f0['getConfigurations'](_0x1aae37);}})['then'](function(_0x2a8152){if(_0x2a8152){_0xf23643=_0x2a8152[_0x978f('0x4a')];if(!_0xa65209[_0x978f('0x33')][_0x978f('0x38')](_0x978f('0x39'))){_0x1aae37[_0x978f('0x1e')]=qs[_0x978f('0x1e')](_0xa65209[_0x978f('0x33')][_0x978f('0x1e')]);_0x1aae37[_0x978f('0x1c')]=qs[_0x978f('0x1c')](_0xa65209[_0x978f('0x33')]['offset']);}return _0x57f8f0['getConfigurations'](_0x1aae37);}})['then'](function(_0x1e3d65){if(_0x1e3d65){return _0x1e3d65?{'count':_0xf23643,'rows':_0x1e3d65}:null;}})['then'](respondWithResult(_0x2a21f1,null))['catch'](handleError(_0x2a21f1,null));};exports[_0x978f('0x50')]=function(_0x204ee6,_0x3266c6,_0x5f2f62){if(_0x204ee6[_0x978f('0x4e')]['id']){delete _0x204ee6[_0x978f('0x4e')]['id'];}return db[_0x978f('0x2e')]['findOne']({'where':{'id':_0x204ee6[_0x978f('0x47')]['id']}})[_0x978f('0x25')](handleEntityNotFound(_0x3266c6,null))['then'](function(_0x4654e2){if(_0x4654e2){_0x204ee6[_0x978f('0x4e')][_0x978f('0x51')]=_0x4654e2['id'];_0x204ee6[_0x978f('0x4e')][_0x978f('0x52')]=integrations[_0x978f('0x53')](_0x204ee6['body'][_0x978f('0x54')],_0x204ee6[_0x978f('0x4e')][_0x978f('0x30')]);_0x204ee6[_0x978f('0x4e')][_0x978f('0x55')]=integrations[_0x978f('0x56')](_0x204ee6[_0x978f('0x4e')][_0x978f('0x54')],_0x204ee6['body'][_0x978f('0x30')]);return db[_0x978f('0x57')]['create'](_0x204ee6['body'],{'include':[{'model':db[_0x978f('0x58')],'as':_0x978f('0x52')},{'model':db[_0x978f('0x58')],'as':_0x978f('0x55')}]});}return null;})[_0x978f('0x25')](respondWithResult(_0x3266c6,null))[_0x978f('0x4c')](handleError(_0x3266c6,null));};var md5=require('md5');exports[_0x978f('0x59')]=function(_0x46c3d2,_0x1f23b3,_0x1a28f3){var _0x3f8bbb=null;var _0x19a63e=null;var _0x4e1c4c=null;var _0x538c65=null;var _0x541925='';return db[_0x978f('0x2e')]['findOne']({'where':{'id':_0x46c3d2[_0x978f('0x47')]['id']},'attributes':['id',_0x978f('0x2a'),_0x978f('0x5a'),_0x978f('0x5b'),_0x978f('0x5c'),_0x978f('0x5d'),'serverUrl',_0x978f('0x5e')]})[_0x978f('0x25')](handleEntityNotFound(_0x1f23b3,null))[_0x978f('0x25')](function(_0x4178fb){if(_0x4178fb){_0x3f8bbb=_0x4178fb[_0x978f('0x5a')];_0x19a63e=_0x4178fb[_0x978f('0x5e')];_0x4e1c4c=_0x4178fb['moduleName'];_0x541925=_0x4178fb[_0x978f('0x5d')];var _0x3463ac=_0x541925[_0x978f('0x5f')](-0x1);if(_0x3463ac==='/'){_0x541925=_0x541925['substring'](0x0,_0x541925['lastIndexOf'](_0x3463ac));}_0x538c65=util[_0x978f('0x60')](_0x978f('0x61'),_0x541925);var _0x31e571={'method':'GET','uri':_0x538c65,'qs':{'operation':_0x978f('0x62'),'username':_0x4178fb[_0x978f('0x5a')]},'json':!![]};return rp(_0x31e571);}})[_0x978f('0x25')](function(_0x57bbea){if(_0x57bbea['success']){var _0x32a5cb={'method':_0x978f('0x63'),'uri':_0x538c65,'form':{'operation':'login','username':_0x3f8bbb,'accessKey':md5(_0x57bbea[_0x978f('0x64')][_0x978f('0x65')]+_0x19a63e)},'json':!![]};return rp(_0x32a5cb);}})[_0x978f('0x25')](function(_0x399795){if(_0x399795[_0x978f('0x66')]){var _0x5405ea={'method':_0x978f('0x67'),'uri':_0x538c65,'qs':{'operation':_0x978f('0x68'),'username':_0x3f8bbb,'sessionName':_0x399795[_0x978f('0x64')]['sessionName'],'elementType':_0x4e1c4c},'json':!![]};return rp(_0x5405ea);}})['then'](function(_0x53e251){if(_0x53e251['success']){var _0x258c5a=[_0x978f('0x69'),_0x978f('0x6a'),_0x978f('0x6b')];_[_0x978f('0x6c')](_0x53e251[_0x978f('0x64')][_0x978f('0x49')],function(_0x178368){return _0x258c5a[_0x978f('0x6d')](_0x178368[_0x978f('0x30')][_0x978f('0x2a')]);});_[_0x978f('0x6c')](_0x53e251['result'][_0x978f('0x49')],function(_0xaf1bf2){return _0xaf1bf2[_0x978f('0x6e')]===_0x978f('0x6f');});return{'count':_0x53e251[_0x978f('0x64')][_0x978f('0x49')]['length'],'rows':_[_0x978f('0x2d')](_0x53e251[_0x978f('0x64')][_0x978f('0x49')],function(_0x52e525){return{'id':_0x52e525[_0x978f('0x2a')],'name':_0x52e525[_0x978f('0x70')],'custom':_[_0x978f('0x71')](_0x52e525[_0x978f('0x2a')],_0x978f('0x72'))?!![]:![],'options':_0x52e525[_0x978f('0x30')][_0x978f('0x2a')]==='picklist'&&_0x52e525[_0x978f('0x30')][_0x978f('0x73')][_0x978f('0x4a')]>0x0?_[_0x978f('0x2d')](_0x52e525[_0x978f('0x30')][_0x978f('0x73')],function(_0x4a7f1f){return{'name':_0x4a7f1f[_0x978f('0x70')],'value':_0x4a7f1f['value']};}):[]};})};}})[_0x978f('0x25')](respondWithResult(_0x1f23b3,null))[_0x978f('0x4c')](function(_0x236f31){console[_0x978f('0x74')](_0x978f('0x75')+_0x236f31);var _0x405fef=_0x46c3d2[_0x978f('0x33')]['test']?0x1f4:_0x236f31[_0x978f('0x76')]||0x1f4;logger['error'](_0x978f('0x77'),_0x978f('0x59'),_0x405fef,JSON[_0x978f('0x78')](_0x236f31));delete _0x236f31['name'];if(_0x405fef===0x191){_0x405fef=0x190;}_0x1f23b3[_0x978f('0x27')](_0x405fef)['send'](_0x46c3d2[_0x978f('0x33')][_0x978f('0x79')]?{'message':_0x978f('0x7a'),'statusCode':_0x236f31['statusCode']}:_0x236f31);});}; \ No newline at end of file +var _0x53d0=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','VtigerAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','include','find','body','getConfigurations','findOne','VtigerConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','create','VtigerField','Descriptions','md5','serverUrl','username','accessKey','moduleName','slice','substring','format','GET','getchallenge','POST','login','result','token','success','reference','owner','remove','includes','editable','false','label','cf_','picklistValues','value','log','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4ac06a,_0x5caa1c){var _0x436089=function(_0x1486e8){while(--_0x1486e8){_0x4ac06a['push'](_0x4ac06a['shift']());}};_0x436089(++_0x5caa1c);}(_0x53d0,0x1c4));var _0x053d=function(_0x1799a0,_0x39d134){_0x1799a0=_0x1799a0-0x0;var _0x11f118=_0x53d0[_0x1799a0];return _0x11f118;};'use strict';var emlformat=require(_0x053d('0x0'));var rimraf=require(_0x053d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x053d('0x2'));var moment=require('moment');var BPromise=require(_0x053d('0x3'));var Mustache=require(_0x053d('0x4'));var util=require(_0x053d('0x5'));var path=require(_0x053d('0x6'));var sox=require('sox');var csv=require(_0x053d('0x7'));var ejs=require(_0x053d('0x8'));var fs=require('fs');var fs_extra=require(_0x053d('0x9'));var _=require(_0x053d('0xa'));var squel=require(_0x053d('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x053d('0xc'));var toCsv=require(_0x053d('0x7'));var querystring=require('querystring');var Papa=require(_0x053d('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x053d('0xe'));var as=require(_0x053d('0xf'));var hardwareService=require(_0x053d('0x10'));var logger=require(_0x053d('0x11'))(_0x053d('0x12'));var utils=require('../../config/utils');var config=require(_0x053d('0x13'));var licenseUtil=require(_0x053d('0x14'));var db=require(_0x053d('0x15'))['db'];var integrations=require(_0x053d('0x16'));function respondWithStatusCode(_0x5324ae,_0x25ee85){_0x25ee85=_0x25ee85||0xcc;return function(_0x1e824e){if(_0x1e824e){return _0x5324ae['sendStatus'](_0x25ee85);}return _0x5324ae[_0x053d('0x17')](_0x25ee85)[_0x053d('0x18')]();};}function respondWithResult(_0x2bb918,_0x35ec7c){_0x35ec7c=_0x35ec7c||0xc8;return function(_0x4a3f0a){if(_0x4a3f0a){return _0x2bb918['status'](_0x35ec7c)['json'](_0x4a3f0a);}};}function respondWithFilteredResult(_0x417342,_0x33d6c0){return function(_0x4efbf7){if(_0x4efbf7){var _0x2c26f6=typeof _0x33d6c0['offset']===_0x053d('0x19')&&typeof _0x33d6c0[_0x053d('0x1a')]===_0x053d('0x19');var _0x22abb5=_0x4efbf7[_0x053d('0x1b')];var _0x41fe06=_0x2c26f6?0x0:_0x33d6c0['offset'];var _0x406735=_0x2c26f6?_0x4efbf7[_0x053d('0x1b')]:_0x33d6c0[_0x053d('0x1c')]+_0x33d6c0[_0x053d('0x1a')];var _0x506505;if(_0x406735>=_0x22abb5){_0x406735=_0x22abb5;_0x506505=0xc8;}else{_0x506505=0xce;}_0x417342[_0x053d('0x17')](_0x506505);return _0x417342['set'](_0x053d('0x1d'),_0x41fe06+'-'+_0x406735+'/'+_0x22abb5)[_0x053d('0x1e')](_0x4efbf7);}return null;};}function patchUpdates(_0x2aa525){return function(_0x42aa15){try{jsonpatch[_0x053d('0x1f')](_0x42aa15,_0x2aa525,!![]);}catch(_0x277a5c){return BPromise[_0x053d('0x20')](_0x277a5c);}return _0x42aa15[_0x053d('0x21')]();};}function saveUpdates(_0x420e97,_0x3d75b6){return function(_0xad7026){if(_0xad7026){return _0xad7026[_0x053d('0x22')](_0x420e97)[_0x053d('0x23')](function(_0x160f89){return _0x160f89;});}return null;};}function removeEntity(_0x131397,_0x12ab0f){return function(_0x2f8756){if(_0x2f8756){return _0x2f8756[_0x053d('0x24')]()[_0x053d('0x23')](function(){_0x131397['status'](0xcc)[_0x053d('0x18')]();});}};}function handleEntityNotFound(_0x18cd5a,_0x513664){return function(_0x1f8dc9){if(!_0x1f8dc9){_0x18cd5a[_0x053d('0x25')](0x194);}return _0x1f8dc9;};}function handleError(_0x45d824,_0x5ef1cf){_0x5ef1cf=_0x5ef1cf||0x1f4;return function(_0x204874){logger[_0x053d('0x26')](_0x204874[_0x053d('0x27')]);if(_0x204874[_0x053d('0x28')]){delete _0x204874['name'];}_0x45d824[_0x053d('0x17')](_0x5ef1cf)['send'](_0x204874);};}exports[_0x053d('0x29')]=function(_0x2e281e,_0x4a19c5){var _0x14845e={},_0x2fade4={},_0x3901e4={'count':0x0,'rows':[]};var _0x567884=_['map'](db[_0x053d('0x2a')][_0x053d('0x2b')],function(_0x22f3d6){return{'name':_0x22f3d6[_0x053d('0x2c')],'type':_0x22f3d6[_0x053d('0x2d')]['key']};});_0x2fade4[_0x053d('0x2e')]=_[_0x053d('0x2f')](_0x567884,_0x053d('0x28'));_0x2fade4[_0x053d('0x30')]=_[_0x053d('0x31')](_0x2e281e['query']);_0x2fade4[_0x053d('0x32')]=_[_0x053d('0x33')](_0x2fade4[_0x053d('0x2e')],_0x2fade4[_0x053d('0x30')]);_0x14845e['attributes']=_[_0x053d('0x33')](_0x2fade4[_0x053d('0x2e')],qs[_0x053d('0x34')](_0x2e281e['query'][_0x053d('0x34')]));_0x14845e[_0x053d('0x35')]=_0x14845e[_0x053d('0x35')][_0x053d('0x36')]?_0x14845e[_0x053d('0x35')]:_0x2fade4[_0x053d('0x2e')];if(!_0x2e281e['query'][_0x053d('0x37')](_0x053d('0x38'))){_0x14845e[_0x053d('0x1a')]=qs[_0x053d('0x1a')](_0x2e281e[_0x053d('0x30')][_0x053d('0x1a')]);_0x14845e[_0x053d('0x1c')]=qs[_0x053d('0x1c')](_0x2e281e[_0x053d('0x30')][_0x053d('0x1c')]);}_0x14845e[_0x053d('0x39')]=qs[_0x053d('0x3a')](_0x2e281e['query'][_0x053d('0x3a')]);_0x14845e['where']=qs[_0x053d('0x32')](_['pick'](_0x2e281e['query'],_0x2fade4['filters']),_0x567884);if(_0x2e281e['query'][_0x053d('0x3b')]){_0x14845e[_0x053d('0x3c')]=_['merge'](_0x14845e[_0x053d('0x3c')],{'$or':_[_0x053d('0x2f')](_0x567884,function(_0x3820cd){if(_0x3820cd[_0x053d('0x2d')]!==_0x053d('0x3d')){var _0x3933eb={};_0x3933eb[_0x3820cd[_0x053d('0x28')]]={'$like':'%'+_0x2e281e[_0x053d('0x30')][_0x053d('0x3b')]+'%'};return _0x3933eb;}})});}_0x14845e=_[_0x053d('0x3e')]({},_0x14845e,_0x2e281e[_0x053d('0x3f')]);var _0x572478={'where':_0x14845e[_0x053d('0x3c')]};return db[_0x053d('0x2a')]['count'](_0x572478)[_0x053d('0x23')](function(_0xe3f3ec){_0x3901e4[_0x053d('0x1b')]=_0xe3f3ec;if(_0x2e281e[_0x053d('0x30')][_0x053d('0x40')]){_0x14845e['include']=[{'all':!![]}];}return db[_0x053d('0x2a')][_0x053d('0x41')](_0x14845e);})[_0x053d('0x23')](function(_0x3ffdfa){_0x3901e4[_0x053d('0x42')]=_0x3ffdfa;return _0x3901e4;})[_0x053d('0x23')](respondWithFilteredResult(_0x4a19c5,_0x14845e))[_0x053d('0x43')](handleError(_0x4a19c5,null));};exports['show']=function(_0x5daadb,_0x29cb54){var _0x16d73c={'raw':![],'where':{'id':_0x5daadb[_0x053d('0x44')]['id']}},_0xb9576={};_0xb9576[_0x053d('0x2e')]=_['keys'](db[_0x053d('0x2a')][_0x053d('0x2b')]);_0xb9576[_0x053d('0x30')]=_[_0x053d('0x31')](_0x5daadb[_0x053d('0x30')]);_0xb9576[_0x053d('0x32')]=_[_0x053d('0x33')](_0xb9576['model'],_0xb9576[_0x053d('0x30')]);_0x16d73c[_0x053d('0x35')]=_[_0x053d('0x33')](_0xb9576[_0x053d('0x2e')],qs['fields'](_0x5daadb[_0x053d('0x30')][_0x053d('0x34')]));_0x16d73c[_0x053d('0x35')]=_0x16d73c[_0x053d('0x35')][_0x053d('0x36')]?_0x16d73c[_0x053d('0x35')]:_0xb9576[_0x053d('0x2e')];if(_0x5daadb[_0x053d('0x30')][_0x053d('0x40')]){_0x16d73c[_0x053d('0x45')]=[{'all':!![]}];}_0x16d73c=_[_0x053d('0x3e')]({},_0x16d73c,_0x5daadb[_0x053d('0x3f')]);return db[_0x053d('0x2a')][_0x053d('0x46')](_0x16d73c)[_0x053d('0x23')](handleEntityNotFound(_0x29cb54,null))[_0x053d('0x23')](respondWithResult(_0x29cb54,null))['catch'](handleError(_0x29cb54,null));};exports['create']=function(_0x5b8f93,_0x1f73e5){return db['VtigerAccount']['create'](_0x5b8f93['body'],{})[_0x053d('0x23')](respondWithResult(_0x1f73e5,0xc9))[_0x053d('0x43')](handleError(_0x1f73e5,null));};exports[_0x053d('0x22')]=function(_0x5585d1,_0x2c6648){if(_0x5585d1[_0x053d('0x47')]['id']){delete _0x5585d1[_0x053d('0x47')]['id'];}return db[_0x053d('0x2a')][_0x053d('0x46')]({'where':{'id':_0x5585d1[_0x053d('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c6648,null))['then'](saveUpdates(_0x5585d1[_0x053d('0x47')],null))[_0x053d('0x23')](respondWithResult(_0x2c6648,null))[_0x053d('0x43')](handleError(_0x2c6648,null));};exports[_0x053d('0x24')]=function(_0x9b9442,_0x33238a){return db[_0x053d('0x2a')][_0x053d('0x46')]({'where':{'id':_0x9b9442[_0x053d('0x44')]['id']}})['then'](handleEntityNotFound(_0x33238a,null))[_0x053d('0x23')](removeEntity(_0x33238a,null))[_0x053d('0x43')](handleError(_0x33238a,null));};exports[_0x053d('0x48')]=function(_0x2fb95f,_0x5ae890,_0x472880){var _0x54b722={};var _0x584eee={};var _0x2b5109;var _0x3857b0;return db[_0x053d('0x2a')][_0x053d('0x49')]({'where':{'id':_0x2fb95f[_0x053d('0x44')]['id']}})[_0x053d('0x23')](handleEntityNotFound(_0x5ae890,null))[_0x053d('0x23')](function(_0x548c1e){if(_0x548c1e){_0x2b5109=_0x548c1e;_0x584eee[_0x053d('0x2e')]=_[_0x053d('0x31')](db[_0x053d('0x4a')]['rawAttributes']);_0x584eee['query']=_['keys'](_0x2fb95f[_0x053d('0x30')]);_0x584eee[_0x053d('0x32')]=_[_0x053d('0x33')](_0x584eee[_0x053d('0x2e')],_0x584eee['query']);_0x54b722[_0x053d('0x35')]=_[_0x053d('0x33')](_0x584eee[_0x053d('0x2e')],qs['fields'](_0x2fb95f[_0x053d('0x30')][_0x053d('0x34')]));_0x54b722[_0x053d('0x35')]=_0x54b722[_0x053d('0x35')][_0x053d('0x36')]?_0x54b722[_0x053d('0x35')]:_0x584eee[_0x053d('0x2e')];_0x54b722[_0x053d('0x39')]=qs[_0x053d('0x3a')](_0x2fb95f[_0x053d('0x30')][_0x053d('0x3a')]);_0x54b722[_0x053d('0x3c')]=qs['filters'](_[_0x053d('0x4b')](_0x2fb95f[_0x053d('0x30')],_0x584eee[_0x053d('0x32')]));if(_0x2fb95f[_0x053d('0x30')][_0x053d('0x3b')]){_0x54b722[_0x053d('0x3c')]=_[_0x053d('0x3e')](_0x54b722['where'],{'$or':_[_0x053d('0x2f')](_0x54b722[_0x053d('0x35')],function(_0x2500eb){var _0x2dc0eb={};_0x2dc0eb[_0x2500eb]={'$like':'%'+_0x2fb95f['query'][_0x053d('0x3b')]+'%'};return _0x2dc0eb;})});}_0x54b722=_['merge']({},_0x54b722,_0x2fb95f['options']);return _0x2b5109[_0x053d('0x48')](_0x54b722);}})['then'](function(_0x21c1ff){if(_0x21c1ff){_0x3857b0=_0x21c1ff[_0x053d('0x36')];if(!_0x2fb95f[_0x053d('0x30')]['hasOwnProperty'](_0x053d('0x38'))){_0x54b722[_0x053d('0x1a')]=qs[_0x053d('0x1a')](_0x2fb95f[_0x053d('0x30')][_0x053d('0x1a')]);_0x54b722[_0x053d('0x1c')]=qs[_0x053d('0x1c')](_0x2fb95f[_0x053d('0x30')]['offset']);}return _0x2b5109['getConfigurations'](_0x54b722);}})['then'](function(_0x5ad61d){if(_0x5ad61d){return _0x5ad61d?{'count':_0x3857b0,'rows':_0x5ad61d}:null;}})['then'](respondWithResult(_0x5ae890,null))[_0x053d('0x43')](handleError(_0x5ae890,null));};exports[_0x053d('0x4c')]=function(_0x143da9,_0x4f2bbf,_0xa9440f){if(_0x143da9[_0x053d('0x47')]['id']){delete _0x143da9[_0x053d('0x47')]['id'];}return db['VtigerAccount'][_0x053d('0x49')]({'where':{'id':_0x143da9[_0x053d('0x44')]['id']}})[_0x053d('0x23')](handleEntityNotFound(_0x4f2bbf,null))[_0x053d('0x23')](function(_0x33a663){if(_0x33a663){_0x143da9[_0x053d('0x47')][_0x053d('0x4d')]=_0x33a663['id'];_0x143da9[_0x053d('0x47')][_0x053d('0x4e')]=integrations[_0x053d('0x4f')](_0x143da9['body']['channel'],_0x143da9[_0x053d('0x47')][_0x053d('0x2d')]);_0x143da9['body']['Descriptions']=integrations['getDescriptions'](_0x143da9[_0x053d('0x47')][_0x053d('0x50')],_0x143da9[_0x053d('0x47')][_0x053d('0x2d')]);return db['VtigerConfiguration'][_0x053d('0x51')](_0x143da9[_0x053d('0x47')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0x053d('0x52')],'as':_0x053d('0x53')}]});}return null;})[_0x053d('0x23')](respondWithResult(_0x4f2bbf,null))['catch'](handleError(_0x4f2bbf,null));};var md5=require(_0x053d('0x54'));exports['getFields']=function(_0x4492c3,_0x18baac,_0x1b79ed){var _0x3d1f90=null;var _0x2909da=null;var _0x88c927=null;var _0x5c35b6=null;var _0x4a395b='';return db[_0x053d('0x2a')][_0x053d('0x49')]({'where':{'id':_0x4492c3['params']['id']},'attributes':['id',_0x053d('0x28'),'username','description','moduleName','remoteUri',_0x053d('0x55'),'accessKey']})[_0x053d('0x23')](handleEntityNotFound(_0x18baac,null))['then'](function(_0x42e12a){if(_0x42e12a){_0x3d1f90=_0x42e12a[_0x053d('0x56')];_0x2909da=_0x42e12a[_0x053d('0x57')];_0x88c927=_0x42e12a[_0x053d('0x58')];_0x4a395b=_0x42e12a['remoteUri'];var _0x38128a=_0x4a395b[_0x053d('0x59')](-0x1);if(_0x38128a==='/'){_0x4a395b=_0x4a395b[_0x053d('0x5a')](0x0,_0x4a395b['lastIndexOf'](_0x38128a));}_0x5c35b6=util[_0x053d('0x5b')]('%s/webservice.php',_0x4a395b);var _0x3d77d5={'method':_0x053d('0x5c'),'uri':_0x5c35b6,'qs':{'operation':_0x053d('0x5d'),'username':_0x42e12a['username']},'json':!![]};return rp(_0x3d77d5);}})[_0x053d('0x23')](function(_0x614aaf){if(_0x614aaf['success']){var _0x12c55a={'method':_0x053d('0x5e'),'uri':_0x5c35b6,'form':{'operation':_0x053d('0x5f'),'username':_0x3d1f90,'accessKey':md5(_0x614aaf[_0x053d('0x60')][_0x053d('0x61')]+_0x2909da)},'json':!![]};return rp(_0x12c55a);}})[_0x053d('0x23')](function(_0x2f1930){if(_0x2f1930[_0x053d('0x62')]){var _0x144e75={'method':_0x053d('0x5c'),'uri':_0x5c35b6,'qs':{'operation':'describe','username':_0x3d1f90,'sessionName':_0x2f1930[_0x053d('0x60')]['sessionName'],'elementType':_0x88c927},'json':!![]};return rp(_0x144e75);}})[_0x053d('0x23')](function(_0x48a2f9){if(_0x48a2f9[_0x053d('0x62')]){var _0x4d197c=['autogenerated',_0x053d('0x63'),_0x053d('0x64')];_[_0x053d('0x65')](_0x48a2f9[_0x053d('0x60')][_0x053d('0x34')],function(_0x30bc6d){return _0x4d197c[_0x053d('0x66')](_0x30bc6d[_0x053d('0x2d')][_0x053d('0x28')]);});_[_0x053d('0x65')](_0x48a2f9['result'][_0x053d('0x34')],function(_0x564112){return _0x564112[_0x053d('0x67')]===_0x053d('0x68');});return{'count':_0x48a2f9[_0x053d('0x60')]['fields'][_0x053d('0x36')],'rows':_[_0x053d('0x2f')](_0x48a2f9[_0x053d('0x60')]['fields'],function(_0x1a61b1){return{'id':_0x1a61b1[_0x053d('0x28')],'name':_0x1a61b1[_0x053d('0x69')],'custom':_['startsWith'](_0x1a61b1['name'],_0x053d('0x6a'))?!![]:![],'options':_0x1a61b1[_0x053d('0x2d')][_0x053d('0x28')]==='picklist'&&_0x1a61b1[_0x053d('0x2d')][_0x053d('0x6b')]['length']>0x0?_[_0x053d('0x2f')](_0x1a61b1[_0x053d('0x2d')][_0x053d('0x6b')],function(_0x3c0a4d){return{'name':_0x3c0a4d[_0x053d('0x69')],'value':_0x3c0a4d[_0x053d('0x6c')]};}):[]};})};}})['then'](respondWithResult(_0x18baac,null))[_0x053d('0x43')](function(_0x439434){console[_0x053d('0x6d')](_0x053d('0x6e')+_0x439434);var _0x77602=_0x4492c3[_0x053d('0x30')]['test']?0x1f4:_0x439434['statusCode']||0x1f4;logger['error'](_0x053d('0x6f'),_0x053d('0x70'),_0x77602,JSON[_0x053d('0x71')](_0x439434));delete _0x439434[_0x053d('0x28')];if(_0x77602===0x191){_0x77602=0x190;}_0x18baac[_0x053d('0x17')](_0x77602)[_0x053d('0x72')](_0x4492c3['query'][_0x053d('0x73')]?{'message':_0x053d('0x74'),'statusCode':_0x439434['statusCode']}:_0x439434);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index fda50e9..f74f69a 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 _0xf1f6=['define','VtigerAccount','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x578c69,_0x13fbc5){var _0x491cf5=function(_0x164420){while(--_0x164420){_0x578c69['push'](_0x578c69['shift']());}};_0x491cf5(++_0x13fbc5);}(_0xf1f6,0x7a));var _0x6f1f=function(_0xfcc49a,_0x4e7f85){_0xfcc49a=_0xfcc49a-0x0;var _0x327804=_0xf1f6[_0xfcc49a];return _0x327804;};'use strict';var _=require(_0x6f1f('0x0'));var util=require(_0x6f1f('0x1'));var logger=require('../../config/logger')(_0x6f1f('0x2'));var moment=require(_0x6f1f('0x3'));var BPromise=require(_0x6f1f('0x4'));var rp=require(_0x6f1f('0x5'));var fs=require('fs');var path=require(_0x6f1f('0x6'));var rimraf=require(_0x6f1f('0x7'));var config=require(_0x6f1f('0x8'));var attributes=require(_0x6f1f('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xbd9302,_0x37a754){return _0xbd9302[_0x6f1f('0xa')](_0x6f1f('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadeb=['lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','int_vtiger_accounts'];(function(_0x4d87d3,_0x9987f){var _0x3433af=function(_0x4ec51b){while(--_0x4ec51b){_0x4d87d3['push'](_0x4d87d3['shift']());}};_0x3433af(++_0x9987f);}(_0xadeb,0xf2));var _0xbade=function(_0x2394f6,_0x110ecf){_0x2394f6=_0x2394f6-0x0;var _0x545995=_0xadeb[_0x2394f6];return _0x545995;};'use strict';var _=require(_0xbade('0x0'));var util=require(_0xbade('0x1'));var logger=require(_0xbade('0x2'))(_0xbade('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbade('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbade('0x5'));var config=require(_0xbade('0x6'));var attributes=require(_0xbade('0x7'));var integrations=require(_0xbade('0x8'));module['exports']=function(_0x5aac8d,_0x524717){return _0x5aac8d[_0xbade('0x9')]('VtigerAccount',attributes,{'tableName':_0xbade('0xa'),'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 e488f32..297ba1a 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 _0xe511=['find','attributes','ShowVtigerAccount','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','options','raw','where','include','map','model','then'];(function(_0x1307f9,_0x43802d){var _0x115fa1=function(_0x6c0ef3){while(--_0x6c0ef3){_0x1307f9['push'](_0x1307f9['shift']());}};_0x115fa1(++_0x43802d);}(_0xe511,0x16f));var _0x1e51=function(_0xfa5c65,_0x54ab9b){_0xfa5c65=_0xfa5c65-0x0;var _0x3946c0=_0xe511[_0xfa5c65];return _0x3946c0;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var moment=require('moment');var BPromise=require(_0x1e51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e51('0x3'));var db=require(_0x1e51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e51('0x5'))(_0x1e51('0x6'));var config=require(_0x1e51('0x7'));var jayson=require(_0x1e51('0x8'));var client=jayson['client'][_0x1e51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21ed6b,_0x5c4590,_0x4fa2ba){return new BPromise(function(_0x394ad8,_0x133021){return client['request'](_0x21ed6b,_0x4fa2ba)['then'](function(_0x658941){logger[_0x1e51('0xa')](_0x1e51('0xb'),_0x5c4590,_0x1e51('0xc'));logger[_0x1e51('0xd')](_0x1e51('0xe'),_0x5c4590,'request\x20sent',JSON[_0x1e51('0xf')](_0x658941));if(_0x658941[_0x1e51('0x10')]){if(_0x658941[_0x1e51('0x10')][_0x1e51('0x11')]===0x1f4){logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941['error'][_0x1e51('0x12')]);return _0x133021(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);return _0x394ad8(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}else{logger[_0x1e51('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x5c4590,_0x1e51('0xc'));_0x394ad8(_0x658941[_0x1e51('0x13')][_0x1e51('0x12')]);}})['catch'](function(_0xa3b410){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x5c4590,_0xa3b410);_0x133021(_0xa3b410);});});}exports[_0x1e51('0x14')]=function(_0x27dcad){var _0x40ae4c=this;return new Promise(function(_0x4785a5,_0x4d1aae){return db[_0x1e51('0x15')]['findAll']({'raw':_0x27dcad[_0x1e51('0x16')]?_0x27dcad['options'][_0x1e51('0x17')]===undefined?!![]:![]:!![],'where':_0x27dcad[_0x1e51('0x16')]?_0x27dcad[_0x1e51('0x16')][_0x1e51('0x18')]||null:null,'attributes':_0x27dcad['options']?_0x27dcad['options']['attributes']||null:null,'limit':_0x27dcad['options']?_0x27dcad[_0x1e51('0x16')]['limit']||null:null,'include':_0x27dcad[_0x1e51('0x16')]?_0x27dcad[_0x1e51('0x16')][_0x1e51('0x19')]?_[_0x1e51('0x1a')](_0x27dcad[_0x1e51('0x16')][_0x1e51('0x19')],function(_0x270adf){return{'model':db[_0x270adf[_0x1e51('0x1b')]],'as':_0x270adf['as'],'attributes':_0x270adf['attributes'],'include':_0x270adf['include']?_[_0x1e51('0x1a')](_0x270adf[_0x1e51('0x19')],function(_0x2e42b1){return{'model':db[_0x2e42b1[_0x1e51('0x1b')]],'as':_0x2e42b1['as'],'attributes':_0x2e42b1['attributes'],'include':_0x2e42b1['include']?_['map'](_0x2e42b1[_0x1e51('0x19')],function(_0x2a1561){return{'model':db[_0x2a1561[_0x1e51('0x1b')]],'as':_0x2a1561['as'],'attributes':_0x2a1561['attributes']};}):[]};}):[]};}):[]:[]})[_0x1e51('0x1c')](function(_0x49c507){logger['info'](_0x1e51('0x14'),_0x27dcad);logger['debug'](_0x1e51('0x14'),_0x27dcad,JSON[_0x1e51('0xf')](_0x49c507));_0x4785a5(_0x49c507);})['catch'](function(_0x3e6ef2){logger[_0x1e51('0x10')](_0x1e51('0x14'),_0x3e6ef2[_0x1e51('0x12')],_0x27dcad);_0x4d1aae(_0x40ae4c['error'](0x1f4,_0x3e6ef2['message']));});});};exports['ShowVtigerAccount']=function(_0x20eb9b){var _0x288b50=this;return new Promise(function(_0x1ba84a,_0x36dabe){return db[_0x1e51('0x15')][_0x1e51('0x1d')]({'raw':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')][_0x1e51('0x17')]===undefined?!![]:![]:!![],'where':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')]['where']||null:null,'attributes':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')][_0x1e51('0x1e')]||null:null,'include':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')]['include']?_[_0x1e51('0x1a')](_0x20eb9b['options'][_0x1e51('0x19')],function(_0x3fb57e){return{'model':db[_0x3fb57e[_0x1e51('0x1b')]],'as':_0x3fb57e['as'],'attributes':_0x3fb57e['attributes'],'include':_0x3fb57e[_0x1e51('0x19')]?_['map'](_0x3fb57e[_0x1e51('0x19')],function(_0x4e0187){return{'model':db[_0x4e0187['model']],'as':_0x4e0187['as'],'attributes':_0x4e0187[_0x1e51('0x1e')],'include':_0x4e0187[_0x1e51('0x19')]?_[_0x1e51('0x1a')](_0x4e0187['include'],function(_0x42ac30){return{'model':db[_0x42ac30['model']],'as':_0x42ac30['as'],'attributes':_0x42ac30[_0x1e51('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1e51('0x1c')](function(_0x5760ba){logger[_0x1e51('0xa')](_0x1e51('0x1f'),_0x20eb9b);logger[_0x1e51('0xd')](_0x1e51('0x1f'),_0x20eb9b,JSON[_0x1e51('0xf')](_0x5760ba));_0x1ba84a(_0x5760ba);})[_0x1e51('0x20')](function(_0x5c57a6){logger['error'](_0x1e51('0x1f'),_0x5c57a6['message'],_0x20eb9b);_0x36dabe(_0x288b50[_0x1e51('0x10')](0x1f4,_0x5c57a6[_0x1e51('0x12')]));});});}; \ No newline at end of file +var _0x878f=['ShowVtigerAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','then','stringify'];(function(_0x1aefea,_0x39e5fa){var _0x33a7a1=function(_0x5cef45){while(--_0x5cef45){_0x1aefea['push'](_0x1aefea['shift']());}};_0x33a7a1(++_0x39e5fa);}(_0x878f,0x173));var _0xf878=function(_0x1f03e6,_0x5c3fd2){_0x1f03e6=_0x1f03e6-0x0;var _0x15aac7=_0x878f[_0x1f03e6];return _0x15aac7;};'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);});});}exports[_0xf878('0x15')]=function(_0x3b2e1b){var _0x47a91a=this;return new Promise(function(_0x2b2b54,_0x34ae59){return db[_0xf878('0x16')][_0xf878('0x17')]({'raw':_0x3b2e1b[_0xf878('0x18')]?_0x3b2e1b[_0xf878('0x18')][_0xf878('0x19')]===undefined?!![]:![]:!![],'where':_0x3b2e1b['options']?_0x3b2e1b[_0xf878('0x18')][_0xf878('0x1a')]||null:null,'attributes':_0x3b2e1b[_0xf878('0x18')]?_0x3b2e1b['options'][_0xf878('0x1b')]||null:null,'limit':_0x3b2e1b[_0xf878('0x18')]?_0x3b2e1b[_0xf878('0x18')][_0xf878('0x1c')]||null:null,'include':_0x3b2e1b[_0xf878('0x18')]?_0x3b2e1b[_0xf878('0x18')][_0xf878('0x1d')]?_[_0xf878('0x1e')](_0x3b2e1b[_0xf878('0x18')][_0xf878('0x1d')],function(_0x45e61f){return{'model':db[_0x45e61f['model']],'as':_0x45e61f['as'],'attributes':_0x45e61f[_0xf878('0x1b')],'include':_0x45e61f['include']?_[_0xf878('0x1e')](_0x45e61f[_0xf878('0x1d')],function(_0x35b3b4){return{'model':db[_0x35b3b4[_0xf878('0x1f')]],'as':_0x35b3b4['as'],'attributes':_0x35b3b4[_0xf878('0x1b')],'include':_0x35b3b4['include']?_['map'](_0x35b3b4['include'],function(_0x242926){return{'model':db[_0x242926[_0xf878('0x1f')]],'as':_0x242926['as'],'attributes':_0x242926[_0xf878('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfa3e11){logger[_0xf878('0xc')](_0xf878('0x15'),_0x3b2e1b);logger[_0xf878('0x20')](_0xf878('0x15'),_0x3b2e1b,JSON['stringify'](_0xfa3e11));_0x2b2b54(_0xfa3e11);})['catch'](function(_0x9a127d){logger[_0xf878('0x10')]('GetVtigerAccount',_0x9a127d[_0xf878('0x12')],_0x3b2e1b);_0x34ae59(_0x47a91a['error'](0x1f4,_0x9a127d[_0xf878('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x2c61c1){var _0x49e66a=this;return new Promise(function(_0x2630fb,_0x48b151){return db[_0xf878('0x16')][_0xf878('0x21')]({'raw':_0x2c61c1[_0xf878('0x18')]?_0x2c61c1[_0xf878('0x18')][_0xf878('0x19')]===undefined?!![]:![]:!![],'where':_0x2c61c1[_0xf878('0x18')]?_0x2c61c1['options'][_0xf878('0x1a')]||null:null,'attributes':_0x2c61c1[_0xf878('0x18')]?_0x2c61c1[_0xf878('0x18')][_0xf878('0x1b')]||null:null,'include':_0x2c61c1[_0xf878('0x18')]?_0x2c61c1['options'][_0xf878('0x1d')]?_[_0xf878('0x1e')](_0x2c61c1['options'][_0xf878('0x1d')],function(_0xd1ad51){return{'model':db[_0xd1ad51[_0xf878('0x1f')]],'as':_0xd1ad51['as'],'attributes':_0xd1ad51[_0xf878('0x1b')],'include':_0xd1ad51[_0xf878('0x1d')]?_['map'](_0xd1ad51[_0xf878('0x1d')],function(_0x1b09de){return{'model':db[_0x1b09de[_0xf878('0x1f')]],'as':_0x1b09de['as'],'attributes':_0x1b09de[_0xf878('0x1b')],'include':_0x1b09de['include']?_[_0xf878('0x1e')](_0x1b09de['include'],function(_0x4ce1e7){return{'model':db[_0x4ce1e7[_0xf878('0x1f')]],'as':_0x4ce1e7['as'],'attributes':_0x4ce1e7[_0xf878('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf878('0x22')](function(_0x105416){logger[_0xf878('0xc')]('ShowVtigerAccount',_0x2c61c1);logger[_0xf878('0x20')]('ShowVtigerAccount',_0x2c61c1,JSON[_0xf878('0x23')](_0x105416));_0x2630fb(_0x105416);})[_0xf878('0x14')](function(_0x4d4aff){logger[_0xf878('0x10')](_0xf878('0x24'),_0x4d4aff['message'],_0x2c61c1);_0x48b151(_0x49e66a[_0xf878('0x10')](0x1f4,_0x4d4aff[_0xf878('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index b341784..d673bf7 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 _0x344f=['get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x344f,0x185));var _0xf344=function(_0xfbd129,_0x2c6140){_0xfbd129=_0xfbd129-0x0;var _0x3fffe9=_0x344f[_0xfbd129];return _0x3fffe9;};'use strict';var multer=require(_0xf344('0x0'));var util=require('util');var path=require(_0xf344('0x1'));var timeout=require(_0xf344('0x2'));var express=require(_0xf344('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf344('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf344('0x5'));var controller=require(_0xf344('0x6'));router[_0xf344('0x7')]('/',auth[_0xf344('0x8')](),controller[_0xf344('0x9')]);router[_0xf344('0x7')](_0xf344('0xa'),auth[_0xf344('0x8')](),controller[_0xf344('0xb')]);router[_0xf344('0x7')](_0xf344('0xc'),auth[_0xf344('0x8')](),controller['getFields']);router[_0xf344('0x7')](_0xf344('0xd'),auth[_0xf344('0x8')](),controller[_0xf344('0xe')]);router[_0xf344('0x7')](_0xf344('0xf'),auth[_0xf344('0x8')](),controller[_0xf344('0x10')]);router[_0xf344('0x11')]('/',auth['isAuthenticated'](),controller[_0xf344('0x12')]);router['put'](_0xf344('0xa'),auth[_0xf344('0x8')](),controller[_0xf344('0x13')]);router[_0xf344('0x14')](_0xf344('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xf344('0x15')]=router; \ No newline at end of file +var _0x0630=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','post','create','put','delete','multer','util','path'];(function(_0x51cabf,_0x2828db){var _0x517538=function(_0x24a966){while(--_0x24a966){_0x51cabf['push'](_0x51cabf['shift']());}};_0x517538(++_0x2828db);}(_0x0630,0x1e0));var _0x0063=function(_0x550a9f,_0x1486ea){_0x550a9f=_0x550a9f-0x0;var _0x24b71c=_0x0630[_0x550a9f];return _0x24b71c;};'use strict';var multer=require(_0x0063('0x0'));var util=require(_0x0063('0x1'));var path=require(_0x0063('0x2'));var timeout=require(_0x0063('0x3'));var express=require(_0x0063('0x4'));var router=express['Router']();var fs_extra=require(_0x0063('0x5'));var auth=require(_0x0063('0x6'));var interaction=require(_0x0063('0x7'));var config=require(_0x0063('0x8'));var controller=require(_0x0063('0x9'));router['get']('/',auth[_0x0063('0xa')](),controller[_0x0063('0xb')]);router[_0x0063('0xc')](_0x0063('0xd'),auth[_0x0063('0xa')](),controller[_0x0063('0xe')]);router[_0x0063('0xc')]('/:id/fields',auth[_0x0063('0xa')](),controller['getFields']);router[_0x0063('0xc')](_0x0063('0xf'),auth[_0x0063('0xa')](),controller[_0x0063('0x10')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x0063('0x11')]('/',auth[_0x0063('0xa')](),controller[_0x0063('0x12')]);router[_0x0063('0x13')](_0x0063('0xd'),auth[_0x0063('0xa')](),controller['update']);router[_0x0063('0x14')](_0x0063('0xd'),auth[_0x0063('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 798315d..3cfbf86 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 _0xc718=['STRING','sequelize','exports'];(function(_0x5bb03e,_0x41edbf){var _0xcac22d=function(_0x29d9be){while(--_0x29d9be){_0x5bb03e['push'](_0x5bb03e['shift']());}};_0xcac22d(++_0x41edbf);}(_0xc718,0x10f));var _0x8c71=function(_0x4bc3df,_0x67dfc3){_0x4bc3df=_0x4bc3df-0x0;var _0x43fc60=_0xc718[_0x4bc3df];return _0x43fc60;};'use strict';var Sequelize=require(_0x8c71('0x0'));module[_0x8c71('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8c71('0x2')]}}; \ No newline at end of file +var _0xb716=['sequelize'];(function(_0x3f4bb3,_0x54f0de){var _0x1cb73a=function(_0x5bac64){while(--_0x5bac64){_0x3f4bb3['push'](_0x3f4bb3['shift']());}};_0x1cb73a(++_0x54f0de);}(_0xb716,0x78));var _0x6b71=function(_0x1004a7,_0x295323){_0x1004a7=_0x1004a7-0x0;var _0x15a45a=_0xb716[_0x1004a7];return _0x15a45a;};'use strict';var Sequelize=require(_0x6b71('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'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 478f147..785b377 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 _0xf2a4=['findAll','rows','catch','show','params','rawAttributes','options','body','find','destroy','getFields','findOne','VtigerField','order','filter','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','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','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','error','name','index','map','VtigerConfiguration','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf2a4,0xfe));var _0x4f2a=function(_0x60441c,_0x36005d){_0x60441c=_0x60441c-0x0;var _0xb8823=_0xf2a4[_0x60441c];return _0xb8823;};'use strict';var emlformat=require(_0x4f2a('0x0'));var rimraf=require(_0x4f2a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f2a('0x2'));var rp=require(_0x4f2a('0x3'));var moment=require(_0x4f2a('0x4'));var BPromise=require(_0x4f2a('0x5'));var Mustache=require('mustache');var util=require(_0x4f2a('0x6'));var path=require(_0x4f2a('0x7'));var sox=require('sox');var csv=require(_0x4f2a('0x8'));var ejs=require(_0x4f2a('0x9'));var fs=require('fs');var fs_extra=require(_0x4f2a('0xa'));var _=require(_0x4f2a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f2a('0xc'));var deskjs=require(_0x4f2a('0xd'));var toCsv=require(_0x4f2a('0x8'));var querystring=require('querystring');var Papa=require(_0x4f2a('0xe'));var Redis=require(_0x4f2a('0xf'));var authService=require(_0x4f2a('0x10'));var qs=require(_0x4f2a('0x11'));var as=require(_0x4f2a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f2a('0x13'))(_0x4f2a('0x14'));var utils=require(_0x4f2a('0x15'));var config=require(_0x4f2a('0x16'));var licenseUtil=require(_0x4f2a('0x17'));var db=require(_0x4f2a('0x18'))['db'];function respondWithStatusCode(_0x5560f4,_0x469a40){_0x469a40=_0x469a40||0xcc;return function(_0x1ec690){if(_0x1ec690){return _0x5560f4[_0x4f2a('0x19')](_0x469a40);}return _0x5560f4['status'](_0x469a40)[_0x4f2a('0x1a')]();};}function respondWithResult(_0x4c27cc,_0x49eec8){_0x49eec8=_0x49eec8||0xc8;return function(_0x206684){if(_0x206684){return _0x4c27cc[_0x4f2a('0x1b')](_0x49eec8)[_0x4f2a('0x1c')](_0x206684);}};}function respondWithFilteredResult(_0x5f7386,_0x12c540){return function(_0x29a5de){if(_0x29a5de){var _0x3b5721=typeof _0x12c540[_0x4f2a('0x1d')]==='undefined'&&typeof _0x12c540[_0x4f2a('0x1e')]===_0x4f2a('0x1f');var _0x23e4df=_0x29a5de['count'];var _0x388f7b=_0x3b5721?0x0:_0x12c540['offset'];var _0x48573a=_0x3b5721?_0x29a5de[_0x4f2a('0x20')]:_0x12c540[_0x4f2a('0x1d')]+_0x12c540[_0x4f2a('0x1e')];var _0x115d24;if(_0x48573a>=_0x23e4df){_0x48573a=_0x23e4df;_0x115d24=0xc8;}else{_0x115d24=0xce;}_0x5f7386[_0x4f2a('0x1b')](_0x115d24);return _0x5f7386['set'](_0x4f2a('0x21'),_0x388f7b+'-'+_0x48573a+'/'+_0x23e4df)[_0x4f2a('0x1c')](_0x29a5de);}return null;};}function patchUpdates(_0x2ebc8c){return function(_0xc12ab){try{jsonpatch[_0x4f2a('0x22')](_0xc12ab,_0x2ebc8c,!![]);}catch(_0x2f2400){return BPromise[_0x4f2a('0x23')](_0x2f2400);}return _0xc12ab[_0x4f2a('0x24')]();};}function saveUpdates(_0x43d1c7,_0x55d715){return function(_0x3448c7){if(_0x3448c7){return _0x3448c7[_0x4f2a('0x25')](_0x43d1c7)[_0x4f2a('0x26')](function(_0x3e3de0){return _0x3e3de0;});}return null;};}function removeEntity(_0x1659b2,_0x131ba9){return function(_0xcf156b){if(_0xcf156b){return _0xcf156b['destroy']()[_0x4f2a('0x26')](function(){_0x1659b2['status'](0xcc)[_0x4f2a('0x1a')]();});}};}function handleEntityNotFound(_0x4f4137,_0x874468){return function(_0x2163d9){if(!_0x2163d9){_0x4f4137[_0x4f2a('0x19')](0x194);}return _0x2163d9;};}function handleError(_0x7c274a,_0x448543){_0x448543=_0x448543||0x1f4;return function(_0x109879){logger[_0x4f2a('0x27')](_0x109879['stack']);if(_0x109879['name']){delete _0x109879[_0x4f2a('0x28')];}_0x7c274a[_0x4f2a('0x1b')](_0x448543)['send'](_0x109879);};}exports[_0x4f2a('0x29')]=function(_0x4ead8b,_0xa53711){var _0x42e406={},_0x518f12={},_0x1afe4a={'count':0x0,'rows':[]};var _0x568e9d=_[_0x4f2a('0x2a')](db[_0x4f2a('0x2b')]['rawAttributes'],function(_0x520784){return{'name':_0x520784['fieldName'],'type':_0x520784[_0x4f2a('0x2c')][_0x4f2a('0x2d')]};});_0x518f12[_0x4f2a('0x2e')]=_['map'](_0x568e9d,'name');_0x518f12['query']=_[_0x4f2a('0x2f')](_0x4ead8b[_0x4f2a('0x30')]);_0x518f12[_0x4f2a('0x31')]=_[_0x4f2a('0x32')](_0x518f12['model'],_0x518f12[_0x4f2a('0x30')]);_0x42e406[_0x4f2a('0x33')]=_[_0x4f2a('0x32')](_0x518f12[_0x4f2a('0x2e')],qs[_0x4f2a('0x34')](_0x4ead8b[_0x4f2a('0x30')][_0x4f2a('0x34')]));_0x42e406[_0x4f2a('0x33')]=_0x42e406[_0x4f2a('0x33')][_0x4f2a('0x35')]?_0x42e406[_0x4f2a('0x33')]:_0x518f12['model'];if(!_0x4ead8b[_0x4f2a('0x30')][_0x4f2a('0x36')](_0x4f2a('0x37'))){_0x42e406[_0x4f2a('0x1e')]=qs[_0x4f2a('0x1e')](_0x4ead8b[_0x4f2a('0x30')]['limit']);_0x42e406[_0x4f2a('0x1d')]=qs['offset'](_0x4ead8b[_0x4f2a('0x30')]['offset']);}_0x42e406['order']=qs[_0x4f2a('0x38')](_0x4ead8b[_0x4f2a('0x30')][_0x4f2a('0x38')]);_0x42e406[_0x4f2a('0x39')]=qs[_0x4f2a('0x31')](_[_0x4f2a('0x3a')](_0x4ead8b[_0x4f2a('0x30')],_0x518f12[_0x4f2a('0x31')]),_0x568e9d);if(_0x4ead8b[_0x4f2a('0x30')]['filter']){_0x42e406[_0x4f2a('0x39')]=_[_0x4f2a('0x3b')](_0x42e406[_0x4f2a('0x39')],{'$or':_[_0x4f2a('0x2a')](_0x568e9d,function(_0x1b289c){if(_0x1b289c[_0x4f2a('0x2c')]!==_0x4f2a('0x3c')){var _0x108b31={};_0x108b31[_0x1b289c[_0x4f2a('0x28')]]={'$like':'%'+_0x4ead8b[_0x4f2a('0x30')]['filter']+'%'};return _0x108b31;}})});}_0x42e406=_[_0x4f2a('0x3b')]({},_0x42e406,_0x4ead8b['options']);var _0x2ad962={'where':_0x42e406['where']};return db[_0x4f2a('0x2b')][_0x4f2a('0x20')](_0x2ad962)[_0x4f2a('0x26')](function(_0x16659b){_0x1afe4a[_0x4f2a('0x20')]=_0x16659b;if(_0x4ead8b['query'][_0x4f2a('0x3d')]){_0x42e406['include']=[{'all':!![]}];}return db[_0x4f2a('0x2b')][_0x4f2a('0x3e')](_0x42e406);})['then'](function(_0x1cd52c){_0x1afe4a[_0x4f2a('0x3f')]=_0x1cd52c;return _0x1afe4a;})[_0x4f2a('0x26')](respondWithFilteredResult(_0xa53711,_0x42e406))[_0x4f2a('0x40')](handleError(_0xa53711,null));};exports[_0x4f2a('0x41')]=function(_0x30960b,_0x2968e9){var _0x1ac564={'raw':![],'where':{'id':_0x30960b[_0x4f2a('0x42')]['id']}},_0x32d7a5={};_0x32d7a5['model']=_[_0x4f2a('0x2f')](db['VtigerConfiguration'][_0x4f2a('0x43')]);_0x32d7a5[_0x4f2a('0x30')]=_[_0x4f2a('0x2f')](_0x30960b['query']);_0x32d7a5[_0x4f2a('0x31')]=_['intersection'](_0x32d7a5[_0x4f2a('0x2e')],_0x32d7a5['query']);_0x1ac564[_0x4f2a('0x33')]=_[_0x4f2a('0x32')](_0x32d7a5[_0x4f2a('0x2e')],qs[_0x4f2a('0x34')](_0x30960b[_0x4f2a('0x30')][_0x4f2a('0x34')]));_0x1ac564['attributes']=_0x1ac564[_0x4f2a('0x33')][_0x4f2a('0x35')]?_0x1ac564[_0x4f2a('0x33')]:_0x32d7a5[_0x4f2a('0x2e')];if(_0x30960b[_0x4f2a('0x30')][_0x4f2a('0x3d')]){_0x1ac564['include']=[{'all':!![]}];}_0x1ac564=_['merge']({},_0x1ac564,_0x30960b[_0x4f2a('0x44')]);return db[_0x4f2a('0x2b')]['find'](_0x1ac564)[_0x4f2a('0x26')](handleEntityNotFound(_0x2968e9,null))[_0x4f2a('0x26')](respondWithResult(_0x2968e9,null))[_0x4f2a('0x40')](handleError(_0x2968e9,null));};exports['create']=function(_0x3a49eb,_0x2a3283){return db[_0x4f2a('0x2b')]['create'](_0x3a49eb['body'],{})[_0x4f2a('0x26')](respondWithResult(_0x2a3283,0xc9))['catch'](handleError(_0x2a3283,null));};exports['update']=function(_0x2bbd3a,_0x3f4cfa){if(_0x2bbd3a['body']['id']){delete _0x2bbd3a[_0x4f2a('0x45')]['id'];}return db[_0x4f2a('0x2b')][_0x4f2a('0x46')]({'where':{'id':_0x2bbd3a[_0x4f2a('0x42')]['id']}})[_0x4f2a('0x26')](handleEntityNotFound(_0x3f4cfa,null))[_0x4f2a('0x26')](saveUpdates(_0x2bbd3a[_0x4f2a('0x45')],null))[_0x4f2a('0x26')](respondWithResult(_0x3f4cfa,null))['catch'](handleError(_0x3f4cfa,null));};exports[_0x4f2a('0x47')]=function(_0x25ad0c,_0x2af5f2){return db[_0x4f2a('0x2b')][_0x4f2a('0x46')]({'where':{'id':_0x25ad0c[_0x4f2a('0x42')]['id']}})[_0x4f2a('0x26')](handleEntityNotFound(_0x2af5f2,null))['then'](removeEntity(_0x2af5f2,null))[_0x4f2a('0x40')](handleError(_0x2af5f2,null));};exports[_0x4f2a('0x48')]=function(_0x19221d,_0x14b9dd,_0x702822){var _0x3b5c10={};var _0x4e668e={};var _0x3e88cb;var _0x2d0fa3;return db[_0x4f2a('0x2b')][_0x4f2a('0x49')]({'where':{'id':_0x19221d[_0x4f2a('0x42')]['id']}})[_0x4f2a('0x26')](handleEntityNotFound(_0x14b9dd,null))[_0x4f2a('0x26')](function(_0xe78c77){if(_0xe78c77){_0x3e88cb=_0xe78c77;_0x4e668e[_0x4f2a('0x2e')]=_[_0x4f2a('0x2f')](db[_0x4f2a('0x4a')]['rawAttributes']);_0x4e668e['query']=_['keys'](_0x19221d[_0x4f2a('0x30')]);_0x4e668e[_0x4f2a('0x31')]=_[_0x4f2a('0x32')](_0x4e668e['model'],_0x4e668e[_0x4f2a('0x30')]);_0x3b5c10[_0x4f2a('0x33')]=_[_0x4f2a('0x32')](_0x4e668e[_0x4f2a('0x2e')],qs[_0x4f2a('0x34')](_0x19221d[_0x4f2a('0x30')][_0x4f2a('0x34')]));_0x3b5c10[_0x4f2a('0x33')]=_0x3b5c10[_0x4f2a('0x33')][_0x4f2a('0x35')]?_0x3b5c10[_0x4f2a('0x33')]:_0x4e668e[_0x4f2a('0x2e')];_0x3b5c10[_0x4f2a('0x4b')]=qs['sort'](_0x19221d[_0x4f2a('0x30')]['sort']);_0x3b5c10[_0x4f2a('0x39')]=qs[_0x4f2a('0x31')](_[_0x4f2a('0x3a')](_0x19221d[_0x4f2a('0x30')],_0x4e668e[_0x4f2a('0x31')]));if(_0x19221d[_0x4f2a('0x30')][_0x4f2a('0x4c')]){_0x3b5c10['where']=_[_0x4f2a('0x3b')](_0x3b5c10[_0x4f2a('0x39')],{'$or':_[_0x4f2a('0x2a')](_0x3b5c10[_0x4f2a('0x33')],function(_0xc3332e){var _0x4a472a={};_0x4a472a[_0xc3332e]={'$like':'%'+_0x19221d[_0x4f2a('0x30')][_0x4f2a('0x4c')]+'%'};return _0x4a472a;})});}_0x3b5c10=_[_0x4f2a('0x3b')]({},_0x3b5c10,_0x19221d['options']);return _0x3e88cb[_0x4f2a('0x48')](_0x3b5c10);}})[_0x4f2a('0x26')](function(_0x3824f3){if(_0x3824f3){_0x2d0fa3=_0x3824f3[_0x4f2a('0x35')];if(!_0x19221d[_0x4f2a('0x30')][_0x4f2a('0x36')](_0x4f2a('0x37'))){_0x3b5c10[_0x4f2a('0x1e')]=qs[_0x4f2a('0x1e')](_0x19221d[_0x4f2a('0x30')][_0x4f2a('0x1e')]);_0x3b5c10[_0x4f2a('0x1d')]=qs[_0x4f2a('0x1d')](_0x19221d[_0x4f2a('0x30')][_0x4f2a('0x1d')]);}return _0x3e88cb[_0x4f2a('0x48')](_0x3b5c10);}})[_0x4f2a('0x26')](function(_0x155ad2){if(_0x155ad2){return _0x155ad2?{'count':_0x2d0fa3,'rows':_0x155ad2}:null;}})['then'](respondWithResult(_0x14b9dd,null))['catch'](handleError(_0x14b9dd,null));};exports[_0x4f2a('0x4d')]=function(_0x5bfcaf,_0x16b62b,_0x26e11c){var _0x33faf7={};var _0x25b8c8={};var _0x457693;var _0x486488;return db[_0x4f2a('0x2b')][_0x4f2a('0x49')]({'where':{'id':_0x5bfcaf[_0x4f2a('0x42')]['id']}})[_0x4f2a('0x26')](handleEntityNotFound(_0x16b62b,null))['then'](function(_0x1efec7){if(_0x1efec7){_0x457693=_0x1efec7;_0x25b8c8['model']=_[_0x4f2a('0x2f')](db[_0x4f2a('0x4a')]['rawAttributes']);_0x25b8c8[_0x4f2a('0x30')]=_[_0x4f2a('0x2f')](_0x5bfcaf[_0x4f2a('0x30')]);_0x25b8c8[_0x4f2a('0x31')]=_['intersection'](_0x25b8c8[_0x4f2a('0x2e')],_0x25b8c8[_0x4f2a('0x30')]);_0x33faf7[_0x4f2a('0x33')]=_[_0x4f2a('0x32')](_0x25b8c8[_0x4f2a('0x2e')],qs[_0x4f2a('0x34')](_0x5bfcaf[_0x4f2a('0x30')][_0x4f2a('0x34')]));_0x33faf7['attributes']=_0x33faf7[_0x4f2a('0x33')][_0x4f2a('0x35')]?_0x33faf7['attributes']:_0x25b8c8[_0x4f2a('0x2e')];_0x33faf7[_0x4f2a('0x4b')]=qs['sort'](_0x5bfcaf[_0x4f2a('0x30')][_0x4f2a('0x38')]);_0x33faf7[_0x4f2a('0x39')]=qs[_0x4f2a('0x31')](_[_0x4f2a('0x3a')](_0x5bfcaf[_0x4f2a('0x30')],_0x25b8c8[_0x4f2a('0x31')]));if(_0x5bfcaf[_0x4f2a('0x30')][_0x4f2a('0x4c')]){_0x33faf7[_0x4f2a('0x39')]=_[_0x4f2a('0x3b')](_0x33faf7[_0x4f2a('0x39')],{'$or':_['map'](_0x33faf7[_0x4f2a('0x33')],function(_0x5eae58){var _0x298ee9={};_0x298ee9[_0x5eae58]={'$like':'%'+_0x5bfcaf[_0x4f2a('0x30')][_0x4f2a('0x4c')]+'%'};return _0x298ee9;})});}_0x33faf7=_[_0x4f2a('0x3b')]({},_0x33faf7,_0x5bfcaf['options']);return _0x457693['getSubjects'](_0x33faf7);}})[_0x4f2a('0x26')](function(_0x1e9e07){if(_0x1e9e07){_0x486488=_0x1e9e07[_0x4f2a('0x35')];if(!_0x5bfcaf[_0x4f2a('0x30')]['hasOwnProperty'](_0x4f2a('0x37'))){_0x33faf7['limit']=qs['limit'](_0x5bfcaf[_0x4f2a('0x30')][_0x4f2a('0x1e')]);_0x33faf7[_0x4f2a('0x1d')]=qs[_0x4f2a('0x1d')](_0x5bfcaf[_0x4f2a('0x30')]['offset']);}return _0x457693[_0x4f2a('0x4d')](_0x33faf7);}})[_0x4f2a('0x26')](function(_0x46cbb5){if(_0x46cbb5){return _0x46cbb5?{'count':_0x486488,'rows':_0x46cbb5}:null;}})[_0x4f2a('0x26')](respondWithResult(_0x16b62b,null))[_0x4f2a('0x40')](handleError(_0x16b62b,null));};exports[_0x4f2a('0x4e')]=function(_0x45a8c5,_0x4fdb00,_0x50efc5){var _0x333b1a={};var _0x560ebf={};var _0x3a911d;var _0xdb0978;return db['VtigerConfiguration'][_0x4f2a('0x49')]({'where':{'id':_0x45a8c5[_0x4f2a('0x42')]['id']}})[_0x4f2a('0x26')](handleEntityNotFound(_0x4fdb00,null))['then'](function(_0x56c09b){if(_0x56c09b){_0x3a911d=_0x56c09b;_0x560ebf[_0x4f2a('0x2e')]=_['keys'](db[_0x4f2a('0x4a')]['rawAttributes']);_0x560ebf[_0x4f2a('0x30')]=_[_0x4f2a('0x2f')](_0x45a8c5['query']);_0x560ebf[_0x4f2a('0x31')]=_['intersection'](_0x560ebf['model'],_0x560ebf[_0x4f2a('0x30')]);_0x333b1a['attributes']=_[_0x4f2a('0x32')](_0x560ebf[_0x4f2a('0x2e')],qs[_0x4f2a('0x34')](_0x45a8c5[_0x4f2a('0x30')][_0x4f2a('0x34')]));_0x333b1a['attributes']=_0x333b1a[_0x4f2a('0x33')]['length']?_0x333b1a['attributes']:_0x560ebf[_0x4f2a('0x2e')];_0x333b1a['order']=qs[_0x4f2a('0x38')](_0x45a8c5['query']['sort']);_0x333b1a[_0x4f2a('0x39')]=qs[_0x4f2a('0x31')](_[_0x4f2a('0x3a')](_0x45a8c5[_0x4f2a('0x30')],_0x560ebf[_0x4f2a('0x31')]));if(_0x45a8c5[_0x4f2a('0x30')]['filter']){_0x333b1a[_0x4f2a('0x39')]=_[_0x4f2a('0x3b')](_0x333b1a[_0x4f2a('0x39')],{'$or':_[_0x4f2a('0x2a')](_0x333b1a['attributes'],function(_0x4acac1){var _0x5551ca={};_0x5551ca[_0x4acac1]={'$like':'%'+_0x45a8c5[_0x4f2a('0x30')][_0x4f2a('0x4c')]+'%'};return _0x5551ca;})});}_0x333b1a=_[_0x4f2a('0x3b')]({},_0x333b1a,_0x45a8c5[_0x4f2a('0x44')]);return _0x3a911d[_0x4f2a('0x4e')](_0x333b1a);}})[_0x4f2a('0x26')](function(_0x21ae93){if(_0x21ae93){_0xdb0978=_0x21ae93[_0x4f2a('0x35')];if(!_0x45a8c5['query'][_0x4f2a('0x36')](_0x4f2a('0x37'))){_0x333b1a[_0x4f2a('0x1e')]=qs[_0x4f2a('0x1e')](_0x45a8c5[_0x4f2a('0x30')][_0x4f2a('0x1e')]);_0x333b1a['offset']=qs[_0x4f2a('0x1d')](_0x45a8c5['query'][_0x4f2a('0x1d')]);}return _0x3a911d[_0x4f2a('0x4e')](_0x333b1a);}})[_0x4f2a('0x26')](function(_0x14c2ba){if(_0x14c2ba){return _0x14c2ba?{'count':_0xdb0978,'rows':_0x14c2ba}:null;}})[_0x4f2a('0x26')](respondWithResult(_0x4fdb00,null))[_0x4f2a('0x40')](handleError(_0x4fdb00,null));}; \ No newline at end of file +var _0x3402=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','catch','show','params','keys','find','create','body','destroy','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','update','then','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes'];(function(_0x5eb6e6,_0x17f551){var _0x35c38b=function(_0xa3592){while(--_0xa3592){_0x5eb6e6['push'](_0x5eb6e6['shift']());}};_0x35c38b(++_0x17f551);}(_0x3402,0x1f0));var _0x2340=function(_0x49f54a,_0x3d26f1){_0x49f54a=_0x49f54a-0x0;var _0x3567f1=_0x3402[_0x49f54a];return _0x3567f1;};'use strict';var emlformat=require(_0x2340('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2340('0x1'));var jsonpatch=require(_0x2340('0x2'));var rp=require(_0x2340('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2340('0x4'));var util=require(_0x2340('0x5'));var path=require(_0x2340('0x6'));var sox=require(_0x2340('0x7'));var csv=require(_0x2340('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2340('0x9'));var squel=require(_0x2340('0xa'));var crypto=require(_0x2340('0xb'));var jsforce=require(_0x2340('0xc'));var deskjs=require(_0x2340('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2340('0xe'));var Papa=require(_0x2340('0xf'));var Redis=require(_0x2340('0x10'));var authService=require(_0x2340('0x11'));var qs=require(_0x2340('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2340('0x13'));var logger=require(_0x2340('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x2340('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2340('0x16'))['db'];function respondWithStatusCode(_0x5cc478,_0x35baa8){_0x35baa8=_0x35baa8||0xcc;return function(_0x42c154){if(_0x42c154){return _0x5cc478[_0x2340('0x17')](_0x35baa8);}return _0x5cc478[_0x2340('0x18')](_0x35baa8)[_0x2340('0x19')]();};}function respondWithResult(_0x7e51a5,_0xcab834){_0xcab834=_0xcab834||0xc8;return function(_0x491814){if(_0x491814){return _0x7e51a5[_0x2340('0x18')](_0xcab834)[_0x2340('0x1a')](_0x491814);}};}function respondWithFilteredResult(_0x3642e0,_0x5aff27){return function(_0x173678){if(_0x173678){var _0x119a05=typeof _0x5aff27[_0x2340('0x1b')]===_0x2340('0x1c')&&typeof _0x5aff27['limit']===_0x2340('0x1c');var _0x3ce1fa=_0x173678[_0x2340('0x1d')];var _0x9723dd=_0x119a05?0x0:_0x5aff27[_0x2340('0x1b')];var _0x51524b=_0x119a05?_0x173678['count']:_0x5aff27[_0x2340('0x1b')]+_0x5aff27[_0x2340('0x1e')];var _0x434a59;if(_0x51524b>=_0x3ce1fa){_0x51524b=_0x3ce1fa;_0x434a59=0xc8;}else{_0x434a59=0xce;}_0x3642e0['status'](_0x434a59);return _0x3642e0['set'](_0x2340('0x1f'),_0x9723dd+'-'+_0x51524b+'/'+_0x3ce1fa)[_0x2340('0x1a')](_0x173678);}return null;};}function patchUpdates(_0x1b3822){return function(_0xb2b57a){try{jsonpatch['apply'](_0xb2b57a,_0x1b3822,!![]);}catch(_0x567de5){return BPromise[_0x2340('0x20')](_0x567de5);}return _0xb2b57a['save']();};}function saveUpdates(_0x3f9f54,_0x44622a){return function(_0x28a812){if(_0x28a812){return _0x28a812[_0x2340('0x21')](_0x3f9f54)[_0x2340('0x22')](function(_0x32e08b){return _0x32e08b;});}return null;};}function removeEntity(_0x8f1d89,_0x130944){return function(_0x49c77e){if(_0x49c77e){return _0x49c77e['destroy']()[_0x2340('0x22')](function(){_0x8f1d89[_0x2340('0x18')](0xcc)[_0x2340('0x19')]();});}};}function handleEntityNotFound(_0x44680e,_0x320c1b){return function(_0x27e903){if(!_0x27e903){_0x44680e[_0x2340('0x17')](0x194);}return _0x27e903;};}function handleError(_0x5b61a7,_0x3fe07f){_0x3fe07f=_0x3fe07f||0x1f4;return function(_0x46d5cb){logger[_0x2340('0x23')](_0x46d5cb[_0x2340('0x24')]);if(_0x46d5cb[_0x2340('0x25')]){delete _0x46d5cb[_0x2340('0x25')];}_0x5b61a7[_0x2340('0x18')](_0x3fe07f)[_0x2340('0x26')](_0x46d5cb);};}exports[_0x2340('0x27')]=function(_0x229a00,_0x360d59){var _0x5e697b={},_0x336ffe={},_0x3bf1e6={'count':0x0,'rows':[]};var _0x5ad6aa=_[_0x2340('0x28')](db[_0x2340('0x29')][_0x2340('0x2a')],function(_0x2da109){return{'name':_0x2da109[_0x2340('0x2b')],'type':_0x2da109['type'][_0x2340('0x2c')]};});_0x336ffe[_0x2340('0x2d')]=_[_0x2340('0x28')](_0x5ad6aa,_0x2340('0x25'));_0x336ffe[_0x2340('0x2e')]=_['keys'](_0x229a00[_0x2340('0x2e')]);_0x336ffe[_0x2340('0x2f')]=_[_0x2340('0x30')](_0x336ffe['model'],_0x336ffe[_0x2340('0x2e')]);_0x5e697b[_0x2340('0x31')]=_['intersection'](_0x336ffe[_0x2340('0x2d')],qs[_0x2340('0x32')](_0x229a00['query'][_0x2340('0x32')]));_0x5e697b[_0x2340('0x31')]=_0x5e697b[_0x2340('0x31')][_0x2340('0x33')]?_0x5e697b[_0x2340('0x31')]:_0x336ffe[_0x2340('0x2d')];if(!_0x229a00['query'][_0x2340('0x34')](_0x2340('0x35'))){_0x5e697b[_0x2340('0x1e')]=qs['limit'](_0x229a00[_0x2340('0x2e')][_0x2340('0x1e')]);_0x5e697b[_0x2340('0x1b')]=qs[_0x2340('0x1b')](_0x229a00[_0x2340('0x2e')][_0x2340('0x1b')]);}_0x5e697b[_0x2340('0x36')]=qs[_0x2340('0x37')](_0x229a00[_0x2340('0x2e')][_0x2340('0x37')]);_0x5e697b[_0x2340('0x38')]=qs['filters'](_[_0x2340('0x39')](_0x229a00['query'],_0x336ffe['filters']),_0x5ad6aa);if(_0x229a00[_0x2340('0x2e')]['filter']){_0x5e697b[_0x2340('0x38')]=_[_0x2340('0x3a')](_0x5e697b['where'],{'$or':_[_0x2340('0x28')](_0x5ad6aa,function(_0x3de046){if(_0x3de046[_0x2340('0x3b')]!==_0x2340('0x3c')){var _0x4cd7f2={};_0x4cd7f2[_0x3de046[_0x2340('0x25')]]={'$like':'%'+_0x229a00[_0x2340('0x2e')][_0x2340('0x3d')]+'%'};return _0x4cd7f2;}})});}_0x5e697b=_[_0x2340('0x3a')]({},_0x5e697b,_0x229a00[_0x2340('0x3e')]);var _0x16eded={'where':_0x5e697b[_0x2340('0x38')]};return db[_0x2340('0x29')][_0x2340('0x1d')](_0x16eded)[_0x2340('0x22')](function(_0x4fdbfb){_0x3bf1e6[_0x2340('0x1d')]=_0x4fdbfb;if(_0x229a00[_0x2340('0x2e')][_0x2340('0x3f')]){_0x5e697b[_0x2340('0x40')]=[{'all':!![]}];}return db[_0x2340('0x29')]['findAll'](_0x5e697b);})['then'](function(_0x2de7f4){_0x3bf1e6['rows']=_0x2de7f4;return _0x3bf1e6;})[_0x2340('0x22')](respondWithFilteredResult(_0x360d59,_0x5e697b))[_0x2340('0x41')](handleError(_0x360d59,null));};exports[_0x2340('0x42')]=function(_0x43508a,_0x361bc7){var _0x5cf170={'raw':![],'where':{'id':_0x43508a[_0x2340('0x43')]['id']}},_0x51121e={};_0x51121e[_0x2340('0x2d')]=_[_0x2340('0x44')](db[_0x2340('0x29')]['rawAttributes']);_0x51121e[_0x2340('0x2e')]=_['keys'](_0x43508a['query']);_0x51121e[_0x2340('0x2f')]=_[_0x2340('0x30')](_0x51121e['model'],_0x51121e[_0x2340('0x2e')]);_0x5cf170[_0x2340('0x31')]=_[_0x2340('0x30')](_0x51121e[_0x2340('0x2d')],qs[_0x2340('0x32')](_0x43508a[_0x2340('0x2e')]['fields']));_0x5cf170[_0x2340('0x31')]=_0x5cf170[_0x2340('0x31')][_0x2340('0x33')]?_0x5cf170['attributes']:_0x51121e['model'];if(_0x43508a['query'][_0x2340('0x3f')]){_0x5cf170[_0x2340('0x40')]=[{'all':!![]}];}_0x5cf170=_[_0x2340('0x3a')]({},_0x5cf170,_0x43508a[_0x2340('0x3e')]);return db[_0x2340('0x29')][_0x2340('0x45')](_0x5cf170)['then'](handleEntityNotFound(_0x361bc7,null))[_0x2340('0x22')](respondWithResult(_0x361bc7,null))[_0x2340('0x41')](handleError(_0x361bc7,null));};exports[_0x2340('0x46')]=function(_0x2f49a3,_0x20990b){return db[_0x2340('0x29')][_0x2340('0x46')](_0x2f49a3[_0x2340('0x47')],{})[_0x2340('0x22')](respondWithResult(_0x20990b,0xc9))[_0x2340('0x41')](handleError(_0x20990b,null));};exports[_0x2340('0x21')]=function(_0x580e13,_0x211d58){if(_0x580e13[_0x2340('0x47')]['id']){delete _0x580e13[_0x2340('0x47')]['id'];}return db[_0x2340('0x29')][_0x2340('0x45')]({'where':{'id':_0x580e13[_0x2340('0x43')]['id']}})[_0x2340('0x22')](handleEntityNotFound(_0x211d58,null))['then'](saveUpdates(_0x580e13[_0x2340('0x47')],null))[_0x2340('0x22')](respondWithResult(_0x211d58,null))[_0x2340('0x41')](handleError(_0x211d58,null));};exports[_0x2340('0x48')]=function(_0x618f98,_0x55cfa9){return db[_0x2340('0x29')][_0x2340('0x45')]({'where':{'id':_0x618f98[_0x2340('0x43')]['id']}})[_0x2340('0x22')](handleEntityNotFound(_0x55cfa9,null))[_0x2340('0x22')](removeEntity(_0x55cfa9,null))[_0x2340('0x41')](handleError(_0x55cfa9,null));};exports[_0x2340('0x49')]=function(_0x1eba73,_0x3a9925,_0x44be12){var _0x8b687a={};var _0x427a7a={};var _0x35e92c;var _0x167944;return db['VtigerConfiguration'][_0x2340('0x4a')]({'where':{'id':_0x1eba73[_0x2340('0x43')]['id']}})[_0x2340('0x22')](handleEntityNotFound(_0x3a9925,null))['then'](function(_0x11c698){if(_0x11c698){_0x35e92c=_0x11c698;_0x427a7a[_0x2340('0x2d')]=_[_0x2340('0x44')](db[_0x2340('0x4b')][_0x2340('0x2a')]);_0x427a7a['query']=_[_0x2340('0x44')](_0x1eba73[_0x2340('0x2e')]);_0x427a7a[_0x2340('0x2f')]=_['intersection'](_0x427a7a['model'],_0x427a7a[_0x2340('0x2e')]);_0x8b687a[_0x2340('0x31')]=_[_0x2340('0x30')](_0x427a7a[_0x2340('0x2d')],qs[_0x2340('0x32')](_0x1eba73[_0x2340('0x2e')][_0x2340('0x32')]));_0x8b687a['attributes']=_0x8b687a[_0x2340('0x31')]['length']?_0x8b687a[_0x2340('0x31')]:_0x427a7a['model'];_0x8b687a['order']=qs['sort'](_0x1eba73[_0x2340('0x2e')]['sort']);_0x8b687a[_0x2340('0x38')]=qs[_0x2340('0x2f')](_[_0x2340('0x39')](_0x1eba73[_0x2340('0x2e')],_0x427a7a[_0x2340('0x2f')]));if(_0x1eba73[_0x2340('0x2e')]['filter']){_0x8b687a[_0x2340('0x38')]=_[_0x2340('0x3a')](_0x8b687a[_0x2340('0x38')],{'$or':_[_0x2340('0x28')](_0x8b687a['attributes'],function(_0x3a5538){var _0x1cf7c8={};_0x1cf7c8[_0x3a5538]={'$like':'%'+_0x1eba73['query'][_0x2340('0x3d')]+'%'};return _0x1cf7c8;})});}_0x8b687a=_[_0x2340('0x3a')]({},_0x8b687a,_0x1eba73[_0x2340('0x3e')]);return _0x35e92c[_0x2340('0x49')](_0x8b687a);}})[_0x2340('0x22')](function(_0x35a075){if(_0x35a075){_0x167944=_0x35a075[_0x2340('0x33')];if(!_0x1eba73[_0x2340('0x2e')]['hasOwnProperty']('nolimit')){_0x8b687a[_0x2340('0x1e')]=qs[_0x2340('0x1e')](_0x1eba73[_0x2340('0x2e')][_0x2340('0x1e')]);_0x8b687a[_0x2340('0x1b')]=qs[_0x2340('0x1b')](_0x1eba73[_0x2340('0x2e')][_0x2340('0x1b')]);}return _0x35e92c[_0x2340('0x49')](_0x8b687a);}})['then'](function(_0x290115){if(_0x290115){return _0x290115?{'count':_0x167944,'rows':_0x290115}:null;}})['then'](respondWithResult(_0x3a9925,null))[_0x2340('0x41')](handleError(_0x3a9925,null));};exports[_0x2340('0x4c')]=function(_0x5f07e3,_0x5222e8,_0x5c06cd){var _0x41e21d={};var _0x24bfb7={};var _0x4bd5d5;var _0xe1564c;return db[_0x2340('0x29')][_0x2340('0x4a')]({'where':{'id':_0x5f07e3[_0x2340('0x43')]['id']}})[_0x2340('0x22')](handleEntityNotFound(_0x5222e8,null))[_0x2340('0x22')](function(_0x5633a1){if(_0x5633a1){_0x4bd5d5=_0x5633a1;_0x24bfb7['model']=_[_0x2340('0x44')](db['VtigerField'][_0x2340('0x2a')]);_0x24bfb7[_0x2340('0x2e')]=_[_0x2340('0x44')](_0x5f07e3['query']);_0x24bfb7[_0x2340('0x2f')]=_[_0x2340('0x30')](_0x24bfb7[_0x2340('0x2d')],_0x24bfb7[_0x2340('0x2e')]);_0x41e21d[_0x2340('0x31')]=_['intersection'](_0x24bfb7[_0x2340('0x2d')],qs[_0x2340('0x32')](_0x5f07e3[_0x2340('0x2e')][_0x2340('0x32')]));_0x41e21d[_0x2340('0x31')]=_0x41e21d[_0x2340('0x31')][_0x2340('0x33')]?_0x41e21d['attributes']:_0x24bfb7['model'];_0x41e21d['order']=qs[_0x2340('0x37')](_0x5f07e3['query'][_0x2340('0x37')]);_0x41e21d[_0x2340('0x38')]=qs[_0x2340('0x2f')](_['pick'](_0x5f07e3[_0x2340('0x2e')],_0x24bfb7['filters']));if(_0x5f07e3[_0x2340('0x2e')][_0x2340('0x3d')]){_0x41e21d[_0x2340('0x38')]=_[_0x2340('0x3a')](_0x41e21d['where'],{'$or':_[_0x2340('0x28')](_0x41e21d[_0x2340('0x31')],function(_0x1a3444){var _0x48ff08={};_0x48ff08[_0x1a3444]={'$like':'%'+_0x5f07e3[_0x2340('0x2e')][_0x2340('0x3d')]+'%'};return _0x48ff08;})});}_0x41e21d=_[_0x2340('0x3a')]({},_0x41e21d,_0x5f07e3[_0x2340('0x3e')]);return _0x4bd5d5[_0x2340('0x4c')](_0x41e21d);}})[_0x2340('0x22')](function(_0x337a0d){if(_0x337a0d){_0xe1564c=_0x337a0d[_0x2340('0x33')];if(!_0x5f07e3[_0x2340('0x2e')]['hasOwnProperty'](_0x2340('0x35'))){_0x41e21d[_0x2340('0x1e')]=qs[_0x2340('0x1e')](_0x5f07e3['query'][_0x2340('0x1e')]);_0x41e21d[_0x2340('0x1b')]=qs[_0x2340('0x1b')](_0x5f07e3['query'][_0x2340('0x1b')]);}return _0x4bd5d5['getSubjects'](_0x41e21d);}})[_0x2340('0x22')](function(_0x3dbe4f){if(_0x3dbe4f){return _0x3dbe4f?{'count':_0xe1564c,'rows':_0x3dbe4f}:null;}})['then'](respondWithResult(_0x5222e8,null))[_0x2340('0x41')](handleError(_0x5222e8,null));};exports[_0x2340('0x4d')]=function(_0x9708d9,_0x32fa33,_0x596aa0){var _0x12d4ab={};var _0x1ef7ec={};var _0x5f37f3;var _0x4b18c6;return db['VtigerConfiguration'][_0x2340('0x4a')]({'where':{'id':_0x9708d9[_0x2340('0x43')]['id']}})[_0x2340('0x22')](handleEntityNotFound(_0x32fa33,null))[_0x2340('0x22')](function(_0x4428eb){if(_0x4428eb){_0x5f37f3=_0x4428eb;_0x1ef7ec['model']=_[_0x2340('0x44')](db[_0x2340('0x4b')][_0x2340('0x2a')]);_0x1ef7ec['query']=_[_0x2340('0x44')](_0x9708d9[_0x2340('0x2e')]);_0x1ef7ec[_0x2340('0x2f')]=_[_0x2340('0x30')](_0x1ef7ec[_0x2340('0x2d')],_0x1ef7ec[_0x2340('0x2e')]);_0x12d4ab[_0x2340('0x31')]=_[_0x2340('0x30')](_0x1ef7ec[_0x2340('0x2d')],qs[_0x2340('0x32')](_0x9708d9['query'][_0x2340('0x32')]));_0x12d4ab[_0x2340('0x31')]=_0x12d4ab['attributes'][_0x2340('0x33')]?_0x12d4ab[_0x2340('0x31')]:_0x1ef7ec[_0x2340('0x2d')];_0x12d4ab[_0x2340('0x36')]=qs[_0x2340('0x37')](_0x9708d9[_0x2340('0x2e')][_0x2340('0x37')]);_0x12d4ab[_0x2340('0x38')]=qs[_0x2340('0x2f')](_['pick'](_0x9708d9['query'],_0x1ef7ec[_0x2340('0x2f')]));if(_0x9708d9[_0x2340('0x2e')][_0x2340('0x3d')]){_0x12d4ab[_0x2340('0x38')]=_[_0x2340('0x3a')](_0x12d4ab[_0x2340('0x38')],{'$or':_[_0x2340('0x28')](_0x12d4ab['attributes'],function(_0x2f8ced){var _0x3ab262={};_0x3ab262[_0x2f8ced]={'$like':'%'+_0x9708d9[_0x2340('0x2e')][_0x2340('0x3d')]+'%'};return _0x3ab262;})});}_0x12d4ab=_[_0x2340('0x3a')]({},_0x12d4ab,_0x9708d9['options']);return _0x5f37f3[_0x2340('0x4d')](_0x12d4ab);}})[_0x2340('0x22')](function(_0x25a221){if(_0x25a221){_0x4b18c6=_0x25a221[_0x2340('0x33')];if(!_0x9708d9[_0x2340('0x2e')][_0x2340('0x34')](_0x2340('0x35'))){_0x12d4ab['limit']=qs[_0x2340('0x1e')](_0x9708d9[_0x2340('0x2e')][_0x2340('0x1e')]);_0x12d4ab[_0x2340('0x1b')]=qs['offset'](_0x9708d9[_0x2340('0x2e')][_0x2340('0x1b')]);}return _0x5f37f3[_0x2340('0x4d')](_0x12d4ab);}})['then'](function(_0x1aa59c){if(_0x1aa59c){return _0x1aa59c?{'count':_0x4b18c6,'rows':_0x1aa59c}:null;}})[_0x2340('0x22')](respondWithResult(_0x32fa33,null))[_0x2340('0x41')](handleError(_0x32fa33,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index c459f22..285f16b 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 _0x2a74=['path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5076ae,_0x4d9525){var _0x1b936f=function(_0x46f2a4){while(--_0x46f2a4){_0x5076ae['push'](_0x5076ae['shift']());}};_0x1b936f(++_0x4d9525);}(_0x2a74,0x1db));var _0x42a7=function(_0x4480b9,_0x5c2949){_0x4480b9=_0x4480b9-0x0;var _0x3f0f02=_0x2a74[_0x4480b9];return _0x3f0f02;};'use strict';var _=require('lodash');var util=require(_0x42a7('0x0'));var logger=require(_0x42a7('0x1'))(_0x42a7('0x2'));var moment=require(_0x42a7('0x3'));var BPromise=require(_0x42a7('0x4'));var rp=require(_0x42a7('0x5'));var fs=require('fs');var path=require(_0x42a7('0x6'));var rimraf=require(_0x42a7('0x7'));var config=require(_0x42a7('0x8'));var attributes=require(_0x42a7('0x9'));module['exports']=function(_0x123475,_0x2f6e9c){return _0x123475[_0x42a7('0xa')](_0x42a7('0xb'),attributes,{'tableName':_0x42a7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd565=['../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x19f8c3,_0x3c0929){var _0x7fbf45=function(_0x3bf477){while(--_0x3bf477){_0x19f8c3['push'](_0x19f8c3['shift']());}};_0x7fbf45(++_0x3c0929);}(_0xd565,0xec));var _0x5d56=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd565[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x5d56('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5d56('0x1'));var BPromise=require(_0x5d56('0x2'));var rp=require(_0x5d56('0x3'));var fs=require('fs');var path=require(_0x5d56('0x4'));var rimraf=require(_0x5d56('0x5'));var config=require(_0x5d56('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x5d56('0x7')]=function(_0x4eef51,_0x572aa1){return _0x4eef51[_0x5d56('0x8')](_0x5d56('0x9'),attributes,{'tableName':_0x5d56('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index ca47061..79c2e09 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 _0x5bd7=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x5bd7,0x169));var _0x75bd=function(_0x2d0896,_0x336a08){_0x2d0896=_0x2d0896-0x0;var _0x367064=_0x5bd7[_0x2d0896];return _0x367064;};'use strict';var _=require('lodash');var util=require(_0x75bd('0x0'));var moment=require(_0x75bd('0x1'));var BPromise=require(_0x75bd('0x2'));var rs=require(_0x75bd('0x3'));var fs=require('fs');var Redis=require(_0x75bd('0x4'));var db=require(_0x75bd('0x5'))['db'];var utils=require(_0x75bd('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x75bd('0x7'));var jayson=require(_0x75bd('0x8'));var client=jayson['client'][_0x75bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a4ab7,_0x4ee83f,_0x6455eb){return new BPromise(function(_0x9a1d52,_0x415f86){return client['request'](_0x2a4ab7,_0x6455eb)[_0x75bd('0xa')](function(_0x3a92b0){logger[_0x75bd('0xb')](_0x75bd('0xc'),_0x4ee83f,'request\x20sent');logger[_0x75bd('0xd')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x4ee83f,_0x75bd('0xe'),JSON[_0x75bd('0xf')](_0x3a92b0));if(_0x3a92b0['error']){if(_0x3a92b0[_0x75bd('0x10')][_0x75bd('0x11')]===0x1f4){logger['error'](_0x75bd('0xc'),_0x4ee83f,_0x3a92b0['error'][_0x75bd('0x12')]);return _0x415f86(_0x3a92b0[_0x75bd('0x10')][_0x75bd('0x12')]);}logger[_0x75bd('0x10')](_0x75bd('0xc'),_0x4ee83f,_0x3a92b0[_0x75bd('0x10')][_0x75bd('0x12')]);return _0x9a1d52(_0x3a92b0[_0x75bd('0x10')][_0x75bd('0x12')]);}else{logger[_0x75bd('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x4ee83f,_0x75bd('0xe'));_0x9a1d52(_0x3a92b0['result'][_0x75bd('0x12')]);}})['catch'](function(_0x5b6f86){logger[_0x75bd('0x10')](_0x75bd('0xc'),_0x4ee83f,_0x5b6f86);_0x415f86(_0x5b6f86);});});} \ No newline at end of file +var _0x66fa=['VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x66fa,0x1ae));var _0xa66f=function(_0x455e29,_0x23f69f){_0x455e29=_0x455e29-0x0;var _0x473807=_0x66fa[_0x455e29];return _0x473807;};'use strict';var _=require('lodash');var util=require(_0xa66f('0x0'));var moment=require('moment');var BPromise=require(_0xa66f('0x1'));var rs=require(_0xa66f('0x2'));var fs=require('fs');var Redis=require(_0xa66f('0x3'));var db=require(_0xa66f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa66f('0x5'))('rpc');var config=require(_0xa66f('0x6'));var jayson=require(_0xa66f('0x7'));var client=jayson[_0xa66f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4faad2,_0x223920,_0x28c51f){return new BPromise(function(_0x3d58c7,_0x1bf129){return client[_0xa66f('0x9')](_0x4faad2,_0x28c51f)[_0xa66f('0xa')](function(_0x46e973){logger['info'](_0xa66f('0xb'),_0x223920,_0xa66f('0xc'));logger[_0xa66f('0xd')](_0xa66f('0xe'),_0x223920,'request\x20sent',JSON[_0xa66f('0xf')](_0x46e973));if(_0x46e973[_0xa66f('0x10')]){if(_0x46e973[_0xa66f('0x10')][_0xa66f('0x11')]===0x1f4){logger[_0xa66f('0x10')](_0xa66f('0xb'),_0x223920,_0x46e973[_0xa66f('0x10')][_0xa66f('0x12')]);return _0x1bf129(_0x46e973['error'][_0xa66f('0x12')]);}logger[_0xa66f('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x223920,_0x46e973[_0xa66f('0x10')][_0xa66f('0x12')]);return _0x3d58c7(_0x46e973['error'][_0xa66f('0x12')]);}else{logger[_0xa66f('0x13')](_0xa66f('0xb'),_0x223920,'request\x20sent');_0x3d58c7(_0x46e973[_0xa66f('0x14')]['message']);}})['catch'](function(_0x297ba3){logger[_0xa66f('0x10')](_0xa66f('0xb'),_0x223920,_0x297ba3);_0x1bf129(_0x297ba3);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index f28017d..72b39c1 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 _0x3bfa=['update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x34112c,_0x4af8c1){var _0x1d9cc6=function(_0x4cd153){while(--_0x4cd153){_0x34112c['push'](_0x34112c['shift']());}};_0x1d9cc6(++_0x4af8c1);}(_0x3bfa,0x159));var _0xa3bf=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x3bfa[_0x1e7b16];return _0x37fadc;};'use strict';var multer=require('multer');var util=require(_0xa3bf('0x0'));var path=require(_0xa3bf('0x1'));var timeout=require(_0xa3bf('0x2'));var express=require(_0xa3bf('0x3'));var router=express[_0xa3bf('0x4')]();var fs_extra=require(_0xa3bf('0x5'));var auth=require(_0xa3bf('0x6'));var interaction=require(_0xa3bf('0x7'));var config=require(_0xa3bf('0x8'));var controller=require('./intVtigerField.controller');router[_0xa3bf('0x9')]('/',auth[_0xa3bf('0xa')](),controller[_0xa3bf('0xb')]);router[_0xa3bf('0x9')](_0xa3bf('0xc'),auth[_0xa3bf('0xa')](),controller[_0xa3bf('0xd')]);router[_0xa3bf('0xe')]('/',auth[_0xa3bf('0xa')](),controller['create']);router[_0xa3bf('0xf')](_0xa3bf('0xc'),auth[_0xa3bf('0xa')](),controller[_0xa3bf('0x10')]);router[_0xa3bf('0x11')](_0xa3bf('0xc'),auth['isAuthenticated'](),controller[_0xa3bf('0x12')]);module['exports']=router; \ No newline at end of file +var _0x666e=['../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5db9df,_0x4ca996){var _0x4b82a2=function(_0xdac87b){while(--_0xdac87b){_0x5db9df['push'](_0x5db9df['shift']());}};_0x4b82a2(++_0x4ca996);}(_0x666e,0x17a));var _0xe666=function(_0x526dc2,_0x37ebb8){_0x526dc2=_0x526dc2-0x0;var _0x54e521=_0x666e[_0x526dc2];return _0x54e521;};'use strict';var multer=require(_0xe666('0x0'));var util=require(_0xe666('0x1'));var path=require('path');var timeout=require(_0xe666('0x2'));var express=require(_0xe666('0x3'));var router=express[_0xe666('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe666('0x5'));var interaction=require(_0xe666('0x6'));var config=require(_0xe666('0x7'));var controller=require(_0xe666('0x8'));router[_0xe666('0x9')]('/',auth[_0xe666('0xa')](),controller[_0xe666('0xb')]);router[_0xe666('0x9')](_0xe666('0xc'),auth[_0xe666('0xa')](),controller['show']);router['post']('/',auth[_0xe666('0xa')](),controller['create']);router['put'](_0xe666('0xc'),auth[_0xe666('0xa')](),controller['update']);router[_0xe666('0xd')](_0xe666('0xc'),auth[_0xe666('0xa')](),controller[_0xe666('0xe')]);module[_0xe666('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index c30e103..e6ad524 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 _0xc6df=['ENUM','variable','keyValue','picklist','string','STRING','BOOLEAN','exports'];(function(_0x219e2c,_0x49bdf2){var _0x1dee0a=function(_0xbd3214){while(--_0xbd3214){_0x219e2c['push'](_0x219e2c['shift']());}};_0x1dee0a(++_0x49bdf2);}(_0xc6df,0x1bf));var _0xfc6d=function(_0x36f2e5,_0x10e3b1){_0x36f2e5=_0x36f2e5-0x0;var _0x4c9b52=_0xc6df[_0x36f2e5];return _0x4c9b52;};'use strict';var Sequelize=require('sequelize');module[_0xfc6d('0x0')]={'type':{'type':Sequelize[_0xfc6d('0x1')]('string',_0xfc6d('0x2'),'customVariable',_0xfc6d('0x3'),_0xfc6d('0x4')),'defaultValue':_0xfc6d('0x5')},'content':{'type':Sequelize[_0xfc6d('0x6')]},'key':{'type':Sequelize[_0xfc6d('0x6')]},'keyType':{'type':Sequelize[_0xfc6d('0x1')](_0xfc6d('0x5'),_0xfc6d('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xfc6d('0x6')]},'idField':{'type':Sequelize[_0xfc6d('0x6')]},'nameField':{'type':Sequelize[_0xfc6d('0x6')]},'customField':{'type':Sequelize[_0xfc6d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfc6d('0x6')]}}; \ No newline at end of file +var _0xf222=['STRING','sequelize','exports','ENUM','variable','customVariable','picklist','string'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0xf222,0x79));var _0x2f22=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf222[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x2f22('0x0'));module[_0x2f22('0x1')]={'type':{'type':Sequelize[_0x2f22('0x2')]('string',_0x2f22('0x3'),_0x2f22('0x4'),'keyValue',_0x2f22('0x5')),'defaultValue':_0x2f22('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2f22('0x7')]},'keyType':{'type':Sequelize[_0x2f22('0x2')](_0x2f22('0x6'),_0x2f22('0x3'),_0x2f22('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2f22('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 7b2d7ac..9a1d2b7 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 _0x01d2=['keys','rawAttributes','length','include','find','create','body','params','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','index','map','VtigerField','key','model','name','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch'];(function(_0x6afc9c,_0xf6b755){var _0x195d68=function(_0x48f1eb){while(--_0x48f1eb){_0x6afc9c['push'](_0x6afc9c['shift']());}};_0x195d68(++_0xf6b755);}(_0x01d2,0x9a));var _0x201d=function(_0xee697a,_0x14dd6e){_0xee697a=_0xee697a-0x0;var _0x10ea66=_0x01d2[_0xee697a];return _0x10ea66;};'use strict';var emlformat=require(_0x201d('0x0'));var rimraf=require(_0x201d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x201d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x201d('0x3'));var Mustache=require(_0x201d('0x4'));var util=require(_0x201d('0x5'));var path=require(_0x201d('0x6'));var sox=require(_0x201d('0x7'));var csv=require(_0x201d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x201d('0x9'));var _=require(_0x201d('0xa'));var squel=require(_0x201d('0xb'));var crypto=require(_0x201d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x201d('0xd'));var toCsv=require(_0x201d('0x8'));var querystring=require(_0x201d('0xe'));var Papa=require(_0x201d('0xf'));var Redis=require(_0x201d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x201d('0x11'));var as=require(_0x201d('0x12'));var hardwareService=require(_0x201d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x201d('0x14'));var config=require(_0x201d('0x15'));var licenseUtil=require(_0x201d('0x16'));var db=require(_0x201d('0x17'))['db'];function respondWithStatusCode(_0x4884c7,_0xbb41ab){_0xbb41ab=_0xbb41ab||0xcc;return function(_0x89a06){if(_0x89a06){return _0x4884c7[_0x201d('0x18')](_0xbb41ab);}return _0x4884c7[_0x201d('0x19')](_0xbb41ab)[_0x201d('0x1a')]();};}function respondWithResult(_0x317596,_0x250002){_0x250002=_0x250002||0xc8;return function(_0x49c044){if(_0x49c044){return _0x317596[_0x201d('0x19')](_0x250002)[_0x201d('0x1b')](_0x49c044);}};}function respondWithFilteredResult(_0x502e94,_0x5203da){return function(_0x3e2ec5){if(_0x3e2ec5){var _0x4799ff=typeof _0x5203da[_0x201d('0x1c')]===_0x201d('0x1d')&&typeof _0x5203da[_0x201d('0x1e')]===_0x201d('0x1d');var _0x530b28=_0x3e2ec5[_0x201d('0x1f')];var _0x120f2b=_0x4799ff?0x0:_0x5203da[_0x201d('0x1c')];var _0x3c1c1e=_0x4799ff?_0x3e2ec5[_0x201d('0x1f')]:_0x5203da[_0x201d('0x1c')]+_0x5203da[_0x201d('0x1e')];var _0x4abf43;if(_0x3c1c1e>=_0x530b28){_0x3c1c1e=_0x530b28;_0x4abf43=0xc8;}else{_0x4abf43=0xce;}_0x502e94[_0x201d('0x19')](_0x4abf43);return _0x502e94[_0x201d('0x20')](_0x201d('0x21'),_0x120f2b+'-'+_0x3c1c1e+'/'+_0x530b28)[_0x201d('0x1b')](_0x3e2ec5);}return null;};}function patchUpdates(_0x10add9){return function(_0x226709){try{jsonpatch[_0x201d('0x22')](_0x226709,_0x10add9,!![]);}catch(_0x5a62e0){return BPromise[_0x201d('0x23')](_0x5a62e0);}return _0x226709['save']();};}function saveUpdates(_0x40601c,_0xa68230){return function(_0x11b472){if(_0x11b472){return _0x11b472[_0x201d('0x24')](_0x40601c)[_0x201d('0x25')](function(_0x1fc0ad){return _0x1fc0ad;});}return null;};}function removeEntity(_0x23462f,_0x24c88b){return function(_0x4a034d){if(_0x4a034d){return _0x4a034d[_0x201d('0x26')]()[_0x201d('0x25')](function(){_0x23462f[_0x201d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15a775,_0xf37e){return function(_0x3b8577){if(!_0x3b8577){_0x15a775[_0x201d('0x18')](0x194);}return _0x3b8577;};}function handleError(_0x1bd511,_0x3011ab){_0x3011ab=_0x3011ab||0x1f4;return function(_0x31bc5a){logger[_0x201d('0x27')](_0x31bc5a[_0x201d('0x28')]);if(_0x31bc5a['name']){delete _0x31bc5a['name'];}_0x1bd511[_0x201d('0x19')](_0x3011ab)[_0x201d('0x29')](_0x31bc5a);};}exports[_0x201d('0x2a')]=function(_0x3b7b10,_0x3956ec){var _0xd7acb9={},_0x8ea02={},_0x29731b={'count':0x0,'rows':[]};var _0xf61b75=_[_0x201d('0x2b')](db[_0x201d('0x2c')]['rawAttributes'],function(_0x5bd3ed){return{'name':_0x5bd3ed['fieldName'],'type':_0x5bd3ed['type'][_0x201d('0x2d')]};});_0x8ea02[_0x201d('0x2e')]=_[_0x201d('0x2b')](_0xf61b75,_0x201d('0x2f'));_0x8ea02['query']=_['keys'](_0x3b7b10['query']);_0x8ea02['filters']=_['intersection'](_0x8ea02[_0x201d('0x2e')],_0x8ea02[_0x201d('0x30')]);_0xd7acb9[_0x201d('0x31')]=_[_0x201d('0x32')](_0x8ea02[_0x201d('0x2e')],qs['fields'](_0x3b7b10[_0x201d('0x30')][_0x201d('0x33')]));_0xd7acb9['attributes']=_0xd7acb9[_0x201d('0x31')]['length']?_0xd7acb9['attributes']:_0x8ea02[_0x201d('0x2e')];if(!_0x3b7b10[_0x201d('0x30')][_0x201d('0x34')](_0x201d('0x35'))){_0xd7acb9[_0x201d('0x1e')]=qs['limit'](_0x3b7b10[_0x201d('0x30')][_0x201d('0x1e')]);_0xd7acb9[_0x201d('0x1c')]=qs[_0x201d('0x1c')](_0x3b7b10[_0x201d('0x30')][_0x201d('0x1c')]);}_0xd7acb9[_0x201d('0x36')]=qs[_0x201d('0x37')](_0x3b7b10[_0x201d('0x30')][_0x201d('0x37')]);_0xd7acb9[_0x201d('0x38')]=qs[_0x201d('0x39')](_['pick'](_0x3b7b10[_0x201d('0x30')],_0x8ea02['filters']),_0xf61b75);if(_0x3b7b10['query'][_0x201d('0x3a')]){_0xd7acb9['where']=_[_0x201d('0x3b')](_0xd7acb9[_0x201d('0x38')],{'$or':_[_0x201d('0x2b')](_0xf61b75,function(_0x463eb4){if(_0x463eb4['type']!==_0x201d('0x3c')){var _0x13d515={};_0x13d515[_0x463eb4[_0x201d('0x2f')]]={'$like':'%'+_0x3b7b10[_0x201d('0x30')][_0x201d('0x3a')]+'%'};return _0x13d515;}})});}_0xd7acb9=_[_0x201d('0x3b')]({},_0xd7acb9,_0x3b7b10[_0x201d('0x3d')]);var _0xc2ff32={'where':_0xd7acb9[_0x201d('0x38')]};return db[_0x201d('0x2c')][_0x201d('0x1f')](_0xc2ff32)[_0x201d('0x25')](function(_0x164d83){_0x29731b[_0x201d('0x1f')]=_0x164d83;if(_0x3b7b10[_0x201d('0x30')][_0x201d('0x3e')]){_0xd7acb9['include']=[{'all':!![]}];}return db[_0x201d('0x2c')][_0x201d('0x3f')](_0xd7acb9);})[_0x201d('0x25')](function(_0x17a82d){_0x29731b['rows']=_0x17a82d;return _0x29731b;})[_0x201d('0x25')](respondWithFilteredResult(_0x3956ec,_0xd7acb9))[_0x201d('0x40')](handleError(_0x3956ec,null));};exports['show']=function(_0x23fab5,_0x327c23){var _0x6c5c0f={'raw':!![],'where':{'id':_0x23fab5['params']['id']}},_0xb432c={};_0xb432c[_0x201d('0x2e')]=_[_0x201d('0x41')](db[_0x201d('0x2c')][_0x201d('0x42')]);_0xb432c[_0x201d('0x30')]=_[_0x201d('0x41')](_0x23fab5['query']);_0xb432c[_0x201d('0x39')]=_[_0x201d('0x32')](_0xb432c['model'],_0xb432c['query']);_0x6c5c0f['attributes']=_[_0x201d('0x32')](_0xb432c[_0x201d('0x2e')],qs[_0x201d('0x33')](_0x23fab5[_0x201d('0x30')]['fields']));_0x6c5c0f['attributes']=_0x6c5c0f[_0x201d('0x31')][_0x201d('0x43')]?_0x6c5c0f[_0x201d('0x31')]:_0xb432c[_0x201d('0x2e')];if(_0x23fab5['query'][_0x201d('0x3e')]){_0x6c5c0f[_0x201d('0x44')]=[{'all':!![]}];}_0x6c5c0f=_['merge']({},_0x6c5c0f,_0x23fab5['options']);return db['VtigerField'][_0x201d('0x45')](_0x6c5c0f)['then'](handleEntityNotFound(_0x327c23,null))[_0x201d('0x25')](respondWithResult(_0x327c23,null))[_0x201d('0x40')](handleError(_0x327c23,null));};exports[_0x201d('0x46')]=function(_0x4c115d,_0x24a555){return db[_0x201d('0x2c')][_0x201d('0x46')](_0x4c115d[_0x201d('0x47')],{})[_0x201d('0x25')](respondWithResult(_0x24a555,0xc9))[_0x201d('0x40')](handleError(_0x24a555,null));};exports[_0x201d('0x24')]=function(_0x44350a,_0x18095e){if(_0x44350a['body']['id']){delete _0x44350a[_0x201d('0x47')]['id'];}return db['VtigerField'][_0x201d('0x45')]({'where':{'id':_0x44350a[_0x201d('0x48')]['id']}})[_0x201d('0x25')](handleEntityNotFound(_0x18095e,null))['then'](saveUpdates(_0x44350a[_0x201d('0x47')],null))[_0x201d('0x25')](respondWithResult(_0x18095e,null))[_0x201d('0x40')](handleError(_0x18095e,null));};exports[_0x201d('0x26')]=function(_0x3bf968,_0x57a370){return db[_0x201d('0x2c')][_0x201d('0x45')]({'where':{'id':_0x3bf968[_0x201d('0x48')]['id']}})[_0x201d('0x25')](handleEntityNotFound(_0x57a370,null))[_0x201d('0x25')](removeEntity(_0x57a370,null))[_0x201d('0x40')](handleError(_0x57a370,null));}; \ No newline at end of file +var _0xebbb=['rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','VtigerField','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body'];(function(_0x13a304,_0x206279){var _0xe3900f=function(_0x267a5d){while(--_0x267a5d){_0x13a304['push'](_0x13a304['shift']());}};_0xe3900f(++_0x206279);}(_0xebbb,0x120));var _0xbebb=function(_0x400350,_0x1e2ade){_0x400350=_0x400350-0x0;var _0x7261c1=_0xebbb[_0x400350];return _0x7261c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbebb('0x0'));var zipdir=require(_0xbebb('0x1'));var jsonpatch=require(_0xbebb('0x2'));var rp=require(_0xbebb('0x3'));var moment=require(_0xbebb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xbebb('0x5'));var csv=require(_0xbebb('0x6'));var ejs=require(_0xbebb('0x7'));var fs=require('fs');var fs_extra=require(_0xbebb('0x8'));var _=require(_0xbebb('0x9'));var squel=require(_0xbebb('0xa'));var crypto=require('crypto');var jsforce=require(_0xbebb('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbebb('0xc'));var Papa=require('papaparse');var Redis=require(_0xbebb('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbebb('0xe'));var hardwareService=require(_0xbebb('0xf'));var logger=require(_0xbebb('0x10'))(_0xbebb('0x11'));var utils=require(_0xbebb('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54911e,_0x5b35ae){_0x5b35ae=_0x5b35ae||0xcc;return function(_0x20a07b){if(_0x20a07b){return _0x54911e[_0xbebb('0x13')](_0x5b35ae);}return _0x54911e['status'](_0x5b35ae)[_0xbebb('0x14')]();};}function respondWithResult(_0x4a450c,_0x222933){_0x222933=_0x222933||0xc8;return function(_0x4dc6e0){if(_0x4dc6e0){return _0x4a450c['status'](_0x222933)['json'](_0x4dc6e0);}};}function respondWithFilteredResult(_0x313154,_0x137128){return function(_0x1122b0){if(_0x1122b0){var _0x2a91f5=typeof _0x137128[_0xbebb('0x15')]===_0xbebb('0x16')&&typeof _0x137128[_0xbebb('0x17')]===_0xbebb('0x16');var _0x33e980=_0x1122b0['count'];var _0x421c1f=_0x2a91f5?0x0:_0x137128['offset'];var _0x14f431=_0x2a91f5?_0x1122b0[_0xbebb('0x18')]:_0x137128[_0xbebb('0x15')]+_0x137128[_0xbebb('0x17')];var _0x4dfca6;if(_0x14f431>=_0x33e980){_0x14f431=_0x33e980;_0x4dfca6=0xc8;}else{_0x4dfca6=0xce;}_0x313154[_0xbebb('0x19')](_0x4dfca6);return _0x313154[_0xbebb('0x1a')](_0xbebb('0x1b'),_0x421c1f+'-'+_0x14f431+'/'+_0x33e980)[_0xbebb('0x1c')](_0x1122b0);}return null;};}function patchUpdates(_0x5f5487){return function(_0x334e70){try{jsonpatch[_0xbebb('0x1d')](_0x334e70,_0x5f5487,!![]);}catch(_0x3dff9c){return BPromise[_0xbebb('0x1e')](_0x3dff9c);}return _0x334e70[_0xbebb('0x1f')]();};}function saveUpdates(_0x19e87d,_0x54422b){return function(_0x1c7bc6){if(_0x1c7bc6){return _0x1c7bc6[_0xbebb('0x20')](_0x19e87d)[_0xbebb('0x21')](function(_0x9c8f13){return _0x9c8f13;});}return null;};}function removeEntity(_0x57d761,_0x3749fd){return function(_0xac3584){if(_0xac3584){return _0xac3584[_0xbebb('0x22')]()['then'](function(){_0x57d761['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1965f1,_0xaba781){return function(_0x117663){if(!_0x117663){_0x1965f1[_0xbebb('0x13')](0x194);}return _0x117663;};}function handleError(_0x4ad43b,_0x2415cc){_0x2415cc=_0x2415cc||0x1f4;return function(_0x2e05b6){logger[_0xbebb('0x23')](_0x2e05b6['stack']);if(_0x2e05b6[_0xbebb('0x24')]){delete _0x2e05b6[_0xbebb('0x24')];}_0x4ad43b[_0xbebb('0x19')](_0x2415cc)[_0xbebb('0x25')](_0x2e05b6);};}exports[_0xbebb('0x26')]=function(_0x523bdd,_0x6fcff3){var _0xed0488={},_0x2047a4={},_0x30ba34={'count':0x0,'rows':[]};var _0x242c14=_[_0xbebb('0x27')](db[_0xbebb('0x28')][_0xbebb('0x29')],function(_0x5f21a6){return{'name':_0x5f21a6['fieldName'],'type':_0x5f21a6['type'][_0xbebb('0x2a')]};});_0x2047a4['model']=_[_0xbebb('0x27')](_0x242c14,_0xbebb('0x24'));_0x2047a4[_0xbebb('0x2b')]=_['keys'](_0x523bdd[_0xbebb('0x2b')]);_0x2047a4[_0xbebb('0x2c')]=_[_0xbebb('0x2d')](_0x2047a4[_0xbebb('0x2e')],_0x2047a4[_0xbebb('0x2b')]);_0xed0488[_0xbebb('0x2f')]=_[_0xbebb('0x2d')](_0x2047a4['model'],qs[_0xbebb('0x30')](_0x523bdd[_0xbebb('0x2b')][_0xbebb('0x30')]));_0xed0488['attributes']=_0xed0488[_0xbebb('0x2f')][_0xbebb('0x31')]?_0xed0488[_0xbebb('0x2f')]:_0x2047a4[_0xbebb('0x2e')];if(!_0x523bdd[_0xbebb('0x2b')][_0xbebb('0x32')](_0xbebb('0x33'))){_0xed0488['limit']=qs[_0xbebb('0x17')](_0x523bdd[_0xbebb('0x2b')][_0xbebb('0x17')]);_0xed0488[_0xbebb('0x15')]=qs[_0xbebb('0x15')](_0x523bdd[_0xbebb('0x2b')][_0xbebb('0x15')]);}_0xed0488[_0xbebb('0x34')]=qs[_0xbebb('0x35')](_0x523bdd['query'][_0xbebb('0x35')]);_0xed0488[_0xbebb('0x36')]=qs[_0xbebb('0x2c')](_[_0xbebb('0x37')](_0x523bdd[_0xbebb('0x2b')],_0x2047a4[_0xbebb('0x2c')]),_0x242c14);if(_0x523bdd[_0xbebb('0x2b')][_0xbebb('0x38')]){_0xed0488[_0xbebb('0x36')]=_[_0xbebb('0x39')](_0xed0488['where'],{'$or':_[_0xbebb('0x27')](_0x242c14,function(_0x4f813d){if(_0x4f813d[_0xbebb('0x3a')]!==_0xbebb('0x3b')){var _0x32db54={};_0x32db54[_0x4f813d[_0xbebb('0x24')]]={'$like':'%'+_0x523bdd[_0xbebb('0x2b')]['filter']+'%'};return _0x32db54;}})});}_0xed0488=_[_0xbebb('0x39')]({},_0xed0488,_0x523bdd['options']);var _0x13d53e={'where':_0xed0488[_0xbebb('0x36')]};return db[_0xbebb('0x28')][_0xbebb('0x18')](_0x13d53e)[_0xbebb('0x21')](function(_0x503133){_0x30ba34[_0xbebb('0x18')]=_0x503133;if(_0x523bdd[_0xbebb('0x2b')]['includeAll']){_0xed0488[_0xbebb('0x3c')]=[{'all':!![]}];}return db[_0xbebb('0x28')][_0xbebb('0x3d')](_0xed0488);})[_0xbebb('0x21')](function(_0x5981bc){_0x30ba34[_0xbebb('0x3e')]=_0x5981bc;return _0x30ba34;})[_0xbebb('0x21')](respondWithFilteredResult(_0x6fcff3,_0xed0488))[_0xbebb('0x3f')](handleError(_0x6fcff3,null));};exports[_0xbebb('0x40')]=function(_0x283d1c,_0x2f5511){var _0x5735f1={'raw':!![],'where':{'id':_0x283d1c[_0xbebb('0x41')]['id']}},_0x1cfa26={};_0x1cfa26['model']=_['keys'](db['VtigerField'][_0xbebb('0x29')]);_0x1cfa26['query']=_[_0xbebb('0x42')](_0x283d1c[_0xbebb('0x2b')]);_0x1cfa26[_0xbebb('0x2c')]=_[_0xbebb('0x2d')](_0x1cfa26[_0xbebb('0x2e')],_0x1cfa26[_0xbebb('0x2b')]);_0x5735f1['attributes']=_['intersection'](_0x1cfa26[_0xbebb('0x2e')],qs[_0xbebb('0x30')](_0x283d1c['query'][_0xbebb('0x30')]));_0x5735f1[_0xbebb('0x2f')]=_0x5735f1[_0xbebb('0x2f')][_0xbebb('0x31')]?_0x5735f1[_0xbebb('0x2f')]:_0x1cfa26[_0xbebb('0x2e')];if(_0x283d1c['query'][_0xbebb('0x43')]){_0x5735f1[_0xbebb('0x3c')]=[{'all':!![]}];}_0x5735f1=_['merge']({},_0x5735f1,_0x283d1c[_0xbebb('0x44')]);return db['VtigerField'][_0xbebb('0x45')](_0x5735f1)['then'](handleEntityNotFound(_0x2f5511,null))['then'](respondWithResult(_0x2f5511,null))[_0xbebb('0x3f')](handleError(_0x2f5511,null));};exports[_0xbebb('0x46')]=function(_0x2fe5c5,_0x107e20){return db[_0xbebb('0x28')][_0xbebb('0x46')](_0x2fe5c5['body'],{})[_0xbebb('0x21')](respondWithResult(_0x107e20,0xc9))['catch'](handleError(_0x107e20,null));};exports['update']=function(_0xe8dee5,_0x460635){if(_0xe8dee5[_0xbebb('0x47')]['id']){delete _0xe8dee5[_0xbebb('0x47')]['id'];}return db[_0xbebb('0x28')][_0xbebb('0x45')]({'where':{'id':_0xe8dee5['params']['id']}})[_0xbebb('0x21')](handleEntityNotFound(_0x460635,null))['then'](saveUpdates(_0xe8dee5[_0xbebb('0x47')],null))[_0xbebb('0x21')](respondWithResult(_0x460635,null))['catch'](handleError(_0x460635,null));};exports[_0xbebb('0x22')]=function(_0x1a9864,_0x5a5bfb){return db[_0xbebb('0x28')][_0xbebb('0x45')]({'where':{'id':_0x1a9864['params']['id']}})['then'](handleEntityNotFound(_0x5a5bfb,null))[_0xbebb('0x21')](removeEntity(_0x5a5bfb,null))[_0xbebb('0x3f')](handleError(_0x5a5bfb,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index f20eca1..56c7711 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 _0xcd5a=['idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','define','int_vtiger_fields'];(function(_0x560924,_0x258a47){var _0x5c694d=function(_0x599a81){while(--_0x599a81){_0x560924['push'](_0x560924['shift']());}};_0x5c694d(++_0x258a47);}(_0xcd5a,0xf0));var _0xacd5=function(_0x334322,_0x494376){_0x334322=_0x334322-0x0;var _0x7a4a25=_0xcd5a[_0x334322];return _0x7a4a25;};'use strict';var _=require('lodash');var util=require(_0xacd5('0x0'));var logger=require(_0xacd5('0x1'))(_0xacd5('0x2'));var moment=require(_0xacd5('0x3'));var BPromise=require(_0xacd5('0x4'));var rp=require(_0xacd5('0x5'));var fs=require('fs');var path=require(_0xacd5('0x6'));var rimraf=require(_0xacd5('0x7'));var config=require(_0xacd5('0x8'));var attributes=require(_0xacd5('0x9'));module['exports']=function(_0x1c86d3,_0x3da744){return _0x1c86d3[_0xacd5('0xa')]('VtigerField',attributes,{'tableName':_0xacd5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xacd5('0xc'),_0xacd5('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70d4=['VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x595bf3,_0x2c1d46){var _0x5b3b7c=function(_0x12e961){while(--_0x12e961){_0x595bf3['push'](_0x595bf3['shift']());}};_0x5b3b7c(++_0x2c1d46);}(_0x70d4,0x130));var _0x470d=function(_0x2fcf18,_0x10009a){_0x2fcf18=_0x2fcf18-0x0;var _0x4c68cc=_0x70d4[_0x2fcf18];return _0x4c68cc;};'use strict';var _=require(_0x470d('0x0'));var util=require('util');var logger=require(_0x470d('0x1'))(_0x470d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x470d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x470d('0x4'));var config=require(_0x470d('0x5'));var attributes=require('./intVtigerField.attributes');module[_0x470d('0x6')]=function(_0x559b16,_0x9669aa){return _0x559b16[_0x470d('0x7')](_0x470d('0x8'),attributes,{'tableName':_0x470d('0x9'),'paranoid':![],'indexes':[{'name':_0x470d('0xa'),'fields':[_0x470d('0xb'),_0x470d('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 7f9362b..d9ac48e 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 _0x7c2b=['VtigerField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x90cfe8,_0x2dc132){var _0x9a0c73=function(_0x5912ac){while(--_0x5912ac){_0x90cfe8['push'](_0x90cfe8['shift']());}};_0x9a0c73(++_0x2dc132);}(_0x7c2b,0x10b));var _0xb7c2=function(_0x941c40,_0x475355){_0x941c40=_0x941c40-0x0;var _0x39b44a=_0x7c2b[_0x941c40];return _0x39b44a;};'use strict';var _=require(_0xb7c2('0x0'));var util=require(_0xb7c2('0x1'));var moment=require(_0xb7c2('0x2'));var BPromise=require(_0xb7c2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7c2('0x4'))['db'];var utils=require(_0xb7c2('0x5'));var logger=require(_0xb7c2('0x6'))(_0xb7c2('0x7'));var config=require('../../config/environment');var jayson=require(_0xb7c2('0x8'));var client=jayson[_0xb7c2('0x9')][_0xb7c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18aaab,_0x46914a,_0x55b551){return new BPromise(function(_0x11c707,_0x1ea873){return client[_0xb7c2('0xb')](_0x18aaab,_0x55b551)[_0xb7c2('0xc')](function(_0x3a29a6){logger[_0xb7c2('0xd')]('VtigerField,\x20%s,\x20%s',_0x46914a,_0xb7c2('0xe'));logger[_0xb7c2('0xf')](_0xb7c2('0x10'),_0x46914a,_0xb7c2('0xe'),JSON[_0xb7c2('0x11')](_0x3a29a6));if(_0x3a29a6[_0xb7c2('0x12')]){if(_0x3a29a6[_0xb7c2('0x12')][_0xb7c2('0x13')]===0x1f4){logger[_0xb7c2('0x12')]('VtigerField,\x20%s,\x20%s',_0x46914a,_0x3a29a6[_0xb7c2('0x12')][_0xb7c2('0x14')]);return _0x1ea873(_0x3a29a6[_0xb7c2('0x12')][_0xb7c2('0x14')]);}logger['error'](_0xb7c2('0x15'),_0x46914a,_0x3a29a6[_0xb7c2('0x12')]['message']);return _0x11c707(_0x3a29a6[_0xb7c2('0x12')]['message']);}else{logger[_0xb7c2('0xd')](_0xb7c2('0x15'),_0x46914a,_0xb7c2('0xe'));_0x11c707(_0x3a29a6[_0xb7c2('0x16')]['message']);}})[_0xb7c2('0x17')](function(_0x1e4785){logger[_0xb7c2('0x12')](_0xb7c2('0x15'),_0x46914a,_0x1e4785);_0x1ea873(_0x1e4785);});});} \ No newline at end of file +var _0x7764=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x55f8fa,_0x616528){var _0x20a9a9=function(_0x337bb5){while(--_0x337bb5){_0x55f8fa['push'](_0x55f8fa['shift']());}};_0x20a9a9(++_0x616528);}(_0x7764,0xa4));var _0x4776=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0x7764[_0x46361e];return _0x14e302;};'use strict';var _=require(_0x4776('0x0'));var util=require(_0x4776('0x1'));var moment=require(_0x4776('0x2'));var BPromise=require(_0x4776('0x3'));var rs=require(_0x4776('0x4'));var fs=require('fs');var Redis=require(_0x4776('0x5'));var db=require(_0x4776('0x6'))['db'];var utils=require(_0x4776('0x7'));var logger=require(_0x4776('0x8'))(_0x4776('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4776('0xa')][_0x4776('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52f59e,_0x1f9a45,_0x2b61c7){return new BPromise(function(_0x4fcbcc,_0x53f976){return client[_0x4776('0xc')](_0x52f59e,_0x2b61c7)['then'](function(_0x35bf06){logger[_0x4776('0xd')](_0x4776('0xe'),_0x1f9a45,_0x4776('0xf'));logger[_0x4776('0x10')](_0x4776('0x11'),_0x1f9a45,_0x4776('0xf'),JSON[_0x4776('0x12')](_0x35bf06));if(_0x35bf06[_0x4776('0x13')]){if(_0x35bf06[_0x4776('0x13')][_0x4776('0x14')]===0x1f4){logger[_0x4776('0x13')](_0x4776('0xe'),_0x1f9a45,_0x35bf06[_0x4776('0x13')][_0x4776('0x15')]);return _0x53f976(_0x35bf06[_0x4776('0x13')]['message']);}logger['error'](_0x4776('0xe'),_0x1f9a45,_0x35bf06[_0x4776('0x13')][_0x4776('0x15')]);return _0x4fcbcc(_0x35bf06[_0x4776('0x13')][_0x4776('0x15')]);}else{logger[_0x4776('0xd')](_0x4776('0xe'),_0x1f9a45,_0x4776('0xf'));_0x4fcbcc(_0x35bf06[_0x4776('0x16')][_0x4776('0x15')]);}})['catch'](function(_0x46fec7){logger['error'](_0x4776('0xe'),_0x1f9a45,_0x46fec7);_0x53f976(_0x46fec7);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 5e46989..ec78a82 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 _0x4b5b=['isAuthenticated','/:id/configurations','getConfigurations','post','create','addConfiguration','put','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x4b5b,0x1c1));var _0xb4b5=function(_0x84b29,_0x5cf782){_0x84b29=_0x84b29-0x0;var _0x3ed99d=_0x4b5b[_0x84b29];return _0x3ed99d;};'use strict';var multer=require('multer');var util=require(_0xb4b5('0x0'));var path=require(_0xb4b5('0x1'));var timeout=require(_0xb4b5('0x2'));var express=require(_0xb4b5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb4b5('0x4'));var interaction=require(_0xb4b5('0x5'));var config=require(_0xb4b5('0x6'));var controller=require(_0xb4b5('0x7'));router[_0xb4b5('0x8')]('/',auth['isAuthenticated'](),controller[_0xb4b5('0x9')]);router[_0xb4b5('0x8')](_0xb4b5('0xa'),auth[_0xb4b5('0xb')](),controller['show']);router[_0xb4b5('0x8')](_0xb4b5('0xc'),auth[_0xb4b5('0xb')](),controller[_0xb4b5('0xd')]);router['get']('/:id/fields',auth[_0xb4b5('0xb')](),controller['getFields']);router[_0xb4b5('0xe')]('/',auth[_0xb4b5('0xb')](),controller[_0xb4b5('0xf')]);router[_0xb4b5('0xe')](_0xb4b5('0xc'),auth[_0xb4b5('0xb')](),controller[_0xb4b5('0x10')]);router[_0xb4b5('0x11')]('/:id',auth[_0xb4b5('0xb')](),controller['update']);router[_0xb4b5('0x12')](_0xb4b5('0xa'),auth[_0xb4b5('0xb')](),controller['destroy']);module[_0xb4b5('0x13')]=router; \ No newline at end of file +var _0x1e7c=['index','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0x1e7c,0x132));var _0xc1e7=function(_0x527f08,_0x4119af){_0x527f08=_0x527f08-0x0;var _0x2f8864=_0x1e7c[_0x527f08];return _0x2f8864;};'use strict';var multer=require(_0xc1e7('0x0'));var util=require('util');var path=require(_0xc1e7('0x1'));var timeout=require('connect-timeout');var express=require(_0xc1e7('0x2'));var router=express[_0xc1e7('0x3')]();var fs_extra=require(_0xc1e7('0x4'));var auth=require(_0xc1e7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc1e7('0x6'));var controller=require('./intZendeskAccount.controller');router[_0xc1e7('0x7')]('/',auth[_0xc1e7('0x8')](),controller[_0xc1e7('0x9')]);router[_0xc1e7('0x7')](_0xc1e7('0xa'),auth['isAuthenticated'](),controller[_0xc1e7('0xb')]);router['get']('/:id/configurations',auth[_0xc1e7('0x8')](),controller[_0xc1e7('0xc')]);router['get']('/:id/fields',auth[_0xc1e7('0x8')](),controller[_0xc1e7('0xd')]);router[_0xc1e7('0xe')]('/',auth[_0xc1e7('0x8')](),controller[_0xc1e7('0xf')]);router[_0xc1e7('0xe')](_0xc1e7('0x10'),auth[_0xc1e7('0x8')](),controller[_0xc1e7('0x11')]);router[_0xc1e7('0x12')](_0xc1e7('0xa'),auth[_0xc1e7('0x8')](),controller[_0xc1e7('0x13')]);router[_0xc1e7('0x14')](_0xc1e7('0xa'),auth[_0xc1e7('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 75a8b70..87839ce 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 _0xacc6=['sequelize','exports','STRING','ENUM','token','password','newTab','integrationTab'];(function(_0x401b8b,_0x1a073c){var _0x51746b=function(_0x1eee82){while(--_0x1eee82){_0x401b8b['push'](_0x401b8b['shift']());}};_0x51746b(++_0x1a073c);}(_0xacc6,0x150));var _0x6acc=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0xacc6[_0x1bbc08];return _0x5d825b;};'use strict';var Sequelize=require(_0x6acc('0x0'));module[_0x6acc('0x1')]={'name':{'type':Sequelize[_0x6acc('0x2')]},'description':{'type':Sequelize[_0x6acc('0x2')]},'username':{'type':Sequelize[_0x6acc('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x6acc('0x2')]},'token':{'type':Sequelize[_0x6acc('0x2')]},'remoteUri':{'type':Sequelize[_0x6acc('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x6acc('0x3')]('password',_0x6acc('0x4')),'defaultValue':_0x6acc('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6acc('0x3')]('integrationTab',_0x6acc('0x6')),'defaultValue':_0x6acc('0x7')}}; \ No newline at end of file +var _0xc359=['remoteUri','password','integrationTab','newTab','exports','STRING','username'];(function(_0x4b8043,_0x221f2a){var _0x4407ac=function(_0x45a22d){while(--_0x45a22d){_0x4b8043['push'](_0x4b8043['shift']());}};_0x4407ac(++_0x221f2a);}(_0xc359,0x1d9));var _0x9c35=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0xc359[_0x53b8e0];return _0x10630c;};'use strict';var Sequelize=require('sequelize');module[_0x9c35('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9c35('0x1')]},'username':{'type':Sequelize[_0x9c35('0x1')],'unique':_0x9c35('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x9c35('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x9c35('0x3')},'authType':{'type':Sequelize['ENUM'](_0x9c35('0x4'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9c35('0x5'),_0x9c35('0x6')),'defaultValue':_0x9c35('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 5075ee3..3dcd760 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 _0xbc9d=['merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','find','create','update','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','getSubjects','channel','ZendeskField','Subjects','Descriptions','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','stack','send','index','ZendeskAccount','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick'];(function(_0x3fb030,_0x12aebe){var _0xd6899b=function(_0x327646){while(--_0x327646){_0x3fb030['push'](_0x3fb030['shift']());}};_0xd6899b(++_0x12aebe);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x4e1235,_0x17d5fc){_0x4e1235=_0x4e1235-0x0;var _0x592211=_0xbc9d[_0x4e1235];return _0x592211;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];var integrations=require(_0xdbc9('0x19'));function respondWithStatusCode(_0x48bc83,_0x567e71){_0x567e71=_0x567e71||0xcc;return function(_0x3d0fdd){if(_0x3d0fdd){return _0x48bc83[_0xdbc9('0x1a')](_0x567e71);}return _0x48bc83[_0xdbc9('0x1b')](_0x567e71)[_0xdbc9('0x1c')]();};}function respondWithResult(_0x53495d,_0x4a9dcb){_0x4a9dcb=_0x4a9dcb||0xc8;return function(_0x2b7bd){if(_0x2b7bd){return _0x53495d[_0xdbc9('0x1b')](_0x4a9dcb)[_0xdbc9('0x1d')](_0x2b7bd);}};}function respondWithFilteredResult(_0x4c7b4f,_0x1b4616){return function(_0x1abee8){if(_0x1abee8){var _0x4fdb81=typeof _0x1b4616[_0xdbc9('0x1e')]===_0xdbc9('0x1f')&&typeof _0x1b4616[_0xdbc9('0x20')]===_0xdbc9('0x1f');var _0x1f22f4=_0x1abee8[_0xdbc9('0x21')];var _0x9f343d=_0x4fdb81?0x0:_0x1b4616[_0xdbc9('0x1e')];var _0x2ad952=_0x4fdb81?_0x1abee8[_0xdbc9('0x21')]:_0x1b4616['offset']+_0x1b4616[_0xdbc9('0x20')];var _0x497be2;if(_0x2ad952>=_0x1f22f4){_0x2ad952=_0x1f22f4;_0x497be2=0xc8;}else{_0x497be2=0xce;}_0x4c7b4f[_0xdbc9('0x1b')](_0x497be2);return _0x4c7b4f[_0xdbc9('0x22')]('Content-Range',_0x9f343d+'-'+_0x2ad952+'/'+_0x1f22f4)[_0xdbc9('0x1d')](_0x1abee8);}return null;};}function patchUpdates(_0x5367dc){return function(_0x569f32){try{jsonpatch['apply'](_0x569f32,_0x5367dc,!![]);}catch(_0x4f3b5d){return BPromise[_0xdbc9('0x23')](_0x4f3b5d);}return _0x569f32[_0xdbc9('0x24')]();};}function saveUpdates(_0x570ad9,_0x16dcf7){return function(_0x20563e){if(_0x20563e){return _0x20563e['update'](_0x570ad9)[_0xdbc9('0x25')](function(_0x6b788){return _0x6b788;});}return null;};}function removeEntity(_0x1b1c0d,_0x119230){return function(_0x3400e7){if(_0x3400e7){return _0x3400e7[_0xdbc9('0x26')]()[_0xdbc9('0x25')](function(){_0x1b1c0d[_0xdbc9('0x1b')](0xcc)[_0xdbc9('0x1c')]();});}};}function handleEntityNotFound(_0x4a868b,_0x550bef){return function(_0xe309ae){if(!_0xe309ae){_0x4a868b[_0xdbc9('0x1a')](0x194);}return _0xe309ae;};}function handleError(_0x1053ca,_0x24fdec){_0x24fdec=_0x24fdec||0x1f4;return function(_0x50c3ee){logger[_0xdbc9('0x27')](_0x50c3ee[_0xdbc9('0x28')]);if(_0x50c3ee['name']){delete _0x50c3ee['name'];}_0x1053ca[_0xdbc9('0x1b')](_0x24fdec)[_0xdbc9('0x29')](_0x50c3ee);};}exports[_0xdbc9('0x2a')]=function(_0x59bfd2,_0x13a432){var _0x539e57={},_0x561f8e={},_0x210a40={'count':0x0,'rows':[]};var _0x49da36=_['map'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')],function(_0x1cb557){return{'name':_0x1cb557['fieldName'],'type':_0x1cb557[_0xdbc9('0x2d')][_0xdbc9('0x2e')]};});_0x561f8e['model']=_['map'](_0x49da36,_0xdbc9('0x2f'));_0x561f8e[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x59bfd2[_0xdbc9('0x30')]);_0x561f8e[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],_0x561f8e['query']);_0x539e57[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],qs[_0xdbc9('0x36')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x539e57['attributes']=_0x539e57[_0xdbc9('0x35')]['length']?_0x539e57['attributes']:_0x561f8e['model'];if(!_0x59bfd2['query']['hasOwnProperty'](_0xdbc9('0x37'))){_0x539e57[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x59bfd2['query'][_0xdbc9('0x20')]);_0x539e57[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x1e')]);}_0x539e57[_0xdbc9('0x38')]=qs['sort'](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x39')]);_0x539e57[_0xdbc9('0x3a')]=qs['filters'](_[_0xdbc9('0x3b')](_0x59bfd2[_0xdbc9('0x30')],_0x561f8e[_0xdbc9('0x32')]),_0x49da36);if(_0x59bfd2[_0xdbc9('0x30')]['filter']){_0x539e57['where']=_[_0xdbc9('0x3c')](_0x539e57[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x49da36,function(_0x1ef970){if(_0x1ef970['type']!==_0xdbc9('0x3e')){var _0x3827be={};_0x3827be[_0x1ef970[_0xdbc9('0x2f')]]={'$like':'%'+_0x59bfd2['query'][_0xdbc9('0x3f')]+'%'};return _0x3827be;}})});}_0x539e57=_[_0xdbc9('0x3c')]({},_0x539e57,_0x59bfd2[_0xdbc9('0x40')]);var _0x523c79={'where':_0x539e57[_0xdbc9('0x3a')]};return db[_0xdbc9('0x2b')]['count'](_0x523c79)['then'](function(_0xfc34d5){_0x210a40[_0xdbc9('0x21')]=_0xfc34d5;if(_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x41')]){_0x539e57['include']=[{'all':!![]}];}return db[_0xdbc9('0x2b')][_0xdbc9('0x42')](_0x539e57);})['then'](function(_0x8445b8){_0x210a40[_0xdbc9('0x43')]=_0x8445b8;return _0x210a40;})['then'](respondWithFilteredResult(_0x13a432,_0x539e57))[_0xdbc9('0x44')](handleError(_0x13a432,null));};exports[_0xdbc9('0x45')]=function(_0x2adb23,_0x3415c3){var _0x3ed4de={'raw':![],'where':{'id':_0x2adb23[_0xdbc9('0x46')]['id']}},_0x1cd538={};_0x1cd538['model']=_['keys'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')]);_0x1cd538[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x2adb23[_0xdbc9('0x30')]);_0x1cd538[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x1cd538[_0xdbc9('0x34')],_0x1cd538[_0xdbc9('0x30')]);_0x3ed4de[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x1cd538['model'],qs['fields'](_0x2adb23[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x3ed4de[_0xdbc9('0x35')]=_0x3ed4de[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x3ed4de[_0xdbc9('0x35')]:_0x1cd538[_0xdbc9('0x34')];if(_0x2adb23[_0xdbc9('0x30')]['includeAll']){_0x3ed4de['include']=[{'all':!![]}];}_0x3ed4de=_[_0xdbc9('0x3c')]({},_0x3ed4de,_0x2adb23[_0xdbc9('0x40')]);return db[_0xdbc9('0x2b')][_0xdbc9('0x48')](_0x3ed4de)[_0xdbc9('0x25')](handleEntityNotFound(_0x3415c3,null))[_0xdbc9('0x25')](respondWithResult(_0x3415c3,null))[_0xdbc9('0x44')](handleError(_0x3415c3,null));};exports[_0xdbc9('0x49')]=function(_0x43e3ec,_0x589557){return db[_0xdbc9('0x2b')][_0xdbc9('0x49')](_0x43e3ec['body'],{})['then'](respondWithResult(_0x589557,0xc9))[_0xdbc9('0x44')](handleError(_0x589557,null));};exports[_0xdbc9('0x4a')]=function(_0x133a13,_0x49a55c){if(_0x133a13[_0xdbc9('0x4b')]['id']){delete _0x133a13[_0xdbc9('0x4b')]['id'];}return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x133a13['params']['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x49a55c,null))[_0xdbc9('0x25')](saveUpdates(_0x133a13[_0xdbc9('0x4b')],null))[_0xdbc9('0x25')](respondWithResult(_0x49a55c,null))['catch'](handleError(_0x49a55c,null));};exports[_0xdbc9('0x26')]=function(_0x36c70e,_0x3f49b7){return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x36c70e[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3f49b7,null))[_0xdbc9('0x25')](removeEntity(_0x3f49b7,null))['catch'](handleError(_0x3f49b7,null));};exports[_0xdbc9('0x4c')]=function(_0x4d09e1,_0x3f493e,_0x4279bc){var _0x53771a={};var _0x561737={};var _0xc7335d;var _0x4b55df;return db[_0xdbc9('0x2b')][_0xdbc9('0x4d')]({'where':{'id':_0x4d09e1[_0xdbc9('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f493e,null))[_0xdbc9('0x25')](function(_0x1c52e6){if(_0x1c52e6){_0xc7335d=_0x1c52e6;_0x561737[_0xdbc9('0x34')]=_[_0xdbc9('0x31')](db[_0xdbc9('0x4e')][_0xdbc9('0x2c')]);_0x561737[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x4d09e1['query']);_0x561737['filters']=_['intersection'](_0x561737[_0xdbc9('0x34')],_0x561737[_0xdbc9('0x30')]);_0x53771a[_0xdbc9('0x35')]=_['intersection'](_0x561737['model'],qs[_0xdbc9('0x36')](_0x4d09e1[_0xdbc9('0x30')]['fields']));_0x53771a['attributes']=_0x53771a[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x53771a[_0xdbc9('0x35')]:_0x561737[_0xdbc9('0x34')];_0x53771a[_0xdbc9('0x38')]=qs[_0xdbc9('0x39')](_0x4d09e1['query'][_0xdbc9('0x39')]);_0x53771a[_0xdbc9('0x3a')]=qs[_0xdbc9('0x32')](_['pick'](_0x4d09e1[_0xdbc9('0x30')],_0x561737[_0xdbc9('0x32')]));if(_0x4d09e1[_0xdbc9('0x30')]['filter']){_0x53771a[_0xdbc9('0x3a')]=_['merge'](_0x53771a[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x53771a[_0xdbc9('0x35')],function(_0x26ed1c){var _0x148061={};_0x148061[_0x26ed1c]={'$like':'%'+_0x4d09e1[_0xdbc9('0x30')]['filter']+'%'};return _0x148061;})});}_0x53771a=_[_0xdbc9('0x3c')]({},_0x53771a,_0x4d09e1['options']);return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})[_0xdbc9('0x25')](function(_0x53fcd6){if(_0x53fcd6){_0x4b55df=_0x53fcd6[_0xdbc9('0x47')];if(!_0x4d09e1[_0xdbc9('0x30')]['hasOwnProperty']('nolimit')){_0x53771a[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x4d09e1[_0xdbc9('0x30')]['limit']);_0x53771a[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x4d09e1['query'][_0xdbc9('0x1e')]);}return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})['then'](function(_0x4876f9){if(_0x4876f9){return _0x4876f9?{'count':_0x4b55df,'rows':_0x4876f9}:null;}})[_0xdbc9('0x25')](respondWithResult(_0x3f493e,null))[_0xdbc9('0x44')](handleError(_0x3f493e,null));};exports[_0xdbc9('0x4f')]=function(_0xa8b4d9,_0x3e93d3,_0x14cbf4){if(_0xa8b4d9[_0xdbc9('0x4b')]['id']){delete _0xa8b4d9[_0xdbc9('0x4b')]['id'];}return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0xa8b4d9[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3e93d3,null))[_0xdbc9('0x25')](function(_0x38f7da){if(_0x38f7da){_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x50')]=_0x38f7da['id'];_0xa8b4d9[_0xdbc9('0x4b')]['Subjects']=integrations[_0xdbc9('0x51')](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9['body'][_0xdbc9('0x2d')]);_0xa8b4d9[_0xdbc9('0x4b')]['Descriptions']=integrations['getDescriptions'](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x2d')]);return db['ZendeskConfiguration'][_0xdbc9('0x49')](_0xa8b4d9[_0xdbc9('0x4b')],{'include':[{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x54')},{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x55')}]});}return null;})[_0xdbc9('0x25')](respondWithResult(_0x3e93d3,null))[_0xdbc9('0x44')](handleError(_0x3e93d3,null));};exports[_0xdbc9('0x56')]=function(_0x5e6522,_0x2787d9,_0x2c3223){var _0x511778='';return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0x5e6522[_0xdbc9('0x46')]['id']},'attributes':['id',_0xdbc9('0x57'),_0xdbc9('0x58'),_0xdbc9('0x59'),_0xdbc9('0x5a'),_0xdbc9('0x5b')]})['then'](handleEntityNotFound(_0x2787d9,null))[_0xdbc9('0x25')](function(_0x19af46){if(_0x19af46){_0x511778=_0x19af46[_0xdbc9('0x5b')];var _0x4a412e=_0x511778[_0xdbc9('0x5c')](-0x1);if(_0x4a412e==='/'){_0x511778=_0x511778[_0xdbc9('0x5d')](0x0,_0x511778[_0xdbc9('0x5e')](_0x4a412e));}var _0x2b4905={'method':_0xdbc9('0x5f'),'uri':util[_0xdbc9('0x60')](_0xdbc9('0x61'),_0x511778,_0xdbc9('0x62')),'json':!![]};switch(_0x19af46[_0xdbc9('0x5a')]){case _0xdbc9('0x58'):_0x2b4905[_0xdbc9('0x63')]={'Authorization':util[_0xdbc9('0x60')]('Basic\x20%s',new Buffer(util['format'](_0xdbc9('0x64'),_0x19af46['username'],_0x19af46['password']))[_0xdbc9('0x65')](_0xdbc9('0x66')))};break;case _0xdbc9('0x59'):_0x2b4905['headers']={'Authorization':util[_0xdbc9('0x60')](_0xdbc9('0x67'),new Buffer(util[_0xdbc9('0x60')]('%s/token:%s',_0x19af46[_0xdbc9('0x57')],_0x19af46[_0xdbc9('0x59')]))['toString'](_0xdbc9('0x66')))};break;default:throw new db[(_0xdbc9('0x68'))][(_0xdbc9('0x69'))](_0xdbc9('0x6a'));}return rp(_0x2b4905);}})[_0xdbc9('0x25')](function(_0x501754){if(_0x501754){var _0x4f984b=[_0xdbc9('0x6b'),_0xdbc9('0x6c'),'group',_0xdbc9('0x6d')];_[_0xdbc9('0x6e')](_0x501754[_0xdbc9('0x62')],function(_0x5802fc){return _0x4f984b[_0xdbc9('0x6f')](_0x5802fc[_0xdbc9('0x2d')]);});return{'count':_0x501754[_0xdbc9('0x62')][_0xdbc9('0x47')],'rows':_[_0xdbc9('0x3d')](_0x501754[_0xdbc9('0x62')],function(_0x1b053a){return{'id':_0x1b053a['id'],'name':_0x1b053a[_0xdbc9('0x70')]>0x7?_0x1b053a['title']:_0x1b053a[_0xdbc9('0x2d')],'custom':_0x1b053a[_0xdbc9('0x70')]>0x7?!![]:![],'options':_0x1b053a[_0xdbc9('0x71')]?_0x1b053a[_0xdbc9('0x71')]:_0x1b053a['custom_field_options']?_0x1b053a[_0xdbc9('0x72')]:[]};})};}})['then'](respondWithResult(_0x2787d9,null))['catch'](function(_0x34ebeb){var _0x3400d0=_0x5e6522['query'][_0xdbc9('0x73')]?0x1f4:_0x34ebeb[_0xdbc9('0x74')]||0x1f4;logger[_0xdbc9('0x27')](_0xdbc9('0x75'),_0xdbc9('0x56'),_0x3400d0,JSON[_0xdbc9('0x76')](_0x34ebeb));delete _0x34ebeb[_0xdbc9('0x2f')];if(_0x3400d0===0x191){_0x3400d0=0x190;}_0x2787d9['status'](_0x3400d0)['send'](_0x5e6522[_0xdbc9('0x30')][_0xdbc9('0x73')]?{'message':_0xdbc9('0x77'),'statusCode':_0x34ebeb['statusCode']}:_0x34ebeb);});}; \ No newline at end of file +var _0xa571=['lastIndexOf','GET','format','%s/%s','ticket_fields','headers','%s:%s','password','toString','base64','Basic\x20%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','ZendeskAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','ZendeskConfiguration','order','merge','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','ZendeskField','Descriptions','getFields','username','token','authType','remoteUri','slice','substring'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xa571,0x107));var _0x1a57=function(_0xac63f5,_0x2f1df7){_0xac63f5=_0xac63f5-0x0;var _0x354310=_0xa571[_0xac63f5];return _0x354310;};'use strict';var emlformat=require(_0x1a57('0x0'));var rimraf=require(_0x1a57('0x1'));var zipdir=require(_0x1a57('0x2'));var jsonpatch=require(_0x1a57('0x3'));var rp=require('request-promise');var moment=require(_0x1a57('0x4'));var BPromise=require(_0x1a57('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1a57('0x6'));var sox=require('sox');var csv=require(_0x1a57('0x7'));var ejs=require(_0x1a57('0x8'));var fs=require('fs');var fs_extra=require(_0x1a57('0x9'));var _=require(_0x1a57('0xa'));var squel=require(_0x1a57('0xb'));var crypto=require(_0x1a57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a57('0xd'));var toCsv=require(_0x1a57('0x7'));var querystring=require(_0x1a57('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a57('0xf'));var authService=require(_0x1a57('0x10'));var qs=require(_0x1a57('0x11'));var as=require(_0x1a57('0x12'));var hardwareService=require(_0x1a57('0x13'));var logger=require(_0x1a57('0x14'))(_0x1a57('0x15'));var utils=require(_0x1a57('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a57('0x17'))['db'];var integrations=require(_0x1a57('0x18'));function respondWithStatusCode(_0x202d9a,_0x5ae643){_0x5ae643=_0x5ae643||0xcc;return function(_0x3de36a){if(_0x3de36a){return _0x202d9a[_0x1a57('0x19')](_0x5ae643);}return _0x202d9a['status'](_0x5ae643)[_0x1a57('0x1a')]();};}function respondWithResult(_0x587422,_0xd08107){_0xd08107=_0xd08107||0xc8;return function(_0x17434c){if(_0x17434c){return _0x587422[_0x1a57('0x1b')](_0xd08107)[_0x1a57('0x1c')](_0x17434c);}};}function respondWithFilteredResult(_0x5802d6,_0x20f7ad){return function(_0x53c61f){if(_0x53c61f){var _0x49ee05=typeof _0x20f7ad[_0x1a57('0x1d')]===_0x1a57('0x1e')&&typeof _0x20f7ad[_0x1a57('0x1f')]==='undefined';var _0x10793e=_0x53c61f[_0x1a57('0x20')];var _0x80f8c1=_0x49ee05?0x0:_0x20f7ad['offset'];var _0x3daa66=_0x49ee05?_0x53c61f[_0x1a57('0x20')]:_0x20f7ad[_0x1a57('0x1d')]+_0x20f7ad[_0x1a57('0x1f')];var _0xe936dd;if(_0x3daa66>=_0x10793e){_0x3daa66=_0x10793e;_0xe936dd=0xc8;}else{_0xe936dd=0xce;}_0x5802d6['status'](_0xe936dd);return _0x5802d6['set'](_0x1a57('0x21'),_0x80f8c1+'-'+_0x3daa66+'/'+_0x10793e)[_0x1a57('0x1c')](_0x53c61f);}return null;};}function patchUpdates(_0x211c63){return function(_0x4d3e05){try{jsonpatch['apply'](_0x4d3e05,_0x211c63,!![]);}catch(_0x51e271){return BPromise[_0x1a57('0x22')](_0x51e271);}return _0x4d3e05[_0x1a57('0x23')]();};}function saveUpdates(_0x3f52b9,_0xee133b){return function(_0x277d06){if(_0x277d06){return _0x277d06[_0x1a57('0x24')](_0x3f52b9)[_0x1a57('0x25')](function(_0x2f8b00){return _0x2f8b00;});}return null;};}function removeEntity(_0x183ca3,_0x35d5dc){return function(_0x29e7cd){if(_0x29e7cd){return _0x29e7cd[_0x1a57('0x26')]()[_0x1a57('0x25')](function(){_0x183ca3[_0x1a57('0x1b')](0xcc)[_0x1a57('0x1a')]();});}};}function handleEntityNotFound(_0x182649,_0x25c1e9){return function(_0x267302){if(!_0x267302){_0x182649[_0x1a57('0x19')](0x194);}return _0x267302;};}function handleError(_0xf6ffef,_0x26584b){_0x26584b=_0x26584b||0x1f4;return function(_0x1dd939){logger['error'](_0x1dd939['stack']);if(_0x1dd939[_0x1a57('0x27')]){delete _0x1dd939[_0x1a57('0x27')];}_0xf6ffef['status'](_0x26584b)[_0x1a57('0x28')](_0x1dd939);};}exports['index']=function(_0x2d8738,_0x4a2901){var _0x53bf6e={},_0x8179a4={},_0x274fe6={'count':0x0,'rows':[]};var _0x30527c=_[_0x1a57('0x29')](db['ZendeskAccount'][_0x1a57('0x2a')],function(_0x396832){return{'name':_0x396832[_0x1a57('0x2b')],'type':_0x396832[_0x1a57('0x2c')]['key']};});_0x8179a4[_0x1a57('0x2d')]=_[_0x1a57('0x29')](_0x30527c,_0x1a57('0x27'));_0x8179a4[_0x1a57('0x2e')]=_[_0x1a57('0x2f')](_0x2d8738[_0x1a57('0x2e')]);_0x8179a4[_0x1a57('0x30')]=_[_0x1a57('0x31')](_0x8179a4[_0x1a57('0x2d')],_0x8179a4['query']);_0x53bf6e[_0x1a57('0x32')]=_[_0x1a57('0x31')](_0x8179a4['model'],qs['fields'](_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x33')]));_0x53bf6e[_0x1a57('0x32')]=_0x53bf6e[_0x1a57('0x32')][_0x1a57('0x34')]?_0x53bf6e[_0x1a57('0x32')]:_0x8179a4[_0x1a57('0x2d')];if(!_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x35')](_0x1a57('0x36'))){_0x53bf6e[_0x1a57('0x1f')]=qs[_0x1a57('0x1f')](_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x1f')]);_0x53bf6e[_0x1a57('0x1d')]=qs[_0x1a57('0x1d')](_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x1d')]);}_0x53bf6e['order']=qs[_0x1a57('0x37')](_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x37')]);_0x53bf6e[_0x1a57('0x38')]=qs[_0x1a57('0x30')](_[_0x1a57('0x39')](_0x2d8738[_0x1a57('0x2e')],_0x8179a4[_0x1a57('0x30')]),_0x30527c);if(_0x2d8738[_0x1a57('0x2e')]['filter']){_0x53bf6e['where']=_['merge'](_0x53bf6e['where'],{'$or':_[_0x1a57('0x29')](_0x30527c,function(_0x14d619){if(_0x14d619[_0x1a57('0x2c')]!=='VIRTUAL'){var _0x364797={};_0x364797[_0x14d619[_0x1a57('0x27')]]={'$like':'%'+_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x3a')]+'%'};return _0x364797;}})});}_0x53bf6e=_['merge']({},_0x53bf6e,_0x2d8738[_0x1a57('0x3b')]);var _0x5e79f0={'where':_0x53bf6e[_0x1a57('0x38')]};return db[_0x1a57('0x3c')][_0x1a57('0x20')](_0x5e79f0)['then'](function(_0x1848cc){_0x274fe6[_0x1a57('0x20')]=_0x1848cc;if(_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x3d')]){_0x53bf6e[_0x1a57('0x3e')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x1a57('0x3f')](_0x53bf6e);})['then'](function(_0x4ba6b3){_0x274fe6[_0x1a57('0x40')]=_0x4ba6b3;return _0x274fe6;})['then'](respondWithFilteredResult(_0x4a2901,_0x53bf6e))[_0x1a57('0x41')](handleError(_0x4a2901,null));};exports[_0x1a57('0x42')]=function(_0x3fbae1,_0x59abb1){var _0x188a50={'raw':![],'where':{'id':_0x3fbae1[_0x1a57('0x43')]['id']}},_0x3c7ea8={};_0x3c7ea8[_0x1a57('0x2d')]=_['keys'](db[_0x1a57('0x3c')][_0x1a57('0x2a')]);_0x3c7ea8['query']=_[_0x1a57('0x2f')](_0x3fbae1['query']);_0x3c7ea8['filters']=_[_0x1a57('0x31')](_0x3c7ea8[_0x1a57('0x2d')],_0x3c7ea8[_0x1a57('0x2e')]);_0x188a50[_0x1a57('0x32')]=_['intersection'](_0x3c7ea8[_0x1a57('0x2d')],qs[_0x1a57('0x33')](_0x3fbae1[_0x1a57('0x2e')][_0x1a57('0x33')]));_0x188a50[_0x1a57('0x32')]=_0x188a50['attributes'][_0x1a57('0x34')]?_0x188a50[_0x1a57('0x32')]:_0x3c7ea8[_0x1a57('0x2d')];if(_0x3fbae1[_0x1a57('0x2e')]['includeAll']){_0x188a50[_0x1a57('0x3e')]=[{'all':!![]}];}_0x188a50=_['merge']({},_0x188a50,_0x3fbae1[_0x1a57('0x3b')]);return db[_0x1a57('0x3c')][_0x1a57('0x44')](_0x188a50)[_0x1a57('0x25')](handleEntityNotFound(_0x59abb1,null))[_0x1a57('0x25')](respondWithResult(_0x59abb1,null))[_0x1a57('0x41')](handleError(_0x59abb1,null));};exports[_0x1a57('0x45')]=function(_0x401285,_0x29fe1f){return db[_0x1a57('0x3c')][_0x1a57('0x45')](_0x401285[_0x1a57('0x46')],{})[_0x1a57('0x25')](respondWithResult(_0x29fe1f,0xc9))['catch'](handleError(_0x29fe1f,null));};exports[_0x1a57('0x24')]=function(_0x480aff,_0x3bf103){if(_0x480aff[_0x1a57('0x46')]['id']){delete _0x480aff[_0x1a57('0x46')]['id'];}return db[_0x1a57('0x3c')][_0x1a57('0x44')]({'where':{'id':_0x480aff[_0x1a57('0x43')]['id']}})[_0x1a57('0x25')](handleEntityNotFound(_0x3bf103,null))[_0x1a57('0x25')](saveUpdates(_0x480aff[_0x1a57('0x46')],null))['then'](respondWithResult(_0x3bf103,null))[_0x1a57('0x41')](handleError(_0x3bf103,null));};exports[_0x1a57('0x26')]=function(_0x51651d,_0x15f1f5){return db[_0x1a57('0x3c')]['find']({'where':{'id':_0x51651d[_0x1a57('0x43')]['id']}})[_0x1a57('0x25')](handleEntityNotFound(_0x15f1f5,null))['then'](removeEntity(_0x15f1f5,null))['catch'](handleError(_0x15f1f5,null));};exports['getConfigurations']=function(_0x2c1bac,_0x41465b,_0x509c4f){var _0x1ec79c={};var _0x18267c={};var _0x572202;var _0x5e510e;return db['ZendeskAccount'][_0x1a57('0x47')]({'where':{'id':_0x2c1bac[_0x1a57('0x43')]['id']}})[_0x1a57('0x25')](handleEntityNotFound(_0x41465b,null))[_0x1a57('0x25')](function(_0x28738e){if(_0x28738e){_0x572202=_0x28738e;_0x18267c[_0x1a57('0x2d')]=_[_0x1a57('0x2f')](db[_0x1a57('0x48')]['rawAttributes']);_0x18267c['query']=_['keys'](_0x2c1bac['query']);_0x18267c['filters']=_[_0x1a57('0x31')](_0x18267c[_0x1a57('0x2d')],_0x18267c[_0x1a57('0x2e')]);_0x1ec79c[_0x1a57('0x32')]=_[_0x1a57('0x31')](_0x18267c[_0x1a57('0x2d')],qs[_0x1a57('0x33')](_0x2c1bac[_0x1a57('0x2e')]['fields']));_0x1ec79c['attributes']=_0x1ec79c['attributes'][_0x1a57('0x34')]?_0x1ec79c['attributes']:_0x18267c[_0x1a57('0x2d')];_0x1ec79c[_0x1a57('0x49')]=qs[_0x1a57('0x37')](_0x2c1bac[_0x1a57('0x2e')][_0x1a57('0x37')]);_0x1ec79c[_0x1a57('0x38')]=qs[_0x1a57('0x30')](_['pick'](_0x2c1bac['query'],_0x18267c['filters']));if(_0x2c1bac[_0x1a57('0x2e')][_0x1a57('0x3a')]){_0x1ec79c[_0x1a57('0x38')]=_[_0x1a57('0x4a')](_0x1ec79c[_0x1a57('0x38')],{'$or':_[_0x1a57('0x29')](_0x1ec79c[_0x1a57('0x32')],function(_0x4ab246){var _0x5b691c={};_0x5b691c[_0x4ab246]={'$like':'%'+_0x2c1bac[_0x1a57('0x2e')][_0x1a57('0x3a')]+'%'};return _0x5b691c;})});}_0x1ec79c=_[_0x1a57('0x4a')]({},_0x1ec79c,_0x2c1bac[_0x1a57('0x3b')]);return _0x572202[_0x1a57('0x4b')](_0x1ec79c);}})[_0x1a57('0x25')](function(_0x59a731){if(_0x59a731){_0x5e510e=_0x59a731['length'];if(!_0x2c1bac[_0x1a57('0x2e')][_0x1a57('0x35')]('nolimit')){_0x1ec79c['limit']=qs[_0x1a57('0x1f')](_0x2c1bac[_0x1a57('0x2e')][_0x1a57('0x1f')]);_0x1ec79c[_0x1a57('0x1d')]=qs[_0x1a57('0x1d')](_0x2c1bac[_0x1a57('0x2e')][_0x1a57('0x1d')]);}return _0x572202['getConfigurations'](_0x1ec79c);}})['then'](function(_0x2fbf49){if(_0x2fbf49){return _0x2fbf49?{'count':_0x5e510e,'rows':_0x2fbf49}:null;}})[_0x1a57('0x25')](respondWithResult(_0x41465b,null))[_0x1a57('0x41')](handleError(_0x41465b,null));};exports[_0x1a57('0x4c')]=function(_0x5d92dc,_0x33092d,_0x28354c){if(_0x5d92dc[_0x1a57('0x46')]['id']){delete _0x5d92dc[_0x1a57('0x46')]['id'];}return db[_0x1a57('0x3c')]['findOne']({'where':{'id':_0x5d92dc['params']['id']}})['then'](handleEntityNotFound(_0x33092d,null))[_0x1a57('0x25')](function(_0x223ba5){if(_0x223ba5){_0x5d92dc[_0x1a57('0x46')][_0x1a57('0x4d')]=_0x223ba5['id'];_0x5d92dc[_0x1a57('0x46')][_0x1a57('0x4e')]=integrations[_0x1a57('0x4f')](_0x5d92dc[_0x1a57('0x46')]['channel'],_0x5d92dc[_0x1a57('0x46')][_0x1a57('0x2c')]);_0x5d92dc['body']['Descriptions']=integrations[_0x1a57('0x50')](_0x5d92dc['body'][_0x1a57('0x51')],_0x5d92dc[_0x1a57('0x46')][_0x1a57('0x2c')]);return db[_0x1a57('0x48')][_0x1a57('0x45')](_0x5d92dc[_0x1a57('0x46')],{'include':[{'model':db[_0x1a57('0x52')],'as':_0x1a57('0x4e')},{'model':db['ZendeskField'],'as':_0x1a57('0x53')}]});}return null;})[_0x1a57('0x25')](respondWithResult(_0x33092d,null))['catch'](handleError(_0x33092d,null));};exports[_0x1a57('0x54')]=function(_0x392f49,_0x20b0d5,_0x570674){var _0x5c3eb8='';return db[_0x1a57('0x3c')][_0x1a57('0x47')]({'where':{'id':_0x392f49[_0x1a57('0x43')]['id']},'attributes':['id',_0x1a57('0x55'),'password',_0x1a57('0x56'),_0x1a57('0x57'),_0x1a57('0x58')]})[_0x1a57('0x25')](handleEntityNotFound(_0x20b0d5,null))[_0x1a57('0x25')](function(_0x58d8cc){if(_0x58d8cc){_0x5c3eb8=_0x58d8cc[_0x1a57('0x58')];var _0x393187=_0x5c3eb8[_0x1a57('0x59')](-0x1);if(_0x393187==='/'){_0x5c3eb8=_0x5c3eb8[_0x1a57('0x5a')](0x0,_0x5c3eb8[_0x1a57('0x5b')](_0x393187));}var _0x69f3fb={'method':_0x1a57('0x5c'),'uri':util[_0x1a57('0x5d')](_0x1a57('0x5e'),_0x5c3eb8,_0x1a57('0x5f')),'json':!![]};switch(_0x58d8cc[_0x1a57('0x57')]){case'password':_0x69f3fb[_0x1a57('0x60')]={'Authorization':util[_0x1a57('0x5d')]('Basic\x20%s',new Buffer(util[_0x1a57('0x5d')](_0x1a57('0x61'),_0x58d8cc['username'],_0x58d8cc[_0x1a57('0x62')]))[_0x1a57('0x63')](_0x1a57('0x64')))};break;case _0x1a57('0x56'):_0x69f3fb[_0x1a57('0x60')]={'Authorization':util[_0x1a57('0x5d')](_0x1a57('0x65'),new Buffer(util[_0x1a57('0x5d')]('%s/token:%s',_0x58d8cc[_0x1a57('0x55')],_0x58d8cc[_0x1a57('0x56')]))['toString'](_0x1a57('0x64')))};break;default:throw new db[(_0x1a57('0x66'))][(_0x1a57('0x67'))](_0x1a57('0x68'));}return rp(_0x69f3fb);}})[_0x1a57('0x25')](function(_0xf2b1c5){if(_0xf2b1c5){var _0x220725=[_0x1a57('0x69'),_0x1a57('0x6a'),'group',_0x1a57('0x6b')];_[_0x1a57('0x6c')](_0xf2b1c5[_0x1a57('0x5f')],function(_0x1e4d4e){return _0x220725[_0x1a57('0x6d')](_0x1e4d4e['type']);});return{'count':_0xf2b1c5[_0x1a57('0x5f')][_0x1a57('0x34')],'rows':_[_0x1a57('0x29')](_0xf2b1c5[_0x1a57('0x5f')],function(_0x33f8da){return{'id':_0x33f8da['id'],'name':_0x33f8da[_0x1a57('0x6e')]>0x7?_0x33f8da[_0x1a57('0x6f')]:_0x33f8da[_0x1a57('0x2c')],'custom':_0x33f8da['position']>0x7?!![]:![],'options':_0x33f8da[_0x1a57('0x70')]?_0x33f8da[_0x1a57('0x70')]:_0x33f8da[_0x1a57('0x71')]?_0x33f8da[_0x1a57('0x71')]:[]};})};}})['then'](respondWithResult(_0x20b0d5,null))['catch'](function(_0x49f809){var _0x57cd92=_0x392f49['query'][_0x1a57('0x72')]?0x1f4:_0x49f809[_0x1a57('0x73')]||0x1f4;logger['error'](_0x1a57('0x74'),_0x1a57('0x54'),_0x57cd92,JSON['stringify'](_0x49f809));delete _0x49f809[_0x1a57('0x27')];if(_0x57cd92===0x191){_0x57cd92=0x190;}_0x20b0d5[_0x1a57('0x1b')](_0x57cd92)[_0x1a57('0x28')](_0x392f49[_0x1a57('0x2e')]['test']?{'message':_0x1a57('0x75'),'statusCode':_0x49f809[_0x1a57('0x73')]}:_0x49f809);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 8d53bd5..b00faa4 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 _0x4837=['rimraf','./intZendeskAccount.attributes','exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','request-promise','path'];(function(_0x2856d4,_0x39967c){var _0x56726d=function(_0x454fc8){while(--_0x454fc8){_0x2856d4['push'](_0x2856d4['shift']());}};_0x56726d(++_0x39967c);}(_0x4837,0x124));var _0x7483=function(_0x246491,_0x116f6b){_0x246491=_0x246491-0x0;var _0x26b90e=_0x4837[_0x246491];return _0x26b90e;};'use strict';var _=require('lodash');var util=require(_0x7483('0x0'));var logger=require(_0x7483('0x1'))(_0x7483('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7483('0x3'));var fs=require('fs');var path=require(_0x7483('0x4'));var rimraf=require(_0x7483('0x5'));var config=require('../../config/environment');var attributes=require(_0x7483('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x7483('0x7')]=function(_0x51a5cf,_0x457675){return _0x51a5cf[_0x7483('0x8')](_0x7483('0x9'),attributes,{'tableName':_0x7483('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x526f=['./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0xc889e1,_0x438415){var _0x17ab9e=function(_0x1ae369){while(--_0x1ae369){_0xc889e1['push'](_0xc889e1['shift']());}};_0x17ab9e(++_0x438415);}(_0x526f,0x144));var _0xf526=function(_0x2bbebc,_0x4f7105){_0x2bbebc=_0x2bbebc-0x0;var _0x15067c=_0x526f[_0x2bbebc];return _0x15067c;};'use strict';var _=require(_0xf526('0x0'));var util=require(_0xf526('0x1'));var logger=require(_0xf526('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf526('0x3'));var rp=require(_0xf526('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf526('0x5'));var config=require('../../config/environment');var attributes=require(_0xf526('0x6'));var integrations=require(_0xf526('0x7'));module[_0xf526('0x8')]=function(_0x2e990b,_0x3f2ffc){return _0x2e990b[_0xf526('0x9')](_0xf526('0xa'),attributes,{'tableName':'int_zendesk_accounts','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 386bb44..f3932c2 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 _0x3de2=['request\x20sent','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','attributes','limit','include','map','model','stringify','ShowZendeskAccount','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x5ad76a,_0x3daeb1){var _0x1711b9=function(_0xa367f){while(--_0xa367f){_0x5ad76a['push'](_0x5ad76a['shift']());}};_0x1711b9(++_0x3daeb1);}(_0x3de2,0x79));var _0x23de=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x3de2[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0x23de('0x0'));var util=require('util');var moment=require(_0x23de('0x1'));var BPromise=require(_0x23de('0x2'));var rs=require(_0x23de('0x3'));var fs=require('fs');var Redis=require(_0x23de('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x23de('0x5'))(_0x23de('0x6'));var config=require(_0x23de('0x7'));var jayson=require(_0x23de('0x8'));var client=jayson['client'][_0x23de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x518ed6,_0x44ee25,_0x19ce11){return new BPromise(function(_0x2f9906,_0x33cb3){return client[_0x23de('0xa')](_0x518ed6,_0x19ce11)[_0x23de('0xb')](function(_0x28f8d2){logger['info'](_0x23de('0xc'),_0x44ee25,'request\x20sent');logger[_0x23de('0xd')](_0x23de('0xe'),_0x44ee25,'request\x20sent',JSON['stringify'](_0x28f8d2));if(_0x28f8d2[_0x23de('0xf')]){if(_0x28f8d2['error'][_0x23de('0x10')]===0x1f4){logger['error'](_0x23de('0xc'),_0x44ee25,_0x28f8d2[_0x23de('0xf')][_0x23de('0x11')]);return _0x33cb3(_0x28f8d2[_0x23de('0xf')][_0x23de('0x11')]);}logger[_0x23de('0xf')](_0x23de('0xc'),_0x44ee25,_0x28f8d2[_0x23de('0xf')][_0x23de('0x11')]);return _0x2f9906(_0x28f8d2[_0x23de('0xf')][_0x23de('0x11')]);}else{logger[_0x23de('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x44ee25,_0x23de('0x13'));_0x2f9906(_0x28f8d2[_0x23de('0x14')][_0x23de('0x11')]);}})[_0x23de('0x15')](function(_0x5edfab){logger['error'](_0x23de('0xc'),_0x44ee25,_0x5edfab);_0x33cb3(_0x5edfab);});});}exports[_0x23de('0x16')]=function(_0x42cc7d){var _0x26cf3b=this;return new Promise(function(_0x20de0d,_0x25e0a7){return db[_0x23de('0x17')][_0x23de('0x18')]({'raw':_0x42cc7d['options']?_0x42cc7d[_0x23de('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x42cc7d[_0x23de('0x19')]?_0x42cc7d['options']['where']||null:null,'attributes':_0x42cc7d['options']?_0x42cc7d[_0x23de('0x19')][_0x23de('0x1a')]||null:null,'limit':_0x42cc7d[_0x23de('0x19')]?_0x42cc7d[_0x23de('0x19')][_0x23de('0x1b')]||null:null,'include':_0x42cc7d[_0x23de('0x19')]?_0x42cc7d[_0x23de('0x19')][_0x23de('0x1c')]?_[_0x23de('0x1d')](_0x42cc7d[_0x23de('0x19')][_0x23de('0x1c')],function(_0x5c5420){return{'model':db[_0x5c5420['model']],'as':_0x5c5420['as'],'attributes':_0x5c5420[_0x23de('0x1a')],'include':_0x5c5420[_0x23de('0x1c')]?_[_0x23de('0x1d')](_0x5c5420[_0x23de('0x1c')],function(_0x1ed8fb){return{'model':db[_0x1ed8fb[_0x23de('0x1e')]],'as':_0x1ed8fb['as'],'attributes':_0x1ed8fb['attributes'],'include':_0x1ed8fb[_0x23de('0x1c')]?_['map'](_0x1ed8fb['include'],function(_0x356d2b){return{'model':db[_0x356d2b[_0x23de('0x1e')]],'as':_0x356d2b['as'],'attributes':_0x356d2b[_0x23de('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x23de('0xb')](function(_0xca0675){logger[_0x23de('0x12')](_0x23de('0x16'),_0x42cc7d);logger[_0x23de('0xd')](_0x23de('0x16'),_0x42cc7d,JSON[_0x23de('0x1f')](_0xca0675));_0x20de0d(_0xca0675);})[_0x23de('0x15')](function(_0x40affa){logger['error']('GetZendeskAccount',_0x40affa['message'],_0x42cc7d);_0x25e0a7(_0x26cf3b['error'](0x1f4,_0x40affa['message']));});});};exports[_0x23de('0x20')]=function(_0x2d270a){var _0x40d7a7=this;return new Promise(function(_0xa3650d,_0x3041d8){return db['ZendeskAccount'][_0x23de('0x21')]({'raw':_0x2d270a['options']?_0x2d270a[_0x23de('0x19')][_0x23de('0x22')]===undefined?!![]:![]:!![],'where':_0x2d270a[_0x23de('0x19')]?_0x2d270a[_0x23de('0x19')]['where']||null:null,'attributes':_0x2d270a[_0x23de('0x19')]?_0x2d270a[_0x23de('0x19')][_0x23de('0x1a')]||null:null,'include':_0x2d270a[_0x23de('0x19')]?_0x2d270a[_0x23de('0x19')][_0x23de('0x1c')]?_[_0x23de('0x1d')](_0x2d270a[_0x23de('0x19')][_0x23de('0x1c')],function(_0x30a217){return{'model':db[_0x30a217['model']],'as':_0x30a217['as'],'attributes':_0x30a217['attributes'],'include':_0x30a217[_0x23de('0x1c')]?_[_0x23de('0x1d')](_0x30a217['include'],function(_0x4e79b7){return{'model':db[_0x4e79b7[_0x23de('0x1e')]],'as':_0x4e79b7['as'],'attributes':_0x4e79b7[_0x23de('0x1a')],'include':_0x4e79b7[_0x23de('0x1c')]?_[_0x23de('0x1d')](_0x4e79b7[_0x23de('0x1c')],function(_0x32e680){return{'model':db[_0x32e680[_0x23de('0x1e')]],'as':_0x32e680['as'],'attributes':_0x32e680[_0x23de('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x23de('0xb')](function(_0x1dd131){logger[_0x23de('0x12')](_0x23de('0x20'),_0x2d270a);logger['debug'](_0x23de('0x20'),_0x2d270a,JSON[_0x23de('0x1f')](_0x1dd131));_0xa3650d(_0x1dd131);})[_0x23de('0x15')](function(_0x2155b4){logger[_0x23de('0xf')](_0x23de('0x20'),_0x2155b4[_0x23de('0x11')],_0x2d270a);_0x3041d8(_0x40d7a7[_0x23de('0xf')](0x1f4,_0x2155b4[_0x23de('0x11')]));});});}; \ No newline at end of file +var _0xb958=['info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','debug','stringify','where','ShowZendeskAccount','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x274a80,_0x36b9f5){var _0x4150ab=function(_0x38433e){while(--_0x38433e){_0x274a80['push'](_0x274a80['shift']());}};_0x4150ab(++_0x36b9f5);}(_0xb958,0x1bb));var _0x8b95=function(_0x135704,_0x539aee){_0x135704=_0x135704-0x0;var _0x24e9fd=_0xb958[_0x135704];return _0x24e9fd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8b95('0x0'));var BPromise=require('bluebird');var rs=require(_0x8b95('0x1'));var fs=require('fs');var Redis=require(_0x8b95('0x2'));var db=require(_0x8b95('0x3'))['db'];var utils=require(_0x8b95('0x4'));var logger=require(_0x8b95('0x5'))(_0x8b95('0x6'));var config=require(_0x8b95('0x7'));var jayson=require(_0x8b95('0x8'));var client=jayson[_0x8b95('0x9')][_0x8b95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x412dfe,_0x5f5dbb,_0x1a58cc){return new BPromise(function(_0x153ccc,_0x4869d1){return client['request'](_0x412dfe,_0x1a58cc)[_0x8b95('0xb')](function(_0x47bd0d){logger[_0x8b95('0xc')](_0x8b95('0xd'),_0x5f5dbb,_0x8b95('0xe'));logger['debug'](_0x8b95('0xf'),_0x5f5dbb,_0x8b95('0xe'),JSON['stringify'](_0x47bd0d));if(_0x47bd0d[_0x8b95('0x10')]){if(_0x47bd0d[_0x8b95('0x10')][_0x8b95('0x11')]===0x1f4){logger[_0x8b95('0x10')](_0x8b95('0xd'),_0x5f5dbb,_0x47bd0d['error'][_0x8b95('0x12')]);return _0x4869d1(_0x47bd0d['error']['message']);}logger[_0x8b95('0x10')](_0x8b95('0xd'),_0x5f5dbb,_0x47bd0d[_0x8b95('0x10')]['message']);return _0x153ccc(_0x47bd0d[_0x8b95('0x10')][_0x8b95('0x12')]);}else{logger[_0x8b95('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x5f5dbb,'request\x20sent');_0x153ccc(_0x47bd0d[_0x8b95('0x13')][_0x8b95('0x12')]);}})[_0x8b95('0x14')](function(_0x1de921){logger['error'](_0x8b95('0xd'),_0x5f5dbb,_0x1de921);_0x4869d1(_0x1de921);});});}exports[_0x8b95('0x15')]=function(_0x4df1e4){var _0x79dbdd=this;return new Promise(function(_0x210ace,_0x1f3927){return db[_0x8b95('0x16')][_0x8b95('0x17')]({'raw':_0x4df1e4[_0x8b95('0x18')]?_0x4df1e4[_0x8b95('0x18')][_0x8b95('0x19')]===undefined?!![]:![]:!![],'where':_0x4df1e4[_0x8b95('0x18')]?_0x4df1e4[_0x8b95('0x18')]['where']||null:null,'attributes':_0x4df1e4[_0x8b95('0x18')]?_0x4df1e4[_0x8b95('0x18')][_0x8b95('0x1a')]||null:null,'limit':_0x4df1e4[_0x8b95('0x18')]?_0x4df1e4[_0x8b95('0x18')][_0x8b95('0x1b')]||null:null,'include':_0x4df1e4['options']?_0x4df1e4[_0x8b95('0x18')][_0x8b95('0x1c')]?_[_0x8b95('0x1d')](_0x4df1e4[_0x8b95('0x18')][_0x8b95('0x1c')],function(_0x508da6){return{'model':db[_0x508da6[_0x8b95('0x1e')]],'as':_0x508da6['as'],'attributes':_0x508da6[_0x8b95('0x1a')],'include':_0x508da6[_0x8b95('0x1c')]?_[_0x8b95('0x1d')](_0x508da6[_0x8b95('0x1c')],function(_0x224de3){return{'model':db[_0x224de3[_0x8b95('0x1e')]],'as':_0x224de3['as'],'attributes':_0x224de3['attributes'],'include':_0x224de3[_0x8b95('0x1c')]?_['map'](_0x224de3[_0x8b95('0x1c')],function(_0x243214){return{'model':db[_0x243214[_0x8b95('0x1e')]],'as':_0x243214['as'],'attributes':_0x243214[_0x8b95('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8b95('0xb')](function(_0x57cd60){logger[_0x8b95('0xc')](_0x8b95('0x15'),_0x4df1e4);logger[_0x8b95('0x1f')](_0x8b95('0x15'),_0x4df1e4,JSON[_0x8b95('0x20')](_0x57cd60));_0x210ace(_0x57cd60);})[_0x8b95('0x14')](function(_0x4dbc94){logger[_0x8b95('0x10')](_0x8b95('0x15'),_0x4dbc94[_0x8b95('0x12')],_0x4df1e4);_0x1f3927(_0x79dbdd[_0x8b95('0x10')](0x1f4,_0x4dbc94[_0x8b95('0x12')]));});});};exports['ShowZendeskAccount']=function(_0x4875a7){var _0x50ee52=this;return new Promise(function(_0x2cc87b,_0x38f200){return db['ZendeskAccount']['find']({'raw':_0x4875a7[_0x8b95('0x18')]?_0x4875a7[_0x8b95('0x18')][_0x8b95('0x19')]===undefined?!![]:![]:!![],'where':_0x4875a7[_0x8b95('0x18')]?_0x4875a7[_0x8b95('0x18')][_0x8b95('0x21')]||null:null,'attributes':_0x4875a7[_0x8b95('0x18')]?_0x4875a7['options'][_0x8b95('0x1a')]||null:null,'include':_0x4875a7[_0x8b95('0x18')]?_0x4875a7['options'][_0x8b95('0x1c')]?_[_0x8b95('0x1d')](_0x4875a7['options'][_0x8b95('0x1c')],function(_0x4db34d){return{'model':db[_0x4db34d[_0x8b95('0x1e')]],'as':_0x4db34d['as'],'attributes':_0x4db34d[_0x8b95('0x1a')],'include':_0x4db34d[_0x8b95('0x1c')]?_[_0x8b95('0x1d')](_0x4db34d['include'],function(_0x4b07da){return{'model':db[_0x4b07da[_0x8b95('0x1e')]],'as':_0x4b07da['as'],'attributes':_0x4b07da[_0x8b95('0x1a')],'include':_0x4b07da[_0x8b95('0x1c')]?_[_0x8b95('0x1d')](_0x4b07da[_0x8b95('0x1c')],function(_0x27aafc){return{'model':db[_0x27aafc[_0x8b95('0x1e')]],'as':_0x27aafc['as'],'attributes':_0x27aafc[_0x8b95('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59849f){logger[_0x8b95('0xc')](_0x8b95('0x22'),_0x4875a7);logger['debug']('ShowZendeskAccount',_0x4875a7,JSON[_0x8b95('0x20')](_0x59849f));_0x2cc87b(_0x59849f);})[_0x8b95('0x14')](function(_0x527996){logger[_0x8b95('0x10')](_0x8b95('0x22'),_0x527996[_0x8b95('0x12')],_0x4875a7);_0x38f200(_0x50ee52[_0x8b95('0x10')](0x1f4,_0x527996[_0x8b95('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 431420b..f8e3638 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x1605a5,_0x18902c){var _0x47f4fc=function(_0x4fe126){while(--_0x4fe126){_0x1605a5['push'](_0x1605a5['shift']());}};_0x47f4fc(++_0x18902c);}(_0xe706,0xa3));var _0x6e70=function(_0x58712a,_0x1d88a9){_0x58712a=_0x58712a-0x0;var _0x342032=_0xe706[_0x58712a];return _0x342032;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0xa')](_0x6e70('0x11'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0xa')](_0x6e70('0x13'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x6e70('0xa')](_0x6e70('0x14'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x15')]);router[_0x6e70('0x16')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x17')]);router[_0x6e70('0x16')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x6e70('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x6e70('0x19')]);router[_0x6e70('0x1a')]('/:id',auth[_0x6e70('0xb')](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xb10b=['getFields','/:id/subjects','/:id/descriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0x36a173,_0x7b7079){var _0x41039f=function(_0x158837){while(--_0x158837){_0x36a173['push'](_0x36a173['shift']());}};_0x41039f(++_0x7b7079);}(_0xb10b,0x12a));var _0xbb10=function(_0x413f2a,_0x1006e4){_0x413f2a=_0x413f2a-0x0;var _0x1932ec=_0xb10b[_0x413f2a];return _0x1932ec;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getDescriptions']);router[_0xbb10('0x9')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x12')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x12')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x15')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 3cb1532..7a6f0ab 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 _0xe43a=['exports','STRING','sequelize'];(function(_0xb7bfd5,_0x580334){var _0x5c6de7=function(_0x23651f){while(--_0x23651f){_0xb7bfd5['push'](_0xb7bfd5['shift']());}};_0x5c6de7(++_0x580334);}(_0xe43a,0x1c7));var _0xae43=function(_0x93397c,_0x14acc4){_0x93397c=_0x93397c-0x0;var _0x1330d1=_0xe43a[_0x93397c];return _0x1330d1;};'use strict';var Sequelize=require(_0xae43('0x0'));module[_0xae43('0x1')]={'name':{'type':Sequelize[_0xae43('0x2')]},'description':{'type':Sequelize[_0xae43('0x2')]}}; \ No newline at end of file +var _0x225a=['exports','STRING','sequelize'];(function(_0x1ffa94,_0x54e89d){var _0x12347d=function(_0xf5676d){while(--_0xf5676d){_0x1ffa94['push'](_0x1ffa94['shift']());}};_0x12347d(++_0x54e89d);}(_0x225a,0x15e));var _0xa225=function(_0x82f6bd,_0x2c3fd0){_0x82f6bd=_0x82f6bd-0x0;var _0x595e0a=_0x225a[_0x82f6bd];return _0x595e0a;};'use strict';var Sequelize=require(_0xa225('0x0'));module[_0xa225('0x1')]={'name':{'type':Sequelize[_0xa225('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 7f0b3ea..5575ae6 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 _0x70b3=['find','create','body','params','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','save','then','destroy','stack','name','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ZendeskConfiguration','findAll','rows','catch','show','length','includeAll','include'];(function(_0x3c5835,_0x2d1ba1){var _0x2a8ada=function(_0x10d737){while(--_0x10d737){_0x3c5835['push'](_0x3c5835['shift']());}};_0x2a8ada(++_0x2d1ba1);}(_0x70b3,0xf7));var _0x370b=function(_0x252441,_0x53e6dd){_0x252441=_0x252441-0x0;var _0x5a5fb5=_0x70b3[_0x252441];return _0x5a5fb5;};'use strict';var emlformat=require(_0x370b('0x0'));var rimraf=require(_0x370b('0x1'));var zipdir=require(_0x370b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x370b('0x3'));var moment=require(_0x370b('0x4'));var BPromise=require(_0x370b('0x5'));var Mustache=require(_0x370b('0x6'));var util=require(_0x370b('0x7'));var path=require('path');var sox=require(_0x370b('0x8'));var csv=require(_0x370b('0x9'));var ejs=require(_0x370b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x370b('0xb'));var squel=require(_0x370b('0xc'));var crypto=require('crypto');var jsforce=require(_0x370b('0xd'));var deskjs=require(_0x370b('0xe'));var toCsv=require(_0x370b('0x9'));var querystring=require(_0x370b('0xf'));var Papa=require(_0x370b('0x10'));var Redis=require(_0x370b('0x11'));var authService=require(_0x370b('0x12'));var qs=require(_0x370b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x370b('0x14'));var logger=require(_0x370b('0x15'))(_0x370b('0x16'));var utils=require(_0x370b('0x17'));var config=require(_0x370b('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d859e,_0x571f65){_0x571f65=_0x571f65||0xcc;return function(_0x18b0d9){if(_0x18b0d9){return _0x1d859e[_0x370b('0x19')](_0x571f65);}return _0x1d859e['status'](_0x571f65)[_0x370b('0x1a')]();};}function respondWithResult(_0x2cafbd,_0x37b6bf){_0x37b6bf=_0x37b6bf||0xc8;return function(_0x43b1d4){if(_0x43b1d4){return _0x2cafbd[_0x370b('0x1b')](_0x37b6bf)[_0x370b('0x1c')](_0x43b1d4);}};}function respondWithFilteredResult(_0xca3d77,_0x17006e){return function(_0x378ed7){if(_0x378ed7){var _0x34ce64=typeof _0x17006e[_0x370b('0x1d')]==='undefined'&&typeof _0x17006e[_0x370b('0x1e')]===_0x370b('0x1f');var _0x49563a=_0x378ed7[_0x370b('0x20')];var _0x5a7151=_0x34ce64?0x0:_0x17006e[_0x370b('0x1d')];var _0x4298d8=_0x34ce64?_0x378ed7['count']:_0x17006e[_0x370b('0x1d')]+_0x17006e[_0x370b('0x1e')];var _0xaf566a;if(_0x4298d8>=_0x49563a){_0x4298d8=_0x49563a;_0xaf566a=0xc8;}else{_0xaf566a=0xce;}_0xca3d77[_0x370b('0x1b')](_0xaf566a);return _0xca3d77[_0x370b('0x21')]('Content-Range',_0x5a7151+'-'+_0x4298d8+'/'+_0x49563a)[_0x370b('0x1c')](_0x378ed7);}return null;};}function patchUpdates(_0x44cde7){return function(_0x467eee){try{jsonpatch[_0x370b('0x22')](_0x467eee,_0x44cde7,!![]);}catch(_0x3c8e9c){return BPromise['reject'](_0x3c8e9c);}return _0x467eee[_0x370b('0x23')]();};}function saveUpdates(_0x53683e,_0x5d43bc){return function(_0x1e235d){if(_0x1e235d){return _0x1e235d['update'](_0x53683e)[_0x370b('0x24')](function(_0x3148ac){return _0x3148ac;});}return null;};}function removeEntity(_0x342bb4,_0x39c06d){return function(_0x38850b){if(_0x38850b){return _0x38850b[_0x370b('0x25')]()['then'](function(){_0x342bb4[_0x370b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa46968,_0x32eee9){return function(_0xe34d8b){if(!_0xe34d8b){_0xa46968[_0x370b('0x19')](0x194);}return _0xe34d8b;};}function handleError(_0x52c2ad,_0x3990e6){_0x3990e6=_0x3990e6||0x1f4;return function(_0x2663dd){logger['error'](_0x2663dd[_0x370b('0x26')]);if(_0x2663dd[_0x370b('0x27')]){delete _0x2663dd[_0x370b('0x27')];}_0x52c2ad[_0x370b('0x1b')](_0x3990e6)['send'](_0x2663dd);};}exports['index']=function(_0x43f041,_0x5af0be){var _0x3dca52={},_0x390fa9={},_0x41be76={'count':0x0,'rows':[]};var _0x23c830=_[_0x370b('0x28')](db['ZendeskConfiguration'][_0x370b('0x29')],function(_0x844bee){return{'name':_0x844bee[_0x370b('0x2a')],'type':_0x844bee['type']['key']};});_0x390fa9[_0x370b('0x2b')]=_[_0x370b('0x28')](_0x23c830,'name');_0x390fa9[_0x370b('0x2c')]=_[_0x370b('0x2d')](_0x43f041[_0x370b('0x2c')]);_0x390fa9[_0x370b('0x2e')]=_[_0x370b('0x2f')](_0x390fa9[_0x370b('0x2b')],_0x390fa9['query']);_0x3dca52[_0x370b('0x30')]=_[_0x370b('0x2f')](_0x390fa9['model'],qs['fields'](_0x43f041[_0x370b('0x2c')][_0x370b('0x31')]));_0x3dca52[_0x370b('0x30')]=_0x3dca52[_0x370b('0x30')]['length']?_0x3dca52[_0x370b('0x30')]:_0x390fa9[_0x370b('0x2b')];if(!_0x43f041[_0x370b('0x2c')][_0x370b('0x32')](_0x370b('0x33'))){_0x3dca52[_0x370b('0x1e')]=qs[_0x370b('0x1e')](_0x43f041[_0x370b('0x2c')][_0x370b('0x1e')]);_0x3dca52[_0x370b('0x1d')]=qs['offset'](_0x43f041[_0x370b('0x2c')][_0x370b('0x1d')]);}_0x3dca52[_0x370b('0x34')]=qs[_0x370b('0x35')](_0x43f041['query']['sort']);_0x3dca52[_0x370b('0x36')]=qs[_0x370b('0x2e')](_[_0x370b('0x37')](_0x43f041[_0x370b('0x2c')],_0x390fa9[_0x370b('0x2e')]),_0x23c830);if(_0x43f041[_0x370b('0x2c')][_0x370b('0x38')]){_0x3dca52['where']=_[_0x370b('0x39')](_0x3dca52[_0x370b('0x36')],{'$or':_[_0x370b('0x28')](_0x23c830,function(_0x989564){if(_0x989564[_0x370b('0x3a')]!==_0x370b('0x3b')){var _0x43a14e={};_0x43a14e[_0x989564[_0x370b('0x27')]]={'$like':'%'+_0x43f041[_0x370b('0x2c')][_0x370b('0x38')]+'%'};return _0x43a14e;}})});}_0x3dca52=_[_0x370b('0x39')]({},_0x3dca52,_0x43f041[_0x370b('0x3c')]);var _0x27e69a={'where':_0x3dca52[_0x370b('0x36')]};return db['ZendeskConfiguration'][_0x370b('0x20')](_0x27e69a)[_0x370b('0x24')](function(_0xa0759c){_0x41be76[_0x370b('0x20')]=_0xa0759c;if(_0x43f041[_0x370b('0x2c')]['includeAll']){_0x3dca52['include']=[{'all':!![]}];}return db[_0x370b('0x3d')][_0x370b('0x3e')](_0x3dca52);})[_0x370b('0x24')](function(_0x4cdb38){_0x41be76[_0x370b('0x3f')]=_0x4cdb38;return _0x41be76;})['then'](respondWithFilteredResult(_0x5af0be,_0x3dca52))[_0x370b('0x40')](handleError(_0x5af0be,null));};exports[_0x370b('0x41')]=function(_0x64b4bc,_0x52a1bd){var _0xc8ab77={'raw':![],'where':{'id':_0x64b4bc['params']['id']}},_0x276a63={};_0x276a63['model']=_[_0x370b('0x2d')](db['ZendeskConfiguration'][_0x370b('0x29')]);_0x276a63[_0x370b('0x2c')]=_[_0x370b('0x2d')](_0x64b4bc[_0x370b('0x2c')]);_0x276a63[_0x370b('0x2e')]=_[_0x370b('0x2f')](_0x276a63[_0x370b('0x2b')],_0x276a63[_0x370b('0x2c')]);_0xc8ab77[_0x370b('0x30')]=_['intersection'](_0x276a63[_0x370b('0x2b')],qs[_0x370b('0x31')](_0x64b4bc[_0x370b('0x2c')][_0x370b('0x31')]));_0xc8ab77['attributes']=_0xc8ab77['attributes'][_0x370b('0x42')]?_0xc8ab77['attributes']:_0x276a63['model'];if(_0x64b4bc[_0x370b('0x2c')][_0x370b('0x43')]){_0xc8ab77[_0x370b('0x44')]=[{'all':!![]}];}_0xc8ab77=_[_0x370b('0x39')]({},_0xc8ab77,_0x64b4bc[_0x370b('0x3c')]);return db[_0x370b('0x3d')][_0x370b('0x45')](_0xc8ab77)[_0x370b('0x24')](handleEntityNotFound(_0x52a1bd,null))[_0x370b('0x24')](respondWithResult(_0x52a1bd,null))['catch'](handleError(_0x52a1bd,null));};exports[_0x370b('0x46')]=function(_0x2dee9d,_0x87301a){return db[_0x370b('0x3d')][_0x370b('0x46')](_0x2dee9d[_0x370b('0x47')],{})['then'](respondWithResult(_0x87301a,0xc9))[_0x370b('0x40')](handleError(_0x87301a,null));};exports['update']=function(_0x32cce3,_0x263595){if(_0x32cce3[_0x370b('0x47')]['id']){delete _0x32cce3[_0x370b('0x47')]['id'];}return db[_0x370b('0x3d')]['find']({'where':{'id':_0x32cce3[_0x370b('0x48')]['id']}})[_0x370b('0x24')](handleEntityNotFound(_0x263595,null))[_0x370b('0x24')](saveUpdates(_0x32cce3['body'],null))[_0x370b('0x24')](respondWithResult(_0x263595,null))['catch'](handleError(_0x263595,null));};exports[_0x370b('0x25')]=function(_0x4ce14b,_0xf54139){return db[_0x370b('0x3d')]['find']({'where':{'id':_0x4ce14b[_0x370b('0x48')]['id']}})['then'](handleEntityNotFound(_0xf54139,null))[_0x370b('0x24')](removeEntity(_0xf54139,null))[_0x370b('0x40')](handleError(_0xf54139,null));};exports[_0x370b('0x49')]=function(_0x30bbb4,_0x1c686f,_0x174d77){var _0x58f5ac={};var _0x5a539d={};var _0x2192f8;var _0x26d631;return db[_0x370b('0x3d')][_0x370b('0x4a')]({'where':{'id':_0x30bbb4['params']['id']}})[_0x370b('0x24')](handleEntityNotFound(_0x1c686f,null))[_0x370b('0x24')](function(_0x30eb26){if(_0x30eb26){_0x2192f8=_0x30eb26;_0x5a539d[_0x370b('0x2b')]=_[_0x370b('0x2d')](db[_0x370b('0x4b')]['rawAttributes']);_0x5a539d[_0x370b('0x2c')]=_[_0x370b('0x2d')](_0x30bbb4[_0x370b('0x2c')]);_0x5a539d['filters']=_[_0x370b('0x2f')](_0x5a539d['model'],_0x5a539d['query']);_0x58f5ac['attributes']=_[_0x370b('0x2f')](_0x5a539d['model'],qs[_0x370b('0x31')](_0x30bbb4['query']['fields']));_0x58f5ac[_0x370b('0x30')]=_0x58f5ac[_0x370b('0x30')]['length']?_0x58f5ac[_0x370b('0x30')]:_0x5a539d['model'];_0x58f5ac['order']=qs[_0x370b('0x35')](_0x30bbb4[_0x370b('0x2c')][_0x370b('0x35')]);_0x58f5ac[_0x370b('0x36')]=qs[_0x370b('0x2e')](_[_0x370b('0x37')](_0x30bbb4[_0x370b('0x2c')],_0x5a539d[_0x370b('0x2e')]));if(_0x30bbb4[_0x370b('0x2c')][_0x370b('0x38')]){_0x58f5ac[_0x370b('0x36')]=_['merge'](_0x58f5ac[_0x370b('0x36')],{'$or':_[_0x370b('0x28')](_0x58f5ac[_0x370b('0x30')],function(_0x1aca5b){var _0x423728={};_0x423728[_0x1aca5b]={'$like':'%'+_0x30bbb4[_0x370b('0x2c')]['filter']+'%'};return _0x423728;})});}_0x58f5ac=_[_0x370b('0x39')]({},_0x58f5ac,_0x30bbb4[_0x370b('0x3c')]);return _0x2192f8[_0x370b('0x49')](_0x58f5ac);}})['then'](function(_0x48be57){if(_0x48be57){_0x26d631=_0x48be57[_0x370b('0x42')];if(!_0x30bbb4[_0x370b('0x2c')][_0x370b('0x32')](_0x370b('0x33'))){_0x58f5ac[_0x370b('0x1e')]=qs['limit'](_0x30bbb4[_0x370b('0x2c')][_0x370b('0x1e')]);_0x58f5ac['offset']=qs[_0x370b('0x1d')](_0x30bbb4['query']['offset']);}return _0x2192f8[_0x370b('0x49')](_0x58f5ac);}})[_0x370b('0x24')](function(_0x3406a2){if(_0x3406a2){return _0x3406a2?{'count':_0x26d631,'rows':_0x3406a2}:null;}})[_0x370b('0x24')](respondWithResult(_0x1c686f,null))[_0x370b('0x40')](handleError(_0x1c686f,null));};exports[_0x370b('0x4c')]=function(_0x382074,_0x561089,_0x296e46){var _0x4432bf={};var _0x4aa9c9={};var _0x470ffd;var _0x2a21ea;return db[_0x370b('0x3d')][_0x370b('0x4a')]({'where':{'id':_0x382074['params']['id']}})[_0x370b('0x24')](handleEntityNotFound(_0x561089,null))[_0x370b('0x24')](function(_0x2ccb13){if(_0x2ccb13){_0x470ffd=_0x2ccb13;_0x4aa9c9[_0x370b('0x2b')]=_[_0x370b('0x2d')](db[_0x370b('0x4b')][_0x370b('0x29')]);_0x4aa9c9['query']=_['keys'](_0x382074[_0x370b('0x2c')]);_0x4aa9c9[_0x370b('0x2e')]=_[_0x370b('0x2f')](_0x4aa9c9[_0x370b('0x2b')],_0x4aa9c9[_0x370b('0x2c')]);_0x4432bf['attributes']=_[_0x370b('0x2f')](_0x4aa9c9[_0x370b('0x2b')],qs[_0x370b('0x31')](_0x382074[_0x370b('0x2c')][_0x370b('0x31')]));_0x4432bf[_0x370b('0x30')]=_0x4432bf[_0x370b('0x30')][_0x370b('0x42')]?_0x4432bf[_0x370b('0x30')]:_0x4aa9c9[_0x370b('0x2b')];_0x4432bf['order']=qs['sort'](_0x382074[_0x370b('0x2c')][_0x370b('0x35')]);_0x4432bf['where']=qs[_0x370b('0x2e')](_[_0x370b('0x37')](_0x382074[_0x370b('0x2c')],_0x4aa9c9['filters']));if(_0x382074[_0x370b('0x2c')]['filter']){_0x4432bf[_0x370b('0x36')]=_[_0x370b('0x39')](_0x4432bf[_0x370b('0x36')],{'$or':_[_0x370b('0x28')](_0x4432bf[_0x370b('0x30')],function(_0x1018c2){var _0x23d7db={};_0x23d7db[_0x1018c2]={'$like':'%'+_0x382074[_0x370b('0x2c')][_0x370b('0x38')]+'%'};return _0x23d7db;})});}_0x4432bf=_[_0x370b('0x39')]({},_0x4432bf,_0x382074[_0x370b('0x3c')]);return _0x470ffd['getSubjects'](_0x4432bf);}})[_0x370b('0x24')](function(_0x4ffaa9){if(_0x4ffaa9){_0x2a21ea=_0x4ffaa9[_0x370b('0x42')];if(!_0x382074[_0x370b('0x2c')]['hasOwnProperty'](_0x370b('0x33'))){_0x4432bf[_0x370b('0x1e')]=qs[_0x370b('0x1e')](_0x382074[_0x370b('0x2c')][_0x370b('0x1e')]);_0x4432bf[_0x370b('0x1d')]=qs['offset'](_0x382074['query'][_0x370b('0x1d')]);}return _0x470ffd['getSubjects'](_0x4432bf);}})['then'](function(_0x4bf7fb){if(_0x4bf7fb){return _0x4bf7fb?{'count':_0x2a21ea,'rows':_0x4bf7fb}:null;}})['then'](respondWithResult(_0x561089,null))[_0x370b('0x40')](handleError(_0x561089,null));};exports[_0x370b('0x4d')]=function(_0x2a3c0a,_0x1c334f,_0x331a87){var _0x339051={};var _0x132d83={};var _0x585da4;var _0x4cbc13;return db[_0x370b('0x3d')][_0x370b('0x4a')]({'where':{'id':_0x2a3c0a[_0x370b('0x48')]['id']}})[_0x370b('0x24')](handleEntityNotFound(_0x1c334f,null))[_0x370b('0x24')](function(_0x58c29b){if(_0x58c29b){_0x585da4=_0x58c29b;_0x132d83[_0x370b('0x2b')]=_[_0x370b('0x2d')](db['ZendeskField'][_0x370b('0x29')]);_0x132d83[_0x370b('0x2c')]=_[_0x370b('0x2d')](_0x2a3c0a[_0x370b('0x2c')]);_0x132d83[_0x370b('0x2e')]=_['intersection'](_0x132d83['model'],_0x132d83[_0x370b('0x2c')]);_0x339051['attributes']=_[_0x370b('0x2f')](_0x132d83['model'],qs[_0x370b('0x31')](_0x2a3c0a[_0x370b('0x2c')][_0x370b('0x31')]));_0x339051['attributes']=_0x339051[_0x370b('0x30')][_0x370b('0x42')]?_0x339051[_0x370b('0x30')]:_0x132d83['model'];_0x339051[_0x370b('0x34')]=qs[_0x370b('0x35')](_0x2a3c0a[_0x370b('0x2c')][_0x370b('0x35')]);_0x339051[_0x370b('0x36')]=qs[_0x370b('0x2e')](_[_0x370b('0x37')](_0x2a3c0a['query'],_0x132d83['filters']));if(_0x2a3c0a[_0x370b('0x2c')][_0x370b('0x38')]){_0x339051[_0x370b('0x36')]=_[_0x370b('0x39')](_0x339051[_0x370b('0x36')],{'$or':_[_0x370b('0x28')](_0x339051[_0x370b('0x30')],function(_0x3a5b95){var _0x5ea614={};_0x5ea614[_0x3a5b95]={'$like':'%'+_0x2a3c0a[_0x370b('0x2c')][_0x370b('0x38')]+'%'};return _0x5ea614;})});}_0x339051=_[_0x370b('0x39')]({},_0x339051,_0x2a3c0a[_0x370b('0x3c')]);return _0x585da4['getDescriptions'](_0x339051);}})['then'](function(_0x40dd1a){if(_0x40dd1a){_0x4cbc13=_0x40dd1a['length'];if(!_0x2a3c0a[_0x370b('0x2c')][_0x370b('0x32')](_0x370b('0x33'))){_0x339051[_0x370b('0x1e')]=qs[_0x370b('0x1e')](_0x2a3c0a[_0x370b('0x2c')][_0x370b('0x1e')]);_0x339051[_0x370b('0x1d')]=qs[_0x370b('0x1d')](_0x2a3c0a[_0x370b('0x2c')][_0x370b('0x1d')]);}return _0x585da4[_0x370b('0x4d')](_0x339051);}})[_0x370b('0x24')](function(_0x4bfd8a){if(_0x4bfd8a){return _0x4bfd8a?{'count':_0x4cbc13,'rows':_0x4bfd8a}:null;}})[_0x370b('0x24')](respondWithResult(_0x1c334f,null))[_0x370b('0x40')](handleError(_0x1c334f,null));};exports['getTags']=function(_0x2ffd8a,_0x4f3542,_0x17cb5a){var _0x2cdf5b={};var _0x1139da={};var _0x29cb9d;var _0x4fffe5;return db[_0x370b('0x3d')][_0x370b('0x4a')]({'where':{'id':_0x2ffd8a[_0x370b('0x48')]['id']}})[_0x370b('0x24')](handleEntityNotFound(_0x4f3542,null))[_0x370b('0x24')](function(_0x18cbc7){if(_0x18cbc7){_0x29cb9d=_0x18cbc7;_0x1139da[_0x370b('0x2b')]=_[_0x370b('0x2d')](db['Tag'][_0x370b('0x29')]);_0x1139da[_0x370b('0x2c')]=_[_0x370b('0x2d')](_0x2ffd8a[_0x370b('0x2c')]);_0x1139da['filters']=_['intersection'](_0x1139da[_0x370b('0x2b')],_0x1139da[_0x370b('0x2c')]);_0x2cdf5b[_0x370b('0x30')]=_[_0x370b('0x2f')](_0x1139da[_0x370b('0x2b')],qs[_0x370b('0x31')](_0x2ffd8a[_0x370b('0x2c')][_0x370b('0x31')]));_0x2cdf5b[_0x370b('0x30')]=_0x2cdf5b[_0x370b('0x30')][_0x370b('0x42')]?_0x2cdf5b[_0x370b('0x30')]:_0x1139da[_0x370b('0x2b')];_0x2cdf5b[_0x370b('0x34')]=qs[_0x370b('0x35')](_0x2ffd8a[_0x370b('0x2c')][_0x370b('0x35')]);_0x2cdf5b[_0x370b('0x36')]=qs[_0x370b('0x2e')](_[_0x370b('0x37')](_0x2ffd8a[_0x370b('0x2c')],_0x1139da[_0x370b('0x2e')]));if(_0x2ffd8a[_0x370b('0x2c')]['filter']){_0x2cdf5b[_0x370b('0x36')]=_[_0x370b('0x39')](_0x2cdf5b[_0x370b('0x36')],{'$or':_[_0x370b('0x28')](_0x2cdf5b[_0x370b('0x30')],function(_0x50df27){var _0x109293={};_0x109293[_0x50df27]={'$like':'%'+_0x2ffd8a[_0x370b('0x2c')][_0x370b('0x38')]+'%'};return _0x109293;})});}_0x2cdf5b=_[_0x370b('0x39')]({},_0x2cdf5b,_0x2ffd8a['options']);return _0x29cb9d[_0x370b('0x4e')](_0x2cdf5b);}})['then'](function(_0x1b107f){if(_0x1b107f){_0x4fffe5=_0x1b107f[_0x370b('0x42')];if(!_0x2ffd8a['query'][_0x370b('0x32')](_0x370b('0x33'))){_0x2cdf5b[_0x370b('0x1e')]=qs[_0x370b('0x1e')](_0x2ffd8a[_0x370b('0x2c')][_0x370b('0x1e')]);_0x2cdf5b[_0x370b('0x1d')]=qs[_0x370b('0x1d')](_0x2ffd8a[_0x370b('0x2c')][_0x370b('0x1d')]);}return _0x29cb9d[_0x370b('0x4e')](_0x2cdf5b);}})[_0x370b('0x24')](function(_0x57013d){if(_0x57013d){return _0x57013d?{'count':_0x4fffe5,'rows':_0x57013d}:null;}})[_0x370b('0x24')](respondWithResult(_0x4f3542,null))[_0x370b('0x40')](handleError(_0x4f3542,null));};exports['setTags']=function(_0x53f96f,_0x20ef61,_0x54c04b){if(_0x53f96f[_0x370b('0x47')]['id']){delete _0x53f96f[_0x370b('0x47')]['id'];}return db[_0x370b('0x3d')]['findOne']({'where':{'id':_0x53f96f[_0x370b('0x48')]['id']}})[_0x370b('0x24')](handleEntityNotFound(_0x20ef61,null))['then'](function(_0x3383a6){if(_0x3383a6){return _0x3383a6['setTags'](_0x53f96f[_0x370b('0x47')]['ids']||[]);}return null;})[_0x370b('0x24')](respondWithResult(_0x20ef61,null))[_0x370b('0x40')](handleError(_0x20ef61,null));}; \ No newline at end of file +var _0xe49c=['../../mysqldb','status','end','json','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','create','body','getFields','findOne','ZendeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x1a237a,_0x4b30f6){var _0xa23732=function(_0x55870a){while(--_0x55870a){_0x1a237a['push'](_0x1a237a['shift']());}};_0xa23732(++_0x4b30f6);}(_0xe49c,0x137));var _0xce49=function(_0x540687,_0x1f5277){_0x540687=_0x540687-0x0;var _0x53e71a=_0xe49c[_0x540687];return _0x53e71a;};'use strict';var emlformat=require(_0xce49('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce49('0x1'));var jsonpatch=require(_0xce49('0x2'));var rp=require(_0xce49('0x3'));var moment=require(_0xce49('0x4'));var BPromise=require(_0xce49('0x5'));var Mustache=require(_0xce49('0x6'));var util=require(_0xce49('0x7'));var path=require(_0xce49('0x8'));var sox=require(_0xce49('0x9'));var csv=require('to-csv');var ejs=require(_0xce49('0xa'));var fs=require('fs');var fs_extra=require(_0xce49('0xb'));var _=require(_0xce49('0xc'));var squel=require('squel');var crypto=require(_0xce49('0xd'));var jsforce=require(_0xce49('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xce49('0xf'));var querystring=require('querystring');var Papa=require(_0xce49('0x10'));var Redis=require(_0xce49('0x11'));var authService=require(_0xce49('0x12'));var qs=require(_0xce49('0x13'));var as=require(_0xce49('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce49('0x15'))('api');var utils=require(_0xce49('0x16'));var config=require(_0xce49('0x17'));var licenseUtil=require(_0xce49('0x18'));var db=require(_0xce49('0x19'))['db'];function respondWithStatusCode(_0x5a743e,_0x2ec35b){_0x2ec35b=_0x2ec35b||0xcc;return function(_0x44a340){if(_0x44a340){return _0x5a743e['sendStatus'](_0x2ec35b);}return _0x5a743e[_0xce49('0x1a')](_0x2ec35b)[_0xce49('0x1b')]();};}function respondWithResult(_0x15e34b,_0x5c6ef4){_0x5c6ef4=_0x5c6ef4||0xc8;return function(_0x207b21){if(_0x207b21){return _0x15e34b['status'](_0x5c6ef4)[_0xce49('0x1c')](_0x207b21);}};}function respondWithFilteredResult(_0x166cd4,_0x3654c5){return function(_0xdf266c){if(_0xdf266c){var _0x54b107=typeof _0x3654c5['offset']===_0xce49('0x1d')&&typeof _0x3654c5['limit']===_0xce49('0x1d');var _0x3344db=_0xdf266c[_0xce49('0x1e')];var _0x391525=_0x54b107?0x0:_0x3654c5[_0xce49('0x1f')];var _0x4fd7d1=_0x54b107?_0xdf266c[_0xce49('0x1e')]:_0x3654c5['offset']+_0x3654c5['limit'];var _0x2b8c98;if(_0x4fd7d1>=_0x3344db){_0x4fd7d1=_0x3344db;_0x2b8c98=0xc8;}else{_0x2b8c98=0xce;}_0x166cd4[_0xce49('0x1a')](_0x2b8c98);return _0x166cd4[_0xce49('0x20')](_0xce49('0x21'),_0x391525+'-'+_0x4fd7d1+'/'+_0x3344db)['json'](_0xdf266c);}return null;};}function patchUpdates(_0x39a594){return function(_0x1f449e){try{jsonpatch[_0xce49('0x22')](_0x1f449e,_0x39a594,!![]);}catch(_0x2e3984){return BPromise['reject'](_0x2e3984);}return _0x1f449e[_0xce49('0x23')]();};}function saveUpdates(_0x9b61d7,_0x4f0429){return function(_0x3b70bd){if(_0x3b70bd){return _0x3b70bd[_0xce49('0x24')](_0x9b61d7)[_0xce49('0x25')](function(_0x4b6e83){return _0x4b6e83;});}return null;};}function removeEntity(_0x546508,_0x217c46){return function(_0x55d710){if(_0x55d710){return _0x55d710[_0xce49('0x26')]()[_0xce49('0x25')](function(){_0x546508[_0xce49('0x1a')](0xcc)[_0xce49('0x1b')]();});}};}function handleEntityNotFound(_0x5149db,_0x2e8a3b){return function(_0x58bbc9){if(!_0x58bbc9){_0x5149db[_0xce49('0x27')](0x194);}return _0x58bbc9;};}function handleError(_0x5417d5,_0x1a3d92){_0x1a3d92=_0x1a3d92||0x1f4;return function(_0x182dec){logger[_0xce49('0x28')](_0x182dec[_0xce49('0x29')]);if(_0x182dec[_0xce49('0x2a')]){delete _0x182dec[_0xce49('0x2a')];}_0x5417d5[_0xce49('0x1a')](_0x1a3d92)['send'](_0x182dec);};}exports[_0xce49('0x2b')]=function(_0x2d32cd,_0x25ed0c){var _0x2cf391={},_0x3b1eb6={},_0x34120e={'count':0x0,'rows':[]};var _0x36a321=_[_0xce49('0x2c')](db[_0xce49('0x2d')][_0xce49('0x2e')],function(_0x4c8694){return{'name':_0x4c8694[_0xce49('0x2f')],'type':_0x4c8694[_0xce49('0x30')]['key']};});_0x3b1eb6['model']=_[_0xce49('0x2c')](_0x36a321,_0xce49('0x2a'));_0x3b1eb6[_0xce49('0x31')]=_['keys'](_0x2d32cd['query']);_0x3b1eb6[_0xce49('0x32')]=_['intersection'](_0x3b1eb6[_0xce49('0x33')],_0x3b1eb6[_0xce49('0x31')]);_0x2cf391['attributes']=_[_0xce49('0x34')](_0x3b1eb6[_0xce49('0x33')],qs[_0xce49('0x35')](_0x2d32cd[_0xce49('0x31')]['fields']));_0x2cf391[_0xce49('0x36')]=_0x2cf391[_0xce49('0x36')][_0xce49('0x37')]?_0x2cf391[_0xce49('0x36')]:_0x3b1eb6['model'];if(!_0x2d32cd['query'][_0xce49('0x38')]('nolimit')){_0x2cf391[_0xce49('0x39')]=qs[_0xce49('0x39')](_0x2d32cd[_0xce49('0x31')]['limit']);_0x2cf391[_0xce49('0x1f')]=qs[_0xce49('0x1f')](_0x2d32cd[_0xce49('0x31')]['offset']);}_0x2cf391[_0xce49('0x3a')]=qs[_0xce49('0x3b')](_0x2d32cd[_0xce49('0x31')][_0xce49('0x3b')]);_0x2cf391['where']=qs[_0xce49('0x32')](_[_0xce49('0x3c')](_0x2d32cd[_0xce49('0x31')],_0x3b1eb6['filters']),_0x36a321);if(_0x2d32cd[_0xce49('0x31')][_0xce49('0x3d')]){_0x2cf391[_0xce49('0x3e')]=_[_0xce49('0x3f')](_0x2cf391['where'],{'$or':_[_0xce49('0x2c')](_0x36a321,function(_0x36b26d){if(_0x36b26d['type']!==_0xce49('0x40')){var _0x8454d3={};_0x8454d3[_0x36b26d[_0xce49('0x2a')]]={'$like':'%'+_0x2d32cd[_0xce49('0x31')][_0xce49('0x3d')]+'%'};return _0x8454d3;}})});}_0x2cf391=_['merge']({},_0x2cf391,_0x2d32cd[_0xce49('0x41')]);var _0xbabba4={'where':_0x2cf391[_0xce49('0x3e')]};return db['ZendeskConfiguration'][_0xce49('0x1e')](_0xbabba4)[_0xce49('0x25')](function(_0x1ea433){_0x34120e['count']=_0x1ea433;if(_0x2d32cd['query'][_0xce49('0x42')]){_0x2cf391[_0xce49('0x43')]=[{'all':!![]}];}return db[_0xce49('0x2d')][_0xce49('0x44')](_0x2cf391);})[_0xce49('0x25')](function(_0x2ebe2a){_0x34120e['rows']=_0x2ebe2a;return _0x34120e;})['then'](respondWithFilteredResult(_0x25ed0c,_0x2cf391))[_0xce49('0x45')](handleError(_0x25ed0c,null));};exports['show']=function(_0x1d5d48,_0x124cd0){var _0x1a31d7={'raw':![],'where':{'id':_0x1d5d48[_0xce49('0x46')]['id']}},_0x3758b5={};_0x3758b5[_0xce49('0x33')]=_[_0xce49('0x47')](db['ZendeskConfiguration']['rawAttributes']);_0x3758b5[_0xce49('0x31')]=_[_0xce49('0x47')](_0x1d5d48[_0xce49('0x31')]);_0x3758b5[_0xce49('0x32')]=_[_0xce49('0x34')](_0x3758b5[_0xce49('0x33')],_0x3758b5['query']);_0x1a31d7[_0xce49('0x36')]=_[_0xce49('0x34')](_0x3758b5[_0xce49('0x33')],qs[_0xce49('0x35')](_0x1d5d48[_0xce49('0x31')][_0xce49('0x35')]));_0x1a31d7[_0xce49('0x36')]=_0x1a31d7[_0xce49('0x36')][_0xce49('0x37')]?_0x1a31d7[_0xce49('0x36')]:_0x3758b5[_0xce49('0x33')];if(_0x1d5d48[_0xce49('0x31')]['includeAll']){_0x1a31d7[_0xce49('0x43')]=[{'all':!![]}];}_0x1a31d7=_[_0xce49('0x3f')]({},_0x1a31d7,_0x1d5d48['options']);return db[_0xce49('0x2d')][_0xce49('0x48')](_0x1a31d7)[_0xce49('0x25')](handleEntityNotFound(_0x124cd0,null))['then'](respondWithResult(_0x124cd0,null))['catch'](handleError(_0x124cd0,null));};exports[_0xce49('0x49')]=function(_0x1e16f8,_0x2c4dbf){return db['ZendeskConfiguration'][_0xce49('0x49')](_0x1e16f8['body'],{})[_0xce49('0x25')](respondWithResult(_0x2c4dbf,0xc9))[_0xce49('0x45')](handleError(_0x2c4dbf,null));};exports[_0xce49('0x24')]=function(_0x33fd76,_0x420237){if(_0x33fd76['body']['id']){delete _0x33fd76[_0xce49('0x4a')]['id'];}return db[_0xce49('0x2d')][_0xce49('0x48')]({'where':{'id':_0x33fd76[_0xce49('0x46')]['id']}})[_0xce49('0x25')](handleEntityNotFound(_0x420237,null))[_0xce49('0x25')](saveUpdates(_0x33fd76[_0xce49('0x4a')],null))[_0xce49('0x25')](respondWithResult(_0x420237,null))[_0xce49('0x45')](handleError(_0x420237,null));};exports['destroy']=function(_0xc8867d,_0x14cf3f){return db[_0xce49('0x2d')][_0xce49('0x48')]({'where':{'id':_0xc8867d[_0xce49('0x46')]['id']}})[_0xce49('0x25')](handleEntityNotFound(_0x14cf3f,null))[_0xce49('0x25')](removeEntity(_0x14cf3f,null))[_0xce49('0x45')](handleError(_0x14cf3f,null));};exports[_0xce49('0x4b')]=function(_0x55c2b9,_0x334136,_0x1528b9){var _0x154824={};var _0x423d7f={};var _0x203bfd;var _0x50f3b3;return db[_0xce49('0x2d')][_0xce49('0x4c')]({'where':{'id':_0x55c2b9['params']['id']}})[_0xce49('0x25')](handleEntityNotFound(_0x334136,null))[_0xce49('0x25')](function(_0x42a114){if(_0x42a114){_0x203bfd=_0x42a114;_0x423d7f[_0xce49('0x33')]=_['keys'](db[_0xce49('0x4d')][_0xce49('0x2e')]);_0x423d7f[_0xce49('0x31')]=_[_0xce49('0x47')](_0x55c2b9[_0xce49('0x31')]);_0x423d7f['filters']=_[_0xce49('0x34')](_0x423d7f[_0xce49('0x33')],_0x423d7f['query']);_0x154824['attributes']=_['intersection'](_0x423d7f[_0xce49('0x33')],qs[_0xce49('0x35')](_0x55c2b9['query']['fields']));_0x154824[_0xce49('0x36')]=_0x154824[_0xce49('0x36')][_0xce49('0x37')]?_0x154824[_0xce49('0x36')]:_0x423d7f[_0xce49('0x33')];_0x154824[_0xce49('0x3a')]=qs[_0xce49('0x3b')](_0x55c2b9[_0xce49('0x31')][_0xce49('0x3b')]);_0x154824[_0xce49('0x3e')]=qs[_0xce49('0x32')](_['pick'](_0x55c2b9[_0xce49('0x31')],_0x423d7f[_0xce49('0x32')]));if(_0x55c2b9[_0xce49('0x31')]['filter']){_0x154824[_0xce49('0x3e')]=_[_0xce49('0x3f')](_0x154824[_0xce49('0x3e')],{'$or':_[_0xce49('0x2c')](_0x154824[_0xce49('0x36')],function(_0x431180){var _0x228fae={};_0x228fae[_0x431180]={'$like':'%'+_0x55c2b9[_0xce49('0x31')][_0xce49('0x3d')]+'%'};return _0x228fae;})});}_0x154824=_['merge']({},_0x154824,_0x55c2b9['options']);return _0x203bfd['getFields'](_0x154824);}})['then'](function(_0x318a6b){if(_0x318a6b){_0x50f3b3=_0x318a6b['length'];if(!_0x55c2b9[_0xce49('0x31')][_0xce49('0x38')](_0xce49('0x4e'))){_0x154824[_0xce49('0x39')]=qs['limit'](_0x55c2b9[_0xce49('0x31')][_0xce49('0x39')]);_0x154824['offset']=qs[_0xce49('0x1f')](_0x55c2b9[_0xce49('0x31')][_0xce49('0x1f')]);}return _0x203bfd['getFields'](_0x154824);}})['then'](function(_0x29a966){if(_0x29a966){return _0x29a966?{'count':_0x50f3b3,'rows':_0x29a966}:null;}})[_0xce49('0x25')](respondWithResult(_0x334136,null))[_0xce49('0x45')](handleError(_0x334136,null));};exports[_0xce49('0x4f')]=function(_0x231e35,_0x3b93a0,_0x505653){var _0x22a655={};var _0x505d10={};var _0x15dd8a;var _0x3fd9f9;return db[_0xce49('0x2d')][_0xce49('0x4c')]({'where':{'id':_0x231e35[_0xce49('0x46')]['id']}})[_0xce49('0x25')](handleEntityNotFound(_0x3b93a0,null))[_0xce49('0x25')](function(_0xec6baa){if(_0xec6baa){_0x15dd8a=_0xec6baa;_0x505d10[_0xce49('0x33')]=_[_0xce49('0x47')](db['ZendeskField'][_0xce49('0x2e')]);_0x505d10[_0xce49('0x31')]=_[_0xce49('0x47')](_0x231e35['query']);_0x505d10['filters']=_[_0xce49('0x34')](_0x505d10[_0xce49('0x33')],_0x505d10[_0xce49('0x31')]);_0x22a655[_0xce49('0x36')]=_[_0xce49('0x34')](_0x505d10[_0xce49('0x33')],qs[_0xce49('0x35')](_0x231e35[_0xce49('0x31')][_0xce49('0x35')]));_0x22a655[_0xce49('0x36')]=_0x22a655[_0xce49('0x36')][_0xce49('0x37')]?_0x22a655['attributes']:_0x505d10[_0xce49('0x33')];_0x22a655[_0xce49('0x3a')]=qs[_0xce49('0x3b')](_0x231e35[_0xce49('0x31')][_0xce49('0x3b')]);_0x22a655[_0xce49('0x3e')]=qs['filters'](_[_0xce49('0x3c')](_0x231e35[_0xce49('0x31')],_0x505d10['filters']));if(_0x231e35[_0xce49('0x31')][_0xce49('0x3d')]){_0x22a655[_0xce49('0x3e')]=_[_0xce49('0x3f')](_0x22a655[_0xce49('0x3e')],{'$or':_[_0xce49('0x2c')](_0x22a655[_0xce49('0x36')],function(_0xad204){var _0x38b454={};_0x38b454[_0xad204]={'$like':'%'+_0x231e35['query'][_0xce49('0x3d')]+'%'};return _0x38b454;})});}_0x22a655=_['merge']({},_0x22a655,_0x231e35[_0xce49('0x41')]);return _0x15dd8a[_0xce49('0x4f')](_0x22a655);}})['then'](function(_0x28edcd){if(_0x28edcd){_0x3fd9f9=_0x28edcd[_0xce49('0x37')];if(!_0x231e35[_0xce49('0x31')][_0xce49('0x38')](_0xce49('0x4e'))){_0x22a655[_0xce49('0x39')]=qs[_0xce49('0x39')](_0x231e35['query'][_0xce49('0x39')]);_0x22a655[_0xce49('0x1f')]=qs[_0xce49('0x1f')](_0x231e35[_0xce49('0x31')]['offset']);}return _0x15dd8a[_0xce49('0x4f')](_0x22a655);}})[_0xce49('0x25')](function(_0x2e39e4){if(_0x2e39e4){return _0x2e39e4?{'count':_0x3fd9f9,'rows':_0x2e39e4}:null;}})[_0xce49('0x25')](respondWithResult(_0x3b93a0,null))[_0xce49('0x45')](handleError(_0x3b93a0,null));};exports[_0xce49('0x50')]=function(_0x5ba2d2,_0x3d7a88,_0x18ef40){var _0x34a68c={};var _0x27ff81={};var _0x1830b3;var _0x39b0fe;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x5ba2d2[_0xce49('0x46')]['id']}})[_0xce49('0x25')](handleEntityNotFound(_0x3d7a88,null))[_0xce49('0x25')](function(_0x335bde){if(_0x335bde){_0x1830b3=_0x335bde;_0x27ff81[_0xce49('0x33')]=_[_0xce49('0x47')](db[_0xce49('0x4d')]['rawAttributes']);_0x27ff81[_0xce49('0x31')]=_[_0xce49('0x47')](_0x5ba2d2[_0xce49('0x31')]);_0x27ff81[_0xce49('0x32')]=_[_0xce49('0x34')](_0x27ff81['model'],_0x27ff81[_0xce49('0x31')]);_0x34a68c[_0xce49('0x36')]=_['intersection'](_0x27ff81['model'],qs[_0xce49('0x35')](_0x5ba2d2[_0xce49('0x31')][_0xce49('0x35')]));_0x34a68c['attributes']=_0x34a68c[_0xce49('0x36')][_0xce49('0x37')]?_0x34a68c['attributes']:_0x27ff81[_0xce49('0x33')];_0x34a68c[_0xce49('0x3a')]=qs[_0xce49('0x3b')](_0x5ba2d2[_0xce49('0x31')][_0xce49('0x3b')]);_0x34a68c['where']=qs['filters'](_[_0xce49('0x3c')](_0x5ba2d2[_0xce49('0x31')],_0x27ff81[_0xce49('0x32')]));if(_0x5ba2d2[_0xce49('0x31')][_0xce49('0x3d')]){_0x34a68c[_0xce49('0x3e')]=_[_0xce49('0x3f')](_0x34a68c[_0xce49('0x3e')],{'$or':_[_0xce49('0x2c')](_0x34a68c[_0xce49('0x36')],function(_0x20cf1d){var _0x2146a9={};_0x2146a9[_0x20cf1d]={'$like':'%'+_0x5ba2d2[_0xce49('0x31')][_0xce49('0x3d')]+'%'};return _0x2146a9;})});}_0x34a68c=_[_0xce49('0x3f')]({},_0x34a68c,_0x5ba2d2['options']);return _0x1830b3['getDescriptions'](_0x34a68c);}})[_0xce49('0x25')](function(_0x14173d){if(_0x14173d){_0x39b0fe=_0x14173d[_0xce49('0x37')];if(!_0x5ba2d2[_0xce49('0x31')]['hasOwnProperty'](_0xce49('0x4e'))){_0x34a68c[_0xce49('0x39')]=qs[_0xce49('0x39')](_0x5ba2d2[_0xce49('0x31')][_0xce49('0x39')]);_0x34a68c[_0xce49('0x1f')]=qs[_0xce49('0x1f')](_0x5ba2d2['query'][_0xce49('0x1f')]);}return _0x1830b3[_0xce49('0x50')](_0x34a68c);}})[_0xce49('0x25')](function(_0x1d3214){if(_0x1d3214){return _0x1d3214?{'count':_0x39b0fe,'rows':_0x1d3214}:null;}})[_0xce49('0x25')](respondWithResult(_0x3d7a88,null))['catch'](handleError(_0x3d7a88,null));};exports[_0xce49('0x51')]=function(_0x42025c,_0xeb166e,_0x225191){var _0x1ff2b3={};var _0x17fee2={};var _0x101bda;var _0x4f869f;return db[_0xce49('0x2d')][_0xce49('0x4c')]({'where':{'id':_0x42025c[_0xce49('0x46')]['id']}})[_0xce49('0x25')](handleEntityNotFound(_0xeb166e,null))['then'](function(_0x337752){if(_0x337752){_0x101bda=_0x337752;_0x17fee2[_0xce49('0x33')]=_['keys'](db[_0xce49('0x52')][_0xce49('0x2e')]);_0x17fee2[_0xce49('0x31')]=_[_0xce49('0x47')](_0x42025c['query']);_0x17fee2['filters']=_[_0xce49('0x34')](_0x17fee2['model'],_0x17fee2[_0xce49('0x31')]);_0x1ff2b3[_0xce49('0x36')]=_[_0xce49('0x34')](_0x17fee2[_0xce49('0x33')],qs['fields'](_0x42025c[_0xce49('0x31')]['fields']));_0x1ff2b3[_0xce49('0x36')]=_0x1ff2b3[_0xce49('0x36')]['length']?_0x1ff2b3['attributes']:_0x17fee2[_0xce49('0x33')];_0x1ff2b3[_0xce49('0x3a')]=qs[_0xce49('0x3b')](_0x42025c[_0xce49('0x31')]['sort']);_0x1ff2b3['where']=qs['filters'](_[_0xce49('0x3c')](_0x42025c[_0xce49('0x31')],_0x17fee2[_0xce49('0x32')]));if(_0x42025c['query'][_0xce49('0x3d')]){_0x1ff2b3[_0xce49('0x3e')]=_['merge'](_0x1ff2b3[_0xce49('0x3e')],{'$or':_['map'](_0x1ff2b3[_0xce49('0x36')],function(_0x334f3a){var _0x13c7a6={};_0x13c7a6[_0x334f3a]={'$like':'%'+_0x42025c['query'][_0xce49('0x3d')]+'%'};return _0x13c7a6;})});}_0x1ff2b3=_[_0xce49('0x3f')]({},_0x1ff2b3,_0x42025c[_0xce49('0x41')]);return _0x101bda[_0xce49('0x51')](_0x1ff2b3);}})[_0xce49('0x25')](function(_0x4062d8){if(_0x4062d8){_0x4f869f=_0x4062d8[_0xce49('0x37')];if(!_0x42025c[_0xce49('0x31')][_0xce49('0x38')](_0xce49('0x4e'))){_0x1ff2b3[_0xce49('0x39')]=qs[_0xce49('0x39')](_0x42025c[_0xce49('0x31')]['limit']);_0x1ff2b3[_0xce49('0x1f')]=qs['offset'](_0x42025c[_0xce49('0x31')][_0xce49('0x1f')]);}return _0x101bda[_0xce49('0x51')](_0x1ff2b3);}})[_0xce49('0x25')](function(_0x3f7418){if(_0x3f7418){return _0x3f7418?{'count':_0x4f869f,'rows':_0x3f7418}:null;}})[_0xce49('0x25')](respondWithResult(_0xeb166e,null))[_0xce49('0x45')](handleError(_0xeb166e,null));};exports[_0xce49('0x53')]=function(_0xd5b3f8,_0x43b7f2,_0x2ce3b7){if(_0xd5b3f8[_0xce49('0x4a')]['id']){delete _0xd5b3f8[_0xce49('0x4a')]['id'];}return db[_0xce49('0x2d')][_0xce49('0x4c')]({'where':{'id':_0xd5b3f8[_0xce49('0x46')]['id']}})[_0xce49('0x25')](handleEntityNotFound(_0x43b7f2,null))[_0xce49('0x25')](function(_0x174e43){if(_0x174e43){return _0x174e43[_0xce49('0x53')](_0xd5b3f8[_0xce49('0x4a')]['ids']||[]);}return null;})[_0xce49('0x25')](respondWithResult(_0x43b7f2,null))[_0xce49('0x45')](handleError(_0x43b7f2,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 8690aa2..11e69b8 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 _0xd824=['rimraf','../../config/environment','ZendeskConfiguration','int_zendesk_configurations','lodash','util','moment','bluebird','request-promise','path'];(function(_0x2f437e,_0x203865){var _0x5a3395=function(_0x5a3a66){while(--_0x5a3a66){_0x2f437e['push'](_0x2f437e['shift']());}};_0x5a3395(++_0x203865);}(_0xd824,0xc2));var _0x4d82=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd824[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4d82('0x2'));var BPromise=require(_0x4d82('0x3'));var rp=require(_0x4d82('0x4'));var fs=require('fs');var path=require(_0x4d82('0x5'));var rimraf=require(_0x4d82('0x6'));var config=require(_0x4d82('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0xd00023,_0x583c7c){return _0xd00023['define'](_0x4d82('0x8'),attributes,{'tableName':_0x4d82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','../../config/logger'];(function(_0x386b69,_0x5d9360){var _0x476415=function(_0x49fd60){while(--_0x49fd60){_0x386b69['push'](_0x386b69['shift']());}};_0x476415(++_0x5d9360);}(_0xb10b,0x12a));var _0xbb10=function(_0x56d78c,_0x2b65d6){_0x56d78c=_0x56d78c-0x0;var _0x9a8155=_0xb10b[_0x56d78c];return _0x9a8155;};'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')]('ZendeskConfiguration',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index d647737..6eef613 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 _0x4e20=['info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','code','error','ZendeskConfiguration,\x20%s,\x20%s','message'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x4e20,0x1d1));var _0x04e2=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0x4e20[_0x38c632];return _0x12737e;};'use strict';var _=require(_0x04e2('0x0'));var util=require(_0x04e2('0x1'));var moment=require(_0x04e2('0x2'));var BPromise=require('bluebird');var rs=require(_0x04e2('0x3'));var fs=require('fs');var Redis=require(_0x04e2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x04e2('0x5'));var logger=require(_0x04e2('0x6'))(_0x04e2('0x7'));var config=require(_0x04e2('0x8'));var jayson=require(_0x04e2('0x9'));var client=jayson['client'][_0x04e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dc8e8,_0x2edcd5,_0x356941){return new BPromise(function(_0x43e81f,_0x53d62a){return client[_0x04e2('0xb')](_0x1dc8e8,_0x356941)['then'](function(_0x2c2813){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x2edcd5,_0x04e2('0xc'));logger[_0x04e2('0xd')](_0x04e2('0xe'),_0x2edcd5,'request\x20sent',JSON['stringify'](_0x2c2813));if(_0x2c2813['error']){if(_0x2c2813['error'][_0x04e2('0xf')]===0x1f4){logger[_0x04e2('0x10')](_0x04e2('0x11'),_0x2edcd5,_0x2c2813[_0x04e2('0x10')][_0x04e2('0x12')]);return _0x53d62a(_0x2c2813[_0x04e2('0x10')][_0x04e2('0x12')]);}logger[_0x04e2('0x10')](_0x04e2('0x11'),_0x2edcd5,_0x2c2813['error'][_0x04e2('0x12')]);return _0x43e81f(_0x2c2813[_0x04e2('0x10')][_0x04e2('0x12')]);}else{logger[_0x04e2('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2edcd5,_0x04e2('0xc'));_0x43e81f(_0x2c2813[_0x04e2('0x14')][_0x04e2('0x12')]);}})[_0x04e2('0x15')](function(_0x2e35db){logger[_0x04e2('0x10')](_0x04e2('0x11'),_0x2edcd5,_0x2e35db);_0x53d62a(_0x2e35db);});});} \ No newline at end of file +var _0x2e76=['ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x418f04,_0x27b8e0){var _0x1849da=function(_0x4faca1){while(--_0x4faca1){_0x418f04['push'](_0x418f04['shift']());}};_0x1849da(++_0x27b8e0);}(_0x2e76,0x1e1));var _0x62e7=function(_0x2631cf,_0x54f27e){_0x2631cf=_0x2631cf-0x0;var _0x5a9bf6=_0x2e76[_0x2631cf];return _0x5a9bf6;};'use strict';var _=require(_0x62e7('0x0'));var util=require(_0x62e7('0x1'));var moment=require('moment');var BPromise=require(_0x62e7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62e7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x62e7('0x4'));var logger=require(_0x62e7('0x5'))('rpc');var config=require(_0x62e7('0x6'));var jayson=require(_0x62e7('0x7'));var client=jayson['client'][_0x62e7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25ad38,_0x4377c5,_0x5b6005){return new BPromise(function(_0x27dce6,_0x7958df){return client[_0x62e7('0x9')](_0x25ad38,_0x5b6005)[_0x62e7('0xa')](function(_0x2b8d71){logger[_0x62e7('0xb')](_0x62e7('0xc'),_0x4377c5,'request\x20sent');logger['debug'](_0x62e7('0xd'),_0x4377c5,'request\x20sent',JSON['stringify'](_0x2b8d71));if(_0x2b8d71['error']){if(_0x2b8d71[_0x62e7('0xe')][_0x62e7('0xf')]===0x1f4){logger[_0x62e7('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4377c5,_0x2b8d71[_0x62e7('0xe')]['message']);return _0x7958df(_0x2b8d71[_0x62e7('0xe')][_0x62e7('0x10')]);}logger[_0x62e7('0xe')](_0x62e7('0xc'),_0x4377c5,_0x2b8d71[_0x62e7('0xe')]['message']);return _0x27dce6(_0x2b8d71[_0x62e7('0xe')][_0x62e7('0x10')]);}else{logger[_0x62e7('0xb')](_0x62e7('0xc'),_0x4377c5,_0x62e7('0x11'));_0x27dce6(_0x2b8d71[_0x62e7('0x12')][_0x62e7('0x10')]);}})['catch'](function(_0x488f07){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x4377c5,_0x488f07);_0x7958df(_0x488f07);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 7bb0141..bec2895 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 _0x1ffb=['get','isAuthenticated','index','show','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4fe651,_0x3c5c3c){var _0x5c5372=function(_0xf39e42){while(--_0xf39e42){_0x4fe651['push'](_0x4fe651['shift']());}};_0x5c5372(++_0x3c5c3c);}(_0x1ffb,0x1c2));var _0xb1ff=function(_0xa634ff,_0x377aa4){_0xa634ff=_0xa634ff-0x0;var _0x27bf1f=_0x1ffb[_0xa634ff];return _0x27bf1f;};'use strict';var multer=require(_0xb1ff('0x0'));var util=require(_0xb1ff('0x1'));var path=require(_0xb1ff('0x2'));var timeout=require(_0xb1ff('0x3'));var express=require(_0xb1ff('0x4'));var router=express[_0xb1ff('0x5')]();var fs_extra=require(_0xb1ff('0x6'));var auth=require(_0xb1ff('0x7'));var interaction=require(_0xb1ff('0x8'));var config=require(_0xb1ff('0x9'));var controller=require('./intZendeskField.controller');router[_0xb1ff('0xa')]('/',auth[_0xb1ff('0xb')](),controller[_0xb1ff('0xc')]);router['get']('/:id',auth[_0xb1ff('0xb')](),controller[_0xb1ff('0xd')]);router[_0xb1ff('0xe')]('/',auth[_0xb1ff('0xb')](),controller['create']);router['put'](_0xb1ff('0xf'),auth['isAuthenticated'](),controller[_0xb1ff('0x10')]);router[_0xb1ff('0x11')](_0xb1ff('0xf'),auth[_0xb1ff('0xb')](),controller[_0xb1ff('0x12')]);module[_0xb1ff('0x13')]=router; \ No newline at end of file +var _0x74c7=['./intZendeskField.controller','isAuthenticated','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0x74c7,0x13d));var _0x774c=function(_0x40cb10,_0x340101){_0x40cb10=_0x40cb10-0x0;var _0x46cac1=_0x74c7[_0x40cb10];return _0x46cac1;};'use strict';var multer=require(_0x774c('0x0'));var util=require(_0x774c('0x1'));var path=require(_0x774c('0x2'));var timeout=require('connect-timeout');var express=require(_0x774c('0x3'));var router=express[_0x774c('0x4')]();var fs_extra=require(_0x774c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x774c('0x6'));var controller=require(_0x774c('0x7'));router['get']('/',auth[_0x774c('0x8')](),controller['index']);router[_0x774c('0x9')](_0x774c('0xa'),auth[_0x774c('0x8')](),controller[_0x774c('0xb')]);router[_0x774c('0xc')]('/',auth[_0x774c('0x8')](),controller[_0x774c('0xd')]);router[_0x774c('0xe')](_0x774c('0xa'),auth[_0x774c('0x8')](),controller[_0x774c('0xf')]);router['delete'](_0x774c('0xa'),auth['isAuthenticated'](),controller[_0x774c('0x10')]);module[_0x774c('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 a31bb5f..6493127 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 _0x3470=['STRING','string','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','picklist'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3470,0x150));var _0x0347=function(_0x37c3f9,_0x4d4f76){_0x37c3f9=_0x37c3f9-0x0;var _0x4a79c0=_0x3470[_0x37c3f9];return _0x4a79c0;};'use strict';var Sequelize=require(_0x0347('0x0'));module[_0x0347('0x1')]={'type':{'type':Sequelize[_0x0347('0x2')]('string',_0x0347('0x3'),_0x0347('0x4'),'keyValue',_0x0347('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0347('0x6')]},'key':{'type':Sequelize[_0x0347('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x0347('0x7'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x0347('0x6')]},'idField':{'type':Sequelize[_0x0347('0x6')]},'nameField':{'type':Sequelize[_0x0347('0x6')]},'customField':{'type':Sequelize[_0x0347('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2121=['ENUM','string','variable','keyValue','STRING','customVariable','sequelize','exports'];(function(_0x52e9a1,_0x5ea77e){var _0x2d41aa=function(_0xefcb3a){while(--_0xefcb3a){_0x52e9a1['push'](_0x52e9a1['shift']());}};_0x2d41aa(++_0x5ea77e);}(_0x2121,0x12e));var _0x1212=function(_0x2b6b25,_0x3f38bf){_0x2b6b25=_0x2b6b25-0x0;var _0x210369=_0x2121[_0x2b6b25];return _0x210369;};'use strict';var Sequelize=require(_0x1212('0x0'));module[_0x1212('0x1')]={'type':{'type':Sequelize[_0x1212('0x2')](_0x1212('0x3'),_0x1212('0x4'),'customVariable',_0x1212('0x5'),'picklist'),'defaultValue':_0x1212('0x3')},'content':{'type':Sequelize[_0x1212('0x6')]},'key':{'type':Sequelize[_0x1212('0x6')]},'keyType':{'type':Sequelize[_0x1212('0x2')](_0x1212('0x3'),_0x1212('0x4'),_0x1212('0x7'))},'keyContent':{'type':Sequelize[_0x1212('0x6')]},'idField':{'type':Sequelize[_0x1212('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 998cd17..6fbb0e1 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 _0x61b2=['name','send','index','map','ZendeskField','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','body','catch','destroy','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','error'];(function(_0x4ad5c4,_0x2822e9){var _0x135c41=function(_0x385a19){while(--_0x385a19){_0x4ad5c4['push'](_0x4ad5c4['shift']());}};_0x135c41(++_0x2822e9);}(_0x61b2,0x139));var _0x261b=function(_0x3d6c81,_0x1bd9d8){_0x3d6c81=_0x3d6c81-0x0;var _0x5cde41=_0x61b2[_0x3d6c81];return _0x5cde41;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x261b('0x0'));var jsonpatch=require(_0x261b('0x1'));var rp=require(_0x261b('0x2'));var moment=require('moment');var BPromise=require(_0x261b('0x3'));var Mustache=require('mustache');var util=require(_0x261b('0x4'));var path=require(_0x261b('0x5'));var sox=require(_0x261b('0x6'));var csv=require(_0x261b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x261b('0x8'));var _=require(_0x261b('0x9'));var squel=require(_0x261b('0xa'));var crypto=require(_0x261b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x261b('0xc'));var toCsv=require(_0x261b('0x7'));var querystring=require('querystring');var Papa=require(_0x261b('0xd'));var Redis=require(_0x261b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x261b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x261b('0x10'));var logger=require('../../config/logger')(_0x261b('0x11'));var utils=require(_0x261b('0x12'));var config=require(_0x261b('0x13'));var licenseUtil=require(_0x261b('0x14'));var db=require(_0x261b('0x15'))['db'];function respondWithStatusCode(_0x3d8c99,_0x46875b){_0x46875b=_0x46875b||0xcc;return function(_0x5b73f8){if(_0x5b73f8){return _0x3d8c99[_0x261b('0x16')](_0x46875b);}return _0x3d8c99[_0x261b('0x17')](_0x46875b)[_0x261b('0x18')]();};}function respondWithResult(_0x29858e,_0x373f45){_0x373f45=_0x373f45||0xc8;return function(_0x1fc8d0){if(_0x1fc8d0){return _0x29858e['status'](_0x373f45)[_0x261b('0x19')](_0x1fc8d0);}};}function respondWithFilteredResult(_0x38d2db,_0x41c490){return function(_0x3e277a){if(_0x3e277a){var _0x1a16d6=typeof _0x41c490['offset']===_0x261b('0x1a')&&typeof _0x41c490['limit']===_0x261b('0x1a');var _0x355595=_0x3e277a[_0x261b('0x1b')];var _0x31f07f=_0x1a16d6?0x0:_0x41c490[_0x261b('0x1c')];var _0x5964f0=_0x1a16d6?_0x3e277a[_0x261b('0x1b')]:_0x41c490[_0x261b('0x1c')]+_0x41c490[_0x261b('0x1d')];var _0x45a24d;if(_0x5964f0>=_0x355595){_0x5964f0=_0x355595;_0x45a24d=0xc8;}else{_0x45a24d=0xce;}_0x38d2db[_0x261b('0x17')](_0x45a24d);return _0x38d2db[_0x261b('0x1e')](_0x261b('0x1f'),_0x31f07f+'-'+_0x5964f0+'/'+_0x355595)[_0x261b('0x19')](_0x3e277a);}return null;};}function patchUpdates(_0x423ffe){return function(_0x67be64){try{jsonpatch[_0x261b('0x20')](_0x67be64,_0x423ffe,!![]);}catch(_0x4ee365){return BPromise['reject'](_0x4ee365);}return _0x67be64[_0x261b('0x21')]();};}function saveUpdates(_0x5c5a3e,_0x4b12bb){return function(_0x4d4cfc){if(_0x4d4cfc){return _0x4d4cfc[_0x261b('0x22')](_0x5c5a3e)['then'](function(_0x227e6b){return _0x227e6b;});}return null;};}function removeEntity(_0x46f4c5,_0x1ca7a4){return function(_0x4a6c79){if(_0x4a6c79){return _0x4a6c79['destroy']()[_0x261b('0x23')](function(){_0x46f4c5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3da1c9,_0x3bf99d){return function(_0x32b4ee){if(!_0x32b4ee){_0x3da1c9[_0x261b('0x16')](0x194);}return _0x32b4ee;};}function handleError(_0x1b0bea,_0x14bc76){_0x14bc76=_0x14bc76||0x1f4;return function(_0x23b5b9){logger[_0x261b('0x24')](_0x23b5b9['stack']);if(_0x23b5b9[_0x261b('0x25')]){delete _0x23b5b9[_0x261b('0x25')];}_0x1b0bea['status'](_0x14bc76)[_0x261b('0x26')](_0x23b5b9);};}exports[_0x261b('0x27')]=function(_0xaddfbf,_0x1f085){var _0x216266={},_0x122ec2={},_0x519757={'count':0x0,'rows':[]};var _0x2622ee=_[_0x261b('0x28')](db[_0x261b('0x29')]['rawAttributes'],function(_0x1575d4){return{'name':_0x1575d4[_0x261b('0x2a')],'type':_0x1575d4[_0x261b('0x2b')]['key']};});_0x122ec2[_0x261b('0x2c')]=_[_0x261b('0x28')](_0x2622ee,_0x261b('0x25'));_0x122ec2[_0x261b('0x2d')]=_[_0x261b('0x2e')](_0xaddfbf[_0x261b('0x2d')]);_0x122ec2['filters']=_['intersection'](_0x122ec2['model'],_0x122ec2['query']);_0x216266['attributes']=_[_0x261b('0x2f')](_0x122ec2[_0x261b('0x2c')],qs[_0x261b('0x30')](_0xaddfbf['query'][_0x261b('0x30')]));_0x216266[_0x261b('0x31')]=_0x216266[_0x261b('0x31')][_0x261b('0x32')]?_0x216266[_0x261b('0x31')]:_0x122ec2[_0x261b('0x2c')];if(!_0xaddfbf['query'][_0x261b('0x33')]('nolimit')){_0x216266[_0x261b('0x1d')]=qs[_0x261b('0x1d')](_0xaddfbf['query'][_0x261b('0x1d')]);_0x216266[_0x261b('0x1c')]=qs[_0x261b('0x1c')](_0xaddfbf[_0x261b('0x2d')][_0x261b('0x1c')]);}_0x216266['order']=qs[_0x261b('0x34')](_0xaddfbf[_0x261b('0x2d')][_0x261b('0x34')]);_0x216266[_0x261b('0x35')]=qs['filters'](_[_0x261b('0x36')](_0xaddfbf[_0x261b('0x2d')],_0x122ec2['filters']),_0x2622ee);if(_0xaddfbf[_0x261b('0x2d')][_0x261b('0x37')]){_0x216266[_0x261b('0x35')]=_[_0x261b('0x38')](_0x216266['where'],{'$or':_[_0x261b('0x28')](_0x2622ee,function(_0x27e11c){if(_0x27e11c['type']!=='VIRTUAL'){var _0x212dcd={};_0x212dcd[_0x27e11c[_0x261b('0x25')]]={'$like':'%'+_0xaddfbf[_0x261b('0x2d')][_0x261b('0x37')]+'%'};return _0x212dcd;}})});}_0x216266=_['merge']({},_0x216266,_0xaddfbf['options']);var _0xdf7653={'where':_0x216266[_0x261b('0x35')]};return db[_0x261b('0x29')][_0x261b('0x1b')](_0xdf7653)[_0x261b('0x23')](function(_0x546adb){_0x519757['count']=_0x546adb;if(_0xaddfbf[_0x261b('0x2d')][_0x261b('0x39')]){_0x216266[_0x261b('0x3a')]=[{'all':!![]}];}return db[_0x261b('0x29')][_0x261b('0x3b')](_0x216266);})[_0x261b('0x23')](function(_0x1e0bad){_0x519757[_0x261b('0x3c')]=_0x1e0bad;return _0x519757;})[_0x261b('0x23')](respondWithFilteredResult(_0x1f085,_0x216266))['catch'](handleError(_0x1f085,null));};exports[_0x261b('0x3d')]=function(_0x8efdc5,_0x430337){var _0x44ceeb={'raw':!![],'where':{'id':_0x8efdc5[_0x261b('0x3e')]['id']}},_0x3c8159={};_0x3c8159[_0x261b('0x2c')]=_[_0x261b('0x2e')](db[_0x261b('0x29')][_0x261b('0x3f')]);_0x3c8159[_0x261b('0x2d')]=_['keys'](_0x8efdc5[_0x261b('0x2d')]);_0x3c8159['filters']=_[_0x261b('0x2f')](_0x3c8159[_0x261b('0x2c')],_0x3c8159['query']);_0x44ceeb['attributes']=_['intersection'](_0x3c8159[_0x261b('0x2c')],qs[_0x261b('0x30')](_0x8efdc5['query']['fields']));_0x44ceeb[_0x261b('0x31')]=_0x44ceeb['attributes']['length']?_0x44ceeb[_0x261b('0x31')]:_0x3c8159[_0x261b('0x2c')];if(_0x8efdc5['query']['includeAll']){_0x44ceeb[_0x261b('0x3a')]=[{'all':!![]}];}_0x44ceeb=_[_0x261b('0x38')]({},_0x44ceeb,_0x8efdc5[_0x261b('0x40')]);return db[_0x261b('0x29')][_0x261b('0x41')](_0x44ceeb)[_0x261b('0x23')](handleEntityNotFound(_0x430337,null))['then'](respondWithResult(_0x430337,null))['catch'](handleError(_0x430337,null));};exports[_0x261b('0x42')]=function(_0x250e23,_0x6df54e){return db[_0x261b('0x29')][_0x261b('0x42')](_0x250e23[_0x261b('0x43')],{})[_0x261b('0x23')](respondWithResult(_0x6df54e,0xc9))['catch'](handleError(_0x6df54e,null));};exports[_0x261b('0x22')]=function(_0x5551d2,_0x45cc54){if(_0x5551d2[_0x261b('0x43')]['id']){delete _0x5551d2[_0x261b('0x43')]['id'];}return db['ZendeskField'][_0x261b('0x41')]({'where':{'id':_0x5551d2[_0x261b('0x3e')]['id']}})[_0x261b('0x23')](handleEntityNotFound(_0x45cc54,null))[_0x261b('0x23')](saveUpdates(_0x5551d2[_0x261b('0x43')],null))['then'](respondWithResult(_0x45cc54,null))[_0x261b('0x44')](handleError(_0x45cc54,null));};exports[_0x261b('0x45')]=function(_0x240b4b,_0x2a65b6){return db[_0x261b('0x29')][_0x261b('0x41')]({'where':{'id':_0x240b4b[_0x261b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2a65b6,null))['then'](removeEntity(_0x2a65b6,null))[_0x261b('0x44')](handleError(_0x2a65b6,null));}; \ No newline at end of file +var _0x3c2d=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','reject','save','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','ZendeskField','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','update','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x163d6a,_0x1be8b8){var _0x47a3f9=function(_0x241d60){while(--_0x241d60){_0x163d6a['push'](_0x163d6a['shift']());}};_0x47a3f9(++_0x1be8b8);}(_0x3c2d,0x11b));var _0xd3c2=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x3c2d[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xd3c2('0x0'));var rimraf=require(_0xd3c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd3c2('0x2'));var moment=require(_0xd3c2('0x3'));var BPromise=require(_0xd3c2('0x4'));var Mustache=require(_0xd3c2('0x5'));var util=require('util');var path=require(_0xd3c2('0x6'));var sox=require(_0xd3c2('0x7'));var csv=require(_0xd3c2('0x8'));var ejs=require(_0xd3c2('0x9'));var fs=require('fs');var fs_extra=require(_0xd3c2('0xa'));var _=require(_0xd3c2('0xb'));var squel=require(_0xd3c2('0xc'));var crypto=require(_0xd3c2('0xd'));var jsforce=require(_0xd3c2('0xe'));var deskjs=require(_0xd3c2('0xf'));var toCsv=require(_0xd3c2('0x8'));var querystring=require(_0xd3c2('0x10'));var Papa=require('papaparse');var Redis=require(_0xd3c2('0x11'));var authService=require(_0xd3c2('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3c2('0x13'));var logger=require(_0xd3c2('0x14'))(_0xd3c2('0x15'));var utils=require(_0xd3c2('0x16'));var config=require(_0xd3c2('0x17'));var licenseUtil=require(_0xd3c2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ce6a1,_0x2a0d5d){_0x2a0d5d=_0x2a0d5d||0xcc;return function(_0x3820ee){if(_0x3820ee){return _0x3ce6a1[_0xd3c2('0x19')](_0x2a0d5d);}return _0x3ce6a1['status'](_0x2a0d5d)['end']();};}function respondWithResult(_0xcde721,_0x566544){_0x566544=_0x566544||0xc8;return function(_0x27376c){if(_0x27376c){return _0xcde721[_0xd3c2('0x1a')](_0x566544)[_0xd3c2('0x1b')](_0x27376c);}};}function respondWithFilteredResult(_0x460a98,_0x3a13e3){return function(_0x5ae192){if(_0x5ae192){var _0x44c087=typeof _0x3a13e3['offset']===_0xd3c2('0x1c')&&typeof _0x3a13e3[_0xd3c2('0x1d')]===_0xd3c2('0x1c');var _0x2fa2e5=_0x5ae192[_0xd3c2('0x1e')];var _0x4c82bc=_0x44c087?0x0:_0x3a13e3[_0xd3c2('0x1f')];var _0x47a945=_0x44c087?_0x5ae192[_0xd3c2('0x1e')]:_0x3a13e3[_0xd3c2('0x1f')]+_0x3a13e3[_0xd3c2('0x1d')];var _0x54a607;if(_0x47a945>=_0x2fa2e5){_0x47a945=_0x2fa2e5;_0x54a607=0xc8;}else{_0x54a607=0xce;}_0x460a98[_0xd3c2('0x1a')](_0x54a607);return _0x460a98['set']('Content-Range',_0x4c82bc+'-'+_0x47a945+'/'+_0x2fa2e5)['json'](_0x5ae192);}return null;};}function patchUpdates(_0x2ec83f){return function(_0x1cbbd6){try{jsonpatch['apply'](_0x1cbbd6,_0x2ec83f,!![]);}catch(_0x3f5bca){return BPromise[_0xd3c2('0x20')](_0x3f5bca);}return _0x1cbbd6[_0xd3c2('0x21')]();};}function saveUpdates(_0x4200f6,_0x506909){return function(_0x2418a6){if(_0x2418a6){return _0x2418a6['update'](_0x4200f6)[_0xd3c2('0x22')](function(_0x3a8a8d){return _0x3a8a8d;});}return null;};}function removeEntity(_0x531411,_0x486cce){return function(_0x9368e){if(_0x9368e){return _0x9368e[_0xd3c2('0x23')]()[_0xd3c2('0x22')](function(){_0x531411['status'](0xcc)[_0xd3c2('0x24')]();});}};}function handleEntityNotFound(_0x1be9b8,_0xf60154){return function(_0x3b43cd){if(!_0x3b43cd){_0x1be9b8[_0xd3c2('0x19')](0x194);}return _0x3b43cd;};}function handleError(_0xecc0bb,_0x40db51){_0x40db51=_0x40db51||0x1f4;return function(_0x42b0b3){logger[_0xd3c2('0x25')](_0x42b0b3[_0xd3c2('0x26')]);if(_0x42b0b3[_0xd3c2('0x27')]){delete _0x42b0b3[_0xd3c2('0x27')];}_0xecc0bb[_0xd3c2('0x1a')](_0x40db51)['send'](_0x42b0b3);};}exports[_0xd3c2('0x28')]=function(_0x4b9d27,_0x1fe32e){var _0xad54bb={},_0x2d3b4a={},_0x308f24={'count':0x0,'rows':[]};var _0x5d657c=_['map'](db['ZendeskField'][_0xd3c2('0x29')],function(_0x5932cf){return{'name':_0x5932cf[_0xd3c2('0x2a')],'type':_0x5932cf['type']['key']};});_0x2d3b4a[_0xd3c2('0x2b')]=_['map'](_0x5d657c,_0xd3c2('0x27'));_0x2d3b4a['query']=_[_0xd3c2('0x2c')](_0x4b9d27[_0xd3c2('0x2d')]);_0x2d3b4a[_0xd3c2('0x2e')]=_[_0xd3c2('0x2f')](_0x2d3b4a[_0xd3c2('0x2b')],_0x2d3b4a[_0xd3c2('0x2d')]);_0xad54bb['attributes']=_[_0xd3c2('0x2f')](_0x2d3b4a['model'],qs[_0xd3c2('0x30')](_0x4b9d27['query']['fields']));_0xad54bb[_0xd3c2('0x31')]=_0xad54bb[_0xd3c2('0x31')]['length']?_0xad54bb[_0xd3c2('0x31')]:_0x2d3b4a[_0xd3c2('0x2b')];if(!_0x4b9d27[_0xd3c2('0x2d')][_0xd3c2('0x32')]('nolimit')){_0xad54bb[_0xd3c2('0x1d')]=qs[_0xd3c2('0x1d')](_0x4b9d27[_0xd3c2('0x2d')][_0xd3c2('0x1d')]);_0xad54bb[_0xd3c2('0x1f')]=qs[_0xd3c2('0x1f')](_0x4b9d27[_0xd3c2('0x2d')]['offset']);}_0xad54bb[_0xd3c2('0x33')]=qs[_0xd3c2('0x34')](_0x4b9d27[_0xd3c2('0x2d')][_0xd3c2('0x34')]);_0xad54bb[_0xd3c2('0x35')]=qs['filters'](_[_0xd3c2('0x36')](_0x4b9d27[_0xd3c2('0x2d')],_0x2d3b4a['filters']),_0x5d657c);if(_0x4b9d27[_0xd3c2('0x2d')][_0xd3c2('0x37')]){_0xad54bb[_0xd3c2('0x35')]=_[_0xd3c2('0x38')](_0xad54bb[_0xd3c2('0x35')],{'$or':_[_0xd3c2('0x39')](_0x5d657c,function(_0x2652df){if(_0x2652df[_0xd3c2('0x3a')]!==_0xd3c2('0x3b')){var _0x1ea459={};_0x1ea459[_0x2652df[_0xd3c2('0x27')]]={'$like':'%'+_0x4b9d27['query'][_0xd3c2('0x37')]+'%'};return _0x1ea459;}})});}_0xad54bb=_[_0xd3c2('0x38')]({},_0xad54bb,_0x4b9d27[_0xd3c2('0x3c')]);var _0x5746c8={'where':_0xad54bb['where']};return db[_0xd3c2('0x3d')][_0xd3c2('0x1e')](_0x5746c8)[_0xd3c2('0x22')](function(_0x10243d){_0x308f24[_0xd3c2('0x1e')]=_0x10243d;if(_0x4b9d27[_0xd3c2('0x2d')]['includeAll']){_0xad54bb[_0xd3c2('0x3e')]=[{'all':!![]}];}return db[_0xd3c2('0x3d')][_0xd3c2('0x3f')](_0xad54bb);})[_0xd3c2('0x22')](function(_0x18eafc){_0x308f24[_0xd3c2('0x40')]=_0x18eafc;return _0x308f24;})[_0xd3c2('0x22')](respondWithFilteredResult(_0x1fe32e,_0xad54bb))[_0xd3c2('0x41')](handleError(_0x1fe32e,null));};exports[_0xd3c2('0x42')]=function(_0x1c8d2b,_0x9e3de8){var _0x36f095={'raw':!![],'where':{'id':_0x1c8d2b[_0xd3c2('0x43')]['id']}},_0x12ecda={};_0x12ecda[_0xd3c2('0x2b')]=_[_0xd3c2('0x2c')](db[_0xd3c2('0x3d')][_0xd3c2('0x29')]);_0x12ecda[_0xd3c2('0x2d')]=_[_0xd3c2('0x2c')](_0x1c8d2b[_0xd3c2('0x2d')]);_0x12ecda['filters']=_[_0xd3c2('0x2f')](_0x12ecda[_0xd3c2('0x2b')],_0x12ecda[_0xd3c2('0x2d')]);_0x36f095[_0xd3c2('0x31')]=_['intersection'](_0x12ecda[_0xd3c2('0x2b')],qs[_0xd3c2('0x30')](_0x1c8d2b[_0xd3c2('0x2d')][_0xd3c2('0x30')]));_0x36f095[_0xd3c2('0x31')]=_0x36f095['attributes'][_0xd3c2('0x44')]?_0x36f095[_0xd3c2('0x31')]:_0x12ecda[_0xd3c2('0x2b')];if(_0x1c8d2b[_0xd3c2('0x2d')][_0xd3c2('0x45')]){_0x36f095[_0xd3c2('0x3e')]=[{'all':!![]}];}_0x36f095=_['merge']({},_0x36f095,_0x1c8d2b[_0xd3c2('0x3c')]);return db['ZendeskField'][_0xd3c2('0x46')](_0x36f095)[_0xd3c2('0x22')](handleEntityNotFound(_0x9e3de8,null))[_0xd3c2('0x22')](respondWithResult(_0x9e3de8,null))[_0xd3c2('0x41')](handleError(_0x9e3de8,null));};exports[_0xd3c2('0x47')]=function(_0x2c2099,_0x140d72){return db[_0xd3c2('0x3d')][_0xd3c2('0x47')](_0x2c2099[_0xd3c2('0x48')],{})['then'](respondWithResult(_0x140d72,0xc9))['catch'](handleError(_0x140d72,null));};exports[_0xd3c2('0x49')]=function(_0xbc2d30,_0x252aac){if(_0xbc2d30[_0xd3c2('0x48')]['id']){delete _0xbc2d30[_0xd3c2('0x48')]['id'];}return db[_0xd3c2('0x3d')]['find']({'where':{'id':_0xbc2d30[_0xd3c2('0x43')]['id']}})[_0xd3c2('0x22')](handleEntityNotFound(_0x252aac,null))[_0xd3c2('0x22')](saveUpdates(_0xbc2d30['body'],null))['then'](respondWithResult(_0x252aac,null))[_0xd3c2('0x41')](handleError(_0x252aac,null));};exports[_0xd3c2('0x23')]=function(_0x543812,_0x485fdd){return db[_0xd3c2('0x3d')][_0xd3c2('0x46')]({'where':{'id':_0x543812[_0xd3c2('0x43')]['id']}})[_0xd3c2('0x22')](handleEntityNotFound(_0x485fdd,null))[_0xd3c2('0x22')](removeEntity(_0x485fdd,null))['catch'](handleError(_0x485fdd,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index bd071b3..930ba38 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 _0x4b43=['exports','define','zendesk_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x500749,_0xb3fc9d){var _0x3032c5=function(_0x1aabde){while(--_0x1aabde){_0x500749['push'](_0x500749['shift']());}};_0x3032c5(++_0xb3fc9d);}(_0x4b43,0x124));var _0x34b4=function(_0x281a15,_0x2e755c){_0x281a15=_0x281a15-0x0;var _0x39e288=_0x4b43[_0x281a15];return _0x39e288;};'use strict';var _=require(_0x34b4('0x0'));var util=require(_0x34b4('0x1'));var logger=require(_0x34b4('0x2'))(_0x34b4('0x3'));var moment=require(_0x34b4('0x4'));var BPromise=require('bluebird');var rp=require(_0x34b4('0x5'));var fs=require('fs');var path=require(_0x34b4('0x6'));var rimraf=require(_0x34b4('0x7'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0x34b4('0x8')]=function(_0x3ffcb0,_0x41a4ee){return _0x3ffcb0[_0x34b4('0x9')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x34b4('0xa'),'fields':[_0x34b4('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ed0=['./intZendeskField.attributes','exports','define','zendesk_unique_index','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3b6361,_0x58e25c){var _0x10d881=function(_0x1bbab9){while(--_0x1bbab9){_0x3b6361['push'](_0x3b6361['shift']());}};_0x10d881(++_0x58e25c);}(_0x6ed0,0x147));var _0x06ed=function(_0x204e9f,_0x2826bc){_0x204e9f=_0x204e9f-0x0;var _0x507799=_0x6ed0[_0x204e9f];return _0x507799;};'use strict';var _=require(_0x06ed('0x0'));var util=require(_0x06ed('0x1'));var logger=require('../../config/logger')(_0x06ed('0x2'));var moment=require(_0x06ed('0x3'));var BPromise=require(_0x06ed('0x4'));var rp=require(_0x06ed('0x5'));var fs=require('fs');var path=require(_0x06ed('0x6'));var rimraf=require(_0x06ed('0x7'));var config=require(_0x06ed('0x8'));var attributes=require(_0x06ed('0x9'));module[_0x06ed('0xa')]=function(_0x26a8b9,_0x332431){return _0x26a8b9[_0x06ed('0xb')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x06ed('0xc'),'fields':['idField',_0x06ed('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 1969c91..3149022 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 _0x8e60=['util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash'];(function(_0x3e4ed0,_0x12e5e1){var _0x1134f8=function(_0x1bf0a4){while(--_0x1bf0a4){_0x3e4ed0['push'](_0x3e4ed0['shift']());}};_0x1134f8(++_0x12e5e1);}(_0x8e60,0x97));var _0x08e6=function(_0x5cd7c3,_0x70f967){_0x5cd7c3=_0x5cd7c3-0x0;var _0x3e6e67=_0x8e60[_0x5cd7c3];return _0x3e6e67;};'use strict';var _=require(_0x08e6('0x0'));var util=require(_0x08e6('0x1'));var moment=require(_0x08e6('0x2'));var BPromise=require(_0x08e6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08e6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x08e6('0x5'));var logger=require('../../config/logger')(_0x08e6('0x6'));var config=require(_0x08e6('0x7'));var jayson=require(_0x08e6('0x8'));var client=jayson[_0x08e6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20021f,_0x4d1672,_0x471471){return new BPromise(function(_0x5144fe,_0x4f8778){return client['request'](_0x20021f,_0x471471)['then'](function(_0x14cdb2){logger['info'](_0x08e6('0xa'),_0x4d1672,_0x08e6('0xb'));logger[_0x08e6('0xc')](_0x08e6('0xd'),_0x4d1672,_0x08e6('0xb'),JSON['stringify'](_0x14cdb2));if(_0x14cdb2['error']){if(_0x14cdb2[_0x08e6('0xe')]['code']===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x4d1672,_0x14cdb2['error']['message']);return _0x4f8778(_0x14cdb2['error'][_0x08e6('0xf')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x4d1672,_0x14cdb2['error'][_0x08e6('0xf')]);return _0x5144fe(_0x14cdb2['error'][_0x08e6('0xf')]);}else{logger[_0x08e6('0x10')](_0x08e6('0xa'),_0x4d1672,_0x08e6('0xb'));_0x5144fe(_0x14cdb2[_0x08e6('0x11')]['message']);}})[_0x08e6('0x12')](function(_0x348dec){logger[_0x08e6('0xe')](_0x08e6('0xa'),_0x4d1672,_0x348dec);_0x4f8778(_0x348dec);});});} \ No newline at end of file +var _0xb8b1=['../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2669e9,_0x16c605){var _0x4a3780=function(_0x2262f9){while(--_0x2262f9){_0x2669e9['push'](_0x2669e9['shift']());}};_0x4a3780(++_0x16c605);}(_0xb8b1,0x1c3));var _0x1b8b=function(_0x56989c,_0x6781f0){_0x56989c=_0x56989c-0x0;var _0x22ab27=_0xb8b1[_0x56989c];return _0x22ab27;};'use strict';var _=require(_0x1b8b('0x0'));var util=require(_0x1b8b('0x1'));var moment=require(_0x1b8b('0x2'));var BPromise=require(_0x1b8b('0x3'));var rs=require(_0x1b8b('0x4'));var fs=require('fs');var Redis=require(_0x1b8b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b8b('0x6'));var logger=require(_0x1b8b('0x7'))(_0x1b8b('0x8'));var config=require(_0x1b8b('0x9'));var jayson=require(_0x1b8b('0xa'));var client=jayson[_0x1b8b('0xb')][_0x1b8b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e0ebd,_0x2c3c34,_0x43bcdb){return new BPromise(function(_0x569645,_0x23f496){return client[_0x1b8b('0xd')](_0x5e0ebd,_0x43bcdb)[_0x1b8b('0xe')](function(_0x9c09d1){logger[_0x1b8b('0xf')](_0x1b8b('0x10'),_0x2c3c34,_0x1b8b('0x11'));logger[_0x1b8b('0x12')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x2c3c34,_0x1b8b('0x11'),JSON[_0x1b8b('0x13')](_0x9c09d1));if(_0x9c09d1['error']){if(_0x9c09d1[_0x1b8b('0x14')][_0x1b8b('0x15')]===0x1f4){logger[_0x1b8b('0x14')](_0x1b8b('0x10'),_0x2c3c34,_0x9c09d1[_0x1b8b('0x14')][_0x1b8b('0x16')]);return _0x23f496(_0x9c09d1[_0x1b8b('0x14')][_0x1b8b('0x16')]);}logger['error'](_0x1b8b('0x10'),_0x2c3c34,_0x9c09d1['error']['message']);return _0x569645(_0x9c09d1[_0x1b8b('0x14')][_0x1b8b('0x16')]);}else{logger['info'](_0x1b8b('0x10'),_0x2c3c34,'request\x20sent');_0x569645(_0x9c09d1['result'][_0x1b8b('0x16')]);}})['catch'](function(_0x20ddb0){logger[_0x1b8b('0x14')](_0x1b8b('0x10'),_0x2c3c34,_0x20ddb0);_0x23f496(_0x20ddb0);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 8496604..49d4059 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 _0x56be=['/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56be,0x129));var _0xe56b=function(_0x59dbae,_0x2bd282){_0x59dbae=_0x59dbae-0x0;var _0x2ae15f=_0x56be[_0x59dbae];return _0x2ae15f;};'use strict';var multer=require(_0xe56b('0x0'));var util=require(_0xe56b('0x1'));var path=require(_0xe56b('0x2'));var timeout=require(_0xe56b('0x3'));var express=require('express');var router=express[_0xe56b('0x4')]();var fs_extra=require(_0xe56b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe56b('0x6'));var config=require(_0xe56b('0x7'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0xe56b('0x8')](),controller[_0xe56b('0x9')]);router[_0xe56b('0xa')](_0xe56b('0xb'),auth[_0xe56b('0x8')](),controller['show']);router[_0xe56b('0xa')](_0xe56b('0xc'),auth[_0xe56b('0x8')](),controller[_0xe56b('0xd')]);router[_0xe56b('0xa')](_0xe56b('0xe'),auth['isAuthenticated'](),controller[_0xe56b('0xf')]);router[_0xe56b('0x10')]('/',auth['isAuthenticated'](),controller[_0xe56b('0x11')]);router[_0xe56b('0x10')](_0xe56b('0xc'),auth[_0xe56b('0x8')](),controller[_0xe56b('0x12')]);router[_0xe56b('0x13')](_0xe56b('0xb'),auth[_0xe56b('0x8')](),controller['update']);router['delete'](_0xe56b('0xb'),auth[_0xe56b('0x8')](),controller[_0xe56b('0x14')]);module[_0xe56b('0x15')]=router; \ No newline at end of file +var _0x3c17=['multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','exports'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x3c17,0x8a));var _0x73c1=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x3c17[_0x5317b5];return _0x3b7ce2;};'use strict';var multer=require(_0x73c1('0x0'));var util=require(_0x73c1('0x1'));var path=require('path');var timeout=require(_0x73c1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x73c1('0x3'));var auth=require(_0x73c1('0x4'));var interaction=require(_0x73c1('0x5'));var config=require(_0x73c1('0x6'));var controller=require(_0x73c1('0x7'));router[_0x73c1('0x8')]('/',auth[_0x73c1('0x9')](),controller[_0x73c1('0xa')]);router['get'](_0x73c1('0xb'),auth['isAuthenticated'](),controller[_0x73c1('0xc')]);router['get'](_0x73c1('0xd'),auth[_0x73c1('0x9')](),controller[_0x73c1('0xe')]);router[_0x73c1('0x8')]('/:id/fields',auth[_0x73c1('0x9')](),controller[_0x73c1('0xf')]);router[_0x73c1('0x10')]('/',auth[_0x73c1('0x9')](),controller['create']);router[_0x73c1('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x73c1('0x11')]);router[_0x73c1('0x12')]('/:id',auth[_0x73c1('0x9')](),controller[_0x73c1('0x13')]);router[_0x73c1('0x14')](_0x73c1('0xb'),auth[_0x73c1('0x9')](),controller[_0x73c1('0x15')]);module[_0x73c1('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 167887e..9f48658 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 _0x70e0=['STRING','sequelize','exports'];(function(_0x45fb44,_0xf55a01){var _0x497298=function(_0x115ae4){while(--_0x115ae4){_0x45fb44['push'](_0x45fb44['shift']());}};_0x497298(++_0xf55a01);}(_0x70e0,0x17b));var _0x070e=function(_0x294513,_0x4dbe51){_0x294513=_0x294513-0x0;var _0x4d4c5d=_0x70e0[_0x294513];return _0x4d4c5d;};'use strict';var Sequelize=require(_0x070e('0x0'));module[_0x070e('0x1')]={'name':{'type':Sequelize[_0x070e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x070e('0x2')]},'clientId':{'type':Sequelize[_0x070e('0x2')]},'clientSecret':{'type':Sequelize[_0x070e('0x2')]},'serverUrl':{'type':Sequelize[_0x070e('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x070e('0x2')]}}; \ No newline at end of file +var _0xa8a8=['exports','STRING','sequelize'];(function(_0x47d346,_0x486e7b){var _0x3dbbfc=function(_0x4cf7b1){while(--_0x4cf7b1){_0x47d346['push'](_0x47d346['shift']());}};_0x3dbbfc(++_0x486e7b);}(_0xa8a8,0xec));var _0x8a8a=function(_0x1e38ea,_0x50b118){_0x1e38ea=_0x1e38ea-0x0;var _0x4dfe44=_0xa8a8[_0x1e38ea];return _0x4dfe44;};'use strict';var Sequelize=require(_0x8a8a('0x0'));module[_0x8a8a('0x1')]={'name':{'type':Sequelize[_0x8a8a('0x2')]},'description':{'type':Sequelize[_0x8a8a('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8a8a('0x2')]},'clientId':{'type':Sequelize[_0x8a8a('0x2')]},'clientSecret':{'type':Sequelize[_0x8a8a('0x2')]},'serverUrl':{'type':Sequelize[_0x8a8a('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8a8a('0x2')]},'refreshToken':{'type':Sequelize[_0x8a8a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 609db21..d7717dc 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 _0x6dae=['refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','zoho.eu','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','type','keys','filters','intersection','model','query','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','options','include','findAll','catch','show','params','fields','find','create','body','getConfigurations','findOne','ZohoConfiguration','sort','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x6dae,0x12a));var _0xe6da=function(_0x11fc67,_0x1eda19){_0x11fc67=_0x11fc67-0x0;var _0x50bb19=_0x6dae[_0x11fc67];return _0x50bb19;};'use strict';var emlformat=require(_0xe6da('0x0'));var rimraf=require(_0xe6da('0x1'));var zipdir=require(_0xe6da('0x2'));var jsonpatch=require(_0xe6da('0x3'));var rp=require(_0xe6da('0x4'));var moment=require(_0xe6da('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe6da('0x6'));var path=require(_0xe6da('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe6da('0x8'));var fs=require('fs');var fs_extra=require(_0xe6da('0x9'));var _=require(_0xe6da('0xa'));var squel=require(_0xe6da('0xb'));var crypto=require(_0xe6da('0xc'));var jsforce=require(_0xe6da('0xd'));var deskjs=require(_0xe6da('0xe'));var toCsv=require(_0xe6da('0xf'));var querystring=require(_0xe6da('0x10'));var Papa=require('papaparse');var Redis=require(_0xe6da('0x11'));var authService=require(_0xe6da('0x12'));var qs=require(_0xe6da('0x13'));var as=require(_0xe6da('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe6da('0x15'));var utils=require(_0xe6da('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe6da('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe6da('0x18'));function respondWithStatusCode(_0x54fa58,_0x4b7cd6){_0x4b7cd6=_0x4b7cd6||0xcc;return function(_0x1ee6ac){if(_0x1ee6ac){return _0x54fa58[_0xe6da('0x19')](_0x4b7cd6);}return _0x54fa58['status'](_0x4b7cd6)[_0xe6da('0x1a')]();};}function respondWithResult(_0x266f28,_0x3fe3df){_0x3fe3df=_0x3fe3df||0xc8;return function(_0x429429){if(_0x429429){return _0x266f28['status'](_0x3fe3df)[_0xe6da('0x1b')](_0x429429);}};}function respondWithFilteredResult(_0x123eaa,_0xb46d18){return function(_0x516f69){if(_0x516f69){var _0x5c708f=typeof _0xb46d18['offset']===_0xe6da('0x1c')&&typeof _0xb46d18[_0xe6da('0x1d')]===_0xe6da('0x1c');var _0x163b14=_0x516f69[_0xe6da('0x1e')];var _0x3094c8=_0x5c708f?0x0:_0xb46d18[_0xe6da('0x1f')];var _0x29aa10=_0x5c708f?_0x516f69[_0xe6da('0x1e')]:_0xb46d18[_0xe6da('0x1f')]+_0xb46d18['limit'];var _0x1ff79d;if(_0x29aa10>=_0x163b14){_0x29aa10=_0x163b14;_0x1ff79d=0xc8;}else{_0x1ff79d=0xce;}_0x123eaa[_0xe6da('0x20')](_0x1ff79d);return _0x123eaa[_0xe6da('0x21')](_0xe6da('0x22'),_0x3094c8+'-'+_0x29aa10+'/'+_0x163b14)[_0xe6da('0x1b')](_0x516f69);}return null;};}function patchUpdates(_0x24472f){return function(_0x3ae2ff){try{jsonpatch[_0xe6da('0x23')](_0x3ae2ff,_0x24472f,!![]);}catch(_0x11156a){return BPromise[_0xe6da('0x24')](_0x11156a);}return _0x3ae2ff['save']();};}function saveUpdates(_0x527cbe,_0xf0ddb8){return function(_0x16781d){if(_0x16781d){return _0x16781d[_0xe6da('0x25')](_0x527cbe)[_0xe6da('0x26')](function(_0xabf481){return _0xabf481;});}return null;};}function removeEntity(_0x48651f,_0x44ff2a){return function(_0x717d92){if(_0x717d92){return _0x717d92[_0xe6da('0x27')]()[_0xe6da('0x26')](function(){_0x48651f[_0xe6da('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50b9f4,_0x57f54f){return function(_0x32f778){if(!_0x32f778){_0x50b9f4[_0xe6da('0x19')](0x194);}return _0x32f778;};}function handleError(_0x28a351,_0x525af8){_0x525af8=_0x525af8||0x1f4;return function(_0x579ab3){logger[_0xe6da('0x28')](_0x579ab3[_0xe6da('0x29')]);if(_0x579ab3[_0xe6da('0x2a')]){delete _0x579ab3[_0xe6da('0x2a')];}_0x28a351[_0xe6da('0x20')](_0x525af8)[_0xe6da('0x2b')](_0x579ab3);};}exports['index']=function(_0x34777b,_0x30cf32){var _0x14e321={},_0x2df974={},_0x116bb4={'count':0x0,'rows':[]};var _0x374b2e=_[_0xe6da('0x2c')](db[_0xe6da('0x2d')][_0xe6da('0x2e')],function(_0x3abab7){return{'name':_0x3abab7[_0xe6da('0x2f')],'type':_0x3abab7[_0xe6da('0x30')]['key']};});_0x2df974['model']=_['map'](_0x374b2e,_0xe6da('0x2a'));_0x2df974['query']=_[_0xe6da('0x31')](_0x34777b['query']);_0x2df974[_0xe6da('0x32')]=_[_0xe6da('0x33')](_0x2df974[_0xe6da('0x34')],_0x2df974[_0xe6da('0x35')]);_0x14e321['attributes']=_[_0xe6da('0x33')](_0x2df974[_0xe6da('0x34')],qs['fields'](_0x34777b['query']['fields']));_0x14e321[_0xe6da('0x36')]=_0x14e321[_0xe6da('0x36')][_0xe6da('0x37')]?_0x14e321[_0xe6da('0x36')]:_0x2df974[_0xe6da('0x34')];if(!_0x34777b[_0xe6da('0x35')][_0xe6da('0x38')](_0xe6da('0x39'))){_0x14e321[_0xe6da('0x1d')]=qs['limit'](_0x34777b['query'][_0xe6da('0x1d')]);_0x14e321['offset']=qs[_0xe6da('0x1f')](_0x34777b[_0xe6da('0x35')]['offset']);}_0x14e321[_0xe6da('0x3a')]=qs['sort'](_0x34777b['query']['sort']);_0x14e321['where']=qs[_0xe6da('0x32')](_[_0xe6da('0x3b')](_0x34777b[_0xe6da('0x35')],_0x2df974['filters']),_0x374b2e);if(_0x34777b[_0xe6da('0x35')][_0xe6da('0x3c')]){_0x14e321[_0xe6da('0x3d')]=_[_0xe6da('0x3e')](_0x14e321[_0xe6da('0x3d')],{'$or':_[_0xe6da('0x2c')](_0x374b2e,function(_0x3daa56){if(_0x3daa56[_0xe6da('0x30')]!=='VIRTUAL'){var _0x1fbd2d={};_0x1fbd2d[_0x3daa56[_0xe6da('0x2a')]]={'$like':'%'+_0x34777b[_0xe6da('0x35')][_0xe6da('0x3c')]+'%'};return _0x1fbd2d;}})});}_0x14e321=_[_0xe6da('0x3e')]({},_0x14e321,_0x34777b[_0xe6da('0x3f')]);var _0x4d4361={'where':_0x14e321[_0xe6da('0x3d')]};return db[_0xe6da('0x2d')][_0xe6da('0x1e')](_0x4d4361)[_0xe6da('0x26')](function(_0x53f4e0){_0x116bb4[_0xe6da('0x1e')]=_0x53f4e0;if(_0x34777b[_0xe6da('0x35')]['includeAll']){_0x14e321[_0xe6da('0x40')]=[{'all':!![]}];}return db[_0xe6da('0x2d')][_0xe6da('0x41')](_0x14e321);})[_0xe6da('0x26')](function(_0x2f69b1){_0x116bb4['rows']=_0x2f69b1;return _0x116bb4;})[_0xe6da('0x26')](respondWithFilteredResult(_0x30cf32,_0x14e321))[_0xe6da('0x42')](handleError(_0x30cf32,null));};exports[_0xe6da('0x43')]=function(_0x4932c9,_0x107dfa){var _0x3e1351={'raw':![],'where':{'id':_0x4932c9[_0xe6da('0x44')]['id']}},_0x5b3262={};_0x5b3262[_0xe6da('0x34')]=_[_0xe6da('0x31')](db['ZohoAccount'][_0xe6da('0x2e')]);_0x5b3262[_0xe6da('0x35')]=_[_0xe6da('0x31')](_0x4932c9['query']);_0x5b3262[_0xe6da('0x32')]=_['intersection'](_0x5b3262[_0xe6da('0x34')],_0x5b3262[_0xe6da('0x35')]);_0x3e1351[_0xe6da('0x36')]=_[_0xe6da('0x33')](_0x5b3262[_0xe6da('0x34')],qs[_0xe6da('0x45')](_0x4932c9[_0xe6da('0x35')][_0xe6da('0x45')]));_0x3e1351[_0xe6da('0x36')]=_0x3e1351['attributes'][_0xe6da('0x37')]?_0x3e1351['attributes']:_0x5b3262[_0xe6da('0x34')];if(_0x4932c9[_0xe6da('0x35')]['includeAll']){_0x3e1351[_0xe6da('0x40')]=[{'all':!![]}];}_0x3e1351=_['merge']({},_0x3e1351,_0x4932c9[_0xe6da('0x3f')]);return db[_0xe6da('0x2d')][_0xe6da('0x46')](_0x3e1351)[_0xe6da('0x26')](handleEntityNotFound(_0x107dfa,null))[_0xe6da('0x26')](respondWithResult(_0x107dfa,null))[_0xe6da('0x42')](handleError(_0x107dfa,null));};exports['create']=function(_0xc324bd,_0x170aea){return db[_0xe6da('0x2d')][_0xe6da('0x47')](_0xc324bd[_0xe6da('0x48')],{})[_0xe6da('0x26')](respondWithResult(_0x170aea,0xc9))[_0xe6da('0x42')](handleError(_0x170aea,null));};exports[_0xe6da('0x25')]=function(_0x4e1526,_0x1f6e02){if(_0x4e1526['body']['id']){delete _0x4e1526[_0xe6da('0x48')]['id'];}return db[_0xe6da('0x2d')]['find']({'where':{'id':_0x4e1526[_0xe6da('0x44')]['id']}})[_0xe6da('0x26')](handleEntityNotFound(_0x1f6e02,null))[_0xe6da('0x26')](saveUpdates(_0x4e1526[_0xe6da('0x48')],null))[_0xe6da('0x26')](respondWithResult(_0x1f6e02,null))[_0xe6da('0x42')](handleError(_0x1f6e02,null));};exports[_0xe6da('0x27')]=function(_0x188913,_0x3efa87){return db['ZohoAccount'][_0xe6da('0x46')]({'where':{'id':_0x188913['params']['id']}})['then'](handleEntityNotFound(_0x3efa87,null))[_0xe6da('0x26')](removeEntity(_0x3efa87,null))[_0xe6da('0x42')](handleError(_0x3efa87,null));};exports[_0xe6da('0x49')]=function(_0x3c7612,_0x148144,_0x1d5115){var _0x3dff8c={};var _0x164222={};var _0xa33761;var _0x2ff1c2;return db['ZohoAccount'][_0xe6da('0x4a')]({'where':{'id':_0x3c7612['params']['id']}})[_0xe6da('0x26')](handleEntityNotFound(_0x148144,null))[_0xe6da('0x26')](function(_0x4c37f2){if(_0x4c37f2){_0xa33761=_0x4c37f2;_0x164222[_0xe6da('0x34')]=_[_0xe6da('0x31')](db[_0xe6da('0x4b')][_0xe6da('0x2e')]);_0x164222[_0xe6da('0x35')]=_[_0xe6da('0x31')](_0x3c7612[_0xe6da('0x35')]);_0x164222[_0xe6da('0x32')]=_[_0xe6da('0x33')](_0x164222[_0xe6da('0x34')],_0x164222[_0xe6da('0x35')]);_0x3dff8c['attributes']=_['intersection'](_0x164222[_0xe6da('0x34')],qs['fields'](_0x3c7612[_0xe6da('0x35')]['fields']));_0x3dff8c[_0xe6da('0x36')]=_0x3dff8c['attributes']['length']?_0x3dff8c[_0xe6da('0x36')]:_0x164222[_0xe6da('0x34')];_0x3dff8c[_0xe6da('0x3a')]=qs['sort'](_0x3c7612[_0xe6da('0x35')][_0xe6da('0x4c')]);_0x3dff8c[_0xe6da('0x3d')]=qs['filters'](_[_0xe6da('0x3b')](_0x3c7612[_0xe6da('0x35')],_0x164222['filters']));if(_0x3c7612[_0xe6da('0x35')][_0xe6da('0x3c')]){_0x3dff8c[_0xe6da('0x3d')]=_[_0xe6da('0x3e')](_0x3dff8c[_0xe6da('0x3d')],{'$or':_[_0xe6da('0x2c')](_0x3dff8c[_0xe6da('0x36')],function(_0x4fecff){var _0xf03b06={};_0xf03b06[_0x4fecff]={'$like':'%'+_0x3c7612[_0xe6da('0x35')][_0xe6da('0x3c')]+'%'};return _0xf03b06;})});}_0x3dff8c=_[_0xe6da('0x3e')]({},_0x3dff8c,_0x3c7612[_0xe6da('0x3f')]);return _0xa33761['getConfigurations'](_0x3dff8c);}})['then'](function(_0x30b738){if(_0x30b738){_0x2ff1c2=_0x30b738[_0xe6da('0x37')];if(!_0x3c7612[_0xe6da('0x35')][_0xe6da('0x38')](_0xe6da('0x39'))){_0x3dff8c[_0xe6da('0x1d')]=qs[_0xe6da('0x1d')](_0x3c7612[_0xe6da('0x35')][_0xe6da('0x1d')]);_0x3dff8c['offset']=qs[_0xe6da('0x1f')](_0x3c7612['query'][_0xe6da('0x1f')]);}return _0xa33761['getConfigurations'](_0x3dff8c);}})['then'](function(_0x36fb06){if(_0x36fb06){return _0x36fb06?{'count':_0x2ff1c2,'rows':_0x36fb06}:null;}})[_0xe6da('0x26')](respondWithResult(_0x148144,null))[_0xe6da('0x42')](handleError(_0x148144,null));};exports['addConfiguration']=function(_0x580a30,_0x525541,_0x1e1889){if(_0x580a30['body']['id']){delete _0x580a30['body']['id'];}return db['ZohoAccount'][_0xe6da('0x4a')]({'where':{'id':_0x580a30[_0xe6da('0x44')]['id']}})['then'](handleEntityNotFound(_0x525541,null))[_0xe6da('0x26')](function(_0x34a44d){if(_0x34a44d){_0x580a30['body'][_0xe6da('0x4d')]=_0x34a44d['id'];_0x580a30[_0xe6da('0x48')][_0xe6da('0x4e')]=integrations['getSubjects'](_0x580a30['body'][_0xe6da('0x4f')],_0x580a30[_0xe6da('0x48')][_0xe6da('0x30')]);_0x580a30['body'][_0xe6da('0x50')]=integrations[_0xe6da('0x51')](_0x580a30[_0xe6da('0x48')]['channel'],_0x580a30[_0xe6da('0x48')][_0xe6da('0x30')]);return db[_0xe6da('0x4b')][_0xe6da('0x47')](_0x580a30[_0xe6da('0x48')],{'include':[{'model':db[_0xe6da('0x52')],'as':_0xe6da('0x4e')},{'model':db[_0xe6da('0x52')],'as':_0xe6da('0x50')}]});}return null;})[_0xe6da('0x26')](respondWithResult(_0x525541,null))[_0xe6da('0x42')](handleError(_0x525541,null));};function getAccessToken(_0x328813){return new Promise(function(_0x247a72,_0x179d82){var _0x27d141;switch(_0x328813[_0xe6da('0x53')]){case'US':_0x27d141=_0xe6da('0x54');break;case'AU':_0x27d141='https://accounts.zoho.com.au';break;case'EU':_0x27d141='https://accounts.zoho.eu';break;case'IN':_0x27d141=_0xe6da('0x55');break;case'CN':_0x27d141='https://accounts.zoho.com.cn';break;default:_0x27d141=_0xe6da('0x56');break;}var _0xeab74={'method':_0xe6da('0x57'),'uri':_0x27d141+_0xe6da('0x58'),'qs':{'refresh_token':_0x328813[_0xe6da('0x59')],'client_id':_0x328813[_0xe6da('0x5a')],'client_secret':_0x328813['clientSecret'],'grant_type':_0xe6da('0x5b')},'json':!![]};return rp(_0xeab74)[_0xe6da('0x26')](function(_0xf688d7){if(_0xf688d7[_0xe6da('0x5c')]){_0x247a72(_0xf688d7[_0xe6da('0x5c')]);}else{_0x179d82(_0xe6da('0x5d'));}})[_0xe6da('0x42')](function(_0x224d42){_0x179d82(_0x224d42);});});}exports[_0xe6da('0x5e')]=function(_0xb67682,_0x1870de,_0x340619){var _0x1c16c3,_0x3c65af,_0x857869,_0x3320ad,_0x58b76e;return db[_0xe6da('0x2d')][_0xe6da('0x4a')]({'where':{'id':_0xb67682[_0xe6da('0x44')]['id']},'attributes':['id',_0xe6da('0x5f'),_0xe6da('0x53'),_0xe6da('0x5a'),_0xe6da('0x60'),_0xe6da('0x61'),'code',_0xe6da('0x59')]})['then'](handleEntityNotFound(_0x1870de,null))[_0xe6da('0x26')](function(_0x39d342){_0x58b76e=_0x39d342;_0x1c16c3=_0x58b76e[_0xe6da('0x5f')];_0x3c65af=_0x1c16c3===_0xe6da('0x62')?'eu':'com';_0x857869=_0x58b76e[_0xe6da('0x61')];var _0xcfbbb1=_0x857869[_0xe6da('0x63')](-0x1);if(_0xcfbbb1==='/'||_0xcfbbb1==='\x5c'||_0xcfbbb1===':'){_0x857869=_0x857869[_0xe6da('0x64')](0x0,_0x857869['lastIndexOf'](_0xcfbbb1));}if(!_0x58b76e['refreshToken']){throw new Error(_0xe6da('0x65'));}return getAccessToken(_0x58b76e);})['then'](function(_0x29d2c4){if(_0x29d2c4){return rp({'method':_0xe6da('0x66'),'uri':util[_0xe6da('0x67')](_0xe6da('0x68'),_0x3c65af),'qs':{'module':_0xe6da('0x69')},'headers':{'Authorization':_0xe6da('0x6a')+_0x29d2c4},'json':!![]});}})[_0xe6da('0x26')](function(_0x5ce648){if(_0x5ce648){if(_0x5ce648[_0xe6da('0x6b')]&&_0x5ce648[_0xe6da('0x6b')][_0xe6da('0x28')]){throw new Error(_0x5ce648['response'][_0xe6da('0x28')][_0xe6da('0x6c')]);}var _0x193908=[];var _0x777468=[];var _0x3ab1bb=[_0xe6da('0x6d'),_0xe6da('0x6e'),_0xe6da('0x6f'),'WhoId',_0xe6da('0x70'),_0xe6da('0x71'),_0xe6da('0x72'),'Call_Type'];_0x777468=_[_0xe6da('0x73')](_0x5ce648[_0xe6da('0x45')],function(_0x3c2242){return _0x3ab1bb[_0xe6da('0x74')](_0x3c2242[_0xe6da('0x75')]);});for(var _0x14b2c9=0x0;_0x14b2c9<_0x777468[_0xe6da('0x37')];_0x14b2c9++){if(_0x777468[_0x14b2c9][_0xe6da('0x76')]===![]){_0x193908[_0xe6da('0x77')]({'id':_0x777468[_0x14b2c9]['id'],'name':_0x777468[_0x14b2c9][_0xe6da('0x78')],'custom':_0x777468[_0x14b2c9][_0xe6da('0x79')],'options':_0x777468[_0x14b2c9][_0xe6da('0x7a')]===_0xe6da('0x7b')&&_0x777468[_0x14b2c9][_0xe6da('0x7c')][_0xe6da('0x37')]>-0x1?_[_0xe6da('0x2c')](_0x777468[_0x14b2c9]['pick_list_values'],function(_0x3ca4ec){return{'name':_0x3ca4ec,'value':_0x3ca4ec};}):[]});}}return{'count':_0x193908[_0xe6da('0x37')],'rows':_0x193908};}else{return{'count':0x0,'rows':[]};}})[_0xe6da('0x26')](respondWithResult(_0x1870de,null))[_0xe6da('0x42')](function(_0x460a20){var _0x2e3cfc=_0xb67682[_0xe6da('0x35')]['test']?0x1f4:_0x460a20[_0xe6da('0x7d')]||0x1f4;logger['error'](_0xe6da('0x7e'),'getFields',_0x2e3cfc,JSON[_0xe6da('0x7f')](_0x460a20));delete _0x460a20['name'];if(_0x2e3cfc===0x191){_0x2e3cfc=0x190;}_0x1870de[_0xe6da('0x20')](_0x2e3cfc)['send'](_0xb67682[_0xe6da('0x35')]['test']?{'message':_0xe6da('0x80'),'statusCode':_0x460a20[_0xe6da('0x7d')]}:_0x460a20);});}; \ No newline at end of file +var _0x464d=['stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','getConfigurations','ZohoConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','findOne','host','clientId','serverUrl','zoho.eu','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','display_label','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','sendStatus','error'];(function(_0x3120e6,_0x324456){var _0x5b739f=function(_0x2e03ab){while(--_0x2e03ab){_0x3120e6['push'](_0x3120e6['shift']());}};_0x5b739f(++_0x324456);}(_0x464d,0x151));var _0xd464=function(_0x5a9e94,_0x54b889){_0x5a9e94=_0x5a9e94-0x0;var _0x5bc016=_0x464d[_0x5a9e94];return _0x5bc016;};'use strict';var emlformat=require(_0xd464('0x0'));var rimraf=require(_0xd464('0x1'));var zipdir=require(_0xd464('0x2'));var jsonpatch=require(_0xd464('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd464('0x4'));var Mustache=require(_0xd464('0x5'));var util=require(_0xd464('0x6'));var path=require(_0xd464('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd464('0x8'));var fs=require('fs');var fs_extra=require(_0xd464('0x9'));var _=require(_0xd464('0xa'));var squel=require(_0xd464('0xb'));var crypto=require(_0xd464('0xc'));var jsforce=require(_0xd464('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd464('0xe'));var querystring=require(_0xd464('0xf'));var Papa=require(_0xd464('0x10'));var Redis=require(_0xd464('0x11'));var authService=require(_0xd464('0x12'));var qs=require(_0xd464('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd464('0x14'));var utils=require(_0xd464('0x15'));var config=require(_0xd464('0x16'));var licenseUtil=require(_0xd464('0x17'));var db=require(_0xd464('0x18'))['db'];var integrations=require(_0xd464('0x19'));function respondWithStatusCode(_0x1e835b,_0x26ffa7){_0x26ffa7=_0x26ffa7||0xcc;return function(_0x3756b4){if(_0x3756b4){return _0x1e835b['sendStatus'](_0x26ffa7);}return _0x1e835b[_0xd464('0x1a')](_0x26ffa7)[_0xd464('0x1b')]();};}function respondWithResult(_0x111ee2,_0x19be6c){_0x19be6c=_0x19be6c||0xc8;return function(_0x42c668){if(_0x42c668){return _0x111ee2[_0xd464('0x1a')](_0x19be6c)[_0xd464('0x1c')](_0x42c668);}};}function respondWithFilteredResult(_0x15dd81,_0x2e0799){return function(_0x2faa56){if(_0x2faa56){var _0x18b718=typeof _0x2e0799[_0xd464('0x1d')]==='undefined'&&typeof _0x2e0799[_0xd464('0x1e')]===_0xd464('0x1f');var _0x4c2eed=_0x2faa56[_0xd464('0x20')];var _0x301896=_0x18b718?0x0:_0x2e0799[_0xd464('0x1d')];var _0x222957=_0x18b718?_0x2faa56[_0xd464('0x20')]:_0x2e0799[_0xd464('0x1d')]+_0x2e0799[_0xd464('0x1e')];var _0x3a2be4;if(_0x222957>=_0x4c2eed){_0x222957=_0x4c2eed;_0x3a2be4=0xc8;}else{_0x3a2be4=0xce;}_0x15dd81[_0xd464('0x1a')](_0x3a2be4);return _0x15dd81[_0xd464('0x21')](_0xd464('0x22'),_0x301896+'-'+_0x222957+'/'+_0x4c2eed)[_0xd464('0x1c')](_0x2faa56);}return null;};}function patchUpdates(_0x511b48){return function(_0x2c11cc){try{jsonpatch[_0xd464('0x23')](_0x2c11cc,_0x511b48,!![]);}catch(_0x205336){return BPromise['reject'](_0x205336);}return _0x2c11cc[_0xd464('0x24')]();};}function saveUpdates(_0x1fb0d2,_0x27d149){return function(_0x2ddcd8){if(_0x2ddcd8){return _0x2ddcd8[_0xd464('0x25')](_0x1fb0d2)[_0xd464('0x26')](function(_0x1e4d6f){return _0x1e4d6f;});}return null;};}function removeEntity(_0x5e937b,_0x26b532){return function(_0x403b4c){if(_0x403b4c){return _0x403b4c['destroy']()['then'](function(){_0x5e937b[_0xd464('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27848d,_0x24f850){return function(_0x50516d){if(!_0x50516d){_0x27848d[_0xd464('0x27')](0x194);}return _0x50516d;};}function handleError(_0xa6b614,_0x4cf73b){_0x4cf73b=_0x4cf73b||0x1f4;return function(_0x89f5c4){logger[_0xd464('0x28')](_0x89f5c4[_0xd464('0x29')]);if(_0x89f5c4[_0xd464('0x2a')]){delete _0x89f5c4['name'];}_0xa6b614[_0xd464('0x1a')](_0x4cf73b)[_0xd464('0x2b')](_0x89f5c4);};}exports[_0xd464('0x2c')]=function(_0x2ae68c,_0x33ebc8){var _0x4debad={},_0x1b339a={},_0xa65405={'count':0x0,'rows':[]};var _0xb85c11=_[_0xd464('0x2d')](db[_0xd464('0x2e')][_0xd464('0x2f')],function(_0x900af9){return{'name':_0x900af9[_0xd464('0x30')],'type':_0x900af9[_0xd464('0x31')][_0xd464('0x32')]};});_0x1b339a[_0xd464('0x33')]=_[_0xd464('0x2d')](_0xb85c11,'name');_0x1b339a[_0xd464('0x34')]=_['keys'](_0x2ae68c[_0xd464('0x34')]);_0x1b339a[_0xd464('0x35')]=_['intersection'](_0x1b339a[_0xd464('0x33')],_0x1b339a['query']);_0x4debad[_0xd464('0x36')]=_[_0xd464('0x37')](_0x1b339a[_0xd464('0x33')],qs[_0xd464('0x38')](_0x2ae68c['query'][_0xd464('0x38')]));_0x4debad[_0xd464('0x36')]=_0x4debad[_0xd464('0x36')][_0xd464('0x39')]?_0x4debad['attributes']:_0x1b339a['model'];if(!_0x2ae68c['query'][_0xd464('0x3a')](_0xd464('0x3b'))){_0x4debad[_0xd464('0x1e')]=qs[_0xd464('0x1e')](_0x2ae68c['query'][_0xd464('0x1e')]);_0x4debad[_0xd464('0x1d')]=qs['offset'](_0x2ae68c[_0xd464('0x34')][_0xd464('0x1d')]);}_0x4debad[_0xd464('0x3c')]=qs[_0xd464('0x3d')](_0x2ae68c['query'][_0xd464('0x3d')]);_0x4debad['where']=qs[_0xd464('0x35')](_[_0xd464('0x3e')](_0x2ae68c[_0xd464('0x34')],_0x1b339a[_0xd464('0x35')]),_0xb85c11);if(_0x2ae68c[_0xd464('0x34')][_0xd464('0x3f')]){_0x4debad['where']=_['merge'](_0x4debad[_0xd464('0x40')],{'$or':_[_0xd464('0x2d')](_0xb85c11,function(_0x32fd51){if(_0x32fd51[_0xd464('0x31')]!==_0xd464('0x41')){var _0x4ffff5={};_0x4ffff5[_0x32fd51['name']]={'$like':'%'+_0x2ae68c[_0xd464('0x34')][_0xd464('0x3f')]+'%'};return _0x4ffff5;}})});}_0x4debad=_[_0xd464('0x42')]({},_0x4debad,_0x2ae68c[_0xd464('0x43')]);var _0x18b678={'where':_0x4debad[_0xd464('0x40')]};return db[_0xd464('0x2e')][_0xd464('0x20')](_0x18b678)['then'](function(_0x5e7ff1){_0xa65405[_0xd464('0x20')]=_0x5e7ff1;if(_0x2ae68c[_0xd464('0x34')]['includeAll']){_0x4debad[_0xd464('0x44')]=[{'all':!![]}];}return db['ZohoAccount'][_0xd464('0x45')](_0x4debad);})[_0xd464('0x26')](function(_0x23c9e3){_0xa65405[_0xd464('0x46')]=_0x23c9e3;return _0xa65405;})[_0xd464('0x26')](respondWithFilteredResult(_0x33ebc8,_0x4debad))[_0xd464('0x47')](handleError(_0x33ebc8,null));};exports[_0xd464('0x48')]=function(_0x55583c,_0x580b37){var _0x5d22a6={'raw':![],'where':{'id':_0x55583c[_0xd464('0x49')]['id']}},_0x51aacb={};_0x51aacb[_0xd464('0x33')]=_[_0xd464('0x4a')](db[_0xd464('0x2e')][_0xd464('0x2f')]);_0x51aacb[_0xd464('0x34')]=_['keys'](_0x55583c[_0xd464('0x34')]);_0x51aacb[_0xd464('0x35')]=_[_0xd464('0x37')](_0x51aacb[_0xd464('0x33')],_0x51aacb[_0xd464('0x34')]);_0x5d22a6[_0xd464('0x36')]=_[_0xd464('0x37')](_0x51aacb[_0xd464('0x33')],qs[_0xd464('0x38')](_0x55583c[_0xd464('0x34')][_0xd464('0x38')]));_0x5d22a6[_0xd464('0x36')]=_0x5d22a6['attributes']['length']?_0x5d22a6[_0xd464('0x36')]:_0x51aacb[_0xd464('0x33')];if(_0x55583c[_0xd464('0x34')][_0xd464('0x4b')]){_0x5d22a6[_0xd464('0x44')]=[{'all':!![]}];}_0x5d22a6=_[_0xd464('0x42')]({},_0x5d22a6,_0x55583c[_0xd464('0x43')]);return db['ZohoAccount'][_0xd464('0x4c')](_0x5d22a6)[_0xd464('0x26')](handleEntityNotFound(_0x580b37,null))[_0xd464('0x26')](respondWithResult(_0x580b37,null))[_0xd464('0x47')](handleError(_0x580b37,null));};exports[_0xd464('0x4d')]=function(_0x106283,_0x445aae){return db['ZohoAccount'][_0xd464('0x4d')](_0x106283[_0xd464('0x4e')],{})[_0xd464('0x26')](respondWithResult(_0x445aae,0xc9))[_0xd464('0x47')](handleError(_0x445aae,null));};exports[_0xd464('0x25')]=function(_0x2fc9a0,_0x3f567d){if(_0x2fc9a0[_0xd464('0x4e')]['id']){delete _0x2fc9a0[_0xd464('0x4e')]['id'];}return db[_0xd464('0x2e')][_0xd464('0x4c')]({'where':{'id':_0x2fc9a0[_0xd464('0x49')]['id']}})[_0xd464('0x26')](handleEntityNotFound(_0x3f567d,null))[_0xd464('0x26')](saveUpdates(_0x2fc9a0['body'],null))[_0xd464('0x26')](respondWithResult(_0x3f567d,null))[_0xd464('0x47')](handleError(_0x3f567d,null));};exports['destroy']=function(_0x2f58f9,_0x2c8fac){return db[_0xd464('0x2e')]['find']({'where':{'id':_0x2f58f9[_0xd464('0x49')]['id']}})[_0xd464('0x26')](handleEntityNotFound(_0x2c8fac,null))['then'](removeEntity(_0x2c8fac,null))[_0xd464('0x47')](handleError(_0x2c8fac,null));};exports[_0xd464('0x4f')]=function(_0x4d6305,_0x3dfe98,_0x2c9108){var _0x4d7f3b={};var _0x364f5a={};var _0x482862;var _0x5e6c76;return db[_0xd464('0x2e')]['findOne']({'where':{'id':_0x4d6305[_0xd464('0x49')]['id']}})[_0xd464('0x26')](handleEntityNotFound(_0x3dfe98,null))[_0xd464('0x26')](function(_0x341c2a){if(_0x341c2a){_0x482862=_0x341c2a;_0x364f5a[_0xd464('0x33')]=_[_0xd464('0x4a')](db[_0xd464('0x50')]['rawAttributes']);_0x364f5a[_0xd464('0x34')]=_['keys'](_0x4d6305[_0xd464('0x34')]);_0x364f5a[_0xd464('0x35')]=_[_0xd464('0x37')](_0x364f5a['model'],_0x364f5a[_0xd464('0x34')]);_0x4d7f3b[_0xd464('0x36')]=_[_0xd464('0x37')](_0x364f5a[_0xd464('0x33')],qs['fields'](_0x4d6305[_0xd464('0x34')][_0xd464('0x38')]));_0x4d7f3b[_0xd464('0x36')]=_0x4d7f3b['attributes'][_0xd464('0x39')]?_0x4d7f3b['attributes']:_0x364f5a['model'];_0x4d7f3b[_0xd464('0x3c')]=qs[_0xd464('0x3d')](_0x4d6305[_0xd464('0x34')][_0xd464('0x3d')]);_0x4d7f3b[_0xd464('0x40')]=qs[_0xd464('0x35')](_[_0xd464('0x3e')](_0x4d6305[_0xd464('0x34')],_0x364f5a['filters']));if(_0x4d6305[_0xd464('0x34')][_0xd464('0x3f')]){_0x4d7f3b[_0xd464('0x40')]=_[_0xd464('0x42')](_0x4d7f3b[_0xd464('0x40')],{'$or':_[_0xd464('0x2d')](_0x4d7f3b[_0xd464('0x36')],function(_0x4d6e62){var _0x28e50b={};_0x28e50b[_0x4d6e62]={'$like':'%'+_0x4d6305[_0xd464('0x34')][_0xd464('0x3f')]+'%'};return _0x28e50b;})});}_0x4d7f3b=_[_0xd464('0x42')]({},_0x4d7f3b,_0x4d6305['options']);return _0x482862['getConfigurations'](_0x4d7f3b);}})[_0xd464('0x26')](function(_0x71435b){if(_0x71435b){_0x5e6c76=_0x71435b['length'];if(!_0x4d6305[_0xd464('0x34')][_0xd464('0x3a')](_0xd464('0x3b'))){_0x4d7f3b[_0xd464('0x1e')]=qs[_0xd464('0x1e')](_0x4d6305[_0xd464('0x34')]['limit']);_0x4d7f3b[_0xd464('0x1d')]=qs[_0xd464('0x1d')](_0x4d6305['query'][_0xd464('0x1d')]);}return _0x482862[_0xd464('0x4f')](_0x4d7f3b);}})[_0xd464('0x26')](function(_0x27ec0f){if(_0x27ec0f){return _0x27ec0f?{'count':_0x5e6c76,'rows':_0x27ec0f}:null;}})['then'](respondWithResult(_0x3dfe98,null))[_0xd464('0x47')](handleError(_0x3dfe98,null));};exports['addConfiguration']=function(_0x4f6285,_0x35975e,_0x15d7cf){if(_0x4f6285[_0xd464('0x4e')]['id']){delete _0x4f6285[_0xd464('0x4e')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x4f6285[_0xd464('0x49')]['id']}})['then'](handleEntityNotFound(_0x35975e,null))[_0xd464('0x26')](function(_0x19962e){if(_0x19962e){_0x4f6285[_0xd464('0x4e')][_0xd464('0x51')]=_0x19962e['id'];_0x4f6285[_0xd464('0x4e')][_0xd464('0x52')]=integrations[_0xd464('0x53')](_0x4f6285[_0xd464('0x4e')][_0xd464('0x54')],_0x4f6285[_0xd464('0x4e')][_0xd464('0x31')]);_0x4f6285[_0xd464('0x4e')][_0xd464('0x55')]=integrations[_0xd464('0x56')](_0x4f6285[_0xd464('0x4e')][_0xd464('0x54')],_0x4f6285[_0xd464('0x4e')][_0xd464('0x31')]);return db[_0xd464('0x50')][_0xd464('0x4d')](_0x4f6285[_0xd464('0x4e')],{'include':[{'model':db[_0xd464('0x57')],'as':'Subjects'},{'model':db[_0xd464('0x57')],'as':_0xd464('0x55')}]});}return null;})[_0xd464('0x26')](respondWithResult(_0x35975e,null))['catch'](handleError(_0x35975e,null));};function getAccessToken(_0x54f6cd){return new Promise(function(_0xe401b1,_0x14e3cc){var _0x305a74;switch(_0x54f6cd[_0xd464('0x58')]){case'US':_0x305a74=_0xd464('0x59');break;case'AU':_0x305a74=_0xd464('0x5a');break;case'EU':_0x305a74=_0xd464('0x5b');break;case'IN':_0x305a74=_0xd464('0x5c');break;case'CN':_0x305a74=_0xd464('0x5d');break;default:_0x305a74=_0xd464('0x5b');break;}var _0x158947={'method':_0xd464('0x5e'),'uri':_0x305a74+'/oauth/v2/token','qs':{'refresh_token':_0x54f6cd[_0xd464('0x5f')],'client_id':_0x54f6cd['clientId'],'client_secret':_0x54f6cd[_0xd464('0x60')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x158947)[_0xd464('0x26')](function(_0x1288b5){if(_0x1288b5[_0xd464('0x61')]){_0xe401b1(_0x1288b5['access_token']);}else{_0x14e3cc(_0xd464('0x62'));}})[_0xd464('0x47')](function(_0x26fce9){_0x14e3cc(_0x26fce9);});});}exports[_0xd464('0x63')]=function(_0x4c747a,_0x49851a,_0x1cca8d){var _0x427f61,_0x47f689,_0x275bab,_0x4c9e71,_0x2b90e1;return db[_0xd464('0x2e')][_0xd464('0x64')]({'where':{'id':_0x4c747a['params']['id']},'attributes':['id',_0xd464('0x65'),'zone',_0xd464('0x66'),_0xd464('0x60'),_0xd464('0x67'),'code',_0xd464('0x5f')]})[_0xd464('0x26')](handleEntityNotFound(_0x49851a,null))['then'](function(_0xca868d){_0x2b90e1=_0xca868d;_0x427f61=_0x2b90e1['host'];_0x47f689=_0x427f61===_0xd464('0x68')?'eu':'com';_0x275bab=_0x2b90e1[_0xd464('0x67')];var _0x293a03=_0x275bab[_0xd464('0x69')](-0x1);if(_0x293a03==='/'||_0x293a03==='\x5c'||_0x293a03===':'){_0x275bab=_0x275bab['substring'](0x0,_0x275bab[_0xd464('0x6a')](_0x293a03));}if(!_0x2b90e1[_0xd464('0x5f')]){throw new Error(_0xd464('0x6b'));}return getAccessToken(_0x2b90e1);})['then'](function(_0x9258a1){if(_0x9258a1){return rp({'method':'GET','uri':util[_0xd464('0x6c')](_0xd464('0x6d'),_0x47f689),'qs':{'module':_0xd464('0x6e')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x9258a1},'json':!![]});}})[_0xd464('0x26')](function(_0x29a0f7){if(_0x29a0f7){if(_0x29a0f7['response']&&_0x29a0f7[_0xd464('0x6f')][_0xd464('0x28')]){throw new Error(_0x29a0f7[_0xd464('0x6f')][_0xd464('0x28')][_0xd464('0x70')]);}var _0x2334d6=[];var _0x4676dc=[];var _0x185c45=['Owner','Subject',_0xd464('0x71'),_0xd464('0x72'),_0xd464('0x73'),_0xd464('0x74'),_0xd464('0x75'),_0xd464('0x76')];_0x4676dc=_['remove'](_0x29a0f7[_0xd464('0x38')],function(_0x300934){return _0x185c45[_0xd464('0x77')](_0x300934[_0xd464('0x78')]);});for(var _0x289620=0x0;_0x289620<_0x4676dc['length'];_0x289620++){if(_0x4676dc[_0x289620]['system_mandatory']===![]){_0x2334d6['push']({'id':_0x4676dc[_0x289620]['id'],'name':_0x4676dc[_0x289620][_0xd464('0x79')],'custom':_0x4676dc[_0x289620]['custom_field'],'options':_0x4676dc[_0x289620][_0xd464('0x7a')]==='picklist'&&_0x4676dc[_0x289620][_0xd464('0x7b')][_0xd464('0x39')]>-0x1?_[_0xd464('0x2d')](_0x4676dc[_0x289620][_0xd464('0x7b')],function(_0x377ae7){return{'name':_0x377ae7,'value':_0x377ae7};}):[]});}}return{'count':_0x2334d6[_0xd464('0x39')],'rows':_0x2334d6};}else{return{'count':0x0,'rows':[]};}})[_0xd464('0x26')](respondWithResult(_0x49851a,null))[_0xd464('0x47')](function(_0x173e11){var _0x1c81e=_0x4c747a[_0xd464('0x34')]['test']?0x1f4:_0x173e11[_0xd464('0x7c')]||0x1f4;logger[_0xd464('0x28')](_0xd464('0x7d'),_0xd464('0x63'),_0x1c81e,JSON['stringify'](_0x173e11));delete _0x173e11[_0xd464('0x2a')];if(_0x1c81e===0x191){_0x1c81e=0x190;}_0x49851a['status'](_0x1c81e)[_0xd464('0x2b')](_0x4c747a[_0xd464('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x173e11[_0xd464('0x7c')]}:_0x173e11);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 71397fb..398121a 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 _0x5209=['request-promise','path','../../config/environment','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret','slice','substring','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','host','lastIndexOf','https://accounts.zoho.com.au','refreshToken','error','util','../../config/logger','api','moment','bluebird'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0x5209,0x17e));var _0x9520=function(_0x3787d7,_0x821963){_0x3787d7=_0x3787d7-0x0;var _0x5c9214=_0x5209[_0x3787d7];return _0x5c9214;};'use strict';var _=require('lodash');var util=require(_0x9520('0x0'));var logger=require(_0x9520('0x1'))(_0x9520('0x2'));var moment=require(_0x9520('0x3'));var BPromise=require(_0x9520('0x4'));var rp=require(_0x9520('0x5'));var fs=require('fs');var path=require(_0x9520('0x6'));var rimraf=require('rimraf');var config=require(_0x9520('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x9520('0x8')]=function(_0x8019e1,_0x3696d5){return _0x8019e1[_0x9520('0x9')](_0x9520('0xa'),attributes,{'tableName':_0x9520('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x56b6fe,_0x188b2e,_0x52cf18){if(_0x56b6fe['changed'](_0x9520('0xc'))||_0x56b6fe[_0x9520('0xd')](_0x9520('0xe'))||_0x56b6fe[_0x9520('0xd')](_0x9520('0xf'))||_0x56b6fe[_0x9520('0xd')](_0x9520('0x10'))||_0x56b6fe[_0x9520('0xd')]('code')||_0x56b6fe[_0x9520('0xd')]('host')){var _0x1af824,_0x5e1679;_0x1af824=_0x56b6fe[_0x9520('0xe')];var _0x59af72=_0x1af824[_0x9520('0x11')](-0x1);if(_0x59af72==='/'||_0x59af72==='\x5c'||_0x59af72===':'){_0x1af824=_0x1af824[_0x9520('0x12')](0x0,_0x1af824['lastIndexOf'](_0x59af72));}switch(_0x56b6fe[_0x9520('0xc')]){case'US':_0x5e1679=_0x9520('0x13');break;case'AU':_0x5e1679='https://accounts.zoho.com.au';break;case'IN':_0x5e1679=_0x9520('0x14');break;case'CN':_0x5e1679=_0x9520('0x15');break;default:_0x5e1679=_0x9520('0x16');break;}var _0x771582={'method':_0x9520('0x17'),'uri':_0x5e1679+_0x9520('0x18'),'form':{'grant_type':_0x9520('0x19'),'client_id':_0x56b6fe[_0x9520('0xf')],'client_secret':_0x56b6fe['clientSecret'],'redirect_uri':_0x56b6fe[_0x9520('0xe')],'code':_0x56b6fe[_0x9520('0x1a')]},'headers':{'Content-Type':_0x9520('0x1b')}};return rp(_0x771582)[_0x9520('0x1c')](function(_0xc24e16){var _0x179eb6=JSON[_0x9520('0x1d')](_0xc24e16);if(_0x179eb6[_0x9520('0x1e')]){_0x56b6fe['refreshToken']=_0x179eb6[_0x9520('0x1e')];logger[_0x9520('0x1f')](util[_0x9520('0x20')](_0x9520('0x21'),_0x56b6fe[_0x9520('0x22')],_0x56b6fe['id']));}else{logger['error'](util[_0x9520('0x20')](_0x9520('0x23'),_0x56b6fe['name'],_0x56b6fe['id']),util[_0x9520('0x24')](_0x179eb6,{'showHidden':![],'depth':null}));}return _0x52cf18(null,_0x188b2e);})[_0x9520('0x25')](function(_0xf32179){logger['error'](util[_0x9520('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x56b6fe[_0x9520('0x22')],_0x56b6fe['id']),util[_0x9520('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x52cf18(_0xf32179);});}else{return _0x52cf18(null,_0x188b2e);}},'beforeUpdate':function(_0x4aecf4,_0x1cc64f,_0x1ea846){if(_0x4aecf4[_0x9520('0xd')](_0x9520('0xc'))||_0x4aecf4[_0x9520('0xd')]('serverUrl')||_0x4aecf4[_0x9520('0xd')](_0x9520('0xf'))||_0x4aecf4[_0x9520('0xd')]('clientSecret')||_0x4aecf4[_0x9520('0xd')](_0x9520('0x1a'))||_0x4aecf4['changed'](_0x9520('0x26'))){var _0x15899e,_0x441c9b;_0x15899e=_0x4aecf4[_0x9520('0xe')];var _0x2525b7=_0x15899e['slice'](-0x1);if(_0x2525b7==='/'||_0x2525b7==='\x5c'||_0x2525b7===':'){_0x15899e=_0x15899e[_0x9520('0x12')](0x0,_0x15899e[_0x9520('0x27')](_0x2525b7));}switch(_0x4aecf4['zone']){case'US':_0x441c9b=_0x9520('0x13');break;case'AU':_0x441c9b=_0x9520('0x28');break;case'IN':_0x441c9b='https://accounts.zoho.in';break;case'CN':_0x441c9b=_0x9520('0x15');break;default:_0x441c9b=_0x9520('0x16');break;}var _0x252620={'method':_0x9520('0x17'),'uri':_0x441c9b+_0x9520('0x18'),'form':{'grant_type':_0x9520('0x19'),'client_id':_0x4aecf4[_0x9520('0xf')],'client_secret':_0x4aecf4[_0x9520('0x10')],'redirect_uri':_0x4aecf4[_0x9520('0xe')],'code':_0x4aecf4[_0x9520('0x1a')]},'headers':{'Content-Type':_0x9520('0x1b')}};return rp(_0x252620)[_0x9520('0x1c')](function(_0x56d752){var _0x1a8181=JSON[_0x9520('0x1d')](_0x56d752);if(_0x1a8181[_0x9520('0x1e')]){_0x4aecf4[_0x9520('0x29')]=_0x1a8181[_0x9520('0x1e')];logger[_0x9520('0x1f')](util['format'](_0x9520('0x21'),_0x4aecf4[_0x9520('0x22')],_0x4aecf4['id']));}else{logger[_0x9520('0x2a')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4aecf4['name'],_0x4aecf4['id']),util['inspect'](_0x1a8181,{'showHidden':![],'depth':null}));}return _0x1ea846(null,_0x1cc64f);})[_0x9520('0x25')](function(_0x490941){logger[_0x9520('0x2a')](util[_0x9520('0x20')](_0x9520('0x23'),_0x4aecf4[_0x9520('0x22')],_0x4aecf4['id']),util[_0x9520('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x1ea846(_0x490941);});}else{return _0x1ea846(null,_0x1cc64f);}}}});}; \ No newline at end of file +var _0xdde0=['https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','format','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','authorization_code','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in'];(function(_0x428dbd,_0x30eeb5){var _0xc411d8=function(_0x12cab8){while(--_0x12cab8){_0x428dbd['push'](_0x428dbd['shift']());}};_0xc411d8(++_0x30eeb5);}(_0xdde0,0xbe));var _0x0dde=function(_0x5dc1fc,_0x582a0b){_0x5dc1fc=_0x5dc1fc-0x0;var _0x35ca2a=_0xdde0[_0x5dc1fc];return _0x35ca2a;};'use strict';var _=require(_0x0dde('0x0'));var util=require(_0x0dde('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0dde('0x2'));var BPromise=require(_0x0dde('0x3'));var rp=require(_0x0dde('0x4'));var fs=require('fs');var path=require(_0x0dde('0x5'));var rimraf=require(_0x0dde('0x6'));var config=require('../../config/environment');var attributes=require(_0x0dde('0x7'));var integrations=require(_0x0dde('0x8'));module['exports']=function(_0x4490e1,_0x364051){return _0x4490e1[_0x0dde('0x9')](_0x0dde('0xa'),attributes,{'tableName':_0x0dde('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x34c397,_0x5bd0bd,_0x2b8a45){if(_0x34c397[_0x0dde('0xc')](_0x0dde('0xd'))||_0x34c397[_0x0dde('0xc')](_0x0dde('0xe'))||_0x34c397[_0x0dde('0xc')](_0x0dde('0xf'))||_0x34c397['changed'](_0x0dde('0x10'))||_0x34c397[_0x0dde('0xc')](_0x0dde('0x11'))||_0x34c397[_0x0dde('0xc')](_0x0dde('0x12'))){var _0x59bc17,_0x1040d8;_0x59bc17=_0x34c397[_0x0dde('0xe')];var _0x8879d1=_0x59bc17[_0x0dde('0x13')](-0x1);if(_0x8879d1==='/'||_0x8879d1==='\x5c'||_0x8879d1===':'){_0x59bc17=_0x59bc17[_0x0dde('0x14')](0x0,_0x59bc17[_0x0dde('0x15')](_0x8879d1));}switch(_0x34c397[_0x0dde('0xd')]){case'US':_0x1040d8=_0x0dde('0x16');break;case'AU':_0x1040d8=_0x0dde('0x17');break;case'IN':_0x1040d8=_0x0dde('0x18');break;case'CN':_0x1040d8=_0x0dde('0x19');break;default:_0x1040d8=_0x0dde('0x1a');break;}var _0x50bec1={'method':_0x0dde('0x1b'),'uri':_0x1040d8+_0x0dde('0x1c'),'form':{'grant_type':'authorization_code','client_id':_0x34c397['clientId'],'client_secret':_0x34c397['clientSecret'],'redirect_uri':_0x34c397[_0x0dde('0xe')],'code':_0x34c397['code']},'headers':{'Content-Type':_0x0dde('0x1d')}};return rp(_0x50bec1)[_0x0dde('0x1e')](function(_0x3cda40){var _0x21cabf=JSON[_0x0dde('0x1f')](_0x3cda40);if(_0x21cabf[_0x0dde('0x20')]){_0x34c397[_0x0dde('0x21')]=_0x21cabf[_0x0dde('0x20')];logger['info'](util[_0x0dde('0x22')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x34c397[_0x0dde('0x23')],_0x34c397['id']));}else{logger['error'](util['format'](_0x0dde('0x24'),_0x34c397[_0x0dde('0x23')],_0x34c397['id']),util[_0x0dde('0x25')](_0x21cabf,{'showHidden':![],'depth':null}));}return _0x2b8a45(null,_0x5bd0bd);})[_0x0dde('0x26')](function(_0x42dd2d){logger[_0x0dde('0x27')](util['format'](_0x0dde('0x24'),_0x34c397[_0x0dde('0x23')],_0x34c397['id']),util[_0x0dde('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x2b8a45(_0x42dd2d);});}else{return _0x2b8a45(null,_0x5bd0bd);}},'beforeUpdate':function(_0x1d6c2a,_0x4face5,_0x1c7bd3){if(_0x1d6c2a['changed'](_0x0dde('0xd'))||_0x1d6c2a[_0x0dde('0xc')](_0x0dde('0xe'))||_0x1d6c2a[_0x0dde('0xc')](_0x0dde('0xf'))||_0x1d6c2a[_0x0dde('0xc')](_0x0dde('0x10'))||_0x1d6c2a[_0x0dde('0xc')](_0x0dde('0x11'))||_0x1d6c2a['changed'](_0x0dde('0x12'))){var _0x2bf4a9,_0x55073f;_0x2bf4a9=_0x1d6c2a[_0x0dde('0xe')];var _0x1ff090=_0x2bf4a9['slice'](-0x1);if(_0x1ff090==='/'||_0x1ff090==='\x5c'||_0x1ff090===':'){_0x2bf4a9=_0x2bf4a9['substring'](0x0,_0x2bf4a9[_0x0dde('0x15')](_0x1ff090));}switch(_0x1d6c2a[_0x0dde('0xd')]){case'US':_0x55073f=_0x0dde('0x16');break;case'AU':_0x55073f=_0x0dde('0x17');break;case'IN':_0x55073f=_0x0dde('0x18');break;case'CN':_0x55073f=_0x0dde('0x19');break;default:_0x55073f=_0x0dde('0x1a');break;}var _0x24956f={'method':_0x0dde('0x1b'),'uri':_0x55073f+'/oauth/v2/token','form':{'grant_type':_0x0dde('0x28'),'client_id':_0x1d6c2a[_0x0dde('0xf')],'client_secret':_0x1d6c2a[_0x0dde('0x10')],'redirect_uri':_0x1d6c2a['serverUrl'],'code':_0x1d6c2a[_0x0dde('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x24956f)[_0x0dde('0x1e')](function(_0x418111){var _0x14ce8f=JSON[_0x0dde('0x1f')](_0x418111);if(_0x14ce8f['refresh_token']){_0x1d6c2a[_0x0dde('0x21')]=_0x14ce8f[_0x0dde('0x20')];logger[_0x0dde('0x29')](util[_0x0dde('0x22')](_0x0dde('0x2a'),_0x1d6c2a[_0x0dde('0x23')],_0x1d6c2a['id']));}else{logger[_0x0dde('0x27')](util[_0x0dde('0x22')](_0x0dde('0x24'),_0x1d6c2a['name'],_0x1d6c2a['id']),util[_0x0dde('0x25')](_0x14ce8f,{'showHidden':![],'depth':null}));}return _0x1c7bd3(null,_0x4face5);})['catch'](function(_0x13959c){logger[_0x0dde('0x27')](util[_0x0dde('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1d6c2a[_0x0dde('0x23')],_0x1d6c2a['id']),util[_0x0dde('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x1c7bd3(_0x13959c);});}else{return _0x1c7bd3(null,_0x4face5);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 341d721..5e8c13a 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 _0x15b8=['request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','include','map','model','find','ShowZohoAccount','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x15b8,0xcd));var _0x815b=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x15b8[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0x815b('0x0'));var moment=require(_0x815b('0x1'));var BPromise=require(_0x815b('0x2'));var rs=require(_0x815b('0x3'));var fs=require('fs');var Redis=require(_0x815b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x815b('0x5'));var logger=require(_0x815b('0x6'))(_0x815b('0x7'));var config=require(_0x815b('0x8'));var jayson=require(_0x815b('0x9'));var client=jayson[_0x815b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e9fc0,_0xdfdf6,_0x26119a){return new BPromise(function(_0x175053,_0x2170c5){return client[_0x815b('0xb')](_0x1e9fc0,_0x26119a)[_0x815b('0xc')](function(_0x221ce4){logger[_0x815b('0xd')](_0x815b('0xe'),_0xdfdf6,_0x815b('0xf'));logger[_0x815b('0x10')](_0x815b('0x11'),_0xdfdf6,_0x815b('0xf'),JSON[_0x815b('0x12')](_0x221ce4));if(_0x221ce4[_0x815b('0x13')]){if(_0x221ce4[_0x815b('0x13')][_0x815b('0x14')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0xdfdf6,_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);return _0x2170c5(_0x221ce4['error']['message']);}logger['error'](_0x815b('0xe'),_0xdfdf6,_0x221ce4['error']['message']);return _0x175053(_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);}else{logger[_0x815b('0xd')]('ZohoAccount,\x20%s,\x20%s',_0xdfdf6,'request\x20sent');_0x175053(_0x221ce4[_0x815b('0x16')][_0x815b('0x15')]);}})[_0x815b('0x17')](function(_0x4078db){logger[_0x815b('0x13')](_0x815b('0xe'),_0xdfdf6,_0x4078db);_0x2170c5(_0x4078db);});});}exports[_0x815b('0x18')]=function(_0x92d86a){var _0x26a8a3=this;return new Promise(function(_0x2fa2bd,_0x2ade43){return db[_0x815b('0x19')][_0x815b('0x1a')]({'raw':_0x92d86a['options']?_0x92d86a[_0x815b('0x1b')][_0x815b('0x1c')]===undefined?!![]:![]:!![],'where':_0x92d86a[_0x815b('0x1b')]?_0x92d86a[_0x815b('0x1b')][_0x815b('0x1d')]||null:null,'attributes':_0x92d86a['options']?_0x92d86a[_0x815b('0x1b')][_0x815b('0x1e')]||null:null,'limit':_0x92d86a[_0x815b('0x1b')]?_0x92d86a['options']['limit']||null:null,'include':_0x92d86a[_0x815b('0x1b')]?_0x92d86a[_0x815b('0x1b')][_0x815b('0x1f')]?_[_0x815b('0x20')](_0x92d86a[_0x815b('0x1b')][_0x815b('0x1f')],function(_0x11f1c1){return{'model':db[_0x11f1c1['model']],'as':_0x11f1c1['as'],'attributes':_0x11f1c1['attributes'],'include':_0x11f1c1[_0x815b('0x1f')]?_[_0x815b('0x20')](_0x11f1c1[_0x815b('0x1f')],function(_0x15098a){return{'model':db[_0x15098a[_0x815b('0x21')]],'as':_0x15098a['as'],'attributes':_0x15098a[_0x815b('0x1e')],'include':_0x15098a[_0x815b('0x1f')]?_[_0x815b('0x20')](_0x15098a['include'],function(_0x27b4e1){return{'model':db[_0x27b4e1[_0x815b('0x21')]],'as':_0x27b4e1['as'],'attributes':_0x27b4e1[_0x815b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8e4578){logger[_0x815b('0xd')]('GetZohoAccount',_0x92d86a);logger[_0x815b('0x10')](_0x815b('0x18'),_0x92d86a,JSON[_0x815b('0x12')](_0x8e4578));_0x2fa2bd(_0x8e4578);})[_0x815b('0x17')](function(_0xb04f){logger[_0x815b('0x13')](_0x815b('0x18'),_0xb04f[_0x815b('0x15')],_0x92d86a);_0x2ade43(_0x26a8a3[_0x815b('0x13')](0x1f4,_0xb04f[_0x815b('0x15')]));});});};exports['ShowZohoAccount']=function(_0x1ed8f1){var _0x2ba2a3=this;return new Promise(function(_0xa007e3,_0x36a799){return db[_0x815b('0x19')][_0x815b('0x22')]({'raw':_0x1ed8f1['options']?_0x1ed8f1[_0x815b('0x1b')][_0x815b('0x1c')]===undefined?!![]:![]:!![],'where':_0x1ed8f1[_0x815b('0x1b')]?_0x1ed8f1[_0x815b('0x1b')][_0x815b('0x1d')]||null:null,'attributes':_0x1ed8f1['options']?_0x1ed8f1[_0x815b('0x1b')]['attributes']||null:null,'include':_0x1ed8f1[_0x815b('0x1b')]?_0x1ed8f1[_0x815b('0x1b')][_0x815b('0x1f')]?_['map'](_0x1ed8f1[_0x815b('0x1b')]['include'],function(_0x530881){return{'model':db[_0x530881['model']],'as':_0x530881['as'],'attributes':_0x530881[_0x815b('0x1e')],'include':_0x530881['include']?_[_0x815b('0x20')](_0x530881['include'],function(_0x103baa){return{'model':db[_0x103baa[_0x815b('0x21')]],'as':_0x103baa['as'],'attributes':_0x103baa['attributes'],'include':_0x103baa[_0x815b('0x1f')]?_['map'](_0x103baa['include'],function(_0x2bc92b){return{'model':db[_0x2bc92b[_0x815b('0x21')]],'as':_0x2bc92b['as'],'attributes':_0x2bc92b[_0x815b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b76e6){logger[_0x815b('0xd')](_0x815b('0x23'),_0x1ed8f1);logger['debug'](_0x815b('0x23'),_0x1ed8f1,JSON[_0x815b('0x12')](_0x1b76e6));_0xa007e3(_0x1b76e6);})[_0x815b('0x17')](function(_0x539e37){logger[_0x815b('0x13')](_0x815b('0x23'),_0x539e37[_0x815b('0x15')],_0x1ed8f1);_0x36a799(_0x2ba2a3[_0x815b('0x13')](0x1f4,_0x539e37[_0x815b('0x15')]));});});}; \ No newline at end of file +var _0xcdd2=['jayson/promise','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','include','map','model','attributes','find','ShowZohoAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x35c313,_0x769389){var _0x3f8d5b=function(_0x522f4d){while(--_0x522f4d){_0x35c313['push'](_0x35c313['shift']());}};_0x3f8d5b(++_0x769389);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var moment=require(_0x2cdd('0x2'));var BPromise=require(_0x2cdd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cdd('0x4'));var db=require(_0x2cdd('0x5'))['db'];var utils=require(_0x2cdd('0x6'));var logger=require(_0x2cdd('0x7'))('rpc');var config=require(_0x2cdd('0x8'));var jayson=require(_0x2cdd('0x9'));var client=jayson['client'][_0x2cdd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36f9ad,_0x2647e6,_0x2ff8e0){return new BPromise(function(_0x506b09,_0x569943){return client['request'](_0x36f9ad,_0x2ff8e0)[_0x2cdd('0xb')](function(_0x4cd731){logger[_0x2cdd('0xc')](_0x2cdd('0xd'),_0x2647e6,_0x2cdd('0xe'));logger[_0x2cdd('0xf')](_0x2cdd('0x10'),_0x2647e6,_0x2cdd('0xe'),JSON[_0x2cdd('0x11')](_0x4cd731));if(_0x4cd731[_0x2cdd('0x12')]){if(_0x4cd731[_0x2cdd('0x12')][_0x2cdd('0x13')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x2647e6,_0x4cd731[_0x2cdd('0x12')][_0x2cdd('0x14')]);return _0x569943(_0x4cd731['error'][_0x2cdd('0x14')]);}logger[_0x2cdd('0x12')](_0x2cdd('0xd'),_0x2647e6,_0x4cd731[_0x2cdd('0x12')][_0x2cdd('0x14')]);return _0x506b09(_0x4cd731['error'][_0x2cdd('0x14')]);}else{logger[_0x2cdd('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x2647e6,_0x2cdd('0xe'));_0x506b09(_0x4cd731[_0x2cdd('0x15')][_0x2cdd('0x14')]);}})[_0x2cdd('0x16')](function(_0x3af7c8){logger[_0x2cdd('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x2647e6,_0x3af7c8);_0x569943(_0x3af7c8);});});}exports[_0x2cdd('0x17')]=function(_0x9491c8){var _0x281101=this;return new Promise(function(_0x23eb4e,_0x57fcb8){return db[_0x2cdd('0x18')][_0x2cdd('0x19')]({'raw':_0x9491c8[_0x2cdd('0x1a')]?_0x9491c8[_0x2cdd('0x1a')][_0x2cdd('0x1b')]===undefined?!![]:![]:!![],'where':_0x9491c8[_0x2cdd('0x1a')]?_0x9491c8[_0x2cdd('0x1a')][_0x2cdd('0x1c')]||null:null,'attributes':_0x9491c8[_0x2cdd('0x1a')]?_0x9491c8[_0x2cdd('0x1a')]['attributes']||null:null,'limit':_0x9491c8['options']?_0x9491c8[_0x2cdd('0x1a')]['limit']||null:null,'include':_0x9491c8['options']?_0x9491c8[_0x2cdd('0x1a')][_0x2cdd('0x1d')]?_[_0x2cdd('0x1e')](_0x9491c8[_0x2cdd('0x1a')]['include'],function(_0x5a7b76){return{'model':db[_0x5a7b76[_0x2cdd('0x1f')]],'as':_0x5a7b76['as'],'attributes':_0x5a7b76[_0x2cdd('0x20')],'include':_0x5a7b76[_0x2cdd('0x1d')]?_[_0x2cdd('0x1e')](_0x5a7b76[_0x2cdd('0x1d')],function(_0xdd4650){return{'model':db[_0xdd4650[_0x2cdd('0x1f')]],'as':_0xdd4650['as'],'attributes':_0xdd4650['attributes'],'include':_0xdd4650[_0x2cdd('0x1d')]?_[_0x2cdd('0x1e')](_0xdd4650[_0x2cdd('0x1d')],function(_0x5a8eff){return{'model':db[_0x5a8eff['model']],'as':_0x5a8eff['as'],'attributes':_0x5a8eff['attributes']};}):[]};}):[]};}):[]:[]})[_0x2cdd('0xb')](function(_0xcf73db){logger['info'](_0x2cdd('0x17'),_0x9491c8);logger[_0x2cdd('0xf')](_0x2cdd('0x17'),_0x9491c8,JSON[_0x2cdd('0x11')](_0xcf73db));_0x23eb4e(_0xcf73db);})[_0x2cdd('0x16')](function(_0x33117f){logger['error'](_0x2cdd('0x17'),_0x33117f[_0x2cdd('0x14')],_0x9491c8);_0x57fcb8(_0x281101[_0x2cdd('0x12')](0x1f4,_0x33117f[_0x2cdd('0x14')]));});});};exports['ShowZohoAccount']=function(_0x447051){var _0x1ab62e=this;return new Promise(function(_0x4b5916,_0x1ca10a){return db[_0x2cdd('0x18')][_0x2cdd('0x21')]({'raw':_0x447051[_0x2cdd('0x1a')]?_0x447051[_0x2cdd('0x1a')][_0x2cdd('0x1b')]===undefined?!![]:![]:!![],'where':_0x447051[_0x2cdd('0x1a')]?_0x447051[_0x2cdd('0x1a')][_0x2cdd('0x1c')]||null:null,'attributes':_0x447051['options']?_0x447051[_0x2cdd('0x1a')][_0x2cdd('0x20')]||null:null,'include':_0x447051[_0x2cdd('0x1a')]?_0x447051['options']['include']?_['map'](_0x447051[_0x2cdd('0x1a')][_0x2cdd('0x1d')],function(_0x5379ce){return{'model':db[_0x5379ce[_0x2cdd('0x1f')]],'as':_0x5379ce['as'],'attributes':_0x5379ce[_0x2cdd('0x20')],'include':_0x5379ce[_0x2cdd('0x1d')]?_[_0x2cdd('0x1e')](_0x5379ce[_0x2cdd('0x1d')],function(_0x5a10b7){return{'model':db[_0x5a10b7['model']],'as':_0x5a10b7['as'],'attributes':_0x5a10b7[_0x2cdd('0x20')],'include':_0x5a10b7[_0x2cdd('0x1d')]?_[_0x2cdd('0x1e')](_0x5a10b7[_0x2cdd('0x1d')],function(_0x41156e){return{'model':db[_0x41156e['model']],'as':_0x41156e['as'],'attributes':_0x41156e[_0x2cdd('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2cdd('0xb')](function(_0x3bfc78){logger[_0x2cdd('0xc')](_0x2cdd('0x22'),_0x447051);logger[_0x2cdd('0xf')](_0x2cdd('0x22'),_0x447051,JSON['stringify'](_0x3bfc78));_0x4b5916(_0x3bfc78);})[_0x2cdd('0x16')](function(_0x3d3421){logger[_0x2cdd('0x12')](_0x2cdd('0x22'),_0x3d3421[_0x2cdd('0x14')],_0x447051);_0x1ca10a(_0x1ab62e[_0x2cdd('0x12')](0x1f4,_0x3d3421[_0x2cdd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index f277f87..f886314 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 _0x8db9=['../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4431a0,_0x302db9){var _0x5cad39=function(_0x43ac81){while(--_0x43ac81){_0x4431a0['push'](_0x4431a0['shift']());}};_0x5cad39(++_0x302db9);}(_0x8db9,0x1c0));var _0x98db=function(_0x312a5c,_0x59990a){_0x312a5c=_0x312a5c-0x0;var _0x329f31=_0x8db9[_0x312a5c];return _0x329f31;};'use strict';var multer=require(_0x98db('0x0'));var util=require(_0x98db('0x1'));var path=require('path');var timeout=require(_0x98db('0x2'));var express=require(_0x98db('0x3'));var router=express[_0x98db('0x4')]();var fs_extra=require(_0x98db('0x5'));var auth=require(_0x98db('0x6'));var interaction=require(_0x98db('0x7'));var config=require(_0x98db('0x8'));var controller=require(_0x98db('0x9'));router['get']('/',auth[_0x98db('0xa')](),controller[_0x98db('0xb')]);router[_0x98db('0xc')](_0x98db('0xd'),auth[_0x98db('0xa')](),controller['show']);router[_0x98db('0xc')]('/:id/fields',auth[_0x98db('0xa')](),controller[_0x98db('0xe')]);router[_0x98db('0xc')](_0x98db('0xf'),auth[_0x98db('0xa')](),controller['getSubjects']);router['get'](_0x98db('0x10'),auth['isAuthenticated'](),controller[_0x98db('0x11')]);router[_0x98db('0x12')]('/',auth['isAuthenticated'](),controller[_0x98db('0x13')]);router[_0x98db('0x14')](_0x98db('0xd'),auth[_0x98db('0xa')](),controller[_0x98db('0x15')]);router[_0x98db('0x16')](_0x98db('0xd'),auth[_0x98db('0xa')](),controller['destroy']);module[_0x98db('0x17')]=router; \ No newline at end of file +var _0x16de=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1a4134,_0x110ba3){var _0xce32ce=function(_0x56edb5){while(--_0x56edb5){_0x1a4134['push'](_0x1a4134['shift']());}};_0xce32ce(++_0x110ba3);}(_0x16de,0xc9));var _0xe16d=function(_0x504675,_0x5d4909){_0x504675=_0x504675-0x0;var _0x49b903=_0x16de[_0x504675];return _0x49b903;};'use strict';var multer=require(_0xe16d('0x0'));var util=require(_0xe16d('0x1'));var path=require(_0xe16d('0x2'));var timeout=require(_0xe16d('0x3'));var express=require(_0xe16d('0x4'));var router=express[_0xe16d('0x5')]();var fs_extra=require(_0xe16d('0x6'));var auth=require(_0xe16d('0x7'));var interaction=require(_0xe16d('0x8'));var config=require(_0xe16d('0x9'));var controller=require(_0xe16d('0xa'));router[_0xe16d('0xb')]('/',auth[_0xe16d('0xc')](),controller[_0xe16d('0xd')]);router[_0xe16d('0xb')](_0xe16d('0xe'),auth[_0xe16d('0xc')](),controller[_0xe16d('0xf')]);router[_0xe16d('0xb')](_0xe16d('0x10'),auth[_0xe16d('0xc')](),controller['getFields']);router[_0xe16d('0xb')](_0xe16d('0x11'),auth['isAuthenticated'](),controller[_0xe16d('0x12')]);router[_0xe16d('0xb')](_0xe16d('0x13'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xe16d('0x14')]('/',auth[_0xe16d('0xc')](),controller[_0xe16d('0x15')]);router[_0xe16d('0x16')](_0xe16d('0xe'),auth[_0xe16d('0xc')](),controller[_0xe16d('0x17')]);router[_0xe16d('0x18')](_0xe16d('0xe'),auth[_0xe16d('0xc')](),controller['destroy']);module[_0xe16d('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index d67964b..7676189 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 _0xf179=['exports','STRING','lead','contact','nothing','ENUM','contact_lead','sequelize'];(function(_0x1aebfe,_0xb00c5b){var _0x3f0f9b=function(_0x291391){while(--_0x291391){_0x1aebfe['push'](_0x1aebfe['shift']());}};_0x3f0f9b(++_0xb00c5b);}(_0xf179,0x87));var _0x9f17=function(_0x156bf4,_0x3f99aa){_0x156bf4=_0x156bf4-0x0;var _0x1272cb=_0xf179[_0x156bf4];return _0x1272cb;};'use strict';var Sequelize=require(_0x9f17('0x0'));module[_0x9f17('0x1')]={'name':{'type':Sequelize[_0x9f17('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x9f17('0x3'),_0x9f17('0x4'),_0x9f17('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x9f17('0x6')]('contact_lead',_0x9f17('0x4'),_0x9f17('0x3')),'defaultValue':_0x9f17('0x7')},'description':{'type':Sequelize[_0x9f17('0x2')]}}; \ No newline at end of file +var _0xb180=['exports','STRING','ENUM','lead','contact','nothing','contact_lead'];(function(_0x2bc870,_0x359ebc){var _0x56554e=function(_0x3d13df){while(--_0x3d13df){_0x2bc870['push'](_0x2bc870['shift']());}};_0x56554e(++_0x359ebc);}(_0xb180,0xa1));var _0x0b18=function(_0x2b4827,_0x29b5f4){_0x2b4827=_0x2b4827-0x0;var _0x2bda56=_0xb180[_0x2b4827];return _0x2bda56;};'use strict';var Sequelize=require('sequelize');module[_0x0b18('0x0')]={'name':{'type':Sequelize[_0x0b18('0x1')]},'moduleCreate':{'type':Sequelize[_0x0b18('0x2')](_0x0b18('0x3'),_0x0b18('0x4'),_0x0b18('0x5')),'defaultValue':_0x0b18('0x3')},'moduleSearch':{'type':Sequelize[_0x0b18('0x2')](_0x0b18('0x6'),_0x0b18('0x4'),_0x0b18('0x3')),'defaultValue':_0x0b18('0x6')},'description':{'type':Sequelize[_0x0b18('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index c335e1e..7856d18 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 _0x8a4c=['options','create','body','update','find','getFields','findOne','ZohoField','rawAttributes','order','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','map','ZohoConfiguration','type','key','model','query','keys','filters','fields','attributes','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','intersection','include'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8a4c,0x151));var _0xc8a4=function(_0xdaf736,_0xd8c667){_0xdaf736=_0xdaf736-0x0;var _0x1090b3=_0x8a4c[_0xdaf736];return _0x1090b3;};'use strict';var emlformat=require(_0xc8a4('0x0'));var rimraf=require(_0xc8a4('0x1'));var zipdir=require(_0xc8a4('0x2'));var jsonpatch=require(_0xc8a4('0x3'));var rp=require(_0xc8a4('0x4'));var moment=require(_0xc8a4('0x5'));var BPromise=require(_0xc8a4('0x6'));var Mustache=require('mustache');var util=require(_0xc8a4('0x7'));var path=require(_0xc8a4('0x8'));var sox=require('sox');var csv=require(_0xc8a4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc8a4('0xa'));var _=require(_0xc8a4('0xb'));var squel=require(_0xc8a4('0xc'));var crypto=require(_0xc8a4('0xd'));var jsforce=require(_0xc8a4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc8a4('0x9'));var querystring=require(_0xc8a4('0xf'));var Papa=require(_0xc8a4('0x10'));var Redis=require(_0xc8a4('0x11'));var authService=require(_0xc8a4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc8a4('0x13'));var hardwareService=require(_0xc8a4('0x14'));var logger=require('../../config/logger')(_0xc8a4('0x15'));var utils=require(_0xc8a4('0x16'));var config=require(_0xc8a4('0x17'));var licenseUtil=require(_0xc8a4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13503b,_0x4d000d){_0x4d000d=_0x4d000d||0xcc;return function(_0x2fbd7e){if(_0x2fbd7e){return _0x13503b[_0xc8a4('0x19')](_0x4d000d);}return _0x13503b[_0xc8a4('0x1a')](_0x4d000d)[_0xc8a4('0x1b')]();};}function respondWithResult(_0x46006e,_0x580538){_0x580538=_0x580538||0xc8;return function(_0x4c7bef){if(_0x4c7bef){return _0x46006e['status'](_0x580538)['json'](_0x4c7bef);}};}function respondWithFilteredResult(_0x2885dc,_0x35ab5d){return function(_0x5c5f97){if(_0x5c5f97){var _0x2b3eb9=typeof _0x35ab5d[_0xc8a4('0x1c')]===_0xc8a4('0x1d')&&typeof _0x35ab5d['limit']===_0xc8a4('0x1d');var _0x2efb37=_0x5c5f97[_0xc8a4('0x1e')];var _0x50c905=_0x2b3eb9?0x0:_0x35ab5d['offset'];var _0x2961a2=_0x2b3eb9?_0x5c5f97[_0xc8a4('0x1e')]:_0x35ab5d[_0xc8a4('0x1c')]+_0x35ab5d[_0xc8a4('0x1f')];var _0x1d950f;if(_0x2961a2>=_0x2efb37){_0x2961a2=_0x2efb37;_0x1d950f=0xc8;}else{_0x1d950f=0xce;}_0x2885dc[_0xc8a4('0x1a')](_0x1d950f);return _0x2885dc['set'](_0xc8a4('0x20'),_0x50c905+'-'+_0x2961a2+'/'+_0x2efb37)[_0xc8a4('0x21')](_0x5c5f97);}return null;};}function patchUpdates(_0x257aeb){return function(_0x5a1707){try{jsonpatch[_0xc8a4('0x22')](_0x5a1707,_0x257aeb,!![]);}catch(_0x49b92b){return BPromise[_0xc8a4('0x23')](_0x49b92b);}return _0x5a1707[_0xc8a4('0x24')]();};}function saveUpdates(_0x52db0e,_0x1656d5){return function(_0xe7bc86){if(_0xe7bc86){return _0xe7bc86['update'](_0x52db0e)[_0xc8a4('0x25')](function(_0x5e7b84){return _0x5e7b84;});}return null;};}function removeEntity(_0x420737,_0x4d0e76){return function(_0x567809){if(_0x567809){return _0x567809[_0xc8a4('0x26')]()['then'](function(){_0x420737['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31c1b5,_0x4b9684){return function(_0x38cbd6){if(!_0x38cbd6){_0x31c1b5[_0xc8a4('0x19')](0x194);}return _0x38cbd6;};}function handleError(_0x1ac1f0,_0x80eab6){_0x80eab6=_0x80eab6||0x1f4;return function(_0x3a0078){logger[_0xc8a4('0x27')](_0x3a0078[_0xc8a4('0x28')]);if(_0x3a0078[_0xc8a4('0x29')]){delete _0x3a0078[_0xc8a4('0x29')];}_0x1ac1f0['status'](_0x80eab6)['send'](_0x3a0078);};}exports['index']=function(_0x5eedf2,_0x7e3a95){var _0x470040={},_0x4432f6={},_0xd9ddf4={'count':0x0,'rows':[]};var _0x17708e=_[_0xc8a4('0x2a')](db[_0xc8a4('0x2b')]['rawAttributes'],function(_0x18fd28){return{'name':_0x18fd28['fieldName'],'type':_0x18fd28[_0xc8a4('0x2c')][_0xc8a4('0x2d')]};});_0x4432f6[_0xc8a4('0x2e')]=_[_0xc8a4('0x2a')](_0x17708e,_0xc8a4('0x29'));_0x4432f6[_0xc8a4('0x2f')]=_[_0xc8a4('0x30')](_0x5eedf2[_0xc8a4('0x2f')]);_0x4432f6[_0xc8a4('0x31')]=_['intersection'](_0x4432f6[_0xc8a4('0x2e')],_0x4432f6['query']);_0x470040['attributes']=_['intersection'](_0x4432f6['model'],qs['fields'](_0x5eedf2['query'][_0xc8a4('0x32')]));_0x470040[_0xc8a4('0x33')]=_0x470040['attributes'][_0xc8a4('0x34')]?_0x470040['attributes']:_0x4432f6[_0xc8a4('0x2e')];if(!_0x5eedf2[_0xc8a4('0x2f')]['hasOwnProperty'](_0xc8a4('0x35'))){_0x470040[_0xc8a4('0x1f')]=qs[_0xc8a4('0x1f')](_0x5eedf2[_0xc8a4('0x2f')]['limit']);_0x470040['offset']=qs[_0xc8a4('0x1c')](_0x5eedf2['query'][_0xc8a4('0x1c')]);}_0x470040['order']=qs[_0xc8a4('0x36')](_0x5eedf2[_0xc8a4('0x2f')]['sort']);_0x470040['where']=qs[_0xc8a4('0x31')](_[_0xc8a4('0x37')](_0x5eedf2[_0xc8a4('0x2f')],_0x4432f6['filters']),_0x17708e);if(_0x5eedf2['query'][_0xc8a4('0x38')]){_0x470040[_0xc8a4('0x39')]=_[_0xc8a4('0x3a')](_0x470040[_0xc8a4('0x39')],{'$or':_[_0xc8a4('0x2a')](_0x17708e,function(_0x5ebd84){if(_0x5ebd84[_0xc8a4('0x2c')]!==_0xc8a4('0x3b')){var _0x23f75e={};_0x23f75e[_0x5ebd84[_0xc8a4('0x29')]]={'$like':'%'+_0x5eedf2[_0xc8a4('0x2f')][_0xc8a4('0x38')]+'%'};return _0x23f75e;}})});}_0x470040=_[_0xc8a4('0x3a')]({},_0x470040,_0x5eedf2['options']);var _0x14ea35={'where':_0x470040[_0xc8a4('0x39')]};return db[_0xc8a4('0x2b')][_0xc8a4('0x1e')](_0x14ea35)['then'](function(_0x234c74){_0xd9ddf4['count']=_0x234c74;if(_0x5eedf2[_0xc8a4('0x2f')][_0xc8a4('0x3c')]){_0x470040['include']=[{'all':!![]}];}return db[_0xc8a4('0x2b')][_0xc8a4('0x3d')](_0x470040);})[_0xc8a4('0x25')](function(_0x23d5ad){_0xd9ddf4[_0xc8a4('0x3e')]=_0x23d5ad;return _0xd9ddf4;})[_0xc8a4('0x25')](respondWithFilteredResult(_0x7e3a95,_0x470040))[_0xc8a4('0x3f')](handleError(_0x7e3a95,null));};exports[_0xc8a4('0x40')]=function(_0x52f116,_0x3b177f){var _0x2ee2a5={'raw':![],'where':{'id':_0x52f116[_0xc8a4('0x41')]['id']}},_0x533a8a={};_0x533a8a['model']=_[_0xc8a4('0x30')](db[_0xc8a4('0x2b')]['rawAttributes']);_0x533a8a[_0xc8a4('0x2f')]=_[_0xc8a4('0x30')](_0x52f116[_0xc8a4('0x2f')]);_0x533a8a[_0xc8a4('0x31')]=_[_0xc8a4('0x42')](_0x533a8a[_0xc8a4('0x2e')],_0x533a8a['query']);_0x2ee2a5['attributes']=_[_0xc8a4('0x42')](_0x533a8a[_0xc8a4('0x2e')],qs[_0xc8a4('0x32')](_0x52f116[_0xc8a4('0x2f')][_0xc8a4('0x32')]));_0x2ee2a5[_0xc8a4('0x33')]=_0x2ee2a5[_0xc8a4('0x33')][_0xc8a4('0x34')]?_0x2ee2a5[_0xc8a4('0x33')]:_0x533a8a[_0xc8a4('0x2e')];if(_0x52f116['query']['includeAll']){_0x2ee2a5[_0xc8a4('0x43')]=[{'all':!![]}];}_0x2ee2a5=_[_0xc8a4('0x3a')]({},_0x2ee2a5,_0x52f116[_0xc8a4('0x44')]);return db[_0xc8a4('0x2b')]['find'](_0x2ee2a5)[_0xc8a4('0x25')](handleEntityNotFound(_0x3b177f,null))[_0xc8a4('0x25')](respondWithResult(_0x3b177f,null))['catch'](handleError(_0x3b177f,null));};exports[_0xc8a4('0x45')]=function(_0x4ea3c2,_0x300bbd){return db[_0xc8a4('0x2b')][_0xc8a4('0x45')](_0x4ea3c2[_0xc8a4('0x46')],{})[_0xc8a4('0x25')](respondWithResult(_0x300bbd,0xc9))[_0xc8a4('0x3f')](handleError(_0x300bbd,null));};exports[_0xc8a4('0x47')]=function(_0x27b490,_0x407a71){if(_0x27b490['body']['id']){delete _0x27b490[_0xc8a4('0x46')]['id'];}return db[_0xc8a4('0x2b')][_0xc8a4('0x48')]({'where':{'id':_0x27b490['params']['id']}})[_0xc8a4('0x25')](handleEntityNotFound(_0x407a71,null))[_0xc8a4('0x25')](saveUpdates(_0x27b490[_0xc8a4('0x46')],null))[_0xc8a4('0x25')](respondWithResult(_0x407a71,null))[_0xc8a4('0x3f')](handleError(_0x407a71,null));};exports['destroy']=function(_0x5a0c1c,_0x30d25f){return db[_0xc8a4('0x2b')][_0xc8a4('0x48')]({'where':{'id':_0x5a0c1c[_0xc8a4('0x41')]['id']}})[_0xc8a4('0x25')](handleEntityNotFound(_0x30d25f,null))[_0xc8a4('0x25')](removeEntity(_0x30d25f,null))[_0xc8a4('0x3f')](handleError(_0x30d25f,null));};exports[_0xc8a4('0x49')]=function(_0x2485a3,_0x5989a0,_0x471590){var _0x1ed79f={};var _0x22b4e5={};var _0x190951;var _0x2e8fb3;return db[_0xc8a4('0x2b')][_0xc8a4('0x4a')]({'where':{'id':_0x2485a3[_0xc8a4('0x41')]['id']}})[_0xc8a4('0x25')](handleEntityNotFound(_0x5989a0,null))['then'](function(_0x34c496){if(_0x34c496){_0x190951=_0x34c496;_0x22b4e5['model']=_[_0xc8a4('0x30')](db[_0xc8a4('0x4b')][_0xc8a4('0x4c')]);_0x22b4e5['query']=_[_0xc8a4('0x30')](_0x2485a3[_0xc8a4('0x2f')]);_0x22b4e5['filters']=_[_0xc8a4('0x42')](_0x22b4e5['model'],_0x22b4e5[_0xc8a4('0x2f')]);_0x1ed79f[_0xc8a4('0x33')]=_[_0xc8a4('0x42')](_0x22b4e5[_0xc8a4('0x2e')],qs[_0xc8a4('0x32')](_0x2485a3[_0xc8a4('0x2f')][_0xc8a4('0x32')]));_0x1ed79f[_0xc8a4('0x33')]=_0x1ed79f[_0xc8a4('0x33')]['length']?_0x1ed79f[_0xc8a4('0x33')]:_0x22b4e5[_0xc8a4('0x2e')];_0x1ed79f[_0xc8a4('0x4d')]=qs[_0xc8a4('0x36')](_0x2485a3[_0xc8a4('0x2f')][_0xc8a4('0x36')]);_0x1ed79f[_0xc8a4('0x39')]=qs[_0xc8a4('0x31')](_['pick'](_0x2485a3[_0xc8a4('0x2f')],_0x22b4e5[_0xc8a4('0x31')]));if(_0x2485a3[_0xc8a4('0x2f')][_0xc8a4('0x38')]){_0x1ed79f['where']=_[_0xc8a4('0x3a')](_0x1ed79f[_0xc8a4('0x39')],{'$or':_[_0xc8a4('0x2a')](_0x1ed79f[_0xc8a4('0x33')],function(_0x41101b){var _0x524d15={};_0x524d15[_0x41101b]={'$like':'%'+_0x2485a3['query'][_0xc8a4('0x38')]+'%'};return _0x524d15;})});}_0x1ed79f=_[_0xc8a4('0x3a')]({},_0x1ed79f,_0x2485a3[_0xc8a4('0x44')]);return _0x190951[_0xc8a4('0x49')](_0x1ed79f);}})[_0xc8a4('0x25')](function(_0x35964a){if(_0x35964a){_0x2e8fb3=_0x35964a[_0xc8a4('0x34')];if(!_0x2485a3['query'][_0xc8a4('0x4e')](_0xc8a4('0x35'))){_0x1ed79f[_0xc8a4('0x1f')]=qs[_0xc8a4('0x1f')](_0x2485a3[_0xc8a4('0x2f')][_0xc8a4('0x1f')]);_0x1ed79f[_0xc8a4('0x1c')]=qs[_0xc8a4('0x1c')](_0x2485a3[_0xc8a4('0x2f')][_0xc8a4('0x1c')]);}return _0x190951[_0xc8a4('0x49')](_0x1ed79f);}})[_0xc8a4('0x25')](function(_0x141c81){if(_0x141c81){return _0x141c81?{'count':_0x2e8fb3,'rows':_0x141c81}:null;}})[_0xc8a4('0x25')](respondWithResult(_0x5989a0,null))[_0xc8a4('0x3f')](handleError(_0x5989a0,null));};exports['getSubjects']=function(_0x137c02,_0x408164,_0xb0560e){var _0x40311b={};var _0x523126={};var _0x1c804b;var _0x4abcb4;return db[_0xc8a4('0x2b')][_0xc8a4('0x4a')]({'where':{'id':_0x137c02['params']['id']}})[_0xc8a4('0x25')](handleEntityNotFound(_0x408164,null))[_0xc8a4('0x25')](function(_0x1da7d6){if(_0x1da7d6){_0x1c804b=_0x1da7d6;_0x523126[_0xc8a4('0x2e')]=_[_0xc8a4('0x30')](db[_0xc8a4('0x4b')][_0xc8a4('0x4c')]);_0x523126[_0xc8a4('0x2f')]=_[_0xc8a4('0x30')](_0x137c02['query']);_0x523126['filters']=_[_0xc8a4('0x42')](_0x523126[_0xc8a4('0x2e')],_0x523126[_0xc8a4('0x2f')]);_0x40311b['attributes']=_['intersection'](_0x523126[_0xc8a4('0x2e')],qs['fields'](_0x137c02['query'][_0xc8a4('0x32')]));_0x40311b['attributes']=_0x40311b[_0xc8a4('0x33')][_0xc8a4('0x34')]?_0x40311b[_0xc8a4('0x33')]:_0x523126['model'];_0x40311b[_0xc8a4('0x4d')]=qs[_0xc8a4('0x36')](_0x137c02[_0xc8a4('0x2f')]['sort']);_0x40311b['where']=qs['filters'](_['pick'](_0x137c02[_0xc8a4('0x2f')],_0x523126['filters']));if(_0x137c02[_0xc8a4('0x2f')]['filter']){_0x40311b[_0xc8a4('0x39')]=_[_0xc8a4('0x3a')](_0x40311b[_0xc8a4('0x39')],{'$or':_['map'](_0x40311b[_0xc8a4('0x33')],function(_0x4e4190){var _0x249f93={};_0x249f93[_0x4e4190]={'$like':'%'+_0x137c02[_0xc8a4('0x2f')][_0xc8a4('0x38')]+'%'};return _0x249f93;})});}_0x40311b=_[_0xc8a4('0x3a')]({},_0x40311b,_0x137c02[_0xc8a4('0x44')]);return _0x1c804b['getSubjects'](_0x40311b);}})[_0xc8a4('0x25')](function(_0x41b7dd){if(_0x41b7dd){_0x4abcb4=_0x41b7dd[_0xc8a4('0x34')];if(!_0x137c02[_0xc8a4('0x2f')][_0xc8a4('0x4e')](_0xc8a4('0x35'))){_0x40311b[_0xc8a4('0x1f')]=qs[_0xc8a4('0x1f')](_0x137c02[_0xc8a4('0x2f')]['limit']);_0x40311b['offset']=qs[_0xc8a4('0x1c')](_0x137c02[_0xc8a4('0x2f')][_0xc8a4('0x1c')]);}return _0x1c804b[_0xc8a4('0x4f')](_0x40311b);}})[_0xc8a4('0x25')](function(_0x1b935b){if(_0x1b935b){return _0x1b935b?{'count':_0x4abcb4,'rows':_0x1b935b}:null;}})[_0xc8a4('0x25')](respondWithResult(_0x408164,null))['catch'](handleError(_0x408164,null));};exports[_0xc8a4('0x50')]=function(_0x51441a,_0x3d46e4,_0x5b93cb){var _0x5be3b4={};var _0x25d308={};var _0x35e7eb;var _0x4bd007;return db[_0xc8a4('0x2b')][_0xc8a4('0x4a')]({'where':{'id':_0x51441a[_0xc8a4('0x41')]['id']}})[_0xc8a4('0x25')](handleEntityNotFound(_0x3d46e4,null))[_0xc8a4('0x25')](function(_0x274f5d){if(_0x274f5d){_0x35e7eb=_0x274f5d;_0x25d308[_0xc8a4('0x2e')]=_['keys'](db['ZohoField'][_0xc8a4('0x4c')]);_0x25d308[_0xc8a4('0x2f')]=_['keys'](_0x51441a[_0xc8a4('0x2f')]);_0x25d308['filters']=_['intersection'](_0x25d308[_0xc8a4('0x2e')],_0x25d308[_0xc8a4('0x2f')]);_0x5be3b4[_0xc8a4('0x33')]=_['intersection'](_0x25d308['model'],qs['fields'](_0x51441a[_0xc8a4('0x2f')][_0xc8a4('0x32')]));_0x5be3b4[_0xc8a4('0x33')]=_0x5be3b4['attributes'][_0xc8a4('0x34')]?_0x5be3b4[_0xc8a4('0x33')]:_0x25d308[_0xc8a4('0x2e')];_0x5be3b4[_0xc8a4('0x4d')]=qs['sort'](_0x51441a[_0xc8a4('0x2f')]['sort']);_0x5be3b4[_0xc8a4('0x39')]=qs[_0xc8a4('0x31')](_[_0xc8a4('0x37')](_0x51441a[_0xc8a4('0x2f')],_0x25d308['filters']));if(_0x51441a[_0xc8a4('0x2f')][_0xc8a4('0x38')]){_0x5be3b4[_0xc8a4('0x39')]=_[_0xc8a4('0x3a')](_0x5be3b4[_0xc8a4('0x39')],{'$or':_[_0xc8a4('0x2a')](_0x5be3b4['attributes'],function(_0x474274){var _0x47b1c9={};_0x47b1c9[_0x474274]={'$like':'%'+_0x51441a[_0xc8a4('0x2f')][_0xc8a4('0x38')]+'%'};return _0x47b1c9;})});}_0x5be3b4=_[_0xc8a4('0x3a')]({},_0x5be3b4,_0x51441a[_0xc8a4('0x44')]);return _0x35e7eb[_0xc8a4('0x50')](_0x5be3b4);}})[_0xc8a4('0x25')](function(_0x810628){if(_0x810628){_0x4bd007=_0x810628[_0xc8a4('0x34')];if(!_0x51441a[_0xc8a4('0x2f')][_0xc8a4('0x4e')](_0xc8a4('0x35'))){_0x5be3b4[_0xc8a4('0x1f')]=qs['limit'](_0x51441a['query'][_0xc8a4('0x1f')]);_0x5be3b4[_0xc8a4('0x1c')]=qs[_0xc8a4('0x1c')](_0x51441a[_0xc8a4('0x2f')]['offset']);}return _0x35e7eb[_0xc8a4('0x50')](_0x5be3b4);}})[_0xc8a4('0x25')](function(_0x11c235){if(_0x11c235){return _0x11c235?{'count':_0x4bd007,'rows':_0x11c235}:null;}})['then'](respondWithResult(_0x3d46e4,null))['catch'](handleError(_0x3d46e4,null));}; \ No newline at end of file +var _0xd556=['query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','intersection','find','create','body','params','findOne','ZohoField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','reject','update','then','destroy','stack','name','index','ZohoConfiguration','rawAttributes','type','key','model','map'];(function(_0x1eb863,_0x3e84ae){var _0x18181e=function(_0x566406){while(--_0x566406){_0x1eb863['push'](_0x1eb863['shift']());}};_0x18181e(++_0x3e84ae);}(_0xd556,0x19c));var _0x6d55=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xd556[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0x6d55('0x0'));var rimraf=require(_0x6d55('0x1'));var zipdir=require(_0x6d55('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d55('0x3'));var moment=require('moment');var BPromise=require(_0x6d55('0x4'));var Mustache=require(_0x6d55('0x5'));var util=require(_0x6d55('0x6'));var path=require(_0x6d55('0x7'));var sox=require('sox');var csv=require(_0x6d55('0x8'));var ejs=require(_0x6d55('0x9'));var fs=require('fs');var fs_extra=require(_0x6d55('0xa'));var _=require(_0x6d55('0xb'));var squel=require(_0x6d55('0xc'));var crypto=require('crypto');var jsforce=require(_0x6d55('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6d55('0xe'));var Papa=require('papaparse');var Redis=require(_0x6d55('0xf'));var authService=require(_0x6d55('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6d55('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6d55('0x12'));var utils=require(_0x6d55('0x13'));var config=require(_0x6d55('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d55('0x15'))['db'];function respondWithStatusCode(_0x1c935d,_0x687fde){_0x687fde=_0x687fde||0xcc;return function(_0xe7d278){if(_0xe7d278){return _0x1c935d[_0x6d55('0x16')](_0x687fde);}return _0x1c935d[_0x6d55('0x17')](_0x687fde)[_0x6d55('0x18')]();};}function respondWithResult(_0x1ac937,_0x28d4a9){_0x28d4a9=_0x28d4a9||0xc8;return function(_0x2d5828){if(_0x2d5828){return _0x1ac937['status'](_0x28d4a9)[_0x6d55('0x19')](_0x2d5828);}};}function respondWithFilteredResult(_0x595888,_0x27f7ae){return function(_0x225108){if(_0x225108){var _0x297f2f=typeof _0x27f7ae[_0x6d55('0x1a')]==='undefined'&&typeof _0x27f7ae[_0x6d55('0x1b')]===_0x6d55('0x1c');var _0x2700c9=_0x225108['count'];var _0x2887ce=_0x297f2f?0x0:_0x27f7ae[_0x6d55('0x1a')];var _0x5b5d03=_0x297f2f?_0x225108['count']:_0x27f7ae[_0x6d55('0x1a')]+_0x27f7ae['limit'];var _0x73eb8;if(_0x5b5d03>=_0x2700c9){_0x5b5d03=_0x2700c9;_0x73eb8=0xc8;}else{_0x73eb8=0xce;}_0x595888['status'](_0x73eb8);return _0x595888[_0x6d55('0x1d')](_0x6d55('0x1e'),_0x2887ce+'-'+_0x5b5d03+'/'+_0x2700c9)[_0x6d55('0x19')](_0x225108);}return null;};}function patchUpdates(_0x48312b){return function(_0x32b220){try{jsonpatch['apply'](_0x32b220,_0x48312b,!![]);}catch(_0x341d11){return BPromise[_0x6d55('0x1f')](_0x341d11);}return _0x32b220['save']();};}function saveUpdates(_0x359b84,_0x2afe38){return function(_0x753757){if(_0x753757){return _0x753757[_0x6d55('0x20')](_0x359b84)[_0x6d55('0x21')](function(_0x2a58b5){return _0x2a58b5;});}return null;};}function removeEntity(_0x39e8fd,_0x8955a1){return function(_0x22d018){if(_0x22d018){return _0x22d018[_0x6d55('0x22')]()['then'](function(){_0x39e8fd['status'](0xcc)[_0x6d55('0x18')]();});}};}function handleEntityNotFound(_0x8c823a,_0xbc4d4f){return function(_0x3d687b){if(!_0x3d687b){_0x8c823a[_0x6d55('0x16')](0x194);}return _0x3d687b;};}function handleError(_0x94526f,_0xd190b0){_0xd190b0=_0xd190b0||0x1f4;return function(_0x54fffe){logger['error'](_0x54fffe[_0x6d55('0x23')]);if(_0x54fffe[_0x6d55('0x24')]){delete _0x54fffe[_0x6d55('0x24')];}_0x94526f[_0x6d55('0x17')](_0xd190b0)['send'](_0x54fffe);};}exports[_0x6d55('0x25')]=function(_0x551397,_0x11d361){var _0x5f03dc={},_0x16c1d9={},_0x3045a7={'count':0x0,'rows':[]};var _0x26d31a=_['map'](db[_0x6d55('0x26')][_0x6d55('0x27')],function(_0x4feff3){return{'name':_0x4feff3['fieldName'],'type':_0x4feff3[_0x6d55('0x28')][_0x6d55('0x29')]};});_0x16c1d9[_0x6d55('0x2a')]=_[_0x6d55('0x2b')](_0x26d31a,_0x6d55('0x24'));_0x16c1d9[_0x6d55('0x2c')]=_[_0x6d55('0x2d')](_0x551397[_0x6d55('0x2c')]);_0x16c1d9['filters']=_['intersection'](_0x16c1d9[_0x6d55('0x2a')],_0x16c1d9[_0x6d55('0x2c')]);_0x5f03dc[_0x6d55('0x2e')]=_['intersection'](_0x16c1d9[_0x6d55('0x2a')],qs[_0x6d55('0x2f')](_0x551397[_0x6d55('0x2c')][_0x6d55('0x2f')]));_0x5f03dc[_0x6d55('0x2e')]=_0x5f03dc[_0x6d55('0x2e')][_0x6d55('0x30')]?_0x5f03dc['attributes']:_0x16c1d9[_0x6d55('0x2a')];if(!_0x551397[_0x6d55('0x2c')][_0x6d55('0x31')](_0x6d55('0x32'))){_0x5f03dc[_0x6d55('0x1b')]=qs[_0x6d55('0x1b')](_0x551397[_0x6d55('0x2c')][_0x6d55('0x1b')]);_0x5f03dc['offset']=qs[_0x6d55('0x1a')](_0x551397[_0x6d55('0x2c')]['offset']);}_0x5f03dc[_0x6d55('0x33')]=qs[_0x6d55('0x34')](_0x551397[_0x6d55('0x2c')]['sort']);_0x5f03dc[_0x6d55('0x35')]=qs[_0x6d55('0x36')](_[_0x6d55('0x37')](_0x551397['query'],_0x16c1d9[_0x6d55('0x36')]),_0x26d31a);if(_0x551397[_0x6d55('0x2c')][_0x6d55('0x38')]){_0x5f03dc['where']=_[_0x6d55('0x39')](_0x5f03dc[_0x6d55('0x35')],{'$or':_[_0x6d55('0x2b')](_0x26d31a,function(_0xcb24a0){if(_0xcb24a0[_0x6d55('0x28')]!==_0x6d55('0x3a')){var _0x5b8d8d={};_0x5b8d8d[_0xcb24a0['name']]={'$like':'%'+_0x551397[_0x6d55('0x2c')][_0x6d55('0x38')]+'%'};return _0x5b8d8d;}})});}_0x5f03dc=_[_0x6d55('0x39')]({},_0x5f03dc,_0x551397[_0x6d55('0x3b')]);var _0x50c25c={'where':_0x5f03dc[_0x6d55('0x35')]};return db['ZohoConfiguration'][_0x6d55('0x3c')](_0x50c25c)[_0x6d55('0x21')](function(_0xc80b15){_0x3045a7[_0x6d55('0x3c')]=_0xc80b15;if(_0x551397[_0x6d55('0x2c')][_0x6d55('0x3d')]){_0x5f03dc[_0x6d55('0x3e')]=[{'all':!![]}];}return db[_0x6d55('0x26')][_0x6d55('0x3f')](_0x5f03dc);})['then'](function(_0x19ebea){_0x3045a7['rows']=_0x19ebea;return _0x3045a7;})[_0x6d55('0x21')](respondWithFilteredResult(_0x11d361,_0x5f03dc))[_0x6d55('0x40')](handleError(_0x11d361,null));};exports[_0x6d55('0x41')]=function(_0x2923c9,_0x216740){var _0x20d8a3={'raw':![],'where':{'id':_0x2923c9['params']['id']}},_0x1e7154={};_0x1e7154['model']=_[_0x6d55('0x2d')](db['ZohoConfiguration'][_0x6d55('0x27')]);_0x1e7154[_0x6d55('0x2c')]=_[_0x6d55('0x2d')](_0x2923c9[_0x6d55('0x2c')]);_0x1e7154['filters']=_['intersection'](_0x1e7154[_0x6d55('0x2a')],_0x1e7154[_0x6d55('0x2c')]);_0x20d8a3[_0x6d55('0x2e')]=_[_0x6d55('0x42')](_0x1e7154[_0x6d55('0x2a')],qs[_0x6d55('0x2f')](_0x2923c9[_0x6d55('0x2c')][_0x6d55('0x2f')]));_0x20d8a3['attributes']=_0x20d8a3[_0x6d55('0x2e')][_0x6d55('0x30')]?_0x20d8a3[_0x6d55('0x2e')]:_0x1e7154[_0x6d55('0x2a')];if(_0x2923c9[_0x6d55('0x2c')][_0x6d55('0x3d')]){_0x20d8a3[_0x6d55('0x3e')]=[{'all':!![]}];}_0x20d8a3=_[_0x6d55('0x39')]({},_0x20d8a3,_0x2923c9[_0x6d55('0x3b')]);return db[_0x6d55('0x26')][_0x6d55('0x43')](_0x20d8a3)['then'](handleEntityNotFound(_0x216740,null))['then'](respondWithResult(_0x216740,null))[_0x6d55('0x40')](handleError(_0x216740,null));};exports['create']=function(_0x3b08b5,_0x24a4fd){return db[_0x6d55('0x26')][_0x6d55('0x44')](_0x3b08b5['body'],{})[_0x6d55('0x21')](respondWithResult(_0x24a4fd,0xc9))[_0x6d55('0x40')](handleError(_0x24a4fd,null));};exports['update']=function(_0x9b9e45,_0x1a7036){if(_0x9b9e45[_0x6d55('0x45')]['id']){delete _0x9b9e45[_0x6d55('0x45')]['id'];}return db[_0x6d55('0x26')][_0x6d55('0x43')]({'where':{'id':_0x9b9e45[_0x6d55('0x46')]['id']}})[_0x6d55('0x21')](handleEntityNotFound(_0x1a7036,null))['then'](saveUpdates(_0x9b9e45[_0x6d55('0x45')],null))[_0x6d55('0x21')](respondWithResult(_0x1a7036,null))[_0x6d55('0x40')](handleError(_0x1a7036,null));};exports[_0x6d55('0x22')]=function(_0x93dd7b,_0x87625e){return db['ZohoConfiguration']['find']({'where':{'id':_0x93dd7b[_0x6d55('0x46')]['id']}})[_0x6d55('0x21')](handleEntityNotFound(_0x87625e,null))['then'](removeEntity(_0x87625e,null))[_0x6d55('0x40')](handleError(_0x87625e,null));};exports['getFields']=function(_0x57e5f8,_0x2d3e51,_0x2c88c0){var _0x165d1a={};var _0x549a58={};var _0x43e2c6;var _0x4d309b;return db[_0x6d55('0x26')][_0x6d55('0x47')]({'where':{'id':_0x57e5f8[_0x6d55('0x46')]['id']}})[_0x6d55('0x21')](handleEntityNotFound(_0x2d3e51,null))['then'](function(_0x5da433){if(_0x5da433){_0x43e2c6=_0x5da433;_0x549a58['model']=_[_0x6d55('0x2d')](db[_0x6d55('0x48')][_0x6d55('0x27')]);_0x549a58[_0x6d55('0x2c')]=_['keys'](_0x57e5f8['query']);_0x549a58[_0x6d55('0x36')]=_[_0x6d55('0x42')](_0x549a58[_0x6d55('0x2a')],_0x549a58['query']);_0x165d1a[_0x6d55('0x2e')]=_[_0x6d55('0x42')](_0x549a58[_0x6d55('0x2a')],qs[_0x6d55('0x2f')](_0x57e5f8[_0x6d55('0x2c')]['fields']));_0x165d1a[_0x6d55('0x2e')]=_0x165d1a[_0x6d55('0x2e')][_0x6d55('0x30')]?_0x165d1a['attributes']:_0x549a58[_0x6d55('0x2a')];_0x165d1a[_0x6d55('0x33')]=qs[_0x6d55('0x34')](_0x57e5f8[_0x6d55('0x2c')][_0x6d55('0x34')]);_0x165d1a['where']=qs[_0x6d55('0x36')](_[_0x6d55('0x37')](_0x57e5f8[_0x6d55('0x2c')],_0x549a58[_0x6d55('0x36')]));if(_0x57e5f8[_0x6d55('0x2c')][_0x6d55('0x38')]){_0x165d1a['where']=_['merge'](_0x165d1a['where'],{'$or':_['map'](_0x165d1a[_0x6d55('0x2e')],function(_0x190591){var _0x1c1467={};_0x1c1467[_0x190591]={'$like':'%'+_0x57e5f8['query'][_0x6d55('0x38')]+'%'};return _0x1c1467;})});}_0x165d1a=_[_0x6d55('0x39')]({},_0x165d1a,_0x57e5f8[_0x6d55('0x3b')]);return _0x43e2c6[_0x6d55('0x49')](_0x165d1a);}})[_0x6d55('0x21')](function(_0x321f0c){if(_0x321f0c){_0x4d309b=_0x321f0c[_0x6d55('0x30')];if(!_0x57e5f8[_0x6d55('0x2c')][_0x6d55('0x31')](_0x6d55('0x32'))){_0x165d1a[_0x6d55('0x1b')]=qs[_0x6d55('0x1b')](_0x57e5f8['query'][_0x6d55('0x1b')]);_0x165d1a[_0x6d55('0x1a')]=qs[_0x6d55('0x1a')](_0x57e5f8[_0x6d55('0x2c')][_0x6d55('0x1a')]);}return _0x43e2c6[_0x6d55('0x49')](_0x165d1a);}})[_0x6d55('0x21')](function(_0x4a865c){if(_0x4a865c){return _0x4a865c?{'count':_0x4d309b,'rows':_0x4a865c}:null;}})[_0x6d55('0x21')](respondWithResult(_0x2d3e51,null))[_0x6d55('0x40')](handleError(_0x2d3e51,null));};exports[_0x6d55('0x4a')]=function(_0x2f8e67,_0x154e3f,_0x362878){var _0x20d079={};var _0xa95032={};var _0xd5ccc0;var _0x40b6c0;return db['ZohoConfiguration'][_0x6d55('0x47')]({'where':{'id':_0x2f8e67[_0x6d55('0x46')]['id']}})[_0x6d55('0x21')](handleEntityNotFound(_0x154e3f,null))['then'](function(_0x4832dc){if(_0x4832dc){_0xd5ccc0=_0x4832dc;_0xa95032[_0x6d55('0x2a')]=_[_0x6d55('0x2d')](db[_0x6d55('0x48')][_0x6d55('0x27')]);_0xa95032[_0x6d55('0x2c')]=_[_0x6d55('0x2d')](_0x2f8e67[_0x6d55('0x2c')]);_0xa95032['filters']=_[_0x6d55('0x42')](_0xa95032[_0x6d55('0x2a')],_0xa95032[_0x6d55('0x2c')]);_0x20d079[_0x6d55('0x2e')]=_['intersection'](_0xa95032[_0x6d55('0x2a')],qs[_0x6d55('0x2f')](_0x2f8e67[_0x6d55('0x2c')][_0x6d55('0x2f')]));_0x20d079['attributes']=_0x20d079[_0x6d55('0x2e')][_0x6d55('0x30')]?_0x20d079[_0x6d55('0x2e')]:_0xa95032['model'];_0x20d079[_0x6d55('0x33')]=qs['sort'](_0x2f8e67[_0x6d55('0x2c')][_0x6d55('0x34')]);_0x20d079['where']=qs[_0x6d55('0x36')](_[_0x6d55('0x37')](_0x2f8e67[_0x6d55('0x2c')],_0xa95032['filters']));if(_0x2f8e67[_0x6d55('0x2c')][_0x6d55('0x38')]){_0x20d079[_0x6d55('0x35')]=_[_0x6d55('0x39')](_0x20d079[_0x6d55('0x35')],{'$or':_['map'](_0x20d079[_0x6d55('0x2e')],function(_0x288dac){var _0x3a318b={};_0x3a318b[_0x288dac]={'$like':'%'+_0x2f8e67['query']['filter']+'%'};return _0x3a318b;})});}_0x20d079=_['merge']({},_0x20d079,_0x2f8e67[_0x6d55('0x3b')]);return _0xd5ccc0['getSubjects'](_0x20d079);}})[_0x6d55('0x21')](function(_0x39e8f0){if(_0x39e8f0){_0x40b6c0=_0x39e8f0[_0x6d55('0x30')];if(!_0x2f8e67[_0x6d55('0x2c')][_0x6d55('0x31')](_0x6d55('0x32'))){_0x20d079[_0x6d55('0x1b')]=qs[_0x6d55('0x1b')](_0x2f8e67[_0x6d55('0x2c')][_0x6d55('0x1b')]);_0x20d079[_0x6d55('0x1a')]=qs[_0x6d55('0x1a')](_0x2f8e67[_0x6d55('0x2c')]['offset']);}return _0xd5ccc0[_0x6d55('0x4a')](_0x20d079);}})[_0x6d55('0x21')](function(_0x2170c3){if(_0x2170c3){return _0x2170c3?{'count':_0x40b6c0,'rows':_0x2170c3}:null;}})[_0x6d55('0x21')](respondWithResult(_0x154e3f,null))[_0x6d55('0x40')](handleError(_0x154e3f,null));};exports[_0x6d55('0x4b')]=function(_0x2638f1,_0x69588,_0x141a90){var _0x43f53f={};var _0x4a5e10={};var _0x2d2db7;var _0x54e832;return db['ZohoConfiguration'][_0x6d55('0x47')]({'where':{'id':_0x2638f1[_0x6d55('0x46')]['id']}})['then'](handleEntityNotFound(_0x69588,null))[_0x6d55('0x21')](function(_0x410dc9){if(_0x410dc9){_0x2d2db7=_0x410dc9;_0x4a5e10['model']=_[_0x6d55('0x2d')](db[_0x6d55('0x48')]['rawAttributes']);_0x4a5e10[_0x6d55('0x2c')]=_[_0x6d55('0x2d')](_0x2638f1[_0x6d55('0x2c')]);_0x4a5e10[_0x6d55('0x36')]=_[_0x6d55('0x42')](_0x4a5e10[_0x6d55('0x2a')],_0x4a5e10[_0x6d55('0x2c')]);_0x43f53f['attributes']=_[_0x6d55('0x42')](_0x4a5e10[_0x6d55('0x2a')],qs[_0x6d55('0x2f')](_0x2638f1[_0x6d55('0x2c')][_0x6d55('0x2f')]));_0x43f53f['attributes']=_0x43f53f['attributes'][_0x6d55('0x30')]?_0x43f53f[_0x6d55('0x2e')]:_0x4a5e10[_0x6d55('0x2a')];_0x43f53f[_0x6d55('0x33')]=qs['sort'](_0x2638f1['query'][_0x6d55('0x34')]);_0x43f53f['where']=qs[_0x6d55('0x36')](_[_0x6d55('0x37')](_0x2638f1[_0x6d55('0x2c')],_0x4a5e10[_0x6d55('0x36')]));if(_0x2638f1[_0x6d55('0x2c')][_0x6d55('0x38')]){_0x43f53f[_0x6d55('0x35')]=_[_0x6d55('0x39')](_0x43f53f[_0x6d55('0x35')],{'$or':_[_0x6d55('0x2b')](_0x43f53f[_0x6d55('0x2e')],function(_0x18edf9){var _0x2418f9={};_0x2418f9[_0x18edf9]={'$like':'%'+_0x2638f1[_0x6d55('0x2c')][_0x6d55('0x38')]+'%'};return _0x2418f9;})});}_0x43f53f=_[_0x6d55('0x39')]({},_0x43f53f,_0x2638f1[_0x6d55('0x3b')]);return _0x2d2db7['getDescriptions'](_0x43f53f);}})[_0x6d55('0x21')](function(_0x6260c1){if(_0x6260c1){_0x54e832=_0x6260c1[_0x6d55('0x30')];if(!_0x2638f1[_0x6d55('0x2c')][_0x6d55('0x31')](_0x6d55('0x32'))){_0x43f53f[_0x6d55('0x1b')]=qs['limit'](_0x2638f1[_0x6d55('0x2c')][_0x6d55('0x1b')]);_0x43f53f[_0x6d55('0x1a')]=qs[_0x6d55('0x1a')](_0x2638f1[_0x6d55('0x2c')][_0x6d55('0x1a')]);}return _0x2d2db7['getDescriptions'](_0x43f53f);}})[_0x6d55('0x21')](function(_0x132ef6){if(_0x132ef6){return _0x132ef6?{'count':_0x54e832,'rows':_0x132ef6}:null;}})[_0x6d55('0x21')](respondWithResult(_0x69588,null))[_0x6d55('0x40')](handleError(_0x69588,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 668cd7f..17e244c 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 _0x3a68=['ZohoConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x2d9659,_0x20606b){var _0xe6436e=function(_0x5f3720){while(--_0x5f3720){_0x2d9659['push'](_0x2d9659['shift']());}};_0xe6436e(++_0x20606b);}(_0x3a68,0x135));var _0x83a6=function(_0x223f53,_0x599c35){_0x223f53=_0x223f53-0x0;var _0x3edb3b=_0x3a68[_0x223f53];return _0x3edb3b;};'use strict';var _=require(_0x83a6('0x0'));var util=require(_0x83a6('0x1'));var logger=require(_0x83a6('0x2'))(_0x83a6('0x3'));var moment=require(_0x83a6('0x4'));var BPromise=require(_0x83a6('0x5'));var rp=require(_0x83a6('0x6'));var fs=require('fs');var path=require(_0x83a6('0x7'));var rimraf=require(_0x83a6('0x8'));var config=require(_0x83a6('0x9'));var attributes=require(_0x83a6('0xa'));module[_0x83a6('0xb')]=function(_0x33b4d9,_0x5f4c34){return _0x33b4d9[_0x83a6('0xc')](_0x83a6('0xd'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdba0=['moment','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','api'];(function(_0x1226b3,_0x2e39c1){var _0x119703=function(_0x2f4e8a){while(--_0x2f4e8a){_0x1226b3['push'](_0x1226b3['shift']());}};_0x119703(++_0x2e39c1);}(_0xdba0,0x10c));var _0x0dba=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0xdba0[_0x480bc8];return _0x28c245;};'use strict';var _=require(_0x0dba('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0dba('0x1'));var moment=require(_0x0dba('0x2'));var BPromise=require('bluebird');var rp=require(_0x0dba('0x3'));var fs=require('fs');var path=require(_0x0dba('0x4'));var rimraf=require('rimraf');var config=require(_0x0dba('0x5'));var attributes=require(_0x0dba('0x6'));module[_0x0dba('0x7')]=function(_0x8905e9,_0xefecba){return _0x8905e9['define'](_0x0dba('0x8'),attributes,{'tableName':_0x0dba('0x9'),'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 5010ff1..3334fc6 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 _0xeeb8=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x49b566,_0x5e6d3e){var _0x551b54=function(_0x113e67){while(--_0x113e67){_0x49b566['push'](_0x49b566['shift']());}};_0x551b54(++_0x5e6d3e);}(_0xeeb8,0x103));var _0x8eeb=function(_0x5aa847,_0x5f2171){_0x5aa847=_0x5aa847-0x0;var _0x476efe=_0xeeb8[_0x5aa847];return _0x476efe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8eeb('0x0'));var BPromise=require('bluebird');var rs=require(_0x8eeb('0x1'));var fs=require('fs');var Redis=require(_0x8eeb('0x2'));var db=require(_0x8eeb('0x3'))['db'];var utils=require(_0x8eeb('0x4'));var logger=require(_0x8eeb('0x5'))(_0x8eeb('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8eeb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25d07b,_0x27f56f,_0x18fdb4){return new BPromise(function(_0x3d8b0b,_0x5aea32){return client[_0x8eeb('0x8')](_0x25d07b,_0x18fdb4)[_0x8eeb('0x9')](function(_0x1b943b){logger[_0x8eeb('0xa')](_0x8eeb('0xb'),_0x27f56f,_0x8eeb('0xc'));logger[_0x8eeb('0xd')](_0x8eeb('0xe'),_0x27f56f,'request\x20sent',JSON[_0x8eeb('0xf')](_0x1b943b));if(_0x1b943b[_0x8eeb('0x10')]){if(_0x1b943b[_0x8eeb('0x10')][_0x8eeb('0x11')]===0x1f4){logger[_0x8eeb('0x10')](_0x8eeb('0xb'),_0x27f56f,_0x1b943b['error'][_0x8eeb('0x12')]);return _0x5aea32(_0x1b943b['error'][_0x8eeb('0x12')]);}logger[_0x8eeb('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x27f56f,_0x1b943b[_0x8eeb('0x10')]['message']);return _0x3d8b0b(_0x1b943b[_0x8eeb('0x10')][_0x8eeb('0x12')]);}else{logger[_0x8eeb('0xa')](_0x8eeb('0xb'),_0x27f56f,_0x8eeb('0xc'));_0x3d8b0b(_0x1b943b[_0x8eeb('0x13')]['message']);}})[_0x8eeb('0x14')](function(_0x29726c){logger[_0x8eeb('0x10')](_0x8eeb('0xb'),_0x27f56f,_0x29726c);_0x5aea32(_0x29726c);});});} \ No newline at end of file +var _0x4a6a=['error','code','message','catch','util','moment','bluebird','ioredis','../../config/utils','rpc','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1b7f55,_0x330b26){var _0x4e77c5=function(_0x4ebfd1){while(--_0x4ebfd1){_0x1b7f55['push'](_0x1b7f55['shift']());}};_0x4e77c5(++_0x330b26);}(_0x4a6a,0x94));var _0xa4a6=function(_0x2664fc,_0x29c91b){_0x2664fc=_0x2664fc-0x0;var _0x37ae02=_0x4a6a[_0x2664fc];return _0x37ae02;};'use strict';var _=require('lodash');var util=require(_0xa4a6('0x0'));var moment=require(_0xa4a6('0x1'));var BPromise=require(_0xa4a6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4a6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa4a6('0x4'));var logger=require('../../config/logger')(_0xa4a6('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa4a6('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x307717,_0x29c411,_0xc289d9){return new BPromise(function(_0x84c5be,_0x4e1215){return client[_0xa4a6('0x7')](_0x307717,_0xc289d9)[_0xa4a6('0x8')](function(_0x445715){logger['info'](_0xa4a6('0x9'),_0x29c411,_0xa4a6('0xa'));logger[_0xa4a6('0xb')](_0xa4a6('0xc'),_0x29c411,_0xa4a6('0xa'),JSON[_0xa4a6('0xd')](_0x445715));if(_0x445715[_0xa4a6('0xe')]){if(_0x445715[_0xa4a6('0xe')][_0xa4a6('0xf')]===0x1f4){logger[_0xa4a6('0xe')](_0xa4a6('0x9'),_0x29c411,_0x445715[_0xa4a6('0xe')][_0xa4a6('0x10')]);return _0x4e1215(_0x445715[_0xa4a6('0xe')][_0xa4a6('0x10')]);}logger[_0xa4a6('0xe')](_0xa4a6('0x9'),_0x29c411,_0x445715['error'][_0xa4a6('0x10')]);return _0x84c5be(_0x445715['error']['message']);}else{logger['info'](_0xa4a6('0x9'),_0x29c411,_0xa4a6('0xa'));_0x84c5be(_0x445715['result'][_0xa4a6('0x10')]);}})[_0xa4a6('0x11')](function(_0x4c9f41){logger[_0xa4a6('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x29c411,_0x4c9f41);_0x4e1215(_0x4c9f41);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 2557efc..f6bbc43 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 _0xc803=['get','/:id','show','post','create','put','isAuthenticated','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x2bcb75,_0x5789a7){var _0x175345=function(_0x3a7d41){while(--_0x3a7d41){_0x2bcb75['push'](_0x2bcb75['shift']());}};_0x175345(++_0x5789a7);}(_0xc803,0xa2));var _0x3c80=function(_0x35352d,_0x2cc55c){_0x35352d=_0x35352d-0x0;var _0x5568a4=_0xc803[_0x35352d];return _0x5568a4;};'use strict';var multer=require('multer');var util=require(_0x3c80('0x0'));var path=require(_0x3c80('0x1'));var timeout=require(_0x3c80('0x2'));var express=require(_0x3c80('0x3'));var router=express['Router']();var fs_extra=require(_0x3c80('0x4'));var auth=require(_0x3c80('0x5'));var interaction=require(_0x3c80('0x6'));var config=require(_0x3c80('0x7'));var controller=require(_0x3c80('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3c80('0x9')](_0x3c80('0xa'),auth['isAuthenticated'](),controller[_0x3c80('0xb')]);router[_0x3c80('0xc')]('/',auth['isAuthenticated'](),controller[_0x3c80('0xd')]);router[_0x3c80('0xe')](_0x3c80('0xa'),auth[_0x3c80('0xf')](),controller['update']);router[_0x3c80('0x10')](_0x3c80('0xa'),auth[_0x3c80('0xf')](),controller[_0x3c80('0x11')]);module[_0x3c80('0x12')]=router; \ No newline at end of file +var _0xf6ed=['index','/:id','post','put','update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated'];(function(_0x5088a0,_0x5266dd){var _0x434060=function(_0x1a1c9f){while(--_0x1a1c9f){_0x5088a0['push'](_0x5088a0['shift']());}};_0x434060(++_0x5266dd);}(_0xf6ed,0xb1));var _0xdf6e=function(_0x10dd31,_0x4239a6){_0x10dd31=_0x10dd31-0x0;var _0x57b172=_0xf6ed[_0x10dd31];return _0x57b172;};'use strict';var multer=require(_0xdf6e('0x0'));var util=require(_0xdf6e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdf6e('0x2'));var router=express[_0xdf6e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdf6e('0x4'));var interaction=require(_0xdf6e('0x5'));var config=require(_0xdf6e('0x6'));var controller=require(_0xdf6e('0x7'));router[_0xdf6e('0x8')]('/',auth[_0xdf6e('0x9')](),controller[_0xdf6e('0xa')]);router['get'](_0xdf6e('0xb'),auth[_0xdf6e('0x9')](),controller['show']);router[_0xdf6e('0xc')]('/',auth[_0xdf6e('0x9')](),controller['create']);router[_0xdf6e('0xd')]('/:id',auth[_0xdf6e('0x9')](),controller[_0xdf6e('0xe')]);router['delete'](_0xdf6e('0xb'),auth['isAuthenticated'](),controller[_0xdf6e('0xf')]);module[_0xdf6e('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 0f61669..2496d20 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 _0x311f=['string','STRING','customVariable','BOOLEAN','sequelize','exports','variable','keyValue','picklist'];(function(_0x1db323,_0x49e5be){var _0x4c9f84=function(_0x1f2aa2){while(--_0x1f2aa2){_0x1db323['push'](_0x1db323['shift']());}};_0x4c9f84(++_0x49e5be);}(_0x311f,0x175));var _0xf311=function(_0x4ceece,_0x420649){_0x4ceece=_0x4ceece-0x0;var _0xe12c40=_0x311f[_0x4ceece];return _0xe12c40;};'use strict';var Sequelize=require(_0xf311('0x0'));module[_0xf311('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xf311('0x2'),'customVariable',_0xf311('0x3'),_0xf311('0x4')),'defaultValue':_0xf311('0x5')},'content':{'type':Sequelize[_0xf311('0x6')]},'key':{'type':Sequelize[_0xf311('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xf311('0x5'),_0xf311('0x2'),_0xf311('0x7'))},'keyContent':{'type':Sequelize[_0xf311('0x6')]},'idField':{'type':Sequelize[_0xf311('0x6')]},'nameField':{'type':Sequelize[_0xf311('0x6')]},'customField':{'type':Sequelize[_0xf311('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf311('0x6')]}}; \ No newline at end of file +var _0x6464=['keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x390bbe,_0x514843){var _0x5aaed0=function(_0x3d2af5){while(--_0x3d2af5){_0x390bbe['push'](_0x390bbe['shift']());}};_0x5aaed0(++_0x514843);}(_0x6464,0x9d));var _0x4646=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6464[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module[_0x4646('0x0')]={'type':{'type':Sequelize[_0x4646('0x1')](_0x4646('0x2'),_0x4646('0x3'),_0x4646('0x4'),_0x4646('0x5'),_0x4646('0x6')),'defaultValue':_0x4646('0x2')},'content':{'type':Sequelize[_0x4646('0x7')]},'key':{'type':Sequelize[_0x4646('0x7')]},'keyType':{'type':Sequelize[_0x4646('0x1')](_0x4646('0x2'),_0x4646('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x4646('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4646('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 f59d198..f3dbd5d 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 _0x317b=['rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','type','include','findAll','rows','params','fields','includeAll','find','catch','create','body','eml-format'];(function(_0x39143,_0x38645d){var _0xdaec2e=function(_0x4af8ef){while(--_0x4af8ef){_0x39143['push'](_0x39143['shift']());}};_0xdaec2e(++_0x38645d);}(_0x317b,0x1c7));var _0xb317=function(_0x106843,_0xd4c6fb){_0x106843=_0x106843-0x0;var _0x4b4651=_0x317b[_0x106843];return _0x4b4651;};'use strict';var emlformat=require(_0xb317('0x0'));var rimraf=require(_0xb317('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb317('0x2'));var rp=require(_0xb317('0x3'));var moment=require('moment');var BPromise=require(_0xb317('0x4'));var Mustache=require(_0xb317('0x5'));var util=require(_0xb317('0x6'));var path=require(_0xb317('0x7'));var sox=require(_0xb317('0x8'));var csv=require(_0xb317('0x9'));var ejs=require(_0xb317('0xa'));var fs=require('fs');var fs_extra=require(_0xb317('0xb'));var _=require(_0xb317('0xc'));var squel=require(_0xb317('0xd'));var crypto=require('crypto');var jsforce=require(_0xb317('0xe'));var deskjs=require(_0xb317('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb317('0x10'));var Papa=require(_0xb317('0x11'));var Redis=require(_0xb317('0x12'));var authService=require(_0xb317('0x13'));var qs=require(_0xb317('0x14'));var as=require(_0xb317('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb317('0x16'))(_0xb317('0x17'));var utils=require('../../config/utils');var config=require(_0xb317('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb317('0x19'))['db'];function respondWithStatusCode(_0x1f9624,_0x458584){_0x458584=_0x458584||0xcc;return function(_0x15f3f5){if(_0x15f3f5){return _0x1f9624['sendStatus'](_0x458584);}return _0x1f9624[_0xb317('0x1a')](_0x458584)['end']();};}function respondWithResult(_0x5562b0,_0x41f778){_0x41f778=_0x41f778||0xc8;return function(_0x4c2585){if(_0x4c2585){return _0x5562b0[_0xb317('0x1a')](_0x41f778)[_0xb317('0x1b')](_0x4c2585);}};}function respondWithFilteredResult(_0x2ef2c6,_0x5f288e){return function(_0x4ade83){if(_0x4ade83){var _0x5f1f1d=typeof _0x5f288e[_0xb317('0x1c')]==='undefined'&&typeof _0x5f288e[_0xb317('0x1d')]===_0xb317('0x1e');var _0x4ceef3=_0x4ade83[_0xb317('0x1f')];var _0x337eaf=_0x5f1f1d?0x0:_0x5f288e['offset'];var _0x497992=_0x5f1f1d?_0x4ade83[_0xb317('0x1f')]:_0x5f288e[_0xb317('0x1c')]+_0x5f288e[_0xb317('0x1d')];var _0x13d760;if(_0x497992>=_0x4ceef3){_0x497992=_0x4ceef3;_0x13d760=0xc8;}else{_0x13d760=0xce;}_0x2ef2c6[_0xb317('0x1a')](_0x13d760);return _0x2ef2c6['set'](_0xb317('0x20'),_0x337eaf+'-'+_0x497992+'/'+_0x4ceef3)[_0xb317('0x1b')](_0x4ade83);}return null;};}function patchUpdates(_0x2467b){return function(_0x2493a2){try{jsonpatch[_0xb317('0x21')](_0x2493a2,_0x2467b,!![]);}catch(_0x187458){return BPromise[_0xb317('0x22')](_0x187458);}return _0x2493a2[_0xb317('0x23')]();};}function saveUpdates(_0x1fb834,_0x2f85d4){return function(_0x2dfdee){if(_0x2dfdee){return _0x2dfdee[_0xb317('0x24')](_0x1fb834)[_0xb317('0x25')](function(_0x3539fd){return _0x3539fd;});}return null;};}function removeEntity(_0x569c6a,_0x42ef04){return function(_0x55bf91){if(_0x55bf91){return _0x55bf91[_0xb317('0x26')]()[_0xb317('0x25')](function(){_0x569c6a[_0xb317('0x1a')](0xcc)[_0xb317('0x27')]();});}};}function handleEntityNotFound(_0x3bab40,_0x1e32d4){return function(_0x109189){if(!_0x109189){_0x3bab40[_0xb317('0x28')](0x194);}return _0x109189;};}function handleError(_0x568233,_0x209f13){_0x209f13=_0x209f13||0x1f4;return function(_0x3079d9){logger[_0xb317('0x29')](_0x3079d9[_0xb317('0x2a')]);if(_0x3079d9[_0xb317('0x2b')]){delete _0x3079d9[_0xb317('0x2b')];}_0x568233['status'](_0x209f13)[_0xb317('0x2c')](_0x3079d9);};}exports[_0xb317('0x2d')]=function(_0x5be03a,_0x5c629c){var _0x33b3c1={},_0x387e17={},_0x425ce8={'count':0x0,'rows':[]};var _0x4ece62=_[_0xb317('0x2e')](db[_0xb317('0x2f')][_0xb317('0x30')],function(_0x3a174f){return{'name':_0x3a174f[_0xb317('0x31')],'type':_0x3a174f['type'][_0xb317('0x32')]};});_0x387e17['model']=_[_0xb317('0x2e')](_0x4ece62,'name');_0x387e17[_0xb317('0x33')]=_[_0xb317('0x34')](_0x5be03a[_0xb317('0x33')]);_0x387e17['filters']=_[_0xb317('0x35')](_0x387e17[_0xb317('0x36')],_0x387e17[_0xb317('0x33')]);_0x33b3c1['attributes']=_['intersection'](_0x387e17[_0xb317('0x36')],qs['fields'](_0x5be03a['query']['fields']));_0x33b3c1[_0xb317('0x37')]=_0x33b3c1[_0xb317('0x37')][_0xb317('0x38')]?_0x33b3c1[_0xb317('0x37')]:_0x387e17['model'];if(!_0x5be03a[_0xb317('0x33')][_0xb317('0x39')](_0xb317('0x3a'))){_0x33b3c1[_0xb317('0x1d')]=qs['limit'](_0x5be03a[_0xb317('0x33')]['limit']);_0x33b3c1[_0xb317('0x1c')]=qs[_0xb317('0x1c')](_0x5be03a[_0xb317('0x33')][_0xb317('0x1c')]);}_0x33b3c1['order']=qs[_0xb317('0x3b')](_0x5be03a[_0xb317('0x33')][_0xb317('0x3b')]);_0x33b3c1['where']=qs[_0xb317('0x3c')](_[_0xb317('0x3d')](_0x5be03a[_0xb317('0x33')],_0x387e17[_0xb317('0x3c')]),_0x4ece62);if(_0x5be03a['query'][_0xb317('0x3e')]){_0x33b3c1[_0xb317('0x3f')]=_[_0xb317('0x40')](_0x33b3c1[_0xb317('0x3f')],{'$or':_[_0xb317('0x2e')](_0x4ece62,function(_0x319c11){if(_0x319c11[_0xb317('0x41')]!=='VIRTUAL'){var _0x766c0a={};_0x766c0a[_0x319c11['name']]={'$like':'%'+_0x5be03a[_0xb317('0x33')][_0xb317('0x3e')]+'%'};return _0x766c0a;}})});}_0x33b3c1=_[_0xb317('0x40')]({},_0x33b3c1,_0x5be03a['options']);var _0x3e4770={'where':_0x33b3c1[_0xb317('0x3f')]};return db[_0xb317('0x2f')][_0xb317('0x1f')](_0x3e4770)['then'](function(_0x3c4e31){_0x425ce8['count']=_0x3c4e31;if(_0x5be03a[_0xb317('0x33')]['includeAll']){_0x33b3c1[_0xb317('0x42')]=[{'all':!![]}];}return db['ZohoField'][_0xb317('0x43')](_0x33b3c1);})['then'](function(_0x33e929){_0x425ce8[_0xb317('0x44')]=_0x33e929;return _0x425ce8;})[_0xb317('0x25')](respondWithFilteredResult(_0x5c629c,_0x33b3c1))['catch'](handleError(_0x5c629c,null));};exports['show']=function(_0x16aa3b,_0x152d8b){var _0x4b6a3a={'raw':!![],'where':{'id':_0x16aa3b[_0xb317('0x45')]['id']}},_0x450ff8={};_0x450ff8[_0xb317('0x36')]=_[_0xb317('0x34')](db[_0xb317('0x2f')]['rawAttributes']);_0x450ff8['query']=_[_0xb317('0x34')](_0x16aa3b['query']);_0x450ff8[_0xb317('0x3c')]=_[_0xb317('0x35')](_0x450ff8[_0xb317('0x36')],_0x450ff8[_0xb317('0x33')]);_0x4b6a3a[_0xb317('0x37')]=_[_0xb317('0x35')](_0x450ff8[_0xb317('0x36')],qs[_0xb317('0x46')](_0x16aa3b[_0xb317('0x33')][_0xb317('0x46')]));_0x4b6a3a[_0xb317('0x37')]=_0x4b6a3a[_0xb317('0x37')][_0xb317('0x38')]?_0x4b6a3a['attributes']:_0x450ff8[_0xb317('0x36')];if(_0x16aa3b['query'][_0xb317('0x47')]){_0x4b6a3a[_0xb317('0x42')]=[{'all':!![]}];}_0x4b6a3a=_[_0xb317('0x40')]({},_0x4b6a3a,_0x16aa3b['options']);return db['ZohoField'][_0xb317('0x48')](_0x4b6a3a)[_0xb317('0x25')](handleEntityNotFound(_0x152d8b,null))[_0xb317('0x25')](respondWithResult(_0x152d8b,null))[_0xb317('0x49')](handleError(_0x152d8b,null));};exports[_0xb317('0x4a')]=function(_0x4a8b59,_0x1b5afa){return db[_0xb317('0x2f')][_0xb317('0x4a')](_0x4a8b59[_0xb317('0x4b')],{})['then'](respondWithResult(_0x1b5afa,0xc9))[_0xb317('0x49')](handleError(_0x1b5afa,null));};exports[_0xb317('0x24')]=function(_0x1918b9,_0x3a9b5d){if(_0x1918b9[_0xb317('0x4b')]['id']){delete _0x1918b9[_0xb317('0x4b')]['id'];}return db['ZohoField'][_0xb317('0x48')]({'where':{'id':_0x1918b9[_0xb317('0x45')]['id']}})[_0xb317('0x25')](handleEntityNotFound(_0x3a9b5d,null))[_0xb317('0x25')](saveUpdates(_0x1918b9[_0xb317('0x4b')],null))[_0xb317('0x25')](respondWithResult(_0x3a9b5d,null))[_0xb317('0x49')](handleError(_0x3a9b5d,null));};exports['destroy']=function(_0x11428f,_0x7acb83){return db[_0xb317('0x2f')][_0xb317('0x48')]({'where':{'id':_0x11428f[_0xb317('0x45')]['id']}})[_0xb317('0x25')](handleEntityNotFound(_0x7acb83,null))['then'](removeEntity(_0x7acb83,null))['catch'](handleError(_0x7acb83,null));}; \ No newline at end of file +var _0x9d1d=['includeAll','find','create','body','eml-format','fast-json-patch','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','count','include','ZohoField','rows','catch','show','params'];(function(_0x43a2af,_0x46b4be){var _0x1950aa=function(_0x57e319){while(--_0x57e319){_0x43a2af['push'](_0x43a2af['shift']());}};_0x1950aa(++_0x46b4be);}(_0x9d1d,0x118));var _0xd9d1=function(_0x22238f,_0x3d6a3c){_0x22238f=_0x22238f-0x0;var _0x79dfd4=_0x9d1d[_0x22238f];return _0x79dfd4;};'use strict';var emlformat=require(_0xd9d1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd9d1('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd9d1('0x2'));var util=require(_0xd9d1('0x3'));var path=require('path');var sox=require(_0xd9d1('0x4'));var csv=require('to-csv');var ejs=require(_0xd9d1('0x5'));var fs=require('fs');var fs_extra=require(_0xd9d1('0x6'));var _=require('lodash');var squel=require(_0xd9d1('0x7'));var crypto=require(_0xd9d1('0x8'));var jsforce=require(_0xd9d1('0x9'));var deskjs=require(_0xd9d1('0xa'));var toCsv=require(_0xd9d1('0xb'));var querystring=require(_0xd9d1('0xc'));var Papa=require(_0xd9d1('0xd'));var Redis=require('ioredis');var authService=require(_0xd9d1('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd9d1('0xf'));var hardwareService=require(_0xd9d1('0x10'));var logger=require(_0xd9d1('0x11'))(_0xd9d1('0x12'));var utils=require(_0xd9d1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd9d1('0x14'));var db=require(_0xd9d1('0x15'))['db'];function respondWithStatusCode(_0x14ab8e,_0x1cefa8){_0x1cefa8=_0x1cefa8||0xcc;return function(_0x82def5){if(_0x82def5){return _0x14ab8e[_0xd9d1('0x16')](_0x1cefa8);}return _0x14ab8e[_0xd9d1('0x17')](_0x1cefa8)[_0xd9d1('0x18')]();};}function respondWithResult(_0x515b23,_0x5e27f8){_0x5e27f8=_0x5e27f8||0xc8;return function(_0x13b564){if(_0x13b564){return _0x515b23[_0xd9d1('0x17')](_0x5e27f8)[_0xd9d1('0x19')](_0x13b564);}};}function respondWithFilteredResult(_0x4a532a,_0x467d6a){return function(_0x40bbb0){if(_0x40bbb0){var _0x4ae31d=typeof _0x467d6a[_0xd9d1('0x1a')]==='undefined'&&typeof _0x467d6a[_0xd9d1('0x1b')]==='undefined';var _0x37599f=_0x40bbb0['count'];var _0x57b963=_0x4ae31d?0x0:_0x467d6a[_0xd9d1('0x1a')];var _0x45965e=_0x4ae31d?_0x40bbb0['count']:_0x467d6a['offset']+_0x467d6a[_0xd9d1('0x1b')];var _0x1970dc;if(_0x45965e>=_0x37599f){_0x45965e=_0x37599f;_0x1970dc=0xc8;}else{_0x1970dc=0xce;}_0x4a532a[_0xd9d1('0x17')](_0x1970dc);return _0x4a532a['set']('Content-Range',_0x57b963+'-'+_0x45965e+'/'+_0x37599f)[_0xd9d1('0x19')](_0x40bbb0);}return null;};}function patchUpdates(_0x210507){return function(_0x11b1a4){try{jsonpatch['apply'](_0x11b1a4,_0x210507,!![]);}catch(_0x596d51){return BPromise[_0xd9d1('0x1c')](_0x596d51);}return _0x11b1a4[_0xd9d1('0x1d')]();};}function saveUpdates(_0x31b89b,_0x35344b){return function(_0x3284ee){if(_0x3284ee){return _0x3284ee[_0xd9d1('0x1e')](_0x31b89b)[_0xd9d1('0x1f')](function(_0x535abe){return _0x535abe;});}return null;};}function removeEntity(_0x589a62,_0x24233b){return function(_0x45bbe6){if(_0x45bbe6){return _0x45bbe6[_0xd9d1('0x20')]()[_0xd9d1('0x1f')](function(){_0x589a62[_0xd9d1('0x17')](0xcc)[_0xd9d1('0x18')]();});}};}function handleEntityNotFound(_0x4c935c,_0x2b58d0){return function(_0x56093b){if(!_0x56093b){_0x4c935c[_0xd9d1('0x16')](0x194);}return _0x56093b;};}function handleError(_0x36ad05,_0x254793){_0x254793=_0x254793||0x1f4;return function(_0x279c04){logger['error'](_0x279c04[_0xd9d1('0x21')]);if(_0x279c04[_0xd9d1('0x22')]){delete _0x279c04[_0xd9d1('0x22')];}_0x36ad05[_0xd9d1('0x17')](_0x254793)[_0xd9d1('0x23')](_0x279c04);};}exports[_0xd9d1('0x24')]=function(_0x584774,_0x2eb758){var _0x1597c2={},_0x505dbd={},_0x50e32f={'count':0x0,'rows':[]};var _0x40de62=_[_0xd9d1('0x25')](db['ZohoField'][_0xd9d1('0x26')],function(_0x530d3e){return{'name':_0x530d3e[_0xd9d1('0x27')],'type':_0x530d3e['type'][_0xd9d1('0x28')]};});_0x505dbd[_0xd9d1('0x29')]=_[_0xd9d1('0x25')](_0x40de62,'name');_0x505dbd[_0xd9d1('0x2a')]=_[_0xd9d1('0x2b')](_0x584774[_0xd9d1('0x2a')]);_0x505dbd[_0xd9d1('0x2c')]=_['intersection'](_0x505dbd['model'],_0x505dbd[_0xd9d1('0x2a')]);_0x1597c2[_0xd9d1('0x2d')]=_[_0xd9d1('0x2e')](_0x505dbd[_0xd9d1('0x29')],qs[_0xd9d1('0x2f')](_0x584774[_0xd9d1('0x2a')]['fields']));_0x1597c2[_0xd9d1('0x2d')]=_0x1597c2[_0xd9d1('0x2d')][_0xd9d1('0x30')]?_0x1597c2[_0xd9d1('0x2d')]:_0x505dbd[_0xd9d1('0x29')];if(!_0x584774[_0xd9d1('0x2a')]['hasOwnProperty'](_0xd9d1('0x31'))){_0x1597c2['limit']=qs[_0xd9d1('0x1b')](_0x584774[_0xd9d1('0x2a')][_0xd9d1('0x1b')]);_0x1597c2[_0xd9d1('0x1a')]=qs[_0xd9d1('0x1a')](_0x584774[_0xd9d1('0x2a')][_0xd9d1('0x1a')]);}_0x1597c2[_0xd9d1('0x32')]=qs[_0xd9d1('0x33')](_0x584774[_0xd9d1('0x2a')][_0xd9d1('0x33')]);_0x1597c2[_0xd9d1('0x34')]=qs[_0xd9d1('0x2c')](_[_0xd9d1('0x35')](_0x584774[_0xd9d1('0x2a')],_0x505dbd[_0xd9d1('0x2c')]),_0x40de62);if(_0x584774[_0xd9d1('0x2a')][_0xd9d1('0x36')]){_0x1597c2[_0xd9d1('0x34')]=_[_0xd9d1('0x37')](_0x1597c2[_0xd9d1('0x34')],{'$or':_[_0xd9d1('0x25')](_0x40de62,function(_0x54409f){if(_0x54409f[_0xd9d1('0x38')]!=='VIRTUAL'){var _0x25380f={};_0x25380f[_0x54409f[_0xd9d1('0x22')]]={'$like':'%'+_0x584774[_0xd9d1('0x2a')][_0xd9d1('0x36')]+'%'};return _0x25380f;}})});}_0x1597c2=_['merge']({},_0x1597c2,_0x584774[_0xd9d1('0x39')]);var _0x324d98={'where':_0x1597c2[_0xd9d1('0x34')]};return db['ZohoField'][_0xd9d1('0x3a')](_0x324d98)[_0xd9d1('0x1f')](function(_0x39431e){_0x50e32f['count']=_0x39431e;if(_0x584774[_0xd9d1('0x2a')]['includeAll']){_0x1597c2[_0xd9d1('0x3b')]=[{'all':!![]}];}return db[_0xd9d1('0x3c')]['findAll'](_0x1597c2);})[_0xd9d1('0x1f')](function(_0x37ae15){_0x50e32f[_0xd9d1('0x3d')]=_0x37ae15;return _0x50e32f;})[_0xd9d1('0x1f')](respondWithFilteredResult(_0x2eb758,_0x1597c2))[_0xd9d1('0x3e')](handleError(_0x2eb758,null));};exports[_0xd9d1('0x3f')]=function(_0x5a1e5f,_0x254245){var _0x299c88={'raw':!![],'where':{'id':_0x5a1e5f[_0xd9d1('0x40')]['id']}},_0x32e7da={};_0x32e7da[_0xd9d1('0x29')]=_[_0xd9d1('0x2b')](db[_0xd9d1('0x3c')][_0xd9d1('0x26')]);_0x32e7da[_0xd9d1('0x2a')]=_[_0xd9d1('0x2b')](_0x5a1e5f['query']);_0x32e7da[_0xd9d1('0x2c')]=_[_0xd9d1('0x2e')](_0x32e7da[_0xd9d1('0x29')],_0x32e7da[_0xd9d1('0x2a')]);_0x299c88[_0xd9d1('0x2d')]=_[_0xd9d1('0x2e')](_0x32e7da[_0xd9d1('0x29')],qs[_0xd9d1('0x2f')](_0x5a1e5f[_0xd9d1('0x2a')]['fields']));_0x299c88['attributes']=_0x299c88[_0xd9d1('0x2d')][_0xd9d1('0x30')]?_0x299c88[_0xd9d1('0x2d')]:_0x32e7da['model'];if(_0x5a1e5f[_0xd9d1('0x2a')][_0xd9d1('0x41')]){_0x299c88[_0xd9d1('0x3b')]=[{'all':!![]}];}_0x299c88=_['merge']({},_0x299c88,_0x5a1e5f[_0xd9d1('0x39')]);return db['ZohoField'][_0xd9d1('0x42')](_0x299c88)[_0xd9d1('0x1f')](handleEntityNotFound(_0x254245,null))[_0xd9d1('0x1f')](respondWithResult(_0x254245,null))['catch'](handleError(_0x254245,null));};exports[_0xd9d1('0x43')]=function(_0x3e200b,_0x1f531c){return db[_0xd9d1('0x3c')][_0xd9d1('0x43')](_0x3e200b[_0xd9d1('0x44')],{})[_0xd9d1('0x1f')](respondWithResult(_0x1f531c,0xc9))[_0xd9d1('0x3e')](handleError(_0x1f531c,null));};exports['update']=function(_0x5c0c22,_0xe127d4){if(_0x5c0c22[_0xd9d1('0x44')]['id']){delete _0x5c0c22[_0xd9d1('0x44')]['id'];}return db[_0xd9d1('0x3c')][_0xd9d1('0x42')]({'where':{'id':_0x5c0c22[_0xd9d1('0x40')]['id']}})[_0xd9d1('0x1f')](handleEntityNotFound(_0xe127d4,null))[_0xd9d1('0x1f')](saveUpdates(_0x5c0c22['body'],null))['then'](respondWithResult(_0xe127d4,null))[_0xd9d1('0x3e')](handleError(_0xe127d4,null));};exports[_0xd9d1('0x20')]=function(_0x179604,_0x117f2e){return db[_0xd9d1('0x3c')]['find']({'where':{'id':_0x179604['params']['id']}})['then'](handleEntityNotFound(_0x117f2e,null))['then'](removeEntity(_0x117f2e,null))[_0xd9d1('0x3e')](handleError(_0x117f2e,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index d012d52..0f2e3ae 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 _0x5496=['moment','request-promise','rimraf','../../config/environment','./intZohoField.attributes','define','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x263cfa,_0x443531){var _0x14b8ec=function(_0x4fe59a){while(--_0x4fe59a){_0x263cfa['push'](_0x263cfa['shift']());}};_0x14b8ec(++_0x443531);}(_0x5496,0x175));var _0x6549=function(_0x44a17b,_0x1032ef){_0x44a17b=_0x44a17b-0x0;var _0x84d034=_0x5496[_0x44a17b];return _0x84d034;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('ZohoField',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2e3=['request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xf2e3[_0x307d86];return _0x361745;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var logger=require(_0x3f2e('0x1'))(_0x3f2e('0x2'));var moment=require(_0x3f2e('0x3'));var BPromise=require(_0x3f2e('0x4'));var rp=require(_0x3f2e('0x5'));var fs=require('fs');var path=require(_0x3f2e('0x6'));var rimraf=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var attributes=require(_0x3f2e('0x9'));module['exports']=function(_0x33a3b7,_0xdd6b3e){return _0x33a3b7[_0x3f2e('0xa')](_0x3f2e('0xb'),attributes,{'tableName':_0x3f2e('0xc'),'paranoid':![],'indexes':[{'name':_0x3f2e('0xd'),'fields':[_0x3f2e('0xe'),_0x3f2e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 48767f1..70d319b 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 _0x50d3=['request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x1b25c1,_0x2c6ce6){var _0x1e4447=function(_0xaaafca){while(--_0xaaafca){_0x1b25c1['push'](_0x1b25c1['shift']());}};_0x1e4447(++_0x2c6ce6);}(_0x50d3,0x7a));var _0x350d=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0x50d3[_0x26da89];return _0xc95b7b;};'use strict';var _=require(_0x350d('0x0'));var util=require(_0x350d('0x1'));var moment=require('moment');var BPromise=require(_0x350d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x350d('0x3'));var db=require(_0x350d('0x4'))['db'];var utils=require(_0x350d('0x5'));var logger=require(_0x350d('0x6'))('rpc');var config=require(_0x350d('0x7'));var jayson=require(_0x350d('0x8'));var client=jayson['client'][_0x350d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x248f2a,_0x412baa,_0x57799a){return new BPromise(function(_0x1968a2,_0x5ec08f){return client[_0x350d('0xa')](_0x248f2a,_0x57799a)[_0x350d('0xb')](function(_0x47208e){logger['info'](_0x350d('0xc'),_0x412baa,_0x350d('0xd'));logger[_0x350d('0xe')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x412baa,_0x350d('0xd'),JSON[_0x350d('0xf')](_0x47208e));if(_0x47208e[_0x350d('0x10')]){if(_0x47208e['error'][_0x350d('0x11')]===0x1f4){logger[_0x350d('0x10')](_0x350d('0xc'),_0x412baa,_0x47208e['error']['message']);return _0x5ec08f(_0x47208e[_0x350d('0x10')][_0x350d('0x12')]);}logger[_0x350d('0x10')](_0x350d('0xc'),_0x412baa,_0x47208e['error'][_0x350d('0x12')]);return _0x1968a2(_0x47208e[_0x350d('0x10')][_0x350d('0x12')]);}else{logger[_0x350d('0x13')](_0x350d('0xc'),_0x412baa,_0x350d('0xd'));_0x1968a2(_0x47208e[_0x350d('0x14')][_0x350d('0x12')]);}})[_0x350d('0x15')](function(_0x3b015a){logger[_0x350d('0x10')]('ZohoField,\x20%s,\x20%s',_0x412baa,_0x3b015a);_0x5ec08f(_0x3b015a);});});} \ No newline at end of file +var _0x4bd8=['rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','ZohoField,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../config/utils','../../config/logger'];(function(_0x48aeae,_0x448bc6){var _0x37be75=function(_0x53e47a){while(--_0x53e47a){_0x48aeae['push'](_0x48aeae['shift']());}};_0x37be75(++_0x448bc6);}(_0x4bd8,0xf6));var _0x84bd=function(_0x4f1376,_0x50f35b){_0x4f1376=_0x4f1376-0x0;var _0x582a90=_0x4bd8[_0x4f1376];return _0x582a90;};'use strict';var _=require(_0x84bd('0x0'));var util=require(_0x84bd('0x1'));var moment=require(_0x84bd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x84bd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x84bd('0x4'));var logger=require(_0x84bd('0x5'))(_0x84bd('0x6'));var config=require(_0x84bd('0x7'));var jayson=require(_0x84bd('0x8'));var client=jayson['client'][_0x84bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf7d75d,_0x2be597,_0x5ad6ba){return new BPromise(function(_0x23a2d0,_0x38cf9e){return client[_0x84bd('0xa')](_0xf7d75d,_0x5ad6ba)[_0x84bd('0xb')](function(_0x3922b9){logger[_0x84bd('0xc')]('ZohoField,\x20%s,\x20%s',_0x2be597,_0x84bd('0xd'));logger[_0x84bd('0xe')](_0x84bd('0xf'),_0x2be597,'request\x20sent',JSON[_0x84bd('0x10')](_0x3922b9));if(_0x3922b9[_0x84bd('0x11')]){if(_0x3922b9[_0x84bd('0x11')]['code']===0x1f4){logger[_0x84bd('0x11')](_0x84bd('0x12'),_0x2be597,_0x3922b9['error']['message']);return _0x38cf9e(_0x3922b9[_0x84bd('0x11')]['message']);}logger[_0x84bd('0x11')](_0x84bd('0x12'),_0x2be597,_0x3922b9[_0x84bd('0x11')][_0x84bd('0x13')]);return _0x23a2d0(_0x3922b9[_0x84bd('0x11')]['message']);}else{logger['info'](_0x84bd('0x12'),_0x2be597,_0x84bd('0xd'));_0x23a2d0(_0x3922b9[_0x84bd('0x14')][_0x84bd('0x13')]);}})['catch'](function(_0x37350d){logger[_0x84bd('0x11')](_0x84bd('0x12'),_0x2be597,_0x37350d);_0x38cf9e(_0x37350d);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 7cd4800..367c3af 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xd8f589,_0x5d0f06){var _0x22ac88=function(_0x1e3091){while(--_0x1e3091){_0xd8f589['push'](_0xd8f589['shift']());}};_0x22ac88(++_0x5d0f06);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x226ad1,_0x2858e2){_0x226ad1=_0x226ad1-0x0;var _0x16b625=_0xcb91[_0x226ad1];return _0x16b625;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x66f647,_0x4d5140){var _0xd1c9fd=function(_0x29e43c){while(--_0x29e43c){_0x66f647['push'](_0x66f647['shift']());}};_0xd1c9fd(++_0x4d5140);}(_0xe706,0xa3));var _0x6e70=function(_0x15eab7,_0x49bed6){_0x15eab7=_0x15eab7-0x0;var _0x1f15c6=_0xe706[_0x15eab7];return _0x1f15c6;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 0430bcf..233196d 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 _0xb8cf=['STRING','BOOLEAN','state','sequelize','unique_name_and_version'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb8cf,0xf3));var _0xfb8c=function(_0x523ee8,_0x32ba42){_0x523ee8=_0x523ee8-0x0;var _0x3aa7fe=_0xb8cf[_0x523ee8];return _0x3aa7fe;};'use strict';var Sequelize=require(_0xfb8c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfb8c('0x1')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfb8c('0x1')},'main':{'type':Sequelize[_0xfb8c('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xfb8c('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xfb8c('0x3')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xfb8c('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0xfb8c('0x4')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xfb8c('0x2')]},'remoteUri':{'type':Sequelize[_0xfb8c('0x2')]},'link':{'type':Sequelize[_0xfb8c('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xa886=['BOOLEAN','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x496624,_0x16d7ab){var _0x3c4852=function(_0x457d13){while(--_0x457d13){_0x496624['push'](_0x496624['shift']());}};_0x3c4852(++_0x16d7ab);}(_0xa886,0x193));var _0x6a88=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xa886[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x6a88('0x0')]={'name':{'type':Sequelize[_0x6a88('0x1')],'allowNull':![],'unique':_0x6a88('0x2')},'version':{'type':Sequelize[_0x6a88('0x1')],'allowNull':![],'unique':_0x6a88('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x6a88('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6a88('0x1')]},'size':{'type':Sequelize[_0x6a88('0x4')]},'active':{'type':Sequelize[_0x6a88('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x6a88('0x1')]},'state':{'type':Sequelize[_0x6a88('0x1')],'unique':'state'},'description':{'type':Sequelize[_0x6a88('0x1')]},'title':{'type':Sequelize[_0x6a88('0x1')]},'remoteUri':{'type':Sequelize[_0x6a88('0x1')]},'link':{'type':Sequelize[_0x6a88('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index e7aaf32..332dded 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 _0x53ec=['count','set','Content-Range','apply','reject','save','then','sendStatus','name','send','map','Integration','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','show','params','include','find','catch','create','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x53ec,0x192));var _0xc53e=function(_0x415264,_0x4e71cc){_0x415264=_0x415264-0x0;var _0x305b9e=_0x53ec[_0x415264];return _0x305b9e;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');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('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];function respondWithStatusCode(_0x863fa,_0x4203aa){_0x4203aa=_0x4203aa||0xcc;return function(_0x56f0e5){if(_0x56f0e5){return _0x863fa['sendStatus'](_0x4203aa);}return _0x863fa[_0xc53e('0x18')](_0x4203aa)[_0xc53e('0x19')]();};}function respondWithResult(_0x7cd798,_0x3d2e17){_0x3d2e17=_0x3d2e17||0xc8;return function(_0x358ef3){if(_0x358ef3){return _0x7cd798[_0xc53e('0x18')](_0x3d2e17)[_0xc53e('0x1a')](_0x358ef3);}};}function respondWithFilteredResult(_0x19c0d1,_0x455e4d){return function(_0x2ad6eb){if(_0x2ad6eb){var _0x5b0a88=typeof _0x455e4d[_0xc53e('0x1b')]===_0xc53e('0x1c')&&typeof _0x455e4d[_0xc53e('0x1d')]===_0xc53e('0x1c');var _0x15333b=_0x2ad6eb[_0xc53e('0x1e')];var _0x164016=_0x5b0a88?0x0:_0x455e4d[_0xc53e('0x1b')];var _0x3b550e=_0x5b0a88?_0x2ad6eb['count']:_0x455e4d['offset']+_0x455e4d[_0xc53e('0x1d')];var _0x2a5bac;if(_0x3b550e>=_0x15333b){_0x3b550e=_0x15333b;_0x2a5bac=0xc8;}else{_0x2a5bac=0xce;}_0x19c0d1[_0xc53e('0x18')](_0x2a5bac);return _0x19c0d1[_0xc53e('0x1f')](_0xc53e('0x20'),_0x164016+'-'+_0x3b550e+'/'+_0x15333b)[_0xc53e('0x1a')](_0x2ad6eb);}return null;};}function patchUpdates(_0x15a015){return function(_0x25702b){try{jsonpatch[_0xc53e('0x21')](_0x25702b,_0x15a015,!![]);}catch(_0x401af6){return BPromise[_0xc53e('0x22')](_0x401af6);}return _0x25702b[_0xc53e('0x23')]();};}function saveUpdates(_0x426467,_0x4fb695){return function(_0x47cfdd){if(_0x47cfdd){return _0x47cfdd['update'](_0x426467)[_0xc53e('0x24')](function(_0x384218){return _0x384218;});}return null;};}function removeEntity(_0x7591c1,_0x4015c8){return function(_0x180811){if(_0x180811){return _0x180811['destroy']()['then'](function(){_0x7591c1[_0xc53e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae55e,_0x3a5ce8){return function(_0x443179){if(!_0x443179){_0x1ae55e[_0xc53e('0x25')](0x194);}return _0x443179;};}function handleError(_0x63c5dc,_0x4df8cf){_0x4df8cf=_0x4df8cf||0x1f4;return function(_0x398e7a){logger['error'](_0x398e7a['stack']);if(_0x398e7a['name']){delete _0x398e7a[_0xc53e('0x26')];}_0x63c5dc['status'](_0x4df8cf)[_0xc53e('0x27')](_0x398e7a);};}exports['index']=function(_0x24a77e,_0x5112d2){var _0x5ce216={},_0x8f0ee6={},_0x6a62b0={'count':0x0,'rows':[]};var _0x42dec1=_[_0xc53e('0x28')](db[_0xc53e('0x29')][_0xc53e('0x2a')],function(_0x3280fe){return{'name':_0x3280fe[_0xc53e('0x2b')],'type':_0x3280fe['type'][_0xc53e('0x2c')]};});_0x8f0ee6[_0xc53e('0x2d')]=_[_0xc53e('0x28')](_0x42dec1,'name');_0x8f0ee6[_0xc53e('0x2e')]=_['keys'](_0x24a77e[_0xc53e('0x2e')]);_0x8f0ee6[_0xc53e('0x2f')]=_['intersection'](_0x8f0ee6['model'],_0x8f0ee6[_0xc53e('0x2e')]);_0x5ce216[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x8f0ee6[_0xc53e('0x2d')],qs[_0xc53e('0x32')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x5ce216[_0xc53e('0x30')]=_0x5ce216['attributes'][_0xc53e('0x33')]?_0x5ce216[_0xc53e('0x30')]:_0x8f0ee6[_0xc53e('0x2d')];if(!_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x34')](_0xc53e('0x35'))){_0x5ce216[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x24a77e[_0xc53e('0x2e')]['limit']);_0x5ce216[_0xc53e('0x1b')]=qs['offset'](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x1b')]);}_0x5ce216['order']=qs[_0xc53e('0x36')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x36')]);_0x5ce216['where']=qs[_0xc53e('0x2f')](_[_0xc53e('0x37')](_0x24a77e[_0xc53e('0x2e')],_0x8f0ee6[_0xc53e('0x2f')]),_0x42dec1);if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]){_0x5ce216[_0xc53e('0x39')]=_['merge'](_0x5ce216[_0xc53e('0x39')],{'$or':_[_0xc53e('0x28')](_0x42dec1,function(_0x2db711){if(_0x2db711['type']!==_0xc53e('0x3a')){var _0x5e8ab7={};_0x5e8ab7[_0x2db711[_0xc53e('0x26')]]={'$like':'%'+_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]+'%'};return _0x5e8ab7;}})});}_0x5ce216=_[_0xc53e('0x3b')]({},_0x5ce216,_0x24a77e[_0xc53e('0x3c')]);var _0x5507d0={'where':_0x5ce216[_0xc53e('0x39')]};return db[_0xc53e('0x29')]['count'](_0x5507d0)['then'](function(_0x5e9e15){_0x6a62b0['count']=_0x5e9e15;if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x5ce216['include']=[{'all':!![]}];}return db[_0xc53e('0x29')]['findAll'](_0x5ce216);})['then'](function(_0x53447e){_0x6a62b0[_0xc53e('0x3e')]=_0x53447e;return _0x6a62b0;})['then'](respondWithFilteredResult(_0x5112d2,_0x5ce216))['catch'](handleError(_0x5112d2,null));};exports[_0xc53e('0x3f')]=function(_0x53a82f,_0x422088){var _0x360af9={'raw':![],'where':{'id':_0x53a82f[_0xc53e('0x40')]['id']}},_0x49f204={};_0x49f204[_0xc53e('0x2d')]=_['keys'](db[_0xc53e('0x29')]['rawAttributes']);_0x49f204['query']=_['keys'](_0x53a82f['query']);_0x49f204[_0xc53e('0x2f')]=_[_0xc53e('0x31')](_0x49f204[_0xc53e('0x2d')],_0x49f204['query']);_0x360af9[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x49f204['model'],qs['fields'](_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x360af9[_0xc53e('0x30')]=_0x360af9['attributes'][_0xc53e('0x33')]?_0x360af9[_0xc53e('0x30')]:_0x49f204[_0xc53e('0x2d')];if(_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x360af9[_0xc53e('0x41')]=[{'all':!![]}];}_0x360af9=_[_0xc53e('0x3b')]({},_0x360af9,_0x53a82f['options']);return db[_0xc53e('0x29')][_0xc53e('0x42')](_0x360af9)[_0xc53e('0x24')](handleEntityNotFound(_0x422088,null))['then'](respondWithResult(_0x422088,null))[_0xc53e('0x43')](handleError(_0x422088,null));};exports[_0xc53e('0x44')]=function(_0x4458c8,_0x15e744){return db[_0xc53e('0x29')][_0xc53e('0x44')](_0x4458c8['body'],{})[_0xc53e('0x24')](respondWithResult(_0x15e744,0xc9))[_0xc53e('0x43')](handleError(_0x15e744,null));};exports[_0xc53e('0x45')]=function(_0x5a6e41,_0x33d45c){if(_0x5a6e41[_0xc53e('0x46')]['id']){delete _0x5a6e41[_0xc53e('0x46')]['id'];}return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'id':_0x5a6e41[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x33d45c,null))[_0xc53e('0x24')](saveUpdates(_0x5a6e41[_0xc53e('0x46')],null))[_0xc53e('0x24')](respondWithResult(_0x33d45c,null))['catch'](handleError(_0x33d45c,null));};exports[_0xc53e('0x47')]=function(_0x17cf13,_0x38520c){return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'id':_0x17cf13['params']['id']}})['then'](handleEntityNotFound(_0x38520c,null))[_0xc53e('0x24')](removeEntity(_0x38520c,null))['catch'](handleError(_0x38520c,null));}; \ No newline at end of file +var _0xc1c6=['type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','Integration','rawAttributes'];(function(_0x1cadad,_0x25aba8){var _0x2ebed7=function(_0x266a12){while(--_0x266a12){_0x1cadad['push'](_0x1cadad['shift']());}};_0x2ebed7(++_0x25aba8);}(_0xc1c6,0xf7));var _0x6c1c=function(_0xbc4245,_0x2041be){_0xbc4245=_0xbc4245-0x0;var _0x4c309a=_0xc1c6[_0xbc4245];return _0x4c309a;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['Integration']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['Integration'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['Integration'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['create']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')](_0x1fe6e8[_0x6c1c('0x48')],{})[_0x6c1c('0x25')](respondWithResult(_0x58d075,0xc9))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x52c14d,_0xa9889a){if(_0x52c14d[_0x6c1c('0x48')]['id']){delete _0x52c14d['body']['id'];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'id':_0x52c14d[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0xa9889a,null))['then'](saveUpdates(_0x52c14d[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0xa9889a,null))[_0x6c1c('0x41')](handleError(_0xa9889a,null));};exports['destroy']=function(_0x5b8d69,_0x56b367){return db['Integration']['find']({'where':{'id':_0x5b8d69[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x56b367,null))['then'](removeEntity(_0x56b367,null))[_0x6c1c('0x41')](handleError(_0x56b367,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 8fa9245..77f7124 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 _0xa8f2=['./integration.attributes','exports','define','Integration','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f395d,_0x266717){var _0x5b46da=function(_0x3fba7b){while(--_0x3fba7b){_0x2f395d['push'](_0x2f395d['shift']());}};_0x5b46da(++_0x266717);}(_0xa8f2,0xe1));var _0x2a8f=function(_0x5f1d18,_0x990a81){_0x5f1d18=_0x5f1d18-0x0;var _0x458737=_0xa8f2[_0x5f1d18];return _0x458737;};'use strict';var _=require('lodash');var util=require(_0x2a8f('0x0'));var logger=require(_0x2a8f('0x1'))(_0x2a8f('0x2'));var moment=require(_0x2a8f('0x3'));var BPromise=require(_0x2a8f('0x4'));var rp=require(_0x2a8f('0x5'));var fs=require('fs');var path=require(_0x2a8f('0x6'));var rimraf=require(_0x2a8f('0x7'));var config=require(_0x2a8f('0x8'));var attributes=require(_0x2a8f('0x9'));module[_0x2a8f('0xa')]=function(_0x4d0ba7,_0x20bcaa){return _0x4d0ba7[_0x2a8f('0xb')](_0x2a8f('0xc'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37cd=['define','Integration','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes'];(function(_0x4b6643,_0x9e4308){var _0x3dc376=function(_0x39aab1){while(--_0x39aab1){_0x4b6643['push'](_0x4b6643['shift']());}};_0x3dc376(++_0x9e4308);}(_0x37cd,0x70));var _0xd37c=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x37cd[_0x50007c];return _0x5c1ec7;};'use strict';var _=require('lodash');var util=require(_0xd37c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd37c('0x1'));var BPromise=require(_0xd37c('0x2'));var rp=require(_0xd37c('0x3'));var fs=require('fs');var path=require(_0xd37c('0x4'));var rimraf=require(_0xd37c('0x5'));var config=require(_0xd37c('0x6'));var attributes=require(_0xd37c('0x7'));module['exports']=function(_0x2a79d6,_0x4e394a){return _0x2a79d6[_0xd37c('0x8')](_0xd37c('0x9'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 64431c0..640ef79 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Integration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x12ebd8,_0x4e3656){var _0x2fab44=function(_0x5a6683){while(--_0x5a6683){_0x12ebd8['push'](_0x12ebd8['shift']());}};_0x2fab44(++_0x4e3656);}(_0x5f2f,0x73));var _0xf5f2=function(_0x34d8f2,_0x57f54d){_0x34d8f2=_0x34d8f2-0x0;var _0x361f7c=_0x5f2f[_0x34d8f2];return _0x361f7c;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','catch','lodash'];(function(_0xb9310c,_0x34e350){var _0x24926f=function(_0x59b4ff){while(--_0x59b4ff){_0xb9310c['push'](_0xb9310c['shift']());}};_0x24926f(++_0x34e350);}(_0x66fa,0x117));var _0xa66f=function(_0x5c4fb4,_0x32f7b6){_0x5c4fb4=_0x5c4fb4-0x0;var _0x5a4616=_0x66fa[_0x5c4fb4];return _0x5a4616;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Integration,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Integration,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 3a2e657..5630d83 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 _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x2b2257,_0x268a09){var _0x3882c9=function(_0x447664){while(--_0x447664){_0x2b2257['push'](_0x2b2257['shift']());}};_0x3882c9(++_0x268a09);}(_0x2ef3,0xba));var _0x32ef=function(_0xffe25a,_0x277a01){_0xffe25a=_0xffe25a-0x0;var _0x3b9560=_0x2ef3[_0xffe25a];return _0x3b9560;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file +var _0xef0f=['update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x10b1a4,_0x1af8ab){var _0x1e9883=function(_0x1c70ad){while(--_0x1c70ad){_0x10b1a4['push'](_0x10b1a4['shift']());}};_0x1e9883(++_0x1af8ab);}(_0xef0f,0x168));var _0xfef0=function(_0x2a5191,_0x345e50){_0x2a5191=_0x2a5191-0x0;var _0x416508=_0xef0f[_0x2a5191];return _0x416508;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['get'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xe')]);router[_0xfef0('0xf')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x11')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x13')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 4d5f8fa..8755235 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 _0x5924=['RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x1d1899,_0x1a11af){var _0x1f77da=function(_0x78fbd4){while(--_0x78fbd4){_0x1d1899['push'](_0x1d1899['shift']());}};_0x1f77da(++_0x1a11af);}(_0x5924,0xd3));var _0x4592=function(_0x47bc5e,_0x6fc500){_0x47bc5e=_0x47bc5e-0x0;var _0x323a59=_0x5924[_0x47bc5e];return _0x323a59;};'use strict';var Sequelize=require(_0x4592('0x0'));module[_0x4592('0x1')]={'integration':{'type':Sequelize[_0x4592('0x2')]},'eventChannel':{'type':Sequelize[_0x4592('0x2')]},'exitStatus':{'type':Sequelize[_0x4592('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x4592('0x3')]},'contacts':{'type':Sequelize[_0x4592('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4592('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4592('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x4592('0x4')]},'holdtime':{'type':Sequelize[_0x4592('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4592('0x4')]},'talktime':{'type':Sequelize[_0x4592('0x3')]},'agentacw':{'type':Sequelize[_0x4592('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4592('0x3')]},'reason':{'type':Sequelize[_0x4592('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x4592('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4592('0x4')]},'agentdump':{'type':Sequelize[_0x4592('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4592('0x4')]},'lastevent':{'type':Sequelize[_0x4592('0x2')]},'channel':{'type':Sequelize[_0x4592('0x2')]},'channelstate':{'type':Sequelize[_0x4592('0x3')]},'channelstatedesc':{'type':Sequelize[_0x4592('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4592('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4592('0x2')]},'priority':{'type':Sequelize[_0x4592('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x4592('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x4592('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4592('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x4592('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x4592('0x2')]},'destaccountcode':{'type':Sequelize[_0x4592('0x2')]},'destcontext':{'type':Sequelize[_0x4592('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x4592('0x2')]},'messageId':{'type':Sequelize[_0x4592('0x2')]},'inReplyTo':{'type':Sequelize[_0x4592('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x4592('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x4592('0x6')]},'html':{'type':Sequelize[_0x4592('0x6')]},'text':{'type':Sequelize[_0x4592('0x6')]},'status':{'type':Sequelize[_0x4592('0x7')](_0x4592('0x8'),'SENDING',_0x4592('0x9'),_0x4592('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x4592('0x2')]},'projectId':{'type':Sequelize[_0x4592('0x3')]}}; \ No newline at end of file +var _0xfa17=['INTEGER','DATE','BOOLEAN','TEXT','SENDING','RECEIVED','sequelize','exports','STRING'];(function(_0x427582,_0x4f5622){var _0x57a7b1=function(_0x4e7d42){while(--_0x4e7d42){_0x427582['push'](_0x427582['shift']());}};_0x57a7b1(++_0x4f5622);}(_0xfa17,0x10b));var _0x7fa1=function(_0x312128,_0x5ed1e8){_0x312128=_0x312128-0x0;var _0x38da7a=_0xfa17[_0x312128];return _0x38da7a;};'use strict';var Sequelize=require(_0x7fa1('0x0'));module[_0x7fa1('0x1')]={'integration':{'type':Sequelize[_0x7fa1('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x7fa1('0x2')]},'ticketId':{'type':Sequelize[_0x7fa1('0x2')]},'integrationId':{'type':Sequelize[_0x7fa1('0x3')]},'contacts':{'type':Sequelize[_0x7fa1('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7fa1('0x2')]},'calleridname':{'type':Sequelize[_0x7fa1('0x2')]},'queue':{'type':Sequelize[_0x7fa1('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7fa1('0x2')]},'agentcalledAt':{'type':Sequelize[_0x7fa1('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x7fa1('0x3')]},'agentcomplete':{'type':Sequelize[_0x7fa1('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x7fa1('0x4')]},'talktime':{'type':Sequelize[_0x7fa1('0x3')]},'agentacw':{'type':Sequelize[_0x7fa1('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7fa1('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x7fa1('0x4')]},'agentdump':{'type':Sequelize[_0x7fa1('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7fa1('0x4')]},'lastevent':{'type':Sequelize[_0x7fa1('0x2')]},'channel':{'type':Sequelize[_0x7fa1('0x2')]},'channelstate':{'type':Sequelize[_0x7fa1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x7fa1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7fa1('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7fa1('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7fa1('0x2')]},'exten':{'type':Sequelize[_0x7fa1('0x2')]},'priority':{'type':Sequelize[_0x7fa1('0x2')]},'destchannel':{'type':Sequelize[_0x7fa1('0x2')]},'destchannelstate':{'type':Sequelize[_0x7fa1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x7fa1('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x7fa1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7fa1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7fa1('0x2')]},'destlanguage':{'type':Sequelize[_0x7fa1('0x2')]},'destaccountcode':{'type':Sequelize[_0x7fa1('0x2')]},'destcontext':{'type':Sequelize[_0x7fa1('0x2')]},'destexten':{'type':Sequelize[_0x7fa1('0x2')]},'destpriority':{'type':Sequelize[_0x7fa1('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x7fa1('0x2')]},'inReplyTo':{'type':Sequelize[_0x7fa1('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x7fa1('0x2')]},'to':{'type':Sequelize[_0x7fa1('0x2')]},'cc':{'type':Sequelize[_0x7fa1('0x2')]},'attachment':{'type':Sequelize[_0x7fa1('0x6')]},'html':{'type':Sequelize[_0x7fa1('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM']('SENT',_0x7fa1('0x7'),_0x7fa1('0x8'),'FAILED')},'url':{'type':Sequelize[_0x7fa1('0x2')]},'app':{'type':Sequelize[_0x7fa1('0x2')]},'appdata':{'type':Sequelize[_0x7fa1('0x2')]},'projectId':{'type':Sequelize[_0x7fa1('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 1726d8f..90bcd83 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 _0x9b93=['../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','error','name','send','index','map','IntegrationReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','then','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x106a74,_0x51ad4b){var _0x1c5273=function(_0x29f69d){while(--_0x29f69d){_0x106a74['push'](_0x106a74['shift']());}};_0x1c5273(++_0x51ad4b);}(_0x9b93,0xca));var _0x39b9=function(_0x67b075,_0x43557d){_0x67b075=_0x67b075-0x0;var _0x39d030=_0x9b93[_0x67b075];return _0x39d030;};'use strict';var emlformat=require(_0x39b9('0x0'));var rimraf=require(_0x39b9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x39b9('0x2'));var moment=require('moment');var BPromise=require(_0x39b9('0x3'));var Mustache=require('mustache');var util=require(_0x39b9('0x4'));var path=require('path');var sox=require(_0x39b9('0x5'));var csv=require(_0x39b9('0x6'));var ejs=require(_0x39b9('0x7'));var fs=require('fs');var fs_extra=require(_0x39b9('0x8'));var _=require(_0x39b9('0x9'));var squel=require(_0x39b9('0xa'));var crypto=require(_0x39b9('0xb'));var jsforce=require(_0x39b9('0xc'));var deskjs=require(_0x39b9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x39b9('0xe'));var Papa=require('papaparse');var Redis=require(_0x39b9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x39b9('0x10'));var as=require(_0x39b9('0x11'));var hardwareService=require(_0x39b9('0x12'));var logger=require('../../config/logger')(_0x39b9('0x13'));var utils=require(_0x39b9('0x14'));var config=require(_0x39b9('0x15'));var licenseUtil=require(_0x39b9('0x16'));var db=require(_0x39b9('0x17'))['db'];function respondWithStatusCode(_0xb8849e,_0x40467a){_0x40467a=_0x40467a||0xcc;return function(_0x3c2f63){if(_0x3c2f63){return _0xb8849e[_0x39b9('0x18')](_0x40467a);}return _0xb8849e[_0x39b9('0x19')](_0x40467a)[_0x39b9('0x1a')]();};}function respondWithResult(_0x4d7c8e,_0x5ed65a){_0x5ed65a=_0x5ed65a||0xc8;return function(_0x284e81){if(_0x284e81){return _0x4d7c8e[_0x39b9('0x19')](_0x5ed65a)['json'](_0x284e81);}};}function respondWithFilteredResult(_0x27c4c2,_0x3812b9){return function(_0x44cdf0){if(_0x44cdf0){var _0xf6d414=typeof _0x3812b9[_0x39b9('0x1b')]===_0x39b9('0x1c')&&typeof _0x3812b9[_0x39b9('0x1d')]==='undefined';var _0x39fadc=_0x44cdf0[_0x39b9('0x1e')];var _0x28c948=_0xf6d414?0x0:_0x3812b9[_0x39b9('0x1b')];var _0x16ca80=_0xf6d414?_0x44cdf0[_0x39b9('0x1e')]:_0x3812b9[_0x39b9('0x1b')]+_0x3812b9['limit'];var _0x402f09;if(_0x16ca80>=_0x39fadc){_0x16ca80=_0x39fadc;_0x402f09=0xc8;}else{_0x402f09=0xce;}_0x27c4c2[_0x39b9('0x19')](_0x402f09);return _0x27c4c2[_0x39b9('0x1f')](_0x39b9('0x20'),_0x28c948+'-'+_0x16ca80+'/'+_0x39fadc)[_0x39b9('0x21')](_0x44cdf0);}return null;};}function patchUpdates(_0x2d0ebe){return function(_0x391540){try{jsonpatch['apply'](_0x391540,_0x2d0ebe,!![]);}catch(_0x259605){return BPromise[_0x39b9('0x22')](_0x259605);}return _0x391540[_0x39b9('0x23')]();};}function saveUpdates(_0x3fb32c,_0x4eea64){return function(_0x432e32){if(_0x432e32){return _0x432e32[_0x39b9('0x24')](_0x3fb32c)['then'](function(_0x201678){return _0x201678;});}return null;};}function removeEntity(_0x5a3e9b,_0x20962a){return function(_0x516bc8){if(_0x516bc8){return _0x516bc8[_0x39b9('0x25')]()['then'](function(){_0x5a3e9b['status'](0xcc)[_0x39b9('0x1a')]();});}};}function handleEntityNotFound(_0x2f37ab,_0x140af6){return function(_0x159f44){if(!_0x159f44){_0x2f37ab[_0x39b9('0x18')](0x194);}return _0x159f44;};}function handleError(_0x59c2f5,_0x32fc94){_0x32fc94=_0x32fc94||0x1f4;return function(_0x38abbc){logger[_0x39b9('0x26')](_0x38abbc['stack']);if(_0x38abbc[_0x39b9('0x27')]){delete _0x38abbc[_0x39b9('0x27')];}_0x59c2f5[_0x39b9('0x19')](_0x32fc94)[_0x39b9('0x28')](_0x38abbc);};}exports[_0x39b9('0x29')]=function(_0x54ab7,_0xc9cc28){var _0x4a737e={},_0x52062f={},_0x1296f5={'count':0x0,'rows':[]};var _0x483e48=_[_0x39b9('0x2a')](db[_0x39b9('0x2b')][_0x39b9('0x2c')],function(_0x15dc1a){return{'name':_0x15dc1a[_0x39b9('0x2d')],'type':_0x15dc1a['type']['key']};});_0x52062f[_0x39b9('0x2e')]=_[_0x39b9('0x2a')](_0x483e48,_0x39b9('0x27'));_0x52062f[_0x39b9('0x2f')]=_[_0x39b9('0x30')](_0x54ab7[_0x39b9('0x2f')]);_0x52062f[_0x39b9('0x31')]=_[_0x39b9('0x32')](_0x52062f[_0x39b9('0x2e')],_0x52062f['query']);_0x4a737e[_0x39b9('0x33')]=_[_0x39b9('0x32')](_0x52062f[_0x39b9('0x2e')],qs[_0x39b9('0x34')](_0x54ab7['query']['fields']));_0x4a737e['attributes']=_0x4a737e[_0x39b9('0x33')][_0x39b9('0x35')]?_0x4a737e['attributes']:_0x52062f['model'];if(!_0x54ab7[_0x39b9('0x2f')][_0x39b9('0x36')](_0x39b9('0x37'))){_0x4a737e['limit']=qs[_0x39b9('0x1d')](_0x54ab7[_0x39b9('0x2f')][_0x39b9('0x1d')]);_0x4a737e[_0x39b9('0x1b')]=qs[_0x39b9('0x1b')](_0x54ab7[_0x39b9('0x2f')][_0x39b9('0x1b')]);}_0x4a737e[_0x39b9('0x38')]=qs[_0x39b9('0x39')](_0x54ab7[_0x39b9('0x2f')]['sort']);_0x4a737e[_0x39b9('0x3a')]=qs[_0x39b9('0x31')](_['pick'](_0x54ab7[_0x39b9('0x2f')],_0x52062f['filters']),_0x483e48);if(_0x54ab7[_0x39b9('0x2f')][_0x39b9('0x3b')]){_0x4a737e[_0x39b9('0x3a')]=_[_0x39b9('0x3c')](_0x4a737e[_0x39b9('0x3a')],{'$or':_['map'](_0x483e48,function(_0x2331e9){if(_0x2331e9[_0x39b9('0x3d')]!=='VIRTUAL'){var _0x33b5d1={};_0x33b5d1[_0x2331e9[_0x39b9('0x27')]]={'$like':'%'+_0x54ab7[_0x39b9('0x2f')][_0x39b9('0x3b')]+'%'};return _0x33b5d1;}})});}_0x4a737e=_[_0x39b9('0x3c')]({},_0x4a737e,_0x54ab7[_0x39b9('0x3e')]);var _0x3e01da={'where':_0x4a737e[_0x39b9('0x3a')]};return db[_0x39b9('0x2b')][_0x39b9('0x1e')](_0x3e01da)[_0x39b9('0x3f')](function(_0x4494ea){_0x1296f5['count']=_0x4494ea;if(_0x54ab7['query'][_0x39b9('0x40')]){_0x4a737e[_0x39b9('0x41')]=[{'all':!![]}];}return db[_0x39b9('0x2b')][_0x39b9('0x42')](_0x4a737e);})['then'](function(_0x65e529){_0x1296f5[_0x39b9('0x43')]=_0x65e529;return _0x1296f5;})[_0x39b9('0x3f')](respondWithFilteredResult(_0xc9cc28,_0x4a737e))[_0x39b9('0x44')](handleError(_0xc9cc28,null));};exports[_0x39b9('0x45')]=function(_0x40bcd2,_0x4016c7){var _0x526335={'raw':![],'where':{'id':_0x40bcd2[_0x39b9('0x46')]['id']}},_0x139407={};_0x139407[_0x39b9('0x2e')]=_['keys'](db[_0x39b9('0x2b')][_0x39b9('0x2c')]);_0x139407[_0x39b9('0x2f')]=_[_0x39b9('0x30')](_0x40bcd2[_0x39b9('0x2f')]);_0x139407[_0x39b9('0x31')]=_['intersection'](_0x139407[_0x39b9('0x2e')],_0x139407[_0x39b9('0x2f')]);_0x526335[_0x39b9('0x33')]=_['intersection'](_0x139407[_0x39b9('0x2e')],qs['fields'](_0x40bcd2[_0x39b9('0x2f')][_0x39b9('0x34')]));_0x526335[_0x39b9('0x33')]=_0x526335['attributes']['length']?_0x526335[_0x39b9('0x33')]:_0x139407['model'];if(_0x40bcd2[_0x39b9('0x2f')][_0x39b9('0x40')]){_0x526335[_0x39b9('0x41')]=[{'all':!![]}];}_0x526335=_[_0x39b9('0x3c')]({},_0x526335,_0x40bcd2['options']);return db[_0x39b9('0x2b')]['find'](_0x526335)['then'](handleEntityNotFound(_0x4016c7,null))[_0x39b9('0x3f')](respondWithResult(_0x4016c7,null))[_0x39b9('0x44')](handleError(_0x4016c7,null));};exports['create']=function(_0x18f26f,_0x2e14e4){return db[_0x39b9('0x2b')][_0x39b9('0x47')](_0x18f26f[_0x39b9('0x48')],{})[_0x39b9('0x3f')](respondWithResult(_0x2e14e4,0xc9))[_0x39b9('0x44')](handleError(_0x2e14e4,null));};exports[_0x39b9('0x24')]=function(_0x5a4059,_0x49a008){if(_0x5a4059['body']['id']){delete _0x5a4059[_0x39b9('0x48')]['id'];}return db[_0x39b9('0x2b')]['find']({'where':{'id':_0x5a4059['params']['id']}})[_0x39b9('0x3f')](handleEntityNotFound(_0x49a008,null))['then'](saveUpdates(_0x5a4059[_0x39b9('0x48')],null))['then'](respondWithResult(_0x49a008,null))['catch'](handleError(_0x49a008,null));};exports[_0x39b9('0x25')]=function(_0x43b702,_0x27f689){return db[_0x39b9('0x2b')][_0x39b9('0x49')]({'where':{'id':_0x43b702[_0x39b9('0x46')]['id']}})[_0x39b9('0x3f')](handleEntityNotFound(_0x27f689,null))['then'](removeEntity(_0x27f689,null))[_0x39b9('0x44')](handleError(_0x27f689,null));};exports[_0x39b9('0x4a')]=function(_0x52b101,_0x4707c4){return db[_0x39b9('0x2b')][_0x39b9('0x4a')]()[_0x39b9('0x3f')](respondWithResult(_0x4707c4,null))[_0x39b9('0x44')](handleError(_0x4707c4,null));}; \ No newline at end of file +var _0xe03e=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','IntegrationReport','rawAttributes','type','key','model','map','query'];(function(_0xdaff31,_0xaf350e){var _0x27f9fb=function(_0x5dedb0){while(--_0x5dedb0){_0xdaff31['push'](_0xdaff31['shift']());}};_0x27f9fb(++_0xaf350e);}(_0xe03e,0x1c7));var _0xee03=function(_0x1dba2a,_0x29a133){_0x1dba2a=_0x1dba2a-0x0;var _0x3b7811=_0xe03e[_0x1dba2a];return _0x3b7811;};'use strict';var emlformat=require(_0xee03('0x0'));var rimraf=require(_0xee03('0x1'));var zipdir=require(_0xee03('0x2'));var jsonpatch=require(_0xee03('0x3'));var rp=require(_0xee03('0x4'));var moment=require(_0xee03('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xee03('0x6'));var util=require('util');var path=require('path');var sox=require(_0xee03('0x7'));var csv=require(_0xee03('0x8'));var ejs=require(_0xee03('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee03('0xa'));var squel=require(_0xee03('0xb'));var crypto=require('crypto');var jsforce=require(_0xee03('0xc'));var deskjs=require(_0xee03('0xd'));var toCsv=require(_0xee03('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xee03('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xee03('0xf'));var hardwareService=require(_0xee03('0x10'));var logger=require(_0xee03('0x11'))(_0xee03('0x12'));var utils=require(_0xee03('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xee03('0x14'));var db=require(_0xee03('0x15'))['db'];function respondWithStatusCode(_0x505d69,_0x1e44d1){_0x1e44d1=_0x1e44d1||0xcc;return function(_0x3cb41e){if(_0x3cb41e){return _0x505d69[_0xee03('0x16')](_0x1e44d1);}return _0x505d69[_0xee03('0x17')](_0x1e44d1)[_0xee03('0x18')]();};}function respondWithResult(_0x400bbb,_0x18558d){_0x18558d=_0x18558d||0xc8;return function(_0x4edca2){if(_0x4edca2){return _0x400bbb[_0xee03('0x17')](_0x18558d)['json'](_0x4edca2);}};}function respondWithFilteredResult(_0x516050,_0x5c6156){return function(_0x1f5d30){if(_0x1f5d30){var _0x2ffc03=typeof _0x5c6156[_0xee03('0x19')]==='undefined'&&typeof _0x5c6156[_0xee03('0x1a')]===_0xee03('0x1b');var _0xaca89c=_0x1f5d30[_0xee03('0x1c')];var _0x40e41c=_0x2ffc03?0x0:_0x5c6156[_0xee03('0x19')];var _0xf4b760=_0x2ffc03?_0x1f5d30[_0xee03('0x1c')]:_0x5c6156[_0xee03('0x19')]+_0x5c6156[_0xee03('0x1a')];var _0x336db7;if(_0xf4b760>=_0xaca89c){_0xf4b760=_0xaca89c;_0x336db7=0xc8;}else{_0x336db7=0xce;}_0x516050[_0xee03('0x17')](_0x336db7);return _0x516050[_0xee03('0x1d')](_0xee03('0x1e'),_0x40e41c+'-'+_0xf4b760+'/'+_0xaca89c)[_0xee03('0x1f')](_0x1f5d30);}return null;};}function patchUpdates(_0x46beac){return function(_0x5cf1b4){try{jsonpatch[_0xee03('0x20')](_0x5cf1b4,_0x46beac,!![]);}catch(_0x39ac67){return BPromise[_0xee03('0x21')](_0x39ac67);}return _0x5cf1b4[_0xee03('0x22')]();};}function saveUpdates(_0x5b263c,_0x45a893){return function(_0xf77c65){if(_0xf77c65){return _0xf77c65[_0xee03('0x23')](_0x5b263c)[_0xee03('0x24')](function(_0x14f812){return _0x14f812;});}return null;};}function removeEntity(_0x408fa8,_0x55cf5f){return function(_0x521301){if(_0x521301){return _0x521301[_0xee03('0x25')]()[_0xee03('0x24')](function(){_0x408fa8[_0xee03('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c833a,_0x1b4037){return function(_0x273f5d){if(!_0x273f5d){_0x5c833a['sendStatus'](0x194);}return _0x273f5d;};}function handleError(_0x1c6339,_0x1fbd3a){_0x1fbd3a=_0x1fbd3a||0x1f4;return function(_0x2600e3){logger[_0xee03('0x26')](_0x2600e3['stack']);if(_0x2600e3[_0xee03('0x27')]){delete _0x2600e3[_0xee03('0x27')];}_0x1c6339[_0xee03('0x17')](_0x1fbd3a)[_0xee03('0x28')](_0x2600e3);};}exports[_0xee03('0x29')]=function(_0x29ec74,_0x51fade){var _0x4d8a61={},_0x2823fc={},_0x1997d9={'count':0x0,'rows':[]};var _0x2cadea=_['map'](db[_0xee03('0x2a')][_0xee03('0x2b')],function(_0x319b85){return{'name':_0x319b85['fieldName'],'type':_0x319b85[_0xee03('0x2c')][_0xee03('0x2d')]};});_0x2823fc[_0xee03('0x2e')]=_[_0xee03('0x2f')](_0x2cadea,'name');_0x2823fc[_0xee03('0x30')]=_[_0xee03('0x31')](_0x29ec74[_0xee03('0x30')]);_0x2823fc[_0xee03('0x32')]=_[_0xee03('0x33')](_0x2823fc['model'],_0x2823fc[_0xee03('0x30')]);_0x4d8a61[_0xee03('0x34')]=_[_0xee03('0x33')](_0x2823fc['model'],qs['fields'](_0x29ec74['query'][_0xee03('0x35')]));_0x4d8a61['attributes']=_0x4d8a61['attributes'][_0xee03('0x36')]?_0x4d8a61[_0xee03('0x34')]:_0x2823fc[_0xee03('0x2e')];if(!_0x29ec74[_0xee03('0x30')][_0xee03('0x37')]('nolimit')){_0x4d8a61['limit']=qs['limit'](_0x29ec74[_0xee03('0x30')][_0xee03('0x1a')]);_0x4d8a61[_0xee03('0x19')]=qs[_0xee03('0x19')](_0x29ec74[_0xee03('0x30')][_0xee03('0x19')]);}_0x4d8a61['order']=qs[_0xee03('0x38')](_0x29ec74[_0xee03('0x30')][_0xee03('0x38')]);_0x4d8a61[_0xee03('0x39')]=qs[_0xee03('0x32')](_[_0xee03('0x3a')](_0x29ec74[_0xee03('0x30')],_0x2823fc[_0xee03('0x32')]),_0x2cadea);if(_0x29ec74[_0xee03('0x30')][_0xee03('0x3b')]){_0x4d8a61[_0xee03('0x39')]=_[_0xee03('0x3c')](_0x4d8a61[_0xee03('0x39')],{'$or':_['map'](_0x2cadea,function(_0x286435){if(_0x286435['type']!=='VIRTUAL'){var _0x5a70ec={};_0x5a70ec[_0x286435[_0xee03('0x27')]]={'$like':'%'+_0x29ec74[_0xee03('0x30')][_0xee03('0x3b')]+'%'};return _0x5a70ec;}})});}_0x4d8a61=_[_0xee03('0x3c')]({},_0x4d8a61,_0x29ec74[_0xee03('0x3d')]);var _0x13a512={'where':_0x4d8a61[_0xee03('0x39')]};return db[_0xee03('0x2a')]['count'](_0x13a512)[_0xee03('0x24')](function(_0x239c82){_0x1997d9[_0xee03('0x1c')]=_0x239c82;if(_0x29ec74[_0xee03('0x30')][_0xee03('0x3e')]){_0x4d8a61[_0xee03('0x3f')]=[{'all':!![]}];}return db['IntegrationReport'][_0xee03('0x40')](_0x4d8a61);})['then'](function(_0x36a634){_0x1997d9['rows']=_0x36a634;return _0x1997d9;})[_0xee03('0x24')](respondWithFilteredResult(_0x51fade,_0x4d8a61))[_0xee03('0x41')](handleError(_0x51fade,null));};exports[_0xee03('0x42')]=function(_0x5d2a22,_0x225535){var _0x511125={'raw':![],'where':{'id':_0x5d2a22[_0xee03('0x43')]['id']}},_0x2af964={};_0x2af964[_0xee03('0x2e')]=_[_0xee03('0x31')](db['IntegrationReport']['rawAttributes']);_0x2af964[_0xee03('0x30')]=_[_0xee03('0x31')](_0x5d2a22[_0xee03('0x30')]);_0x2af964[_0xee03('0x32')]=_[_0xee03('0x33')](_0x2af964[_0xee03('0x2e')],_0x2af964['query']);_0x511125[_0xee03('0x34')]=_['intersection'](_0x2af964['model'],qs[_0xee03('0x35')](_0x5d2a22['query'][_0xee03('0x35')]));_0x511125[_0xee03('0x34')]=_0x511125['attributes'][_0xee03('0x36')]?_0x511125[_0xee03('0x34')]:_0x2af964['model'];if(_0x5d2a22[_0xee03('0x30')][_0xee03('0x3e')]){_0x511125[_0xee03('0x3f')]=[{'all':!![]}];}_0x511125=_[_0xee03('0x3c')]({},_0x511125,_0x5d2a22[_0xee03('0x3d')]);return db[_0xee03('0x2a')]['find'](_0x511125)[_0xee03('0x24')](handleEntityNotFound(_0x225535,null))[_0xee03('0x24')](respondWithResult(_0x225535,null))['catch'](handleError(_0x225535,null));};exports[_0xee03('0x44')]=function(_0x408602,_0x53d6fd){return db['IntegrationReport'][_0xee03('0x44')](_0x408602[_0xee03('0x45')],{})[_0xee03('0x24')](respondWithResult(_0x53d6fd,0xc9))[_0xee03('0x41')](handleError(_0x53d6fd,null));};exports['update']=function(_0x3bbbba,_0x452423){if(_0x3bbbba['body']['id']){delete _0x3bbbba[_0xee03('0x45')]['id'];}return db[_0xee03('0x2a')][_0xee03('0x46')]({'where':{'id':_0x3bbbba[_0xee03('0x43')]['id']}})[_0xee03('0x24')](handleEntityNotFound(_0x452423,null))['then'](saveUpdates(_0x3bbbba[_0xee03('0x45')],null))['then'](respondWithResult(_0x452423,null))['catch'](handleError(_0x452423,null));};exports['destroy']=function(_0x1749d2,_0x2c82a7){return db[_0xee03('0x2a')][_0xee03('0x46')]({'where':{'id':_0x1749d2[_0xee03('0x43')]['id']}})[_0xee03('0x24')](handleEntityNotFound(_0x2c82a7,null))[_0xee03('0x24')](removeEntity(_0x2c82a7,null))['catch'](handleError(_0x2c82a7,null));};exports[_0xee03('0x47')]=function(_0x1e6566,_0x2c9067){return db[_0xee03('0x2a')]['describe']()[_0xee03('0x24')](respondWithResult(_0x2c9067,null))[_0xee03('0x41')](handleError(_0x2c9067,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index a31a0e2..c34719c 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 _0x0e71=['moment','bluebird','request-promise','path','rimraf','../../config/environment','IntegrationReport','report_integration','lodash','../../config/logger','api'];(function(_0x163e78,_0x5a8ce1){var _0x4ee0fd=function(_0x5aff96){while(--_0x5aff96){_0x163e78['push'](_0x163e78['shift']());}};_0x4ee0fd(++_0x5a8ce1);}(_0x0e71,0x8c));var _0x10e7=function(_0x5e5f1d,_0x22ad3c){_0x5e5f1d=_0x5e5f1d-0x0;var _0x1d077c=_0x0e71[_0x5e5f1d];return _0x1d077c;};'use strict';var _=require(_0x10e7('0x0'));var util=require('util');var logger=require(_0x10e7('0x1'))(_0x10e7('0x2'));var moment=require(_0x10e7('0x3'));var BPromise=require(_0x10e7('0x4'));var rp=require(_0x10e7('0x5'));var fs=require('fs');var path=require(_0x10e7('0x6'));var rimraf=require(_0x10e7('0x7'));var config=require(_0x10e7('0x8'));var attributes=require('./integrationReport.attributes');module['exports']=function(_0x4a3e13,_0x5146f2){return _0x4a3e13['define'](_0x10e7('0x9'),attributes,{'tableName':_0x10e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4dfb=['IntegrationReport','report_integration','util','../../config/logger','api','bluebird','request-promise','rimraf','./integrationReport.attributes','exports','define'];(function(_0x4c19c0,_0x32d0e8){var _0x3be0c2=function(_0x51b7cd){while(--_0x51b7cd){_0x4c19c0['push'](_0x4c19c0['shift']());}};_0x3be0c2(++_0x32d0e8);}(_0x4dfb,0x14c));var _0xb4df=function(_0x4fb886,_0x3e64cb){_0x4fb886=_0x4fb886-0x0;var _0x210a1a=_0x4dfb[_0x4fb886];return _0x210a1a;};'use strict';var _=require('lodash');var util=require(_0xb4df('0x0'));var logger=require(_0xb4df('0x1'))(_0xb4df('0x2'));var moment=require('moment');var BPromise=require(_0xb4df('0x3'));var rp=require(_0xb4df('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4df('0x5'));var config=require('../../config/environment');var attributes=require(_0xb4df('0x6'));module[_0xb4df('0x7')]=function(_0xaaa168,_0x357ebb){return _0xaaa168[_0xb4df('0x8')](_0xb4df('0x9'),attributes,{'tableName':_0xb4df('0xa'),'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 d9fa9b0..9173b7e 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x2491fe,_0x5dcfed){var _0x4a04f9=function(_0x93a388){while(--_0x93a388){_0x2491fe['push'](_0x2491fe['shift']());}};_0x4a04f9(++_0x5dcfed);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x2fa242,_0x5b5aa9){var _0x5c4012=function(_0x1b5648){while(--_0x1b5648){_0x2fa242['push'](_0x2fa242['shift']());}};_0x5c4012(++_0x5b5aa9);}(_0x4819,0xcd));var _0x9481=function(_0xd723,_0x164010){_0xd723=_0xd723-0x0;var _0x5179d2=_0x4819[_0xd723];return _0x5179d2;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index ca82031..b685ea4 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 _0x5e8d=['/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getIntervals','post','create','/:id/sub_intervals'];(function(_0x463d51,_0x416a80){var _0x5d764c=function(_0x259fbe){while(--_0x259fbe){_0x463d51['push'](_0x463d51['shift']());}};_0x5d764c(++_0x416a80);}(_0x5e8d,0x11a));var _0xd5e8=function(_0x2cb5bb,_0x56d9c0){_0x2cb5bb=_0x2cb5bb-0x0;var _0x4e9e9c=_0x5e8d[_0x2cb5bb];return _0x4e9e9c;};'use strict';var multer=require(_0xd5e8('0x0'));var util=require(_0xd5e8('0x1'));var path=require(_0xd5e8('0x2'));var timeout=require(_0xd5e8('0x3'));var express=require(_0xd5e8('0x4'));var router=express[_0xd5e8('0x5')]();var fs_extra=require(_0xd5e8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd5e8('0x7'));var config=require(_0xd5e8('0x8'));var controller=require('./interval.controller');router[_0xd5e8('0x9')]('/',auth[_0xd5e8('0xa')](),controller[_0xd5e8('0xb')]);router['get'](_0xd5e8('0xc'),auth[_0xd5e8('0xa')](),controller[_0xd5e8('0xd')]);router[_0xd5e8('0x9')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0xd5e8('0xe')]);router[_0xd5e8('0xf')]('/',auth[_0xd5e8('0xa')](),controller[_0xd5e8('0x10')]);router['post'](_0xd5e8('0x11'),auth[_0xd5e8('0xa')](),controller['addInterval']);router[_0xd5e8('0xf')](_0xd5e8('0x12'),auth[_0xd5e8('0xa')](),controller[_0xd5e8('0x13')]);router[_0xd5e8('0x14')](_0xd5e8('0xc'),auth[_0xd5e8('0xa')](),controller[_0xd5e8('0x15')]);router[_0xd5e8('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xd5e8('0x17')]);module[_0xd5e8('0x18')]=router; \ No newline at end of file +var _0xfd20=['../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','show','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','destroy','exports','util','express','Router'];(function(_0x36a6de,_0x2d4cb6){var _0x127b87=function(_0x2e7ea9){while(--_0x2e7ea9){_0x36a6de['push'](_0x36a6de['shift']());}};_0x127b87(++_0x2d4cb6);}(_0xfd20,0x66));var _0x0fd2=function(_0x332309,_0x5eff30){_0x332309=_0x332309-0x0;var _0x5048cf=_0xfd20[_0x332309];return _0x5048cf;};'use strict';var multer=require('multer');var util=require(_0x0fd2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0fd2('0x1'));var router=express[_0x0fd2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0fd2('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0fd2('0x4'));var controller=require(_0x0fd2('0x5'));router[_0x0fd2('0x6')]('/',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x8')]);router['get']('/:id',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x9')]);router[_0x0fd2('0x6')](_0x0fd2('0xa'),auth[_0x0fd2('0x7')](),controller[_0x0fd2('0xb')]);router[_0x0fd2('0xc')]('/',auth['isAuthenticated'](),controller[_0x0fd2('0xd')]);router[_0x0fd2('0xc')]('/:id/sub_intervals',auth[_0x0fd2('0x7')](),controller['addInterval']);router[_0x0fd2('0xc')](_0x0fd2('0xe'),auth[_0x0fd2('0x7')](),controller[_0x0fd2('0xf')]);router[_0x0fd2('0x10')](_0x0fd2('0x11'),auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x12')]);router['delete']('/:id',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x13')]);module[_0x0fd2('0x14')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index c1c23c2..bc4a4f6 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 _0x3286=['STRING','exports'];(function(_0x5c92cb,_0xfe3fb2){var _0x122cb5=function(_0x105e1f){while(--_0x105e1f){_0x5c92cb['push'](_0x5c92cb['shift']());}};_0x122cb5(++_0xfe3fb2);}(_0x3286,0xfd));var _0x6328=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3286[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x6328('0x0')]={'name':{'type':Sequelize[_0x6328('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6328('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x4dac=['sequelize','exports','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4dac,0x159));var _0xc4da=function(_0x4c5cd4,_0x268643){_0x4c5cd4=_0x4c5cd4-0x0;var _0x210bcf=_0x4dac[_0x4c5cd4];return _0x210bcf;};'use strict';var Sequelize=require(_0xc4da('0x0'));module[_0xc4da('0x1')]={'name':{'type':Sequelize[_0xc4da('0x2')]},'description':{'type':Sequelize[_0xc4da('0x2')]},'interval':{'type':Sequelize[_0xc4da('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 c9b17a0..ce71270 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 _0xf20f=['rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','Interval','findAll','catch','show','params','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','addInterval','IntervalId','getIntervals','order','pick','addIntervals','findOne','sequelize','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../components/extensions/rewrite','sendStatus','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','get','Intervals','UserProfileResource','status','error','name','send'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xf20f,0x140));var _0xff20=function(_0x338568,_0x4d6627){_0x338568=_0x338568-0x0;var _0x512e5d=_0xf20f[_0x338568];return _0x512e5d;};'use strict';var emlformat=require(_0xff20('0x0'));var rimraf=require(_0xff20('0x1'));var zipdir=require(_0xff20('0x2'));var jsonpatch=require(_0xff20('0x3'));var rp=require(_0xff20('0x4'));var moment=require(_0xff20('0x5'));var BPromise=require(_0xff20('0x6'));var Mustache=require('mustache');var util=require(_0xff20('0x7'));var path=require(_0xff20('0x8'));var sox=require('sox');var csv=require(_0xff20('0x9'));var ejs=require(_0xff20('0xa'));var fs=require('fs');var fs_extra=require(_0xff20('0xb'));var _=require(_0xff20('0xc'));var squel=require(_0xff20('0xd'));var crypto=require(_0xff20('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xff20('0xf'));var toCsv=require(_0xff20('0x9'));var querystring=require(_0xff20('0x10'));var Papa=require(_0xff20('0x11'));var Redis=require(_0xff20('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xff20('0x13'));var hardwareService=require(_0xff20('0x14'));var logger=require('../../config/logger')(_0xff20('0x15'));var utils=require(_0xff20('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xff20('0x17'));var db=require('../../mysqldb')['db'];var extensions=require(_0xff20('0x18'));function respondWithStatusCode(_0x383ec9,_0x5e4db8){_0x5e4db8=_0x5e4db8||0xcc;return function(_0x3e05b9){if(_0x3e05b9){return _0x383ec9[_0xff20('0x19')](_0x5e4db8);}return _0x383ec9['status'](_0x5e4db8)[_0xff20('0x1a')]();};}function respondWithResult(_0x2759db,_0x51973e){_0x51973e=_0x51973e||0xc8;return function(_0x147d07){if(_0x147d07){return _0x2759db['status'](_0x51973e)[_0xff20('0x1b')](_0x147d07);}};}function respondWithFilteredResult(_0x35fc16,_0x5180f6){return function(_0x41ea10){if(_0x41ea10){var _0x5bfb32=typeof _0x5180f6['offset']===_0xff20('0x1c')&&typeof _0x5180f6['limit']===_0xff20('0x1c');var _0x1e60ff=_0x41ea10[_0xff20('0x1d')];var _0x31eaa3=_0x5bfb32?0x0:_0x5180f6[_0xff20('0x1e')];var _0x49327a=_0x5bfb32?_0x41ea10['count']:_0x5180f6['offset']+_0x5180f6[_0xff20('0x1f')];var _0x1a92b6;if(_0x49327a>=_0x1e60ff){_0x49327a=_0x1e60ff;_0x1a92b6=0xc8;}else{_0x1a92b6=0xce;}_0x35fc16['status'](_0x1a92b6);return _0x35fc16['set'](_0xff20('0x20'),_0x31eaa3+'-'+_0x49327a+'/'+_0x1e60ff)['json'](_0x41ea10);}return null;};}function patchUpdates(_0xfce98b){return function(_0x428c94){try{jsonpatch[_0xff20('0x21')](_0x428c94,_0xfce98b,!![]);}catch(_0x2ad0bc){return BPromise[_0xff20('0x22')](_0x2ad0bc);}return _0x428c94[_0xff20('0x23')]();};}function saveUpdates(_0x431e29,_0x44b3ee){return function(_0x519895){if(_0x519895){return _0x519895['update'](_0x431e29)[_0xff20('0x24')](function(_0x553dc6){return _0x553dc6;});}return null;};}function removeEntity(_0x340850,_0x4de871){return function(_0x15f9d5){if(_0x15f9d5){return _0x15f9d5['destroy']()[_0xff20('0x24')](function(){var _0x279a42=_0x15f9d5[_0xff20('0x25')]({'plain':!![]});var _0x39965d=_0xff20('0x26');return db[_0xff20('0x27')]['destroy']({'where':{'type':_0x39965d,'resourceId':_0x279a42['id']}})[_0xff20('0x24')](function(){return _0x15f9d5;});})[_0xff20('0x24')](function(){_0x340850[_0xff20('0x28')](0xcc)[_0xff20('0x1a')]();});}};}function handleEntityNotFound(_0x12367e,_0x4ecfde){return function(_0x3d09c3){if(!_0x3d09c3){_0x12367e[_0xff20('0x19')](0x194);}return _0x3d09c3;};}function handleError(_0x233b78,_0x5da635){_0x5da635=_0x5da635||0x1f4;return function(_0x2f2d0e){logger[_0xff20('0x29')](_0x2f2d0e['stack']);if(_0x2f2d0e[_0xff20('0x2a')]){delete _0x2f2d0e[_0xff20('0x2a')];}_0x233b78['status'](_0x5da635)[_0xff20('0x2b')](_0x2f2d0e);};}exports['index']=function(_0x5b6214,_0x53c073){var _0x25edfd={},_0x24f37a={},_0x396f11={'count':0x0,'rows':[]};var _0x3da450=_['map'](db['Interval'][_0xff20('0x2c')],function(_0x5004a9){return{'name':_0x5004a9[_0xff20('0x2d')],'type':_0x5004a9[_0xff20('0x2e')][_0xff20('0x2f')]};});_0x24f37a['model']=_[_0xff20('0x30')](_0x3da450,_0xff20('0x2a'));_0x24f37a[_0xff20('0x31')]=_[_0xff20('0x32')](_0x5b6214[_0xff20('0x31')]);_0x24f37a[_0xff20('0x33')]=_[_0xff20('0x34')](_0x24f37a[_0xff20('0x35')],_0x24f37a['query']);_0x25edfd['attributes']=_['intersection'](_0x24f37a[_0xff20('0x35')],qs[_0xff20('0x36')](_0x5b6214[_0xff20('0x31')][_0xff20('0x36')]));_0x25edfd[_0xff20('0x37')]=_0x25edfd[_0xff20('0x37')]['length']?_0x25edfd['attributes']:_0x24f37a[_0xff20('0x35')];if(!_0x5b6214['query']['hasOwnProperty'](_0xff20('0x38'))){_0x25edfd['limit']=qs['limit'](_0x5b6214[_0xff20('0x31')][_0xff20('0x1f')]);_0x25edfd['offset']=qs[_0xff20('0x1e')](_0x5b6214[_0xff20('0x31')][_0xff20('0x1e')]);}_0x25edfd['order']=qs[_0xff20('0x39')](_0x5b6214[_0xff20('0x31')][_0xff20('0x39')]);_0x25edfd[_0xff20('0x3a')]=qs[_0xff20('0x33')](_['pick'](_0x5b6214[_0xff20('0x31')],_0x24f37a[_0xff20('0x33')]),_0x3da450);if(_0x5b6214[_0xff20('0x31')][_0xff20('0x3b')]){_0x25edfd['where']=_[_0xff20('0x3c')](_0x25edfd[_0xff20('0x3a')],{'$or':_[_0xff20('0x30')](_0x3da450,function(_0xf04320){if(_0xf04320[_0xff20('0x2e')]!==_0xff20('0x3d')){var _0x2b8fa2={};_0x2b8fa2[_0xf04320[_0xff20('0x2a')]]={'$like':'%'+_0x5b6214[_0xff20('0x31')][_0xff20('0x3b')]+'%'};return _0x2b8fa2;}})});}_0x25edfd=_[_0xff20('0x3c')]({},_0x25edfd,_0x5b6214[_0xff20('0x3e')]);var _0x5d863e={'where':_0x25edfd[_0xff20('0x3a')]};return db['Interval'][_0xff20('0x1d')](_0x5d863e)[_0xff20('0x24')](function(_0x174852){_0x396f11[_0xff20('0x1d')]=_0x174852;if(_0x5b6214['query'][_0xff20('0x3f')]){_0x25edfd[_0xff20('0x40')]=[{'all':!![]}];}return db[_0xff20('0x41')][_0xff20('0x42')](_0x25edfd);})[_0xff20('0x24')](function(_0x2f3314){_0x396f11['rows']=_0x2f3314;return _0x396f11;})[_0xff20('0x24')](respondWithFilteredResult(_0x53c073,_0x25edfd))[_0xff20('0x43')](handleError(_0x53c073,null));};exports[_0xff20('0x44')]=function(_0x15c8ea,_0x4a2ead){var _0x21e2a8={'raw':!![],'where':{'id':_0x15c8ea[_0xff20('0x45')]['id']}},_0x55e19c={};_0x55e19c[_0xff20('0x35')]=_[_0xff20('0x32')](db[_0xff20('0x41')][_0xff20('0x2c')]);_0x55e19c['query']=_['keys'](_0x15c8ea[_0xff20('0x31')]);_0x55e19c[_0xff20('0x33')]=_[_0xff20('0x34')](_0x55e19c['model'],_0x55e19c[_0xff20('0x31')]);_0x21e2a8[_0xff20('0x37')]=_['intersection'](_0x55e19c['model'],qs[_0xff20('0x36')](_0x15c8ea[_0xff20('0x31')]['fields']));_0x21e2a8[_0xff20('0x37')]=_0x21e2a8[_0xff20('0x37')][_0xff20('0x46')]?_0x21e2a8[_0xff20('0x37')]:_0x55e19c[_0xff20('0x35')];if(_0x15c8ea[_0xff20('0x31')][_0xff20('0x3f')]){_0x21e2a8[_0xff20('0x40')]=[{'all':!![]}];}_0x21e2a8=_[_0xff20('0x3c')]({},_0x21e2a8,_0x15c8ea[_0xff20('0x3e')]);return db[_0xff20('0x41')][_0xff20('0x47')](_0x21e2a8)[_0xff20('0x24')](handleEntityNotFound(_0x4a2ead,null))['then'](respondWithResult(_0x4a2ead,null))[_0xff20('0x43')](handleError(_0x4a2ead,null));};exports[_0xff20('0x48')]=function(_0x27981c,_0x39a9c0){return db['Interval']['create'](_0x27981c[_0xff20('0x49')],{})[_0xff20('0x24')](function(_0x310cfd){var _0x253202=_0x27981c[_0xff20('0x4a')]['get']({'plain':!![]});if(!_0x253202)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x253202[_0xff20('0x4b')]==='user'){var _0x17b213=_0x310cfd[_0xff20('0x25')]({'plain':!![]});var _0x26880c=_0xff20('0x26');return db[_0xff20('0x4c')][_0xff20('0x47')]({'where':{'name':_0x26880c,'userProfileId':_0x253202[_0xff20('0x4d')]},'raw':!![]})[_0xff20('0x24')](function(_0x46525a){if(_0x46525a&&_0x46525a[_0xff20('0x4e')]===0x0){return db[_0xff20('0x27')][_0xff20('0x48')]({'name':_0x17b213[_0xff20('0x2a')],'resourceId':_0x17b213['id'],'type':_0x46525a[_0xff20('0x2a')],'sectionId':_0x46525a['id']},{})['then'](function(){return _0x310cfd;});}else{return _0x310cfd;}})['catch'](function(_0x1fe825){logger['error'](_0xff20('0x4f'),_0x1fe825);throw _0x1fe825;});}return _0x310cfd;})[_0xff20('0x24')](respondWithResult(_0x39a9c0,0xc9))[_0xff20('0x43')](handleError(_0x39a9c0,null));};exports[_0xff20('0x50')]=function(_0x1a2365,_0x31b580){if(_0x1a2365['body']['id']){delete _0x1a2365[_0xff20('0x49')]['id'];}return db[_0xff20('0x41')]['find']({'where':{'id':_0x1a2365[_0xff20('0x45')]['id']}})[_0xff20('0x24')](handleEntityNotFound(_0x31b580,null))[_0xff20('0x24')](saveUpdates(_0x1a2365[_0xff20('0x49')],null))[_0xff20('0x24')](respondWithResult(_0x31b580,null))[_0xff20('0x43')](handleError(_0x31b580,null));};exports[_0xff20('0x51')]=function(_0x1ae3e8,_0x22e93d){return db[_0xff20('0x41')]['find']({'where':{'id':_0x1ae3e8['params']['id']}})[_0xff20('0x24')](handleEntityNotFound(_0x22e93d,null))[_0xff20('0x24')](removeEntity(_0x22e93d,null))[_0xff20('0x43')](handleError(_0x22e93d,null));};exports[_0xff20('0x52')]=function(_0x319064,_0x26ef2c,_0x13cedf){if(_0x319064['body']['id']){delete _0x319064[_0xff20('0x49')]['id'];}return db[_0xff20('0x41')][_0xff20('0x47')]({'where':{'id':_0x319064['params']['id']}})['then'](handleEntityNotFound(_0x26ef2c,null))[_0xff20('0x24')](function(_0x37ad3e){if(_0x37ad3e){_0x319064[_0xff20('0x49')][_0xff20('0x53')]=_0x37ad3e['id'];return db[_0xff20('0x41')][_0xff20('0x48')](_0x319064[_0xff20('0x49')]);}})[_0xff20('0x24')](respondWithResult(_0x26ef2c,null))[_0xff20('0x43')](handleError(_0x26ef2c,null));};exports[_0xff20('0x54')]=function(_0xfcba7,_0x2636d0,_0x32ef8f){var _0x2cf2ce={};var _0x30a0c9={};var _0x303862;var _0x1e8908;return db['Interval']['findOne']({'where':{'id':_0xfcba7[_0xff20('0x45')]['id']}})[_0xff20('0x24')](handleEntityNotFound(_0x2636d0,null))[_0xff20('0x24')](function(_0x30a6a0){if(_0x30a6a0){_0x303862=_0x30a6a0;_0x30a0c9[_0xff20('0x35')]=_['keys'](db['Interval'][_0xff20('0x2c')]);_0x30a0c9[_0xff20('0x31')]=_[_0xff20('0x32')](_0xfcba7[_0xff20('0x31')]);_0x30a0c9['filters']=_['intersection'](_0x30a0c9[_0xff20('0x35')],_0x30a0c9[_0xff20('0x31')]);_0x2cf2ce[_0xff20('0x37')]=_[_0xff20('0x34')](_0x30a0c9[_0xff20('0x35')],qs[_0xff20('0x36')](_0xfcba7[_0xff20('0x31')]['fields']));_0x2cf2ce[_0xff20('0x37')]=_0x2cf2ce[_0xff20('0x37')][_0xff20('0x46')]?_0x2cf2ce['attributes']:_0x30a0c9['model'];_0x2cf2ce[_0xff20('0x55')]=qs[_0xff20('0x39')](_0xfcba7[_0xff20('0x31')][_0xff20('0x39')]);_0x2cf2ce[_0xff20('0x3a')]=qs[_0xff20('0x33')](_[_0xff20('0x56')](_0xfcba7[_0xff20('0x31')],_0x30a0c9[_0xff20('0x33')]));if(_0xfcba7['query']['filter']){_0x2cf2ce[_0xff20('0x3a')]=_[_0xff20('0x3c')](_0x2cf2ce['where'],{'$or':_['map'](_0x2cf2ce[_0xff20('0x37')],function(_0x53f2d1){var _0x3429e4={};_0x3429e4[_0x53f2d1]={'$like':'%'+_0xfcba7[_0xff20('0x31')]['filter']+'%'};return _0x3429e4;})});}_0x2cf2ce=_[_0xff20('0x3c')]({},_0x2cf2ce,_0xfcba7[_0xff20('0x3e')]);return _0x303862['getIntervals'](_0x2cf2ce);}})[_0xff20('0x24')](function(_0x162192){if(_0x162192){_0x1e8908=_0x162192[_0xff20('0x46')];if(!_0xfcba7[_0xff20('0x31')]['hasOwnProperty'](_0xff20('0x38'))){_0x2cf2ce[_0xff20('0x1f')]=qs[_0xff20('0x1f')](_0xfcba7['query'][_0xff20('0x1f')]);_0x2cf2ce['offset']=qs[_0xff20('0x1e')](_0xfcba7['query'][_0xff20('0x1e')]);}return _0x303862[_0xff20('0x54')](_0x2cf2ce);}})['then'](function(_0x1155c4){if(_0x1155c4){return _0x1155c4?{'count':_0x1e8908,'rows':_0x1155c4}:null;}})['then'](respondWithResult(_0x2636d0,null))[_0xff20('0x43')](handleError(_0x2636d0,null));};exports[_0xff20('0x57')]=function(_0x2247dc,_0x26dc59,_0x3f0827){return db[_0xff20('0x41')][_0xff20('0x58')]({'where':{'id':_0x2247dc[_0xff20('0x45')]['id']}})['then'](handleEntityNotFound(_0x26dc59,null))['then'](function(_0x2532d4){if(_0x2532d4){return db[_0xff20('0x59')]['transaction'](function(_0xe21b22){return db[_0xff20('0x41')][_0xff20('0x51')]({'where':{'IntervalId':_0x2247dc[_0xff20('0x45')]['id']},'transaction':_0xe21b22})[_0xff20('0x24')](function(_0x1c7020){var _0x11f872=_[_0xff20('0x30')](_0x2247dc['body'],function(_0x12b4e0){delete _0x12b4e0['id'];_0x12b4e0[_0xff20('0x53')]=_0x2247dc[_0xff20('0x45')]['id'];return _0x12b4e0;});return db[_0xff20('0x41')][_0xff20('0x5a')](_0x11f872,{'transaction':_0xe21b22});});})[_0xff20('0x24')](function(){return db['Interval'][_0xff20('0x42')]({'where':{'IntervalId':_0x2247dc['params']['id']}});});}})[_0xff20('0x24')](respondWithResult(_0x26dc59,null))[_0xff20('0x43')](handleError(_0x26dc59,null));}; \ No newline at end of file +var _0xd6d0=['fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','addInterval','getIntervals','pick','addIntervals','findOne','sequelize','transaction','IntervalId','bulkCreate','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','error','name','send','index','map','Interval','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xd6d0,0xde));var _0x0d6d=function(_0x3606ba,_0x3c55b5){_0x3606ba=_0x3606ba-0x0;var _0xbb4222=_0xd6d0[_0x3606ba];return _0xbb4222;};'use strict';var emlformat=require(_0x0d6d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0d6d('0x1'));var rp=require(_0x0d6d('0x2'));var moment=require(_0x0d6d('0x3'));var BPromise=require(_0x0d6d('0x4'));var Mustache=require(_0x0d6d('0x5'));var util=require('util');var path=require(_0x0d6d('0x6'));var sox=require(_0x0d6d('0x7'));var csv=require(_0x0d6d('0x8'));var ejs=require(_0x0d6d('0x9'));var fs=require('fs');var fs_extra=require(_0x0d6d('0xa'));var _=require('lodash');var squel=require(_0x0d6d('0xb'));var crypto=require(_0x0d6d('0xc'));var jsforce=require(_0x0d6d('0xd'));var deskjs=require(_0x0d6d('0xe'));var toCsv=require(_0x0d6d('0x8'));var querystring=require(_0x0d6d('0xf'));var Papa=require(_0x0d6d('0x10'));var Redis=require(_0x0d6d('0x11'));var authService=require(_0x0d6d('0x12'));var qs=require(_0x0d6d('0x13'));var as=require(_0x0d6d('0x14'));var hardwareService=require(_0x0d6d('0x15'));var logger=require(_0x0d6d('0x16'))(_0x0d6d('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0d6d('0x18'));var db=require(_0x0d6d('0x19'))['db'];var extensions=require(_0x0d6d('0x1a'));function respondWithStatusCode(_0x22d061,_0x28ac6f){_0x28ac6f=_0x28ac6f||0xcc;return function(_0xca8520){if(_0xca8520){return _0x22d061[_0x0d6d('0x1b')](_0x28ac6f);}return _0x22d061[_0x0d6d('0x1c')](_0x28ac6f)['end']();};}function respondWithResult(_0x363d83,_0x78a1df){_0x78a1df=_0x78a1df||0xc8;return function(_0x123f9d){if(_0x123f9d){return _0x363d83[_0x0d6d('0x1c')](_0x78a1df)['json'](_0x123f9d);}};}function respondWithFilteredResult(_0x357eb3,_0x55844f){return function(_0x210aff){if(_0x210aff){var _0x491dac=typeof _0x55844f['offset']===_0x0d6d('0x1d')&&typeof _0x55844f[_0x0d6d('0x1e')]===_0x0d6d('0x1d');var _0x549dce=_0x210aff[_0x0d6d('0x1f')];var _0x4dc4ec=_0x491dac?0x0:_0x55844f[_0x0d6d('0x20')];var _0x2f2dee=_0x491dac?_0x210aff[_0x0d6d('0x1f')]:_0x55844f['offset']+_0x55844f['limit'];var _0xf45a9d;if(_0x2f2dee>=_0x549dce){_0x2f2dee=_0x549dce;_0xf45a9d=0xc8;}else{_0xf45a9d=0xce;}_0x357eb3[_0x0d6d('0x1c')](_0xf45a9d);return _0x357eb3['set'](_0x0d6d('0x21'),_0x4dc4ec+'-'+_0x2f2dee+'/'+_0x549dce)[_0x0d6d('0x22')](_0x210aff);}return null;};}function patchUpdates(_0x565595){return function(_0x2e203a){try{jsonpatch['apply'](_0x2e203a,_0x565595,!![]);}catch(_0xa7724e){return BPromise[_0x0d6d('0x23')](_0xa7724e);}return _0x2e203a[_0x0d6d('0x24')]();};}function saveUpdates(_0x149383,_0x5b0b25){return function(_0x518314){if(_0x518314){return _0x518314[_0x0d6d('0x25')](_0x149383)[_0x0d6d('0x26')](function(_0x21bc09){return _0x21bc09;});}return null;};}function removeEntity(_0xaca947,_0x45c85e){return function(_0xe292ba){if(_0xe292ba){return _0xe292ba[_0x0d6d('0x27')]()['then'](function(){var _0x3201d8=_0xe292ba[_0x0d6d('0x28')]({'plain':!![]});var _0x32d87e=_0x0d6d('0x29');return db[_0x0d6d('0x2a')]['destroy']({'where':{'type':_0x32d87e,'resourceId':_0x3201d8['id']}})[_0x0d6d('0x26')](function(){return _0xe292ba;});})[_0x0d6d('0x26')](function(){_0xaca947['status'](0xcc)[_0x0d6d('0x2b')]();});}};}function handleEntityNotFound(_0x15c4c6,_0x3609ba){return function(_0x8ee39f){if(!_0x8ee39f){_0x15c4c6['sendStatus'](0x194);}return _0x8ee39f;};}function handleError(_0x2c0fa1,_0x1db909){_0x1db909=_0x1db909||0x1f4;return function(_0xa7e405){logger[_0x0d6d('0x2c')](_0xa7e405['stack']);if(_0xa7e405[_0x0d6d('0x2d')]){delete _0xa7e405['name'];}_0x2c0fa1[_0x0d6d('0x1c')](_0x1db909)[_0x0d6d('0x2e')](_0xa7e405);};}exports[_0x0d6d('0x2f')]=function(_0x19be8e,_0x1dca70){var _0x36037f={},_0x39cf17={},_0x5e6677={'count':0x0,'rows':[]};var _0x37843e=_[_0x0d6d('0x30')](db[_0x0d6d('0x31')][_0x0d6d('0x32')],function(_0xb6441f){return{'name':_0xb6441f[_0x0d6d('0x33')],'type':_0xb6441f[_0x0d6d('0x34')][_0x0d6d('0x35')]};});_0x39cf17['model']=_['map'](_0x37843e,_0x0d6d('0x2d'));_0x39cf17['query']=_[_0x0d6d('0x36')](_0x19be8e['query']);_0x39cf17[_0x0d6d('0x37')]=_[_0x0d6d('0x38')](_0x39cf17[_0x0d6d('0x39')],_0x39cf17[_0x0d6d('0x3a')]);_0x36037f[_0x0d6d('0x3b')]=_[_0x0d6d('0x38')](_0x39cf17['model'],qs[_0x0d6d('0x3c')](_0x19be8e[_0x0d6d('0x3a')][_0x0d6d('0x3c')]));_0x36037f[_0x0d6d('0x3b')]=_0x36037f[_0x0d6d('0x3b')][_0x0d6d('0x3d')]?_0x36037f[_0x0d6d('0x3b')]:_0x39cf17['model'];if(!_0x19be8e[_0x0d6d('0x3a')][_0x0d6d('0x3e')](_0x0d6d('0x3f'))){_0x36037f[_0x0d6d('0x1e')]=qs[_0x0d6d('0x1e')](_0x19be8e[_0x0d6d('0x3a')][_0x0d6d('0x1e')]);_0x36037f[_0x0d6d('0x20')]=qs[_0x0d6d('0x20')](_0x19be8e[_0x0d6d('0x3a')][_0x0d6d('0x20')]);}_0x36037f[_0x0d6d('0x40')]=qs[_0x0d6d('0x41')](_0x19be8e[_0x0d6d('0x3a')][_0x0d6d('0x41')]);_0x36037f[_0x0d6d('0x42')]=qs[_0x0d6d('0x37')](_['pick'](_0x19be8e[_0x0d6d('0x3a')],_0x39cf17[_0x0d6d('0x37')]),_0x37843e);if(_0x19be8e['query'][_0x0d6d('0x43')]){_0x36037f[_0x0d6d('0x42')]=_[_0x0d6d('0x44')](_0x36037f[_0x0d6d('0x42')],{'$or':_[_0x0d6d('0x30')](_0x37843e,function(_0x447cf5){if(_0x447cf5[_0x0d6d('0x34')]!=='VIRTUAL'){var _0x159a4f={};_0x159a4f[_0x447cf5['name']]={'$like':'%'+_0x19be8e[_0x0d6d('0x3a')][_0x0d6d('0x43')]+'%'};return _0x159a4f;}})});}_0x36037f=_[_0x0d6d('0x44')]({},_0x36037f,_0x19be8e[_0x0d6d('0x45')]);var _0xa97edc={'where':_0x36037f[_0x0d6d('0x42')]};return db[_0x0d6d('0x31')][_0x0d6d('0x1f')](_0xa97edc)[_0x0d6d('0x26')](function(_0x43f88f){_0x5e6677[_0x0d6d('0x1f')]=_0x43f88f;if(_0x19be8e[_0x0d6d('0x3a')]['includeAll']){_0x36037f[_0x0d6d('0x46')]=[{'all':!![]}];}return db['Interval'][_0x0d6d('0x47')](_0x36037f);})[_0x0d6d('0x26')](function(_0x5e34d9){_0x5e6677['rows']=_0x5e34d9;return _0x5e6677;})['then'](respondWithFilteredResult(_0x1dca70,_0x36037f))[_0x0d6d('0x48')](handleError(_0x1dca70,null));};exports[_0x0d6d('0x49')]=function(_0x2dbdee,_0x1d2be3){var _0xcc2a65={'raw':!![],'where':{'id':_0x2dbdee[_0x0d6d('0x4a')]['id']}},_0x58850c={};_0x58850c[_0x0d6d('0x39')]=_[_0x0d6d('0x36')](db[_0x0d6d('0x31')][_0x0d6d('0x32')]);_0x58850c[_0x0d6d('0x3a')]=_[_0x0d6d('0x36')](_0x2dbdee['query']);_0x58850c[_0x0d6d('0x37')]=_[_0x0d6d('0x38')](_0x58850c[_0x0d6d('0x39')],_0x58850c['query']);_0xcc2a65[_0x0d6d('0x3b')]=_['intersection'](_0x58850c[_0x0d6d('0x39')],qs[_0x0d6d('0x3c')](_0x2dbdee[_0x0d6d('0x3a')]['fields']));_0xcc2a65[_0x0d6d('0x3b')]=_0xcc2a65[_0x0d6d('0x3b')][_0x0d6d('0x3d')]?_0xcc2a65[_0x0d6d('0x3b')]:_0x58850c[_0x0d6d('0x39')];if(_0x2dbdee[_0x0d6d('0x3a')][_0x0d6d('0x4b')]){_0xcc2a65['include']=[{'all':!![]}];}_0xcc2a65=_[_0x0d6d('0x44')]({},_0xcc2a65,_0x2dbdee[_0x0d6d('0x45')]);return db[_0x0d6d('0x31')][_0x0d6d('0x4c')](_0xcc2a65)[_0x0d6d('0x26')](handleEntityNotFound(_0x1d2be3,null))[_0x0d6d('0x26')](respondWithResult(_0x1d2be3,null))[_0x0d6d('0x48')](handleError(_0x1d2be3,null));};exports[_0x0d6d('0x4d')]=function(_0x3e235a,_0x76b8a8){return db[_0x0d6d('0x31')][_0x0d6d('0x4d')](_0x3e235a[_0x0d6d('0x4e')],{})[_0x0d6d('0x26')](function(_0x11d5af){var _0x52d817=_0x3e235a[_0x0d6d('0x4f')]['get']({'plain':!![]});if(!_0x52d817)throw new Error(_0x0d6d('0x50'));if(_0x52d817[_0x0d6d('0x51')]==='user'){var _0x2f018d=_0x11d5af[_0x0d6d('0x28')]({'plain':!![]});var _0x496e2a=_0x0d6d('0x29');return db[_0x0d6d('0x52')][_0x0d6d('0x4c')]({'where':{'name':_0x496e2a,'userProfileId':_0x52d817[_0x0d6d('0x53')]},'raw':!![]})['then'](function(_0x37bba7){if(_0x37bba7&&_0x37bba7[_0x0d6d('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x2f018d[_0x0d6d('0x2d')],'resourceId':_0x2f018d['id'],'type':_0x37bba7[_0x0d6d('0x2d')],'sectionId':_0x37bba7['id']},{})[_0x0d6d('0x26')](function(){return _0x11d5af;});}else{return _0x11d5af;}})['catch'](function(_0x335e66){logger[_0x0d6d('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x335e66);throw _0x335e66;});}return _0x11d5af;})[_0x0d6d('0x26')](respondWithResult(_0x76b8a8,0xc9))[_0x0d6d('0x48')](handleError(_0x76b8a8,null));};exports[_0x0d6d('0x25')]=function(_0xf9e05,_0x1c31ea){if(_0xf9e05[_0x0d6d('0x4e')]['id']){delete _0xf9e05['body']['id'];}return db[_0x0d6d('0x31')]['find']({'where':{'id':_0xf9e05['params']['id']}})[_0x0d6d('0x26')](handleEntityNotFound(_0x1c31ea,null))['then'](saveUpdates(_0xf9e05[_0x0d6d('0x4e')],null))[_0x0d6d('0x26')](respondWithResult(_0x1c31ea,null))[_0x0d6d('0x48')](handleError(_0x1c31ea,null));};exports[_0x0d6d('0x27')]=function(_0x22192a,_0x4dbf3a){return db[_0x0d6d('0x31')][_0x0d6d('0x4c')]({'where':{'id':_0x22192a[_0x0d6d('0x4a')]['id']}})[_0x0d6d('0x26')](handleEntityNotFound(_0x4dbf3a,null))[_0x0d6d('0x26')](removeEntity(_0x4dbf3a,null))[_0x0d6d('0x48')](handleError(_0x4dbf3a,null));};exports[_0x0d6d('0x55')]=function(_0x566b2c,_0x4e1c72,_0x47d49f){if(_0x566b2c['body']['id']){delete _0x566b2c[_0x0d6d('0x4e')]['id'];}return db['Interval'][_0x0d6d('0x4c')]({'where':{'id':_0x566b2c[_0x0d6d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4e1c72,null))[_0x0d6d('0x26')](function(_0x4e4a46){if(_0x4e4a46){_0x566b2c[_0x0d6d('0x4e')]['IntervalId']=_0x4e4a46['id'];return db[_0x0d6d('0x31')]['create'](_0x566b2c['body']);}})[_0x0d6d('0x26')](respondWithResult(_0x4e1c72,null))[_0x0d6d('0x48')](handleError(_0x4e1c72,null));};exports[_0x0d6d('0x56')]=function(_0x3d299b,_0x286ed6,_0x27b272){var _0x5b6922={};var _0x253585={};var _0x13190e;var _0x14e6d1;return db[_0x0d6d('0x31')]['findOne']({'where':{'id':_0x3d299b[_0x0d6d('0x4a')]['id']}})[_0x0d6d('0x26')](handleEntityNotFound(_0x286ed6,null))[_0x0d6d('0x26')](function(_0x543901){if(_0x543901){_0x13190e=_0x543901;_0x253585[_0x0d6d('0x39')]=_[_0x0d6d('0x36')](db[_0x0d6d('0x31')]['rawAttributes']);_0x253585[_0x0d6d('0x3a')]=_[_0x0d6d('0x36')](_0x3d299b['query']);_0x253585[_0x0d6d('0x37')]=_['intersection'](_0x253585[_0x0d6d('0x39')],_0x253585[_0x0d6d('0x3a')]);_0x5b6922[_0x0d6d('0x3b')]=_[_0x0d6d('0x38')](_0x253585[_0x0d6d('0x39')],qs[_0x0d6d('0x3c')](_0x3d299b[_0x0d6d('0x3a')][_0x0d6d('0x3c')]));_0x5b6922['attributes']=_0x5b6922[_0x0d6d('0x3b')]['length']?_0x5b6922[_0x0d6d('0x3b')]:_0x253585[_0x0d6d('0x39')];_0x5b6922[_0x0d6d('0x40')]=qs[_0x0d6d('0x41')](_0x3d299b['query']['sort']);_0x5b6922[_0x0d6d('0x42')]=qs[_0x0d6d('0x37')](_[_0x0d6d('0x57')](_0x3d299b[_0x0d6d('0x3a')],_0x253585[_0x0d6d('0x37')]));if(_0x3d299b[_0x0d6d('0x3a')][_0x0d6d('0x43')]){_0x5b6922['where']=_[_0x0d6d('0x44')](_0x5b6922[_0x0d6d('0x42')],{'$or':_[_0x0d6d('0x30')](_0x5b6922[_0x0d6d('0x3b')],function(_0x29b5d7){var _0x54e876={};_0x54e876[_0x29b5d7]={'$like':'%'+_0x3d299b['query']['filter']+'%'};return _0x54e876;})});}_0x5b6922=_[_0x0d6d('0x44')]({},_0x5b6922,_0x3d299b[_0x0d6d('0x45')]);return _0x13190e['getIntervals'](_0x5b6922);}})[_0x0d6d('0x26')](function(_0x332830){if(_0x332830){_0x14e6d1=_0x332830[_0x0d6d('0x3d')];if(!_0x3d299b[_0x0d6d('0x3a')][_0x0d6d('0x3e')](_0x0d6d('0x3f'))){_0x5b6922[_0x0d6d('0x1e')]=qs[_0x0d6d('0x1e')](_0x3d299b[_0x0d6d('0x3a')][_0x0d6d('0x1e')]);_0x5b6922[_0x0d6d('0x20')]=qs[_0x0d6d('0x20')](_0x3d299b[_0x0d6d('0x3a')][_0x0d6d('0x20')]);}return _0x13190e[_0x0d6d('0x56')](_0x5b6922);}})[_0x0d6d('0x26')](function(_0x4f0e72){if(_0x4f0e72){return _0x4f0e72?{'count':_0x14e6d1,'rows':_0x4f0e72}:null;}})['then'](respondWithResult(_0x286ed6,null))[_0x0d6d('0x48')](handleError(_0x286ed6,null));};exports[_0x0d6d('0x58')]=function(_0x137d7e,_0x5e3623,_0x33a28f){return db[_0x0d6d('0x31')][_0x0d6d('0x59')]({'where':{'id':_0x137d7e[_0x0d6d('0x4a')]['id']}})[_0x0d6d('0x26')](handleEntityNotFound(_0x5e3623,null))[_0x0d6d('0x26')](function(_0x502f55){if(_0x502f55){return db[_0x0d6d('0x5a')][_0x0d6d('0x5b')](function(_0x32c783){return db['Interval'][_0x0d6d('0x27')]({'where':{'IntervalId':_0x137d7e[_0x0d6d('0x4a')]['id']},'transaction':_0x32c783})[_0x0d6d('0x26')](function(_0x579143){var _0x2585b1=_['map'](_0x137d7e['body'],function(_0x57fa68){delete _0x57fa68['id'];_0x57fa68[_0x0d6d('0x5c')]=_0x137d7e[_0x0d6d('0x4a')]['id'];return _0x57fa68;});return db[_0x0d6d('0x31')][_0x0d6d('0x5d')](_0x2585b1,{'transaction':_0x32c783});});})[_0x0d6d('0x26')](function(){return db[_0x0d6d('0x31')][_0x0d6d('0x47')]({'where':{'IntervalId':_0x137d7e[_0x0d6d('0x4a')]['id']}});});}})['then'](respondWithResult(_0x5e3623,null))['catch'](handleError(_0x5e3623,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 6be8ff1..590b5d6 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 _0x4ff8=['rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','tools_intervals'];(function(_0x5fa80a,_0x51c5af){var _0x5682c1=function(_0xf4ca96){while(--_0xf4ca96){_0x5fa80a['push'](_0x5fa80a['shift']());}};_0x5682c1(++_0x51c5af);}(_0x4ff8,0x1e1));var _0x84ff=function(_0x2b6a4e,_0x25bc12){_0x2b6a4e=_0x2b6a4e-0x0;var _0x18ca01=_0x4ff8[_0x2b6a4e];return _0x18ca01;};'use strict';var _=require(_0x84ff('0x0'));var util=require(_0x84ff('0x1'));var logger=require(_0x84ff('0x2'))(_0x84ff('0x3'));var moment=require(_0x84ff('0x4'));var BPromise=require(_0x84ff('0x5'));var rp=require(_0x84ff('0x6'));var fs=require('fs');var path=require(_0x84ff('0x7'));var rimraf=require(_0x84ff('0x8'));var config=require(_0x84ff('0x9'));var attributes=require(_0x84ff('0xa'));var extensions=require(_0x84ff('0xb'));module[_0x84ff('0xc')]=function(_0x3a116e,_0x366944){return _0x3a116e['define']('Interval',attributes,{'tableName':_0x84ff('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x11d358,_0x2caf43){extensions[_0x84ff('0xe')](_0x3a116e,_0x11d358);},'afterBulkCreate':function(_0x5ad153,_0x1adc1f,_0x440385){_0x440385();extensions[_0x84ff('0xe')](_0x3a116e,_0x5ad153[0x0]);},'afterUpdate':function(_0x1802b9,_0x231924){extensions[_0x84ff('0xe')](_0x3a116e,_0x1802b9);},'afterDestroy':function(_0x3685ab,_0x36173f){extensions[_0x84ff('0xe')](_0x3a116e,_0x3685ab);}}});}; \ No newline at end of file +var _0xdaa1=['../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xdaa1,0x17d));var _0x1daa=function(_0x28beeb,_0x1a5e85){_0x28beeb=_0x28beeb-0x0;var _0xcae110=_0xdaa1[_0x28beeb];return _0xcae110;};'use strict';var _=require(_0x1daa('0x0'));var util=require(_0x1daa('0x1'));var logger=require(_0x1daa('0x2'))(_0x1daa('0x3'));var moment=require(_0x1daa('0x4'));var BPromise=require(_0x1daa('0x5'));var rp=require(_0x1daa('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1daa('0x7'));var config=require(_0x1daa('0x8'));var attributes=require('./interval.attributes');var extensions=require(_0x1daa('0x9'));module[_0x1daa('0xa')]=function(_0x5a4ca1,_0x14b5f0){return _0x5a4ca1[_0x1daa('0xb')](_0x1daa('0xc'),attributes,{'tableName':_0x1daa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b5a7d,_0x38e9bd){extensions[_0x1daa('0xe')](_0x5a4ca1,_0x4b5a7d);},'afterBulkCreate':function(_0x35e4f2,_0x3ab75f,_0x492815){_0x492815();extensions[_0x1daa('0xe')](_0x5a4ca1,_0x35e4f2[0x0]);},'afterUpdate':function(_0x55b7dc,_0x19bb43){extensions[_0x1daa('0xe')](_0x5a4ca1,_0x55b7dc);},'afterDestroy':function(_0x2e4e1e,_0x1552b3){extensions[_0x1daa('0xe')](_0x5a4ca1,_0x2e4e1e);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index f387201..eb294c2 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 _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x2e9187,_0x3763f6){var _0x1fc3a8=function(_0xb30d96){while(--_0xb30d96){_0x2e9187['push'](_0x2e9187['shift']());}};_0x1fc3a8(++_0x3763f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=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')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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['GetInterval']=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')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index cb77262..54eb02f 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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3dea7d,_0x2cd4ea){_0x3dea7d=_0x3dea7d-0x0;var _0x53919a=_0x0b0e[_0x3dea7d];return _0x53919a;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 9f91881..5956de0 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 _0xeaa6=['oldToken','newToken','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','base64','stringify','setEncoding','utf8','data','status','statusCode','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','send','body','x-forwarded-for','connection','socket','bluebird','../../config/logger','support','key','MOTGUI','Report','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501'];(function(_0x243bba,_0x1ea69f){var _0x12e696=function(_0x5d3ab5){while(--_0x5d3ab5){_0x243bba['push'](_0x243bba['shift']());}};_0x12e696(++_0x1ea69f);}(_0xeaa6,0x142));var _0x6eaa=function(_0x256df3,_0x497d6b){_0x256df3=_0x256df3-0x0;var _0x1fa364=_0xeaa6[_0x256df3];return _0x1fa364;};'use strict';var BPromise=require(_0x6eaa('0x0'));var https=require('https');var logger=require(_0x6eaa('0x1'))('api');var USERNAME=_0x6eaa('0x2');var PASSWORD='3eAmWpBVP0';function openIssue(_0x4858bb,_0x124796){var _0x448ea6={'fields':{'project':{'key':_0x4858bb[_0x6eaa('0x3')]||_0x6eaa('0x4')},'summary':(_0x4858bb['summary']||_0x6eaa('0x5'))+_0x6eaa('0x6')+_0x4858bb['ip'],'description':_0x4858bb[_0x6eaa('0x7')]||JSON['stringify'](_0x4858bb),'issuetype':{'name':_0x4858bb[_0x6eaa('0x8')]||_0x6eaa('0x9')}}};_0x448ea6[_0x6eaa('0xa')][_0x6eaa('0xb')]=_0x4858bb[_0x6eaa('0xc')];_0x448ea6[_0x6eaa('0xa')][_0x6eaa('0xd')]=_0x4858bb[_0x6eaa('0xe')];_0x448ea6['fields']['customfield_11502']=_0x4858bb[_0x6eaa('0xf')];_0x448ea6[_0x6eaa('0xa')][_0x6eaa('0x10')]=_0x4858bb[_0x6eaa('0x11')];_0x448ea6[_0x6eaa('0xa')][_0x6eaa('0x12')]=_0x4858bb['reason'];_0x448ea6[_0x6eaa('0xa')][_0x6eaa('0x13')]=_0x4858bb['ip'];var _0x15d158={'host':_0x6eaa('0x14'),'port':0x1bb,'path':_0x6eaa('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x6eaa('0x16'),'Authorization':_0x6eaa('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x6eaa('0x18')](_0x6eaa('0x19'))}};var _0x523591=JSON[_0x6eaa('0x1a')](_0x448ea6);var _0x3126ea=https['request'](_0x15d158,function(_0x50d250){_0x50d250[_0x6eaa('0x1b')](_0x6eaa('0x1c'));var _0x4e72a8='';_0x50d250['on'](_0x6eaa('0x1d'),function(_0x5e1bca){_0x4e72a8+=_0x5e1bca;});_0x50d250['on']('end',function(){if(_0x124796){return _0x124796[_0x6eaa('0x1e')](_0x50d250[_0x6eaa('0x1f')])['json'](JSON['parse'](_0x4e72a8));}});});_0x3126ea['on'](_0x6eaa('0x20'),function(_0x39866c){if(_0x124796){return _0x124796[_0x6eaa('0x1e')](0x1f4)['json']({'errors':[{'message':_0x6eaa('0x21'),'type':_0x6eaa('0x22')}]});}});_0x3126ea[_0x6eaa('0x23')](_0x523591);_0x3126ea[_0x6eaa('0x24')]();}exports['openIssue']=openIssue;exports[_0x6eaa('0x25')]=function(_0x43e0b0,_0x324243){_0x43e0b0[_0x6eaa('0x26')]['ip']=_0x43e0b0['headers'][_0x6eaa('0x27')]||_0x43e0b0[_0x6eaa('0x28')]['remoteAddress']||_0x43e0b0[_0x6eaa('0x29')]['remoteAddress']||_0x43e0b0['connection'][_0x6eaa('0x29')]['remoteAddress'];return openIssue(_0x43e0b0[_0x6eaa('0x26')],_0x324243);}; \ No newline at end of file +var _0x7e02=['3eAmWpBVP0','key','MOTGUI','Report','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','body','x-forwarded-for','connection','socket','remoteAddress','bluebird','../../config/logger','api'];(function(_0x32f17f,_0x1b6eca){var _0xd54d18=function(_0x3408fa){while(--_0x3408fa){_0x32f17f['push'](_0x32f17f['shift']());}};_0xd54d18(++_0x1b6eca);}(_0x7e02,0x13f));var _0x27e0=function(_0x2d42f4,_0x23bcb8){_0x2d42f4=_0x2d42f4-0x0;var _0x11485a=_0x7e02[_0x2d42f4];return _0x11485a;};'use strict';var BPromise=require(_0x27e0('0x0'));var https=require('https');var logger=require(_0x27e0('0x1'))(_0x27e0('0x2'));var USERNAME='support';var PASSWORD=_0x27e0('0x3');function openIssue(_0x55aca2,_0x4459cf){var _0x1b8dc6={'fields':{'project':{'key':_0x55aca2[_0x27e0('0x4')]||_0x27e0('0x5')},'summary':(_0x55aca2['summary']||_0x27e0('0x6'))+'\x20from\x20'+_0x55aca2['ip'],'description':_0x55aca2[_0x27e0('0x7')]||JSON[_0x27e0('0x8')](_0x55aca2),'issuetype':{'name':_0x55aca2[_0x27e0('0x9')]||_0x27e0('0xa')}}};_0x1b8dc6[_0x27e0('0xb')][_0x27e0('0xc')]=_0x55aca2[_0x27e0('0xd')];_0x1b8dc6['fields'][_0x27e0('0xe')]=_0x55aca2[_0x27e0('0xf')];_0x1b8dc6['fields'][_0x27e0('0x10')]=_0x55aca2[_0x27e0('0x11')];_0x1b8dc6[_0x27e0('0xb')][_0x27e0('0x12')]=_0x55aca2[_0x27e0('0x13')];_0x1b8dc6[_0x27e0('0xb')][_0x27e0('0x14')]=_0x55aca2[_0x27e0('0x15')];_0x1b8dc6[_0x27e0('0xb')][_0x27e0('0x16')]=_0x55aca2['ip'];var _0x231e6e={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x27e0('0x17'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x27e0('0x18'),'Authorization':_0x27e0('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x27e0('0x1a')](_0x27e0('0x1b'))}};var _0x3abc1c=JSON[_0x27e0('0x8')](_0x1b8dc6);var _0x4f0209=https[_0x27e0('0x1c')](_0x231e6e,function(_0x5127de){_0x5127de[_0x27e0('0x1d')](_0x27e0('0x1e'));var _0xf09202='';_0x5127de['on'](_0x27e0('0x1f'),function(_0x53d022){_0xf09202+=_0x53d022;});_0x5127de['on'](_0x27e0('0x20'),function(){if(_0x4459cf){return _0x4459cf[_0x27e0('0x21')](_0x5127de[_0x27e0('0x22')])[_0x27e0('0x23')](JSON[_0x27e0('0x24')](_0xf09202));}});});_0x4f0209['on'](_0x27e0('0x25'),function(_0x38e8e6){if(_0x4459cf){return _0x4459cf[_0x27e0('0x21')](0x1f4)['json']({'errors':[{'message':_0x27e0('0x26'),'type':_0x27e0('0x27')}]});}});_0x4f0209['write'](_0x3abc1c);_0x4f0209[_0x27e0('0x20')]();}exports[_0x27e0('0x28')]=openIssue;exports['send']=function(_0x533f2d,_0x1fd605){_0x533f2d[_0x27e0('0x29')]['ip']=_0x533f2d['headers'][_0x27e0('0x2a')]||_0x533f2d[_0x27e0('0x2b')]['remoteAddress']||_0x533f2d[_0x27e0('0x2c')]['remoteAddress']||_0x533f2d['connection'][_0x27e0('0x2c')][_0x27e0('0x2d')];return openIssue(_0x533f2d[_0x27e0('0x29')],_0x1fd605);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 99cfa8d..0a409e7 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2dae=['show','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x2dae,0xc3));var _0xe2da=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0x2dae[_0x1793de];return _0x4f0309;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xd')]);router[_0xe2da('0x9')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xf')]);router['post']('/',auth[_0xe2da('0xc')](),controller[_0xe2da('0x10')]);router[_0xe2da('0x11')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x12')]);router[_0xe2da('0x13')](_0xe2da('0xe'),auth['isAuthenticated'](),controller[_0xe2da('0x14')]);module['exports']=router; \ No newline at end of file +var _0x0713=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update'];(function(_0x685a6d,_0x4b5f66){var _0x2a6f7d=function(_0x4e9772){while(--_0x4e9772){_0x685a6d['push'](_0x685a6d['shift']());}};_0x2a6f7d(++_0x4b5f66);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')](_0x3071('0xd'),auth['isAuthenticated'](),controller[_0x3071('0x11')]);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);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 0143e18..d44e19e 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7a54,0x106));var _0x47a5=function(_0x145720,_0x50ac34){_0x145720=_0x145720-0x0;var _0x3fac1b=_0x7a54[_0x145720];return _0x3fac1b;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7a54,0x106));var _0x47a5=function(_0x1b0f89,_0x7ddb22){_0x1b0f89=_0x1b0f89-0x0;var _0x4f8b99=_0x7a54[_0x1b0f89];return _0x4f8b99;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 0d8bf5a..13638d4 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 _0x7d55=['sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','then','error','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x5cac50,_0x20c81c){var _0x23a1dc=function(_0x397b23){while(--_0x397b23){_0x5cac50['push'](_0x5cac50['shift']());}};_0x23a1dc(++_0x20c81c);}(_0x7d55,0x1bc));var _0x57d5=function(_0x361e96,_0x2d843e){_0x361e96=_0x361e96-0x0;var _0x1de3cb=_0x7d55[_0x361e96];return _0x1de3cb;};'use strict';var emlformat=require(_0x57d5('0x0'));var rimraf=require(_0x57d5('0x1'));var zipdir=require(_0x57d5('0x2'));var jsonpatch=require(_0x57d5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x57d5('0x4'));var Mustache=require(_0x57d5('0x5'));var util=require(_0x57d5('0x6'));var path=require('path');var sox=require(_0x57d5('0x7'));var csv=require(_0x57d5('0x8'));var ejs=require(_0x57d5('0x9'));var fs=require('fs');var fs_extra=require(_0x57d5('0xa'));var _=require(_0x57d5('0xb'));var squel=require(_0x57d5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x57d5('0xd'));var Papa=require(_0x57d5('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x57d5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57d5('0x10'));var logger=require(_0x57d5('0x11'))(_0x57d5('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x57d5('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b7cc5,_0x1226b4){_0x1226b4=_0x1226b4||0xcc;return function(_0x336f38){if(_0x336f38){return _0x1b7cc5[_0x57d5('0x14')](_0x1226b4);}return _0x1b7cc5[_0x57d5('0x15')](_0x1226b4)[_0x57d5('0x16')]();};}function respondWithResult(_0x24c331,_0x25c927){_0x25c927=_0x25c927||0xc8;return function(_0x4dded6){if(_0x4dded6){return _0x24c331['status'](_0x25c927)[_0x57d5('0x17')](_0x4dded6);}};}function respondWithFilteredResult(_0x5ceac8,_0x35d736){return function(_0x2cc76e){if(_0x2cc76e){var _0x48308c=typeof _0x35d736[_0x57d5('0x18')]==='undefined'&&typeof _0x35d736['limit']===_0x57d5('0x19');var _0x12af1c=_0x2cc76e['count'];var _0x573143=_0x48308c?0x0:_0x35d736[_0x57d5('0x18')];var _0x28cb8d=_0x48308c?_0x2cc76e[_0x57d5('0x1a')]:_0x35d736[_0x57d5('0x18')]+_0x35d736[_0x57d5('0x1b')];var _0x394acc;if(_0x28cb8d>=_0x12af1c){_0x28cb8d=_0x12af1c;_0x394acc=0xc8;}else{_0x394acc=0xce;}_0x5ceac8['status'](_0x394acc);return _0x5ceac8[_0x57d5('0x1c')](_0x57d5('0x1d'),_0x573143+'-'+_0x28cb8d+'/'+_0x12af1c)[_0x57d5('0x17')](_0x2cc76e);}return null;};}function patchUpdates(_0x3ac374){return function(_0xaf0b7f){try{jsonpatch[_0x57d5('0x1e')](_0xaf0b7f,_0x3ac374,!![]);}catch(_0x449c4b){return BPromise['reject'](_0x449c4b);}return _0xaf0b7f['save']();};}function saveUpdates(_0x43e2d4,_0x4bda8b){return function(_0x378ee5){if(_0x378ee5){return _0x378ee5[_0x57d5('0x1f')](_0x43e2d4)['then'](function(_0x3b9951){return _0x3b9951;});}return null;};}function removeEntity(_0x58b01b,_0x2becaa){return function(_0x4d6c6b){if(_0x4d6c6b){return _0x4d6c6b[_0x57d5('0x20')]()[_0x57d5('0x21')](function(){_0x58b01b[_0x57d5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e6ff0,_0x567dc9){return function(_0x4498b7){if(!_0x4498b7){_0x5e6ff0[_0x57d5('0x14')](0x194);}return _0x4498b7;};}function handleError(_0x6cefe3,_0x46d600){_0x46d600=_0x46d600||0x1f4;return function(_0x33ff35){logger[_0x57d5('0x22')](_0x33ff35['stack']);if(_0x33ff35[_0x57d5('0x23')]){delete _0x33ff35[_0x57d5('0x23')];}_0x6cefe3[_0x57d5('0x15')](_0x46d600)[_0x57d5('0x24')](_0x33ff35);};}exports[_0x57d5('0x25')]=function(_0x2aa68b,_0x3c98cc){var _0x32e4d3={},_0x5d1696={},_0x44abad={'count':0x0,'rows':[]};var _0x1e53a1=_[_0x57d5('0x26')](db[_0x57d5('0x27')][_0x57d5('0x28')],function(_0x50a475){return{'name':_0x50a475[_0x57d5('0x29')],'type':_0x50a475[_0x57d5('0x2a')]['key']};});_0x5d1696[_0x57d5('0x2b')]=_[_0x57d5('0x26')](_0x1e53a1,'name');_0x5d1696[_0x57d5('0x2c')]=_[_0x57d5('0x2d')](_0x2aa68b[_0x57d5('0x2c')]);_0x5d1696[_0x57d5('0x2e')]=_[_0x57d5('0x2f')](_0x5d1696['model'],_0x5d1696['query']);_0x32e4d3[_0x57d5('0x30')]=_[_0x57d5('0x2f')](_0x5d1696['model'],qs[_0x57d5('0x31')](_0x2aa68b[_0x57d5('0x2c')][_0x57d5('0x31')]));_0x32e4d3['attributes']=_0x32e4d3[_0x57d5('0x30')][_0x57d5('0x32')]?_0x32e4d3['attributes']:_0x5d1696['model'];if(!_0x2aa68b[_0x57d5('0x2c')][_0x57d5('0x33')](_0x57d5('0x34'))){_0x32e4d3[_0x57d5('0x1b')]=qs['limit'](_0x2aa68b[_0x57d5('0x2c')]['limit']);_0x32e4d3[_0x57d5('0x18')]=qs[_0x57d5('0x18')](_0x2aa68b[_0x57d5('0x2c')][_0x57d5('0x18')]);}_0x32e4d3['order']=qs[_0x57d5('0x35')](_0x2aa68b[_0x57d5('0x2c')][_0x57d5('0x35')]);_0x32e4d3[_0x57d5('0x36')]=qs[_0x57d5('0x2e')](_[_0x57d5('0x37')](_0x2aa68b[_0x57d5('0x2c')],_0x5d1696[_0x57d5('0x2e')]),_0x1e53a1);if(_0x2aa68b[_0x57d5('0x2c')]['filter']){_0x32e4d3[_0x57d5('0x36')]=_[_0x57d5('0x38')](_0x32e4d3['where'],{'$or':_[_0x57d5('0x26')](_0x1e53a1,function(_0x422bc0){if(_0x422bc0[_0x57d5('0x2a')]!==_0x57d5('0x39')){var _0x208ec3={};_0x208ec3[_0x422bc0[_0x57d5('0x23')]]={'$like':'%'+_0x2aa68b[_0x57d5('0x2c')][_0x57d5('0x3a')]+'%'};return _0x208ec3;}})});}_0x32e4d3=_[_0x57d5('0x38')]({},_0x32e4d3,_0x2aa68b[_0x57d5('0x3b')]);var _0x42a945={'where':_0x32e4d3['where']};return db[_0x57d5('0x27')]['count'](_0x42a945)[_0x57d5('0x21')](function(_0x3ca8d5){_0x44abad['count']=_0x3ca8d5;if(_0x2aa68b[_0x57d5('0x2c')][_0x57d5('0x3c')]){_0x32e4d3['include']=[{'all':!![]}];}return db[_0x57d5('0x27')][_0x57d5('0x3d')](_0x32e4d3);})[_0x57d5('0x21')](function(_0x2c4188){_0x44abad[_0x57d5('0x3e')]=_0x2c4188;return _0x44abad;})['then'](respondWithFilteredResult(_0x3c98cc,_0x32e4d3))[_0x57d5('0x3f')](handleError(_0x3c98cc,null));};exports[_0x57d5('0x40')]=function(_0x2ba0d6,_0x275f4e){var _0x4ed26e={'raw':!![],'where':{'id':_0x2ba0d6[_0x57d5('0x41')]['id']}},_0x258e94={};_0x258e94[_0x57d5('0x2b')]=_[_0x57d5('0x2d')](db['JscriptyAnswerReport'][_0x57d5('0x28')]);_0x258e94['query']=_[_0x57d5('0x2d')](_0x2ba0d6[_0x57d5('0x2c')]);_0x258e94[_0x57d5('0x2e')]=_['intersection'](_0x258e94['model'],_0x258e94[_0x57d5('0x2c')]);_0x4ed26e[_0x57d5('0x30')]=_[_0x57d5('0x2f')](_0x258e94['model'],qs[_0x57d5('0x31')](_0x2ba0d6[_0x57d5('0x2c')][_0x57d5('0x31')]));_0x4ed26e[_0x57d5('0x30')]=_0x4ed26e[_0x57d5('0x30')][_0x57d5('0x32')]?_0x4ed26e[_0x57d5('0x30')]:_0x258e94[_0x57d5('0x2b')];if(_0x2ba0d6[_0x57d5('0x2c')]['includeAll']){_0x4ed26e[_0x57d5('0x42')]=[{'all':!![]}];}_0x4ed26e=_[_0x57d5('0x38')]({},_0x4ed26e,_0x2ba0d6[_0x57d5('0x3b')]);return db[_0x57d5('0x27')]['find'](_0x4ed26e)[_0x57d5('0x21')](handleEntityNotFound(_0x275f4e,null))['then'](respondWithResult(_0x275f4e,null))[_0x57d5('0x3f')](handleError(_0x275f4e,null));};exports[_0x57d5('0x43')]=function(_0x3763ee,_0x30613c){return db['JscriptyAnswerReport'][_0x57d5('0x43')](_0x3763ee[_0x57d5('0x44')],{})[_0x57d5('0x21')](respondWithResult(_0x30613c,0xc9))['catch'](handleError(_0x30613c,null));};exports[_0x57d5('0x1f')]=function(_0x5d5ba8,_0x3b0caf){if(_0x5d5ba8[_0x57d5('0x44')]['id']){delete _0x5d5ba8[_0x57d5('0x44')]['id'];}return db[_0x57d5('0x27')][_0x57d5('0x45')]({'where':{'id':_0x5d5ba8[_0x57d5('0x41')]['id']}})[_0x57d5('0x21')](handleEntityNotFound(_0x3b0caf,null))[_0x57d5('0x21')](saveUpdates(_0x5d5ba8[_0x57d5('0x44')],null))[_0x57d5('0x21')](respondWithResult(_0x3b0caf,null))[_0x57d5('0x3f')](handleError(_0x3b0caf,null));};exports[_0x57d5('0x20')]=function(_0x16a69f,_0x59457b){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x16a69f['params']['id']}})[_0x57d5('0x21')](handleEntityNotFound(_0x59457b,null))[_0x57d5('0x21')](removeEntity(_0x59457b,null))[_0x57d5('0x3f')](handleError(_0x59457b,null));};exports[_0x57d5('0x46')]=function(_0x59509b,_0x31763f){return db[_0x57d5('0x27')][_0x57d5('0x46')]()[_0x57d5('0x21')](respondWithResult(_0x31763f,null))[_0x57d5('0x3f')](handleError(_0x31763f,null));}; \ No newline at end of file +var _0x1115=['crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyAnswerReport','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1115,0x1b6));var _0x5111=function(_0x277890,_0x4a3a4e){_0x277890=_0x277890-0x0;var _0x102770=_0x1115[_0x277890];return _0x102770;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5111('0x0'));var zipdir=require(_0x5111('0x1'));var jsonpatch=require(_0x5111('0x2'));var rp=require(_0x5111('0x3'));var moment=require(_0x5111('0x4'));var BPromise=require(_0x5111('0x5'));var Mustache=require(_0x5111('0x6'));var util=require(_0x5111('0x7'));var path=require(_0x5111('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5111('0x9'));var fs=require('fs');var fs_extra=require(_0x5111('0xa'));var _=require('lodash');var squel=require(_0x5111('0xb'));var crypto=require(_0x5111('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5111('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5111('0xe'));var Papa=require(_0x5111('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5111('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5111('0x11'));var logger=require('../../config/logger')(_0x5111('0x12'));var utils=require(_0x5111('0x13'));var config=require(_0x5111('0x14'));var licenseUtil=require(_0x5111('0x15'));var db=require(_0x5111('0x16'))['db'];function respondWithStatusCode(_0x54f83a,_0x266625){_0x266625=_0x266625||0xcc;return function(_0x14b4e3){if(_0x14b4e3){return _0x54f83a[_0x5111('0x17')](_0x266625);}return _0x54f83a[_0x5111('0x18')](_0x266625)[_0x5111('0x19')]();};}function respondWithResult(_0x62ce44,_0x264703){_0x264703=_0x264703||0xc8;return function(_0x3e60b5){if(_0x3e60b5){return _0x62ce44[_0x5111('0x18')](_0x264703)[_0x5111('0x1a')](_0x3e60b5);}};}function respondWithFilteredResult(_0x77ddfd,_0x45052e){return function(_0x478b68){if(_0x478b68){var _0x1ac606=typeof _0x45052e['offset']==='undefined'&&typeof _0x45052e[_0x5111('0x1b')]===_0x5111('0x1c');var _0x638470=_0x478b68['count'];var _0x367f8d=_0x1ac606?0x0:_0x45052e[_0x5111('0x1d')];var _0x52c614=_0x1ac606?_0x478b68[_0x5111('0x1e')]:_0x45052e[_0x5111('0x1d')]+_0x45052e[_0x5111('0x1b')];var _0x1b3b45;if(_0x52c614>=_0x638470){_0x52c614=_0x638470;_0x1b3b45=0xc8;}else{_0x1b3b45=0xce;}_0x77ddfd['status'](_0x1b3b45);return _0x77ddfd[_0x5111('0x1f')](_0x5111('0x20'),_0x367f8d+'-'+_0x52c614+'/'+_0x638470)[_0x5111('0x1a')](_0x478b68);}return null;};}function patchUpdates(_0x1b3136){return function(_0x22c7cd){try{jsonpatch[_0x5111('0x21')](_0x22c7cd,_0x1b3136,!![]);}catch(_0x3e8de1){return BPromise[_0x5111('0x22')](_0x3e8de1);}return _0x22c7cd[_0x5111('0x23')]();};}function saveUpdates(_0x3a3fae,_0x4b73ce){return function(_0x3f462d){if(_0x3f462d){return _0x3f462d[_0x5111('0x24')](_0x3a3fae)[_0x5111('0x25')](function(_0x5bf534){return _0x5bf534;});}return null;};}function removeEntity(_0x28cc87,_0x20a4f7){return function(_0x2d9446){if(_0x2d9446){return _0x2d9446[_0x5111('0x26')]()[_0x5111('0x25')](function(){_0x28cc87[_0x5111('0x18')](0xcc)[_0x5111('0x19')]();});}};}function handleEntityNotFound(_0x316b39,_0x382bd0){return function(_0x1a5793){if(!_0x1a5793){_0x316b39['sendStatus'](0x194);}return _0x1a5793;};}function handleError(_0x1bdd54,_0x3d6825){_0x3d6825=_0x3d6825||0x1f4;return function(_0x151b67){logger[_0x5111('0x27')](_0x151b67[_0x5111('0x28')]);if(_0x151b67[_0x5111('0x29')]){delete _0x151b67[_0x5111('0x29')];}_0x1bdd54['status'](_0x3d6825)[_0x5111('0x2a')](_0x151b67);};}exports[_0x5111('0x2b')]=function(_0x25a75a,_0x5efec6){var _0xdf9031={},_0x28efc1={},_0x16107a={'count':0x0,'rows':[]};var _0x48379a=_['map'](db[_0x5111('0x2c')]['rawAttributes'],function(_0xbacf9e){return{'name':_0xbacf9e['fieldName'],'type':_0xbacf9e[_0x5111('0x2d')]['key']};});_0x28efc1['model']=_['map'](_0x48379a,_0x5111('0x29'));_0x28efc1[_0x5111('0x2e')]=_[_0x5111('0x2f')](_0x25a75a[_0x5111('0x2e')]);_0x28efc1[_0x5111('0x30')]=_[_0x5111('0x31')](_0x28efc1[_0x5111('0x32')],_0x28efc1['query']);_0xdf9031[_0x5111('0x33')]=_[_0x5111('0x31')](_0x28efc1[_0x5111('0x32')],qs[_0x5111('0x34')](_0x25a75a['query']['fields']));_0xdf9031[_0x5111('0x33')]=_0xdf9031[_0x5111('0x33')][_0x5111('0x35')]?_0xdf9031[_0x5111('0x33')]:_0x28efc1[_0x5111('0x32')];if(!_0x25a75a[_0x5111('0x2e')][_0x5111('0x36')](_0x5111('0x37'))){_0xdf9031['limit']=qs[_0x5111('0x1b')](_0x25a75a[_0x5111('0x2e')][_0x5111('0x1b')]);_0xdf9031['offset']=qs[_0x5111('0x1d')](_0x25a75a[_0x5111('0x2e')][_0x5111('0x1d')]);}_0xdf9031['order']=qs['sort'](_0x25a75a['query'][_0x5111('0x38')]);_0xdf9031[_0x5111('0x39')]=qs[_0x5111('0x30')](_[_0x5111('0x3a')](_0x25a75a[_0x5111('0x2e')],_0x28efc1['filters']),_0x48379a);if(_0x25a75a[_0x5111('0x2e')][_0x5111('0x3b')]){_0xdf9031[_0x5111('0x39')]=_[_0x5111('0x3c')](_0xdf9031['where'],{'$or':_[_0x5111('0x3d')](_0x48379a,function(_0x444d82){if(_0x444d82[_0x5111('0x2d')]!==_0x5111('0x3e')){var _0x2f0224={};_0x2f0224[_0x444d82[_0x5111('0x29')]]={'$like':'%'+_0x25a75a[_0x5111('0x2e')][_0x5111('0x3b')]+'%'};return _0x2f0224;}})});}_0xdf9031=_[_0x5111('0x3c')]({},_0xdf9031,_0x25a75a[_0x5111('0x3f')]);var _0x35c3b5={'where':_0xdf9031[_0x5111('0x39')]};return db[_0x5111('0x2c')]['count'](_0x35c3b5)[_0x5111('0x25')](function(_0xf00f9){_0x16107a['count']=_0xf00f9;if(_0x25a75a[_0x5111('0x2e')][_0x5111('0x40')]){_0xdf9031[_0x5111('0x41')]=[{'all':!![]}];}return db[_0x5111('0x2c')][_0x5111('0x42')](_0xdf9031);})[_0x5111('0x25')](function(_0x1f1534){_0x16107a['rows']=_0x1f1534;return _0x16107a;})[_0x5111('0x25')](respondWithFilteredResult(_0x5efec6,_0xdf9031))[_0x5111('0x43')](handleError(_0x5efec6,null));};exports[_0x5111('0x44')]=function(_0x1c2e17,_0x96893c){var _0x49307f={'raw':!![],'where':{'id':_0x1c2e17[_0x5111('0x45')]['id']}},_0x50a293={};_0x50a293[_0x5111('0x32')]=_['keys'](db[_0x5111('0x2c')][_0x5111('0x46')]);_0x50a293[_0x5111('0x2e')]=_[_0x5111('0x2f')](_0x1c2e17[_0x5111('0x2e')]);_0x50a293[_0x5111('0x30')]=_[_0x5111('0x31')](_0x50a293[_0x5111('0x32')],_0x50a293[_0x5111('0x2e')]);_0x49307f[_0x5111('0x33')]=_['intersection'](_0x50a293['model'],qs[_0x5111('0x34')](_0x1c2e17[_0x5111('0x2e')][_0x5111('0x34')]));_0x49307f[_0x5111('0x33')]=_0x49307f[_0x5111('0x33')][_0x5111('0x35')]?_0x49307f['attributes']:_0x50a293[_0x5111('0x32')];if(_0x1c2e17[_0x5111('0x2e')][_0x5111('0x40')]){_0x49307f[_0x5111('0x41')]=[{'all':!![]}];}_0x49307f=_['merge']({},_0x49307f,_0x1c2e17[_0x5111('0x3f')]);return db[_0x5111('0x2c')][_0x5111('0x47')](_0x49307f)['then'](handleEntityNotFound(_0x96893c,null))[_0x5111('0x25')](respondWithResult(_0x96893c,null))[_0x5111('0x43')](handleError(_0x96893c,null));};exports[_0x5111('0x48')]=function(_0x2d64de,_0x5cd7a5){return db['JscriptyAnswerReport'][_0x5111('0x48')](_0x2d64de['body'],{})['then'](respondWithResult(_0x5cd7a5,0xc9))[_0x5111('0x43')](handleError(_0x5cd7a5,null));};exports[_0x5111('0x24')]=function(_0x4aa934,_0x296f87){if(_0x4aa934[_0x5111('0x49')]['id']){delete _0x4aa934[_0x5111('0x49')]['id'];}return db[_0x5111('0x2c')][_0x5111('0x47')]({'where':{'id':_0x4aa934[_0x5111('0x45')]['id']}})[_0x5111('0x25')](handleEntityNotFound(_0x296f87,null))[_0x5111('0x25')](saveUpdates(_0x4aa934[_0x5111('0x49')],null))[_0x5111('0x25')](respondWithResult(_0x296f87,null))[_0x5111('0x43')](handleError(_0x296f87,null));};exports[_0x5111('0x26')]=function(_0x53d631,_0x79427d){return db[_0x5111('0x2c')][_0x5111('0x47')]({'where':{'id':_0x53d631[_0x5111('0x45')]['id']}})[_0x5111('0x25')](handleEntityNotFound(_0x79427d,null))[_0x5111('0x25')](removeEntity(_0x79427d,null))[_0x5111('0x43')](handleError(_0x79427d,null));};exports['describe']=function(_0x55cba5,_0x13fe1b){return db['JscriptyAnswerReport'][_0x5111('0x4a')]()[_0x5111('0x25')](respondWithResult(_0x13fe1b,null))[_0x5111('0x43')](handleError(_0x13fe1b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 326a485..1737c44 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 _0x73ff=['../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x3818b3,_0x5a6992){var _0x1f0c7c=function(_0x724043){while(--_0x724043){_0x3818b3['push'](_0x3818b3['shift']());}};_0x1f0c7c(++_0x5a6992);}(_0x73ff,0x1b3));var _0xf73f=function(_0x67135,_0x47428e){_0x67135=_0x67135-0x0;var _0x2251ee=_0x73ff[_0x67135];return _0x2251ee;};'use strict';var _=require(_0xf73f('0x0'));var util=require(_0xf73f('0x1'));var logger=require(_0xf73f('0x2'))('api');var moment=require(_0xf73f('0x3'));var BPromise=require('bluebird');var rp=require(_0xf73f('0x4'));var fs=require('fs');var path=require(_0xf73f('0x5'));var rimraf=require(_0xf73f('0x6'));var config=require(_0xf73f('0x7'));var attributes=require(_0xf73f('0x8'));module[_0xf73f('0x9')]=function(_0x113e62,_0x2827d2){return _0x113e62[_0xf73f('0xa')](_0xf73f('0xb'),attributes,{'tableName':_0xf73f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf299=['lodash','../../config/logger','api','moment','bluebird','../../config/environment','exports','define','JscriptyAnswerReport','report_jscripty_answers'];(function(_0xc66af2,_0x14f6d8){var _0x38d439=function(_0x544ab8){while(--_0x544ab8){_0xc66af2['push'](_0xc66af2['shift']());}};_0x38d439(++_0x14f6d8);}(_0xf299,0x118));var _0x9f29=function(_0x1b1087,_0x32f9ce){_0x1b1087=_0x1b1087-0x0;var _0x1071d9=_0xf299[_0x1b1087];return _0x1071d9;};'use strict';var _=require(_0x9f29('0x0'));var util=require('util');var logger=require(_0x9f29('0x1'))(_0x9f29('0x2'));var moment=require(_0x9f29('0x3'));var BPromise=require(_0x9f29('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9f29('0x5'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x9f29('0x6')]=function(_0x4c33d9,_0x33fe44){return _0x4c33d9[_0x9f29('0x7')](_0x9f29('0x8'),attributes,{'tableName':_0x9f29('0x9'),'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 434cd16..ebde82c 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 _0xf73c=['util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xf73c,0x1ce));var _0xcf73=function(_0x3427dc,_0x2b9c60){_0x3427dc=_0x3427dc-0x0;var _0x1ca79e=_0xf73c[_0x3427dc];return _0x1ca79e;};'use strict';var _=require('lodash');var util=require(_0xcf73('0x0'));var moment=require('moment');var BPromise=require(_0xcf73('0x1'));var rs=require(_0xcf73('0x2'));var fs=require('fs');var Redis=require(_0xcf73('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcf73('0x4'));var config=require(_0xcf73('0x5'));var jayson=require(_0xcf73('0x6'));var client=jayson[_0xcf73('0x7')][_0xcf73('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d4289,_0x11fb9b,_0x2ac81c){return new BPromise(function(_0x12b8ac,_0x5e64b6){return client[_0xcf73('0x9')](_0x1d4289,_0x2ac81c)[_0xcf73('0xa')](function(_0x5dba03){logger['info'](_0xcf73('0xb'),_0x11fb9b,_0xcf73('0xc'));logger['debug'](_0xcf73('0xd'),_0x11fb9b,_0xcf73('0xc'),JSON[_0xcf73('0xe')](_0x5dba03));if(_0x5dba03[_0xcf73('0xf')]){if(_0x5dba03[_0xcf73('0xf')][_0xcf73('0x10')]===0x1f4){logger[_0xcf73('0xf')](_0xcf73('0xb'),_0x11fb9b,_0x5dba03[_0xcf73('0xf')][_0xcf73('0x11')]);return _0x5e64b6(_0x5dba03[_0xcf73('0xf')][_0xcf73('0x11')]);}logger[_0xcf73('0xf')](_0xcf73('0xb'),_0x11fb9b,_0x5dba03[_0xcf73('0xf')][_0xcf73('0x11')]);return _0x12b8ac(_0x5dba03[_0xcf73('0xf')][_0xcf73('0x11')]);}else{logger[_0xcf73('0x12')](_0xcf73('0xb'),_0x11fb9b,_0xcf73('0xc'));_0x12b8ac(_0x5dba03[_0xcf73('0x13')][_0xcf73('0x11')]);}})[_0xcf73('0x14')](function(_0x4afe5d){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x11fb9b,_0x4afe5d);_0x5e64b6(_0x4afe5d);});});} \ No newline at end of file +var _0x7571=['../../config/utils','jayson/promise','client','http','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7571,0x12d));var _0x1757=function(_0x523503,_0x12b703){_0x523503=_0x523503-0x0;var _0x1362df=_0x7571[_0x523503];return _0x1362df;};'use strict';var _=require(_0x1757('0x0'));var util=require(_0x1757('0x1'));var moment=require(_0x1757('0x2'));var BPromise=require('bluebird');var rs=require(_0x1757('0x3'));var fs=require('fs');var Redis=require(_0x1757('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1757('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1757('0x6'));var client=jayson[_0x1757('0x7')][_0x1757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f3d25,_0x44a171,_0x3c78c5){return new BPromise(function(_0x4da663,_0x5c07f8){return client['request'](_0x3f3d25,_0x3c78c5)['then'](function(_0xa945bc){logger[_0x1757('0x9')](_0x1757('0xa'),_0x44a171,'request\x20sent');logger[_0x1757('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x44a171,_0x1757('0xc'),JSON['stringify'](_0xa945bc));if(_0xa945bc[_0x1757('0xd')]){if(_0xa945bc[_0x1757('0xd')][_0x1757('0xe')]===0x1f4){logger[_0x1757('0xd')](_0x1757('0xa'),_0x44a171,_0xa945bc[_0x1757('0xd')][_0x1757('0xf')]);return _0x5c07f8(_0xa945bc[_0x1757('0xd')][_0x1757('0xf')]);}logger[_0x1757('0xd')](_0x1757('0xa'),_0x44a171,_0xa945bc[_0x1757('0xd')]['message']);return _0x4da663(_0xa945bc[_0x1757('0xd')]['message']);}else{logger[_0x1757('0x9')](_0x1757('0xa'),_0x44a171,_0x1757('0xc'));_0x4da663(_0xa945bc[_0x1757('0x10')]['message']);}})[_0x1757('0x11')](function(_0x3bcb1b){logger['error'](_0x1757('0xa'),_0x44a171,_0x3bcb1b);_0x5c07f8(_0x3bcb1b);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 34b0c8e..06c9212 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 _0xac3d=['util','path','express','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','clone','put','update','delete','destroy','exports'];(function(_0x5ac09a,_0x145832){var _0x4cde78=function(_0x2e06ee){while(--_0x2e06ee){_0x5ac09a['push'](_0x5ac09a['shift']());}};_0x4cde78(++_0x145832);}(_0xac3d,0x150));var _0xdac3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xac3d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xdac3('0x0'));var path=require(_0xdac3('0x1'));var timeout=require('connect-timeout');var express=require(_0xdac3('0x2'));var router=express['Router']();var fs_extra=require(_0xdac3('0x3'));var auth=require(_0xdac3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdac3('0x5'));var controller=require(_0xdac3('0x6'));router[_0xdac3('0x7')]('/',auth[_0xdac3('0x8')](),controller[_0xdac3('0x9')]);router[_0xdac3('0x7')](_0xdac3('0xa'),auth['isAuthenticated'](),controller[_0xdac3('0xb')]);router[_0xdac3('0x7')]('/:id/sessions',auth['isAuthenticated'](),controller['getSessions']);router[_0xdac3('0x7')](_0xdac3('0xc'),auth[_0xdac3('0x8')](),controller[_0xdac3('0xd')]);router[_0xdac3('0x7')](_0xdac3('0xe'),auth[_0xdac3('0x8')](),timeout(_0xdac3('0xf')),controller[_0xdac3('0x10')]);router[_0xdac3('0x11')]('/',auth[_0xdac3('0x8')](),controller['create']);router[_0xdac3('0x11')]('/:id/clone',auth[_0xdac3('0x8')](),controller[_0xdac3('0x12')]);router[_0xdac3('0x13')](_0xdac3('0xa'),auth[_0xdac3('0x8')](),controller[_0xdac3('0x14')]);router[_0xdac3('0x15')](_0xdac3('0xa'),auth[_0xdac3('0x8')](),controller[_0xdac3('0x16')]);module[_0xdac3('0x17')]=router; \ No newline at end of file +var _0xbce8=['index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated'];(function(_0x11f363,_0x1f9526){var _0x11f6e4=function(_0x414f4c){while(--_0x414f4c){_0x11f363['push'](_0x11f363['shift']());}};_0x11f6e4(++_0x1f9526);}(_0xbce8,0x1d1));var _0x8bce=function(_0xd8aad0,_0x4da2cd){_0xd8aad0=_0xd8aad0-0x0;var _0x570860=_0xbce8[_0xd8aad0];return _0x570860;};'use strict';var multer=require(_0x8bce('0x0'));var util=require(_0x8bce('0x1'));var path=require(_0x8bce('0x2'));var timeout=require('connect-timeout');var express=require(_0x8bce('0x3'));var router=express[_0x8bce('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8bce('0x5'));var interaction=require(_0x8bce('0x6'));var config=require(_0x8bce('0x7'));var controller=require(_0x8bce('0x8'));router[_0x8bce('0x9')]('/',auth[_0x8bce('0xa')](),controller[_0x8bce('0xb')]);router[_0x8bce('0x9')](_0x8bce('0xc'),auth[_0x8bce('0xa')](),controller[_0x8bce('0xd')]);router[_0x8bce('0x9')](_0x8bce('0xe'),auth[_0x8bce('0xa')](),controller[_0x8bce('0xf')]);router[_0x8bce('0x9')](_0x8bce('0x10'),auth[_0x8bce('0xa')](),controller[_0x8bce('0x11')]);router[_0x8bce('0x9')](_0x8bce('0x12'),auth[_0x8bce('0xa')](),timeout(_0x8bce('0x13')),controller[_0x8bce('0x14')]);router[_0x8bce('0x15')]('/',auth[_0x8bce('0xa')](),controller[_0x8bce('0x16')]);router['post'](_0x8bce('0x17'),auth[_0x8bce('0xa')](),controller['clone']);router[_0x8bce('0x18')]('/:id',auth[_0x8bce('0xa')](),controller[_0x8bce('0x19')]);router['delete'](_0x8bce('0xc'),auth[_0x8bce('0xa')](),controller[_0x8bce('0x1a')]);module[_0x8bce('0x1b')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index d97bb87..67d7b39 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 _0x97e7=['format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','STRING','name','long','isObjectLike','setDataValue','formData','stringify','isString'];(function(_0x272492,_0x3f1168){var _0xab15b8=function(_0x523d5f){while(--_0x523d5f){_0x272492['push'](_0x272492['shift']());}};_0xab15b8(++_0x3f1168);}(_0x97e7,0x163));var _0x797e=function(_0x3a1e2d,_0x5225b0){_0x3a1e2d=_0x3a1e2d-0x0;var _0x4e3fb7=_0x97e7[_0x3a1e2d];return _0x4e3fb7;};'use strict';var Sequelize=require('sequelize');var _=require(_0x797e('0x0'));var util=require('util');module['exports']={'name':{'type':Sequelize[_0x797e('0x1')],'unique':_0x797e('0x2')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x797e('0x3')),'set':function(_0x35f79c){if(_[_0x797e('0x4')](_0x35f79c)){this[_0x797e('0x5')](_0x797e('0x6'),JSON[_0x797e('0x7')](_0x35f79c));}else if(_[_0x797e('0x8')](_0x35f79c)){this['setDataValue'](_0x797e('0x6'),_0x35f79c);}else{this[_0x797e('0x5')](_0x797e('0x6'),util[_0x797e('0x9')](_0x797e('0xa'),this[_0x797e('0xb')](_0x797e('0x2'))||'',this[_0x797e('0xb')](_0x797e('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x797e('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x5d23=['name','description','BOOLEAN','lodash','util','exports','STRING','long','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x1a2d35,_0x10af53){var _0x3099a3=function(_0x50fd75){while(--_0x50fd75){_0x1a2d35['push'](_0x1a2d35['shift']());}};_0x3099a3(++_0x10af53);}(_0x5d23,0x145));var _0x35d2=function(_0x14d37a,_0x856bdb){_0x14d37a=_0x14d37a-0x0;var _0x1975fe=_0x5d23[_0x14d37a];return _0x1975fe;};'use strict';var Sequelize=require('sequelize');var _=require(_0x35d2('0x0'));var util=require(_0x35d2('0x1'));module[_0x35d2('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x35d2('0x3')]},'formData':{'type':Sequelize['TEXT'](_0x35d2('0x4')),'set':function(_0x12b240){if(_['isObjectLike'](_0x12b240)){this[_0x35d2('0x5')](_0x35d2('0x6'),JSON[_0x35d2('0x7')](_0x12b240));}else if(_['isString'](_0x12b240)){this['setDataValue'](_0x35d2('0x6'),_0x12b240);}else{this[_0x35d2('0x5')](_0x35d2('0x6'),util[_0x35d2('0x8')](_0x35d2('0x9'),this[_0x35d2('0xa')](_0x35d2('0xb'))||'',this[_0x35d2('0xa')](_0x35d2('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x35d2('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x35d2('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index a15e62d..a63f3ac 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 _0x6ea1=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','get','Projects','UserProfileResource','destroy','error','name','index','map','JscriptyProject','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','clone','length','omit','createdAt','updatedAt','body','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','JscriptySessionReport','findOne','JscriptyAnswerReport','ProjectId','findAll','fromCharCode','toString','indexOf','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ea1,0x1c2));var _0x16ea=function(_0x524620,_0x3c2653){_0x524620=_0x524620-0x0;var _0x2ac245=_0x6ea1[_0x524620];return _0x2ac245;};'use strict';var emlformat=require(_0x16ea('0x0'));var rimraf=require(_0x16ea('0x1'));var zipdir=require(_0x16ea('0x2'));var jsonpatch=require(_0x16ea('0x3'));var rp=require(_0x16ea('0x4'));var moment=require(_0x16ea('0x5'));var BPromise=require(_0x16ea('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x16ea('0x7'));var sox=require(_0x16ea('0x8'));var csv=require('to-csv');var ejs=require(_0x16ea('0x9'));var fs=require('fs');var fs_extra=require(_0x16ea('0xa'));var _=require(_0x16ea('0xb'));var squel=require(_0x16ea('0xc'));var crypto=require(_0x16ea('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x16ea('0xe'));var toCsv=require(_0x16ea('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x16ea('0x10'));var authService=require(_0x16ea('0x11'));var qs=require(_0x16ea('0x12'));var as=require(_0x16ea('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x16ea('0x14'))(_0x16ea('0x15'));var utils=require('../../config/utils');var config=require(_0x16ea('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x16ea('0x17'))['db'];function respondWithStatusCode(_0x2d0f2d,_0x1a90e0){_0x1a90e0=_0x1a90e0||0xcc;return function(_0x1ce7eb){if(_0x1ce7eb){return _0x2d0f2d[_0x16ea('0x18')](_0x1a90e0);}return _0x2d0f2d[_0x16ea('0x19')](_0x1a90e0)[_0x16ea('0x1a')]();};}function respondWithResult(_0x22a666,_0x10c8ba){_0x10c8ba=_0x10c8ba||0xc8;return function(_0x3e0ec9){if(_0x3e0ec9){return _0x22a666['status'](_0x10c8ba)[_0x16ea('0x1b')](_0x3e0ec9);}};}function respondWithFilteredResult(_0x330073,_0x44241c){return function(_0x4a86a7){if(_0x4a86a7){var _0x53e58d=typeof _0x44241c[_0x16ea('0x1c')]===_0x16ea('0x1d')&&typeof _0x44241c['limit']===_0x16ea('0x1d');var _0x1358ee=_0x4a86a7[_0x16ea('0x1e')];var _0x3f9815=_0x53e58d?0x0:_0x44241c[_0x16ea('0x1c')];var _0xe170=_0x53e58d?_0x4a86a7[_0x16ea('0x1e')]:_0x44241c[_0x16ea('0x1c')]+_0x44241c[_0x16ea('0x1f')];var _0x2b40ad;if(_0xe170>=_0x1358ee){_0xe170=_0x1358ee;_0x2b40ad=0xc8;}else{_0x2b40ad=0xce;}_0x330073[_0x16ea('0x19')](_0x2b40ad);return _0x330073[_0x16ea('0x20')](_0x16ea('0x21'),_0x3f9815+'-'+_0xe170+'/'+_0x1358ee)['json'](_0x4a86a7);}return null;};}function patchUpdates(_0x3842f6){return function(_0x4e016b){try{jsonpatch[_0x16ea('0x22')](_0x4e016b,_0x3842f6,!![]);}catch(_0x4b999a){return BPromise['reject'](_0x4b999a);}return _0x4e016b[_0x16ea('0x23')]();};}function saveUpdates(_0x5e0c43,_0x52caed){return function(_0x2bb93d){if(_0x2bb93d){return _0x2bb93d[_0x16ea('0x24')](_0x5e0c43)[_0x16ea('0x25')](function(_0x1068b6){return _0x1068b6;});}return null;};}function removeEntity(_0x62a7d3,_0x2074b0){return function(_0x1f500c){if(_0x1f500c){return _0x1f500c['destroy']()[_0x16ea('0x25')](function(){var _0x5c03bf=_0x1f500c[_0x16ea('0x26')]({'plain':!![]});var _0x45e599=_0x16ea('0x27');return db[_0x16ea('0x28')][_0x16ea('0x29')]({'where':{'type':_0x45e599,'resourceId':_0x5c03bf['id']}})[_0x16ea('0x25')](function(){return _0x1f500c;});})['then'](function(){_0x62a7d3[_0x16ea('0x19')](0xcc)[_0x16ea('0x1a')]();});}};}function handleEntityNotFound(_0x350431,_0x3c0bb4){return function(_0x318823){if(!_0x318823){_0x350431[_0x16ea('0x18')](0x194);}return _0x318823;};}function handleError(_0x1105f3,_0x10101f){_0x10101f=_0x10101f||0x1f4;return function(_0x350cf7){logger[_0x16ea('0x2a')](_0x350cf7['stack']);if(_0x350cf7[_0x16ea('0x2b')]){delete _0x350cf7[_0x16ea('0x2b')];}_0x1105f3[_0x16ea('0x19')](_0x10101f)['send'](_0x350cf7);};}exports[_0x16ea('0x2c')]=function(_0x5ad1ab,_0x1ac6da){var _0x27924c={},_0x14d973={},_0x15362d={'count':0x0,'rows':[]};var _0x5dd8be=_[_0x16ea('0x2d')](db[_0x16ea('0x2e')]['rawAttributes'],function(_0x4f22d0){return{'name':_0x4f22d0['fieldName'],'type':_0x4f22d0[_0x16ea('0x2f')][_0x16ea('0x30')]};});_0x14d973[_0x16ea('0x31')]=_[_0x16ea('0x2d')](_0x5dd8be,_0x16ea('0x2b'));_0x14d973['query']=_[_0x16ea('0x32')](_0x5ad1ab[_0x16ea('0x33')]);_0x14d973[_0x16ea('0x34')]=_[_0x16ea('0x35')](_0x14d973[_0x16ea('0x31')],_0x14d973[_0x16ea('0x33')]);_0x27924c[_0x16ea('0x36')]=_[_0x16ea('0x35')](_0x14d973[_0x16ea('0x31')],qs[_0x16ea('0x37')](_0x5ad1ab[_0x16ea('0x33')][_0x16ea('0x37')]));_0x27924c[_0x16ea('0x36')]=_0x27924c[_0x16ea('0x36')]['length']?_0x27924c['attributes']:_0x14d973[_0x16ea('0x31')];if(!_0x5ad1ab[_0x16ea('0x33')][_0x16ea('0x38')](_0x16ea('0x39'))){_0x27924c[_0x16ea('0x1f')]=qs['limit'](_0x5ad1ab[_0x16ea('0x33')][_0x16ea('0x1f')]);_0x27924c[_0x16ea('0x1c')]=qs['offset'](_0x5ad1ab[_0x16ea('0x33')][_0x16ea('0x1c')]);}_0x27924c[_0x16ea('0x3a')]=qs['sort'](_0x5ad1ab['query'][_0x16ea('0x3b')]);_0x27924c['where']=qs[_0x16ea('0x34')](_[_0x16ea('0x3c')](_0x5ad1ab[_0x16ea('0x33')],_0x14d973[_0x16ea('0x34')]),_0x5dd8be);if(_0x5ad1ab[_0x16ea('0x33')][_0x16ea('0x3d')]){_0x27924c[_0x16ea('0x3e')]=_[_0x16ea('0x3f')](_0x27924c[_0x16ea('0x3e')],{'$or':_['map'](_0x5dd8be,function(_0x376431){if(_0x376431[_0x16ea('0x2f')]!=='VIRTUAL'){var _0xafa15={};_0xafa15[_0x376431[_0x16ea('0x2b')]]={'$like':'%'+_0x5ad1ab['query'][_0x16ea('0x3d')]+'%'};return _0xafa15;}})});}_0x27924c=_[_0x16ea('0x3f')]({},_0x27924c,_0x5ad1ab[_0x16ea('0x40')]);var _0x42b26f={'where':_0x27924c[_0x16ea('0x3e')]};return db[_0x16ea('0x2e')][_0x16ea('0x1e')](_0x42b26f)[_0x16ea('0x25')](function(_0x1e4fee){_0x15362d['count']=_0x1e4fee;if(_0x5ad1ab[_0x16ea('0x33')][_0x16ea('0x41')]){_0x27924c[_0x16ea('0x42')]=[{'all':!![]}];}return db[_0x16ea('0x2e')]['findAll'](_0x27924c);})[_0x16ea('0x25')](function(_0x4d38f9){_0x15362d[_0x16ea('0x43')]=_0x4d38f9;return _0x15362d;})[_0x16ea('0x25')](respondWithFilteredResult(_0x1ac6da,_0x27924c))[_0x16ea('0x44')](handleError(_0x1ac6da,null));};exports[_0x16ea('0x45')]=function(_0x54a391,_0x26095b){var _0x3fc9d3={'raw':![],'where':{'id':_0x54a391[_0x16ea('0x46')]['id']}},_0x187d4e={};_0x187d4e[_0x16ea('0x31')]=_['keys'](db['JscriptyProject'][_0x16ea('0x47')]);_0x187d4e[_0x16ea('0x33')]=_[_0x16ea('0x32')](_0x54a391[_0x16ea('0x33')]);_0x187d4e[_0x16ea('0x34')]=_['intersection'](_0x187d4e[_0x16ea('0x31')],_0x187d4e[_0x16ea('0x33')]);_0x3fc9d3[_0x16ea('0x36')]=_[_0x16ea('0x35')](_0x187d4e[_0x16ea('0x31')],qs[_0x16ea('0x37')](_0x54a391[_0x16ea('0x33')][_0x16ea('0x37')]));_0x3fc9d3['attributes']=_0x3fc9d3[_0x16ea('0x36')]['length']?_0x3fc9d3['attributes']:_0x187d4e[_0x16ea('0x31')];if(_0x54a391['query']['includeAll']){_0x3fc9d3[_0x16ea('0x42')]=[{'all':!![]}];}_0x3fc9d3=_[_0x16ea('0x3f')]({},_0x3fc9d3,_0x54a391[_0x16ea('0x40')]);return db[_0x16ea('0x2e')][_0x16ea('0x48')](_0x3fc9d3)[_0x16ea('0x25')](handleEntityNotFound(_0x26095b,null))[_0x16ea('0x25')](respondWithResult(_0x26095b,null))[_0x16ea('0x44')](handleError(_0x26095b,null));};exports[_0x16ea('0x49')]=function(_0x5ee4e0,_0x184fc7){return db[_0x16ea('0x2e')][_0x16ea('0x49')](_0x5ee4e0['body'],{})[_0x16ea('0x25')](function(_0x7de6cf){var _0xa8a6a=_0x5ee4e0[_0x16ea('0x4a')][_0x16ea('0x26')]({'plain':!![]});if(!_0xa8a6a)throw new Error(_0x16ea('0x4b'));if(_0xa8a6a[_0x16ea('0x4c')]===_0x16ea('0x4a')){var _0x509477=_0x7de6cf[_0x16ea('0x26')]({'plain':!![]});var _0x38ac2d=_0x16ea('0x27');return db[_0x16ea('0x4d')][_0x16ea('0x48')]({'where':{'name':_0x38ac2d,'userProfileId':_0xa8a6a['userProfileId']},'raw':!![]})[_0x16ea('0x25')](function(_0x38b679){if(_0x38b679&&_0x38b679[_0x16ea('0x4e')]===0x0){return db['UserProfileResource'][_0x16ea('0x49')]({'name':_0x509477[_0x16ea('0x2b')],'resourceId':_0x509477['id'],'type':_0x38b679['name'],'sectionId':_0x38b679['id']},{})[_0x16ea('0x25')](function(){return _0x7de6cf;});}else{return _0x7de6cf;}})[_0x16ea('0x44')](function(_0x264d16){logger[_0x16ea('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x264d16);throw _0x264d16;});}return _0x7de6cf;})['then'](respondWithResult(_0x184fc7,0xc9))[_0x16ea('0x44')](handleError(_0x184fc7,null));};exports[_0x16ea('0x4f')]=function(_0x165082,_0x300965){var _0x17b713={'where':{'id':_0x165082[_0x16ea('0x46')]['id']}},_0x325cbf={};_0x325cbf[_0x16ea('0x31')]=_['keys'](db[_0x16ea('0x2e')][_0x16ea('0x47')]);_0x17b713[_0x16ea('0x36')]=_['intersection'](_0x325cbf['model'],qs[_0x16ea('0x37')](_0x165082[_0x16ea('0x33')][_0x16ea('0x37')]));_0x17b713['attributes']=_0x17b713['attributes'][_0x16ea('0x50')]?_0x17b713['attributes']:_0x325cbf['model'];if(_0x165082[_0x16ea('0x33')][_0x16ea('0x41')]){_0x17b713[_0x16ea('0x42')]=[{'all':!![]}];}_0x17b713=_[_0x16ea('0x3f')]({},_0x17b713,_0x165082[_0x16ea('0x40')]);return db['JscriptyProject'][_0x16ea('0x48')](_0x17b713)[_0x16ea('0x25')](handleEntityNotFound(_0x300965,null))[_0x16ea('0x25')](function(_0x1a6abb){if(_0x1a6abb){var _0xd1f77d=_0x1a6abb[_0x16ea('0x26')]({'plain':!![]});_0xd1f77d=qs[_0x16ea('0x51')](_0xd1f77d,['id',_0x16ea('0x52'),_0x16ea('0x53')]);_0x165082['body']=_[_0x16ea('0x51')](_0x165082[_0x16ea('0x54')],['id','createdAt','updatedAt']);return db[_0x16ea('0x2e')][_0x16ea('0x49')](_['merge'](_0xd1f77d,_0x165082[_0x16ea('0x54')]),{'include':_0x165082[_0x16ea('0x33')][_0x16ea('0x41')]?[{'all':!![]}]:undefined})[_0x16ea('0x25')](function(_0xeb40c3){var _0x558a32=_0x165082[_0x16ea('0x4a')][_0x16ea('0x26')]({'plain':!![]});if(!_0x558a32)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x558a32[_0x16ea('0x4c')]===_0x16ea('0x4a')){var _0x481f48=_0xeb40c3[_0x16ea('0x26')]({'plain':!![]});var _0x2fd66d=_0x16ea('0x27');return db[_0x16ea('0x4d')][_0x16ea('0x48')]({'where':{'name':_0x2fd66d,'userProfileId':_0x558a32[_0x16ea('0x55')]},'raw':!![]})[_0x16ea('0x25')](function(_0x19bd31){if(_0x19bd31&&_0x19bd31['autoAssociation']===0x0){return db['UserProfileResource'][_0x16ea('0x49')]({'name':_0x481f48[_0x16ea('0x2b')],'resourceId':_0x481f48['id'],'type':_0x19bd31[_0x16ea('0x2b')],'sectionId':_0x19bd31['id']},{})[_0x16ea('0x25')](function(){return _0xeb40c3;});}else{return _0xeb40c3;}})[_0x16ea('0x44')](function(_0x3d9af9){logger[_0x16ea('0x2a')](_0x16ea('0x56'),_0x3d9af9);throw _0x3d9af9;});}return _0xeb40c3;});}})['then'](respondWithResult(_0x300965,0xc9))[_0x16ea('0x44')](handleError(_0x300965,null));};exports[_0x16ea('0x24')]=function(_0x55aaae,_0x43aea3){if(_0x55aaae[_0x16ea('0x54')]['id']){delete _0x55aaae[_0x16ea('0x54')]['id'];}return db[_0x16ea('0x2e')][_0x16ea('0x48')]({'where':{'id':_0x55aaae[_0x16ea('0x46')]['id']}})['then'](handleEntityNotFound(_0x43aea3,null))[_0x16ea('0x25')](saveUpdates(_0x55aaae[_0x16ea('0x54')],null))[_0x16ea('0x25')](respondWithResult(_0x43aea3,null))[_0x16ea('0x44')](handleError(_0x43aea3,null));};exports[_0x16ea('0x29')]=function(_0x197ce0,_0x1e7e30){return db[_0x16ea('0x2e')][_0x16ea('0x48')]({'where':{'id':_0x197ce0[_0x16ea('0x46')]['id']}})[_0x16ea('0x25')](handleEntityNotFound(_0x1e7e30,null))['then'](removeEntity(_0x1e7e30,null))[_0x16ea('0x44')](handleError(_0x1e7e30,null));};exports['getSessions']=function(_0xa9a84a,_0x312017,_0x50942e){var _0x22c9d7={'raw':!![],'where':{}};var _0x5d77fd={};var _0x684fc9={'count':0x0,'rows':[]};return db[_0x16ea('0x2e')]['findOne']({'where':{'id':_0xa9a84a[_0x16ea('0x46')]['id']}})[_0x16ea('0x25')](handleEntityNotFound(_0x312017,null))[_0x16ea('0x25')](function(_0x1e806f){if(_0x1e806f){_0x5d77fd[_0x16ea('0x31')]=_[_0x16ea('0x32')](db[_0x16ea('0x57')][_0x16ea('0x47')]);_0x5d77fd[_0x16ea('0x33')]=_[_0x16ea('0x32')](_0xa9a84a[_0x16ea('0x33')]);_0x5d77fd['filters']=_['intersection'](_0x5d77fd[_0x16ea('0x31')],_0x5d77fd['query']);_0x22c9d7[_0x16ea('0x36')]=_[_0x16ea('0x35')](_0x5d77fd[_0x16ea('0x31')],qs[_0x16ea('0x37')](_0xa9a84a['query'][_0x16ea('0x37')]));_0x22c9d7['attributes']=_0x22c9d7['attributes'][_0x16ea('0x50')]?_0x22c9d7[_0x16ea('0x36')]:_0x5d77fd[_0x16ea('0x31')];if(!_0xa9a84a[_0x16ea('0x33')][_0x16ea('0x38')](_0x16ea('0x39'))){_0x22c9d7[_0x16ea('0x1f')]=qs[_0x16ea('0x1f')](_0xa9a84a[_0x16ea('0x33')][_0x16ea('0x1f')]);_0x22c9d7['offset']=qs['offset'](_0xa9a84a[_0x16ea('0x33')][_0x16ea('0x1c')]);}_0x22c9d7['order']=qs[_0x16ea('0x3b')](_0xa9a84a[_0x16ea('0x33')][_0x16ea('0x3b')]);_0x22c9d7[_0x16ea('0x3e')]=qs[_0x16ea('0x34')](_['pick'](_0xa9a84a[_0x16ea('0x33')],_0x5d77fd['filters']));_0x22c9d7[_0x16ea('0x3e')]['ProjectId']=_0x1e806f['id'];if(_0xa9a84a[_0x16ea('0x33')][_0x16ea('0x3d')]){_0x22c9d7[_0x16ea('0x3e')]=_[_0x16ea('0x3f')](_0x22c9d7[_0x16ea('0x3e')],{'$or':_[_0x16ea('0x2d')](_0x22c9d7[_0x16ea('0x36')],function(_0x19b8b8){var _0x235a04={};_0x235a04[_0x19b8b8]={'$like':'%'+_0xa9a84a[_0x16ea('0x33')][_0x16ea('0x3d')]+'%'};return _0x235a04;})});}_0x22c9d7=_[_0x16ea('0x3f')]({},_0x22c9d7,_0xa9a84a[_0x16ea('0x40')]);return db[_0x16ea('0x57')][_0x16ea('0x1e')]({'where':_0x22c9d7[_0x16ea('0x3e')]})['then'](function(_0x2af851){_0x684fc9[_0x16ea('0x1e')]=_0x2af851;if(_0xa9a84a[_0x16ea('0x33')][_0x16ea('0x41')]){_0x22c9d7[_0x16ea('0x42')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x22c9d7);})['then'](function(_0x50dbe4){_0x684fc9[_0x16ea('0x43')]=_0x50dbe4;return _0x684fc9;});}})['then'](respondWithFilteredResult(_0x312017,_0x22c9d7))['catch'](handleError(_0x312017,null));};exports['getAnswers']=function(_0x2094a6,_0x52a06d,_0x50b5a9){var _0x47ae24={'raw':!![],'where':{}};var _0x470292={};var _0x353ca4={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x16ea('0x58')]({'where':{'id':_0x2094a6['params']['id']}})[_0x16ea('0x25')](handleEntityNotFound(_0x52a06d,null))['then'](function(_0x422550){if(_0x422550){_0x470292[_0x16ea('0x31')]=_[_0x16ea('0x32')](db[_0x16ea('0x59')][_0x16ea('0x47')]);_0x470292[_0x16ea('0x33')]=_[_0x16ea('0x32')](_0x2094a6[_0x16ea('0x33')]);_0x470292[_0x16ea('0x34')]=_['intersection'](_0x470292['model'],_0x470292[_0x16ea('0x33')]);_0x47ae24['attributes']=_[_0x16ea('0x35')](_0x470292['model'],qs[_0x16ea('0x37')](_0x2094a6[_0x16ea('0x33')][_0x16ea('0x37')]));_0x47ae24['attributes']=_0x47ae24[_0x16ea('0x36')][_0x16ea('0x50')]?_0x47ae24[_0x16ea('0x36')]:_0x470292[_0x16ea('0x31')];if(!_0x2094a6['query']['hasOwnProperty'](_0x16ea('0x39'))){_0x47ae24[_0x16ea('0x1f')]=qs[_0x16ea('0x1f')](_0x2094a6[_0x16ea('0x33')][_0x16ea('0x1f')]);_0x47ae24[_0x16ea('0x1c')]=qs[_0x16ea('0x1c')](_0x2094a6[_0x16ea('0x33')][_0x16ea('0x1c')]);}_0x47ae24[_0x16ea('0x3a')]=qs[_0x16ea('0x3b')](_0x2094a6[_0x16ea('0x33')][_0x16ea('0x3b')]);_0x47ae24['where']=qs[_0x16ea('0x34')](_['pick'](_0x2094a6[_0x16ea('0x33')],_0x470292[_0x16ea('0x34')]));_0x47ae24[_0x16ea('0x3e')][_0x16ea('0x5a')]=_0x422550['id'];if(_0x2094a6[_0x16ea('0x33')][_0x16ea('0x3d')]){_0x47ae24[_0x16ea('0x3e')]=_[_0x16ea('0x3f')](_0x47ae24[_0x16ea('0x3e')],{'$or':_['map'](_0x47ae24[_0x16ea('0x36')],function(_0x4f3153){var _0x39c8c4={};_0x39c8c4[_0x4f3153]={'$like':'%'+_0x2094a6[_0x16ea('0x33')][_0x16ea('0x3d')]+'%'};return _0x39c8c4;})});}_0x47ae24=_[_0x16ea('0x3f')]({},_0x47ae24,_0x2094a6[_0x16ea('0x40')]);return db['JscriptyAnswerReport'][_0x16ea('0x1e')]({'where':_0x47ae24[_0x16ea('0x3e')]})[_0x16ea('0x25')](function(_0x3c6f6f){_0x353ca4['count']=_0x3c6f6f;if(_0x2094a6[_0x16ea('0x33')][_0x16ea('0x41')]){_0x47ae24[_0x16ea('0x42')]=[{'all':!![]}];}return db[_0x16ea('0x59')][_0x16ea('0x5b')](_0x47ae24);})[_0x16ea('0x25')](function(_0x17b1b3){_0x353ca4[_0x16ea('0x43')]=_0x17b1b3;return _0x353ca4;});}})['then'](respondWithFilteredResult(_0x52a06d,_0x47ae24))[_0x16ea('0x44')](handleError(_0x52a06d,null));};function char(_0x12a780){return'number'===typeof _0x12a780?String[_0x16ea('0x5c')][_0x16ea('0x22')](null,arguments):_0x12a780;}function needsEncapsulation(_0x8863aa){return!!_0x8863aa&&(_0x8863aa[_0x16ea('0x5d')]()[_0x16ea('0x5e')](char(0xd))>=0x0||_0x8863aa[_0x16ea('0x5d')]()[_0x16ea('0x5e')](char(0xa))>=0x0||_0x8863aa[_0x16ea('0x5d')]()[_0x16ea('0x5e')](char(0x2c))>=0x0||_0x8863aa['toString']()[_0x16ea('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x16c0ce){var _0x3ed60e=char(0x22),_0xf7e19b='\x5c'+char(0x22),_0xc6a179=_0x16c0ce['toString']()['replace'](new RegExp(_0x3ed60e,'g'),_0xf7e19b);return _0x3ed60e+_0xc6a179+_0x3ed60e;}exports['getSummary']=function(_0x389a3e,_0x49dcf6,_0x2febb6){var _0x12409d,_0x5e1103;var _0x5716d1={'where':{'ProjectId':_0x389a3e['params']['id']}};if(_0x389a3e[_0x16ea('0x33')][_0x16ea('0x5f')]){_0x5716d1[_0x16ea('0x3e')][_0x16ea('0x60')]=JSON[_0x16ea('0x61')](_0x389a3e[_0x16ea('0x33')][_0x16ea('0x5f')]);}return db['JscriptySessionReport'][_0x16ea('0x5b')](_0x5716d1)[_0x16ea('0x25')](handleEntityNotFound(_0x49dcf6,null))['then'](function(_0x13f5af){if(_0x13f5af){_0x12409d=_0x13f5af;return db[_0x16ea('0x62')][_0x16ea('0x5b')]({'where':{'SessionId':{'$in':_[_0x16ea('0x2d')](_0x12409d,'id')},'ProjectId':_0x389a3e[_0x16ea('0x46')]['id']},'order':_0x16ea('0x63')});}})[_0x16ea('0x25')](handleEntityNotFound(_0x49dcf6,null))[_0x16ea('0x25')](function(_0xd18dfb){if(_0xd18dfb){_0x5e1103=_0xd18dfb;var _0x4bc1eb={};for(var _0x46d6cb=0x0,_0x20d868=_0x5e1103[_0x16ea('0x50')];_0x46d6cb<_0x20d868;_0x46d6cb++){if(!_0x4bc1eb[_0x16ea('0x38')](_0x5e1103[_0x46d6cb][_0x16ea('0x64')])){_0x4bc1eb[_0x5e1103[_0x46d6cb]['questionId']]=needsEncapsulation(_0x5e1103[_0x46d6cb][_0x16ea('0x65')])?encapsulate(_0x5e1103[_0x46d6cb][_0x16ea('0x65')]):_0x5e1103[_0x46d6cb]['question'];}}var _0x2d2e6d=[],_0x239661={};for(var _0x5915bb=0x0,_0x18fe03=_0x12409d[_0x16ea('0x50')];_0x5915bb<_0x18fe03;_0x5915bb++){_0x239661={'ProjectId':_0x389a3e[_0x16ea('0x46')]['id'],'SessionId':_0x12409d[_0x5915bb]['id'],'StartTime':moment(_0x12409d[_0x5915bb][_0x16ea('0x60')])[_0x16ea('0x66')](_0x16ea('0x67'))};for(var _0x59a9d2=0x0,_0x1cc16d=_0x5e1103['length'];_0x59a9d2<_0x1cc16d;_0x59a9d2++){if(_0x5e1103[_0x59a9d2][_0x16ea('0x68')]==_0x12409d[_0x5915bb]['id']&&_0x4bc1eb['hasOwnProperty'](_0x5e1103[_0x59a9d2][_0x16ea('0x64')])){_0x239661[_0x4bc1eb[_0x5e1103[_0x59a9d2][_0x16ea('0x64')]]]=_0x5e1103[_0x59a9d2][_0x16ea('0x69')];}}for(var _0x5e3310 in _0x4bc1eb){if(!_0x239661['hasOwnProperty'](_0x4bc1eb[_0x5e3310])){_0x239661[_0x4bc1eb[_0x5e3310]]=null;}}_0x2d2e6d[_0x16ea('0x6a')](_0x239661);}return _0x2d2e6d;}})[_0x16ea('0x25')](function(_0x3cf66f){if(!_[_0x16ea('0x6b')](_0x3cf66f)){var _0x8761eb=toCsv(_0x3cf66f);var _0x47f154=Date[_0x16ea('0x6c')]();fs[_0x16ea('0x6d')](util['format'](_0x16ea('0x6e'),_0x389a3e[_0x16ea('0x46')]['id'],_0x47f154),_0x8761eb);_0x49dcf6[_0x16ea('0x6f')](_0x16ea('0x70'),_0x16ea('0x71')+util[_0x16ea('0x66')](_0x16ea('0x72'),_0x389a3e[_0x16ea('0x46')]['id'],_0x47f154));_0x49dcf6[_0x16ea('0x6f')]('Content-type',_0x16ea('0x73'));return _0x49dcf6[_0x16ea('0x74')](util[_0x16ea('0x66')](_0x16ea('0x6e'),_0x389a3e['params']['id'],_0x47f154));}else{return _0x49dcf6[_0x16ea('0x18')](0xcc);}})[_0x16ea('0x44')](handleError(_0x49dcf6,null));}; \ No newline at end of file +var _0x13ea=['nolimit','order','sort','pick','filter','where','merge','VIRTUAL','name','include','findAll','rows','catch','show','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','params','length','find','get','omit','updatedAt','createdAt','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','ProjectId','options','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','toString','indexOf','getSummary','startTime','-createdAt','questionId','question','starttime','format','SessionId','answer','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','Projects','UserProfileResource','destroy','sendStatus','error','stack','send','index','map','JscriptyProject','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13ea,0xa9));var _0xa13e=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0x13ea[_0x1ee351];return _0x245aaf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa13e('0x0'));var jsonpatch=require(_0xa13e('0x1'));var rp=require(_0xa13e('0x2'));var moment=require('moment');var BPromise=require(_0xa13e('0x3'));var Mustache=require('mustache');var util=require(_0xa13e('0x4'));var path=require('path');var sox=require(_0xa13e('0x5'));var csv=require(_0xa13e('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa13e('0x7'));var jsforce=require(_0xa13e('0x8'));var deskjs=require(_0xa13e('0x9'));var toCsv=require('to-csv');var querystring=require(_0xa13e('0xa'));var Papa=require(_0xa13e('0xb'));var Redis=require(_0xa13e('0xc'));var authService=require(_0xa13e('0xd'));var qs=require(_0xa13e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa13e('0xf'));var logger=require(_0xa13e('0x10'))(_0xa13e('0x11'));var utils=require(_0xa13e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa13e('0x13'));var db=require(_0xa13e('0x14'))['db'];function respondWithStatusCode(_0x17a949,_0x39fa45){_0x39fa45=_0x39fa45||0xcc;return function(_0x423688){if(_0x423688){return _0x17a949['sendStatus'](_0x39fa45);}return _0x17a949[_0xa13e('0x15')](_0x39fa45)[_0xa13e('0x16')]();};}function respondWithResult(_0x57ec24,_0x493010){_0x493010=_0x493010||0xc8;return function(_0xd9c8a8){if(_0xd9c8a8){return _0x57ec24['status'](_0x493010)[_0xa13e('0x17')](_0xd9c8a8);}};}function respondWithFilteredResult(_0x513019,_0x112321){return function(_0x243ce5){if(_0x243ce5){var _0x1c5b14=typeof _0x112321[_0xa13e('0x18')]===_0xa13e('0x19')&&typeof _0x112321['limit']===_0xa13e('0x19');var _0x193d4a=_0x243ce5[_0xa13e('0x1a')];var _0x4f8af2=_0x1c5b14?0x0:_0x112321[_0xa13e('0x18')];var _0x36acb8=_0x1c5b14?_0x243ce5['count']:_0x112321[_0xa13e('0x18')]+_0x112321[_0xa13e('0x1b')];var _0x441df6;if(_0x36acb8>=_0x193d4a){_0x36acb8=_0x193d4a;_0x441df6=0xc8;}else{_0x441df6=0xce;}_0x513019[_0xa13e('0x15')](_0x441df6);return _0x513019['set'](_0xa13e('0x1c'),_0x4f8af2+'-'+_0x36acb8+'/'+_0x193d4a)[_0xa13e('0x17')](_0x243ce5);}return null;};}function patchUpdates(_0x24b13a){return function(_0x321cd3){try{jsonpatch[_0xa13e('0x1d')](_0x321cd3,_0x24b13a,!![]);}catch(_0x30f4e5){return BPromise['reject'](_0x30f4e5);}return _0x321cd3[_0xa13e('0x1e')]();};}function saveUpdates(_0x1eeacc,_0x498081){return function(_0x5136be){if(_0x5136be){return _0x5136be[_0xa13e('0x1f')](_0x1eeacc)[_0xa13e('0x20')](function(_0x359dd7){return _0x359dd7;});}return null;};}function removeEntity(_0x1932bd,_0x213000){return function(_0x2dc21b){if(_0x2dc21b){return _0x2dc21b['destroy']()[_0xa13e('0x20')](function(){var _0x364e70=_0x2dc21b['get']({'plain':!![]});var _0x1dd290=_0xa13e('0x21');return db[_0xa13e('0x22')][_0xa13e('0x23')]({'where':{'type':_0x1dd290,'resourceId':_0x364e70['id']}})[_0xa13e('0x20')](function(){return _0x2dc21b;});})[_0xa13e('0x20')](function(){_0x1932bd[_0xa13e('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21c2b6,_0x416433){return function(_0x380f6b){if(!_0x380f6b){_0x21c2b6[_0xa13e('0x24')](0x194);}return _0x380f6b;};}function handleError(_0x4e8405,_0x643ce7){_0x643ce7=_0x643ce7||0x1f4;return function(_0x30814a){logger[_0xa13e('0x25')](_0x30814a[_0xa13e('0x26')]);if(_0x30814a['name']){delete _0x30814a['name'];}_0x4e8405[_0xa13e('0x15')](_0x643ce7)[_0xa13e('0x27')](_0x30814a);};}exports[_0xa13e('0x28')]=function(_0x5af83d,_0x133694){var _0x2d1a4d={},_0x5b919d={},_0x1a61a8={'count':0x0,'rows':[]};var _0x11bf12=_[_0xa13e('0x29')](db[_0xa13e('0x2a')][_0xa13e('0x2b')],function(_0x2bfd0b){return{'name':_0x2bfd0b['fieldName'],'type':_0x2bfd0b[_0xa13e('0x2c')][_0xa13e('0x2d')]};});_0x5b919d[_0xa13e('0x2e')]=_['map'](_0x11bf12,'name');_0x5b919d[_0xa13e('0x2f')]=_['keys'](_0x5af83d['query']);_0x5b919d[_0xa13e('0x30')]=_[_0xa13e('0x31')](_0x5b919d['model'],_0x5b919d['query']);_0x2d1a4d[_0xa13e('0x32')]=_[_0xa13e('0x31')](_0x5b919d[_0xa13e('0x2e')],qs[_0xa13e('0x33')](_0x5af83d['query']['fields']));_0x2d1a4d[_0xa13e('0x32')]=_0x2d1a4d['attributes']['length']?_0x2d1a4d[_0xa13e('0x32')]:_0x5b919d[_0xa13e('0x2e')];if(!_0x5af83d[_0xa13e('0x2f')][_0xa13e('0x34')](_0xa13e('0x35'))){_0x2d1a4d[_0xa13e('0x1b')]=qs['limit'](_0x5af83d[_0xa13e('0x2f')][_0xa13e('0x1b')]);_0x2d1a4d['offset']=qs[_0xa13e('0x18')](_0x5af83d[_0xa13e('0x2f')]['offset']);}_0x2d1a4d[_0xa13e('0x36')]=qs[_0xa13e('0x37')](_0x5af83d[_0xa13e('0x2f')][_0xa13e('0x37')]);_0x2d1a4d['where']=qs[_0xa13e('0x30')](_[_0xa13e('0x38')](_0x5af83d['query'],_0x5b919d[_0xa13e('0x30')]),_0x11bf12);if(_0x5af83d[_0xa13e('0x2f')][_0xa13e('0x39')]){_0x2d1a4d[_0xa13e('0x3a')]=_[_0xa13e('0x3b')](_0x2d1a4d['where'],{'$or':_[_0xa13e('0x29')](_0x11bf12,function(_0x1f41b1){if(_0x1f41b1['type']!==_0xa13e('0x3c')){var _0x2ed1eb={};_0x2ed1eb[_0x1f41b1[_0xa13e('0x3d')]]={'$like':'%'+_0x5af83d['query'][_0xa13e('0x39')]+'%'};return _0x2ed1eb;}})});}_0x2d1a4d=_[_0xa13e('0x3b')]({},_0x2d1a4d,_0x5af83d['options']);var _0x2b0834={'where':_0x2d1a4d[_0xa13e('0x3a')]};return db[_0xa13e('0x2a')][_0xa13e('0x1a')](_0x2b0834)[_0xa13e('0x20')](function(_0x1a66aa){_0x1a61a8[_0xa13e('0x1a')]=_0x1a66aa;if(_0x5af83d[_0xa13e('0x2f')]['includeAll']){_0x2d1a4d[_0xa13e('0x3e')]=[{'all':!![]}];}return db['JscriptyProject'][_0xa13e('0x3f')](_0x2d1a4d);})['then'](function(_0x4e23fc){_0x1a61a8[_0xa13e('0x40')]=_0x4e23fc;return _0x1a61a8;})[_0xa13e('0x20')](respondWithFilteredResult(_0x133694,_0x2d1a4d))[_0xa13e('0x41')](handleError(_0x133694,null));};exports[_0xa13e('0x42')]=function(_0xa5d7c5,_0x589051){var _0x3fc3d7={'raw':![],'where':{'id':_0xa5d7c5['params']['id']}},_0x19f127={};_0x19f127[_0xa13e('0x2e')]=_[_0xa13e('0x43')](db['JscriptyProject'][_0xa13e('0x2b')]);_0x19f127[_0xa13e('0x2f')]=_[_0xa13e('0x43')](_0xa5d7c5[_0xa13e('0x2f')]);_0x19f127['filters']=_[_0xa13e('0x31')](_0x19f127[_0xa13e('0x2e')],_0x19f127['query']);_0x3fc3d7['attributes']=_[_0xa13e('0x31')](_0x19f127[_0xa13e('0x2e')],qs[_0xa13e('0x33')](_0xa5d7c5[_0xa13e('0x2f')][_0xa13e('0x33')]));_0x3fc3d7[_0xa13e('0x32')]=_0x3fc3d7[_0xa13e('0x32')]['length']?_0x3fc3d7['attributes']:_0x19f127[_0xa13e('0x2e')];if(_0xa5d7c5[_0xa13e('0x2f')][_0xa13e('0x44')]){_0x3fc3d7[_0xa13e('0x3e')]=[{'all':!![]}];}_0x3fc3d7=_[_0xa13e('0x3b')]({},_0x3fc3d7,_0xa5d7c5['options']);return db['JscriptyProject']['find'](_0x3fc3d7)['then'](handleEntityNotFound(_0x589051,null))[_0xa13e('0x20')](respondWithResult(_0x589051,null))[_0xa13e('0x41')](handleError(_0x589051,null));};exports[_0xa13e('0x45')]=function(_0x1522b6,_0x2762d4){return db[_0xa13e('0x2a')][_0xa13e('0x45')](_0x1522b6[_0xa13e('0x46')],{})['then'](function(_0x49ea7b){var _0x58c8cc=_0x1522b6[_0xa13e('0x47')]['get']({'plain':!![]});if(!_0x58c8cc)throw new Error(_0xa13e('0x48'));if(_0x58c8cc['role']===_0xa13e('0x47')){var _0x7f3666=_0x49ea7b['get']({'plain':!![]});var _0x4d11d5=_0xa13e('0x21');return db[_0xa13e('0x49')]['find']({'where':{'name':_0x4d11d5,'userProfileId':_0x58c8cc[_0xa13e('0x4a')]},'raw':!![]})[_0xa13e('0x20')](function(_0x33431f){if(_0x33431f&&_0x33431f['autoAssociation']===0x0){return db['UserProfileResource'][_0xa13e('0x45')]({'name':_0x7f3666['name'],'resourceId':_0x7f3666['id'],'type':_0x33431f[_0xa13e('0x3d')],'sectionId':_0x33431f['id']},{})[_0xa13e('0x20')](function(){return _0x49ea7b;});}else{return _0x49ea7b;}})[_0xa13e('0x41')](function(_0x1c2726){logger[_0xa13e('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c2726);throw _0x1c2726;});}return _0x49ea7b;})[_0xa13e('0x20')](respondWithResult(_0x2762d4,0xc9))[_0xa13e('0x41')](handleError(_0x2762d4,null));};exports['clone']=function(_0x3d7f44,_0x437c68){var _0x4f5a6b={'where':{'id':_0x3d7f44[_0xa13e('0x4b')]['id']}},_0x255ba1={};_0x255ba1[_0xa13e('0x2e')]=_[_0xa13e('0x43')](db[_0xa13e('0x2a')][_0xa13e('0x2b')]);_0x4f5a6b['attributes']=_[_0xa13e('0x31')](_0x255ba1[_0xa13e('0x2e')],qs[_0xa13e('0x33')](_0x3d7f44[_0xa13e('0x2f')][_0xa13e('0x33')]));_0x4f5a6b[_0xa13e('0x32')]=_0x4f5a6b[_0xa13e('0x32')][_0xa13e('0x4c')]?_0x4f5a6b[_0xa13e('0x32')]:_0x255ba1[_0xa13e('0x2e')];if(_0x3d7f44[_0xa13e('0x2f')][_0xa13e('0x44')]){_0x4f5a6b['include']=[{'all':!![]}];}_0x4f5a6b=_[_0xa13e('0x3b')]({},_0x4f5a6b,_0x3d7f44['options']);return db[_0xa13e('0x2a')][_0xa13e('0x4d')](_0x4f5a6b)[_0xa13e('0x20')](handleEntityNotFound(_0x437c68,null))[_0xa13e('0x20')](function(_0x2b598d){if(_0x2b598d){var _0x47870e=_0x2b598d[_0xa13e('0x4e')]({'plain':!![]});_0x47870e=qs[_0xa13e('0x4f')](_0x47870e,['id','createdAt',_0xa13e('0x50')]);_0x3d7f44[_0xa13e('0x46')]=_[_0xa13e('0x4f')](_0x3d7f44[_0xa13e('0x46')],['id',_0xa13e('0x51'),'updatedAt']);return db[_0xa13e('0x2a')]['create'](_['merge'](_0x47870e,_0x3d7f44[_0xa13e('0x46')]),{'include':_0x3d7f44[_0xa13e('0x2f')][_0xa13e('0x44')]?[{'all':!![]}]:undefined})[_0xa13e('0x20')](function(_0x43e9fd){var _0x598a6a=_0x3d7f44[_0xa13e('0x47')][_0xa13e('0x4e')]({'plain':!![]});if(!_0x598a6a)throw new Error(_0xa13e('0x48'));if(_0x598a6a[_0xa13e('0x52')]===_0xa13e('0x47')){var _0x4cef03=_0x43e9fd['get']({'plain':!![]});var _0x2a291a=_0xa13e('0x21');return db['UserProfileSection'][_0xa13e('0x4d')]({'where':{'name':_0x2a291a,'userProfileId':_0x598a6a[_0xa13e('0x4a')]},'raw':!![]})[_0xa13e('0x20')](function(_0x18007a){if(_0x18007a&&_0x18007a[_0xa13e('0x53')]===0x0){return db['UserProfileResource'][_0xa13e('0x45')]({'name':_0x4cef03[_0xa13e('0x3d')],'resourceId':_0x4cef03['id'],'type':_0x18007a[_0xa13e('0x3d')],'sectionId':_0x18007a['id']},{})[_0xa13e('0x20')](function(){return _0x43e9fd;});}else{return _0x43e9fd;}})['catch'](function(_0xe918a){logger[_0xa13e('0x25')](_0xa13e('0x54'),_0xe918a);throw _0xe918a;});}return _0x43e9fd;});}})[_0xa13e('0x20')](respondWithResult(_0x437c68,0xc9))[_0xa13e('0x41')](handleError(_0x437c68,null));};exports[_0xa13e('0x1f')]=function(_0x249e41,_0x5df452){if(_0x249e41['body']['id']){delete _0x249e41[_0xa13e('0x46')]['id'];}return db['JscriptyProject'][_0xa13e('0x4d')]({'where':{'id':_0x249e41[_0xa13e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5df452,null))[_0xa13e('0x20')](saveUpdates(_0x249e41[_0xa13e('0x46')],null))[_0xa13e('0x20')](respondWithResult(_0x5df452,null))[_0xa13e('0x41')](handleError(_0x5df452,null));};exports[_0xa13e('0x23')]=function(_0x112cc2,_0x194ce4){return db[_0xa13e('0x2a')][_0xa13e('0x4d')]({'where':{'id':_0x112cc2['params']['id']}})[_0xa13e('0x20')](handleEntityNotFound(_0x194ce4,null))[_0xa13e('0x20')](removeEntity(_0x194ce4,null))[_0xa13e('0x41')](handleError(_0x194ce4,null));};exports[_0xa13e('0x55')]=function(_0x35be12,_0xab3a3c,_0x134fad){var _0x194a4c={'raw':!![],'where':{}};var _0x16dee2={};var _0x58f985={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x35be12[_0xa13e('0x4b')]['id']}})[_0xa13e('0x20')](handleEntityNotFound(_0xab3a3c,null))[_0xa13e('0x20')](function(_0x2f513e){if(_0x2f513e){_0x16dee2[_0xa13e('0x2e')]=_[_0xa13e('0x43')](db['JscriptySessionReport'][_0xa13e('0x2b')]);_0x16dee2['query']=_[_0xa13e('0x43')](_0x35be12[_0xa13e('0x2f')]);_0x16dee2[_0xa13e('0x30')]=_[_0xa13e('0x31')](_0x16dee2[_0xa13e('0x2e')],_0x16dee2[_0xa13e('0x2f')]);_0x194a4c['attributes']=_[_0xa13e('0x31')](_0x16dee2[_0xa13e('0x2e')],qs[_0xa13e('0x33')](_0x35be12[_0xa13e('0x2f')][_0xa13e('0x33')]));_0x194a4c[_0xa13e('0x32')]=_0x194a4c['attributes'][_0xa13e('0x4c')]?_0x194a4c[_0xa13e('0x32')]:_0x16dee2['model'];if(!_0x35be12[_0xa13e('0x2f')][_0xa13e('0x34')](_0xa13e('0x35'))){_0x194a4c['limit']=qs[_0xa13e('0x1b')](_0x35be12['query']['limit']);_0x194a4c[_0xa13e('0x18')]=qs[_0xa13e('0x18')](_0x35be12[_0xa13e('0x2f')][_0xa13e('0x18')]);}_0x194a4c[_0xa13e('0x36')]=qs[_0xa13e('0x37')](_0x35be12['query'][_0xa13e('0x37')]);_0x194a4c[_0xa13e('0x3a')]=qs[_0xa13e('0x30')](_[_0xa13e('0x38')](_0x35be12['query'],_0x16dee2[_0xa13e('0x30')]));_0x194a4c[_0xa13e('0x3a')][_0xa13e('0x56')]=_0x2f513e['id'];if(_0x35be12['query']['filter']){_0x194a4c['where']=_['merge'](_0x194a4c['where'],{'$or':_[_0xa13e('0x29')](_0x194a4c['attributes'],function(_0x1e29cb){var _0x3d68ac={};_0x3d68ac[_0x1e29cb]={'$like':'%'+_0x35be12[_0xa13e('0x2f')][_0xa13e('0x39')]+'%'};return _0x3d68ac;})});}_0x194a4c=_[_0xa13e('0x3b')]({},_0x194a4c,_0x35be12[_0xa13e('0x57')]);return db['JscriptySessionReport']['count']({'where':_0x194a4c['where']})[_0xa13e('0x20')](function(_0x31d4e){_0x58f985[_0xa13e('0x1a')]=_0x31d4e;if(_0x35be12[_0xa13e('0x2f')][_0xa13e('0x44')]){_0x194a4c['include']=[{'all':!![]}];}return db[_0xa13e('0x58')]['findAll'](_0x194a4c);})[_0xa13e('0x20')](function(_0x212892){_0x58f985[_0xa13e('0x40')]=_0x212892;return _0x58f985;});}})[_0xa13e('0x20')](respondWithFilteredResult(_0xab3a3c,_0x194a4c))[_0xa13e('0x41')](handleError(_0xab3a3c,null));};exports[_0xa13e('0x59')]=function(_0x1c6d0a,_0x325492,_0x20d933){var _0x391356={'raw':!![],'where':{}};var _0x2633db={};var _0x5955c0={'count':0x0,'rows':[]};return db[_0xa13e('0x2a')]['findOne']({'where':{'id':_0x1c6d0a['params']['id']}})['then'](handleEntityNotFound(_0x325492,null))[_0xa13e('0x20')](function(_0x51636d){if(_0x51636d){_0x2633db[_0xa13e('0x2e')]=_['keys'](db[_0xa13e('0x5a')][_0xa13e('0x2b')]);_0x2633db[_0xa13e('0x2f')]=_['keys'](_0x1c6d0a['query']);_0x2633db[_0xa13e('0x30')]=_[_0xa13e('0x31')](_0x2633db[_0xa13e('0x2e')],_0x2633db['query']);_0x391356[_0xa13e('0x32')]=_[_0xa13e('0x31')](_0x2633db['model'],qs[_0xa13e('0x33')](_0x1c6d0a[_0xa13e('0x2f')][_0xa13e('0x33')]));_0x391356[_0xa13e('0x32')]=_0x391356[_0xa13e('0x32')][_0xa13e('0x4c')]?_0x391356['attributes']:_0x2633db[_0xa13e('0x2e')];if(!_0x1c6d0a[_0xa13e('0x2f')][_0xa13e('0x34')](_0xa13e('0x35'))){_0x391356[_0xa13e('0x1b')]=qs[_0xa13e('0x1b')](_0x1c6d0a['query'][_0xa13e('0x1b')]);_0x391356[_0xa13e('0x18')]=qs[_0xa13e('0x18')](_0x1c6d0a[_0xa13e('0x2f')][_0xa13e('0x18')]);}_0x391356['order']=qs[_0xa13e('0x37')](_0x1c6d0a['query']['sort']);_0x391356[_0xa13e('0x3a')]=qs[_0xa13e('0x30')](_[_0xa13e('0x38')](_0x1c6d0a[_0xa13e('0x2f')],_0x2633db[_0xa13e('0x30')]));_0x391356[_0xa13e('0x3a')][_0xa13e('0x56')]=_0x51636d['id'];if(_0x1c6d0a[_0xa13e('0x2f')]['filter']){_0x391356[_0xa13e('0x3a')]=_[_0xa13e('0x3b')](_0x391356[_0xa13e('0x3a')],{'$or':_[_0xa13e('0x29')](_0x391356['attributes'],function(_0xc544c0){var _0xc1e082={};_0xc1e082[_0xc544c0]={'$like':'%'+_0x1c6d0a[_0xa13e('0x2f')][_0xa13e('0x39')]+'%'};return _0xc1e082;})});}_0x391356=_[_0xa13e('0x3b')]({},_0x391356,_0x1c6d0a[_0xa13e('0x57')]);return db[_0xa13e('0x5a')]['count']({'where':_0x391356[_0xa13e('0x3a')]})[_0xa13e('0x20')](function(_0x536b50){_0x5955c0['count']=_0x536b50;if(_0x1c6d0a[_0xa13e('0x2f')][_0xa13e('0x44')]){_0x391356['include']=[{'all':!![]}];}return db[_0xa13e('0x5a')][_0xa13e('0x3f')](_0x391356);})[_0xa13e('0x20')](function(_0x4afca5){_0x5955c0['rows']=_0x4afca5;return _0x5955c0;});}})[_0xa13e('0x20')](respondWithFilteredResult(_0x325492,_0x391356))[_0xa13e('0x41')](handleError(_0x325492,null));};function char(_0x4070cf){return _0xa13e('0x5b')===typeof _0x4070cf?String['fromCharCode'][_0xa13e('0x1d')](null,arguments):_0x4070cf;}function needsEncapsulation(_0x4ce9b9){return!!_0x4ce9b9&&(_0x4ce9b9[_0xa13e('0x5c')]()[_0xa13e('0x5d')](char(0xd))>=0x0||_0x4ce9b9[_0xa13e('0x5c')]()['indexOf'](char(0xa))>=0x0||_0x4ce9b9[_0xa13e('0x5c')]()[_0xa13e('0x5d')](char(0x2c))>=0x0||_0x4ce9b9[_0xa13e('0x5c')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x509a45){var _0x2e89c7=char(0x22),_0x4e941c='\x5c'+char(0x22),_0x44f1fc=_0x509a45[_0xa13e('0x5c')]()['replace'](new RegExp(_0x2e89c7,'g'),_0x4e941c);return _0x2e89c7+_0x44f1fc+_0x2e89c7;}exports[_0xa13e('0x5e')]=function(_0x47a029,_0x50f0eb,_0x517239){var _0xa81cd5,_0x2c1a65;var _0x4b4537={'where':{'ProjectId':_0x47a029[_0xa13e('0x4b')]['id']}};if(_0x47a029[_0xa13e('0x2f')][_0xa13e('0x5f')]){_0x4b4537[_0xa13e('0x3a')]['starttime']=JSON['parse'](_0x47a029[_0xa13e('0x2f')][_0xa13e('0x5f')]);}return db[_0xa13e('0x58')]['findAll'](_0x4b4537)['then'](handleEntityNotFound(_0x50f0eb,null))[_0xa13e('0x20')](function(_0x48cae4){if(_0x48cae4){_0xa81cd5=_0x48cae4;return db['JscriptyQuestionReport'][_0xa13e('0x3f')]({'where':{'SessionId':{'$in':_['map'](_0xa81cd5,'id')},'ProjectId':_0x47a029['params']['id']},'order':_0xa13e('0x60')});}})[_0xa13e('0x20')](handleEntityNotFound(_0x50f0eb,null))['then'](function(_0xa91fd2){if(_0xa91fd2){_0x2c1a65=_0xa91fd2;var _0x5ccc0e={};for(var _0x57c309=0x0,_0x170ea1=_0x2c1a65[_0xa13e('0x4c')];_0x57c309<_0x170ea1;_0x57c309++){if(!_0x5ccc0e[_0xa13e('0x34')](_0x2c1a65[_0x57c309][_0xa13e('0x61')])){_0x5ccc0e[_0x2c1a65[_0x57c309]['questionId']]=needsEncapsulation(_0x2c1a65[_0x57c309][_0xa13e('0x62')])?encapsulate(_0x2c1a65[_0x57c309][_0xa13e('0x62')]):_0x2c1a65[_0x57c309][_0xa13e('0x62')];}}var _0x14625d=[],_0x5d276e={};for(var _0x2eb158=0x0,_0x16395a=_0xa81cd5[_0xa13e('0x4c')];_0x2eb158<_0x16395a;_0x2eb158++){_0x5d276e={'ProjectId':_0x47a029[_0xa13e('0x4b')]['id'],'SessionId':_0xa81cd5[_0x2eb158]['id'],'StartTime':moment(_0xa81cd5[_0x2eb158][_0xa13e('0x63')])[_0xa13e('0x64')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x4cd192=0x0,_0x30d7a3=_0x2c1a65[_0xa13e('0x4c')];_0x4cd192<_0x30d7a3;_0x4cd192++){if(_0x2c1a65[_0x4cd192][_0xa13e('0x65')]==_0xa81cd5[_0x2eb158]['id']&&_0x5ccc0e['hasOwnProperty'](_0x2c1a65[_0x4cd192][_0xa13e('0x61')])){_0x5d276e[_0x5ccc0e[_0x2c1a65[_0x4cd192][_0xa13e('0x61')]]]=_0x2c1a65[_0x4cd192][_0xa13e('0x66')];}}for(var _0xfa6a95 in _0x5ccc0e){if(!_0x5d276e[_0xa13e('0x34')](_0x5ccc0e[_0xfa6a95])){_0x5d276e[_0x5ccc0e[_0xfa6a95]]=null;}}_0x14625d['push'](_0x5d276e);}return _0x14625d;}})[_0xa13e('0x20')](function(_0x5324e0){if(!_['isEmpty'](_0x5324e0)){var _0x1c351c=toCsv(_0x5324e0);var _0x2d55b5=Date[_0xa13e('0x67')]();fs[_0xa13e('0x68')](util[_0xa13e('0x64')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x47a029[_0xa13e('0x4b')]['id'],_0x2d55b5),_0x1c351c);_0x50f0eb[_0xa13e('0x69')](_0xa13e('0x6a'),_0xa13e('0x6b')+util[_0xa13e('0x64')](_0xa13e('0x6c'),_0x47a029['params']['id'],_0x2d55b5));_0x50f0eb[_0xa13e('0x69')]('Content-type',_0xa13e('0x6d'));return _0x50f0eb[_0xa13e('0x6e')](util[_0xa13e('0x64')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x47a029[_0xa13e('0x4b')]['id'],_0x2d55b5));}else{return _0x50f0eb[_0xa13e('0x24')](0xcc);}})[_0xa13e('0x41')](handleError(_0x50f0eb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 787d6b2..6e94b42 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 _0x8375=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','jscripty_projects','util','../../config/logger'];(function(_0x3db288,_0x5e7279){var _0x76b34=function(_0x1ccb1e){while(--_0x1ccb1e){_0x3db288['push'](_0x3db288['shift']());}};_0x76b34(++_0x5e7279);}(_0x8375,0x132));var _0x5837=function(_0x535460,_0x23c3f4){_0x535460=_0x535460-0x0;var _0x5f33f1=_0x8375[_0x535460];return _0x5f33f1;};'use strict';var _=require('lodash');var util=require(_0x5837('0x0'));var logger=require(_0x5837('0x1'))(_0x5837('0x2'));var moment=require(_0x5837('0x3'));var BPromise=require(_0x5837('0x4'));var rp=require(_0x5837('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5837('0x6'));var config=require(_0x5837('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0x5837('0x8')]=function(_0x438491,_0x21c9bd){return _0x438491[_0x5837('0x9')]('JscriptyProject',attributes,{'tableName':_0x5837('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f5a=['api','bluebird','request-promise','path','../../config/environment','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger'];(function(_0x3d3379,_0x4c9bc1){var _0x358633=function(_0x54510c){while(--_0x54510c){_0x3d3379['push'](_0x3d3379['shift']());}};_0x358633(++_0x4c9bc1);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x4ddcd8,_0x3104ac){_0x4ddcd8=_0x4ddcd8-0x0;var _0x4c8b3f=_0x9f5a[_0x4ddcd8];return _0x4c8b3f;};'use strict';var _=require(_0xa9f5('0x0'));var util=require(_0xa9f5('0x1'));var logger=require(_0xa9f5('0x2'))(_0xa9f5('0x3'));var moment=require('moment');var BPromise=require(_0xa9f5('0x4'));var rp=require(_0xa9f5('0x5'));var fs=require('fs');var path=require(_0xa9f5('0x6'));var rimraf=require('rimraf');var config=require(_0xa9f5('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0xa9f5('0x8')]=function(_0x219e89,_0x49e337){return _0x219e89[_0xa9f5('0x9')](_0xa9f5('0xa'),attributes,{'tableName':_0xa9f5('0xb'),'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 df47f8f..d4fc07d 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 _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x36f5ae,_0x53960b){var _0x10c86c=function(_0x597583){while(--_0x597583){_0x36f5ae['push'](_0x36f5ae['shift']());}};_0x10c86c(++_0x53960b);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3237e9,_0x376f18){_0x3237e9=_0x3237e9-0x0;var _0x2edae8=_0xf4eb[_0x3237e9];return _0x2edae8;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x506fd2,_0x184543){var _0x232fb5=function(_0x444c6f){while(--_0x444c6f){_0x506fd2['push'](_0x506fd2['shift']());}};_0x232fb5(++_0x184543);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 0cb5d93..f9860bf 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 _0xf3c5=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','index','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x50d7fd,_0x30cd62){var _0x512b17=function(_0x305414){while(--_0x305414){_0x50d7fd['push'](_0x50d7fd['shift']());}};_0x512b17(++_0x30cd62);}(_0xf3c5,0x74));var _0x5f3c=function(_0x568427,_0x742280){_0x568427=_0x568427-0x0;var _0x3c2f86=_0xf3c5[_0x568427];return _0x3c2f86;};'use strict';var multer=require(_0x5f3c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5f3c('0x1'));var express=require(_0x5f3c('0x2'));var router=express[_0x5f3c('0x3')]();var fs_extra=require(_0x5f3c('0x4'));var auth=require(_0x5f3c('0x5'));var interaction=require(_0x5f3c('0x6'));var config=require('../../config/environment');var controller=require(_0x5f3c('0x7'));router[_0x5f3c('0x8')]('/',auth['isAuthenticated'](),controller[_0x5f3c('0x9')]);router[_0x5f3c('0x8')]('/describe',auth[_0x5f3c('0xa')](),controller[_0x5f3c('0xb')]);router[_0x5f3c('0x8')](_0x5f3c('0xc'),auth[_0x5f3c('0xa')](),controller[_0x5f3c('0xd')]);router[_0x5f3c('0xe')]('/',auth[_0x5f3c('0xa')](),controller['create']);router[_0x5f3c('0xf')]('/:id',auth[_0x5f3c('0xa')](),controller[_0x5f3c('0x10')]);router[_0x5f3c('0x11')](_0x5f3c('0xc'),auth[_0x5f3c('0xa')](),controller[_0x5f3c('0x12')]);module[_0x5f3c('0x13')]=router; \ No newline at end of file +var _0x7fe7=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x7fe7,0xff));var _0x77fe=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0x7fe7[_0x54381d];return _0x5308a7;};'use strict';var multer=require(_0x77fe('0x0'));var util=require(_0x77fe('0x1'));var path=require('path');var timeout=require(_0x77fe('0x2'));var express=require(_0x77fe('0x3'));var router=express[_0x77fe('0x4')]();var fs_extra=require(_0x77fe('0x5'));var auth=require(_0x77fe('0x6'));var interaction=require(_0x77fe('0x7'));var config=require(_0x77fe('0x8'));var controller=require(_0x77fe('0x9'));router[_0x77fe('0xa')]('/',auth[_0x77fe('0xb')](),controller[_0x77fe('0xc')]);router[_0x77fe('0xa')](_0x77fe('0xd'),auth['isAuthenticated'](),controller[_0x77fe('0xe')]);router[_0x77fe('0xa')](_0x77fe('0xf'),auth['isAuthenticated'](),controller[_0x77fe('0x10')]);router[_0x77fe('0x11')]('/',auth[_0x77fe('0xb')](),controller[_0x77fe('0x12')]);router[_0x77fe('0x13')](_0x77fe('0xf'),auth[_0x77fe('0xb')](),controller[_0x77fe('0x14')]);router['delete'](_0x77fe('0xf'),auth[_0x77fe('0xb')](),controller[_0x77fe('0x15')]);module[_0x77fe('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index cad2cd8..99bb01f 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7a54,0x106));var _0x47a5=function(_0x173f7a,_0x7c36a1){_0x173f7a=_0x173f7a-0x0;var _0x271b60=_0x7a54[_0x173f7a];return _0x271b60;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x7a54,0x106));var _0x47a5=function(_0xae49a,_0x3a26ec){_0xae49a=_0xae49a-0x0;var _0x29f0d9=_0x7a54[_0xae49a];return _0x29f0d9;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 999bea4..f81b432 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 _0xf7cb=['end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','fields','body','find','describe','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3f2187,_0x23b866){var _0x2cf8b5=function(_0x3b33e6){while(--_0x3b33e6){_0x3f2187['push'](_0x3f2187['shift']());}};_0x2cf8b5(++_0x23b866);}(_0xf7cb,0x14e));var _0xbf7c=function(_0x2e099f,_0x56504c){_0x2e099f=_0x2e099f-0x0;var _0x4c2855=_0xf7cb[_0x2e099f];return _0x4c2855;};'use strict';var emlformat=require(_0xbf7c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbf7c('0x1'));var moment=require(_0xbf7c('0x2'));var BPromise=require(_0xbf7c('0x3'));var Mustache=require(_0xbf7c('0x4'));var util=require('util');var path=require(_0xbf7c('0x5'));var sox=require(_0xbf7c('0x6'));var csv=require(_0xbf7c('0x7'));var ejs=require(_0xbf7c('0x8'));var fs=require('fs');var fs_extra=require(_0xbf7c('0x9'));var _=require(_0xbf7c('0xa'));var squel=require(_0xbf7c('0xb'));var crypto=require(_0xbf7c('0xc'));var jsforce=require(_0xbf7c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbf7c('0x7'));var querystring=require('querystring');var Papa=require(_0xbf7c('0xe'));var Redis=require(_0xbf7c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbf7c('0x10'));var as=require(_0xbf7c('0x11'));var hardwareService=require(_0xbf7c('0x12'));var logger=require(_0xbf7c('0x13'))(_0xbf7c('0x14'));var utils=require('../../config/utils');var config=require(_0xbf7c('0x15'));var licenseUtil=require(_0xbf7c('0x16'));var db=require(_0xbf7c('0x17'))['db'];function respondWithStatusCode(_0x3fa0e6,_0x1d3816){_0x1d3816=_0x1d3816||0xcc;return function(_0x13c16c){if(_0x13c16c){return _0x3fa0e6[_0xbf7c('0x18')](_0x1d3816);}return _0x3fa0e6[_0xbf7c('0x19')](_0x1d3816)[_0xbf7c('0x1a')]();};}function respondWithResult(_0x29d9a3,_0x41db1c){_0x41db1c=_0x41db1c||0xc8;return function(_0x1ceed6){if(_0x1ceed6){return _0x29d9a3[_0xbf7c('0x19')](_0x41db1c)[_0xbf7c('0x1b')](_0x1ceed6);}};}function respondWithFilteredResult(_0x37bea8,_0x4b6621){return function(_0x500c23){if(_0x500c23){var _0x54fb60=typeof _0x4b6621[_0xbf7c('0x1c')]==='undefined'&&typeof _0x4b6621[_0xbf7c('0x1d')]===_0xbf7c('0x1e');var _0x27ac6d=_0x500c23[_0xbf7c('0x1f')];var _0x353817=_0x54fb60?0x0:_0x4b6621[_0xbf7c('0x1c')];var _0x977268=_0x54fb60?_0x500c23['count']:_0x4b6621['offset']+_0x4b6621['limit'];var _0x5d2a8a;if(_0x977268>=_0x27ac6d){_0x977268=_0x27ac6d;_0x5d2a8a=0xc8;}else{_0x5d2a8a=0xce;}_0x37bea8[_0xbf7c('0x19')](_0x5d2a8a);return _0x37bea8[_0xbf7c('0x20')](_0xbf7c('0x21'),_0x353817+'-'+_0x977268+'/'+_0x27ac6d)[_0xbf7c('0x1b')](_0x500c23);}return null;};}function patchUpdates(_0x20e4db){return function(_0x3b8cf2){try{jsonpatch['apply'](_0x3b8cf2,_0x20e4db,!![]);}catch(_0x53816a){return BPromise['reject'](_0x53816a);}return _0x3b8cf2[_0xbf7c('0x22')]();};}function saveUpdates(_0x4d0d01,_0x4d05d5){return function(_0x216c47){if(_0x216c47){return _0x216c47[_0xbf7c('0x23')](_0x4d0d01)[_0xbf7c('0x24')](function(_0x542e49){return _0x542e49;});}return null;};}function removeEntity(_0x1f5854,_0x8113e8){return function(_0xc30ab9){if(_0xc30ab9){return _0xc30ab9[_0xbf7c('0x25')]()[_0xbf7c('0x24')](function(){_0x1f5854[_0xbf7c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f9d81,_0x194fea){return function(_0x5b5fbd){if(!_0x5b5fbd){_0x2f9d81['sendStatus'](0x194);}return _0x5b5fbd;};}function handleError(_0x382781,_0x2f18da){_0x2f18da=_0x2f18da||0x1f4;return function(_0x5fc09c){logger['error'](_0x5fc09c['stack']);if(_0x5fc09c['name']){delete _0x5fc09c[_0xbf7c('0x26')];}_0x382781['status'](_0x2f18da)[_0xbf7c('0x27')](_0x5fc09c);};}exports[_0xbf7c('0x28')]=function(_0x1aafb6,_0x4a3f72){var _0x248b89={},_0x1efa81={},_0x3ee033={'count':0x0,'rows':[]};var _0x1aa021=_[_0xbf7c('0x29')](db[_0xbf7c('0x2a')][_0xbf7c('0x2b')],function(_0x232aea){return{'name':_0x232aea[_0xbf7c('0x2c')],'type':_0x232aea[_0xbf7c('0x2d')][_0xbf7c('0x2e')]};});_0x1efa81[_0xbf7c('0x2f')]=_[_0xbf7c('0x29')](_0x1aa021,'name');_0x1efa81[_0xbf7c('0x30')]=_[_0xbf7c('0x31')](_0x1aafb6[_0xbf7c('0x30')]);_0x1efa81[_0xbf7c('0x32')]=_[_0xbf7c('0x33')](_0x1efa81[_0xbf7c('0x2f')],_0x1efa81[_0xbf7c('0x30')]);_0x248b89[_0xbf7c('0x34')]=_[_0xbf7c('0x33')](_0x1efa81['model'],qs['fields'](_0x1aafb6[_0xbf7c('0x30')]['fields']));_0x248b89[_0xbf7c('0x34')]=_0x248b89[_0xbf7c('0x34')][_0xbf7c('0x35')]?_0x248b89[_0xbf7c('0x34')]:_0x1efa81['model'];if(!_0x1aafb6[_0xbf7c('0x30')][_0xbf7c('0x36')](_0xbf7c('0x37'))){_0x248b89[_0xbf7c('0x1d')]=qs[_0xbf7c('0x1d')](_0x1aafb6[_0xbf7c('0x30')][_0xbf7c('0x1d')]);_0x248b89['offset']=qs[_0xbf7c('0x1c')](_0x1aafb6['query'][_0xbf7c('0x1c')]);}_0x248b89[_0xbf7c('0x38')]=qs['sort'](_0x1aafb6[_0xbf7c('0x30')]['sort']);_0x248b89[_0xbf7c('0x39')]=qs['filters'](_['pick'](_0x1aafb6[_0xbf7c('0x30')],_0x1efa81[_0xbf7c('0x32')]),_0x1aa021);if(_0x1aafb6['query'][_0xbf7c('0x3a')]){_0x248b89[_0xbf7c('0x39')]=_[_0xbf7c('0x3b')](_0x248b89[_0xbf7c('0x39')],{'$or':_['map'](_0x1aa021,function(_0x52e9dc){if(_0x52e9dc[_0xbf7c('0x2d')]!==_0xbf7c('0x3c')){var _0x3376da={};_0x3376da[_0x52e9dc['name']]={'$like':'%'+_0x1aafb6['query'][_0xbf7c('0x3a')]+'%'};return _0x3376da;}})});}_0x248b89=_[_0xbf7c('0x3b')]({},_0x248b89,_0x1aafb6[_0xbf7c('0x3d')]);var _0x67f666={'where':_0x248b89['where']};return db[_0xbf7c('0x2a')][_0xbf7c('0x1f')](_0x67f666)[_0xbf7c('0x24')](function(_0x295e02){_0x3ee033[_0xbf7c('0x1f')]=_0x295e02;if(_0x1aafb6[_0xbf7c('0x30')][_0xbf7c('0x3e')]){_0x248b89[_0xbf7c('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xbf7c('0x40')](_0x248b89);})[_0xbf7c('0x24')](function(_0x3542d7){_0x3ee033['rows']=_0x3542d7;return _0x3ee033;})['then'](respondWithFilteredResult(_0x4a3f72,_0x248b89))[_0xbf7c('0x41')](handleError(_0x4a3f72,null));};exports[_0xbf7c('0x42')]=function(_0x3ffc5a,_0x12d933){var _0x370853={'raw':!![],'where':{'id':_0x3ffc5a[_0xbf7c('0x43')]['id']}},_0x125bc2={};_0x125bc2[_0xbf7c('0x2f')]=_['keys'](db[_0xbf7c('0x2a')]['rawAttributes']);_0x125bc2[_0xbf7c('0x30')]=_['keys'](_0x3ffc5a[_0xbf7c('0x30')]);_0x125bc2[_0xbf7c('0x32')]=_['intersection'](_0x125bc2[_0xbf7c('0x2f')],_0x125bc2[_0xbf7c('0x30')]);_0x370853['attributes']=_[_0xbf7c('0x33')](_0x125bc2[_0xbf7c('0x2f')],qs[_0xbf7c('0x44')](_0x3ffc5a[_0xbf7c('0x30')][_0xbf7c('0x44')]));_0x370853['attributes']=_0x370853[_0xbf7c('0x34')][_0xbf7c('0x35')]?_0x370853[_0xbf7c('0x34')]:_0x125bc2[_0xbf7c('0x2f')];if(_0x3ffc5a['query']['includeAll']){_0x370853['include']=[{'all':!![]}];}_0x370853=_[_0xbf7c('0x3b')]({},_0x370853,_0x3ffc5a[_0xbf7c('0x3d')]);return db[_0xbf7c('0x2a')]['find'](_0x370853)[_0xbf7c('0x24')](handleEntityNotFound(_0x12d933,null))[_0xbf7c('0x24')](respondWithResult(_0x12d933,null))[_0xbf7c('0x41')](handleError(_0x12d933,null));};exports['create']=function(_0x39bfc2,_0x580b93){return db[_0xbf7c('0x2a')]['create'](_0x39bfc2['body'],{})[_0xbf7c('0x24')](respondWithResult(_0x580b93,0xc9))['catch'](handleError(_0x580b93,null));};exports[_0xbf7c('0x23')]=function(_0x94935d,_0x48f3f1){if(_0x94935d[_0xbf7c('0x45')]['id']){delete _0x94935d[_0xbf7c('0x45')]['id'];}return db[_0xbf7c('0x2a')][_0xbf7c('0x46')]({'where':{'id':_0x94935d[_0xbf7c('0x43')]['id']}})[_0xbf7c('0x24')](handleEntityNotFound(_0x48f3f1,null))[_0xbf7c('0x24')](saveUpdates(_0x94935d['body'],null))[_0xbf7c('0x24')](respondWithResult(_0x48f3f1,null))[_0xbf7c('0x41')](handleError(_0x48f3f1,null));};exports[_0xbf7c('0x25')]=function(_0x54ebcb,_0x418071){return db['JscriptyQuestionReport'][_0xbf7c('0x46')]({'where':{'id':_0x54ebcb[_0xbf7c('0x43')]['id']}})['then'](handleEntityNotFound(_0x418071,null))[_0xbf7c('0x24')](removeEntity(_0x418071,null))['catch'](handleError(_0x418071,null));};exports[_0xbf7c('0x47')]=function(_0x58b087,_0x397060){return db[_0xbf7c('0x2a')][_0xbf7c('0x47')]()[_0xbf7c('0x24')](respondWithResult(_0x397060,null))['catch'](handleError(_0x397060,null));}; \ No newline at end of file +var _0xb331=['end','json','offset','undefined','limit','count','set','apply','reject','save','name','index','map','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','JscriptyQuestionReport','then','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status'];(function(_0x3c984d,_0x5a2b4c){var _0x26d4e5=function(_0x53308d){while(--_0x53308d){_0x3c984d['push'](_0x3c984d['shift']());}};_0x26d4e5(++_0x5a2b4c);}(_0xb331,0x159));var _0x1b33=function(_0x495800,_0x5e2ca8){_0x495800=_0x495800-0x0;var _0x453796=_0xb331[_0x495800];return _0x453796;};'use strict';var emlformat=require(_0x1b33('0x0'));var rimraf=require(_0x1b33('0x1'));var zipdir=require(_0x1b33('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b33('0x3'));var BPromise=require(_0x1b33('0x4'));var Mustache=require('mustache');var util=require(_0x1b33('0x5'));var path=require(_0x1b33('0x6'));var sox=require(_0x1b33('0x7'));var csv=require('to-csv');var ejs=require(_0x1b33('0x8'));var fs=require('fs');var fs_extra=require(_0x1b33('0x9'));var _=require('lodash');var squel=require(_0x1b33('0xa'));var crypto=require('crypto');var jsforce=require(_0x1b33('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1b33('0xc'));var querystring=require(_0x1b33('0xd'));var Papa=require(_0x1b33('0xe'));var Redis=require('ioredis');var authService=require(_0x1b33('0xf'));var qs=require(_0x1b33('0x10'));var as=require(_0x1b33('0x11'));var hardwareService=require(_0x1b33('0x12'));var logger=require(_0x1b33('0x13'))(_0x1b33('0x14'));var utils=require(_0x1b33('0x15'));var config=require(_0x1b33('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b33('0x17'))['db'];function respondWithStatusCode(_0x3d2303,_0x9575c){_0x9575c=_0x9575c||0xcc;return function(_0xa606f){if(_0xa606f){return _0x3d2303['sendStatus'](_0x9575c);}return _0x3d2303[_0x1b33('0x18')](_0x9575c)[_0x1b33('0x19')]();};}function respondWithResult(_0xba448f,_0x135bdb){_0x135bdb=_0x135bdb||0xc8;return function(_0x2d0965){if(_0x2d0965){return _0xba448f[_0x1b33('0x18')](_0x135bdb)[_0x1b33('0x1a')](_0x2d0965);}};}function respondWithFilteredResult(_0x5443e2,_0x1b068c){return function(_0x3e0ce8){if(_0x3e0ce8){var _0x4a7ba9=typeof _0x1b068c[_0x1b33('0x1b')]===_0x1b33('0x1c')&&typeof _0x1b068c[_0x1b33('0x1d')]===_0x1b33('0x1c');var _0x5a365f=_0x3e0ce8[_0x1b33('0x1e')];var _0xbcbe8e=_0x4a7ba9?0x0:_0x1b068c[_0x1b33('0x1b')];var _0x480303=_0x4a7ba9?_0x3e0ce8[_0x1b33('0x1e')]:_0x1b068c[_0x1b33('0x1b')]+_0x1b068c[_0x1b33('0x1d')];var _0x1c5665;if(_0x480303>=_0x5a365f){_0x480303=_0x5a365f;_0x1c5665=0xc8;}else{_0x1c5665=0xce;}_0x5443e2[_0x1b33('0x18')](_0x1c5665);return _0x5443e2[_0x1b33('0x1f')]('Content-Range',_0xbcbe8e+'-'+_0x480303+'/'+_0x5a365f)[_0x1b33('0x1a')](_0x3e0ce8);}return null;};}function patchUpdates(_0x82136f){return function(_0x5a6477){try{jsonpatch[_0x1b33('0x20')](_0x5a6477,_0x82136f,!![]);}catch(_0x562741){return BPromise[_0x1b33('0x21')](_0x562741);}return _0x5a6477[_0x1b33('0x22')]();};}function saveUpdates(_0x43cc7d,_0x2e90a5){return function(_0x31c675){if(_0x31c675){return _0x31c675['update'](_0x43cc7d)['then'](function(_0x5e3768){return _0x5e3768;});}return null;};}function removeEntity(_0x5d5e9d,_0x49e0bc){return function(_0x4b9d84){if(_0x4b9d84){return _0x4b9d84['destroy']()['then'](function(){_0x5d5e9d['status'](0xcc)[_0x1b33('0x19')]();});}};}function handleEntityNotFound(_0x565d7e,_0x23a7f5){return function(_0x28fa0e){if(!_0x28fa0e){_0x565d7e['sendStatus'](0x194);}return _0x28fa0e;};}function handleError(_0x183dba,_0xce18fa){_0xce18fa=_0xce18fa||0x1f4;return function(_0x1760b8){logger['error'](_0x1760b8['stack']);if(_0x1760b8['name']){delete _0x1760b8[_0x1b33('0x23')];}_0x183dba[_0x1b33('0x18')](_0xce18fa)['send'](_0x1760b8);};}exports[_0x1b33('0x24')]=function(_0x7b5452,_0x358fb3){var _0x4fe8b4={},_0x273d66={},_0x24a026={'count':0x0,'rows':[]};var _0x5bce3e=_[_0x1b33('0x25')](db['JscriptyQuestionReport']['rawAttributes'],function(_0x137fbe){return{'name':_0x137fbe[_0x1b33('0x26')],'type':_0x137fbe['type'][_0x1b33('0x27')]};});_0x273d66['model']=_[_0x1b33('0x25')](_0x5bce3e,_0x1b33('0x23'));_0x273d66[_0x1b33('0x28')]=_[_0x1b33('0x29')](_0x7b5452[_0x1b33('0x28')]);_0x273d66['filters']=_[_0x1b33('0x2a')](_0x273d66[_0x1b33('0x2b')],_0x273d66['query']);_0x4fe8b4[_0x1b33('0x2c')]=_[_0x1b33('0x2a')](_0x273d66[_0x1b33('0x2b')],qs['fields'](_0x7b5452[_0x1b33('0x28')][_0x1b33('0x2d')]));_0x4fe8b4[_0x1b33('0x2c')]=_0x4fe8b4[_0x1b33('0x2c')][_0x1b33('0x2e')]?_0x4fe8b4[_0x1b33('0x2c')]:_0x273d66[_0x1b33('0x2b')];if(!_0x7b5452['query'][_0x1b33('0x2f')](_0x1b33('0x30'))){_0x4fe8b4[_0x1b33('0x1d')]=qs['limit'](_0x7b5452[_0x1b33('0x28')][_0x1b33('0x1d')]);_0x4fe8b4[_0x1b33('0x1b')]=qs[_0x1b33('0x1b')](_0x7b5452['query'][_0x1b33('0x1b')]);}_0x4fe8b4[_0x1b33('0x31')]=qs[_0x1b33('0x32')](_0x7b5452[_0x1b33('0x28')]['sort']);_0x4fe8b4[_0x1b33('0x33')]=qs[_0x1b33('0x34')](_[_0x1b33('0x35')](_0x7b5452['query'],_0x273d66['filters']),_0x5bce3e);if(_0x7b5452[_0x1b33('0x28')][_0x1b33('0x36')]){_0x4fe8b4[_0x1b33('0x33')]=_[_0x1b33('0x37')](_0x4fe8b4['where'],{'$or':_[_0x1b33('0x25')](_0x5bce3e,function(_0x3ce6f8){if(_0x3ce6f8[_0x1b33('0x38')]!==_0x1b33('0x39')){var _0x4e0789={};_0x4e0789[_0x3ce6f8['name']]={'$like':'%'+_0x7b5452[_0x1b33('0x28')]['filter']+'%'};return _0x4e0789;}})});}_0x4fe8b4=_[_0x1b33('0x37')]({},_0x4fe8b4,_0x7b5452[_0x1b33('0x3a')]);var _0x3e9326={'where':_0x4fe8b4[_0x1b33('0x33')]};return db[_0x1b33('0x3b')][_0x1b33('0x1e')](_0x3e9326)[_0x1b33('0x3c')](function(_0x1976e0){_0x24a026[_0x1b33('0x1e')]=_0x1976e0;if(_0x7b5452['query'][_0x1b33('0x3d')]){_0x4fe8b4[_0x1b33('0x3e')]=[{'all':!![]}];}return db[_0x1b33('0x3b')][_0x1b33('0x3f')](_0x4fe8b4);})[_0x1b33('0x3c')](function(_0x163d15){_0x24a026[_0x1b33('0x40')]=_0x163d15;return _0x24a026;})[_0x1b33('0x3c')](respondWithFilteredResult(_0x358fb3,_0x4fe8b4))['catch'](handleError(_0x358fb3,null));};exports[_0x1b33('0x41')]=function(_0x29633e,_0x5b22d3){var _0x271d9b={'raw':!![],'where':{'id':_0x29633e[_0x1b33('0x42')]['id']}},_0xad50d4={};_0xad50d4[_0x1b33('0x2b')]=_[_0x1b33('0x29')](db[_0x1b33('0x3b')][_0x1b33('0x43')]);_0xad50d4[_0x1b33('0x28')]=_['keys'](_0x29633e[_0x1b33('0x28')]);_0xad50d4[_0x1b33('0x34')]=_[_0x1b33('0x2a')](_0xad50d4[_0x1b33('0x2b')],_0xad50d4[_0x1b33('0x28')]);_0x271d9b['attributes']=_[_0x1b33('0x2a')](_0xad50d4[_0x1b33('0x2b')],qs['fields'](_0x29633e[_0x1b33('0x28')][_0x1b33('0x2d')]));_0x271d9b[_0x1b33('0x2c')]=_0x271d9b['attributes'][_0x1b33('0x2e')]?_0x271d9b[_0x1b33('0x2c')]:_0xad50d4['model'];if(_0x29633e[_0x1b33('0x28')][_0x1b33('0x3d')]){_0x271d9b['include']=[{'all':!![]}];}_0x271d9b=_['merge']({},_0x271d9b,_0x29633e[_0x1b33('0x3a')]);return db[_0x1b33('0x3b')][_0x1b33('0x44')](_0x271d9b)[_0x1b33('0x3c')](handleEntityNotFound(_0x5b22d3,null))[_0x1b33('0x3c')](respondWithResult(_0x5b22d3,null))[_0x1b33('0x45')](handleError(_0x5b22d3,null));};exports[_0x1b33('0x46')]=function(_0x3d239b,_0x285e93){return db[_0x1b33('0x3b')][_0x1b33('0x46')](_0x3d239b['body'],{})['then'](respondWithResult(_0x285e93,0xc9))[_0x1b33('0x45')](handleError(_0x285e93,null));};exports['update']=function(_0x3b723b,_0x2540a7){if(_0x3b723b[_0x1b33('0x47')]['id']){delete _0x3b723b[_0x1b33('0x47')]['id'];}return db['JscriptyQuestionReport'][_0x1b33('0x44')]({'where':{'id':_0x3b723b[_0x1b33('0x42')]['id']}})[_0x1b33('0x3c')](handleEntityNotFound(_0x2540a7,null))[_0x1b33('0x3c')](saveUpdates(_0x3b723b[_0x1b33('0x47')],null))[_0x1b33('0x3c')](respondWithResult(_0x2540a7,null))['catch'](handleError(_0x2540a7,null));};exports[_0x1b33('0x48')]=function(_0x1d5978,_0x27a3dd){return db[_0x1b33('0x3b')][_0x1b33('0x44')]({'where':{'id':_0x1d5978[_0x1b33('0x42')]['id']}})[_0x1b33('0x3c')](handleEntityNotFound(_0x27a3dd,null))[_0x1b33('0x3c')](removeEntity(_0x27a3dd,null))[_0x1b33('0x45')](handleError(_0x27a3dd,null));};exports[_0x1b33('0x49')]=function(_0x3a1213,_0xe6d408){return db[_0x1b33('0x3b')]['describe']()[_0x1b33('0x3c')](respondWithResult(_0xe6d408,null))[_0x1b33('0x45')](handleError(_0xe6d408,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 331c37e..469f9c3 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 _0xf4b5=['report_jscripty_questions','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport'];(function(_0x38ce62,_0x299c30){var _0x763f72=function(_0x2a4406){while(--_0x2a4406){_0x38ce62['push'](_0x38ce62['shift']());}};_0x763f72(++_0x299c30);}(_0xf4b5,0x16d));var _0x5f4b=function(_0x578ed8,_0x2e3674){_0x578ed8=_0x578ed8-0x0;var _0x5a13a5=_0xf4b5[_0x578ed8];return _0x5a13a5;};'use strict';var _=require(_0x5f4b('0x0'));var util=require(_0x5f4b('0x1'));var logger=require('../../config/logger')(_0x5f4b('0x2'));var moment=require(_0x5f4b('0x3'));var BPromise=require(_0x5f4b('0x4'));var rp=require(_0x5f4b('0x5'));var fs=require('fs');var path=require(_0x5f4b('0x6'));var rimraf=require(_0x5f4b('0x7'));var config=require(_0x5f4b('0x8'));var attributes=require(_0x5f4b('0x9'));module[_0x5f4b('0xa')]=function(_0x4d94bf,_0x1cebc8){return _0x4d94bf['define'](_0x5f4b('0xb'),attributes,{'tableName':_0x5f4b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x779b=['util','../../config/logger','rimraf','./jscriptyQuestionReport.attributes','JscriptyQuestionReport','lodash'];(function(_0x4e345c,_0x4846d9){var _0x8d771c=function(_0x45c214){while(--_0x45c214){_0x4e345c['push'](_0x4e345c['shift']());}};_0x8d771c(++_0x4846d9);}(_0x779b,0x1e5));var _0xb779=function(_0x402e06,_0x1da42b){_0x402e06=_0x402e06-0x0;var _0xab7eae=_0x779b[_0x402e06];return _0xab7eae;};'use strict';var _=require(_0xb779('0x0'));var util=require(_0xb779('0x1'));var logger=require(_0xb779('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb779('0x3'));var config=require('../../config/environment');var attributes=require(_0xb779('0x4'));module['exports']=function(_0x5811e7,_0x2bd654){return _0x5811e7['define'](_0xb779('0x5'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 93fb365..aaabcaf 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 _0x8d23=['message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x410b1d,_0x331cbd){var _0x5b9a89=function(_0x16b8a5){while(--_0x16b8a5){_0x410b1d['push'](_0x410b1d['shift']());}};_0x5b9a89(++_0x331cbd);}(_0x8d23,0x143));var _0x38d2=function(_0x159555,_0x117772){_0x159555=_0x159555-0x0;var _0x411e11=_0x8d23[_0x159555];return _0x411e11;};'use strict';var _=require(_0x38d2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x38d2('0x1'));var rs=require(_0x38d2('0x2'));var fs=require('fs');var Redis=require(_0x38d2('0x3'));var db=require(_0x38d2('0x4'))['db'];var utils=require(_0x38d2('0x5'));var logger=require(_0x38d2('0x6'))(_0x38d2('0x7'));var config=require('../../config/environment');var jayson=require(_0x38d2('0x8'));var client=jayson['client'][_0x38d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11f0aa,_0x202778,_0x120b44){return new BPromise(function(_0x5805c2,_0x5490cf){return client['request'](_0x11f0aa,_0x120b44)[_0x38d2('0xa')](function(_0x2dd9e2){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x202778,_0x38d2('0xb'));logger[_0x38d2('0xc')](_0x38d2('0xd'),_0x202778,_0x38d2('0xb'),JSON[_0x38d2('0xe')](_0x2dd9e2));if(_0x2dd9e2[_0x38d2('0xf')]){if(_0x2dd9e2[_0x38d2('0xf')]['code']===0x1f4){logger['error'](_0x38d2('0x10'),_0x202778,_0x2dd9e2[_0x38d2('0xf')]['message']);return _0x5490cf(_0x2dd9e2['error'][_0x38d2('0x11')]);}logger['error'](_0x38d2('0x10'),_0x202778,_0x2dd9e2[_0x38d2('0xf')]['message']);return _0x5805c2(_0x2dd9e2[_0x38d2('0xf')][_0x38d2('0x11')]);}else{logger['info'](_0x38d2('0x10'),_0x202778,_0x38d2('0xb'));_0x5805c2(_0x2dd9e2[_0x38d2('0x12')][_0x38d2('0x11')]);}})[_0x38d2('0x13')](function(_0x2eaed1){logger[_0x38d2('0xf')](_0x38d2('0x10'),_0x202778,_0x2eaed1);_0x5490cf(_0x2eaed1);});});} \ No newline at end of file +var _0x5870=['../../config/environment','jayson/promise','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5870,0xb4));var _0x0587=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x5870[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x0587('0x0'));var util=require(_0x0587('0x1'));var moment=require(_0x0587('0x2'));var BPromise=require(_0x0587('0x3'));var rs=require(_0x0587('0x4'));var fs=require('fs');var Redis=require(_0x0587('0x5'));var db=require(_0x0587('0x6'))['db'];var utils=require(_0x0587('0x7'));var logger=require(_0x0587('0x8'))('rpc');var config=require(_0x0587('0x9'));var jayson=require(_0x0587('0xa'));var client=jayson['client'][_0x0587('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ec830,_0x22d6ff,_0x722d62){return new BPromise(function(_0x1a530a,_0x25a5ae){return client[_0x0587('0xc')](_0x2ec830,_0x722d62)['then'](function(_0x48fc8e){logger[_0x0587('0xd')](_0x0587('0xe'),_0x22d6ff,'request\x20sent');logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x22d6ff,'request\x20sent',JSON[_0x0587('0xf')](_0x48fc8e));if(_0x48fc8e[_0x0587('0x10')]){if(_0x48fc8e[_0x0587('0x10')][_0x0587('0x11')]===0x1f4){logger[_0x0587('0x10')](_0x0587('0xe'),_0x22d6ff,_0x48fc8e[_0x0587('0x10')][_0x0587('0x12')]);return _0x25a5ae(_0x48fc8e[_0x0587('0x10')][_0x0587('0x12')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x22d6ff,_0x48fc8e[_0x0587('0x10')][_0x0587('0x12')]);return _0x1a530a(_0x48fc8e[_0x0587('0x10')][_0x0587('0x12')]);}else{logger[_0x0587('0xd')](_0x0587('0xe'),_0x22d6ff,_0x0587('0x13'));_0x1a530a(_0x48fc8e['result'][_0x0587('0x12')]);}})[_0x0587('0x14')](function(_0x10eebc){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x22d6ff,_0x10eebc);_0x25a5ae(_0x10eebc);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 832411a..81c705f 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 _0xa402=['/:id','show','/:id/questions','isAuthenticated','getQuestions','post','update','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','describe'];(function(_0x5ad4be,_0x197a3d){var _0x2a9ba3=function(_0x3ab165){while(--_0x3ab165){_0x5ad4be['push'](_0x5ad4be['shift']());}};_0x2a9ba3(++_0x197a3d);}(_0xa402,0x151));var _0x2a40=function(_0x1faa64,_0x27380c){_0x1faa64=_0x1faa64-0x0;var _0x3e01e1=_0xa402[_0x1faa64];return _0x3e01e1;};'use strict';var multer=require(_0x2a40('0x0'));var util=require(_0x2a40('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2a40('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2a40('0x3'));var interaction=require(_0x2a40('0x4'));var config=require(_0x2a40('0x5'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2a40('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x2a40('0x7')]);router[_0x2a40('0x6')](_0x2a40('0x8'),auth['isAuthenticated'](),controller[_0x2a40('0x9')]);router[_0x2a40('0x6')](_0x2a40('0xa'),auth[_0x2a40('0xb')](),controller[_0x2a40('0xc')]);router[_0x2a40('0xd')]('/',auth[_0x2a40('0xb')](),controller['create']);router['put'](_0x2a40('0x8'),auth[_0x2a40('0xb')](),controller[_0x2a40('0xe')]);router['delete']('/:id',auth[_0x2a40('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2d6b=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','post','put','update'];(function(_0x3d2dfb,_0x308438){var _0x2775b4=function(_0x3a0dda){while(--_0x3a0dda){_0x3d2dfb['push'](_0x3d2dfb['shift']());}};_0x2775b4(++_0x308438);}(_0x2d6b,0x6c));var _0xb2d6=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x2d6b[_0xbf8ebe];return _0x1e25e8;};'use strict';var multer=require(_0xb2d6('0x0'));var util=require(_0xb2d6('0x1'));var path=require(_0xb2d6('0x2'));var timeout=require(_0xb2d6('0x3'));var express=require('express');var router=express[_0xb2d6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb2d6('0x5'));var controller=require(_0xb2d6('0x6'));router[_0xb2d6('0x7')]('/',auth[_0xb2d6('0x8')](),controller[_0xb2d6('0x9')]);router['get'](_0xb2d6('0xa'),auth[_0xb2d6('0x8')](),controller[_0xb2d6('0xb')]);router['get'](_0xb2d6('0xc'),auth[_0xb2d6('0x8')](),controller[_0xb2d6('0xd')]);router[_0xb2d6('0x7')](_0xb2d6('0xe'),auth[_0xb2d6('0x8')](),controller['getQuestions']);router[_0xb2d6('0xf')]('/',auth[_0xb2d6('0x8')](),controller['create']);router[_0xb2d6('0x10')](_0xb2d6('0xc'),auth[_0xb2d6('0x8')](),controller[_0xb2d6('0x11')]);router[_0xb2d6('0x12')](_0xb2d6('0xc'),auth['isAuthenticated'](),controller[_0xb2d6('0x13')]);module[_0xb2d6('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index dacece7..9a634ba 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 _0x1b38=['sequelize','exports','DATE','setDataValue','starttime','endtime','format','STRING','BOOLEAN','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b38,0x95));var _0x81b3=function(_0x2c54db,_0x4decb4){_0x2c54db=_0x2c54db-0x0;var _0x40c4e4=_0x1b38[_0x2c54db];return _0x40c4e4;};'use strict';var moment=require(_0x81b3('0x0'));var Sequelize=require(_0x81b3('0x1'));module[_0x81b3('0x2')]={'starttime':{'type':Sequelize[_0x81b3('0x3')],'set':function(_0x1f1bec){this[_0x81b3('0x4')](_0x81b3('0x5'),_0x1f1bec);this[_0x81b3('0x4')](_0x81b3('0x6'),moment()[_0x81b3('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x81b3('0x3')]},'membername':{'type':Sequelize[_0x81b3('0x8')]},'projectname':{'type':Sequelize[_0x81b3('0x8')]},'queue':{'type':Sequelize[_0x81b3('0x8')]},'uniqueid':{'type':Sequelize[_0x81b3('0x8')]},'calleridname':{'type':Sequelize[_0x81b3('0x8')]},'calleridnum':{'type':Sequelize[_0x81b3('0x8')]},'completed':{'type':Sequelize[_0x81b3('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xbe54=['setDataValue','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','DATE'];(function(_0x2ff8e3,_0x15553b){var _0x2f60b5=function(_0x582b5f){while(--_0x582b5f){_0x2ff8e3['push'](_0x2ff8e3['shift']());}};_0x2f60b5(++_0x15553b);}(_0xbe54,0x9e));var _0x4be5=function(_0x22d8c8,_0x2f8289){_0x22d8c8=_0x22d8c8-0x0;var _0x267710=_0xbe54[_0x22d8c8];return _0x267710;};'use strict';var moment=require(_0x4be5('0x0'));var Sequelize=require(_0x4be5('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x4be5('0x2')],'set':function(_0x4bf64b){this[_0x4be5('0x3')]('starttime',_0x4bf64b);this['setDataValue']('endtime',moment()['format'](_0x4be5('0x4')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x4be5('0x5')]},'projectname':{'type':Sequelize[_0x4be5('0x5')]},'queue':{'type':Sequelize[_0x4be5('0x5')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4be5('0x5')]},'calleridnum':{'type':Sequelize[_0x4be5('0x5')]},'completed':{'type':Sequelize[_0x4be5('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index f56b349..f0b6996 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 _0x5ef8=['where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort'];(function(_0x1ebf82,_0x58b575){var _0x30cc14=function(_0x52937f){while(--_0x52937f){_0x1ebf82['push'](_0x1ebf82['shift']());}};_0x30cc14(++_0x58b575);}(_0x5ef8,0x67));var _0x85ef=function(_0x5822ce,_0x280d1b){_0x5822ce=_0x5822ce-0x0;var _0x8779ab=_0x5ef8[_0x5822ce];return _0x8779ab;};'use strict';var emlformat=require(_0x85ef('0x0'));var rimraf=require(_0x85ef('0x1'));var zipdir=require(_0x85ef('0x2'));var jsonpatch=require(_0x85ef('0x3'));var rp=require(_0x85ef('0x4'));var moment=require(_0x85ef('0x5'));var BPromise=require(_0x85ef('0x6'));var Mustache=require(_0x85ef('0x7'));var util=require(_0x85ef('0x8'));var path=require('path');var sox=require(_0x85ef('0x9'));var csv=require(_0x85ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x85ef('0xb'));var _=require(_0x85ef('0xc'));var squel=require(_0x85ef('0xd'));var crypto=require(_0x85ef('0xe'));var jsforce=require(_0x85ef('0xf'));var deskjs=require(_0x85ef('0x10'));var toCsv=require('to-csv');var querystring=require(_0x85ef('0x11'));var Papa=require(_0x85ef('0x12'));var Redis=require(_0x85ef('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x85ef('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85ef('0x15'))(_0x85ef('0x16'));var utils=require(_0x85ef('0x17'));var config=require(_0x85ef('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cd58d,_0x574fa5){_0x574fa5=_0x574fa5||0xcc;return function(_0x84fd9a){if(_0x84fd9a){return _0x4cd58d['sendStatus'](_0x574fa5);}return _0x4cd58d['status'](_0x574fa5)['end']();};}function respondWithResult(_0x3289b4,_0xbfa04c){_0xbfa04c=_0xbfa04c||0xc8;return function(_0x4865c9){if(_0x4865c9){return _0x3289b4[_0x85ef('0x19')](_0xbfa04c)[_0x85ef('0x1a')](_0x4865c9);}};}function respondWithFilteredResult(_0xb691b7,_0x16f431){return function(_0x5b31b1){if(_0x5b31b1){var _0x2e2fe1=typeof _0x16f431[_0x85ef('0x1b')]===_0x85ef('0x1c')&&typeof _0x16f431[_0x85ef('0x1d')]===_0x85ef('0x1c');var _0x48caf9=_0x5b31b1[_0x85ef('0x1e')];var _0x10c926=_0x2e2fe1?0x0:_0x16f431[_0x85ef('0x1b')];var _0x3c790d=_0x2e2fe1?_0x5b31b1[_0x85ef('0x1e')]:_0x16f431['offset']+_0x16f431[_0x85ef('0x1d')];var _0x58a5b8;if(_0x3c790d>=_0x48caf9){_0x3c790d=_0x48caf9;_0x58a5b8=0xc8;}else{_0x58a5b8=0xce;}_0xb691b7[_0x85ef('0x19')](_0x58a5b8);return _0xb691b7[_0x85ef('0x1f')]('Content-Range',_0x10c926+'-'+_0x3c790d+'/'+_0x48caf9)[_0x85ef('0x1a')](_0x5b31b1);}return null;};}function patchUpdates(_0x2e5315){return function(_0x1dc9f9){try{jsonpatch[_0x85ef('0x20')](_0x1dc9f9,_0x2e5315,!![]);}catch(_0xbcbc83){return BPromise[_0x85ef('0x21')](_0xbcbc83);}return _0x1dc9f9[_0x85ef('0x22')]();};}function saveUpdates(_0x5987c2,_0x32d383){return function(_0x4cbc65){if(_0x4cbc65){return _0x4cbc65[_0x85ef('0x23')](_0x5987c2)[_0x85ef('0x24')](function(_0x30815e){return _0x30815e;});}return null;};}function removeEntity(_0x5f248f,_0x297e90){return function(_0x140610){if(_0x140610){return _0x140610['destroy']()[_0x85ef('0x24')](function(){_0x5f248f[_0x85ef('0x19')](0xcc)[_0x85ef('0x25')]();});}};}function handleEntityNotFound(_0x1df1e1,_0x5b636f){return function(_0x13a0d4){if(!_0x13a0d4){_0x1df1e1[_0x85ef('0x26')](0x194);}return _0x13a0d4;};}function handleError(_0x1b9e98,_0x4cadb3){_0x4cadb3=_0x4cadb3||0x1f4;return function(_0x184385){logger[_0x85ef('0x27')](_0x184385[_0x85ef('0x28')]);if(_0x184385[_0x85ef('0x29')]){delete _0x184385[_0x85ef('0x29')];}_0x1b9e98['status'](_0x4cadb3)[_0x85ef('0x2a')](_0x184385);};}exports[_0x85ef('0x2b')]=function(_0xd7122e,_0x1d9c4b){var _0x3029ef={},_0x5bf278={},_0x434b46={'count':0x0,'rows':[]};var _0x3bdec0=_[_0x85ef('0x2c')](db[_0x85ef('0x2d')]['rawAttributes'],function(_0x1bc277){return{'name':_0x1bc277[_0x85ef('0x2e')],'type':_0x1bc277['type'][_0x85ef('0x2f')]};});_0x5bf278[_0x85ef('0x30')]=_[_0x85ef('0x2c')](_0x3bdec0,'name');_0x5bf278[_0x85ef('0x31')]=_[_0x85ef('0x32')](_0xd7122e['query']);_0x5bf278['filters']=_[_0x85ef('0x33')](_0x5bf278[_0x85ef('0x30')],_0x5bf278['query']);_0x3029ef[_0x85ef('0x34')]=_[_0x85ef('0x33')](_0x5bf278[_0x85ef('0x30')],qs[_0x85ef('0x35')](_0xd7122e['query'][_0x85ef('0x35')]));_0x3029ef[_0x85ef('0x34')]=_0x3029ef[_0x85ef('0x34')]['length']?_0x3029ef[_0x85ef('0x34')]:_0x5bf278[_0x85ef('0x30')];if(!_0xd7122e[_0x85ef('0x31')][_0x85ef('0x36')](_0x85ef('0x37'))){_0x3029ef[_0x85ef('0x1d')]=qs[_0x85ef('0x1d')](_0xd7122e[_0x85ef('0x31')]['limit']);_0x3029ef[_0x85ef('0x1b')]=qs[_0x85ef('0x1b')](_0xd7122e[_0x85ef('0x31')][_0x85ef('0x1b')]);}_0x3029ef['order']=qs[_0x85ef('0x38')](_0xd7122e['query'][_0x85ef('0x38')]);_0x3029ef[_0x85ef('0x39')]=qs[_0x85ef('0x3a')](_[_0x85ef('0x3b')](_0xd7122e['query'],_0x5bf278[_0x85ef('0x3a')]),_0x3bdec0);if(_0xd7122e['query'][_0x85ef('0x3c')]){_0x3029ef['where']=_[_0x85ef('0x3d')](_0x3029ef[_0x85ef('0x39')],{'$or':_['map'](_0x3bdec0,function(_0x25dc1a){if(_0x25dc1a[_0x85ef('0x3e')]!=='VIRTUAL'){var _0x34abd9={};_0x34abd9[_0x25dc1a[_0x85ef('0x29')]]={'$like':'%'+_0xd7122e[_0x85ef('0x31')][_0x85ef('0x3c')]+'%'};return _0x34abd9;}})});}_0x3029ef=_['merge']({},_0x3029ef,_0xd7122e[_0x85ef('0x3f')]);var _0x14a29f={'where':_0x3029ef[_0x85ef('0x39')]};return db[_0x85ef('0x2d')][_0x85ef('0x1e')](_0x14a29f)[_0x85ef('0x24')](function(_0x254e4b){_0x434b46[_0x85ef('0x1e')]=_0x254e4b;if(_0xd7122e[_0x85ef('0x31')][_0x85ef('0x40')]){_0x3029ef[_0x85ef('0x41')]=[{'all':!![]}];}return db[_0x85ef('0x2d')][_0x85ef('0x42')](_0x3029ef);})['then'](function(_0x38ee9f){_0x434b46[_0x85ef('0x43')]=_0x38ee9f;return _0x434b46;})['then'](respondWithFilteredResult(_0x1d9c4b,_0x3029ef))[_0x85ef('0x44')](handleError(_0x1d9c4b,null));};exports[_0x85ef('0x45')]=function(_0x1e4013,_0x4fb81a){var _0x250882={'raw':!![],'where':{'id':_0x1e4013[_0x85ef('0x46')]['id']}},_0x2643c6={};_0x2643c6[_0x85ef('0x30')]=_[_0x85ef('0x32')](db[_0x85ef('0x2d')]['rawAttributes']);_0x2643c6['query']=_['keys'](_0x1e4013[_0x85ef('0x31')]);_0x2643c6[_0x85ef('0x3a')]=_[_0x85ef('0x33')](_0x2643c6[_0x85ef('0x30')],_0x2643c6[_0x85ef('0x31')]);_0x250882[_0x85ef('0x34')]=_[_0x85ef('0x33')](_0x2643c6[_0x85ef('0x30')],qs['fields'](_0x1e4013[_0x85ef('0x31')]['fields']));_0x250882['attributes']=_0x250882[_0x85ef('0x34')][_0x85ef('0x47')]?_0x250882[_0x85ef('0x34')]:_0x2643c6[_0x85ef('0x30')];if(_0x1e4013[_0x85ef('0x31')][_0x85ef('0x40')]){_0x250882[_0x85ef('0x41')]=[{'all':!![]}];}_0x250882=_[_0x85ef('0x3d')]({},_0x250882,_0x1e4013['options']);return db[_0x85ef('0x2d')][_0x85ef('0x48')](_0x250882)[_0x85ef('0x24')](handleEntityNotFound(_0x4fb81a,null))[_0x85ef('0x24')](respondWithResult(_0x4fb81a,null))[_0x85ef('0x44')](handleError(_0x4fb81a,null));};exports[_0x85ef('0x49')]=function(_0x2c72be,_0xb090e6){return db['JscriptySessionReport'][_0x85ef('0x49')](_0x2c72be['body'],{})[_0x85ef('0x24')](respondWithResult(_0xb090e6,0xc9))['catch'](handleError(_0xb090e6,null));};exports[_0x85ef('0x23')]=function(_0xc9cf07,_0x2850e4){if(_0xc9cf07[_0x85ef('0x4a')]['id']){delete _0xc9cf07['body']['id'];}return db[_0x85ef('0x2d')][_0x85ef('0x48')]({'where':{'id':_0xc9cf07[_0x85ef('0x46')]['id']}})[_0x85ef('0x24')](handleEntityNotFound(_0x2850e4,null))[_0x85ef('0x24')](saveUpdates(_0xc9cf07['body'],null))['then'](respondWithResult(_0x2850e4,null))[_0x85ef('0x44')](handleError(_0x2850e4,null));};exports[_0x85ef('0x4b')]=function(_0x26804c,_0x154156){return db[_0x85ef('0x2d')][_0x85ef('0x48')]({'where':{'id':_0x26804c[_0x85ef('0x46')]['id']}})[_0x85ef('0x24')](handleEntityNotFound(_0x154156,null))[_0x85ef('0x24')](removeEntity(_0x154156,null))['catch'](handleError(_0x154156,null));};exports[_0x85ef('0x4c')]=function(_0x117446,_0x482065){return db[_0x85ef('0x2d')]['describe']()[_0x85ef('0x24')](respondWithResult(_0x482065,null))[_0x85ef('0x44')](handleError(_0x482065,null));};exports[_0x85ef('0x4d')]=function(_0x2c77af,_0x4078e9,_0x5504ad){var _0x523c07={'raw':!![],'where':{}};var _0x363450={};var _0x5cd1e4={'count':0x0,'rows':[]};return db[_0x85ef('0x2d')][_0x85ef('0x4e')]({'where':{'id':_0x2c77af[_0x85ef('0x46')]['id']}})[_0x85ef('0x24')](handleEntityNotFound(_0x4078e9,null))['then'](function(_0x5151ad){if(_0x5151ad){_0x363450['model']=_[_0x85ef('0x32')](db[_0x85ef('0x4f')]['rawAttributes']);_0x363450[_0x85ef('0x31')]=_['keys'](_0x2c77af[_0x85ef('0x31')]);_0x363450[_0x85ef('0x3a')]=_[_0x85ef('0x33')](_0x363450['model'],_0x363450['query']);_0x523c07[_0x85ef('0x34')]=_['intersection'](_0x363450['model'],qs['fields'](_0x2c77af['query'][_0x85ef('0x35')]));_0x523c07[_0x85ef('0x34')]=_0x523c07[_0x85ef('0x34')][_0x85ef('0x47')]?_0x523c07['attributes']:_0x363450['model'];if(!_0x2c77af[_0x85ef('0x31')]['hasOwnProperty'](_0x85ef('0x37'))){_0x523c07[_0x85ef('0x1d')]=qs['limit'](_0x2c77af[_0x85ef('0x31')]['limit']);_0x523c07[_0x85ef('0x1b')]=qs[_0x85ef('0x1b')](_0x2c77af['query'][_0x85ef('0x1b')]);}_0x523c07['order']=qs['sort'](_0x2c77af['query'][_0x85ef('0x38')]);_0x523c07[_0x85ef('0x39')]=qs[_0x85ef('0x3a')](_['pick'](_0x2c77af['query'],_0x363450[_0x85ef('0x3a')]));_0x523c07[_0x85ef('0x39')]['SessionId']=_0x5151ad['id'];if(_0x2c77af['query']['filter']){_0x523c07[_0x85ef('0x39')]=_[_0x85ef('0x3d')](_0x523c07['where'],{'$or':_['map'](_0x523c07[_0x85ef('0x34')],function(_0x14d57b){var _0x59dfc9={};_0x59dfc9[_0x14d57b]={'$like':'%'+_0x2c77af[_0x85ef('0x31')][_0x85ef('0x3c')]+'%'};return _0x59dfc9;})});}_0x523c07=_['merge']({},_0x523c07,_0x2c77af[_0x85ef('0x3f')]);return db[_0x85ef('0x4f')][_0x85ef('0x1e')]({'where':_0x523c07[_0x85ef('0x39')]})[_0x85ef('0x24')](function(_0x55befc){_0x5cd1e4['count']=_0x55befc;if(_0x2c77af['query'][_0x85ef('0x40')]){_0x523c07[_0x85ef('0x41')]=[{'all':!![]}];}return db[_0x85ef('0x4f')][_0x85ef('0x42')](_0x523c07);})[_0x85ef('0x24')](function(_0x56eb6e){_0x5cd1e4['rows']=_0x56eb6e;return _0x5cd1e4;});}})[_0x85ef('0x24')](respondWithFilteredResult(_0x4078e9,_0x523c07))[_0x85ef('0x44')](handleError(_0x4078e9,null));}; \ No newline at end of file +var _0xff96=['limit','set','Content-Range','apply','reject','update','then','destroy','status','sendStatus','name','send','index','map','JscriptySessionReport','fieldName','key','keys','query','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','show','params','rawAttributes','intersection','options','catch','create','body','find','describe','getQuestions','findOne','nolimit','SessionId','JscriptyQuestionReport','rows','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','offset','undefined','count'];(function(_0x68f242,_0x8b2ba6){var _0x592bba=function(_0x41da2c){while(--_0x41da2c){_0x68f242['push'](_0x68f242['shift']());}};_0x592bba(++_0x8b2ba6);}(_0xff96,0xce));var _0x6ff9=function(_0x51ea1b,_0x1c5a3b){_0x51ea1b=_0x51ea1b-0x0;var _0x56d914=_0xff96[_0x51ea1b];return _0x56d914;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6ff9('0x0'));var zipdir=require(_0x6ff9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6ff9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6ff9('0x3'));var util=require('util');var path=require(_0x6ff9('0x4'));var sox=require(_0x6ff9('0x5'));var csv=require(_0x6ff9('0x6'));var ejs=require(_0x6ff9('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ff9('0x8'));var squel=require('squel');var crypto=require(_0x6ff9('0x9'));var jsforce=require(_0x6ff9('0xa'));var deskjs=require(_0x6ff9('0xb'));var toCsv=require(_0x6ff9('0x6'));var querystring=require('querystring');var Papa=require(_0x6ff9('0xc'));var Redis=require(_0x6ff9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x6ff9('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ff9('0xf'));var logger=require(_0x6ff9('0x10'))(_0x6ff9('0x11'));var utils=require(_0x6ff9('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x6ff9('0x13'));var db=require(_0x6ff9('0x14'))['db'];function respondWithStatusCode(_0x3307d2,_0x381574){_0x381574=_0x381574||0xcc;return function(_0x29c076){if(_0x29c076){return _0x3307d2['sendStatus'](_0x381574);}return _0x3307d2['status'](_0x381574)[_0x6ff9('0x15')]();};}function respondWithResult(_0x58c647,_0x4a967b){_0x4a967b=_0x4a967b||0xc8;return function(_0x24ff0d){if(_0x24ff0d){return _0x58c647['status'](_0x4a967b)['json'](_0x24ff0d);}};}function respondWithFilteredResult(_0x4d8b14,_0x58478d){return function(_0x5a6fb7){if(_0x5a6fb7){var _0x1ec245=typeof _0x58478d[_0x6ff9('0x16')]==='undefined'&&typeof _0x58478d['limit']===_0x6ff9('0x17');var _0x469423=_0x5a6fb7['count'];var _0x5c9e7d=_0x1ec245?0x0:_0x58478d[_0x6ff9('0x16')];var _0x4276fa=_0x1ec245?_0x5a6fb7[_0x6ff9('0x18')]:_0x58478d[_0x6ff9('0x16')]+_0x58478d[_0x6ff9('0x19')];var _0x2c3e74;if(_0x4276fa>=_0x469423){_0x4276fa=_0x469423;_0x2c3e74=0xc8;}else{_0x2c3e74=0xce;}_0x4d8b14['status'](_0x2c3e74);return _0x4d8b14[_0x6ff9('0x1a')](_0x6ff9('0x1b'),_0x5c9e7d+'-'+_0x4276fa+'/'+_0x469423)['json'](_0x5a6fb7);}return null;};}function patchUpdates(_0x21b552){return function(_0x4fa268){try{jsonpatch[_0x6ff9('0x1c')](_0x4fa268,_0x21b552,!![]);}catch(_0x3a0186){return BPromise[_0x6ff9('0x1d')](_0x3a0186);}return _0x4fa268['save']();};}function saveUpdates(_0x9aad60,_0x3fa20f){return function(_0x2d1821){if(_0x2d1821){return _0x2d1821[_0x6ff9('0x1e')](_0x9aad60)[_0x6ff9('0x1f')](function(_0xd1641e){return _0xd1641e;});}return null;};}function removeEntity(_0x4aa3a1,_0x5a2af5){return function(_0x3d2675){if(_0x3d2675){return _0x3d2675[_0x6ff9('0x20')]()[_0x6ff9('0x1f')](function(){_0x4aa3a1[_0x6ff9('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x367e9d,_0x45f9b7){return function(_0x14cb35){if(!_0x14cb35){_0x367e9d[_0x6ff9('0x22')](0x194);}return _0x14cb35;};}function handleError(_0x169c79,_0x929741){_0x929741=_0x929741||0x1f4;return function(_0x504c1e){logger['error'](_0x504c1e['stack']);if(_0x504c1e[_0x6ff9('0x23')]){delete _0x504c1e['name'];}_0x169c79[_0x6ff9('0x21')](_0x929741)[_0x6ff9('0x24')](_0x504c1e);};}exports[_0x6ff9('0x25')]=function(_0x268dfa,_0x41e56c){var _0x199b67={},_0x24bb9d={},_0x566d7a={'count':0x0,'rows':[]};var _0x1baae2=_[_0x6ff9('0x26')](db[_0x6ff9('0x27')]['rawAttributes'],function(_0x51a80e){return{'name':_0x51a80e[_0x6ff9('0x28')],'type':_0x51a80e['type'][_0x6ff9('0x29')]};});_0x24bb9d['model']=_[_0x6ff9('0x26')](_0x1baae2,_0x6ff9('0x23'));_0x24bb9d['query']=_[_0x6ff9('0x2a')](_0x268dfa[_0x6ff9('0x2b')]);_0x24bb9d[_0x6ff9('0x2c')]=_['intersection'](_0x24bb9d[_0x6ff9('0x2d')],_0x24bb9d[_0x6ff9('0x2b')]);_0x199b67[_0x6ff9('0x2e')]=_['intersection'](_0x24bb9d[_0x6ff9('0x2d')],qs['fields'](_0x268dfa[_0x6ff9('0x2b')][_0x6ff9('0x2f')]));_0x199b67[_0x6ff9('0x2e')]=_0x199b67[_0x6ff9('0x2e')][_0x6ff9('0x30')]?_0x199b67['attributes']:_0x24bb9d[_0x6ff9('0x2d')];if(!_0x268dfa[_0x6ff9('0x2b')][_0x6ff9('0x31')]('nolimit')){_0x199b67[_0x6ff9('0x19')]=qs[_0x6ff9('0x19')](_0x268dfa[_0x6ff9('0x2b')][_0x6ff9('0x19')]);_0x199b67[_0x6ff9('0x16')]=qs[_0x6ff9('0x16')](_0x268dfa[_0x6ff9('0x2b')][_0x6ff9('0x16')]);}_0x199b67[_0x6ff9('0x32')]=qs[_0x6ff9('0x33')](_0x268dfa['query'][_0x6ff9('0x33')]);_0x199b67[_0x6ff9('0x34')]=qs[_0x6ff9('0x2c')](_[_0x6ff9('0x35')](_0x268dfa['query'],_0x24bb9d['filters']),_0x1baae2);if(_0x268dfa['query'][_0x6ff9('0x36')]){_0x199b67['where']=_[_0x6ff9('0x37')](_0x199b67['where'],{'$or':_[_0x6ff9('0x26')](_0x1baae2,function(_0x2cd278){if(_0x2cd278[_0x6ff9('0x38')]!==_0x6ff9('0x39')){var _0x37e215={};_0x37e215[_0x2cd278['name']]={'$like':'%'+_0x268dfa[_0x6ff9('0x2b')][_0x6ff9('0x36')]+'%'};return _0x37e215;}})});}_0x199b67=_[_0x6ff9('0x37')]({},_0x199b67,_0x268dfa['options']);var _0x3b6d51={'where':_0x199b67['where']};return db[_0x6ff9('0x27')][_0x6ff9('0x18')](_0x3b6d51)['then'](function(_0x226b6b){_0x566d7a['count']=_0x226b6b;if(_0x268dfa['query'][_0x6ff9('0x3a')]){_0x199b67[_0x6ff9('0x3b')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x6ff9('0x3c')](_0x199b67);})[_0x6ff9('0x1f')](function(_0x4ba0d5){_0x566d7a['rows']=_0x4ba0d5;return _0x566d7a;})['then'](respondWithFilteredResult(_0x41e56c,_0x199b67))['catch'](handleError(_0x41e56c,null));};exports[_0x6ff9('0x3d')]=function(_0x59379f,_0xcc18e6){var _0x458ce1={'raw':!![],'where':{'id':_0x59379f[_0x6ff9('0x3e')]['id']}},_0x1b31d6={};_0x1b31d6['model']=_[_0x6ff9('0x2a')](db[_0x6ff9('0x27')][_0x6ff9('0x3f')]);_0x1b31d6[_0x6ff9('0x2b')]=_['keys'](_0x59379f[_0x6ff9('0x2b')]);_0x1b31d6[_0x6ff9('0x2c')]=_[_0x6ff9('0x40')](_0x1b31d6[_0x6ff9('0x2d')],_0x1b31d6['query']);_0x458ce1[_0x6ff9('0x2e')]=_['intersection'](_0x1b31d6[_0x6ff9('0x2d')],qs['fields'](_0x59379f[_0x6ff9('0x2b')]['fields']));_0x458ce1[_0x6ff9('0x2e')]=_0x458ce1[_0x6ff9('0x2e')][_0x6ff9('0x30')]?_0x458ce1[_0x6ff9('0x2e')]:_0x1b31d6[_0x6ff9('0x2d')];if(_0x59379f['query'][_0x6ff9('0x3a')]){_0x458ce1[_0x6ff9('0x3b')]=[{'all':!![]}];}_0x458ce1=_['merge']({},_0x458ce1,_0x59379f[_0x6ff9('0x41')]);return db[_0x6ff9('0x27')]['find'](_0x458ce1)[_0x6ff9('0x1f')](handleEntityNotFound(_0xcc18e6,null))[_0x6ff9('0x1f')](respondWithResult(_0xcc18e6,null))[_0x6ff9('0x42')](handleError(_0xcc18e6,null));};exports['create']=function(_0x197b3a,_0x1ff8fe){return db[_0x6ff9('0x27')][_0x6ff9('0x43')](_0x197b3a[_0x6ff9('0x44')],{})['then'](respondWithResult(_0x1ff8fe,0xc9))[_0x6ff9('0x42')](handleError(_0x1ff8fe,null));};exports[_0x6ff9('0x1e')]=function(_0x1f0b2c,_0x1afbbb){if(_0x1f0b2c[_0x6ff9('0x44')]['id']){delete _0x1f0b2c[_0x6ff9('0x44')]['id'];}return db['JscriptySessionReport'][_0x6ff9('0x45')]({'where':{'id':_0x1f0b2c['params']['id']}})[_0x6ff9('0x1f')](handleEntityNotFound(_0x1afbbb,null))[_0x6ff9('0x1f')](saveUpdates(_0x1f0b2c['body'],null))[_0x6ff9('0x1f')](respondWithResult(_0x1afbbb,null))[_0x6ff9('0x42')](handleError(_0x1afbbb,null));};exports[_0x6ff9('0x20')]=function(_0xbe638f,_0x1fc111){return db[_0x6ff9('0x27')]['find']({'where':{'id':_0xbe638f['params']['id']}})[_0x6ff9('0x1f')](handleEntityNotFound(_0x1fc111,null))[_0x6ff9('0x1f')](removeEntity(_0x1fc111,null))[_0x6ff9('0x42')](handleError(_0x1fc111,null));};exports[_0x6ff9('0x46')]=function(_0x4ea8f2,_0x2f0587){return db[_0x6ff9('0x27')][_0x6ff9('0x46')]()[_0x6ff9('0x1f')](respondWithResult(_0x2f0587,null))[_0x6ff9('0x42')](handleError(_0x2f0587,null));};exports[_0x6ff9('0x47')]=function(_0x30bd04,_0x582a43,_0x1935fa){var _0x4dc941={'raw':!![],'where':{}};var _0x275efc={};var _0x681887={'count':0x0,'rows':[]};return db[_0x6ff9('0x27')][_0x6ff9('0x48')]({'where':{'id':_0x30bd04[_0x6ff9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x582a43,null))[_0x6ff9('0x1f')](function(_0x1ff8f6){if(_0x1ff8f6){_0x275efc[_0x6ff9('0x2d')]=_[_0x6ff9('0x2a')](db['JscriptyQuestionReport'][_0x6ff9('0x3f')]);_0x275efc[_0x6ff9('0x2b')]=_[_0x6ff9('0x2a')](_0x30bd04[_0x6ff9('0x2b')]);_0x275efc[_0x6ff9('0x2c')]=_[_0x6ff9('0x40')](_0x275efc[_0x6ff9('0x2d')],_0x275efc[_0x6ff9('0x2b')]);_0x4dc941[_0x6ff9('0x2e')]=_[_0x6ff9('0x40')](_0x275efc[_0x6ff9('0x2d')],qs[_0x6ff9('0x2f')](_0x30bd04[_0x6ff9('0x2b')][_0x6ff9('0x2f')]));_0x4dc941[_0x6ff9('0x2e')]=_0x4dc941[_0x6ff9('0x2e')][_0x6ff9('0x30')]?_0x4dc941[_0x6ff9('0x2e')]:_0x275efc['model'];if(!_0x30bd04['query'][_0x6ff9('0x31')](_0x6ff9('0x49'))){_0x4dc941[_0x6ff9('0x19')]=qs['limit'](_0x30bd04['query'][_0x6ff9('0x19')]);_0x4dc941[_0x6ff9('0x16')]=qs['offset'](_0x30bd04[_0x6ff9('0x2b')]['offset']);}_0x4dc941['order']=qs[_0x6ff9('0x33')](_0x30bd04[_0x6ff9('0x2b')]['sort']);_0x4dc941['where']=qs[_0x6ff9('0x2c')](_[_0x6ff9('0x35')](_0x30bd04['query'],_0x275efc['filters']));_0x4dc941['where'][_0x6ff9('0x4a')]=_0x1ff8f6['id'];if(_0x30bd04['query'][_0x6ff9('0x36')]){_0x4dc941[_0x6ff9('0x34')]=_[_0x6ff9('0x37')](_0x4dc941[_0x6ff9('0x34')],{'$or':_['map'](_0x4dc941['attributes'],function(_0x3332cc){var _0x230446={};_0x230446[_0x3332cc]={'$like':'%'+_0x30bd04[_0x6ff9('0x2b')][_0x6ff9('0x36')]+'%'};return _0x230446;})});}_0x4dc941=_[_0x6ff9('0x37')]({},_0x4dc941,_0x30bd04[_0x6ff9('0x41')]);return db[_0x6ff9('0x4b')][_0x6ff9('0x18')]({'where':_0x4dc941[_0x6ff9('0x34')]})[_0x6ff9('0x1f')](function(_0x4b856b){_0x681887['count']=_0x4b856b;if(_0x30bd04[_0x6ff9('0x2b')]['includeAll']){_0x4dc941['include']=[{'all':!![]}];}return db[_0x6ff9('0x4b')][_0x6ff9('0x3c')](_0x4dc941);})[_0x6ff9('0x1f')](function(_0x5ab380){_0x681887[_0x6ff9('0x4c')]=_0x5ab380;return _0x681887;});}})['then'](respondWithFilteredResult(_0x582a43,_0x4dc941))[_0x6ff9('0x42')](handleError(_0x582a43,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 4422c27..5341bb3 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 _0x2eb2=['moment','bluebird','request-promise','rimraf','exports','define','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger','api'];(function(_0x2e5f40,_0x4dd30f){var _0x1653ec=function(_0x24abd6){while(--_0x24abd6){_0x2e5f40['push'](_0x2e5f40['shift']());}};_0x1653ec(++_0x4dd30f);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x2eb2[_0x4d07cc];return _0x42de3b;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x22eb('0x7')]=function(_0x10e116,_0x35dd5b){return _0x10e116[_0x22eb('0x8')](_0x22eb('0x9'),attributes,{'tableName':_0x22eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3baf=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x3baf,0xf7));var _0xf3ba=function(_0x36cb4d,_0x2dc7aa){_0x36cb4d=_0x36cb4d-0x0;var _0x35ca7c=_0x3baf[_0x36cb4d];return _0x35ca7c;};'use strict';var _=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var logger=require(_0xf3ba('0x2'))(_0xf3ba('0x3'));var moment=require(_0xf3ba('0x4'));var BPromise=require(_0xf3ba('0x5'));var rp=require(_0xf3ba('0x6'));var fs=require('fs');var path=require(_0xf3ba('0x7'));var rimraf=require(_0xf3ba('0x8'));var config=require(_0xf3ba('0x9'));var attributes=require(_0xf3ba('0xa'));module[_0xf3ba('0xb')]=function(_0x475268,_0x2e6df2){return _0x475268[_0xf3ba('0xc')]('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 e7217f3..7ac1e64 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 _0x4325=['http','request','then','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client'];(function(_0xb14099,_0x136a28){var _0x41b125=function(_0x48232e){while(--_0x48232e){_0xb14099['push'](_0xb14099['shift']());}};_0x41b125(++_0x136a28);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});} \ No newline at end of file +var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0x524e,0x15e));var _0xe524=function(_0xb547f4,_0x4897cb){_0xb547f4=_0xb547f4-0x0;var _0x29c2ed=_0x524e[_0xb547f4];return _0x29c2ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 35a7b61..7d8de56 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 _0xa9e7=['put','isAuthenticated','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0xa9e7,0xfa));var _0x7a9e=function(_0x5225df,_0x3ac5fc){_0x5225df=_0x5225df-0x0;var _0x541a74=_0xa9e7[_0x5225df];return _0x541a74;};'use strict';var multer=require(_0x7a9e('0x0'));var util=require(_0x7a9e('0x1'));var path=require(_0x7a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7a9e('0x3'));var auth=require(_0x7a9e('0x4'));var interaction=require(_0x7a9e('0x5'));var config=require(_0x7a9e('0x6'));var controller=require(_0x7a9e('0x7'));router[_0x7a9e('0x8')]('/',controller[_0x7a9e('0x9')]);router[_0x7a9e('0xa')]('/:id',auth[_0x7a9e('0xb')](),controller['update']);module[_0x7a9e('0xc')]=router; \ No newline at end of file +var _0x1dcc=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','put','/:id','update','exports','multer','util','path','connect-timeout'];(function(_0x5bbc23,_0x2f7d0a){var _0x15a062=function(_0x39df96){while(--_0x39df96){_0x5bbc23['push'](_0x5bbc23['shift']());}};_0x15a062(++_0x2f7d0a);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x55aacc,_0x42c41d){_0x55aacc=_0x55aacc-0x0;var _0x520bcd=_0x1dcc[_0x55aacc];return _0x520bcd;};'use strict';var multer=require(_0xc1dc('0x0'));var util=require(_0xc1dc('0x1'));var path=require(_0xc1dc('0x2'));var timeout=require(_0xc1dc('0x3'));var express=require('express');var router=express[_0xc1dc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc1dc('0x5'));var interaction=require(_0xc1dc('0x6'));var config=require(_0xc1dc('0x7'));var controller=require('./license.controller');router['get']('/',controller[_0xc1dc('0x8')]);router[_0xc1dc('0x9')](_0xc1dc('0xa'),auth['isAuthenticated'](),controller[_0xc1dc('0xb')]);module[_0xc1dc('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 5549a74..8a4c61f 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 _0x5686=['INTEGER','TEXT','STRING'];(function(_0x233716,_0x346676){var _0x302298=function(_0x53d84c){while(--_0x53d84c){_0x233716['push'](_0x233716['shift']());}};_0x302298(++_0x346676);}(_0x5686,0x187));var _0x6568=function(_0x1177d5,_0x22b649){_0x1177d5=_0x1177d5-0x0;var _0xc3ddc2=_0x5686[_0x1177d5];return _0xc3ddc2;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0x6568('0x0')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x6568('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x6568('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x59bb=['STRING','sequelize','TEXT'];(function(_0x3ddb2,_0x386ec3){var _0x41cc1f=function(_0x13e620){while(--_0x13e620){_0x3ddb2['push'](_0x3ddb2['shift']());}};_0x41cc1f(++_0x386ec3);}(_0x59bb,0x109));var _0xb59b=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x59bb[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xb59b('0x0'));module['exports']={'license':{'type':Sequelize[_0xb59b('0x1')]},'data1':{'type':Sequelize[_0xb59b('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 5949a61..c4cad01 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 _0x0295=['demo','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','../../config/license/util','model','keys','rawAttributes','query','filters','intersection','attributes','fields','merge','options','catch','body','License','find','checkLicense','key'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x0295,0x1f0));var _0x5029=function(_0x35344a,_0x1790b6){_0x35344a=_0x35344a-0x0;var _0x285085=_0x0295[_0x35344a];return _0x285085;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}var utilLicense=require(_0x5029('0x25'));exports['index']=function(_0x32da06,_0x251f99){var _0xe5313e={'raw':!![],'where':{'id':0x1}},_0x4b6f92={};_0x4b6f92[_0x5029('0x26')]=_[_0x5029('0x27')](db['License'][_0x5029('0x28')]);_0x4b6f92[_0x5029('0x29')]=_[_0x5029('0x27')](_0x32da06[_0x5029('0x29')]);_0x4b6f92[_0x5029('0x2a')]=_[_0x5029('0x2b')](_0x4b6f92[_0x5029('0x26')],_0x4b6f92[_0x5029('0x29')]);_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2b')](_0x4b6f92[_0x5029('0x26')],qs[_0x5029('0x2d')](_0x32da06['query'][_0x5029('0x2d')]));_0xe5313e['attributes']=_0xe5313e[_0x5029('0x2c')]['length']?_0xe5313e['attributes']:_0x4b6f92[_0x5029('0x26')];_0xe5313e=_[_0x5029('0x2e')]({},_0xe5313e,_0x32da06[_0x5029('0x2f')]);return utilLicense['getLicense'](_0xe5313e)[_0x5029('0x20')](respondWithResult(_0x251f99,null))[_0x5029('0x30')](handleError(_0x251f99,null));};exports[_0x5029('0x1f')]=function(_0x29c59a,_0x1bb896){if(_0x29c59a[_0x5029('0x31')]['id']){delete _0x29c59a[_0x5029('0x31')]['id'];}return db[_0x5029('0x32')][_0x5029('0x33')]({'where':{'id':_0x29c59a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x1bb896,null))[_0x5029('0x20')](function(_0xc110e8){var _0x1b3817=_0xc110e8['get']({'plain':!![]});return utilLicense[_0x5029('0x34')](_0x1b3817,_0x29c59a[_0x5029('0x31')][_0x5029('0x35')]);})['then'](function(_0x4904cc){if(!_0x4904cc[_0x5029('0x36')]){return saveUpdates(_0x29c59a[_0x5029('0x31')],null);}return _0x4904cc;})['then'](respondWithResult(_0x1bb896,null))['catch'](handleError(_0x1bb896,null));}; \ No newline at end of file +var _0x326f=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','options','getLicense','catch','body','License','find','checkLicense','key','demo','eml-format','fast-json-patch','request-promise','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/logger','../../config/utils','../../config/license/util'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x326f,0xd1));var _0xf326=function(_0xb822a0,_0x48113f){_0xb822a0=_0xb822a0-0x0;var _0x36a447=_0x326f[_0xb822a0];return _0x36a447;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3162f9,_0x9ed463){_0x9ed463=_0x9ed463||0xcc;return function(_0x4b3966){if(_0x4b3966){return _0x3162f9[_0xf326('0x17')](_0x9ed463);}return _0x3162f9[_0xf326('0x18')](_0x9ed463)[_0xf326('0x19')]();};}function respondWithResult(_0x17a098,_0x5c8483){_0x5c8483=_0x5c8483||0xc8;return function(_0x45c1b6){if(_0x45c1b6){return _0x17a098['status'](_0x5c8483)['json'](_0x45c1b6);}};}function respondWithFilteredResult(_0xdf21d9,_0x11f6d2){return function(_0x1f2e5a){if(_0x1f2e5a){var _0xa63d1a=typeof _0x11f6d2[_0xf326('0x1a')]===_0xf326('0x1b')&&typeof _0x11f6d2[_0xf326('0x1c')]===_0xf326('0x1b');var _0x5a682a=_0x1f2e5a[_0xf326('0x1d')];var _0x453100=_0xa63d1a?0x0:_0x11f6d2[_0xf326('0x1a')];var _0x31ffb9=_0xa63d1a?_0x1f2e5a[_0xf326('0x1d')]:_0x11f6d2[_0xf326('0x1a')]+_0x11f6d2['limit'];var _0x4a5b6c;if(_0x31ffb9>=_0x5a682a){_0x31ffb9=_0x5a682a;_0x4a5b6c=0xc8;}else{_0x4a5b6c=0xce;}_0xdf21d9['status'](_0x4a5b6c);return _0xdf21d9[_0xf326('0x1e')](_0xf326('0x1f'),_0x453100+'-'+_0x31ffb9+'/'+_0x5a682a)['json'](_0x1f2e5a);}return null;};}function patchUpdates(_0x4cabce){return function(_0x128c68){try{jsonpatch['apply'](_0x128c68,_0x4cabce,!![]);}catch(_0x5b6d3c){return BPromise[_0xf326('0x20')](_0x5b6d3c);}return _0x128c68[_0xf326('0x21')]();};}function saveUpdates(_0x549b46,_0x5aa184){return function(_0x19b8ba){if(_0x19b8ba){return _0x19b8ba[_0xf326('0x22')](_0x549b46)['then'](function(_0x337ed5){return _0x337ed5;});}return null;};}function removeEntity(_0x1b9039,_0x43c53e){return function(_0x295752){if(_0x295752){return _0x295752[_0xf326('0x23')]()[_0xf326('0x24')](function(){_0x1b9039['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f31f6,_0x520d85){return function(_0x1a2c4e){if(!_0x1a2c4e){_0x4f31f6[_0xf326('0x17')](0x194);}return _0x1a2c4e;};}function handleError(_0x1ff2b5,_0x148953){_0x148953=_0x148953||0x1f4;return function(_0x410237){logger['error'](_0x410237[_0xf326('0x25')]);if(_0x410237[_0xf326('0x26')]){delete _0x410237[_0xf326('0x26')];}_0x1ff2b5['status'](_0x148953)[_0xf326('0x27')](_0x410237);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x6a8e89,_0x1ae23a){var _0x2fa28e={'raw':!![],'where':{'id':0x1}},_0x5dbe63={};_0x5dbe63[_0xf326('0x28')]=_[_0xf326('0x29')](db['License'][_0xf326('0x2a')]);_0x5dbe63[_0xf326('0x2b')]=_[_0xf326('0x29')](_0x6a8e89[_0xf326('0x2b')]);_0x5dbe63[_0xf326('0x2c')]=_[_0xf326('0x2d')](_0x5dbe63[_0xf326('0x28')],_0x5dbe63[_0xf326('0x2b')]);_0x2fa28e[_0xf326('0x2e')]=_[_0xf326('0x2d')](_0x5dbe63['model'],qs[_0xf326('0x2f')](_0x6a8e89[_0xf326('0x2b')][_0xf326('0x2f')]));_0x2fa28e['attributes']=_0x2fa28e[_0xf326('0x2e')][_0xf326('0x30')]?_0x2fa28e[_0xf326('0x2e')]:_0x5dbe63['model'];_0x2fa28e=_['merge']({},_0x2fa28e,_0x6a8e89[_0xf326('0x31')]);return utilLicense[_0xf326('0x32')](_0x2fa28e)[_0xf326('0x24')](respondWithResult(_0x1ae23a,null))[_0xf326('0x33')](handleError(_0x1ae23a,null));};exports[_0xf326('0x22')]=function(_0x2e8a64,_0x62585a){if(_0x2e8a64[_0xf326('0x34')]['id']){delete _0x2e8a64['body']['id'];}return db[_0xf326('0x35')][_0xf326('0x36')]({'where':{'id':_0x2e8a64['params']['id']}})[_0xf326('0x24')](handleEntityNotFound(_0x62585a,null))['then'](function(_0xce1cbb){var _0x481b64=_0xce1cbb['get']({'plain':!![]});return utilLicense[_0xf326('0x37')](_0x481b64,_0x2e8a64['body'][_0xf326('0x38')]);})['then'](function(_0x310dbb){if(!_0x310dbb[_0xf326('0x39')]){return saveUpdates(_0x2e8a64[_0xf326('0x34')],null);}return _0x310dbb;})['then'](respondWithResult(_0x62585a,null))[_0xf326('0x33')](handleError(_0x62585a,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index e504228..2730f49 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 _0x6cde=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','License'];(function(_0x1d0dd7,_0x9355c7){var _0x3d45fb=function(_0x16a409){while(--_0x16a409){_0x1d0dd7['push'](_0x1d0dd7['shift']());}};_0x3d45fb(++_0x9355c7);}(_0x6cde,0xfd));var _0xe6cd=function(_0x3d8e9b,_0x3b55a1){_0x3d8e9b=_0x3d8e9b-0x0;var _0x4d70de=_0x6cde[_0x3d8e9b];return _0x4d70de;};'use strict';var _=require(_0xe6cd('0x0'));var util=require(_0xe6cd('0x1'));var logger=require(_0xe6cd('0x2'))(_0xe6cd('0x3'));var moment=require('moment');var BPromise=require(_0xe6cd('0x4'));var rp=require(_0xe6cd('0x5'));var fs=require('fs');var path=require(_0xe6cd('0x6'));var rimraf=require(_0xe6cd('0x7'));var config=require(_0xe6cd('0x8'));var attributes=require('./license.attributes');module[_0xe6cd('0x9')]=function(_0x2698f2,_0x5dca6c){return _0x2698f2['define'](_0xe6cd('0xa'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bb1=['api','request-promise','path','rimraf','./license.attributes','define','License','license','lodash','util','../../config/logger'];(function(_0x108f0e,_0x8389ce){var _0x1528eb=function(_0x4ba08d){while(--_0x4ba08d){_0x108f0e['push'](_0x108f0e['shift']());}};_0x1528eb(++_0x8389ce);}(_0x5bb1,0x1d6));var _0x15bb=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5bb1[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x15bb('0x0'));var util=require(_0x15bb('0x1'));var logger=require(_0x15bb('0x2'))(_0x15bb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x15bb('0x4'));var fs=require('fs');var path=require(_0x15bb('0x5'));var rimraf=require(_0x15bb('0x6'));var config=require('../../config/environment');var attributes=require(_0x15bb('0x7'));module['exports']=function(_0x14e214,_0xcd6d05){return _0x14e214[_0x15bb('0x8')](_0x15bb('0x9'),attributes,{'tableName':_0x15bb('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 467cbb0..4e4444f 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 _0xe906=['client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x39d260,_0x1b3420){var _0x26d031=function(_0x427eb4){while(--_0x427eb4){_0x39d260['push'](_0x39d260['shift']());}};_0x26d031(++_0x1b3420);}(_0xe906,0x15a));var _0x6e90=function(_0x2dc6c7,_0x5eba22){_0x2dc6c7=_0x2dc6c7-0x0;var _0x6721e3=_0xe906[_0x2dc6c7];return _0x6721e3;};'use strict';var _=require(_0x6e90('0x0'));var util=require(_0x6e90('0x1'));var moment=require('moment');var BPromise=require(_0x6e90('0x2'));var rs=require(_0x6e90('0x3'));var fs=require('fs');var Redis=require(_0x6e90('0x4'));var db=require(_0x6e90('0x5'))['db'];var utils=require(_0x6e90('0x6'));var logger=require(_0x6e90('0x7'))(_0x6e90('0x8'));var config=require(_0x6e90('0x9'));var jayson=require(_0x6e90('0xa'));var client=jayson[_0x6e90('0xb')][_0x6e90('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa3aec4,_0x58d23a,_0x86735a){return new BPromise(function(_0x2d54eb,_0x3b91b1){return client[_0x6e90('0xd')](_0xa3aec4,_0x86735a)[_0x6e90('0xe')](function(_0x5efe78){logger[_0x6e90('0xf')](_0x6e90('0x10'),_0x58d23a,_0x6e90('0x11'));logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x58d23a,_0x6e90('0x11'),JSON[_0x6e90('0x12')](_0x5efe78));if(_0x5efe78[_0x6e90('0x13')]){if(_0x5efe78['error']['code']===0x1f4){logger[_0x6e90('0x13')](_0x6e90('0x10'),_0x58d23a,_0x5efe78[_0x6e90('0x13')]['message']);return _0x3b91b1(_0x5efe78[_0x6e90('0x13')]['message']);}logger[_0x6e90('0x13')]('License,\x20%s,\x20%s',_0x58d23a,_0x5efe78['error'][_0x6e90('0x14')]);return _0x2d54eb(_0x5efe78[_0x6e90('0x13')][_0x6e90('0x14')]);}else{logger[_0x6e90('0xf')](_0x6e90('0x10'),_0x58d23a,_0x6e90('0x11'));_0x2d54eb(_0x5efe78['result'][_0x6e90('0x14')]);}})['catch'](function(_0x3f89a3){logger['error'](_0x6e90('0x10'),_0x58d23a,_0x3f89a3);_0x3b91b1(_0x3f89a3);});});} \ No newline at end of file +var _0x05e4=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x228fa9,_0x1768f4){var _0x49edfc=function(_0x44ae43){while(--_0x44ae43){_0x228fa9['push'](_0x228fa9['shift']());}};_0x49edfc(++_0x1768f4);}(_0x05e4,0x137));var _0x405e=function(_0x3c352a,_0xf991a5){_0x3c352a=_0x3c352a-0x0;var _0x56da81=_0x05e4[_0x3c352a];return _0x56da81;};'use strict';var _=require(_0x405e('0x0'));var util=require(_0x405e('0x1'));var moment=require(_0x405e('0x2'));var BPromise=require(_0x405e('0x3'));var rs=require(_0x405e('0x4'));var fs=require('fs');var Redis=require(_0x405e('0x5'));var db=require(_0x405e('0x6'))['db'];var utils=require(_0x405e('0x7'));var logger=require(_0x405e('0x8'))(_0x405e('0x9'));var config=require(_0x405e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x405e('0xb')][_0x405e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d7390,_0x5a65fd,_0x200829){return new BPromise(function(_0x3e1301,_0x2ca4e8){return client[_0x405e('0xd')](_0x2d7390,_0x200829)['then'](function(_0x4ca3cd){logger['info'](_0x405e('0xe'),_0x5a65fd,_0x405e('0xf'));logger[_0x405e('0x10')](_0x405e('0x11'),_0x5a65fd,_0x405e('0xf'),JSON[_0x405e('0x12')](_0x4ca3cd));if(_0x4ca3cd[_0x405e('0x13')]){if(_0x4ca3cd[_0x405e('0x13')][_0x405e('0x14')]===0x1f4){logger[_0x405e('0x13')](_0x405e('0xe'),_0x5a65fd,_0x4ca3cd[_0x405e('0x13')][_0x405e('0x15')]);return _0x2ca4e8(_0x4ca3cd['error'][_0x405e('0x15')]);}logger[_0x405e('0x13')](_0x405e('0xe'),_0x5a65fd,_0x4ca3cd['error'][_0x405e('0x15')]);return _0x3e1301(_0x4ca3cd[_0x405e('0x13')][_0x405e('0x15')]);}else{logger['info'](_0x405e('0xe'),_0x5a65fd,'request\x20sent');_0x3e1301(_0x4ca3cd[_0x405e('0x16')]['message']);}})[_0x405e('0x17')](function(_0x4f0f56){logger[_0x405e('0x13')](_0x405e('0xe'),_0x5a65fd,_0x4f0f56);_0x2ca4e8(_0x4f0f56);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 15c887c..541e6c6 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 _0x59cb=['Router','fs-extra','./mailAccount.controller','isAuthenticated','/describe','describe','get','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/in_servers','/:id/out_servers','/:id/interactions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeSmtp','destroy','removeAgents','exports','path','connect-timeout','express'];(function(_0x2e5975,_0x5d56ee){var _0x99cd95=function(_0x2edba4){while(--_0x2edba4){_0x2e5975['push'](_0x2e5975['shift']());}};_0x99cd95(++_0x5d56ee);}(_0x59cb,0xa5));var _0xb59c=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x59cb[_0x465a0c];return _0x1e202e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb59c('0x0'));var timeout=require(_0xb59c('0x1'));var express=require(_0xb59c('0x2'));var router=express[_0xb59c('0x3')]();var fs_extra=require(_0xb59c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb59c('0x5'));router['get']('/',auth[_0xb59c('0x6')](),controller['index']);router['get'](_0xb59c('0x7'),auth['isAuthenticated'](),controller[_0xb59c('0x8')]);router[_0xb59c('0x9')](_0xb59c('0xa'),auth[_0xb59c('0x6')](),controller[_0xb59c('0xb')]);router['get'](_0xb59c('0xc'),auth[_0xb59c('0x6')](),controller['getDispositions']);router[_0xb59c('0x9')](_0xb59c('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xb59c('0x9')](_0xb59c('0xe'),auth[_0xb59c('0x6')](),controller['getImap']);router['get'](_0xb59c('0xf'),auth[_0xb59c('0x6')](),controller['getSmtp']);router['get'](_0xb59c('0x10'),auth[_0xb59c('0x6')](),controller['getInteractions']);router['get'](_0xb59c('0x11'),auth[_0xb59c('0x6')](),controller[_0xb59c('0x12')]);router['get'](_0xb59c('0x13'),auth['isAuthenticated'](),controller['getMessages']);router[_0xb59c('0x9')](_0xb59c('0x14'),auth['isAuthenticated'](),controller[_0xb59c('0x15')]);router[_0xb59c('0x9')](_0xb59c('0x16'),auth['isAuthenticated'](),controller[_0xb59c('0x17')]);router[_0xb59c('0x18')](_0xb59c('0xc'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xb59c('0x18')](_0xb59c('0xd'),auth[_0xb59c('0x6')](),controller[_0xb59c('0x19')]);router[_0xb59c('0x18')]('/',auth[_0xb59c('0x6')](),controller['create']);router[_0xb59c('0x18')](_0xb59c('0xe'),auth[_0xb59c('0x6')](),controller[_0xb59c('0x1a')]);router[_0xb59c('0x18')](_0xb59c('0xf'),auth[_0xb59c('0x6')](),controller[_0xb59c('0x1b')]);router[_0xb59c('0x18')](_0xb59c('0x10'),auth[_0xb59c('0x6')](),controller[_0xb59c('0x1c')]);router['post'](_0xb59c('0x11'),auth[_0xb59c('0x6')](),controller[_0xb59c('0x1d')]);router['post'](_0xb59c('0x1e'),auth[_0xb59c('0x6')](),controller[_0xb59c('0x1f')]);router[_0xb59c('0x18')](_0xb59c('0x16'),auth['isAuthenticated'](),controller[_0xb59c('0x20')]);router[_0xb59c('0x21')](_0xb59c('0xa'),auth[_0xb59c('0x6')](),controller[_0xb59c('0x22')]);router[_0xb59c('0x23')](_0xb59c('0xc'),auth[_0xb59c('0x6')](),controller[_0xb59c('0x24')]);router[_0xb59c('0x23')](_0xb59c('0xd'),auth['isAuthenticated'](),controller[_0xb59c('0x25')]);router[_0xb59c('0x23')]('/:id/in_servers',auth['isAuthenticated'](),controller['removeImap']);router[_0xb59c('0x23')](_0xb59c('0xf'),auth[_0xb59c('0x6')](),controller[_0xb59c('0x26')]);router[_0xb59c('0x23')](_0xb59c('0xa'),auth[_0xb59c('0x6')](),controller[_0xb59c('0x27')]);router[_0xb59c('0x23')](_0xb59c('0x16'),auth[_0xb59c('0x6')](),controller[_0xb59c('0x28')]);module[_0xb59c('0x29')]=router; \ No newline at end of file +var _0x5150=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','/:id/dispositions','post','create','/:id/in_servers','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer'];(function(_0x4b6949,_0x1887a2){var _0xe5d552=function(_0x1bc451){while(--_0x1bc451){_0x4b6949['push'](_0x4b6949['shift']());}};_0xe5d552(++_0x1887a2);}(_0x5150,0x1d5));var _0x0515=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0x5150[_0x40be86];return _0xda3c3b;};'use strict';var multer=require(_0x0515('0x0'));var util=require('util');var path=require(_0x0515('0x1'));var timeout=require('connect-timeout');var express=require(_0x0515('0x2'));var router=express[_0x0515('0x3')]();var fs_extra=require(_0x0515('0x4'));var auth=require(_0x0515('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0515('0x6'));var controller=require(_0x0515('0x7'));router[_0x0515('0x8')]('/',auth[_0x0515('0x9')](),controller[_0x0515('0xa')]);router[_0x0515('0x8')](_0x0515('0xb'),auth['isAuthenticated'](),controller[_0x0515('0xc')]);router[_0x0515('0x8')](_0x0515('0xd'),auth[_0x0515('0x9')](),controller[_0x0515('0xe')]);router[_0x0515('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x0515('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x0515('0x8')]('/:id/in_servers',auth[_0x0515('0x9')](),controller['getImap']);router[_0x0515('0x8')](_0x0515('0x10'),auth[_0x0515('0x9')](),controller[_0x0515('0x11')]);router[_0x0515('0x8')](_0x0515('0x12'),auth[_0x0515('0x9')](),controller['getInteractions']);router[_0x0515('0x8')](_0x0515('0x13'),auth[_0x0515('0x9')](),controller[_0x0515('0x14')]);router[_0x0515('0x8')](_0x0515('0x15'),auth[_0x0515('0x9')](),controller['getMessages']);router[_0x0515('0x8')](_0x0515('0x16'),auth[_0x0515('0x9')](),controller[_0x0515('0x17')]);router['get'](_0x0515('0x18'),auth['isAuthenticated'](),controller[_0x0515('0x19')]);router['post'](_0x0515('0x1a'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x0515('0x1b')]('/:id/canned_answers',auth[_0x0515('0x9')](),controller['addAnswer']);router[_0x0515('0x1b')]('/',auth['isAuthenticated'](),controller[_0x0515('0x1c')]);router[_0x0515('0x1b')](_0x0515('0x1d'),auth[_0x0515('0x9')](),controller[_0x0515('0x1e')]);router['post']('/:id/out_servers',auth[_0x0515('0x9')](),controller[_0x0515('0x1f')]);router[_0x0515('0x1b')](_0x0515('0x12'),auth[_0x0515('0x9')](),controller[_0x0515('0x20')]);router[_0x0515('0x1b')](_0x0515('0x13'),auth[_0x0515('0x9')](),controller[_0x0515('0x21')]);router['post'](_0x0515('0x22'),auth[_0x0515('0x9')](),controller[_0x0515('0x23')]);router[_0x0515('0x1b')]('/:id/users',auth['isAuthenticated'](),controller[_0x0515('0x24')]);router[_0x0515('0x25')](_0x0515('0xd'),auth[_0x0515('0x9')](),controller[_0x0515('0x26')]);router[_0x0515('0x27')](_0x0515('0x1a'),auth[_0x0515('0x9')](),controller[_0x0515('0x28')]);router[_0x0515('0x27')](_0x0515('0xf'),auth[_0x0515('0x9')](),controller[_0x0515('0x29')]);router[_0x0515('0x27')](_0x0515('0x1d'),auth[_0x0515('0x9')](),controller[_0x0515('0x2a')]);router['delete'](_0x0515('0x10'),auth[_0x0515('0x9')](),controller[_0x0515('0x2b')]);router['delete'](_0x0515('0xd'),auth[_0x0515('0x9')](),controller[_0x0515('0x2c')]);router[_0x0515('0x27')]('/:id/users',auth[_0x0515('0x9')](),controller[_0x0515('0x2d')]);module[_0x0515('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 7cd82e3..4a2e27a 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 _0x3036=['setDataValue','mandatoryDispositionPauseId','STRING','BOOLEAN','INTEGER','UNSIGNED','TEXT','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3bb8a8,_0xbba59d){var _0x1c0921=function(_0x1cdd8d){while(--_0x1cdd8d){_0x3bb8a8['push'](_0x3bb8a8['shift']());}};_0x1c0921(++_0xbba59d);}(_0x3036,0x1a9));var _0x6303=function(_0x24420f,_0x3e3f1d){_0x24420f=_0x24420f-0x0;var _0x502e30=_0x3036[_0x24420f];return _0x502e30;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x6303('0x0')]},'name':{'type':Sequelize[_0x6303('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0x6303('0x1')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x6303('0x1')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x6303('0x0')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x6303('0x2')](0x2)[_0x6303('0x3')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x6303('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x6303('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6303('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6303('0x2')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6303('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6303('0x2')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6303('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6303('0x2')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6303('0x2')],'allowNull':!![],'defaultValue':null,'comment':_0x6303('0x5')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6303('0x6'),'set':function(_0x24aa6c){if(!_0x24aa6c)this[_0x6303('0x7')](_0x6303('0x8'),null);this[_0x6303('0x7')]('mandatoryDisposition',_0x24aa6c);}}}; \ No newline at end of file +var _0x1159=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','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}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x48c4ef,_0x319d44){var _0x435715=function(_0x925d50){while(--_0x925d50){_0x48c4ef['push'](_0x48c4ef['shift']());}};_0x435715(++_0x319d44);}(_0x1159,0xf3));var _0x9115=function(_0x13216d,_0x22e39c){_0x13216d=_0x13216d-0x0;var _0x176e76=_0x1159[_0x13216d];return _0x176e76;};'use strict';var Sequelize=require(_0x9115('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x9115('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x9115('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x9115('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9115('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x9115('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x9115('0x3')]},'markAsUnread':{'type':Sequelize[_0x9115('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x9115('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x9115('0x4')](0x2)[_0x9115('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9115('0x3')],'defaultValue':function(){return _0x9115('0x6');}},'notificationSound':{'type':Sequelize[_0x9115('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9115('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9115('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9115('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9115('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x9115('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9115('0x8'),'set':function(_0x170177){if(!_0x170177)this[_0x9115('0x9')](_0x9115('0xa'),null);this['setDataValue'](_0x9115('0xb'),_0x170177);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index d8858d6..415e77d 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 _0xb288=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','body','Imap','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','rawAttributes','pick','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','cpassword','authentication','host','port','service','pass','MailServerIn','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','MailApplication','priority','getApplications','$gte','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','split','List','Contacts','DESC','from','format','%s\x20<%s>','attachments','root','basename','auth','SendMail','sendMail','List\x20not\x20found','messageId','attach','Interaction','Messages','verifySmtp','secure','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./mailAccount.socket','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','update','destroy','get','UserProfileResource','stack','name','send','index','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key'];(function(_0x14c0f2,_0x142813){var _0x3560c3=function(_0x530ce0){while(--_0x530ce0){_0x14c0f2['push'](_0x14c0f2['shift']());}};_0x3560c3(++_0x142813);}(_0xb288,0x13d));var _0x8b28=function(_0x57d6e7,_0x50b5ee){_0x57d6e7=_0x57d6e7-0x0;var _0x17b2ba=_0xb288[_0x57d6e7];return _0x17b2ba;};'use strict';var emlformat=require(_0x8b28('0x0'));var rimraf=require(_0x8b28('0x1'));var zipdir=require(_0x8b28('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b28('0x3'));var moment=require(_0x8b28('0x4'));var BPromise=require(_0x8b28('0x5'));var Mustache=require(_0x8b28('0x6'));var util=require(_0x8b28('0x7'));var path=require(_0x8b28('0x8'));var sox=require('sox');var csv=require(_0x8b28('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b28('0xa'));var _=require(_0x8b28('0xb'));var squel=require(_0x8b28('0xc'));var crypto=require(_0x8b28('0xd'));var jsforce=require(_0x8b28('0xe'));var deskjs=require(_0x8b28('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8b28('0x10'));var Papa=require(_0x8b28('0x11'));var htmlToText=require(_0x8b28('0x12'));var juice=require(_0x8b28('0x13'));var Redis=require(_0x8b28('0x14'));var authService=require(_0x8b28('0x15'));var qs=require(_0x8b28('0x16'));var as=require(_0x8b28('0x17'));var hardwareService=require(_0x8b28('0x18'));var logger=require('../../config/logger')(_0x8b28('0x19'));var utils=require(_0x8b28('0x1a'));var config=require(_0x8b28('0x1b'));var licenseUtil=require(_0x8b28('0x1c'));var db=require(_0x8b28('0x1d'))['db'];config['redis']=_[_0x8b28('0x1e')](config[_0x8b28('0x1f')],{'host':_0x8b28('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8b28('0x21'))['register'](socket);var jayson=require(_0x8b28('0x22'));var client=jayson[_0x8b28('0x23')][_0x8b28('0x24')]({'port':0x232b});function respondWithRpcPromise(_0x59d4c1,_0x250090,_0xb432c1,_0x283ad1){return new BPromise(function(_0x2268c1,_0x48290a){var _0x10d26d=_0x283ad1||client;return _0x10d26d[_0x8b28('0x25')](_0x59d4c1,_0xb432c1)[_0x8b28('0x26')](function(_0x10d0be){logger[_0x8b28('0x27')](_0x8b28('0x28'),_0x250090,'request\x20sent');logger[_0x8b28('0x29')](_0x8b28('0x2a'),_0x250090,'request\x20sent',JSON[_0x8b28('0x2b')](_0x10d0be));if(_0x10d0be[_0x8b28('0x2c')]){if(_0x10d0be[_0x8b28('0x2c')]['code']===0x1f4){logger['error'](_0x8b28('0x28'),_0x250090,_0x10d0be[_0x8b28('0x2c')][_0x8b28('0x2d')]);return _0x48290a(_0x10d0be['error'][_0x8b28('0x2d')]);}logger[_0x8b28('0x2c')](_0x8b28('0x28'),_0x250090,_0x10d0be[_0x8b28('0x2c')][_0x8b28('0x2d')]);return _0x2268c1(_0x10d0be[_0x8b28('0x2c')][_0x8b28('0x2d')]);}else{logger[_0x8b28('0x27')](_0x8b28('0x28'),_0x250090,_0x8b28('0x2e'));_0x2268c1(_0x10d0be[_0x8b28('0x2f')][_0x8b28('0x2d')]);}})['catch'](function(_0x23e67b){logger[_0x8b28('0x2c')](_0x8b28('0x28'),_0x250090,_0x23e67b);_0x48290a(_0x23e67b);});});}function respondWithStatusCode(_0x24bad5,_0x524353){_0x524353=_0x524353||0xcc;return function(_0x1aff8a){if(_0x1aff8a){return _0x24bad5[_0x8b28('0x30')](_0x524353);}return _0x24bad5[_0x8b28('0x31')](_0x524353)[_0x8b28('0x32')]();};}function respondWithResult(_0x52c3f9,_0x5535e8){_0x5535e8=_0x5535e8||0xc8;return function(_0x313125){if(_0x313125){return _0x52c3f9[_0x8b28('0x31')](_0x5535e8)[_0x8b28('0x33')](_0x313125);}};}function respondWithFilteredResult(_0x4296d3,_0x2d6d13){return function(_0x55bd35){if(_0x55bd35){var _0x3ebaa0=typeof _0x2d6d13['offset']==='undefined'&&typeof _0x2d6d13[_0x8b28('0x34')]===_0x8b28('0x35');var _0x37d6d6=_0x55bd35['count'];var _0x12d3a5=_0x3ebaa0?0x0:_0x2d6d13[_0x8b28('0x36')];var _0x1d7939=_0x3ebaa0?_0x55bd35[_0x8b28('0x37')]:_0x2d6d13[_0x8b28('0x36')]+_0x2d6d13[_0x8b28('0x34')];var _0x5e40ee;if(_0x1d7939>=_0x37d6d6){_0x1d7939=_0x37d6d6;_0x5e40ee=0xc8;}else{_0x5e40ee=0xce;}_0x4296d3[_0x8b28('0x31')](_0x5e40ee);return _0x4296d3[_0x8b28('0x38')](_0x8b28('0x39'),_0x12d3a5+'-'+_0x1d7939+'/'+_0x37d6d6)['json'](_0x55bd35);}return null;};}function patchUpdates(_0x2b0964){return function(_0xb530c6){try{jsonpatch['apply'](_0xb530c6,_0x2b0964,!![]);}catch(_0x1f68d4){return BPromise['reject'](_0x1f68d4);}return _0xb530c6['save']();};}function saveUpdates(_0x2477ea,_0xd7f1c9){return function(_0x50cd6c){if(_0x50cd6c){return _0x50cd6c[_0x8b28('0x3a')](_0x2477ea)[_0x8b28('0x26')](function(_0x524ee6){return _0x524ee6;});}return null;};}function removeEntity(_0x38627c,_0x30a1eb){return function(_0x491575){if(_0x491575){return _0x491575[_0x8b28('0x3b')]()[_0x8b28('0x26')](function(){var _0x4c0f77=_0x491575[_0x8b28('0x3c')]({'plain':!![]});var _0x342f0e='MailAccounts';return db[_0x8b28('0x3d')]['destroy']({'where':{'type':_0x342f0e,'resourceId':_0x4c0f77['id']}})[_0x8b28('0x26')](function(){return _0x491575;});})[_0x8b28('0x26')](function(){_0x38627c[_0x8b28('0x31')](0xcc)[_0x8b28('0x32')]();});}};}function handleEntityNotFound(_0xde7b9e,_0x586502){return function(_0x4ee14b){if(!_0x4ee14b){_0xde7b9e[_0x8b28('0x30')](0x194);}return _0x4ee14b;};}function handleError(_0x576d9e,_0x396d9c){_0x396d9c=_0x396d9c||0x1f4;return function(_0x4ff956){logger[_0x8b28('0x2c')](_0x4ff956[_0x8b28('0x3e')]);if(_0x4ff956[_0x8b28('0x3f')]){delete _0x4ff956[_0x8b28('0x3f')];}_0x576d9e[_0x8b28('0x31')](_0x396d9c)[_0x8b28('0x40')](_0x4ff956);};}exports[_0x8b28('0x41')]=function(_0x54378e,_0x3db6db){var _0x21eb11={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x8b28('0x42')],'as':_0x8b28('0x43')},{'model':db[_0x8b28('0x44')],'as':_0x8b28('0x45')}]},_0x4ddfe2={},_0x1bff76={'count':0x0,'rows':[]};var _0x3274a0=_[_0x8b28('0x46')](db[_0x8b28('0x47')]['rawAttributes'],function(_0x315812){return{'name':_0x315812[_0x8b28('0x48')],'type':_0x315812[_0x8b28('0x49')][_0x8b28('0x4a')]};});_0x4ddfe2['model']=_[_0x8b28('0x46')](_0x3274a0,_0x8b28('0x3f'));_0x4ddfe2[_0x8b28('0x4b')]=_[_0x8b28('0x4c')](_0x54378e[_0x8b28('0x4b')]);_0x4ddfe2[_0x8b28('0x4d')]=_[_0x8b28('0x4e')](_0x4ddfe2[_0x8b28('0x4f')],_0x4ddfe2[_0x8b28('0x4b')]);_0x21eb11[_0x8b28('0x50')]=_['intersection'](_0x4ddfe2[_0x8b28('0x4f')],qs[_0x8b28('0x51')](_0x54378e[_0x8b28('0x4b')][_0x8b28('0x51')]));_0x21eb11[_0x8b28('0x50')]=_0x21eb11[_0x8b28('0x50')][_0x8b28('0x52')]?_0x21eb11['attributes']:_0x4ddfe2[_0x8b28('0x4f')];if(!_0x54378e[_0x8b28('0x4b')][_0x8b28('0x53')](_0x8b28('0x54'))){_0x21eb11[_0x8b28('0x34')]=qs['limit'](_0x54378e[_0x8b28('0x4b')][_0x8b28('0x34')]);_0x21eb11[_0x8b28('0x36')]=qs[_0x8b28('0x36')](_0x54378e[_0x8b28('0x4b')]['offset']);}_0x21eb11[_0x8b28('0x55')]=qs[_0x8b28('0x56')](_0x54378e[_0x8b28('0x4b')][_0x8b28('0x56')]);_0x21eb11[_0x8b28('0x57')]=qs[_0x8b28('0x4d')](_['pick'](_0x54378e['query'],_0x4ddfe2['filters']),_0x3274a0);if(_0x54378e[_0x8b28('0x4b')][_0x8b28('0x58')]){_0x21eb11[_0x8b28('0x57')]=_[_0x8b28('0x59')](_0x21eb11[_0x8b28('0x57')],{'$or':_[_0x8b28('0x46')](_0x3274a0,function(_0x2bf222){if(_0x2bf222['type']!==_0x8b28('0x5a')){var _0x21effe={};_0x21effe[_0x2bf222[_0x8b28('0x3f')]]={'$like':'%'+_0x54378e[_0x8b28('0x4b')][_0x8b28('0x58')]+'%'};return _0x21effe;}})});}_0x21eb11=_[_0x8b28('0x59')]({},_0x21eb11,_0x54378e['options']);var _0x383a8f={'where':_0x21eb11[_0x8b28('0x57')]};return db[_0x8b28('0x47')]['count'](_0x383a8f)[_0x8b28('0x26')](function(_0xaa1732){_0x1bff76[_0x8b28('0x37')]=_0xaa1732;if(_0x54378e[_0x8b28('0x4b')][_0x8b28('0x5b')]){_0x21eb11['include']=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x21eb11);})[_0x8b28('0x26')](function(_0x5d2a2d){_0x1bff76[_0x8b28('0x5c')]=_0x5d2a2d;return _0x1bff76;})[_0x8b28('0x26')](respondWithFilteredResult(_0x3db6db,_0x21eb11))[_0x8b28('0x5d')](handleError(_0x3db6db,null));};exports[_0x8b28('0x5e')]=function(_0x55e790,_0x2ae0a2){var _0x98615d={'raw':![],'where':{'id':_0x55e790[_0x8b28('0x5f')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x8b28('0x42')],'as':_0x8b28('0x43')},{'model':db[_0x8b28('0x44')],'as':_0x8b28('0x45')}]},_0x347fc1={};_0x347fc1['model']=_[_0x8b28('0x4c')](db[_0x8b28('0x47')]['rawAttributes']);_0x347fc1[_0x8b28('0x4b')]=_[_0x8b28('0x4c')](_0x55e790['query']);_0x347fc1[_0x8b28('0x4d')]=_[_0x8b28('0x4e')](_0x347fc1['model'],_0x347fc1['query']);_0x98615d[_0x8b28('0x50')]=_[_0x8b28('0x4e')](_0x347fc1['model'],qs[_0x8b28('0x51')](_0x55e790[_0x8b28('0x4b')][_0x8b28('0x51')]));_0x98615d[_0x8b28('0x50')]=_0x98615d[_0x8b28('0x50')][_0x8b28('0x52')]?_0x98615d[_0x8b28('0x50')]:_0x347fc1[_0x8b28('0x4f')];if(_0x55e790[_0x8b28('0x4b')]['includeAll']){_0x98615d[_0x8b28('0x60')]=[{'all':!![]}];}_0x98615d=_[_0x8b28('0x59')]({},_0x98615d,_0x55e790[_0x8b28('0x61')]);return db[_0x8b28('0x47')][_0x8b28('0x62')](_0x98615d)[_0x8b28('0x26')](handleEntityNotFound(_0x2ae0a2,null))[_0x8b28('0x26')](respondWithResult(_0x2ae0a2,null))[_0x8b28('0x5d')](handleError(_0x2ae0a2,null));};exports[_0x8b28('0x3a')]=function(_0x58d4c7,_0x4d6463){if(_0x58d4c7[_0x8b28('0x63')]['id']){delete _0x58d4c7[_0x8b28('0x63')]['id'];}return db['MailAccount'][_0x8b28('0x62')]({'where':{'id':_0x58d4c7[_0x8b28('0x5f')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x8b28('0x42')],'as':_0x8b28('0x43')},{'model':db[_0x8b28('0x44')],'as':_0x8b28('0x45')}]})['then'](handleEntityNotFound(_0x4d6463,null))['then'](saveUpdates(_0x58d4c7[_0x8b28('0x63')],null))[_0x8b28('0x26')](function(_0x3b3118){if(_0x3b3118&&_0x58d4c7[_0x8b28('0x63')][_0x8b28('0x64')]){return db['MailServerIn'][_0x8b28('0x3a')](_0x58d4c7[_0x8b28('0x63')][_0x8b28('0x64')],{'where':{'MailAccountId':_0x3b3118['id']}})[_0x8b28('0x26')](function(){return _0x3b3118;});}return _0x3b3118;})[_0x8b28('0x26')](function(_0x4f0ee2){if(_0x4f0ee2&&_0x58d4c7['body'][_0x8b28('0x43')]){return db[_0x8b28('0x42')][_0x8b28('0x3a')](_0x58d4c7[_0x8b28('0x63')][_0x8b28('0x43')],{'where':{'MailAccountId':_0x4f0ee2['id']}})[_0x8b28('0x26')](function(){return _0x4f0ee2;});}return _0x4f0ee2;})[_0x8b28('0x26')](respondWithResult(_0x4d6463,null))['catch'](handleError(_0x4d6463,null));};exports[_0x8b28('0x65')]=function(_0x3ecdb0,_0xc9eb44){return db[_0x8b28('0x47')][_0x8b28('0x65')]()[_0x8b28('0x26')](respondWithResult(_0xc9eb44,null))[_0x8b28('0x5d')](handleError(_0xc9eb44,null));};exports[_0x8b28('0x66')]=function(_0x40e334,_0x2a33f6,_0x4f8d74){if(_0x40e334['body']['id']){delete _0x40e334[_0x8b28('0x63')]['id'];}return db['MailAccount'][_0x8b28('0x62')]({'where':{'id':_0x40e334[_0x8b28('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2a33f6,null))[_0x8b28('0x26')](function(_0x1b55c0){if(_0x1b55c0){_0x40e334[_0x8b28('0x63')][_0x8b28('0x67')]=_0x1b55c0['id'];return db[_0x8b28('0x68')][_0x8b28('0x69')](_0x40e334[_0x8b28('0x63')]);}})[_0x8b28('0x26')](respondWithResult(_0x2a33f6,null))['catch'](handleError(_0x2a33f6,null));};exports[_0x8b28('0x6a')]=function(_0xccc4f1,_0xed8e63,_0x306dfd){var _0x11489b={'raw':![],'where':{}};var _0x39e026={};var _0x2170ee={'count':0x0,'rows':[]};return db[_0x8b28('0x47')][_0x8b28('0x6b')]({'where':{'id':_0xccc4f1[_0x8b28('0x5f')]['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0xed8e63,null))['then'](function(_0x3bb883){if(_0x3bb883){_0x39e026['model']=_[_0x8b28('0x4c')](db['Disposition'][_0x8b28('0x6c')]);_0x39e026[_0x8b28('0x4b')]=_[_0x8b28('0x4c')](_0xccc4f1[_0x8b28('0x4b')]);_0x39e026[_0x8b28('0x4d')]=_[_0x8b28('0x4e')](_0x39e026[_0x8b28('0x4f')],_0x39e026['query']);_0x11489b[_0x8b28('0x50')]=_['intersection'](_0x39e026[_0x8b28('0x4f')],qs['fields'](_0xccc4f1[_0x8b28('0x4b')][_0x8b28('0x51')]));_0x11489b['attributes']=_0x11489b[_0x8b28('0x50')][_0x8b28('0x52')]?_0x11489b[_0x8b28('0x50')]:_0x39e026['model'];if(!_0xccc4f1[_0x8b28('0x4b')][_0x8b28('0x53')](_0x8b28('0x54'))){_0x11489b['limit']=qs[_0x8b28('0x34')](_0xccc4f1[_0x8b28('0x4b')][_0x8b28('0x34')]);_0x11489b[_0x8b28('0x36')]=qs[_0x8b28('0x36')](_0xccc4f1[_0x8b28('0x4b')]['offset']);}_0x11489b['order']=qs['sort'](_0xccc4f1[_0x8b28('0x4b')][_0x8b28('0x56')]);_0x11489b[_0x8b28('0x57')]=qs[_0x8b28('0x4d')](_[_0x8b28('0x6d')](_0xccc4f1[_0x8b28('0x4b')],_0x39e026[_0x8b28('0x4d')]));_0x11489b['where'][_0x8b28('0x67')]=_0x3bb883['id'];if(_0xccc4f1[_0x8b28('0x4b')][_0x8b28('0x58')]){_0x11489b['where']=_['merge'](_0x11489b[_0x8b28('0x57')],{'$or':_[_0x8b28('0x46')](_0x11489b[_0x8b28('0x50')],function(_0x56e025){var _0x33ac8b={};_0x33ac8b[_0x56e025]={'$like':'%'+_0xccc4f1[_0x8b28('0x4b')][_0x8b28('0x58')]+'%'};return _0x33ac8b;})});}_0x11489b=_[_0x8b28('0x59')]({},_0x11489b,_0xccc4f1[_0x8b28('0x61')]);return db[_0x8b28('0x68')][_0x8b28('0x37')]({'where':_0x11489b['where']})[_0x8b28('0x26')](function(_0x2fd1fa){_0x2170ee[_0x8b28('0x37')]=_0x2fd1fa;if(_0xccc4f1['query'][_0x8b28('0x5b')]){_0x11489b[_0x8b28('0x60')]=[{'all':!![]}];}return db[_0x8b28('0x68')][_0x8b28('0x6e')](_0x11489b);})['then'](function(_0x14f4af){_0x2170ee[_0x8b28('0x5c')]=_0x14f4af;return _0x2170ee;});}})[_0x8b28('0x26')](respondWithFilteredResult(_0xed8e63,_0x11489b))['catch'](handleError(_0xed8e63,null));};exports['removeDispositions']=function(_0x297858,_0x501655,_0x1f839f){return db[_0x8b28('0x47')][_0x8b28('0x62')]({'where':{'id':_0x297858[_0x8b28('0x5f')]['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0x501655,null))[_0x8b28('0x26')](function(_0x43df5f){if(_0x43df5f){return _0x43df5f[_0x8b28('0x6f')](_0x297858[_0x8b28('0x4b')][_0x8b28('0x70')]);}})['then'](respondWithStatusCode(_0x501655,null))[_0x8b28('0x5d')](handleError(_0x501655,null));};exports['addAnswer']=function(_0x556fbd,_0x277463,_0x4e84dd){if(_0x556fbd['body']['id']){delete _0x556fbd[_0x8b28('0x63')]['id'];}return db[_0x8b28('0x47')][_0x8b28('0x62')]({'where':{'id':_0x556fbd[_0x8b28('0x5f')]['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0x277463,null))[_0x8b28('0x26')](function(_0x2afc87){if(_0x2afc87){_0x556fbd[_0x8b28('0x63')][_0x8b28('0x67')]=_0x2afc87['id'];return db[_0x8b28('0x71')][_0x8b28('0x69')](_0x556fbd[_0x8b28('0x63')]);}})[_0x8b28('0x26')](respondWithResult(_0x277463,null))['catch'](handleError(_0x277463,null));};exports[_0x8b28('0x72')]=function(_0x506b88,_0x39c44f,_0x39fba8){var _0x1f70b8={'raw':![],'where':{}};var _0x29bd65={};var _0x263bd7={'count':0x0,'rows':[]};return db[_0x8b28('0x47')]['findOne']({'where':{'id':_0x506b88['params']['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0x39c44f,null))[_0x8b28('0x26')](function(_0x416fc3){if(_0x416fc3){_0x29bd65[_0x8b28('0x4f')]=_[_0x8b28('0x4c')](db[_0x8b28('0x71')][_0x8b28('0x6c')]);_0x29bd65[_0x8b28('0x4b')]=_['keys'](_0x506b88[_0x8b28('0x4b')]);_0x29bd65[_0x8b28('0x4d')]=_[_0x8b28('0x4e')](_0x29bd65[_0x8b28('0x4f')],_0x29bd65[_0x8b28('0x4b')]);_0x1f70b8[_0x8b28('0x50')]=_[_0x8b28('0x4e')](_0x29bd65[_0x8b28('0x4f')],qs[_0x8b28('0x51')](_0x506b88[_0x8b28('0x4b')][_0x8b28('0x51')]));_0x1f70b8[_0x8b28('0x50')]=_0x1f70b8[_0x8b28('0x50')][_0x8b28('0x52')]?_0x1f70b8[_0x8b28('0x50')]:_0x29bd65['model'];if(!_0x506b88['query']['hasOwnProperty'](_0x8b28('0x54'))){_0x1f70b8[_0x8b28('0x34')]=qs[_0x8b28('0x34')](_0x506b88[_0x8b28('0x4b')]['limit']);_0x1f70b8['offset']=qs[_0x8b28('0x36')](_0x506b88[_0x8b28('0x4b')]['offset']);}_0x1f70b8[_0x8b28('0x55')]=qs['sort'](_0x506b88[_0x8b28('0x4b')]['sort']);_0x1f70b8[_0x8b28('0x57')]=qs[_0x8b28('0x4d')](_[_0x8b28('0x6d')](_0x506b88[_0x8b28('0x4b')],_0x29bd65[_0x8b28('0x4d')]));_0x1f70b8['where']['MailAccountId']=_0x416fc3['id'];if(_0x506b88[_0x8b28('0x4b')][_0x8b28('0x58')]){_0x1f70b8[_0x8b28('0x57')]=_[_0x8b28('0x59')](_0x1f70b8[_0x8b28('0x57')],{'$or':_[_0x8b28('0x46')](_0x1f70b8[_0x8b28('0x50')],function(_0x4cc429){var _0x3ace43={};_0x3ace43[_0x4cc429]={'$like':'%'+_0x506b88[_0x8b28('0x4b')][_0x8b28('0x58')]+'%'};return _0x3ace43;})});}_0x1f70b8=_['merge']({},_0x1f70b8,_0x506b88[_0x8b28('0x61')]);return db[_0x8b28('0x71')]['count']({'where':_0x1f70b8[_0x8b28('0x57')]})[_0x8b28('0x26')](function(_0x470b83){_0x263bd7['count']=_0x470b83;if(_0x506b88[_0x8b28('0x4b')][_0x8b28('0x5b')]){_0x1f70b8['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x1f70b8);})[_0x8b28('0x26')](function(_0x29ea63){_0x263bd7[_0x8b28('0x5c')]=_0x29ea63;return _0x263bd7;});}})[_0x8b28('0x26')](respondWithFilteredResult(_0x39c44f,_0x1f70b8))[_0x8b28('0x5d')](handleError(_0x39c44f,null));};exports[_0x8b28('0x73')]=function(_0x39f08d,_0xd680fb,_0x400a4e){return db[_0x8b28('0x47')][_0x8b28('0x62')]({'where':{'id':_0x39f08d[_0x8b28('0x5f')]['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0xd680fb,null))[_0x8b28('0x26')](function(_0x2800ec){if(_0x2800ec){return _0x2800ec[_0x8b28('0x73')](_0x39f08d[_0x8b28('0x4b')][_0x8b28('0x70')]);}})[_0x8b28('0x26')](respondWithStatusCode(_0xd680fb,null))[_0x8b28('0x5d')](handleError(_0xd680fb,null));};exports['create']=function(_0x151bbd,_0x508128){var _0x27e6df={'name':_0x151bbd['body'][_0x8b28('0x3f')],'key':_0x151bbd[_0x8b28('0x63')][_0x8b28('0x4a')],'email':_0x151bbd['body'][_0x8b28('0x74')],'ListId':_0x151bbd[_0x8b28('0x63')][_0x8b28('0x75')],'active':!_[_0x8b28('0x76')](_0x151bbd[_0x8b28('0x63')][_0x8b28('0x77')])?_0x151bbd[_0x8b28('0x63')][_0x8b28('0x77')]:!![],'description':_0x151bbd[_0x8b28('0x63')][_0x8b28('0x78')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x151bbd['body'][_0x8b28('0x79')])){if(_0x151bbd['body'][_0x8b28('0x7a')]){_0x27e6df[_0x8b28('0x64')][_0x8b28('0x7b')]=_0x27e6df[_0x8b28('0x43')][_0x8b28('0x7b')]=_0x151bbd[_0x8b28('0x63')][_0x8b28('0x7c')];_0x27e6df[_0x8b28('0x64')][_0x8b28('0x7d')]=_0x27e6df[_0x8b28('0x43')]['pass']=_0x151bbd[_0x8b28('0x63')][_0x8b28('0x7e')];}else{_0x27e6df[_0x8b28('0x64')][_0x8b28('0x7f')]=_0x27e6df[_0x8b28('0x43')][_0x8b28('0x7f')]=![];}_0x27e6df[_0x8b28('0x64')][_0x8b28('0x80')]=_0x151bbd[_0x8b28('0x63')][_0x8b28('0x64')][_0x8b28('0x80')];_0x27e6df[_0x8b28('0x64')]['port']=_0x151bbd[_0x8b28('0x63')][_0x8b28('0x64')][_0x8b28('0x81')];_0x27e6df['Smtp'][_0x8b28('0x80')]=_0x151bbd[_0x8b28('0x63')][_0x8b28('0x43')]['host'];_0x27e6df[_0x8b28('0x43')][_0x8b28('0x81')]=_0x151bbd['body'][_0x8b28('0x43')][_0x8b28('0x81')];}else{_0x27e6df[_0x8b28('0x64')][_0x8b28('0x82')]=_0x27e6df[_0x8b28('0x43')][_0x8b28('0x82')]=_0x151bbd['body'][_0x8b28('0x79')];_0x27e6df['Imap'][_0x8b28('0x7b')]=_0x27e6df[_0x8b28('0x43')]['user']=_0x151bbd[_0x8b28('0x63')][_0x8b28('0x7c')];_0x27e6df[_0x8b28('0x64')][_0x8b28('0x7d')]=_0x27e6df[_0x8b28('0x43')][_0x8b28('0x83')]=_0x151bbd[_0x8b28('0x63')][_0x8b28('0x7e')];}return db[_0x8b28('0x47')][_0x8b28('0x69')](_0x27e6df,{'include':[{'model':db[_0x8b28('0x42')],'as':_0x8b28('0x43')},{'model':db[_0x8b28('0x84')],'as':_0x8b28('0x64')}]})['then'](function(_0x3ef21c){var _0x3ee03c=_0x151bbd[_0x8b28('0x7b')][_0x8b28('0x3c')]({'plain':!![]});if(!_0x3ee03c)throw new Error(_0x8b28('0x85'));if(_0x3ee03c[_0x8b28('0x86')]==='user'){var _0xcb8859=_0x3ef21c[_0x8b28('0x3c')]({'plain':!![]});return db[_0x8b28('0x87')][_0x8b28('0x62')]({'where':{'name':_0x8b28('0x88'),'userProfileId':_0x3ee03c[_0x8b28('0x89')]},'raw':!![]})['then'](function(_0x29e5bb){if(_0x29e5bb&&_0x29e5bb['autoAssociation']===0x0){return db[_0x8b28('0x3d')][_0x8b28('0x69')]({'name':_0xcb8859[_0x8b28('0x3f')],'resourceId':_0xcb8859['id'],'type':_0x29e5bb[_0x8b28('0x3f')],'sectionId':_0x29e5bb['id']},{})[_0x8b28('0x26')](function(){return _0x3ef21c;});}else{return _0x3ef21c;}})[_0x8b28('0x5d')](function(_0x192ef4){logger[_0x8b28('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x192ef4);throw _0x192ef4;});}return _0x3ef21c;})[_0x8b28('0x26')](respondWithResult(_0x508128,0xc9))['catch'](handleError(_0x508128,null));};exports[_0x8b28('0x8a')]=function(_0x2a0260,_0x61e9ad,_0x1df50a){return db[_0x8b28('0x47')][_0x8b28('0x6b')]({'where':{'id':_0x2a0260[_0x8b28('0x5f')]['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0x61e9ad,null))['then'](function(_0x428eca){if(_0x428eca){return _0x428eca[_0x8b28('0x8a')]();}return null;})[_0x8b28('0x26')](respondWithResult(_0x61e9ad,null))[_0x8b28('0x5d')](handleError(_0x61e9ad,null));};exports[_0x8b28('0x8b')]=function(_0x1d835b,_0x446706,_0x5e9baf){if(_0x1d835b[_0x8b28('0x63')]['id']){delete _0x1d835b[_0x8b28('0x63')]['id'];}return db[_0x8b28('0x47')]['find']({'where':{'id':_0x1d835b['params']['id']}})['then'](handleEntityNotFound(_0x446706,null))[_0x8b28('0x26')](function(_0xdb747c){if(_0xdb747c){_0x1d835b[_0x8b28('0x63')][_0x8b28('0x67')]=_0xdb747c['id'];return db[_0x8b28('0x84')]['create'](_0x1d835b['body']);}})[_0x8b28('0x26')](respondWithResult(_0x446706,null))[_0x8b28('0x5d')](handleError(_0x446706,null));};exports[_0x8b28('0x8c')]=function(_0x2bc5ba,_0x2f5c0f,_0x567f52){return db[_0x8b28('0x47')][_0x8b28('0x6b')]({'where':{'id':_0x2bc5ba['params']['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0x2f5c0f,null))['then'](function(_0x5e4fe2){if(_0x5e4fe2){return _0x5e4fe2[_0x8b28('0x8d')](null);}return null;})[_0x8b28('0x26')](respondWithStatusCode(_0x2f5c0f,null))[_0x8b28('0x5d')](handleError(_0x2f5c0f,null));};exports[_0x8b28('0x8e')]=function(_0x34f721,_0x1a5ad4,_0x2177b0){return db[_0x8b28('0x47')][_0x8b28('0x6b')]({'where':{'id':_0x34f721['params']['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0x1a5ad4,null))[_0x8b28('0x26')](function(_0x36c10e){if(_0x36c10e){return _0x36c10e[_0x8b28('0x8e')]();}return null;})[_0x8b28('0x26')](respondWithResult(_0x1a5ad4,null))[_0x8b28('0x5d')](handleError(_0x1a5ad4,null));};exports[_0x8b28('0x8f')]=function(_0x24a468,_0x2bb972,_0x107285){if(_0x24a468[_0x8b28('0x63')]['id']){delete _0x24a468['body']['id'];}return db['MailAccount'][_0x8b28('0x62')]({'where':{'id':_0x24a468[_0x8b28('0x5f')]['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0x2bb972,null))[_0x8b28('0x26')](function(_0x3f5f21){if(_0x3f5f21){_0x24a468['body'][_0x8b28('0x67')]=_0x3f5f21['id'];return db[_0x8b28('0x42')][_0x8b28('0x69')](_0x24a468[_0x8b28('0x63')]);}})['then'](respondWithResult(_0x2bb972,null))[_0x8b28('0x5d')](handleError(_0x2bb972,null));};exports['removeSmtp']=function(_0x1990e7,_0x1a64c3,_0x3ed730){return db['MailAccount'][_0x8b28('0x6b')]({'where':{'id':_0x1990e7[_0x8b28('0x5f')]['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0x1a64c3,null))[_0x8b28('0x26')](function(_0x549edb){if(_0x549edb){return _0x549edb['setSmtp'](null);}return null;})[_0x8b28('0x26')](respondWithStatusCode(_0x1a64c3,null))[_0x8b28('0x5d')](handleError(_0x1a64c3,null));};exports['addInteraction']=function(_0xc1ccc2,_0x19e7f7,_0x5e6ed2){return db['MailInteraction'][_0x8b28('0x62')]({'where':{'id':_0xc1ccc2[_0x8b28('0x5f')]['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0x19e7f7,null))[_0x8b28('0x26')](function(_0x40156d){if(_0x40156d){return _0x40156d[_0x8b28('0x90')](_0xc1ccc2[_0x8b28('0x63')][_0x8b28('0x70')],_[_0x8b28('0x91')](_0xc1ccc2[_0x8b28('0x63')],[_0x8b28('0x70'),'id'])||{});}})[_0x8b28('0x26')](respondWithResult(_0x19e7f7,null))['catch'](handleError(_0x19e7f7,null));};exports[_0x8b28('0x92')]=function(_0x429343,_0x14b71e,_0x1f1500){var _0x39d371={'raw':![],'where':{}};var _0x134e90={};var _0x19cdce={'count':0x0,'rows':[]};return db[_0x8b28('0x47')][_0x8b28('0x6b')]({'where':{'id':_0x429343[_0x8b28('0x5f')]['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0x14b71e,null))['then'](function(_0x459cb9){if(_0x459cb9){_0x134e90['model']=_[_0x8b28('0x4c')](db[_0x8b28('0x93')][_0x8b28('0x6c')]);_0x134e90['query']=_[_0x8b28('0x4c')](_0x429343[_0x8b28('0x4b')]);_0x134e90[_0x8b28('0x4d')]=_[_0x8b28('0x4e')](_0x134e90[_0x8b28('0x4f')],_0x134e90[_0x8b28('0x4b')]);_0x39d371[_0x8b28('0x50')]=_['intersection'](_0x134e90['model'],qs[_0x8b28('0x51')](_0x429343[_0x8b28('0x4b')][_0x8b28('0x51')]));_0x39d371[_0x8b28('0x50')]=_0x39d371[_0x8b28('0x50')][_0x8b28('0x52')]?_0x39d371[_0x8b28('0x50')]:_0x134e90['model'];if(!_0x429343[_0x8b28('0x4b')][_0x8b28('0x53')](_0x8b28('0x54'))){_0x39d371['limit']=qs[_0x8b28('0x34')](_0x429343['query']['limit']);_0x39d371[_0x8b28('0x36')]=qs[_0x8b28('0x36')](_0x429343['query'][_0x8b28('0x36')]);}_0x39d371[_0x8b28('0x55')]=qs[_0x8b28('0x56')](_0x429343[_0x8b28('0x4b')][_0x8b28('0x56')]);_0x39d371[_0x8b28('0x57')]=qs[_0x8b28('0x4d')](_['pick'](_0x429343[_0x8b28('0x4b')],_0x134e90[_0x8b28('0x4d')]));_0x39d371[_0x8b28('0x57')][_0x8b28('0x67')]=_0x459cb9['id'];if(_0x429343[_0x8b28('0x4b')][_0x8b28('0x58')]){_0x39d371[_0x8b28('0x57')]=_[_0x8b28('0x59')](_0x39d371['where'],{'$or':_[_0x8b28('0x46')](_0x39d371[_0x8b28('0x50')],function(_0x500465){var _0x5d93a2={};_0x5d93a2[_0x500465]={'$like':'%'+_0x429343[_0x8b28('0x4b')]['filter']+'%'};return _0x5d93a2;})});}_0x39d371=_[_0x8b28('0x59')]({},_0x39d371,_0x429343[_0x8b28('0x61')]);return db['MailInteraction'][_0x8b28('0x37')]({'where':_0x39d371[_0x8b28('0x57')]})[_0x8b28('0x26')](function(_0x4561e3){_0x19cdce[_0x8b28('0x37')]=_0x4561e3;if(_0x429343[_0x8b28('0x4b')][_0x8b28('0x5b')]){_0x39d371['include']=[{'model':db[_0x8b28('0x94')],'as':_0x8b28('0x95'),'required':![]},{'model':db[_0x8b28('0x96')],'as':_0x8b28('0x97'),'attributes':[_0x8b28('0x3f'),_0x8b28('0x98'),'internal'],'required':![]},{'model':db[_0x8b28('0x99')],'as':_0x8b28('0x9a'),'attributes':['id',_0x8b28('0x3f'),_0x8b28('0x9b')],'where':_0x429343[_0x8b28('0x4b')][_0x8b28('0x9c')]?{'id':_0x429343[_0x8b28('0x4b')]['tag']}:undefined,'required':_0x429343['query']['tag']?!![]:![]}];}return db['MailInteraction'][_0x8b28('0x6e')](_0x39d371);})[_0x8b28('0x26')](function(_0x99d855){_0x19cdce['rows']=_0x99d855;return _0x19cdce;});}})['then'](respondWithFilteredResult(_0x14b71e,_0x39d371))[_0x8b28('0x5d')](handleError(_0x14b71e,null));};exports[_0x8b28('0x9d')]=function(_0x212312,_0x4765fa,_0x5530a8){return db[_0x8b28('0x47')][_0x8b28('0x6b')]({'where':{'id':_0x212312[_0x8b28('0x5f')]['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0x4765fa,null))[_0x8b28('0x26')](function(_0x3db0e5){if(_0x3db0e5){return db[_0x8b28('0x9e')]['transaction'](function(_0x40c191){return db[_0x8b28('0x9f')][_0x8b28('0x3b')]({'where':{'MailAccountId':_0x212312[_0x8b28('0x5f')]['id']},'transaction':_0x40c191})['then'](function(_0x3564ce){var _0xade747=_[_0x8b28('0x46')](_0x212312['body'],function(_0x42012f){_0x42012f[_0x8b28('0x67')]=_0x212312[_0x8b28('0x5f')]['id'];return _0x42012f;});return db[_0x8b28('0x9f')]['bulkCreate'](_0xade747,{'transaction':_0x40c191});});})[_0x8b28('0x26')](function(){return db[_0x8b28('0x9f')]['findAndCountAll']({'where':{'MailAccountId':_0x212312[_0x8b28('0x5f')]['id']},'order':_0x8b28('0xa0')});});}})[_0x8b28('0x26')](respondWithResult(_0x4765fa,null))['catch'](handleError(_0x4765fa,null));};exports[_0x8b28('0xa1')]=function(_0x495c9f,_0x36d15d,_0x162ccb){var _0x5c6228={};var _0x2d8962={};var _0x48e8c3;var _0x1846ee;return db[_0x8b28('0x47')][_0x8b28('0x6b')]({'where':{'id':_0x495c9f[_0x8b28('0x5f')]['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0x36d15d,null))[_0x8b28('0x26')](function(_0x387f64){if(_0x387f64){_0x48e8c3=_0x387f64;_0x2d8962[_0x8b28('0x4f')]=_[_0x8b28('0x4c')](db[_0x8b28('0x9f')][_0x8b28('0x6c')]);_0x2d8962[_0x8b28('0x4b')]=_['keys'](_0x495c9f[_0x8b28('0x4b')]);_0x2d8962[_0x8b28('0x4d')]=_[_0x8b28('0x4e')](_0x2d8962[_0x8b28('0x4f')],_0x2d8962[_0x8b28('0x4b')]);_0x5c6228[_0x8b28('0x50')]=_[_0x8b28('0x4e')](_0x2d8962[_0x8b28('0x4f')],qs[_0x8b28('0x51')](_0x495c9f[_0x8b28('0x4b')][_0x8b28('0x51')]));_0x5c6228[_0x8b28('0x50')]=_0x5c6228[_0x8b28('0x50')][_0x8b28('0x52')]?_0x5c6228[_0x8b28('0x50')]:_0x2d8962[_0x8b28('0x4f')];_0x5c6228['order']=qs[_0x8b28('0x56')](_0x495c9f['query'][_0x8b28('0x56')]);_0x5c6228[_0x8b28('0x57')]=qs[_0x8b28('0x4d')](_[_0x8b28('0x6d')](_0x495c9f[_0x8b28('0x4b')],_0x2d8962[_0x8b28('0x4d')]));if(_0x495c9f[_0x8b28('0x4b')]['filter']){_0x5c6228[_0x8b28('0x57')]=_[_0x8b28('0x59')](_0x5c6228[_0x8b28('0x57')],{'$or':_[_0x8b28('0x46')](_0x5c6228[_0x8b28('0x50')],function(_0x2a51c2){var _0x5e0548={};_0x5e0548[_0x2a51c2]={'$like':'%'+_0x495c9f['query'][_0x8b28('0x58')]+'%'};return _0x5e0548;})});}_0x5c6228=_['merge']({},_0x5c6228,_0x495c9f[_0x8b28('0x61')]);return _0x48e8c3[_0x8b28('0xa1')](_0x5c6228);}})[_0x8b28('0x26')](function(_0x324bc3){if(_0x324bc3){_0x1846ee=_0x324bc3[_0x8b28('0x52')];if(!_0x495c9f['query'][_0x8b28('0x53')](_0x8b28('0x54'))){_0x5c6228[_0x8b28('0x34')]=qs[_0x8b28('0x34')](_0x495c9f[_0x8b28('0x4b')][_0x8b28('0x34')]);_0x5c6228['offset']=qs[_0x8b28('0x36')](_0x495c9f[_0x8b28('0x4b')][_0x8b28('0x36')]);}return _0x48e8c3[_0x8b28('0xa1')](_0x5c6228);}})[_0x8b28('0x26')](function(_0x523337){if(_0x523337){return _0x523337?{'count':_0x1846ee,'rows':_0x523337}:null;}})[_0x8b28('0x26')](respondWithResult(_0x36d15d,null))[_0x8b28('0x5d')](handleError(_0x36d15d,null));};exports['getMessages']=function(_0x1bc117,_0x26871e,_0x53f028){var _0x3cd18b={'raw':!![],'where':{}};var _0xa73d15={};var _0x24d4fd={'count':0x0,'rows':[]};return db['MailAccount'][_0x8b28('0x6b')]({'where':{'id':_0x1bc117[_0x8b28('0x5f')]['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0x26871e,null))[_0x8b28('0x26')](function(_0x203c2c){if(_0x203c2c){_0xa73d15['model']=_[_0x8b28('0x4c')](db['MailMessage']['rawAttributes']);_0xa73d15['query']=_[_0x8b28('0x4c')](_0x1bc117[_0x8b28('0x4b')]);_0xa73d15[_0x8b28('0x4d')]=_[_0x8b28('0x4e')](_0xa73d15['model'],_0xa73d15[_0x8b28('0x4b')]);_0x3cd18b[_0x8b28('0x50')]=_['intersection'](_0xa73d15['model'],qs[_0x8b28('0x51')](_0x1bc117[_0x8b28('0x4b')][_0x8b28('0x51')]));_0x3cd18b['attributes']=_0x3cd18b[_0x8b28('0x50')][_0x8b28('0x52')]?_0x3cd18b[_0x8b28('0x50')]:_0xa73d15['model'];if(!_0x1bc117[_0x8b28('0x4b')]['hasOwnProperty'](_0x8b28('0x54'))){_0x3cd18b[_0x8b28('0x34')]=qs[_0x8b28('0x34')](_0x1bc117[_0x8b28('0x4b')][_0x8b28('0x34')]);_0x3cd18b['offset']=qs[_0x8b28('0x36')](_0x1bc117[_0x8b28('0x4b')][_0x8b28('0x36')]);}_0x3cd18b[_0x8b28('0x55')]=qs['sort'](_0x1bc117['query']['sort']);_0x3cd18b[_0x8b28('0x57')]=qs[_0x8b28('0x4d')](_['pick'](_0x1bc117[_0x8b28('0x4b')],_0xa73d15[_0x8b28('0x4d')]));_0x3cd18b['where'][_0x8b28('0x67')]=_0x203c2c['id'];if(_0x1bc117['query'][_0x8b28('0x58')]){_0x3cd18b[_0x8b28('0x57')]=_[_0x8b28('0x59')](_0x3cd18b[_0x8b28('0x57')],{'$or':_[_0x8b28('0x46')](_0x3cd18b[_0x8b28('0x50')],function(_0x3b0698){var _0x23ca0c={};_0x23ca0c[_0x3b0698]={'$like':'%'+_0x1bc117['query']['filter']+'%'};return _0x23ca0c;})});}if(_0x1bc117[_0x8b28('0x4b')][_0x8b28('0xa2')]){var _0x146a17=_0x1bc117[_0x8b28('0x4b')][_0x8b28('0xa2')]['split'](',');var _0x58004d={};_0x58004d[_0x146a17[0x0]]={'$gte':moment(_0x146a17[0x1])['format'](_0x8b28('0xa3'))};_0x3cd18b[_0x8b28('0x57')]=_[_0x8b28('0x59')](_0x3cd18b[_0x8b28('0x57')],_0x58004d);}_0x3cd18b=_[_0x8b28('0x59')]({},_0x3cd18b,_0x1bc117[_0x8b28('0x61')]);return db[_0x8b28('0xa4')][_0x8b28('0x37')]({'where':_0x3cd18b['where']})[_0x8b28('0x26')](function(_0x5aeef1){_0x24d4fd['count']=_0x5aeef1;if(_0x1bc117['query'][_0x8b28('0x5b')]){_0x3cd18b[_0x8b28('0x60')]=[{'all':!![]}];}return db[_0x8b28('0xa4')][_0x8b28('0x6e')](_0x3cd18b);})['then'](function(_0x385e7e){if(_0x1bc117[_0x8b28('0x4b')][_0x8b28('0xa5')]==='true'){for(var _0x1bfb26=0x0;_0x1bfb26<_0x385e7e[_0x8b28('0x52')];_0x1bfb26++){_0x385e7e[_0x1bfb26][_0x8b28('0x63')]=juice(_0x385e7e[_0x1bfb26][_0x8b28('0x63')]);}}_0x24d4fd[_0x8b28('0x5c')]=_0x385e7e;return _0x24d4fd;});}})[_0x8b28('0x26')](respondWithFilteredResult(_0x26871e,_0x3cd18b))[_0x8b28('0x5d')](handleError(_0x26871e,null));};exports['send']=function(_0x5b1936,_0x19a481,_0x1834b2){var _0x4cd98f,_0x4cbcb7={},_0x35d179;if(_0x5b1936[_0x8b28('0x63')]['to']){_0x35d179=_0x5b1936[_0x8b28('0x63')]['to'][_0x8b28('0xa6')](',')[0x0];}return db[_0x8b28('0x47')][_0x8b28('0x62')]({'where':{'id':_0x5b1936[_0x8b28('0x5f')]['id']},'include':[{'model':db['CmList'],'as':_0x8b28('0xa7'),'include':[{'model':db['CmContact'],'as':_0x8b28('0xa8'),'where':{'email':_0x35d179},'limit':0x1,'order':[['updatedAt',_0x8b28('0xa9')]]}]},{'model':db['MailServerOut'],'as':_0x8b28('0x43'),'raw':!![]}]})[_0x8b28('0x26')](handleEntityNotFound(_0x19a481,null))[_0x8b28('0x26')](function(_0x18d8b0){if(_0x18d8b0){_0x4cd98f=_0x18d8b0;if(_0x18d8b0[_0x8b28('0x43')]){if(_['isNil'](_0x5b1936[_0x8b28('0x63')][_0x8b28('0xaa')])){_0x5b1936['body']['from']=util[_0x8b28('0xab')](_0x8b28('0xac'),_0x18d8b0[_0x8b28('0x3f')],_0x18d8b0['email']||_0x18d8b0[_0x8b28('0x43')][_0x8b28('0x7b')]);}if(_0x5b1936[_0x8b28('0x63')][_0x8b28('0xad')]&&_0x5b1936['body']['attachments'][_0x8b28('0x52')]){for(var _0x4dd0e4=0x0;_0x4dd0e4<_0x5b1936['body'][_0x8b28('0xad')][_0x8b28('0x52')];_0x4dd0e4+=0x1){_0x5b1936['body']['attachments'][_0x4dd0e4]={'filename':_0x5b1936[_0x8b28('0x63')][_0x8b28('0xad')][_0x4dd0e4][_0x8b28('0x3f')],'path':path['join'](config[_0x8b28('0xae')],'server/files/attachments',_0x5b1936['body'][_0x8b28('0xad')][_0x4dd0e4][_0x8b28('0xaf')])};}}var _0x5b2d51={'tls':{'rejectUnauthorized':![]}};if(_[_0x8b28('0x76')](_0x18d8b0[_0x8b28('0x43')][_0x8b28('0x82')])){if(_0x18d8b0[_0x8b28('0x43')][_0x8b28('0x7f')]){_0x5b2d51[_0x8b28('0xb0')]={'user':_0x18d8b0[_0x8b28('0x43')][_0x8b28('0x7b')],'pass':_0x18d8b0['Smtp'][_0x8b28('0x83')]};}_0x5b2d51[_0x8b28('0x80')]=_0x18d8b0[_0x8b28('0x43')][_0x8b28('0x80')];_0x5b2d51[_0x8b28('0x81')]=_0x18d8b0[_0x8b28('0x43')][_0x8b28('0x81')];_0x5b2d51['secure']=_0x18d8b0[_0x8b28('0x43')]['secure'];}else{_0x5b2d51[_0x8b28('0x82')]=_0x18d8b0['Smtp'][_0x8b28('0x82')];_0x5b2d51[_0x8b28('0xb0')]={'user':_0x18d8b0[_0x8b28('0x43')][_0x8b28('0x7b')],'pass':_0x18d8b0['Smtp'][_0x8b28('0x83')]};}return respondWithRpcPromise(_0x8b28('0xb1'),_0x8b28('0xb2'),{'account':_0x5b2d51,'message':_0x5b1936['body']});}else{throw new Error(_0x8b28('0xb3'));}}})[_0x8b28('0x26')](function(_0x5436ef){if(_0x5436ef){_0x4cbcb7=_0x5436ef;if(_0x4cd98f[_0x8b28('0xa7')]){if(_0x4cd98f[_0x8b28('0xa7')][_0x8b28('0xa8')]['length']){return _0x4cd98f[_0x8b28('0xa7')]['Contacts'][0x0];}else{return db[_0x8b28('0x94')][_0x8b28('0x69')](_[_0x8b28('0x1e')](_0x5b1936[_0x8b28('0x63')],{'firstName':_0x5b1936['body']['to'],'email':_0x5b1936[_0x8b28('0x63')]['to'],'phone':_0x5b1936['body']['to'],'ListId':_0x4cd98f[_0x8b28('0x75')]}));}}else{throw new Error(_0x8b28('0xb3'));}}})['then'](function(_0xea5aac){if(_0xea5aac){var _0x5dff5b={'UserId':_0x5b1936[_0x8b28('0x7b')]['id'],'ContactId':_0xea5aac['id'],'MailAccountId':_0x4cd98f['id'],'inReplyTo':_0x4cbcb7[_0x8b28('0xb4')],'to':_0x5b1936['body'][_0x8b28('0xaa')],'cc':_0x5b1936['body']['cc'],'subject':_0x5b1936[_0x8b28('0x63')]['subject'],'attach':_0x5b1936[_0x8b28('0x63')][_0x8b28('0xb5')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x8b28('0xab')](_0x8b28('0xa3')),'lastMsgDirection':'out','Messages':[_['merge'](_0x5b1936[_0x8b28('0x63')],{'messageId':_0x4cbcb7[_0x8b28('0xb4')],'sentAt':moment()[_0x8b28('0xab')](_0x8b28('0xa3')),'read':!![],'MailAccountId':_0x4cd98f['id'],'UserId':_0x5b1936['user']['id'],'ContactId':_0xea5aac['id']})]};if(_0x5b1936[_0x8b28('0x63')][_0x8b28('0xb6')]){_0x5dff5b=_['merge'](_0x5dff5b,_0x5b1936['body']['Interaction']);}return db[_0x8b28('0x93')][_0x8b28('0x69')](_0x5dff5b,{'include':[{'model':db['MailMessage'],'as':_0x8b28('0xb7')}]});}})[_0x8b28('0x26')](respondWithResult(_0x19a481,null))[_0x8b28('0x5d')](handleError(_0x19a481,null));};exports[_0x8b28('0xb8')]=function(_0x2270eb,_0x270fce,_0x54c215){return db[_0x8b28('0x47')]['find']({'where':{'id':_0x2270eb[_0x8b28('0x5f')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x8b28('0x43'),'raw':!![]}]})[_0x8b28('0x26')](handleEntityNotFound(_0x270fce,null))[_0x8b28('0x26')](function(_0x58e08c){if(_0x58e08c&&_0x58e08c[_0x8b28('0x43')]){var _0x104adc={'id':_0x58e08c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x58e08c[_0x8b28('0x43')][_0x8b28('0x82')]){_0x104adc[_0x8b28('0x82')]=_0x58e08c[_0x8b28('0x43')][_0x8b28('0x82')];}else{_0x104adc[_0x8b28('0x80')]=_0x58e08c[_0x8b28('0x43')][_0x8b28('0x80')];_0x104adc[_0x8b28('0x81')]=_0x58e08c['Smtp'][_0x8b28('0x81')];_0x104adc[_0x8b28('0xb9')]=_0x58e08c[_0x8b28('0x43')]['secure'];}if(_0x58e08c[_0x8b28('0x43')][_0x8b28('0x7f')]){_0x104adc[_0x8b28('0xb0')]={'user':_0x58e08c[_0x8b28('0x43')]['user'],'pass':_0x58e08c[_0x8b28('0x43')][_0x8b28('0x83')]};}return respondWithRpcPromise(_0x8b28('0xba'),_0x8b28('0xb8'),{'account':_0x104adc});}})['then'](respondWithResult(_0x270fce,null))[_0x8b28('0x5d')](handleError(_0x270fce,null));};exports['destroy']=function(_0x37bfe4,_0x39294f){return db[_0x8b28('0x47')]['find']({'where':{'id':_0x37bfe4[_0x8b28('0x5f')]['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0x39294f,null))['then'](function(_0x3d234d){if(_0x3d234d&&_0x3d234d[_0x8b28('0x82')]){throw new db['Sequelize'][(_0x8b28('0xbb'))](_0x8b28('0xbc'));}return _0x3d234d;})[_0x8b28('0x26')](removeEntity(_0x39294f,null))[_0x8b28('0x5d')](handleError(_0x39294f,null));};exports[_0x8b28('0xbd')]=function(_0xc5217f,_0x36d604,_0xb4d321){return db[_0x8b28('0x47')][_0x8b28('0x62')]({'where':{'id':_0xc5217f[_0x8b28('0x5f')]['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0x36d604,null))['then'](function(_0x4fd9c5){if(_0x4fd9c5){return _0x4fd9c5[_0x8b28('0xbd')](_0xc5217f[_0x8b28('0x63')]['ids'],_[_0x8b28('0x91')](_0xc5217f[_0x8b28('0x63')],['ids','id'])||{})[_0x8b28('0xbe')](function(_0x2fa990){for(var _0x412a19=0x0;_0x412a19<_0xc5217f[_0x8b28('0x63')][_0x8b28('0x70')]['length'];_0x412a19+=0x1){socket[_0x8b28('0xbf')](_0x8b28('0xc0'),{'UserId':Number(_0xc5217f['body'][_0x8b28('0x70')][_0x412a19]),'MailAccountId':Number(_0xc5217f[_0x8b28('0x5f')]['id'])});}return _0x2fa990;});}})['then'](respondWithResult(_0x36d604,null))[_0x8b28('0x5d')](handleError(_0x36d604,null));};exports['removeAgents']=function(_0x1b78b8,_0x289f9f,_0x42eb5c){return db[_0x8b28('0x47')]['find']({'where':{'id':_0x1b78b8[_0x8b28('0x5f')]['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0x289f9f,null))[_0x8b28('0x26')](function(_0x128b08){if(_0x128b08){return _0x128b08[_0x8b28('0xc1')](_0x1b78b8[_0x8b28('0x4b')][_0x8b28('0x70')])['then'](function(){if(_['isArray'](_0x1b78b8[_0x8b28('0x4b')][_0x8b28('0x70')])){for(var _0x4cd3cc=0x0;_0x4cd3cc<_0x1b78b8['query'][_0x8b28('0x70')][_0x8b28('0x52')];_0x4cd3cc+=0x1){socket[_0x8b28('0xbf')](_0x8b28('0xc2'),{'UserId':Number(_0x1b78b8['query'][_0x8b28('0x70')][_0x4cd3cc]),'MailAccountId':Number(_0x1b78b8['params']['id'])});}}else{socket['emit'](_0x8b28('0xc2'),{'UserId':Number(_0x1b78b8[_0x8b28('0x4b')][_0x8b28('0x70')]),'MailAccountId':Number(_0x1b78b8[_0x8b28('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x289f9f,null))[_0x8b28('0x5d')](handleError(_0x289f9f,null));};exports[_0x8b28('0xc3')]=function(_0x1e1323,_0x3089b7,_0x196dc5){var _0x5941d7={};var _0x5e9112={};var _0x39d150;var _0x2071be;return db[_0x8b28('0x47')][_0x8b28('0x6b')]({'where':{'id':_0x1e1323[_0x8b28('0x5f')]['id']}})[_0x8b28('0x26')](handleEntityNotFound(_0x3089b7,null))[_0x8b28('0x26')](function(_0x44ea41){if(_0x44ea41){_0x39d150=_0x44ea41;_0x5e9112[_0x8b28('0x4f')]=_[_0x8b28('0x4c')](db[_0x8b28('0x96')][_0x8b28('0x6c')]);_0x5e9112['query']=_[_0x8b28('0x4c')](_0x1e1323[_0x8b28('0x4b')]);_0x5e9112[_0x8b28('0x4d')]=_[_0x8b28('0x4e')](_0x5e9112[_0x8b28('0x4f')],_0x5e9112[_0x8b28('0x4b')]);_0x5941d7[_0x8b28('0x50')]=_[_0x8b28('0x4e')](_0x5e9112[_0x8b28('0x4f')],qs['fields'](_0x1e1323[_0x8b28('0x4b')][_0x8b28('0x51')]));_0x5941d7[_0x8b28('0x50')]=_0x5941d7[_0x8b28('0x50')]['length']?_0x5941d7['attributes']:_0x5e9112[_0x8b28('0x4f')];_0x5941d7[_0x8b28('0x55')]=qs['sort'](_0x1e1323[_0x8b28('0x4b')][_0x8b28('0x56')]);_0x5941d7[_0x8b28('0x57')]=qs[_0x8b28('0x4d')](_['pick'](_0x1e1323[_0x8b28('0x4b')],_0x5e9112[_0x8b28('0x4d')]));if(_0x1e1323[_0x8b28('0x4b')][_0x8b28('0x58')]){_0x5941d7[_0x8b28('0x57')]=_[_0x8b28('0x59')](_0x5941d7[_0x8b28('0x57')],{'$or':_[_0x8b28('0x46')](_0x5941d7[_0x8b28('0x50')],function(_0x2d95d4){var _0x316bce={};_0x316bce[_0x2d95d4]={'$like':'%'+_0x1e1323[_0x8b28('0x4b')][_0x8b28('0x58')]+'%'};return _0x316bce;})});}_0x5941d7=_[_0x8b28('0x59')]({},_0x5941d7,_0x1e1323['options']);return _0x39d150[_0x8b28('0xc3')](_0x5941d7);}})['then'](function(_0x1e2a8c){if(_0x1e2a8c){_0x2071be=_0x1e2a8c['length'];if(!_0x1e1323[_0x8b28('0x4b')]['hasOwnProperty'](_0x8b28('0x54'))){_0x5941d7[_0x8b28('0x34')]=qs['limit'](_0x1e1323['query'][_0x8b28('0x34')]);_0x5941d7[_0x8b28('0x36')]=qs[_0x8b28('0x36')](_0x1e1323[_0x8b28('0x4b')][_0x8b28('0x36')]);}return _0x39d150['getAgents'](_0x5941d7);}})[_0x8b28('0x26')](function(_0x2c7771){if(_0x2c7771){return _0x2c7771?{'count':_0x2071be,'rows':_0x2c7771}:null;}})[_0x8b28('0x26')](respondWithResult(_0x3089b7,null))[_0x8b28('0x5d')](handleError(_0x3089b7,null));}; \ No newline at end of file +var _0x6b25=['http','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','get','UserProfileResource','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','MailAccount','includeAll','include','findAll','rows','show','params','find','body','describe','addDisposition','MailAccountId','Disposition','getDispositions','length','hasOwnProperty','ids','CannedAnswer','removeAnswers','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','port','host','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','getImap','findOne','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','Owner','fullname','Tag','color','tag','addApplications','sequelize','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','List','Contacts','updatedAt','DESC','from','format','email','attachments','join','root','server/files/attachments','basename','service','secure','auth','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client'];(function(_0x4bdf64,_0x3022b2){var _0x9a1a19=function(_0x4e551b){while(--_0x4e551b){_0x4bdf64['push'](_0x4bdf64['shift']());}};_0x9a1a19(++_0x3022b2);}(_0x6b25,0xa2));var _0x56b2=function(_0x25a634,_0x5b80c1){_0x25a634=_0x25a634-0x0;var _0x432e8a=_0x6b25[_0x25a634];return _0x432e8a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x56b2('0x0'));var zipdir=require(_0x56b2('0x1'));var jsonpatch=require(_0x56b2('0x2'));var rp=require(_0x56b2('0x3'));var moment=require(_0x56b2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x56b2('0x5'));var fs=require('fs');var fs_extra=require(_0x56b2('0x6'));var _=require(_0x56b2('0x7'));var squel=require(_0x56b2('0x8'));var crypto=require(_0x56b2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x56b2('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x56b2('0xb'));var htmlToText=require('html-to-text');var juice=require(_0x56b2('0xc'));var Redis=require(_0x56b2('0xd'));var authService=require(_0x56b2('0xe'));var qs=require(_0x56b2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x56b2('0x10'));var logger=require(_0x56b2('0x11'))(_0x56b2('0x12'));var utils=require(_0x56b2('0x13'));var config=require(_0x56b2('0x14'));var licenseUtil=require(_0x56b2('0x15'));var db=require(_0x56b2('0x16'))['db'];config[_0x56b2('0x17')]=_[_0x56b2('0x18')](config[_0x56b2('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x56b2('0x19'))(new Redis(config[_0x56b2('0x17')]));require('./mailAccount.socket')[_0x56b2('0x1a')](socket);var jayson=require(_0x56b2('0x1b'));var client=jayson[_0x56b2('0x1c')][_0x56b2('0x1d')]({'port':0x232b});function respondWithRpcPromise(_0x8830c9,_0x59a254,_0x229ba9,_0x4aa687){return new BPromise(function(_0xc14be0,_0x3e362c){var _0x492c4a=_0x4aa687||client;return _0x492c4a['request'](_0x8830c9,_0x229ba9)[_0x56b2('0x1e')](function(_0x42570c){logger['info'](_0x56b2('0x1f'),_0x59a254,'request\x20sent');logger[_0x56b2('0x20')](_0x56b2('0x21'),_0x59a254,_0x56b2('0x22'),JSON[_0x56b2('0x23')](_0x42570c));if(_0x42570c[_0x56b2('0x24')]){if(_0x42570c['error'][_0x56b2('0x25')]===0x1f4){logger[_0x56b2('0x24')]('MailAccount,\x20%s,\x20%s',_0x59a254,_0x42570c[_0x56b2('0x24')][_0x56b2('0x26')]);return _0x3e362c(_0x42570c['error'][_0x56b2('0x26')]);}logger['error'](_0x56b2('0x1f'),_0x59a254,_0x42570c[_0x56b2('0x24')][_0x56b2('0x26')]);return _0xc14be0(_0x42570c[_0x56b2('0x24')]['message']);}else{logger[_0x56b2('0x27')](_0x56b2('0x1f'),_0x59a254,_0x56b2('0x22'));_0xc14be0(_0x42570c[_0x56b2('0x28')]['message']);}})[_0x56b2('0x29')](function(_0x3a6acf){logger[_0x56b2('0x24')](_0x56b2('0x1f'),_0x59a254,_0x3a6acf);_0x3e362c(_0x3a6acf);});});}function respondWithStatusCode(_0x535aa0,_0x3f24ef){_0x3f24ef=_0x3f24ef||0xcc;return function(_0x2b0e67){if(_0x2b0e67){return _0x535aa0[_0x56b2('0x2a')](_0x3f24ef);}return _0x535aa0[_0x56b2('0x2b')](_0x3f24ef)[_0x56b2('0x2c')]();};}function respondWithResult(_0x491ffb,_0x28e708){_0x28e708=_0x28e708||0xc8;return function(_0x390f94){if(_0x390f94){return _0x491ffb[_0x56b2('0x2b')](_0x28e708)[_0x56b2('0x2d')](_0x390f94);}};}function respondWithFilteredResult(_0xa54934,_0x100f01){return function(_0xd4ec37){if(_0xd4ec37){var _0x111561=typeof _0x100f01[_0x56b2('0x2e')]===_0x56b2('0x2f')&&typeof _0x100f01[_0x56b2('0x30')]===_0x56b2('0x2f');var _0xdc4901=_0xd4ec37[_0x56b2('0x31')];var _0x3233d7=_0x111561?0x0:_0x100f01['offset'];var _0x5c884b=_0x111561?_0xd4ec37['count']:_0x100f01['offset']+_0x100f01[_0x56b2('0x30')];var _0x3ae5b7;if(_0x5c884b>=_0xdc4901){_0x5c884b=_0xdc4901;_0x3ae5b7=0xc8;}else{_0x3ae5b7=0xce;}_0xa54934[_0x56b2('0x2b')](_0x3ae5b7);return _0xa54934[_0x56b2('0x32')]('Content-Range',_0x3233d7+'-'+_0x5c884b+'/'+_0xdc4901)['json'](_0xd4ec37);}return null;};}function patchUpdates(_0xb12259){return function(_0x15af78){try{jsonpatch[_0x56b2('0x33')](_0x15af78,_0xb12259,!![]);}catch(_0x334c72){return BPromise['reject'](_0x334c72);}return _0x15af78[_0x56b2('0x34')]();};}function saveUpdates(_0x2eef08,_0xe7006a){return function(_0x188609){if(_0x188609){return _0x188609[_0x56b2('0x35')](_0x2eef08)[_0x56b2('0x1e')](function(_0x175dd0){return _0x175dd0;});}return null;};}function removeEntity(_0x3be63c,_0x29bddf){return function(_0x5c064d){if(_0x5c064d){return _0x5c064d[_0x56b2('0x36')]()['then'](function(){var _0x175dd3=_0x5c064d[_0x56b2('0x37')]({'plain':!![]});var _0x3c77c7='MailAccounts';return db[_0x56b2('0x38')][_0x56b2('0x36')]({'where':{'type':_0x3c77c7,'resourceId':_0x175dd3['id']}})[_0x56b2('0x1e')](function(){return _0x5c064d;});})['then'](function(){_0x3be63c[_0x56b2('0x2b')](0xcc)[_0x56b2('0x2c')]();});}};}function handleEntityNotFound(_0x215dbf,_0xab14b0){return function(_0x1ebf91){if(!_0x1ebf91){_0x215dbf['sendStatus'](0x194);}return _0x1ebf91;};}function handleError(_0xba52fe,_0x1f98e4){_0x1f98e4=_0x1f98e4||0x1f4;return function(_0x469ac9){logger['error'](_0x469ac9['stack']);if(_0x469ac9[_0x56b2('0x39')]){delete _0x469ac9[_0x56b2('0x39')];}_0xba52fe[_0x56b2('0x2b')](_0x1f98e4)[_0x56b2('0x3a')](_0x469ac9);};}exports[_0x56b2('0x3b')]=function(_0x1a6e3e,_0x415fdc){var _0xacfa3a={'include':[{'model':db[_0x56b2('0x3c')],'as':_0x56b2('0x3d')},{'model':db[_0x56b2('0x3e')],'as':_0x56b2('0x3f')},{'model':db[_0x56b2('0x40')],'as':_0x56b2('0x41')}]},_0x5db0ab={},_0x1ec953={'count':0x0,'rows':[]};var _0x26feef=_[_0x56b2('0x42')](db['MailAccount'][_0x56b2('0x43')],function(_0x1faa19){return{'name':_0x1faa19['fieldName'],'type':_0x1faa19[_0x56b2('0x44')][_0x56b2('0x45')]};});_0x5db0ab[_0x56b2('0x46')]=_['map'](_0x26feef,_0x56b2('0x39'));_0x5db0ab[_0x56b2('0x47')]=_[_0x56b2('0x48')](_0x1a6e3e[_0x56b2('0x47')]);_0x5db0ab['filters']=_[_0x56b2('0x49')](_0x5db0ab[_0x56b2('0x46')],_0x5db0ab[_0x56b2('0x47')]);_0xacfa3a[_0x56b2('0x4a')]=_['intersection'](_0x5db0ab[_0x56b2('0x46')],qs[_0x56b2('0x4b')](_0x1a6e3e[_0x56b2('0x47')][_0x56b2('0x4b')]));_0xacfa3a[_0x56b2('0x4a')]=_0xacfa3a[_0x56b2('0x4a')]['length']?_0xacfa3a[_0x56b2('0x4a')]:_0x5db0ab[_0x56b2('0x46')];if(!_0x1a6e3e[_0x56b2('0x47')]['hasOwnProperty'](_0x56b2('0x4c'))){_0xacfa3a['limit']=qs[_0x56b2('0x30')](_0x1a6e3e[_0x56b2('0x47')][_0x56b2('0x30')]);_0xacfa3a[_0x56b2('0x2e')]=qs['offset'](_0x1a6e3e[_0x56b2('0x47')][_0x56b2('0x2e')]);}_0xacfa3a[_0x56b2('0x4d')]=qs[_0x56b2('0x4e')](_0x1a6e3e[_0x56b2('0x47')][_0x56b2('0x4e')]);_0xacfa3a['where']=qs[_0x56b2('0x4f')](_[_0x56b2('0x50')](_0x1a6e3e[_0x56b2('0x47')],_0x5db0ab[_0x56b2('0x4f')]),_0x26feef);if(_0x1a6e3e['query']['filter']){_0xacfa3a[_0x56b2('0x51')]=_[_0x56b2('0x52')](_0xacfa3a['where'],{'$or':_[_0x56b2('0x42')](_0x26feef,function(_0x19248b){if(_0x19248b[_0x56b2('0x44')]!==_0x56b2('0x53')){var _0x44b755={};_0x44b755[_0x19248b['name']]={'$like':'%'+_0x1a6e3e['query'][_0x56b2('0x54')]+'%'};return _0x44b755;}})});}_0xacfa3a=_[_0x56b2('0x52')]({},_0xacfa3a,_0x1a6e3e[_0x56b2('0x55')]);var _0x4a8e3a={'where':_0xacfa3a[_0x56b2('0x51')]};return db[_0x56b2('0x56')][_0x56b2('0x31')](_0x4a8e3a)[_0x56b2('0x1e')](function(_0x3af058){_0x1ec953['count']=_0x3af058;if(_0x1a6e3e[_0x56b2('0x47')][_0x56b2('0x57')]){_0xacfa3a[_0x56b2('0x58')]=[{'all':!![]}];}return db[_0x56b2('0x56')][_0x56b2('0x59')](_0xacfa3a);})[_0x56b2('0x1e')](function(_0x101bff){_0x1ec953[_0x56b2('0x5a')]=_0x101bff;return _0x1ec953;})['then'](respondWithFilteredResult(_0x415fdc,_0xacfa3a))[_0x56b2('0x29')](handleError(_0x415fdc,null));};exports[_0x56b2('0x5b')]=function(_0x168c9f,_0x1a4761){var _0x1e8dbd={'raw':![],'where':{'id':_0x168c9f[_0x56b2('0x5c')]['id']},'include':[{'model':db[_0x56b2('0x3c')],'as':'Imap'},{'model':db[_0x56b2('0x3e')],'as':_0x56b2('0x3f')},{'model':db[_0x56b2('0x40')],'as':_0x56b2('0x41')}]},_0x30748a={};_0x30748a[_0x56b2('0x46')]=_[_0x56b2('0x48')](db[_0x56b2('0x56')]['rawAttributes']);_0x30748a[_0x56b2('0x47')]=_[_0x56b2('0x48')](_0x168c9f[_0x56b2('0x47')]);_0x30748a[_0x56b2('0x4f')]=_['intersection'](_0x30748a['model'],_0x30748a[_0x56b2('0x47')]);_0x1e8dbd[_0x56b2('0x4a')]=_['intersection'](_0x30748a[_0x56b2('0x46')],qs[_0x56b2('0x4b')](_0x168c9f['query']['fields']));_0x1e8dbd[_0x56b2('0x4a')]=_0x1e8dbd[_0x56b2('0x4a')]['length']?_0x1e8dbd[_0x56b2('0x4a')]:_0x30748a[_0x56b2('0x46')];if(_0x168c9f['query'][_0x56b2('0x57')]){_0x1e8dbd[_0x56b2('0x58')]=[{'all':!![]}];}_0x1e8dbd=_[_0x56b2('0x52')]({},_0x1e8dbd,_0x168c9f['options']);return db[_0x56b2('0x56')][_0x56b2('0x5d')](_0x1e8dbd)[_0x56b2('0x1e')](handleEntityNotFound(_0x1a4761,null))['then'](respondWithResult(_0x1a4761,null))[_0x56b2('0x29')](handleError(_0x1a4761,null));};exports['update']=function(_0x5e0f89,_0x5173c1){if(_0x5e0f89[_0x56b2('0x5e')]['id']){delete _0x5e0f89[_0x56b2('0x5e')]['id'];}return db[_0x56b2('0x56')]['find']({'where':{'id':_0x5e0f89[_0x56b2('0x5c')]['id']},'include':[{'model':db[_0x56b2('0x3c')],'as':'Imap'},{'model':db[_0x56b2('0x3e')],'as':_0x56b2('0x3f')},{'model':db[_0x56b2('0x40')],'as':_0x56b2('0x41')}]})[_0x56b2('0x1e')](handleEntityNotFound(_0x5173c1,null))['then'](saveUpdates(_0x5e0f89[_0x56b2('0x5e')],null))[_0x56b2('0x1e')](function(_0x4799b8){if(_0x4799b8&&_0x5e0f89[_0x56b2('0x5e')][_0x56b2('0x3d')]){return db[_0x56b2('0x3c')][_0x56b2('0x35')](_0x5e0f89['body'][_0x56b2('0x3d')],{'where':{'MailAccountId':_0x4799b8['id']}})[_0x56b2('0x1e')](function(){return _0x4799b8;});}return _0x4799b8;})[_0x56b2('0x1e')](function(_0x324828){if(_0x324828&&_0x5e0f89[_0x56b2('0x5e')][_0x56b2('0x3f')]){return db[_0x56b2('0x3e')][_0x56b2('0x35')](_0x5e0f89[_0x56b2('0x5e')][_0x56b2('0x3f')],{'where':{'MailAccountId':_0x324828['id']}})[_0x56b2('0x1e')](function(){return _0x324828;});}return _0x324828;})['then'](respondWithResult(_0x5173c1,null))[_0x56b2('0x29')](handleError(_0x5173c1,null));};exports[_0x56b2('0x5f')]=function(_0x43c88d,_0x31ea50){return db[_0x56b2('0x56')][_0x56b2('0x5f')]()[_0x56b2('0x1e')](respondWithResult(_0x31ea50,null))['catch'](handleError(_0x31ea50,null));};exports[_0x56b2('0x60')]=function(_0x3aa2cc,_0x3432f9,_0x77d221){if(_0x3aa2cc[_0x56b2('0x5e')]['id']){delete _0x3aa2cc[_0x56b2('0x5e')]['id'];}return db[_0x56b2('0x56')][_0x56b2('0x5d')]({'where':{'id':_0x3aa2cc[_0x56b2('0x5c')]['id']}})[_0x56b2('0x1e')](handleEntityNotFound(_0x3432f9,null))[_0x56b2('0x1e')](function(_0x5dae54){if(_0x5dae54){_0x3aa2cc[_0x56b2('0x5e')][_0x56b2('0x61')]=_0x5dae54['id'];return db[_0x56b2('0x62')]['create'](_0x3aa2cc[_0x56b2('0x5e')]);}})['then'](respondWithResult(_0x3432f9,null))['catch'](handleError(_0x3432f9,null));};exports[_0x56b2('0x63')]=function(_0x75da70,_0x4da459,_0x5750b8){var _0x5d148a={'raw':![],'where':{}};var _0x3f5d7c={};var _0x40cd3b={'count':0x0,'rows':[]};return db[_0x56b2('0x56')]['findOne']({'where':{'id':_0x75da70[_0x56b2('0x5c')]['id']}})[_0x56b2('0x1e')](handleEntityNotFound(_0x4da459,null))[_0x56b2('0x1e')](function(_0x18f028){if(_0x18f028){_0x3f5d7c['model']=_['keys'](db['Disposition'][_0x56b2('0x43')]);_0x3f5d7c[_0x56b2('0x47')]=_[_0x56b2('0x48')](_0x75da70[_0x56b2('0x47')]);_0x3f5d7c[_0x56b2('0x4f')]=_[_0x56b2('0x49')](_0x3f5d7c['model'],_0x3f5d7c[_0x56b2('0x47')]);_0x5d148a[_0x56b2('0x4a')]=_['intersection'](_0x3f5d7c[_0x56b2('0x46')],qs[_0x56b2('0x4b')](_0x75da70['query'][_0x56b2('0x4b')]));_0x5d148a[_0x56b2('0x4a')]=_0x5d148a[_0x56b2('0x4a')][_0x56b2('0x64')]?_0x5d148a[_0x56b2('0x4a')]:_0x3f5d7c[_0x56b2('0x46')];if(!_0x75da70[_0x56b2('0x47')][_0x56b2('0x65')](_0x56b2('0x4c'))){_0x5d148a['limit']=qs[_0x56b2('0x30')](_0x75da70[_0x56b2('0x47')][_0x56b2('0x30')]);_0x5d148a['offset']=qs[_0x56b2('0x2e')](_0x75da70['query'][_0x56b2('0x2e')]);}_0x5d148a[_0x56b2('0x4d')]=qs['sort'](_0x75da70[_0x56b2('0x47')][_0x56b2('0x4e')]);_0x5d148a[_0x56b2('0x51')]=qs[_0x56b2('0x4f')](_[_0x56b2('0x50')](_0x75da70[_0x56b2('0x47')],_0x3f5d7c['filters']));_0x5d148a[_0x56b2('0x51')][_0x56b2('0x61')]=_0x18f028['id'];if(_0x75da70[_0x56b2('0x47')][_0x56b2('0x54')]){_0x5d148a[_0x56b2('0x51')]=_['merge'](_0x5d148a[_0x56b2('0x51')],{'$or':_[_0x56b2('0x42')](_0x5d148a[_0x56b2('0x4a')],function(_0x57a962){var _0x452a0b={};_0x452a0b[_0x57a962]={'$like':'%'+_0x75da70[_0x56b2('0x47')][_0x56b2('0x54')]+'%'};return _0x452a0b;})});}_0x5d148a=_[_0x56b2('0x52')]({},_0x5d148a,_0x75da70[_0x56b2('0x55')]);return db[_0x56b2('0x62')][_0x56b2('0x31')]({'where':_0x5d148a[_0x56b2('0x51')]})[_0x56b2('0x1e')](function(_0x224cb1){_0x40cd3b[_0x56b2('0x31')]=_0x224cb1;if(_0x75da70['query'][_0x56b2('0x57')]){_0x5d148a['include']=[{'all':!![]}];}return db[_0x56b2('0x62')][_0x56b2('0x59')](_0x5d148a);})['then'](function(_0x4ecc50){_0x40cd3b['rows']=_0x4ecc50;return _0x40cd3b;});}})[_0x56b2('0x1e')](respondWithFilteredResult(_0x4da459,_0x5d148a))[_0x56b2('0x29')](handleError(_0x4da459,null));};exports['removeDispositions']=function(_0x105c24,_0x15d996,_0x4e9592){return db[_0x56b2('0x56')][_0x56b2('0x5d')]({'where':{'id':_0x105c24[_0x56b2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x15d996,null))[_0x56b2('0x1e')](function(_0x5998e5){if(_0x5998e5){return _0x5998e5['removeDispositions'](_0x105c24[_0x56b2('0x47')][_0x56b2('0x66')]);}})[_0x56b2('0x1e')](respondWithStatusCode(_0x15d996,null))[_0x56b2('0x29')](handleError(_0x15d996,null));};exports['addAnswer']=function(_0x46b695,_0x4a75d4,_0x59b72b){if(_0x46b695['body']['id']){delete _0x46b695[_0x56b2('0x5e')]['id'];}return db[_0x56b2('0x56')][_0x56b2('0x5d')]({'where':{'id':_0x46b695[_0x56b2('0x5c')]['id']}})[_0x56b2('0x1e')](handleEntityNotFound(_0x4a75d4,null))[_0x56b2('0x1e')](function(_0x48839c){if(_0x48839c){_0x46b695[_0x56b2('0x5e')][_0x56b2('0x61')]=_0x48839c['id'];return db[_0x56b2('0x67')]['create'](_0x46b695[_0x56b2('0x5e')]);}})['then'](respondWithResult(_0x4a75d4,null))[_0x56b2('0x29')](handleError(_0x4a75d4,null));};exports['getAnswers']=function(_0xcaf3e2,_0x49aa8f,_0xda2462){var _0x5d0848={'raw':![],'where':{}};var _0x1db492={};var _0x522293={'count':0x0,'rows':[]};return db[_0x56b2('0x56')]['findOne']({'where':{'id':_0xcaf3e2['params']['id']}})[_0x56b2('0x1e')](handleEntityNotFound(_0x49aa8f,null))[_0x56b2('0x1e')](function(_0x13ada8){if(_0x13ada8){_0x1db492[_0x56b2('0x46')]=_[_0x56b2('0x48')](db[_0x56b2('0x67')]['rawAttributes']);_0x1db492[_0x56b2('0x47')]=_[_0x56b2('0x48')](_0xcaf3e2[_0x56b2('0x47')]);_0x1db492[_0x56b2('0x4f')]=_['intersection'](_0x1db492[_0x56b2('0x46')],_0x1db492[_0x56b2('0x47')]);_0x5d0848[_0x56b2('0x4a')]=_[_0x56b2('0x49')](_0x1db492[_0x56b2('0x46')],qs[_0x56b2('0x4b')](_0xcaf3e2['query'][_0x56b2('0x4b')]));_0x5d0848[_0x56b2('0x4a')]=_0x5d0848[_0x56b2('0x4a')][_0x56b2('0x64')]?_0x5d0848['attributes']:_0x1db492[_0x56b2('0x46')];if(!_0xcaf3e2[_0x56b2('0x47')][_0x56b2('0x65')](_0x56b2('0x4c'))){_0x5d0848[_0x56b2('0x30')]=qs['limit'](_0xcaf3e2[_0x56b2('0x47')][_0x56b2('0x30')]);_0x5d0848['offset']=qs['offset'](_0xcaf3e2['query'][_0x56b2('0x2e')]);}_0x5d0848['order']=qs[_0x56b2('0x4e')](_0xcaf3e2['query'][_0x56b2('0x4e')]);_0x5d0848['where']=qs[_0x56b2('0x4f')](_[_0x56b2('0x50')](_0xcaf3e2[_0x56b2('0x47')],_0x1db492[_0x56b2('0x4f')]));_0x5d0848['where'][_0x56b2('0x61')]=_0x13ada8['id'];if(_0xcaf3e2[_0x56b2('0x47')][_0x56b2('0x54')]){_0x5d0848['where']=_['merge'](_0x5d0848[_0x56b2('0x51')],{'$or':_[_0x56b2('0x42')](_0x5d0848['attributes'],function(_0x556821){var _0x47591a={};_0x47591a[_0x556821]={'$like':'%'+_0xcaf3e2[_0x56b2('0x47')][_0x56b2('0x54')]+'%'};return _0x47591a;})});}_0x5d0848=_['merge']({},_0x5d0848,_0xcaf3e2[_0x56b2('0x55')]);return db[_0x56b2('0x67')][_0x56b2('0x31')]({'where':_0x5d0848[_0x56b2('0x51')]})[_0x56b2('0x1e')](function(_0x1a0da1){_0x522293[_0x56b2('0x31')]=_0x1a0da1;if(_0xcaf3e2['query'][_0x56b2('0x57')]){_0x5d0848[_0x56b2('0x58')]=[{'all':!![]}];}return db[_0x56b2('0x67')]['findAll'](_0x5d0848);})[_0x56b2('0x1e')](function(_0x56be12){_0x522293['rows']=_0x56be12;return _0x522293;});}})[_0x56b2('0x1e')](respondWithFilteredResult(_0x49aa8f,_0x5d0848))['catch'](handleError(_0x49aa8f,null));};exports[_0x56b2('0x68')]=function(_0x7a4cd6,_0x1b889b,_0x242b98){return db['MailAccount'][_0x56b2('0x5d')]({'where':{'id':_0x7a4cd6['params']['id']}})[_0x56b2('0x1e')](handleEntityNotFound(_0x1b889b,null))[_0x56b2('0x1e')](function(_0x27dacd){if(_0x27dacd){return _0x27dacd['removeAnswers'](_0x7a4cd6[_0x56b2('0x47')]['ids']);}})[_0x56b2('0x1e')](respondWithStatusCode(_0x1b889b,null))[_0x56b2('0x29')](handleError(_0x1b889b,null));};exports['create']=function(_0x5f1a7c,_0x30c1cd){var _0x2fbff7={'name':_0x5f1a7c[_0x56b2('0x5e')]['name'],'key':_0x5f1a7c[_0x56b2('0x5e')][_0x56b2('0x45')],'email':_0x5f1a7c[_0x56b2('0x5e')]['email'],'ListId':_0x5f1a7c[_0x56b2('0x5e')][_0x56b2('0x69')],'active':!_[_0x56b2('0x6a')](_0x5f1a7c['body'][_0x56b2('0x6b')])?_0x5f1a7c[_0x56b2('0x5e')][_0x56b2('0x6b')]:!![],'description':_0x5f1a7c[_0x56b2('0x5e')][_0x56b2('0x6c')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x5f1a7c[_0x56b2('0x5e')][_0x56b2('0x6d')])){if(_0x5f1a7c['body'][_0x56b2('0x6e')]){_0x2fbff7[_0x56b2('0x3d')]['user']=_0x2fbff7['Smtp'][_0x56b2('0x6f')]=_0x5f1a7c[_0x56b2('0x5e')][_0x56b2('0x70')];_0x2fbff7['Imap'][_0x56b2('0x71')]=_0x2fbff7[_0x56b2('0x3f')][_0x56b2('0x72')]=_0x5f1a7c[_0x56b2('0x5e')][_0x56b2('0x73')];}else{_0x2fbff7[_0x56b2('0x3d')]['authentication']=_0x2fbff7[_0x56b2('0x3f')][_0x56b2('0x74')]=![];}_0x2fbff7['Imap']['host']=_0x5f1a7c[_0x56b2('0x5e')][_0x56b2('0x3d')]['host'];_0x2fbff7[_0x56b2('0x3d')][_0x56b2('0x75')]=_0x5f1a7c[_0x56b2('0x5e')]['Imap']['port'];_0x2fbff7[_0x56b2('0x3f')]['host']=_0x5f1a7c[_0x56b2('0x5e')]['Smtp'][_0x56b2('0x76')];_0x2fbff7[_0x56b2('0x3f')][_0x56b2('0x75')]=_0x5f1a7c[_0x56b2('0x5e')][_0x56b2('0x3f')][_0x56b2('0x75')];}else{_0x2fbff7[_0x56b2('0x3d')]['service']=_0x2fbff7[_0x56b2('0x3f')]['service']=_0x5f1a7c[_0x56b2('0x5e')]['cservice'];_0x2fbff7[_0x56b2('0x3d')][_0x56b2('0x6f')]=_0x2fbff7[_0x56b2('0x3f')][_0x56b2('0x6f')]=_0x5f1a7c['body'][_0x56b2('0x70')];_0x2fbff7[_0x56b2('0x3d')][_0x56b2('0x71')]=_0x2fbff7[_0x56b2('0x3f')][_0x56b2('0x72')]=_0x5f1a7c[_0x56b2('0x5e')][_0x56b2('0x73')];}return db[_0x56b2('0x56')][_0x56b2('0x77')](_0x2fbff7,{'include':[{'model':db['MailServerOut'],'as':_0x56b2('0x3f')},{'model':db[_0x56b2('0x3c')],'as':_0x56b2('0x3d')}]})[_0x56b2('0x1e')](function(_0x560b32){var _0x3623e8=_0x5f1a7c[_0x56b2('0x6f')][_0x56b2('0x37')]({'plain':!![]});if(!_0x3623e8)throw new Error(_0x56b2('0x78'));if(_0x3623e8['role']===_0x56b2('0x6f')){var _0x182b05=_0x560b32[_0x56b2('0x37')]({'plain':!![]});return db[_0x56b2('0x79')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x3623e8[_0x56b2('0x7a')]},'raw':!![]})[_0x56b2('0x1e')](function(_0x138044){if(_0x138044&&_0x138044[_0x56b2('0x7b')]===0x0){return db[_0x56b2('0x38')][_0x56b2('0x77')]({'name':_0x182b05['name'],'resourceId':_0x182b05['id'],'type':_0x138044['name'],'sectionId':_0x138044['id']},{})['then'](function(){return _0x560b32;});}else{return _0x560b32;}})[_0x56b2('0x29')](function(_0x426336){logger[_0x56b2('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x426336);throw _0x426336;});}return _0x560b32;})[_0x56b2('0x1e')](respondWithResult(_0x30c1cd,0xc9))[_0x56b2('0x29')](handleError(_0x30c1cd,null));};exports[_0x56b2('0x7c')]=function(_0xd9eccd,_0x9b58ad,_0x5c54f3){return db[_0x56b2('0x56')][_0x56b2('0x7d')]({'where':{'id':_0xd9eccd[_0x56b2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x9b58ad,null))[_0x56b2('0x1e')](function(_0x368c7e){if(_0x368c7e){return _0x368c7e['getImap']();}return null;})[_0x56b2('0x1e')](respondWithResult(_0x9b58ad,null))[_0x56b2('0x29')](handleError(_0x9b58ad,null));};exports[_0x56b2('0x7e')]=function(_0x36d5db,_0x430c4e,_0x5ebdec){if(_0x36d5db[_0x56b2('0x5e')]['id']){delete _0x36d5db['body']['id'];}return db['MailAccount'][_0x56b2('0x5d')]({'where':{'id':_0x36d5db['params']['id']}})['then'](handleEntityNotFound(_0x430c4e,null))['then'](function(_0x224f5d){if(_0x224f5d){_0x36d5db['body'][_0x56b2('0x61')]=_0x224f5d['id'];return db[_0x56b2('0x3c')][_0x56b2('0x77')](_0x36d5db[_0x56b2('0x5e')]);}})['then'](respondWithResult(_0x430c4e,null))[_0x56b2('0x29')](handleError(_0x430c4e,null));};exports[_0x56b2('0x7f')]=function(_0x34646e,_0xbe0aee,_0x2d1ad1){return db[_0x56b2('0x56')][_0x56b2('0x7d')]({'where':{'id':_0x34646e[_0x56b2('0x5c')]['id']}})['then'](handleEntityNotFound(_0xbe0aee,null))['then'](function(_0x5d6b8d){if(_0x5d6b8d){return _0x5d6b8d['setImap'](null);}return null;})[_0x56b2('0x1e')](respondWithStatusCode(_0xbe0aee,null))['catch'](handleError(_0xbe0aee,null));};exports[_0x56b2('0x80')]=function(_0x1c3ce6,_0x390b75,_0x14f57d){return db[_0x56b2('0x56')]['findOne']({'where':{'id':_0x1c3ce6[_0x56b2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x390b75,null))['then'](function(_0x54163f){if(_0x54163f){return _0x54163f[_0x56b2('0x80')]();}return null;})['then'](respondWithResult(_0x390b75,null))[_0x56b2('0x29')](handleError(_0x390b75,null));};exports[_0x56b2('0x81')]=function(_0x2ce32c,_0xa346aa,_0xade338){if(_0x2ce32c[_0x56b2('0x5e')]['id']){delete _0x2ce32c[_0x56b2('0x5e')]['id'];}return db['MailAccount'][_0x56b2('0x5d')]({'where':{'id':_0x2ce32c[_0x56b2('0x5c')]['id']}})[_0x56b2('0x1e')](handleEntityNotFound(_0xa346aa,null))['then'](function(_0x4574ba){if(_0x4574ba){_0x2ce32c[_0x56b2('0x5e')][_0x56b2('0x61')]=_0x4574ba['id'];return db['MailServerOut'][_0x56b2('0x77')](_0x2ce32c['body']);}})[_0x56b2('0x1e')](respondWithResult(_0xa346aa,null))[_0x56b2('0x29')](handleError(_0xa346aa,null));};exports[_0x56b2('0x82')]=function(_0x4f5004,_0x2fd416,_0x3a3c4c){return db[_0x56b2('0x56')][_0x56b2('0x7d')]({'where':{'id':_0x4f5004[_0x56b2('0x5c')]['id']}})[_0x56b2('0x1e')](handleEntityNotFound(_0x2fd416,null))['then'](function(_0x347f4d){if(_0x347f4d){return _0x347f4d[_0x56b2('0x83')](null);}return null;})['then'](respondWithStatusCode(_0x2fd416,null))[_0x56b2('0x29')](handleError(_0x2fd416,null));};exports[_0x56b2('0x84')]=function(_0x12c9a9,_0x4dbfcc,_0x21aa68){return db[_0x56b2('0x85')][_0x56b2('0x5d')]({'where':{'id':_0x12c9a9[_0x56b2('0x5c')]['id']}})[_0x56b2('0x1e')](handleEntityNotFound(_0x4dbfcc,null))[_0x56b2('0x1e')](function(_0x2bd3bd){if(_0x2bd3bd){return _0x2bd3bd[_0x56b2('0x84')](_0x12c9a9[_0x56b2('0x5e')][_0x56b2('0x66')],_[_0x56b2('0x86')](_0x12c9a9[_0x56b2('0x5e')],['ids','id'])||{});}})['then'](respondWithResult(_0x4dbfcc,null))['catch'](handleError(_0x4dbfcc,null));};exports['getInteractions']=function(_0x129a13,_0x200427,_0x3545b5){var _0x5e0940={'raw':![],'where':{}};var _0x568183={};var _0x1368eb={'count':0x0,'rows':[]};return db['MailAccount'][_0x56b2('0x7d')]({'where':{'id':_0x129a13['params']['id']}})[_0x56b2('0x1e')](handleEntityNotFound(_0x200427,null))[_0x56b2('0x1e')](function(_0x37d85e){if(_0x37d85e){_0x568183[_0x56b2('0x46')]=_[_0x56b2('0x48')](db['MailInteraction'][_0x56b2('0x43')]);_0x568183[_0x56b2('0x47')]=_['keys'](_0x129a13[_0x56b2('0x47')]);_0x568183[_0x56b2('0x4f')]=_[_0x56b2('0x49')](_0x568183[_0x56b2('0x46')],_0x568183[_0x56b2('0x47')]);_0x5e0940[_0x56b2('0x4a')]=_[_0x56b2('0x49')](_0x568183[_0x56b2('0x46')],qs['fields'](_0x129a13[_0x56b2('0x47')][_0x56b2('0x4b')]));_0x5e0940[_0x56b2('0x4a')]=_0x5e0940['attributes'][_0x56b2('0x64')]?_0x5e0940[_0x56b2('0x4a')]:_0x568183[_0x56b2('0x46')];if(!_0x129a13[_0x56b2('0x47')][_0x56b2('0x65')](_0x56b2('0x4c'))){_0x5e0940[_0x56b2('0x30')]=qs[_0x56b2('0x30')](_0x129a13[_0x56b2('0x47')][_0x56b2('0x30')]);_0x5e0940['offset']=qs[_0x56b2('0x2e')](_0x129a13['query'][_0x56b2('0x2e')]);}_0x5e0940[_0x56b2('0x4d')]=qs['sort'](_0x129a13['query'][_0x56b2('0x4e')]);_0x5e0940[_0x56b2('0x51')]=qs[_0x56b2('0x4f')](_[_0x56b2('0x50')](_0x129a13[_0x56b2('0x47')],_0x568183[_0x56b2('0x4f')]));_0x5e0940[_0x56b2('0x51')][_0x56b2('0x61')]=_0x37d85e['id'];if(_0x129a13[_0x56b2('0x47')][_0x56b2('0x54')]){_0x5e0940[_0x56b2('0x51')]=_[_0x56b2('0x52')](_0x5e0940[_0x56b2('0x51')],{'$or':_['map'](_0x5e0940[_0x56b2('0x4a')],function(_0x3bd5bf){var _0x383f79={};_0x383f79[_0x3bd5bf]={'$like':'%'+_0x129a13[_0x56b2('0x47')]['filter']+'%'};return _0x383f79;})});}_0x5e0940=_[_0x56b2('0x52')]({},_0x5e0940,_0x129a13[_0x56b2('0x55')]);return db['MailInteraction'][_0x56b2('0x31')]({'where':_0x5e0940[_0x56b2('0x51')]})[_0x56b2('0x1e')](function(_0x3e554f){_0x1368eb[_0x56b2('0x31')]=_0x3e554f;if(_0x129a13[_0x56b2('0x47')]['includeAll']){_0x5e0940[_0x56b2('0x58')]=[{'model':db[_0x56b2('0x87')],'as':_0x56b2('0x88'),'required':![]},{'model':db[_0x56b2('0x89')],'as':_0x56b2('0x8a'),'attributes':[_0x56b2('0x39'),_0x56b2('0x8b'),'internal'],'required':![]},{'model':db[_0x56b2('0x8c')],'as':'Tags','attributes':['id',_0x56b2('0x39'),_0x56b2('0x8d')],'where':_0x129a13[_0x56b2('0x47')][_0x56b2('0x8e')]?{'id':_0x129a13[_0x56b2('0x47')]['tag']}:undefined,'required':_0x129a13[_0x56b2('0x47')][_0x56b2('0x8e')]?!![]:![]}];}return db['MailInteraction'][_0x56b2('0x59')](_0x5e0940);})[_0x56b2('0x1e')](function(_0x4ee5a9){_0x1368eb['rows']=_0x4ee5a9;return _0x1368eb;});}})[_0x56b2('0x1e')](respondWithFilteredResult(_0x200427,_0x5e0940))['catch'](handleError(_0x200427,null));};exports[_0x56b2('0x8f')]=function(_0x21ebe5,_0x3b98de,_0xaf4562){return db[_0x56b2('0x56')][_0x56b2('0x7d')]({'where':{'id':_0x21ebe5[_0x56b2('0x5c')]['id']}})[_0x56b2('0x1e')](handleEntityNotFound(_0x3b98de,null))['then'](function(_0x325b2c){if(_0x325b2c){return db[_0x56b2('0x90')]['transaction'](function(_0x3124f7){return db[_0x56b2('0x91')][_0x56b2('0x36')]({'where':{'MailAccountId':_0x21ebe5[_0x56b2('0x5c')]['id']},'transaction':_0x3124f7})[_0x56b2('0x1e')](function(_0x29bb3c){var _0x5d6cbc=_['map'](_0x21ebe5[_0x56b2('0x5e')],function(_0x19ae42){_0x19ae42[_0x56b2('0x61')]=_0x21ebe5['params']['id'];return _0x19ae42;});return db[_0x56b2('0x91')]['bulkCreate'](_0x5d6cbc,{'transaction':_0x3124f7});});})[_0x56b2('0x1e')](function(){return db['MailApplication'][_0x56b2('0x92')]({'where':{'MailAccountId':_0x21ebe5[_0x56b2('0x5c')]['id']},'order':_0x56b2('0x93')});});}})[_0x56b2('0x1e')](respondWithResult(_0x3b98de,null))['catch'](handleError(_0x3b98de,null));};exports['getApplications']=function(_0x31ced5,_0x4008fd,_0x26423b){var _0x446412={};var _0x274c8e={};var _0x13d017;var _0x133933;return db[_0x56b2('0x56')][_0x56b2('0x7d')]({'where':{'id':_0x31ced5[_0x56b2('0x5c')]['id']}})[_0x56b2('0x1e')](handleEntityNotFound(_0x4008fd,null))['then'](function(_0xd8ed7f){if(_0xd8ed7f){_0x13d017=_0xd8ed7f;_0x274c8e[_0x56b2('0x46')]=_['keys'](db[_0x56b2('0x91')][_0x56b2('0x43')]);_0x274c8e['query']=_[_0x56b2('0x48')](_0x31ced5['query']);_0x274c8e[_0x56b2('0x4f')]=_[_0x56b2('0x49')](_0x274c8e[_0x56b2('0x46')],_0x274c8e[_0x56b2('0x47')]);_0x446412[_0x56b2('0x4a')]=_[_0x56b2('0x49')](_0x274c8e[_0x56b2('0x46')],qs[_0x56b2('0x4b')](_0x31ced5['query']['fields']));_0x446412['attributes']=_0x446412[_0x56b2('0x4a')][_0x56b2('0x64')]?_0x446412[_0x56b2('0x4a')]:_0x274c8e[_0x56b2('0x46')];_0x446412[_0x56b2('0x4d')]=qs['sort'](_0x31ced5[_0x56b2('0x47')][_0x56b2('0x4e')]);_0x446412['where']=qs[_0x56b2('0x4f')](_['pick'](_0x31ced5[_0x56b2('0x47')],_0x274c8e[_0x56b2('0x4f')]));if(_0x31ced5[_0x56b2('0x47')]['filter']){_0x446412['where']=_[_0x56b2('0x52')](_0x446412[_0x56b2('0x51')],{'$or':_[_0x56b2('0x42')](_0x446412[_0x56b2('0x4a')],function(_0x43b5a2){var _0x3d62e9={};_0x3d62e9[_0x43b5a2]={'$like':'%'+_0x31ced5['query'][_0x56b2('0x54')]+'%'};return _0x3d62e9;})});}_0x446412=_[_0x56b2('0x52')]({},_0x446412,_0x31ced5[_0x56b2('0x55')]);return _0x13d017[_0x56b2('0x94')](_0x446412);}})['then'](function(_0x5423dc){if(_0x5423dc){_0x133933=_0x5423dc[_0x56b2('0x64')];if(!_0x31ced5[_0x56b2('0x47')]['hasOwnProperty'](_0x56b2('0x4c'))){_0x446412[_0x56b2('0x30')]=qs['limit'](_0x31ced5[_0x56b2('0x47')][_0x56b2('0x30')]);_0x446412[_0x56b2('0x2e')]=qs[_0x56b2('0x2e')](_0x31ced5['query'][_0x56b2('0x2e')]);}return _0x13d017[_0x56b2('0x94')](_0x446412);}})[_0x56b2('0x1e')](function(_0x5f0bb6){if(_0x5f0bb6){return _0x5f0bb6?{'count':_0x133933,'rows':_0x5f0bb6}:null;}})[_0x56b2('0x1e')](respondWithResult(_0x4008fd,null))[_0x56b2('0x29')](handleError(_0x4008fd,null));};exports[_0x56b2('0x95')]=function(_0x3c947e,_0x23f43d,_0x4ec3d7){var _0x15633c={'raw':!![],'where':{}};var _0x2b24b7={};var _0x44f172={'count':0x0,'rows':[]};return db['MailAccount'][_0x56b2('0x7d')]({'where':{'id':_0x3c947e[_0x56b2('0x5c')]['id']}})[_0x56b2('0x1e')](handleEntityNotFound(_0x23f43d,null))[_0x56b2('0x1e')](function(_0xf42cf5){if(_0xf42cf5){_0x2b24b7[_0x56b2('0x46')]=_['keys'](db[_0x56b2('0x96')][_0x56b2('0x43')]);_0x2b24b7['query']=_[_0x56b2('0x48')](_0x3c947e[_0x56b2('0x47')]);_0x2b24b7[_0x56b2('0x4f')]=_[_0x56b2('0x49')](_0x2b24b7[_0x56b2('0x46')],_0x2b24b7[_0x56b2('0x47')]);_0x15633c[_0x56b2('0x4a')]=_[_0x56b2('0x49')](_0x2b24b7[_0x56b2('0x46')],qs[_0x56b2('0x4b')](_0x3c947e[_0x56b2('0x47')][_0x56b2('0x4b')]));_0x15633c[_0x56b2('0x4a')]=_0x15633c[_0x56b2('0x4a')][_0x56b2('0x64')]?_0x15633c[_0x56b2('0x4a')]:_0x2b24b7['model'];if(!_0x3c947e[_0x56b2('0x47')][_0x56b2('0x65')](_0x56b2('0x4c'))){_0x15633c['limit']=qs[_0x56b2('0x30')](_0x3c947e['query']['limit']);_0x15633c[_0x56b2('0x2e')]=qs[_0x56b2('0x2e')](_0x3c947e['query'][_0x56b2('0x2e')]);}_0x15633c['order']=qs[_0x56b2('0x4e')](_0x3c947e[_0x56b2('0x47')]['sort']);_0x15633c[_0x56b2('0x51')]=qs[_0x56b2('0x4f')](_[_0x56b2('0x50')](_0x3c947e[_0x56b2('0x47')],_0x2b24b7[_0x56b2('0x4f')]));_0x15633c['where'][_0x56b2('0x61')]=_0xf42cf5['id'];if(_0x3c947e[_0x56b2('0x47')][_0x56b2('0x54')]){_0x15633c[_0x56b2('0x51')]=_['merge'](_0x15633c[_0x56b2('0x51')],{'$or':_[_0x56b2('0x42')](_0x15633c[_0x56b2('0x4a')],function(_0xdfb08b){var _0x306c21={};_0x306c21[_0xdfb08b]={'$like':'%'+_0x3c947e[_0x56b2('0x47')]['filter']+'%'};return _0x306c21;})});}if(_0x3c947e['query'][_0x56b2('0x97')]){var _0x27f877=_0x3c947e['query'][_0x56b2('0x97')][_0x56b2('0x98')](',');var _0x247996={};_0x247996[_0x27f877[0x0]]={'$gte':moment(_0x27f877[0x1])['format'](_0x56b2('0x99'))};_0x15633c['where']=_['merge'](_0x15633c[_0x56b2('0x51')],_0x247996);}_0x15633c=_[_0x56b2('0x52')]({},_0x15633c,_0x3c947e[_0x56b2('0x55')]);return db['MailMessage'][_0x56b2('0x31')]({'where':_0x15633c[_0x56b2('0x51')]})[_0x56b2('0x1e')](function(_0x5815de){_0x44f172[_0x56b2('0x31')]=_0x5815de;if(_0x3c947e[_0x56b2('0x47')]['includeAll']){_0x15633c[_0x56b2('0x58')]=[{'all':!![]}];}return db[_0x56b2('0x96')][_0x56b2('0x59')](_0x15633c);})[_0x56b2('0x1e')](function(_0x4d91fd){if(_0x3c947e['query'][_0x56b2('0x9a')]===_0x56b2('0x9b')){for(var _0x5c16f3=0x0;_0x5c16f3<_0x4d91fd[_0x56b2('0x64')];_0x5c16f3++){_0x4d91fd[_0x5c16f3][_0x56b2('0x5e')]=juice(_0x4d91fd[_0x5c16f3][_0x56b2('0x5e')]);}}_0x44f172[_0x56b2('0x5a')]=_0x4d91fd;return _0x44f172;});}})[_0x56b2('0x1e')](respondWithFilteredResult(_0x23f43d,_0x15633c))['catch'](handleError(_0x23f43d,null));};exports[_0x56b2('0x3a')]=function(_0x3d2f7c,_0x25a1f1,_0x3aee02){var _0x196d2c,_0x1549b5={},_0x4e1a5c;if(_0x3d2f7c['body']['to']){_0x4e1a5c=_0x3d2f7c['body']['to']['split'](',')[0x0];}return db[_0x56b2('0x56')][_0x56b2('0x5d')]({'where':{'id':_0x3d2f7c[_0x56b2('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0x56b2('0x9c'),'include':[{'model':db[_0x56b2('0x87')],'as':_0x56b2('0x9d'),'where':{'email':_0x4e1a5c},'limit':0x1,'order':[[_0x56b2('0x9e'),_0x56b2('0x9f')]]}]},{'model':db['MailServerOut'],'as':_0x56b2('0x3f'),'raw':!![]}]})[_0x56b2('0x1e')](handleEntityNotFound(_0x25a1f1,null))[_0x56b2('0x1e')](function(_0x36addd){if(_0x36addd){_0x196d2c=_0x36addd;if(_0x36addd[_0x56b2('0x3f')]){if(_[_0x56b2('0x6a')](_0x3d2f7c[_0x56b2('0x5e')][_0x56b2('0xa0')])){_0x3d2f7c[_0x56b2('0x5e')][_0x56b2('0xa0')]=util[_0x56b2('0xa1')]('%s\x20<%s>',_0x36addd['name'],_0x36addd[_0x56b2('0xa2')]||_0x36addd['Smtp']['user']);}if(_0x3d2f7c[_0x56b2('0x5e')][_0x56b2('0xa3')]&&_0x3d2f7c[_0x56b2('0x5e')][_0x56b2('0xa3')][_0x56b2('0x64')]){for(var _0xe01555=0x0;_0xe01555<_0x3d2f7c[_0x56b2('0x5e')][_0x56b2('0xa3')][_0x56b2('0x64')];_0xe01555+=0x1){_0x3d2f7c[_0x56b2('0x5e')][_0x56b2('0xa3')][_0xe01555]={'filename':_0x3d2f7c[_0x56b2('0x5e')][_0x56b2('0xa3')][_0xe01555][_0x56b2('0x39')],'path':path[_0x56b2('0xa4')](config[_0x56b2('0xa5')],_0x56b2('0xa6'),_0x3d2f7c[_0x56b2('0x5e')][_0x56b2('0xa3')][_0xe01555][_0x56b2('0xa7')])};}}var _0x4591de={'tls':{'rejectUnauthorized':![]}};if(_[_0x56b2('0x6a')](_0x36addd['Smtp'][_0x56b2('0xa8')])){if(_0x36addd[_0x56b2('0x3f')][_0x56b2('0x74')]){_0x4591de['auth']={'user':_0x36addd[_0x56b2('0x3f')][_0x56b2('0x6f')],'pass':_0x36addd['Smtp'][_0x56b2('0x72')]};}_0x4591de[_0x56b2('0x76')]=_0x36addd[_0x56b2('0x3f')][_0x56b2('0x76')];_0x4591de[_0x56b2('0x75')]=_0x36addd[_0x56b2('0x3f')][_0x56b2('0x75')];_0x4591de['secure']=_0x36addd[_0x56b2('0x3f')][_0x56b2('0xa9')];}else{_0x4591de[_0x56b2('0xa8')]=_0x36addd['Smtp'][_0x56b2('0xa8')];_0x4591de[_0x56b2('0xaa')]={'user':_0x36addd[_0x56b2('0x3f')]['user'],'pass':_0x36addd[_0x56b2('0x3f')][_0x56b2('0x72')]};}return respondWithRpcPromise('SendMail',_0x56b2('0xab'),{'account':_0x4591de,'message':_0x3d2f7c[_0x56b2('0x5e')]});}else{throw new Error('List\x20not\x20found');}}})[_0x56b2('0x1e')](function(_0x597d02){if(_0x597d02){_0x1549b5=_0x597d02;if(_0x196d2c[_0x56b2('0x9c')]){if(_0x196d2c[_0x56b2('0x9c')][_0x56b2('0x9d')]['length']){return _0x196d2c[_0x56b2('0x9c')][_0x56b2('0x9d')][0x0];}else{return db[_0x56b2('0x87')][_0x56b2('0x77')](_[_0x56b2('0x18')](_0x3d2f7c[_0x56b2('0x5e')],{'firstName':_0x3d2f7c[_0x56b2('0x5e')]['to'],'email':_0x3d2f7c[_0x56b2('0x5e')]['to'],'phone':_0x3d2f7c[_0x56b2('0x5e')]['to'],'ListId':_0x196d2c[_0x56b2('0x69')]}));}}else{throw new Error(_0x56b2('0xac'));}}})[_0x56b2('0x1e')](function(_0x36a589){if(_0x36a589){var _0x4ee2c0={'UserId':_0x3d2f7c[_0x56b2('0x6f')]['id'],'ContactId':_0x36a589['id'],'MailAccountId':_0x196d2c['id'],'inReplyTo':_0x1549b5[_0x56b2('0xad')],'to':_0x3d2f7c[_0x56b2('0x5e')][_0x56b2('0xa0')],'cc':_0x3d2f7c[_0x56b2('0x5e')]['cc'],'subject':_0x3d2f7c[_0x56b2('0x5e')][_0x56b2('0xae')],'attach':_0x3d2f7c[_0x56b2('0x5e')][_0x56b2('0xaf')],'firstMsgDirection':_0x56b2('0xb0'),'lastMsgAt':moment()['format'](_0x56b2('0x99')),'lastMsgDirection':_0x56b2('0xb0'),'Messages':[_[_0x56b2('0x52')](_0x3d2f7c[_0x56b2('0x5e')],{'messageId':_0x1549b5[_0x56b2('0xad')],'sentAt':moment()['format'](_0x56b2('0x99')),'read':!![],'MailAccountId':_0x196d2c['id'],'UserId':_0x3d2f7c[_0x56b2('0x6f')]['id'],'ContactId':_0x36a589['id']})]};if(_0x3d2f7c['body'][_0x56b2('0xb1')]){_0x4ee2c0=_[_0x56b2('0x52')](_0x4ee2c0,_0x3d2f7c[_0x56b2('0x5e')][_0x56b2('0xb1')]);}return db[_0x56b2('0x85')][_0x56b2('0x77')](_0x4ee2c0,{'include':[{'model':db[_0x56b2('0x96')],'as':'Messages'}]});}})[_0x56b2('0x1e')](respondWithResult(_0x25a1f1,null))[_0x56b2('0x29')](handleError(_0x25a1f1,null));};exports[_0x56b2('0xb2')]=function(_0x51b917,_0x5ddf78,_0x4d5afb){return db[_0x56b2('0x56')]['find']({'where':{'id':_0x51b917[_0x56b2('0x5c')]['id']},'include':[{'model':db[_0x56b2('0x3e')],'as':_0x56b2('0x3f'),'raw':!![]}]})[_0x56b2('0x1e')](handleEntityNotFound(_0x5ddf78,null))[_0x56b2('0x1e')](function(_0xfadab0){if(_0xfadab0&&_0xfadab0[_0x56b2('0x3f')]){var _0x1ba5a3={'id':_0xfadab0['id'],'tls':{'rejectUnauthorized':![]}};if(_0xfadab0[_0x56b2('0x3f')][_0x56b2('0xa8')]){_0x1ba5a3[_0x56b2('0xa8')]=_0xfadab0[_0x56b2('0x3f')][_0x56b2('0xa8')];}else{_0x1ba5a3['host']=_0xfadab0[_0x56b2('0x3f')][_0x56b2('0x76')];_0x1ba5a3[_0x56b2('0x75')]=_0xfadab0[_0x56b2('0x3f')][_0x56b2('0x75')];_0x1ba5a3[_0x56b2('0xa9')]=_0xfadab0['Smtp'][_0x56b2('0xa9')];}if(_0xfadab0[_0x56b2('0x3f')][_0x56b2('0x74')]){_0x1ba5a3['auth']={'user':_0xfadab0[_0x56b2('0x3f')][_0x56b2('0x6f')],'pass':_0xfadab0['Smtp']['pass']};}return respondWithRpcPromise(_0x56b2('0xb3'),_0x56b2('0xb2'),{'account':_0x1ba5a3});}})[_0x56b2('0x1e')](respondWithResult(_0x5ddf78,null))['catch'](handleError(_0x5ddf78,null));};exports['destroy']=function(_0x1659eb,_0x55b67c){return db['MailAccount'][_0x56b2('0x5d')]({'where':{'id':_0x1659eb[_0x56b2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x55b67c,null))[_0x56b2('0x1e')](function(_0x3d46c4){if(_0x3d46c4&&_0x3d46c4[_0x56b2('0xa8')]){throw new db[(_0x56b2('0xb4'))][(_0x56b2('0xb5'))](_0x56b2('0xb6'));}return _0x3d46c4;})[_0x56b2('0x1e')](removeEntity(_0x55b67c,null))[_0x56b2('0x29')](handleError(_0x55b67c,null));};exports[_0x56b2('0xb7')]=function(_0x472d8a,_0xe6d748,_0x2da09e){return db[_0x56b2('0x56')]['find']({'where':{'id':_0x472d8a[_0x56b2('0x5c')]['id']}})[_0x56b2('0x1e')](handleEntityNotFound(_0xe6d748,null))[_0x56b2('0x1e')](function(_0x12e8cf){if(_0x12e8cf){return _0x12e8cf[_0x56b2('0xb7')](_0x472d8a[_0x56b2('0x5e')][_0x56b2('0x66')],_[_0x56b2('0x86')](_0x472d8a['body'],['ids','id'])||{})[_0x56b2('0xb8')](function(_0x333e8e){for(var _0x2ba4d7=0x0;_0x2ba4d7<_0x472d8a[_0x56b2('0x5e')]['ids']['length'];_0x2ba4d7+=0x1){socket['emit'](_0x56b2('0xb9'),{'UserId':Number(_0x472d8a[_0x56b2('0x5e')][_0x56b2('0x66')][_0x2ba4d7]),'MailAccountId':Number(_0x472d8a['params']['id'])});}return _0x333e8e;});}})['then'](respondWithResult(_0xe6d748,null))[_0x56b2('0x29')](handleError(_0xe6d748,null));};exports[_0x56b2('0xba')]=function(_0x33cf1e,_0x506f10,_0x3d57f1){return db['MailAccount'][_0x56b2('0x5d')]({'where':{'id':_0x33cf1e[_0x56b2('0x5c')]['id']}})[_0x56b2('0x1e')](handleEntityNotFound(_0x506f10,null))[_0x56b2('0x1e')](function(_0x4e4bb7){if(_0x4e4bb7){return _0x4e4bb7[_0x56b2('0xba')](_0x33cf1e[_0x56b2('0x47')][_0x56b2('0x66')])[_0x56b2('0x1e')](function(){if(_[_0x56b2('0xbb')](_0x33cf1e[_0x56b2('0x47')][_0x56b2('0x66')])){for(var _0x12f36a=0x0;_0x12f36a<_0x33cf1e[_0x56b2('0x47')][_0x56b2('0x66')]['length'];_0x12f36a+=0x1){socket[_0x56b2('0xbc')](_0x56b2('0xbd'),{'UserId':Number(_0x33cf1e['query']['ids'][_0x12f36a]),'MailAccountId':Number(_0x33cf1e[_0x56b2('0x5c')]['id'])});}}else{socket[_0x56b2('0xbc')]('userMailAccount:remove',{'UserId':Number(_0x33cf1e[_0x56b2('0x47')][_0x56b2('0x66')]),'MailAccountId':Number(_0x33cf1e[_0x56b2('0x5c')]['id'])});}});}})[_0x56b2('0x1e')](respondWithStatusCode(_0x506f10,null))[_0x56b2('0x29')](handleError(_0x506f10,null));};exports[_0x56b2('0xbe')]=function(_0x3b1231,_0x388c14,_0x2db841){var _0xd863b5={};var _0x4c2796={};var _0xe94e1b;var _0x3cce9b;return db[_0x56b2('0x56')]['findOne']({'where':{'id':_0x3b1231[_0x56b2('0x5c')]['id']}})[_0x56b2('0x1e')](handleEntityNotFound(_0x388c14,null))['then'](function(_0x318131){if(_0x318131){_0xe94e1b=_0x318131;_0x4c2796[_0x56b2('0x46')]=_[_0x56b2('0x48')](db[_0x56b2('0x89')][_0x56b2('0x43')]);_0x4c2796['query']=_[_0x56b2('0x48')](_0x3b1231[_0x56b2('0x47')]);_0x4c2796['filters']=_[_0x56b2('0x49')](_0x4c2796[_0x56b2('0x46')],_0x4c2796[_0x56b2('0x47')]);_0xd863b5[_0x56b2('0x4a')]=_[_0x56b2('0x49')](_0x4c2796['model'],qs[_0x56b2('0x4b')](_0x3b1231[_0x56b2('0x47')]['fields']));_0xd863b5[_0x56b2('0x4a')]=_0xd863b5['attributes'][_0x56b2('0x64')]?_0xd863b5[_0x56b2('0x4a')]:_0x4c2796['model'];_0xd863b5['order']=qs[_0x56b2('0x4e')](_0x3b1231[_0x56b2('0x47')][_0x56b2('0x4e')]);_0xd863b5['where']=qs['filters'](_[_0x56b2('0x50')](_0x3b1231['query'],_0x4c2796[_0x56b2('0x4f')]));if(_0x3b1231[_0x56b2('0x47')][_0x56b2('0x54')]){_0xd863b5['where']=_[_0x56b2('0x52')](_0xd863b5['where'],{'$or':_['map'](_0xd863b5[_0x56b2('0x4a')],function(_0x3d1514){var _0x57b65e={};_0x57b65e[_0x3d1514]={'$like':'%'+_0x3b1231[_0x56b2('0x47')]['filter']+'%'};return _0x57b65e;})});}_0xd863b5=_[_0x56b2('0x52')]({},_0xd863b5,_0x3b1231[_0x56b2('0x55')]);return _0xe94e1b[_0x56b2('0xbe')](_0xd863b5);}})[_0x56b2('0x1e')](function(_0xd84b75){if(_0xd84b75){_0x3cce9b=_0xd84b75[_0x56b2('0x64')];if(!_0x3b1231[_0x56b2('0x47')]['hasOwnProperty']('nolimit')){_0xd863b5['limit']=qs[_0x56b2('0x30')](_0x3b1231[_0x56b2('0x47')][_0x56b2('0x30')]);_0xd863b5[_0x56b2('0x2e')]=qs[_0x56b2('0x2e')](_0x3b1231[_0x56b2('0x47')][_0x56b2('0x2e')]);}return _0xe94e1b[_0x56b2('0xbe')](_0xd863b5);}})[_0x56b2('0x1e')](function(_0x42a5ba){if(_0x42a5ba){return _0x42a5ba?{'count':_0x3cce9b,'rows':_0x42a5ba}:null;}})[_0x56b2('0x1e')](respondWithResult(_0x388c14,null))['catch'](handleError(_0x388c14,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index ce86bbd..a04031c 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 _0xdfd2=['setMaxListeners','update','remove','emit','hook','exports','events','MailAccount'];(function(_0x214a25,_0x15071d){var _0x405988=function(_0x5c6fc1){while(--_0x5c6fc1){_0x214a25['push'](_0x214a25['shift']());}};_0x405988(++_0x15071d);}(_0xdfd2,0xf6));var _0x2dfd=function(_0x34912c,_0x365901){_0x34912c=_0x34912c-0x0;var _0x5b3617=_0xdfd2[_0x34912c];return _0x5b3617;};'use strict';var EventEmitter=require(_0x2dfd('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x2dfd('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x2dfd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2dfd('0x3'),'afterDestroy':_0x2dfd('0x4')};function emitEvent(_0x57e414){return function(_0x4b7cca,_0x37c673,_0x4298a5){MailAccountEvents[_0x2dfd('0x5')](_0x57e414+':'+_0x4b7cca['id'],_0x4b7cca);MailAccountEvents['emit'](_0x57e414,_0x4b7cca);_0x4298a5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x2dfd('0x6')](e,emitEvent(event));}}module[_0x2dfd('0x7')]=MailAccountEvents; \ No newline at end of file +var _0xdc86=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xaf4235,_0x205f86){var _0x39b9b6=function(_0x2e52c0){while(--_0x2e52c0){_0xaf4235['push'](_0xaf4235['shift']());}};_0x39b9b6(++_0x205f86);}(_0xdc86,0x118));var _0x6dc8=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xdc86[_0x1a7846];return _0x48049;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x6dc8('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x6dc8('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6dc8('0x2'),'afterDestroy':_0x6dc8('0x3')};function emitEvent(_0x36fe6a){return function(_0xfa6165,_0x44634f,_0x556a4c){MailAccountEvents[_0x6dc8('0x4')](_0x36fe6a+':'+_0xfa6165['id'],_0xfa6165);MailAccountEvents[_0x6dc8('0x4')](_0x36fe6a,_0xfa6165);_0x556a4c(null);};}for(var e in events){if(events[_0x6dc8('0x5')](e)){var event=events[e];MailAccount[_0x6dc8('0x6')](e,emitEvent(event));}}module[_0x6dc8('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index e03a298..6ccec14 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 _0x9315=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./mailAccount.attributes','MailAccount','lodash','util'];(function(_0x6a0b92,_0x3143c0){var _0x2545fe=function(_0x34ec95){while(--_0x34ec95){_0x6a0b92['push'](_0x6a0b92['shift']());}};_0x2545fe(++_0x3143c0);}(_0x9315,0x12a));var _0x5931=function(_0x2b7399,_0x2893ae){_0x2b7399=_0x2b7399-0x0;var _0x5b39f3=_0x9315[_0x2b7399];return _0x5b39f3;};'use strict';var _=require(_0x5931('0x0'));var util=require(_0x5931('0x1'));var logger=require(_0x5931('0x2'))(_0x5931('0x3'));var moment=require('moment');var BPromise=require(_0x5931('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5931('0x5'));var rimraf=require(_0x5931('0x6'));var config=require(_0x5931('0x7'));var attributes=require(_0x5931('0x8'));module['exports']=function(_0x4c49e7,_0x59a032){return _0x4c49e7['define'](_0x5931('0x9'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6314=['util','../../config/logger','api','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash'];(function(_0x415f67,_0x1fb9e3){var _0x2d0e76=function(_0xa398cf){while(--_0xa398cf){_0x415f67['push'](_0x415f67['shift']());}};_0x2d0e76(++_0x1fb9e3);}(_0x6314,0x1eb));var _0x4631=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x6314[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x4631('0x0'));var util=require(_0x4631('0x1'));var logger=require(_0x4631('0x2'))(_0x4631('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4631('0x4'));var rimraf=require(_0x4631('0x5'));var config=require(_0x4631('0x6'));var attributes=require(_0x4631('0x7'));module[_0x4631('0x8')]=function(_0x58ef62,_0x2d47b9){return _0x58ef62[_0x4631('0x9')](_0x4631('0xa'),attributes,{'tableName':_0x4631('0xb'),'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 970ffd0..33cd79d 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 _0x5854=['create','List\x20not\x20found','contact','messageId','generate','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','update','subject','attach','format','interaction','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../config/utils','client','http','defaults','redis','socket.io-emitter','register','request','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','GetMailAccount','MailAccount','findAll','options','attributes','limit','include','map','model','stringify','raw','where','ShowMailAccount','NotifyMailAccount','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','List','CmContact','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','list','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*'];(function(_0x23b57c,_0xdc7f98){var _0x4c3b1d=function(_0x283147){while(--_0x283147){_0x23b57c['push'](_0x23b57c['shift']());}};_0x4c3b1d(++_0xdc7f98);}(_0x5854,0xe7));var _0x4585=function(_0x2d034d,_0x532a40){_0x2d034d=_0x2d034d-0x0;var _0x286474=_0x5854[_0x2d034d];return _0x286474;};'use strict';var _=require(_0x4585('0x0'));var util=require(_0x4585('0x1'));var moment=require('moment');var BPromise=require(_0x4585('0x2'));var rs=require(_0x4585('0x3'));var fs=require('fs');var Redis=require(_0x4585('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4585('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4585('0x6')][_0x4585('0x7')]({'port':0x232c});config['redis']=_[_0x4585('0x8')](config[_0x4585('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4585('0xa'))(new Redis(config['redis']));require('./mailAccount.socket')[_0x4585('0xb')](socket);function respondWithRpcPromise(_0x9619af,_0x6dd037,_0x2a8304){return new BPromise(function(_0xec25ef,_0x591ca0){return client[_0x4585('0xc')](_0x9619af,_0x2a8304)[_0x4585('0xd')](function(_0x5ac7a0){logger['info'](_0x4585('0xe'),_0x6dd037,'request\x20sent');logger[_0x4585('0xf')](_0x4585('0x10'),_0x6dd037,_0x4585('0x11'),JSON['stringify'](_0x5ac7a0));if(_0x5ac7a0[_0x4585('0x12')]){if(_0x5ac7a0[_0x4585('0x12')]['code']===0x1f4){logger['error'](_0x4585('0xe'),_0x6dd037,_0x5ac7a0[_0x4585('0x12')]['message']);return _0x591ca0(_0x5ac7a0[_0x4585('0x12')][_0x4585('0x13')]);}logger[_0x4585('0x12')](_0x4585('0xe'),_0x6dd037,_0x5ac7a0[_0x4585('0x12')][_0x4585('0x13')]);return _0xec25ef(_0x5ac7a0['error'][_0x4585('0x13')]);}else{logger[_0x4585('0x14')]('MailAccount,\x20%s,\x20%s',_0x6dd037,_0x4585('0x11'));_0xec25ef(_0x5ac7a0['result']['message']);}})[_0x4585('0x15')](function(_0x22522d){logger[_0x4585('0x12')](_0x4585('0xe'),_0x6dd037,_0x22522d);_0x591ca0(_0x22522d);});});}exports[_0x4585('0x16')]=function(_0x51e874){var _0x4032f0=this;return new Promise(function(_0x137db,_0xddf0a8){return db[_0x4585('0x17')][_0x4585('0x18')]({'raw':_0x51e874['options']?_0x51e874['options']['raw']===undefined?!![]:![]:!![],'where':_0x51e874[_0x4585('0x19')]?_0x51e874[_0x4585('0x19')]['where']||null:null,'attributes':_0x51e874[_0x4585('0x19')]?_0x51e874['options'][_0x4585('0x1a')]||null:null,'limit':_0x51e874[_0x4585('0x19')]?_0x51e874[_0x4585('0x19')][_0x4585('0x1b')]||null:null,'include':_0x51e874[_0x4585('0x19')]?_0x51e874['options'][_0x4585('0x1c')]?_[_0x4585('0x1d')](_0x51e874['options'][_0x4585('0x1c')],function(_0x28b6f8){return{'model':db[_0x28b6f8['model']],'as':_0x28b6f8['as'],'attributes':_0x28b6f8[_0x4585('0x1a')],'include':_0x28b6f8[_0x4585('0x1c')]?_[_0x4585('0x1d')](_0x28b6f8[_0x4585('0x1c')],function(_0x1c320a){return{'model':db[_0x1c320a[_0x4585('0x1e')]],'as':_0x1c320a['as'],'attributes':_0x1c320a[_0x4585('0x1a')],'include':_0x1c320a[_0x4585('0x1c')]?_[_0x4585('0x1d')](_0x1c320a[_0x4585('0x1c')],function(_0x33cfe3){return{'model':db[_0x33cfe3[_0x4585('0x1e')]],'as':_0x33cfe3['as'],'attributes':_0x33cfe3[_0x4585('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4585('0xd')](function(_0x37e2d2){logger['info'](_0x4585('0x16'),_0x51e874);logger[_0x4585('0xf')](_0x4585('0x16'),_0x51e874,JSON[_0x4585('0x1f')](_0x37e2d2));_0x137db(_0x37e2d2);})[_0x4585('0x15')](function(_0x1860a1){logger[_0x4585('0x12')](_0x4585('0x16'),_0x1860a1[_0x4585('0x13')],_0x51e874);_0xddf0a8(_0x4032f0['error'](0x1f4,_0x1860a1[_0x4585('0x13')]));});});};exports['ShowMailAccount']=function(_0x190262){var _0x500bde=this;return new Promise(function(_0x249416,_0x375067){return db[_0x4585('0x17')]['find']({'raw':_0x190262[_0x4585('0x19')]?_0x190262[_0x4585('0x19')][_0x4585('0x20')]===undefined?!![]:![]:!![],'where':_0x190262[_0x4585('0x19')]?_0x190262[_0x4585('0x19')][_0x4585('0x21')]||null:null,'attributes':_0x190262[_0x4585('0x19')]?_0x190262[_0x4585('0x19')][_0x4585('0x1a')]||null:null,'include':_0x190262[_0x4585('0x19')]?_0x190262[_0x4585('0x19')]['include']?_['map'](_0x190262[_0x4585('0x19')][_0x4585('0x1c')],function(_0x2ebcf8){return{'model':db[_0x2ebcf8['model']],'as':_0x2ebcf8['as'],'attributes':_0x2ebcf8[_0x4585('0x1a')],'include':_0x2ebcf8['include']?_[_0x4585('0x1d')](_0x2ebcf8[_0x4585('0x1c')],function(_0x48e588){return{'model':db[_0x48e588[_0x4585('0x1e')]],'as':_0x48e588['as'],'attributes':_0x48e588[_0x4585('0x1a')],'include':_0x48e588[_0x4585('0x1c')]?_[_0x4585('0x1d')](_0x48e588[_0x4585('0x1c')],function(_0x2af810){return{'model':db[_0x2af810[_0x4585('0x1e')]],'as':_0x2af810['as'],'attributes':_0x2af810[_0x4585('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4585('0xd')](function(_0x409afd){logger['info']('ShowMailAccount',_0x190262);logger[_0x4585('0xf')](_0x4585('0x22'),_0x190262,JSON[_0x4585('0x1f')](_0x409afd));_0x249416(_0x409afd);})[_0x4585('0x15')](function(_0x1f9b0f){logger['error'](_0x4585('0x22'),_0x1f9b0f['message'],_0x190262);_0x375067(_0x500bde['error'](0x1f4,_0x1f9b0f[_0x4585('0x13')]));});});};exports[_0x4585('0x23')]=function(_0x37011d){var _0xf6ec54=this;return new Promise(function(_0x1a0333,_0x37fa8c){var _0x5aaae9={'body':_0x37011d['body'],'channel':'mail'};var _0x3d301c=_[_0x4585('0x24')](_[_0x4585('0x25')](db['CmContact'][_0x4585('0x26')]),[_0x4585('0x27'),_0x4585('0x28'),_0x4585('0x29'),_0x4585('0x2a')]);var _0x3051e7=![];if(_0x37011d[_0x4585('0x2b')]['id']){delete _0x37011d[_0x4585('0x2b')]['id'];}if(_[_0x4585('0x2c')](_0x37011d[_0x4585('0x2b')]['from'])){return _0x37fa8c(_0xf6ec54[_0x4585('0x12')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x4585('0x2c')](_0x37011d[_0x4585('0x2b')][_0x4585('0x2b')])||_0x37011d['body'][_0x4585('0x2b')]===''){return _0x37fa8c(_0xf6ec54[_0x4585('0x12')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x4585('0x2c')](_0x37011d[_0x4585('0x2b')][_0x4585('0x2d')])){return _0x37fa8c(_0xf6ec54['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3d301c));}if(!_[_0x4585('0x2e')](_0x3d301c,_0x37011d[_0x4585('0x2b')][_0x4585('0x2d')])){return _0x37fa8c(_0xf6ec54[_0x4585('0x12')](0x1f4,_0x4585('0x2f')+_0x3d301c));}var _0x3b072d={};_0x3b072d[_0x37011d['body'][_0x4585('0x2d')]]=_0x37011d['body'][_0x4585('0x30')];return db[_0x4585('0x17')][_0x4585('0x31')]({'where':{'id':_0x37011d[_0x4585('0x32')]['id']},'include':[{'model':db[_0x4585('0x33')],'as':_0x4585('0x34'),'include':[{'model':db[_0x4585('0x35')],'as':_0x4585('0x36'),'where':_0x3b072d,'limit':0x1,'order':[[_0x4585('0x28'),_0x4585('0x37')]]}]},{'model':db[_0x4585('0x38')],'as':_0x4585('0x39')},{'model':db[_0x4585('0x3a')],'as':_0x4585('0x3b')}]})[_0x4585('0xd')](function(_0x2f8627){if(_0x2f8627&&_0x2f8627[_0x4585('0x34')]){var _0x1468c1=_0x2f8627[_0x4585('0x3c')]({'plain':!![]});_0x5aaae9['account']=_[_0x4585('0x3d')](_0x1468c1,['Applications',_0x4585('0x34')]);_0x5aaae9[_0x4585('0x3e')]=_0x1468c1['Applications'];_0x5aaae9[_0x4585('0x3f')]=_0x1468c1[_0x4585('0x34')];_0x5aaae9[_0x4585('0x3e')]=_[_0x4585('0x40')](_0x5aaae9[_0x4585('0x3e')],[_0x4585('0x41')],[_0x4585('0x42')]);if(_0x5aaae9[_0x4585('0x32')]&&_0x5aaae9[_0x4585('0x32')][_0x4585('0x43')]){_0x5aaae9[_0x4585('0x3e')][_0x4585('0x44')]({'id':0x0,'priority':_0x5aaae9[_0x4585('0x3e')][_0x4585('0x45')]+0x1,'app':_0x4585('0x46'),'appdata':_0x4585('0x43'),'interval':_0x4585('0x47')});}if(_0x5aaae9[_0x4585('0x32')][_0x4585('0x39')]){delete _0x5aaae9['account'][_0x4585('0x39')];}if(_0x5aaae9[_0x4585('0x32')][_0x4585('0x34')]){delete _0x5aaae9[_0x4585('0x32')][_0x4585('0x34')];}if(_0x1468c1['List'][_0x4585('0x36')][_0x4585('0x45')]){return _0x1468c1['List'][_0x4585('0x36')][0x0];}var _0x25240d=_[_0x4585('0x8')](_0x37011d['body'],{'firstName':_0x37011d[_0x4585('0x2b')][_0x4585('0x30')],'ListId':_0x1468c1[_0x4585('0x2a')]});_0x25240d[_0x37011d[_0x4585('0x2b')][_0x4585('0x2d')]]=_0x37011d[_0x4585('0x2b')][_0x4585('0x30')];return db['CmContact'][_0x4585('0x48')](_0x25240d);}else{throw new Error(_0x4585('0x49'));}})[_0x4585('0xd')](function(_0x2392d3){_0x5aaae9[_0x4585('0x4a')]=_0x2392d3;if(_0x2392d3){if(!_0x37011d[_0x4585('0x2b')][_0x4585('0x13')][_0x4585('0x4b')]){_0x37011d[_0x4585('0x2b')][_0x4585('0x13')][_0x4585('0x4b')]=rs[_0x4585('0x4c')]()+'\x20'+_0x37011d[_0x4585('0x2b')][_0x4585('0x13')]['from'];}var _0x1fa0a5={'ContactId':_0x2392d3['id'],'MailAccountId':_0x37011d[_0x4585('0x32')]['id'],'inReplyTo':_0x37011d[_0x4585('0x2b')]['message'][_0x4585('0x4b')],'to':_0x37011d[_0x4585('0x2b')][_0x4585('0x13')][_0x4585('0x30')],'cc':_0x37011d[_0x4585('0x2b')][_0x4585('0x13')]['cc'],'subject':_0x37011d[_0x4585('0x2b')][_0x4585('0x13')]['subject'],'attach':_0x37011d[_0x4585('0x2b')][_0x4585('0x13')]['attach'],'lastMsgAt':moment()['format'](_0x4585('0x4d')),'lastMsgDirection':'in'};return db[_0x4585('0x4e')][_0x4585('0x31')]({'where':{'closed':![],'MailAccountId':_0x37011d[_0x4585('0x32')]['id']},'include':[{'model':db[_0x4585('0x4f')],'as':_0x4585('0x50'),'attributes':[_0x4585('0x4b')],'where':{'messageId':_0x37011d[_0x4585('0x2b')]['message']['inReplyTo']}}]})['then'](function(_0x5a6ff0){if(_0x5a6ff0){return[_0x5a6ff0,![]];}return db['MailInteraction']['create'](_0x1fa0a5)[_0x4585('0xd')](function(_0x53f902){return[_0x53f902,!![]];});});}else{throw new Error(_0x4585('0x51'));}})['spread'](function(_0x384af1,_0x25257e){if(_0x384af1){_0x3051e7=_0x25257e;if(!_0x25257e){return _0x384af1[_0x4585('0x52')]({'inReplyTo':_0x37011d[_0x4585('0x2b')][_0x4585('0x13')][_0x4585('0x4b')],'to':_0x37011d[_0x4585('0x2b')][_0x4585('0x13')][_0x4585('0x30')],'cc':_0x37011d[_0x4585('0x2b')][_0x4585('0x13')]['cc'],'subject':_0x37011d[_0x4585('0x2b')]['message'][_0x4585('0x53')],'attach':_0x384af1[_0x4585('0x54')]?_0x384af1[_0x4585('0x54')]:_0x37011d[_0x4585('0x2b')][_0x4585('0x13')][_0x4585('0x54')],'substatus':null,'substatusAt':moment()['format'](_0x4585('0x4d')),'lastMsgAt':moment()[_0x4585('0x55')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x384af1;}}})[_0x4585('0xd')](function(_0x243963){_0x5aaae9['interaction']=_0x243963['get']({'plain':!![]});_0x5aaae9[_0x4585('0x56')]['created']=_0x3051e7;return db[_0x4585('0x4f')]['create']({'body':_0x37011d['body']['body'],'MailAccountId':_0x37011d[_0x4585('0x32')]['id'],'MailInteractionId':_0x243963['id'],'direction':'in','ContactId':_0x5aaae9[_0x4585('0x4a')]['id'],'messageId':_0x37011d[_0x4585('0x2b')][_0x4585('0x13')][_0x4585('0x4b')],'from':_0x37011d[_0x4585('0x2b')]['message'][_0x4585('0x30')],'to':_0x37011d[_0x4585('0x2b')][_0x4585('0x13')]['to'],'cc':_0x37011d['body'][_0x4585('0x13')]['cc'],'subject':_0x37011d[_0x4585('0x2b')][_0x4585('0x13')][_0x4585('0x53')],'attach':_0x37011d[_0x4585('0x2b')][_0x4585('0x13')][_0x4585('0x54')],'Attachments':_0x37011d['body'][_0x4585('0x13')]['attachments'],'originTo':_0x37011d[_0x4585('0x2b')]['message']['originTo'],'originCc':_0x37011d[_0x4585('0x2b')][_0x4585('0x13')][_0x4585('0x57')],'bcc':_0x37011d[_0x4585('0x2b')][_0x4585('0x13')][_0x4585('0x58')],'ChatWebsiteId':_0x37011d[_0x4585('0x2b')][_0x4585('0x13')][_0x4585('0x59')]||null,'originChannel':_0x37011d['body'][_0x4585('0x13')]['originChannel']||_0x4585('0x5a'),'ChatOfflineMessageId':_0x37011d[_0x4585('0x2b')][_0x4585('0x13')][_0x4585('0x5b')]||null},{'include':[{'model':db[_0x4585('0x5c')],'as':'Attachments'}]});})['then'](function(_0x247e15){_0x5aaae9['message']=_0x247e15;if(_0x5aaae9[_0x4585('0x56')][_0x4585('0x5d')]){return db[_0x4585('0x5e')]['find']({'attributes':['id',_0x4585('0x5f')],'where':{'id':_0x5aaae9[_0x4585('0x56')][_0x4585('0x5d')]}})[_0x4585('0xd')](function(_0x16d77d){if(_0x16d77d){_0x5aaae9[_0x4585('0x3e')][_0x4585('0x60')]({'id':0x0,'priority':0x0,'app':_0x4585('0x61'),'appdata':_0x16d77d[_0x4585('0x5f')]+','+(_0x5aaae9['account'][_0x4585('0x62')]||0xa),'interval':_0x4585('0x47')});}return respondWithRpcPromise(_0x4585('0x63'),_0x4585('0x64'),_0x5aaae9);});}return respondWithRpcPromise(_0x4585('0x63'),_0x4585('0x64'),_0x5aaae9);})[_0x4585('0xd')](function(_0x6f4d22){_0x1a0333(_0x6f4d22);})[_0x4585('0x15')](function(_0x192d55){_0x37fa8c(_0xf6ec54['error'](0x1f4,_0x192d55[_0x4585('0x13')]));});});}; \ No newline at end of file +var _0x1998=['defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','map','model','then','catch','ShowMailAccount','find','NotifyMailAccount','body','createdAt','updatedAt','ListId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','List','CmContact','Contacts','MailApplication','Applications','Smtp','get','applications','list','asc','length','close','autoclose','*,*,*,*','create','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','spread','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','interaction','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0x2c0c8d,_0x4a86c7){var _0x114e7a=function(_0x5ef296){while(--_0x5ef296){_0x2c0c8d['push'](_0x2c0c8d['shift']());}};_0x114e7a(++_0x4a86c7);}(_0x1998,0xb1));var _0x8199=function(_0x4c0897,_0x3a969f){_0x4c0897=_0x4c0897-0x0;var _0x198215=_0x1998[_0x4c0897];return _0x198215;};'use strict';var _=require(_0x8199('0x0'));var util=require(_0x8199('0x1'));var moment=require(_0x8199('0x2'));var BPromise=require(_0x8199('0x3'));var rs=require(_0x8199('0x4'));var fs=require('fs');var Redis=require(_0x8199('0x5'));var db=require(_0x8199('0x6'))['db'];var utils=require(_0x8199('0x7'));var logger=require(_0x8199('0x8'))(_0x8199('0x9'));var config=require(_0x8199('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x8199('0xb')]['http']({'port':0x232c});config[_0x8199('0xc')]=_[_0x8199('0xd')](config[_0x8199('0xc')],{'host':_0x8199('0xe'),'port':0x18eb});var socket=require(_0x8199('0xf'))(new Redis(config['redis']));require(_0x8199('0x10'))[_0x8199('0x11')](socket);function respondWithRpcPromise(_0x3ab36f,_0x125e3f,_0x150ee4){return new BPromise(function(_0x12acfa,_0x450faa){return client[_0x8199('0x12')](_0x3ab36f,_0x150ee4)['then'](function(_0xa6e965){logger[_0x8199('0x13')](_0x8199('0x14'),_0x125e3f,'request\x20sent');logger[_0x8199('0x15')](_0x8199('0x16'),_0x125e3f,_0x8199('0x17'),JSON[_0x8199('0x18')](_0xa6e965));if(_0xa6e965[_0x8199('0x19')]){if(_0xa6e965[_0x8199('0x19')]['code']===0x1f4){logger[_0x8199('0x19')](_0x8199('0x14'),_0x125e3f,_0xa6e965[_0x8199('0x19')][_0x8199('0x1a')]);return _0x450faa(_0xa6e965[_0x8199('0x19')]['message']);}logger[_0x8199('0x19')](_0x8199('0x14'),_0x125e3f,_0xa6e965['error']['message']);return _0x12acfa(_0xa6e965[_0x8199('0x19')]['message']);}else{logger['info'](_0x8199('0x14'),_0x125e3f,_0x8199('0x17'));_0x12acfa(_0xa6e965[_0x8199('0x1b')][_0x8199('0x1a')]);}})['catch'](function(_0x213ffc){logger[_0x8199('0x19')](_0x8199('0x14'),_0x125e3f,_0x213ffc);_0x450faa(_0x213ffc);});});}exports[_0x8199('0x1c')]=function(_0x3f7548){var _0x369c18=this;return new Promise(function(_0x5b8e6e,_0x463d91){return db[_0x8199('0x1d')][_0x8199('0x1e')]({'raw':_0x3f7548[_0x8199('0x1f')]?_0x3f7548['options'][_0x8199('0x20')]===undefined?!![]:![]:!![],'where':_0x3f7548[_0x8199('0x1f')]?_0x3f7548['options'][_0x8199('0x21')]||null:null,'attributes':_0x3f7548[_0x8199('0x1f')]?_0x3f7548['options'][_0x8199('0x22')]||null:null,'limit':_0x3f7548['options']?_0x3f7548[_0x8199('0x1f')]['limit']||null:null,'include':_0x3f7548['options']?_0x3f7548[_0x8199('0x1f')][_0x8199('0x23')]?_[_0x8199('0x24')](_0x3f7548[_0x8199('0x1f')][_0x8199('0x23')],function(_0x237dad){return{'model':db[_0x237dad[_0x8199('0x25')]],'as':_0x237dad['as'],'attributes':_0x237dad[_0x8199('0x22')],'include':_0x237dad[_0x8199('0x23')]?_[_0x8199('0x24')](_0x237dad[_0x8199('0x23')],function(_0x3dbedb){return{'model':db[_0x3dbedb[_0x8199('0x25')]],'as':_0x3dbedb['as'],'attributes':_0x3dbedb[_0x8199('0x22')],'include':_0x3dbedb[_0x8199('0x23')]?_['map'](_0x3dbedb[_0x8199('0x23')],function(_0x3bb001){return{'model':db[_0x3bb001[_0x8199('0x25')]],'as':_0x3bb001['as'],'attributes':_0x3bb001[_0x8199('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8199('0x26')](function(_0x9e2d19){logger[_0x8199('0x13')](_0x8199('0x1c'),_0x3f7548);logger[_0x8199('0x15')](_0x8199('0x1c'),_0x3f7548,JSON[_0x8199('0x18')](_0x9e2d19));_0x5b8e6e(_0x9e2d19);})[_0x8199('0x27')](function(_0x21e66e){logger[_0x8199('0x19')](_0x8199('0x1c'),_0x21e66e['message'],_0x3f7548);_0x463d91(_0x369c18[_0x8199('0x19')](0x1f4,_0x21e66e[_0x8199('0x1a')]));});});};exports[_0x8199('0x28')]=function(_0x4ac778){var _0xb1f57e=this;return new Promise(function(_0x1da4a8,_0x3ff7ba){return db[_0x8199('0x1d')][_0x8199('0x29')]({'raw':_0x4ac778[_0x8199('0x1f')]?_0x4ac778[_0x8199('0x1f')][_0x8199('0x20')]===undefined?!![]:![]:!![],'where':_0x4ac778[_0x8199('0x1f')]?_0x4ac778[_0x8199('0x1f')][_0x8199('0x21')]||null:null,'attributes':_0x4ac778[_0x8199('0x1f')]?_0x4ac778[_0x8199('0x1f')][_0x8199('0x22')]||null:null,'include':_0x4ac778[_0x8199('0x1f')]?_0x4ac778[_0x8199('0x1f')]['include']?_['map'](_0x4ac778[_0x8199('0x1f')][_0x8199('0x23')],function(_0x2ad9ba){return{'model':db[_0x2ad9ba[_0x8199('0x25')]],'as':_0x2ad9ba['as'],'attributes':_0x2ad9ba[_0x8199('0x22')],'include':_0x2ad9ba['include']?_['map'](_0x2ad9ba[_0x8199('0x23')],function(_0x710fa2){return{'model':db[_0x710fa2['model']],'as':_0x710fa2['as'],'attributes':_0x710fa2['attributes'],'include':_0x710fa2['include']?_['map'](_0x710fa2[_0x8199('0x23')],function(_0x2b5291){return{'model':db[_0x2b5291[_0x8199('0x25')]],'as':_0x2b5291['as'],'attributes':_0x2b5291['attributes']};}):[]};}):[]};}):[]:[]})[_0x8199('0x26')](function(_0x311714){logger[_0x8199('0x13')](_0x8199('0x28'),_0x4ac778);logger[_0x8199('0x15')](_0x8199('0x28'),_0x4ac778,JSON[_0x8199('0x18')](_0x311714));_0x1da4a8(_0x311714);})[_0x8199('0x27')](function(_0x2b8f0a){logger[_0x8199('0x19')](_0x8199('0x28'),_0x2b8f0a[_0x8199('0x1a')],_0x4ac778);_0x3ff7ba(_0xb1f57e[_0x8199('0x19')](0x1f4,_0x2b8f0a[_0x8199('0x1a')]));});});};exports[_0x8199('0x2a')]=function(_0x53f408){var _0x578a17=this;return new Promise(function(_0x4bc90a,_0x33a033){var _0x3fe6e5={'body':_0x53f408[_0x8199('0x2b')],'channel':'mail'};var _0xcc18eb=_['difference'](_['keys'](db['CmContact']['rawAttributes']),[_0x8199('0x2c'),_0x8199('0x2d'),'CompanyId',_0x8199('0x2e')]);var _0x595387=![];if(_0x53f408['body']['id']){delete _0x53f408[_0x8199('0x2b')]['id'];}if(_[_0x8199('0x2f')](_0x53f408[_0x8199('0x2b')][_0x8199('0x30')])){return _0x33a033(_0x578a17[_0x8199('0x19')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x8199('0x2f')](_0x53f408[_0x8199('0x2b')][_0x8199('0x2b')])||_0x53f408['body'][_0x8199('0x2b')]===''){return _0x33a033(_0x578a17[_0x8199('0x19')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x53f408[_0x8199('0x2b')][_0x8199('0x31')])){return _0x33a033(_0x578a17[_0x8199('0x19')](0x1f4,_0x8199('0x32')+_0xcc18eb));}if(!_[_0x8199('0x33')](_0xcc18eb,_0x53f408['body'][_0x8199('0x31')])){return _0x33a033(_0x578a17[_0x8199('0x19')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xcc18eb));}var _0x4955b5={};_0x4955b5[_0x53f408[_0x8199('0x2b')][_0x8199('0x31')]]=_0x53f408[_0x8199('0x2b')][_0x8199('0x30')];return db[_0x8199('0x1d')][_0x8199('0x29')]({'where':{'id':_0x53f408[_0x8199('0x34')]['id']},'include':[{'model':db[_0x8199('0x35')],'as':_0x8199('0x36'),'include':[{'model':db[_0x8199('0x37')],'as':_0x8199('0x38'),'where':_0x4955b5,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x8199('0x39')],'as':_0x8199('0x3a')},{'model':db['MailServerOut'],'as':_0x8199('0x3b')}]})[_0x8199('0x26')](function(_0x53bc8c){if(_0x53bc8c&&_0x53bc8c[_0x8199('0x36')]){var _0x125337=_0x53bc8c[_0x8199('0x3c')]({'plain':!![]});_0x3fe6e5[_0x8199('0x34')]=_['omit'](_0x125337,[_0x8199('0x3a'),'List']);_0x3fe6e5[_0x8199('0x3d')]=_0x125337[_0x8199('0x3a')];_0x3fe6e5[_0x8199('0x3e')]=_0x125337[_0x8199('0x36')];_0x3fe6e5[_0x8199('0x3d')]=_['orderBy'](_0x3fe6e5['applications'],['priority'],[_0x8199('0x3f')]);if(_0x3fe6e5[_0x8199('0x34')]&&_0x3fe6e5[_0x8199('0x34')]['autoclose']){_0x3fe6e5[_0x8199('0x3d')]['push']({'id':0x0,'priority':_0x3fe6e5[_0x8199('0x3d')][_0x8199('0x40')]+0x1,'app':_0x8199('0x41'),'appdata':_0x8199('0x42'),'interval':_0x8199('0x43')});}if(_0x3fe6e5[_0x8199('0x34')][_0x8199('0x3a')]){delete _0x3fe6e5[_0x8199('0x34')]['Applications'];}if(_0x3fe6e5['account']['List']){delete _0x3fe6e5[_0x8199('0x34')]['List'];}if(_0x125337[_0x8199('0x36')][_0x8199('0x38')][_0x8199('0x40')]){return _0x125337[_0x8199('0x36')]['Contacts'][0x0];}var _0x585289=_[_0x8199('0xd')](_0x53f408[_0x8199('0x2b')],{'firstName':_0x53f408[_0x8199('0x2b')][_0x8199('0x30')],'ListId':_0x125337[_0x8199('0x2e')]});_0x585289[_0x53f408[_0x8199('0x2b')]['mapKey']]=_0x53f408[_0x8199('0x2b')][_0x8199('0x30')];return db[_0x8199('0x37')][_0x8199('0x44')](_0x585289);}else{throw new Error('List\x20not\x20found');}})[_0x8199('0x26')](function(_0x4a9c6a){_0x3fe6e5[_0x8199('0x45')]=_0x4a9c6a;if(_0x4a9c6a){if(!_0x53f408[_0x8199('0x2b')]['message'][_0x8199('0x46')]){_0x53f408[_0x8199('0x2b')][_0x8199('0x1a')]['messageId']=rs['generate']()+'\x20'+_0x53f408[_0x8199('0x2b')][_0x8199('0x1a')]['from'];}var _0x5ea76e={'ContactId':_0x4a9c6a['id'],'MailAccountId':_0x53f408[_0x8199('0x34')]['id'],'inReplyTo':_0x53f408[_0x8199('0x2b')][_0x8199('0x1a')][_0x8199('0x46')],'to':_0x53f408[_0x8199('0x2b')][_0x8199('0x1a')][_0x8199('0x30')],'cc':_0x53f408[_0x8199('0x2b')][_0x8199('0x1a')]['cc'],'subject':_0x53f408[_0x8199('0x2b')][_0x8199('0x1a')][_0x8199('0x47')],'attach':_0x53f408[_0x8199('0x2b')]['message'][_0x8199('0x48')],'lastMsgAt':moment()[_0x8199('0x49')](_0x8199('0x4a')),'lastMsgDirection':'in'};return db[_0x8199('0x4b')][_0x8199('0x29')]({'where':{'closed':![],'MailAccountId':_0x53f408[_0x8199('0x34')]['id']},'include':[{'model':db[_0x8199('0x4c')],'as':'Messages','attributes':[_0x8199('0x46')],'where':{'messageId':_0x53f408[_0x8199('0x2b')]['message'][_0x8199('0x4d')]}}]})['then'](function(_0x2fd97f){if(_0x2fd97f){return[_0x2fd97f,![]];}return db[_0x8199('0x4b')][_0x8199('0x44')](_0x5ea76e)['then'](function(_0x46f691){return[_0x46f691,!![]];});});}else{throw new Error(_0x8199('0x4e'));}})[_0x8199('0x4f')](function(_0x20621d,_0x445814){if(_0x20621d){_0x595387=_0x445814;if(!_0x445814){return _0x20621d['update']({'inReplyTo':_0x53f408[_0x8199('0x2b')][_0x8199('0x1a')]['messageId'],'to':_0x53f408['body'][_0x8199('0x1a')][_0x8199('0x30')],'cc':_0x53f408[_0x8199('0x2b')]['message']['cc'],'subject':_0x53f408[_0x8199('0x2b')][_0x8199('0x1a')][_0x8199('0x47')],'attach':_0x20621d[_0x8199('0x48')]?_0x20621d[_0x8199('0x48')]:_0x53f408[_0x8199('0x2b')][_0x8199('0x1a')][_0x8199('0x48')],'substatus':null,'substatusAt':moment()[_0x8199('0x49')](_0x8199('0x4a')),'lastMsgAt':moment()[_0x8199('0x49')](_0x8199('0x4a')),'lastMsgDirection':'in'});}else{return _0x20621d;}}})[_0x8199('0x26')](function(_0x227ae5){_0x3fe6e5['interaction']=_0x227ae5[_0x8199('0x3c')]({'plain':!![]});_0x3fe6e5['interaction']['created']=_0x595387;return db['MailMessage'][_0x8199('0x44')]({'body':_0x53f408[_0x8199('0x2b')][_0x8199('0x2b')],'MailAccountId':_0x53f408[_0x8199('0x34')]['id'],'MailInteractionId':_0x227ae5['id'],'direction':'in','ContactId':_0x3fe6e5[_0x8199('0x45')]['id'],'messageId':_0x53f408[_0x8199('0x2b')][_0x8199('0x1a')][_0x8199('0x46')],'from':_0x53f408[_0x8199('0x2b')][_0x8199('0x1a')][_0x8199('0x30')],'to':_0x53f408[_0x8199('0x2b')][_0x8199('0x1a')]['to'],'cc':_0x53f408[_0x8199('0x2b')][_0x8199('0x1a')]['cc'],'subject':_0x53f408[_0x8199('0x2b')]['message'][_0x8199('0x47')],'attach':_0x53f408['body'][_0x8199('0x1a')]['attach'],'Attachments':_0x53f408['body'][_0x8199('0x1a')]['attachments'],'originTo':_0x53f408['body'][_0x8199('0x1a')][_0x8199('0x50')],'originCc':_0x53f408[_0x8199('0x2b')][_0x8199('0x1a')]['originCc'],'bcc':_0x53f408[_0x8199('0x2b')][_0x8199('0x1a')][_0x8199('0x51')],'ChatWebsiteId':_0x53f408['body'][_0x8199('0x1a')][_0x8199('0x52')]||null,'originChannel':_0x53f408['body']['message'][_0x8199('0x53')]||_0x8199('0x54'),'ChatOfflineMessageId':_0x53f408[_0x8199('0x2b')][_0x8199('0x1a')][_0x8199('0x55')]||null},{'include':[{'model':db['Attachment'],'as':_0x8199('0x56')}]});})['then'](function(_0x5f4422){_0x3fe6e5[_0x8199('0x1a')]=_0x5f4422;if(_0x3fe6e5[_0x8199('0x57')][_0x8199('0x58')]){return db[_0x8199('0x59')][_0x8199('0x29')]({'attributes':['id',_0x8199('0x5a')],'where':{'id':_0x3fe6e5[_0x8199('0x57')][_0x8199('0x58')]}})['then'](function(_0x3ebe2b){if(_0x3ebe2b){_0x3fe6e5['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x8199('0x5b'),'appdata':_0x3ebe2b['name']+','+(_0x3fe6e5['account'][_0x8199('0x5c')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x8199('0x5d'),_0x8199('0x5e'),_0x3fe6e5);});}return respondWithRpcPromise(_0x8199('0x5d'),_0x8199('0x5e'),_0x3fe6e5);})[_0x8199('0x26')](function(_0x2f5d75){_0x4bc90a(_0x2f5d75);})[_0x8199('0x27')](function(_0x146135){_0x33a033(_0x578a17[_0x8199('0x19')](0x1f4,_0x146135[_0x8199('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 2f4d847..c1be714 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 _0xa62c=['update','emit','removeListener','register','length','mailAccount:','./mailAccount.events','remove'];(function(_0x46c8ec,_0x52c7a6){var _0x26503b=function(_0x506f11){while(--_0x506f11){_0x46c8ec['push'](_0x46c8ec['shift']());}};_0x26503b(++_0x52c7a6);}(_0xa62c,0x186));var _0xca62=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0xa62c[_0x39106e];return _0x892aec;};'use strict';var MailAccountEvents=require(_0xca62('0x0'));var events=['save',_0xca62('0x1'),_0xca62('0x2')];function createListener(_0x523841,_0x57bfee){return function(_0x2ac087){_0x57bfee[_0xca62('0x3')](_0x523841,_0x2ac087);};}function removeListener(_0x16f282,_0xb18c51){return function(){MailAccountEvents[_0xca62('0x4')](_0x16f282,_0xb18c51);};}exports[_0xca62('0x5')]=function(_0xc6fada){for(var _0x236042=0x0,_0x243ad3=events[_0xca62('0x6')];_0x236042<_0x243ad3;_0x236042++){var _0x293af5=events[_0x236042];var _0x400c27=createListener(_0xca62('0x7')+_0x293af5,_0xc6fada);MailAccountEvents['on'](_0x293af5,_0x400c27);}}; \ No newline at end of file +var _0x56c8=['register','length','./mailAccount.events','save','remove','update','emit'];(function(_0x1b6b6f,_0x213f54){var _0x252d7c=function(_0x320a3d){while(--_0x320a3d){_0x1b6b6f['push'](_0x1b6b6f['shift']());}};_0x252d7c(++_0x213f54);}(_0x56c8,0x12f));var _0x856c=function(_0x23217c,_0x167e77){_0x23217c=_0x23217c-0x0;var _0x1e1bbd=_0x56c8[_0x23217c];return _0x1e1bbd;};'use strict';var MailAccountEvents=require(_0x856c('0x0'));var events=[_0x856c('0x1'),_0x856c('0x2'),_0x856c('0x3')];function createListener(_0x51518f,_0x14fe45){return function(_0x30df82){_0x14fe45[_0x856c('0x4')](_0x51518f,_0x30df82);};}function removeListener(_0xd0f4b3,_0x2a1b07){return function(){MailAccountEvents['removeListener'](_0xd0f4b3,_0x2a1b07);};}exports[_0x856c('0x5')]=function(_0x1922f4){for(var _0x413964=0x0,_0x15a17c=events[_0x856c('0x6')];_0x413964<_0x15a17c;_0x413964++){var _0x456bdb=events[_0x413964];var _0x48d81b=createListener('mailAccount:'+_0x456bdb,_0x1922f4);MailAccountEvents['on'](_0x456bdb,_0x48d81b);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index cabae6e..a364d72 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 _0x4924=['isAuthenticated','show','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id'];(function(_0x26349b,_0x3d7030){var _0x5f3f80=function(_0x4e0d2b){while(--_0x4e0d2b){_0x26349b['push'](_0x26349b['shift']());}};_0x5f3f80(++_0x3d7030);}(_0x4924,0x96));var _0x4492=function(_0xb7cb72,_0x19d391){_0xb7cb72=_0xb7cb72-0x0;var _0x4b7570=_0x4924[_0xb7cb72];return _0x4b7570;};'use strict';var multer=require(_0x4492('0x0'));var util=require(_0x4492('0x1'));var path=require(_0x4492('0x2'));var timeout=require(_0x4492('0x3'));var express=require('express');var router=express[_0x4492('0x4')]();var fs_extra=require(_0x4492('0x5'));var auth=require(_0x4492('0x6'));var interaction=require(_0x4492('0x7'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x4492('0x8')](_0x4492('0x9'),auth[_0x4492('0xa')](),controller[_0x4492('0xb')]);router[_0x4492('0xc')](_0x4492('0x9'),auth['isAuthenticated'](),controller[_0x4492('0xd')]);router[_0x4492('0xe')](_0x4492('0x9'),auth['isAuthenticated'](),controller[_0x4492('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0f61=['Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','show','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2e6a4b,_0x30cb6b){var _0x2513f6=function(_0x4b817a){while(--_0x4b817a){_0x2e6a4b['push'](_0x2e6a4b['shift']());}};_0x2513f6(++_0x30cb6b);}(_0x0f61,0x12d));var _0x10f6=function(_0x427467,_0x38f031){_0x427467=_0x427467-0x0;var _0x1c0382=_0x0f61[_0x427467];return _0x1c0382;};'use strict';var multer=require(_0x10f6('0x0'));var util=require(_0x10f6('0x1'));var path=require(_0x10f6('0x2'));var timeout=require(_0x10f6('0x3'));var express=require(_0x10f6('0x4'));var router=express[_0x10f6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x10f6('0x6'));var interaction=require(_0x10f6('0x7'));var config=require('../../config/environment');var controller=require(_0x10f6('0x8'));router[_0x10f6('0x9')](_0x10f6('0xa'),auth['isAuthenticated'](),controller[_0x10f6('0xb')]);router[_0x10f6('0xc')](_0x10f6('0xa'),auth[_0x10f6('0xd')](),controller[_0x10f6('0xe')]);router[_0x10f6('0xf')](_0x10f6('0xa'),auth[_0x10f6('0xd')](),controller[_0x10f6('0x10')]);module[_0x10f6('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 10b026d..8c98261 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 _0x382c=['exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x10c85c,_0x6bf4){var _0x4a4c59=function(_0x2a2666){while(--_0x2a2666){_0x10c85c['push'](_0x10c85c['shift']());}};_0x4a4c59(++_0x6bf4);}(_0x382c,0x78));var _0xc382=function(_0x40dc85,_0x14e2b5){_0x40dc85=_0x40dc85-0x0;var _0x5e9047=_0x382c[_0x40dc85];return _0x5e9047;};'use strict';var Sequelize=require('sequelize');module[_0xc382('0x0')]={'priority':{'type':Sequelize[_0xc382('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc382('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xc382('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc382('0x2')],'defaultValue':_0xc382('0x4')}}; \ No newline at end of file +var _0xfa52=['TEXT','STRING','*,*,*,*','sequelize','INTEGER','noop'];(function(_0x2f88b6,_0x49ab2c){var _0x11baf5=function(_0x4a0f63){while(--_0x4a0f63){_0x2f88b6['push'](_0x2f88b6['shift']());}};_0x11baf5(++_0x49ab2c);}(_0xfa52,0x87));var _0x2fa5=function(_0x2150cd,_0x32f172){_0x2150cd=_0x2150cd-0x0;var _0x5a57df=_0xfa52[_0x2150cd];return _0x5a57df;};'use strict';var Sequelize=require(_0x2fa5('0x0'));module['exports']={'priority':{'type':Sequelize[_0x2fa5('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2fa5('0x2')},'appdata':{'type':Sequelize[_0x2fa5('0x3')]()},'description':{'type':Sequelize[_0x2fa5('0x4')]},'interval':{'type':Sequelize[_0x2fa5('0x4')],'defaultValue':_0x2fa5('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 81b4702..843021c 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x27d7fb,_0x559b56){var _0x15c05d=function(_0x4e64e6){while(--_0x4e64e6){_0x27d7fb['push'](_0x27d7fb['shift']());}};_0x15c05d(++_0x559b56);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file +var _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x5cc3b6,_0x249e4f){var _0x3ea2e0=function(_0x8ab600){while(--_0x8ab600){_0x5cc3b6['push'](_0x5cc3b6['shift']());}};_0x3ea2e0(++_0x249e4f);}(_0x9bde,0xe1));var _0xe9bd=function(_0x18f47d,_0x113c6d){_0x18f47d=_0x18f47d-0x0;var _0x19eca0=_0x9bde[_0x18f47d];return _0x19eca0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 7b70af1..a5c7d5b 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 _0xb594=['path','rimraf','../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise'];(function(_0x2b5a0a,_0x59478f){var _0x1041e2=function(_0x4f85d7){while(--_0x4f85d7){_0x2b5a0a['push'](_0x2b5a0a['shift']());}};_0x1041e2(++_0x59478f);}(_0xb594,0x1d0));var _0x4b59=function(_0x5e6ebe,_0x373752){_0x5e6ebe=_0x5e6ebe-0x0;var _0x5d80a0=_0xb594[_0x5e6ebe];return _0x5d80a0;};'use strict';var _=require(_0x4b59('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4b59('0x1'));var BPromise=require(_0x4b59('0x2'));var rp=require(_0x4b59('0x3'));var fs=require('fs');var path=require(_0x4b59('0x4'));var rimraf=require(_0x4b59('0x5'));var config=require(_0x4b59('0x6'));var attributes=require('./mailApplication.attributes');module[_0x4b59('0x7')]=function(_0x499509,_0x580579){return _0x499509[_0x4b59('0x8')](_0x4b59('0x9'),attributes,{'tableName':_0x4b59('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4b59('0xb'),'collate':_0x4b59('0xc')});}; \ No newline at end of file +var _0xef26=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailApplication.attributes','MailApplication','mail_applications','utf8mb4'];(function(_0x495054,_0x304104){var _0x146d2e=function(_0x350426){while(--_0x350426){_0x495054['push'](_0x495054['shift']());}};_0x146d2e(++_0x304104);}(_0xef26,0xf8));var _0x6ef2=function(_0xd7b303,_0x1496b2){_0xd7b303=_0xd7b303-0x0;var _0x3befe6=_0xef26[_0xd7b303];return _0x3befe6;};'use strict';var _=require('lodash');var util=require(_0x6ef2('0x0'));var logger=require(_0x6ef2('0x1'))(_0x6ef2('0x2'));var moment=require(_0x6ef2('0x3'));var BPromise=require(_0x6ef2('0x4'));var rp=require(_0x6ef2('0x5'));var fs=require('fs');var path=require(_0x6ef2('0x6'));var rimraf=require('rimraf');var config=require(_0x6ef2('0x7'));var attributes=require(_0x6ef2('0x8'));module['exports']=function(_0x1a2ab7,_0xcc81d){return _0x1a2ab7['define'](_0x6ef2('0x9'),attributes,{'tableName':_0x6ef2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6ef2('0xb'),'collate':_0x6ef2('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index ed675aa..18077ff 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 _0x1123=['moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','limit'];(function(_0x4e6dbe,_0x5877c4){var _0x495715=function(_0x1cfde4){while(--_0x1cfde4){_0x4e6dbe['push'](_0x4e6dbe['shift']());}};_0x495715(++_0x5877c4);}(_0x1123,0x118));var _0x3112=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1123[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3112('0x0'));var BPromise=require('bluebird');var rs=require(_0x3112('0x1'));var fs=require('fs');var Redis=require(_0x3112('0x2'));var db=require(_0x3112('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3112('0x4'));var config=require(_0x3112('0x5'));var jayson=require(_0x3112('0x6'));var client=jayson[_0x3112('0x7')][_0x3112('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e2b5c,_0x3bee38,_0x3f7ae4){return new BPromise(function(_0x3cd83c,_0x4849f9){return client[_0x3112('0x9')](_0x3e2b5c,_0x3f7ae4)[_0x3112('0xa')](function(_0x39b75b){logger[_0x3112('0xb')](_0x3112('0xc'),_0x3bee38,_0x3112('0xd'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x3bee38,_0x3112('0xd'),JSON[_0x3112('0xe')](_0x39b75b));if(_0x39b75b[_0x3112('0xf')]){if(_0x39b75b[_0x3112('0xf')][_0x3112('0x10')]===0x1f4){logger['error'](_0x3112('0xc'),_0x3bee38,_0x39b75b['error']['message']);return _0x4849f9(_0x39b75b[_0x3112('0xf')][_0x3112('0x11')]);}logger[_0x3112('0xf')]('MailApplication,\x20%s,\x20%s',_0x3bee38,_0x39b75b['error'][_0x3112('0x11')]);return _0x3cd83c(_0x39b75b['error'][_0x3112('0x11')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x3bee38,_0x3112('0xd'));_0x3cd83c(_0x39b75b[_0x3112('0x12')]['message']);}})[_0x3112('0x13')](function(_0x3f5cfd){logger['error']('MailApplication,\x20%s,\x20%s',_0x3bee38,_0x3f5cfd);_0x4849f9(_0x3f5cfd);});});}exports[_0x3112('0x14')]=function(_0x5ca7d9){var _0x254ffc=this;return new Promise(function(_0x22925b,_0x5e9262){return db['MailApplication'][_0x3112('0x15')](_0x5ca7d9[_0x3112('0x16')],{'raw':_0x5ca7d9[_0x3112('0x17')]?_0x5ca7d9[_0x3112('0x17')][_0x3112('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ca7d9[_0x3112('0x17')]?_0x5ca7d9['options'][_0x3112('0x19')]||null:null,'attributes':_0x5ca7d9['options']?_0x5ca7d9[_0x3112('0x17')][_0x3112('0x1a')]||null:null,'limit':_0x5ca7d9[_0x3112('0x17')]?_0x5ca7d9[_0x3112('0x17')][_0x3112('0x1b')]||null:null})['then'](function(_0x435227){logger['info'](_0x3112('0x14'),_0x5ca7d9);logger['debug']('UpdateMailApplication',_0x5ca7d9,JSON[_0x3112('0xe')](_0x435227));_0x22925b(_0x435227);})['catch'](function(_0x9f194f){logger[_0x3112('0xf')](_0x3112('0x14'),_0x9f194f['message'],_0x5ca7d9);_0x5e9262(_0x254ffc[_0x3112('0xf')](0x1f4,_0x9f194f[_0x3112('0x11')]));});});}; \ No newline at end of file +var _0x0afa=['debug','MailApplication,\x20%s,\x20%s,\x20%s','error','MailApplication,\x20%s,\x20%s','message','catch','UpdateMailApplication','MailApplication','body','options','raw','attributes','limit','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','then','info','request\x20sent'];(function(_0x392dc2,_0x47c3f3){var _0x14150f=function(_0x9f305a){while(--_0x9f305a){_0x392dc2['push'](_0x392dc2['shift']());}};_0x14150f(++_0x47c3f3);}(_0x0afa,0x137));var _0xa0af=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x0afa[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0xa0af('0x0'));var moment=require(_0xa0af('0x1'));var BPromise=require(_0xa0af('0x2'));var rs=require(_0xa0af('0x3'));var fs=require('fs');var Redis=require(_0xa0af('0x4'));var db=require(_0xa0af('0x5'))['db'];var utils=require(_0xa0af('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa0af('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa0af('0x8')][_0xa0af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fbdf3,_0x44d2c9,_0x5e542c){return new BPromise(function(_0x27cf5e,_0x245d32){return client['request'](_0x2fbdf3,_0x5e542c)[_0xa0af('0xa')](function(_0x33c2d0){logger[_0xa0af('0xb')]('MailApplication,\x20%s,\x20%s',_0x44d2c9,_0xa0af('0xc'));logger[_0xa0af('0xd')](_0xa0af('0xe'),_0x44d2c9,_0xa0af('0xc'),JSON['stringify'](_0x33c2d0));if(_0x33c2d0[_0xa0af('0xf')]){if(_0x33c2d0[_0xa0af('0xf')]['code']===0x1f4){logger[_0xa0af('0xf')](_0xa0af('0x10'),_0x44d2c9,_0x33c2d0['error']['message']);return _0x245d32(_0x33c2d0[_0xa0af('0xf')]['message']);}logger[_0xa0af('0xf')]('MailApplication,\x20%s,\x20%s',_0x44d2c9,_0x33c2d0[_0xa0af('0xf')]['message']);return _0x27cf5e(_0x33c2d0['error']['message']);}else{logger[_0xa0af('0xb')](_0xa0af('0x10'),_0x44d2c9,'request\x20sent');_0x27cf5e(_0x33c2d0['result'][_0xa0af('0x11')]);}})[_0xa0af('0x12')](function(_0x1489c5){logger['error'](_0xa0af('0x10'),_0x44d2c9,_0x1489c5);_0x245d32(_0x1489c5);});});}exports[_0xa0af('0x13')]=function(_0xb00649){var _0x5abf2d=this;return new Promise(function(_0x2dcc16,_0xa28cd0){return db[_0xa0af('0x14')]['update'](_0xb00649[_0xa0af('0x15')],{'raw':_0xb00649[_0xa0af('0x16')]?_0xb00649['options'][_0xa0af('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb00649[_0xa0af('0x16')]?_0xb00649[_0xa0af('0x16')]['where']||null:null,'attributes':_0xb00649[_0xa0af('0x16')]?_0xb00649[_0xa0af('0x16')][_0xa0af('0x18')]||null:null,'limit':_0xb00649[_0xa0af('0x16')]?_0xb00649[_0xa0af('0x16')][_0xa0af('0x19')]||null:null})[_0xa0af('0xa')](function(_0x77977){logger[_0xa0af('0xb')]('UpdateMailApplication',_0xb00649);logger[_0xa0af('0xd')](_0xa0af('0x13'),_0xb00649,JSON[_0xa0af('0x1a')](_0x77977));_0x2dcc16(_0x77977);})[_0xa0af('0x12')](function(_0x14f124){logger[_0xa0af('0xf')]('UpdateMailApplication',_0x14f124['message'],_0xb00649);_0xa28cd0(_0x5abf2d['error'](0x1f4,_0x14f124[_0xa0af('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 83ce7f5..b13f89e 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 _0x2c11=['destroy','exports','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','describe','/:id','/:id/messages','/:id/download','download','create','addMessage','post','/:id/tags','tracked','mailinteraction:addtags','addTags','put','mail','mailinteraction:update','update','delete','mailinteraction:destroy'];(function(_0x15e6fe,_0x1a5c39){var _0x34894d=function(_0x32eec2){while(--_0x32eec2){_0x15e6fe['push'](_0x15e6fe['shift']());}};_0x34894d(++_0x1a5c39);}(_0x2c11,0xd2));var _0x12c1=function(_0x1163c3,_0x3aedc6){_0x1163c3=_0x1163c3-0x0;var _0x7a7cb5=_0x2c11[_0x1163c3];return _0x7a7cb5;};'use strict';var express=require('express');var router=express[_0x12c1('0x0')]();var auth=require(_0x12c1('0x1'));var interaction=require(_0x12c1('0x2'));var controller=require(_0x12c1('0x3'));router[_0x12c1('0x4')]('/',auth[_0x12c1('0x5')](),controller['index']);router[_0x12c1('0x4')]('/describe',auth[_0x12c1('0x5')](),controller[_0x12c1('0x6')]);router[_0x12c1('0x4')](_0x12c1('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x12c1('0x4')](_0x12c1('0x8'),auth[_0x12c1('0x5')](),controller['getMessages']);router[_0x12c1('0x4')](_0x12c1('0x9'),auth['isAuthenticated'](),controller[_0x12c1('0xa')]);router['post']('/',auth[_0x12c1('0x5')](),controller[_0x12c1('0xb')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x12c1('0xc')]);router[_0x12c1('0xd')](_0x12c1('0xe'),auth['isAuthenticated'](),interaction[_0x12c1('0xf')]('mail',_0x12c1('0x10')),controller[_0x12c1('0x11')]);router[_0x12c1('0x12')](_0x12c1('0x7'),auth[_0x12c1('0x5')](),interaction[_0x12c1('0xf')](_0x12c1('0x13'),_0x12c1('0x14')),controller[_0x12c1('0x15')]);router[_0x12c1('0x16')](_0x12c1('0x7'),auth[_0x12c1('0x5')](),interaction[_0x12c1('0xf')](_0x12c1('0x13'),_0x12c1('0x17')),controller[_0x12c1('0x18')]);router[_0x12c1('0x16')](_0x12c1('0xe'),auth[_0x12c1('0x5')](),controller['removeTags']);module[_0x12c1('0x19')]=router; \ No newline at end of file +var _0x1d90=['mailinteraction:addtags','addTags','put','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail'];(function(_0x24b382,_0x52cdf1){var _0x3a4730=function(_0x259f13){while(--_0x259f13){_0x24b382['push'](_0x24b382['shift']());}};_0x3a4730(++_0x52cdf1);}(_0x1d90,0x1cb));var _0x01d9=function(_0x6a21f4,_0x220ad8){_0x6a21f4=_0x6a21f4-0x0;var _0x4c15ac=_0x1d90[_0x6a21f4];return _0x4c15ac;};'use strict';var express=require(_0x01d9('0x0'));var router=express[_0x01d9('0x1')]();var auth=require(_0x01d9('0x2'));var interaction=require(_0x01d9('0x3'));var controller=require('./mailInteraction.controller');router[_0x01d9('0x4')]('/',auth[_0x01d9('0x5')](),controller[_0x01d9('0x6')]);router[_0x01d9('0x4')](_0x01d9('0x7'),auth['isAuthenticated'](),controller[_0x01d9('0x8')]);router['get'](_0x01d9('0x9'),auth[_0x01d9('0x5')](),controller[_0x01d9('0xa')]);router['get'](_0x01d9('0xb'),auth[_0x01d9('0x5')](),controller[_0x01d9('0xc')]);router[_0x01d9('0x4')](_0x01d9('0xd'),auth[_0x01d9('0x5')](),controller[_0x01d9('0xe')]);router[_0x01d9('0xf')]('/',auth[_0x01d9('0x5')](),controller[_0x01d9('0x10')]);router[_0x01d9('0xf')](_0x01d9('0xb'),auth[_0x01d9('0x5')](),controller[_0x01d9('0x11')]);router[_0x01d9('0xf')](_0x01d9('0x12'),auth[_0x01d9('0x5')](),interaction[_0x01d9('0x13')](_0x01d9('0x14'),_0x01d9('0x15')),controller[_0x01d9('0x16')]);router[_0x01d9('0x17')]('/:id',auth[_0x01d9('0x5')](),interaction[_0x01d9('0x13')](_0x01d9('0x14'),'mailinteraction:update'),controller[_0x01d9('0x18')]);router[_0x01d9('0x19')](_0x01d9('0x9'),auth[_0x01d9('0x5')](),interaction[_0x01d9('0x13')](_0x01d9('0x14'),_0x01d9('0x1a')),controller[_0x01d9('0x1b')]);router['delete'](_0x01d9('0x12'),auth[_0x01d9('0x5')](),controller[_0x01d9('0x1c')]);module[_0x01d9('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 98179e5..6860214 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 _0xb3a1=['long','BOOLEAN','out','exports','DATE','STRING','TEXT'];(function(_0x370e86,_0xdbfd30){var _0x3bcacf=function(_0x514269){while(--_0x514269){_0x370e86['push'](_0x370e86['shift']());}};_0x3bcacf(++_0xdbfd30);}(_0xb3a1,0x1bc));var _0x1b3a=function(_0x11f12d,_0x4a2fe5){_0x11f12d=_0x11f12d-0x0;var _0x3c720b=_0xb3a1[_0x11f12d];return _0x3c720b;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0x1b3a('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1b3a('0x1')]},'disposition':{'type':Sequelize[_0x1b3a('0x2')]},'secondDisposition':{'type':Sequelize[_0x1b3a('0x2')]},'thirdDisposition':{'type':Sequelize[_0x1b3a('0x2')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x1b3a('0x3')](_0x1b3a('0x4'))},'subject':{'type':Sequelize[_0x1b3a('0x3')]()},'attach':{'type':Sequelize[_0x1b3a('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x1b3a('0x1')]},'substatus':{'type':Sequelize[_0x1b3a('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x1b3a('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1b3a('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1b3a('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1b3a('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x3544=['DATE','out','sequelize','exports','BOOLEAN','STRING','TEXT'];(function(_0x34933a,_0x327378){var _0x36abb4=function(_0x2d6814){while(--_0x2d6814){_0x34933a['push'](_0x34933a['shift']());}};_0x36abb4(++_0x327378);}(_0x3544,0x121));var _0x4354=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x3544[_0x2555d0];return _0x3bb486;};'use strict';var Sequelize=require(_0x4354('0x0'));var iconv=require('iconv');module[_0x4354('0x1')]={'closed':{'type':Sequelize[_0x4354('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x4354('0x3')]},'secondDisposition':{'type':Sequelize[_0x4354('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4354('0x3')]},'note':{'type':Sequelize[_0x4354('0x3')]},'inReplyTo':{'type':Sequelize[_0x4354('0x3')](0x1fe)},'to':{'type':Sequelize[_0x4354('0x3')]},'cc':{'type':Sequelize[_0x4354('0x4')]('long')},'subject':{'type':Sequelize[_0x4354('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4354('0x5')]},'substatus':{'type':Sequelize[_0x4354('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4354('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4354('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4354('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 0a7f160..84284c2 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 _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','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','type','text','start','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','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x1f7122,_0x27f5e8){var _0x2f7545=function(_0x8f305e){while(--_0x8f305e){_0x1f7122['push'](_0x1f7122['shift']());}};_0x2f7545(++_0x27f5e8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('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','contactName');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file +var _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','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','type','text','start','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','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x28600d,_0x1cce36){var _0x439f97=function(_0x32d000){while(--_0x32d000){_0x28600d['push'](_0x28600d['shift']());}};_0x439f97(++_0x1cce36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('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','contactName');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 7d6fe37..f9dac52 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 _0xea95=['setDataValue','map','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','MailMessage','save','update','remove','getUsers','then'];(function(_0x488ccf,_0x4a7abf){var _0x49e5dd=function(_0x15fb8c){while(--_0x15fb8c){_0x488ccf['push'](_0x488ccf['shift']());}};_0x49e5dd(++_0x4a7abf);}(_0xea95,0x1b7));var _0x5ea9=function(_0x4ed9b6,_0xa351e3){_0x4ed9b6=_0x4ed9b6-0x0;var _0x4bfa3f=_0xea95[_0x4ed9b6];return _0x4bfa3f;};'use strict';var EventEmitter=require(_0x5ea9('0x0'));var MailInteraction=require(_0x5ea9('0x1'))['db'][_0x5ea9('0x2')];var MailMessage=require(_0x5ea9('0x1'))['db'][_0x5ea9('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5ea9('0x4'),'afterUpdate':_0x5ea9('0x5'),'afterDestroy':_0x5ea9('0x6')};function emitEvent(_0x175c9a){return function(_0x1f8dba,_0x492a5b,_0x1b104d){_0x1f8dba[_0x5ea9('0x7')]({'attributes':['id'],'raw':!![]})[_0x5ea9('0x8')](function(_0x567546){_0x1f8dba[_0x5ea9('0x9')]('Users',_0x567546[_0x5ea9('0xa')](function(_0x3f6030){return{'id':_0x3f6030['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x1f8dba['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5ea9('0x8')](function(_0x1e98e1){_0x1f8dba['setDataValue']('unreadMessages',_0x1e98e1[_0x5ea9('0xb')]);MailInteractionEvents[_0x5ea9('0xc')](_0x175c9a+':'+_0x1f8dba['id'],_0x1f8dba);MailInteractionEvents[_0x5ea9('0xc')](_0x175c9a,_0x1f8dba);_0x1b104d(null);})[_0x5ea9('0xd')](_0x1b104d(null));};}for(var e in events){if(events[_0x5ea9('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x5ea9('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x931f=['exports','../../mysqldb','MailInteraction','MailMessage','save','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','emit','catch','hook'];(function(_0x4c5b19,_0x4d16ac){var _0x245588=function(_0x7e72b2){while(--_0x7e72b2){_0x4c5b19['push'](_0x4c5b19['shift']());}};_0x245588(++_0x4d16ac);}(_0x931f,0x133));var _0xf931=function(_0x5ec61d,_0x36c73c){_0x5ec61d=_0x5ec61d-0x0;var _0x2e0e5c=_0x931f[_0x5ec61d];return _0x2e0e5c;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xf931('0x0'))['db'][_0xf931('0x1')];var MailMessage=require(_0xf931('0x0'))['db'][_0xf931('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf931('0x3'),'afterUpdate':_0xf931('0x4'),'afterDestroy':_0xf931('0x5')};function emitEvent(_0x26669b){return function(_0x138c19,_0x3f792b,_0x5f46d5){_0x138c19[_0xf931('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x11e05f){_0x138c19[_0xf931('0x7')](_0xf931('0x8'),_0x11e05f[_0xf931('0x9')](function(_0x277855){return{'id':_0x277855['id']};}));return MailMessage[_0xf931('0xa')]({'where':{'MailInteractionId':_0x138c19['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf931('0xb')](function(_0x1741b3){_0x138c19[_0xf931('0x7')](_0xf931('0xc'),_0x1741b3['length']);MailInteractionEvents[_0xf931('0xd')](_0x26669b+':'+_0x138c19['id'],_0x138c19);MailInteractionEvents[_0xf931('0xd')](_0x26669b,_0x138c19);_0x5f46d5(null);})[_0xf931('0xe')](_0x5f46d5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xf931('0xf')](e,emitEvent(event));}}module[_0xf931('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 4b62e4a..be91be2 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 _0xf362=['mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','substatusAt','models','MailMessage','update','catch','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction'];(function(_0x17318b,_0x371ab8){var _0x163ef4=function(_0x27df6f){while(--_0x27df6f){_0x17318b['push'](_0x17318b['shift']());}};_0x163ef4(++_0x371ab8);}(_0xf362,0xb2));var _0x2f36=function(_0x319442,_0x59e7d0){_0x319442=_0x319442-0x0;var _0x448836=_0xf362[_0x319442];return _0x448836;};'use strict';var _=require('lodash');var util=require(_0x2f36('0x0'));var logger=require(_0x2f36('0x1'))('api');var moment=require(_0x2f36('0x2'));var BPromise=require(_0x2f36('0x3'));var rp=require(_0x2f36('0x4'));var fs=require('fs');var path=require(_0x2f36('0x5'));var rimraf=require(_0x2f36('0x6'));var config=require(_0x2f36('0x7'));var attributes=require(_0x2f36('0x8'));module['exports']=function(_0x412a8f,_0x3f4486){return _0x412a8f[_0x2f36('0x9')](_0x2f36('0xa'),attributes,{'tableName':_0x2f36('0xb'),'paranoid':![],'indexes':[{'name':_0x2f36('0xc'),'fields':[_0x2f36('0xd'),'to'],'type':_0x2f36('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4975f3,_0x765d5e,_0xe956de){if(_0x4975f3[_0x2f36('0xf')]){_0x4975f3['substatusAt']=moment()[_0x2f36('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4975f3[_0x2f36('0x11')]){_0x4975f3[_0x2f36('0x12')]=moment()[_0x2f36('0x10')](_0x2f36('0x13'));}_0xe956de(null,_0x765d5e);},'beforeUpdate':function(_0x54ded1,_0x1cd5b3,_0x192a37){if(_0x54ded1[_0x2f36('0x14')]('substatus')){_0x54ded1[_0x2f36('0x15')]=_0x54ded1[_0x2f36('0xf')]?moment()[_0x2f36('0x10')](_0x2f36('0x13')):null;}if(_0x54ded1['changed'](_0x2f36('0x11'))){_0x54ded1[_0x2f36('0x12')]=moment()['format'](_0x2f36('0x13'));_0x54ded1[_0x2f36('0xf')]=null;_0x54ded1[_0x2f36('0x15')]=null;}_0x192a37(null,_0x54ded1);},'afterUpdate':function(_0x5a8b8e,_0x48c52c,_0x3cae71){var _0x356299=_0x412a8f[_0x2f36('0x16')];var _0x5ecd71=_0x5a8b8e['get']({'plain':!![]});if(_0x5ecd71['closed']){return _0x356299[_0x2f36('0x17')][_0x2f36('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x5ecd71['id']}})['then'](function(){_0x3cae71();})[_0x2f36('0x19')](function(_0xd65fb9){_0x3cae71(_0xd65fb9);});}else{_0x3cae71();}}},'charset':_0x2f36('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7986=['YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','api','bluebird','request-promise','rimraf','../../config/environment','define','fti_mail_interactions','subject','substatusAt','format'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7986,0xf3));var _0x6798=function(_0x282ffe,_0x512a5f){_0x282ffe=_0x282ffe-0x0;var _0x1d616b=_0x7986[_0x282ffe];return _0x1d616b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6798('0x0'));var moment=require('moment');var BPromise=require(_0x6798('0x1'));var rp=require(_0x6798('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6798('0x3'));var config=require(_0x6798('0x4'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x85b07c,_0x407a91){return _0x85b07c[_0x6798('0x5')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x6798('0x6'),'fields':[_0x6798('0x7'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x389310,_0x5d2040,_0x3f8a02){if(_0x389310['substatus']){_0x389310[_0x6798('0x8')]=moment()[_0x6798('0x9')](_0x6798('0xa'));}if(_0x389310[_0x6798('0xb')]){_0x389310[_0x6798('0xc')]=moment()['format'](_0x6798('0xa'));}_0x3f8a02(null,_0x5d2040);},'beforeUpdate':function(_0x2a9650,_0x43a6e8,_0x3d46ca){if(_0x2a9650[_0x6798('0xd')](_0x6798('0xe'))){_0x2a9650['substatusAt']=_0x2a9650['substatus']?moment()[_0x6798('0x9')](_0x6798('0xa')):null;}if(_0x2a9650['changed'](_0x6798('0xb'))){_0x2a9650[_0x6798('0xc')]=moment()[_0x6798('0x9')](_0x6798('0xa'));_0x2a9650[_0x6798('0xe')]=null;_0x2a9650[_0x6798('0x8')]=null;}_0x3d46ca(null,_0x2a9650);},'afterUpdate':function(_0x23fd44,_0x425406,_0x521ac3){var _0x5c39cc=_0x85b07c[_0x6798('0xf')];var _0x2f7268=_0x23fd44[_0x6798('0x10')]({'plain':!![]});if(_0x2f7268[_0x6798('0xb')]){return _0x5c39cc[_0x6798('0x11')][_0x6798('0x12')]({'read':!![]},{'where':{'MailInteractionId':_0x2f7268['id']}})[_0x6798('0x13')](function(){_0x521ac3();})[_0x6798('0x14')](function(_0xc65135){_0x521ac3(_0xc65135);});}else{_0x521ac3();}}},'charset':_0x6798('0x15'),'collate':_0x6798('0x16')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 8433f4e..4b0cb59 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 _0xb245=['UpdateMailInteraction','MailInteraction','update','body','options','where','limit','stringify','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','defaults','socket.io-emitter','redis','register','request','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0x31e94f,_0x42ecd6){var _0x1b8494=function(_0x5da15c){while(--_0x5da15c){_0x31e94f['push'](_0x31e94f['shift']());}};_0x1b8494(++_0x42ecd6);}(_0xb245,0xf8));var _0x5b24=function(_0xe5da70,_0x2540a7){_0xe5da70=_0xe5da70-0x0;var _0x549d62=_0xb245[_0xe5da70];return _0x549d62;};'use strict';var _=require(_0x5b24('0x0'));var util=require(_0x5b24('0x1'));var moment=require(_0x5b24('0x2'));var BPromise=require('bluebird');var rs=require(_0x5b24('0x3'));var fs=require('fs');var Redis=require(_0x5b24('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5b24('0x5'))(_0x5b24('0x6'));var config=require(_0x5b24('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5b24('0x8')][_0x5b24('0x9')]({'port':0x232a});config['redis']=_[_0x5b24('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5b24('0xb'))(new Redis(config[_0x5b24('0xc')]));require('./mailInteraction.socket')[_0x5b24('0xd')](socket);function respondWithRpcPromise(_0x5e4f70,_0x58568f,_0x1e4382){return new BPromise(function(_0x3372ee,_0x2b5cc8){return client[_0x5b24('0xe')](_0x5e4f70,_0x1e4382)[_0x5b24('0xf')](function(_0x39912a){logger[_0x5b24('0x10')](_0x5b24('0x11'),_0x58568f,'request\x20sent');logger[_0x5b24('0x12')](_0x5b24('0x13'),_0x58568f,_0x5b24('0x14'),JSON['stringify'](_0x39912a));if(_0x39912a[_0x5b24('0x15')]){if(_0x39912a[_0x5b24('0x15')][_0x5b24('0x16')]===0x1f4){logger[_0x5b24('0x15')](_0x5b24('0x11'),_0x58568f,_0x39912a[_0x5b24('0x15')][_0x5b24('0x17')]);return _0x2b5cc8(_0x39912a[_0x5b24('0x15')][_0x5b24('0x17')]);}logger['error'](_0x5b24('0x11'),_0x58568f,_0x39912a[_0x5b24('0x15')][_0x5b24('0x17')]);return _0x3372ee(_0x39912a['error']['message']);}else{logger[_0x5b24('0x10')](_0x5b24('0x11'),_0x58568f,_0x5b24('0x14'));_0x3372ee(_0x39912a['result'][_0x5b24('0x17')]);}})[_0x5b24('0x18')](function(_0x481f50){logger['error'](_0x5b24('0x11'),_0x58568f,_0x481f50);_0x2b5cc8(_0x481f50);});});}exports[_0x5b24('0x19')]=function(_0x4790ce){var _0x39edd8=this;return new Promise(function(_0x4f50e9,_0x312b50){return db[_0x5b24('0x1a')][_0x5b24('0x1b')](_0x4790ce[_0x5b24('0x1c')],{'raw':_0x4790ce[_0x5b24('0x1d')]?_0x4790ce[_0x5b24('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4790ce[_0x5b24('0x1d')]?_0x4790ce[_0x5b24('0x1d')][_0x5b24('0x1e')]||null:null,'attributes':_0x4790ce[_0x5b24('0x1d')]?_0x4790ce['options']['attributes']||null:null,'limit':_0x4790ce[_0x5b24('0x1d')]?_0x4790ce[_0x5b24('0x1d')][_0x5b24('0x1f')]||null:null})[_0x5b24('0xf')](function(_0x2f9d7c){logger[_0x5b24('0x10')](_0x5b24('0x19'),_0x4790ce);logger[_0x5b24('0x12')](_0x5b24('0x19'),_0x4790ce,JSON[_0x5b24('0x20')](_0x2f9d7c));_0x4f50e9(_0x2f9d7c);})['catch'](function(_0x1f012d){logger[_0x5b24('0x15')]('UpdateMailInteraction',_0x1f012d[_0x5b24('0x17')],_0x4790ce);_0x312b50(_0x39edd8['error'](0x1f4,_0x1f012d['message']));});});};exports['AddTagsToMailInteraction']=function(_0x28f94a){return new Promise(function(_0x456b03,_0x5e5ed8){return db['MailInteraction'][_0x5b24('0x21')]({'where':_0x28f94a[_0x5b24('0x1d')]?_0x28f94a[_0x5b24('0x1d')][_0x5b24('0x1e')]||null:null})[_0x5b24('0xf')](function(_0x18671d){if(_0x18671d){return _0x18671d[_0x5b24('0x22')](_0x28f94a[_0x5b24('0x1c')][_0x5b24('0x23')],_[_0x5b24('0x24')](_0x28f94a[_0x5b24('0x1c')],[_0x5b24('0x23'),'id'])||{});}})[_0x5b24('0x25')](function(_0x2b30a1){logger[_0x5b24('0x10')](_0x5b24('0x26'),_0x28f94a);logger[_0x5b24('0x12')](_0x5b24('0x26'),_0x28f94a,JSON[_0x5b24('0x20')](_0x2b30a1));_0x456b03(_0x2b30a1);})[_0x5b24('0x18')](function(_0x270f49){logger['error'](_0x5b24('0x26'),_0x270f49[_0x5b24('0x17')],_0x28f94a);_0x5e5ed8(_this[_0x5b24('0x15')](0x1f4,_0x270f49[_0x5b24('0x17')]));});});}; \ No newline at end of file +var _0xc0f9=['localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','raw','options','where','AddTagsToMailInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x5b1c50,_0x56e694){var _0x2d379b=function(_0x981b9c){while(--_0x981b9c){_0x5b1c50['push'](_0x5b1c50['shift']());}};_0x2d379b(++_0x56e694);}(_0xc0f9,0xc5));var _0x9c0f=function(_0x252328,_0x4c22f0){_0x252328=_0x252328-0x0;var _0xaa85b7=_0xc0f9[_0x252328];return _0xaa85b7;};'use strict';var _=require(_0x9c0f('0x0'));var util=require(_0x9c0f('0x1'));var moment=require(_0x9c0f('0x2'));var BPromise=require(_0x9c0f('0x3'));var rs=require(_0x9c0f('0x4'));var fs=require('fs');var Redis=require(_0x9c0f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c0f('0x6'));var logger=require(_0x9c0f('0x7'))(_0x9c0f('0x8'));var config=require('../../config/environment');var jayson=require(_0x9c0f('0x9'));var client=jayson[_0x9c0f('0xa')][_0x9c0f('0xb')]({'port':0x232a});config[_0x9c0f('0xc')]=_['defaults'](config[_0x9c0f('0xc')],{'host':_0x9c0f('0xd'),'port':0x18eb});var socket=require(_0x9c0f('0xe'))(new Redis(config[_0x9c0f('0xc')]));require('./mailInteraction.socket')[_0x9c0f('0xf')](socket);function respondWithRpcPromise(_0x15b0ca,_0x4902e8,_0x2edb0f){return new BPromise(function(_0x20e9d8,_0x17c8c3){return client[_0x9c0f('0x10')](_0x15b0ca,_0x2edb0f)[_0x9c0f('0x11')](function(_0x249674){logger[_0x9c0f('0x12')]('MailInteraction,\x20%s,\x20%s',_0x4902e8,_0x9c0f('0x13'));logger[_0x9c0f('0x14')](_0x9c0f('0x15'),_0x4902e8,_0x9c0f('0x13'),JSON[_0x9c0f('0x16')](_0x249674));if(_0x249674[_0x9c0f('0x17')]){if(_0x249674[_0x9c0f('0x17')][_0x9c0f('0x18')]===0x1f4){logger[_0x9c0f('0x17')](_0x9c0f('0x19'),_0x4902e8,_0x249674[_0x9c0f('0x17')]['message']);return _0x17c8c3(_0x249674[_0x9c0f('0x17')]['message']);}logger[_0x9c0f('0x17')]('MailInteraction,\x20%s,\x20%s',_0x4902e8,_0x249674[_0x9c0f('0x17')][_0x9c0f('0x1a')]);return _0x20e9d8(_0x249674[_0x9c0f('0x17')]['message']);}else{logger['info'](_0x9c0f('0x19'),_0x4902e8,_0x9c0f('0x13'));_0x20e9d8(_0x249674[_0x9c0f('0x1b')][_0x9c0f('0x1a')]);}})[_0x9c0f('0x1c')](function(_0x4e2496){logger[_0x9c0f('0x17')](_0x9c0f('0x19'),_0x4902e8,_0x4e2496);_0x17c8c3(_0x4e2496);});});}exports[_0x9c0f('0x1d')]=function(_0x1f3016){var _0x5758d3=this;return new Promise(function(_0x33dff7,_0x24a892){return db[_0x9c0f('0x1e')][_0x9c0f('0x1f')](_0x1f3016[_0x9c0f('0x20')],{'raw':_0x1f3016['options']?_0x1f3016['options'][_0x9c0f('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f3016[_0x9c0f('0x22')]?_0x1f3016[_0x9c0f('0x22')][_0x9c0f('0x23')]||null:null,'attributes':_0x1f3016[_0x9c0f('0x22')]?_0x1f3016['options']['attributes']||null:null,'limit':_0x1f3016[_0x9c0f('0x22')]?_0x1f3016[_0x9c0f('0x22')]['limit']||null:null})[_0x9c0f('0x11')](function(_0x16c4ec){logger[_0x9c0f('0x12')](_0x9c0f('0x1d'),_0x1f3016);logger['debug']('UpdateMailInteraction',_0x1f3016,JSON[_0x9c0f('0x16')](_0x16c4ec));_0x33dff7(_0x16c4ec);})[_0x9c0f('0x1c')](function(_0xe2f0f5){logger[_0x9c0f('0x17')](_0x9c0f('0x1d'),_0xe2f0f5[_0x9c0f('0x1a')],_0x1f3016);_0x24a892(_0x5758d3[_0x9c0f('0x17')](0x1f4,_0xe2f0f5[_0x9c0f('0x1a')]));});});};exports[_0x9c0f('0x24')]=function(_0x56a3b7){return new Promise(function(_0x3adc6b,_0x497f24){return db[_0x9c0f('0x1e')][_0x9c0f('0x25')]({'where':_0x56a3b7[_0x9c0f('0x22')]?_0x56a3b7[_0x9c0f('0x22')]['where']||null:null})['then'](function(_0x5c0240){if(_0x5c0240){return _0x5c0240['addTags'](_0x56a3b7[_0x9c0f('0x20')][_0x9c0f('0x26')],_[_0x9c0f('0x27')](_0x56a3b7[_0x9c0f('0x20')],['ids','id'])||{});}})[_0x9c0f('0x28')](function(_0x4c2538){logger[_0x9c0f('0x12')](_0x9c0f('0x29'),_0x56a3b7);logger['debug'](_0x9c0f('0x29'),_0x56a3b7,JSON[_0x9c0f('0x16')](_0x4c2538));_0x3adc6b(_0x4c2538);})['catch'](function(_0x37c95b){logger[_0x9c0f('0x17')](_0x9c0f('0x29'),_0x37c95b[_0x9c0f('0x1a')],_0x56a3b7);_0x497f24(_this[_0x9c0f('0x17')](0x1f4,_0x37c95b[_0x9c0f('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index aa1fa70..2861b37 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 _0x571c=['length','./mailInteraction.events','update','emit','register'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0x571c,0x15f));var _0xc571=function(_0x2fab2f,_0x2e0cd5){_0x2fab2f=_0x2fab2f-0x0;var _0xabcfa1=_0x571c[_0x2fab2f];return _0xabcfa1;};'use strict';var MailInteractionEvents=require(_0xc571('0x0'));var events=['save','remove',_0xc571('0x1')];function createListener(_0x4af728,_0x2d24b5){return function(_0x388fa1){_0x2d24b5[_0xc571('0x2')](_0x4af728,_0x388fa1);};}function removeListener(_0x4b7ea7,_0x1513f5){return function(){MailInteractionEvents['removeListener'](_0x4b7ea7,_0x1513f5);};}exports[_0xc571('0x3')]=function(_0x11d868){for(var _0x4b96ca=0x0,_0x16f6ae=events[_0xc571('0x4')];_0x4b96ca<_0x16f6ae;_0x4b96ca++){var _0x800991=events[_0x4b96ca];var _0x1a6d49=createListener('mailInteraction:'+_0x800991,_0x11d868);MailInteractionEvents['on'](_0x800991,_0x1a6d49);}}; \ No newline at end of file +var _0xbef3=['./mailInteraction.events','save','update','emit','removeListener','length','mailInteraction:'];(function(_0x1dec47,_0x35d21a){var _0x5bc07e=function(_0x270a05){while(--_0x270a05){_0x1dec47['push'](_0x1dec47['shift']());}};_0x5bc07e(++_0x35d21a);}(_0xbef3,0x150));var _0x3bef=function(_0x3a516d,_0x30cd91){_0x3a516d=_0x3a516d-0x0;var _0x3e4e68=_0xbef3[_0x3a516d];return _0x3e4e68;};'use strict';var MailInteractionEvents=require(_0x3bef('0x0'));var events=[_0x3bef('0x1'),'remove',_0x3bef('0x2')];function createListener(_0xd69b44,_0x26b28a){return function(_0x55984a){_0x26b28a[_0x3bef('0x3')](_0xd69b44,_0x55984a);};}function removeListener(_0x27b549,_0x3257b9){return function(){MailInteractionEvents[_0x3bef('0x4')](_0x27b549,_0x3257b9);};}exports['register']=function(_0x1fd798){for(var _0x10950d=0x0,_0x3af27d=events[_0x3bef('0x5')];_0x10950d<_0x3af27d;_0x10950d++){var _0x2cde60=events[_0x10950d];var _0x366a3d=createListener(_0x3bef('0x6')+_0x2cde60,_0x1fd798);MailInteractionEvents['on'](_0x2cde60,_0x366a3d);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index cfc56a2..62d8eb1 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 _0x2e16=['index','/describe','/:id','show','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','reject','exports','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated'];(function(_0x188cc8,_0xd39746){var _0x4cb155=function(_0x2d2a6c){while(--_0x2d2a6c){_0x188cc8['push'](_0x188cc8['shift']());}};_0x4cb155(++_0xd39746);}(_0x2e16,0x8d));var _0x62e1=function(_0x541c6b,_0x4814be){_0x541c6b=_0x541c6b-0x0;var _0x641d0e=_0x2e16[_0x541c6b];return _0x641d0e;};'use strict';var multer=require(_0x62e1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x62e1('0x1'));var router=express[_0x62e1('0x2')]();var fs_extra=require(_0x62e1('0x3'));var auth=require(_0x62e1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x62e1('0x5'));var controller=require(_0x62e1('0x6'));router[_0x62e1('0x7')]('/',auth[_0x62e1('0x8')](),controller[_0x62e1('0x9')]);router[_0x62e1('0x7')](_0x62e1('0xa'),auth[_0x62e1('0x8')](),controller['describe']);router[_0x62e1('0x7')](_0x62e1('0xb'),auth['isAuthenticated'](),controller[_0x62e1('0xc')]);router['get']('/:id/download',auth[_0x62e1('0x8')](),controller[_0x62e1('0xd')]);router[_0x62e1('0xe')]('/',auth[_0x62e1('0x8')](),interaction[_0x62e1('0xf')](_0x62e1('0x10'),_0x62e1('0x11')),controller[_0x62e1('0x12')]);router[_0x62e1('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x62e1('0x14')]);router[_0x62e1('0x13')](_0x62e1('0x15'),auth[_0x62e1('0x8')](),controller[_0x62e1('0x16')]);router[_0x62e1('0x13')]('/:id/reject',auth[_0x62e1('0x8')](),controller[_0x62e1('0x17')]);router['delete'](_0x62e1('0xb'),auth[_0x62e1('0x8')](),controller['destroy']);module[_0x62e1('0x18')]=router; \ No newline at end of file +var _0x4060=['get','index','isAuthenticated','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller'];(function(_0x3525db,_0x245474){var _0x28564c=function(_0x497aa6){while(--_0x497aa6){_0x3525db['push'](_0x3525db['shift']());}};_0x28564c(++_0x245474);}(_0x4060,0x89));var _0x0406=function(_0x37cc77,_0x204e22){_0x37cc77=_0x37cc77-0x0;var _0x2460cf=_0x4060[_0x37cc77];return _0x2460cf;};'use strict';var multer=require('multer');var util=require(_0x0406('0x0'));var path=require('path');var timeout=require(_0x0406('0x1'));var express=require(_0x0406('0x2'));var router=express[_0x0406('0x3')]();var fs_extra=require(_0x0406('0x4'));var auth=require(_0x0406('0x5'));var interaction=require(_0x0406('0x6'));var config=require('../../config/environment');var controller=require(_0x0406('0x7'));router[_0x0406('0x8')]('/',auth['isAuthenticated'](),controller[_0x0406('0x9')]);router[_0x0406('0x8')]('/describe',auth[_0x0406('0xa')](),controller[_0x0406('0xb')]);router[_0x0406('0x8')](_0x0406('0xc'),auth[_0x0406('0xa')](),controller[_0x0406('0xd')]);router[_0x0406('0x8')](_0x0406('0xe'),auth['isAuthenticated'](),controller[_0x0406('0xf')]);router[_0x0406('0x10')]('/',auth[_0x0406('0xa')](),interaction[_0x0406('0x11')](_0x0406('0x12'),_0x0406('0x13')),controller[_0x0406('0x14')]);router[_0x0406('0x15')]('/:id',auth[_0x0406('0xa')](),controller[_0x0406('0x16')]);router[_0x0406('0x15')]('/:id/accept',auth['isAuthenticated'](),controller[_0x0406('0x17')]);router[_0x0406('0x15')](_0x0406('0x18'),auth[_0x0406('0xa')](),controller[_0x0406('0x19')]);router[_0x0406('0x1a')](_0x0406('0xc'),auth[_0x0406('0xa')](),controller[_0x0406('0x1b')]);module[_0x0406('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index e17a48a..66c2095 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 _0x1dd4=['exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','Chat','sequelize'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1dd4,0x95));var _0x41dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x41dd('0x0'));var _=require('lodash');module[_0x41dd('0x1')]={'body':{'type':Sequelize[_0x41dd('0x2')](_0x41dd('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x41dd('0x2')](_0x41dd('0x4'))},'read':{'type':Sequelize[_0x41dd('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x41dd('0x6')]('in','out'),'defaultValue':_0x41dd('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x41dd('0x8')](0x1fe)},'from':{'type':Sequelize[_0x41dd('0x8')]},'to':{'type':Sequelize[_0x41dd('0x2')]('long')},'cc':{'type':Sequelize['TEXT'](_0x41dd('0x3'))},'bcc':{'type':Sequelize[_0x41dd('0x2')]('long')},'subject':{'type':Sequelize[_0x41dd('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x41dd('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0x41dd('0x3'))},'originCc':{'type':Sequelize[_0x41dd('0x2')](_0x41dd('0x3'))},'originChannel':{'type':Sequelize['ENUM']('Email',_0x41dd('0x9')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xa322=['TEXT','medium','BOOLEAN','STRING','long','DATE','INTEGER','ENUM','Email','Chat','sequelize','lodash','exports'];(function(_0x32e1a9,_0x2dace6){var _0x422965=function(_0x51edd3){while(--_0x51edd3){_0x32e1a9['push'](_0x32e1a9['shift']());}};_0x422965(++_0x2dace6);}(_0xa322,0x15c));var _0x2a32=function(_0x3643e2,_0x71ea58){_0x3643e2=_0x3643e2-0x0;var _0x2a8368=_0xa322[_0x3643e2];return _0x2a8368;};'use strict';var Sequelize=require(_0x2a32('0x0'));var _=require(_0x2a32('0x1'));module[_0x2a32('0x2')]={'body':{'type':Sequelize[_0x2a32('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x2a32('0x3')](_0x2a32('0x4'))},'read':{'type':Sequelize[_0x2a32('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x2a32('0x6')](0x1fe)},'from':{'type':Sequelize[_0x2a32('0x6')]},'to':{'type':Sequelize[_0x2a32('0x3')]('long')},'cc':{'type':Sequelize['TEXT'](_0x2a32('0x7'))},'bcc':{'type':Sequelize[_0x2a32('0x3')](_0x2a32('0x7'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x2a32('0x8')]},'attach':{'type':Sequelize[_0x2a32('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2a32('0x8')]},'originTo':{'type':Sequelize[_0x2a32('0x3')](_0x2a32('0x7'))},'originCc':{'type':Sequelize[_0x2a32('0x3')](_0x2a32('0x7'))},'originChannel':{'type':Sequelize[_0x2a32('0xa')](_0x2a32('0xb'),_0x2a32('0xc')),'defaultValue':_0x2a32('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 7b1d436..7ad00f3 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 _0x7217=['filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','findAll','rows','show','params','length','include','find','body','describe','create','direction','out','secret','MailAccount','CmContact','Contacts','updatedAt','MailServerOut','Smtp','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','List','ListId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','readAt','UserId','agent','get','MailInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','interface','SIP/%s','channel','event','fromString','EventManager','acceptmessage','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','email','reject','rejectmessage','download','toString','server','tmp','files','message-%s.eml','from','bcc','subject','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','build','writeFileSync','eml-format','bluebird','util','path','lodash','ioredis','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','http','client','request','then','info','request\x20sent','debug','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','limit','undefined','count','Content-Range','update','destroy','stack','name','send','MailMessage','fieldName','type','key','model','map','query','keys'];(function(_0x36a6e0,_0x90a919){var _0x49a7b4=function(_0x5b7de0){while(--_0x5b7de0){_0x36a6e0['push'](_0x36a6e0['shift']());}};_0x49a7b4(++_0x90a919);}(_0x7217,0x19e));var _0x7721=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7217[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7721('0x0'));var moment=require('moment');var BPromise=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var path=require(_0x7721('0x3'));var fs=require('fs');var _=require(_0x7721('0x4'));var Redis=require(_0x7721('0x5'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require(_0x7721('0x6'))(_0x7721('0x7'));var interaction_log=require(_0x7721('0x6'))(_0x7721('0x8'));var config=require(_0x7721('0x9'));var db=require(_0x7721('0xa'))['db'];config[_0x7721('0xb')]=_[_0x7721('0xc')](config[_0x7721('0xb')],{'host':_0x7721('0xd'),'port':0x18eb});var socket=require(_0x7721('0xe'))(new Redis(config[_0x7721('0xb')]));require(_0x7721('0xf'))[_0x7721('0x10')](socket);var jayson=require(_0x7721('0x11'));var client=jayson['client'][_0x7721('0x12')]({'port':0x232c});var client9003=jayson[_0x7721('0x13')][_0x7721('0x12')]({'port':0x232b});var client9002=jayson[_0x7721('0x13')][_0x7721('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x409b37,_0x1e7fd7,_0x27b36b,_0x55b4ca){return new BPromise(function(_0x2911ec,_0x199930){var _0x57ff6d=_0x55b4ca||client;return _0x57ff6d[_0x7721('0x14')](_0x409b37,_0x27b36b)[_0x7721('0x15')](function(_0x3f01c5){logger[_0x7721('0x16')]('MailMessage,\x20%s,\x20%s',_0x1e7fd7,_0x7721('0x17'));logger[_0x7721('0x18')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x1e7fd7,'request\x20sent',JSON['stringify'](_0x3f01c5));if(_0x3f01c5[_0x7721('0x19')]){if(_0x3f01c5[_0x7721('0x19')][_0x7721('0x1a')]===0x1f4){logger[_0x7721('0x19')]('MailMessage,\x20%s,\x20%s',_0x1e7fd7,_0x3f01c5[_0x7721('0x19')]['message']);return _0x199930(_0x3f01c5[_0x7721('0x19')]['message']);}logger[_0x7721('0x19')](_0x7721('0x1b'),_0x1e7fd7,_0x3f01c5[_0x7721('0x19')][_0x7721('0x1c')]);return _0x2911ec(_0x3f01c5[_0x7721('0x19')][_0x7721('0x1c')]);}else{logger[_0x7721('0x16')](_0x7721('0x1b'),_0x1e7fd7,_0x7721('0x17'));_0x2911ec(_0x3f01c5[_0x7721('0x1d')]['message']);}})[_0x7721('0x1e')](function(_0x2c1583){logger[_0x7721('0x19')](_0x7721('0x1b'),_0x1e7fd7,_0x2c1583);_0x199930(_0x2c1583);});});}function respondWithResult(_0x57140c,_0x28f5a6){_0x28f5a6=_0x28f5a6||0xc8;return function(_0x512f31){if(_0x512f31){return _0x57140c[_0x7721('0x1f')](_0x28f5a6)[_0x7721('0x20')](_0x512f31);}};}function respondWithFilteredResult(_0x3e8a4e,_0x1caad8){return function(_0x121cc4){if(_0x121cc4){var _0x395b15=typeof _0x1caad8[_0x7721('0x21')]==='undefined'&&typeof _0x1caad8[_0x7721('0x22')]===_0x7721('0x23');var _0x125564=_0x121cc4[_0x7721('0x24')];var _0x40d550=_0x395b15?0x0:_0x1caad8[_0x7721('0x21')];var _0x424e05=_0x395b15?_0x121cc4[_0x7721('0x24')]:_0x1caad8[_0x7721('0x21')]+_0x1caad8['limit'];var _0x258ddf;if(_0x424e05>=_0x125564){_0x424e05=_0x125564;_0x258ddf=0xc8;}else{_0x258ddf=0xce;}_0x3e8a4e['status'](_0x258ddf);return _0x3e8a4e['set'](_0x7721('0x25'),_0x40d550+'-'+_0x424e05+'/'+_0x125564)[_0x7721('0x20')](_0x121cc4);}return null;};}function saveUpdates(_0x53c904){return function(_0x158d98){if(_0x158d98){return _0x158d98[_0x7721('0x26')](_0x53c904)[_0x7721('0x15')](function(_0xd7d703){return _0xd7d703;});}return null;};}function removeEntity(_0x1da2d8){return function(_0x5c54f0){if(_0x5c54f0){return _0x5c54f0[_0x7721('0x27')]()[_0x7721('0x15')](function(){_0x1da2d8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfde9ec){return function(_0x220bbf){if(!_0x220bbf){_0xfde9ec['sendStatus'](0x194);}return _0x220bbf;};}function handleError(_0x46f772,_0x4651b5){_0x4651b5=_0x4651b5||0x1f4;return function(_0x382821){logger['error'](_0x382821[_0x7721('0x28')]);if(_0x382821[_0x7721('0x29')]){delete _0x382821[_0x7721('0x29')];}_0x46f772[_0x7721('0x1f')](_0x4651b5)[_0x7721('0x2a')](_0x382821);};}exports['index']=function(_0x195ffb,_0x3e4e56){var _0xb2386d={},_0x5c5b33={},_0x35de7a={'count':0x0,'rows':[]};var _0x213a2e=_['map'](db[_0x7721('0x2b')]['rawAttributes'],function(_0x2d6ba0){return{'name':_0x2d6ba0[_0x7721('0x2c')],'type':_0x2d6ba0[_0x7721('0x2d')][_0x7721('0x2e')]};});_0x5c5b33[_0x7721('0x2f')]=_[_0x7721('0x30')](_0x213a2e,_0x7721('0x29'));_0x5c5b33[_0x7721('0x31')]=_[_0x7721('0x32')](_0x195ffb[_0x7721('0x31')]);_0x5c5b33[_0x7721('0x33')]=_['intersection'](_0x5c5b33[_0x7721('0x2f')],_0x5c5b33['query']);_0xb2386d[_0x7721('0x34')]=_[_0x7721('0x35')](_0x5c5b33[_0x7721('0x2f')],qs[_0x7721('0x36')](_0x195ffb[_0x7721('0x31')][_0x7721('0x36')]));_0xb2386d['attributes']=_0xb2386d['attributes']['length']?_0xb2386d['attributes']:_0x5c5b33[_0x7721('0x2f')];if(!_0x195ffb[_0x7721('0x31')][_0x7721('0x37')](_0x7721('0x38'))){_0xb2386d['limit']=qs[_0x7721('0x22')](_0x195ffb['query'][_0x7721('0x22')]);_0xb2386d[_0x7721('0x21')]=qs['offset'](_0x195ffb[_0x7721('0x31')][_0x7721('0x21')]);}_0xb2386d['order']=qs['sort'](_0x195ffb[_0x7721('0x31')][_0x7721('0x39')]);_0xb2386d[_0x7721('0x3a')]=qs[_0x7721('0x33')](_['pick'](_0x195ffb[_0x7721('0x31')],_0x5c5b33[_0x7721('0x33')]),_0x213a2e);if(_0x195ffb[_0x7721('0x31')][_0x7721('0x3b')]){_0xb2386d[_0x7721('0x3a')]=_['merge'](_0xb2386d[_0x7721('0x3a')],{'$or':_['map'](_0x213a2e,function(_0xaa3216){if(_0xaa3216['type']!==_0x7721('0x3c')){var _0x15fa2c={};_0x15fa2c[_0xaa3216[_0x7721('0x29')]]={'$like':'%'+_0x195ffb['query'][_0x7721('0x3b')]+'%'};return _0x15fa2c;}})});}_0xb2386d=_[_0x7721('0x3d')]({},_0xb2386d,_0x195ffb[_0x7721('0x3e')]);var _0x481fa8={'where':_0xb2386d[_0x7721('0x3a')]};return db[_0x7721('0x2b')][_0x7721('0x24')](_0x481fa8)[_0x7721('0x15')](function(_0x135dbc){_0x35de7a[_0x7721('0x24')]=_0x135dbc;if(_0x195ffb[_0x7721('0x31')]['includeAll']){_0xb2386d['include']=[{'all':!![]}];}return db[_0x7721('0x2b')][_0x7721('0x3f')](_0xb2386d);})[_0x7721('0x15')](function(_0x39a3ad){_0x35de7a[_0x7721('0x40')]=_0x39a3ad;return _0x35de7a;})[_0x7721('0x15')](respondWithFilteredResult(_0x3e4e56,_0xb2386d))[_0x7721('0x1e')](handleError(_0x3e4e56,null));};exports[_0x7721('0x41')]=function(_0xa601bc,_0x3af123){var _0x5460cd={'raw':!![],'where':{'id':_0xa601bc[_0x7721('0x42')]['id']}},_0x578867={};_0x578867[_0x7721('0x2f')]=_[_0x7721('0x32')](db[_0x7721('0x2b')]['rawAttributes']);_0x578867[_0x7721('0x31')]=_[_0x7721('0x32')](_0xa601bc['query']);_0x578867[_0x7721('0x33')]=_['intersection'](_0x578867[_0x7721('0x2f')],_0x578867['query']);_0x5460cd[_0x7721('0x34')]=_[_0x7721('0x35')](_0x578867[_0x7721('0x2f')],qs['fields'](_0xa601bc[_0x7721('0x31')][_0x7721('0x36')]));_0x5460cd['attributes']=_0x5460cd[_0x7721('0x34')][_0x7721('0x43')]?_0x5460cd[_0x7721('0x34')]:_0x578867['model'];if(_0xa601bc[_0x7721('0x31')]['includeAll']){_0x5460cd[_0x7721('0x44')]=[{'all':!![]}];}_0x5460cd=_[_0x7721('0x3d')]({},_0x5460cd,_0xa601bc[_0x7721('0x3e')]);return db[_0x7721('0x2b')][_0x7721('0x45')](_0x5460cd)[_0x7721('0x15')](handleEntityNotFound(_0x3af123,null))[_0x7721('0x15')](respondWithResult(_0x3af123,null))[_0x7721('0x1e')](handleError(_0x3af123,null));};exports[_0x7721('0x26')]=function(_0x3386aa,_0x31770e){if(_0x3386aa[_0x7721('0x46')]['id']){delete _0x3386aa[_0x7721('0x46')]['id'];}return db[_0x7721('0x2b')][_0x7721('0x45')]({'where':{'id':_0x3386aa['params']['id']}})[_0x7721('0x15')](handleEntityNotFound(_0x31770e,null))[_0x7721('0x15')](saveUpdates(_0x3386aa[_0x7721('0x46')],null))[_0x7721('0x15')](respondWithResult(_0x31770e,null))[_0x7721('0x1e')](handleError(_0x31770e,null));};exports[_0x7721('0x27')]=function(_0x267f5e,_0x57484c){return db[_0x7721('0x2b')][_0x7721('0x45')]({'where':{'id':_0x267f5e[_0x7721('0x42')]['id']}})[_0x7721('0x15')](handleEntityNotFound(_0x57484c,null))[_0x7721('0x15')](removeEntity(_0x57484c,null))[_0x7721('0x1e')](handleError(_0x57484c,null));};exports[_0x7721('0x47')]=function(_0x33287d,_0x11b300){return db[_0x7721('0x2b')][_0x7721('0x47')]()['then'](respondWithResult(_0x11b300,null))[_0x7721('0x1e')](handleError(_0x11b300,null));};exports[_0x7721('0x48')]=function(_0x1234bc,_0x2ee3c0){return db[_0x7721('0x2b')][_0x7721('0x48')](_0x1234bc[_0x7721('0x46')])[_0x7721('0x15')](function(_0x360882){if(_0x360882){if(_0x360882[_0x7721('0x49')]===_0x7721('0x4a')&&!_0x360882[_0x7721('0x4b')]){var _0x106664,_0x18f7f6,_0x300ea4;if(_0x1234bc['body']['to']){_0x18f7f6=_0x1234bc['body']['to']['split'](',')[0x0];}return db[_0x7721('0x4c')]['findOne']({'where':{'id':_0x360882['MailAccountId']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x7721('0x4d')],'as':_0x7721('0x4e'),'where':{'email':_0x18f7f6},'limit':0x1,'order':[[_0x7721('0x4f'),'DESC']]}]},{'model':db[_0x7721('0x50')],'as':'Smtp','raw':!![]}]})['then'](function(_0x484b8e){_0x106664=_0x484b8e;if(_0x106664&&_0x106664[_0x7721('0x51')]){var _0x4f0d38={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x106664['Smtp'][_0x7721('0x52')])){_0x4f0d38[_0x7721('0x53')]=_0x106664[_0x7721('0x51')]['host'];_0x4f0d38[_0x7721('0x54')]=_0x106664[_0x7721('0x51')][_0x7721('0x54')];_0x4f0d38[_0x7721('0x55')]=_0x106664[_0x7721('0x51')][_0x7721('0x55')];if(_0x106664[_0x7721('0x51')][_0x7721('0x56')]){_0x4f0d38[_0x7721('0x57')]={'user':_0x106664[_0x7721('0x51')][_0x7721('0x58')],'pass':_0x106664[_0x7721('0x51')][_0x7721('0x59')]};}}else{_0x4f0d38[_0x7721('0x52')]=_0x106664[_0x7721('0x51')]['service'];_0x4f0d38[_0x7721('0x57')]={'user':_0x106664[_0x7721('0x51')][_0x7721('0x58')],'pass':_0x106664[_0x7721('0x51')]['pass']};_0x4f0d38[_0x7721('0x55')]=_0x106664[_0x7721('0x51')]['secure'];}if(_0x1234bc[_0x7721('0x46')]['attachments']&&_0x1234bc[_0x7721('0x46')][_0x7721('0x5a')][_0x7721('0x43')]){for(var _0x3f9eaa=0x0;_0x3f9eaa<_0x1234bc[_0x7721('0x46')][_0x7721('0x5a')][_0x7721('0x43')];_0x3f9eaa+=0x1){_0x1234bc[_0x7721('0x46')][_0x7721('0x5a')][_0x3f9eaa]={'filename':_0x1234bc['body'][_0x7721('0x5a')][_0x3f9eaa][_0x7721('0x29')],'path':path[_0x7721('0x5b')](config[_0x7721('0x5c')],_0x7721('0x5d'),_0x1234bc[_0x7721('0x46')][_0x7721('0x5a')][_0x3f9eaa]['basename'])};}}_0x300ea4={'account':_0x4f0d38,'message':_0x1234bc[_0x7721('0x46')]};return;}})[_0x7721('0x15')](function(){if(_0x106664['List']){if(_0x106664[_0x7721('0x5e')]['Contacts'][_0x7721('0x43')]){return _0x106664[_0x7721('0x5e')][_0x7721('0x4e')][0x0];}else{return db[_0x7721('0x4d')][_0x7721('0x48')](_[_0x7721('0xc')](_0x1234bc[_0x7721('0x46')],{'firstName':_0x1234bc['body']['to'],'email':_0x1234bc[_0x7721('0x46')]['to'],'phone':_0x1234bc[_0x7721('0x46')]['to'],'ListId':_0x106664[_0x7721('0x5f')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x300ea4){return respondWithRpcPromise('SendMail','sendMail',_0x300ea4,client9003)['then'](function(_0x1fc5f7){return _0x360882[_0x7721('0x26')]({'read':!![],'messageId':_0x1fc5f7['messageId'],'sentAt':moment()[_0x7721('0x60')](_0x7721('0x61'))});})[_0x7721('0x1e')](function(_0x4593e1){logger['error']('%s',JSON[_0x7721('0x62')](_0x4593e1));return _0x360882;});}return _0x360882;});}return _0x360882;}})[_0x7721('0x15')](respondWithResult(_0x2ee3c0,0xc9))[_0x7721('0x1e')](handleError(_0x2ee3c0,null));};exports[_0x7721('0x63')]=function(_0x3cf3fd,_0x53adb1){var _0x29ac64={'agent':{},'channel':_0x7721('0x64')};if(_0x3cf3fd[_0x7721('0x46')]['id']){delete _0x3cf3fd['body']['id'];}_0x3cf3fd['body'][_0x7721('0x65')]=!![];_0x3cf3fd[_0x7721('0x46')][_0x7721('0x66')]=moment()[_0x7721('0x60')](_0x7721('0x61'));_0x3cf3fd['body']['UserId']=_0x3cf3fd[_0x7721('0x46')][_0x7721('0x67')]||_0x3cf3fd[_0x7721('0x58')]['id'];_0x29ac64[_0x7721('0x68')]['id']=_0x3cf3fd[_0x7721('0x46')][_0x7721('0x67')];return db[_0x7721('0x2b')]['find']({'where':{'id':_0x3cf3fd[_0x7721('0x42')]['id'],'UserId':null}})[_0x7721('0x15')](handleEntityNotFound(_0x53adb1,null))[_0x7721('0x15')](saveUpdates(_0x3cf3fd['body'],null))[_0x7721('0x15')](function(_0x1a53d6){if(_0x1a53d6){_0x29ac64[_0x7721('0x1c')]=_0x1a53d6[_0x7721('0x69')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x1a53d6[_0x7721('0x6a')]}});}return null;})[_0x7721('0x15')](handleEntityNotFound(_0x53adb1,null))[_0x7721('0x15')](function(_0x42c849){if(_0x42c849){return _0x42c849[_0x7721('0x26')]({'UserId':_0x3cf3fd[_0x7721('0x46')]['UserId'],'read1stAt':_[_0x7721('0x6b')](_0x42c849[_0x7721('0x6c')])?moment()[_0x7721('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x7721('0x15')](function(_0x3b16f3){if(_0x3b16f3){_0x29ac64[_0x7721('0x6d')]=_0x3b16f3[_0x7721('0x69')]({'plain':!![]});interaction_log[_0x7721('0x16')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3cf3fd[_0x7721('0x58')]['id'],_0x3cf3fd['user'][_0x7721('0x29')],_0x3cf3fd[_0x7721('0x58')][_0x7721('0x6e')],_0x29ac64[_0x7721('0x6d')]['id'],_0x3cf3fd[_0x7721('0x46')]?JSON[_0x7721('0x62')](_0x3cf3fd[_0x7721('0x46')]):_0x7721('0x6f'));return respondWithRpcPromise(_0x7721('0x70'),_0x7721('0x71'),_0x29ac64);}return null;})[_0x7721('0x15')](function(_0x55d209){var _0x19fad6=_0x7721('0x72')+_0x55d209[_0x7721('0x1c')]['ContactId'];return db[_0x7721('0x73')][_0x7721('0x31')](_0x19fad6,{'type':db[_0x7721('0x74')][_0x7721('0x75')][_0x7721('0x76')],'raw':!![]})['then'](function(_0x1276ce){return _0x1276ce;});})[_0x7721('0x15')](function(_0x44326d){if(_0x44326d){_0x29ac64[_0x7721('0x1c')][_0x7721('0x77')]=_0x44326d[0x0];if(!_0x3cf3fd[_0x7721('0x46')]['UserId'])return;return db[_0x7721('0x78')][_0x7721('0x45')]({'where':{'id':_0x3cf3fd['body'][_0x7721('0x67')],'role':'agent'},'attributes':['id',_0x7721('0x29'),_0x7721('0x79'),'email',_0x7721('0x7a')],'raw':!![]});}return null;})['then'](function(_0x56069f){if(!_0x56069f)return null;_0x29ac64['message'][_0x7721('0x68')]=_0x56069f;return _0x29ac64;})[_0x7721('0x15')](function(_0x21a686){if(_0x21a686){if(_0x3cf3fd['body']['manual']){_0x29ac64['message'][_0x7721('0x7b')]=util[_0x7721('0x60')](_0x7721('0x7c'),_0x3cf3fd[_0x7721('0x58')][_0x7721('0x29')]);_0x29ac64[_0x7721('0x1c')]['channel']=_0x29ac64[_0x7721('0x7d')];_0x29ac64[_0x7721('0x1c')][_0x7721('0x7e')]=_0x7721('0x63');_0x29ac64[_0x7721('0x1c')][_0x7721('0x46')]=htmlToText[_0x7721('0x7f')](_0x29ac64[_0x7721('0x1c')][_0x7721('0x46')]);return respondWithRpcPromise(_0x7721('0x80'),_0x7721('0x80'),{'event':_0x7721('0x81'),'message':_0x29ac64['message']},client9002)['then'](function(){return _0x29ac64;});}return _0x29ac64;}return null;})[_0x7721('0x15')](respondWithResult(_0x53adb1,null))[_0x7721('0x1e')](handleError(_0x53adb1,null));};exports['reject']=function(_0x167e05,_0x570cf4){var _0x4e3c93={'agent':{},'channel':_0x7721('0x64')};if(_0x167e05['body']['id']){delete _0x167e05['body']['id'];}_0x167e05[_0x7721('0x46')][_0x7721('0x67')]=_0x167e05[_0x7721('0x46')][_0x7721('0x67')]||_0x167e05[_0x7721('0x58')]['id'];_0x4e3c93['agent']['id']=_0x167e05[_0x7721('0x46')][_0x7721('0x67')];return db[_0x7721('0x2b')][_0x7721('0x45')]({'where':{'id':_0x167e05['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x570cf4,null))[_0x7721('0x15')](function(_0x1790d3){if(_0x1790d3){_0x4e3c93['message']=_0x1790d3[_0x7721('0x69')]({'plain':!![]});return db[_0x7721('0x82')]['find']({'where':{'id':_0x1790d3['MailInteractionId']}});}return null;})[_0x7721('0x15')](handleEntityNotFound(_0x570cf4,null))[_0x7721('0x15')](function(_0x606b4b){if(_0x606b4b){_0x4e3c93[_0x7721('0x6d')]=_0x606b4b[_0x7721('0x69')]({'plain':!![]});interaction_log[_0x7721('0x16')](_0x7721('0x83'),_0x167e05[_0x7721('0x58')]['id'],_0x167e05['user'][_0x7721('0x29')],_0x167e05[_0x7721('0x58')][_0x7721('0x6e')],_0x4e3c93[_0x7721('0x6d')]['id'],_0x167e05[_0x7721('0x46')]?JSON[_0x7721('0x62')](_0x167e05[_0x7721('0x46')]):'null');return respondWithRpcPromise(_0x7721('0x84'),_0x7721('0x85'),_0x4e3c93);}return null;})['then'](function(_0x9b3e44){var _0x1cc8ee=_0x7721('0x72')+_0x9b3e44[_0x7721('0x1c')][_0x7721('0x86')];return db[_0x7721('0x73')][_0x7721('0x31')](_0x1cc8ee,{'type':db[_0x7721('0x74')][_0x7721('0x75')][_0x7721('0x76')],'raw':!![]})['then'](function(_0x418954){return _0x418954;});})[_0x7721('0x15')](function(_0xc894d4){if(_0xc894d4){_0x4e3c93[_0x7721('0x1c')][_0x7721('0x77')]=_0xc894d4[0x0];if(!_0x167e05[_0x7721('0x46')][_0x7721('0x67')])return;return db[_0x7721('0x78')][_0x7721('0x45')]({'where':{'id':_0x167e05[_0x7721('0x46')][_0x7721('0x67')],'role':_0x7721('0x68')},'attributes':['id',_0x7721('0x29'),_0x7721('0x79'),_0x7721('0x87'),_0x7721('0x7a')],'raw':!![]});}return null;})[_0x7721('0x15')](function(_0x1fb651){if(!_0x1fb651)return null;_0x4e3c93[_0x7721('0x1c')][_0x7721('0x68')]=_0x1fb651;return _0x4e3c93;})['then'](function(_0x3fc25c){if(_0x3fc25c){_0x3fc25c['message'][_0x7721('0x7b')]=util[_0x7721('0x60')](_0x7721('0x7c'),_0x167e05[_0x7721('0x58')][_0x7721('0x29')]);_0x3fc25c['message']['channel']=_0x4e3c93['channel'];_0x3fc25c['message'][_0x7721('0x7e')]=_0x7721('0x88');_0x3fc25c[_0x7721('0x1c')][_0x7721('0x46')]=htmlToText[_0x7721('0x7f')](_0x4e3c93['message'][_0x7721('0x46')]);respondWithRpcPromise('EventManager',_0x7721('0x80'),{'event':_0x7721('0x89'),'message':_0x3fc25c[_0x7721('0x1c')]},client9002);return _0x4e3c93;}return null;})[_0x7721('0x15')](respondWithResult(_0x570cf4,null))[_0x7721('0x1e')](handleError(_0x570cf4,null));};exports[_0x7721('0x8a')]=function(_0x56b916,_0x30ce7c){var _0x56f321=moment()['unix']()[_0x7721('0x8b')]();var _0xf718dd=path[_0x7721('0x5b')](config[_0x7721('0x5c')],_0x7721('0x8c'),'files',_0x7721('0x8d'));var _0x2561b5=path[_0x7721('0x5b')](config[_0x7721('0x5c')],_0x7721('0x8c'),_0x7721('0x8e'),_0x7721('0x5a'));var _0x50ee94=util[_0x7721('0x60')](_0x7721('0x8f'),_0x56f321);return db[_0x7721('0x2b')][_0x7721('0x45')]({'where':{'id':_0x56b916[_0x7721('0x42')]['id']},'attributes':['id','body',_0x7721('0x90'),'to','cc',_0x7721('0x91'),_0x7721('0x92'),'createdAt'],'include':_0x56b916[_0x7721('0x31')][_0x7721('0x5a')]?[{'model':db['Attachment'],'as':_0x7721('0x93')}]:undefined})[_0x7721('0x15')](handleEntityNotFound(_0x30ce7c,null))[_0x7721('0x15')](function(_0x30f548){if(_0x30f548){var _0x5b64de=_0x30f548;var _0x40beb8={'from':_0x5b64de['from'],'to':_0x5b64de['to'],'subject':_0x5b64de[_0x7721('0x92')],'html':_0x5b64de[_0x7721('0x46')],'headers':{'Date':moment(_0x5b64de['createdAt'])[_0x7721('0x60')](_0x7721('0x94'))},'attachments':[]};if(_0x30f548['cc']){_0x40beb8['headers']['Cc']=_0x30f548['cc'];}if(_0x30f548[_0x7721('0x91')]){_0x40beb8[_0x7721('0x95')]['Bcc']=_0x30f548[_0x7721('0x91')];}return new BPromise(function(_0x52e8b1,_0x240b0a){if(_0x30f548[_0x7721('0x93')]){for(var _0x271632=0x0;_0x271632<_0x30f548['Attachments'][_0x7721('0x43')];_0x271632++){var _0x506f9c=_0x30f548['Attachments'][_0x271632];var _0x287d61=path[_0x7721('0x5b')](_0x2561b5,_0x506f9c[_0x7721('0x96')]);if(fs[_0x7721('0x97')](_0x287d61)){_0x40beb8[_0x7721('0x5a')]['push']({'name':_0x506f9c[_0x7721('0x29')],'contentType':_0x506f9c[_0x7721('0x2d')],'data':fs[_0x7721('0x98')](_0x287d61)});}}}emlformat[_0x7721('0x99')](_0x40beb8,function(_0x42cd58,_0x58173d){if(_0x42cd58)return _0x240b0a(_0x42cd58);fs[_0x7721('0x9a')](path['join'](_0xf718dd,_0x50ee94),_0x58173d);return _0x52e8b1(_0x58173d);});});}})[_0x7721('0x15')](function(_0x4ade82){if(_0x4ade82){return _0x30ce7c['download'](path[_0x7721('0x5b')](_0xf718dd,_0x50ee94),_0x50ee94,function(_0x52f3c8){if(!_0x52f3c8)fs['unlinkSync'](path[_0x7721('0x5b')](_0xf718dd,_0x50ee94));});}})[_0x7721('0x1e')](handleError(_0x30ce7c,null));}; \ No newline at end of file +var _0x34e8=['message','info','catch','status','json','offset','undefined','limit','count','set','Content-Range','destroy','end','sendStatus','name','send','index','map','MailMessage','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','length','include','find','body','create','direction','out','secret','MailAccount','findOne','CmList','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename','ListId','sendMail','update','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','readAt','UserId','agent','get','MailInteraction','MailInteractionId','format','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','SIP/%s','channel','fromString','EventManager','acceptmessage','reject','mail','RejectMessage','rejectMessage','email','interface','event','rejectmessage','download','unix','toString','files','tmp','server','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0x34e8,0x12c));var _0x834e=function(_0x1bd529,_0x23d017){_0x1bd529=_0x1bd529-0x0;var _0x3f18fa=_0x34e8[_0x1bd529];return _0x3f18fa;};'use strict';var emlformat=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var util=require(_0x834e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x834e('0x4'));var Redis=require(_0x834e('0x5'));var htmlToText=require(_0x834e('0x6'));var qs=require(_0x834e('0x7'));var logger=require(_0x834e('0x8'))(_0x834e('0x9'));var interaction_log=require(_0x834e('0x8'))('mail-interactions');var config=require(_0x834e('0xa'));var db=require('../../mysqldb')['db'];config[_0x834e('0xb')]=_[_0x834e('0xc')](config[_0x834e('0xb')],{'host':_0x834e('0xd'),'port':0x18eb});var socket=require(_0x834e('0xe'))(new Redis(config[_0x834e('0xb')]));require(_0x834e('0xf'))[_0x834e('0x10')](socket);var jayson=require(_0x834e('0x11'));var client=jayson[_0x834e('0x12')][_0x834e('0x13')]({'port':0x232c});var client9003=jayson[_0x834e('0x12')][_0x834e('0x13')]({'port':0x232b});var client9002=jayson[_0x834e('0x12')][_0x834e('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x1e00de,_0x2fd95c,_0x538bb3,_0x5e5b6d){return new BPromise(function(_0x6cd9b9,_0x58a27e){var _0x23848e=_0x5e5b6d||client;return _0x23848e[_0x834e('0x14')](_0x1e00de,_0x538bb3)[_0x834e('0x15')](function(_0x21cc0a){logger['info'](_0x834e('0x16'),_0x2fd95c,_0x834e('0x17'));logger['debug'](_0x834e('0x18'),_0x2fd95c,'request\x20sent',JSON[_0x834e('0x19')](_0x21cc0a));if(_0x21cc0a[_0x834e('0x1a')]){if(_0x21cc0a['error'][_0x834e('0x1b')]===0x1f4){logger[_0x834e('0x1a')](_0x834e('0x16'),_0x2fd95c,_0x21cc0a['error'][_0x834e('0x1c')]);return _0x58a27e(_0x21cc0a[_0x834e('0x1a')][_0x834e('0x1c')]);}logger[_0x834e('0x1a')](_0x834e('0x16'),_0x2fd95c,_0x21cc0a[_0x834e('0x1a')][_0x834e('0x1c')]);return _0x6cd9b9(_0x21cc0a['error'][_0x834e('0x1c')]);}else{logger[_0x834e('0x1d')](_0x834e('0x16'),_0x2fd95c,_0x834e('0x17'));_0x6cd9b9(_0x21cc0a['result'][_0x834e('0x1c')]);}})[_0x834e('0x1e')](function(_0x5a05c0){logger[_0x834e('0x1a')](_0x834e('0x16'),_0x2fd95c,_0x5a05c0);_0x58a27e(_0x5a05c0);});});}function respondWithResult(_0x8d406e,_0x5c55ca){_0x5c55ca=_0x5c55ca||0xc8;return function(_0x4e3f48){if(_0x4e3f48){return _0x8d406e[_0x834e('0x1f')](_0x5c55ca)[_0x834e('0x20')](_0x4e3f48);}};}function respondWithFilteredResult(_0x589dde,_0x25ee1d){return function(_0x1dc1e0){if(_0x1dc1e0){var _0x58f4fd=typeof _0x25ee1d[_0x834e('0x21')]===_0x834e('0x22')&&typeof _0x25ee1d[_0x834e('0x23')]==='undefined';var _0x24fcf7=_0x1dc1e0[_0x834e('0x24')];var _0x5e1cc5=_0x58f4fd?0x0:_0x25ee1d['offset'];var _0x1e713a=_0x58f4fd?_0x1dc1e0['count']:_0x25ee1d[_0x834e('0x21')]+_0x25ee1d[_0x834e('0x23')];var _0x3db026;if(_0x1e713a>=_0x24fcf7){_0x1e713a=_0x24fcf7;_0x3db026=0xc8;}else{_0x3db026=0xce;}_0x589dde[_0x834e('0x1f')](_0x3db026);return _0x589dde[_0x834e('0x25')](_0x834e('0x26'),_0x5e1cc5+'-'+_0x1e713a+'/'+_0x24fcf7)['json'](_0x1dc1e0);}return null;};}function saveUpdates(_0x510780){return function(_0x4dc64a){if(_0x4dc64a){return _0x4dc64a['update'](_0x510780)[_0x834e('0x15')](function(_0x567cea){return _0x567cea;});}return null;};}function removeEntity(_0x106d6a){return function(_0x5dacc1){if(_0x5dacc1){return _0x5dacc1[_0x834e('0x27')]()[_0x834e('0x15')](function(){_0x106d6a[_0x834e('0x1f')](0xcc)[_0x834e('0x28')]();});}};}function handleEntityNotFound(_0x4551f5){return function(_0x390119){if(!_0x390119){_0x4551f5[_0x834e('0x29')](0x194);}return _0x390119;};}function handleError(_0xfaf716,_0x278db3){_0x278db3=_0x278db3||0x1f4;return function(_0x493289){logger[_0x834e('0x1a')](_0x493289['stack']);if(_0x493289[_0x834e('0x2a')]){delete _0x493289[_0x834e('0x2a')];}_0xfaf716[_0x834e('0x1f')](_0x278db3)[_0x834e('0x2b')](_0x493289);};}exports[_0x834e('0x2c')]=function(_0x4689c2,_0x4696a1){var _0x38cd29={},_0x358c31={},_0x12b2bc={'count':0x0,'rows':[]};var _0x5bd232=_[_0x834e('0x2d')](db[_0x834e('0x2e')][_0x834e('0x2f')],function(_0xaf01f4){return{'name':_0xaf01f4['fieldName'],'type':_0xaf01f4[_0x834e('0x30')][_0x834e('0x31')]};});_0x358c31['model']=_['map'](_0x5bd232,'name');_0x358c31[_0x834e('0x32')]=_[_0x834e('0x33')](_0x4689c2[_0x834e('0x32')]);_0x358c31[_0x834e('0x34')]=_[_0x834e('0x35')](_0x358c31[_0x834e('0x36')],_0x358c31['query']);_0x38cd29[_0x834e('0x37')]=_['intersection'](_0x358c31[_0x834e('0x36')],qs[_0x834e('0x38')](_0x4689c2['query'][_0x834e('0x38')]));_0x38cd29[_0x834e('0x37')]=_0x38cd29['attributes']['length']?_0x38cd29[_0x834e('0x37')]:_0x358c31[_0x834e('0x36')];if(!_0x4689c2[_0x834e('0x32')][_0x834e('0x39')](_0x834e('0x3a'))){_0x38cd29['limit']=qs[_0x834e('0x23')](_0x4689c2['query']['limit']);_0x38cd29[_0x834e('0x21')]=qs['offset'](_0x4689c2[_0x834e('0x32')][_0x834e('0x21')]);}_0x38cd29[_0x834e('0x3b')]=qs[_0x834e('0x3c')](_0x4689c2[_0x834e('0x32')]['sort']);_0x38cd29[_0x834e('0x3d')]=qs[_0x834e('0x34')](_[_0x834e('0x3e')](_0x4689c2['query'],_0x358c31[_0x834e('0x34')]),_0x5bd232);if(_0x4689c2[_0x834e('0x32')]['filter']){_0x38cd29[_0x834e('0x3d')]=_['merge'](_0x38cd29[_0x834e('0x3d')],{'$or':_[_0x834e('0x2d')](_0x5bd232,function(_0x4a18bb){if(_0x4a18bb['type']!==_0x834e('0x3f')){var _0x16969b={};_0x16969b[_0x4a18bb[_0x834e('0x2a')]]={'$like':'%'+_0x4689c2[_0x834e('0x32')][_0x834e('0x40')]+'%'};return _0x16969b;}})});}_0x38cd29=_[_0x834e('0x41')]({},_0x38cd29,_0x4689c2[_0x834e('0x42')]);var _0x4a3381={'where':_0x38cd29[_0x834e('0x3d')]};return db['MailMessage'][_0x834e('0x24')](_0x4a3381)['then'](function(_0x1df5b0){_0x12b2bc['count']=_0x1df5b0;if(_0x4689c2[_0x834e('0x32')][_0x834e('0x43')]){_0x38cd29['include']=[{'all':!![]}];}return db[_0x834e('0x2e')][_0x834e('0x44')](_0x38cd29);})[_0x834e('0x15')](function(_0xd55cc3){_0x12b2bc[_0x834e('0x45')]=_0xd55cc3;return _0x12b2bc;})[_0x834e('0x15')](respondWithFilteredResult(_0x4696a1,_0x38cd29))[_0x834e('0x1e')](handleError(_0x4696a1,null));};exports[_0x834e('0x46')]=function(_0x5dc63b,_0x279ea1){var _0x5f3943={'raw':!![],'where':{'id':_0x5dc63b[_0x834e('0x47')]['id']}},_0x3124be={};_0x3124be['model']=_[_0x834e('0x33')](db[_0x834e('0x2e')][_0x834e('0x2f')]);_0x3124be[_0x834e('0x32')]=_[_0x834e('0x33')](_0x5dc63b[_0x834e('0x32')]);_0x3124be['filters']=_['intersection'](_0x3124be[_0x834e('0x36')],_0x3124be[_0x834e('0x32')]);_0x5f3943[_0x834e('0x37')]=_[_0x834e('0x35')](_0x3124be[_0x834e('0x36')],qs[_0x834e('0x38')](_0x5dc63b[_0x834e('0x32')][_0x834e('0x38')]));_0x5f3943[_0x834e('0x37')]=_0x5f3943[_0x834e('0x37')][_0x834e('0x48')]?_0x5f3943[_0x834e('0x37')]:_0x3124be[_0x834e('0x36')];if(_0x5dc63b[_0x834e('0x32')][_0x834e('0x43')]){_0x5f3943[_0x834e('0x49')]=[{'all':!![]}];}_0x5f3943=_[_0x834e('0x41')]({},_0x5f3943,_0x5dc63b[_0x834e('0x42')]);return db[_0x834e('0x2e')][_0x834e('0x4a')](_0x5f3943)['then'](handleEntityNotFound(_0x279ea1,null))[_0x834e('0x15')](respondWithResult(_0x279ea1,null))[_0x834e('0x1e')](handleError(_0x279ea1,null));};exports['update']=function(_0x3c00a3,_0x3b0988){if(_0x3c00a3['body']['id']){delete _0x3c00a3[_0x834e('0x4b')]['id'];}return db[_0x834e('0x2e')][_0x834e('0x4a')]({'where':{'id':_0x3c00a3[_0x834e('0x47')]['id']}})[_0x834e('0x15')](handleEntityNotFound(_0x3b0988,null))[_0x834e('0x15')](saveUpdates(_0x3c00a3[_0x834e('0x4b')],null))['then'](respondWithResult(_0x3b0988,null))[_0x834e('0x1e')](handleError(_0x3b0988,null));};exports[_0x834e('0x27')]=function(_0x3e0550,_0x363675){return db[_0x834e('0x2e')][_0x834e('0x4a')]({'where':{'id':_0x3e0550[_0x834e('0x47')]['id']}})[_0x834e('0x15')](handleEntityNotFound(_0x363675,null))['then'](removeEntity(_0x363675,null))[_0x834e('0x1e')](handleError(_0x363675,null));};exports['describe']=function(_0x2f4bde,_0x53a9ee){return db[_0x834e('0x2e')]['describe']()['then'](respondWithResult(_0x53a9ee,null))[_0x834e('0x1e')](handleError(_0x53a9ee,null));};exports[_0x834e('0x4c')]=function(_0x5291ae,_0x5be43d){return db[_0x834e('0x2e')][_0x834e('0x4c')](_0x5291ae[_0x834e('0x4b')])[_0x834e('0x15')](function(_0x21c417){if(_0x21c417){if(_0x21c417[_0x834e('0x4d')]===_0x834e('0x4e')&&!_0x21c417[_0x834e('0x4f')]){var _0x528e66,_0x142334,_0x3c70bf;if(_0x5291ae['body']['to']){_0x142334=_0x5291ae[_0x834e('0x4b')]['to']['split'](',')[0x0];}return db[_0x834e('0x50')][_0x834e('0x51')]({'where':{'id':_0x21c417['MailAccountId']},'include':[{'model':db[_0x834e('0x52')],'as':_0x834e('0x53'),'include':[{'model':db[_0x834e('0x54')],'as':_0x834e('0x55'),'where':{'email':_0x142334},'limit':0x1,'order':[['updatedAt',_0x834e('0x56')]]}]},{'model':db[_0x834e('0x57')],'as':_0x834e('0x58'),'raw':!![]}]})['then'](function(_0x246b8e){_0x528e66=_0x246b8e;if(_0x528e66&&_0x528e66[_0x834e('0x58')]){var _0x3a7683={'tls':{'rejectUnauthorized':![]}};if(_[_0x834e('0x59')](_0x528e66[_0x834e('0x58')][_0x834e('0x5a')])){_0x3a7683[_0x834e('0x5b')]=_0x528e66[_0x834e('0x58')][_0x834e('0x5b')];_0x3a7683[_0x834e('0x5c')]=_0x528e66[_0x834e('0x58')][_0x834e('0x5c')];_0x3a7683[_0x834e('0x5d')]=_0x528e66[_0x834e('0x58')][_0x834e('0x5d')];if(_0x528e66[_0x834e('0x58')][_0x834e('0x5e')]){_0x3a7683[_0x834e('0x5f')]={'user':_0x528e66[_0x834e('0x58')][_0x834e('0x60')],'pass':_0x528e66[_0x834e('0x58')][_0x834e('0x61')]};}}else{_0x3a7683['service']=_0x528e66[_0x834e('0x58')][_0x834e('0x5a')];_0x3a7683[_0x834e('0x5f')]={'user':_0x528e66[_0x834e('0x58')]['user'],'pass':_0x528e66[_0x834e('0x58')]['pass']};_0x3a7683['secure']=_0x528e66[_0x834e('0x58')][_0x834e('0x5d')];}if(_0x5291ae[_0x834e('0x4b')][_0x834e('0x62')]&&_0x5291ae[_0x834e('0x4b')][_0x834e('0x62')][_0x834e('0x48')]){for(var _0xe5c8f6=0x0;_0xe5c8f6<_0x5291ae['body'][_0x834e('0x62')]['length'];_0xe5c8f6+=0x1){_0x5291ae[_0x834e('0x4b')][_0x834e('0x62')][_0xe5c8f6]={'filename':_0x5291ae['body']['attachments'][_0xe5c8f6][_0x834e('0x2a')],'path':path[_0x834e('0x63')](config[_0x834e('0x64')],_0x834e('0x65'),_0x5291ae[_0x834e('0x4b')]['attachments'][_0xe5c8f6][_0x834e('0x66')])};}}_0x3c70bf={'account':_0x3a7683,'message':_0x5291ae[_0x834e('0x4b')]};return;}})[_0x834e('0x15')](function(){if(_0x528e66[_0x834e('0x53')]){if(_0x528e66[_0x834e('0x53')][_0x834e('0x55')][_0x834e('0x48')]){return _0x528e66[_0x834e('0x53')][_0x834e('0x55')][0x0];}else{return db[_0x834e('0x54')]['create'](_[_0x834e('0xc')](_0x5291ae[_0x834e('0x4b')],{'firstName':_0x5291ae[_0x834e('0x4b')]['to'],'email':_0x5291ae[_0x834e('0x4b')]['to'],'phone':_0x5291ae['body']['to'],'ListId':_0x528e66[_0x834e('0x67')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x3c70bf){return respondWithRpcPromise('SendMail',_0x834e('0x68'),_0x3c70bf,client9003)[_0x834e('0x15')](function(_0x514aac){return _0x21c417[_0x834e('0x69')]({'read':!![],'messageId':_0x514aac[_0x834e('0x6a')],'sentAt':moment()['format'](_0x834e('0x6b'))});})[_0x834e('0x1e')](function(_0x4b88e7){logger['error']('%s',JSON[_0x834e('0x19')](_0x4b88e7));return _0x21c417;});}return _0x21c417;});}return _0x21c417;}})[_0x834e('0x15')](respondWithResult(_0x5be43d,0xc9))[_0x834e('0x1e')](handleError(_0x5be43d,null));};exports[_0x834e('0x6c')]=function(_0x1d8e7,_0x493239){var _0x264a6f={'agent':{},'channel':'mail'};if(_0x1d8e7[_0x834e('0x4b')]['id']){delete _0x1d8e7[_0x834e('0x4b')]['id'];}_0x1d8e7[_0x834e('0x4b')]['read']=!![];_0x1d8e7[_0x834e('0x4b')][_0x834e('0x6d')]=moment()['format'](_0x834e('0x6b'));_0x1d8e7[_0x834e('0x4b')][_0x834e('0x6e')]=_0x1d8e7['body'][_0x834e('0x6e')]||_0x1d8e7[_0x834e('0x60')]['id'];_0x264a6f[_0x834e('0x6f')]['id']=_0x1d8e7[_0x834e('0x4b')][_0x834e('0x6e')];return db[_0x834e('0x2e')][_0x834e('0x4a')]({'where':{'id':_0x1d8e7[_0x834e('0x47')]['id'],'UserId':null}})[_0x834e('0x15')](handleEntityNotFound(_0x493239,null))[_0x834e('0x15')](saveUpdates(_0x1d8e7['body'],null))['then'](function(_0x4e466e){if(_0x4e466e){_0x264a6f[_0x834e('0x1c')]=_0x4e466e[_0x834e('0x70')]({'plain':!![]});return db[_0x834e('0x71')][_0x834e('0x4a')]({'where':{'id':_0x4e466e[_0x834e('0x72')]}});}return null;})['then'](handleEntityNotFound(_0x493239,null))['then'](function(_0x4520fc){if(_0x4520fc){return _0x4520fc[_0x834e('0x69')]({'UserId':_0x1d8e7[_0x834e('0x4b')][_0x834e('0x6e')],'read1stAt':_[_0x834e('0x59')](_0x4520fc['read1stAt'])?moment()[_0x834e('0x73')](_0x834e('0x6b')):undefined});}return null;})[_0x834e('0x15')](function(_0x4e1735){if(_0x4e1735){_0x264a6f[_0x834e('0x74')]=_0x4e1735[_0x834e('0x70')]({'plain':!![]});interaction_log[_0x834e('0x1d')](_0x834e('0x75'),_0x1d8e7[_0x834e('0x60')]['id'],_0x1d8e7['user']['name'],_0x1d8e7[_0x834e('0x60')][_0x834e('0x76')],_0x264a6f['interaction']['id'],_0x1d8e7[_0x834e('0x4b')]?JSON['stringify'](_0x1d8e7[_0x834e('0x4b')]):_0x834e('0x77'));return respondWithRpcPromise(_0x834e('0x78'),'acceptMessage',_0x264a6f);}return null;})[_0x834e('0x15')](function(_0x49e721){var _0x5b2621='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x49e721[_0x834e('0x1c')][_0x834e('0x79')];return db[_0x834e('0x7a')][_0x834e('0x32')](_0x5b2621,{'type':db[_0x834e('0x7b')][_0x834e('0x7c')][_0x834e('0x7d')],'raw':!![]})[_0x834e('0x15')](function(_0x17e61a){return _0x17e61a;});})['then'](function(_0x2f775a){if(_0x2f775a){_0x264a6f['message'][_0x834e('0x7e')]=_0x2f775a[0x0];if(!_0x1d8e7[_0x834e('0x4b')][_0x834e('0x6e')])return;return db[_0x834e('0x7f')][_0x834e('0x4a')]({'where':{'id':_0x1d8e7[_0x834e('0x4b')]['UserId'],'role':'agent'},'attributes':['id',_0x834e('0x2a'),_0x834e('0x80'),'email',_0x834e('0x81')],'raw':!![]});}return null;})[_0x834e('0x15')](function(_0x1bc5d1){if(!_0x1bc5d1)return null;_0x264a6f[_0x834e('0x1c')][_0x834e('0x6f')]=_0x1bc5d1;return _0x264a6f;})['then'](function(_0x29839d){if(_0x29839d){if(_0x1d8e7[_0x834e('0x4b')]['manual']){_0x264a6f['message']['interface']=util[_0x834e('0x73')](_0x834e('0x82'),_0x1d8e7['user'][_0x834e('0x2a')]);_0x264a6f[_0x834e('0x1c')]['channel']=_0x264a6f[_0x834e('0x83')];_0x264a6f['message']['event']=_0x834e('0x6c');_0x264a6f[_0x834e('0x1c')][_0x834e('0x4b')]=htmlToText[_0x834e('0x84')](_0x264a6f['message'][_0x834e('0x4b')]);return respondWithRpcPromise(_0x834e('0x85'),_0x834e('0x85'),{'event':_0x834e('0x86'),'message':_0x264a6f[_0x834e('0x1c')]},client9002)[_0x834e('0x15')](function(){return _0x264a6f;});}return _0x264a6f;}return null;})[_0x834e('0x15')](respondWithResult(_0x493239,null))[_0x834e('0x1e')](handleError(_0x493239,null));};exports[_0x834e('0x87')]=function(_0x2821fe,_0x2fa64c){var _0x261e3d={'agent':{},'channel':_0x834e('0x88')};if(_0x2821fe[_0x834e('0x4b')]['id']){delete _0x2821fe[_0x834e('0x4b')]['id'];}_0x2821fe[_0x834e('0x4b')][_0x834e('0x6e')]=_0x2821fe[_0x834e('0x4b')][_0x834e('0x6e')]||_0x2821fe[_0x834e('0x60')]['id'];_0x261e3d[_0x834e('0x6f')]['id']=_0x2821fe[_0x834e('0x4b')]['UserId'];return db[_0x834e('0x2e')][_0x834e('0x4a')]({'where':{'id':_0x2821fe[_0x834e('0x47')]['id'],'UserId':null}})[_0x834e('0x15')](handleEntityNotFound(_0x2fa64c,null))[_0x834e('0x15')](function(_0x3bcdcd){if(_0x3bcdcd){_0x261e3d[_0x834e('0x1c')]=_0x3bcdcd[_0x834e('0x70')]({'plain':!![]});return db[_0x834e('0x71')]['find']({'where':{'id':_0x3bcdcd['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2fa64c,null))[_0x834e('0x15')](function(_0x493e1f){if(_0x493e1f){_0x261e3d[_0x834e('0x74')]=_0x493e1f[_0x834e('0x70')]({'plain':!![]});interaction_log[_0x834e('0x1d')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2821fe[_0x834e('0x60')]['id'],_0x2821fe[_0x834e('0x60')][_0x834e('0x2a')],_0x2821fe[_0x834e('0x60')][_0x834e('0x76')],_0x261e3d[_0x834e('0x74')]['id'],_0x2821fe['body']?JSON[_0x834e('0x19')](_0x2821fe[_0x834e('0x4b')]):_0x834e('0x77'));return respondWithRpcPromise(_0x834e('0x89'),_0x834e('0x8a'),_0x261e3d);}return null;})['then'](function(_0x4ebeba){var _0x508b3e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4ebeba[_0x834e('0x1c')][_0x834e('0x79')];return db['sequelize'][_0x834e('0x32')](_0x508b3e,{'type':db[_0x834e('0x7b')]['QueryTypes'][_0x834e('0x7d')],'raw':!![]})[_0x834e('0x15')](function(_0xbf7693){return _0xbf7693;});})[_0x834e('0x15')](function(_0x1d1075){if(_0x1d1075){_0x261e3d[_0x834e('0x1c')]['contact']=_0x1d1075[0x0];if(!_0x2821fe['body'][_0x834e('0x6e')])return;return db[_0x834e('0x7f')][_0x834e('0x4a')]({'where':{'id':_0x2821fe['body'][_0x834e('0x6e')],'role':_0x834e('0x6f')},'attributes':['id','name',_0x834e('0x80'),_0x834e('0x8b'),_0x834e('0x81')],'raw':!![]});}return null;})[_0x834e('0x15')](function(_0x4cb802){if(!_0x4cb802)return null;_0x261e3d[_0x834e('0x1c')]['agent']=_0x4cb802;return _0x261e3d;})['then'](function(_0xc64958){if(_0xc64958){_0xc64958[_0x834e('0x1c')][_0x834e('0x8c')]=util[_0x834e('0x73')](_0x834e('0x82'),_0x2821fe[_0x834e('0x60')]['name']);_0xc64958['message'][_0x834e('0x83')]=_0x261e3d[_0x834e('0x83')];_0xc64958[_0x834e('0x1c')][_0x834e('0x8d')]=_0x834e('0x87');_0xc64958[_0x834e('0x1c')][_0x834e('0x4b')]=htmlToText['fromString'](_0x261e3d[_0x834e('0x1c')][_0x834e('0x4b')]);respondWithRpcPromise('EventManager',_0x834e('0x85'),{'event':_0x834e('0x8e'),'message':_0xc64958[_0x834e('0x1c')]},client9002);return _0x261e3d;}return null;})[_0x834e('0x15')](respondWithResult(_0x2fa64c,null))[_0x834e('0x1e')](handleError(_0x2fa64c,null));};exports[_0x834e('0x8f')]=function(_0x231f0b,_0x3b44f3){var _0x14e794=moment()[_0x834e('0x90')]()[_0x834e('0x91')]();var _0x152372=path[_0x834e('0x63')](config[_0x834e('0x64')],'server',_0x834e('0x92'),_0x834e('0x93'));var _0x522eab=path[_0x834e('0x63')](config['root'],_0x834e('0x94'),'files',_0x834e('0x62'));var _0x560d10=util[_0x834e('0x73')](_0x834e('0x95'),_0x14e794);return db[_0x834e('0x2e')][_0x834e('0x4a')]({'where':{'id':_0x231f0b['params']['id']},'attributes':['id',_0x834e('0x4b'),_0x834e('0x96'),'to','cc',_0x834e('0x97'),_0x834e('0x98'),_0x834e('0x99')],'include':_0x231f0b[_0x834e('0x32')][_0x834e('0x62')]?[{'model':db[_0x834e('0x9a')],'as':_0x834e('0x9b')}]:undefined})[_0x834e('0x15')](handleEntityNotFound(_0x3b44f3,null))[_0x834e('0x15')](function(_0x1cb4d0){if(_0x1cb4d0){var _0x3a6546=_0x1cb4d0;var _0x246f01={'from':_0x3a6546[_0x834e('0x96')],'to':_0x3a6546['to'],'subject':_0x3a6546[_0x834e('0x98')],'html':_0x3a6546[_0x834e('0x4b')],'headers':{'Date':moment(_0x3a6546['createdAt'])['format'](_0x834e('0x9c'))},'attachments':[]};if(_0x1cb4d0['cc']){_0x246f01[_0x834e('0x9d')]['Cc']=_0x1cb4d0['cc'];}if(_0x1cb4d0[_0x834e('0x97')]){_0x246f01[_0x834e('0x9d')][_0x834e('0x9e')]=_0x1cb4d0[_0x834e('0x97')];}return new BPromise(function(_0x22f90d,_0x40fd40){if(_0x1cb4d0[_0x834e('0x9b')]){for(var _0x58cd3b=0x0;_0x58cd3b<_0x1cb4d0[_0x834e('0x9b')][_0x834e('0x48')];_0x58cd3b++){var _0x513d9e=_0x1cb4d0[_0x834e('0x9b')][_0x58cd3b];var _0x54c129=path[_0x834e('0x63')](_0x522eab,_0x513d9e[_0x834e('0x66')]);if(fs[_0x834e('0x9f')](_0x54c129)){_0x246f01['attachments'][_0x834e('0xa0')]({'name':_0x513d9e[_0x834e('0x2a')],'contentType':_0x513d9e['type'],'data':fs['readFileSync'](_0x54c129)});}}}emlformat[_0x834e('0xa1')](_0x246f01,function(_0x3b7b1a,_0x4e0f4d){if(_0x3b7b1a)return _0x40fd40(_0x3b7b1a);fs[_0x834e('0xa2')](path[_0x834e('0x63')](_0x152372,_0x560d10),_0x4e0f4d);return _0x22f90d(_0x4e0f4d);});});}})[_0x834e('0x15')](function(_0x135219){if(_0x135219){return _0x3b44f3[_0x834e('0x8f')](path['join'](_0x152372,_0x560d10),_0x560d10,function(_0x4e7545){if(!_0x4e7545)fs[_0x834e('0xa3')](path['join'](_0x152372,_0x560d10));});}})['catch'](handleError(_0x3b44f3,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index d99f7fb..eb34f1e 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 _0x2c62=['exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x2c62,0x123));var _0x22c6=function(_0x9c2c53,_0x4861d5){_0x9c2c53=_0x9c2c53-0x0;var _0xe09a34=_0x2c62[_0x9c2c53];return _0xe09a34;};'use strict';var EventEmitter=require(_0x22c6('0x0'));var MailMessage=require(_0x22c6('0x1'))['db'][_0x22c6('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x22c6('0x3')](0x0);var events={'afterCreate':_0x22c6('0x4'),'afterUpdate':_0x22c6('0x5'),'afterDestroy':_0x22c6('0x6')};function emitEvent(_0x3ce15d){return function(_0x3087e8,_0x2ac4fb,_0x5023d7){MailMessageEvents[_0x22c6('0x7')](_0x3ce15d+':'+_0x3087e8['id'],_0x3087e8);MailMessageEvents[_0x22c6('0x7')](_0x3ce15d,_0x3087e8);_0x5023d7(null);};}for(var e in events){if(events[_0x22c6('0x8')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x22c6('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x07e9=['emit','exports','events','../../mysqldb','MailMessage','setMaxListeners','update','remove'];(function(_0x51e8b0,_0xb85bea){var _0x3c2c67=function(_0x2cb86e){while(--_0x2cb86e){_0x51e8b0['push'](_0x51e8b0['shift']());}};_0x3c2c67(++_0xb85bea);}(_0x07e9,0x152));var _0x907e=function(_0x196cc0,_0x33fa5f){_0x196cc0=_0x196cc0-0x0;var _0x2299f5=_0x07e9[_0x196cc0];return _0x2299f5;};'use strict';var EventEmitter=require(_0x907e('0x0'));var MailMessage=require(_0x907e('0x1'))['db'][_0x907e('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x907e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x907e('0x4'),'afterDestroy':_0x907e('0x5')};function emitEvent(_0x588174){return function(_0x4878c9,_0x44a40b,_0xef12cd){MailMessageEvents[_0x907e('0x6')](_0x588174+':'+_0x4878c9['id'],_0x4878c9);MailMessageEvents[_0x907e('0x6')](_0x588174,_0x4878c9);_0xef12cd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x907e('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 474a6e8..6aa8781 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 _0xb839=['../../config/logger','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','messageId','fti_mail_messages','plainBody','subject','body','get','direction','toLowerCase','out','secret','MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x5f806d,_0x20a414){var _0x2dfba9=function(_0x4ba943){while(--_0x4ba943){_0x5f806d['push'](_0x5f806d['shift']());}};_0x2dfba9(++_0x20a414);}(_0xb839,0x166));var _0x9b83=function(_0xeee2c1,_0x10154c){_0xeee2c1=_0xeee2c1-0x0;var _0x4db1db=_0xb839[_0xeee2c1];return _0x4db1db;};'use strict';var _=require(_0x9b83('0x0'));var util=require(_0x9b83('0x1'));var logger=require(_0x9b83('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9b83('0x3'));var rp=require('request-promise');var htmlToText=require(_0x9b83('0x4'));var fs=require('fs');var path=require(_0x9b83('0x5'));var rimraf=require(_0x9b83('0x6'));var config=require(_0x9b83('0x7'));var attributes=require(_0x9b83('0x8'));module[_0x9b83('0x9')]=function(_0x2fd020,_0x51894c){return _0x2fd020['define'](_0x9b83('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x9b83('0xb')]},{'name':_0x9b83('0xc'),'fields':[_0x9b83('0xd'),_0x9b83('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x56611b,_0x4439b3,_0xa4ccf7){if(_0x56611b[_0x9b83('0xf')]){_0x56611b[_0x9b83('0xd')]=htmlToText['fromString'](_0x56611b[_0x9b83('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xa4ccf7(null,_0x4439b3);},'afterCreate':function(_0x7203bd,_0x55ddb7,_0xbc187){var _0x3be53b=_0x2fd020['models'];var _0x1b1dfb=_0x7203bd[_0x9b83('0x10')]({'plain':!![]});if(_0x1b1dfb[_0x9b83('0x11')][_0x9b83('0x12')]()==='in'||_0x1b1dfb[_0x9b83('0x11')][_0x9b83('0x12')]()===_0x9b83('0x13')&&!_0x1b1dfb[_0x9b83('0x14')]&&!_['isNil'](_0x1b1dfb['UserId'])){_0x3be53b[_0x9b83('0x15')][_0x9b83('0x16')]({'where':{'id':_0x1b1dfb['MailInteractionId']}})[_0x9b83('0x17')](function(_0x5ea16e){if(_0x5ea16e){_0x5ea16e[_0x9b83('0x18')]({'lastMsgAt':_0x1b1dfb[_0x9b83('0x19')],'lastMsgDirection':_0x1b1dfb[_0x9b83('0x11')][_0x9b83('0x12')]()});}})[_0x9b83('0x1a')](function(_0x141f3b){console[_0x9b83('0x1b')](_0x141f3b);});}_0xbc187();}},'charset':_0x9b83('0x1c'),'collate':_0x9b83('0x1d')});}; \ No newline at end of file +var _0x4486=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','MailInteraction','MailInteractionId','then','update','createdAt','catch','error','utf8mb4'];(function(_0x181a70,_0x2d2ed5){var _0x164d72=function(_0x30e467){while(--_0x30e467){_0x181a70['push'](_0x181a70['shift']());}};_0x164d72(++_0x2d2ed5);}(_0x4486,0xf6));var _0x6448=function(_0x292423,_0x1759b7){_0x292423=_0x292423-0x0;var _0x2801cb=_0x4486[_0x292423];return _0x2801cb;};'use strict';var _=require('lodash');var util=require(_0x6448('0x0'));var logger=require(_0x6448('0x1'))(_0x6448('0x2'));var moment=require(_0x6448('0x3'));var BPromise=require(_0x6448('0x4'));var rp=require('request-promise');var htmlToText=require(_0x6448('0x5'));var fs=require('fs');var path=require(_0x6448('0x6'));var rimraf=require(_0x6448('0x7'));var config=require(_0x6448('0x8'));var attributes=require(_0x6448('0x9'));module['exports']=function(_0x28e24b,_0x4c4144){return _0x28e24b[_0x6448('0xa')](_0x6448('0xb'),attributes,{'tableName':_0x6448('0xc'),'paranoid':![],'indexes':[{'name':_0x6448('0xd'),'fields':[_0x6448('0xd')]},{'name':'fti_mail_messages','fields':[_0x6448('0xe'),_0x6448('0xf')],'type':_0x6448('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x10e438,_0x3e1aa6,_0x1771b1){if(_0x10e438[_0x6448('0x11')]){_0x10e438[_0x6448('0xe')]=htmlToText[_0x6448('0x12')](_0x10e438[_0x6448('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1771b1(null,_0x3e1aa6);},'afterCreate':function(_0x270188,_0x432821,_0x35c55e){var _0x140a50=_0x28e24b[_0x6448('0x13')];var _0x394640=_0x270188[_0x6448('0x14')]({'plain':!![]});if(_0x394640[_0x6448('0x15')][_0x6448('0x16')]()==='in'||_0x394640[_0x6448('0x15')]['toLowerCase']()===_0x6448('0x17')&&!_0x394640[_0x6448('0x18')]&&!_[_0x6448('0x19')](_0x394640['UserId'])){_0x140a50[_0x6448('0x1a')]['findOne']({'where':{'id':_0x394640[_0x6448('0x1b')]}})[_0x6448('0x1c')](function(_0x82a72){if(_0x82a72){_0x82a72[_0x6448('0x1d')]({'lastMsgAt':_0x394640[_0x6448('0x1e')],'lastMsgDirection':_0x394640['direction'][_0x6448('0x16')]()});}})[_0x6448('0x1f')](function(_0x9712e){console[_0x6448('0x20')](_0x9712e);});}_0x35c55e();}},'charset':_0x6448('0x21'),'collate':_0x6448('0x22')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 9d4877e..51cdbcb 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 _0xe2cf=['MailMessage,\x20%s,\x20%s','request\x20sent','error','message','result','CreateMailMessage','MailMessage','create','options','debug','stringify','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./mailMessage.socket','request','then','info'];(function(_0x5cd11b,_0x27eba6){var _0x20e74a=function(_0x596c43){while(--_0x596c43){_0x5cd11b['push'](_0x5cd11b['shift']());}};_0x20e74a(++_0x27eba6);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0xe2cf[_0x12bcf7];return _0x2825a;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var moment=require('moment');var BPromise=require(_0xfe2c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe2c('0x2'));var db=require(_0xfe2c('0x3'))['db'];var utils=require(_0xfe2c('0x4'));var logger=require(_0xfe2c('0x5'))('rpc');var config=require(_0xfe2c('0x6'));var jayson=require(_0xfe2c('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xfe2c('0x8')]=_[_0xfe2c('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfe2c('0xa'))(new Redis(config[_0xfe2c('0x8')]));require(_0xfe2c('0xb'))['register'](socket);function respondWithRpcPromise(_0x5b616c,_0x396912,_0x15421e){return new BPromise(function(_0x495513,_0x22278c){return client[_0xfe2c('0xc')](_0x5b616c,_0x15421e)[_0xfe2c('0xd')](function(_0xa176e9){logger[_0xfe2c('0xe')](_0xfe2c('0xf'),_0x396912,_0xfe2c('0x10'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x396912,'request\x20sent',JSON['stringify'](_0xa176e9));if(_0xa176e9[_0xfe2c('0x11')]){if(_0xa176e9['error']['code']===0x1f4){logger[_0xfe2c('0x11')](_0xfe2c('0xf'),_0x396912,_0xa176e9[_0xfe2c('0x11')][_0xfe2c('0x12')]);return _0x22278c(_0xa176e9['error']['message']);}logger[_0xfe2c('0x11')](_0xfe2c('0xf'),_0x396912,_0xa176e9[_0xfe2c('0x11')][_0xfe2c('0x12')]);return _0x495513(_0xa176e9['error'][_0xfe2c('0x12')]);}else{logger[_0xfe2c('0xe')](_0xfe2c('0xf'),_0x396912,_0xfe2c('0x10'));_0x495513(_0xa176e9[_0xfe2c('0x13')][_0xfe2c('0x12')]);}})['catch'](function(_0x22481a){logger[_0xfe2c('0x11')](_0xfe2c('0xf'),_0x396912,_0x22481a);_0x22278c(_0x22481a);});});}exports[_0xfe2c('0x14')]=function(_0x55f751){var _0x1139fe=this;return new Promise(function(_0x59bdeb,_0x4e9137){return db[_0xfe2c('0x15')][_0xfe2c('0x16')](_0x55f751['body'],{'raw':_0x55f751[_0xfe2c('0x17')]?_0x55f751[_0xfe2c('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xfe2c('0xd')](function(_0x5dd54b){logger[_0xfe2c('0xe')](_0xfe2c('0x14'),_0x55f751);logger[_0xfe2c('0x18')](_0xfe2c('0x14'),_0x55f751,JSON[_0xfe2c('0x19')](_0x5dd54b));_0x59bdeb(_0x5dd54b);})[_0xfe2c('0x1a')](function(_0x57cd6d){logger[_0xfe2c('0x11')](_0xfe2c('0x14'),_0x57cd6d[_0xfe2c('0x12')],_0x55f751);_0x4e9137(_0x1139fe[_0xfe2c('0x11')](0x1f4,_0x57cd6d[_0xfe2c('0x12')]));});});}; \ No newline at end of file +var _0x0120=['then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','body','options','raw','CreateMailMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x0120,0x6f));var _0x0012=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x0120[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var BPromise=require(_0x0012('0x3'));var rs=require(_0x0012('0x4'));var fs=require('fs');var Redis=require(_0x0012('0x5'));var db=require(_0x0012('0x6'))['db'];var utils=require(_0x0012('0x7'));var logger=require(_0x0012('0x8'))(_0x0012('0x9'));var config=require(_0x0012('0xa'));var jayson=require(_0x0012('0xb'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x0012('0xc')](config[_0x0012('0xd')],{'host':_0x0012('0xe'),'port':0x18eb});var socket=require(_0x0012('0xf'))(new Redis(config[_0x0012('0xd')]));require('./mailMessage.socket')[_0x0012('0x10')](socket);function respondWithRpcPromise(_0x2d484c,_0x1dc1b2,_0x323282){return new BPromise(function(_0x520171,_0x2d4674){return client['request'](_0x2d484c,_0x323282)[_0x0012('0x11')](function(_0x1d1c02){logger[_0x0012('0x12')](_0x0012('0x13'),_0x1dc1b2,_0x0012('0x14'));logger['debug'](_0x0012('0x15'),_0x1dc1b2,'request\x20sent',JSON['stringify'](_0x1d1c02));if(_0x1d1c02['error']){if(_0x1d1c02['error'][_0x0012('0x16')]===0x1f4){logger['error'](_0x0012('0x13'),_0x1dc1b2,_0x1d1c02[_0x0012('0x17')]['message']);return _0x2d4674(_0x1d1c02[_0x0012('0x17')][_0x0012('0x18')]);}logger[_0x0012('0x17')](_0x0012('0x13'),_0x1dc1b2,_0x1d1c02['error']['message']);return _0x520171(_0x1d1c02[_0x0012('0x17')][_0x0012('0x18')]);}else{logger[_0x0012('0x12')](_0x0012('0x13'),_0x1dc1b2,_0x0012('0x14'));_0x520171(_0x1d1c02[_0x0012('0x19')][_0x0012('0x18')]);}})[_0x0012('0x1a')](function(_0x5b236f){logger[_0x0012('0x17')](_0x0012('0x13'),_0x1dc1b2,_0x5b236f);_0x2d4674(_0x5b236f);});});}exports['CreateMailMessage']=function(_0x45d00b){var _0x1f54fc=this;return new Promise(function(_0xa2e623,_0x2c837e){return db['MailMessage']['create'](_0x45d00b[_0x0012('0x1b')],{'raw':_0x45d00b[_0x0012('0x1c')]?_0x45d00b[_0x0012('0x1c')][_0x0012('0x1d')]===undefined?!![]:![]:!![]})[_0x0012('0x11')](function(_0x2e6a2c){logger[_0x0012('0x12')](_0x0012('0x1e'),_0x45d00b);logger['debug'](_0x0012('0x1e'),_0x45d00b,JSON[_0x0012('0x1f')](_0x2e6a2c));_0xa2e623(_0x2e6a2c);})['catch'](function(_0x36cf42){logger[_0x0012('0x17')](_0x0012('0x1e'),_0x36cf42[_0x0012('0x18')],_0x45d00b);_0x2c837e(_0x1f54fc[_0x0012('0x17')](0x1f4,_0x36cf42['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index c1ab3b0..c42494e 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 _0x6668=['./mailMessage.events','save','update','emit','removeListener','register','length','mailMessage:'];(function(_0x213729,_0x49b994){var _0x5d88c1=function(_0x5f78c6){while(--_0x5f78c6){_0x213729['push'](_0x213729['shift']());}};_0x5d88c1(++_0x49b994);}(_0x6668,0xf0));var _0x8666=function(_0x92e6a,_0x4c3e17){_0x92e6a=_0x92e6a-0x0;var _0x687db8=_0x6668[_0x92e6a];return _0x687db8;};'use strict';var MailMessageEvents=require(_0x8666('0x0'));var events=[_0x8666('0x1'),'remove',_0x8666('0x2')];function createListener(_0x9a477f,_0x2c389f){return function(_0x58d59b){_0x2c389f[_0x8666('0x3')](_0x9a477f,_0x58d59b);};}function removeListener(_0x56f5fb,_0x2862ae){return function(){MailMessageEvents[_0x8666('0x4')](_0x56f5fb,_0x2862ae);};}exports[_0x8666('0x5')]=function(_0x30e986){for(var _0x499d18=0x0,_0x49c942=events[_0x8666('0x6')];_0x499d18<_0x49c942;_0x499d18++){var _0x40ecba=events[_0x499d18];var _0x4e3de2=createListener(_0x8666('0x7')+_0x40ecba,_0x30e986);MailMessageEvents['on'](_0x40ecba,_0x4e3de2);}}; \ No newline at end of file +var _0x8c2c=['remove','update','emit','register','length','mailMessage:','save'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x8c2c,0x92));var _0xc8c2=function(_0x5ecbbc,_0x2541f5){_0x5ecbbc=_0x5ecbbc-0x0;var _0x219a19=_0x8c2c[_0x5ecbbc];return _0x219a19;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xc8c2('0x0'),_0xc8c2('0x1'),_0xc8c2('0x2')];function createListener(_0x409381,_0x149d48){return function(_0x315813){_0x149d48[_0xc8c2('0x3')](_0x409381,_0x315813);};}function removeListener(_0x170876,_0x5e8d3a){return function(){MailMessageEvents['removeListener'](_0x170876,_0x5e8d3a);};}exports[_0xc8c2('0x4')]=function(_0x460317){for(var _0x22177d=0x0,_0x2579ad=events[_0xc8c2('0x5')];_0x22177d<_0x2579ad;_0x22177d++){var _0x5acf62=events[_0x22177d];var _0x54b165=createListener(_0xc8c2('0x6')+_0x5acf62,_0x460317);MailMessageEvents['on'](_0x5acf62,_0x54b165);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index f62fe04..ede5892 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 _0x147d=['delete','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','update','destroy'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x147d,0x1c4));var _0xd147=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x147d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd147('0x0'));var util=require(_0xd147('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd147('0x2')]();var fs_extra=require(_0xd147('0x3'));var auth=require(_0xd147('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd147('0x5'));var controller=require(_0xd147('0x6'));router[_0xd147('0x7')]('/',auth[_0xd147('0x8')](),controller[_0xd147('0x9')]);router['get']('/describe',auth[_0xd147('0x8')](),controller[_0xd147('0xa')]);router['get'](_0xd147('0xb'),auth['isAuthenticated'](),controller[_0xd147('0xc')]);router[_0xd147('0x7')](_0xd147('0xd'),auth[_0xd147('0x8')](),controller[_0xd147('0xe')]);router[_0xd147('0x7')](_0xd147('0xf'),auth[_0xd147('0x8')](),controller[_0xd147('0x10')]);router[_0xd147('0x7')](_0xd147('0x11'),auth[_0xd147('0x8')](),controller['getAgents']);router[_0xd147('0x12')]('/',auth['isAuthenticated'](),controller[_0xd147('0x13')]);router['post'](_0xd147('0xf'),auth[_0xd147('0x8')](),controller['addTeams']);router[_0xd147('0x12')]('/:id/users',auth[_0xd147('0x8')](),controller[_0xd147('0x14')]);router[_0xd147('0x15')](_0xd147('0xb'),auth['isAuthenticated'](),controller[_0xd147('0x16')]);router['delete'](_0xd147('0xb'),auth[_0xd147('0x8')](),controller[_0xd147('0x17')]);router[_0xd147('0x18')](_0xd147('0xf'),auth[_0xd147('0x8')](),controller[_0xd147('0x19')]);router['delete'](_0xd147('0x11'),auth[_0xd147('0x8')](),controller[_0xd147('0x1a')]);module[_0xd147('0x1b')]=router; \ No newline at end of file +var _0x619a=['exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','addAgents','update','delete','destroy','removeTeams'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x619a,0x199));var _0xa619=function(_0x3b587a,_0x5cd349){_0x3b587a=_0x3b587a-0x0;var _0x424fcc=_0x619a[_0x3b587a];return _0x424fcc;};'use strict';var multer=require(_0xa619('0x0'));var util=require('util');var path=require(_0xa619('0x1'));var timeout=require(_0xa619('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa619('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa619('0x4'));var config=require(_0xa619('0x5'));var controller=require('./mailQueue.controller');router[_0xa619('0x6')]('/',auth[_0xa619('0x7')](),controller[_0xa619('0x8')]);router[_0xa619('0x6')](_0xa619('0x9'),auth[_0xa619('0x7')](),controller['describe']);router[_0xa619('0x6')](_0xa619('0xa'),auth[_0xa619('0x7')](),controller['show']);router[_0xa619('0x6')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xa619('0x6')](_0xa619('0xb'),auth[_0xa619('0x7')](),controller[_0xa619('0xc')]);router[_0xa619('0x6')](_0xa619('0xd'),auth[_0xa619('0x7')](),controller[_0xa619('0xe')]);router['post']('/',auth[_0xa619('0x7')](),controller[_0xa619('0xf')]);router['post'](_0xa619('0xb'),auth[_0xa619('0x7')](),controller[_0xa619('0x10')]);router[_0xa619('0x11')]('/:id/users',auth[_0xa619('0x7')](),controller[_0xa619('0x12')]);router['put'](_0xa619('0xa'),auth[_0xa619('0x7')](),controller[_0xa619('0x13')]);router[_0xa619('0x14')]('/:id',auth[_0xa619('0x7')](),controller[_0xa619('0x15')]);router[_0xa619('0x14')](_0xa619('0xb'),auth[_0xa619('0x7')](),controller[_0xa619('0x16')]);router[_0xa619('0x14')](_0xa619('0xd'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xa619('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index b074a7a..e96d01f 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 _0xa742=['rrmemory','roundrobin','sequelize','STRING','INTEGER','ENUM'];(function(_0x2a1e70,_0xfe2064){var _0x4f7cad=function(_0x131078){while(--_0x131078){_0x2a1e70['push'](_0x2a1e70['shift']());}};_0x4f7cad(++_0xfe2064);}(_0xa742,0x13a));var _0x2a74=function(_0x2519ed,_0x1838b3){_0x2519ed=_0x2519ed-0x0;var _0x2893bc=_0xa742[_0x2519ed];return _0x2893bc;};'use strict';var Sequelize=require(_0x2a74('0x0'));module['exports']={'name':{'type':Sequelize[_0x2a74('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2a74('0x1')]},'timeout':{'type':Sequelize[_0x2a74('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2a74('0x3')](_0x2a74('0x4'),'beepall',_0x2a74('0x5'))}}; \ No newline at end of file +var _0xdeaf=['INTEGER','ENUM','rrmemory','exports','STRING','name'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xdeaf,0x165));var _0xfdea=function(_0x56189a,_0x388273){_0x56189a=_0x56189a-0x0;var _0x121f62=_0xdeaf[_0x56189a];return _0x121f62;};'use strict';var Sequelize=require('sequelize');module[_0xfdea('0x0')]={'name':{'type':Sequelize[_0xfdea('0x1')],'unique':_0xfdea('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfdea('0x1')]},'timeout':{'type':Sequelize[_0xfdea('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfdea('0x4')](_0xfdea('0x5'),'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 b25123f..e8d87ed 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 _0xbb50=['value','removeTeams','isEmpty','removeAgents','forEach','emit','userMailQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','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/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','limit','undefined','count','set','Content-Range','then','get','MailQueues','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','MailQueue','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','params','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','findOne','MailQueueId','UserMailQueue','updatedAt','format','%s/%s','mailPause','createdAt','getTeams','Team','order','nolimit','addTeams','ids','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','userMailQueue:save','User','field','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','union'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0xbb50,0x11b));var _0x0bb5=function(_0x34c019,_0x2e7ab5){_0x34c019=_0x34c019-0x0;var _0x54eab2=_0xbb50[_0x34c019];return _0x54eab2;};'use strict';var emlformat=require(_0x0bb5('0x0'));var rimraf=require(_0x0bb5('0x1'));var zipdir=require(_0x0bb5('0x2'));var jsonpatch=require(_0x0bb5('0x3'));var rp=require(_0x0bb5('0x4'));var moment=require('moment');var BPromise=require(_0x0bb5('0x5'));var Mustache=require('mustache');var util=require(_0x0bb5('0x6'));var path=require('path');var sox=require(_0x0bb5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0bb5('0x8'));var squel=require('squel');var crypto=require(_0x0bb5('0x9'));var jsforce=require(_0x0bb5('0xa'));var deskjs=require(_0x0bb5('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0bb5('0xc'));var Papa=require(_0x0bb5('0xd'));var Redis=require(_0x0bb5('0xe'));var authService=require(_0x0bb5('0xf'));var qs=require(_0x0bb5('0x10'));var as=require(_0x0bb5('0x11'));var hardwareService=require(_0x0bb5('0x12'));var logger=require(_0x0bb5('0x13'))(_0x0bb5('0x14'));var utils=require(_0x0bb5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0bb5('0x16'));var db=require(_0x0bb5('0x17'))['db'];config[_0x0bb5('0x18')]=_[_0x0bb5('0x19')](config[_0x0bb5('0x18')],{'host':_0x0bb5('0x1a'),'port':0x18eb});var socket=require(_0x0bb5('0x1b'))(new Redis(config[_0x0bb5('0x18')]));require('./mailQueue.socket')[_0x0bb5('0x1c')](socket);function respondWithStatusCode(_0x31323e,_0x437624){_0x437624=_0x437624||0xcc;return function(_0x327916){if(_0x327916){return _0x31323e['sendStatus'](_0x437624);}return _0x31323e[_0x0bb5('0x1d')](_0x437624)[_0x0bb5('0x1e')]();};}function respondWithResult(_0x362ed0,_0x5e0070){_0x5e0070=_0x5e0070||0xc8;return function(_0x1a6c8e){if(_0x1a6c8e){return _0x362ed0['status'](_0x5e0070)[_0x0bb5('0x1f')](_0x1a6c8e);}};}function respondWithFilteredResult(_0x42cd3b,_0x28a272){return function(_0x22a03b){if(_0x22a03b){var _0x559474=typeof _0x28a272[_0x0bb5('0x20')]==='undefined'&&typeof _0x28a272[_0x0bb5('0x21')]===_0x0bb5('0x22');var _0x447975=_0x22a03b[_0x0bb5('0x23')];var _0x2044eb=_0x559474?0x0:_0x28a272[_0x0bb5('0x20')];var _0x56a675=_0x559474?_0x22a03b['count']:_0x28a272[_0x0bb5('0x20')]+_0x28a272['limit'];var _0x21f97c;if(_0x56a675>=_0x447975){_0x56a675=_0x447975;_0x21f97c=0xc8;}else{_0x21f97c=0xce;}_0x42cd3b[_0x0bb5('0x1d')](_0x21f97c);return _0x42cd3b[_0x0bb5('0x24')](_0x0bb5('0x25'),_0x2044eb+'-'+_0x56a675+'/'+_0x447975)[_0x0bb5('0x1f')](_0x22a03b);}return null;};}function patchUpdates(_0x54b373){return function(_0x168aa4){try{jsonpatch['apply'](_0x168aa4,_0x54b373,!![]);}catch(_0x4afb1d){return BPromise['reject'](_0x4afb1d);}return _0x168aa4['save']();};}function saveUpdates(_0x46af33,_0x46f7ce){return function(_0x44e902){if(_0x44e902){return _0x44e902['update'](_0x46af33)[_0x0bb5('0x26')](function(_0x54b677){return _0x54b677;});}return null;};}function removeEntity(_0x11af62,_0xb443f0){return function(_0x9818c7){if(_0x9818c7){return _0x9818c7['destroy']()[_0x0bb5('0x26')](function(){var _0x4299d8=_0x9818c7[_0x0bb5('0x27')]({'plain':!![]});var _0x1f3dad=_0x0bb5('0x28');return db[_0x0bb5('0x29')][_0x0bb5('0x2a')]({'where':{'type':_0x1f3dad,'resourceId':_0x4299d8['id']}})['then'](function(){return _0x9818c7;});})[_0x0bb5('0x26')](function(){_0x11af62[_0x0bb5('0x1d')](0xcc)[_0x0bb5('0x1e')]();});}};}function handleEntityNotFound(_0x50d5bc,_0x409cee){return function(_0x2450bf){if(!_0x2450bf){_0x50d5bc[_0x0bb5('0x2b')](0x194);}return _0x2450bf;};}function handleError(_0x466258,_0xff44){_0xff44=_0xff44||0x1f4;return function(_0x580bc1){logger[_0x0bb5('0x2c')](_0x580bc1[_0x0bb5('0x2d')]);if(_0x580bc1[_0x0bb5('0x2e')]){delete _0x580bc1['name'];}_0x466258[_0x0bb5('0x1d')](_0xff44)[_0x0bb5('0x2f')](_0x580bc1);};}exports[_0x0bb5('0x30')]=function(_0x4ccfea,_0x32b092){var _0x379780={},_0x5f023d={},_0x2efb3e={'count':0x0,'rows':[]};var _0x53f67c=_[_0x0bb5('0x31')](db[_0x0bb5('0x32')][_0x0bb5('0x33')],function(_0x4abfac){return{'name':_0x4abfac['fieldName'],'type':_0x4abfac['type']['key']};});_0x5f023d[_0x0bb5('0x34')]=_[_0x0bb5('0x31')](_0x53f67c,_0x0bb5('0x2e'));_0x5f023d[_0x0bb5('0x35')]=_[_0x0bb5('0x36')](_0x4ccfea[_0x0bb5('0x35')]);_0x5f023d[_0x0bb5('0x37')]=_[_0x0bb5('0x38')](_0x5f023d[_0x0bb5('0x34')],_0x5f023d['query']);_0x379780['attributes']=_[_0x0bb5('0x38')](_0x5f023d[_0x0bb5('0x34')],qs[_0x0bb5('0x39')](_0x4ccfea[_0x0bb5('0x35')][_0x0bb5('0x39')]));_0x379780['attributes']=_0x379780[_0x0bb5('0x3a')][_0x0bb5('0x3b')]?_0x379780[_0x0bb5('0x3a')]:_0x5f023d[_0x0bb5('0x34')];if(!_0x4ccfea['query'][_0x0bb5('0x3c')]('nolimit')){_0x379780['limit']=qs[_0x0bb5('0x21')](_0x4ccfea[_0x0bb5('0x35')][_0x0bb5('0x21')]);_0x379780['offset']=qs['offset'](_0x4ccfea[_0x0bb5('0x35')][_0x0bb5('0x20')]);}_0x379780['order']=qs['sort'](_0x4ccfea['query'][_0x0bb5('0x3d')]);_0x379780[_0x0bb5('0x3e')]=qs[_0x0bb5('0x37')](_[_0x0bb5('0x3f')](_0x4ccfea['query'],_0x5f023d[_0x0bb5('0x37')]),_0x53f67c);if(_0x4ccfea[_0x0bb5('0x35')][_0x0bb5('0x40')]){_0x379780[_0x0bb5('0x3e')]=_[_0x0bb5('0x41')](_0x379780['where'],{'$or':_[_0x0bb5('0x31')](_0x53f67c,function(_0x178022){if(_0x178022[_0x0bb5('0x42')]!==_0x0bb5('0x43')){var _0xb035a3={};_0xb035a3[_0x178022[_0x0bb5('0x2e')]]={'$like':'%'+_0x4ccfea['query'][_0x0bb5('0x40')]+'%'};return _0xb035a3;}})});}_0x379780=_[_0x0bb5('0x41')]({},_0x379780,_0x4ccfea['options']);var _0x742eeb={'where':_0x379780[_0x0bb5('0x3e')]};return db[_0x0bb5('0x32')]['count'](_0x742eeb)[_0x0bb5('0x26')](function(_0x3a7b98){_0x2efb3e[_0x0bb5('0x23')]=_0x3a7b98;if(_0x4ccfea[_0x0bb5('0x35')]['includeAll']){_0x379780[_0x0bb5('0x44')]=[{'all':!![]}];}return db['MailQueue'][_0x0bb5('0x45')](_0x379780);})[_0x0bb5('0x26')](function(_0x51d268){_0x2efb3e[_0x0bb5('0x46')]=_0x51d268;return _0x2efb3e;})[_0x0bb5('0x26')](respondWithFilteredResult(_0x32b092,_0x379780))[_0x0bb5('0x47')](handleError(_0x32b092,null));};exports['show']=function(_0x3c1c9b,_0x504964){var _0x128cce={'raw':!![],'where':{'id':_0x3c1c9b[_0x0bb5('0x48')]['id']}},_0x2cc9f3={};_0x2cc9f3[_0x0bb5('0x34')]=_[_0x0bb5('0x36')](db[_0x0bb5('0x32')]['rawAttributes']);_0x2cc9f3[_0x0bb5('0x35')]=_[_0x0bb5('0x36')](_0x3c1c9b[_0x0bb5('0x35')]);_0x2cc9f3[_0x0bb5('0x37')]=_['intersection'](_0x2cc9f3[_0x0bb5('0x34')],_0x2cc9f3[_0x0bb5('0x35')]);_0x128cce['attributes']=_[_0x0bb5('0x38')](_0x2cc9f3['model'],qs['fields'](_0x3c1c9b[_0x0bb5('0x35')][_0x0bb5('0x39')]));_0x128cce['attributes']=_0x128cce[_0x0bb5('0x3a')][_0x0bb5('0x3b')]?_0x128cce[_0x0bb5('0x3a')]:_0x2cc9f3[_0x0bb5('0x34')];if(_0x3c1c9b[_0x0bb5('0x35')][_0x0bb5('0x49')]){_0x128cce[_0x0bb5('0x44')]=[{'all':!![]}];}_0x128cce=_[_0x0bb5('0x41')]({},_0x128cce,_0x3c1c9b[_0x0bb5('0x4a')]);return db[_0x0bb5('0x32')][_0x0bb5('0x4b')](_0x128cce)['then'](handleEntityNotFound(_0x504964,null))[_0x0bb5('0x26')](respondWithResult(_0x504964,null))[_0x0bb5('0x47')](handleError(_0x504964,null));};exports[_0x0bb5('0x4c')]=function(_0x354ad4,_0x40db8c){return db['MailQueue']['create'](_0x354ad4['body'],{})[_0x0bb5('0x26')](function(_0x1f9bbe){var _0x45fb0b=_0x354ad4[_0x0bb5('0x4d')]['get']({'plain':!![]});if(!_0x45fb0b)throw new Error(_0x0bb5('0x4e'));if(_0x45fb0b[_0x0bb5('0x4f')]===_0x0bb5('0x4d')){var _0x5cff4e=_0x1f9bbe[_0x0bb5('0x27')]({'plain':!![]});var _0xc7b582='MailQueues';return db[_0x0bb5('0x50')][_0x0bb5('0x4b')]({'where':{'name':_0xc7b582,'userProfileId':_0x45fb0b[_0x0bb5('0x51')]},'raw':!![]})[_0x0bb5('0x26')](function(_0x5994a5){if(_0x5994a5&&_0x5994a5[_0x0bb5('0x52')]===0x0){return db['UserProfileResource'][_0x0bb5('0x4c')]({'name':_0x5cff4e['name'],'resourceId':_0x5cff4e['id'],'type':_0x5994a5[_0x0bb5('0x2e')],'sectionId':_0x5994a5['id']},{})['then'](function(){return _0x1f9bbe;});}else{return _0x1f9bbe;}})[_0x0bb5('0x47')](function(_0x1d7697){logger[_0x0bb5('0x2c')](_0x0bb5('0x53'),_0x1d7697);throw _0x1d7697;});}return _0x1f9bbe;})[_0x0bb5('0x26')](respondWithResult(_0x40db8c,0xc9))[_0x0bb5('0x47')](handleError(_0x40db8c,null));};exports[_0x0bb5('0x54')]=function(_0x5eed19,_0x6ad9f){if(_0x5eed19['body']['id']){delete _0x5eed19[_0x0bb5('0x55')]['id'];}return db[_0x0bb5('0x32')][_0x0bb5('0x4b')]({'where':{'id':_0x5eed19['params']['id']}})[_0x0bb5('0x26')](handleEntityNotFound(_0x6ad9f,null))[_0x0bb5('0x26')](saveUpdates(_0x5eed19[_0x0bb5('0x55')],null))[_0x0bb5('0x26')](respondWithResult(_0x6ad9f,null))[_0x0bb5('0x47')](handleError(_0x6ad9f,null));};exports[_0x0bb5('0x2a')]=function(_0x4fcb95,_0x54c249){return db['MailQueue']['find']({'where':{'id':_0x4fcb95['params']['id']}})[_0x0bb5('0x26')](handleEntityNotFound(_0x54c249,null))[_0x0bb5('0x26')](removeEntity(_0x54c249,null))['catch'](handleError(_0x54c249,null));};exports[_0x0bb5('0x56')]=function(_0x28d3db,_0x1ce3f1){return db['MailQueue'][_0x0bb5('0x56')]()[_0x0bb5('0x26')](respondWithResult(_0x1ce3f1,null))[_0x0bb5('0x47')](handleError(_0x1ce3f1,null));};exports['getMembers']=function(_0x4e3e20,_0x4d7b88,_0x5b8001){var _0x578b6a={'raw':!![],'where':{}},_0x2c7429={},_0x2e07ef;return db[_0x0bb5('0x32')][_0x0bb5('0x57')]({'where':{'id':_0x4e3e20[_0x0bb5('0x48')]['id']}})[_0x0bb5('0x26')](handleEntityNotFound(_0x4d7b88,null))[_0x0bb5('0x26')](function(_0x2c0bb5){if(_0x2c0bb5){_0x2e07ef=_0x2c0bb5[_0x0bb5('0x27')]({'plain':!![]});_0x2c7429[_0x0bb5('0x34')]=_['keys'](db['UserMailQueue'][_0x0bb5('0x33')]);_0x2c7429[_0x0bb5('0x35')]=_['keys'](_0x4e3e20[_0x0bb5('0x35')]);_0x2c7429[_0x0bb5('0x37')]=_[_0x0bb5('0x38')](_0x2c7429['model'],_0x2c7429[_0x0bb5('0x35')]);_0x578b6a['attributes']=_[_0x0bb5('0x38')](_0x2c7429[_0x0bb5('0x34')],qs['fields'](_0x4e3e20[_0x0bb5('0x35')][_0x0bb5('0x39')]));_0x578b6a['attributes']=_0x578b6a[_0x0bb5('0x3a')][_0x0bb5('0x3b')]?_0x578b6a['attributes']:_0x2c7429[_0x0bb5('0x34')];if(!_0x4e3e20['query'][_0x0bb5('0x3c')]('nolimit')){_0x578b6a[_0x0bb5('0x21')]=qs[_0x0bb5('0x21')](_0x4e3e20[_0x0bb5('0x35')][_0x0bb5('0x21')]);_0x578b6a[_0x0bb5('0x20')]=qs[_0x0bb5('0x20')](_0x4e3e20[_0x0bb5('0x35')][_0x0bb5('0x20')]);}_0x578b6a['order']=qs[_0x0bb5('0x3d')](_0x4e3e20[_0x0bb5('0x35')][_0x0bb5('0x3d')]);_0x578b6a[_0x0bb5('0x3e')]=qs['filters'](_[_0x0bb5('0x3f')](_0x4e3e20[_0x0bb5('0x35')],_0x2c7429[_0x0bb5('0x37')]));_0x578b6a[_0x0bb5('0x3e')][_0x0bb5('0x58')]=_0x2c0bb5['id'];if(_0x4e3e20[_0x0bb5('0x35')][_0x0bb5('0x40')]){_0x578b6a['where']=_[_0x0bb5('0x41')](_0x578b6a[_0x0bb5('0x3e')],{'$or':_[_0x0bb5('0x31')](_0x578b6a['attributes'],function(_0x27e018){var _0x9dcda3={};_0x9dcda3[_0x27e018]={'$like':'%'+_0x4e3e20[_0x0bb5('0x35')]['filter']+'%'};return _0x9dcda3;})});}_0x578b6a=_[_0x0bb5('0x41')]({},_0x578b6a,_0x4e3e20[_0x0bb5('0x4a')]);return db[_0x0bb5('0x59')]['findAll'](_0x578b6a);}})['then'](function(_0x575126){if(_0x575126){return db['User']['findAndCountAll']({'where':{'id':_[_0x0bb5('0x31')](_0x575126,'UserId'),'role':'agent'},'attributes':['id','name','mailPause',_0x0bb5('0x5a'),'createdAt']});}})[_0x0bb5('0x26')](function(_0x192a5d){if(_0x192a5d){return{'count':_0x192a5d['count'],'rows':_[_0x0bb5('0x31')](_0x192a5d[_0x0bb5('0x46')],function(_0x11bcb3){return{'membername':_0x11bcb3['name'],'UserId':_0x11bcb3['id'],'queue_name':_0x2e07ef[_0x0bb5('0x2e')],'MailQueueId':_0x2e07ef['id'],'interface':util[_0x0bb5('0x5b')](_0x0bb5('0x5c'),'SIP',_0x11bcb3[_0x0bb5('0x2e')]),'penalty':0x0,'paused':_0x11bcb3[_0x0bb5('0x5d')],'createdAt':_0x11bcb3[_0x0bb5('0x5e')],'updatedAt':_0x11bcb3[_0x0bb5('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0bb5('0x26')](respondWithFilteredResult(_0x4d7b88,_0x578b6a))['catch'](handleError(_0x4d7b88,null));};exports[_0x0bb5('0x5f')]=function(_0xa688a5,_0x26011f,_0x1dbadf){var _0x3281bc={};var _0x16aaf2={};var _0x2f1502;var _0x134ff1;return db['MailQueue'][_0x0bb5('0x57')]({'where':{'id':_0xa688a5[_0x0bb5('0x48')]['id']}})['then'](handleEntityNotFound(_0x26011f,null))['then'](function(_0x1f12f9){if(_0x1f12f9){_0x2f1502=_0x1f12f9;_0x16aaf2[_0x0bb5('0x34')]=_[_0x0bb5('0x36')](db[_0x0bb5('0x60')][_0x0bb5('0x33')]);_0x16aaf2['query']=_[_0x0bb5('0x36')](_0xa688a5[_0x0bb5('0x35')]);_0x16aaf2[_0x0bb5('0x37')]=_[_0x0bb5('0x38')](_0x16aaf2[_0x0bb5('0x34')],_0x16aaf2[_0x0bb5('0x35')]);_0x3281bc[_0x0bb5('0x3a')]=_['intersection'](_0x16aaf2[_0x0bb5('0x34')],qs['fields'](_0xa688a5['query'][_0x0bb5('0x39')]));_0x3281bc['attributes']=_0x3281bc['attributes']['length']?_0x3281bc['attributes']:_0x16aaf2[_0x0bb5('0x34')];_0x3281bc[_0x0bb5('0x61')]=qs['sort'](_0xa688a5[_0x0bb5('0x35')][_0x0bb5('0x3d')]);_0x3281bc['where']=qs['filters'](_[_0x0bb5('0x3f')](_0xa688a5[_0x0bb5('0x35')],_0x16aaf2[_0x0bb5('0x37')]));if(_0xa688a5['query'][_0x0bb5('0x40')]){_0x3281bc['where']=_[_0x0bb5('0x41')](_0x3281bc['where'],{'$or':_[_0x0bb5('0x31')](_0x3281bc[_0x0bb5('0x3a')],function(_0x571c22){var _0xf3b17b={};_0xf3b17b[_0x571c22]={'$like':'%'+_0xa688a5[_0x0bb5('0x35')]['filter']+'%'};return _0xf3b17b;})});}_0x3281bc=_['merge']({},_0x3281bc,_0xa688a5[_0x0bb5('0x4a')]);return _0x2f1502[_0x0bb5('0x5f')](_0x3281bc);}})[_0x0bb5('0x26')](function(_0x52cefd){if(_0x52cefd){_0x134ff1=_0x52cefd[_0x0bb5('0x3b')];if(!_0xa688a5['query'][_0x0bb5('0x3c')](_0x0bb5('0x62'))){_0x3281bc[_0x0bb5('0x21')]=qs[_0x0bb5('0x21')](_0xa688a5[_0x0bb5('0x35')][_0x0bb5('0x21')]);_0x3281bc[_0x0bb5('0x20')]=qs['offset'](_0xa688a5[_0x0bb5('0x35')][_0x0bb5('0x20')]);}return _0x2f1502[_0x0bb5('0x5f')](_0x3281bc);}})[_0x0bb5('0x26')](function(_0x408676){if(_0x408676){return _0x408676?{'count':_0x134ff1,'rows':_0x408676}:null;}})['then'](respondWithResult(_0x26011f,null))['catch'](handleError(_0x26011f,null));};exports[_0x0bb5('0x63')]=function(_0x3bacd2,_0x576a02,_0x32141b){var _0x2ea471=_0x3bacd2[_0x0bb5('0x55')][_0x0bb5('0x64')];return db[_0x0bb5('0x60')][_0x0bb5('0x45')]({'where':{'id':_0x2ea471},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x0bb5('0x2e'),'online','voicePause',_0x0bb5('0x65')],'raw':!![]}]})[_0x0bb5('0x26')](function(_0x58aac1){if(_0x58aac1){var _0x23e159=_[_0x0bb5('0x66')](_0x58aac1,function(_0x29b3d8){var _0x3af581=_0x29b3d8[_0x0bb5('0x27')]({'plain':!![]});return _0x3af581[_0x0bb5('0x67')];});return db[_0x0bb5('0x32')]['find']({'where':{'id':_0x3bacd2[_0x0bb5('0x48')]['id']}})[_0x0bb5('0x26')](function(_0x5e3fc6){return db[_0x0bb5('0x68')][_0x0bb5('0x69')](function(_0x5e7179){return _0x5e3fc6[_0x0bb5('0x63')](_0x2ea471,{'transaction':_0x5e7179})[_0x0bb5('0x26')](function(){return BPromise[_0x0bb5('0x6a')](_0x23e159,function(_0x330af5){return db[_0x0bb5('0x59')][_0x0bb5('0x6b')]({'where':{'UserId':_0x330af5['id'],'MailQueueId':_0x3bacd2[_0x0bb5('0x48')]['id']},'transaction':_0x5e7179});});})[_0x0bb5('0x26')](function(){_0x23e159['forEach'](function(_0x413ffc){socket['emit'](_0x0bb5('0x6c'),{'UserId':_0x413ffc['id'],'MailQueueId':_0x5e3fc6['id']});});});});});}})[_0x0bb5('0x26')](respondWithStatusCode(_0x576a02,null))[_0x0bb5('0x47')](handleError(_0x576a02,null));};exports['removeTeams']=function(_0x2780bb,_0x5d3144,_0x3aee61){return db['Team'][_0x0bb5('0x45')]({'where':{'id':_0x2780bb[_0x0bb5('0x35')][_0x0bb5('0x64')]},'attributes':['id'],'include':[{'model':db[_0x0bb5('0x6d')],'as':_0x0bb5('0x67'),'attributes':['id'],'raw':!![]}]})[_0x0bb5('0x26')](handleEntityNotFound(_0x5d3144,null))[_0x0bb5('0x26')](function(_0x4e96f2){var _0x2e3a76=_[_0x0bb5('0x31')](_0x4e96f2,'id');var _0x428fa3=[];var _0x549841=[];var _0x1ed8fe=squel['select']();_0x1ed8fe[_0x0bb5('0x6e')]('tq.TeamId')[_0x0bb5('0x6f')](_0x0bb5('0x70'),'tq')[_0x0bb5('0x71')](_0x0bb5('0x72'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0bb5('0x3e')](_0x0bb5('0x73'),_0x2780bb['params']['id']);for(var _0x3b9511=0x0;_0x3b9511<_0x4e96f2[_0x0bb5('0x3b')];_0x3b9511+=0x1){let _0x4d6111=_0x4e96f2[_0x3b9511];for(var _0x113928=0x0;_0x113928<_0x4d6111['Agents'][_0x0bb5('0x3b')];_0x113928+=0x1){let _0x2df98e=_0x4d6111[_0x0bb5('0x67')][_0x113928];var _0x2f442d=_0x1ed8fe[_0x0bb5('0x74')]();_0x2f442d[_0x0bb5('0x3e')](_0x0bb5('0x75'),_0x2df98e['id']);_0x549841[_0x0bb5('0x76')](db[_0x0bb5('0x68')]['query'](_0x2f442d[_0x0bb5('0x77')](),{'type':db[_0x0bb5('0x68')]['QueryTypes'][_0x0bb5('0x78')]})[_0x0bb5('0x26')](function(_0xb0804f){if(_0xb0804f[_0x0bb5('0x3b')]===0x1){return _0x2df98e['id'];}else{var _0x57a8d7=_[_0x0bb5('0x79')](_[_0x0bb5('0x31')](_0xb0804f,_0x0bb5('0x7a')),function(_0x315605){return _[_0x0bb5('0x7b')](_0x2e3a76,_0x315605);});if(_0x57a8d7){return _0x2df98e['id'];}}}));}}return BPromise['all'](_0x549841)[_0x0bb5('0x26')](function(_0x26192d){_0x428fa3=_(_0x428fa3)[_0x0bb5('0x7c')](_0x26192d)['compact']()[_0x0bb5('0x7d')]();return db['MailQueue'][_0x0bb5('0x4b')]({'where':{'id':_0x2780bb[_0x0bb5('0x48')]['id']}})[_0x0bb5('0x26')](function(_0x45f092){return db['sequelize'][_0x0bb5('0x69')](function(_0xee2f31){return _0x45f092[_0x0bb5('0x7e')](_0x2780bb[_0x0bb5('0x35')]['ids'],{'transaction':_0xee2f31})[_0x0bb5('0x26')](function(){if(!_[_0x0bb5('0x7f')](_0x428fa3)){return _0x45f092[_0x0bb5('0x80')](_0x428fa3,{'transaction':_0xee2f31});}})[_0x0bb5('0x26')](function(){_0x428fa3[_0x0bb5('0x81')](function(_0x501521){socket[_0x0bb5('0x82')](_0x0bb5('0x83'),{'UserId':_0x501521,'MailQueueId':_0x45f092['id']});});});});});});})[_0x0bb5('0x26')](respondWithStatusCode(_0x5d3144,null))[_0x0bb5('0x47')](handleError(_0x5d3144,null));};exports['addAgents']=function(_0x13c6ef,_0x5da917,_0x5affde){return db[_0x0bb5('0x32')][_0x0bb5('0x4b')]({'where':{'id':_0x13c6ef['params']['id']}})['then'](handleEntityNotFound(_0x5da917,null))['then'](function(_0x223057){if(_0x223057){return _0x223057[_0x0bb5('0x84')](_0x13c6ef[_0x0bb5('0x55')][_0x0bb5('0x64')],_[_0x0bb5('0x85')](_0x13c6ef['body'],['ids','id'])||{})[_0x0bb5('0x86')](function(_0x869ca4){for(var _0x25ca0b=0x0;_0x25ca0b<_0x13c6ef[_0x0bb5('0x55')][_0x0bb5('0x64')][_0x0bb5('0x3b')];_0x25ca0b+=0x1){socket['emit'](_0x0bb5('0x6c'),{'UserId':Number(_0x13c6ef[_0x0bb5('0x55')][_0x0bb5('0x64')][_0x25ca0b]),'MailQueueId':Number(_0x13c6ef['params']['id'])});}return _0x869ca4;});}})[_0x0bb5('0x26')](respondWithResult(_0x5da917,null))[_0x0bb5('0x47')](handleError(_0x5da917,null));};exports[_0x0bb5('0x80')]=function(_0x15a3f4,_0x33c547,_0x1cded1){return db['MailQueue'][_0x0bb5('0x4b')]({'where':{'id':_0x15a3f4[_0x0bb5('0x48')]['id']}})[_0x0bb5('0x26')](handleEntityNotFound(_0x33c547,null))['then'](function(_0x5d16fa){if(_0x5d16fa){return _0x5d16fa[_0x0bb5('0x80')](_0x15a3f4[_0x0bb5('0x35')][_0x0bb5('0x64')])[_0x0bb5('0x26')](function(){if(_['isArray'](_0x15a3f4['query']['ids'])){for(var _0x3a433e=0x0;_0x3a433e<_0x15a3f4[_0x0bb5('0x35')][_0x0bb5('0x64')]['length'];_0x3a433e+=0x1){socket[_0x0bb5('0x82')](_0x0bb5('0x83'),{'UserId':Number(_0x15a3f4[_0x0bb5('0x35')]['ids'][_0x3a433e]),'MailQueueId':Number(_0x15a3f4[_0x0bb5('0x48')]['id'])});}}else{socket[_0x0bb5('0x82')](_0x0bb5('0x83'),{'UserId':Number(_0x15a3f4[_0x0bb5('0x35')]['ids']),'MailQueueId':Number(_0x15a3f4[_0x0bb5('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x33c547,null))[_0x0bb5('0x47')](handleError(_0x33c547,null));};exports[_0x0bb5('0x87')]=function(_0x29a132,_0x1d1677,_0x32d3cc){var _0x305612={};var _0x5bbfd9={};var _0x1ad9d3;var _0x1b0bb5;return db[_0x0bb5('0x32')]['findOne']({'where':{'id':_0x29a132['params']['id']}})[_0x0bb5('0x26')](handleEntityNotFound(_0x1d1677,null))[_0x0bb5('0x26')](function(_0x40dba6){if(_0x40dba6){_0x1ad9d3=_0x40dba6;_0x5bbfd9['model']=_['keys'](db['User'][_0x0bb5('0x33')]);_0x5bbfd9['query']=_['keys'](_0x29a132[_0x0bb5('0x35')]);_0x5bbfd9[_0x0bb5('0x37')]=_[_0x0bb5('0x38')](_0x5bbfd9[_0x0bb5('0x34')],_0x5bbfd9[_0x0bb5('0x35')]);_0x305612[_0x0bb5('0x3a')]=_['intersection'](_0x5bbfd9['model'],qs[_0x0bb5('0x39')](_0x29a132[_0x0bb5('0x35')][_0x0bb5('0x39')]));_0x305612[_0x0bb5('0x3a')]=_0x305612['attributes'][_0x0bb5('0x3b')]?_0x305612[_0x0bb5('0x3a')]:_0x5bbfd9[_0x0bb5('0x34')];_0x305612[_0x0bb5('0x61')]=qs[_0x0bb5('0x3d')](_0x29a132[_0x0bb5('0x35')]['sort']);_0x305612[_0x0bb5('0x3e')]=qs[_0x0bb5('0x37')](_[_0x0bb5('0x3f')](_0x29a132[_0x0bb5('0x35')],_0x5bbfd9[_0x0bb5('0x37')]));if(_0x29a132['query']['filter']){_0x305612[_0x0bb5('0x3e')]=_[_0x0bb5('0x41')](_0x305612[_0x0bb5('0x3e')],{'$or':_['map'](_0x305612[_0x0bb5('0x3a')],function(_0x57ee39){var _0x3c3f1d={};_0x3c3f1d[_0x57ee39]={'$like':'%'+_0x29a132['query'][_0x0bb5('0x40')]+'%'};return _0x3c3f1d;})});}_0x305612=_[_0x0bb5('0x41')]({},_0x305612,_0x29a132[_0x0bb5('0x4a')]);return _0x1ad9d3[_0x0bb5('0x87')](_0x305612);}})['then'](function(_0x306414){if(_0x306414){_0x1b0bb5=_0x306414[_0x0bb5('0x3b')];if(!_0x29a132[_0x0bb5('0x35')][_0x0bb5('0x3c')](_0x0bb5('0x62'))){_0x305612[_0x0bb5('0x21')]=qs[_0x0bb5('0x21')](_0x29a132[_0x0bb5('0x35')][_0x0bb5('0x21')]);_0x305612['offset']=qs['offset'](_0x29a132[_0x0bb5('0x35')][_0x0bb5('0x20')]);}return _0x1ad9d3[_0x0bb5('0x87')](_0x305612);}})[_0x0bb5('0x26')](function(_0xba2847){if(_0xba2847){return _0xba2847?{'count':_0x1b0bb5,'rows':_0xba2847}:null;}})['then'](respondWithResult(_0x1d1677,null))['catch'](handleError(_0x1d1677,null));}; \ No newline at end of file +var _0xe3c9=['addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','findAll','select','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','removeTeams','removeAgents','userMailQueue:remove','addAgents','getAgents','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','offset','limit','count','set','json','apply','reject','save','update','then','destroy','MailQueues','UserProfileResource','end','error','stack','name','index','map','MailQueue','rawAttributes','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','MailQueueId','User','findAndCountAll','mailPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0xe3c9,0x1ad));var _0x9e3c=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xe3c9[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e3c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e3c('0x1'));var rp=require(_0x9e3c('0x2'));var moment=require(_0x9e3c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9e3c('0x4'));var util=require(_0x9e3c('0x5'));var path=require(_0x9e3c('0x6'));var sox=require(_0x9e3c('0x7'));var csv=require('to-csv');var ejs=require(_0x9e3c('0x8'));var fs=require('fs');var fs_extra=require(_0x9e3c('0x9'));var _=require('lodash');var squel=require(_0x9e3c('0xa'));var crypto=require(_0x9e3c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9e3c('0xc'));var toCsv=require(_0x9e3c('0xd'));var querystring=require('querystring');var Papa=require(_0x9e3c('0xe'));var Redis=require(_0x9e3c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9e3c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e3c('0x11'))(_0x9e3c('0x12'));var utils=require('../../config/utils');var config=require(_0x9e3c('0x13'));var licenseUtil=require(_0x9e3c('0x14'));var db=require(_0x9e3c('0x15'))['db'];config['redis']=_[_0x9e3c('0x16')](config[_0x9e3c('0x17')],{'host':_0x9e3c('0x18'),'port':0x18eb});var socket=require(_0x9e3c('0x19'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x9e3c('0x1a')](socket);function respondWithStatusCode(_0x413790,_0x8765d2){_0x8765d2=_0x8765d2||0xcc;return function(_0x3fdd0a){if(_0x3fdd0a){return _0x413790[_0x9e3c('0x1b')](_0x8765d2);}return _0x413790[_0x9e3c('0x1c')](_0x8765d2)['end']();};}function respondWithResult(_0x2fd8b8,_0x335a6f){_0x335a6f=_0x335a6f||0xc8;return function(_0x5a8fc4){if(_0x5a8fc4){return _0x2fd8b8['status'](_0x335a6f)['json'](_0x5a8fc4);}};}function respondWithFilteredResult(_0x2e4ce9,_0x56e8e7){return function(_0x2943fe){if(_0x2943fe){var _0x47da45=typeof _0x56e8e7[_0x9e3c('0x1d')]==='undefined'&&typeof _0x56e8e7[_0x9e3c('0x1e')]==='undefined';var _0x47ad90=_0x2943fe[_0x9e3c('0x1f')];var _0x2eb6d7=_0x47da45?0x0:_0x56e8e7[_0x9e3c('0x1d')];var _0x5c9244=_0x47da45?_0x2943fe[_0x9e3c('0x1f')]:_0x56e8e7[_0x9e3c('0x1d')]+_0x56e8e7[_0x9e3c('0x1e')];var _0x24300a;if(_0x5c9244>=_0x47ad90){_0x5c9244=_0x47ad90;_0x24300a=0xc8;}else{_0x24300a=0xce;}_0x2e4ce9[_0x9e3c('0x1c')](_0x24300a);return _0x2e4ce9[_0x9e3c('0x20')]('Content-Range',_0x2eb6d7+'-'+_0x5c9244+'/'+_0x47ad90)[_0x9e3c('0x21')](_0x2943fe);}return null;};}function patchUpdates(_0x22a0cc){return function(_0x512ec8){try{jsonpatch[_0x9e3c('0x22')](_0x512ec8,_0x22a0cc,!![]);}catch(_0x1d68cd){return BPromise[_0x9e3c('0x23')](_0x1d68cd);}return _0x512ec8[_0x9e3c('0x24')]();};}function saveUpdates(_0x134bfd,_0x38499a){return function(_0x3a6c45){if(_0x3a6c45){return _0x3a6c45[_0x9e3c('0x25')](_0x134bfd)[_0x9e3c('0x26')](function(_0x35f6a2){return _0x35f6a2;});}return null;};}function removeEntity(_0x1bea58,_0x4452c8){return function(_0x42ecc8){if(_0x42ecc8){return _0x42ecc8[_0x9e3c('0x27')]()[_0x9e3c('0x26')](function(){var _0x11c9c7=_0x42ecc8['get']({'plain':!![]});var _0x303f45=_0x9e3c('0x28');return db[_0x9e3c('0x29')]['destroy']({'where':{'type':_0x303f45,'resourceId':_0x11c9c7['id']}})['then'](function(){return _0x42ecc8;});})[_0x9e3c('0x26')](function(){_0x1bea58['status'](0xcc)[_0x9e3c('0x2a')]();});}};}function handleEntityNotFound(_0x4f8ab0,_0xb2c1a9){return function(_0x5a3b41){if(!_0x5a3b41){_0x4f8ab0['sendStatus'](0x194);}return _0x5a3b41;};}function handleError(_0x422afe,_0x55ea22){_0x55ea22=_0x55ea22||0x1f4;return function(_0x246800){logger[_0x9e3c('0x2b')](_0x246800[_0x9e3c('0x2c')]);if(_0x246800['name']){delete _0x246800[_0x9e3c('0x2d')];}_0x422afe['status'](_0x55ea22)['send'](_0x246800);};}exports[_0x9e3c('0x2e')]=function(_0x1b52eb,_0x1689d9){var _0x29acc6={},_0x370f14={},_0x50d488={'count':0x0,'rows':[]};var _0x19a843=_[_0x9e3c('0x2f')](db[_0x9e3c('0x30')][_0x9e3c('0x31')],function(_0xb96fa6){return{'name':_0xb96fa6['fieldName'],'type':_0xb96fa6[_0x9e3c('0x32')][_0x9e3c('0x33')]};});_0x370f14['model']=_[_0x9e3c('0x2f')](_0x19a843,_0x9e3c('0x2d'));_0x370f14[_0x9e3c('0x34')]=_[_0x9e3c('0x35')](_0x1b52eb[_0x9e3c('0x34')]);_0x370f14[_0x9e3c('0x36')]=_['intersection'](_0x370f14[_0x9e3c('0x37')],_0x370f14['query']);_0x29acc6['attributes']=_[_0x9e3c('0x38')](_0x370f14[_0x9e3c('0x37')],qs[_0x9e3c('0x39')](_0x1b52eb['query'][_0x9e3c('0x39')]));_0x29acc6[_0x9e3c('0x3a')]=_0x29acc6['attributes'][_0x9e3c('0x3b')]?_0x29acc6[_0x9e3c('0x3a')]:_0x370f14[_0x9e3c('0x37')];if(!_0x1b52eb[_0x9e3c('0x34')][_0x9e3c('0x3c')](_0x9e3c('0x3d'))){_0x29acc6['limit']=qs[_0x9e3c('0x1e')](_0x1b52eb[_0x9e3c('0x34')][_0x9e3c('0x1e')]);_0x29acc6['offset']=qs[_0x9e3c('0x1d')](_0x1b52eb[_0x9e3c('0x34')][_0x9e3c('0x1d')]);}_0x29acc6[_0x9e3c('0x3e')]=qs[_0x9e3c('0x3f')](_0x1b52eb[_0x9e3c('0x34')]['sort']);_0x29acc6[_0x9e3c('0x40')]=qs[_0x9e3c('0x36')](_[_0x9e3c('0x41')](_0x1b52eb[_0x9e3c('0x34')],_0x370f14[_0x9e3c('0x36')]),_0x19a843);if(_0x1b52eb[_0x9e3c('0x34')][_0x9e3c('0x42')]){_0x29acc6[_0x9e3c('0x40')]=_[_0x9e3c('0x43')](_0x29acc6[_0x9e3c('0x40')],{'$or':_[_0x9e3c('0x2f')](_0x19a843,function(_0x4bc800){if(_0x4bc800['type']!==_0x9e3c('0x44')){var _0x905f5a={};_0x905f5a[_0x4bc800[_0x9e3c('0x2d')]]={'$like':'%'+_0x1b52eb[_0x9e3c('0x34')]['filter']+'%'};return _0x905f5a;}})});}_0x29acc6=_[_0x9e3c('0x43')]({},_0x29acc6,_0x1b52eb[_0x9e3c('0x45')]);var _0x4c5142={'where':_0x29acc6[_0x9e3c('0x40')]};return db[_0x9e3c('0x30')][_0x9e3c('0x1f')](_0x4c5142)[_0x9e3c('0x26')](function(_0x35c29d){_0x50d488[_0x9e3c('0x1f')]=_0x35c29d;if(_0x1b52eb[_0x9e3c('0x34')][_0x9e3c('0x46')]){_0x29acc6[_0x9e3c('0x47')]=[{'all':!![]}];}return db[_0x9e3c('0x30')]['findAll'](_0x29acc6);})[_0x9e3c('0x26')](function(_0x11c74f){_0x50d488[_0x9e3c('0x48')]=_0x11c74f;return _0x50d488;})[_0x9e3c('0x26')](respondWithFilteredResult(_0x1689d9,_0x29acc6))[_0x9e3c('0x49')](handleError(_0x1689d9,null));};exports['show']=function(_0x207e9f,_0x3b2de2){var _0x14edbc={'raw':!![],'where':{'id':_0x207e9f['params']['id']}},_0x443102={};_0x443102[_0x9e3c('0x37')]=_[_0x9e3c('0x35')](db[_0x9e3c('0x30')][_0x9e3c('0x31')]);_0x443102['query']=_[_0x9e3c('0x35')](_0x207e9f[_0x9e3c('0x34')]);_0x443102[_0x9e3c('0x36')]=_[_0x9e3c('0x38')](_0x443102['model'],_0x443102[_0x9e3c('0x34')]);_0x14edbc[_0x9e3c('0x3a')]=_[_0x9e3c('0x38')](_0x443102[_0x9e3c('0x37')],qs[_0x9e3c('0x39')](_0x207e9f[_0x9e3c('0x34')]['fields']));_0x14edbc[_0x9e3c('0x3a')]=_0x14edbc[_0x9e3c('0x3a')]['length']?_0x14edbc[_0x9e3c('0x3a')]:_0x443102[_0x9e3c('0x37')];if(_0x207e9f[_0x9e3c('0x34')]['includeAll']){_0x14edbc[_0x9e3c('0x47')]=[{'all':!![]}];}_0x14edbc=_[_0x9e3c('0x43')]({},_0x14edbc,_0x207e9f[_0x9e3c('0x45')]);return db[_0x9e3c('0x30')]['find'](_0x14edbc)[_0x9e3c('0x26')](handleEntityNotFound(_0x3b2de2,null))[_0x9e3c('0x26')](respondWithResult(_0x3b2de2,null))[_0x9e3c('0x49')](handleError(_0x3b2de2,null));};exports[_0x9e3c('0x4a')]=function(_0x385a3e,_0x290de0){return db[_0x9e3c('0x30')][_0x9e3c('0x4a')](_0x385a3e[_0x9e3c('0x4b')],{})[_0x9e3c('0x26')](function(_0x5ee9ec){var _0x50ec6a=_0x385a3e[_0x9e3c('0x4c')][_0x9e3c('0x4d')]({'plain':!![]});if(!_0x50ec6a)throw new Error(_0x9e3c('0x4e'));if(_0x50ec6a[_0x9e3c('0x4f')]===_0x9e3c('0x4c')){var _0x1198f9=_0x5ee9ec[_0x9e3c('0x4d')]({'plain':!![]});var _0x4e41b9=_0x9e3c('0x28');return db[_0x9e3c('0x50')][_0x9e3c('0x51')]({'where':{'name':_0x4e41b9,'userProfileId':_0x50ec6a[_0x9e3c('0x52')]},'raw':!![]})['then'](function(_0x540879){if(_0x540879&&_0x540879[_0x9e3c('0x53')]===0x0){return db[_0x9e3c('0x29')][_0x9e3c('0x4a')]({'name':_0x1198f9[_0x9e3c('0x2d')],'resourceId':_0x1198f9['id'],'type':_0x540879[_0x9e3c('0x2d')],'sectionId':_0x540879['id']},{})['then'](function(){return _0x5ee9ec;});}else{return _0x5ee9ec;}})[_0x9e3c('0x49')](function(_0x24cd10){logger['error'](_0x9e3c('0x54'),_0x24cd10);throw _0x24cd10;});}return _0x5ee9ec;})[_0x9e3c('0x26')](respondWithResult(_0x290de0,0xc9))[_0x9e3c('0x49')](handleError(_0x290de0,null));};exports[_0x9e3c('0x25')]=function(_0xf1efa3,_0x32cf83){if(_0xf1efa3[_0x9e3c('0x4b')]['id']){delete _0xf1efa3['body']['id'];}return db['MailQueue'][_0x9e3c('0x51')]({'where':{'id':_0xf1efa3[_0x9e3c('0x55')]['id']}})['then'](handleEntityNotFound(_0x32cf83,null))['then'](saveUpdates(_0xf1efa3[_0x9e3c('0x4b')],null))[_0x9e3c('0x26')](respondWithResult(_0x32cf83,null))[_0x9e3c('0x49')](handleError(_0x32cf83,null));};exports['destroy']=function(_0x1d77c9,_0x42d84f){return db['MailQueue'][_0x9e3c('0x51')]({'where':{'id':_0x1d77c9[_0x9e3c('0x55')]['id']}})['then'](handleEntityNotFound(_0x42d84f,null))[_0x9e3c('0x26')](removeEntity(_0x42d84f,null))[_0x9e3c('0x49')](handleError(_0x42d84f,null));};exports['describe']=function(_0x5ef5c6,_0x5d76b5){return db[_0x9e3c('0x30')][_0x9e3c('0x56')]()[_0x9e3c('0x26')](respondWithResult(_0x5d76b5,null))['catch'](handleError(_0x5d76b5,null));};exports[_0x9e3c('0x57')]=function(_0x59c640,_0x2225b9,_0x1647ea){var _0x4de97b={'raw':!![],'where':{}},_0x3b52ed={},_0x5687ff;return db[_0x9e3c('0x30')]['findOne']({'where':{'id':_0x59c640['params']['id']}})[_0x9e3c('0x26')](handleEntityNotFound(_0x2225b9,null))[_0x9e3c('0x26')](function(_0x68b946){if(_0x68b946){_0x5687ff=_0x68b946[_0x9e3c('0x4d')]({'plain':!![]});_0x3b52ed[_0x9e3c('0x37')]=_['keys'](db['UserMailQueue'][_0x9e3c('0x31')]);_0x3b52ed['query']=_[_0x9e3c('0x35')](_0x59c640[_0x9e3c('0x34')]);_0x3b52ed[_0x9e3c('0x36')]=_[_0x9e3c('0x38')](_0x3b52ed[_0x9e3c('0x37')],_0x3b52ed[_0x9e3c('0x34')]);_0x4de97b['attributes']=_[_0x9e3c('0x38')](_0x3b52ed[_0x9e3c('0x37')],qs['fields'](_0x59c640[_0x9e3c('0x34')][_0x9e3c('0x39')]));_0x4de97b['attributes']=_0x4de97b[_0x9e3c('0x3a')]['length']?_0x4de97b[_0x9e3c('0x3a')]:_0x3b52ed[_0x9e3c('0x37')];if(!_0x59c640[_0x9e3c('0x34')][_0x9e3c('0x3c')](_0x9e3c('0x3d'))){_0x4de97b[_0x9e3c('0x1e')]=qs[_0x9e3c('0x1e')](_0x59c640[_0x9e3c('0x34')][_0x9e3c('0x1e')]);_0x4de97b[_0x9e3c('0x1d')]=qs[_0x9e3c('0x1d')](_0x59c640[_0x9e3c('0x34')][_0x9e3c('0x1d')]);}_0x4de97b[_0x9e3c('0x3e')]=qs[_0x9e3c('0x3f')](_0x59c640[_0x9e3c('0x34')][_0x9e3c('0x3f')]);_0x4de97b[_0x9e3c('0x40')]=qs[_0x9e3c('0x36')](_[_0x9e3c('0x41')](_0x59c640['query'],_0x3b52ed[_0x9e3c('0x36')]));_0x4de97b[_0x9e3c('0x40')][_0x9e3c('0x58')]=_0x68b946['id'];if(_0x59c640[_0x9e3c('0x34')][_0x9e3c('0x42')]){_0x4de97b[_0x9e3c('0x40')]=_['merge'](_0x4de97b[_0x9e3c('0x40')],{'$or':_[_0x9e3c('0x2f')](_0x4de97b[_0x9e3c('0x3a')],function(_0x5c98c6){var _0x2cdd89={};_0x2cdd89[_0x5c98c6]={'$like':'%'+_0x59c640[_0x9e3c('0x34')][_0x9e3c('0x42')]+'%'};return _0x2cdd89;})});}_0x4de97b=_[_0x9e3c('0x43')]({},_0x4de97b,_0x59c640['options']);return db['UserMailQueue']['findAll'](_0x4de97b);}})['then'](function(_0x3c4a17){if(_0x3c4a17){return db[_0x9e3c('0x59')][_0x9e3c('0x5a')]({'where':{'id':_[_0x9e3c('0x2f')](_0x3c4a17,'UserId'),'role':'agent'},'attributes':['id',_0x9e3c('0x2d'),_0x9e3c('0x5b'),_0x9e3c('0x5c'),_0x9e3c('0x5d')]});}})['then'](function(_0x22af0c){if(_0x22af0c){return{'count':_0x22af0c[_0x9e3c('0x1f')],'rows':_[_0x9e3c('0x2f')](_0x22af0c[_0x9e3c('0x48')],function(_0x2b20ed){return{'membername':_0x2b20ed[_0x9e3c('0x2d')],'UserId':_0x2b20ed['id'],'queue_name':_0x5687ff[_0x9e3c('0x2d')],'MailQueueId':_0x5687ff['id'],'interface':util[_0x9e3c('0x5e')]('%s/%s',_0x9e3c('0x5f'),_0x2b20ed[_0x9e3c('0x2d')]),'penalty':0x0,'paused':_0x2b20ed[_0x9e3c('0x5b')],'createdAt':_0x2b20ed[_0x9e3c('0x5d')],'updatedAt':_0x2b20ed[_0x9e3c('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9e3c('0x26')](respondWithFilteredResult(_0x2225b9,_0x4de97b))[_0x9e3c('0x49')](handleError(_0x2225b9,null));};exports[_0x9e3c('0x60')]=function(_0x417382,_0x2879a0,_0x384d54){var _0xfaad10={};var _0x319c16={};var _0x5e6393;var _0xfaf65f;return db['MailQueue'][_0x9e3c('0x61')]({'where':{'id':_0x417382[_0x9e3c('0x55')]['id']}})[_0x9e3c('0x26')](handleEntityNotFound(_0x2879a0,null))[_0x9e3c('0x26')](function(_0x3ac509){if(_0x3ac509){_0x5e6393=_0x3ac509;_0x319c16[_0x9e3c('0x37')]=_[_0x9e3c('0x35')](db[_0x9e3c('0x62')]['rawAttributes']);_0x319c16[_0x9e3c('0x34')]=_[_0x9e3c('0x35')](_0x417382[_0x9e3c('0x34')]);_0x319c16[_0x9e3c('0x36')]=_[_0x9e3c('0x38')](_0x319c16[_0x9e3c('0x37')],_0x319c16['query']);_0xfaad10[_0x9e3c('0x3a')]=_[_0x9e3c('0x38')](_0x319c16[_0x9e3c('0x37')],qs[_0x9e3c('0x39')](_0x417382[_0x9e3c('0x34')][_0x9e3c('0x39')]));_0xfaad10[_0x9e3c('0x3a')]=_0xfaad10[_0x9e3c('0x3a')][_0x9e3c('0x3b')]?_0xfaad10[_0x9e3c('0x3a')]:_0x319c16[_0x9e3c('0x37')];_0xfaad10[_0x9e3c('0x3e')]=qs[_0x9e3c('0x3f')](_0x417382[_0x9e3c('0x34')]['sort']);_0xfaad10[_0x9e3c('0x40')]=qs[_0x9e3c('0x36')](_[_0x9e3c('0x41')](_0x417382[_0x9e3c('0x34')],_0x319c16['filters']));if(_0x417382['query'][_0x9e3c('0x42')]){_0xfaad10[_0x9e3c('0x40')]=_['merge'](_0xfaad10[_0x9e3c('0x40')],{'$or':_[_0x9e3c('0x2f')](_0xfaad10[_0x9e3c('0x3a')],function(_0x3f154b){var _0x12f06e={};_0x12f06e[_0x3f154b]={'$like':'%'+_0x417382[_0x9e3c('0x34')][_0x9e3c('0x42')]+'%'};return _0x12f06e;})});}_0xfaad10=_[_0x9e3c('0x43')]({},_0xfaad10,_0x417382['options']);return _0x5e6393[_0x9e3c('0x60')](_0xfaad10);}})[_0x9e3c('0x26')](function(_0x171c5d){if(_0x171c5d){_0xfaf65f=_0x171c5d[_0x9e3c('0x3b')];if(!_0x417382[_0x9e3c('0x34')][_0x9e3c('0x3c')](_0x9e3c('0x3d'))){_0xfaad10[_0x9e3c('0x1e')]=qs[_0x9e3c('0x1e')](_0x417382[_0x9e3c('0x34')][_0x9e3c('0x1e')]);_0xfaad10['offset']=qs['offset'](_0x417382[_0x9e3c('0x34')][_0x9e3c('0x1d')]);}return _0x5e6393[_0x9e3c('0x60')](_0xfaad10);}})[_0x9e3c('0x26')](function(_0x551f46){if(_0x551f46){return _0x551f46?{'count':_0xfaf65f,'rows':_0x551f46}:null;}})[_0x9e3c('0x26')](respondWithResult(_0x2879a0,null))[_0x9e3c('0x49')](handleError(_0x2879a0,null));};exports['addTeams']=function(_0xa89f01,_0x53d198,_0x5c1c6a){var _0x905f87=_0xa89f01[_0x9e3c('0x4b')][_0x9e3c('0x63')];return db[_0x9e3c('0x62')]['findAll']({'where':{'id':_0x905f87},'attributes':['id'],'include':[{'model':db[_0x9e3c('0x59')],'as':_0x9e3c('0x64'),'attributes':['id',_0x9e3c('0x2d'),_0x9e3c('0x65'),_0x9e3c('0x66'),_0x9e3c('0x67')],'raw':!![]}]})['then'](function(_0x21ea03){if(_0x21ea03){var _0x3c41c0=_[_0x9e3c('0x68')](_0x21ea03,function(_0x1152f6){var _0x242d87=_0x1152f6[_0x9e3c('0x4d')]({'plain':!![]});return _0x242d87[_0x9e3c('0x64')];});return db['MailQueue']['find']({'where':{'id':_0xa89f01['params']['id']}})[_0x9e3c('0x26')](function(_0x14c73b){return db[_0x9e3c('0x69')][_0x9e3c('0x6a')](function(_0x7a4289){return _0x14c73b[_0x9e3c('0x6b')](_0x905f87,{'transaction':_0x7a4289})[_0x9e3c('0x26')](function(){return BPromise[_0x9e3c('0x6c')](_0x3c41c0,function(_0x347c37){return db['UserMailQueue'][_0x9e3c('0x6d')]({'where':{'UserId':_0x347c37['id'],'MailQueueId':_0xa89f01[_0x9e3c('0x55')]['id']},'transaction':_0x7a4289});});})[_0x9e3c('0x26')](function(){_0x3c41c0[_0x9e3c('0x6e')](function(_0x2d867d){socket[_0x9e3c('0x6f')](_0x9e3c('0x70'),{'UserId':_0x2d867d['id'],'MailQueueId':_0x14c73b['id']});});});});});}})['then'](respondWithStatusCode(_0x53d198,null))[_0x9e3c('0x49')](handleError(_0x53d198,null));};exports['removeTeams']=function(_0x2aaec4,_0x7a9d4b,_0x409dfc){return db[_0x9e3c('0x62')][_0x9e3c('0x71')]({'where':{'id':_0x2aaec4[_0x9e3c('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9e3c('0x59')],'as':_0x9e3c('0x64'),'attributes':['id'],'raw':!![]}]})[_0x9e3c('0x26')](handleEntityNotFound(_0x7a9d4b,null))['then'](function(_0x29dae6){var _0x4d04a1=_[_0x9e3c('0x2f')](_0x29dae6,'id');var _0x4a5d90=[];var _0x237230=[];var _0x31bf19=squel[_0x9e3c('0x72')]();_0x31bf19['field']('tq.TeamId')[_0x9e3c('0x73')]('team_has_mail_queues','tq')[_0x9e3c('0x74')](_0x9e3c('0x75'),'ut',_0x9e3c('0x76'))[_0x9e3c('0x40')](_0x9e3c('0x77'),_0x2aaec4[_0x9e3c('0x55')]['id']);for(var _0x3ab82d=0x0;_0x3ab82d<_0x29dae6[_0x9e3c('0x3b')];_0x3ab82d+=0x1){let _0x4e786e=_0x29dae6[_0x3ab82d];for(var _0x2fe03f=0x0;_0x2fe03f<_0x4e786e[_0x9e3c('0x64')]['length'];_0x2fe03f+=0x1){let _0x2345a5=_0x4e786e[_0x9e3c('0x64')][_0x2fe03f];var _0x2b6984=_0x31bf19['clone']();_0x2b6984['where']('ut.UserId\x20=\x20?',_0x2345a5['id']);_0x237230[_0x9e3c('0x78')](db[_0x9e3c('0x69')][_0x9e3c('0x34')](_0x2b6984[_0x9e3c('0x79')](),{'type':db[_0x9e3c('0x69')][_0x9e3c('0x7a')][_0x9e3c('0x7b')]})[_0x9e3c('0x26')](function(_0xd9d8bf){if(_0xd9d8bf[_0x9e3c('0x3b')]===0x1){return _0x2345a5['id'];}else{var _0x3b682a=_[_0x9e3c('0x7c')](_[_0x9e3c('0x2f')](_0xd9d8bf,_0x9e3c('0x7d')),function(_0xb61092){return _[_0x9e3c('0x7e')](_0x4d04a1,_0xb61092);});if(_0x3b682a){return _0x2345a5['id'];}}}));}}return BPromise[_0x9e3c('0x7f')](_0x237230)[_0x9e3c('0x26')](function(_0x236939){_0x4a5d90=_(_0x4a5d90)[_0x9e3c('0x80')](_0x236939)['compact']()['value']();return db['MailQueue'][_0x9e3c('0x51')]({'where':{'id':_0x2aaec4[_0x9e3c('0x55')]['id']}})[_0x9e3c('0x26')](function(_0x395be4){return db[_0x9e3c('0x69')][_0x9e3c('0x6a')](function(_0x5047bc){return _0x395be4[_0x9e3c('0x81')](_0x2aaec4[_0x9e3c('0x34')][_0x9e3c('0x63')],{'transaction':_0x5047bc})[_0x9e3c('0x26')](function(){if(!_['isEmpty'](_0x4a5d90)){return _0x395be4[_0x9e3c('0x82')](_0x4a5d90,{'transaction':_0x5047bc});}})[_0x9e3c('0x26')](function(){_0x4a5d90['forEach'](function(_0x4adc84){socket[_0x9e3c('0x6f')](_0x9e3c('0x83'),{'UserId':_0x4adc84,'MailQueueId':_0x395be4['id']});});});});});});})[_0x9e3c('0x26')](respondWithStatusCode(_0x7a9d4b,null))['catch'](handleError(_0x7a9d4b,null));};exports[_0x9e3c('0x84')]=function(_0x1fc4c8,_0x3118e5,_0x55f587){return db[_0x9e3c('0x30')][_0x9e3c('0x51')]({'where':{'id':_0x1fc4c8[_0x9e3c('0x55')]['id']}})['then'](handleEntityNotFound(_0x3118e5,null))['then'](function(_0x59e8d5){if(_0x59e8d5){return _0x59e8d5['addAgents'](_0x1fc4c8['body'][_0x9e3c('0x63')],_['omit'](_0x1fc4c8[_0x9e3c('0x4b')],[_0x9e3c('0x63'),'id'])||{})['spread'](function(_0x32d6b7){for(var _0x9f0546=0x0;_0x9f0546<_0x1fc4c8[_0x9e3c('0x4b')][_0x9e3c('0x63')]['length'];_0x9f0546+=0x1){socket[_0x9e3c('0x6f')](_0x9e3c('0x70'),{'UserId':Number(_0x1fc4c8[_0x9e3c('0x4b')][_0x9e3c('0x63')][_0x9f0546]),'MailQueueId':Number(_0x1fc4c8['params']['id'])});}return _0x32d6b7;});}})[_0x9e3c('0x26')](respondWithResult(_0x3118e5,null))['catch'](handleError(_0x3118e5,null));};exports[_0x9e3c('0x82')]=function(_0x3c2419,_0x4f90f1,_0xc3a3c6){return db[_0x9e3c('0x30')][_0x9e3c('0x51')]({'where':{'id':_0x3c2419[_0x9e3c('0x55')]['id']}})[_0x9e3c('0x26')](handleEntityNotFound(_0x4f90f1,null))[_0x9e3c('0x26')](function(_0x51069c){if(_0x51069c){return _0x51069c[_0x9e3c('0x82')](_0x3c2419[_0x9e3c('0x34')][_0x9e3c('0x63')])[_0x9e3c('0x26')](function(){if(_['isArray'](_0x3c2419[_0x9e3c('0x34')][_0x9e3c('0x63')])){for(var _0x5a893e=0x0;_0x5a893e<_0x3c2419[_0x9e3c('0x34')]['ids']['length'];_0x5a893e+=0x1){socket[_0x9e3c('0x6f')](_0x9e3c('0x83'),{'UserId':Number(_0x3c2419[_0x9e3c('0x34')][_0x9e3c('0x63')][_0x5a893e]),'MailQueueId':Number(_0x3c2419['params']['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x3c2419[_0x9e3c('0x34')][_0x9e3c('0x63')]),'MailQueueId':Number(_0x3c2419['params']['id'])});}});}})[_0x9e3c('0x26')](respondWithStatusCode(_0x4f90f1,null))['catch'](handleError(_0x4f90f1,null));};exports['getAgents']=function(_0x53919a,_0x1f6d89,_0x4fb636){var _0x18e684={};var _0x23ad4e={};var _0x55e6c2;var _0x52909f;return db[_0x9e3c('0x30')][_0x9e3c('0x61')]({'where':{'id':_0x53919a['params']['id']}})[_0x9e3c('0x26')](handleEntityNotFound(_0x1f6d89,null))[_0x9e3c('0x26')](function(_0x20427e){if(_0x20427e){_0x55e6c2=_0x20427e;_0x23ad4e[_0x9e3c('0x37')]=_[_0x9e3c('0x35')](db[_0x9e3c('0x59')][_0x9e3c('0x31')]);_0x23ad4e[_0x9e3c('0x34')]=_[_0x9e3c('0x35')](_0x53919a[_0x9e3c('0x34')]);_0x23ad4e[_0x9e3c('0x36')]=_[_0x9e3c('0x38')](_0x23ad4e[_0x9e3c('0x37')],_0x23ad4e[_0x9e3c('0x34')]);_0x18e684[_0x9e3c('0x3a')]=_[_0x9e3c('0x38')](_0x23ad4e[_0x9e3c('0x37')],qs[_0x9e3c('0x39')](_0x53919a[_0x9e3c('0x34')]['fields']));_0x18e684[_0x9e3c('0x3a')]=_0x18e684['attributes'][_0x9e3c('0x3b')]?_0x18e684[_0x9e3c('0x3a')]:_0x23ad4e[_0x9e3c('0x37')];_0x18e684['order']=qs['sort'](_0x53919a[_0x9e3c('0x34')][_0x9e3c('0x3f')]);_0x18e684[_0x9e3c('0x40')]=qs['filters'](_[_0x9e3c('0x41')](_0x53919a[_0x9e3c('0x34')],_0x23ad4e[_0x9e3c('0x36')]));if(_0x53919a[_0x9e3c('0x34')][_0x9e3c('0x42')]){_0x18e684[_0x9e3c('0x40')]=_[_0x9e3c('0x43')](_0x18e684['where'],{'$or':_['map'](_0x18e684[_0x9e3c('0x3a')],function(_0x3a65bb){var _0x3ae971={};_0x3ae971[_0x3a65bb]={'$like':'%'+_0x53919a['query'][_0x9e3c('0x42')]+'%'};return _0x3ae971;})});}_0x18e684=_['merge']({},_0x18e684,_0x53919a[_0x9e3c('0x45')]);return _0x55e6c2['getAgents'](_0x18e684);}})[_0x9e3c('0x26')](function(_0xb281ee){if(_0xb281ee){_0x52909f=_0xb281ee[_0x9e3c('0x3b')];if(!_0x53919a[_0x9e3c('0x34')][_0x9e3c('0x3c')](_0x9e3c('0x3d'))){_0x18e684[_0x9e3c('0x1e')]=qs[_0x9e3c('0x1e')](_0x53919a['query'][_0x9e3c('0x1e')]);_0x18e684[_0x9e3c('0x1d')]=qs['offset'](_0x53919a[_0x9e3c('0x34')][_0x9e3c('0x1d')]);}return _0x55e6c2[_0x9e3c('0x85')](_0x18e684);}})[_0x9e3c('0x26')](function(_0x5eddb7){if(_0x5eddb7){return _0x5eddb7?{'count':_0x52909f,'rows':_0x5eddb7}:null;}})['then'](respondWithResult(_0x1f6d89,null))['catch'](handleError(_0x1f6d89,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 1d28835..02e0e29 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 _0xcca1=['MailQueue','save','update','remove','emit','exports','events'];(function(_0x19131f,_0x379191){var _0x2636e4=function(_0x2f11cf){while(--_0x2f11cf){_0x19131f['push'](_0x19131f['shift']());}};_0x2636e4(++_0x379191);}(_0xcca1,0xf4));var _0x1cca=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcca1[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x1cca('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x1cca('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1cca('0x2'),'afterUpdate':_0x1cca('0x3'),'afterDestroy':_0x1cca('0x4')};function emitEvent(_0x18ae1f){return function(_0x694ce0,_0x23f58d,_0x3dd34b){MailQueueEvents[_0x1cca('0x5')](_0x18ae1f+':'+_0x694ce0['id'],_0x694ce0);MailQueueEvents[_0x1cca('0x5')](_0x18ae1f,_0x694ce0);_0x3dd34b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x1cca('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x26e1=['events','../../mysqldb','MailQueue','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x2610d8,_0x33a335){var _0x3b1863=function(_0x2fa3dc){while(--_0x2fa3dc){_0x2610d8['push'](_0x2610d8['shift']());}};_0x3b1863(++_0x33a335);}(_0x26e1,0x1e6));var _0x126e=function(_0x2ae5a4,_0x578104){_0x2ae5a4=_0x2ae5a4-0x0;var _0x4d01de=_0x26e1[_0x2ae5a4];return _0x4d01de;};'use strict';var EventEmitter=require(_0x126e('0x0'));var MailQueue=require(_0x126e('0x1'))['db'][_0x126e('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x126e('0x3')](0x0);var events={'afterCreate':_0x126e('0x4'),'afterUpdate':'update','afterDestroy':_0x126e('0x5')};function emitEvent(_0x24e729){return function(_0x5d9644,_0x3fceaf,_0x388648){MailQueueEvents[_0x126e('0x6')](_0x24e729+':'+_0x5d9644['id'],_0x5d9644);MailQueueEvents[_0x126e('0x6')](_0x24e729,_0x5d9644);_0x388648(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x126e('0x7')](e,emitEvent(event));}}module[_0x126e('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 441b765..314ca65 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 _0x4f1e=['./mailQueue.attributes','define','MailQueue','mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x6a8660,_0xdee20f){var _0x25eef7=function(_0x376ac3){while(--_0x376ac3){_0x6a8660['push'](_0x6a8660['shift']());}};_0x25eef7(++_0xdee20f);}(_0x4f1e,0xe1));var _0xe4f1=function(_0x29a2de,_0x4b086c){_0x29a2de=_0x29a2de-0x0;var _0xf02af6=_0x4f1e[_0x29a2de];return _0xf02af6;};'use strict';var _=require(_0xe4f1('0x0'));var util=require(_0xe4f1('0x1'));var logger=require(_0xe4f1('0x2'))('api');var moment=require(_0xe4f1('0x3'));var BPromise=require(_0xe4f1('0x4'));var rp=require(_0xe4f1('0x5'));var fs=require('fs');var path=require(_0xe4f1('0x6'));var rimraf=require(_0xe4f1('0x7'));var config=require(_0xe4f1('0x8'));var attributes=require(_0xe4f1('0x9'));module['exports']=function(_0xef753e,_0x1766cf){return _0xef753e[_0xe4f1('0xa')](_0xe4f1('0xb'),attributes,{'tableName':_0xe4f1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8279=['MailQueue','mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define'];(function(_0x4392a7,_0x569823){var _0x1da430=function(_0xb733a4){while(--_0xb733a4){_0x4392a7['push'](_0x4392a7['shift']());}};_0x1da430(++_0x569823);}(_0x8279,0x17c));var _0x9827=function(_0x316da4,_0x5a290f){_0x316da4=_0x316da4-0x0;var _0x32197b=_0x8279[_0x316da4];return _0x32197b;};'use strict';var _=require(_0x9827('0x0'));var util=require(_0x9827('0x1'));var logger=require(_0x9827('0x2'))('api');var moment=require(_0x9827('0x3'));var BPromise=require(_0x9827('0x4'));var rp=require(_0x9827('0x5'));var fs=require('fs');var path=require(_0x9827('0x6'));var rimraf=require(_0x9827('0x7'));var config=require(_0x9827('0x8'));var attributes=require(_0x9827('0x9'));module[_0x9827('0xa')]=function(_0x589531,_0x68fd7a){return _0x589531[_0x9827('0xb')](_0x9827('0xc'),attributes,{'tableName':_0x9827('0xd'),'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 d4f5879..aecfe13 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 _0x726e=['debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailQueue','findAll','options','raw','where','limit','include','model','attributes','map','GetMailQueue','ShowMailQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x5dce82,_0xaa5720){var _0x34e4d7=function(_0x4c2f95){while(--_0x4c2f95){_0x5dce82['push'](_0x5dce82['shift']());}};_0x34e4d7(++_0xaa5720);}(_0x726e,0x186));var _0xe726=function(_0x168b2b,_0x36f554){_0x168b2b=_0x168b2b-0x0;var _0x4dab49=_0x726e[_0x168b2b];return _0x4dab49;};'use strict';var _=require(_0xe726('0x0'));var util=require('util');var moment=require(_0xe726('0x1'));var BPromise=require(_0xe726('0x2'));var rs=require(_0xe726('0x3'));var fs=require('fs');var Redis=require(_0xe726('0x4'));var db=require(_0xe726('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe726('0x6'));var config=require(_0xe726('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe726('0x8')][_0xe726('0x9')]({'port':0x232a});config[_0xe726('0xa')]=_[_0xe726('0xb')](config[_0xe726('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe726('0xc'))(new Redis(config[_0xe726('0xa')]));require(_0xe726('0xd'))[_0xe726('0xe')](socket);function respondWithRpcPromise(_0xfac8a8,_0x3171de,_0x5190ee){return new BPromise(function(_0x4f5125,_0x4c8880){return client[_0xe726('0xf')](_0xfac8a8,_0x5190ee)[_0xe726('0x10')](function(_0x40e9af){logger[_0xe726('0x11')](_0xe726('0x12'),_0x3171de,_0xe726('0x13'));logger[_0xe726('0x14')](_0xe726('0x15'),_0x3171de,'request\x20sent',JSON[_0xe726('0x16')](_0x40e9af));if(_0x40e9af[_0xe726('0x17')]){if(_0x40e9af[_0xe726('0x17')][_0xe726('0x18')]===0x1f4){logger['error'](_0xe726('0x12'),_0x3171de,_0x40e9af[_0xe726('0x17')][_0xe726('0x19')]);return _0x4c8880(_0x40e9af[_0xe726('0x17')][_0xe726('0x19')]);}logger[_0xe726('0x17')](_0xe726('0x12'),_0x3171de,_0x40e9af['error'][_0xe726('0x19')]);return _0x4f5125(_0x40e9af[_0xe726('0x17')][_0xe726('0x19')]);}else{logger[_0xe726('0x11')](_0xe726('0x12'),_0x3171de,'request\x20sent');_0x4f5125(_0x40e9af[_0xe726('0x1a')][_0xe726('0x19')]);}})[_0xe726('0x1b')](function(_0x3d55a5){logger[_0xe726('0x17')](_0xe726('0x12'),_0x3171de,_0x3d55a5);_0x4c8880(_0x3d55a5);});});}exports['GetMailQueue']=function(_0x35216e){var _0x15a255=this;return new Promise(function(_0x378ad6,_0x1fce4c){return db[_0xe726('0x1c')][_0xe726('0x1d')]({'raw':_0x35216e[_0xe726('0x1e')]?_0x35216e[_0xe726('0x1e')][_0xe726('0x1f')]===undefined?!![]:![]:!![],'where':_0x35216e[_0xe726('0x1e')]?_0x35216e['options'][_0xe726('0x20')]||null:null,'attributes':_0x35216e[_0xe726('0x1e')]?_0x35216e[_0xe726('0x1e')]['attributes']||null:null,'limit':_0x35216e[_0xe726('0x1e')]?_0x35216e['options'][_0xe726('0x21')]||null:null,'include':_0x35216e[_0xe726('0x1e')]?_0x35216e[_0xe726('0x1e')][_0xe726('0x22')]?_['map'](_0x35216e[_0xe726('0x1e')][_0xe726('0x22')],function(_0x2ac054){return{'model':db[_0x2ac054[_0xe726('0x23')]],'as':_0x2ac054['as'],'attributes':_0x2ac054[_0xe726('0x24')],'include':_0x2ac054['include']?_[_0xe726('0x25')](_0x2ac054[_0xe726('0x22')],function(_0x445087){return{'model':db[_0x445087[_0xe726('0x23')]],'as':_0x445087['as'],'attributes':_0x445087['attributes'],'include':_0x445087[_0xe726('0x22')]?_['map'](_0x445087[_0xe726('0x22')],function(_0x46f287){return{'model':db[_0x46f287['model']],'as':_0x46f287['as'],'attributes':_0x46f287[_0xe726('0x24')]};}):[]};}):[]};}):[]:[]})[_0xe726('0x10')](function(_0x2781b6){logger[_0xe726('0x11')](_0xe726('0x26'),_0x35216e);logger[_0xe726('0x14')](_0xe726('0x26'),_0x35216e,JSON[_0xe726('0x16')](_0x2781b6));_0x378ad6(_0x2781b6);})[_0xe726('0x1b')](function(_0x94b859){logger[_0xe726('0x17')](_0xe726('0x26'),_0x94b859[_0xe726('0x19')],_0x35216e);_0x1fce4c(_0x15a255[_0xe726('0x17')](0x1f4,_0x94b859[_0xe726('0x19')]));});});};exports[_0xe726('0x27')]=function(_0x2ca717){var _0x38285a=this;return new Promise(function(_0x3b2bfa,_0x584165){return db[_0xe726('0x1c')][_0xe726('0x28')]({'raw':_0x2ca717['options']?_0x2ca717[_0xe726('0x1e')][_0xe726('0x1f')]===undefined?!![]:![]:!![],'where':_0x2ca717[_0xe726('0x1e')]?_0x2ca717[_0xe726('0x1e')][_0xe726('0x20')]||null:null,'attributes':_0x2ca717[_0xe726('0x1e')]?_0x2ca717['options'][_0xe726('0x24')]||null:null,'include':_0x2ca717[_0xe726('0x1e')]?_0x2ca717[_0xe726('0x1e')][_0xe726('0x22')]?_[_0xe726('0x25')](_0x2ca717[_0xe726('0x1e')][_0xe726('0x22')],function(_0x7f0417){return{'model':db[_0x7f0417[_0xe726('0x23')]],'as':_0x7f0417['as'],'attributes':_0x7f0417[_0xe726('0x24')],'include':_0x7f0417['include']?_[_0xe726('0x25')](_0x7f0417[_0xe726('0x22')],function(_0x42f8b8){return{'model':db[_0x42f8b8[_0xe726('0x23')]],'as':_0x42f8b8['as'],'attributes':_0x42f8b8[_0xe726('0x24')],'include':_0x42f8b8[_0xe726('0x22')]?_[_0xe726('0x25')](_0x42f8b8['include'],function(_0x566957){return{'model':db[_0x566957[_0xe726('0x23')]],'as':_0x566957['as'],'attributes':_0x566957[_0xe726('0x24')]};}):[]};}):[]};}):[]:[]})[_0xe726('0x10')](function(_0x536bdc){logger[_0xe726('0x11')](_0xe726('0x27'),_0x2ca717);logger[_0xe726('0x14')](_0xe726('0x27'),_0x2ca717,JSON[_0xe726('0x16')](_0x536bdc));_0x3b2bfa(_0x536bdc);})[_0xe726('0x1b')](function(_0x238625){logger[_0xe726('0x17')]('ShowMailQueue',_0x238625['message'],_0x2ca717);_0x584165(_0x38285a[_0xe726('0x17')](0x1f4,_0x238625['message']));});});}; \ No newline at end of file +var _0x9fcc=['catch','MailQueue','findAll','options','where','attributes','limit','include','map','model','GetMailQueue','find','raw','ShowMailQueue','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','request\x20sent','debug','stringify','error','MailQueue,\x20%s,\x20%s','message'];(function(_0x3cc8f2,_0x1ab97a){var _0x396625=function(_0x510d2b){while(--_0x510d2b){_0x3cc8f2['push'](_0x3cc8f2['shift']());}};_0x396625(++_0x1ab97a);}(_0x9fcc,0x146));var _0xc9fc=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9fcc[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xc9fc('0x0'));var util=require(_0xc9fc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc9fc('0x2'));var fs=require('fs');var Redis=require(_0xc9fc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9fc('0x4'));var logger=require(_0xc9fc('0x5'))('rpc');var config=require(_0xc9fc('0x6'));var jayson=require(_0xc9fc('0x7'));var client=jayson[_0xc9fc('0x8')][_0xc9fc('0x9')]({'port':0x232a});config[_0xc9fc('0xa')]=_[_0xc9fc('0xb')](config[_0xc9fc('0xa')],{'host':_0xc9fc('0xc'),'port':0x18eb});var socket=require(_0xc9fc('0xd'))(new Redis(config[_0xc9fc('0xa')]));require(_0xc9fc('0xe'))[_0xc9fc('0xf')](socket);function respondWithRpcPromise(_0x526391,_0x27a9fc,_0x34fe32){return new BPromise(function(_0x1874c8,_0x3ac2f8){return client[_0xc9fc('0x10')](_0x526391,_0x34fe32)[_0xc9fc('0x11')](function(_0x26706c){logger[_0xc9fc('0x12')]('MailQueue,\x20%s,\x20%s',_0x27a9fc,_0xc9fc('0x13'));logger[_0xc9fc('0x14')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x27a9fc,'request\x20sent',JSON[_0xc9fc('0x15')](_0x26706c));if(_0x26706c[_0xc9fc('0x16')]){if(_0x26706c[_0xc9fc('0x16')]['code']===0x1f4){logger['error'](_0xc9fc('0x17'),_0x27a9fc,_0x26706c[_0xc9fc('0x16')][_0xc9fc('0x18')]);return _0x3ac2f8(_0x26706c['error'][_0xc9fc('0x18')]);}logger[_0xc9fc('0x16')](_0xc9fc('0x17'),_0x27a9fc,_0x26706c[_0xc9fc('0x16')][_0xc9fc('0x18')]);return _0x1874c8(_0x26706c[_0xc9fc('0x16')]['message']);}else{logger[_0xc9fc('0x12')]('MailQueue,\x20%s,\x20%s',_0x27a9fc,'request\x20sent');_0x1874c8(_0x26706c['result']['message']);}})[_0xc9fc('0x19')](function(_0x14c214){logger[_0xc9fc('0x16')](_0xc9fc('0x17'),_0x27a9fc,_0x14c214);_0x3ac2f8(_0x14c214);});});}exports['GetMailQueue']=function(_0x1bdd96){var _0x53404e=this;return new Promise(function(_0xc547e3,_0x3fec01){return db[_0xc9fc('0x1a')][_0xc9fc('0x1b')]({'raw':_0x1bdd96[_0xc9fc('0x1c')]?_0x1bdd96[_0xc9fc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1bdd96[_0xc9fc('0x1c')]?_0x1bdd96['options'][_0xc9fc('0x1d')]||null:null,'attributes':_0x1bdd96['options']?_0x1bdd96[_0xc9fc('0x1c')][_0xc9fc('0x1e')]||null:null,'limit':_0x1bdd96[_0xc9fc('0x1c')]?_0x1bdd96[_0xc9fc('0x1c')][_0xc9fc('0x1f')]||null:null,'include':_0x1bdd96[_0xc9fc('0x1c')]?_0x1bdd96['options'][_0xc9fc('0x20')]?_[_0xc9fc('0x21')](_0x1bdd96[_0xc9fc('0x1c')]['include'],function(_0x2172ac){return{'model':db[_0x2172ac['model']],'as':_0x2172ac['as'],'attributes':_0x2172ac[_0xc9fc('0x1e')],'include':_0x2172ac['include']?_[_0xc9fc('0x21')](_0x2172ac[_0xc9fc('0x20')],function(_0x11e124){return{'model':db[_0x11e124[_0xc9fc('0x22')]],'as':_0x11e124['as'],'attributes':_0x11e124[_0xc9fc('0x1e')],'include':_0x11e124[_0xc9fc('0x20')]?_[_0xc9fc('0x21')](_0x11e124[_0xc9fc('0x20')],function(_0x1de8b0){return{'model':db[_0x1de8b0['model']],'as':_0x1de8b0['as'],'attributes':_0x1de8b0[_0xc9fc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc9fc('0x11')](function(_0x49dc64){logger[_0xc9fc('0x12')](_0xc9fc('0x23'),_0x1bdd96);logger['debug']('GetMailQueue',_0x1bdd96,JSON[_0xc9fc('0x15')](_0x49dc64));_0xc547e3(_0x49dc64);})['catch'](function(_0x58cac0){logger[_0xc9fc('0x16')]('GetMailQueue',_0x58cac0[_0xc9fc('0x18')],_0x1bdd96);_0x3fec01(_0x53404e[_0xc9fc('0x16')](0x1f4,_0x58cac0['message']));});});};exports['ShowMailQueue']=function(_0x2ba210){var _0x24af13=this;return new Promise(function(_0x409430,_0x594d17){return db[_0xc9fc('0x1a')][_0xc9fc('0x24')]({'raw':_0x2ba210[_0xc9fc('0x1c')]?_0x2ba210[_0xc9fc('0x1c')][_0xc9fc('0x25')]===undefined?!![]:![]:!![],'where':_0x2ba210[_0xc9fc('0x1c')]?_0x2ba210[_0xc9fc('0x1c')][_0xc9fc('0x1d')]||null:null,'attributes':_0x2ba210[_0xc9fc('0x1c')]?_0x2ba210['options'][_0xc9fc('0x1e')]||null:null,'include':_0x2ba210[_0xc9fc('0x1c')]?_0x2ba210[_0xc9fc('0x1c')][_0xc9fc('0x20')]?_[_0xc9fc('0x21')](_0x2ba210[_0xc9fc('0x1c')]['include'],function(_0x19517f){return{'model':db[_0x19517f[_0xc9fc('0x22')]],'as':_0x19517f['as'],'attributes':_0x19517f['attributes'],'include':_0x19517f[_0xc9fc('0x20')]?_['map'](_0x19517f['include'],function(_0x2e9e40){return{'model':db[_0x2e9e40[_0xc9fc('0x22')]],'as':_0x2e9e40['as'],'attributes':_0x2e9e40['attributes'],'include':_0x2e9e40[_0xc9fc('0x20')]?_[_0xc9fc('0x21')](_0x2e9e40[_0xc9fc('0x20')],function(_0x4ac64e){return{'model':db[_0x4ac64e[_0xc9fc('0x22')]],'as':_0x4ac64e['as'],'attributes':_0x4ac64e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x33e4d5){logger['info'](_0xc9fc('0x26'),_0x2ba210);logger[_0xc9fc('0x14')](_0xc9fc('0x26'),_0x2ba210,JSON[_0xc9fc('0x15')](_0x33e4d5));_0x409430(_0x33e4d5);})['catch'](function(_0x3bbd03){logger[_0xc9fc('0x16')]('ShowMailQueue',_0x3bbd03[_0xc9fc('0x18')],_0x2ba210);_0x594d17(_0x24af13[_0xc9fc('0x16')](0x1f4,_0x3bbd03[_0xc9fc('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 7517f91..6126c1a 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 _0xe6d7=['save','update','register','length','mailQueue:'];(function(_0x357fa0,_0x1cd5ee){var _0x16edd2=function(_0x2fa6fa){while(--_0x2fa6fa){_0x357fa0['push'](_0x357fa0['shift']());}};_0x16edd2(++_0x1cd5ee);}(_0xe6d7,0x1ae));var _0x7e6d=function(_0x8267aa,_0x496ef0){_0x8267aa=_0x8267aa-0x0;var _0x2a437f=_0xe6d7[_0x8267aa];return _0x2a437f;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x7e6d('0x0'),'remove',_0x7e6d('0x1')];function createListener(_0x22c8d2,_0x186417){return function(_0x168ae7){_0x186417['emit'](_0x22c8d2,_0x168ae7);};}function removeListener(_0xcef693,_0x4edd64){return function(){MailQueueEvents['removeListener'](_0xcef693,_0x4edd64);};}exports[_0x7e6d('0x2')]=function(_0x23c09e){for(var _0x4faafe=0x0,_0x344697=events[_0x7e6d('0x3')];_0x4faafe<_0x344697;_0x4faafe++){var _0x3a7cfe=events[_0x4faafe];var _0x30eb06=createListener(_0x7e6d('0x4')+_0x3a7cfe,_0x23c09e);MailQueueEvents['on'](_0x3a7cfe,_0x30eb06);}}; \ No newline at end of file +var _0xda5b=['update','emit','removeListener','length','mailQueue:','./mailQueue.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda5b,0x12d));var _0xbda5=function(_0x5534ce,_0x26ef5e){_0x5534ce=_0x5534ce-0x0;var _0x33042b=_0xda5b[_0x5534ce];return _0x33042b;};'use strict';var MailQueueEvents=require(_0xbda5('0x0'));var events=[_0xbda5('0x1'),_0xbda5('0x2'),_0xbda5('0x3')];function createListener(_0x5de962,_0x12ba72){return function(_0x583278){_0x12ba72[_0xbda5('0x4')](_0x5de962,_0x583278);};}function removeListener(_0x2046ca,_0x3a15f6){return function(){MailQueueEvents[_0xbda5('0x5')](_0x2046ca,_0x3a15f6);};}exports['register']=function(_0x201ebf){for(var _0x496fd0=0x0,_0x37028f=events[_0xbda5('0x6')];_0x496fd0<_0x37028f;_0x496fd0++){var _0x2969ec=events[_0x496fd0];var _0x209ee9=createListener(_0xbda5('0x7')+_0x2969ec,_0x201ebf);MailQueueEvents['on'](_0x2969ec,_0x209ee9);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 042b171..75b245d 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 _0x1d69=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','index','get','describe','isAuthenticated','post'];(function(_0x507acf,_0x5963cc){var _0x3e6303=function(_0x1f9c23){while(--_0x1f9c23){_0x507acf['push'](_0x507acf['shift']());}};_0x3e6303(++_0x5963cc);}(_0x1d69,0x18e));var _0x91d6=function(_0x324e86,_0x81b1cb){_0x324e86=_0x324e86-0x0;var _0x592846=_0x1d69[_0x324e86];return _0x592846;};'use strict';var multer=require(_0x91d6('0x0'));var util=require(_0x91d6('0x1'));var path=require(_0x91d6('0x2'));var timeout=require(_0x91d6('0x3'));var express=require(_0x91d6('0x4'));var router=express[_0x91d6('0x5')]();var fs_extra=require(_0x91d6('0x6'));var auth=require(_0x91d6('0x7'));var interaction=require(_0x91d6('0x8'));var config=require(_0x91d6('0x9'));var controller=require(_0x91d6('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x91d6('0xb')]);router[_0x91d6('0xc')]('/describe',auth['isAuthenticated'](),controller[_0x91d6('0xd')]);router[_0x91d6('0xc')]('/:id',auth[_0x91d6('0xe')](),controller['show']);router[_0x91d6('0xf')]('/',auth[_0x91d6('0xe')](),controller[_0x91d6('0x10')]);router[_0x91d6('0x11')](_0x91d6('0x12'),auth[_0x91d6('0xe')](),controller[_0x91d6('0x13')]);router[_0x91d6('0x14')](_0x91d6('0x12'),auth['isAuthenticated'](),controller[_0x91d6('0x15')]);module[_0x91d6('0x16')]=router; \ No newline at end of file +var _0x852e=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x2fe4e6,_0x39f94e){var _0x331d75=function(_0x346bdf){while(--_0x346bdf){_0x2fe4e6['push'](_0x2fe4e6['shift']());}};_0x331d75(++_0x39f94e);}(_0x852e,0x1e9));var _0xe852=function(_0xaaac03,_0xf62031){_0xaaac03=_0xaaac03-0x0;var _0x29ca10=_0x852e[_0xaaac03];return _0x29ca10;};'use strict';var multer=require(_0xe852('0x0'));var util=require(_0xe852('0x1'));var path=require(_0xe852('0x2'));var timeout=require(_0xe852('0x3'));var express=require(_0xe852('0x4'));var router=express[_0xe852('0x5')]();var fs_extra=require(_0xe852('0x6'));var auth=require(_0xe852('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe852('0x8'));var controller=require(_0xe852('0x9'));router[_0xe852('0xa')]('/',auth[_0xe852('0xb')](),controller[_0xe852('0xc')]);router[_0xe852('0xa')](_0xe852('0xd'),auth[_0xe852('0xb')](),controller[_0xe852('0xe')]);router[_0xe852('0xa')](_0xe852('0xf'),auth[_0xe852('0xb')](),controller['show']);router[_0xe852('0x10')]('/',auth['isAuthenticated'](),controller[_0xe852('0x11')]);router[_0xe852('0x12')](_0xe852('0xf'),auth[_0xe852('0xb')](),controller[_0xe852('0x13')]);router[_0xe852('0x14')](_0xe852('0xf'),auth[_0xe852('0xb')](),controller[_0xe852('0x15')]);module[_0xe852('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 195372b..7d71613 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 _0xea1b=['DATE','moment','sequelize','exports','STRING'];(function(_0x2e834c,_0x261302){var _0x2f58e5=function(_0x2ab464){while(--_0x2ab464){_0x2e834c['push'](_0x2e834c['shift']());}};_0x2f58e5(++_0x261302);}(_0xea1b,0xd8));var _0xbea1=function(_0x5b3dfb,_0x1b629c){_0x5b3dfb=_0x5b3dfb-0x0;var _0x503711=_0xea1b[_0x5b3dfb];return _0x503711;};'use strict';var moment=require(_0xbea1('0x0'));var Sequelize=require(_0xbea1('0x1'));module[_0xbea1('0x2')]={'uniqueid':{'type':Sequelize[_0xbea1('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xbea1('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xbea1('0x4')]},'acceptAt':{'type':Sequelize[_0xbea1('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x79e5=['moment','sequelize','STRING','DATE'];(function(_0x2fe618,_0x35215b){var _0x3ec99b=function(_0x4c3237){while(--_0x4c3237){_0x2fe618['push'](_0x2fe618['shift']());}};_0x3ec99b(++_0x35215b);}(_0x79e5,0x164));var _0x579e=function(_0x746eba,_0x1d5f6c){_0x746eba=_0x746eba-0x0;var _0x3e9586=_0x79e5[_0x746eba];return _0x3e9586;};'use strict';var moment=require(_0x579e('0x0'));var Sequelize=require(_0x579e('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x579e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x579e('0x2')]},'joinAt':{'type':Sequelize[_0x579e('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x579e('0x3')]},'exitAt':{'type':Sequelize[_0x579e('0x3')]},'reason':{'type':Sequelize[_0x579e('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index e8f7391..bed6988 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 _0x77e6=['rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','catch','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','end','stack','name','send','index','map','MailQueueReport'];(function(_0xc32348,_0x410be7){var _0x4f07e1=function(_0xdd8f8e){while(--_0xdd8f8e){_0xc32348['push'](_0xc32348['shift']());}};_0x4f07e1(++_0x410be7);}(_0x77e6,0x1a6));var _0x677e=function(_0x38bd9d,_0x30bbac){_0x38bd9d=_0x38bd9d-0x0;var _0x5c1212=_0x77e6[_0x38bd9d];return _0x5c1212;};'use strict';var emlformat=require(_0x677e('0x0'));var rimraf=require(_0x677e('0x1'));var zipdir=require(_0x677e('0x2'));var jsonpatch=require(_0x677e('0x3'));var rp=require(_0x677e('0x4'));var moment=require(_0x677e('0x5'));var BPromise=require(_0x677e('0x6'));var Mustache=require(_0x677e('0x7'));var util=require('util');var path=require(_0x677e('0x8'));var sox=require(_0x677e('0x9'));var csv=require('to-csv');var ejs=require(_0x677e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x677e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x677e('0xc'));var deskjs=require(_0x677e('0xd'));var toCsv=require(_0x677e('0xe'));var querystring=require(_0x677e('0xf'));var Papa=require('papaparse');var Redis=require(_0x677e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x677e('0x11'));var as=require(_0x677e('0x12'));var hardwareService=require(_0x677e('0x13'));var logger=require(_0x677e('0x14'))(_0x677e('0x15'));var utils=require(_0x677e('0x16'));var config=require(_0x677e('0x17'));var licenseUtil=require(_0x677e('0x18'));var db=require(_0x677e('0x19'))['db'];function respondWithStatusCode(_0x46a67e,_0x366490){_0x366490=_0x366490||0xcc;return function(_0x2a5f95){if(_0x2a5f95){return _0x46a67e[_0x677e('0x1a')](_0x366490);}return _0x46a67e[_0x677e('0x1b')](_0x366490)['end']();};}function respondWithResult(_0x512631,_0x5c7351){_0x5c7351=_0x5c7351||0xc8;return function(_0x213a50){if(_0x213a50){return _0x512631[_0x677e('0x1b')](_0x5c7351)[_0x677e('0x1c')](_0x213a50);}};}function respondWithFilteredResult(_0x36e976,_0x4daa04){return function(_0x42d0c3){if(_0x42d0c3){var _0x24c9eb=typeof _0x4daa04[_0x677e('0x1d')]===_0x677e('0x1e')&&typeof _0x4daa04[_0x677e('0x1f')]===_0x677e('0x1e');var _0xe4d960=_0x42d0c3['count'];var _0x1c5124=_0x24c9eb?0x0:_0x4daa04[_0x677e('0x1d')];var _0x385b06=_0x24c9eb?_0x42d0c3[_0x677e('0x20')]:_0x4daa04[_0x677e('0x1d')]+_0x4daa04[_0x677e('0x1f')];var _0x52f65d;if(_0x385b06>=_0xe4d960){_0x385b06=_0xe4d960;_0x52f65d=0xc8;}else{_0x52f65d=0xce;}_0x36e976[_0x677e('0x1b')](_0x52f65d);return _0x36e976['set'](_0x677e('0x21'),_0x1c5124+'-'+_0x385b06+'/'+_0xe4d960)[_0x677e('0x1c')](_0x42d0c3);}return null;};}function patchUpdates(_0x26e9c5){return function(_0x593aed){try{jsonpatch[_0x677e('0x22')](_0x593aed,_0x26e9c5,!![]);}catch(_0x1a6122){return BPromise[_0x677e('0x23')](_0x1a6122);}return _0x593aed[_0x677e('0x24')]();};}function saveUpdates(_0x295964,_0x8732e0){return function(_0x3a7895){if(_0x3a7895){return _0x3a7895['update'](_0x295964)['then'](function(_0x52d915){return _0x52d915;});}return null;};}function removeEntity(_0x357466,_0x154fce){return function(_0x31a1e4){if(_0x31a1e4){return _0x31a1e4[_0x677e('0x25')]()[_0x677e('0x26')](function(){_0x357466[_0x677e('0x1b')](0xcc)[_0x677e('0x27')]();});}};}function handleEntityNotFound(_0x42f2b8,_0x2c51d3){return function(_0x3f0646){if(!_0x3f0646){_0x42f2b8['sendStatus'](0x194);}return _0x3f0646;};}function handleError(_0x5f0ba2,_0x3d3370){_0x3d3370=_0x3d3370||0x1f4;return function(_0x184f68){logger['error'](_0x184f68[_0x677e('0x28')]);if(_0x184f68[_0x677e('0x29')]){delete _0x184f68[_0x677e('0x29')];}_0x5f0ba2[_0x677e('0x1b')](_0x3d3370)[_0x677e('0x2a')](_0x184f68);};}exports[_0x677e('0x2b')]=function(_0x56ad40,_0xcd4646){var _0x2a6033={},_0xeca8e2={},_0x1e2694={'count':0x0,'rows':[]};var _0x22e44c=_[_0x677e('0x2c')](db[_0x677e('0x2d')][_0x677e('0x2e')],function(_0x9d49b5){return{'name':_0x9d49b5['fieldName'],'type':_0x9d49b5[_0x677e('0x2f')][_0x677e('0x30')]};});_0xeca8e2[_0x677e('0x31')]=_[_0x677e('0x2c')](_0x22e44c,_0x677e('0x29'));_0xeca8e2[_0x677e('0x32')]=_[_0x677e('0x33')](_0x56ad40[_0x677e('0x32')]);_0xeca8e2[_0x677e('0x34')]=_[_0x677e('0x35')](_0xeca8e2['model'],_0xeca8e2[_0x677e('0x32')]);_0x2a6033[_0x677e('0x36')]=_[_0x677e('0x35')](_0xeca8e2[_0x677e('0x31')],qs[_0x677e('0x37')](_0x56ad40[_0x677e('0x32')]['fields']));_0x2a6033[_0x677e('0x36')]=_0x2a6033[_0x677e('0x36')][_0x677e('0x38')]?_0x2a6033['attributes']:_0xeca8e2[_0x677e('0x31')];if(!_0x56ad40[_0x677e('0x32')][_0x677e('0x39')](_0x677e('0x3a'))){_0x2a6033[_0x677e('0x1f')]=qs['limit'](_0x56ad40[_0x677e('0x32')][_0x677e('0x1f')]);_0x2a6033[_0x677e('0x1d')]=qs[_0x677e('0x1d')](_0x56ad40['query'][_0x677e('0x1d')]);}_0x2a6033[_0x677e('0x3b')]=qs[_0x677e('0x3c')](_0x56ad40['query']['sort']);_0x2a6033[_0x677e('0x3d')]=qs[_0x677e('0x34')](_['pick'](_0x56ad40[_0x677e('0x32')],_0xeca8e2[_0x677e('0x34')]),_0x22e44c);if(_0x56ad40['query']['filter']){_0x2a6033[_0x677e('0x3d')]=_[_0x677e('0x3e')](_0x2a6033['where'],{'$or':_['map'](_0x22e44c,function(_0x42ce2c){if(_0x42ce2c[_0x677e('0x2f')]!==_0x677e('0x3f')){var _0x5bb080={};_0x5bb080[_0x42ce2c[_0x677e('0x29')]]={'$like':'%'+_0x56ad40[_0x677e('0x32')][_0x677e('0x40')]+'%'};return _0x5bb080;}})});}_0x2a6033=_[_0x677e('0x3e')]({},_0x2a6033,_0x56ad40[_0x677e('0x41')]);var _0x4b34fa={'where':_0x2a6033['where']};return db[_0x677e('0x2d')][_0x677e('0x20')](_0x4b34fa)[_0x677e('0x26')](function(_0x1db5b4){_0x1e2694[_0x677e('0x20')]=_0x1db5b4;if(_0x56ad40[_0x677e('0x32')][_0x677e('0x42')]){_0x2a6033[_0x677e('0x43')]=[{'all':!![]}];}return db[_0x677e('0x2d')][_0x677e('0x44')](_0x2a6033);})['then'](function(_0x56eb30){_0x1e2694[_0x677e('0x45')]=_0x56eb30;return _0x1e2694;})[_0x677e('0x26')](respondWithFilteredResult(_0xcd4646,_0x2a6033))['catch'](handleError(_0xcd4646,null));};exports[_0x677e('0x46')]=function(_0x511125,_0x16362e){var _0x29b9c0={'raw':!![],'where':{'id':_0x511125[_0x677e('0x47')]['id']}},_0x283aaa={};_0x283aaa[_0x677e('0x31')]=_[_0x677e('0x33')](db['MailQueueReport'][_0x677e('0x2e')]);_0x283aaa[_0x677e('0x32')]=_[_0x677e('0x33')](_0x511125[_0x677e('0x32')]);_0x283aaa[_0x677e('0x34')]=_[_0x677e('0x35')](_0x283aaa['model'],_0x283aaa[_0x677e('0x32')]);_0x29b9c0['attributes']=_[_0x677e('0x35')](_0x283aaa[_0x677e('0x31')],qs[_0x677e('0x37')](_0x511125[_0x677e('0x32')][_0x677e('0x37')]));_0x29b9c0[_0x677e('0x36')]=_0x29b9c0[_0x677e('0x36')][_0x677e('0x38')]?_0x29b9c0[_0x677e('0x36')]:_0x283aaa[_0x677e('0x31')];if(_0x511125['query'][_0x677e('0x42')]){_0x29b9c0['include']=[{'all':!![]}];}_0x29b9c0=_['merge']({},_0x29b9c0,_0x511125[_0x677e('0x41')]);return db[_0x677e('0x2d')][_0x677e('0x48')](_0x29b9c0)[_0x677e('0x26')](handleEntityNotFound(_0x16362e,null))[_0x677e('0x26')](respondWithResult(_0x16362e,null))['catch'](handleError(_0x16362e,null));};exports[_0x677e('0x49')]=function(_0x136b77,_0x3cb653){return db[_0x677e('0x2d')][_0x677e('0x49')](_0x136b77['body'],{})[_0x677e('0x26')](respondWithResult(_0x3cb653,0xc9))[_0x677e('0x4a')](handleError(_0x3cb653,null));};exports[_0x677e('0x4b')]=function(_0x496627,_0x30ed5c){if(_0x496627['body']['id']){delete _0x496627[_0x677e('0x4c')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x496627[_0x677e('0x47')]['id']}})[_0x677e('0x26')](handleEntityNotFound(_0x30ed5c,null))[_0x677e('0x26')](saveUpdates(_0x496627[_0x677e('0x4c')],null))['then'](respondWithResult(_0x30ed5c,null))[_0x677e('0x4a')](handleError(_0x30ed5c,null));};exports[_0x677e('0x25')]=function(_0x51b2b8,_0x5e93e9){return db[_0x677e('0x2d')][_0x677e('0x48')]({'where':{'id':_0x51b2b8[_0x677e('0x47')]['id']}})[_0x677e('0x26')](handleEntityNotFound(_0x5e93e9,null))['then'](removeEntity(_0x5e93e9,null))[_0x677e('0x4a')](handleError(_0x5e93e9,null));};exports['describe']=function(_0x5404a1,_0x3bb4d8){return db['MailQueueReport'][_0x677e('0x4d')]()[_0x677e('0x26')](respondWithResult(_0x3bb4d8,null))[_0x677e('0x4a')](handleError(_0x3bb4d8,null));}; \ No newline at end of file +var _0xbbbc=['query','intersection','fields','attributes','length','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','filters','includeAll','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x41f03b,_0x313c0d){_0x41f03b=_0x41f03b-0x0;var _0x4a1431=_0xbbbc[_0x41f03b];return _0x4a1431;};'use strict';var emlformat=require(_0xcbbb('0x0'));var rimraf=require(_0xcbbb('0x1'));var zipdir=require(_0xcbbb('0x2'));var jsonpatch=require(_0xcbbb('0x3'));var rp=require(_0xcbbb('0x4'));var moment=require(_0xcbbb('0x5'));var BPromise=require(_0xcbbb('0x6'));var Mustache=require('mustache');var util=require(_0xcbbb('0x7'));var path=require(_0xcbbb('0x8'));var sox=require(_0xcbbb('0x9'));var csv=require(_0xcbbb('0xa'));var ejs=require(_0xcbbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbbb('0xc'));var squel=require(_0xcbbb('0xd'));var crypto=require(_0xcbbb('0xe'));var jsforce=require(_0xcbbb('0xf'));var deskjs=require(_0xcbbb('0x10'));var toCsv=require(_0xcbbb('0xa'));var querystring=require(_0xcbbb('0x11'));var Papa=require('papaparse');var Redis=require(_0xcbbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbbb('0x14'))('api');var utils=require(_0xcbbb('0x15'));var config=require(_0xcbbb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbbb('0x17'))['db'];function respondWithStatusCode(_0x53e651,_0x56f81){_0x56f81=_0x56f81||0xcc;return function(_0x523c50){if(_0x523c50){return _0x53e651[_0xcbbb('0x18')](_0x56f81);}return _0x53e651[_0xcbbb('0x19')](_0x56f81)[_0xcbbb('0x1a')]();};}function respondWithResult(_0x47ea6a,_0x27ba56){_0x27ba56=_0x27ba56||0xc8;return function(_0x3ff767){if(_0x3ff767){return _0x47ea6a[_0xcbbb('0x19')](_0x27ba56)[_0xcbbb('0x1b')](_0x3ff767);}};}function respondWithFilteredResult(_0x47e679,_0x5af226){return function(_0x1bba39){if(_0x1bba39){var _0x30297d=typeof _0x5af226[_0xcbbb('0x1c')]===_0xcbbb('0x1d')&&typeof _0x5af226['limit']===_0xcbbb('0x1d');var _0x4ff973=_0x1bba39[_0xcbbb('0x1e')];var _0x3436af=_0x30297d?0x0:_0x5af226[_0xcbbb('0x1c')];var _0x5052df=_0x30297d?_0x1bba39['count']:_0x5af226['offset']+_0x5af226[_0xcbbb('0x1f')];var _0x3ae91b;if(_0x5052df>=_0x4ff973){_0x5052df=_0x4ff973;_0x3ae91b=0xc8;}else{_0x3ae91b=0xce;}_0x47e679[_0xcbbb('0x19')](_0x3ae91b);return _0x47e679[_0xcbbb('0x20')](_0xcbbb('0x21'),_0x3436af+'-'+_0x5052df+'/'+_0x4ff973)[_0xcbbb('0x1b')](_0x1bba39);}return null;};}function patchUpdates(_0x45de5f){return function(_0x2be36c){try{jsonpatch[_0xcbbb('0x22')](_0x2be36c,_0x45de5f,!![]);}catch(_0x2d4335){return BPromise['reject'](_0x2d4335);}return _0x2be36c[_0xcbbb('0x23')]();};}function saveUpdates(_0xe07b0,_0x159c62){return function(_0x42aaf1){if(_0x42aaf1){return _0x42aaf1[_0xcbbb('0x24')](_0xe07b0)[_0xcbbb('0x25')](function(_0x297eae){return _0x297eae;});}return null;};}function removeEntity(_0xabb565,_0x3ca570){return function(_0x5e3970){if(_0x5e3970){return _0x5e3970[_0xcbbb('0x26')]()[_0xcbbb('0x25')](function(){_0xabb565['status'](0xcc)[_0xcbbb('0x1a')]();});}};}function handleEntityNotFound(_0x4ffa80,_0x48dfc4){return function(_0x575d56){if(!_0x575d56){_0x4ffa80[_0xcbbb('0x18')](0x194);}return _0x575d56;};}function handleError(_0x548440,_0x59c422){_0x59c422=_0x59c422||0x1f4;return function(_0x5499a1){logger[_0xcbbb('0x27')](_0x5499a1['stack']);if(_0x5499a1['name']){delete _0x5499a1[_0xcbbb('0x28')];}_0x548440[_0xcbbb('0x19')](_0x59c422)[_0xcbbb('0x29')](_0x5499a1);};}exports[_0xcbbb('0x2a')]=function(_0x372024,_0x39ba8b){var _0x3d4c0d={},_0x1c986d={},_0x2a023f={'count':0x0,'rows':[]};var _0x26c05e=_[_0xcbbb('0x2b')](db[_0xcbbb('0x2c')][_0xcbbb('0x2d')],function(_0x1ce741){return{'name':_0x1ce741[_0xcbbb('0x2e')],'type':_0x1ce741[_0xcbbb('0x2f')][_0xcbbb('0x30')]};});_0x1c986d[_0xcbbb('0x31')]=_['map'](_0x26c05e,_0xcbbb('0x28'));_0x1c986d[_0xcbbb('0x32')]=_['keys'](_0x372024[_0xcbbb('0x32')]);_0x1c986d['filters']=_[_0xcbbb('0x33')](_0x1c986d[_0xcbbb('0x31')],_0x1c986d[_0xcbbb('0x32')]);_0x3d4c0d['attributes']=_[_0xcbbb('0x33')](_0x1c986d[_0xcbbb('0x31')],qs[_0xcbbb('0x34')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x34')]));_0x3d4c0d[_0xcbbb('0x35')]=_0x3d4c0d[_0xcbbb('0x35')][_0xcbbb('0x36')]?_0x3d4c0d[_0xcbbb('0x35')]:_0x1c986d[_0xcbbb('0x31')];if(!_0x372024['query']['hasOwnProperty']('nolimit')){_0x3d4c0d['limit']=qs[_0xcbbb('0x1f')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x1f')]);_0x3d4c0d[_0xcbbb('0x1c')]=qs[_0xcbbb('0x1c')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x1c')]);}_0x3d4c0d[_0xcbbb('0x37')]=qs[_0xcbbb('0x38')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x38')]);_0x3d4c0d[_0xcbbb('0x39')]=qs['filters'](_['pick'](_0x372024[_0xcbbb('0x32')],_0x1c986d['filters']),_0x26c05e);if(_0x372024['query']['filter']){_0x3d4c0d[_0xcbbb('0x39')]=_[_0xcbbb('0x3a')](_0x3d4c0d[_0xcbbb('0x39')],{'$or':_[_0xcbbb('0x2b')](_0x26c05e,function(_0x38e59d){if(_0x38e59d[_0xcbbb('0x2f')]!==_0xcbbb('0x3b')){var _0x14c1a2={};_0x14c1a2[_0x38e59d[_0xcbbb('0x28')]]={'$like':'%'+_0x372024[_0xcbbb('0x32')][_0xcbbb('0x3c')]+'%'};return _0x14c1a2;}})});}_0x3d4c0d=_['merge']({},_0x3d4c0d,_0x372024[_0xcbbb('0x3d')]);var _0x55d349={'where':_0x3d4c0d[_0xcbbb('0x39')]};return db[_0xcbbb('0x2c')][_0xcbbb('0x1e')](_0x55d349)[_0xcbbb('0x25')](function(_0x433065){_0x2a023f[_0xcbbb('0x1e')]=_0x433065;if(_0x372024['query']['includeAll']){_0x3d4c0d['include']=[{'all':!![]}];}return db[_0xcbbb('0x2c')][_0xcbbb('0x3e')](_0x3d4c0d);})[_0xcbbb('0x25')](function(_0x162979){_0x2a023f[_0xcbbb('0x3f')]=_0x162979;return _0x2a023f;})[_0xcbbb('0x25')](respondWithFilteredResult(_0x39ba8b,_0x3d4c0d))[_0xcbbb('0x40')](handleError(_0x39ba8b,null));};exports['show']=function(_0x1a7799,_0x22076a){var _0x5550d2={'raw':!![],'where':{'id':_0x1a7799[_0xcbbb('0x41')]['id']}},_0x15b3bc={};_0x15b3bc[_0xcbbb('0x31')]=_[_0xcbbb('0x42')](db[_0xcbbb('0x2c')]['rawAttributes']);_0x15b3bc[_0xcbbb('0x32')]=_['keys'](_0x1a7799['query']);_0x15b3bc[_0xcbbb('0x43')]=_[_0xcbbb('0x33')](_0x15b3bc[_0xcbbb('0x31')],_0x15b3bc[_0xcbbb('0x32')]);_0x5550d2[_0xcbbb('0x35')]=_[_0xcbbb('0x33')](_0x15b3bc[_0xcbbb('0x31')],qs[_0xcbbb('0x34')](_0x1a7799[_0xcbbb('0x32')][_0xcbbb('0x34')]));_0x5550d2[_0xcbbb('0x35')]=_0x5550d2[_0xcbbb('0x35')][_0xcbbb('0x36')]?_0x5550d2[_0xcbbb('0x35')]:_0x15b3bc['model'];if(_0x1a7799[_0xcbbb('0x32')][_0xcbbb('0x44')]){_0x5550d2[_0xcbbb('0x45')]=[{'all':!![]}];}_0x5550d2=_[_0xcbbb('0x3a')]({},_0x5550d2,_0x1a7799['options']);return db['MailQueueReport']['find'](_0x5550d2)[_0xcbbb('0x25')](handleEntityNotFound(_0x22076a,null))[_0xcbbb('0x25')](respondWithResult(_0x22076a,null))[_0xcbbb('0x40')](handleError(_0x22076a,null));};exports[_0xcbbb('0x46')]=function(_0x146f37,_0x1ef25b){return db[_0xcbbb('0x2c')]['create'](_0x146f37[_0xcbbb('0x47')],{})[_0xcbbb('0x25')](respondWithResult(_0x1ef25b,0xc9))[_0xcbbb('0x40')](handleError(_0x1ef25b,null));};exports[_0xcbbb('0x24')]=function(_0x478c22,_0x3378cd){if(_0x478c22[_0xcbbb('0x47')]['id']){delete _0x478c22[_0xcbbb('0x47')]['id'];}return db[_0xcbbb('0x2c')]['find']({'where':{'id':_0x478c22['params']['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x3378cd,null))[_0xcbbb('0x25')](saveUpdates(_0x478c22[_0xcbbb('0x47')],null))['then'](respondWithResult(_0x3378cd,null))['catch'](handleError(_0x3378cd,null));};exports['destroy']=function(_0x189a40,_0x3070d9){return db['MailQueueReport'][_0xcbbb('0x48')]({'where':{'id':_0x189a40[_0xcbbb('0x41')]['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x3070d9,null))[_0xcbbb('0x25')](removeEntity(_0x3070d9,null))['catch'](handleError(_0x3070d9,null));};exports[_0xcbbb('0x49')]=function(_0x1e4bb0,_0x39640d){return db[_0xcbbb('0x2c')][_0xcbbb('0x49')]()[_0xcbbb('0x25')](respondWithResult(_0x39640d,null))[_0xcbbb('0x40')](handleError(_0x39640d,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index d0ed17a..b209b88 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 _0x7f3b=['../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7f3b,0x149));var _0xb7f3=function(_0x247da7,_0x689561){_0x247da7=_0x247da7-0x0;var _0x4366cb=_0x7f3b[_0x247da7];return _0x4366cb;};'use strict';var _=require(_0xb7f3('0x0'));var util=require('util');var logger=require(_0xb7f3('0x1'))(_0xb7f3('0x2'));var moment=require('moment');var BPromise=require(_0xb7f3('0x3'));var rp=require(_0xb7f3('0x4'));var fs=require('fs');var path=require(_0xb7f3('0x5'));var rimraf=require(_0xb7f3('0x6'));var config=require(_0xb7f3('0x7'));var attributes=require(_0xb7f3('0x8'));module[_0xb7f3('0x9')]=function(_0x24e8e2,_0x1c26d8){return _0x24e8e2[_0xb7f3('0xa')](_0xb7f3('0xb'),attributes,{'tableName':_0xb7f3('0xc'),'paranoid':![],'indexes':[{'name':_0xb7f3('0xd'),'fields':[_0xb7f3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2168=['path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x2168,0x112));var _0x8216=function(_0x3f8fc1,_0x485adb){_0x3f8fc1=_0x3f8fc1-0x0;var _0x5b5e8a=_0x2168[_0x3f8fc1];return _0x5b5e8a;};'use strict';var _=require(_0x8216('0x0'));var util=require(_0x8216('0x1'));var logger=require('../../config/logger')(_0x8216('0x2'));var moment=require(_0x8216('0x3'));var BPromise=require(_0x8216('0x4'));var rp=require(_0x8216('0x5'));var fs=require('fs');var path=require(_0x8216('0x6'));var rimraf=require(_0x8216('0x7'));var config=require(_0x8216('0x8'));var attributes=require(_0x8216('0x9'));module[_0x8216('0xa')]=function(_0x181e70,_0x32fb7b){return _0x181e70['define'](_0x8216('0xb'),attributes,{'tableName':_0x8216('0xc'),'paranoid':![],'indexes':[{'name':_0x8216('0xd'),'fields':[_0x8216('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 5d1c389..e673853 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x47cfcc,_0x1e693b){var _0x149870=function(_0xcba63a){while(--_0xcba63a){_0x47cfcc['push'](_0x47cfcc['shift']());}};_0x149870(++_0x1e693b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x441221,_0x166082){_0x441221=_0x441221-0x0;var _0x497e40=_0x5f2f[_0x441221];return _0x497e40;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file +var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2d95b1,_0x18e323){var _0x25b298=function(_0x3258b9){while(--_0x3258b9){_0x2d95b1['push'](_0x2d95b1['shift']());}};_0x25b298(++_0x18e323);}(_0x326f,0xd1));var _0xf326=function(_0x21e17c,_0x277d41){_0x21e17c=_0x21e17c-0x0;var _0x40a192=_0x326f[_0x21e17c];return _0x40a192;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 725a1a8..32716c2 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xf27a5d,_0x5a3b2f){var _0x217da7=function(_0x41f99c){while(--_0x41f99c){_0xf27a5d['push'](_0xf27a5d['shift']());}};_0x217da7(++_0x5a3b2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2e4b96,_0x37563d){var _0x4037da=function(_0x2f9be8){while(--_0x2f9be8){_0x2e4b96['push'](_0x2e4b96['shift']());}};_0x4037da(++_0x37563d);}(_0x70e0,0x17b));var _0x070e=function(_0x2f6f25,_0x234f20){_0x2f6f25=_0x2f6f25-0x0;var _0x4829a6=_0x70e0[_0x2f6f25];return _0x4829a6;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index bb30d13..403083a 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 _0x2b65=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x2b65,0x131));var _0x52b6=function(_0x4d7241,_0x32aa1f){_0x4d7241=_0x4d7241-0x0;var _0x59d9e2=_0x2b65[_0x4d7241];return _0x59d9e2;};'use strict';var Sequelize=require(_0x52b6('0x0'));module[_0x52b6('0x1')]={'description':{'type':Sequelize[_0x52b6('0x2')]},'host':{'type':Sequelize[_0x52b6('0x2')]},'authentication':{'type':Sequelize[_0x52b6('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x52b6('0x2')]},'password':{'type':Sequelize[_0x52b6('0x2')]},'port':{'type':Sequelize[_0x52b6('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x52b6('0x2')],'defaultValue':_0x52b6('0x5')},'connTimeout':{'type':Sequelize[_0x52b6('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x52b6('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x52b6('0x2')]}}; \ No newline at end of file +var _0xd64b=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x516f7c,_0x120dbc){var _0x5cda06=function(_0x4f38b6){while(--_0x4f38b6){_0x516f7c['push'](_0x516f7c['shift']());}};_0x5cda06(++_0x120dbc);}(_0xd64b,0xc1));var _0xbd64=function(_0x149221,_0x4099ad){_0x149221=_0x149221-0x0;var _0xb08d4f=_0xd64b[_0x149221];return _0xb08d4f;};'use strict';var Sequelize=require(_0xbd64('0x0'));module['exports']={'description':{'type':Sequelize[_0xbd64('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xbd64('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xbd64('0x1')]},'password':{'type':Sequelize[_0xbd64('0x1')]},'port':{'type':Sequelize[_0xbd64('0x3')]},'tls':{'type':Sequelize[_0xbd64('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xbd64('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index e4a3ddf..4a67713 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 _0x413a=['api','bluebird','request-promise','path','rimraf','../../config/environment','define','mail_servers_in','lodash','util'];(function(_0x55c4f3,_0x4e1c73){var _0x59bf4b=function(_0x2befea){while(--_0x2befea){_0x55c4f3['push'](_0x55c4f3['shift']());}};_0x59bf4b(++_0x4e1c73);}(_0x413a,0x15c));var _0xa413=function(_0x31a25d,_0x4ef649){_0x31a25d=_0x31a25d-0x0;var _0x393d04=_0x413a[_0x31a25d];return _0x393d04;};'use strict';var _=require(_0xa413('0x0'));var util=require(_0xa413('0x1'));var logger=require('../../config/logger')(_0xa413('0x2'));var moment=require('moment');var BPromise=require(_0xa413('0x3'));var rp=require(_0xa413('0x4'));var fs=require('fs');var path=require(_0xa413('0x5'));var rimraf=require(_0xa413('0x6'));var config=require(_0xa413('0x7'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0xa80fc,_0x3ac5f4){return _0xa80fc[_0xa413('0x8')]('MailServerIn',attributes,{'tableName':_0xa413('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0acd=['../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x30c7c5,_0x168208){var _0x29e24e=function(_0x427d3e){while(--_0x427d3e){_0x30c7c5['push'](_0x30c7c5['shift']());}};_0x29e24e(++_0x168208);}(_0x0acd,0x132));var _0xd0ac=function(_0x24b459,_0x29bcbc){_0x24b459=_0x24b459-0x0;var _0x2a3f6b=_0x0acd[_0x24b459];return _0x2a3f6b;};'use strict';var _=require('lodash');var util=require(_0xd0ac('0x0'));var logger=require(_0xd0ac('0x1'))('api');var moment=require(_0xd0ac('0x2'));var BPromise=require('bluebird');var rp=require(_0xd0ac('0x3'));var fs=require('fs');var path=require(_0xd0ac('0x4'));var rimraf=require(_0xd0ac('0x5'));var config=require(_0xd0ac('0x6'));var attributes=require(_0xd0ac('0x7'));module[_0xd0ac('0x8')]=function(_0x431419,_0x3b19da){return _0x431419[_0xd0ac('0x9')](_0xd0ac('0xa'),attributes,{'tableName':_0xd0ac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index f459a03..e87ebf6 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 _0xbe27=['message','GetMailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x2a7bcf,_0x1f75df){var _0xd610b3=function(_0x23532d){while(--_0x23532d){_0x2a7bcf['push'](_0x2a7bcf['shift']());}};_0xd610b3(++_0x1f75df);}(_0xbe27,0x12d));var _0x7be2=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbe27[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x7be2('0x0'));var moment=require(_0x7be2('0x1'));var BPromise=require('bluebird');var rs=require(_0x7be2('0x2'));var fs=require('fs');var Redis=require(_0x7be2('0x3'));var db=require(_0x7be2('0x4'))['db'];var utils=require(_0x7be2('0x5'));var logger=require(_0x7be2('0x6'))(_0x7be2('0x7'));var config=require(_0x7be2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7be2('0x9')][_0x7be2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb1c9b1,_0x4f9f02,_0x2ebc58){return new BPromise(function(_0x2e4036,_0x592aaf){return client[_0x7be2('0xb')](_0xb1c9b1,_0x2ebc58)[_0x7be2('0xc')](function(_0x1d1efe){logger[_0x7be2('0xd')](_0x7be2('0xe'),_0x4f9f02,_0x7be2('0xf'));logger[_0x7be2('0x10')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x4f9f02,'request\x20sent',JSON['stringify'](_0x1d1efe));if(_0x1d1efe[_0x7be2('0x11')]){if(_0x1d1efe[_0x7be2('0x11')][_0x7be2('0x12')]===0x1f4){logger[_0x7be2('0x11')]('MailServerIn,\x20%s,\x20%s',_0x4f9f02,_0x1d1efe[_0x7be2('0x11')]['message']);return _0x592aaf(_0x1d1efe[_0x7be2('0x11')][_0x7be2('0x13')]);}logger[_0x7be2('0x11')](_0x7be2('0xe'),_0x4f9f02,_0x1d1efe[_0x7be2('0x11')][_0x7be2('0x13')]);return _0x2e4036(_0x1d1efe[_0x7be2('0x11')]['message']);}else{logger[_0x7be2('0xd')](_0x7be2('0xe'),_0x4f9f02,_0x7be2('0xf'));_0x2e4036(_0x1d1efe['result'][_0x7be2('0x13')]);}})['catch'](function(_0x4e8e62){logger[_0x7be2('0x11')](_0x7be2('0xe'),_0x4f9f02,_0x4e8e62);_0x592aaf(_0x4e8e62);});});}exports[_0x7be2('0x14')]=function(_0x2b0b90){var _0x56f0f6=this;return new Promise(function(_0x1c3e76,_0x120285){return db['MailServerIn'][_0x7be2('0x15')]({'raw':_0x2b0b90[_0x7be2('0x16')]?_0x2b0b90[_0x7be2('0x16')][_0x7be2('0x17')]===undefined?!![]:![]:!![],'where':_0x2b0b90['options']?_0x2b0b90[_0x7be2('0x16')][_0x7be2('0x18')]||null:null,'attributes':_0x2b0b90[_0x7be2('0x16')]?_0x2b0b90[_0x7be2('0x16')][_0x7be2('0x19')]||null:null,'limit':_0x2b0b90[_0x7be2('0x16')]?_0x2b0b90[_0x7be2('0x16')][_0x7be2('0x1a')]||null:null,'include':_0x2b0b90[_0x7be2('0x16')]?_0x2b0b90[_0x7be2('0x16')][_0x7be2('0x1b')]?_[_0x7be2('0x1c')](_0x2b0b90[_0x7be2('0x16')][_0x7be2('0x1b')],function(_0x2a2eae){return{'model':db[_0x2a2eae[_0x7be2('0x1d')]],'as':_0x2a2eae['as'],'attributes':_0x2a2eae[_0x7be2('0x19')],'include':_0x2a2eae[_0x7be2('0x1b')]?_[_0x7be2('0x1c')](_0x2a2eae[_0x7be2('0x1b')],function(_0x5d2bf5){return{'model':db[_0x5d2bf5[_0x7be2('0x1d')]],'as':_0x5d2bf5['as'],'attributes':_0x5d2bf5[_0x7be2('0x19')],'include':_0x5d2bf5[_0x7be2('0x1b')]?_[_0x7be2('0x1c')](_0x5d2bf5['include'],function(_0x484aee){return{'model':db[_0x484aee[_0x7be2('0x1d')]],'as':_0x484aee['as'],'attributes':_0x484aee['attributes']};}):[]};}):[]};}):[]:[]})[_0x7be2('0xc')](function(_0x231d47){logger[_0x7be2('0xd')]('GetMailServerIn',_0x2b0b90);logger[_0x7be2('0x10')](_0x7be2('0x14'),_0x2b0b90,JSON[_0x7be2('0x1e')](_0x231d47));_0x1c3e76(_0x231d47);})[_0x7be2('0x1f')](function(_0x2b2e22){logger[_0x7be2('0x11')]('GetMailServerIn',_0x2b2e22[_0x7be2('0x13')],_0x2b0b90);_0x120285(_0x56f0f6['error'](0x1f4,_0x2b2e22[_0x7be2('0x13')]));});});}; \ No newline at end of file +var _0x3222=['info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','limit','map','include','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4e0a03,_0x5eb6b0){var _0x2478fc=function(_0x59afcc){while(--_0x59afcc){_0x4e0a03['push'](_0x4e0a03['shift']());}};_0x2478fc(++_0x5eb6b0);}(_0x3222,0x101));var _0x2322=function(_0x4a0e89,_0x57526e){_0x4a0e89=_0x4a0e89-0x0;var _0x536a15=_0x3222[_0x4a0e89];return _0x536a15;};'use strict';var _=require(_0x2322('0x0'));var util=require(_0x2322('0x1'));var moment=require(_0x2322('0x2'));var BPromise=require(_0x2322('0x3'));var rs=require(_0x2322('0x4'));var fs=require('fs');var Redis=require(_0x2322('0x5'));var db=require(_0x2322('0x6'))['db'];var utils=require(_0x2322('0x7'));var logger=require('../../config/logger')(_0x2322('0x8'));var config=require(_0x2322('0x9'));var jayson=require(_0x2322('0xa'));var client=jayson[_0x2322('0xb')][_0x2322('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x355205,_0x59c081,_0x2698d2){return new BPromise(function(_0x3646a3,_0x561f79){return client[_0x2322('0xd')](_0x355205,_0x2698d2)[_0x2322('0xe')](function(_0x39ff55){logger[_0x2322('0xf')](_0x2322('0x10'),_0x59c081,_0x2322('0x11'));logger[_0x2322('0x12')](_0x2322('0x13'),_0x59c081,_0x2322('0x11'),JSON['stringify'](_0x39ff55));if(_0x39ff55['error']){if(_0x39ff55[_0x2322('0x14')]['code']===0x1f4){logger[_0x2322('0x14')]('MailServerIn,\x20%s,\x20%s',_0x59c081,_0x39ff55[_0x2322('0x14')]['message']);return _0x561f79(_0x39ff55[_0x2322('0x14')]['message']);}logger['error'](_0x2322('0x10'),_0x59c081,_0x39ff55[_0x2322('0x14')][_0x2322('0x15')]);return _0x3646a3(_0x39ff55[_0x2322('0x14')][_0x2322('0x15')]);}else{logger[_0x2322('0xf')]('MailServerIn,\x20%s,\x20%s',_0x59c081,_0x2322('0x11'));_0x3646a3(_0x39ff55['result'][_0x2322('0x15')]);}})[_0x2322('0x16')](function(_0x21b49f){logger['error'](_0x2322('0x10'),_0x59c081,_0x21b49f);_0x561f79(_0x21b49f);});});}exports[_0x2322('0x17')]=function(_0x56f953){var _0x62f0e=this;return new Promise(function(_0x1c80d7,_0x1bdb1b){return db[_0x2322('0x18')][_0x2322('0x19')]({'raw':_0x56f953[_0x2322('0x1a')]?_0x56f953[_0x2322('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x56f953[_0x2322('0x1a')]?_0x56f953['options'][_0x2322('0x1b')]||null:null,'attributes':_0x56f953[_0x2322('0x1a')]?_0x56f953[_0x2322('0x1a')][_0x2322('0x1c')]||null:null,'limit':_0x56f953['options']?_0x56f953[_0x2322('0x1a')][_0x2322('0x1d')]||null:null,'include':_0x56f953[_0x2322('0x1a')]?_0x56f953[_0x2322('0x1a')]['include']?_[_0x2322('0x1e')](_0x56f953[_0x2322('0x1a')][_0x2322('0x1f')],function(_0xaf20fb){return{'model':db[_0xaf20fb[_0x2322('0x20')]],'as':_0xaf20fb['as'],'attributes':_0xaf20fb[_0x2322('0x1c')],'include':_0xaf20fb[_0x2322('0x1f')]?_[_0x2322('0x1e')](_0xaf20fb[_0x2322('0x1f')],function(_0x453fc1){return{'model':db[_0x453fc1['model']],'as':_0x453fc1['as'],'attributes':_0x453fc1[_0x2322('0x1c')],'include':_0x453fc1[_0x2322('0x1f')]?_[_0x2322('0x1e')](_0x453fc1['include'],function(_0x551636){return{'model':db[_0x551636[_0x2322('0x20')]],'as':_0x551636['as'],'attributes':_0x551636[_0x2322('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2322('0xe')](function(_0x4ca5a7){logger[_0x2322('0xf')](_0x2322('0x17'),_0x56f953);logger[_0x2322('0x12')](_0x2322('0x17'),_0x56f953,JSON[_0x2322('0x21')](_0x4ca5a7));_0x1c80d7(_0x4ca5a7);})[_0x2322('0x16')](function(_0x4b88fd){logger[_0x2322('0x14')](_0x2322('0x17'),_0x4b88fd[_0x2322('0x15')],_0x56f953);_0x1bdb1b(_0x62f0e[_0x2322('0x14')](0x1f4,_0x4b88fd['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 7ede9d2..7b6c197 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7a54,0x106));var _0x47a5=function(_0x28fd46,_0x3b4563){_0x28fd46=_0x28fd46-0x0;var _0x32292f=_0x7a54[_0x28fd46];return _0x32292f;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 37171aa..5d93cbc 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 _0xdf4d=['STRING','INTEGER','BOOLEAN','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xdf4d,0xcb));var _0xddf4=function(_0x120b1e,_0x4d2bec){_0x120b1e=_0x120b1e-0x0;var _0x186859=_0xdf4d[_0x120b1e];return _0x186859;};'use strict';var Sequelize=require('sequelize');module[_0xddf4('0x0')]={'description':{'type':Sequelize[_0xddf4('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xddf4('0x1')]},'pass':{'type':Sequelize[_0xddf4('0x1')]},'port':{'type':Sequelize[_0xddf4('0x2')]},'secure':{'type':Sequelize[_0xddf4('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xddf4('0x1')]},'authentication':{'type':Sequelize[_0xddf4('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1b38=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0x1b38,0x95));var _0x81b3=function(_0x4879b8,_0x55569f){_0x4879b8=_0x4879b8-0x0;var _0x34abae=_0x1b38[_0x4879b8];return _0x34abae;};'use strict';var Sequelize=require(_0x81b3('0x0'));module[_0x81b3('0x1')]={'description':{'type':Sequelize[_0x81b3('0x2')]},'host':{'type':Sequelize[_0x81b3('0x2')]},'user':{'type':Sequelize[_0x81b3('0x2')]},'pass':{'type':Sequelize[_0x81b3('0x2')]},'port':{'type':Sequelize[_0x81b3('0x3')]},'secure':{'type':Sequelize[_0x81b3('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x81b3('0x2')]},'authentication':{'type':Sequelize[_0x81b3('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 65d587b..f930462 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 _0xde35=['then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','keys','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','MailServerOut','count','includeAll','include','findAll','rows','params','length','options','find','create','body','catch','rimraf','zip-dir','request-promise','moment','bluebird','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','destroy'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0xde35,0x10a));var _0x5de3=function(_0x1b6148,_0x46553e){_0x1b6148=_0x1b6148-0x0;var _0x62bcf=_0xde35[_0x1b6148];return _0x62bcf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5de3('0x0'));var zipdir=require(_0x5de3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5de3('0x2'));var moment=require(_0x5de3('0x3'));var BPromise=require(_0x5de3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5de3('0x5'));var csv=require('to-csv');var ejs=require(_0x5de3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5de3('0x7'));var squel=require(_0x5de3('0x8'));var crypto=require(_0x5de3('0x9'));var jsforce=require(_0x5de3('0xa'));var deskjs=require(_0x5de3('0xb'));var toCsv=require(_0x5de3('0xc'));var querystring=require('querystring');var Papa=require(_0x5de3('0xd'));var Redis=require(_0x5de3('0xe'));var authService=require(_0x5de3('0xf'));var qs=require(_0x5de3('0x10'));var as=require(_0x5de3('0x11'));var hardwareService=require(_0x5de3('0x12'));var logger=require(_0x5de3('0x13'))('api');var utils=require(_0x5de3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5de3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x137966,_0x25ec0e){_0x25ec0e=_0x25ec0e||0xcc;return function(_0x331703){if(_0x331703){return _0x137966[_0x5de3('0x16')](_0x25ec0e);}return _0x137966[_0x5de3('0x17')](_0x25ec0e)['end']();};}function respondWithResult(_0x22394f,_0x2aa305){_0x2aa305=_0x2aa305||0xc8;return function(_0x51de9a){if(_0x51de9a){return _0x22394f[_0x5de3('0x17')](_0x2aa305)[_0x5de3('0x18')](_0x51de9a);}};}function respondWithFilteredResult(_0x1acff9,_0x261918){return function(_0x36eed5){if(_0x36eed5){var _0x12050c=typeof _0x261918[_0x5de3('0x19')]===_0x5de3('0x1a')&&typeof _0x261918['limit']===_0x5de3('0x1a');var _0xbf41cb=_0x36eed5['count'];var _0x86496c=_0x12050c?0x0:_0x261918[_0x5de3('0x19')];var _0x134d36=_0x12050c?_0x36eed5['count']:_0x261918[_0x5de3('0x19')]+_0x261918[_0x5de3('0x1b')];var _0x4c567e;if(_0x134d36>=_0xbf41cb){_0x134d36=_0xbf41cb;_0x4c567e=0xc8;}else{_0x4c567e=0xce;}_0x1acff9[_0x5de3('0x17')](_0x4c567e);return _0x1acff9[_0x5de3('0x1c')](_0x5de3('0x1d'),_0x86496c+'-'+_0x134d36+'/'+_0xbf41cb)[_0x5de3('0x18')](_0x36eed5);}return null;};}function patchUpdates(_0x146ac1){return function(_0x419210){try{jsonpatch[_0x5de3('0x1e')](_0x419210,_0x146ac1,!![]);}catch(_0x509281){return BPromise['reject'](_0x509281);}return _0x419210[_0x5de3('0x1f')]();};}function saveUpdates(_0x5986df,_0x3b7c68){return function(_0x40e27){if(_0x40e27){return _0x40e27[_0x5de3('0x20')](_0x5986df)['then'](function(_0x44eaae){return _0x44eaae;});}return null;};}function removeEntity(_0x292ec6,_0x267768){return function(_0xf8a5c5){if(_0xf8a5c5){return _0xf8a5c5[_0x5de3('0x21')]()[_0x5de3('0x22')](function(){_0x292ec6[_0x5de3('0x17')](0xcc)[_0x5de3('0x23')]();});}};}function handleEntityNotFound(_0x325cdf,_0x1f4ab8){return function(_0x4473a7){if(!_0x4473a7){_0x325cdf[_0x5de3('0x16')](0x194);}return _0x4473a7;};}function handleError(_0x211ee1,_0x3e1871){_0x3e1871=_0x3e1871||0x1f4;return function(_0x40d3d1){logger[_0x5de3('0x24')](_0x40d3d1[_0x5de3('0x25')]);if(_0x40d3d1[_0x5de3('0x26')]){delete _0x40d3d1[_0x5de3('0x26')];}_0x211ee1[_0x5de3('0x17')](_0x3e1871)[_0x5de3('0x27')](_0x40d3d1);};}exports[_0x5de3('0x28')]=function(_0x347ecb,_0x177d26){var _0x1381ae={},_0x341160={},_0x434f60={'count':0x0,'rows':[]};var _0xb86332=_['map'](db['MailServerOut'][_0x5de3('0x29')],function(_0x55a3d5){return{'name':_0x55a3d5[_0x5de3('0x2a')],'type':_0x55a3d5[_0x5de3('0x2b')][_0x5de3('0x2c')]};});_0x341160['model']=_[_0x5de3('0x2d')](_0xb86332,_0x5de3('0x26'));_0x341160['query']=_[_0x5de3('0x2e')](_0x347ecb[_0x5de3('0x2f')]);_0x341160[_0x5de3('0x30')]=_['intersection'](_0x341160[_0x5de3('0x31')],_0x341160[_0x5de3('0x2f')]);_0x1381ae['attributes']=_[_0x5de3('0x32')](_0x341160[_0x5de3('0x31')],qs['fields'](_0x347ecb[_0x5de3('0x2f')][_0x5de3('0x33')]));_0x1381ae['attributes']=_0x1381ae[_0x5de3('0x34')]['length']?_0x1381ae[_0x5de3('0x34')]:_0x341160[_0x5de3('0x31')];if(!_0x347ecb[_0x5de3('0x2f')][_0x5de3('0x35')](_0x5de3('0x36'))){_0x1381ae[_0x5de3('0x1b')]=qs['limit'](_0x347ecb[_0x5de3('0x2f')][_0x5de3('0x1b')]);_0x1381ae[_0x5de3('0x19')]=qs[_0x5de3('0x19')](_0x347ecb['query'][_0x5de3('0x19')]);}_0x1381ae[_0x5de3('0x37')]=qs[_0x5de3('0x38')](_0x347ecb[_0x5de3('0x2f')][_0x5de3('0x38')]);_0x1381ae[_0x5de3('0x39')]=qs[_0x5de3('0x30')](_[_0x5de3('0x3a')](_0x347ecb[_0x5de3('0x2f')],_0x341160[_0x5de3('0x30')]),_0xb86332);if(_0x347ecb[_0x5de3('0x2f')][_0x5de3('0x3b')]){_0x1381ae[_0x5de3('0x39')]=_[_0x5de3('0x3c')](_0x1381ae[_0x5de3('0x39')],{'$or':_[_0x5de3('0x2d')](_0xb86332,function(_0x4607c6){if(_0x4607c6[_0x5de3('0x2b')]!==_0x5de3('0x3d')){var _0x43faa0={};_0x43faa0[_0x4607c6[_0x5de3('0x26')]]={'$like':'%'+_0x347ecb[_0x5de3('0x2f')][_0x5de3('0x3b')]+'%'};return _0x43faa0;}})});}_0x1381ae=_[_0x5de3('0x3c')]({},_0x1381ae,_0x347ecb['options']);var _0x53d915={'where':_0x1381ae[_0x5de3('0x39')]};return db[_0x5de3('0x3e')][_0x5de3('0x3f')](_0x53d915)[_0x5de3('0x22')](function(_0x535db1){_0x434f60[_0x5de3('0x3f')]=_0x535db1;if(_0x347ecb['query'][_0x5de3('0x40')]){_0x1381ae[_0x5de3('0x41')]=[{'all':!![]}];}return db[_0x5de3('0x3e')][_0x5de3('0x42')](_0x1381ae);})[_0x5de3('0x22')](function(_0x4c81ae){_0x434f60[_0x5de3('0x43')]=_0x4c81ae;return _0x434f60;})['then'](respondWithFilteredResult(_0x177d26,_0x1381ae))['catch'](handleError(_0x177d26,null));};exports['show']=function(_0x2fc23a,_0x4dc3d8){var _0x58db03={'raw':!![],'where':{'id':_0x2fc23a[_0x5de3('0x44')]['id']}},_0xabc488={};_0xabc488['model']=_[_0x5de3('0x2e')](db['MailServerOut'][_0x5de3('0x29')]);_0xabc488['query']=_[_0x5de3('0x2e')](_0x2fc23a[_0x5de3('0x2f')]);_0xabc488['filters']=_[_0x5de3('0x32')](_0xabc488[_0x5de3('0x31')],_0xabc488[_0x5de3('0x2f')]);_0x58db03['attributes']=_[_0x5de3('0x32')](_0xabc488[_0x5de3('0x31')],qs['fields'](_0x2fc23a['query'][_0x5de3('0x33')]));_0x58db03['attributes']=_0x58db03[_0x5de3('0x34')][_0x5de3('0x45')]?_0x58db03[_0x5de3('0x34')]:_0xabc488[_0x5de3('0x31')];if(_0x2fc23a[_0x5de3('0x2f')][_0x5de3('0x40')]){_0x58db03[_0x5de3('0x41')]=[{'all':!![]}];}_0x58db03=_[_0x5de3('0x3c')]({},_0x58db03,_0x2fc23a[_0x5de3('0x46')]);return db[_0x5de3('0x3e')][_0x5de3('0x47')](_0x58db03)['then'](handleEntityNotFound(_0x4dc3d8,null))[_0x5de3('0x22')](respondWithResult(_0x4dc3d8,null))['catch'](handleError(_0x4dc3d8,null));};exports[_0x5de3('0x48')]=function(_0x201873,_0xef8f55){return db['MailServerOut'][_0x5de3('0x48')](_0x201873[_0x5de3('0x49')],{})[_0x5de3('0x22')](respondWithResult(_0xef8f55,0xc9))[_0x5de3('0x4a')](handleError(_0xef8f55,null));};exports['update']=function(_0x28f5a5,_0x3ac3e5){if(_0x28f5a5[_0x5de3('0x49')]['id']){delete _0x28f5a5[_0x5de3('0x49')]['id'];}return db['MailServerOut'][_0x5de3('0x47')]({'where':{'id':_0x28f5a5[_0x5de3('0x44')]['id']}})[_0x5de3('0x22')](handleEntityNotFound(_0x3ac3e5,null))['then'](saveUpdates(_0x28f5a5[_0x5de3('0x49')],null))[_0x5de3('0x22')](respondWithResult(_0x3ac3e5,null))[_0x5de3('0x4a')](handleError(_0x3ac3e5,null));};exports['destroy']=function(_0x25ac06,_0x1561c1){return db[_0x5de3('0x3e')][_0x5de3('0x47')]({'where':{'id':_0x25ac06[_0x5de3('0x44')]['id']}})[_0x5de3('0x22')](handleEntityNotFound(_0x1561c1,null))[_0x5de3('0x22')](removeEntity(_0x1561c1,null))['catch'](handleError(_0x1561c1,null));}; \ No newline at end of file +var _0x3e66=['filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','filter','merge','where','options','includeAll','findAll','rows','show','params','MailServerOut','include','find','create','body','update','catch','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','reject','save','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys'];(function(_0x586e59,_0x232a11){var _0x344aa6=function(_0x1a5153){while(--_0x1a5153){_0x586e59['push'](_0x586e59['shift']());}};_0x344aa6(++_0x232a11);}(_0x3e66,0xed));var _0x63e6=function(_0x539a3c,_0xe3181d){_0x539a3c=_0x539a3c-0x0;var _0x361cc6=_0x3e66[_0x539a3c];return _0x361cc6;};'use strict';var emlformat=require(_0x63e6('0x0'));var rimraf=require(_0x63e6('0x1'));var zipdir=require(_0x63e6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x63e6('0x3'));var BPromise=require(_0x63e6('0x4'));var Mustache=require(_0x63e6('0x5'));var util=require(_0x63e6('0x6'));var path=require(_0x63e6('0x7'));var sox=require('sox');var csv=require(_0x63e6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x63e6('0x9'));var _=require(_0x63e6('0xa'));var squel=require(_0x63e6('0xb'));var crypto=require(_0x63e6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x63e6('0xd'));var toCsv=require(_0x63e6('0x8'));var querystring=require(_0x63e6('0xe'));var Papa=require(_0x63e6('0xf'));var Redis=require(_0x63e6('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x63e6('0x11'));var hardwareService=require(_0x63e6('0x12'));var logger=require('../../config/logger')(_0x63e6('0x13'));var utils=require(_0x63e6('0x14'));var config=require(_0x63e6('0x15'));var licenseUtil=require(_0x63e6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37ffcb,_0x4d920e){_0x4d920e=_0x4d920e||0xcc;return function(_0x469feb){if(_0x469feb){return _0x37ffcb[_0x63e6('0x17')](_0x4d920e);}return _0x37ffcb['status'](_0x4d920e)[_0x63e6('0x18')]();};}function respondWithResult(_0x38575c,_0x5b31ad){_0x5b31ad=_0x5b31ad||0xc8;return function(_0x52c42c){if(_0x52c42c){return _0x38575c['status'](_0x5b31ad)[_0x63e6('0x19')](_0x52c42c);}};}function respondWithFilteredResult(_0x541b35,_0x51f745){return function(_0x178ff8){if(_0x178ff8){var _0x3bb966=typeof _0x51f745[_0x63e6('0x1a')]===_0x63e6('0x1b')&&typeof _0x51f745[_0x63e6('0x1c')]==='undefined';var _0x393dcd=_0x178ff8[_0x63e6('0x1d')];var _0x1049d0=_0x3bb966?0x0:_0x51f745[_0x63e6('0x1a')];var _0x5f203e=_0x3bb966?_0x178ff8['count']:_0x51f745['offset']+_0x51f745[_0x63e6('0x1c')];var _0x358098;if(_0x5f203e>=_0x393dcd){_0x5f203e=_0x393dcd;_0x358098=0xc8;}else{_0x358098=0xce;}_0x541b35[_0x63e6('0x1e')](_0x358098);return _0x541b35['set'](_0x63e6('0x1f'),_0x1049d0+'-'+_0x5f203e+'/'+_0x393dcd)[_0x63e6('0x19')](_0x178ff8);}return null;};}function patchUpdates(_0x30ecb9){return function(_0x1e863a){try{jsonpatch['apply'](_0x1e863a,_0x30ecb9,!![]);}catch(_0x1d24c1){return BPromise[_0x63e6('0x20')](_0x1d24c1);}return _0x1e863a[_0x63e6('0x21')]();};}function saveUpdates(_0x2bf619,_0x54d6d0){return function(_0x4fb19d){if(_0x4fb19d){return _0x4fb19d['update'](_0x2bf619)['then'](function(_0x99a0e6){return _0x99a0e6;});}return null;};}function removeEntity(_0xd3aabf,_0x315d3c){return function(_0x1c3c21){if(_0x1c3c21){return _0x1c3c21[_0x63e6('0x22')]()[_0x63e6('0x23')](function(){_0xd3aabf['status'](0xcc)[_0x63e6('0x18')]();});}};}function handleEntityNotFound(_0x8f0b32,_0x206538){return function(_0x79802e){if(!_0x79802e){_0x8f0b32['sendStatus'](0x194);}return _0x79802e;};}function handleError(_0x5e9e80,_0x28d5e0){_0x28d5e0=_0x28d5e0||0x1f4;return function(_0x4e0a1b){logger[_0x63e6('0x24')](_0x4e0a1b['stack']);if(_0x4e0a1b[_0x63e6('0x25')]){delete _0x4e0a1b[_0x63e6('0x25')];}_0x5e9e80[_0x63e6('0x1e')](_0x28d5e0)[_0x63e6('0x26')](_0x4e0a1b);};}exports[_0x63e6('0x27')]=function(_0xa47d59,_0x2cfcae){var _0xae6d62={},_0x51aac1={},_0x3b891c={'count':0x0,'rows':[]};var _0x3564cc=_[_0x63e6('0x28')](db['MailServerOut'][_0x63e6('0x29')],function(_0x537b65){return{'name':_0x537b65[_0x63e6('0x2a')],'type':_0x537b65[_0x63e6('0x2b')][_0x63e6('0x2c')]};});_0x51aac1[_0x63e6('0x2d')]=_['map'](_0x3564cc,'name');_0x51aac1['query']=_[_0x63e6('0x2e')](_0xa47d59['query']);_0x51aac1[_0x63e6('0x2f')]=_[_0x63e6('0x30')](_0x51aac1[_0x63e6('0x2d')],_0x51aac1[_0x63e6('0x31')]);_0xae6d62[_0x63e6('0x32')]=_[_0x63e6('0x30')](_0x51aac1[_0x63e6('0x2d')],qs[_0x63e6('0x33')](_0xa47d59[_0x63e6('0x31')][_0x63e6('0x33')]));_0xae6d62['attributes']=_0xae6d62['attributes']['length']?_0xae6d62[_0x63e6('0x32')]:_0x51aac1[_0x63e6('0x2d')];if(!_0xa47d59['query'][_0x63e6('0x34')]('nolimit')){_0xae6d62[_0x63e6('0x1c')]=qs[_0x63e6('0x1c')](_0xa47d59[_0x63e6('0x31')][_0x63e6('0x1c')]);_0xae6d62['offset']=qs[_0x63e6('0x1a')](_0xa47d59[_0x63e6('0x31')]['offset']);}_0xae6d62[_0x63e6('0x35')]=qs[_0x63e6('0x36')](_0xa47d59[_0x63e6('0x31')][_0x63e6('0x36')]);_0xae6d62['where']=qs[_0x63e6('0x2f')](_['pick'](_0xa47d59[_0x63e6('0x31')],_0x51aac1[_0x63e6('0x2f')]),_0x3564cc);if(_0xa47d59[_0x63e6('0x31')][_0x63e6('0x37')]){_0xae6d62['where']=_[_0x63e6('0x38')](_0xae6d62[_0x63e6('0x39')],{'$or':_['map'](_0x3564cc,function(_0x29635a){if(_0x29635a[_0x63e6('0x2b')]!=='VIRTUAL'){var _0x5570c7={};_0x5570c7[_0x29635a['name']]={'$like':'%'+_0xa47d59[_0x63e6('0x31')][_0x63e6('0x37')]+'%'};return _0x5570c7;}})});}_0xae6d62=_[_0x63e6('0x38')]({},_0xae6d62,_0xa47d59[_0x63e6('0x3a')]);var _0x2d9040={'where':_0xae6d62['where']};return db['MailServerOut'][_0x63e6('0x1d')](_0x2d9040)[_0x63e6('0x23')](function(_0x45fc82){_0x3b891c[_0x63e6('0x1d')]=_0x45fc82;if(_0xa47d59[_0x63e6('0x31')][_0x63e6('0x3b')]){_0xae6d62['include']=[{'all':!![]}];}return db['MailServerOut'][_0x63e6('0x3c')](_0xae6d62);})['then'](function(_0x55d619){_0x3b891c[_0x63e6('0x3d')]=_0x55d619;return _0x3b891c;})['then'](respondWithFilteredResult(_0x2cfcae,_0xae6d62))['catch'](handleError(_0x2cfcae,null));};exports[_0x63e6('0x3e')]=function(_0x4f361c,_0x57483d){var _0x956d1={'raw':!![],'where':{'id':_0x4f361c[_0x63e6('0x3f')]['id']}},_0x81877d={};_0x81877d[_0x63e6('0x2d')]=_[_0x63e6('0x2e')](db[_0x63e6('0x40')]['rawAttributes']);_0x81877d[_0x63e6('0x31')]=_[_0x63e6('0x2e')](_0x4f361c[_0x63e6('0x31')]);_0x81877d[_0x63e6('0x2f')]=_[_0x63e6('0x30')](_0x81877d[_0x63e6('0x2d')],_0x81877d[_0x63e6('0x31')]);_0x956d1[_0x63e6('0x32')]=_[_0x63e6('0x30')](_0x81877d[_0x63e6('0x2d')],qs['fields'](_0x4f361c[_0x63e6('0x31')][_0x63e6('0x33')]));_0x956d1[_0x63e6('0x32')]=_0x956d1[_0x63e6('0x32')]['length']?_0x956d1[_0x63e6('0x32')]:_0x81877d[_0x63e6('0x2d')];if(_0x4f361c[_0x63e6('0x31')]['includeAll']){_0x956d1[_0x63e6('0x41')]=[{'all':!![]}];}_0x956d1=_[_0x63e6('0x38')]({},_0x956d1,_0x4f361c[_0x63e6('0x3a')]);return db[_0x63e6('0x40')][_0x63e6('0x42')](_0x956d1)['then'](handleEntityNotFound(_0x57483d,null))[_0x63e6('0x23')](respondWithResult(_0x57483d,null))['catch'](handleError(_0x57483d,null));};exports[_0x63e6('0x43')]=function(_0x2be1d0,_0xfe9aa8){return db['MailServerOut'][_0x63e6('0x43')](_0x2be1d0[_0x63e6('0x44')],{})[_0x63e6('0x23')](respondWithResult(_0xfe9aa8,0xc9))['catch'](handleError(_0xfe9aa8,null));};exports[_0x63e6('0x45')]=function(_0x1784b4,_0x50697e){if(_0x1784b4[_0x63e6('0x44')]['id']){delete _0x1784b4[_0x63e6('0x44')]['id'];}return db[_0x63e6('0x40')]['find']({'where':{'id':_0x1784b4['params']['id']}})[_0x63e6('0x23')](handleEntityNotFound(_0x50697e,null))['then'](saveUpdates(_0x1784b4[_0x63e6('0x44')],null))[_0x63e6('0x23')](respondWithResult(_0x50697e,null))['catch'](handleError(_0x50697e,null));};exports['destroy']=function(_0x4aec27,_0x25b9a5){return db['MailServerOut']['find']({'where':{'id':_0x4aec27[_0x63e6('0x3f')]['id']}})[_0x63e6('0x23')](handleEntityNotFound(_0x25b9a5,null))['then'](removeEntity(_0x25b9a5,null))[_0x63e6('0x46')](handleError(_0x25b9a5,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 9942a83..df92cf8 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 _0x89bf=['request-promise','path','../../config/environment','./mailServerOut.attributes','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','moment'];(function(_0x207645,_0x1ff2cd){var _0x5140bd=function(_0x34f8b7){while(--_0x34f8b7){_0x207645['push'](_0x207645['shift']());}};_0x5140bd(++_0x1ff2cd);}(_0x89bf,0x172));var _0xf89b=function(_0x2be255,_0x250130){_0x2be255=_0x2be255-0x0;var _0x491cf3=_0x89bf[_0x2be255];return _0x491cf3;};'use strict';var _=require(_0xf89b('0x0'));var util=require(_0xf89b('0x1'));var logger=require(_0xf89b('0x2'))('api');var moment=require(_0xf89b('0x3'));var BPromise=require('bluebird');var rp=require(_0xf89b('0x4'));var fs=require('fs');var path=require(_0xf89b('0x5'));var rimraf=require('rimraf');var config=require(_0xf89b('0x6'));var attributes=require(_0xf89b('0x7'));module['exports']=function(_0x33b0a6,_0x5340f8){return _0x33b0a6[_0xf89b('0x8')](_0xf89b('0x9'),attributes,{'tableName':_0xf89b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4125=['util','api','moment','bluebird','request-promise','path','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out'];(function(_0x3bd305,_0x372f68){var _0x191e90=function(_0x976f65){while(--_0x976f65){_0x3bd305['push'](_0x3bd305['shift']());}};_0x191e90(++_0x372f68);}(_0x4125,0x1e0));var _0x5412=function(_0x330458,_0xa91caa){_0x330458=_0x330458-0x0;var _0x2990d8=_0x4125[_0x330458];return _0x2990d8;};'use strict';var _=require('lodash');var util=require(_0x5412('0x0'));var logger=require('../../config/logger')(_0x5412('0x1'));var moment=require(_0x5412('0x2'));var BPromise=require(_0x5412('0x3'));var rp=require(_0x5412('0x4'));var fs=require('fs');var path=require(_0x5412('0x5'));var rimraf=require('rimraf');var config=require(_0x5412('0x6'));var attributes=require(_0x5412('0x7'));module[_0x5412('0x8')]=function(_0x6118eb,_0xf3b6ec){return _0x6118eb[_0x5412('0x9')](_0x5412('0xa'),attributes,{'tableName':_0x5412('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 87b599f..9380dde 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x311f44,_0x1d7f5b){var _0x46f1e6=function(_0x27342a){while(--_0x27342a){_0x311f44['push'](_0x311f44['shift']());}};_0x46f1e6(++_0x1d7f5b);}(_0x2ef3,0xba));var _0x32ef=function(_0x425910,_0x38f2f3){_0x425910=_0x425910-0x0;var _0x5641e9=_0x2ef3[_0x425910];return _0x5641e9;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x5e4fb9,_0x45caf4){var _0x4189b4=function(_0x486bfa){while(--_0x486bfa){_0x5e4fb9['push'](_0x5e4fb9['shift']());}};_0x4189b4(++_0x45caf4);}(_0x2ef3,0xba));var _0x32ef=function(_0x99b37b,_0x278617){_0x99b37b=_0x99b37b-0x0;var _0x3e74fb=_0x2ef3[_0x99b37b];return _0x3e74fb;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 5a2b26f..313b8ce 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 _0x2914=['post','create','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller','index','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x5e132f,_0x141fb3){var _0x5aed85=function(_0x282fe5){while(--_0x282fe5){_0x5e132f['push'](_0x5e132f['shift']());}};_0x5aed85(++_0x141fb3);}(_0x2914,0xc3));var _0x4291=function(_0x21c5bf,_0x5a7e6d){_0x21c5bf=_0x21c5bf-0x0;var _0x2496aa=_0x2914[_0x21c5bf];return _0x2496aa;};'use strict';var multer=require('multer');var util=require(_0x4291('0x0'));var path=require('path');var timeout=require(_0x4291('0x1'));var express=require(_0x4291('0x2'));var router=express[_0x4291('0x3')]();var fs_extra=require(_0x4291('0x4'));var auth=require(_0x4291('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4291('0x6'));var controller=require(_0x4291('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4291('0x8')]);router[_0x4291('0x9')](_0x4291('0xa'),auth[_0x4291('0xb')](),controller[_0x4291('0xc')]);router[_0x4291('0x9')](_0x4291('0xd'),auth[_0x4291('0xb')](),controller[_0x4291('0xe')]);router[_0x4291('0xf')]('/',auth[_0x4291('0xb')](),controller[_0x4291('0x10')]);router[_0x4291('0x11')]('/:id',auth[_0x4291('0xb')](),controller['update']);router[_0x4291('0x12')](_0x4291('0xd'),auth[_0x4291('0xb')](),controller[_0x4291('0x13')]);module[_0x4291('0x14')]=router; \ No newline at end of file +var _0xc950=['delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe','isAuthenticated','/:id','post','create','put','update'];(function(_0x585d09,_0x1274bc){var _0x7d9a14=function(_0x343d4e){while(--_0x343d4e){_0x585d09['push'](_0x585d09['shift']());}};_0x7d9a14(++_0x1274bc);}(_0xc950,0x113));var _0x0c95=function(_0x24624a,_0xfd71bc){_0x24624a=_0x24624a-0x0;var _0x749fda=_0xc950[_0x24624a];return _0x749fda;};'use strict';var multer=require(_0x0c95('0x0'));var util=require(_0x0c95('0x1'));var path=require(_0x0c95('0x2'));var timeout=require('connect-timeout');var express=require(_0x0c95('0x3'));var router=express[_0x0c95('0x4')]();var fs_extra=require(_0x0c95('0x5'));var auth=require(_0x0c95('0x6'));var interaction=require(_0x0c95('0x7'));var config=require(_0x0c95('0x8'));var controller=require(_0x0c95('0x9'));router[_0x0c95('0xa')]('/',auth['isAuthenticated'](),controller[_0x0c95('0xb')]);router[_0x0c95('0xa')](_0x0c95('0xc'),auth[_0x0c95('0xd')](),controller['describe']);router[_0x0c95('0xa')](_0x0c95('0xe'),auth[_0x0c95('0xd')](),controller['show']);router[_0x0c95('0xf')]('/',auth[_0x0c95('0xd')](),controller[_0x0c95('0x10')]);router[_0x0c95('0x11')](_0x0c95('0xe'),auth[_0x0c95('0xd')](),controller[_0x0c95('0x12')]);router[_0x0c95('0x13')]('/:id',auth[_0x0c95('0xd')](),controller['destroy']);module[_0x0c95('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index c920cda..1b65e82 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 _0x7c09=['exports','STRING'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0x7c09,0x102));var _0x97c0=function(_0x55515c,_0x4f74a5){_0x55515c=_0x55515c-0x0;var _0x3b7a59=_0x7c09[_0x55515c];return _0x3b7a59;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'name':{'type':Sequelize[_0x97c0('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x97c0('0x1')]}}; \ No newline at end of file +var _0x5fab=['exports','name','STRING','sequelize'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x5fab,0x177));var _0xb5fa=function(_0x3844ab,_0x461e40){_0x3844ab=_0x3844ab-0x0;var _0x2a3276=_0x5fab[_0x3844ab];return _0x2a3276;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb5fa('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb5fa('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index eb0340c..ba08616 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 _0x9ea4=['status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x269c42,_0xeed101){var _0x4dad76=function(_0x167b87){while(--_0x167b87){_0x269c42['push'](_0x269c42['shift']());}};_0x4dad76(++_0xeed101);}(_0x9ea4,0xd0));var _0x49ea=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9ea4[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x49ea('0x0'));var rimraf=require(_0x49ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x49ea('0x2'));var moment=require(_0x49ea('0x3'));var BPromise=require(_0x49ea('0x4'));var Mustache=require(_0x49ea('0x5'));var util=require(_0x49ea('0x6'));var path=require(_0x49ea('0x7'));var sox=require(_0x49ea('0x8'));var csv=require('to-csv');var ejs=require(_0x49ea('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x49ea('0xa'));var squel=require('squel');var crypto=require(_0x49ea('0xb'));var jsforce=require(_0x49ea('0xc'));var deskjs=require(_0x49ea('0xd'));var toCsv=require(_0x49ea('0xe'));var querystring=require(_0x49ea('0xf'));var Papa=require(_0x49ea('0x10'));var Redis=require(_0x49ea('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x49ea('0x12'));var hardwareService=require(_0x49ea('0x13'));var logger=require(_0x49ea('0x14'))(_0x49ea('0x15'));var utils=require('../../config/utils');var config=require(_0x49ea('0x16'));var licenseUtil=require(_0x49ea('0x17'));var db=require(_0x49ea('0x18'))['db'];function respondWithStatusCode(_0x2ac7d2,_0x1ce880){_0x1ce880=_0x1ce880||0xcc;return function(_0x351f6b){if(_0x351f6b){return _0x2ac7d2[_0x49ea('0x19')](_0x1ce880);}return _0x2ac7d2[_0x49ea('0x1a')](_0x1ce880)[_0x49ea('0x1b')]();};}function respondWithResult(_0x36970d,_0x2f3535){_0x2f3535=_0x2f3535||0xc8;return function(_0x388a59){if(_0x388a59){return _0x36970d[_0x49ea('0x1a')](_0x2f3535)[_0x49ea('0x1c')](_0x388a59);}};}function respondWithFilteredResult(_0x600402,_0x22c838){return function(_0x18d637){if(_0x18d637){var _0x3d12a2=typeof _0x22c838[_0x49ea('0x1d')]===_0x49ea('0x1e')&&typeof _0x22c838['limit']===_0x49ea('0x1e');var _0x129df3=_0x18d637['count'];var _0x502e68=_0x3d12a2?0x0:_0x22c838[_0x49ea('0x1d')];var _0x1a3741=_0x3d12a2?_0x18d637['count']:_0x22c838[_0x49ea('0x1d')]+_0x22c838[_0x49ea('0x1f')];var _0x3e4456;if(_0x1a3741>=_0x129df3){_0x1a3741=_0x129df3;_0x3e4456=0xc8;}else{_0x3e4456=0xce;}_0x600402[_0x49ea('0x1a')](_0x3e4456);return _0x600402[_0x49ea('0x20')]('Content-Range',_0x502e68+'-'+_0x1a3741+'/'+_0x129df3)[_0x49ea('0x1c')](_0x18d637);}return null;};}function patchUpdates(_0x2d3855){return function(_0x20244c){try{jsonpatch[_0x49ea('0x21')](_0x20244c,_0x2d3855,!![]);}catch(_0x3457b4){return BPromise[_0x49ea('0x22')](_0x3457b4);}return _0x20244c[_0x49ea('0x23')]();};}function saveUpdates(_0x143a0d,_0x108cd2){return function(_0x229340){if(_0x229340){return _0x229340[_0x49ea('0x24')](_0x143a0d)[_0x49ea('0x25')](function(_0xcf2294){return _0xcf2294;});}return null;};}function removeEntity(_0x5a068e,_0x3d1dab){return function(_0x3cb9ef){if(_0x3cb9ef){return _0x3cb9ef[_0x49ea('0x26')]()['then'](function(){_0x5a068e[_0x49ea('0x1a')](0xcc)[_0x49ea('0x1b')]();});}};}function handleEntityNotFound(_0x5ba213,_0x394c9b){return function(_0x2ff878){if(!_0x2ff878){_0x5ba213['sendStatus'](0x194);}return _0x2ff878;};}function handleError(_0x4fd88c,_0x515209){_0x515209=_0x515209||0x1f4;return function(_0x1d44ce){logger[_0x49ea('0x27')](_0x1d44ce[_0x49ea('0x28')]);if(_0x1d44ce[_0x49ea('0x29')]){delete _0x1d44ce[_0x49ea('0x29')];}_0x4fd88c[_0x49ea('0x1a')](_0x515209)[_0x49ea('0x2a')](_0x1d44ce);};}exports['index']=function(_0x179fd4,_0x430b38){var _0x5865f4={},_0x332e59={},_0x56b8fa={'count':0x0,'rows':[]};var _0x33c212=_[_0x49ea('0x2b')](db[_0x49ea('0x2c')][_0x49ea('0x2d')],function(_0x3d4186){return{'name':_0x3d4186[_0x49ea('0x2e')],'type':_0x3d4186[_0x49ea('0x2f')][_0x49ea('0x30')]};});_0x332e59[_0x49ea('0x31')]=_[_0x49ea('0x2b')](_0x33c212,_0x49ea('0x29'));_0x332e59[_0x49ea('0x32')]=_[_0x49ea('0x33')](_0x179fd4[_0x49ea('0x32')]);_0x332e59[_0x49ea('0x34')]=_[_0x49ea('0x35')](_0x332e59[_0x49ea('0x31')],_0x332e59[_0x49ea('0x32')]);_0x5865f4[_0x49ea('0x36')]=_[_0x49ea('0x35')](_0x332e59[_0x49ea('0x31')],qs[_0x49ea('0x37')](_0x179fd4[_0x49ea('0x32')][_0x49ea('0x37')]));_0x5865f4[_0x49ea('0x36')]=_0x5865f4[_0x49ea('0x36')][_0x49ea('0x38')]?_0x5865f4[_0x49ea('0x36')]:_0x332e59[_0x49ea('0x31')];if(!_0x179fd4[_0x49ea('0x32')][_0x49ea('0x39')](_0x49ea('0x3a'))){_0x5865f4[_0x49ea('0x1f')]=qs[_0x49ea('0x1f')](_0x179fd4[_0x49ea('0x32')][_0x49ea('0x1f')]);_0x5865f4[_0x49ea('0x1d')]=qs[_0x49ea('0x1d')](_0x179fd4[_0x49ea('0x32')]['offset']);}_0x5865f4[_0x49ea('0x3b')]=qs[_0x49ea('0x3c')](_0x179fd4[_0x49ea('0x32')][_0x49ea('0x3c')]);_0x5865f4[_0x49ea('0x3d')]=qs[_0x49ea('0x34')](_[_0x49ea('0x3e')](_0x179fd4[_0x49ea('0x32')],_0x332e59['filters']),_0x33c212);if(_0x179fd4[_0x49ea('0x32')][_0x49ea('0x3f')]){_0x5865f4[_0x49ea('0x3d')]=_['merge'](_0x5865f4[_0x49ea('0x3d')],{'$or':_[_0x49ea('0x2b')](_0x33c212,function(_0x5ab28c){if(_0x5ab28c[_0x49ea('0x2f')]!==_0x49ea('0x40')){var _0x132dc3={};_0x132dc3[_0x5ab28c[_0x49ea('0x29')]]={'$like':'%'+_0x179fd4[_0x49ea('0x32')][_0x49ea('0x3f')]+'%'};return _0x132dc3;}})});}_0x5865f4=_[_0x49ea('0x41')]({},_0x5865f4,_0x179fd4[_0x49ea('0x42')]);var _0x293a75={'where':_0x5865f4[_0x49ea('0x3d')]};return db[_0x49ea('0x2c')][_0x49ea('0x43')](_0x293a75)['then'](function(_0x561b94){_0x56b8fa['count']=_0x561b94;if(_0x179fd4[_0x49ea('0x32')][_0x49ea('0x44')]){_0x5865f4[_0x49ea('0x45')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x5865f4);})[_0x49ea('0x25')](function(_0x10fc9a){_0x56b8fa[_0x49ea('0x46')]=_0x10fc9a;return _0x56b8fa;})[_0x49ea('0x25')](respondWithFilteredResult(_0x430b38,_0x5865f4))[_0x49ea('0x47')](handleError(_0x430b38,null));};exports[_0x49ea('0x48')]=function(_0x4f64d1,_0x58f3bf){var _0x20cfea={'raw':!![],'where':{'id':_0x4f64d1[_0x49ea('0x49')]['id']}},_0x4e43cf={};_0x4e43cf[_0x49ea('0x31')]=_[_0x49ea('0x33')](db['MailSubstatus'][_0x49ea('0x2d')]);_0x4e43cf[_0x49ea('0x32')]=_[_0x49ea('0x33')](_0x4f64d1['query']);_0x4e43cf[_0x49ea('0x34')]=_[_0x49ea('0x35')](_0x4e43cf['model'],_0x4e43cf[_0x49ea('0x32')]);_0x20cfea[_0x49ea('0x36')]=_[_0x49ea('0x35')](_0x4e43cf[_0x49ea('0x31')],qs['fields'](_0x4f64d1[_0x49ea('0x32')][_0x49ea('0x37')]));_0x20cfea[_0x49ea('0x36')]=_0x20cfea[_0x49ea('0x36')][_0x49ea('0x38')]?_0x20cfea['attributes']:_0x4e43cf[_0x49ea('0x31')];if(_0x4f64d1[_0x49ea('0x32')][_0x49ea('0x44')]){_0x20cfea['include']=[{'all':!![]}];}_0x20cfea=_[_0x49ea('0x41')]({},_0x20cfea,_0x4f64d1[_0x49ea('0x42')]);return db['MailSubstatus'][_0x49ea('0x4a')](_0x20cfea)['then'](handleEntityNotFound(_0x58f3bf,null))[_0x49ea('0x25')](respondWithResult(_0x58f3bf,null))[_0x49ea('0x47')](handleError(_0x58f3bf,null));};exports[_0x49ea('0x4b')]=function(_0x3e15e5,_0x1732ab){return db[_0x49ea('0x2c')][_0x49ea('0x4b')](_0x3e15e5[_0x49ea('0x4c')],{})['then'](respondWithResult(_0x1732ab,0xc9))[_0x49ea('0x47')](handleError(_0x1732ab,null));};exports[_0x49ea('0x24')]=function(_0x2d477b,_0x1165c6){if(_0x2d477b[_0x49ea('0x4c')]['id']){delete _0x2d477b[_0x49ea('0x4c')]['id'];}return db[_0x49ea('0x2c')][_0x49ea('0x4a')]({'where':{'id':_0x2d477b[_0x49ea('0x49')]['id']}})[_0x49ea('0x25')](handleEntityNotFound(_0x1165c6,null))[_0x49ea('0x25')](saveUpdates(_0x2d477b[_0x49ea('0x4c')],null))[_0x49ea('0x25')](respondWithResult(_0x1165c6,null))[_0x49ea('0x47')](handleError(_0x1165c6,null));};exports[_0x49ea('0x26')]=function(_0xac2fe3,_0x151257){return db[_0x49ea('0x2c')][_0x49ea('0x4a')]({'where':{'id':_0xac2fe3[_0x49ea('0x49')]['id']}})[_0x49ea('0x25')](handleEntityNotFound(_0x151257,null))[_0x49ea('0x25')](removeEntity(_0x151257,null))[_0x49ea('0x47')](handleError(_0x151257,null));};exports['describe']=function(_0x125140,_0x374fb6){return db[_0x49ea('0x2c')][_0x49ea('0x4d')]()[_0x49ea('0x25')](respondWithResult(_0x374fb6,null))[_0x49ea('0x47')](handleError(_0x374fb6,null));}; \ No newline at end of file +var _0x0d89=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','MailSubstatus','includeAll','include','rows','show','params','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','util','to-csv'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0d89,0x1e4));var _0x90d8=function(_0x3646e3,_0x1703c8){_0x3646e3=_0x3646e3-0x0;var _0x247596=_0x0d89[_0x3646e3];return _0x247596;};'use strict';var emlformat=require(_0x90d8('0x0'));var rimraf=require(_0x90d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x90d8('0x2'));var rp=require(_0x90d8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x90d8('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x90d8('0x5'));var ejs=require(_0x90d8('0x6'));var fs=require('fs');var fs_extra=require(_0x90d8('0x7'));var _=require(_0x90d8('0x8'));var squel=require(_0x90d8('0x9'));var crypto=require(_0x90d8('0xa'));var jsforce=require(_0x90d8('0xb'));var deskjs=require(_0x90d8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x90d8('0xd'));var Papa=require('papaparse');var Redis=require(_0x90d8('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x90d8('0xf'));var hardwareService=require(_0x90d8('0x10'));var logger=require(_0x90d8('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x90d8('0x12'));var licenseUtil=require(_0x90d8('0x13'));var db=require(_0x90d8('0x14'))['db'];function respondWithStatusCode(_0xe05701,_0x419457){_0x419457=_0x419457||0xcc;return function(_0x4fb150){if(_0x4fb150){return _0xe05701['sendStatus'](_0x419457);}return _0xe05701[_0x90d8('0x15')](_0x419457)[_0x90d8('0x16')]();};}function respondWithResult(_0x2fb72c,_0x41aae0){_0x41aae0=_0x41aae0||0xc8;return function(_0xe58751){if(_0xe58751){return _0x2fb72c['status'](_0x41aae0)[_0x90d8('0x17')](_0xe58751);}};}function respondWithFilteredResult(_0x40d675,_0x3104f0){return function(_0x50724c){if(_0x50724c){var _0x47dc3d=typeof _0x3104f0['offset']==='undefined'&&typeof _0x3104f0[_0x90d8('0x18')]==='undefined';var _0x3f5f45=_0x50724c[_0x90d8('0x19')];var _0x1a8b28=_0x47dc3d?0x0:_0x3104f0[_0x90d8('0x1a')];var _0x193da8=_0x47dc3d?_0x50724c[_0x90d8('0x19')]:_0x3104f0['offset']+_0x3104f0['limit'];var _0x277dd6;if(_0x193da8>=_0x3f5f45){_0x193da8=_0x3f5f45;_0x277dd6=0xc8;}else{_0x277dd6=0xce;}_0x40d675[_0x90d8('0x15')](_0x277dd6);return _0x40d675[_0x90d8('0x1b')]('Content-Range',_0x1a8b28+'-'+_0x193da8+'/'+_0x3f5f45)[_0x90d8('0x17')](_0x50724c);}return null;};}function patchUpdates(_0x482783){return function(_0x519eee){try{jsonpatch[_0x90d8('0x1c')](_0x519eee,_0x482783,!![]);}catch(_0x1c57d9){return BPromise[_0x90d8('0x1d')](_0x1c57d9);}return _0x519eee[_0x90d8('0x1e')]();};}function saveUpdates(_0x4b2978,_0x3e6e2d){return function(_0x2cdaf2){if(_0x2cdaf2){return _0x2cdaf2[_0x90d8('0x1f')](_0x4b2978)[_0x90d8('0x20')](function(_0x217592){return _0x217592;});}return null;};}function removeEntity(_0x2fd647,_0x34a7c7){return function(_0x4b875f){if(_0x4b875f){return _0x4b875f[_0x90d8('0x21')]()[_0x90d8('0x20')](function(){_0x2fd647[_0x90d8('0x15')](0xcc)[_0x90d8('0x16')]();});}};}function handleEntityNotFound(_0x5f4590,_0x2cf0dc){return function(_0x1c327b){if(!_0x1c327b){_0x5f4590[_0x90d8('0x22')](0x194);}return _0x1c327b;};}function handleError(_0xff36bc,_0x1b0e2d){_0x1b0e2d=_0x1b0e2d||0x1f4;return function(_0x185516){logger[_0x90d8('0x23')](_0x185516[_0x90d8('0x24')]);if(_0x185516[_0x90d8('0x25')]){delete _0x185516['name'];}_0xff36bc[_0x90d8('0x15')](_0x1b0e2d)[_0x90d8('0x26')](_0x185516);};}exports[_0x90d8('0x27')]=function(_0x13db34,_0x1f7e4d){var _0x3c594f={},_0x2c76c2={},_0x33b344={'count':0x0,'rows':[]};var _0x172c09=_['map'](db['MailSubstatus']['rawAttributes'],function(_0x42736b){return{'name':_0x42736b[_0x90d8('0x28')],'type':_0x42736b['type'][_0x90d8('0x29')]};});_0x2c76c2[_0x90d8('0x2a')]=_['map'](_0x172c09,_0x90d8('0x25'));_0x2c76c2['query']=_[_0x90d8('0x2b')](_0x13db34[_0x90d8('0x2c')]);_0x2c76c2[_0x90d8('0x2d')]=_['intersection'](_0x2c76c2[_0x90d8('0x2a')],_0x2c76c2[_0x90d8('0x2c')]);_0x3c594f[_0x90d8('0x2e')]=_[_0x90d8('0x2f')](_0x2c76c2[_0x90d8('0x2a')],qs[_0x90d8('0x30')](_0x13db34[_0x90d8('0x2c')][_0x90d8('0x30')]));_0x3c594f[_0x90d8('0x2e')]=_0x3c594f[_0x90d8('0x2e')][_0x90d8('0x31')]?_0x3c594f[_0x90d8('0x2e')]:_0x2c76c2[_0x90d8('0x2a')];if(!_0x13db34[_0x90d8('0x2c')][_0x90d8('0x32')](_0x90d8('0x33'))){_0x3c594f[_0x90d8('0x18')]=qs[_0x90d8('0x18')](_0x13db34['query'][_0x90d8('0x18')]);_0x3c594f[_0x90d8('0x1a')]=qs['offset'](_0x13db34[_0x90d8('0x2c')]['offset']);}_0x3c594f['order']=qs['sort'](_0x13db34['query'][_0x90d8('0x34')]);_0x3c594f['where']=qs['filters'](_[_0x90d8('0x35')](_0x13db34[_0x90d8('0x2c')],_0x2c76c2[_0x90d8('0x2d')]),_0x172c09);if(_0x13db34[_0x90d8('0x2c')][_0x90d8('0x36')]){_0x3c594f[_0x90d8('0x37')]=_[_0x90d8('0x38')](_0x3c594f[_0x90d8('0x37')],{'$or':_['map'](_0x172c09,function(_0x36c7e0){if(_0x36c7e0[_0x90d8('0x39')]!==_0x90d8('0x3a')){var _0x5a8611={};_0x5a8611[_0x36c7e0['name']]={'$like':'%'+_0x13db34[_0x90d8('0x2c')]['filter']+'%'};return _0x5a8611;}})});}_0x3c594f=_[_0x90d8('0x38')]({},_0x3c594f,_0x13db34[_0x90d8('0x3b')]);var _0x4a61e1={'where':_0x3c594f['where']};return db[_0x90d8('0x3c')]['count'](_0x4a61e1)[_0x90d8('0x20')](function(_0x559822){_0x33b344['count']=_0x559822;if(_0x13db34[_0x90d8('0x2c')][_0x90d8('0x3d')]){_0x3c594f[_0x90d8('0x3e')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x3c594f);})[_0x90d8('0x20')](function(_0x5ccc5d){_0x33b344[_0x90d8('0x3f')]=_0x5ccc5d;return _0x33b344;})['then'](respondWithFilteredResult(_0x1f7e4d,_0x3c594f))['catch'](handleError(_0x1f7e4d,null));};exports[_0x90d8('0x40')]=function(_0x5d80ef,_0x3e2e4a){var _0x22f6a4={'raw':!![],'where':{'id':_0x5d80ef[_0x90d8('0x41')]['id']}},_0x2d5e61={};_0x2d5e61[_0x90d8('0x2a')]=_[_0x90d8('0x2b')](db[_0x90d8('0x3c')]['rawAttributes']);_0x2d5e61[_0x90d8('0x2c')]=_['keys'](_0x5d80ef[_0x90d8('0x2c')]);_0x2d5e61[_0x90d8('0x2d')]=_['intersection'](_0x2d5e61['model'],_0x2d5e61[_0x90d8('0x2c')]);_0x22f6a4[_0x90d8('0x2e')]=_[_0x90d8('0x2f')](_0x2d5e61[_0x90d8('0x2a')],qs[_0x90d8('0x30')](_0x5d80ef[_0x90d8('0x2c')][_0x90d8('0x30')]));_0x22f6a4[_0x90d8('0x2e')]=_0x22f6a4[_0x90d8('0x2e')]['length']?_0x22f6a4[_0x90d8('0x2e')]:_0x2d5e61[_0x90d8('0x2a')];if(_0x5d80ef[_0x90d8('0x2c')][_0x90d8('0x3d')]){_0x22f6a4[_0x90d8('0x3e')]=[{'all':!![]}];}_0x22f6a4=_[_0x90d8('0x38')]({},_0x22f6a4,_0x5d80ef[_0x90d8('0x3b')]);return db['MailSubstatus'][_0x90d8('0x42')](_0x22f6a4)[_0x90d8('0x20')](handleEntityNotFound(_0x3e2e4a,null))[_0x90d8('0x20')](respondWithResult(_0x3e2e4a,null))[_0x90d8('0x43')](handleError(_0x3e2e4a,null));};exports['create']=function(_0x4ff3b6,_0x335c79){return db[_0x90d8('0x3c')][_0x90d8('0x44')](_0x4ff3b6[_0x90d8('0x45')],{})[_0x90d8('0x20')](respondWithResult(_0x335c79,0xc9))['catch'](handleError(_0x335c79,null));};exports[_0x90d8('0x1f')]=function(_0x380c73,_0x1f860e){if(_0x380c73[_0x90d8('0x45')]['id']){delete _0x380c73['body']['id'];}return db[_0x90d8('0x3c')][_0x90d8('0x42')]({'where':{'id':_0x380c73[_0x90d8('0x41')]['id']}})['then'](handleEntityNotFound(_0x1f860e,null))[_0x90d8('0x20')](saveUpdates(_0x380c73[_0x90d8('0x45')],null))['then'](respondWithResult(_0x1f860e,null))['catch'](handleError(_0x1f860e,null));};exports[_0x90d8('0x21')]=function(_0x5a5b2b,_0x1d46ff){return db[_0x90d8('0x3c')][_0x90d8('0x42')]({'where':{'id':_0x5a5b2b[_0x90d8('0x41')]['id']}})[_0x90d8('0x20')](handleEntityNotFound(_0x1d46ff,null))[_0x90d8('0x20')](removeEntity(_0x1d46ff,null))[_0x90d8('0x43')](handleError(_0x1d46ff,null));};exports['describe']=function(_0x2344b3,_0x35cdbf){return db['MailSubstatus']['describe']()['then'](respondWithResult(_0x35cdbf,null))['catch'](handleError(_0x35cdbf,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 0ef2794..4dccc2c 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 _0xf5af=['path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf5af,0x103));var _0xff5a=function(_0x59a91b,_0x5dfdaa){_0x59a91b=_0x59a91b-0x0;var _0x3484fe=_0xf5af[_0x59a91b];return _0x3484fe;};'use strict';var _=require(_0xff5a('0x0'));var util=require(_0xff5a('0x1'));var logger=require(_0xff5a('0x2'))(_0xff5a('0x3'));var moment=require(_0xff5a('0x4'));var BPromise=require(_0xff5a('0x5'));var rp=require(_0xff5a('0x6'));var fs=require('fs');var path=require(_0xff5a('0x7'));var rimraf=require(_0xff5a('0x8'));var config=require(_0xff5a('0x9'));var attributes=require(_0xff5a('0xa'));module[_0xff5a('0xb')]=function(_0xb81ce4,_0x2a8495){return _0xb81ce4[_0xff5a('0xc')](_0xff5a('0xd'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe076=['moment','request-promise','rimraf','../../config/environment','exports','define','MailSubstatus','mail_substatuses','lodash','util','api'];(function(_0x58be74,_0xe485b){var _0x5d675f=function(_0x55e499){while(--_0x55e499){_0x58be74['push'](_0x58be74['shift']());}};_0x5d675f(++_0xe485b);}(_0xe076,0x194));var _0x6e07=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xe076[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x6e07('0x0'));var util=require(_0x6e07('0x1'));var logger=require('../../config/logger')(_0x6e07('0x2'));var moment=require(_0x6e07('0x3'));var BPromise=require('bluebird');var rp=require(_0x6e07('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e07('0x5'));var config=require(_0x6e07('0x6'));var attributes=require('./mailSubstatus.attributes');module[_0x6e07('0x7')]=function(_0x5b1f3c,_0x8bb52c){return _0x5b1f3c[_0x6e07('0x8')](_0x6e07('0x9'),attributes,{'tableName':_0x6e07('0xa'),'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 cecd469..8cfb93b 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 _0xf3be=['code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise','http','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xf3be,0x1e1));var _0xef3b=function(_0x2e29bd,_0x187fe3){_0x2e29bd=_0x2e29bd-0x0;var _0x12f178=_0xf3be[_0x2e29bd];return _0x12f178;};'use strict';var _=require(_0xef3b('0x0'));var util=require(_0xef3b('0x1'));var moment=require(_0xef3b('0x2'));var BPromise=require(_0xef3b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef3b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xef3b('0x5'));var jayson=require(_0xef3b('0x6'));var client=jayson['client'][_0xef3b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f7873,_0x17e70a,_0x19191a){return new BPromise(function(_0x47069a,_0x3a36db){return client['request'](_0x3f7873,_0x19191a)['then'](function(_0x273a7d){logger['info'](_0xef3b('0x8'),_0x17e70a,_0xef3b('0x9'));logger[_0xef3b('0xa')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x17e70a,_0xef3b('0x9'),JSON['stringify'](_0x273a7d));if(_0x273a7d[_0xef3b('0xb')]){if(_0x273a7d[_0xef3b('0xb')][_0xef3b('0xc')]===0x1f4){logger[_0xef3b('0xb')](_0xef3b('0x8'),_0x17e70a,_0x273a7d[_0xef3b('0xb')][_0xef3b('0xd')]);return _0x3a36db(_0x273a7d[_0xef3b('0xb')][_0xef3b('0xd')]);}logger[_0xef3b('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x17e70a,_0x273a7d['error'][_0xef3b('0xd')]);return _0x47069a(_0x273a7d[_0xef3b('0xb')][_0xef3b('0xd')]);}else{logger[_0xef3b('0xe')](_0xef3b('0x8'),_0x17e70a,'request\x20sent');_0x47069a(_0x273a7d[_0xef3b('0xf')][_0xef3b('0xd')]);}})[_0xef3b('0x10')](function(_0x3c96a6){logger[_0xef3b('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x17e70a,_0x3c96a6);_0x3a36db(_0x3c96a6);});});} \ No newline at end of file +var _0x8071=['request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','MailSubstatus,\x20%s,\x20%s'];(function(_0x3c37f5,_0x464875){var _0x5c25d7=function(_0x5e0265){while(--_0x5e0265){_0x3c37f5['push'](_0x3c37f5['shift']());}};_0x5c25d7(++_0x464875);}(_0x8071,0x93));var _0x1807=function(_0x3e27a9,_0x3bfbdb){_0x3e27a9=_0x3e27a9-0x0;var _0x5780ec=_0x8071[_0x3e27a9];return _0x5780ec;};'use strict';var _=require(_0x1807('0x0'));var util=require(_0x1807('0x1'));var moment=require(_0x1807('0x2'));var BPromise=require(_0x1807('0x3'));var rs=require(_0x1807('0x4'));var fs=require('fs');var Redis=require(_0x1807('0x5'));var db=require(_0x1807('0x6'))['db'];var utils=require(_0x1807('0x7'));var logger=require(_0x1807('0x8'))(_0x1807('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1807('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x495a74,_0x4dbb3d,_0xffa1c8){return new BPromise(function(_0x5a907e,_0x2965ba){return client[_0x1807('0xb')](_0x495a74,_0xffa1c8)[_0x1807('0xc')](function(_0x23b5da){logger['info'](_0x1807('0xd'),_0x4dbb3d,_0x1807('0xe'));logger['debug'](_0x1807('0xf'),_0x4dbb3d,_0x1807('0xe'),JSON[_0x1807('0x10')](_0x23b5da));if(_0x23b5da[_0x1807('0x11')]){if(_0x23b5da['error'][_0x1807('0x12')]===0x1f4){logger[_0x1807('0x11')](_0x1807('0xd'),_0x4dbb3d,_0x23b5da['error'][_0x1807('0x13')]);return _0x2965ba(_0x23b5da[_0x1807('0x11')][_0x1807('0x13')]);}logger[_0x1807('0x11')](_0x1807('0xd'),_0x4dbb3d,_0x23b5da[_0x1807('0x11')][_0x1807('0x13')]);return _0x5a907e(_0x23b5da[_0x1807('0x11')][_0x1807('0x13')]);}else{logger[_0x1807('0x14')](_0x1807('0xd'),_0x4dbb3d,_0x1807('0xe'));_0x5a907e(_0x23b5da[_0x1807('0x15')]['message']);}})[_0x1807('0x16')](function(_0x2a2f89){logger[_0x1807('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x4dbb3d,_0x2a2f89);_0x2965ba(_0x2a2f89);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index c512e67..3526fdb 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 _0x7dfd=['destroy','exports','util','express','Router','fs-extra','../../components/interaction/service','./mailTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x57b201,_0x41764c){var _0x3c1b53=function(_0x3534ce){while(--_0x3534ce){_0x57b201['push'](_0x57b201['shift']());}};_0x3c1b53(++_0x41764c);}(_0x7dfd,0xc0));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd7df('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd7df('0x1'));var router=express[_0xd7df('0x2')]();var fs_extra=require(_0xd7df('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd7df('0x4'));var config=require('../../config/environment');var controller=require(_0xd7df('0x5'));router[_0xd7df('0x6')]('/',auth['isAuthenticated'](),controller[_0xd7df('0x7')]);router[_0xd7df('0x6')](_0xd7df('0x8'),auth[_0xd7df('0x9')](),controller['describe']);router[_0xd7df('0x6')](_0xd7df('0xa'),auth['isAuthenticated'](),controller[_0xd7df('0xb')]);router[_0xd7df('0xc')]('/',auth['isAuthenticated'](),controller[_0xd7df('0xd')]);router[_0xd7df('0xe')](_0xd7df('0xa'),auth[_0xd7df('0x9')](),controller[_0xd7df('0xf')]);router[_0xd7df('0x10')](_0xd7df('0xa'),auth[_0xd7df('0x9')](),controller[_0xd7df('0x11')]);module[_0xd7df('0x12')]=router; \ No newline at end of file +var _0x6ae6=['path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0x6ae6,0xbb));var _0x66ae=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x6ae6[_0x75f869];return _0x10af8b;};'use strict';var multer=require(_0x66ae('0x0'));var util=require(_0x66ae('0x1'));var path=require(_0x66ae('0x2'));var timeout=require(_0x66ae('0x3'));var express=require(_0x66ae('0x4'));var router=express[_0x66ae('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x66ae('0x6'));var controller=require('./mailTransferReport.controller');router[_0x66ae('0x7')]('/',auth[_0x66ae('0x8')](),controller[_0x66ae('0x9')]);router[_0x66ae('0x7')](_0x66ae('0xa'),auth[_0x66ae('0x8')](),controller[_0x66ae('0xb')]);router[_0x66ae('0x7')](_0x66ae('0xc'),auth[_0x66ae('0x8')](),controller[_0x66ae('0xd')]);router[_0x66ae('0xe')]('/',auth[_0x66ae('0x8')](),controller[_0x66ae('0xf')]);router[_0x66ae('0x10')](_0x66ae('0xc'),auth[_0x66ae('0x8')](),controller[_0x66ae('0x11')]);router[_0x66ae('0x12')](_0x66ae('0xc'),auth['isAuthenticated'](),controller[_0x66ae('0x13')]);module[_0x66ae('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 5e73c18..03057cb 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x272dc5,_0xc410a3){var _0xd3e426=function(_0x28d450){while(--_0x28d450){_0x272dc5['push'](_0x272dc5['shift']());}};_0xd3e426(++_0xc410a3);}(_0xf4eb,0xec));var _0xbf4e=function(_0x15a1a2,_0x5f60e8){_0x15a1a2=_0x15a1a2-0x0;var _0xcf790c=_0xf4eb[_0x15a1a2];return _0xcf790c;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x11e2bd,_0xd27110){var _0x547afa=function(_0x423462){while(--_0x423462){_0x11e2bd['push'](_0x11e2bd['shift']());}};_0x547afa(++_0xd27110);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 82728c9..6217e58 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 _0x0e3a=['save','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','where','merge','filter','options','MailTransferReport','findAll','catch','show','params','keys','includeAll','include','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject'];(function(_0x57faf2,_0x381b93){var _0x518f53=function(_0x417f4e){while(--_0x417f4e){_0x57faf2['push'](_0x57faf2['shift']());}};_0x518f53(++_0x381b93);}(_0x0e3a,0xb6));var _0xa0e3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0e3a[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0xa0e3('0x0'));var rimraf=require(_0xa0e3('0x1'));var zipdir=require(_0xa0e3('0x2'));var jsonpatch=require(_0xa0e3('0x3'));var rp=require(_0xa0e3('0x4'));var moment=require(_0xa0e3('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa0e3('0x6'));var sox=require('sox');var csv=require(_0xa0e3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa0e3('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa0e3('0x9'));var jsforce=require(_0xa0e3('0xa'));var deskjs=require(_0xa0e3('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa0e3('0xc'));var Papa=require(_0xa0e3('0xd'));var Redis=require(_0xa0e3('0xe'));var authService=require(_0xa0e3('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0e3('0x10'))(_0xa0e3('0x11'));var utils=require(_0xa0e3('0x12'));var config=require(_0xa0e3('0x13'));var licenseUtil=require(_0xa0e3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3281db,_0x498b78){_0x498b78=_0x498b78||0xcc;return function(_0x3b4cd1){if(_0x3b4cd1){return _0x3281db[_0xa0e3('0x15')](_0x498b78);}return _0x3281db[_0xa0e3('0x16')](_0x498b78)['end']();};}function respondWithResult(_0x59e2f8,_0x2b717c){_0x2b717c=_0x2b717c||0xc8;return function(_0x53da91){if(_0x53da91){return _0x59e2f8['status'](_0x2b717c)[_0xa0e3('0x17')](_0x53da91);}};}function respondWithFilteredResult(_0x53f208,_0x3252ce){return function(_0x310922){if(_0x310922){var _0x325cb8=typeof _0x3252ce[_0xa0e3('0x18')]===_0xa0e3('0x19')&&typeof _0x3252ce['limit']===_0xa0e3('0x19');var _0xd4347a=_0x310922[_0xa0e3('0x1a')];var _0x47bbdb=_0x325cb8?0x0:_0x3252ce['offset'];var _0x365391=_0x325cb8?_0x310922[_0xa0e3('0x1a')]:_0x3252ce['offset']+_0x3252ce[_0xa0e3('0x1b')];var _0xa7f789;if(_0x365391>=_0xd4347a){_0x365391=_0xd4347a;_0xa7f789=0xc8;}else{_0xa7f789=0xce;}_0x53f208[_0xa0e3('0x16')](_0xa7f789);return _0x53f208[_0xa0e3('0x1c')](_0xa0e3('0x1d'),_0x47bbdb+'-'+_0x365391+'/'+_0xd4347a)[_0xa0e3('0x17')](_0x310922);}return null;};}function patchUpdates(_0x5ee365){return function(_0x40b904){try{jsonpatch['apply'](_0x40b904,_0x5ee365,!![]);}catch(_0x46b83a){return BPromise[_0xa0e3('0x1e')](_0x46b83a);}return _0x40b904[_0xa0e3('0x1f')]();};}function saveUpdates(_0x58238e,_0x593244){return function(_0x309b20){if(_0x309b20){return _0x309b20['update'](_0x58238e)[_0xa0e3('0x20')](function(_0x5b181b){return _0x5b181b;});}return null;};}function removeEntity(_0x30b2a8,_0x36d724){return function(_0x22f0db){if(_0x22f0db){return _0x22f0db[_0xa0e3('0x21')]()['then'](function(){_0x30b2a8[_0xa0e3('0x16')](0xcc)[_0xa0e3('0x22')]();});}};}function handleEntityNotFound(_0x4c4e70,_0x29fc4c){return function(_0x5d3ab4){if(!_0x5d3ab4){_0x4c4e70[_0xa0e3('0x15')](0x194);}return _0x5d3ab4;};}function handleError(_0x2f78eb,_0x41c7a4){_0x41c7a4=_0x41c7a4||0x1f4;return function(_0x1fca3a){logger[_0xa0e3('0x23')](_0x1fca3a[_0xa0e3('0x24')]);if(_0x1fca3a['name']){delete _0x1fca3a[_0xa0e3('0x25')];}_0x2f78eb[_0xa0e3('0x16')](_0x41c7a4)[_0xa0e3('0x26')](_0x1fca3a);};}exports['index']=function(_0x4ff7fe,_0x5921bc){var _0x1598c6={},_0xfb8719={},_0x2cc338={'count':0x0,'rows':[]};var _0x24fa27=_[_0xa0e3('0x27')](db['MailTransferReport'][_0xa0e3('0x28')],function(_0x25526d){return{'name':_0x25526d[_0xa0e3('0x29')],'type':_0x25526d[_0xa0e3('0x2a')][_0xa0e3('0x2b')]};});_0xfb8719[_0xa0e3('0x2c')]=_[_0xa0e3('0x27')](_0x24fa27,_0xa0e3('0x25'));_0xfb8719['query']=_['keys'](_0x4ff7fe[_0xa0e3('0x2d')]);_0xfb8719[_0xa0e3('0x2e')]=_[_0xa0e3('0x2f')](_0xfb8719[_0xa0e3('0x2c')],_0xfb8719[_0xa0e3('0x2d')]);_0x1598c6[_0xa0e3('0x30')]=_[_0xa0e3('0x2f')](_0xfb8719[_0xa0e3('0x2c')],qs[_0xa0e3('0x31')](_0x4ff7fe['query'][_0xa0e3('0x31')]));_0x1598c6['attributes']=_0x1598c6['attributes']['length']?_0x1598c6[_0xa0e3('0x30')]:_0xfb8719[_0xa0e3('0x2c')];if(!_0x4ff7fe[_0xa0e3('0x2d')][_0xa0e3('0x32')]('nolimit')){_0x1598c6[_0xa0e3('0x1b')]=qs[_0xa0e3('0x1b')](_0x4ff7fe[_0xa0e3('0x2d')][_0xa0e3('0x1b')]);_0x1598c6[_0xa0e3('0x18')]=qs[_0xa0e3('0x18')](_0x4ff7fe[_0xa0e3('0x2d')]['offset']);}_0x1598c6[_0xa0e3('0x33')]=qs[_0xa0e3('0x34')](_0x4ff7fe[_0xa0e3('0x2d')][_0xa0e3('0x34')]);_0x1598c6['where']=qs[_0xa0e3('0x2e')](_[_0xa0e3('0x35')](_0x4ff7fe[_0xa0e3('0x2d')],_0xfb8719['filters']),_0x24fa27);if(_0x4ff7fe[_0xa0e3('0x2d')]['filter']){_0x1598c6[_0xa0e3('0x36')]=_[_0xa0e3('0x37')](_0x1598c6[_0xa0e3('0x36')],{'$or':_[_0xa0e3('0x27')](_0x24fa27,function(_0x5641da){if(_0x5641da['type']!=='VIRTUAL'){var _0x377ca={};_0x377ca[_0x5641da[_0xa0e3('0x25')]]={'$like':'%'+_0x4ff7fe[_0xa0e3('0x2d')][_0xa0e3('0x38')]+'%'};return _0x377ca;}})});}_0x1598c6=_[_0xa0e3('0x37')]({},_0x1598c6,_0x4ff7fe[_0xa0e3('0x39')]);var _0x86676f={'where':_0x1598c6['where']};return db[_0xa0e3('0x3a')][_0xa0e3('0x1a')](_0x86676f)[_0xa0e3('0x20')](function(_0x3fb27b){_0x2cc338[_0xa0e3('0x1a')]=_0x3fb27b;if(_0x4ff7fe[_0xa0e3('0x2d')]['includeAll']){_0x1598c6['include']=[{'all':!![]}];}return db['MailTransferReport'][_0xa0e3('0x3b')](_0x1598c6);})[_0xa0e3('0x20')](function(_0x41d206){_0x2cc338['rows']=_0x41d206;return _0x2cc338;})[_0xa0e3('0x20')](respondWithFilteredResult(_0x5921bc,_0x1598c6))[_0xa0e3('0x3c')](handleError(_0x5921bc,null));};exports[_0xa0e3('0x3d')]=function(_0xa0bf45,_0x149279){var _0x3e4435={'raw':!![],'where':{'id':_0xa0bf45[_0xa0e3('0x3e')]['id']}},_0x1a95a6={};_0x1a95a6[_0xa0e3('0x2c')]=_['keys'](db['MailTransferReport'][_0xa0e3('0x28')]);_0x1a95a6[_0xa0e3('0x2d')]=_[_0xa0e3('0x3f')](_0xa0bf45[_0xa0e3('0x2d')]);_0x1a95a6['filters']=_[_0xa0e3('0x2f')](_0x1a95a6[_0xa0e3('0x2c')],_0x1a95a6['query']);_0x3e4435[_0xa0e3('0x30')]=_[_0xa0e3('0x2f')](_0x1a95a6[_0xa0e3('0x2c')],qs[_0xa0e3('0x31')](_0xa0bf45['query'][_0xa0e3('0x31')]));_0x3e4435[_0xa0e3('0x30')]=_0x3e4435[_0xa0e3('0x30')]['length']?_0x3e4435[_0xa0e3('0x30')]:_0x1a95a6[_0xa0e3('0x2c')];if(_0xa0bf45['query'][_0xa0e3('0x40')]){_0x3e4435[_0xa0e3('0x41')]=[{'all':!![]}];}_0x3e4435=_[_0xa0e3('0x37')]({},_0x3e4435,_0xa0bf45[_0xa0e3('0x39')]);return db[_0xa0e3('0x3a')][_0xa0e3('0x42')](_0x3e4435)['then'](handleEntityNotFound(_0x149279,null))['then'](respondWithResult(_0x149279,null))[_0xa0e3('0x3c')](handleError(_0x149279,null));};exports[_0xa0e3('0x43')]=function(_0x65b53,_0x5e5f4c){return db[_0xa0e3('0x3a')]['create'](_0x65b53['body'],{})[_0xa0e3('0x20')](respondWithResult(_0x5e5f4c,0xc9))['catch'](handleError(_0x5e5f4c,null));};exports[_0xa0e3('0x44')]=function(_0x3ba165,_0x3aa5ce){if(_0x3ba165[_0xa0e3('0x45')]['id']){delete _0x3ba165[_0xa0e3('0x45')]['id'];}return db[_0xa0e3('0x3a')]['find']({'where':{'id':_0x3ba165[_0xa0e3('0x3e')]['id']}})[_0xa0e3('0x20')](handleEntityNotFound(_0x3aa5ce,null))['then'](saveUpdates(_0x3ba165[_0xa0e3('0x45')],null))[_0xa0e3('0x20')](respondWithResult(_0x3aa5ce,null))[_0xa0e3('0x3c')](handleError(_0x3aa5ce,null));};exports[_0xa0e3('0x21')]=function(_0x4d0f9d,_0x1e35fa){return db[_0xa0e3('0x3a')][_0xa0e3('0x42')]({'where':{'id':_0x4d0f9d[_0xa0e3('0x3e')]['id']}})[_0xa0e3('0x20')](handleEntityNotFound(_0x1e35fa,null))[_0xa0e3('0x20')](removeEntity(_0x1e35fa,null))[_0xa0e3('0x3c')](handleError(_0x1e35fa,null));};exports['describe']=function(_0x342ebb,_0x302282){return db[_0xa0e3('0x3a')][_0xa0e3('0x46')]()['then'](respondWithResult(_0x302282,null))['catch'](handleError(_0x302282,null));}; \ No newline at end of file +var _0x6e30=['sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','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/license/util','../../mysqldb'];(function(_0x37acb5,_0x3b5c56){var _0x4b5284=function(_0x49940e){while(--_0x49940e){_0x37acb5['push'](_0x37acb5['shift']());}};_0x4b5284(++_0x3b5c56);}(_0x6e30,0x84));var _0x06e3=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0x6e30[_0x386525];return _0x14d015;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x06e3('0x0'));var zipdir=require(_0x06e3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x06e3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x06e3('0x3'));var util=require(_0x06e3('0x4'));var path=require(_0x06e3('0x5'));var sox=require(_0x06e3('0x6'));var csv=require('to-csv');var ejs=require(_0x06e3('0x7'));var fs=require('fs');var fs_extra=require(_0x06e3('0x8'));var _=require(_0x06e3('0x9'));var squel=require(_0x06e3('0xa'));var crypto=require('crypto');var jsforce=require(_0x06e3('0xb'));var deskjs=require(_0x06e3('0xc'));var toCsv=require(_0x06e3('0xd'));var querystring=require(_0x06e3('0xe'));var Papa=require(_0x06e3('0xf'));var Redis=require(_0x06e3('0x10'));var authService=require(_0x06e3('0x11'));var qs=require(_0x06e3('0x12'));var as=require(_0x06e3('0x13'));var hardwareService=require(_0x06e3('0x14'));var logger=require(_0x06e3('0x15'))(_0x06e3('0x16'));var utils=require(_0x06e3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x06e3('0x18'));var db=require(_0x06e3('0x19'))['db'];function respondWithStatusCode(_0x56f1ca,_0x2e4d26){_0x2e4d26=_0x2e4d26||0xcc;return function(_0x525d7d){if(_0x525d7d){return _0x56f1ca[_0x06e3('0x1a')](_0x2e4d26);}return _0x56f1ca[_0x06e3('0x1b')](_0x2e4d26)[_0x06e3('0x1c')]();};}function respondWithResult(_0x168320,_0x579084){_0x579084=_0x579084||0xc8;return function(_0x3798f3){if(_0x3798f3){return _0x168320['status'](_0x579084)[_0x06e3('0x1d')](_0x3798f3);}};}function respondWithFilteredResult(_0x1b8799,_0x38be31){return function(_0x5d152b){if(_0x5d152b){var _0x452a4a=typeof _0x38be31['offset']===_0x06e3('0x1e')&&typeof _0x38be31[_0x06e3('0x1f')]===_0x06e3('0x1e');var _0x17b1df=_0x5d152b['count'];var _0x19dde5=_0x452a4a?0x0:_0x38be31[_0x06e3('0x20')];var _0x389cae=_0x452a4a?_0x5d152b[_0x06e3('0x21')]:_0x38be31[_0x06e3('0x20')]+_0x38be31[_0x06e3('0x1f')];var _0x1aadd1;if(_0x389cae>=_0x17b1df){_0x389cae=_0x17b1df;_0x1aadd1=0xc8;}else{_0x1aadd1=0xce;}_0x1b8799['status'](_0x1aadd1);return _0x1b8799[_0x06e3('0x22')](_0x06e3('0x23'),_0x19dde5+'-'+_0x389cae+'/'+_0x17b1df)[_0x06e3('0x1d')](_0x5d152b);}return null;};}function patchUpdates(_0xb0be3c){return function(_0x587a86){try{jsonpatch[_0x06e3('0x24')](_0x587a86,_0xb0be3c,!![]);}catch(_0x25baf4){return BPromise[_0x06e3('0x25')](_0x25baf4);}return _0x587a86[_0x06e3('0x26')]();};}function saveUpdates(_0x125f3c,_0x415563){return function(_0xe013e8){if(_0xe013e8){return _0xe013e8[_0x06e3('0x27')](_0x125f3c)[_0x06e3('0x28')](function(_0x22bffb){return _0x22bffb;});}return null;};}function removeEntity(_0x579148,_0x6d56fe){return function(_0x194ea9){if(_0x194ea9){return _0x194ea9[_0x06e3('0x29')]()[_0x06e3('0x28')](function(){_0x579148[_0x06e3('0x1b')](0xcc)[_0x06e3('0x1c')]();});}};}function handleEntityNotFound(_0x599b84,_0x30f7b5){return function(_0x1f8675){if(!_0x1f8675){_0x599b84['sendStatus'](0x194);}return _0x1f8675;};}function handleError(_0x4a145b,_0x50f5a8){_0x50f5a8=_0x50f5a8||0x1f4;return function(_0x3672a5){logger['error'](_0x3672a5[_0x06e3('0x2a')]);if(_0x3672a5[_0x06e3('0x2b')]){delete _0x3672a5[_0x06e3('0x2b')];}_0x4a145b['status'](_0x50f5a8)[_0x06e3('0x2c')](_0x3672a5);};}exports[_0x06e3('0x2d')]=function(_0x3ce43e,_0x1ab804){var _0x28e2d1={},_0x4e7b6d={},_0x15a5d2={'count':0x0,'rows':[]};var _0x402bd6=_[_0x06e3('0x2e')](db[_0x06e3('0x2f')][_0x06e3('0x30')],function(_0x6806fb){return{'name':_0x6806fb[_0x06e3('0x31')],'type':_0x6806fb['type'][_0x06e3('0x32')]};});_0x4e7b6d[_0x06e3('0x33')]=_[_0x06e3('0x2e')](_0x402bd6,_0x06e3('0x2b'));_0x4e7b6d[_0x06e3('0x34')]=_[_0x06e3('0x35')](_0x3ce43e['query']);_0x4e7b6d['filters']=_[_0x06e3('0x36')](_0x4e7b6d[_0x06e3('0x33')],_0x4e7b6d['query']);_0x28e2d1[_0x06e3('0x37')]=_[_0x06e3('0x36')](_0x4e7b6d[_0x06e3('0x33')],qs[_0x06e3('0x38')](_0x3ce43e[_0x06e3('0x34')][_0x06e3('0x38')]));_0x28e2d1[_0x06e3('0x37')]=_0x28e2d1[_0x06e3('0x37')][_0x06e3('0x39')]?_0x28e2d1[_0x06e3('0x37')]:_0x4e7b6d['model'];if(!_0x3ce43e[_0x06e3('0x34')][_0x06e3('0x3a')]('nolimit')){_0x28e2d1[_0x06e3('0x1f')]=qs[_0x06e3('0x1f')](_0x3ce43e[_0x06e3('0x34')][_0x06e3('0x1f')]);_0x28e2d1[_0x06e3('0x20')]=qs[_0x06e3('0x20')](_0x3ce43e[_0x06e3('0x34')]['offset']);}_0x28e2d1[_0x06e3('0x3b')]=qs[_0x06e3('0x3c')](_0x3ce43e[_0x06e3('0x34')][_0x06e3('0x3c')]);_0x28e2d1[_0x06e3('0x3d')]=qs[_0x06e3('0x3e')](_[_0x06e3('0x3f')](_0x3ce43e[_0x06e3('0x34')],_0x4e7b6d['filters']),_0x402bd6);if(_0x3ce43e[_0x06e3('0x34')][_0x06e3('0x40')]){_0x28e2d1[_0x06e3('0x3d')]=_[_0x06e3('0x41')](_0x28e2d1[_0x06e3('0x3d')],{'$or':_[_0x06e3('0x2e')](_0x402bd6,function(_0x5bd3a2){if(_0x5bd3a2[_0x06e3('0x42')]!==_0x06e3('0x43')){var _0x50bde6={};_0x50bde6[_0x5bd3a2['name']]={'$like':'%'+_0x3ce43e[_0x06e3('0x34')][_0x06e3('0x40')]+'%'};return _0x50bde6;}})});}_0x28e2d1=_['merge']({},_0x28e2d1,_0x3ce43e['options']);var _0x58e73a={'where':_0x28e2d1['where']};return db['MailTransferReport'][_0x06e3('0x21')](_0x58e73a)['then'](function(_0x35f1cc){_0x15a5d2[_0x06e3('0x21')]=_0x35f1cc;if(_0x3ce43e[_0x06e3('0x34')][_0x06e3('0x44')]){_0x28e2d1[_0x06e3('0x45')]=[{'all':!![]}];}return db[_0x06e3('0x2f')][_0x06e3('0x46')](_0x28e2d1);})[_0x06e3('0x28')](function(_0x35ef30){_0x15a5d2[_0x06e3('0x47')]=_0x35ef30;return _0x15a5d2;})[_0x06e3('0x28')](respondWithFilteredResult(_0x1ab804,_0x28e2d1))['catch'](handleError(_0x1ab804,null));};exports[_0x06e3('0x48')]=function(_0x4642de,_0xf0d2ac){var _0x56679b={'raw':!![],'where':{'id':_0x4642de[_0x06e3('0x49')]['id']}},_0x247488={};_0x247488[_0x06e3('0x33')]=_[_0x06e3('0x35')](db[_0x06e3('0x2f')][_0x06e3('0x30')]);_0x247488['query']=_[_0x06e3('0x35')](_0x4642de['query']);_0x247488[_0x06e3('0x3e')]=_[_0x06e3('0x36')](_0x247488[_0x06e3('0x33')],_0x247488[_0x06e3('0x34')]);_0x56679b[_0x06e3('0x37')]=_['intersection'](_0x247488['model'],qs['fields'](_0x4642de['query'][_0x06e3('0x38')]));_0x56679b['attributes']=_0x56679b[_0x06e3('0x37')]['length']?_0x56679b['attributes']:_0x247488[_0x06e3('0x33')];if(_0x4642de[_0x06e3('0x34')][_0x06e3('0x44')]){_0x56679b['include']=[{'all':!![]}];}_0x56679b=_[_0x06e3('0x41')]({},_0x56679b,_0x4642de['options']);return db[_0x06e3('0x2f')][_0x06e3('0x4a')](_0x56679b)[_0x06e3('0x28')](handleEntityNotFound(_0xf0d2ac,null))[_0x06e3('0x28')](respondWithResult(_0xf0d2ac,null))[_0x06e3('0x4b')](handleError(_0xf0d2ac,null));};exports[_0x06e3('0x4c')]=function(_0x57e203,_0x38d294){return db[_0x06e3('0x2f')][_0x06e3('0x4c')](_0x57e203['body'],{})[_0x06e3('0x28')](respondWithResult(_0x38d294,0xc9))['catch'](handleError(_0x38d294,null));};exports[_0x06e3('0x27')]=function(_0x3c95c9,_0xed690d){if(_0x3c95c9['body']['id']){delete _0x3c95c9[_0x06e3('0x4d')]['id'];}return db['MailTransferReport'][_0x06e3('0x4a')]({'where':{'id':_0x3c95c9[_0x06e3('0x49')]['id']}})[_0x06e3('0x28')](handleEntityNotFound(_0xed690d,null))[_0x06e3('0x28')](saveUpdates(_0x3c95c9['body'],null))[_0x06e3('0x28')](respondWithResult(_0xed690d,null))[_0x06e3('0x4b')](handleError(_0xed690d,null));};exports[_0x06e3('0x29')]=function(_0x185fab,_0xda5834){return db[_0x06e3('0x2f')][_0x06e3('0x4a')]({'where':{'id':_0x185fab[_0x06e3('0x49')]['id']}})[_0x06e3('0x28')](handleEntityNotFound(_0xda5834,null))[_0x06e3('0x28')](removeEntity(_0xda5834,null))[_0x06e3('0x4b')](handleError(_0xda5834,null));};exports[_0x06e3('0x4e')]=function(_0x530a1d,_0x1d0de1){return db['MailTransferReport'][_0x06e3('0x4e')]()[_0x06e3('0x28')](respondWithResult(_0x1d0de1,null))[_0x06e3('0x4b')](handleError(_0x1d0de1,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index b4c037f..4a9dad6 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 _0x6dec=['moment','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api'];(function(_0x5db99b,_0xdee23a){var _0x4b2d0e=function(_0x4deee1){while(--_0x4deee1){_0x5db99b['push'](_0x5db99b['shift']());}};_0x4b2d0e(++_0xdee23a);}(_0x6dec,0x10e));var _0xc6de=function(_0x21c211,_0x2201ca){_0x21c211=_0x21c211-0x0;var _0x57a158=_0x6dec[_0x21c211];return _0x57a158;};'use strict';var _=require(_0xc6de('0x0'));var util=require('util');var logger=require(_0xc6de('0x1'))(_0xc6de('0x2'));var moment=require(_0xc6de('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6de('0x4'));var rimraf=require(_0xc6de('0x5'));var config=require(_0xc6de('0x6'));var attributes=require(_0xc6de('0x7'));module[_0xc6de('0x8')]=function(_0x46077c,_0x3665c3){return _0x46077c[_0xc6de('0x9')](_0xc6de('0xa'),attributes,{'tableName':_0xc6de('0xb'),'paranoid':![],'indexes':[{'name':_0xc6de('0xc'),'fields':[_0xc6de('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaab2=['rimraf','../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xaab2,0xca));var _0x2aab=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xaab2[_0x4e9628];return _0x27bc8c;};'use strict';var _=require('lodash');var util=require(_0x2aab('0x0'));var logger=require(_0x2aab('0x1'))(_0x2aab('0x2'));var moment=require('moment');var BPromise=require(_0x2aab('0x3'));var rp=require(_0x2aab('0x4'));var fs=require('fs');var path=require(_0x2aab('0x5'));var rimraf=require(_0x2aab('0x6'));var config=require(_0x2aab('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0x2aab('0x8')]=function(_0x5b35ec,_0x3af395){return _0x5b35ec[_0x2aab('0x9')](_0x2aab('0xa'),attributes,{'tableName':_0x2aab('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2aab('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index abeb307..3146dc9 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 _0xb781=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2fdea4,_0x260afb){var _0x3bb159=function(_0x39a0b1){while(--_0x39a0b1){_0x2fdea4['push'](_0x2fdea4['shift']());}};_0x3bb159(++_0x260afb);}(_0xb781,0x1c6));var _0x1b78=function(_0xde19a5,_0x10b395){_0xde19a5=_0xde19a5-0x0;var _0x957d99=_0xb781[_0xde19a5];return _0x957d99;};'use strict';var _=require(_0x1b78('0x0'));var util=require(_0x1b78('0x1'));var moment=require(_0x1b78('0x2'));var BPromise=require(_0x1b78('0x3'));var rs=require(_0x1b78('0x4'));var fs=require('fs');var Redis=require(_0x1b78('0x5'));var db=require(_0x1b78('0x6'))['db'];var utils=require(_0x1b78('0x7'));var logger=require(_0x1b78('0x8'))(_0x1b78('0x9'));var config=require('../../config/environment');var jayson=require(_0x1b78('0xa'));var client=jayson[_0x1b78('0xb')][_0x1b78('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3fd4b9,_0x5cc489,_0x6f4100){return new BPromise(function(_0x23ea58,_0x651159){return client[_0x1b78('0xd')](_0x3fd4b9,_0x6f4100)[_0x1b78('0xe')](function(_0x3c4b11){logger['info'](_0x1b78('0xf'),_0x5cc489,_0x1b78('0x10'));logger[_0x1b78('0x11')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x5cc489,_0x1b78('0x10'),JSON[_0x1b78('0x12')](_0x3c4b11));if(_0x3c4b11[_0x1b78('0x13')]){if(_0x3c4b11[_0x1b78('0x13')][_0x1b78('0x14')]===0x1f4){logger['error'](_0x1b78('0xf'),_0x5cc489,_0x3c4b11[_0x1b78('0x13')][_0x1b78('0x15')]);return _0x651159(_0x3c4b11[_0x1b78('0x13')][_0x1b78('0x15')]);}logger[_0x1b78('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x5cc489,_0x3c4b11[_0x1b78('0x13')]['message']);return _0x23ea58(_0x3c4b11[_0x1b78('0x13')][_0x1b78('0x15')]);}else{logger[_0x1b78('0x16')](_0x1b78('0xf'),_0x5cc489,_0x1b78('0x10'));_0x23ea58(_0x3c4b11[_0x1b78('0x17')]['message']);}})[_0x1b78('0x18')](function(_0x1a8cfe){logger[_0x1b78('0x13')](_0x1b78('0xf'),_0x5cc489,_0x1a8cfe);_0x651159(_0x1a8cfe);});});} \ No newline at end of file +var _0xf37f=['debug','error','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0xf37f,0x15b));var _0xff37=function(_0x5c81b2,_0x46590a){_0x5c81b2=_0x5c81b2-0x0;var _0x4cbed6=_0xf37f[_0x5c81b2];return _0x4cbed6;};'use strict';var _=require('lodash');var util=require(_0xff37('0x0'));var moment=require('moment');var BPromise=require(_0xff37('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff37('0x2'));var db=require(_0xff37('0x3'))['db'];var utils=require(_0xff37('0x4'));var logger=require(_0xff37('0x5'))(_0xff37('0x6'));var config=require('../../config/environment');var jayson=require(_0xff37('0x7'));var client=jayson[_0xff37('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3531de,_0x2d06f9,_0x34c9f7){return new BPromise(function(_0xc11604,_0x17493c){return client[_0xff37('0x9')](_0x3531de,_0x34c9f7)['then'](function(_0x11c9e0){logger[_0xff37('0xa')](_0xff37('0xb'),_0x2d06f9,_0xff37('0xc'));logger[_0xff37('0xd')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x2d06f9,_0xff37('0xc'),JSON['stringify'](_0x11c9e0));if(_0x11c9e0[_0xff37('0xe')]){if(_0x11c9e0[_0xff37('0xe')]['code']===0x1f4){logger[_0xff37('0xe')](_0xff37('0xb'),_0x2d06f9,_0x11c9e0[_0xff37('0xe')][_0xff37('0xf')]);return _0x17493c(_0x11c9e0[_0xff37('0xe')][_0xff37('0xf')]);}logger['error'](_0xff37('0xb'),_0x2d06f9,_0x11c9e0['error'][_0xff37('0xf')]);return _0xc11604(_0x11c9e0[_0xff37('0xe')]['message']);}else{logger['info'](_0xff37('0xb'),_0x2d06f9,_0xff37('0xc'));_0xc11604(_0x11c9e0[_0xff37('0x10')][_0xff37('0xf')]);}})[_0xff37('0x11')](function(_0x3948bf){logger[_0xff37('0xe')](_0xff37('0xb'),_0x2d06f9,_0x3948bf);_0x17493c(_0x3948bf);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 975274a..c21af3b 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 _0xa3a7=['get','isAuthenticated','index','/describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xa3a7,0x1c4));var _0x7a3a=function(_0x361102,_0x1f06b4){_0x361102=_0x361102-0x0;var _0x9ee646=_0xa3a7[_0x361102];return _0x9ee646;};'use strict';var multer=require(_0x7a3a('0x0'));var util=require(_0x7a3a('0x1'));var path=require(_0x7a3a('0x2'));var timeout=require(_0x7a3a('0x3'));var express=require('express');var router=express[_0x7a3a('0x4')]();var fs_extra=require(_0x7a3a('0x5'));var auth=require(_0x7a3a('0x6'));var interaction=require(_0x7a3a('0x7'));var config=require(_0x7a3a('0x8'));var controller=require(_0x7a3a('0x9'));router[_0x7a3a('0xa')]('/',auth[_0x7a3a('0xb')](),controller[_0x7a3a('0xc')]);router[_0x7a3a('0xa')](_0x7a3a('0xd'),auth[_0x7a3a('0xb')](),controller['describe']);router[_0x7a3a('0xa')](_0x7a3a('0xe'),auth[_0x7a3a('0xb')](),controller[_0x7a3a('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7a3a('0x10')]);router['put'](_0x7a3a('0xe'),auth[_0x7a3a('0xb')](),controller[_0x7a3a('0x11')]);router[_0x7a3a('0x12')](_0x7a3a('0xe'),auth[_0x7a3a('0xb')](),controller[_0x7a3a('0x13')]);module[_0x7a3a('0x14')]=router; \ No newline at end of file +var _0x4eb8=['util','express','Router','fs-extra','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy','exports','multer'];(function(_0x375741,_0x2810a0){var _0x25b2f6=function(_0x64f8bc){while(--_0x64f8bc){_0x375741['push'](_0x375741['shift']());}};_0x25b2f6(++_0x2810a0);}(_0x4eb8,0x117));var _0x84eb=function(_0x529f36,_0x6b4496){_0x529f36=_0x529f36-0x0;var _0x64d301=_0x4eb8[_0x529f36];return _0x64d301;};'use strict';var multer=require(_0x84eb('0x0'));var util=require(_0x84eb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x84eb('0x2'));var router=express[_0x84eb('0x3')]();var fs_extra=require(_0x84eb('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x84eb('0x5'));var config=require('../../config/environment');var controller=require(_0x84eb('0x6'));router[_0x84eb('0x7')]('/',auth[_0x84eb('0x8')](),controller[_0x84eb('0x9')]);router[_0x84eb('0x7')](_0x84eb('0xa'),auth[_0x84eb('0x8')](),controller[_0x84eb('0xb')]);router[_0x84eb('0x7')]('/:id',auth[_0x84eb('0x8')](),controller[_0x84eb('0xc')]);router[_0x84eb('0xd')]('/',auth['isAuthenticated'](),controller[_0x84eb('0xe')]);router[_0x84eb('0xf')](_0x84eb('0x10'),auth[_0x84eb('0x8')](),controller[_0x84eb('0x11')]);router['delete'](_0x84eb('0x10'),auth[_0x84eb('0x8')](),controller[_0x84eb('0x12')]);module[_0x84eb('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index d7754b7..fffaebb 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 _0x1db3=['diff','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt'];(function(_0x13049b,_0xa80f90){var _0x4242db=function(_0x485119){while(--_0x485119){_0x13049b['push'](_0x13049b['shift']());}};_0x4242db(++_0xa80f90);}(_0x1db3,0x1e5));var _0x31db=function(_0x5753a3,_0x108f6f){_0x5753a3=_0x5753a3-0x0;var _0x3d314a=_0x1db3[_0x5753a3];return _0x3d314a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x31db('0x0'));module[_0x31db('0x1')]={'channel':{'type':Sequelize[_0x31db('0x2')]},'membername':{'type':Sequelize[_0x31db('0x2')]},'interface':{'type':Sequelize[_0x31db('0x2')]},'type':{'type':Sequelize[_0x31db('0x2')],'defaultValue':_0x31db('0x3'),'comment':_0x31db('0x4')},'duration':{'type':Sequelize[_0x31db('0x5')]},'enterAt':{'type':Sequelize[_0x31db('0x6')]},'exitAt':{'type':Sequelize[_0x31db('0x6')],'set':function(_0x3f252a){var _0x2b4eb6=moment(_0x3f252a);var _0x156381=moment(this[_0x31db('0x7')](_0x31db('0x8')));var _0x3a431e=_0x2b4eb6[_0x31db('0x9')](_0x156381,_0x31db('0xa'));this['setDataValue'](_0x31db('0xb'),_0x3f252a);this[_0x31db('0xc')](_0x31db('0xd'),_0x3a431e||null);}},'data1':{'type':Sequelize[_0x31db('0x2')],'comment':_0x31db('0xe')},'data2':{'type':Sequelize['STRING'],'comment':_0x31db('0xf')},'data3':{'type':Sequelize[_0x31db('0x2')],'comment':_0x31db('0x10')},'data4':{'type':Sequelize['STRING'],'comment':_0x31db('0x11')},'data5':{'type':Sequelize[_0x31db('0x2')],'comment':_0x31db('0x12')},'role':{'type':Sequelize[_0x31db('0x2')]},'internal':{'type':Sequelize[_0x31db('0x5')]},'uniqueid':{'type':Sequelize[_0x31db('0x2')]}}; \ No newline at end of file +var _0x9d02=['diff','seconds','exitAt','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt'];(function(_0x1833b6,_0x724dc5){var _0x245a46=function(_0x36140c){while(--_0x36140c){_0x1833b6['push'](_0x1833b6['shift']());}};_0x245a46(++_0x724dc5);}(_0x9d02,0x118));var _0x29d0=function(_0x288136,_0x249aa4){_0x288136=_0x288136-0x0;var _0x51ab69=_0x9d02[_0x288136];return _0x51ab69;};'use strict';var Sequelize=require(_0x29d0('0x0'));var moment=require('moment');module[_0x29d0('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x29d0('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x29d0('0x2')],'defaultValue':_0x29d0('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x29d0('0x4')]},'enterAt':{'type':Sequelize[_0x29d0('0x5')]},'exitAt':{'type':Sequelize[_0x29d0('0x5')],'set':function(_0x5a9824){var _0x5ef279=moment(_0x5a9824);var _0x5e35b3=moment(this[_0x29d0('0x6')](_0x29d0('0x7')));var _0x4a4019=_0x5ef279[_0x29d0('0x8')](_0x5e35b3,_0x29d0('0x9'));this['setDataValue'](_0x29d0('0xa'),_0x5a9824);this[_0x29d0('0xb')]('duration',_0x4a4019||null);}},'data1':{'type':Sequelize[_0x29d0('0x2')],'comment':_0x29d0('0xc')},'data2':{'type':Sequelize[_0x29d0('0x2')],'comment':_0x29d0('0xd')},'data3':{'type':Sequelize['STRING'],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x29d0('0x2')],'comment':_0x29d0('0xe')},'data5':{'type':Sequelize[_0x29d0('0x2')],'comment':_0x29d0('0xf')},'role':{'type':Sequelize[_0x29d0('0x2')]},'internal':{'type':Sequelize[_0x29d0('0x4')]},'uniqueid':{'type':Sequelize[_0x29d0('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index ed82b50..1dc4508 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x34e8,0x12c));var _0x834e=function(_0x2169b4,_0x5a2772){_0x2169b4=_0x2169b4-0x0;var _0x37130c=_0x34e8[_0x2169b4];return _0x37130c;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x55ca,0x126));var _0xa55c=function(_0x5820df,_0x24240a){_0x5820df=_0x5820df-0x0;var _0x7a47f1=_0x55ca[_0x5820df];return _0x7a47f1;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));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('0x7'));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=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 73c008a..981568a 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 _0x5941=['report_member','membername_interface','membername','interface','lodash','util','api','moment','bluebird','path','rimraf','./memberReport.attributes','exports','define'];(function(_0x16d22f,_0x26c599){var _0x49272f=function(_0x2d9fb7){while(--_0x2d9fb7){_0x16d22f['push'](_0x16d22f['shift']());}};_0x49272f(++_0x26c599);}(_0x5941,0x74));var _0x1594=function(_0xf22556,_0x1d3ed4){_0xf22556=_0xf22556-0x0;var _0x1cb134=_0x5941[_0xf22556];return _0x1cb134;};'use strict';var _=require(_0x1594('0x0'));var util=require(_0x1594('0x1'));var logger=require('../../config/logger')(_0x1594('0x2'));var moment=require(_0x1594('0x3'));var BPromise=require(_0x1594('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1594('0x5'));var rimraf=require(_0x1594('0x6'));var config=require('../../config/environment');var attributes=require(_0x1594('0x7'));module[_0x1594('0x8')]=function(_0x4c21f3,_0x140a20){return _0x4c21f3[_0x1594('0x9')]('MemberReport',attributes,{'tableName':_0x1594('0xa'),'paranoid':![],'indexes':[{'name':_0x1594('0xb'),'fields':[_0x1594('0xc'),_0x1594('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe34d=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','define','MemberReport','report_member','membername_interface','membername'];(function(_0x29aabf,_0x52240a){var _0x1e0551=function(_0xe87166){while(--_0xe87166){_0x29aabf['push'](_0x29aabf['shift']());}};_0x1e0551(++_0x52240a);}(_0xe34d,0xd0));var _0xde34=function(_0x3e2c99,_0x3ee049){_0x3e2c99=_0x3e2c99-0x0;var _0x4996ab=_0xe34d[_0x3e2c99];return _0x4996ab;};'use strict';var _=require(_0xde34('0x0'));var util=require(_0xde34('0x1'));var logger=require('../../config/logger')(_0xde34('0x2'));var moment=require('moment');var BPromise=require(_0xde34('0x3'));var rp=require(_0xde34('0x4'));var fs=require('fs');var path=require(_0xde34('0x5'));var rimraf=require(_0xde34('0x6'));var config=require(_0xde34('0x7'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x4bd189,_0x3574bd){return _0x4bd189[_0xde34('0x8')](_0xde34('0x9'),attributes,{'tableName':_0xde34('0xa'),'paranoid':![],'indexes':[{'name':_0xde34('0xb'),'fields':[_0xde34('0xc'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index aad9f8f..95e5834 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 _0x17c4=['info','MemberReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','model','map','CreateMemberReport','create','body','update','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x17c4,0x102));var _0x417c=function(_0x32d7e8,_0x2ad5d8){_0x32d7e8=_0x32d7e8-0x0;var _0x33f098=_0x17c4[_0x32d7e8];return _0x33f098;};'use strict';var _=require(_0x417c('0x0'));var util=require(_0x417c('0x1'));var moment=require(_0x417c('0x2'));var BPromise=require(_0x417c('0x3'));var rs=require(_0x417c('0x4'));var fs=require('fs');var Redis=require(_0x417c('0x5'));var db=require(_0x417c('0x6'))['db'];var utils=require(_0x417c('0x7'));var logger=require(_0x417c('0x8'))(_0x417c('0x9'));var config=require(_0x417c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x417c('0xb')][_0x417c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x340095,_0xc418d9,_0x1106df){return new BPromise(function(_0x4c6534,_0x5e75e6){return client[_0x417c('0xd')](_0x340095,_0x1106df)[_0x417c('0xe')](function(_0x36c36f){logger[_0x417c('0xf')](_0x417c('0x10'),_0xc418d9,'request\x20sent');logger[_0x417c('0x11')]('MemberReport,\x20%s,\x20%s,\x20%s',_0xc418d9,_0x417c('0x12'),JSON[_0x417c('0x13')](_0x36c36f));if(_0x36c36f[_0x417c('0x14')]){if(_0x36c36f[_0x417c('0x14')]['code']===0x1f4){logger['error'](_0x417c('0x10'),_0xc418d9,_0x36c36f['error']['message']);return _0x5e75e6(_0x36c36f['error'][_0x417c('0x15')]);}logger['error'](_0x417c('0x10'),_0xc418d9,_0x36c36f[_0x417c('0x14')]['message']);return _0x4c6534(_0x36c36f[_0x417c('0x14')][_0x417c('0x15')]);}else{logger[_0x417c('0xf')](_0x417c('0x10'),_0xc418d9,'request\x20sent');_0x4c6534(_0x36c36f['result'][_0x417c('0x15')]);}})[_0x417c('0x16')](function(_0x3f6058){logger['error'](_0x417c('0x10'),_0xc418d9,_0x3f6058);_0x5e75e6(_0x3f6058);});});}exports[_0x417c('0x17')]=function(_0xf8d94c){var _0x2f4565=this;return new Promise(function(_0x308618,_0x2620f1){return db[_0x417c('0x18')][_0x417c('0x19')]({'raw':_0xf8d94c[_0x417c('0x1a')]?_0xf8d94c[_0x417c('0x1a')][_0x417c('0x1b')]===undefined?!![]:![]:!![],'where':_0xf8d94c[_0x417c('0x1a')]?_0xf8d94c[_0x417c('0x1a')][_0x417c('0x1c')]||null:null,'attributes':_0xf8d94c[_0x417c('0x1a')]?_0xf8d94c[_0x417c('0x1a')][_0x417c('0x1d')]||null:null,'limit':_0xf8d94c[_0x417c('0x1a')]?_0xf8d94c[_0x417c('0x1a')][_0x417c('0x1e')]||null:null,'include':_0xf8d94c[_0x417c('0x1a')]?_0xf8d94c[_0x417c('0x1a')]['include']?_['map'](_0xf8d94c[_0x417c('0x1a')][_0x417c('0x1f')],function(_0x1867e6){return{'model':db[_0x1867e6[_0x417c('0x20')]],'as':_0x1867e6['as'],'attributes':_0x1867e6[_0x417c('0x1d')],'include':_0x1867e6[_0x417c('0x1f')]?_[_0x417c('0x21')](_0x1867e6[_0x417c('0x1f')],function(_0x2a27f8){return{'model':db[_0x2a27f8['model']],'as':_0x2a27f8['as'],'attributes':_0x2a27f8[_0x417c('0x1d')],'include':_0x2a27f8[_0x417c('0x1f')]?_['map'](_0x2a27f8['include'],function(_0x54dd1a){return{'model':db[_0x54dd1a[_0x417c('0x20')]],'as':_0x54dd1a['as'],'attributes':_0x54dd1a['attributes']};}):[]};}):[]};}):[]:[]})[_0x417c('0xe')](function(_0x344867){logger[_0x417c('0xf')](_0x417c('0x17'),_0xf8d94c);logger[_0x417c('0x11')](_0x417c('0x17'),_0xf8d94c,JSON[_0x417c('0x13')](_0x344867));_0x308618(_0x344867);})[_0x417c('0x16')](function(_0x9685fd){logger[_0x417c('0x14')]('GetMemberReport',_0x9685fd[_0x417c('0x15')],_0xf8d94c);_0x2620f1(_0x2f4565[_0x417c('0x14')](0x1f4,_0x9685fd[_0x417c('0x15')]));});});};exports[_0x417c('0x22')]=function(_0x45a075){var _0x1345ba=this;return new Promise(function(_0x4c2573,_0x3f91d9){return db[_0x417c('0x18')][_0x417c('0x23')](_0x45a075[_0x417c('0x24')],{'raw':_0x45a075['options']?_0x45a075[_0x417c('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x170b73){logger['info']('CreateMemberReport',_0x45a075);logger['debug']('CreateMemberReport',_0x45a075,JSON[_0x417c('0x13')](_0x170b73));_0x4c2573(_0x170b73);})[_0x417c('0x16')](function(_0x48cce9){logger[_0x417c('0x14')]('CreateMemberReport',_0x48cce9[_0x417c('0x15')],_0x45a075);_0x3f91d9(_0x1345ba[_0x417c('0x14')](0x1f4,_0x48cce9[_0x417c('0x15')]));});});};exports['UpdateMemberReport']=function(_0x38efe9){var _0x1c5b47=this;return new Promise(function(_0x40430e,_0x10eda8){return db[_0x417c('0x18')][_0x417c('0x25')](_0x38efe9[_0x417c('0x24')],{'raw':_0x38efe9['options']?_0x38efe9['options'][_0x417c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38efe9[_0x417c('0x1a')]?_0x38efe9['options']['where']||null:null,'attributes':_0x38efe9[_0x417c('0x1a')]?_0x38efe9[_0x417c('0x1a')]['attributes']||null:null,'limit':_0x38efe9['options']?_0x38efe9[_0x417c('0x1a')]['limit']||null:null})[_0x417c('0xe')](function(_0x273f74){logger['info']('UpdateMemberReport',_0x38efe9);logger[_0x417c('0x11')](_0x417c('0x26'),_0x38efe9,JSON[_0x417c('0x13')](_0x273f74));_0x40430e(_0x273f74);})[_0x417c('0x16')](function(_0x432f61){logger['error']('UpdateMemberReport',_0x432f61[_0x417c('0x15')],_0x38efe9);_0x10eda8(_0x1c5b47[_0x417c('0x14')](0x1f4,_0x432f61['message']));});});}; \ No newline at end of file +var _0x86f4=['../../mysqldb','../../config/logger','rpc','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','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','catch','CreateMemberReport','body','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x836822,_0x3e3773){var _0x40521a=function(_0x198725){while(--_0x198725){_0x836822['push'](_0x836822['shift']());}};_0x40521a(++_0x3e3773);}(_0x86f4,0x18a));var _0x486f=function(_0x5e5fdf,_0x1f01f5){_0x5e5fdf=_0x5e5fdf-0x0;var _0xd178d2=_0x86f4[_0x5e5fdf];return _0xd178d2;};'use strict';var _=require(_0x486f('0x0'));var util=require(_0x486f('0x1'));var moment=require(_0x486f('0x2'));var BPromise=require(_0x486f('0x3'));var rs=require(_0x486f('0x4'));var fs=require('fs');var Redis=require(_0x486f('0x5'));var db=require(_0x486f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x486f('0x7'))(_0x486f('0x8'));var config=require('../../config/environment');var jayson=require(_0x486f('0x9'));var client=jayson[_0x486f('0xa')][_0x486f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x207201,_0x3c6469,_0x3a0791){return new BPromise(function(_0x5bfabc,_0x33363d){return client[_0x486f('0xc')](_0x207201,_0x3a0791)[_0x486f('0xd')](function(_0x468a82){logger[_0x486f('0xe')](_0x486f('0xf'),_0x3c6469,_0x486f('0x10'));logger[_0x486f('0x11')](_0x486f('0x12'),_0x3c6469,_0x486f('0x10'),JSON[_0x486f('0x13')](_0x468a82));if(_0x468a82[_0x486f('0x14')]){if(_0x468a82[_0x486f('0x14')][_0x486f('0x15')]===0x1f4){logger[_0x486f('0x14')](_0x486f('0xf'),_0x3c6469,_0x468a82[_0x486f('0x14')]['message']);return _0x33363d(_0x468a82[_0x486f('0x14')]['message']);}logger[_0x486f('0x14')](_0x486f('0xf'),_0x3c6469,_0x468a82[_0x486f('0x14')]['message']);return _0x5bfabc(_0x468a82['error'][_0x486f('0x16')]);}else{logger[_0x486f('0xe')]('MemberReport,\x20%s,\x20%s',_0x3c6469,_0x486f('0x10'));_0x5bfabc(_0x468a82[_0x486f('0x17')][_0x486f('0x16')]);}})['catch'](function(_0x53561a){logger[_0x486f('0x14')](_0x486f('0xf'),_0x3c6469,_0x53561a);_0x33363d(_0x53561a);});});}exports[_0x486f('0x18')]=function(_0x39bfac){var _0x4e68d1=this;return new Promise(function(_0x59deb8,_0x268eb9){return db[_0x486f('0x19')][_0x486f('0x1a')]({'raw':_0x39bfac[_0x486f('0x1b')]?_0x39bfac[_0x486f('0x1b')][_0x486f('0x1c')]===undefined?!![]:![]:!![],'where':_0x39bfac[_0x486f('0x1b')]?_0x39bfac[_0x486f('0x1b')][_0x486f('0x1d')]||null:null,'attributes':_0x39bfac[_0x486f('0x1b')]?_0x39bfac[_0x486f('0x1b')][_0x486f('0x1e')]||null:null,'limit':_0x39bfac[_0x486f('0x1b')]?_0x39bfac[_0x486f('0x1b')][_0x486f('0x1f')]||null:null,'include':_0x39bfac[_0x486f('0x1b')]?_0x39bfac['options'][_0x486f('0x20')]?_[_0x486f('0x21')](_0x39bfac[_0x486f('0x1b')][_0x486f('0x20')],function(_0x351f81){return{'model':db[_0x351f81[_0x486f('0x22')]],'as':_0x351f81['as'],'attributes':_0x351f81[_0x486f('0x1e')],'include':_0x351f81[_0x486f('0x20')]?_[_0x486f('0x21')](_0x351f81[_0x486f('0x20')],function(_0x2e983b){return{'model':db[_0x2e983b[_0x486f('0x22')]],'as':_0x2e983b['as'],'attributes':_0x2e983b[_0x486f('0x1e')],'include':_0x2e983b[_0x486f('0x20')]?_[_0x486f('0x21')](_0x2e983b[_0x486f('0x20')],function(_0x6f1e8e){return{'model':db[_0x6f1e8e[_0x486f('0x22')]],'as':_0x6f1e8e['as'],'attributes':_0x6f1e8e[_0x486f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x486f('0xd')](function(_0x3c2762){logger[_0x486f('0xe')]('GetMemberReport',_0x39bfac);logger['debug']('GetMemberReport',_0x39bfac,JSON['stringify'](_0x3c2762));_0x59deb8(_0x3c2762);})[_0x486f('0x23')](function(_0x5c994a){logger[_0x486f('0x14')](_0x486f('0x18'),_0x5c994a['message'],_0x39bfac);_0x268eb9(_0x4e68d1[_0x486f('0x14')](0x1f4,_0x5c994a['message']));});});};exports[_0x486f('0x24')]=function(_0x2f166c){var _0x1481c1=this;return new Promise(function(_0x604ec3,_0x1962c2){return db[_0x486f('0x19')]['create'](_0x2f166c[_0x486f('0x25')],{'raw':_0x2f166c[_0x486f('0x1b')]?_0x2f166c[_0x486f('0x1b')][_0x486f('0x1c')]===undefined?!![]:![]:!![]})[_0x486f('0xd')](function(_0x22d89c){logger[_0x486f('0xe')](_0x486f('0x24'),_0x2f166c);logger['debug'](_0x486f('0x24'),_0x2f166c,JSON[_0x486f('0x13')](_0x22d89c));_0x604ec3(_0x22d89c);})['catch'](function(_0x153a48){logger[_0x486f('0x14')](_0x486f('0x24'),_0x153a48[_0x486f('0x16')],_0x2f166c);_0x1962c2(_0x1481c1[_0x486f('0x14')](0x1f4,_0x153a48['message']));});});};exports[_0x486f('0x26')]=function(_0x40dd81){var _0x1be0da=this;return new Promise(function(_0x202ea8,_0x387939){return db[_0x486f('0x19')][_0x486f('0x27')](_0x40dd81['body'],{'raw':_0x40dd81[_0x486f('0x1b')]?_0x40dd81[_0x486f('0x1b')][_0x486f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40dd81['options']?_0x40dd81['options'][_0x486f('0x1d')]||null:null,'attributes':_0x40dd81[_0x486f('0x1b')]?_0x40dd81['options'][_0x486f('0x1e')]||null:null,'limit':_0x40dd81['options']?_0x40dd81[_0x486f('0x1b')][_0x486f('0x1f')]||null:null})['then'](function(_0x5a8eb2){logger[_0x486f('0xe')](_0x486f('0x26'),_0x40dd81);logger[_0x486f('0x11')](_0x486f('0x26'),_0x40dd81,JSON[_0x486f('0x13')](_0x5a8eb2));_0x202ea8(_0x5a8eb2);})[_0x486f('0x23')](function(_0x901b9){logger[_0x486f('0x14')](_0x486f('0x26'),_0x901b9[_0x486f('0x16')],_0x40dd81);_0x387939(_0x1be0da[_0x486f('0x14')](0x1f4,_0x901b9[_0x486f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 3154523..5a1db6e 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 _0xaa5c=['index','exports','multer','util','path','connect-timeout','../../components/interaction/service','get'];(function(_0x1d4c1b,_0x96d5dd){var _0xff5dd6=function(_0x120a71){while(--_0x120a71){_0x1d4c1b['push'](_0x1d4c1b['shift']());}};_0xff5dd6(++_0x96d5dd);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x49861f,_0x5c8050){_0x49861f=_0x49861f-0x0;var _0x65369f=_0xaa5c[_0x49861f];return _0x65369f;};'use strict';var multer=require(_0xcaa5('0x0'));var util=require(_0xcaa5('0x1'));var path=require(_0xcaa5('0x2'));var timeout=require(_0xcaa5('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcaa5('0x4'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0xcaa5('0x5')]('/',controller[_0xcaa5('0x6')]);module[_0xcaa5('0x7')]=router; \ No newline at end of file +var _0xf739=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x2442b9,_0x3d87e9){var _0x31b571=function(_0x1e10ee){while(--_0x1e10ee){_0x2442b9['push'](_0x2442b9['shift']());}};_0x31b571(++_0x3d87e9);}(_0xf739,0x1df));var _0x9f73=function(_0xb04032,_0x5e0cad){_0xb04032=_0xb04032-0x0;var _0x2b0248=_0xf739[_0xb04032];return _0x2b0248;};'use strict';var multer=require('multer');var util=require(_0x9f73('0x0'));var path=require('path');var timeout=require(_0x9f73('0x1'));var express=require(_0x9f73('0x2'));var router=express[_0x9f73('0x3')]();var fs_extra=require(_0x9f73('0x4'));var auth=require(_0x9f73('0x5'));var interaction=require(_0x9f73('0x6'));var config=require(_0x9f73('0x7'));var controller=require(_0x9f73('0x8'));router['get']('/',controller[_0x9f73('0x9')]);module[_0x9f73('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 1b4ba5b..5aa41bc 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 _0xd522=['exports'];(function(_0x58832b,_0x4e6ffc){var _0x1a7b20=function(_0x208600){while(--_0x208600){_0x58832b['push'](_0x58832b['shift']());}};_0x1a7b20(++_0x4e6ffc);}(_0xd522,0x1bc));var _0x2d52=function(_0x34e5c3,_0x2e2b9b){_0x34e5c3=_0x34e5c3-0x0;var _0x175897=_0xd522[_0x34e5c3];return _0x175897;};'use strict';var Sequelize=require('sequelize');module[_0x2d52('0x0')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0xd367=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd367,0x1c2));var _0x7d36=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd367[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x7d36('0x0')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 77be4b3..a2eecc1 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 _0x6f35=['Content-Range','apply','reject','save','update','destroy','end','sendStatus','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','then','rows','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x6f35,0x177));var _0x56f3=function(_0x369abe,_0x25fdce){_0x369abe=_0x369abe-0x0;var _0x30dc6a=_0x6f35[_0x369abe];return _0x30dc6a;};'use strict';var emlformat=require(_0x56f3('0x0'));var rimraf=require(_0x56f3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x56f3('0x2'));var rp=require(_0x56f3('0x3'));var moment=require(_0x56f3('0x4'));var BPromise=require(_0x56f3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x56f3('0x6'));var sox=require(_0x56f3('0x7'));var csv=require(_0x56f3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x56f3('0x9'));var _=require('lodash');var squel=require(_0x56f3('0xa'));var crypto=require('crypto');var jsforce=require(_0x56f3('0xb'));var deskjs=require(_0x56f3('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x56f3('0xd'));var Redis=require('ioredis');var authService=require(_0x56f3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x56f3('0xf'));var hardwareService=require(_0x56f3('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x56f3('0x11'));var config=require(_0x56f3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x56f3('0x13'))['db'];function respondWithStatusCode(_0x4ae24e,_0x383e22){_0x383e22=_0x383e22||0xcc;return function(_0x18d24b){if(_0x18d24b){return _0x4ae24e['sendStatus'](_0x383e22);}return _0x4ae24e[_0x56f3('0x14')](_0x383e22)['end']();};}function respondWithResult(_0x28b7f0,_0x272b3d){_0x272b3d=_0x272b3d||0xc8;return function(_0x46efd4){if(_0x46efd4){return _0x28b7f0[_0x56f3('0x14')](_0x272b3d)[_0x56f3('0x15')](_0x46efd4);}};}function respondWithFilteredResult(_0xd4e758,_0x2ebe8f){return function(_0x5ce76b){if(_0x5ce76b){var _0x4aa554=typeof _0x2ebe8f[_0x56f3('0x16')]===_0x56f3('0x17')&&typeof _0x2ebe8f['limit']==='undefined';var _0x4c5c43=_0x5ce76b[_0x56f3('0x18')];var _0x292fa9=_0x4aa554?0x0:_0x2ebe8f['offset'];var _0xff91c4=_0x4aa554?_0x5ce76b[_0x56f3('0x18')]:_0x2ebe8f[_0x56f3('0x16')]+_0x2ebe8f[_0x56f3('0x19')];var _0x4e490e;if(_0xff91c4>=_0x4c5c43){_0xff91c4=_0x4c5c43;_0x4e490e=0xc8;}else{_0x4e490e=0xce;}_0xd4e758[_0x56f3('0x14')](_0x4e490e);return _0xd4e758[_0x56f3('0x1a')](_0x56f3('0x1b'),_0x292fa9+'-'+_0xff91c4+'/'+_0x4c5c43)[_0x56f3('0x15')](_0x5ce76b);}return null;};}function patchUpdates(_0x5ab3a0){return function(_0x474c96){try{jsonpatch[_0x56f3('0x1c')](_0x474c96,_0x5ab3a0,!![]);}catch(_0x557e99){return BPromise[_0x56f3('0x1d')](_0x557e99);}return _0x474c96[_0x56f3('0x1e')]();};}function saveUpdates(_0x4d3732,_0x20172f){return function(_0x5b56f8){if(_0x5b56f8){return _0x5b56f8[_0x56f3('0x1f')](_0x4d3732)['then'](function(_0x1a4dc0){return _0x1a4dc0;});}return null;};}function removeEntity(_0x2df31f,_0x590c44){return function(_0x51ce9f){if(_0x51ce9f){return _0x51ce9f[_0x56f3('0x20')]()['then'](function(){_0x2df31f['status'](0xcc)[_0x56f3('0x21')]();});}};}function handleEntityNotFound(_0x387312,_0x334849){return function(_0x21b900){if(!_0x21b900){_0x387312[_0x56f3('0x22')](0x194);}return _0x21b900;};}function handleError(_0x2900d7,_0x25c583){_0x25c583=_0x25c583||0x1f4;return function(_0x329a32){logger[_0x56f3('0x23')](_0x329a32[_0x56f3('0x24')]);if(_0x329a32[_0x56f3('0x25')]){delete _0x329a32[_0x56f3('0x25')];}_0x2900d7['status'](_0x25c583)[_0x56f3('0x26')](_0x329a32);};}exports[_0x56f3('0x27')]=function(_0x4f6c2a,_0x593511){var _0x2c5519={},_0x244c0a={},_0x2e34ac={'count':0x0,'rows':[]};var _0x3e67b4=_[_0x56f3('0x28')](db[_0x56f3('0x29')][_0x56f3('0x2a')],function(_0x26e106){return{'name':_0x26e106[_0x56f3('0x2b')],'type':_0x26e106[_0x56f3('0x2c')][_0x56f3('0x2d')]};});_0x244c0a[_0x56f3('0x2e')]=_[_0x56f3('0x28')](_0x3e67b4,'name');_0x244c0a[_0x56f3('0x2f')]=_['keys'](_0x4f6c2a[_0x56f3('0x2f')]);_0x244c0a['filters']=_[_0x56f3('0x30')](_0x244c0a[_0x56f3('0x2e')],_0x244c0a[_0x56f3('0x2f')]);_0x2c5519['attributes']=_[_0x56f3('0x30')](_0x244c0a['model'],qs[_0x56f3('0x31')](_0x4f6c2a[_0x56f3('0x2f')][_0x56f3('0x31')]));_0x2c5519[_0x56f3('0x32')]=_0x2c5519[_0x56f3('0x32')][_0x56f3('0x33')]?_0x2c5519[_0x56f3('0x32')]:_0x244c0a[_0x56f3('0x2e')];if(!_0x4f6c2a[_0x56f3('0x2f')][_0x56f3('0x34')](_0x56f3('0x35'))){_0x2c5519['limit']=qs['limit'](_0x4f6c2a[_0x56f3('0x2f')]['limit']);_0x2c5519[_0x56f3('0x16')]=qs[_0x56f3('0x16')](_0x4f6c2a[_0x56f3('0x2f')][_0x56f3('0x16')]);}_0x2c5519[_0x56f3('0x36')]=qs[_0x56f3('0x37')](_0x4f6c2a[_0x56f3('0x2f')][_0x56f3('0x37')]);_0x2c5519['where']=qs[_0x56f3('0x38')](_[_0x56f3('0x39')](_0x4f6c2a[_0x56f3('0x2f')],_0x244c0a['filters']),_0x3e67b4);if(_0x4f6c2a[_0x56f3('0x2f')][_0x56f3('0x3a')]){_0x2c5519[_0x56f3('0x3b')]=_[_0x56f3('0x3c')](_0x2c5519[_0x56f3('0x3b')],{'$or':_[_0x56f3('0x28')](_0x3e67b4,function(_0x37bff9){if(_0x37bff9['type']!=='VIRTUAL'){var _0x2eac7a={};_0x2eac7a[_0x37bff9[_0x56f3('0x25')]]={'$like':'%'+_0x4f6c2a[_0x56f3('0x2f')][_0x56f3('0x3a')]+'%'};return _0x2eac7a;}})});}_0x2c5519=_['merge']({},_0x2c5519,_0x4f6c2a[_0x56f3('0x3d')]);var _0x18bc28={'where':_0x2c5519[_0x56f3('0x3b')]};return db['Migration'][_0x56f3('0x18')](_0x18bc28)['then'](function(_0x52b5d9){_0x2e34ac['count']=_0x52b5d9;if(_0x4f6c2a[_0x56f3('0x2f')][_0x56f3('0x3e')]){_0x2c5519[_0x56f3('0x3f')]=[{'all':!![]}];}return db[_0x56f3('0x29')]['findAll'](_0x2c5519);})[_0x56f3('0x40')](function(_0xa0abbd){_0x2e34ac[_0x56f3('0x41')]=_0xa0abbd;return _0x2e34ac;})['then'](respondWithFilteredResult(_0x593511,_0x2c5519))[_0x56f3('0x42')](handleError(_0x593511,null));}; \ No newline at end of file +var _0xa7c5=['model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','Migration','rawAttributes','type','query','keys','filters','intersection'];(function(_0xfd14d4,_0x93c9c7){var _0x3664ef=function(_0x46b21c){while(--_0x46b21c){_0xfd14d4['push'](_0xfd14d4['shift']());}};_0x3664ef(++_0x93c9c7);}(_0xa7c5,0x1e6));var _0x5a7c=function(_0x47ee06,_0x52878c){_0x47ee06=_0x47ee06-0x0;var _0x3a1f8f=_0xa7c5[_0x47ee06];return _0x3a1f8f;};'use strict';var emlformat=require(_0x5a7c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5a7c('0x1'));var moment=require(_0x5a7c('0x2'));var BPromise=require(_0x5a7c('0x3'));var Mustache=require(_0x5a7c('0x4'));var util=require(_0x5a7c('0x5'));var path=require(_0x5a7c('0x6'));var sox=require(_0x5a7c('0x7'));var csv=require(_0x5a7c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a7c('0x9'));var _=require(_0x5a7c('0xa'));var squel=require('squel');var crypto=require(_0x5a7c('0xb'));var jsforce=require(_0x5a7c('0xc'));var deskjs=require(_0x5a7c('0xd'));var toCsv=require(_0x5a7c('0x8'));var querystring=require(_0x5a7c('0xe'));var Papa=require(_0x5a7c('0xf'));var Redis=require(_0x5a7c('0x10'));var authService=require(_0x5a7c('0x11'));var qs=require(_0x5a7c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a7c('0x13'));var logger=require(_0x5a7c('0x14'))('api');var utils=require(_0x5a7c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5a7c('0x16'));var db=require(_0x5a7c('0x17'))['db'];function respondWithStatusCode(_0xe27d6b,_0xafa4e6){_0xafa4e6=_0xafa4e6||0xcc;return function(_0xf141f7){if(_0xf141f7){return _0xe27d6b[_0x5a7c('0x18')](_0xafa4e6);}return _0xe27d6b[_0x5a7c('0x19')](_0xafa4e6)[_0x5a7c('0x1a')]();};}function respondWithResult(_0x1b11a8,_0x1e77ca){_0x1e77ca=_0x1e77ca||0xc8;return function(_0x570be5){if(_0x570be5){return _0x1b11a8['status'](_0x1e77ca)[_0x5a7c('0x1b')](_0x570be5);}};}function respondWithFilteredResult(_0x4bbd72,_0x5284d0){return function(_0x512674){if(_0x512674){var _0x284fd2=typeof _0x5284d0[_0x5a7c('0x1c')]===_0x5a7c('0x1d')&&typeof _0x5284d0[_0x5a7c('0x1e')]==='undefined';var _0x5cf3cf=_0x512674[_0x5a7c('0x1f')];var _0x543f16=_0x284fd2?0x0:_0x5284d0[_0x5a7c('0x1c')];var _0x16f170=_0x284fd2?_0x512674['count']:_0x5284d0[_0x5a7c('0x1c')]+_0x5284d0[_0x5a7c('0x1e')];var _0x49b1b5;if(_0x16f170>=_0x5cf3cf){_0x16f170=_0x5cf3cf;_0x49b1b5=0xc8;}else{_0x49b1b5=0xce;}_0x4bbd72[_0x5a7c('0x19')](_0x49b1b5);return _0x4bbd72[_0x5a7c('0x20')](_0x5a7c('0x21'),_0x543f16+'-'+_0x16f170+'/'+_0x5cf3cf)[_0x5a7c('0x1b')](_0x512674);}return null;};}function patchUpdates(_0x59c38c){return function(_0x5924a6){try{jsonpatch['apply'](_0x5924a6,_0x59c38c,!![]);}catch(_0x55d577){return BPromise[_0x5a7c('0x22')](_0x55d577);}return _0x5924a6[_0x5a7c('0x23')]();};}function saveUpdates(_0x153e25,_0x126484){return function(_0x18b7a5){if(_0x18b7a5){return _0x18b7a5['update'](_0x153e25)[_0x5a7c('0x24')](function(_0x28f05a){return _0x28f05a;});}return null;};}function removeEntity(_0x2d6c45,_0x46c197){return function(_0x2a22e6){if(_0x2a22e6){return _0x2a22e6[_0x5a7c('0x25')]()[_0x5a7c('0x24')](function(){_0x2d6c45['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x449823,_0x427663){return function(_0x5a2cb3){if(!_0x5a2cb3){_0x449823[_0x5a7c('0x18')](0x194);}return _0x5a2cb3;};}function handleError(_0x2bea7b,_0x2db54d){_0x2db54d=_0x2db54d||0x1f4;return function(_0x6e74aa){logger[_0x5a7c('0x26')](_0x6e74aa[_0x5a7c('0x27')]);if(_0x6e74aa[_0x5a7c('0x28')]){delete _0x6e74aa[_0x5a7c('0x28')];}_0x2bea7b['status'](_0x2db54d)[_0x5a7c('0x29')](_0x6e74aa);};}exports['index']=function(_0x5d5b79,_0x3f81d5){var _0x448915={},_0x484383={},_0x3d662f={'count':0x0,'rows':[]};var _0x119e83=_[_0x5a7c('0x2a')](db[_0x5a7c('0x2b')][_0x5a7c('0x2c')],function(_0x5d229d){return{'name':_0x5d229d['fieldName'],'type':_0x5d229d[_0x5a7c('0x2d')]['key']};});_0x484383['model']=_['map'](_0x119e83,'name');_0x484383[_0x5a7c('0x2e')]=_[_0x5a7c('0x2f')](_0x5d5b79[_0x5a7c('0x2e')]);_0x484383[_0x5a7c('0x30')]=_[_0x5a7c('0x31')](_0x484383[_0x5a7c('0x32')],_0x484383[_0x5a7c('0x2e')]);_0x448915[_0x5a7c('0x33')]=_[_0x5a7c('0x31')](_0x484383[_0x5a7c('0x32')],qs[_0x5a7c('0x34')](_0x5d5b79[_0x5a7c('0x2e')][_0x5a7c('0x34')]));_0x448915['attributes']=_0x448915[_0x5a7c('0x33')][_0x5a7c('0x35')]?_0x448915[_0x5a7c('0x33')]:_0x484383[_0x5a7c('0x32')];if(!_0x5d5b79[_0x5a7c('0x2e')][_0x5a7c('0x36')](_0x5a7c('0x37'))){_0x448915['limit']=qs[_0x5a7c('0x1e')](_0x5d5b79[_0x5a7c('0x2e')][_0x5a7c('0x1e')]);_0x448915[_0x5a7c('0x1c')]=qs[_0x5a7c('0x1c')](_0x5d5b79[_0x5a7c('0x2e')][_0x5a7c('0x1c')]);}_0x448915['order']=qs[_0x5a7c('0x38')](_0x5d5b79['query'][_0x5a7c('0x38')]);_0x448915[_0x5a7c('0x39')]=qs[_0x5a7c('0x30')](_[_0x5a7c('0x3a')](_0x5d5b79['query'],_0x484383[_0x5a7c('0x30')]),_0x119e83);if(_0x5d5b79[_0x5a7c('0x2e')][_0x5a7c('0x3b')]){_0x448915[_0x5a7c('0x39')]=_[_0x5a7c('0x3c')](_0x448915[_0x5a7c('0x39')],{'$or':_[_0x5a7c('0x2a')](_0x119e83,function(_0x29af28){if(_0x29af28[_0x5a7c('0x2d')]!==_0x5a7c('0x3d')){var _0x4d257c={};_0x4d257c[_0x29af28[_0x5a7c('0x28')]]={'$like':'%'+_0x5d5b79[_0x5a7c('0x2e')]['filter']+'%'};return _0x4d257c;}})});}_0x448915=_[_0x5a7c('0x3c')]({},_0x448915,_0x5d5b79[_0x5a7c('0x3e')]);var _0x3872ae={'where':_0x448915[_0x5a7c('0x39')]};return db[_0x5a7c('0x2b')][_0x5a7c('0x1f')](_0x3872ae)['then'](function(_0xe827d0){_0x3d662f[_0x5a7c('0x1f')]=_0xe827d0;if(_0x5d5b79[_0x5a7c('0x2e')][_0x5a7c('0x3f')]){_0x448915[_0x5a7c('0x40')]=[{'all':!![]}];}return db[_0x5a7c('0x2b')][_0x5a7c('0x41')](_0x448915);})[_0x5a7c('0x24')](function(_0x468bdc){_0x3d662f[_0x5a7c('0x42')]=_0x468bdc;return _0x3d662f;})[_0x5a7c('0x24')](respondWithFilteredResult(_0x3f81d5,_0x448915))['catch'](handleError(_0x3f81d5,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index c76ac2c..5ac861d 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 _0xcbc8=['../../config/environment','exports','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xcbc8,0x19c));var _0x8cbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcbc8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8cbc('0x0'));var util=require(_0x8cbc('0x1'));var logger=require(_0x8cbc('0x2'))(_0x8cbc('0x3'));var moment=require(_0x8cbc('0x4'));var BPromise=require(_0x8cbc('0x5'));var rp=require(_0x8cbc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8cbc('0x7'));var config=require(_0x8cbc('0x8'));var attributes=require('./migration.attributes');module[_0x8cbc('0x9')]=function(_0x39c1cd,_0x5dda07){return _0x39c1cd['define'](_0x8cbc('0xa'),attributes,{'tableName':_0x8cbc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb90e=['migrations','lodash','util','../../config/logger','moment','bluebird','request-promise','exports','define','Migration'];(function(_0x59ddd3,_0x21440c){var _0x49fb32=function(_0x35d5dd){while(--_0x35d5dd){_0x59ddd3['push'](_0x59ddd3['shift']());}};_0x49fb32(++_0x21440c);}(_0xb90e,0x1e1));var _0xeb90=function(_0xd94728,_0x4febe7){_0xd94728=_0xd94728-0x0;var _0x22be6e=_0xb90e[_0xd94728];return _0x22be6e;};'use strict';var _=require(_0xeb90('0x0'));var util=require(_0xeb90('0x1'));var logger=require(_0xeb90('0x2'))('api');var moment=require(_0xeb90('0x3'));var BPromise=require(_0xeb90('0x4'));var rp=require(_0xeb90('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0xeb90('0x6')]=function(_0x95194d,_0x5a7a06){return _0x95194d[_0xeb90('0x7')](_0xeb90('0x8'),attributes,{'tableName':_0xeb90('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 feb45ee..961050c 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 _0x4e5c=['moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x564b31,_0x315d7f){var _0x2c114b=function(_0x303640){while(--_0x303640){_0x564b31['push'](_0x564b31['shift']());}};_0x2c114b(++_0x315d7f);}(_0x4e5c,0x149));var _0xc4e5=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x4e5c[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xc4e5('0x0'));var util=require('util');var moment=require(_0xc4e5('0x1'));var BPromise=require('bluebird');var rs=require(_0xc4e5('0x2'));var fs=require('fs');var Redis=require(_0xc4e5('0x3'));var db=require(_0xc4e5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc4e5('0x5'));var jayson=require(_0xc4e5('0x6'));var client=jayson[_0xc4e5('0x7')][_0xc4e5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36da95,_0x1a7dac,_0x40c9df){return new BPromise(function(_0x3fb6b7,_0x3283b4){return client[_0xc4e5('0x9')](_0x36da95,_0x40c9df)[_0xc4e5('0xa')](function(_0x259106){logger['info'](_0xc4e5('0xb'),_0x1a7dac,_0xc4e5('0xc'));logger[_0xc4e5('0xd')](_0xc4e5('0xe'),_0x1a7dac,'request\x20sent',JSON[_0xc4e5('0xf')](_0x259106));if(_0x259106[_0xc4e5('0x10')]){if(_0x259106[_0xc4e5('0x10')][_0xc4e5('0x11')]===0x1f4){logger[_0xc4e5('0x10')](_0xc4e5('0xb'),_0x1a7dac,_0x259106[_0xc4e5('0x10')]['message']);return _0x3283b4(_0x259106['error'][_0xc4e5('0x12')]);}logger['error'](_0xc4e5('0xb'),_0x1a7dac,_0x259106[_0xc4e5('0x10')][_0xc4e5('0x12')]);return _0x3fb6b7(_0x259106[_0xc4e5('0x10')]['message']);}else{logger[_0xc4e5('0x13')]('Migration,\x20%s,\x20%s',_0x1a7dac,_0xc4e5('0xc'));_0x3fb6b7(_0x259106[_0xc4e5('0x14')][_0xc4e5('0x12')]);}})[_0xc4e5('0x15')](function(_0x12ff4c){logger[_0xc4e5('0x10')](_0xc4e5('0xb'),_0x1a7dac,_0x12ff4c);_0x3283b4(_0x12ff4c);});});} \ No newline at end of file +var _0xb240=['http','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb240,0x7e));var _0x0b24=function(_0x34c65f,_0x97ee3c){_0x34c65f=_0x34c65f-0x0;var _0x585ceb=_0xb240[_0x34c65f];return _0x585ceb;};'use strict';var _=require(_0x0b24('0x0'));var util=require(_0x0b24('0x1'));var moment=require(_0x0b24('0x2'));var BPromise=require(_0x0b24('0x3'));var rs=require(_0x0b24('0x4'));var fs=require('fs');var Redis=require(_0x0b24('0x5'));var db=require(_0x0b24('0x6'))['db'];var utils=require(_0x0b24('0x7'));var logger=require(_0x0b24('0x8'))('rpc');var config=require(_0x0b24('0x9'));var jayson=require(_0x0b24('0xa'));var client=jayson[_0x0b24('0xb')][_0x0b24('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x162a50,_0x53526b,_0x238a19){return new BPromise(function(_0x34be24,_0x41b7b9){return client['request'](_0x162a50,_0x238a19)['then'](function(_0x2679d5){logger['info']('Migration,\x20%s,\x20%s',_0x53526b,_0x0b24('0xd'));logger[_0x0b24('0xe')](_0x0b24('0xf'),_0x53526b,_0x0b24('0xd'),JSON[_0x0b24('0x10')](_0x2679d5));if(_0x2679d5[_0x0b24('0x11')]){if(_0x2679d5[_0x0b24('0x11')][_0x0b24('0x12')]===0x1f4){logger['error'](_0x0b24('0x13'),_0x53526b,_0x2679d5[_0x0b24('0x11')]['message']);return _0x41b7b9(_0x2679d5[_0x0b24('0x11')][_0x0b24('0x14')]);}logger[_0x0b24('0x11')](_0x0b24('0x13'),_0x53526b,_0x2679d5['error']['message']);return _0x34be24(_0x2679d5['error']['message']);}else{logger[_0x0b24('0x15')](_0x0b24('0x13'),_0x53526b,_0x0b24('0xd'));_0x34be24(_0x2679d5['result'][_0x0b24('0x14')]);}})[_0x0b24('0x16')](function(_0x1fd966){logger[_0x0b24('0x11')](_0x0b24('0x13'),_0x53526b,_0x1fd966);_0x41b7b9(_0x1fd966);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 39ced10..b526197 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 _0x8af6=['post','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show'];(function(_0x4503df,_0xfec122){var _0x3f1b2b=function(_0x32b1de){while(--_0x32b1de){_0x4503df['push'](_0x4503df['shift']());}};_0x3f1b2b(++_0xfec122);}(_0x8af6,0x76));var _0x68af=function(_0x4dd1da,_0x3cd58b){_0x4dd1da=_0x4dd1da-0x0;var _0x22fdf2=_0x8af6[_0x4dd1da];return _0x22fdf2;};'use strict';var multer=require(_0x68af('0x0'));var util=require(_0x68af('0x1'));var path=require(_0x68af('0x2'));var timeout=require(_0x68af('0x3'));var express=require(_0x68af('0x4'));var router=express[_0x68af('0x5')]();var fs_extra=require(_0x68af('0x6'));var auth=require(_0x68af('0x7'));var interaction=require(_0x68af('0x8'));var config=require(_0x68af('0x9'));var controller=require('./network.controller');router[_0x68af('0xa')]('/',auth['isAuthenticated'](),controller[_0x68af('0xb')]);router[_0x68af('0xa')](_0x68af('0xc'),auth[_0x68af('0xd')](),controller[_0x68af('0xe')]);router[_0x68af('0xf')]('/',auth[_0x68af('0xd')](),controller['create']);router['put'](_0x68af('0xc'),auth[_0x68af('0xd')](),controller['update']);router[_0x68af('0x10')](_0x68af('0xc'),auth[_0x68af('0xd')](),controller[_0x68af('0x11')]);module[_0x68af('0x12')]=router; \ No newline at end of file +var _0x6931=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x58b469,_0x35b4a7){var _0x30f453=function(_0x2036cd){while(--_0x2036cd){_0x58b469['push'](_0x58b469['shift']());}};_0x30f453(++_0x35b4a7);}(_0x6931,0x1a9));var _0x1693=function(_0x579156,_0x4b1f22){_0x579156=_0x579156-0x0;var _0x34cfb6=_0x6931[_0x579156];return _0x34cfb6;};'use strict';var multer=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var path=require(_0x1693('0x2'));var timeout=require(_0x1693('0x3'));var express=require(_0x1693('0x4'));var router=express[_0x1693('0x5')]();var fs_extra=require(_0x1693('0x6'));var auth=require(_0x1693('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1693('0x8'));var controller=require(_0x1693('0x9'));router[_0x1693('0xa')]('/',auth[_0x1693('0xb')](),controller[_0x1693('0xc')]);router['get'](_0x1693('0xd'),auth[_0x1693('0xb')](),controller[_0x1693('0xe')]);router['post']('/',auth[_0x1693('0xb')](),controller[_0x1693('0xf')]);router[_0x1693('0x10')](_0x1693('0xd'),auth[_0x1693('0xb')](),controller[_0x1693('0x11')]);router[_0x1693('0x12')](_0x1693('0xd'),auth[_0x1693('0xb')](),controller[_0x1693('0x13')]);module[_0x1693('0x14')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 109ec5b..36eade9 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 _0x72bb=['sequelize','exports','localnet','stun','turn','STRING'];(function(_0x1ed3c0,_0x260f08){var _0x42b647=function(_0x19a9aa){while(--_0x19a9aa){_0x1ed3c0['push'](_0x1ed3c0['shift']());}};_0x42b647(++_0x260f08);}(_0x72bb,0x1f2));var _0xb72b=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0x72bb[_0x83af7f];return _0x32d85c;};'use strict';var Sequelize=require(_0xb72b('0x0'));module[_0xb72b('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb72b('0x2'),'externip',_0xb72b('0x3'),_0xb72b('0x4'))},'value':{'type':Sequelize[_0xb72b('0x5')]},'username':{'type':Sequelize[_0xb72b('0x5')]},'password':{'type':Sequelize[_0xb72b('0x5')]}}; \ No newline at end of file +var _0xabe4=['turn','STRING','sequelize','ENUM','localnet','externip','stun'];(function(_0x3babec,_0x4d1223){var _0x395125=function(_0x39eb76){while(--_0x39eb76){_0x3babec['push'](_0x3babec['shift']());}};_0x395125(++_0x4d1223);}(_0xabe4,0x79));var _0x4abe=function(_0x544072,_0xc41ee1){_0x544072=_0x544072-0x0;var _0x590bf6=_0xabe4[_0x544072];return _0x590bf6;};'use strict';var Sequelize=require(_0x4abe('0x0'));module['exports']={'type':{'type':Sequelize[_0x4abe('0x1')](_0x4abe('0x2'),_0x4abe('0x3'),_0x4abe('0x4'),_0x4abe('0x5'))},'value':{'type':Sequelize[_0x4abe('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x4abe('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 2d96156..9328b24 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 _0x548b=['Reload','TURN','join','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/stun_multiple.ejs','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','request','then','Network,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','sequelize','transaction','body','findAll','toUpperCase','STUN','readFileSync','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0x548b,0x14f));var _0xb548=function(_0x151c58,_0x158fe4){_0x151c58=_0x151c58-0x0;var _0x1df732=_0x548b[_0x151c58];return _0x1df732;};'use strict';var emlformat=require(_0xb548('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb548('0x1'));var jsonpatch=require(_0xb548('0x2'));var rp=require(_0xb548('0x3'));var moment=require(_0xb548('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb548('0x5'));var path=require(_0xb548('0x6'));var sox=require(_0xb548('0x7'));var csv=require(_0xb548('0x8'));var ejs=require(_0xb548('0x9'));var fs=require('fs');var fs_extra=require(_0xb548('0xa'));var _=require(_0xb548('0xb'));var squel=require(_0xb548('0xc'));var crypto=require(_0xb548('0xd'));var jsforce=require(_0xb548('0xe'));var deskjs=require(_0xb548('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb548('0x10'));var Papa=require(_0xb548('0x11'));var Redis=require(_0xb548('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb548('0x13'));var as=require(_0xb548('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb548('0x15'));var config=require(_0xb548('0x16'));var licenseUtil=require(_0xb548('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb548('0x18'));var client=jayson[_0xb548('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ba5ba,_0x13ca51,_0x43d501,_0x480fb3){return new BPromise(function(_0x291bf9,_0x5e1068){var _0x26b05c=_0x480fb3||client;return _0x26b05c[_0xb548('0x1a')](_0x2ba5ba,_0x43d501)[_0xb548('0x1b')](function(_0x54faf5){logger['info'](_0xb548('0x1c'),_0x13ca51,'request\x20sent');logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x13ca51,_0xb548('0x1d'),JSON['stringify'](_0x54faf5));if(_0x54faf5[_0xb548('0x1e')]){if(_0x54faf5['error'][_0xb548('0x1f')]===0x1f4){logger[_0xb548('0x1e')](_0xb548('0x1c'),_0x13ca51,_0x54faf5['error'][_0xb548('0x20')]);return _0x5e1068(_0x54faf5[_0xb548('0x1e')][_0xb548('0x20')]);}logger[_0xb548('0x1e')](_0xb548('0x1c'),_0x13ca51,_0x54faf5[_0xb548('0x1e')]['message']);return _0x291bf9(_0x54faf5[_0xb548('0x1e')][_0xb548('0x20')]);}else{logger[_0xb548('0x21')](_0xb548('0x1c'),_0x13ca51,'request\x20sent');_0x291bf9(_0x54faf5[_0xb548('0x22')]['message']);}})['catch'](function(_0x3329ac){logger[_0xb548('0x1e')]('Network,\x20%s,\x20%s',_0x13ca51,_0x3329ac);_0x5e1068(_0x3329ac);});});}function respondWithStatusCode(_0x33b780,_0x1f6b72){_0x1f6b72=_0x1f6b72||0xcc;return function(_0x59ec0a){if(_0x59ec0a){return _0x33b780[_0xb548('0x23')](_0x1f6b72);}return _0x33b780[_0xb548('0x24')](_0x1f6b72)[_0xb548('0x25')]();};}function respondWithResult(_0x3d95b0,_0x40c7b7){_0x40c7b7=_0x40c7b7||0xc8;return function(_0x12f9e0){if(_0x12f9e0){return _0x3d95b0['status'](_0x40c7b7)[_0xb548('0x26')](_0x12f9e0);}};}function respondWithFilteredResult(_0x254c58,_0xd7c005){return function(_0x523760){if(_0x523760){var _0x2b9696=typeof _0xd7c005[_0xb548('0x27')]===_0xb548('0x28')&&typeof _0xd7c005['limit']===_0xb548('0x28');var _0x1c969c=_0x523760[_0xb548('0x29')];var _0x2eb53f=_0x2b9696?0x0:_0xd7c005[_0xb548('0x27')];var _0x2feb5e=_0x2b9696?_0x523760['count']:_0xd7c005[_0xb548('0x27')]+_0xd7c005[_0xb548('0x2a')];var _0x497806;if(_0x2feb5e>=_0x1c969c){_0x2feb5e=_0x1c969c;_0x497806=0xc8;}else{_0x497806=0xce;}_0x254c58['status'](_0x497806);return _0x254c58['set'](_0xb548('0x2b'),_0x2eb53f+'-'+_0x2feb5e+'/'+_0x1c969c)['json'](_0x523760);}return null;};}function patchUpdates(_0x2488b6){return function(_0xadf363){try{jsonpatch[_0xb548('0x2c')](_0xadf363,_0x2488b6,!![]);}catch(_0x3fef01){return BPromise[_0xb548('0x2d')](_0x3fef01);}return _0xadf363[_0xb548('0x2e')]();};}function saveUpdates(_0x322505,_0x536689){return function(_0x30153e){if(_0x30153e){return _0x30153e[_0xb548('0x2f')](_0x322505)[_0xb548('0x1b')](function(_0x466d38){return _0x466d38;});}return null;};}function removeEntity(_0x147aed,_0x51edc6){return function(_0x1def4a){if(_0x1def4a){return _0x1def4a[_0xb548('0x30')]()['then'](function(){_0x147aed['status'](0xcc)[_0xb548('0x25')]();});}};}function handleEntityNotFound(_0x217146,_0x5b6126){return function(_0x54b421){if(!_0x54b421){_0x217146[_0xb548('0x23')](0x194);}return _0x54b421;};}function handleError(_0x174406,_0x1c7dee){_0x1c7dee=_0x1c7dee||0x1f4;return function(_0x570509){logger[_0xb548('0x1e')](_0x570509[_0xb548('0x31')]);if(_0x570509[_0xb548('0x32')]){delete _0x570509[_0xb548('0x32')];}_0x174406['status'](_0x1c7dee)[_0xb548('0x33')](_0x570509);};}exports[_0xb548('0x34')]=function(_0x38d4d4,_0xc10fa1){var _0x435415={},_0x3fc1ec={},_0x336837={'count':0x0,'rows':[]};var _0xd8310d=_[_0xb548('0x35')](db[_0xb548('0x36')][_0xb548('0x37')],function(_0x386ca2){return{'name':_0x386ca2[_0xb548('0x38')],'type':_0x386ca2[_0xb548('0x39')][_0xb548('0x3a')]};});_0x3fc1ec['model']=_['map'](_0xd8310d,'name');_0x3fc1ec[_0xb548('0x3b')]=_[_0xb548('0x3c')](_0x38d4d4['query']);_0x3fc1ec[_0xb548('0x3d')]=_['intersection'](_0x3fc1ec[_0xb548('0x3e')],_0x3fc1ec[_0xb548('0x3b')]);_0x435415[_0xb548('0x3f')]=_[_0xb548('0x40')](_0x3fc1ec[_0xb548('0x3e')],qs['fields'](_0x38d4d4[_0xb548('0x3b')][_0xb548('0x41')]));_0x435415[_0xb548('0x3f')]=_0x435415[_0xb548('0x3f')]['length']?_0x435415[_0xb548('0x3f')]:_0x3fc1ec[_0xb548('0x3e')];if(!_0x38d4d4[_0xb548('0x3b')]['hasOwnProperty'](_0xb548('0x42'))){_0x435415[_0xb548('0x2a')]=qs[_0xb548('0x2a')](_0x38d4d4[_0xb548('0x3b')][_0xb548('0x2a')]);_0x435415['offset']=qs['offset'](_0x38d4d4[_0xb548('0x3b')][_0xb548('0x27')]);}_0x435415[_0xb548('0x43')]=qs[_0xb548('0x44')](_0x38d4d4['query'][_0xb548('0x44')]);_0x435415[_0xb548('0x45')]=qs[_0xb548('0x3d')](_[_0xb548('0x46')](_0x38d4d4['query'],_0x3fc1ec[_0xb548('0x3d')]),_0xd8310d);if(_0x38d4d4['query'][_0xb548('0x47')]){_0x435415[_0xb548('0x45')]=_[_0xb548('0x48')](_0x435415['where'],{'$or':_[_0xb548('0x35')](_0xd8310d,function(_0x31568c){if(_0x31568c[_0xb548('0x39')]!==_0xb548('0x49')){var _0x1effa0={};_0x1effa0[_0x31568c[_0xb548('0x32')]]={'$like':'%'+_0x38d4d4[_0xb548('0x3b')][_0xb548('0x47')]+'%'};return _0x1effa0;}})});}_0x435415=_[_0xb548('0x48')]({},_0x435415,_0x38d4d4[_0xb548('0x4a')]);var _0x583e43={'where':_0x435415[_0xb548('0x45')]};return db['Network']['count'](_0x583e43)[_0xb548('0x1b')](function(_0x72f4e3){_0x336837[_0xb548('0x29')]=_0x72f4e3;if(_0x38d4d4[_0xb548('0x3b')][_0xb548('0x4b')]){_0x435415[_0xb548('0x4c')]=[{'all':!![]}];}return db['Network']['findAll'](_0x435415);})[_0xb548('0x1b')](function(_0x4dabcf){_0x336837[_0xb548('0x4d')]=_0x4dabcf;return _0x336837;})['then'](respondWithFilteredResult(_0xc10fa1,_0x435415))[_0xb548('0x4e')](handleError(_0xc10fa1,null));};exports[_0xb548('0x4f')]=function(_0x5d5e88,_0x42c291){var _0x40c643={'raw':!![],'where':{'id':_0x5d5e88[_0xb548('0x50')]['id']}},_0x493543={};_0x493543[_0xb548('0x3e')]=_[_0xb548('0x3c')](db[_0xb548('0x36')][_0xb548('0x37')]);_0x493543[_0xb548('0x3b')]=_['keys'](_0x5d5e88[_0xb548('0x3b')]);_0x493543[_0xb548('0x3d')]=_[_0xb548('0x40')](_0x493543[_0xb548('0x3e')],_0x493543['query']);_0x40c643['attributes']=_['intersection'](_0x493543['model'],qs['fields'](_0x5d5e88[_0xb548('0x3b')][_0xb548('0x41')]));_0x40c643['attributes']=_0x40c643[_0xb548('0x3f')]['length']?_0x40c643[_0xb548('0x3f')]:_0x493543[_0xb548('0x3e')];if(_0x5d5e88[_0xb548('0x3b')][_0xb548('0x4b')]){_0x40c643[_0xb548('0x4c')]=[{'all':!![]}];}_0x40c643=_[_0xb548('0x48')]({},_0x40c643,_0x5d5e88[_0xb548('0x4a')]);return db['Network']['find'](_0x40c643)['then'](handleEntityNotFound(_0x42c291,null))[_0xb548('0x1b')](respondWithResult(_0x42c291,null))[_0xb548('0x4e')](handleError(_0x42c291,null));};exports[_0xb548('0x51')]=function(_0x1adf7b,_0x199ef3,_0x44365e){var _0x34a863;return db[_0xb548('0x52')][_0xb548('0x53')](function(_0x243a15){return db[_0xb548('0x36')][_0xb548('0x51')](_0x1adf7b[_0xb548('0x54')],{'raw':!![]})[_0xb548('0x1b')](function(_0x3a727c){_0x34a863=_0x3a727c;return db[_0xb548('0x36')][_0xb548('0x55')]({'where':{'type':_0x1adf7b[_0xb548('0x54')][_0xb548('0x39')]},'raw':!![]});})[_0xb548('0x1b')](function(_0xb0d19f){if(_0x34a863[_0xb548('0x39')][_0xb548('0x56')]()==_0xb548('0x57')){var _0x57576b=fs[_0xb548('0x58')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),_0xb548('0x59'));var _0x3ed367=ejs[_0xb548('0x5a')](_0x57576b,{'networks':_0xb0d19f||[]});fs[_0xb548('0x5b')](_0xb548('0x5c'),_0x3ed367);return respondWithRpcPromise(_0xb548('0x5d'),_0xb548('0x51'),{'module':'res_stun_monitor.so'});}else if(_0x34a863[_0xb548('0x39')][_0xb548('0x56')]()==_0xb548('0x5e')){var _0x46c359=fs[_0xb548('0x58')](path[_0xb548('0x5f')](config[_0xb548('0x60')],_0xb548('0x61')),'utf8');var _0x1bbaa6=ejs[_0xb548('0x5a')](_0x46c359,{'networks':_0xb0d19f||[]});fs[_0xb548('0x5b')](_0xb548('0x62'),_0x1bbaa6);return respondWithRpcPromise('Reload',_0xb548('0x51'),{'module':_0xb548('0x63')});}else{var _0x5559b9=fs[_0xb548('0x58')](path[_0xb548('0x5f')](config['root'],_0xb548('0x64')),_0xb548('0x59'));var _0x26a446=ejs[_0xb548('0x5a')](_0x5559b9,{'networks':_0xb0d19f||[]});fs[_0xb548('0x5b')](util[_0xb548('0x65')](_0xb548('0x66'),_0x1adf7b[_0xb548('0x54')][_0xb548('0x39')][_0xb548('0x67')]()),_0x26a446);return respondWithRpcPromise('Reload',_0xb548('0x51'),{'module':_0xb548('0x68')});}return null;})[_0xb548('0x1b')](function(){return _0x34a863;});})[_0xb548('0x1b')](respondWithResult(_0x199ef3,0xc9))[_0xb548('0x4e')](handleError(_0x199ef3,null));};exports[_0xb548('0x2f')]=function(_0x3e8dee,_0x13b8f3,_0x56ff60){var _0x33e1fe;return db['sequelize'][_0xb548('0x53')](function(_0x2c1de8){return db['Network']['find']({'where':{'id':_0x3e8dee['params']['id']}})['then'](handleEntityNotFound(_0x13b8f3,null))[_0xb548('0x1b')](saveUpdates(_0x3e8dee['body'],null))[_0xb548('0x1b')](function(_0x2b5d88){if(_0x2b5d88){_0x33e1fe=_0x2b5d88;return db['Network'][_0xb548('0x55')]({'where':{'type':_0x33e1fe[_0xb548('0x39')]},'raw':!![]});}return null;})[_0xb548('0x1b')](function(_0x19a152){if(_0x33e1fe['type'][_0xb548('0x56')]()=='STUN'){var _0x1b84ff=fs[_0xb548('0x58')](path[_0xb548('0x5f')](config[_0xb548('0x60')],_0xb548('0x69')),_0xb548('0x59'));var _0x4a233d=ejs[_0xb548('0x5a')](_0x1b84ff,{'networks':_0x19a152||[]});fs[_0xb548('0x5b')](_0xb548('0x5c'),_0x4a233d);return respondWithRpcPromise(_0xb548('0x5d'),_0xb548('0x2f'),{'module':_0xb548('0x63')});}else if(_0x33e1fe[_0xb548('0x39')][_0xb548('0x56')]()==_0xb548('0x5e')){var _0x29da4d=fs[_0xb548('0x58')](path[_0xb548('0x5f')](config[_0xb548('0x60')],_0xb548('0x61')),_0xb548('0x59'));var _0x85b6e0=ejs[_0xb548('0x5a')](_0x29da4d,{'networks':_0x19a152||[]});fs[_0xb548('0x5b')](_0xb548('0x62'),_0x85b6e0);return respondWithRpcPromise(_0xb548('0x5d'),'update',{'module':_0xb548('0x63')});}else{var _0x19a448=fs['readFileSync'](path[_0xb548('0x5f')](config[_0xb548('0x60')],_0xb548('0x64')),'utf8');var _0xf7f71e=ejs[_0xb548('0x5a')](_0x19a448,{'networks':_0x19a152||[]});fs[_0xb548('0x5b')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x3e8dee[_0xb548('0x54')][_0xb548('0x39')]['toLowerCase']()),_0xf7f71e);return respondWithRpcPromise(_0xb548('0x5d'),'update',{'module':_0xb548('0x68')});}return null;})[_0xb548('0x1b')](function(_0x151a58){if(_0x151a58){return _0x33e1fe;}return null;});})[_0xb548('0x1b')](respondWithResult(_0x13b8f3,null))[_0xb548('0x4e')](handleError(_0x13b8f3,null));};exports[_0xb548('0x30')]=function(_0xf0d3a1,_0xa95ae5,_0x5bfc93){var _0x3955cc;return db[_0xb548('0x36')][_0xb548('0x6a')]({'where':{'id':_0xf0d3a1[_0xb548('0x50')]['id']}})[_0xb548('0x1b')](function(_0x8fed52){_0x3955cc=_0x8fed52;return _0x8fed52;})['then'](handleEntityNotFound(_0xa95ae5,null))[_0xb548('0x1b')](removeEntity(_0xa95ae5,null))[_0xb548('0x1b')](function(){if(_0x3955cc){return db[_0xb548('0x36')][_0xb548('0x55')]({'where':{'type':_0x3955cc[_0xb548('0x39')]},'raw':!![]});}})['then'](function(_0x3390d1){if(_0x3955cc['type'][_0xb548('0x56')]()==_0xb548('0x57')){var _0x25b024=fs[_0xb548('0x58')](path[_0xb548('0x5f')](config['root'],_0xb548('0x69')),_0xb548('0x59'));var _0xa45358=ejs[_0xb548('0x5a')](_0x25b024,{'networks':_0x3390d1||[]});fs['writeFileSync'](_0xb548('0x5c'),_0xa45358);return respondWithRpcPromise(_0xb548('0x5d'),_0xb548('0x30'),{'module':_0xb548('0x63')});}else if(_0x3955cc['type'][_0xb548('0x56')]()=='TURN'){var _0x49824=fs['readFileSync'](path[_0xb548('0x5f')](config[_0xb548('0x60')],_0xb548('0x61')),_0xb548('0x59'));var _0x380529=ejs[_0xb548('0x5a')](_0x49824,{'networks':_0x3390d1||[]});fs[_0xb548('0x5b')](_0xb548('0x62'),_0x380529);return respondWithRpcPromise(_0xb548('0x5d'),_0xb548('0x30'),{'module':_0xb548('0x63')});}else{var _0x833e7f=fs[_0xb548('0x58')](path['join'](config[_0xb548('0x60')],_0xb548('0x64')),_0xb548('0x59'));var _0x123733=ejs[_0xb548('0x5a')](_0x833e7f,{'networks':_0x3390d1||[]});fs[_0xb548('0x5b')](util['format'](_0xb548('0x66'),_0xf0d3a1[_0xb548('0x54')][_0xb548('0x39')][_0xb548('0x67')]()),_0x123733);return respondWithRpcPromise(_0xb548('0x5d'),_0xb548('0x30'),{'module':_0xb548('0x68')});}return null;})['catch'](handleError(_0xa95ae5,null));}; \ No newline at end of file +var _0x7bb0=['count','Content-Range','apply','stack','name','send','index','map','Network','fieldName','key','model','query','keys','filters','intersection','fields','length','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','show','params','rawAttributes','attributes','find','create','sequelize','transaction','body','findAll','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','render','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','STUN','/etc/asterisk/turn_xcally.conf','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../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','offset','undefined','limit'];(function(_0x305190,_0x36b7cb){var _0x4660dc=function(_0x451332){while(--_0x451332){_0x305190['push'](_0x305190['shift']());}};_0x4660dc(++_0x36b7cb);}(_0x7bb0,0xa7));var _0x07bb=function(_0x4f92ec,_0x4c470c){_0x4f92ec=_0x4f92ec-0x0;var _0x31cec9=_0x7bb0[_0x4f92ec];return _0x31cec9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x07bb('0x0'));var zipdir=require(_0x07bb('0x1'));var jsonpatch=require(_0x07bb('0x2'));var rp=require(_0x07bb('0x3'));var moment=require(_0x07bb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x07bb('0x5'));var path=require('path');var sox=require(_0x07bb('0x6'));var csv=require(_0x07bb('0x7'));var ejs=require(_0x07bb('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x07bb('0x9'));var squel=require(_0x07bb('0xa'));var crypto=require(_0x07bb('0xb'));var jsforce=require(_0x07bb('0xc'));var deskjs=require(_0x07bb('0xd'));var toCsv=require(_0x07bb('0x7'));var querystring=require(_0x07bb('0xe'));var Papa=require(_0x07bb('0xf'));var Redis=require(_0x07bb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x07bb('0x11'));var as=require(_0x07bb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x07bb('0x13'))('api');var utils=require(_0x07bb('0x14'));var config=require(_0x07bb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x07bb('0x16'))['db'];var jayson=require(_0x07bb('0x17'));var client=jayson[_0x07bb('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x389f45,_0x26ef66,_0x547958,_0x20c68a){return new BPromise(function(_0x3fcac0,_0x1441bf){var _0x17fa3f=_0x20c68a||client;return _0x17fa3f[_0x07bb('0x19')](_0x389f45,_0x547958)[_0x07bb('0x1a')](function(_0x32892a){logger[_0x07bb('0x1b')](_0x07bb('0x1c'),_0x26ef66,_0x07bb('0x1d'));logger[_0x07bb('0x1e')](_0x07bb('0x1f'),_0x26ef66,_0x07bb('0x1d'),JSON['stringify'](_0x32892a));if(_0x32892a[_0x07bb('0x20')]){if(_0x32892a[_0x07bb('0x20')][_0x07bb('0x21')]===0x1f4){logger[_0x07bb('0x20')](_0x07bb('0x1c'),_0x26ef66,_0x32892a[_0x07bb('0x20')][_0x07bb('0x22')]);return _0x1441bf(_0x32892a[_0x07bb('0x20')][_0x07bb('0x22')]);}logger[_0x07bb('0x20')](_0x07bb('0x1c'),_0x26ef66,_0x32892a['error']['message']);return _0x3fcac0(_0x32892a[_0x07bb('0x20')][_0x07bb('0x22')]);}else{logger['info'](_0x07bb('0x1c'),_0x26ef66,_0x07bb('0x1d'));_0x3fcac0(_0x32892a[_0x07bb('0x23')][_0x07bb('0x22')]);}})[_0x07bb('0x24')](function(_0x1a5abb){logger[_0x07bb('0x20')]('Network,\x20%s,\x20%s',_0x26ef66,_0x1a5abb);_0x1441bf(_0x1a5abb);});});}function respondWithStatusCode(_0x6ce47f,_0x4630b7){_0x4630b7=_0x4630b7||0xcc;return function(_0x47b74c){if(_0x47b74c){return _0x6ce47f[_0x07bb('0x25')](_0x4630b7);}return _0x6ce47f[_0x07bb('0x26')](_0x4630b7)[_0x07bb('0x27')]();};}function respondWithResult(_0x268b22,_0x32c065){_0x32c065=_0x32c065||0xc8;return function(_0x53523f){if(_0x53523f){return _0x268b22[_0x07bb('0x26')](_0x32c065)['json'](_0x53523f);}};}function respondWithFilteredResult(_0x336bcc,_0x12f2a7){return function(_0x31c26b){if(_0x31c26b){var _0x13eaf8=typeof _0x12f2a7[_0x07bb('0x28')]===_0x07bb('0x29')&&typeof _0x12f2a7[_0x07bb('0x2a')]==='undefined';var _0x1a1882=_0x31c26b[_0x07bb('0x2b')];var _0x5f1883=_0x13eaf8?0x0:_0x12f2a7[_0x07bb('0x28')];var _0x100174=_0x13eaf8?_0x31c26b[_0x07bb('0x2b')]:_0x12f2a7[_0x07bb('0x28')]+_0x12f2a7[_0x07bb('0x2a')];var _0x296727;if(_0x100174>=_0x1a1882){_0x100174=_0x1a1882;_0x296727=0xc8;}else{_0x296727=0xce;}_0x336bcc[_0x07bb('0x26')](_0x296727);return _0x336bcc['set'](_0x07bb('0x2c'),_0x5f1883+'-'+_0x100174+'/'+_0x1a1882)['json'](_0x31c26b);}return null;};}function patchUpdates(_0xedc54c){return function(_0x1cf970){try{jsonpatch[_0x07bb('0x2d')](_0x1cf970,_0xedc54c,!![]);}catch(_0x2db3b0){return BPromise['reject'](_0x2db3b0);}return _0x1cf970['save']();};}function saveUpdates(_0x3a9232,_0x2f5040){return function(_0x46ef9a){if(_0x46ef9a){return _0x46ef9a['update'](_0x3a9232)[_0x07bb('0x1a')](function(_0x19c589){return _0x19c589;});}return null;};}function removeEntity(_0x2e24c4,_0x50b4d3){return function(_0x6d857a){if(_0x6d857a){return _0x6d857a['destroy']()[_0x07bb('0x1a')](function(){_0x2e24c4[_0x07bb('0x26')](0xcc)[_0x07bb('0x27')]();});}};}function handleEntityNotFound(_0x2bdc66,_0x3082c4){return function(_0x5cc071){if(!_0x5cc071){_0x2bdc66[_0x07bb('0x25')](0x194);}return _0x5cc071;};}function handleError(_0xf6a018,_0x4dd7fd){_0x4dd7fd=_0x4dd7fd||0x1f4;return function(_0x305f93){logger[_0x07bb('0x20')](_0x305f93[_0x07bb('0x2e')]);if(_0x305f93[_0x07bb('0x2f')]){delete _0x305f93['name'];}_0xf6a018[_0x07bb('0x26')](_0x4dd7fd)[_0x07bb('0x30')](_0x305f93);};}exports[_0x07bb('0x31')]=function(_0x132bc6,_0x30a340){var _0x573714={},_0x51c103={},_0x231f4b={'count':0x0,'rows':[]};var _0x1989e4=_[_0x07bb('0x32')](db[_0x07bb('0x33')]['rawAttributes'],function(_0xf264b0){return{'name':_0xf264b0[_0x07bb('0x34')],'type':_0xf264b0['type'][_0x07bb('0x35')]};});_0x51c103[_0x07bb('0x36')]=_[_0x07bb('0x32')](_0x1989e4,_0x07bb('0x2f'));_0x51c103[_0x07bb('0x37')]=_[_0x07bb('0x38')](_0x132bc6[_0x07bb('0x37')]);_0x51c103[_0x07bb('0x39')]=_[_0x07bb('0x3a')](_0x51c103['model'],_0x51c103[_0x07bb('0x37')]);_0x573714['attributes']=_[_0x07bb('0x3a')](_0x51c103['model'],qs['fields'](_0x132bc6[_0x07bb('0x37')][_0x07bb('0x3b')]));_0x573714['attributes']=_0x573714['attributes'][_0x07bb('0x3c')]?_0x573714['attributes']:_0x51c103['model'];if(!_0x132bc6['query']['hasOwnProperty']('nolimit')){_0x573714['limit']=qs[_0x07bb('0x2a')](_0x132bc6['query'][_0x07bb('0x2a')]);_0x573714[_0x07bb('0x28')]=qs[_0x07bb('0x28')](_0x132bc6[_0x07bb('0x37')][_0x07bb('0x28')]);}_0x573714[_0x07bb('0x3d')]=qs['sort'](_0x132bc6['query'][_0x07bb('0x3e')]);_0x573714[_0x07bb('0x3f')]=qs[_0x07bb('0x39')](_[_0x07bb('0x40')](_0x132bc6['query'],_0x51c103['filters']),_0x1989e4);if(_0x132bc6[_0x07bb('0x37')][_0x07bb('0x41')]){_0x573714[_0x07bb('0x3f')]=_['merge'](_0x573714[_0x07bb('0x3f')],{'$or':_[_0x07bb('0x32')](_0x1989e4,function(_0x32bfe0){if(_0x32bfe0[_0x07bb('0x42')]!==_0x07bb('0x43')){var _0x409fe3={};_0x409fe3[_0x32bfe0[_0x07bb('0x2f')]]={'$like':'%'+_0x132bc6[_0x07bb('0x37')][_0x07bb('0x41')]+'%'};return _0x409fe3;}})});}_0x573714=_[_0x07bb('0x44')]({},_0x573714,_0x132bc6[_0x07bb('0x45')]);var _0x3c78c6={'where':_0x573714[_0x07bb('0x3f')]};return db[_0x07bb('0x33')][_0x07bb('0x2b')](_0x3c78c6)[_0x07bb('0x1a')](function(_0x37f1f4){_0x231f4b[_0x07bb('0x2b')]=_0x37f1f4;if(_0x132bc6[_0x07bb('0x37')][_0x07bb('0x46')]){_0x573714[_0x07bb('0x47')]=[{'all':!![]}];}return db[_0x07bb('0x33')]['findAll'](_0x573714);})['then'](function(_0x3f35be){_0x231f4b[_0x07bb('0x48')]=_0x3f35be;return _0x231f4b;})[_0x07bb('0x1a')](respondWithFilteredResult(_0x30a340,_0x573714))['catch'](handleError(_0x30a340,null));};exports[_0x07bb('0x49')]=function(_0xc8dc75,_0x142575){var _0x1f1b12={'raw':!![],'where':{'id':_0xc8dc75[_0x07bb('0x4a')]['id']}},_0x54d173={};_0x54d173['model']=_[_0x07bb('0x38')](db[_0x07bb('0x33')][_0x07bb('0x4b')]);_0x54d173[_0x07bb('0x37')]=_[_0x07bb('0x38')](_0xc8dc75[_0x07bb('0x37')]);_0x54d173['filters']=_['intersection'](_0x54d173[_0x07bb('0x36')],_0x54d173[_0x07bb('0x37')]);_0x1f1b12[_0x07bb('0x4c')]=_[_0x07bb('0x3a')](_0x54d173[_0x07bb('0x36')],qs[_0x07bb('0x3b')](_0xc8dc75[_0x07bb('0x37')]['fields']));_0x1f1b12['attributes']=_0x1f1b12[_0x07bb('0x4c')][_0x07bb('0x3c')]?_0x1f1b12['attributes']:_0x54d173['model'];if(_0xc8dc75[_0x07bb('0x37')][_0x07bb('0x46')]){_0x1f1b12[_0x07bb('0x47')]=[{'all':!![]}];}_0x1f1b12=_[_0x07bb('0x44')]({},_0x1f1b12,_0xc8dc75[_0x07bb('0x45')]);return db['Network'][_0x07bb('0x4d')](_0x1f1b12)[_0x07bb('0x1a')](handleEntityNotFound(_0x142575,null))['then'](respondWithResult(_0x142575,null))[_0x07bb('0x24')](handleError(_0x142575,null));};exports[_0x07bb('0x4e')]=function(_0x5acdb0,_0x19901d,_0x35eaf8){var _0x2b85ed;return db[_0x07bb('0x4f')][_0x07bb('0x50')](function(_0x195f05){return db[_0x07bb('0x33')][_0x07bb('0x4e')](_0x5acdb0[_0x07bb('0x51')],{'raw':!![]})['then'](function(_0x17f987){_0x2b85ed=_0x17f987;return db[_0x07bb('0x33')][_0x07bb('0x52')]({'where':{'type':_0x5acdb0[_0x07bb('0x51')]['type']},'raw':!![]});})[_0x07bb('0x1a')](function(_0xf5a0f){if(_0x2b85ed[_0x07bb('0x42')]['toUpperCase']()=='STUN'){var _0x4d867f=fs[_0x07bb('0x53')](path[_0x07bb('0x54')](config[_0x07bb('0x55')],_0x07bb('0x56')),_0x07bb('0x57'));var _0x237e6d=ejs['render'](_0x4d867f,{'networks':_0xf5a0f||[]});fs[_0x07bb('0x58')](_0x07bb('0x59'),_0x237e6d);return respondWithRpcPromise(_0x07bb('0x5a'),_0x07bb('0x4e'),{'module':_0x07bb('0x5b')});}else if(_0x2b85ed[_0x07bb('0x42')][_0x07bb('0x5c')]()==_0x07bb('0x5d')){var _0x85b12f=fs['readFileSync'](path[_0x07bb('0x54')](config[_0x07bb('0x55')],_0x07bb('0x5e')),_0x07bb('0x57'));var _0x1aee02=ejs[_0x07bb('0x5f')](_0x85b12f,{'networks':_0xf5a0f||[]});fs[_0x07bb('0x58')]('/etc/asterisk/turn_xcally.conf',_0x1aee02);return respondWithRpcPromise('Reload',_0x07bb('0x4e'),{'module':'res_stun_monitor.so'});}else{var _0x5d889b=fs[_0x07bb('0x53')](path[_0x07bb('0x54')](config[_0x07bb('0x55')],_0x07bb('0x60')),_0x07bb('0x57'));var _0x37ea31=ejs[_0x07bb('0x5f')](_0x5d889b,{'networks':_0xf5a0f||[]});fs[_0x07bb('0x58')](util[_0x07bb('0x61')](_0x07bb('0x62'),_0x5acdb0['body'][_0x07bb('0x42')][_0x07bb('0x63')]()),_0x37ea31);return respondWithRpcPromise(_0x07bb('0x5a'),'create',{'module':_0x07bb('0x64')});}return null;})[_0x07bb('0x1a')](function(){return _0x2b85ed;});})[_0x07bb('0x1a')](respondWithResult(_0x19901d,0xc9))['catch'](handleError(_0x19901d,null));};exports[_0x07bb('0x65')]=function(_0x561519,_0x130e7b,_0x5e65c3){var _0x2257da;return db['sequelize'][_0x07bb('0x50')](function(_0x1aca69){return db[_0x07bb('0x33')][_0x07bb('0x4d')]({'where':{'id':_0x561519['params']['id']}})['then'](handleEntityNotFound(_0x130e7b,null))[_0x07bb('0x1a')](saveUpdates(_0x561519['body'],null))[_0x07bb('0x1a')](function(_0x301d57){if(_0x301d57){_0x2257da=_0x301d57;return db[_0x07bb('0x33')][_0x07bb('0x52')]({'where':{'type':_0x2257da['type']},'raw':!![]});}return null;})[_0x07bb('0x1a')](function(_0x314f44){if(_0x2257da[_0x07bb('0x42')][_0x07bb('0x5c')]()==_0x07bb('0x66')){var _0x6fef1c=fs[_0x07bb('0x53')](path[_0x07bb('0x54')](config[_0x07bb('0x55')],_0x07bb('0x56')),'utf8');var _0x57ab0d=ejs[_0x07bb('0x5f')](_0x6fef1c,{'networks':_0x314f44||[]});fs[_0x07bb('0x58')](_0x07bb('0x59'),_0x57ab0d);return respondWithRpcPromise(_0x07bb('0x5a'),'update',{'module':_0x07bb('0x5b')});}else if(_0x2257da[_0x07bb('0x42')]['toUpperCase']()==_0x07bb('0x5d')){var _0x52212a=fs[_0x07bb('0x53')](path['join'](config[_0x07bb('0x55')],'server/files/templates/turn_multiple.ejs'),_0x07bb('0x57'));var _0x41a17e=ejs[_0x07bb('0x5f')](_0x52212a,{'networks':_0x314f44||[]});fs[_0x07bb('0x58')](_0x07bb('0x67'),_0x41a17e);return respondWithRpcPromise(_0x07bb('0x5a'),_0x07bb('0x65'),{'module':_0x07bb('0x5b')});}else{var _0x8896bf=fs['readFileSync'](path[_0x07bb('0x54')](config[_0x07bb('0x55')],_0x07bb('0x60')),_0x07bb('0x57'));var _0x24155d=ejs[_0x07bb('0x5f')](_0x8896bf,{'networks':_0x314f44||[]});fs[_0x07bb('0x58')](util[_0x07bb('0x61')]('/etc/asterisk/sip_xcally_%s.conf',_0x561519[_0x07bb('0x51')][_0x07bb('0x42')][_0x07bb('0x63')]()),_0x24155d);return respondWithRpcPromise(_0x07bb('0x5a'),'update',{'module':_0x07bb('0x64')});}return null;})[_0x07bb('0x1a')](function(_0x3a5f1a){if(_0x3a5f1a){return _0x2257da;}return null;});})['then'](respondWithResult(_0x130e7b,null))['catch'](handleError(_0x130e7b,null));};exports[_0x07bb('0x68')]=function(_0x2c59c0,_0x18baf7,_0x5b5d4a){var _0x3b416f;return db[_0x07bb('0x33')]['find']({'where':{'id':_0x2c59c0[_0x07bb('0x4a')]['id']}})['then'](function(_0x29116f){_0x3b416f=_0x29116f;return _0x29116f;})['then'](handleEntityNotFound(_0x18baf7,null))[_0x07bb('0x1a')](removeEntity(_0x18baf7,null))[_0x07bb('0x1a')](function(){if(_0x3b416f){return db[_0x07bb('0x33')][_0x07bb('0x52')]({'where':{'type':_0x3b416f[_0x07bb('0x42')]},'raw':!![]});}})['then'](function(_0x1ac871){if(_0x3b416f[_0x07bb('0x42')]['toUpperCase']()==_0x07bb('0x66')){var _0x367d44=fs[_0x07bb('0x53')](path[_0x07bb('0x54')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x07bb('0x57'));var _0x4289af=ejs['render'](_0x367d44,{'networks':_0x1ac871||[]});fs['writeFileSync'](_0x07bb('0x59'),_0x4289af);return respondWithRpcPromise(_0x07bb('0x5a'),_0x07bb('0x68'),{'module':_0x07bb('0x5b')});}else if(_0x3b416f[_0x07bb('0x42')][_0x07bb('0x5c')]()=='TURN'){var _0x2afc7e=fs[_0x07bb('0x53')](path[_0x07bb('0x54')](config[_0x07bb('0x55')],_0x07bb('0x5e')),_0x07bb('0x57'));var _0x483d3a=ejs[_0x07bb('0x5f')](_0x2afc7e,{'networks':_0x1ac871||[]});fs[_0x07bb('0x58')](_0x07bb('0x67'),_0x483d3a);return respondWithRpcPromise('Reload',_0x07bb('0x68'),{'module':'res_stun_monitor.so'});}else{var _0x146277=fs[_0x07bb('0x53')](path[_0x07bb('0x54')](config[_0x07bb('0x55')],_0x07bb('0x60')),_0x07bb('0x57'));var _0x5ac02c=ejs[_0x07bb('0x5f')](_0x146277,{'networks':_0x1ac871||[]});fs[_0x07bb('0x58')](util['format'](_0x07bb('0x62'),_0x2c59c0[_0x07bb('0x51')]['type'][_0x07bb('0x63')]()),_0x5ac02c);return respondWithRpcPromise(_0x07bb('0x5a'),'destroy',{'module':_0x07bb('0x64')});}return null;})[_0x07bb('0x24')](handleError(_0x18baf7,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 4cd7c18..a551130 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 _0x41bb=['bluebird','request-promise','path','rimraf','./network.attributes','exports','network','lodash','util','api'];(function(_0x501973,_0x1cfbf4){var _0x597c49=function(_0x474a94){while(--_0x474a94){_0x501973['push'](_0x501973['shift']());}};_0x597c49(++_0x1cfbf4);}(_0x41bb,0xc5));var _0xb41b=function(_0x2723da,_0x4cc0ee){_0x2723da=_0x2723da-0x0;var _0x2ac9ec=_0x41bb[_0x2723da];return _0x2ac9ec;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var moment=require('moment');var BPromise=require(_0xb41b('0x3'));var rp=require(_0xb41b('0x4'));var fs=require('fs');var path=require(_0xb41b('0x5'));var rimraf=require(_0xb41b('0x6'));var config=require('../../config/environment');var attributes=require(_0xb41b('0x7'));module[_0xb41b('0x8')]=function(_0x2dbaa3,_0x50bc62){return _0x2dbaa3['define']('Network',attributes,{'tableName':_0xb41b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcea2=['../../config/environment','./network.attributes','define','Network','network','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x16db0f,_0x582aee){var _0x2f0b8d=function(_0x51444b){while(--_0x51444b){_0x16db0f['push'](_0x16db0f['shift']());}};_0x2f0b8d(++_0x582aee);}(_0xcea2,0x15a));var _0x2cea=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xcea2[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var logger=require(_0x2cea('0x1'))('api');var moment=require(_0x2cea('0x2'));var BPromise=require(_0x2cea('0x3'));var rp=require(_0x2cea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var attributes=require(_0x2cea('0x7'));module['exports']=function(_0x34f0f2,_0x485c26){return _0x34f0f2[_0x2cea('0x8')](_0x2cea('0x9'),attributes,{'tableName':_0x2cea('0xa'),'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 7a8568e..a1feed8 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x126d56,_0x2c6027){var _0x1687c0=function(_0x225b3f){while(--_0x225b3f){_0x126d56['push'](_0x126d56['shift']());}};_0x1687c0(++_0x2c6027);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x34229f,_0x38320c){var _0x4f9349=function(_0x3126f0){while(--_0x3126f0){_0x34229f['push'](_0x34229f['shift']());}};_0x4f9349(++_0x38320c);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index a0e1894..af8441b 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 _0xd301=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addAgents','/:id/send','put','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd301,0x1c2));var _0x1d30=function(_0x4e0964,_0x4c179b){_0x4e0964=_0x4e0964-0x0;var _0x34eadf=_0xd301[_0x4e0964];return _0x34eadf;};'use strict';var multer=require(_0x1d30('0x0'));var util=require(_0x1d30('0x1'));var path=require(_0x1d30('0x2'));var timeout=require('connect-timeout');var express=require(_0x1d30('0x3'));var router=express[_0x1d30('0x4')]();var fs_extra=require(_0x1d30('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1d30('0x6'));var config=require(_0x1d30('0x7'));var controller=require(_0x1d30('0x8'));router[_0x1d30('0x9')]('/',auth[_0x1d30('0xa')](),controller[_0x1d30('0xb')]);router['get'](_0x1d30('0xc'),auth[_0x1d30('0xa')](),controller[_0x1d30('0xd')]);router[_0x1d30('0x9')](_0x1d30('0xe'),auth[_0x1d30('0xa')](),controller[_0x1d30('0xf')]);router[_0x1d30('0x9')](_0x1d30('0x10'),auth[_0x1d30('0xa')](),controller[_0x1d30('0x11')]);router[_0x1d30('0x9')](_0x1d30('0x12'),auth[_0x1d30('0xa')](),controller[_0x1d30('0x13')]);router[_0x1d30('0x9')](_0x1d30('0x14'),auth['isAuthenticated'](),controller[_0x1d30('0x15')]);router[_0x1d30('0x9')](_0x1d30('0x16'),auth['isAuthenticated'](),controller[_0x1d30('0x17')]);router[_0x1d30('0x9')](_0x1d30('0x18'),auth[_0x1d30('0xa')](),controller[_0x1d30('0x19')]);router[_0x1d30('0x1a')]('/',auth[_0x1d30('0xa')](),controller[_0x1d30('0x1b')]);router['post'](_0x1d30('0x10'),auth[_0x1d30('0xa')](),controller[_0x1d30('0x1c')]);router[_0x1d30('0x1a')](_0x1d30('0x12'),auth[_0x1d30('0xa')](),controller[_0x1d30('0x1d')]);router[_0x1d30('0x1a')](_0x1d30('0x1e'),controller[_0x1d30('0x1f')]);router[_0x1d30('0x1a')](_0x1d30('0x14'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x1d30('0x18'),auth[_0x1d30('0xa')](),controller[_0x1d30('0x20')]);router['post'](_0x1d30('0x21'),auth[_0x1d30('0xa')](),controller['send']);router[_0x1d30('0x22')](_0x1d30('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1d30('0xe'),auth['isAuthenticated'](),controller[_0x1d30('0x23')]);router[_0x1d30('0x24')](_0x1d30('0x10'),auth['isAuthenticated'](),controller[_0x1d30('0x25')]);router[_0x1d30('0x24')]('/:id/canned_answers',auth[_0x1d30('0xa')](),controller[_0x1d30('0x26')]);router['delete'](_0x1d30('0x18'),auth[_0x1d30('0xa')](),controller[_0x1d30('0x27')]);module[_0x1d30('0x28')]=router; \ No newline at end of file +var _0xb790=['../../components/interaction/service','./openchannelAccount.controller','get','index','isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x16fdbe,_0x52b364){var _0x3407d4=function(_0x5a4896){while(--_0x5a4896){_0x16fdbe['push'](_0x16fdbe['shift']());}};_0x3407d4(++_0x52b364);}(_0xb790,0x122));var _0x0b79=function(_0x2a3d50,_0x516d5f){_0x2a3d50=_0x2a3d50-0x0;var _0x41861b=_0xb790[_0x2a3d50];return _0x41861b;};'use strict';var multer=require(_0x0b79('0x0'));var util=require('util');var path=require(_0x0b79('0x1'));var timeout=require('connect-timeout');var express=require(_0x0b79('0x2'));var router=express[_0x0b79('0x3')]();var fs_extra=require(_0x0b79('0x4'));var auth=require(_0x0b79('0x5'));var interaction=require(_0x0b79('0x6'));var config=require('../../config/environment');var controller=require(_0x0b79('0x7'));router[_0x0b79('0x8')]('/',auth['isAuthenticated'](),controller[_0x0b79('0x9')]);router['get']('/describe',auth[_0x0b79('0xa')](),controller[_0x0b79('0xb')]);router[_0x0b79('0x8')](_0x0b79('0xc'),auth[_0x0b79('0xa')](),controller[_0x0b79('0xd')]);router[_0x0b79('0x8')]('/:id/dispositions',auth[_0x0b79('0xa')](),controller[_0x0b79('0xe')]);router[_0x0b79('0x8')](_0x0b79('0xf'),auth['isAuthenticated'](),controller[_0x0b79('0x10')]);router['get'](_0x0b79('0x11'),auth[_0x0b79('0xa')](),controller[_0x0b79('0x12')]);router[_0x0b79('0x8')]('/:id/interactions',auth[_0x0b79('0xa')](),controller[_0x0b79('0x13')]);router[_0x0b79('0x8')](_0x0b79('0x14'),auth[_0x0b79('0xa')](),controller[_0x0b79('0x15')]);router[_0x0b79('0x16')]('/',auth[_0x0b79('0xa')](),controller[_0x0b79('0x17')]);router[_0x0b79('0x16')](_0x0b79('0x18'),auth[_0x0b79('0xa')](),controller['addDisposition']);router[_0x0b79('0x16')]('/:id/canned_answers',auth[_0x0b79('0xa')](),controller[_0x0b79('0x19')]);router['post'](_0x0b79('0x1a'),controller[_0x0b79('0x1b')]);router[_0x0b79('0x16')]('/:id/applications',auth[_0x0b79('0xa')](),controller[_0x0b79('0x1c')]);router[_0x0b79('0x16')]('/:id/users',auth[_0x0b79('0xa')](),controller['addAgents']);router[_0x0b79('0x16')](_0x0b79('0x1d'),auth[_0x0b79('0xa')](),controller[_0x0b79('0x1e')]);router[_0x0b79('0x1f')](_0x0b79('0xc'),auth[_0x0b79('0xa')](),controller['update']);router[_0x0b79('0x20')]('/:id',auth[_0x0b79('0xa')](),controller[_0x0b79('0x21')]);router[_0x0b79('0x20')](_0x0b79('0x18'),auth[_0x0b79('0xa')](),controller[_0x0b79('0x22')]);router[_0x0b79('0x20')]('/:id/canned_answers',auth[_0x0b79('0xa')](),controller[_0x0b79('0x23')]);router[_0x0b79('0x20')](_0x0b79('0x14'),auth[_0x0b79('0xa')](),controller['removeAgents']);module[_0x0b79('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 9d3195d..e23a466 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 _0xd06e=['mandatoryDisposition','sequelize','randomstring','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x22e62e,_0x4b5d86){var _0x96ef28=function(_0x2c71a9){while(--_0x2c71a9){_0x22e62e['push'](_0x22e62e['shift']());}};_0x96ef28(++_0x4b5d86);}(_0xd06e,0xdd));var _0xed06=function(_0xa5283c,_0x299a11){_0xa5283c=_0xa5283c-0x0;var _0x4d03fa=_0xd06e[_0xa5283c];return _0x4d03fa;};'use strict';var Sequelize=require(_0xed06('0x0'));var rs=require(_0xed06('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xed06('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xed06('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xed06('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xed06('0x3')],'defaultValue':function(){return _0xed06('0x4');}},'notificationSound':{'type':Sequelize[_0xed06('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xed06('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xed06('0x2')]},'queueTransfer':{'type':Sequelize[_0xed06('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xed06('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xed06('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xed06('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xed06('0x5')],'defaultValue':![],'comment':_0xed06('0x7'),'set':function(_0x4941da){if(!_0x4941da)this[_0xed06('0x8')](_0xed06('0x9'),null);this[_0xed06('0x8')](_0xed06('0xa'),_0x4941da);}}}; \ No newline at end of file +var _0x4825=['setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x5034be,_0x5d2bde){var _0x209668=function(_0x1b13b7){while(--_0x1b13b7){_0x5034be['push'](_0x5034be['shift']());}};_0x209668(++_0x5d2bde);}(_0x4825,0x1be));var _0x5482=function(_0x16f7bd,_0x351325){_0x16f7bd=_0x16f7bd-0x0;var _0x278acd=_0x4825[_0x16f7bd];return _0x278acd;};'use strict';var Sequelize=require(_0x5482('0x0'));var rs=require(_0x5482('0x1'));module[_0x5482('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x5482('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5482('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5482('0x5')],'defaultValue':function(){return _0x5482('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5482('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x5482('0x4')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5482('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5482('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5482('0x7')],'defaultValue':![],'comment':_0x5482('0x9'),'set':function(_0xb92404){if(!_0xb92404)this[_0x5482('0xa')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x5482('0xb'),_0xb92404);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index b43d13e..5e7ea6e 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 _0xcaf1=['UserProfileResource','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','filter','merge','options','findAll','rows','catch','show','find','create','body','user','get','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','findOne','Disposition','hasOwnProperty','sort','pick','OpenchannelAccountId','include','removeDispositions','ids','CannedAnswer','includeAll','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./openchannelAccount.socket','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','OpenchannelAccounts'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xcaf1,0x142));var _0x1caf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcaf1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1caf('0x0'));var rimraf=require(_0x1caf('0x1'));var zipdir=require(_0x1caf('0x2'));var jsonpatch=require(_0x1caf('0x3'));var rp=require(_0x1caf('0x4'));var moment=require(_0x1caf('0x5'));var BPromise=require(_0x1caf('0x6'));var Mustache=require('mustache');var util=require(_0x1caf('0x7'));var path=require(_0x1caf('0x8'));var sox=require(_0x1caf('0x9'));var csv=require(_0x1caf('0xa'));var ejs=require(_0x1caf('0xb'));var fs=require('fs');var fs_extra=require(_0x1caf('0xc'));var _=require(_0x1caf('0xd'));var squel=require('squel');var crypto=require(_0x1caf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1caf('0xf'));var toCsv=require(_0x1caf('0xa'));var querystring=require(_0x1caf('0x10'));var Papa=require('papaparse');var Redis=require(_0x1caf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1caf('0x12'));var as=require(_0x1caf('0x13'));var hardwareService=require(_0x1caf('0x14'));var logger=require(_0x1caf('0x15'))(_0x1caf('0x16'));var utils=require(_0x1caf('0x17'));var config=require(_0x1caf('0x18'));var licenseUtil=require(_0x1caf('0x19'));var db=require(_0x1caf('0x1a'))['db'];config['redis']=_['defaults'](config[_0x1caf('0x1b')],{'host':_0x1caf('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1caf('0x1b')]));require(_0x1caf('0x1d'))['register'](socket);var jayson=require(_0x1caf('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x1caf('0x1f')][_0x1caf('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3dc1ab,_0x5d7404,_0xcde4c8,_0x5f2477){return new BPromise(function(_0x5294e5,_0x1fb32e){var _0x1fcd82=_0x5f2477||client;return _0x1fcd82[_0x1caf('0x21')](_0x3dc1ab,_0xcde4c8)[_0x1caf('0x22')](function(_0x21cea7){logger[_0x1caf('0x23')](_0x1caf('0x24'),_0x5d7404,_0x1caf('0x25'));logger['debug'](_0x1caf('0x26'),_0x5d7404,_0x1caf('0x25'),JSON['stringify'](_0x21cea7));if(_0x21cea7['error']){if(_0x21cea7['error'][_0x1caf('0x27')]===0x1f4){logger[_0x1caf('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x5d7404,_0x21cea7[_0x1caf('0x28')][_0x1caf('0x29')]);return _0x1fb32e(_0x21cea7['error'][_0x1caf('0x29')]);}logger['error'](_0x1caf('0x24'),_0x5d7404,_0x21cea7['error'][_0x1caf('0x29')]);return _0x5294e5(_0x21cea7[_0x1caf('0x28')][_0x1caf('0x29')]);}else{logger[_0x1caf('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x5d7404,'request\x20sent');_0x5294e5(_0x21cea7[_0x1caf('0x2a')]['message']);}})['catch'](function(_0x2d57c7){logger[_0x1caf('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x5d7404,_0x2d57c7);_0x1fb32e(_0x2d57c7);});});}function respondWithStatusCode(_0x2fe714,_0x4ed7ba){_0x4ed7ba=_0x4ed7ba||0xcc;return function(_0x36dc6b){if(_0x36dc6b){return _0x2fe714['sendStatus'](_0x4ed7ba);}return _0x2fe714[_0x1caf('0x2b')](_0x4ed7ba)['end']();};}function respondWithResult(_0x15d3c8,_0x4561fd){_0x4561fd=_0x4561fd||0xc8;return function(_0x3d2f54){if(_0x3d2f54){return _0x15d3c8['status'](_0x4561fd)['json'](_0x3d2f54);}};}function respondWithFilteredResult(_0x20e2a6,_0x39b9a4){return function(_0xfeb2ac){if(_0xfeb2ac){var _0x184a0c=typeof _0x39b9a4[_0x1caf('0x2c')]===_0x1caf('0x2d')&&typeof _0x39b9a4[_0x1caf('0x2e')]==='undefined';var _0x4d3d0f=_0xfeb2ac['count'];var _0x5da902=_0x184a0c?0x0:_0x39b9a4[_0x1caf('0x2c')];var _0x49dd0d=_0x184a0c?_0xfeb2ac[_0x1caf('0x2f')]:_0x39b9a4[_0x1caf('0x2c')]+_0x39b9a4['limit'];var _0x2e65e9;if(_0x49dd0d>=_0x4d3d0f){_0x49dd0d=_0x4d3d0f;_0x2e65e9=0xc8;}else{_0x2e65e9=0xce;}_0x20e2a6[_0x1caf('0x2b')](_0x2e65e9);return _0x20e2a6[_0x1caf('0x30')](_0x1caf('0x31'),_0x5da902+'-'+_0x49dd0d+'/'+_0x4d3d0f)['json'](_0xfeb2ac);}return null;};}function patchUpdates(_0x1d4cae){return function(_0x55ea97){try{jsonpatch[_0x1caf('0x32')](_0x55ea97,_0x1d4cae,!![]);}catch(_0x3abcff){return BPromise[_0x1caf('0x33')](_0x3abcff);}return _0x55ea97[_0x1caf('0x34')]();};}function saveUpdates(_0x1e4f7b,_0x4e19a5){return function(_0x37307c){if(_0x37307c){return _0x37307c[_0x1caf('0x35')](_0x1e4f7b)[_0x1caf('0x22')](function(_0x153307){return _0x153307;});}return null;};}function removeEntity(_0x16cb2f,_0x3c2e13){return function(_0x4d8387){if(_0x4d8387){return _0x4d8387[_0x1caf('0x36')]()[_0x1caf('0x22')](function(){var _0x54b08a=_0x4d8387['get']({'plain':!![]});var _0x56a6e8=_0x1caf('0x37');return db[_0x1caf('0x38')]['destroy']({'where':{'type':_0x56a6e8,'resourceId':_0x54b08a['id']}})[_0x1caf('0x22')](function(){return _0x4d8387;});})[_0x1caf('0x22')](function(){_0x16cb2f['status'](0xcc)[_0x1caf('0x39')]();});}};}function handleEntityNotFound(_0x26a04b,_0x7ad7c2){return function(_0x10ab1f){if(!_0x10ab1f){_0x26a04b[_0x1caf('0x3a')](0x194);}return _0x10ab1f;};}function handleError(_0x51bef1,_0x1ca240){_0x1ca240=_0x1ca240||0x1f4;return function(_0x267f3d){logger[_0x1caf('0x28')](_0x267f3d[_0x1caf('0x3b')]);if(_0x267f3d[_0x1caf('0x3c')]){delete _0x267f3d[_0x1caf('0x3c')];}_0x51bef1['status'](_0x1ca240)[_0x1caf('0x3d')](_0x267f3d);};}exports[_0x1caf('0x3e')]=function(_0x162d79,_0x5004c0){var _0xf093f5={'include':[{'model':db[_0x1caf('0x3f')],'as':_0x1caf('0x40')}]},_0x5cf7c5={},_0x3f58b1={'count':0x0,'rows':[]};var _0x4885a0=_[_0x1caf('0x41')](db[_0x1caf('0x42')][_0x1caf('0x43')],function(_0x3cabb8){return{'name':_0x3cabb8['fieldName'],'type':_0x3cabb8[_0x1caf('0x44')]['key']};});_0x5cf7c5[_0x1caf('0x45')]=_['map'](_0x4885a0,_0x1caf('0x3c'));_0x5cf7c5[_0x1caf('0x46')]=_[_0x1caf('0x47')](_0x162d79['query']);_0x5cf7c5[_0x1caf('0x48')]=_[_0x1caf('0x49')](_0x5cf7c5[_0x1caf('0x45')],_0x5cf7c5[_0x1caf('0x46')]);_0xf093f5[_0x1caf('0x4a')]=_[_0x1caf('0x49')](_0x5cf7c5['model'],qs[_0x1caf('0x4b')](_0x162d79[_0x1caf('0x46')][_0x1caf('0x4b')]));_0xf093f5[_0x1caf('0x4a')]=_0xf093f5[_0x1caf('0x4a')][_0x1caf('0x4c')]?_0xf093f5[_0x1caf('0x4a')]:_0x5cf7c5[_0x1caf('0x45')];if(!_0x162d79[_0x1caf('0x46')]['hasOwnProperty'](_0x1caf('0x4d'))){_0xf093f5[_0x1caf('0x2e')]=qs[_0x1caf('0x2e')](_0x162d79[_0x1caf('0x46')][_0x1caf('0x2e')]);_0xf093f5[_0x1caf('0x2c')]=qs[_0x1caf('0x2c')](_0x162d79[_0x1caf('0x46')]['offset']);}_0xf093f5[_0x1caf('0x4e')]=qs['sort'](_0x162d79[_0x1caf('0x46')]['sort']);_0xf093f5[_0x1caf('0x4f')]=qs[_0x1caf('0x48')](_['pick'](_0x162d79[_0x1caf('0x46')],_0x5cf7c5[_0x1caf('0x48')]),_0x4885a0);if(_0x162d79[_0x1caf('0x46')][_0x1caf('0x50')]){_0xf093f5[_0x1caf('0x4f')]=_[_0x1caf('0x51')](_0xf093f5[_0x1caf('0x4f')],{'$or':_[_0x1caf('0x41')](_0x4885a0,function(_0x17bca6){if(_0x17bca6[_0x1caf('0x44')]!=='VIRTUAL'){var _0x5a9712={};_0x5a9712[_0x17bca6[_0x1caf('0x3c')]]={'$like':'%'+_0x162d79[_0x1caf('0x46')]['filter']+'%'};return _0x5a9712;}})});}_0xf093f5=_[_0x1caf('0x51')]({},_0xf093f5,_0x162d79[_0x1caf('0x52')]);var _0x45dd8b={'where':_0xf093f5[_0x1caf('0x4f')]};return db['OpenchannelAccount']['count'](_0x45dd8b)[_0x1caf('0x22')](function(_0x539a84){_0x3f58b1['count']=_0x539a84;if(_0x162d79[_0x1caf('0x46')]['includeAll']){_0xf093f5['include']=[{'all':!![]}];}return db[_0x1caf('0x42')][_0x1caf('0x53')](_0xf093f5);})[_0x1caf('0x22')](function(_0x38002c){_0x3f58b1[_0x1caf('0x54')]=_0x38002c;return _0x3f58b1;})[_0x1caf('0x22')](respondWithFilteredResult(_0x5004c0,_0xf093f5))[_0x1caf('0x55')](handleError(_0x5004c0,null));};exports[_0x1caf('0x56')]=function(_0x514c68,_0x566466){var _0x1c35b8={'raw':![],'where':{'id':_0x514c68['params']['id']},'include':[{'model':db[_0x1caf('0x3f')],'as':_0x1caf('0x40')}]},_0x48787e={};_0x48787e[_0x1caf('0x45')]=_[_0x1caf('0x47')](db['OpenchannelAccount'][_0x1caf('0x43')]);_0x48787e[_0x1caf('0x46')]=_[_0x1caf('0x47')](_0x514c68[_0x1caf('0x46')]);_0x48787e[_0x1caf('0x48')]=_['intersection'](_0x48787e[_0x1caf('0x45')],_0x48787e[_0x1caf('0x46')]);_0x1c35b8[_0x1caf('0x4a')]=_[_0x1caf('0x49')](_0x48787e[_0x1caf('0x45')],qs[_0x1caf('0x4b')](_0x514c68[_0x1caf('0x46')][_0x1caf('0x4b')]));_0x1c35b8[_0x1caf('0x4a')]=_0x1c35b8[_0x1caf('0x4a')][_0x1caf('0x4c')]?_0x1c35b8[_0x1caf('0x4a')]:_0x48787e['model'];if(_0x514c68[_0x1caf('0x46')]['includeAll']){_0x1c35b8['include']=[{'all':!![]}];}_0x1c35b8=_['merge']({},_0x1c35b8,_0x514c68['options']);return db[_0x1caf('0x42')][_0x1caf('0x57')](_0x1c35b8)[_0x1caf('0x22')](handleEntityNotFound(_0x566466,null))['then'](respondWithResult(_0x566466,null))[_0x1caf('0x55')](handleError(_0x566466,null));};exports[_0x1caf('0x58')]=function(_0x44bcd2,_0x5464a1){return db[_0x1caf('0x42')]['create'](_0x44bcd2[_0x1caf('0x59')],{})[_0x1caf('0x22')](function(_0x2a46f4){var _0x304fac=_0x44bcd2[_0x1caf('0x5a')][_0x1caf('0x5b')]({'plain':!![]});if(!_0x304fac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x304fac['role']==='user'){var _0x4571cb=_0x2a46f4[_0x1caf('0x5b')]({'plain':!![]});var _0x5cb7cd=_0x1caf('0x37');return db['UserProfileSection']['find']({'where':{'name':_0x5cb7cd,'userProfileId':_0x304fac[_0x1caf('0x5c')]},'raw':!![]})[_0x1caf('0x22')](function(_0x547a72){if(_0x547a72&&_0x547a72['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4571cb[_0x1caf('0x3c')],'resourceId':_0x4571cb['id'],'type':_0x547a72[_0x1caf('0x3c')],'sectionId':_0x547a72['id']},{})['then'](function(){return _0x2a46f4;});}else{return _0x2a46f4;}})[_0x1caf('0x55')](function(_0x2032b9){logger[_0x1caf('0x28')](_0x1caf('0x5d'),_0x2032b9);throw _0x2032b9;});}return _0x2a46f4;})[_0x1caf('0x22')](respondWithResult(_0x5464a1,0xc9))[_0x1caf('0x55')](handleError(_0x5464a1,null));};exports[_0x1caf('0x35')]=function(_0x39ec3b,_0x10f853){if(_0x39ec3b['body']['id']){delete _0x39ec3b[_0x1caf('0x59')]['id'];}return db[_0x1caf('0x42')]['find']({'where':{'id':_0x39ec3b[_0x1caf('0x5e')]['id']},'include':[{'model':db[_0x1caf('0x3f')],'as':'mandatoryDispositionPause'}]})[_0x1caf('0x22')](handleEntityNotFound(_0x10f853,null))[_0x1caf('0x22')](saveUpdates(_0x39ec3b[_0x1caf('0x59')],null))['then'](respondWithResult(_0x10f853,null))[_0x1caf('0x55')](handleError(_0x10f853,null));};exports[_0x1caf('0x36')]=function(_0xb9884d,_0x4596d5){return db[_0x1caf('0x42')][_0x1caf('0x57')]({'where':{'id':_0xb9884d[_0x1caf('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4596d5,null))[_0x1caf('0x22')](removeEntity(_0x4596d5,null))[_0x1caf('0x55')](handleError(_0x4596d5,null));};exports['describe']=function(_0x2093e9,_0x52f1db){return db[_0x1caf('0x42')][_0x1caf('0x5f')]()[_0x1caf('0x22')](respondWithResult(_0x52f1db,null))['catch'](handleError(_0x52f1db,null));};exports[_0x1caf('0x60')]=function(_0x2515f0,_0x863c73,_0x9f5630){if(_0x2515f0[_0x1caf('0x59')]['id']){delete _0x2515f0[_0x1caf('0x59')]['id'];}return db[_0x1caf('0x42')][_0x1caf('0x57')]({'where':{'id':_0x2515f0[_0x1caf('0x5e')]['id']}})[_0x1caf('0x22')](handleEntityNotFound(_0x863c73,null))[_0x1caf('0x22')](function(_0x56fe5c){if(_0x56fe5c){_0x2515f0[_0x1caf('0x59')]['OpenchannelAccountId']=_0x56fe5c['id'];return db['Disposition'][_0x1caf('0x58')](_0x2515f0['body']);}})['then'](respondWithResult(_0x863c73,null))[_0x1caf('0x55')](handleError(_0x863c73,null));};exports['getDispositions']=function(_0x58350b,_0x1de83f,_0x50a2e0){var _0x38ad18={'raw':![],'where':{}};var _0xe61c05={};var _0x8d896b={'count':0x0,'rows':[]};return db[_0x1caf('0x42')][_0x1caf('0x61')]({'where':{'id':_0x58350b[_0x1caf('0x5e')]['id']}})[_0x1caf('0x22')](handleEntityNotFound(_0x1de83f,null))[_0x1caf('0x22')](function(_0x39f4a5){if(_0x39f4a5){_0xe61c05[_0x1caf('0x45')]=_[_0x1caf('0x47')](db[_0x1caf('0x62')][_0x1caf('0x43')]);_0xe61c05[_0x1caf('0x46')]=_[_0x1caf('0x47')](_0x58350b['query']);_0xe61c05[_0x1caf('0x48')]=_[_0x1caf('0x49')](_0xe61c05[_0x1caf('0x45')],_0xe61c05[_0x1caf('0x46')]);_0x38ad18[_0x1caf('0x4a')]=_[_0x1caf('0x49')](_0xe61c05[_0x1caf('0x45')],qs[_0x1caf('0x4b')](_0x58350b[_0x1caf('0x46')][_0x1caf('0x4b')]));_0x38ad18[_0x1caf('0x4a')]=_0x38ad18[_0x1caf('0x4a')][_0x1caf('0x4c')]?_0x38ad18[_0x1caf('0x4a')]:_0xe61c05[_0x1caf('0x45')];if(!_0x58350b[_0x1caf('0x46')][_0x1caf('0x63')](_0x1caf('0x4d'))){_0x38ad18['limit']=qs['limit'](_0x58350b[_0x1caf('0x46')][_0x1caf('0x2e')]);_0x38ad18['offset']=qs[_0x1caf('0x2c')](_0x58350b['query']['offset']);}_0x38ad18[_0x1caf('0x4e')]=qs[_0x1caf('0x64')](_0x58350b[_0x1caf('0x46')][_0x1caf('0x64')]);_0x38ad18[_0x1caf('0x4f')]=qs[_0x1caf('0x48')](_[_0x1caf('0x65')](_0x58350b[_0x1caf('0x46')],_0xe61c05['filters']));_0x38ad18[_0x1caf('0x4f')][_0x1caf('0x66')]=_0x39f4a5['id'];if(_0x58350b[_0x1caf('0x46')]['filter']){_0x38ad18[_0x1caf('0x4f')]=_[_0x1caf('0x51')](_0x38ad18[_0x1caf('0x4f')],{'$or':_[_0x1caf('0x41')](_0x38ad18[_0x1caf('0x4a')],function(_0x5df00c){var _0x341ca1={};_0x341ca1[_0x5df00c]={'$like':'%'+_0x58350b[_0x1caf('0x46')][_0x1caf('0x50')]+'%'};return _0x341ca1;})});}_0x38ad18=_[_0x1caf('0x51')]({},_0x38ad18,_0x58350b[_0x1caf('0x52')]);return db[_0x1caf('0x62')][_0x1caf('0x2f')]({'where':_0x38ad18[_0x1caf('0x4f')]})[_0x1caf('0x22')](function(_0x423c76){_0x8d896b['count']=_0x423c76;if(_0x58350b[_0x1caf('0x46')]['includeAll']){_0x38ad18[_0x1caf('0x67')]=[{'all':!![]}];}return db[_0x1caf('0x62')][_0x1caf('0x53')](_0x38ad18);})[_0x1caf('0x22')](function(_0x54b2bb){_0x8d896b['rows']=_0x54b2bb;return _0x8d896b;});}})['then'](respondWithFilteredResult(_0x1de83f,_0x38ad18))['catch'](handleError(_0x1de83f,null));};exports[_0x1caf('0x68')]=function(_0x555064,_0x1a8f10,_0x2355ac){return db[_0x1caf('0x42')][_0x1caf('0x57')]({'where':{'id':_0x555064[_0x1caf('0x5e')]['id']}})[_0x1caf('0x22')](handleEntityNotFound(_0x1a8f10,null))[_0x1caf('0x22')](function(_0x30967e){if(_0x30967e){return _0x30967e['removeDispositions'](_0x555064[_0x1caf('0x46')][_0x1caf('0x69')]);}})[_0x1caf('0x22')](respondWithStatusCode(_0x1a8f10,null))[_0x1caf('0x55')](handleError(_0x1a8f10,null));};exports['addAnswer']=function(_0x1f3933,_0x565ab7,_0x33e6f1){if(_0x1f3933[_0x1caf('0x59')]['id']){delete _0x1f3933[_0x1caf('0x59')]['id'];}return db[_0x1caf('0x42')]['find']({'where':{'id':_0x1f3933[_0x1caf('0x5e')]['id']}})[_0x1caf('0x22')](handleEntityNotFound(_0x565ab7,null))[_0x1caf('0x22')](function(_0x18fa10){if(_0x18fa10){_0x1f3933['body'][_0x1caf('0x66')]=_0x18fa10['id'];return db[_0x1caf('0x6a')][_0x1caf('0x58')](_0x1f3933[_0x1caf('0x59')]);}})[_0x1caf('0x22')](respondWithResult(_0x565ab7,null))[_0x1caf('0x55')](handleError(_0x565ab7,null));};exports['getAnswers']=function(_0x43a162,_0x2afbc1,_0x25915c){var _0x229494={'raw':![],'where':{}};var _0x2c8888={};var _0x54b5e2={'count':0x0,'rows':[]};return db[_0x1caf('0x42')][_0x1caf('0x61')]({'where':{'id':_0x43a162[_0x1caf('0x5e')]['id']}})[_0x1caf('0x22')](handleEntityNotFound(_0x2afbc1,null))[_0x1caf('0x22')](function(_0x5dbe15){if(_0x5dbe15){_0x2c8888['model']=_[_0x1caf('0x47')](db[_0x1caf('0x6a')][_0x1caf('0x43')]);_0x2c8888['query']=_[_0x1caf('0x47')](_0x43a162['query']);_0x2c8888[_0x1caf('0x48')]=_[_0x1caf('0x49')](_0x2c8888[_0x1caf('0x45')],_0x2c8888[_0x1caf('0x46')]);_0x229494[_0x1caf('0x4a')]=_['intersection'](_0x2c8888[_0x1caf('0x45')],qs[_0x1caf('0x4b')](_0x43a162['query'][_0x1caf('0x4b')]));_0x229494[_0x1caf('0x4a')]=_0x229494['attributes'][_0x1caf('0x4c')]?_0x229494[_0x1caf('0x4a')]:_0x2c8888['model'];if(!_0x43a162[_0x1caf('0x46')][_0x1caf('0x63')](_0x1caf('0x4d'))){_0x229494[_0x1caf('0x2e')]=qs['limit'](_0x43a162[_0x1caf('0x46')]['limit']);_0x229494[_0x1caf('0x2c')]=qs['offset'](_0x43a162[_0x1caf('0x46')][_0x1caf('0x2c')]);}_0x229494['order']=qs['sort'](_0x43a162['query']['sort']);_0x229494[_0x1caf('0x4f')]=qs['filters'](_['pick'](_0x43a162['query'],_0x2c8888['filters']));_0x229494[_0x1caf('0x4f')][_0x1caf('0x66')]=_0x5dbe15['id'];if(_0x43a162[_0x1caf('0x46')]['filter']){_0x229494[_0x1caf('0x4f')]=_['merge'](_0x229494[_0x1caf('0x4f')],{'$or':_[_0x1caf('0x41')](_0x229494[_0x1caf('0x4a')],function(_0x153689){var _0x1d4952={};_0x1d4952[_0x153689]={'$like':'%'+_0x43a162['query'][_0x1caf('0x50')]+'%'};return _0x1d4952;})});}_0x229494=_[_0x1caf('0x51')]({},_0x229494,_0x43a162['options']);return db['CannedAnswer']['count']({'where':_0x229494[_0x1caf('0x4f')]})[_0x1caf('0x22')](function(_0x5ec250){_0x54b5e2[_0x1caf('0x2f')]=_0x5ec250;if(_0x43a162['query'][_0x1caf('0x6b')]){_0x229494[_0x1caf('0x67')]=[{'all':!![]}];}return db[_0x1caf('0x6a')][_0x1caf('0x53')](_0x229494);})[_0x1caf('0x22')](function(_0x347823){_0x54b5e2[_0x1caf('0x54')]=_0x347823;return _0x54b5e2;});}})[_0x1caf('0x22')](respondWithFilteredResult(_0x2afbc1,_0x229494))[_0x1caf('0x55')](handleError(_0x2afbc1,null));};exports[_0x1caf('0x6c')]=function(_0x4db40d,_0x4478b2,_0x52996f){return db['OpenchannelAccount']['find']({'where':{'id':_0x4db40d['params']['id']}})[_0x1caf('0x22')](handleEntityNotFound(_0x4478b2,null))[_0x1caf('0x22')](function(_0x1ede1f){if(_0x1ede1f){return _0x1ede1f[_0x1caf('0x6c')](_0x4db40d[_0x1caf('0x46')][_0x1caf('0x69')]);}})['then'](respondWithStatusCode(_0x4478b2,null))[_0x1caf('0x55')](handleError(_0x4478b2,null));};exports[_0x1caf('0x6d')]=function(_0xaac275,_0x4c356,_0x5989f2){var _0x51a35d={'body':_0xaac275[_0x1caf('0x59')],'channel':'openchannel'};var _0x3f3c7c=[];var _0x6484e3=[];var _0x489cee={};var _0x46d413=![];return db[_0x1caf('0x6e')][_0x1caf('0x5f')]()[_0x1caf('0x22')](function(_0x10b530){if(!_0x10b530){throw new db[(_0x1caf('0x6f'))][(_0x1caf('0x70'))](_0x1caf('0x71'));}_0x3f3c7c=_[_0x1caf('0x72')](_[_0x1caf('0x47')](_0x10b530),[_0x1caf('0x73'),_0x1caf('0x74')]);_0x6484e3=_[_0x1caf('0x72')](_[_0x1caf('0x47')](_0x10b530),['createdAt',_0x1caf('0x74'),_0x1caf('0x75'),_0x1caf('0x76')]);if(_0xaac275['body']['id']){delete _0xaac275['body']['id'];}if(_[_0x1caf('0x77')](_0xaac275[_0x1caf('0x59')][_0x1caf('0x78')])){throw new db[(_0x1caf('0x6f'))][(_0x1caf('0x70'))](_0x1caf('0x79'));}if(_[_0x1caf('0x77')](_0xaac275[_0x1caf('0x59')][_0x1caf('0x59')])||_0xaac275[_0x1caf('0x59')][_0x1caf('0x59')]===''){throw new db[(_0x1caf('0x6f'))][(_0x1caf('0x70'))](_0x1caf('0x7a'));}if(_['isNil'](_0xaac275[_0x1caf('0x59')]['mapKey'])){throw new db[(_0x1caf('0x6f'))][(_0x1caf('0x70'))](_0x1caf('0x7b')+_0x6484e3);}if(!_[_0x1caf('0x7c')](_0x6484e3,_0xaac275[_0x1caf('0x59')][_0x1caf('0x7d')])){throw new db[(_0x1caf('0x6f'))][(_0x1caf('0x70'))](_0x1caf('0x7e')+_0x6484e3);}_0x489cee[_0xaac275['body']['mapKey']]=_0xaac275[_0x1caf('0x59')][_0x1caf('0x78')];})[_0x1caf('0x22')](function(){return db[_0x1caf('0x42')][_0x1caf('0x57')]({'where':{'id':_0xaac275[_0x1caf('0x5e')]['id']},'include':[{'model':db[_0x1caf('0x7f')],'as':_0x1caf('0x80'),'include':[{'model':db['CmContact'],'as':_0x1caf('0x81'),'where':_0x489cee,'limit':0x1,'order':[[_0x1caf('0x74'),_0x1caf('0x82')]]}]},{'model':db[_0x1caf('0x83')],'as':_0x1caf('0x84')}]});})[_0x1caf('0x22')](handleEntityNotFound(_0x4c356,null))['then'](function(_0x431c85){if(_0x431c85&&_0x431c85['List']){_0x51a35d[_0x1caf('0x85')]=_0x431c85;_0x51a35d[_0x1caf('0x86')]=_0x431c85[_0x1caf('0x84')];_0x51a35d[_0x1caf('0x87')]=_0x431c85[_0x1caf('0x80')];_0x51a35d['applications']=_[_0x1caf('0x88')](_0x51a35d[_0x1caf('0x86')],[_0x1caf('0x89')],[_0x1caf('0x8a')]);if(_0x51a35d[_0x1caf('0x85')][_0x1caf('0x84')]){delete _0x51a35d[_0x1caf('0x85')]['Applications'];}if(_0x51a35d['account']['List']&&_0x51a35d[_0x1caf('0x85')][_0x1caf('0x80')]['Contacts'][_0x1caf('0x4c')]){return _0x51a35d['account'][_0x1caf('0x80')][_0x1caf('0x81')][0x0];}var _0x1154fd=_[_0x1caf('0x8b')](_0xaac275[_0x1caf('0x59')],{'firstName':_0xaac275[_0x1caf('0x59')][_0x1caf('0x78')],'ListId':_0x431c85[_0x1caf('0x76')]});_0x1154fd[_0xaac275[_0x1caf('0x59')][_0x1caf('0x7d')]]=_0xaac275[_0x1caf('0x59')]['from'];return db['CmContact'][_0x1caf('0x58')](_0x1154fd,{'fields':_0x3f3c7c,'raw':!![]});}})['then'](handleEntityNotFound(_0x4c356,null))[_0x1caf('0x22')](function(_0x1a15a4){_0x51a35d[_0x1caf('0x8c')]=_0x1a15a4;if(_0x1a15a4){var _0x5a310b={'ContactId':_0x1a15a4['id'],'OpenchannelAccountId':_0xaac275[_0x1caf('0x5e')]['id'],'from':(_0x1a15a4[_0x1caf('0x8d')]||'')+'\x20'+(_0x1a15a4[_0x1caf('0x8e')]||'')};var _0x1257cc={'OpenchannelAccountId':_0xaac275[_0x1caf('0x5e')]['id'],'closed':![]};if(_0xaac275['body']['threadId']){_0x1257cc[_0x1caf('0x8f')]=_0xaac275[_0x1caf('0x59')][_0x1caf('0x8f')];return db[_0x1caf('0x90')][_0x1caf('0x57')]({'where':_0x1257cc})['then'](function(_0x22e6ca){if(_0x22e6ca){return[_0x22e6ca,![]];}_0x5a310b[_0x1caf('0x8f')]=_0xaac275[_0x1caf('0x59')]['threadId'];_0x5a310b[_0x1caf('0x91')]=_0xaac275[_0x1caf('0x59')]['externalUrl'];return db[_0x1caf('0x90')][_0x1caf('0x58')](_0x5a310b)[_0x1caf('0x22')](function(_0x135043){return[_0x135043,!![]];});});}else{_0x1257cc['threadId']=null;}_0x1257cc[_0x1caf('0x92')]=_0x1a15a4['id'];return db['OpenchannelInteraction'][_0x1caf('0x57')]({'where':_0x1257cc})[_0x1caf('0x22')](function(_0x4c537b){if(_0x4c537b){return[_0x4c537b,![]];}return db[_0x1caf('0x90')]['create'](_0x5a310b)[_0x1caf('0x22')](function(_0x3167f4){return[_0x3167f4,!![]];});});}})[_0x1caf('0x93')](function(_0x478e40,_0xb101e4){if(_0x478e40){_0x46d413=_0xb101e4;if(!_0xb101e4){var _0x141e4b={'from':(_0x51a35d[_0x1caf('0x8c')][_0x1caf('0x8d')]||'')+'\x20'+(_0x51a35d[_0x1caf('0x8c')][_0x1caf('0x8e')]||'')};if(_0xaac275[_0x1caf('0x59')][_0x1caf('0x8f')]&&_0xaac275[_0x1caf('0x59')][_0x1caf('0x94')]&&_0xaac275[_0x1caf('0x59')][_0x1caf('0x8f')]!=_0xaac275[_0x1caf('0x59')][_0x1caf('0x94')]){_0x141e4b[_0x1caf('0x8f')]=_0xaac275['body']['messageId'];}return _0x478e40[_0x1caf('0x35')](_0x141e4b);}else{return _0x478e40;}}})[_0x1caf('0x22')](function(_0x453956){_0x51a35d[_0x1caf('0x95')]=_0x453956[_0x1caf('0x5b')]({'plain':!![]});_0x51a35d[_0x1caf('0x95')][_0x1caf('0x96')]=_0x46d413;if(_0x51a35d[_0x1caf('0x95')][_0x1caf('0x96')]){if(_0x51a35d['account'][_0x1caf('0x97')]){_0x51a35d[_0x1caf('0x86')][_0x1caf('0x98')]({'id':0x0,'priority':_0x51a35d[_0x1caf('0x86')]['length']+0x1,'app':_0x1caf('0x99'),'appdata':_0x1caf('0x9a'),'interval':_0x1caf('0x9b')});}}return db[_0x1caf('0x9c')]['create']({'body':_0xaac275[_0x1caf('0x59')][_0x1caf('0x59')],'OpenchannelAccountId':_0xaac275[_0x1caf('0x5e')]['id'],'OpenchannelInteractionId':_0x453956['id'],'direction':'in','ContactId':_0x51a35d[_0x1caf('0x8c')]['id'],'AttachmentId':_0xaac275[_0x1caf('0x59')][_0x1caf('0x9d')]});})[_0x1caf('0x22')](function(_0x13aaff){_0x51a35d[_0x1caf('0x29')]=_0x13aaff;if(_0x51a35d[_0x1caf('0x95')][_0x1caf('0x9e')]){return db[_0x1caf('0x9f')][_0x1caf('0x57')]({'attributes':['id',_0x1caf('0x3c')],'where':{'id':_0x51a35d[_0x1caf('0x95')]['UserId']}})[_0x1caf('0x22')](function(_0x5592e3){if(_0x5592e3){_0x51a35d[_0x1caf('0x86')][_0x1caf('0xa0')]({'id':0x0,'priority':0x0,'app':_0x1caf('0xa1'),'appdata':_0x5592e3['name']+','+(_0x51a35d[_0x1caf('0x85')][_0x1caf('0xa2')]||0xa),'interval':_0x1caf('0x9b')});_0x51a35d['forcedOwnership']=![];}return respondWithRpcPromise(_0x1caf('0xa3'),'startRouting',_0x51a35d);});}return respondWithRpcPromise(_0x1caf('0xa3'),_0x1caf('0xa4'),_0x51a35d);})[_0x1caf('0x22')](function(_0x188368){respondWithRpcPromise('EventManager',_0x1caf('0xa5'),{'event':_0x1caf('0x6d'),'message':_0x188368},client9002);return _0x188368;})[_0x1caf('0x22')](respondWithResult(_0x4c356,null))[_0x1caf('0x55')](handleError(_0x4c356,null));};exports[_0x1caf('0xa6')]=function(_0x249466,_0x4d59e9,_0x352429){return db[_0x1caf('0x42')]['findOne']({'where':{'id':_0x249466[_0x1caf('0x5e')]['id']}})[_0x1caf('0x22')](handleEntityNotFound(_0x4d59e9,null))[_0x1caf('0x22')](function(_0x5794ae){if(_0x5794ae){return db[_0x1caf('0xa7')][_0x1caf('0xa8')](function(_0x28c870){return db[_0x1caf('0x83')][_0x1caf('0x36')]({'where':{'OpenchannelAccountId':_0x249466['params']['id']},'transaction':_0x28c870})[_0x1caf('0x22')](function(_0x335e94){var _0x30e0b9=_[_0x1caf('0x41')](_0x249466[_0x1caf('0x59')],function(_0x30c592){_0x30c592[_0x1caf('0x66')]=_0x249466['params']['id'];return _0x30c592;});return db[_0x1caf('0x83')][_0x1caf('0xa9')](_0x30e0b9,{'transaction':_0x28c870});});})['then'](function(){return db[_0x1caf('0x83')][_0x1caf('0xaa')]({'where':{'OpenchannelAccountId':_0x249466[_0x1caf('0x5e')]['id']},'order':_0x1caf('0x89')});});}})['then'](respondWithResult(_0x4d59e9,null))[_0x1caf('0x55')](handleError(_0x4d59e9,null));};exports[_0x1caf('0xab')]=function(_0x7e16e2,_0x525f4b,_0x3aed59){var _0x5f4dc7={};var _0x3041b4={};var _0x4e7cea;var _0x569f56;return db[_0x1caf('0x42')]['findOne']({'where':{'id':_0x7e16e2[_0x1caf('0x5e')]['id']}})[_0x1caf('0x22')](handleEntityNotFound(_0x525f4b,null))[_0x1caf('0x22')](function(_0x5d2c8f){if(_0x5d2c8f){_0x4e7cea=_0x5d2c8f;_0x3041b4[_0x1caf('0x45')]=_[_0x1caf('0x47')](db['OpenchannelApplication']['rawAttributes']);_0x3041b4[_0x1caf('0x46')]=_[_0x1caf('0x47')](_0x7e16e2[_0x1caf('0x46')]);_0x3041b4[_0x1caf('0x48')]=_[_0x1caf('0x49')](_0x3041b4['model'],_0x3041b4[_0x1caf('0x46')]);_0x5f4dc7[_0x1caf('0x4a')]=_[_0x1caf('0x49')](_0x3041b4['model'],qs[_0x1caf('0x4b')](_0x7e16e2[_0x1caf('0x46')]['fields']));_0x5f4dc7['attributes']=_0x5f4dc7['attributes'][_0x1caf('0x4c')]?_0x5f4dc7[_0x1caf('0x4a')]:_0x3041b4['model'];_0x5f4dc7[_0x1caf('0x4e')]=qs['sort'](_0x7e16e2['query'][_0x1caf('0x64')]);_0x5f4dc7['where']=qs['filters'](_[_0x1caf('0x65')](_0x7e16e2[_0x1caf('0x46')],_0x3041b4[_0x1caf('0x48')]));if(_0x7e16e2[_0x1caf('0x46')][_0x1caf('0x50')]){_0x5f4dc7[_0x1caf('0x4f')]=_[_0x1caf('0x51')](_0x5f4dc7['where'],{'$or':_[_0x1caf('0x41')](_0x5f4dc7[_0x1caf('0x4a')],function(_0xe44378){var _0x4314f8={};_0x4314f8[_0xe44378]={'$like':'%'+_0x7e16e2[_0x1caf('0x46')][_0x1caf('0x50')]+'%'};return _0x4314f8;})});}_0x5f4dc7=_['merge']({},_0x5f4dc7,_0x7e16e2[_0x1caf('0x52')]);return _0x4e7cea[_0x1caf('0xab')](_0x5f4dc7);}})[_0x1caf('0x22')](function(_0x3be58e){if(_0x3be58e){_0x569f56=_0x3be58e['length'];if(!_0x7e16e2[_0x1caf('0x46')][_0x1caf('0x63')]('nolimit')){_0x5f4dc7[_0x1caf('0x2e')]=qs[_0x1caf('0x2e')](_0x7e16e2[_0x1caf('0x46')][_0x1caf('0x2e')]);_0x5f4dc7[_0x1caf('0x2c')]=qs['offset'](_0x7e16e2[_0x1caf('0x46')]['offset']);}return _0x4e7cea['getApplications'](_0x5f4dc7);}})[_0x1caf('0x22')](function(_0x1338a2){if(_0x1338a2){return _0x1338a2?{'count':_0x569f56,'rows':_0x1338a2}:null;}})[_0x1caf('0x22')](respondWithResult(_0x525f4b,null))[_0x1caf('0x55')](handleError(_0x525f4b,null));};exports['getInteractions']=function(_0x4e5665,_0x15bfe3,_0x591bdd){var _0x4ee237={'raw':![],'where':{}};var _0x563ce4={};var _0x3bd855={'count':0x0,'rows':[]};return db[_0x1caf('0x42')]['findOne']({'where':{'id':_0x4e5665[_0x1caf('0x5e')]['id']}})[_0x1caf('0x22')](handleEntityNotFound(_0x15bfe3,null))[_0x1caf('0x22')](function(_0x3aeb0b){if(_0x3aeb0b){_0x563ce4[_0x1caf('0x45')]=_['keys'](db[_0x1caf('0x90')][_0x1caf('0x43')]);_0x563ce4[_0x1caf('0x46')]=_['keys'](_0x4e5665[_0x1caf('0x46')]);_0x563ce4[_0x1caf('0x48')]=_[_0x1caf('0x49')](_0x563ce4[_0x1caf('0x45')],_0x563ce4['query']);_0x4ee237['attributes']=_[_0x1caf('0x49')](_0x563ce4[_0x1caf('0x45')],qs[_0x1caf('0x4b')](_0x4e5665['query'][_0x1caf('0x4b')]));_0x4ee237[_0x1caf('0x4a')]=_0x4ee237[_0x1caf('0x4a')][_0x1caf('0x4c')]?_0x4ee237[_0x1caf('0x4a')]:_0x563ce4[_0x1caf('0x45')];if(!_0x4e5665[_0x1caf('0x46')][_0x1caf('0x63')](_0x1caf('0x4d'))){_0x4ee237[_0x1caf('0x2e')]=qs[_0x1caf('0x2e')](_0x4e5665[_0x1caf('0x46')]['limit']);_0x4ee237[_0x1caf('0x2c')]=qs['offset'](_0x4e5665['query'][_0x1caf('0x2c')]);}_0x4ee237[_0x1caf('0x4e')]=qs[_0x1caf('0x64')](_0x4e5665['query'][_0x1caf('0x64')]);_0x4ee237[_0x1caf('0x4f')]=qs[_0x1caf('0x48')](_[_0x1caf('0x65')](_0x4e5665['query'],_0x563ce4['filters']));_0x4ee237['where'][_0x1caf('0x66')]=_0x3aeb0b['id'];if(_0x4e5665[_0x1caf('0x46')]['filter']){_0x4ee237['where']=_[_0x1caf('0x51')](_0x4ee237[_0x1caf('0x4f')],{'$or':_['map'](_0x4ee237[_0x1caf('0x4a')],function(_0x2cf97e){var _0x11ee4b={};_0x11ee4b[_0x2cf97e]={'$like':'%'+_0x4e5665[_0x1caf('0x46')]['filter']+'%'};return _0x11ee4b;})});}_0x4ee237=_[_0x1caf('0x51')]({},_0x4ee237,_0x4e5665['options']);return db['OpenchannelInteraction'][_0x1caf('0x2f')]({'where':_0x4ee237[_0x1caf('0x4f')]})[_0x1caf('0x22')](function(_0x5f1e29){_0x3bd855[_0x1caf('0x2f')]=_0x5f1e29;if(_0x4e5665['query']['includeAll']){_0x4ee237[_0x1caf('0x67')]=[{'model':db[_0x1caf('0x6e')],'as':'Contact','required':![]},{'model':db[_0x1caf('0x9f')],'as':_0x1caf('0xac'),'attributes':[_0x1caf('0x3c'),_0x1caf('0xad'),_0x1caf('0xae')],'required':![]},{'model':db[_0x1caf('0xaf')],'as':_0x1caf('0xb0'),'attributes':['id',_0x1caf('0x3c'),_0x1caf('0xb1')],'where':_0x4e5665['query'][_0x1caf('0xb2')]?{'id':_0x4e5665[_0x1caf('0x46')][_0x1caf('0xb2')]}:undefined,'required':_0x4e5665[_0x1caf('0x46')]['tag']?!![]:![]}];}return db[_0x1caf('0x90')][_0x1caf('0x53')](_0x4ee237);})[_0x1caf('0x22')](function(_0x8b1fbe){_0x3bd855[_0x1caf('0x54')]=_0x8b1fbe;return _0x3bd855;});}})['then'](respondWithFilteredResult(_0x15bfe3,_0x4ee237))['catch'](handleError(_0x15bfe3,null));};exports['addAgents']=function(_0x4f1a20,_0x37518e,_0x3d6477){return db[_0x1caf('0x42')][_0x1caf('0x57')]({'where':{'id':_0x4f1a20[_0x1caf('0x5e')]['id']}})['then'](handleEntityNotFound(_0x37518e,null))[_0x1caf('0x22')](function(_0x31bc05){if(_0x31bc05){return _0x31bc05[_0x1caf('0xb3')](_0x4f1a20['body'][_0x1caf('0x69')],_[_0x1caf('0xb4')](_0x4f1a20[_0x1caf('0x59')],['ids','id'])||{})[_0x1caf('0x93')](function(_0x285f36){for(var _0xb4a8b2=0x0;_0xb4a8b2<_0x4f1a20[_0x1caf('0x59')][_0x1caf('0x69')][_0x1caf('0x4c')];_0xb4a8b2+=0x1){socket[_0x1caf('0xb5')]('userOpenchannelAccount:save',{'UserId':Number(_0x4f1a20['body'][_0x1caf('0x69')][_0xb4a8b2]),'OpenchannelAccountId':Number(_0x4f1a20[_0x1caf('0x5e')]['id'])});}return _0x285f36;});}})[_0x1caf('0x22')](respondWithResult(_0x37518e,null))[_0x1caf('0x55')](handleError(_0x37518e,null));};exports[_0x1caf('0xb6')]=function(_0x193ad3,_0x475401,_0x462e42){return db[_0x1caf('0x42')]['find']({'where':{'id':_0x193ad3['params']['id']}})[_0x1caf('0x22')](handleEntityNotFound(_0x475401,null))[_0x1caf('0x22')](function(_0x3753c5){if(_0x3753c5){return _0x3753c5[_0x1caf('0xb6')](_0x193ad3[_0x1caf('0x46')]['ids'])[_0x1caf('0x22')](function(){if(_[_0x1caf('0xb7')](_0x193ad3[_0x1caf('0x46')][_0x1caf('0x69')])){for(var _0x2e7247=0x0;_0x2e7247<_0x193ad3[_0x1caf('0x46')][_0x1caf('0x69')][_0x1caf('0x4c')];_0x2e7247+=0x1){socket['emit'](_0x1caf('0xb8'),{'UserId':Number(_0x193ad3['query']['ids'][_0x2e7247]),'OpenchannelAccountId':Number(_0x193ad3[_0x1caf('0x5e')]['id'])});}}else{socket['emit'](_0x1caf('0xb8'),{'UserId':Number(_0x193ad3['query'][_0x1caf('0x69')]),'OpenchannelAccountId':Number(_0x193ad3[_0x1caf('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x475401,null))[_0x1caf('0x55')](handleError(_0x475401,null));};exports[_0x1caf('0xb9')]=function(_0xdc50bb,_0x372c2a,_0x59bfe5){var _0x56d390={};var _0x1b05c5={};var _0x125b97;var _0x137186;return db['OpenchannelAccount']['findOne']({'where':{'id':_0xdc50bb[_0x1caf('0x5e')]['id']}})[_0x1caf('0x22')](handleEntityNotFound(_0x372c2a,null))['then'](function(_0x3d77a8){if(_0x3d77a8){_0x125b97=_0x3d77a8;_0x1b05c5[_0x1caf('0x45')]=_['keys'](db[_0x1caf('0x9f')][_0x1caf('0x43')]);_0x1b05c5['query']=_[_0x1caf('0x47')](_0xdc50bb[_0x1caf('0x46')]);_0x1b05c5[_0x1caf('0x48')]=_[_0x1caf('0x49')](_0x1b05c5[_0x1caf('0x45')],_0x1b05c5['query']);_0x56d390[_0x1caf('0x4a')]=_[_0x1caf('0x49')](_0x1b05c5[_0x1caf('0x45')],qs['fields'](_0xdc50bb[_0x1caf('0x46')][_0x1caf('0x4b')]));_0x56d390['attributes']=_0x56d390[_0x1caf('0x4a')]['length']?_0x56d390[_0x1caf('0x4a')]:_0x1b05c5['model'];_0x56d390['order']=qs[_0x1caf('0x64')](_0xdc50bb['query'][_0x1caf('0x64')]);_0x56d390[_0x1caf('0x4f')]=qs[_0x1caf('0x48')](_[_0x1caf('0x65')](_0xdc50bb['query'],_0x1b05c5[_0x1caf('0x48')]));if(_0xdc50bb[_0x1caf('0x46')][_0x1caf('0x50')]){_0x56d390[_0x1caf('0x4f')]=_[_0x1caf('0x51')](_0x56d390['where'],{'$or':_[_0x1caf('0x41')](_0x56d390[_0x1caf('0x4a')],function(_0x334058){var _0xe64ac7={};_0xe64ac7[_0x334058]={'$like':'%'+_0xdc50bb['query'][_0x1caf('0x50')]+'%'};return _0xe64ac7;})});}_0x56d390=_[_0x1caf('0x51')]({},_0x56d390,_0xdc50bb['options']);return _0x125b97['getAgents'](_0x56d390);}})[_0x1caf('0x22')](function(_0x449203){if(_0x449203){_0x137186=_0x449203[_0x1caf('0x4c')];if(!_0xdc50bb[_0x1caf('0x46')][_0x1caf('0x63')](_0x1caf('0x4d'))){_0x56d390[_0x1caf('0x2e')]=qs['limit'](_0xdc50bb['query'][_0x1caf('0x2e')]);_0x56d390['offset']=qs['offset'](_0xdc50bb[_0x1caf('0x46')][_0x1caf('0x2c')]);}return _0x125b97[_0x1caf('0xb9')](_0x56d390);}})[_0x1caf('0x22')](function(_0x1809c7){if(_0x1809c7){return _0x1809c7?{'count':_0x137186,'rows':_0x1809c7}:null;}})[_0x1caf('0x22')](respondWithResult(_0x372c2a,null))[_0x1caf('0x55')](handleError(_0x372c2a,null));};exports[_0x1caf('0x3d')]=function(_0x49b037,_0x198552,_0x221eba){var _0x27904e,_0x1a11a4,_0x436415;if(_[_0x1caf('0x77')](_0x49b037['body'][_0x1caf('0x59')])||_0x49b037[_0x1caf('0x59')]['body']===''){throw new db[(_0x1caf('0x6f'))][(_0x1caf('0x70'))](_0x1caf('0x7a'));}if(_[_0x1caf('0x77')](_0x49b037[_0x1caf('0x59')]['to'])){}_0x27904e=_0x49b037[_0x1caf('0x59')]['to'];return db[_0x1caf('0x42')][_0x1caf('0x61')]({'where':{'id':_0x49b037[_0x1caf('0x5e')]['id']}})[_0x1caf('0x22')](handleEntityNotFound(_0x198552,null))[_0x1caf('0x22')](function(_0x413fc9){if(_0x413fc9){return db['OpenchannelAccount'][_0x1caf('0x57')]({'where':{'id':_0x413fc9['id']},'include':[{'model':db[_0x1caf('0x7f')],'as':_0x1caf('0x80'),'include':[{'model':db[_0x1caf('0x6e')],'as':'Contacts','where':{[_0x413fc9[_0x1caf('0x7d')]]:_0x27904e},'limit':0x1,'order':[[_0x1caf('0x74'),_0x1caf('0x82')]]}]}]})[_0x1caf('0x22')](handleEntityNotFound(_0x198552,null))['then'](function(_0x336caf){if(_0x336caf&&_0x336caf['List']){_0x1a11a4=_0x336caf[_0x1caf('0x5b')]({'plain':!![]});if(_0x1a11a4[_0x1caf('0x80')]&&_0x1a11a4[_0x1caf('0x80')][_0x1caf('0x81')][_0x1caf('0x4c')]){return _0x1a11a4[_0x1caf('0x80')][_0x1caf('0x81')][0x0];}return db[_0x1caf('0x6e')][_0x1caf('0x58')](_[_0x1caf('0x8b')](_0x49b037['body'],{'firstName':_0x27904e,[_0x336caf[_0x1caf('0x7d')]]:_0x27904e,'phone':_0x27904e,'ListId':_0x1a11a4[_0x1caf('0x76')]}));}})[_0x1caf('0x22')](handleEntityNotFound(_0x198552,null))['then'](function(_0x3161e1){if(_0x3161e1){_0x436415=_0x3161e1;return db[_0x1caf('0x90')]['find']({'where':{'ContactId':_0x436415['id'],'closed':![],'OpenchannelAccountId':_0x1a11a4['id']}})['then'](function(_0x55e315){if(_0x55e315){return[_0x55e315,![]];}return db[_0x1caf('0x90')][_0x1caf('0x58')]({'UserId':_0x49b037[_0x1caf('0x5a')]['id'],'ContactId':_0x436415['id'],'OpenchannelAccountId':_0x1a11a4['id'],'lastMsgDirection':_0x1caf('0xba'),'Messages':[_[_0x1caf('0x51')](_0x49b037[_0x1caf('0x59')],{'read':![],'body':_0x49b037[_0x1caf('0x59')][_0x1caf('0x59')],'OpenchannelAccountId':_0x1a11a4['id'],'UserId':_0x49b037[_0x1caf('0x5a')]['id'],'ContactId':_0x436415['id']})]},{'include':[{'model':db[_0x1caf('0x9c')],'as':_0x1caf('0xbb')}]})[_0x1caf('0x22')](function(_0x20f41d){return[_0x20f41d,!![]];});});}})[_0x1caf('0x93')](function(_0xfafe5d,_0x5502cc){if(_0x5502cc){return _0xfafe5d;}return db[_0x1caf('0x9c')][_0x1caf('0x58')](_['merge'](_0x49b037[_0x1caf('0x59')],{'read':![],'body':_0x49b037[_0x1caf('0x59')][_0x1caf('0x59')],'OpenchannelAccountId':_0x1a11a4['id'],'OpenchannelInteractionId':_0xfafe5d['id'],'UserId':_0x49b037[_0x1caf('0x5a')]['id'],'ContactId':_0x436415['id']}))[_0x1caf('0x22')](function(_0x432b69){_0xfafe5d['dataValues']['Messages']=[];_0xfafe5d[_0x1caf('0xbc')][_0x1caf('0xbb')][_0x1caf('0x98')](_0x432b69['dataValues']);return _0xfafe5d;});});}})[_0x1caf('0x22')](respondWithResult(_0x198552,null))[_0x1caf('0x55')](handleError(_0x198552,null));}; \ No newline at end of file +var _0x4a3c=['save','destroy','get','stack','name','index','Pause','map','OpenchannelAccount','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','options','includeAll','findAll','catch','params','mandatoryDispositionPause','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','Disposition','getDispositions','findOne','order','pick','OpenchannelAccountId','include','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','no\x20available\x20attributes','difference','updatedAt','createdAt','isNil','from','from\x20is\x20mandatory','Sequelize','ValidationError','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','List','CmContact','DESC','list','applications','orderBy','asc','account','ListId','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','update','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','OpenchannelApplication','priority','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','CmList','Contacts','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject'];(function(_0x18a16d,_0x199976){var _0x21cf0c=function(_0x2717d1){while(--_0x2717d1){_0x18a16d['push'](_0x18a16d['shift']());}};_0x21cf0c(++_0x199976);}(_0x4a3c,0x14a));var _0xc4a3=function(_0x4d0eee,_0x2b2bb7){_0x4d0eee=_0x4d0eee-0x0;var _0x52e90a=_0x4a3c[_0x4d0eee];return _0x52e90a;};'use strict';var emlformat=require(_0xc4a3('0x0'));var rimraf=require(_0xc4a3('0x1'));var zipdir=require(_0xc4a3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc4a3('0x3'));var moment=require(_0xc4a3('0x4'));var BPromise=require(_0xc4a3('0x5'));var Mustache=require(_0xc4a3('0x6'));var util=require('util');var path=require(_0xc4a3('0x7'));var sox=require(_0xc4a3('0x8'));var csv=require(_0xc4a3('0x9'));var ejs=require(_0xc4a3('0xa'));var fs=require('fs');var fs_extra=require(_0xc4a3('0xb'));var _=require(_0xc4a3('0xc'));var squel=require(_0xc4a3('0xd'));var crypto=require(_0xc4a3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc4a3('0xf'));var toCsv=require(_0xc4a3('0x9'));var querystring=require('querystring');var Papa=require(_0xc4a3('0x10'));var Redis=require(_0xc4a3('0x11'));var authService=require(_0xc4a3('0x12'));var qs=require(_0xc4a3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4a3('0x14'));var logger=require('../../config/logger')(_0xc4a3('0x15'));var utils=require('../../config/utils');var config=require(_0xc4a3('0x16'));var licenseUtil=require(_0xc4a3('0x17'));var db=require(_0xc4a3('0x18'))['db'];config[_0xc4a3('0x19')]=_[_0xc4a3('0x1a')](config[_0xc4a3('0x19')],{'host':_0xc4a3('0x1b'),'port':0x18eb});var socket=require(_0xc4a3('0x1c'))(new Redis(config[_0xc4a3('0x19')]));require(_0xc4a3('0x1d'))[_0xc4a3('0x1e')](socket);var jayson=require(_0xc4a3('0x1f'));var client=jayson[_0xc4a3('0x20')][_0xc4a3('0x21')]({'port':0x232c});var client9002=jayson[_0xc4a3('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d4459,_0xa9e479,_0x19d276,_0x5029cb){return new BPromise(function(_0x1c0078,_0x531673){var _0x52c8da=_0x5029cb||client;return _0x52c8da[_0xc4a3('0x22')](_0x4d4459,_0x19d276)[_0xc4a3('0x23')](function(_0x48473b){logger[_0xc4a3('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0xa9e479,_0xc4a3('0x25'));logger[_0xc4a3('0x26')](_0xc4a3('0x27'),_0xa9e479,'request\x20sent',JSON[_0xc4a3('0x28')](_0x48473b));if(_0x48473b[_0xc4a3('0x29')]){if(_0x48473b['error'][_0xc4a3('0x2a')]===0x1f4){logger[_0xc4a3('0x29')](_0xc4a3('0x2b'),_0xa9e479,_0x48473b[_0xc4a3('0x29')][_0xc4a3('0x2c')]);return _0x531673(_0x48473b[_0xc4a3('0x29')][_0xc4a3('0x2c')]);}logger[_0xc4a3('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0xa9e479,_0x48473b[_0xc4a3('0x29')][_0xc4a3('0x2c')]);return _0x1c0078(_0x48473b[_0xc4a3('0x29')]['message']);}else{logger[_0xc4a3('0x24')](_0xc4a3('0x2b'),_0xa9e479,_0xc4a3('0x25'));_0x1c0078(_0x48473b[_0xc4a3('0x2d')][_0xc4a3('0x2c')]);}})['catch'](function(_0x3c1a8c){logger['error'](_0xc4a3('0x2b'),_0xa9e479,_0x3c1a8c);_0x531673(_0x3c1a8c);});});}function respondWithStatusCode(_0x1f2b6c,_0x412b5a){_0x412b5a=_0x412b5a||0xcc;return function(_0x492dcc){if(_0x492dcc){return _0x1f2b6c[_0xc4a3('0x2e')](_0x412b5a);}return _0x1f2b6c['status'](_0x412b5a)[_0xc4a3('0x2f')]();};}function respondWithResult(_0x5f54a1,_0x3d2a3b){_0x3d2a3b=_0x3d2a3b||0xc8;return function(_0xde50a0){if(_0xde50a0){return _0x5f54a1['status'](_0x3d2a3b)[_0xc4a3('0x30')](_0xde50a0);}};}function respondWithFilteredResult(_0x2acd03,_0x58c10d){return function(_0x435218){if(_0x435218){var _0x12ddb0=typeof _0x58c10d[_0xc4a3('0x31')]===_0xc4a3('0x32')&&typeof _0x58c10d['limit']==='undefined';var _0x2a993b=_0x435218['count'];var _0x1cd21a=_0x12ddb0?0x0:_0x58c10d[_0xc4a3('0x31')];var _0x37d370=_0x12ddb0?_0x435218[_0xc4a3('0x33')]:_0x58c10d[_0xc4a3('0x31')]+_0x58c10d[_0xc4a3('0x34')];var _0x511866;if(_0x37d370>=_0x2a993b){_0x37d370=_0x2a993b;_0x511866=0xc8;}else{_0x511866=0xce;}_0x2acd03[_0xc4a3('0x35')](_0x511866);return _0x2acd03[_0xc4a3('0x36')](_0xc4a3('0x37'),_0x1cd21a+'-'+_0x37d370+'/'+_0x2a993b)[_0xc4a3('0x30')](_0x435218);}return null;};}function patchUpdates(_0x49aa0e){return function(_0x1247a9){try{jsonpatch[_0xc4a3('0x38')](_0x1247a9,_0x49aa0e,!![]);}catch(_0x5c5e2e){return BPromise[_0xc4a3('0x39')](_0x5c5e2e);}return _0x1247a9[_0xc4a3('0x3a')]();};}function saveUpdates(_0x3760e7,_0x528518){return function(_0x4fd27d){if(_0x4fd27d){return _0x4fd27d['update'](_0x3760e7)[_0xc4a3('0x23')](function(_0xd1c382){return _0xd1c382;});}return null;};}function removeEntity(_0x1b3335,_0x297c29){return function(_0x29f0d1){if(_0x29f0d1){return _0x29f0d1[_0xc4a3('0x3b')]()[_0xc4a3('0x23')](function(){var _0x97c86a=_0x29f0d1[_0xc4a3('0x3c')]({'plain':!![]});var _0xaf0f95='OpenchannelAccounts';return db['UserProfileResource'][_0xc4a3('0x3b')]({'where':{'type':_0xaf0f95,'resourceId':_0x97c86a['id']}})[_0xc4a3('0x23')](function(){return _0x29f0d1;});})[_0xc4a3('0x23')](function(){_0x1b3335[_0xc4a3('0x35')](0xcc)['end']();});}};}function handleEntityNotFound(_0x465e0c,_0x59399c){return function(_0x2cadae){if(!_0x2cadae){_0x465e0c[_0xc4a3('0x2e')](0x194);}return _0x2cadae;};}function handleError(_0x5423b3,_0x134248){_0x134248=_0x134248||0x1f4;return function(_0x35339d){logger[_0xc4a3('0x29')](_0x35339d[_0xc4a3('0x3d')]);if(_0x35339d[_0xc4a3('0x3e')]){delete _0x35339d[_0xc4a3('0x3e')];}_0x5423b3[_0xc4a3('0x35')](_0x134248)['send'](_0x35339d);};}exports[_0xc4a3('0x3f')]=function(_0x16f04f,_0x349d55){var _0x3c69f4={'include':[{'model':db[_0xc4a3('0x40')],'as':'mandatoryDispositionPause'}]},_0x5785f2={},_0x24d6cc={'count':0x0,'rows':[]};var _0x1a99c7=_[_0xc4a3('0x41')](db[_0xc4a3('0x42')]['rawAttributes'],function(_0x4b4f93){return{'name':_0x4b4f93[_0xc4a3('0x43')],'type':_0x4b4f93['type'][_0xc4a3('0x44')]};});_0x5785f2[_0xc4a3('0x45')]=_['map'](_0x1a99c7,_0xc4a3('0x3e'));_0x5785f2[_0xc4a3('0x46')]=_['keys'](_0x16f04f[_0xc4a3('0x46')]);_0x5785f2[_0xc4a3('0x47')]=_[_0xc4a3('0x48')](_0x5785f2[_0xc4a3('0x45')],_0x5785f2['query']);_0x3c69f4['attributes']=_[_0xc4a3('0x48')](_0x5785f2['model'],qs[_0xc4a3('0x49')](_0x16f04f[_0xc4a3('0x46')][_0xc4a3('0x49')]));_0x3c69f4[_0xc4a3('0x4a')]=_0x3c69f4['attributes'][_0xc4a3('0x4b')]?_0x3c69f4[_0xc4a3('0x4a')]:_0x5785f2[_0xc4a3('0x45')];if(!_0x16f04f[_0xc4a3('0x46')][_0xc4a3('0x4c')](_0xc4a3('0x4d'))){_0x3c69f4[_0xc4a3('0x34')]=qs[_0xc4a3('0x34')](_0x16f04f[_0xc4a3('0x46')][_0xc4a3('0x34')]);_0x3c69f4['offset']=qs[_0xc4a3('0x31')](_0x16f04f[_0xc4a3('0x46')]['offset']);}_0x3c69f4['order']=qs[_0xc4a3('0x4e')](_0x16f04f[_0xc4a3('0x46')][_0xc4a3('0x4e')]);_0x3c69f4['where']=qs[_0xc4a3('0x47')](_['pick'](_0x16f04f[_0xc4a3('0x46')],_0x5785f2[_0xc4a3('0x47')]),_0x1a99c7);if(_0x16f04f[_0xc4a3('0x46')][_0xc4a3('0x4f')]){_0x3c69f4[_0xc4a3('0x50')]=_[_0xc4a3('0x51')](_0x3c69f4[_0xc4a3('0x50')],{'$or':_[_0xc4a3('0x41')](_0x1a99c7,function(_0xc890bc){if(_0xc890bc[_0xc4a3('0x52')]!=='VIRTUAL'){var _0x5a4e54={};_0x5a4e54[_0xc890bc[_0xc4a3('0x3e')]]={'$like':'%'+_0x16f04f[_0xc4a3('0x46')]['filter']+'%'};return _0x5a4e54;}})});}_0x3c69f4=_[_0xc4a3('0x51')]({},_0x3c69f4,_0x16f04f[_0xc4a3('0x53')]);var _0x3b8101={'where':_0x3c69f4['where']};return db[_0xc4a3('0x42')][_0xc4a3('0x33')](_0x3b8101)[_0xc4a3('0x23')](function(_0x2e28a8){_0x24d6cc[_0xc4a3('0x33')]=_0x2e28a8;if(_0x16f04f[_0xc4a3('0x46')][_0xc4a3('0x54')]){_0x3c69f4['include']=[{'all':!![]}];}return db[_0xc4a3('0x42')][_0xc4a3('0x55')](_0x3c69f4);})[_0xc4a3('0x23')](function(_0x425c00){_0x24d6cc['rows']=_0x425c00;return _0x24d6cc;})[_0xc4a3('0x23')](respondWithFilteredResult(_0x349d55,_0x3c69f4))[_0xc4a3('0x56')](handleError(_0x349d55,null));};exports['show']=function(_0x13476d,_0x1ae33d){var _0x2aa1a0={'raw':![],'where':{'id':_0x13476d[_0xc4a3('0x57')]['id']},'include':[{'model':db[_0xc4a3('0x40')],'as':_0xc4a3('0x58')}]},_0xf3576c={};_0xf3576c['model']=_[_0xc4a3('0x59')](db['OpenchannelAccount'][_0xc4a3('0x5a')]);_0xf3576c[_0xc4a3('0x46')]=_[_0xc4a3('0x59')](_0x13476d[_0xc4a3('0x46')]);_0xf3576c[_0xc4a3('0x47')]=_[_0xc4a3('0x48')](_0xf3576c[_0xc4a3('0x45')],_0xf3576c[_0xc4a3('0x46')]);_0x2aa1a0[_0xc4a3('0x4a')]=_[_0xc4a3('0x48')](_0xf3576c['model'],qs[_0xc4a3('0x49')](_0x13476d[_0xc4a3('0x46')]['fields']));_0x2aa1a0[_0xc4a3('0x4a')]=_0x2aa1a0[_0xc4a3('0x4a')][_0xc4a3('0x4b')]?_0x2aa1a0[_0xc4a3('0x4a')]:_0xf3576c[_0xc4a3('0x45')];if(_0x13476d[_0xc4a3('0x46')][_0xc4a3('0x54')]){_0x2aa1a0['include']=[{'all':!![]}];}_0x2aa1a0=_[_0xc4a3('0x51')]({},_0x2aa1a0,_0x13476d['options']);return db[_0xc4a3('0x42')][_0xc4a3('0x5b')](_0x2aa1a0)[_0xc4a3('0x23')](handleEntityNotFound(_0x1ae33d,null))[_0xc4a3('0x23')](respondWithResult(_0x1ae33d,null))[_0xc4a3('0x56')](handleError(_0x1ae33d,null));};exports[_0xc4a3('0x5c')]=function(_0x2545ca,_0x37dcac){return db['OpenchannelAccount'][_0xc4a3('0x5c')](_0x2545ca[_0xc4a3('0x5d')],{})[_0xc4a3('0x23')](function(_0x2de1bf){var _0x3d349a=_0x2545ca[_0xc4a3('0x5e')][_0xc4a3('0x3c')]({'plain':!![]});if(!_0x3d349a)throw new Error(_0xc4a3('0x5f'));if(_0x3d349a['role']===_0xc4a3('0x5e')){var _0x2247ce=_0x2de1bf[_0xc4a3('0x3c')]({'plain':!![]});var _0x5e8c57=_0xc4a3('0x60');return db[_0xc4a3('0x61')]['find']({'where':{'name':_0x5e8c57,'userProfileId':_0x3d349a[_0xc4a3('0x62')]},'raw':!![]})[_0xc4a3('0x23')](function(_0x27aa16){if(_0x27aa16&&_0x27aa16[_0xc4a3('0x63')]===0x0){return db['UserProfileResource'][_0xc4a3('0x5c')]({'name':_0x2247ce[_0xc4a3('0x3e')],'resourceId':_0x2247ce['id'],'type':_0x27aa16['name'],'sectionId':_0x27aa16['id']},{})[_0xc4a3('0x23')](function(){return _0x2de1bf;});}else{return _0x2de1bf;}})[_0xc4a3('0x56')](function(_0x532dad){logger[_0xc4a3('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x532dad);throw _0x532dad;});}return _0x2de1bf;})[_0xc4a3('0x23')](respondWithResult(_0x37dcac,0xc9))[_0xc4a3('0x56')](handleError(_0x37dcac,null));};exports['update']=function(_0x586673,_0x68f18e){if(_0x586673[_0xc4a3('0x5d')]['id']){delete _0x586673[_0xc4a3('0x5d')]['id'];}return db[_0xc4a3('0x42')][_0xc4a3('0x5b')]({'where':{'id':_0x586673[_0xc4a3('0x57')]['id']},'include':[{'model':db[_0xc4a3('0x40')],'as':'mandatoryDispositionPause'}]})[_0xc4a3('0x23')](handleEntityNotFound(_0x68f18e,null))['then'](saveUpdates(_0x586673[_0xc4a3('0x5d')],null))['then'](respondWithResult(_0x68f18e,null))[_0xc4a3('0x56')](handleError(_0x68f18e,null));};exports[_0xc4a3('0x3b')]=function(_0xbd0101,_0xb81ba7){return db[_0xc4a3('0x42')][_0xc4a3('0x5b')]({'where':{'id':_0xbd0101[_0xc4a3('0x57')]['id']}})[_0xc4a3('0x23')](handleEntityNotFound(_0xb81ba7,null))[_0xc4a3('0x23')](removeEntity(_0xb81ba7,null))[_0xc4a3('0x56')](handleError(_0xb81ba7,null));};exports[_0xc4a3('0x64')]=function(_0x1542ac,_0x5e475b){return db[_0xc4a3('0x42')][_0xc4a3('0x64')]()[_0xc4a3('0x23')](respondWithResult(_0x5e475b,null))[_0xc4a3('0x56')](handleError(_0x5e475b,null));};exports[_0xc4a3('0x65')]=function(_0x4b6b92,_0x4d118b,_0x703939){if(_0x4b6b92[_0xc4a3('0x5d')]['id']){delete _0x4b6b92[_0xc4a3('0x5d')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x4b6b92[_0xc4a3('0x57')]['id']}})[_0xc4a3('0x23')](handleEntityNotFound(_0x4d118b,null))[_0xc4a3('0x23')](function(_0x21924b){if(_0x21924b){_0x4b6b92['body']['OpenchannelAccountId']=_0x21924b['id'];return db[_0xc4a3('0x66')][_0xc4a3('0x5c')](_0x4b6b92[_0xc4a3('0x5d')]);}})[_0xc4a3('0x23')](respondWithResult(_0x4d118b,null))[_0xc4a3('0x56')](handleError(_0x4d118b,null));};exports[_0xc4a3('0x67')]=function(_0xfc5374,_0x4e3cfd,_0x1092e7){var _0xa7ab61={'raw':![],'where':{}};var _0x1ea2ff={};var _0x1fd8ab={'count':0x0,'rows':[]};return db[_0xc4a3('0x42')][_0xc4a3('0x68')]({'where':{'id':_0xfc5374['params']['id']}})[_0xc4a3('0x23')](handleEntityNotFound(_0x4e3cfd,null))['then'](function(_0x51155b){if(_0x51155b){_0x1ea2ff[_0xc4a3('0x45')]=_[_0xc4a3('0x59')](db['Disposition'][_0xc4a3('0x5a')]);_0x1ea2ff[_0xc4a3('0x46')]=_['keys'](_0xfc5374[_0xc4a3('0x46')]);_0x1ea2ff['filters']=_[_0xc4a3('0x48')](_0x1ea2ff[_0xc4a3('0x45')],_0x1ea2ff[_0xc4a3('0x46')]);_0xa7ab61[_0xc4a3('0x4a')]=_[_0xc4a3('0x48')](_0x1ea2ff[_0xc4a3('0x45')],qs[_0xc4a3('0x49')](_0xfc5374[_0xc4a3('0x46')]['fields']));_0xa7ab61[_0xc4a3('0x4a')]=_0xa7ab61[_0xc4a3('0x4a')][_0xc4a3('0x4b')]?_0xa7ab61['attributes']:_0x1ea2ff[_0xc4a3('0x45')];if(!_0xfc5374['query'][_0xc4a3('0x4c')]('nolimit')){_0xa7ab61[_0xc4a3('0x34')]=qs[_0xc4a3('0x34')](_0xfc5374[_0xc4a3('0x46')][_0xc4a3('0x34')]);_0xa7ab61[_0xc4a3('0x31')]=qs['offset'](_0xfc5374[_0xc4a3('0x46')][_0xc4a3('0x31')]);}_0xa7ab61[_0xc4a3('0x69')]=qs[_0xc4a3('0x4e')](_0xfc5374[_0xc4a3('0x46')][_0xc4a3('0x4e')]);_0xa7ab61[_0xc4a3('0x50')]=qs[_0xc4a3('0x47')](_[_0xc4a3('0x6a')](_0xfc5374['query'],_0x1ea2ff[_0xc4a3('0x47')]));_0xa7ab61[_0xc4a3('0x50')][_0xc4a3('0x6b')]=_0x51155b['id'];if(_0xfc5374[_0xc4a3('0x46')]['filter']){_0xa7ab61[_0xc4a3('0x50')]=_[_0xc4a3('0x51')](_0xa7ab61[_0xc4a3('0x50')],{'$or':_['map'](_0xa7ab61[_0xc4a3('0x4a')],function(_0x5f016b){var _0x492534={};_0x492534[_0x5f016b]={'$like':'%'+_0xfc5374[_0xc4a3('0x46')][_0xc4a3('0x4f')]+'%'};return _0x492534;})});}_0xa7ab61=_[_0xc4a3('0x51')]({},_0xa7ab61,_0xfc5374['options']);return db[_0xc4a3('0x66')][_0xc4a3('0x33')]({'where':_0xa7ab61[_0xc4a3('0x50')]})[_0xc4a3('0x23')](function(_0x5abe68){_0x1fd8ab[_0xc4a3('0x33')]=_0x5abe68;if(_0xfc5374[_0xc4a3('0x46')][_0xc4a3('0x54')]){_0xa7ab61[_0xc4a3('0x6c')]=[{'all':!![]}];}return db[_0xc4a3('0x66')][_0xc4a3('0x55')](_0xa7ab61);})[_0xc4a3('0x23')](function(_0x58adc2){_0x1fd8ab['rows']=_0x58adc2;return _0x1fd8ab;});}})[_0xc4a3('0x23')](respondWithFilteredResult(_0x4e3cfd,_0xa7ab61))['catch'](handleError(_0x4e3cfd,null));};exports['removeDispositions']=function(_0x48ec19,_0x28397a,_0x54f3af){return db[_0xc4a3('0x42')]['find']({'where':{'id':_0x48ec19[_0xc4a3('0x57')]['id']}})[_0xc4a3('0x23')](handleEntityNotFound(_0x28397a,null))[_0xc4a3('0x23')](function(_0x5897a8){if(_0x5897a8){return _0x5897a8['removeDispositions'](_0x48ec19[_0xc4a3('0x46')][_0xc4a3('0x6d')]);}})[_0xc4a3('0x23')](respondWithStatusCode(_0x28397a,null))[_0xc4a3('0x56')](handleError(_0x28397a,null));};exports[_0xc4a3('0x6e')]=function(_0x14ffff,_0x2684dc,_0x3d1ae4){if(_0x14ffff[_0xc4a3('0x5d')]['id']){delete _0x14ffff[_0xc4a3('0x5d')]['id'];}return db[_0xc4a3('0x42')]['find']({'where':{'id':_0x14ffff[_0xc4a3('0x57')]['id']}})[_0xc4a3('0x23')](handleEntityNotFound(_0x2684dc,null))[_0xc4a3('0x23')](function(_0x56463c){if(_0x56463c){_0x14ffff[_0xc4a3('0x5d')]['OpenchannelAccountId']=_0x56463c['id'];return db[_0xc4a3('0x6f')][_0xc4a3('0x5c')](_0x14ffff[_0xc4a3('0x5d')]);}})[_0xc4a3('0x23')](respondWithResult(_0x2684dc,null))['catch'](handleError(_0x2684dc,null));};exports[_0xc4a3('0x70')]=function(_0x1fc2b2,_0x747271,_0x120eac){var _0x242f51={'raw':![],'where':{}};var _0x1a5556={};var _0x7a2a78={'count':0x0,'rows':[]};return db[_0xc4a3('0x42')][_0xc4a3('0x68')]({'where':{'id':_0x1fc2b2[_0xc4a3('0x57')]['id']}})[_0xc4a3('0x23')](handleEntityNotFound(_0x747271,null))[_0xc4a3('0x23')](function(_0x258650){if(_0x258650){_0x1a5556[_0xc4a3('0x45')]=_['keys'](db[_0xc4a3('0x6f')][_0xc4a3('0x5a')]);_0x1a5556['query']=_[_0xc4a3('0x59')](_0x1fc2b2[_0xc4a3('0x46')]);_0x1a5556[_0xc4a3('0x47')]=_[_0xc4a3('0x48')](_0x1a5556[_0xc4a3('0x45')],_0x1a5556[_0xc4a3('0x46')]);_0x242f51[_0xc4a3('0x4a')]=_['intersection'](_0x1a5556[_0xc4a3('0x45')],qs[_0xc4a3('0x49')](_0x1fc2b2[_0xc4a3('0x46')][_0xc4a3('0x49')]));_0x242f51['attributes']=_0x242f51[_0xc4a3('0x4a')][_0xc4a3('0x4b')]?_0x242f51['attributes']:_0x1a5556['model'];if(!_0x1fc2b2[_0xc4a3('0x46')][_0xc4a3('0x4c')](_0xc4a3('0x4d'))){_0x242f51[_0xc4a3('0x34')]=qs['limit'](_0x1fc2b2['query'][_0xc4a3('0x34')]);_0x242f51[_0xc4a3('0x31')]=qs[_0xc4a3('0x31')](_0x1fc2b2['query']['offset']);}_0x242f51[_0xc4a3('0x69')]=qs['sort'](_0x1fc2b2[_0xc4a3('0x46')][_0xc4a3('0x4e')]);_0x242f51[_0xc4a3('0x50')]=qs[_0xc4a3('0x47')](_[_0xc4a3('0x6a')](_0x1fc2b2[_0xc4a3('0x46')],_0x1a5556['filters']));_0x242f51[_0xc4a3('0x50')]['OpenchannelAccountId']=_0x258650['id'];if(_0x1fc2b2[_0xc4a3('0x46')][_0xc4a3('0x4f')]){_0x242f51[_0xc4a3('0x50')]=_[_0xc4a3('0x51')](_0x242f51['where'],{'$or':_['map'](_0x242f51[_0xc4a3('0x4a')],function(_0x5d117f){var _0x54774d={};_0x54774d[_0x5d117f]={'$like':'%'+_0x1fc2b2[_0xc4a3('0x46')][_0xc4a3('0x4f')]+'%'};return _0x54774d;})});}_0x242f51=_[_0xc4a3('0x51')]({},_0x242f51,_0x1fc2b2[_0xc4a3('0x53')]);return db[_0xc4a3('0x6f')][_0xc4a3('0x33')]({'where':_0x242f51['where']})[_0xc4a3('0x23')](function(_0x2db4c7){_0x7a2a78[_0xc4a3('0x33')]=_0x2db4c7;if(_0x1fc2b2[_0xc4a3('0x46')][_0xc4a3('0x54')]){_0x242f51[_0xc4a3('0x6c')]=[{'all':!![]}];}return db[_0xc4a3('0x6f')]['findAll'](_0x242f51);})[_0xc4a3('0x23')](function(_0x34f3ea){_0x7a2a78['rows']=_0x34f3ea;return _0x7a2a78;});}})[_0xc4a3('0x23')](respondWithFilteredResult(_0x747271,_0x242f51))[_0xc4a3('0x56')](handleError(_0x747271,null));};exports[_0xc4a3('0x71')]=function(_0x2447cf,_0x2ddbbf,_0x14f4d6){return db['OpenchannelAccount'][_0xc4a3('0x5b')]({'where':{'id':_0x2447cf[_0xc4a3('0x57')]['id']}})['then'](handleEntityNotFound(_0x2ddbbf,null))[_0xc4a3('0x23')](function(_0xa6ae16){if(_0xa6ae16){return _0xa6ae16[_0xc4a3('0x71')](_0x2447cf[_0xc4a3('0x46')][_0xc4a3('0x6d')]);}})['then'](respondWithStatusCode(_0x2ddbbf,null))[_0xc4a3('0x56')](handleError(_0x2ddbbf,null));};exports[_0xc4a3('0x72')]=function(_0x13e3cd,_0x21fc20,_0x454c2c){var _0x4dff58={'body':_0x13e3cd[_0xc4a3('0x5d')],'channel':_0xc4a3('0x73')};var _0x42da35=[];var _0x5810ef=[];var _0x29594e={};var _0x2aa4fe=![];return db['CmContact']['describe']()[_0xc4a3('0x23')](function(_0x466cff){if(!_0x466cff){throw new db['Sequelize']['ValidationError'](_0xc4a3('0x74'));}_0x42da35=_[_0xc4a3('0x75')](_[_0xc4a3('0x59')](_0x466cff),['createdAt',_0xc4a3('0x76')]);_0x5810ef=_[_0xc4a3('0x75')](_[_0xc4a3('0x59')](_0x466cff),[_0xc4a3('0x77'),_0xc4a3('0x76'),'CompanyId','ListId']);if(_0x13e3cd[_0xc4a3('0x5d')]['id']){delete _0x13e3cd[_0xc4a3('0x5d')]['id'];}if(_[_0xc4a3('0x78')](_0x13e3cd[_0xc4a3('0x5d')][_0xc4a3('0x79')])){throw new db['Sequelize']['ValidationError'](_0xc4a3('0x7a'));}if(_[_0xc4a3('0x78')](_0x13e3cd['body'][_0xc4a3('0x5d')])||_0x13e3cd['body'][_0xc4a3('0x5d')]===''){throw new db[(_0xc4a3('0x7b'))][(_0xc4a3('0x7c'))](_0xc4a3('0x7d'));}if(_[_0xc4a3('0x78')](_0x13e3cd[_0xc4a3('0x5d')][_0xc4a3('0x7e')])){throw new db['Sequelize'][(_0xc4a3('0x7c'))](_0xc4a3('0x7f')+_0x5810ef);}if(!_[_0xc4a3('0x80')](_0x5810ef,_0x13e3cd[_0xc4a3('0x5d')][_0xc4a3('0x7e')])){throw new db['Sequelize'][(_0xc4a3('0x7c'))](_0xc4a3('0x81')+_0x5810ef);}_0x29594e[_0x13e3cd['body'][_0xc4a3('0x7e')]]=_0x13e3cd['body']['from'];})[_0xc4a3('0x23')](function(){return db[_0xc4a3('0x42')][_0xc4a3('0x5b')]({'where':{'id':_0x13e3cd[_0xc4a3('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0xc4a3('0x82'),'include':[{'model':db[_0xc4a3('0x83')],'as':'Contacts','where':_0x29594e,'limit':0x1,'order':[['updatedAt',_0xc4a3('0x84')]]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x21fc20,null))[_0xc4a3('0x23')](function(_0x1db366){if(_0x1db366&&_0x1db366[_0xc4a3('0x82')]){_0x4dff58['account']=_0x1db366;_0x4dff58['applications']=_0x1db366['Applications'];_0x4dff58[_0xc4a3('0x85')]=_0x1db366[_0xc4a3('0x82')];_0x4dff58[_0xc4a3('0x86')]=_[_0xc4a3('0x87')](_0x4dff58[_0xc4a3('0x86')],['priority'],[_0xc4a3('0x88')]);if(_0x4dff58[_0xc4a3('0x89')]['Applications']){delete _0x4dff58[_0xc4a3('0x89')]['Applications'];}if(_0x4dff58[_0xc4a3('0x89')]['List']&&_0x4dff58[_0xc4a3('0x89')][_0xc4a3('0x82')]['Contacts'][_0xc4a3('0x4b')]){return _0x4dff58[_0xc4a3('0x89')][_0xc4a3('0x82')]['Contacts'][0x0];}var _0x242820=_['defaults'](_0x13e3cd[_0xc4a3('0x5d')],{'firstName':_0x13e3cd[_0xc4a3('0x5d')]['from'],'ListId':_0x1db366[_0xc4a3('0x8a')]});_0x242820[_0x13e3cd['body']['mapKey']]=_0x13e3cd['body'][_0xc4a3('0x79')];return db[_0xc4a3('0x83')][_0xc4a3('0x5c')](_0x242820,{'fields':_0x42da35,'raw':!![]});}})['then'](handleEntityNotFound(_0x21fc20,null))['then'](function(_0x31154d){_0x4dff58['contact']=_0x31154d;if(_0x31154d){var _0x1dedc3={'ContactId':_0x31154d['id'],'OpenchannelAccountId':_0x13e3cd['params']['id'],'from':(_0x31154d[_0xc4a3('0x8b')]||'')+'\x20'+(_0x31154d[_0xc4a3('0x8c')]||'')};var _0x1ff192={'OpenchannelAccountId':_0x13e3cd[_0xc4a3('0x57')]['id'],'closed':![]};if(_0x13e3cd[_0xc4a3('0x5d')][_0xc4a3('0x8d')]){_0x1ff192['threadId']=_0x13e3cd[_0xc4a3('0x5d')][_0xc4a3('0x8d')];return db[_0xc4a3('0x8e')][_0xc4a3('0x5b')]({'where':_0x1ff192})[_0xc4a3('0x23')](function(_0x5929f2){if(_0x5929f2){return[_0x5929f2,![]];}_0x1dedc3[_0xc4a3('0x8d')]=_0x13e3cd[_0xc4a3('0x5d')]['threadId'];_0x1dedc3['externalUrl']=_0x13e3cd[_0xc4a3('0x5d')][_0xc4a3('0x8f')];return db['OpenchannelInteraction'][_0xc4a3('0x5c')](_0x1dedc3)[_0xc4a3('0x23')](function(_0xe10079){return[_0xe10079,!![]];});});}else{_0x1ff192[_0xc4a3('0x8d')]=null;}_0x1ff192[_0xc4a3('0x90')]=_0x31154d['id'];return db[_0xc4a3('0x8e')][_0xc4a3('0x5b')]({'where':_0x1ff192})['then'](function(_0x417cb2){if(_0x417cb2){return[_0x417cb2,![]];}return db[_0xc4a3('0x8e')]['create'](_0x1dedc3)[_0xc4a3('0x23')](function(_0x24cc1f){return[_0x24cc1f,!![]];});});}})[_0xc4a3('0x91')](function(_0x4d0e81,_0x3afdba){if(_0x4d0e81){_0x2aa4fe=_0x3afdba;if(!_0x3afdba){var _0x501e55={'from':(_0x4dff58[_0xc4a3('0x92')][_0xc4a3('0x8b')]||'')+'\x20'+(_0x4dff58[_0xc4a3('0x92')][_0xc4a3('0x8c')]||'')};if(_0x13e3cd[_0xc4a3('0x5d')][_0xc4a3('0x8d')]&&_0x13e3cd[_0xc4a3('0x5d')]['messageId']&&_0x13e3cd[_0xc4a3('0x5d')]['threadId']!=_0x13e3cd[_0xc4a3('0x5d')][_0xc4a3('0x93')]){_0x501e55[_0xc4a3('0x8d')]=_0x13e3cd[_0xc4a3('0x5d')][_0xc4a3('0x93')];}return _0x4d0e81[_0xc4a3('0x94')](_0x501e55);}else{return _0x4d0e81;}}})[_0xc4a3('0x23')](function(_0x4ae63d){_0x4dff58[_0xc4a3('0x95')]=_0x4ae63d[_0xc4a3('0x3c')]({'plain':!![]});_0x4dff58[_0xc4a3('0x95')][_0xc4a3('0x96')]=_0x2aa4fe;if(_0x4dff58['interaction'][_0xc4a3('0x96')]){if(_0x4dff58['account'][_0xc4a3('0x97')]){_0x4dff58['applications'][_0xc4a3('0x98')]({'id':0x0,'priority':_0x4dff58[_0xc4a3('0x86')][_0xc4a3('0x4b')]+0x1,'app':_0xc4a3('0x99'),'appdata':_0xc4a3('0x9a'),'interval':_0xc4a3('0x9b')});}}return db['OpenchannelMessage']['create']({'body':_0x13e3cd[_0xc4a3('0x5d')][_0xc4a3('0x5d')],'OpenchannelAccountId':_0x13e3cd['params']['id'],'OpenchannelInteractionId':_0x4ae63d['id'],'direction':'in','ContactId':_0x4dff58['contact']['id'],'AttachmentId':_0x13e3cd['body'][_0xc4a3('0x9c')]});})['then'](function(_0x4d2bee){_0x4dff58[_0xc4a3('0x2c')]=_0x4d2bee;if(_0x4dff58[_0xc4a3('0x95')][_0xc4a3('0x9d')]){return db['User']['find']({'attributes':['id',_0xc4a3('0x3e')],'where':{'id':_0x4dff58[_0xc4a3('0x95')][_0xc4a3('0x9d')]}})[_0xc4a3('0x23')](function(_0x3eaa6e){if(_0x3eaa6e){_0x4dff58[_0xc4a3('0x86')][_0xc4a3('0x9e')]({'id':0x0,'priority':0x0,'app':_0xc4a3('0x9f'),'appdata':_0x3eaa6e[_0xc4a3('0x3e')]+','+(_0x4dff58[_0xc4a3('0x89')][_0xc4a3('0xa0')]||0xa),'interval':_0xc4a3('0x9b')});_0x4dff58[_0xc4a3('0xa1')]=![];}return respondWithRpcPromise(_0xc4a3('0xa2'),_0xc4a3('0xa3'),_0x4dff58);});}return respondWithRpcPromise('Start',_0xc4a3('0xa3'),_0x4dff58);})[_0xc4a3('0x23')](function(_0x36edd7){respondWithRpcPromise(_0xc4a3('0xa4'),'EventManager',{'event':_0xc4a3('0x72'),'message':_0x36edd7},client9002);return _0x36edd7;})[_0xc4a3('0x23')](respondWithResult(_0x21fc20,null))[_0xc4a3('0x56')](handleError(_0x21fc20,null));};exports[_0xc4a3('0xa5')]=function(_0x13587c,_0x461287,_0x5c8f6c){return db[_0xc4a3('0x42')]['findOne']({'where':{'id':_0x13587c[_0xc4a3('0x57')]['id']}})[_0xc4a3('0x23')](handleEntityNotFound(_0x461287,null))['then'](function(_0x1300d9){if(_0x1300d9){return db[_0xc4a3('0xa6')][_0xc4a3('0xa7')](function(_0x1660d3){return db[_0xc4a3('0xa8')][_0xc4a3('0x3b')]({'where':{'OpenchannelAccountId':_0x13587c['params']['id']},'transaction':_0x1660d3})[_0xc4a3('0x23')](function(_0x516b88){var _0x1dc43c=_[_0xc4a3('0x41')](_0x13587c[_0xc4a3('0x5d')],function(_0x5c7631){_0x5c7631[_0xc4a3('0x6b')]=_0x13587c[_0xc4a3('0x57')]['id'];return _0x5c7631;});return db[_0xc4a3('0xa8')]['bulkCreate'](_0x1dc43c,{'transaction':_0x1660d3});});})[_0xc4a3('0x23')](function(){return db[_0xc4a3('0xa8')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x13587c['params']['id']},'order':_0xc4a3('0xa9')});});}})[_0xc4a3('0x23')](respondWithResult(_0x461287,null))[_0xc4a3('0x56')](handleError(_0x461287,null));};exports[_0xc4a3('0xaa')]=function(_0xf2446f,_0x5a8a6a,_0x32121b){var _0x2caa1c={};var _0x31e8b5={};var _0x391009;var _0x68d641;return db['OpenchannelAccount'][_0xc4a3('0x68')]({'where':{'id':_0xf2446f[_0xc4a3('0x57')]['id']}})[_0xc4a3('0x23')](handleEntityNotFound(_0x5a8a6a,null))['then'](function(_0x48726){if(_0x48726){_0x391009=_0x48726;_0x31e8b5[_0xc4a3('0x45')]=_['keys'](db[_0xc4a3('0xa8')][_0xc4a3('0x5a')]);_0x31e8b5[_0xc4a3('0x46')]=_[_0xc4a3('0x59')](_0xf2446f[_0xc4a3('0x46')]);_0x31e8b5[_0xc4a3('0x47')]=_['intersection'](_0x31e8b5[_0xc4a3('0x45')],_0x31e8b5['query']);_0x2caa1c[_0xc4a3('0x4a')]=_[_0xc4a3('0x48')](_0x31e8b5[_0xc4a3('0x45')],qs[_0xc4a3('0x49')](_0xf2446f[_0xc4a3('0x46')][_0xc4a3('0x49')]));_0x2caa1c['attributes']=_0x2caa1c[_0xc4a3('0x4a')][_0xc4a3('0x4b')]?_0x2caa1c[_0xc4a3('0x4a')]:_0x31e8b5[_0xc4a3('0x45')];_0x2caa1c[_0xc4a3('0x69')]=qs[_0xc4a3('0x4e')](_0xf2446f['query'][_0xc4a3('0x4e')]);_0x2caa1c[_0xc4a3('0x50')]=qs[_0xc4a3('0x47')](_[_0xc4a3('0x6a')](_0xf2446f['query'],_0x31e8b5[_0xc4a3('0x47')]));if(_0xf2446f[_0xc4a3('0x46')][_0xc4a3('0x4f')]){_0x2caa1c[_0xc4a3('0x50')]=_['merge'](_0x2caa1c['where'],{'$or':_['map'](_0x2caa1c[_0xc4a3('0x4a')],function(_0x148414){var _0x1851cb={};_0x1851cb[_0x148414]={'$like':'%'+_0xf2446f['query'][_0xc4a3('0x4f')]+'%'};return _0x1851cb;})});}_0x2caa1c=_['merge']({},_0x2caa1c,_0xf2446f['options']);return _0x391009[_0xc4a3('0xaa')](_0x2caa1c);}})[_0xc4a3('0x23')](function(_0x1c6209){if(_0x1c6209){_0x68d641=_0x1c6209[_0xc4a3('0x4b')];if(!_0xf2446f[_0xc4a3('0x46')][_0xc4a3('0x4c')]('nolimit')){_0x2caa1c[_0xc4a3('0x34')]=qs[_0xc4a3('0x34')](_0xf2446f['query']['limit']);_0x2caa1c[_0xc4a3('0x31')]=qs[_0xc4a3('0x31')](_0xf2446f[_0xc4a3('0x46')]['offset']);}return _0x391009[_0xc4a3('0xaa')](_0x2caa1c);}})[_0xc4a3('0x23')](function(_0x48f484){if(_0x48f484){return _0x48f484?{'count':_0x68d641,'rows':_0x48f484}:null;}})[_0xc4a3('0x23')](respondWithResult(_0x5a8a6a,null))[_0xc4a3('0x56')](handleError(_0x5a8a6a,null));};exports[_0xc4a3('0xab')]=function(_0x508770,_0x2fde93,_0x5a50b8){var _0x2e840c={'raw':![],'where':{}};var _0x5f0980={};var _0x313ba2={'count':0x0,'rows':[]};return db[_0xc4a3('0x42')][_0xc4a3('0x68')]({'where':{'id':_0x508770['params']['id']}})[_0xc4a3('0x23')](handleEntityNotFound(_0x2fde93,null))[_0xc4a3('0x23')](function(_0x1dc524){if(_0x1dc524){_0x5f0980[_0xc4a3('0x45')]=_[_0xc4a3('0x59')](db[_0xc4a3('0x8e')][_0xc4a3('0x5a')]);_0x5f0980[_0xc4a3('0x46')]=_[_0xc4a3('0x59')](_0x508770[_0xc4a3('0x46')]);_0x5f0980[_0xc4a3('0x47')]=_[_0xc4a3('0x48')](_0x5f0980[_0xc4a3('0x45')],_0x5f0980[_0xc4a3('0x46')]);_0x2e840c[_0xc4a3('0x4a')]=_[_0xc4a3('0x48')](_0x5f0980['model'],qs[_0xc4a3('0x49')](_0x508770[_0xc4a3('0x46')]['fields']));_0x2e840c[_0xc4a3('0x4a')]=_0x2e840c[_0xc4a3('0x4a')][_0xc4a3('0x4b')]?_0x2e840c['attributes']:_0x5f0980['model'];if(!_0x508770['query'][_0xc4a3('0x4c')](_0xc4a3('0x4d'))){_0x2e840c['limit']=qs['limit'](_0x508770[_0xc4a3('0x46')]['limit']);_0x2e840c[_0xc4a3('0x31')]=qs[_0xc4a3('0x31')](_0x508770['query'][_0xc4a3('0x31')]);}_0x2e840c[_0xc4a3('0x69')]=qs[_0xc4a3('0x4e')](_0x508770[_0xc4a3('0x46')][_0xc4a3('0x4e')]);_0x2e840c['where']=qs[_0xc4a3('0x47')](_[_0xc4a3('0x6a')](_0x508770[_0xc4a3('0x46')],_0x5f0980[_0xc4a3('0x47')]));_0x2e840c[_0xc4a3('0x50')]['OpenchannelAccountId']=_0x1dc524['id'];if(_0x508770['query'][_0xc4a3('0x4f')]){_0x2e840c[_0xc4a3('0x50')]=_[_0xc4a3('0x51')](_0x2e840c[_0xc4a3('0x50')],{'$or':_['map'](_0x2e840c[_0xc4a3('0x4a')],function(_0x1623ae){var _0x53c8cd={};_0x53c8cd[_0x1623ae]={'$like':'%'+_0x508770[_0xc4a3('0x46')][_0xc4a3('0x4f')]+'%'};return _0x53c8cd;})});}_0x2e840c=_[_0xc4a3('0x51')]({},_0x2e840c,_0x508770[_0xc4a3('0x53')]);return db[_0xc4a3('0x8e')][_0xc4a3('0x33')]({'where':_0x2e840c[_0xc4a3('0x50')]})[_0xc4a3('0x23')](function(_0x491efe){_0x313ba2[_0xc4a3('0x33')]=_0x491efe;if(_0x508770[_0xc4a3('0x46')][_0xc4a3('0x54')]){_0x2e840c['include']=[{'model':db[_0xc4a3('0x83')],'as':_0xc4a3('0xac'),'required':![]},{'model':db[_0xc4a3('0xad')],'as':_0xc4a3('0xae'),'attributes':[_0xc4a3('0x3e'),_0xc4a3('0xaf'),_0xc4a3('0xb0')],'required':![]},{'model':db['Tag'],'as':_0xc4a3('0xb1'),'attributes':['id','name','color'],'where':_0x508770[_0xc4a3('0x46')][_0xc4a3('0xb2')]?{'id':_0x508770['query'][_0xc4a3('0xb2')]}:undefined,'required':_0x508770[_0xc4a3('0x46')]['tag']?!![]:![]}];}return db[_0xc4a3('0x8e')][_0xc4a3('0x55')](_0x2e840c);})[_0xc4a3('0x23')](function(_0x3e8c69){_0x313ba2['rows']=_0x3e8c69;return _0x313ba2;});}})['then'](respondWithFilteredResult(_0x2fde93,_0x2e840c))['catch'](handleError(_0x2fde93,null));};exports['addAgents']=function(_0x454306,_0x5caf03,_0x480eeb){return db[_0xc4a3('0x42')][_0xc4a3('0x5b')]({'where':{'id':_0x454306[_0xc4a3('0x57')]['id']}})[_0xc4a3('0x23')](handleEntityNotFound(_0x5caf03,null))[_0xc4a3('0x23')](function(_0x3fa0e7){if(_0x3fa0e7){return _0x3fa0e7[_0xc4a3('0xb3')](_0x454306[_0xc4a3('0x5d')][_0xc4a3('0x6d')],_[_0xc4a3('0xb4')](_0x454306[_0xc4a3('0x5d')],[_0xc4a3('0x6d'),'id'])||{})['spread'](function(_0x4d6845){for(var _0x51a7d5=0x0;_0x51a7d5<_0x454306[_0xc4a3('0x5d')][_0xc4a3('0x6d')][_0xc4a3('0x4b')];_0x51a7d5+=0x1){socket[_0xc4a3('0xb5')](_0xc4a3('0xb6'),{'UserId':Number(_0x454306['body'][_0xc4a3('0x6d')][_0x51a7d5]),'OpenchannelAccountId':Number(_0x454306[_0xc4a3('0x57')]['id'])});}return _0x4d6845;});}})[_0xc4a3('0x23')](respondWithResult(_0x5caf03,null))['catch'](handleError(_0x5caf03,null));};exports['removeAgents']=function(_0x1d660e,_0x380e8a,_0x2e6b3a){return db[_0xc4a3('0x42')][_0xc4a3('0x5b')]({'where':{'id':_0x1d660e['params']['id']}})['then'](handleEntityNotFound(_0x380e8a,null))[_0xc4a3('0x23')](function(_0x2a7b35){if(_0x2a7b35){return _0x2a7b35[_0xc4a3('0xb7')](_0x1d660e[_0xc4a3('0x46')][_0xc4a3('0x6d')])[_0xc4a3('0x23')](function(){if(_[_0xc4a3('0xb8')](_0x1d660e[_0xc4a3('0x46')][_0xc4a3('0x6d')])){for(var _0x3cc06f=0x0;_0x3cc06f<_0x1d660e[_0xc4a3('0x46')][_0xc4a3('0x6d')]['length'];_0x3cc06f+=0x1){socket[_0xc4a3('0xb5')](_0xc4a3('0xb9'),{'UserId':Number(_0x1d660e[_0xc4a3('0x46')][_0xc4a3('0x6d')][_0x3cc06f]),'OpenchannelAccountId':Number(_0x1d660e[_0xc4a3('0x57')]['id'])});}}else{socket[_0xc4a3('0xb5')](_0xc4a3('0xb9'),{'UserId':Number(_0x1d660e[_0xc4a3('0x46')]['ids']),'OpenchannelAccountId':Number(_0x1d660e[_0xc4a3('0x57')]['id'])});}});}})[_0xc4a3('0x23')](respondWithStatusCode(_0x380e8a,null))[_0xc4a3('0x56')](handleError(_0x380e8a,null));};exports[_0xc4a3('0xba')]=function(_0x2ee2c8,_0x3613eb,_0x2e1214){var _0x9d65db={};var _0x29ad2e={};var _0x204902;var _0x20c249;return db[_0xc4a3('0x42')]['findOne']({'where':{'id':_0x2ee2c8[_0xc4a3('0x57')]['id']}})[_0xc4a3('0x23')](handleEntityNotFound(_0x3613eb,null))['then'](function(_0x432a91){if(_0x432a91){_0x204902=_0x432a91;_0x29ad2e[_0xc4a3('0x45')]=_[_0xc4a3('0x59')](db[_0xc4a3('0xad')][_0xc4a3('0x5a')]);_0x29ad2e['query']=_[_0xc4a3('0x59')](_0x2ee2c8['query']);_0x29ad2e['filters']=_['intersection'](_0x29ad2e['model'],_0x29ad2e[_0xc4a3('0x46')]);_0x9d65db[_0xc4a3('0x4a')]=_[_0xc4a3('0x48')](_0x29ad2e[_0xc4a3('0x45')],qs[_0xc4a3('0x49')](_0x2ee2c8[_0xc4a3('0x46')][_0xc4a3('0x49')]));_0x9d65db[_0xc4a3('0x4a')]=_0x9d65db['attributes'][_0xc4a3('0x4b')]?_0x9d65db[_0xc4a3('0x4a')]:_0x29ad2e[_0xc4a3('0x45')];_0x9d65db[_0xc4a3('0x69')]=qs[_0xc4a3('0x4e')](_0x2ee2c8[_0xc4a3('0x46')][_0xc4a3('0x4e')]);_0x9d65db[_0xc4a3('0x50')]=qs[_0xc4a3('0x47')](_[_0xc4a3('0x6a')](_0x2ee2c8[_0xc4a3('0x46')],_0x29ad2e[_0xc4a3('0x47')]));if(_0x2ee2c8['query'][_0xc4a3('0x4f')]){_0x9d65db[_0xc4a3('0x50')]=_['merge'](_0x9d65db[_0xc4a3('0x50')],{'$or':_[_0xc4a3('0x41')](_0x9d65db[_0xc4a3('0x4a')],function(_0x4c55fe){var _0x47d1b1={};_0x47d1b1[_0x4c55fe]={'$like':'%'+_0x2ee2c8[_0xc4a3('0x46')]['filter']+'%'};return _0x47d1b1;})});}_0x9d65db=_['merge']({},_0x9d65db,_0x2ee2c8[_0xc4a3('0x53')]);return _0x204902[_0xc4a3('0xba')](_0x9d65db);}})[_0xc4a3('0x23')](function(_0x16eecc){if(_0x16eecc){_0x20c249=_0x16eecc[_0xc4a3('0x4b')];if(!_0x2ee2c8[_0xc4a3('0x46')][_0xc4a3('0x4c')](_0xc4a3('0x4d'))){_0x9d65db['limit']=qs[_0xc4a3('0x34')](_0x2ee2c8[_0xc4a3('0x46')]['limit']);_0x9d65db['offset']=qs[_0xc4a3('0x31')](_0x2ee2c8[_0xc4a3('0x46')][_0xc4a3('0x31')]);}return _0x204902['getAgents'](_0x9d65db);}})[_0xc4a3('0x23')](function(_0x34aba7){if(_0x34aba7){return _0x34aba7?{'count':_0x20c249,'rows':_0x34aba7}:null;}})[_0xc4a3('0x23')](respondWithResult(_0x3613eb,null))[_0xc4a3('0x56')](handleError(_0x3613eb,null));};exports[_0xc4a3('0xbb')]=function(_0x29e2c2,_0x166316,_0x571a0a){var _0x4d8e7e,_0x1181ca,_0x28343c;if(_['isNil'](_0x29e2c2['body'][_0xc4a3('0x5d')])||_0x29e2c2[_0xc4a3('0x5d')][_0xc4a3('0x5d')]===''){throw new db['Sequelize'][(_0xc4a3('0x7c'))](_0xc4a3('0x7d'));}if(_['isNil'](_0x29e2c2[_0xc4a3('0x5d')]['to'])){}_0x4d8e7e=_0x29e2c2[_0xc4a3('0x5d')]['to'];return db[_0xc4a3('0x42')][_0xc4a3('0x68')]({'where':{'id':_0x29e2c2[_0xc4a3('0x57')]['id']}})['then'](handleEntityNotFound(_0x166316,null))[_0xc4a3('0x23')](function(_0x120e40){if(_0x120e40){return db['OpenchannelAccount'][_0xc4a3('0x5b')]({'where':{'id':_0x120e40['id']},'include':[{'model':db[_0xc4a3('0xbc')],'as':_0xc4a3('0x82'),'include':[{'model':db[_0xc4a3('0x83')],'as':_0xc4a3('0xbd'),'where':{[_0x120e40[_0xc4a3('0x7e')]]:_0x4d8e7e},'limit':0x1,'order':[[_0xc4a3('0x76'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x166316,null))[_0xc4a3('0x23')](function(_0x1815c6){if(_0x1815c6&&_0x1815c6[_0xc4a3('0x82')]){_0x1181ca=_0x1815c6[_0xc4a3('0x3c')]({'plain':!![]});if(_0x1181ca['List']&&_0x1181ca[_0xc4a3('0x82')][_0xc4a3('0xbd')]['length']){return _0x1181ca['List'][_0xc4a3('0xbd')][0x0];}return db['CmContact'][_0xc4a3('0x5c')](_['defaults'](_0x29e2c2[_0xc4a3('0x5d')],{'firstName':_0x4d8e7e,[_0x1815c6[_0xc4a3('0x7e')]]:_0x4d8e7e,'phone':_0x4d8e7e,'ListId':_0x1181ca['ListId']}));}})[_0xc4a3('0x23')](handleEntityNotFound(_0x166316,null))[_0xc4a3('0x23')](function(_0x2586e6){if(_0x2586e6){_0x28343c=_0x2586e6;return db[_0xc4a3('0x8e')][_0xc4a3('0x5b')]({'where':{'ContactId':_0x28343c['id'],'closed':![],'OpenchannelAccountId':_0x1181ca['id']}})[_0xc4a3('0x23')](function(_0x2c9533){if(_0x2c9533){return[_0x2c9533,![]];}return db['OpenchannelInteraction'][_0xc4a3('0x5c')]({'UserId':_0x29e2c2[_0xc4a3('0x5e')]['id'],'ContactId':_0x28343c['id'],'OpenchannelAccountId':_0x1181ca['id'],'lastMsgDirection':_0xc4a3('0xbe'),'Messages':[_[_0xc4a3('0x51')](_0x29e2c2[_0xc4a3('0x5d')],{'read':![],'body':_0x29e2c2[_0xc4a3('0x5d')][_0xc4a3('0x5d')],'OpenchannelAccountId':_0x1181ca['id'],'UserId':_0x29e2c2[_0xc4a3('0x5e')]['id'],'ContactId':_0x28343c['id']})]},{'include':[{'model':db[_0xc4a3('0xbf')],'as':_0xc4a3('0xc0')}]})[_0xc4a3('0x23')](function(_0x17a0fe){return[_0x17a0fe,!![]];});});}})[_0xc4a3('0x91')](function(_0x40bcda,_0x5f4cbe){if(_0x5f4cbe){return _0x40bcda;}return db[_0xc4a3('0xbf')][_0xc4a3('0x5c')](_[_0xc4a3('0x51')](_0x29e2c2['body'],{'read':![],'body':_0x29e2c2[_0xc4a3('0x5d')][_0xc4a3('0x5d')],'OpenchannelAccountId':_0x1181ca['id'],'OpenchannelInteractionId':_0x40bcda['id'],'UserId':_0x29e2c2[_0xc4a3('0x5e')]['id'],'ContactId':_0x28343c['id']}))[_0xc4a3('0x23')](function(_0x301694){_0x40bcda[_0xc4a3('0xc1')]['Messages']=[];_0x40bcda[_0xc4a3('0xc1')][_0xc4a3('0xc0')]['push'](_0x301694[_0xc4a3('0xc1')]);return _0x40bcda;});});}})[_0xc4a3('0x23')](respondWithResult(_0x166316,null))[_0xc4a3('0x56')](handleError(_0x166316,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index e10ed8d..bc8fcea 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 _0xf4eb=['hook','events','update','emit','hasOwnProperty'];(function(_0x5914bf,_0xe1204f){var _0x49ae1d=function(_0x2c93c5){while(--_0x2c93c5){_0x5914bf['push'](_0x5914bf['shift']());}};_0x49ae1d(++_0xe1204f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x11d579,_0x19265b){_0x11d579=_0x11d579-0x0;var _0x14dd45=_0xf4eb[_0x11d579];return _0x14dd45;};'use strict';var EventEmitter=require(_0xbf4e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbf4e('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4e7fa7){return function(_0x2e3070,_0x1c7606,_0x32d1d7){OpenchannelAccountEvents[_0xbf4e('0x2')](_0x4e7fa7+':'+_0x2e3070['id'],_0x2e3070);OpenchannelAccountEvents[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070);_0x32d1d7(null);};}for(var e in events){if(events[_0xbf4e('0x3')](e)){var event=events[e];OpenchannelAccount[_0xbf4e('0x4')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xe706=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update','remove','emit'];(function(_0x53912a,_0x519ebd){var _0x4db109=function(_0x24f263){while(--_0x24f263){_0x53912a['push'](_0x53912a['shift']());}};_0x4db109(++_0x519ebd);}(_0xe706,0xa3));var _0x6e70=function(_0xbc2974,_0xec3342){_0xbc2974=_0xbc2974-0x0;var _0x3a5b4f=_0xe706[_0xbc2974];return _0x3a5b4f;};'use strict';var EventEmitter=require(_0x6e70('0x0'));var OpenchannelAccount=require(_0x6e70('0x1'))['db'][_0x6e70('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e70('0x3'),'afterUpdate':_0x6e70('0x4'),'afterDestroy':_0x6e70('0x5')};function emitEvent(_0x7dfbc3){return function(_0x142c27,_0x2164a4,_0x376a8d){OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3+':'+_0x142c27['id'],_0x142c27);OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3,_0x142c27);_0x376a8d(null);};}for(var e in events){if(events[_0x6e70('0x7')](e)){var event=events[e];OpenchannelAccount[_0x6e70('0x8')](e,emitEvent(event));}}module[_0x6e70('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 6fe7cde..f0bf4d6 100644 --- a/server/api/openchannelAccount/openchannelAccount.model.js +++ b/server/api/openchannelAccount/openchannelAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x28cfe9,_0x1744d3){var _0x4d7409=function(_0x4d02d2){while(--_0x4d02d2){_0x28cfe9['push'](_0x28cfe9['shift']());}};_0x4d7409(++_0x1744d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x326886,_0x5e254b){var _0x2813b5=function(_0x58a9c1){while(--_0x58a9c1){_0x326886['push'](_0x326886['shift']());}};_0x2813b5(++_0x5e254b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 48af717..695bf26 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 _0x693f=['info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./openchannelAccount.socket','register','request','then'];(function(_0x24ab5b,_0x4b6a8a){var _0x6cb7f2=function(_0x20c764){while(--_0x20c764){_0x24ab5b['push'](_0x24ab5b['shift']());}};_0x6cb7f2(++_0x4b6a8a);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf693('0x0'));var util=require(_0xf693('0x1'));var moment=require(_0xf693('0x2'));var BPromise=require(_0xf693('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf693('0x4'));var db=require(_0xf693('0x5'))['db'];var utils=require(_0xf693('0x6'));var logger=require(_0xf693('0x7'))(_0xf693('0x8'));var config=require(_0xf693('0x9'));var jayson=require(_0xf693('0xa'));var client=jayson['client'][_0xf693('0xb')]({'port':0x232a});config[_0xf693('0xc')]=_['defaults'](config[_0xf693('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf693('0xd'))(new Redis(config['redis']));require(_0xf693('0xe'))[_0xf693('0xf')](socket);function respondWithRpcPromise(_0x48984a,_0x4b09d6,_0x5d9159){return new BPromise(function(_0x38b847,_0x527cd9){return client[_0xf693('0x10')](_0x48984a,_0x5d9159)[_0xf693('0x11')](function(_0x2202f1){logger[_0xf693('0x12')](_0xf693('0x13'),_0x4b09d6,'request\x20sent');logger['debug'](_0xf693('0x14'),_0x4b09d6,_0xf693('0x15'),JSON['stringify'](_0x2202f1));if(_0x2202f1[_0xf693('0x16')]){if(_0x2202f1[_0xf693('0x16')]['code']===0x1f4){logger['error'](_0xf693('0x13'),_0x4b09d6,_0x2202f1[_0xf693('0x16')][_0xf693('0x17')]);return _0x527cd9(_0x2202f1[_0xf693('0x16')][_0xf693('0x17')]);}logger['error'](_0xf693('0x13'),_0x4b09d6,_0x2202f1[_0xf693('0x16')][_0xf693('0x17')]);return _0x38b847(_0x2202f1[_0xf693('0x16')][_0xf693('0x17')]);}else{logger[_0xf693('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x4b09d6,'request\x20sent');_0x38b847(_0x2202f1['result'][_0xf693('0x17')]);}})[_0xf693('0x18')](function(_0x3f4d4d){logger[_0xf693('0x16')](_0xf693('0x13'),_0x4b09d6,_0x3f4d4d);_0x527cd9(_0x3f4d4d);});});} \ No newline at end of file +var _0x4058=['request','then','debug','code','error','message','OpenchannelAccount,\x20%s,\x20%s','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket'];(function(_0x3b4054,_0x2ccc43){var _0x362ff5=function(_0x2b6e48){while(--_0x2b6e48){_0x3b4054['push'](_0x3b4054['shift']());}};_0x362ff5(++_0x2ccc43);}(_0x4058,0x129));var _0x8405=function(_0xef57d4,_0x5cdacb){_0xef57d4=_0xef57d4-0x0;var _0x28c205=_0x4058[_0xef57d4];return _0x28c205;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var moment=require(_0x8405('0x2'));var BPromise=require(_0x8405('0x3'));var rs=require(_0x8405('0x4'));var fs=require('fs');var Redis=require(_0x8405('0x5'));var db=require(_0x8405('0x6'))['db'];var utils=require(_0x8405('0x7'));var logger=require(_0x8405('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8405('0x9')][_0x8405('0xa')]({'port':0x232a});config[_0x8405('0xb')]=_[_0x8405('0xc')](config[_0x8405('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8405('0xd'))(new Redis(config[_0x8405('0xb')]));require(_0x8405('0xe'))['register'](socket);function respondWithRpcPromise(_0x30705f,_0x5e132b,_0x6979fd){return new BPromise(function(_0xb442,_0x50344e){return client[_0x8405('0xf')](_0x30705f,_0x6979fd)[_0x8405('0x10')](function(_0x5b94d5){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x5e132b,'request\x20sent');logger[_0x8405('0x11')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5e132b,'request\x20sent',JSON['stringify'](_0x5b94d5));if(_0x5b94d5['error']){if(_0x5b94d5['error'][_0x8405('0x12')]===0x1f4){logger[_0x8405('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x5e132b,_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);return _0x50344e(_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);}logger['error'](_0x8405('0x15'),_0x5e132b,_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);return _0xb442(_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);}else{logger[_0x8405('0x16')](_0x8405('0x15'),_0x5e132b,_0x8405('0x17'));_0xb442(_0x5b94d5[_0x8405('0x18')][_0x8405('0x14')]);}})[_0x8405('0x19')](function(_0x21376d){logger[_0x8405('0x13')](_0x8405('0x15'),_0x5e132b,_0x21376d);_0x50344e(_0x21376d);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index d4e8909..23579e7 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 _0x54ef=['remove','emit','removeListener','length','./openchannelAccount.events','save'];(function(_0x16a7fe,_0x2b9d1c){var _0x3f664d=function(_0x4e4f77){while(--_0x4e4f77){_0x16a7fe['push'](_0x16a7fe['shift']());}};_0x3f664d(++_0x2b9d1c);}(_0x54ef,0x112));var _0xf54e=function(_0x9b8cd5,_0x440811){_0x9b8cd5=_0x9b8cd5-0x0;var _0x20039e=_0x54ef[_0x9b8cd5];return _0x20039e;};'use strict';var OpenchannelAccountEvents=require(_0xf54e('0x0'));var events=[_0xf54e('0x1'),_0xf54e('0x2'),'update'];function createListener(_0xd936f7,_0x18b7d6){return function(_0x18b1cf){_0x18b7d6[_0xf54e('0x3')](_0xd936f7,_0x18b1cf);};}function removeListener(_0x8b6bb6,_0x431e36){return function(){OpenchannelAccountEvents[_0xf54e('0x4')](_0x8b6bb6,_0x431e36);};}exports['register']=function(_0x55e611){for(var _0x18e84e=0x0,_0x99cf9=events[_0xf54e('0x5')];_0x18e84e<_0x99cf9;_0x18e84e++){var _0x561870=events[_0x18e84e];var _0x27e69b=createListener('openchannelAccount:'+_0x561870,_0x55e611);OpenchannelAccountEvents['on'](_0x561870,_0x27e69b);}}; \ No newline at end of file +var _0x2bb0=['register','length','openchannelAccount:','./openchannelAccount.events','save','remove','emit','removeListener'];(function(_0x306d30,_0x15a684){var _0x44fa4e=function(_0x1675cd){while(--_0x1675cd){_0x306d30['push'](_0x306d30['shift']());}};_0x44fa4e(++_0x15a684);}(_0x2bb0,0xf3));var _0x02bb=function(_0x3ae3a4,_0xf3fcf2){_0x3ae3a4=_0x3ae3a4-0x0;var _0x1ea301=_0x2bb0[_0x3ae3a4];return _0x1ea301;};'use strict';var OpenchannelAccountEvents=require(_0x02bb('0x0'));var events=[_0x02bb('0x1'),_0x02bb('0x2'),'update'];function createListener(_0xc43ce8,_0x59a1ed){return function(_0x4a22b7){_0x59a1ed[_0x02bb('0x3')](_0xc43ce8,_0x4a22b7);};}function removeListener(_0x500cd1,_0x1dff97){return function(){OpenchannelAccountEvents[_0x02bb('0x4')](_0x500cd1,_0x1dff97);};}exports[_0x02bb('0x5')]=function(_0x390ff7){for(var _0x43dbb7=0x0,_0x16bb7c=events[_0x02bb('0x6')];_0x43dbb7<_0x16bb7c;_0x43dbb7++){var _0x47d7ae=events[_0x43dbb7];var _0x6d064a=createListener(_0x02bb('0x7')+_0x47d7ae,_0x390ff7);OpenchannelAccountEvents['on'](_0x47d7ae,_0x6d064a);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 1005d7a..969c044 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 _0x3d65=['isAuthenticated','get','/:id','show','create','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5af9d8,_0x26af73){var _0x1d9019=function(_0xdf14b1){while(--_0xdf14b1){_0x5af9d8['push'](_0x5af9d8['shift']());}};_0x1d9019(++_0x26af73);}(_0x3d65,0x17d));var _0x53d6=function(_0x1023a9,_0x3c2a28){_0x1023a9=_0x1023a9-0x0;var _0xa619fb=_0x3d65[_0x1023a9];return _0xa619fb;};'use strict';var multer=require(_0x53d6('0x0'));var util=require(_0x53d6('0x1'));var path=require(_0x53d6('0x2'));var timeout=require(_0x53d6('0x3'));var express=require(_0x53d6('0x4'));var router=express[_0x53d6('0x5')]();var fs_extra=require(_0x53d6('0x6'));var auth=require(_0x53d6('0x7'));var interaction=require(_0x53d6('0x8'));var config=require(_0x53d6('0x9'));var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0x53d6('0xa')](),controller['index']);router[_0x53d6('0xb')](_0x53d6('0xc'),auth['isAuthenticated'](),controller[_0x53d6('0xd')]);router['post']('/',auth[_0x53d6('0xa')](),controller[_0x53d6('0xe')]);router[_0x53d6('0xf')](_0x53d6('0xc'),auth[_0x53d6('0xa')](),controller['update']);router[_0x53d6('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8c8c=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','get','post','create','put','/:id','update','delete','exports'];(function(_0x5b0741,_0x438df7){var _0x3ee9c9=function(_0x4686d5){while(--_0x4686d5){_0x5b0741['push'](_0x5b0741['shift']());}};_0x3ee9c9(++_0x438df7);}(_0x8c8c,0x1d4));var _0xc8c8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8c8c[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xc8c8('0x0'));var util=require(_0xc8c8('0x1'));var path=require(_0xc8c8('0x2'));var timeout=require('connect-timeout');var express=require(_0xc8c8('0x3'));var router=express[_0xc8c8('0x4')]();var fs_extra=require(_0xc8c8('0x5'));var auth=require(_0xc8c8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc8c8('0x7'));var controller=require(_0xc8c8('0x8'));router['get']('/',auth[_0xc8c8('0x9')](),controller['index']);router[_0xc8c8('0xa')]('/:id',auth[_0xc8c8('0x9')](),controller['show']);router[_0xc8c8('0xb')]('/',auth[_0xc8c8('0x9')](),controller[_0xc8c8('0xc')]);router[_0xc8c8('0xd')](_0xc8c8('0xe'),auth['isAuthenticated'](),controller[_0xc8c8('0xf')]);router[_0xc8c8('0x10')](_0xc8c8('0xe'),auth[_0xc8c8('0x9')](),controller['destroy']);module[_0xc8c8('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 8b87521..aeb57e0 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 _0x448e=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x1d0ae8,_0x9b4aaf){var _0xc20ec9=function(_0x4d189c){while(--_0x4d189c){_0x1d0ae8['push'](_0x1d0ae8['shift']());}};_0xc20ec9(++_0x9b4aaf);}(_0x448e,0xab));var _0xe448=function(_0x1e1fe9,_0x216dd9){_0x1e1fe9=_0x1e1fe9-0x0;var _0x4eeb06=_0x448e[_0x1e1fe9];return _0x4eeb06;};'use strict';var Sequelize=require(_0xe448('0x0'));module[_0xe448('0x1')]={'priority':{'type':Sequelize[_0xe448('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe448('0x3')],'allowNull':![],'defaultValue':_0xe448('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe448('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xe448('0x5')}}; \ No newline at end of file +var _0xdcce=['sequelize','exports','INTEGER','noop','STRING','*,*,*,*'];(function(_0x55a491,_0x291960){var _0x132398=function(_0x447d92){while(--_0x447d92){_0x55a491['push'](_0x55a491['shift']());}};_0x132398(++_0x291960);}(_0xdcce,0x186));var _0xedcc=function(_0x4212ed,_0x1513d8){_0x4212ed=_0x4212ed-0x0;var _0x1bf4ff=_0xdcce[_0x4212ed];return _0x1bf4ff;};'use strict';var Sequelize=require(_0xedcc('0x0'));module[_0xedcc('0x1')]={'priority':{'type':Sequelize[_0xedcc('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xedcc('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xedcc('0x4')],'defaultValue':_0xedcc('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 410bd37..992e259 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 _0x71c6=['filters','attributes','intersection','fields','length','nolimit','sort','where','merge','type','VIRTUAL','filter','options','OpenchannelApplication','includeAll','include','rows','catch','show','params','keys','find','create','body','update','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','then','error','name','send','index','map','rawAttributes','fieldName','key','model','query'];(function(_0x5bb4e8,_0x44b756){var _0x2a86f2=function(_0x279ab2){while(--_0x279ab2){_0x5bb4e8['push'](_0x5bb4e8['shift']());}};_0x2a86f2(++_0x44b756);}(_0x71c6,0x1c3));var _0x671c=function(_0x35fe8f,_0x3d14dd){_0x35fe8f=_0x35fe8f-0x0;var _0x36640f=_0x71c6[_0x35fe8f];return _0x36640f;};'use strict';var emlformat=require(_0x671c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x671c('0x1'));var jsonpatch=require(_0x671c('0x2'));var rp=require('request-promise');var moment=require(_0x671c('0x3'));var BPromise=require(_0x671c('0x4'));var Mustache=require('mustache');var util=require(_0x671c('0x5'));var path=require(_0x671c('0x6'));var sox=require(_0x671c('0x7'));var csv=require(_0x671c('0x8'));var ejs=require(_0x671c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x671c('0xa'));var crypto=require('crypto');var jsforce=require(_0x671c('0xb'));var deskjs=require(_0x671c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x671c('0xd'));var Redis=require(_0x671c('0xe'));var authService=require(_0x671c('0xf'));var qs=require(_0x671c('0x10'));var as=require(_0x671c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x671c('0x12'))('api');var utils=require(_0x671c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x671c('0x14'));var db=require(_0x671c('0x15'))['db'];function respondWithStatusCode(_0x57901e,_0x32c3ae){_0x32c3ae=_0x32c3ae||0xcc;return function(_0x1e8912){if(_0x1e8912){return _0x57901e[_0x671c('0x16')](_0x32c3ae);}return _0x57901e[_0x671c('0x17')](_0x32c3ae)[_0x671c('0x18')]();};}function respondWithResult(_0xd2a511,_0x328abe){_0x328abe=_0x328abe||0xc8;return function(_0x4a68bf){if(_0x4a68bf){return _0xd2a511['status'](_0x328abe)['json'](_0x4a68bf);}};}function respondWithFilteredResult(_0x59d12b,_0x6a0ab5){return function(_0x429b2a){if(_0x429b2a){var _0x133e62=typeof _0x6a0ab5['offset']===_0x671c('0x19')&&typeof _0x6a0ab5['limit']===_0x671c('0x19');var _0x8ae9d4=_0x429b2a[_0x671c('0x1a')];var _0x518d77=_0x133e62?0x0:_0x6a0ab5[_0x671c('0x1b')];var _0x237263=_0x133e62?_0x429b2a[_0x671c('0x1a')]:_0x6a0ab5[_0x671c('0x1b')]+_0x6a0ab5[_0x671c('0x1c')];var _0x2f3557;if(_0x237263>=_0x8ae9d4){_0x237263=_0x8ae9d4;_0x2f3557=0xc8;}else{_0x2f3557=0xce;}_0x59d12b['status'](_0x2f3557);return _0x59d12b[_0x671c('0x1d')](_0x671c('0x1e'),_0x518d77+'-'+_0x237263+'/'+_0x8ae9d4)[_0x671c('0x1f')](_0x429b2a);}return null;};}function patchUpdates(_0x237ba9){return function(_0x5f1551){try{jsonpatch[_0x671c('0x20')](_0x5f1551,_0x237ba9,!![]);}catch(_0x36b6c8){return BPromise[_0x671c('0x21')](_0x36b6c8);}return _0x5f1551[_0x671c('0x22')]();};}function saveUpdates(_0x416f9a,_0xe60c84){return function(_0x1d15a1){if(_0x1d15a1){return _0x1d15a1['update'](_0x416f9a)[_0x671c('0x23')](function(_0x4e543a){return _0x4e543a;});}return null;};}function removeEntity(_0x29913b,_0x45f4b5){return function(_0x22c7fa){if(_0x22c7fa){return _0x22c7fa['destroy']()[_0x671c('0x23')](function(){_0x29913b[_0x671c('0x17')](0xcc)[_0x671c('0x18')]();});}};}function handleEntityNotFound(_0x28a517,_0x1d1e25){return function(_0x790393){if(!_0x790393){_0x28a517['sendStatus'](0x194);}return _0x790393;};}function handleError(_0x374396,_0x3e81da){_0x3e81da=_0x3e81da||0x1f4;return function(_0x33b878){logger[_0x671c('0x24')](_0x33b878['stack']);if(_0x33b878[_0x671c('0x25')]){delete _0x33b878[_0x671c('0x25')];}_0x374396['status'](_0x3e81da)[_0x671c('0x26')](_0x33b878);};}exports[_0x671c('0x27')]=function(_0x3da60e,_0x5ef4d9){var _0x2d89fb={},_0x1f09be={},_0x207fad={'count':0x0,'rows':[]};var _0x302397=_[_0x671c('0x28')](db['OpenchannelApplication'][_0x671c('0x29')],function(_0x19b1fa){return{'name':_0x19b1fa[_0x671c('0x2a')],'type':_0x19b1fa['type'][_0x671c('0x2b')]};});_0x1f09be[_0x671c('0x2c')]=_[_0x671c('0x28')](_0x302397,'name');_0x1f09be[_0x671c('0x2d')]=_['keys'](_0x3da60e[_0x671c('0x2d')]);_0x1f09be[_0x671c('0x2e')]=_['intersection'](_0x1f09be[_0x671c('0x2c')],_0x1f09be[_0x671c('0x2d')]);_0x2d89fb[_0x671c('0x2f')]=_[_0x671c('0x30')](_0x1f09be[_0x671c('0x2c')],qs[_0x671c('0x31')](_0x3da60e['query'][_0x671c('0x31')]));_0x2d89fb[_0x671c('0x2f')]=_0x2d89fb[_0x671c('0x2f')][_0x671c('0x32')]?_0x2d89fb['attributes']:_0x1f09be[_0x671c('0x2c')];if(!_0x3da60e[_0x671c('0x2d')]['hasOwnProperty'](_0x671c('0x33'))){_0x2d89fb[_0x671c('0x1c')]=qs[_0x671c('0x1c')](_0x3da60e[_0x671c('0x2d')]['limit']);_0x2d89fb[_0x671c('0x1b')]=qs[_0x671c('0x1b')](_0x3da60e['query']['offset']);}_0x2d89fb['order']=qs['sort'](_0x3da60e[_0x671c('0x2d')][_0x671c('0x34')]);_0x2d89fb[_0x671c('0x35')]=qs[_0x671c('0x2e')](_['pick'](_0x3da60e['query'],_0x1f09be['filters']),_0x302397);if(_0x3da60e['query']['filter']){_0x2d89fb['where']=_[_0x671c('0x36')](_0x2d89fb['where'],{'$or':_[_0x671c('0x28')](_0x302397,function(_0x9917ad){if(_0x9917ad[_0x671c('0x37')]!==_0x671c('0x38')){var _0x29d4e4={};_0x29d4e4[_0x9917ad[_0x671c('0x25')]]={'$like':'%'+_0x3da60e[_0x671c('0x2d')][_0x671c('0x39')]+'%'};return _0x29d4e4;}})});}_0x2d89fb=_['merge']({},_0x2d89fb,_0x3da60e[_0x671c('0x3a')]);var _0xcc4d30={'where':_0x2d89fb['where']};return db[_0x671c('0x3b')][_0x671c('0x1a')](_0xcc4d30)[_0x671c('0x23')](function(_0x482e19){_0x207fad[_0x671c('0x1a')]=_0x482e19;if(_0x3da60e[_0x671c('0x2d')][_0x671c('0x3c')]){_0x2d89fb[_0x671c('0x3d')]=[{'all':!![]}];}return db[_0x671c('0x3b')]['findAll'](_0x2d89fb);})[_0x671c('0x23')](function(_0xd2dd0a){_0x207fad[_0x671c('0x3e')]=_0xd2dd0a;return _0x207fad;})[_0x671c('0x23')](respondWithFilteredResult(_0x5ef4d9,_0x2d89fb))[_0x671c('0x3f')](handleError(_0x5ef4d9,null));};exports[_0x671c('0x40')]=function(_0x4394b3,_0xc96f7){var _0x5eab1a={'raw':!![],'where':{'id':_0x4394b3[_0x671c('0x41')]['id']}},_0x5e9bab={};_0x5e9bab['model']=_[_0x671c('0x42')](db[_0x671c('0x3b')]['rawAttributes']);_0x5e9bab['query']=_[_0x671c('0x42')](_0x4394b3['query']);_0x5e9bab[_0x671c('0x2e')]=_[_0x671c('0x30')](_0x5e9bab['model'],_0x5e9bab[_0x671c('0x2d')]);_0x5eab1a[_0x671c('0x2f')]=_[_0x671c('0x30')](_0x5e9bab[_0x671c('0x2c')],qs['fields'](_0x4394b3['query'][_0x671c('0x31')]));_0x5eab1a[_0x671c('0x2f')]=_0x5eab1a['attributes'][_0x671c('0x32')]?_0x5eab1a[_0x671c('0x2f')]:_0x5e9bab['model'];if(_0x4394b3[_0x671c('0x2d')][_0x671c('0x3c')]){_0x5eab1a[_0x671c('0x3d')]=[{'all':!![]}];}_0x5eab1a=_[_0x671c('0x36')]({},_0x5eab1a,_0x4394b3[_0x671c('0x3a')]);return db[_0x671c('0x3b')][_0x671c('0x43')](_0x5eab1a)[_0x671c('0x23')](handleEntityNotFound(_0xc96f7,null))['then'](respondWithResult(_0xc96f7,null))[_0x671c('0x3f')](handleError(_0xc96f7,null));};exports['create']=function(_0x3d7124,_0x551638){return db[_0x671c('0x3b')][_0x671c('0x44')](_0x3d7124[_0x671c('0x45')],{})[_0x671c('0x23')](respondWithResult(_0x551638,0xc9))[_0x671c('0x3f')](handleError(_0x551638,null));};exports[_0x671c('0x46')]=function(_0x411c92,_0x23c1fa){if(_0x411c92[_0x671c('0x45')]['id']){delete _0x411c92[_0x671c('0x45')]['id'];}return db[_0x671c('0x3b')][_0x671c('0x43')]({'where':{'id':_0x411c92[_0x671c('0x41')]['id']}})[_0x671c('0x23')](handleEntityNotFound(_0x23c1fa,null))[_0x671c('0x23')](saveUpdates(_0x411c92[_0x671c('0x45')],null))[_0x671c('0x23')](respondWithResult(_0x23c1fa,null))[_0x671c('0x3f')](handleError(_0x23c1fa,null));};exports['destroy']=function(_0x270795,_0x9bbc83){return db[_0x671c('0x3b')][_0x671c('0x43')]({'where':{'id':_0x270795[_0x671c('0x41')]['id']}})[_0x671c('0x23')](handleEntityNotFound(_0x9bbc83,null))[_0x671c('0x23')](removeEntity(_0x9bbc83,null))[_0x671c('0x3f')](handleError(_0x9bbc83,null));}; \ No newline at end of file +var _0xb712=['limit','count','set','apply','save','update','then','destroy','error','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','findAll','catch','includeAll','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x58300f,_0x2d17f8){var _0xbf6adf=function(_0x352d94){while(--_0x352d94){_0x58300f['push'](_0x58300f['shift']());}};_0xbf6adf(++_0x2d17f8);}(_0xb712,0x192));var _0x2b71=function(_0x3c2e7a,_0x55b3e1){_0x3c2e7a=_0x3c2e7a-0x0;var _0x172d5e=_0xb712[_0x3c2e7a];return _0x172d5e;};'use strict';var emlformat=require(_0x2b71('0x0'));var rimraf=require(_0x2b71('0x1'));var zipdir=require(_0x2b71('0x2'));var jsonpatch=require(_0x2b71('0x3'));var rp=require(_0x2b71('0x4'));var moment=require(_0x2b71('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2b71('0x6'));var util=require('util');var path=require(_0x2b71('0x7'));var sox=require(_0x2b71('0x8'));var csv=require(_0x2b71('0x9'));var ejs=require(_0x2b71('0xa'));var fs=require('fs');var fs_extra=require(_0x2b71('0xb'));var _=require(_0x2b71('0xc'));var squel=require('squel');var crypto=require(_0x2b71('0xd'));var jsforce=require(_0x2b71('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2b71('0xf'));var Papa=require(_0x2b71('0x10'));var Redis=require(_0x2b71('0x11'));var authService=require(_0x2b71('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2b71('0x13'));var hardwareService=require(_0x2b71('0x14'));var logger=require(_0x2b71('0x15'))(_0x2b71('0x16'));var utils=require(_0x2b71('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2b71('0x18'))['db'];function respondWithStatusCode(_0x23913c,_0x463034){_0x463034=_0x463034||0xcc;return function(_0xd5b857){if(_0xd5b857){return _0x23913c[_0x2b71('0x19')](_0x463034);}return _0x23913c[_0x2b71('0x1a')](_0x463034)[_0x2b71('0x1b')]();};}function respondWithResult(_0x4cd89b,_0x2e9bca){_0x2e9bca=_0x2e9bca||0xc8;return function(_0x4ec24a){if(_0x4ec24a){return _0x4cd89b['status'](_0x2e9bca)['json'](_0x4ec24a);}};}function respondWithFilteredResult(_0x1e1b70,_0x4290a6){return function(_0x4b7a4d){if(_0x4b7a4d){var _0x3f269c=typeof _0x4290a6[_0x2b71('0x1c')]===_0x2b71('0x1d')&&typeof _0x4290a6[_0x2b71('0x1e')]==='undefined';var _0x4ab858=_0x4b7a4d[_0x2b71('0x1f')];var _0x132c25=_0x3f269c?0x0:_0x4290a6['offset'];var _0x292bbc=_0x3f269c?_0x4b7a4d[_0x2b71('0x1f')]:_0x4290a6[_0x2b71('0x1c')]+_0x4290a6[_0x2b71('0x1e')];var _0x11610a;if(_0x292bbc>=_0x4ab858){_0x292bbc=_0x4ab858;_0x11610a=0xc8;}else{_0x11610a=0xce;}_0x1e1b70[_0x2b71('0x1a')](_0x11610a);return _0x1e1b70[_0x2b71('0x20')]('Content-Range',_0x132c25+'-'+_0x292bbc+'/'+_0x4ab858)['json'](_0x4b7a4d);}return null;};}function patchUpdates(_0x331d3b){return function(_0x47dd43){try{jsonpatch[_0x2b71('0x21')](_0x47dd43,_0x331d3b,!![]);}catch(_0x44f2d2){return BPromise['reject'](_0x44f2d2);}return _0x47dd43[_0x2b71('0x22')]();};}function saveUpdates(_0x419b7a,_0x2d0c5b){return function(_0x5868a9){if(_0x5868a9){return _0x5868a9[_0x2b71('0x23')](_0x419b7a)[_0x2b71('0x24')](function(_0x39956a){return _0x39956a;});}return null;};}function removeEntity(_0x3b9dde,_0x49b0b1){return function(_0x2d0cf4){if(_0x2d0cf4){return _0x2d0cf4[_0x2b71('0x25')]()[_0x2b71('0x24')](function(){_0x3b9dde[_0x2b71('0x1a')](0xcc)[_0x2b71('0x1b')]();});}};}function handleEntityNotFound(_0xef7196,_0x5b3ae1){return function(_0x462c6f){if(!_0x462c6f){_0xef7196[_0x2b71('0x19')](0x194);}return _0x462c6f;};}function handleError(_0x1bbe00,_0x45e59d){_0x45e59d=_0x45e59d||0x1f4;return function(_0x3e6592){logger[_0x2b71('0x26')](_0x3e6592[_0x2b71('0x27')]);if(_0x3e6592['name']){delete _0x3e6592[_0x2b71('0x28')];}_0x1bbe00[_0x2b71('0x1a')](_0x45e59d)[_0x2b71('0x29')](_0x3e6592);};}exports[_0x2b71('0x2a')]=function(_0x4f2e57,_0x1c515e){var _0x46522d={},_0x5ea7f1={},_0x3bab28={'count':0x0,'rows':[]};var _0x16f02a=_['map'](db[_0x2b71('0x2b')][_0x2b71('0x2c')],function(_0x30339d){return{'name':_0x30339d[_0x2b71('0x2d')],'type':_0x30339d[_0x2b71('0x2e')][_0x2b71('0x2f')]};});_0x5ea7f1['model']=_[_0x2b71('0x30')](_0x16f02a,_0x2b71('0x28'));_0x5ea7f1[_0x2b71('0x31')]=_[_0x2b71('0x32')](_0x4f2e57[_0x2b71('0x31')]);_0x5ea7f1[_0x2b71('0x33')]=_[_0x2b71('0x34')](_0x5ea7f1[_0x2b71('0x35')],_0x5ea7f1[_0x2b71('0x31')]);_0x46522d[_0x2b71('0x36')]=_[_0x2b71('0x34')](_0x5ea7f1[_0x2b71('0x35')],qs[_0x2b71('0x37')](_0x4f2e57[_0x2b71('0x31')]['fields']));_0x46522d[_0x2b71('0x36')]=_0x46522d[_0x2b71('0x36')][_0x2b71('0x38')]?_0x46522d[_0x2b71('0x36')]:_0x5ea7f1[_0x2b71('0x35')];if(!_0x4f2e57['query'][_0x2b71('0x39')]('nolimit')){_0x46522d[_0x2b71('0x1e')]=qs['limit'](_0x4f2e57[_0x2b71('0x31')][_0x2b71('0x1e')]);_0x46522d['offset']=qs[_0x2b71('0x1c')](_0x4f2e57[_0x2b71('0x31')][_0x2b71('0x1c')]);}_0x46522d[_0x2b71('0x3a')]=qs[_0x2b71('0x3b')](_0x4f2e57['query'][_0x2b71('0x3b')]);_0x46522d[_0x2b71('0x3c')]=qs['filters'](_['pick'](_0x4f2e57[_0x2b71('0x31')],_0x5ea7f1['filters']),_0x16f02a);if(_0x4f2e57[_0x2b71('0x31')][_0x2b71('0x3d')]){_0x46522d[_0x2b71('0x3c')]=_[_0x2b71('0x3e')](_0x46522d['where'],{'$or':_[_0x2b71('0x30')](_0x16f02a,function(_0x485671){if(_0x485671[_0x2b71('0x2e')]!==_0x2b71('0x3f')){var _0x20d527={};_0x20d527[_0x485671[_0x2b71('0x28')]]={'$like':'%'+_0x4f2e57[_0x2b71('0x31')]['filter']+'%'};return _0x20d527;}})});}_0x46522d=_[_0x2b71('0x3e')]({},_0x46522d,_0x4f2e57['options']);var _0x39ddab={'where':_0x46522d[_0x2b71('0x3c')]};return db[_0x2b71('0x2b')][_0x2b71('0x1f')](_0x39ddab)['then'](function(_0x1920ea){_0x3bab28['count']=_0x1920ea;if(_0x4f2e57[_0x2b71('0x31')]['includeAll']){_0x46522d['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x2b71('0x40')](_0x46522d);})[_0x2b71('0x24')](function(_0x492e76){_0x3bab28['rows']=_0x492e76;return _0x3bab28;})[_0x2b71('0x24')](respondWithFilteredResult(_0x1c515e,_0x46522d))[_0x2b71('0x41')](handleError(_0x1c515e,null));};exports['show']=function(_0x36ec11,_0x5e4f0e){var _0x148a3d={'raw':!![],'where':{'id':_0x36ec11['params']['id']}},_0x403161={};_0x403161[_0x2b71('0x35')]=_[_0x2b71('0x32')](db[_0x2b71('0x2b')][_0x2b71('0x2c')]);_0x403161[_0x2b71('0x31')]=_[_0x2b71('0x32')](_0x36ec11['query']);_0x403161[_0x2b71('0x33')]=_[_0x2b71('0x34')](_0x403161[_0x2b71('0x35')],_0x403161[_0x2b71('0x31')]);_0x148a3d[_0x2b71('0x36')]=_['intersection'](_0x403161[_0x2b71('0x35')],qs[_0x2b71('0x37')](_0x36ec11[_0x2b71('0x31')][_0x2b71('0x37')]));_0x148a3d[_0x2b71('0x36')]=_0x148a3d[_0x2b71('0x36')][_0x2b71('0x38')]?_0x148a3d[_0x2b71('0x36')]:_0x403161['model'];if(_0x36ec11['query'][_0x2b71('0x42')]){_0x148a3d[_0x2b71('0x43')]=[{'all':!![]}];}_0x148a3d=_[_0x2b71('0x3e')]({},_0x148a3d,_0x36ec11['options']);return db['OpenchannelApplication'][_0x2b71('0x44')](_0x148a3d)[_0x2b71('0x24')](handleEntityNotFound(_0x5e4f0e,null))['then'](respondWithResult(_0x5e4f0e,null))[_0x2b71('0x41')](handleError(_0x5e4f0e,null));};exports['create']=function(_0x1222ac,_0x53ae4b){return db['OpenchannelApplication'][_0x2b71('0x45')](_0x1222ac[_0x2b71('0x46')],{})[_0x2b71('0x24')](respondWithResult(_0x53ae4b,0xc9))[_0x2b71('0x41')](handleError(_0x53ae4b,null));};exports[_0x2b71('0x23')]=function(_0x55c63b,_0x308e9a){if(_0x55c63b[_0x2b71('0x46')]['id']){delete _0x55c63b['body']['id'];}return db['OpenchannelApplication'][_0x2b71('0x44')]({'where':{'id':_0x55c63b[_0x2b71('0x47')]['id']}})[_0x2b71('0x24')](handleEntityNotFound(_0x308e9a,null))[_0x2b71('0x24')](saveUpdates(_0x55c63b[_0x2b71('0x46')],null))[_0x2b71('0x24')](respondWithResult(_0x308e9a,null))[_0x2b71('0x41')](handleError(_0x308e9a,null));};exports[_0x2b71('0x25')]=function(_0x1ee26e,_0xbb1305){return db[_0x2b71('0x2b')]['find']({'where':{'id':_0x1ee26e['params']['id']}})[_0x2b71('0x24')](handleEntityNotFound(_0xbb1305,null))[_0x2b71('0x24')](removeEntity(_0xbb1305,null))['catch'](handleError(_0xbb1305,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index f958484..ee32067 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 _0x6fb2=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x7d3263,_0x402cf6){var _0x91a7cf=function(_0x1289da){while(--_0x1289da){_0x7d3263['push'](_0x7d3263['shift']());}};_0x91a7cf(++_0x402cf6);}(_0x6fb2,0x104));var _0x26fb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6fb2[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x26fb('0x0'));var util=require(_0x26fb('0x1'));var logger=require(_0x26fb('0x2'))(_0x26fb('0x3'));var moment=require(_0x26fb('0x4'));var BPromise=require(_0x26fb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x26fb('0x6'));var rimraf=require(_0x26fb('0x7'));var config=require('../../config/environment');var attributes=require(_0x26fb('0x8'));module[_0x26fb('0x9')]=function(_0x381660,_0x8409d3){return _0x381660['define'](_0x26fb('0xa'),attributes,{'tableName':_0x26fb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x26fb('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x96d7=['util','../../config/logger','moment','request-promise','../../config/environment','./openchannelApplication.attributes','exports','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5ae2fa,_0x506886){var _0x3cdb50=function(_0x228ec8){while(--_0x228ec8){_0x5ae2fa['push'](_0x5ae2fa['shift']());}};_0x3cdb50(++_0x506886);}(_0x96d7,0x168));var _0x796d=function(_0x260037,_0x384a78){_0x260037=_0x260037-0x0;var _0x149b53=_0x96d7[_0x260037];return _0x149b53;};'use strict';var _=require('lodash');var util=require(_0x796d('0x0'));var logger=require(_0x796d('0x1'))('api');var moment=require(_0x796d('0x2'));var BPromise=require('bluebird');var rp=require(_0x796d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x796d('0x4'));var attributes=require(_0x796d('0x5'));module[_0x796d('0x6')]=function(_0x2fd997,_0x2e95d3){return _0x2fd997['define']('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x796d('0x7'),'collate':_0x796d('0x8')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 7510ab8..ae16bc5 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 _0x4572=['where','attributes','limit','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0x4572,0x1a8));var _0x2457=function(_0x18fb16,_0x45edbc){_0x18fb16=_0x18fb16-0x0;var _0x147b0d=_0x4572[_0x18fb16];return _0x147b0d;};'use strict';var _=require(_0x2457('0x0'));var util=require(_0x2457('0x1'));var moment=require(_0x2457('0x2'));var BPromise=require(_0x2457('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2457('0x4'));var db=require(_0x2457('0x5'))['db'];var utils=require(_0x2457('0x6'));var logger=require('../../config/logger')(_0x2457('0x7'));var config=require(_0x2457('0x8'));var jayson=require(_0x2457('0x9'));var client=jayson[_0x2457('0xa')][_0x2457('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x156980,_0x4c4752,_0x497394){return new BPromise(function(_0x2f123c,_0x4989ff){return client['request'](_0x156980,_0x497394)['then'](function(_0x5afcf8){logger['info'](_0x2457('0xc'),_0x4c4752,_0x2457('0xd'));logger[_0x2457('0xe')](_0x2457('0xf'),_0x4c4752,_0x2457('0xd'),JSON[_0x2457('0x10')](_0x5afcf8));if(_0x5afcf8['error']){if(_0x5afcf8[_0x2457('0x11')]['code']===0x1f4){logger[_0x2457('0x11')](_0x2457('0xc'),_0x4c4752,_0x5afcf8['error'][_0x2457('0x12')]);return _0x4989ff(_0x5afcf8[_0x2457('0x11')]['message']);}logger[_0x2457('0x11')](_0x2457('0xc'),_0x4c4752,_0x5afcf8[_0x2457('0x11')]['message']);return _0x2f123c(_0x5afcf8[_0x2457('0x11')][_0x2457('0x12')]);}else{logger[_0x2457('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x4c4752,_0x2457('0xd'));_0x2f123c(_0x5afcf8['result']['message']);}})[_0x2457('0x14')](function(_0x2b7750){logger[_0x2457('0x11')](_0x2457('0xc'),_0x4c4752,_0x2b7750);_0x4989ff(_0x2b7750);});});}exports[_0x2457('0x15')]=function(_0x3969fd){var _0x380993=this;return new Promise(function(_0x38f538,_0x5e5fe8){return db[_0x2457('0x16')][_0x2457('0x17')](_0x3969fd['body'],{'raw':_0x3969fd[_0x2457('0x18')]?_0x3969fd[_0x2457('0x18')][_0x2457('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3969fd['options']?_0x3969fd[_0x2457('0x18')][_0x2457('0x1a')]||null:null,'attributes':_0x3969fd[_0x2457('0x18')]?_0x3969fd[_0x2457('0x18')][_0x2457('0x1b')]||null:null,'limit':_0x3969fd[_0x2457('0x18')]?_0x3969fd[_0x2457('0x18')][_0x2457('0x1c')]||null:null})[_0x2457('0x1d')](function(_0x11f3de){logger[_0x2457('0x13')](_0x2457('0x15'),_0x3969fd);logger[_0x2457('0xe')](_0x2457('0x15'),_0x3969fd,JSON[_0x2457('0x10')](_0x11f3de));_0x38f538(_0x11f3de);})[_0x2457('0x14')](function(_0x42c557){logger[_0x2457('0x11')](_0x2457('0x15'),_0x42c557[_0x2457('0x12')],_0x3969fd);_0x5e5fe8(_0x380993[_0x2457('0x11')](0x1f4,_0x42c557[_0x2457('0x12')]));});});}; \ No newline at end of file +var _0x17b5=['OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','OpenchannelApplication','update','options','raw','where','attributes','limit','UpdateOpenchannelApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0x17b5,0x1ce));var _0x517b=function(_0x57ee8c,_0xe42849){_0x57ee8c=_0x57ee8c-0x0;var _0x3a2322=_0x17b5[_0x57ee8c];return _0x3a2322;};'use strict';var _=require(_0x517b('0x0'));var util=require(_0x517b('0x1'));var moment=require(_0x517b('0x2'));var BPromise=require(_0x517b('0x3'));var rs=require(_0x517b('0x4'));var fs=require('fs');var Redis=require(_0x517b('0x5'));var db=require(_0x517b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x517b('0x7'))(_0x517b('0x8'));var config=require(_0x517b('0x9'));var jayson=require(_0x517b('0xa'));var client=jayson[_0x517b('0xb')][_0x517b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f1764,_0x351ddb,_0xa88431){return new BPromise(function(_0x2cd533,_0x397de8){return client[_0x517b('0xd')](_0x3f1764,_0xa88431)[_0x517b('0xe')](function(_0x5dd613){logger[_0x517b('0xf')](_0x517b('0x10'),_0x351ddb,'request\x20sent');logger[_0x517b('0x11')](_0x517b('0x12'),_0x351ddb,'request\x20sent',JSON['stringify'](_0x5dd613));if(_0x5dd613[_0x517b('0x13')]){if(_0x5dd613[_0x517b('0x13')]['code']===0x1f4){logger[_0x517b('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x351ddb,_0x5dd613[_0x517b('0x13')]['message']);return _0x397de8(_0x5dd613['error'][_0x517b('0x14')]);}logger[_0x517b('0x13')](_0x517b('0x10'),_0x351ddb,_0x5dd613[_0x517b('0x13')][_0x517b('0x14')]);return _0x2cd533(_0x5dd613[_0x517b('0x13')][_0x517b('0x14')]);}else{logger['info'](_0x517b('0x10'),_0x351ddb,_0x517b('0x15'));_0x2cd533(_0x5dd613[_0x517b('0x16')][_0x517b('0x14')]);}})[_0x517b('0x17')](function(_0xf98169){logger[_0x517b('0x13')](_0x517b('0x10'),_0x351ddb,_0xf98169);_0x397de8(_0xf98169);});});}exports['UpdateOpenchannelApplication']=function(_0xcda351){var _0x283a61=this;return new Promise(function(_0x227416,_0x586d2f){return db[_0x517b('0x18')][_0x517b('0x19')](_0xcda351['body'],{'raw':_0xcda351[_0x517b('0x1a')]?_0xcda351[_0x517b('0x1a')][_0x517b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcda351['options']?_0xcda351[_0x517b('0x1a')][_0x517b('0x1c')]||null:null,'attributes':_0xcda351[_0x517b('0x1a')]?_0xcda351['options'][_0x517b('0x1d')]||null:null,'limit':_0xcda351[_0x517b('0x1a')]?_0xcda351['options'][_0x517b('0x1e')]||null:null})['then'](function(_0x1bbcc2){logger['info'](_0x517b('0x1f'),_0xcda351);logger[_0x517b('0x11')](_0x517b('0x1f'),_0xcda351,JSON['stringify'](_0x1bbcc2));_0x227416(_0x1bbcc2);})[_0x517b('0x17')](function(_0x4eb01b){logger['error']('UpdateOpenchannelApplication',_0x4eb01b[_0x517b('0x14')],_0xcda351);_0x586d2f(_0x283a61[_0x517b('0x13')](0x1f4,_0x4eb01b[_0x517b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 012a61a..6103f22 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 _0x351f=['openchannel','openchannelinteraction:addtags','addTags','put','update','delete','openchannelinteraction:destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x351f,0xda));var _0xf351=function(_0x3f8827,_0x2485c5){_0x3f8827=_0x3f8827-0x0;var _0x54a0c6=_0x351f[_0x3f8827];return _0x54a0c6;};'use strict';var multer=require(_0xf351('0x0'));var util=require(_0xf351('0x1'));var path=require(_0xf351('0x2'));var timeout=require('connect-timeout');var express=require(_0xf351('0x3'));var router=express[_0xf351('0x4')]();var fs_extra=require(_0xf351('0x5'));var auth=require(_0xf351('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf351('0x7'));var controller=require(_0xf351('0x8'));router['get']('/',auth[_0xf351('0x9')](),controller['index']);router[_0xf351('0xa')](_0xf351('0xb'),auth[_0xf351('0x9')](),controller[_0xf351('0xc')]);router[_0xf351('0xa')](_0xf351('0xd'),auth[_0xf351('0x9')](),controller[_0xf351('0xe')]);router[_0xf351('0xa')](_0xf351('0xf'),auth[_0xf351('0x9')](),controller[_0xf351('0x10')]);router[_0xf351('0xa')]('/:id/download',auth[_0xf351('0x9')](),controller[_0xf351('0x11')]);router[_0xf351('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf351('0x12')](_0xf351('0xf'),auth[_0xf351('0x9')](),controller[_0xf351('0x13')]);router[_0xf351('0x12')](_0xf351('0x14'),auth[_0xf351('0x9')](),interaction[_0xf351('0x15')](_0xf351('0x16'),_0xf351('0x17')),controller[_0xf351('0x18')]);router[_0xf351('0x19')](_0xf351('0xd'),auth[_0xf351('0x9')](),interaction[_0xf351('0x15')](_0xf351('0x16'),'openchannelinteraction:update'),controller[_0xf351('0x1a')]);router[_0xf351('0x1b')](_0xf351('0xd'),auth[_0xf351('0x9')](),interaction[_0xf351('0x15')](_0xf351('0x16'),_0xf351('0x1c')),controller['destroy']);router[_0xf351('0x1b')](_0xf351('0x14'),auth['isAuthenticated'](),controller['removeTags']);module[_0xf351('0x1d')]=router; \ No newline at end of file +var _0x0423=['post','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download'];(function(_0x53d248,_0x371a7e){var _0x3817a2=function(_0x6c7d76){while(--_0x6c7d76){_0x53d248['push'](_0x53d248['shift']());}};_0x3817a2(++_0x371a7e);}(_0x0423,0xc8));var _0x3042=function(_0x15b25d,_0x1e3559){_0x15b25d=_0x15b25d-0x0;var _0x3ea03f=_0x0423[_0x15b25d];return _0x3ea03f;};'use strict';var multer=require(_0x3042('0x0'));var util=require('util');var path=require(_0x3042('0x1'));var timeout=require(_0x3042('0x2'));var express=require(_0x3042('0x3'));var router=express[_0x3042('0x4')]();var fs_extra=require(_0x3042('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3042('0x6'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3042('0x7')]);router[_0x3042('0x8')](_0x3042('0x9'),auth[_0x3042('0xa')](),controller[_0x3042('0xb')]);router[_0x3042('0x8')](_0x3042('0xc'),auth['isAuthenticated'](),controller[_0x3042('0xd')]);router[_0x3042('0x8')](_0x3042('0xe'),auth[_0x3042('0xa')](),controller['getMessages']);router[_0x3042('0x8')](_0x3042('0xf'),auth['isAuthenticated'](),controller[_0x3042('0x10')]);router[_0x3042('0x11')]('/',auth[_0x3042('0xa')](),controller['create']);router[_0x3042('0x11')](_0x3042('0xe'),auth['isAuthenticated'](),controller[_0x3042('0x12')]);router['post']('/:id/tags',auth[_0x3042('0xa')](),interaction[_0x3042('0x13')](_0x3042('0x14'),_0x3042('0x15')),controller[_0x3042('0x16')]);router[_0x3042('0x17')](_0x3042('0xc'),auth[_0x3042('0xa')](),interaction[_0x3042('0x13')](_0x3042('0x14'),_0x3042('0x18')),controller[_0x3042('0x19')]);router[_0x3042('0x1a')](_0x3042('0xc'),auth[_0x3042('0xa')](),interaction[_0x3042('0x13')]('openchannel',_0x3042('0x1b')),controller[_0x3042('0x1c')]);router[_0x3042('0x1a')](_0x3042('0x1d'),auth['isAuthenticated'](),controller[_0x3042('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 957e96a..96c0833 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 _0x80d9=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x20d4e7,_0x5f29f7){var _0x125131=function(_0x10dc57){while(--_0x10dc57){_0x20d4e7['push'](_0x20d4e7['shift']());}};_0x125131(++_0x5f29f7);}(_0x80d9,0xb6));var _0x980d=function(_0x4bd9af,_0x41fd25){_0x4bd9af=_0x4bd9af-0x0;var _0x4cd1ad=_0x80d9[_0x4bd9af];return _0x4cd1ad;};'use strict';var Sequelize=require(_0x980d('0x0'));module[_0x980d('0x1')]={'closed':{'type':Sequelize[_0x980d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x980d('0x3')]},'disposition':{'type':Sequelize[_0x980d('0x4')]},'secondDisposition':{'type':Sequelize[_0x980d('0x4')]},'thirdDisposition':{'type':Sequelize[_0x980d('0x4')]},'note':{'type':Sequelize[_0x980d('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x980d('0x4')]},'externalUrl':{'type':Sequelize[_0x980d('0x4')]},'lastMsgAt':{'type':Sequelize[_0x980d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x980d('0x5')]('in',_0x980d('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x980d('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2060=['ENUM','out','sequelize','BOOLEAN','DATE','STRING'];(function(_0x38d760,_0x71d351){var _0x63b1d=function(_0x115743){while(--_0x115743){_0x38d760['push'](_0x38d760['shift']());}};_0x63b1d(++_0x71d351);}(_0x2060,0x1be));var _0x0206=function(_0x3227d4,_0x23004f){_0x3227d4=_0x3227d4-0x0;var _0xb99a07=_0x2060[_0x3227d4];return _0xb99a07;};'use strict';var Sequelize=require(_0x0206('0x0'));module['exports']={'closed':{'type':Sequelize[_0x0206('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0206('0x2')]},'disposition':{'type':Sequelize[_0x0206('0x3')]},'secondDisposition':{'type':Sequelize[_0x0206('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0206('0x3')]},'read1stAt':{'type':Sequelize[_0x0206('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x0206('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0206('0x4')]('in',_0x0206('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x0206('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index ad2151b..a4bb4eb 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 _0x1100=['where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','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','QueryTypes','clone','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','contactName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','rows','catch','show','params','includeAll','include','create','describe','addMessage','omit','getMessages','findOne','OpenchannelMessage','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','ids','spread','emit','removeTags','download','join','root','server','files','attachments','transcript-%d-%s.zip','CmContact','firstName','Attachment','createdAt','direction','secret','Account','Owner','mkdirSync','Openchannel','N.A.','closed','closedAt','threadId','createReadStream','pipe','createWriteStream','basename','System','lastName','out','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','name','send','Users','map','fullname','TagIds','forEach','Tags','push','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','pick','select','field','color','from','u.id','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null'];(function(_0x566bdf,_0x1f4861){var _0x331215=function(_0x524d0d){while(--_0x524d0d){_0x566bdf['push'](_0x566bdf['shift']());}};_0x331215(++_0x1f4861);}(_0x1100,0x6c));var _0x0110=function(_0x3e8a21,_0xdd25ad){_0x3e8a21=_0x3e8a21-0x0;var _0x36341a=_0x1100[_0x3e8a21];return _0x36341a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0110('0x0'));var zipdir=require(_0x0110('0x1'));var jsonpatch=require(_0x0110('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0110('0x3'));var Mustache=require(_0x0110('0x4'));var util=require(_0x0110('0x5'));var path=require(_0x0110('0x6'));var sox=require(_0x0110('0x7'));var csv=require('to-csv');var ejs=require(_0x0110('0x8'));var fs=require('fs');var fs_extra=require(_0x0110('0x9'));var _=require(_0x0110('0xa'));var squel=require(_0x0110('0xb'));var crypto=require(_0x0110('0xc'));var jsforce=require(_0x0110('0xd'));var deskjs=require(_0x0110('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0110('0xf'));var Redis=require(_0x0110('0x10'));var authService=require(_0x0110('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0110('0x12'));var pdf=require(_0x0110('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0110('0x14'))(_0x0110('0x15'));var utils=require(_0x0110('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0110('0x17'));var db=require('../../mysqldb')['db'];config[_0x0110('0x18')]=_[_0x0110('0x19')](config[_0x0110('0x18')],{'host':_0x0110('0x1a'),'port':0x18eb});var socket=require(_0x0110('0x1b'))(new Redis(config[_0x0110('0x18')]));require(_0x0110('0x1c'))[_0x0110('0x1d')](socket);function respondWithStatusCode(_0xed7d0c,_0x3951fe){_0x3951fe=_0x3951fe||0xcc;return function(_0x5cae34){if(_0x5cae34){return _0xed7d0c[_0x0110('0x1e')](_0x3951fe);}return _0xed7d0c['status'](_0x3951fe)['end']();};}function respondWithResult(_0x46bf54,_0x39b706){_0x39b706=_0x39b706||0xc8;return function(_0x44e0cd){if(_0x44e0cd){return _0x46bf54[_0x0110('0x1f')](_0x39b706)[_0x0110('0x20')](_0x44e0cd);}};}function respondWithFilteredResult(_0x2e2fbe,_0x47aa36){return function(_0x1d1209){if(_0x1d1209){var _0x2c00fd=typeof _0x47aa36[_0x0110('0x21')]===_0x0110('0x22')&&typeof _0x47aa36[_0x0110('0x23')]===_0x0110('0x22');var _0xeedee2=_0x1d1209[_0x0110('0x24')];var _0xb255d6=_0x2c00fd?0x0:_0x47aa36[_0x0110('0x21')];var _0x34be68=_0x2c00fd?_0x1d1209['count']:_0x47aa36[_0x0110('0x21')]+_0x47aa36[_0x0110('0x23')];var _0x5f161f;if(_0x34be68>=_0xeedee2){_0x34be68=_0xeedee2;_0x5f161f=0xc8;}else{_0x5f161f=0xce;}_0x2e2fbe[_0x0110('0x1f')](_0x5f161f);return _0x2e2fbe[_0x0110('0x25')](_0x0110('0x26'),_0xb255d6+'-'+_0x34be68+'/'+_0xeedee2)[_0x0110('0x20')](_0x1d1209);}return null;};}function patchUpdates(_0x3882da){return function(_0x2cdfdd){try{jsonpatch[_0x0110('0x27')](_0x2cdfdd,_0x3882da,!![]);}catch(_0x42bcd7){return BPromise['reject'](_0x42bcd7);}return _0x2cdfdd[_0x0110('0x28')]();};}function saveUpdates(_0x220eb8,_0x535ee1){return function(_0x12a4ea){if(_0x12a4ea){return _0x12a4ea[_0x0110('0x29')](_0x220eb8)[_0x0110('0x2a')](function(_0x29dd65){return _0x29dd65;});}return null;};}function removeEntity(_0x4f8e31,_0x3ce79f){return function(_0x18ea76){if(_0x18ea76){return _0x18ea76[_0x0110('0x2b')]()['then'](function(){_0x4f8e31[_0x0110('0x1f')](0xcc)[_0x0110('0x2c')]();});}};}function handleEntityNotFound(_0x2494d0,_0x1b5fb7){return function(_0x2123b3){if(!_0x2123b3){_0x2494d0['sendStatus'](0x194);}return _0x2123b3;};}function handleError(_0x54dbd3,_0x40114c){_0x40114c=_0x40114c||0x1f4;return function(_0x5d2818){logger['error'](_0x5d2818['stack']);if(_0x5d2818[_0x0110('0x2d')]){delete _0x5d2818['name'];}_0x54dbd3[_0x0110('0x1f')](_0x40114c)[_0x0110('0x2e')](_0x5d2818);};}function getInteractionUsers(_0x5b37be,_0x4ceaa9){return new BPromise(function(_0x217f45,_0x3e0b39){try{if(_0x4ceaa9[_0x5b37be['id']]){_0x5b37be[_0x0110('0x2f')]=_[_0x0110('0x30')](_0x4ceaa9[_0x5b37be['id']],function(_0x2a7600){return{'id':_0x2a7600['id'],'fullname':_0x2a7600[_0x0110('0x31')]};});}}catch(_0x35a9d6){_0x3e0b39(_0x35a9d6);}_0x217f45(_0x5b37be);});}function getInteractionTags(_0x5b5fcd,_0x54edf4){return new BPromise(function(_0x17b947,_0x2f3137){try{if(_0x5b5fcd['TagIds']){_0x5b5fcd['Tags']=[];_0x5b5fcd[_0x0110('0x32')]['split'](',')[_0x0110('0x33')](function(_0x4fdcec){_0x5b5fcd[_0x0110('0x34')][_0x0110('0x35')](_0x54edf4[_0x4fdcec]);});}delete _0x5b5fcd[_0x0110('0x32')];}catch(_0x4fb99d){_0x2f3137(_0x4fb99d);}_0x17b947(_0x5b5fcd);});}function updateOpenchannelInteraction(_0x1a1625,_0x5d0abe,_0x5311e5){return new BPromise(function(_0x3ebc5f,_0x4ee4be){return getInteractionUsers(_0x1a1625,_0x5311e5)[_0x0110('0x2a')](function(_0x94e371){return getInteractionTags(_0x94e371,_0x5d0abe);})[_0x0110('0x2a')](function(_0x34889f){_0x3ebc5f(_0x34889f);})['catch'](function(_0x235b79){_0x4ee4be(_0x235b79);});});}exports[_0x0110('0x36')]=function(_0x2f4790,_0x53e51e){var _0x36ab7e={},_0x4a958d={},_0xe0818={'count':0x0,'rows':[]};var _0x4e4875=_[_0x0110('0x30')](db[_0x0110('0x37')][_0x0110('0x38')],function(_0x183cf4){return{'name':_0x183cf4[_0x0110('0x39')],'type':_0x183cf4[_0x0110('0x3a')][_0x0110('0x3b')]};});_0x4a958d['model']=_['map'](_0x4e4875,_0x0110('0x2d'));_0x4a958d[_0x0110('0x3c')]=_[_0x0110('0x3d')](_0x2f4790[_0x0110('0x3c')]);_0x4a958d[_0x0110('0x3e')]=_[_0x0110('0x3f')](_0x4a958d[_0x0110('0x40')],_0x4a958d['query']);_0x36ab7e[_0x0110('0x41')]=_[_0x0110('0x3f')](_0x4a958d['model'],qs['fields'](_0x2f4790[_0x0110('0x3c')]['fields']));_0x36ab7e[_0x0110('0x41')]=_0x36ab7e[_0x0110('0x41')][_0x0110('0x42')]?_0x36ab7e[_0x0110('0x41')]:_0x4a958d[_0x0110('0x40')];if(!_0x2f4790[_0x0110('0x3c')][_0x0110('0x43')]('nolimit')){_0x36ab7e[_0x0110('0x23')]=qs[_0x0110('0x23')](_0x2f4790[_0x0110('0x3c')]['limit']);_0x36ab7e[_0x0110('0x21')]=qs[_0x0110('0x21')](_0x2f4790[_0x0110('0x3c')][_0x0110('0x21')]);}_0x36ab7e[_0x0110('0x44')]=qs[_0x0110('0x45')](_0x2f4790[_0x0110('0x3c')]['sort']);_0x36ab7e['where']=qs[_0x0110('0x3e')](_[_0x0110('0x46')](_0x2f4790[_0x0110('0x3c')],_0x4a958d['filters']),_0x4e4875);var _0x24b638=[];var _0x94402c=squel[_0x0110('0x47')]()[_0x0110('0x48')]('id')['field']('name')['field'](_0x0110('0x49'))[_0x0110('0x4a')]('tools_tags');var _0x1ec076=squel[_0x0110('0x47')]()[_0x0110('0x48')](_0x0110('0x4b'))[_0x0110('0x48')](_0x0110('0x4c'))['field']('ui.OpenchannelInteractionId')[_0x0110('0x4a')](_0x0110('0x4d'),'ui')[_0x0110('0x4e')](_0x0110('0x4f'),'u',_0x0110('0x50'));var _0x52566a=squel[_0x0110('0x47')]()[_0x0110('0x4a')]('openchannel_interactions','i')[_0x0110('0x4e')]('cm_contacts','c',_0x0110('0x51'))['left_join'](_0x0110('0x4f'),'o',_0x0110('0x52'))[_0x0110('0x4e')](_0x0110('0x53'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0x0110('0x4e')](_0x0110('0x54'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x0110('0x4e')](_0x0110('0x55'),'it',_0x0110('0x56'))[_0x0110('0x4e')](_0x0110('0x57'),'t','t.id\x20=\x20it.TagId');var _0xebcba1=squel[_0x0110('0x58')]();var _0x3c1b4f=[];var _0x2d7c56=squel[_0x0110('0x58')]();var _0x4f078d;if(_0x2f4790['query'][_0x0110('0x59')]){_0x4f078d=as[_0x0110('0x5a')](_0x2f4790[_0x0110('0x3c')][_0x0110('0x59')]);var _0x16945b=_0x4f078d[_0x0110('0x5b')];for(var _0x3a4796=0x0;_0x3a4796<_0x4f078d[_0x0110('0x5c')][_0x0110('0x42')];_0x3a4796++){var _0x285c05=_0x4f078d[_0x0110('0x5c')][_0x3a4796];var _0x3aca43='i';var _0xc50846=_[_0x0110('0x5d')](_0x4e4875,['name',_0x285c05[_0x0110('0x48')]]);if(!_0xc50846){switch(_0x285c05[_0x0110('0x48')]){case _0x0110('0x5e'):if(_0x285c05[_0x0110('0x5f')]==0x1){_0x52566a[_0x0110('0x60')]('`'+_0x285c05[_0x0110('0x48')]+_0x0110('0x61'));}else{_0x52566a[_0x0110('0x60')]('`'+_0x285c05[_0x0110('0x48')]+'`\x20>\x200');}break;case _0x0110('0x62'):if(_0x285c05[_0x0110('0x63')]===_0x0110('0x64')){if(_0x285c05['value'][_0x0110('0x65')]('\x20')[_0x0110('0x42')]>0x1){_0xebcba1[_0x16945b](_0x0110('0x66'),qs[_0x0110('0x67')](_0x285c05[_0x0110('0x5f')]),null);}else{var _0x5574ed='%'+_0x285c05[_0x0110('0x5f')]+'%';_0xebcba1[_0x16945b](_0x0110('0x68'),_0x5574ed,_0x5574ed,_0x5574ed);}}else{_0xc50846=_[_0x0110('0x5d')](_0x4e4875,['name','ContactId']);_0x285c05[_0x0110('0x48')]=_0x0110('0x69');_0x247d08=as[_0x0110('0x6a')](_0x3aca43,_0xc50846[_0x0110('0x3a')],_0x285c05);_0xebcba1[_0x16945b](_0x247d08[_0x0110('0x6b')],_0x247d08[_0x0110('0x5f')][_0x0110('0x6c')],_0x247d08['value'][_0x0110('0x2c')]);}break;case _0x0110('0x6d'):var _0x4c7a78=_0x285c05[_0x0110('0x5f')][_0x0110('0x65')](',')['map'](function(_0xc297c1){return Number(_0xc297c1);});_0x4c7a78[_0x0110('0x33')](function(_0x4afaf0){_0x2d7c56['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4afaf0+',%');});_0x3c1b4f=_[_0x0110('0x6e')](_0x3c1b4f,_0x4c7a78);break;case _0x0110('0x6f'):if(_0x285c05[_0x0110('0x63')]===_0x0110('0x64')){_0xebcba1[_0x16945b](_0x0110('0x70'),'%'+_0x285c05[_0x0110('0x5f')]+'%',null);}else{_0xc50846=_[_0x0110('0x5d')](_0x4e4875,[_0x0110('0x2d'),_0x0110('0x71')]);_0x285c05[_0x0110('0x48')]=_0x0110('0x71');_0x247d08=as['buildExpression'](_0x3aca43,_0xc50846[_0x0110('0x3a')],_0x285c05);_0xebcba1[_0x16945b](_0x247d08[_0x0110('0x6b')],_0x247d08[_0x0110('0x5f')][_0x0110('0x6c')],_0x247d08[_0x0110('0x5f')][_0x0110('0x2c')]);}break;case _0x0110('0x72'):_0x247d08=as[_0x0110('0x6a')]('me',null,_0x285c05);_0xebcba1[_0x16945b](_0x247d08['text'],_0x247d08[_0x0110('0x5f')][_0x0110('0x6c')],_0x247d08[_0x0110('0x5f')][_0x0110('0x2c')]);break;}}else{var _0x247d08=as['buildExpression'](_0x3aca43,_0xc50846[_0x0110('0x3a')],_0x285c05);_0xebcba1[_0x16945b](_0x247d08['text'],_0x247d08[_0x0110('0x5f')][_0x0110('0x6c')],_0x247d08[_0x0110('0x5f')][_0x0110('0x2c')]);}}}else{var _0x48af0e=_(_0x2f4790[_0x0110('0x3c')])[_0x0110('0x3d')]()[_0x0110('0x30')](function(_0x51f04c){return _['some'](_0x4e4875,['name',_0x51f04c])?_0x51f04c:undefined;})[_0x0110('0x73')]()[_0x0110('0x5f')]();if(!_[_0x0110('0x74')](_0x48af0e)){_0x48af0e[_0x0110('0x33')](function(_0x2622ee){if(_0x2622ee===_0x0110('0x75')){_0x52566a['where'](_0x0110('0x76'),[][_0x0110('0x77')](_0x2f4790[_0x0110('0x3c')][_0x2622ee]));}else if(_0x2622ee==='createdAt'){var _0x2df837=JSON[_0x0110('0x78')](_0x2f4790['query'][_0x2622ee])[_0x0110('0x79')];var _0x5ca9f2=JSON['parse'](_0x2f4790[_0x0110('0x3c')][_0x2622ee])[_0x0110('0x7a')];_0x52566a['where'](_0x0110('0x7b'),_0x2df837,_0x5ca9f2);}else{if(_0x2f4790[_0x0110('0x3c')][_0x2622ee]===_0x0110('0x7c')){_0x52566a[_0x0110('0x7d')]('i.'+_0x2622ee+_0x0110('0x7e'));}else{_0x52566a[_0x0110('0x7d')]('i.'+_0x2622ee+_0x0110('0x7f'),_0x2f4790[_0x0110('0x3c')][_0x2622ee]);}}});}if(_0x2f4790[_0x0110('0x3c')][_0x0110('0x80')]){if(_0x2f4790['query'][_0x0110('0x80')]==0x1){_0x52566a[_0x0110('0x60')](_0x0110('0x81'));}else{_0x52566a[_0x0110('0x60')](_0x0110('0x82'));}}if(_0x2f4790[_0x0110('0x3c')][_0x0110('0x83')]){_0x3c1b4f=_[_0x0110('0x84')](_0x2f4790[_0x0110('0x3c')][_0x0110('0x83')])?_0x2f4790[_0x0110('0x3c')][_0x0110('0x83')]:new Array(_0x2f4790['query']['tag']);_0x3c1b4f[_0x0110('0x33')](function(_0x8dc87d){_0x2d7c56['or'](_0x0110('0x85'),'%,'+_0x8dc87d+',%');});}if(_0x2f4790[_0x0110('0x3c')]['filter']){var _0x4c14cd=_0x2f4790[_0x0110('0x3c')][_0x0110('0x86')][_0x0110('0x87')]('\x5c','\x5c\x5c')[_0x0110('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4c14cd)){_0xebcba1['or'](_0x0110('0x88'),_0x4c14cd+'%');}else{_0xebcba1['or'](_0x0110('0x89'),qs[_0x0110('0x67')](_0x4c14cd))['or']('i.from\x20LIKE\x20?',_0x4c14cd+'%')['or'](_0x0110('0x8a'),_0x4c14cd+'%');}}}_0x52566a['where'](_0xebcba1);_0x52566a[_0x0110('0x8b')](_0x0110('0x8c'));var _0x34f914={'type':db['Sequelize'][_0x0110('0x8d')]['SELECT'],'raw':!![]};var _0xe101bb=_0x52566a[_0x0110('0x8e')]();_0xe101bb['field'](_0x0110('0x8c'));_0xe101bb[_0x0110('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0110('0x5e'));if(_0x36ab7e[_0x0110('0x44')]){_0x36ab7e[_0x0110('0x44')][_0x0110('0x33')](function(_0x5e440a){var _0x12d7f7=_0x5e440a[0x0]==='contactName'?_0x5e440a[0x0]:'i.'+_0x5e440a[0x0];_0x52566a[_0x0110('0x44')](_0x12d7f7,_0x5e440a[0x1]===_0x0110('0x8f')?![]:!![]);});}if(!_[_0x0110('0x74')](_0x3c1b4f)){_0x52566a[_0x0110('0x60')](_0x2d7c56);_0xe101bb[_0x0110('0x7d')](_0x0110('0x90'),_0x3c1b4f);}BPromise[_0x0110('0x91')]()[_0x0110('0x2a')](function(){if(!_0x4f078d){if(_0x2f4790['query'][_0x0110('0x75')])return;_0xe101bb[_0x0110('0x7d')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x52566a[_0x0110('0x7d')](_0x0110('0x92'));return;}if(_0x2f4790[_0x0110('0x93')][_0x0110('0x94')]!==_0x0110('0x95'))return;return _0x2f4790['user'][_0x0110('0x96')]({'attributes':['id'],'raw':!![]})[_0x0110('0x2a')](function(_0x2fb750){if(_[_0x0110('0x74')](_0x2fb750)){_0xe101bb[_0x0110('0x7d')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x52566a[_0x0110('0x7d')](_0x0110('0x97'));}else{_0xe101bb[_0x0110('0x7d')](_0x0110('0x76'),_[_0x0110('0x30')](_0x2fb750,'id'));_0x52566a[_0x0110('0x7d')](_0x0110('0x76'),_[_0x0110('0x30')](_0x2fb750,'id'));}});})[_0x0110('0x2a')](function(){if(_0x2f4790[_0x0110('0x93')]['role']===_0x0110('0x95')&&!_0x4f078d&&!_0x2f4790[_0x0110('0x3c')][_0x0110('0x75')])return[];return db[_0x0110('0x98')][_0x0110('0x3c')](_0xe101bb[_0x0110('0x99')](),_0x34f914);})[_0x0110('0x2a')](function(_0xe8d634){_0xe0818[_0x0110('0x24')]=_0xe8d634[_0x0110('0x42')];if(_0xe0818[_0x0110('0x24')]===0x0)return[];return db[_0x0110('0x98')]['query'](_0x94402c[_0x0110('0x99')](),_0x34f914)['then'](function(_0x2be7ef){_0x24b638=_['keyBy'](_0x2be7ef,'id');_0x34f914=_[_0x0110('0x9a')](_0x34f914,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f4790[_0x0110('0x3c')][_0x0110('0x9b')]){_0x36ab7e['attributes'][_0x0110('0x33')](function(_0x2416e7){_0x52566a['field']('i.'+_0x2416e7);});}else{_0x52566a[_0x0110('0x48')](_0x0110('0x9c'),_0x0110('0x5e'));_0x52566a[_0x0110('0x48')]('a.key',_0x0110('0x9d'));_0x52566a[_0x0110('0x48')](_0x0110('0x9e'),'Account.mandatoryDisposition');_0x52566a[_0x0110('0x48')]('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',_0x0110('0x9f'));_0x52566a[_0x0110('0x48')]('i.*');_0x52566a[_0x0110('0x48')]('c.firstName',_0x0110('0xa0'));_0x52566a[_0x0110('0x48')](_0x0110('0xa1'),_0x0110('0xa2'));_0x52566a[_0x0110('0x48')](_0x0110('0xa3'),_0x0110('0xa4'));_0x52566a[_0x0110('0x48')](_0x0110('0xa5'),_0x0110('0xa6'));_0x52566a['field'](_0x0110('0xa7'),_0x0110('0xa8'));_0x52566a[_0x0110('0x48')]('c.fax',_0x0110('0xa9'));_0x52566a['field'](_0x0110('0xaa'),_0x0110('0xab'));_0x52566a[_0x0110('0x48')]('o.internal',_0x0110('0xac'));_0x52566a[_0x0110('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0110('0x32'));}if(_0x36ab7e[_0x0110('0x23')])_0x52566a['limit'](_0x36ab7e['limit']);if(_0x36ab7e[_0x0110('0x21')])_0x52566a[_0x0110('0x21')](_0x36ab7e[_0x0110('0x21')]);return db[_0x0110('0x98')][_0x0110('0x3c')](_0x52566a['toString'](),_0x34f914);})[_0x0110('0x2a')](function(_0x1ef157){if(_0x1ef157[_0x0110('0x42')]>0x0)_0x1ec076[_0x0110('0x7d')](_0x0110('0xad'),_[_0x0110('0x30')](_0x1ef157,'id'));return db[_0x0110('0x98')][_0x0110('0x3c')](_0x1ec076['toString'](),_0x34f914)[_0x0110('0x2a')](function(_0x11e9c2){var _0x28b8e1=_[_0x0110('0xae')](_0x11e9c2,_0x0110('0xaf'));var _0x26f064=[];_0x1ef157[_0x0110('0x33')](function(_0x5990eb){_0x26f064[_0x0110('0x35')](updateOpenchannelInteraction(_0x5990eb,_0x24b638,_0x28b8e1));});return BPromise['all'](_0x26f064);});});})[_0x0110('0x2a')](function(_0x347b7f){_0xe0818[_0x0110('0xb0')]=_0x347b7f;return _0xe0818;})[_0x0110('0x2a')](respondWithFilteredResult(_0x53e51e,_0x36ab7e))[_0x0110('0xb1')](handleError(_0x53e51e,null));};exports[_0x0110('0xb2')]=function(_0x59e1c4,_0x39e067){var _0x20cb76={};if(_0x59e1c4[_0x0110('0x3c')][_0x0110('0x3a')]&&_0x59e1c4['query']['type']==='from'){_0x20cb76[_0x0110('0x4a')]=_0x59e1c4[_0x0110('0xb3')]['id'];}else{_0x20cb76['id']=_0x59e1c4[_0x0110('0xb3')]['id'];}var _0x8074f2={'raw':![],'where':_0x20cb76},_0x29f742={};_0x29f742['model']=_[_0x0110('0x3d')](db['OpenchannelInteraction'][_0x0110('0x38')]);_0x29f742['query']=_['keys'](_0x59e1c4[_0x0110('0x3c')]);_0x29f742[_0x0110('0x3e')]=_[_0x0110('0x3f')](_0x29f742[_0x0110('0x40')],_0x29f742[_0x0110('0x3c')]);_0x8074f2[_0x0110('0x41')]=_[_0x0110('0x3f')](_0x29f742['model'],qs[_0x0110('0x9b')](_0x59e1c4['query'][_0x0110('0x9b')]));_0x8074f2[_0x0110('0x41')]=_0x8074f2[_0x0110('0x41')][_0x0110('0x42')]?_0x8074f2[_0x0110('0x41')]:_0x29f742[_0x0110('0x40')];if(_0x59e1c4['query'][_0x0110('0xb4')]){_0x8074f2[_0x0110('0xb5')]=[{'all':!![]}];}_0x8074f2=_[_0x0110('0x9a')]({},_0x8074f2,_0x59e1c4['options']);return db[_0x0110('0x37')][_0x0110('0x5d')](_0x8074f2)['then'](handleEntityNotFound(_0x39e067,null))['then'](respondWithResult(_0x39e067,null))[_0x0110('0xb1')](handleError(_0x39e067,null));};exports[_0x0110('0xb6')]=function(_0x3c63da,_0x1e38f7){return db[_0x0110('0x37')][_0x0110('0xb6')](_0x3c63da[_0x0110('0x72')],{})[_0x0110('0x2a')](respondWithResult(_0x1e38f7,0xc9))['catch'](handleError(_0x1e38f7,null));};exports[_0x0110('0x29')]=function(_0x39e9e3,_0x2ce72e){if(_0x39e9e3[_0x0110('0x72')]['id']){delete _0x39e9e3[_0x0110('0x72')]['id'];}return db[_0x0110('0x37')]['find']({'where':{'id':_0x39e9e3['params']['id']}})['then'](handleEntityNotFound(_0x2ce72e,null))['then'](saveUpdates(_0x39e9e3[_0x0110('0x72')],null))[_0x0110('0x2a')](respondWithResult(_0x2ce72e,null))[_0x0110('0xb1')](handleError(_0x2ce72e,null));};exports[_0x0110('0x2b')]=function(_0x223466,_0x34e741){return db[_0x0110('0x37')]['find']({'where':{'id':_0x223466[_0x0110('0xb3')]['id']}})[_0x0110('0x2a')](handleEntityNotFound(_0x34e741,null))['then'](removeEntity(_0x34e741,null))[_0x0110('0xb1')](handleError(_0x34e741,null));};exports[_0x0110('0xb7')]=function(_0x3c3008,_0x1ae9a6){return db[_0x0110('0x37')][_0x0110('0xb7')]()[_0x0110('0x2a')](respondWithResult(_0x1ae9a6,null))[_0x0110('0xb1')](handleError(_0x1ae9a6,null));};exports[_0x0110('0xb8')]=function(_0x1bad97,_0xc44dc8,_0x489d03){return db['OpenchannelMessage'][_0x0110('0x5d')]({'where':{'id':_0x1bad97[_0x0110('0xb3')]['id']}})[_0x0110('0x2a')](handleEntityNotFound(_0xc44dc8,null))[_0x0110('0x2a')](function(_0x475bd8){if(_0x475bd8){return _0x475bd8[_0x0110('0xb8')](_0x1bad97[_0x0110('0x72')]['ids'],_[_0x0110('0xb9')](_0x1bad97['body'],['ids','id'])||{});}})['then'](respondWithResult(_0xc44dc8,null))['catch'](handleError(_0xc44dc8,null));};exports[_0x0110('0xba')]=function(_0x37ddc7,_0x171c81,_0x3838f2){var _0x56e3b2={'raw':![],'where':{}};var _0x195576={};var _0x3e85e5={'count':0x0,'rows':[]};return db[_0x0110('0x37')][_0x0110('0xbb')]({'where':{'id':_0x37ddc7['params']['id']}})['then'](handleEntityNotFound(_0x171c81,null))[_0x0110('0x2a')](function(_0x162527){if(_0x162527){_0x195576[_0x0110('0x40')]=_[_0x0110('0x3d')](db[_0x0110('0xbc')][_0x0110('0x38')]);_0x195576[_0x0110('0x3c')]=_['keys'](_0x37ddc7['query']);_0x195576[_0x0110('0x3e')]=_['intersection'](_0x195576[_0x0110('0x40')],_0x195576[_0x0110('0x3c')]);_0x56e3b2[_0x0110('0x41')]=_['intersection'](_0x195576[_0x0110('0x40')],qs[_0x0110('0x9b')](_0x37ddc7['query'][_0x0110('0x9b')]));_0x56e3b2[_0x0110('0x41')]=_0x56e3b2['attributes'][_0x0110('0x42')]?_0x56e3b2[_0x0110('0x41')]:_0x195576['model'];if(!_0x37ddc7[_0x0110('0x3c')][_0x0110('0x43')](_0x0110('0xbd'))){_0x56e3b2['limit']=qs[_0x0110('0x23')](_0x37ddc7[_0x0110('0x3c')][_0x0110('0x23')]);_0x56e3b2[_0x0110('0x21')]=qs[_0x0110('0x21')](_0x37ddc7[_0x0110('0x3c')][_0x0110('0x21')]);}_0x56e3b2['order']=qs['sort'](_0x37ddc7[_0x0110('0x3c')][_0x0110('0x45')]);_0x56e3b2['where']=qs[_0x0110('0x3e')](_[_0x0110('0x46')](_0x37ddc7['query'],_0x195576[_0x0110('0x3e')]));_0x56e3b2[_0x0110('0x7d')][_0x0110('0xaf')]=_0x162527['id'];if(_0x37ddc7[_0x0110('0x3c')][_0x0110('0x86')]){_0x56e3b2['where']=_[_0x0110('0x9a')](_0x56e3b2[_0x0110('0x7d')],{'$or':_[_0x0110('0x30')](_0x56e3b2[_0x0110('0x41')],function(_0x1f43cc){var _0x226a82={};_0x226a82[_0x1f43cc]={'$like':'%'+_0x37ddc7[_0x0110('0x3c')]['filter']+'%'};return _0x226a82;})});}if(_0x37ddc7[_0x0110('0x3c')][_0x0110('0x79')]){var _0x4c1bc3=_0x37ddc7['query'][_0x0110('0x79')][_0x0110('0x65')](',');var _0x232a99={};_0x232a99[_0x4c1bc3[0x0]]={'$gte':moment(_0x4c1bc3[0x1])[_0x0110('0xbe')](_0x0110('0xbf'))};_0x56e3b2[_0x0110('0x7d')]=_[_0x0110('0x9a')](_0x56e3b2[_0x0110('0x7d')],_0x232a99);}_0x56e3b2=_[_0x0110('0x9a')]({},_0x56e3b2,_0x37ddc7[_0x0110('0xc0')]);return db[_0x0110('0xbc')][_0x0110('0x24')]({'where':_0x56e3b2[_0x0110('0x7d')]})[_0x0110('0x2a')](function(_0x5a2a87){_0x3e85e5[_0x0110('0x24')]=_0x5a2a87;if(_0x37ddc7[_0x0110('0x3c')]['includeAll']){_0x56e3b2[_0x0110('0xb5')]=[{'all':!![]}];}return db[_0x0110('0xbc')][_0x0110('0xc1')](_0x56e3b2);})[_0x0110('0x2a')](function(_0x245903){_0x3e85e5[_0x0110('0xb0')]=_0x245903;return _0x3e85e5;});}})[_0x0110('0x2a')](respondWithFilteredResult(_0x171c81,_0x56e3b2))['catch'](handleError(_0x171c81,null));};exports['addTags']=function(_0x4ed30f,_0x5c666e,_0x14976a){return db[_0x0110('0x37')][_0x0110('0x5d')]({'where':{'id':_0x4ed30f[_0x0110('0xb3')]['id']}})[_0x0110('0x2a')](handleEntityNotFound(_0x5c666e,null))[_0x0110('0x2a')](function(_0x57b0bd){if(_0x57b0bd){return _0x57b0bd['setTags'](_0x4ed30f[_0x0110('0x72')][_0x0110('0xc2')],_[_0x0110('0xb9')](_0x4ed30f[_0x0110('0x72')],['ids','id'])||{})[_0x0110('0xc3')](function(){return db[_0x0110('0x6d')][_0x0110('0xc1')]({'attributes':['id','name',_0x0110('0x49')],'where':{'id':_0x4ed30f[_0x0110('0x72')]['ids']}});})[_0x0110('0x2a')](function(_0x4e1f8c){socket[_0x0110('0xc4')]('openchannelInteractionTags:save',{'id':Number(_0x4ed30f[_0x0110('0xb3')]['id']),'tags':_0x4e1f8c||[]});return{'id':Number(_0x4ed30f['params']['id']),'tags':_0x4e1f8c||[]};});}})[_0x0110('0x2a')](respondWithResult(_0x5c666e,null))[_0x0110('0xb1')](handleError(_0x5c666e,null));};exports[_0x0110('0xc5')]=function(_0x31ebb6,_0x329548,_0x3113a9){return db[_0x0110('0x37')]['find']({'where':{'id':_0x31ebb6[_0x0110('0xb3')]['id']}})[_0x0110('0x2a')](handleEntityNotFound(_0x329548,null))[_0x0110('0x2a')](function(_0x5281d4){if(_0x5281d4){return _0x5281d4['removeTags'](_0x31ebb6[_0x0110('0x3c')][_0x0110('0xc2')]);}})[_0x0110('0x2a')](respondWithStatusCode(_0x329548,null))[_0x0110('0xb1')](handleError(_0x329548,null));};exports[_0x0110('0xc6')]=function(_0x311f7e,_0x4d9acf){var _0x5be6f3=moment()['unix']()[_0x0110('0x99')]();var _0xb2b106=path[_0x0110('0xc7')](config[_0x0110('0xc8')],_0x0110('0xc9'),_0x0110('0xca'),'tmp');var _0x13706d=path[_0x0110('0xc7')](config[_0x0110('0xc8')],'server','files',_0x0110('0xcb'));var _0x11f567=path[_0x0110('0xc7')](_0xb2b106,_0x5be6f3);var _0x122055=util['format'](_0x0110('0xcc'),_0x311f7e[_0x0110('0xb3')]['id'],_0x5be6f3);var _0x3375de=path[_0x0110('0xc7')](_0xb2b106,_0x122055);var _0x421a3f=[];_0x421a3f['push']({'model':db[_0x0110('0x6f')],'as':_0x0110('0x6f'),'attributes':['id',_0x0110('0x31')],'raw':!![]});_0x421a3f[_0x0110('0x35')]({'model':db[_0x0110('0xcd')],'as':_0x0110('0x62'),'attributes':['id',_0x0110('0xce'),'lastName'],'raw':!![]});if(_0x311f7e[_0x0110('0x3c')][_0x0110('0xcb')]){_0x421a3f['push']({'model':db[_0x0110('0xcf')],'as':_0x0110('0xcf'),'raw':!![]});}var _0x30b641=[{'model':db[_0x0110('0xbc')],'as':'Messages','attributes':['id','body',_0x0110('0xd0'),_0x0110('0xd1'),_0x0110('0xd2'),_0x0110('0x80')],'include':_0x421a3f}];_0x30b641[_0x0110('0x35')]({'model':db['OpenchannelAccount'],'as':_0x0110('0xd3'),'attributes':['id','name']});_0x30b641[_0x0110('0x35')]({'model':db[_0x0110('0x6f')],'as':_0x0110('0xd4'),'attributes':['id','fullname']});return db[_0x0110('0x37')]['find']({'where':{'id':_0x311f7e['params']['id']},'include':_0x30b641})[_0x0110('0x2a')](handleEntityNotFound(_0x4d9acf,null))['then'](function(_0x15fdc0){if(_0x15fdc0){var _0x3cc4f6=_0x15fdc0['get']({'plain':!![]});fs[_0x0110('0xd5')](_0x11f567);var _0x103b66={'channel':_0x0110('0xd6'),'account':_0x3cc4f6[_0x0110('0xd3')][_0x0110('0x2d')],'agent':_0x3cc4f6[_0x0110('0xd4')]?_0x3cc4f6['Owner'][_0x0110('0x31')]:_0x0110('0xd7'),'createdAt':moment(_0x3cc4f6[_0x0110('0xd0')])['format'](_0x0110('0xbf'))[_0x0110('0x99')](),'closedAt':_0x3cc4f6[_0x0110('0xd8')]?moment(_0x3cc4f6[_0x0110('0xd9')])[_0x0110('0xbe')](_0x0110('0xbf'))['toString']():'','disposition':_0x3cc4f6['disposition'],'visibility':_0x3cc4f6[_0x0110('0xda')]?'Public':'Private','messages':_(_0x3cc4f6['Messages'])['filter']({'secret':![]})[_0x0110('0x30')](function(_0x56a2ac){if(_0x56a2ac[_0x0110('0xcf')]){var _0x779c21=path[_0x0110('0xc7')](_0x13706d,_0x56a2ac[_0x0110('0xcf')]['basename']);if(fs['existsSync'](_0x779c21)){fs[_0x0110('0xdb')](_0x779c21)[_0x0110('0xdc')](fs[_0x0110('0xdd')](path['join'](_0x11f567,_0x56a2ac[_0x0110('0xcf')][_0x0110('0xde')])));}}return{'date':moment(_0x56a2ac[_0x0110('0xd0')])[_0x0110('0xbe')](_0x0110('0xbf'))[_0x0110('0x99')](),'sender':_0x56a2ac[_0x0110('0xd1')]==='out'?_0x56a2ac[_0x0110('0x6f')]?_0x56a2ac[_0x0110('0x6f')][_0x0110('0x31')]:_0x0110('0xdf'):_0x56a2ac[_0x0110('0x62')][_0x0110('0xce')]+(_0x56a2ac[_0x0110('0x62')][_0x0110('0xe0')]?'\x20'+_0x56a2ac['Contact'][_0x0110('0xe0')]:''),'body':_0x56a2ac[_0x0110('0xcf')]?_0x56a2ac['Attachment'][_0x0110('0xde')]:_0x56a2ac[_0x0110('0x72')],'direction':_0x56a2ac['direction']===_0x0110('0xe1')?'A':'C','secret':_0x56a2ac[_0x0110('0xd2')],'read':_0x56a2ac[_0x0110('0x80')],'attachment':_0x56a2ac[_0x0110('0xcf')]};})[_0x0110('0x5f')]()};return ejs[_0x0110('0xe2')](path[_0x0110('0xc7')](config[_0x0110('0xc8')],_0x0110('0xc9'),_0x0110('0xe3'),_0x0110('0xe4')),{'interaction':_0x103b66})[_0x0110('0x2a')](function(_0x4031e4){var _0x45e881=path[_0x0110('0xc7')](_0x11f567,'transcript-'+_0x3cc4f6['id']+'-'+_0x5be6f3+_0x0110('0xe5'));var _0x1f9c7f={'path':_0x45e881,'channel':_0x0110('0xd6'),'interactionId':_0x3cc4f6['id']};return pdf[_0x0110('0xe6')](_0x4031e4,_0x1f9c7f);})[_0x0110('0x2a')](function(){return new BPromise(function(_0x1d7b4d,_0x5a4676){zipdir(_0x11f567,{'saveTo':_0x3375de},function(_0x25cc46,_0x999723){if(_0x25cc46)return _0x5a4676(_0x25cc46);return _0x1d7b4d(_0x999723);});})[_0x0110('0x2a')](function(){return new BPromise(function(_0x25fd09,_0x5a07a6){rimraf(_0x11f567,function(_0x559a5f){if(_0x559a5f)_0x5a07a6(_0x559a5f);return _0x25fd09();});});})[_0x0110('0x2a')](function(){return _0x4d9acf[_0x0110('0xc6')](_0x3375de,_0x122055,function(_0x4a79db){if(_0x4a79db){console[_0x0110('0xe7')](_0x0110('0xe8'),_0x4a79db);}else{fs['unlinkSync'](_0x3375de);}});});});}else{return _0x4d9acf[_0x0110('0x1e')](0xc8);}})[_0x0110('0xb1')](handleError(_0x4d9acf,null));}; \ No newline at end of file +var _0x2462=['t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','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)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','start','Tag','union','type','text','body','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','getOpenchannelAccounts','user','agent','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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.*','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','catch','from','params','include','options','create','destroy','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','hasOwnProperty','sort','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','omit','spread','emit','removeTags','download','unix','join','root','files','tmp','attachments','transcript-%d-%s.zip','User','CmContact','firstName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','closed','disposition','threadId','Public','Private','createReadStream','pipe','createWriteStream','lastName','basename','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','end','status','json','offset','limit','undefined','count','set','apply','save','update','then','sendStatus','error','stack','name','send','Users','map','fullname','Tags','split','forEach','push','TagIds','index','OpenchannelInteraction','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','color','select','u.id','field','u.fullname','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags'];(function(_0x1cc109,_0x22038c){var _0x2519d5=function(_0x45fe3f){while(--_0x45fe3f){_0x1cc109['push'](_0x1cc109['shift']());}};_0x2519d5(++_0x22038c);}(_0x2462,0x179));var _0x2246=function(_0x290fc3,_0x2721e5){_0x290fc3=_0x290fc3-0x0;var _0x4f8563=_0x2462[_0x290fc3];return _0x4f8563;};'use strict';var emlformat=require(_0x2246('0x0'));var rimraf=require(_0x2246('0x1'));var zipdir=require(_0x2246('0x2'));var jsonpatch=require(_0x2246('0x3'));var rp=require(_0x2246('0x4'));var moment=require(_0x2246('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2246('0x6'));var util=require(_0x2246('0x7'));var path=require(_0x2246('0x8'));var sox=require(_0x2246('0x9'));var csv=require(_0x2246('0xa'));var ejs=require(_0x2246('0xb'));var fs=require('fs');var fs_extra=require(_0x2246('0xc'));var _=require(_0x2246('0xd'));var squel=require(_0x2246('0xe'));var crypto=require(_0x2246('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2246('0x10'));var toCsv=require(_0x2246('0xa'));var querystring=require('querystring');var Papa=require(_0x2246('0x11'));var Redis=require(_0x2246('0x12'));var authService=require(_0x2246('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x2246('0x14'));var hardwareService=require(_0x2246('0x15'));var logger=require(_0x2246('0x16'))(_0x2246('0x17'));var utils=require('../../config/utils');var config=require(_0x2246('0x18'));var licenseUtil=require(_0x2246('0x19'));var db=require(_0x2246('0x1a'))['db'];config[_0x2246('0x1b')]=_[_0x2246('0x1c')](config['redis'],{'host':_0x2246('0x1d'),'port':0x18eb});var socket=require(_0x2246('0x1e'))(new Redis(config[_0x2246('0x1b')]));require('./openchannelInteraction.socket')[_0x2246('0x1f')](socket);function respondWithStatusCode(_0x50ab19,_0x375e2e){_0x375e2e=_0x375e2e||0xcc;return function(_0x29669b){if(_0x29669b){return _0x50ab19['sendStatus'](_0x375e2e);}return _0x50ab19['status'](_0x375e2e)[_0x2246('0x20')]();};}function respondWithResult(_0x44afe3,_0xdc22e1){_0xdc22e1=_0xdc22e1||0xc8;return function(_0x564f01){if(_0x564f01){return _0x44afe3[_0x2246('0x21')](_0xdc22e1)[_0x2246('0x22')](_0x564f01);}};}function respondWithFilteredResult(_0x4e625f,_0x380997){return function(_0x3f7adf){if(_0x3f7adf){var _0x334866=typeof _0x380997[_0x2246('0x23')]==='undefined'&&typeof _0x380997[_0x2246('0x24')]===_0x2246('0x25');var _0x13ed94=_0x3f7adf[_0x2246('0x26')];var _0x49bd41=_0x334866?0x0:_0x380997[_0x2246('0x23')];var _0x4c704e=_0x334866?_0x3f7adf[_0x2246('0x26')]:_0x380997[_0x2246('0x23')]+_0x380997[_0x2246('0x24')];var _0x537ede;if(_0x4c704e>=_0x13ed94){_0x4c704e=_0x13ed94;_0x537ede=0xc8;}else{_0x537ede=0xce;}_0x4e625f[_0x2246('0x21')](_0x537ede);return _0x4e625f[_0x2246('0x27')]('Content-Range',_0x49bd41+'-'+_0x4c704e+'/'+_0x13ed94)[_0x2246('0x22')](_0x3f7adf);}return null;};}function patchUpdates(_0x425261){return function(_0x25eab9){try{jsonpatch[_0x2246('0x28')](_0x25eab9,_0x425261,!![]);}catch(_0x3b96db){return BPromise['reject'](_0x3b96db);}return _0x25eab9[_0x2246('0x29')]();};}function saveUpdates(_0x4165f8,_0x3a348d){return function(_0x5fee48){if(_0x5fee48){return _0x5fee48[_0x2246('0x2a')](_0x4165f8)[_0x2246('0x2b')](function(_0x2b5311){return _0x2b5311;});}return null;};}function removeEntity(_0x25b17f,_0x5f0df0){return function(_0x121659){if(_0x121659){return _0x121659['destroy']()[_0x2246('0x2b')](function(){_0x25b17f[_0x2246('0x21')](0xcc)[_0x2246('0x20')]();});}};}function handleEntityNotFound(_0x2c27b7,_0x2368f1){return function(_0xc5150c){if(!_0xc5150c){_0x2c27b7[_0x2246('0x2c')](0x194);}return _0xc5150c;};}function handleError(_0x58a98b,_0x4883ce){_0x4883ce=_0x4883ce||0x1f4;return function(_0x406006){logger[_0x2246('0x2d')](_0x406006[_0x2246('0x2e')]);if(_0x406006[_0x2246('0x2f')]){delete _0x406006[_0x2246('0x2f')];}_0x58a98b['status'](_0x4883ce)[_0x2246('0x30')](_0x406006);};}function getInteractionUsers(_0x57cc18,_0x123416){return new BPromise(function(_0x215171,_0x52bf0e){try{if(_0x123416[_0x57cc18['id']]){_0x57cc18[_0x2246('0x31')]=_[_0x2246('0x32')](_0x123416[_0x57cc18['id']],function(_0x33362e){return{'id':_0x33362e['id'],'fullname':_0x33362e[_0x2246('0x33')]};});}}catch(_0x110b1a){_0x52bf0e(_0x110b1a);}_0x215171(_0x57cc18);});}function getInteractionTags(_0x5d2d2b,_0x185911){return new BPromise(function(_0x117ce5,_0x3d52bc){try{if(_0x5d2d2b['TagIds']){_0x5d2d2b[_0x2246('0x34')]=[];_0x5d2d2b['TagIds'][_0x2246('0x35')](',')[_0x2246('0x36')](function(_0x159e61){_0x5d2d2b['Tags'][_0x2246('0x37')](_0x185911[_0x159e61]);});}delete _0x5d2d2b[_0x2246('0x38')];}catch(_0x3bf283){_0x3d52bc(_0x3bf283);}_0x117ce5(_0x5d2d2b);});}function updateOpenchannelInteraction(_0x2b7b65,_0x22f71a,_0x1f0c85){return new BPromise(function(_0x59fe11,_0x4527e3){return getInteractionUsers(_0x2b7b65,_0x1f0c85)['then'](function(_0x355286){return getInteractionTags(_0x355286,_0x22f71a);})['then'](function(_0x3936fb){_0x59fe11(_0x3936fb);})['catch'](function(_0xd02b57){_0x4527e3(_0xd02b57);});});}exports[_0x2246('0x39')]=function(_0x1bd6b0,_0x53491a){var _0x8617f9={},_0xb16457={},_0x236b98={'count':0x0,'rows':[]};var _0x5d061b=_[_0x2246('0x32')](db[_0x2246('0x3a')][_0x2246('0x3b')],function(_0x3ae576){return{'name':_0x3ae576[_0x2246('0x3c')],'type':_0x3ae576['type']['key']};});_0xb16457[_0x2246('0x3d')]=_[_0x2246('0x32')](_0x5d061b,_0x2246('0x2f'));_0xb16457[_0x2246('0x3e')]=_[_0x2246('0x3f')](_0x1bd6b0[_0x2246('0x3e')]);_0xb16457[_0x2246('0x40')]=_[_0x2246('0x41')](_0xb16457[_0x2246('0x3d')],_0xb16457[_0x2246('0x3e')]);_0x8617f9[_0x2246('0x42')]=_['intersection'](_0xb16457[_0x2246('0x3d')],qs[_0x2246('0x43')](_0x1bd6b0[_0x2246('0x3e')][_0x2246('0x43')]));_0x8617f9[_0x2246('0x42')]=_0x8617f9[_0x2246('0x42')][_0x2246('0x44')]?_0x8617f9[_0x2246('0x42')]:_0xb16457[_0x2246('0x3d')];if(!_0x1bd6b0[_0x2246('0x3e')]['hasOwnProperty'](_0x2246('0x45'))){_0x8617f9['limit']=qs[_0x2246('0x24')](_0x1bd6b0[_0x2246('0x3e')][_0x2246('0x24')]);_0x8617f9[_0x2246('0x23')]=qs['offset'](_0x1bd6b0['query'][_0x2246('0x23')]);}_0x8617f9[_0x2246('0x46')]=qs['sort'](_0x1bd6b0[_0x2246('0x3e')]['sort']);_0x8617f9[_0x2246('0x47')]=qs['filters'](_[_0x2246('0x48')](_0x1bd6b0[_0x2246('0x3e')],_0xb16457[_0x2246('0x40')]),_0x5d061b);var _0x3b39d9=[];var _0x4cc324=squel['select']()['field']('id')['field'](_0x2246('0x2f'))['field'](_0x2246('0x49'))['from']('tools_tags');var _0x23af54=squel[_0x2246('0x4a')]()['field'](_0x2246('0x4b'))[_0x2246('0x4c')](_0x2246('0x4d'))[_0x2246('0x4c')]('ui.OpenchannelInteractionId')['from']('user_has_openchannel_interactions','ui')[_0x2246('0x4e')]('users','u',_0x2246('0x4f'));var _0x3e9c03=squel[_0x2246('0x4a')]()['from']('openchannel_interactions','i')[_0x2246('0x4e')](_0x2246('0x50'),'c',_0x2246('0x51'))['left_join']('users','o','o.id\x20=\x20i.UserId')['left_join'](_0x2246('0x52'),'a',_0x2246('0x53'))['left_join'](_0x2246('0x54'),'me',_0x2246('0x55'))[_0x2246('0x4e')](_0x2246('0x56'),'it',_0x2246('0x57'))[_0x2246('0x4e')](_0x2246('0x58'),'t',_0x2246('0x59'));var _0x45cfc3=squel[_0x2246('0x5a')]();var _0x4aa262=[];var _0x9bf0dd=squel[_0x2246('0x5a')]();var _0x98e989;if(_0x1bd6b0['query'][_0x2246('0x5b')]){_0x98e989=as[_0x2246('0x5c')](_0x1bd6b0['query']['search']);var _0x2a3725=_0x98e989[_0x2246('0x5d')];for(var _0x14aecb=0x0;_0x14aecb<_0x98e989[_0x2246('0x5e')][_0x2246('0x44')];_0x14aecb++){var _0x5ee183=_0x98e989[_0x2246('0x5e')][_0x14aecb];var _0x24b8ac='i';var _0x4c3af2=_[_0x2246('0x5f')](_0x5d061b,[_0x2246('0x2f'),_0x5ee183[_0x2246('0x4c')]]);if(!_0x4c3af2){switch(_0x5ee183[_0x2246('0x4c')]){case _0x2246('0x60'):if(_0x5ee183[_0x2246('0x61')]==0x1){_0x3e9c03[_0x2246('0x62')]('`'+_0x5ee183['field']+_0x2246('0x63'));}else{_0x3e9c03[_0x2246('0x62')]('`'+_0x5ee183[_0x2246('0x4c')]+_0x2246('0x64'));}break;case _0x2246('0x65'):if(_0x5ee183[_0x2246('0x66')]===_0x2246('0x67')){if(_0x5ee183[_0x2246('0x61')][_0x2246('0x35')]('\x20')[_0x2246('0x44')]>0x1){_0x45cfc3[_0x2a3725](_0x2246('0x68'),qs['getFullTextValue'](_0x5ee183[_0x2246('0x61')]),null);}else{var _0x506011='%'+_0x5ee183['value']+'%';_0x45cfc3[_0x2a3725](_0x2246('0x69'),_0x506011,_0x506011,_0x506011);}}else{_0x4c3af2=_['find'](_0x5d061b,[_0x2246('0x2f'),'ContactId']);_0x5ee183['field']='ContactId';_0x5f40a4=as[_0x2246('0x6a')](_0x24b8ac,_0x4c3af2['type'],_0x5ee183);_0x45cfc3[_0x2a3725](_0x5f40a4['text'],_0x5f40a4[_0x2246('0x61')][_0x2246('0x6b')],_0x5f40a4[_0x2246('0x61')][_0x2246('0x20')]);}break;case _0x2246('0x6c'):var _0x4d639e=_0x5ee183[_0x2246('0x61')][_0x2246('0x35')](',')[_0x2246('0x32')](function(_0x420777){return Number(_0x420777);});_0x4d639e[_0x2246('0x36')](function(_0x4ca57c){_0x9bf0dd['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4ca57c+',%');});_0x4aa262=_[_0x2246('0x6d')](_0x4aa262,_0x4d639e);break;case'User':if(_0x5ee183[_0x2246('0x66')]==='$substring'){_0x45cfc3[_0x2a3725]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ee183[_0x2246('0x61')]+'%',null);}else{_0x4c3af2=_[_0x2246('0x5f')](_0x5d061b,['name','UserId']);_0x5ee183[_0x2246('0x4c')]='UserId';_0x5f40a4=as[_0x2246('0x6a')](_0x24b8ac,_0x4c3af2[_0x2246('0x6e')],_0x5ee183);_0x45cfc3[_0x2a3725](_0x5f40a4[_0x2246('0x6f')],_0x5f40a4[_0x2246('0x61')][_0x2246('0x6b')],_0x5f40a4[_0x2246('0x61')][_0x2246('0x20')]);}break;case _0x2246('0x70'):_0x5f40a4=as['buildExpression']('me',null,_0x5ee183);_0x45cfc3[_0x2a3725](_0x5f40a4['text'],_0x5f40a4[_0x2246('0x61')][_0x2246('0x6b')],_0x5f40a4[_0x2246('0x61')]['end']);break;}}else{var _0x5f40a4=as[_0x2246('0x6a')](_0x24b8ac,_0x4c3af2['type'],_0x5ee183);_0x45cfc3[_0x2a3725](_0x5f40a4[_0x2246('0x6f')],_0x5f40a4[_0x2246('0x61')]['start'],_0x5f40a4[_0x2246('0x61')][_0x2246('0x20')]);}}}else{var _0x2e253d=_(_0x1bd6b0[_0x2246('0x3e')])[_0x2246('0x3f')]()[_0x2246('0x32')](function(_0x239dc5){return _['some'](_0x5d061b,[_0x2246('0x2f'),_0x239dc5])?_0x239dc5:undefined;})[_0x2246('0x71')]()[_0x2246('0x61')]();if(!_[_0x2246('0x72')](_0x2e253d)){_0x2e253d['forEach'](function(_0x56930d){if(_0x56930d===_0x2246('0x73')){_0x3e9c03[_0x2246('0x47')](_0x2246('0x74'),[][_0x2246('0x75')](_0x1bd6b0[_0x2246('0x3e')][_0x56930d]));}else if(_0x56930d===_0x2246('0x76')){var _0x5de49f=JSON[_0x2246('0x77')](_0x1bd6b0[_0x2246('0x3e')][_0x56930d])[_0x2246('0x78')];var _0x219031=JSON[_0x2246('0x77')](_0x1bd6b0[_0x2246('0x3e')][_0x56930d])[_0x2246('0x79')];_0x3e9c03[_0x2246('0x47')](_0x2246('0x7a'),_0x5de49f,_0x219031);}else{if(_0x1bd6b0[_0x2246('0x3e')][_0x56930d]==='null'){_0x3e9c03[_0x2246('0x47')]('i.'+_0x56930d+_0x2246('0x7b'));}else{_0x3e9c03['where']('i.'+_0x56930d+'\x20=\x20?',_0x1bd6b0[_0x2246('0x3e')][_0x56930d]);}}});}if(_0x1bd6b0['query'][_0x2246('0x7c')]){if(_0x1bd6b0[_0x2246('0x3e')][_0x2246('0x7c')]==0x1){_0x3e9c03['having'](_0x2246('0x7d'));}else{_0x3e9c03[_0x2246('0x62')](_0x2246('0x7e'));}}if(_0x1bd6b0[_0x2246('0x3e')][_0x2246('0x7f')]){_0x4aa262=_[_0x2246('0x80')](_0x1bd6b0['query'][_0x2246('0x7f')])?_0x1bd6b0[_0x2246('0x3e')]['tag']:new Array(_0x1bd6b0[_0x2246('0x3e')][_0x2246('0x7f')]);_0x4aa262[_0x2246('0x36')](function(_0x3c70db){_0x9bf0dd['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3c70db+',%');});}if(_0x1bd6b0[_0x2246('0x3e')][_0x2246('0x81')]){var _0x3ecb7e=_0x1bd6b0['query'][_0x2246('0x81')][_0x2246('0x82')]('\x5c','\x5c\x5c')[_0x2246('0x82')](/'/g,'\x27\x27');if(qs[_0x2246('0x83')](_0x3ecb7e)){_0x45cfc3['or']('i.id\x20LIKE\x20?',_0x3ecb7e+'%');}else{_0x45cfc3['or'](_0x2246('0x84'),qs['getFullTextValue'](_0x3ecb7e))['or'](_0x2246('0x85'),_0x3ecb7e+'%')['or'](_0x2246('0x86'),_0x3ecb7e+'%');}}}_0x3e9c03['where'](_0x45cfc3);_0x3e9c03[_0x2246('0x87')]('i.id');var _0x30a28f={'type':db[_0x2246('0x88')][_0x2246('0x89')]['SELECT'],'raw':!![]};var _0x39815b=_0x3e9c03[_0x2246('0x8a')]();_0x39815b[_0x2246('0x4c')]('i.id');_0x39815b[_0x2246('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2246('0x60'));if(_0x8617f9[_0x2246('0x46')]){_0x8617f9[_0x2246('0x46')][_0x2246('0x36')](function(_0x5f2ab0){var _0x546cff=_0x5f2ab0[0x0]===_0x2246('0x8b')?_0x5f2ab0[0x0]:'i.'+_0x5f2ab0[0x0];_0x3e9c03['order'](_0x546cff,_0x5f2ab0[0x1]===_0x2246('0x8c')?![]:!![]);});}if(!_[_0x2246('0x72')](_0x4aa262)){_0x3e9c03[_0x2246('0x62')](_0x9bf0dd);_0x39815b[_0x2246('0x47')](_0x2246('0x8d'),_0x4aa262);}BPromise[_0x2246('0x8e')]()[_0x2246('0x2b')](function(){if(!_0x98e989){if(_0x1bd6b0[_0x2246('0x3e')][_0x2246('0x73')])return;_0x39815b['where'](_0x2246('0x8f'));_0x3e9c03[_0x2246('0x47')](_0x2246('0x8f'));return;}if(_0x1bd6b0['user'][_0x2246('0x90')]!=='agent')return;return _0x1bd6b0['user'][_0x2246('0x91')]({'attributes':['id'],'raw':!![]})[_0x2246('0x2b')](function(_0x2a4919){if(_[_0x2246('0x72')](_0x2a4919)){_0x39815b[_0x2246('0x47')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x3e9c03[_0x2246('0x47')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x39815b[_0x2246('0x47')](_0x2246('0x74'),_[_0x2246('0x32')](_0x2a4919,'id'));_0x3e9c03[_0x2246('0x47')](_0x2246('0x74'),_[_0x2246('0x32')](_0x2a4919,'id'));}});})[_0x2246('0x2b')](function(){if(_0x1bd6b0[_0x2246('0x92')][_0x2246('0x90')]===_0x2246('0x93')&&!_0x98e989&&!_0x1bd6b0[_0x2246('0x3e')][_0x2246('0x73')])return[];return db[_0x2246('0x94')][_0x2246('0x3e')](_0x39815b[_0x2246('0x95')](),_0x30a28f);})[_0x2246('0x2b')](function(_0x1a1296){_0x236b98[_0x2246('0x26')]=_0x1a1296[_0x2246('0x44')];if(_0x236b98['count']===0x0)return[];return db[_0x2246('0x94')][_0x2246('0x3e')](_0x4cc324[_0x2246('0x95')](),_0x30a28f)[_0x2246('0x2b')](function(_0xd3ef16){_0x3b39d9=_['keyBy'](_0xd3ef16,'id');_0x30a28f=_[_0x2246('0x96')](_0x30a28f,{'model':db[_0x2246('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1bd6b0[_0x2246('0x3e')][_0x2246('0x43')]){_0x8617f9[_0x2246('0x42')][_0x2246('0x36')](function(_0x3fdef3){_0x3e9c03[_0x2246('0x4c')]('i.'+_0x3fdef3);});}else{_0x3e9c03[_0x2246('0x4c')](_0x2246('0x97'),_0x2246('0x60'));_0x3e9c03[_0x2246('0x4c')]('a.key','Account.key');_0x3e9c03['field'](_0x2246('0x98'),_0x2246('0x99'));_0x3e9c03[_0x2246('0x4c')](_0x2246('0x9a'),'contactName');_0x3e9c03['field'](_0x2246('0x9b'));_0x3e9c03[_0x2246('0x4c')]('c.firstName',_0x2246('0x9c'));_0x3e9c03[_0x2246('0x4c')]('c.lastName',_0x2246('0x9d'));_0x3e9c03[_0x2246('0x4c')](_0x2246('0x9e'),_0x2246('0x9f'));_0x3e9c03[_0x2246('0x4c')](_0x2246('0xa0'),'Contact.phone');_0x3e9c03[_0x2246('0x4c')](_0x2246('0xa1'),_0x2246('0xa2'));_0x3e9c03[_0x2246('0x4c')](_0x2246('0xa3'),_0x2246('0xa4'));_0x3e9c03[_0x2246('0x4c')](_0x2246('0xa5'),_0x2246('0xa6'));_0x3e9c03[_0x2246('0x4c')]('o.internal',_0x2246('0xa7'));_0x3e9c03[_0x2246('0x4c')](_0x2246('0xa8'),_0x2246('0x38'));}if(_0x8617f9[_0x2246('0x24')])_0x3e9c03[_0x2246('0x24')](_0x8617f9[_0x2246('0x24')]);if(_0x8617f9[_0x2246('0x23')])_0x3e9c03[_0x2246('0x23')](_0x8617f9['offset']);return db[_0x2246('0x94')][_0x2246('0x3e')](_0x3e9c03[_0x2246('0x95')](),_0x30a28f);})['then'](function(_0x3e89b1){if(_0x3e89b1['length']>0x0)_0x23af54['where'](_0x2246('0xa9'),_['map'](_0x3e89b1,'id'));return db['sequelize'][_0x2246('0x3e')](_0x23af54[_0x2246('0x95')](),_0x30a28f)[_0x2246('0x2b')](function(_0x4aabfd){var _0x13eccc=_[_0x2246('0xaa')](_0x4aabfd,'OpenchannelInteractionId');var _0x49ab77=[];_0x3e89b1[_0x2246('0x36')](function(_0x2c2737){_0x49ab77[_0x2246('0x37')](updateOpenchannelInteraction(_0x2c2737,_0x3b39d9,_0x13eccc));});return BPromise['all'](_0x49ab77);});});})[_0x2246('0x2b')](function(_0x179ea2){_0x236b98['rows']=_0x179ea2;return _0x236b98;})[_0x2246('0x2b')](respondWithFilteredResult(_0x53491a,_0x8617f9))[_0x2246('0xab')](handleError(_0x53491a,null));};exports['show']=function(_0x332448,_0x37ecc7){var _0x57ecf8={};if(_0x332448[_0x2246('0x3e')][_0x2246('0x6e')]&&_0x332448['query'][_0x2246('0x6e')]===_0x2246('0xac')){_0x57ecf8['from']=_0x332448[_0x2246('0xad')]['id'];}else{_0x57ecf8['id']=_0x332448[_0x2246('0xad')]['id'];}var _0x23d616={'raw':![],'where':_0x57ecf8},_0x80292d={};_0x80292d[_0x2246('0x3d')]=_[_0x2246('0x3f')](db[_0x2246('0x3a')]['rawAttributes']);_0x80292d['query']=_[_0x2246('0x3f')](_0x332448[_0x2246('0x3e')]);_0x80292d[_0x2246('0x40')]=_[_0x2246('0x41')](_0x80292d['model'],_0x80292d[_0x2246('0x3e')]);_0x23d616[_0x2246('0x42')]=_[_0x2246('0x41')](_0x80292d[_0x2246('0x3d')],qs[_0x2246('0x43')](_0x332448[_0x2246('0x3e')]['fields']));_0x23d616['attributes']=_0x23d616['attributes'][_0x2246('0x44')]?_0x23d616[_0x2246('0x42')]:_0x80292d[_0x2246('0x3d')];if(_0x332448[_0x2246('0x3e')]['includeAll']){_0x23d616[_0x2246('0xae')]=[{'all':!![]}];}_0x23d616=_[_0x2246('0x96')]({},_0x23d616,_0x332448[_0x2246('0xaf')]);return db[_0x2246('0x3a')]['find'](_0x23d616)['then'](handleEntityNotFound(_0x37ecc7,null))[_0x2246('0x2b')](respondWithResult(_0x37ecc7,null))['catch'](handleError(_0x37ecc7,null));};exports[_0x2246('0xb0')]=function(_0x2df4bf,_0x2d4a96){return db[_0x2246('0x3a')][_0x2246('0xb0')](_0x2df4bf[_0x2246('0x70')],{})[_0x2246('0x2b')](respondWithResult(_0x2d4a96,0xc9))[_0x2246('0xab')](handleError(_0x2d4a96,null));};exports[_0x2246('0x2a')]=function(_0x27584b,_0x4c66e9){if(_0x27584b[_0x2246('0x70')]['id']){delete _0x27584b[_0x2246('0x70')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x27584b['params']['id']}})[_0x2246('0x2b')](handleEntityNotFound(_0x4c66e9,null))['then'](saveUpdates(_0x27584b[_0x2246('0x70')],null))[_0x2246('0x2b')](respondWithResult(_0x4c66e9,null))[_0x2246('0xab')](handleError(_0x4c66e9,null));};exports[_0x2246('0xb1')]=function(_0x3602c8,_0x209d64){return db['OpenchannelInteraction'][_0x2246('0x5f')]({'where':{'id':_0x3602c8[_0x2246('0xad')]['id']}})[_0x2246('0x2b')](handleEntityNotFound(_0x209d64,null))['then'](removeEntity(_0x209d64,null))[_0x2246('0xab')](handleError(_0x209d64,null));};exports[_0x2246('0xb2')]=function(_0x2d814d,_0x21e927){return db['OpenchannelInteraction'][_0x2246('0xb2')]()[_0x2246('0x2b')](respondWithResult(_0x21e927,null))[_0x2246('0xab')](handleError(_0x21e927,null));};exports[_0x2246('0xb3')]=function(_0x5a5373,_0x5545ec,_0x2f3d90){return db[_0x2246('0xb4')][_0x2246('0x5f')]({'where':{'id':_0x5a5373[_0x2246('0xad')]['id']}})[_0x2246('0x2b')](handleEntityNotFound(_0x5545ec,null))[_0x2246('0x2b')](function(_0xe1d6f){if(_0xe1d6f){return _0xe1d6f[_0x2246('0xb3')](_0x5a5373[_0x2246('0x70')][_0x2246('0xb5')],_['omit'](_0x5a5373[_0x2246('0x70')],['ids','id'])||{});}})[_0x2246('0x2b')](respondWithResult(_0x5545ec,null))[_0x2246('0xab')](handleError(_0x5545ec,null));};exports[_0x2246('0xb6')]=function(_0xce023c,_0x18ccc3,_0x3fcf12){var _0x58489c={'raw':![],'where':{}};var _0x35801a={};var _0x19fb3c={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x2246('0xb7')]({'where':{'id':_0xce023c['params']['id']}})['then'](handleEntityNotFound(_0x18ccc3,null))['then'](function(_0xebf97){if(_0xebf97){_0x35801a['model']=_[_0x2246('0x3f')](db[_0x2246('0xb4')][_0x2246('0x3b')]);_0x35801a[_0x2246('0x3e')]=_[_0x2246('0x3f')](_0xce023c[_0x2246('0x3e')]);_0x35801a[_0x2246('0x40')]=_[_0x2246('0x41')](_0x35801a[_0x2246('0x3d')],_0x35801a[_0x2246('0x3e')]);_0x58489c[_0x2246('0x42')]=_[_0x2246('0x41')](_0x35801a[_0x2246('0x3d')],qs[_0x2246('0x43')](_0xce023c['query']['fields']));_0x58489c[_0x2246('0x42')]=_0x58489c['attributes'][_0x2246('0x44')]?_0x58489c['attributes']:_0x35801a['model'];if(!_0xce023c[_0x2246('0x3e')][_0x2246('0xb8')](_0x2246('0x45'))){_0x58489c[_0x2246('0x24')]=qs[_0x2246('0x24')](_0xce023c[_0x2246('0x3e')]['limit']);_0x58489c[_0x2246('0x23')]=qs['offset'](_0xce023c[_0x2246('0x3e')][_0x2246('0x23')]);}_0x58489c[_0x2246('0x46')]=qs[_0x2246('0xb9')](_0xce023c['query'][_0x2246('0xb9')]);_0x58489c['where']=qs[_0x2246('0x40')](_[_0x2246('0x48')](_0xce023c['query'],_0x35801a[_0x2246('0x40')]));_0x58489c[_0x2246('0x47')]['OpenchannelInteractionId']=_0xebf97['id'];if(_0xce023c[_0x2246('0x3e')][_0x2246('0x81')]){_0x58489c[_0x2246('0x47')]=_[_0x2246('0x96')](_0x58489c[_0x2246('0x47')],{'$or':_[_0x2246('0x32')](_0x58489c[_0x2246('0x42')],function(_0x2092f7){var _0x5710f9={};_0x5710f9[_0x2092f7]={'$like':'%'+_0xce023c['query'][_0x2246('0x81')]+'%'};return _0x5710f9;})});}if(_0xce023c[_0x2246('0x3e')][_0x2246('0x78')]){var _0x271cd8=_0xce023c[_0x2246('0x3e')][_0x2246('0x78')]['split'](',');var _0x375c4b={};_0x375c4b[_0x271cd8[0x0]]={'$gte':moment(_0x271cd8[0x1])[_0x2246('0xba')](_0x2246('0xbb'))};_0x58489c[_0x2246('0x47')]=_[_0x2246('0x96')](_0x58489c[_0x2246('0x47')],_0x375c4b);}_0x58489c=_['merge']({},_0x58489c,_0xce023c['options']);return db[_0x2246('0xb4')][_0x2246('0x26')]({'where':_0x58489c[_0x2246('0x47')]})[_0x2246('0x2b')](function(_0x2ab890){_0x19fb3c[_0x2246('0x26')]=_0x2ab890;if(_0xce023c['query']['includeAll']){_0x58489c[_0x2246('0xae')]=[{'all':!![]}];}return db[_0x2246('0xb4')][_0x2246('0xbc')](_0x58489c);})['then'](function(_0x382735){_0x19fb3c[_0x2246('0xbd')]=_0x382735;return _0x19fb3c;});}})[_0x2246('0x2b')](respondWithFilteredResult(_0x18ccc3,_0x58489c))[_0x2246('0xab')](handleError(_0x18ccc3,null));};exports[_0x2246('0xbe')]=function(_0xbb4057,_0x90ff91,_0x23eb86){return db['OpenchannelInteraction'][_0x2246('0x5f')]({'where':{'id':_0xbb4057['params']['id']}})[_0x2246('0x2b')](handleEntityNotFound(_0x90ff91,null))[_0x2246('0x2b')](function(_0x145542){if(_0x145542){return _0x145542[_0x2246('0xbf')](_0xbb4057['body'][_0x2246('0xb5')],_[_0x2246('0xc0')](_0xbb4057[_0x2246('0x70')],[_0x2246('0xb5'),'id'])||{})[_0x2246('0xc1')](function(){return db['Tag'][_0x2246('0xbc')]({'attributes':['id',_0x2246('0x2f'),_0x2246('0x49')],'where':{'id':_0xbb4057[_0x2246('0x70')]['ids']}});})[_0x2246('0x2b')](function(_0x4d0332){socket[_0x2246('0xc2')]('openchannelInteractionTags:save',{'id':Number(_0xbb4057[_0x2246('0xad')]['id']),'tags':_0x4d0332||[]});return{'id':Number(_0xbb4057[_0x2246('0xad')]['id']),'tags':_0x4d0332||[]};});}})[_0x2246('0x2b')](respondWithResult(_0x90ff91,null))['catch'](handleError(_0x90ff91,null));};exports[_0x2246('0xc3')]=function(_0x6a32cc,_0x45c858,_0x43ffa6){return db[_0x2246('0x3a')][_0x2246('0x5f')]({'where':{'id':_0x6a32cc[_0x2246('0xad')]['id']}})[_0x2246('0x2b')](handleEntityNotFound(_0x45c858,null))['then'](function(_0x57a0b6){if(_0x57a0b6){return _0x57a0b6['removeTags'](_0x6a32cc[_0x2246('0x3e')][_0x2246('0xb5')]);}})['then'](respondWithStatusCode(_0x45c858,null))[_0x2246('0xab')](handleError(_0x45c858,null));};exports[_0x2246('0xc4')]=function(_0x335149,_0x53097a){var _0x37e78f=moment()[_0x2246('0xc5')]()['toString']();var _0x4e1cb9=path[_0x2246('0xc6')](config[_0x2246('0xc7')],'server',_0x2246('0xc8'),_0x2246('0xc9'));var _0x135a02=path[_0x2246('0xc6')](config[_0x2246('0xc7')],'server',_0x2246('0xc8'),_0x2246('0xca'));var _0x1e32b2=path[_0x2246('0xc6')](_0x4e1cb9,_0x37e78f);var _0x524ba5=util[_0x2246('0xba')](_0x2246('0xcb'),_0x335149['params']['id'],_0x37e78f);var _0x334ca8=path[_0x2246('0xc6')](_0x4e1cb9,_0x524ba5);var _0x3d9e29=[];_0x3d9e29[_0x2246('0x37')]({'model':db['User'],'as':_0x2246('0xcc'),'attributes':['id','fullname'],'raw':!![]});_0x3d9e29[_0x2246('0x37')]({'model':db[_0x2246('0xcd')],'as':_0x2246('0x65'),'attributes':['id',_0x2246('0xce'),'lastName'],'raw':!![]});if(_0x335149[_0x2246('0x3e')]['attachments']){_0x3d9e29[_0x2246('0x37')]({'model':db[_0x2246('0xcf')],'as':_0x2246('0xcf'),'raw':!![]});}var _0x415cdf=[{'model':db[_0x2246('0xb4')],'as':_0x2246('0xd0'),'attributes':['id',_0x2246('0x70'),'createdAt',_0x2246('0xd1'),_0x2246('0xd2'),_0x2246('0x7c')],'include':_0x3d9e29}];_0x415cdf[_0x2246('0x37')]({'model':db[_0x2246('0xd3')],'as':_0x2246('0xd4'),'attributes':['id',_0x2246('0x2f')]});_0x415cdf['push']({'model':db[_0x2246('0xcc')],'as':_0x2246('0xd5'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0x2246('0x5f')]({'where':{'id':_0x335149[_0x2246('0xad')]['id']},'include':_0x415cdf})[_0x2246('0x2b')](handleEntityNotFound(_0x53097a,null))[_0x2246('0x2b')](function(_0x5ca51c){if(_0x5ca51c){var _0x3a9ab8=_0x5ca51c[_0x2246('0xd6')]({'plain':!![]});fs[_0x2246('0xd7')](_0x1e32b2);var _0x4b6be9={'channel':_0x2246('0xd8'),'account':_0x3a9ab8[_0x2246('0xd4')][_0x2246('0x2f')],'agent':_0x3a9ab8['Owner']?_0x3a9ab8['Owner'][_0x2246('0x33')]:'N.A.','createdAt':moment(_0x3a9ab8['createdAt'])[_0x2246('0xba')](_0x2246('0xbb'))['toString'](),'closedAt':_0x3a9ab8[_0x2246('0xd9')]?moment(_0x3a9ab8['closedAt'])[_0x2246('0xba')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x3a9ab8[_0x2246('0xda')],'visibility':_0x3a9ab8[_0x2246('0xdb')]?_0x2246('0xdc'):_0x2246('0xdd'),'messages':_(_0x3a9ab8[_0x2246('0xd0')])[_0x2246('0x81')]({'secret':![]})[_0x2246('0x32')](function(_0x6a0e9b){if(_0x6a0e9b[_0x2246('0xcf')]){var _0x3a9195=path[_0x2246('0xc6')](_0x135a02,_0x6a0e9b[_0x2246('0xcf')]['basename']);if(fs['existsSync'](_0x3a9195)){fs[_0x2246('0xde')](_0x3a9195)[_0x2246('0xdf')](fs[_0x2246('0xe0')](path[_0x2246('0xc6')](_0x1e32b2,_0x6a0e9b['Attachment']['basename'])));}}return{'date':moment(_0x6a0e9b[_0x2246('0x76')])[_0x2246('0xba')](_0x2246('0xbb'))[_0x2246('0x95')](),'sender':_0x6a0e9b[_0x2246('0xd1')]==='out'?_0x6a0e9b[_0x2246('0xcc')]?_0x6a0e9b[_0x2246('0xcc')]['fullname']:'System':_0x6a0e9b[_0x2246('0x65')][_0x2246('0xce')]+(_0x6a0e9b['Contact'][_0x2246('0xe1')]?'\x20'+_0x6a0e9b[_0x2246('0x65')]['lastName']:''),'body':_0x6a0e9b[_0x2246('0xcf')]?_0x6a0e9b[_0x2246('0xcf')][_0x2246('0xe2')]:_0x6a0e9b[_0x2246('0x70')],'direction':_0x6a0e9b[_0x2246('0xd1')]==='out'?'A':'C','secret':_0x6a0e9b[_0x2246('0xd2')],'read':_0x6a0e9b[_0x2246('0x7c')],'attachment':_0x6a0e9b[_0x2246('0xcf')]};})[_0x2246('0x61')]()};return ejs['renderFile'](path[_0x2246('0xc6')](config[_0x2246('0xc7')],'server',_0x2246('0xe3'),_0x2246('0xe4')),{'interaction':_0x4b6be9})[_0x2246('0x2b')](function(_0x2b53b4){var _0x502acd=path[_0x2246('0xc6')](_0x1e32b2,_0x2246('0xe5')+_0x3a9ab8['id']+'-'+_0x37e78f+_0x2246('0xe6'));var _0x52b496={'path':_0x502acd,'channel':_0x2246('0xd8'),'interactionId':_0x3a9ab8['id']};return pdf[_0x2246('0xe7')](_0x2b53b4,_0x52b496);})['then'](function(){return new BPromise(function(_0x590905,_0x505cb7){zipdir(_0x1e32b2,{'saveTo':_0x334ca8},function(_0x3d7be2,_0x19b5b3){if(_0x3d7be2)return _0x505cb7(_0x3d7be2);return _0x590905(_0x19b5b3);});})['then'](function(){return new BPromise(function(_0x157ae0,_0x533127){rimraf(_0x1e32b2,function(_0x18fae4){if(_0x18fae4)_0x533127(_0x18fae4);return _0x157ae0();});});})[_0x2246('0x2b')](function(){return _0x53097a[_0x2246('0xc4')](_0x334ca8,_0x524ba5,function(_0x38c33d){if(_0x38c33d){console['log']('err',_0x38c33d);}else{fs[_0x2246('0xe8')](_0x334ca8);}});});});}else{return _0x53097a[_0x2246('0x2c')](0xc8);}})[_0x2246('0xab')](handleError(_0x53097a,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 536d87e..bd926d4 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 _0xc6c0=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','then','setDataValue','map','findAll','length','emit'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xc6c0,0xae));var _0x0c6c=function(_0x1c6089,_0x3816e2){_0x1c6089=_0x1c6089-0x0;var _0x4d97c1=_0xc6c0[_0x1c6089];return _0x4d97c1;};'use strict';var EventEmitter=require(_0x0c6c('0x0'));var OpenchannelInteraction=require(_0x0c6c('0x1'))['db'][_0x0c6c('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x0c6c('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0c6c('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0c6c('0x5'),'afterDestroy':_0x0c6c('0x6')};function emitEvent(_0x2dd7c4){return function(_0x5b7acd,_0x2f2022,_0x382712){_0x5b7acd['getUsers']({'attributes':['id'],'raw':!![]})[_0x0c6c('0x7')](function(_0x53e91a){_0x5b7acd[_0x0c6c('0x8')]('Users',_0x53e91a[_0x0c6c('0x9')](function(_0x2efe7f){return{'id':_0x2efe7f['id']};}));return OpenchannelMessage[_0x0c6c('0xa')]({'where':{'OpenchannelInteractionId':_0x5b7acd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0c6c('0x7')](function(_0x5ec7ed){_0x5b7acd[_0x0c6c('0x8')]('unreadMessages',_0x5ec7ed[_0x0c6c('0xb')]);OpenchannelInteractionEvents[_0x0c6c('0xc')](_0x2dd7c4+':'+_0x5b7acd['id'],_0x5b7acd);OpenchannelInteractionEvents[_0x0c6c('0xc')](_0x2dd7c4,_0x5b7acd);_0x382712(null);})[_0x0c6c('0xd')](_0x382712(null));};}for(var e in events){if(events[_0x0c6c('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x0c6c('0xf')](e,emitEvent(event));}}module[_0x0c6c('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xc934=['map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','update','remove','then','setDataValue','Users'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xc934,0x18f));var _0x4c93=function(_0x45bddc,_0x3af164){_0x45bddc=_0x45bddc-0x0;var _0x343087=_0xc934[_0x45bddc];return _0x343087;};'use strict';var EventEmitter=require(_0x4c93('0x0'));var OpenchannelInteraction=require(_0x4c93('0x1'))['db'][_0x4c93('0x2')];var OpenchannelMessage=require(_0x4c93('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4c93('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4c93('0x4'),'afterDestroy':_0x4c93('0x5')};function emitEvent(_0x19ca67){return function(_0x5cdac2,_0x4d726c,_0xb7f752){_0x5cdac2['getUsers']({'attributes':['id'],'raw':!![]})[_0x4c93('0x6')](function(_0x557f49){_0x5cdac2[_0x4c93('0x7')](_0x4c93('0x8'),_0x557f49[_0x4c93('0x9')](function(_0x4c79d6){return{'id':_0x4c79d6['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x5cdac2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4c93('0x6')](function(_0x28f0dd){_0x5cdac2[_0x4c93('0x7')](_0x4c93('0xa'),_0x28f0dd[_0x4c93('0xb')]);OpenchannelInteractionEvents[_0x4c93('0xc')](_0x19ca67+':'+_0x5cdac2['id'],_0x5cdac2);OpenchannelInteractionEvents[_0x4c93('0xc')](_0x19ca67,_0x5cdac2);_0xb7f752(null);})[_0x4c93('0xd')](_0xb7f752(null));};}for(var e in events){if(events[_0x4c93('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x4c93('0xf')](e,emitEvent(event));}}module[_0x4c93('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index ccad54f..9b077d2 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 _0xa8fd=['changed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions'];(function(_0x35d34c,_0x419476){var _0x3ff9bb=function(_0x2646a6){while(--_0x2646a6){_0x35d34c['push'](_0x35d34c['shift']());}};_0x3ff9bb(++_0x419476);}(_0xa8fd,0xd4));var _0xda8f=function(_0x3f3f44,_0x27eaa5){_0x3f3f44=_0x3f3f44-0x0;var _0x3eb36f=_0xa8fd[_0x3f3f44];return _0x3eb36f;};'use strict';var _=require(_0xda8f('0x0'));var util=require(_0xda8f('0x1'));var logger=require(_0xda8f('0x2'))(_0xda8f('0x3'));var moment=require(_0xda8f('0x4'));var BPromise=require(_0xda8f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda8f('0x6'));var rimraf=require(_0xda8f('0x7'));var config=require(_0xda8f('0x8'));var attributes=require(_0xda8f('0x9'));module[_0xda8f('0xa')]=function(_0x588be0,_0x4a75c1){return _0x588be0['define'](_0xda8f('0xb'),attributes,{'tableName':_0xda8f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x407f7d,_0x1806a4,_0x3dea34){if(_0x407f7d[_0xda8f('0xd')]('closed')){_0x407f7d['closedAt']=moment()['format'](_0xda8f('0xe'));}_0x3dea34(null,_0x407f7d);}}});}; \ No newline at end of file +var _0xcd74=['closed','closedAt','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions'];(function(_0x5975c4,_0x361758){var _0x1f6fc9=function(_0x593895){while(--_0x593895){_0x5975c4['push'](_0x5975c4['shift']());}};_0x1f6fc9(++_0x361758);}(_0xcd74,0x18a));var _0x4cd7=function(_0xe89505,_0x410a3b){_0xe89505=_0xe89505-0x0;var _0x1590c5=_0xcd74[_0xe89505];return _0x1590c5;};'use strict';var _=require('lodash');var util=require(_0x4cd7('0x0'));var logger=require(_0x4cd7('0x1'))(_0x4cd7('0x2'));var moment=require(_0x4cd7('0x3'));var BPromise=require('bluebird');var rp=require(_0x4cd7('0x4'));var fs=require('fs');var path=require(_0x4cd7('0x5'));var rimraf=require(_0x4cd7('0x6'));var config=require(_0x4cd7('0x7'));var attributes=require(_0x4cd7('0x8'));module['exports']=function(_0x407275,_0x3a7fa5){return _0x407275[_0x4cd7('0x9')](_0x4cd7('0xa'),attributes,{'tableName':_0x4cd7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x482460,_0x19c439,_0x5bfe6b){if(_0x482460['changed'](_0x4cd7('0xc'))){_0x482460[_0x4cd7('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5bfe6b(null,_0x482460);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 172c7b6..68bc18c 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 _0xa4fd=['client','redis','defaults','localhost','socket.io-emitter','register','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','limit','then','AddTagsToOpenchannelInteraction','find','ids','spread','AddTags','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3d599d,_0x197f95){var _0x317bb8=function(_0x31d1eb){while(--_0x31d1eb){_0x3d599d['push'](_0x3d599d['shift']());}};_0x317bb8(++_0x197f95);}(_0xa4fd,0x17d));var _0xda4f=function(_0x4da7ce,_0x238865){_0x4da7ce=_0x4da7ce-0x0;var _0x3b1b7b=_0xa4fd[_0x4da7ce];return _0x3b1b7b;};'use strict';var _=require(_0xda4f('0x0'));var util=require(_0xda4f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xda4f('0x2'));var fs=require('fs');var Redis=require(_0xda4f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xda4f('0x4'));var logger=require(_0xda4f('0x5'))(_0xda4f('0x6'));var config=require(_0xda4f('0x7'));var jayson=require(_0xda4f('0x8'));var client=jayson[_0xda4f('0x9')]['http']({'port':0x232a});config[_0xda4f('0xa')]=_[_0xda4f('0xb')](config['redis'],{'host':_0xda4f('0xc'),'port':0x18eb});var socket=require(_0xda4f('0xd'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0xda4f('0xe')](socket);function respondWithRpcPromise(_0x116824,_0x25df19,_0x36a0fd){return new BPromise(function(_0x2b0bf8,_0x21ad4f){return client['request'](_0x116824,_0x36a0fd)['then'](function(_0x25a4a0){logger[_0xda4f('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x25df19,_0xda4f('0x10'));logger[_0xda4f('0x11')](_0xda4f('0x12'),_0x25df19,_0xda4f('0x10'),JSON[_0xda4f('0x13')](_0x25a4a0));if(_0x25a4a0[_0xda4f('0x14')]){if(_0x25a4a0[_0xda4f('0x14')][_0xda4f('0x15')]===0x1f4){logger[_0xda4f('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x25df19,_0x25a4a0['error'][_0xda4f('0x16')]);return _0x21ad4f(_0x25a4a0[_0xda4f('0x14')][_0xda4f('0x16')]);}logger[_0xda4f('0x14')](_0xda4f('0x17'),_0x25df19,_0x25a4a0[_0xda4f('0x14')][_0xda4f('0x16')]);return _0x2b0bf8(_0x25a4a0[_0xda4f('0x14')][_0xda4f('0x16')]);}else{logger[_0xda4f('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x25df19,_0xda4f('0x10'));_0x2b0bf8(_0x25a4a0['result'][_0xda4f('0x16')]);}})[_0xda4f('0x18')](function(_0x154a46){logger[_0xda4f('0x14')](_0xda4f('0x17'),_0x25df19,_0x154a46);_0x21ad4f(_0x154a46);});});}exports[_0xda4f('0x19')]=function(_0x3cd375){var _0x305582=this;return new Promise(function(_0x28a8ec,_0x31ff2e){return db[_0xda4f('0x1a')]['update'](_0x3cd375[_0xda4f('0x1b')],{'raw':_0x3cd375['options']?_0x3cd375[_0xda4f('0x1c')][_0xda4f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cd375['options']?_0x3cd375[_0xda4f('0x1c')][_0xda4f('0x1e')]||null:null,'attributes':_0x3cd375[_0xda4f('0x1c')]?_0x3cd375[_0xda4f('0x1c')][_0xda4f('0x1f')]||null:null,'limit':_0x3cd375[_0xda4f('0x1c')]?_0x3cd375['options'][_0xda4f('0x20')]||null:null})[_0xda4f('0x21')](function(_0x2b14e5){logger[_0xda4f('0xf')](_0xda4f('0x19'),_0x3cd375);logger[_0xda4f('0x11')]('UpdateOpenchannelInteraction',_0x3cd375,JSON[_0xda4f('0x13')](_0x2b14e5));_0x28a8ec(_0x2b14e5);})[_0xda4f('0x18')](function(_0x1cef6a){logger[_0xda4f('0x14')]('UpdateOpenchannelInteraction',_0x1cef6a[_0xda4f('0x16')],_0x3cd375);_0x31ff2e(_0x305582[_0xda4f('0x14')](0x1f4,_0x1cef6a['message']));});});};exports[_0xda4f('0x22')]=function(_0x2a5021){return new Promise(function(_0x2946ab,_0x5b76f5){return db['OpenchannelInteraction'][_0xda4f('0x23')]({'where':_0x2a5021['options']?_0x2a5021['options'][_0xda4f('0x1e')]||null:null})['then'](function(_0x1dd238){if(_0x1dd238){return _0x1dd238['addTags'](_0x2a5021[_0xda4f('0x1b')][_0xda4f('0x24')],_['omit'](_0x2a5021[_0xda4f('0x1b')],[_0xda4f('0x24'),'id'])||{});}})[_0xda4f('0x25')](function(_0x4185cc){logger['info'](_0xda4f('0x26'),_0x2a5021);logger[_0xda4f('0x11')]('AddTags',_0x2a5021,JSON['stringify'](_0x4185cc));_0x2946ab(_0x4185cc);})[_0xda4f('0x18')](function(_0x3bbeef){logger[_0xda4f('0x14')](_0xda4f('0x26'),_0x3bbeef[_0xda4f('0x16')],_0x2a5021);_0x5b76f5(_this['error'](0x1f4,_0x3bbeef[_0xda4f('0x16')]));});});}; \ No newline at end of file +var _0x2777=['./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','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x512c83,_0x42a67a){var _0x1f7f25=function(_0x1e656c){while(--_0x1e656c){_0x512c83['push'](_0x512c83['shift']());}};_0x1f7f25(++_0x42a67a);}(_0x2777,0xa5));var _0x7277=function(_0x130fe7,_0x1dd5e6){_0x130fe7=_0x130fe7-0x0;var _0x299c23=_0x2777[_0x130fe7];return _0x299c23;};'use strict';var _=require(_0x7277('0x0'));var util=require(_0x7277('0x1'));var moment=require(_0x7277('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7277('0x3'));var db=require(_0x7277('0x4'))['db'];var utils=require(_0x7277('0x5'));var logger=require(_0x7277('0x6'))('rpc');var config=require(_0x7277('0x7'));var jayson=require(_0x7277('0x8'));var client=jayson[_0x7277('0x9')][_0x7277('0xa')]({'port':0x232a});config[_0x7277('0xb')]=_[_0x7277('0xc')](config[_0x7277('0xb')],{'host':_0x7277('0xd'),'port':0x18eb});var socket=require(_0x7277('0xe'))(new Redis(config['redis']));require(_0x7277('0xf'))[_0x7277('0x10')](socket);function respondWithRpcPromise(_0x114c29,_0xd60997,_0x378613){return new BPromise(function(_0x583bc7,_0x56328e){return client[_0x7277('0x11')](_0x114c29,_0x378613)[_0x7277('0x12')](function(_0x6f043a){logger[_0x7277('0x13')](_0x7277('0x14'),_0xd60997,_0x7277('0x15'));logger[_0x7277('0x16')](_0x7277('0x17'),_0xd60997,_0x7277('0x15'),JSON[_0x7277('0x18')](_0x6f043a));if(_0x6f043a[_0x7277('0x19')]){if(_0x6f043a[_0x7277('0x19')][_0x7277('0x1a')]===0x1f4){logger[_0x7277('0x19')](_0x7277('0x14'),_0xd60997,_0x6f043a[_0x7277('0x19')][_0x7277('0x1b')]);return _0x56328e(_0x6f043a[_0x7277('0x19')]['message']);}logger[_0x7277('0x19')](_0x7277('0x14'),_0xd60997,_0x6f043a['error'][_0x7277('0x1b')]);return _0x583bc7(_0x6f043a[_0x7277('0x19')][_0x7277('0x1b')]);}else{logger[_0x7277('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0xd60997,_0x7277('0x15'));_0x583bc7(_0x6f043a[_0x7277('0x1c')][_0x7277('0x1b')]);}})[_0x7277('0x1d')](function(_0x15be62){logger[_0x7277('0x19')](_0x7277('0x14'),_0xd60997,_0x15be62);_0x56328e(_0x15be62);});});}exports[_0x7277('0x1e')]=function(_0x2a0986){var _0x35e69c=this;return new Promise(function(_0x47963d,_0x2fa0dd){return db[_0x7277('0x1f')][_0x7277('0x20')](_0x2a0986[_0x7277('0x21')],{'raw':_0x2a0986['options']?_0x2a0986[_0x7277('0x22')][_0x7277('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a0986[_0x7277('0x22')]?_0x2a0986[_0x7277('0x22')][_0x7277('0x24')]||null:null,'attributes':_0x2a0986[_0x7277('0x22')]?_0x2a0986[_0x7277('0x22')][_0x7277('0x25')]||null:null,'limit':_0x2a0986['options']?_0x2a0986[_0x7277('0x22')][_0x7277('0x26')]||null:null})['then'](function(_0x2ad848){logger['info']('UpdateOpenchannelInteraction',_0x2a0986);logger[_0x7277('0x16')](_0x7277('0x1e'),_0x2a0986,JSON[_0x7277('0x18')](_0x2ad848));_0x47963d(_0x2ad848);})[_0x7277('0x1d')](function(_0x46dec3){logger[_0x7277('0x19')](_0x7277('0x1e'),_0x46dec3['message'],_0x2a0986);_0x2fa0dd(_0x35e69c[_0x7277('0x19')](0x1f4,_0x46dec3[_0x7277('0x1b')]));});});};exports[_0x7277('0x27')]=function(_0xb6b9a){return new Promise(function(_0x154890,_0x285678){return db[_0x7277('0x1f')]['find']({'where':_0xb6b9a[_0x7277('0x22')]?_0xb6b9a[_0x7277('0x22')][_0x7277('0x24')]||null:null})['then'](function(_0x3d7a86){if(_0x3d7a86){return _0x3d7a86[_0x7277('0x28')](_0xb6b9a[_0x7277('0x21')][_0x7277('0x29')],_[_0x7277('0x2a')](_0xb6b9a[_0x7277('0x21')],[_0x7277('0x29'),'id'])||{});}})[_0x7277('0x2b')](function(_0x4e4f7a){logger[_0x7277('0x13')](_0x7277('0x2c'),_0xb6b9a);logger[_0x7277('0x16')](_0x7277('0x2c'),_0xb6b9a,JSON['stringify'](_0x4e4f7a));_0x154890(_0x4e4f7a);})[_0x7277('0x1d')](function(_0x10d881){logger[_0x7277('0x19')](_0x7277('0x2c'),_0x10d881[_0x7277('0x1b')],_0xb6b9a);_0x285678(_this[_0x7277('0x19')](0x1f4,_0x10d881[_0x7277('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 3ac0526..19dca75 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 _0x68b3=['save','emit','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x2d5906,_0x17b858){var _0x30d315=function(_0x2a09c5){while(--_0x2a09c5){_0x2d5906['push'](_0x2d5906['shift']());}};_0x30d315(++_0x17b858);}(_0x68b3,0xae));var _0x368b=function(_0x3ddb60,_0x37c081){_0x3ddb60=_0x3ddb60-0x0;var _0x549740=_0x68b3[_0x3ddb60];return _0x549740;};'use strict';var OpenchannelInteractionEvents=require(_0x368b('0x0'));var events=[_0x368b('0x1'),'remove','update'];function createListener(_0x38f3bb,_0x31aa34){return function(_0xc43f0e){_0x31aa34[_0x368b('0x2')](_0x38f3bb,_0xc43f0e);};}function removeListener(_0x114ed8,_0x4d6fe0){return function(){OpenchannelInteractionEvents['removeListener'](_0x114ed8,_0x4d6fe0);};}exports['register']=function(_0xb888cb){for(var _0x5c520d=0x0,_0x838b9e=events[_0x368b('0x3')];_0x5c520d<_0x838b9e;_0x5c520d++){var _0xf86317=events[_0x5c520d];var _0x205901=createListener(_0x368b('0x4')+_0xf86317,_0xb888cb);OpenchannelInteractionEvents['on'](_0xf86317,_0x205901);}}; \ No newline at end of file +var _0x5e2a=['openchannelInteraction:','./openchannelInteraction.events','save','update','emit','removeListener','register','length'];(function(_0x1d8dd2,_0x2046ac){var _0x498d1a=function(_0x2104a2){while(--_0x2104a2){_0x1d8dd2['push'](_0x1d8dd2['shift']());}};_0x498d1a(++_0x2046ac);}(_0x5e2a,0x1f1));var _0xa5e2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e2a[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelInteractionEvents=require(_0xa5e2('0x0'));var events=[_0xa5e2('0x1'),'remove',_0xa5e2('0x2')];function createListener(_0x1cbede,_0x22f66f){return function(_0x5a1df9){_0x22f66f[_0xa5e2('0x3')](_0x1cbede,_0x5a1df9);};}function removeListener(_0x1e56f8,_0x2e86d0){return function(){OpenchannelInteractionEvents[_0xa5e2('0x4')](_0x1e56f8,_0x2e86d0);};}exports[_0xa5e2('0x5')]=function(_0x7de2cc){for(var _0x5d39df=0x0,_0x2d308a=events[_0xa5e2('0x6')];_0x5d39df<_0x2d308a;_0x5d39df++){var _0x1cf423=events[_0x5d39df];var _0x4a6a19=createListener(_0xa5e2('0x7')+_0x1cf423,_0x7de2cc);OpenchannelInteractionEvents['on'](_0x1cf423,_0x4a6a19);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index e813ce4..a0fa058 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x3881bf,_0x1b016){var _0x539015=function(_0x5a5aea){while(--_0x5a5aea){_0x3881bf['push'](_0x3881bf['shift']());}};_0x539015(++_0x1b016);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2525f1,_0x47034f){_0x2525f1=_0x2525f1-0x0;var _0x13c1b5=_0xcb91[_0x2525f1];return _0x13c1b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x253cdb,_0x142a36){var _0x1ae7f4=function(_0x476a82){while(--_0x476a82){_0x253cdb['push'](_0x253cdb['shift']());}};_0x1ae7f4(++_0x142a36);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xcb91[_0x562f3b];return _0x1edd55;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 85cf876..c3a53d9 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 _0xa478=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa478,0x136));var _0x8a47=function(_0x47f4c2,_0x134e7b){_0x47f4c2=_0x47f4c2-0x0;var _0x22c63e=_0xa478[_0x47f4c2];return _0x22c63e;};'use strict';var Sequelize=require(_0x8a47('0x0'));module[_0x8a47('0x1')]={'body':{'type':Sequelize[_0x8a47('0x2')](_0x8a47('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8a47('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x8a47('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8a47('0x5')]('in',_0x8a47('0x6')),'defaultValue':_0x8a47('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x8a47('0x7')]},'providerName':{'type':Sequelize[_0x8a47('0x8')]},'providerResponse':{'type':Sequelize[_0x8a47('0x2')]}}; \ No newline at end of file +var _0x373d=['out','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x90d843,_0x5902fe){var _0x1963b1=function(_0x19100d){while(--_0x19100d){_0x90d843['push'](_0x90d843['shift']());}};_0x1963b1(++_0x5902fe);}(_0x373d,0x1e2));var _0xd373=function(_0x282320,_0x379ad6){_0x282320=_0x282320-0x0;var _0x271d54=_0x373d[_0x282320];return _0x271d54;};'use strict';var Sequelize=require(_0xd373('0x0'));module['exports']={'body':{'type':Sequelize[_0xd373('0x1')](_0xd373('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd373('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd373('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd373('0x4')),'defaultValue':_0xd373('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd373('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 9bbc6cd..ebe1976 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 _0x7cc1=['sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','fieldName','type','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','include','rows','show','params','rawAttributes','intersection','length','includeAll','options','catch','create','body','find','describe','openchannel-interactions','accept','openchannel','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','format','SIP/%s','channel','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x3cf89d,_0x3ad686){var _0x2c9c39=function(_0x446f44){while(--_0x446f44){_0x3cf89d['push'](_0x3cf89d['shift']());}};_0x2c9c39(++_0x3ad686);}(_0x7cc1,0x7a));var _0x17cc=function(_0x370474,_0x525d36){_0x370474=_0x370474-0x0;var _0x535f28=_0x7cc1[_0x370474];return _0x535f28;};'use strict';var emlformat=require(_0x17cc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x17cc('0x1'));var rp=require(_0x17cc('0x2'));var moment=require(_0x17cc('0x3'));var BPromise=require(_0x17cc('0x4'));var Mustache=require(_0x17cc('0x5'));var util=require(_0x17cc('0x6'));var path=require('path');var sox=require(_0x17cc('0x7'));var csv=require(_0x17cc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x17cc('0x9'));var squel=require(_0x17cc('0xa'));var crypto=require(_0x17cc('0xb'));var jsforce=require(_0x17cc('0xc'));var deskjs=require(_0x17cc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x17cc('0xe'));var Papa=require('papaparse');var Redis=require(_0x17cc('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x17cc('0x10'));var as=require(_0x17cc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x17cc('0x12'))(_0x17cc('0x13'));var utils=require(_0x17cc('0x14'));var config=require(_0x17cc('0x15'));var licenseUtil=require(_0x17cc('0x16'));var db=require(_0x17cc('0x17'))['db'];config[_0x17cc('0x18')]=_[_0x17cc('0x19')](config[_0x17cc('0x18')],{'host':_0x17cc('0x1a'),'port':0x18eb});var socket=require(_0x17cc('0x1b'))(new Redis(config['redis']));require(_0x17cc('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x17cc('0x1d')][_0x17cc('0x1e')]({'port':0x232c});var client9002=jayson[_0x17cc('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cfe83,_0x3e53e1,_0x17bf4b,_0x5cca83){return new BPromise(function(_0xe44fac,_0x1cc03b){var _0x442d0a=_0x5cca83||client;return _0x442d0a['request'](_0x1cfe83,_0x17bf4b)[_0x17cc('0x1f')](function(_0x1575b2){logger[_0x17cc('0x20')](_0x17cc('0x21'),_0x3e53e1,'request\x20sent');logger['debug'](_0x17cc('0x22'),_0x3e53e1,_0x17cc('0x23'),JSON[_0x17cc('0x24')](_0x1575b2));if(_0x1575b2[_0x17cc('0x25')]){if(_0x1575b2[_0x17cc('0x25')][_0x17cc('0x26')]===0x1f4){logger[_0x17cc('0x25')](_0x17cc('0x21'),_0x3e53e1,_0x1575b2[_0x17cc('0x25')][_0x17cc('0x27')]);return _0x1cc03b(_0x1575b2[_0x17cc('0x25')][_0x17cc('0x27')]);}logger['error'](_0x17cc('0x21'),_0x3e53e1,_0x1575b2['error'][_0x17cc('0x27')]);return _0xe44fac(_0x1575b2[_0x17cc('0x25')][_0x17cc('0x27')]);}else{logger[_0x17cc('0x20')](_0x17cc('0x21'),_0x3e53e1,'request\x20sent');_0xe44fac(_0x1575b2[_0x17cc('0x28')][_0x17cc('0x27')]);}})['catch'](function(_0x3d41a8){logger['error'](_0x17cc('0x21'),_0x3e53e1,_0x3d41a8);_0x1cc03b(_0x3d41a8);});});}function respondWithStatusCode(_0x3139ee,_0x38bbc5){_0x38bbc5=_0x38bbc5||0xcc;return function(_0x2ab67b){if(_0x2ab67b){return _0x3139ee[_0x17cc('0x29')](_0x38bbc5);}return _0x3139ee[_0x17cc('0x2a')](_0x38bbc5)['end']();};}function respondWithResult(_0x4b0629,_0x228a39){_0x228a39=_0x228a39||0xc8;return function(_0x476624){if(_0x476624){return _0x4b0629['status'](_0x228a39)['json'](_0x476624);}};}function respondWithFilteredResult(_0x5ca3b3,_0x34c1ec){return function(_0x51ae0a){if(_0x51ae0a){var _0x43ede7=typeof _0x34c1ec[_0x17cc('0x2b')]===_0x17cc('0x2c')&&typeof _0x34c1ec[_0x17cc('0x2d')]===_0x17cc('0x2c');var _0xae9dc5=_0x51ae0a[_0x17cc('0x2e')];var _0x2901a4=_0x43ede7?0x0:_0x34c1ec[_0x17cc('0x2b')];var _0x32c8c9=_0x43ede7?_0x51ae0a[_0x17cc('0x2e')]:_0x34c1ec['offset']+_0x34c1ec['limit'];var _0x44f4ee;if(_0x32c8c9>=_0xae9dc5){_0x32c8c9=_0xae9dc5;_0x44f4ee=0xc8;}else{_0x44f4ee=0xce;}_0x5ca3b3['status'](_0x44f4ee);return _0x5ca3b3[_0x17cc('0x2f')](_0x17cc('0x30'),_0x2901a4+'-'+_0x32c8c9+'/'+_0xae9dc5)[_0x17cc('0x31')](_0x51ae0a);}return null;};}function patchUpdates(_0x2e1d57){return function(_0x3356e5){try{jsonpatch['apply'](_0x3356e5,_0x2e1d57,!![]);}catch(_0x4e7eb8){return BPromise[_0x17cc('0x32')](_0x4e7eb8);}return _0x3356e5[_0x17cc('0x33')]();};}function saveUpdates(_0x3f6373,_0x3303b8){return function(_0x23357e){if(_0x23357e){return _0x23357e[_0x17cc('0x34')](_0x3f6373)[_0x17cc('0x1f')](function(_0x5e7969){return _0x5e7969;});}return null;};}function removeEntity(_0x2fbb1a,_0x272673){return function(_0x1fd26f){if(_0x1fd26f){return _0x1fd26f[_0x17cc('0x35')]()[_0x17cc('0x1f')](function(){_0x2fbb1a[_0x17cc('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23d524,_0x559bcf){return function(_0x4d46ec){if(!_0x4d46ec){_0x23d524[_0x17cc('0x29')](0x194);}return _0x4d46ec;};}function handleError(_0x3d2cef,_0x418515){_0x418515=_0x418515||0x1f4;return function(_0xf98d89){logger[_0x17cc('0x25')](_0xf98d89[_0x17cc('0x36')]);if(_0xf98d89[_0x17cc('0x37')]){delete _0xf98d89['name'];}_0x3d2cef['status'](_0x418515)[_0x17cc('0x38')](_0xf98d89);};}exports[_0x17cc('0x39')]=function(_0x41bda,_0x385bde){var _0x5dd63c={},_0x1c376a={},_0x245eec={'count':0x0,'rows':[]};var _0x501868=_[_0x17cc('0x3a')](db[_0x17cc('0x3b')]['rawAttributes'],function(_0x11b73a){return{'name':_0x11b73a[_0x17cc('0x3c')],'type':_0x11b73a[_0x17cc('0x3d')][_0x17cc('0x3e')]};});_0x1c376a[_0x17cc('0x3f')]=_[_0x17cc('0x3a')](_0x501868,_0x17cc('0x37'));_0x1c376a[_0x17cc('0x40')]=_[_0x17cc('0x41')](_0x41bda['query']);_0x1c376a['filters']=_['intersection'](_0x1c376a[_0x17cc('0x3f')],_0x1c376a[_0x17cc('0x40')]);_0x5dd63c[_0x17cc('0x42')]=_['intersection'](_0x1c376a[_0x17cc('0x3f')],qs[_0x17cc('0x43')](_0x41bda[_0x17cc('0x40')][_0x17cc('0x43')]));_0x5dd63c[_0x17cc('0x42')]=_0x5dd63c['attributes']['length']?_0x5dd63c[_0x17cc('0x42')]:_0x1c376a[_0x17cc('0x3f')];if(!_0x41bda[_0x17cc('0x40')][_0x17cc('0x44')](_0x17cc('0x45'))){_0x5dd63c[_0x17cc('0x2d')]=qs['limit'](_0x41bda[_0x17cc('0x40')]['limit']);_0x5dd63c[_0x17cc('0x2b')]=qs['offset'](_0x41bda[_0x17cc('0x40')][_0x17cc('0x2b')]);}_0x5dd63c[_0x17cc('0x46')]=qs[_0x17cc('0x47')](_0x41bda[_0x17cc('0x40')][_0x17cc('0x47')]);_0x5dd63c[_0x17cc('0x48')]=qs['filters'](_[_0x17cc('0x49')](_0x41bda['query'],_0x1c376a[_0x17cc('0x4a')]),_0x501868);if(_0x41bda[_0x17cc('0x40')][_0x17cc('0x4b')]){_0x5dd63c['where']=_['merge'](_0x5dd63c[_0x17cc('0x48')],{'$or':_[_0x17cc('0x3a')](_0x501868,function(_0x19bc64){if(_0x19bc64[_0x17cc('0x3d')]!==_0x17cc('0x4c')){var _0x41c3ef={};_0x41c3ef[_0x19bc64['name']]={'$like':'%'+_0x41bda['query'][_0x17cc('0x4b')]+'%'};return _0x41c3ef;}})});}_0x5dd63c=_['merge']({},_0x5dd63c,_0x41bda['options']);var _0x39df4d={'where':_0x5dd63c[_0x17cc('0x48')]};return db['OpenchannelMessage'][_0x17cc('0x2e')](_0x39df4d)['then'](function(_0x14fe04){_0x245eec['count']=_0x14fe04;if(_0x41bda[_0x17cc('0x40')]['includeAll']){_0x5dd63c[_0x17cc('0x4d')]=[{'all':!![]}];}return db[_0x17cc('0x3b')]['findAll'](_0x5dd63c);})[_0x17cc('0x1f')](function(_0x405f90){_0x245eec[_0x17cc('0x4e')]=_0x405f90;return _0x245eec;})['then'](respondWithFilteredResult(_0x385bde,_0x5dd63c))['catch'](handleError(_0x385bde,null));};exports[_0x17cc('0x4f')]=function(_0x2b2c46,_0x56848f){var _0x5317bc={'raw':!![],'where':{'id':_0x2b2c46[_0x17cc('0x50')]['id']}},_0x292974={};_0x292974[_0x17cc('0x3f')]=_[_0x17cc('0x41')](db[_0x17cc('0x3b')][_0x17cc('0x51')]);_0x292974[_0x17cc('0x40')]=_[_0x17cc('0x41')](_0x2b2c46[_0x17cc('0x40')]);_0x292974['filters']=_[_0x17cc('0x52')](_0x292974[_0x17cc('0x3f')],_0x292974[_0x17cc('0x40')]);_0x5317bc[_0x17cc('0x42')]=_[_0x17cc('0x52')](_0x292974[_0x17cc('0x3f')],qs[_0x17cc('0x43')](_0x2b2c46[_0x17cc('0x40')][_0x17cc('0x43')]));_0x5317bc[_0x17cc('0x42')]=_0x5317bc[_0x17cc('0x42')][_0x17cc('0x53')]?_0x5317bc[_0x17cc('0x42')]:_0x292974[_0x17cc('0x3f')];if(_0x2b2c46['query'][_0x17cc('0x54')]){_0x5317bc[_0x17cc('0x4d')]=[{'all':!![]}];}_0x5317bc=_['merge']({},_0x5317bc,_0x2b2c46[_0x17cc('0x55')]);return db[_0x17cc('0x3b')]['find'](_0x5317bc)[_0x17cc('0x1f')](handleEntityNotFound(_0x56848f,null))['then'](respondWithResult(_0x56848f,null))[_0x17cc('0x56')](handleError(_0x56848f,null));};exports['create']=function(_0x4eb9be,_0x24123e){return db[_0x17cc('0x3b')][_0x17cc('0x57')](_0x4eb9be[_0x17cc('0x58')],{})['then'](respondWithResult(_0x24123e,0xc9))[_0x17cc('0x56')](handleError(_0x24123e,null));};exports[_0x17cc('0x34')]=function(_0x4a11d7,_0x387baa){if(_0x4a11d7[_0x17cc('0x58')]['id']){delete _0x4a11d7['body']['id'];}return db[_0x17cc('0x3b')]['find']({'where':{'id':_0x4a11d7[_0x17cc('0x50')]['id']}})[_0x17cc('0x1f')](handleEntityNotFound(_0x387baa,null))[_0x17cc('0x1f')](saveUpdates(_0x4a11d7[_0x17cc('0x58')],null))[_0x17cc('0x1f')](respondWithResult(_0x387baa,null))[_0x17cc('0x56')](handleError(_0x387baa,null));};exports[_0x17cc('0x35')]=function(_0x49fe19,_0x324e9f){return db[_0x17cc('0x3b')][_0x17cc('0x59')]({'where':{'id':_0x49fe19[_0x17cc('0x50')]['id']}})[_0x17cc('0x1f')](handleEntityNotFound(_0x324e9f,null))[_0x17cc('0x1f')](removeEntity(_0x324e9f,null))['catch'](handleError(_0x324e9f,null));};exports[_0x17cc('0x5a')]=function(_0x4f9ae7,_0x5f0843){return db[_0x17cc('0x3b')][_0x17cc('0x5a')]()[_0x17cc('0x1f')](respondWithResult(_0x5f0843,null))[_0x17cc('0x56')](handleError(_0x5f0843,null));};var interaction_log=require('../../config/logger')(_0x17cc('0x5b'));exports[_0x17cc('0x5c')]=function(_0x36efc1,_0x2316bd,_0x2a23e7){var _0x1b3a9c={'agent':{},'channel':_0x17cc('0x5d')};if(_0x36efc1[_0x17cc('0x58')]['id']){delete _0x36efc1[_0x17cc('0x58')]['id'];}_0x36efc1['body']['read']=!![];_0x36efc1[_0x17cc('0x58')][_0x17cc('0x5e')]=moment()['format'](_0x17cc('0x5f'));_0x36efc1[_0x17cc('0x58')][_0x17cc('0x60')]=_0x36efc1[_0x17cc('0x58')]['UserId']||_0x36efc1[_0x17cc('0x61')]['id'];_0x1b3a9c[_0x17cc('0x62')]['id']=_0x36efc1[_0x17cc('0x58')]['UserId'];return db[_0x17cc('0x3b')][_0x17cc('0x59')]({'where':{'id':_0x36efc1[_0x17cc('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2316bd,null))[_0x17cc('0x1f')](saveUpdates(_0x36efc1[_0x17cc('0x58')],null))[_0x17cc('0x1f')](function(_0x46a6f2){if(_0x46a6f2){_0x1b3a9c[_0x17cc('0x27')]=_0x46a6f2[_0x17cc('0x63')]({'plain':!![]});return db[_0x17cc('0x64')]['find']({'where':{'id':_0x46a6f2[_0x17cc('0x65')]}});}return null;})[_0x17cc('0x1f')](handleEntityNotFound(_0x2316bd,null))[_0x17cc('0x1f')](function(_0x2ee838){if(_0x2ee838){return _0x2ee838['update']({'UserId':_0x36efc1['body'][_0x17cc('0x60')],'read1stAt':_[_0x17cc('0x66')](_0x2ee838['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x17cc('0x1f')](function(_0x404244){if(_0x404244){_0x1b3a9c[_0x17cc('0x67')]=_0x404244['get']({'plain':!![]});interaction_log[_0x17cc('0x20')](_0x17cc('0x68'),_0x36efc1['user']['id'],_0x36efc1[_0x17cc('0x61')][_0x17cc('0x37')],_0x36efc1[_0x17cc('0x61')][_0x17cc('0x69')],_0x1b3a9c[_0x17cc('0x67')]['id'],_0x36efc1[_0x17cc('0x58')]?JSON['stringify'](_0x36efc1[_0x17cc('0x58')]):'null');return respondWithRpcPromise(_0x17cc('0x6a'),_0x17cc('0x6b'),_0x1b3a9c);}return null;})[_0x17cc('0x1f')](function(_0x564e19){var _0x44406d=_0x17cc('0x6c')+_0x564e19[_0x17cc('0x27')][_0x17cc('0x6d')];return db[_0x17cc('0x6e')]['query'](_0x44406d,{'type':db[_0x17cc('0x6f')][_0x17cc('0x70')][_0x17cc('0x71')],'raw':!![]})[_0x17cc('0x1f')](function(_0x11c6bd){return _0x11c6bd;});})[_0x17cc('0x1f')](function(_0x5d40b0){if(_0x5d40b0){_0x1b3a9c[_0x17cc('0x27')][_0x17cc('0x72')]=_0x5d40b0[0x0];if(!_0x36efc1[_0x17cc('0x58')][_0x17cc('0x60')])return;return db[_0x17cc('0x73')]['find']({'where':{'id':_0x36efc1[_0x17cc('0x58')][_0x17cc('0x60')],'role':_0x17cc('0x62')},'attributes':['id',_0x17cc('0x37'),_0x17cc('0x74'),_0x17cc('0x75'),_0x17cc('0x76')],'raw':!![]});}return null;})['then'](function(_0xfb16df){if(!_0xfb16df)return null;_0x1b3a9c[_0x17cc('0x27')]['agent']=_0xfb16df;return _0x1b3a9c;})[_0x17cc('0x1f')](function(_0x4e0b83){if(_0x4e0b83){if(_0x36efc1[_0x17cc('0x58')][_0x17cc('0x77')]){_0x1b3a9c[_0x17cc('0x27')]['interface']=util[_0x17cc('0x78')](_0x17cc('0x79'),_0x36efc1[_0x17cc('0x61')][_0x17cc('0x37')]);_0x1b3a9c['message'][_0x17cc('0x7a')]=_0x1b3a9c[_0x17cc('0x7a')];_0x1b3a9c[_0x17cc('0x27')]['event']=_0x17cc('0x5c');return respondWithRpcPromise(_0x17cc('0x7b'),_0x17cc('0x7b'),{'event':_0x17cc('0x7c'),'message':_0x1b3a9c['message']},client9002)['then'](function(){return _0x1b3a9c;});}return _0x1b3a9c;}return null;})[_0x17cc('0x1f')](respondWithResult(_0x2316bd,null))['catch'](handleError(_0x2316bd,null));};var interaction_log=require('../../config/logger')(_0x17cc('0x5b'));exports[_0x17cc('0x32')]=function(_0xccb103,_0x35c174,_0x597388){var _0x24dafb={'agent':{},'channel':_0x17cc('0x5d')};if(_0xccb103[_0x17cc('0x58')]['id']){delete _0xccb103[_0x17cc('0x58')]['id'];}_0xccb103[_0x17cc('0x58')][_0x17cc('0x60')]=_0xccb103[_0x17cc('0x58')][_0x17cc('0x60')]||_0xccb103[_0x17cc('0x61')]['id'];_0x24dafb[_0x17cc('0x62')]['id']=_0xccb103[_0x17cc('0x58')][_0x17cc('0x60')];return db[_0x17cc('0x3b')][_0x17cc('0x59')]({'where':{'id':_0xccb103[_0x17cc('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x35c174,null))['then'](function(_0x50afd9){if(_0x50afd9){_0x24dafb[_0x17cc('0x27')]=_0x50afd9['get']({'plain':!![]});return db[_0x17cc('0x64')][_0x17cc('0x59')]({'where':{'id':_0x50afd9[_0x17cc('0x65')]}});}return null;})[_0x17cc('0x1f')](handleEntityNotFound(_0x35c174,null))['then'](function(_0x16cc87){if(_0x16cc87){_0x24dafb[_0x17cc('0x67')]=_0x16cc87[_0x17cc('0x63')]({'plain':!![]});interaction_log[_0x17cc('0x20')](_0x17cc('0x7d'),_0xccb103[_0x17cc('0x61')]['id'],_0xccb103['user'][_0x17cc('0x37')],_0xccb103[_0x17cc('0x61')][_0x17cc('0x69')],_0x24dafb[_0x17cc('0x67')]['id'],_0xccb103[_0x17cc('0x58')]?JSON[_0x17cc('0x24')](_0xccb103[_0x17cc('0x58')]):'null');return respondWithRpcPromise(_0x17cc('0x7e'),_0x17cc('0x7f'),_0x24dafb);}return null;})['then'](function(_0x2be8ea){var _0x3c7908=_0x17cc('0x6c')+_0x2be8ea[_0x17cc('0x27')][_0x17cc('0x6d')];return db[_0x17cc('0x6e')][_0x17cc('0x40')](_0x3c7908,{'type':db[_0x17cc('0x6f')][_0x17cc('0x70')]['SELECT'],'raw':!![]})['then'](function(_0x1d5780){return _0x1d5780;});})[_0x17cc('0x1f')](function(_0x350fb7){if(_0x350fb7){_0x24dafb['message'][_0x17cc('0x72')]=_0x350fb7[0x0];if(!_0xccb103[_0x17cc('0x58')][_0x17cc('0x60')])return;return db['User'][_0x17cc('0x59')]({'where':{'id':_0xccb103[_0x17cc('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0x17cc('0x37'),'fullname',_0x17cc('0x75'),_0x17cc('0x76')],'raw':!![]});}return null;})[_0x17cc('0x1f')](function(_0x334153){if(!_0x334153)return null;_0x24dafb[_0x17cc('0x27')][_0x17cc('0x62')]=_0x334153;return _0x24dafb;})[_0x17cc('0x1f')](function(_0x9cd4f1){if(_0x9cd4f1){_0x9cd4f1[_0x17cc('0x27')]['interface']=util[_0x17cc('0x78')]('SIP/%s',_0xccb103['user'][_0x17cc('0x37')]);_0x9cd4f1[_0x17cc('0x27')][_0x17cc('0x7a')]=_0x24dafb[_0x17cc('0x7a')];_0x9cd4f1[_0x17cc('0x27')]['event']=_0x17cc('0x32');respondWithRpcPromise(_0x17cc('0x7b'),'EventManager',{'event':_0x17cc('0x80'),'message':_0x9cd4f1['message']},client9002);return _0x24dafb;}return null;})[_0x17cc('0x1f')](respondWithResult(_0x35c174,null))['catch'](handleError(_0x35c174,null));}; \ No newline at end of file +var _0x4744=['key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','OpenchannelMessage','include','findAll','rows','show','params','keys','includeAll','find','create','body','describe','openchannel-interactions','accept','read','readAt','format','UserId','user','agent','OpenchannelInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','event','EventManager','acceptmessage','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','User','channel','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','request','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','info','request\x20sent','result','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type'];(function(_0x186cc7,_0x2e7299){var _0x29664c=function(_0x55a224){while(--_0x55a224){_0x186cc7['push'](_0x186cc7['shift']());}};_0x29664c(++_0x2e7299);}(_0x4744,0x152));var _0x4474=function(_0x2b1fab,_0x280ba9){_0x2b1fab=_0x2b1fab-0x0;var _0x931537=_0x4744[_0x2b1fab];return _0x931537;};'use strict';var emlformat=require(_0x4474('0x0'));var rimraf=require(_0x4474('0x1'));var zipdir=require(_0x4474('0x2'));var jsonpatch=require(_0x4474('0x3'));var rp=require(_0x4474('0x4'));var moment=require(_0x4474('0x5'));var BPromise=require(_0x4474('0x6'));var Mustache=require('mustache');var util=require(_0x4474('0x7'));var path=require(_0x4474('0x8'));var sox=require(_0x4474('0x9'));var csv=require(_0x4474('0xa'));var ejs=require(_0x4474('0xb'));var fs=require('fs');var fs_extra=require(_0x4474('0xc'));var _=require(_0x4474('0xd'));var squel=require(_0x4474('0xe'));var crypto=require('crypto');var jsforce=require(_0x4474('0xf'));var deskjs=require(_0x4474('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4474('0x11'));var Papa=require(_0x4474('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4474('0x13'));var hardwareService=require(_0x4474('0x14'));var logger=require(_0x4474('0x15'))('api');var utils=require(_0x4474('0x16'));var config=require(_0x4474('0x17'));var licenseUtil=require(_0x4474('0x18'));var db=require(_0x4474('0x19'))['db'];config['redis']=_['defaults'](config[_0x4474('0x1a')],{'host':_0x4474('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4474('0x1c'))[_0x4474('0x1d')](socket);var jayson=require(_0x4474('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x4474('0x1f')][_0x4474('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3025b8,_0x52b4ea,_0x35b8fc,_0x37f0d9){return new BPromise(function(_0x2ad527,_0x1a9761){var _0x3e060d=_0x37f0d9||client;return _0x3e060d[_0x4474('0x21')](_0x3025b8,_0x35b8fc)['then'](function(_0xc90508){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x52b4ea,'request\x20sent');logger[_0x4474('0x22')](_0x4474('0x23'),_0x52b4ea,'request\x20sent',JSON[_0x4474('0x24')](_0xc90508));if(_0xc90508[_0x4474('0x25')]){if(_0xc90508[_0x4474('0x25')]['code']===0x1f4){logger['error'](_0x4474('0x26'),_0x52b4ea,_0xc90508[_0x4474('0x25')][_0x4474('0x27')]);return _0x1a9761(_0xc90508[_0x4474('0x25')]['message']);}logger[_0x4474('0x25')](_0x4474('0x26'),_0x52b4ea,_0xc90508[_0x4474('0x25')][_0x4474('0x27')]);return _0x2ad527(_0xc90508[_0x4474('0x25')][_0x4474('0x27')]);}else{logger[_0x4474('0x28')](_0x4474('0x26'),_0x52b4ea,_0x4474('0x29'));_0x2ad527(_0xc90508[_0x4474('0x2a')][_0x4474('0x27')]);}})[_0x4474('0x2b')](function(_0x415ed5){logger[_0x4474('0x25')](_0x4474('0x26'),_0x52b4ea,_0x415ed5);_0x1a9761(_0x415ed5);});});}function respondWithStatusCode(_0xb75de4,_0x2dbed9){_0x2dbed9=_0x2dbed9||0xcc;return function(_0x2b597e){if(_0x2b597e){return _0xb75de4[_0x4474('0x2c')](_0x2dbed9);}return _0xb75de4[_0x4474('0x2d')](_0x2dbed9)[_0x4474('0x2e')]();};}function respondWithResult(_0xf98a21,_0x34aefe){_0x34aefe=_0x34aefe||0xc8;return function(_0x34b959){if(_0x34b959){return _0xf98a21['status'](_0x34aefe)[_0x4474('0x2f')](_0x34b959);}};}function respondWithFilteredResult(_0xc9aec5,_0x1ff79b){return function(_0x1870e6){if(_0x1870e6){var _0x31803c=typeof _0x1ff79b['offset']===_0x4474('0x30')&&typeof _0x1ff79b[_0x4474('0x31')]===_0x4474('0x30');var _0x388a9e=_0x1870e6['count'];var _0x47d4e9=_0x31803c?0x0:_0x1ff79b[_0x4474('0x32')];var _0x27c295=_0x31803c?_0x1870e6[_0x4474('0x33')]:_0x1ff79b[_0x4474('0x32')]+_0x1ff79b[_0x4474('0x31')];var _0x4061a1;if(_0x27c295>=_0x388a9e){_0x27c295=_0x388a9e;_0x4061a1=0xc8;}else{_0x4061a1=0xce;}_0xc9aec5[_0x4474('0x2d')](_0x4061a1);return _0xc9aec5[_0x4474('0x34')](_0x4474('0x35'),_0x47d4e9+'-'+_0x27c295+'/'+_0x388a9e)[_0x4474('0x2f')](_0x1870e6);}return null;};}function patchUpdates(_0x3b993c){return function(_0x34a98d){try{jsonpatch[_0x4474('0x36')](_0x34a98d,_0x3b993c,!![]);}catch(_0x185bc9){return BPromise[_0x4474('0x37')](_0x185bc9);}return _0x34a98d[_0x4474('0x38')]();};}function saveUpdates(_0x3f6f74,_0x102374){return function(_0x4723fb){if(_0x4723fb){return _0x4723fb[_0x4474('0x39')](_0x3f6f74)[_0x4474('0x3a')](function(_0x3e9036){return _0x3e9036;});}return null;};}function removeEntity(_0x36da10,_0x53fcc8){return function(_0x54e42a){if(_0x54e42a){return _0x54e42a[_0x4474('0x3b')]()[_0x4474('0x3a')](function(){_0x36da10[_0x4474('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3097a7,_0x34ce50){return function(_0x251467){if(!_0x251467){_0x3097a7['sendStatus'](0x194);}return _0x251467;};}function handleError(_0x2975bb,_0x19da4c){_0x19da4c=_0x19da4c||0x1f4;return function(_0x2ed0fa){logger['error'](_0x2ed0fa[_0x4474('0x3c')]);if(_0x2ed0fa[_0x4474('0x3d')]){delete _0x2ed0fa['name'];}_0x2975bb[_0x4474('0x2d')](_0x19da4c)['send'](_0x2ed0fa);};}exports[_0x4474('0x3e')]=function(_0x15b1b5,_0xa03f42){var _0x4cb608={},_0x44f783={},_0x507f6a={'count':0x0,'rows':[]};var _0x2a111d=_[_0x4474('0x3f')](db['OpenchannelMessage'][_0x4474('0x40')],function(_0x3b9849){return{'name':_0x3b9849[_0x4474('0x41')],'type':_0x3b9849[_0x4474('0x42')][_0x4474('0x43')]};});_0x44f783[_0x4474('0x44')]=_['map'](_0x2a111d,'name');_0x44f783['query']=_['keys'](_0x15b1b5['query']);_0x44f783[_0x4474('0x45')]=_[_0x4474('0x46')](_0x44f783[_0x4474('0x44')],_0x44f783[_0x4474('0x47')]);_0x4cb608[_0x4474('0x48')]=_[_0x4474('0x46')](_0x44f783[_0x4474('0x44')],qs[_0x4474('0x49')](_0x15b1b5['query'][_0x4474('0x49')]));_0x4cb608['attributes']=_0x4cb608[_0x4474('0x48')][_0x4474('0x4a')]?_0x4cb608[_0x4474('0x48')]:_0x44f783[_0x4474('0x44')];if(!_0x15b1b5[_0x4474('0x47')][_0x4474('0x4b')]('nolimit')){_0x4cb608['limit']=qs['limit'](_0x15b1b5[_0x4474('0x47')][_0x4474('0x31')]);_0x4cb608[_0x4474('0x32')]=qs[_0x4474('0x32')](_0x15b1b5[_0x4474('0x47')][_0x4474('0x32')]);}_0x4cb608['order']=qs['sort'](_0x15b1b5[_0x4474('0x47')][_0x4474('0x4c')]);_0x4cb608['where']=qs[_0x4474('0x45')](_[_0x4474('0x4d')](_0x15b1b5[_0x4474('0x47')],_0x44f783['filters']),_0x2a111d);if(_0x15b1b5[_0x4474('0x47')][_0x4474('0x4e')]){_0x4cb608[_0x4474('0x4f')]=_[_0x4474('0x50')](_0x4cb608['where'],{'$or':_['map'](_0x2a111d,function(_0x18af84){if(_0x18af84['type']!==_0x4474('0x51')){var _0x5dd044={};_0x5dd044[_0x18af84[_0x4474('0x3d')]]={'$like':'%'+_0x15b1b5['query']['filter']+'%'};return _0x5dd044;}})});}_0x4cb608=_['merge']({},_0x4cb608,_0x15b1b5[_0x4474('0x52')]);var _0x6fd3ce={'where':_0x4cb608[_0x4474('0x4f')]};return db[_0x4474('0x53')][_0x4474('0x33')](_0x6fd3ce)['then'](function(_0x5096e5){_0x507f6a[_0x4474('0x33')]=_0x5096e5;if(_0x15b1b5[_0x4474('0x47')]['includeAll']){_0x4cb608[_0x4474('0x54')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x4474('0x55')](_0x4cb608);})['then'](function(_0xe15a24){_0x507f6a[_0x4474('0x56')]=_0xe15a24;return _0x507f6a;})['then'](respondWithFilteredResult(_0xa03f42,_0x4cb608))[_0x4474('0x2b')](handleError(_0xa03f42,null));};exports[_0x4474('0x57')]=function(_0x7459a,_0x11903b){var _0x54ad80={'raw':!![],'where':{'id':_0x7459a[_0x4474('0x58')]['id']}},_0x1c9eeb={};_0x1c9eeb[_0x4474('0x44')]=_[_0x4474('0x59')](db[_0x4474('0x53')][_0x4474('0x40')]);_0x1c9eeb[_0x4474('0x47')]=_['keys'](_0x7459a[_0x4474('0x47')]);_0x1c9eeb['filters']=_['intersection'](_0x1c9eeb['model'],_0x1c9eeb[_0x4474('0x47')]);_0x54ad80[_0x4474('0x48')]=_[_0x4474('0x46')](_0x1c9eeb[_0x4474('0x44')],qs['fields'](_0x7459a[_0x4474('0x47')][_0x4474('0x49')]));_0x54ad80[_0x4474('0x48')]=_0x54ad80[_0x4474('0x48')][_0x4474('0x4a')]?_0x54ad80[_0x4474('0x48')]:_0x1c9eeb[_0x4474('0x44')];if(_0x7459a['query'][_0x4474('0x5a')]){_0x54ad80[_0x4474('0x54')]=[{'all':!![]}];}_0x54ad80=_[_0x4474('0x50')]({},_0x54ad80,_0x7459a['options']);return db[_0x4474('0x53')][_0x4474('0x5b')](_0x54ad80)[_0x4474('0x3a')](handleEntityNotFound(_0x11903b,null))[_0x4474('0x3a')](respondWithResult(_0x11903b,null))[_0x4474('0x2b')](handleError(_0x11903b,null));};exports[_0x4474('0x5c')]=function(_0x21e47f,_0x531271){return db[_0x4474('0x53')][_0x4474('0x5c')](_0x21e47f['body'],{})[_0x4474('0x3a')](respondWithResult(_0x531271,0xc9))[_0x4474('0x2b')](handleError(_0x531271,null));};exports[_0x4474('0x39')]=function(_0x434e3d,_0x56a70d){if(_0x434e3d[_0x4474('0x5d')]['id']){delete _0x434e3d[_0x4474('0x5d')]['id'];}return db['OpenchannelMessage'][_0x4474('0x5b')]({'where':{'id':_0x434e3d[_0x4474('0x58')]['id']}})[_0x4474('0x3a')](handleEntityNotFound(_0x56a70d,null))[_0x4474('0x3a')](saveUpdates(_0x434e3d[_0x4474('0x5d')],null))['then'](respondWithResult(_0x56a70d,null))[_0x4474('0x2b')](handleError(_0x56a70d,null));};exports[_0x4474('0x3b')]=function(_0x1d296f,_0x23df74){return db[_0x4474('0x53')][_0x4474('0x5b')]({'where':{'id':_0x1d296f[_0x4474('0x58')]['id']}})[_0x4474('0x3a')](handleEntityNotFound(_0x23df74,null))[_0x4474('0x3a')](removeEntity(_0x23df74,null))[_0x4474('0x2b')](handleError(_0x23df74,null));};exports[_0x4474('0x5e')]=function(_0x46ad6d,_0x161b02){return db[_0x4474('0x53')]['describe']()[_0x4474('0x3a')](respondWithResult(_0x161b02,null))[_0x4474('0x2b')](handleError(_0x161b02,null));};var interaction_log=require(_0x4474('0x15'))(_0x4474('0x5f'));exports[_0x4474('0x60')]=function(_0x4e3ee3,_0x1f668f,_0x7b978){var _0x212632={'agent':{},'channel':'openchannel'};if(_0x4e3ee3[_0x4474('0x5d')]['id']){delete _0x4e3ee3['body']['id'];}_0x4e3ee3[_0x4474('0x5d')][_0x4474('0x61')]=!![];_0x4e3ee3[_0x4474('0x5d')][_0x4474('0x62')]=moment()[_0x4474('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e3ee3['body']['UserId']=_0x4e3ee3[_0x4474('0x5d')][_0x4474('0x64')]||_0x4e3ee3[_0x4474('0x65')]['id'];_0x212632[_0x4474('0x66')]['id']=_0x4e3ee3['body']['UserId'];return db['OpenchannelMessage'][_0x4474('0x5b')]({'where':{'id':_0x4e3ee3[_0x4474('0x58')]['id'],'UserId':null}})[_0x4474('0x3a')](handleEntityNotFound(_0x1f668f,null))['then'](saveUpdates(_0x4e3ee3[_0x4474('0x5d')],null))[_0x4474('0x3a')](function(_0x3d44ee){if(_0x3d44ee){_0x212632[_0x4474('0x27')]=_0x3d44ee['get']({'plain':!![]});return db[_0x4474('0x67')][_0x4474('0x5b')]({'where':{'id':_0x3d44ee['OpenchannelInteractionId']}});}return null;})[_0x4474('0x3a')](handleEntityNotFound(_0x1f668f,null))[_0x4474('0x3a')](function(_0x4b4280){if(_0x4b4280){return _0x4b4280[_0x4474('0x39')]({'UserId':_0x4e3ee3['body'][_0x4474('0x64')],'read1stAt':_['isNil'](_0x4b4280[_0x4474('0x68')])?moment()['format'](_0x4474('0x69')):undefined});}return null;})[_0x4474('0x3a')](function(_0x3d8c1e){if(_0x3d8c1e){_0x212632[_0x4474('0x6a')]=_0x3d8c1e[_0x4474('0x6b')]({'plain':!![]});interaction_log[_0x4474('0x28')](_0x4474('0x6c'),_0x4e3ee3[_0x4474('0x65')]['id'],_0x4e3ee3[_0x4474('0x65')]['name'],_0x4e3ee3[_0x4474('0x65')][_0x4474('0x6d')],_0x212632['interaction']['id'],_0x4e3ee3[_0x4474('0x5d')]?JSON[_0x4474('0x24')](_0x4e3ee3[_0x4474('0x5d')]):_0x4474('0x6e'));return respondWithRpcPromise('AcceptMessage',_0x4474('0x6f'),_0x212632);}return null;})[_0x4474('0x3a')](function(_0x1f0327){var _0x505419=_0x4474('0x70')+_0x1f0327[_0x4474('0x27')][_0x4474('0x71')];return db['sequelize'][_0x4474('0x47')](_0x505419,{'type':db[_0x4474('0x72')][_0x4474('0x73')][_0x4474('0x74')],'raw':!![]})[_0x4474('0x3a')](function(_0x50824c){return _0x50824c;});})['then'](function(_0x154395){if(_0x154395){_0x212632[_0x4474('0x27')][_0x4474('0x75')]=_0x154395[0x0];if(!_0x4e3ee3[_0x4474('0x5d')][_0x4474('0x64')])return;return db['User'][_0x4474('0x5b')]({'where':{'id':_0x4e3ee3['body'][_0x4474('0x64')],'role':_0x4474('0x66')},'attributes':['id','name',_0x4474('0x76'),_0x4474('0x77'),_0x4474('0x78')],'raw':!![]});}return null;})[_0x4474('0x3a')](function(_0x612b65){if(!_0x612b65)return null;_0x212632[_0x4474('0x27')][_0x4474('0x66')]=_0x612b65;return _0x212632;})['then'](function(_0x4aad5c){if(_0x4aad5c){if(_0x4e3ee3[_0x4474('0x5d')][_0x4474('0x79')]){_0x212632['message'][_0x4474('0x7a')]=util['format'](_0x4474('0x7b'),_0x4e3ee3[_0x4474('0x65')][_0x4474('0x3d')]);_0x212632[_0x4474('0x27')]['channel']=_0x212632['channel'];_0x212632[_0x4474('0x27')][_0x4474('0x7c')]='accept';return respondWithRpcPromise(_0x4474('0x7d'),_0x4474('0x7d'),{'event':_0x4474('0x7e'),'message':_0x212632[_0x4474('0x27')]},client9002)[_0x4474('0x3a')](function(){return _0x212632;});}return _0x212632;}return null;})[_0x4474('0x3a')](respondWithResult(_0x1f668f,null))[_0x4474('0x2b')](handleError(_0x1f668f,null));};var interaction_log=require(_0x4474('0x15'))('openchannel-interactions');exports[_0x4474('0x37')]=function(_0x2df656,_0x1918f3,_0x2e5243){var _0x199890={'agent':{},'channel':'openchannel'};if(_0x2df656[_0x4474('0x5d')]['id']){delete _0x2df656[_0x4474('0x5d')]['id'];}_0x2df656['body'][_0x4474('0x64')]=_0x2df656[_0x4474('0x5d')][_0x4474('0x64')]||_0x2df656[_0x4474('0x65')]['id'];_0x199890[_0x4474('0x66')]['id']=_0x2df656[_0x4474('0x5d')]['UserId'];return db[_0x4474('0x53')][_0x4474('0x5b')]({'where':{'id':_0x2df656[_0x4474('0x58')]['id'],'UserId':null}})[_0x4474('0x3a')](handleEntityNotFound(_0x1918f3,null))[_0x4474('0x3a')](function(_0x3d5cf7){if(_0x3d5cf7){_0x199890['message']=_0x3d5cf7[_0x4474('0x6b')]({'plain':!![]});return db[_0x4474('0x67')][_0x4474('0x5b')]({'where':{'id':_0x3d5cf7[_0x4474('0x7f')]}});}return null;})[_0x4474('0x3a')](handleEntityNotFound(_0x1918f3,null))[_0x4474('0x3a')](function(_0x2b35b0){if(_0x2b35b0){_0x199890['interaction']=_0x2b35b0[_0x4474('0x6b')]({'plain':!![]});interaction_log[_0x4474('0x28')](_0x4474('0x80'),_0x2df656[_0x4474('0x65')]['id'],_0x2df656['user']['name'],_0x2df656[_0x4474('0x65')][_0x4474('0x6d')],_0x199890[_0x4474('0x6a')]['id'],_0x2df656['body']?JSON[_0x4474('0x24')](_0x2df656[_0x4474('0x5d')]):_0x4474('0x6e'));return respondWithRpcPromise(_0x4474('0x81'),_0x4474('0x82'),_0x199890);}return null;})['then'](function(_0x23fa0f){var _0x51b617=_0x4474('0x70')+_0x23fa0f['message']['ContactId'];return db[_0x4474('0x83')][_0x4474('0x47')](_0x51b617,{'type':db[_0x4474('0x72')][_0x4474('0x73')][_0x4474('0x74')],'raw':!![]})[_0x4474('0x3a')](function(_0x122c8d){return _0x122c8d;});})['then'](function(_0x411e18){if(_0x411e18){_0x199890[_0x4474('0x27')][_0x4474('0x75')]=_0x411e18[0x0];if(!_0x2df656[_0x4474('0x5d')][_0x4474('0x64')])return;return db[_0x4474('0x84')][_0x4474('0x5b')]({'where':{'id':_0x2df656[_0x4474('0x5d')]['UserId'],'role':_0x4474('0x66')},'attributes':['id',_0x4474('0x3d'),_0x4474('0x76'),_0x4474('0x77'),_0x4474('0x78')],'raw':!![]});}return null;})[_0x4474('0x3a')](function(_0x8c618e){if(!_0x8c618e)return null;_0x199890[_0x4474('0x27')][_0x4474('0x66')]=_0x8c618e;return _0x199890;})[_0x4474('0x3a')](function(_0x351e2a){if(_0x351e2a){_0x351e2a[_0x4474('0x27')][_0x4474('0x7a')]=util[_0x4474('0x63')]('SIP/%s',_0x2df656[_0x4474('0x65')][_0x4474('0x3d')]);_0x351e2a[_0x4474('0x27')][_0x4474('0x85')]=_0x199890[_0x4474('0x85')];_0x351e2a[_0x4474('0x27')][_0x4474('0x7c')]=_0x4474('0x37');respondWithRpcPromise('EventManager',_0x4474('0x7d'),{'event':_0x4474('0x86'),'message':_0x351e2a[_0x4474('0x27')]},client9002);return _0x199890;}return null;})[_0x4474('0x3a')](respondWithResult(_0x1918f3,null))[_0x4474('0x2b')](handleError(_0x1918f3,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 3d6cb95..7830799 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 _0x921c=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x921c,0x19e));var _0xc921=function(_0x48d41e,_0x29ff12){_0x48d41e=_0x48d41e-0x0;var _0x5bbf4f=_0x921c[_0x48d41e];return _0x5bbf4f;};'use strict';var EventEmitter=require(_0xc921('0x0'));var OpenchannelMessage=require(_0xc921('0x1'))['db'][_0xc921('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc921('0x3')](0x0);var events={'afterCreate':_0xc921('0x4'),'afterUpdate':'update','afterDestroy':_0xc921('0x5')};function emitEvent(_0x5afd10){return function(_0xadba28,_0x3d4c36,_0x19714e){OpenchannelMessageEvents['emit'](_0x5afd10+':'+_0xadba28['id'],_0xadba28);OpenchannelMessageEvents[_0xc921('0x6')](_0x5afd10,_0xadba28);_0x19714e(null);};}for(var e in events){if(events[_0xc921('0x7')](e)){var event=events[e];OpenchannelMessage[_0xc921('0x8')](e,emitEvent(event));}}module[_0xc921('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xd81e=['save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x266f4e,_0x86e551){var _0x4b9a5e=function(_0xe15eca){while(--_0xe15eca){_0x266f4e['push'](_0x266f4e['shift']());}};_0x4b9a5e(++_0x86e551);}(_0xd81e,0xf0));var _0xed81=function(_0x2dfa73,_0x32395f){_0x2dfa73=_0x2dfa73-0x0;var _0x5f3efd=_0xd81e[_0x2dfa73];return _0x5f3efd;};'use strict';var EventEmitter=require(_0xed81('0x0'));var OpenchannelMessage=require(_0xed81('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xed81('0x2')](0x0);var events={'afterCreate':_0xed81('0x3'),'afterUpdate':_0xed81('0x4'),'afterDestroy':_0xed81('0x5')};function emitEvent(_0x245a2e){return function(_0x2c6a09,_0x444247,_0x56a582){OpenchannelMessageEvents['emit'](_0x245a2e+':'+_0x2c6a09['id'],_0x2c6a09);OpenchannelMessageEvents['emit'](_0x245a2e,_0x2c6a09);_0x56a582(null);};}for(var e in events){if(events[_0xed81('0x6')](e)){var event=events[e];OpenchannelMessage[_0xed81('0x7')](e,emitEvent(event));}}module[_0xed81('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 4dbe23f..0a5bf68 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 _0x8952=['POST','GET','threadId','inspect','finally','utf8mb4','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','toLowerCase','direction','secret','isNil','OpenchannelInteraction','findOne','update','catch','error','out','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','omit','Contact'];(function(_0x422edf,_0x36c7c4){var _0x54f733=function(_0x8f6213){while(--_0x8f6213){_0x422edf['push'](_0x422edf['shift']());}};_0x54f733(++_0x36c7c4);}(_0x8952,0x17e));var _0x2895=function(_0x210dc0,_0x5b7f5f){_0x210dc0=_0x210dc0-0x0;var _0x24562e=_0x8952[_0x210dc0];return _0x24562e;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var logger=require(_0x2895('0x1'))(_0x2895('0x2'));var moment=require(_0x2895('0x3'));var BPromise=require(_0x2895('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2895('0x5'));var rimraf=require(_0x2895('0x6'));var config=require(_0x2895('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x2895('0x8')]=function(_0x73c245,_0x37305b){return _0x73c245['define']('OpenchannelMessage',attributes,{'tableName':_0x2895('0x9'),'paranoid':![],'indexes':[{'name':_0x2895('0xa'),'fields':[_0x2895('0xb')],'type':_0x2895('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x384cc6,_0x4952fa,_0x14fb67){var _0x5f2632=_0x73c245[_0x2895('0xd')];var _0x5af454=_0x384cc6['get']({'plain':!![]});if(_0x5af454['direction'][_0x2895('0xe')]()==='in'||_0x5af454[_0x2895('0xf')][_0x2895('0xe')]()==='out'&&!_0x5af454[_0x2895('0x10')]&&!_[_0x2895('0x11')](_0x5af454['UserId'])){_0x5f2632[_0x2895('0x12')][_0x2895('0x13')]({'where':{'id':_0x5af454['OpenchannelInteractionId']}})['then'](function(_0x1d1493){if(_0x1d1493){_0x1d1493[_0x2895('0x14')]({'lastMsgAt':_0x5af454['createdAt'],'lastMsgDirection':_0x5af454[_0x2895('0xf')][_0x2895('0xe')]()});}})[_0x2895('0x15')](function(_0x1ae013){console[_0x2895('0x16')](_0x1ae013);});}if(_0x5af454[_0x2895('0xf')]===_0x2895('0x17')&&!_0x5af454[_0x2895('0x10')]){var _0x3e96d7;_0x5f2632[_0x2895('0x18')][_0x2895('0x19')]()[_0x2895('0x1a')](function(_0xbf8b63){return _0x5f2632[_0x2895('0x1b')][_0x2895('0x1c')]({'where':{'id':_0x5af454[_0x2895('0x1d')]},'include':[{'model':_0x5f2632[_0x2895('0x12')],'as':_0x2895('0x1e'),'where':{'id':_0x5af454['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x5f2632['CmContact'],'as':'Contact','attributes':_[_0x2895('0x1f')](_0xbf8b63)}]}]});})[_0x2895('0x1a')](function(_0x3ec4da){_0x3e96d7=_0x3ec4da['get']({'plain':!![]});if(_0x3e96d7&&_0x3e96d7[_0x2895('0x20')]){logger[_0x2895('0x21')](_0x2895('0x22'),_0x2895('0x23'),util[_0x2895('0x24')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x5af454['id'],_0x3e96d7[_0x2895('0x20')]));if(_0x3e96d7[_0x2895('0x1e')]&&_0x3e96d7['Interactions'][_0x2895('0x25')]){_0x5af454[_0x2895('0x26')]=_[_0x2895('0x27')](_0x3e96d7['Interactions'][0x0],'Contact');_0x5af454[_0x2895('0x28')]=_0x3e96d7[_0x2895('0x1e')][0x0][_0x2895('0x28')];}var _0x4952fa={'method':_0x2895('0x29'),'uri':encodeURI(_0x3e96d7[_0x2895('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4952fa['method']){case _0x2895('0x2a'):_0x4952fa['qs']=_0x5af454;break;case _0x2895('0x29'):_0x4952fa[_0x2895('0xb')]=_0x5af454;break;}return rp(_0x4952fa)['then'](function(_0x320661){logger[_0x2895('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x2895('0x23'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x5af454['id'],_0x3e96d7[_0x2895('0x20')]));if(_0x320661['body'][_0x2895('0x2b')]&&_0x320661[_0x2895('0xb')]['threadId']!=_0x5af454['Interaction'][_0x2895('0x2b')]){return _0x5f2632[_0x2895('0x12')][_0x2895('0x14')]({'threadId':_0x320661[_0x2895('0xb')][_0x2895('0x2b')]},{'logging':!![],'where':{'id':_0x5af454[_0x2895('0x26')]['id']}});}else{return;}})[_0x2895('0x1a')](function(){return _0x384cc6['update']({'read':!![]});})[_0x2895('0x15')](function(_0xd45db5){logger[_0x2895('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x2895('0x23'),util[_0x2895('0x2c')](_0xd45db5,{'showHidden':![],'depth':null}));_0x14fb67();});}else{_0x14fb67();}})[_0x2895('0x2d')](function(){_0x14fb67();});}else{_0x14fb67();}}},'charset':_0x2895('0x2e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2032=['body','models','direction','out','secret','then','createdAt','toLowerCase','catch','error','describe','OpenchannelAccount','find','OpenchannelInteraction','OpenchannelInteractionId','CmContact','Contact','keys','replyUri','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','omit','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages'];(function(_0x5cdb7c,_0x4cdcd8){var _0x3efa6d=function(_0x471cb5){while(--_0x471cb5){_0x5cdb7c['push'](_0x5cdb7c['shift']());}};_0x3efa6d(++_0x4cdcd8);}(_0x2032,0xd9));var _0x2203=function(_0x373619,_0x47440e){_0x373619=_0x373619-0x0;var _0x32bde5=_0x2032[_0x373619];return _0x32bde5;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[{'name':_0x2203('0xc'),'fields':[_0x2203('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x526ae0,_0x10f055,_0x549908){var _0x27081c=_0x3f7ba1[_0x2203('0xe')];var _0x6339c4=_0x526ae0['get']({'plain':!![]});if(_0x6339c4[_0x2203('0xf')]['toLowerCase']()==='in'||_0x6339c4[_0x2203('0xf')]['toLowerCase']()===_0x2203('0x10')&&!_0x6339c4[_0x2203('0x11')]&&!_['isNil'](_0x6339c4['UserId'])){_0x27081c['OpenchannelInteraction']['findOne']({'where':{'id':_0x6339c4['OpenchannelInteractionId']}})[_0x2203('0x12')](function(_0x538b30){if(_0x538b30){_0x538b30['update']({'lastMsgAt':_0x6339c4[_0x2203('0x13')],'lastMsgDirection':_0x6339c4[_0x2203('0xf')][_0x2203('0x14')]()});}})[_0x2203('0x15')](function(_0x226209){console[_0x2203('0x16')](_0x226209);});}if(_0x6339c4[_0x2203('0xf')]===_0x2203('0x10')&&!_0x6339c4[_0x2203('0x11')]){var _0x3053f3;_0x27081c['CmContact'][_0x2203('0x17')]()[_0x2203('0x12')](function(_0x4893ff){return _0x27081c[_0x2203('0x18')][_0x2203('0x19')]({'where':{'id':_0x6339c4['OpenchannelAccountId']},'include':[{'model':_0x27081c[_0x2203('0x1a')],'as':'Interactions','where':{'id':_0x6339c4[_0x2203('0x1b')]},'limit':0x1,'include':[{'model':_0x27081c[_0x2203('0x1c')],'as':_0x2203('0x1d'),'attributes':_[_0x2203('0x1e')](_0x4893ff)}]}]});})[_0x2203('0x12')](function(_0x449039){_0x3053f3=_0x449039['get']({'plain':!![]});if(_0x3053f3&&_0x3053f3[_0x2203('0x1f')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2203('0x20'),util['format'](_0x2203('0x21'),_0x6339c4['id'],_0x3053f3[_0x2203('0x1f')]));if(_0x3053f3['Interactions']&&_0x3053f3[_0x2203('0x22')]['length']){_0x6339c4['Interaction']=_[_0x2203('0x23')](_0x3053f3[_0x2203('0x22')][0x0],_0x2203('0x1d'));_0x6339c4[_0x2203('0x1d')]=_0x3053f3[_0x2203('0x22')][0x0][_0x2203('0x1d')];}var _0x10f055={'method':_0x2203('0x24'),'uri':encodeURI(_0x3053f3['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x10f055[_0x2203('0x25')]){case _0x2203('0x26'):_0x10f055['qs']=_0x6339c4;break;case _0x2203('0x24'):_0x10f055['body']=_0x6339c4;break;}return rp(_0x10f055)[_0x2203('0x12')](function(_0x1cec17){logger['info'](_0x2203('0x27'),_0x2203('0x20'),util[_0x2203('0x28')](_0x2203('0x29'),_0x6339c4['id'],_0x3053f3[_0x2203('0x1f')]));if(_0x1cec17[_0x2203('0xd')][_0x2203('0x2a')]&&_0x1cec17['body'][_0x2203('0x2a')]!=_0x6339c4[_0x2203('0x2b')][_0x2203('0x2a')]){return _0x27081c[_0x2203('0x1a')]['update']({'threadId':_0x1cec17[_0x2203('0xd')][_0x2203('0x2a')]},{'logging':!![],'where':{'id':_0x6339c4[_0x2203('0x2b')]['id']}});}else{return;}})[_0x2203('0x12')](function(){return _0x526ae0['update']({'read':!![]});})[_0x2203('0x15')](function(_0x50aa17){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x2203('0x20'),util['inspect'](_0x50aa17,{'showHidden':![],'depth':null}));_0x549908();});}else{_0x549908();}})['finally'](function(){_0x549908();});}else{_0x549908();}}},'charset':_0x2203('0x2c'),'collate':_0x2203('0x2d')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index cef6206..74ae062 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 _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1eb4cc,_0xca601b){var _0x327923=function(_0x23277a){while(--_0x23277a){_0x1eb4cc['push'](_0x1eb4cc['shift']());}};_0x327923(++_0xca601b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x162067,_0x2ea51d){_0x162067=_0x162067-0x0;var _0x5c695f=_0x5f2f[_0x162067];return _0x5c695f;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x515935,_0x4909ab){var _0x1ffe74=function(_0xc01892){while(--_0xc01892){_0x515935['push'](_0x515935['shift']());}};_0x1ffe74(++_0x4909ab);}(_0xadb5,0xad));var _0x5adb=function(_0x33c1cd,_0x4b92db){_0x33c1cd=_0x33c1cd-0x0;var _0x365b58=_0xadb5[_0x33c1cd];return _0x365b58;};'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});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 17a04fd..ab747a1 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 _0xde4e=['update','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x4ad759,_0x11efc1){var _0xe358a1=function(_0x1e6007){while(--_0x1e6007){_0x4ad759['push'](_0x4ad759['shift']());}};_0xe358a1(++_0x11efc1);}(_0xde4e,0x1ec));var _0xede4=function(_0x182dd3,_0xc6c28e){_0x182dd3=_0x182dd3-0x0;var _0x3b85ae=_0xde4e[_0x182dd3];return _0x3b85ae;};'use strict';var OpenchannelMessageEvents=require(_0xede4('0x0'));var events=[_0xede4('0x1'),_0xede4('0x2'),_0xede4('0x3')];function createListener(_0x1d6a79,_0x3db80d){return function(_0x38ee98){_0x3db80d[_0xede4('0x4')](_0x1d6a79,_0x38ee98);};}function removeListener(_0x53b123,_0x23cb78){return function(){OpenchannelMessageEvents[_0xede4('0x5')](_0x53b123,_0x23cb78);};}exports[_0xede4('0x6')]=function(_0x6b3d2f){for(var _0x54891b=0x0,_0x24ad30=events[_0xede4('0x7')];_0x54891b<_0x24ad30;_0x54891b++){var _0x5c7952=events[_0x54891b];var _0x1ddbd8=createListener(_0xede4('0x8')+_0x5c7952,_0x6b3d2f);OpenchannelMessageEvents['on'](_0x5c7952,_0x1ddbd8);}}; \ No newline at end of file +var _0x6863=['./openchannelMessage.events','save','remove','removeListener','register','length','openchannelMessage:'];(function(_0x382326,_0x406569){var _0x5c7a77=function(_0xb33184){while(--_0xb33184){_0x382326['push'](_0x382326['shift']());}};_0x5c7a77(++_0x406569);}(_0x6863,0xd9));var _0x3686=function(_0x30b511,_0x36dd52){_0x30b511=_0x30b511-0x0;var _0x2a6491=_0x6863[_0x30b511];return _0x2a6491;};'use strict';var OpenchannelMessageEvents=require(_0x3686('0x0'));var events=[_0x3686('0x1'),_0x3686('0x2'),'update'];function createListener(_0x52b6be,_0x14bacc){return function(_0x117020){_0x14bacc['emit'](_0x52b6be,_0x117020);};}function removeListener(_0x1eb8e2,_0x4d0177){return function(){OpenchannelMessageEvents[_0x3686('0x3')](_0x1eb8e2,_0x4d0177);};}exports[_0x3686('0x4')]=function(_0x2c82b4){for(var _0x4c5c07=0x0,_0x7dd73c=events[_0x3686('0x5')];_0x4c5c07<_0x7dd73c;_0x4c5c07++){var _0x5cfb2c=events[_0x4c5c07];var _0x2ad6d4=createListener(_0x3686('0x6')+_0x5cfb2c,_0x2c82b4);OpenchannelMessageEvents['on'](_0x5cfb2c,_0x2ad6d4);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 195b38f..1062349 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 _0x42e2=['/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','/:id/members','getMembers'];(function(_0x578e07,_0x41acf3){var _0x779a65=function(_0x439524){while(--_0x439524){_0x578e07['push'](_0x578e07['shift']());}};_0x779a65(++_0x41acf3);}(_0x42e2,0x1ce));var _0x242e=function(_0xd83514,_0x59b136){_0xd83514=_0xd83514-0x0;var _0x27ff22=_0x42e2[_0xd83514];return _0x27ff22;};'use strict';var multer=require(_0x242e('0x0'));var util=require(_0x242e('0x1'));var path=require(_0x242e('0x2'));var timeout=require('connect-timeout');var express=require(_0x242e('0x3'));var router=express[_0x242e('0x4')]();var fs_extra=require(_0x242e('0x5'));var auth=require(_0x242e('0x6'));var interaction=require(_0x242e('0x7'));var config=require(_0x242e('0x8'));var controller=require(_0x242e('0x9'));router[_0x242e('0xa')]('/',auth['isAuthenticated'](),controller[_0x242e('0xb')]);router['get'](_0x242e('0xc'),auth['isAuthenticated'](),controller[_0x242e('0xd')]);router[_0x242e('0xa')](_0x242e('0xe'),auth[_0x242e('0xf')](),controller['show']);router[_0x242e('0xa')](_0x242e('0x10'),auth[_0x242e('0xf')](),controller[_0x242e('0x11')]);router['get'](_0x242e('0x12'),auth['isAuthenticated'](),controller[_0x242e('0x13')]);router[_0x242e('0xa')](_0x242e('0x14'),auth[_0x242e('0xf')](),controller[_0x242e('0x15')]);router[_0x242e('0x16')]('/',auth['isAuthenticated'](),controller[_0x242e('0x17')]);router['post'](_0x242e('0x12'),auth[_0x242e('0xf')](),controller[_0x242e('0x18')]);router['post'](_0x242e('0x14'),auth[_0x242e('0xf')](),controller[_0x242e('0x19')]);router['put'](_0x242e('0xe'),auth[_0x242e('0xf')](),controller[_0x242e('0x1a')]);router[_0x242e('0x1b')](_0x242e('0xe'),auth[_0x242e('0xf')](),controller[_0x242e('0x1c')]);router['delete']('/:id/teams',auth[_0x242e('0xf')](),controller[_0x242e('0x1d')]);router[_0x242e('0x1b')](_0x242e('0x14'),auth[_0x242e('0xf')](),controller[_0x242e('0x1e')]);module[_0x242e('0x1f')]=router; \ No newline at end of file +var _0x41f9=['/describe','describe','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x24aa50,_0x15d6d3){var _0x65c42c=function(_0xd4d534){while(--_0xd4d534){_0x24aa50['push'](_0x24aa50['shift']());}};_0x65c42c(++_0x15d6d3);}(_0x41f9,0x131));var _0x941f=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x41f9[_0x88cd7b];return _0x56fcc8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x941f('0x0'));var express=require(_0x941f('0x1'));var router=express['Router']();var fs_extra=require(_0x941f('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x941f('0x3'));var config=require(_0x941f('0x4'));var controller=require('./openchannelQueue.controller');router[_0x941f('0x5')]('/',auth[_0x941f('0x6')](),controller['index']);router[_0x941f('0x5')](_0x941f('0x7'),auth['isAuthenticated'](),controller[_0x941f('0x8')]);router[_0x941f('0x5')]('/:id',auth[_0x941f('0x6')](),controller['show']);router[_0x941f('0x5')](_0x941f('0x9'),auth[_0x941f('0x6')](),controller[_0x941f('0xa')]);router[_0x941f('0x5')]('/:id/teams',auth['isAuthenticated'](),controller[_0x941f('0xb')]);router[_0x941f('0x5')](_0x941f('0xc'),auth[_0x941f('0x6')](),controller[_0x941f('0xd')]);router['post']('/',auth[_0x941f('0x6')](),controller['create']);router[_0x941f('0xe')](_0x941f('0xf'),auth['isAuthenticated'](),controller[_0x941f('0x10')]);router['post']('/:id/users',auth[_0x941f('0x6')](),controller[_0x941f('0x11')]);router[_0x941f('0x12')](_0x941f('0x13'),auth[_0x941f('0x6')](),controller[_0x941f('0x14')]);router[_0x941f('0x15')](_0x941f('0x13'),auth[_0x941f('0x6')](),controller[_0x941f('0x16')]);router[_0x941f('0x15')](_0x941f('0xf'),auth[_0x941f('0x6')](),controller[_0x941f('0x17')]);router[_0x941f('0x15')](_0x941f('0xc'),auth[_0x941f('0x6')](),controller[_0x941f('0x18')]);module[_0x941f('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 6c86f9b..59a5ceb 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 _0xe26e=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x10ce90,_0xbcbfa7){var _0x1739e7=function(_0xcc7f25){while(--_0xcc7f25){_0x10ce90['push'](_0x10ce90['shift']());}};_0x1739e7(++_0xbcbfa7);}(_0xe26e,0x146));var _0xee26=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe26e[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xee26('0x0'));module[_0xee26('0x1')]={'name':{'type':Sequelize[_0xee26('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xee26('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xee26('0x3')](_0xee26('0x4'),_0xee26('0x5'),_0xee26('0x6'))}}; \ No newline at end of file +var _0xa31e=['INTEGER','ENUM','rrmemory','roundrobin','STRING','name'];(function(_0x560a62,_0x43006a){var _0x1eb1ed=function(_0x4643e8){while(--_0x4643e8){_0x560a62['push'](_0x560a62['shift']());}};_0x1eb1ed(++_0x43006a);}(_0xa31e,0x1c0));var _0xea31=function(_0x4e1d7d,_0x5a7761){_0x4e1d7d=_0x4e1d7d-0x0;var _0x53f086=_0xa31e[_0x4e1d7d];return _0x53f086;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xea31('0x0')],'unique':_0xea31('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xea31('0x0')]},'timeout':{'type':Sequelize[_0xea31('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xea31('0x3')](_0xea31('0x4'),'beepall',_0xea31('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index cefb51d..6b17416 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 _0x28d5=['ids','Team','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','Agents','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','findOne','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','nolimit','OpenchannelQueueId','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams'];(function(_0x315d76,_0x24b3a5){var _0x31785d=function(_0x3c1660){while(--_0x3c1660){_0x315d76['push'](_0x315d76['shift']());}};_0x31785d(++_0x24b3a5);}(_0x28d5,0xbc));var _0x528d=function(_0x4bd710,_0x237f88){_0x4bd710=_0x4bd710-0x0;var _0x30f143=_0x28d5[_0x4bd710];return _0x30f143;};'use strict';var emlformat=require(_0x528d('0x0'));var rimraf=require(_0x528d('0x1'));var zipdir=require(_0x528d('0x2'));var jsonpatch=require(_0x528d('0x3'));var rp=require(_0x528d('0x4'));var moment=require('moment');var BPromise=require(_0x528d('0x5'));var Mustache=require('mustache');var util=require(_0x528d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x528d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x528d('0x8'));var _=require(_0x528d('0x9'));var squel=require(_0x528d('0xa'));var crypto=require(_0x528d('0xb'));var jsforce=require(_0x528d('0xc'));var deskjs=require(_0x528d('0xd'));var toCsv=require(_0x528d('0x7'));var querystring=require(_0x528d('0xe'));var Papa=require(_0x528d('0xf'));var Redis=require(_0x528d('0x10'));var authService=require(_0x528d('0x11'));var qs=require(_0x528d('0x12'));var as=require(_0x528d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x528d('0x14'))(_0x528d('0x15'));var utils=require(_0x528d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x528d('0x17'));var db=require(_0x528d('0x18'))['db'];config[_0x528d('0x19')]=_[_0x528d('0x1a')](config[_0x528d('0x19')],{'host':_0x528d('0x1b'),'port':0x18eb});var socket=require(_0x528d('0x1c'))(new Redis(config[_0x528d('0x19')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x463f3e,_0x97b1f2){_0x97b1f2=_0x97b1f2||0xcc;return function(_0x246121){if(_0x246121){return _0x463f3e[_0x528d('0x1d')](_0x97b1f2);}return _0x463f3e[_0x528d('0x1e')](_0x97b1f2)[_0x528d('0x1f')]();};}function respondWithResult(_0x43c3c3,_0x3d4196){_0x3d4196=_0x3d4196||0xc8;return function(_0x168042){if(_0x168042){return _0x43c3c3[_0x528d('0x1e')](_0x3d4196)['json'](_0x168042);}};}function respondWithFilteredResult(_0x35d403,_0xbb36fe){return function(_0x23a24f){if(_0x23a24f){var _0x3d6af1=typeof _0xbb36fe['offset']===_0x528d('0x20')&&typeof _0xbb36fe[_0x528d('0x21')]===_0x528d('0x20');var _0x5013e3=_0x23a24f[_0x528d('0x22')];var _0x5f3c03=_0x3d6af1?0x0:_0xbb36fe[_0x528d('0x23')];var _0x54fe00=_0x3d6af1?_0x23a24f[_0x528d('0x22')]:_0xbb36fe[_0x528d('0x23')]+_0xbb36fe[_0x528d('0x21')];var _0x3469a0;if(_0x54fe00>=_0x5013e3){_0x54fe00=_0x5013e3;_0x3469a0=0xc8;}else{_0x3469a0=0xce;}_0x35d403['status'](_0x3469a0);return _0x35d403[_0x528d('0x24')](_0x528d('0x25'),_0x5f3c03+'-'+_0x54fe00+'/'+_0x5013e3)[_0x528d('0x26')](_0x23a24f);}return null;};}function patchUpdates(_0x29a803){return function(_0x1cbe38){try{jsonpatch[_0x528d('0x27')](_0x1cbe38,_0x29a803,!![]);}catch(_0x259a4e){return BPromise['reject'](_0x259a4e);}return _0x1cbe38['save']();};}function saveUpdates(_0x255c04,_0x347389){return function(_0x1c617f){if(_0x1c617f){return _0x1c617f[_0x528d('0x28')](_0x255c04)[_0x528d('0x29')](function(_0x272358){return _0x272358;});}return null;};}function removeEntity(_0x567b50,_0x13553f){return function(_0x460f59){if(_0x460f59){return _0x460f59[_0x528d('0x2a')]()[_0x528d('0x29')](function(){var _0x5e6912=_0x460f59[_0x528d('0x2b')]({'plain':!![]});var _0x23cbf6='OpenchannelQueues';return db[_0x528d('0x2c')]['destroy']({'where':{'type':_0x23cbf6,'resourceId':_0x5e6912['id']}})[_0x528d('0x29')](function(){return _0x460f59;});})[_0x528d('0x29')](function(){_0x567b50[_0x528d('0x1e')](0xcc)[_0x528d('0x1f')]();});}};}function handleEntityNotFound(_0x8a7214,_0x4ea49b){return function(_0x5b7dfe){if(!_0x5b7dfe){_0x8a7214[_0x528d('0x1d')](0x194);}return _0x5b7dfe;};}function handleError(_0x330920,_0x18e1f5){_0x18e1f5=_0x18e1f5||0x1f4;return function(_0x374f3d){logger[_0x528d('0x2d')](_0x374f3d[_0x528d('0x2e')]);if(_0x374f3d[_0x528d('0x2f')]){delete _0x374f3d[_0x528d('0x2f')];}_0x330920[_0x528d('0x1e')](_0x18e1f5)[_0x528d('0x30')](_0x374f3d);};}exports[_0x528d('0x31')]=function(_0x4630eb,_0x432d9e){var _0x3b5bda={},_0x1c8d6c={},_0xb817c0={'count':0x0,'rows':[]};var _0x583614=_[_0x528d('0x32')](db[_0x528d('0x33')][_0x528d('0x34')],function(_0x26da93){return{'name':_0x26da93[_0x528d('0x35')],'type':_0x26da93['type'][_0x528d('0x36')]};});_0x1c8d6c[_0x528d('0x37')]=_[_0x528d('0x32')](_0x583614,_0x528d('0x2f'));_0x1c8d6c[_0x528d('0x38')]=_[_0x528d('0x39')](_0x4630eb[_0x528d('0x38')]);_0x1c8d6c[_0x528d('0x3a')]=_[_0x528d('0x3b')](_0x1c8d6c[_0x528d('0x37')],_0x1c8d6c['query']);_0x3b5bda['attributes']=_['intersection'](_0x1c8d6c[_0x528d('0x37')],qs[_0x528d('0x3c')](_0x4630eb[_0x528d('0x38')]['fields']));_0x3b5bda[_0x528d('0x3d')]=_0x3b5bda[_0x528d('0x3d')]['length']?_0x3b5bda[_0x528d('0x3d')]:_0x1c8d6c[_0x528d('0x37')];if(!_0x4630eb[_0x528d('0x38')][_0x528d('0x3e')]('nolimit')){_0x3b5bda['limit']=qs['limit'](_0x4630eb[_0x528d('0x38')][_0x528d('0x21')]);_0x3b5bda[_0x528d('0x23')]=qs[_0x528d('0x23')](_0x4630eb[_0x528d('0x38')][_0x528d('0x23')]);}_0x3b5bda[_0x528d('0x3f')]=qs[_0x528d('0x40')](_0x4630eb[_0x528d('0x38')][_0x528d('0x40')]);_0x3b5bda['where']=qs['filters'](_[_0x528d('0x41')](_0x4630eb['query'],_0x1c8d6c[_0x528d('0x3a')]),_0x583614);if(_0x4630eb[_0x528d('0x38')][_0x528d('0x42')]){_0x3b5bda[_0x528d('0x43')]=_[_0x528d('0x44')](_0x3b5bda[_0x528d('0x43')],{'$or':_['map'](_0x583614,function(_0x41e274){if(_0x41e274[_0x528d('0x45')]!==_0x528d('0x46')){var _0x365fb1={};_0x365fb1[_0x41e274[_0x528d('0x2f')]]={'$like':'%'+_0x4630eb[_0x528d('0x38')][_0x528d('0x42')]+'%'};return _0x365fb1;}})});}_0x3b5bda=_['merge']({},_0x3b5bda,_0x4630eb[_0x528d('0x47')]);var _0x5a004b={'where':_0x3b5bda['where']};return db['OpenchannelQueue'][_0x528d('0x22')](_0x5a004b)[_0x528d('0x29')](function(_0x2db9ad){_0xb817c0[_0x528d('0x22')]=_0x2db9ad;if(_0x4630eb['query'][_0x528d('0x48')]){_0x3b5bda[_0x528d('0x49')]=[{'all':!![]}];}return db[_0x528d('0x33')][_0x528d('0x4a')](_0x3b5bda);})[_0x528d('0x29')](function(_0x393e95){_0xb817c0[_0x528d('0x4b')]=_0x393e95;return _0xb817c0;})[_0x528d('0x29')](respondWithFilteredResult(_0x432d9e,_0x3b5bda))[_0x528d('0x4c')](handleError(_0x432d9e,null));};exports[_0x528d('0x4d')]=function(_0x12938b,_0x13443b){var _0x258b71={'raw':!![],'where':{'id':_0x12938b[_0x528d('0x4e')]['id']}},_0x489374={};_0x489374['model']=_[_0x528d('0x39')](db[_0x528d('0x33')][_0x528d('0x34')]);_0x489374[_0x528d('0x38')]=_['keys'](_0x12938b[_0x528d('0x38')]);_0x489374[_0x528d('0x3a')]=_[_0x528d('0x3b')](_0x489374[_0x528d('0x37')],_0x489374['query']);_0x258b71[_0x528d('0x3d')]=_[_0x528d('0x3b')](_0x489374[_0x528d('0x37')],qs[_0x528d('0x3c')](_0x12938b[_0x528d('0x38')][_0x528d('0x3c')]));_0x258b71[_0x528d('0x3d')]=_0x258b71[_0x528d('0x3d')][_0x528d('0x4f')]?_0x258b71[_0x528d('0x3d')]:_0x489374[_0x528d('0x37')];if(_0x12938b[_0x528d('0x38')][_0x528d('0x48')]){_0x258b71['include']=[{'all':!![]}];}_0x258b71=_[_0x528d('0x44')]({},_0x258b71,_0x12938b['options']);return db[_0x528d('0x33')]['find'](_0x258b71)[_0x528d('0x29')](handleEntityNotFound(_0x13443b,null))[_0x528d('0x29')](respondWithResult(_0x13443b,null))[_0x528d('0x4c')](handleError(_0x13443b,null));};exports[_0x528d('0x50')]=function(_0x2fa31c,_0x332ca8){return db[_0x528d('0x33')][_0x528d('0x50')](_0x2fa31c[_0x528d('0x51')],{})['then'](function(_0x33cc0a){var _0x2386b3=_0x2fa31c[_0x528d('0x52')][_0x528d('0x2b')]({'plain':!![]});if(!_0x2386b3)throw new Error(_0x528d('0x53'));if(_0x2386b3[_0x528d('0x54')]===_0x528d('0x52')){var _0x3cd818=_0x33cc0a[_0x528d('0x2b')]({'plain':!![]});var _0x191a48=_0x528d('0x55');return db[_0x528d('0x56')]['find']({'where':{'name':_0x191a48,'userProfileId':_0x2386b3['userProfileId']},'raw':!![]})[_0x528d('0x29')](function(_0x154311){if(_0x154311&&_0x154311['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3cd818[_0x528d('0x2f')],'resourceId':_0x3cd818['id'],'type':_0x154311[_0x528d('0x2f')],'sectionId':_0x154311['id']},{})[_0x528d('0x29')](function(){return _0x33cc0a;});}else{return _0x33cc0a;}})[_0x528d('0x4c')](function(_0x40cd57){logger['error'](_0x528d('0x57'),_0x40cd57);throw _0x40cd57;});}return _0x33cc0a;})[_0x528d('0x29')](respondWithResult(_0x332ca8,0xc9))[_0x528d('0x4c')](handleError(_0x332ca8,null));};exports[_0x528d('0x28')]=function(_0x57a1c6,_0x1a9941){if(_0x57a1c6[_0x528d('0x51')]['id']){delete _0x57a1c6['body']['id'];}return db[_0x528d('0x33')][_0x528d('0x58')]({'where':{'id':_0x57a1c6[_0x528d('0x4e')]['id']}})[_0x528d('0x29')](handleEntityNotFound(_0x1a9941,null))[_0x528d('0x29')](saveUpdates(_0x57a1c6[_0x528d('0x51')],null))['then'](respondWithResult(_0x1a9941,null))[_0x528d('0x4c')](handleError(_0x1a9941,null));};exports[_0x528d('0x2a')]=function(_0x1bf841,_0x508e52){return db[_0x528d('0x33')][_0x528d('0x58')]({'where':{'id':_0x1bf841[_0x528d('0x4e')]['id']}})[_0x528d('0x29')](handleEntityNotFound(_0x508e52,null))['then'](removeEntity(_0x508e52,null))[_0x528d('0x4c')](handleError(_0x508e52,null));};exports[_0x528d('0x59')]=function(_0x41535b,_0x18a4f4){return db['OpenchannelQueue'][_0x528d('0x59')]()[_0x528d('0x29')](respondWithResult(_0x18a4f4,null))['catch'](handleError(_0x18a4f4,null));};exports[_0x528d('0x5a')]=function(_0x29dbd3,_0xd03726,_0x3d7c34){var _0x17d9a4={'raw':!![],'where':{}},_0x409983={},_0x114cae;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x29dbd3[_0x528d('0x4e')]['id']}})[_0x528d('0x29')](handleEntityNotFound(_0xd03726,null))[_0x528d('0x29')](function(_0x4ce149){if(_0x4ce149){_0x114cae=_0x4ce149[_0x528d('0x2b')]({'plain':!![]});_0x409983['model']=_[_0x528d('0x39')](db['UserOpenchannelQueue'][_0x528d('0x34')]);_0x409983[_0x528d('0x38')]=_[_0x528d('0x39')](_0x29dbd3[_0x528d('0x38')]);_0x409983[_0x528d('0x3a')]=_[_0x528d('0x3b')](_0x409983[_0x528d('0x37')],_0x409983['query']);_0x17d9a4[_0x528d('0x3d')]=_[_0x528d('0x3b')](_0x409983['model'],qs[_0x528d('0x3c')](_0x29dbd3[_0x528d('0x38')][_0x528d('0x3c')]));_0x17d9a4[_0x528d('0x3d')]=_0x17d9a4[_0x528d('0x3d')]['length']?_0x17d9a4[_0x528d('0x3d')]:_0x409983[_0x528d('0x37')];if(!_0x29dbd3[_0x528d('0x38')][_0x528d('0x3e')](_0x528d('0x5b'))){_0x17d9a4[_0x528d('0x21')]=qs[_0x528d('0x21')](_0x29dbd3[_0x528d('0x38')]['limit']);_0x17d9a4['offset']=qs[_0x528d('0x23')](_0x29dbd3[_0x528d('0x38')][_0x528d('0x23')]);}_0x17d9a4[_0x528d('0x3f')]=qs[_0x528d('0x40')](_0x29dbd3[_0x528d('0x38')]['sort']);_0x17d9a4[_0x528d('0x43')]=qs[_0x528d('0x3a')](_[_0x528d('0x41')](_0x29dbd3['query'],_0x409983[_0x528d('0x3a')]));_0x17d9a4[_0x528d('0x43')][_0x528d('0x5c')]=_0x4ce149['id'];if(_0x29dbd3[_0x528d('0x38')][_0x528d('0x42')]){_0x17d9a4['where']=_['merge'](_0x17d9a4[_0x528d('0x43')],{'$or':_['map'](_0x17d9a4['attributes'],function(_0x3ee713){var _0x2af363={};_0x2af363[_0x3ee713]={'$like':'%'+_0x29dbd3[_0x528d('0x38')][_0x528d('0x42')]+'%'};return _0x2af363;})});}_0x17d9a4=_[_0x528d('0x44')]({},_0x17d9a4,_0x29dbd3[_0x528d('0x47')]);return db['UserOpenchannelQueue']['findAll'](_0x17d9a4);}})[_0x528d('0x29')](function(_0x381f91){if(_0x381f91){return db[_0x528d('0x5d')][_0x528d('0x5e')]({'where':{'id':_[_0x528d('0x32')](_0x381f91,'UserId'),'role':_0x528d('0x5f')},'attributes':['id',_0x528d('0x2f'),_0x528d('0x60'),_0x528d('0x61'),_0x528d('0x62')]});}})[_0x528d('0x29')](function(_0x3a3fd4){if(_0x3a3fd4){return{'count':_0x3a3fd4[_0x528d('0x22')],'rows':_[_0x528d('0x32')](_0x3a3fd4['rows'],function(_0x47ef31){return{'membername':_0x47ef31[_0x528d('0x2f')],'UserId':_0x47ef31['id'],'queue_name':_0x114cae[_0x528d('0x2f')],'OpenchannelQueueId':_0x114cae['id'],'interface':util[_0x528d('0x63')](_0x528d('0x64'),_0x528d('0x65'),_0x47ef31[_0x528d('0x2f')]),'penalty':0x0,'paused':_0x47ef31[_0x528d('0x60')],'createdAt':_0x47ef31[_0x528d('0x62')],'updatedAt':_0x47ef31[_0x528d('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x528d('0x29')](respondWithFilteredResult(_0xd03726,_0x17d9a4))[_0x528d('0x4c')](handleError(_0xd03726,null));};exports['getTeams']=function(_0x264252,_0x30f439,_0x4a694a){var _0x347408={};var _0x35ad8f={};var _0x122183;var _0x269ed5;return db[_0x528d('0x33')]['findOne']({'where':{'id':_0x264252[_0x528d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x30f439,null))[_0x528d('0x29')](function(_0x20fb48){if(_0x20fb48){_0x122183=_0x20fb48;_0x35ad8f[_0x528d('0x37')]=_[_0x528d('0x39')](db['Team'][_0x528d('0x34')]);_0x35ad8f['query']=_[_0x528d('0x39')](_0x264252[_0x528d('0x38')]);_0x35ad8f[_0x528d('0x3a')]=_[_0x528d('0x3b')](_0x35ad8f[_0x528d('0x37')],_0x35ad8f[_0x528d('0x38')]);_0x347408['attributes']=_['intersection'](_0x35ad8f[_0x528d('0x37')],qs[_0x528d('0x3c')](_0x264252[_0x528d('0x38')]['fields']));_0x347408['attributes']=_0x347408[_0x528d('0x3d')][_0x528d('0x4f')]?_0x347408[_0x528d('0x3d')]:_0x35ad8f['model'];_0x347408['order']=qs[_0x528d('0x40')](_0x264252[_0x528d('0x38')][_0x528d('0x40')]);_0x347408[_0x528d('0x43')]=qs[_0x528d('0x3a')](_[_0x528d('0x41')](_0x264252[_0x528d('0x38')],_0x35ad8f[_0x528d('0x3a')]));if(_0x264252[_0x528d('0x38')][_0x528d('0x42')]){_0x347408[_0x528d('0x43')]=_[_0x528d('0x44')](_0x347408['where'],{'$or':_['map'](_0x347408[_0x528d('0x3d')],function(_0x3fcb9){var _0x5bc2ac={};_0x5bc2ac[_0x3fcb9]={'$like':'%'+_0x264252[_0x528d('0x38')]['filter']+'%'};return _0x5bc2ac;})});}_0x347408=_[_0x528d('0x44')]({},_0x347408,_0x264252[_0x528d('0x47')]);return _0x122183[_0x528d('0x66')](_0x347408);}})[_0x528d('0x29')](function(_0x33c59){if(_0x33c59){_0x269ed5=_0x33c59[_0x528d('0x4f')];if(!_0x264252[_0x528d('0x38')]['hasOwnProperty'](_0x528d('0x5b'))){_0x347408[_0x528d('0x21')]=qs[_0x528d('0x21')](_0x264252[_0x528d('0x38')][_0x528d('0x21')]);_0x347408[_0x528d('0x23')]=qs['offset'](_0x264252[_0x528d('0x38')][_0x528d('0x23')]);}return _0x122183[_0x528d('0x66')](_0x347408);}})[_0x528d('0x29')](function(_0x57c6b2){if(_0x57c6b2){return _0x57c6b2?{'count':_0x269ed5,'rows':_0x57c6b2}:null;}})[_0x528d('0x29')](respondWithResult(_0x30f439,null))[_0x528d('0x4c')](handleError(_0x30f439,null));};exports[_0x528d('0x67')]=function(_0x3526ae,_0x36943b,_0x257864){var _0x1a3e0c=_0x3526ae[_0x528d('0x51')][_0x528d('0x68')];return db[_0x528d('0x69')][_0x528d('0x4a')]({'where':{'id':_0x1a3e0c},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x528d('0x2f'),'online',_0x528d('0x6a'),_0x528d('0x6b')],'raw':!![]}]})[_0x528d('0x29')](function(_0x4e9323){if(_0x4e9323){var _0x4d3ede=_[_0x528d('0x6c')](_0x4e9323,function(_0x1fdbf8){var _0x709c8e=_0x1fdbf8[_0x528d('0x2b')]({'plain':!![]});return _0x709c8e['Agents'];});return db[_0x528d('0x33')][_0x528d('0x58')]({'where':{'id':_0x3526ae[_0x528d('0x4e')]['id']}})[_0x528d('0x29')](function(_0x14bfc4){return db[_0x528d('0x6d')][_0x528d('0x6e')](function(_0x268638){return _0x14bfc4[_0x528d('0x67')](_0x1a3e0c,{'transaction':_0x268638})[_0x528d('0x29')](function(){return BPromise[_0x528d('0x6f')](_0x4d3ede,function(_0x1b4240){return db['UserOpenchannelQueue'][_0x528d('0x70')]({'where':{'UserId':_0x1b4240['id'],'OpenchannelQueueId':_0x3526ae['params']['id']},'transaction':_0x268638});});})[_0x528d('0x29')](function(){_0x4d3ede['forEach'](function(_0x1fc307){socket[_0x528d('0x71')]('userOpenchannelQueue:save',{'UserId':_0x1fc307['id'],'OpenchannelQueueId':_0x14bfc4['id']});});});});});}})[_0x528d('0x29')](respondWithStatusCode(_0x36943b,null))[_0x528d('0x4c')](handleError(_0x36943b,null));};exports[_0x528d('0x72')]=function(_0x1f7ab4,_0x1c0e92,_0x7bf6b8){return db[_0x528d('0x69')][_0x528d('0x4a')]({'where':{'id':_0x1f7ab4[_0x528d('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x528d('0x5d')],'as':_0x528d('0x73'),'attributes':['id'],'raw':!![]}]})[_0x528d('0x29')](handleEntityNotFound(_0x1c0e92,null))[_0x528d('0x29')](function(_0x2e86a9){var _0x3a8923=_['map'](_0x2e86a9,'id');var _0x3598dc=[];var _0x487750=[];var _0x415904=squel[_0x528d('0x74')]();_0x415904[_0x528d('0x75')](_0x528d('0x76'))[_0x528d('0x77')](_0x528d('0x78'),'tq')[_0x528d('0x79')](_0x528d('0x7a'),'ut',_0x528d('0x7b'))[_0x528d('0x43')](_0x528d('0x7c'),_0x1f7ab4[_0x528d('0x4e')]['id']);for(var _0x28c2c9=0x0;_0x28c2c9<_0x2e86a9[_0x528d('0x4f')];_0x28c2c9+=0x1){let _0x345bb6=_0x2e86a9[_0x28c2c9];for(var _0x2eafec=0x0;_0x2eafec<_0x345bb6[_0x528d('0x73')][_0x528d('0x4f')];_0x2eafec+=0x1){let _0x5a26b0=_0x345bb6[_0x528d('0x73')][_0x2eafec];var _0x324583=_0x415904[_0x528d('0x7d')]();_0x324583['where'](_0x528d('0x7e'),_0x5a26b0['id']);_0x487750[_0x528d('0x7f')](db['sequelize']['query'](_0x324583[_0x528d('0x80')](),{'type':db[_0x528d('0x6d')]['QueryTypes'][_0x528d('0x81')]})[_0x528d('0x29')](function(_0x55deb6){if(_0x55deb6['length']===0x1){return _0x5a26b0['id'];}else{var _0x42b6a2=_[_0x528d('0x82')](_['map'](_0x55deb6,_0x528d('0x83')),function(_0x4ce8b1){return _[_0x528d('0x84')](_0x3a8923,_0x4ce8b1);});if(_0x42b6a2){return _0x5a26b0['id'];}}}));}}return BPromise[_0x528d('0x85')](_0x487750)['then'](function(_0x3ead32){_0x3598dc=_(_0x3598dc)[_0x528d('0x86')](_0x3ead32)[_0x528d('0x87')]()['value']();return db[_0x528d('0x33')][_0x528d('0x58')]({'where':{'id':_0x1f7ab4[_0x528d('0x4e')]['id']}})[_0x528d('0x29')](function(_0x43bda2){return db[_0x528d('0x6d')]['transaction'](function(_0x275ae4){return _0x43bda2[_0x528d('0x72')](_0x1f7ab4[_0x528d('0x38')]['ids'],{'transaction':_0x275ae4})[_0x528d('0x29')](function(){if(!_['isEmpty'](_0x3598dc)){return _0x43bda2[_0x528d('0x88')](_0x3598dc,{'transaction':_0x275ae4});}})[_0x528d('0x29')](function(){_0x3598dc[_0x528d('0x89')](function(_0x4e2cb6){socket[_0x528d('0x71')](_0x528d('0x8a'),{'UserId':_0x4e2cb6,'OpenchannelQueueId':_0x43bda2['id']});});});});});});})[_0x528d('0x29')](respondWithStatusCode(_0x1c0e92,null))[_0x528d('0x4c')](handleError(_0x1c0e92,null));};exports[_0x528d('0x8b')]=function(_0x5e8877,_0x2dc95c,_0x1ec80e){return db[_0x528d('0x33')][_0x528d('0x58')]({'where':{'id':_0x5e8877[_0x528d('0x4e')]['id']}})[_0x528d('0x29')](handleEntityNotFound(_0x2dc95c,null))[_0x528d('0x29')](function(_0x1f77e8){if(_0x1f77e8){return _0x1f77e8['addAgents'](_0x5e8877[_0x528d('0x51')]['ids'],_[_0x528d('0x8c')](_0x5e8877[_0x528d('0x51')],[_0x528d('0x68'),'id'])||{})[_0x528d('0x8d')](function(_0x3441a1){for(var _0xbaa1f0=0x0;_0xbaa1f0<_0x5e8877[_0x528d('0x51')]['ids'][_0x528d('0x4f')];_0xbaa1f0+=0x1){socket['emit'](_0x528d('0x8e'),{'UserId':Number(_0x5e8877[_0x528d('0x51')][_0x528d('0x68')][_0xbaa1f0]),'OpenchannelQueueId':Number(_0x5e8877['params']['id'])});}return _0x3441a1;});}})[_0x528d('0x29')](respondWithResult(_0x2dc95c,null))[_0x528d('0x4c')](handleError(_0x2dc95c,null));};exports[_0x528d('0x88')]=function(_0x456322,_0x5efb59,_0xc200b3){return db[_0x528d('0x33')]['find']({'where':{'id':_0x456322[_0x528d('0x4e')]['id']}})[_0x528d('0x29')](handleEntityNotFound(_0x5efb59,null))[_0x528d('0x29')](function(_0x5735e7){if(_0x5735e7){return _0x5735e7['removeAgents'](_0x456322[_0x528d('0x38')][_0x528d('0x68')])[_0x528d('0x29')](function(){if(_[_0x528d('0x8f')](_0x456322['query']['ids'])){for(var _0x47faa0=0x0;_0x47faa0<_0x456322[_0x528d('0x38')]['ids'][_0x528d('0x4f')];_0x47faa0+=0x1){socket['emit'](_0x528d('0x8a'),{'UserId':Number(_0x456322[_0x528d('0x38')][_0x528d('0x68')][_0x47faa0]),'OpenchannelQueueId':Number(_0x456322[_0x528d('0x4e')]['id'])});}}else{socket['emit'](_0x528d('0x8a'),{'UserId':Number(_0x456322[_0x528d('0x38')][_0x528d('0x68')]),'OpenchannelQueueId':Number(_0x456322[_0x528d('0x4e')]['id'])});}});}})[_0x528d('0x29')](respondWithStatusCode(_0x5efb59,null))[_0x528d('0x4c')](handleError(_0x5efb59,null));};exports['getAgents']=function(_0x4124c4,_0x80d752,_0x3995d4){var _0x5881ba={};var _0x55424b={};var _0xc56947;var _0x4d818e;return db[_0x528d('0x33')][_0x528d('0x90')]({'where':{'id':_0x4124c4[_0x528d('0x4e')]['id']}})[_0x528d('0x29')](handleEntityNotFound(_0x80d752,null))[_0x528d('0x29')](function(_0x596964){if(_0x596964){_0xc56947=_0x596964;_0x55424b['model']=_[_0x528d('0x39')](db[_0x528d('0x5d')][_0x528d('0x34')]);_0x55424b[_0x528d('0x38')]=_[_0x528d('0x39')](_0x4124c4[_0x528d('0x38')]);_0x55424b[_0x528d('0x3a')]=_[_0x528d('0x3b')](_0x55424b[_0x528d('0x37')],_0x55424b[_0x528d('0x38')]);_0x5881ba['attributes']=_['intersection'](_0x55424b[_0x528d('0x37')],qs[_0x528d('0x3c')](_0x4124c4[_0x528d('0x38')][_0x528d('0x3c')]));_0x5881ba[_0x528d('0x3d')]=_0x5881ba[_0x528d('0x3d')][_0x528d('0x4f')]?_0x5881ba['attributes']:_0x55424b[_0x528d('0x37')];_0x5881ba['order']=qs[_0x528d('0x40')](_0x4124c4[_0x528d('0x38')][_0x528d('0x40')]);_0x5881ba[_0x528d('0x43')]=qs[_0x528d('0x3a')](_[_0x528d('0x41')](_0x4124c4[_0x528d('0x38')],_0x55424b['filters']));if(_0x4124c4[_0x528d('0x38')][_0x528d('0x42')]){_0x5881ba['where']=_['merge'](_0x5881ba[_0x528d('0x43')],{'$or':_[_0x528d('0x32')](_0x5881ba[_0x528d('0x3d')],function(_0x40efb4){var _0xa057b6={};_0xa057b6[_0x40efb4]={'$like':'%'+_0x4124c4[_0x528d('0x38')][_0x528d('0x42')]+'%'};return _0xa057b6;})});}_0x5881ba=_[_0x528d('0x44')]({},_0x5881ba,_0x4124c4[_0x528d('0x47')]);return _0xc56947[_0x528d('0x91')](_0x5881ba);}})[_0x528d('0x29')](function(_0x38f2ef){if(_0x38f2ef){_0x4d818e=_0x38f2ef['length'];if(!_0x4124c4[_0x528d('0x38')][_0x528d('0x3e')](_0x528d('0x5b'))){_0x5881ba[_0x528d('0x21')]=qs[_0x528d('0x21')](_0x4124c4[_0x528d('0x38')][_0x528d('0x21')]);_0x5881ba[_0x528d('0x23')]=qs[_0x528d('0x23')](_0x4124c4[_0x528d('0x38')][_0x528d('0x23')]);}return _0xc56947[_0x528d('0x91')](_0x5881ba);}})['then'](function(_0x4c040c){if(_0x4c040c){return _0x4c040c?{'count':_0x4d818e,'rows':_0x4c040c}:null;}})[_0x528d('0x29')](respondWithResult(_0x80d752,null))[_0x528d('0x4c')](handleError(_0x80d752,null));}; \ No newline at end of file +var _0x623d=['desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','limit','count','set','Content-Range','reject','save','update','destroy','then','OpenchannelQueues','UserProfileResource','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','%s/%s','SIP','createdAt','findOne','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','value','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x34f06f,_0x2a0ca4){var _0x23ae95=function(_0x2a5bf9){while(--_0x2a5bf9){_0x34f06f['push'](_0x34f06f['shift']());}};_0x23ae95(++_0x2a0ca4);}(_0x623d,0x111));var _0xd623=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x623d[_0x37bd26];return _0xe83dc4;};'use strict';var emlformat=require(_0xd623('0x0'));var rimraf=require(_0xd623('0x1'));var zipdir=require(_0xd623('0x2'));var jsonpatch=require(_0xd623('0x3'));var rp=require(_0xd623('0x4'));var moment=require(_0xd623('0x5'));var BPromise=require(_0xd623('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd623('0x7'));var csv=require(_0xd623('0x8'));var ejs=require(_0xd623('0x9'));var fs=require('fs');var fs_extra=require(_0xd623('0xa'));var _=require('lodash');var squel=require(_0xd623('0xb'));var crypto=require(_0xd623('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd623('0xd'));var toCsv=require(_0xd623('0x8'));var querystring=require(_0xd623('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd623('0xf'));var qs=require(_0xd623('0x10'));var as=require(_0xd623('0x11'));var hardwareService=require(_0xd623('0x12'));var logger=require(_0xd623('0x13'))(_0xd623('0x14'));var utils=require(_0xd623('0x15'));var config=require(_0xd623('0x16'));var licenseUtil=require(_0xd623('0x17'));var db=require(_0xd623('0x18'))['db'];config['redis']=_[_0xd623('0x19')](config[_0xd623('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xd623('0x1b'))(new Redis(config[_0xd623('0x1a')]));require('./openchannelQueue.socket')[_0xd623('0x1c')](socket);function respondWithStatusCode(_0x1559ad,_0xbfeeb6){_0xbfeeb6=_0xbfeeb6||0xcc;return function(_0x44256c){if(_0x44256c){return _0x1559ad[_0xd623('0x1d')](_0xbfeeb6);}return _0x1559ad[_0xd623('0x1e')](_0xbfeeb6)[_0xd623('0x1f')]();};}function respondWithResult(_0x23abbc,_0x180fbe){_0x180fbe=_0x180fbe||0xc8;return function(_0x4b746d){if(_0x4b746d){return _0x23abbc[_0xd623('0x1e')](_0x180fbe)[_0xd623('0x20')](_0x4b746d);}};}function respondWithFilteredResult(_0x36ec26,_0x47dbf6){return function(_0x36dbdb){if(_0x36dbdb){var _0x36a2b7=typeof _0x47dbf6['offset']==='undefined'&&typeof _0x47dbf6[_0xd623('0x21')]==='undefined';var _0x4b5f16=_0x36dbdb[_0xd623('0x22')];var _0x5e73fc=_0x36a2b7?0x0:_0x47dbf6['offset'];var _0xf87b3a=_0x36a2b7?_0x36dbdb['count']:_0x47dbf6['offset']+_0x47dbf6[_0xd623('0x21')];var _0x3b43cc;if(_0xf87b3a>=_0x4b5f16){_0xf87b3a=_0x4b5f16;_0x3b43cc=0xc8;}else{_0x3b43cc=0xce;}_0x36ec26[_0xd623('0x1e')](_0x3b43cc);return _0x36ec26[_0xd623('0x23')](_0xd623('0x24'),_0x5e73fc+'-'+_0xf87b3a+'/'+_0x4b5f16)[_0xd623('0x20')](_0x36dbdb);}return null;};}function patchUpdates(_0x73824c){return function(_0x3ad359){try{jsonpatch['apply'](_0x3ad359,_0x73824c,!![]);}catch(_0x233ec3){return BPromise[_0xd623('0x25')](_0x233ec3);}return _0x3ad359[_0xd623('0x26')]();};}function saveUpdates(_0x51e49f,_0x95a9c0){return function(_0x1dfe8b){if(_0x1dfe8b){return _0x1dfe8b[_0xd623('0x27')](_0x51e49f)['then'](function(_0x30cbe4){return _0x30cbe4;});}return null;};}function removeEntity(_0x15e3e1,_0x36fda7){return function(_0x8c954c){if(_0x8c954c){return _0x8c954c[_0xd623('0x28')]()[_0xd623('0x29')](function(){var _0x39e71c=_0x8c954c['get']({'plain':!![]});var _0x6b1ef8=_0xd623('0x2a');return db[_0xd623('0x2b')]['destroy']({'where':{'type':_0x6b1ef8,'resourceId':_0x39e71c['id']}})[_0xd623('0x29')](function(){return _0x8c954c;});})['then'](function(){_0x15e3e1[_0xd623('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31d5f3,_0x2a0dd3){return function(_0x129d4e){if(!_0x129d4e){_0x31d5f3[_0xd623('0x1d')](0x194);}return _0x129d4e;};}function handleError(_0x201df4,_0x33daab){_0x33daab=_0x33daab||0x1f4;return function(_0x2e52d0){logger['error'](_0x2e52d0[_0xd623('0x2c')]);if(_0x2e52d0['name']){delete _0x2e52d0[_0xd623('0x2d')];}_0x201df4['status'](_0x33daab)[_0xd623('0x2e')](_0x2e52d0);};}exports[_0xd623('0x2f')]=function(_0x27cb52,_0x320e1d){var _0xa018={},_0x1db3a2={},_0x4decd1={'count':0x0,'rows':[]};var _0x4fdb1b=_[_0xd623('0x30')](db[_0xd623('0x31')][_0xd623('0x32')],function(_0x5badf8){return{'name':_0x5badf8[_0xd623('0x33')],'type':_0x5badf8[_0xd623('0x34')][_0xd623('0x35')]};});_0x1db3a2[_0xd623('0x36')]=_[_0xd623('0x30')](_0x4fdb1b,'name');_0x1db3a2[_0xd623('0x37')]=_[_0xd623('0x38')](_0x27cb52[_0xd623('0x37')]);_0x1db3a2[_0xd623('0x39')]=_[_0xd623('0x3a')](_0x1db3a2['model'],_0x1db3a2[_0xd623('0x37')]);_0xa018[_0xd623('0x3b')]=_[_0xd623('0x3a')](_0x1db3a2[_0xd623('0x36')],qs[_0xd623('0x3c')](_0x27cb52['query'][_0xd623('0x3c')]));_0xa018[_0xd623('0x3b')]=_0xa018['attributes']['length']?_0xa018['attributes']:_0x1db3a2[_0xd623('0x36')];if(!_0x27cb52['query'][_0xd623('0x3d')](_0xd623('0x3e'))){_0xa018[_0xd623('0x21')]=qs[_0xd623('0x21')](_0x27cb52['query'][_0xd623('0x21')]);_0xa018[_0xd623('0x3f')]=qs[_0xd623('0x3f')](_0x27cb52[_0xd623('0x37')]['offset']);}_0xa018[_0xd623('0x40')]=qs[_0xd623('0x41')](_0x27cb52[_0xd623('0x37')]['sort']);_0xa018['where']=qs[_0xd623('0x39')](_[_0xd623('0x42')](_0x27cb52[_0xd623('0x37')],_0x1db3a2['filters']),_0x4fdb1b);if(_0x27cb52[_0xd623('0x37')][_0xd623('0x43')]){_0xa018[_0xd623('0x44')]=_[_0xd623('0x45')](_0xa018[_0xd623('0x44')],{'$or':_[_0xd623('0x30')](_0x4fdb1b,function(_0x460215){if(_0x460215['type']!==_0xd623('0x46')){var _0x3a0dcc={};_0x3a0dcc[_0x460215[_0xd623('0x2d')]]={'$like':'%'+_0x27cb52[_0xd623('0x37')]['filter']+'%'};return _0x3a0dcc;}})});}_0xa018=_[_0xd623('0x45')]({},_0xa018,_0x27cb52[_0xd623('0x47')]);var _0x278ae4={'where':_0xa018['where']};return db['OpenchannelQueue'][_0xd623('0x22')](_0x278ae4)[_0xd623('0x29')](function(_0x303f38){_0x4decd1[_0xd623('0x22')]=_0x303f38;if(_0x27cb52[_0xd623('0x37')][_0xd623('0x48')]){_0xa018[_0xd623('0x49')]=[{'all':!![]}];}return db[_0xd623('0x31')][_0xd623('0x4a')](_0xa018);})[_0xd623('0x29')](function(_0x333d28){_0x4decd1[_0xd623('0x4b')]=_0x333d28;return _0x4decd1;})[_0xd623('0x29')](respondWithFilteredResult(_0x320e1d,_0xa018))[_0xd623('0x4c')](handleError(_0x320e1d,null));};exports['show']=function(_0x1ebe0b,_0x1e00ae){var _0x2bcb7e={'raw':!![],'where':{'id':_0x1ebe0b[_0xd623('0x4d')]['id']}},_0x5ad50a={};_0x5ad50a['model']=_[_0xd623('0x38')](db[_0xd623('0x31')]['rawAttributes']);_0x5ad50a[_0xd623('0x37')]=_[_0xd623('0x38')](_0x1ebe0b[_0xd623('0x37')]);_0x5ad50a[_0xd623('0x39')]=_[_0xd623('0x3a')](_0x5ad50a['model'],_0x5ad50a['query']);_0x2bcb7e[_0xd623('0x3b')]=_[_0xd623('0x3a')](_0x5ad50a[_0xd623('0x36')],qs[_0xd623('0x3c')](_0x1ebe0b[_0xd623('0x37')]['fields']));_0x2bcb7e[_0xd623('0x3b')]=_0x2bcb7e[_0xd623('0x3b')][_0xd623('0x4e')]?_0x2bcb7e['attributes']:_0x5ad50a[_0xd623('0x36')];if(_0x1ebe0b[_0xd623('0x37')][_0xd623('0x48')]){_0x2bcb7e[_0xd623('0x49')]=[{'all':!![]}];}_0x2bcb7e=_['merge']({},_0x2bcb7e,_0x1ebe0b[_0xd623('0x47')]);return db[_0xd623('0x31')]['find'](_0x2bcb7e)[_0xd623('0x29')](handleEntityNotFound(_0x1e00ae,null))[_0xd623('0x29')](respondWithResult(_0x1e00ae,null))[_0xd623('0x4c')](handleError(_0x1e00ae,null));};exports[_0xd623('0x4f')]=function(_0x3cc7a4,_0x7f6ad4){return db['OpenchannelQueue'][_0xd623('0x4f')](_0x3cc7a4[_0xd623('0x50')],{})[_0xd623('0x29')](function(_0x49c5a0){var _0x589a95=_0x3cc7a4[_0xd623('0x51')]['get']({'plain':!![]});if(!_0x589a95)throw new Error(_0xd623('0x52'));if(_0x589a95['role']===_0xd623('0x51')){var _0x33a24b=_0x49c5a0[_0xd623('0x53')]({'plain':!![]});var _0x20919d=_0xd623('0x2a');return db[_0xd623('0x54')][_0xd623('0x55')]({'where':{'name':_0x20919d,'userProfileId':_0x589a95[_0xd623('0x56')]},'raw':!![]})['then'](function(_0x3f0223){if(_0x3f0223&&_0x3f0223[_0xd623('0x57')]===0x0){return db['UserProfileResource'][_0xd623('0x4f')]({'name':_0x33a24b[_0xd623('0x2d')],'resourceId':_0x33a24b['id'],'type':_0x3f0223[_0xd623('0x2d')],'sectionId':_0x3f0223['id']},{})['then'](function(){return _0x49c5a0;});}else{return _0x49c5a0;}})[_0xd623('0x4c')](function(_0x27e1fd){logger[_0xd623('0x58')](_0xd623('0x59'),_0x27e1fd);throw _0x27e1fd;});}return _0x49c5a0;})['then'](respondWithResult(_0x7f6ad4,0xc9))[_0xd623('0x4c')](handleError(_0x7f6ad4,null));};exports[_0xd623('0x27')]=function(_0x3fd032,_0x38a9cf){if(_0x3fd032['body']['id']){delete _0x3fd032[_0xd623('0x50')]['id'];}return db['OpenchannelQueue'][_0xd623('0x55')]({'where':{'id':_0x3fd032[_0xd623('0x4d')]['id']}})[_0xd623('0x29')](handleEntityNotFound(_0x38a9cf,null))[_0xd623('0x29')](saveUpdates(_0x3fd032[_0xd623('0x50')],null))[_0xd623('0x29')](respondWithResult(_0x38a9cf,null))['catch'](handleError(_0x38a9cf,null));};exports[_0xd623('0x28')]=function(_0x34ac93,_0xf30224){return db[_0xd623('0x31')][_0xd623('0x55')]({'where':{'id':_0x34ac93[_0xd623('0x4d')]['id']}})[_0xd623('0x29')](handleEntityNotFound(_0xf30224,null))[_0xd623('0x29')](removeEntity(_0xf30224,null))[_0xd623('0x4c')](handleError(_0xf30224,null));};exports['describe']=function(_0x25a874,_0x57ae9c){return db['OpenchannelQueue'][_0xd623('0x5a')]()[_0xd623('0x29')](respondWithResult(_0x57ae9c,null))[_0xd623('0x4c')](handleError(_0x57ae9c,null));};exports[_0xd623('0x5b')]=function(_0x153edf,_0x4e49b2,_0x361933){var _0x28c17b={'raw':!![],'where':{}},_0x3fdd04={},_0x4f8f43;return db[_0xd623('0x31')]['findOne']({'where':{'id':_0x153edf[_0xd623('0x4d')]['id']}})[_0xd623('0x29')](handleEntityNotFound(_0x4e49b2,null))[_0xd623('0x29')](function(_0x11ce58){if(_0x11ce58){_0x4f8f43=_0x11ce58[_0xd623('0x53')]({'plain':!![]});_0x3fdd04['model']=_[_0xd623('0x38')](db[_0xd623('0x5c')][_0xd623('0x32')]);_0x3fdd04[_0xd623('0x37')]=_['keys'](_0x153edf[_0xd623('0x37')]);_0x3fdd04['filters']=_[_0xd623('0x3a')](_0x3fdd04[_0xd623('0x36')],_0x3fdd04[_0xd623('0x37')]);_0x28c17b['attributes']=_[_0xd623('0x3a')](_0x3fdd04[_0xd623('0x36')],qs[_0xd623('0x3c')](_0x153edf[_0xd623('0x37')]['fields']));_0x28c17b[_0xd623('0x3b')]=_0x28c17b[_0xd623('0x3b')][_0xd623('0x4e')]?_0x28c17b[_0xd623('0x3b')]:_0x3fdd04[_0xd623('0x36')];if(!_0x153edf[_0xd623('0x37')][_0xd623('0x3d')](_0xd623('0x3e'))){_0x28c17b[_0xd623('0x21')]=qs[_0xd623('0x21')](_0x153edf[_0xd623('0x37')][_0xd623('0x21')]);_0x28c17b[_0xd623('0x3f')]=qs['offset'](_0x153edf[_0xd623('0x37')][_0xd623('0x3f')]);}_0x28c17b[_0xd623('0x40')]=qs[_0xd623('0x41')](_0x153edf[_0xd623('0x37')][_0xd623('0x41')]);_0x28c17b[_0xd623('0x44')]=qs[_0xd623('0x39')](_[_0xd623('0x42')](_0x153edf[_0xd623('0x37')],_0x3fdd04[_0xd623('0x39')]));_0x28c17b['where'][_0xd623('0x5d')]=_0x11ce58['id'];if(_0x153edf['query']['filter']){_0x28c17b['where']=_[_0xd623('0x45')](_0x28c17b[_0xd623('0x44')],{'$or':_['map'](_0x28c17b[_0xd623('0x3b')],function(_0x45a41a){var _0x4933c9={};_0x4933c9[_0x45a41a]={'$like':'%'+_0x153edf[_0xd623('0x37')]['filter']+'%'};return _0x4933c9;})});}_0x28c17b=_[_0xd623('0x45')]({},_0x28c17b,_0x153edf['options']);return db[_0xd623('0x5c')][_0xd623('0x4a')](_0x28c17b);}})[_0xd623('0x29')](function(_0xe52e9d){if(_0xe52e9d){return db[_0xd623('0x5e')][_0xd623('0x5f')]({'where':{'id':_[_0xd623('0x30')](_0xe52e9d,_0xd623('0x60')),'role':_0xd623('0x61')},'attributes':['id',_0xd623('0x2d'),_0xd623('0x62'),_0xd623('0x63'),'createdAt']});}})[_0xd623('0x29')](function(_0x3a9ca0){if(_0x3a9ca0){return{'count':_0x3a9ca0[_0xd623('0x22')],'rows':_[_0xd623('0x30')](_0x3a9ca0[_0xd623('0x4b')],function(_0x3beb08){return{'membername':_0x3beb08[_0xd623('0x2d')],'UserId':_0x3beb08['id'],'queue_name':_0x4f8f43[_0xd623('0x2d')],'OpenchannelQueueId':_0x4f8f43['id'],'interface':util['format'](_0xd623('0x64'),_0xd623('0x65'),_0x3beb08[_0xd623('0x2d')]),'penalty':0x0,'paused':_0x3beb08[_0xd623('0x62')],'createdAt':_0x3beb08[_0xd623('0x66')],'updatedAt':_0x3beb08['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd623('0x29')](respondWithFilteredResult(_0x4e49b2,_0x28c17b))[_0xd623('0x4c')](handleError(_0x4e49b2,null));};exports['getTeams']=function(_0x290cef,_0x1a7f40,_0x392d8d){var _0x17b102={};var _0x35a5a0={};var _0x28a1a2;var _0x1f8e36;return db[_0xd623('0x31')][_0xd623('0x67')]({'where':{'id':_0x290cef['params']['id']}})['then'](handleEntityNotFound(_0x1a7f40,null))[_0xd623('0x29')](function(_0x2ca495){if(_0x2ca495){_0x28a1a2=_0x2ca495;_0x35a5a0[_0xd623('0x36')]=_[_0xd623('0x38')](db[_0xd623('0x68')][_0xd623('0x32')]);_0x35a5a0['query']=_[_0xd623('0x38')](_0x290cef['query']);_0x35a5a0[_0xd623('0x39')]=_[_0xd623('0x3a')](_0x35a5a0[_0xd623('0x36')],_0x35a5a0[_0xd623('0x37')]);_0x17b102['attributes']=_[_0xd623('0x3a')](_0x35a5a0['model'],qs[_0xd623('0x3c')](_0x290cef['query'][_0xd623('0x3c')]));_0x17b102[_0xd623('0x3b')]=_0x17b102[_0xd623('0x3b')][_0xd623('0x4e')]?_0x17b102['attributes']:_0x35a5a0[_0xd623('0x36')];_0x17b102[_0xd623('0x40')]=qs[_0xd623('0x41')](_0x290cef[_0xd623('0x37')]['sort']);_0x17b102[_0xd623('0x44')]=qs[_0xd623('0x39')](_['pick'](_0x290cef[_0xd623('0x37')],_0x35a5a0[_0xd623('0x39')]));if(_0x290cef[_0xd623('0x37')][_0xd623('0x43')]){_0x17b102['where']=_[_0xd623('0x45')](_0x17b102['where'],{'$or':_[_0xd623('0x30')](_0x17b102['attributes'],function(_0x5dcae2){var _0x35f75a={};_0x35f75a[_0x5dcae2]={'$like':'%'+_0x290cef[_0xd623('0x37')][_0xd623('0x43')]+'%'};return _0x35f75a;})});}_0x17b102=_[_0xd623('0x45')]({},_0x17b102,_0x290cef[_0xd623('0x47')]);return _0x28a1a2[_0xd623('0x69')](_0x17b102);}})[_0xd623('0x29')](function(_0x5ec134){if(_0x5ec134){_0x1f8e36=_0x5ec134[_0xd623('0x4e')];if(!_0x290cef[_0xd623('0x37')]['hasOwnProperty'](_0xd623('0x3e'))){_0x17b102[_0xd623('0x21')]=qs[_0xd623('0x21')](_0x290cef[_0xd623('0x37')][_0xd623('0x21')]);_0x17b102[_0xd623('0x3f')]=qs[_0xd623('0x3f')](_0x290cef[_0xd623('0x37')][_0xd623('0x3f')]);}return _0x28a1a2[_0xd623('0x69')](_0x17b102);}})[_0xd623('0x29')](function(_0x3c55e7){if(_0x3c55e7){return _0x3c55e7?{'count':_0x1f8e36,'rows':_0x3c55e7}:null;}})[_0xd623('0x29')](respondWithResult(_0x1a7f40,null))[_0xd623('0x4c')](handleError(_0x1a7f40,null));};exports[_0xd623('0x6a')]=function(_0x6a152f,_0x29bca4,_0x5a7450){var _0x1365f9=_0x6a152f[_0xd623('0x50')][_0xd623('0x6b')];return db[_0xd623('0x68')][_0xd623('0x4a')]({'where':{'id':_0x1365f9},'attributes':['id'],'include':[{'model':db[_0xd623('0x5e')],'as':_0xd623('0x6c'),'attributes':['id','name',_0xd623('0x6d'),_0xd623('0x6e'),_0xd623('0x6f')],'raw':!![]}]})[_0xd623('0x29')](function(_0x56d89e){if(_0x56d89e){var _0x1be0b8=_[_0xd623('0x70')](_0x56d89e,function(_0x17bcb5){var _0x5595a0=_0x17bcb5[_0xd623('0x53')]({'plain':!![]});return _0x5595a0['Agents'];});return db[_0xd623('0x31')]['find']({'where':{'id':_0x6a152f[_0xd623('0x4d')]['id']}})[_0xd623('0x29')](function(_0x4c7e9c){return db[_0xd623('0x71')]['transaction'](function(_0x272b96){return _0x4c7e9c[_0xd623('0x6a')](_0x1365f9,{'transaction':_0x272b96})['then'](function(){return BPromise[_0xd623('0x72')](_0x1be0b8,function(_0x305eb4){return db['UserOpenchannelQueue'][_0xd623('0x73')]({'where':{'UserId':_0x305eb4['id'],'OpenchannelQueueId':_0x6a152f[_0xd623('0x4d')]['id']},'transaction':_0x272b96});});})['then'](function(){_0x1be0b8[_0xd623('0x74')](function(_0x34eeb4){socket[_0xd623('0x75')](_0xd623('0x76'),{'UserId':_0x34eeb4['id'],'OpenchannelQueueId':_0x4c7e9c['id']});});});});});}})[_0xd623('0x29')](respondWithStatusCode(_0x29bca4,null))[_0xd623('0x4c')](handleError(_0x29bca4,null));};exports[_0xd623('0x77')]=function(_0x8de117,_0x3e63a2,_0x361e40){return db[_0xd623('0x68')][_0xd623('0x4a')]({'where':{'id':_0x8de117[_0xd623('0x37')][_0xd623('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xd623('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd623('0x29')](handleEntityNotFound(_0x3e63a2,null))['then'](function(_0x1ca532){var _0x47d286=_[_0xd623('0x30')](_0x1ca532,'id');var _0x1b4e8a=[];var _0x3d9ef2=[];var _0x3a0466=squel['select']();_0x3a0466[_0xd623('0x78')](_0xd623('0x79'))[_0xd623('0x7a')]('team_has_openchannel_queues','tq')[_0xd623('0x7b')](_0xd623('0x7c'),'ut',_0xd623('0x7d'))['where'](_0xd623('0x7e'),_0x8de117[_0xd623('0x4d')]['id']);for(var _0x2fa49b=0x0;_0x2fa49b<_0x1ca532[_0xd623('0x4e')];_0x2fa49b+=0x1){let _0x5edf36=_0x1ca532[_0x2fa49b];for(var _0x335c72=0x0;_0x335c72<_0x5edf36[_0xd623('0x6c')]['length'];_0x335c72+=0x1){let _0x2b1f09=_0x5edf36[_0xd623('0x6c')][_0x335c72];var _0x21c614=_0x3a0466['clone']();_0x21c614[_0xd623('0x44')](_0xd623('0x7f'),_0x2b1f09['id']);_0x3d9ef2['push'](db['sequelize'][_0xd623('0x37')](_0x21c614[_0xd623('0x80')](),{'type':db['sequelize'][_0xd623('0x81')][_0xd623('0x82')]})['then'](function(_0x299755){if(_0x299755[_0xd623('0x4e')]===0x1){return _0x2b1f09['id'];}else{var _0x22fd1b=_[_0xd623('0x83')](_[_0xd623('0x30')](_0x299755,_0xd623('0x84')),function(_0x8ca2c6){return _['includes'](_0x47d286,_0x8ca2c6);});if(_0x22fd1b){return _0x2b1f09['id'];}}}));}}return BPromise[_0xd623('0x85')](_0x3d9ef2)[_0xd623('0x29')](function(_0x30414a){_0x1b4e8a=_(_0x1b4e8a)[_0xd623('0x86')](_0x30414a)['compact']()[_0xd623('0x87')]();return db['OpenchannelQueue'][_0xd623('0x55')]({'where':{'id':_0x8de117[_0xd623('0x4d')]['id']}})['then'](function(_0x47c913){return db[_0xd623('0x71')][_0xd623('0x88')](function(_0x22a3e3){return _0x47c913[_0xd623('0x77')](_0x8de117[_0xd623('0x37')][_0xd623('0x6b')],{'transaction':_0x22a3e3})[_0xd623('0x29')](function(){if(!_[_0xd623('0x89')](_0x1b4e8a)){return _0x47c913[_0xd623('0x8a')](_0x1b4e8a,{'transaction':_0x22a3e3});}})[_0xd623('0x29')](function(){_0x1b4e8a[_0xd623('0x74')](function(_0x59bc2b){socket[_0xd623('0x75')](_0xd623('0x8b'),{'UserId':_0x59bc2b,'OpenchannelQueueId':_0x47c913['id']});});});});});});})[_0xd623('0x29')](respondWithStatusCode(_0x3e63a2,null))[_0xd623('0x4c')](handleError(_0x3e63a2,null));};exports[_0xd623('0x8c')]=function(_0x4948ad,_0x396791,_0x4b1f90){return db[_0xd623('0x31')][_0xd623('0x55')]({'where':{'id':_0x4948ad[_0xd623('0x4d')]['id']}})[_0xd623('0x29')](handleEntityNotFound(_0x396791,null))[_0xd623('0x29')](function(_0x18c97f){if(_0x18c97f){return _0x18c97f['addAgents'](_0x4948ad[_0xd623('0x50')][_0xd623('0x6b')],_['omit'](_0x4948ad['body'],[_0xd623('0x6b'),'id'])||{})['spread'](function(_0x4e11e2){for(var _0x4e2587=0x0;_0x4e2587<_0x4948ad[_0xd623('0x50')][_0xd623('0x6b')][_0xd623('0x4e')];_0x4e2587+=0x1){socket[_0xd623('0x75')]('userOpenchannelQueue:save',{'UserId':Number(_0x4948ad[_0xd623('0x50')][_0xd623('0x6b')][_0x4e2587]),'OpenchannelQueueId':Number(_0x4948ad['params']['id'])});}return _0x4e11e2;});}})[_0xd623('0x29')](respondWithResult(_0x396791,null))[_0xd623('0x4c')](handleError(_0x396791,null));};exports['removeAgents']=function(_0x5959fd,_0xfbe6aa,_0x53a98f){return db['OpenchannelQueue'][_0xd623('0x55')]({'where':{'id':_0x5959fd['params']['id']}})[_0xd623('0x29')](handleEntityNotFound(_0xfbe6aa,null))[_0xd623('0x29')](function(_0x2b69c5){if(_0x2b69c5){return _0x2b69c5[_0xd623('0x8a')](_0x5959fd['query']['ids'])['then'](function(){if(_[_0xd623('0x8d')](_0x5959fd['query'][_0xd623('0x6b')])){for(var _0xeec516=0x0;_0xeec516<_0x5959fd[_0xd623('0x37')]['ids'][_0xd623('0x4e')];_0xeec516+=0x1){socket[_0xd623('0x75')](_0xd623('0x8b'),{'UserId':Number(_0x5959fd[_0xd623('0x37')]['ids'][_0xeec516]),'OpenchannelQueueId':Number(_0x5959fd['params']['id'])});}}else{socket[_0xd623('0x75')](_0xd623('0x8b'),{'UserId':Number(_0x5959fd[_0xd623('0x37')][_0xd623('0x6b')]),'OpenchannelQueueId':Number(_0x5959fd[_0xd623('0x4d')]['id'])});}});}})[_0xd623('0x29')](respondWithStatusCode(_0xfbe6aa,null))[_0xd623('0x4c')](handleError(_0xfbe6aa,null));};exports[_0xd623('0x8e')]=function(_0x44c909,_0x240243,_0x571f06){var _0x5268c8={};var _0x480ed3={};var _0x3e1a3c;var _0x1a0706;return db[_0xd623('0x31')][_0xd623('0x67')]({'where':{'id':_0x44c909[_0xd623('0x4d')]['id']}})[_0xd623('0x29')](handleEntityNotFound(_0x240243,null))['then'](function(_0x421356){if(_0x421356){_0x3e1a3c=_0x421356;_0x480ed3[_0xd623('0x36')]=_[_0xd623('0x38')](db['User'][_0xd623('0x32')]);_0x480ed3[_0xd623('0x37')]=_[_0xd623('0x38')](_0x44c909[_0xd623('0x37')]);_0x480ed3['filters']=_[_0xd623('0x3a')](_0x480ed3[_0xd623('0x36')],_0x480ed3['query']);_0x5268c8[_0xd623('0x3b')]=_[_0xd623('0x3a')](_0x480ed3[_0xd623('0x36')],qs[_0xd623('0x3c')](_0x44c909['query'][_0xd623('0x3c')]));_0x5268c8[_0xd623('0x3b')]=_0x5268c8[_0xd623('0x3b')][_0xd623('0x4e')]?_0x5268c8[_0xd623('0x3b')]:_0x480ed3[_0xd623('0x36')];_0x5268c8[_0xd623('0x40')]=qs[_0xd623('0x41')](_0x44c909[_0xd623('0x37')][_0xd623('0x41')]);_0x5268c8[_0xd623('0x44')]=qs[_0xd623('0x39')](_[_0xd623('0x42')](_0x44c909[_0xd623('0x37')],_0x480ed3[_0xd623('0x39')]));if(_0x44c909[_0xd623('0x37')][_0xd623('0x43')]){_0x5268c8['where']=_[_0xd623('0x45')](_0x5268c8['where'],{'$or':_[_0xd623('0x30')](_0x5268c8[_0xd623('0x3b')],function(_0x22944a){var _0x1557b7={};_0x1557b7[_0x22944a]={'$like':'%'+_0x44c909[_0xd623('0x37')][_0xd623('0x43')]+'%'};return _0x1557b7;})});}_0x5268c8=_[_0xd623('0x45')]({},_0x5268c8,_0x44c909[_0xd623('0x47')]);return _0x3e1a3c[_0xd623('0x8e')](_0x5268c8);}})[_0xd623('0x29')](function(_0x380bee){if(_0x380bee){_0x1a0706=_0x380bee[_0xd623('0x4e')];if(!_0x44c909[_0xd623('0x37')][_0xd623('0x3d')]('nolimit')){_0x5268c8['limit']=qs[_0xd623('0x21')](_0x44c909[_0xd623('0x37')]['limit']);_0x5268c8['offset']=qs[_0xd623('0x3f')](_0x44c909[_0xd623('0x37')][_0xd623('0x3f')]);}return _0x3e1a3c[_0xd623('0x8e')](_0x5268c8);}})[_0xd623('0x29')](function(_0x53ef02){if(_0x53ef02){return _0x53ef02?{'count':_0x1a0706,'rows':_0x53ef02}:null;}})[_0xd623('0x29')](respondWithResult(_0x240243,null))['catch'](handleError(_0x240243,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index b6401dd..2d3a239 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 _0x3d47=['../../mysqldb','OpenchannelQueue','setMaxListeners','remove','hook','exports','events'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0x3d47,0xbc));var _0x73d4=function(_0x3a7bfb,_0x5a31f3){_0x3a7bfb=_0x3a7bfb-0x0;var _0x186d76=_0x3d47[_0x3a7bfb];return _0x186d76;};'use strict';var EventEmitter=require(_0x73d4('0x0'));var OpenchannelQueue=require(_0x73d4('0x1'))['db'][_0x73d4('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x73d4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x73d4('0x4')};function emitEvent(_0xb6cc37){return function(_0x1c16f2,_0x77b8be,_0x302ad0){OpenchannelQueueEvents['emit'](_0xb6cc37+':'+_0x1c16f2['id'],_0x1c16f2);OpenchannelQueueEvents['emit'](_0xb6cc37,_0x1c16f2);_0x302ad0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x73d4('0x5')](e,emitEvent(event));}}module[_0x73d4('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x4f4e=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0x2a6b55,_0x572485){var _0x3dd7fd=function(_0x52837f){while(--_0x52837f){_0x2a6b55['push'](_0x2a6b55['shift']());}};_0x3dd7fd(++_0x572485);}(_0x4f4e,0x164));var _0xe4f4=function(_0x53f402,_0x326920){_0x53f402=_0x53f402-0x0;var _0x45a76d=_0x4f4e[_0x53f402];return _0x45a76d;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xe4f4('0x0'))['db'][_0xe4f4('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xe4f4('0x2')](0x0);var events={'afterCreate':_0xe4f4('0x3'),'afterUpdate':_0xe4f4('0x4'),'afterDestroy':_0xe4f4('0x5')};function emitEvent(_0x1e77f5){return function(_0x3b6c5b,_0x37d3db,_0x49cccb){OpenchannelQueueEvents[_0xe4f4('0x6')](_0x1e77f5+':'+_0x3b6c5b['id'],_0x3b6c5b);OpenchannelQueueEvents['emit'](_0x1e77f5,_0x3b6c5b);_0x49cccb(null);};}for(var e in events){if(events[_0xe4f4('0x7')](e)){var event=events[e];OpenchannelQueue[_0xe4f4('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index ab4bfc3..c3c17bd 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 _0x3294=['OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3294,0x19a));var _0x4329=function(_0x5ccf30,_0x2a3e67){_0x5ccf30=_0x5ccf30-0x0;var _0x1d3f0c=_0x3294[_0x5ccf30];return _0x1d3f0c;};'use strict';var _=require(_0x4329('0x0'));var util=require('util');var logger=require(_0x4329('0x1'))(_0x4329('0x2'));var moment=require('moment');var BPromise=require(_0x4329('0x3'));var rp=require(_0x4329('0x4'));var fs=require('fs');var path=require(_0x4329('0x5'));var rimraf=require(_0x4329('0x6'));var config=require(_0x4329('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x4329('0x8')]=function(_0x291ace,_0x49d763){return _0x291ace[_0x4329('0x9')](_0x4329('0xa'),attributes,{'tableName':_0x4329('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20af=['path','rimraf','../../config/environment','exports','define','openchannel_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2adf4,_0x5df6de){var _0x45d47d=function(_0x903910){while(--_0x903910){_0x2adf4['push'](_0x2adf4['shift']());}};_0x45d47d(++_0x5df6de);}(_0x20af,0x17c));var _0xf20a=function(_0x1552d1,_0x52a3c1){_0x1552d1=_0x1552d1-0x0;var _0x457993=_0x20af[_0x1552d1];return _0x457993;};'use strict';var _=require(_0xf20a('0x0'));var util=require('util');var logger=require(_0xf20a('0x1'))(_0xf20a('0x2'));var moment=require(_0xf20a('0x3'));var BPromise=require(_0xf20a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf20a('0x5'));var rimraf=require(_0xf20a('0x6'));var config=require(_0xf20a('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0xf20a('0x8')]=function(_0x4cc8a,_0xaf248d){return _0x4cc8a[_0xf20a('0x9')]('OpenchannelQueue',attributes,{'tableName':_0xf20a('0xa'),'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 1fb9f88..ee7c203 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 _0xada1=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','limit','include','model','map','catch','ShowOpenchannelQueue','find','raw','lodash','util'];(function(_0x17771d,_0x575d07){var _0x1aef9b=function(_0x37acba){while(--_0x37acba){_0x17771d['push'](_0x17771d['shift']());}};_0x1aef9b(++_0x575d07);}(_0xada1,0x166));var _0x1ada=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xada1[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0x1ada('0x0'));var util=require(_0x1ada('0x1'));var moment=require('moment');var BPromise=require(_0x1ada('0x2'));var rs=require(_0x1ada('0x3'));var fs=require('fs');var Redis=require(_0x1ada('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1ada('0x5'))(_0x1ada('0x6'));var config=require(_0x1ada('0x7'));var jayson=require(_0x1ada('0x8'));var client=jayson[_0x1ada('0x9')]['http']({'port':0x232a});config[_0x1ada('0xa')]=_['defaults'](config[_0x1ada('0xa')],{'host':_0x1ada('0xb'),'port':0x18eb});var socket=require(_0x1ada('0xc'))(new Redis(config['redis']));require(_0x1ada('0xd'))[_0x1ada('0xe')](socket);function respondWithRpcPromise(_0x933c13,_0x210ec1,_0x55fdb0){return new BPromise(function(_0x65ae02,_0x3381cc){return client[_0x1ada('0xf')](_0x933c13,_0x55fdb0)[_0x1ada('0x10')](function(_0x15f9a8){logger[_0x1ada('0x11')](_0x1ada('0x12'),_0x210ec1,'request\x20sent');logger[_0x1ada('0x13')](_0x1ada('0x14'),_0x210ec1,_0x1ada('0x15'),JSON[_0x1ada('0x16')](_0x15f9a8));if(_0x15f9a8['error']){if(_0x15f9a8[_0x1ada('0x17')]['code']===0x1f4){logger['error'](_0x1ada('0x12'),_0x210ec1,_0x15f9a8[_0x1ada('0x17')][_0x1ada('0x18')]);return _0x3381cc(_0x15f9a8[_0x1ada('0x17')]['message']);}logger['error'](_0x1ada('0x12'),_0x210ec1,_0x15f9a8['error'][_0x1ada('0x18')]);return _0x65ae02(_0x15f9a8[_0x1ada('0x17')][_0x1ada('0x18')]);}else{logger[_0x1ada('0x11')](_0x1ada('0x12'),_0x210ec1,_0x1ada('0x15'));_0x65ae02(_0x15f9a8[_0x1ada('0x19')]['message']);}})['catch'](function(_0x213b1d){logger['error'](_0x1ada('0x12'),_0x210ec1,_0x213b1d);_0x3381cc(_0x213b1d);});});}exports[_0x1ada('0x1a')]=function(_0x2fc8fa){var _0x5288a1=this;return new Promise(function(_0x4cab96,_0x40112a){return db[_0x1ada('0x1b')][_0x1ada('0x1c')]({'raw':_0x2fc8fa[_0x1ada('0x1d')]?_0x2fc8fa[_0x1ada('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2fc8fa[_0x1ada('0x1d')]?_0x2fc8fa[_0x1ada('0x1d')][_0x1ada('0x1e')]||null:null,'attributes':_0x2fc8fa['options']?_0x2fc8fa[_0x1ada('0x1d')][_0x1ada('0x1f')]||null:null,'limit':_0x2fc8fa[_0x1ada('0x1d')]?_0x2fc8fa[_0x1ada('0x1d')][_0x1ada('0x20')]||null:null,'include':_0x2fc8fa['options']?_0x2fc8fa[_0x1ada('0x1d')][_0x1ada('0x21')]?_['map'](_0x2fc8fa[_0x1ada('0x1d')][_0x1ada('0x21')],function(_0x4b9021){return{'model':db[_0x4b9021[_0x1ada('0x22')]],'as':_0x4b9021['as'],'attributes':_0x4b9021[_0x1ada('0x1f')],'include':_0x4b9021[_0x1ada('0x21')]?_[_0x1ada('0x23')](_0x4b9021['include'],function(_0x4f1bb3){return{'model':db[_0x4f1bb3['model']],'as':_0x4f1bb3['as'],'attributes':_0x4f1bb3[_0x1ada('0x1f')],'include':_0x4f1bb3[_0x1ada('0x21')]?_[_0x1ada('0x23')](_0x4f1bb3[_0x1ada('0x21')],function(_0x471d47){return{'model':db[_0x471d47['model']],'as':_0x471d47['as'],'attributes':_0x471d47[_0x1ada('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1ada('0x10')](function(_0x13781b){logger[_0x1ada('0x11')](_0x1ada('0x1a'),_0x2fc8fa);logger[_0x1ada('0x13')](_0x1ada('0x1a'),_0x2fc8fa,JSON['stringify'](_0x13781b));_0x4cab96(_0x13781b);})[_0x1ada('0x24')](function(_0x396a75){logger[_0x1ada('0x17')](_0x1ada('0x1a'),_0x396a75[_0x1ada('0x18')],_0x2fc8fa);_0x40112a(_0x5288a1[_0x1ada('0x17')](0x1f4,_0x396a75[_0x1ada('0x18')]));});});};exports[_0x1ada('0x25')]=function(_0x9c77b4){var _0x34ce0b=this;return new Promise(function(_0x429f04,_0x334ba1){return db[_0x1ada('0x1b')][_0x1ada('0x26')]({'raw':_0x9c77b4[_0x1ada('0x1d')]?_0x9c77b4[_0x1ada('0x1d')][_0x1ada('0x27')]===undefined?!![]:![]:!![],'where':_0x9c77b4[_0x1ada('0x1d')]?_0x9c77b4[_0x1ada('0x1d')][_0x1ada('0x1e')]||null:null,'attributes':_0x9c77b4['options']?_0x9c77b4[_0x1ada('0x1d')][_0x1ada('0x1f')]||null:null,'include':_0x9c77b4[_0x1ada('0x1d')]?_0x9c77b4[_0x1ada('0x1d')][_0x1ada('0x21')]?_[_0x1ada('0x23')](_0x9c77b4[_0x1ada('0x1d')][_0x1ada('0x21')],function(_0x1908be){return{'model':db[_0x1908be[_0x1ada('0x22')]],'as':_0x1908be['as'],'attributes':_0x1908be['attributes'],'include':_0x1908be[_0x1ada('0x21')]?_['map'](_0x1908be[_0x1ada('0x21')],function(_0x1db9d9){return{'model':db[_0x1db9d9[_0x1ada('0x22')]],'as':_0x1db9d9['as'],'attributes':_0x1db9d9[_0x1ada('0x1f')],'include':_0x1db9d9[_0x1ada('0x21')]?_[_0x1ada('0x23')](_0x1db9d9['include'],function(_0xc475bd){return{'model':db[_0xc475bd[_0x1ada('0x22')]],'as':_0xc475bd['as'],'attributes':_0xc475bd[_0x1ada('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5691cb){logger[_0x1ada('0x11')](_0x1ada('0x25'),_0x9c77b4);logger['debug'](_0x1ada('0x25'),_0x9c77b4,JSON['stringify'](_0x5691cb));_0x429f04(_0x5691cb);})[_0x1ada('0x24')](function(_0x171d74){logger[_0x1ada('0x17')]('ShowOpenchannelQueue',_0x171d74[_0x1ada('0x18')],_0x9c77b4);_0x334ba1(_0x34ce0b[_0x1ada('0x17')](0x1f4,_0x171d74[_0x1ada('0x18')]));});});}; \ No newline at end of file +var _0x9f8a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','raw','options','where','limit','include','map','model','attributes','debug','ShowOpenchannelQueue','find','lodash','moment'];(function(_0x282916,_0x29c453){var _0x317b39=function(_0x52a106){while(--_0x52a106){_0x282916['push'](_0x282916['shift']());}};_0x317b39(++_0x29c453);}(_0x9f8a,0x6d));var _0xa9f8=function(_0x2fc5d4,_0x514199){_0x2fc5d4=_0x2fc5d4-0x0;var _0x3b273c=_0x9f8a[_0x2fc5d4];return _0x3b273c;};'use strict';var _=require(_0xa9f8('0x0'));var util=require('util');var moment=require(_0xa9f8('0x1'));var BPromise=require(_0xa9f8('0x2'));var rs=require(_0xa9f8('0x3'));var fs=require('fs');var Redis=require(_0xa9f8('0x4'));var db=require(_0xa9f8('0x5'))['db'];var utils=require(_0xa9f8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa9f8('0x7'));var jayson=require(_0xa9f8('0x8'));var client=jayson['client'][_0xa9f8('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa9f8('0xa')]));require('./openchannelQueue.socket')[_0xa9f8('0xb')](socket);function respondWithRpcPromise(_0x41d232,_0x2c9c56,_0x5510f3){return new BPromise(function(_0x5e1533,_0x3f5c3c){return client[_0xa9f8('0xc')](_0x41d232,_0x5510f3)[_0xa9f8('0xd')](function(_0x1260e){logger[_0xa9f8('0xe')](_0xa9f8('0xf'),_0x2c9c56,_0xa9f8('0x10'));logger['debug'](_0xa9f8('0x11'),_0x2c9c56,_0xa9f8('0x10'),JSON[_0xa9f8('0x12')](_0x1260e));if(_0x1260e[_0xa9f8('0x13')]){if(_0x1260e[_0xa9f8('0x13')][_0xa9f8('0x14')]===0x1f4){logger[_0xa9f8('0x13')](_0xa9f8('0xf'),_0x2c9c56,_0x1260e[_0xa9f8('0x13')][_0xa9f8('0x15')]);return _0x3f5c3c(_0x1260e['error']['message']);}logger[_0xa9f8('0x13')](_0xa9f8('0xf'),_0x2c9c56,_0x1260e[_0xa9f8('0x13')]['message']);return _0x5e1533(_0x1260e[_0xa9f8('0x13')][_0xa9f8('0x15')]);}else{logger[_0xa9f8('0xe')](_0xa9f8('0xf'),_0x2c9c56,'request\x20sent');_0x5e1533(_0x1260e[_0xa9f8('0x16')][_0xa9f8('0x15')]);}})[_0xa9f8('0x17')](function(_0x4999bf){logger['error'](_0xa9f8('0xf'),_0x2c9c56,_0x4999bf);_0x3f5c3c(_0x4999bf);});});}exports[_0xa9f8('0x18')]=function(_0x44d269){var _0x6de25a=this;return new Promise(function(_0x26d4b8,_0x14f944){return db[_0xa9f8('0x19')]['findAll']({'raw':_0x44d269['options']?_0x44d269['options'][_0xa9f8('0x1a')]===undefined?!![]:![]:!![],'where':_0x44d269[_0xa9f8('0x1b')]?_0x44d269['options'][_0xa9f8('0x1c')]||null:null,'attributes':_0x44d269['options']?_0x44d269[_0xa9f8('0x1b')]['attributes']||null:null,'limit':_0x44d269[_0xa9f8('0x1b')]?_0x44d269[_0xa9f8('0x1b')][_0xa9f8('0x1d')]||null:null,'include':_0x44d269['options']?_0x44d269[_0xa9f8('0x1b')][_0xa9f8('0x1e')]?_[_0xa9f8('0x1f')](_0x44d269[_0xa9f8('0x1b')][_0xa9f8('0x1e')],function(_0x57790c){return{'model':db[_0x57790c[_0xa9f8('0x20')]],'as':_0x57790c['as'],'attributes':_0x57790c[_0xa9f8('0x21')],'include':_0x57790c[_0xa9f8('0x1e')]?_[_0xa9f8('0x1f')](_0x57790c[_0xa9f8('0x1e')],function(_0x44df27){return{'model':db[_0x44df27[_0xa9f8('0x20')]],'as':_0x44df27['as'],'attributes':_0x44df27[_0xa9f8('0x21')],'include':_0x44df27['include']?_[_0xa9f8('0x1f')](_0x44df27['include'],function(_0xd72a7c){return{'model':db[_0xd72a7c[_0xa9f8('0x20')]],'as':_0xd72a7c['as'],'attributes':_0xd72a7c[_0xa9f8('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa9f8('0xd')](function(_0x3f625e){logger[_0xa9f8('0xe')]('GetOpenchannelQueue',_0x44d269);logger[_0xa9f8('0x22')](_0xa9f8('0x18'),_0x44d269,JSON[_0xa9f8('0x12')](_0x3f625e));_0x26d4b8(_0x3f625e);})[_0xa9f8('0x17')](function(_0x3cd94f){logger[_0xa9f8('0x13')](_0xa9f8('0x18'),_0x3cd94f['message'],_0x44d269);_0x14f944(_0x6de25a['error'](0x1f4,_0x3cd94f[_0xa9f8('0x15')]));});});};exports[_0xa9f8('0x23')]=function(_0x3dae54){var _0x507c34=this;return new Promise(function(_0x5102ca,_0x3f9f9d){return db[_0xa9f8('0x19')][_0xa9f8('0x24')]({'raw':_0x3dae54[_0xa9f8('0x1b')]?_0x3dae54[_0xa9f8('0x1b')][_0xa9f8('0x1a')]===undefined?!![]:![]:!![],'where':_0x3dae54[_0xa9f8('0x1b')]?_0x3dae54[_0xa9f8('0x1b')]['where']||null:null,'attributes':_0x3dae54[_0xa9f8('0x1b')]?_0x3dae54[_0xa9f8('0x1b')][_0xa9f8('0x21')]||null:null,'include':_0x3dae54[_0xa9f8('0x1b')]?_0x3dae54[_0xa9f8('0x1b')][_0xa9f8('0x1e')]?_[_0xa9f8('0x1f')](_0x3dae54[_0xa9f8('0x1b')]['include'],function(_0x3f03c2){return{'model':db[_0x3f03c2['model']],'as':_0x3f03c2['as'],'attributes':_0x3f03c2[_0xa9f8('0x21')],'include':_0x3f03c2[_0xa9f8('0x1e')]?_[_0xa9f8('0x1f')](_0x3f03c2[_0xa9f8('0x1e')],function(_0x292d25){return{'model':db[_0x292d25[_0xa9f8('0x20')]],'as':_0x292d25['as'],'attributes':_0x292d25['attributes'],'include':_0x292d25['include']?_['map'](_0x292d25[_0xa9f8('0x1e')],function(_0x872d3b){return{'model':db[_0x872d3b[_0xa9f8('0x20')]],'as':_0x872d3b['as'],'attributes':_0x872d3b[_0xa9f8('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa9f8('0xd')](function(_0xb9a6ab){logger[_0xa9f8('0xe')](_0xa9f8('0x23'),_0x3dae54);logger[_0xa9f8('0x22')]('ShowOpenchannelQueue',_0x3dae54,JSON['stringify'](_0xb9a6ab));_0x5102ca(_0xb9a6ab);})[_0xa9f8('0x17')](function(_0x3fe2bf){logger[_0xa9f8('0x13')]('ShowOpenchannelQueue',_0x3fe2bf[_0xa9f8('0x15')],_0x3dae54);_0x3f9f9d(_0x507c34[_0xa9f8('0x13')](0x1f4,_0x3fe2bf[_0xa9f8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 9e103a6..c39d767 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 _0x39fb=['removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','update'];(function(_0x311562,_0x2ffad4){var _0x2c46ef=function(_0x104400){while(--_0x104400){_0x311562['push'](_0x311562['shift']());}};_0x2c46ef(++_0x2ffad4);}(_0x39fb,0x9e));var _0xb39f=function(_0xad1863,_0x19118e){_0xad1863=_0xad1863-0x0;var _0x3980be=_0x39fb[_0xad1863];return _0x3980be;};'use strict';var OpenchannelQueueEvents=require(_0xb39f('0x0'));var events=[_0xb39f('0x1'),'remove',_0xb39f('0x2')];function createListener(_0x58c8f6,_0x29d681){return function(_0x1b89e5){_0x29d681['emit'](_0x58c8f6,_0x1b89e5);};}function removeListener(_0x1ebdc6,_0x1f1b52){return function(){OpenchannelQueueEvents[_0xb39f('0x3')](_0x1ebdc6,_0x1f1b52);};}exports[_0xb39f('0x4')]=function(_0x3504ad){for(var _0x926cb=0x0,_0x3557a4=events[_0xb39f('0x5')];_0x926cb<_0x3557a4;_0x926cb++){var _0x3fe6ac=events[_0x926cb];var _0x5343fd=createListener(_0xb39f('0x6')+_0x3fe6ac,_0x3504ad);OpenchannelQueueEvents['on'](_0x3fe6ac,_0x5343fd);}}; \ No newline at end of file +var _0x80a2=['emit','removeListener','register','./openchannelQueue.events','save','remove'];(function(_0x3a7455,_0x46b004){var _0x216c72=function(_0xdd775c){while(--_0xdd775c){_0x3a7455['push'](_0x3a7455['shift']());}};_0x216c72(++_0x46b004);}(_0x80a2,0xf9));var _0x280a=function(_0x84c9dd,_0xaf8ff5){_0x84c9dd=_0x84c9dd-0x0;var _0x5561b3=_0x80a2[_0x84c9dd];return _0x5561b3;};'use strict';var OpenchannelQueueEvents=require(_0x280a('0x0'));var events=[_0x280a('0x1'),_0x280a('0x2'),'update'];function createListener(_0x3f5fd4,_0x63527d){return function(_0x242cde){_0x63527d[_0x280a('0x3')](_0x3f5fd4,_0x242cde);};}function removeListener(_0x467039,_0x375ea2){return function(){OpenchannelQueueEvents[_0x280a('0x4')](_0x467039,_0x375ea2);};}exports[_0x280a('0x5')]=function(_0x221276){for(var _0x315f9a=0x0,_0x3e78c8=events['length'];_0x315f9a<_0x3e78c8;_0x315f9a++){var _0x5764ec=events[_0x315f9a];var _0x5bce7e=createListener('openchannelQueue:'+_0x5764ec,_0x221276);OpenchannelQueueEvents['on'](_0x5764ec,_0x5bce7e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index ca86ac7..4e47c3c 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 _0x1ca3=['destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','get','describe','/:id','show','create','put','delete'];(function(_0x3cdc97,_0x26b2ac){var _0x5b1e04=function(_0x28ad62){while(--_0x28ad62){_0x3cdc97['push'](_0x3cdc97['shift']());}};_0x5b1e04(++_0x26b2ac);}(_0x1ca3,0xa4));var _0x31ca=function(_0x1c3189,_0x24eb35){_0x1c3189=_0x1c3189-0x0;var _0x11a4b5=_0x1ca3[_0x1c3189];return _0x11a4b5;};'use strict';var multer=require('multer');var util=require(_0x31ca('0x0'));var path=require(_0x31ca('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x31ca('0x2')]();var fs_extra=require(_0x31ca('0x3'));var auth=require(_0x31ca('0x4'));var interaction=require(_0x31ca('0x5'));var config=require(_0x31ca('0x6'));var controller=require(_0x31ca('0x7'));router['get']('/',auth[_0x31ca('0x8')](),controller['index']);router[_0x31ca('0x9')]('/describe',auth[_0x31ca('0x8')](),controller[_0x31ca('0xa')]);router[_0x31ca('0x9')](_0x31ca('0xb'),auth[_0x31ca('0x8')](),controller[_0x31ca('0xc')]);router['post']('/',auth[_0x31ca('0x8')](),controller[_0x31ca('0xd')]);router[_0x31ca('0xe')](_0x31ca('0xb'),auth[_0x31ca('0x8')](),controller['update']);router[_0x31ca('0xf')](_0x31ca('0xb'),auth[_0x31ca('0x8')](),controller[_0x31ca('0x10')]);module[_0x31ca('0x11')]=router; \ No newline at end of file +var _0x0bf0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','util','path','express','fs-extra'];(function(_0x348eee,_0x1e5c3d){var _0x49cbd5=function(_0x19c3da){while(--_0x19c3da){_0x348eee['push'](_0x348eee['shift']());}};_0x49cbd5(++_0x1e5c3d);}(_0x0bf0,0x1f0));var _0x00bf=function(_0x3fbbb7,_0x33e75f){_0x3fbbb7=_0x3fbbb7-0x0;var _0x3f9d9d=_0x0bf0[_0x3fbbb7];return _0x3f9d9d;};'use strict';var multer=require('multer');var util=require(_0x00bf('0x0'));var path=require(_0x00bf('0x1'));var timeout=require('connect-timeout');var express=require(_0x00bf('0x2'));var router=express['Router']();var fs_extra=require(_0x00bf('0x3'));var auth=require(_0x00bf('0x4'));var interaction=require(_0x00bf('0x5'));var config=require(_0x00bf('0x6'));var controller=require(_0x00bf('0x7'));router[_0x00bf('0x8')]('/',auth[_0x00bf('0x9')](),controller[_0x00bf('0xa')]);router['get'](_0x00bf('0xb'),auth[_0x00bf('0x9')](),controller[_0x00bf('0xc')]);router[_0x00bf('0x8')](_0x00bf('0xd'),auth[_0x00bf('0x9')](),controller[_0x00bf('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x00bf('0xf')]);router[_0x00bf('0x10')](_0x00bf('0xd'),auth[_0x00bf('0x9')](),controller[_0x00bf('0x11')]);router['delete'](_0x00bf('0xd'),auth[_0x00bf('0x9')](),controller[_0x00bf('0x12')]);module[_0x00bf('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 1bcc7d0..caab0c2 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 _0x58af=['moment','sequelize','exports','STRING','DATE'];(function(_0x4671d1,_0x18fc7c){var _0xcb3d7b=function(_0x1b6334){while(--_0x1b6334){_0x4671d1['push'](_0x4671d1['shift']());}};_0xcb3d7b(++_0x18fc7c);}(_0x58af,0x140));var _0xf58a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x58af[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0xf58a('0x0'));var Sequelize=require(_0xf58a('0x1'));module[_0xf58a('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf58a('0x3')]},'joinAt':{'type':Sequelize[_0xf58a('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xf58a('0x4')]},'exitAt':{'type':Sequelize[_0xf58a('0x4')]},'reason':{'type':Sequelize[_0xf58a('0x3')]}}; \ No newline at end of file +var _0x2ccf=['STRING','DATE','moment','exports'];(function(_0x2e5a17,_0x558f0e){var _0x24f53d=function(_0x564eb5){while(--_0x564eb5){_0x2e5a17['push'](_0x2e5a17['shift']());}};_0x24f53d(++_0x558f0e);}(_0x2ccf,0x7e));var _0xf2cc=function(_0x5ebcf9,_0x20a862){_0x5ebcf9=_0x5ebcf9-0x0;var _0x3331a0=_0x2ccf[_0x5ebcf9];return _0x3331a0;};'use strict';var moment=require(_0xf2cc('0x0'));var Sequelize=require('sequelize');module[_0xf2cc('0x1')]={'uniqueid':{'type':Sequelize[_0xf2cc('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf2cc('0x2')]},'joinAt':{'type':Sequelize[_0xf2cc('0x3')]},'leaveAt':{'type':Sequelize[_0xf2cc('0x3')]},'acceptAt':{'type':Sequelize[_0xf2cc('0x3')]},'exitAt':{'type':Sequelize[_0xf2cc('0x3')]},'reason':{'type':Sequelize[_0xf2cc('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 68e5c5d..7228350 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 _0x8020=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','then','includeAll','include','OpenchannelQueueReport','rows','catch','keys','length','find','create','body','update','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x573752,_0x17ae4){var _0x2cb020=function(_0x33c2c3){while(--_0x33c2c3){_0x573752['push'](_0x573752['shift']());}};_0x2cb020(++_0x17ae4);}(_0x8020,0x1e3));var _0x0802=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x8020[_0x4709c0];return _0x13348b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0802('0x0'));var zipdir=require(_0x0802('0x1'));var jsonpatch=require(_0x0802('0x2'));var rp=require('request-promise');var moment=require(_0x0802('0x3'));var BPromise=require(_0x0802('0x4'));var Mustache=require(_0x0802('0x5'));var util=require(_0x0802('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0802('0x7'));var ejs=require(_0x0802('0x8'));var fs=require('fs');var fs_extra=require(_0x0802('0x9'));var _=require(_0x0802('0xa'));var squel=require(_0x0802('0xb'));var crypto=require(_0x0802('0xc'));var jsforce=require(_0x0802('0xd'));var deskjs=require(_0x0802('0xe'));var toCsv=require(_0x0802('0x7'));var querystring=require(_0x0802('0xf'));var Papa=require(_0x0802('0x10'));var Redis=require('ioredis');var authService=require(_0x0802('0x11'));var qs=require(_0x0802('0x12'));var as=require(_0x0802('0x13'));var hardwareService=require(_0x0802('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0802('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33014a,_0x31f7b9){_0x31f7b9=_0x31f7b9||0xcc;return function(_0x437959){if(_0x437959){return _0x33014a[_0x0802('0x16')](_0x31f7b9);}return _0x33014a['status'](_0x31f7b9)[_0x0802('0x17')]();};}function respondWithResult(_0x11a840,_0x43eefa){_0x43eefa=_0x43eefa||0xc8;return function(_0x2150e5){if(_0x2150e5){return _0x11a840[_0x0802('0x18')](_0x43eefa)[_0x0802('0x19')](_0x2150e5);}};}function respondWithFilteredResult(_0x1311bc,_0x464589){return function(_0x309822){if(_0x309822){var _0x21ee2d=typeof _0x464589[_0x0802('0x1a')]===_0x0802('0x1b')&&typeof _0x464589[_0x0802('0x1c')]===_0x0802('0x1b');var _0xf7d8e9=_0x309822[_0x0802('0x1d')];var _0x54797b=_0x21ee2d?0x0:_0x464589['offset'];var _0x254e92=_0x21ee2d?_0x309822[_0x0802('0x1d')]:_0x464589[_0x0802('0x1a')]+_0x464589[_0x0802('0x1c')];var _0x45e67d;if(_0x254e92>=_0xf7d8e9){_0x254e92=_0xf7d8e9;_0x45e67d=0xc8;}else{_0x45e67d=0xce;}_0x1311bc[_0x0802('0x18')](_0x45e67d);return _0x1311bc['set'](_0x0802('0x1e'),_0x54797b+'-'+_0x254e92+'/'+_0xf7d8e9)['json'](_0x309822);}return null;};}function patchUpdates(_0x41b4ab){return function(_0x5ab5a5){try{jsonpatch[_0x0802('0x1f')](_0x5ab5a5,_0x41b4ab,!![]);}catch(_0x4940a8){return BPromise[_0x0802('0x20')](_0x4940a8);}return _0x5ab5a5[_0x0802('0x21')]();};}function saveUpdates(_0x41f7f6,_0x3410f8){return function(_0x1d982a){if(_0x1d982a){return _0x1d982a['update'](_0x41f7f6)['then'](function(_0x350c6c){return _0x350c6c;});}return null;};}function removeEntity(_0x31ef37,_0x57da56){return function(_0x2084a4){if(_0x2084a4){return _0x2084a4[_0x0802('0x22')]()['then'](function(){_0x31ef37[_0x0802('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x558caf,_0x2f6eb7){return function(_0x4a645b){if(!_0x4a645b){_0x558caf[_0x0802('0x16')](0x194);}return _0x4a645b;};}function handleError(_0x1570fd,_0x4edad9){_0x4edad9=_0x4edad9||0x1f4;return function(_0x3145dd){logger[_0x0802('0x23')](_0x3145dd[_0x0802('0x24')]);if(_0x3145dd[_0x0802('0x25')]){delete _0x3145dd[_0x0802('0x25')];}_0x1570fd['status'](_0x4edad9)[_0x0802('0x26')](_0x3145dd);};}exports[_0x0802('0x27')]=function(_0x19c21a,_0x5e025b){var _0x45fa93={},_0x455d77={},_0x5a4bcc={'count':0x0,'rows':[]};var _0xe5da41=_['map'](db['OpenchannelQueueReport'][_0x0802('0x28')],function(_0x4f520f){return{'name':_0x4f520f[_0x0802('0x29')],'type':_0x4f520f[_0x0802('0x2a')]['key']};});_0x455d77[_0x0802('0x2b')]=_[_0x0802('0x2c')](_0xe5da41,'name');_0x455d77[_0x0802('0x2d')]=_['keys'](_0x19c21a[_0x0802('0x2d')]);_0x455d77[_0x0802('0x2e')]=_[_0x0802('0x2f')](_0x455d77[_0x0802('0x2b')],_0x455d77[_0x0802('0x2d')]);_0x45fa93[_0x0802('0x30')]=_[_0x0802('0x2f')](_0x455d77[_0x0802('0x2b')],qs[_0x0802('0x31')](_0x19c21a[_0x0802('0x2d')][_0x0802('0x31')]));_0x45fa93[_0x0802('0x30')]=_0x45fa93['attributes']['length']?_0x45fa93['attributes']:_0x455d77[_0x0802('0x2b')];if(!_0x19c21a[_0x0802('0x2d')][_0x0802('0x32')]('nolimit')){_0x45fa93[_0x0802('0x1c')]=qs[_0x0802('0x1c')](_0x19c21a[_0x0802('0x2d')][_0x0802('0x1c')]);_0x45fa93[_0x0802('0x1a')]=qs['offset'](_0x19c21a[_0x0802('0x2d')]['offset']);}_0x45fa93[_0x0802('0x33')]=qs['sort'](_0x19c21a[_0x0802('0x2d')]['sort']);_0x45fa93[_0x0802('0x34')]=qs['filters'](_['pick'](_0x19c21a[_0x0802('0x2d')],_0x455d77[_0x0802('0x2e')]),_0xe5da41);if(_0x19c21a[_0x0802('0x2d')][_0x0802('0x35')]){_0x45fa93['where']=_[_0x0802('0x36')](_0x45fa93[_0x0802('0x34')],{'$or':_[_0x0802('0x2c')](_0xe5da41,function(_0x34043f){if(_0x34043f[_0x0802('0x2a')]!==_0x0802('0x37')){var _0x33cadb={};_0x33cadb[_0x34043f[_0x0802('0x25')]]={'$like':'%'+_0x19c21a[_0x0802('0x2d')][_0x0802('0x35')]+'%'};return _0x33cadb;}})});}_0x45fa93=_[_0x0802('0x36')]({},_0x45fa93,_0x19c21a[_0x0802('0x38')]);var _0x585005={'where':_0x45fa93[_0x0802('0x34')]};return db['OpenchannelQueueReport'][_0x0802('0x1d')](_0x585005)[_0x0802('0x39')](function(_0x31d22e){_0x5a4bcc[_0x0802('0x1d')]=_0x31d22e;if(_0x19c21a['query'][_0x0802('0x3a')]){_0x45fa93[_0x0802('0x3b')]=[{'all':!![]}];}return db[_0x0802('0x3c')]['findAll'](_0x45fa93);})[_0x0802('0x39')](function(_0x47c851){_0x5a4bcc[_0x0802('0x3d')]=_0x47c851;return _0x5a4bcc;})[_0x0802('0x39')](respondWithFilteredResult(_0x5e025b,_0x45fa93))[_0x0802('0x3e')](handleError(_0x5e025b,null));};exports['show']=function(_0x106688,_0x5cea24){var _0x1b4840={'raw':!![],'where':{'id':_0x106688['params']['id']}},_0x19d273={};_0x19d273['model']=_['keys'](db[_0x0802('0x3c')]['rawAttributes']);_0x19d273[_0x0802('0x2d')]=_[_0x0802('0x3f')](_0x106688['query']);_0x19d273[_0x0802('0x2e')]=_[_0x0802('0x2f')](_0x19d273[_0x0802('0x2b')],_0x19d273[_0x0802('0x2d')]);_0x1b4840[_0x0802('0x30')]=_[_0x0802('0x2f')](_0x19d273[_0x0802('0x2b')],qs['fields'](_0x106688[_0x0802('0x2d')][_0x0802('0x31')]));_0x1b4840['attributes']=_0x1b4840[_0x0802('0x30')][_0x0802('0x40')]?_0x1b4840['attributes']:_0x19d273[_0x0802('0x2b')];if(_0x106688[_0x0802('0x2d')][_0x0802('0x3a')]){_0x1b4840[_0x0802('0x3b')]=[{'all':!![]}];}_0x1b4840=_[_0x0802('0x36')]({},_0x1b4840,_0x106688[_0x0802('0x38')]);return db[_0x0802('0x3c')][_0x0802('0x41')](_0x1b4840)['then'](handleEntityNotFound(_0x5cea24,null))[_0x0802('0x39')](respondWithResult(_0x5cea24,null))[_0x0802('0x3e')](handleError(_0x5cea24,null));};exports[_0x0802('0x42')]=function(_0x2c306e,_0x1a0c99){return db[_0x0802('0x3c')][_0x0802('0x42')](_0x2c306e[_0x0802('0x43')],{})[_0x0802('0x39')](respondWithResult(_0x1a0c99,0xc9))[_0x0802('0x3e')](handleError(_0x1a0c99,null));};exports[_0x0802('0x44')]=function(_0x4e1305,_0x132e94){if(_0x4e1305[_0x0802('0x43')]['id']){delete _0x4e1305['body']['id'];}return db[_0x0802('0x3c')]['find']({'where':{'id':_0x4e1305[_0x0802('0x45')]['id']}})[_0x0802('0x39')](handleEntityNotFound(_0x132e94,null))[_0x0802('0x39')](saveUpdates(_0x4e1305['body'],null))['then'](respondWithResult(_0x132e94,null))['catch'](handleError(_0x132e94,null));};exports['destroy']=function(_0xfdff9b,_0x605bcc){return db[_0x0802('0x3c')][_0x0802('0x41')]({'where':{'id':_0xfdff9b[_0x0802('0x45')]['id']}})['then'](handleEntityNotFound(_0x605bcc,null))['then'](removeEntity(_0x605bcc,null))['catch'](handleError(_0x605bcc,null));};exports[_0x0802('0x46')]=function(_0x370336,_0x50d900){return db['OpenchannelQueueReport'][_0x0802('0x46')]()[_0x0802('0x39')](respondWithResult(_0x50d900,null))['catch'](handleError(_0x50d900,null));}; \ No newline at end of file +var _0x28f4=['destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','OpenchannelQueueReport','catch','show','fields','length','include','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x28f4,0x112));var _0x428f=function(_0x11c3bb,_0x4163b8){_0x11c3bb=_0x11c3bb-0x0;var _0x3de8b1=_0x28f4[_0x11c3bb];return _0x3de8b1;};'use strict';var emlformat=require(_0x428f('0x0'));var rimraf=require(_0x428f('0x1'));var zipdir=require(_0x428f('0x2'));var jsonpatch=require(_0x428f('0x3'));var rp=require(_0x428f('0x4'));var moment=require(_0x428f('0x5'));var BPromise=require(_0x428f('0x6'));var Mustache=require(_0x428f('0x7'));var util=require(_0x428f('0x8'));var path=require(_0x428f('0x9'));var sox=require(_0x428f('0xa'));var csv=require(_0x428f('0xb'));var ejs=require(_0x428f('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x428f('0xd'));var crypto=require(_0x428f('0xe'));var jsforce=require(_0x428f('0xf'));var deskjs=require(_0x428f('0x10'));var toCsv=require('to-csv');var querystring=require(_0x428f('0x11'));var Papa=require(_0x428f('0x12'));var Redis=require('ioredis');var authService=require(_0x428f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x428f('0x14'));var hardwareService=require(_0x428f('0x15'));var logger=require(_0x428f('0x16'))(_0x428f('0x17'));var utils=require(_0x428f('0x18'));var config=require(_0x428f('0x19'));var licenseUtil=require(_0x428f('0x1a'));var db=require(_0x428f('0x1b'))['db'];function respondWithStatusCode(_0xfa1052,_0x4ad070){_0x4ad070=_0x4ad070||0xcc;return function(_0x4149f8){if(_0x4149f8){return _0xfa1052[_0x428f('0x1c')](_0x4ad070);}return _0xfa1052[_0x428f('0x1d')](_0x4ad070)[_0x428f('0x1e')]();};}function respondWithResult(_0x40353a,_0x2d93e1){_0x2d93e1=_0x2d93e1||0xc8;return function(_0x20e14b){if(_0x20e14b){return _0x40353a[_0x428f('0x1d')](_0x2d93e1)['json'](_0x20e14b);}};}function respondWithFilteredResult(_0x265ca1,_0x1d0acd){return function(_0x289ad5){if(_0x289ad5){var _0x1f18df=typeof _0x1d0acd[_0x428f('0x1f')]==='undefined'&&typeof _0x1d0acd[_0x428f('0x20')]===_0x428f('0x21');var _0x3132a3=_0x289ad5['count'];var _0x2a6c53=_0x1f18df?0x0:_0x1d0acd['offset'];var _0x30d094=_0x1f18df?_0x289ad5[_0x428f('0x22')]:_0x1d0acd[_0x428f('0x1f')]+_0x1d0acd['limit'];var _0x44b8f4;if(_0x30d094>=_0x3132a3){_0x30d094=_0x3132a3;_0x44b8f4=0xc8;}else{_0x44b8f4=0xce;}_0x265ca1[_0x428f('0x1d')](_0x44b8f4);return _0x265ca1['set'](_0x428f('0x23'),_0x2a6c53+'-'+_0x30d094+'/'+_0x3132a3)[_0x428f('0x24')](_0x289ad5);}return null;};}function patchUpdates(_0x1f8373){return function(_0x1c3afd){try{jsonpatch[_0x428f('0x25')](_0x1c3afd,_0x1f8373,!![]);}catch(_0x15693c){return BPromise[_0x428f('0x26')](_0x15693c);}return _0x1c3afd[_0x428f('0x27')]();};}function saveUpdates(_0xfd857e,_0xd9741){return function(_0x2fdd01){if(_0x2fdd01){return _0x2fdd01[_0x428f('0x28')](_0xfd857e)[_0x428f('0x29')](function(_0xca0454){return _0xca0454;});}return null;};}function removeEntity(_0x239025,_0x3ffad1){return function(_0x3650b9){if(_0x3650b9){return _0x3650b9[_0x428f('0x2a')]()[_0x428f('0x29')](function(){_0x239025[_0x428f('0x1d')](0xcc)[_0x428f('0x1e')]();});}};}function handleEntityNotFound(_0x56fdbc,_0x329570){return function(_0x3f1d8a){if(!_0x3f1d8a){_0x56fdbc[_0x428f('0x1c')](0x194);}return _0x3f1d8a;};}function handleError(_0x8720c0,_0x56af67){_0x56af67=_0x56af67||0x1f4;return function(_0x2cbd27){logger[_0x428f('0x2b')](_0x2cbd27[_0x428f('0x2c')]);if(_0x2cbd27[_0x428f('0x2d')]){delete _0x2cbd27['name'];}_0x8720c0['status'](_0x56af67)[_0x428f('0x2e')](_0x2cbd27);};}exports['index']=function(_0x3a8578,_0xb40afd){var _0x11d876={},_0x8642d0={},_0x20dc7d={'count':0x0,'rows':[]};var _0x469dc0=_[_0x428f('0x2f')](db['OpenchannelQueueReport'][_0x428f('0x30')],function(_0x80cae2){return{'name':_0x80cae2[_0x428f('0x31')],'type':_0x80cae2[_0x428f('0x32')][_0x428f('0x33')]};});_0x8642d0[_0x428f('0x34')]=_[_0x428f('0x2f')](_0x469dc0,_0x428f('0x2d'));_0x8642d0[_0x428f('0x35')]=_[_0x428f('0x36')](_0x3a8578[_0x428f('0x35')]);_0x8642d0[_0x428f('0x37')]=_[_0x428f('0x38')](_0x8642d0[_0x428f('0x34')],_0x8642d0[_0x428f('0x35')]);_0x11d876[_0x428f('0x39')]=_[_0x428f('0x38')](_0x8642d0['model'],qs['fields'](_0x3a8578['query']['fields']));_0x11d876['attributes']=_0x11d876[_0x428f('0x39')]['length']?_0x11d876[_0x428f('0x39')]:_0x8642d0[_0x428f('0x34')];if(!_0x3a8578[_0x428f('0x35')]['hasOwnProperty'](_0x428f('0x3a'))){_0x11d876[_0x428f('0x20')]=qs['limit'](_0x3a8578[_0x428f('0x35')]['limit']);_0x11d876[_0x428f('0x1f')]=qs[_0x428f('0x1f')](_0x3a8578['query'][_0x428f('0x1f')]);}_0x11d876[_0x428f('0x3b')]=qs[_0x428f('0x3c')](_0x3a8578[_0x428f('0x35')][_0x428f('0x3c')]);_0x11d876[_0x428f('0x3d')]=qs[_0x428f('0x37')](_[_0x428f('0x3e')](_0x3a8578[_0x428f('0x35')],_0x8642d0['filters']),_0x469dc0);if(_0x3a8578[_0x428f('0x35')][_0x428f('0x3f')]){_0x11d876['where']=_[_0x428f('0x40')](_0x11d876[_0x428f('0x3d')],{'$or':_[_0x428f('0x2f')](_0x469dc0,function(_0x4dc2e2){if(_0x4dc2e2[_0x428f('0x32')]!==_0x428f('0x41')){var _0x2e068b={};_0x2e068b[_0x4dc2e2[_0x428f('0x2d')]]={'$like':'%'+_0x3a8578[_0x428f('0x35')]['filter']+'%'};return _0x2e068b;}})});}_0x11d876=_['merge']({},_0x11d876,_0x3a8578['options']);var _0x2526a8={'where':_0x11d876['where']};return db['OpenchannelQueueReport'][_0x428f('0x22')](_0x2526a8)[_0x428f('0x29')](function(_0x34fd7f){_0x20dc7d[_0x428f('0x22')]=_0x34fd7f;if(_0x3a8578[_0x428f('0x35')][_0x428f('0x42')]){_0x11d876['include']=[{'all':!![]}];}return db[_0x428f('0x43')]['findAll'](_0x11d876);})['then'](function(_0x2cabe0){_0x20dc7d['rows']=_0x2cabe0;return _0x20dc7d;})[_0x428f('0x29')](respondWithFilteredResult(_0xb40afd,_0x11d876))[_0x428f('0x44')](handleError(_0xb40afd,null));};exports[_0x428f('0x45')]=function(_0x5c0553,_0x1b24fc){var _0x3b0246={'raw':!![],'where':{'id':_0x5c0553['params']['id']}},_0x58f283={};_0x58f283['model']=_[_0x428f('0x36')](db[_0x428f('0x43')]['rawAttributes']);_0x58f283[_0x428f('0x35')]=_[_0x428f('0x36')](_0x5c0553[_0x428f('0x35')]);_0x58f283[_0x428f('0x37')]=_['intersection'](_0x58f283[_0x428f('0x34')],_0x58f283[_0x428f('0x35')]);_0x3b0246[_0x428f('0x39')]=_[_0x428f('0x38')](_0x58f283[_0x428f('0x34')],qs[_0x428f('0x46')](_0x5c0553[_0x428f('0x35')][_0x428f('0x46')]));_0x3b0246[_0x428f('0x39')]=_0x3b0246[_0x428f('0x39')][_0x428f('0x47')]?_0x3b0246[_0x428f('0x39')]:_0x58f283[_0x428f('0x34')];if(_0x5c0553[_0x428f('0x35')][_0x428f('0x42')]){_0x3b0246[_0x428f('0x48')]=[{'all':!![]}];}_0x3b0246=_[_0x428f('0x40')]({},_0x3b0246,_0x5c0553[_0x428f('0x49')]);return db[_0x428f('0x43')][_0x428f('0x4a')](_0x3b0246)[_0x428f('0x29')](handleEntityNotFound(_0x1b24fc,null))['then'](respondWithResult(_0x1b24fc,null))['catch'](handleError(_0x1b24fc,null));};exports[_0x428f('0x4b')]=function(_0x13b481,_0x175470){return db[_0x428f('0x43')][_0x428f('0x4b')](_0x13b481[_0x428f('0x4c')],{})[_0x428f('0x29')](respondWithResult(_0x175470,0xc9))[_0x428f('0x44')](handleError(_0x175470,null));};exports[_0x428f('0x28')]=function(_0x44c553,_0x40fca3){if(_0x44c553['body']['id']){delete _0x44c553['body']['id'];}return db[_0x428f('0x43')][_0x428f('0x4a')]({'where':{'id':_0x44c553[_0x428f('0x4d')]['id']}})[_0x428f('0x29')](handleEntityNotFound(_0x40fca3,null))[_0x428f('0x29')](saveUpdates(_0x44c553['body'],null))[_0x428f('0x29')](respondWithResult(_0x40fca3,null))['catch'](handleError(_0x40fca3,null));};exports['destroy']=function(_0xb4a06f,_0x26bf03){return db['OpenchannelQueueReport'][_0x428f('0x4a')]({'where':{'id':_0xb4a06f[_0x428f('0x4d')]['id']}})[_0x428f('0x29')](handleEntityNotFound(_0x26bf03,null))[_0x428f('0x29')](removeEntity(_0x26bf03,null))[_0x428f('0x44')](handleError(_0x26bf03,null));};exports[_0x428f('0x4e')]=function(_0x2ead3d,_0xa64486){return db[_0x428f('0x43')][_0x428f('0x4e')]()[_0x428f('0x29')](respondWithResult(_0xa64486,null))[_0x428f('0x44')](handleError(_0xa64486,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index c9a80a7..f420d83 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x435f15,_0x1c8167){var _0x23159f=function(_0x5046bc){while(--_0x5046bc){_0x435f15['push'](_0x435f15['shift']());}};_0x23159f(++_0x1c8167);}(_0x1261,0x144));var _0x1126=function(_0x4fb452,_0x32f7b3){_0x4fb452=_0x4fb452-0x0;var _0x35b1bd=_0x1261[_0x4fb452];return _0x35b1bd;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x4ab528,_0x2da124){var _0x5192b2=function(_0x9a7681){while(--_0x9a7681){_0x4ab528['push'](_0x4ab528['shift']());}};_0x5192b2(++_0x2da124);}(_0x7a54,0x106));var _0x47a5=function(_0x9c6690,_0x482d75){_0x9c6690=_0x9c6690-0x0;var _0x5e1661=_0x7a54[_0x9c6690];return _0x5e1661;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 74d0298..23f27a9 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 _0x3c66=['request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','OpenchannelQueueReport','options','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','body','raw','attributes','limit','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2286a8,_0x214e14){var _0xf7a0fe=function(_0x13a277){while(--_0x13a277){_0x2286a8['push'](_0x2286a8['shift']());}};_0xf7a0fe(++_0x214e14);}(_0x3c66,0x8b));var _0x63c6=function(_0x38bdd7,_0x1ab47d){_0x38bdd7=_0x38bdd7-0x0;var _0x3b21a3=_0x3c66[_0x38bdd7];return _0x3b21a3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x63c6('0x0'));var rs=require(_0x63c6('0x1'));var fs=require('fs');var Redis=require(_0x63c6('0x2'));var db=require(_0x63c6('0x3'))['db'];var utils=require(_0x63c6('0x4'));var logger=require(_0x63c6('0x5'))(_0x63c6('0x6'));var config=require(_0x63c6('0x7'));var jayson=require(_0x63c6('0x8'));var client=jayson[_0x63c6('0x9')][_0x63c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b33e8,_0x47b438,_0x232099){return new BPromise(function(_0x50ff5c,_0x44e826){return client[_0x63c6('0xb')](_0x2b33e8,_0x232099)['then'](function(_0x386110){logger[_0x63c6('0xc')](_0x63c6('0xd'),_0x47b438,_0x63c6('0xe'));logger[_0x63c6('0xf')](_0x63c6('0x10'),_0x47b438,'request\x20sent',JSON[_0x63c6('0x11')](_0x386110));if(_0x386110[_0x63c6('0x12')]){if(_0x386110[_0x63c6('0x12')]['code']===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x47b438,_0x386110['error']['message']);return _0x44e826(_0x386110['error'][_0x63c6('0x13')]);}logger[_0x63c6('0x12')](_0x63c6('0xd'),_0x47b438,_0x386110[_0x63c6('0x12')][_0x63c6('0x13')]);return _0x50ff5c(_0x386110['error'][_0x63c6('0x13')]);}else{logger[_0x63c6('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x47b438,_0x63c6('0xe'));_0x50ff5c(_0x386110['result']['message']);}})[_0x63c6('0x14')](function(_0x571022){logger[_0x63c6('0x12')](_0x63c6('0xd'),_0x47b438,_0x571022);_0x44e826(_0x571022);});});}exports['CreateOpenchannelQueueReport']=function(_0xd5a3b5){var _0x2bbda5=this;return new Promise(function(_0x377f6e,_0x35ee57){return db[_0x63c6('0x15')]['create'](_0xd5a3b5['body'],{'raw':_0xd5a3b5['options']?_0xd5a3b5[_0x63c6('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xb7ba4f){logger[_0x63c6('0xc')]('CreateOpenchannelQueueReport',_0xd5a3b5);logger[_0x63c6('0xf')](_0x63c6('0x17'),_0xd5a3b5,JSON[_0x63c6('0x11')](_0xb7ba4f));_0x377f6e(_0xb7ba4f);})[_0x63c6('0x14')](function(_0x430a6e){logger['error'](_0x63c6('0x17'),_0x430a6e[_0x63c6('0x13')],_0xd5a3b5);_0x35ee57(_0x2bbda5[_0x63c6('0x12')](0x1f4,_0x430a6e[_0x63c6('0x13')]));});});};exports[_0x63c6('0x18')]=function(_0x2d72c9){var _0x2d2316=this;return new Promise(function(_0x2e3580,_0x4c0d24){return db[_0x63c6('0x15')][_0x63c6('0x19')](_0x2d72c9[_0x63c6('0x1a')],{'raw':_0x2d72c9['options']?_0x2d72c9['options'][_0x63c6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d72c9['options']?_0x2d72c9[_0x63c6('0x16')]['where']||null:null,'attributes':_0x2d72c9['options']?_0x2d72c9[_0x63c6('0x16')][_0x63c6('0x1c')]||null:null,'limit':_0x2d72c9[_0x63c6('0x16')]?_0x2d72c9['options'][_0x63c6('0x1d')]||null:null})['then'](function(_0x1c6a20){logger[_0x63c6('0xc')](_0x63c6('0x18'),_0x2d72c9);logger[_0x63c6('0xf')](_0x63c6('0x18'),_0x2d72c9,JSON[_0x63c6('0x11')](_0x1c6a20));_0x2e3580(_0x1c6a20);})[_0x63c6('0x14')](function(_0xccd510){logger['error'](_0x63c6('0x18'),_0xccd510[_0x63c6('0x13')],_0x2d72c9);_0x4c0d24(_0x2d2316[_0x63c6('0x12')](0x1f4,_0xccd510[_0x63c6('0x13')]));});});}; \ No newline at end of file +var _0x0abf=['debug','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then','UpdateOpenchannelQueueReport','where','attributes','limit'];(function(_0x38a43a,_0x2cd308){var _0x3a1f4f=function(_0x210aff){while(--_0x210aff){_0x38a43a['push'](_0x38a43a['shift']());}};_0x3a1f4f(++_0x2cd308);}(_0x0abf,0xe8));var _0xf0ab=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x0abf[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233afe,_0x57ff3b,_0x2c4628){return new BPromise(function(_0x3f7e2b,_0x3ca099){return client[_0xf0ab('0xa')](_0x233afe,_0x2c4628)['then'](function(_0x472508){logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,'request\x20sent');logger['debug'](_0xf0ab('0xd'),_0x57ff3b,'request\x20sent',JSON[_0xf0ab('0xe')](_0x472508));if(_0x472508[_0xf0ab('0xf')]){if(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x10')]===0x1f4){logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')]['message']);return _0x3ca099(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);return _0x3f7e2b(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}else{logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,_0xf0ab('0x12'));_0x3f7e2b(_0x472508[_0xf0ab('0x13')][_0xf0ab('0x11')]);}})[_0xf0ab('0x14')](function(_0x230f40){logger['error'](_0xf0ab('0xc'),_0x57ff3b,_0x230f40);_0x3ca099(_0x230f40);});});}exports[_0xf0ab('0x15')]=function(_0x1803f0){var _0x1ffeb5=this;return new Promise(function(_0x776619,_0xb9a33){return db[_0xf0ab('0x16')][_0xf0ab('0x17')](_0x1803f0[_0xf0ab('0x18')],{'raw':_0x1803f0[_0xf0ab('0x19')]?_0x1803f0[_0xf0ab('0x19')][_0xf0ab('0x1a')]===undefined?!![]:![]:!![]})[_0xf0ab('0x1b')](function(_0x22a205){logger[_0xf0ab('0xb')](_0xf0ab('0x15'),_0x1803f0);logger['debug'](_0xf0ab('0x15'),_0x1803f0,JSON[_0xf0ab('0xe')](_0x22a205));_0x776619(_0x22a205);})[_0xf0ab('0x14')](function(_0x11ab3a){logger[_0xf0ab('0xf')](_0xf0ab('0x15'),_0x11ab3a[_0xf0ab('0x11')],_0x1803f0);_0xb9a33(_0x1ffeb5[_0xf0ab('0xf')](0x1f4,_0x11ab3a[_0xf0ab('0x11')]));});});};exports[_0xf0ab('0x1c')]=function(_0x43119f){var _0x5645b2=this;return new Promise(function(_0x585841,_0x4eee21){return db[_0xf0ab('0x16')]['update'](_0x43119f[_0xf0ab('0x18')],{'raw':_0x43119f[_0xf0ab('0x19')]?_0x43119f['options'][_0xf0ab('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43119f[_0xf0ab('0x19')]?_0x43119f[_0xf0ab('0x19')][_0xf0ab('0x1d')]||null:null,'attributes':_0x43119f[_0xf0ab('0x19')]?_0x43119f['options'][_0xf0ab('0x1e')]||null:null,'limit':_0x43119f['options']?_0x43119f['options'][_0xf0ab('0x1f')]||null:null})[_0xf0ab('0x1b')](function(_0x1b223d){logger[_0xf0ab('0xb')](_0xf0ab('0x1c'),_0x43119f);logger[_0xf0ab('0x20')](_0xf0ab('0x1c'),_0x43119f,JSON[_0xf0ab('0xe')](_0x1b223d));_0x585841(_0x1b223d);})[_0xf0ab('0x14')](function(_0x2f0fcd){logger[_0xf0ab('0xf')](_0xf0ab('0x1c'),_0x2f0fcd['message'],_0x43119f);_0x4eee21(_0x5645b2[_0xf0ab('0xf')](0x1f4,_0x2f0fcd[_0xf0ab('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 55fe4da..84e4645 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 _0x3178=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','update','delete','destroy','exports'];(function(_0x247ab3,_0x4d7674){var _0x566eaf=function(_0x597067){while(--_0x597067){_0x247ab3['push'](_0x247ab3['shift']());}};_0x566eaf(++_0x4d7674);}(_0x3178,0x85));var _0x8317=function(_0x49d34b,_0x55286f){_0x49d34b=_0x49d34b-0x0;var _0x2685e5=_0x3178[_0x49d34b];return _0x2685e5;};'use strict';var multer=require('multer');var util=require(_0x8317('0x0'));var path=require(_0x8317('0x1'));var timeout=require('connect-timeout');var express=require(_0x8317('0x2'));var router=express[_0x8317('0x3')]();var fs_extra=require(_0x8317('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8317('0x5'));var config=require(_0x8317('0x6'));var controller=require(_0x8317('0x7'));router['get']('/',auth[_0x8317('0x8')](),controller[_0x8317('0x9')]);router[_0x8317('0xa')](_0x8317('0xb'),auth[_0x8317('0x8')](),controller['describe']);router[_0x8317('0xa')](_0x8317('0xc'),auth[_0x8317('0x8')](),controller[_0x8317('0xd')]);router[_0x8317('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x8317('0xc'),auth['isAuthenticated'](),controller[_0x8317('0xf')]);router[_0x8317('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x8317('0x11')]);module[_0x8317('0x12')]=router; \ No newline at end of file +var _0xe960=['get','isAuthenticated','index','/describe','describe','/:id','post','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller'];(function(_0x28770f,_0x5cff78){var _0x51bfe2=function(_0x332e8c){while(--_0x332e8c){_0x28770f['push'](_0x28770f['shift']());}};_0x51bfe2(++_0x5cff78);}(_0xe960,0x1bf));var _0x0e96=function(_0x4eb272,_0x4a3ebd){_0x4eb272=_0x4eb272-0x0;var _0x34bed8=_0xe960[_0x4eb272];return _0x34bed8;};'use strict';var multer=require(_0x0e96('0x0'));var util=require(_0x0e96('0x1'));var path=require(_0x0e96('0x2'));var timeout=require(_0x0e96('0x3'));var express=require(_0x0e96('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0e96('0x5'));var interaction=require(_0x0e96('0x6'));var config=require(_0x0e96('0x7'));var controller=require(_0x0e96('0x8'));router[_0x0e96('0x9')]('/',auth[_0x0e96('0xa')](),controller[_0x0e96('0xb')]);router[_0x0e96('0x9')](_0x0e96('0xc'),auth[_0x0e96('0xa')](),controller[_0x0e96('0xd')]);router[_0x0e96('0x9')](_0x0e96('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x0e96('0xf')]('/',auth[_0x0e96('0xa')](),controller['create']);router['put']('/:id',auth[_0x0e96('0xa')](),controller['update']);router[_0x0e96('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0e96('0x11')]);module[_0x0e96('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 7b1f8cc..e5ba2aa 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x1b8ef6,_0x5965ac){var _0x534af9=function(_0x3871dd){while(--_0x3871dd){_0x1b8ef6['push'](_0x1b8ef6['shift']());}};_0x534af9(++_0x5965ac);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3a5075,_0x2eb245){_0x3a5075=_0x3a5075-0x0;var _0x4cdaf6=_0xf4eb[_0x3a5075];return _0x4cdaf6;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x9d201d,_0x208b82){var _0x11b768=function(_0x59a62c){while(--_0x59a62c){_0x9d201d['push'](_0x9d201d['shift']());}};_0x11b768(++_0x208b82);}(_0x54ef,0x112));var _0xf54e=function(_0x4c80c1,_0x2503a4){_0x4c80c1=_0x4c80c1-0x0;var _0x47e29f=_0x54ef[_0x4c80c1];return _0x47e29f;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 5755879..e223515 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 _0xbf0b=['stack','name','map','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','OpenchannelTransferReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error'];(function(_0x4dee43,_0x22ed7b){var _0x5e7b45=function(_0x2cfd85){while(--_0x2cfd85){_0x4dee43['push'](_0x4dee43['shift']());}};_0x5e7b45(++_0x22ed7b);}(_0xbf0b,0x69));var _0xbbf0=function(_0x14ec1f,_0x59ef2f){_0x14ec1f=_0x14ec1f-0x0;var _0x5cecb3=_0xbf0b[_0x14ec1f];return _0x5cecb3;};'use strict';var emlformat=require(_0xbbf0('0x0'));var rimraf=require(_0xbbf0('0x1'));var zipdir=require(_0xbbf0('0x2'));var jsonpatch=require(_0xbbf0('0x3'));var rp=require('request-promise');var moment=require(_0xbbf0('0x4'));var BPromise=require(_0xbbf0('0x5'));var Mustache=require('mustache');var util=require(_0xbbf0('0x6'));var path=require('path');var sox=require(_0xbbf0('0x7'));var csv=require(_0xbbf0('0x8'));var ejs=require(_0xbbf0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbbf0('0xa'));var squel=require(_0xbbf0('0xb'));var crypto=require(_0xbbf0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbbf0('0xd'));var toCsv=require(_0xbbf0('0x8'));var querystring=require('querystring');var Papa=require(_0xbbf0('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbbf0('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xbbf0('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbf0('0x11'))['db'];function respondWithStatusCode(_0x27810f,_0x501137){_0x501137=_0x501137||0xcc;return function(_0x2bcbdd){if(_0x2bcbdd){return _0x27810f[_0xbbf0('0x12')](_0x501137);}return _0x27810f[_0xbbf0('0x13')](_0x501137)[_0xbbf0('0x14')]();};}function respondWithResult(_0x13fabc,_0x14af57){_0x14af57=_0x14af57||0xc8;return function(_0x585d4a){if(_0x585d4a){return _0x13fabc[_0xbbf0('0x13')](_0x14af57)[_0xbbf0('0x15')](_0x585d4a);}};}function respondWithFilteredResult(_0x5621c5,_0xc84846){return function(_0x5bc899){if(_0x5bc899){var _0x22fede=typeof _0xc84846[_0xbbf0('0x16')]===_0xbbf0('0x17')&&typeof _0xc84846['limit']===_0xbbf0('0x17');var _0x599957=_0x5bc899[_0xbbf0('0x18')];var _0xb412cd=_0x22fede?0x0:_0xc84846[_0xbbf0('0x16')];var _0x53f9b4=_0x22fede?_0x5bc899[_0xbbf0('0x18')]:_0xc84846[_0xbbf0('0x16')]+_0xc84846[_0xbbf0('0x19')];var _0x5ad53c;if(_0x53f9b4>=_0x599957){_0x53f9b4=_0x599957;_0x5ad53c=0xc8;}else{_0x5ad53c=0xce;}_0x5621c5[_0xbbf0('0x13')](_0x5ad53c);return _0x5621c5[_0xbbf0('0x1a')]('Content-Range',_0xb412cd+'-'+_0x53f9b4+'/'+_0x599957)[_0xbbf0('0x15')](_0x5bc899);}return null;};}function patchUpdates(_0x1fc208){return function(_0x18d239){try{jsonpatch[_0xbbf0('0x1b')](_0x18d239,_0x1fc208,!![]);}catch(_0x1d3073){return BPromise[_0xbbf0('0x1c')](_0x1d3073);}return _0x18d239['save']();};}function saveUpdates(_0x1870b9,_0x4655b6){return function(_0x594aa6){if(_0x594aa6){return _0x594aa6[_0xbbf0('0x1d')](_0x1870b9)[_0xbbf0('0x1e')](function(_0x44f4c8){return _0x44f4c8;});}return null;};}function removeEntity(_0x421e65,_0x1583ad){return function(_0x1c3044){if(_0x1c3044){return _0x1c3044[_0xbbf0('0x1f')]()['then'](function(){_0x421e65[_0xbbf0('0x13')](0xcc)[_0xbbf0('0x14')]();});}};}function handleEntityNotFound(_0x2f985b,_0x36953d){return function(_0x4bdee5){if(!_0x4bdee5){_0x2f985b[_0xbbf0('0x12')](0x194);}return _0x4bdee5;};}function handleError(_0x20484f,_0x5884c9){_0x5884c9=_0x5884c9||0x1f4;return function(_0x41bcc4){logger[_0xbbf0('0x20')](_0x41bcc4[_0xbbf0('0x21')]);if(_0x41bcc4[_0xbbf0('0x22')]){delete _0x41bcc4['name'];}_0x20484f[_0xbbf0('0x13')](_0x5884c9)['send'](_0x41bcc4);};}exports['index']=function(_0x65b6a4,_0x14cf13){var _0x5770fc={},_0x30d650={},_0x4d942d={'count':0x0,'rows':[]};var _0x3f1c5e=_[_0xbbf0('0x23')](db['OpenchannelTransferReport']['rawAttributes'],function(_0x1f4ffc){return{'name':_0x1f4ffc[_0xbbf0('0x24')],'type':_0x1f4ffc[_0xbbf0('0x25')][_0xbbf0('0x26')]};});_0x30d650[_0xbbf0('0x27')]=_['map'](_0x3f1c5e,_0xbbf0('0x22'));_0x30d650['query']=_[_0xbbf0('0x28')](_0x65b6a4[_0xbbf0('0x29')]);_0x30d650[_0xbbf0('0x2a')]=_[_0xbbf0('0x2b')](_0x30d650[_0xbbf0('0x27')],_0x30d650[_0xbbf0('0x29')]);_0x5770fc['attributes']=_[_0xbbf0('0x2b')](_0x30d650[_0xbbf0('0x27')],qs[_0xbbf0('0x2c')](_0x65b6a4[_0xbbf0('0x29')][_0xbbf0('0x2c')]));_0x5770fc[_0xbbf0('0x2d')]=_0x5770fc[_0xbbf0('0x2d')][_0xbbf0('0x2e')]?_0x5770fc['attributes']:_0x30d650[_0xbbf0('0x27')];if(!_0x65b6a4['query']['hasOwnProperty'](_0xbbf0('0x2f'))){_0x5770fc['limit']=qs['limit'](_0x65b6a4['query'][_0xbbf0('0x19')]);_0x5770fc['offset']=qs[_0xbbf0('0x16')](_0x65b6a4['query'][_0xbbf0('0x16')]);}_0x5770fc[_0xbbf0('0x30')]=qs[_0xbbf0('0x31')](_0x65b6a4[_0xbbf0('0x29')][_0xbbf0('0x31')]);_0x5770fc[_0xbbf0('0x32')]=qs['filters'](_[_0xbbf0('0x33')](_0x65b6a4[_0xbbf0('0x29')],_0x30d650[_0xbbf0('0x2a')]),_0x3f1c5e);if(_0x65b6a4[_0xbbf0('0x29')][_0xbbf0('0x34')]){_0x5770fc[_0xbbf0('0x32')]=_['merge'](_0x5770fc[_0xbbf0('0x32')],{'$or':_['map'](_0x3f1c5e,function(_0x2f0bb7){if(_0x2f0bb7[_0xbbf0('0x25')]!==_0xbbf0('0x35')){var _0x5e7fd5={};_0x5e7fd5[_0x2f0bb7[_0xbbf0('0x22')]]={'$like':'%'+_0x65b6a4[_0xbbf0('0x29')]['filter']+'%'};return _0x5e7fd5;}})});}_0x5770fc=_['merge']({},_0x5770fc,_0x65b6a4[_0xbbf0('0x36')]);var _0x37e3cb={'where':_0x5770fc[_0xbbf0('0x32')]};return db[_0xbbf0('0x37')][_0xbbf0('0x18')](_0x37e3cb)[_0xbbf0('0x1e')](function(_0x239142){_0x4d942d[_0xbbf0('0x18')]=_0x239142;if(_0x65b6a4[_0xbbf0('0x29')][_0xbbf0('0x38')]){_0x5770fc[_0xbbf0('0x39')]=[{'all':!![]}];}return db[_0xbbf0('0x37')][_0xbbf0('0x3a')](_0x5770fc);})['then'](function(_0x286f6a){_0x4d942d[_0xbbf0('0x3b')]=_0x286f6a;return _0x4d942d;})[_0xbbf0('0x1e')](respondWithFilteredResult(_0x14cf13,_0x5770fc))[_0xbbf0('0x3c')](handleError(_0x14cf13,null));};exports[_0xbbf0('0x3d')]=function(_0xcb6b83,_0x1228cb){var _0x5e1a2d={'raw':!![],'where':{'id':_0xcb6b83[_0xbbf0('0x3e')]['id']}},_0x306771={};_0x306771['model']=_[_0xbbf0('0x28')](db['OpenchannelTransferReport'][_0xbbf0('0x3f')]);_0x306771['query']=_[_0xbbf0('0x28')](_0xcb6b83['query']);_0x306771[_0xbbf0('0x2a')]=_[_0xbbf0('0x2b')](_0x306771[_0xbbf0('0x27')],_0x306771['query']);_0x5e1a2d[_0xbbf0('0x2d')]=_['intersection'](_0x306771[_0xbbf0('0x27')],qs['fields'](_0xcb6b83[_0xbbf0('0x29')]['fields']));_0x5e1a2d[_0xbbf0('0x2d')]=_0x5e1a2d[_0xbbf0('0x2d')][_0xbbf0('0x2e')]?_0x5e1a2d[_0xbbf0('0x2d')]:_0x306771['model'];if(_0xcb6b83[_0xbbf0('0x29')]['includeAll']){_0x5e1a2d[_0xbbf0('0x39')]=[{'all':!![]}];}_0x5e1a2d=_[_0xbbf0('0x40')]({},_0x5e1a2d,_0xcb6b83['options']);return db[_0xbbf0('0x37')][_0xbbf0('0x41')](_0x5e1a2d)[_0xbbf0('0x1e')](handleEntityNotFound(_0x1228cb,null))['then'](respondWithResult(_0x1228cb,null))[_0xbbf0('0x3c')](handleError(_0x1228cb,null));};exports['create']=function(_0x39fff4,_0x33723e){return db[_0xbbf0('0x37')][_0xbbf0('0x42')](_0x39fff4[_0xbbf0('0x43')],{})[_0xbbf0('0x1e')](respondWithResult(_0x33723e,0xc9))[_0xbbf0('0x3c')](handleError(_0x33723e,null));};exports['update']=function(_0x503430,_0x1d77ba){if(_0x503430[_0xbbf0('0x43')]['id']){delete _0x503430['body']['id'];}return db['OpenchannelTransferReport'][_0xbbf0('0x41')]({'where':{'id':_0x503430[_0xbbf0('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1d77ba,null))['then'](saveUpdates(_0x503430[_0xbbf0('0x43')],null))[_0xbbf0('0x1e')](respondWithResult(_0x1d77ba,null))[_0xbbf0('0x3c')](handleError(_0x1d77ba,null));};exports[_0xbbf0('0x1f')]=function(_0x469e20,_0x21d921){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x469e20['params']['id']}})[_0xbbf0('0x1e')](handleEntityNotFound(_0x21d921,null))[_0xbbf0('0x1e')](removeEntity(_0x21d921,null))['catch'](handleError(_0x21d921,null));};exports[_0xbbf0('0x44')]=function(_0x58096b,_0x19d5e9){return db[_0xbbf0('0x37')]['describe']()['then'](respondWithResult(_0x19d5e9,null))['catch'](handleError(_0x19d5e9,null));}; \ No newline at end of file +var _0x005e=['zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','name','send','index','map','OpenchannelTransferReport','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','filter','where','merge','options','includeAll','include','rows','catch','show','keys','rawAttributes','find','create','body','params','describe','rimraf'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x005e,0x1a3));var _0xe005=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x005e[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe005('0x0'));var zipdir=require(_0xe005('0x1'));var jsonpatch=require(_0xe005('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe005('0x3'));var Mustache=require(_0xe005('0x4'));var util=require(_0xe005('0x5'));var path=require(_0xe005('0x6'));var sox=require(_0xe005('0x7'));var csv=require(_0xe005('0x8'));var ejs=require(_0xe005('0x9'));var fs=require('fs');var fs_extra=require(_0xe005('0xa'));var _=require(_0xe005('0xb'));var squel=require(_0xe005('0xc'));var crypto=require('crypto');var jsforce=require(_0xe005('0xd'));var deskjs=require(_0xe005('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe005('0xf'));var Papa=require(_0xe005('0x10'));var Redis=require('ioredis');var authService=require(_0xe005('0x11'));var qs=require(_0xe005('0x12'));var as=require(_0xe005('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe005('0x14'));var utils=require(_0xe005('0x15'));var config=require(_0xe005('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34f3a6,_0x389a39){_0x389a39=_0x389a39||0xcc;return function(_0x580571){if(_0x580571){return _0x34f3a6[_0xe005('0x17')](_0x389a39);}return _0x34f3a6[_0xe005('0x18')](_0x389a39)[_0xe005('0x19')]();};}function respondWithResult(_0x3b8c78,_0x39a2bb){_0x39a2bb=_0x39a2bb||0xc8;return function(_0x5dfdc9){if(_0x5dfdc9){return _0x3b8c78[_0xe005('0x18')](_0x39a2bb)[_0xe005('0x1a')](_0x5dfdc9);}};}function respondWithFilteredResult(_0x48b42e,_0x3a6c78){return function(_0x50dba5){if(_0x50dba5){var _0x32ee0f=typeof _0x3a6c78[_0xe005('0x1b')]===_0xe005('0x1c')&&typeof _0x3a6c78[_0xe005('0x1d')]==='undefined';var _0x33124c=_0x50dba5[_0xe005('0x1e')];var _0x43eaa9=_0x32ee0f?0x0:_0x3a6c78[_0xe005('0x1b')];var _0x171a1c=_0x32ee0f?_0x50dba5[_0xe005('0x1e')]:_0x3a6c78[_0xe005('0x1b')]+_0x3a6c78[_0xe005('0x1d')];var _0x27f27f;if(_0x171a1c>=_0x33124c){_0x171a1c=_0x33124c;_0x27f27f=0xc8;}else{_0x27f27f=0xce;}_0x48b42e[_0xe005('0x18')](_0x27f27f);return _0x48b42e[_0xe005('0x1f')](_0xe005('0x20'),_0x43eaa9+'-'+_0x171a1c+'/'+_0x33124c)[_0xe005('0x1a')](_0x50dba5);}return null;};}function patchUpdates(_0x5028a9){return function(_0x340af3){try{jsonpatch[_0xe005('0x21')](_0x340af3,_0x5028a9,!![]);}catch(_0x378657){return BPromise[_0xe005('0x22')](_0x378657);}return _0x340af3['save']();};}function saveUpdates(_0x4b0678,_0x432a8b){return function(_0x397a04){if(_0x397a04){return _0x397a04[_0xe005('0x23')](_0x4b0678)[_0xe005('0x24')](function(_0x5a70a1){return _0x5a70a1;});}return null;};}function removeEntity(_0x53eda4,_0x2ff513){return function(_0xc0c220){if(_0xc0c220){return _0xc0c220[_0xe005('0x25')]()[_0xe005('0x24')](function(){_0x53eda4[_0xe005('0x18')](0xcc)[_0xe005('0x19')]();});}};}function handleEntityNotFound(_0x9a0901,_0xe8ebcd){return function(_0x135bcc){if(!_0x135bcc){_0x9a0901['sendStatus'](0x194);}return _0x135bcc;};}function handleError(_0x5cc490,_0x1f18cd){_0x1f18cd=_0x1f18cd||0x1f4;return function(_0x2f483f){logger['error'](_0x2f483f['stack']);if(_0x2f483f[_0xe005('0x26')]){delete _0x2f483f['name'];}_0x5cc490[_0xe005('0x18')](_0x1f18cd)[_0xe005('0x27')](_0x2f483f);};}exports[_0xe005('0x28')]=function(_0x4c1bb4,_0x2b930c){var _0x4ee2c5={},_0x31a8d2={},_0x16b222={'count':0x0,'rows':[]};var _0x4a4ffa=_[_0xe005('0x29')](db[_0xe005('0x2a')]['rawAttributes'],function(_0x30d94a){return{'name':_0x30d94a[_0xe005('0x2b')],'type':_0x30d94a[_0xe005('0x2c')][_0xe005('0x2d')]};});_0x31a8d2[_0xe005('0x2e')]=_[_0xe005('0x29')](_0x4a4ffa,'name');_0x31a8d2[_0xe005('0x2f')]=_['keys'](_0x4c1bb4['query']);_0x31a8d2[_0xe005('0x30')]=_['intersection'](_0x31a8d2[_0xe005('0x2e')],_0x31a8d2[_0xe005('0x2f')]);_0x4ee2c5[_0xe005('0x31')]=_[_0xe005('0x32')](_0x31a8d2['model'],qs[_0xe005('0x33')](_0x4c1bb4[_0xe005('0x2f')][_0xe005('0x33')]));_0x4ee2c5['attributes']=_0x4ee2c5[_0xe005('0x31')][_0xe005('0x34')]?_0x4ee2c5[_0xe005('0x31')]:_0x31a8d2[_0xe005('0x2e')];if(!_0x4c1bb4[_0xe005('0x2f')][_0xe005('0x35')]('nolimit')){_0x4ee2c5[_0xe005('0x1d')]=qs[_0xe005('0x1d')](_0x4c1bb4[_0xe005('0x2f')][_0xe005('0x1d')]);_0x4ee2c5[_0xe005('0x1b')]=qs['offset'](_0x4c1bb4['query'][_0xe005('0x1b')]);}_0x4ee2c5['order']=qs['sort'](_0x4c1bb4[_0xe005('0x2f')]['sort']);_0x4ee2c5['where']=qs[_0xe005('0x30')](_['pick'](_0x4c1bb4[_0xe005('0x2f')],_0x31a8d2[_0xe005('0x30')]),_0x4a4ffa);if(_0x4c1bb4[_0xe005('0x2f')][_0xe005('0x36')]){_0x4ee2c5[_0xe005('0x37')]=_[_0xe005('0x38')](_0x4ee2c5[_0xe005('0x37')],{'$or':_[_0xe005('0x29')](_0x4a4ffa,function(_0x27c3ab){if(_0x27c3ab[_0xe005('0x2c')]!=='VIRTUAL'){var _0xce193c={};_0xce193c[_0x27c3ab[_0xe005('0x26')]]={'$like':'%'+_0x4c1bb4['query']['filter']+'%'};return _0xce193c;}})});}_0x4ee2c5=_[_0xe005('0x38')]({},_0x4ee2c5,_0x4c1bb4[_0xe005('0x39')]);var _0x49fd32={'where':_0x4ee2c5[_0xe005('0x37')]};return db[_0xe005('0x2a')]['count'](_0x49fd32)[_0xe005('0x24')](function(_0x4228d2){_0x16b222['count']=_0x4228d2;if(_0x4c1bb4[_0xe005('0x2f')][_0xe005('0x3a')]){_0x4ee2c5[_0xe005('0x3b')]=[{'all':!![]}];}return db[_0xe005('0x2a')]['findAll'](_0x4ee2c5);})['then'](function(_0x5299f8){_0x16b222[_0xe005('0x3c')]=_0x5299f8;return _0x16b222;})['then'](respondWithFilteredResult(_0x2b930c,_0x4ee2c5))[_0xe005('0x3d')](handleError(_0x2b930c,null));};exports[_0xe005('0x3e')]=function(_0x3b6cdc,_0x2fb28b){var _0x379414={'raw':!![],'where':{'id':_0x3b6cdc['params']['id']}},_0x431776={};_0x431776[_0xe005('0x2e')]=_[_0xe005('0x3f')](db[_0xe005('0x2a')][_0xe005('0x40')]);_0x431776[_0xe005('0x2f')]=_[_0xe005('0x3f')](_0x3b6cdc[_0xe005('0x2f')]);_0x431776[_0xe005('0x30')]=_[_0xe005('0x32')](_0x431776[_0xe005('0x2e')],_0x431776[_0xe005('0x2f')]);_0x379414[_0xe005('0x31')]=_['intersection'](_0x431776[_0xe005('0x2e')],qs['fields'](_0x3b6cdc[_0xe005('0x2f')]['fields']));_0x379414[_0xe005('0x31')]=_0x379414[_0xe005('0x31')][_0xe005('0x34')]?_0x379414[_0xe005('0x31')]:_0x431776[_0xe005('0x2e')];if(_0x3b6cdc[_0xe005('0x2f')][_0xe005('0x3a')]){_0x379414[_0xe005('0x3b')]=[{'all':!![]}];}_0x379414=_[_0xe005('0x38')]({},_0x379414,_0x3b6cdc[_0xe005('0x39')]);return db[_0xe005('0x2a')][_0xe005('0x41')](_0x379414)[_0xe005('0x24')](handleEntityNotFound(_0x2fb28b,null))[_0xe005('0x24')](respondWithResult(_0x2fb28b,null))['catch'](handleError(_0x2fb28b,null));};exports[_0xe005('0x42')]=function(_0x1b0419,_0x4b33c5){return db['OpenchannelTransferReport'][_0xe005('0x42')](_0x1b0419['body'],{})['then'](respondWithResult(_0x4b33c5,0xc9))[_0xe005('0x3d')](handleError(_0x4b33c5,null));};exports['update']=function(_0xfdc961,_0x56f42a){if(_0xfdc961[_0xe005('0x43')]['id']){delete _0xfdc961[_0xe005('0x43')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0xfdc961['params']['id']}})['then'](handleEntityNotFound(_0x56f42a,null))[_0xe005('0x24')](saveUpdates(_0xfdc961[_0xe005('0x43')],null))[_0xe005('0x24')](respondWithResult(_0x56f42a,null))[_0xe005('0x3d')](handleError(_0x56f42a,null));};exports['destroy']=function(_0x490cd3,_0x1ae49d){return db[_0xe005('0x2a')][_0xe005('0x41')]({'where':{'id':_0x490cd3[_0xe005('0x44')]['id']}})[_0xe005('0x24')](handleEntityNotFound(_0x1ae49d,null))[_0xe005('0x24')](removeEntity(_0x1ae49d,null))[_0xe005('0x3d')](handleError(_0x1ae49d,null));};exports[_0xe005('0x45')]=function(_0x3fbac7,_0x570a99){return db[_0xe005('0x2a')]['describe']()[_0xe005('0x24')](respondWithResult(_0x570a99,null))[_0xe005('0x3d')](handleError(_0x570a99,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index e0dc3f5..2b8272d 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 _0x5da7=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','report_openchannel_transfer','uniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5da7,0x1e1));var _0x75da=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5da7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x75da('0x0'));var util=require(_0x75da('0x1'));var logger=require(_0x75da('0x2'))(_0x75da('0x3'));var moment=require(_0x75da('0x4'));var BPromise=require(_0x75da('0x5'));var rp=require(_0x75da('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75da('0x7'));var config=require(_0x75da('0x8'));var attributes=require(_0x75da('0x9'));module['exports']=function(_0x2dac8d,_0x451072){return _0x2dac8d[_0x75da('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0x75da('0xb'),'paranoid':![],'indexes':[{'name':_0x75da('0xc'),'fields':[_0x75da('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6b60=['lodash','util','../../config/logger','api','moment','request-promise','path','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x2df2b4,_0x276cf1){var _0x37f2fc=function(_0x35ccf7){while(--_0x35ccf7){_0x2df2b4['push'](_0x2df2b4['shift']());}};_0x37f2fc(++_0x276cf1);}(_0x6b60,0x180));var _0x06b6=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0x6b60[_0x4c0622];return _0x1799d8;};'use strict';var _=require(_0x06b6('0x0'));var util=require(_0x06b6('0x1'));var logger=require(_0x06b6('0x2'))(_0x06b6('0x3'));var moment=require(_0x06b6('0x4'));var BPromise=require('bluebird');var rp=require(_0x06b6('0x5'));var fs=require('fs');var path=require(_0x06b6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x06b6('0x7'));module['exports']=function(_0x29c9be,_0x32ac56){return _0x29c9be[_0x06b6('0x8')](_0x06b6('0x9'),attributes,{'tableName':_0x06b6('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x06b6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 830e0c6..5be2ff2 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 _0x34aa=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x59de5a,_0x1c31ab){var _0x1e86eb=function(_0x5c3182){while(--_0x5c3182){_0x59de5a['push'](_0x59de5a['shift']());}};_0x1e86eb(++_0x1c31ab);}(_0x34aa,0x171));var _0xa34a=function(_0x1c2f29,_0x5a2668){_0x1c2f29=_0x1c2f29-0x0;var _0x258465=_0x34aa[_0x1c2f29];return _0x258465;};'use strict';var _=require(_0xa34a('0x0'));var util=require('util');var moment=require(_0xa34a('0x1'));var BPromise=require(_0xa34a('0x2'));var rs=require(_0xa34a('0x3'));var fs=require('fs');var Redis=require(_0xa34a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa34a('0x5'));var logger=require(_0xa34a('0x6'))(_0xa34a('0x7'));var config=require(_0xa34a('0x8'));var jayson=require(_0xa34a('0x9'));var client=jayson[_0xa34a('0xa')][_0xa34a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43f9ea,_0x1a03fd,_0x45f2b4){return new BPromise(function(_0x467864,_0x5c858b){return client[_0xa34a('0xc')](_0x43f9ea,_0x45f2b4)[_0xa34a('0xd')](function(_0x35f231){logger[_0xa34a('0xe')](_0xa34a('0xf'),_0x1a03fd,'request\x20sent');logger[_0xa34a('0x10')](_0xa34a('0x11'),_0x1a03fd,_0xa34a('0x12'),JSON[_0xa34a('0x13')](_0x35f231));if(_0x35f231[_0xa34a('0x14')]){if(_0x35f231[_0xa34a('0x14')][_0xa34a('0x15')]===0x1f4){logger['error'](_0xa34a('0xf'),_0x1a03fd,_0x35f231[_0xa34a('0x14')][_0xa34a('0x16')]);return _0x5c858b(_0x35f231['error'][_0xa34a('0x16')]);}logger[_0xa34a('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1a03fd,_0x35f231[_0xa34a('0x14')][_0xa34a('0x16')]);return _0x467864(_0x35f231['error'][_0xa34a('0x16')]);}else{logger[_0xa34a('0xe')](_0xa34a('0xf'),_0x1a03fd,_0xa34a('0x12'));_0x467864(_0x35f231[_0xa34a('0x17')]['message']);}})[_0xa34a('0x18')](function(_0x56f4da){logger[_0xa34a('0x14')](_0xa34a('0xf'),_0x1a03fd,_0x56f4da);_0x5c858b(_0x56f4da);});});} \ No newline at end of file +var _0xc492=['jayson/promise','http','request','then','info','request\x20sent','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../config/logger','rpc'];(function(_0x443082,_0x5b13f6){var _0x5d33b7=function(_0x340b52){while(--_0x340b52){_0x443082['push'](_0x443082['shift']());}};_0x5d33b7(++_0x5b13f6);}(_0xc492,0xd7));var _0x2c49=function(_0x5c637b,_0x2014a9){_0x5c637b=_0x5c637b-0x0;var _0x256139=_0xc492[_0x5c637b];return _0x256139;};'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')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4c76dd,'request\x20sent');logger['debug']('OpenchannelTransferReport,\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/pause/index.js b/server/api/pause/index.js index 508c17b..1c00a4e 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 _0xcbb3=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','path','express'];(function(_0x349f4d,_0x1424f){var _0x5babd7=function(_0x489e9a){while(--_0x489e9a){_0x349f4d['push'](_0x349f4d['shift']());}};_0x5babd7(++_0x1424f);}(_0xcbb3,0x130));var _0x3cbb=function(_0x2ccb19,_0x2ed40f){_0x2ccb19=_0x2ccb19-0x0;var _0x4c5a39=_0xcbb3[_0x2ccb19];return _0x4c5a39;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3cbb('0x0'));var timeout=require('connect-timeout');var express=require(_0x3cbb('0x1'));var router=express[_0x3cbb('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3cbb('0x3'));var interaction=require(_0x3cbb('0x4'));var config=require(_0x3cbb('0x5'));var controller=require('./pause.controller');router[_0x3cbb('0x6')]('/',auth[_0x3cbb('0x7')](),controller[_0x3cbb('0x8')]);router[_0x3cbb('0x6')](_0x3cbb('0x9'),auth[_0x3cbb('0x7')](),controller[_0x3cbb('0xa')]);router[_0x3cbb('0xb')]('/',auth[_0x3cbb('0x7')](),controller[_0x3cbb('0xc')]);router[_0x3cbb('0xd')](_0x3cbb('0x9'),auth[_0x3cbb('0x7')](),controller['update']);router[_0x3cbb('0xe')](_0x3cbb('0x9'),auth['isAuthenticated'](),controller[_0x3cbb('0xf')]);module[_0x3cbb('0x10')]=router; \ No newline at end of file +var _0x871b=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','put','/:id','update','destroy'];(function(_0xe7ba73,_0x1a1dd3){var _0x9bfee0=function(_0x9871f4){while(--_0x9871f4){_0xe7ba73['push'](_0xe7ba73['shift']());}};_0x9bfee0(++_0x1a1dd3);}(_0x871b,0x77));var _0xb871=function(_0x1fc893,_0x4a9efe){_0x1fc893=_0x1fc893-0x0;var _0x2490b2=_0x871b[_0x1fc893];return _0x2490b2;};'use strict';var multer=require(_0xb871('0x0'));var util=require(_0xb871('0x1'));var path=require(_0xb871('0x2'));var timeout=require(_0xb871('0x3'));var express=require(_0xb871('0x4'));var router=express[_0xb871('0x5')]();var fs_extra=require(_0xb871('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb871('0x7'));var config=require(_0xb871('0x8'));var controller=require(_0xb871('0x9'));router[_0xb871('0xa')]('/',auth[_0xb871('0xb')](),controller[_0xb871('0xc')]);router[_0xb871('0xa')]('/:id',auth[_0xb871('0xb')](),controller['show']);router['post']('/',auth[_0xb871('0xb')](),controller['create']);router[_0xb871('0xd')](_0xb871('0xe'),auth['isAuthenticated'](),controller[_0xb871('0xf')]);router['delete'](_0xb871('0xe'),auth['isAuthenticated'](),controller[_0xb871('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index d22f19a..df47fb9 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 _0xad3f=['sequelize','exports','STRING','name'];(function(_0x7ca3c8,_0x3f044b){var _0x1d0618=function(_0x598bfe){while(--_0x598bfe){_0x7ca3c8['push'](_0x7ca3c8['shift']());}};_0x1d0618(++_0x3f044b);}(_0xad3f,0x14c));var _0xfad3=function(_0x183a4d,_0x53dd61){_0x183a4d=_0x183a4d-0x0;var _0x58ddf3=_0xad3f[_0x183a4d];return _0x58ddf3;};'use strict';var Sequelize=require(_0xfad3('0x0'));module[_0xfad3('0x1')]={'name':{'type':Sequelize[_0xfad3('0x2')],'unique':_0xfad3('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xfad3('0x2')]}}; \ No newline at end of file +var _0xce04=['STRING','sequelize','exports'];(function(_0x5bf706,_0xbb64a0){var _0x1e5665=function(_0xb5e0bc){while(--_0xb5e0bc){_0x5bf706['push'](_0x5bf706['shift']());}};_0x1e5665(++_0xbb64a0);}(_0xce04,0x1ae));var _0x4ce0=function(_0x444471,_0x1821a4){_0x444471=_0x444471-0x0;var _0x55c4ec=_0xce04[_0x444471];return _0x55c4ec;};'use strict';var Sequelize=require(_0x4ce0('0x0'));module[_0x4ce0('0x1')]={'name':{'type':Sequelize[_0x4ce0('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x4ce0('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 82c7278..0dd9e66 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 _0xb962=['rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','Pauses','error','stack','send','index','map','Pause','rawAttributes','fieldName','type','key','model','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','VIRTUAL','options','includeAll','include','findAll'];(function(_0x52434c,_0x4756ee){var _0x3e5bef=function(_0x16e146){while(--_0x16e146){_0x52434c['push'](_0x52434c['shift']());}};_0x3e5bef(++_0x4756ee);}(_0xb962,0x162));var _0x2b96=function(_0x26c989,_0xc1d4c6){_0x26c989=_0x26c989-0x0;var _0x5aa68c=_0xb962[_0x26c989];return _0x5aa68c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b96('0x0'));var zipdir=require(_0x2b96('0x1'));var jsonpatch=require(_0x2b96('0x2'));var rp=require(_0x2b96('0x3'));var moment=require(_0x2b96('0x4'));var BPromise=require(_0x2b96('0x5'));var Mustache=require(_0x2b96('0x6'));var util=require(_0x2b96('0x7'));var path=require(_0x2b96('0x8'));var sox=require(_0x2b96('0x9'));var csv=require(_0x2b96('0xa'));var ejs=require(_0x2b96('0xb'));var fs=require('fs');var fs_extra=require(_0x2b96('0xc'));var _=require('lodash');var squel=require(_0x2b96('0xd'));var crypto=require(_0x2b96('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2b96('0xa'));var querystring=require(_0x2b96('0xf'));var Papa=require(_0x2b96('0x10'));var Redis=require(_0x2b96('0x11'));var authService=require(_0x2b96('0x12'));var qs=require(_0x2b96('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b96('0x14'))(_0x2b96('0x15'));var utils=require(_0x2b96('0x16'));var config=require(_0x2b96('0x17'));var licenseUtil=require(_0x2b96('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55c5de,_0x5e23a0){_0x5e23a0=_0x5e23a0||0xcc;return function(_0x33faec){if(_0x33faec){return _0x55c5de[_0x2b96('0x19')](_0x5e23a0);}return _0x55c5de['status'](_0x5e23a0)[_0x2b96('0x1a')]();};}function respondWithResult(_0x280516,_0x2d1110){_0x2d1110=_0x2d1110||0xc8;return function(_0x346bae){if(_0x346bae){return _0x280516[_0x2b96('0x1b')](_0x2d1110)[_0x2b96('0x1c')](_0x346bae);}};}function respondWithFilteredResult(_0x1b9213,_0x5277de){return function(_0xfb4b45){if(_0xfb4b45){var _0x5077d8=typeof _0x5277de[_0x2b96('0x1d')]===_0x2b96('0x1e')&&typeof _0x5277de[_0x2b96('0x1f')]===_0x2b96('0x1e');var _0x278933=_0xfb4b45['count'];var _0x4c2d38=_0x5077d8?0x0:_0x5277de['offset'];var _0x1280d5=_0x5077d8?_0xfb4b45[_0x2b96('0x20')]:_0x5277de[_0x2b96('0x1d')]+_0x5277de[_0x2b96('0x1f')];var _0x30a28e;if(_0x1280d5>=_0x278933){_0x1280d5=_0x278933;_0x30a28e=0xc8;}else{_0x30a28e=0xce;}_0x1b9213['status'](_0x30a28e);return _0x1b9213[_0x2b96('0x21')](_0x2b96('0x22'),_0x4c2d38+'-'+_0x1280d5+'/'+_0x278933)[_0x2b96('0x1c')](_0xfb4b45);}return null;};}function patchUpdates(_0x16d14f){return function(_0x1c543d){try{jsonpatch['apply'](_0x1c543d,_0x16d14f,!![]);}catch(_0xaace30){return BPromise[_0x2b96('0x23')](_0xaace30);}return _0x1c543d[_0x2b96('0x24')]();};}function saveUpdates(_0x5d3c8a,_0x4566ea){return function(_0x485442){if(_0x485442){return _0x485442[_0x2b96('0x25')](_0x5d3c8a)['then'](function(_0x2f95a4){return _0x2f95a4;});}return null;};}function removeEntity(_0xbb580,_0x3dc15f){return function(_0x293b8f){if(_0x293b8f){return _0x293b8f['destroy']()[_0x2b96('0x26')](function(){var _0x533b8c=_0x293b8f[_0x2b96('0x27')]({'plain':!![]});var _0x2cd89b=_0x2b96('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x2cd89b,'resourceId':_0x533b8c['id']}})[_0x2b96('0x26')](function(){return _0x293b8f;});})[_0x2b96('0x26')](function(){_0xbb580[_0x2b96('0x1b')](0xcc)[_0x2b96('0x1a')]();});}};}function handleEntityNotFound(_0x36c5c2,_0xdfa069){return function(_0x5baada){if(!_0x5baada){_0x36c5c2['sendStatus'](0x194);}return _0x5baada;};}function handleError(_0x2c064f,_0x4c326d){_0x4c326d=_0x4c326d||0x1f4;return function(_0x35d11d){logger[_0x2b96('0x29')](_0x35d11d[_0x2b96('0x2a')]);if(_0x35d11d['name']){delete _0x35d11d['name'];}_0x2c064f['status'](_0x4c326d)[_0x2b96('0x2b')](_0x35d11d);};}exports[_0x2b96('0x2c')]=function(_0xa78d1f,_0x32784d){var _0x5599d8={},_0x582265={},_0xaa845c={'count':0x0,'rows':[]};var _0x179157=_[_0x2b96('0x2d')](db[_0x2b96('0x2e')][_0x2b96('0x2f')],function(_0x2eed14){return{'name':_0x2eed14[_0x2b96('0x30')],'type':_0x2eed14[_0x2b96('0x31')][_0x2b96('0x32')]};});_0x582265[_0x2b96('0x33')]=_['map'](_0x179157,_0x2b96('0x34'));_0x582265[_0x2b96('0x35')]=_[_0x2b96('0x36')](_0xa78d1f[_0x2b96('0x35')]);_0x582265['filters']=_['intersection'](_0x582265[_0x2b96('0x33')],_0x582265[_0x2b96('0x35')]);_0x5599d8[_0x2b96('0x37')]=_[_0x2b96('0x38')](_0x582265[_0x2b96('0x33')],qs[_0x2b96('0x39')](_0xa78d1f[_0x2b96('0x35')][_0x2b96('0x39')]));_0x5599d8['attributes']=_0x5599d8[_0x2b96('0x37')][_0x2b96('0x3a')]?_0x5599d8[_0x2b96('0x37')]:_0x582265['model'];if(!_0xa78d1f[_0x2b96('0x35')][_0x2b96('0x3b')](_0x2b96('0x3c'))){_0x5599d8[_0x2b96('0x1f')]=qs[_0x2b96('0x1f')](_0xa78d1f[_0x2b96('0x35')][_0x2b96('0x1f')]);_0x5599d8[_0x2b96('0x1d')]=qs[_0x2b96('0x1d')](_0xa78d1f[_0x2b96('0x35')][_0x2b96('0x1d')]);}_0x5599d8[_0x2b96('0x3d')]=qs['sort'](_0xa78d1f[_0x2b96('0x35')]['sort']);_0x5599d8['where']=qs[_0x2b96('0x3e')](_[_0x2b96('0x3f')](_0xa78d1f[_0x2b96('0x35')],_0x582265['filters']),_0x179157);if(_0xa78d1f[_0x2b96('0x35')][_0x2b96('0x40')]){_0x5599d8[_0x2b96('0x41')]=_['merge'](_0x5599d8['where'],{'$or':_['map'](_0x179157,function(_0x20d3b7){if(_0x20d3b7['type']!==_0x2b96('0x42')){var _0x5f4fd7={};_0x5f4fd7[_0x20d3b7[_0x2b96('0x34')]]={'$like':'%'+_0xa78d1f[_0x2b96('0x35')][_0x2b96('0x40')]+'%'};return _0x5f4fd7;}})});}_0x5599d8=_['merge']({},_0x5599d8,_0xa78d1f[_0x2b96('0x43')]);var _0x15d644={'where':_0x5599d8['where']};return db[_0x2b96('0x2e')][_0x2b96('0x20')](_0x15d644)[_0x2b96('0x26')](function(_0x1ccf3d){_0xaa845c[_0x2b96('0x20')]=_0x1ccf3d;if(_0xa78d1f[_0x2b96('0x35')][_0x2b96('0x44')]){_0x5599d8[_0x2b96('0x45')]=[{'all':!![]}];}return db[_0x2b96('0x2e')][_0x2b96('0x46')](_0x5599d8);})[_0x2b96('0x26')](function(_0x368f44){_0xaa845c[_0x2b96('0x47')]=_0x368f44;return _0xaa845c;})['then'](respondWithFilteredResult(_0x32784d,_0x5599d8))[_0x2b96('0x48')](handleError(_0x32784d,null));};exports[_0x2b96('0x49')]=function(_0x49c259,_0xca79e1){var _0x3608ae={'raw':!![],'where':{'id':_0x49c259[_0x2b96('0x4a')]['id']}},_0x14e851={};_0x14e851[_0x2b96('0x33')]=_[_0x2b96('0x36')](db[_0x2b96('0x2e')][_0x2b96('0x2f')]);_0x14e851[_0x2b96('0x35')]=_['keys'](_0x49c259[_0x2b96('0x35')]);_0x14e851[_0x2b96('0x3e')]=_[_0x2b96('0x38')](_0x14e851['model'],_0x14e851[_0x2b96('0x35')]);_0x3608ae[_0x2b96('0x37')]=_[_0x2b96('0x38')](_0x14e851[_0x2b96('0x33')],qs[_0x2b96('0x39')](_0x49c259['query'][_0x2b96('0x39')]));_0x3608ae['attributes']=_0x3608ae['attributes'][_0x2b96('0x3a')]?_0x3608ae[_0x2b96('0x37')]:_0x14e851[_0x2b96('0x33')];if(_0x49c259[_0x2b96('0x35')]['includeAll']){_0x3608ae[_0x2b96('0x45')]=[{'all':!![]}];}_0x3608ae=_['merge']({},_0x3608ae,_0x49c259[_0x2b96('0x43')]);return db[_0x2b96('0x2e')][_0x2b96('0x4b')](_0x3608ae)['then'](handleEntityNotFound(_0xca79e1,null))[_0x2b96('0x26')](respondWithResult(_0xca79e1,null))[_0x2b96('0x48')](handleError(_0xca79e1,null));};exports[_0x2b96('0x4c')]=function(_0x127c23,_0x563a40){return db[_0x2b96('0x2e')][_0x2b96('0x4c')](_0x127c23[_0x2b96('0x4d')],{})[_0x2b96('0x26')](function(_0x203e11){var _0x1fb47d=_0x127c23['user'][_0x2b96('0x27')]({'plain':!![]});if(!_0x1fb47d)throw new Error(_0x2b96('0x4e'));if(_0x1fb47d[_0x2b96('0x4f')]===_0x2b96('0x50')){var _0xa0450a=_0x203e11[_0x2b96('0x27')]({'plain':!![]});var _0x463267='Pauses';return db[_0x2b96('0x51')][_0x2b96('0x4b')]({'where':{'name':_0x463267,'userProfileId':_0x1fb47d[_0x2b96('0x52')]},'raw':!![]})[_0x2b96('0x26')](function(_0x47ca81){if(_0x47ca81&&_0x47ca81['autoAssociation']===0x0){return db[_0x2b96('0x53')][_0x2b96('0x4c')]({'name':_0xa0450a[_0x2b96('0x34')],'resourceId':_0xa0450a['id'],'type':_0x47ca81[_0x2b96('0x34')],'sectionId':_0x47ca81['id']},{})[_0x2b96('0x26')](function(){return _0x203e11;});}else{return _0x203e11;}})[_0x2b96('0x48')](function(_0x358d75){logger[_0x2b96('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x358d75);throw _0x358d75;});}return _0x203e11;})[_0x2b96('0x26')](respondWithResult(_0x563a40,0xc9))[_0x2b96('0x48')](handleError(_0x563a40,null));};exports['update']=function(_0x2c124b,_0x48e385){if(_0x2c124b[_0x2b96('0x4d')]['id']){delete _0x2c124b[_0x2b96('0x4d')]['id'];}return db['Pause'][_0x2b96('0x4b')]({'where':{'id':_0x2c124b[_0x2b96('0x4a')]['id']}})[_0x2b96('0x26')](handleEntityNotFound(_0x48e385,null))[_0x2b96('0x26')](saveUpdates(_0x2c124b['body'],null))[_0x2b96('0x26')](respondWithResult(_0x48e385,null))[_0x2b96('0x48')](handleError(_0x48e385,null));};exports[_0x2b96('0x54')]=function(_0x1bac0f,_0x45cc9e){return db[_0x2b96('0x2e')][_0x2b96('0x4b')]({'where':{'id':_0x1bac0f[_0x2b96('0x4a')]['id']}})['then'](handleEntityNotFound(_0x45cc9e,null))[_0x2b96('0x26')](removeEntity(_0x45cc9e,null))[_0x2b96('0x48')](handleError(_0x45cc9e,null));}; \ No newline at end of file +var _0xa664=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','ejs','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','json','apply','save','update','then','destroy','get','Pauses','UserProfileResource','error','name','send','index','map','Pause','fieldName','type','key','keys','query','filters','model','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','rawAttributes','length','find','create','body'];(function(_0x4fb8cb,_0x5f3b15){var _0x434267=function(_0x4afd7b){while(--_0x4afd7b){_0x4fb8cb['push'](_0x4fb8cb['shift']());}};_0x434267(++_0x5f3b15);}(_0xa664,0x198));var _0x4a66=function(_0x52de05,_0x4d2857){_0x52de05=_0x52de05-0x0;var _0x3d6f5e=_0xa664[_0x52de05];return _0x3d6f5e;};'use strict';var emlformat=require(_0x4a66('0x0'));var rimraf=require(_0x4a66('0x1'));var zipdir=require(_0x4a66('0x2'));var jsonpatch=require(_0x4a66('0x3'));var rp=require(_0x4a66('0x4'));var moment=require(_0x4a66('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4a66('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4a66('0x7'));var fs=require('fs');var fs_extra=require(_0x4a66('0x8'));var _=require('lodash');var squel=require(_0x4a66('0x9'));var crypto=require(_0x4a66('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4a66('0xb'));var querystring=require(_0x4a66('0xc'));var Papa=require(_0x4a66('0xd'));var Redis=require(_0x4a66('0xe'));var authService=require(_0x4a66('0xf'));var qs=require(_0x4a66('0x10'));var as=require(_0x4a66('0x11'));var hardwareService=require(_0x4a66('0x12'));var logger=require('../../config/logger')(_0x4a66('0x13'));var utils=require(_0x4a66('0x14'));var config=require(_0x4a66('0x15'));var licenseUtil=require(_0x4a66('0x16'));var db=require(_0x4a66('0x17'))['db'];function respondWithStatusCode(_0x373160,_0x4f1886){_0x4f1886=_0x4f1886||0xcc;return function(_0x93201c){if(_0x93201c){return _0x373160['sendStatus'](_0x4f1886);}return _0x373160['status'](_0x4f1886)['end']();};}function respondWithResult(_0x5d2421,_0x5c2a53){_0x5c2a53=_0x5c2a53||0xc8;return function(_0x2dbc9d){if(_0x2dbc9d){return _0x5d2421[_0x4a66('0x18')](_0x5c2a53)['json'](_0x2dbc9d);}};}function respondWithFilteredResult(_0x2673c2,_0x2035a1){return function(_0x377aac){if(_0x377aac){var _0x41e101=typeof _0x2035a1[_0x4a66('0x19')]==='undefined'&&typeof _0x2035a1[_0x4a66('0x1a')]===_0x4a66('0x1b');var _0xecb8f2=_0x377aac['count'];var _0x1fdfd2=_0x41e101?0x0:_0x2035a1[_0x4a66('0x19')];var _0x32c236=_0x41e101?_0x377aac[_0x4a66('0x1c')]:_0x2035a1['offset']+_0x2035a1[_0x4a66('0x1a')];var _0x335666;if(_0x32c236>=_0xecb8f2){_0x32c236=_0xecb8f2;_0x335666=0xc8;}else{_0x335666=0xce;}_0x2673c2[_0x4a66('0x18')](_0x335666);return _0x2673c2['set']('Content-Range',_0x1fdfd2+'-'+_0x32c236+'/'+_0xecb8f2)[_0x4a66('0x1d')](_0x377aac);}return null;};}function patchUpdates(_0x3d3ace){return function(_0x16db1b){try{jsonpatch[_0x4a66('0x1e')](_0x16db1b,_0x3d3ace,!![]);}catch(_0x2a0076){return BPromise['reject'](_0x2a0076);}return _0x16db1b[_0x4a66('0x1f')]();};}function saveUpdates(_0x12c190,_0x3a4bb9){return function(_0x42ef1d){if(_0x42ef1d){return _0x42ef1d[_0x4a66('0x20')](_0x12c190)[_0x4a66('0x21')](function(_0x21eecd){return _0x21eecd;});}return null;};}function removeEntity(_0x28840e,_0xc9a508){return function(_0x43cd8b){if(_0x43cd8b){return _0x43cd8b[_0x4a66('0x22')]()[_0x4a66('0x21')](function(){var _0x2def86=_0x43cd8b[_0x4a66('0x23')]({'plain':!![]});var _0x399198=_0x4a66('0x24');return db[_0x4a66('0x25')]['destroy']({'where':{'type':_0x399198,'resourceId':_0x2def86['id']}})['then'](function(){return _0x43cd8b;});})[_0x4a66('0x21')](function(){_0x28840e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x178957,_0x25ffba){return function(_0x383013){if(!_0x383013){_0x178957['sendStatus'](0x194);}return _0x383013;};}function handleError(_0xd6b25e,_0x240626){_0x240626=_0x240626||0x1f4;return function(_0x2a2e96){logger[_0x4a66('0x26')](_0x2a2e96['stack']);if(_0x2a2e96[_0x4a66('0x27')]){delete _0x2a2e96[_0x4a66('0x27')];}_0xd6b25e[_0x4a66('0x18')](_0x240626)[_0x4a66('0x28')](_0x2a2e96);};}exports[_0x4a66('0x29')]=function(_0x4f1ce8,_0xbdfbdc){var _0x1cc1b1={},_0x4e9b26={},_0x337c7f={'count':0x0,'rows':[]};var _0x3fca01=_[_0x4a66('0x2a')](db[_0x4a66('0x2b')]['rawAttributes'],function(_0x3b3836){return{'name':_0x3b3836[_0x4a66('0x2c')],'type':_0x3b3836[_0x4a66('0x2d')][_0x4a66('0x2e')]};});_0x4e9b26['model']=_[_0x4a66('0x2a')](_0x3fca01,_0x4a66('0x27'));_0x4e9b26['query']=_[_0x4a66('0x2f')](_0x4f1ce8[_0x4a66('0x30')]);_0x4e9b26[_0x4a66('0x31')]=_['intersection'](_0x4e9b26[_0x4a66('0x32')],_0x4e9b26[_0x4a66('0x30')]);_0x1cc1b1['attributes']=_[_0x4a66('0x33')](_0x4e9b26[_0x4a66('0x32')],qs['fields'](_0x4f1ce8[_0x4a66('0x30')]['fields']));_0x1cc1b1[_0x4a66('0x34')]=_0x1cc1b1['attributes']['length']?_0x1cc1b1[_0x4a66('0x34')]:_0x4e9b26['model'];if(!_0x4f1ce8[_0x4a66('0x30')][_0x4a66('0x35')](_0x4a66('0x36'))){_0x1cc1b1['limit']=qs[_0x4a66('0x1a')](_0x4f1ce8[_0x4a66('0x30')]['limit']);_0x1cc1b1[_0x4a66('0x19')]=qs[_0x4a66('0x19')](_0x4f1ce8[_0x4a66('0x30')][_0x4a66('0x19')]);}_0x1cc1b1[_0x4a66('0x37')]=qs[_0x4a66('0x38')](_0x4f1ce8['query']['sort']);_0x1cc1b1[_0x4a66('0x39')]=qs[_0x4a66('0x31')](_[_0x4a66('0x3a')](_0x4f1ce8[_0x4a66('0x30')],_0x4e9b26['filters']),_0x3fca01);if(_0x4f1ce8[_0x4a66('0x30')][_0x4a66('0x3b')]){_0x1cc1b1['where']=_[_0x4a66('0x3c')](_0x1cc1b1[_0x4a66('0x39')],{'$or':_[_0x4a66('0x2a')](_0x3fca01,function(_0xd83f){if(_0xd83f['type']!=='VIRTUAL'){var _0x263b9b={};_0x263b9b[_0xd83f[_0x4a66('0x27')]]={'$like':'%'+_0x4f1ce8[_0x4a66('0x30')][_0x4a66('0x3b')]+'%'};return _0x263b9b;}})});}_0x1cc1b1=_[_0x4a66('0x3c')]({},_0x1cc1b1,_0x4f1ce8[_0x4a66('0x3d')]);var _0x5aa178={'where':_0x1cc1b1[_0x4a66('0x39')]};return db[_0x4a66('0x2b')][_0x4a66('0x1c')](_0x5aa178)[_0x4a66('0x21')](function(_0x37a0ca){_0x337c7f['count']=_0x37a0ca;if(_0x4f1ce8[_0x4a66('0x30')][_0x4a66('0x3e')]){_0x1cc1b1[_0x4a66('0x3f')]=[{'all':!![]}];}return db[_0x4a66('0x2b')]['findAll'](_0x1cc1b1);})[_0x4a66('0x21')](function(_0x55eb9d){_0x337c7f[_0x4a66('0x40')]=_0x55eb9d;return _0x337c7f;})[_0x4a66('0x21')](respondWithFilteredResult(_0xbdfbdc,_0x1cc1b1))[_0x4a66('0x41')](handleError(_0xbdfbdc,null));};exports[_0x4a66('0x42')]=function(_0x443950,_0x4daf47){var _0x1c039d={'raw':!![],'where':{'id':_0x443950['params']['id']}},_0x59a2cf={};_0x59a2cf[_0x4a66('0x32')]=_[_0x4a66('0x2f')](db[_0x4a66('0x2b')][_0x4a66('0x43')]);_0x59a2cf[_0x4a66('0x30')]=_[_0x4a66('0x2f')](_0x443950[_0x4a66('0x30')]);_0x59a2cf[_0x4a66('0x31')]=_[_0x4a66('0x33')](_0x59a2cf[_0x4a66('0x32')],_0x59a2cf[_0x4a66('0x30')]);_0x1c039d['attributes']=_[_0x4a66('0x33')](_0x59a2cf[_0x4a66('0x32')],qs['fields'](_0x443950[_0x4a66('0x30')]['fields']));_0x1c039d['attributes']=_0x1c039d[_0x4a66('0x34')][_0x4a66('0x44')]?_0x1c039d[_0x4a66('0x34')]:_0x59a2cf[_0x4a66('0x32')];if(_0x443950['query']['includeAll']){_0x1c039d[_0x4a66('0x3f')]=[{'all':!![]}];}_0x1c039d=_[_0x4a66('0x3c')]({},_0x1c039d,_0x443950['options']);return db[_0x4a66('0x2b')][_0x4a66('0x45')](_0x1c039d)[_0x4a66('0x21')](handleEntityNotFound(_0x4daf47,null))[_0x4a66('0x21')](respondWithResult(_0x4daf47,null))[_0x4a66('0x41')](handleError(_0x4daf47,null));};exports[_0x4a66('0x46')]=function(_0x3b3c9d,_0x5853de){return db[_0x4a66('0x2b')]['create'](_0x3b3c9d[_0x4a66('0x47')],{})[_0x4a66('0x21')](function(_0x1635b4){var _0x7f16d1=_0x3b3c9d[_0x4a66('0x48')][_0x4a66('0x23')]({'plain':!![]});if(!_0x7f16d1)throw new Error(_0x4a66('0x49'));if(_0x7f16d1[_0x4a66('0x4a')]===_0x4a66('0x48')){var _0x1da2a8=_0x1635b4['get']({'plain':!![]});var _0x1f3bd1='Pauses';return db[_0x4a66('0x4b')][_0x4a66('0x45')]({'where':{'name':_0x1f3bd1,'userProfileId':_0x7f16d1[_0x4a66('0x4c')]},'raw':!![]})[_0x4a66('0x21')](function(_0x4a5377){if(_0x4a5377&&_0x4a5377[_0x4a66('0x4d')]===0x0){return db[_0x4a66('0x25')]['create']({'name':_0x1da2a8['name'],'resourceId':_0x1da2a8['id'],'type':_0x4a5377[_0x4a66('0x27')],'sectionId':_0x4a5377['id']},{})[_0x4a66('0x21')](function(){return _0x1635b4;});}else{return _0x1635b4;}})[_0x4a66('0x41')](function(_0x38e7fd){logger[_0x4a66('0x26')](_0x4a66('0x4e'),_0x38e7fd);throw _0x38e7fd;});}return _0x1635b4;})[_0x4a66('0x21')](respondWithResult(_0x5853de,0xc9))['catch'](handleError(_0x5853de,null));};exports[_0x4a66('0x20')]=function(_0x173ac8,_0x1b7e5f){if(_0x173ac8[_0x4a66('0x47')]['id']){delete _0x173ac8['body']['id'];}return db[_0x4a66('0x2b')][_0x4a66('0x45')]({'where':{'id':_0x173ac8[_0x4a66('0x4f')]['id']}})[_0x4a66('0x21')](handleEntityNotFound(_0x1b7e5f,null))[_0x4a66('0x21')](saveUpdates(_0x173ac8['body'],null))[_0x4a66('0x21')](respondWithResult(_0x1b7e5f,null))[_0x4a66('0x41')](handleError(_0x1b7e5f,null));};exports[_0x4a66('0x22')]=function(_0x585331,_0xd56fa3){return db[_0x4a66('0x2b')][_0x4a66('0x45')]({'where':{'id':_0x585331[_0x4a66('0x4f')]['id']}})[_0x4a66('0x21')](handleEntityNotFound(_0xd56fa3,null))[_0x4a66('0x21')](removeEntity(_0xd56fa3,null))[_0x4a66('0x41')](handleError(_0xd56fa3,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index c09efa6..59bf3e2 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 _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x253209,_0x14763b){var _0x9f644b=function(_0x2d0c14){while(--_0x2d0c14){_0x253209['push'](_0x253209['shift']());}};_0x9f644b(++_0x14763b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x122d9f,_0x2c9e5b){_0x122d9f=_0x122d9f-0x0;var _0x41a09e=_0x5fc3[_0x122d9f];return _0x41a09e;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x2bd36c,_0x7f22c4){var _0x575b6e=function(_0x10d1d9){while(--_0x10d1d9){_0x2bd36c['push'](_0x2bd36c['shift']());}};_0x575b6e(++_0x7f22c4);}(_0x814b,0x1a2));var _0xb814=function(_0x3f8759,_0x3fe6fb){_0x3f8759=_0x3f8759-0x0;var _0x2d33ca=_0x814b[_0x3f8759];return _0x2d33ca;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'tools_pauses','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 6aa240d..02dc1e1 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x129605,_0x113329){var _0x48d5d9=function(_0x3b0ad4){while(--_0x3b0ad4){_0x129605['push'](_0x129605['shift']());}};_0x48d5d9(++_0x113329);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e7653,_0x414e83){_0x3e7653=_0x3e7653-0x0;var _0x2d518d=_0xb10b[_0x3e7653];return _0x2d518d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x7f024e,_0x4eaecf){var _0x3686d1=function(_0x351b8c){while(--_0x351b8c){_0x7f024e['push'](_0x7f024e['shift']());}};_0x3686d1(++_0x4eaecf);}(_0xb10b,0x12a));var _0xbb10=function(_0x71d4f3,_0x4662e1){_0x71d4f3=_0x71d4f3-0x0;var _0x330245=_0xb10b[_0x71d4f3];return _0x330245;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 5aebb5e..92396bf 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 _0x9b67=['../../components/auth/service','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','single','file','upload','post','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9b67,0xf6));var _0x79b6=function(_0x374786,_0x3e5070){_0x374786=_0x374786-0x0;var _0x5cd8e5=_0x9b67[_0x374786];return _0x5cd8e5;};'use strict';var multer=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var path=require(_0x79b6('0x2'));var timeout=require(_0x79b6('0x3'));var express=require(_0x79b6('0x4'));var router=express['Router']();var fs_extra=require(_0x79b6('0x5'));var auth=require(_0x79b6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x79b6('0x7'));router[_0x79b6('0x8')]('/',auth[_0x79b6('0x9')](),controller[_0x79b6('0xa')]);router[_0x79b6('0x8')](_0x79b6('0xb'),controller[_0x79b6('0xc')]);router['get'](_0x79b6('0xd'),auth[_0x79b6('0x9')](),controller[_0x79b6('0xe')]);router[_0x79b6('0x8')](_0x79b6('0xf'),auth['isAuthenticated'](),controller[_0x79b6('0x10')]);var upload=multer({'storage':multer[_0x79b6('0x11')]({'destination':function(_0x3f3b44,_0x301f13,_0x58a98b){_0x58a98b(null,path['join'](config[_0x79b6('0x12')],_0x79b6('0x13')));},'filename':function(_0x303cfb,_0x526727,_0xc05a77){_0x526727[_0x79b6('0x14')]=_0x526727[_0x79b6('0x14')][_0x79b6('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xc05a77(null,util[_0x79b6('0x16')](_0x79b6('0x17'),path[_0x79b6('0x18')](_0x526727[_0x79b6('0x14')],path[_0x79b6('0x19')](_0x526727[_0x79b6('0x14')])),Date[_0x79b6('0x1a')](),path[_0x79b6('0x19')](_0x526727[_0x79b6('0x14')])));}})});router['post']('/',upload[_0x79b6('0x1b')](_0x79b6('0x1c')),controller[_0x79b6('0x1d')]);router[_0x79b6('0x1e')](_0x79b6('0xb'),controller[_0x79b6('0x1f')]);router[_0x79b6('0x20')](_0x79b6('0xd'),auth[_0x79b6('0x9')](),controller[_0x79b6('0x21')]);router[_0x79b6('0x22')](_0x79b6('0xd'),auth[_0x79b6('0x9')](),controller['delete']);module[_0x79b6('0x23')]=router; \ No newline at end of file +var _0x425d=['isAuthenticated','index','/webhook','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','format','%s-%s%s','basename','extname','now','single','file','upload','post','webhookPost','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get'];(function(_0x14a6aa,_0x4607c1){var _0x2082cd=function(_0x32a768){while(--_0x32a768){_0x14a6aa['push'](_0x14a6aa['shift']());}};_0x2082cd(++_0x4607c1);}(_0x425d,0x1e0));var _0xd425=function(_0xe052be,_0x393642){_0xe052be=_0xe052be-0x0;var _0x11ba22=_0x425d[_0xe052be];return _0x11ba22;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var fs_extra=require(_0xd425('0x5'));var auth=require(_0xd425('0x6'));var interaction=require(_0xd425('0x7'));var config=require('../../config/environment');var controller=require(_0xd425('0x8'));router[_0xd425('0x9')]('/',auth[_0xd425('0xa')](),controller[_0xd425('0xb')]);router[_0xd425('0x9')](_0xd425('0xc'),controller['webhookGet']);router[_0xd425('0x9')](_0xd425('0xd'),auth[_0xd425('0xa')](),controller[_0xd425('0xe')]);router[_0xd425('0x9')](_0xd425('0xf'),auth[_0xd425('0xa')](),controller[_0xd425('0x10')]);var upload=multer({'storage':multer[_0xd425('0x11')]({'destination':function(_0x35a7f4,_0x3d2bcf,_0x10d463){_0x10d463(null,path[_0xd425('0x12')](config[_0xd425('0x13')],_0xd425('0x14')));},'filename':function(_0x2385a5,_0x9bb611,_0x3cacf7){_0x9bb611[_0xd425('0x15')]=_0x9bb611[_0xd425('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3cacf7(null,util[_0xd425('0x16')](_0xd425('0x17'),path[_0xd425('0x18')](_0x9bb611['originalname'],path[_0xd425('0x19')](_0x9bb611[_0xd425('0x15')])),Date[_0xd425('0x1a')](),path[_0xd425('0x19')](_0x9bb611[_0xd425('0x15')])));}})});router['post']('/',upload[_0xd425('0x1b')](_0xd425('0x1c')),controller[_0xd425('0x1d')]);router[_0xd425('0x1e')]('/webhook',controller[_0xd425('0x1f')]);router[_0xd425('0x20')](_0xd425('0xd'),auth[_0xd425('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd425('0x21')]);module[_0xd425('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index e5e5a19..770abbd 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 _0x6e71=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT'];(function(_0x3caeb5,_0x219363){var _0x5eca7e=function(_0x4cae6b){while(--_0x4cae6b){_0x3caeb5['push'](_0x3caeb5['shift']());}};_0x5eca7e(++_0x219363);}(_0x6e71,0xbd));var _0x16e7=function(_0x2adb23,_0x7448e5){_0x2adb23=_0x2adb23-0x0;var _0x35e468=_0x6e71[_0x2adb23];return _0x35e468;};'use strict';var Sequelize=require(_0x16e7('0x0'));module[_0x16e7('0x1')]={'name':{'type':Sequelize[_0x16e7('0x2')]},'type':{'type':Sequelize[_0x16e7('0x3')](_0x16e7('0x4'),_0x16e7('0x5'))},'description':{'type':Sequelize[_0x16e7('0x6')]},'version':{'type':Sequelize[_0x16e7('0x6')]},'path':{'type':Sequelize[_0x16e7('0x2')],'comment':_0x16e7('0x7')},'active':{'type':Sequelize[_0x16e7('0x8')],'defaultValue':0x0,'comment':_0x16e7('0x9')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0x16e7('0xa'),'always',_0x16e7('0xb')),'defaultValue':_0x16e7('0xc'),'comment':_0x16e7('0xd')},'icon':{'type':Sequelize[_0x16e7('0x2')]},'adminUrl':{'type':Sequelize[_0x16e7('0x2')]},'agentUrl':{'type':Sequelize[_0x16e7('0x2')]},'scriptName':{'type':Sequelize[_0x16e7('0x2')]},'scriptPath':{'type':Sequelize[_0x16e7('0x2')]}}; \ No newline at end of file +var _0x65c0=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','TEXT'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x65c0,0x150));var _0x065c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x65c0[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0x065c('0x0')]={'name':{'type':Sequelize[_0x065c('0x1')]},'type':{'type':Sequelize[_0x065c('0x2')](_0x065c('0x3'),'script')},'description':{'type':Sequelize[_0x065c('0x4')]},'version':{'type':Sequelize[_0x065c('0x4')]},'path':{'type':Sequelize[_0x065c('0x1')],'comment':_0x065c('0x5')},'active':{'type':Sequelize[_0x065c('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x065c('0x7'),'agentOnly',_0x065c('0x8'),_0x065c('0x9')),'defaultValue':'always','comment':_0x065c('0xa')},'icon':{'type':Sequelize[_0x065c('0x1')]},'adminUrl':{'type':Sequelize[_0x065c('0x1')]},'agentUrl':{'type':Sequelize[_0x065c('0x1')]},'scriptName':{'type':Sequelize[_0x065c('0x1')]},'scriptPath':{'type':Sequelize[_0x065c('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index ff83c0a..618d6fb 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 _0xd209=['upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','error','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','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','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','test','create','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','body','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Plugins','name','send','index','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','include','findAll','rows','catch','show','params','length','includeAll','find','download','join','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','pipe','glob','**/*','root','dirname','attachments/**/*','finalize','close','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed'];(function(_0x22d5c4,_0x1b3ab5){var _0x4a3111=function(_0x2f102b){while(--_0x2f102b){_0x22d5c4['push'](_0x22d5c4['shift']());}};_0x4a3111(++_0x1b3ab5);}(_0xd209,0x1b1));var _0x9d20=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xd209[_0x1cfa0d];return _0xe33279;};'use strict';var emlformat=require(_0x9d20('0x0'));var rimraf=require(_0x9d20('0x1'));var zipdir=require(_0x9d20('0x2'));var jsonpatch=require(_0x9d20('0x3'));var rp=require('request-promise');var moment=require(_0x9d20('0x4'));var BPromise=require(_0x9d20('0x5'));var Mustache=require('mustache');var util=require(_0x9d20('0x6'));var path=require(_0x9d20('0x7'));var sox=require(_0x9d20('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d20('0x9'));var _=require(_0x9d20('0xa'));var squel=require(_0x9d20('0xb'));var crypto=require(_0x9d20('0xc'));var jsforce=require(_0x9d20('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9d20('0xe'));var querystring=require(_0x9d20('0xf'));var Papa=require(_0x9d20('0x10'));var extract=require(_0x9d20('0x11'));var rimraf=require(_0x9d20('0x1'));var archiver=require(_0x9d20('0x12'));var Redis=require(_0x9d20('0x13'));var authService=require(_0x9d20('0x14'));var qs=require(_0x9d20('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9d20('0x16'));var utils=require(_0x9d20('0x17'));var config=require(_0x9d20('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d20('0x19'))['db'];config[_0x9d20('0x1a')]=_[_0x9d20('0x1b')](config[_0x9d20('0x1a')],{'host':_0x9d20('0x1c'),'port':0x18eb});var socket=require(_0x9d20('0x1d'))(new Redis(config[_0x9d20('0x1a')]));require(_0x9d20('0x1e'))[_0x9d20('0x1f')](socket);function respondWithStatusCode(_0x19db4a,_0x2b98c8){_0x2b98c8=_0x2b98c8||0xcc;return function(_0x291b30){if(_0x291b30){return _0x19db4a[_0x9d20('0x20')](_0x2b98c8);}return _0x19db4a[_0x9d20('0x21')](_0x2b98c8)[_0x9d20('0x22')]();};}function respondWithResult(_0x1cd718,_0x5d7a82){_0x5d7a82=_0x5d7a82||0xc8;return function(_0x4e74d3){if(_0x4e74d3){return _0x1cd718[_0x9d20('0x21')](_0x5d7a82)[_0x9d20('0x23')](_0x4e74d3);}};}function respondWithFilteredResult(_0xa47c72,_0xa792d2){return function(_0x15a6d3){if(_0x15a6d3){var _0x136c99=typeof _0xa792d2[_0x9d20('0x24')]==='undefined'&&typeof _0xa792d2[_0x9d20('0x25')]==='undefined';var _0x4a152e=_0x15a6d3[_0x9d20('0x26')];var _0x21e84c=_0x136c99?0x0:_0xa792d2[_0x9d20('0x24')];var _0x193f13=_0x136c99?_0x15a6d3[_0x9d20('0x26')]:_0xa792d2[_0x9d20('0x24')]+_0xa792d2[_0x9d20('0x25')];var _0x3bc0b8;if(_0x193f13>=_0x4a152e){_0x193f13=_0x4a152e;_0x3bc0b8=0xc8;}else{_0x3bc0b8=0xce;}_0xa47c72[_0x9d20('0x21')](_0x3bc0b8);return _0xa47c72[_0x9d20('0x27')](_0x9d20('0x28'),_0x21e84c+'-'+_0x193f13+'/'+_0x4a152e)['json'](_0x15a6d3);}return null;};}function patchUpdates(_0xa48389){return function(_0x3381ec){try{jsonpatch[_0x9d20('0x29')](_0x3381ec,_0xa48389,!![]);}catch(_0x48823e){return BPromise['reject'](_0x48823e);}return _0x3381ec[_0x9d20('0x2a')]();};}function saveUpdates(_0x2b4a79,_0x1b3a7d){return function(_0x433fde){if(_0x433fde){return _0x433fde[_0x9d20('0x2b')](_0x2b4a79)[_0x9d20('0x2c')](function(_0x238c46){return _0x238c46;});}return null;};}function removeEntity(_0x5adfea,_0x39ec1e){return function(_0x55bdfa){if(_0x55bdfa){return _0x55bdfa[_0x9d20('0x2d')]()['then'](function(){var _0x8b4455=_0x55bdfa[_0x9d20('0x2e')]({'plain':!![]});var _0x1a778e=_0x9d20('0x2f');return db['UserProfileResource'][_0x9d20('0x2d')]({'where':{'type':_0x1a778e,'resourceId':_0x8b4455['id']}})[_0x9d20('0x2c')](function(){return _0x55bdfa;});})[_0x9d20('0x2c')](function(){_0x5adfea[_0x9d20('0x21')](0xcc)[_0x9d20('0x22')]();});}};}function handleEntityNotFound(_0x48f9c5,_0x40116f){return function(_0x1163de){if(!_0x1163de){_0x48f9c5[_0x9d20('0x20')](0x194);}return _0x1163de;};}function handleError(_0x48b57a,_0x3347b0){_0x3347b0=_0x3347b0||0x1f4;return function(_0x324340){logger['error'](_0x324340['stack']);if(_0x324340['name']){delete _0x324340[_0x9d20('0x30')];}_0x48b57a[_0x9d20('0x21')](_0x3347b0)[_0x9d20('0x31')](_0x324340);};}exports[_0x9d20('0x32')]=function(_0x230dc9,_0x4ac5fc){var _0x7d938d={},_0x4ff89a={},_0x4e9c1a={'count':0x0,'rows':[]};var _0x577578=_['map'](db[_0x9d20('0x33')][_0x9d20('0x34')],function(_0x2b8669){return{'name':_0x2b8669[_0x9d20('0x35')],'type':_0x2b8669[_0x9d20('0x36')][_0x9d20('0x37')]};});_0x4ff89a[_0x9d20('0x38')]=_['map'](_0x577578,_0x9d20('0x30'));_0x4ff89a[_0x9d20('0x39')]=_[_0x9d20('0x3a')](_0x230dc9[_0x9d20('0x39')]);_0x4ff89a[_0x9d20('0x3b')]=_[_0x9d20('0x3c')](_0x4ff89a[_0x9d20('0x38')],_0x4ff89a[_0x9d20('0x39')]);_0x7d938d['attributes']=_[_0x9d20('0x3c')](_0x4ff89a[_0x9d20('0x38')],qs[_0x9d20('0x3d')](_0x230dc9[_0x9d20('0x39')][_0x9d20('0x3d')]));_0x7d938d[_0x9d20('0x3e')]=_0x7d938d[_0x9d20('0x3e')]['length']?_0x7d938d[_0x9d20('0x3e')]:_0x4ff89a['model'];if(!_0x230dc9['query'][_0x9d20('0x3f')](_0x9d20('0x40'))){_0x7d938d[_0x9d20('0x25')]=qs['limit'](_0x230dc9['query'][_0x9d20('0x25')]);_0x7d938d['offset']=qs[_0x9d20('0x24')](_0x230dc9[_0x9d20('0x39')][_0x9d20('0x24')]);}_0x7d938d[_0x9d20('0x41')]=qs[_0x9d20('0x42')](_0x230dc9[_0x9d20('0x39')][_0x9d20('0x42')]);_0x7d938d[_0x9d20('0x43')]=qs[_0x9d20('0x3b')](_[_0x9d20('0x44')](_0x230dc9[_0x9d20('0x39')],_0x4ff89a['filters']),_0x577578);if(_0x230dc9['query'][_0x9d20('0x45')]){_0x7d938d[_0x9d20('0x43')]=_[_0x9d20('0x46')](_0x7d938d[_0x9d20('0x43')],{'$or':_[_0x9d20('0x47')](_0x577578,function(_0x103475){if(_0x103475['type']!=='VIRTUAL'){var _0x4c8205={};_0x4c8205[_0x103475['name']]={'$like':'%'+_0x230dc9[_0x9d20('0x39')][_0x9d20('0x45')]+'%'};return _0x4c8205;}})});}_0x7d938d=_['merge']({},_0x7d938d,_0x230dc9[_0x9d20('0x48')]);var _0x7ccfbd={'where':_0x7d938d[_0x9d20('0x43')]};return db[_0x9d20('0x33')][_0x9d20('0x26')](_0x7ccfbd)[_0x9d20('0x2c')](function(_0x3113f6){_0x4e9c1a['count']=_0x3113f6;if(_0x230dc9[_0x9d20('0x39')]['includeAll']){_0x7d938d[_0x9d20('0x49')]=[{'all':!![]}];}return db['Plugin'][_0x9d20('0x4a')](_0x7d938d);})[_0x9d20('0x2c')](function(_0x4bf140){_0x4e9c1a[_0x9d20('0x4b')]=_0x4bf140;return _0x4e9c1a;})[_0x9d20('0x2c')](respondWithFilteredResult(_0x4ac5fc,_0x7d938d))[_0x9d20('0x4c')](handleError(_0x4ac5fc,null));};exports[_0x9d20('0x4d')]=function(_0x3ee458,_0x2d0ed7){var _0x500e22={'raw':!![],'where':{'id':_0x3ee458[_0x9d20('0x4e')]['id']}},_0x1aad9a={};_0x1aad9a[_0x9d20('0x38')]=_[_0x9d20('0x3a')](db['Plugin'][_0x9d20('0x34')]);_0x1aad9a[_0x9d20('0x39')]=_[_0x9d20('0x3a')](_0x3ee458[_0x9d20('0x39')]);_0x1aad9a[_0x9d20('0x3b')]=_[_0x9d20('0x3c')](_0x1aad9a[_0x9d20('0x38')],_0x1aad9a[_0x9d20('0x39')]);_0x500e22[_0x9d20('0x3e')]=_['intersection'](_0x1aad9a[_0x9d20('0x38')],qs[_0x9d20('0x3d')](_0x3ee458[_0x9d20('0x39')][_0x9d20('0x3d')]));_0x500e22['attributes']=_0x500e22[_0x9d20('0x3e')][_0x9d20('0x4f')]?_0x500e22[_0x9d20('0x3e')]:_0x1aad9a[_0x9d20('0x38')];if(_0x3ee458[_0x9d20('0x39')][_0x9d20('0x50')]){_0x500e22[_0x9d20('0x49')]=[{'all':!![]}];}_0x500e22=_[_0x9d20('0x46')]({},_0x500e22,_0x3ee458[_0x9d20('0x48')]);return db[_0x9d20('0x33')][_0x9d20('0x51')](_0x500e22)[_0x9d20('0x2c')](handleEntityNotFound(_0x2d0ed7,null))[_0x9d20('0x2c')](respondWithResult(_0x2d0ed7,null))['catch'](handleError(_0x2d0ed7,null));};exports[_0x9d20('0x52')]=function(_0x18cfa0,_0x123a41,_0x524b1d){return db['Plugin'][_0x9d20('0x51')]({'where':{'id':_0x18cfa0[_0x9d20('0x4e')]['id']},'attributes':[_0x9d20('0x30'),_0x9d20('0x7')],'raw':!![]})[_0x9d20('0x2c')](handleEntityNotFound(_0x123a41,null))[_0x9d20('0x2c')](function(_0x2e2db2){if(_0x2e2db2){var _0x198ae3=path[_0x9d20('0x53')](config['root'],_0x9d20('0x54'),util[_0x9d20('0x55')](_0x9d20('0x56'),path[_0x9d20('0x57')](_0x2e2db2[_0x9d20('0x7')])));var _0x92e6e=fs[_0x9d20('0x58')](_0x198ae3);var _0x468c3a=archiver('zip',{'zlib':{'level':0x9}});_0x468c3a['on'](_0x9d20('0x59'),function(_0xcbe5e7){if(_0xcbe5e7[_0x9d20('0x5a')]===_0x9d20('0x5b')){logger['error'](_0xcbe5e7);}else{throw new db[(_0x9d20('0x5c'))][(_0x9d20('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x468c3a['on']('error',function(_0x3e8454){throw new db[(_0x9d20('0x5c'))][(_0x9d20('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x468c3a[_0x9d20('0x5e')](_0x92e6e);_0x468c3a[_0x9d20('0x5f')](_0x9d20('0x60'),{'cwd':path[_0x9d20('0x53')](config[_0x9d20('0x61')],_0x9d20('0x54'),path[_0x9d20('0x62')](_0x2e2db2[_0x9d20('0x7')])),'ignore':[path['join'](path[_0x9d20('0x57')](_0x2e2db2[_0x9d20('0x7')]),'node_modules/**/*'),path[_0x9d20('0x53')](path[_0x9d20('0x57')](_0x2e2db2[_0x9d20('0x7')]),_0x9d20('0x63'))],'nodir':!![]})[_0x9d20('0x64')]();_0x92e6e['on'](_0x9d20('0x65'),function(){if(!fs['existsSync'](_0x198ae3)){throw new db['Sequelize'][(_0x9d20('0x5d'))]('Plugin\x20not\x20found');}return _0x123a41['download'](_0x198ae3,util[_0x9d20('0x55')](_0x9d20('0x56'),path['basename'](_0x2e2db2[_0x9d20('0x7')])),function(_0x381808){if(_0x381808){throw new db['Sequelize'][(_0x9d20('0x5d'))](_0x9d20('0x66'));}fs[_0x9d20('0x67')](_0x198ae3);logger[_0x9d20('0x68')](_0x9d20('0x69'));logger[_0x9d20('0x68')](_0x9d20('0x6a'));});});}return null;})[_0x9d20('0x4c')](handleError(_0x123a41,null));};exports[_0x9d20('0x6b')]=function(_0x5cbd97,_0x24b274,_0x28f6b4){var _0x29bf73=path[_0x9d20('0x57')](_0x5cbd97[_0x9d20('0x6c')][_0x9d20('0x6d')],path[_0x9d20('0x6e')](_0x5cbd97['file']['filename']));var _0x453874=path[_0x9d20('0x53')](config[_0x9d20('0x61')],'server/files/plugins',_0x5cbd97[_0x9d20('0x6c')][_0x9d20('0x6d')]);var _0x4c1962=path['join'](config[_0x9d20('0x61')],_0x9d20('0x54'),_0x29bf73);logger['info'](_0x9d20('0x6f'),_0x453874);logger['info'](_0x9d20('0x70'),_0x4c1962);try{fs[_0x9d20('0x71')](_0x453874,parseInt(_0x9d20('0x72'),0x8));extract(_0x453874,{'dir':_0x4c1962},function(_0x21f65b){if(_0x21f65b){logger[_0x9d20('0x73')](_0x21f65b);handleError(_0x21f65b,!![]);};var _0xaee1b9=fs[_0x9d20('0x74')](_0x4c1962);if(_0xaee1b9[_0x9d20('0x4f')]>0x1){removeReferences(_0x453874,_0x4c1962);logger[_0x9d20('0x73')](_0x9d20('0x75'));return _0x28f6b4(new Error(_0x9d20('0x75')));}var _0x9a662=fs[_0x9d20('0x76')](path['join'](_0x4c1962,_0xaee1b9[0x0]));if(_0x9a662[_0x9d20('0x77')]()){removeReferences(_0x453874,_0x4c1962);logger['error'](_0x9d20('0x75'));return _0x28f6b4(new Error(_0x9d20('0x75')));}if(_0x9a662[_0x9d20('0x78')]()){var _0x1bc963=fs[_0x9d20('0x74')](path[_0x9d20('0x53')](_0x4c1962,_0xaee1b9[0x0]));if(_0x1bc963['length']===0x0){removeReferences(_0x453874,_0x4c1962);logger['error'](_0x9d20('0x75'));return _0x28f6b4(new Error(_0x9d20('0x75')));}var _0x1fc9bc=_0x1bc963[_0x9d20('0x79')](function(_0x421c89){return _0x421c89===_0x9d20('0x7a');});if(!_0x1fc9bc){return _0x28f6b4(new Error(_0x9d20('0x7b')));}var _0x12b61e=fs[_0x9d20('0x7c')](path[_0x9d20('0x53')](_0x4c1962,_0xaee1b9[0x0],_0x9d20('0x7a')));var _0x2155f3=JSON[_0x9d20('0x7d')](_0x12b61e);if('undefined'==typeof _0x2155f3[_0x9d20('0x30')]){return _0x28f6b4(new Error(_0x9d20('0x7e')));}if(_0x9d20('0x7f')==typeof _0x2155f3[_0x9d20('0x36')]){return _0x28f6b4(new Error(_0x9d20('0x80')));}if(_0x9d20('0x7f')==typeof _0x2155f3[_0x9d20('0x81')]){return _0x28f6b4(new Error(_0x9d20('0x82')));}if(_0x9d20('0x7f')==typeof _0x2155f3[_0x9d20('0x83')]){return _0x28f6b4(new Error(_0x9d20('0x84')));}if(_0x2155f3[_0x9d20('0x36')]===_0x9d20('0x85')){if(_0x9d20('0x7f')==typeof _0x2155f3['parameters'][_0x9d20('0x86')]){return _0x28f6b4(new Error(_0x9d20('0x87')));}if(_0x9d20('0x7f')==typeof _0x2155f3[_0x9d20('0x83')]['views'][_0x9d20('0x88')]&&_0x9d20('0x7f')==typeof _0x2155f3['parameters']['views'][_0x9d20('0x89')]){return _0x28f6b4(new Error(_0x9d20('0x8a')));}}else if(_0x2155f3[_0x9d20('0x36')]===_0x9d20('0x8b')){if(_0x9d20('0x7f')==typeof _0x2155f3[_0x9d20('0x83')][_0x9d20('0x8c')]){return _0x28f6b4(new Error(_0x9d20('0x8d')));}if(_0x9d20('0x7f')==typeof _0x2155f3['parameters']['scriptPath']){return _0x28f6b4(new Error(_0x9d20('0x8e')));}}else{return _0x28f6b4(new Error(_0x9d20('0x8f')));}var _0x9cbe91=_0x2155f3[_0x9d20('0x30')];var _0x285ae2=_0x2155f3[_0x9d20('0x90')];var _0x1cf481=_0x2155f3[_0x9d20('0x36')];var _0x571bbc=_0x2155f3[_0x9d20('0x91')]?_0x2155f3[_0x9d20('0x91')]:_0x9d20('0x92');var _0x125d88=_0x2155f3['icon']?_0x2155f3[_0x9d20('0x93')]:_0x9d20('0x94');var _0x5b5c8b='';var _0x409483='';var _0x3e4c3a='';var _0x293246='';var _0xbeb62f=_0x2155f3[_0x9d20('0x81')];if(_0x1cf481===_0x9d20('0x85')){if(_0x9d20('0x7f')!=typeof _0x2155f3[_0x9d20('0x83')][_0x9d20('0x86')][_0x9d20('0x88')]){var _0x3d7edb=_0x2155f3[_0x9d20('0x83')][_0x9d20('0x86')][_0x9d20('0x88')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3d7edb)){_0x5b5c8b=path[_0x9d20('0x53')](_0x9d20('0x95'),_0x29bf73,_0xaee1b9[0x0],_0x3d7edb);}else{_0x5b5c8b=_0x3d7edb;}}else{logger[_0x9d20('0x68')](_0x9d20('0x96'));}if('undefined'!=typeof _0x2155f3['parameters'][_0x9d20('0x86')][_0x9d20('0x89')]){var _0x4f8245=_0x2155f3[_0x9d20('0x83')][_0x9d20('0x86')][_0x9d20('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4f8245)){_0x409483=path['join']('plugins',_0x29bf73,_0xaee1b9[0x0],_0x4f8245);}else{_0x409483=_0x4f8245;}}else{logger[_0x9d20('0x68')](_0x9d20('0x97'));}}else if(_0x1cf481===_0x9d20('0x8b')){_0x3e4c3a=_0x2155f3['parameters'][_0x9d20('0x8c')];_0x293246=_0x2155f3[_0x9d20('0x83')][_0x9d20('0x98')];if(_0x9d20('0x7f')!=typeof _0x2155f3[_0x9d20('0x83')]['views']){if(_0x9d20('0x7f')!=typeof _0x2155f3[_0x9d20('0x83')][_0x9d20('0x86')][_0x9d20('0x88')]){var _0x3d7edb=_0x2155f3[_0x9d20('0x83')][_0x9d20('0x86')][_0x9d20('0x88')];if(!/^(f|ht)tps?:\/\//i[_0x9d20('0x99')](_0x3d7edb)){_0x5b5c8b=path[_0x9d20('0x53')](_0x9d20('0x95'),_0x29bf73,_0xaee1b9[0x0],_0x3d7edb);}else{_0x5b5c8b=_0x3d7edb;}}if('undefined'!=typeof _0x2155f3[_0x9d20('0x83')][_0x9d20('0x86')][_0x9d20('0x89')]){var _0x4f8245=_0x2155f3[_0x9d20('0x83')][_0x9d20('0x86')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9d20('0x99')](_0x4f8245)){_0x409483=path[_0x9d20('0x53')](_0x9d20('0x95'),_0x29bf73,_0xaee1b9[0x0],_0x4f8245);}else{_0x409483=_0x4f8245;}}}}var _0x1e3e66={'name':_0x9cbe91,'description':_0x285ae2,'path':path[_0x9d20('0x53')](_0x29bf73,_0xaee1b9[0x0]),'type':_0x1cf481,'sidebar':_0x571bbc,'icon':_0x125d88,'adminUrl':_0x5b5c8b,'agentUrl':_0x409483,'scriptName':_0x3e4c3a,'scriptPath':_0x293246,'version':_0xbeb62f};removeReferences(_0x453874,null);return db[_0x9d20('0x33')][_0x9d20('0x9a')](_0x1e3e66)['then'](function(_0x2aa07e){var _0x43a953={'role':_0x5cbd97['body'][_0x9d20('0x9b')],'userProfileId':_0x5cbd97['body']['userProfileId']};if(!_0x43a953)throw new Error(_0x9d20('0x9c'));if(_0x43a953[_0x9d20('0x9b')]==='user'){var _0x563692=_0x2aa07e[_0x9d20('0x2e')]({'plain':!![]});return db[_0x9d20('0x9d')][_0x9d20('0x51')]({'where':{'name':_0x9d20('0x2f'),'userProfileId':_0x43a953[_0x9d20('0x9e')]},'raw':!![]})[_0x9d20('0x2c')](function(_0x3c56d4){if(_0x3c56d4&&_0x3c56d4[_0x9d20('0x9f')]===0x0){return db['UserProfileResource'][_0x9d20('0x9a')]({'name':_0x563692[_0x9d20('0x30')],'resourceId':_0x563692['id'],'type':_0x3c56d4[_0x9d20('0x30')],'sectionId':_0x3c56d4['id']},{})['then'](function(){return _0x2aa07e;});}else{return _0x2aa07e;}})[_0x9d20('0x4c')](function(_0x54df01){logger[_0x9d20('0x73')](_0x9d20('0xa0'),_0x54df01);throw _0x54df01;});}return _0x2aa07e;})[_0x9d20('0x2c')](respondWithResult(_0x24b274,null))[_0x9d20('0x4c')](handleError(_0x24b274,null));}});}catch(_0x19b923){_0x24b274['status'](0x1f4)['send'](_0x19b923);}};function removeReferences(_0x3c27c9,_0x38af0a){try{if(_0x3c27c9){fs[_0x9d20('0x67')](_0x3c27c9);logger[_0x9d20('0x68')](_0x9d20('0xa1'));}if(_0x38af0a){rimraf(_0x38af0a,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x229f84){logger[_0x9d20('0x73')](_0x229f84);}}exports['update']=function(_0x157ad3,_0x51e8af,_0x100e67){return db[_0x9d20('0x33')][_0x9d20('0x51')]({'where':{'id':_0x157ad3['params']['id']}})[_0x9d20('0x2c')](handleEntityNotFound(_0x51e8af,null))[_0x9d20('0x2c')](saveUpdates(_0x157ad3[_0x9d20('0xa2')],null))[_0x9d20('0x2c')](respondWithResult(_0x51e8af,null))['catch'](handleError(_0x51e8af,null));};exports[_0x9d20('0xa3')]=function(_0x447679,_0x3ba767,_0x275062){return db[_0x9d20('0x33')][_0x9d20('0x51')]({'where':{'id':_0x447679[_0x9d20('0x4e')]['id']}})[_0x9d20('0x2c')](function(_0x3362c8){if(_0x3362c8){return _0x3362c8['destroy']();}})[_0x9d20('0x2c')](function(_0x3c0f89){rimraf(path[_0x9d20('0x53')](config['root'],'server/files/plugins',path[_0x9d20('0x62')](_0x3c0f89[_0x9d20('0x7')])),function(){});return _0x3c0f89;})['then'](handleEntityNotFound(_0x3ba767,null))[_0x9d20('0x2c')](respondWithStatusCode(_0x3ba767,null))['catch'](handleError(_0x3ba767,null));};exports[_0x9d20('0xa4')]=function(_0x56dffa,_0xf1d220,_0x2ead48){return BPromise[_0x9d20('0xa5')]()[_0x9d20('0x2c')](function(){if(!_0x56dffa[_0x9d20('0x39')][_0x9d20('0x7')]){throw new Error(_0x9d20('0xa6'));}if(!_0x56dffa[_0x9d20('0x39')]['port']){throw new Error(_0x9d20('0xa7'));}var _0xa1fe5b=_0x56dffa['query'][_0x9d20('0xa8')]?_0x56dffa['query']['hostname']+':'+_0x56dffa[_0x9d20('0x39')][_0x9d20('0xa9')]:_0x9d20('0xaa')+_0x56dffa[_0x9d20('0x39')]['port'];var _0x327778=_0x56dffa[_0x9d20('0x39')][_0x9d20('0x23')]?_0x56dffa['query'][_0x9d20('0x23')]:!![];var _0x2b8274=_0x56dffa[_0x9d20('0x39')][_0x9d20('0xab')]?_0x56dffa[_0x9d20('0x39')][_0x9d20('0xab')]:null;var _0x17e9a1={'method':_0x56dffa[_0x9d20('0xac')],'uri':util[_0x9d20('0x55')](_0x9d20('0xad'),_0xa1fe5b,_0x56dffa[_0x9d20('0x39')]['path']),'json':_0x327778,'resolveWithFullResponse':!![],'encoding':_0x2b8274,'qs':_0x56dffa[_0x9d20('0x39')]};if(_0x56dffa[_0x9d20('0xae')]){_0x17e9a1[_0x9d20('0xae')]=_0x56dffa[_0x9d20('0xae')];if(_0x17e9a1[_0x9d20('0xae')][_0x9d20('0xaf')]){delete _0x17e9a1['headers'][_0x9d20('0xaf')];}}if(_0x17e9a1[_0x9d20('0xae')][_0x9d20('0xb0')]){delete _0x17e9a1[_0x9d20('0xae')][_0x9d20('0xb0')];}return rp(_0x17e9a1);})['then'](function(_0x4a3e31){if(_0x4a3e31){_0xf1d220['set'](_0x4a3e31['headers']);logger[_0x9d20('0x68')](_0x4a3e31[_0x9d20('0xa2')]);if(_[_0x9d20('0xb1')](_0x56dffa[_0x9d20('0x39')]['path'],'download')&&_0x4a3e31[_0x9d20('0xb2')]==0x1f4){return _0xf1d220[_0x9d20('0x20')](_0x4a3e31[_0x9d20('0xb2')]);}else{return _0xf1d220[_0x9d20('0x21')](_0x4a3e31['statusCode'])[_0x9d20('0x31')](_0x4a3e31['body']);}}else{return _0xf1d220['sendStatus'](0xc8);}})[_0x9d20('0x4c')](handleError(_0xf1d220,null));};exports[_0x9d20('0xb3')]=function(_0x4daefd,_0x30ee88,_0x1d0b32){return BPromise['resolve']()[_0x9d20('0x2c')](function(){if(!_0x4daefd[_0x9d20('0x39')][_0x9d20('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x4daefd['query']['port']){throw new Error(_0x9d20('0xa7'));}var _0x2fee11=_0x4daefd['query']['hostname']?_0x4daefd['query'][_0x9d20('0xa8')]+':'+_0x4daefd[_0x9d20('0x39')][_0x9d20('0xa9')]:_0x9d20('0xaa')+_0x4daefd[_0x9d20('0x39')][_0x9d20('0xa9')];var _0x2ff0e4=_0x4daefd[_0x9d20('0x39')][_0x9d20('0x23')]?_0x4daefd['query'][_0x9d20('0x23')]:!![];var _0x1162bd=_0x4daefd[_0x9d20('0x39')][_0x9d20('0xab')]?_0x4daefd[_0x9d20('0x39')][_0x9d20('0xab')]:null;var _0x1e410e={'method':_0x4daefd['method'],'uri':util[_0x9d20('0x55')]('%s%s',_0x2fee11,_0x4daefd['query'][_0x9d20('0x7')]),'json':_0x2ff0e4,'resolveWithFullResponse':!![],'encoding':_0x1162bd,'body':_0x4daefd[_0x9d20('0xa2')]};if(_0x4daefd[_0x9d20('0xae')]){_0x1e410e[_0x9d20('0xae')]=_0x4daefd[_0x9d20('0xae')];if(_0x1e410e[_0x9d20('0xae')][_0x9d20('0xaf')]){delete _0x1e410e[_0x9d20('0xae')]['content-length'];}}if(_0x1e410e['headers'][_0x9d20('0xb0')]){delete _0x1e410e[_0x9d20('0xae')][_0x9d20('0xb0')];}return rp(_0x1e410e);})[_0x9d20('0x2c')](function(_0x17c3c5){if(_0x17c3c5){_0x30ee88[_0x9d20('0x27')](_0x17c3c5[_0x9d20('0xae')]);logger[_0x9d20('0x68')](_0x17c3c5['body']);return _0x30ee88[_0x9d20('0x21')](_0x17c3c5['statusCode'])[_0x9d20('0x31')](_0x17c3c5['body']);}else{return _0x30ee88[_0x9d20('0x20')](0xc8);}})[_0x9d20('0x4c')](handleError(_0x30ee88,null));}; \ No newline at end of file +var _0x54a5=['download','find','path','join','root','server/files/plugins','basename','createWriteStream','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','info','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20views\x20missing','admin','views','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','always','icon','html','test','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','plugins','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','headers','content-length','statusCode','webhookPost','%s%s','content-type','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./plugin.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Plugins','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','type','VIRTUAL','merge','options','where','includeAll','include','Plugin','findAll','rows','catch','show','params'];(function(_0xdbf39f,_0x3cfbe7){var _0x12358e=function(_0x43eb9e){while(--_0x43eb9e){_0xdbf39f['push'](_0xdbf39f['shift']());}};_0x12358e(++_0x3cfbe7);}(_0x54a5,0x100));var _0x554a=function(_0x43a485,_0x336240){_0x43a485=_0x43a485-0x0;var _0x10ffa6=_0x54a5[_0x43a485];return _0x10ffa6;};'use strict';var emlformat=require(_0x554a('0x0'));var rimraf=require(_0x554a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x554a('0x2'));var moment=require(_0x554a('0x3'));var BPromise=require(_0x554a('0x4'));var Mustache=require(_0x554a('0x5'));var util=require(_0x554a('0x6'));var path=require('path');var sox=require(_0x554a('0x7'));var csv=require(_0x554a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x554a('0x9'));var _=require(_0x554a('0xa'));var squel=require('squel');var crypto=require(_0x554a('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x554a('0x8'));var querystring=require(_0x554a('0xc'));var Papa=require(_0x554a('0xd'));var extract=require(_0x554a('0xe'));var rimraf=require(_0x554a('0x1'));var archiver=require(_0x554a('0xf'));var Redis=require(_0x554a('0x10'));var authService=require(_0x554a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x554a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x554a('0x13'))(_0x554a('0x14'));var utils=require(_0x554a('0x15'));var config=require(_0x554a('0x16'));var licenseUtil=require(_0x554a('0x17'));var db=require('../../mysqldb')['db'];config[_0x554a('0x18')]=_[_0x554a('0x19')](config[_0x554a('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x554a('0x18')]));require(_0x554a('0x1a'))[_0x554a('0x1b')](socket);function respondWithStatusCode(_0x46f957,_0x542954){_0x542954=_0x542954||0xcc;return function(_0x135367){if(_0x135367){return _0x46f957[_0x554a('0x1c')](_0x542954);}return _0x46f957[_0x554a('0x1d')](_0x542954)[_0x554a('0x1e')]();};}function respondWithResult(_0x197aff,_0x3acd6f){_0x3acd6f=_0x3acd6f||0xc8;return function(_0x222536){if(_0x222536){return _0x197aff[_0x554a('0x1d')](_0x3acd6f)['json'](_0x222536);}};}function respondWithFilteredResult(_0x5d1ef2,_0x29ff18){return function(_0x4ea8b9){if(_0x4ea8b9){var _0x4c8196=typeof _0x29ff18['offset']===_0x554a('0x1f')&&typeof _0x29ff18[_0x554a('0x20')]==='undefined';var _0x7c9475=_0x4ea8b9[_0x554a('0x21')];var _0x18ed39=_0x4c8196?0x0:_0x29ff18[_0x554a('0x22')];var _0xd0a444=_0x4c8196?_0x4ea8b9[_0x554a('0x21')]:_0x29ff18[_0x554a('0x22')]+_0x29ff18[_0x554a('0x20')];var _0x24bd71;if(_0xd0a444>=_0x7c9475){_0xd0a444=_0x7c9475;_0x24bd71=0xc8;}else{_0x24bd71=0xce;}_0x5d1ef2[_0x554a('0x1d')](_0x24bd71);return _0x5d1ef2[_0x554a('0x23')](_0x554a('0x24'),_0x18ed39+'-'+_0xd0a444+'/'+_0x7c9475)[_0x554a('0x25')](_0x4ea8b9);}return null;};}function patchUpdates(_0x105ec7){return function(_0x1e5435){try{jsonpatch[_0x554a('0x26')](_0x1e5435,_0x105ec7,!![]);}catch(_0x216851){return BPromise[_0x554a('0x27')](_0x216851);}return _0x1e5435[_0x554a('0x28')]();};}function saveUpdates(_0x496104,_0x1e6b2c){return function(_0xaad82e){if(_0xaad82e){return _0xaad82e[_0x554a('0x29')](_0x496104)['then'](function(_0x41dc52){return _0x41dc52;});}return null;};}function removeEntity(_0x327b26,_0x81fb50){return function(_0x576092){if(_0x576092){return _0x576092[_0x554a('0x2a')]()[_0x554a('0x2b')](function(){var _0x2c4716=_0x576092[_0x554a('0x2c')]({'plain':!![]});var _0x14112e=_0x554a('0x2d');return db[_0x554a('0x2e')]['destroy']({'where':{'type':_0x14112e,'resourceId':_0x2c4716['id']}})[_0x554a('0x2b')](function(){return _0x576092;});})[_0x554a('0x2b')](function(){_0x327b26['status'](0xcc)[_0x554a('0x1e')]();});}};}function handleEntityNotFound(_0xdcb9d5,_0x29452f){return function(_0x4e2e7c){if(!_0x4e2e7c){_0xdcb9d5[_0x554a('0x1c')](0x194);}return _0x4e2e7c;};}function handleError(_0x5a4882,_0x595dd0){_0x595dd0=_0x595dd0||0x1f4;return function(_0x3a5c43){logger[_0x554a('0x2f')](_0x3a5c43[_0x554a('0x30')]);if(_0x3a5c43[_0x554a('0x31')]){delete _0x3a5c43[_0x554a('0x31')];}_0x5a4882[_0x554a('0x1d')](_0x595dd0)[_0x554a('0x32')](_0x3a5c43);};}exports[_0x554a('0x33')]=function(_0x511107,_0x37b02b){var _0x41ca69={},_0x49288c={},_0x25a8a2={'count':0x0,'rows':[]};var _0xd055d6=_[_0x554a('0x34')](db['Plugin'][_0x554a('0x35')],function(_0x5e0414){return{'name':_0x5e0414[_0x554a('0x36')],'type':_0x5e0414['type'][_0x554a('0x37')]};});_0x49288c[_0x554a('0x38')]=_[_0x554a('0x34')](_0xd055d6,'name');_0x49288c[_0x554a('0x39')]=_[_0x554a('0x3a')](_0x511107[_0x554a('0x39')]);_0x49288c[_0x554a('0x3b')]=_[_0x554a('0x3c')](_0x49288c[_0x554a('0x38')],_0x49288c[_0x554a('0x39')]);_0x41ca69[_0x554a('0x3d')]=_[_0x554a('0x3c')](_0x49288c[_0x554a('0x38')],qs[_0x554a('0x3e')](_0x511107[_0x554a('0x39')][_0x554a('0x3e')]));_0x41ca69[_0x554a('0x3d')]=_0x41ca69[_0x554a('0x3d')][_0x554a('0x3f')]?_0x41ca69['attributes']:_0x49288c['model'];if(!_0x511107[_0x554a('0x39')][_0x554a('0x40')](_0x554a('0x41'))){_0x41ca69[_0x554a('0x20')]=qs[_0x554a('0x20')](_0x511107[_0x554a('0x39')][_0x554a('0x20')]);_0x41ca69[_0x554a('0x22')]=qs[_0x554a('0x22')](_0x511107[_0x554a('0x39')][_0x554a('0x22')]);}_0x41ca69[_0x554a('0x42')]=qs[_0x554a('0x43')](_0x511107[_0x554a('0x39')][_0x554a('0x43')]);_0x41ca69['where']=qs[_0x554a('0x3b')](_['pick'](_0x511107['query'],_0x49288c[_0x554a('0x3b')]),_0xd055d6);if(_0x511107[_0x554a('0x39')][_0x554a('0x44')]){_0x41ca69['where']=_['merge'](_0x41ca69['where'],{'$or':_[_0x554a('0x34')](_0xd055d6,function(_0x163b50){if(_0x163b50[_0x554a('0x45')]!==_0x554a('0x46')){var _0x74e91a={};_0x74e91a[_0x163b50[_0x554a('0x31')]]={'$like':'%'+_0x511107[_0x554a('0x39')][_0x554a('0x44')]+'%'};return _0x74e91a;}})});}_0x41ca69=_[_0x554a('0x47')]({},_0x41ca69,_0x511107[_0x554a('0x48')]);var _0x28004c={'where':_0x41ca69[_0x554a('0x49')]};return db['Plugin'][_0x554a('0x21')](_0x28004c)[_0x554a('0x2b')](function(_0x28e9ae){_0x25a8a2[_0x554a('0x21')]=_0x28e9ae;if(_0x511107[_0x554a('0x39')][_0x554a('0x4a')]){_0x41ca69[_0x554a('0x4b')]=[{'all':!![]}];}return db[_0x554a('0x4c')][_0x554a('0x4d')](_0x41ca69);})['then'](function(_0x194c78){_0x25a8a2[_0x554a('0x4e')]=_0x194c78;return _0x25a8a2;})[_0x554a('0x2b')](respondWithFilteredResult(_0x37b02b,_0x41ca69))[_0x554a('0x4f')](handleError(_0x37b02b,null));};exports[_0x554a('0x50')]=function(_0x2ea47c,_0x486065){var _0x4649d6={'raw':!![],'where':{'id':_0x2ea47c[_0x554a('0x51')]['id']}},_0x367d76={};_0x367d76[_0x554a('0x38')]=_[_0x554a('0x3a')](db[_0x554a('0x4c')][_0x554a('0x35')]);_0x367d76['query']=_['keys'](_0x2ea47c[_0x554a('0x39')]);_0x367d76[_0x554a('0x3b')]=_['intersection'](_0x367d76[_0x554a('0x38')],_0x367d76['query']);_0x4649d6[_0x554a('0x3d')]=_[_0x554a('0x3c')](_0x367d76[_0x554a('0x38')],qs[_0x554a('0x3e')](_0x2ea47c['query'][_0x554a('0x3e')]));_0x4649d6[_0x554a('0x3d')]=_0x4649d6[_0x554a('0x3d')][_0x554a('0x3f')]?_0x4649d6[_0x554a('0x3d')]:_0x367d76[_0x554a('0x38')];if(_0x2ea47c[_0x554a('0x39')]['includeAll']){_0x4649d6[_0x554a('0x4b')]=[{'all':!![]}];}_0x4649d6=_[_0x554a('0x47')]({},_0x4649d6,_0x2ea47c['options']);return db[_0x554a('0x4c')]['find'](_0x4649d6)['then'](handleEntityNotFound(_0x486065,null))[_0x554a('0x2b')](respondWithResult(_0x486065,null))[_0x554a('0x4f')](handleError(_0x486065,null));};exports[_0x554a('0x52')]=function(_0x50817e,_0x51522a,_0x279faa){return db['Plugin'][_0x554a('0x53')]({'where':{'id':_0x50817e[_0x554a('0x51')]['id']},'attributes':['name',_0x554a('0x54')],'raw':!![]})[_0x554a('0x2b')](handleEntityNotFound(_0x51522a,null))[_0x554a('0x2b')](function(_0x55a996){if(_0x55a996){var _0x1d6fb0=path[_0x554a('0x55')](config[_0x554a('0x56')],_0x554a('0x57'),util['format']('%s.zip',path[_0x554a('0x58')](_0x55a996[_0x554a('0x54')])));var _0x234110=fs[_0x554a('0x59')](_0x1d6fb0);var _0x16fc76=archiver(_0x554a('0x5a'),{'zlib':{'level':0x9}});_0x16fc76['on'](_0x554a('0x5b'),function(_0x3234cc){if(_0x3234cc['code']===_0x554a('0x5c')){logger[_0x554a('0x2f')](_0x3234cc);}else{throw new db[(_0x554a('0x5d'))][(_0x554a('0x5e'))](_0x554a('0x5f'));}});_0x16fc76['on']('error',function(_0x25c745){throw new db[(_0x554a('0x5d'))][(_0x554a('0x5e'))](_0x554a('0x5f'));});_0x16fc76['pipe'](_0x234110);_0x16fc76[_0x554a('0x60')](_0x554a('0x61'),{'cwd':path[_0x554a('0x55')](config[_0x554a('0x56')],'server/files/plugins',path[_0x554a('0x62')](_0x55a996['path'])),'ignore':[path[_0x554a('0x55')](path[_0x554a('0x58')](_0x55a996['path']),_0x554a('0x63')),path[_0x554a('0x55')](path[_0x554a('0x58')](_0x55a996[_0x554a('0x54')]),_0x554a('0x64'))],'nodir':!![]})[_0x554a('0x65')]();_0x234110['on'](_0x554a('0x66'),function(){if(!fs['existsSync'](_0x1d6fb0)){throw new db['Sequelize'][(_0x554a('0x5e'))]('Plugin\x20not\x20found');}return _0x51522a['download'](_0x1d6fb0,util[_0x554a('0x67')]('%s.zip',path['basename'](_0x55a996[_0x554a('0x54')])),function(_0x99b643){if(_0x99b643){throw new db[(_0x554a('0x5d'))][(_0x554a('0x5e'))](_0x554a('0x68'));}fs[_0x554a('0x69')](_0x1d6fb0);logger['info'](_0x554a('0x6a'));logger['info'](_0x554a('0x6b'));});});}return null;})[_0x554a('0x4f')](handleError(_0x51522a,null));};exports[_0x554a('0x6c')]=function(_0x105ffb,_0x24e249,_0x216376){var _0xff0cce=path[_0x554a('0x58')](_0x105ffb[_0x554a('0x6d')][_0x554a('0x6e')],path['extname'](_0x105ffb[_0x554a('0x6d')]['filename']));var _0x528f51=path['join'](config['root'],'server/files/plugins',_0x105ffb['file']['filename']);var _0x3782b9=path[_0x554a('0x55')](config[_0x554a('0x56')],_0x554a('0x57'),_0xff0cce);logger[_0x554a('0x6f')]('Plugin\x20upload\x20filepath:\x20%s',_0x528f51);logger['info'](_0x554a('0x70'),_0x3782b9);try{fs[_0x554a('0x71')](_0x528f51,parseInt(_0x554a('0x72'),0x8));extract(_0x528f51,{'dir':_0x3782b9},function(_0x5d5d03){if(_0x5d5d03){logger['error'](_0x5d5d03);handleError(_0x5d5d03,!![]);};var _0x32c56c=fs[_0x554a('0x73')](_0x3782b9);if(_0x32c56c[_0x554a('0x3f')]>0x1){removeReferences(_0x528f51,_0x3782b9);logger[_0x554a('0x2f')]('Invalid\x20plugin\x20structure');return _0x216376(new Error(_0x554a('0x74')));}var _0x3d90c5=fs['lstatSync'](path[_0x554a('0x55')](_0x3782b9,_0x32c56c[0x0]));if(_0x3d90c5['isFile']()){removeReferences(_0x528f51,_0x3782b9);logger['error']('Invalid\x20plugin\x20structure');return _0x216376(new Error('Invalid\x20plugin\x20structure'));}if(_0x3d90c5[_0x554a('0x75')]()){var _0x1780c4=fs[_0x554a('0x73')](path[_0x554a('0x55')](_0x3782b9,_0x32c56c[0x0]));if(_0x1780c4[_0x554a('0x3f')]===0x0){removeReferences(_0x528f51,_0x3782b9);logger[_0x554a('0x2f')](_0x554a('0x74'));return _0x216376(new Error(_0x554a('0x74')));}var _0x9b7769=_0x1780c4[_0x554a('0x76')](function(_0x727c44){return _0x727c44===_0x554a('0x77');});if(!_0x9b7769){return _0x216376(new Error(_0x554a('0x78')));}var _0x1049d5=fs['readFileSync'](path[_0x554a('0x55')](_0x3782b9,_0x32c56c[0x0],_0x554a('0x77')));var _0x1c742e=JSON[_0x554a('0x79')](_0x1049d5);if(_0x554a('0x1f')==typeof _0x1c742e[_0x554a('0x31')]){return _0x216376(new Error(_0x554a('0x7a')));}if('undefined'==typeof _0x1c742e[_0x554a('0x45')]){return _0x216376(new Error(_0x554a('0x7b')));}if('undefined'==typeof _0x1c742e[_0x554a('0x7c')]){return _0x216376(new Error(_0x554a('0x7d')));}if(_0x554a('0x1f')==typeof _0x1c742e['parameters']){return _0x216376(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x1c742e[_0x554a('0x45')]==='html'){if(_0x554a('0x1f')==typeof _0x1c742e[_0x554a('0x7e')]['views']){return _0x216376(new Error(_0x554a('0x7f')));}if(_0x554a('0x1f')==typeof _0x1c742e[_0x554a('0x7e')]['views'][_0x554a('0x80')]&&_0x554a('0x1f')==typeof _0x1c742e[_0x554a('0x7e')][_0x554a('0x81')]['agent']){return _0x216376(new Error(_0x554a('0x82')));}}else if(_0x1c742e[_0x554a('0x45')]===_0x554a('0x83')){if(_0x554a('0x1f')==typeof _0x1c742e[_0x554a('0x7e')][_0x554a('0x84')]){return _0x216376(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x554a('0x1f')==typeof _0x1c742e[_0x554a('0x7e')][_0x554a('0x85')]){return _0x216376(new Error(_0x554a('0x86')));}}else{return _0x216376(new Error(_0x554a('0x87')));}var _0x211e70=_0x1c742e[_0x554a('0x31')];var _0x38e0c3=_0x1c742e['description'];var _0x4c99c6=_0x1c742e[_0x554a('0x45')];var _0x5b1821=_0x1c742e['sidebar']?_0x1c742e['sidebar']:_0x554a('0x88');var _0xab03e1=_0x1c742e['icon']?_0x1c742e[_0x554a('0x89')]:'icon-apps';var _0x3d827c='';var _0xa80dd8='';var _0x33c4b6='';var _0x802975='';var _0x3ba3ed=_0x1c742e[_0x554a('0x7c')];if(_0x4c99c6===_0x554a('0x8a')){if(_0x554a('0x1f')!=typeof _0x1c742e[_0x554a('0x7e')]['views'][_0x554a('0x80')]){var _0x53f2b1=_0x1c742e[_0x554a('0x7e')][_0x554a('0x81')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x554a('0x8b')](_0x53f2b1)){_0x3d827c=path[_0x554a('0x55')]('plugins',_0xff0cce,_0x32c56c[0x0],_0x53f2b1);}else{_0x3d827c=_0x53f2b1;}}else{logger['info'](_0x554a('0x8c'));}if(_0x554a('0x1f')!=typeof _0x1c742e[_0x554a('0x7e')][_0x554a('0x81')][_0x554a('0x8d')]){var _0x324196=_0x1c742e[_0x554a('0x7e')][_0x554a('0x81')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x554a('0x8b')](_0x324196)){_0xa80dd8=path['join']('plugins',_0xff0cce,_0x32c56c[0x0],_0x324196);}else{_0xa80dd8=_0x324196;}}else{logger[_0x554a('0x6f')](_0x554a('0x8e'));}}else if(_0x4c99c6==='script'){_0x33c4b6=_0x1c742e[_0x554a('0x7e')][_0x554a('0x84')];_0x802975=_0x1c742e[_0x554a('0x7e')][_0x554a('0x85')];if(_0x554a('0x1f')!=typeof _0x1c742e[_0x554a('0x7e')]['views']){if(_0x554a('0x1f')!=typeof _0x1c742e[_0x554a('0x7e')]['views'][_0x554a('0x80')]){var _0x53f2b1=_0x1c742e[_0x554a('0x7e')][_0x554a('0x81')][_0x554a('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x554a('0x8b')](_0x53f2b1)){_0x3d827c=path[_0x554a('0x55')](_0x554a('0x8f'),_0xff0cce,_0x32c56c[0x0],_0x53f2b1);}else{_0x3d827c=_0x53f2b1;}}if(_0x554a('0x1f')!=typeof _0x1c742e[_0x554a('0x7e')]['views']['agent']){var _0x324196=_0x1c742e['parameters'][_0x554a('0x81')][_0x554a('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x554a('0x8b')](_0x324196)){_0xa80dd8=path[_0x554a('0x55')](_0x554a('0x8f'),_0xff0cce,_0x32c56c[0x0],_0x324196);}else{_0xa80dd8=_0x324196;}}}}var _0x1ee63e={'name':_0x211e70,'description':_0x38e0c3,'path':path[_0x554a('0x55')](_0xff0cce,_0x32c56c[0x0]),'type':_0x4c99c6,'sidebar':_0x5b1821,'icon':_0xab03e1,'adminUrl':_0x3d827c,'agentUrl':_0xa80dd8,'scriptName':_0x33c4b6,'scriptPath':_0x802975,'version':_0x3ba3ed};removeReferences(_0x528f51,null);return db[_0x554a('0x4c')][_0x554a('0x90')](_0x1ee63e)[_0x554a('0x2b')](function(_0x2574a6){var _0x2e4577={'role':_0x105ffb[_0x554a('0x91')]['role'],'userProfileId':_0x105ffb[_0x554a('0x91')][_0x554a('0x92')]};if(!_0x2e4577)throw new Error(_0x554a('0x93'));if(_0x2e4577[_0x554a('0x94')]===_0x554a('0x95')){var _0x52c823=_0x2574a6[_0x554a('0x2c')]({'plain':!![]});return db[_0x554a('0x96')][_0x554a('0x53')]({'where':{'name':'Plugins','userProfileId':_0x2e4577[_0x554a('0x92')]},'raw':!![]})[_0x554a('0x2b')](function(_0x414658){if(_0x414658&&_0x414658[_0x554a('0x97')]===0x0){return db[_0x554a('0x2e')][_0x554a('0x90')]({'name':_0x52c823[_0x554a('0x31')],'resourceId':_0x52c823['id'],'type':_0x414658[_0x554a('0x31')],'sectionId':_0x414658['id']},{})[_0x554a('0x2b')](function(){return _0x2574a6;});}else{return _0x2574a6;}})[_0x554a('0x4f')](function(_0x49de71){logger['error'](_0x554a('0x98'),_0x49de71);throw _0x49de71;});}return _0x2574a6;})[_0x554a('0x2b')](respondWithResult(_0x24e249,null))['catch'](handleError(_0x24e249,null));}});}catch(_0x560bb7){_0x24e249[_0x554a('0x1d')](0x1f4)['send'](_0x560bb7);}};function removeReferences(_0x3b1fcd,_0x221b8a){try{if(_0x3b1fcd){fs['unlinkSync'](_0x3b1fcd);logger[_0x554a('0x6f')](_0x554a('0x99'));}if(_0x221b8a){rimraf(_0x221b8a,function(){});logger[_0x554a('0x6f')](_0x554a('0x9a'));}}catch(_0x53f5b7){logger['error'](_0x53f5b7);}}exports[_0x554a('0x29')]=function(_0xa6e21,_0x1ac153,_0x2e36d8){return db[_0x554a('0x4c')][_0x554a('0x53')]({'where':{'id':_0xa6e21['params']['id']}})[_0x554a('0x2b')](handleEntityNotFound(_0x1ac153,null))['then'](saveUpdates(_0xa6e21[_0x554a('0x91')],null))[_0x554a('0x2b')](respondWithResult(_0x1ac153,null))[_0x554a('0x4f')](handleError(_0x1ac153,null));};exports[_0x554a('0x9b')]=function(_0x18dd3b,_0xc96eac,_0x40dd56){return db[_0x554a('0x4c')][_0x554a('0x53')]({'where':{'id':_0x18dd3b[_0x554a('0x51')]['id']}})['then'](function(_0x1c2e98){if(_0x1c2e98){return _0x1c2e98[_0x554a('0x2a')]();}})[_0x554a('0x2b')](function(_0x1b995e){rimraf(path[_0x554a('0x55')](config['root'],'server/files/plugins',path[_0x554a('0x62')](_0x1b995e[_0x554a('0x54')])),function(){});return _0x1b995e;})['then'](handleEntityNotFound(_0xc96eac,null))[_0x554a('0x2b')](respondWithStatusCode(_0xc96eac,null))[_0x554a('0x4f')](handleError(_0xc96eac,null));};exports[_0x554a('0x9c')]=function(_0xde35a5,_0x1d510d,_0x295d7b){return BPromise['resolve']()[_0x554a('0x2b')](function(){if(!_0xde35a5[_0x554a('0x39')]['path']){throw new Error(_0x554a('0x9d'));}if(!_0xde35a5['query'][_0x554a('0x9e')]){throw new Error(_0x554a('0x9f'));}var _0xb1ce6=_0xde35a5[_0x554a('0x39')][_0x554a('0xa0')]?_0xde35a5[_0x554a('0x39')][_0x554a('0xa0')]+':'+_0xde35a5['query'][_0x554a('0x9e')]:'http://localhost:'+_0xde35a5[_0x554a('0x39')][_0x554a('0x9e')];var _0xaf630=_0xde35a5[_0x554a('0x39')]['json']?_0xde35a5[_0x554a('0x39')][_0x554a('0x25')]:!![];var _0x35abd5=_0xde35a5[_0x554a('0x39')]['encoding']?_0xde35a5[_0x554a('0x39')][_0x554a('0xa1')]:null;var _0x1cf6fd={'method':_0xde35a5[_0x554a('0xa2')],'uri':util[_0x554a('0x67')]('%s%s',_0xb1ce6,_0xde35a5[_0x554a('0x39')][_0x554a('0x54')]),'json':_0xaf630,'resolveWithFullResponse':!![],'encoding':_0x35abd5,'qs':_0xde35a5[_0x554a('0x39')]};if(_0xde35a5[_0x554a('0xa3')]){_0x1cf6fd[_0x554a('0xa3')]=_0xde35a5[_0x554a('0xa3')];if(_0x1cf6fd['headers'][_0x554a('0xa4')]){delete _0x1cf6fd[_0x554a('0xa3')]['content-length'];}}if(_0x1cf6fd[_0x554a('0xa3')]['content-type']){delete _0x1cf6fd['headers']['content-type'];}return rp(_0x1cf6fd);})['then'](function(_0x4f52ef){if(_0x4f52ef){_0x1d510d[_0x554a('0x23')](_0x4f52ef['headers']);logger[_0x554a('0x6f')](_0x4f52ef[_0x554a('0x91')]);if(_['endsWith'](_0xde35a5[_0x554a('0x39')][_0x554a('0x54')],_0x554a('0x52'))&&_0x4f52ef['statusCode']==0x1f4){return _0x1d510d['sendStatus'](_0x4f52ef[_0x554a('0xa5')]);}else{return _0x1d510d[_0x554a('0x1d')](_0x4f52ef['statusCode'])[_0x554a('0x32')](_0x4f52ef['body']);}}else{return _0x1d510d[_0x554a('0x1c')](0xc8);}})[_0x554a('0x4f')](handleError(_0x1d510d,null));};exports[_0x554a('0xa6')]=function(_0x3dd748,_0x260aab,_0x3baa17){return BPromise['resolve']()[_0x554a('0x2b')](function(){if(!_0x3dd748['query'][_0x554a('0x54')]){throw new Error(_0x554a('0x9d'));}if(!_0x3dd748[_0x554a('0x39')][_0x554a('0x9e')]){throw new Error(_0x554a('0x9f'));}var _0xef8442=_0x3dd748[_0x554a('0x39')][_0x554a('0xa0')]?_0x3dd748[_0x554a('0x39')][_0x554a('0xa0')]+':'+_0x3dd748['query']['port']:'http://localhost:'+_0x3dd748['query']['port'];var _0x5eff0c=_0x3dd748[_0x554a('0x39')][_0x554a('0x25')]?_0x3dd748[_0x554a('0x39')]['json']:!![];var _0x52fac9=_0x3dd748['query']['encoding']?_0x3dd748[_0x554a('0x39')][_0x554a('0xa1')]:null;var _0x53ed93={'method':_0x3dd748[_0x554a('0xa2')],'uri':util[_0x554a('0x67')](_0x554a('0xa7'),_0xef8442,_0x3dd748[_0x554a('0x39')][_0x554a('0x54')]),'json':_0x5eff0c,'resolveWithFullResponse':!![],'encoding':_0x52fac9,'body':_0x3dd748[_0x554a('0x91')]};if(_0x3dd748[_0x554a('0xa3')]){_0x53ed93[_0x554a('0xa3')]=_0x3dd748[_0x554a('0xa3')];if(_0x53ed93['headers'][_0x554a('0xa4')]){delete _0x53ed93[_0x554a('0xa3')][_0x554a('0xa4')];}}if(_0x53ed93[_0x554a('0xa3')][_0x554a('0xa8')]){delete _0x53ed93[_0x554a('0xa3')][_0x554a('0xa8')];}return rp(_0x53ed93);})[_0x554a('0x2b')](function(_0x363152){if(_0x363152){_0x260aab['set'](_0x363152[_0x554a('0xa3')]);logger['info'](_0x363152[_0x554a('0x91')]);return _0x260aab[_0x554a('0x1d')](_0x363152[_0x554a('0xa5')])[_0x554a('0x32')](_0x363152[_0x554a('0x91')]);}else{return _0x260aab[_0x554a('0x1c')](0xc8);}})[_0x554a('0x4f')](handleError(_0x260aab,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 22f74aa..6336962 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 _0x9134=['hook','exports','../../mysqldb','Plugin','setMaxListeners','save','emit'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9134,0x87));var _0x4913=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9134[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x4913('0x0'))['db'][_0x4913('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x4913('0x2')](0x0);var events={'afterCreate':_0x4913('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x352f58){return function(_0x488795,_0x367836,_0x349c8c){PluginEvents[_0x4913('0x4')](_0x352f58+':'+_0x488795['id'],_0x488795);PluginEvents[_0x4913('0x4')](_0x352f58,_0x488795);_0x349c8c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x4913('0x5')](e,emitEvent(event));}}module[_0x4913('0x6')]=PluginEvents; \ No newline at end of file +var _0x3e24=['../../mysqldb','Plugin','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x23d74b,_0x1f0d6f){var _0x4a1767=function(_0x1dddbc){while(--_0x1dddbc){_0x23d74b['push'](_0x23d74b['shift']());}};_0x4a1767(++_0x1f0d6f);}(_0x3e24,0x167));var _0x43e2=function(_0x10fa22,_0x1b4769){_0x10fa22=_0x10fa22-0x0;var _0x585fc5=_0x3e24[_0x10fa22];return _0x585fc5;};'use strict';var EventEmitter=require(_0x43e2('0x0'));var Plugin=require(_0x43e2('0x1'))['db'][_0x43e2('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x43e2('0x3')](0x0);var events={'afterCreate':_0x43e2('0x4'),'afterUpdate':'update','afterDestroy':_0x43e2('0x5')};function emitEvent(_0x1ff04b){return function(_0x5d2806,_0x1dd127,_0x18629c){PluginEvents[_0x43e2('0x6')](_0x1ff04b+':'+_0x5d2806['id'],_0x5d2806);PluginEvents[_0x43e2('0x6')](_0x1ff04b,_0x5d2806);_0x18629c(null);};}for(var e in events){if(events[_0x43e2('0x7')](e)){var event=events[e];Plugin[_0x43e2('0x8')](e,emitEvent(event));}}module[_0x43e2('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index c2bb78d..84f89c3 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 _0x3fe9=['moment','bluebird','request-promise','path','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util'];(function(_0x40a384,_0x519734){var _0x59d873=function(_0x61a9f8){while(--_0x61a9f8){_0x40a384['push'](_0x40a384['shift']());}};_0x59d873(++_0x519734);}(_0x3fe9,0x106));var _0x93fe=function(_0x2e31f9,_0x263a44){_0x2e31f9=_0x2e31f9-0x0;var _0x8045f1=_0x3fe9[_0x2e31f9];return _0x8045f1;};'use strict';var _=require(_0x93fe('0x0'));var util=require(_0x93fe('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x93fe('0x2'));var BPromise=require(_0x93fe('0x3'));var rp=require(_0x93fe('0x4'));var fs=require('fs');var path=require(_0x93fe('0x5'));var rimraf=require('rimraf');var config=require(_0x93fe('0x6'));var attributes=require(_0x93fe('0x7'));module[_0x93fe('0x8')]=function(_0x3a1584,_0x5ad293){return _0x3a1584[_0x93fe('0x9')](_0x93fe('0xa'),attributes,{'tableName':_0x93fe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18c8=['lodash','util','moment','bluebird','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x18c8,0x160));var _0x818c=function(_0x35394b,_0x514776){_0x35394b=_0x35394b-0x0;var _0x56e3e6=_0x18c8[_0x35394b];return _0x56e3e6;};'use strict';var _=require(_0x818c('0x0'));var util=require(_0x818c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x818c('0x2'));var BPromise=require(_0x818c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x818c('0x4'));var rimraf=require(_0x818c('0x5'));var config=require(_0x818c('0x6'));var attributes=require(_0x818c('0x7'));module[_0x818c('0x8')]=function(_0x4eb5dc,_0x1085de){return _0x4eb5dc[_0x818c('0x9')](_0x818c('0xa'),attributes,{'tableName':'plugins','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 620380b..daf2346 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 _0xb92a=['defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','Plugin,\x20%s,\x20%s','Plugin','create','body','options','CreatePlugin','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis'];(function(_0x35326f,_0xa0e156){var _0x11326c=function(_0x11dc0b){while(--_0x11dc0b){_0x35326f['push'](_0x35326f['shift']());}};_0x11326c(++_0xa0e156);}(_0xb92a,0x1b7));var _0xab92=function(_0x237cba,_0x4acd0a){_0x237cba=_0x237cba-0x0;var _0x49ac44=_0xb92a[_0x237cba];return _0x49ac44;};'use strict';var _=require(_0xab92('0x0'));var util=require(_0xab92('0x1'));var moment=require(_0xab92('0x2'));var BPromise=require(_0xab92('0x3'));var rs=require(_0xab92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab92('0x5'))['db'];var utils=require(_0xab92('0x6'));var logger=require('../../config/logger')(_0xab92('0x7'));var config=require('../../config/environment');var jayson=require(_0xab92('0x8'));var client=jayson[_0xab92('0x9')]['http']({'port':0x232a});config[_0xab92('0xa')]=_[_0xab92('0xb')](config[_0xab92('0xa')],{'host':_0xab92('0xc'),'port':0x18eb});var socket=require(_0xab92('0xd'))(new Redis(config[_0xab92('0xa')]));require('./plugin.socket')[_0xab92('0xe')](socket);function respondWithRpcPromise(_0x2cb37e,_0x37e035,_0x2b36f0){return new BPromise(function(_0x4853ce,_0x34cde7){return client['request'](_0x2cb37e,_0x2b36f0)[_0xab92('0xf')](function(_0x4d6bb1){logger[_0xab92('0x10')]('Plugin,\x20%s,\x20%s',_0x37e035,_0xab92('0x11'));logger[_0xab92('0x12')](_0xab92('0x13'),_0x37e035,_0xab92('0x11'),JSON[_0xab92('0x14')](_0x4d6bb1));if(_0x4d6bb1[_0xab92('0x15')]){if(_0x4d6bb1[_0xab92('0x15')]['code']===0x1f4){logger[_0xab92('0x15')]('Plugin,\x20%s,\x20%s',_0x37e035,_0x4d6bb1[_0xab92('0x15')][_0xab92('0x16')]);return _0x34cde7(_0x4d6bb1[_0xab92('0x15')][_0xab92('0x16')]);}logger[_0xab92('0x15')](_0xab92('0x17'),_0x37e035,_0x4d6bb1[_0xab92('0x15')]['message']);return _0x4853ce(_0x4d6bb1[_0xab92('0x15')][_0xab92('0x16')]);}else{logger['info'](_0xab92('0x17'),_0x37e035,_0xab92('0x11'));_0x4853ce(_0x4d6bb1['result'][_0xab92('0x16')]);}})['catch'](function(_0xdeffec){logger[_0xab92('0x15')]('Plugin,\x20%s,\x20%s',_0x37e035,_0xdeffec);_0x34cde7(_0xdeffec);});});}exports['CreatePlugin']=function(_0x4098ef){var _0x431a97=this;return new Promise(function(_0x17823c,_0x1f6b0a){return db[_0xab92('0x18')][_0xab92('0x19')](_0x4098ef[_0xab92('0x1a')],{'raw':_0x4098ef[_0xab92('0x1b')]?_0x4098ef[_0xab92('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xab92('0xf')](function(_0x11766f){logger['info'](_0xab92('0x1c'),_0x4098ef);logger[_0xab92('0x12')]('CreatePlugin',_0x4098ef,JSON[_0xab92('0x14')](_0x11766f));_0x17823c(_0x11766f);})[_0xab92('0x1d')](function(_0xb143be){logger[_0xab92('0x15')](_0xab92('0x1c'),_0xb143be[_0xab92('0x16')],_0x4098ef);_0x1f6b0a(_0x431a97[_0xab92('0x15')](0x1f4,_0xb143be['message']));});});}; \ No newline at end of file +var _0x3cec=['./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0xba7986,_0xfa5a34){var _0x2844f6=function(_0x10d7ea){while(--_0x10d7ea){_0xba7986['push'](_0xba7986['shift']());}};_0x2844f6(++_0xfa5a34);}(_0x3cec,0x1ab));var _0xc3ce=function(_0x599972,_0x48987f){_0x599972=_0x599972-0x0;var _0x5e5ade=_0x3cec[_0x599972];return _0x5e5ade;};'use strict';var _=require(_0xc3ce('0x0'));var util=require('util');var moment=require(_0xc3ce('0x1'));var BPromise=require(_0xc3ce('0x2'));var rs=require(_0xc3ce('0x3'));var fs=require('fs');var Redis=require(_0xc3ce('0x4'));var db=require(_0xc3ce('0x5'))['db'];var utils=require(_0xc3ce('0x6'));var logger=require(_0xc3ce('0x7'))(_0xc3ce('0x8'));var config=require('../../config/environment');var jayson=require(_0xc3ce('0x9'));var client=jayson['client'][_0xc3ce('0xa')]({'port':0x232a});config[_0xc3ce('0xb')]=_[_0xc3ce('0xc')](config[_0xc3ce('0xb')],{'host':_0xc3ce('0xd'),'port':0x18eb});var socket=require(_0xc3ce('0xe'))(new Redis(config['redis']));require(_0xc3ce('0xf'))[_0xc3ce('0x10')](socket);function respondWithRpcPromise(_0x50566f,_0x173afe,_0x3493b9){return new BPromise(function(_0x315ef9,_0xcc894f){return client[_0xc3ce('0x11')](_0x50566f,_0x3493b9)['then'](function(_0x2fdab5){logger[_0xc3ce('0x12')](_0xc3ce('0x13'),_0x173afe,_0xc3ce('0x14'));logger[_0xc3ce('0x15')](_0xc3ce('0x16'),_0x173afe,_0xc3ce('0x14'),JSON['stringify'](_0x2fdab5));if(_0x2fdab5[_0xc3ce('0x17')]){if(_0x2fdab5['error'][_0xc3ce('0x18')]===0x1f4){logger[_0xc3ce('0x17')]('Plugin,\x20%s,\x20%s',_0x173afe,_0x2fdab5[_0xc3ce('0x17')][_0xc3ce('0x19')]);return _0xcc894f(_0x2fdab5[_0xc3ce('0x17')][_0xc3ce('0x19')]);}logger['error'](_0xc3ce('0x13'),_0x173afe,_0x2fdab5[_0xc3ce('0x17')]['message']);return _0x315ef9(_0x2fdab5['error'][_0xc3ce('0x19')]);}else{logger[_0xc3ce('0x12')](_0xc3ce('0x13'),_0x173afe,_0xc3ce('0x14'));_0x315ef9(_0x2fdab5[_0xc3ce('0x1a')][_0xc3ce('0x19')]);}})[_0xc3ce('0x1b')](function(_0x359216){logger[_0xc3ce('0x17')](_0xc3ce('0x13'),_0x173afe,_0x359216);_0xcc894f(_0x359216);});});}exports[_0xc3ce('0x1c')]=function(_0x3aefe2){var _0x243bb4=this;return new Promise(function(_0x32bb89,_0x5b9132){return db[_0xc3ce('0x1d')][_0xc3ce('0x1e')](_0x3aefe2[_0xc3ce('0x1f')],{'raw':_0x3aefe2[_0xc3ce('0x20')]?_0x3aefe2[_0xc3ce('0x20')]['raw']===undefined?!![]:![]:!![]})[_0xc3ce('0x21')](function(_0x1e7ca9){logger[_0xc3ce('0x12')]('CreatePlugin',_0x3aefe2);logger[_0xc3ce('0x15')]('CreatePlugin',_0x3aefe2,JSON['stringify'](_0x1e7ca9));_0x32bb89(_0x1e7ca9);})[_0xc3ce('0x1b')](function(_0x1f03a9){logger[_0xc3ce('0x17')](_0xc3ce('0x1c'),_0x1f03a9['message'],_0x3aefe2);_0x5b9132(_0x243bb4['error'](0x1f4,_0x1f03a9[_0xc3ce('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 28c4c49..815eb66 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 _0xbd47=['removeListener','register','length','remove','update'];(function(_0x5007c0,_0x590157){var _0x3e55ec=function(_0x44da55){while(--_0x44da55){_0x5007c0['push'](_0x5007c0['shift']());}};_0x3e55ec(++_0x590157);}(_0xbd47,0xb7));var _0x7bd4=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xbd47[_0x2d34d6];return _0x1d3d12;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0x7bd4('0x0'),_0x7bd4('0x1')];function createListener(_0x55f3ba,_0x41c2cf){return function(_0x57f668){_0x41c2cf['emit'](_0x55f3ba,_0x57f668);};}function removeListener(_0x286089,_0x5782d9){return function(){PluginEvents[_0x7bd4('0x2')](_0x286089,_0x5782d9);};}exports[_0x7bd4('0x3')]=function(_0x4aca02){for(var _0x49992a=0x0,_0x4fd030=events[_0x7bd4('0x4')];_0x49992a<_0x4fd030;_0x49992a++){var _0xb4d89b=events[_0x49992a];var _0x20ccc3=createListener('plugin:'+_0xb4d89b,_0x4aca02);PluginEvents['on'](_0xb4d89b,_0x20ccc3);}}; \ No newline at end of file +var _0xb1c4=['emit','removeListener','length','./plugin.events','save','remove'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0xb1c4,0x12f));var _0x4b1c=function(_0x461d65,_0x1bdfb8){_0x461d65=_0x461d65-0x0;var _0x115521=_0xb1c4[_0x461d65];return _0x115521;};'use strict';var PluginEvents=require(_0x4b1c('0x0'));var events=[_0x4b1c('0x1'),_0x4b1c('0x2'),'update'];function createListener(_0x26ebb1,_0x29da5c){return function(_0x4c443f){_0x29da5c[_0x4b1c('0x3')](_0x26ebb1,_0x4c443f);};}function removeListener(_0x4799c4,_0x328a8e){return function(){PluginEvents[_0x4b1c('0x4')](_0x4799c4,_0x328a8e);};}exports['register']=function(_0x3d728c){for(var _0xa67525=0x0,_0x280204=events[_0x4b1c('0x5')];_0xa67525<_0x280204;_0xa67525++){var _0x5c3998=events[_0xa67525];var _0x1695ea=createListener('plugin:'+_0x5c3998,_0x3d728c);PluginEvents['on'](_0x5c3998,_0x1695ea);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 74a9bab..fb00d23 100644 --- a/server/api/pm2/index.js +++ b/server/api/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x42836c,_0x48738a){var _0x1cda06=function(_0xa13729){while(--_0xa13729){_0x42836c['push'](_0x42836c['shift']());}};_0x1cda06(++_0x48738a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x2bd9fd,_0x2114e5){var _0x5bf24b=function(_0x35237d){while(--_0x35237d){_0x2bd9fd['push'](_0x2bd9fd['shift']());}};_0x5bf24b(++_0x2114e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 7e2acec..12a2c59 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 _0xd404=['stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','api','path','exec','bluebird','sendStatus','json','name','status','send','npm\x20install','info','error','index','list','then','express','motion2','length','catch','show','describe','params','body','join','script','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart'];(function(_0x1baedc,_0x200d6e){var _0x446281=function(_0x551e15){while(--_0x551e15){_0x1baedc['push'](_0x1baedc['shift']());}};_0x446281(++_0x200d6e);}(_0xd404,0x15b));var _0x4d40=function(_0x36f1be,_0x44e4f8){_0x36f1be=_0x36f1be-0x0;var _0x46008a=_0xd404[_0x36f1be];return _0x46008a;};'use strict';var _=require(_0x4d40('0x0'));var pm2=require(_0x4d40('0x1'));var logger=require('../../config/logger')(_0x4d40('0x2'));var path=require(_0x4d40('0x3'));var exec=require('child_process')[_0x4d40('0x4')];var BPromise=require(_0x4d40('0x5'));function handleEntityNotFound(_0xba821,_0x8bde12){return function(_0xbfb4c6){if(!_0xbfb4c6){_0xba821[_0x4d40('0x6')](0x194);;}return _0xbfb4c6;};}function respondWithResult(_0xc2a9db,_0x24a237){_0x24a237=_0x24a237||0xc8;return function(_0x2e4bd8){if(_0x2e4bd8){return _0xc2a9db['status'](_0x24a237)[_0x4d40('0x7')](_0x2e4bd8);}return null;};}function handleError(_0x116941,_0x5a23a2){_0x5a23a2=_0x5a23a2||0x1f4;return function(_0x3bf81a){logger['error'](_0x3bf81a['stack']);if(_0x3bf81a[_0x4d40('0x8')]){delete _0x3bf81a[_0x4d40('0x8')];}_0x116941[_0x4d40('0x9')](_0x5a23a2)[_0x4d40('0xa')](_0x3bf81a);};}function execChildProcess(){return new BPromise(function(_0x1d00cf,_0x357abf){exec(_0x4d40('0xb'),function(_0x2eab7a,_0x1e18bc,_0x3f5c29){logger[_0x4d40('0xc')](_0x1e18bc);logger[_0x4d40('0xc')](_0x3f5c29);if(_0x2eab7a){logger[_0x4d40('0xd')](_0x2eab7a);return _0x357abf(_0x2eab7a);}return _0x1d00cf(_0x1e18bc);});});}exports[_0x4d40('0xe')]=function(_0x5162f9,_0xa644d2){return pm2[_0x4d40('0xf')]()[_0x4d40('0x10')](function(_0x2083bd){if(_0x2083bd){var _0x477a91=_['reject'](_0x2083bd,function(_0x23de7b){return _0x23de7b[_0x4d40('0x8')]===_0x4d40('0x11')||_0x23de7b[_0x4d40('0x8')]===_0x4d40('0x12');});return{'rows':_0x477a91,'count':_0x477a91[_0x4d40('0x13')]};}return null;})[_0x4d40('0x10')](respondWithResult(_0xa644d2,null))[_0x4d40('0x14')](handleError(_0xa644d2,null));};exports[_0x4d40('0x15')]=function(_0x4b5d23,_0x535989){return pm2[_0x4d40('0x16')](_0x4b5d23[_0x4d40('0x17')]['id'])['then'](respondWithResult(_0x535989,null))[_0x4d40('0x10')](handleEntityNotFound(_0x535989,null))[_0x4d40('0x14')](handleError(_0x535989,null));};exports['create']=function(_0x36d031,_0x5a77e0){if(_0x36d031[_0x4d40('0x18')][_0x4d40('0x8')]&&_0x36d031['body']['script']){var _0x375ce0=path[_0x4d40('0x19')](__dirname,'../../files/plugins',_0x36d031[_0x4d40('0x18')][_0x4d40('0x1a')]);var _0x30f058=process['cwd']();process[_0x4d40('0x1b')](path[_0x4d40('0x1c')](_0x375ce0));return execChildProcess()[_0x4d40('0x10')](function(_0x5ca0a0){process['chdir'](_0x30f058);return pm2[_0x4d40('0x1d')]({'name':_0x36d031[_0x4d40('0x18')][_0x4d40('0x8')],'script':_0x375ce0});})[_0x4d40('0x10')](function(_0x4677c9){pm2['dump']();return _0x4677c9[0x0];})[_0x4d40('0x10')](respondWithResult(_0x5a77e0,0xc9))[_0x4d40('0x14')](handleError(_0x5a77e0,null));}else{return _0x5a77e0['status'](0x1f4)['send']({'message':_0x4d40('0x1e')});}};exports[_0x4d40('0x1f')]=function(_0x3fa83e,_0x3ad1d7){if(_0x3fa83e[_0x4d40('0x18')]['id']){delete _0x3fa83e[_0x4d40('0x18')]['id'];}var _0x105635={'online':_0x4d40('0x20'),'stopped':_0x4d40('0x21')};if(_0x105635[_0x4d40('0x22')](_0x3fa83e[_0x4d40('0x18')]['status'])){return pm2[_0x105635[_0x3fa83e['body']['status']]](_0x3fa83e[_0x4d40('0x17')]['id'])[_0x4d40('0x10')](respondWithResult(_0x3ad1d7,0xc8))[_0x4d40('0x14')](handleError(_0x3ad1d7,null));}else{return _0x3ad1d7[_0x4d40('0x9')](0x1f4)['send']({'message':_0x4d40('0x23')});}};exports[_0x4d40('0x24')]=function(_0x429da9,_0x5a6aff){if(_0x429da9[_0x4d40('0x18')]['id']){delete _0x429da9[_0x4d40('0x18')]['id'];}if(_0x429da9[_0x4d40('0x17')]['id']){return pm2[_0x4d40('0x25')](_0x429da9[_0x4d40('0x17')]['id'])['then'](function(_0x2f4b22){pm2['dump']();return _0x2f4b22[0x0];})[_0x4d40('0x10')](respondWithResult(_0x5a6aff,null))[_0x4d40('0x14')](handleError(_0x5a6aff,null));}else{return _0x5a6aff[_0x4d40('0x9')](0x1f4)[_0x4d40('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xa902=['then','catch','show','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','status','update','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','exec','sendStatus','json','error','stack','name','send','npm\x20install','info','list','reject','express','motion2','length'];(function(_0x3f984b,_0x1f46df){var _0x43a3bb=function(_0x452542){while(--_0x452542){_0x3f984b['push'](_0x3f984b['shift']());}};_0x43a3bb(++_0x1f46df);}(_0xa902,0x8d));var _0x2a90=function(_0x17044c,_0x208790){_0x17044c=_0x17044c-0x0;var _0x5e6db0=_0xa902[_0x17044c];return _0x5e6db0;};'use strict';var _=require(_0x2a90('0x0'));var pm2=require(_0x2a90('0x1'));var logger=require(_0x2a90('0x2'))(_0x2a90('0x3'));var path=require(_0x2a90('0x4'));var exec=require('child_process')[_0x2a90('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x4961c2,_0x169808){return function(_0x2b40c0){if(!_0x2b40c0){_0x4961c2[_0x2a90('0x6')](0x194);;}return _0x2b40c0;};}function respondWithResult(_0x21e1d2,_0x4a32c7){_0x4a32c7=_0x4a32c7||0xc8;return function(_0x25bcfc){if(_0x25bcfc){return _0x21e1d2['status'](_0x4a32c7)[_0x2a90('0x7')](_0x25bcfc);}return null;};}function handleError(_0x570659,_0x5ec2b9){_0x5ec2b9=_0x5ec2b9||0x1f4;return function(_0xc75b6e){logger[_0x2a90('0x8')](_0xc75b6e[_0x2a90('0x9')]);if(_0xc75b6e[_0x2a90('0xa')]){delete _0xc75b6e[_0x2a90('0xa')];}_0x570659['status'](_0x5ec2b9)[_0x2a90('0xb')](_0xc75b6e);};}function execChildProcess(){return new BPromise(function(_0x3dadc2,_0x43c56d){exec(_0x2a90('0xc'),function(_0x541e22,_0x40e6aa,_0x52391c){logger[_0x2a90('0xd')](_0x40e6aa);logger['info'](_0x52391c);if(_0x541e22){logger[_0x2a90('0x8')](_0x541e22);return _0x43c56d(_0x541e22);}return _0x3dadc2(_0x40e6aa);});});}exports['index']=function(_0x407ce5,_0x30e166){return pm2[_0x2a90('0xe')]()['then'](function(_0x56d1b8){if(_0x56d1b8){var _0x57227c=_[_0x2a90('0xf')](_0x56d1b8,function(_0x3a42df){return _0x3a42df['name']===_0x2a90('0x10')||_0x3a42df[_0x2a90('0xa')]===_0x2a90('0x11');});return{'rows':_0x57227c,'count':_0x57227c[_0x2a90('0x12')]};}return null;})[_0x2a90('0x13')](respondWithResult(_0x30e166,null))[_0x2a90('0x14')](handleError(_0x30e166,null));};exports[_0x2a90('0x15')]=function(_0x10cf94,_0x43eea5){return pm2['describe'](_0x10cf94[_0x2a90('0x16')]['id'])[_0x2a90('0x13')](respondWithResult(_0x43eea5,null))[_0x2a90('0x13')](handleEntityNotFound(_0x43eea5,null))['catch'](handleError(_0x43eea5,null));};exports[_0x2a90('0x17')]=function(_0x1f51a6,_0x148d18){if(_0x1f51a6[_0x2a90('0x18')][_0x2a90('0xa')]&&_0x1f51a6[_0x2a90('0x18')][_0x2a90('0x19')]){var _0x114d42=path[_0x2a90('0x1a')](__dirname,_0x2a90('0x1b'),_0x1f51a6[_0x2a90('0x18')][_0x2a90('0x19')]);var _0x4fdd62=process[_0x2a90('0x1c')]();process[_0x2a90('0x1d')](path[_0x2a90('0x1e')](_0x114d42));return execChildProcess()[_0x2a90('0x13')](function(_0x5912fd){process[_0x2a90('0x1d')](_0x4fdd62);return pm2[_0x2a90('0x1f')]({'name':_0x1f51a6['body'][_0x2a90('0xa')],'script':_0x114d42});})[_0x2a90('0x13')](function(_0x10a6dd){pm2[_0x2a90('0x20')]();return _0x10a6dd[0x0];})[_0x2a90('0x13')](respondWithResult(_0x148d18,0xc9))[_0x2a90('0x14')](handleError(_0x148d18,null));}else{return _0x148d18[_0x2a90('0x21')](0x1f4)[_0x2a90('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x2a90('0x22')]=function(_0x17f978,_0x3934d4){if(_0x17f978[_0x2a90('0x18')]['id']){delete _0x17f978[_0x2a90('0x18')]['id'];}var _0x5208d8={'online':'restart','stopped':_0x2a90('0x23')};if(_0x5208d8['hasOwnProperty'](_0x17f978['body']['status'])){return pm2[_0x5208d8[_0x17f978[_0x2a90('0x18')][_0x2a90('0x21')]]](_0x17f978['params']['id'])['then'](respondWithResult(_0x3934d4,0xc8))[_0x2a90('0x14')](handleError(_0x3934d4,null));}else{return _0x3934d4['status'](0x1f4)[_0x2a90('0xb')]({'message':_0x2a90('0x24')});}};exports[_0x2a90('0x25')]=function(_0x27b6b6,_0xf18d11){if(_0x27b6b6[_0x2a90('0x18')]['id']){delete _0x27b6b6[_0x2a90('0x18')]['id'];}if(_0x27b6b6['params']['id']){return pm2[_0x2a90('0x26')](_0x27b6b6[_0x2a90('0x16')]['id'])[_0x2a90('0x13')](function(_0x5cdeb4){pm2[_0x2a90('0x20')]();return _0x5cdeb4[0x0];})[_0x2a90('0x13')](respondWithResult(_0xf18d11,null))[_0x2a90('0x14')](handleError(_0xf18d11,null));}else{return _0xf18d11[_0x2a90('0x21')](0x1f4)['send']({'message':_0x2a90('0x27')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index b353fcd..90b5a8d 100644 --- a/server/api/realtime/index.js +++ b/server/api/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e57=['fs-extra','../../components/auth/service','../../components/interaction/service','./realtime.controller','get','/queues','isAuthenticated','getQueues','exports','multer','util','connect-timeout'];(function(_0x4780e5,_0x3d80f2){var _0x5d3c2c=function(_0x4deba7){while(--_0x4deba7){_0x4780e5['push'](_0x4780e5['shift']());}};_0x5d3c2c(++_0x3d80f2);}(_0x3e57,0x1d1));var _0x73e5=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0x3e57[_0x4d674b];return _0x535a1f;};'use strict';var multer=require(_0x73e5('0x0'));var util=require(_0x73e5('0x1'));var path=require('path');var timeout=require(_0x73e5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x73e5('0x3'));var auth=require(_0x73e5('0x4'));var interaction=require(_0x73e5('0x5'));var config=require('../../config/environment');var controller=require(_0x73e5('0x6'));router[_0x73e5('0x7')](_0x73e5('0x8'),auth[_0x73e5('0x9')](),controller[_0x73e5('0xa')]);module[_0x73e5('0xb')]=router; \ No newline at end of file +var _0xf1a7=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./realtime.controller','get','/queues','isAuthenticated','exports'];(function(_0x22b2d4,_0xe806b1){var _0x1bbd39=function(_0xbbc6e7){while(--_0xbbc6e7){_0x22b2d4['push'](_0x22b2d4['shift']());}};_0x1bbd39(++_0xe806b1);}(_0xf1a7,0x8f));var _0x7f1a=function(_0x16c86a,_0x298546){_0x16c86a=_0x16c86a-0x0;var _0x191334=_0xf1a7[_0x16c86a];return _0x191334;};'use strict';var multer=require('multer');var util=require(_0x7f1a('0x0'));var path=require('path');var timeout=require(_0x7f1a('0x1'));var express=require(_0x7f1a('0x2'));var router=express[_0x7f1a('0x3')]();var fs_extra=require(_0x7f1a('0x4'));var auth=require(_0x7f1a('0x5'));var interaction=require(_0x7f1a('0x6'));var config=require(_0x7f1a('0x7'));var controller=require(_0x7f1a('0x8'));router[_0x7f1a('0x9')](_0x7f1a('0xa'),auth[_0x7f1a('0xb')](),controller['getQueues']);module[_0x7f1a('0xc')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 474e877..0fbfe96 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5935=['dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','get','pTalking','agents','find','rows','pick','online','UserId','loggedInDb','User','QueueId','Pause','findAll','agent','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','Realtime,\x20%s,\x20%s','request\x20sent','debug','Realtime,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','status','end','json','undefined','limit','offset','set','apply','reject','update','destroy','stack','name','send','getQueues','mail','openchannel','fax','whatsapp','resolve','query','channel','includes','toLowerCase','Invalid\x20channel','Queue','map','rawAttributes','fieldName','type','getOptions','user','userProfileId','voice','outbound','Queues','UserProfile','getResources','findAndCountAll','count','startCase','format','result','loggedIn','available','waiting','talking','paused','push','originated'];(function(_0x10cbb8,_0x1b0b56){var _0x454de9=function(_0x3987aa){while(--_0x3987aa){_0x10cbb8['push'](_0x10cbb8['shift']());}};_0x454de9(++_0x1b0b56);}(_0x5935,0x10f));var _0x5593=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x5935[_0x2ed8f3];return _0x525a55;};'use strict';var emlformat=require(_0x5593('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5593('0x1'));var jsonpatch=require(_0x5593('0x2'));var rp=require(_0x5593('0x3'));var moment=require(_0x5593('0x4'));var BPromise=require(_0x5593('0x5'));var Mustache=require(_0x5593('0x6'));var util=require('util');var path=require(_0x5593('0x7'));var sox=require(_0x5593('0x8'));var csv=require(_0x5593('0x9'));var ejs=require(_0x5593('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5593('0xb'));var squel=require(_0x5593('0xc'));var crypto=require(_0x5593('0xd'));var jsforce=require(_0x5593('0xe'));var deskjs=require(_0x5593('0xf'));var toCsv=require(_0x5593('0x9'));var querystring=require(_0x5593('0x10'));var Papa=require(_0x5593('0x11'));var Redis=require(_0x5593('0x12'));var authService=require(_0x5593('0x13'));var qs=require(_0x5593('0x14'));var as=require(_0x5593('0x15'));var hardwareService=require(_0x5593('0x16'));var logger=require(_0x5593('0x17'))('api');var utils=require(_0x5593('0x18'));var config=require(_0x5593('0x19'));var licenseUtil=require(_0x5593('0x1a'));var db=require(_0x5593('0x1b'))['db'];var jayson=require(_0x5593('0x1c'));var client=jayson[_0x5593('0x1d')][_0x5593('0x1e')]({'port':0x232a});var routingClient=jayson['client'][_0x5593('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x140a71,_0x390ae9,_0xa351f,_0x1a8af1){return new BPromise(function(_0x1b1d4a,_0x5ec1c0){var _0x2e7731=_0x1a8af1||client;return _0x2e7731['request'](_0x140a71,_0xa351f)[_0x5593('0x1f')](function(_0x3446f2){logger['info'](_0x5593('0x20'),_0x390ae9,_0x5593('0x21'));logger[_0x5593('0x22')](_0x5593('0x23'),_0x390ae9,_0x5593('0x21'),JSON[_0x5593('0x24')](_0x3446f2));if(_0x3446f2['error']){if(_0x3446f2[_0x5593('0x25')]['code']===0x1f4){logger[_0x5593('0x25')]('Realtime,\x20%s,\x20%s',_0x390ae9,_0x3446f2[_0x5593('0x25')][_0x5593('0x26')]);return _0x5ec1c0(_0x3446f2['error'][_0x5593('0x26')]);}logger[_0x5593('0x25')](_0x5593('0x20'),_0x390ae9,_0x3446f2['error'][_0x5593('0x26')]);return _0x1b1d4a(_0x3446f2['error'][_0x5593('0x26')]);}else{logger[_0x5593('0x27')]('Realtime,\x20%s,\x20%s',_0x390ae9,'request\x20sent');_0x1b1d4a(_0x3446f2['result'][_0x5593('0x26')]);}})[_0x5593('0x28')](function(_0xcf24bf){logger['error']('Realtime,\x20%s,\x20%s',_0x390ae9,_0xcf24bf);_0x5ec1c0(_0xcf24bf);});});}function respondWithStatusCode(_0x4213cf,_0x4a357e){_0x4a357e=_0x4a357e||0xcc;return function(_0x502655){if(_0x502655){return _0x4213cf[_0x5593('0x29')](_0x4a357e);}return _0x4213cf[_0x5593('0x2a')](_0x4a357e)[_0x5593('0x2b')]();};}function respondWithResult(_0x14d983,_0x5220f3){_0x5220f3=_0x5220f3||0xc8;return function(_0x36edae){if(_0x36edae){return _0x14d983[_0x5593('0x2a')](_0x5220f3)[_0x5593('0x2c')](_0x36edae);}};}function respondWithFilteredResult(_0x58b5dc,_0x4b4daa){return function(_0x454112){if(_0x454112){var _0x12b066=typeof _0x4b4daa['offset']===_0x5593('0x2d')&&typeof _0x4b4daa[_0x5593('0x2e')]==='undefined';var _0x40e74f=_0x454112['count'];var _0x11a7e4=_0x12b066?0x0:_0x4b4daa['offset'];var _0x37b5f8=_0x12b066?_0x454112['count']:_0x4b4daa[_0x5593('0x2f')]+_0x4b4daa['limit'];var _0x1062a1;if(_0x37b5f8>=_0x40e74f){_0x37b5f8=_0x40e74f;_0x1062a1=0xc8;}else{_0x1062a1=0xce;}_0x58b5dc[_0x5593('0x2a')](_0x1062a1);return _0x58b5dc[_0x5593('0x30')]('Content-Range',_0x11a7e4+'-'+_0x37b5f8+'/'+_0x40e74f)[_0x5593('0x2c')](_0x454112);}return null;};}function patchUpdates(_0x5e5ef3){return function(_0x42be2e){try{jsonpatch[_0x5593('0x31')](_0x42be2e,_0x5e5ef3,!![]);}catch(_0x1323a6){return BPromise[_0x5593('0x32')](_0x1323a6);}return _0x42be2e['save']();};}function saveUpdates(_0x13a854,_0xe7e1a9){return function(_0x1d0914){if(_0x1d0914){return _0x1d0914[_0x5593('0x33')](_0x13a854)[_0x5593('0x1f')](function(_0x52e922){return _0x52e922;});}return null;};}function removeEntity(_0x3fb4e4,_0x469da6){return function(_0x263b92){if(_0x263b92){return _0x263b92[_0x5593('0x34')]()[_0x5593('0x1f')](function(){_0x3fb4e4[_0x5593('0x2a')](0xcc)[_0x5593('0x2b')]();});}};}function handleEntityNotFound(_0x5b7506,_0x210d2a){return function(_0x535ec0){if(!_0x535ec0){_0x5b7506[_0x5593('0x29')](0x194);}return _0x535ec0;};}function handleError(_0x92df9e,_0x57360c){_0x57360c=_0x57360c||0x1f4;return function(_0x4c3eaf){logger[_0x5593('0x25')](_0x4c3eaf[_0x5593('0x35')]);if(_0x4c3eaf[_0x5593('0x36')]){delete _0x4c3eaf[_0x5593('0x36')];}_0x92df9e[_0x5593('0x2a')](_0x57360c)[_0x5593('0x37')](_0x4c3eaf);};}exports[_0x5593('0x38')]=function(_0x2047f7,_0x3e3a8f){var _0x4064d4=[_0x5593('0x39'),'chat','sms',_0x5593('0x3a'),_0x5593('0x3b'),_0x5593('0x3c'),'voice'];var _0x5be296={'count':0x0,'rows':[]},_0x512e48={},_0x3080b0;Promise[_0x5593('0x3d')]()[_0x5593('0x1f')](function(){if(_0x2047f7[_0x5593('0x3e')][_0x5593('0x3f')]){if(!_[_0x5593('0x40')](_0x4064d4,_0x2047f7['query'][_0x5593('0x3f')][_0x5593('0x41')]()))throw new Error(_0x5593('0x42'));_0x3080b0=_0x2047f7[_0x5593('0x3e')]['channel'][_0x5593('0x41')]();}var _0x3fd09f=_['startCase'](_0x3080b0)+_0x5593('0x43');var _0x208d2e=_[_0x5593('0x44')](db[_0x3fd09f][_0x5593('0x45')],function(_0x6045f2){return{'name':_0x6045f2[_0x5593('0x46')],'type':_0x6045f2[_0x5593('0x47')]['key']};});_0x512e48=qs[_0x5593('0x48')](_0x208d2e,_0x2047f7);if(_0x2047f7[_0x5593('0x49')]['role']===_0x5593('0x49')){var _0x184cb7={'params':{'id':_0x2047f7['user'][_0x5593('0x4a')]},'query':{'section':_0x3080b0===_0x5593('0x4b')&&_0x2047f7[_0x5593('0x3e')][_0x5593('0x47')]===_0x5593('0x4c')?'QueueCampaigns':_['startCase'](_0x3080b0)+_0x5593('0x4d'),'type':_0x2047f7[_0x5593('0x3e')]['type'],'nolimit':!![],'sort':_0x5593('0x36'),'filter':_0x2047f7[_0x5593('0x3e')]['filter']}};return db[_0x5593('0x4e')][_0x5593('0x4f')](_0x184cb7);}return db[_0x3fd09f][_0x5593('0x50')](_0x512e48);})[_0x5593('0x1f')](function(_0x25fbdb){_0x5be296[_0x5593('0x51')]=_0x25fbdb[_0x5593('0x51')];var _0x52c9c1=_0x3080b0==='voice'?client:routingClient;return _0x52c9c1['request'](_[_0x5593('0x52')](_0x3080b0)+'Queues',_0x2047f7)[_0x5593('0x1f')](function(_0x2f8d44){if(_0x2f8d44[_0x5593('0x25')])throw new Error(util[_0x5593('0x53')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x3080b0));var _0x50a713=_0x2f8d44[_0x5593('0x54')];var _0x26daec=[_0x5593('0x55'),_0x5593('0x56'),_0x5593('0x57'),_0x5593('0x58'),_0x5593('0x59')];if(_0x3080b0===_0x5593('0x4b')&&_0x2047f7['query'][_0x5593('0x47')]===_0x5593('0x4c')){_0x26daec[_0x5593('0x5a')]('pTalking',_0x5593('0x5b'),'message',_0x5593('0x5c'),_0x5593('0x5d'),_0x5593('0x5e'),_0x5593('0x5f'),_0x5593('0x60'),'erlangCalls','erlangCallToSecond',_0x5593('0x61'),_0x5593('0x62'),'dialPredictiveInterval',_0x5593('0x63'),_0x5593('0x64'),_0x5593('0x65'),'predictiveIntervalTotalCalls',_0x5593('0x66'),_0x5593('0x67'),'predictiveIntervalDroppedCallsCallersExit',_0x5593('0x68'),_0x5593('0x69'));}var _0x3f4f50=_0x25fbdb['rows']['map'](function(_0x363f14){var _0x5b291e=_0x363f14[_0x5593('0x6a')]({'plain':!![]});_0x5b291e[_0x5593('0x59')]=0x0;_0x5b291e['loggedInDb']=0x0;_0x5b291e[_0x5593('0x55')]=0x0;_0x5b291e['available']=0x0;_0x5b291e[_0x5593('0x59')]=0x0;_0x5b291e[_0x5593('0x57')]=0x0;if(_0x3080b0===_0x5593('0x4b')){_0x5b291e[_0x5593('0x58')]=0x0;if(_0x2047f7[_0x5593('0x3e')][_0x5593('0x47')]===_0x5593('0x4c')){_0x5b291e[_0x5593('0x6b')]=0x0;_0x5b291e[_0x5593('0x5b')]=0x0;}}_0x5b291e[_0x5593('0x6c')]=[];var _0x1968f4=_[_0x5593('0x6d')](_0x50a713[_0x5593('0x6e')],['id',_0x5b291e['id']]);if(_0x1968f4)_['merge'](_0x5b291e,_[_0x5593('0x6f')](_0x1968f4,_0x26daec));if(_0x3080b0===_0x5593('0x4b')){return _0x363f14['getAgents']({'attributes':['id','name',_0x5593('0x70')],'joinTableAttributes':[],'raw':!![]})[_0x5593('0x1f')](function(_0x405cc0){return _0x363f14['getMembers']({'raw':!![]})['then'](function(_0x114855){for(var _0x201546=0x0;_0x201546<_0x405cc0['length'];_0x201546++){var _0x2c678b=_[_0x5593('0x6d')](_0x114855,[_0x5593('0x71'),_0x405cc0[_0x201546]['id']]);var _0x5606fc={'id':_0x405cc0[_0x201546]['id'],'name':_0x405cc0[_0x201546][_0x5593('0x36')],'online':Boolean(_0x405cc0[_0x201546][_0x5593('0x70')]),'paused':_0x2c678b?Boolean(_0x2c678b[_0x5593('0x59')]):![]};if(_0x5606fc[_0x5593('0x70')])_0x5b291e[_0x5593('0x72')]++;if(_0x5606fc['paused'])_0x5b291e[_0x5593('0x59')]++;_0x5b291e[_0x5593('0x6c')][_0x5593('0x5a')](_0x5606fc);}return _0x5b291e;});});}else{var _0x4114a4=_0x5593('0x73')+_[_0x5593('0x52')](_0x3080b0)+_0x5593('0x43');var _0xb88ebd=_['startCase'](_0x3080b0)+_0x5593('0x74');var _0x1dda65=_0x3080b0+_0x5593('0x75');return db[_0x4114a4][_0x5593('0x76')]({'where':{['userQueueKey']:_0x363f14['id']},'raw':!![]})['then'](function(_0x3e6465){return db[_0x5593('0x73')][_0x5593('0x76')]({'attributes':['id',_0x5593('0x36'),'online',_0x1dda65],'where':{'id':_['map'](_0x3e6465,_0x5593('0x71')),'role':_0x5593('0x77')},'raw':!![]});})[_0x5593('0x1f')](function(_0x1eee9c){for(var _0x123638=0x0;_0x123638<_0x1eee9c['length'];_0x123638++){var _0x4b711b={'id':_0x1eee9c[_0x123638]['id'],'name':_0x1eee9c[_0x123638][_0x5593('0x36')],'online':Boolean(_0x1eee9c[_0x123638][_0x5593('0x70')]),'paused':Boolean(_0x1eee9c[_0x123638][_0x1dda65])};if(_0x4b711b[_0x5593('0x70')])_0x5b291e['loggedInDb']++;if(_0x4b711b[_0x5593('0x59')])_0x5b291e[_0x5593('0x59')]++;_0x5b291e[_0x5593('0x6c')][_0x5593('0x5a')](_0x4b711b);}return _0x5b291e;});}});return Promise[_0x5593('0x78')](_0x3f4f50);});})[_0x5593('0x1f')](function(_0xf9536a){_0x5be296[_0x5593('0x6e')]=_0xf9536a;return _0x5be296;})[_0x5593('0x1f')](respondWithFilteredResult(_0x3e3a8f,_0x512e48))[_0x5593('0x28')](handleError(_0x3e3a8f,null));}; \ No newline at end of file +var _0x850d=['online','UserId','loggedInDb','User','Pause','findAll','length','all','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Realtime,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Realtime,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','send','getQueues','mail','chat','sms','openchannel','fax','whatsapp','voice','resolve','query','channel','Invalid\x20channel','toLowerCase','startCase','Queue','map','fieldName','type','key','getOptions','role','user','QueueCampaigns','filter','UserProfile','getResources','findAndCountAll','request','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','loggedIn','available','talking','outbound','push','pTalking','originated','dialMethod','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','paused','waiting','agents','find','getAgents'];(function(_0x6d3590,_0x463414){var _0x224bef=function(_0x1dfea8){while(--_0x1dfea8){_0x6d3590['push'](_0x6d3590['shift']());}};_0x224bef(++_0x463414);}(_0x850d,0x80));var _0xd850=function(_0x19a79c,_0x18a3c5){_0x19a79c=_0x19a79c-0x0;var _0xbd43df=_0x850d[_0x19a79c];return _0xbd43df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd850('0x0'));var zipdir=require(_0xd850('0x1'));var jsonpatch=require(_0xd850('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd850('0x3'));var Mustache=require(_0xd850('0x4'));var util=require(_0xd850('0x5'));var path=require(_0xd850('0x6'));var sox=require(_0xd850('0x7'));var csv=require(_0xd850('0x8'));var ejs=require(_0xd850('0x9'));var fs=require('fs');var fs_extra=require(_0xd850('0xa'));var _=require(_0xd850('0xb'));var squel=require('squel');var crypto=require(_0xd850('0xc'));var jsforce=require(_0xd850('0xd'));var deskjs=require(_0xd850('0xe'));var toCsv=require(_0xd850('0x8'));var querystring=require(_0xd850('0xf'));var Papa=require(_0xd850('0x10'));var Redis=require(_0xd850('0x11'));var authService=require(_0xd850('0x12'));var qs=require(_0xd850('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd850('0x14'))(_0xd850('0x15'));var utils=require(_0xd850('0x16'));var config=require(_0xd850('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xd850('0x18'));var client=jayson[_0xd850('0x19')][_0xd850('0x1a')]({'port':0x232a});var routingClient=jayson['client'][_0xd850('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x3e9d1b,_0x30048d,_0x4bef49,_0x3dfcf2){return new BPromise(function(_0xb3bb60,_0x57bf67){var _0x2df1c5=_0x3dfcf2||client;return _0x2df1c5['request'](_0x3e9d1b,_0x4bef49)[_0xd850('0x1b')](function(_0x4e9f4f){logger[_0xd850('0x1c')]('Realtime,\x20%s,\x20%s',_0x30048d,_0xd850('0x1d'));logger[_0xd850('0x1e')](_0xd850('0x1f'),_0x30048d,_0xd850('0x1d'),JSON[_0xd850('0x20')](_0x4e9f4f));if(_0x4e9f4f[_0xd850('0x21')]){if(_0x4e9f4f['error'][_0xd850('0x22')]===0x1f4){logger[_0xd850('0x21')]('Realtime,\x20%s,\x20%s',_0x30048d,_0x4e9f4f[_0xd850('0x21')][_0xd850('0x23')]);return _0x57bf67(_0x4e9f4f[_0xd850('0x21')][_0xd850('0x23')]);}logger['error'](_0xd850('0x24'),_0x30048d,_0x4e9f4f[_0xd850('0x21')][_0xd850('0x23')]);return _0xb3bb60(_0x4e9f4f['error'][_0xd850('0x23')]);}else{logger['info']('Realtime,\x20%s,\x20%s',_0x30048d,_0xd850('0x1d'));_0xb3bb60(_0x4e9f4f[_0xd850('0x25')][_0xd850('0x23')]);}})[_0xd850('0x26')](function(_0x3c46b5){logger[_0xd850('0x21')](_0xd850('0x24'),_0x30048d,_0x3c46b5);_0x57bf67(_0x3c46b5);});});}function respondWithStatusCode(_0x59dab4,_0x10b379){_0x10b379=_0x10b379||0xcc;return function(_0x27c275){if(_0x27c275){return _0x59dab4[_0xd850('0x27')](_0x10b379);}return _0x59dab4[_0xd850('0x28')](_0x10b379)[_0xd850('0x29')]();};}function respondWithResult(_0x3d0892,_0x13b55b){_0x13b55b=_0x13b55b||0xc8;return function(_0x2ba140){if(_0x2ba140){return _0x3d0892['status'](_0x13b55b)[_0xd850('0x2a')](_0x2ba140);}};}function respondWithFilteredResult(_0x135c19,_0x2dd9c3){return function(_0x10aa53){if(_0x10aa53){var _0x173339=typeof _0x2dd9c3[_0xd850('0x2b')]===_0xd850('0x2c')&&typeof _0x2dd9c3[_0xd850('0x2d')]==='undefined';var _0x366ed4=_0x10aa53[_0xd850('0x2e')];var _0x1d3e44=_0x173339?0x0:_0x2dd9c3['offset'];var _0x4cd519=_0x173339?_0x10aa53[_0xd850('0x2e')]:_0x2dd9c3[_0xd850('0x2b')]+_0x2dd9c3[_0xd850('0x2d')];var _0xbac2c3;if(_0x4cd519>=_0x366ed4){_0x4cd519=_0x366ed4;_0xbac2c3=0xc8;}else{_0xbac2c3=0xce;}_0x135c19[_0xd850('0x28')](_0xbac2c3);return _0x135c19[_0xd850('0x2f')](_0xd850('0x30'),_0x1d3e44+'-'+_0x4cd519+'/'+_0x366ed4)[_0xd850('0x2a')](_0x10aa53);}return null;};}function patchUpdates(_0x263c37){return function(_0x3cbe27){try{jsonpatch[_0xd850('0x31')](_0x3cbe27,_0x263c37,!![]);}catch(_0x34248d){return BPromise[_0xd850('0x32')](_0x34248d);}return _0x3cbe27[_0xd850('0x33')]();};}function saveUpdates(_0x4e6c38,_0x50aa84){return function(_0x130327){if(_0x130327){return _0x130327[_0xd850('0x34')](_0x4e6c38)[_0xd850('0x1b')](function(_0x643ef){return _0x643ef;});}return null;};}function removeEntity(_0xfdbf59,_0x38692a){return function(_0xa0baed){if(_0xa0baed){return _0xa0baed[_0xd850('0x35')]()[_0xd850('0x1b')](function(){_0xfdbf59[_0xd850('0x28')](0xcc)[_0xd850('0x29')]();});}};}function handleEntityNotFound(_0x43533d,_0xc85089){return function(_0x431332){if(!_0x431332){_0x43533d['sendStatus'](0x194);}return _0x431332;};}function handleError(_0x1382b6,_0x1fa59a){_0x1fa59a=_0x1fa59a||0x1f4;return function(_0x2c6510){logger[_0xd850('0x21')](_0x2c6510['stack']);if(_0x2c6510[_0xd850('0x36')]){delete _0x2c6510[_0xd850('0x36')];}_0x1382b6[_0xd850('0x28')](_0x1fa59a)[_0xd850('0x37')](_0x2c6510);};}exports[_0xd850('0x38')]=function(_0x20b3e5,_0x31a930){var _0x44ed18=[_0xd850('0x39'),_0xd850('0x3a'),_0xd850('0x3b'),_0xd850('0x3c'),_0xd850('0x3d'),_0xd850('0x3e'),_0xd850('0x3f')];var _0x483adb={'count':0x0,'rows':[]},_0x467fab={},_0x2a4166;Promise[_0xd850('0x40')]()[_0xd850('0x1b')](function(){if(_0x20b3e5[_0xd850('0x41')]['channel']){if(!_['includes'](_0x44ed18,_0x20b3e5[_0xd850('0x41')][_0xd850('0x42')]['toLowerCase']()))throw new Error(_0xd850('0x43'));_0x2a4166=_0x20b3e5['query']['channel'][_0xd850('0x44')]();}var _0x5541cd=_[_0xd850('0x45')](_0x2a4166)+_0xd850('0x46');var _0x5062d2=_[_0xd850('0x47')](db[_0x5541cd]['rawAttributes'],function(_0x5edd23){return{'name':_0x5edd23[_0xd850('0x48')],'type':_0x5edd23[_0xd850('0x49')][_0xd850('0x4a')]};});_0x467fab=qs[_0xd850('0x4b')](_0x5062d2,_0x20b3e5);if(_0x20b3e5['user'][_0xd850('0x4c')]===_0xd850('0x4d')){var _0xcfc5f9={'params':{'id':_0x20b3e5[_0xd850('0x4d')]['userProfileId']},'query':{'section':_0x2a4166===_0xd850('0x3f')&&_0x20b3e5[_0xd850('0x41')][_0xd850('0x49')]==='outbound'?_0xd850('0x4e'):_[_0xd850('0x45')](_0x2a4166)+'Queues','type':_0x20b3e5[_0xd850('0x41')][_0xd850('0x49')],'nolimit':!![],'sort':_0xd850('0x36'),'filter':_0x20b3e5[_0xd850('0x41')][_0xd850('0x4f')]}};return db[_0xd850('0x50')][_0xd850('0x51')](_0xcfc5f9);}return db[_0x5541cd][_0xd850('0x52')](_0x467fab);})[_0xd850('0x1b')](function(_0x8e7495){_0x483adb[_0xd850('0x2e')]=_0x8e7495[_0xd850('0x2e')];var _0x32b7c7=_0x2a4166===_0xd850('0x3f')?client:routingClient;return _0x32b7c7[_0xd850('0x53')](_[_0xd850('0x45')](_0x2a4166)+_0xd850('0x54'),_0x20b3e5)['then'](function(_0x42c520){if(_0x42c520[_0xd850('0x21')])throw new Error(util[_0xd850('0x55')](_0xd850('0x56'),_0x2a4166));var _0x1bc425=_0x42c520[_0xd850('0x25')];var _0x432219=[_0xd850('0x57'),_0xd850('0x58'),'waiting',_0xd850('0x59'),'paused'];if(_0x2a4166===_0xd850('0x3f')&&_0x20b3e5[_0xd850('0x41')][_0xd850('0x49')]===_0xd850('0x5a')){_0x432219[_0xd850('0x5b')](_0xd850('0x5c'),_0xd850('0x5d'),'message','dialActive',_0xd850('0x5e'),'Trunk',_0xd850('0x5f'),'startProgressive',_0xd850('0x60'),_0xd850('0x61'),_0xd850('0x62'),_0xd850('0x63'),'dialPredictiveInterval',_0xd850('0x64'),'dialPredictiveIntervalMinThreshold',_0xd850('0x65'),_0xd850('0x66'),'predictiveIntervalAnsweredCalls',_0xd850('0x67'),'predictiveIntervalDroppedCallsCallersExit',_0xd850('0x68'),_0xd850('0x69'));}var _0xdaebb7=_0x8e7495[_0xd850('0x6a')][_0xd850('0x47')](function(_0x131499){var _0x3dab1d=_0x131499['get']({'plain':!![]});_0x3dab1d[_0xd850('0x6b')]=0x0;_0x3dab1d['loggedInDb']=0x0;_0x3dab1d['loggedIn']=0x0;_0x3dab1d[_0xd850('0x58')]=0x0;_0x3dab1d[_0xd850('0x6b')]=0x0;_0x3dab1d[_0xd850('0x6c')]=0x0;if(_0x2a4166==='voice'){_0x3dab1d[_0xd850('0x59')]=0x0;if(_0x20b3e5[_0xd850('0x41')][_0xd850('0x49')]===_0xd850('0x5a')){_0x3dab1d[_0xd850('0x5c')]=0x0;_0x3dab1d['originated']=0x0;}}_0x3dab1d[_0xd850('0x6d')]=[];var _0x265494=_[_0xd850('0x6e')](_0x1bc425['rows'],['id',_0x3dab1d['id']]);if(_0x265494)_['merge'](_0x3dab1d,_['pick'](_0x265494,_0x432219));if(_0x2a4166===_0xd850('0x3f')){return _0x131499[_0xd850('0x6f')]({'attributes':['id',_0xd850('0x36'),_0xd850('0x70')],'joinTableAttributes':[],'raw':!![]})[_0xd850('0x1b')](function(_0x377c7a){return _0x131499['getMembers']({'raw':!![]})['then'](function(_0x33fa4d){for(var _0x26b170=0x0;_0x26b170<_0x377c7a['length'];_0x26b170++){var _0x3dfc61=_[_0xd850('0x6e')](_0x33fa4d,[_0xd850('0x71'),_0x377c7a[_0x26b170]['id']]);var _0x2b5638={'id':_0x377c7a[_0x26b170]['id'],'name':_0x377c7a[_0x26b170][_0xd850('0x36')],'online':Boolean(_0x377c7a[_0x26b170][_0xd850('0x70')]),'paused':_0x3dfc61?Boolean(_0x3dfc61[_0xd850('0x6b')]):![]};if(_0x2b5638[_0xd850('0x70')])_0x3dab1d[_0xd850('0x72')]++;if(_0x2b5638[_0xd850('0x6b')])_0x3dab1d[_0xd850('0x6b')]++;_0x3dab1d[_0xd850('0x6d')]['push'](_0x2b5638);}return _0x3dab1d;});});}else{var _0x4c3905=_0xd850('0x73')+_[_0xd850('0x45')](_0x2a4166)+_0xd850('0x46');var _0x52b492=_[_0xd850('0x45')](_0x2a4166)+'QueueId';var _0x5e3f5c=_0x2a4166+_0xd850('0x74');return db[_0x4c3905][_0xd850('0x75')]({'where':{['userQueueKey']:_0x131499['id']},'raw':!![]})[_0xd850('0x1b')](function(_0xba8a4f){return db[_0xd850('0x73')][_0xd850('0x75')]({'attributes':['id',_0xd850('0x36'),_0xd850('0x70'),_0x5e3f5c],'where':{'id':_['map'](_0xba8a4f,_0xd850('0x71')),'role':'agent'},'raw':!![]});})[_0xd850('0x1b')](function(_0x5b3d48){for(var _0x15cd1e=0x0;_0x15cd1e<_0x5b3d48[_0xd850('0x76')];_0x15cd1e++){var _0x413601={'id':_0x5b3d48[_0x15cd1e]['id'],'name':_0x5b3d48[_0x15cd1e][_0xd850('0x36')],'online':Boolean(_0x5b3d48[_0x15cd1e]['online']),'paused':Boolean(_0x5b3d48[_0x15cd1e][_0x5e3f5c])};if(_0x413601['online'])_0x3dab1d[_0xd850('0x72')]++;if(_0x413601[_0xd850('0x6b')])_0x3dab1d[_0xd850('0x6b')]++;_0x3dab1d['agents']['push'](_0x413601);}return _0x3dab1d;});}});return Promise[_0xd850('0x77')](_0xdaebb7);});})[_0xd850('0x1b')](function(_0x4786a4){_0x483adb[_0xd850('0x6a')]=_0x4786a4;return _0x483adb;})[_0xd850('0x1b')](respondWithFilteredResult(_0x31a930,_0x467fab))[_0xd850('0x26')](handleError(_0x31a930,null));}; \ No newline at end of file diff --git a/server/api/realtime/realtime.model.js b/server/api/realtime/realtime.model.js index 50ad049..e5c8199 100644 --- a/server/api/realtime/realtime.model.js +++ b/server/api/realtime/realtime.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8582=['rimraf','../../config/environment','exports','Realtime','lodash','util','moment','bluebird','request-promise'];(function(_0x5bda27,_0x1bacc3){var _0x51c6de=function(_0x2445f4){while(--_0x2445f4){_0x5bda27['push'](_0x5bda27['shift']());}};_0x51c6de(++_0x1bacc3);}(_0x8582,0x1b4));var _0x2858=function(_0x5aa51e,_0x2db526){_0x5aa51e=_0x5aa51e-0x0;var _0x2fd467=_0x8582[_0x5aa51e];return _0x2fd467;};'use strict';var _=require(_0x2858('0x0'));var util=require(_0x2858('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2858('0x2'));var BPromise=require(_0x2858('0x3'));var rp=require(_0x2858('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2858('0x5'));var config=require(_0x2858('0x6'));;module[_0x2858('0x7')]=function(_0x186b35,_0x3eafe1){return _0x186b35['define'](_0x2858('0x8'),[],{});}; \ No newline at end of file +var _0xc83a=['api','moment','bluebird','request-promise','path','exports','Realtime','util','../../config/logger'];(function(_0x401813,_0x5a9587){var _0x16bb16=function(_0x598ef0){while(--_0x598ef0){_0x401813['push'](_0x401813['shift']());}};_0x16bb16(++_0x5a9587);}(_0xc83a,0x11e));var _0xac83=function(_0x17288a,_0x3427c9){_0x17288a=_0x17288a-0x0;var _0x267500=_0xc83a[_0x17288a];return _0x267500;};'use strict';var _=require('lodash');var util=require(_0xac83('0x0'));var logger=require(_0xac83('0x1'))(_0xac83('0x2'));var moment=require(_0xac83('0x3'));var BPromise=require(_0xac83('0x4'));var rp=require(_0xac83('0x5'));var fs=require('fs');var path=require(_0xac83('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');;module[_0xac83('0x7')]=function(_0x20c834,_0x471bca){return _0x20c834['define'](_0xac83('0x8'),[],{});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index fa677ed..1345ab5 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4ccc7a,_0x2b65d2){var _0x1f8000=function(_0x3463aa){while(--_0x3463aa){_0x4ccc7a['push'](_0x4ccc7a['shift']());}};_0x1f8000(++_0x2b65d2);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x15d356,_0x30debd){var _0x374b38=function(_0x2753e4){while(--_0x2753e4){_0x15d356['push'](_0x15d356['shift']());}};_0x374b38(++_0x30debd);}(_0x70e0,0x17b));var _0x070e=function(_0x42d005,_0x494e93){_0x42d005=_0x42d005-0x0;var _0x11dcca=_0x70e0[_0x42d005];return _0x11dcca;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index b4c2498..527d74d 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 _0x199c=['DATE','INTEGER','STRING'];(function(_0xe054d1,_0x2ba0dd){var _0x49c242=function(_0x5f5109){while(--_0x5f5109){_0xe054d1['push'](_0xe054d1['shift']());}};_0x49c242(++_0x2ba0dd);}(_0x199c,0x1d8));var _0xc199=function(_0x396216,_0x3d35d1){_0x396216=_0x396216-0x0;var _0x426f3d=_0x199c[_0x396216];return _0x426f3d;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0xc199('0x0')](0x2)},'statedesc':{'type':Sequelize[_0xc199('0x1')]},'scheduledat':{'type':Sequelize[_0xc199('0x2')]},'uniqueid':{'type':Sequelize[_0xc199('0x1')]},'starttime':{'type':Sequelize[_0xc199('0x2')]},'responsetime':{'type':Sequelize[_0xc199('0x2')]},'ringtime':{'type':Sequelize[_0xc199('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xc199('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc199('0x1')]}}; \ No newline at end of file +var _0x4745=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4745,0x1e7));var _0x5474=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4745[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x5474('0x0'));module[_0x5474('0x1')]={'state':{'type':Sequelize[_0x5474('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5474('0x3')]},'scheduledat':{'type':Sequelize[_0x5474('0x4')]},'uniqueid':{'type':Sequelize[_0x5474('0x3')]},'starttime':{'type':Sequelize[_0x5474('0x4')]},'responsetime':{'type':Sequelize[_0x5474('0x4')]},'ringtime':{'type':Sequelize[_0x5474('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5474('0x3')]},'campaigntype':{'type':Sequelize[_0x5474('0x3')]},'membername':{'type':Sequelize[_0x5474('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 928731c..04fd16e 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 _0x14dd=['ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define'];(function(_0x28dfcf,_0x59d832){var _0x432b65=function(_0x45a2af){while(--_0x45a2af){_0x28dfcf['push'](_0x28dfcf['shift']());}};_0x432b65(++_0x59d832);}(_0x14dd,0x72));var _0xd14d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14dd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd14d('0x0'));var util=require(_0xd14d('0x1'));var logger=require(_0xd14d('0x2'))(_0xd14d('0x3'));var moment=require(_0xd14d('0x4'));var BPromise=require(_0xd14d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd14d('0x6'));var rimraf=require(_0xd14d('0x7'));var config=require(_0xd14d('0x8'));var attributes=require(_0xd14d('0x9'));module[_0xd14d('0xa')]=function(_0x593a29,_0x187e73){return _0x593a29[_0xd14d('0xb')](_0xd14d('0xc'),attributes,{'tableName':_0xd14d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0af1=['report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview'];(function(_0xe14ee9,_0x4cd8e1){var _0x1dda60=function(_0x50b9cf){while(--_0x50b9cf){_0xe14ee9['push'](_0xe14ee9['shift']());}};_0x1dda60(++_0x4cd8e1);}(_0x0af1,0xf1));var _0x10af=function(_0xb483c1,_0x4bbad2){_0xb483c1=_0xb483c1-0x0;var _0x33dc07=_0x0af1[_0xb483c1];return _0x33dc07;};'use strict';var _=require(_0x10af('0x0'));var util=require(_0x10af('0x1'));var logger=require(_0x10af('0x2'))(_0x10af('0x3'));var moment=require(_0x10af('0x4'));var BPromise=require(_0x10af('0x5'));var rp=require(_0x10af('0x6'));var fs=require('fs');var path=require(_0x10af('0x7'));var rimraf=require(_0x10af('0x8'));var config=require(_0x10af('0x9'));var attributes=require(_0x10af('0xa'));module[_0x10af('0xb')]=function(_0x24a5f9,_0x32fe90){return _0x24a5f9[_0x10af('0xc')](_0x10af('0xd'),attributes,{'tableName':_0x10af('0xe'),'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 583720b..8bb8f20 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 _0x4a79=['moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','ReportAgentPreview','create','body','options','raw','catch','CreateReportAgentPreview','lodash','util'];(function(_0x568760,_0x468155){var _0x2803ea=function(_0xf44839){while(--_0xf44839){_0x568760['push'](_0x568760['shift']());}};_0x2803ea(++_0x468155);}(_0x4a79,0x10c));var _0x94a7=function(_0x185fce,_0x4d45cf){_0x185fce=_0x185fce-0x0;var _0x3065d0=_0x4a79[_0x185fce];return _0x3065d0;};'use strict';var _=require(_0x94a7('0x0'));var util=require(_0x94a7('0x1'));var moment=require(_0x94a7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x94a7('0x3'));var db=require(_0x94a7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x94a7('0x5'))('rpc');var config=require(_0x94a7('0x6'));var jayson=require(_0x94a7('0x7'));var client=jayson[_0x94a7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c27a0,_0x206c86,_0x4d7f95){return new BPromise(function(_0x558f02,_0x291807){return client['request'](_0x5c27a0,_0x4d7f95)[_0x94a7('0x9')](function(_0x496487){logger[_0x94a7('0xa')](_0x94a7('0xb'),_0x206c86,_0x94a7('0xc'));logger[_0x94a7('0xd')](_0x94a7('0xe'),_0x206c86,_0x94a7('0xc'),JSON[_0x94a7('0xf')](_0x496487));if(_0x496487['error']){if(_0x496487['error'][_0x94a7('0x10')]===0x1f4){logger[_0x94a7('0x11')](_0x94a7('0xb'),_0x206c86,_0x496487[_0x94a7('0x11')][_0x94a7('0x12')]);return _0x291807(_0x496487['error'][_0x94a7('0x12')]);}logger[_0x94a7('0x11')](_0x94a7('0xb'),_0x206c86,_0x496487[_0x94a7('0x11')][_0x94a7('0x12')]);return _0x558f02(_0x496487['error'][_0x94a7('0x12')]);}else{logger[_0x94a7('0xa')](_0x94a7('0xb'),_0x206c86,_0x94a7('0xc'));_0x558f02(_0x496487[_0x94a7('0x13')][_0x94a7('0x12')]);}})['catch'](function(_0x420d38){logger[_0x94a7('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x206c86,_0x420d38);_0x291807(_0x420d38);});});}exports['CreateReportAgentPreview']=function(_0x54acc0){var _0x49ef8a=this;return new Promise(function(_0x4fd23c,_0x29b422){return db[_0x94a7('0x14')][_0x94a7('0x15')](_0x54acc0[_0x94a7('0x16')],{'raw':_0x54acc0[_0x94a7('0x17')]?_0x54acc0[_0x94a7('0x17')][_0x94a7('0x18')]===undefined?!![]:![]:!![]})[_0x94a7('0x9')](function(_0x5c5592){logger['info']('CreateReportAgentPreview',_0x54acc0);logger[_0x94a7('0xd')]('CreateReportAgentPreview',_0x54acc0,JSON[_0x94a7('0xf')](_0x5c5592));_0x4fd23c(_0x5c5592);})[_0x94a7('0x19')](function(_0x169f97){logger[_0x94a7('0x11')](_0x94a7('0x1a'),_0x169f97['message'],_0x54acc0);_0x29b422(_0x49ef8a[_0x94a7('0x11')](0x1f4,_0x169f97['message']));});});}; \ No newline at end of file +var _0x4c62=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateReportAgentPreview','ReportAgentPreview','create','body','raw','debug','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x4329c0,_0x507029){var _0x5e82b0=function(_0x11d092){while(--_0x11d092){_0x4329c0['push'](_0x4329c0['shift']());}};_0x5e82b0(++_0x507029);}(_0x4c62,0x14b));var _0x24c6=function(_0x2c27f6,_0x12b617){_0x2c27f6=_0x2c27f6-0x0;var _0x16749f=_0x4c62[_0x2c27f6];return _0x16749f;};'use strict';var _=require(_0x24c6('0x0'));var util=require(_0x24c6('0x1'));var moment=require('moment');var BPromise=require(_0x24c6('0x2'));var rs=require(_0x24c6('0x3'));var fs=require('fs');var Redis=require(_0x24c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x24c6('0x5'));var logger=require(_0x24c6('0x6'))(_0x24c6('0x7'));var config=require(_0x24c6('0x8'));var jayson=require(_0x24c6('0x9'));var client=jayson['client'][_0x24c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x220506,_0xa2259f,_0xd6b95c){return new BPromise(function(_0x284339,_0x5c4f35){return client[_0x24c6('0xb')](_0x220506,_0xd6b95c)[_0x24c6('0xc')](function(_0x1d1768){logger[_0x24c6('0xd')](_0x24c6('0xe'),_0xa2259f,_0x24c6('0xf'));logger['debug'](_0x24c6('0x10'),_0xa2259f,_0x24c6('0xf'),JSON[_0x24c6('0x11')](_0x1d1768));if(_0x1d1768[_0x24c6('0x12')]){if(_0x1d1768['error'][_0x24c6('0x13')]===0x1f4){logger[_0x24c6('0x12')](_0x24c6('0xe'),_0xa2259f,_0x1d1768[_0x24c6('0x12')]['message']);return _0x5c4f35(_0x1d1768['error'][_0x24c6('0x14')]);}logger[_0x24c6('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0xa2259f,_0x1d1768['error'][_0x24c6('0x14')]);return _0x284339(_0x1d1768['error']['message']);}else{logger['info'](_0x24c6('0xe'),_0xa2259f,_0x24c6('0xf'));_0x284339(_0x1d1768['result'][_0x24c6('0x14')]);}})['catch'](function(_0x525386){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0xa2259f,_0x525386);_0x5c4f35(_0x525386);});});}exports[_0x24c6('0x15')]=function(_0x118b83){var _0x4f6292=this;return new Promise(function(_0x51f031,_0x233f2e){return db[_0x24c6('0x16')][_0x24c6('0x17')](_0x118b83[_0x24c6('0x18')],{'raw':_0x118b83['options']?_0x118b83['options'][_0x24c6('0x19')]===undefined?!![]:![]:!![]})[_0x24c6('0xc')](function(_0x45f774){logger[_0x24c6('0xd')](_0x24c6('0x15'),_0x118b83);logger[_0x24c6('0x1a')](_0x24c6('0x15'),_0x118b83,JSON[_0x24c6('0x11')](_0x45f774));_0x51f031(_0x45f774);})[_0x24c6('0x1b')](function(_0x37d00a){logger[_0x24c6('0x12')](_0x24c6('0x15'),_0x37d00a[_0x24c6('0x14')],_0x118b83);_0x233f2e(_0x4f6292['error'](0x1f4,_0x37d00a[_0x24c6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index ee4bae1..e7d8285 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 _0xd7b8=['path','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','voiceChannels','get','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','showVoiceQueues','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/telephones','trunks','/fax/accounts','faxAccounts','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer'];(function(_0x56a226,_0x2fb531){var _0x15fcfe=function(_0x45b94e){while(--_0x45b94e){_0x56a226['push'](_0x56a226['shift']());}};_0x15fcfe(++_0x2fb531);}(_0xd7b8,0x18f));var _0x8d7b=function(_0x411bba,_0x5a5713){_0x411bba=_0x411bba-0x0;var _0x42a5cf=_0xd7b8[_0x411bba];return _0x42a5cf;};'use strict';var multer=require(_0x8d7b('0x0'));var util=require('util');var path=require(_0x8d7b('0x1'));var express=require(_0x8d7b('0x2'));var router=express[_0x8d7b('0x3')]();var auth=require(_0x8d7b('0x4'));var controller=require(_0x8d7b('0x5'));router['get'](_0x8d7b('0x6'),auth['isAuthenticated'](),controller[_0x8d7b('0x7')]);router[_0x8d7b('0x8')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x8d7b('0x9')](),controller[_0x8d7b('0xa')]);router[_0x8d7b('0x8')](_0x8d7b('0xb'),auth[_0x8d7b('0x9')](),controller['voiceChannelStopMixMonitor']);router[_0x8d7b('0x8')](_0x8d7b('0xc'),auth[_0x8d7b('0x9')](),controller[_0x8d7b('0xd')]);router[_0x8d7b('0x8')](_0x8d7b('0xe'),auth[_0x8d7b('0x9')](),controller['chatQueues']);router[_0x8d7b('0x8')](_0x8d7b('0xf'),auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x10')]);router[_0x8d7b('0x8')](_0x8d7b('0x11'),auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x12')]);router['get'](_0x8d7b('0x13'),auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x14')]);router[_0x8d7b('0x8')](_0x8d7b('0x15'),auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x16')]);router[_0x8d7b('0x8')](_0x8d7b('0x17'),auth['isAuthenticated'](),controller[_0x8d7b('0x18')]);router[_0x8d7b('0x8')](_0x8d7b('0x19'),auth[_0x8d7b('0x9')](),controller['faxQueues']);router[_0x8d7b('0x8')](_0x8d7b('0x1a'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0x8d7b('0x8')]('/voice/queues/channels',auth['isAuthenticated'](),controller[_0x8d7b('0x1b')]);router[_0x8d7b('0x8')](_0x8d7b('0x1c'),auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x1d')]);router[_0x8d7b('0x8')](_0x8d7b('0x1e'),auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x1f')]);router[_0x8d7b('0x8')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x20')]);router[_0x8d7b('0x8')]('/voice/queues/:id',auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x21')]);router['put'](_0x8d7b('0x22'),auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x23')]);router['get'](_0x8d7b('0x24'),auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x25')]);router[_0x8d7b('0x8')](_0x8d7b('0x26'),auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x27')]);router[_0x8d7b('0x8')](_0x8d7b('0x28'),auth['isAuthenticated'](),controller[_0x8d7b('0x29')]);router[_0x8d7b('0x2a')]('/agents/:id/capacity',auth[_0x8d7b('0x9')](),controller['agentCapacity']);router[_0x8d7b('0x8')](_0x8d7b('0x2b'),auth[_0x8d7b('0x9')](),controller['telephones']);router['get']('/trunks',auth['isAuthenticated'](),controller[_0x8d7b('0x2c')]);router[_0x8d7b('0x8')]('/campaigns',auth[_0x8d7b('0x9')](),controller['campaigns']);router[_0x8d7b('0x8')](_0x8d7b('0x2d'),auth['isAuthenticated'](),controller[_0x8d7b('0x2e')]);router[_0x8d7b('0x8')]('/chat/queues/waitinginteractions',auth[_0x8d7b('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0x8d7b('0x8')](_0x8d7b('0x2f'),auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x30')]);router['get'](_0x8d7b('0x31'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x8d7b('0x8')](_0x8d7b('0x32'),auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x33')]);router['get'](_0x8d7b('0x34'),auth['isAuthenticated'](),controller[_0x8d7b('0x35')]);router[_0x8d7b('0x8')]('/whatsapp/queues/waitinginteractions',auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x36')]);router[_0x8d7b('0x8')](_0x8d7b('0x37'),auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x38')]);router[_0x8d7b('0x39')]('/mail/queues/:id/notify',auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x3a')](_0x8d7b('0x3b')));router[_0x8d7b('0x8')](_0x8d7b('0x3c'),auth['isAuthenticated'](),controller[_0x8d7b('0x3d')]);router[_0x8d7b('0x39')](_0x8d7b('0x3e'),auth['isAuthenticated'](),controller[_0x8d7b('0x3a')](_0x8d7b('0x3f')));router['get'](_0x8d7b('0x40'),auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x41')]);router[_0x8d7b('0x39')](_0x8d7b('0x42'),auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x3a')](_0x8d7b('0x43')));router[_0x8d7b('0x8')](_0x8d7b('0x44'),auth[_0x8d7b('0x9')](),controller['showFaxQueues']);router[_0x8d7b('0x39')](_0x8d7b('0x45'),auth['isAuthenticated'](),controller[_0x8d7b('0x3a')](_0x8d7b('0x46')));router['get'](_0x8d7b('0x47'),auth[_0x8d7b('0x9')](),controller['showOpenchannelQueues']);router[_0x8d7b('0x39')](_0x8d7b('0x48'),auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x3a')]('sms'));router[_0x8d7b('0x39')](_0x8d7b('0x49'),auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x3a')]('whatsapp'));router[_0x8d7b('0x8')]('/sms/queues/:id',auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x4a')]);router[_0x8d7b('0x8')](_0x8d7b('0x4b'),auth[_0x8d7b('0x9')](),controller[_0x8d7b('0x4c')]);router[_0x8d7b('0x39')](_0x8d7b('0x4d'),auth['isAuthenticated'](),controller[_0x8d7b('0x4e')]);module[_0x8d7b('0x4f')]=router; \ No newline at end of file +var _0x854f=['voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','/campaigns','campaigns','/fax/accounts','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id','/sms/queues/:id/notify','sms','showSmsQueues','showWhatsappQueues','agentNotify','multer','util','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor'];(function(_0x55c725,_0x22748f){var _0x2aa1d6=function(_0x20719d){while(--_0x20719d){_0x55c725['push'](_0x55c725['shift']());}};_0x2aa1d6(++_0x22748f);}(_0x854f,0x8d));var _0xf854=function(_0x324066,_0x4f4640){_0x324066=_0x324066-0x0;var _0xe65cdf=_0x854f[_0x324066];return _0xe65cdf;};'use strict';var multer=require(_0xf854('0x0'));var util=require(_0xf854('0x1'));var path=require(_0xf854('0x2'));var express=require(_0xf854('0x3'));var router=express[_0xf854('0x4')]();var auth=require(_0xf854('0x5'));var controller=require('./rpc.controller');router[_0xf854('0x6')](_0xf854('0x7'),auth[_0xf854('0x8')](),controller[_0xf854('0x9')]);router[_0xf854('0x6')](_0xf854('0xa'),auth[_0xf854('0x8')](),controller[_0xf854('0xb')]);router[_0xf854('0x6')](_0xf854('0xc'),auth[_0xf854('0x8')](),controller[_0xf854('0xd')]);router['get'](_0xf854('0xe'),auth[_0xf854('0x8')](),controller[_0xf854('0xf')]);router[_0xf854('0x6')](_0xf854('0x10'),auth[_0xf854('0x8')](),controller[_0xf854('0x11')]);router[_0xf854('0x6')]('/mail/queues',auth['isAuthenticated'](),controller['mailQueues']);router[_0xf854('0x6')](_0xf854('0x12'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0xf854('0x6')](_0xf854('0x13'),auth[_0xf854('0x8')](),controller[_0xf854('0x14')]);router['get'](_0xf854('0x15'),auth[_0xf854('0x8')](),controller[_0xf854('0x16')]);router[_0xf854('0x6')](_0xf854('0x17'),auth[_0xf854('0x8')](),controller['whatsappQueues']);router[_0xf854('0x6')](_0xf854('0x18'),auth['isAuthenticated'](),controller[_0xf854('0x19')]);router[_0xf854('0x6')]('/voice/queues/preview/:id',auth[_0xf854('0x8')](),controller['voiceQueuesPreview']);router['get']('/voice/queues/channels',auth['isAuthenticated'](),controller[_0xf854('0x1a')]);router[_0xf854('0x6')](_0xf854('0x1b'),auth[_0xf854('0x8')](),controller[_0xf854('0x1c')]);router[_0xf854('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xf854('0x8')](),controller[_0xf854('0x1d')]);router[_0xf854('0x6')](_0xf854('0x1e'),auth[_0xf854('0x8')](),controller['voiceQueuesChannelRedirect']);router[_0xf854('0x6')](_0xf854('0x1f'),auth[_0xf854('0x8')](),controller[_0xf854('0x20')]);router[_0xf854('0x21')](_0xf854('0x1f'),auth['isAuthenticated'](),controller[_0xf854('0x22')]);router[_0xf854('0x6')](_0xf854('0x23'),auth[_0xf854('0x8')](),controller[_0xf854('0x24')]);router[_0xf854('0x6')](_0xf854('0x25'),auth[_0xf854('0x8')](),controller[_0xf854('0x26')]);router[_0xf854('0x6')](_0xf854('0x27'),auth[_0xf854('0x8')](),controller[_0xf854('0x28')]);router['put'](_0xf854('0x29'),auth[_0xf854('0x8')](),controller[_0xf854('0x2a')]);router[_0xf854('0x6')]('/telephones',auth[_0xf854('0x8')](),controller[_0xf854('0x2b')]);router['get'](_0xf854('0x2c'),auth[_0xf854('0x8')](),controller['trunks']);router['get'](_0xf854('0x2d'),auth[_0xf854('0x8')](),controller[_0xf854('0x2e')]);router[_0xf854('0x6')](_0xf854('0x2f'),auth[_0xf854('0x8')](),controller['faxAccounts']);router['get']('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0xf854('0x6')](_0xf854('0x30'),auth[_0xf854('0x8')](),controller[_0xf854('0x31')]);router['get'](_0xf854('0x32'),auth[_0xf854('0x8')](),controller[_0xf854('0x33')]);router[_0xf854('0x6')](_0xf854('0x34'),auth[_0xf854('0x8')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xf854('0x6')](_0xf854('0x35'),auth[_0xf854('0x8')](),controller[_0xf854('0x36')]);router[_0xf854('0x6')](_0xf854('0x37'),auth[_0xf854('0x8')](),controller[_0xf854('0x38')]);router['get'](_0xf854('0x39'),auth[_0xf854('0x8')](),controller[_0xf854('0x3a')]);router[_0xf854('0x3b')](_0xf854('0x3c'),auth[_0xf854('0x8')](),controller[_0xf854('0x3d')](_0xf854('0x3e')));router['get'](_0xf854('0x3f'),auth[_0xf854('0x8')](),controller[_0xf854('0x40')]);router[_0xf854('0x3b')](_0xf854('0x41'),auth[_0xf854('0x8')](),controller['queueNotify']('chat'));router[_0xf854('0x6')]('/chat/queues/:id',auth[_0xf854('0x8')](),controller[_0xf854('0x42')]);router['post'](_0xf854('0x43'),auth[_0xf854('0x8')](),controller[_0xf854('0x3d')](_0xf854('0x44')));router['get']('/fax/queues/:id',auth[_0xf854('0x8')](),controller[_0xf854('0x45')]);router[_0xf854('0x3b')]('/openchannel/queues/:id/notify',auth[_0xf854('0x8')](),controller[_0xf854('0x3d')]('openchannel'));router['get'](_0xf854('0x46'),auth[_0xf854('0x8')](),controller['showOpenchannelQueues']);router[_0xf854('0x3b')](_0xf854('0x47'),auth['isAuthenticated'](),controller['queueNotify'](_0xf854('0x48')));router[_0xf854('0x3b')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0xf854('0x3d')]('whatsapp'));router[_0xf854('0x6')]('/sms/queues/:id',auth[_0xf854('0x8')](),controller[_0xf854('0x49')]);router['get']('/whatsapp/queues/:id',auth[_0xf854('0x8')](),controller[_0xf854('0x4a')]);router[_0xf854('0x3b')]('/agents/:id/notify',auth[_0xf854('0x8')](),controller[_0xf854('0x4b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index e7a0e1a..d14e3da 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 _0x46ed=['send','isNil','rows','VoiceChannels','query','then','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','MemberReport','findOrCreate','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','\x20Message\x20not\x20found','bluebird','moment','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','error','code','message','result','status','name'];(function(_0x426801,_0x71d9ce){var _0x17bd75=function(_0xe6292f){while(--_0xe6292f){_0x426801['push'](_0x426801['shift']());}};_0x17bd75(++_0x71d9ce);}(_0x46ed,0x168));var _0xd46e=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x46ed[_0x36ed48];return _0x51c63a;};'use strict';var BPromise=require(_0xd46e('0x0'));var moment=require(_0xd46e('0x1'));var _=require('lodash');var util=require(_0xd46e('0x2'));var db=require(_0xd46e('0x3'))['db'];var logger=require(_0xd46e('0x4'))('api');var jayson=require(_0xd46e('0x5'));var amiClient=jayson[_0xd46e('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0xd46e('0x6')][_0xd46e('0x7')]({'port':0x232b});var routingClient=jayson[_0xd46e('0x6')][_0xd46e('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x45e680,_0x855f24,_0x437ea0){return new BPromise(function(_0x144687,_0x31259b){var _0x19e4f4=_0x437ea0?_0x437ea0:amiClient;return _0x19e4f4[_0xd46e('0x8')](_0x45e680,_0x855f24)['then'](function(_0x7b2d69){if(_0x7b2d69[_0xd46e('0x9')]){if(_0x7b2d69['error'][_0xd46e('0xa')]===0x1f4){return _0x31259b(_0x7b2d69[_0xd46e('0x9')][_0xd46e('0xb')]);}return _0x144687(_0x7b2d69[_0xd46e('0x9')][_0xd46e('0xb')]);}else{_0x144687(_0x7b2d69[_0xd46e('0xc')]);}})['catch'](function(_0x24c54b){_0x31259b(_0x24c54b);});});}function respondWithResult(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xc8;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0xd')](_0x48550b)['json'](_0xf3048c);}return _0x5bc1da['sendStatus'](0x194);};}function handleError(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0x1f4;return function(_0x1e9aae){logger[_0xd46e('0x9')](_0x1e9aae['stack']);if(_0x1e9aae[_0xd46e('0xe')]){delete _0x1e9aae[_0xd46e('0xe')];}_0xacd799[_0xd46e('0xd')](_0x4688ae)[_0xd46e('0xf')](_0x1e9aae);};}function findById(_0x36a317){return function(_0x47fa8f){if(!_[_0xd46e('0x10')](_0x36a317)&&!_[_0xd46e('0x10')](_0x47fa8f)&&!_[_0xd46e('0x10')](_0x47fa8f['rows'])){return _['find'](_0x47fa8f[_0xd46e('0x11')],function(_0x1bd574){return _0x1bd574['id']==_0x36a317;});}return null;};}exports['voiceChannels']=function(_0x4fd1f2,_0x2d6f2c){return respondWithRpcPromise(_0xd46e('0x12'),_0x4fd1f2[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x2d6f2c,null))[_0xd46e('0x15')](handleError(_0x2d6f2c,null));};exports[_0xd46e('0x16')]=function(_0x3b5fa4,_0x327b7e){return respondWithRpcPromise(_0xd46e('0x17'),_[_0xd46e('0x18')](_0x3b5fa4[_0xd46e('0x13')],_0x3b5fa4['params']))[_0xd46e('0x14')](respondWithResult(_0x327b7e,null))[_0xd46e('0x15')](handleError(_0x327b7e,null));};exports[_0xd46e('0x19')]=function(_0x45ce0b,_0x128246){return respondWithRpcPromise(_0xd46e('0x1a'),_[_0xd46e('0x18')](_0x45ce0b[_0xd46e('0x13')],_0x45ce0b[_0xd46e('0x1b')]))['then'](respondWithResult(_0x128246,null))[_0xd46e('0x15')](handleError(_0x128246,null));};exports['voiceQueues']=function(_0x4b8f6a,_0x371054){return respondWithRpcPromise(_0xd46e('0x1c'),_0x4b8f6a[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x371054,null))[_0xd46e('0x15')](handleError(_0x371054,null));};exports[_0xd46e('0x1d')]=function(_0x1740d1,_0x4dab6a){return respondWithRpcPromise(_0xd46e('0x1c'),_0x1740d1[_0xd46e('0x13')])[_0xd46e('0x14')](findById(_0x1740d1[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x4dab6a,null))[_0xd46e('0x15')](handleError(_0x4dab6a,null));};exports['updateVoiceQueue']=function(_0x465d54,_0x3a1ced){return respondWithRpcPromise(_0xd46e('0x1e'),_[_0xd46e('0x18')](_0x465d54[_0xd46e('0x1f')],_0x465d54[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x3a1ced,null))[_0xd46e('0x15')](handleError(_0x3a1ced,null));};exports[_0xd46e('0x20')]=function(_0x45ea47,_0x2ff785){return respondWithRpcPromise(_0xd46e('0x21'),_[_0xd46e('0x18')](_0x45ea47['query'],_0x45ea47[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x2ff785,null))[_0xd46e('0x15')](handleError(_0x2ff785,null));};exports[_0xd46e('0x22')]=function(_0x5ef248,_0x2eed3a){return respondWithRpcPromise(_0xd46e('0x23'),_0x5ef248['query'])[_0xd46e('0x14')](respondWithResult(_0x2eed3a,null))[_0xd46e('0x15')](handleError(_0x2eed3a,null));};exports['voiceQueuesChannel']=function(_0x306458,_0x1c15c9){return respondWithRpcPromise(_0xd46e('0x24'),_['merge'](_0x306458['query'],_0x306458[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x1c15c9,null))[_0xd46e('0x15')](handleError(_0x1c15c9,null));};exports[_0xd46e('0x25')]=function(_0x83526a,_0x423de9){return respondWithRpcPromise(_0xd46e('0x26'),_[_0xd46e('0x18')](_0x83526a['query'],_0x83526a[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x423de9,null))[_0xd46e('0x15')](handleError(_0x423de9,null));};exports[_0xd46e('0x27')]=function(_0x1fa66c,_0x1e0897){return respondWithRpcPromise(_0xd46e('0x28'),_['merge'](_0x1fa66c[_0xd46e('0x13')],_0x1fa66c[_0xd46e('0x1b')]))['then'](respondWithResult(_0x1e0897,null))[_0xd46e('0x15')](handleError(_0x1e0897,null));};exports[_0xd46e('0x29')]=function(_0x12ccf8,_0x3b6e67){return respondWithRpcPromise('Outbound',_0x12ccf8[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x3b6e67,null))[_0xd46e('0x15')](handleError(_0x3b6e67,null));};exports[_0xd46e('0x2a')]=function(_0xefe5f4,_0x1f58ad){return respondWithRpcPromise(_0xd46e('0x2b'),_0xefe5f4[_0xd46e('0x13')])['then'](respondWithResult(_0x1f58ad,null))[_0xd46e('0x15')](handleError(_0x1f58ad,null));};exports[_0xd46e('0x2c')]=function(_0xc83ea1,_0x25657a){var _0x165ce8;return respondWithRpcPromise('Agents',_0xc83ea1[_0xd46e('0x13')])['then'](function(_0x55230d){_0x165ce8=_0x55230d;return respondWithRpcPromise('Agents',_0xc83ea1['query'],routingClient);})[_0xd46e('0x14')](function(_0x54949f){return _[_0xd46e('0x18')]({},_0x54949f,_0x165ce8);})[_0xd46e('0x14')](respondWithResult(_0x25657a,null))['catch'](handleError(_0x25657a,null));};exports[_0xd46e('0x2d')]=function(_0x4114e6,_0x3bd5e9){if(_0x4114e6[_0xd46e('0x1f')]&&_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')]&&_0x4114e6[_0xd46e('0x2f')]&&_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')]){for(var _0xec367d in _0x4114e6[_0xd46e('0x1f')]['interaction']){if(_0x4114e6['body']['interaction'][_0xd46e('0x30')](_0xec367d)){db['MemberReport'][_0xd46e('0x31')]({'where':{'channel':_0xec367d,'membername':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')],'type':_0xd46e('0x32'),'exitAt':null,'uniqueid':_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')][_0xec367d]&&_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')][_0xec367d]['length']?{'$notIn':_0x4114e6[_0xd46e('0x1f')]['interaction'][_0xec367d]}:{'$ne':null}}})[_0xd46e('0x14')](function(_0x196e51){var _0x41a983=moment()[_0xd46e('0x33')](_0xd46e('0x34'));for(var _0x5d65ca=0x0,_0x384b6e=_0x196e51[_0xd46e('0x35')];_0x5d65ca<_0x384b6e;_0x5d65ca+=0x1){_0x196e51[_0x5d65ca][_0xd46e('0x36')]({'exitAt':_0x41a983});}});for(var _0xac268d=0x0;_0xac268d<_0x4114e6[_0xd46e('0x1f')]['interaction'][_0xec367d][_0xd46e('0x35')];_0xac268d+=0x1){db[_0xd46e('0x37')][_0xd46e('0x38')]({'where':{'channel':_0xec367d,'membername':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')],'type':'INTERACTION','uniqueid':_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')][_0xec367d][_0xac268d],'exitAt':null},'defaults':{'channel':_0xec367d,'membername':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')],'interface':_[_0xd46e('0x10')](_0x4114e6[_0xd46e('0x2f')][_0xd46e('0x39')])?util[_0xd46e('0x33')]('SIP/%s',_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')]):_0x4114e6[_0xd46e('0x2f')][_0xd46e('0x39')],'type':_0xd46e('0x32'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xd46e('0x3a'),'internal':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0x3b')],'uniqueid':_0x4114e6['body']['interaction'][_0xec367d][_0xac268d]}});}}}}return respondWithRpcPromise(_0xd46e('0x3c'),{'id':_0x4114e6[_0xd46e('0x1b')]['id'],'capacity':_0x4114e6['body'][_0xd46e('0x3d')]},routingClient)[_0xd46e('0x14')](respondWithResult(_0x3bd5e9,null))[_0xd46e('0x15')](handleError(_0x3bd5e9,null));};exports[_0xd46e('0x3e')]=function(_0x1bd8a5,_0x34d4ca){return respondWithRpcPromise(_0xd46e('0x3f'),_0x1bd8a5[_0xd46e('0x13')])['then'](respondWithResult(_0x34d4ca,null))[_0xd46e('0x15')](handleError(_0x34d4ca,null));};exports[_0xd46e('0x40')]=function(_0x1c7f92,_0x63ee74){return respondWithRpcPromise('Trunks',_0x1c7f92['query'])[_0xd46e('0x14')](respondWithResult(_0x63ee74,null))['catch'](handleError(_0x63ee74,null));};exports[_0xd46e('0x41')]=function(_0x2af20b,_0x393cb9){return respondWithRpcPromise(_0xd46e('0x42'),_0x2af20b[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x393cb9,null))['catch'](handleError(_0x393cb9,null));};exports[_0xd46e('0x43')]=function(_0x354739,_0x51f45a){return respondWithRpcPromise('ChatQueues',_0x354739[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x51f45a,null))[_0xd46e('0x15')](handleError(_0x51f45a,null));};exports[_0xd46e('0x44')]=function(_0x1886e6,_0x2cc676){return respondWithRpcPromise(_0xd46e('0x45'),_0x1886e6[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x1886e6[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x2cc676,null))[_0xd46e('0x15')](handleError(_0x2cc676,null));};exports[_0xd46e('0x46')]=function(_0x402df2,_0x47a86c){return respondWithRpcPromise(_0xd46e('0x47'),_0x402df2[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x47a86c,null))[_0xd46e('0x15')](handleError(_0x47a86c,null));};exports['showMailQueues']=function(_0x636f15,_0x36e18a){return respondWithRpcPromise(_0xd46e('0x47'),_0x636f15[_0xd46e('0x13')],routingClient)['then'](findById(_0x636f15[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x36e18a,null))['catch'](handleError(_0x36e18a,null));};exports['mailAccounts']=function(_0x45e102,_0xd59920){return respondWithRpcPromise(_0xd46e('0x48'),_0x45e102['query'],mailClient)['then'](respondWithResult(_0xd59920,null))[_0xd46e('0x15')](handleError(_0xd59920,null));};exports[_0xd46e('0x49')]=function(_0x1f310d,_0x263425){return respondWithRpcPromise(_0xd46e('0x4a'),_0x1f310d[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x263425,null))[_0xd46e('0x15')](handleError(_0x263425,null));};exports[_0xd46e('0x4b')]=function(_0x2a172c,_0x4af44){return respondWithRpcPromise(_0xd46e('0x4a'),_0x2a172c[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x2a172c[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x4af44,null))['catch'](handleError(_0x4af44,null));};exports[_0xd46e('0x4c')]=function(_0x1a3771,_0x3a2dec){return respondWithRpcPromise('SmsQueues',_0x1a3771[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x3a2dec,null))['catch'](handleError(_0x3a2dec,null));};exports[_0xd46e('0x4d')]=function(_0x2c86fe,_0x1801d4){return respondWithRpcPromise('SmsQueues',_0x2c86fe[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x2c86fe[_0xd46e('0x1b')]['id']))['then'](respondWithResult(_0x1801d4,null))[_0xd46e('0x15')](handleError(_0x1801d4,null));};exports['whatsappQueues']=function(_0x32eed0,_0x148187){return respondWithRpcPromise(_0xd46e('0x4e'),_0x32eed0['query'],routingClient)[_0xd46e('0x14')](respondWithResult(_0x148187,null))[_0xd46e('0x15')](handleError(_0x148187,null));};exports[_0xd46e('0x4f')]=function(_0xbce76f,_0x502f37){return respondWithRpcPromise(_0xd46e('0x4e'),_0xbce76f[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0xbce76f[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x502f37,null))[_0xd46e('0x15')](handleError(_0x502f37,null));};exports[_0xd46e('0x50')]=function(_0x41057c,_0x24be84){return respondWithRpcPromise('FaxQueues',_0x41057c['query'],routingClient)[_0xd46e('0x14')](respondWithResult(_0x24be84,null))[_0xd46e('0x15')](handleError(_0x24be84,null));};exports[_0xd46e('0x51')]=function(_0x2fff69,_0x249938){return respondWithRpcPromise('FaxQueues',_0x2fff69[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x2fff69[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x249938,null))['catch'](handleError(_0x249938,null));};exports[_0xd46e('0x52')]=function(_0x9dd439,_0x5a36df){return respondWithRpcPromise(_0xd46e('0x53'),_0x9dd439[_0xd46e('0x13')])['then'](respondWithResult(_0x5a36df,null))[_0xd46e('0x15')](handleError(_0x5a36df,null));};exports[_0xd46e('0x54')]=function(_0x566e65,_0x44ba36){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x566e65[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x44ba36,null))['catch'](handleError(_0x44ba36,null));};exports['mailQueuesWaitingInteractions']=function(_0x475133,_0x3eb6b){return respondWithRpcPromise(_0xd46e('0x55'),_0x475133[_0xd46e('0x13')],routingClient)['then'](respondWithResult(_0x3eb6b,null))[_0xd46e('0x15')](handleError(_0x3eb6b,null));};exports[_0xd46e('0x56')]=function(_0x510a1e,_0x10bcdb){return respondWithRpcPromise(_0xd46e('0x57'),_0x510a1e[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x10bcdb,null))[_0xd46e('0x15')](handleError(_0x10bcdb,null));};exports[_0xd46e('0x58')]=function(_0x21f193,_0xaf7c79){return respondWithRpcPromise(_0xd46e('0x57'),_0x21f193['query'],routingClient)[_0xd46e('0x14')](function(_0x1c1bae){if(_0x21f193['query'][_0xd46e('0x59')]!==undefined){var _0x3ba83f=_(_0x1c1bae[_0xd46e('0x11')])[_0xd46e('0x5a')]([_0x21f193[_0xd46e('0x13')][_0xd46e('0x59')],_0x21f193['params']['id']])['map'](_0xd46e('0x5b'))[_0xd46e('0x5c')]()['value']();return _0x1c1bae['rows']['filter'](function(_0x825746){return _0x3ba83f[_0xd46e('0x5d')](_0x825746[_0xd46e('0x5b')])>-0x1;});}else{return _0x1c1bae['rows'][_0xd46e('0x5a')](function(_0x69ade9){return _0x69ade9[_0xd46e('0x5b')]===parseInt(_0x21f193['params']['id']);});}})['then'](respondWithResult(_0xaf7c79,null))['catch'](handleError(_0xaf7c79,null));};exports['smsQueuesWaitingInteractions']=function(_0x2d4410,_0x5d7c51){return respondWithRpcPromise(_0xd46e('0x5e'),_0x2d4410['query'],routingClient)['then'](respondWithResult(_0x5d7c51,null))[_0xd46e('0x15')](handleError(_0x5d7c51,null));};exports[_0xd46e('0x5f')]=function(_0x3df2c2,_0x2754ff){return respondWithRpcPromise(_0xd46e('0x60'),_0x3df2c2[_0xd46e('0x13')],routingClient)['then'](respondWithResult(_0x2754ff,null))['catch'](handleError(_0x2754ff,null));};exports[_0xd46e('0x61')]=function(_0x383919,_0x114f2c){return respondWithRpcPromise(_0xd46e('0x62'),_0x383919['query'],routingClient)[_0xd46e('0x14')](respondWithResult(_0x114f2c,null))[_0xd46e('0x15')](handleError(_0x114f2c,null));};exports['queueNotify']=function(_0x1309b5){return function(_0x483ef1,_0x2abaee){var _0x24a2e1,_0x5b54b6;var _0x59fb83=_[_0xd46e('0x63')](_0x1309b5);var _0x2c11b8=_0x1309b5===_0xd46e('0x64')?'Website':_0xd46e('0x65');return db[_0x59fb83+_0xd46e('0x66')][_0xd46e('0x67')]({'raw':!![],'where':{'id':_0x483ef1[_0xd46e('0x1b')]['id']}})[_0xd46e('0x14')](function(_0x88460a){if(_[_0xd46e('0x10')](_0x88460a)){throw new Error(_0x59fb83+_0xd46e('0x68'));}_0x24a2e1=_0x88460a;return db[_0x59fb83+_0xd46e('0x69')][_0xd46e('0x67')]({'where':{'id':_0x483ef1[_0xd46e('0x1f')][_0xd46e('0x6a')]},'include':[{'model':db[_0x59fb83+_0xd46e('0x6b')],'as':_0xd46e('0x6b')},{'model':db[_0x59fb83+_0x2c11b8],'as':_0xd46e('0x65')}]});})[_0xd46e('0x14')](function(_0x441f73){if(_[_0xd46e('0x10')](_0x441f73)){throw new Error(_0x59fb83+'\x20Message\x20not\x20found');}_0x5b54b6=_0x441f73;return _0x441f73[_0xd46e('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3436ff={'uniqueid':_0x1309b5+'.'+_0x5b54b6['id']+'.'+_0x5b54b6[_0xd46e('0x6b')]['id'],'FromUserId':_0x483ef1['user']['id'],'type':_0xd46e('0x6d')};_0x3436ff[_0x59fb83+_0xd46e('0x6e')]=_0x5b54b6['id'];_0x3436ff[_0x59fb83+_0xd46e('0x6f')]=_0x5b54b6[_0xd46e('0x6b')]['id'];_0x3436ff[_0xd46e('0x70')+_0x59fb83+_0x2c11b8+'Id']=_0x5b54b6[_0xd46e('0x65')]['id'];_0x3436ff['To'+_0x59fb83+_0xd46e('0x71')]=_0x24a2e1['id'];return db[_0x59fb83+_0xd46e('0x72')][_0xd46e('0x73')](_0x3436ff);})[_0xd46e('0x14')](function(){return respondWithRpcPromise(_0xd46e('0x74'),{'channel':_0x1309b5,'interaction':_0x5b54b6['Interaction'],'message':_0x5b54b6,'account':_0x5b54b6['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xd46e('0x6d'),'appdata':_0x24a2e1[_0xd46e('0xe')]+','+(_0x5b54b6[_0xd46e('0x65')][_0xd46e('0x75')]||0x12c),'interval':_0xd46e('0x76')}]},routingClient);})[_0xd46e('0x14')](respondWithResult(_0x2abaee,null))['catch'](handleError(_0x2abaee,null));};};exports[_0xd46e('0x77')]=function(_0x127604,_0xa254f5){var _0x2c9703,_0x41443d;if(_[_0xd46e('0x10')](_0x127604['body'][_0xd46e('0x78')])){throw new Error(_0xd46e('0x79'));}var _0x59067a=_0x127604[_0xd46e('0x1f')][_0xd46e('0x78')];var _0x9e222d=_[_0xd46e('0x63')](_0x59067a);var _0x97ee80=_0x59067a===_0xd46e('0x64')?_0xd46e('0x7a'):_0xd46e('0x65');return db[_0xd46e('0x7b')][_0xd46e('0x67')]({'raw':!![],'where':{'id':_0x127604[_0xd46e('0x1b')]['id'],'role':_0xd46e('0x3a')}})[_0xd46e('0x14')](function(_0x30dcfc){if(_['isNil'](_0x30dcfc)){throw new Error('Agent\x20not\x20found');}_0x2c9703=_0x30dcfc;return db[_0x9e222d+_0xd46e('0x69')][_0xd46e('0x67')]({'where':{'id':_0x127604[_0xd46e('0x1f')][_0xd46e('0x6a')]},'include':[{'model':db[_0x9e222d+_0xd46e('0x6b')],'as':_0xd46e('0x6b')},{'model':db[_0x9e222d+_0x97ee80],'as':'Account'}]});})[_0xd46e('0x14')](function(_0x216143){if(_[_0xd46e('0x10')](_0x216143)){throw new Error(_0x9e222d+_0xd46e('0x7c'));}_0x41443d=_0x216143;return _0x216143['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xd46e('0x14')](function(){var _0x191b48={'uniqueid':_0x59067a+'.'+_0x41443d['id']+'.'+_0x41443d['Interaction']['id'],'FromUserId':_0x127604[_0xd46e('0x2f')]['id'],'type':'queue','ToUserId':_0x2c9703['id']};_0x191b48[_0x9e222d+'MessageId']=_0x41443d['id'];_0x191b48[_0x9e222d+_0xd46e('0x6f')]=_0x41443d[_0xd46e('0x6b')]['id'];_0x191b48[_0xd46e('0x70')+_0x9e222d+_0x97ee80+'Id']=_0x41443d[_0xd46e('0x65')]['id'];return db[_0x9e222d+'TransferReport']['create'](_0x191b48);})[_0xd46e('0x14')](function(){return respondWithRpcPromise('Start',{'channel':_0x59067a,'interaction':_0x41443d[_0xd46e('0x6b')],'message':_0x41443d,'account':_0x41443d['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x2c9703[_0xd46e('0xe')]+','+(_0x41443d[_0xd46e('0x65')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xd46e('0x14')](respondWithResult(_0xa254f5,null))[_0xd46e('0x15')](handleError(_0xa254f5,null));}; \ No newline at end of file +var _0x2675=['request','error','result','catch','status','json','sendStatus','name','send','isNil','rows','find','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','then','voiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','updateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','merge','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format','MemberReport','findOrCreate','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','telephones','Telephones','trunks','Trunks','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','type','map','queue_id','indexOf','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Agent\x20not\x20found','Message','findOne','agentTransferTimeout','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0xe59cff,_0x1a7dbe){var _0x26e8c1=function(_0x6a95cc){while(--_0x6a95cc){_0xe59cff['push'](_0xe59cff['shift']());}};_0x26e8c1(++_0x1a7dbe);}(_0x2675,0x75));var _0x5267=function(_0x3e1621,_0x30cd13){_0x3e1621=_0x3e1621-0x0;var _0x5b0033=_0x2675[_0x3e1621];return _0x5b0033;};'use strict';var BPromise=require(_0x5267('0x0'));var moment=require('moment');var _=require('lodash');var util=require('util');var db=require(_0x5267('0x1'))['db'];var logger=require(_0x5267('0x2'))('api');var jayson=require(_0x5267('0x3'));var amiClient=jayson[_0x5267('0x4')]['http']({'port':0x232a});var mailClient=jayson[_0x5267('0x4')][_0x5267('0x5')]({'port':0x232b});var routingClient=jayson[_0x5267('0x4')][_0x5267('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){var _0x506fd7=_0x527c16?_0x527c16:amiClient;return _0x506fd7[_0x5267('0x6')](_0x20f065,_0xc56cd5)['then'](function(_0x3ff4e9){if(_0x3ff4e9[_0x5267('0x7')]){if(_0x3ff4e9[_0x5267('0x7')]['code']===0x1f4){return _0x46bfdf(_0x3ff4e9[_0x5267('0x7')]['message']);}return _0x9e0a27(_0x3ff4e9[_0x5267('0x7')]['message']);}else{_0x9e0a27(_0x3ff4e9[_0x5267('0x8')]);}})[_0x5267('0x9')](function(_0x268a8a){_0x46bfdf(_0x268a8a);});});}function respondWithResult(_0x1f9be3,_0x1d7090){_0x1d7090=_0x1d7090||0xc8;return function(_0x1171b9){if(_0x1171b9){return _0x1f9be3[_0x5267('0xa')](_0x1d7090)[_0x5267('0xb')](_0x1171b9);}return _0x1f9be3[_0x5267('0xc')](0x194);};}function handleError(_0x1e2d3b,_0x16e5a7){_0x16e5a7=_0x16e5a7||0x1f4;return function(_0x29349a){logger[_0x5267('0x7')](_0x29349a['stack']);if(_0x29349a['name']){delete _0x29349a[_0x5267('0xd')];}_0x1e2d3b[_0x5267('0xa')](_0x16e5a7)[_0x5267('0xe')](_0x29349a);};}function findById(_0x3f5344){return function(_0x46b2c2){if(!_[_0x5267('0xf')](_0x3f5344)&&!_[_0x5267('0xf')](_0x46b2c2)&&!_[_0x5267('0xf')](_0x46b2c2[_0x5267('0x10')])){return _[_0x5267('0x11')](_0x46b2c2[_0x5267('0x10')],function(_0x1ab03){return _0x1ab03['id']==_0x3f5344;});}return null;};}exports['voiceChannels']=function(_0x18f32e,_0x2afd38){return respondWithRpcPromise('VoiceChannels',_0x18f32e[_0x5267('0x12')])['then'](respondWithResult(_0x2afd38,null))[_0x5267('0x9')](handleError(_0x2afd38,null));};exports[_0x5267('0x13')]=function(_0x39c0c3,_0x2a9f99){return respondWithRpcPromise(_0x5267('0x14'),_['merge'](_0x39c0c3[_0x5267('0x12')],_0x39c0c3['params']))[_0x5267('0x15')](respondWithResult(_0x2a9f99,null))[_0x5267('0x9')](handleError(_0x2a9f99,null));};exports[_0x5267('0x16')]=function(_0x56dd95,_0x499f19){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x56dd95['query'],_0x56dd95[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x499f19,null))[_0x5267('0x9')](handleError(_0x499f19,null));};exports[_0x5267('0x18')]=function(_0x11c8ea,_0x40d1be){return respondWithRpcPromise(_0x5267('0x19'),_0x11c8ea[_0x5267('0x12')])[_0x5267('0x15')](respondWithResult(_0x40d1be,null))['catch'](handleError(_0x40d1be,null));};exports['showVoiceQueues']=function(_0x354111,_0x472938){return respondWithRpcPromise('VoiceQueues',_0x354111[_0x5267('0x12')])['then'](findById(_0x354111['params']['id']))[_0x5267('0x15')](respondWithResult(_0x472938,null))[_0x5267('0x9')](handleError(_0x472938,null));};exports[_0x5267('0x1a')]=function(_0x2d2ace,_0x33c431){return respondWithRpcPromise('UpdateVoiceQueue',_['merge'](_0x2d2ace[_0x5267('0x1b')],_0x2d2ace[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x33c431,null))['catch'](handleError(_0x33c431,null));};exports['voiceQueuesPreview']=function(_0xbe7922,_0x3ef2a8){return respondWithRpcPromise(_0x5267('0x1c'),_['merge'](_0xbe7922['query'],_0xbe7922[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x3ef2a8,null))[_0x5267('0x9')](handleError(_0x3ef2a8,null));};exports[_0x5267('0x1d')]=function(_0x5bbb83,_0x33e456){return respondWithRpcPromise(_0x5267('0x1e'),_0x5bbb83[_0x5267('0x12')])[_0x5267('0x15')](respondWithResult(_0x33e456,null))[_0x5267('0x9')](handleError(_0x33e456,null));};exports[_0x5267('0x1f')]=function(_0x341bae,_0x1dda95){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x341bae[_0x5267('0x12')],_0x341bae['params']))[_0x5267('0x15')](respondWithResult(_0x1dda95,null))[_0x5267('0x9')](handleError(_0x1dda95,null));};exports[_0x5267('0x20')]=function(_0x3a729c,_0x4ac4a0){return respondWithRpcPromise(_0x5267('0x21'),_[_0x5267('0x22')](_0x3a729c[_0x5267('0x12')],_0x3a729c[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x4ac4a0,null))[_0x5267('0x9')](handleError(_0x4ac4a0,null));};exports[_0x5267('0x23')]=function(_0xa0ea89,_0x484b77){return respondWithRpcPromise(_0x5267('0x24'),_['merge'](_0xa0ea89[_0x5267('0x12')],_0xa0ea89[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x484b77,null))[_0x5267('0x9')](handleError(_0x484b77,null));};exports[_0x5267('0x25')]=function(_0x33ecd7,_0x465ad9){return respondWithRpcPromise('Outbound',_0x33ecd7[_0x5267('0x12')])[_0x5267('0x15')](respondWithResult(_0x465ad9,null))[_0x5267('0x9')](handleError(_0x465ad9,null));};exports[_0x5267('0x26')]=function(_0x82cea7,_0x21eabf){return respondWithRpcPromise(_0x5267('0x27'),_0x82cea7['query'])[_0x5267('0x15')](respondWithResult(_0x21eabf,null))['catch'](handleError(_0x21eabf,null));};exports[_0x5267('0x28')]=function(_0x5c0cdf,_0x4dee66){var _0x51bddd;return respondWithRpcPromise(_0x5267('0x29'),_0x5c0cdf['query'])[_0x5267('0x15')](function(_0x146476){_0x51bddd=_0x146476;return respondWithRpcPromise(_0x5267('0x29'),_0x5c0cdf[_0x5267('0x12')],routingClient);})['then'](function(_0x456b33){return _[_0x5267('0x22')]({},_0x456b33,_0x51bddd);})['then'](respondWithResult(_0x4dee66,null))['catch'](handleError(_0x4dee66,null));};exports[_0x5267('0x2a')]=function(_0x560cdf,_0x12df83){if(_0x560cdf[_0x5267('0x1b')]&&_0x560cdf[_0x5267('0x1b')][_0x5267('0x2b')]&&_0x560cdf[_0x5267('0x2c')]&&_0x560cdf[_0x5267('0x2c')][_0x5267('0xd')]){for(var _0x5697b3 in _0x560cdf['body'][_0x5267('0x2b')]){if(_0x560cdf['body'][_0x5267('0x2b')][_0x5267('0x2d')](_0x5697b3)){db['MemberReport'][_0x5267('0x2e')]({'where':{'channel':_0x5697b3,'membername':_0x560cdf[_0x5267('0x2c')][_0x5267('0xd')],'type':_0x5267('0x2f'),'exitAt':null,'uniqueid':_0x560cdf[_0x5267('0x1b')][_0x5267('0x2b')][_0x5697b3]&&_0x560cdf[_0x5267('0x1b')][_0x5267('0x2b')][_0x5697b3][_0x5267('0x30')]?{'$notIn':_0x560cdf['body'][_0x5267('0x2b')][_0x5697b3]}:{'$ne':null}}})[_0x5267('0x15')](function(_0x19b015){var _0x45241a=moment()[_0x5267('0x31')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3d15ac=0x0,_0x4e0132=_0x19b015[_0x5267('0x30')];_0x3d15ac<_0x4e0132;_0x3d15ac+=0x1){_0x19b015[_0x3d15ac]['updateAttributes']({'exitAt':_0x45241a});}});for(var _0x4ae9f9=0x0;_0x4ae9f9<_0x560cdf[_0x5267('0x1b')]['interaction'][_0x5697b3][_0x5267('0x30')];_0x4ae9f9+=0x1){db[_0x5267('0x32')][_0x5267('0x33')]({'where':{'channel':_0x5697b3,'membername':_0x560cdf[_0x5267('0x2c')]['name'],'type':_0x5267('0x2f'),'uniqueid':_0x560cdf['body']['interaction'][_0x5697b3][_0x4ae9f9],'exitAt':null},'defaults':{'channel':_0x5697b3,'membername':_0x560cdf[_0x5267('0x2c')][_0x5267('0xd')],'interface':_['isNil'](_0x560cdf['user'][_0x5267('0x34')])?util[_0x5267('0x31')](_0x5267('0x35'),_0x560cdf[_0x5267('0x2c')][_0x5267('0xd')]):_0x560cdf[_0x5267('0x2c')][_0x5267('0x34')],'type':_0x5267('0x2f'),'enterAt':moment()[_0x5267('0x31')](_0x5267('0x36')),'role':_0x5267('0x37'),'internal':_0x560cdf[_0x5267('0x2c')][_0x5267('0x38')],'uniqueid':_0x560cdf[_0x5267('0x1b')]['interaction'][_0x5697b3][_0x4ae9f9]}});}}}}return respondWithRpcPromise(_0x5267('0x39'),{'id':_0x560cdf[_0x5267('0x17')]['id'],'capacity':_0x560cdf[_0x5267('0x1b')]['capacity']},routingClient)[_0x5267('0x15')](respondWithResult(_0x12df83,null))[_0x5267('0x9')](handleError(_0x12df83,null));};exports[_0x5267('0x3a')]=function(_0x2a97f1,_0x119546){return respondWithRpcPromise(_0x5267('0x3b'),_0x2a97f1['query'])[_0x5267('0x15')](respondWithResult(_0x119546,null))['catch'](handleError(_0x119546,null));};exports[_0x5267('0x3c')]=function(_0x30fcd2,_0xa49fd7){return respondWithRpcPromise(_0x5267('0x3d'),_0x30fcd2[_0x5267('0x12')])[_0x5267('0x15')](respondWithResult(_0xa49fd7,null))[_0x5267('0x9')](handleError(_0xa49fd7,null));};exports['campaigns']=function(_0x57ca8f,_0x200855){return respondWithRpcPromise(_0x5267('0x3e'),_0x57ca8f['query'])[_0x5267('0x15')](respondWithResult(_0x200855,null))['catch'](handleError(_0x200855,null));};exports['chatQueues']=function(_0x1eeb21,_0x79cee1){return respondWithRpcPromise(_0x5267('0x3f'),_0x1eeb21[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x79cee1,null))[_0x5267('0x9')](handleError(_0x79cee1,null));};exports[_0x5267('0x40')]=function(_0x3fd8f9,_0xf0b5a9){return respondWithRpcPromise(_0x5267('0x3f'),_0x3fd8f9['query'],routingClient)[_0x5267('0x15')](findById(_0x3fd8f9[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0xf0b5a9,null))[_0x5267('0x9')](handleError(_0xf0b5a9,null));};exports[_0x5267('0x41')]=function(_0x34c205,_0x552211){return respondWithRpcPromise(_0x5267('0x42'),_0x34c205['query'],routingClient)[_0x5267('0x15')](respondWithResult(_0x552211,null))[_0x5267('0x9')](handleError(_0x552211,null));};exports[_0x5267('0x43')]=function(_0x4a72c3,_0x1593ce){return respondWithRpcPromise(_0x5267('0x42'),_0x4a72c3[_0x5267('0x12')],routingClient)[_0x5267('0x15')](findById(_0x4a72c3[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0x1593ce,null))['catch'](handleError(_0x1593ce,null));};exports[_0x5267('0x44')]=function(_0x190d02,_0x186667){return respondWithRpcPromise(_0x5267('0x45'),_0x190d02['query'],mailClient)['then'](respondWithResult(_0x186667,null))[_0x5267('0x9')](handleError(_0x186667,null));};exports['openchannelQueues']=function(_0x3f5cda,_0x47059c){return respondWithRpcPromise('OpenchannelQueues',_0x3f5cda['query'],routingClient)[_0x5267('0x15')](respondWithResult(_0x47059c,null))[_0x5267('0x9')](handleError(_0x47059c,null));};exports[_0x5267('0x46')]=function(_0x537f75,_0x457dca){return respondWithRpcPromise(_0x5267('0x47'),_0x537f75[_0x5267('0x12')],routingClient)[_0x5267('0x15')](findById(_0x537f75['params']['id']))['then'](respondWithResult(_0x457dca,null))['catch'](handleError(_0x457dca,null));};exports[_0x5267('0x48')]=function(_0x2457a3,_0x45ee25){return respondWithRpcPromise(_0x5267('0x49'),_0x2457a3[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x45ee25,null))[_0x5267('0x9')](handleError(_0x45ee25,null));};exports[_0x5267('0x4a')]=function(_0x486b02,_0x1ddfad){return respondWithRpcPromise(_0x5267('0x49'),_0x486b02['query'],routingClient)[_0x5267('0x15')](findById(_0x486b02[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0x1ddfad,null))[_0x5267('0x9')](handleError(_0x1ddfad,null));};exports[_0x5267('0x4b')]=function(_0xde1ecd,_0x4915f4){return respondWithRpcPromise(_0x5267('0x4c'),_0xde1ecd[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x4915f4,null))[_0x5267('0x9')](handleError(_0x4915f4,null));};exports[_0x5267('0x4d')]=function(_0xd9bcf9,_0x4aac32){return respondWithRpcPromise(_0x5267('0x4c'),_0xd9bcf9[_0x5267('0x12')],routingClient)[_0x5267('0x15')](findById(_0xd9bcf9[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0x4aac32,null))[_0x5267('0x9')](handleError(_0x4aac32,null));};exports['faxQueues']=function(_0x283423,_0x41299c){return respondWithRpcPromise(_0x5267('0x4e'),_0x283423[_0x5267('0x12')],routingClient)['then'](respondWithResult(_0x41299c,null))['catch'](handleError(_0x41299c,null));};exports['showFaxQueues']=function(_0x910f97,_0x5cca85){return respondWithRpcPromise(_0x5267('0x4e'),_0x910f97['query'],routingClient)[_0x5267('0x15')](findById(_0x910f97[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0x5cca85,null))[_0x5267('0x9')](handleError(_0x5cca85,null));};exports[_0x5267('0x4f')]=function(_0xa92aa5,_0x21338f){return respondWithRpcPromise(_0x5267('0x50'),_0xa92aa5['query'])['then'](respondWithResult(_0x21338f,null))['catch'](handleError(_0x21338f,null));};exports[_0x5267('0x51')]=function(_0x28a101,_0x2ab2be){return respondWithRpcPromise(_0x5267('0x52'),_0x28a101['query'],routingClient)[_0x5267('0x15')](respondWithResult(_0x2ab2be,null))[_0x5267('0x9')](handleError(_0x2ab2be,null));};exports[_0x5267('0x53')]=function(_0xc3ac3f,_0x5a0e73){return respondWithRpcPromise(_0x5267('0x54'),_0xc3ac3f[_0x5267('0x12')],routingClient)['then'](respondWithResult(_0x5a0e73,null))[_0x5267('0x9')](handleError(_0x5a0e73,null));};exports[_0x5267('0x55')]=function(_0x4a9995,_0x47e235){return respondWithRpcPromise(_0x5267('0x56'),_0x4a9995[_0x5267('0x12')],routingClient)['then'](respondWithResult(_0x47e235,null))['catch'](handleError(_0x47e235,null));};exports[_0x5267('0x57')]=function(_0x2e7f8a,_0x35b302){return respondWithRpcPromise(_0x5267('0x56'),_0x2e7f8a[_0x5267('0x12')],routingClient)['then'](function(_0x4643ae){if(_0x2e7f8a[_0x5267('0x12')]['type']!==undefined){var _0x26c628=_(_0x4643ae[_0x5267('0x10')])[_0x5267('0x58')]([_0x2e7f8a[_0x5267('0x12')][_0x5267('0x59')],_0x2e7f8a[_0x5267('0x17')]['id']])[_0x5267('0x5a')](_0x5267('0x5b'))['uniq']()['value']();return _0x4643ae[_0x5267('0x10')][_0x5267('0x58')](function(_0x3f729f){return _0x26c628[_0x5267('0x5c')](_0x3f729f['queue_id'])>-0x1;});}else{return _0x4643ae[_0x5267('0x10')]['filter'](function(_0x2988a1){return _0x2988a1[_0x5267('0x5b')]===parseInt(_0x2e7f8a[_0x5267('0x17')]['id']);});}})[_0x5267('0x15')](respondWithResult(_0x35b302,null))['catch'](handleError(_0x35b302,null));};exports['smsQueuesWaitingInteractions']=function(_0x3a67a0,_0x3e2cf5){return respondWithRpcPromise(_0x5267('0x5d'),_0x3a67a0[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x3e2cf5,null))[_0x5267('0x9')](handleError(_0x3e2cf5,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x1b8d72,_0x4a05c9){return respondWithRpcPromise(_0x5267('0x5e'),_0x1b8d72['query'],routingClient)[_0x5267('0x15')](respondWithResult(_0x4a05c9,null))[_0x5267('0x9')](handleError(_0x4a05c9,null));};exports[_0x5267('0x5f')]=function(_0x87aa90,_0x164cc1){return respondWithRpcPromise(_0x5267('0x60'),_0x87aa90[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x164cc1,null))[_0x5267('0x9')](handleError(_0x164cc1,null));};exports[_0x5267('0x61')]=function(_0x555c8){return function(_0x531bb9,_0x40c7b5){var _0x14baf4,_0x4d9ec9;var _0xde179f=_[_0x5267('0x62')](_0x555c8);var _0x3ebda6=_0x555c8===_0x5267('0x63')?_0x5267('0x64'):_0x5267('0x65');return db[_0xde179f+_0x5267('0x66')]['findOne']({'raw':!![],'where':{'id':_0x531bb9[_0x5267('0x17')]['id']}})[_0x5267('0x15')](function(_0x2543a4){if(_[_0x5267('0xf')](_0x2543a4)){throw new Error(_0xde179f+_0x5267('0x67'));}_0x14baf4=_0x2543a4;return db[_0xde179f+'Message']['findOne']({'where':{'id':_0x531bb9[_0x5267('0x1b')][_0x5267('0x68')]},'include':[{'model':db[_0xde179f+_0x5267('0x69')],'as':_0x5267('0x69')},{'model':db[_0xde179f+_0x3ebda6],'as':'Account'}]});})[_0x5267('0x15')](function(_0x3cc775){if(_[_0x5267('0xf')](_0x3cc775)){throw new Error(_0xde179f+_0x5267('0x6a'));}_0x4d9ec9=_0x3cc775;return _0x3cc775[_0x5267('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})[_0x5267('0x15')](function(){var _0x2b38f2={'uniqueid':_0x555c8+'.'+_0x4d9ec9['id']+'.'+_0x4d9ec9[_0x5267('0x69')]['id'],'FromUserId':_0x531bb9[_0x5267('0x2c')]['id'],'type':_0x5267('0x6c')};_0x2b38f2[_0xde179f+_0x5267('0x6d')]=_0x4d9ec9['id'];_0x2b38f2[_0xde179f+_0x5267('0x6e')]=_0x4d9ec9[_0x5267('0x69')]['id'];_0x2b38f2['From'+_0xde179f+_0x3ebda6+'Id']=_0x4d9ec9[_0x5267('0x65')]['id'];_0x2b38f2['To'+_0xde179f+_0x5267('0x6f')]=_0x14baf4['id'];return db[_0xde179f+_0x5267('0x70')][_0x5267('0x71')](_0x2b38f2);})[_0x5267('0x15')](function(){return respondWithRpcPromise(_0x5267('0x72'),{'channel':_0x555c8,'interaction':_0x4d9ec9[_0x5267('0x69')],'message':_0x4d9ec9,'account':_0x4d9ec9[_0x5267('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5267('0x6c'),'appdata':_0x14baf4[_0x5267('0xd')]+','+(_0x4d9ec9[_0x5267('0x65')][_0x5267('0x73')]||0x12c),'interval':_0x5267('0x74')}]},routingClient);})[_0x5267('0x15')](respondWithResult(_0x40c7b5,null))[_0x5267('0x9')](handleError(_0x40c7b5,null));};};exports[_0x5267('0x75')]=function(_0x28884b,_0x35a4a3){var _0x7ecf0e,_0x676556;if(_[_0x5267('0xf')](_0x28884b[_0x5267('0x1b')][_0x5267('0x76')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x339f3f=_0x28884b[_0x5267('0x1b')][_0x5267('0x76')];var _0x405eb4=_[_0x5267('0x62')](_0x339f3f);var _0x557749=_0x339f3f===_0x5267('0x63')?_0x5267('0x64'):'Account';return db['User']['findOne']({'raw':!![],'where':{'id':_0x28884b[_0x5267('0x17')]['id'],'role':'agent'}})[_0x5267('0x15')](function(_0x54422c){if(_['isNil'](_0x54422c)){throw new Error(_0x5267('0x77'));}_0x7ecf0e=_0x54422c;return db[_0x405eb4+_0x5267('0x78')][_0x5267('0x79')]({'where':{'id':_0x28884b[_0x5267('0x1b')][_0x5267('0x68')]},'include':[{'model':db[_0x405eb4+'Interaction'],'as':'Interaction'},{'model':db[_0x405eb4+_0x557749],'as':_0x5267('0x65')}]});})[_0x5267('0x15')](function(_0x1a6245){if(_[_0x5267('0xf')](_0x1a6245)){throw new Error(_0x405eb4+_0x5267('0x6a'));}_0x676556=_0x1a6245;return _0x1a6245['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x5267('0x15')](function(){var _0x5bece1={'uniqueid':_0x339f3f+'.'+_0x676556['id']+'.'+_0x676556['Interaction']['id'],'FromUserId':_0x28884b[_0x5267('0x2c')]['id'],'type':'queue','ToUserId':_0x7ecf0e['id']};_0x5bece1[_0x405eb4+'MessageId']=_0x676556['id'];_0x5bece1[_0x405eb4+_0x5267('0x6e')]=_0x676556[_0x5267('0x69')]['id'];_0x5bece1['From'+_0x405eb4+_0x557749+'Id']=_0x676556['Account']['id'];return db[_0x405eb4+'TransferReport'][_0x5267('0x71')](_0x5bece1);})['then'](function(){return respondWithRpcPromise(_0x5267('0x72'),{'channel':_0x339f3f,'interaction':_0x676556['Interaction'],'message':_0x676556,'account':_0x676556[_0x5267('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5267('0x37'),'appdata':_0x7ecf0e['name']+','+(_0x676556[_0x5267('0x65')][_0x5267('0x7a')]||0x12c),'interval':_0x5267('0x74')}]},routingClient);})[_0x5267('0x15')](respondWithResult(_0x35a4a3,null))[_0x5267('0x9')](handleError(_0x35a4a3,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index f6ac0ab..7f3e1bf 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 _0x7c18=['index','/:id','isAuthenticated','show','/:id/run','post','update','delete','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get'];(function(_0x373ba0,_0x55e574){var _0x2d057d=function(_0x278e49){while(--_0x278e49){_0x373ba0['push'](_0x373ba0['shift']());}};_0x2d057d(++_0x55e574);}(_0x7c18,0x171));var _0x87c1=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7c18[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0x87c1('0x0'));var path=require(_0x87c1('0x1'));var timeout=require(_0x87c1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x87c1('0x3'));var auth=require(_0x87c1('0x4'));var interaction=require(_0x87c1('0x5'));var config=require(_0x87c1('0x6'));var controller=require(_0x87c1('0x7'));router[_0x87c1('0x8')]('/',auth['isAuthenticated'](),controller[_0x87c1('0x9')]);router[_0x87c1('0x8')](_0x87c1('0xa'),auth[_0x87c1('0xb')](),controller[_0x87c1('0xc')]);router[_0x87c1('0x8')](_0x87c1('0xd'),auth[_0x87c1('0xb')](),controller['run']);router[_0x87c1('0xe')]('/',auth[_0x87c1('0xb')](),controller['create']);router['put'](_0x87c1('0xa'),auth[_0x87c1('0xb')](),controller[_0x87c1('0xf')]);router[_0x87c1('0x10')]('/:id',auth[_0x87c1('0xb')](),controller['destroy']);module[_0x87c1('0x11')]=router; \ No newline at end of file +var _0x68c5=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','/:id/run','isAuthenticated','run','post','create','put','update','destroy','multer','util'];(function(_0x53f812,_0x3a47e5){var _0x466856=function(_0x164719){while(--_0x164719){_0x53f812['push'](_0x53f812['shift']());}};_0x466856(++_0x3a47e5);}(_0x68c5,0x8a));var _0x568c=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x68c5[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0x568c('0x0'));var util=require(_0x568c('0x1'));var path=require(_0x568c('0x2'));var timeout=require(_0x568c('0x3'));var express=require(_0x568c('0x4'));var router=express[_0x568c('0x5')]();var fs_extra=require(_0x568c('0x6'));var auth=require(_0x568c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x568c('0x8'));var controller=require('./schedule.controller');router[_0x568c('0x9')]('/',auth['isAuthenticated'](),controller[_0x568c('0xa')]);router[_0x568c('0x9')](_0x568c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x568c('0x9')](_0x568c('0xc'),auth[_0x568c('0xd')](),controller[_0x568c('0xe')]);router[_0x568c('0xf')]('/',auth[_0x568c('0xd')](),controller[_0x568c('0x10')]);router[_0x568c('0x11')]('/:id',auth[_0x568c('0xd')](),controller[_0x568c('0x12')]);router['delete'](_0x568c('0xb'),auth[_0x568c('0xd')](),controller[_0x568c('0x13')]);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 6d26b79..b4ca67c 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 _0x3e81=['STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','months','weeks','days','hours','minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports'];(function(_0xdc0397,_0x20d1f1){var _0x553d02=function(_0x364781){while(--_0x364781){_0xdc0397['push'](_0xdc0397['shift']());}};_0x553d02(++_0x20d1f1);}(_0x3e81,0x167));var _0x13e8=function(_0x1c240f,_0x4bb3b5){_0x1c240f=_0x1c240f-0x0;var _0x2efe10=_0x3e81[_0x1c240f];return _0x2efe10;};'use strict';var Sequelize=require(_0x13e8('0x0'));module[_0x13e8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x13e8('0x2')]},'active':{'type':Sequelize[_0x13e8('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x13e8('0x2')],'allowNull':![],'defaultValue':_0x13e8('0x4')},'startAt':{'type':Sequelize[_0x13e8('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x13e8('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x13e8('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x13e8('0x7')]('years','quarters',_0x13e8('0x8'),_0x13e8('0x9'),_0x13e8('0xa'),_0x13e8('0xb'),_0x13e8('0xc')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0x13e8('0xd'),_0x13e8('0xe'),_0x13e8('0xf')),'allowNull':![],'defaultValue':_0x13e8('0xd')},'type':{'type':Sequelize[_0x13e8('0x7')](_0x13e8('0x10'),_0x13e8('0x11')),'allowNull':![],'defaultValue':_0x13e8('0x10')},'sendMail':{'type':Sequelize[_0x13e8('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x13e8('0x2')]},'cc':{'type':Sequelize[_0x13e8('0x12')]},'bcc':{'type':Sequelize[_0x13e8('0x12')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xc602=['minutes','csv','pdf','custom','TEXT','BOOLEAN','sequelize','exports','STRING','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours'];(function(_0xe7d07d,_0x52e4e3){var _0x229e46=function(_0x376839){while(--_0x376839){_0xe7d07d['push'](_0xe7d07d['shift']());}};_0x229e46(++_0x52e4e3);}(_0xc602,0x17c));var _0x2c60=function(_0x532a7f,_0x3aa276){_0x532a7f=_0x532a7f-0x0;var _0x3f16bf=_0xc602[_0x532a7f];return _0x3f16bf;};'use strict';var Sequelize=require(_0x2c60('0x0'));module[_0x2c60('0x1')]={'name':{'type':Sequelize[_0x2c60('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2c60('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x2c60('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x2c60('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x2c60('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2c60('0x5')](_0x2c60('0x6'),_0x2c60('0x7'),_0x2c60('0x8'),_0x2c60('0x9'),'days',_0x2c60('0xa'),_0x2c60('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x2c60('0x5')](_0x2c60('0xc'),_0x2c60('0xd'),'xlsx'),'allowNull':![],'defaultValue':_0x2c60('0xc')},'type':{'type':Sequelize[_0x2c60('0x5')](_0x2c60('0xe'),'default'),'allowNull':![],'defaultValue':_0x2c60('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x2c60('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x2c60('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x2c60('0x10')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index b4631ae..8f53ab4 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 _0xb592=['count','set','Content-Range','reject','update','then','destroy','get','Scheduler','UserProfileResource','end','error','stack','name','send','index','map','Schedule','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit'];(function(_0x54516e,_0x5df54c){var _0x4d1e6f=function(_0x454bbc){while(--_0x454bbc){_0x54516e['push'](_0x54516e['shift']());}};_0x4d1e6f(++_0x5df54c);}(_0xb592,0x199));var _0x2b59=function(_0x19dd32,_0x5b5417){_0x19dd32=_0x19dd32-0x0;var _0x501852=_0xb592[_0x19dd32];return _0x501852;};'use strict';var emlformat=require(_0x2b59('0x0'));var rimraf=require(_0x2b59('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b59('0x2'));var rp=require(_0x2b59('0x3'));var moment=require('moment');var BPromise=require(_0x2b59('0x4'));var Mustache=require(_0x2b59('0x5'));var util=require(_0x2b59('0x6'));var path=require(_0x2b59('0x7'));var sox=require('sox');var csv=require(_0x2b59('0x8'));var ejs=require(_0x2b59('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b59('0xa'));var squel=require(_0x2b59('0xb'));var crypto=require(_0x2b59('0xc'));var jsforce=require(_0x2b59('0xd'));var deskjs=require(_0x2b59('0xe'));var toCsv=require(_0x2b59('0x8'));var querystring=require(_0x2b59('0xf'));var Papa=require(_0x2b59('0x10'));var Redis=require('ioredis');var authService=require(_0x2b59('0x11'));var qs=require(_0x2b59('0x12'));var as=require(_0x2b59('0x13'));var hardwareService=require(_0x2b59('0x14'));var logger=require(_0x2b59('0x15'))('api');var utils=require(_0x2b59('0x16'));var config=require(_0x2b59('0x17'));var licenseUtil=require(_0x2b59('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16e76,_0x4991bb){_0x4991bb=_0x4991bb||0xcc;return function(_0x3aedff){if(_0x3aedff){return _0x16e76[_0x2b59('0x19')](_0x4991bb);}return _0x16e76[_0x2b59('0x1a')](_0x4991bb)['end']();};}function respondWithResult(_0x5b1a98,_0x2a4420){_0x2a4420=_0x2a4420||0xc8;return function(_0x40bc00){if(_0x40bc00){return _0x5b1a98['status'](_0x2a4420)[_0x2b59('0x1b')](_0x40bc00);}};}function respondWithFilteredResult(_0x59805c,_0x2e7969){return function(_0xd431bb){if(_0xd431bb){var _0x561b42=typeof _0x2e7969[_0x2b59('0x1c')]===_0x2b59('0x1d')&&typeof _0x2e7969[_0x2b59('0x1e')]===_0x2b59('0x1d');var _0x5ad68e=_0xd431bb[_0x2b59('0x1f')];var _0x21ea1a=_0x561b42?0x0:_0x2e7969[_0x2b59('0x1c')];var _0x4e35c6=_0x561b42?_0xd431bb[_0x2b59('0x1f')]:_0x2e7969[_0x2b59('0x1c')]+_0x2e7969['limit'];var _0x1a9a8f;if(_0x4e35c6>=_0x5ad68e){_0x4e35c6=_0x5ad68e;_0x1a9a8f=0xc8;}else{_0x1a9a8f=0xce;}_0x59805c[_0x2b59('0x1a')](_0x1a9a8f);return _0x59805c[_0x2b59('0x20')](_0x2b59('0x21'),_0x21ea1a+'-'+_0x4e35c6+'/'+_0x5ad68e)[_0x2b59('0x1b')](_0xd431bb);}return null;};}function patchUpdates(_0x1feefc){return function(_0x28c5b4){try{jsonpatch['apply'](_0x28c5b4,_0x1feefc,!![]);}catch(_0x3ba389){return BPromise[_0x2b59('0x22')](_0x3ba389);}return _0x28c5b4['save']();};}function saveUpdates(_0x2a246a,_0x34bcb6){return function(_0x7c6f64){if(_0x7c6f64){return _0x7c6f64[_0x2b59('0x23')](_0x2a246a)[_0x2b59('0x24')](function(_0x1ebfb1){return _0x1ebfb1;});}return null;};}function removeEntity(_0x47d447,_0x2f1afe){return function(_0x481871){if(_0x481871){return _0x481871[_0x2b59('0x25')]()[_0x2b59('0x24')](function(){var _0x39a6e0=_0x481871[_0x2b59('0x26')]({'plain':!![]});var _0xa6b912=_0x2b59('0x27');return db[_0x2b59('0x28')][_0x2b59('0x25')]({'where':{'type':_0xa6b912,'resourceId':_0x39a6e0['id']}})[_0x2b59('0x24')](function(){return _0x481871;});})[_0x2b59('0x24')](function(){_0x47d447[_0x2b59('0x1a')](0xcc)[_0x2b59('0x29')]();});}};}function handleEntityNotFound(_0x4d13c1,_0x4b5f14){return function(_0x170775){if(!_0x170775){_0x4d13c1[_0x2b59('0x19')](0x194);}return _0x170775;};}function handleError(_0x456b42,_0x1c7919){_0x1c7919=_0x1c7919||0x1f4;return function(_0x5aba33){logger[_0x2b59('0x2a')](_0x5aba33[_0x2b59('0x2b')]);if(_0x5aba33[_0x2b59('0x2c')]){delete _0x5aba33[_0x2b59('0x2c')];}_0x456b42[_0x2b59('0x1a')](_0x1c7919)[_0x2b59('0x2d')](_0x5aba33);};}exports[_0x2b59('0x2e')]=function(_0x28a1fa,_0x3b688f){var _0x174615={},_0x59214d={},_0x18dca5={'count':0x0,'rows':[]};var _0x5038b0=_[_0x2b59('0x2f')](db[_0x2b59('0x30')]['rawAttributes'],function(_0x3f1a07){return{'name':_0x3f1a07['fieldName'],'type':_0x3f1a07['type'][_0x2b59('0x31')]};});_0x59214d[_0x2b59('0x32')]=_[_0x2b59('0x2f')](_0x5038b0,_0x2b59('0x2c'));_0x59214d[_0x2b59('0x33')]=_[_0x2b59('0x34')](_0x28a1fa['query']);_0x59214d[_0x2b59('0x35')]=_[_0x2b59('0x36')](_0x59214d[_0x2b59('0x32')],_0x59214d[_0x2b59('0x33')]);_0x174615[_0x2b59('0x37')]=_[_0x2b59('0x36')](_0x59214d[_0x2b59('0x32')],qs[_0x2b59('0x38')](_0x28a1fa[_0x2b59('0x33')]['fields']));_0x174615[_0x2b59('0x37')]=_0x174615[_0x2b59('0x37')][_0x2b59('0x39')]?_0x174615[_0x2b59('0x37')]:_0x59214d[_0x2b59('0x32')];if(!_0x28a1fa[_0x2b59('0x33')][_0x2b59('0x3a')](_0x2b59('0x3b'))){_0x174615['limit']=qs[_0x2b59('0x1e')](_0x28a1fa[_0x2b59('0x33')]['limit']);_0x174615[_0x2b59('0x1c')]=qs[_0x2b59('0x1c')](_0x28a1fa['query']['offset']);}_0x174615[_0x2b59('0x3c')]=qs[_0x2b59('0x3d')](_0x28a1fa[_0x2b59('0x33')][_0x2b59('0x3d')]);_0x174615[_0x2b59('0x3e')]=qs[_0x2b59('0x35')](_[_0x2b59('0x3f')](_0x28a1fa['query'],_0x59214d['filters']),_0x5038b0);if(_0x28a1fa[_0x2b59('0x33')][_0x2b59('0x40')]){_0x174615['where']=_[_0x2b59('0x41')](_0x174615[_0x2b59('0x3e')],{'$or':_['map'](_0x5038b0,function(_0x217c2a){if(_0x217c2a[_0x2b59('0x42')]!==_0x2b59('0x43')){var _0x1df409={};_0x1df409[_0x217c2a['name']]={'$like':'%'+_0x28a1fa[_0x2b59('0x33')][_0x2b59('0x40')]+'%'};return _0x1df409;}})});}_0x174615=_[_0x2b59('0x41')]({},_0x174615,_0x28a1fa[_0x2b59('0x44')]);var _0x5e00c3={'where':_0x174615[_0x2b59('0x3e')]};return db['Schedule'][_0x2b59('0x1f')](_0x5e00c3)['then'](function(_0x1fd2a0){_0x18dca5['count']=_0x1fd2a0;if(_0x28a1fa['query'][_0x2b59('0x45')]){_0x174615['include']=[{'all':!![]}];}return db[_0x2b59('0x30')][_0x2b59('0x46')](_0x174615);})[_0x2b59('0x24')](function(_0x24d511){_0x18dca5[_0x2b59('0x47')]=_0x24d511;return _0x18dca5;})[_0x2b59('0x24')](respondWithFilteredResult(_0x3b688f,_0x174615))[_0x2b59('0x48')](handleError(_0x3b688f,null));};exports[_0x2b59('0x49')]=function(_0x5ae24d,_0x5082a0){var _0x36d7eb={'raw':![],'where':{'id':_0x5ae24d[_0x2b59('0x4a')]['id']}},_0x253cc7={};_0x253cc7[_0x2b59('0x32')]=_['keys'](db[_0x2b59('0x30')][_0x2b59('0x4b')]);_0x253cc7[_0x2b59('0x33')]=_[_0x2b59('0x34')](_0x5ae24d[_0x2b59('0x33')]);_0x253cc7[_0x2b59('0x35')]=_[_0x2b59('0x36')](_0x253cc7[_0x2b59('0x32')],_0x253cc7[_0x2b59('0x33')]);_0x36d7eb[_0x2b59('0x37')]=_[_0x2b59('0x36')](_0x253cc7['model'],qs[_0x2b59('0x38')](_0x5ae24d[_0x2b59('0x33')][_0x2b59('0x38')]));_0x36d7eb['attributes']=_0x36d7eb[_0x2b59('0x37')]['length']?_0x36d7eb[_0x2b59('0x37')]:_0x253cc7['model'];if(_0x5ae24d[_0x2b59('0x33')]['includeAll']){_0x36d7eb[_0x2b59('0x4c')]=[{'all':!![]}];}_0x36d7eb=_[_0x2b59('0x41')]({},_0x36d7eb,_0x5ae24d[_0x2b59('0x44')]);return db[_0x2b59('0x30')][_0x2b59('0x4d')](_0x36d7eb)[_0x2b59('0x24')](handleEntityNotFound(_0x5082a0,null))[_0x2b59('0x24')](respondWithResult(_0x5082a0,null))[_0x2b59('0x48')](handleError(_0x5082a0,null));};exports[_0x2b59('0x4e')]=function(_0x2deac0,_0x429f7e){return db[_0x2b59('0x30')]['create'](_0x2deac0[_0x2b59('0x4f')],{})[_0x2b59('0x24')](function(_0x440c1d){var _0x1aa9a7=_0x2deac0['user']['get']({'plain':!![]});if(!_0x1aa9a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1aa9a7[_0x2b59('0x50')]===_0x2b59('0x51')){var _0x53603a=_0x440c1d['get']({'plain':!![]});var _0x55a059='Scheduler';return db[_0x2b59('0x52')][_0x2b59('0x4d')]({'where':{'name':_0x55a059,'userProfileId':_0x1aa9a7[_0x2b59('0x53')]},'raw':!![]})[_0x2b59('0x24')](function(_0x3a91ae){if(_0x3a91ae&&_0x3a91ae[_0x2b59('0x54')]===0x0){return db[_0x2b59('0x28')][_0x2b59('0x4e')]({'name':_0x53603a[_0x2b59('0x2c')],'resourceId':_0x53603a['id'],'type':_0x3a91ae[_0x2b59('0x2c')],'sectionId':_0x3a91ae['id']},{})[_0x2b59('0x24')](function(){return _0x440c1d;});}else{return _0x440c1d;}})[_0x2b59('0x48')](function(_0x4571fb){logger[_0x2b59('0x2a')](_0x2b59('0x55'),_0x4571fb);throw _0x4571fb;});}return _0x440c1d;})[_0x2b59('0x24')](respondWithResult(_0x429f7e,0xc9))[_0x2b59('0x48')](handleError(_0x429f7e,null));};exports[_0x2b59('0x23')]=function(_0x5b90c3,_0x3c65ff){if(_0x5b90c3['body']['id']){delete _0x5b90c3[_0x2b59('0x4f')]['id'];}return db[_0x2b59('0x30')][_0x2b59('0x4d')]({'where':{'id':_0x5b90c3[_0x2b59('0x4a')]['id']}})[_0x2b59('0x24')](handleEntityNotFound(_0x3c65ff,null))['then'](saveUpdates(_0x5b90c3[_0x2b59('0x4f')],null))[_0x2b59('0x24')](respondWithResult(_0x3c65ff,null))['catch'](handleError(_0x3c65ff,null));};exports[_0x2b59('0x25')]=function(_0x1e0136,_0x33b32c){return db[_0x2b59('0x30')][_0x2b59('0x4d')]({'where':{'id':_0x1e0136[_0x2b59('0x4a')]['id']}})[_0x2b59('0x24')](handleEntityNotFound(_0x33b32c,null))[_0x2b59('0x24')](removeEntity(_0x33b32c,null))[_0x2b59('0x48')](handleError(_0x33b32c,null));};exports[_0x2b59('0x56')]=function(_0x1ea3a8,_0x401a04,_0x1e9e6c){var _0x5df05c=require(_0x2b59('0x57'));return db[_0x2b59('0x30')]['find']({'where':{'id':_0x1ea3a8[_0x2b59('0x4a')]['id']},'raw':!![]})[_0x2b59('0x24')](handleEntityNotFound(_0x401a04,null))[_0x2b59('0x24')](function(){_0x5df05c[_0x2b59('0x56')](_0x1ea3a8[_0x2b59('0x4a')]['id']);})['then'](respondWithStatusCode(_0x401a04,null))[_0x2b59('0x48')](handleError(_0x401a04,null));}; \ No newline at end of file +var _0xda4c=['lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','Scheduler','UserProfileResource','end','sendStatus','error','stack','name','send','map','Schedule','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','show','params','includeAll','find','create','body','get','role','user','userProfileId','autoAssociation','catch','run','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xda4c,0x1eb));var _0xcda4=function(_0x214708,_0x139460){_0x214708=_0x214708-0x0;var _0xf03fe0=_0xda4c[_0x214708];return _0xf03fe0;};'use strict';var emlformat=require(_0xcda4('0x0'));var rimraf=require(_0xcda4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcda4('0x2'));var rp=require(_0xcda4('0x3'));var moment=require(_0xcda4('0x4'));var BPromise=require(_0xcda4('0x5'));var Mustache=require(_0xcda4('0x6'));var util=require(_0xcda4('0x7'));var path=require(_0xcda4('0x8'));var sox=require(_0xcda4('0x9'));var csv=require(_0xcda4('0xa'));var ejs=require(_0xcda4('0xb'));var fs=require('fs');var fs_extra=require(_0xcda4('0xc'));var _=require(_0xcda4('0xd'));var squel=require(_0xcda4('0xe'));var crypto=require(_0xcda4('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xcda4('0x10'));var toCsv=require(_0xcda4('0xa'));var querystring=require('querystring');var Papa=require(_0xcda4('0x11'));var Redis=require('ioredis');var authService=require(_0xcda4('0x12'));var qs=require(_0xcda4('0x13'));var as=require(_0xcda4('0x14'));var hardwareService=require(_0xcda4('0x15'));var logger=require(_0xcda4('0x16'))(_0xcda4('0x17'));var utils=require(_0xcda4('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcda4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c1385,_0x4d14e3){_0x4d14e3=_0x4d14e3||0xcc;return function(_0x40995f){if(_0x40995f){return _0x2c1385['sendStatus'](_0x4d14e3);}return _0x2c1385[_0xcda4('0x1a')](_0x4d14e3)['end']();};}function respondWithResult(_0x4f1db2,_0x23d439){_0x23d439=_0x23d439||0xc8;return function(_0x1fe682){if(_0x1fe682){return _0x4f1db2[_0xcda4('0x1a')](_0x23d439)[_0xcda4('0x1b')](_0x1fe682);}};}function respondWithFilteredResult(_0x3a1086,_0x1bed0e){return function(_0x388bad){if(_0x388bad){var _0x5163fd=typeof _0x1bed0e['offset']===_0xcda4('0x1c')&&typeof _0x1bed0e[_0xcda4('0x1d')]==='undefined';var _0x435a55=_0x388bad[_0xcda4('0x1e')];var _0x6c6d0b=_0x5163fd?0x0:_0x1bed0e[_0xcda4('0x1f')];var _0x29ff6f=_0x5163fd?_0x388bad[_0xcda4('0x1e')]:_0x1bed0e['offset']+_0x1bed0e['limit'];var _0x3a0301;if(_0x29ff6f>=_0x435a55){_0x29ff6f=_0x435a55;_0x3a0301=0xc8;}else{_0x3a0301=0xce;}_0x3a1086['status'](_0x3a0301);return _0x3a1086['set'](_0xcda4('0x20'),_0x6c6d0b+'-'+_0x29ff6f+'/'+_0x435a55)['json'](_0x388bad);}return null;};}function patchUpdates(_0xfbe4a7){return function(_0x311898){try{jsonpatch['apply'](_0x311898,_0xfbe4a7,!![]);}catch(_0x3120cb){return BPromise[_0xcda4('0x21')](_0x3120cb);}return _0x311898[_0xcda4('0x22')]();};}function saveUpdates(_0xad3748,_0x3ed311){return function(_0xc685b3){if(_0xc685b3){return _0xc685b3[_0xcda4('0x23')](_0xad3748)[_0xcda4('0x24')](function(_0x55a4dc){return _0x55a4dc;});}return null;};}function removeEntity(_0x3a2977,_0x92349d){return function(_0x53d2c7){if(_0x53d2c7){return _0x53d2c7[_0xcda4('0x25')]()[_0xcda4('0x24')](function(){var _0x2b14c1=_0x53d2c7['get']({'plain':!![]});var _0x1c064e=_0xcda4('0x26');return db[_0xcda4('0x27')][_0xcda4('0x25')]({'where':{'type':_0x1c064e,'resourceId':_0x2b14c1['id']}})[_0xcda4('0x24')](function(){return _0x53d2c7;});})[_0xcda4('0x24')](function(){_0x3a2977['status'](0xcc)[_0xcda4('0x28')]();});}};}function handleEntityNotFound(_0x2e8e32,_0x109748){return function(_0x3aad9a){if(!_0x3aad9a){_0x2e8e32[_0xcda4('0x29')](0x194);}return _0x3aad9a;};}function handleError(_0x55f0a1,_0x288ef0){_0x288ef0=_0x288ef0||0x1f4;return function(_0x55e390){logger[_0xcda4('0x2a')](_0x55e390[_0xcda4('0x2b')]);if(_0x55e390['name']){delete _0x55e390[_0xcda4('0x2c')];}_0x55f0a1['status'](_0x288ef0)[_0xcda4('0x2d')](_0x55e390);};}exports['index']=function(_0x54e922,_0x5313e3){var _0xfc2aa4={},_0x1d13d0={},_0x101276={'count':0x0,'rows':[]};var _0x516adf=_[_0xcda4('0x2e')](db[_0xcda4('0x2f')][_0xcda4('0x30')],function(_0x189574){return{'name':_0x189574[_0xcda4('0x31')],'type':_0x189574['type'][_0xcda4('0x32')]};});_0x1d13d0[_0xcda4('0x33')]=_['map'](_0x516adf,'name');_0x1d13d0['query']=_[_0xcda4('0x34')](_0x54e922[_0xcda4('0x35')]);_0x1d13d0[_0xcda4('0x36')]=_[_0xcda4('0x37')](_0x1d13d0[_0xcda4('0x33')],_0x1d13d0[_0xcda4('0x35')]);_0xfc2aa4[_0xcda4('0x38')]=_[_0xcda4('0x37')](_0x1d13d0[_0xcda4('0x33')],qs[_0xcda4('0x39')](_0x54e922[_0xcda4('0x35')][_0xcda4('0x39')]));_0xfc2aa4['attributes']=_0xfc2aa4['attributes'][_0xcda4('0x3a')]?_0xfc2aa4[_0xcda4('0x38')]:_0x1d13d0['model'];if(!_0x54e922[_0xcda4('0x35')][_0xcda4('0x3b')](_0xcda4('0x3c'))){_0xfc2aa4[_0xcda4('0x1d')]=qs[_0xcda4('0x1d')](_0x54e922[_0xcda4('0x35')][_0xcda4('0x1d')]);_0xfc2aa4['offset']=qs['offset'](_0x54e922['query'][_0xcda4('0x1f')]);}_0xfc2aa4['order']=qs[_0xcda4('0x3d')](_0x54e922['query'][_0xcda4('0x3d')]);_0xfc2aa4[_0xcda4('0x3e')]=qs['filters'](_[_0xcda4('0x3f')](_0x54e922[_0xcda4('0x35')],_0x1d13d0[_0xcda4('0x36')]),_0x516adf);if(_0x54e922[_0xcda4('0x35')][_0xcda4('0x40')]){_0xfc2aa4['where']=_[_0xcda4('0x41')](_0xfc2aa4[_0xcda4('0x3e')],{'$or':_[_0xcda4('0x2e')](_0x516adf,function(_0x3b2146){if(_0x3b2146[_0xcda4('0x42')]!==_0xcda4('0x43')){var _0x55925b={};_0x55925b[_0x3b2146[_0xcda4('0x2c')]]={'$like':'%'+_0x54e922[_0xcda4('0x35')][_0xcda4('0x40')]+'%'};return _0x55925b;}})});}_0xfc2aa4=_[_0xcda4('0x41')]({},_0xfc2aa4,_0x54e922[_0xcda4('0x44')]);var _0x13f0e2={'where':_0xfc2aa4['where']};return db['Schedule'][_0xcda4('0x1e')](_0x13f0e2)[_0xcda4('0x24')](function(_0x59dd2c){_0x101276[_0xcda4('0x1e')]=_0x59dd2c;if(_0x54e922[_0xcda4('0x35')]['includeAll']){_0xfc2aa4['include']=[{'all':!![]}];}return db[_0xcda4('0x2f')][_0xcda4('0x45')](_0xfc2aa4);})['then'](function(_0x357e21){_0x101276[_0xcda4('0x46')]=_0x357e21;return _0x101276;})[_0xcda4('0x24')](respondWithFilteredResult(_0x5313e3,_0xfc2aa4))['catch'](handleError(_0x5313e3,null));};exports[_0xcda4('0x47')]=function(_0x82ec20,_0x5b12fe){var _0x3b2727={'raw':![],'where':{'id':_0x82ec20[_0xcda4('0x48')]['id']}},_0x56d89c={};_0x56d89c[_0xcda4('0x33')]=_[_0xcda4('0x34')](db[_0xcda4('0x2f')][_0xcda4('0x30')]);_0x56d89c['query']=_[_0xcda4('0x34')](_0x82ec20[_0xcda4('0x35')]);_0x56d89c[_0xcda4('0x36')]=_[_0xcda4('0x37')](_0x56d89c[_0xcda4('0x33')],_0x56d89c[_0xcda4('0x35')]);_0x3b2727[_0xcda4('0x38')]=_[_0xcda4('0x37')](_0x56d89c[_0xcda4('0x33')],qs[_0xcda4('0x39')](_0x82ec20[_0xcda4('0x35')][_0xcda4('0x39')]));_0x3b2727[_0xcda4('0x38')]=_0x3b2727[_0xcda4('0x38')][_0xcda4('0x3a')]?_0x3b2727['attributes']:_0x56d89c[_0xcda4('0x33')];if(_0x82ec20[_0xcda4('0x35')][_0xcda4('0x49')]){_0x3b2727['include']=[{'all':!![]}];}_0x3b2727=_[_0xcda4('0x41')]({},_0x3b2727,_0x82ec20['options']);return db['Schedule'][_0xcda4('0x4a')](_0x3b2727)[_0xcda4('0x24')](handleEntityNotFound(_0x5b12fe,null))['then'](respondWithResult(_0x5b12fe,null))['catch'](handleError(_0x5b12fe,null));};exports[_0xcda4('0x4b')]=function(_0x8c2cb9,_0x1008cb){return db[_0xcda4('0x2f')]['create'](_0x8c2cb9[_0xcda4('0x4c')],{})[_0xcda4('0x24')](function(_0x3ecb5b){var _0x212aad=_0x8c2cb9['user'][_0xcda4('0x4d')]({'plain':!![]});if(!_0x212aad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x212aad[_0xcda4('0x4e')]===_0xcda4('0x4f')){var _0x353ba1=_0x3ecb5b[_0xcda4('0x4d')]({'plain':!![]});var _0x418306=_0xcda4('0x26');return db['UserProfileSection'][_0xcda4('0x4a')]({'where':{'name':_0x418306,'userProfileId':_0x212aad[_0xcda4('0x50')]},'raw':!![]})[_0xcda4('0x24')](function(_0xabf9f0){if(_0xabf9f0&&_0xabf9f0[_0xcda4('0x51')]===0x0){return db[_0xcda4('0x27')]['create']({'name':_0x353ba1['name'],'resourceId':_0x353ba1['id'],'type':_0xabf9f0[_0xcda4('0x2c')],'sectionId':_0xabf9f0['id']},{})[_0xcda4('0x24')](function(){return _0x3ecb5b;});}else{return _0x3ecb5b;}})[_0xcda4('0x52')](function(_0x1042d2){logger[_0xcda4('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1042d2);throw _0x1042d2;});}return _0x3ecb5b;})['then'](respondWithResult(_0x1008cb,0xc9))[_0xcda4('0x52')](handleError(_0x1008cb,null));};exports[_0xcda4('0x23')]=function(_0x414a61,_0x566f17){if(_0x414a61[_0xcda4('0x4c')]['id']){delete _0x414a61[_0xcda4('0x4c')]['id'];}return db[_0xcda4('0x2f')][_0xcda4('0x4a')]({'where':{'id':_0x414a61[_0xcda4('0x48')]['id']}})['then'](handleEntityNotFound(_0x566f17,null))[_0xcda4('0x24')](saveUpdates(_0x414a61[_0xcda4('0x4c')],null))[_0xcda4('0x24')](respondWithResult(_0x566f17,null))[_0xcda4('0x52')](handleError(_0x566f17,null));};exports[_0xcda4('0x25')]=function(_0x664906,_0x3639a9){return db['Schedule'][_0xcda4('0x4a')]({'where':{'id':_0x664906['params']['id']}})['then'](handleEntityNotFound(_0x3639a9,null))[_0xcda4('0x24')](removeEntity(_0x3639a9,null))['catch'](handleError(_0x3639a9,null));};exports[_0xcda4('0x53')]=function(_0x3e2fba,_0x38b15a,_0x2c7401){var _0x4018ff=require('../../config/schedule');return db[_0xcda4('0x2f')][_0xcda4('0x4a')]({'where':{'id':_0x3e2fba[_0xcda4('0x48')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x38b15a,null))[_0xcda4('0x24')](function(){_0x4018ff['run'](_0x3e2fba[_0xcda4('0x48')]['id']);})['then'](respondWithStatusCode(_0x38b15a,null))[_0xcda4('0x52')](handleError(_0x38b15a,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 090dbe9..a042cbd 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 _0x8600=['path','rimraf','../../config/environment','./schedule.attributes','exports','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1158cd,_0x1c9cbe){var _0x4b359d=function(_0x5846f5){while(--_0x5846f5){_0x1158cd['push'](_0x1158cd['shift']());}};_0x4b359d(++_0x1c9cbe);}(_0x8600,0x18c));var _0x0860=function(_0x2e819c,_0x3f99a5){_0x2e819c=_0x2e819c-0x0;var _0x24e271=_0x8600[_0x2e819c];return _0x24e271;};'use strict';var _=require(_0x0860('0x0'));var util=require(_0x0860('0x1'));var logger=require(_0x0860('0x2'))(_0x0860('0x3'));var moment=require(_0x0860('0x4'));var BPromise=require(_0x0860('0x5'));var rp=require(_0x0860('0x6'));var fs=require('fs');var path=require(_0x0860('0x7'));var rimraf=require(_0x0860('0x8'));var config=require(_0x0860('0x9'));var attributes=require(_0x0860('0xa'));module[_0x0860('0xb')]=function(_0x306153,_0x5238ee){return _0x306153['define']('Schedule',attributes,{'tableName':_0x0860('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8ce=['rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd8ce,0x173));var _0xed8c=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0xd8ce[_0x41c381];return _0x427981;};'use strict';var _=require(_0xed8c('0x0'));var util=require(_0xed8c('0x1'));var logger=require(_0xed8c('0x2'))(_0xed8c('0x3'));var moment=require(_0xed8c('0x4'));var BPromise=require(_0xed8c('0x5'));var rp=require(_0xed8c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed8c('0x7'));var config=require(_0xed8c('0x8'));var attributes=require(_0xed8c('0x9'));module[_0xed8c('0xa')]=function(_0x1e8c8a,_0x3b205d){return _0x1e8c8a[_0xed8c('0xb')](_0xed8c('0xc'),attributes,{'tableName':_0xed8c('0xd'),'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 3da719f..b084d8c 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 _0x73a1=['error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x4f770b,_0x48ca59){var _0x521801=function(_0x44f498){while(--_0x44f498){_0x4f770b['push'](_0x4f770b['shift']());}};_0x521801(++_0x48ca59);}(_0x73a1,0x119));var _0x173a=function(_0x5e4b85,_0x6cf965){_0x5e4b85=_0x5e4b85-0x0;var _0x5cd3cb=_0x73a1[_0x5e4b85];return _0x5cd3cb;};'use strict';var _=require(_0x173a('0x0'));var util=require(_0x173a('0x1'));var moment=require(_0x173a('0x2'));var BPromise=require('bluebird');var rs=require(_0x173a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x173a('0x4'))['db'];var utils=require(_0x173a('0x5'));var logger=require(_0x173a('0x6'))(_0x173a('0x7'));var config=require(_0x173a('0x8'));var jayson=require(_0x173a('0x9'));var client=jayson['client'][_0x173a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e78ee,_0x3b7f1d,_0x6619f8){return new BPromise(function(_0x5d9503,_0x660b8c){return client[_0x173a('0xb')](_0x1e78ee,_0x6619f8)[_0x173a('0xc')](function(_0x56bc2d){logger[_0x173a('0xd')](_0x173a('0xe'),_0x3b7f1d,_0x173a('0xf'));logger[_0x173a('0x10')]('Schedule,\x20%s,\x20%s,\x20%s',_0x3b7f1d,_0x173a('0xf'),JSON[_0x173a('0x11')](_0x56bc2d));if(_0x56bc2d[_0x173a('0x12')]){if(_0x56bc2d['error'][_0x173a('0x13')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x3b7f1d,_0x56bc2d[_0x173a('0x12')][_0x173a('0x14')]);return _0x660b8c(_0x56bc2d['error']['message']);}logger[_0x173a('0x12')](_0x173a('0xe'),_0x3b7f1d,_0x56bc2d[_0x173a('0x12')][_0x173a('0x14')]);return _0x5d9503(_0x56bc2d['error'][_0x173a('0x14')]);}else{logger[_0x173a('0xd')]('Schedule,\x20%s,\x20%s',_0x3b7f1d,_0x173a('0xf'));_0x5d9503(_0x56bc2d[_0x173a('0x15')]['message']);}})[_0x173a('0x16')](function(_0x53a497){logger[_0x173a('0x12')]('Schedule,\x20%s,\x20%s',_0x3b7f1d,_0x53a497);_0x660b8c(_0x53a497);});});} \ No newline at end of file +var _0x9a64=['code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x55cee5,_0x5e09ad){var _0x1ecce1=function(_0x132582){while(--_0x132582){_0x55cee5['push'](_0x55cee5['shift']());}};_0x1ecce1(++_0x5e09ad);}(_0x9a64,0x129));var _0x49a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a64[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x49a6('0x0'));var util=require(_0x49a6('0x1'));var moment=require(_0x49a6('0x2'));var BPromise=require(_0x49a6('0x3'));var rs=require(_0x49a6('0x4'));var fs=require('fs');var Redis=require(_0x49a6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x49a6('0x6'));var logger=require(_0x49a6('0x7'))(_0x49a6('0x8'));var config=require(_0x49a6('0x9'));var jayson=require(_0x49a6('0xa'));var client=jayson['client'][_0x49a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52b0b6,_0x130239,_0x18773e){return new BPromise(function(_0x7cb22a,_0x7bc9d9){return client['request'](_0x52b0b6,_0x18773e)[_0x49a6('0xc')](function(_0x4458a2){logger['info'](_0x49a6('0xd'),_0x130239,_0x49a6('0xe'));logger['debug'](_0x49a6('0xf'),_0x130239,_0x49a6('0xe'),JSON[_0x49a6('0x10')](_0x4458a2));if(_0x4458a2[_0x49a6('0x11')]){if(_0x4458a2[_0x49a6('0x11')][_0x49a6('0x12')]===0x1f4){logger[_0x49a6('0x11')](_0x49a6('0xd'),_0x130239,_0x4458a2['error'][_0x49a6('0x13')]);return _0x7bc9d9(_0x4458a2[_0x49a6('0x11')][_0x49a6('0x13')]);}logger['error'](_0x49a6('0xd'),_0x130239,_0x4458a2['error'][_0x49a6('0x13')]);return _0x7cb22a(_0x4458a2[_0x49a6('0x11')][_0x49a6('0x13')]);}else{logger[_0x49a6('0x14')](_0x49a6('0xd'),_0x130239,'request\x20sent');_0x7cb22a(_0x4458a2['result'][_0x49a6('0x13')]);}})['catch'](function(_0x37cb16){logger[_0x49a6('0x11')]('Schedule,\x20%s,\x20%s',_0x130239,_0x37cb16);_0x7bc9d9(_0x37cb16);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index a9e3a13..4d69232 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 _0x4fd3=['put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get','/describe','describe','show','/:id/download','download','create'];(function(_0xead955,_0x32aaf6){var _0x3ebd7e=function(_0x1fd661){while(--_0x1fd661){_0xead955['push'](_0xead955['shift']());}};_0x3ebd7e(++_0x32aaf6);}(_0x4fd3,0x7d));var _0x34fd=function(_0x3cbd07,_0x53c3b2){_0x3cbd07=_0x3cbd07-0x0;var _0x29d15a=_0x4fd3[_0x3cbd07];return _0x29d15a;};'use strict';var multer=require('multer');var util=require(_0x34fd('0x0'));var path=require(_0x34fd('0x1'));var timeout=require(_0x34fd('0x2'));var express=require(_0x34fd('0x3'));var router=express[_0x34fd('0x4')]();var fs_extra=require(_0x34fd('0x5'));var auth=require(_0x34fd('0x6'));var interaction=require(_0x34fd('0x7'));var config=require(_0x34fd('0x8'));var controller=require(_0x34fd('0x9'));router['get']('/',auth[_0x34fd('0xa')](),controller[_0x34fd('0xb')]);router[_0x34fd('0xc')](_0x34fd('0xd'),auth[_0x34fd('0xa')](),controller[_0x34fd('0xe')]);router['get']('/:id',auth[_0x34fd('0xa')](),controller[_0x34fd('0xf')]);router[_0x34fd('0xc')](_0x34fd('0x10'),auth[_0x34fd('0xa')](),controller[_0x34fd('0x11')]);router['post']('/',auth[_0x34fd('0xa')](),controller[_0x34fd('0x12')]);router[_0x34fd('0x13')](_0x34fd('0x14'),auth[_0x34fd('0xa')](),controller[_0x34fd('0x15')]);router[_0x34fd('0x16')](_0x34fd('0x14'),auth[_0x34fd('0xa')](),controller[_0x34fd('0x17')]);module['exports']=router; \ No newline at end of file +var _0x14dd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id','show','download','post','put','update','delete','destroy','path','connect-timeout','express','Router'];(function(_0x23a1ec,_0x2281c8){var _0x89cd93=function(_0x4110dc){while(--_0x4110dc){_0x23a1ec['push'](_0x23a1ec['shift']());}};_0x89cd93(++_0x2281c8);}(_0x14dd,0x19e));var _0xd14d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14dd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd14d('0x0'));var timeout=require(_0xd14d('0x1'));var express=require(_0xd14d('0x2'));var router=express[_0xd14d('0x3')]();var fs_extra=require(_0xd14d('0x4'));var auth=require(_0xd14d('0x5'));var interaction=require(_0xd14d('0x6'));var config=require(_0xd14d('0x7'));var controller=require('./screenRecording.controller');router[_0xd14d('0x8')]('/',auth['isAuthenticated'](),controller[_0xd14d('0x9')]);router[_0xd14d('0x8')]('/describe',auth[_0xd14d('0xa')](),controller['describe']);router[_0xd14d('0x8')](_0xd14d('0xb'),auth[_0xd14d('0xa')](),controller[_0xd14d('0xc')]);router[_0xd14d('0x8')]('/:id/download',auth[_0xd14d('0xa')](),controller[_0xd14d('0xd')]);router[_0xd14d('0xe')]('/',auth[_0xd14d('0xa')](),controller['create']);router[_0xd14d('0xf')](_0xd14d('0xb'),auth[_0xd14d('0xa')](),controller[_0xd14d('0x10')]);router[_0xd14d('0x11')]('/:id',auth[_0xd14d('0xa')](),controller[_0xd14d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index eaa88e2..c4f2098 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 _0x4dcb=['replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','createdAt','toString','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING'];(function(_0x3b86c1,_0x5dbd0c){var _0x51d593=function(_0x51b355){while(--_0x51b355){_0x3b86c1['push'](_0x3b86c1['shift']());}};_0x51d593(++_0x5dbd0c);}(_0x4dcb,0x186));var _0xb4dc=function(_0x507224,_0x3b08a2){_0x507224=_0x507224-0x0;var _0x559ee6=_0x4dcb[_0x507224];return _0x559ee6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb4dc('0x0'));var path=require(_0xb4dc('0x1'));var config=require(_0xb4dc('0x2'));module[_0xb4dc('0x3')]={'format':{'type':Sequelize[_0xb4dc('0x4')],'get':function(){return this[_0xb4dc('0x5')](_0xb4dc('0x6'))?path[_0xb4dc('0x7')](this[_0xb4dc('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb4dc('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x445f93){var _0x14790e=_0x445f93[_0xb4dc('0x9')](/\\/g,'/');this[_0xb4dc('0xa')](_0xb4dc('0x6'),_0x14790e);}},'rating':{'type':Sequelize[_0xb4dc('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0xa50528){this[_0xb4dc('0xa')](_0xb4dc('0xc'),moment()[_0xb4dc('0xd')](_0xa50528,'ms'));this[_0xb4dc('0xa')](_0xb4dc('0xe'),moment());this[_0xb4dc('0xa')](_0xb4dc('0xf'),_0xa50528);}},'startedAt':{'type':Sequelize[_0xb4dc('0x10')],'get':function(){return moment(this[_0xb4dc('0x5')](_0xb4dc('0xc')))[_0xb4dc('0x11')](_0xb4dc('0x12'))['toString']();}},'closedAt':{'type':Sequelize[_0xb4dc('0x10')],'get':function(){return moment(this[_0xb4dc('0x5')](_0xb4dc('0xe')))[_0xb4dc('0x11')](_0xb4dc('0x12'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb4dc('0x5')](_0xb4dc('0x13')))[_0xb4dc('0x11')](_0xb4dc('0x12'))[_0xb4dc('0x14')]();}},'updatedAt':{'type':Sequelize[_0xb4dc('0x10')],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0xb4dc('0x11')](_0xb4dc('0x12'))[_0xb4dc('0x14')]();}}}; \ No newline at end of file +var _0x430c=['toString','DATE','createdAt','sequelize','../../config/environment','exports','VIRTUAL','value','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration','getDataValue','format','MM-DD-YYYY\x20HH:mm'];(function(_0x59145a,_0x1f60f1){var _0xf04d7=function(_0x247581){while(--_0x247581){_0x59145a['push'](_0x59145a['shift']());}};_0xf04d7(++_0x1f60f1);}(_0x430c,0x1a1));var _0xc430=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x430c[_0x4ff09b];return _0x3f5c2e;};'use strict';var Sequelize=require(_0xc430('0x0'));var moment=require('moment');var path=require('path');var config=require(_0xc430('0x1'));module[_0xc430('0x2')]={'format':{'type':Sequelize[_0xc430('0x3')],'get':function(){return this['getDataValue']('value')?path['extname'](this['getDataValue'](_0xc430('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xc430('0x5')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xc430('0x5')],'set':function(_0x4de44f){var _0x212354=_0x4de44f[_0xc430('0x6')](/\\/g,'/');this[_0xc430('0x7')](_0xc430('0x4'),_0x212354);}},'rating':{'type':Sequelize[_0xc430('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xc430('0x8')],'set':function(_0x861581){this[_0xc430('0x7')](_0xc430('0x9'),moment()['subtract'](_0x861581,'ms'));this[_0xc430('0x7')](_0xc430('0xa'),moment());this['setDataValue'](_0xc430('0xb'),_0x861581);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xc430('0xc')]('startedAt'))[_0xc430('0xd')](_0xc430('0xe'))[_0xc430('0xf')]();}},'closedAt':{'type':Sequelize[_0xc430('0x10')],'get':function(){return moment(this[_0xc430('0xc')](_0xc430('0xa')))[_0xc430('0xd')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0xc430('0x10')],'get':function(){return moment(this[_0xc430('0xc')](_0xc430('0x11')))[_0xc430('0xd')](_0xc430('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0xc430('0x10')],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0xc430('0xd')](_0xc430('0xe'))[_0xc430('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 586ec2a..b288f3f 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 _0x8d0e=['name','send','map','fieldName','type','key','format','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','rows','catch','show','includeAll','include','ScreenRecording','find','create','body','duration','value','params','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','filename','unlink','ScreenRecording\x20not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','stack'];(function(_0x1a3fe2,_0x553b71){var _0x490ee2=function(_0xc569b4){while(--_0xc569b4){_0x1a3fe2['push'](_0x1a3fe2['shift']());}};_0x490ee2(++_0x553b71);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x2e5a89,_0x32826f){_0x2e5a89=_0x2e5a89-0x0;var _0x13ac14=_0x8d0e[_0x2e5a89];return _0x13ac14;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];function respondWithStatusCode(_0x5934b2,_0x38fac0){_0x38fac0=_0x38fac0||0xcc;return function(_0x15b9e5){if(_0x15b9e5){return _0x5934b2['sendStatus'](_0x38fac0);}return _0x5934b2[_0xe8d0('0x1b')](_0x38fac0)['end']();};}function respondWithResult(_0x59b4b7,_0x90a1ea){_0x90a1ea=_0x90a1ea||0xc8;return function(_0x2aa906){if(_0x2aa906){return _0x59b4b7[_0xe8d0('0x1b')](_0x90a1ea)[_0xe8d0('0x1c')](_0x2aa906);}};}function respondWithFilteredResult(_0x15d3a1,_0x7151c6){return function(_0x52818a){if(_0x52818a){var _0x6ccffa=typeof _0x7151c6['offset']===_0xe8d0('0x1d')&&typeof _0x7151c6[_0xe8d0('0x1e')]===_0xe8d0('0x1d');var _0x4d1db4=_0x52818a['count'];var _0x47c67a=_0x6ccffa?0x0:_0x7151c6[_0xe8d0('0x1f')];var _0x384854=_0x6ccffa?_0x52818a[_0xe8d0('0x20')]:_0x7151c6[_0xe8d0('0x1f')]+_0x7151c6[_0xe8d0('0x1e')];var _0x588133;if(_0x384854>=_0x4d1db4){_0x384854=_0x4d1db4;_0x588133=0xc8;}else{_0x588133=0xce;}_0x15d3a1[_0xe8d0('0x1b')](_0x588133);return _0x15d3a1[_0xe8d0('0x21')]('Content-Range',_0x47c67a+'-'+_0x384854+'/'+_0x4d1db4)['json'](_0x52818a);}return null;};}function patchUpdates(_0x554402){return function(_0x384a60){try{jsonpatch[_0xe8d0('0x22')](_0x384a60,_0x554402,!![]);}catch(_0x25363b){return BPromise[_0xe8d0('0x23')](_0x25363b);}return _0x384a60[_0xe8d0('0x24')]();};}function saveUpdates(_0x23a945,_0x1bd25c){return function(_0x28a6b5){if(_0x28a6b5){return _0x28a6b5[_0xe8d0('0x25')](_0x23a945)['then'](function(_0xed8f2e){return _0xed8f2e;});}return null;};}function removeEntity(_0x9f747,_0x572c25){return function(_0x106614){if(_0x106614){return _0x106614[_0xe8d0('0x26')]()[_0xe8d0('0x27')](function(){_0x9f747[_0xe8d0('0x1b')](0xcc)[_0xe8d0('0x28')]();});}};}function handleEntityNotFound(_0x149dfd,_0x31519b){return function(_0x32f0c1){if(!_0x32f0c1){_0x149dfd[_0xe8d0('0x29')](0x194);}return _0x32f0c1;};}function handleError(_0x2dee67,_0x264de4){_0x264de4=_0x264de4||0x1f4;return function(_0x539548){logger[_0xe8d0('0x2a')](_0x539548[_0xe8d0('0x2b')]);if(_0x539548[_0xe8d0('0x2c')]){delete _0x539548['name'];}_0x2dee67[_0xe8d0('0x1b')](_0x264de4)[_0xe8d0('0x2d')](_0x539548);};}exports['index']=function(_0x1519e2,_0x3ffcb7){var _0x11fcf2={},_0x9eec0e={},_0x3cf3d6={'count':0x0,'rows':[]};var _0x495064=_[_0xe8d0('0x2e')](db['ScreenRecording']['rawAttributes'],function(_0x50ad3c){return{'name':_0x50ad3c[_0xe8d0('0x2f')],'type':_0x50ad3c[_0xe8d0('0x30')][_0xe8d0('0x31')]};});_0x9eec0e['model']=_['differenceBy'](_[_0xe8d0('0x2e')](_0x495064,'name'),[_0xe8d0('0x32')]);_0x9eec0e[_0xe8d0('0x33')]=_[_0xe8d0('0x34')](_0x1519e2[_0xe8d0('0x33')]);_0x9eec0e[_0xe8d0('0x35')]=_['intersection'](_0x9eec0e[_0xe8d0('0x36')],_0x9eec0e[_0xe8d0('0x33')]);_0x11fcf2[_0xe8d0('0x37')]=_[_0xe8d0('0x38')](_0x9eec0e['model'],qs[_0xe8d0('0x39')](_0x1519e2[_0xe8d0('0x33')]['fields']));_0x11fcf2[_0xe8d0('0x37')]=_0x11fcf2['attributes'][_0xe8d0('0x3a')]?_0x11fcf2['attributes']:_0x9eec0e[_0xe8d0('0x36')];if(!_0x1519e2['query'][_0xe8d0('0x3b')](_0xe8d0('0x3c'))){_0x11fcf2[_0xe8d0('0x1e')]=qs[_0xe8d0('0x1e')](_0x1519e2['query'][_0xe8d0('0x1e')]);_0x11fcf2[_0xe8d0('0x1f')]=qs[_0xe8d0('0x1f')](_0x1519e2['query'][_0xe8d0('0x1f')]);}_0x11fcf2[_0xe8d0('0x3d')]=qs[_0xe8d0('0x3e')](_0x1519e2[_0xe8d0('0x33')][_0xe8d0('0x3e')]);_0x11fcf2['where']=qs[_0xe8d0('0x35')](_[_0xe8d0('0x3f')](_0x1519e2[_0xe8d0('0x33')],_0x9eec0e[_0xe8d0('0x35')]),_0x495064);if(_0x1519e2[_0xe8d0('0x33')][_0xe8d0('0x40')]){_0x11fcf2[_0xe8d0('0x41')]=_[_0xe8d0('0x42')](_0x11fcf2['where'],{'$or':_['map'](_0x495064,function(_0xdca203){if(_0xdca203[_0xe8d0('0x30')]!==_0xe8d0('0x43')){var _0x377dc1={};_0x377dc1[_0xdca203[_0xe8d0('0x2c')]]={'$like':'%'+_0x1519e2['query'][_0xe8d0('0x40')]+'%'};return _0x377dc1;}})});}_0x11fcf2=_['merge']({},_0x11fcf2,_0x1519e2[_0xe8d0('0x44')]);var _0x458294={'where':_0x11fcf2[_0xe8d0('0x41')]};return db['ScreenRecording'][_0xe8d0('0x20')](_0x458294)[_0xe8d0('0x27')](function(_0x731382){_0x3cf3d6[_0xe8d0('0x20')]=_0x731382;if(_0x1519e2[_0xe8d0('0x33')]['includeAll']){_0x11fcf2['include']=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x11fcf2);})[_0xe8d0('0x27')](function(_0x52f288){_0x3cf3d6[_0xe8d0('0x45')]=_0x52f288;return _0x3cf3d6;})[_0xe8d0('0x27')](respondWithFilteredResult(_0x3ffcb7,_0x11fcf2))[_0xe8d0('0x46')](handleError(_0x3ffcb7,null));};exports[_0xe8d0('0x47')]=function(_0x2fd21e,_0x1156da){var _0x1b41c7={'raw':![],'where':{'id':_0x2fd21e['params']['id']}},_0x3cbca5={};_0x3cbca5[_0xe8d0('0x36')]=_[_0xe8d0('0x34')](db['ScreenRecording']['rawAttributes']);_0x3cbca5[_0xe8d0('0x33')]=_[_0xe8d0('0x34')](_0x2fd21e[_0xe8d0('0x33')]);_0x3cbca5['filters']=_[_0xe8d0('0x38')](_0x3cbca5[_0xe8d0('0x36')],_0x3cbca5['query']);_0x1b41c7[_0xe8d0('0x37')]=_[_0xe8d0('0x38')](_0x3cbca5['model'],qs[_0xe8d0('0x39')](_0x2fd21e[_0xe8d0('0x33')][_0xe8d0('0x39')]));_0x1b41c7[_0xe8d0('0x37')]=_0x1b41c7[_0xe8d0('0x37')][_0xe8d0('0x3a')]?_0x1b41c7[_0xe8d0('0x37')]:_0x3cbca5[_0xe8d0('0x36')];if(_0x2fd21e['query'][_0xe8d0('0x48')]){_0x1b41c7[_0xe8d0('0x49')]=[{'all':!![]}];}_0x1b41c7=_[_0xe8d0('0x42')]({},_0x1b41c7,_0x2fd21e[_0xe8d0('0x44')]);return db[_0xe8d0('0x4a')][_0xe8d0('0x4b')](_0x1b41c7)[_0xe8d0('0x27')](handleEntityNotFound(_0x1156da,null))[_0xe8d0('0x27')](respondWithResult(_0x1156da,null))[_0xe8d0('0x46')](handleError(_0x1156da,null));};exports[_0xe8d0('0x4c')]=function(_0x361e3d,_0x3a5987){return db['ScreenRecording'][_0xe8d0('0x4c')](_0x361e3d[_0xe8d0('0x4d')],{})[_0xe8d0('0x27')](respondWithResult(_0x3a5987,0xc9))[_0xe8d0('0x46')](handleError(_0x3a5987,null));};exports[_0xe8d0('0x25')]=function(_0x2e4caf,_0x5a0c7e){if(_0x2e4caf['body']['id']){delete _0x2e4caf[_0xe8d0('0x4d')]['id'];}delete _0x2e4caf[_0xe8d0('0x4d')][_0xe8d0('0x4e')];delete _0x2e4caf[_0xe8d0('0x4d')]['createdAt'];delete _0x2e4caf[_0xe8d0('0x4d')]['closedAt'];delete _0x2e4caf[_0xe8d0('0x4d')][_0xe8d0('0x4f')];return db[_0xe8d0('0x4a')][_0xe8d0('0x4b')]({'where':{'id':_0x2e4caf[_0xe8d0('0x50')]['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x5a0c7e,null))[_0xe8d0('0x27')](saveUpdates(_0x2e4caf['body'],null))[_0xe8d0('0x27')](respondWithResult(_0x5a0c7e,null))['catch'](handleError(_0x5a0c7e,null));};exports['describe']=function(_0x35138a,_0x5516ad){return db[_0xe8d0('0x4a')]['describe']()[_0xe8d0('0x27')](respondWithResult(_0x5516ad,null))[_0xe8d0('0x46')](handleError(_0x5516ad,null));};exports[_0xe8d0('0x51')]=function(_0xcf4642,_0x555a56,_0x3088b1){var _0xbd55db=require(_0xe8d0('0x52'));var _0x2e3f1d=![];var _0x18cc14={};if(_0xcf4642['query'][_0xe8d0('0x30')]&&_0xcf4642[_0xe8d0('0x33')][_0xe8d0('0x30')]==='uniqueid'){_0x18cc14[_0xe8d0('0x53')]=_0xcf4642['params']['id'];}else{_0x18cc14['id']=_0xcf4642['params']['id'];}return db[_0xe8d0('0x4a')][_0xe8d0('0x4b')]({'where':_0x18cc14,'attributes':['id','value'],'raw':!![]})[_0xe8d0('0x27')](handleEntityNotFound(_0x555a56,null))[_0xe8d0('0x27')](function(_0x47893d){if(_0x47893d){var _0x2a54c1=path[_0xe8d0('0x54')](config[_0xe8d0('0x55')],_0xe8d0('0x56'),_0x47893d['value']);var _0x20f6c2=util[_0xe8d0('0x32')](_0xe8d0('0x57'),_0x2a54c1);if(fs[_0xe8d0('0x58')](_0x20f6c2)){_0x2e3f1d=!![];return _0xbd55db['decryptFile'](_0x20f6c2,_0x2a54c1,config[_0xe8d0('0x59')][_0xe8d0('0x5a')])[_0xe8d0('0x27')](function(){return _0x47893d;});}return _0x47893d;}})[_0xe8d0('0x27')](function(_0x1a74d0){if(_0x1a74d0){var _0x29667c=path['join'](config['root'],_0xe8d0('0x56'),_0x1a74d0['value']);if(!fs[_0xe8d0('0x58')](_0x29667c)){throw new db[(_0xe8d0('0x5b'))]['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x1a74d0[_0xe8d0('0x5c')]){return _0x555a56['download'](_0x29667c,_0x1a74d0[_0xe8d0('0x5c')]+path['extname'](_0x29667c),function(){if(_0x2e3f1d){fs[_0xe8d0('0x5d')](_0x29667c);}});}else{return _0x555a56[_0xe8d0('0x51')](_0x29667c,function(_0x13b9f0){if(_0x2e3f1d){fs['unlink'](_0x29667c);}});}}})[_0xe8d0('0x46')](function(_0x3cbc9f){if(_0x3cbc9f['message']===_0xe8d0('0x5e')){_0x555a56['status'](0x194)[_0xe8d0('0x2d')]('Not\x20found');}else{return handleError(_0x555a56,null);}});};exports[_0xe8d0('0x26')]=function(_0x17afc2,_0x29467d){return db[_0xe8d0('0x4a')][_0xe8d0('0x4b')]({'where':{'id':_0x17afc2['params']['id']}})['then'](function(_0xd7d433){if(_['isNil'](_0xd7d433)){throw new ReferenceError(_0xe8d0('0x5f'));}return _0xd7d433;})[_0xe8d0('0x27')](function(_0xbbe457){var _0x95565d=path[_0xe8d0('0x54')](config[_0xe8d0('0x55')],_0xe8d0('0x56'),_0xbbe457[_0xe8d0('0x4f')]);logger[_0xe8d0('0x60')](_0xe8d0('0x61'),_0x95565d);if(!_[_0xe8d0('0x62')](_0xbbe457[_0xe8d0('0x4f')])&&fs[_0xe8d0('0x58')](_0x95565d)){logger[_0xe8d0('0x60')](_0xe8d0('0x63')+_0x95565d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe8d0('0x64')](_0x95565d);}_0x95565d=_0x95565d+_0xe8d0('0x65');if(!_[_0xe8d0('0x62')](_0xbbe457[_0xe8d0('0x4f')])&&fs[_0xe8d0('0x58')](_0x95565d)){logger['info'](_0xe8d0('0x63')+_0x95565d+_0xe8d0('0x66'));fs[_0xe8d0('0x64')](_0x95565d);}return _0xbbe457;})[_0xe8d0('0x27')](function(_0x360633){if(!_0x360633)throw new InternalError();return _0x360633[_0xe8d0('0x26')]();})[_0xe8d0('0x27')](function(){_0x29467d[_0xe8d0('0x1b')](0xcc)[_0xe8d0('0x28')]();})[_0xe8d0('0x46')](handleError(_0x29467d,null));}; \ No newline at end of file +var _0x425d=['include','findAll','rows','catch','show','params','length','includeAll','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','root','server/files/screen_recordings','value','%s.cypher','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0x425d,0x1e0));var _0xd425=function(_0x2de322,_0x2c601b){_0x2de322=_0x2de322-0x0;var _0x54ba40=_0x425d[_0x2de322];return _0x54ba40;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];function respondWithStatusCode(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xcc;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x1d')](_0x3cacf7);}return _0x9bb611['status'](_0x3cacf7)[_0xd425('0x1e')]();};}function respondWithResult(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0xc8;return function(_0x5d3d60){if(_0x5d3d60){return _0x17a498[_0xd425('0x1f')](_0x336dc3)[_0xd425('0x20')](_0x5d3d60);}};}function respondWithFilteredResult(_0x643fd2,_0x41f34d){return function(_0x1fc822){if(_0x1fc822){var _0x538a0a=typeof _0x41f34d[_0xd425('0x21')]===_0xd425('0x22')&&typeof _0x41f34d[_0xd425('0x23')]===_0xd425('0x22');var _0x5d6585=_0x1fc822[_0xd425('0x24')];var _0x434d97=_0x538a0a?0x0:_0x41f34d[_0xd425('0x21')];var _0x1155bc=_0x538a0a?_0x1fc822['count']:_0x41f34d['offset']+_0x41f34d['limit'];var _0x4b293a;if(_0x1155bc>=_0x5d6585){_0x1155bc=_0x5d6585;_0x4b293a=0xc8;}else{_0x4b293a=0xce;}_0x643fd2[_0xd425('0x1f')](_0x4b293a);return _0x643fd2[_0xd425('0x25')](_0xd425('0x26'),_0x434d97+'-'+_0x1155bc+'/'+_0x5d6585)['json'](_0x1fc822);}return null;};}function patchUpdates(_0x355af0){return function(_0x7e982e){try{jsonpatch['apply'](_0x7e982e,_0x355af0,!![]);}catch(_0x2e1ec4){return BPromise[_0xd425('0x27')](_0x2e1ec4);}return _0x7e982e[_0xd425('0x28')]();};}function saveUpdates(_0x1d3fc0,_0x3e93db){return function(_0xb240c4){if(_0xb240c4){return _0xb240c4[_0xd425('0x29')](_0x1d3fc0)[_0xd425('0x2a')](function(_0x314201){return _0x314201;});}return null;};}function removeEntity(_0x2b030b,_0x151ad9){return function(_0x40e84b){if(_0x40e84b){return _0x40e84b['destroy']()[_0xd425('0x2a')](function(){_0x2b030b[_0xd425('0x1f')](0xcc)[_0xd425('0x1e')]();});}};}function handleEntityNotFound(_0x1908a5,_0x2afcdb){return function(_0x400dd7){if(!_0x400dd7){_0x1908a5[_0xd425('0x1d')](0x194);}return _0x400dd7;};}function handleError(_0x577e4b,_0x12f951){_0x12f951=_0x12f951||0x1f4;return function(_0x177de2){logger[_0xd425('0x2b')](_0x177de2['stack']);if(_0x177de2[_0xd425('0x2c')]){delete _0x177de2[_0xd425('0x2c')];}_0x577e4b[_0xd425('0x1f')](_0x12f951)[_0xd425('0x2d')](_0x177de2);};}exports[_0xd425('0x2e')]=function(_0x185d7e,_0x2fd17a){var _0x37b63c={},_0x24da23={},_0x1cac61={'count':0x0,'rows':[]};var _0x482ba6=_[_0xd425('0x2f')](db[_0xd425('0x30')][_0xd425('0x31')],function(_0x3695dd){return{'name':_0x3695dd[_0xd425('0x32')],'type':_0x3695dd[_0xd425('0x33')][_0xd425('0x34')]};});_0x24da23[_0xd425('0x35')]=_[_0xd425('0x36')](_[_0xd425('0x2f')](_0x482ba6,_0xd425('0x2c')),['format']);_0x24da23[_0xd425('0x37')]=_[_0xd425('0x38')](_0x185d7e[_0xd425('0x37')]);_0x24da23[_0xd425('0x39')]=_[_0xd425('0x3a')](_0x24da23['model'],_0x24da23[_0xd425('0x37')]);_0x37b63c[_0xd425('0x3b')]=_['intersection'](_0x24da23['model'],qs['fields'](_0x185d7e[_0xd425('0x37')][_0xd425('0x3c')]));_0x37b63c[_0xd425('0x3b')]=_0x37b63c[_0xd425('0x3b')]['length']?_0x37b63c[_0xd425('0x3b')]:_0x24da23[_0xd425('0x35')];if(!_0x185d7e[_0xd425('0x37')][_0xd425('0x3d')](_0xd425('0x3e'))){_0x37b63c[_0xd425('0x23')]=qs[_0xd425('0x23')](_0x185d7e['query'][_0xd425('0x23')]);_0x37b63c['offset']=qs[_0xd425('0x21')](_0x185d7e[_0xd425('0x37')][_0xd425('0x21')]);}_0x37b63c['order']=qs[_0xd425('0x3f')](_0x185d7e[_0xd425('0x37')][_0xd425('0x3f')]);_0x37b63c[_0xd425('0x40')]=qs['filters'](_[_0xd425('0x41')](_0x185d7e[_0xd425('0x37')],_0x24da23['filters']),_0x482ba6);if(_0x185d7e['query']['filter']){_0x37b63c[_0xd425('0x40')]=_[_0xd425('0x42')](_0x37b63c[_0xd425('0x40')],{'$or':_['map'](_0x482ba6,function(_0x4f8323){if(_0x4f8323['type']!==_0xd425('0x43')){var _0x3f9090={};_0x3f9090[_0x4f8323[_0xd425('0x2c')]]={'$like':'%'+_0x185d7e[_0xd425('0x37')][_0xd425('0x44')]+'%'};return _0x3f9090;}})});}_0x37b63c=_[_0xd425('0x42')]({},_0x37b63c,_0x185d7e[_0xd425('0x45')]);var _0x4b922f={'where':_0x37b63c[_0xd425('0x40')]};return db[_0xd425('0x30')][_0xd425('0x24')](_0x4b922f)['then'](function(_0x3adc67){_0x1cac61[_0xd425('0x24')]=_0x3adc67;if(_0x185d7e[_0xd425('0x37')]['includeAll']){_0x37b63c[_0xd425('0x46')]=[{'all':!![]}];}return db[_0xd425('0x30')][_0xd425('0x47')](_0x37b63c);})[_0xd425('0x2a')](function(_0x5afd62){_0x1cac61[_0xd425('0x48')]=_0x5afd62;return _0x1cac61;})[_0xd425('0x2a')](respondWithFilteredResult(_0x2fd17a,_0x37b63c))[_0xd425('0x49')](handleError(_0x2fd17a,null));};exports[_0xd425('0x4a')]=function(_0x3f24fb,_0x2f6bf7){var _0x2d799b={'raw':![],'where':{'id':_0x3f24fb[_0xd425('0x4b')]['id']}},_0x524fad={};_0x524fad[_0xd425('0x35')]=_['keys'](db[_0xd425('0x30')]['rawAttributes']);_0x524fad['query']=_[_0xd425('0x38')](_0x3f24fb['query']);_0x524fad[_0xd425('0x39')]=_['intersection'](_0x524fad[_0xd425('0x35')],_0x524fad[_0xd425('0x37')]);_0x2d799b[_0xd425('0x3b')]=_[_0xd425('0x3a')](_0x524fad[_0xd425('0x35')],qs['fields'](_0x3f24fb[_0xd425('0x37')]['fields']));_0x2d799b[_0xd425('0x3b')]=_0x2d799b['attributes'][_0xd425('0x4c')]?_0x2d799b[_0xd425('0x3b')]:_0x524fad[_0xd425('0x35')];if(_0x3f24fb[_0xd425('0x37')][_0xd425('0x4d')]){_0x2d799b['include']=[{'all':!![]}];}_0x2d799b=_[_0xd425('0x42')]({},_0x2d799b,_0x3f24fb[_0xd425('0x45')]);return db[_0xd425('0x30')][_0xd425('0x4e')](_0x2d799b)[_0xd425('0x2a')](handleEntityNotFound(_0x2f6bf7,null))['then'](respondWithResult(_0x2f6bf7,null))[_0xd425('0x49')](handleError(_0x2f6bf7,null));};exports[_0xd425('0x4f')]=function(_0x1450f2,_0x2a2ab4){return db[_0xd425('0x30')][_0xd425('0x4f')](_0x1450f2['body'],{})[_0xd425('0x2a')](respondWithResult(_0x2a2ab4,0xc9))[_0xd425('0x49')](handleError(_0x2a2ab4,null));};exports['update']=function(_0x3f305,_0x42c084){if(_0x3f305[_0xd425('0x50')]['id']){delete _0x3f305[_0xd425('0x50')]['id'];}delete _0x3f305['body'][_0xd425('0x51')];delete _0x3f305[_0xd425('0x50')][_0xd425('0x52')];delete _0x3f305[_0xd425('0x50')][_0xd425('0x53')];delete _0x3f305['body']['value'];return db[_0xd425('0x30')]['find']({'where':{'id':_0x3f305[_0xd425('0x4b')]['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x42c084,null))['then'](saveUpdates(_0x3f305[_0xd425('0x50')],null))['then'](respondWithResult(_0x42c084,null))['catch'](handleError(_0x42c084,null));};exports[_0xd425('0x54')]=function(_0x111905,_0xe6451f){return db[_0xd425('0x30')][_0xd425('0x54')]()[_0xd425('0x2a')](respondWithResult(_0xe6451f,null))[_0xd425('0x49')](handleError(_0xe6451f,null));};exports[_0xd425('0x55')]=function(_0x54d437,_0x11ed71,_0x1c6141){var _0x1be9bb=require(_0xd425('0x56'));var _0x7b1080=![];var _0x1c80c2={};if(_0x54d437[_0xd425('0x37')][_0xd425('0x33')]&&_0x54d437['query']['type']==='uniqueid'){_0x1c80c2[_0xd425('0x57')]=_0x54d437[_0xd425('0x4b')]['id'];}else{_0x1c80c2['id']=_0x54d437[_0xd425('0x4b')]['id'];}return db[_0xd425('0x30')]['find']({'where':_0x1c80c2,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x11ed71,null))['then'](function(_0x254b8b){if(_0x254b8b){var _0x44c5e4=path['join'](config[_0xd425('0x58')],_0xd425('0x59'),_0x254b8b[_0xd425('0x5a')]);var _0x57e23e=util['format'](_0xd425('0x5b'),_0x44c5e4);if(fs['existsSync'](_0x57e23e)){_0x7b1080=!![];return _0x1be9bb['decryptFile'](_0x57e23e,_0x44c5e4,config['secrets'][_0xd425('0x5c')])[_0xd425('0x2a')](function(){return _0x254b8b;});}return _0x254b8b;}})[_0xd425('0x2a')](function(_0x5b2323){if(_0x5b2323){var _0x3395d8=path['join'](config[_0xd425('0x58')],_0xd425('0x59'),_0x5b2323[_0xd425('0x5a')]);if(!fs[_0xd425('0x5d')](_0x3395d8)){throw new db[(_0xd425('0x5e'))][(_0xd425('0x5f'))](_0xd425('0x60'));}if(_0x5b2323[_0xd425('0x61')]){return _0x11ed71[_0xd425('0x55')](_0x3395d8,_0x5b2323['filename']+path[_0xd425('0x62')](_0x3395d8),function(){if(_0x7b1080){fs[_0xd425('0x63')](_0x3395d8);}});}else{return _0x11ed71[_0xd425('0x55')](_0x3395d8,function(_0xf22906){if(_0x7b1080){fs['unlink'](_0x3395d8);}});}}})['catch'](function(_0x307e9a){if(_0x307e9a[_0xd425('0x64')]===_0xd425('0x60')){_0x11ed71[_0xd425('0x1f')](0x194)[_0xd425('0x2d')](_0xd425('0x65'));}else{return handleError(_0x11ed71,null);}});};exports[_0xd425('0x66')]=function(_0x44782a,_0x1fcde4){return db[_0xd425('0x30')][_0xd425('0x4e')]({'where':{'id':_0x44782a[_0xd425('0x4b')]['id']}})[_0xd425('0x2a')](function(_0x28979e){if(_['isNil'](_0x28979e)){throw new ReferenceError(_0xd425('0x67'));}return _0x28979e;})[_0xd425('0x2a')](function(_0xd2f2e8){var _0x4fd793=path['join'](config['root'],_0xd425('0x59'),_0xd2f2e8[_0xd425('0x5a')]);logger[_0xd425('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x4fd793);if(!_[_0xd425('0x69')](_0xd2f2e8['value'])&&fs[_0xd425('0x5d')](_0x4fd793)){logger[_0xd425('0x68')](_0xd425('0x6a')+_0x4fd793+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xd425('0x6b')](_0x4fd793);}_0x4fd793=_0x4fd793+_0xd425('0x6c');if(!_[_0xd425('0x69')](_0xd2f2e8[_0xd425('0x5a')])&&fs[_0xd425('0x5d')](_0x4fd793)){logger[_0xd425('0x68')](_0xd425('0x6a')+_0x4fd793+_0xd425('0x6d'));fs[_0xd425('0x6b')](_0x4fd793);}return _0xd2f2e8;})[_0xd425('0x2a')](function(_0x2ba77b){if(!_0x2ba77b)throw new InternalError();return _0x2ba77b[_0xd425('0x66')]();})[_0xd425('0x2a')](function(){_0x1fcde4[_0xd425('0x1f')](0xcc)[_0xd425('0x1e')]();})[_0xd425('0x49')](handleError(_0x1fcde4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 9c862f3..1b2cb9b 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 _0x0516=['exports','define','ScreenRecording','interactionid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes'];(function(_0x22d72b,_0x112e6d){var _0x35f65f=function(_0x23d67f){while(--_0x23d67f){_0x22d72b['push'](_0x22d72b['shift']());}};_0x35f65f(++_0x112e6d);}(_0x0516,0xa0));var _0x6051=function(_0x36feb2,_0x53abef){_0x36feb2=_0x36feb2-0x0;var _0x292b43=_0x0516[_0x36feb2];return _0x292b43;};'use strict';var _=require('lodash');var util=require(_0x6051('0x0'));var logger=require(_0x6051('0x1'))(_0x6051('0x2'));var moment=require(_0x6051('0x3'));var BPromise=require('bluebird');var rp=require(_0x6051('0x4'));var fs=require('fs');var path=require(_0x6051('0x5'));var rimraf=require(_0x6051('0x6'));var config=require(_0x6051('0x7'));var attributes=require(_0x6051('0x8'));module[_0x6051('0x9')]=function(_0x5b9787,_0x52b996){return _0x5b9787[_0x6051('0xa')](_0x6051('0xb'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x6051('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x333c=['interactionid','lodash','util','../../config/logger','api','moment','bluebird','path','./screenRecording.attributes','exports','define','screen_recordings'];(function(_0x3c4504,_0x381774){var _0x40f834=function(_0x9982a3){while(--_0x9982a3){_0x3c4504['push'](_0x3c4504['shift']());}};_0x40f834(++_0x381774);}(_0x333c,0x15d));var _0xc333=function(_0x52997e,_0x43b53c){_0x52997e=_0x52997e-0x0;var _0x3bb6b2=_0x333c[_0x52997e];return _0x3bb6b2;};'use strict';var _=require(_0xc333('0x0'));var util=require(_0xc333('0x1'));var logger=require(_0xc333('0x2'))(_0xc333('0x3'));var moment=require(_0xc333('0x4'));var BPromise=require(_0xc333('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc333('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc333('0x7'));module[_0xc333('0x8')]=function(_0x497bc8,_0x867d44){return _0x497bc8[_0xc333('0x9')]('ScreenRecording',attributes,{'tableName':_0xc333('0xa'),'paranoid':![],'indexes':[{'name':_0xc333('0xb'),'fields':[_0xc333('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 6bb7e8b..67de1a6 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 _0xb7db=['stringify','error','message','ScreenRecording,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s'];(function(_0x3d2580,_0x5bcf59){var _0x1bed34=function(_0x4838e5){while(--_0x4838e5){_0x3d2580['push'](_0x3d2580['shift']());}};_0x1bed34(++_0x5bcf59);}(_0xb7db,0x124));var _0xbb7d=function(_0x51fcb0,_0x13b180){_0x51fcb0=_0x51fcb0-0x0;var _0x27d846=_0xb7db[_0x51fcb0];return _0x27d846;};'use strict';var _=require(_0xbb7d('0x0'));var util=require(_0xbb7d('0x1'));var moment=require(_0xbb7d('0x2'));var BPromise=require(_0xbb7d('0x3'));var rs=require(_0xbb7d('0x4'));var fs=require('fs');var Redis=require(_0xbb7d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb7d('0x6'));var logger=require(_0xbb7d('0x7'))(_0xbb7d('0x8'));var config=require(_0xbb7d('0x9'));var jayson=require(_0xbb7d('0xa'));var client=jayson[_0xbb7d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47bb43,_0x22872e,_0x51e7b5){return new BPromise(function(_0x3fc777,_0x45fc17){return client['request'](_0x47bb43,_0x51e7b5)[_0xbb7d('0xc')](function(_0x17f3e7){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x22872e,_0xbb7d('0xd'));logger[_0xbb7d('0xe')](_0xbb7d('0xf'),_0x22872e,_0xbb7d('0xd'),JSON[_0xbb7d('0x10')](_0x17f3e7));if(_0x17f3e7[_0xbb7d('0x11')]){if(_0x17f3e7[_0xbb7d('0x11')]['code']===0x1f4){logger[_0xbb7d('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x22872e,_0x17f3e7[_0xbb7d('0x11')][_0xbb7d('0x12')]);return _0x45fc17(_0x17f3e7[_0xbb7d('0x11')]['message']);}logger['error'](_0xbb7d('0x13'),_0x22872e,_0x17f3e7['error'][_0xbb7d('0x12')]);return _0x3fc777(_0x17f3e7[_0xbb7d('0x11')][_0xbb7d('0x12')]);}else{logger[_0xbb7d('0x14')](_0xbb7d('0x13'),_0x22872e,'request\x20sent');_0x3fc777(_0x17f3e7[_0xbb7d('0x15')]['message']);}})['catch'](function(_0x2a047c){logger[_0xbb7d('0x11')](_0xbb7d('0x13'),_0x22872e,_0x2a047c);_0x45fc17(_0x2a047c);});});} \ No newline at end of file +var _0x044f=['jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','randomstring','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x3a7f48,_0x3d2c4b){var _0x2c1b35=function(_0x47ed20){while(--_0x47ed20){_0x3a7f48['push'](_0x3a7f48['shift']());}};_0x2c1b35(++_0x3d2c4b);}(_0x044f,0x118));var _0xf044=function(_0x2beeb9,_0x415c85){_0x2beeb9=_0x2beeb9-0x0;var _0x3f7f25=_0x044f[_0x2beeb9];return _0x3f7f25;};'use strict';var _=require(_0xf044('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf044('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf044('0x2'))['db'];var utils=require(_0xf044('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xf044('0x4'));var jayson=require(_0xf044('0x5'));var client=jayson[_0xf044('0x6')][_0xf044('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3ff946,_0x1eab42,_0x53de40){return new BPromise(function(_0x1b63b6,_0x21d2f4){return client[_0xf044('0x8')](_0x3ff946,_0x53de40)[_0xf044('0x9')](function(_0x1cb19d){logger[_0xf044('0xa')](_0xf044('0xb'),_0x1eab42,_0xf044('0xc'));logger[_0xf044('0xd')](_0xf044('0xe'),_0x1eab42,'request\x20sent',JSON[_0xf044('0xf')](_0x1cb19d));if(_0x1cb19d[_0xf044('0x10')]){if(_0x1cb19d[_0xf044('0x10')]['code']===0x1f4){logger['error'](_0xf044('0xb'),_0x1eab42,_0x1cb19d[_0xf044('0x10')]['message']);return _0x21d2f4(_0x1cb19d[_0xf044('0x10')][_0xf044('0x11')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x1eab42,_0x1cb19d[_0xf044('0x10')][_0xf044('0x11')]);return _0x1b63b6(_0x1cb19d[_0xf044('0x10')][_0xf044('0x11')]);}else{logger['info'](_0xf044('0xb'),_0x1eab42,_0xf044('0xc'));_0x1b63b6(_0x1cb19d[_0xf044('0x12')][_0xf044('0x11')]);}})['catch'](function(_0x5da90c){logger[_0xf044('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x1eab42,_0x5da90c);_0x21d2f4(_0x5da90c);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 3246b74..5fb0d97 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 _0x79f7=['originalname','post','single','file','addLogo','logologin','root','preferred','addPreferred','favicon','addFavicon','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/now','show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','diskStorage','join','server/files/images/logos/','format','%s%s','logo','extname'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x79f7,0x180));var _0x779f=function(_0xdc0e22,_0xac8be6){_0xdc0e22=_0xdc0e22-0x0;var _0x1c4344=_0x79f7[_0xdc0e22];return _0x1c4344;};'use strict';var multer=require(_0x779f('0x0'));var util=require(_0x779f('0x1'));var path=require(_0x779f('0x2'));var timeout=require(_0x779f('0x3'));var express=require(_0x779f('0x4'));var router=express[_0x779f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x779f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x779f('0x7')]('/',auth[_0x779f('0x8')](),controller[_0x779f('0x9')]);router['get'](_0x779f('0xa'),controller['getDate']);router[_0x779f('0x7')]('/:id',controller[_0x779f('0xb')]);router[_0x779f('0x7')](_0x779f('0xc'),controller[_0x779f('0xd')]);router[_0x779f('0x7')](_0x779f('0xe'),controller['getLogoLogin']);router[_0x779f('0x7')](_0x779f('0xf'),controller[_0x779f('0x10')]);router[_0x779f('0x7')](_0x779f('0x11'),controller['getPreferred']);router['get'](_0x779f('0x12'),controller['getFavicon']);var upload=multer({'storage':multer[_0x779f('0x13')]({'destination':function(_0x171130,_0x599464,_0x463e52){_0x463e52(null,path[_0x779f('0x14')](config['root'],_0x779f('0x15')));},'filename':function(_0x2563e4,_0x3f1247,_0x583178){_0x583178(null,util[_0x779f('0x16')](_0x779f('0x17'),_0x779f('0x18'),path[_0x779f('0x19')](_0x3f1247[_0x779f('0x1a')])));}})});router[_0x779f('0x1b')]('/:id/logo',upload[_0x779f('0x1c')](_0x779f('0x1d')),controller[_0x779f('0x1e')]);var upload=multer({'storage':multer[_0x779f('0x13')]({'destination':function(_0x5c784e,_0x8b2b1d,_0x2dd8e1){_0x2dd8e1(null,path[_0x779f('0x14')](config['root'],_0x779f('0x15')));},'filename':function(_0x250ed9,_0x1af716,_0x1f9960){_0x1f9960(null,util['format'](_0x779f('0x17'),_0x779f('0x1f'),path[_0x779f('0x19')](_0x1af716[_0x779f('0x1a')])));}})});router[_0x779f('0x1b')](_0x779f('0xe'),upload[_0x779f('0x1c')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x217294,_0x3dfd49,_0x50e486){_0x50e486(null,path[_0x779f('0x14')](config[_0x779f('0x20')],_0x779f('0x15')));},'filename':function(_0x28d2f5,_0x17e1ef,_0x36712d){_0x36712d(null,util[_0x779f('0x16')](_0x779f('0x17'),_0x779f('0x21'),path[_0x779f('0x19')](_0x17e1ef[_0x779f('0x1a')])));}})});router['post'](_0x779f('0x11'),upload[_0x779f('0x1c')](_0x779f('0x1d')),controller[_0x779f('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x48589d,_0x4bb6ec,_0x399e40){_0x399e40(null,path[_0x779f('0x14')](config[_0x779f('0x20')],_0x779f('0x15')));},'filename':function(_0x557645,_0x2906e7,_0x29eead){_0x29eead(null,util['format'](_0x779f('0x17'),_0x779f('0x23'),path[_0x779f('0x19')](_0x2906e7[_0x779f('0x1a')])));}})});router[_0x779f('0x1b')]('/:id/favicon',upload[_0x779f('0x1c')](_0x779f('0x1d')),controller[_0x779f('0x24')]);router[_0x779f('0x25')](_0x779f('0x26'),auth['isAuthenticated'](),controller[_0x779f('0x27')]);module[_0x779f('0x28')]=router; \ No newline at end of file +var _0x6477=['index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','extname','originalname','post','single','diskStorage','%s%s','logologin','file','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated'];(function(_0x22c93c,_0x5139cc){var _0x46d24a=function(_0x9e862c){while(--_0x9e862c){_0x22c93c['push'](_0x22c93c['shift']());}};_0x46d24a(++_0x5139cc);}(_0x6477,0x1b8));var _0x7647=function(_0x2755fb,_0x5970f1){_0x2755fb=_0x2755fb-0x0;var _0x293f12=_0x6477[_0x2755fb];return _0x293f12;};'use strict';var multer=require(_0x7647('0x0'));var util=require(_0x7647('0x1'));var path=require('path');var timeout=require(_0x7647('0x2'));var express=require('express');var router=express[_0x7647('0x3')]();var fs_extra=require(_0x7647('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7647('0x5'));var config=require(_0x7647('0x6'));var controller=require(_0x7647('0x7'));router[_0x7647('0x8')]('/',auth[_0x7647('0x9')](),controller[_0x7647('0xa')]);router[_0x7647('0x8')](_0x7647('0xb'),controller[_0x7647('0xc')]);router[_0x7647('0x8')](_0x7647('0xd'),controller[_0x7647('0xe')]);router[_0x7647('0x8')](_0x7647('0xf'),controller[_0x7647('0x10')]);router[_0x7647('0x8')](_0x7647('0x11'),controller[_0x7647('0x12')]);router[_0x7647('0x8')](_0x7647('0x13'),controller[_0x7647('0x14')]);router[_0x7647('0x8')](_0x7647('0x15'),controller[_0x7647('0x16')]);router[_0x7647('0x8')](_0x7647('0x17'),controller[_0x7647('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5575de,_0x4072fb,_0x1c67f0){_0x1c67f0(null,path[_0x7647('0x19')](config[_0x7647('0x1a')],_0x7647('0x1b')));},'filename':function(_0x506b55,_0x2abcb0,_0x1a54b6){_0x1a54b6(null,util[_0x7647('0x1c')]('%s%s','logo',path[_0x7647('0x1d')](_0x2abcb0[_0x7647('0x1e')])));}})});router[_0x7647('0x1f')](_0x7647('0xf'),upload[_0x7647('0x20')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x7647('0x21')]({'destination':function(_0x4bd8b8,_0x48f7bd,_0x5d0a69){_0x5d0a69(null,path[_0x7647('0x19')](config['root'],_0x7647('0x1b')));},'filename':function(_0x5f1f52,_0xfda3df,_0x7952c0){_0x7952c0(null,util[_0x7647('0x1c')](_0x7647('0x22'),_0x7647('0x23'),path[_0x7647('0x1d')](_0xfda3df[_0x7647('0x1e')])));}})});router['post'](_0x7647('0x11'),upload[_0x7647('0x20')](_0x7647('0x24')),controller[_0x7647('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xcd9c04,_0x40a367,_0x330c26){_0x330c26(null,path['join'](config[_0x7647('0x1a')],_0x7647('0x1b')));},'filename':function(_0x3dd141,_0x517a80,_0x4daab2){_0x4daab2(null,util[_0x7647('0x1c')](_0x7647('0x22'),_0x7647('0x26'),path[_0x7647('0x1d')](_0x517a80[_0x7647('0x1e')])));}})});router[_0x7647('0x1f')](_0x7647('0x15'),upload[_0x7647('0x20')](_0x7647('0x24')),controller[_0x7647('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2fd6ef,_0x4c0d3b,_0x4be81a){_0x4be81a(null,path['join'](config[_0x7647('0x1a')],_0x7647('0x1b')));},'filename':function(_0x7af15f,_0x1fafc0,_0x431635){_0x431635(null,util[_0x7647('0x1c')](_0x7647('0x22'),_0x7647('0x28'),path[_0x7647('0x1d')](_0x1fafc0['originalname'])));}})});router[_0x7647('0x1f')](_0x7647('0x17'),upload['single'](_0x7647('0x24')),controller[_0x7647('0x29')]);router[_0x7647('0x2a')](_0x7647('0xd'),auth['isAuthenticated'](),controller[_0x7647('0x2b')]);module[_0x7647('0x2c')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 6cacd58..252ab85 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 _0x5f2f=['INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','alternate','UNSIGNED','sequelize','exports'];(function(_0x14fb7e,_0x5a58c3){var _0x45bfbd=function(_0x2d9fe3){while(--_0x2d9fe3){_0x14fb7e['push'](_0x14fb7e['shift']());}};_0x45bfbd(++_0x5a58c3);}(_0x5f2f,0x73));var _0xf5f2=function(_0xfe488b,_0xd4afef){_0xfe488b=_0xfe488b-0x0;var _0x348d03=_0x5f2f[_0xfe488b];return _0x348d03;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'min_internal':{'type':Sequelize[_0xf5f2('0x2')](0xb),'unique':_0xf5f2('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xf5f2('0x2')](0xb),'unique':_0xf5f2('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xf5f2('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xf5f2('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xf5f2('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xf5f2('0x5')]},'turnaddr':{'type':Sequelize[_0xf5f2('0x5')]},'turnusername':{'type':Sequelize[_0xf5f2('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xf5f2('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':_0xf5f2('0x7')},'chatTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xf5f2('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xf5f2('0x2')]},'transcribeRegion':{'type':Sequelize[_0xf5f2('0x5')]},'sentiment':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xf5f2('0x2')]},'sentimentRegion':{'type':Sequelize[_0xf5f2('0x5')]},'language':{'type':Sequelize[_0xf5f2('0x5')]},'bucket':{'type':Sequelize[_0xf5f2('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xf5f2('0x2')](0x2)[_0xf5f2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xf5f2('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xf5f2('0x2')](0x2)[_0xf5f2('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xadb5=['https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','exports','min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x5beda8,_0x1e8554){var _0x2aa042=function(_0x510f45){while(--_0x510f45){_0x5beda8['push'](_0x5beda8['shift']());}};_0x2aa042(++_0x1e8554);}(_0xadb5,0xad));var _0x5adb=function(_0x123f3f,_0xb7150d){_0x123f3f=_0x123f3f-0x0;var _0x67e2f6=_0xadb5[_0x123f3f];return _0x67e2f6;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x5adb('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5adb('0x2')](0xb),'unique':_0x5adb('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x5adb('0x4')],'defaultValue':_0x5adb('0x5')},'logo':{'type':Sequelize[_0x5adb('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x5adb('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x5adb('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x5adb('0x4')]},'turnaddr':{'type':Sequelize[_0x5adb('0x4')]},'turnusername':{'type':Sequelize[_0x5adb('0x4')]},'turnpassword':{'type':Sequelize[_0x5adb('0x4')]},'pageTitle':{'type':Sequelize[_0x5adb('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x5adb('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x5adb('0x7')},'enableEmailPreview':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5adb('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5adb('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5adb('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x5adb('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5adb('0x2')]},'transcribeRegion':{'type':Sequelize[_0x5adb('0x4')]},'sentiment':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5adb('0x2')]},'sentimentRegion':{'type':Sequelize[_0x5adb('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x5adb('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x5adb('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x5adb('0x2')](0x2)[_0x5adb('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x5adb('0x2')](0x2)[_0x5adb('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index dd3c0ae..b9be1b1 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 _0xea12=['error','code','message','info','result','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','stack','name','send','index','Setting','rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','params','keys','intersection','find','body','addLogo','file','filename','server/files/images/logos','getLicense','logo','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','toLower','join','root','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','getLogoLogin','default_loginLogo.svg','\x20not\x20found','download','gdpr','addPreferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','client','http','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xea12,0x149));var _0x2ea1=function(_0x233817,_0x32c610){_0x233817=_0x233817-0x0;var _0x26b56a=_0xea12[_0x233817];return _0x26b56a;};'use strict';var emlformat=require(_0x2ea1('0x0'));var rimraf=require(_0x2ea1('0x1'));var zipdir=require(_0x2ea1('0x2'));var jsonpatch=require(_0x2ea1('0x3'));var rp=require(_0x2ea1('0x4'));var moment=require(_0x2ea1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2ea1('0x6'));var util=require(_0x2ea1('0x7'));var path=require('path');var sox=require(_0x2ea1('0x8'));var csv=require(_0x2ea1('0x9'));var ejs=require(_0x2ea1('0xa'));var fs=require('fs');var fs_extra=require(_0x2ea1('0xb'));var _=require('lodash');var squel=require(_0x2ea1('0xc'));var crypto=require(_0x2ea1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2ea1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2ea1('0xf'));var Papa=require(_0x2ea1('0x10'));var Redis=require(_0x2ea1('0x11'));var authService=require(_0x2ea1('0x12'));var qs=require(_0x2ea1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ea1('0x14'));var logger=require(_0x2ea1('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2ea1('0x16'));var licenseUtil=require(_0x2ea1('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x2ea1('0x18')][_0x2ea1('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x494530,_0xe9fcc1,_0x44e2a9,_0x35f4a2){return new BPromise(function(_0x38ebd5,_0x228acb){var _0x43700a=_0x35f4a2||client;return _0x43700a['request'](_0x494530,_0x44e2a9)[_0x2ea1('0x1a')](function(_0x4ac5ff){logger['info'](_0x2ea1('0x1b'),_0xe9fcc1,_0x2ea1('0x1c'));logger[_0x2ea1('0x1d')](_0x2ea1('0x1e'),_0xe9fcc1,_0x2ea1('0x1c'),JSON['stringify'](_0x4ac5ff));if(_0x4ac5ff[_0x2ea1('0x1f')]){if(_0x4ac5ff[_0x2ea1('0x1f')][_0x2ea1('0x20')]===0x1f4){logger[_0x2ea1('0x1f')](_0x2ea1('0x1b'),_0xe9fcc1,_0x4ac5ff['error'][_0x2ea1('0x21')]);return _0x228acb(_0x4ac5ff[_0x2ea1('0x1f')]['message']);}logger[_0x2ea1('0x1f')]('Setting,\x20%s,\x20%s',_0xe9fcc1,_0x4ac5ff[_0x2ea1('0x1f')][_0x2ea1('0x21')]);return _0x38ebd5(_0x4ac5ff[_0x2ea1('0x1f')][_0x2ea1('0x21')]);}else{logger[_0x2ea1('0x22')](_0x2ea1('0x1b'),_0xe9fcc1,'request\x20sent');_0x38ebd5(_0x4ac5ff[_0x2ea1('0x23')][_0x2ea1('0x21')]);}})[_0x2ea1('0x24')](function(_0x4e128c){logger[_0x2ea1('0x1f')](_0x2ea1('0x1b'),_0xe9fcc1,_0x4e128c);_0x228acb(_0x4e128c);});});}function respondWithStatusCode(_0x3244eb,_0xa7ee3a){_0xa7ee3a=_0xa7ee3a||0xcc;return function(_0x1ef4fa){if(_0x1ef4fa){return _0x3244eb[_0x2ea1('0x25')](_0xa7ee3a);}return _0x3244eb[_0x2ea1('0x26')](_0xa7ee3a)[_0x2ea1('0x27')]();};}function respondWithResult(_0x3abc83,_0x251e06){_0x251e06=_0x251e06||0xc8;return function(_0x510566){if(_0x510566){return _0x3abc83[_0x2ea1('0x26')](_0x251e06)[_0x2ea1('0x28')](_0x510566);}};}function respondWithFilteredResult(_0x38df05,_0x44708b){return function(_0x2a1748){if(_0x2a1748){var _0x1550cf=typeof _0x44708b['offset']===_0x2ea1('0x29')&&typeof _0x44708b['limit']===_0x2ea1('0x29');var _0x37ac28=_0x2a1748[_0x2ea1('0x2a')];var _0x53be81=_0x1550cf?0x0:_0x44708b[_0x2ea1('0x2b')];var _0x2fce41=_0x1550cf?_0x2a1748[_0x2ea1('0x2a')]:_0x44708b[_0x2ea1('0x2b')]+_0x44708b['limit'];var _0x1ed62a;if(_0x2fce41>=_0x37ac28){_0x2fce41=_0x37ac28;_0x1ed62a=0xc8;}else{_0x1ed62a=0xce;}_0x38df05[_0x2ea1('0x26')](_0x1ed62a);return _0x38df05[_0x2ea1('0x2c')](_0x2ea1('0x2d'),_0x53be81+'-'+_0x2fce41+'/'+_0x37ac28)[_0x2ea1('0x28')](_0x2a1748);}return null;};}function patchUpdates(_0x308714){return function(_0x18039b){try{jsonpatch[_0x2ea1('0x2e')](_0x18039b,_0x308714,!![]);}catch(_0x3efabd){return BPromise[_0x2ea1('0x2f')](_0x3efabd);}return _0x18039b[_0x2ea1('0x30')]();};}function saveUpdates(_0x23abc9,_0x5af312){return function(_0x23a672){if(_0x23a672){return _0x23a672['update'](_0x23abc9)['then'](function(_0x4c175b){return _0x4c175b;});}return null;};}function removeEntity(_0x53af1f,_0x22934a){return function(_0x26c33f){if(_0x26c33f){return _0x26c33f['destroy']()[_0x2ea1('0x1a')](function(){_0x53af1f[_0x2ea1('0x26')](0xcc)[_0x2ea1('0x27')]();});}};}function handleEntityNotFound(_0x308d1d,_0x4b7c06){return function(_0x333549){if(!_0x333549){_0x308d1d['sendStatus'](0x194);}return _0x333549;};}function handleError(_0x4a7ede,_0x5ea9fd){_0x5ea9fd=_0x5ea9fd||0x1f4;return function(_0x1c0ba7){logger[_0x2ea1('0x1f')](_0x1c0ba7[_0x2ea1('0x31')]);if(_0x1c0ba7['name']){delete _0x1c0ba7[_0x2ea1('0x32')];}_0x4a7ede[_0x2ea1('0x26')](_0x5ea9fd)[_0x2ea1('0x33')](_0x1c0ba7);};}exports[_0x2ea1('0x34')]=function(_0x36e6d1,_0x4b7099){var _0x13df9f={},_0x5363d7={},_0x4532dd={'count':0x0,'rows':[]};var _0x43750a=_['map'](db[_0x2ea1('0x35')][_0x2ea1('0x36')],function(_0x499e6f){return{'name':_0x499e6f['fieldName'],'type':_0x499e6f[_0x2ea1('0x37')][_0x2ea1('0x38')]};});_0x5363d7[_0x2ea1('0x39')]=_['map'](_0x43750a,_0x2ea1('0x32'));_0x5363d7[_0x2ea1('0x3a')]=_['keys'](_0x36e6d1['query']);_0x5363d7[_0x2ea1('0x3b')]=_['intersection'](_0x5363d7[_0x2ea1('0x39')],_0x5363d7['query']);_0x13df9f[_0x2ea1('0x3c')]=_['intersection'](_0x5363d7[_0x2ea1('0x39')],qs[_0x2ea1('0x3d')](_0x36e6d1[_0x2ea1('0x3a')]['fields']));_0x13df9f['attributes']=_0x13df9f[_0x2ea1('0x3c')][_0x2ea1('0x3e')]?_0x13df9f['attributes']:_0x5363d7['model'];if(!_0x36e6d1[_0x2ea1('0x3a')][_0x2ea1('0x3f')]('nolimit')){_0x13df9f[_0x2ea1('0x40')]=qs[_0x2ea1('0x40')](_0x36e6d1[_0x2ea1('0x3a')][_0x2ea1('0x40')]);_0x13df9f['offset']=qs[_0x2ea1('0x2b')](_0x36e6d1[_0x2ea1('0x3a')][_0x2ea1('0x2b')]);}_0x13df9f['order']=qs[_0x2ea1('0x41')](_0x36e6d1[_0x2ea1('0x3a')][_0x2ea1('0x41')]);_0x13df9f[_0x2ea1('0x42')]=qs[_0x2ea1('0x3b')](_[_0x2ea1('0x43')](_0x36e6d1[_0x2ea1('0x3a')],_0x5363d7[_0x2ea1('0x3b')]),_0x43750a);if(_0x36e6d1[_0x2ea1('0x3a')][_0x2ea1('0x44')]){_0x13df9f[_0x2ea1('0x42')]=_[_0x2ea1('0x45')](_0x13df9f[_0x2ea1('0x42')],{'$or':_[_0x2ea1('0x46')](_0x43750a,function(_0x19710a){if(_0x19710a['type']!==_0x2ea1('0x47')){var _0x30d387={};_0x30d387[_0x19710a['name']]={'$like':'%'+_0x36e6d1[_0x2ea1('0x3a')][_0x2ea1('0x44')]+'%'};return _0x30d387;}})});}_0x13df9f=_['merge']({},_0x13df9f,_0x36e6d1[_0x2ea1('0x48')]);var _0x4e944b={'where':_0x13df9f[_0x2ea1('0x42')]};return db[_0x2ea1('0x35')][_0x2ea1('0x2a')](_0x4e944b)[_0x2ea1('0x1a')](function(_0x14aebb){_0x4532dd[_0x2ea1('0x2a')]=_0x14aebb;if(_0x36e6d1[_0x2ea1('0x3a')][_0x2ea1('0x49')]){_0x13df9f[_0x2ea1('0x4a')]=[{'all':!![]}];}return db[_0x2ea1('0x35')]['findAll'](_0x13df9f);})['then'](function(_0x59abc0){_0x4532dd[_0x2ea1('0x4b')]=_0x59abc0;return _0x4532dd;})[_0x2ea1('0x1a')](respondWithFilteredResult(_0x4b7099,_0x13df9f))['catch'](handleError(_0x4b7099,null));};exports[_0x2ea1('0x4c')]=function(_0x2c9e6c,_0x3522c1){var _0x2dda42={'raw':![],'where':{'id':_0x2c9e6c[_0x2ea1('0x4d')]['id']}},_0x1a261d={};_0x1a261d['model']=_[_0x2ea1('0x4e')](db[_0x2ea1('0x35')][_0x2ea1('0x36')]);_0x1a261d['query']=_['keys'](_0x2c9e6c[_0x2ea1('0x3a')]);_0x1a261d[_0x2ea1('0x3b')]=_[_0x2ea1('0x4f')](_0x1a261d['model'],_0x1a261d[_0x2ea1('0x3a')]);_0x2dda42[_0x2ea1('0x3c')]=_[_0x2ea1('0x4f')](_0x1a261d[_0x2ea1('0x39')],qs['fields'](_0x2c9e6c['query']['fields']));_0x2dda42[_0x2ea1('0x3c')]=_0x2dda42[_0x2ea1('0x3c')][_0x2ea1('0x3e')]?_0x2dda42[_0x2ea1('0x3c')]:_0x1a261d[_0x2ea1('0x39')];if(_0x2c9e6c['query']['includeAll']){_0x2dda42[_0x2ea1('0x4a')]=[{'all':!![]}];}_0x2dda42=_[_0x2ea1('0x45')]({},_0x2dda42,_0x2c9e6c['options']);return db['Setting'][_0x2ea1('0x50')](_0x2dda42)['then'](handleEntityNotFound(_0x3522c1,null))[_0x2ea1('0x1a')](respondWithResult(_0x3522c1,null))[_0x2ea1('0x24')](handleError(_0x3522c1,null));};exports['update']=function(_0x1f24ca,_0x1cfe19){if(_0x1f24ca[_0x2ea1('0x51')]['id']){delete _0x1f24ca['body']['id'];}return db[_0x2ea1('0x35')]['find']({'where':{'id':_0x1f24ca[_0x2ea1('0x4d')]['id']}})[_0x2ea1('0x1a')](handleEntityNotFound(_0x1cfe19,null))['then'](saveUpdates(_0x1f24ca['body'],null))[_0x2ea1('0x1a')](respondWithResult(_0x1cfe19,null))[_0x2ea1('0x24')](handleError(_0x1cfe19,null));};exports[_0x2ea1('0x52')]=function(_0x4367fd,_0x4a62fd,_0x2095b9){if(_0x4367fd['file']&&_0x4367fd[_0x2ea1('0x53')][_0x2ea1('0x54')]){_0x4367fd[_0x2ea1('0x51')]['logo']=_0x4367fd[_0x2ea1('0x53')]['filename'];}return db[_0x2ea1('0x35')]['find']({'where':{'id':_0x4367fd['params']['id']}})[_0x2ea1('0x1a')](handleEntityNotFound(_0x4a62fd,null))[_0x2ea1('0x1a')](saveUpdates(_0x4367fd[_0x2ea1('0x51')],null))['then'](respondWithResult(_0x4a62fd,null))[_0x2ea1('0x24')](handleError(_0x4a62fd,null));};exports['addLogoLogin']=function(_0x5cec64,_0x39930c,_0x4b739f){if(_0x5cec64[_0x2ea1('0x53')]&&_0x5cec64[_0x2ea1('0x53')][_0x2ea1('0x54')]){_0x5cec64[_0x2ea1('0x51')]['loginLogo']=_0x5cec64[_0x2ea1('0x53')][_0x2ea1('0x54')];}return db['Setting'][_0x2ea1('0x50')]({'where':{'id':_0x5cec64[_0x2ea1('0x4d')]['id']}})[_0x2ea1('0x1a')](handleEntityNotFound(_0x39930c,null))[_0x2ea1('0x1a')](saveUpdates(_0x5cec64[_0x2ea1('0x51')],null))[_0x2ea1('0x1a')](respondWithResult(_0x39930c,null))[_0x2ea1('0x24')](handleError(_0x39930c,null));};var utilLicense=require(_0x2ea1('0x17'));exports['getLogo']=function(_0x30a13a,_0x8df873,_0x1df1f6){var _0x3dd7bb=_0x2ea1('0x55');var _0x17f80c={'custom':![]};return utilLicense[_0x2ea1('0x56')]()[_0x2ea1('0x1a')](function(_0x17528c){if(_0x17528c){_0x17f80c=_0x17528c;}return db['Setting'][_0x2ea1('0x50')]({'where':{'id':_0x30a13a[_0x2ea1('0x4d')]['id']},'attributes':[_0x2ea1('0x57'),_0x2ea1('0x58'),_0x2ea1('0x59'),_0x2ea1('0x5a'),_0x2ea1('0x5b'),_0x2ea1('0x5c'),_0x2ea1('0x5d'),_0x2ea1('0x5e')],'raw':!![]});})[_0x2ea1('0x1a')](handleEntityNotFound(_0x8df873,null))['then'](function(_0x555130){if(_0x555130){var _0x3911e7=_0x555130['logo']&&fs[_0x2ea1('0x5f')](path['join'](config['root'],_0x3dd7bb,_[_0x2ea1('0x60')](_0x555130['logo'])))?path[_0x2ea1('0x61')](config[_0x2ea1('0x62')],_0x3dd7bb,_['toLower'](_0x555130[_0x2ea1('0x57')])):path[_0x2ea1('0x61')](config[_0x2ea1('0x62')],_0x3dd7bb,_['toLower'](_0x2ea1('0x63')));var _0x416c68=_0x2ea1('0x64')+_[_0x2ea1('0x65')]('logo');if(_0x555130[_0x416c68]||!_0x17f80c[_0x2ea1('0x66')]){_0x3911e7=path[_0x2ea1('0x61')](config[_0x2ea1('0x62')],_0x3dd7bb,_[_0x2ea1('0x60')](_0x2ea1('0x63')));}if(!fs[_0x2ea1('0x5f')](_0x3911e7)){throw new db[(_0x2ea1('0x67'))][(_0x2ea1('0x68'))](_['upperFirst'](_0x2ea1('0x57'))+'\x20not\x20found');}return _0x8df873['download'](_0x3911e7);}})[_0x2ea1('0x24')](handleError(_0x8df873,null));};var utilLicense=require(_0x2ea1('0x17'));exports[_0x2ea1('0x69')]=function(_0x3892e3,_0x41d437,_0x656bbe){var _0x22ea3f='server/files/images/logos';var _0x2cdcd3={'custom':![]};return utilLicense['getLicense']()[_0x2ea1('0x1a')](function(_0x37c8c5){if(_0x37c8c5){_0x2cdcd3=_0x37c8c5;}return db['Setting'][_0x2ea1('0x50')]({'where':{'id':_0x3892e3[_0x2ea1('0x4d')]['id']},'attributes':[_0x2ea1('0x57'),'loginLogo',_0x2ea1('0x59'),_0x2ea1('0x5a'),'defaultLogo',_0x2ea1('0x5c'),_0x2ea1('0x5d'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x41d437,null))[_0x2ea1('0x1a')](function(_0x21eb23){if(_0x21eb23){var _0x1a4072=_0x21eb23[_0x2ea1('0x58')]&&fs[_0x2ea1('0x5f')](path[_0x2ea1('0x61')](config['root'],_0x22ea3f,_['toLower'](_0x21eb23['loginLogo'])))?path[_0x2ea1('0x61')](config['root'],_0x22ea3f,_[_0x2ea1('0x60')](_0x21eb23[_0x2ea1('0x58')])):path[_0x2ea1('0x61')](config[_0x2ea1('0x62')],_0x22ea3f,_[_0x2ea1('0x60')](_0x2ea1('0x6a')));var _0x15738e=_0x2ea1('0x64')+_[_0x2ea1('0x65')]('loginLogo');if(_0x21eb23[_0x15738e]||!_0x2cdcd3['custom']){_0x1a4072=path[_0x2ea1('0x61')](config['root'],_0x22ea3f,_[_0x2ea1('0x60')]('default_loginLogo.svg'));}if(!fs[_0x2ea1('0x5f')](_0x1a4072)){throw new db[(_0x2ea1('0x67'))][(_0x2ea1('0x68'))](_['upperFirst'](_0x2ea1('0x58'))+_0x2ea1('0x6b'));}return _0x41d437[_0x2ea1('0x6c')](_0x1a4072);}})['catch'](handleError(_0x41d437,null));};exports[_0x2ea1('0x6d')]=function(_0x15970f,_0x3aa3cf){return db[_0x2ea1('0x35')]['find']({'where':{'id':_0x15970f[_0x2ea1('0x4d')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x3aa3cf,null))[_0x2ea1('0x24')](handleError(_0x3aa3cf,null));};exports[_0x2ea1('0x6e')]=function(_0xb3008a,_0x43c01c,_0x52f97c){if(_0xb3008a[_0x2ea1('0x53')]&&_0xb3008a[_0x2ea1('0x53')]['filename']){_0xb3008a['body']['preferred']=_0xb3008a['file']['filename'];}return db[_0x2ea1('0x35')][_0x2ea1('0x50')]({'where':{'id':_0xb3008a[_0x2ea1('0x4d')]['id']}})[_0x2ea1('0x1a')](handleEntityNotFound(_0x43c01c,null))['then'](saveUpdates(_0xb3008a[_0x2ea1('0x51')],null))[_0x2ea1('0x1a')](respondWithResult(_0x43c01c,null))['catch'](handleError(_0x43c01c,null));};var utilLicense=require('../../config/license/util');exports[_0x2ea1('0x6f')]=function(_0x1dfea9,_0xe70c27,_0x4a4e98){var _0x9a3eb6=_0x2ea1('0x55');var _0x2ffe17={'custom':![]};return utilLicense[_0x2ea1('0x56')]()[_0x2ea1('0x1a')](function(_0x49090e){if(_0x49090e){_0x2ffe17=_0x49090e;}return db['Setting'][_0x2ea1('0x50')]({'where':{'id':_0x1dfea9[_0x2ea1('0x4d')]['id']},'attributes':[_0x2ea1('0x57'),_0x2ea1('0x58'),_0x2ea1('0x59'),_0x2ea1('0x5a'),_0x2ea1('0x5b'),'defaultLoginLogo','defaultPreferred',_0x2ea1('0x5e')],'raw':!![]});})[_0x2ea1('0x1a')](handleEntityNotFound(_0xe70c27,null))[_0x2ea1('0x1a')](function(_0x20813f){if(_0x20813f){var _0x233217=_0x20813f['preferred']&&fs[_0x2ea1('0x5f')](path[_0x2ea1('0x61')](config[_0x2ea1('0x62')],_0x9a3eb6,_[_0x2ea1('0x60')](_0x20813f['preferred'])))?path[_0x2ea1('0x61')](config[_0x2ea1('0x62')],_0x9a3eb6,_[_0x2ea1('0x60')](_0x20813f[_0x2ea1('0x59')])):path[_0x2ea1('0x61')](config['root'],_0x9a3eb6,_[_0x2ea1('0x60')](_0x2ea1('0x70')));var _0x5e1086=_0x2ea1('0x64')+_[_0x2ea1('0x65')](_0x2ea1('0x59'));if(_0x20813f[_0x5e1086]||!_0x2ffe17['custom']||!_0x2ffe17[_0x2ea1('0x59')]){_0x233217=path[_0x2ea1('0x61')](config[_0x2ea1('0x62')],_0x9a3eb6,_[_0x2ea1('0x60')](_0x2ea1('0x70')));}if(!fs[_0x2ea1('0x5f')](_0x233217)){throw new db[(_0x2ea1('0x67'))]['ValidationError'](_[_0x2ea1('0x65')](_0x2ea1('0x59'))+_0x2ea1('0x6b'));}return _0xe70c27['download'](_0x233217);}})['catch'](handleError(_0xe70c27,null));};exports['addFavicon']=function(_0x3e0995,_0x390453,_0x1b2021){if(_0x3e0995[_0x2ea1('0x53')]&&_0x3e0995[_0x2ea1('0x53')][_0x2ea1('0x54')]){_0x3e0995[_0x2ea1('0x51')]['favicon']=_0x3e0995['file'][_0x2ea1('0x54')];}return db[_0x2ea1('0x35')][_0x2ea1('0x50')]({'where':{'id':_0x3e0995[_0x2ea1('0x4d')]['id']}})[_0x2ea1('0x1a')](handleEntityNotFound(_0x390453,null))['then'](saveUpdates(_0x3e0995[_0x2ea1('0x51')],null))[_0x2ea1('0x1a')](respondWithResult(_0x390453,null))[_0x2ea1('0x24')](handleError(_0x390453,null));};var utilLicense=require('../../config/license/util');exports[_0x2ea1('0x71')]=function(_0x1b2827,_0x4839dc,_0x35804d){var _0x1146e3=_0x2ea1('0x55');var _0x49ca0a={'custom':![]};return utilLicense[_0x2ea1('0x56')]()[_0x2ea1('0x1a')](function(_0x36590e){if(_0x36590e){_0x49ca0a=_0x36590e;}return db[_0x2ea1('0x35')][_0x2ea1('0x50')]({'where':{'id':_0x1b2827[_0x2ea1('0x4d')]['id']},'attributes':[_0x2ea1('0x57'),_0x2ea1('0x58'),_0x2ea1('0x59'),_0x2ea1('0x5a'),'defaultLogo',_0x2ea1('0x5c'),'defaultPreferred',_0x2ea1('0x5e')],'raw':!![]});})[_0x2ea1('0x1a')](handleEntityNotFound(_0x4839dc,null))[_0x2ea1('0x1a')](function(_0x597094){if(_0x597094){var _0x167c60=_0x597094[_0x2ea1('0x5a')]&&fs[_0x2ea1('0x5f')](path[_0x2ea1('0x61')](config['root'],_0x1146e3,_[_0x2ea1('0x60')](_0x597094['favicon'])))?path['join'](config[_0x2ea1('0x62')],_0x1146e3,_['toLower'](_0x597094[_0x2ea1('0x5a')])):path[_0x2ea1('0x61')](config[_0x2ea1('0x62')],_0x1146e3,_[_0x2ea1('0x60')](_0x2ea1('0x72')));var _0x442027=_0x2ea1('0x64')+_[_0x2ea1('0x65')](_0x2ea1('0x5a'));if(_0x597094[_0x442027]||!_0x49ca0a['custom']){_0x167c60=path['join'](config['root'],_0x1146e3,_[_0x2ea1('0x60')]('default_favicon.ico'));}if(!fs[_0x2ea1('0x5f')](_0x167c60)){throw new db[(_0x2ea1('0x67'))][(_0x2ea1('0x68'))](_['upperFirst'](_0x2ea1('0x5a'))+'\x20not\x20found');}return _0x4839dc[_0x2ea1('0x6c')](_0x167c60);}})[_0x2ea1('0x24')](handleError(_0x4839dc,null));};exports[_0x2ea1('0x73')]=function(_0x1307e9,_0x154deb){var _0x1e550c={'offset':moment()[_0x2ea1('0x74')]()};_0x1e550c[_0x2ea1('0x75')]=moment()[_0x2ea1('0x74')](_0x1e550c['offset'])[_0x2ea1('0x76')](_0x2ea1('0x77'));return _0x154deb[_0x2ea1('0x26')](0xc8)[_0x2ea1('0x33')](_0x1e550c);}; \ No newline at end of file +var _0xe77f=['model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','body','addLogo','file','logo','filename','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','getLicense','defaultPreferred','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','addFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','json','offset','undefined','limit','count','status','apply','reject','update','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key'];(function(_0x238736,_0x5d8d9e){var _0x4fc175=function(_0x1118c9){while(--_0x1118c9){_0x238736['push'](_0x238736['shift']());}};_0x4fc175(++_0x5d8d9e);}(_0xe77f,0xba));var _0xfe77=function(_0x2c9164,_0x1aa56b){_0x2c9164=_0x2c9164-0x0;var _0x2972de=_0xe77f[_0x2c9164];return _0x2972de;};'use strict';var emlformat=require(_0xfe77('0x0'));var rimraf=require(_0xfe77('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe77('0x2'));var rp=require(_0xfe77('0x3'));var moment=require('moment');var BPromise=require(_0xfe77('0x4'));var Mustache=require(_0xfe77('0x5'));var util=require('util');var path=require(_0xfe77('0x6'));var sox=require(_0xfe77('0x7'));var csv=require(_0xfe77('0x8'));var ejs=require(_0xfe77('0x9'));var fs=require('fs');var fs_extra=require(_0xfe77('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfe77('0xb'));var jsforce=require(_0xfe77('0xc'));var deskjs=require(_0xfe77('0xd'));var toCsv=require(_0xfe77('0x8'));var querystring=require(_0xfe77('0xe'));var Papa=require(_0xfe77('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfe77('0x10'));var as=require(_0xfe77('0x11'));var hardwareService=require(_0xfe77('0x12'));var logger=require(_0xfe77('0x13'))('api');var utils=require(_0xfe77('0x14'));var config=require(_0xfe77('0x15'));var licenseUtil=require(_0xfe77('0x16'));var db=require(_0xfe77('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xfe77('0x18')][_0xfe77('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x17627f,_0x5b2271,_0x2f4c5f,_0x1a686e){return new BPromise(function(_0x51f692,_0xc793dd){var _0x17d031=_0x1a686e||client;return _0x17d031[_0xfe77('0x1a')](_0x17627f,_0x2f4c5f)[_0xfe77('0x1b')](function(_0x110dbd){logger[_0xfe77('0x1c')](_0xfe77('0x1d'),_0x5b2271,_0xfe77('0x1e'));logger[_0xfe77('0x1f')](_0xfe77('0x20'),_0x5b2271,_0xfe77('0x1e'),JSON[_0xfe77('0x21')](_0x110dbd));if(_0x110dbd[_0xfe77('0x22')]){if(_0x110dbd['error'][_0xfe77('0x23')]===0x1f4){logger['error'](_0xfe77('0x1d'),_0x5b2271,_0x110dbd[_0xfe77('0x22')]['message']);return _0xc793dd(_0x110dbd[_0xfe77('0x22')]['message']);}logger[_0xfe77('0x22')]('Setting,\x20%s,\x20%s',_0x5b2271,_0x110dbd['error'][_0xfe77('0x24')]);return _0x51f692(_0x110dbd['error'][_0xfe77('0x24')]);}else{logger[_0xfe77('0x1c')](_0xfe77('0x1d'),_0x5b2271,_0xfe77('0x1e'));_0x51f692(_0x110dbd[_0xfe77('0x25')][_0xfe77('0x24')]);}})[_0xfe77('0x26')](function(_0xca6b02){logger[_0xfe77('0x22')](_0xfe77('0x1d'),_0x5b2271,_0xca6b02);_0xc793dd(_0xca6b02);});});}function respondWithStatusCode(_0x3f9ab8,_0x10de1a){_0x10de1a=_0x10de1a||0xcc;return function(_0x5053f2){if(_0x5053f2){return _0x3f9ab8['sendStatus'](_0x10de1a);}return _0x3f9ab8['status'](_0x10de1a)[_0xfe77('0x27')]();};}function respondWithResult(_0x1dd58e,_0x9b5b2f){_0x9b5b2f=_0x9b5b2f||0xc8;return function(_0x41ba66){if(_0x41ba66){return _0x1dd58e['status'](_0x9b5b2f)[_0xfe77('0x28')](_0x41ba66);}};}function respondWithFilteredResult(_0x63d932,_0x5b1e3d){return function(_0x3fe30d){if(_0x3fe30d){var _0x14fb23=typeof _0x5b1e3d[_0xfe77('0x29')]===_0xfe77('0x2a')&&typeof _0x5b1e3d[_0xfe77('0x2b')]===_0xfe77('0x2a');var _0x114097=_0x3fe30d[_0xfe77('0x2c')];var _0x4565f9=_0x14fb23?0x0:_0x5b1e3d['offset'];var _0x243171=_0x14fb23?_0x3fe30d[_0xfe77('0x2c')]:_0x5b1e3d[_0xfe77('0x29')]+_0x5b1e3d[_0xfe77('0x2b')];var _0x102248;if(_0x243171>=_0x114097){_0x243171=_0x114097;_0x102248=0xc8;}else{_0x102248=0xce;}_0x63d932[_0xfe77('0x2d')](_0x102248);return _0x63d932['set']('Content-Range',_0x4565f9+'-'+_0x243171+'/'+_0x114097)[_0xfe77('0x28')](_0x3fe30d);}return null;};}function patchUpdates(_0x5c5eb4){return function(_0x191e44){try{jsonpatch[_0xfe77('0x2e')](_0x191e44,_0x5c5eb4,!![]);}catch(_0x74188a){return BPromise[_0xfe77('0x2f')](_0x74188a);}return _0x191e44['save']();};}function saveUpdates(_0x2a5a71,_0x44199a){return function(_0x44906d){if(_0x44906d){return _0x44906d[_0xfe77('0x30')](_0x2a5a71)['then'](function(_0xe7e91a){return _0xe7e91a;});}return null;};}function removeEntity(_0x15e2c1,_0x2dcc18){return function(_0x282f9f){if(_0x282f9f){return _0x282f9f[_0xfe77('0x31')]()['then'](function(){_0x15e2c1[_0xfe77('0x2d')](0xcc)[_0xfe77('0x27')]();});}};}function handleEntityNotFound(_0x4c3eb3,_0x1f33ea){return function(_0x233617){if(!_0x233617){_0x4c3eb3['sendStatus'](0x194);}return _0x233617;};}function handleError(_0x12306a,_0x2a24dc){_0x2a24dc=_0x2a24dc||0x1f4;return function(_0x39f0e7){logger[_0xfe77('0x22')](_0x39f0e7[_0xfe77('0x32')]);if(_0x39f0e7[_0xfe77('0x33')]){delete _0x39f0e7['name'];}_0x12306a[_0xfe77('0x2d')](_0x2a24dc)[_0xfe77('0x34')](_0x39f0e7);};}exports[_0xfe77('0x35')]=function(_0x27aa83,_0x8df2ca){var _0x487be6={},_0x391ab3={},_0x3851d9={'count':0x0,'rows':[]};var _0x1e8e89=_[_0xfe77('0x36')](db[_0xfe77('0x37')][_0xfe77('0x38')],function(_0x5cf5ba){return{'name':_0x5cf5ba[_0xfe77('0x39')],'type':_0x5cf5ba[_0xfe77('0x3a')][_0xfe77('0x3b')]};});_0x391ab3[_0xfe77('0x3c')]=_[_0xfe77('0x36')](_0x1e8e89,'name');_0x391ab3[_0xfe77('0x3d')]=_[_0xfe77('0x3e')](_0x27aa83[_0xfe77('0x3d')]);_0x391ab3[_0xfe77('0x3f')]=_[_0xfe77('0x40')](_0x391ab3['model'],_0x391ab3[_0xfe77('0x3d')]);_0x487be6['attributes']=_[_0xfe77('0x40')](_0x391ab3['model'],qs[_0xfe77('0x41')](_0x27aa83[_0xfe77('0x3d')]['fields']));_0x487be6['attributes']=_0x487be6[_0xfe77('0x42')][_0xfe77('0x43')]?_0x487be6[_0xfe77('0x42')]:_0x391ab3['model'];if(!_0x27aa83['query']['hasOwnProperty'](_0xfe77('0x44'))){_0x487be6[_0xfe77('0x2b')]=qs[_0xfe77('0x2b')](_0x27aa83['query']['limit']);_0x487be6[_0xfe77('0x29')]=qs[_0xfe77('0x29')](_0x27aa83['query'][_0xfe77('0x29')]);}_0x487be6[_0xfe77('0x45')]=qs['sort'](_0x27aa83['query'][_0xfe77('0x46')]);_0x487be6[_0xfe77('0x47')]=qs[_0xfe77('0x3f')](_[_0xfe77('0x48')](_0x27aa83['query'],_0x391ab3[_0xfe77('0x3f')]),_0x1e8e89);if(_0x27aa83[_0xfe77('0x3d')][_0xfe77('0x49')]){_0x487be6[_0xfe77('0x47')]=_[_0xfe77('0x4a')](_0x487be6['where'],{'$or':_[_0xfe77('0x36')](_0x1e8e89,function(_0x512f61){if(_0x512f61['type']!==_0xfe77('0x4b')){var _0x48844a={};_0x48844a[_0x512f61['name']]={'$like':'%'+_0x27aa83[_0xfe77('0x3d')][_0xfe77('0x49')]+'%'};return _0x48844a;}})});}_0x487be6=_[_0xfe77('0x4a')]({},_0x487be6,_0x27aa83[_0xfe77('0x4c')]);var _0x562cdf={'where':_0x487be6[_0xfe77('0x47')]};return db[_0xfe77('0x37')][_0xfe77('0x2c')](_0x562cdf)[_0xfe77('0x1b')](function(_0x3f399c){_0x3851d9[_0xfe77('0x2c')]=_0x3f399c;if(_0x27aa83['query'][_0xfe77('0x4d')]){_0x487be6[_0xfe77('0x4e')]=[{'all':!![]}];}return db[_0xfe77('0x37')][_0xfe77('0x4f')](_0x487be6);})['then'](function(_0x333e4f){_0x3851d9['rows']=_0x333e4f;return _0x3851d9;})[_0xfe77('0x1b')](respondWithFilteredResult(_0x8df2ca,_0x487be6))['catch'](handleError(_0x8df2ca,null));};exports[_0xfe77('0x50')]=function(_0x3673f6,_0x128d8a){var _0x229340={'raw':![],'where':{'id':_0x3673f6[_0xfe77('0x51')]['id']}},_0x52f673={};_0x52f673[_0xfe77('0x3c')]=_['keys'](db['Setting']['rawAttributes']);_0x52f673['query']=_['keys'](_0x3673f6[_0xfe77('0x3d')]);_0x52f673[_0xfe77('0x3f')]=_['intersection'](_0x52f673['model'],_0x52f673['query']);_0x229340[_0xfe77('0x42')]=_['intersection'](_0x52f673[_0xfe77('0x3c')],qs[_0xfe77('0x41')](_0x3673f6[_0xfe77('0x3d')]['fields']));_0x229340[_0xfe77('0x42')]=_0x229340[_0xfe77('0x42')][_0xfe77('0x43')]?_0x229340[_0xfe77('0x42')]:_0x52f673[_0xfe77('0x3c')];if(_0x3673f6[_0xfe77('0x3d')][_0xfe77('0x4d')]){_0x229340[_0xfe77('0x4e')]=[{'all':!![]}];}_0x229340=_[_0xfe77('0x4a')]({},_0x229340,_0x3673f6['options']);return db[_0xfe77('0x37')][_0xfe77('0x52')](_0x229340)[_0xfe77('0x1b')](handleEntityNotFound(_0x128d8a,null))['then'](respondWithResult(_0x128d8a,null))[_0xfe77('0x26')](handleError(_0x128d8a,null));};exports[_0xfe77('0x30')]=function(_0x5cec9d,_0x24365e){if(_0x5cec9d['body']['id']){delete _0x5cec9d[_0xfe77('0x53')]['id'];}return db[_0xfe77('0x37')][_0xfe77('0x52')]({'where':{'id':_0x5cec9d['params']['id']}})[_0xfe77('0x1b')](handleEntityNotFound(_0x24365e,null))['then'](saveUpdates(_0x5cec9d[_0xfe77('0x53')],null))['then'](respondWithResult(_0x24365e,null))['catch'](handleError(_0x24365e,null));};exports[_0xfe77('0x54')]=function(_0x297715,_0x50388e,_0x1c143b){if(_0x297715[_0xfe77('0x55')]&&_0x297715[_0xfe77('0x55')]['filename']){_0x297715[_0xfe77('0x53')][_0xfe77('0x56')]=_0x297715[_0xfe77('0x55')][_0xfe77('0x57')];}return db['Setting']['find']({'where':{'id':_0x297715[_0xfe77('0x51')]['id']}})[_0xfe77('0x1b')](handleEntityNotFound(_0x50388e,null))[_0xfe77('0x1b')](saveUpdates(_0x297715[_0xfe77('0x53')],null))['then'](respondWithResult(_0x50388e,null))[_0xfe77('0x26')](handleError(_0x50388e,null));};exports['addLogoLogin']=function(_0x1cccdd,_0x119938,_0x1adcc3){if(_0x1cccdd[_0xfe77('0x55')]&&_0x1cccdd[_0xfe77('0x55')][_0xfe77('0x57')]){_0x1cccdd[_0xfe77('0x53')][_0xfe77('0x58')]=_0x1cccdd['file'][_0xfe77('0x57')];}return db[_0xfe77('0x37')][_0xfe77('0x52')]({'where':{'id':_0x1cccdd[_0xfe77('0x51')]['id']}})[_0xfe77('0x1b')](handleEntityNotFound(_0x119938,null))[_0xfe77('0x1b')](saveUpdates(_0x1cccdd['body'],null))['then'](respondWithResult(_0x119938,null))['catch'](handleError(_0x119938,null));};var utilLicense=require(_0xfe77('0x16'));exports[_0xfe77('0x59')]=function(_0x294e05,_0x313f33,_0x36e416){var _0xf35b0a=_0xfe77('0x5a');var _0x14446f={'custom':![]};return utilLicense['getLicense']()[_0xfe77('0x1b')](function(_0x41a37f){if(_0x41a37f){_0x14446f=_0x41a37f;}return db[_0xfe77('0x37')][_0xfe77('0x52')]({'where':{'id':_0x294e05[_0xfe77('0x51')]['id']},'attributes':[_0xfe77('0x56'),'loginLogo',_0xfe77('0x5b'),_0xfe77('0x5c'),_0xfe77('0x5d'),_0xfe77('0x5e'),'defaultPreferred',_0xfe77('0x5f')],'raw':!![]});})[_0xfe77('0x1b')](handleEntityNotFound(_0x313f33,null))[_0xfe77('0x1b')](function(_0x46d7b9){if(_0x46d7b9){var _0x2f9fc0=_0x46d7b9['logo']&&fs[_0xfe77('0x60')](path['join'](config[_0xfe77('0x61')],_0xf35b0a,_[_0xfe77('0x62')](_0x46d7b9[_0xfe77('0x56')])))?path[_0xfe77('0x63')](config[_0xfe77('0x61')],_0xf35b0a,_['toLower'](_0x46d7b9['logo'])):path[_0xfe77('0x63')](config['root'],_0xf35b0a,_[_0xfe77('0x62')](_0xfe77('0x64')));var _0x4f50e4=_0xfe77('0x65')+_[_0xfe77('0x66')]('logo');if(_0x46d7b9[_0x4f50e4]||!_0x14446f[_0xfe77('0x67')]){_0x2f9fc0=path[_0xfe77('0x63')](config[_0xfe77('0x61')],_0xf35b0a,_['toLower'](_0xfe77('0x64')));}if(!fs['existsSync'](_0x2f9fc0)){throw new db[(_0xfe77('0x68'))][(_0xfe77('0x69'))](_[_0xfe77('0x66')]('logo')+_0xfe77('0x6a'));}return _0x313f33[_0xfe77('0x6b')](_0x2f9fc0);}})[_0xfe77('0x26')](handleError(_0x313f33,null));};var utilLicense=require(_0xfe77('0x16'));exports[_0xfe77('0x6c')]=function(_0x2b17f8,_0x2a98ca,_0x88e73a){var _0xba3ecd=_0xfe77('0x5a');var _0x311cd8={'custom':![]};return utilLicense[_0xfe77('0x6d')]()[_0xfe77('0x1b')](function(_0x205f69){if(_0x205f69){_0x311cd8=_0x205f69;}return db[_0xfe77('0x37')][_0xfe77('0x52')]({'where':{'id':_0x2b17f8[_0xfe77('0x51')]['id']},'attributes':[_0xfe77('0x56'),_0xfe77('0x58'),_0xfe77('0x5b'),'favicon',_0xfe77('0x5d'),'defaultLoginLogo',_0xfe77('0x6e'),'defaultFavicon'],'raw':!![]});})[_0xfe77('0x1b')](handleEntityNotFound(_0x2a98ca,null))[_0xfe77('0x1b')](function(_0x2bea96){if(_0x2bea96){var _0x7f603a=_0x2bea96[_0xfe77('0x58')]&&fs[_0xfe77('0x60')](path['join'](config[_0xfe77('0x61')],_0xba3ecd,_['toLower'](_0x2bea96[_0xfe77('0x58')])))?path[_0xfe77('0x63')](config[_0xfe77('0x61')],_0xba3ecd,_[_0xfe77('0x62')](_0x2bea96[_0xfe77('0x58')])):path[_0xfe77('0x63')](config['root'],_0xba3ecd,_[_0xfe77('0x62')](_0xfe77('0x6f')));var _0x21e88a=_0xfe77('0x65')+_[_0xfe77('0x66')](_0xfe77('0x58'));if(_0x2bea96[_0x21e88a]||!_0x311cd8[_0xfe77('0x67')]){_0x7f603a=path[_0xfe77('0x63')](config[_0xfe77('0x61')],_0xba3ecd,_['toLower'](_0xfe77('0x6f')));}if(!fs[_0xfe77('0x60')](_0x7f603a)){throw new db['Sequelize'][(_0xfe77('0x69'))](_['upperFirst']('loginLogo')+_0xfe77('0x6a'));}return _0x2a98ca[_0xfe77('0x6b')](_0x7f603a);}})['catch'](handleError(_0x2a98ca,null));};exports[_0xfe77('0x70')]=function(_0x1daefb,_0x478f56){return db[_0xfe77('0x37')][_0xfe77('0x52')]({'where':{'id':_0x1daefb[_0xfe77('0x51')]['id']},'attributes':[_0xfe77('0x71')]})[_0xfe77('0x1b')](respondWithResult(_0x478f56,null))[_0xfe77('0x26')](handleError(_0x478f56,null));};exports[_0xfe77('0x72')]=function(_0x23159e,_0x5511be,_0x24b7dd){if(_0x23159e['file']&&_0x23159e[_0xfe77('0x55')][_0xfe77('0x57')]){_0x23159e['body'][_0xfe77('0x5b')]=_0x23159e[_0xfe77('0x55')][_0xfe77('0x57')];}return db[_0xfe77('0x37')][_0xfe77('0x52')]({'where':{'id':_0x23159e[_0xfe77('0x51')]['id']}})[_0xfe77('0x1b')](handleEntityNotFound(_0x5511be,null))[_0xfe77('0x1b')](saveUpdates(_0x23159e[_0xfe77('0x53')],null))[_0xfe77('0x1b')](respondWithResult(_0x5511be,null))[_0xfe77('0x26')](handleError(_0x5511be,null));};var utilLicense=require(_0xfe77('0x16'));exports[_0xfe77('0x73')]=function(_0x32309c,_0x552708,_0xbaf14d){var _0x5d5b65=_0xfe77('0x5a');var _0x17971e={'custom':![]};return utilLicense[_0xfe77('0x6d')]()[_0xfe77('0x1b')](function(_0x3eff7c){if(_0x3eff7c){_0x17971e=_0x3eff7c;}return db[_0xfe77('0x37')][_0xfe77('0x52')]({'where':{'id':_0x32309c[_0xfe77('0x51')]['id']},'attributes':[_0xfe77('0x56'),_0xfe77('0x58'),'preferred','favicon',_0xfe77('0x5d'),_0xfe77('0x5e'),_0xfe77('0x6e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x552708,null))[_0xfe77('0x1b')](function(_0xdc6b14){if(_0xdc6b14){var _0x1806f5=_0xdc6b14[_0xfe77('0x5b')]&&fs[_0xfe77('0x60')](path[_0xfe77('0x63')](config[_0xfe77('0x61')],_0x5d5b65,_[_0xfe77('0x62')](_0xdc6b14[_0xfe77('0x5b')])))?path['join'](config[_0xfe77('0x61')],_0x5d5b65,_[_0xfe77('0x62')](_0xdc6b14[_0xfe77('0x5b')])):path[_0xfe77('0x63')](config[_0xfe77('0x61')],_0x5d5b65,_[_0xfe77('0x62')]('default_preferred.png'));var _0x2e9208=_0xfe77('0x65')+_[_0xfe77('0x66')]('preferred');if(_0xdc6b14[_0x2e9208]||!_0x17971e[_0xfe77('0x67')]||!_0x17971e[_0xfe77('0x5b')]){_0x1806f5=path[_0xfe77('0x63')](config[_0xfe77('0x61')],_0x5d5b65,_['toLower']('default_preferred.png'));}if(!fs['existsSync'](_0x1806f5)){throw new db[(_0xfe77('0x68'))][(_0xfe77('0x69'))](_[_0xfe77('0x66')](_0xfe77('0x5b'))+_0xfe77('0x6a'));}return _0x552708[_0xfe77('0x6b')](_0x1806f5);}})[_0xfe77('0x26')](handleError(_0x552708,null));};exports[_0xfe77('0x74')]=function(_0x145fbb,_0x3201ad,_0x6bca2a){if(_0x145fbb['file']&&_0x145fbb[_0xfe77('0x55')][_0xfe77('0x57')]){_0x145fbb[_0xfe77('0x53')]['favicon']=_0x145fbb[_0xfe77('0x55')][_0xfe77('0x57')];}return db['Setting'][_0xfe77('0x52')]({'where':{'id':_0x145fbb[_0xfe77('0x51')]['id']}})[_0xfe77('0x1b')](handleEntityNotFound(_0x3201ad,null))[_0xfe77('0x1b')](saveUpdates(_0x145fbb[_0xfe77('0x53')],null))[_0xfe77('0x1b')](respondWithResult(_0x3201ad,null))[_0xfe77('0x26')](handleError(_0x3201ad,null));};var utilLicense=require(_0xfe77('0x16'));exports['getFavicon']=function(_0x4fcd7c,_0xf55a16,_0x344008){var _0x3c16b8=_0xfe77('0x5a');var _0x378271={'custom':![]};return utilLicense[_0xfe77('0x6d')]()[_0xfe77('0x1b')](function(_0x150ea1){if(_0x150ea1){_0x378271=_0x150ea1;}return db[_0xfe77('0x37')][_0xfe77('0x52')]({'where':{'id':_0x4fcd7c[_0xfe77('0x51')]['id']},'attributes':[_0xfe77('0x56'),_0xfe77('0x58'),_0xfe77('0x5b'),_0xfe77('0x5c'),'defaultLogo','defaultLoginLogo',_0xfe77('0x6e'),_0xfe77('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0xf55a16,null))['then'](function(_0x4d1800){if(_0x4d1800){var _0x1931be=_0x4d1800[_0xfe77('0x5c')]&&fs[_0xfe77('0x60')](path[_0xfe77('0x63')](config['root'],_0x3c16b8,_[_0xfe77('0x62')](_0x4d1800['favicon'])))?path[_0xfe77('0x63')](config[_0xfe77('0x61')],_0x3c16b8,_['toLower'](_0x4d1800[_0xfe77('0x5c')])):path['join'](config[_0xfe77('0x61')],_0x3c16b8,_[_0xfe77('0x62')](_0xfe77('0x75')));var _0x356573='default'+_['upperFirst'](_0xfe77('0x5c'));if(_0x4d1800[_0x356573]||!_0x378271[_0xfe77('0x67')]){_0x1931be=path[_0xfe77('0x63')](config[_0xfe77('0x61')],_0x3c16b8,_[_0xfe77('0x62')](_0xfe77('0x75')));}if(!fs[_0xfe77('0x60')](_0x1931be)){throw new db[(_0xfe77('0x68'))][(_0xfe77('0x69'))](_[_0xfe77('0x66')](_0xfe77('0x5c'))+_0xfe77('0x6a'));}return _0xf55a16['download'](_0x1931be);}})[_0xfe77('0x26')](handleError(_0xf55a16,null));};exports[_0xfe77('0x76')]=function(_0x3dccec,_0x295670){var _0x23e345={'offset':moment()[_0xfe77('0x77')]()};_0x23e345[_0xfe77('0x78')]=moment()[_0xfe77('0x77')](_0x23e345['offset'])[_0xfe77('0x79')](_0xfe77('0x7a'));return _0x295670['status'](0xc8)[_0xfe77('0x34')](_0x23e345);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index c7bc05a..ffa1c75 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x161341,_0x1c054d){var _0x5e06c3=function(_0x1d177a){while(--_0x1d177a){_0x161341['push'](_0x161341['shift']());}};_0x5e06c3(++_0x1c054d);}(_0x3e74,0x175));var _0x43e7=function(_0x5594cb,_0x3d2784){_0x5594cb=_0x5594cb-0x0;var _0x43af67=_0x3e74[_0x5594cb];return _0x43af67;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0x55ca,0x126));var _0xa55c=function(_0x193266,_0x37c379){_0x193266=_0x193266-0x0;var _0x2a9bde=_0x55ca[_0x193266];return _0x2a9bde;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index fa3ad3e..c677395 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 _0xd9df=['result','Setting','find','options','raw','where','attributes','map','include','model','ShowSetting','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','client','request','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message'];(function(_0x2252db,_0x22d062){var _0x432e01=function(_0xcb8571){while(--_0xcb8571){_0x2252db['push'](_0x2252db['shift']());}};_0x432e01(++_0x22d062);}(_0xd9df,0xfc));var _0xfd9d=function(_0x408a3a,_0x1c36d2){_0x408a3a=_0x408a3a-0x0;var _0xac33ea=_0xd9df[_0x408a3a];return _0xac33ea;};'use strict';var _=require(_0xfd9d('0x0'));var util=require(_0xfd9d('0x1'));var moment=require(_0xfd9d('0x2'));var BPromise=require(_0xfd9d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd9d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd9d('0x5'))(_0xfd9d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfd9d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29ae89,_0x22e012,_0xdce466){return new BPromise(function(_0x3c106e,_0x52099f){return client[_0xfd9d('0x8')](_0x29ae89,_0xdce466)['then'](function(_0x406252){logger[_0xfd9d('0x9')]('Setting,\x20%s,\x20%s',_0x22e012,'request\x20sent');logger[_0xfd9d('0xa')](_0xfd9d('0xb'),_0x22e012,_0xfd9d('0xc'),JSON[_0xfd9d('0xd')](_0x406252));if(_0x406252[_0xfd9d('0xe')]){if(_0x406252[_0xfd9d('0xe')][_0xfd9d('0xf')]===0x1f4){logger['error'](_0xfd9d('0x10'),_0x22e012,_0x406252[_0xfd9d('0xe')][_0xfd9d('0x11')]);return _0x52099f(_0x406252[_0xfd9d('0xe')][_0xfd9d('0x11')]);}logger['error'](_0xfd9d('0x10'),_0x22e012,_0x406252[_0xfd9d('0xe')][_0xfd9d('0x11')]);return _0x3c106e(_0x406252[_0xfd9d('0xe')][_0xfd9d('0x11')]);}else{logger[_0xfd9d('0x9')]('Setting,\x20%s,\x20%s',_0x22e012,_0xfd9d('0xc'));_0x3c106e(_0x406252[_0xfd9d('0x12')]['message']);}})['catch'](function(_0x21c109){logger[_0xfd9d('0xe')](_0xfd9d('0x10'),_0x22e012,_0x21c109);_0x52099f(_0x21c109);});});}exports['ShowSetting']=function(_0x37b50f){var _0x477773=this;return new Promise(function(_0x26a2bb,_0x46b402){return db[_0xfd9d('0x13')][_0xfd9d('0x14')]({'raw':_0x37b50f[_0xfd9d('0x15')]?_0x37b50f[_0xfd9d('0x15')][_0xfd9d('0x16')]===undefined?!![]:![]:!![],'where':_0x37b50f[_0xfd9d('0x15')]?_0x37b50f[_0xfd9d('0x15')][_0xfd9d('0x17')]||null:null,'attributes':_0x37b50f['options']?_0x37b50f[_0xfd9d('0x15')][_0xfd9d('0x18')]||null:null,'include':_0x37b50f[_0xfd9d('0x15')]?_0x37b50f[_0xfd9d('0x15')]['include']?_[_0xfd9d('0x19')](_0x37b50f[_0xfd9d('0x15')][_0xfd9d('0x1a')],function(_0xff435b){return{'model':db[_0xff435b[_0xfd9d('0x1b')]],'as':_0xff435b['as'],'attributes':_0xff435b['attributes'],'include':_0xff435b['include']?_[_0xfd9d('0x19')](_0xff435b['include'],function(_0x3e5ca1){return{'model':db[_0x3e5ca1[_0xfd9d('0x1b')]],'as':_0x3e5ca1['as'],'attributes':_0x3e5ca1[_0xfd9d('0x18')],'include':_0x3e5ca1[_0xfd9d('0x1a')]?_[_0xfd9d('0x19')](_0x3e5ca1[_0xfd9d('0x1a')],function(_0xd07ffb){return{'model':db[_0xd07ffb[_0xfd9d('0x1b')]],'as':_0xd07ffb['as'],'attributes':_0xd07ffb[_0xfd9d('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bbf19){logger['info'](_0xfd9d('0x1c'),_0x37b50f);logger[_0xfd9d('0xa')](_0xfd9d('0x1c'),_0x37b50f,JSON[_0xfd9d('0xd')](_0x1bbf19));_0x26a2bb(_0x1bbf19);})[_0xfd9d('0x1d')](function(_0x2c5a5a){logger[_0xfd9d('0xe')](_0xfd9d('0x1c'),_0x2c5a5a[_0xfd9d('0x11')],_0x37b50f);_0x46b402(_0x477773['error'](0x1f4,_0x2c5a5a['message']));});});}; \ No newline at end of file +var _0xc395=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','ShowSetting','Setting','find','options','raw','include','model','attributes','map','debug','lodash','moment','bluebird'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xc395,0xdd));var _0x5c39=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0xc395[_0x5ac84c];return _0x3c53d2;};'use strict';var _=require(_0x5c39('0x0'));var util=require('util');var moment=require(_0x5c39('0x1'));var BPromise=require(_0x5c39('0x2'));var rs=require(_0x5c39('0x3'));var fs=require('fs');var Redis=require(_0x5c39('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5c39('0x5'));var logger=require(_0x5c39('0x6'))(_0x5c39('0x7'));var config=require(_0x5c39('0x8'));var jayson=require(_0x5c39('0x9'));var client=jayson[_0x5c39('0xa')][_0x5c39('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b56ee,_0x12f0c8,_0x289d5c){return new BPromise(function(_0x33ed06,_0x4245ef){return client[_0x5c39('0xc')](_0x1b56ee,_0x289d5c)[_0x5c39('0xd')](function(_0x1958e7){logger['info'](_0x5c39('0xe'),_0x12f0c8,_0x5c39('0xf'));logger['debug'](_0x5c39('0x10'),_0x12f0c8,'request\x20sent',JSON[_0x5c39('0x11')](_0x1958e7));if(_0x1958e7['error']){if(_0x1958e7[_0x5c39('0x12')]['code']===0x1f4){logger['error'](_0x5c39('0xe'),_0x12f0c8,_0x1958e7[_0x5c39('0x12')][_0x5c39('0x13')]);return _0x4245ef(_0x1958e7[_0x5c39('0x12')]['message']);}logger[_0x5c39('0x12')](_0x5c39('0xe'),_0x12f0c8,_0x1958e7[_0x5c39('0x12')]['message']);return _0x33ed06(_0x1958e7[_0x5c39('0x12')][_0x5c39('0x13')]);}else{logger[_0x5c39('0x14')](_0x5c39('0xe'),_0x12f0c8,'request\x20sent');_0x33ed06(_0x1958e7['result'][_0x5c39('0x13')]);}})[_0x5c39('0x15')](function(_0x3c0556){logger[_0x5c39('0x12')]('Setting,\x20%s,\x20%s',_0x12f0c8,_0x3c0556);_0x4245ef(_0x3c0556);});});}exports[_0x5c39('0x16')]=function(_0xabf5ff){var _0x117e13=this;return new Promise(function(_0x4efec5,_0xff2b84){return db[_0x5c39('0x17')][_0x5c39('0x18')]({'raw':_0xabf5ff[_0x5c39('0x19')]?_0xabf5ff['options'][_0x5c39('0x1a')]===undefined?!![]:![]:!![],'where':_0xabf5ff[_0x5c39('0x19')]?_0xabf5ff[_0x5c39('0x19')]['where']||null:null,'attributes':_0xabf5ff[_0x5c39('0x19')]?_0xabf5ff[_0x5c39('0x19')]['attributes']||null:null,'include':_0xabf5ff[_0x5c39('0x19')]?_0xabf5ff[_0x5c39('0x19')][_0x5c39('0x1b')]?_['map'](_0xabf5ff['options']['include'],function(_0x23d777){return{'model':db[_0x23d777[_0x5c39('0x1c')]],'as':_0x23d777['as'],'attributes':_0x23d777[_0x5c39('0x1d')],'include':_0x23d777[_0x5c39('0x1b')]?_[_0x5c39('0x1e')](_0x23d777['include'],function(_0x3f04e9){return{'model':db[_0x3f04e9[_0x5c39('0x1c')]],'as':_0x3f04e9['as'],'attributes':_0x3f04e9[_0x5c39('0x1d')],'include':_0x3f04e9['include']?_[_0x5c39('0x1e')](_0x3f04e9[_0x5c39('0x1b')],function(_0x5e1bb2){return{'model':db[_0x5e1bb2[_0x5c39('0x1c')]],'as':_0x5e1bb2['as'],'attributes':_0x5e1bb2[_0x5c39('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5c39('0xd')](function(_0x9c98fc){logger['info']('ShowSetting',_0xabf5ff);logger[_0x5c39('0x1f')]('ShowSetting',_0xabf5ff,JSON[_0x5c39('0x11')](_0x9c98fc));_0x4efec5(_0x9c98fc);})[_0x5c39('0x15')](function(_0x3faabc){logger[_0x5c39('0x12')](_0x5c39('0x16'),_0x3faabc[_0x5c39('0x13')],_0xabf5ff);_0xff2b84(_0x117e13[_0x5c39('0x12')](0x1f4,_0x3faabc[_0x5c39('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 907fa65..ca8503e 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 _0x1cb9=['/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addAnswer','/:id/notify','notify','/:id/applications','/:id/send','/:id/status','status','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2f47f0,_0x2d9f92){_0x2f47f0=_0x2f47f0-0x0;var _0x2bb63a=_0x1cb9[_0x2f47f0];return _0x2bb63a;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0x8')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x8')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x8')]('/:id/applications',auth[_0x91cb('0x9')](),controller[_0x91cb('0x13')]);router['get'](_0x91cb('0x14'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x15')]);router[_0x91cb('0x8')]('/:id/status',controller['statusGet']);router[_0x91cb('0x8')](_0x91cb('0x16'),auth['isAuthenticated'](),controller['getAgents']);router[_0x91cb('0x17')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x18')]);router['post'](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller['addDisposition']);router[_0x91cb('0x17')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x19')]);router['post'](_0x91cb('0x1a'),controller[_0x91cb('0x1b')]);router['post'](_0x91cb('0x1c'),auth['isAuthenticated'](),controller['addApplications']);router[_0x91cb('0x17')](_0x91cb('0x1d'),auth['isAuthenticated'](),controller['send']);router['post'](_0x91cb('0x1e'),controller[_0x91cb('0x1f')]);router[_0x91cb('0x17')](_0x91cb('0x16'),auth['isAuthenticated'](),controller[_0x91cb('0x20')]);router[_0x91cb('0x21')](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0x22')]);router[_0x91cb('0x23')](_0x91cb('0xd'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x24')]);router[_0x91cb('0x23')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x25')]);router['delete']('/:id/canned_answers',auth[_0x91cb('0x9')](),controller['removeAnswers']);router[_0x91cb('0x23')](_0x91cb('0x16'),auth[_0x91cb('0x9')](),controller['removeAgents']);module[_0x91cb('0x26')]=router; \ No newline at end of file +var _0xe14b=['./smsAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','update','/:id','destroy','removeDispositions','delete','/:id/users','removeAgents','multer','util','express','Router','../../components/auth/service'];(function(_0x376c18,_0x2bf6ba){var _0x4aee4c=function(_0x3b04d4){while(--_0x3b04d4){_0x376c18['push'](_0x376c18['shift']());}};_0x4aee4c(++_0x2bf6ba);}(_0xe14b,0x93));var _0xbe14=function(_0x1a48f7,_0x1ed115){_0x1a48f7=_0x1a48f7-0x0;var _0x1635dd=_0xe14b[_0x1a48f7];return _0x1635dd;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x6')](_0xbe14('0x10'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x6')](_0xbe14('0x12'),controller[_0xbe14('0x13')]);router[_0xbe14('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x14')]);router[_0xbe14('0x15')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x16')]);router['post'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x15')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);router['post'](_0xbe14('0x19'),controller[_0xbe14('0x1a')]);router[_0xbe14('0x15')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1b')]);router['post'](_0xbe14('0x1c'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1d')]);router[_0xbe14('0x15')](_0xbe14('0x12'),controller['status']);router[_0xbe14('0x15')]('/:id/users',auth[_0xbe14('0x7')](),controller['addAgents']);router[_0xbe14('0x1e')]('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0x1f')]);router['delete'](_0xbe14('0x20'),auth['isAuthenticated'](),controller[_0xbe14('0x21')]);router['delete'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x22')]);router[_0xbe14('0x23')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeAnswers']);router[_0xbe14('0x23')](_0xbe14('0x24'),auth[_0xbe14('0x7')](),controller[_0xbe14('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 d2ed406..4b4f096 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 _0x4024=['twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','name','ENUM'];(function(_0x475612,_0xc128e6){var _0x564690=function(_0x4bab60){while(--_0x4bab60){_0x475612['push'](_0x475612['shift']());}};_0x564690(++_0xc128e6);}(_0x4024,0xd7));var _0x4402=function(_0x1766f2,_0x15f324){_0x1766f2=_0x1766f2-0x0;var _0x1613e1=_0x4024[_0x1766f2];return _0x1613e1;};'use strict';var Sequelize=require(_0x4402('0x0'));var rs=require('randomstring');module[_0x4402('0x1')]={'name':{'type':Sequelize[_0x4402('0x2')],'unique':_0x4402('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x4402('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x4402('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x4402('0x2')]},'type':{'type':Sequelize[_0x4402('0x4')](_0x4402('0x5'),_0x4402('0x6'),_0x4402('0x7'),_0x4402('0x8'),_0x4402('0x9'),_0x4402('0xa'),_0x4402('0xb'),_0x4402('0xc'),'infobip',_0x4402('0xd'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x4402('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x4402('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x4402('0x2')]},'password':{'type':Sequelize[_0x4402('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x4402('0x2')]},'accountId':{'type':Sequelize[_0x4402('0x2')]},'senderString':{'type':Sequelize[_0x4402('0x2')]},'deliveryReport':{'type':Sequelize[_0x4402('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x4402('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4402('0xf')],'defaultValue':function(){return _0x4402('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4402('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4402('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x4402('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4402('0x11')],'comment':_0x4402('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x4402('0xe')],'defaultValue':![],'comment':_0x4402('0x13'),'set':function(_0xadecf8){if(!_0xadecf8)this[_0x4402('0x14')]('mandatoryDispositionPauseId',null);this[_0x4402('0x14')](_0x4402('0x15'),_0xadecf8);}}}; \ No newline at end of file +var _0x2bfc=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','skebby','clicksend','plivo','clickatell','csc','infobip','intelepeer','ENUM','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x756e9,_0xc02466){var _0x243653=function(_0x4dc96f){while(--_0x4dc96f){_0x756e9['push'](_0x756e9['shift']());}};_0x243653(++_0xc02466);}(_0x2bfc,0x1a7));var _0xc2bf=function(_0x5d14c6,_0xef6d82){_0x5d14c6=_0x5d14c6-0x0;var _0x49f240=_0x2bfc[_0x5d14c6];return _0x49f240;};'use strict';var Sequelize=require(_0xc2bf('0x0'));var rs=require(_0xc2bf('0x1'));module[_0xc2bf('0x2')]={'name':{'type':Sequelize[_0xc2bf('0x3')],'unique':_0xc2bf('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xc2bf('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xc2bf('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xc2bf('0x5')]();}},'phone':{'type':Sequelize[_0xc2bf('0x3')]},'type':{'type':Sequelize['ENUM']('twilio',_0xc2bf('0x6'),'connectel',_0xc2bf('0x7'),_0xc2bf('0x8'),_0xc2bf('0x9'),'bandwidth',_0xc2bf('0xa'),_0xc2bf('0xb'),_0xc2bf('0xc'))},'accountSid':{'type':Sequelize[_0xc2bf('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xc2bf('0x3')]},'smsMethod':{'type':Sequelize[_0xc2bf('0xd')]('SI','TI','GP')},'username':{'type':Sequelize[_0xc2bf('0x3')]},'password':{'type':Sequelize[_0xc2bf('0x3')]},'apiKey':{'type':Sequelize[_0xc2bf('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xc2bf('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xc2bf('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xc2bf('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xc2bf('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc2bf('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc2bf('0xf')],'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[_0xc2bf('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc2bf('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xc2bf('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc2bf('0xf')],'comment':_0xc2bf('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xc2bf('0xe')],'defaultValue':![],'comment':_0xc2bf('0x11'),'set':function(_0x3d2cea){if(!_0x3d2cea)this[_0xc2bf('0x12')](_0xc2bf('0x13'),null);this[_0xc2bf('0x12')](_0xc2bf('0x14'),_0x3d2cea);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 17d78dd..fe75ced 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 _0xb8df=['ACCEPTD','statusGet','state','message-id','addAgents','userSmsAccount:save','removeAgents','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','get','then','send','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','map','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','keys','includeAll','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','SmsAccountId','Disposition','create','findOne','order','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','notify','sms','SmsApplication','Applications','applications','priority','account','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','connectel','clicksend','message_id','Text','MessageUUID','results','csc','originatingAddress','clickatell','text','replyMessageId','bandwidth','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmContact','Contacts','omit','contact','SmsInteraction','interaction','created','push','close','unmanaged','SmsMessage','ContactId','User','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','json','addApplications','sequelize','transaction','findAndCountAll','getApplications','Owner','internal','Tag','Tags','color','rows','to\x20is\x20mandatory','CmList','List','Messages','spread','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','DELIVERED','redif','inspect','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD'];(function(_0x4e55a9,_0x241b22){var _0x4a9b67=function(_0x2a3bd1){while(--_0x2a3bd1){_0x4e55a9['push'](_0x4e55a9['shift']());}};_0x4a9b67(++_0x241b22);}(_0xb8df,0xdd));var _0xfb8d=function(_0x2b2c53,_0x4bcf9b){_0x2b2c53=_0x2b2c53-0x0;var _0x311ec2=_0xb8df[_0x2b2c53];return _0x311ec2;};'use strict';var emlformat=require(_0xfb8d('0x0'));var rimraf=require(_0xfb8d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb8d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfb8d('0x3'));var Mustache=require(_0xfb8d('0x4'));var util=require(_0xfb8d('0x5'));var path=require(_0xfb8d('0x6'));var sox=require(_0xfb8d('0x7'));var csv=require(_0xfb8d('0x8'));var ejs=require(_0xfb8d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfb8d('0xa'));var crypto=require(_0xfb8d('0xb'));var jsforce=require(_0xfb8d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfb8d('0x8'));var querystring=require(_0xfb8d('0xd'));var Papa=require('papaparse');var Redis=require(_0xfb8d('0xe'));var authService=require(_0xfb8d('0xf'));var qs=require(_0xfb8d('0x10'));var as=require(_0xfb8d('0x11'));var hardwareService=require(_0xfb8d('0x12'));var logger=require(_0xfb8d('0x13'))('api');var utils=require(_0xfb8d('0x14'));var config=require(_0xfb8d('0x15'));var licenseUtil=require(_0xfb8d('0x16'));var db=require(_0xfb8d('0x17'))['db'];config[_0xfb8d('0x18')]=_[_0xfb8d('0x19')](config[_0xfb8d('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xfb8d('0x1a'))(new Redis(config[_0xfb8d('0x18')]));require('./smsAccount.socket')[_0xfb8d('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xfb8d('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x571d67,_0x28ce9e,_0x5c985e,_0x57561f){return new BPromise(function(_0x4c22e4,_0xde02bd){var _0x50c3b0=_0x57561f||client;return _0x50c3b0[_0xfb8d('0x1d')](_0x571d67,_0x5c985e)['then'](function(_0x497dc7){logger[_0xfb8d('0x1e')](_0xfb8d('0x1f'),_0x28ce9e,_0xfb8d('0x20'));logger[_0xfb8d('0x21')](_0xfb8d('0x22'),_0x28ce9e,_0xfb8d('0x20'),JSON[_0xfb8d('0x23')](_0x497dc7));if(_0x497dc7[_0xfb8d('0x24')]){if(_0x497dc7[_0xfb8d('0x24')]['code']===0x1f4){logger[_0xfb8d('0x24')](_0xfb8d('0x1f'),_0x28ce9e,_0x497dc7[_0xfb8d('0x24')][_0xfb8d('0x25')]);return _0xde02bd(_0x497dc7[_0xfb8d('0x24')][_0xfb8d('0x25')]);}logger[_0xfb8d('0x24')](_0xfb8d('0x1f'),_0x28ce9e,_0x497dc7['error'][_0xfb8d('0x25')]);return _0x4c22e4(_0x497dc7[_0xfb8d('0x24')]['message']);}else{logger[_0xfb8d('0x1e')](_0xfb8d('0x1f'),_0x28ce9e,_0xfb8d('0x20'));_0x4c22e4(_0x497dc7['result'][_0xfb8d('0x25')]);}})[_0xfb8d('0x26')](function(_0x50bfa3){logger[_0xfb8d('0x24')](_0xfb8d('0x1f'),_0x28ce9e,_0x50bfa3);_0xde02bd(_0x50bfa3);});});}function respondWithStatusCode(_0x284ebb,_0x2371db){_0x2371db=_0x2371db||0xcc;return function(_0x13a00b){if(_0x13a00b){return _0x284ebb[_0xfb8d('0x27')](_0x2371db);}return _0x284ebb['status'](_0x2371db)[_0xfb8d('0x28')]();};}function respondWithResult(_0x122f5d,_0x3ab2f0){_0x3ab2f0=_0x3ab2f0||0xc8;return function(_0x68ab35){if(_0x68ab35){return _0x122f5d[_0xfb8d('0x29')](_0x3ab2f0)['json'](_0x68ab35);}};}function respondWithFilteredResult(_0x1cd931,_0x4ec298){return function(_0x3c2b07){if(_0x3c2b07){var _0x3c9dec=typeof _0x4ec298[_0xfb8d('0x2a')]==='undefined'&&typeof _0x4ec298[_0xfb8d('0x2b')]===_0xfb8d('0x2c');var _0x5c0483=_0x3c2b07[_0xfb8d('0x2d')];var _0x4dacd0=_0x3c9dec?0x0:_0x4ec298['offset'];var _0x55eaea=_0x3c9dec?_0x3c2b07['count']:_0x4ec298['offset']+_0x4ec298[_0xfb8d('0x2b')];var _0x11677e;if(_0x55eaea>=_0x5c0483){_0x55eaea=_0x5c0483;_0x11677e=0xc8;}else{_0x11677e=0xce;}_0x1cd931[_0xfb8d('0x29')](_0x11677e);return _0x1cd931[_0xfb8d('0x2e')](_0xfb8d('0x2f'),_0x4dacd0+'-'+_0x55eaea+'/'+_0x5c0483)['json'](_0x3c2b07);}return null;};}function patchUpdates(_0x390c50){return function(_0x2b7aa0){try{jsonpatch[_0xfb8d('0x30')](_0x2b7aa0,_0x390c50,!![]);}catch(_0x251909){return BPromise[_0xfb8d('0x31')](_0x251909);}return _0x2b7aa0['save']();};}function saveUpdates(_0x191b93,_0x3c85b5){return function(_0x4a0d97){if(_0x4a0d97){return _0x4a0d97[_0xfb8d('0x32')](_0x191b93)['then'](function(_0x36877f){return _0x36877f;});}return null;};}function removeEntity(_0x29a627,_0x154d6b){return function(_0xa02312){if(_0xa02312){return _0xa02312[_0xfb8d('0x33')]()['then'](function(){var _0x507c3f=_0xa02312[_0xfb8d('0x34')]({'plain':!![]});var _0x2a8f6d='SmsAccounts';return db['UserProfileResource'][_0xfb8d('0x33')]({'where':{'type':_0x2a8f6d,'resourceId':_0x507c3f['id']}})[_0xfb8d('0x35')](function(){return _0xa02312;});})[_0xfb8d('0x35')](function(){_0x29a627[_0xfb8d('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1800b4,_0x2a608c){return function(_0x2a34c9){if(!_0x2a34c9){_0x1800b4[_0xfb8d('0x27')](0x194);}return _0x2a34c9;};}function handleError(_0x28b322,_0x312639){_0x312639=_0x312639||0x1f4;return function(_0x5fdf8b){logger[_0xfb8d('0x24')](_0x5fdf8b['stack']);if(_0x5fdf8b['name']){delete _0x5fdf8b['name'];}_0x28b322['status'](_0x312639)[_0xfb8d('0x36')](_0x5fdf8b);};}exports['index']=function(_0x295ab9,_0x1d38c4){var _0x401f6a={'include':[{'model':db[_0xfb8d('0x37')],'as':_0xfb8d('0x38')}]},_0x30d216={},_0x4d6581={'count':0x0,'rows':[]};var _0x50dccb=_['map'](db[_0xfb8d('0x39')][_0xfb8d('0x3a')],function(_0x1057ea){return{'name':_0x1057ea[_0xfb8d('0x3b')],'type':_0x1057ea[_0xfb8d('0x3c')][_0xfb8d('0x3d')]};});_0x30d216[_0xfb8d('0x3e')]=_[_0xfb8d('0x3f')](_0x50dccb,_0xfb8d('0x40'));_0x30d216[_0xfb8d('0x41')]=_['keys'](_0x295ab9[_0xfb8d('0x41')]);_0x30d216['filters']=_[_0xfb8d('0x42')](_0x30d216['model'],_0x30d216[_0xfb8d('0x41')]);_0x401f6a[_0xfb8d('0x43')]=_[_0xfb8d('0x42')](_0x30d216['model'],qs[_0xfb8d('0x44')](_0x295ab9[_0xfb8d('0x41')][_0xfb8d('0x44')]));_0x401f6a['attributes']=_0x401f6a['attributes'][_0xfb8d('0x45')]?_0x401f6a[_0xfb8d('0x43')]:_0x30d216[_0xfb8d('0x3e')];if(!_0x295ab9[_0xfb8d('0x41')][_0xfb8d('0x46')](_0xfb8d('0x47'))){_0x401f6a[_0xfb8d('0x2b')]=qs[_0xfb8d('0x2b')](_0x295ab9[_0xfb8d('0x41')][_0xfb8d('0x2b')]);_0x401f6a['offset']=qs['offset'](_0x295ab9[_0xfb8d('0x41')][_0xfb8d('0x2a')]);}_0x401f6a['order']=qs[_0xfb8d('0x48')](_0x295ab9[_0xfb8d('0x41')]['sort']);_0x401f6a[_0xfb8d('0x49')]=qs[_0xfb8d('0x4a')](_[_0xfb8d('0x4b')](_0x295ab9[_0xfb8d('0x41')],_0x30d216[_0xfb8d('0x4a')]),_0x50dccb);if(_0x295ab9[_0xfb8d('0x41')][_0xfb8d('0x4c')]){_0x401f6a['where']=_[_0xfb8d('0x4d')](_0x401f6a[_0xfb8d('0x49')],{'$or':_[_0xfb8d('0x3f')](_0x50dccb,function(_0x5e76d4){if(_0x5e76d4[_0xfb8d('0x3c')]!==_0xfb8d('0x4e')){var _0x36ad52={};_0x36ad52[_0x5e76d4['name']]={'$like':'%'+_0x295ab9[_0xfb8d('0x41')][_0xfb8d('0x4c')]+'%'};return _0x36ad52;}})});}_0x401f6a=_[_0xfb8d('0x4d')]({},_0x401f6a,_0x295ab9[_0xfb8d('0x4f')]);var _0x3a7af4={'where':_0x401f6a[_0xfb8d('0x49')]};return db[_0xfb8d('0x39')][_0xfb8d('0x2d')](_0x3a7af4)[_0xfb8d('0x35')](function(_0x41a8ec){_0x4d6581['count']=_0x41a8ec;if(_0x295ab9['query']['includeAll']){_0x401f6a[_0xfb8d('0x50')]=[{'all':!![]}];}return db[_0xfb8d('0x39')][_0xfb8d('0x51')](_0x401f6a);})[_0xfb8d('0x35')](function(_0xd11e0a){_0x4d6581['rows']=_0xd11e0a;return _0x4d6581;})[_0xfb8d('0x35')](respondWithFilteredResult(_0x1d38c4,_0x401f6a))[_0xfb8d('0x26')](handleError(_0x1d38c4,null));};exports[_0xfb8d('0x52')]=function(_0x16232a,_0x34cd6d){var _0x2e8a5c={'raw':![],'where':{'id':_0x16232a[_0xfb8d('0x53')]['id']},'include':[{'model':db[_0xfb8d('0x37')],'as':_0xfb8d('0x38')}]},_0x53b3c2={};_0x53b3c2[_0xfb8d('0x3e')]=_[_0xfb8d('0x54')](db[_0xfb8d('0x39')][_0xfb8d('0x3a')]);_0x53b3c2[_0xfb8d('0x41')]=_[_0xfb8d('0x54')](_0x16232a['query']);_0x53b3c2[_0xfb8d('0x4a')]=_[_0xfb8d('0x42')](_0x53b3c2[_0xfb8d('0x3e')],_0x53b3c2['query']);_0x2e8a5c[_0xfb8d('0x43')]=_[_0xfb8d('0x42')](_0x53b3c2[_0xfb8d('0x3e')],qs[_0xfb8d('0x44')](_0x16232a[_0xfb8d('0x41')][_0xfb8d('0x44')]));_0x2e8a5c[_0xfb8d('0x43')]=_0x2e8a5c['attributes'][_0xfb8d('0x45')]?_0x2e8a5c[_0xfb8d('0x43')]:_0x53b3c2['model'];if(_0x16232a[_0xfb8d('0x41')][_0xfb8d('0x55')]){_0x2e8a5c['include']=[{'all':!![]}];}_0x2e8a5c=_['merge']({},_0x2e8a5c,_0x16232a[_0xfb8d('0x4f')]);return db[_0xfb8d('0x39')]['find'](_0x2e8a5c)['then'](handleEntityNotFound(_0x34cd6d,null))['then'](respondWithResult(_0x34cd6d,null))[_0xfb8d('0x26')](handleError(_0x34cd6d,null));};exports['create']=function(_0x320b92,_0xf5d314){return db[_0xfb8d('0x39')]['create'](_0x320b92[_0xfb8d('0x56')],{})['then'](function(_0x2dd6a7){var _0x5e11ef=_0x320b92[_0xfb8d('0x57')][_0xfb8d('0x34')]({'plain':!![]});if(!_0x5e11ef)throw new Error(_0xfb8d('0x58'));if(_0x5e11ef[_0xfb8d('0x59')]===_0xfb8d('0x57')){var _0x526b38=_0x2dd6a7[_0xfb8d('0x34')]({'plain':!![]});var _0x14857b='SmsAccounts';return db[_0xfb8d('0x5a')][_0xfb8d('0x5b')]({'where':{'name':_0x14857b,'userProfileId':_0x5e11ef['userProfileId']},'raw':!![]})[_0xfb8d('0x35')](function(_0x3a28b1){if(_0x3a28b1&&_0x3a28b1[_0xfb8d('0x5c')]===0x0){return db[_0xfb8d('0x5d')]['create']({'name':_0x526b38['name'],'resourceId':_0x526b38['id'],'type':_0x3a28b1[_0xfb8d('0x40')],'sectionId':_0x3a28b1['id']},{})[_0xfb8d('0x35')](function(){return _0x2dd6a7;});}else{return _0x2dd6a7;}})[_0xfb8d('0x26')](function(_0x3e7506){logger[_0xfb8d('0x24')](_0xfb8d('0x5e'),_0x3e7506);throw _0x3e7506;});}return _0x2dd6a7;})[_0xfb8d('0x35')](respondWithResult(_0xf5d314,0xc9))[_0xfb8d('0x26')](handleError(_0xf5d314,null));};exports[_0xfb8d('0x32')]=function(_0x351255,_0x2f773c){if(_0x351255[_0xfb8d('0x56')]['id']){delete _0x351255[_0xfb8d('0x56')]['id'];}return db[_0xfb8d('0x39')][_0xfb8d('0x5b')]({'where':{'id':_0x351255['params']['id']},'include':[{'model':db[_0xfb8d('0x37')],'as':'mandatoryDispositionPause'}]})[_0xfb8d('0x35')](handleEntityNotFound(_0x2f773c,null))[_0xfb8d('0x35')](saveUpdates(_0x351255['body'],null))[_0xfb8d('0x35')](respondWithResult(_0x2f773c,null))[_0xfb8d('0x26')](handleError(_0x2f773c,null));};exports[_0xfb8d('0x33')]=function(_0x5c905d,_0x5b7097){return db[_0xfb8d('0x39')][_0xfb8d('0x5b')]({'where':{'id':_0x5c905d[_0xfb8d('0x53')]['id']}})[_0xfb8d('0x35')](handleEntityNotFound(_0x5b7097,null))['then'](removeEntity(_0x5b7097,null))[_0xfb8d('0x26')](handleError(_0x5b7097,null));};exports['describe']=function(_0x5b8b6a,_0x5d9f49){return db[_0xfb8d('0x39')]['describe']()['then'](respondWithResult(_0x5d9f49,null))[_0xfb8d('0x26')](handleError(_0x5d9f49,null));};exports[_0xfb8d('0x5f')]=function(_0x855735,_0x1b5f47,_0x502741){if(_0x855735[_0xfb8d('0x56')]['id']){delete _0x855735[_0xfb8d('0x56')]['id'];}return db[_0xfb8d('0x39')][_0xfb8d('0x5b')]({'where':{'id':_0x855735[_0xfb8d('0x53')]['id']}})[_0xfb8d('0x35')](handleEntityNotFound(_0x1b5f47,null))['then'](function(_0x191317){if(_0x191317){_0x855735[_0xfb8d('0x56')][_0xfb8d('0x60')]=_0x191317['id'];return db[_0xfb8d('0x61')][_0xfb8d('0x62')](_0x855735[_0xfb8d('0x56')]);}})[_0xfb8d('0x35')](respondWithResult(_0x1b5f47,null))[_0xfb8d('0x26')](handleError(_0x1b5f47,null));};exports['getDispositions']=function(_0xb40675,_0x5ddd9c,_0x244695){var _0x52e431={'raw':![],'where':{}};var _0x16df92={};var _0x252170={'count':0x0,'rows':[]};return db[_0xfb8d('0x39')][_0xfb8d('0x63')]({'where':{'id':_0xb40675[_0xfb8d('0x53')]['id']}})[_0xfb8d('0x35')](handleEntityNotFound(_0x5ddd9c,null))[_0xfb8d('0x35')](function(_0x1b5c07){if(_0x1b5c07){_0x16df92[_0xfb8d('0x3e')]=_[_0xfb8d('0x54')](db[_0xfb8d('0x61')][_0xfb8d('0x3a')]);_0x16df92['query']=_[_0xfb8d('0x54')](_0xb40675[_0xfb8d('0x41')]);_0x16df92[_0xfb8d('0x4a')]=_[_0xfb8d('0x42')](_0x16df92[_0xfb8d('0x3e')],_0x16df92[_0xfb8d('0x41')]);_0x52e431[_0xfb8d('0x43')]=_[_0xfb8d('0x42')](_0x16df92[_0xfb8d('0x3e')],qs['fields'](_0xb40675[_0xfb8d('0x41')][_0xfb8d('0x44')]));_0x52e431[_0xfb8d('0x43')]=_0x52e431['attributes']['length']?_0x52e431['attributes']:_0x16df92[_0xfb8d('0x3e')];if(!_0xb40675[_0xfb8d('0x41')][_0xfb8d('0x46')]('nolimit')){_0x52e431['limit']=qs[_0xfb8d('0x2b')](_0xb40675['query'][_0xfb8d('0x2b')]);_0x52e431[_0xfb8d('0x2a')]=qs['offset'](_0xb40675[_0xfb8d('0x41')][_0xfb8d('0x2a')]);}_0x52e431[_0xfb8d('0x64')]=qs[_0xfb8d('0x48')](_0xb40675['query'][_0xfb8d('0x48')]);_0x52e431[_0xfb8d('0x49')]=qs['filters'](_[_0xfb8d('0x4b')](_0xb40675[_0xfb8d('0x41')],_0x16df92[_0xfb8d('0x4a')]));_0x52e431[_0xfb8d('0x49')][_0xfb8d('0x60')]=_0x1b5c07['id'];if(_0xb40675['query'][_0xfb8d('0x4c')]){_0x52e431[_0xfb8d('0x49')]=_[_0xfb8d('0x4d')](_0x52e431[_0xfb8d('0x49')],{'$or':_['map'](_0x52e431[_0xfb8d('0x43')],function(_0x45d7f6){var _0x39e3ff={};_0x39e3ff[_0x45d7f6]={'$like':'%'+_0xb40675[_0xfb8d('0x41')][_0xfb8d('0x4c')]+'%'};return _0x39e3ff;})});}_0x52e431=_[_0xfb8d('0x4d')]({},_0x52e431,_0xb40675['options']);return db[_0xfb8d('0x61')][_0xfb8d('0x2d')]({'where':_0x52e431[_0xfb8d('0x49')]})[_0xfb8d('0x35')](function(_0x13f044){_0x252170[_0xfb8d('0x2d')]=_0x13f044;if(_0xb40675[_0xfb8d('0x41')][_0xfb8d('0x55')]){_0x52e431[_0xfb8d('0x50')]=[{'all':!![]}];}return db[_0xfb8d('0x61')][_0xfb8d('0x51')](_0x52e431);})[_0xfb8d('0x35')](function(_0x3130b8){_0x252170['rows']=_0x3130b8;return _0x252170;});}})[_0xfb8d('0x35')](respondWithFilteredResult(_0x5ddd9c,_0x52e431))[_0xfb8d('0x26')](handleError(_0x5ddd9c,null));};exports[_0xfb8d('0x65')]=function(_0x6af495,_0x59463b,_0x3d0b28){return db[_0xfb8d('0x39')][_0xfb8d('0x5b')]({'where':{'id':_0x6af495[_0xfb8d('0x53')]['id']}})['then'](handleEntityNotFound(_0x59463b,null))[_0xfb8d('0x35')](function(_0x924dae){if(_0x924dae){return _0x924dae[_0xfb8d('0x65')](_0x6af495[_0xfb8d('0x41')]['ids']);}})[_0xfb8d('0x35')](respondWithStatusCode(_0x59463b,null))[_0xfb8d('0x26')](handleError(_0x59463b,null));};exports[_0xfb8d('0x66')]=function(_0x491e71,_0x287627,_0x4c64b4){if(_0x491e71[_0xfb8d('0x56')]['id']){delete _0x491e71[_0xfb8d('0x56')]['id'];}return db['SmsAccount'][_0xfb8d('0x5b')]({'where':{'id':_0x491e71[_0xfb8d('0x53')]['id']}})[_0xfb8d('0x35')](handleEntityNotFound(_0x287627,null))[_0xfb8d('0x35')](function(_0x259021){if(_0x259021){_0x491e71[_0xfb8d('0x56')][_0xfb8d('0x60')]=_0x259021['id'];return db['CannedAnswer'][_0xfb8d('0x62')](_0x491e71[_0xfb8d('0x56')]);}})[_0xfb8d('0x35')](respondWithResult(_0x287627,null))[_0xfb8d('0x26')](handleError(_0x287627,null));};exports[_0xfb8d('0x67')]=function(_0x2a8e3c,_0x130ad5,_0x3c5028){var _0x41d11d={'raw':![],'where':{}};var _0x36e6ad={};var _0x29561b={'count':0x0,'rows':[]};return db[_0xfb8d('0x39')][_0xfb8d('0x63')]({'where':{'id':_0x2a8e3c['params']['id']}})[_0xfb8d('0x35')](handleEntityNotFound(_0x130ad5,null))[_0xfb8d('0x35')](function(_0x8db014){if(_0x8db014){_0x36e6ad[_0xfb8d('0x3e')]=_[_0xfb8d('0x54')](db[_0xfb8d('0x68')][_0xfb8d('0x3a')]);_0x36e6ad[_0xfb8d('0x41')]=_['keys'](_0x2a8e3c['query']);_0x36e6ad[_0xfb8d('0x4a')]=_[_0xfb8d('0x42')](_0x36e6ad[_0xfb8d('0x3e')],_0x36e6ad[_0xfb8d('0x41')]);_0x41d11d[_0xfb8d('0x43')]=_[_0xfb8d('0x42')](_0x36e6ad[_0xfb8d('0x3e')],qs[_0xfb8d('0x44')](_0x2a8e3c[_0xfb8d('0x41')]['fields']));_0x41d11d[_0xfb8d('0x43')]=_0x41d11d[_0xfb8d('0x43')][_0xfb8d('0x45')]?_0x41d11d[_0xfb8d('0x43')]:_0x36e6ad[_0xfb8d('0x3e')];if(!_0x2a8e3c[_0xfb8d('0x41')]['hasOwnProperty'](_0xfb8d('0x47'))){_0x41d11d[_0xfb8d('0x2b')]=qs[_0xfb8d('0x2b')](_0x2a8e3c[_0xfb8d('0x41')][_0xfb8d('0x2b')]);_0x41d11d[_0xfb8d('0x2a')]=qs[_0xfb8d('0x2a')](_0x2a8e3c['query']['offset']);}_0x41d11d[_0xfb8d('0x64')]=qs[_0xfb8d('0x48')](_0x2a8e3c['query']['sort']);_0x41d11d[_0xfb8d('0x49')]=qs[_0xfb8d('0x4a')](_[_0xfb8d('0x4b')](_0x2a8e3c['query'],_0x36e6ad['filters']));_0x41d11d['where'][_0xfb8d('0x60')]=_0x8db014['id'];if(_0x2a8e3c['query'][_0xfb8d('0x4c')]){_0x41d11d[_0xfb8d('0x49')]=_[_0xfb8d('0x4d')](_0x41d11d[_0xfb8d('0x49')],{'$or':_[_0xfb8d('0x3f')](_0x41d11d['attributes'],function(_0x20cc89){var _0x45c2db={};_0x45c2db[_0x20cc89]={'$like':'%'+_0x2a8e3c[_0xfb8d('0x41')][_0xfb8d('0x4c')]+'%'};return _0x45c2db;})});}_0x41d11d=_[_0xfb8d('0x4d')]({},_0x41d11d,_0x2a8e3c[_0xfb8d('0x4f')]);return db['CannedAnswer'][_0xfb8d('0x2d')]({'where':_0x41d11d[_0xfb8d('0x49')]})[_0xfb8d('0x35')](function(_0x44ea66){_0x29561b['count']=_0x44ea66;if(_0x2a8e3c[_0xfb8d('0x41')][_0xfb8d('0x55')]){_0x41d11d['include']=[{'all':!![]}];}return db[_0xfb8d('0x68')]['findAll'](_0x41d11d);})['then'](function(_0x36b364){_0x29561b['rows']=_0x36b364;return _0x29561b;});}})['then'](respondWithFilteredResult(_0x130ad5,_0x41d11d))[_0xfb8d('0x26')](handleError(_0x130ad5,null));};exports[_0xfb8d('0x69')]=function(_0x2e4206,_0x557658,_0x563216){return db[_0xfb8d('0x39')][_0xfb8d('0x5b')]({'where':{'id':_0x2e4206[_0xfb8d('0x53')]['id']}})[_0xfb8d('0x35')](handleEntityNotFound(_0x557658,null))['then'](function(_0x3be486){if(_0x3be486){return _0x3be486['removeAnswers'](_0x2e4206[_0xfb8d('0x41')][_0xfb8d('0x6a')]);}})['then'](respondWithStatusCode(_0x557658,null))['catch'](handleError(_0x557658,null));};exports[_0xfb8d('0x6b')]=function(_0x450158,_0x382f7e,_0x388cf4){var _0x2803e7={'channel':_0xfb8d('0x6c')};var _0x680a33=[];var _0x402408=[];var _0x2c0ce5={};return db[_0xfb8d('0x39')]['find']({'where':{'id':_0x450158[_0xfb8d('0x53')]['id']},'include':[{'model':db[_0xfb8d('0x6d')],'as':_0xfb8d('0x6e')}]})[_0xfb8d('0x35')](handleEntityNotFound(_0x382f7e,null))[_0xfb8d('0x35')](function(_0x22e4e7){_0x2803e7['account']=_0x22e4e7;_0x2803e7[_0xfb8d('0x6f')]=_['orderBy'](_0x22e4e7[_0xfb8d('0x6e')],[_0xfb8d('0x70')],['asc']);if(_0x2803e7[_0xfb8d('0x71')]['Applications']){delete _0x2803e7[_0xfb8d('0x71')][_0xfb8d('0x6e')];}return db['CmContact']['describe']();})['then'](function(_0x3dc7c1){if(!_0x3dc7c1){throw new db[(_0xfb8d('0x72'))][(_0xfb8d('0x73'))](_0xfb8d('0x74'));}_0x680a33=_[_0xfb8d('0x75')](_[_0xfb8d('0x54')](_0x3dc7c1),[_0xfb8d('0x76'),_0xfb8d('0x77')]);_0x402408=_[_0xfb8d('0x75')](_[_0xfb8d('0x54')](_0x3dc7c1),[_0xfb8d('0x76'),'updatedAt','CompanyId',_0xfb8d('0x78')]);_0x2803e7[_0xfb8d('0x56')]={'mapKey':_0xfb8d('0x79')};if(_0x2803e7[_0xfb8d('0x71')][_0xfb8d('0x3c')]){switch(_0x2803e7[_0xfb8d('0x71')][_0xfb8d('0x3c')]){case _0xfb8d('0x7a'):_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x7b')]=_0x450158[_0xfb8d('0x56')][_0xfb8d('0x7c')];_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x56')]=_0x450158[_0xfb8d('0x56')][_0xfb8d('0x7d')];_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x7e')]=_0x450158[_0xfb8d('0x56')][_0xfb8d('0x7f')];break;case _0xfb8d('0x80'):_0x2803e7[_0xfb8d('0x56')]['from']='+'+_0x450158['body']['sender'];_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x56')]=_0x450158[_0xfb8d('0x56')]['text'];break;case _0xfb8d('0x81'):_0x2803e7['body']['from']=_0x450158[_0xfb8d('0x56')][_0xfb8d('0x7b')];_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x56')]=_0x450158[_0xfb8d('0x56')][_0xfb8d('0x25')];break;case _0xfb8d('0x82'):_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x7b')]=_0x450158['body'][_0xfb8d('0x7b')];_0x2803e7[_0xfb8d('0x56')]['body']=_0x450158[_0xfb8d('0x56')][_0xfb8d('0x56')];_0x2803e7[_0xfb8d('0x56')]['messageId']=_0x450158['body'][_0xfb8d('0x83')];break;case'plivo':_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x7b')]=_0x450158['body'][_0xfb8d('0x7c')];_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x56')]=_0x450158[_0xfb8d('0x56')][_0xfb8d('0x84')];_0x2803e7['body'][_0xfb8d('0x7e')]=_0x450158[_0xfb8d('0x56')][_0xfb8d('0x85')];break;case'infobip':_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x7b')]='+'+_0x450158[_0xfb8d('0x56')][_0xfb8d('0x86')][0x0][_0xfb8d('0x7b')];_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x56')]=_0x450158['body'][_0xfb8d('0x86')][0x0]['text'];_0x2803e7['body'][_0xfb8d('0x7e')]=_0x450158[_0xfb8d('0x56')]['results'][0x0][_0xfb8d('0x7e')];break;case _0xfb8d('0x87'):_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x7b')]=_0x450158['body'][_0xfb8d('0x88')];_0x2803e7[_0xfb8d('0x56')]['body']=_0x450158['body']['segmentedMessage']['message'];break;case _0xfb8d('0x89'):_0x2803e7['body'][_0xfb8d('0x7b')]=_0x450158[_0xfb8d('0x56')]['fromNumber'];_0x2803e7['body']['body']=_0x450158[_0xfb8d('0x56')][_0xfb8d('0x8a')];_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x7e')]=_0x450158[_0xfb8d('0x56')][_0xfb8d('0x8b')];break;case _0xfb8d('0x8c'):_0x2803e7['body']['messageId']=_0x450158['body'][0x0][_0xfb8d('0x25')]['id'];_0x2803e7[_0xfb8d('0x56')]['from']=_0x450158['body'][0x0][_0xfb8d('0x25')][_0xfb8d('0x7b')];_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x56')]=_0x450158[_0xfb8d('0x56')][0x0][_0xfb8d('0x25')]['text'];break;case _0xfb8d('0x8d'):_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x7b')]=_0x450158[_0xfb8d('0x56')]['from'];_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x56')]=_0x450158[_0xfb8d('0x56')][_0xfb8d('0x25')];_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x7e')]=_0x450158[_0xfb8d('0x56')][_0xfb8d('0x8e')];break;}}if(_0x2803e7['body']['id']){delete _0x2803e7[_0xfb8d('0x56')]['id'];}if(_['isNil'](_0x2803e7[_0xfb8d('0x56')]['from'])){throw new db[(_0xfb8d('0x72'))][(_0xfb8d('0x73'))]('from\x20is\x20mandatory');}if(_[_0xfb8d('0x8f')](_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x56')])||_0x2803e7[_0xfb8d('0x56')]['body']===''){throw new db['Sequelize'][(_0xfb8d('0x73'))](_0xfb8d('0x90'));}if(_[_0xfb8d('0x8f')](_0x2803e7['body']['mapKey'])){throw new db[(_0xfb8d('0x72'))][(_0xfb8d('0x73'))](_0xfb8d('0x91')+_0x402408);}if(!_['includes'](_0x402408,_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x92')])){throw new db['Sequelize'][(_0xfb8d('0x73'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x402408);}_0x2c0ce5[_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x92')]]=_0x2803e7['body']['from'];return db['CmList'][_0xfb8d('0x5b')]({'where':{'id':_0x2803e7[_0xfb8d('0x71')][_0xfb8d('0x78')]},'include':[{'model':db[_0xfb8d('0x93')],'as':_0xfb8d('0x94'),'where':_0x2c0ce5,'limit':0x1,'order':[[_0xfb8d('0x77'),'DESC']]}]});})['then'](handleEntityNotFound(_0x382f7e,null))[_0xfb8d('0x35')](function(_0x113f80){if(_0x113f80){_0x2803e7['list']=_[_0xfb8d('0x95')](_0x113f80,[_0xfb8d('0x94')]);if(_0x113f80['Contacts'][_0xfb8d('0x45')]){return _0x113f80[_0xfb8d('0x94')][0x0];}var _0x39d757=_[_0xfb8d('0x19')](_0x2803e7[_0xfb8d('0x56')],{'firstName':_0x2803e7['body']['from'],'ListId':_0x113f80['id']});_0x39d757[_0x2803e7['body'][_0xfb8d('0x92')]]=_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x7b')];return db[_0xfb8d('0x93')][_0xfb8d('0x62')](_0x39d757,{'fields':_0x680a33,'raw':!![]});}})[_0xfb8d('0x35')](handleEntityNotFound(_0x382f7e,null))[_0xfb8d('0x35')](function(_0x149171){if(_0x149171){_0x2803e7[_0xfb8d('0x96')]=_0x149171;var _0x192386={'ContactId':_0x149171['id'],'phone':_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x7b')],'SmsAccountId':_0x450158[_0xfb8d('0x53')]['id']};var _0x47ca26={'ContactId':_0x149171['id'],'SmsAccountId':_0x450158[_0xfb8d('0x53')]['id'],'closed':![]};return db[_0xfb8d('0x97')][_0xfb8d('0x5b')]({'where':_0x47ca26})[_0xfb8d('0x35')](function(_0x267ac6){if(_0x267ac6){return[_0x267ac6,![]];}return db[_0xfb8d('0x97')][_0xfb8d('0x62')](_0x192386)['then'](function(_0x128176){return[_0x128176,!![]];});});}})['spread'](function(_0x1dd57c,_0x24fbd9){_0x2803e7['interaction']=_0x1dd57c[_0xfb8d('0x34')]({'plain':!![]});_0x2803e7[_0xfb8d('0x98')][_0xfb8d('0x99')]=![];if(_0x24fbd9){if(_0x2803e7[_0xfb8d('0x71')]['autoclose']){_0x2803e7[_0xfb8d('0x6f')][_0xfb8d('0x9a')]({'id':0x0,'priority':_0x2803e7['applications'][_0xfb8d('0x45')]+0x1,'app':_0xfb8d('0x9b'),'appdata':_0xfb8d('0x9c'),'interval':'*,*,*,*'});}_0x2803e7[_0xfb8d('0x98')][_0xfb8d('0x99')]=!![];}return db[_0xfb8d('0x9d')][_0xfb8d('0x62')]({'phone':_0x2803e7[_0xfb8d('0x56')][_0xfb8d('0x7b')],'messageId':_0x2803e7['body'][_0xfb8d('0x7e')],'body':_0x2803e7['body']['body'],'SmsAccountId':_0x450158[_0xfb8d('0x53')]['id'],'SmsInteractionId':_0x1dd57c['id'],'direction':'in','ContactId':_0x1dd57c[_0xfb8d('0x9e')],'AttachmentId':_0x2803e7[_0xfb8d('0x56')]['AttachmentId']});})[_0xfb8d('0x35')](function(_0x8a3202){_0x2803e7[_0xfb8d('0x25')]=_0x8a3202;if(_0x2803e7[_0xfb8d('0x98')]['UserId']){return db[_0xfb8d('0x9f')][_0xfb8d('0x5b')]({'attributes':['id','name'],'where':{'id':_0x2803e7[_0xfb8d('0x98')]['UserId']}})['then'](function(_0x4ec0d9){if(_0x4ec0d9){_0x2803e7[_0xfb8d('0x6f')][_0xfb8d('0xa0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4ec0d9[_0xfb8d('0x40')]+','+(_0x2803e7[_0xfb8d('0x71')][_0xfb8d('0xa1')]||0xa),'interval':_0xfb8d('0xa2')});}return respondWithRpcPromise(_0xfb8d('0xa3'),_0xfb8d('0xa4'),_0x2803e7);});}return respondWithRpcPromise(_0xfb8d('0xa3'),_0xfb8d('0xa4'),_0x2803e7);})[_0xfb8d('0x35')](function(_0x717354){if(_0x717354){var _0x59d3e1=0xc8;var _0xb809e4=_0xfb8d('0xa5');logger[_0xfb8d('0x1e')](_0xfb8d('0x22'),_0xb809e4,_0x59d3e1,_0xfb8d('0xa6'));logger[_0xfb8d('0x21')](_0xfb8d('0xa7'),_0xb809e4,_0x59d3e1,_0xfb8d('0xa6'),JSON[_0xfb8d('0x23')](_0x717354));if(_0x2803e7[_0xfb8d('0x71')][_0xfb8d('0x3c')]===_0xfb8d('0x7a')){return _0x382f7e[_0xfb8d('0x29')](_0x59d3e1)[_0xfb8d('0x2e')](_0xfb8d('0xa8'),_0xfb8d('0xa9'))[_0xfb8d('0x36')]('\x0a');}else{return _0x382f7e['status'](_0x59d3e1)[_0xfb8d('0xaa')](_0x717354);}}})[_0xfb8d('0x26')](handleError(_0x382f7e,null));};exports[_0xfb8d('0xab')]=function(_0x2d8045,_0xdb5fbf,_0x1bb4a5){return db[_0xfb8d('0x39')][_0xfb8d('0x63')]({'where':{'id':_0x2d8045[_0xfb8d('0x53')]['id']}})['then'](handleEntityNotFound(_0xdb5fbf,null))['then'](function(_0x16f21a){if(_0x16f21a){return db[_0xfb8d('0xac')][_0xfb8d('0xad')](function(_0x7b8cf8){return db[_0xfb8d('0x6d')]['destroy']({'where':{'SmsAccountId':_0x2d8045[_0xfb8d('0x53')]['id']},'transaction':_0x7b8cf8})['then'](function(_0x183076){var _0x598b5a=_['map'](_0x2d8045['body'],function(_0x5692f6){_0x5692f6[_0xfb8d('0x60')]=_0x2d8045[_0xfb8d('0x53')]['id'];return _0x5692f6;});return db['SmsApplication']['bulkCreate'](_0x598b5a,{'transaction':_0x7b8cf8});});})[_0xfb8d('0x35')](function(){return db['SmsApplication'][_0xfb8d('0xae')]({'where':{'SmsAccountId':_0x2d8045[_0xfb8d('0x53')]['id']},'order':_0xfb8d('0x70')});});}})[_0xfb8d('0x35')](respondWithResult(_0xdb5fbf,null))['catch'](handleError(_0xdb5fbf,null));};exports[_0xfb8d('0xaf')]=function(_0x5a7b1e,_0x102124,_0x300e18){var _0x1593b1={};var _0x55a204={};var _0x49c3f1;var _0x3c6445;return db[_0xfb8d('0x39')]['findOne']({'where':{'id':_0x5a7b1e['params']['id']}})[_0xfb8d('0x35')](handleEntityNotFound(_0x102124,null))[_0xfb8d('0x35')](function(_0x4f4061){if(_0x4f4061){_0x49c3f1=_0x4f4061;_0x55a204['model']=_[_0xfb8d('0x54')](db[_0xfb8d('0x6d')]['rawAttributes']);_0x55a204['query']=_[_0xfb8d('0x54')](_0x5a7b1e[_0xfb8d('0x41')]);_0x55a204[_0xfb8d('0x4a')]=_[_0xfb8d('0x42')](_0x55a204[_0xfb8d('0x3e')],_0x55a204[_0xfb8d('0x41')]);_0x1593b1[_0xfb8d('0x43')]=_[_0xfb8d('0x42')](_0x55a204[_0xfb8d('0x3e')],qs[_0xfb8d('0x44')](_0x5a7b1e[_0xfb8d('0x41')][_0xfb8d('0x44')]));_0x1593b1[_0xfb8d('0x43')]=_0x1593b1[_0xfb8d('0x43')][_0xfb8d('0x45')]?_0x1593b1[_0xfb8d('0x43')]:_0x55a204[_0xfb8d('0x3e')];_0x1593b1['order']=qs[_0xfb8d('0x48')](_0x5a7b1e['query']['sort']);_0x1593b1[_0xfb8d('0x49')]=qs['filters'](_[_0xfb8d('0x4b')](_0x5a7b1e[_0xfb8d('0x41')],_0x55a204[_0xfb8d('0x4a')]));if(_0x5a7b1e['query'][_0xfb8d('0x4c')]){_0x1593b1[_0xfb8d('0x49')]=_['merge'](_0x1593b1['where'],{'$or':_[_0xfb8d('0x3f')](_0x1593b1[_0xfb8d('0x43')],function(_0x4be936){var _0x2f87b6={};_0x2f87b6[_0x4be936]={'$like':'%'+_0x5a7b1e['query'][_0xfb8d('0x4c')]+'%'};return _0x2f87b6;})});}_0x1593b1=_[_0xfb8d('0x4d')]({},_0x1593b1,_0x5a7b1e[_0xfb8d('0x4f')]);return _0x49c3f1[_0xfb8d('0xaf')](_0x1593b1);}})[_0xfb8d('0x35')](function(_0x61d5f0){if(_0x61d5f0){_0x3c6445=_0x61d5f0['length'];if(!_0x5a7b1e[_0xfb8d('0x41')]['hasOwnProperty'](_0xfb8d('0x47'))){_0x1593b1[_0xfb8d('0x2b')]=qs[_0xfb8d('0x2b')](_0x5a7b1e[_0xfb8d('0x41')][_0xfb8d('0x2b')]);_0x1593b1[_0xfb8d('0x2a')]=qs[_0xfb8d('0x2a')](_0x5a7b1e[_0xfb8d('0x41')][_0xfb8d('0x2a')]);}return _0x49c3f1[_0xfb8d('0xaf')](_0x1593b1);}})[_0xfb8d('0x35')](function(_0x4b80e0){if(_0x4b80e0){return _0x4b80e0?{'count':_0x3c6445,'rows':_0x4b80e0}:null;}})[_0xfb8d('0x35')](respondWithResult(_0x102124,null))[_0xfb8d('0x26')](handleError(_0x102124,null));};exports['getInteractions']=function(_0x4510c8,_0x7f51c5,_0x35e2de){var _0x5592d7={'raw':![],'where':{}};var _0x10c428={};var _0x584dd2={'count':0x0,'rows':[]};return db[_0xfb8d('0x39')]['findOne']({'where':{'id':_0x4510c8[_0xfb8d('0x53')]['id']}})[_0xfb8d('0x35')](handleEntityNotFound(_0x7f51c5,null))[_0xfb8d('0x35')](function(_0x288a6e){if(_0x288a6e){_0x10c428[_0xfb8d('0x3e')]=_[_0xfb8d('0x54')](db[_0xfb8d('0x97')][_0xfb8d('0x3a')]);_0x10c428[_0xfb8d('0x41')]=_[_0xfb8d('0x54')](_0x4510c8[_0xfb8d('0x41')]);_0x10c428[_0xfb8d('0x4a')]=_[_0xfb8d('0x42')](_0x10c428[_0xfb8d('0x3e')],_0x10c428['query']);_0x5592d7[_0xfb8d('0x43')]=_[_0xfb8d('0x42')](_0x10c428[_0xfb8d('0x3e')],qs[_0xfb8d('0x44')](_0x4510c8[_0xfb8d('0x41')][_0xfb8d('0x44')]));_0x5592d7[_0xfb8d('0x43')]=_0x5592d7[_0xfb8d('0x43')][_0xfb8d('0x45')]?_0x5592d7[_0xfb8d('0x43')]:_0x10c428['model'];if(!_0x4510c8[_0xfb8d('0x41')]['hasOwnProperty'](_0xfb8d('0x47'))){_0x5592d7[_0xfb8d('0x2b')]=qs[_0xfb8d('0x2b')](_0x4510c8[_0xfb8d('0x41')]['limit']);_0x5592d7['offset']=qs['offset'](_0x4510c8[_0xfb8d('0x41')][_0xfb8d('0x2a')]);}_0x5592d7['order']=qs[_0xfb8d('0x48')](_0x4510c8[_0xfb8d('0x41')][_0xfb8d('0x48')]);_0x5592d7[_0xfb8d('0x49')]=qs[_0xfb8d('0x4a')](_[_0xfb8d('0x4b')](_0x4510c8[_0xfb8d('0x41')],_0x10c428[_0xfb8d('0x4a')]));_0x5592d7[_0xfb8d('0x49')][_0xfb8d('0x60')]=_0x288a6e['id'];if(_0x4510c8['query'][_0xfb8d('0x4c')]){_0x5592d7[_0xfb8d('0x49')]=_[_0xfb8d('0x4d')](_0x5592d7[_0xfb8d('0x49')],{'$or':_[_0xfb8d('0x3f')](_0x5592d7[_0xfb8d('0x43')],function(_0x217f93){var _0xab4fea={};_0xab4fea[_0x217f93]={'$like':'%'+_0x4510c8['query'][_0xfb8d('0x4c')]+'%'};return _0xab4fea;})});}_0x5592d7=_[_0xfb8d('0x4d')]({},_0x5592d7,_0x4510c8['options']);return db[_0xfb8d('0x97')][_0xfb8d('0x2d')]({'where':_0x5592d7[_0xfb8d('0x49')]})[_0xfb8d('0x35')](function(_0x4e61f9){_0x584dd2['count']=_0x4e61f9;if(_0x4510c8[_0xfb8d('0x41')][_0xfb8d('0x55')]){_0x5592d7[_0xfb8d('0x50')]=[{'model':db[_0xfb8d('0x93')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xfb8d('0xb0'),'attributes':[_0xfb8d('0x40'),'fullname',_0xfb8d('0xb1')],'required':![]},{'model':db[_0xfb8d('0xb2')],'as':_0xfb8d('0xb3'),'attributes':['id',_0xfb8d('0x40'),_0xfb8d('0xb4')],'where':_0x4510c8[_0xfb8d('0x41')]['tag']?{'id':_0x4510c8[_0xfb8d('0x41')]['tag']}:undefined,'required':_0x4510c8[_0xfb8d('0x41')]['tag']?!![]:![]}];}return db[_0xfb8d('0x97')]['findAll'](_0x5592d7);})[_0xfb8d('0x35')](function(_0x32f170){_0x584dd2[_0xfb8d('0xb5')]=_0x32f170;return _0x584dd2;});}})[_0xfb8d('0x35')](respondWithFilteredResult(_0x7f51c5,_0x5592d7))['catch'](handleError(_0x7f51c5,null));};exports[_0xfb8d('0x36')]=function(_0x34a0f3,_0x3dc983,_0x5a748e){var _0x38750e,_0x322986,_0xae92a7;if(_['isNil'](_0x34a0f3[_0xfb8d('0x56')][_0xfb8d('0x56')])||_0x34a0f3[_0xfb8d('0x56')][_0xfb8d('0x56')]===''){throw new db['Sequelize'][(_0xfb8d('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x34a0f3[_0xfb8d('0x56')]['to'])){throw new db['Sequelize'][(_0xfb8d('0x73'))](_0xfb8d('0xb6'));}_0x38750e=_0x34a0f3[_0xfb8d('0x56')]['to'];return db[_0xfb8d('0x39')][_0xfb8d('0x5b')]({'where':{'id':_0x34a0f3['params']['id']},'include':[{'model':db[_0xfb8d('0xb7')],'as':_0xfb8d('0xb8'),'include':[{'model':db[_0xfb8d('0x93')],'as':_0xfb8d('0x94'),'where':{'mobile':_0x38750e},'limit':0x1,'order':[[_0xfb8d('0x77'),'DESC']]}]}]})[_0xfb8d('0x35')](handleEntityNotFound(_0x3dc983,null))[_0xfb8d('0x35')](function(_0x4806cb){if(_0x4806cb&&_0x4806cb['List']){_0x322986=_0x4806cb['get']({'plain':!![]});if(_0x322986[_0xfb8d('0xb8')]&&_0x322986[_0xfb8d('0xb8')][_0xfb8d('0x94')][_0xfb8d('0x45')]){return _0x322986[_0xfb8d('0xb8')][_0xfb8d('0x94')][0x0];}return db[_0xfb8d('0x93')][_0xfb8d('0x62')](_[_0xfb8d('0x19')](_0x34a0f3[_0xfb8d('0x56')],{'firstName':_0x38750e,'mobile':_0x38750e,'phone':_0x38750e,'ListId':_0x322986['ListId']}));}})[_0xfb8d('0x35')](handleEntityNotFound(_0x3dc983,null))[_0xfb8d('0x35')](function(_0x2ce762){if(_0x2ce762){_0xae92a7=_0x2ce762;return db['SmsInteraction'][_0xfb8d('0x5b')]({'where':{'ContactId':_0xae92a7['id'],'closed':![],'SmsAccountId':_0x322986['id']}})[_0xfb8d('0x35')](function(_0x23b79b){if(_0x23b79b){return[_0x23b79b,![]];}return db[_0xfb8d('0x97')][_0xfb8d('0x62')]({'UserId':_0x34a0f3[_0xfb8d('0x57')]['id'],'ContactId':_0xae92a7['id'],'SmsAccountId':_0x322986['id'],'phone':_0x38750e,'firstMsgDirection':'out','Messages':[_[_0xfb8d('0x4d')](_0x34a0f3[_0xfb8d('0x56')],{'read':![],'body':_0x34a0f3[_0xfb8d('0x56')]['body'],'phone':_0x38750e,'SmsAccountId':_0x322986['id'],'UserId':_0x34a0f3[_0xfb8d('0x57')]['id'],'ContactId':_0xae92a7['id']})]},{'include':[{'model':db[_0xfb8d('0x9d')],'as':_0xfb8d('0xb9')}]})[_0xfb8d('0x35')](function(_0x50fd52){return[_0x50fd52,!![]];});});}})[_0xfb8d('0xba')](function(_0x42a72b,_0x346ce4){if(_0x346ce4){return _0x42a72b;}return db[_0xfb8d('0x9d')][_0xfb8d('0x62')](_[_0xfb8d('0x4d')](_0x34a0f3[_0xfb8d('0x56')],{'read':![],'body':_0x34a0f3[_0xfb8d('0x56')][_0xfb8d('0x56')],'phone':_0x38750e,'SmsAccountId':_0x322986['id'],'SmsInteractionId':_0x42a72b['id'],'UserId':_0x34a0f3[_0xfb8d('0x57')]['id'],'ContactId':_0xae92a7['id']}))['then'](function(_0x3cf9e2){_0x42a72b['dataValues'][_0xfb8d('0xb9')]=[];_0x42a72b['dataValues'][_0xfb8d('0xb9')][_0xfb8d('0x9a')](_0x3cf9e2[_0xfb8d('0xbb')]);return _0x42a72b;});})[_0xfb8d('0x35')](respondWithResult(_0x3dc983,null))[_0xfb8d('0x26')](handleError(_0x3dc983,null));};exports['status']=function(_0x2c15d7,_0x12d098,_0x3a6014){if(_0x2c15d7[_0xfb8d('0x56')]['id']){delete _0x2c15d7['body']['id'];}var _0x43b931,_0x3fcca8,_0x36a1e5;return db[_0xfb8d('0x39')][_0xfb8d('0x5b')]({'where':{'id':_0x2c15d7[_0xfb8d('0x53')]['id']}})[_0xfb8d('0x35')](handleEntityNotFound(_0x12d098,null))['then'](function(_0x585e62){if(_0x585e62){_0x36a1e5=_0x585e62;logger[_0xfb8d('0x21')](_0xfb8d('0x22'),_0xfb8d('0x29'),_0xfb8d('0xbc'),_0x585e62[_0xfb8d('0x3c')],util['inspect'](_0x2c15d7[_0xfb8d('0x56')],{'showHidden':![],'depth':null}));switch(_0x585e62[_0xfb8d('0x3c')]){case _0xfb8d('0x80'):if(_0x2c15d7[_0xfb8d('0x56')][_0xfb8d('0xbd')]&&_0x2c15d7[_0xfb8d('0x56')][_0xfb8d('0x29')]){_0x3fcca8=_0x2c15d7['body'][_0xfb8d('0x29')];return db['SmsMessage'][_0xfb8d('0x5b')]({'where':{'messageId':_0x2c15d7[_0xfb8d('0x56')][_0xfb8d('0xbd')]}});}break;case _0xfb8d('0x81'):if(_0x2c15d7[_0xfb8d('0x56')][_0xfb8d('0xbe')]&&_0x2c15d7[_0xfb8d('0x56')][_0xfb8d('0xbf')]){_0x3fcca8=_0x2c15d7[_0xfb8d('0x56')][_0xfb8d('0xbf')];return db[_0xfb8d('0x9d')][_0xfb8d('0x5b')]({'where':{'messageId':_0x2c15d7[_0xfb8d('0x56')][_0xfb8d('0xbe')]}});}break;case _0xfb8d('0x82'):if(_0x2c15d7[_0xfb8d('0x56')]['message_id']&&_0x2c15d7[_0xfb8d('0x56')][_0xfb8d('0xc0')]){_0x3fcca8=_0x2c15d7[_0xfb8d('0x56')]['status_code'];return db[_0xfb8d('0x9d')]['find']({'where':{'messageId':_0x2c15d7[_0xfb8d('0x56')][_0xfb8d('0x83')]}});}break;case _0xfb8d('0xc1'):var _0x7a0da=_0x2c15d7[_0xfb8d('0x56')][_0xfb8d('0x86')][0x0];if(_0x7a0da[_0xfb8d('0x7e')]&&_0x7a0da[_0xfb8d('0x29')][_0xfb8d('0xc2')]===_0xfb8d('0xc3')){_0x3fcca8=_0x7a0da['status'][_0xfb8d('0xc2')];return db[_0xfb8d('0x9d')][_0xfb8d('0x5b')]({'where':{'messageId':_0x7a0da[_0xfb8d('0x7e')]}});}break;case _0xfb8d('0x89'):if(_0x2c15d7['body']['messageId']&&_0x2c15d7[_0xfb8d('0x56')]['status']){_0x3fcca8=_0x2c15d7['body'][_0xfb8d('0x29')];return db[_0xfb8d('0x9d')][_0xfb8d('0x5b')]({'where':{'messageId':_0x2c15d7[_0xfb8d('0x56')][_0xfb8d('0x7e')]}});}break;case _0xfb8d('0x8c'):if(_0x2c15d7['body'][0x0]['message']['id']){_0x3fcca8=_0x2c15d7[_0xfb8d('0x56')][0x0][_0xfb8d('0x3c')];return db[_0xfb8d('0x9d')]['find']({'where':{'messageId':_0x2c15d7[_0xfb8d('0x56')][0x0][_0xfb8d('0x25')]['id']}});}break;case _0xfb8d('0x8d'):if(_0x2c15d7[_0xfb8d('0x56')]['redif']&&_0x2c15d7['body'][_0xfb8d('0x29')]){_0x3fcca8=_0x2c15d7[_0xfb8d('0x56')][_0xfb8d('0x29')];return db[_0xfb8d('0x9d')]['find']({'where':{'messageId':_0x2c15d7[_0xfb8d('0x56')][_0xfb8d('0xc4')]}});}break;}}})['then'](handleEntityNotFound(_0x12d098,null))['then'](function(_0x34c3b2){if(_0x34c3b2){_0x43b931=_0x34c3b2;switch(_0x36a1e5[_0xfb8d('0x3c')]){case _0xfb8d('0x80'):if(_0x3fcca8===_0xfb8d('0xc3')){return _0x43b931['update']({'read':!![]});}else{logger[_0xfb8d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xfb8d('0x80'),util[_0xfb8d('0xc5')](_0x2c15d7['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x3fcca8==='1'){return _0x43b931['update']({'read':!![]});}else{logger[_0xfb8d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfb8d('0x29'),_0xfb8d('0x80'),util[_0xfb8d('0xc5')](_0x2c15d7['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x2c15d7[_0xfb8d('0x56')]['error_code']&&_0x3fcca8>=0xc8&&_0x3fcca8<=0xce){return _0x43b931[_0xfb8d('0x32')]({'read':!![]});}else{logger['error'](_0xfb8d('0x22'),_0xfb8d('0x29'),_0xfb8d('0x82'),util[_0xfb8d('0xc5')](_0x2c15d7['body'],{'showHidden':![],'depth':null}));}break;case _0xfb8d('0xc1'):var _0x5efad5=_0x2c15d7[_0xfb8d('0x56')]['results'][0x0];if(_0x5efad5['status'][_0xfb8d('0xc2')]==='DELIVERED'){return _0x43b931[_0xfb8d('0x32')]({'read':!![]});}else{logger[_0xfb8d('0x24')](_0xfb8d('0x22'),_0xfb8d('0x29'),'infobip',util[_0xfb8d('0xc5')](_0x2c15d7[_0xfb8d('0x56')],{'showHidden':![],'depth':null}));}break;case _0xfb8d('0x89'):if(_0x3fcca8==_0xfb8d('0xc6')||_0x3fcca8=='RECEIVED_BY_RECIPIENT'){return _0x43b931['update']({'read':!![]});}else{logger[_0xfb8d('0x24')](_0xfb8d('0x22'),_0xfb8d('0x29'),_0xfb8d('0x89'),util['inspect'](_0x2c15d7[_0xfb8d('0x56')],{'showHidden':![],'depth':null}));}break;case _0xfb8d('0x8c'):if(_0x3fcca8==_0xfb8d('0xc7')){return _0x43b931[_0xfb8d('0x32')]({'read':!![]});}else{logger[_0xfb8d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfb8d('0x29'),_0xfb8d('0x8c'),util[_0xfb8d('0xc5')](_0x2c15d7[_0xfb8d('0x56')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x3fcca8===_0xfb8d('0xc8')||_0x3fcca8===_0xfb8d('0xc9')){return _0x43b931['update']({'read':!![]});}else{logger[_0xfb8d('0x24')](_0xfb8d('0x22'),_0xfb8d('0x29'),_0xfb8d('0x8d'),util[_0xfb8d('0xc5')](_0x2c15d7[_0xfb8d('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x43b931;}})[_0xfb8d('0x35')](respondWithResult(_0x12d098,null))[_0xfb8d('0x26')](handleError(_0x12d098,null));};exports[_0xfb8d('0xca')]=function(_0x468b16,_0x6e5616,_0x4e27d8){var _0x5d2df0,_0x5d0705,_0x5ce8eb;return db[_0xfb8d('0x39')][_0xfb8d('0x5b')]({'where':{'id':_0x468b16[_0xfb8d('0x53')]['id']}})[_0xfb8d('0x35')](handleEntityNotFound(_0x6e5616,null))['then'](function(_0x446809){if(_0x446809){_0x5ce8eb=_0x446809;logger[_0xfb8d('0x21')](_0xfb8d('0x22'),_0xfb8d('0x29'),_0xfb8d('0xbc'),_0x446809[_0xfb8d('0x3c')],util[_0xfb8d('0xc5')](_0x468b16[_0xfb8d('0x41')],{'showHidden':![],'depth':null}));switch(_0x446809[_0xfb8d('0x3c')]){case _0xfb8d('0x87'):if(_0x468b16[_0xfb8d('0x41')]['message-id']&&_0x468b16[_0xfb8d('0x41')][_0xfb8d('0xcb')]){_0x5d0705=_0x468b16[_0xfb8d('0x41')]['state'];return db[_0xfb8d('0x9d')][_0xfb8d('0x5b')]({'where':{'messageId':_0x468b16[_0xfb8d('0x41')][_0xfb8d('0xcc')]}});}break;}}})[_0xfb8d('0x35')](handleEntityNotFound(_0x6e5616,null))[_0xfb8d('0x35')](function(_0x34d120){if(_0x34d120){_0x5d2df0=_0x34d120;switch(_0x5ce8eb['type']){case _0xfb8d('0x87'):if(_0x5d0705==='2'||_0x5d0705==='6'){return _0x5d2df0[_0xfb8d('0x32')]({'read':!![]});}else{logger['error'](_0xfb8d('0x22'),_0xfb8d('0x29'),_0xfb8d('0x87'),util[_0xfb8d('0xc5')](_0x468b16[_0xfb8d('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x5d2df0;}})['then'](respondWithResult(_0x6e5616,null))[_0xfb8d('0x26')](handleError(_0x6e5616,null));};exports[_0xfb8d('0xcd')]=function(_0x118a5c,_0x41f228,_0x1ee1f4){return db[_0xfb8d('0x39')][_0xfb8d('0x5b')]({'where':{'id':_0x118a5c[_0xfb8d('0x53')]['id']}})[_0xfb8d('0x35')](handleEntityNotFound(_0x41f228,null))[_0xfb8d('0x35')](function(_0xe2dca4){if(_0xe2dca4){return _0xe2dca4[_0xfb8d('0xcd')](_0x118a5c[_0xfb8d('0x56')][_0xfb8d('0x6a')],_[_0xfb8d('0x95')](_0x118a5c[_0xfb8d('0x56')],[_0xfb8d('0x6a'),'id'])||{})[_0xfb8d('0xba')](function(_0xc4c05){for(var _0x2961ef=0x0;_0x2961ef<_0x118a5c['body'][_0xfb8d('0x6a')][_0xfb8d('0x45')];_0x2961ef+=0x1){socket['emit'](_0xfb8d('0xce'),{'UserId':Number(_0x118a5c[_0xfb8d('0x56')][_0xfb8d('0x6a')][_0x2961ef]),'SmsAccountId':Number(_0x118a5c[_0xfb8d('0x53')]['id'])});}return _0xc4c05;});}})[_0xfb8d('0x35')](respondWithResult(_0x41f228,null))[_0xfb8d('0x26')](handleError(_0x41f228,null));};exports['removeAgents']=function(_0x115a0f,_0x17d209,_0x21a2d8){return db[_0xfb8d('0x39')]['find']({'where':{'id':_0x115a0f[_0xfb8d('0x53')]['id']}})['then'](handleEntityNotFound(_0x17d209,null))[_0xfb8d('0x35')](function(_0x41e60b){if(_0x41e60b){return _0x41e60b[_0xfb8d('0xcf')](_0x115a0f[_0xfb8d('0x41')]['ids'])[_0xfb8d('0x35')](function(){if(_['isArray'](_0x115a0f['query'][_0xfb8d('0x6a')])){for(var _0xe5f82d=0x0;_0xe5f82d<_0x115a0f[_0xfb8d('0x41')][_0xfb8d('0x6a')][_0xfb8d('0x45')];_0xe5f82d+=0x1){socket[_0xfb8d('0xd0')](_0xfb8d('0xd1'),{'UserId':Number(_0x115a0f[_0xfb8d('0x41')][_0xfb8d('0x6a')][_0xe5f82d]),'SmsAccountId':Number(_0x115a0f['params']['id'])});}}else{socket[_0xfb8d('0xd0')](_0xfb8d('0xd1'),{'UserId':Number(_0x115a0f['query'][_0xfb8d('0x6a')]),'SmsAccountId':Number(_0x115a0f[_0xfb8d('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x17d209,null))['catch'](handleError(_0x17d209,null));};exports[_0xfb8d('0xd2')]=function(_0x309a98,_0x513f07,_0xa8f6bc){var _0x23bbb1={};var _0x279864={};var _0x5cf326;var _0x2f7d88;return db[_0xfb8d('0x39')][_0xfb8d('0x63')]({'where':{'id':_0x309a98[_0xfb8d('0x53')]['id']}})['then'](handleEntityNotFound(_0x513f07,null))[_0xfb8d('0x35')](function(_0x4fb881){if(_0x4fb881){_0x5cf326=_0x4fb881;_0x279864[_0xfb8d('0x3e')]=_['keys'](db[_0xfb8d('0x9f')]['rawAttributes']);_0x279864[_0xfb8d('0x41')]=_[_0xfb8d('0x54')](_0x309a98['query']);_0x279864[_0xfb8d('0x4a')]=_[_0xfb8d('0x42')](_0x279864['model'],_0x279864['query']);_0x23bbb1[_0xfb8d('0x43')]=_['intersection'](_0x279864['model'],qs['fields'](_0x309a98['query'][_0xfb8d('0x44')]));_0x23bbb1[_0xfb8d('0x43')]=_0x23bbb1[_0xfb8d('0x43')][_0xfb8d('0x45')]?_0x23bbb1[_0xfb8d('0x43')]:_0x279864['model'];_0x23bbb1[_0xfb8d('0x64')]=qs[_0xfb8d('0x48')](_0x309a98['query'][_0xfb8d('0x48')]);_0x23bbb1['where']=qs[_0xfb8d('0x4a')](_[_0xfb8d('0x4b')](_0x309a98[_0xfb8d('0x41')],_0x279864[_0xfb8d('0x4a')]));if(_0x309a98['query'][_0xfb8d('0x4c')]){_0x23bbb1['where']=_[_0xfb8d('0x4d')](_0x23bbb1[_0xfb8d('0x49')],{'$or':_[_0xfb8d('0x3f')](_0x23bbb1['attributes'],function(_0x3e47c4){var _0x40bd56={};_0x40bd56[_0x3e47c4]={'$like':'%'+_0x309a98['query']['filter']+'%'};return _0x40bd56;})});}_0x23bbb1=_[_0xfb8d('0x4d')]({},_0x23bbb1,_0x309a98[_0xfb8d('0x4f')]);return _0x5cf326['getAgents'](_0x23bbb1);}})[_0xfb8d('0x35')](function(_0x263525){if(_0x263525){_0x2f7d88=_0x263525[_0xfb8d('0x45')];if(!_0x309a98[_0xfb8d('0x41')]['hasOwnProperty'](_0xfb8d('0x47'))){_0x23bbb1[_0xfb8d('0x2b')]=qs[_0xfb8d('0x2b')](_0x309a98['query'][_0xfb8d('0x2b')]);_0x23bbb1[_0xfb8d('0x2a')]=qs['offset'](_0x309a98[_0xfb8d('0x41')]['offset']);}return _0x5cf326['getAgents'](_0x23bbb1);}})[_0xfb8d('0x35')](function(_0x42a26a){if(_0x42a26a){return _0x42a26a?{'count':_0x2f7d88,'rows':_0x42a26a}:null;}})[_0xfb8d('0x35')](respondWithResult(_0x513f07,null))[_0xfb8d('0x26')](handleError(_0x513f07,null));}; \ No newline at end of file +var _0x101a=['stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','SmsAccounts','UserProfileResource','destroy','stack','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','name','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','SmsAccount','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','Disposition','findOne','nolimit','sort','SmsAccountId','removeDispositions','ids','addAnswer','CannedAnswer','pick','removeAnswers','sms','SmsApplication','Applications','account','orderBy','priority','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','mobile','twilio','from','From','messageId','MessageSid','skebby','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','DESC','list','omit','defaults','SmsInteraction','spread','interaction','autoclose','applications','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','entity\x20found','text/xml','sequelize','bulkCreate','getApplications','getInteractions','User','Owner','fullname','internal','Tag','tag','CmList','List','out','Messages','dataValues','debug','received\x20delivery\x20report\x20from','skebby_dispatch_id','statusInt','requestid','status_code','groupName','inspect','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','statusGet','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','localhost','./smsAccount.socket','register','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s'];(function(_0x4ca536,_0x57c8de){var _0x3bd35f=function(_0x26d91d){while(--_0x26d91d){_0x4ca536['push'](_0x4ca536['shift']());}};_0x3bd35f(++_0x57c8de);}(_0x101a,0x187));var _0xa101=function(_0x20e0ff,_0x5e8afc){_0x20e0ff=_0x20e0ff-0x0;var _0x41c617=_0x101a[_0x20e0ff];return _0x41c617;};'use strict';var emlformat=require(_0xa101('0x0'));var rimraf=require(_0xa101('0x1'));var zipdir=require(_0xa101('0x2'));var jsonpatch=require(_0xa101('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa101('0x4'));var sox=require('sox');var csv=require(_0xa101('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa101('0x6'));var _=require(_0xa101('0x7'));var squel=require(_0xa101('0x8'));var crypto=require(_0xa101('0x9'));var jsforce=require(_0xa101('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa101('0x5'));var querystring=require(_0xa101('0xb'));var Papa=require(_0xa101('0xc'));var Redis=require(_0xa101('0xd'));var authService=require(_0xa101('0xe'));var qs=require(_0xa101('0xf'));var as=require(_0xa101('0x10'));var hardwareService=require(_0xa101('0x11'));var logger=require(_0xa101('0x12'))('api');var utils=require(_0xa101('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa101('0x14'));var db=require('../../mysqldb')['db'];config[_0xa101('0x15')]=_['defaults'](config[_0xa101('0x15')],{'host':_0xa101('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa101('0x15')]));require(_0xa101('0x17'))[_0xa101('0x18')](socket);var jayson=require(_0xa101('0x19'));var client=jayson[_0xa101('0x1a')]['http']({'port':0x232c});function respondWithRpcPromise(_0x284f7e,_0x14bbf4,_0x402a44,_0x399444){return new BPromise(function(_0x3fcb24,_0x58b1d1){var _0x577322=_0x399444||client;return _0x577322[_0xa101('0x1b')](_0x284f7e,_0x402a44)[_0xa101('0x1c')](function(_0x14d2e0){logger[_0xa101('0x1d')](_0xa101('0x1e'),_0x14bbf4,_0xa101('0x1f'));logger['debug'](_0xa101('0x20'),_0x14bbf4,_0xa101('0x1f'),JSON[_0xa101('0x21')](_0x14d2e0));if(_0x14d2e0[_0xa101('0x22')]){if(_0x14d2e0['error'][_0xa101('0x23')]===0x1f4){logger['error'](_0xa101('0x1e'),_0x14bbf4,_0x14d2e0[_0xa101('0x22')][_0xa101('0x24')]);return _0x58b1d1(_0x14d2e0['error'][_0xa101('0x24')]);}logger[_0xa101('0x22')]('SmsAccount,\x20%s,\x20%s',_0x14bbf4,_0x14d2e0[_0xa101('0x22')]['message']);return _0x3fcb24(_0x14d2e0[_0xa101('0x22')][_0xa101('0x24')]);}else{logger['info'](_0xa101('0x1e'),_0x14bbf4,_0xa101('0x1f'));_0x3fcb24(_0x14d2e0['result'][_0xa101('0x24')]);}})[_0xa101('0x25')](function(_0x4d32a1){logger[_0xa101('0x22')](_0xa101('0x1e'),_0x14bbf4,_0x4d32a1);_0x58b1d1(_0x4d32a1);});});}function respondWithStatusCode(_0x2ace8c,_0x546eb7){_0x546eb7=_0x546eb7||0xcc;return function(_0x37622a){if(_0x37622a){return _0x2ace8c[_0xa101('0x26')](_0x546eb7);}return _0x2ace8c['status'](_0x546eb7)['end']();};}function respondWithResult(_0x3c40f6,_0x396b84){_0x396b84=_0x396b84||0xc8;return function(_0x5570b1){if(_0x5570b1){return _0x3c40f6[_0xa101('0x27')](_0x396b84)[_0xa101('0x28')](_0x5570b1);}};}function respondWithFilteredResult(_0x1facba,_0x3c36e3){return function(_0x182338){if(_0x182338){var _0x5eda53=typeof _0x3c36e3[_0xa101('0x29')]===_0xa101('0x2a')&&typeof _0x3c36e3[_0xa101('0x2b')]===_0xa101('0x2a');var _0x5a4d4c=_0x182338[_0xa101('0x2c')];var _0xfb5e18=_0x5eda53?0x0:_0x3c36e3[_0xa101('0x29')];var _0x285357=_0x5eda53?_0x182338[_0xa101('0x2c')]:_0x3c36e3[_0xa101('0x29')]+_0x3c36e3[_0xa101('0x2b')];var _0x1de50b;if(_0x285357>=_0x5a4d4c){_0x285357=_0x5a4d4c;_0x1de50b=0xc8;}else{_0x1de50b=0xce;}_0x1facba[_0xa101('0x27')](_0x1de50b);return _0x1facba[_0xa101('0x2d')](_0xa101('0x2e'),_0xfb5e18+'-'+_0x285357+'/'+_0x5a4d4c)[_0xa101('0x28')](_0x182338);}return null;};}function patchUpdates(_0x2c745a){return function(_0x46fbde){try{jsonpatch[_0xa101('0x2f')](_0x46fbde,_0x2c745a,!![]);}catch(_0x209052){return BPromise['reject'](_0x209052);}return _0x46fbde[_0xa101('0x30')]();};}function saveUpdates(_0x1504b1,_0x44efd5){return function(_0x306ae8){if(_0x306ae8){return _0x306ae8[_0xa101('0x31')](_0x1504b1)[_0xa101('0x1c')](function(_0x466ad1){return _0x466ad1;});}return null;};}function removeEntity(_0x137ca1,_0x5f5309){return function(_0x54e1c6){if(_0x54e1c6){return _0x54e1c6['destroy']()['then'](function(){var _0x1f6e77=_0x54e1c6[_0xa101('0x32')]({'plain':!![]});var _0x29c294=_0xa101('0x33');return db[_0xa101('0x34')][_0xa101('0x35')]({'where':{'type':_0x29c294,'resourceId':_0x1f6e77['id']}})[_0xa101('0x1c')](function(){return _0x54e1c6;});})[_0xa101('0x1c')](function(){_0x137ca1[_0xa101('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34931b,_0x5dd258){return function(_0x286477){if(!_0x286477){_0x34931b['sendStatus'](0x194);}return _0x286477;};}function handleError(_0x13ddea,_0x4f1b46){_0x4f1b46=_0x4f1b46||0x1f4;return function(_0x1707f5){logger['error'](_0x1707f5[_0xa101('0x36')]);if(_0x1707f5['name']){delete _0x1707f5['name'];}_0x13ddea[_0xa101('0x27')](_0x4f1b46)[_0xa101('0x37')](_0x1707f5);};}exports[_0xa101('0x38')]=function(_0x763f4f,_0x2a614b){var _0x1025c6={'include':[{'model':db[_0xa101('0x39')],'as':_0xa101('0x3a')}]},_0x4c8ab9={},_0x556336={'count':0x0,'rows':[]};var _0x40da56=_[_0xa101('0x3b')](db['SmsAccount'][_0xa101('0x3c')],function(_0x5e6aa9){return{'name':_0x5e6aa9[_0xa101('0x3d')],'type':_0x5e6aa9[_0xa101('0x3e')][_0xa101('0x3f')]};});_0x4c8ab9['model']=_[_0xa101('0x3b')](_0x40da56,_0xa101('0x40'));_0x4c8ab9[_0xa101('0x41')]=_[_0xa101('0x42')](_0x763f4f['query']);_0x4c8ab9[_0xa101('0x43')]=_['intersection'](_0x4c8ab9['model'],_0x4c8ab9[_0xa101('0x41')]);_0x1025c6[_0xa101('0x44')]=_[_0xa101('0x45')](_0x4c8ab9[_0xa101('0x46')],qs['fields'](_0x763f4f[_0xa101('0x41')][_0xa101('0x47')]));_0x1025c6[_0xa101('0x44')]=_0x1025c6[_0xa101('0x44')][_0xa101('0x48')]?_0x1025c6[_0xa101('0x44')]:_0x4c8ab9[_0xa101('0x46')];if(!_0x763f4f[_0xa101('0x41')][_0xa101('0x49')]('nolimit')){_0x1025c6[_0xa101('0x2b')]=qs[_0xa101('0x2b')](_0x763f4f[_0xa101('0x41')]['limit']);_0x1025c6[_0xa101('0x29')]=qs[_0xa101('0x29')](_0x763f4f['query'][_0xa101('0x29')]);}_0x1025c6[_0xa101('0x4a')]=qs['sort'](_0x763f4f['query']['sort']);_0x1025c6[_0xa101('0x4b')]=qs[_0xa101('0x43')](_['pick'](_0x763f4f[_0xa101('0x41')],_0x4c8ab9[_0xa101('0x43')]),_0x40da56);if(_0x763f4f[_0xa101('0x41')][_0xa101('0x4c')]){_0x1025c6[_0xa101('0x4b')]=_[_0xa101('0x4d')](_0x1025c6[_0xa101('0x4b')],{'$or':_[_0xa101('0x3b')](_0x40da56,function(_0x5286e7){if(_0x5286e7[_0xa101('0x3e')]!==_0xa101('0x4e')){var _0x5466e8={};_0x5466e8[_0x5286e7[_0xa101('0x40')]]={'$like':'%'+_0x763f4f[_0xa101('0x41')]['filter']+'%'};return _0x5466e8;}})});}_0x1025c6=_['merge']({},_0x1025c6,_0x763f4f[_0xa101('0x4f')]);var _0x30c1e0={'where':_0x1025c6['where']};return db[_0xa101('0x50')][_0xa101('0x2c')](_0x30c1e0)[_0xa101('0x1c')](function(_0x3950fd){_0x556336[_0xa101('0x2c')]=_0x3950fd;if(_0x763f4f[_0xa101('0x41')][_0xa101('0x51')]){_0x1025c6[_0xa101('0x52')]=[{'all':!![]}];}return db[_0xa101('0x50')][_0xa101('0x53')](_0x1025c6);})[_0xa101('0x1c')](function(_0x37458e){_0x556336[_0xa101('0x54')]=_0x37458e;return _0x556336;})['then'](respondWithFilteredResult(_0x2a614b,_0x1025c6))['catch'](handleError(_0x2a614b,null));};exports[_0xa101('0x55')]=function(_0x57befb,_0x1eeae6){var _0x35a6e4={'raw':![],'where':{'id':_0x57befb[_0xa101('0x56')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x31e989={};_0x31e989[_0xa101('0x46')]=_[_0xa101('0x42')](db['SmsAccount'][_0xa101('0x3c')]);_0x31e989[_0xa101('0x41')]=_[_0xa101('0x42')](_0x57befb[_0xa101('0x41')]);_0x31e989['filters']=_[_0xa101('0x45')](_0x31e989[_0xa101('0x46')],_0x31e989[_0xa101('0x41')]);_0x35a6e4[_0xa101('0x44')]=_[_0xa101('0x45')](_0x31e989[_0xa101('0x46')],qs[_0xa101('0x47')](_0x57befb[_0xa101('0x41')][_0xa101('0x47')]));_0x35a6e4[_0xa101('0x44')]=_0x35a6e4[_0xa101('0x44')][_0xa101('0x48')]?_0x35a6e4['attributes']:_0x31e989[_0xa101('0x46')];if(_0x57befb['query'][_0xa101('0x51')]){_0x35a6e4[_0xa101('0x52')]=[{'all':!![]}];}_0x35a6e4=_[_0xa101('0x4d')]({},_0x35a6e4,_0x57befb[_0xa101('0x4f')]);return db[_0xa101('0x50')][_0xa101('0x57')](_0x35a6e4)[_0xa101('0x1c')](handleEntityNotFound(_0x1eeae6,null))[_0xa101('0x1c')](respondWithResult(_0x1eeae6,null))[_0xa101('0x25')](handleError(_0x1eeae6,null));};exports[_0xa101('0x58')]=function(_0x32c7e4,_0xb2adf7){return db[_0xa101('0x50')][_0xa101('0x58')](_0x32c7e4[_0xa101('0x59')],{})[_0xa101('0x1c')](function(_0x1b351d){var _0x337efa=_0x32c7e4[_0xa101('0x5a')][_0xa101('0x32')]({'plain':!![]});if(!_0x337efa)throw new Error(_0xa101('0x5b'));if(_0x337efa['role']===_0xa101('0x5a')){var _0x230c88=_0x1b351d['get']({'plain':!![]});var _0x17e8d1=_0xa101('0x33');return db[_0xa101('0x5c')][_0xa101('0x57')]({'where':{'name':_0x17e8d1,'userProfileId':_0x337efa[_0xa101('0x5d')]},'raw':!![]})[_0xa101('0x1c')](function(_0x40f810){if(_0x40f810&&_0x40f810[_0xa101('0x5e')]===0x0){return db['UserProfileResource'][_0xa101('0x58')]({'name':_0x230c88[_0xa101('0x40')],'resourceId':_0x230c88['id'],'type':_0x40f810['name'],'sectionId':_0x40f810['id']},{})['then'](function(){return _0x1b351d;});}else{return _0x1b351d;}})[_0xa101('0x25')](function(_0x1960df){logger[_0xa101('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1960df);throw _0x1960df;});}return _0x1b351d;})[_0xa101('0x1c')](respondWithResult(_0xb2adf7,0xc9))[_0xa101('0x25')](handleError(_0xb2adf7,null));};exports['update']=function(_0x42275d,_0xb8ab32){if(_0x42275d[_0xa101('0x59')]['id']){delete _0x42275d[_0xa101('0x59')]['id'];}return db[_0xa101('0x50')]['find']({'where':{'id':_0x42275d['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xa101('0x1c')](handleEntityNotFound(_0xb8ab32,null))[_0xa101('0x1c')](saveUpdates(_0x42275d[_0xa101('0x59')],null))[_0xa101('0x1c')](respondWithResult(_0xb8ab32,null))[_0xa101('0x25')](handleError(_0xb8ab32,null));};exports[_0xa101('0x35')]=function(_0x1af800,_0x97cae0){return db['SmsAccount'][_0xa101('0x57')]({'where':{'id':_0x1af800[_0xa101('0x56')]['id']}})[_0xa101('0x1c')](handleEntityNotFound(_0x97cae0,null))[_0xa101('0x1c')](removeEntity(_0x97cae0,null))[_0xa101('0x25')](handleError(_0x97cae0,null));};exports[_0xa101('0x5f')]=function(_0xbb6b2d,_0x1a5bbf){return db[_0xa101('0x50')][_0xa101('0x5f')]()[_0xa101('0x1c')](respondWithResult(_0x1a5bbf,null))[_0xa101('0x25')](handleError(_0x1a5bbf,null));};exports[_0xa101('0x60')]=function(_0x231a33,_0xad6b9c,_0x4adf9e){if(_0x231a33[_0xa101('0x59')]['id']){delete _0x231a33['body']['id'];}return db['SmsAccount'][_0xa101('0x57')]({'where':{'id':_0x231a33[_0xa101('0x56')]['id']}})[_0xa101('0x1c')](handleEntityNotFound(_0xad6b9c,null))[_0xa101('0x1c')](function(_0x1bfecb){if(_0x1bfecb){_0x231a33[_0xa101('0x59')]['SmsAccountId']=_0x1bfecb['id'];return db[_0xa101('0x61')][_0xa101('0x58')](_0x231a33[_0xa101('0x59')]);}})[_0xa101('0x1c')](respondWithResult(_0xad6b9c,null))[_0xa101('0x25')](handleError(_0xad6b9c,null));};exports['getDispositions']=function(_0x3943c1,_0x39b3b3,_0x5d28b2){var _0x4c7e7a={'raw':![],'where':{}};var _0x552f2c={};var _0x3ba962={'count':0x0,'rows':[]};return db['SmsAccount'][_0xa101('0x62')]({'where':{'id':_0x3943c1['params']['id']}})[_0xa101('0x1c')](handleEntityNotFound(_0x39b3b3,null))[_0xa101('0x1c')](function(_0x3171e4){if(_0x3171e4){_0x552f2c[_0xa101('0x46')]=_['keys'](db[_0xa101('0x61')][_0xa101('0x3c')]);_0x552f2c[_0xa101('0x41')]=_['keys'](_0x3943c1[_0xa101('0x41')]);_0x552f2c[_0xa101('0x43')]=_['intersection'](_0x552f2c[_0xa101('0x46')],_0x552f2c[_0xa101('0x41')]);_0x4c7e7a[_0xa101('0x44')]=_[_0xa101('0x45')](_0x552f2c['model'],qs['fields'](_0x3943c1[_0xa101('0x41')][_0xa101('0x47')]));_0x4c7e7a[_0xa101('0x44')]=_0x4c7e7a[_0xa101('0x44')][_0xa101('0x48')]?_0x4c7e7a[_0xa101('0x44')]:_0x552f2c[_0xa101('0x46')];if(!_0x3943c1[_0xa101('0x41')]['hasOwnProperty'](_0xa101('0x63'))){_0x4c7e7a['limit']=qs['limit'](_0x3943c1['query'][_0xa101('0x2b')]);_0x4c7e7a[_0xa101('0x29')]=qs[_0xa101('0x29')](_0x3943c1['query'][_0xa101('0x29')]);}_0x4c7e7a['order']=qs[_0xa101('0x64')](_0x3943c1['query']['sort']);_0x4c7e7a[_0xa101('0x4b')]=qs[_0xa101('0x43')](_['pick'](_0x3943c1[_0xa101('0x41')],_0x552f2c[_0xa101('0x43')]));_0x4c7e7a[_0xa101('0x4b')][_0xa101('0x65')]=_0x3171e4['id'];if(_0x3943c1['query'][_0xa101('0x4c')]){_0x4c7e7a[_0xa101('0x4b')]=_[_0xa101('0x4d')](_0x4c7e7a[_0xa101('0x4b')],{'$or':_[_0xa101('0x3b')](_0x4c7e7a[_0xa101('0x44')],function(_0x4b0c02){var _0x52ab47={};_0x52ab47[_0x4b0c02]={'$like':'%'+_0x3943c1[_0xa101('0x41')][_0xa101('0x4c')]+'%'};return _0x52ab47;})});}_0x4c7e7a=_[_0xa101('0x4d')]({},_0x4c7e7a,_0x3943c1['options']);return db[_0xa101('0x61')][_0xa101('0x2c')]({'where':_0x4c7e7a[_0xa101('0x4b')]})[_0xa101('0x1c')](function(_0x171f0c){_0x3ba962[_0xa101('0x2c')]=_0x171f0c;if(_0x3943c1[_0xa101('0x41')]['includeAll']){_0x4c7e7a[_0xa101('0x52')]=[{'all':!![]}];}return db['Disposition'][_0xa101('0x53')](_0x4c7e7a);})[_0xa101('0x1c')](function(_0x5d74c7){_0x3ba962[_0xa101('0x54')]=_0x5d74c7;return _0x3ba962;});}})['then'](respondWithFilteredResult(_0x39b3b3,_0x4c7e7a))[_0xa101('0x25')](handleError(_0x39b3b3,null));};exports[_0xa101('0x66')]=function(_0x304b7f,_0x417ec1,_0x43f0f4){return db['SmsAccount']['find']({'where':{'id':_0x304b7f[_0xa101('0x56')]['id']}})[_0xa101('0x1c')](handleEntityNotFound(_0x417ec1,null))[_0xa101('0x1c')](function(_0x2e5438){if(_0x2e5438){return _0x2e5438[_0xa101('0x66')](_0x304b7f['query'][_0xa101('0x67')]);}})[_0xa101('0x1c')](respondWithStatusCode(_0x417ec1,null))[_0xa101('0x25')](handleError(_0x417ec1,null));};exports[_0xa101('0x68')]=function(_0x56659e,_0x2b82f4,_0x264ec3){if(_0x56659e[_0xa101('0x59')]['id']){delete _0x56659e[_0xa101('0x59')]['id'];}return db['SmsAccount'][_0xa101('0x57')]({'where':{'id':_0x56659e[_0xa101('0x56')]['id']}})[_0xa101('0x1c')](handleEntityNotFound(_0x2b82f4,null))[_0xa101('0x1c')](function(_0x4cc67b){if(_0x4cc67b){_0x56659e[_0xa101('0x59')][_0xa101('0x65')]=_0x4cc67b['id'];return db[_0xa101('0x69')][_0xa101('0x58')](_0x56659e['body']);}})[_0xa101('0x1c')](respondWithResult(_0x2b82f4,null))[_0xa101('0x25')](handleError(_0x2b82f4,null));};exports['getAnswers']=function(_0xac19b9,_0x596122,_0x3ed524){var _0x5b7906={'raw':![],'where':{}};var _0x377dc5={};var _0x55dc26={'count':0x0,'rows':[]};return db[_0xa101('0x50')][_0xa101('0x62')]({'where':{'id':_0xac19b9[_0xa101('0x56')]['id']}})[_0xa101('0x1c')](handleEntityNotFound(_0x596122,null))[_0xa101('0x1c')](function(_0x5a7b3e){if(_0x5a7b3e){_0x377dc5['model']=_[_0xa101('0x42')](db[_0xa101('0x69')][_0xa101('0x3c')]);_0x377dc5[_0xa101('0x41')]=_['keys'](_0xac19b9[_0xa101('0x41')]);_0x377dc5['filters']=_['intersection'](_0x377dc5['model'],_0x377dc5['query']);_0x5b7906[_0xa101('0x44')]=_[_0xa101('0x45')](_0x377dc5[_0xa101('0x46')],qs[_0xa101('0x47')](_0xac19b9[_0xa101('0x41')][_0xa101('0x47')]));_0x5b7906[_0xa101('0x44')]=_0x5b7906[_0xa101('0x44')][_0xa101('0x48')]?_0x5b7906[_0xa101('0x44')]:_0x377dc5[_0xa101('0x46')];if(!_0xac19b9[_0xa101('0x41')][_0xa101('0x49')](_0xa101('0x63'))){_0x5b7906['limit']=qs[_0xa101('0x2b')](_0xac19b9[_0xa101('0x41')][_0xa101('0x2b')]);_0x5b7906['offset']=qs['offset'](_0xac19b9[_0xa101('0x41')][_0xa101('0x29')]);}_0x5b7906['order']=qs['sort'](_0xac19b9['query'][_0xa101('0x64')]);_0x5b7906[_0xa101('0x4b')]=qs[_0xa101('0x43')](_[_0xa101('0x6a')](_0xac19b9[_0xa101('0x41')],_0x377dc5[_0xa101('0x43')]));_0x5b7906[_0xa101('0x4b')]['SmsAccountId']=_0x5a7b3e['id'];if(_0xac19b9[_0xa101('0x41')][_0xa101('0x4c')]){_0x5b7906[_0xa101('0x4b')]=_[_0xa101('0x4d')](_0x5b7906['where'],{'$or':_[_0xa101('0x3b')](_0x5b7906[_0xa101('0x44')],function(_0x546821){var _0x1d91dd={};_0x1d91dd[_0x546821]={'$like':'%'+_0xac19b9[_0xa101('0x41')]['filter']+'%'};return _0x1d91dd;})});}_0x5b7906=_['merge']({},_0x5b7906,_0xac19b9[_0xa101('0x4f')]);return db[_0xa101('0x69')][_0xa101('0x2c')]({'where':_0x5b7906['where']})[_0xa101('0x1c')](function(_0xa16325){_0x55dc26['count']=_0xa16325;if(_0xac19b9[_0xa101('0x41')][_0xa101('0x51')]){_0x5b7906[_0xa101('0x52')]=[{'all':!![]}];}return db[_0xa101('0x69')][_0xa101('0x53')](_0x5b7906);})[_0xa101('0x1c')](function(_0x385b35){_0x55dc26[_0xa101('0x54')]=_0x385b35;return _0x55dc26;});}})[_0xa101('0x1c')](respondWithFilteredResult(_0x596122,_0x5b7906))[_0xa101('0x25')](handleError(_0x596122,null));};exports[_0xa101('0x6b')]=function(_0xea8065,_0x463892,_0x879952){return db[_0xa101('0x50')][_0xa101('0x57')]({'where':{'id':_0xea8065[_0xa101('0x56')]['id']}})['then'](handleEntityNotFound(_0x463892,null))['then'](function(_0x4b393){if(_0x4b393){return _0x4b393[_0xa101('0x6b')](_0xea8065[_0xa101('0x41')][_0xa101('0x67')]);}})[_0xa101('0x1c')](respondWithStatusCode(_0x463892,null))[_0xa101('0x25')](handleError(_0x463892,null));};exports['notify']=function(_0x23ffff,_0x33765e,_0x5940d4){var _0x4f9362={'channel':_0xa101('0x6c')};var _0x51a592=[];var _0x1abee6=[];var _0x56a60c={};return db['SmsAccount'][_0xa101('0x57')]({'where':{'id':_0x23ffff[_0xa101('0x56')]['id']},'include':[{'model':db[_0xa101('0x6d')],'as':_0xa101('0x6e')}]})['then'](handleEntityNotFound(_0x33765e,null))[_0xa101('0x1c')](function(_0x5f55c4){_0x4f9362[_0xa101('0x6f')]=_0x5f55c4;_0x4f9362['applications']=_[_0xa101('0x70')](_0x5f55c4[_0xa101('0x6e')],[_0xa101('0x71')],['asc']);if(_0x4f9362['account']['Applications']){delete _0x4f9362[_0xa101('0x6f')][_0xa101('0x6e')];}return db[_0xa101('0x72')][_0xa101('0x5f')]();})[_0xa101('0x1c')](function(_0x28d608){if(!_0x28d608){throw new db[(_0xa101('0x73'))][(_0xa101('0x74'))]('no\x20available\x20attributes');}_0x51a592=_[_0xa101('0x75')](_[_0xa101('0x42')](_0x28d608),[_0xa101('0x76'),'updatedAt']);_0x1abee6=_[_0xa101('0x75')](_['keys'](_0x28d608),[_0xa101('0x76'),_0xa101('0x77'),'CompanyId','ListId']);_0x4f9362[_0xa101('0x59')]={'mapKey':_0xa101('0x78')};if(_0x4f9362[_0xa101('0x6f')][_0xa101('0x3e')]){switch(_0x4f9362['account'][_0xa101('0x3e')]){case _0xa101('0x79'):_0x4f9362[_0xa101('0x59')][_0xa101('0x7a')]=_0x23ffff[_0xa101('0x59')][_0xa101('0x7b')];_0x4f9362[_0xa101('0x59')][_0xa101('0x59')]=_0x23ffff[_0xa101('0x59')]['Body'];_0x4f9362[_0xa101('0x59')][_0xa101('0x7c')]=_0x23ffff[_0xa101('0x59')][_0xa101('0x7d')];break;case _0xa101('0x7e'):_0x4f9362[_0xa101('0x59')][_0xa101('0x7a')]='+'+_0x23ffff[_0xa101('0x59')]['sender'];_0x4f9362[_0xa101('0x59')][_0xa101('0x59')]=_0x23ffff[_0xa101('0x59')]['text'];break;case _0xa101('0x7f'):_0x4f9362[_0xa101('0x59')]['from']=_0x23ffff[_0xa101('0x59')][_0xa101('0x7a')];_0x4f9362[_0xa101('0x59')][_0xa101('0x59')]=_0x23ffff[_0xa101('0x59')]['message'];break;case _0xa101('0x80'):_0x4f9362[_0xa101('0x59')][_0xa101('0x7a')]=_0x23ffff[_0xa101('0x59')]['from'];_0x4f9362[_0xa101('0x59')]['body']=_0x23ffff['body'][_0xa101('0x59')];_0x4f9362[_0xa101('0x59')][_0xa101('0x7c')]=_0x23ffff[_0xa101('0x59')][_0xa101('0x81')];break;case _0xa101('0x82'):_0x4f9362['body'][_0xa101('0x7a')]=_0x23ffff[_0xa101('0x59')][_0xa101('0x7b')];_0x4f9362[_0xa101('0x59')]['body']=_0x23ffff[_0xa101('0x59')][_0xa101('0x83')];_0x4f9362[_0xa101('0x59')][_0xa101('0x7c')]=_0x23ffff[_0xa101('0x59')][_0xa101('0x84')];break;case _0xa101('0x85'):_0x4f9362['body'][_0xa101('0x7a')]='+'+_0x23ffff['body']['results'][0x0][_0xa101('0x7a')];_0x4f9362['body']['body']=_0x23ffff[_0xa101('0x59')][_0xa101('0x86')][0x0]['text'];_0x4f9362[_0xa101('0x59')][_0xa101('0x7c')]=_0x23ffff['body'][_0xa101('0x86')][0x0][_0xa101('0x7c')];break;case'csc':_0x4f9362[_0xa101('0x59')]['from']=_0x23ffff[_0xa101('0x59')][_0xa101('0x87')];_0x4f9362['body'][_0xa101('0x59')]=_0x23ffff[_0xa101('0x59')][_0xa101('0x88')][_0xa101('0x24')];break;case _0xa101('0x89'):_0x4f9362[_0xa101('0x59')][_0xa101('0x7a')]=_0x23ffff[_0xa101('0x59')][_0xa101('0x8a')];_0x4f9362[_0xa101('0x59')][_0xa101('0x59')]=_0x23ffff[_0xa101('0x59')][_0xa101('0x8b')];_0x4f9362[_0xa101('0x59')][_0xa101('0x7c')]=_0x23ffff[_0xa101('0x59')][_0xa101('0x8c')];break;case _0xa101('0x8d'):_0x4f9362['body'][_0xa101('0x7c')]=_0x23ffff[_0xa101('0x59')][0x0]['message']['id'];_0x4f9362[_0xa101('0x59')]['from']=_0x23ffff[_0xa101('0x59')][0x0][_0xa101('0x24')]['from'];_0x4f9362[_0xa101('0x59')][_0xa101('0x59')]=_0x23ffff[_0xa101('0x59')][0x0][_0xa101('0x24')][_0xa101('0x8b')];break;case _0xa101('0x8e'):_0x4f9362['body'][_0xa101('0x7a')]=_0x23ffff['body'][_0xa101('0x7a')];_0x4f9362[_0xa101('0x59')][_0xa101('0x59')]=_0x23ffff[_0xa101('0x59')][_0xa101('0x24')];_0x4f9362[_0xa101('0x59')][_0xa101('0x7c')]=_0x23ffff[_0xa101('0x59')][_0xa101('0x8f')];break;}}if(_0x4f9362['body']['id']){delete _0x4f9362[_0xa101('0x59')]['id'];}if(_[_0xa101('0x90')](_0x4f9362['body'][_0xa101('0x7a')])){throw new db[(_0xa101('0x73'))][(_0xa101('0x74'))](_0xa101('0x91'));}if(_[_0xa101('0x90')](_0x4f9362[_0xa101('0x59')][_0xa101('0x59')])||_0x4f9362[_0xa101('0x59')]['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa101('0x90')](_0x4f9362['body'][_0xa101('0x92')])){throw new db['Sequelize'][(_0xa101('0x74'))](_0xa101('0x93')+_0x1abee6);}if(!_['includes'](_0x1abee6,_0x4f9362[_0xa101('0x59')]['mapKey'])){throw new db[(_0xa101('0x73'))][(_0xa101('0x74'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1abee6);}_0x56a60c[_0x4f9362[_0xa101('0x59')]['mapKey']]=_0x4f9362[_0xa101('0x59')][_0xa101('0x7a')];return db['CmList'][_0xa101('0x57')]({'where':{'id':_0x4f9362['account'][_0xa101('0x94')]},'include':[{'model':db[_0xa101('0x72')],'as':_0xa101('0x95'),'where':_0x56a60c,'limit':0x1,'order':[[_0xa101('0x77'),_0xa101('0x96')]]}]});})[_0xa101('0x1c')](handleEntityNotFound(_0x33765e,null))[_0xa101('0x1c')](function(_0x48f064){if(_0x48f064){_0x4f9362[_0xa101('0x97')]=_[_0xa101('0x98')](_0x48f064,['Contacts']);if(_0x48f064[_0xa101('0x95')][_0xa101('0x48')]){return _0x48f064['Contacts'][0x0];}var _0x3e5cae=_[_0xa101('0x99')](_0x4f9362[_0xa101('0x59')],{'firstName':_0x4f9362[_0xa101('0x59')][_0xa101('0x7a')],'ListId':_0x48f064['id']});_0x3e5cae[_0x4f9362[_0xa101('0x59')][_0xa101('0x92')]]=_0x4f9362[_0xa101('0x59')]['from'];return db[_0xa101('0x72')][_0xa101('0x58')](_0x3e5cae,{'fields':_0x51a592,'raw':!![]});}})['then'](handleEntityNotFound(_0x33765e,null))[_0xa101('0x1c')](function(_0xa37046){if(_0xa37046){_0x4f9362['contact']=_0xa37046;var _0x2bb6e6={'ContactId':_0xa37046['id'],'phone':_0x4f9362[_0xa101('0x59')][_0xa101('0x7a')],'SmsAccountId':_0x23ffff[_0xa101('0x56')]['id']};var _0x59d2c8={'ContactId':_0xa37046['id'],'SmsAccountId':_0x23ffff[_0xa101('0x56')]['id'],'closed':![]};return db[_0xa101('0x9a')]['find']({'where':_0x59d2c8})[_0xa101('0x1c')](function(_0x1ca7f2){if(_0x1ca7f2){return[_0x1ca7f2,![]];}return db[_0xa101('0x9a')][_0xa101('0x58')](_0x2bb6e6)[_0xa101('0x1c')](function(_0x1b0058){return[_0x1b0058,!![]];});});}})[_0xa101('0x9b')](function(_0x53285d,_0x1f9f90){_0x4f9362['interaction']=_0x53285d[_0xa101('0x32')]({'plain':!![]});_0x4f9362[_0xa101('0x9c')]['created']=![];if(_0x1f9f90){if(_0x4f9362['account'][_0xa101('0x9d')]){_0x4f9362[_0xa101('0x9e')][_0xa101('0x9f')]({'id':0x0,'priority':_0x4f9362['applications']['length']+0x1,'app':_0xa101('0xa0'),'appdata':_0xa101('0xa1'),'interval':_0xa101('0xa2')});}_0x4f9362[_0xa101('0x9c')][_0xa101('0xa3')]=!![];}return db[_0xa101('0xa4')][_0xa101('0x58')]({'phone':_0x4f9362[_0xa101('0x59')]['from'],'messageId':_0x4f9362[_0xa101('0x59')][_0xa101('0x7c')],'body':_0x4f9362[_0xa101('0x59')][_0xa101('0x59')],'SmsAccountId':_0x23ffff[_0xa101('0x56')]['id'],'SmsInteractionId':_0x53285d['id'],'direction':'in','ContactId':_0x53285d[_0xa101('0xa5')],'AttachmentId':_0x4f9362[_0xa101('0x59')]['AttachmentId']});})[_0xa101('0x1c')](function(_0x289ae7){_0x4f9362[_0xa101('0x24')]=_0x289ae7;if(_0x4f9362[_0xa101('0x9c')][_0xa101('0xa6')]){return db['User'][_0xa101('0x57')]({'attributes':['id',_0xa101('0x40')],'where':{'id':_0x4f9362[_0xa101('0x9c')][_0xa101('0xa6')]}})[_0xa101('0x1c')](function(_0x3b2812){if(_0x3b2812){_0x4f9362['applications'][_0xa101('0xa7')]({'id':0x0,'priority':0x0,'app':_0xa101('0xa8'),'appdata':_0x3b2812[_0xa101('0x40')]+','+(_0x4f9362[_0xa101('0x6f')][_0xa101('0xa9')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xa101('0xaa'),_0x4f9362);});}return respondWithRpcPromise(_0xa101('0xab'),_0xa101('0xaa'),_0x4f9362);})[_0xa101('0x1c')](function(_0x5b2e44){if(_0x5b2e44){var _0x4a01f6=0xc8;var _0x570a84='receiveMessage';logger[_0xa101('0x1d')](_0xa101('0x20'),_0x570a84,_0x4a01f6,_0xa101('0xac'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x570a84,_0x4a01f6,_0xa101('0xac'),JSON[_0xa101('0x21')](_0x5b2e44));if(_0x4f9362[_0xa101('0x6f')][_0xa101('0x3e')]===_0xa101('0x79')){return _0x33765e[_0xa101('0x27')](_0x4a01f6)[_0xa101('0x2d')]('Content-Type',_0xa101('0xad'))[_0xa101('0x37')]('\x0a');}else{return _0x33765e[_0xa101('0x27')](_0x4a01f6)[_0xa101('0x28')](_0x5b2e44);}}})[_0xa101('0x25')](handleError(_0x33765e,null));};exports['addApplications']=function(_0x4be191,_0x58262a,_0x493b53){return db[_0xa101('0x50')]['findOne']({'where':{'id':_0x4be191['params']['id']}})[_0xa101('0x1c')](handleEntityNotFound(_0x58262a,null))['then'](function(_0x585e88){if(_0x585e88){return db[_0xa101('0xae')]['transaction'](function(_0x6cf66c){return db[_0xa101('0x6d')][_0xa101('0x35')]({'where':{'SmsAccountId':_0x4be191[_0xa101('0x56')]['id']},'transaction':_0x6cf66c})[_0xa101('0x1c')](function(_0x4f26e8){var _0x11e722=_[_0xa101('0x3b')](_0x4be191[_0xa101('0x59')],function(_0x258ee4){_0x258ee4[_0xa101('0x65')]=_0x4be191['params']['id'];return _0x258ee4;});return db[_0xa101('0x6d')][_0xa101('0xaf')](_0x11e722,{'transaction':_0x6cf66c});});})[_0xa101('0x1c')](function(){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x4be191[_0xa101('0x56')]['id']},'order':_0xa101('0x71')});});}})['then'](respondWithResult(_0x58262a,null))['catch'](handleError(_0x58262a,null));};exports[_0xa101('0xb0')]=function(_0x2f16ca,_0x1f845e,_0x1687de){var _0x42ff2c={};var _0x136890={};var _0x4ff87a;var _0x37b83c;return db['SmsAccount'][_0xa101('0x62')]({'where':{'id':_0x2f16ca[_0xa101('0x56')]['id']}})['then'](handleEntityNotFound(_0x1f845e,null))[_0xa101('0x1c')](function(_0x12bbe9){if(_0x12bbe9){_0x4ff87a=_0x12bbe9;_0x136890['model']=_['keys'](db['SmsApplication'][_0xa101('0x3c')]);_0x136890['query']=_[_0xa101('0x42')](_0x2f16ca[_0xa101('0x41')]);_0x136890[_0xa101('0x43')]=_[_0xa101('0x45')](_0x136890['model'],_0x136890['query']);_0x42ff2c['attributes']=_[_0xa101('0x45')](_0x136890[_0xa101('0x46')],qs[_0xa101('0x47')](_0x2f16ca[_0xa101('0x41')][_0xa101('0x47')]));_0x42ff2c[_0xa101('0x44')]=_0x42ff2c[_0xa101('0x44')][_0xa101('0x48')]?_0x42ff2c[_0xa101('0x44')]:_0x136890[_0xa101('0x46')];_0x42ff2c['order']=qs[_0xa101('0x64')](_0x2f16ca[_0xa101('0x41')]['sort']);_0x42ff2c[_0xa101('0x4b')]=qs[_0xa101('0x43')](_[_0xa101('0x6a')](_0x2f16ca[_0xa101('0x41')],_0x136890[_0xa101('0x43')]));if(_0x2f16ca[_0xa101('0x41')][_0xa101('0x4c')]){_0x42ff2c[_0xa101('0x4b')]=_[_0xa101('0x4d')](_0x42ff2c[_0xa101('0x4b')],{'$or':_[_0xa101('0x3b')](_0x42ff2c[_0xa101('0x44')],function(_0x918d){var _0x5e65b0={};_0x5e65b0[_0x918d]={'$like':'%'+_0x2f16ca[_0xa101('0x41')][_0xa101('0x4c')]+'%'};return _0x5e65b0;})});}_0x42ff2c=_[_0xa101('0x4d')]({},_0x42ff2c,_0x2f16ca['options']);return _0x4ff87a[_0xa101('0xb0')](_0x42ff2c);}})[_0xa101('0x1c')](function(_0x1f5d95){if(_0x1f5d95){_0x37b83c=_0x1f5d95['length'];if(!_0x2f16ca[_0xa101('0x41')][_0xa101('0x49')](_0xa101('0x63'))){_0x42ff2c['limit']=qs['limit'](_0x2f16ca[_0xa101('0x41')][_0xa101('0x2b')]);_0x42ff2c[_0xa101('0x29')]=qs[_0xa101('0x29')](_0x2f16ca[_0xa101('0x41')]['offset']);}return _0x4ff87a[_0xa101('0xb0')](_0x42ff2c);}})['then'](function(_0x12c4eb){if(_0x12c4eb){return _0x12c4eb?{'count':_0x37b83c,'rows':_0x12c4eb}:null;}})[_0xa101('0x1c')](respondWithResult(_0x1f845e,null))[_0xa101('0x25')](handleError(_0x1f845e,null));};exports[_0xa101('0xb1')]=function(_0x2aa8ff,_0x70aeaa,_0x30cdff){var _0x4e7344={'raw':![],'where':{}};var _0x40bd39={};var _0x5a3535={'count':0x0,'rows':[]};return db[_0xa101('0x50')]['findOne']({'where':{'id':_0x2aa8ff['params']['id']}})['then'](handleEntityNotFound(_0x70aeaa,null))[_0xa101('0x1c')](function(_0x1f50bc){if(_0x1f50bc){_0x40bd39[_0xa101('0x46')]=_['keys'](db[_0xa101('0x9a')][_0xa101('0x3c')]);_0x40bd39['query']=_[_0xa101('0x42')](_0x2aa8ff[_0xa101('0x41')]);_0x40bd39[_0xa101('0x43')]=_[_0xa101('0x45')](_0x40bd39[_0xa101('0x46')],_0x40bd39['query']);_0x4e7344[_0xa101('0x44')]=_[_0xa101('0x45')](_0x40bd39['model'],qs[_0xa101('0x47')](_0x2aa8ff[_0xa101('0x41')][_0xa101('0x47')]));_0x4e7344['attributes']=_0x4e7344[_0xa101('0x44')]['length']?_0x4e7344[_0xa101('0x44')]:_0x40bd39[_0xa101('0x46')];if(!_0x2aa8ff[_0xa101('0x41')][_0xa101('0x49')](_0xa101('0x63'))){_0x4e7344[_0xa101('0x2b')]=qs[_0xa101('0x2b')](_0x2aa8ff[_0xa101('0x41')][_0xa101('0x2b')]);_0x4e7344['offset']=qs['offset'](_0x2aa8ff['query']['offset']);}_0x4e7344[_0xa101('0x4a')]=qs['sort'](_0x2aa8ff[_0xa101('0x41')][_0xa101('0x64')]);_0x4e7344[_0xa101('0x4b')]=qs[_0xa101('0x43')](_[_0xa101('0x6a')](_0x2aa8ff[_0xa101('0x41')],_0x40bd39[_0xa101('0x43')]));_0x4e7344[_0xa101('0x4b')][_0xa101('0x65')]=_0x1f50bc['id'];if(_0x2aa8ff[_0xa101('0x41')]['filter']){_0x4e7344['where']=_['merge'](_0x4e7344[_0xa101('0x4b')],{'$or':_[_0xa101('0x3b')](_0x4e7344[_0xa101('0x44')],function(_0x4206fa){var _0x1f3e12={};_0x1f3e12[_0x4206fa]={'$like':'%'+_0x2aa8ff[_0xa101('0x41')][_0xa101('0x4c')]+'%'};return _0x1f3e12;})});}_0x4e7344=_[_0xa101('0x4d')]({},_0x4e7344,_0x2aa8ff[_0xa101('0x4f')]);return db[_0xa101('0x9a')][_0xa101('0x2c')]({'where':_0x4e7344[_0xa101('0x4b')]})[_0xa101('0x1c')](function(_0x3ee26c){_0x5a3535[_0xa101('0x2c')]=_0x3ee26c;if(_0x2aa8ff[_0xa101('0x41')][_0xa101('0x51')]){_0x4e7344[_0xa101('0x52')]=[{'model':db[_0xa101('0x72')],'as':'Contact','required':![]},{'model':db[_0xa101('0xb2')],'as':_0xa101('0xb3'),'attributes':[_0xa101('0x40'),_0xa101('0xb4'),_0xa101('0xb5')],'required':![]},{'model':db[_0xa101('0xb6')],'as':'Tags','attributes':['id',_0xa101('0x40'),'color'],'where':_0x2aa8ff['query'][_0xa101('0xb7')]?{'id':_0x2aa8ff[_0xa101('0x41')][_0xa101('0xb7')]}:undefined,'required':_0x2aa8ff[_0xa101('0x41')][_0xa101('0xb7')]?!![]:![]}];}return db[_0xa101('0x9a')]['findAll'](_0x4e7344);})[_0xa101('0x1c')](function(_0x5f2bc3){_0x5a3535[_0xa101('0x54')]=_0x5f2bc3;return _0x5a3535;});}})[_0xa101('0x1c')](respondWithFilteredResult(_0x70aeaa,_0x4e7344))[_0xa101('0x25')](handleError(_0x70aeaa,null));};exports[_0xa101('0x37')]=function(_0x33165d,_0x4a24ca,_0x611ee){var _0x1e830f,_0x5ad589,_0x49281e;if(_[_0xa101('0x90')](_0x33165d['body']['body'])||_0x33165d['body']['body']===''){throw new db[(_0xa101('0x73'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa101('0x90')](_0x33165d['body']['to'])){throw new db['Sequelize'][(_0xa101('0x74'))]('to\x20is\x20mandatory');}_0x1e830f=_0x33165d['body']['to'];return db[_0xa101('0x50')][_0xa101('0x57')]({'where':{'id':_0x33165d[_0xa101('0x56')]['id']},'include':[{'model':db[_0xa101('0xb8')],'as':_0xa101('0xb9'),'include':[{'model':db[_0xa101('0x72')],'as':_0xa101('0x95'),'where':{'mobile':_0x1e830f},'limit':0x1,'order':[['updatedAt',_0xa101('0x96')]]}]}]})[_0xa101('0x1c')](handleEntityNotFound(_0x4a24ca,null))[_0xa101('0x1c')](function(_0x21b19a){if(_0x21b19a&&_0x21b19a['List']){_0x5ad589=_0x21b19a[_0xa101('0x32')]({'plain':!![]});if(_0x5ad589[_0xa101('0xb9')]&&_0x5ad589[_0xa101('0xb9')][_0xa101('0x95')]['length']){return _0x5ad589[_0xa101('0xb9')][_0xa101('0x95')][0x0];}return db[_0xa101('0x72')]['create'](_[_0xa101('0x99')](_0x33165d[_0xa101('0x59')],{'firstName':_0x1e830f,'mobile':_0x1e830f,'phone':_0x1e830f,'ListId':_0x5ad589[_0xa101('0x94')]}));}})[_0xa101('0x1c')](handleEntityNotFound(_0x4a24ca,null))['then'](function(_0x2db433){if(_0x2db433){_0x49281e=_0x2db433;return db['SmsInteraction'][_0xa101('0x57')]({'where':{'ContactId':_0x49281e['id'],'closed':![],'SmsAccountId':_0x5ad589['id']}})['then'](function(_0x4a3660){if(_0x4a3660){return[_0x4a3660,![]];}return db[_0xa101('0x9a')][_0xa101('0x58')]({'UserId':_0x33165d[_0xa101('0x5a')]['id'],'ContactId':_0x49281e['id'],'SmsAccountId':_0x5ad589['id'],'phone':_0x1e830f,'firstMsgDirection':_0xa101('0xba'),'Messages':[_['merge'](_0x33165d[_0xa101('0x59')],{'read':![],'body':_0x33165d['body'][_0xa101('0x59')],'phone':_0x1e830f,'SmsAccountId':_0x5ad589['id'],'UserId':_0x33165d[_0xa101('0x5a')]['id'],'ContactId':_0x49281e['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xa101('0xbb')}]})['then'](function(_0x50b9a6){return[_0x50b9a6,!![]];});});}})[_0xa101('0x9b')](function(_0x20420b,_0x4df5c3){if(_0x4df5c3){return _0x20420b;}return db[_0xa101('0xa4')]['create'](_['merge'](_0x33165d[_0xa101('0x59')],{'read':![],'body':_0x33165d[_0xa101('0x59')]['body'],'phone':_0x1e830f,'SmsAccountId':_0x5ad589['id'],'SmsInteractionId':_0x20420b['id'],'UserId':_0x33165d['user']['id'],'ContactId':_0x49281e['id']}))['then'](function(_0x1d0f02){_0x20420b['dataValues'][_0xa101('0xbb')]=[];_0x20420b[_0xa101('0xbc')]['Messages']['push'](_0x1d0f02[_0xa101('0xbc')]);return _0x20420b;});})[_0xa101('0x1c')](respondWithResult(_0x4a24ca,null))[_0xa101('0x25')](handleError(_0x4a24ca,null));};exports['status']=function(_0x3b4621,_0x485a25,_0x84cbe6){if(_0x3b4621[_0xa101('0x59')]['id']){delete _0x3b4621[_0xa101('0x59')]['id'];}var _0xdc3812,_0x15b98a,_0x295fda;return db[_0xa101('0x50')][_0xa101('0x57')]({'where':{'id':_0x3b4621[_0xa101('0x56')]['id']}})[_0xa101('0x1c')](handleEntityNotFound(_0x485a25,null))['then'](function(_0x3fc8e1){if(_0x3fc8e1){_0x295fda=_0x3fc8e1;logger[_0xa101('0xbd')](_0xa101('0x20'),_0xa101('0x27'),_0xa101('0xbe'),_0x3fc8e1[_0xa101('0x3e')],util['inspect'](_0x3b4621[_0xa101('0x59')],{'showHidden':![],'depth':null}));switch(_0x3fc8e1['type']){case _0xa101('0x7e'):if(_0x3b4621[_0xa101('0x59')][_0xa101('0xbf')]&&_0x3b4621[_0xa101('0x59')]['status']){_0x15b98a=_0x3b4621[_0xa101('0x59')]['status'];return db[_0xa101('0xa4')][_0xa101('0x57')]({'where':{'messageId':_0x3b4621[_0xa101('0x59')][_0xa101('0xbf')]}});}break;case _0xa101('0x7f'):if(_0x3b4621[_0xa101('0x59')]['requestid']&&_0x3b4621[_0xa101('0x59')][_0xa101('0xc0')]){_0x15b98a=_0x3b4621[_0xa101('0x59')]['statusInt'];return db[_0xa101('0xa4')][_0xa101('0x57')]({'where':{'messageId':_0x3b4621['body'][_0xa101('0xc1')]}});}break;case _0xa101('0x80'):if(_0x3b4621[_0xa101('0x59')][_0xa101('0x81')]&&_0x3b4621[_0xa101('0x59')][_0xa101('0xc2')]){_0x15b98a=_0x3b4621['body']['status_code'];return db[_0xa101('0xa4')][_0xa101('0x57')]({'where':{'messageId':_0x3b4621[_0xa101('0x59')][_0xa101('0x81')]}});}break;case _0xa101('0x85'):var _0x31c0d6=_0x3b4621[_0xa101('0x59')]['results'][0x0];if(_0x31c0d6[_0xa101('0x7c')]&&_0x31c0d6[_0xa101('0x27')][_0xa101('0xc3')]==='DELIVERED'){_0x15b98a=_0x31c0d6[_0xa101('0x27')]['groupName'];return db[_0xa101('0xa4')][_0xa101('0x57')]({'where':{'messageId':_0x31c0d6[_0xa101('0x7c')]}});}break;case _0xa101('0x89'):if(_0x3b4621[_0xa101('0x59')][_0xa101('0x7c')]&&_0x3b4621[_0xa101('0x59')][_0xa101('0x27')]){_0x15b98a=_0x3b4621[_0xa101('0x59')][_0xa101('0x27')];return db[_0xa101('0xa4')][_0xa101('0x57')]({'where':{'messageId':_0x3b4621[_0xa101('0x59')][_0xa101('0x7c')]}});}break;case _0xa101('0x8d'):if(_0x3b4621['body'][0x0]['message']['id']){_0x15b98a=_0x3b4621[_0xa101('0x59')][0x0][_0xa101('0x3e')];return db[_0xa101('0xa4')][_0xa101('0x57')]({'where':{'messageId':_0x3b4621[_0xa101('0x59')][0x0][_0xa101('0x24')]['id']}});}break;case _0xa101('0x8e'):if(_0x3b4621[_0xa101('0x59')]['redif']&&_0x3b4621[_0xa101('0x59')][_0xa101('0x27')]){_0x15b98a=_0x3b4621[_0xa101('0x59')][_0xa101('0x27')];return db[_0xa101('0xa4')]['find']({'where':{'messageId':_0x3b4621['body']['redif']}});}break;}}})['then'](handleEntityNotFound(_0x485a25,null))['then'](function(_0x23c9dc){if(_0x23c9dc){_0xdc3812=_0x23c9dc;switch(_0x295fda[_0xa101('0x3e')]){case _0xa101('0x7e'):if(_0x15b98a==='DELIVERED'){return _0xdc3812[_0xa101('0x31')]({'read':!![]});}else{logger[_0xa101('0x22')](_0xa101('0x20'),_0xa101('0x27'),'skebby',util[_0xa101('0xc4')](_0x3b4621[_0xa101('0x59')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x15b98a==='1'){return _0xdc3812[_0xa101('0x31')]({'read':!![]});}else{logger['error'](_0xa101('0x20'),'status',_0xa101('0x7e'),util[_0xa101('0xc4')](_0x3b4621['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x3b4621[_0xa101('0x59')]['error_code']&&_0x15b98a>=0xc8&&_0x15b98a<=0xce){return _0xdc3812['update']({'read':!![]});}else{logger[_0xa101('0x22')](_0xa101('0x20'),_0xa101('0x27'),_0xa101('0x80'),util[_0xa101('0xc4')](_0x3b4621[_0xa101('0x59')],{'showHidden':![],'depth':null}));}break;case _0xa101('0x85'):var _0x4a6d35=_0x3b4621[_0xa101('0x59')][_0xa101('0x86')][0x0];if(_0x4a6d35[_0xa101('0x27')][_0xa101('0xc3')]===_0xa101('0xc5')){return _0xdc3812[_0xa101('0x31')]({'read':!![]});}else{logger[_0xa101('0x22')](_0xa101('0x20'),_0xa101('0x27'),'infobip',util[_0xa101('0xc4')](_0x3b4621[_0xa101('0x59')],{'showHidden':![],'depth':null}));}break;case _0xa101('0x89'):if(_0x15b98a==_0xa101('0xc6')||_0x15b98a==_0xa101('0xc7')){return _0xdc3812[_0xa101('0x31')]({'read':!![]});}else{logger[_0xa101('0x22')](_0xa101('0x20'),'status',_0xa101('0x89'),util['inspect'](_0x3b4621[_0xa101('0x59')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x15b98a==_0xa101('0xc8')){return _0xdc3812[_0xa101('0x31')]({'read':!![]});}else{logger[_0xa101('0x22')](_0xa101('0x20'),_0xa101('0x27'),_0xa101('0x8d'),util[_0xa101('0xc4')](_0x3b4621['body'],{'showHidden':![],'depth':null}));}break;case _0xa101('0x8e'):if(_0x15b98a==='DELIVRD'||_0x15b98a==='ACCEPTD'){return _0xdc3812[_0xa101('0x31')]({'read':!![]});}else{logger[_0xa101('0x22')](_0xa101('0x20'),_0xa101('0x27'),'intelepeer',util[_0xa101('0xc4')](_0x3b4621[_0xa101('0x59')],{'showHidden':![],'depth':null}));}break;}return _0xdc3812;}})[_0xa101('0x1c')](respondWithResult(_0x485a25,null))['catch'](handleError(_0x485a25,null));};exports[_0xa101('0xc9')]=function(_0x560fc4,_0xefe48c,_0x41ae01){var _0xf9ab70,_0x1e7a5f,_0x22d41f;return db[_0xa101('0x50')][_0xa101('0x57')]({'where':{'id':_0x560fc4['params']['id']}})[_0xa101('0x1c')](handleEntityNotFound(_0xefe48c,null))[_0xa101('0x1c')](function(_0x584440){if(_0x584440){_0x22d41f=_0x584440;logger[_0xa101('0xbd')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa101('0x27'),_0xa101('0xbe'),_0x584440['type'],util[_0xa101('0xc4')](_0x560fc4[_0xa101('0x41')],{'showHidden':![],'depth':null}));switch(_0x584440[_0xa101('0x3e')]){case _0xa101('0xca'):if(_0x560fc4[_0xa101('0x41')][_0xa101('0xcb')]&&_0x560fc4[_0xa101('0x41')][_0xa101('0xcc')]){_0x1e7a5f=_0x560fc4['query']['state'];return db[_0xa101('0xa4')]['find']({'where':{'messageId':_0x560fc4[_0xa101('0x41')][_0xa101('0xcb')]}});}break;}}})['then'](handleEntityNotFound(_0xefe48c,null))[_0xa101('0x1c')](function(_0x4f6c42){if(_0x4f6c42){_0xf9ab70=_0x4f6c42;switch(_0x22d41f[_0xa101('0x3e')]){case _0xa101('0xca'):if(_0x1e7a5f==='2'||_0x1e7a5f==='6'){return _0xf9ab70['update']({'read':!![]});}else{logger[_0xa101('0x22')](_0xa101('0x20'),_0xa101('0x27'),_0xa101('0xca'),util[_0xa101('0xc4')](_0x560fc4[_0xa101('0x41')],{'showHidden':![],'depth':null}));};break;}return _0xf9ab70;}})[_0xa101('0x1c')](respondWithResult(_0xefe48c,null))[_0xa101('0x25')](handleError(_0xefe48c,null));};exports[_0xa101('0xcd')]=function(_0x2c9314,_0xece830,_0x1d12aa){return db[_0xa101('0x50')]['find']({'where':{'id':_0x2c9314[_0xa101('0x56')]['id']}})['then'](handleEntityNotFound(_0xece830,null))[_0xa101('0x1c')](function(_0x3b279d){if(_0x3b279d){return _0x3b279d[_0xa101('0xcd')](_0x2c9314[_0xa101('0x59')][_0xa101('0x67')],_[_0xa101('0x98')](_0x2c9314['body'],[_0xa101('0x67'),'id'])||{})[_0xa101('0x9b')](function(_0x50ad37){for(var _0x3c9aed=0x0;_0x3c9aed<_0x2c9314[_0xa101('0x59')][_0xa101('0x67')][_0xa101('0x48')];_0x3c9aed+=0x1){socket[_0xa101('0xce')](_0xa101('0xcf'),{'UserId':Number(_0x2c9314['body'][_0xa101('0x67')][_0x3c9aed]),'SmsAccountId':Number(_0x2c9314[_0xa101('0x56')]['id'])});}return _0x50ad37;});}})[_0xa101('0x1c')](respondWithResult(_0xece830,null))[_0xa101('0x25')](handleError(_0xece830,null));};exports[_0xa101('0xd0')]=function(_0x483437,_0x5f2d2a,_0x5bb422){return db['SmsAccount'][_0xa101('0x57')]({'where':{'id':_0x483437['params']['id']}})[_0xa101('0x1c')](handleEntityNotFound(_0x5f2d2a,null))['then'](function(_0x256bed){if(_0x256bed){return _0x256bed[_0xa101('0xd0')](_0x483437['query']['ids'])['then'](function(){if(_[_0xa101('0xd1')](_0x483437[_0xa101('0x41')]['ids'])){for(var _0x4818cc=0x0;_0x4818cc<_0x483437[_0xa101('0x41')][_0xa101('0x67')][_0xa101('0x48')];_0x4818cc+=0x1){socket[_0xa101('0xce')](_0xa101('0xd2'),{'UserId':Number(_0x483437[_0xa101('0x41')][_0xa101('0x67')][_0x4818cc]),'SmsAccountId':Number(_0x483437[_0xa101('0x56')]['id'])});}}else{socket['emit'](_0xa101('0xd2'),{'UserId':Number(_0x483437[_0xa101('0x41')][_0xa101('0x67')]),'SmsAccountId':Number(_0x483437[_0xa101('0x56')]['id'])});}});}})[_0xa101('0x1c')](respondWithStatusCode(_0x5f2d2a,null))[_0xa101('0x25')](handleError(_0x5f2d2a,null));};exports['getAgents']=function(_0xc8122,_0x295bfd,_0x553d12){var _0x472cdb={};var _0x27639e={};var _0x3d21e9;var _0x5b3631;return db[_0xa101('0x50')][_0xa101('0x62')]({'where':{'id':_0xc8122['params']['id']}})[_0xa101('0x1c')](handleEntityNotFound(_0x295bfd,null))[_0xa101('0x1c')](function(_0x5e8830){if(_0x5e8830){_0x3d21e9=_0x5e8830;_0x27639e['model']=_[_0xa101('0x42')](db[_0xa101('0xb2')][_0xa101('0x3c')]);_0x27639e[_0xa101('0x41')]=_['keys'](_0xc8122[_0xa101('0x41')]);_0x27639e[_0xa101('0x43')]=_[_0xa101('0x45')](_0x27639e['model'],_0x27639e[_0xa101('0x41')]);_0x472cdb[_0xa101('0x44')]=_[_0xa101('0x45')](_0x27639e[_0xa101('0x46')],qs[_0xa101('0x47')](_0xc8122[_0xa101('0x41')][_0xa101('0x47')]));_0x472cdb[_0xa101('0x44')]=_0x472cdb['attributes'][_0xa101('0x48')]?_0x472cdb['attributes']:_0x27639e['model'];_0x472cdb[_0xa101('0x4a')]=qs[_0xa101('0x64')](_0xc8122[_0xa101('0x41')][_0xa101('0x64')]);_0x472cdb[_0xa101('0x4b')]=qs[_0xa101('0x43')](_['pick'](_0xc8122['query'],_0x27639e['filters']));if(_0xc8122[_0xa101('0x41')][_0xa101('0x4c')]){_0x472cdb[_0xa101('0x4b')]=_['merge'](_0x472cdb[_0xa101('0x4b')],{'$or':_['map'](_0x472cdb[_0xa101('0x44')],function(_0x9e882b){var _0x32d06e={};_0x32d06e[_0x9e882b]={'$like':'%'+_0xc8122[_0xa101('0x41')][_0xa101('0x4c')]+'%'};return _0x32d06e;})});}_0x472cdb=_[_0xa101('0x4d')]({},_0x472cdb,_0xc8122[_0xa101('0x4f')]);return _0x3d21e9[_0xa101('0xd3')](_0x472cdb);}})[_0xa101('0x1c')](function(_0x267ca8){if(_0x267ca8){_0x5b3631=_0x267ca8[_0xa101('0x48')];if(!_0xc8122[_0xa101('0x41')][_0xa101('0x49')](_0xa101('0x63'))){_0x472cdb[_0xa101('0x2b')]=qs['limit'](_0xc8122[_0xa101('0x41')][_0xa101('0x2b')]);_0x472cdb[_0xa101('0x29')]=qs['offset'](_0xc8122[_0xa101('0x41')][_0xa101('0x29')]);}return _0x3d21e9['getAgents'](_0x472cdb);}})[_0xa101('0x1c')](function(_0x22208a){if(_0x22208a){return _0x22208a?{'count':_0x5b3631,'rows':_0x22208a}:null;}})[_0xa101('0x1c')](respondWithResult(_0x295bfd,null))[_0xa101('0x25')](handleError(_0x295bfd,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 9d16560..558b184 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 _0x7196=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7196,0xfd));var _0x6719=function(_0x42ba04,_0x330010){_0x42ba04=_0x42ba04-0x0;var _0x1b8e19=_0x7196[_0x42ba04];return _0x1b8e19;};'use strict';var EventEmitter=require(_0x6719('0x0'));var SmsAccount=require(_0x6719('0x1'))['db'][_0x6719('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x6719('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6719('0x4'),'afterDestroy':_0x6719('0x5')};function emitEvent(_0x4717ee){return function(_0xd32d59,_0x36ca4e,_0x51cbc3){SmsAccountEvents[_0x6719('0x6')](_0x4717ee+':'+_0xd32d59['id'],_0xd32d59);SmsAccountEvents[_0x6719('0x6')](_0x4717ee,_0xd32d59);_0x51cbc3(null);};}for(var e in events){if(events[_0x6719('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x6719('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x4a09=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove'];(function(_0x5cd39f,_0x5ef209){var _0x563823=function(_0x53a839){while(--_0x53a839){_0x5cd39f['push'](_0x5cd39f['shift']());}};_0x563823(++_0x5ef209);}(_0x4a09,0x14e));var _0x94a0=function(_0x2b8e3c,_0x3c12c9){_0x2b8e3c=_0x2b8e3c-0x0;var _0xdfb0bc=_0x4a09[_0x2b8e3c];return _0xdfb0bc;};'use strict';var EventEmitter=require(_0x94a0('0x0'));var SmsAccount=require(_0x94a0('0x1'))['db'][_0x94a0('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x94a0('0x3')](0x0);var events={'afterCreate':_0x94a0('0x4'),'afterUpdate':_0x94a0('0x5'),'afterDestroy':_0x94a0('0x6')};function emitEvent(_0xc634e7){return function(_0x235746,_0x224b86,_0x104ff4){SmsAccountEvents[_0x94a0('0x7')](_0xc634e7+':'+_0x235746['id'],_0x235746);SmsAccountEvents[_0x94a0('0x7')](_0xc634e7,_0x235746);_0x104ff4(null);};}for(var e in events){if(events[_0x94a0('0x8')](e)){var event=events[e];SmsAccount[_0x94a0('0x9')](e,emitEvent(event));}}module[_0x94a0('0xa')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 6ec1937..fa753a4 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 _0xeef6=['request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','util','../../config/logger'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0xeef6,0x82));var _0x6eef=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xeef6[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x6eef('0x0'));var logger=require(_0x6eef('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6eef('0x2'));var fs=require('fs');var path=require(_0x6eef('0x3'));var rimraf=require(_0x6eef('0x4'));var config=require(_0x6eef('0x5'));var attributes=require(_0x6eef('0x6'));module[_0x6eef('0x7')]=function(_0x40132c,_0x13a176){return _0x40132c[_0x6eef('0x8')](_0x6eef('0x9'),attributes,{'tableName':_0x6eef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd2c=['moment','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','sms_accounts','lodash','util','../../config/logger'];(function(_0x32dffb,_0x5c6436){var _0x1cabd3=function(_0x3b1ecc){while(--_0x3b1ecc){_0x32dffb['push'](_0x32dffb['shift']());}};_0x1cabd3(++_0x5c6436);}(_0xbd2c,0x173));var _0xcbd2=function(_0x5730bf,_0x684a92){_0x5730bf=_0x5730bf-0x0;var _0x3e855d=_0xbd2c[_0x5730bf];return _0x3e855d;};'use strict';var _=require(_0xcbd2('0x0'));var util=require(_0xcbd2('0x1'));var logger=require(_0xcbd2('0x2'))('api');var moment=require(_0xcbd2('0x3'));var BPromise=require(_0xcbd2('0x4'));var rp=require(_0xcbd2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbd2('0x6'));var config=require(_0xcbd2('0x7'));var attributes=require(_0xcbd2('0x8'));module[_0xcbd2('0x9')]=function(_0x2e079f,_0x4e94cb){return _0x2e079f['define']('SmsAccount',attributes,{'tableName':_0xcbd2('0xa'),'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 9ee4e39..eafaa7a 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 _0x59a4=['find','options','where','attributes','include','map','model','then','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./smsAccount.socket','register','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSmsAccount'];(function(_0x460e09,_0x543fe5){var _0x116d07=function(_0xc6a675){while(--_0xc6a675){_0x460e09['push'](_0x460e09['shift']());}};_0x116d07(++_0x543fe5);}(_0x59a4,0x1e9));var _0x459a=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x59a4[_0x4c440b];return _0x2d48cf;};'use strict';var _=require('lodash');var util=require(_0x459a('0x0'));var moment=require(_0x459a('0x1'));var BPromise=require(_0x459a('0x2'));var rs=require(_0x459a('0x3'));var fs=require('fs');var Redis=require(_0x459a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x459a('0x5'));var logger=require(_0x459a('0x6'))(_0x459a('0x7'));var config=require(_0x459a('0x8'));var jayson=require(_0x459a('0x9'));var client=jayson['client'][_0x459a('0xa')]({'port':0x232a});config[_0x459a('0xb')]=_[_0x459a('0xc')](config[_0x459a('0xb')],{'host':_0x459a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x459a('0xb')]));require(_0x459a('0xe'))[_0x459a('0xf')](socket);function respondWithRpcPromise(_0xe678d4,_0xdff481,_0x447e7){return new BPromise(function(_0x3572fe,_0x48f8a7){return client[_0x459a('0x10')](_0xe678d4,_0x447e7)['then'](function(_0x110308){logger['info'](_0x459a('0x11'),_0xdff481,_0x459a('0x12'));logger[_0x459a('0x13')](_0x459a('0x14'),_0xdff481,_0x459a('0x12'),JSON[_0x459a('0x15')](_0x110308));if(_0x110308[_0x459a('0x16')]){if(_0x110308[_0x459a('0x16')][_0x459a('0x17')]===0x1f4){logger[_0x459a('0x16')](_0x459a('0x11'),_0xdff481,_0x110308[_0x459a('0x16')][_0x459a('0x18')]);return _0x48f8a7(_0x110308['error'][_0x459a('0x18')]);}logger[_0x459a('0x16')](_0x459a('0x11'),_0xdff481,_0x110308['error']['message']);return _0x3572fe(_0x110308[_0x459a('0x16')][_0x459a('0x18')]);}else{logger[_0x459a('0x19')]('SmsAccount,\x20%s,\x20%s',_0xdff481,_0x459a('0x12'));_0x3572fe(_0x110308[_0x459a('0x1a')][_0x459a('0x18')]);}})[_0x459a('0x1b')](function(_0x47f92e){logger[_0x459a('0x16')](_0x459a('0x11'),_0xdff481,_0x47f92e);_0x48f8a7(_0x47f92e);});});}exports[_0x459a('0x1c')]=function(_0x466383){var _0x28d2eb=this;return new Promise(function(_0x319f10,_0x3ca49b){return db['SmsAccount'][_0x459a('0x1d')]({'raw':_0x466383[_0x459a('0x1e')]?_0x466383['options']['raw']===undefined?!![]:![]:!![],'where':_0x466383[_0x459a('0x1e')]?_0x466383[_0x459a('0x1e')][_0x459a('0x1f')]||null:null,'attributes':_0x466383[_0x459a('0x1e')]?_0x466383[_0x459a('0x1e')][_0x459a('0x20')]||null:null,'include':_0x466383[_0x459a('0x1e')]?_0x466383[_0x459a('0x1e')][_0x459a('0x21')]?_[_0x459a('0x22')](_0x466383[_0x459a('0x1e')][_0x459a('0x21')],function(_0x354b96){return{'model':db[_0x354b96[_0x459a('0x23')]],'as':_0x354b96['as'],'attributes':_0x354b96[_0x459a('0x20')],'include':_0x354b96[_0x459a('0x21')]?_[_0x459a('0x22')](_0x354b96[_0x459a('0x21')],function(_0x52e6d6){return{'model':db[_0x52e6d6[_0x459a('0x23')]],'as':_0x52e6d6['as'],'attributes':_0x52e6d6[_0x459a('0x20')],'include':_0x52e6d6[_0x459a('0x21')]?_[_0x459a('0x22')](_0x52e6d6[_0x459a('0x21')],function(_0x315448){return{'model':db[_0x315448['model']],'as':_0x315448['as'],'attributes':_0x315448[_0x459a('0x20')]};}):[]};}):[]};}):[]:[]})[_0x459a('0x24')](function(_0x22eafc){logger['info'](_0x459a('0x1c'),_0x466383);logger[_0x459a('0x13')](_0x459a('0x1c'),_0x466383,JSON[_0x459a('0x15')](_0x22eafc));_0x319f10(_0x22eafc);})[_0x459a('0x1b')](function(_0x3eb405){logger[_0x459a('0x16')](_0x459a('0x1c'),_0x3eb405['message'],_0x466383);_0x3ca49b(_0x28d2eb['error'](0x1f4,_0x3eb405[_0x459a('0x18')]));});});}; \ No newline at end of file +var _0x87a9=['info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model','map','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register'];(function(_0xf35443,_0x1b1e42){var _0x3eec75=function(_0x56003e){while(--_0x56003e){_0xf35443['push'](_0xf35443['shift']());}};_0x3eec75(++_0x1b1e42);}(_0x87a9,0x9c));var _0x987a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x87a9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x987a('0x0'));var BPromise=require(_0x987a('0x1'));var rs=require(_0x987a('0x2'));var fs=require('fs');var Redis=require(_0x987a('0x3'));var db=require(_0x987a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x987a('0x5'))('rpc');var config=require(_0x987a('0x6'));var jayson=require(_0x987a('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x987a('0x8')]=_[_0x987a('0x9')](config[_0x987a('0x8')],{'host':_0x987a('0xa'),'port':0x18eb});var socket=require(_0x987a('0xb'))(new Redis(config[_0x987a('0x8')]));require(_0x987a('0xc'))[_0x987a('0xd')](socket);function respondWithRpcPromise(_0x3e8f6f,_0x46d9e4,_0x4f72fc){return new BPromise(function(_0x330963,_0xee2191){return client['request'](_0x3e8f6f,_0x4f72fc)['then'](function(_0x9b320a){logger[_0x987a('0xe')]('SmsAccount,\x20%s,\x20%s',_0x46d9e4,'request\x20sent');logger[_0x987a('0xf')](_0x987a('0x10'),_0x46d9e4,_0x987a('0x11'),JSON[_0x987a('0x12')](_0x9b320a));if(_0x9b320a[_0x987a('0x13')]){if(_0x9b320a[_0x987a('0x13')]['code']===0x1f4){logger[_0x987a('0x13')](_0x987a('0x14'),_0x46d9e4,_0x9b320a[_0x987a('0x13')][_0x987a('0x15')]);return _0xee2191(_0x9b320a[_0x987a('0x13')][_0x987a('0x15')]);}logger[_0x987a('0x13')](_0x987a('0x14'),_0x46d9e4,_0x9b320a[_0x987a('0x13')][_0x987a('0x15')]);return _0x330963(_0x9b320a[_0x987a('0x13')][_0x987a('0x15')]);}else{logger[_0x987a('0xe')](_0x987a('0x14'),_0x46d9e4,_0x987a('0x11'));_0x330963(_0x9b320a[_0x987a('0x16')]['message']);}})[_0x987a('0x17')](function(_0x548d24){logger['error'](_0x987a('0x14'),_0x46d9e4,_0x548d24);_0xee2191(_0x548d24);});});}exports[_0x987a('0x18')]=function(_0x514769){var _0x34ecd0=this;return new Promise(function(_0x1feb09,_0x30be6e){return db[_0x987a('0x19')][_0x987a('0x1a')]({'raw':_0x514769[_0x987a('0x1b')]?_0x514769[_0x987a('0x1b')][_0x987a('0x1c')]===undefined?!![]:![]:!![],'where':_0x514769[_0x987a('0x1b')]?_0x514769['options'][_0x987a('0x1d')]||null:null,'attributes':_0x514769[_0x987a('0x1b')]?_0x514769[_0x987a('0x1b')][_0x987a('0x1e')]||null:null,'include':_0x514769[_0x987a('0x1b')]?_0x514769[_0x987a('0x1b')][_0x987a('0x1f')]?_['map'](_0x514769[_0x987a('0x1b')][_0x987a('0x1f')],function(_0xa3dd17){return{'model':db[_0xa3dd17[_0x987a('0x20')]],'as':_0xa3dd17['as'],'attributes':_0xa3dd17[_0x987a('0x1e')],'include':_0xa3dd17['include']?_[_0x987a('0x21')](_0xa3dd17[_0x987a('0x1f')],function(_0x390090){return{'model':db[_0x390090['model']],'as':_0x390090['as'],'attributes':_0x390090['attributes'],'include':_0x390090['include']?_[_0x987a('0x21')](_0x390090[_0x987a('0x1f')],function(_0x471fcf){return{'model':db[_0x471fcf[_0x987a('0x20')]],'as':_0x471fcf['as'],'attributes':_0x471fcf[_0x987a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x404e2e){logger[_0x987a('0xe')]('ShowSmsAccount',_0x514769);logger[_0x987a('0xf')](_0x987a('0x18'),_0x514769,JSON[_0x987a('0x12')](_0x404e2e));_0x1feb09(_0x404e2e);})['catch'](function(_0x4e22bc){logger[_0x987a('0x13')](_0x987a('0x18'),_0x4e22bc[_0x987a('0x15')],_0x514769);_0x30be6e(_0x34ecd0[_0x987a('0x13')](0x1f4,_0x4e22bc[_0x987a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index b4c0d8b..a5668d1 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index fa7195a..5840ea7 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4ae2d3,_0x562129){var _0x4ebca5=function(_0x15b803){while(--_0x15b803){_0x4ae2d3['push'](_0x4ae2d3['shift']());}};_0x4ebca5(++_0x562129);}(_0xedd9,0xfc));var _0x9edd=function(_0x57904d,_0x58e82f){_0x57904d=_0x57904d-0x0;var _0x105cfc=_0xedd9[_0x57904d];return _0x105cfc;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('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 588539d..1d8b152 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 _0x161d=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0x161d,0x1bb));var _0xd161=function(_0x4e483a,_0xe93962){_0x4e483a=_0x4e483a-0x0;var _0x3cd1b6=_0x161d[_0x4e483a];return _0x3cd1b6;};'use strict';var Sequelize=require(_0xd161('0x0'));module[_0xd161('0x1')]={'priority':{'type':Sequelize[_0xd161('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd161('0x3')],'allowNull':![],'defaultValue':_0xd161('0x4')},'appdata':{'type':Sequelize[_0xd161('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd161('0x3')],'defaultValue':_0xd161('0x6')}}; \ No newline at end of file +var _0x7cf1=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x7cf1,0x8d));var _0x17cf=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x7cf1[_0xd0b415];return _0x2bdf2c;};'use strict';var Sequelize=require(_0x17cf('0x0'));module[_0x17cf('0x1')]={'priority':{'type':Sequelize[_0x17cf('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x17cf('0x3')],'allowNull':![],'defaultValue':_0x17cf('0x4')},'appdata':{'type':Sequelize[_0x17cf('0x5')]()},'description':{'type':Sequelize[_0x17cf('0x3')]},'interval':{'type':Sequelize[_0x17cf('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index cc5837b..be2e3cc 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 _0x7579=['send','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','SmsApplication','findAll','rows','catch','show','rawAttributes','find','create','body','params','rimraf','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x7579,0xf9));var _0x9757=function(_0x4de221,_0x1c3214){_0x4de221=_0x4de221-0x0;var _0x46cd52=_0x7579[_0x4de221];return _0x46cd52;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9757('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9757('0x1'));var moment=require(_0x9757('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9757('0x3'));var path=require('path');var sox=require(_0x9757('0x4'));var csv=require(_0x9757('0x5'));var ejs=require(_0x9757('0x6'));var fs=require('fs');var fs_extra=require(_0x9757('0x7'));var _=require(_0x9757('0x8'));var squel=require(_0x9757('0x9'));var crypto=require(_0x9757('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9757('0xb'));var toCsv=require(_0x9757('0x5'));var querystring=require(_0x9757('0xc'));var Papa=require(_0x9757('0xd'));var Redis=require('ioredis');var authService=require(_0x9757('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9757('0xf'));var hardwareService=require(_0x9757('0x10'));var logger=require(_0x9757('0x11'))('api');var utils=require(_0x9757('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x9757('0x13'));var db=require(_0x9757('0x14'))['db'];function respondWithStatusCode(_0x11a178,_0x3c8287){_0x3c8287=_0x3c8287||0xcc;return function(_0x4f392c){if(_0x4f392c){return _0x11a178['sendStatus'](_0x3c8287);}return _0x11a178['status'](_0x3c8287)[_0x9757('0x15')]();};}function respondWithResult(_0x4a21b4,_0xf2f83c){_0xf2f83c=_0xf2f83c||0xc8;return function(_0x1fa3b3){if(_0x1fa3b3){return _0x4a21b4[_0x9757('0x16')](_0xf2f83c)['json'](_0x1fa3b3);}};}function respondWithFilteredResult(_0x578e9a,_0x1cb017){return function(_0x40cebd){if(_0x40cebd){var _0xce04c5=typeof _0x1cb017['offset']===_0x9757('0x17')&&typeof _0x1cb017[_0x9757('0x18')]===_0x9757('0x17');var _0x17046a=_0x40cebd[_0x9757('0x19')];var _0x39ff4f=_0xce04c5?0x0:_0x1cb017[_0x9757('0x1a')];var _0x46ca78=_0xce04c5?_0x40cebd[_0x9757('0x19')]:_0x1cb017[_0x9757('0x1a')]+_0x1cb017[_0x9757('0x18')];var _0x47ef35;if(_0x46ca78>=_0x17046a){_0x46ca78=_0x17046a;_0x47ef35=0xc8;}else{_0x47ef35=0xce;}_0x578e9a[_0x9757('0x16')](_0x47ef35);return _0x578e9a[_0x9757('0x1b')](_0x9757('0x1c'),_0x39ff4f+'-'+_0x46ca78+'/'+_0x17046a)[_0x9757('0x1d')](_0x40cebd);}return null;};}function patchUpdates(_0x57ec9a){return function(_0x555037){try{jsonpatch[_0x9757('0x1e')](_0x555037,_0x57ec9a,!![]);}catch(_0x32b04c){return BPromise[_0x9757('0x1f')](_0x32b04c);}return _0x555037[_0x9757('0x20')]();};}function saveUpdates(_0x191b95,_0x2332ff){return function(_0x1b1536){if(_0x1b1536){return _0x1b1536[_0x9757('0x21')](_0x191b95)['then'](function(_0x2b4add){return _0x2b4add;});}return null;};}function removeEntity(_0x370569,_0x337cde){return function(_0x105702){if(_0x105702){return _0x105702[_0x9757('0x22')]()[_0x9757('0x23')](function(){_0x370569[_0x9757('0x16')](0xcc)[_0x9757('0x15')]();});}};}function handleEntityNotFound(_0x58e6fe,_0x2f3a59){return function(_0x4d4242){if(!_0x4d4242){_0x58e6fe['sendStatus'](0x194);}return _0x4d4242;};}function handleError(_0x55654a,_0x16594d){_0x16594d=_0x16594d||0x1f4;return function(_0x568a08){logger[_0x9757('0x24')](_0x568a08[_0x9757('0x25')]);if(_0x568a08['name']){delete _0x568a08[_0x9757('0x26')];}_0x55654a[_0x9757('0x16')](_0x16594d)[_0x9757('0x27')](_0x568a08);};}exports[_0x9757('0x28')]=function(_0x39dd93,_0x3df2d2){var _0x221a3f={},_0x4387b9={},_0x5ae706={'count':0x0,'rows':[]};var _0x122bdd=_[_0x9757('0x29')](db['SmsApplication']['rawAttributes'],function(_0x16bbc8){return{'name':_0x16bbc8[_0x9757('0x2a')],'type':_0x16bbc8[_0x9757('0x2b')]['key']};});_0x4387b9['model']=_[_0x9757('0x29')](_0x122bdd,_0x9757('0x26'));_0x4387b9[_0x9757('0x2c')]=_[_0x9757('0x2d')](_0x39dd93[_0x9757('0x2c')]);_0x4387b9[_0x9757('0x2e')]=_[_0x9757('0x2f')](_0x4387b9[_0x9757('0x30')],_0x4387b9[_0x9757('0x2c')]);_0x221a3f[_0x9757('0x31')]=_[_0x9757('0x2f')](_0x4387b9['model'],qs[_0x9757('0x32')](_0x39dd93['query'][_0x9757('0x32')]));_0x221a3f[_0x9757('0x31')]=_0x221a3f['attributes']['length']?_0x221a3f[_0x9757('0x31')]:_0x4387b9[_0x9757('0x30')];if(!_0x39dd93[_0x9757('0x2c')][_0x9757('0x33')](_0x9757('0x34'))){_0x221a3f['limit']=qs[_0x9757('0x18')](_0x39dd93[_0x9757('0x2c')][_0x9757('0x18')]);_0x221a3f[_0x9757('0x1a')]=qs['offset'](_0x39dd93[_0x9757('0x2c')][_0x9757('0x1a')]);}_0x221a3f[_0x9757('0x35')]=qs['sort'](_0x39dd93[_0x9757('0x2c')][_0x9757('0x36')]);_0x221a3f[_0x9757('0x37')]=qs['filters'](_['pick'](_0x39dd93[_0x9757('0x2c')],_0x4387b9['filters']),_0x122bdd);if(_0x39dd93[_0x9757('0x2c')][_0x9757('0x38')]){_0x221a3f['where']=_[_0x9757('0x39')](_0x221a3f[_0x9757('0x37')],{'$or':_[_0x9757('0x29')](_0x122bdd,function(_0x1d0e79){if(_0x1d0e79['type']!==_0x9757('0x3a')){var _0x8a1d2b={};_0x8a1d2b[_0x1d0e79[_0x9757('0x26')]]={'$like':'%'+_0x39dd93['query'][_0x9757('0x38')]+'%'};return _0x8a1d2b;}})});}_0x221a3f=_[_0x9757('0x39')]({},_0x221a3f,_0x39dd93[_0x9757('0x3b')]);var _0x464c03={'where':_0x221a3f['where']};return db['SmsApplication'][_0x9757('0x19')](_0x464c03)[_0x9757('0x23')](function(_0x3e4161){_0x5ae706[_0x9757('0x19')]=_0x3e4161;if(_0x39dd93['query'][_0x9757('0x3c')]){_0x221a3f[_0x9757('0x3d')]=[{'all':!![]}];}return db[_0x9757('0x3e')][_0x9757('0x3f')](_0x221a3f);})[_0x9757('0x23')](function(_0x42feb9){_0x5ae706[_0x9757('0x40')]=_0x42feb9;return _0x5ae706;})['then'](respondWithFilteredResult(_0x3df2d2,_0x221a3f))[_0x9757('0x41')](handleError(_0x3df2d2,null));};exports[_0x9757('0x42')]=function(_0x280a2c,_0x26310a){var _0x3c5a19={'raw':!![],'where':{'id':_0x280a2c['params']['id']}},_0x2a230b={};_0x2a230b['model']=_['keys'](db[_0x9757('0x3e')][_0x9757('0x43')]);_0x2a230b[_0x9757('0x2c')]=_[_0x9757('0x2d')](_0x280a2c[_0x9757('0x2c')]);_0x2a230b['filters']=_['intersection'](_0x2a230b[_0x9757('0x30')],_0x2a230b[_0x9757('0x2c')]);_0x3c5a19[_0x9757('0x31')]=_[_0x9757('0x2f')](_0x2a230b[_0x9757('0x30')],qs['fields'](_0x280a2c[_0x9757('0x2c')]['fields']));_0x3c5a19[_0x9757('0x31')]=_0x3c5a19['attributes']['length']?_0x3c5a19[_0x9757('0x31')]:_0x2a230b[_0x9757('0x30')];if(_0x280a2c[_0x9757('0x2c')][_0x9757('0x3c')]){_0x3c5a19[_0x9757('0x3d')]=[{'all':!![]}];}_0x3c5a19=_['merge']({},_0x3c5a19,_0x280a2c[_0x9757('0x3b')]);return db[_0x9757('0x3e')][_0x9757('0x44')](_0x3c5a19)[_0x9757('0x23')](handleEntityNotFound(_0x26310a,null))['then'](respondWithResult(_0x26310a,null))[_0x9757('0x41')](handleError(_0x26310a,null));};exports[_0x9757('0x45')]=function(_0x2942b5,_0x169189){return db[_0x9757('0x3e')][_0x9757('0x45')](_0x2942b5['body'],{})[_0x9757('0x23')](respondWithResult(_0x169189,0xc9))['catch'](handleError(_0x169189,null));};exports[_0x9757('0x21')]=function(_0x49f810,_0x291502){if(_0x49f810[_0x9757('0x46')]['id']){delete _0x49f810[_0x9757('0x46')]['id'];}return db[_0x9757('0x3e')][_0x9757('0x44')]({'where':{'id':_0x49f810[_0x9757('0x47')]['id']}})['then'](handleEntityNotFound(_0x291502,null))['then'](saveUpdates(_0x49f810[_0x9757('0x46')],null))[_0x9757('0x23')](respondWithResult(_0x291502,null))['catch'](handleError(_0x291502,null));};exports[_0x9757('0x22')]=function(_0x59dec6,_0x1b7469){return db[_0x9757('0x3e')]['find']({'where':{'id':_0x59dec6[_0x9757('0x47')]['id']}})[_0x9757('0x23')](handleEntityNotFound(_0x1b7469,null))[_0x9757('0x23')](removeEntity(_0x1b7469,null))[_0x9757('0x41')](handleError(_0x1b7469,null));}; \ No newline at end of file +var _0x3b9f=['end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','map','SmsApplication','rawAttributes','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','intersection','fields','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3b9f,0xca));var _0xf3b9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3b9f[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf3b9('0x0'));var jsonpatch=require(_0xf3b9('0x1'));var rp=require(_0xf3b9('0x2'));var moment=require(_0xf3b9('0x3'));var BPromise=require(_0xf3b9('0x4'));var Mustache=require(_0xf3b9('0x5'));var util=require('util');var path=require(_0xf3b9('0x6'));var sox=require(_0xf3b9('0x7'));var csv=require(_0xf3b9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf3b9('0x9'));var _=require(_0xf3b9('0xa'));var squel=require(_0xf3b9('0xb'));var crypto=require(_0xf3b9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf3b9('0xd'));var toCsv=require(_0xf3b9('0x8'));var querystring=require(_0xf3b9('0xe'));var Papa=require(_0xf3b9('0xf'));var Redis=require(_0xf3b9('0x10'));var authService=require(_0xf3b9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf3b9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3b9('0x13'))(_0xf3b9('0x14'));var utils=require(_0xf3b9('0x15'));var config=require(_0xf3b9('0x16'));var licenseUtil=require(_0xf3b9('0x17'));var db=require(_0xf3b9('0x18'))['db'];function respondWithStatusCode(_0x463f18,_0xbc5934){_0xbc5934=_0xbc5934||0xcc;return function(_0x561b24){if(_0x561b24){return _0x463f18[_0xf3b9('0x19')](_0xbc5934);}return _0x463f18['status'](_0xbc5934)[_0xf3b9('0x1a')]();};}function respondWithResult(_0x2f2267,_0x552cf0){_0x552cf0=_0x552cf0||0xc8;return function(_0x3b2c8d){if(_0x3b2c8d){return _0x2f2267[_0xf3b9('0x1b')](_0x552cf0)['json'](_0x3b2c8d);}};}function respondWithFilteredResult(_0x124eb6,_0x1bb3aa){return function(_0x482f5a){if(_0x482f5a){var _0x42ee58=typeof _0x1bb3aa[_0xf3b9('0x1c')]===_0xf3b9('0x1d')&&typeof _0x1bb3aa[_0xf3b9('0x1e')]===_0xf3b9('0x1d');var _0x26a0f2=_0x482f5a[_0xf3b9('0x1f')];var _0x595890=_0x42ee58?0x0:_0x1bb3aa[_0xf3b9('0x1c')];var _0x36cc7e=_0x42ee58?_0x482f5a[_0xf3b9('0x1f')]:_0x1bb3aa[_0xf3b9('0x1c')]+_0x1bb3aa[_0xf3b9('0x1e')];var _0x23d4b3;if(_0x36cc7e>=_0x26a0f2){_0x36cc7e=_0x26a0f2;_0x23d4b3=0xc8;}else{_0x23d4b3=0xce;}_0x124eb6[_0xf3b9('0x1b')](_0x23d4b3);return _0x124eb6[_0xf3b9('0x20')](_0xf3b9('0x21'),_0x595890+'-'+_0x36cc7e+'/'+_0x26a0f2)[_0xf3b9('0x22')](_0x482f5a);}return null;};}function patchUpdates(_0x311aae){return function(_0x1cf0c4){try{jsonpatch[_0xf3b9('0x23')](_0x1cf0c4,_0x311aae,!![]);}catch(_0x47c95a){return BPromise[_0xf3b9('0x24')](_0x47c95a);}return _0x1cf0c4[_0xf3b9('0x25')]();};}function saveUpdates(_0x242293,_0x235154){return function(_0x325fc2){if(_0x325fc2){return _0x325fc2[_0xf3b9('0x26')](_0x242293)['then'](function(_0x57e68b){return _0x57e68b;});}return null;};}function removeEntity(_0xbd55f2,_0x36924e){return function(_0xa43845){if(_0xa43845){return _0xa43845[_0xf3b9('0x27')]()[_0xf3b9('0x28')](function(){_0xbd55f2[_0xf3b9('0x1b')](0xcc)[_0xf3b9('0x1a')]();});}};}function handleEntityNotFound(_0x3caa9d,_0x24b368){return function(_0x150639){if(!_0x150639){_0x3caa9d[_0xf3b9('0x19')](0x194);}return _0x150639;};}function handleError(_0x1a87ff,_0x29ce13){_0x29ce13=_0x29ce13||0x1f4;return function(_0x14a1ab){logger[_0xf3b9('0x29')](_0x14a1ab[_0xf3b9('0x2a')]);if(_0x14a1ab['name']){delete _0x14a1ab[_0xf3b9('0x2b')];}_0x1a87ff[_0xf3b9('0x1b')](_0x29ce13)[_0xf3b9('0x2c')](_0x14a1ab);};}exports['index']=function(_0x25325c,_0x16b29a){var _0x1f9125={},_0x104b9d={},_0x5d60a6={'count':0x0,'rows':[]};var _0x1093d8=_[_0xf3b9('0x2d')](db[_0xf3b9('0x2e')][_0xf3b9('0x2f')],function(_0x123c74){return{'name':_0x123c74['fieldName'],'type':_0x123c74[_0xf3b9('0x30')][_0xf3b9('0x31')]};});_0x104b9d[_0xf3b9('0x32')]=_[_0xf3b9('0x2d')](_0x1093d8,_0xf3b9('0x2b'));_0x104b9d[_0xf3b9('0x33')]=_[_0xf3b9('0x34')](_0x25325c['query']);_0x104b9d[_0xf3b9('0x35')]=_['intersection'](_0x104b9d[_0xf3b9('0x32')],_0x104b9d['query']);_0x1f9125[_0xf3b9('0x36')]=_['intersection'](_0x104b9d[_0xf3b9('0x32')],qs['fields'](_0x25325c[_0xf3b9('0x33')]['fields']));_0x1f9125['attributes']=_0x1f9125['attributes'][_0xf3b9('0x37')]?_0x1f9125[_0xf3b9('0x36')]:_0x104b9d[_0xf3b9('0x32')];if(!_0x25325c[_0xf3b9('0x33')][_0xf3b9('0x38')](_0xf3b9('0x39'))){_0x1f9125[_0xf3b9('0x1e')]=qs['limit'](_0x25325c[_0xf3b9('0x33')][_0xf3b9('0x1e')]);_0x1f9125[_0xf3b9('0x1c')]=qs[_0xf3b9('0x1c')](_0x25325c['query']['offset']);}_0x1f9125[_0xf3b9('0x3a')]=qs[_0xf3b9('0x3b')](_0x25325c[_0xf3b9('0x33')][_0xf3b9('0x3b')]);_0x1f9125[_0xf3b9('0x3c')]=qs[_0xf3b9('0x35')](_[_0xf3b9('0x3d')](_0x25325c[_0xf3b9('0x33')],_0x104b9d[_0xf3b9('0x35')]),_0x1093d8);if(_0x25325c[_0xf3b9('0x33')][_0xf3b9('0x3e')]){_0x1f9125[_0xf3b9('0x3c')]=_[_0xf3b9('0x3f')](_0x1f9125[_0xf3b9('0x3c')],{'$or':_['map'](_0x1093d8,function(_0x2b7612){if(_0x2b7612['type']!=='VIRTUAL'){var _0x36ba67={};_0x36ba67[_0x2b7612['name']]={'$like':'%'+_0x25325c[_0xf3b9('0x33')]['filter']+'%'};return _0x36ba67;}})});}_0x1f9125=_[_0xf3b9('0x3f')]({},_0x1f9125,_0x25325c[_0xf3b9('0x40')]);var _0x455756={'where':_0x1f9125['where']};return db[_0xf3b9('0x2e')]['count'](_0x455756)[_0xf3b9('0x28')](function(_0x3b6886){_0x5d60a6[_0xf3b9('0x1f')]=_0x3b6886;if(_0x25325c[_0xf3b9('0x33')][_0xf3b9('0x41')]){_0x1f9125[_0xf3b9('0x42')]=[{'all':!![]}];}return db[_0xf3b9('0x2e')][_0xf3b9('0x43')](_0x1f9125);})[_0xf3b9('0x28')](function(_0x5f25f2){_0x5d60a6['rows']=_0x5f25f2;return _0x5d60a6;})['then'](respondWithFilteredResult(_0x16b29a,_0x1f9125))[_0xf3b9('0x44')](handleError(_0x16b29a,null));};exports[_0xf3b9('0x45')]=function(_0x14bfe4,_0xd61143){var _0x2ac929={'raw':!![],'where':{'id':_0x14bfe4[_0xf3b9('0x46')]['id']}},_0x14be30={};_0x14be30[_0xf3b9('0x32')]=_[_0xf3b9('0x34')](db[_0xf3b9('0x2e')]['rawAttributes']);_0x14be30[_0xf3b9('0x33')]=_[_0xf3b9('0x34')](_0x14bfe4[_0xf3b9('0x33')]);_0x14be30[_0xf3b9('0x35')]=_[_0xf3b9('0x47')](_0x14be30[_0xf3b9('0x32')],_0x14be30[_0xf3b9('0x33')]);_0x2ac929[_0xf3b9('0x36')]=_['intersection'](_0x14be30[_0xf3b9('0x32')],qs[_0xf3b9('0x48')](_0x14bfe4[_0xf3b9('0x33')][_0xf3b9('0x48')]));_0x2ac929[_0xf3b9('0x36')]=_0x2ac929[_0xf3b9('0x36')][_0xf3b9('0x37')]?_0x2ac929[_0xf3b9('0x36')]:_0x14be30['model'];if(_0x14bfe4[_0xf3b9('0x33')][_0xf3b9('0x41')]){_0x2ac929['include']=[{'all':!![]}];}_0x2ac929=_['merge']({},_0x2ac929,_0x14bfe4[_0xf3b9('0x40')]);return db['SmsApplication'][_0xf3b9('0x49')](_0x2ac929)['then'](handleEntityNotFound(_0xd61143,null))[_0xf3b9('0x28')](respondWithResult(_0xd61143,null))[_0xf3b9('0x44')](handleError(_0xd61143,null));};exports['create']=function(_0x4c86f5,_0x57d7cc){return db[_0xf3b9('0x2e')][_0xf3b9('0x4a')](_0x4c86f5[_0xf3b9('0x4b')],{})[_0xf3b9('0x28')](respondWithResult(_0x57d7cc,0xc9))[_0xf3b9('0x44')](handleError(_0x57d7cc,null));};exports[_0xf3b9('0x26')]=function(_0x4c84d5,_0x1b5763){if(_0x4c84d5['body']['id']){delete _0x4c84d5[_0xf3b9('0x4b')]['id'];}return db[_0xf3b9('0x2e')][_0xf3b9('0x49')]({'where':{'id':_0x4c84d5[_0xf3b9('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b5763,null))[_0xf3b9('0x28')](saveUpdates(_0x4c84d5[_0xf3b9('0x4b')],null))[_0xf3b9('0x28')](respondWithResult(_0x1b5763,null))[_0xf3b9('0x44')](handleError(_0x1b5763,null));};exports['destroy']=function(_0x1ed772,_0x22fc4d){return db[_0xf3b9('0x2e')]['find']({'where':{'id':_0x1ed772[_0xf3b9('0x46')]['id']}})[_0xf3b9('0x28')](handleEntityNotFound(_0x22fc4d,null))[_0xf3b9('0x28')](removeEntity(_0x22fc4d,null))[_0xf3b9('0x44')](handleError(_0x22fc4d,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index fe2fe91..7a34b22 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 _0xdc9f=['exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x4c73f3,_0x503082){var _0x3716ca=function(_0x26b215){while(--_0x26b215){_0x4c73f3['push'](_0x4c73f3['shift']());}};_0x3716ca(++_0x503082);}(_0xdc9f,0x8d));var _0xfdc9=function(_0x15a0b0,_0x211684){_0x15a0b0=_0x15a0b0-0x0;var _0x579e78=_0xdc9f[_0x15a0b0];return _0x579e78;};'use strict';var _=require(_0xfdc9('0x0'));var util=require('util');var logger=require(_0xfdc9('0x1'))(_0xfdc9('0x2'));var moment=require(_0xfdc9('0x3'));var BPromise=require(_0xfdc9('0x4'));var rp=require(_0xfdc9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfdc9('0x6'));var config=require(_0xfdc9('0x7'));var attributes=require(_0xfdc9('0x8'));module[_0xfdc9('0x9')]=function(_0x490bdf,_0x322b9c){return _0x490bdf[_0xfdc9('0xa')](_0xfdc9('0xb'),attributes,{'tableName':_0xfdc9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfdc9('0xd'),'collate':_0xfdc9('0xe')});}; \ No newline at end of file +var _0x4491=['path','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x45bc3f,_0x234416){var _0x530329=function(_0x4c2442){while(--_0x4c2442){_0x45bc3f['push'](_0x45bc3f['shift']());}};_0x530329(++_0x234416);}(_0x4491,0x1bb));var _0x1449=function(_0x3ba958,_0x11bb61){_0x3ba958=_0x3ba958-0x0;var _0x481d70=_0x4491[_0x3ba958];return _0x481d70;};'use strict';var _=require(_0x1449('0x0'));var util=require('util');var logger=require(_0x1449('0x1'))('api');var moment=require(_0x1449('0x2'));var BPromise=require(_0x1449('0x3'));var rp=require(_0x1449('0x4'));var fs=require('fs');var path=require(_0x1449('0x5'));var rimraf=require(_0x1449('0x6'));var config=require(_0x1449('0x7'));var attributes=require('./smsApplication.attributes');module[_0x1449('0x8')]=function(_0x557482,_0x1d45eb){return _0x557482[_0x1449('0x9')](_0x1449('0xa'),attributes,{'tableName':_0x1449('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1449('0xc'),'collate':_0x1449('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 7aece91..442b1e8 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 _0x3266=['../../config/environment','client','http','request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x3266,0x6a));var _0x6326=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0x3266[_0x3b5049];return _0x12454e;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var moment=require(_0x6326('0x2'));var BPromise=require(_0x6326('0x3'));var rs=require(_0x6326('0x4'));var fs=require('fs');var Redis=require(_0x6326('0x5'));var db=require(_0x6326('0x6'))['db'];var utils=require(_0x6326('0x7'));var logger=require(_0x6326('0x8'))('rpc');var config=require(_0x6326('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6326('0xa')][_0x6326('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14208e,_0x5402e5,_0x161f4e){return new BPromise(function(_0x5730e7,_0x2af571){return client[_0x6326('0xc')](_0x14208e,_0x161f4e)[_0x6326('0xd')](function(_0x1aee60){logger[_0x6326('0xe')]('SmsApplication,\x20%s,\x20%s',_0x5402e5,_0x6326('0xf'));logger[_0x6326('0x10')](_0x6326('0x11'),_0x5402e5,_0x6326('0xf'),JSON[_0x6326('0x12')](_0x1aee60));if(_0x1aee60[_0x6326('0x13')]){if(_0x1aee60[_0x6326('0x13')][_0x6326('0x14')]===0x1f4){logger[_0x6326('0x13')](_0x6326('0x15'),_0x5402e5,_0x1aee60['error']['message']);return _0x2af571(_0x1aee60[_0x6326('0x13')][_0x6326('0x16')]);}logger['error'](_0x6326('0x15'),_0x5402e5,_0x1aee60['error'][_0x6326('0x16')]);return _0x5730e7(_0x1aee60[_0x6326('0x13')][_0x6326('0x16')]);}else{logger[_0x6326('0xe')](_0x6326('0x15'),_0x5402e5,_0x6326('0xf'));_0x5730e7(_0x1aee60['result'][_0x6326('0x16')]);}})['catch'](function(_0x5945ee){logger['error']('SmsApplication,\x20%s,\x20%s',_0x5402e5,_0x5945ee);_0x2af571(_0x5945ee);});});} \ No newline at end of file +var _0x0b7f=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','SmsApplication,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','bluebird'];(function(_0x4c6763,_0x3c4c95){var _0x5147a=function(_0x5c79ac){while(--_0x5c79ac){_0x4c6763['push'](_0x4c6763['shift']());}};_0x5147a(++_0x3c4c95);}(_0x0b7f,0x115));var _0xf0b7=function(_0x200dcf,_0x280d3b){_0x200dcf=_0x200dcf-0x0;var _0x4523cd=_0x0b7f[_0x200dcf];return _0x4523cd;};'use strict';var _=require(_0xf0b7('0x0'));var util=require(_0xf0b7('0x1'));var moment=require('moment');var BPromise=require(_0xf0b7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0b7('0x3'));var db=require(_0xf0b7('0x4'))['db'];var utils=require(_0xf0b7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0b7('0x6'));var jayson=require(_0xf0b7('0x7'));var client=jayson[_0xf0b7('0x8')][_0xf0b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b2de8,_0x5e449a,_0x1408ee){return new BPromise(function(_0x276f09,_0x275a13){return client[_0xf0b7('0xa')](_0x2b2de8,_0x1408ee)[_0xf0b7('0xb')](function(_0x588b46){logger[_0xf0b7('0xc')]('SmsApplication,\x20%s,\x20%s',_0x5e449a,'request\x20sent');logger['debug'](_0xf0b7('0xd'),_0x5e449a,'request\x20sent',JSON['stringify'](_0x588b46));if(_0x588b46[_0xf0b7('0xe')]){if(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0xf')]===0x1f4){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x275a13(_0x588b46[_0xf0b7('0xe')]['message']);}logger['error'](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x276f09(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);}else{logger['info'](_0xf0b7('0x10'),_0x5e449a,_0xf0b7('0x12'));_0x276f09(_0x588b46[_0xf0b7('0x13')][_0xf0b7('0x11')]);}})['catch'](function(_0x303db6){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x303db6);_0x275a13(_0x303db6);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 557905b..890b89a 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 _0x4024=['addTags','put','smsinteraction:update','update','delete','destroy','removeTags','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x4024,0x89));var _0x4402=function(_0x32bf37,_0x391c37){_0x32bf37=_0x32bf37-0x0;var _0x5e6056=_0x4024[_0x32bf37];return _0x5e6056;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./smsInteraction.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/describe',auth[_0x4402('0x7')](),controller['describe']);router['get'](_0x4402('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x4402('0x9')]('/:id/messages',auth[_0x4402('0x7')](),controller['getMessages']);router[_0x4402('0x9')]('/:id/download',auth[_0x4402('0x7')](),controller[_0x4402('0xb')]);router['post']('/',auth[_0x4402('0x7')](),controller[_0x4402('0xc')]);router[_0x4402('0xd')]('/:id/messages',auth[_0x4402('0x7')](),controller[_0x4402('0xe')]);router[_0x4402('0xd')](_0x4402('0xf'),auth[_0x4402('0x7')](),interaction[_0x4402('0x10')](_0x4402('0x11'),_0x4402('0x12')),controller[_0x4402('0x13')]);router[_0x4402('0x14')](_0x4402('0xa'),auth[_0x4402('0x7')](),interaction[_0x4402('0x10')](_0x4402('0x11'),_0x4402('0x15')),controller[_0x4402('0x16')]);router[_0x4402('0x17')](_0x4402('0xa'),auth[_0x4402('0x7')](),interaction[_0x4402('0x10')]('sms','smsinteraction:destroy'),controller[_0x4402('0x18')]);router[_0x4402('0x17')]('/:id/tags',auth[_0x4402('0x7')](),controller[_0x4402('0x19')]);module['exports']=router; \ No newline at end of file +var _0x1775=['/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var fs_extra=require(_0x5177('0x5'));var auth=require(_0x5177('0x6'));var interaction=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var controller=require(_0x5177('0x9'));router[_0x5177('0xa')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0xc')]);router[_0x5177('0xa')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0xe')]);router[_0x5177('0xa')](_0x5177('0xf'),auth[_0x5177('0xb')](),controller[_0x5177('0x10')]);router[_0x5177('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0x5177('0x11')]);router[_0x5177('0xa')](_0x5177('0x12'),auth[_0x5177('0xb')](),controller[_0x5177('0x13')]);router['post']('/',auth[_0x5177('0xb')](),controller[_0x5177('0x14')]);router[_0x5177('0x15')](_0x5177('0x16'),auth[_0x5177('0xb')](),controller[_0x5177('0x17')]);router[_0x5177('0x15')](_0x5177('0x18'),auth[_0x5177('0xb')](),interaction[_0x5177('0x19')](_0x5177('0x1a'),_0x5177('0x1b')),controller[_0x5177('0x1c')]);router[_0x5177('0x1d')](_0x5177('0xf'),auth[_0x5177('0xb')](),interaction[_0x5177('0x19')](_0x5177('0x1a'),_0x5177('0x1e')),controller['update']);router[_0x5177('0x1f')](_0x5177('0xf'),auth[_0x5177('0xb')](),interaction[_0x5177('0x19')]('sms',_0x5177('0x20')),controller[_0x5177('0x21')]);router[_0x5177('0x1f')]('/:id/tags',auth[_0x5177('0xb')](),controller['removeTags']);module[_0x5177('0x22')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 81a02de..a9dc825 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 _0xe574=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe574,0x100));var _0x4e57=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe574[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x4e57('0x0'));var moment=require('moment');module[_0x4e57('0x1')]={'closed':{'type':Sequelize[_0x4e57('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4e57('0x3')]},'disposition':{'type':Sequelize[_0x4e57('0x4')]},'secondDisposition':{'type':Sequelize[_0x4e57('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4e57('0x4')]},'note':{'type':Sequelize[_0x4e57('0x4')]},'phone':{'type':Sequelize[_0x4e57('0x4')]},'read1stAt':{'type':Sequelize[_0x4e57('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4e57('0x5')]('in',_0x4e57('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4e57('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4e57('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x7da7=['ENUM','out','BOOLEAN','sequelize','moment','exports','STRING'];(function(_0xc9a386,_0x431e08){var _0x16fd5b=function(_0x289217){while(--_0x289217){_0xc9a386['push'](_0xc9a386['shift']());}};_0x16fd5b(++_0x431e08);}(_0x7da7,0x10d));var _0x77da=function(_0x121886,_0x8cd8e5){_0x121886=_0x121886-0x0;var _0x20ca01=_0x7da7[_0x121886];return _0x20ca01;};'use strict';var Sequelize=require(_0x77da('0x0'));var moment=require(_0x77da('0x1'));module[_0x77da('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x77da('0x3')]},'secondDisposition':{'type':Sequelize[_0x77da('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x77da('0x3')]},'phone':{'type':Sequelize[_0x77da('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x77da('0x4')]('in',_0x77da('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x77da('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x77da('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 102b151..8f6a50c 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 _0x9632=['../../config/environment','../../config/license/util','redis','localhost','./smsInteraction.socket','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','end','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','index','SmsInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','length','find','value','having','`\x20=\x200','Contact','operator','$substring','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','body','some','compact','isEmpty','i.SmsAccountId\x20IN\x20?','concat','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','SmsInteractionId','rows','catch','show','params','includeAll','include','options','create','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','hasOwnProperty','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','emit','smsInteractionTags:save','removeTags','download','join','files','tmp','root','attachments','User','CmContact','firstName','direction','secret','SmsAccount','Owner','mkdirSync','Account','N.A.','createdAt','closed','closedAt','disposition','Messages','out','System','lastName','renderFile','server','views','downloadInteraction.ejs','transcript-','Sms','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api'];(function(_0x12d678,_0x448c7d){var _0x20f278=function(_0x10d51a){while(--_0x10d51a){_0x12d678['push'](_0x12d678['shift']());}};_0x20f278(++_0x448c7d);}(_0x9632,0x1b6));var _0x2963=function(_0x707427,_0x474925){_0x707427=_0x707427-0x0;var _0x9d9a79=_0x9632[_0x707427];return _0x9d9a79;};'use strict';var emlformat=require(_0x2963('0x0'));var rimraf=require(_0x2963('0x1'));var zipdir=require(_0x2963('0x2'));var jsonpatch=require(_0x2963('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2963('0x4'));var Mustache=require(_0x2963('0x5'));var util=require(_0x2963('0x6'));var path=require(_0x2963('0x7'));var sox=require(_0x2963('0x8'));var csv=require('to-csv');var ejs=require(_0x2963('0x9'));var fs=require('fs');var fs_extra=require(_0x2963('0xa'));var _=require(_0x2963('0xb'));var squel=require(_0x2963('0xc'));var crypto=require(_0x2963('0xd'));var jsforce=require(_0x2963('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2963('0xf'));var querystring=require(_0x2963('0x10'));var Papa=require('papaparse');var Redis=require(_0x2963('0x11'));var authService=require(_0x2963('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2963('0x13'));var pdf=require(_0x2963('0x14'));var hardwareService=require(_0x2963('0x15'));var logger=require(_0x2963('0x16'))(_0x2963('0x17'));var utils=require('../../config/utils');var config=require(_0x2963('0x18'));var licenseUtil=require(_0x2963('0x19'));var db=require('../../mysqldb')['db'];config[_0x2963('0x1a')]=_['defaults'](config[_0x2963('0x1a')],{'host':_0x2963('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2963('0x1a')]));require(_0x2963('0x1c'))['register'](socket);function respondWithStatusCode(_0x5e39f3,_0x2812d5){_0x2812d5=_0x2812d5||0xcc;return function(_0x50d717){if(_0x50d717){return _0x5e39f3['sendStatus'](_0x2812d5);}return _0x5e39f3[_0x2963('0x1d')](_0x2812d5)['end']();};}function respondWithResult(_0x25fbfe,_0x52ba14){_0x52ba14=_0x52ba14||0xc8;return function(_0x41f0d7){if(_0x41f0d7){return _0x25fbfe[_0x2963('0x1d')](_0x52ba14)[_0x2963('0x1e')](_0x41f0d7);}};}function respondWithFilteredResult(_0x1c55bb,_0x589dee){return function(_0x8cb36f){if(_0x8cb36f){var _0x473593=typeof _0x589dee[_0x2963('0x1f')]===_0x2963('0x20')&&typeof _0x589dee['limit']===_0x2963('0x20');var _0x311c90=_0x8cb36f[_0x2963('0x21')];var _0x1cd051=_0x473593?0x0:_0x589dee[_0x2963('0x1f')];var _0x287da8=_0x473593?_0x8cb36f['count']:_0x589dee[_0x2963('0x1f')]+_0x589dee[_0x2963('0x22')];var _0x242994;if(_0x287da8>=_0x311c90){_0x287da8=_0x311c90;_0x242994=0xc8;}else{_0x242994=0xce;}_0x1c55bb[_0x2963('0x1d')](_0x242994);return _0x1c55bb[_0x2963('0x23')](_0x2963('0x24'),_0x1cd051+'-'+_0x287da8+'/'+_0x311c90)[_0x2963('0x1e')](_0x8cb36f);}return null;};}function patchUpdates(_0x17eeff){return function(_0x6706c){try{jsonpatch['apply'](_0x6706c,_0x17eeff,!![]);}catch(_0x38db7a){return BPromise[_0x2963('0x25')](_0x38db7a);}return _0x6706c['save']();};}function saveUpdates(_0x57e9b5,_0x20a332){return function(_0x1ba4dc){if(_0x1ba4dc){return _0x1ba4dc[_0x2963('0x26')](_0x57e9b5)[_0x2963('0x27')](function(_0x5c23dc){return _0x5c23dc;});}return null;};}function removeEntity(_0x20f5f7,_0x2bbd39){return function(_0x5edd4f){if(_0x5edd4f){return _0x5edd4f[_0x2963('0x28')]()['then'](function(){_0x20f5f7[_0x2963('0x1d')](0xcc)[_0x2963('0x29')]();});}};}function handleEntityNotFound(_0x3ba210,_0x198987){return function(_0x3300f6){if(!_0x3300f6){_0x3ba210[_0x2963('0x2a')](0x194);}return _0x3300f6;};}function handleError(_0x30ad5b,_0x4e9444){_0x4e9444=_0x4e9444||0x1f4;return function(_0x571572){logger[_0x2963('0x2b')](_0x571572[_0x2963('0x2c')]);if(_0x571572['name']){delete _0x571572[_0x2963('0x2d')];}_0x30ad5b['status'](_0x4e9444)[_0x2963('0x2e')](_0x571572);};}function getInteractionUsers(_0x1e034b,_0x10f519){return new BPromise(function(_0x38e4d5,_0xa5cb3c){try{if(_0x10f519[_0x1e034b['id']]){_0x1e034b[_0x2963('0x2f')]=_[_0x2963('0x30')](_0x10f519[_0x1e034b['id']],function(_0xe29f7c){return{'id':_0xe29f7c['id'],'fullname':_0xe29f7c[_0x2963('0x31')]};});}}catch(_0x253e5d){_0xa5cb3c(_0x253e5d);}_0x38e4d5(_0x1e034b);});}function getInteractionTags(_0x46ef04,_0x7a49d2){return new BPromise(function(_0x1e6117,_0x2ab340){try{if(_0x46ef04[_0x2963('0x32')]){_0x46ef04[_0x2963('0x33')]=[];_0x46ef04[_0x2963('0x32')]['split'](',')[_0x2963('0x34')](function(_0x3c23d4){_0x46ef04[_0x2963('0x33')][_0x2963('0x35')](_0x7a49d2[_0x3c23d4]);});}delete _0x46ef04[_0x2963('0x32')];}catch(_0x80e678){_0x2ab340(_0x80e678);}_0x1e6117(_0x46ef04);});}function updateSmsInteraction(_0x2b5393,_0x4ccd21,_0x7d2e09){return new BPromise(function(_0x27ad60,_0x513ac5){return getInteractionUsers(_0x2b5393,_0x7d2e09)[_0x2963('0x27')](function(_0x34739b){return getInteractionTags(_0x34739b,_0x4ccd21);})[_0x2963('0x27')](function(_0x54d91f){_0x27ad60(_0x54d91f);})['catch'](function(_0x467d42){_0x513ac5(_0x467d42);});});}exports[_0x2963('0x36')]=function(_0x5a32b2,_0x49907e){var _0x39295b={},_0xd1b418={},_0x432e2f={'count':0x0,'rows':[]};var _0x516420=_[_0x2963('0x30')](db[_0x2963('0x37')][_0x2963('0x38')],function(_0x40b1bd){return{'name':_0x40b1bd['fieldName'],'type':_0x40b1bd[_0x2963('0x39')][_0x2963('0x3a')]};});_0xd1b418[_0x2963('0x3b')]=_[_0x2963('0x30')](_0x516420,_0x2963('0x2d'));_0xd1b418[_0x2963('0x3c')]=_[_0x2963('0x3d')](_0x5a32b2[_0x2963('0x3c')]);_0xd1b418[_0x2963('0x3e')]=_[_0x2963('0x3f')](_0xd1b418[_0x2963('0x3b')],_0xd1b418[_0x2963('0x3c')]);_0x39295b['attributes']=_[_0x2963('0x3f')](_0xd1b418[_0x2963('0x3b')],qs['fields'](_0x5a32b2['query'][_0x2963('0x40')]));_0x39295b[_0x2963('0x41')]=_0x39295b['attributes']['length']?_0x39295b[_0x2963('0x41')]:_0xd1b418[_0x2963('0x3b')];if(!_0x5a32b2[_0x2963('0x3c')]['hasOwnProperty'](_0x2963('0x42'))){_0x39295b['limit']=qs[_0x2963('0x22')](_0x5a32b2[_0x2963('0x3c')][_0x2963('0x22')]);_0x39295b[_0x2963('0x1f')]=qs[_0x2963('0x1f')](_0x5a32b2[_0x2963('0x3c')][_0x2963('0x1f')]);}_0x39295b[_0x2963('0x43')]=qs[_0x2963('0x44')](_0x5a32b2[_0x2963('0x3c')][_0x2963('0x44')]);_0x39295b[_0x2963('0x45')]=qs[_0x2963('0x3e')](_['pick'](_0x5a32b2[_0x2963('0x3c')],_0xd1b418[_0x2963('0x3e')]),_0x516420);var _0x2ef0b4=[];var _0x52b041=squel[_0x2963('0x46')]()[_0x2963('0x47')]('id')[_0x2963('0x47')](_0x2963('0x2d'))[_0x2963('0x47')](_0x2963('0x48'))[_0x2963('0x49')](_0x2963('0x4a'));var _0x426042=squel['select']()[_0x2963('0x47')](_0x2963('0x4b'))['field'](_0x2963('0x4c'))[_0x2963('0x47')](_0x2963('0x4d'))['from']('user_has_sms_interactions','ui')[_0x2963('0x4e')](_0x2963('0x4f'),'u',_0x2963('0x50'));var _0x51ff13=squel['select']()[_0x2963('0x49')]('sms_interactions','i')['left_join'](_0x2963('0x51'),'c',_0x2963('0x52'))[_0x2963('0x4e')](_0x2963('0x4f'),'o',_0x2963('0x53'))[_0x2963('0x4e')](_0x2963('0x54'),'a','a.id\x20=\x20i.SmsAccountId')['left_join']('sms_messages','me',_0x2963('0x55'))[_0x2963('0x4e')]('sms_interaction_has_tags','it',_0x2963('0x56'))['left_join'](_0x2963('0x4a'),'t',_0x2963('0x57'));var _0x56174c=squel[_0x2963('0x58')]();var _0xb4195b=[];var _0x437a35=squel['expr']();var _0x3b5ff2;if(_0x5a32b2[_0x2963('0x3c')]['search']){_0x3b5ff2=as[_0x2963('0x59')](_0x5a32b2[_0x2963('0x3c')][_0x2963('0x5a')]);var _0x127624=_0x3b5ff2['sqlOperator'];for(var _0x27d9c0=0x0;_0x27d9c0<_0x3b5ff2[_0x2963('0x5b')][_0x2963('0x5c')];_0x27d9c0++){var _0xf29280=_0x3b5ff2[_0x2963('0x5b')][_0x27d9c0];var _0x32f633='i';var _0x12ccc1=_[_0x2963('0x5d')](_0x516420,[_0x2963('0x2d'),_0xf29280[_0x2963('0x47')]]);if(!_0x12ccc1){switch(_0xf29280[_0x2963('0x47')]){case'unreadMessages':if(_0xf29280[_0x2963('0x5e')]==0x1){_0x51ff13[_0x2963('0x5f')]('`'+_0xf29280[_0x2963('0x47')]+_0x2963('0x60'));}else{_0x51ff13[_0x2963('0x5f')]('`'+_0xf29280[_0x2963('0x47')]+'`\x20>\x200');}break;case _0x2963('0x61'):if(_0xf29280[_0x2963('0x62')]===_0x2963('0x63')){if(_0xf29280['value'][_0x2963('0x64')]('\x20')['length']>0x1){_0x56174c[_0x127624]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2963('0x65')](_0xf29280[_0x2963('0x5e')]),null);}else{var _0x3539bd='%'+_0xf29280[_0x2963('0x5e')]+'%';_0x56174c[_0x127624](_0x2963('0x66'),_0x3539bd,_0x3539bd,_0x3539bd);}}else{_0x12ccc1=_['find'](_0x516420,[_0x2963('0x2d'),_0x2963('0x67')]);_0xf29280[_0x2963('0x47')]='ContactId';_0x2ad1eb=as[_0x2963('0x68')](_0x32f633,_0x12ccc1[_0x2963('0x39')],_0xf29280);_0x56174c[_0x127624](_0x2ad1eb['text'],_0x2ad1eb['value']['start'],_0x2ad1eb[_0x2963('0x5e')][_0x2963('0x29')]);}break;case _0x2963('0x69'):var _0x110a13=_0xf29280[_0x2963('0x5e')]['split'](',')[_0x2963('0x30')](function(_0x288725){return Number(_0x288725);});_0x110a13[_0x2963('0x34')](function(_0x5b6708){_0x437a35['or'](_0x2963('0x6a'),'%,'+_0x5b6708+',%');});_0xb4195b=_[_0x2963('0x6b')](_0xb4195b,_0x110a13);break;case'User':if(_0xf29280[_0x2963('0x62')]===_0x2963('0x63')){_0x56174c[_0x127624](_0x2963('0x6c'),'%'+_0xf29280[_0x2963('0x5e')]+'%',null);}else{_0x12ccc1=_[_0x2963('0x5d')](_0x516420,[_0x2963('0x2d'),_0x2963('0x6d')]);_0xf29280[_0x2963('0x47')]=_0x2963('0x6d');_0x2ad1eb=as[_0x2963('0x68')](_0x32f633,_0x12ccc1['type'],_0xf29280);_0x56174c[_0x127624](_0x2ad1eb[_0x2963('0x6e')],_0x2ad1eb[_0x2963('0x5e')][_0x2963('0x6f')],_0x2ad1eb[_0x2963('0x5e')]['end']);}break;case _0x2963('0x70'):_0x2ad1eb=as[_0x2963('0x68')]('me',null,_0xf29280);_0x56174c[_0x127624](_0x2ad1eb[_0x2963('0x6e')],_0x2ad1eb[_0x2963('0x5e')][_0x2963('0x6f')],_0x2ad1eb[_0x2963('0x5e')]['end']);break;}}else{var _0x2ad1eb=as[_0x2963('0x68')](_0x32f633,_0x12ccc1[_0x2963('0x39')],_0xf29280);_0x56174c[_0x127624](_0x2ad1eb[_0x2963('0x6e')],_0x2ad1eb['value'][_0x2963('0x6f')],_0x2ad1eb['value'][_0x2963('0x29')]);}}}else{var _0x7e509c=_(_0x5a32b2[_0x2963('0x3c')])[_0x2963('0x3d')]()[_0x2963('0x30')](function(_0x17f30b){return _[_0x2963('0x71')](_0x516420,['name',_0x17f30b])?_0x17f30b:undefined;})[_0x2963('0x72')]()['value']();if(!_[_0x2963('0x73')](_0x7e509c)){_0x7e509c[_0x2963('0x34')](function(_0x20ed13){if(_0x20ed13==='SmsAccountId'){_0x51ff13[_0x2963('0x45')](_0x2963('0x74'),[][_0x2963('0x75')](_0x5a32b2['query'][_0x20ed13]));}else if(_0x20ed13==='createdAt'){var _0x361714=JSON['parse'](_0x5a32b2[_0x2963('0x3c')][_0x20ed13])['$gte'];var _0x1b5b32=JSON[_0x2963('0x76')](_0x5a32b2[_0x2963('0x3c')][_0x20ed13])['$lte'];_0x51ff13['where'](_0x2963('0x77'),_0x361714,_0x1b5b32);}else{if(_0x5a32b2[_0x2963('0x3c')][_0x20ed13]==='null'){_0x51ff13[_0x2963('0x45')]('i.'+_0x20ed13+_0x2963('0x78'));}else{_0x51ff13[_0x2963('0x45')]('i.'+_0x20ed13+_0x2963('0x79'),_0x5a32b2[_0x2963('0x3c')][_0x20ed13]);}}});}if(_0x5a32b2[_0x2963('0x3c')][_0x2963('0x7a')]){if(_0x5a32b2[_0x2963('0x3c')][_0x2963('0x7a')]==0x1){_0x51ff13[_0x2963('0x5f')](_0x2963('0x7b'));}else{_0x51ff13['having'](_0x2963('0x7c'));}}if(_0x5a32b2[_0x2963('0x3c')][_0x2963('0x7d')]){_0xb4195b=_[_0x2963('0x7e')](_0x5a32b2[_0x2963('0x3c')]['tag'])?_0x5a32b2['query'][_0x2963('0x7d')]:new Array(_0x5a32b2['query'][_0x2963('0x7d')]);_0xb4195b['forEach'](function(_0xb14303){_0x437a35['or'](_0x2963('0x6a'),'%,'+_0xb14303+',%');});}if(_0x5a32b2[_0x2963('0x3c')][_0x2963('0x7f')]){var _0x479ab4=_0x5a32b2[_0x2963('0x3c')]['filter'][_0x2963('0x80')]('\x5c','\x5c\x5c')[_0x2963('0x80')](/'/g,'\x27\x27');if(qs[_0x2963('0x81')](_0x479ab4)){_0x56174c['or']('i.id\x20LIKE\x20?',_0x479ab4+'%')['or'](_0x2963('0x82'),_0x479ab4+'%');}else{_0x56174c['or'](_0x2963('0x83'),qs[_0x2963('0x65')](_0x479ab4))['or'](_0x2963('0x84'),_0x479ab4+'%');}}}_0x51ff13['where'](_0x56174c);_0x51ff13[_0x2963('0x85')]('i.id');var _0x281c26={'type':db[_0x2963('0x86')][_0x2963('0x87')]['SELECT'],'raw':!![]};var _0x1451bf=_0x51ff13['clone']();_0x1451bf[_0x2963('0x47')](_0x2963('0x88'));_0x1451bf[_0x2963('0x47')](_0x2963('0x89'),_0x2963('0x8a'));if(_0x39295b[_0x2963('0x43')]){_0x39295b[_0x2963('0x43')][_0x2963('0x34')](function(_0x4ce4a3){var _0xed281a=_0x4ce4a3[0x0]===_0x2963('0x8b')?_0x4ce4a3[0x0]:'i.'+_0x4ce4a3[0x0];_0x51ff13['order'](_0xed281a,_0x4ce4a3[0x1]===_0x2963('0x8c')?![]:!![]);});}if(!_[_0x2963('0x73')](_0xb4195b)){_0x51ff13[_0x2963('0x5f')](_0x437a35);_0x1451bf['where'](_0x2963('0x8d'),_0xb4195b);}BPromise['resolve']()[_0x2963('0x27')](function(){if(!_0x3b5ff2){if(_0x5a32b2[_0x2963('0x3c')][_0x2963('0x8e')])return;_0x1451bf[_0x2963('0x45')](_0x2963('0x8f'));_0x51ff13['where'](_0x2963('0x8f'));return;}if(_0x5a32b2[_0x2963('0x90')][_0x2963('0x91')]!==_0x2963('0x92'))return;return _0x5a32b2[_0x2963('0x90')][_0x2963('0x93')]({'attributes':['id'],'raw':!![]})[_0x2963('0x27')](function(_0x825ffd){if(_[_0x2963('0x73')](_0x825ffd)){_0x1451bf[_0x2963('0x45')](_0x2963('0x94'));_0x51ff13['where']('i.SmsAccountId\x20IS\x20NULL');}else{_0x1451bf['where'](_0x2963('0x74'),_[_0x2963('0x30')](_0x825ffd,'id'));_0x51ff13['where']('i.SmsAccountId\x20IN\x20?',_['map'](_0x825ffd,'id'));}});})[_0x2963('0x27')](function(){if(_0x5a32b2[_0x2963('0x90')][_0x2963('0x91')]===_0x2963('0x92')&&!_0x3b5ff2&&!_0x5a32b2[_0x2963('0x3c')][_0x2963('0x8e')])return[];return db[_0x2963('0x95')][_0x2963('0x3c')](_0x1451bf[_0x2963('0x96')](),_0x281c26);})[_0x2963('0x27')](function(_0xc52d5e){_0x432e2f[_0x2963('0x21')]=_0xc52d5e[_0x2963('0x5c')];if(_0x432e2f[_0x2963('0x21')]===0x0)return[];return db[_0x2963('0x95')][_0x2963('0x3c')](_0x52b041[_0x2963('0x96')](),_0x281c26)[_0x2963('0x27')](function(_0x4e31db){_0x2ef0b4=_[_0x2963('0x97')](_0x4e31db,'id');_0x281c26=_[_0x2963('0x98')](_0x281c26,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5a32b2[_0x2963('0x3c')][_0x2963('0x40')]){_0x39295b['attributes']['forEach'](function(_0x9d97b9){_0x51ff13[_0x2963('0x47')]('i.'+_0x9d97b9);});}else{_0x51ff13[_0x2963('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2963('0x8a'));_0x51ff13[_0x2963('0x47')]('a.key','Account.key');_0x51ff13['field'](_0x2963('0x99'),'Account.mandatoryDisposition');_0x51ff13[_0x2963('0x47')](_0x2963('0x9a'),_0x2963('0x8b'));_0x51ff13[_0x2963('0x47')](_0x2963('0x9b'));_0x51ff13['field'](_0x2963('0x9c'),'Contact.firstName');_0x51ff13[_0x2963('0x47')](_0x2963('0x9d'),_0x2963('0x9e'));_0x51ff13[_0x2963('0x47')](_0x2963('0x9f'),_0x2963('0xa0'));_0x51ff13['field']('c.phone',_0x2963('0xa1'));_0x51ff13[_0x2963('0x47')](_0x2963('0xa2'),_0x2963('0xa3'));_0x51ff13['field'](_0x2963('0xa4'),_0x2963('0xa5'));_0x51ff13[_0x2963('0x47')](_0x2963('0xa6'),_0x2963('0xa7'));_0x51ff13[_0x2963('0x47')]('o.internal',_0x2963('0xa8'));_0x51ff13[_0x2963('0x47')](_0x2963('0xa9'),_0x2963('0x32'));}if(_0x39295b['limit'])_0x51ff13['limit'](_0x39295b[_0x2963('0x22')]);if(_0x39295b['offset'])_0x51ff13[_0x2963('0x1f')](_0x39295b['offset']);return db['sequelize'][_0x2963('0x3c')](_0x51ff13[_0x2963('0x96')](),_0x281c26);})[_0x2963('0x27')](function(_0x22b577){if(_0x22b577[_0x2963('0x5c')]>0x0)_0x426042[_0x2963('0x45')]('ui.SmsInteractionId\x20IN\x20?',_[_0x2963('0x30')](_0x22b577,'id'));return db['sequelize'][_0x2963('0x3c')](_0x426042[_0x2963('0x96')](),_0x281c26)[_0x2963('0x27')](function(_0xd272f7){var _0x159100=_['groupBy'](_0xd272f7,_0x2963('0xaa'));var _0x29c2aa=[];_0x22b577[_0x2963('0x34')](function(_0x3d2d76){_0x29c2aa[_0x2963('0x35')](updateSmsInteraction(_0x3d2d76,_0x2ef0b4,_0x159100));});return BPromise['all'](_0x29c2aa);});});})[_0x2963('0x27')](function(_0xe2dfd8){_0x432e2f[_0x2963('0xab')]=_0xe2dfd8;return _0x432e2f;})[_0x2963('0x27')](respondWithFilteredResult(_0x49907e,_0x39295b))[_0x2963('0xac')](handleError(_0x49907e,null));};exports[_0x2963('0xad')]=function(_0x43e1df,_0x5ad132){var _0x2adc3e={'raw':![],'where':{'id':_0x43e1df[_0x2963('0xae')]['id']}},_0x3185aa={};_0x3185aa[_0x2963('0x3b')]=_[_0x2963('0x3d')](db[_0x2963('0x37')][_0x2963('0x38')]);_0x3185aa[_0x2963('0x3c')]=_[_0x2963('0x3d')](_0x43e1df['query']);_0x3185aa['filters']=_[_0x2963('0x3f')](_0x3185aa['model'],_0x3185aa['query']);_0x2adc3e[_0x2963('0x41')]=_['intersection'](_0x3185aa[_0x2963('0x3b')],qs[_0x2963('0x40')](_0x43e1df[_0x2963('0x3c')][_0x2963('0x40')]));_0x2adc3e[_0x2963('0x41')]=_0x2adc3e['attributes'][_0x2963('0x5c')]?_0x2adc3e[_0x2963('0x41')]:_0x3185aa[_0x2963('0x3b')];if(_0x43e1df[_0x2963('0x3c')][_0x2963('0xaf')]){_0x2adc3e[_0x2963('0xb0')]=[{'all':!![]}];}_0x2adc3e=_[_0x2963('0x98')]({},_0x2adc3e,_0x43e1df[_0x2963('0xb1')]);return db[_0x2963('0x37')][_0x2963('0x5d')](_0x2adc3e)[_0x2963('0x27')](handleEntityNotFound(_0x5ad132,null))[_0x2963('0x27')](respondWithResult(_0x5ad132,null))[_0x2963('0xac')](handleError(_0x5ad132,null));};exports[_0x2963('0xb2')]=function(_0x517bdd,_0x1b724a){return db['SmsInteraction'][_0x2963('0xb2')](_0x517bdd[_0x2963('0x70')],{})[_0x2963('0x27')](respondWithResult(_0x1b724a,0xc9))[_0x2963('0xac')](handleError(_0x1b724a,null));};exports[_0x2963('0x26')]=function(_0x1ae0b1,_0x340401){if(_0x1ae0b1[_0x2963('0x70')]['id']){delete _0x1ae0b1[_0x2963('0x70')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x1ae0b1[_0x2963('0xae')]['id']}})[_0x2963('0x27')](handleEntityNotFound(_0x340401,null))['then'](saveUpdates(_0x1ae0b1['body'],null))[_0x2963('0x27')](respondWithResult(_0x340401,null))[_0x2963('0xac')](handleError(_0x340401,null));};exports[_0x2963('0x28')]=function(_0x5292ae,_0x2715ff){return db[_0x2963('0x37')]['find']({'where':{'id':_0x5292ae[_0x2963('0xae')]['id']}})['then'](handleEntityNotFound(_0x2715ff,null))['then'](removeEntity(_0x2715ff,null))['catch'](handleError(_0x2715ff,null));};exports[_0x2963('0xb3')]=function(_0xf01eda,_0x5d05cc){return db[_0x2963('0x37')][_0x2963('0xb3')]()['then'](respondWithResult(_0x5d05cc,null))[_0x2963('0xac')](handleError(_0x5d05cc,null));};exports[_0x2963('0xb4')]=function(_0x1241dc,_0x39683c,_0x52a240){return db['SmsMessage'][_0x2963('0x5d')]({'where':{'id':_0x1241dc[_0x2963('0xae')]['id']}})['then'](handleEntityNotFound(_0x39683c,null))[_0x2963('0x27')](function(_0xe815ee){if(_0xe815ee){return _0xe815ee[_0x2963('0xb4')](_0x1241dc['body'][_0x2963('0xb5')],_[_0x2963('0xb6')](_0x1241dc['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x39683c,null))[_0x2963('0xac')](handleError(_0x39683c,null));};exports[_0x2963('0xb7')]=function(_0x5b1d94,_0x1db37a,_0x36032d){var _0x2265a0={'raw':![],'where':{}};var _0x2451c4={};var _0x2d7d71={'count':0x0,'rows':[]};return db[_0x2963('0x37')][_0x2963('0xb8')]({'where':{'id':_0x5b1d94[_0x2963('0xae')]['id']}})[_0x2963('0x27')](handleEntityNotFound(_0x1db37a,null))[_0x2963('0x27')](function(_0x4ed148){if(_0x4ed148){_0x2451c4[_0x2963('0x3b')]=_[_0x2963('0x3d')](db[_0x2963('0xb9')][_0x2963('0x38')]);_0x2451c4[_0x2963('0x3c')]=_[_0x2963('0x3d')](_0x5b1d94[_0x2963('0x3c')]);_0x2451c4['filters']=_['intersection'](_0x2451c4[_0x2963('0x3b')],_0x2451c4[_0x2963('0x3c')]);_0x2265a0[_0x2963('0x41')]=_[_0x2963('0x3f')](_0x2451c4['model'],qs[_0x2963('0x40')](_0x5b1d94['query'][_0x2963('0x40')]));_0x2265a0[_0x2963('0x41')]=_0x2265a0[_0x2963('0x41')][_0x2963('0x5c')]?_0x2265a0[_0x2963('0x41')]:_0x2451c4[_0x2963('0x3b')];if(!_0x5b1d94[_0x2963('0x3c')][_0x2963('0xba')](_0x2963('0x42'))){_0x2265a0['limit']=qs[_0x2963('0x22')](_0x5b1d94[_0x2963('0x3c')][_0x2963('0x22')]);_0x2265a0[_0x2963('0x1f')]=qs[_0x2963('0x1f')](_0x5b1d94[_0x2963('0x3c')][_0x2963('0x1f')]);}_0x2265a0['order']=qs[_0x2963('0x44')](_0x5b1d94['query'][_0x2963('0x44')]);_0x2265a0[_0x2963('0x45')]=qs[_0x2963('0x3e')](_[_0x2963('0xbb')](_0x5b1d94[_0x2963('0x3c')],_0x2451c4[_0x2963('0x3e')]));_0x2265a0[_0x2963('0x45')][_0x2963('0xaa')]=_0x4ed148['id'];if(_0x5b1d94['query'][_0x2963('0x7f')]){_0x2265a0['where']=_[_0x2963('0x98')](_0x2265a0[_0x2963('0x45')],{'$or':_[_0x2963('0x30')](_0x2265a0[_0x2963('0x41')],function(_0x291ec2){var _0x4a2675={};_0x4a2675[_0x291ec2]={'$like':'%'+_0x5b1d94[_0x2963('0x3c')]['filter']+'%'};return _0x4a2675;})});}if(_0x5b1d94['query'][_0x2963('0xbc')]){var _0x96a18c=_0x5b1d94[_0x2963('0x3c')]['$gte'][_0x2963('0x64')](',');var _0x192c54={};_0x192c54[_0x96a18c[0x0]]={'$gte':moment(_0x96a18c[0x1])[_0x2963('0xbd')](_0x2963('0xbe'))};_0x2265a0[_0x2963('0x45')]=_[_0x2963('0x98')](_0x2265a0['where'],_0x192c54);}_0x2265a0=_[_0x2963('0x98')]({},_0x2265a0,_0x5b1d94[_0x2963('0xb1')]);return db[_0x2963('0xb9')][_0x2963('0x21')]({'where':_0x2265a0['where']})[_0x2963('0x27')](function(_0x5b29e9){_0x2d7d71['count']=_0x5b29e9;if(_0x5b1d94['query']['includeAll']){_0x2265a0[_0x2963('0xb0')]=[{'all':!![]}];}return db[_0x2963('0xb9')][_0x2963('0xbf')](_0x2265a0);})[_0x2963('0x27')](function(_0xc2d26e){_0x2d7d71[_0x2963('0xab')]=_0xc2d26e;return _0x2d7d71;});}})[_0x2963('0x27')](respondWithFilteredResult(_0x1db37a,_0x2265a0))[_0x2963('0xac')](handleError(_0x1db37a,null));};exports[_0x2963('0xc0')]=function(_0x41fd46,_0x40f5be,_0x35e4c3){return db[_0x2963('0x37')]['find']({'where':{'id':_0x41fd46['params']['id']}})[_0x2963('0x27')](handleEntityNotFound(_0x40f5be,null))[_0x2963('0x27')](function(_0x4ede2c){if(_0x4ede2c){return _0x4ede2c[_0x2963('0xc1')](_0x41fd46[_0x2963('0x70')][_0x2963('0xb5')],_[_0x2963('0xb6')](_0x41fd46['body'],[_0x2963('0xb5'),'id'])||{})['spread'](function(){return db['Tag'][_0x2963('0xbf')]({'attributes':['id',_0x2963('0x2d'),_0x2963('0x48')],'where':{'id':_0x41fd46[_0x2963('0x70')][_0x2963('0xb5')]}});})[_0x2963('0x27')](function(_0x462065){socket[_0x2963('0xc2')](_0x2963('0xc3'),{'id':Number(_0x41fd46[_0x2963('0xae')]['id']),'tags':_0x462065||[]});return{'id':Number(_0x41fd46[_0x2963('0xae')]['id']),'tags':_0x462065||[]};});}})[_0x2963('0x27')](respondWithResult(_0x40f5be,null))[_0x2963('0xac')](handleError(_0x40f5be,null));};exports['removeTags']=function(_0x19d97f,_0x37ea53,_0x275a40){return db['SmsInteraction']['find']({'where':{'id':_0x19d97f[_0x2963('0xae')]['id']}})['then'](handleEntityNotFound(_0x37ea53,null))['then'](function(_0x36a827){if(_0x36a827){return _0x36a827[_0x2963('0xc4')](_0x19d97f[_0x2963('0x3c')]['ids']);}})[_0x2963('0x27')](respondWithStatusCode(_0x37ea53,null))[_0x2963('0xac')](handleError(_0x37ea53,null));};exports[_0x2963('0xc5')]=function(_0x31aee8,_0x27f1fe){var _0x18139e=moment()['unix']()[_0x2963('0x96')]();var _0x346648=path[_0x2963('0xc6')](config['root'],'server',_0x2963('0xc7'),_0x2963('0xc8'));var _0x38c238=path[_0x2963('0xc6')](config[_0x2963('0xc9')],'server','files',_0x2963('0xca'));var _0x50bb6e=path[_0x2963('0xc6')](_0x346648,_0x18139e);var _0x241792=util[_0x2963('0xbd')]('transcript-%d-%s.zip',_0x31aee8[_0x2963('0xae')]['id'],_0x18139e);var _0x359828=path[_0x2963('0xc6')](_0x346648,_0x241792);var _0x8ff76e=[];_0x8ff76e[_0x2963('0x35')]({'model':db[_0x2963('0xcb')],'as':_0x2963('0xcb'),'attributes':['id',_0x2963('0x31')],'raw':!![]});_0x8ff76e[_0x2963('0x35')]({'model':db[_0x2963('0xcc')],'as':_0x2963('0x61'),'attributes':['id',_0x2963('0xcd'),'lastName'],'raw':!![]});var _0x12b8db=[{'model':db[_0x2963('0xb9')],'as':'Messages','attributes':['id','body','createdAt',_0x2963('0xce'),_0x2963('0xcf'),_0x2963('0x7a')],'include':_0x8ff76e}];_0x12b8db[_0x2963('0x35')]({'model':db[_0x2963('0xd0')],'as':'Account','attributes':['id','name']});_0x12b8db[_0x2963('0x35')]({'model':db[_0x2963('0xcb')],'as':_0x2963('0xd1'),'attributes':['id',_0x2963('0x31')]});return db[_0x2963('0x37')]['find']({'where':{'id':_0x31aee8['params']['id']},'include':_0x12b8db})[_0x2963('0x27')](handleEntityNotFound(_0x27f1fe,null))['then'](function(_0x39e38c){if(_0x39e38c){var _0x3572d0=_0x39e38c['get']({'plain':!![]});fs[_0x2963('0xd2')](_0x50bb6e);var _0x12551f={'channel':'Sms','account':_0x3572d0[_0x2963('0xd3')][_0x2963('0x2d')],'agent':_0x3572d0['Owner']?_0x3572d0['Owner']['fullname']:_0x2963('0xd4'),'createdAt':moment(_0x3572d0[_0x2963('0xd5')])[_0x2963('0xbd')](_0x2963('0xbe'))[_0x2963('0x96')](),'closedAt':_0x3572d0[_0x2963('0xd6')]?moment(_0x3572d0[_0x2963('0xd7')])[_0x2963('0xbd')](_0x2963('0xbe'))[_0x2963('0x96')]():'','disposition':_0x3572d0[_0x2963('0xd8')],'messages':_(_0x3572d0[_0x2963('0xd9')])[_0x2963('0x7f')]({'secret':![]})[_0x2963('0x30')](function(_0x136ef9){return{'date':moment(_0x136ef9['createdAt'])[_0x2963('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2963('0x96')](),'sender':_0x136ef9[_0x2963('0xce')]===_0x2963('0xda')?_0x136ef9['User']?_0x136ef9[_0x2963('0xcb')]['fullname']:_0x2963('0xdb'):_0x136ef9['Contact'][_0x2963('0xcd')]+(_0x136ef9[_0x2963('0x61')][_0x2963('0xdc')]?'\x20'+_0x136ef9[_0x2963('0x61')][_0x2963('0xdc')]:''),'body':_0x136ef9[_0x2963('0x70')],'direction':_0x136ef9['direction']==='out'?'A':'C','secret':_0x136ef9['secret'],'read':_0x136ef9[_0x2963('0x7a')]};})['value']()};return ejs[_0x2963('0xdd')](path['join'](config[_0x2963('0xc9')],_0x2963('0xde'),_0x2963('0xdf'),_0x2963('0xe0')),{'interaction':_0x12551f})['then'](function(_0x1010a4){var _0x1c73b8=path[_0x2963('0xc6')](_0x50bb6e,_0x2963('0xe1')+_0x3572d0['id']+'-'+_0x18139e+'.pdf');var _0x1b337a={'path':_0x1c73b8,'channel':_0x2963('0xe2'),'interactionId':_0x3572d0['id']};return pdf[_0x2963('0xe3')](_0x1010a4,_0x1b337a);})[_0x2963('0x27')](function(){return new BPromise(function(_0x5f3d25,_0x42f1f0){zipdir(_0x50bb6e,{'saveTo':_0x359828},function(_0x3b3df2,_0xe6d738){if(_0x3b3df2)return _0x42f1f0(_0x3b3df2);return _0x5f3d25(_0xe6d738);});})[_0x2963('0x27')](function(){return new BPromise(function(_0x3cc15c,_0xa15252){rimraf(_0x50bb6e,function(_0x4e2b1b){if(_0x4e2b1b)_0xa15252(_0x4e2b1b);return _0x3cc15c();});});})[_0x2963('0x27')](function(){return _0x27f1fe['download'](_0x359828,_0x241792,function(_0x2c1371){if(_0x2c1371){console[_0x2963('0xe4')](_0x2963('0xe5'),_0x2c1371);}else{fs[_0x2963('0xe6')](_0x359828);}});});});}else{return _0x27f1fe[_0x2963('0x2a')](0xc8);}})[_0x2963('0xac')](handleError(_0x27f1fe,null));}; \ No newline at end of file +var _0x17fd=['bluebird','util','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','json','offset','limit','status','Content-Range','reject','save','then','destroy','error','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','SmsInteraction','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','nolimit','sort','where','pick','filters','select','field','color','from','tools_tags','u.fullname','left_join','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','buildExpression','type','body','some','compact','forEach','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','`unreadMessages`\x20=\x200','isArray','tag','filter','isNumeric','i.phone\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','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','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','rows','show','params','includeAll','include','options','create','update','describe','SmsMessage','addMessage','ids','getMessages','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','count','findAll','addTags','omit','spread','emit','removeTags','unix','server','files','tmp','join','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','secret','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closed','disposition','System','out','renderFile','root','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x17fd,0x1b6));var _0xd17f=function(_0x175b84,_0xe53ff4){_0x175b84=_0x175b84-0x0;var _0x183820=_0x17fd[_0x175b84];return _0x183820;};'use strict';var emlformat=require(_0xd17f('0x0'));var rimraf=require(_0xd17f('0x1'));var zipdir=require(_0xd17f('0x2'));var jsonpatch=require(_0xd17f('0x3'));var rp=require(_0xd17f('0x4'));var moment=require(_0xd17f('0x5'));var BPromise=require(_0xd17f('0x6'));var Mustache=require('mustache');var util=require(_0xd17f('0x7'));var path=require('path');var sox=require(_0xd17f('0x8'));var csv=require('to-csv');var ejs=require(_0xd17f('0x9'));var fs=require('fs');var fs_extra=require(_0xd17f('0xa'));var _=require('lodash');var squel=require(_0xd17f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd17f('0xc'));var toCsv=require(_0xd17f('0xd'));var querystring=require(_0xd17f('0xe'));var Papa=require(_0xd17f('0xf'));var Redis=require(_0xd17f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd17f('0x11'));var as=require(_0xd17f('0x12'));var pdf=require(_0xd17f('0x13'));var hardwareService=require(_0xd17f('0x14'));var logger=require(_0xd17f('0x15'))(_0xd17f('0x16'));var utils=require(_0xd17f('0x17'));var config=require(_0xd17f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd17f('0x19'))['db'];config[_0xd17f('0x1a')]=_[_0xd17f('0x1b')](config[_0xd17f('0x1a')],{'host':_0xd17f('0x1c'),'port':0x18eb});var socket=require(_0xd17f('0x1d'))(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1e5e20,_0x5ee7ff){_0x5ee7ff=_0x5ee7ff||0xcc;return function(_0x47c7f6){if(_0x47c7f6){return _0x1e5e20[_0xd17f('0x1e')](_0x5ee7ff);}return _0x1e5e20['status'](_0x5ee7ff)[_0xd17f('0x1f')]();};}function respondWithResult(_0x3375ae,_0x4753ca){_0x4753ca=_0x4753ca||0xc8;return function(_0x31e067){if(_0x31e067){return _0x3375ae['status'](_0x4753ca)[_0xd17f('0x20')](_0x31e067);}};}function respondWithFilteredResult(_0x1e2c92,_0x2cb530){return function(_0x24f0fb){if(_0x24f0fb){var _0x33d3a0=typeof _0x2cb530[_0xd17f('0x21')]==='undefined'&&typeof _0x2cb530[_0xd17f('0x22')]==='undefined';var _0x7d9d25=_0x24f0fb['count'];var _0x52231e=_0x33d3a0?0x0:_0x2cb530['offset'];var _0x24b875=_0x33d3a0?_0x24f0fb['count']:_0x2cb530['offset']+_0x2cb530['limit'];var _0x281699;if(_0x24b875>=_0x7d9d25){_0x24b875=_0x7d9d25;_0x281699=0xc8;}else{_0x281699=0xce;}_0x1e2c92[_0xd17f('0x23')](_0x281699);return _0x1e2c92['set'](_0xd17f('0x24'),_0x52231e+'-'+_0x24b875+'/'+_0x7d9d25)['json'](_0x24f0fb);}return null;};}function patchUpdates(_0x566636){return function(_0x5e9a57){try{jsonpatch['apply'](_0x5e9a57,_0x566636,!![]);}catch(_0x4b5dac){return BPromise[_0xd17f('0x25')](_0x4b5dac);}return _0x5e9a57[_0xd17f('0x26')]();};}function saveUpdates(_0x1bd31f,_0x3edbf8){return function(_0x21e77b){if(_0x21e77b){return _0x21e77b['update'](_0x1bd31f)[_0xd17f('0x27')](function(_0x3f3ecb){return _0x3f3ecb;});}return null;};}function removeEntity(_0x8efed0,_0x441b03){return function(_0x35e903){if(_0x35e903){return _0x35e903[_0xd17f('0x28')]()[_0xd17f('0x27')](function(){_0x8efed0[_0xd17f('0x23')](0xcc)[_0xd17f('0x1f')]();});}};}function handleEntityNotFound(_0x29bdaf,_0x1e1326){return function(_0x3a5791){if(!_0x3a5791){_0x29bdaf[_0xd17f('0x1e')](0x194);}return _0x3a5791;};}function handleError(_0x13399c,_0x596c14){_0x596c14=_0x596c14||0x1f4;return function(_0x40d9c8){logger[_0xd17f('0x29')](_0x40d9c8['stack']);if(_0x40d9c8[_0xd17f('0x2a')]){delete _0x40d9c8[_0xd17f('0x2a')];}_0x13399c[_0xd17f('0x23')](_0x596c14)[_0xd17f('0x2b')](_0x40d9c8);};}function getInteractionUsers(_0x17e095,_0x38d07b){return new BPromise(function(_0x57234f,_0x343ca9){try{if(_0x38d07b[_0x17e095['id']]){_0x17e095[_0xd17f('0x2c')]=_[_0xd17f('0x2d')](_0x38d07b[_0x17e095['id']],function(_0x9db287){return{'id':_0x9db287['id'],'fullname':_0x9db287[_0xd17f('0x2e')]};});}}catch(_0xf83e79){_0x343ca9(_0xf83e79);}_0x57234f(_0x17e095);});}function getInteractionTags(_0x588d53,_0x3d4135){return new BPromise(function(_0x2a264a,_0x513d30){try{if(_0x588d53[_0xd17f('0x2f')]){_0x588d53[_0xd17f('0x30')]=[];_0x588d53['TagIds'][_0xd17f('0x31')](',')['forEach'](function(_0x18cac5){_0x588d53[_0xd17f('0x30')][_0xd17f('0x32')](_0x3d4135[_0x18cac5]);});}delete _0x588d53['TagIds'];}catch(_0x2a5e89){_0x513d30(_0x2a5e89);}_0x2a264a(_0x588d53);});}function updateSmsInteraction(_0x2b4d7f,_0xf52425,_0x3418a4){return new BPromise(function(_0x2fd91,_0x2af3f7){return getInteractionUsers(_0x2b4d7f,_0x3418a4)['then'](function(_0x1f5241){return getInteractionTags(_0x1f5241,_0xf52425);})[_0xd17f('0x27')](function(_0x18189e){_0x2fd91(_0x18189e);})[_0xd17f('0x33')](function(_0x359275){_0x2af3f7(_0x359275);});});}exports[_0xd17f('0x34')]=function(_0x5291e0,_0x44d11d){var _0xd1553b={},_0x342fc1={},_0x51124c={'count':0x0,'rows':[]};var _0xedc83a=_[_0xd17f('0x2d')](db[_0xd17f('0x35')][_0xd17f('0x36')],function(_0x18199f){return{'name':_0x18199f[_0xd17f('0x37')],'type':_0x18199f['type']['key']};});_0x342fc1[_0xd17f('0x38')]=_[_0xd17f('0x2d')](_0xedc83a,_0xd17f('0x2a'));_0x342fc1['query']=_[_0xd17f('0x39')](_0x5291e0[_0xd17f('0x3a')]);_0x342fc1['filters']=_[_0xd17f('0x3b')](_0x342fc1[_0xd17f('0x38')],_0x342fc1['query']);_0xd1553b[_0xd17f('0x3c')]=_[_0xd17f('0x3b')](_0x342fc1[_0xd17f('0x38')],qs[_0xd17f('0x3d')](_0x5291e0[_0xd17f('0x3a')]['fields']));_0xd1553b[_0xd17f('0x3c')]=_0xd1553b['attributes']['length']?_0xd1553b[_0xd17f('0x3c')]:_0x342fc1['model'];if(!_0x5291e0[_0xd17f('0x3a')]['hasOwnProperty'](_0xd17f('0x3e'))){_0xd1553b[_0xd17f('0x22')]=qs[_0xd17f('0x22')](_0x5291e0[_0xd17f('0x3a')][_0xd17f('0x22')]);_0xd1553b[_0xd17f('0x21')]=qs[_0xd17f('0x21')](_0x5291e0[_0xd17f('0x3a')][_0xd17f('0x21')]);}_0xd1553b['order']=qs[_0xd17f('0x3f')](_0x5291e0[_0xd17f('0x3a')][_0xd17f('0x3f')]);_0xd1553b[_0xd17f('0x40')]=qs['filters'](_[_0xd17f('0x41')](_0x5291e0['query'],_0x342fc1[_0xd17f('0x42')]),_0xedc83a);var _0x1d0b4a=[];var _0x561cb1=squel[_0xd17f('0x43')]()[_0xd17f('0x44')]('id')[_0xd17f('0x44')](_0xd17f('0x2a'))[_0xd17f('0x44')](_0xd17f('0x45'))[_0xd17f('0x46')](_0xd17f('0x47'));var _0x577d43=squel[_0xd17f('0x43')]()[_0xd17f('0x44')]('u.id')[_0xd17f('0x44')](_0xd17f('0x48'))[_0xd17f('0x44')]('ui.SmsInteractionId')[_0xd17f('0x46')]('user_has_sms_interactions','ui')[_0xd17f('0x49')]('users','u','u.id\x20=\x20ui.UserId');var _0x619e28=squel['select']()[_0xd17f('0x46')](_0xd17f('0x4a'),'i')[_0xd17f('0x49')](_0xd17f('0x4b'),'c',_0xd17f('0x4c'))[_0xd17f('0x49')](_0xd17f('0x4d'),'o','o.id\x20=\x20i.UserId')[_0xd17f('0x49')](_0xd17f('0x4e'),'a',_0xd17f('0x4f'))[_0xd17f('0x49')](_0xd17f('0x50'),'me',_0xd17f('0x51'))[_0xd17f('0x49')](_0xd17f('0x52'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xd17f('0x49')]('tools_tags','t',_0xd17f('0x53'));var _0x4b60a9=squel[_0xd17f('0x54')]();var _0x1bd46c=[];var _0x1af3af=squel['expr']();var _0x5ceef0;if(_0x5291e0[_0xd17f('0x3a')][_0xd17f('0x55')]){_0x5ceef0=as[_0xd17f('0x56')](_0x5291e0[_0xd17f('0x3a')][_0xd17f('0x55')]);var _0x3c753e=_0x5ceef0[_0xd17f('0x57')];for(var _0x5f0b8b=0x0;_0x5f0b8b<_0x5ceef0['conditions'][_0xd17f('0x58')];_0x5f0b8b++){var _0x13cb14=_0x5ceef0['conditions'][_0x5f0b8b];var _0x4c739b='i';var _0x44b51d=_[_0xd17f('0x59')](_0xedc83a,[_0xd17f('0x2a'),_0x13cb14['field']]);if(!_0x44b51d){switch(_0x13cb14[_0xd17f('0x44')]){case _0xd17f('0x5a'):if(_0x13cb14[_0xd17f('0x5b')]==0x1){_0x619e28[_0xd17f('0x5c')]('`'+_0x13cb14[_0xd17f('0x44')]+_0xd17f('0x5d'));}else{_0x619e28[_0xd17f('0x5c')]('`'+_0x13cb14[_0xd17f('0x44')]+_0xd17f('0x5e'));}break;case _0xd17f('0x5f'):if(_0x13cb14[_0xd17f('0x60')]===_0xd17f('0x61')){if(_0x13cb14['value'][_0xd17f('0x31')]('\x20')[_0xd17f('0x58')]>0x1){_0x4b60a9[_0x3c753e]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x13cb14['value']),null);}else{var _0x4e948b='%'+_0x13cb14[_0xd17f('0x5b')]+'%';_0x4b60a9[_0x3c753e](_0xd17f('0x62'),_0x4e948b,_0x4e948b,_0x4e948b);}}else{_0x44b51d=_[_0xd17f('0x59')](_0xedc83a,['name',_0xd17f('0x63')]);_0x13cb14['field']=_0xd17f('0x63');_0x2083f6=as['buildExpression'](_0x4c739b,_0x44b51d['type'],_0x13cb14);_0x4b60a9[_0x3c753e](_0x2083f6[_0xd17f('0x64')],_0x2083f6[_0xd17f('0x5b')][_0xd17f('0x65')],_0x2083f6['value'][_0xd17f('0x1f')]);}break;case _0xd17f('0x66'):var _0x33c445=_0x13cb14['value']['split'](',')[_0xd17f('0x2d')](function(_0x14e61f){return Number(_0x14e61f);});_0x33c445['forEach'](function(_0xcb2430){_0x1af3af['or'](_0xd17f('0x67'),'%,'+_0xcb2430+',%');});_0x1bd46c=_[_0xd17f('0x68')](_0x1bd46c,_0x33c445);break;case _0xd17f('0x69'):if(_0x13cb14['operator']===_0xd17f('0x61')){_0x4b60a9[_0x3c753e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x13cb14[_0xd17f('0x5b')]+'%',null);}else{_0x44b51d=_['find'](_0xedc83a,['name','UserId']);_0x13cb14[_0xd17f('0x44')]=_0xd17f('0x6a');_0x2083f6=as[_0xd17f('0x6b')](_0x4c739b,_0x44b51d[_0xd17f('0x6c')],_0x13cb14);_0x4b60a9[_0x3c753e](_0x2083f6[_0xd17f('0x64')],_0x2083f6[_0xd17f('0x5b')]['start'],_0x2083f6[_0xd17f('0x5b')][_0xd17f('0x1f')]);}break;case _0xd17f('0x6d'):_0x2083f6=as['buildExpression']('me',null,_0x13cb14);_0x4b60a9[_0x3c753e](_0x2083f6[_0xd17f('0x64')],_0x2083f6[_0xd17f('0x5b')]['start'],_0x2083f6[_0xd17f('0x5b')][_0xd17f('0x1f')]);break;}}else{var _0x2083f6=as[_0xd17f('0x6b')](_0x4c739b,_0x44b51d['type'],_0x13cb14);_0x4b60a9[_0x3c753e](_0x2083f6[_0xd17f('0x64')],_0x2083f6[_0xd17f('0x5b')][_0xd17f('0x65')],_0x2083f6[_0xd17f('0x5b')]['end']);}}}else{var _0xeb9d42=_(_0x5291e0['query'])[_0xd17f('0x39')]()[_0xd17f('0x2d')](function(_0x4ff754){return _[_0xd17f('0x6e')](_0xedc83a,[_0xd17f('0x2a'),_0x4ff754])?_0x4ff754:undefined;})[_0xd17f('0x6f')]()[_0xd17f('0x5b')]();if(!_['isEmpty'](_0xeb9d42)){_0xeb9d42[_0xd17f('0x70')](function(_0x2e14e6){if(_0x2e14e6===_0xd17f('0x71')){_0x619e28[_0xd17f('0x40')](_0xd17f('0x72'),[]['concat'](_0x5291e0[_0xd17f('0x3a')][_0x2e14e6]));}else if(_0x2e14e6===_0xd17f('0x73')){var _0x345a2e=JSON[_0xd17f('0x74')](_0x5291e0['query'][_0x2e14e6])[_0xd17f('0x75')];var _0x2dbb0=JSON['parse'](_0x5291e0['query'][_0x2e14e6])['$lte'];_0x619e28[_0xd17f('0x40')](_0xd17f('0x76'),_0x345a2e,_0x2dbb0);}else{if(_0x5291e0[_0xd17f('0x3a')][_0x2e14e6]===_0xd17f('0x77')){_0x619e28[_0xd17f('0x40')]('i.'+_0x2e14e6+'\x20IS\x20NULL');}else{_0x619e28['where']('i.'+_0x2e14e6+'\x20=\x20?',_0x5291e0[_0xd17f('0x3a')][_0x2e14e6]);}}});}if(_0x5291e0['query']['read']){if(_0x5291e0[_0xd17f('0x3a')]['read']==0x1){_0x619e28['having'](_0xd17f('0x78'));}else{_0x619e28['having']('`unreadMessages`\x20>\x200');}}if(_0x5291e0[_0xd17f('0x3a')]['tag']){_0x1bd46c=_[_0xd17f('0x79')](_0x5291e0[_0xd17f('0x3a')][_0xd17f('0x7a')])?_0x5291e0[_0xd17f('0x3a')][_0xd17f('0x7a')]:new Array(_0x5291e0[_0xd17f('0x3a')][_0xd17f('0x7a')]);_0x1bd46c[_0xd17f('0x70')](function(_0x510d87){_0x1af3af['or'](_0xd17f('0x67'),'%,'+_0x510d87+',%');});}if(_0x5291e0['query'][_0xd17f('0x7b')]){var _0x4abe3c=_0x5291e0[_0xd17f('0x3a')][_0xd17f('0x7b')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xd17f('0x7c')](_0x4abe3c)){_0x4b60a9['or']('i.id\x20LIKE\x20?',_0x4abe3c+'%')['or'](_0xd17f('0x7d'),_0x4abe3c+'%');}else{_0x4b60a9['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4abe3c))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x4abe3c+'%');}}}_0x619e28['where'](_0x4b60a9);_0x619e28[_0xd17f('0x7e')](_0xd17f('0x7f'));var _0x2e737b={'type':db['Sequelize'][_0xd17f('0x80')]['SELECT'],'raw':!![]};var _0x95bd1b=_0x619e28[_0xd17f('0x81')]();_0x95bd1b['field'](_0xd17f('0x7f'));_0x95bd1b[_0xd17f('0x44')](_0xd17f('0x82'),_0xd17f('0x5a'));if(_0xd1553b[_0xd17f('0x83')]){_0xd1553b[_0xd17f('0x83')][_0xd17f('0x70')](function(_0x208fd4){var _0x2505ea=_0x208fd4[0x0]===_0xd17f('0x84')?_0x208fd4[0x0]:'i.'+_0x208fd4[0x0];_0x619e28['order'](_0x2505ea,_0x208fd4[0x1]===_0xd17f('0x85')?![]:!![]);});}if(!_['isEmpty'](_0x1bd46c)){_0x619e28[_0xd17f('0x5c')](_0x1af3af);_0x95bd1b[_0xd17f('0x40')]('t.id\x20IN\x20?',_0x1bd46c);}BPromise[_0xd17f('0x86')]()['then'](function(){if(!_0x5ceef0){if(_0x5291e0[_0xd17f('0x3a')][_0xd17f('0x71')])return;_0x95bd1b[_0xd17f('0x40')](_0xd17f('0x87'));_0x619e28['where'](_0xd17f('0x87'));return;}if(_0x5291e0[_0xd17f('0x88')][_0xd17f('0x89')]!==_0xd17f('0x8a'))return;return _0x5291e0[_0xd17f('0x88')][_0xd17f('0x8b')]({'attributes':['id'],'raw':!![]})[_0xd17f('0x27')](function(_0x21b62b){if(_['isEmpty'](_0x21b62b)){_0x95bd1b[_0xd17f('0x40')](_0xd17f('0x8c'));_0x619e28[_0xd17f('0x40')](_0xd17f('0x8c'));}else{_0x95bd1b[_0xd17f('0x40')]('i.SmsAccountId\x20IN\x20?',_[_0xd17f('0x2d')](_0x21b62b,'id'));_0x619e28[_0xd17f('0x40')](_0xd17f('0x72'),_[_0xd17f('0x2d')](_0x21b62b,'id'));}});})[_0xd17f('0x27')](function(){if(_0x5291e0[_0xd17f('0x88')][_0xd17f('0x89')]===_0xd17f('0x8a')&&!_0x5ceef0&&!_0x5291e0['query'][_0xd17f('0x71')])return[];return db[_0xd17f('0x8d')]['query'](_0x95bd1b[_0xd17f('0x8e')](),_0x2e737b);})[_0xd17f('0x27')](function(_0x4dc182){_0x51124c['count']=_0x4dc182[_0xd17f('0x58')];if(_0x51124c['count']===0x0)return[];return db['sequelize']['query'](_0x561cb1[_0xd17f('0x8e')](),_0x2e737b)['then'](function(_0x4ed160){_0x1d0b4a=_['keyBy'](_0x4ed160,'id');_0x2e737b=_[_0xd17f('0x8f')](_0x2e737b,{'model':db[_0xd17f('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5291e0[_0xd17f('0x3a')]['fields']){_0xd1553b[_0xd17f('0x3c')]['forEach'](function(_0x3e2e4f){_0x619e28[_0xd17f('0x44')]('i.'+_0x3e2e4f);});}else{_0x619e28[_0xd17f('0x44')](_0xd17f('0x82'),_0xd17f('0x5a'));_0x619e28[_0xd17f('0x44')]('a.key',_0xd17f('0x90'));_0x619e28[_0xd17f('0x44')](_0xd17f('0x91'),_0xd17f('0x92'));_0x619e28[_0xd17f('0x44')](_0xd17f('0x93'),_0xd17f('0x84'));_0x619e28[_0xd17f('0x44')](_0xd17f('0x94'));_0x619e28[_0xd17f('0x44')](_0xd17f('0x95'),_0xd17f('0x96'));_0x619e28[_0xd17f('0x44')](_0xd17f('0x97'),'Contact.lastName');_0x619e28[_0xd17f('0x44')](_0xd17f('0x98'),'Contact.email');_0x619e28['field'](_0xd17f('0x99'),_0xd17f('0x9a'));_0x619e28[_0xd17f('0x44')](_0xd17f('0x9b'),_0xd17f('0x9c'));_0x619e28[_0xd17f('0x44')](_0xd17f('0x9d'),'Contact.fax');_0x619e28[_0xd17f('0x44')](_0xd17f('0x9e'),_0xd17f('0x9f'));_0x619e28[_0xd17f('0x44')]('o.internal',_0xd17f('0xa0'));_0x619e28[_0xd17f('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xd17f('0x2f'));}if(_0xd1553b['limit'])_0x619e28[_0xd17f('0x22')](_0xd1553b['limit']);if(_0xd1553b[_0xd17f('0x21')])_0x619e28[_0xd17f('0x21')](_0xd1553b[_0xd17f('0x21')]);return db[_0xd17f('0x8d')][_0xd17f('0x3a')](_0x619e28[_0xd17f('0x8e')](),_0x2e737b);})[_0xd17f('0x27')](function(_0x4d124f){if(_0x4d124f[_0xd17f('0x58')]>0x0)_0x577d43[_0xd17f('0x40')](_0xd17f('0xa1'),_['map'](_0x4d124f,'id'));return db['sequelize']['query'](_0x577d43[_0xd17f('0x8e')](),_0x2e737b)['then'](function(_0x22a653){var _0x57e81c=_[_0xd17f('0xa2')](_0x22a653,_0xd17f('0xa3'));var _0x4b1846=[];_0x4d124f['forEach'](function(_0x39a242){_0x4b1846[_0xd17f('0x32')](updateSmsInteraction(_0x39a242,_0x1d0b4a,_0x57e81c));});return BPromise['all'](_0x4b1846);});});})['then'](function(_0x517e93){_0x51124c[_0xd17f('0xa4')]=_0x517e93;return _0x51124c;})[_0xd17f('0x27')](respondWithFilteredResult(_0x44d11d,_0xd1553b))[_0xd17f('0x33')](handleError(_0x44d11d,null));};exports[_0xd17f('0xa5')]=function(_0x112523,_0x460eb2){var _0x3ca3e6={'raw':![],'where':{'id':_0x112523[_0xd17f('0xa6')]['id']}},_0x21bb91={};_0x21bb91[_0xd17f('0x38')]=_[_0xd17f('0x39')](db[_0xd17f('0x35')]['rawAttributes']);_0x21bb91[_0xd17f('0x3a')]=_[_0xd17f('0x39')](_0x112523[_0xd17f('0x3a')]);_0x21bb91[_0xd17f('0x42')]=_[_0xd17f('0x3b')](_0x21bb91[_0xd17f('0x38')],_0x21bb91[_0xd17f('0x3a')]);_0x3ca3e6[_0xd17f('0x3c')]=_[_0xd17f('0x3b')](_0x21bb91[_0xd17f('0x38')],qs['fields'](_0x112523[_0xd17f('0x3a')]['fields']));_0x3ca3e6[_0xd17f('0x3c')]=_0x3ca3e6[_0xd17f('0x3c')][_0xd17f('0x58')]?_0x3ca3e6[_0xd17f('0x3c')]:_0x21bb91[_0xd17f('0x38')];if(_0x112523[_0xd17f('0x3a')][_0xd17f('0xa7')]){_0x3ca3e6[_0xd17f('0xa8')]=[{'all':!![]}];}_0x3ca3e6=_[_0xd17f('0x8f')]({},_0x3ca3e6,_0x112523[_0xd17f('0xa9')]);return db['SmsInteraction']['find'](_0x3ca3e6)['then'](handleEntityNotFound(_0x460eb2,null))['then'](respondWithResult(_0x460eb2,null))[_0xd17f('0x33')](handleError(_0x460eb2,null));};exports[_0xd17f('0xaa')]=function(_0x46461a,_0x566575){return db[_0xd17f('0x35')][_0xd17f('0xaa')](_0x46461a[_0xd17f('0x6d')],{})[_0xd17f('0x27')](respondWithResult(_0x566575,0xc9))['catch'](handleError(_0x566575,null));};exports[_0xd17f('0xab')]=function(_0xb8e6c9,_0x60f3c5){if(_0xb8e6c9[_0xd17f('0x6d')]['id']){delete _0xb8e6c9[_0xd17f('0x6d')]['id'];}return db[_0xd17f('0x35')][_0xd17f('0x59')]({'where':{'id':_0xb8e6c9[_0xd17f('0xa6')]['id']}})['then'](handleEntityNotFound(_0x60f3c5,null))[_0xd17f('0x27')](saveUpdates(_0xb8e6c9[_0xd17f('0x6d')],null))[_0xd17f('0x27')](respondWithResult(_0x60f3c5,null))[_0xd17f('0x33')](handleError(_0x60f3c5,null));};exports[_0xd17f('0x28')]=function(_0x51b25a,_0x1bbf8e){return db['SmsInteraction'][_0xd17f('0x59')]({'where':{'id':_0x51b25a[_0xd17f('0xa6')]['id']}})['then'](handleEntityNotFound(_0x1bbf8e,null))[_0xd17f('0x27')](removeEntity(_0x1bbf8e,null))[_0xd17f('0x33')](handleError(_0x1bbf8e,null));};exports[_0xd17f('0xac')]=function(_0x1f130d,_0x1ab1ca){return db['SmsInteraction']['describe']()[_0xd17f('0x27')](respondWithResult(_0x1ab1ca,null))[_0xd17f('0x33')](handleError(_0x1ab1ca,null));};exports['addMessage']=function(_0x14a83b,_0x1a91c9,_0x291f67){return db[_0xd17f('0xad')][_0xd17f('0x59')]({'where':{'id':_0x14a83b['params']['id']}})['then'](handleEntityNotFound(_0x1a91c9,null))[_0xd17f('0x27')](function(_0x11d3b1){if(_0x11d3b1){return _0x11d3b1[_0xd17f('0xae')](_0x14a83b[_0xd17f('0x6d')]['ids'],_['omit'](_0x14a83b[_0xd17f('0x6d')],[_0xd17f('0xaf'),'id'])||{});}})['then'](respondWithResult(_0x1a91c9,null))['catch'](handleError(_0x1a91c9,null));};exports[_0xd17f('0xb0')]=function(_0x3c55cb,_0x1a5bec,_0x5eec70){var _0x419479={'raw':![],'where':{}};var _0x32fdbc={};var _0x586c5b={'count':0x0,'rows':[]};return db[_0xd17f('0x35')]['findOne']({'where':{'id':_0x3c55cb[_0xd17f('0xa6')]['id']}})[_0xd17f('0x27')](handleEntityNotFound(_0x1a5bec,null))[_0xd17f('0x27')](function(_0x596c11){if(_0x596c11){_0x32fdbc[_0xd17f('0x38')]=_[_0xd17f('0x39')](db[_0xd17f('0xad')][_0xd17f('0x36')]);_0x32fdbc[_0xd17f('0x3a')]=_[_0xd17f('0x39')](_0x3c55cb['query']);_0x32fdbc[_0xd17f('0x42')]=_['intersection'](_0x32fdbc[_0xd17f('0x38')],_0x32fdbc[_0xd17f('0x3a')]);_0x419479[_0xd17f('0x3c')]=_[_0xd17f('0x3b')](_0x32fdbc[_0xd17f('0x38')],qs[_0xd17f('0x3d')](_0x3c55cb[_0xd17f('0x3a')][_0xd17f('0x3d')]));_0x419479[_0xd17f('0x3c')]=_0x419479[_0xd17f('0x3c')][_0xd17f('0x58')]?_0x419479[_0xd17f('0x3c')]:_0x32fdbc[_0xd17f('0x38')];if(!_0x3c55cb[_0xd17f('0x3a')][_0xd17f('0xb1')](_0xd17f('0x3e'))){_0x419479[_0xd17f('0x22')]=qs[_0xd17f('0x22')](_0x3c55cb[_0xd17f('0x3a')][_0xd17f('0x22')]);_0x419479[_0xd17f('0x21')]=qs[_0xd17f('0x21')](_0x3c55cb['query']['offset']);}_0x419479[_0xd17f('0x83')]=qs[_0xd17f('0x3f')](_0x3c55cb[_0xd17f('0x3a')][_0xd17f('0x3f')]);_0x419479[_0xd17f('0x40')]=qs[_0xd17f('0x42')](_['pick'](_0x3c55cb[_0xd17f('0x3a')],_0x32fdbc[_0xd17f('0x42')]));_0x419479[_0xd17f('0x40')]['SmsInteractionId']=_0x596c11['id'];if(_0x3c55cb['query'][_0xd17f('0x7b')]){_0x419479[_0xd17f('0x40')]=_[_0xd17f('0x8f')](_0x419479[_0xd17f('0x40')],{'$or':_[_0xd17f('0x2d')](_0x419479['attributes'],function(_0x2c0ff3){var _0x12914e={};_0x12914e[_0x2c0ff3]={'$like':'%'+_0x3c55cb[_0xd17f('0x3a')][_0xd17f('0x7b')]+'%'};return _0x12914e;})});}if(_0x3c55cb[_0xd17f('0x3a')][_0xd17f('0x75')]){var _0x5c5430=_0x3c55cb[_0xd17f('0x3a')][_0xd17f('0x75')]['split'](',');var _0x3be2e9={};_0x3be2e9[_0x5c5430[0x0]]={'$gte':moment(_0x5c5430[0x1])[_0xd17f('0xb2')](_0xd17f('0xb3'))};_0x419479[_0xd17f('0x40')]=_[_0xd17f('0x8f')](_0x419479['where'],_0x3be2e9);}_0x419479=_[_0xd17f('0x8f')]({},_0x419479,_0x3c55cb[_0xd17f('0xa9')]);return db[_0xd17f('0xad')][_0xd17f('0xb4')]({'where':_0x419479[_0xd17f('0x40')]})[_0xd17f('0x27')](function(_0x24e12c){_0x586c5b['count']=_0x24e12c;if(_0x3c55cb[_0xd17f('0x3a')][_0xd17f('0xa7')]){_0x419479['include']=[{'all':!![]}];}return db[_0xd17f('0xad')][_0xd17f('0xb5')](_0x419479);})[_0xd17f('0x27')](function(_0x4fa5dd){_0x586c5b[_0xd17f('0xa4')]=_0x4fa5dd;return _0x586c5b;});}})[_0xd17f('0x27')](respondWithFilteredResult(_0x1a5bec,_0x419479))[_0xd17f('0x33')](handleError(_0x1a5bec,null));};exports[_0xd17f('0xb6')]=function(_0x1a17c7,_0x54d45f,_0x2cba6f){return db[_0xd17f('0x35')][_0xd17f('0x59')]({'where':{'id':_0x1a17c7[_0xd17f('0xa6')]['id']}})['then'](handleEntityNotFound(_0x54d45f,null))[_0xd17f('0x27')](function(_0x9557e5){if(_0x9557e5){return _0x9557e5['setTags'](_0x1a17c7[_0xd17f('0x6d')][_0xd17f('0xaf')],_[_0xd17f('0xb7')](_0x1a17c7[_0xd17f('0x6d')],[_0xd17f('0xaf'),'id'])||{})[_0xd17f('0xb8')](function(){return db[_0xd17f('0x66')]['findAll']({'attributes':['id',_0xd17f('0x2a'),_0xd17f('0x45')],'where':{'id':_0x1a17c7['body']['ids']}});})[_0xd17f('0x27')](function(_0x68d542){socket[_0xd17f('0xb9')]('smsInteractionTags:save',{'id':Number(_0x1a17c7[_0xd17f('0xa6')]['id']),'tags':_0x68d542||[]});return{'id':Number(_0x1a17c7['params']['id']),'tags':_0x68d542||[]};});}})[_0xd17f('0x27')](respondWithResult(_0x54d45f,null))[_0xd17f('0x33')](handleError(_0x54d45f,null));};exports[_0xd17f('0xba')]=function(_0x11fb4e,_0x3f8379,_0x6b3cb2){return db['SmsInteraction'][_0xd17f('0x59')]({'where':{'id':_0x11fb4e['params']['id']}})[_0xd17f('0x27')](handleEntityNotFound(_0x3f8379,null))[_0xd17f('0x27')](function(_0x79b015){if(_0x79b015){return _0x79b015[_0xd17f('0xba')](_0x11fb4e['query'][_0xd17f('0xaf')]);}})[_0xd17f('0x27')](respondWithStatusCode(_0x3f8379,null))[_0xd17f('0x33')](handleError(_0x3f8379,null));};exports['download']=function(_0x2abb84,_0x20b7e6){var _0xeb6b16=moment()[_0xd17f('0xbb')]()[_0xd17f('0x8e')]();var _0x3c7253=path['join'](config['root'],_0xd17f('0xbc'),_0xd17f('0xbd'),_0xd17f('0xbe'));var _0x3add30=path[_0xd17f('0xbf')](config['root'],_0xd17f('0xbc'),_0xd17f('0xbd'),_0xd17f('0xc0'));var _0x4b1a5a=path['join'](_0x3c7253,_0xeb6b16);var _0x18bcd6=util[_0xd17f('0xb2')](_0xd17f('0xc1'),_0x2abb84['params']['id'],_0xeb6b16);var _0x4e3df8=path[_0xd17f('0xbf')](_0x3c7253,_0x18bcd6);var _0x409dbd=[];_0x409dbd[_0xd17f('0x32')]({'model':db[_0xd17f('0x69')],'as':_0xd17f('0x69'),'attributes':['id',_0xd17f('0x2e')],'raw':!![]});_0x409dbd[_0xd17f('0x32')]({'model':db[_0xd17f('0xc2')],'as':_0xd17f('0x5f'),'attributes':['id',_0xd17f('0xc3'),_0xd17f('0xc4')],'raw':!![]});var _0x261495=[{'model':db['SmsMessage'],'as':_0xd17f('0xc5'),'attributes':['id','body',_0xd17f('0x73'),_0xd17f('0xc6'),_0xd17f('0xc7'),_0xd17f('0xc8')],'include':_0x409dbd}];_0x261495[_0xd17f('0x32')]({'model':db[_0xd17f('0xc9')],'as':_0xd17f('0xca'),'attributes':['id',_0xd17f('0x2a')]});_0x261495[_0xd17f('0x32')]({'model':db[_0xd17f('0x69')],'as':_0xd17f('0xcb'),'attributes':['id',_0xd17f('0x2e')]});return db['SmsInteraction'][_0xd17f('0x59')]({'where':{'id':_0x2abb84['params']['id']},'include':_0x261495})['then'](handleEntityNotFound(_0x20b7e6,null))[_0xd17f('0x27')](function(_0x3b795a){if(_0x3b795a){var _0x288664=_0x3b795a[_0xd17f('0xcc')]({'plain':!![]});fs[_0xd17f('0xcd')](_0x4b1a5a);var _0x265684={'channel':_0xd17f('0xce'),'account':_0x288664['Account'][_0xd17f('0x2a')],'agent':_0x288664[_0xd17f('0xcb')]?_0x288664[_0xd17f('0xcb')][_0xd17f('0x2e')]:_0xd17f('0xcf'),'createdAt':moment(_0x288664['createdAt'])[_0xd17f('0xb2')](_0xd17f('0xb3'))['toString'](),'closedAt':_0x288664[_0xd17f('0xd0')]?moment(_0x288664['closedAt'])[_0xd17f('0xb2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd17f('0x8e')]():'','disposition':_0x288664[_0xd17f('0xd1')],'messages':_(_0x288664['Messages'])[_0xd17f('0x7b')]({'secret':![]})['map'](function(_0xe11972){return{'date':moment(_0xe11972['createdAt'])[_0xd17f('0xb2')](_0xd17f('0xb3'))['toString'](),'sender':_0xe11972[_0xd17f('0xc6')]==='out'?_0xe11972['User']?_0xe11972[_0xd17f('0x69')][_0xd17f('0x2e')]:_0xd17f('0xd2'):_0xe11972[_0xd17f('0x5f')][_0xd17f('0xc3')]+(_0xe11972['Contact'][_0xd17f('0xc4')]?'\x20'+_0xe11972[_0xd17f('0x5f')][_0xd17f('0xc4')]:''),'body':_0xe11972[_0xd17f('0x6d')],'direction':_0xe11972[_0xd17f('0xc6')]===_0xd17f('0xd3')?'A':'C','secret':_0xe11972[_0xd17f('0xc7')],'read':_0xe11972[_0xd17f('0xc8')]};})[_0xd17f('0x5b')]()};return ejs[_0xd17f('0xd4')](path['join'](config[_0xd17f('0xd5')],_0xd17f('0xbc'),_0xd17f('0xd6'),_0xd17f('0xd7')),{'interaction':_0x265684})[_0xd17f('0x27')](function(_0x4ac420){var _0x40f221=path['join'](_0x4b1a5a,'transcript-'+_0x288664['id']+'-'+_0xeb6b16+_0xd17f('0xd8'));var _0xb328a9={'path':_0x40f221,'channel':'Sms','interactionId':_0x288664['id']};return pdf[_0xd17f('0xd9')](_0x4ac420,_0xb328a9);})[_0xd17f('0x27')](function(){return new BPromise(function(_0x449db0,_0x2401f9){zipdir(_0x4b1a5a,{'saveTo':_0x4e3df8},function(_0x56638f,_0x260d21){if(_0x56638f)return _0x2401f9(_0x56638f);return _0x449db0(_0x260d21);});})['then'](function(){return new BPromise(function(_0x3e3b78,_0x27cd87){rimraf(_0x4b1a5a,function(_0xd1859a){if(_0xd1859a)_0x27cd87(_0xd1859a);return _0x3e3b78();});});})[_0xd17f('0x27')](function(){return _0x20b7e6[_0xd17f('0xda')](_0x4e3df8,_0x18bcd6,function(_0xa8395d){if(_0xa8395d){console[_0xd17f('0xdb')](_0xd17f('0xdc'),_0xa8395d);}else{fs[_0xd17f('0xdd')](_0x4e3df8);}});});});}else{return _0x20b7e6[_0xd17f('0x1e')](0xc8);}})[_0xd17f('0x33')](handleError(_0x20b7e6,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 5e2e7b6..5b62085 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 _0xb574=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','SmsMessage','save','update','remove','getUsers','map','findAll','then'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0xb574,0x106));var _0x4b57=function(_0x3cb7d3,_0xc272e){_0x3cb7d3=_0x3cb7d3-0x0;var _0x1ecb89=_0xb574[_0x3cb7d3];return _0x1ecb89;};'use strict';var EventEmitter=require(_0x4b57('0x0'));var SmsInteraction=require(_0x4b57('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x4b57('0x1'))['db'][_0x4b57('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4b57('0x3'),'afterUpdate':_0x4b57('0x4'),'afterDestroy':_0x4b57('0x5')};function emitEvent(_0x919851){return function(_0xe2ae86,_0x4a3efa,_0x4eb019){_0xe2ae86[_0x4b57('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x585d86){_0xe2ae86['setDataValue']('Users',_0x585d86[_0x4b57('0x7')](function(_0x2bf397){return{'id':_0x2bf397['id']};}));return SmsMessage[_0x4b57('0x8')]({'where':{'SmsInteractionId':_0xe2ae86['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4b57('0x9')](function(_0xce47ad){_0xe2ae86[_0x4b57('0xa')](_0x4b57('0xb'),_0xce47ad[_0x4b57('0xc')]);SmsInteractionEvents['emit'](_0x919851+':'+_0xe2ae86['id'],_0xe2ae86);SmsInteractionEvents[_0x4b57('0xd')](_0x919851,_0xe2ae86);_0x4eb019(null);})[_0x4b57('0xe')](_0x4eb019(null));};}for(var e in events){if(events[_0x4b57('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x5c3c=['events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','emit','catch','hook','exports'];(function(_0x48e740,_0x2fe555){var _0x2d29d9=function(_0x460c9d){while(--_0x460c9d){_0x48e740['push'](_0x48e740['shift']());}};_0x2d29d9(++_0x2fe555);}(_0x5c3c,0x132));var _0xc5c3=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x5c3c[_0x1ccdf7];return _0x52a0ae;};'use strict';var EventEmitter=require(_0xc5c3('0x0'));var SmsInteraction=require(_0xc5c3('0x1'))['db'][_0xc5c3('0x2')];var SmsMessage=require(_0xc5c3('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc5c3('0x3')](0x0);var events={'afterCreate':_0xc5c3('0x4'),'afterUpdate':_0xc5c3('0x5'),'afterDestroy':_0xc5c3('0x6')};function emitEvent(_0x2535e0){return function(_0x36525d,_0xe85098,_0x23a6b5){_0x36525d[_0xc5c3('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4b8404){_0x36525d['setDataValue'](_0xc5c3('0x8'),_0x4b8404[_0xc5c3('0x9')](function(_0x593b35){return{'id':_0x593b35['id']};}));return SmsMessage[_0xc5c3('0xa')]({'where':{'SmsInteractionId':_0x36525d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc5c3('0xb')](function(_0x52f3eb){_0x36525d[_0xc5c3('0xc')](_0xc5c3('0xd'),_0x52f3eb['length']);SmsInteractionEvents[_0xc5c3('0xe')](_0x2535e0+':'+_0x36525d['id'],_0x36525d);SmsInteractionEvents[_0xc5c3('0xe')](_0x2535e0,_0x36525d);_0x23a6b5(null);})[_0xc5c3('0xf')](_0x23a6b5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xc5c3('0x10')](e,emitEvent(event));}}module[_0xc5c3('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 709bfd5..0e9a24a 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 _0x3ed1=['exports','define','SmsInteraction','closed','closedAt','format','lodash','util','../../config/logger','request-promise','rimraf','../../config/environment','./smsInteraction.attributes'];(function(_0x4e19d0,_0x12a23c){var _0x23c21c=function(_0x17ee53){while(--_0x17ee53){_0x4e19d0['push'](_0x4e19d0['shift']());}};_0x23c21c(++_0x12a23c);}(_0x3ed1,0x6e));var _0x13ed=function(_0x454d94,_0x2d5642){_0x454d94=_0x454d94-0x0;var _0x1389b0=_0x3ed1[_0x454d94];return _0x1389b0;};'use strict';var _=require(_0x13ed('0x0'));var util=require(_0x13ed('0x1'));var logger=require(_0x13ed('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x13ed('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x13ed('0x4'));var config=require(_0x13ed('0x5'));var attributes=require(_0x13ed('0x6'));module[_0x13ed('0x7')]=function(_0x55272e,_0xfafd21){return _0x55272e[_0x13ed('0x8')](_0x13ed('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15635d,_0x3d2622,_0x180970){if(_0x15635d['changed'](_0x13ed('0xa'))){_0x15635d[_0x13ed('0xb')]=moment()[_0x13ed('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x180970(null,_0x15635d);}}});}; \ No newline at end of file +var _0x61a6=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions'];(function(_0x2cdf8c,_0x258633){var _0x12f054=function(_0x5bd3e2){while(--_0x5bd3e2){_0x2cdf8c['push'](_0x2cdf8c['shift']());}};_0x12f054(++_0x258633);}(_0x61a6,0x147));var _0x661a=function(_0x26f5e4,_0x4efb0f){_0x26f5e4=_0x26f5e4-0x0;var _0x1a107c=_0x61a6[_0x26f5e4];return _0x1a107c;};'use strict';var _=require(_0x661a('0x0'));var util=require(_0x661a('0x1'));var logger=require(_0x661a('0x2'))('api');var moment=require(_0x661a('0x3'));var BPromise=require(_0x661a('0x4'));var rp=require(_0x661a('0x5'));var fs=require('fs');var path=require(_0x661a('0x6'));var rimraf=require(_0x661a('0x7'));var config=require(_0x661a('0x8'));var attributes=require(_0x661a('0x9'));module[_0x661a('0xa')]=function(_0x19bac9,_0xafd478){return _0x19bac9['define'](_0x661a('0xb'),attributes,{'tableName':_0x661a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a2a02,_0x4a04ef,_0x9a31e7){if(_0x5a2a02[_0x661a('0xd')](_0x661a('0xe'))){_0x5a2a02[_0x661a('0xf')]=moment()['format'](_0x661a('0x10'));}_0x9a31e7(null,_0x5a2a02);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index cc40f34..2093c6f 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 _0x79a2=['register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','debug','stringify','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x79a2,0x1d2));var _0x279a=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x79a2[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x279a('0x0'));var util=require(_0x279a('0x1'));var moment=require(_0x279a('0x2'));var BPromise=require(_0x279a('0x3'));var rs=require(_0x279a('0x4'));var fs=require('fs');var Redis=require(_0x279a('0x5'));var db=require(_0x279a('0x6'))['db'];var utils=require(_0x279a('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x279a('0x8'));var jayson=require(_0x279a('0x9'));var client=jayson['client'][_0x279a('0xa')]({'port':0x232a});config[_0x279a('0xb')]=_['defaults'](config[_0x279a('0xb')],{'host':_0x279a('0xc'),'port':0x18eb});var socket=require(_0x279a('0xd'))(new Redis(config[_0x279a('0xb')]));require('./smsInteraction.socket')[_0x279a('0xe')](socket);function respondWithRpcPromise(_0x10c7cf,_0xaad635,_0x3e28ba){return new BPromise(function(_0x71cf87,_0x21e2ee){return client[_0x279a('0xf')](_0x10c7cf,_0x3e28ba)[_0x279a('0x10')](function(_0x2a78d7){logger[_0x279a('0x11')](_0x279a('0x12'),_0xaad635,_0x279a('0x13'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0xaad635,_0x279a('0x13'),JSON['stringify'](_0x2a78d7));if(_0x2a78d7[_0x279a('0x14')]){if(_0x2a78d7[_0x279a('0x14')][_0x279a('0x15')]===0x1f4){logger[_0x279a('0x14')](_0x279a('0x12'),_0xaad635,_0x2a78d7[_0x279a('0x14')][_0x279a('0x16')]);return _0x21e2ee(_0x2a78d7[_0x279a('0x14')][_0x279a('0x16')]);}logger[_0x279a('0x14')](_0x279a('0x12'),_0xaad635,_0x2a78d7[_0x279a('0x14')][_0x279a('0x16')]);return _0x71cf87(_0x2a78d7[_0x279a('0x14')][_0x279a('0x16')]);}else{logger['info'](_0x279a('0x12'),_0xaad635,'request\x20sent');_0x71cf87(_0x2a78d7[_0x279a('0x17')][_0x279a('0x16')]);}})[_0x279a('0x18')](function(_0x2bd604){logger['error'](_0x279a('0x12'),_0xaad635,_0x2bd604);_0x21e2ee(_0x2bd604);});});}exports[_0x279a('0x19')]=function(_0xe3a825){var _0x3f4ed1=this;return new Promise(function(_0x3e14ad,_0x451348){return db[_0x279a('0x1a')][_0x279a('0x1b')](_0xe3a825[_0x279a('0x1c')],{'raw':_0xe3a825['options']?_0xe3a825[_0x279a('0x1d')][_0x279a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe3a825[_0x279a('0x1d')]?_0xe3a825[_0x279a('0x1d')][_0x279a('0x1f')]||null:null,'attributes':_0xe3a825['options']?_0xe3a825[_0x279a('0x1d')][_0x279a('0x20')]||null:null,'limit':_0xe3a825['options']?_0xe3a825[_0x279a('0x1d')][_0x279a('0x21')]||null:null})[_0x279a('0x10')](function(_0x51b2fb){logger[_0x279a('0x11')]('UpdateSmsInteraction',_0xe3a825);logger[_0x279a('0x22')](_0x279a('0x19'),_0xe3a825,JSON[_0x279a('0x23')](_0x51b2fb));_0x3e14ad(_0x51b2fb);})[_0x279a('0x18')](function(_0x4b3c69){logger[_0x279a('0x14')](_0x279a('0x19'),_0x4b3c69[_0x279a('0x16')],_0xe3a825);_0x451348(_0x3f4ed1['error'](0x1f4,_0x4b3c69['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x4018be){return new Promise(function(_0xc8e46e,_0x43bf48){return db[_0x279a('0x1a')]['find']({'where':_0x4018be[_0x279a('0x1d')]?_0x4018be['options'][_0x279a('0x1f')]||null:null})['then'](function(_0x53cfc5){if(_0x53cfc5){return _0x53cfc5[_0x279a('0x24')](_0x4018be['body'][_0x279a('0x25')],_[_0x279a('0x26')](_0x4018be[_0x279a('0x1c')],[_0x279a('0x25'),'id'])||{});}})['spread'](function(_0x48ef1d){logger['info'](_0x279a('0x27'),_0x4018be);logger['debug']('AddTags',_0x4018be,JSON[_0x279a('0x23')](_0x48ef1d));_0xc8e46e(_0x48ef1d);})[_0x279a('0x18')](function(_0x650c5d){logger[_0x279a('0x14')](_0x279a('0x27'),_0x650c5d['message'],_0x4018be);_0x43bf48(_this[_0x279a('0x14')](0x1f4,_0x650c5d[_0x279a('0x16')]));});});}; \ No newline at end of file +var _0xcb76=['message','result','catch','UpdateSmsInteraction','update','options','raw','AddTagsToSmsInteraction','SmsInteraction','find','where','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2e27e8,_0x5488bd){var _0x529cfb=function(_0x38770e){while(--_0x38770e){_0x2e27e8['push'](_0x2e27e8['shift']());}};_0x529cfb(++_0x5488bd);}(_0xcb76,0x106));var _0x6cb7=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xcb76[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0x6cb7('0x0'));var util=require(_0x6cb7('0x1'));var moment=require(_0x6cb7('0x2'));var BPromise=require(_0x6cb7('0x3'));var rs=require(_0x6cb7('0x4'));var fs=require('fs');var Redis=require(_0x6cb7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6cb7('0x6'))(_0x6cb7('0x7'));var config=require(_0x6cb7('0x8'));var jayson=require(_0x6cb7('0x9'));var client=jayson['client'][_0x6cb7('0xa')]({'port':0x232a});config[_0x6cb7('0xb')]=_['defaults'](config[_0x6cb7('0xb')],{'host':_0x6cb7('0xc'),'port':0x18eb});var socket=require(_0x6cb7('0xd'))(new Redis(config['redis']));require(_0x6cb7('0xe'))[_0x6cb7('0xf')](socket);function respondWithRpcPromise(_0x3c5c5b,_0x3eb7bf,_0x3955b2){return new BPromise(function(_0x1301f5,_0x1dc2c5){return client['request'](_0x3c5c5b,_0x3955b2)[_0x6cb7('0x10')](function(_0x1cf37b){logger[_0x6cb7('0x11')](_0x6cb7('0x12'),_0x3eb7bf,_0x6cb7('0x13'));logger[_0x6cb7('0x14')](_0x6cb7('0x15'),_0x3eb7bf,_0x6cb7('0x13'),JSON[_0x6cb7('0x16')](_0x1cf37b));if(_0x1cf37b[_0x6cb7('0x17')]){if(_0x1cf37b[_0x6cb7('0x17')][_0x6cb7('0x18')]===0x1f4){logger['error'](_0x6cb7('0x12'),_0x3eb7bf,_0x1cf37b[_0x6cb7('0x17')][_0x6cb7('0x19')]);return _0x1dc2c5(_0x1cf37b[_0x6cb7('0x17')][_0x6cb7('0x19')]);}logger[_0x6cb7('0x17')](_0x6cb7('0x12'),_0x3eb7bf,_0x1cf37b[_0x6cb7('0x17')]['message']);return _0x1301f5(_0x1cf37b['error'][_0x6cb7('0x19')]);}else{logger[_0x6cb7('0x11')](_0x6cb7('0x12'),_0x3eb7bf,_0x6cb7('0x13'));_0x1301f5(_0x1cf37b[_0x6cb7('0x1a')][_0x6cb7('0x19')]);}})[_0x6cb7('0x1b')](function(_0x2ac09f){logger[_0x6cb7('0x17')](_0x6cb7('0x12'),_0x3eb7bf,_0x2ac09f);_0x1dc2c5(_0x2ac09f);});});}exports[_0x6cb7('0x1c')]=function(_0x109957){var _0x297fb1=this;return new Promise(function(_0x546034,_0x15211a){return db['SmsInteraction'][_0x6cb7('0x1d')](_0x109957['body'],{'raw':_0x109957['options']?_0x109957[_0x6cb7('0x1e')][_0x6cb7('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x109957['options']?_0x109957['options']['where']||null:null,'attributes':_0x109957[_0x6cb7('0x1e')]?_0x109957[_0x6cb7('0x1e')]['attributes']||null:null,'limit':_0x109957[_0x6cb7('0x1e')]?_0x109957[_0x6cb7('0x1e')]['limit']||null:null})[_0x6cb7('0x10')](function(_0x4584ba){logger[_0x6cb7('0x11')](_0x6cb7('0x1c'),_0x109957);logger[_0x6cb7('0x14')]('UpdateSmsInteraction',_0x109957,JSON[_0x6cb7('0x16')](_0x4584ba));_0x546034(_0x4584ba);})['catch'](function(_0x3a9eb9){logger[_0x6cb7('0x17')](_0x6cb7('0x1c'),_0x3a9eb9[_0x6cb7('0x19')],_0x109957);_0x15211a(_0x297fb1[_0x6cb7('0x17')](0x1f4,_0x3a9eb9[_0x6cb7('0x19')]));});});};exports[_0x6cb7('0x20')]=function(_0x42bdbb){return new Promise(function(_0xea2484,_0x1b1125){return db[_0x6cb7('0x21')][_0x6cb7('0x22')]({'where':_0x42bdbb[_0x6cb7('0x1e')]?_0x42bdbb[_0x6cb7('0x1e')][_0x6cb7('0x23')]||null:null})[_0x6cb7('0x10')](function(_0x470483){if(_0x470483){return _0x470483['addTags'](_0x42bdbb[_0x6cb7('0x24')][_0x6cb7('0x25')],_[_0x6cb7('0x26')](_0x42bdbb[_0x6cb7('0x24')],[_0x6cb7('0x25'),'id'])||{});}})[_0x6cb7('0x27')](function(_0x478788){logger[_0x6cb7('0x11')](_0x6cb7('0x28'),_0x42bdbb);logger['debug'](_0x6cb7('0x28'),_0x42bdbb,JSON[_0x6cb7('0x16')](_0x478788));_0xea2484(_0x478788);})[_0x6cb7('0x1b')](function(_0x1187db){logger[_0x6cb7('0x17')](_0x6cb7('0x28'),_0x1187db[_0x6cb7('0x19')],_0x42bdbb);_0x1b1125(_this['error'](0x1f4,_0x1187db['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 2070154..9be0e8c 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 _0x8cb2=['./smsInteraction.events','save','remove','removeListener','register','length','smsInteraction:'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x8cb2,0xb6));var _0x28cb=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8cb2[_0x167cc1];return _0x10bc4b;};'use strict';var SmsInteractionEvents=require(_0x28cb('0x0'));var events=[_0x28cb('0x1'),_0x28cb('0x2'),'update'];function createListener(_0x5f1885,_0x231f92){return function(_0x10cd47){_0x231f92['emit'](_0x5f1885,_0x10cd47);};}function removeListener(_0x51d9ba,_0x4f8c89){return function(){SmsInteractionEvents[_0x28cb('0x3')](_0x51d9ba,_0x4f8c89);};}exports[_0x28cb('0x4')]=function(_0x5da5e6){for(var _0x5119ef=0x0,_0x5dd5b4=events[_0x28cb('0x5')];_0x5119ef<_0x5dd5b4;_0x5119ef++){var _0x69af53=events[_0x5119ef];var _0x5b5ea0=createListener(_0x28cb('0x6')+_0x69af53,_0x5da5e6);SmsInteractionEvents['on'](_0x69af53,_0x5b5ea0);}}; \ No newline at end of file +var _0xb5bb=['emit','removeListener','register','smsInteraction:','save','update'];(function(_0x3a8243,_0x2b5cdf){var _0x8f50c8=function(_0x3bfd62){while(--_0x3bfd62){_0x3a8243['push'](_0x3a8243['shift']());}};_0x8f50c8(++_0x2b5cdf);}(_0xb5bb,0x11e));var _0xbb5b=function(_0x1a1cb3,_0x2455f5){_0x1a1cb3=_0x1a1cb3-0x0;var _0x33f471=_0xb5bb[_0x1a1cb3];return _0x33f471;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xbb5b('0x0'),'remove',_0xbb5b('0x1')];function createListener(_0x40f72d,_0x5d43da){return function(_0x3e9651){_0x5d43da[_0xbb5b('0x2')](_0x40f72d,_0x3e9651);};}function removeListener(_0x5542f6,_0x598168){return function(){SmsInteractionEvents[_0xbb5b('0x3')](_0x5542f6,_0x598168);};}exports[_0xbb5b('0x4')]=function(_0x2f36d0){for(var _0x4100ef=0x0,_0x87039e=events['length'];_0x4100ef<_0x87039e;_0x4100ef++){var _0x4e1cb0=events[_0x4100ef];var _0x157dad=createListener(_0xbb5b('0x5')+_0x4e1cb0,_0x2f36d0);SmsInteractionEvents['on'](_0x4e1cb0,_0x157dad);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index df1efae..9549c0f 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 _0x7980=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','update','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7980,0x123));var _0x0798=function(_0x394dee,_0x36ef0d){_0x394dee=_0x394dee-0x0;var _0x320f72=_0x7980[_0x394dee];return _0x320f72;};'use strict';var multer=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var path=require('path');var timeout=require(_0x0798('0x2'));var express=require(_0x0798('0x3'));var router=express[_0x0798('0x4')]();var fs_extra=require(_0x0798('0x5'));var auth=require(_0x0798('0x6'));var interaction=require(_0x0798('0x7'));var config=require(_0x0798('0x8'));var controller=require(_0x0798('0x9'));router['get']('/',auth[_0x0798('0xa')](),controller[_0x0798('0xb')]);router[_0x0798('0xc')](_0x0798('0xd'),auth[_0x0798('0xa')](),controller[_0x0798('0xe')]);router['get'](_0x0798('0xf'),auth[_0x0798('0xa')](),controller[_0x0798('0x10')]);router[_0x0798('0x11')]('/',auth[_0x0798('0xa')](),interaction[_0x0798('0x12')](_0x0798('0x13'),_0x0798('0x14')),controller[_0x0798('0x15')]);router[_0x0798('0x11')](_0x0798('0x16'),controller[_0x0798('0x17')]);router['put'](_0x0798('0xf'),auth['isAuthenticated'](),controller[_0x0798('0x18')]);router['put'](_0x0798('0x19'),auth['isAuthenticated'](),controller[_0x0798('0x1a')]);router[_0x0798('0x1b')](_0x0798('0x1c'),auth[_0x0798('0xa')](),controller[_0x0798('0x1d')]);router[_0x0798('0x1e')](_0x0798('0xf'),auth[_0x0798('0xa')](),controller[_0x0798('0x1f')]);module[_0x0798('0x20')]=router; \ No newline at end of file +var _0xc1a2=['put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','/:id/status','status'];(function(_0x563198,_0x402e1a){var _0x58961d=function(_0x2efa72){while(--_0x2efa72){_0x563198['push'](_0x563198['shift']());}};_0x58961d(++_0x402e1a);}(_0xc1a2,0x148));var _0x2c1a=function(_0x297893,_0x44666b){_0x297893=_0x297893-0x0;var _0x413dc5=_0xc1a2[_0x297893];return _0x413dc5;};'use strict';var multer=require(_0x2c1a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2c1a('0x1'));var express=require(_0x2c1a('0x2'));var router=express[_0x2c1a('0x3')]();var fs_extra=require(_0x2c1a('0x4'));var auth=require(_0x2c1a('0x5'));var interaction=require(_0x2c1a('0x6'));var config=require('../../config/environment');var controller=require(_0x2c1a('0x7'));router[_0x2c1a('0x8')]('/',auth[_0x2c1a('0x9')](),controller[_0x2c1a('0xa')]);router['get'](_0x2c1a('0xb'),auth[_0x2c1a('0x9')](),controller[_0x2c1a('0xc')]);router['get'](_0x2c1a('0xd'),auth[_0x2c1a('0x9')](),controller[_0x2c1a('0xe')]);router[_0x2c1a('0xf')]('/',auth[_0x2c1a('0x9')](),interaction[_0x2c1a('0x10')](_0x2c1a('0x11'),'smsmessage:create'),controller['create']);router[_0x2c1a('0xf')](_0x2c1a('0x12'),controller[_0x2c1a('0x13')]);router[_0x2c1a('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x2c1a('0x15')]);router[_0x2c1a('0x14')](_0x2c1a('0x16'),auth[_0x2c1a('0x9')](),controller[_0x2c1a('0x17')]);router[_0x2c1a('0x14')](_0x2c1a('0x18'),auth[_0x2c1a('0x9')](),controller[_0x2c1a('0x19')]);router[_0x2c1a('0x1a')](_0x2c1a('0xd'),auth[_0x2c1a('0x9')](),controller[_0x2c1a('0x1b')]);module[_0x2c1a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 38c54a3..b393e05 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 _0x96dc=['exports','medium','BOOLEAN','ENUM','out','STRING','TEXT'];(function(_0xc98e40,_0xa814ad){var _0x48b378=function(_0x240f0a){while(--_0x240f0a){_0xc98e40['push'](_0xc98e40['shift']());}};_0x48b378(++_0xa814ad);}(_0x96dc,0x134));var _0xc96d=function(_0x4c812e,_0x2c9c6d){_0x4c812e=_0x4c812e-0x0;var _0x56c0de=_0x96dc[_0x4c812e];return _0x56c0de;};'use strict';var Sequelize=require('sequelize');module[_0xc96d('0x0')]={'body':{'type':Sequelize['TEXT'](_0xc96d('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc96d('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc96d('0x3')]('in','out'),'defaultValue':_0xc96d('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc96d('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xc96d('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc96d('0x6')]}}; \ No newline at end of file +var _0x4579=['ENUM','out','STRING','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x4579,0x164));var _0x9457=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4579[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x9457('0x0'));module['exports']={'body':{'type':Sequelize[_0x9457('0x1')](_0x9457('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9457('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9457('0x4')]('in',_0x9457('0x5')),'defaultValue':_0x9457('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9457('0x6')](0xbe)},'phone':{'type':Sequelize[_0x9457('0x6')]},'readAt':{'type':Sequelize[_0x9457('0x7')]},'secret':{'type':Sequelize[_0x9457('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9457('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 165d516..cfe4c8e 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 _0x4955=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','request','then','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','info','result','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','../../config/logger','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','agent','fullname','manual','interface','channel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','Sequelize','email','internal','SIP/%s','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x3e8be2,_0x3c1753){var _0x2c764e=function(_0x13b4d9){while(--_0x13b4d9){_0x3e8be2['push'](_0x3e8be2['shift']());}};_0x2c764e(++_0x3c1753);}(_0x4955,0x12a));var _0x5495=function(_0xe11d1e,_0x5db72b){_0xe11d1e=_0xe11d1e-0x0;var _0x5b0b27=_0x4955[_0xe11d1e];return _0x5b0b27;};'use strict';var emlformat=require(_0x5495('0x0'));var rimraf=require(_0x5495('0x1'));var zipdir=require(_0x5495('0x2'));var jsonpatch=require(_0x5495('0x3'));var rp=require(_0x5495('0x4'));var moment=require('moment');var BPromise=require(_0x5495('0x5'));var Mustache=require(_0x5495('0x6'));var util=require(_0x5495('0x7'));var path=require(_0x5495('0x8'));var sox=require(_0x5495('0x9'));var csv=require(_0x5495('0xa'));var ejs=require(_0x5495('0xb'));var fs=require('fs');var fs_extra=require(_0x5495('0xc'));var _=require(_0x5495('0xd'));var squel=require(_0x5495('0xe'));var crypto=require(_0x5495('0xf'));var jsforce=require(_0x5495('0x10'));var deskjs=require(_0x5495('0x11'));var toCsv=require(_0x5495('0xa'));var querystring=require(_0x5495('0x12'));var Papa=require(_0x5495('0x13'));var Redis=require(_0x5495('0x14'));var authService=require(_0x5495('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x5495('0x16'));var hardwareService=require(_0x5495('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x5495('0x18'));var config=require(_0x5495('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5495('0x1a'))['db'];config['redis']=_[_0x5495('0x1b')](config[_0x5495('0x1c')],{'host':_0x5495('0x1d'),'port':0x18eb});var socket=require(_0x5495('0x1e'))(new Redis(config[_0x5495('0x1c')]));require(_0x5495('0x1f'))['register'](socket);var jayson=require(_0x5495('0x20'));var client=jayson[_0x5495('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x5495('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x345060,_0x3a4914,_0x4d36e8,_0x12d530){return new BPromise(function(_0x4a3f75,_0x993172){var _0x5c4f90=_0x12d530||client;return _0x5c4f90[_0x5495('0x22')](_0x345060,_0x4d36e8)[_0x5495('0x23')](function(_0x370798){logger['info']('SmsMessage,\x20%s,\x20%s',_0x3a4914,'request\x20sent');logger[_0x5495('0x24')](_0x5495('0x25'),_0x3a4914,_0x5495('0x26'),JSON[_0x5495('0x27')](_0x370798));if(_0x370798[_0x5495('0x28')]){if(_0x370798[_0x5495('0x28')][_0x5495('0x29')]===0x1f4){logger[_0x5495('0x28')](_0x5495('0x2a'),_0x3a4914,_0x370798[_0x5495('0x28')][_0x5495('0x2b')]);return _0x993172(_0x370798['error'][_0x5495('0x2b')]);}logger[_0x5495('0x28')](_0x5495('0x2a'),_0x3a4914,_0x370798[_0x5495('0x28')][_0x5495('0x2b')]);return _0x4a3f75(_0x370798[_0x5495('0x28')]['message']);}else{logger[_0x5495('0x2c')](_0x5495('0x2a'),_0x3a4914,'request\x20sent');_0x4a3f75(_0x370798[_0x5495('0x2d')]['message']);}})['catch'](function(_0x16ad20){logger[_0x5495('0x28')](_0x5495('0x2a'),_0x3a4914,_0x16ad20);_0x993172(_0x16ad20);});});}function respondWithStatusCode(_0x4aeddf,_0x1729c7){_0x1729c7=_0x1729c7||0xcc;return function(_0x51c523){if(_0x51c523){return _0x4aeddf[_0x5495('0x2e')](_0x1729c7);}return _0x4aeddf[_0x5495('0x2f')](_0x1729c7)[_0x5495('0x30')]();};}function respondWithResult(_0x21b6de,_0x367dfa){_0x367dfa=_0x367dfa||0xc8;return function(_0x1b9bf0){if(_0x1b9bf0){return _0x21b6de[_0x5495('0x2f')](_0x367dfa)[_0x5495('0x31')](_0x1b9bf0);}};}function respondWithFilteredResult(_0x2e7ebc,_0x2d7ba9){return function(_0x415635){if(_0x415635){var _0x5b4be3=typeof _0x2d7ba9['offset']===_0x5495('0x32')&&typeof _0x2d7ba9['limit']===_0x5495('0x32');var _0x4425e3=_0x415635[_0x5495('0x33')];var _0x1f926c=_0x5b4be3?0x0:_0x2d7ba9[_0x5495('0x34')];var _0xc33b83=_0x5b4be3?_0x415635[_0x5495('0x33')]:_0x2d7ba9[_0x5495('0x34')]+_0x2d7ba9[_0x5495('0x35')];var _0x4ed285;if(_0xc33b83>=_0x4425e3){_0xc33b83=_0x4425e3;_0x4ed285=0xc8;}else{_0x4ed285=0xce;}_0x2e7ebc[_0x5495('0x2f')](_0x4ed285);return _0x2e7ebc[_0x5495('0x36')]('Content-Range',_0x1f926c+'-'+_0xc33b83+'/'+_0x4425e3)[_0x5495('0x31')](_0x415635);}return null;};}function patchUpdates(_0x11207f){return function(_0x28955a){try{jsonpatch['apply'](_0x28955a,_0x11207f,!![]);}catch(_0x5579e9){return BPromise[_0x5495('0x37')](_0x5579e9);}return _0x28955a['save']();};}function saveUpdates(_0x43f1a8,_0x19d765){return function(_0xf60c88){if(_0xf60c88){return _0xf60c88[_0x5495('0x38')](_0x43f1a8)[_0x5495('0x23')](function(_0x320093){return _0x320093;});}return null;};}function removeEntity(_0x19cd12,_0x57d1d7){return function(_0x4cd79f){if(_0x4cd79f){return _0x4cd79f[_0x5495('0x39')]()[_0x5495('0x23')](function(){_0x19cd12['status'](0xcc)[_0x5495('0x30')]();});}};}function handleEntityNotFound(_0x14b2c4,_0x2192c7){return function(_0x1301d6){if(!_0x1301d6){_0x14b2c4['sendStatus'](0x194);}return _0x1301d6;};}function handleError(_0x4311e6,_0x44ed6c){_0x44ed6c=_0x44ed6c||0x1f4;return function(_0x519b1b){logger['error'](_0x519b1b[_0x5495('0x3a')]);if(_0x519b1b[_0x5495('0x3b')]){delete _0x519b1b[_0x5495('0x3b')];}_0x4311e6['status'](_0x44ed6c)[_0x5495('0x3c')](_0x519b1b);};}exports[_0x5495('0x3d')]=function(_0x26fd90,_0x438b1c){var _0x4ea53a={},_0x361839={},_0xfbb4df={'count':0x0,'rows':[]};var _0x3d739c=_[_0x5495('0x3e')](db[_0x5495('0x3f')][_0x5495('0x40')],function(_0x41331e){return{'name':_0x41331e[_0x5495('0x41')],'type':_0x41331e['type'][_0x5495('0x42')]};});_0x361839[_0x5495('0x43')]=_[_0x5495('0x3e')](_0x3d739c,_0x5495('0x3b'));_0x361839['query']=_[_0x5495('0x44')](_0x26fd90[_0x5495('0x45')]);_0x361839[_0x5495('0x46')]=_[_0x5495('0x47')](_0x361839['model'],_0x361839['query']);_0x4ea53a['attributes']=_[_0x5495('0x47')](_0x361839['model'],qs[_0x5495('0x48')](_0x26fd90['query'][_0x5495('0x48')]));_0x4ea53a[_0x5495('0x49')]=_0x4ea53a[_0x5495('0x49')][_0x5495('0x4a')]?_0x4ea53a[_0x5495('0x49')]:_0x361839['model'];if(!_0x26fd90[_0x5495('0x45')][_0x5495('0x4b')]('nolimit')){_0x4ea53a[_0x5495('0x35')]=qs[_0x5495('0x35')](_0x26fd90[_0x5495('0x45')][_0x5495('0x35')]);_0x4ea53a['offset']=qs['offset'](_0x26fd90[_0x5495('0x45')][_0x5495('0x34')]);}_0x4ea53a[_0x5495('0x4c')]=qs[_0x5495('0x4d')](_0x26fd90['query']['sort']);_0x4ea53a[_0x5495('0x4e')]=qs[_0x5495('0x46')](_[_0x5495('0x4f')](_0x26fd90['query'],_0x361839['filters']),_0x3d739c);if(_0x26fd90['query'][_0x5495('0x50')]){_0x4ea53a['where']=_[_0x5495('0x51')](_0x4ea53a[_0x5495('0x4e')],{'$or':_[_0x5495('0x3e')](_0x3d739c,function(_0x1f1836){if(_0x1f1836['type']!==_0x5495('0x52')){var _0x44641a={};_0x44641a[_0x1f1836['name']]={'$like':'%'+_0x26fd90[_0x5495('0x45')][_0x5495('0x50')]+'%'};return _0x44641a;}})});}_0x4ea53a=_[_0x5495('0x51')]({},_0x4ea53a,_0x26fd90[_0x5495('0x53')]);var _0x51003b={'where':_0x4ea53a[_0x5495('0x4e')]};return db[_0x5495('0x3f')]['count'](_0x51003b)[_0x5495('0x23')](function(_0x5ea1ed){_0xfbb4df['count']=_0x5ea1ed;if(_0x26fd90[_0x5495('0x45')][_0x5495('0x54')]){_0x4ea53a[_0x5495('0x55')]=[{'all':!![]}];}return db[_0x5495('0x3f')]['findAll'](_0x4ea53a);})[_0x5495('0x23')](function(_0x2ac72d){_0xfbb4df[_0x5495('0x56')]=_0x2ac72d;return _0xfbb4df;})['then'](respondWithFilteredResult(_0x438b1c,_0x4ea53a))[_0x5495('0x57')](handleError(_0x438b1c,null));};exports[_0x5495('0x58')]=function(_0xd117cb,_0x39d225){var _0x3aa515={'raw':!![],'where':{'id':_0xd117cb[_0x5495('0x59')]['id']}},_0x270696={};_0x270696['model']=_[_0x5495('0x44')](db['SmsMessage'][_0x5495('0x40')]);_0x270696[_0x5495('0x45')]=_[_0x5495('0x44')](_0xd117cb['query']);_0x270696[_0x5495('0x46')]=_[_0x5495('0x47')](_0x270696[_0x5495('0x43')],_0x270696[_0x5495('0x45')]);_0x3aa515[_0x5495('0x49')]=_['intersection'](_0x270696[_0x5495('0x43')],qs[_0x5495('0x48')](_0xd117cb[_0x5495('0x45')]['fields']));_0x3aa515[_0x5495('0x49')]=_0x3aa515[_0x5495('0x49')][_0x5495('0x4a')]?_0x3aa515[_0x5495('0x49')]:_0x270696[_0x5495('0x43')];if(_0xd117cb[_0x5495('0x45')][_0x5495('0x54')]){_0x3aa515[_0x5495('0x55')]=[{'all':!![]}];}_0x3aa515=_['merge']({},_0x3aa515,_0xd117cb['options']);return db[_0x5495('0x3f')][_0x5495('0x5a')](_0x3aa515)[_0x5495('0x23')](handleEntityNotFound(_0x39d225,null))['then'](respondWithResult(_0x39d225,null))['catch'](handleError(_0x39d225,null));};exports['create']=function(_0x2fbac2,_0x2ed633){return db[_0x5495('0x3f')][_0x5495('0x5b')](_0x2fbac2['body'],{})[_0x5495('0x23')](respondWithResult(_0x2ed633,0xc9))['catch'](handleError(_0x2ed633,null));};exports['update']=function(_0x27cfc3,_0x1f2aaf){if(_0x27cfc3[_0x5495('0x5c')]['id']){delete _0x27cfc3[_0x5495('0x5c')]['id'];}return db['SmsMessage'][_0x5495('0x5a')]({'where':{'id':_0x27cfc3[_0x5495('0x59')]['id']}})[_0x5495('0x23')](handleEntityNotFound(_0x1f2aaf,null))[_0x5495('0x23')](saveUpdates(_0x27cfc3[_0x5495('0x5c')],null))['then'](respondWithResult(_0x1f2aaf,null))[_0x5495('0x57')](handleError(_0x1f2aaf,null));};exports[_0x5495('0x39')]=function(_0x2ae086,_0x3acb5d){return db[_0x5495('0x3f')]['find']({'where':{'id':_0x2ae086[_0x5495('0x59')]['id']}})[_0x5495('0x23')](handleEntityNotFound(_0x3acb5d,null))['then'](removeEntity(_0x3acb5d,null))['catch'](handleError(_0x3acb5d,null));};exports[_0x5495('0x5d')]=function(_0x9f6be7,_0x459a3a){return db[_0x5495('0x3f')][_0x5495('0x5d')]()[_0x5495('0x23')](respondWithResult(_0x459a3a,null))[_0x5495('0x57')](handleError(_0x459a3a,null));};var interaction_log=require(_0x5495('0x5e'))(_0x5495('0x5f'));exports['accept']=function(_0x37d34f,_0xb76603,_0x20c815){var _0x430ae9={'agent':{},'channel':_0x5495('0x60')};if(_0x37d34f[_0x5495('0x5c')]['id']){delete _0x37d34f[_0x5495('0x5c')]['id'];}_0x37d34f[_0x5495('0x5c')][_0x5495('0x61')]=!![];_0x37d34f['body'][_0x5495('0x62')]=moment()[_0x5495('0x63')](_0x5495('0x64'));_0x37d34f[_0x5495('0x5c')][_0x5495('0x65')]=_0x37d34f[_0x5495('0x5c')]['UserId']||_0x37d34f[_0x5495('0x66')]['id'];_0x430ae9['agent']['id']=_0x37d34f[_0x5495('0x5c')]['UserId'];return db[_0x5495('0x3f')][_0x5495('0x5a')]({'where':{'id':_0x37d34f[_0x5495('0x59')]['id'],'UserId':null}})[_0x5495('0x23')](handleEntityNotFound(_0xb76603,null))['then'](saveUpdates(_0x37d34f['body'],null))[_0x5495('0x23')](function(_0x373f04){if(_0x373f04){_0x430ae9[_0x5495('0x2b')]=_0x373f04[_0x5495('0x67')]({'plain':!![]});return db[_0x5495('0x68')][_0x5495('0x5a')]({'where':{'id':_0x373f04[_0x5495('0x69')]}});}return null;})[_0x5495('0x23')](handleEntityNotFound(_0xb76603,null))['then'](function(_0x12cd75){if(_0x12cd75){return _0x12cd75[_0x5495('0x38')]({'UserId':_0x37d34f[_0x5495('0x5c')][_0x5495('0x65')],'read1stAt':_[_0x5495('0x6a')](_0x12cd75[_0x5495('0x6b')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x317b8c){if(_0x317b8c){_0x430ae9[_0x5495('0x6c')]=_0x317b8c['get']({'plain':!![]});interaction_log[_0x5495('0x2c')](_0x5495('0x6d'),_0x37d34f[_0x5495('0x66')]['id'],_0x37d34f[_0x5495('0x66')][_0x5495('0x3b')],_0x37d34f[_0x5495('0x66')][_0x5495('0x6e')],_0x430ae9['interaction']['id'],_0x37d34f[_0x5495('0x5c')]?JSON['stringify'](_0x37d34f[_0x5495('0x5c')]):'null');return respondWithRpcPromise('AcceptMessage',_0x5495('0x6f'),_0x430ae9);}return null;})['then'](function(_0x336c09){var _0x1e9dde=_0x5495('0x70')+_0x336c09[_0x5495('0x2b')][_0x5495('0x71')];return db[_0x5495('0x72')][_0x5495('0x45')](_0x1e9dde,{'type':db['Sequelize'][_0x5495('0x73')][_0x5495('0x74')],'raw':!![]})[_0x5495('0x23')](function(_0xaf0148){return _0xaf0148;});})[_0x5495('0x23')](function(_0x1c3797){if(_0x1c3797){_0x430ae9['message'][_0x5495('0x75')]=_0x1c3797[0x0];if(!_0x37d34f['body'][_0x5495('0x65')])return;return db[_0x5495('0x76')][_0x5495('0x5a')]({'where':{'id':_0x37d34f[_0x5495('0x5c')][_0x5495('0x65')],'role':_0x5495('0x77')},'attributes':['id',_0x5495('0x3b'),_0x5495('0x78'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x5c9895){if(!_0x5c9895)return null;_0x430ae9[_0x5495('0x2b')]['agent']=_0x5c9895;return _0x430ae9;})[_0x5495('0x23')](function(_0x51487a){if(_0x51487a){if(_0x37d34f[_0x5495('0x5c')][_0x5495('0x79')]){_0x430ae9[_0x5495('0x2b')][_0x5495('0x7a')]=util[_0x5495('0x63')]('SIP/%s',_0x37d34f[_0x5495('0x66')]['name']);_0x430ae9[_0x5495('0x2b')][_0x5495('0x7b')]=_0x430ae9[_0x5495('0x7b')];_0x430ae9[_0x5495('0x2b')][_0x5495('0x7c')]='accept';return respondWithRpcPromise(_0x5495('0x7d'),_0x5495('0x7d'),{'event':_0x5495('0x7e'),'message':_0x430ae9[_0x5495('0x2b')]},client9002)[_0x5495('0x23')](function(){return _0x430ae9;});}return _0x430ae9;}return null;})[_0x5495('0x23')](respondWithResult(_0xb76603,null))[_0x5495('0x57')](handleError(_0xb76603,null));};var interaction_log=require(_0x5495('0x5e'))('sms-interactions');exports[_0x5495('0x37')]=function(_0x26346f,_0x255dba,_0x44475f){var _0x2b13dc={'agent':{},'channel':_0x5495('0x60')};if(_0x26346f['body']['id']){delete _0x26346f['body']['id'];}_0x26346f[_0x5495('0x5c')]['UserId']=_0x26346f[_0x5495('0x5c')]['UserId']||_0x26346f[_0x5495('0x66')]['id'];_0x2b13dc[_0x5495('0x77')]['id']=_0x26346f[_0x5495('0x5c')]['UserId'];return db[_0x5495('0x3f')][_0x5495('0x5a')]({'where':{'id':_0x26346f[_0x5495('0x59')]['id'],'UserId':null}})[_0x5495('0x23')](handleEntityNotFound(_0x255dba,null))[_0x5495('0x23')](function(_0x89da9b){if(_0x89da9b){_0x2b13dc[_0x5495('0x2b')]=_0x89da9b['get']({'plain':!![]});return db[_0x5495('0x68')]['find']({'where':{'id':_0x89da9b[_0x5495('0x69')]}});}return null;})[_0x5495('0x23')](handleEntityNotFound(_0x255dba,null))['then'](function(_0x3eefc9){if(_0x3eefc9){_0x2b13dc[_0x5495('0x6c')]=_0x3eefc9[_0x5495('0x67')]({'plain':!![]});interaction_log['info'](_0x5495('0x7f'),_0x26346f[_0x5495('0x66')]['id'],_0x26346f[_0x5495('0x66')][_0x5495('0x3b')],_0x26346f[_0x5495('0x66')][_0x5495('0x6e')],_0x2b13dc[_0x5495('0x6c')]['id'],_0x26346f[_0x5495('0x5c')]?JSON[_0x5495('0x27')](_0x26346f['body']):_0x5495('0x80'));return respondWithRpcPromise(_0x5495('0x81'),_0x5495('0x82'),_0x2b13dc);}return null;})[_0x5495('0x23')](function(_0x23e102){var _0x447285=_0x5495('0x70')+_0x23e102[_0x5495('0x2b')][_0x5495('0x71')];return db['sequelize'][_0x5495('0x45')](_0x447285,{'type':db[_0x5495('0x83')]['QueryTypes'][_0x5495('0x74')],'raw':!![]})[_0x5495('0x23')](function(_0x302370){return _0x302370;});})[_0x5495('0x23')](function(_0x71f07f){if(_0x71f07f){_0x2b13dc[_0x5495('0x2b')][_0x5495('0x75')]=_0x71f07f[0x0];if(!_0x26346f[_0x5495('0x5c')][_0x5495('0x65')])return;return db[_0x5495('0x76')][_0x5495('0x5a')]({'where':{'id':_0x26346f[_0x5495('0x5c')]['UserId'],'role':_0x5495('0x77')},'attributes':['id','name',_0x5495('0x78'),_0x5495('0x84'),_0x5495('0x85')],'raw':!![]});}return null;})[_0x5495('0x23')](function(_0x2dfae1){if(!_0x2dfae1)return null;_0x2b13dc[_0x5495('0x2b')]['agent']=_0x2dfae1;return _0x2b13dc;})['then'](function(_0x1523c1){if(_0x1523c1){_0x1523c1['message'][_0x5495('0x7a')]=util[_0x5495('0x63')](_0x5495('0x86'),_0x26346f[_0x5495('0x66')]['name']);_0x1523c1[_0x5495('0x2b')][_0x5495('0x7b')]=_0x2b13dc[_0x5495('0x7b')];_0x1523c1[_0x5495('0x2b')][_0x5495('0x7c')]='reject';respondWithRpcPromise(_0x5495('0x7d'),_0x5495('0x7d'),{'event':_0x5495('0x87'),'message':_0x1523c1['message']},client9002);return _0x2b13dc;}return null;})[_0x5495('0x23')](respondWithResult(_0x255dba,null))['catch'](handleError(_0x255dba,null));};exports[_0x5495('0x2f')]=function(_0x3d451d,_0x40a96b,_0x119596){if(_0x3d451d[_0x5495('0x5c')]['id']){delete _0x3d451d[_0x5495('0x5c')]['id'];}var _0x5f0927;return db[_0x5495('0x3f')][_0x5495('0x5a')]({'where':{'id':_0x3d451d[_0x5495('0x59')]['id']}})[_0x5495('0x23')](handleEntityNotFound(_0x40a96b,null))[_0x5495('0x23')](function(_0x57d43b){if(_0x57d43b){_0x5f0927=_0x57d43b;return db['SmsAccount'][_0x5495('0x5a')]({'where':{'id':_0x57d43b[_0x5495('0x88')]}});}})['then'](handleEntityNotFound(_0x40a96b,null))[_0x5495('0x23')](function(_0x28b2bb){if(_0x28b2bb){logger[_0x5495('0x24')](_0x5495('0x25'),_0x5495('0x2f'),_0x5495('0x89'),_0x28b2bb[_0x5495('0x8a')],util[_0x5495('0x8b')](_0x3d451d[_0x5495('0x5c')],{'showHidden':![],'depth':null}));switch(_0x28b2bb[_0x5495('0x8a')]){case _0x5495('0x8c'):if(_0x3d451d[_0x5495('0x5c')][_0x5495('0x8d')]&&_0x3d451d[_0x5495('0x5c')][_0x5495('0x8d')]===_0x5f0927['messageId']){return _0x5f0927[_0x5495('0x38')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5495('0x2f'),_0x5495('0x8c'),util['inspect'](_0x3d451d['body'],{'showHidden':![],'depth':null}));}break;case _0x5495('0x8e'):if(_0x3d451d['body'][_0x5495('0x8f')]&&_0x3d451d['body'][_0x5495('0x8f')]===_0x5f0927[_0x5495('0x90')]&&_[_0x5495('0x91')]([_0x5495('0x92'),_0x5495('0x93')],_0x3d451d['body'][_0x5495('0x94')])>=0x0){return _0x5f0927[_0x5495('0x38')]({'read':!![]});}else{logger['error'](_0x5495('0x95'),_0x5495('0x2f'),_0x5495('0x96'),util['inspect'](_0x3d451d['body'],{'showHidden':![],'depth':null}));}break;case _0x5495('0x97'):var _0x4ad906=_0x3d451d['body'][_0x5495('0x98')][0x0];if(_0x4ad906[_0x5495('0x2f')]['groupName']===_0x5495('0x99')){return _0x5f0927[_0x5495('0x38')]({'read':!![]});}else{logger[_0x5495('0x28')](_0x5495('0x95'),'status','infobip',util[_0x5495('0x8b')](_0x3d451d['body'],{'showHidden':![],'depth':null}));}break;}return _0x5f0927;}})[_0x5495('0x23')](respondWithResult(_0x40a96b,null))[_0x5495('0x57')](handleError(_0x40a96b,null));}; \ No newline at end of file +var _0x1345=['sms-interactions','accept','sms','read','readAt','format','UserId','user','agent','get','SmsInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','QueryTypes','rejectmessage','SmsAccountId','inspect','MessageSid','messageId','twilio','plivo','MessageUUID','indexOf','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','name','map','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SmsMessage','include','findAll','rows','show','params','keys','includeAll','create','update','body','find','destroy','describe'];(function(_0x1fdbf1,_0x4c125c){var _0x39456e=function(_0x5798c7){while(--_0x5798c7){_0x1fdbf1['push'](_0x1fdbf1['shift']());}};_0x39456e(++_0x4c125c);}(_0x1345,0xca));var _0x5134=function(_0x34b821,_0x504e55){_0x34b821=_0x34b821-0x0;var _0x5e00a0=_0x1345[_0x34b821];return _0x5e00a0;};'use strict';var emlformat=require(_0x5134('0x0'));var rimraf=require(_0x5134('0x1'));var zipdir=require(_0x5134('0x2'));var jsonpatch=require(_0x5134('0x3'));var rp=require(_0x5134('0x4'));var moment=require(_0x5134('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5134('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5134('0x7'));var csv=require(_0x5134('0x8'));var ejs=require(_0x5134('0x9'));var fs=require('fs');var fs_extra=require(_0x5134('0xa'));var _=require(_0x5134('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5134('0xc'));var deskjs=require(_0x5134('0xd'));var toCsv=require(_0x5134('0x8'));var querystring=require(_0x5134('0xe'));var Papa=require('papaparse');var Redis=require(_0x5134('0xf'));var authService=require(_0x5134('0x10'));var qs=require(_0x5134('0x11'));var as=require(_0x5134('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5134('0x13'))(_0x5134('0x14'));var utils=require(_0x5134('0x15'));var config=require(_0x5134('0x16'));var licenseUtil=require(_0x5134('0x17'));var db=require(_0x5134('0x18'))['db'];config[_0x5134('0x19')]=_[_0x5134('0x1a')](config[_0x5134('0x19')],{'host':_0x5134('0x1b'),'port':0x18eb});var socket=require(_0x5134('0x1c'))(new Redis(config['redis']));require(_0x5134('0x1d'))[_0x5134('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5134('0x1f')][_0x5134('0x20')]({'port':0x232c});var client9002=jayson[_0x5134('0x1f')][_0x5134('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x15bdb9,_0x4064e3,_0x4fa163,_0xa9fb88){return new BPromise(function(_0x32ce54,_0x214132){var _0x4cce02=_0xa9fb88||client;return _0x4cce02['request'](_0x15bdb9,_0x4fa163)['then'](function(_0x5a5cb4){logger[_0x5134('0x21')](_0x5134('0x22'),_0x4064e3,_0x5134('0x23'));logger[_0x5134('0x24')](_0x5134('0x25'),_0x4064e3,'request\x20sent',JSON[_0x5134('0x26')](_0x5a5cb4));if(_0x5a5cb4[_0x5134('0x27')]){if(_0x5a5cb4[_0x5134('0x27')][_0x5134('0x28')]===0x1f4){logger['error'](_0x5134('0x22'),_0x4064e3,_0x5a5cb4['error'][_0x5134('0x29')]);return _0x214132(_0x5a5cb4[_0x5134('0x27')][_0x5134('0x29')]);}logger[_0x5134('0x27')](_0x5134('0x22'),_0x4064e3,_0x5a5cb4[_0x5134('0x27')]['message']);return _0x32ce54(_0x5a5cb4[_0x5134('0x27')]['message']);}else{logger[_0x5134('0x21')](_0x5134('0x22'),_0x4064e3,_0x5134('0x23'));_0x32ce54(_0x5a5cb4[_0x5134('0x2a')]['message']);}})[_0x5134('0x2b')](function(_0x4bedb4){logger[_0x5134('0x27')](_0x5134('0x22'),_0x4064e3,_0x4bedb4);_0x214132(_0x4bedb4);});});}function respondWithStatusCode(_0x5ce671,_0x4ae300){_0x4ae300=_0x4ae300||0xcc;return function(_0x1927a1){if(_0x1927a1){return _0x5ce671['sendStatus'](_0x4ae300);}return _0x5ce671[_0x5134('0x2c')](_0x4ae300)[_0x5134('0x2d')]();};}function respondWithResult(_0x19b002,_0x289c47){_0x289c47=_0x289c47||0xc8;return function(_0x5a99e0){if(_0x5a99e0){return _0x19b002['status'](_0x289c47)[_0x5134('0x2e')](_0x5a99e0);}};}function respondWithFilteredResult(_0x4d386b,_0x302196){return function(_0x372a82){if(_0x372a82){var _0x480e70=typeof _0x302196[_0x5134('0x2f')]===_0x5134('0x30')&&typeof _0x302196[_0x5134('0x31')]===_0x5134('0x30');var _0x276eed=_0x372a82[_0x5134('0x32')];var _0x3fd7cf=_0x480e70?0x0:_0x302196[_0x5134('0x2f')];var _0x2ad300=_0x480e70?_0x372a82['count']:_0x302196[_0x5134('0x2f')]+_0x302196[_0x5134('0x31')];var _0x420f90;if(_0x2ad300>=_0x276eed){_0x2ad300=_0x276eed;_0x420f90=0xc8;}else{_0x420f90=0xce;}_0x4d386b['status'](_0x420f90);return _0x4d386b[_0x5134('0x33')](_0x5134('0x34'),_0x3fd7cf+'-'+_0x2ad300+'/'+_0x276eed)[_0x5134('0x2e')](_0x372a82);}return null;};}function patchUpdates(_0x277a0a){return function(_0x43cd96){try{jsonpatch[_0x5134('0x35')](_0x43cd96,_0x277a0a,!![]);}catch(_0x14fce2){return BPromise[_0x5134('0x36')](_0x14fce2);}return _0x43cd96[_0x5134('0x37')]();};}function saveUpdates(_0x498877,_0x500931){return function(_0x572ca8){if(_0x572ca8){return _0x572ca8['update'](_0x498877)[_0x5134('0x38')](function(_0x23a5db){return _0x23a5db;});}return null;};}function removeEntity(_0x3531ec,_0x4ab5b4){return function(_0x213ff6){if(_0x213ff6){return _0x213ff6['destroy']()[_0x5134('0x38')](function(){_0x3531ec[_0x5134('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbad62,_0x19965e){return function(_0x539b27){if(!_0x539b27){_0xbad62[_0x5134('0x39')](0x194);}return _0x539b27;};}function handleError(_0x33e8da,_0x136170){_0x136170=_0x136170||0x1f4;return function(_0x11d070){logger[_0x5134('0x27')](_0x11d070['stack']);if(_0x11d070[_0x5134('0x3a')]){delete _0x11d070[_0x5134('0x3a')];}_0x33e8da[_0x5134('0x2c')](_0x136170)['send'](_0x11d070);};}exports['index']=function(_0x491f9f,_0x12d062){var _0x44d357={},_0x5eea4e={},_0x48dc2a={'count':0x0,'rows':[]};var _0x5bf052=_[_0x5134('0x3b')](db['SmsMessage'][_0x5134('0x3c')],function(_0x5c67a5){return{'name':_0x5c67a5['fieldName'],'type':_0x5c67a5[_0x5134('0x3d')][_0x5134('0x3e')]};});_0x5eea4e[_0x5134('0x3f')]=_[_0x5134('0x3b')](_0x5bf052,_0x5134('0x3a'));_0x5eea4e['query']=_['keys'](_0x491f9f[_0x5134('0x40')]);_0x5eea4e[_0x5134('0x41')]=_['intersection'](_0x5eea4e[_0x5134('0x3f')],_0x5eea4e[_0x5134('0x40')]);_0x44d357[_0x5134('0x42')]=_[_0x5134('0x43')](_0x5eea4e[_0x5134('0x3f')],qs[_0x5134('0x44')](_0x491f9f[_0x5134('0x40')]['fields']));_0x44d357[_0x5134('0x42')]=_0x44d357[_0x5134('0x42')][_0x5134('0x45')]?_0x44d357['attributes']:_0x5eea4e[_0x5134('0x3f')];if(!_0x491f9f[_0x5134('0x40')][_0x5134('0x46')](_0x5134('0x47'))){_0x44d357[_0x5134('0x31')]=qs[_0x5134('0x31')](_0x491f9f[_0x5134('0x40')][_0x5134('0x31')]);_0x44d357[_0x5134('0x2f')]=qs[_0x5134('0x2f')](_0x491f9f[_0x5134('0x40')]['offset']);}_0x44d357[_0x5134('0x48')]=qs['sort'](_0x491f9f[_0x5134('0x40')][_0x5134('0x49')]);_0x44d357[_0x5134('0x4a')]=qs[_0x5134('0x41')](_[_0x5134('0x4b')](_0x491f9f[_0x5134('0x40')],_0x5eea4e['filters']),_0x5bf052);if(_0x491f9f[_0x5134('0x40')][_0x5134('0x4c')]){_0x44d357[_0x5134('0x4a')]=_['merge'](_0x44d357['where'],{'$or':_[_0x5134('0x3b')](_0x5bf052,function(_0xebd1d7){if(_0xebd1d7[_0x5134('0x3d')]!==_0x5134('0x4d')){var _0x25e887={};_0x25e887[_0xebd1d7[_0x5134('0x3a')]]={'$like':'%'+_0x491f9f[_0x5134('0x40')][_0x5134('0x4c')]+'%'};return _0x25e887;}})});}_0x44d357=_[_0x5134('0x4e')]({},_0x44d357,_0x491f9f[_0x5134('0x4f')]);var _0x1e7f0a={'where':_0x44d357[_0x5134('0x4a')]};return db[_0x5134('0x50')][_0x5134('0x32')](_0x1e7f0a)['then'](function(_0x59a1b1){_0x48dc2a['count']=_0x59a1b1;if(_0x491f9f[_0x5134('0x40')]['includeAll']){_0x44d357[_0x5134('0x51')]=[{'all':!![]}];}return db[_0x5134('0x50')][_0x5134('0x52')](_0x44d357);})['then'](function(_0x1d5634){_0x48dc2a[_0x5134('0x53')]=_0x1d5634;return _0x48dc2a;})['then'](respondWithFilteredResult(_0x12d062,_0x44d357))[_0x5134('0x2b')](handleError(_0x12d062,null));};exports[_0x5134('0x54')]=function(_0x371345,_0x37de7c){var _0x50fcca={'raw':!![],'where':{'id':_0x371345[_0x5134('0x55')]['id']}},_0x25ccad={};_0x25ccad[_0x5134('0x3f')]=_[_0x5134('0x56')](db[_0x5134('0x50')][_0x5134('0x3c')]);_0x25ccad[_0x5134('0x40')]=_[_0x5134('0x56')](_0x371345[_0x5134('0x40')]);_0x25ccad[_0x5134('0x41')]=_[_0x5134('0x43')](_0x25ccad['model'],_0x25ccad[_0x5134('0x40')]);_0x50fcca[_0x5134('0x42')]=_[_0x5134('0x43')](_0x25ccad['model'],qs[_0x5134('0x44')](_0x371345['query'][_0x5134('0x44')]));_0x50fcca[_0x5134('0x42')]=_0x50fcca['attributes'][_0x5134('0x45')]?_0x50fcca['attributes']:_0x25ccad[_0x5134('0x3f')];if(_0x371345[_0x5134('0x40')][_0x5134('0x57')]){_0x50fcca[_0x5134('0x51')]=[{'all':!![]}];}_0x50fcca=_[_0x5134('0x4e')]({},_0x50fcca,_0x371345['options']);return db[_0x5134('0x50')]['find'](_0x50fcca)[_0x5134('0x38')](handleEntityNotFound(_0x37de7c,null))[_0x5134('0x38')](respondWithResult(_0x37de7c,null))[_0x5134('0x2b')](handleError(_0x37de7c,null));};exports['create']=function(_0xa3c0f4,_0x42d2d2){return db['SmsMessage'][_0x5134('0x58')](_0xa3c0f4['body'],{})['then'](respondWithResult(_0x42d2d2,0xc9))[_0x5134('0x2b')](handleError(_0x42d2d2,null));};exports[_0x5134('0x59')]=function(_0x3e0c5a,_0x318ef5){if(_0x3e0c5a['body']['id']){delete _0x3e0c5a[_0x5134('0x5a')]['id'];}return db[_0x5134('0x50')][_0x5134('0x5b')]({'where':{'id':_0x3e0c5a['params']['id']}})[_0x5134('0x38')](handleEntityNotFound(_0x318ef5,null))[_0x5134('0x38')](saveUpdates(_0x3e0c5a[_0x5134('0x5a')],null))[_0x5134('0x38')](respondWithResult(_0x318ef5,null))[_0x5134('0x2b')](handleError(_0x318ef5,null));};exports[_0x5134('0x5c')]=function(_0x25bf9d,_0x411fc4){return db[_0x5134('0x50')][_0x5134('0x5b')]({'where':{'id':_0x25bf9d[_0x5134('0x55')]['id']}})[_0x5134('0x38')](handleEntityNotFound(_0x411fc4,null))[_0x5134('0x38')](removeEntity(_0x411fc4,null))[_0x5134('0x2b')](handleError(_0x411fc4,null));};exports[_0x5134('0x5d')]=function(_0x181dd2,_0x52b4e7){return db['SmsMessage'][_0x5134('0x5d')]()[_0x5134('0x38')](respondWithResult(_0x52b4e7,null))['catch'](handleError(_0x52b4e7,null));};var interaction_log=require(_0x5134('0x13'))(_0x5134('0x5e'));exports[_0x5134('0x5f')]=function(_0x3811dc,_0x59a406,_0x4aca75){var _0x5cffe3={'agent':{},'channel':_0x5134('0x60')};if(_0x3811dc[_0x5134('0x5a')]['id']){delete _0x3811dc['body']['id'];}_0x3811dc[_0x5134('0x5a')][_0x5134('0x61')]=!![];_0x3811dc[_0x5134('0x5a')][_0x5134('0x62')]=moment()[_0x5134('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x3811dc['body'][_0x5134('0x64')]=_0x3811dc[_0x5134('0x5a')][_0x5134('0x64')]||_0x3811dc[_0x5134('0x65')]['id'];_0x5cffe3[_0x5134('0x66')]['id']=_0x3811dc['body'][_0x5134('0x64')];return db['SmsMessage'][_0x5134('0x5b')]({'where':{'id':_0x3811dc[_0x5134('0x55')]['id'],'UserId':null}})[_0x5134('0x38')](handleEntityNotFound(_0x59a406,null))['then'](saveUpdates(_0x3811dc['body'],null))['then'](function(_0x49cca7){if(_0x49cca7){_0x5cffe3[_0x5134('0x29')]=_0x49cca7[_0x5134('0x67')]({'plain':!![]});return db['SmsInteraction'][_0x5134('0x5b')]({'where':{'id':_0x49cca7[_0x5134('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x59a406,null))['then'](function(_0x106ca1){if(_0x106ca1){return _0x106ca1[_0x5134('0x59')]({'UserId':_0x3811dc[_0x5134('0x5a')][_0x5134('0x64')],'read1stAt':_[_0x5134('0x69')](_0x106ca1['read1stAt'])?moment()['format'](_0x5134('0x6a')):undefined});}return null;})[_0x5134('0x38')](function(_0x1ede93){if(_0x1ede93){_0x5cffe3['interaction']=_0x1ede93['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3811dc[_0x5134('0x65')]['id'],_0x3811dc['user'][_0x5134('0x3a')],_0x3811dc[_0x5134('0x65')][_0x5134('0x6b')],_0x5cffe3[_0x5134('0x6c')]['id'],_0x3811dc[_0x5134('0x5a')]?JSON[_0x5134('0x26')](_0x3811dc['body']):_0x5134('0x6d'));return respondWithRpcPromise(_0x5134('0x6e'),'acceptMessage',_0x5cffe3);}return null;})[_0x5134('0x38')](function(_0x4061de){var _0x2c1ca1=_0x5134('0x6f')+_0x4061de[_0x5134('0x29')][_0x5134('0x70')];return db['sequelize']['query'](_0x2c1ca1,{'type':db[_0x5134('0x71')]['QueryTypes'][_0x5134('0x72')],'raw':!![]})['then'](function(_0x277b7b){return _0x277b7b;});})[_0x5134('0x38')](function(_0x11e922){if(_0x11e922){_0x5cffe3[_0x5134('0x29')][_0x5134('0x73')]=_0x11e922[0x0];if(!_0x3811dc[_0x5134('0x5a')][_0x5134('0x64')])return;return db[_0x5134('0x74')][_0x5134('0x5b')]({'where':{'id':_0x3811dc[_0x5134('0x5a')][_0x5134('0x64')],'role':_0x5134('0x66')},'attributes':['id',_0x5134('0x3a'),_0x5134('0x75'),_0x5134('0x76'),_0x5134('0x77')],'raw':!![]});}return null;})[_0x5134('0x38')](function(_0x599665){if(!_0x599665)return null;_0x5cffe3[_0x5134('0x29')][_0x5134('0x66')]=_0x599665;return _0x5cffe3;})['then'](function(_0x315c7b){if(_0x315c7b){if(_0x3811dc[_0x5134('0x5a')][_0x5134('0x78')]){_0x5cffe3[_0x5134('0x29')][_0x5134('0x79')]=util[_0x5134('0x63')](_0x5134('0x7a'),_0x3811dc[_0x5134('0x65')][_0x5134('0x3a')]);_0x5cffe3[_0x5134('0x29')]['channel']=_0x5cffe3[_0x5134('0x7b')];_0x5cffe3[_0x5134('0x29')][_0x5134('0x7c')]=_0x5134('0x5f');return respondWithRpcPromise(_0x5134('0x7d'),_0x5134('0x7d'),{'event':_0x5134('0x7e'),'message':_0x5cffe3[_0x5134('0x29')]},client9002)[_0x5134('0x38')](function(){return _0x5cffe3;});}return _0x5cffe3;}return null;})[_0x5134('0x38')](respondWithResult(_0x59a406,null))[_0x5134('0x2b')](handleError(_0x59a406,null));};var interaction_log=require(_0x5134('0x13'))(_0x5134('0x5e'));exports[_0x5134('0x36')]=function(_0x474228,_0x59cd38,_0x385b5f){var _0x2aa953={'agent':{},'channel':_0x5134('0x60')};if(_0x474228['body']['id']){delete _0x474228[_0x5134('0x5a')]['id'];}_0x474228['body'][_0x5134('0x64')]=_0x474228[_0x5134('0x5a')][_0x5134('0x64')]||_0x474228['user']['id'];_0x2aa953[_0x5134('0x66')]['id']=_0x474228[_0x5134('0x5a')][_0x5134('0x64')];return db[_0x5134('0x50')][_0x5134('0x5b')]({'where':{'id':_0x474228['params']['id'],'UserId':null}})[_0x5134('0x38')](handleEntityNotFound(_0x59cd38,null))[_0x5134('0x38')](function(_0x974b47){if(_0x974b47){_0x2aa953[_0x5134('0x29')]=_0x974b47[_0x5134('0x67')]({'plain':!![]});return db[_0x5134('0x7f')]['find']({'where':{'id':_0x974b47[_0x5134('0x68')]}});}return null;})[_0x5134('0x38')](handleEntityNotFound(_0x59cd38,null))[_0x5134('0x38')](function(_0x50eccd){if(_0x50eccd){_0x2aa953[_0x5134('0x6c')]=_0x50eccd[_0x5134('0x67')]({'plain':!![]});interaction_log[_0x5134('0x21')](_0x5134('0x80'),_0x474228[_0x5134('0x65')]['id'],_0x474228['user'][_0x5134('0x3a')],_0x474228[_0x5134('0x65')][_0x5134('0x6b')],_0x2aa953[_0x5134('0x6c')]['id'],_0x474228[_0x5134('0x5a')]?JSON[_0x5134('0x26')](_0x474228[_0x5134('0x5a')]):_0x5134('0x6d'));return respondWithRpcPromise('RejectMessage',_0x5134('0x81'),_0x2aa953);}return null;})[_0x5134('0x38')](function(_0x3f7e89){var _0xb68c1b=_0x5134('0x6f')+_0x3f7e89[_0x5134('0x29')][_0x5134('0x70')];return db[_0x5134('0x82')]['query'](_0xb68c1b,{'type':db['Sequelize'][_0x5134('0x83')][_0x5134('0x72')],'raw':!![]})[_0x5134('0x38')](function(_0x3bf4b4){return _0x3bf4b4;});})[_0x5134('0x38')](function(_0x4f08a1){if(_0x4f08a1){_0x2aa953[_0x5134('0x29')]['contact']=_0x4f08a1[0x0];if(!_0x474228[_0x5134('0x5a')][_0x5134('0x64')])return;return db[_0x5134('0x74')][_0x5134('0x5b')]({'where':{'id':_0x474228[_0x5134('0x5a')][_0x5134('0x64')],'role':'agent'},'attributes':['id','name',_0x5134('0x75'),_0x5134('0x76'),'internal'],'raw':!![]});}return null;})[_0x5134('0x38')](function(_0x603c18){if(!_0x603c18)return null;_0x2aa953[_0x5134('0x29')][_0x5134('0x66')]=_0x603c18;return _0x2aa953;})[_0x5134('0x38')](function(_0x3a0d49){if(_0x3a0d49){_0x3a0d49['message'][_0x5134('0x79')]=util[_0x5134('0x63')](_0x5134('0x7a'),_0x474228[_0x5134('0x65')][_0x5134('0x3a')]);_0x3a0d49['message'][_0x5134('0x7b')]=_0x2aa953['channel'];_0x3a0d49[_0x5134('0x29')][_0x5134('0x7c')]='reject';respondWithRpcPromise('EventManager',_0x5134('0x7d'),{'event':_0x5134('0x84'),'message':_0x3a0d49[_0x5134('0x29')]},client9002);return _0x2aa953;}return null;})[_0x5134('0x38')](respondWithResult(_0x59cd38,null))['catch'](handleError(_0x59cd38,null));};exports['status']=function(_0x452e7e,_0xb8c5f9,_0x211eb7){if(_0x452e7e[_0x5134('0x5a')]['id']){delete _0x452e7e[_0x5134('0x5a')]['id'];}var _0x243d66;return db[_0x5134('0x50')][_0x5134('0x5b')]({'where':{'id':_0x452e7e[_0x5134('0x55')]['id']}})[_0x5134('0x38')](handleEntityNotFound(_0xb8c5f9,null))[_0x5134('0x38')](function(_0x4aa329){if(_0x4aa329){_0x243d66=_0x4aa329;return db['SmsAccount'][_0x5134('0x5b')]({'where':{'id':_0x4aa329[_0x5134('0x85')]}});}})[_0x5134('0x38')](handleEntityNotFound(_0xb8c5f9,null))[_0x5134('0x38')](function(_0x346431){if(_0x346431){logger[_0x5134('0x24')](_0x5134('0x25'),_0x5134('0x2c'),'received\x20delivery\x20report\x20from',_0x346431['type'],util[_0x5134('0x86')](_0x452e7e[_0x5134('0x5a')],{'showHidden':![],'depth':null}));switch(_0x346431[_0x5134('0x3d')]){case'twilio':if(_0x452e7e[_0x5134('0x5a')][_0x5134('0x87')]&&_0x452e7e['body']['MessageSid']===_0x243d66[_0x5134('0x88')]){return _0x243d66[_0x5134('0x59')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5134('0x2c'),_0x5134('0x89'),util[_0x5134('0x86')](_0x452e7e[_0x5134('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x5134('0x8a'):if(_0x452e7e[_0x5134('0x5a')]['MessageUUID']&&_0x452e7e[_0x5134('0x5a')][_0x5134('0x8b')]===_0x243d66[_0x5134('0x88')]&&_[_0x5134('0x8c')](['sent','delivered'],_0x452e7e['body'][_0x5134('0x8d')])>=0x0){return _0x243d66[_0x5134('0x59')]({'read':!![]});}else{logger['error'](_0x5134('0x8e'),_0x5134('0x2c'),_0x5134('0x8f'),util[_0x5134('0x86')](_0x452e7e['body'],{'showHidden':![],'depth':null}));}break;case _0x5134('0x90'):var _0x841e95=_0x452e7e[_0x5134('0x5a')][_0x5134('0x91')][0x0];if(_0x841e95[_0x5134('0x2c')][_0x5134('0x92')]===_0x5134('0x93')){return _0x243d66[_0x5134('0x59')]({'read':!![]});}else{logger[_0x5134('0x27')](_0x5134('0x8e'),_0x5134('0x2c'),_0x5134('0x90'),util[_0x5134('0x86')](_0x452e7e['body'],{'showHidden':![],'depth':null}));}break;}return _0x243d66;}})[_0x5134('0x38')](respondWithResult(_0xb8c5f9,null))[_0x5134('0x2b')](handleError(_0xb8c5f9,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 75e1358..ec31663 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 _0xe0d0=['hook','events','../../mysqldb','SmsMessage','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x4fdc5c,_0x15ec25){var _0x2c9b2f=function(_0x49830d){while(--_0x49830d){_0x4fdc5c['push'](_0x4fdc5c['shift']());}};_0x2c9b2f(++_0x15ec25);}(_0xe0d0,0x121));var _0x0e0d=function(_0x5c0123,_0x16cf46){_0x5c0123=_0x5c0123-0x0;var _0x468186=_0xe0d0[_0x5c0123];return _0x468186;};'use strict';var EventEmitter=require(_0x0e0d('0x0'));var SmsMessage=require(_0x0e0d('0x1'))['db'][_0x0e0d('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x0e0d('0x3')](0x0);var events={'afterCreate':_0x0e0d('0x4'),'afterUpdate':'update','afterDestroy':_0x0e0d('0x5')};function emitEvent(_0xf270a4){return function(_0xbbc2d8,_0x4bd859,_0x44db73){SmsMessageEvents[_0x0e0d('0x6')](_0xf270a4+':'+_0xbbc2d8['id'],_0xbbc2d8);SmsMessageEvents[_0x0e0d('0x6')](_0xf270a4,_0xbbc2d8);_0x44db73(null);};}for(var e in events){if(events[_0x0e0d('0x7')](e)){var event=events[e];SmsMessage[_0x0e0d('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x504f=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update'];(function(_0x104fc1,_0x46ea2b){var _0x466ed4=function(_0xc82397){while(--_0xc82397){_0x104fc1['push'](_0x104fc1['shift']());}};_0x466ed4(++_0x46ea2b);}(_0x504f,0x184));var _0xf504=function(_0x3b8c0d,_0x552943){_0x3b8c0d=_0x3b8c0d-0x0;var _0x5256be=_0x504f[_0x3b8c0d];return _0x5256be;};'use strict';var EventEmitter=require(_0xf504('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xf504('0x1')](0x0);var events={'afterCreate':_0xf504('0x2'),'afterUpdate':_0xf504('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2c88a5){return function(_0x5b790e,_0x105b82,_0x2b99da){SmsMessageEvents['emit'](_0x2c88a5+':'+_0x5b790e['id'],_0x5b790e);SmsMessageEvents[_0xf504('0x4')](_0x2c88a5,_0x5b790e);_0x2b99da(null);};}for(var e in events){if(events[_0xf504('0x5')](e)){var event=events[e];SmsMessage[_0xf504('0x6')](e,emitEvent(event));}}module[_0xf504('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 4cb01aa..0cb1747 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 _0xe80c=['username','password','smsMethod','sender','GET','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','update','afterCreate','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','read','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','remote','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','signature=','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','application/json','refid','status','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','define','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','findOne','SmsInteractionId','then','createdAt','error','SmsAccount','find','SmsAccountId','type','accountSid','authToken','phone','messages','create','/api/sms/messages/','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','twilio','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/'];(function(_0x2dba9a,_0x1177e1){var _0x4e6157=function(_0x559e41){while(--_0x559e41){_0x2dba9a['push'](_0x2dba9a['shift']());}};_0x4e6157(++_0x1177e1);}(_0xe80c,0x1c2));var _0xce80=function(_0x54c105,_0x2059f8){_0x54c105=_0x54c105-0x0;var _0x3d3d42=_0xe80c[_0x54c105];return _0x3d3d42;};'use strict';var _=require('lodash');var util=require(_0xce80('0x0'));var logger=require(_0xce80('0x1'))(_0xce80('0x2'));var moment=require(_0xce80('0x3'));var BPromise=require(_0xce80('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce80('0x5'));var rimraf=require(_0xce80('0x6'));var config=require(_0xce80('0x7'));var attributes=require(_0xce80('0x8'));module['exports']=function(_0xb10325,_0x150f6a){return _0xb10325[_0xce80('0x9')]('SmsMessage',attributes,{'tableName':_0xce80('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xce80('0xb')]},{'name':'fti_sms_messages','fields':[_0xce80('0xc')],'type':_0xce80('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x51f349,_0x58894d,_0x2d7bf3){var _0x159969=_0xb10325[_0xce80('0xe')];var _0x53b6df=_0x51f349[_0xce80('0xf')]({'plain':!![]});if(_0x53b6df[_0xce80('0x10')][_0xce80('0x11')]()==='in'||_0x53b6df[_0xce80('0x10')]['toLowerCase']()===_0xce80('0x12')&&!_0x53b6df[_0xce80('0x13')]&&!_[_0xce80('0x14')](_0x53b6df['UserId'])){_0x159969['SmsInteraction'][_0xce80('0x15')]({'where':{'id':_0x53b6df[_0xce80('0x16')]}})[_0xce80('0x17')](function(_0x3cac82){if(_0x3cac82){_0x3cac82['update']({'lastMsgAt':_0x53b6df[_0xce80('0x18')],'lastMsgDirection':_0x53b6df['direction'][_0xce80('0x11')]()});}})['catch'](function(_0x24efa3){console[_0xce80('0x19')](_0x24efa3);});}if(_0x53b6df['direction']==='out'&&!_0x53b6df['secret']){var _0x35b40d;_0x159969[_0xce80('0x1a')][_0xce80('0x1b')]({'where':{'id':_0x53b6df[_0xce80('0x1c')]},'raw':!![]})[_0xce80('0x17')](function(_0x5ebf73){_0x35b40d=_0x5ebf73;if(_0x35b40d&&_0x35b40d[_0xce80('0x1d')]){switch(_0x35b40d[_0xce80('0x1d')]){case'twilio':var _0x56865a=require('twilio');if(_0x35b40d[_0xce80('0x1e')]&&_0x35b40d[_0xce80('0x1f')]&&_0x35b40d[_0xce80('0x20')]){var _0x44f399=new _0x56865a(_0x35b40d['accountSid'],_0x35b40d[_0xce80('0x1f')]);_0x44f399[_0xce80('0x21')][_0xce80('0x22')]({'body':_0x53b6df['body'],'to':_0x53b6df['phone'],'from':_0x35b40d[_0xce80('0x20')],'statusCallback':_0x35b40d['remote']+_0xce80('0x23')+_0x53b6df['id']+_0xce80('0x24')+_0x35b40d[_0xce80('0x25')]})[_0xce80('0x17')](function(_0x4fc91c){if(_0x4fc91c[_0xce80('0x26')]){return _0x51f349['update']({'messageId':_0x4fc91c[_0xce80('0x26')]});}})[_0xce80('0x27')](function(_0x4cd1f5){logger['error'](_0xce80('0x28'),'afterCreate',_0xce80('0x29'),util[_0xce80('0x2a')](_0x4cd1f5,{'showHidden':![],'depth':null}));});}else{logger[_0xce80('0x19')](_0xce80('0x28'),'afterCreate',_0xce80('0x29'),_0xce80('0x2b'));}break;case _0xce80('0x2c'):var _0x3d7c49=_0xce80('0x2d');if(_0x35b40d[_0xce80('0x2e')]&&_0x35b40d[_0xce80('0x2f')]){var _0x6d1190={'recipient':[_0x53b6df['phone']],'message':_0x53b6df[_0xce80('0xc')],'message_type':_0x35b40d[_0xce80('0x30')]};if(_0x35b40d[_0xce80('0x30')]&&_0x35b40d[_0xce80('0x30')]!=='SI'){_0x6d1190[_0xce80('0x31')]=_0x35b40d[_0xce80('0x20')];}var _0x35eac6={'url':_0x3d7c49+'login?username='+_0x35b40d[_0xce80('0x2e')]+'&password='+_0x35b40d['password'],'method':_0xce80('0x32')};rp(_0x35eac6)[_0xce80('0x17')](function(_0x39c1c0){var _0xa7aae9=_0x39c1c0[_0xce80('0x33')](';');var _0x31d431={'user_key':_0xa7aae9[0x0],'session_key':_0xa7aae9[0x1]};_0x35eac6={'url':_0x3d7c49+_0xce80('0x34'),'method':_0xce80('0x35'),'headers':{'user_key':_0x31d431['user_key'],'Session_key':_0x31d431[_0xce80('0x36')]},'json':!![],'body':_0x6d1190};return rp(_0x35eac6);})['then'](function(_0x25c8c7){if(_0x25c8c7[_0xce80('0x37')]>=0x1){var _0x107ad0={'messageId':_0x25c8c7[_0xce80('0x38')]};if(_0x35b40d[_0xce80('0x30')]!=='GP'||!_0x35b40d[_0xce80('0x39')]){_0x107ad0['read']=!![];}return _0x51f349[_0xce80('0x3a')](_0x107ad0);}else{return logger[_0xce80('0x19')](_0xce80('0x28'),_0xce80('0x3b'),_0xce80('0x2c'),util[_0xce80('0x2a')](_0x25c8c7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4848d1){return logger[_0xce80('0x19')](_0xce80('0x28'),_0xce80('0x3b'),_0xce80('0x2c'),util[_0xce80('0x2a')](_0x4848d1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xce80('0x28'),_0xce80('0x3b'),_0xce80('0x2c'),_0xce80('0x3c'));}break;case _0xce80('0x3d'):if(_0x35b40d[_0xce80('0x1f')]){var _0x3cb994={'recipient':_0x53b6df[_0xce80('0x20')],'message':_0x53b6df[_0xce80('0xc')],'sender':_0x35b40d[_0xce80('0x3e')]||_0x35b40d['phone'],'authorization':_0x35b40d[_0xce80('0x1f')]};var _0x58894d={'method':_0xce80('0x35'),'uri':_0xce80('0x3f'),'body':_0x3cb994,'json':!![]};rp(_0x58894d)[_0xce80('0x17')](function(_0x2c87ce){var _0x222b08={'messageId':_0x2c87ce['requestid']};if(!_0x35b40d[_0xce80('0x39')]){_0x222b08[_0xce80('0x40')]=!![];}return _0x51f349[_0xce80('0x3a')](_0x222b08);})['catch'](function(_0x1d2dbe){logger['error'](_0xce80('0x28'),_0xce80('0x3b'),_0xce80('0x3d'),util[_0xce80('0x2a')](_0x1d2dbe,{'showHidden':![],'depth':null}));});}else{logger[_0xce80('0x19')](_0xce80('0x28'),'afterCreate',_0xce80('0x3d'),_0xce80('0x41'));}break;case _0xce80('0x42'):if(_0x35b40d[_0xce80('0x2e')]&&_0x35b40d['password']){var _0x3cb994={'messages':[{'source':'xCALLY\x20Motion','to':_0x53b6df[_0xce80('0x20')],'body':_0x53b6df[_0xce80('0xc')],'from':_0x35b40d[_0xce80('0x3e')]||_0x35b40d[_0xce80('0x20')]}]};var _0x34be91=util[_0xce80('0x43')](_0xce80('0x44'),_0x35b40d[_0xce80('0x2e')],_0x35b40d[_0xce80('0x2f')]);var _0x58894d={'method':_0xce80('0x35'),'uri':_0xce80('0x45'),'body':_0x3cb994,'headers':{'Authorization':util[_0xce80('0x43')]('Basic\x20%s',new Buffer(_0x34be91)[_0xce80('0x46')](_0xce80('0x47')))},'json':!![]};rp(_0x58894d)[_0xce80('0x17')](function(_0x4e449f){if(_0x4e449f[_0xce80('0x48')]>=0xc8&&_0x4e449f['http_code']<=0xce){if(_0x4e449f[_0xce80('0x49')]&&_0x4e449f[_0xce80('0x49')][_0xce80('0x4a')]>0x0){var _0x5e7a00=_[_0xce80('0x4b')](_0x4e449f[_0xce80('0x49')][_0xce80('0x21')]);var _0x4d10a0={'messageId':_0x5e7a00[_0xce80('0x4c')]};if(!_0x35b40d['deliveryReport']){_0x4d10a0['read']=!![];}return _0x51f349[_0xce80('0x3a')](_0x4d10a0);}else{logger[_0xce80('0x19')](_0xce80('0x28'),_0xce80('0x3b'),_0xce80('0x4d'),util[_0xce80('0x2a')](_0x4e449f,{'showHidden':![],'depth':null}));}}else{logger[_0xce80('0x19')](_0xce80('0x28'),'afterCreate',_0xce80('0x4d'),util['inspect'](_0x4e449f,{'showHidden':![],'depth':null}));}})[_0xce80('0x27')](function(_0x2dd290){logger[_0xce80('0x19')](_0xce80('0x28'),_0xce80('0x3b'),_0xce80('0x4d'),util['inspect'](_0x2dd290,{'showHidden':![],'depth':null}));});}else{logger[_0xce80('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xce80('0x3b'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0xce80('0x4e'):if(_0x35b40d[_0xce80('0x4f')]&&_0x35b40d[_0xce80('0x1f')]){var _0x3cb994={'dst':_0x53b6df['phone'],'text':_0x53b6df[_0xce80('0xc')],'src':_0x35b40d[_0xce80('0x3e')]||_0x35b40d['phone'],'url':_0x35b40d[_0xce80('0x50')]+_0xce80('0x23')+_0x53b6df['id']+_0xce80('0x24')+_0x35b40d[_0xce80('0x25')]};var _0x34be91=util['format']('%s:%s',_0x35b40d[_0xce80('0x4f')],_0x35b40d[_0xce80('0x1f')]);var _0x58894d={'method':'POST','uri':util['format'](_0xce80('0x51'),_0x35b40d['authId']),'body':_0x3cb994,'headers':{'Authorization':util[_0xce80('0x43')](_0xce80('0x52'),new Buffer(_0x34be91)[_0xce80('0x46')](_0xce80('0x47')))},'json':!![]};rp(_0x58894d)[_0xce80('0x17')](function(_0x8610b){var _0x2869cf={'messageId':_0x8610b[_0xce80('0x53')][0x0]};return _0x51f349[_0xce80('0x3a')](_0x2869cf);})[_0xce80('0x27')](function(_0x142462){logger['error'](_0xce80('0x28'),_0xce80('0x3b'),_0xce80('0x4e'),util[_0xce80('0x2a')](_0x142462,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xce80('0x28'),'afterCreate',_0xce80('0x4e'),_0xce80('0x54'));}break;case _0xce80('0x55'):if(_0x35b40d[_0xce80('0x2e')]&&_0x35b40d[_0xce80('0x2f')]){if(_0x35b40d[_0xce80('0x56')]){var _0x3c5915={'method':_0xce80('0x35'),'uri':_0x35b40d[_0xce80('0x56')]+_0xce80('0x57'),'body':{'username':_0x35b40d['username'],'password':_0x35b40d[_0xce80('0x2f')]},'json':!![]};return rp(_0x3c5915)[_0xce80('0x17')](function(_0x120cac){var _0x23566f={'method':_0xce80('0x35'),'uri':_0x35b40d[_0xce80('0x56')]+_0xce80('0x58'),'body':{'messages':[{'from':_0x35b40d[_0xce80('0x20')],'destinations':[{'to':_0x53b6df[_0xce80('0x20')]}],'text':_0x53b6df[_0xce80('0xc')],'notifyUrl':_0x35b40d[_0xce80('0x50')]+_0xce80('0x23')+_0x53b6df['id']+_0xce80('0x24')+_0x35b40d[_0xce80('0x25')],'notifyContentType':'application/json','callbackData':_0x35b40d[_0xce80('0x20')]+';'+_0x53b6df[_0xce80('0xc')]}]},'headers':{'Authorization':_0xce80('0x59')+_0x120cac['token']},'json':!![]};return rp(_0x23566f)[_0xce80('0x17')](function(_0x4ff3f0){if(_0x4ff3f0['messages']){var _0x2a8d9f={'messageId':_0x4ff3f0['messages'][0x0][_0xce80('0xb')]};if(!_0x35b40d[_0xce80('0x39')]){_0x2a8d9f[_0xce80('0x40')]=!![];}return _0x51f349['update'](_0x2a8d9f);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xce80('0x3b'),_0xce80('0x55'),util[_0xce80('0x2a')](_0x4ff3f0,{'showHidden':![],'depth':null}));}});})[_0xce80('0x27')](function(_0x4309a2){return logger[_0xce80('0x19')](_0xce80('0x28'),_0xce80('0x3b'),_0xce80('0x55'),util[_0xce80('0x2a')](_0x4309a2,{'showHidden':![],'depth':null}));});}else{logger[_0xce80('0x19')](_0xce80('0x28'),'afterCreate','infobip',_0xce80('0x5a'));}}else{logger[_0xce80('0x19')](_0xce80('0x28'),'afterCreate',_0xce80('0x55'),_0xce80('0x3c'));}break;case _0xce80('0x5b'):var _0x577598=require(_0xce80('0x5c'));if(_0x35b40d[_0xce80('0x5d')]){var _0x1e46ec={};_0x1e46ec[_0xce80('0x5e')]=_0x35b40d['username'];_0x1e46ec[_0xce80('0x20')]=_0x53b6df['phone'];_0x1e46ec[_0xce80('0x31')]=_0x35b40d[_0xce80('0x20')];_0x1e46ec[_0xce80('0x5f')]=_0x53b6df[_0xce80('0xc')];_0x1e46ec[_0xce80('0x60')]=+new Date();var _0x29dfc8='';var _0x1eb92b='';var _0x19b642=Object[_0xce80('0x61')](_0x1e46ec);_0x19b642[_0xce80('0x62')]();for(var _0x309342=0x0;_0x309342<_0x19b642[_0xce80('0x63')];_0x309342++){if(_0x29dfc8!=''){_0x29dfc8+='&';}_0x29dfc8+=_0x19b642[_0x309342]+'='+encodeURIComponent(_0x1e46ec[_0x19b642[_0x309342]]);_0x1eb92b+=_0x1e46ec[_0x19b642[_0x309342]];}_0x1eb92b+=_0x35b40d[_0xce80('0x5d')];_0x1eb92b=_0x577598[_0xce80('0x64')](_0xce80('0x65'))['update'](_0x1eb92b)['digest']('hex');if(_0x29dfc8!==''){_0x29dfc8+='&';}_0x29dfc8+=_0xce80('0x66')+_0x1eb92b;var _0x35eac6={'method':_0xce80('0x32'),'uri':_0x35b40d[_0xce80('0x56')]+'/external/get/send.php?'+_0x29dfc8,'json':!![]};return rp(_0x35eac6)[_0xce80('0x17')](function(_0x9215aa){var _0x422b16=Object[_0xce80('0x61')](_0x9215aa);if(_0x9215aa[_0x422b16[0x0]][_0xce80('0x19')]&&parseInt(_0x9215aa[_0x422b16[0x0]][_0xce80('0x19')])===0x0){var _0x2b9cd5={'messageId':_0x9215aa[_0x422b16[0x0]]['id_sms']};if(!_0x35b40d[_0xce80('0x39')]){_0x2b9cd5[_0xce80('0x40')]=!![];}return _0x51f349[_0xce80('0x3a')](_0x2b9cd5);}else{return logger['error'](_0xce80('0x28'),'afterCreate',_0xce80('0x5b'),util[_0xce80('0x2a')](_0x9215aa['error'],{'showHidden':![],'depth':null}));}})[_0xce80('0x27')](function(_0x4fe5b8){return logger[_0xce80('0x19')](_0xce80('0x28'),_0xce80('0x3b'),_0xce80('0x5b'),util[_0xce80('0x2a')](_0x4fe5b8,{'showHidden':![],'depth':null}));});}else{logger[_0xce80('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xce80('0x3b'),'csc','Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x35b40d['apiKey']){var _0x2aeb6f={'method':_0xce80('0x35'),'uri':_0xce80('0x67'),'headers':{'Authorization':_0x35b40d[_0xce80('0x5d')]},'body':{'content':_0x53b6df[_0xce80('0xc')],'to':[_0x53b6df[_0xce80('0x20')]],'from':_0x35b40d[_0xce80('0x20')],'binary':![],'clientMessageId':'uuid','charset':_0xce80('0x68')},'json':!![]};rp(_0x2aeb6f)['then'](function(_0x1a7cd8){if(!_0x1a7cd8[_0xce80('0x19')]){var _0x38a5f3={'messageId':_0x1a7cd8[_0xce80('0x21')][0x0][_0xce80('0x69')]};if(!_0x35b40d[_0xce80('0x39')]){_0x38a5f3[_0xce80('0x40')]=!![];}return _0x51f349[_0xce80('0x3a')](_0x38a5f3);}else{return logger[_0xce80('0x19')](_0xce80('0x28'),_0xce80('0x3b'),_0xce80('0x6a'),util[_0xce80('0x2a')](_0x1a7cd8[_0xce80('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x4ee1b5){return logger['error'](_0xce80('0x28'),'afterCreate',_0xce80('0x6a'),util[_0xce80('0x2a')](_0x4ee1b5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xce80('0x28'),'afterCreate',_0xce80('0x6a'),'Missing\x20parameters:\x20apiKey');}break;case _0xce80('0x6b'):if(_0x35b40d[_0xce80('0x2e')]&&_0x35b40d[_0xce80('0x2f')]){var _0x34be91=util[_0xce80('0x43')](_0xce80('0x44'),_0x35b40d[_0xce80('0x2e')],_0x35b40d[_0xce80('0x2f')]);var _0x58894d={'method':'POST','uri':_0xce80('0x6c')+_0x35b40d[_0xce80('0x6d')]+_0xce80('0x6e'),'body':{'to':[_0x53b6df[_0xce80('0x20')]],'text':_0x53b6df[_0xce80('0xc')],'from':_0x35b40d['phone'],'applicationId':_0x35b40d[_0xce80('0x6f')]},'headers':{'Authorization':util[_0xce80('0x43')](_0xce80('0x52'),new Buffer(_0x34be91)[_0xce80('0x46')](_0xce80('0x47')))},'json':!![]};rp(_0x58894d)[_0xce80('0x17')](function(_0x4bcc04){if(_0x4bcc04['id']){var _0x2cfe92={'messageId':_0x4bcc04['id']};return _0x51f349[_0xce80('0x3a')](_0x2cfe92);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xce80('0x6b'),util[_0xce80('0x2a')](_0x4bcc04,{'showHidden':![],'depth':null}));}})[_0xce80('0x27')](function(_0x572197){logger[_0xce80('0x19')](_0xce80('0x28'),_0xce80('0x3b'),'bandwidth',util[_0xce80('0x2a')](_0x572197,{'showHidden':![],'depth':null}));});}else{logger[_0xce80('0x19')](_0xce80('0x28'),_0xce80('0x3b'),_0xce80('0x6b'),_0xce80('0x3c'));}break;case _0xce80('0x70'):if(_0x35b40d[_0xce80('0x5d')]){var _0x49c6cb={};var _0x35eac6={'method':'POST','uri':_0xce80('0x71'),'headers':{'Authorization':'Bearer\x20'+_0x35b40d['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x35b40d[_0xce80('0x20')],'to':_0x53b6df['phone'],'text':_0x53b6df[_0xce80('0xc')]},'json':!![]};return rp(_0x35eac6)[_0xce80('0x17')](function(_0x98026e){if(_0x98026e[_0xce80('0x72')]==0xca){_0x49c6cb[_0xce80('0x73')]=_0x98026e;var _0x1d2e8c={'method':_0xce80('0x35'),'uri':_0xce80('0x74'),'headers':{'Authorization':_0xce80('0x75')+_0x35b40d['apiKey'],'Content-Type':_0xce80('0x76')},'body':{'refid':_0x49c6cb[_0xce80('0x73')][_0xce80('0x77')]},'json':!![]};return rp(_0x1d2e8c)[_0xce80('0x17')](function(_0x1e4b20){_0x49c6cb[_0xce80('0x78')]=_0x1e4b20;var _0x1572de={'messageId':_0x49c6cb[_0xce80('0x73')][_0xce80('0x77')],'read':!![]};return _0x51f349[_0xce80('0x3a')](_0x1572de);});}else{return logger[_0xce80('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xce80('0x3b'),_0xce80('0x70'),util['inspect'](_0x98026e,{'showHidden':![],'depth':null}));}})[_0xce80('0x27')](function(_0x12c43a){return logger[_0xce80('0x19')](_0xce80('0x28'),_0xce80('0x3b'),_0xce80('0x70'),util[_0xce80('0x2a')](_0x12c43a,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xce80('0x70'),_0xce80('0x79'));}break;}}})['finally'](function(){_0x2d7bf3();});}else{_0x2d7bf3();}}},'charset':_0xce80('0x7a'),'collate':_0xce80('0x7b')});}; \ No newline at end of file +var _0x83f1=['./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','findOne','SmsInteractionId','then','update','catch','error','secret','find','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','sms','user_key','session_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','POST','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','clicksend','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','crypto','login','timestamp','keys','sort','length','apiKey','createHash','hex','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','status','intelepeer','Token\x20not\x20received','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x1e9c0c,_0x61b24f){var _0x4bceff=function(_0x40a491){while(--_0x40a491){_0x1e9c0c['push'](_0x1e9c0c['shift']());}};_0x4bceff(++_0x61b24f);}(_0x83f1,0x1cc));var _0x183f=function(_0x1b383c,_0x36e123){_0x1b383c=_0x1b383c-0x0;var _0x556e4a=_0x83f1[_0x1b383c];return _0x556e4a;};'use strict';var _=require(_0x183f('0x0'));var util=require(_0x183f('0x1'));var logger=require(_0x183f('0x2'))(_0x183f('0x3'));var moment=require(_0x183f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x183f('0x5'));var rimraf=require(_0x183f('0x6'));var config=require(_0x183f('0x7'));var attributes=require(_0x183f('0x8'));module[_0x183f('0x9')]=function(_0x5381b2,_0x5c1cbd){return _0x5381b2[_0x183f('0xa')](_0x183f('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x183f('0xc'),'fields':['messageId']},{'name':_0x183f('0xd'),'fields':[_0x183f('0xe')],'type':_0x183f('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x30f091,_0x22bcd6,_0x1848a6){var _0x333813=_0x5381b2['models'];var _0x1a1031=_0x30f091[_0x183f('0x10')]({'plain':!![]});if(_0x1a1031[_0x183f('0x11')][_0x183f('0x12')]()==='in'||_0x1a1031[_0x183f('0x11')][_0x183f('0x12')]()===_0x183f('0x13')&&!_0x1a1031['secret']&&!_[_0x183f('0x14')](_0x1a1031['UserId'])){_0x333813['SmsInteraction'][_0x183f('0x15')]({'where':{'id':_0x1a1031[_0x183f('0x16')]}})[_0x183f('0x17')](function(_0x103526){if(_0x103526){_0x103526[_0x183f('0x18')]({'lastMsgAt':_0x1a1031['createdAt'],'lastMsgDirection':_0x1a1031[_0x183f('0x11')]['toLowerCase']()});}})[_0x183f('0x19')](function(_0x357f65){console[_0x183f('0x1a')](_0x357f65);});}if(_0x1a1031['direction']===_0x183f('0x13')&&!_0x1a1031[_0x183f('0x1b')]){var _0x3db030;_0x333813['SmsAccount'][_0x183f('0x1c')]({'where':{'id':_0x1a1031[_0x183f('0x1d')]},'raw':!![]})[_0x183f('0x17')](function(_0x3f713f){_0x3db030=_0x3f713f;if(_0x3db030&&_0x3db030[_0x183f('0x1e')]){switch(_0x3db030[_0x183f('0x1e')]){case'twilio':var _0x328e9f=require(_0x183f('0x1f'));if(_0x3db030[_0x183f('0x20')]&&_0x3db030['authToken']&&_0x3db030[_0x183f('0x21')]){var _0x4ad044=new _0x328e9f(_0x3db030[_0x183f('0x20')],_0x3db030[_0x183f('0x22')]);_0x4ad044[_0x183f('0x23')][_0x183f('0x24')]({'body':_0x1a1031['body'],'to':_0x1a1031[_0x183f('0x21')],'from':_0x3db030[_0x183f('0x21')],'statusCallback':_0x3db030[_0x183f('0x25')]+_0x183f('0x26')+_0x1a1031['id']+_0x183f('0x27')+_0x3db030[_0x183f('0x28')]})[_0x183f('0x17')](function(_0x129ba5){if(_0x129ba5[_0x183f('0x29')]){return _0x30f091[_0x183f('0x18')]({'messageId':_0x129ba5['sid']});}})[_0x183f('0x19')](function(_0x4d6ccf){logger['error'](_0x183f('0x2a'),_0x183f('0x2b'),_0x183f('0x1f'),util[_0x183f('0x2c')](_0x4d6ccf,{'showHidden':![],'depth':null}));});}else{logger[_0x183f('0x1a')](_0x183f('0x2a'),_0x183f('0x2b'),_0x183f('0x1f'),_0x183f('0x2d'));}break;case _0x183f('0x2e'):var _0xf17bd3=_0x183f('0x2f');if(_0x3db030[_0x183f('0x30')]&&_0x3db030[_0x183f('0x31')]){var _0xb7a748={'recipient':[_0x1a1031[_0x183f('0x21')]],'message':_0x1a1031[_0x183f('0xe')],'message_type':_0x3db030['smsMethod']};if(_0x3db030['smsMethod']&&_0x3db030[_0x183f('0x32')]!=='SI'){_0xb7a748[_0x183f('0x33')]=_0x3db030['phone'];}var _0x1bfc44={'url':_0xf17bd3+'login?username='+_0x3db030['username']+_0x183f('0x34')+_0x3db030[_0x183f('0x31')],'method':_0x183f('0x35')};rp(_0x1bfc44)[_0x183f('0x17')](function(_0x6c3745){var _0x202370=_0x6c3745[_0x183f('0x36')](';');var _0x1ba611={'user_key':_0x202370[0x0],'session_key':_0x202370[0x1]};_0x1bfc44={'url':_0xf17bd3+_0x183f('0x37'),'method':'POST','headers':{'user_key':_0x1ba611[_0x183f('0x38')],'Session_key':_0x1ba611[_0x183f('0x39')]},'json':!![],'body':_0xb7a748};return rp(_0x1bfc44);})[_0x183f('0x17')](function(_0x39ee7a){if(_0x39ee7a[_0x183f('0x3a')]>=0x1){var _0x5d3133={'messageId':_0x39ee7a[_0x183f('0x3b')]};if(_0x3db030[_0x183f('0x32')]!=='GP'||!_0x3db030['deliveryReport']){_0x5d3133[_0x183f('0x3c')]=!![];}return _0x30f091['update'](_0x5d3133);}else{return logger[_0x183f('0x1a')](_0x183f('0x2a'),_0x183f('0x2b'),_0x183f('0x2e'),util['inspect'](_0x39ee7a,{'showHidden':![],'depth':null}));}})[_0x183f('0x19')](function(_0x58cdc4){return logger[_0x183f('0x1a')](_0x183f('0x2a'),'afterCreate',_0x183f('0x2e'),util[_0x183f('0x2c')](_0x58cdc4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x183f('0x2a'),_0x183f('0x2b'),_0x183f('0x2e'),_0x183f('0x3d'));}break;case _0x183f('0x3e'):if(_0x3db030[_0x183f('0x22')]){var _0x550eed={'recipient':_0x1a1031[_0x183f('0x21')],'message':_0x1a1031[_0x183f('0xe')],'sender':_0x3db030['senderString']||_0x3db030[_0x183f('0x21')],'authorization':_0x3db030[_0x183f('0x22')]};var _0x22bcd6={'method':_0x183f('0x3f'),'uri':_0x183f('0x40'),'body':_0x550eed,'json':!![]};rp(_0x22bcd6)[_0x183f('0x17')](function(_0x512f3f){var _0xb91f8a={'messageId':_0x512f3f[_0x183f('0x41')]};if(!_0x3db030[_0x183f('0x42')]){_0xb91f8a['read']=!![];}return _0x30f091[_0x183f('0x18')](_0xb91f8a);})[_0x183f('0x19')](function(_0x2b600f){logger[_0x183f('0x1a')](_0x183f('0x2a'),_0x183f('0x2b'),'connectel',util[_0x183f('0x2c')](_0x2b600f,{'showHidden':![],'depth':null}));});}else{logger[_0x183f('0x1a')](_0x183f('0x2a'),_0x183f('0x2b'),_0x183f('0x3e'),'Missing\x20parameters:\x20authToken');}break;case _0x183f('0x43'):if(_0x3db030['username']&&_0x3db030['password']){var _0x550eed={'messages':[{'source':'xCALLY\x20Motion','to':_0x1a1031[_0x183f('0x21')],'body':_0x1a1031[_0x183f('0xe')],'from':_0x3db030['senderString']||_0x3db030[_0x183f('0x21')]}]};var _0x2b92f0=util[_0x183f('0x44')](_0x183f('0x45'),_0x3db030[_0x183f('0x30')],_0x3db030[_0x183f('0x31')]);var _0x22bcd6={'method':_0x183f('0x3f'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x550eed,'headers':{'Authorization':util[_0x183f('0x44')](_0x183f('0x46'),new Buffer(_0x2b92f0)[_0x183f('0x47')](_0x183f('0x48')))},'json':!![]};rp(_0x22bcd6)[_0x183f('0x17')](function(_0x23a361){if(_0x23a361[_0x183f('0x49')]>=0xc8&&_0x23a361[_0x183f('0x49')]<=0xce){if(_0x23a361[_0x183f('0x4a')]&&_0x23a361[_0x183f('0x4a')][_0x183f('0x4b')]>0x0){var _0x221dcf=_[_0x183f('0x4c')](_0x23a361[_0x183f('0x4a')]['messages']);var _0x3c6f40={'messageId':_0x221dcf[_0x183f('0x4d')]};if(!_0x3db030['deliveryReport']){_0x3c6f40[_0x183f('0x3c')]=!![];}return _0x30f091[_0x183f('0x18')](_0x3c6f40);}else{logger[_0x183f('0x1a')](_0x183f('0x2a'),_0x183f('0x2b'),'clickSend',util['inspect'](_0x23a361,{'showHidden':![],'depth':null}));}}else{logger[_0x183f('0x1a')](_0x183f('0x2a'),'afterCreate',_0x183f('0x4e'),util[_0x183f('0x2c')](_0x23a361,{'showHidden':![],'depth':null}));}})['catch'](function(_0x147417){logger[_0x183f('0x1a')](_0x183f('0x2a'),'afterCreate',_0x183f('0x4e'),util[_0x183f('0x2c')](_0x147417,{'showHidden':![],'depth':null}));});}else{logger[_0x183f('0x1a')](_0x183f('0x2a'),_0x183f('0x2b'),_0x183f('0x4e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x183f('0x4f'):if(_0x3db030[_0x183f('0x50')]&&_0x3db030['authToken']){var _0x550eed={'dst':_0x1a1031[_0x183f('0x21')],'text':_0x1a1031[_0x183f('0xe')],'src':_0x3db030['senderString']||_0x3db030[_0x183f('0x21')],'url':_0x3db030[_0x183f('0x25')]+'/api/sms/messages/'+_0x1a1031['id']+_0x183f('0x27')+_0x3db030['token']};var _0x2b92f0=util[_0x183f('0x44')](_0x183f('0x45'),_0x3db030[_0x183f('0x50')],_0x3db030['authToken']);var _0x22bcd6={'method':_0x183f('0x3f'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x3db030[_0x183f('0x50')]),'body':_0x550eed,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x2b92f0)['toString']('base64'))},'json':!![]};rp(_0x22bcd6)['then'](function(_0x177cbb){var _0x397f61={'messageId':_0x177cbb[_0x183f('0x51')][0x0]};return _0x30f091['update'](_0x397f61);})[_0x183f('0x19')](function(_0x2dfe39){logger['error'](_0x183f('0x2a'),_0x183f('0x2b'),_0x183f('0x4f'),util[_0x183f('0x2c')](_0x2dfe39,{'showHidden':![],'depth':null}));});}else{logger[_0x183f('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','plivo',_0x183f('0x52'));}break;case'infobip':if(_0x3db030[_0x183f('0x30')]&&_0x3db030['password']){if(_0x3db030[_0x183f('0x53')]){var _0x262eba={'method':_0x183f('0x3f'),'uri':_0x3db030[_0x183f('0x53')]+_0x183f('0x54'),'body':{'username':_0x3db030[_0x183f('0x30')],'password':_0x3db030['password']},'json':!![]};return rp(_0x262eba)[_0x183f('0x17')](function(_0x3071ed){var _0x46cffb={'method':'POST','uri':_0x3db030[_0x183f('0x53')]+_0x183f('0x55'),'body':{'messages':[{'from':_0x3db030[_0x183f('0x21')],'destinations':[{'to':_0x1a1031['phone']}],'text':_0x1a1031[_0x183f('0xe')],'notifyUrl':_0x3db030[_0x183f('0x25')]+_0x183f('0x26')+_0x1a1031['id']+_0x183f('0x27')+_0x3db030['token'],'notifyContentType':_0x183f('0x56'),'callbackData':_0x3db030[_0x183f('0x21')]+';'+_0x1a1031['body']}]},'headers':{'Authorization':_0x183f('0x57')+_0x3071ed[_0x183f('0x28')]},'json':!![]};return rp(_0x46cffb)[_0x183f('0x17')](function(_0x4ac2fd){if(_0x4ac2fd['messages']){var _0x16efd5={'messageId':_0x4ac2fd[_0x183f('0x23')][0x0][_0x183f('0xc')]};if(!_0x3db030[_0x183f('0x42')]){_0x16efd5[_0x183f('0x3c')]=!![];}return _0x30f091['update'](_0x16efd5);}else{return logger[_0x183f('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x183f('0x2b'),_0x183f('0x58'),util[_0x183f('0x2c')](_0x4ac2fd,{'showHidden':![],'depth':null}));}});})[_0x183f('0x19')](function(_0x4bcc22){return logger[_0x183f('0x1a')](_0x183f('0x2a'),_0x183f('0x2b'),_0x183f('0x58'),util[_0x183f('0x2c')](_0x4bcc22,{'showHidden':![],'depth':null}));});}else{logger[_0x183f('0x1a')](_0x183f('0x2a'),'afterCreate',_0x183f('0x58'),_0x183f('0x59'));}}else{logger[_0x183f('0x1a')](_0x183f('0x2a'),'afterCreate',_0x183f('0x58'),_0x183f('0x3d'));}break;case'csc':var _0x4fac43=require(_0x183f('0x5a'));if(_0x3db030['apiKey']){var _0x46b592={};_0x46b592[_0x183f('0x5b')]=_0x3db030['username'];_0x46b592[_0x183f('0x21')]=_0x1a1031['phone'];_0x46b592[_0x183f('0x33')]=_0x3db030[_0x183f('0x21')];_0x46b592['text']=_0x1a1031[_0x183f('0xe')];_0x46b592[_0x183f('0x5c')]=+new Date();var _0x184374='';var _0xbb790f='';var _0x2baa1d=Object[_0x183f('0x5d')](_0x46b592);_0x2baa1d[_0x183f('0x5e')]();for(var _0x36b617=0x0;_0x36b617<_0x2baa1d[_0x183f('0x5f')];_0x36b617++){if(_0x184374!=''){_0x184374+='&';}_0x184374+=_0x2baa1d[_0x36b617]+'='+encodeURIComponent(_0x46b592[_0x2baa1d[_0x36b617]]);_0xbb790f+=_0x46b592[_0x2baa1d[_0x36b617]];}_0xbb790f+=_0x3db030[_0x183f('0x60')];_0xbb790f=_0x4fac43[_0x183f('0x61')]('md5')[_0x183f('0x18')](_0xbb790f)['digest'](_0x183f('0x62'));if(_0x184374!==''){_0x184374+='&';}_0x184374+='signature='+_0xbb790f;var _0x1bfc44={'method':_0x183f('0x35'),'uri':_0x3db030['baseUrl']+'/external/get/send.php?'+_0x184374,'json':!![]};return rp(_0x1bfc44)['then'](function(_0x55a0fd){var _0x10b683=Object[_0x183f('0x5d')](_0x55a0fd);if(_0x55a0fd[_0x10b683[0x0]][_0x183f('0x1a')]&&parseInt(_0x55a0fd[_0x10b683[0x0]][_0x183f('0x1a')])===0x0){var _0x19be2f={'messageId':_0x55a0fd[_0x10b683[0x0]][_0x183f('0x63')]};if(!_0x3db030[_0x183f('0x42')]){_0x19be2f[_0x183f('0x3c')]=!![];}return _0x30f091[_0x183f('0x18')](_0x19be2f);}else{return logger[_0x183f('0x1a')](_0x183f('0x2a'),_0x183f('0x2b'),'csc',util[_0x183f('0x2c')](_0x55a0fd[_0x183f('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x11da7f){return logger[_0x183f('0x1a')](_0x183f('0x2a'),'afterCreate',_0x183f('0x64'),util[_0x183f('0x2c')](_0x11da7f,{'showHidden':![],'depth':null}));});}else{logger[_0x183f('0x1a')](_0x183f('0x2a'),'afterCreate',_0x183f('0x64'),_0x183f('0x65'));}break;case _0x183f('0x66'):if(_0x3db030['apiKey']){var _0x233a78={'method':'POST','uri':_0x183f('0x67'),'headers':{'Authorization':_0x3db030[_0x183f('0x60')]},'body':{'content':_0x1a1031['body'],'to':[_0x1a1031[_0x183f('0x21')]],'from':_0x3db030[_0x183f('0x21')],'binary':![],'clientMessageId':_0x183f('0x68'),'charset':_0x183f('0x69')},'json':!![]};rp(_0x233a78)[_0x183f('0x17')](function(_0x4759d2){if(!_0x4759d2[_0x183f('0x1a')]){var _0x286459={'messageId':_0x4759d2['messages'][0x0][_0x183f('0x6a')]};if(!_0x3db030['deliveryReport']){_0x286459[_0x183f('0x3c')]=!![];}return _0x30f091['update'](_0x286459);}else{return logger[_0x183f('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x183f('0x66'),util[_0x183f('0x2c')](_0x4759d2[_0x183f('0x1a')],{'showHidden':![],'depth':null}));}})[_0x183f('0x19')](function(_0x3d03a4){return logger[_0x183f('0x1a')](_0x183f('0x2a'),'afterCreate',_0x183f('0x66'),util['inspect'](_0x3d03a4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x183f('0x2a'),'afterCreate',_0x183f('0x66'),_0x183f('0x65'));}break;case _0x183f('0x6b'):if(_0x3db030[_0x183f('0x30')]&&_0x3db030[_0x183f('0x31')]){var _0x2b92f0=util[_0x183f('0x44')](_0x183f('0x45'),_0x3db030[_0x183f('0x30')],_0x3db030[_0x183f('0x31')]);var _0x22bcd6={'method':_0x183f('0x3f'),'uri':_0x183f('0x6c')+_0x3db030['accountId']+'/messages','body':{'to':[_0x1a1031[_0x183f('0x21')]],'text':_0x1a1031[_0x183f('0xe')],'from':_0x3db030[_0x183f('0x21')],'applicationId':_0x3db030['applicationId']},'headers':{'Authorization':util[_0x183f('0x44')]('Basic\x20%s',new Buffer(_0x2b92f0)[_0x183f('0x47')]('base64'))},'json':!![]};rp(_0x22bcd6)[_0x183f('0x17')](function(_0x422668){if(_0x422668['id']){var _0x10eacb={'messageId':_0x422668['id']};return _0x30f091[_0x183f('0x18')](_0x10eacb);}else{logger[_0x183f('0x1a')](_0x183f('0x2a'),_0x183f('0x2b'),'bandwidth',util['inspect'](_0x422668,{'showHidden':![],'depth':null}));}})[_0x183f('0x19')](function(_0x33e3a1){logger[_0x183f('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x183f('0x2b'),'bandwidth',util[_0x183f('0x2c')](_0x33e3a1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x183f('0x2a'),_0x183f('0x2b'),_0x183f('0x6b'),_0x183f('0x3d'));}break;case'intelepeer':if(_0x3db030['apiKey']){var _0x40a57e={};var _0x1bfc44={'method':_0x183f('0x3f'),'uri':_0x183f('0x6d'),'headers':{'Authorization':_0x183f('0x6e')+_0x3db030[_0x183f('0x60')],'Content-Type':_0x183f('0x56')},'body':{'from':_0x3db030[_0x183f('0x21')],'to':_0x1a1031[_0x183f('0x21')],'text':_0x1a1031[_0x183f('0xe')]},'json':!![]};return rp(_0x1bfc44)[_0x183f('0x17')](function(_0xef534b){if(_0xef534b[_0x183f('0x6f')]==0xca){_0x40a57e[_0x183f('0x70')]=_0xef534b;var _0x57a868={'method':_0x183f('0x3f'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x3db030['apiKey'],'Content-Type':_0x183f('0x56')},'body':{'refid':_0x40a57e['message'][_0x183f('0x71')]},'json':!![]};return rp(_0x57a868)[_0x183f('0x17')](function(_0xdbfa5e){_0x40a57e[_0x183f('0x72')]=_0xdbfa5e;var _0x547501={'messageId':_0x40a57e[_0x183f('0x70')][_0x183f('0x71')],'read':!![]};return _0x30f091[_0x183f('0x18')](_0x547501);});}else{return logger[_0x183f('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util[_0x183f('0x2c')](_0xef534b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x360f14){return logger[_0x183f('0x1a')](_0x183f('0x2a'),_0x183f('0x2b'),_0x183f('0x73'),util[_0x183f('0x2c')](_0x360f14,{'showHidden':![],'depth':null}));});}else{return logger[_0x183f('0x1a')](_0x183f('0x2a'),'afterCreate',_0x183f('0x73'),_0x183f('0x74'));}break;}}})['finally'](function(){_0x1848a6();});}else{_0x1848a6();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index bbc1a6a..f208edf 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 _0xa756=['then','CreateSmsMessage','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','SmsMessage','create','body','options','raw'];(function(_0x25a964,_0x5f547f){var _0x49c085=function(_0x5920f2){while(--_0x5920f2){_0x25a964['push'](_0x25a964['shift']());}};_0x49c085(++_0x5f547f);}(_0xa756,0xc2));var _0x6a75=function(_0x493dda,_0x1528d3){_0x493dda=_0x493dda-0x0;var _0x31a5a6=_0xa756[_0x493dda];return _0x31a5a6;};'use strict';var _=require(_0x6a75('0x0'));var util=require(_0x6a75('0x1'));var moment=require(_0x6a75('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a75('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a75('0x4'))(_0x6a75('0x5'));var config=require(_0x6a75('0x6'));var jayson=require(_0x6a75('0x7'));var client=jayson['client'][_0x6a75('0x8')]({'port':0x232a});config[_0x6a75('0x9')]=_['defaults'](config[_0x6a75('0x9')],{'host':_0x6a75('0xa'),'port':0x18eb});var socket=require(_0x6a75('0xb'))(new Redis(config[_0x6a75('0x9')]));require(_0x6a75('0xc'))[_0x6a75('0xd')](socket);function respondWithRpcPromise(_0x120461,_0x27d337,_0x5e7b0c){return new BPromise(function(_0x311669,_0x2862b7){return client[_0x6a75('0xe')](_0x120461,_0x5e7b0c)['then'](function(_0xa4e32b){logger[_0x6a75('0xf')](_0x6a75('0x10'),_0x27d337,'request\x20sent');logger[_0x6a75('0x11')](_0x6a75('0x12'),_0x27d337,_0x6a75('0x13'),JSON[_0x6a75('0x14')](_0xa4e32b));if(_0xa4e32b['error']){if(_0xa4e32b[_0x6a75('0x15')]['code']===0x1f4){logger[_0x6a75('0x15')](_0x6a75('0x10'),_0x27d337,_0xa4e32b[_0x6a75('0x15')][_0x6a75('0x16')]);return _0x2862b7(_0xa4e32b[_0x6a75('0x15')]['message']);}logger[_0x6a75('0x15')](_0x6a75('0x10'),_0x27d337,_0xa4e32b[_0x6a75('0x15')][_0x6a75('0x16')]);return _0x311669(_0xa4e32b[_0x6a75('0x15')][_0x6a75('0x16')]);}else{logger[_0x6a75('0xf')](_0x6a75('0x10'),_0x27d337,_0x6a75('0x13'));_0x311669(_0xa4e32b[_0x6a75('0x17')]['message']);}})[_0x6a75('0x18')](function(_0x462e86){logger['error']('SmsMessage,\x20%s,\x20%s',_0x27d337,_0x462e86);_0x2862b7(_0x462e86);});});}exports['CreateSmsMessage']=function(_0x3ddc1f){var _0x1581ff=this;return new Promise(function(_0x4f3043,_0x4c0d70){return db[_0x6a75('0x19')][_0x6a75('0x1a')](_0x3ddc1f[_0x6a75('0x1b')],{'raw':_0x3ddc1f[_0x6a75('0x1c')]?_0x3ddc1f[_0x6a75('0x1c')][_0x6a75('0x1d')]===undefined?!![]:![]:!![]})[_0x6a75('0x1e')](function(_0x1e8f0c){logger['info'](_0x6a75('0x1f'),_0x3ddc1f);logger[_0x6a75('0x11')](_0x6a75('0x1f'),_0x3ddc1f,JSON[_0x6a75('0x14')](_0x1e8f0c));_0x4f3043(_0x1e8f0c);})[_0x6a75('0x18')](function(_0x261ad9){logger['error'](_0x6a75('0x1f'),_0x261ad9['message'],_0x3ddc1f);_0x4c0d70(_0x1581ff[_0x6a75('0x15')](0x1f4,_0x261ad9[_0x6a75('0x16')]));});});}; \ No newline at end of file +var _0x8c71=['debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsMessage','SmsMessage','options','raw','lodash','moment','randomstring','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x529e6c,_0x54b8a0){var _0x3ae9d3=function(_0x46e1f9){while(--_0x46e1f9){_0x529e6c['push'](_0x529e6c['shift']());}};_0x3ae9d3(++_0x54b8a0);}(_0x8c71,0x7f));var _0x18c7=function(_0xd79494,_0x1fcda7){_0xd79494=_0xd79494-0x0;var _0x1c1698=_0x8c71[_0xd79494];return _0x1c1698;};'use strict';var _=require(_0x18c7('0x0'));var util=require('util');var moment=require(_0x18c7('0x1'));var BPromise=require('bluebird');var rs=require(_0x18c7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x18c7('0x3'));var config=require(_0x18c7('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x18c7('0x5')][_0x18c7('0x6')]({'port':0x232a});config[_0x18c7('0x7')]=_[_0x18c7('0x8')](config[_0x18c7('0x7')],{'host':_0x18c7('0x9'),'port':0x18eb});var socket=require(_0x18c7('0xa'))(new Redis(config['redis']));require(_0x18c7('0xb'))[_0x18c7('0xc')](socket);function respondWithRpcPromise(_0x56f35a,_0x594e7c,_0x544264){return new BPromise(function(_0x21d39f,_0x43f180){return client[_0x18c7('0xd')](_0x56f35a,_0x544264)[_0x18c7('0xe')](function(_0x2e4e36){logger[_0x18c7('0xf')](_0x18c7('0x10'),_0x594e7c,_0x18c7('0x11'));logger[_0x18c7('0x12')](_0x18c7('0x13'),_0x594e7c,'request\x20sent',JSON[_0x18c7('0x14')](_0x2e4e36));if(_0x2e4e36['error']){if(_0x2e4e36[_0x18c7('0x15')]['code']===0x1f4){logger[_0x18c7('0x15')](_0x18c7('0x10'),_0x594e7c,_0x2e4e36[_0x18c7('0x15')][_0x18c7('0x16')]);return _0x43f180(_0x2e4e36['error'][_0x18c7('0x16')]);}logger[_0x18c7('0x15')](_0x18c7('0x10'),_0x594e7c,_0x2e4e36['error'][_0x18c7('0x16')]);return _0x21d39f(_0x2e4e36[_0x18c7('0x15')][_0x18c7('0x16')]);}else{logger['info'](_0x18c7('0x10'),_0x594e7c,_0x18c7('0x11'));_0x21d39f(_0x2e4e36[_0x18c7('0x17')][_0x18c7('0x16')]);}})[_0x18c7('0x18')](function(_0x561fc8){logger[_0x18c7('0x15')]('SmsMessage,\x20%s,\x20%s',_0x594e7c,_0x561fc8);_0x43f180(_0x561fc8);});});}exports[_0x18c7('0x19')]=function(_0xec2cda){var _0x2c1815=this;return new Promise(function(_0x4a34b4,_0x5a3a15){return db[_0x18c7('0x1a')]['create'](_0xec2cda['body'],{'raw':_0xec2cda[_0x18c7('0x1b')]?_0xec2cda[_0x18c7('0x1b')][_0x18c7('0x1c')]===undefined?!![]:![]:!![]})[_0x18c7('0xe')](function(_0x5b7517){logger[_0x18c7('0xf')](_0x18c7('0x19'),_0xec2cda);logger[_0x18c7('0x12')](_0x18c7('0x19'),_0xec2cda,JSON[_0x18c7('0x14')](_0x5b7517));_0x4a34b4(_0x5b7517);})[_0x18c7('0x18')](function(_0x358adf){logger[_0x18c7('0x15')](_0x18c7('0x19'),_0x358adf['message'],_0xec2cda);_0x5a3a15(_0x2c1815[_0x18c7('0x15')](0x1f4,_0x358adf[_0x18c7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index eca197e..2276b60 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 _0xf202=['save','remove','emit','removeListener','length','smsMessage:','./smsMessage.events'];(function(_0x2cd9e3,_0xf441e2){var _0x38c00d=function(_0x2e75c6){while(--_0x2e75c6){_0x2cd9e3['push'](_0x2cd9e3['shift']());}};_0x38c00d(++_0xf441e2);}(_0xf202,0x1e2));var _0x2f20=function(_0x17d69c,_0x5eb937){_0x17d69c=_0x17d69c-0x0;var _0x364876=_0xf202[_0x17d69c];return _0x364876;};'use strict';var SmsMessageEvents=require(_0x2f20('0x0'));var events=[_0x2f20('0x1'),_0x2f20('0x2'),'update'];function createListener(_0x18680e,_0xc47623){return function(_0x48876f){_0xc47623[_0x2f20('0x3')](_0x18680e,_0x48876f);};}function removeListener(_0x1ef133,_0x1cd3fc){return function(){SmsMessageEvents[_0x2f20('0x4')](_0x1ef133,_0x1cd3fc);};}exports['register']=function(_0x402c45){for(var _0x4b0400=0x0,_0x4b863d=events[_0x2f20('0x5')];_0x4b0400<_0x4b863d;_0x4b0400++){var _0x2a3ad1=events[_0x4b0400];var _0x18d602=createListener(_0x2f20('0x6')+_0x2a3ad1,_0x402c45);SmsMessageEvents['on'](_0x2a3ad1,_0x18d602);}}; \ No newline at end of file +var _0x89f4=['update','length','smsMessage:','./smsMessage.events','remove'];(function(_0x57a670,_0x30e402){var _0x41ce21=function(_0x11bd34){while(--_0x11bd34){_0x57a670['push'](_0x57a670['shift']());}};_0x41ce21(++_0x30e402);}(_0x89f4,0xee));var _0x489f=function(_0x43fc42,_0x40deb1){_0x43fc42=_0x43fc42-0x0;var _0x216b99=_0x89f4[_0x43fc42];return _0x216b99;};'use strict';var SmsMessageEvents=require(_0x489f('0x0'));var events=['save',_0x489f('0x1'),_0x489f('0x2')];function createListener(_0x5104dd,_0x990ad6){return function(_0x406ae8){_0x990ad6['emit'](_0x5104dd,_0x406ae8);};}function removeListener(_0x239431,_0x5cbe14){return function(){SmsMessageEvents['removeListener'](_0x239431,_0x5cbe14);};}exports['register']=function(_0x527cab){for(var _0x3e96e0=0x0,_0x5873cd=events[_0x489f('0x3')];_0x3e96e0<_0x5873cd;_0x3e96e0++){var _0x483ca9=events[_0x3e96e0];var _0xdb136=createListener(_0x489f('0x4')+_0x483ca9,_0x527cab);SmsMessageEvents['on'](_0x483ca9,_0xdb136);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 5debf9b..4b081a9 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 _0xd7a9=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe'];(function(_0x284174,_0x1dd400){var _0x58b7fb=function(_0x20a7d5){while(--_0x20a7d5){_0x284174['push'](_0x284174['shift']());}};_0x58b7fb(++_0x1dd400);}(_0xd7a9,0xad));var _0x9d7a=function(_0x2f8d56,_0x376c64){_0x2f8d56=_0x2f8d56-0x0;var _0x36081d=_0xd7a9[_0x2f8d56];return _0x36081d;};'use strict';var multer=require(_0x9d7a('0x0'));var util=require(_0x9d7a('0x1'));var path=require(_0x9d7a('0x2'));var timeout=require(_0x9d7a('0x3'));var express=require('express');var router=express[_0x9d7a('0x4')]();var fs_extra=require(_0x9d7a('0x5'));var auth=require(_0x9d7a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9d7a('0x7'));var controller=require(_0x9d7a('0x8'));router[_0x9d7a('0x9')]('/',auth[_0x9d7a('0xa')](),controller['index']);router[_0x9d7a('0x9')](_0x9d7a('0xb'),auth[_0x9d7a('0xa')](),controller[_0x9d7a('0xc')]);router[_0x9d7a('0x9')](_0x9d7a('0xd'),auth['isAuthenticated'](),controller[_0x9d7a('0xe')]);router['get'](_0x9d7a('0xf'),auth[_0x9d7a('0xa')](),controller[_0x9d7a('0x10')]);router[_0x9d7a('0x9')](_0x9d7a('0x11'),auth[_0x9d7a('0xa')](),controller[_0x9d7a('0x12')]);router[_0x9d7a('0x9')](_0x9d7a('0x13'),auth['isAuthenticated'](),controller[_0x9d7a('0x14')]);router['post']('/',auth[_0x9d7a('0xa')](),controller[_0x9d7a('0x15')]);router[_0x9d7a('0x16')](_0x9d7a('0x11'),auth[_0x9d7a('0xa')](),controller[_0x9d7a('0x17')]);router[_0x9d7a('0x16')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x9d7a('0x18')](_0x9d7a('0xd'),auth[_0x9d7a('0xa')](),controller[_0x9d7a('0x19')]);router[_0x9d7a('0x1a')](_0x9d7a('0xd'),auth[_0x9d7a('0xa')](),controller[_0x9d7a('0x1b')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0x9d7a('0x1c')]);router[_0x9d7a('0x1a')](_0x9d7a('0x13'),auth[_0x9d7a('0xa')](),controller[_0x9d7a('0x1d')]);module[_0x9d7a('0x1e')]=router; \ No newline at end of file +var _0x587f=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','/:id','update','delete','destroy','removeTeams','exports','multer','util'];(function(_0xdca4a6,_0x4965f6){var _0x5c5b95=function(_0x2c8fe7){while(--_0x2c8fe7){_0xdca4a6['push'](_0xdca4a6['shift']());}};_0x5c5b95(++_0x4965f6);}(_0x587f,0xc2));var _0xf587=function(_0x30faee,_0x1c3794){_0x30faee=_0x30faee-0x0;var _0x3a90ab=_0x587f[_0x30faee];return _0x3a90ab;};'use strict';var multer=require(_0xf587('0x0'));var util=require(_0xf587('0x1'));var path=require(_0xf587('0x2'));var timeout=require(_0xf587('0x3'));var express=require(_0xf587('0x4'));var router=express[_0xf587('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf587('0x6'));var interaction=require(_0xf587('0x7'));var config=require(_0xf587('0x8'));var controller=require('./smsQueue.controller');router[_0xf587('0x9')]('/',auth[_0xf587('0xa')](),controller['index']);router['get'](_0xf587('0xb'),auth['isAuthenticated'](),controller[_0xf587('0xc')]);router[_0xf587('0x9')]('/:id',auth[_0xf587('0xa')](),controller[_0xf587('0xd')]);router[_0xf587('0x9')]('/:id/members',auth[_0xf587('0xa')](),controller[_0xf587('0xe')]);router[_0xf587('0x9')](_0xf587('0xf'),auth[_0xf587('0xa')](),controller[_0xf587('0x10')]);router['get'](_0xf587('0x11'),auth[_0xf587('0xa')](),controller[_0xf587('0x12')]);router[_0xf587('0x13')]('/',auth[_0xf587('0xa')](),controller[_0xf587('0x14')]);router[_0xf587('0x13')](_0xf587('0xf'),auth[_0xf587('0xa')](),controller['addTeams']);router['post'](_0xf587('0x11'),auth[_0xf587('0xa')](),controller[_0xf587('0x15')]);router['put'](_0xf587('0x16'),auth[_0xf587('0xa')](),controller[_0xf587('0x17')]);router[_0xf587('0x18')](_0xf587('0x16'),auth[_0xf587('0xa')](),controller[_0xf587('0x19')]);router[_0xf587('0x18')]('/:id/teams',auth[_0xf587('0xa')](),controller[_0xf587('0x1a')]);router[_0xf587('0x18')]('/:id/users',auth[_0xf587('0xa')](),controller['removeAgents']);module[_0xf587('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 5ae0db5..90f6cb8 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 _0xedff=['INTEGER','ENUM','rrmemory','sequelize','STRING'];(function(_0x30c133,_0x20e3bd){var _0x38a446=function(_0x279454){while(--_0x279454){_0x30c133['push'](_0x30c133['shift']());}};_0x38a446(++_0x20e3bd);}(_0xedff,0x125));var _0xfedf=function(_0x3bfbec,_0x4051a6){_0x3bfbec=_0x3bfbec-0x0;var _0x2cc96a=_0xedff[_0x3bfbec];return _0x2cc96a;};'use strict';var Sequelize=require(_0xfedf('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfedf('0x1')]},'timeout':{'type':Sequelize[_0xfedf('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfedf('0x3')](_0xfedf('0x4'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x8f1f=['name','INTEGER','rrmemory','sequelize','exports','STRING'];(function(_0x36f6fd,_0x4ac52d){var _0x192ce2=function(_0x43e43e){while(--_0x43e43e){_0x36f6fd['push'](_0x36f6fd['shift']());}};_0x192ce2(++_0x4ac52d);}(_0x8f1f,0x17d));var _0xf8f1=function(_0x2c78b0,_0x24bf54){_0x2c78b0=_0x2c78b0-0x0;var _0x4af61f=_0x8f1f[_0x2c78b0];return _0x4af61f;};'use strict';var Sequelize=require(_0xf8f1('0x0'));module[_0xf8f1('0x1')]={'name':{'type':Sequelize[_0xf8f1('0x2')],'unique':_0xf8f1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf8f1('0x2')]},'timeout':{'type':Sequelize[_0xf8f1('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xf8f1('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 270b580..24aba5f 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 _0x0c01=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','status','end','json','offset','limit','undefined','count','reject','then','get','SmsQueues','UserProfileResource','sendStatus','error','stack','name','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','includeAll','include','findAll','catch','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','params','describe','findOne','UserSmsQueue','nolimit','SmsQueueId','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x0c01,0x10f));var _0x10c0=function(_0x381034,_0x216c04){_0x381034=_0x381034-0x0;var _0x3cf431=_0x0c01[_0x381034];return _0x3cf431;};'use strict';var emlformat=require(_0x10c0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x10c0('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x10c0('0x2'));var Mustache=require(_0x10c0('0x3'));var util=require(_0x10c0('0x4'));var path=require(_0x10c0('0x5'));var sox=require(_0x10c0('0x6'));var csv=require(_0x10c0('0x7'));var ejs=require(_0x10c0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x10c0('0x9'));var squel=require('squel');var crypto=require(_0x10c0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x10c0('0xb'));var toCsv=require(_0x10c0('0x7'));var querystring=require(_0x10c0('0xc'));var Papa=require(_0x10c0('0xd'));var Redis=require(_0x10c0('0xe'));var authService=require(_0x10c0('0xf'));var qs=require(_0x10c0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x10c0('0x11'));var logger=require(_0x10c0('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x10c0('0x13'));var db=require(_0x10c0('0x14'))['db'];config[_0x10c0('0x15')]=_[_0x10c0('0x16')](config[_0x10c0('0x15')],{'host':_0x10c0('0x17'),'port':0x18eb});var socket=require(_0x10c0('0x18'))(new Redis(config[_0x10c0('0x15')]));require(_0x10c0('0x19'))[_0x10c0('0x1a')](socket);function respondWithStatusCode(_0x4516c7,_0x4c70b1){_0x4c70b1=_0x4c70b1||0xcc;return function(_0x17bcf3){if(_0x17bcf3){return _0x4516c7['sendStatus'](_0x4c70b1);}return _0x4516c7[_0x10c0('0x1b')](_0x4c70b1)[_0x10c0('0x1c')]();};}function respondWithResult(_0x3ddc80,_0x389619){_0x389619=_0x389619||0xc8;return function(_0xc2e3ac){if(_0xc2e3ac){return _0x3ddc80[_0x10c0('0x1b')](_0x389619)[_0x10c0('0x1d')](_0xc2e3ac);}};}function respondWithFilteredResult(_0x13b6d2,_0x46c2fe){return function(_0x411883){if(_0x411883){var _0x278612=typeof _0x46c2fe[_0x10c0('0x1e')]==='undefined'&&typeof _0x46c2fe[_0x10c0('0x1f')]===_0x10c0('0x20');var _0x279239=_0x411883[_0x10c0('0x21')];var _0x1420b0=_0x278612?0x0:_0x46c2fe[_0x10c0('0x1e')];var _0x546db0=_0x278612?_0x411883['count']:_0x46c2fe[_0x10c0('0x1e')]+_0x46c2fe[_0x10c0('0x1f')];var _0xbdebe4;if(_0x546db0>=_0x279239){_0x546db0=_0x279239;_0xbdebe4=0xc8;}else{_0xbdebe4=0xce;}_0x13b6d2[_0x10c0('0x1b')](_0xbdebe4);return _0x13b6d2['set']('Content-Range',_0x1420b0+'-'+_0x546db0+'/'+_0x279239)[_0x10c0('0x1d')](_0x411883);}return null;};}function patchUpdates(_0x170947){return function(_0x18fc9d){try{jsonpatch['apply'](_0x18fc9d,_0x170947,!![]);}catch(_0x47a0f2){return BPromise[_0x10c0('0x22')](_0x47a0f2);}return _0x18fc9d['save']();};}function saveUpdates(_0x53edcd,_0x5eab76){return function(_0x1fa180){if(_0x1fa180){return _0x1fa180['update'](_0x53edcd)[_0x10c0('0x23')](function(_0x233d71){return _0x233d71;});}return null;};}function removeEntity(_0x21d722,_0x235fc5){return function(_0x321458){if(_0x321458){return _0x321458['destroy']()[_0x10c0('0x23')](function(){var _0x526297=_0x321458[_0x10c0('0x24')]({'plain':!![]});var _0x2683ee=_0x10c0('0x25');return db[_0x10c0('0x26')]['destroy']({'where':{'type':_0x2683ee,'resourceId':_0x526297['id']}})[_0x10c0('0x23')](function(){return _0x321458;});})[_0x10c0('0x23')](function(){_0x21d722[_0x10c0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x449901,_0x1a39fb){return function(_0x4217fc){if(!_0x4217fc){_0x449901[_0x10c0('0x27')](0x194);}return _0x4217fc;};}function handleError(_0x6c9415,_0x5b0ce2){_0x5b0ce2=_0x5b0ce2||0x1f4;return function(_0x2f839b){logger[_0x10c0('0x28')](_0x2f839b[_0x10c0('0x29')]);if(_0x2f839b[_0x10c0('0x2a')]){delete _0x2f839b[_0x10c0('0x2a')];}_0x6c9415[_0x10c0('0x1b')](_0x5b0ce2)['send'](_0x2f839b);};}exports[_0x10c0('0x2b')]=function(_0x52ea42,_0x5505f1){var _0x35479f={},_0x3a0d01={},_0x5323dc={'count':0x0,'rows':[]};var _0x444d28=_[_0x10c0('0x2c')](db[_0x10c0('0x2d')][_0x10c0('0x2e')],function(_0x8448bf){return{'name':_0x8448bf[_0x10c0('0x2f')],'type':_0x8448bf[_0x10c0('0x30')][_0x10c0('0x31')]};});_0x3a0d01[_0x10c0('0x32')]=_[_0x10c0('0x2c')](_0x444d28,'name');_0x3a0d01[_0x10c0('0x33')]=_[_0x10c0('0x34')](_0x52ea42['query']);_0x3a0d01[_0x10c0('0x35')]=_['intersection'](_0x3a0d01[_0x10c0('0x32')],_0x3a0d01[_0x10c0('0x33')]);_0x35479f[_0x10c0('0x36')]=_[_0x10c0('0x37')](_0x3a0d01[_0x10c0('0x32')],qs[_0x10c0('0x38')](_0x52ea42[_0x10c0('0x33')][_0x10c0('0x38')]));_0x35479f[_0x10c0('0x36')]=_0x35479f[_0x10c0('0x36')][_0x10c0('0x39')]?_0x35479f[_0x10c0('0x36')]:_0x3a0d01[_0x10c0('0x32')];if(!_0x52ea42[_0x10c0('0x33')][_0x10c0('0x3a')]('nolimit')){_0x35479f[_0x10c0('0x1f')]=qs[_0x10c0('0x1f')](_0x52ea42['query'][_0x10c0('0x1f')]);_0x35479f[_0x10c0('0x1e')]=qs[_0x10c0('0x1e')](_0x52ea42[_0x10c0('0x33')][_0x10c0('0x1e')]);}_0x35479f[_0x10c0('0x3b')]=qs[_0x10c0('0x3c')](_0x52ea42['query'][_0x10c0('0x3c')]);_0x35479f[_0x10c0('0x3d')]=qs[_0x10c0('0x35')](_[_0x10c0('0x3e')](_0x52ea42['query'],_0x3a0d01[_0x10c0('0x35')]),_0x444d28);if(_0x52ea42[_0x10c0('0x33')]['filter']){_0x35479f['where']=_['merge'](_0x35479f[_0x10c0('0x3d')],{'$or':_[_0x10c0('0x2c')](_0x444d28,function(_0x589046){if(_0x589046[_0x10c0('0x30')]!==_0x10c0('0x3f')){var _0x4a51eb={};_0x4a51eb[_0x589046[_0x10c0('0x2a')]]={'$like':'%'+_0x52ea42['query'][_0x10c0('0x40')]+'%'};return _0x4a51eb;}})});}_0x35479f=_['merge']({},_0x35479f,_0x52ea42['options']);var _0x1ece7b={'where':_0x35479f[_0x10c0('0x3d')]};return db[_0x10c0('0x2d')][_0x10c0('0x21')](_0x1ece7b)[_0x10c0('0x23')](function(_0x586d46){_0x5323dc[_0x10c0('0x21')]=_0x586d46;if(_0x52ea42[_0x10c0('0x33')][_0x10c0('0x41')]){_0x35479f[_0x10c0('0x42')]=[{'all':!![]}];}return db['SmsQueue'][_0x10c0('0x43')](_0x35479f);})['then'](function(_0x2a5627){_0x5323dc['rows']=_0x2a5627;return _0x5323dc;})[_0x10c0('0x23')](respondWithFilteredResult(_0x5505f1,_0x35479f))[_0x10c0('0x44')](handleError(_0x5505f1,null));};exports['show']=function(_0x8f44c9,_0x399795){var _0x17bc5c={'raw':!![],'where':{'id':_0x8f44c9['params']['id']}},_0x95414f={};_0x95414f[_0x10c0('0x32')]=_[_0x10c0('0x34')](db['SmsQueue'][_0x10c0('0x2e')]);_0x95414f[_0x10c0('0x33')]=_[_0x10c0('0x34')](_0x8f44c9[_0x10c0('0x33')]);_0x95414f[_0x10c0('0x35')]=_[_0x10c0('0x37')](_0x95414f[_0x10c0('0x32')],_0x95414f[_0x10c0('0x33')]);_0x17bc5c[_0x10c0('0x36')]=_[_0x10c0('0x37')](_0x95414f[_0x10c0('0x32')],qs[_0x10c0('0x38')](_0x8f44c9['query'][_0x10c0('0x38')]));_0x17bc5c[_0x10c0('0x36')]=_0x17bc5c[_0x10c0('0x36')]['length']?_0x17bc5c['attributes']:_0x95414f['model'];if(_0x8f44c9[_0x10c0('0x33')][_0x10c0('0x41')]){_0x17bc5c[_0x10c0('0x42')]=[{'all':!![]}];}_0x17bc5c=_[_0x10c0('0x45')]({},_0x17bc5c,_0x8f44c9[_0x10c0('0x46')]);return db['SmsQueue'][_0x10c0('0x47')](_0x17bc5c)['then'](handleEntityNotFound(_0x399795,null))[_0x10c0('0x23')](respondWithResult(_0x399795,null))[_0x10c0('0x44')](handleError(_0x399795,null));};exports['create']=function(_0x447c8f,_0x138807){return db['SmsQueue'][_0x10c0('0x48')](_0x447c8f[_0x10c0('0x49')],{})['then'](function(_0x4bbd8e){var _0x330a50=_0x447c8f[_0x10c0('0x4a')][_0x10c0('0x24')]({'plain':!![]});if(!_0x330a50)throw new Error(_0x10c0('0x4b'));if(_0x330a50['role']===_0x10c0('0x4a')){var _0x58ba42=_0x4bbd8e[_0x10c0('0x24')]({'plain':!![]});var _0x310ccc=_0x10c0('0x25');return db['UserProfileSection'][_0x10c0('0x47')]({'where':{'name':_0x310ccc,'userProfileId':_0x330a50[_0x10c0('0x4c')]},'raw':!![]})[_0x10c0('0x23')](function(_0x3ebfc5){if(_0x3ebfc5&&_0x3ebfc5[_0x10c0('0x4d')]===0x0){return db[_0x10c0('0x26')]['create']({'name':_0x58ba42[_0x10c0('0x2a')],'resourceId':_0x58ba42['id'],'type':_0x3ebfc5[_0x10c0('0x2a')],'sectionId':_0x3ebfc5['id']},{})[_0x10c0('0x23')](function(){return _0x4bbd8e;});}else{return _0x4bbd8e;}})[_0x10c0('0x44')](function(_0x4c1f7a){logger['error'](_0x10c0('0x4e'),_0x4c1f7a);throw _0x4c1f7a;});}return _0x4bbd8e;})[_0x10c0('0x23')](respondWithResult(_0x138807,0xc9))[_0x10c0('0x44')](handleError(_0x138807,null));};exports[_0x10c0('0x4f')]=function(_0x518082,_0x5b5519){if(_0x518082[_0x10c0('0x49')]['id']){delete _0x518082[_0x10c0('0x49')]['id'];}return db['SmsQueue'][_0x10c0('0x47')]({'where':{'id':_0x518082['params']['id']}})['then'](handleEntityNotFound(_0x5b5519,null))['then'](saveUpdates(_0x518082[_0x10c0('0x49')],null))[_0x10c0('0x23')](respondWithResult(_0x5b5519,null))['catch'](handleError(_0x5b5519,null));};exports[_0x10c0('0x50')]=function(_0xd3b95a,_0x1a140a){return db[_0x10c0('0x2d')][_0x10c0('0x47')]({'where':{'id':_0xd3b95a[_0x10c0('0x51')]['id']}})['then'](handleEntityNotFound(_0x1a140a,null))[_0x10c0('0x23')](removeEntity(_0x1a140a,null))[_0x10c0('0x44')](handleError(_0x1a140a,null));};exports[_0x10c0('0x52')]=function(_0x23ba78,_0x91f70f){return db[_0x10c0('0x2d')][_0x10c0('0x52')]()[_0x10c0('0x23')](respondWithResult(_0x91f70f,null))[_0x10c0('0x44')](handleError(_0x91f70f,null));};exports['getMembers']=function(_0x55c35a,_0x5a6831,_0x273eb0){var _0x1f31ea={'raw':!![],'where':{}},_0x23ee99={},_0x583b20;return db[_0x10c0('0x2d')][_0x10c0('0x53')]({'where':{'id':_0x55c35a[_0x10c0('0x51')]['id']}})[_0x10c0('0x23')](handleEntityNotFound(_0x5a6831,null))[_0x10c0('0x23')](function(_0x104604){if(_0x104604){_0x583b20=_0x104604[_0x10c0('0x24')]({'plain':!![]});_0x23ee99[_0x10c0('0x32')]=_[_0x10c0('0x34')](db[_0x10c0('0x54')]['rawAttributes']);_0x23ee99[_0x10c0('0x33')]=_[_0x10c0('0x34')](_0x55c35a[_0x10c0('0x33')]);_0x23ee99['filters']=_[_0x10c0('0x37')](_0x23ee99[_0x10c0('0x32')],_0x23ee99[_0x10c0('0x33')]);_0x1f31ea[_0x10c0('0x36')]=_[_0x10c0('0x37')](_0x23ee99[_0x10c0('0x32')],qs[_0x10c0('0x38')](_0x55c35a[_0x10c0('0x33')][_0x10c0('0x38')]));_0x1f31ea[_0x10c0('0x36')]=_0x1f31ea['attributes'][_0x10c0('0x39')]?_0x1f31ea['attributes']:_0x23ee99['model'];if(!_0x55c35a['query'][_0x10c0('0x3a')](_0x10c0('0x55'))){_0x1f31ea['limit']=qs['limit'](_0x55c35a[_0x10c0('0x33')]['limit']);_0x1f31ea['offset']=qs[_0x10c0('0x1e')](_0x55c35a[_0x10c0('0x33')][_0x10c0('0x1e')]);}_0x1f31ea[_0x10c0('0x3b')]=qs[_0x10c0('0x3c')](_0x55c35a[_0x10c0('0x33')][_0x10c0('0x3c')]);_0x1f31ea[_0x10c0('0x3d')]=qs[_0x10c0('0x35')](_['pick'](_0x55c35a[_0x10c0('0x33')],_0x23ee99[_0x10c0('0x35')]));_0x1f31ea['where'][_0x10c0('0x56')]=_0x104604['id'];if(_0x55c35a[_0x10c0('0x33')]['filter']){_0x1f31ea[_0x10c0('0x3d')]=_[_0x10c0('0x45')](_0x1f31ea['where'],{'$or':_['map'](_0x1f31ea[_0x10c0('0x36')],function(_0x28ad0f){var _0x1a1d45={};_0x1a1d45[_0x28ad0f]={'$like':'%'+_0x55c35a[_0x10c0('0x33')][_0x10c0('0x40')]+'%'};return _0x1a1d45;})});}_0x1f31ea=_[_0x10c0('0x45')]({},_0x1f31ea,_0x55c35a[_0x10c0('0x46')]);return db[_0x10c0('0x54')][_0x10c0('0x43')](_0x1f31ea);}})['then'](function(_0x2f0c0a){if(_0x2f0c0a){return db['User'][_0x10c0('0x57')]({'where':{'id':_[_0x10c0('0x2c')](_0x2f0c0a,_0x10c0('0x58')),'role':_0x10c0('0x59')},'attributes':['id','name',_0x10c0('0x5a'),_0x10c0('0x5b'),_0x10c0('0x5c')]});}})[_0x10c0('0x23')](function(_0x52dd4d){if(_0x52dd4d){return{'count':_0x52dd4d['count'],'rows':_[_0x10c0('0x2c')](_0x52dd4d[_0x10c0('0x5d')],function(_0x15befa){return{'membername':_0x15befa['name'],'UserId':_0x15befa['id'],'queue_name':_0x583b20['name'],'SmsQueueId':_0x583b20['id'],'interface':util[_0x10c0('0x5e')](_0x10c0('0x5f'),_0x10c0('0x60'),_0x15befa['name']),'penalty':0x0,'paused':_0x15befa[_0x10c0('0x5a')],'createdAt':_0x15befa[_0x10c0('0x5c')],'updatedAt':_0x15befa[_0x10c0('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x10c0('0x23')](respondWithFilteredResult(_0x5a6831,_0x1f31ea))[_0x10c0('0x44')](handleError(_0x5a6831,null));};exports[_0x10c0('0x61')]=function(_0x4d6c9b,_0x146cc6,_0x4d21f1){var _0x3058eb={};var _0x3e5397={};var _0x234328;var _0x63a8f1;return db['SmsQueue'][_0x10c0('0x53')]({'where':{'id':_0x4d6c9b[_0x10c0('0x51')]['id']}})[_0x10c0('0x23')](handleEntityNotFound(_0x146cc6,null))[_0x10c0('0x23')](function(_0x40d93c){if(_0x40d93c){_0x234328=_0x40d93c;_0x3e5397[_0x10c0('0x32')]=_[_0x10c0('0x34')](db[_0x10c0('0x62')][_0x10c0('0x2e')]);_0x3e5397[_0x10c0('0x33')]=_[_0x10c0('0x34')](_0x4d6c9b['query']);_0x3e5397[_0x10c0('0x35')]=_[_0x10c0('0x37')](_0x3e5397[_0x10c0('0x32')],_0x3e5397['query']);_0x3058eb['attributes']=_['intersection'](_0x3e5397[_0x10c0('0x32')],qs[_0x10c0('0x38')](_0x4d6c9b[_0x10c0('0x33')][_0x10c0('0x38')]));_0x3058eb[_0x10c0('0x36')]=_0x3058eb[_0x10c0('0x36')]['length']?_0x3058eb[_0x10c0('0x36')]:_0x3e5397[_0x10c0('0x32')];_0x3058eb['order']=qs[_0x10c0('0x3c')](_0x4d6c9b[_0x10c0('0x33')][_0x10c0('0x3c')]);_0x3058eb[_0x10c0('0x3d')]=qs[_0x10c0('0x35')](_[_0x10c0('0x3e')](_0x4d6c9b[_0x10c0('0x33')],_0x3e5397[_0x10c0('0x35')]));if(_0x4d6c9b[_0x10c0('0x33')]['filter']){_0x3058eb['where']=_[_0x10c0('0x45')](_0x3058eb[_0x10c0('0x3d')],{'$or':_['map'](_0x3058eb['attributes'],function(_0x1ad8b9){var _0x22d22c={};_0x22d22c[_0x1ad8b9]={'$like':'%'+_0x4d6c9b[_0x10c0('0x33')][_0x10c0('0x40')]+'%'};return _0x22d22c;})});}_0x3058eb=_[_0x10c0('0x45')]({},_0x3058eb,_0x4d6c9b[_0x10c0('0x46')]);return _0x234328[_0x10c0('0x61')](_0x3058eb);}})[_0x10c0('0x23')](function(_0x49102a){if(_0x49102a){_0x63a8f1=_0x49102a['length'];if(!_0x4d6c9b[_0x10c0('0x33')]['hasOwnProperty'](_0x10c0('0x55'))){_0x3058eb['limit']=qs[_0x10c0('0x1f')](_0x4d6c9b[_0x10c0('0x33')][_0x10c0('0x1f')]);_0x3058eb[_0x10c0('0x1e')]=qs['offset'](_0x4d6c9b[_0x10c0('0x33')]['offset']);}return _0x234328['getTeams'](_0x3058eb);}})['then'](function(_0x14eac3){if(_0x14eac3){return _0x14eac3?{'count':_0x63a8f1,'rows':_0x14eac3}:null;}})[_0x10c0('0x23')](respondWithResult(_0x146cc6,null))['catch'](handleError(_0x146cc6,null));};exports[_0x10c0('0x63')]=function(_0x4a2949,_0xe78274,_0x1f932f){var _0x4bffd3=_0x4a2949['body'][_0x10c0('0x64')];return db[_0x10c0('0x62')][_0x10c0('0x43')]({'where':{'id':_0x4bffd3},'attributes':['id'],'include':[{'model':db[_0x10c0('0x65')],'as':_0x10c0('0x66'),'attributes':['id','name',_0x10c0('0x67'),_0x10c0('0x68'),_0x10c0('0x69')],'raw':!![]}]})[_0x10c0('0x23')](function(_0x247f76){if(_0x247f76){var _0x41cb56=_[_0x10c0('0x6a')](_0x247f76,function(_0x38823a){var _0x2f4cd6=_0x38823a['get']({'plain':!![]});return _0x2f4cd6[_0x10c0('0x66')];});return db[_0x10c0('0x2d')]['find']({'where':{'id':_0x4a2949[_0x10c0('0x51')]['id']}})['then'](function(_0x3ba043){return db[_0x10c0('0x6b')][_0x10c0('0x6c')](function(_0x3fab61){return _0x3ba043[_0x10c0('0x63')](_0x4bffd3,{'transaction':_0x3fab61})[_0x10c0('0x23')](function(){return BPromise[_0x10c0('0x6d')](_0x41cb56,function(_0x46fa5e){return db[_0x10c0('0x54')][_0x10c0('0x6e')]({'where':{'UserId':_0x46fa5e['id'],'SmsQueueId':_0x4a2949['params']['id']},'transaction':_0x3fab61});});})[_0x10c0('0x23')](function(){_0x41cb56[_0x10c0('0x6f')](function(_0x3ea6f8){socket[_0x10c0('0x70')](_0x10c0('0x71'),{'UserId':_0x3ea6f8['id'],'SmsQueueId':_0x3ba043['id']});});});});});}})[_0x10c0('0x23')](respondWithStatusCode(_0xe78274,null))[_0x10c0('0x44')](handleError(_0xe78274,null));};exports[_0x10c0('0x72')]=function(_0x5af7d5,_0x57b17e,_0x56d6ef){return db[_0x10c0('0x62')][_0x10c0('0x43')]({'where':{'id':_0x5af7d5['query'][_0x10c0('0x64')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x57b17e,null))[_0x10c0('0x23')](function(_0x37697e){var _0x3ae4bd=_[_0x10c0('0x2c')](_0x37697e,'id');var _0x2003e2=[];var _0x334254=[];var _0x2b7234=squel[_0x10c0('0x73')]();_0x2b7234['field'](_0x10c0('0x74'))[_0x10c0('0x75')](_0x10c0('0x76'),'tq')[_0x10c0('0x77')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x10c0('0x3d')](_0x10c0('0x78'),_0x5af7d5['params']['id']);for(var _0x382b89=0x0;_0x382b89<_0x37697e[_0x10c0('0x39')];_0x382b89+=0x1){let _0x3a9bf7=_0x37697e[_0x382b89];for(var _0x4e3382=0x0;_0x4e3382<_0x3a9bf7[_0x10c0('0x66')][_0x10c0('0x39')];_0x4e3382+=0x1){let _0x1451d2=_0x3a9bf7[_0x10c0('0x66')][_0x4e3382];var _0x36f8a5=_0x2b7234[_0x10c0('0x79')]();_0x36f8a5[_0x10c0('0x3d')](_0x10c0('0x7a'),_0x1451d2['id']);_0x334254[_0x10c0('0x7b')](db[_0x10c0('0x6b')][_0x10c0('0x33')](_0x36f8a5[_0x10c0('0x7c')](),{'type':db[_0x10c0('0x6b')][_0x10c0('0x7d')][_0x10c0('0x7e')]})['then'](function(_0x1099a4){if(_0x1099a4['length']===0x1){return _0x1451d2['id'];}else{var _0x336f7b=_[_0x10c0('0x7f')](_[_0x10c0('0x2c')](_0x1099a4,_0x10c0('0x80')),function(_0x21c940){return _[_0x10c0('0x81')](_0x3ae4bd,_0x21c940);});if(_0x336f7b){return _0x1451d2['id'];}}}));}}return BPromise[_0x10c0('0x82')](_0x334254)[_0x10c0('0x23')](function(_0x3febc6){_0x2003e2=_(_0x2003e2)[_0x10c0('0x83')](_0x3febc6)[_0x10c0('0x84')]()[_0x10c0('0x85')]();return db['SmsQueue'][_0x10c0('0x47')]({'where':{'id':_0x5af7d5[_0x10c0('0x51')]['id']}})[_0x10c0('0x23')](function(_0x4f11fa){return db[_0x10c0('0x6b')]['transaction'](function(_0x1c4006){return _0x4f11fa[_0x10c0('0x72')](_0x5af7d5['query'][_0x10c0('0x64')],{'transaction':_0x1c4006})[_0x10c0('0x23')](function(){if(!_['isEmpty'](_0x2003e2)){return _0x4f11fa['removeAgents'](_0x2003e2,{'transaction':_0x1c4006});}})['then'](function(){_0x2003e2['forEach'](function(_0x3d2e7e){socket['emit'](_0x10c0('0x86'),{'UserId':_0x3d2e7e,'SmsQueueId':_0x4f11fa['id']});});});});});});})[_0x10c0('0x23')](respondWithStatusCode(_0x57b17e,null))['catch'](handleError(_0x57b17e,null));};exports[_0x10c0('0x87')]=function(_0x1d99a7,_0x1cb7a4,_0x1d3b13){return db[_0x10c0('0x2d')]['find']({'where':{'id':_0x1d99a7[_0x10c0('0x51')]['id']}})['then'](handleEntityNotFound(_0x1cb7a4,null))[_0x10c0('0x23')](function(_0x3d4afb){if(_0x3d4afb){return _0x3d4afb[_0x10c0('0x87')](_0x1d99a7['body'][_0x10c0('0x64')],_[_0x10c0('0x88')](_0x1d99a7['body'],[_0x10c0('0x64'),'id'])||{})[_0x10c0('0x89')](function(_0x106803){for(var _0x24f21c=0x0;_0x24f21c<_0x1d99a7[_0x10c0('0x49')][_0x10c0('0x64')][_0x10c0('0x39')];_0x24f21c+=0x1){socket[_0x10c0('0x70')](_0x10c0('0x71'),{'UserId':Number(_0x1d99a7['body']['ids'][_0x24f21c]),'SmsQueueId':Number(_0x1d99a7[_0x10c0('0x51')]['id'])});}return _0x106803;});}})[_0x10c0('0x23')](respondWithResult(_0x1cb7a4,null))[_0x10c0('0x44')](handleError(_0x1cb7a4,null));};exports['removeAgents']=function(_0x9e96c2,_0x3ff01b,_0x42d8c9){return db['SmsQueue']['find']({'where':{'id':_0x9e96c2['params']['id']}})[_0x10c0('0x23')](handleEntityNotFound(_0x3ff01b,null))[_0x10c0('0x23')](function(_0x38f896){if(_0x38f896){return _0x38f896[_0x10c0('0x8a')](_0x9e96c2[_0x10c0('0x33')][_0x10c0('0x64')])[_0x10c0('0x23')](function(){if(_[_0x10c0('0x8b')](_0x9e96c2[_0x10c0('0x33')][_0x10c0('0x64')])){for(var _0x63f929=0x0;_0x63f929<_0x9e96c2[_0x10c0('0x33')][_0x10c0('0x64')]['length'];_0x63f929+=0x1){socket['emit'](_0x10c0('0x86'),{'UserId':Number(_0x9e96c2['query'][_0x10c0('0x64')][_0x63f929]),'SmsQueueId':Number(_0x9e96c2[_0x10c0('0x51')]['id'])});}}else{socket[_0x10c0('0x70')]('userSmsQueue:remove',{'UserId':Number(_0x9e96c2[_0x10c0('0x33')]['ids']),'SmsQueueId':Number(_0x9e96c2[_0x10c0('0x51')]['id'])});}});}})[_0x10c0('0x23')](respondWithStatusCode(_0x3ff01b,null))[_0x10c0('0x44')](handleError(_0x3ff01b,null));};exports[_0x10c0('0x8c')]=function(_0x40942f,_0x83bfd,_0x430c77){var _0x3dbecc={};var _0x333179={};var _0x21eec2;var _0x20eec9;return db['SmsQueue'][_0x10c0('0x53')]({'where':{'id':_0x40942f[_0x10c0('0x51')]['id']}})[_0x10c0('0x23')](handleEntityNotFound(_0x83bfd,null))[_0x10c0('0x23')](function(_0x575b45){if(_0x575b45){_0x21eec2=_0x575b45;_0x333179['model']=_[_0x10c0('0x34')](db['User'][_0x10c0('0x2e')]);_0x333179['query']=_[_0x10c0('0x34')](_0x40942f[_0x10c0('0x33')]);_0x333179[_0x10c0('0x35')]=_['intersection'](_0x333179[_0x10c0('0x32')],_0x333179[_0x10c0('0x33')]);_0x3dbecc[_0x10c0('0x36')]=_[_0x10c0('0x37')](_0x333179[_0x10c0('0x32')],qs[_0x10c0('0x38')](_0x40942f[_0x10c0('0x33')][_0x10c0('0x38')]));_0x3dbecc[_0x10c0('0x36')]=_0x3dbecc[_0x10c0('0x36')][_0x10c0('0x39')]?_0x3dbecc[_0x10c0('0x36')]:_0x333179['model'];_0x3dbecc[_0x10c0('0x3b')]=qs[_0x10c0('0x3c')](_0x40942f[_0x10c0('0x33')][_0x10c0('0x3c')]);_0x3dbecc[_0x10c0('0x3d')]=qs[_0x10c0('0x35')](_[_0x10c0('0x3e')](_0x40942f[_0x10c0('0x33')],_0x333179['filters']));if(_0x40942f[_0x10c0('0x33')][_0x10c0('0x40')]){_0x3dbecc[_0x10c0('0x3d')]=_[_0x10c0('0x45')](_0x3dbecc[_0x10c0('0x3d')],{'$or':_[_0x10c0('0x2c')](_0x3dbecc[_0x10c0('0x36')],function(_0x16e156){var _0x29d25c={};_0x29d25c[_0x16e156]={'$like':'%'+_0x40942f[_0x10c0('0x33')][_0x10c0('0x40')]+'%'};return _0x29d25c;})});}_0x3dbecc=_[_0x10c0('0x45')]({},_0x3dbecc,_0x40942f[_0x10c0('0x46')]);return _0x21eec2[_0x10c0('0x8c')](_0x3dbecc);}})[_0x10c0('0x23')](function(_0x299c58){if(_0x299c58){_0x20eec9=_0x299c58[_0x10c0('0x39')];if(!_0x40942f[_0x10c0('0x33')][_0x10c0('0x3a')]('nolimit')){_0x3dbecc[_0x10c0('0x1f')]=qs[_0x10c0('0x1f')](_0x40942f[_0x10c0('0x33')][_0x10c0('0x1f')]);_0x3dbecc[_0x10c0('0x1e')]=qs[_0x10c0('0x1e')](_0x40942f[_0x10c0('0x33')][_0x10c0('0x1e')]);}return _0x21eec2['getAgents'](_0x3dbecc);}})['then'](function(_0x4e53a7){if(_0x4e53a7){return _0x4e53a7?{'count':_0x20eec9,'rows':_0x4e53a7}:null;}})['then'](respondWithResult(_0x83bfd,null))[_0x10c0('0x44')](handleError(_0x83bfd,null));}; \ No newline at end of file +var _0xe797=['from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','includes','all','union','value','removeAgents','forEach','emit','userSmsQueue:remove','addAgents','omit','isArray','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','smsPause','Team','getTeams','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','removeTeams','select','field','tq.TeamId'];(function(_0xf62e93,_0x101f5c){var _0x15e79d=function(_0x589b09){while(--_0x589b09){_0xf62e93['push'](_0xf62e93['shift']());}};_0x15e79d(++_0x101f5c);}(_0xe797,0x12a));var _0x7e79=function(_0x541bcb,_0xf0394d){_0x541bcb=_0x541bcb-0x0;var _0x12b575=_0xe797[_0x541bcb];return _0x12b575;};'use strict';var emlformat=require(_0x7e79('0x0'));var rimraf=require(_0x7e79('0x1'));var zipdir=require(_0x7e79('0x2'));var jsonpatch=require(_0x7e79('0x3'));var rp=require(_0x7e79('0x4'));var moment=require(_0x7e79('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7e79('0x6'));var util=require(_0x7e79('0x7'));var path=require('path');var sox=require(_0x7e79('0x8'));var csv=require(_0x7e79('0x9'));var ejs=require(_0x7e79('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7e79('0xb'));var crypto=require(_0x7e79('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7e79('0x9'));var querystring=require(_0x7e79('0xd'));var Papa=require(_0x7e79('0xe'));var Redis=require('ioredis');var authService=require(_0x7e79('0xf'));var qs=require(_0x7e79('0x10'));var as=require(_0x7e79('0x11'));var hardwareService=require(_0x7e79('0x12'));var logger=require(_0x7e79('0x13'))(_0x7e79('0x14'));var utils=require(_0x7e79('0x15'));var config=require(_0x7e79('0x16'));var licenseUtil=require(_0x7e79('0x17'));var db=require('../../mysqldb')['db'];config[_0x7e79('0x18')]=_['defaults'](config[_0x7e79('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x7e79('0x19'))(new Redis(config[_0x7e79('0x18')]));require(_0x7e79('0x1a'))[_0x7e79('0x1b')](socket);function respondWithStatusCode(_0x4ddcfa,_0xa06e32){_0xa06e32=_0xa06e32||0xcc;return function(_0x2c918d){if(_0x2c918d){return _0x4ddcfa[_0x7e79('0x1c')](_0xa06e32);}return _0x4ddcfa[_0x7e79('0x1d')](_0xa06e32)[_0x7e79('0x1e')]();};}function respondWithResult(_0xdabb80,_0x361560){_0x361560=_0x361560||0xc8;return function(_0x4e09b5){if(_0x4e09b5){return _0xdabb80[_0x7e79('0x1d')](_0x361560)[_0x7e79('0x1f')](_0x4e09b5);}};}function respondWithFilteredResult(_0x36db1e,_0x102a46){return function(_0x45b6f3){if(_0x45b6f3){var _0x4c687b=typeof _0x102a46['offset']==='undefined'&&typeof _0x102a46['limit']===_0x7e79('0x20');var _0x123bd4=_0x45b6f3[_0x7e79('0x21')];var _0x49f5f5=_0x4c687b?0x0:_0x102a46[_0x7e79('0x22')];var _0x2c4624=_0x4c687b?_0x45b6f3[_0x7e79('0x21')]:_0x102a46[_0x7e79('0x22')]+_0x102a46[_0x7e79('0x23')];var _0x145600;if(_0x2c4624>=_0x123bd4){_0x2c4624=_0x123bd4;_0x145600=0xc8;}else{_0x145600=0xce;}_0x36db1e[_0x7e79('0x1d')](_0x145600);return _0x36db1e['set'](_0x7e79('0x24'),_0x49f5f5+'-'+_0x2c4624+'/'+_0x123bd4)[_0x7e79('0x1f')](_0x45b6f3);}return null;};}function patchUpdates(_0x4e43de){return function(_0x29529b){try{jsonpatch[_0x7e79('0x25')](_0x29529b,_0x4e43de,!![]);}catch(_0x4736bb){return BPromise['reject'](_0x4736bb);}return _0x29529b[_0x7e79('0x26')]();};}function saveUpdates(_0x537bfa,_0x2ab384){return function(_0x51bcf1){if(_0x51bcf1){return _0x51bcf1['update'](_0x537bfa)[_0x7e79('0x27')](function(_0x67b3be){return _0x67b3be;});}return null;};}function removeEntity(_0x5c1653,_0x384029){return function(_0x9d987){if(_0x9d987){return _0x9d987[_0x7e79('0x28')]()[_0x7e79('0x27')](function(){var _0x4c6cec=_0x9d987[_0x7e79('0x29')]({'plain':!![]});var _0x5d5c74=_0x7e79('0x2a');return db[_0x7e79('0x2b')][_0x7e79('0x28')]({'where':{'type':_0x5d5c74,'resourceId':_0x4c6cec['id']}})[_0x7e79('0x27')](function(){return _0x9d987;});})[_0x7e79('0x27')](function(){_0x5c1653['status'](0xcc)[_0x7e79('0x1e')]();});}};}function handleEntityNotFound(_0xcbd3da,_0x3e8405){return function(_0x49e01e){if(!_0x49e01e){_0xcbd3da['sendStatus'](0x194);}return _0x49e01e;};}function handleError(_0x3b9cbb,_0xd734c8){_0xd734c8=_0xd734c8||0x1f4;return function(_0x5791d1){logger[_0x7e79('0x2c')](_0x5791d1[_0x7e79('0x2d')]);if(_0x5791d1['name']){delete _0x5791d1[_0x7e79('0x2e')];}_0x3b9cbb[_0x7e79('0x1d')](_0xd734c8)[_0x7e79('0x2f')](_0x5791d1);};}exports[_0x7e79('0x30')]=function(_0x3a4504,_0x48ed88){var _0x184c66={},_0x481970={},_0x3f9e54={'count':0x0,'rows':[]};var _0x6e61fa=_[_0x7e79('0x31')](db[_0x7e79('0x32')][_0x7e79('0x33')],function(_0x47125a){return{'name':_0x47125a[_0x7e79('0x34')],'type':_0x47125a[_0x7e79('0x35')][_0x7e79('0x36')]};});_0x481970[_0x7e79('0x37')]=_[_0x7e79('0x31')](_0x6e61fa,_0x7e79('0x2e'));_0x481970[_0x7e79('0x38')]=_[_0x7e79('0x39')](_0x3a4504['query']);_0x481970[_0x7e79('0x3a')]=_[_0x7e79('0x3b')](_0x481970[_0x7e79('0x37')],_0x481970[_0x7e79('0x38')]);_0x184c66[_0x7e79('0x3c')]=_[_0x7e79('0x3b')](_0x481970[_0x7e79('0x37')],qs[_0x7e79('0x3d')](_0x3a4504['query'][_0x7e79('0x3d')]));_0x184c66[_0x7e79('0x3c')]=_0x184c66[_0x7e79('0x3c')][_0x7e79('0x3e')]?_0x184c66[_0x7e79('0x3c')]:_0x481970[_0x7e79('0x37')];if(!_0x3a4504['query']['hasOwnProperty'](_0x7e79('0x3f'))){_0x184c66[_0x7e79('0x23')]=qs[_0x7e79('0x23')](_0x3a4504[_0x7e79('0x38')][_0x7e79('0x23')]);_0x184c66[_0x7e79('0x22')]=qs['offset'](_0x3a4504[_0x7e79('0x38')][_0x7e79('0x22')]);}_0x184c66[_0x7e79('0x40')]=qs[_0x7e79('0x41')](_0x3a4504['query'][_0x7e79('0x41')]);_0x184c66[_0x7e79('0x42')]=qs['filters'](_[_0x7e79('0x43')](_0x3a4504[_0x7e79('0x38')],_0x481970['filters']),_0x6e61fa);if(_0x3a4504[_0x7e79('0x38')][_0x7e79('0x44')]){_0x184c66[_0x7e79('0x42')]=_[_0x7e79('0x45')](_0x184c66[_0x7e79('0x42')],{'$or':_[_0x7e79('0x31')](_0x6e61fa,function(_0x213b00){if(_0x213b00[_0x7e79('0x35')]!==_0x7e79('0x46')){var _0xe1c5b7={};_0xe1c5b7[_0x213b00['name']]={'$like':'%'+_0x3a4504[_0x7e79('0x38')][_0x7e79('0x44')]+'%'};return _0xe1c5b7;}})});}_0x184c66=_[_0x7e79('0x45')]({},_0x184c66,_0x3a4504[_0x7e79('0x47')]);var _0x566fdd={'where':_0x184c66[_0x7e79('0x42')]};return db['SmsQueue'][_0x7e79('0x21')](_0x566fdd)[_0x7e79('0x27')](function(_0x552ab5){_0x3f9e54[_0x7e79('0x21')]=_0x552ab5;if(_0x3a4504['query'][_0x7e79('0x48')]){_0x184c66['include']=[{'all':!![]}];}return db[_0x7e79('0x32')]['findAll'](_0x184c66);})['then'](function(_0x378a5d){_0x3f9e54[_0x7e79('0x49')]=_0x378a5d;return _0x3f9e54;})[_0x7e79('0x27')](respondWithFilteredResult(_0x48ed88,_0x184c66))['catch'](handleError(_0x48ed88,null));};exports[_0x7e79('0x4a')]=function(_0x42c0d7,_0x3bfe1f){var _0x341ebb={'raw':!![],'where':{'id':_0x42c0d7[_0x7e79('0x4b')]['id']}},_0x1d8b6f={};_0x1d8b6f[_0x7e79('0x37')]=_[_0x7e79('0x39')](db[_0x7e79('0x32')]['rawAttributes']);_0x1d8b6f[_0x7e79('0x38')]=_[_0x7e79('0x39')](_0x42c0d7[_0x7e79('0x38')]);_0x1d8b6f[_0x7e79('0x3a')]=_['intersection'](_0x1d8b6f[_0x7e79('0x37')],_0x1d8b6f[_0x7e79('0x38')]);_0x341ebb['attributes']=_[_0x7e79('0x3b')](_0x1d8b6f[_0x7e79('0x37')],qs['fields'](_0x42c0d7[_0x7e79('0x38')][_0x7e79('0x3d')]));_0x341ebb['attributes']=_0x341ebb['attributes'][_0x7e79('0x3e')]?_0x341ebb['attributes']:_0x1d8b6f[_0x7e79('0x37')];if(_0x42c0d7[_0x7e79('0x38')][_0x7e79('0x48')]){_0x341ebb[_0x7e79('0x4c')]=[{'all':!![]}];}_0x341ebb=_['merge']({},_0x341ebb,_0x42c0d7[_0x7e79('0x47')]);return db[_0x7e79('0x32')][_0x7e79('0x4d')](_0x341ebb)[_0x7e79('0x27')](handleEntityNotFound(_0x3bfe1f,null))[_0x7e79('0x27')](respondWithResult(_0x3bfe1f,null))['catch'](handleError(_0x3bfe1f,null));};exports[_0x7e79('0x4e')]=function(_0x5ab4a5,_0x4f062c){return db[_0x7e79('0x32')]['create'](_0x5ab4a5[_0x7e79('0x4f')],{})[_0x7e79('0x27')](function(_0x361a27){var _0x1442de=_0x5ab4a5[_0x7e79('0x50')][_0x7e79('0x29')]({'plain':!![]});if(!_0x1442de)throw new Error(_0x7e79('0x51'));if(_0x1442de['role']===_0x7e79('0x50')){var _0x37c3ab=_0x361a27[_0x7e79('0x29')]({'plain':!![]});var _0x1e8f00=_0x7e79('0x2a');return db[_0x7e79('0x52')]['find']({'where':{'name':_0x1e8f00,'userProfileId':_0x1442de[_0x7e79('0x53')]},'raw':!![]})[_0x7e79('0x27')](function(_0x1962cb){if(_0x1962cb&&_0x1962cb['autoAssociation']===0x0){return db[_0x7e79('0x2b')]['create']({'name':_0x37c3ab['name'],'resourceId':_0x37c3ab['id'],'type':_0x1962cb['name'],'sectionId':_0x1962cb['id']},{})[_0x7e79('0x27')](function(){return _0x361a27;});}else{return _0x361a27;}})[_0x7e79('0x54')](function(_0xf3a8de){logger[_0x7e79('0x2c')](_0x7e79('0x55'),_0xf3a8de);throw _0xf3a8de;});}return _0x361a27;})['then'](respondWithResult(_0x4f062c,0xc9))[_0x7e79('0x54')](handleError(_0x4f062c,null));};exports['update']=function(_0x3879fc,_0x1bed0a){if(_0x3879fc[_0x7e79('0x4f')]['id']){delete _0x3879fc[_0x7e79('0x4f')]['id'];}return db[_0x7e79('0x32')]['find']({'where':{'id':_0x3879fc['params']['id']}})['then'](handleEntityNotFound(_0x1bed0a,null))['then'](saveUpdates(_0x3879fc['body'],null))[_0x7e79('0x27')](respondWithResult(_0x1bed0a,null))[_0x7e79('0x54')](handleError(_0x1bed0a,null));};exports[_0x7e79('0x28')]=function(_0x571a8b,_0x2b44b4){return db[_0x7e79('0x32')][_0x7e79('0x4d')]({'where':{'id':_0x571a8b[_0x7e79('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2b44b4,null))[_0x7e79('0x27')](removeEntity(_0x2b44b4,null))[_0x7e79('0x54')](handleError(_0x2b44b4,null));};exports[_0x7e79('0x56')]=function(_0xaeedc1,_0xdaba27){return db[_0x7e79('0x32')][_0x7e79('0x56')]()['then'](respondWithResult(_0xdaba27,null))[_0x7e79('0x54')](handleError(_0xdaba27,null));};exports[_0x7e79('0x57')]=function(_0x8c2622,_0x471bcd,_0x107746){var _0x1efdde={'raw':!![],'where':{}},_0x5b2dbf={},_0x3bdfe8;return db['SmsQueue'][_0x7e79('0x58')]({'where':{'id':_0x8c2622[_0x7e79('0x4b')]['id']}})[_0x7e79('0x27')](handleEntityNotFound(_0x471bcd,null))['then'](function(_0x1d638e){if(_0x1d638e){_0x3bdfe8=_0x1d638e[_0x7e79('0x29')]({'plain':!![]});_0x5b2dbf[_0x7e79('0x37')]=_['keys'](db[_0x7e79('0x59')]['rawAttributes']);_0x5b2dbf[_0x7e79('0x38')]=_[_0x7e79('0x39')](_0x8c2622[_0x7e79('0x38')]);_0x5b2dbf[_0x7e79('0x3a')]=_[_0x7e79('0x3b')](_0x5b2dbf[_0x7e79('0x37')],_0x5b2dbf[_0x7e79('0x38')]);_0x1efdde[_0x7e79('0x3c')]=_[_0x7e79('0x3b')](_0x5b2dbf[_0x7e79('0x37')],qs[_0x7e79('0x3d')](_0x8c2622[_0x7e79('0x38')][_0x7e79('0x3d')]));_0x1efdde[_0x7e79('0x3c')]=_0x1efdde[_0x7e79('0x3c')][_0x7e79('0x3e')]?_0x1efdde[_0x7e79('0x3c')]:_0x5b2dbf[_0x7e79('0x37')];if(!_0x8c2622[_0x7e79('0x38')]['hasOwnProperty'](_0x7e79('0x3f'))){_0x1efdde['limit']=qs['limit'](_0x8c2622[_0x7e79('0x38')][_0x7e79('0x23')]);_0x1efdde[_0x7e79('0x22')]=qs['offset'](_0x8c2622[_0x7e79('0x38')]['offset']);}_0x1efdde['order']=qs[_0x7e79('0x41')](_0x8c2622[_0x7e79('0x38')][_0x7e79('0x41')]);_0x1efdde[_0x7e79('0x42')]=qs['filters'](_[_0x7e79('0x43')](_0x8c2622[_0x7e79('0x38')],_0x5b2dbf[_0x7e79('0x3a')]));_0x1efdde[_0x7e79('0x42')][_0x7e79('0x5a')]=_0x1d638e['id'];if(_0x8c2622['query']['filter']){_0x1efdde[_0x7e79('0x42')]=_[_0x7e79('0x45')](_0x1efdde[_0x7e79('0x42')],{'$or':_[_0x7e79('0x31')](_0x1efdde[_0x7e79('0x3c')],function(_0x4babe3){var _0xd2d7be={};_0xd2d7be[_0x4babe3]={'$like':'%'+_0x8c2622['query']['filter']+'%'};return _0xd2d7be;})});}_0x1efdde=_['merge']({},_0x1efdde,_0x8c2622[_0x7e79('0x47')]);return db[_0x7e79('0x59')][_0x7e79('0x5b')](_0x1efdde);}})[_0x7e79('0x27')](function(_0x4c9386){if(_0x4c9386){return db[_0x7e79('0x5c')][_0x7e79('0x5d')]({'where':{'id':_['map'](_0x4c9386,_0x7e79('0x5e')),'role':_0x7e79('0x5f')},'attributes':['id',_0x7e79('0x2e'),'smsPause',_0x7e79('0x60'),_0x7e79('0x61')]});}})[_0x7e79('0x27')](function(_0x26d7c5){if(_0x26d7c5){return{'count':_0x26d7c5[_0x7e79('0x21')],'rows':_['map'](_0x26d7c5[_0x7e79('0x49')],function(_0xdef9be){return{'membername':_0xdef9be[_0x7e79('0x2e')],'UserId':_0xdef9be['id'],'queue_name':_0x3bdfe8[_0x7e79('0x2e')],'SmsQueueId':_0x3bdfe8['id'],'interface':util[_0x7e79('0x62')](_0x7e79('0x63'),'SIP',_0xdef9be['name']),'penalty':0x0,'paused':_0xdef9be[_0x7e79('0x64')],'createdAt':_0xdef9be[_0x7e79('0x61')],'updatedAt':_0xdef9be['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7e79('0x27')](respondWithFilteredResult(_0x471bcd,_0x1efdde))[_0x7e79('0x54')](handleError(_0x471bcd,null));};exports['getTeams']=function(_0x3a5144,_0x51c682,_0xeaa2cb){var _0x3d4adb={};var _0x334c62={};var _0x492372;var _0x9b03b6;return db[_0x7e79('0x32')][_0x7e79('0x58')]({'where':{'id':_0x3a5144[_0x7e79('0x4b')]['id']}})['then'](handleEntityNotFound(_0x51c682,null))[_0x7e79('0x27')](function(_0x5e2c0a){if(_0x5e2c0a){_0x492372=_0x5e2c0a;_0x334c62[_0x7e79('0x37')]=_[_0x7e79('0x39')](db[_0x7e79('0x65')][_0x7e79('0x33')]);_0x334c62[_0x7e79('0x38')]=_['keys'](_0x3a5144[_0x7e79('0x38')]);_0x334c62[_0x7e79('0x3a')]=_[_0x7e79('0x3b')](_0x334c62[_0x7e79('0x37')],_0x334c62[_0x7e79('0x38')]);_0x3d4adb['attributes']=_['intersection'](_0x334c62['model'],qs[_0x7e79('0x3d')](_0x3a5144[_0x7e79('0x38')][_0x7e79('0x3d')]));_0x3d4adb[_0x7e79('0x3c')]=_0x3d4adb[_0x7e79('0x3c')][_0x7e79('0x3e')]?_0x3d4adb[_0x7e79('0x3c')]:_0x334c62[_0x7e79('0x37')];_0x3d4adb['order']=qs[_0x7e79('0x41')](_0x3a5144['query'][_0x7e79('0x41')]);_0x3d4adb[_0x7e79('0x42')]=qs[_0x7e79('0x3a')](_[_0x7e79('0x43')](_0x3a5144[_0x7e79('0x38')],_0x334c62[_0x7e79('0x3a')]));if(_0x3a5144['query']['filter']){_0x3d4adb[_0x7e79('0x42')]=_[_0x7e79('0x45')](_0x3d4adb['where'],{'$or':_[_0x7e79('0x31')](_0x3d4adb[_0x7e79('0x3c')],function(_0x18e550){var _0x5b773e={};_0x5b773e[_0x18e550]={'$like':'%'+_0x3a5144['query'][_0x7e79('0x44')]+'%'};return _0x5b773e;})});}_0x3d4adb=_[_0x7e79('0x45')]({},_0x3d4adb,_0x3a5144[_0x7e79('0x47')]);return _0x492372[_0x7e79('0x66')](_0x3d4adb);}})[_0x7e79('0x27')](function(_0x3b43a8){if(_0x3b43a8){_0x9b03b6=_0x3b43a8['length'];if(!_0x3a5144[_0x7e79('0x38')]['hasOwnProperty']('nolimit')){_0x3d4adb[_0x7e79('0x23')]=qs[_0x7e79('0x23')](_0x3a5144[_0x7e79('0x38')]['limit']);_0x3d4adb['offset']=qs[_0x7e79('0x22')](_0x3a5144['query'][_0x7e79('0x22')]);}return _0x492372[_0x7e79('0x66')](_0x3d4adb);}})[_0x7e79('0x27')](function(_0x371a9f){if(_0x371a9f){return _0x371a9f?{'count':_0x9b03b6,'rows':_0x371a9f}:null;}})[_0x7e79('0x27')](respondWithResult(_0x51c682,null))[_0x7e79('0x54')](handleError(_0x51c682,null));};exports[_0x7e79('0x67')]=function(_0x4ceb58,_0x2b024d,_0x42ff52){var _0x554c77=_0x4ceb58[_0x7e79('0x4f')][_0x7e79('0x68')];return db[_0x7e79('0x65')][_0x7e79('0x5b')]({'where':{'id':_0x554c77},'attributes':['id'],'include':[{'model':db[_0x7e79('0x5c')],'as':_0x7e79('0x69'),'attributes':['id','name','online',_0x7e79('0x6a'),_0x7e79('0x6b')],'raw':!![]}]})[_0x7e79('0x27')](function(_0x30116f){if(_0x30116f){var _0x4f7130=_[_0x7e79('0x6c')](_0x30116f,function(_0x17c24c){var _0x1ce363=_0x17c24c[_0x7e79('0x29')]({'plain':!![]});return _0x1ce363[_0x7e79('0x69')];});return db[_0x7e79('0x32')][_0x7e79('0x4d')]({'where':{'id':_0x4ceb58[_0x7e79('0x4b')]['id']}})[_0x7e79('0x27')](function(_0x118a79){return db[_0x7e79('0x6d')][_0x7e79('0x6e')](function(_0x593e5c){return _0x118a79['addTeams'](_0x554c77,{'transaction':_0x593e5c})['then'](function(){return BPromise[_0x7e79('0x6f')](_0x4f7130,function(_0x4f231d){return db[_0x7e79('0x59')]['findOrCreate']({'where':{'UserId':_0x4f231d['id'],'SmsQueueId':_0x4ceb58[_0x7e79('0x4b')]['id']},'transaction':_0x593e5c});});})['then'](function(){_0x4f7130['forEach'](function(_0x1ad3d2){socket['emit']('userSmsQueue:save',{'UserId':_0x1ad3d2['id'],'SmsQueueId':_0x118a79['id']});});});});});}})['then'](respondWithStatusCode(_0x2b024d,null))[_0x7e79('0x54')](handleError(_0x2b024d,null));};exports[_0x7e79('0x70')]=function(_0x5f47cb,_0x3979f3,_0x1716b9){return db[_0x7e79('0x65')][_0x7e79('0x5b')]({'where':{'id':_0x5f47cb['query'][_0x7e79('0x68')]},'attributes':['id'],'include':[{'model':db[_0x7e79('0x5c')],'as':_0x7e79('0x69'),'attributes':['id'],'raw':!![]}]})[_0x7e79('0x27')](handleEntityNotFound(_0x3979f3,null))['then'](function(_0x2a0941){var _0x447ab6=_[_0x7e79('0x31')](_0x2a0941,'id');var _0x3ce471=[];var _0x1cdb8d=[];var _0x277d92=squel[_0x7e79('0x71')]();_0x277d92[_0x7e79('0x72')](_0x7e79('0x73'))[_0x7e79('0x74')]('team_has_sms_queues','tq')[_0x7e79('0x75')](_0x7e79('0x76'),'ut',_0x7e79('0x77'))[_0x7e79('0x42')](_0x7e79('0x78'),_0x5f47cb[_0x7e79('0x4b')]['id']);for(var _0x3ef5f1=0x0;_0x3ef5f1<_0x2a0941[_0x7e79('0x3e')];_0x3ef5f1+=0x1){let _0x2fb9f9=_0x2a0941[_0x3ef5f1];for(var _0x175676=0x0;_0x175676<_0x2fb9f9['Agents'][_0x7e79('0x3e')];_0x175676+=0x1){let _0x2a1121=_0x2fb9f9[_0x7e79('0x69')][_0x175676];var _0x59e79e=_0x277d92[_0x7e79('0x79')]();_0x59e79e[_0x7e79('0x42')](_0x7e79('0x7a'),_0x2a1121['id']);_0x1cdb8d[_0x7e79('0x7b')](db[_0x7e79('0x6d')]['query'](_0x59e79e['toString'](),{'type':db[_0x7e79('0x6d')]['QueryTypes'][_0x7e79('0x7c')]})[_0x7e79('0x27')](function(_0x56b976){if(_0x56b976[_0x7e79('0x3e')]===0x1){return _0x2a1121['id'];}else{var _0x23f426=_['every'](_['map'](_0x56b976,'TeamId'),function(_0x40b6d7){return _[_0x7e79('0x7d')](_0x447ab6,_0x40b6d7);});if(_0x23f426){return _0x2a1121['id'];}}}));}}return BPromise[_0x7e79('0x7e')](_0x1cdb8d)[_0x7e79('0x27')](function(_0x43dcc2){_0x3ce471=_(_0x3ce471)[_0x7e79('0x7f')](_0x43dcc2)['compact']()[_0x7e79('0x80')]();return db[_0x7e79('0x32')][_0x7e79('0x4d')]({'where':{'id':_0x5f47cb['params']['id']}})['then'](function(_0x480b96){return db[_0x7e79('0x6d')][_0x7e79('0x6e')](function(_0x352c25){return _0x480b96[_0x7e79('0x70')](_0x5f47cb[_0x7e79('0x38')][_0x7e79('0x68')],{'transaction':_0x352c25})[_0x7e79('0x27')](function(){if(!_['isEmpty'](_0x3ce471)){return _0x480b96[_0x7e79('0x81')](_0x3ce471,{'transaction':_0x352c25});}})[_0x7e79('0x27')](function(){_0x3ce471[_0x7e79('0x82')](function(_0x60c404){socket[_0x7e79('0x83')](_0x7e79('0x84'),{'UserId':_0x60c404,'SmsQueueId':_0x480b96['id']});});});});});});})[_0x7e79('0x27')](respondWithStatusCode(_0x3979f3,null))['catch'](handleError(_0x3979f3,null));};exports[_0x7e79('0x85')]=function(_0x189347,_0x2d86f7,_0x577ea7){return db[_0x7e79('0x32')]['find']({'where':{'id':_0x189347['params']['id']}})[_0x7e79('0x27')](handleEntityNotFound(_0x2d86f7,null))[_0x7e79('0x27')](function(_0x235960){if(_0x235960){return _0x235960[_0x7e79('0x85')](_0x189347['body'][_0x7e79('0x68')],_[_0x7e79('0x86')](_0x189347['body'],[_0x7e79('0x68'),'id'])||{})['spread'](function(_0x24c1b6){for(var _0x5407b8=0x0;_0x5407b8<_0x189347[_0x7e79('0x4f')]['ids'][_0x7e79('0x3e')];_0x5407b8+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x189347[_0x7e79('0x4f')]['ids'][_0x5407b8]),'SmsQueueId':Number(_0x189347['params']['id'])});}return _0x24c1b6;});}})[_0x7e79('0x27')](respondWithResult(_0x2d86f7,null))[_0x7e79('0x54')](handleError(_0x2d86f7,null));};exports[_0x7e79('0x81')]=function(_0x395133,_0x392e02,_0x2956b3){return db[_0x7e79('0x32')]['find']({'where':{'id':_0x395133[_0x7e79('0x4b')]['id']}})['then'](handleEntityNotFound(_0x392e02,null))[_0x7e79('0x27')](function(_0x102fea){if(_0x102fea){return _0x102fea[_0x7e79('0x81')](_0x395133[_0x7e79('0x38')][_0x7e79('0x68')])[_0x7e79('0x27')](function(){if(_[_0x7e79('0x87')](_0x395133['query'][_0x7e79('0x68')])){for(var _0x47564c=0x0;_0x47564c<_0x395133[_0x7e79('0x38')][_0x7e79('0x68')][_0x7e79('0x3e')];_0x47564c+=0x1){socket[_0x7e79('0x83')](_0x7e79('0x84'),{'UserId':Number(_0x395133[_0x7e79('0x38')][_0x7e79('0x68')][_0x47564c]),'SmsQueueId':Number(_0x395133[_0x7e79('0x4b')]['id'])});}}else{socket[_0x7e79('0x83')]('userSmsQueue:remove',{'UserId':Number(_0x395133[_0x7e79('0x38')][_0x7e79('0x68')]),'SmsQueueId':Number(_0x395133[_0x7e79('0x4b')]['id'])});}});}})[_0x7e79('0x27')](respondWithStatusCode(_0x392e02,null))[_0x7e79('0x54')](handleError(_0x392e02,null));};exports[_0x7e79('0x88')]=function(_0x409acd,_0x50a87b,_0x13eae5){var _0x2fd315={};var _0x1da9d4={};var _0x419795;var _0x438291;return db[_0x7e79('0x32')][_0x7e79('0x58')]({'where':{'id':_0x409acd[_0x7e79('0x4b')]['id']}})[_0x7e79('0x27')](handleEntityNotFound(_0x50a87b,null))[_0x7e79('0x27')](function(_0x24521d){if(_0x24521d){_0x419795=_0x24521d;_0x1da9d4[_0x7e79('0x37')]=_[_0x7e79('0x39')](db[_0x7e79('0x5c')][_0x7e79('0x33')]);_0x1da9d4[_0x7e79('0x38')]=_[_0x7e79('0x39')](_0x409acd[_0x7e79('0x38')]);_0x1da9d4['filters']=_[_0x7e79('0x3b')](_0x1da9d4[_0x7e79('0x37')],_0x1da9d4[_0x7e79('0x38')]);_0x2fd315[_0x7e79('0x3c')]=_[_0x7e79('0x3b')](_0x1da9d4[_0x7e79('0x37')],qs['fields'](_0x409acd[_0x7e79('0x38')]['fields']));_0x2fd315['attributes']=_0x2fd315['attributes'][_0x7e79('0x3e')]?_0x2fd315[_0x7e79('0x3c')]:_0x1da9d4[_0x7e79('0x37')];_0x2fd315[_0x7e79('0x40')]=qs['sort'](_0x409acd[_0x7e79('0x38')][_0x7e79('0x41')]);_0x2fd315[_0x7e79('0x42')]=qs[_0x7e79('0x3a')](_[_0x7e79('0x43')](_0x409acd[_0x7e79('0x38')],_0x1da9d4[_0x7e79('0x3a')]));if(_0x409acd[_0x7e79('0x38')][_0x7e79('0x44')]){_0x2fd315[_0x7e79('0x42')]=_['merge'](_0x2fd315['where'],{'$or':_[_0x7e79('0x31')](_0x2fd315[_0x7e79('0x3c')],function(_0x3d0505){var _0x19886f={};_0x19886f[_0x3d0505]={'$like':'%'+_0x409acd[_0x7e79('0x38')][_0x7e79('0x44')]+'%'};return _0x19886f;})});}_0x2fd315=_[_0x7e79('0x45')]({},_0x2fd315,_0x409acd['options']);return _0x419795['getAgents'](_0x2fd315);}})[_0x7e79('0x27')](function(_0x15ac1d){if(_0x15ac1d){_0x438291=_0x15ac1d[_0x7e79('0x3e')];if(!_0x409acd[_0x7e79('0x38')][_0x7e79('0x89')](_0x7e79('0x3f'))){_0x2fd315[_0x7e79('0x23')]=qs[_0x7e79('0x23')](_0x409acd[_0x7e79('0x38')][_0x7e79('0x23')]);_0x2fd315[_0x7e79('0x22')]=qs[_0x7e79('0x22')](_0x409acd[_0x7e79('0x38')][_0x7e79('0x22')]);}return _0x419795[_0x7e79('0x88')](_0x2fd315);}})['then'](function(_0x503d49){if(_0x503d49){return _0x503d49?{'count':_0x438291,'rows':_0x503d49}:null;}})['then'](respondWithResult(_0x50a87b,null))['catch'](handleError(_0x50a87b,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index d050739..31b9c43 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 _0xda81=['exports','../../mysqldb','SmsQueue','setMaxListeners','emit','hasOwnProperty','hook'];(function(_0x4eeca4,_0x5901c9){var _0x430031=function(_0x237ed7){while(--_0x237ed7){_0x4eeca4['push'](_0x4eeca4['shift']());}};_0x430031(++_0x5901c9);}(_0xda81,0xd3));var _0x1da8=function(_0x48aa4b,_0x451d37){_0x48aa4b=_0x48aa4b-0x0;var _0x3c8d6f=_0xda81[_0x48aa4b];return _0x3c8d6f;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x1da8('0x0'))['db'][_0x1da8('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1da8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x128364){return function(_0x38075c,_0x10d9f5,_0x2c599){SmsQueueEvents[_0x1da8('0x3')](_0x128364+':'+_0x38075c['id'],_0x38075c);SmsQueueEvents['emit'](_0x128364,_0x38075c);_0x2c599(null);};}for(var e in events){if(events[_0x1da8('0x4')](e)){var event=events[e];SmsQueue[_0x1da8('0x5')](e,emitEvent(event));}}module[_0x1da8('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0xb4d6=['hasOwnProperty','hook','exports','events','save','update','emit'];(function(_0x1bc28d,_0x4e0d7a){var _0x2dbb66=function(_0x48a3a3){while(--_0x48a3a3){_0x1bc28d['push'](_0x1bc28d['shift']());}};_0x2dbb66(++_0x4e0d7a);}(_0xb4d6,0xe3));var _0x6b4d=function(_0x56a69f,_0x1bf698){_0x56a69f=_0x56a69f-0x0;var _0x1cb629=_0xb4d6[_0x56a69f];return _0x1cb629;};'use strict';var EventEmitter=require(_0x6b4d('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b4d('0x1'),'afterUpdate':_0x6b4d('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5990cf){return function(_0x5882c9,_0xd83fd,_0x455d32){SmsQueueEvents[_0x6b4d('0x3')](_0x5990cf+':'+_0x5882c9['id'],_0x5882c9);SmsQueueEvents['emit'](_0x5990cf,_0x5882c9);_0x455d32(null);};}for(var e in events){if(events[_0x6b4d('0x4')](e)){var event=events[e];SmsQueue[_0x6b4d('0x5')](e,emitEvent(event));}}module[_0x6b4d('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 6e7ba59..74dd545 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 _0xc461=['bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','lodash','util','api','moment'];(function(_0x259264,_0xfe2f1f){var _0x333ff4=function(_0x366e5c){while(--_0x366e5c){_0x259264['push'](_0x259264['shift']());}};_0x333ff4(++_0xfe2f1f);}(_0xc461,0x104));var _0x1c46=function(_0x45778b,_0x2df919){_0x45778b=_0x45778b-0x0;var _0x5cd104=_0xc461[_0x45778b];return _0x5cd104;};'use strict';var _=require(_0x1c46('0x0'));var util=require(_0x1c46('0x1'));var logger=require('../../config/logger')(_0x1c46('0x2'));var moment=require(_0x1c46('0x3'));var BPromise=require(_0x1c46('0x4'));var rp=require(_0x1c46('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c46('0x6'));var config=require(_0x1c46('0x7'));var attributes=require(_0x1c46('0x8'));module[_0x1c46('0x9')]=function(_0x6be7bc,_0xbd3c87){return _0x6be7bc[_0x1c46('0xa')](_0x1c46('0xb'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76d8=['path','../../config/environment','exports','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0x76d8,0x123));var _0x876d=function(_0x3393a1,_0x3ba2de){_0x3393a1=_0x3393a1-0x0;var _0x13beeb=_0x76d8[_0x3393a1];return _0x13beeb;};'use strict';var _=require(_0x876d('0x0'));var util=require(_0x876d('0x1'));var logger=require(_0x876d('0x2'))(_0x876d('0x3'));var moment=require(_0x876d('0x4'));var BPromise=require(_0x876d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x876d('0x6'));var rimraf=require('rimraf');var config=require(_0x876d('0x7'));var attributes=require('./smsQueue.attributes');module[_0x876d('0x8')]=function(_0x5d9eef,_0x15cfdf){return _0x5d9eef['define'](_0x876d('0x9'),attributes,{'tableName':_0x876d('0xa'),'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 f65540d..ecae43b 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 _0x5fce=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','SmsQueue','options','where','attributes','include','map','model','GetSmsQueue','ShowSmsQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x8b1642,_0x438b4c){var _0x163e28=function(_0x352d94){while(--_0x352d94){_0x8b1642['push'](_0x8b1642['shift']());}};_0x163e28(++_0x438b4c);}(_0x5fce,0x85));var _0xe5fc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5fce[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe5fc('0x0'));var util=require('util');var moment=require(_0xe5fc('0x1'));var BPromise=require(_0xe5fc('0x2'));var rs=require(_0xe5fc('0x3'));var fs=require('fs');var Redis=require(_0xe5fc('0x4'));var db=require(_0xe5fc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe5fc('0x6'));var config=require(_0xe5fc('0x7'));var jayson=require(_0xe5fc('0x8'));var client=jayson[_0xe5fc('0x9')][_0xe5fc('0xa')]({'port':0x232a});config[_0xe5fc('0xb')]=_[_0xe5fc('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe5fc('0xd'))(new Redis(config[_0xe5fc('0xb')]));require(_0xe5fc('0xe'))['register'](socket);function respondWithRpcPromise(_0x4b0dc2,_0x2aaa7f,_0x130338){return new BPromise(function(_0x45bf8d,_0x2c928d){return client['request'](_0x4b0dc2,_0x130338)[_0xe5fc('0xf')](function(_0x5ccb0f){logger[_0xe5fc('0x10')](_0xe5fc('0x11'),_0x2aaa7f,_0xe5fc('0x12'));logger[_0xe5fc('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x2aaa7f,_0xe5fc('0x12'),JSON[_0xe5fc('0x14')](_0x5ccb0f));if(_0x5ccb0f['error']){if(_0x5ccb0f[_0xe5fc('0x15')]['code']===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x2aaa7f,_0x5ccb0f['error'][_0xe5fc('0x16')]);return _0x2c928d(_0x5ccb0f[_0xe5fc('0x15')][_0xe5fc('0x16')]);}logger[_0xe5fc('0x15')](_0xe5fc('0x11'),_0x2aaa7f,_0x5ccb0f['error'][_0xe5fc('0x16')]);return _0x45bf8d(_0x5ccb0f[_0xe5fc('0x15')][_0xe5fc('0x16')]);}else{logger[_0xe5fc('0x10')]('SmsQueue,\x20%s,\x20%s',_0x2aaa7f,_0xe5fc('0x12'));_0x45bf8d(_0x5ccb0f[_0xe5fc('0x17')]['message']);}})[_0xe5fc('0x18')](function(_0x152775){logger[_0xe5fc('0x15')]('SmsQueue,\x20%s,\x20%s',_0x2aaa7f,_0x152775);_0x2c928d(_0x152775);});});}exports['GetSmsQueue']=function(_0x18dc3e){var _0x401c7b=this;return new Promise(function(_0x15c713,_0x5c7a8f){return db[_0xe5fc('0x19')]['findAll']({'raw':_0x18dc3e[_0xe5fc('0x1a')]?_0x18dc3e['options']['raw']===undefined?!![]:![]:!![],'where':_0x18dc3e[_0xe5fc('0x1a')]?_0x18dc3e[_0xe5fc('0x1a')][_0xe5fc('0x1b')]||null:null,'attributes':_0x18dc3e['options']?_0x18dc3e[_0xe5fc('0x1a')][_0xe5fc('0x1c')]||null:null,'limit':_0x18dc3e['options']?_0x18dc3e[_0xe5fc('0x1a')]['limit']||null:null,'include':_0x18dc3e[_0xe5fc('0x1a')]?_0x18dc3e[_0xe5fc('0x1a')][_0xe5fc('0x1d')]?_[_0xe5fc('0x1e')](_0x18dc3e[_0xe5fc('0x1a')][_0xe5fc('0x1d')],function(_0x312540){return{'model':db[_0x312540[_0xe5fc('0x1f')]],'as':_0x312540['as'],'attributes':_0x312540[_0xe5fc('0x1c')],'include':_0x312540[_0xe5fc('0x1d')]?_[_0xe5fc('0x1e')](_0x312540[_0xe5fc('0x1d')],function(_0x57e41a){return{'model':db[_0x57e41a[_0xe5fc('0x1f')]],'as':_0x57e41a['as'],'attributes':_0x57e41a[_0xe5fc('0x1c')],'include':_0x57e41a[_0xe5fc('0x1d')]?_['map'](_0x57e41a[_0xe5fc('0x1d')],function(_0x2e27ef){return{'model':db[_0x2e27ef[_0xe5fc('0x1f')]],'as':_0x2e27ef['as'],'attributes':_0x2e27ef[_0xe5fc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe5fc('0xf')](function(_0x13ba53){logger[_0xe5fc('0x10')]('GetSmsQueue',_0x18dc3e);logger['debug']('GetSmsQueue',_0x18dc3e,JSON[_0xe5fc('0x14')](_0x13ba53));_0x15c713(_0x13ba53);})[_0xe5fc('0x18')](function(_0x58d199){logger[_0xe5fc('0x15')](_0xe5fc('0x20'),_0x58d199[_0xe5fc('0x16')],_0x18dc3e);_0x5c7a8f(_0x401c7b[_0xe5fc('0x15')](0x1f4,_0x58d199[_0xe5fc('0x16')]));});});};exports[_0xe5fc('0x21')]=function(_0x2fdb7b){var _0x46fd0b=this;return new Promise(function(_0x205832,_0x3829f8){return db[_0xe5fc('0x19')][_0xe5fc('0x22')]({'raw':_0x2fdb7b['options']?_0x2fdb7b[_0xe5fc('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2fdb7b['options']?_0x2fdb7b[_0xe5fc('0x1a')][_0xe5fc('0x1b')]||null:null,'attributes':_0x2fdb7b[_0xe5fc('0x1a')]?_0x2fdb7b[_0xe5fc('0x1a')][_0xe5fc('0x1c')]||null:null,'include':_0x2fdb7b[_0xe5fc('0x1a')]?_0x2fdb7b[_0xe5fc('0x1a')][_0xe5fc('0x1d')]?_['map'](_0x2fdb7b[_0xe5fc('0x1a')]['include'],function(_0x473665){return{'model':db[_0x473665['model']],'as':_0x473665['as'],'attributes':_0x473665['attributes'],'include':_0x473665[_0xe5fc('0x1d')]?_['map'](_0x473665[_0xe5fc('0x1d')],function(_0x2418b2){return{'model':db[_0x2418b2[_0xe5fc('0x1f')]],'as':_0x2418b2['as'],'attributes':_0x2418b2[_0xe5fc('0x1c')],'include':_0x2418b2[_0xe5fc('0x1d')]?_[_0xe5fc('0x1e')](_0x2418b2[_0xe5fc('0x1d')],function(_0x4a12cd){return{'model':db[_0x4a12cd[_0xe5fc('0x1f')]],'as':_0x4a12cd['as'],'attributes':_0x4a12cd[_0xe5fc('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ca891){logger[_0xe5fc('0x10')](_0xe5fc('0x21'),_0x2fdb7b);logger[_0xe5fc('0x13')](_0xe5fc('0x21'),_0x2fdb7b,JSON[_0xe5fc('0x14')](_0x2ca891));_0x205832(_0x2ca891);})[_0xe5fc('0x18')](function(_0x34bd8f){logger['error'](_0xe5fc('0x21'),_0x34bd8f[_0xe5fc('0x16')],_0x2fdb7b);_0x3829f8(_0x46fd0b[_0xe5fc('0x15')](0x1f4,_0x34bd8f[_0xe5fc('0x16')]));});});}; \ No newline at end of file +var _0x2c53=['attributes','limit','map','include','model','GetSmsQueue','find','ShowSmsQueue','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./smsQueue.socket','register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','SmsQueue','findAll','options','raw','where'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0x2c53,0x18b));var _0x32c5=function(_0x553145,_0x4f9ab8){_0x553145=_0x553145-0x0;var _0x11cfbd=_0x2c53[_0x553145];return _0x11cfbd;};'use strict';var _=require(_0x32c5('0x0'));var util=require(_0x32c5('0x1'));var moment=require(_0x32c5('0x2'));var BPromise=require('bluebird');var rs=require(_0x32c5('0x3'));var fs=require('fs');var Redis=require(_0x32c5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x32c5('0x5'));var logger=require(_0x32c5('0x6'))(_0x32c5('0x7'));var config=require(_0x32c5('0x8'));var jayson=require(_0x32c5('0x9'));var client=jayson[_0x32c5('0xa')][_0x32c5('0xb')]({'port':0x232a});config['redis']=_[_0x32c5('0xc')](config[_0x32c5('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x32c5('0xe'))(new Redis(config[_0x32c5('0xd')]));require(_0x32c5('0xf'))[_0x32c5('0x10')](socket);function respondWithRpcPromise(_0x321687,_0x3e0787,_0x310d96){return new BPromise(function(_0x845eb,_0xe24123){return client[_0x32c5('0x11')](_0x321687,_0x310d96)[_0x32c5('0x12')](function(_0x3739cf){logger[_0x32c5('0x13')]('SmsQueue,\x20%s,\x20%s',_0x3e0787,_0x32c5('0x14'));logger[_0x32c5('0x15')](_0x32c5('0x16'),_0x3e0787,'request\x20sent',JSON[_0x32c5('0x17')](_0x3739cf));if(_0x3739cf[_0x32c5('0x18')]){if(_0x3739cf[_0x32c5('0x18')][_0x32c5('0x19')]===0x1f4){logger['error'](_0x32c5('0x1a'),_0x3e0787,_0x3739cf[_0x32c5('0x18')][_0x32c5('0x1b')]);return _0xe24123(_0x3739cf['error']['message']);}logger['error'](_0x32c5('0x1a'),_0x3e0787,_0x3739cf['error'][_0x32c5('0x1b')]);return _0x845eb(_0x3739cf['error'][_0x32c5('0x1b')]);}else{logger[_0x32c5('0x13')](_0x32c5('0x1a'),_0x3e0787,_0x32c5('0x14'));_0x845eb(_0x3739cf[_0x32c5('0x1c')][_0x32c5('0x1b')]);}})[_0x32c5('0x1d')](function(_0x5b96e6){logger[_0x32c5('0x18')](_0x32c5('0x1a'),_0x3e0787,_0x5b96e6);_0xe24123(_0x5b96e6);});});}exports['GetSmsQueue']=function(_0xf82e4a){var _0x5af765=this;return new Promise(function(_0x284c2c,_0x2781ff){return db[_0x32c5('0x1e')][_0x32c5('0x1f')]({'raw':_0xf82e4a['options']?_0xf82e4a[_0x32c5('0x20')][_0x32c5('0x21')]===undefined?!![]:![]:!![],'where':_0xf82e4a[_0x32c5('0x20')]?_0xf82e4a[_0x32c5('0x20')][_0x32c5('0x22')]||null:null,'attributes':_0xf82e4a[_0x32c5('0x20')]?_0xf82e4a['options'][_0x32c5('0x23')]||null:null,'limit':_0xf82e4a['options']?_0xf82e4a[_0x32c5('0x20')][_0x32c5('0x24')]||null:null,'include':_0xf82e4a[_0x32c5('0x20')]?_0xf82e4a['options']['include']?_[_0x32c5('0x25')](_0xf82e4a[_0x32c5('0x20')][_0x32c5('0x26')],function(_0x1d09d7){return{'model':db[_0x1d09d7[_0x32c5('0x27')]],'as':_0x1d09d7['as'],'attributes':_0x1d09d7[_0x32c5('0x23')],'include':_0x1d09d7[_0x32c5('0x26')]?_['map'](_0x1d09d7[_0x32c5('0x26')],function(_0x5391ce){return{'model':db[_0x5391ce[_0x32c5('0x27')]],'as':_0x5391ce['as'],'attributes':_0x5391ce[_0x32c5('0x23')],'include':_0x5391ce[_0x32c5('0x26')]?_['map'](_0x5391ce[_0x32c5('0x26')],function(_0x231866){return{'model':db[_0x231866[_0x32c5('0x27')]],'as':_0x231866['as'],'attributes':_0x231866['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f4089){logger['info'](_0x32c5('0x28'),_0xf82e4a);logger[_0x32c5('0x15')](_0x32c5('0x28'),_0xf82e4a,JSON[_0x32c5('0x17')](_0x2f4089));_0x284c2c(_0x2f4089);})[_0x32c5('0x1d')](function(_0x17f3a1){logger[_0x32c5('0x18')](_0x32c5('0x28'),_0x17f3a1[_0x32c5('0x1b')],_0xf82e4a);_0x2781ff(_0x5af765['error'](0x1f4,_0x17f3a1[_0x32c5('0x1b')]));});});};exports['ShowSmsQueue']=function(_0x5df013){var _0x28df0a=this;return new Promise(function(_0x377912,_0x238ecd){return db[_0x32c5('0x1e')][_0x32c5('0x29')]({'raw':_0x5df013['options']?_0x5df013[_0x32c5('0x20')][_0x32c5('0x21')]===undefined?!![]:![]:!![],'where':_0x5df013['options']?_0x5df013[_0x32c5('0x20')]['where']||null:null,'attributes':_0x5df013[_0x32c5('0x20')]?_0x5df013[_0x32c5('0x20')]['attributes']||null:null,'include':_0x5df013[_0x32c5('0x20')]?_0x5df013[_0x32c5('0x20')][_0x32c5('0x26')]?_[_0x32c5('0x25')](_0x5df013[_0x32c5('0x20')]['include'],function(_0x36f1c2){return{'model':db[_0x36f1c2[_0x32c5('0x27')]],'as':_0x36f1c2['as'],'attributes':_0x36f1c2[_0x32c5('0x23')],'include':_0x36f1c2[_0x32c5('0x26')]?_['map'](_0x36f1c2[_0x32c5('0x26')],function(_0x2aef84){return{'model':db[_0x2aef84[_0x32c5('0x27')]],'as':_0x2aef84['as'],'attributes':_0x2aef84[_0x32c5('0x23')],'include':_0x2aef84[_0x32c5('0x26')]?_[_0x32c5('0x25')](_0x2aef84[_0x32c5('0x26')],function(_0x401b0e){return{'model':db[_0x401b0e[_0x32c5('0x27')]],'as':_0x401b0e['as'],'attributes':_0x401b0e[_0x32c5('0x23')]};}):[]};}):[]};}):[]:[]})[_0x32c5('0x12')](function(_0x2e2ec9){logger['info']('ShowSmsQueue',_0x5df013);logger[_0x32c5('0x15')](_0x32c5('0x2a'),_0x5df013,JSON['stringify'](_0x2e2ec9));_0x377912(_0x2e2ec9);})[_0x32c5('0x1d')](function(_0x39bc11){logger[_0x32c5('0x18')](_0x32c5('0x2a'),_0x39bc11[_0x32c5('0x1b')],_0x5df013);_0x238ecd(_0x28df0a[_0x32c5('0x18')](0x1f4,_0x39bc11[_0x32c5('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 18d66f5..e8e2cb7 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 _0x42a7=['length','smsQueue:','./smsQueue.events','save','update'];(function(_0x81eb80,_0x2743d7){var _0x290cce=function(_0xdb94f8){while(--_0xdb94f8){_0x81eb80['push'](_0x81eb80['shift']());}};_0x290cce(++_0x2743d7);}(_0x42a7,0x151));var _0x742a=function(_0x210bb1,_0x5bf081){_0x210bb1=_0x210bb1-0x0;var _0x52c12f=_0x42a7[_0x210bb1];return _0x52c12f;};'use strict';var SmsQueueEvents=require(_0x742a('0x0'));var events=[_0x742a('0x1'),'remove',_0x742a('0x2')];function createListener(_0x22ab8f,_0x400d6f){return function(_0x56abff){_0x400d6f['emit'](_0x22ab8f,_0x56abff);};}function removeListener(_0x54fec0,_0x2e262f){return function(){SmsQueueEvents['removeListener'](_0x54fec0,_0x2e262f);};}exports['register']=function(_0x3fca7a){for(var _0x1f5835=0x0,_0x2204c3=events[_0x742a('0x3')];_0x1f5835<_0x2204c3;_0x1f5835++){var _0x5465d5=events[_0x1f5835];var _0x7520a8=createListener(_0x742a('0x4')+_0x5465d5,_0x3fca7a);SmsQueueEvents['on'](_0x5465d5,_0x7520a8);}}; \ No newline at end of file +var _0xc0be=['length','save','remove','update','emit','removeListener','register'];(function(_0x3ef5c0,_0x1f1612){var _0x4eeac9=function(_0xc0ca2e){while(--_0xc0ca2e){_0x3ef5c0['push'](_0x3ef5c0['shift']());}};_0x4eeac9(++_0x1f1612);}(_0xc0be,0x9b));var _0xec0b=function(_0x12f067,_0x5398cb){_0x12f067=_0x12f067-0x0;var _0x5b67f8=_0xc0be[_0x12f067];return _0x5b67f8;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xec0b('0x0'),_0xec0b('0x1'),_0xec0b('0x2')];function createListener(_0x834d8,_0x2b2955){return function(_0x5ef2db){_0x2b2955[_0xec0b('0x3')](_0x834d8,_0x5ef2db);};}function removeListener(_0x383729,_0x38fa7e){return function(){SmsQueueEvents[_0xec0b('0x4')](_0x383729,_0x38fa7e);};}exports[_0xec0b('0x5')]=function(_0x2137c8){for(var _0x4302d2=0x0,_0x126c0f=events[_0xec0b('0x6')];_0x4302d2<_0x126c0f;_0x4302d2++){var _0x1acfc5=events[_0x4302d2];var _0x2f701f=createListener('smsQueue:'+_0x1acfc5,_0x2137c8);SmsQueueEvents['on'](_0x1acfc5,_0x2f701f);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index f4cb18a..f6f46e1 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 _0x9c0a=['../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','/describe','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c0a,0x117));var _0xa9c0=function(_0x4c62db,_0x31f9bf){_0x4c62db=_0x4c62db-0x0;var _0x48e398=_0x9c0a[_0x4c62db];return _0x48e398;};'use strict';var multer=require('multer');var util=require(_0xa9c0('0x0'));var path=require(_0xa9c0('0x1'));var timeout=require(_0xa9c0('0x2'));var express=require('express');var router=express[_0xa9c0('0x3')]();var fs_extra=require(_0xa9c0('0x4'));var auth=require(_0xa9c0('0x5'));var interaction=require(_0xa9c0('0x6'));var config=require('../../config/environment');var controller=require(_0xa9c0('0x7'));router[_0xa9c0('0x8')]('/',auth[_0xa9c0('0x9')](),controller['index']);router[_0xa9c0('0x8')](_0xa9c0('0xa'),auth[_0xa9c0('0x9')](),controller['describe']);router[_0xa9c0('0x8')](_0xa9c0('0xb'),auth[_0xa9c0('0x9')](),controller['show']);router[_0xa9c0('0xc')]('/',auth[_0xa9c0('0x9')](),controller[_0xa9c0('0xd')]);router[_0xa9c0('0xe')](_0xa9c0('0xb'),auth[_0xa9c0('0x9')](),controller[_0xa9c0('0xf')]);router[_0xa9c0('0x10')](_0xa9c0('0xb'),auth[_0xa9c0('0x9')](),controller[_0xa9c0('0x11')]);module[_0xa9c0('0x12')]=router; \ No newline at end of file +var _0x1641=['/describe','describe','/:id','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index'];(function(_0x2fb1e8,_0x556edd){var _0x1b8b2f=function(_0x58630d){while(--_0x58630d){_0x2fb1e8['push'](_0x2fb1e8['shift']());}};_0x1b8b2f(++_0x556edd);}(_0x1641,0x153));var _0x1164=function(_0xc06121,_0x284c61){_0xc06121=_0xc06121-0x0;var _0x131a25=_0x1641[_0xc06121];return _0x131a25;};'use strict';var multer=require(_0x1164('0x0'));var util=require(_0x1164('0x1'));var path=require(_0x1164('0x2'));var timeout=require('connect-timeout');var express=require(_0x1164('0x3'));var router=express[_0x1164('0x4')]();var fs_extra=require(_0x1164('0x5'));var auth=require(_0x1164('0x6'));var interaction=require(_0x1164('0x7'));var config=require(_0x1164('0x8'));var controller=require(_0x1164('0x9'));router[_0x1164('0xa')]('/',auth[_0x1164('0xb')](),controller[_0x1164('0xc')]);router[_0x1164('0xa')](_0x1164('0xd'),auth[_0x1164('0xb')](),controller[_0x1164('0xe')]);router[_0x1164('0xa')](_0x1164('0xf'),auth[_0x1164('0xb')](),controller['show']);router[_0x1164('0x10')]('/',auth[_0x1164('0xb')](),controller[_0x1164('0x11')]);router['put'](_0x1164('0xf'),auth[_0x1164('0xb')](),controller[_0x1164('0x12')]);router[_0x1164('0x13')](_0x1164('0xf'),auth[_0x1164('0xb')](),controller[_0x1164('0x14')]);module[_0x1164('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index a24fb4e..21f3853 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 _0x01be=['moment','sequelize','exports','STRING','DATE'];(function(_0x441ccc,_0x2c174a){var _0x2ac0d5=function(_0x1d03f2){while(--_0x1d03f2){_0x441ccc['push'](_0x441ccc['shift']());}};_0x2ac0d5(++_0x2c174a);}(_0x01be,0x136));var _0xe01b=function(_0x532cee,_0x363d65){_0x532cee=_0x532cee-0x0;var _0x235db6=_0x01be[_0x532cee];return _0x235db6;};'use strict';var moment=require(_0xe01b('0x0'));var Sequelize=require(_0xe01b('0x1'));module[_0xe01b('0x2')]={'uniqueid':{'type':Sequelize[_0xe01b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe01b('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xe01b('0x4')]},'acceptAt':{'type':Sequelize[_0xe01b('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xe01b('0x3')]}}; \ No newline at end of file +var _0x030b=['exports','STRING','DATE','moment','sequelize'];(function(_0x2ef8c1,_0x2f72f4){var _0x288305=function(_0x56244b){while(--_0x56244b){_0x2ef8c1['push'](_0x2ef8c1['shift']());}};_0x288305(++_0x2f72f4);}(_0x030b,0x184));var _0xb030=function(_0x201cc7,_0x36beaf){_0x201cc7=_0x201cc7-0x0;var _0x96d712=_0x030b[_0x201cc7];return _0x96d712;};'use strict';var moment=require(_0xb030('0x0'));var Sequelize=require(_0xb030('0x1'));module[_0xb030('0x2')]={'uniqueid':{'type':Sequelize[_0xb030('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb030('0x3')]},'joinAt':{'type':Sequelize[_0xb030('0x4')]},'leaveAt':{'type':Sequelize[_0xb030('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb030('0x4')]},'reason':{'type':Sequelize[_0xb030('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index bd4566e..035e4db 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 _0xdf36=['fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','create','body','update','find','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xdf36,0xde));var _0x6df3=function(_0x185a53,_0x137354){_0x185a53=_0x185a53-0x0;var _0x139e1d=_0xdf36[_0x185a53];return _0x139e1d;};'use strict';var emlformat=require(_0x6df3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6df3('0x1'));var rp=require(_0x6df3('0x2'));var moment=require(_0x6df3('0x3'));var BPromise=require(_0x6df3('0x4'));var Mustache=require(_0x6df3('0x5'));var util=require(_0x6df3('0x6'));var path=require('path');var sox=require(_0x6df3('0x7'));var csv=require(_0x6df3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6df3('0x9'));var _=require('lodash');var squel=require(_0x6df3('0xa'));var crypto=require(_0x6df3('0xb'));var jsforce=require(_0x6df3('0xc'));var deskjs=require(_0x6df3('0xd'));var toCsv=require(_0x6df3('0x8'));var querystring=require(_0x6df3('0xe'));var Papa=require(_0x6df3('0xf'));var Redis=require(_0x6df3('0x10'));var authService=require(_0x6df3('0x11'));var qs=require(_0x6df3('0x12'));var as=require(_0x6df3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6df3('0x14'))('api');var utils=require(_0x6df3('0x15'));var config=require(_0x6df3('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e4b7e,_0x3e9514){_0x3e9514=_0x3e9514||0xcc;return function(_0x589f49){if(_0x589f49){return _0x2e4b7e[_0x6df3('0x17')](_0x3e9514);}return _0x2e4b7e[_0x6df3('0x18')](_0x3e9514)[_0x6df3('0x19')]();};}function respondWithResult(_0x18cbce,_0x47dac8){_0x47dac8=_0x47dac8||0xc8;return function(_0x33a18c){if(_0x33a18c){return _0x18cbce[_0x6df3('0x18')](_0x47dac8)['json'](_0x33a18c);}};}function respondWithFilteredResult(_0x20cc72,_0x3d9122){return function(_0x259a89){if(_0x259a89){var _0x3eebd5=typeof _0x3d9122['offset']==='undefined'&&typeof _0x3d9122[_0x6df3('0x1a')]===_0x6df3('0x1b');var _0x1ed960=_0x259a89[_0x6df3('0x1c')];var _0x2cb105=_0x3eebd5?0x0:_0x3d9122['offset'];var _0x39b6d1=_0x3eebd5?_0x259a89[_0x6df3('0x1c')]:_0x3d9122[_0x6df3('0x1d')]+_0x3d9122[_0x6df3('0x1a')];var _0x31c043;if(_0x39b6d1>=_0x1ed960){_0x39b6d1=_0x1ed960;_0x31c043=0xc8;}else{_0x31c043=0xce;}_0x20cc72[_0x6df3('0x18')](_0x31c043);return _0x20cc72[_0x6df3('0x1e')](_0x6df3('0x1f'),_0x2cb105+'-'+_0x39b6d1+'/'+_0x1ed960)[_0x6df3('0x20')](_0x259a89);}return null;};}function patchUpdates(_0x3969fa){return function(_0x219545){try{jsonpatch[_0x6df3('0x21')](_0x219545,_0x3969fa,!![]);}catch(_0x47df17){return BPromise[_0x6df3('0x22')](_0x47df17);}return _0x219545[_0x6df3('0x23')]();};}function saveUpdates(_0x3de0aa,_0x56748b){return function(_0x50f2cd){if(_0x50f2cd){return _0x50f2cd['update'](_0x3de0aa)[_0x6df3('0x24')](function(_0x1919fb){return _0x1919fb;});}return null;};}function removeEntity(_0x208317,_0x2a7186){return function(_0x43d605){if(_0x43d605){return _0x43d605[_0x6df3('0x25')]()['then'](function(){_0x208317[_0x6df3('0x18')](0xcc)[_0x6df3('0x19')]();});}};}function handleEntityNotFound(_0x3de397,_0x3bc50f){return function(_0x3b4141){if(!_0x3b4141){_0x3de397['sendStatus'](0x194);}return _0x3b4141;};}function handleError(_0x3b6d28,_0x596514){_0x596514=_0x596514||0x1f4;return function(_0x9d2747){logger[_0x6df3('0x26')](_0x9d2747[_0x6df3('0x27')]);if(_0x9d2747[_0x6df3('0x28')]){delete _0x9d2747[_0x6df3('0x28')];}_0x3b6d28[_0x6df3('0x18')](_0x596514)['send'](_0x9d2747);};}exports[_0x6df3('0x29')]=function(_0x5eb80f,_0x5749eb){var _0x5c2367={},_0x3e4f07={},_0x54b67a={'count':0x0,'rows':[]};var _0x3f691b=_[_0x6df3('0x2a')](db[_0x6df3('0x2b')][_0x6df3('0x2c')],function(_0x251de3){return{'name':_0x251de3[_0x6df3('0x2d')],'type':_0x251de3['type'][_0x6df3('0x2e')]};});_0x3e4f07[_0x6df3('0x2f')]=_[_0x6df3('0x2a')](_0x3f691b,'name');_0x3e4f07[_0x6df3('0x30')]=_['keys'](_0x5eb80f['query']);_0x3e4f07[_0x6df3('0x31')]=_[_0x6df3('0x32')](_0x3e4f07[_0x6df3('0x2f')],_0x3e4f07['query']);_0x5c2367['attributes']=_[_0x6df3('0x32')](_0x3e4f07['model'],qs['fields'](_0x5eb80f['query'][_0x6df3('0x33')]));_0x5c2367[_0x6df3('0x34')]=_0x5c2367[_0x6df3('0x34')][_0x6df3('0x35')]?_0x5c2367['attributes']:_0x3e4f07[_0x6df3('0x2f')];if(!_0x5eb80f[_0x6df3('0x30')][_0x6df3('0x36')]('nolimit')){_0x5c2367[_0x6df3('0x1a')]=qs['limit'](_0x5eb80f[_0x6df3('0x30')]['limit']);_0x5c2367[_0x6df3('0x1d')]=qs[_0x6df3('0x1d')](_0x5eb80f[_0x6df3('0x30')]['offset']);}_0x5c2367[_0x6df3('0x37')]=qs['sort'](_0x5eb80f[_0x6df3('0x30')][_0x6df3('0x38')]);_0x5c2367[_0x6df3('0x39')]=qs[_0x6df3('0x31')](_[_0x6df3('0x3a')](_0x5eb80f[_0x6df3('0x30')],_0x3e4f07['filters']),_0x3f691b);if(_0x5eb80f[_0x6df3('0x30')]['filter']){_0x5c2367[_0x6df3('0x39')]=_[_0x6df3('0x3b')](_0x5c2367['where'],{'$or':_['map'](_0x3f691b,function(_0x3e0125){if(_0x3e0125[_0x6df3('0x3c')]!==_0x6df3('0x3d')){var _0x375e69={};_0x375e69[_0x3e0125[_0x6df3('0x28')]]={'$like':'%'+_0x5eb80f['query'][_0x6df3('0x3e')]+'%'};return _0x375e69;}})});}_0x5c2367=_[_0x6df3('0x3b')]({},_0x5c2367,_0x5eb80f[_0x6df3('0x3f')]);var _0x10b9f0={'where':_0x5c2367['where']};return db[_0x6df3('0x2b')]['count'](_0x10b9f0)[_0x6df3('0x24')](function(_0x2dc931){_0x54b67a['count']=_0x2dc931;if(_0x5eb80f[_0x6df3('0x30')][_0x6df3('0x40')]){_0x5c2367[_0x6df3('0x41')]=[{'all':!![]}];}return db[_0x6df3('0x2b')][_0x6df3('0x42')](_0x5c2367);})[_0x6df3('0x24')](function(_0x539864){_0x54b67a[_0x6df3('0x43')]=_0x539864;return _0x54b67a;})['then'](respondWithFilteredResult(_0x5749eb,_0x5c2367))[_0x6df3('0x44')](handleError(_0x5749eb,null));};exports[_0x6df3('0x45')]=function(_0x6863d8,_0x3c7d9c){var _0x51a1f1={'raw':!![],'where':{'id':_0x6863d8['params']['id']}},_0x5b94db={};_0x5b94db['model']=_[_0x6df3('0x46')](db['SmsQueueReport'][_0x6df3('0x2c')]);_0x5b94db[_0x6df3('0x30')]=_[_0x6df3('0x46')](_0x6863d8[_0x6df3('0x30')]);_0x5b94db['filters']=_[_0x6df3('0x32')](_0x5b94db[_0x6df3('0x2f')],_0x5b94db[_0x6df3('0x30')]);_0x51a1f1[_0x6df3('0x34')]=_[_0x6df3('0x32')](_0x5b94db[_0x6df3('0x2f')],qs['fields'](_0x6863d8[_0x6df3('0x30')][_0x6df3('0x33')]));_0x51a1f1['attributes']=_0x51a1f1[_0x6df3('0x34')][_0x6df3('0x35')]?_0x51a1f1[_0x6df3('0x34')]:_0x5b94db[_0x6df3('0x2f')];if(_0x6863d8['query']['includeAll']){_0x51a1f1[_0x6df3('0x41')]=[{'all':!![]}];}_0x51a1f1=_[_0x6df3('0x3b')]({},_0x51a1f1,_0x6863d8['options']);return db[_0x6df3('0x2b')]['find'](_0x51a1f1)[_0x6df3('0x24')](handleEntityNotFound(_0x3c7d9c,null))[_0x6df3('0x24')](respondWithResult(_0x3c7d9c,null))[_0x6df3('0x44')](handleError(_0x3c7d9c,null));};exports[_0x6df3('0x47')]=function(_0xacbf3d,_0x41fd51){return db[_0x6df3('0x2b')][_0x6df3('0x47')](_0xacbf3d[_0x6df3('0x48')],{})['then'](respondWithResult(_0x41fd51,0xc9))[_0x6df3('0x44')](handleError(_0x41fd51,null));};exports[_0x6df3('0x49')]=function(_0x4f91a8,_0x5cb30e){if(_0x4f91a8['body']['id']){delete _0x4f91a8['body']['id'];}return db[_0x6df3('0x2b')][_0x6df3('0x4a')]({'where':{'id':_0x4f91a8[_0x6df3('0x4b')]['id']}})[_0x6df3('0x24')](handleEntityNotFound(_0x5cb30e,null))[_0x6df3('0x24')](saveUpdates(_0x4f91a8[_0x6df3('0x48')],null))['then'](respondWithResult(_0x5cb30e,null))['catch'](handleError(_0x5cb30e,null));};exports['destroy']=function(_0x585128,_0x364ad5){return db[_0x6df3('0x2b')][_0x6df3('0x4a')]({'where':{'id':_0x585128[_0x6df3('0x4b')]['id']}})[_0x6df3('0x24')](handleEntityNotFound(_0x364ad5,null))[_0x6df3('0x24')](removeEntity(_0x364ad5,null))[_0x6df3('0x44')](handleError(_0x364ad5,null));};exports[_0x6df3('0x4c')]=function(_0x59c327,_0x411e49){return db[_0x6df3('0x2b')][_0x6df3('0x4c')]()['then'](respondWithResult(_0x411e49,null))[_0x6df3('0x44')](handleError(_0x411e49,null));}; \ No newline at end of file +var _0x6160=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','json','reject','update','then','destroy','error','stack','name','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x603eb7,_0x7d3d5f){var _0xaa5f2e=function(_0x5e076e){while(--_0x5e076e){_0x603eb7['push'](_0x603eb7['shift']());}};_0xaa5f2e(++_0x7d3d5f);}(_0x6160,0xc8));var _0x0616=function(_0x3cc66a,_0x4b67ab){_0x3cc66a=_0x3cc66a-0x0;var _0x8262f2=_0x6160[_0x3cc66a];return _0x8262f2;};'use strict';var emlformat=require(_0x0616('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0616('0x1'));var jsonpatch=require(_0x0616('0x2'));var rp=require(_0x0616('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0616('0x4'));var util=require(_0x0616('0x5'));var path=require(_0x0616('0x6'));var sox=require('sox');var csv=require(_0x0616('0x7'));var ejs=require(_0x0616('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0616('0x9'));var squel=require(_0x0616('0xa'));var crypto=require(_0x0616('0xb'));var jsforce=require(_0x0616('0xc'));var deskjs=require(_0x0616('0xd'));var toCsv=require(_0x0616('0x7'));var querystring=require('querystring');var Papa=require(_0x0616('0xe'));var Redis=require(_0x0616('0xf'));var authService=require(_0x0616('0x10'));var qs=require(_0x0616('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0616('0x12'));var logger=require(_0x0616('0x13'))(_0x0616('0x14'));var utils=require('../../config/utils');var config=require(_0x0616('0x15'));var licenseUtil=require(_0x0616('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ee2d0,_0x11da1a){_0x11da1a=_0x11da1a||0xcc;return function(_0x10da6a){if(_0x10da6a){return _0x3ee2d0['sendStatus'](_0x11da1a);}return _0x3ee2d0[_0x0616('0x17')](_0x11da1a)[_0x0616('0x18')]();};}function respondWithResult(_0x569aaa,_0x4e59de){_0x4e59de=_0x4e59de||0xc8;return function(_0x2a6e50){if(_0x2a6e50){return _0x569aaa[_0x0616('0x17')](_0x4e59de)['json'](_0x2a6e50);}};}function respondWithFilteredResult(_0x3eb1c7,_0x396ec5){return function(_0x3a5570){if(_0x3a5570){var _0xccbec6=typeof _0x396ec5[_0x0616('0x19')]===_0x0616('0x1a')&&typeof _0x396ec5[_0x0616('0x1b')]==='undefined';var _0x5fbf6e=_0x3a5570[_0x0616('0x1c')];var _0x278b50=_0xccbec6?0x0:_0x396ec5[_0x0616('0x19')];var _0x33b760=_0xccbec6?_0x3a5570['count']:_0x396ec5[_0x0616('0x19')]+_0x396ec5[_0x0616('0x1b')];var _0x4f95fc;if(_0x33b760>=_0x5fbf6e){_0x33b760=_0x5fbf6e;_0x4f95fc=0xc8;}else{_0x4f95fc=0xce;}_0x3eb1c7[_0x0616('0x17')](_0x4f95fc);return _0x3eb1c7[_0x0616('0x1d')]('Content-Range',_0x278b50+'-'+_0x33b760+'/'+_0x5fbf6e)[_0x0616('0x1e')](_0x3a5570);}return null;};}function patchUpdates(_0x25355d){return function(_0x3073fb){try{jsonpatch['apply'](_0x3073fb,_0x25355d,!![]);}catch(_0x35effd){return BPromise[_0x0616('0x1f')](_0x35effd);}return _0x3073fb['save']();};}function saveUpdates(_0x446a9c,_0xa208d0){return function(_0x1bc400){if(_0x1bc400){return _0x1bc400[_0x0616('0x20')](_0x446a9c)[_0x0616('0x21')](function(_0x4ec533){return _0x4ec533;});}return null;};}function removeEntity(_0x245e9f,_0x51b636){return function(_0x8283fd){if(_0x8283fd){return _0x8283fd[_0x0616('0x22')]()[_0x0616('0x21')](function(){_0x245e9f[_0x0616('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5715e7,_0x5d50b6){return function(_0x231c84){if(!_0x231c84){_0x5715e7['sendStatus'](0x194);}return _0x231c84;};}function handleError(_0x1e8e6e,_0x5cfb61){_0x5cfb61=_0x5cfb61||0x1f4;return function(_0x309996){logger[_0x0616('0x23')](_0x309996[_0x0616('0x24')]);if(_0x309996[_0x0616('0x25')]){delete _0x309996[_0x0616('0x25')];}_0x1e8e6e[_0x0616('0x17')](_0x5cfb61)['send'](_0x309996);};}exports['index']=function(_0x589ddf,_0x28493b){var _0x3aa000={},_0x25b094={},_0x138d05={'count':0x0,'rows':[]};var _0x577480=_[_0x0616('0x26')](db[_0x0616('0x27')][_0x0616('0x28')],function(_0x362dfb){return{'name':_0x362dfb[_0x0616('0x29')],'type':_0x362dfb[_0x0616('0x2a')][_0x0616('0x2b')]};});_0x25b094[_0x0616('0x2c')]=_[_0x0616('0x26')](_0x577480,_0x0616('0x25'));_0x25b094['query']=_[_0x0616('0x2d')](_0x589ddf[_0x0616('0x2e')]);_0x25b094['filters']=_[_0x0616('0x2f')](_0x25b094[_0x0616('0x2c')],_0x25b094['query']);_0x3aa000[_0x0616('0x30')]=_[_0x0616('0x2f')](_0x25b094['model'],qs[_0x0616('0x31')](_0x589ddf['query'][_0x0616('0x31')]));_0x3aa000[_0x0616('0x30')]=_0x3aa000[_0x0616('0x30')][_0x0616('0x32')]?_0x3aa000['attributes']:_0x25b094['model'];if(!_0x589ddf['query'][_0x0616('0x33')](_0x0616('0x34'))){_0x3aa000[_0x0616('0x1b')]=qs['limit'](_0x589ddf[_0x0616('0x2e')][_0x0616('0x1b')]);_0x3aa000[_0x0616('0x19')]=qs[_0x0616('0x19')](_0x589ddf[_0x0616('0x2e')][_0x0616('0x19')]);}_0x3aa000[_0x0616('0x35')]=qs[_0x0616('0x36')](_0x589ddf[_0x0616('0x2e')]['sort']);_0x3aa000['where']=qs[_0x0616('0x37')](_[_0x0616('0x38')](_0x589ddf[_0x0616('0x2e')],_0x25b094['filters']),_0x577480);if(_0x589ddf[_0x0616('0x2e')][_0x0616('0x39')]){_0x3aa000[_0x0616('0x3a')]=_[_0x0616('0x3b')](_0x3aa000[_0x0616('0x3a')],{'$or':_['map'](_0x577480,function(_0x5496b9){if(_0x5496b9[_0x0616('0x2a')]!==_0x0616('0x3c')){var _0x38765f={};_0x38765f[_0x5496b9[_0x0616('0x25')]]={'$like':'%'+_0x589ddf[_0x0616('0x2e')][_0x0616('0x39')]+'%'};return _0x38765f;}})});}_0x3aa000=_['merge']({},_0x3aa000,_0x589ddf[_0x0616('0x3d')]);var _0x3db71f={'where':_0x3aa000['where']};return db[_0x0616('0x27')][_0x0616('0x1c')](_0x3db71f)['then'](function(_0x12fdcf){_0x138d05[_0x0616('0x1c')]=_0x12fdcf;if(_0x589ddf['query'][_0x0616('0x3e')]){_0x3aa000[_0x0616('0x3f')]=[{'all':!![]}];}return db[_0x0616('0x27')][_0x0616('0x40')](_0x3aa000);})['then'](function(_0x2c53b4){_0x138d05[_0x0616('0x41')]=_0x2c53b4;return _0x138d05;})[_0x0616('0x21')](respondWithFilteredResult(_0x28493b,_0x3aa000))['catch'](handleError(_0x28493b,null));};exports[_0x0616('0x42')]=function(_0x22ac49,_0x205941){var _0x102f15={'raw':!![],'where':{'id':_0x22ac49[_0x0616('0x43')]['id']}},_0x25701b={};_0x25701b['model']=_['keys'](db[_0x0616('0x27')][_0x0616('0x28')]);_0x25701b[_0x0616('0x2e')]=_[_0x0616('0x2d')](_0x22ac49[_0x0616('0x2e')]);_0x25701b[_0x0616('0x37')]=_['intersection'](_0x25701b[_0x0616('0x2c')],_0x25701b[_0x0616('0x2e')]);_0x102f15['attributes']=_[_0x0616('0x2f')](_0x25701b[_0x0616('0x2c')],qs[_0x0616('0x31')](_0x22ac49[_0x0616('0x2e')][_0x0616('0x31')]));_0x102f15['attributes']=_0x102f15[_0x0616('0x30')][_0x0616('0x32')]?_0x102f15['attributes']:_0x25701b[_0x0616('0x2c')];if(_0x22ac49['query']['includeAll']){_0x102f15['include']=[{'all':!![]}];}_0x102f15=_[_0x0616('0x3b')]({},_0x102f15,_0x22ac49['options']);return db[_0x0616('0x27')][_0x0616('0x44')](_0x102f15)['then'](handleEntityNotFound(_0x205941,null))[_0x0616('0x21')](respondWithResult(_0x205941,null))[_0x0616('0x45')](handleError(_0x205941,null));};exports['create']=function(_0x1d1bd3,_0x5857a7){return db[_0x0616('0x27')]['create'](_0x1d1bd3[_0x0616('0x46')],{})[_0x0616('0x21')](respondWithResult(_0x5857a7,0xc9))[_0x0616('0x45')](handleError(_0x5857a7,null));};exports[_0x0616('0x20')]=function(_0xfe8eb1,_0x1d67d7){if(_0xfe8eb1[_0x0616('0x46')]['id']){delete _0xfe8eb1[_0x0616('0x46')]['id'];}return db[_0x0616('0x27')][_0x0616('0x44')]({'where':{'id':_0xfe8eb1[_0x0616('0x43')]['id']}})[_0x0616('0x21')](handleEntityNotFound(_0x1d67d7,null))[_0x0616('0x21')](saveUpdates(_0xfe8eb1[_0x0616('0x46')],null))[_0x0616('0x21')](respondWithResult(_0x1d67d7,null))[_0x0616('0x45')](handleError(_0x1d67d7,null));};exports[_0x0616('0x22')]=function(_0x35023b,_0x2e6f19){return db[_0x0616('0x27')]['find']({'where':{'id':_0x35023b[_0x0616('0x43')]['id']}})['then'](handleEntityNotFound(_0x2e6f19,null))[_0x0616('0x21')](removeEntity(_0x2e6f19,null))[_0x0616('0x45')](handleError(_0x2e6f19,null));};exports['describe']=function(_0x371780,_0x829b51){return db['SmsQueueReport']['describe']()[_0x0616('0x21')](respondWithResult(_0x829b51,null))[_0x0616('0x45')](handleError(_0x829b51,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 4b66f24..948e353 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x3f5166,_0x1f2652){var _0x37557f=function(_0x4f5b06){while(--_0x4f5b06){_0x3f5166['push'](_0x3f5166['shift']());}};_0x37557f(++_0x1f2652);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xb7e7[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x568d32,_0x25edf9){var _0x59d096=function(_0xc06b41){while(--_0xc06b41){_0x568d32['push'](_0x568d32['shift']());}};_0x59d096(++_0x25edf9);}(_0xe706,0xa3));var _0x6e70=function(_0x2cdcf9,_0x8a09d1){_0x2cdcf9=_0x2cdcf9-0x0;var _0x39412d=_0xe706[_0x2cdcf9];return _0x39412d;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 0b75d08..9ba1da6 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 _0xa1c7=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateSmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','update','where','attributes','catch'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xa1c7,0x7c));var _0x7a1c=function(_0x4e1f55,_0x5a9c37){_0x4e1f55=_0x4e1f55-0x0;var _0x48b6b5=_0xa1c7[_0x4e1f55];return _0x48b6b5;};'use strict';var _=require('lodash');var util=require(_0x7a1c('0x0'));var moment=require(_0x7a1c('0x1'));var BPromise=require(_0x7a1c('0x2'));var rs=require(_0x7a1c('0x3'));var fs=require('fs');var Redis=require(_0x7a1c('0x4'));var db=require(_0x7a1c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a1c('0x6'))(_0x7a1c('0x7'));var config=require(_0x7a1c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7a1c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f1a12,_0x285ec4,_0x4486ba){return new BPromise(function(_0x346256,_0x4c9d91){return client['request'](_0x5f1a12,_0x4486ba)[_0x7a1c('0xa')](function(_0xda6412){logger['info'](_0x7a1c('0xb'),_0x285ec4,_0x7a1c('0xc'));logger[_0x7a1c('0xd')](_0x7a1c('0xe'),_0x285ec4,_0x7a1c('0xc'),JSON[_0x7a1c('0xf')](_0xda6412));if(_0xda6412['error']){if(_0xda6412[_0x7a1c('0x10')][_0x7a1c('0x11')]===0x1f4){logger[_0x7a1c('0x10')](_0x7a1c('0xb'),_0x285ec4,_0xda6412[_0x7a1c('0x10')][_0x7a1c('0x12')]);return _0x4c9d91(_0xda6412[_0x7a1c('0x10')][_0x7a1c('0x12')]);}logger['error'](_0x7a1c('0xb'),_0x285ec4,_0xda6412[_0x7a1c('0x10')][_0x7a1c('0x12')]);return _0x346256(_0xda6412[_0x7a1c('0x10')]['message']);}else{logger[_0x7a1c('0x13')](_0x7a1c('0xb'),_0x285ec4,'request\x20sent');_0x346256(_0xda6412[_0x7a1c('0x14')][_0x7a1c('0x12')]);}})['catch'](function(_0x10b8cc){logger[_0x7a1c('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x285ec4,_0x10b8cc);_0x4c9d91(_0x10b8cc);});});}exports[_0x7a1c('0x15')]=function(_0x35d9fc){var _0x57f84d=this;return new Promise(function(_0x165fbb,_0x350845){return db['SmsQueueReport'][_0x7a1c('0x16')](_0x35d9fc[_0x7a1c('0x17')],{'raw':_0x35d9fc[_0x7a1c('0x18')]?_0x35d9fc[_0x7a1c('0x18')][_0x7a1c('0x19')]===undefined?!![]:![]:!![]})[_0x7a1c('0xa')](function(_0x50e773){logger[_0x7a1c('0x13')](_0x7a1c('0x15'),_0x35d9fc);logger[_0x7a1c('0xd')](_0x7a1c('0x15'),_0x35d9fc,JSON['stringify'](_0x50e773));_0x165fbb(_0x50e773);})['catch'](function(_0xb1712d){logger['error'](_0x7a1c('0x15'),_0xb1712d[_0x7a1c('0x12')],_0x35d9fc);_0x350845(_0x57f84d[_0x7a1c('0x10')](0x1f4,_0xb1712d[_0x7a1c('0x12')]));});});};exports[_0x7a1c('0x1a')]=function(_0x376c1a){var _0x48194a=this;return new Promise(function(_0x186e4c,_0x4b2670){return db['SmsQueueReport'][_0x7a1c('0x1b')](_0x376c1a['body'],{'raw':_0x376c1a[_0x7a1c('0x18')]?_0x376c1a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x376c1a[_0x7a1c('0x18')]?_0x376c1a[_0x7a1c('0x18')][_0x7a1c('0x1c')]||null:null,'attributes':_0x376c1a[_0x7a1c('0x18')]?_0x376c1a[_0x7a1c('0x18')][_0x7a1c('0x1d')]||null:null,'limit':_0x376c1a[_0x7a1c('0x18')]?_0x376c1a['options']['limit']||null:null})['then'](function(_0x5965c0){logger['info'](_0x7a1c('0x1a'),_0x376c1a);logger[_0x7a1c('0xd')](_0x7a1c('0x1a'),_0x376c1a,JSON[_0x7a1c('0xf')](_0x5965c0));_0x186e4c(_0x5965c0);})[_0x7a1c('0x1e')](function(_0x536806){logger[_0x7a1c('0x10')](_0x7a1c('0x1a'),_0x536806[_0x7a1c('0x12')],_0x376c1a);_0x4b2670(_0x48194a[_0x7a1c('0x10')](0x1f4,_0x536806[_0x7a1c('0x12')]));});});}; \ No newline at end of file +var _0x137f=['body','options','raw','stringify','where','attributes','limit','UpdateSmsQueueReport','lodash','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','SmsQueueReport,\x20%s,\x20%s','message','catch','CreateSmsQueueReport','SmsQueueReport','create'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x137f,0x164));var _0xf137=function(_0x37a732,_0x250286){_0x37a732=_0x37a732-0x0;var _0x130af8=_0x137f[_0x37a732];return _0x130af8;};'use strict';var _=require(_0xf137('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf137('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf137('0x2'))(_0xf137('0x3'));var config=require(_0xf137('0x4'));var jayson=require(_0xf137('0x5'));var client=jayson[_0xf137('0x6')][_0xf137('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a2934,_0x1818d5,_0xfbd28a){return new BPromise(function(_0x319d40,_0x27309d){return client[_0xf137('0x8')](_0x5a2934,_0xfbd28a)[_0xf137('0x9')](function(_0x454f11){logger[_0xf137('0xa')]('SmsQueueReport,\x20%s,\x20%s',_0x1818d5,_0xf137('0xb'));logger[_0xf137('0xc')](_0xf137('0xd'),_0x1818d5,'request\x20sent',JSON['stringify'](_0x454f11));if(_0x454f11[_0xf137('0xe')]){if(_0x454f11[_0xf137('0xe')]['code']===0x1f4){logger[_0xf137('0xe')](_0xf137('0xf'),_0x1818d5,_0x454f11[_0xf137('0xe')][_0xf137('0x10')]);return _0x27309d(_0x454f11[_0xf137('0xe')][_0xf137('0x10')]);}logger['error'](_0xf137('0xf'),_0x1818d5,_0x454f11['error'][_0xf137('0x10')]);return _0x319d40(_0x454f11[_0xf137('0xe')][_0xf137('0x10')]);}else{logger['info'](_0xf137('0xf'),_0x1818d5,'request\x20sent');_0x319d40(_0x454f11['result'][_0xf137('0x10')]);}})[_0xf137('0x11')](function(_0x1cbfc4){logger[_0xf137('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x1818d5,_0x1cbfc4);_0x27309d(_0x1cbfc4);});});}exports[_0xf137('0x12')]=function(_0x2ebfcf){var _0x1e811f=this;return new Promise(function(_0x575136,_0x4bc67b){return db[_0xf137('0x13')][_0xf137('0x14')](_0x2ebfcf[_0xf137('0x15')],{'raw':_0x2ebfcf[_0xf137('0x16')]?_0x2ebfcf[_0xf137('0x16')][_0xf137('0x17')]===undefined?!![]:![]:!![]})[_0xf137('0x9')](function(_0x1852b7){logger['info']('CreateSmsQueueReport',_0x2ebfcf);logger[_0xf137('0xc')](_0xf137('0x12'),_0x2ebfcf,JSON[_0xf137('0x18')](_0x1852b7));_0x575136(_0x1852b7);})[_0xf137('0x11')](function(_0x21520a){logger[_0xf137('0xe')]('CreateSmsQueueReport',_0x21520a[_0xf137('0x10')],_0x2ebfcf);_0x4bc67b(_0x1e811f['error'](0x1f4,_0x21520a[_0xf137('0x10')]));});});};exports['UpdateSmsQueueReport']=function(_0x287c6f){var _0xd3c268=this;return new Promise(function(_0xd38dd,_0x114e19){return db[_0xf137('0x13')]['update'](_0x287c6f[_0xf137('0x15')],{'raw':_0x287c6f[_0xf137('0x16')]?_0x287c6f[_0xf137('0x16')][_0xf137('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287c6f[_0xf137('0x16')]?_0x287c6f[_0xf137('0x16')][_0xf137('0x19')]||null:null,'attributes':_0x287c6f[_0xf137('0x16')]?_0x287c6f['options'][_0xf137('0x1a')]||null:null,'limit':_0x287c6f['options']?_0x287c6f[_0xf137('0x16')][_0xf137('0x1b')]||null:null})[_0xf137('0x9')](function(_0x135804){logger[_0xf137('0xa')](_0xf137('0x1c'),_0x287c6f);logger[_0xf137('0xc')](_0xf137('0x1c'),_0x287c6f,JSON['stringify'](_0x135804));_0xd38dd(_0x135804);})[_0xf137('0x11')](function(_0x40066c){logger[_0xf137('0xe')]('UpdateSmsQueueReport',_0x40066c['message'],_0x287c6f);_0x114e19(_0xd3c268[_0xf137('0xe')](0x1f4,_0x40066c['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 0a9f391..c4ecf41 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 _0x1dcc=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x36436d,_0x20292c){var _0x34615d=function(_0x5447af){while(--_0x5447af){_0x36436d['push'](_0x36436d['shift']());}};_0x34615d(++_0x20292c);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0xdbeb1d,_0x44d6cf){_0xdbeb1d=_0xdbeb1d-0x0;var _0x166f26=_0x1dcc[_0xdbeb1d];return _0x166f26;};'use strict';var multer=require(_0xc1dc('0x0'));var util=require(_0xc1dc('0x1'));var path=require(_0xc1dc('0x2'));var timeout=require(_0xc1dc('0x3'));var express=require('express');var router=express[_0xc1dc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc1dc('0x5'));var interaction=require(_0xc1dc('0x6'));var config=require(_0xc1dc('0x7'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0xc1dc('0x8')](),controller[_0xc1dc('0x9')]);router[_0xc1dc('0xa')]('/describe',auth[_0xc1dc('0x8')](),controller[_0xc1dc('0xb')]);router['get'](_0xc1dc('0xc'),auth['isAuthenticated'](),controller[_0xc1dc('0xd')]);router['post']('/',auth[_0xc1dc('0x8')](),controller[_0xc1dc('0xe')]);router[_0xc1dc('0xf')](_0xc1dc('0xc'),auth[_0xc1dc('0x8')](),controller[_0xc1dc('0x10')]);router[_0xc1dc('0x11')](_0xc1dc('0xc'),auth[_0xc1dc('0x8')](),controller['destroy']);module[_0xc1dc('0x12')]=router; \ No newline at end of file +var _0x90b5=['/describe','describe','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x491b22,_0x5548bb){var _0x389bd4=function(_0x1b75d6){while(--_0x1b75d6){_0x491b22['push'](_0x491b22['shift']());}};_0x389bd4(++_0x5548bb);}(_0x90b5,0x139));var _0x590b=function(_0x1d4483,_0x29b98e){_0x1d4483=_0x1d4483-0x0;var _0x5c441f=_0x90b5[_0x1d4483];return _0x5c441f;};'use strict';var multer=require(_0x590b('0x0'));var util=require('util');var path=require(_0x590b('0x1'));var timeout=require(_0x590b('0x2'));var express=require(_0x590b('0x3'));var router=express[_0x590b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x590b('0x5'));var config=require(_0x590b('0x6'));var controller=require('./smsTransferReport.controller');router[_0x590b('0x7')]('/',auth[_0x590b('0x8')](),controller[_0x590b('0x9')]);router['get'](_0x590b('0xa'),auth[_0x590b('0x8')](),controller[_0x590b('0xb')]);router[_0x590b('0x7')](_0x590b('0xc'),auth[_0x590b('0x8')](),controller[_0x590b('0xd')]);router[_0x590b('0xe')]('/',auth[_0x590b('0x8')](),controller['create']);router[_0x590b('0xf')](_0x590b('0xc'),auth['isAuthenticated'](),controller[_0x590b('0x10')]);router['delete'](_0x590b('0xc'),auth[_0x590b('0x8')](),controller[_0x590b('0x11')]);module[_0x590b('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index c5603dd..3d601b1 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x351714,_0x3605b9){var _0x3238bb=function(_0x52cbd9){while(--_0x52cbd9){_0x351714['push'](_0x351714['shift']());}};_0x3238bb(++_0x3605b9);}(_0x70e0,0x17b));var _0x070e=function(_0x5a8f95,_0x2db430){_0x5a8f95=_0x5a8f95-0x0;var _0x3f7b85=_0x70e0[_0x5a8f95];return _0x3f7b85;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x4c1241,_0x2c9bf2){var _0x39d39a=function(_0x1b7483){while(--_0x1b7483){_0x4c1241['push'](_0x4c1241['shift']());}};_0x39d39a(++_0x2c9bf2);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x575b72,_0x1a7eb1){_0x575b72=_0x575b72-0x0;var _0x561c57=_0xf3cd[_0x575b72];return _0x561c57;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index f2034b2..60edf99 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 _0x1e0d=['then','destroy','sendStatus','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','show','keys','catch','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update'];(function(_0x3cd216,_0x4d2599){var _0x24e5b4=function(_0x30556a){while(--_0x30556a){_0x3cd216['push'](_0x3cd216['shift']());}};_0x24e5b4(++_0x4d2599);}(_0x1e0d,0x71));var _0xd1e0=function(_0x3a101c,_0x471a98){_0x3a101c=_0x3a101c-0x0;var _0x5e180e=_0x1e0d[_0x3a101c];return _0x5e180e;};'use strict';var emlformat=require(_0xd1e0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd1e0('0x1'));var jsonpatch=require(_0xd1e0('0x2'));var rp=require(_0xd1e0('0x3'));var moment=require(_0xd1e0('0x4'));var BPromise=require(_0xd1e0('0x5'));var Mustache=require(_0xd1e0('0x6'));var util=require(_0xd1e0('0x7'));var path=require(_0xd1e0('0x8'));var sox=require('sox');var csv=require(_0xd1e0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd1e0('0xa'));var _=require(_0xd1e0('0xb'));var squel=require('squel');var crypto=require(_0xd1e0('0xc'));var jsforce=require(_0xd1e0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd1e0('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd1e0('0xe'));var authService=require(_0xd1e0('0xf'));var qs=require(_0xd1e0('0x10'));var as=require(_0xd1e0('0x11'));var hardwareService=require(_0xd1e0('0x12'));var logger=require(_0xd1e0('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd1e0('0x14'));var db=require(_0xd1e0('0x15'))['db'];function respondWithStatusCode(_0x163aca,_0x28f6b4){_0x28f6b4=_0x28f6b4||0xcc;return function(_0x419c5f){if(_0x419c5f){return _0x163aca['sendStatus'](_0x28f6b4);}return _0x163aca[_0xd1e0('0x16')](_0x28f6b4)['end']();};}function respondWithResult(_0x5bbbd9,_0x14dc18){_0x14dc18=_0x14dc18||0xc8;return function(_0x17030c){if(_0x17030c){return _0x5bbbd9[_0xd1e0('0x16')](_0x14dc18)[_0xd1e0('0x17')](_0x17030c);}};}function respondWithFilteredResult(_0x3328a0,_0x356cab){return function(_0x199d9c){if(_0x199d9c){var _0x24ddea=typeof _0x356cab[_0xd1e0('0x18')]===_0xd1e0('0x19')&&typeof _0x356cab['limit']===_0xd1e0('0x19');var _0x5e5401=_0x199d9c[_0xd1e0('0x1a')];var _0xcd779=_0x24ddea?0x0:_0x356cab[_0xd1e0('0x18')];var _0x4889be=_0x24ddea?_0x199d9c[_0xd1e0('0x1a')]:_0x356cab[_0xd1e0('0x18')]+_0x356cab[_0xd1e0('0x1b')];var _0x1eff67;if(_0x4889be>=_0x5e5401){_0x4889be=_0x5e5401;_0x1eff67=0xc8;}else{_0x1eff67=0xce;}_0x3328a0[_0xd1e0('0x16')](_0x1eff67);return _0x3328a0[_0xd1e0('0x1c')](_0xd1e0('0x1d'),_0xcd779+'-'+_0x4889be+'/'+_0x5e5401)[_0xd1e0('0x17')](_0x199d9c);}return null;};}function patchUpdates(_0x1e3600){return function(_0x12afb7){try{jsonpatch[_0xd1e0('0x1e')](_0x12afb7,_0x1e3600,!![]);}catch(_0x3dde10){return BPromise[_0xd1e0('0x1f')](_0x3dde10);}return _0x12afb7['save']();};}function saveUpdates(_0x4b32f9,_0x2df159){return function(_0x2ceef7){if(_0x2ceef7){return _0x2ceef7[_0xd1e0('0x20')](_0x4b32f9)[_0xd1e0('0x21')](function(_0x10aa72){return _0x10aa72;});}return null;};}function removeEntity(_0x2cdb2e,_0x1a906f){return function(_0xb32b29){if(_0xb32b29){return _0xb32b29[_0xd1e0('0x22')]()['then'](function(){_0x2cdb2e[_0xd1e0('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b83eb,_0x14dd49){return function(_0x5ea368){if(!_0x5ea368){_0x1b83eb[_0xd1e0('0x23')](0x194);}return _0x5ea368;};}function handleError(_0xba59e3,_0x1cd910){_0x1cd910=_0x1cd910||0x1f4;return function(_0x8089aa){logger['error'](_0x8089aa[_0xd1e0('0x24')]);if(_0x8089aa[_0xd1e0('0x25')]){delete _0x8089aa[_0xd1e0('0x25')];}_0xba59e3['status'](_0x1cd910)[_0xd1e0('0x26')](_0x8089aa);};}exports[_0xd1e0('0x27')]=function(_0x17017a,_0x5afd00){var _0x50e683={},_0x49d688={},_0x3414ce={'count':0x0,'rows':[]};var _0x28530a=_[_0xd1e0('0x28')](db[_0xd1e0('0x29')][_0xd1e0('0x2a')],function(_0x1ea002){return{'name':_0x1ea002[_0xd1e0('0x2b')],'type':_0x1ea002[_0xd1e0('0x2c')][_0xd1e0('0x2d')]};});_0x49d688[_0xd1e0('0x2e')]=_[_0xd1e0('0x28')](_0x28530a,_0xd1e0('0x25'));_0x49d688[_0xd1e0('0x2f')]=_['keys'](_0x17017a[_0xd1e0('0x2f')]);_0x49d688[_0xd1e0('0x30')]=_['intersection'](_0x49d688[_0xd1e0('0x2e')],_0x49d688[_0xd1e0('0x2f')]);_0x50e683[_0xd1e0('0x31')]=_[_0xd1e0('0x32')](_0x49d688['model'],qs[_0xd1e0('0x33')](_0x17017a[_0xd1e0('0x2f')][_0xd1e0('0x33')]));_0x50e683[_0xd1e0('0x31')]=_0x50e683[_0xd1e0('0x31')][_0xd1e0('0x34')]?_0x50e683['attributes']:_0x49d688[_0xd1e0('0x2e')];if(!_0x17017a['query'][_0xd1e0('0x35')](_0xd1e0('0x36'))){_0x50e683[_0xd1e0('0x1b')]=qs[_0xd1e0('0x1b')](_0x17017a[_0xd1e0('0x2f')][_0xd1e0('0x1b')]);_0x50e683['offset']=qs[_0xd1e0('0x18')](_0x17017a['query'][_0xd1e0('0x18')]);}_0x50e683[_0xd1e0('0x37')]=qs['sort'](_0x17017a['query'][_0xd1e0('0x38')]);_0x50e683[_0xd1e0('0x39')]=qs[_0xd1e0('0x30')](_[_0xd1e0('0x3a')](_0x17017a[_0xd1e0('0x2f')],_0x49d688[_0xd1e0('0x30')]),_0x28530a);if(_0x17017a['query']['filter']){_0x50e683[_0xd1e0('0x39')]=_[_0xd1e0('0x3b')](_0x50e683[_0xd1e0('0x39')],{'$or':_[_0xd1e0('0x28')](_0x28530a,function(_0x404606){if(_0x404606['type']!==_0xd1e0('0x3c')){var _0x40ea53={};_0x40ea53[_0x404606[_0xd1e0('0x25')]]={'$like':'%'+_0x17017a['query']['filter']+'%'};return _0x40ea53;}})});}_0x50e683=_[_0xd1e0('0x3b')]({},_0x50e683,_0x17017a[_0xd1e0('0x3d')]);var _0x39750a={'where':_0x50e683[_0xd1e0('0x39')]};return db[_0xd1e0('0x29')]['count'](_0x39750a)['then'](function(_0x2a0370){_0x3414ce['count']=_0x2a0370;if(_0x17017a[_0xd1e0('0x2f')]['includeAll']){_0x50e683[_0xd1e0('0x3e')]=[{'all':!![]}];}return db[_0xd1e0('0x29')][_0xd1e0('0x3f')](_0x50e683);})[_0xd1e0('0x21')](function(_0x53cfa1){_0x3414ce[_0xd1e0('0x40')]=_0x53cfa1;return _0x3414ce;})[_0xd1e0('0x21')](respondWithFilteredResult(_0x5afd00,_0x50e683))['catch'](handleError(_0x5afd00,null));};exports[_0xd1e0('0x41')]=function(_0x3b9940,_0x1cfcff){var _0x23d49b={'raw':!![],'where':{'id':_0x3b9940['params']['id']}},_0x375b13={};_0x375b13[_0xd1e0('0x2e')]=_[_0xd1e0('0x42')](db[_0xd1e0('0x29')][_0xd1e0('0x2a')]);_0x375b13[_0xd1e0('0x2f')]=_['keys'](_0x3b9940[_0xd1e0('0x2f')]);_0x375b13[_0xd1e0('0x30')]=_[_0xd1e0('0x32')](_0x375b13[_0xd1e0('0x2e')],_0x375b13['query']);_0x23d49b[_0xd1e0('0x31')]=_[_0xd1e0('0x32')](_0x375b13[_0xd1e0('0x2e')],qs[_0xd1e0('0x33')](_0x3b9940[_0xd1e0('0x2f')]['fields']));_0x23d49b[_0xd1e0('0x31')]=_0x23d49b['attributes'][_0xd1e0('0x34')]?_0x23d49b[_0xd1e0('0x31')]:_0x375b13[_0xd1e0('0x2e')];if(_0x3b9940[_0xd1e0('0x2f')]['includeAll']){_0x23d49b[_0xd1e0('0x3e')]=[{'all':!![]}];}_0x23d49b=_['merge']({},_0x23d49b,_0x3b9940[_0xd1e0('0x3d')]);return db[_0xd1e0('0x29')]['find'](_0x23d49b)[_0xd1e0('0x21')](handleEntityNotFound(_0x1cfcff,null))['then'](respondWithResult(_0x1cfcff,null))[_0xd1e0('0x43')](handleError(_0x1cfcff,null));};exports[_0xd1e0('0x44')]=function(_0x24d011,_0x24286c){return db['SmsTransferReport'][_0xd1e0('0x44')](_0x24d011[_0xd1e0('0x45')],{})['then'](respondWithResult(_0x24286c,0xc9))[_0xd1e0('0x43')](handleError(_0x24286c,null));};exports[_0xd1e0('0x20')]=function(_0x336d9e,_0x40bf87){if(_0x336d9e[_0xd1e0('0x45')]['id']){delete _0x336d9e[_0xd1e0('0x45')]['id'];}return db[_0xd1e0('0x29')][_0xd1e0('0x46')]({'where':{'id':_0x336d9e[_0xd1e0('0x47')]['id']}})['then'](handleEntityNotFound(_0x40bf87,null))[_0xd1e0('0x21')](saveUpdates(_0x336d9e[_0xd1e0('0x45')],null))[_0xd1e0('0x21')](respondWithResult(_0x40bf87,null))['catch'](handleError(_0x40bf87,null));};exports[_0xd1e0('0x22')]=function(_0x5efecc,_0x5a66e2){return db[_0xd1e0('0x29')][_0xd1e0('0x46')]({'where':{'id':_0x5efecc[_0xd1e0('0x47')]['id']}})[_0xd1e0('0x21')](handleEntityNotFound(_0x5a66e2,null))[_0xd1e0('0x21')](removeEntity(_0x5a66e2,null))[_0xd1e0('0x43')](handleError(_0x5a66e2,null));};exports[_0xd1e0('0x48')]=function(_0x2b9638,_0x5c1af2){return db[_0xd1e0('0x29')]['describe']()[_0xd1e0('0x21')](respondWithResult(_0x5c1af2,null))[_0xd1e0('0x43')](handleError(_0x5c1af2,null));}; \ No newline at end of file +var _0x23e1=['api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','then','error','stack','name','send','map','SmsTransferReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','VIRTUAL','filter','merge','options','where','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x497a47,_0xe1ee42){var _0x20524f=function(_0x1ba092){while(--_0x1ba092){_0x497a47['push'](_0x497a47['shift']());}};_0x20524f(++_0xe1ee42);}(_0x23e1,0x1b1));var _0x123e=function(_0x2e8510,_0x253a5a){_0x2e8510=_0x2e8510-0x0;var _0x23a7a3=_0x23e1[_0x2e8510];return _0x23a7a3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x123e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x123e('0x1'));var rp=require(_0x123e('0x2'));var moment=require(_0x123e('0x3'));var BPromise=require(_0x123e('0x4'));var Mustache=require(_0x123e('0x5'));var util=require(_0x123e('0x6'));var path=require(_0x123e('0x7'));var sox=require('sox');var csv=require(_0x123e('0x8'));var ejs=require(_0x123e('0x9'));var fs=require('fs');var fs_extra=require(_0x123e('0xa'));var _=require('lodash');var squel=require(_0x123e('0xb'));var crypto=require(_0x123e('0xc'));var jsforce=require(_0x123e('0xd'));var deskjs=require(_0x123e('0xe'));var toCsv=require(_0x123e('0x8'));var querystring=require(_0x123e('0xf'));var Papa=require(_0x123e('0x10'));var Redis=require(_0x123e('0x11'));var authService=require(_0x123e('0x12'));var qs=require(_0x123e('0x13'));var as=require(_0x123e('0x14'));var hardwareService=require(_0x123e('0x15'));var logger=require(_0x123e('0x16'))(_0x123e('0x17'));var utils=require('../../config/utils');var config=require(_0x123e('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16f662,_0x12c8d3){_0x12c8d3=_0x12c8d3||0xcc;return function(_0x592940){if(_0x592940){return _0x16f662[_0x123e('0x19')](_0x12c8d3);}return _0x16f662[_0x123e('0x1a')](_0x12c8d3)[_0x123e('0x1b')]();};}function respondWithResult(_0x23e25f,_0x3a7097){_0x3a7097=_0x3a7097||0xc8;return function(_0x138d95){if(_0x138d95){return _0x23e25f[_0x123e('0x1a')](_0x3a7097)[_0x123e('0x1c')](_0x138d95);}};}function respondWithFilteredResult(_0x42b07f,_0x7faab2){return function(_0xe46103){if(_0xe46103){var _0x50e41e=typeof _0x7faab2[_0x123e('0x1d')]===_0x123e('0x1e')&&typeof _0x7faab2['limit']===_0x123e('0x1e');var _0x46ee87=_0xe46103[_0x123e('0x1f')];var _0x270df5=_0x50e41e?0x0:_0x7faab2[_0x123e('0x1d')];var _0x4958a9=_0x50e41e?_0xe46103[_0x123e('0x1f')]:_0x7faab2[_0x123e('0x1d')]+_0x7faab2[_0x123e('0x20')];var _0x22b877;if(_0x4958a9>=_0x46ee87){_0x4958a9=_0x46ee87;_0x22b877=0xc8;}else{_0x22b877=0xce;}_0x42b07f['status'](_0x22b877);return _0x42b07f[_0x123e('0x21')](_0x123e('0x22'),_0x270df5+'-'+_0x4958a9+'/'+_0x46ee87)[_0x123e('0x1c')](_0xe46103);}return null;};}function patchUpdates(_0x58b336){return function(_0x2fe9f4){try{jsonpatch[_0x123e('0x23')](_0x2fe9f4,_0x58b336,!![]);}catch(_0x311f2f){return BPromise['reject'](_0x311f2f);}return _0x2fe9f4[_0x123e('0x24')]();};}function saveUpdates(_0x546df8,_0x48a298){return function(_0x1dbd8d){if(_0x1dbd8d){return _0x1dbd8d['update'](_0x546df8)['then'](function(_0x4e56f3){return _0x4e56f3;});}return null;};}function removeEntity(_0xe352ee,_0x3f87ab){return function(_0x2933be){if(_0x2933be){return _0x2933be[_0x123e('0x25')]()[_0x123e('0x26')](function(){_0xe352ee[_0x123e('0x1a')](0xcc)[_0x123e('0x1b')]();});}};}function handleEntityNotFound(_0x26f32f,_0x343742){return function(_0x3add15){if(!_0x3add15){_0x26f32f[_0x123e('0x19')](0x194);}return _0x3add15;};}function handleError(_0x4ae900,_0x50f7db){_0x50f7db=_0x50f7db||0x1f4;return function(_0xc5e7c0){logger[_0x123e('0x27')](_0xc5e7c0[_0x123e('0x28')]);if(_0xc5e7c0[_0x123e('0x29')]){delete _0xc5e7c0[_0x123e('0x29')];}_0x4ae900['status'](_0x50f7db)[_0x123e('0x2a')](_0xc5e7c0);};}exports['index']=function(_0x4f58e8,_0x43eb1c){var _0x28cf3a={},_0x153cc9={},_0x349fd7={'count':0x0,'rows':[]};var _0x5d3858=_[_0x123e('0x2b')](db[_0x123e('0x2c')]['rawAttributes'],function(_0x461158){return{'name':_0x461158[_0x123e('0x2d')],'type':_0x461158[_0x123e('0x2e')]['key']};});_0x153cc9[_0x123e('0x2f')]=_[_0x123e('0x2b')](_0x5d3858,_0x123e('0x29'));_0x153cc9[_0x123e('0x30')]=_[_0x123e('0x31')](_0x4f58e8[_0x123e('0x30')]);_0x153cc9[_0x123e('0x32')]=_[_0x123e('0x33')](_0x153cc9[_0x123e('0x2f')],_0x153cc9[_0x123e('0x30')]);_0x28cf3a[_0x123e('0x34')]=_[_0x123e('0x33')](_0x153cc9[_0x123e('0x2f')],qs[_0x123e('0x35')](_0x4f58e8[_0x123e('0x30')]['fields']));_0x28cf3a[_0x123e('0x34')]=_0x28cf3a[_0x123e('0x34')][_0x123e('0x36')]?_0x28cf3a['attributes']:_0x153cc9[_0x123e('0x2f')];if(!_0x4f58e8[_0x123e('0x30')][_0x123e('0x37')](_0x123e('0x38'))){_0x28cf3a['limit']=qs[_0x123e('0x20')](_0x4f58e8[_0x123e('0x30')][_0x123e('0x20')]);_0x28cf3a[_0x123e('0x1d')]=qs[_0x123e('0x1d')](_0x4f58e8['query']['offset']);}_0x28cf3a[_0x123e('0x39')]=qs['sort'](_0x4f58e8['query'][_0x123e('0x3a')]);_0x28cf3a['where']=qs[_0x123e('0x32')](_[_0x123e('0x3b')](_0x4f58e8['query'],_0x153cc9[_0x123e('0x32')]),_0x5d3858);if(_0x4f58e8[_0x123e('0x30')]['filter']){_0x28cf3a['where']=_['merge'](_0x28cf3a['where'],{'$or':_[_0x123e('0x2b')](_0x5d3858,function(_0x4b5a68){if(_0x4b5a68[_0x123e('0x2e')]!==_0x123e('0x3c')){var _0x4246e1={};_0x4246e1[_0x4b5a68['name']]={'$like':'%'+_0x4f58e8[_0x123e('0x30')][_0x123e('0x3d')]+'%'};return _0x4246e1;}})});}_0x28cf3a=_[_0x123e('0x3e')]({},_0x28cf3a,_0x4f58e8[_0x123e('0x3f')]);var _0x1d2124={'where':_0x28cf3a[_0x123e('0x40')]};return db[_0x123e('0x2c')][_0x123e('0x1f')](_0x1d2124)[_0x123e('0x26')](function(_0x43e1d6){_0x349fd7[_0x123e('0x1f')]=_0x43e1d6;if(_0x4f58e8['query'][_0x123e('0x41')]){_0x28cf3a[_0x123e('0x42')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x123e('0x43')](_0x28cf3a);})[_0x123e('0x26')](function(_0x547f8b){_0x349fd7[_0x123e('0x44')]=_0x547f8b;return _0x349fd7;})[_0x123e('0x26')](respondWithFilteredResult(_0x43eb1c,_0x28cf3a))[_0x123e('0x45')](handleError(_0x43eb1c,null));};exports[_0x123e('0x46')]=function(_0x49e841,_0x261c2e){var _0x3f9fc7={'raw':!![],'where':{'id':_0x49e841[_0x123e('0x47')]['id']}},_0x5efbe4={};_0x5efbe4[_0x123e('0x2f')]=_[_0x123e('0x31')](db[_0x123e('0x2c')]['rawAttributes']);_0x5efbe4[_0x123e('0x30')]=_['keys'](_0x49e841[_0x123e('0x30')]);_0x5efbe4[_0x123e('0x32')]=_['intersection'](_0x5efbe4[_0x123e('0x2f')],_0x5efbe4['query']);_0x3f9fc7['attributes']=_[_0x123e('0x33')](_0x5efbe4[_0x123e('0x2f')],qs['fields'](_0x49e841[_0x123e('0x30')]['fields']));_0x3f9fc7[_0x123e('0x34')]=_0x3f9fc7[_0x123e('0x34')][_0x123e('0x36')]?_0x3f9fc7[_0x123e('0x34')]:_0x5efbe4['model'];if(_0x49e841['query'][_0x123e('0x41')]){_0x3f9fc7['include']=[{'all':!![]}];}_0x3f9fc7=_[_0x123e('0x3e')]({},_0x3f9fc7,_0x49e841[_0x123e('0x3f')]);return db[_0x123e('0x2c')][_0x123e('0x48')](_0x3f9fc7)[_0x123e('0x26')](handleEntityNotFound(_0x261c2e,null))[_0x123e('0x26')](respondWithResult(_0x261c2e,null))[_0x123e('0x45')](handleError(_0x261c2e,null));};exports[_0x123e('0x49')]=function(_0x3e89a0,_0x249338){return db['SmsTransferReport'][_0x123e('0x49')](_0x3e89a0[_0x123e('0x4a')],{})[_0x123e('0x26')](respondWithResult(_0x249338,0xc9))['catch'](handleError(_0x249338,null));};exports['update']=function(_0x3f95ed,_0x56b58e){if(_0x3f95ed['body']['id']){delete _0x3f95ed[_0x123e('0x4a')]['id'];}return db['SmsTransferReport'][_0x123e('0x48')]({'where':{'id':_0x3f95ed[_0x123e('0x47')]['id']}})['then'](handleEntityNotFound(_0x56b58e,null))[_0x123e('0x26')](saveUpdates(_0x3f95ed[_0x123e('0x4a')],null))[_0x123e('0x26')](respondWithResult(_0x56b58e,null))['catch'](handleError(_0x56b58e,null));};exports['destroy']=function(_0x4f0e3f,_0x455f1b){return db[_0x123e('0x2c')][_0x123e('0x48')]({'where':{'id':_0x4f0e3f[_0x123e('0x47')]['id']}})[_0x123e('0x26')](handleEntityNotFound(_0x455f1b,null))[_0x123e('0x26')](removeEntity(_0x455f1b,null))['catch'](handleError(_0x455f1b,null));};exports[_0x123e('0x4b')]=function(_0x565982,_0xc53f4){return db[_0x123e('0x2c')]['describe']()[_0x123e('0x26')](respondWithResult(_0xc53f4,null))[_0x123e('0x45')](handleError(_0xc53f4,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index c971580..aa89de7 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 _0xa261=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','./smsTransferReport.attributes','exports','define','report_sms_transfer'];(function(_0x93f061,_0x5b30ea){var _0xdc7282=function(_0x5248a6){while(--_0x5248a6){_0x93f061['push'](_0x93f061['shift']());}};_0xdc7282(++_0x5b30ea);}(_0xa261,0x1a3));var _0x1a26=function(_0x9c27e0,_0x1f7f43){_0x9c27e0=_0x9c27e0-0x0;var _0x5466b1=_0xa261[_0x9c27e0];return _0x5466b1;};'use strict';var _=require(_0x1a26('0x0'));var util=require('util');var logger=require(_0x1a26('0x1'))(_0x1a26('0x2'));var moment=require(_0x1a26('0x3'));var BPromise=require(_0x1a26('0x4'));var rp=require(_0x1a26('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1a26('0x6'));module[_0x1a26('0x7')]=function(_0x2dad90,_0x392ee0){return _0x2dad90[_0x1a26('0x8')]('SmsTransferReport',attributes,{'tableName':_0x1a26('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1a26('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4989=['lodash','api','moment','bluebird','request-promise','../../config/environment','exports','define','SmsTransferReport','report_sms_transfer','uniqueid'];(function(_0x3bbe89,_0x2e1ba3){var _0x32842b=function(_0x22678f){while(--_0x22678f){_0x3bbe89['push'](_0x3bbe89['shift']());}};_0x32842b(++_0x2e1ba3);}(_0x4989,0x79));var _0x9498=function(_0x3b6648,_0x2d723a){_0x3b6648=_0x3b6648-0x0;var _0x5a0a0d=_0x4989[_0x3b6648];return _0x5a0a0d;};'use strict';var _=require(_0x9498('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9498('0x1'));var moment=require(_0x9498('0x2'));var BPromise=require(_0x9498('0x3'));var rp=require(_0x9498('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9498('0x5'));var attributes=require('./smsTransferReport.attributes');module[_0x9498('0x6')]=function(_0x4745ef,_0x51014c){return _0x4745ef[_0x9498('0x7')](_0x9498('0x8'),attributes,{'tableName':_0x9498('0x9'),'paranoid':![],'indexes':[{'name':_0x9498('0xa'),'fields':[_0x9498('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index b88060c..60f7858 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 _0xf69d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsTransferReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x39748a,_0x9f13fe){var _0xd9a7f2=function(_0x367ea2){while(--_0x367ea2){_0x39748a['push'](_0x39748a['shift']());}};_0xd9a7f2(++_0x9f13fe);}(_0xf69d,0xd3));var _0xdf69=function(_0x1b05b8,_0x44a92){_0x1b05b8=_0x1b05b8-0x0;var _0x36f4b4=_0xf69d[_0x1b05b8];return _0x36f4b4;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var moment=require(_0xdf69('0x2'));var BPromise=require(_0xdf69('0x3'));var rs=require(_0xdf69('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf69('0x5'))['db'];var utils=require(_0xdf69('0x6'));var logger=require(_0xdf69('0x7'))(_0xdf69('0x8'));var config=require(_0xdf69('0x9'));var jayson=require(_0xdf69('0xa'));var client=jayson[_0xdf69('0xb')][_0xdf69('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d2501,_0x12c186,_0x18a08e){return new BPromise(function(_0xc1b77e,_0x38909e){return client[_0xdf69('0xd')](_0x1d2501,_0x18a08e)[_0xdf69('0xe')](function(_0x211ea9){logger[_0xdf69('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x12c186,_0xdf69('0x10'));logger[_0xdf69('0x11')](_0xdf69('0x12'),_0x12c186,_0xdf69('0x10'),JSON[_0xdf69('0x13')](_0x211ea9));if(_0x211ea9[_0xdf69('0x14')]){if(_0x211ea9['error']['code']===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x12c186,_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);return _0x38909e(_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);}logger[_0xdf69('0x14')](_0xdf69('0x16'),_0x12c186,_0x211ea9['error'][_0xdf69('0x15')]);return _0xc1b77e(_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);}else{logger[_0xdf69('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x12c186,_0xdf69('0x10'));_0xc1b77e(_0x211ea9['result'][_0xdf69('0x15')]);}})[_0xdf69('0x17')](function(_0x5263a4){logger[_0xdf69('0x14')](_0xdf69('0x16'),_0x12c186,_0x5263a4);_0x38909e(_0x5263a4);});});} \ No newline at end of file +var _0x097c=['request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x126ee1,_0x4b9781){var _0x32524c=function(_0x2c7b1e){while(--_0x2c7b1e){_0x126ee1['push'](_0x126ee1['shift']());}};_0x32524c(++_0x4b9781);}(_0x097c,0x1d5));var _0xc097=function(_0x63cf45,_0x3e5660){_0x63cf45=_0x63cf45-0x0;var _0x1266cc=_0x097c[_0x63cf45];return _0x1266cc;};'use strict';var _=require(_0xc097('0x0'));var util=require(_0xc097('0x1'));var moment=require(_0xc097('0x2'));var BPromise=require('bluebird');var rs=require(_0xc097('0x3'));var fs=require('fs');var Redis=require(_0xc097('0x4'));var db=require(_0xc097('0x5'))['db'];var utils=require(_0xc097('0x6'));var logger=require('../../config/logger')(_0xc097('0x7'));var config=require('../../config/environment');var jayson=require(_0xc097('0x8'));var client=jayson[_0xc097('0x9')][_0xc097('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32493e,_0x582476,_0x3f67a4){return new BPromise(function(_0x4d95d9,_0x57b782){return client[_0xc097('0xb')](_0x32493e,_0x3f67a4)[_0xc097('0xc')](function(_0x26e257){logger[_0xc097('0xd')](_0xc097('0xe'),_0x582476,_0xc097('0xf'));logger[_0xc097('0x10')](_0xc097('0x11'),_0x582476,_0xc097('0xf'),JSON['stringify'](_0x26e257));if(_0x26e257[_0xc097('0x12')]){if(_0x26e257[_0xc097('0x12')]['code']===0x1f4){logger[_0xc097('0x12')](_0xc097('0xe'),_0x582476,_0x26e257[_0xc097('0x12')][_0xc097('0x13')]);return _0x57b782(_0x26e257[_0xc097('0x12')][_0xc097('0x13')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x582476,_0x26e257[_0xc097('0x12')][_0xc097('0x13')]);return _0x4d95d9(_0x26e257[_0xc097('0x12')][_0xc097('0x13')]);}else{logger[_0xc097('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x582476,_0xc097('0xf'));_0x4d95d9(_0x26e257['result'][_0xc097('0x13')]);}})['catch'](function(_0x1a2a3a){logger[_0xc097('0x12')](_0xc097('0xe'),_0x582476,_0x1a2a3a);_0x57b782(_0x1a2a3a);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 75b6a39..2ead030 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 _0x408c=['multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id','show','join','root','originalname','replace','format','%s-%s%s','extname','now','post','file','create','put','update','delete','exports'];(function(_0x4fde61,_0x119ec6){var _0x22da6c=function(_0x467f1e){while(--_0x467f1e){_0x4fde61['push'](_0x4fde61['shift']());}};_0x22da6c(++_0x119ec6);}(_0x408c,0xc4));var _0xc408=function(_0x2ef291,_0x11d6f5){_0x2ef291=_0x2ef291-0x0;var _0x2c374b=_0x408c[_0x2ef291];return _0x2c374b;};'use strict';var multer=require(_0xc408('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc408('0x1'));var express=require(_0xc408('0x2'));var router=express[_0xc408('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc408('0x4'));var interaction=require(_0xc408('0x5'));var config=require(_0xc408('0x6'));var controller=require(_0xc408('0x7'));router['get']('/',auth[_0xc408('0x8')](),controller[_0xc408('0x9')]);router[_0xc408('0xa')](_0xc408('0xb'),auth[_0xc408('0x8')](),controller[_0xc408('0xc')]);router[_0xc408('0xa')]('/:id/download',auth[_0xc408('0x8')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4ee58b,_0x5d3e3b,_0x4d23ff){_0x4d23ff(null,path[_0xc408('0xd')](config[_0xc408('0xe')],'server/files/sounds/original/'));},'filename':function(_0x1bbd46,_0x5a712f,_0x3ef67f){_0x5a712f[_0xc408('0xf')]=_0x5a712f[_0xc408('0xf')][_0xc408('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ef67f(null,util[_0xc408('0x11')](_0xc408('0x12'),path['basename'](_0x5a712f[_0xc408('0xf')],path[_0xc408('0x13')](_0x5a712f[_0xc408('0xf')])),Date[_0xc408('0x14')](),path[_0xc408('0x13')](_0x5a712f[_0xc408('0xf')])));}})});router[_0xc408('0x15')]('/',upload['single'](_0xc408('0x16')),controller[_0xc408('0x17')]);router[_0xc408('0x18')](_0xc408('0xb'),auth[_0xc408('0x8')](),controller[_0xc408('0x19')]);router[_0xc408('0x1a')]('/:id',auth[_0xc408('0x8')](),controller[_0xc408('0x1a')]);module[_0xc408('0x1b')]=router; \ No newline at end of file +var _0x1b8b=['./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','diskStorage','join','server/files/sounds/original/','originalname','replace','basename','extname','now','post','single','create','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x50ff4b,_0x213182){var _0x6d20b3=function(_0x256cb2){while(--_0x256cb2){_0x50ff4b['push'](_0x50ff4b['shift']());}};_0x6d20b3(++_0x213182);}(_0x1b8b,0x123));var _0xb1b8=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0x1b8b[_0x3da832];return _0xe602f2;};'use strict';var multer=require(_0xb1b8('0x0'));var util=require(_0xb1b8('0x1'));var path=require(_0xb1b8('0x2'));var timeout=require('connect-timeout');var express=require(_0xb1b8('0x3'));var router=express[_0xb1b8('0x4')]();var fs_extra=require(_0xb1b8('0x5'));var auth=require(_0xb1b8('0x6'));var interaction=require(_0xb1b8('0x7'));var config=require(_0xb1b8('0x8'));var controller=require(_0xb1b8('0x9'));router[_0xb1b8('0xa')]('/',auth['isAuthenticated'](),controller[_0xb1b8('0xb')]);router[_0xb1b8('0xa')](_0xb1b8('0xc'),auth[_0xb1b8('0xd')](),controller[_0xb1b8('0xe')]);router[_0xb1b8('0xa')](_0xb1b8('0xf'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xb1b8('0x10')]({'destination':function(_0x4f9757,_0x129d99,_0x30dccd){_0x30dccd(null,path[_0xb1b8('0x11')](config['root'],_0xb1b8('0x12')));},'filename':function(_0x262811,_0x87452,_0x4c46a7){_0x87452[_0xb1b8('0x13')]=_0x87452[_0xb1b8('0x13')][_0xb1b8('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4c46a7(null,util['format']('%s-%s%s',path[_0xb1b8('0x15')](_0x87452['originalname'],path[_0xb1b8('0x16')](_0x87452[_0xb1b8('0x13')])),Date[_0xb1b8('0x17')](),path[_0xb1b8('0x16')](_0x87452['originalname'])));}})});router[_0xb1b8('0x18')]('/',upload[_0xb1b8('0x19')]('file'),controller[_0xb1b8('0x1a')]);router[_0xb1b8('0x1b')]('/:id',auth[_0xb1b8('0xd')](),controller['update']);router['delete']('/:id',auth[_0xb1b8('0xd')](),controller[_0xb1b8('0x1c')]);module[_0xb1b8('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 83719ba..6f5898e 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 _0xf0dd=['sequelize','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x512d7d,_0x1d5a55){var _0x2713fc=function(_0x280628){while(--_0x280628){_0x512d7d['push'](_0x512d7d['shift']());}};_0x2713fc(++_0x1d5a55);}(_0xf0dd,0x84));var _0xdf0d=function(_0x165ca9,_0x36e359){_0x165ca9=_0x165ca9-0x0;var _0x25f49a=_0xf0dd[_0x165ca9];return _0x25f49a;};'use strict';var Sequelize=require(_0xdf0d('0x0'));module['exports']={'name':{'type':Sequelize[_0xdf0d('0x1')],'unique':_0xdf0d('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xdf0d('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xdf0d('0x1')]},'original_duration':{'type':Sequelize[_0xdf0d('0x3')]},'original_sampleCount':{'type':Sequelize[_0xdf0d('0x4')]},'original_channelCount':{'type':Sequelize[_0xdf0d('0x5')]},'original_bitRate':{'type':Sequelize[_0xdf0d('0x4')]},'original_sampleRate':{'type':Sequelize[_0xdf0d('0x5')]},'converted_format':{'type':Sequelize[_0xdf0d('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xdf0d('0x4')]},'converted_channelCount':{'type':Sequelize[_0xdf0d('0x5')]},'converted_bitRate':{'type':Sequelize[_0xdf0d('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xdf0d('0x5')]}}; \ No newline at end of file +var _0x434e=['FLOAT','BIGINT','INTEGER','sequelize','exports','name','STRING'];(function(_0x5e2f7b,_0x226498){var _0x3c386e=function(_0x34c8e1){while(--_0x34c8e1){_0x5e2f7b['push'](_0x5e2f7b['shift']());}};_0x3c386e(++_0x226498);}(_0x434e,0x1d8));var _0xe434=function(_0x148879,_0x5b4c11){_0x148879=_0x148879-0x0;var _0x4f7027=_0x434e[_0x148879];return _0x4f7027;};'use strict';var Sequelize=require(_0xe434('0x0'));module[_0xe434('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe434('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xe434('0x3')]},'display_name':{'type':Sequelize[_0xe434('0x3')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xe434('0x3')]},'original_duration':{'type':Sequelize[_0xe434('0x4')]},'original_sampleCount':{'type':Sequelize[_0xe434('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xe434('0x5')]},'original_sampleRate':{'type':Sequelize[_0xe434('0x6')]},'converted_format':{'type':Sequelize[_0xe434('0x3')]},'converted_duration':{'type':Sequelize[_0xe434('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xe434('0x5')]},'converted_channelCount':{'type':Sequelize[_0xe434('0x6')]},'converted_bitRate':{'type':Sequelize[_0xe434('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 745b93d..25f3ea9 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 _0x555d=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','apply','save','update','then','destroy','get','Sounds','UserProfileResource','end','error','stack','name','index','map','Sound','fieldName','type','key','model','query','filters','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','intersection','include','find','catch','download','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','basename','originalname','extname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','send','description','delete','unlinkSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x40b819,_0x1dc456){var _0x13fcf8=function(_0x2db0fc){while(--_0x2db0fc){_0x40b819['push'](_0x40b819['shift']());}};_0x13fcf8(++_0x1dc456);}(_0x555d,0x69));var _0xd555=function(_0xde654b,_0x12cc9e){_0xde654b=_0xde654b-0x0;var _0x170441=_0x555d[_0xde654b];return _0x170441;};'use strict';var emlformat=require(_0xd555('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd555('0x1'));var jsonpatch=require(_0xd555('0x2'));var rp=require('request-promise');var moment=require(_0xd555('0x3'));var BPromise=require(_0xd555('0x4'));var Mustache=require('mustache');var util=require(_0xd555('0x5'));var path=require('path');var sox=require(_0xd555('0x6'));var csv=require('to-csv');var ejs=require(_0xd555('0x7'));var fs=require('fs');var fs_extra=require(_0xd555('0x8'));var _=require(_0xd555('0x9'));var squel=require(_0xd555('0xa'));var crypto=require('crypto');var jsforce=require(_0xd555('0xb'));var deskjs=require(_0xd555('0xc'));var toCsv=require(_0xd555('0xd'));var querystring=require(_0xd555('0xe'));var Papa=require(_0xd555('0xf'));var Redis=require(_0xd555('0x10'));var authService=require(_0xd555('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd555('0x12'));var hardwareService=require(_0xd555('0x13'));var logger=require('../../config/logger')(_0xd555('0x14'));var utils=require(_0xd555('0x15'));var config=require(_0xd555('0x16'));var licenseUtil=require(_0xd555('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bd4f4,_0x2081a6){_0x2081a6=_0x2081a6||0xcc;return function(_0x54e7ab){if(_0x54e7ab){return _0x3bd4f4[_0xd555('0x18')](_0x2081a6);}return _0x3bd4f4['status'](_0x2081a6)['end']();};}function respondWithResult(_0x4ece30,_0x596393){_0x596393=_0x596393||0xc8;return function(_0x118db7){if(_0x118db7){return _0x4ece30['status'](_0x596393)[_0xd555('0x19')](_0x118db7);}};}function respondWithFilteredResult(_0x3b5b72,_0x5e4d93){return function(_0x31279c){if(_0x31279c){var _0x2196ad=typeof _0x5e4d93[_0xd555('0x1a')]===_0xd555('0x1b')&&typeof _0x5e4d93['limit']===_0xd555('0x1b');var _0x285f9d=_0x31279c['count'];var _0x5b0c2f=_0x2196ad?0x0:_0x5e4d93[_0xd555('0x1a')];var _0x17db0f=_0x2196ad?_0x31279c[_0xd555('0x1c')]:_0x5e4d93[_0xd555('0x1a')]+_0x5e4d93[_0xd555('0x1d')];var _0x514b53;if(_0x17db0f>=_0x285f9d){_0x17db0f=_0x285f9d;_0x514b53=0xc8;}else{_0x514b53=0xce;}_0x3b5b72[_0xd555('0x1e')](_0x514b53);return _0x3b5b72[_0xd555('0x1f')](_0xd555('0x20'),_0x5b0c2f+'-'+_0x17db0f+'/'+_0x285f9d)[_0xd555('0x19')](_0x31279c);}return null;};}function patchUpdates(_0x37c99c){return function(_0x36995e){try{jsonpatch[_0xd555('0x21')](_0x36995e,_0x37c99c,!![]);}catch(_0x49ba00){return BPromise['reject'](_0x49ba00);}return _0x36995e[_0xd555('0x22')]();};}function saveUpdates(_0xa548a8,_0x5d4f92){return function(_0x41b0a7){if(_0x41b0a7){return _0x41b0a7[_0xd555('0x23')](_0xa548a8)[_0xd555('0x24')](function(_0x2c5094){return _0x2c5094;});}return null;};}function removeEntity(_0x524fb6,_0x19307b){return function(_0x2a5be7){if(_0x2a5be7){return _0x2a5be7[_0xd555('0x25')]()[_0xd555('0x24')](function(){var _0x4cac51=_0x2a5be7[_0xd555('0x26')]({'plain':!![]});var _0x398c7e=_0xd555('0x27');return db[_0xd555('0x28')][_0xd555('0x25')]({'where':{'type':_0x398c7e,'resourceId':_0x4cac51['id']}})[_0xd555('0x24')](function(){return _0x2a5be7;});})[_0xd555('0x24')](function(){_0x524fb6[_0xd555('0x1e')](0xcc)[_0xd555('0x29')]();});}};}function handleEntityNotFound(_0x1b6bc3,_0x16c42f){return function(_0x145920){if(!_0x145920){_0x1b6bc3['sendStatus'](0x194);}return _0x145920;};}function handleError(_0x3100de,_0x563b65){_0x563b65=_0x563b65||0x1f4;return function(_0x5b40c3){logger[_0xd555('0x2a')](_0x5b40c3[_0xd555('0x2b')]);if(_0x5b40c3[_0xd555('0x2c')]){delete _0x5b40c3['name'];}_0x3100de[_0xd555('0x1e')](_0x563b65)['send'](_0x5b40c3);};}exports[_0xd555('0x2d')]=function(_0xe492a,_0x417756){var _0x5dd846={},_0x542aa8={},_0x227d0d={'count':0x0,'rows':[]};var _0x526548=_[_0xd555('0x2e')](db[_0xd555('0x2f')]['rawAttributes'],function(_0x1b7121){return{'name':_0x1b7121[_0xd555('0x30')],'type':_0x1b7121[_0xd555('0x31')][_0xd555('0x32')]};});_0x542aa8[_0xd555('0x33')]=_[_0xd555('0x2e')](_0x526548,_0xd555('0x2c'));_0x542aa8[_0xd555('0x34')]=_['keys'](_0xe492a[_0xd555('0x34')]);_0x542aa8[_0xd555('0x35')]=_['intersection'](_0x542aa8[_0xd555('0x33')],_0x542aa8[_0xd555('0x34')]);_0x5dd846[_0xd555('0x36')]=_['intersection'](_0x542aa8['model'],qs[_0xd555('0x37')](_0xe492a[_0xd555('0x34')]['fields']));_0x5dd846[_0xd555('0x36')]=_0x5dd846[_0xd555('0x36')][_0xd555('0x38')]?_0x5dd846[_0xd555('0x36')]:_0x542aa8[_0xd555('0x33')];if(!_0xe492a[_0xd555('0x34')]['hasOwnProperty']('nolimit')){_0x5dd846[_0xd555('0x1d')]=qs[_0xd555('0x1d')](_0xe492a[_0xd555('0x34')]['limit']);_0x5dd846['offset']=qs['offset'](_0xe492a[_0xd555('0x34')][_0xd555('0x1a')]);}_0x5dd846['order']=qs['sort'](_0xe492a[_0xd555('0x34')][_0xd555('0x39')]);_0x5dd846[_0xd555('0x3a')]=qs[_0xd555('0x35')](_[_0xd555('0x3b')](_0xe492a[_0xd555('0x34')],_0x542aa8[_0xd555('0x35')]),_0x526548);if(_0xe492a['query'][_0xd555('0x3c')]){_0x5dd846[_0xd555('0x3a')]=_[_0xd555('0x3d')](_0x5dd846[_0xd555('0x3a')],{'$or':_[_0xd555('0x2e')](_0x526548,function(_0x4e1776){if(_0x4e1776[_0xd555('0x31')]!==_0xd555('0x3e')){var _0x2d55aa={};_0x2d55aa[_0x4e1776[_0xd555('0x2c')]]={'$like':'%'+_0xe492a['query'][_0xd555('0x3c')]+'%'};return _0x2d55aa;}})});}_0x5dd846=_[_0xd555('0x3d')]({},_0x5dd846,_0xe492a[_0xd555('0x3f')]);var _0x4b4c6d={'where':_0x5dd846[_0xd555('0x3a')]};return db[_0xd555('0x2f')][_0xd555('0x1c')](_0x4b4c6d)[_0xd555('0x24')](function(_0x576405){_0x227d0d[_0xd555('0x1c')]=_0x576405;if(_0xe492a[_0xd555('0x34')][_0xd555('0x40')]){_0x5dd846['include']=[{'all':!![]}];}return db['Sound'][_0xd555('0x41')](_0x5dd846);})[_0xd555('0x24')](function(_0x339239){_0x227d0d['rows']=_0x339239;return _0x227d0d;})[_0xd555('0x24')](respondWithFilteredResult(_0x417756,_0x5dd846))['catch'](handleError(_0x417756,null));};exports[_0xd555('0x42')]=function(_0x541bcb,_0x4e0bb9){var _0x329226={'raw':!![],'where':{'id':_0x541bcb[_0xd555('0x43')]['id']}},_0x2c3302={};_0x2c3302[_0xd555('0x33')]=_['keys'](db[_0xd555('0x2f')][_0xd555('0x44')]);_0x2c3302['query']=_['keys'](_0x541bcb[_0xd555('0x34')]);_0x2c3302[_0xd555('0x35')]=_[_0xd555('0x45')](_0x2c3302['model'],_0x2c3302['query']);_0x329226['attributes']=_[_0xd555('0x45')](_0x2c3302['model'],qs[_0xd555('0x37')](_0x541bcb[_0xd555('0x34')]['fields']));_0x329226['attributes']=_0x329226[_0xd555('0x36')]['length']?_0x329226[_0xd555('0x36')]:_0x2c3302[_0xd555('0x33')];if(_0x541bcb[_0xd555('0x34')][_0xd555('0x40')]){_0x329226[_0xd555('0x46')]=[{'all':!![]}];}_0x329226=_[_0xd555('0x3d')]({},_0x329226,_0x541bcb[_0xd555('0x3f')]);return db[_0xd555('0x2f')][_0xd555('0x47')](_0x329226)[_0xd555('0x24')](handleEntityNotFound(_0x4e0bb9,null))[_0xd555('0x24')](respondWithResult(_0x4e0bb9,null))[_0xd555('0x48')](handleError(_0x4e0bb9,null));};exports[_0xd555('0x49')]=function(_0xb6f9f4,_0x36256d,_0x2eed80){return db[_0xd555('0x2f')]['find']({'where':{'id':_0xb6f9f4[_0xd555('0x43')]['id']},'attributes':[_0xd555('0x2c'),_0xd555('0x4a'),_0xd555('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x36256d,null))[_0xd555('0x24')](function(_0x53b097){if(_0x53b097){if(!fs['existsSync'](path[_0xd555('0x4c')](config[_0xd555('0x4d')],_0xd555('0x4e'),_0x53b097['save_name']+'.'+_0x53b097[_0xd555('0x4b')]))){throw new db[(_0xd555('0x4f'))][(_0xd555('0x50'))](_0xd555('0x51'));}return _0x36256d['download'](path[_0xd555('0x4c')](config[_0xd555('0x4d')],_0xd555('0x4e'),util[_0xd555('0x52')](_0xd555('0x53'),_0x53b097['save_name'],_0x53b097[_0xd555('0x4b')])),util[_0xd555('0x52')]('%s.%s',_0x53b097['name'],_0x53b097[_0xd555('0x4b')]));}return null;})[_0xd555('0x48')](handleError(_0x36256d,null));};exports['create']=function(_0x47195a,_0x2f8783,_0x1d8501){var _0x1de8a6={'name':path[_0xd555('0x54')](_0x47195a['file'][_0xd555('0x55')],path[_0xd555('0x56')](_0x47195a[_0xd555('0x57')][_0xd555('0x55')])),'save_name':path[_0xd555('0x54')](_0x47195a['file'][_0xd555('0x58')],path[_0xd555('0x56')](_0x47195a['file']['filename'])),'original_format':path[_0xd555('0x56')](_0x47195a[_0xd555('0x57')][_0xd555('0x55')])[_0xd555('0x59')](0x1),'converted_format':_0xd555('0x5a')};var _0x9a0f06=path['join'](config['root'],_0xd555('0x5b'),_0x47195a[_0xd555('0x57')][_0xd555('0x58')]);var _0x1c1c09=path[_0xd555('0x4c')](config[_0xd555('0x4d')],_0xd555('0x4e'),util[_0xd555('0x52')](_0xd555('0x53'),path[_0xd555('0x54')](_0x47195a['file'][_0xd555('0x58')],path[_0xd555('0x56')](_0x47195a[_0xd555('0x57')][_0xd555('0x58')])),_0x1de8a6['converted_format']));logger[_0xd555('0x5c')](_0xd555('0x5d'),_0x9a0f06);logger[_0xd555('0x5c')](_0xd555('0x5e'),_0x1c1c09);try{fs[_0xd555('0x5f')](_0x9a0f06,parseInt(_0xd555('0x60'),0x8));var _0x2701c1=sox[_0xd555('0x61')](_0x9a0f06,_0x1c1c09,{'sampleRate':0x1f40,'format':_0xd555('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2701c1['on'](_0xd555('0x2a'),function(_0x1ea8a8){fs['unlinkSync'](_0x9a0f06);_0x2f8783[_0xd555('0x1e')](0x1f4)['send'](_0x1ea8a8);});_0x2701c1['on']('src',function(_0x1d06b7){_0x1de8a6['original_duration']=isNaN(_0x1d06b7[_0xd555('0x62')])?null:_0x1d06b7['duration']*0x3e8;_0x1de8a6[_0xd555('0x63')]=isNaN(_0x1d06b7['sampleCount'])?null:_0x1d06b7[_0xd555('0x64')];_0x1de8a6[_0xd555('0x65')]=isNaN(_0x1d06b7['channelCount'])?null:_0x1d06b7[_0xd555('0x66')];_0x1de8a6[_0xd555('0x67')]=isNaN(_0x1d06b7[_0xd555('0x68')])?null:_0x1d06b7[_0xd555('0x68')];_0x1de8a6[_0xd555('0x69')]=isNaN(_0x1d06b7[_0xd555('0x6a')])?null:_0x1d06b7[_0xd555('0x6a')];});_0x2701c1['on'](_0xd555('0x6b'),function(_0x46aa4c){_0x1de8a6[_0xd555('0x6c')]=isNaN(_0x46aa4c[_0xd555('0x62')])?null:_0x46aa4c[_0xd555('0x62')]*0x3e8;_0x1de8a6[_0xd555('0x6d')]=isNaN(_0x46aa4c[_0xd555('0x64')])?null:_0x46aa4c['sampleCount'];_0x1de8a6['converted_channelCount']=isNaN(_0x46aa4c[_0xd555('0x66')])?null:_0x46aa4c['channelCount'];_0x1de8a6[_0xd555('0x6e')]=isNaN(_0x46aa4c[_0xd555('0x68')])?null:_0x46aa4c[_0xd555('0x68')];_0x1de8a6[_0xd555('0x6f')]=isNaN(_0x46aa4c[_0xd555('0x6a')])?null:_0x46aa4c['sampleRate'];});_0x2701c1['on'](_0xd555('0x29'),function(){fs['chmodSync'](_0x1c1c09,parseInt(_0xd555('0x60'),0x8));return db[_0xd555('0x2f')][_0xd555('0x70')](_0x1de8a6)['then'](function(_0x457a77){var _0x39e920={'role':_0x47195a[_0xd555('0x71')][_0xd555('0x72')],'userProfileId':_0x47195a['body']['userProfileId']};if(!_0x39e920)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39e920[_0xd555('0x72')]==='user'){var _0x941f40=_0x457a77[_0xd555('0x26')]({'plain':!![]});return db[_0xd555('0x73')][_0xd555('0x47')]({'where':{'name':_0xd555('0x27'),'userProfileId':_0x39e920[_0xd555('0x74')]},'raw':!![]})[_0xd555('0x24')](function(_0x377664){if(_0x377664&&_0x377664[_0xd555('0x75')]===0x0){return db[_0xd555('0x28')][_0xd555('0x70')]({'name':_0x941f40['name'],'resourceId':_0x941f40['id'],'type':_0x377664['name'],'sectionId':_0x377664['id']},{})[_0xd555('0x24')](function(){return _0x457a77;});}else{return _0x457a77;}})['catch'](function(_0x14aa20){logger[_0xd555('0x2a')](_0xd555('0x76'),_0x14aa20);throw _0x14aa20;});}return _0x457a77;})[_0xd555('0x24')](respondWithResult(_0x2f8783,null))['catch'](handleError(_0x2f8783,null));});_0x2701c1[_0xd555('0x77')]();}catch(_0x4941c9){_0x2f8783[_0xd555('0x1e')](0x1f4)[_0xd555('0x78')](_0x4941c9);}};exports[_0xd555('0x23')]=function(_0x491e81,_0x72c82e,_0x29d1c7){return db['Sound'][_0xd555('0x47')]({'where':{'id':_0x491e81[_0xd555('0x43')]['id']}})[_0xd555('0x24')](handleEntityNotFound(_0x72c82e,null))[_0xd555('0x24')](saveUpdates(_[_0xd555('0x3b')](_0x491e81[_0xd555('0x71')],['name',_0xd555('0x79')]),null))[_0xd555('0x24')](respondWithResult(_0x72c82e,null))[_0xd555('0x48')](handleError(_0x72c82e,null));};exports[_0xd555('0x7a')]=function(_0x25d663,_0x3d5e0b,_0x114953){return db['Sound'][_0xd555('0x47')]({'where':{'id':_0x25d663[_0xd555('0x43')]['id']}})[_0xd555('0x24')](function(_0x171f9e){if(_0x171f9e){return _0x171f9e[_0xd555('0x25')]();}})[_0xd555('0x24')](function(_0x58445b){var _0x406276=path['join'](config[_0xd555('0x4d')],'server/files/sounds/original',util['format']('%s.%s',_0x58445b['save_name'],_0x58445b['original_format']));var _0x4186bd=path[_0xd555('0x4c')](config[_0xd555('0x4d')],_0xd555('0x4e'),util['format']('%s.%s',_0x58445b[_0xd555('0x4a')],_0x58445b[_0xd555('0x4b')]));fs[_0xd555('0x7b')](_0x406276);fs['unlinkSync'](_0x4186bd);return _0x58445b;})[_0xd555('0x24')](function(_0x106e52){if(_0x106e52){return _0x3d5e0b[_0xd555('0x1e')](0xcc)[_0xd555('0x29')]();}})[_0xd555('0x24')](handleEntityNotFound(_0x3d5e0b,null))['catch'](handleError(_0x3d5e0b,null));}; \ No newline at end of file +var _0x6a4d=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','Sounds','UserProfileResource','sendStatus','error','stack','name','index','Sound','rawAttributes','fieldName','key','model','map','query','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filters','filter','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','length','merge','save_name','converted_format','existsSync','join','root','Sequelize','download','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','chmodSync','body','role','userProfileId','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','pick','description','delete','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs'];(function(_0x1aae69,_0x486daf){var _0xa5d933=function(_0x41873b){while(--_0x41873b){_0x1aae69['push'](_0x1aae69['shift']());}};_0xa5d933(++_0x486daf);}(_0x6a4d,0x75));var _0xd6a4=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x6a4d[_0x58afd5];return _0x3e503b;};'use strict';var emlformat=require(_0xd6a4('0x0'));var rimraf=require(_0xd6a4('0x1'));var zipdir=require(_0xd6a4('0x2'));var jsonpatch=require(_0xd6a4('0x3'));var rp=require(_0xd6a4('0x4'));var moment=require(_0xd6a4('0x5'));var BPromise=require(_0xd6a4('0x6'));var Mustache=require('mustache');var util=require(_0xd6a4('0x7'));var path=require('path');var sox=require(_0xd6a4('0x8'));var csv=require(_0xd6a4('0x9'));var ejs=require(_0xd6a4('0xa'));var fs=require('fs');var fs_extra=require(_0xd6a4('0xb'));var _=require(_0xd6a4('0xc'));var squel=require(_0xd6a4('0xd'));var crypto=require(_0xd6a4('0xe'));var jsforce=require(_0xd6a4('0xf'));var deskjs=require(_0xd6a4('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd6a4('0x11'));var Papa=require(_0xd6a4('0x12'));var Redis=require('ioredis');var authService=require(_0xd6a4('0x13'));var qs=require(_0xd6a4('0x14'));var as=require(_0xd6a4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd6a4('0x16'))('api');var utils=require(_0xd6a4('0x17'));var config=require(_0xd6a4('0x18'));var licenseUtil=require(_0xd6a4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e320f,_0xe61d87){_0xe61d87=_0xe61d87||0xcc;return function(_0x376ca5){if(_0x376ca5){return _0x5e320f['sendStatus'](_0xe61d87);}return _0x5e320f[_0xd6a4('0x1a')](_0xe61d87)[_0xd6a4('0x1b')]();};}function respondWithResult(_0x543ea5,_0x578c06){_0x578c06=_0x578c06||0xc8;return function(_0x51c366){if(_0x51c366){return _0x543ea5['status'](_0x578c06)['json'](_0x51c366);}};}function respondWithFilteredResult(_0x47cf6d,_0x2986e4){return function(_0x25fe30){if(_0x25fe30){var _0x917fd5=typeof _0x2986e4['offset']===_0xd6a4('0x1c')&&typeof _0x2986e4['limit']===_0xd6a4('0x1c');var _0x193055=_0x25fe30[_0xd6a4('0x1d')];var _0x5bd7ae=_0x917fd5?0x0:_0x2986e4['offset'];var _0x62b080=_0x917fd5?_0x25fe30[_0xd6a4('0x1d')]:_0x2986e4['offset']+_0x2986e4[_0xd6a4('0x1e')];var _0x150bb6;if(_0x62b080>=_0x193055){_0x62b080=_0x193055;_0x150bb6=0xc8;}else{_0x150bb6=0xce;}_0x47cf6d['status'](_0x150bb6);return _0x47cf6d[_0xd6a4('0x1f')](_0xd6a4('0x20'),_0x5bd7ae+'-'+_0x62b080+'/'+_0x193055)[_0xd6a4('0x21')](_0x25fe30);}return null;};}function patchUpdates(_0x3704e7){return function(_0x37448a){try{jsonpatch[_0xd6a4('0x22')](_0x37448a,_0x3704e7,!![]);}catch(_0x2852ec){return BPromise[_0xd6a4('0x23')](_0x2852ec);}return _0x37448a['save']();};}function saveUpdates(_0x12f9de,_0x1085aa){return function(_0x3f430f){if(_0x3f430f){return _0x3f430f[_0xd6a4('0x24')](_0x12f9de)[_0xd6a4('0x25')](function(_0x164eb2){return _0x164eb2;});}return null;};}function removeEntity(_0x57af91,_0x2a97a6){return function(_0x5bc75f){if(_0x5bc75f){return _0x5bc75f[_0xd6a4('0x26')]()[_0xd6a4('0x25')](function(){var _0x5e7c3d=_0x5bc75f[_0xd6a4('0x27')]({'plain':!![]});var _0x2dc9d3=_0xd6a4('0x28');return db[_0xd6a4('0x29')][_0xd6a4('0x26')]({'where':{'type':_0x2dc9d3,'resourceId':_0x5e7c3d['id']}})[_0xd6a4('0x25')](function(){return _0x5bc75f;});})[_0xd6a4('0x25')](function(){_0x57af91[_0xd6a4('0x1a')](0xcc)[_0xd6a4('0x1b')]();});}};}function handleEntityNotFound(_0x36edb9,_0x48a56d){return function(_0x2747be){if(!_0x2747be){_0x36edb9[_0xd6a4('0x2a')](0x194);}return _0x2747be;};}function handleError(_0x37ac35,_0xe17c9d){_0xe17c9d=_0xe17c9d||0x1f4;return function(_0x3003ec){logger[_0xd6a4('0x2b')](_0x3003ec[_0xd6a4('0x2c')]);if(_0x3003ec['name']){delete _0x3003ec[_0xd6a4('0x2d')];}_0x37ac35[_0xd6a4('0x1a')](_0xe17c9d)['send'](_0x3003ec);};}exports[_0xd6a4('0x2e')]=function(_0x42dfe2,_0x1ba470){var _0x5cfac5={},_0x44cac6={},_0x4432c4={'count':0x0,'rows':[]};var _0x56c976=_['map'](db[_0xd6a4('0x2f')][_0xd6a4('0x30')],function(_0x8dfafa){return{'name':_0x8dfafa[_0xd6a4('0x31')],'type':_0x8dfafa['type'][_0xd6a4('0x32')]};});_0x44cac6[_0xd6a4('0x33')]=_[_0xd6a4('0x34')](_0x56c976,_0xd6a4('0x2d'));_0x44cac6[_0xd6a4('0x35')]=_['keys'](_0x42dfe2[_0xd6a4('0x35')]);_0x44cac6['filters']=_[_0xd6a4('0x36')](_0x44cac6[_0xd6a4('0x33')],_0x44cac6[_0xd6a4('0x35')]);_0x5cfac5['attributes']=_[_0xd6a4('0x36')](_0x44cac6['model'],qs['fields'](_0x42dfe2[_0xd6a4('0x35')][_0xd6a4('0x37')]));_0x5cfac5[_0xd6a4('0x38')]=_0x5cfac5[_0xd6a4('0x38')]['length']?_0x5cfac5[_0xd6a4('0x38')]:_0x44cac6[_0xd6a4('0x33')];if(!_0x42dfe2['query'][_0xd6a4('0x39')](_0xd6a4('0x3a'))){_0x5cfac5['limit']=qs[_0xd6a4('0x1e')](_0x42dfe2[_0xd6a4('0x35')][_0xd6a4('0x1e')]);_0x5cfac5[_0xd6a4('0x3b')]=qs[_0xd6a4('0x3b')](_0x42dfe2[_0xd6a4('0x35')][_0xd6a4('0x3b')]);}_0x5cfac5[_0xd6a4('0x3c')]=qs['sort'](_0x42dfe2[_0xd6a4('0x35')][_0xd6a4('0x3d')]);_0x5cfac5[_0xd6a4('0x3e')]=qs[_0xd6a4('0x3f')](_['pick'](_0x42dfe2[_0xd6a4('0x35')],_0x44cac6[_0xd6a4('0x3f')]),_0x56c976);if(_0x42dfe2['query'][_0xd6a4('0x40')]){_0x5cfac5[_0xd6a4('0x3e')]=_['merge'](_0x5cfac5[_0xd6a4('0x3e')],{'$or':_[_0xd6a4('0x34')](_0x56c976,function(_0x32e109){if(_0x32e109[_0xd6a4('0x41')]!==_0xd6a4('0x42')){var _0x343bc3={};_0x343bc3[_0x32e109[_0xd6a4('0x2d')]]={'$like':'%'+_0x42dfe2['query'][_0xd6a4('0x40')]+'%'};return _0x343bc3;}})});}_0x5cfac5=_['merge']({},_0x5cfac5,_0x42dfe2[_0xd6a4('0x43')]);var _0x510f0c={'where':_0x5cfac5[_0xd6a4('0x3e')]};return db[_0xd6a4('0x2f')][_0xd6a4('0x1d')](_0x510f0c)[_0xd6a4('0x25')](function(_0x481f26){_0x4432c4[_0xd6a4('0x1d')]=_0x481f26;if(_0x42dfe2['query'][_0xd6a4('0x44')]){_0x5cfac5[_0xd6a4('0x45')]=[{'all':!![]}];}return db[_0xd6a4('0x2f')][_0xd6a4('0x46')](_0x5cfac5);})[_0xd6a4('0x25')](function(_0x5ee853){_0x4432c4['rows']=_0x5ee853;return _0x4432c4;})[_0xd6a4('0x25')](respondWithFilteredResult(_0x1ba470,_0x5cfac5))[_0xd6a4('0x47')](handleError(_0x1ba470,null));};exports[_0xd6a4('0x48')]=function(_0x2523a2,_0x198397){var _0x4ce9ed={'raw':!![],'where':{'id':_0x2523a2[_0xd6a4('0x49')]['id']}},_0x5ce7db={};_0x5ce7db[_0xd6a4('0x33')]=_[_0xd6a4('0x4a')](db[_0xd6a4('0x2f')][_0xd6a4('0x30')]);_0x5ce7db[_0xd6a4('0x35')]=_['keys'](_0x2523a2[_0xd6a4('0x35')]);_0x5ce7db[_0xd6a4('0x3f')]=_['intersection'](_0x5ce7db[_0xd6a4('0x33')],_0x5ce7db[_0xd6a4('0x35')]);_0x4ce9ed[_0xd6a4('0x38')]=_[_0xd6a4('0x36')](_0x5ce7db['model'],qs[_0xd6a4('0x37')](_0x2523a2['query'][_0xd6a4('0x37')]));_0x4ce9ed[_0xd6a4('0x38')]=_0x4ce9ed['attributes'][_0xd6a4('0x4b')]?_0x4ce9ed[_0xd6a4('0x38')]:_0x5ce7db['model'];if(_0x2523a2[_0xd6a4('0x35')]['includeAll']){_0x4ce9ed[_0xd6a4('0x45')]=[{'all':!![]}];}_0x4ce9ed=_[_0xd6a4('0x4c')]({},_0x4ce9ed,_0x2523a2[_0xd6a4('0x43')]);return db[_0xd6a4('0x2f')]['find'](_0x4ce9ed)[_0xd6a4('0x25')](handleEntityNotFound(_0x198397,null))[_0xd6a4('0x25')](respondWithResult(_0x198397,null))[_0xd6a4('0x47')](handleError(_0x198397,null));};exports['download']=function(_0x25121a,_0x4deeeb,_0x421944){return db[_0xd6a4('0x2f')]['find']({'where':{'id':_0x25121a[_0xd6a4('0x49')]['id']},'attributes':[_0xd6a4('0x2d'),_0xd6a4('0x4d'),_0xd6a4('0x4e')],'raw':!![]})[_0xd6a4('0x25')](handleEntityNotFound(_0x4deeeb,null))['then'](function(_0x39155c){if(_0x39155c){if(!fs[_0xd6a4('0x4f')](path[_0xd6a4('0x50')](config[_0xd6a4('0x51')],'server/files/sounds/converted',_0x39155c[_0xd6a4('0x4d')]+'.'+_0x39155c[_0xd6a4('0x4e')]))){throw new db[(_0xd6a4('0x52'))]['ValidationError']('Sound\x20not\x20found');}return _0x4deeeb[_0xd6a4('0x53')](path[_0xd6a4('0x50')](config['root'],_0xd6a4('0x54'),util[_0xd6a4('0x55')](_0xd6a4('0x56'),_0x39155c[_0xd6a4('0x4d')],_0x39155c['converted_format'])),util['format']('%s.%s',_0x39155c['name'],_0x39155c['converted_format']));}return null;})['catch'](handleError(_0x4deeeb,null));};exports[_0xd6a4('0x57')]=function(_0x197d90,_0x23816b,_0x3518ff){var _0x2addc6={'name':path[_0xd6a4('0x58')](_0x197d90[_0xd6a4('0x59')][_0xd6a4('0x5a')],path[_0xd6a4('0x5b')](_0x197d90['file'][_0xd6a4('0x5a')])),'save_name':path['basename'](_0x197d90[_0xd6a4('0x59')][_0xd6a4('0x5c')],path[_0xd6a4('0x5b')](_0x197d90[_0xd6a4('0x59')][_0xd6a4('0x5c')])),'original_format':path[_0xd6a4('0x5b')](_0x197d90['file'][_0xd6a4('0x5a')])[_0xd6a4('0x5d')](0x1),'converted_format':_0xd6a4('0x5e')};var _0x50b655=path[_0xd6a4('0x50')](config[_0xd6a4('0x51')],'server/files/sounds/original',_0x197d90[_0xd6a4('0x59')][_0xd6a4('0x5c')]);var _0x1d68e3=path[_0xd6a4('0x50')](config['root'],'server/files/sounds/converted',util[_0xd6a4('0x55')](_0xd6a4('0x56'),path[_0xd6a4('0x58')](_0x197d90[_0xd6a4('0x59')][_0xd6a4('0x5c')],path[_0xd6a4('0x5b')](_0x197d90[_0xd6a4('0x59')][_0xd6a4('0x5c')])),_0x2addc6['converted_format']));logger[_0xd6a4('0x5f')](_0xd6a4('0x60'),_0x50b655);logger[_0xd6a4('0x5f')](_0xd6a4('0x61'),_0x1d68e3);try{fs['chmodSync'](_0x50b655,parseInt(_0xd6a4('0x62'),0x8));var _0x228369=sox[_0xd6a4('0x63')](_0x50b655,_0x1d68e3,{'sampleRate':0x1f40,'format':_0xd6a4('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x228369['on']('error',function(_0x1e0a4a){fs[_0xd6a4('0x64')](_0x50b655);_0x23816b[_0xd6a4('0x1a')](0x1f4)[_0xd6a4('0x65')](_0x1e0a4a);});_0x228369['on'](_0xd6a4('0x66'),function(_0x215921){_0x2addc6[_0xd6a4('0x67')]=isNaN(_0x215921['duration'])?null:_0x215921[_0xd6a4('0x68')]*0x3e8;_0x2addc6[_0xd6a4('0x69')]=isNaN(_0x215921['sampleCount'])?null:_0x215921[_0xd6a4('0x6a')];_0x2addc6[_0xd6a4('0x6b')]=isNaN(_0x215921[_0xd6a4('0x6c')])?null:_0x215921['channelCount'];_0x2addc6[_0xd6a4('0x6d')]=isNaN(_0x215921[_0xd6a4('0x6e')])?null:_0x215921[_0xd6a4('0x6e')];_0x2addc6['original_sampleRate']=isNaN(_0x215921[_0xd6a4('0x6f')])?null:_0x215921['sampleRate'];});_0x228369['on'](_0xd6a4('0x70'),function(_0x3a4f9a){_0x2addc6[_0xd6a4('0x71')]=isNaN(_0x3a4f9a[_0xd6a4('0x68')])?null:_0x3a4f9a[_0xd6a4('0x68')]*0x3e8;_0x2addc6[_0xd6a4('0x72')]=isNaN(_0x3a4f9a[_0xd6a4('0x6a')])?null:_0x3a4f9a[_0xd6a4('0x6a')];_0x2addc6[_0xd6a4('0x73')]=isNaN(_0x3a4f9a[_0xd6a4('0x6c')])?null:_0x3a4f9a['channelCount'];_0x2addc6[_0xd6a4('0x74')]=isNaN(_0x3a4f9a[_0xd6a4('0x6e')])?null:_0x3a4f9a[_0xd6a4('0x6e')];_0x2addc6['converted_sampleRate']=isNaN(_0x3a4f9a['sampleRate'])?null:_0x3a4f9a[_0xd6a4('0x6f')];});_0x228369['on'](_0xd6a4('0x1b'),function(){fs[_0xd6a4('0x75')](_0x1d68e3,parseInt('0777',0x8));return db[_0xd6a4('0x2f')]['create'](_0x2addc6)[_0xd6a4('0x25')](function(_0x1960f6){var _0x974d8={'role':_0x197d90[_0xd6a4('0x76')][_0xd6a4('0x77')],'userProfileId':_0x197d90[_0xd6a4('0x76')][_0xd6a4('0x78')]};if(!_0x974d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x974d8[_0xd6a4('0x77')]===_0xd6a4('0x79')){var _0x202bfa=_0x1960f6[_0xd6a4('0x27')]({'plain':!![]});return db[_0xd6a4('0x7a')]['find']({'where':{'name':_0xd6a4('0x28'),'userProfileId':_0x974d8[_0xd6a4('0x78')]},'raw':!![]})[_0xd6a4('0x25')](function(_0x3ec0b4){if(_0x3ec0b4&&_0x3ec0b4['autoAssociation']===0x0){return db[_0xd6a4('0x29')][_0xd6a4('0x57')]({'name':_0x202bfa['name'],'resourceId':_0x202bfa['id'],'type':_0x3ec0b4[_0xd6a4('0x2d')],'sectionId':_0x3ec0b4['id']},{})['then'](function(){return _0x1960f6;});}else{return _0x1960f6;}})[_0xd6a4('0x47')](function(_0x283e9e){logger[_0xd6a4('0x2b')](_0xd6a4('0x7b'),_0x283e9e);throw _0x283e9e;});}return _0x1960f6;})[_0xd6a4('0x25')](respondWithResult(_0x23816b,null))[_0xd6a4('0x47')](handleError(_0x23816b,null));});_0x228369['start']();}catch(_0x476bae){_0x23816b[_0xd6a4('0x1a')](0x1f4)['send'](_0x476bae);}};exports[_0xd6a4('0x24')]=function(_0x150bf6,_0x5e13da,_0x2266d2){return db[_0xd6a4('0x2f')][_0xd6a4('0x7c')]({'where':{'id':_0x150bf6[_0xd6a4('0x49')]['id']}})[_0xd6a4('0x25')](handleEntityNotFound(_0x5e13da,null))[_0xd6a4('0x25')](saveUpdates(_[_0xd6a4('0x7d')](_0x150bf6[_0xd6a4('0x76')],[_0xd6a4('0x2d'),_0xd6a4('0x7e')]),null))[_0xd6a4('0x25')](respondWithResult(_0x5e13da,null))[_0xd6a4('0x47')](handleError(_0x5e13da,null));};exports[_0xd6a4('0x7f')]=function(_0x435123,_0x40694d,_0x21a4d6){return db[_0xd6a4('0x2f')][_0xd6a4('0x7c')]({'where':{'id':_0x435123[_0xd6a4('0x49')]['id']}})[_0xd6a4('0x25')](function(_0xefebfb){if(_0xefebfb){return _0xefebfb[_0xd6a4('0x26')]();}})[_0xd6a4('0x25')](function(_0x3156ea){var _0xc90999=path['join'](config['root'],'server/files/sounds/original',util[_0xd6a4('0x55')](_0xd6a4('0x56'),_0x3156ea[_0xd6a4('0x4d')],_0x3156ea['original_format']));var _0x320da0=path[_0xd6a4('0x50')](config['root'],_0xd6a4('0x54'),util['format'](_0xd6a4('0x56'),_0x3156ea['save_name'],_0x3156ea['converted_format']));fs[_0xd6a4('0x64')](_0xc90999);fs[_0xd6a4('0x64')](_0x320da0);return _0x3156ea;})['then'](function(_0x375161){if(_0x375161){return _0x40694d['status'](0xcc)[_0xd6a4('0x1b')]();}})[_0xd6a4('0x25')](handleEntityNotFound(_0x40694d,null))[_0xd6a4('0x47')](handleError(_0x40694d,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 6993e75..ca5e4f4 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 _0x68ef=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','define','Sound'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68ef,0xf0));var _0xf68e=function(_0x4f0049,_0xf8e3fa){_0x4f0049=_0x4f0049-0x0;var _0x2a60f7=_0x68ef[_0x4f0049];return _0x2a60f7;};'use strict';var _=require(_0xf68e('0x0'));var util=require(_0xf68e('0x1'));var logger=require(_0xf68e('0x2'))(_0xf68e('0x3'));var moment=require(_0xf68e('0x4'));var BPromise=require('bluebird');var rp=require(_0xf68e('0x5'));var fs=require('fs');var path=require(_0xf68e('0x6'));var rimraf=require(_0xf68e('0x7'));var config=require(_0xf68e('0x8'));var attributes=require(_0xf68e('0x9'));module['exports']=function(_0x1b4938,_0x3f2b49){return _0x1b4938[_0xf68e('0xa')](_0xf68e('0xb'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30c8=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','tools_sounds','lodash'];(function(_0x1d6c11,_0x2dbdc1){var _0x1b99ba=function(_0xdafd8){while(--_0xdafd8){_0x1d6c11['push'](_0x1d6c11['shift']());}};_0x1b99ba(++_0x2dbdc1);}(_0x30c8,0xa8));var _0x830c=function(_0xfcc1e7,_0x142df9){_0xfcc1e7=_0xfcc1e7-0x0;var _0x59f9fd=_0x30c8[_0xfcc1e7];return _0x59f9fd;};'use strict';var _=require(_0x830c('0x0'));var util=require(_0x830c('0x1'));var logger=require(_0x830c('0x2'))(_0x830c('0x3'));var moment=require(_0x830c('0x4'));var BPromise=require(_0x830c('0x5'));var rp=require(_0x830c('0x6'));var fs=require('fs');var path=require(_0x830c('0x7'));var rimraf=require(_0x830c('0x8'));var config=require(_0x830c('0x9'));var attributes=require('./sound.attributes');module[_0x830c('0xa')]=function(_0x26aa56,_0x1dc825){return _0x26aa56[_0x830c('0xb')]('Sound',attributes,{'tableName':_0x830c('0xc'),'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 1b94ffd..6a7a19e 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 _0xda34=['attributes','include','model','map','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','error','code','message','catch','ShowSound','find','options','where'];(function(_0x3f6fca,_0x326591){var _0x125eb4=function(_0x40f459){while(--_0x40f459){_0x3f6fca['push'](_0x3f6fca['shift']());}};_0x125eb4(++_0x326591);}(_0xda34,0x1a5));var _0x4da3=function(_0x103575,_0x1609cd){_0x103575=_0x103575-0x0;var _0x9ccab8=_0xda34[_0x103575];return _0x9ccab8;};'use strict';var _=require('lodash');var util=require(_0x4da3('0x0'));var moment=require(_0x4da3('0x1'));var BPromise=require(_0x4da3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4da3('0x3'));var db=require(_0x4da3('0x4'))['db'];var utils=require(_0x4da3('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4da3('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4da3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xd4c30f,_0x1dc691,_0x241a41){return new BPromise(function(_0x61de82,_0x32a8d8){return client[_0x4da3('0x8')](_0xd4c30f,_0x241a41)[_0x4da3('0x9')](function(_0x40d045){logger[_0x4da3('0xa')](_0x4da3('0xb'),_0x1dc691,_0x4da3('0xc'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x1dc691,_0x4da3('0xc'),JSON['stringify'](_0x40d045));if(_0x40d045[_0x4da3('0xd')]){if(_0x40d045['error'][_0x4da3('0xe')]===0x1f4){logger[_0x4da3('0xd')](_0x4da3('0xb'),_0x1dc691,_0x40d045[_0x4da3('0xd')]['message']);return _0x32a8d8(_0x40d045[_0x4da3('0xd')][_0x4da3('0xf')]);}logger[_0x4da3('0xd')](_0x4da3('0xb'),_0x1dc691,_0x40d045['error'][_0x4da3('0xf')]);return _0x61de82(_0x40d045[_0x4da3('0xd')][_0x4da3('0xf')]);}else{logger['info'](_0x4da3('0xb'),_0x1dc691,_0x4da3('0xc'));_0x61de82(_0x40d045['result'][_0x4da3('0xf')]);}})[_0x4da3('0x10')](function(_0x36b556){logger['error']('Sound,\x20%s,\x20%s',_0x1dc691,_0x36b556);_0x32a8d8(_0x36b556);});});}exports[_0x4da3('0x11')]=function(_0x5de418){var _0x51fbae=this;return new Promise(function(_0x2a44f4,_0x1c00aa){return db['Sound'][_0x4da3('0x12')]({'raw':_0x5de418[_0x4da3('0x13')]?_0x5de418['options']['raw']===undefined?!![]:![]:!![],'where':_0x5de418[_0x4da3('0x13')]?_0x5de418[_0x4da3('0x13')][_0x4da3('0x14')]||null:null,'attributes':_0x5de418[_0x4da3('0x13')]?_0x5de418[_0x4da3('0x13')][_0x4da3('0x15')]||null:null,'include':_0x5de418[_0x4da3('0x13')]?_0x5de418[_0x4da3('0x13')]['include']?_['map'](_0x5de418[_0x4da3('0x13')][_0x4da3('0x16')],function(_0x21a1f4){return{'model':db[_0x21a1f4[_0x4da3('0x17')]],'as':_0x21a1f4['as'],'attributes':_0x21a1f4[_0x4da3('0x15')],'include':_0x21a1f4[_0x4da3('0x16')]?_[_0x4da3('0x18')](_0x21a1f4['include'],function(_0x42b9eb){return{'model':db[_0x42b9eb[_0x4da3('0x17')]],'as':_0x42b9eb['as'],'attributes':_0x42b9eb[_0x4da3('0x15')],'include':_0x42b9eb[_0x4da3('0x16')]?_[_0x4da3('0x18')](_0x42b9eb['include'],function(_0xd48e62){return{'model':db[_0xd48e62[_0x4da3('0x17')]],'as':_0xd48e62['as'],'attributes':_0xd48e62[_0x4da3('0x15')]};}):[]};}):[]};}):[]:[]})[_0x4da3('0x9')](function(_0x101522){logger[_0x4da3('0xa')]('ShowSound',_0x5de418);logger[_0x4da3('0x19')](_0x4da3('0x11'),_0x5de418,JSON['stringify'](_0x101522));_0x2a44f4(_0x101522);})[_0x4da3('0x10')](function(_0x2b519f){logger[_0x4da3('0xd')]('ShowSound',_0x2b519f[_0x4da3('0xf')],_0x5de418);_0x1c00aa(_0x51fbae[_0x4da3('0xd')](0x1f4,_0x2b519f[_0x4da3('0xf')]));});});}; \ No newline at end of file +var _0x534b=['../../config/utils','../../config/environment','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Sound','find','options','raw','where','attributes','include','model','map','ShowSound','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x534b,0xeb));var _0xb534=function(_0x4dc3fa,_0x1c9987){_0x4dc3fa=_0x4dc3fa-0x0;var _0x449e89=_0x534b[_0x4dc3fa];return _0x449e89;};'use strict';var _=require(_0xb534('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb534('0x1'));var rs=require(_0xb534('0x2'));var fs=require('fs');var Redis=require(_0xb534('0x3'));var db=require(_0xb534('0x4'))['db'];var utils=require(_0xb534('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb534('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb534('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26b9a4,_0x40a75e,_0x43afda){return new BPromise(function(_0x16222f,_0x220235){return client[_0xb534('0x8')](_0x26b9a4,_0x43afda)[_0xb534('0x9')](function(_0x4f86f9){logger[_0xb534('0xa')](_0xb534('0xb'),_0x40a75e,_0xb534('0xc'));logger[_0xb534('0xd')](_0xb534('0xe'),_0x40a75e,_0xb534('0xc'),JSON[_0xb534('0xf')](_0x4f86f9));if(_0x4f86f9[_0xb534('0x10')]){if(_0x4f86f9[_0xb534('0x10')][_0xb534('0x11')]===0x1f4){logger[_0xb534('0x10')]('Sound,\x20%s,\x20%s',_0x40a75e,_0x4f86f9[_0xb534('0x10')][_0xb534('0x12')]);return _0x220235(_0x4f86f9[_0xb534('0x10')][_0xb534('0x12')]);}logger[_0xb534('0x10')](_0xb534('0xb'),_0x40a75e,_0x4f86f9['error'][_0xb534('0x12')]);return _0x16222f(_0x4f86f9['error'][_0xb534('0x12')]);}else{logger[_0xb534('0xa')](_0xb534('0xb'),_0x40a75e,_0xb534('0xc'));_0x16222f(_0x4f86f9['result']['message']);}})[_0xb534('0x13')](function(_0xa892e9){logger['error'](_0xb534('0xb'),_0x40a75e,_0xa892e9);_0x220235(_0xa892e9);});});}exports['ShowSound']=function(_0x12f276){var _0x123f66=this;return new Promise(function(_0x28353e,_0x5c2134){return db[_0xb534('0x14')][_0xb534('0x15')]({'raw':_0x12f276[_0xb534('0x16')]?_0x12f276['options'][_0xb534('0x17')]===undefined?!![]:![]:!![],'where':_0x12f276[_0xb534('0x16')]?_0x12f276[_0xb534('0x16')][_0xb534('0x18')]||null:null,'attributes':_0x12f276[_0xb534('0x16')]?_0x12f276[_0xb534('0x16')][_0xb534('0x19')]||null:null,'include':_0x12f276['options']?_0x12f276[_0xb534('0x16')][_0xb534('0x1a')]?_['map'](_0x12f276[_0xb534('0x16')][_0xb534('0x1a')],function(_0x18d021){return{'model':db[_0x18d021[_0xb534('0x1b')]],'as':_0x18d021['as'],'attributes':_0x18d021[_0xb534('0x19')],'include':_0x18d021[_0xb534('0x1a')]?_['map'](_0x18d021['include'],function(_0x2ab529){return{'model':db[_0x2ab529[_0xb534('0x1b')]],'as':_0x2ab529['as'],'attributes':_0x2ab529[_0xb534('0x19')],'include':_0x2ab529[_0xb534('0x1a')]?_[_0xb534('0x1c')](_0x2ab529[_0xb534('0x1a')],function(_0x5bba82){return{'model':db[_0x5bba82[_0xb534('0x1b')]],'as':_0x5bba82['as'],'attributes':_0x5bba82[_0xb534('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb534('0x9')](function(_0x49fc09){logger[_0xb534('0xa')](_0xb534('0x1d'),_0x12f276);logger[_0xb534('0xd')](_0xb534('0x1d'),_0x12f276,JSON['stringify'](_0x49fc09));_0x28353e(_0x49fc09);})[_0xb534('0x13')](function(_0x1038c3){logger['error'](_0xb534('0x1d'),_0x1038c3['message'],_0x12f276);_0x5c2134(_0x123f66[_0xb534('0x10')](0x1f4,_0x1038c3[_0xb534('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 45e7656..7029e24 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 _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x2a67cb,_0x359895){var _0x3e7c03=function(_0x4bf0da){while(--_0x4bf0da){_0x2a67cb['push'](_0x2a67cb['shift']());}};_0x3e7c03(++_0x359895);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5ac4b6,_0x4d9360){_0x5ac4b6=_0x5ac4b6-0x0;var _0x29ced8=_0x5eb8[_0x5ac4b6];return _0x29ced8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file +var _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0xb3eb73,_0x49d849){var _0xca1a5a=function(_0x5050ed){while(--_0x5050ed){_0xb3eb73['push'](_0xb3eb73['shift']());}};_0xca1a5a(++_0x49d849);}(_0xda2d,0x102));var _0xdda2=function(_0x4b8187,_0x310c4a){_0x4b8187=_0x4b8187-0x0;var _0x35aa14=_0xda2d[_0x4b8187];return _0x35aa14;};'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 fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 51d141f..22eadc7 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 _0xc1f5=['medium','ENUM','out','STRING','TEXT','exports'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xc1f5,0xb9));var _0x5c1f=function(_0x43aa88,_0x395450){_0x43aa88=_0x43aa88-0x0;var _0x1c9451=_0xc1f5[_0x43aa88];return _0x1c9451;};'use strict';var Sequelize=require('sequelize');module[_0x5c1f('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0x5c1f('0x1')),'allowNull':![]},'direction':{'type':Sequelize[_0x5c1f('0x2')]('in',_0x5c1f('0x3')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x5c1f('0x4')]},'providerResponse':{'type':Sequelize[_0x5c1f('0x5')]}}; \ No newline at end of file +var _0x58f0=['medium','ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0x3e5dc6,_0x52e9a7){var _0x4edf3e=function(_0x2b6d95){while(--_0x2b6d95){_0x3e5dc6['push'](_0x3e5dc6['shift']());}};_0x4edf3e(++_0x52e9a7);}(_0x58f0,0xb2));var _0x058f=function(_0x52e30c,_0x5f321c){_0x52e30c=_0x52e30c-0x0;var _0x1cde07=_0x58f0[_0x52e30c];return _0x1cde07;};'use strict';var Sequelize=require(_0x058f('0x0'));module[_0x058f('0x1')]={'uniqueid':{'type':Sequelize[_0x058f('0x2')]},'body':{'type':Sequelize[_0x058f('0x3')](_0x058f('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x058f('0x5')]('in',_0x058f('0x6')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x058f('0x2')]},'providerResponse':{'type':Sequelize[_0x058f('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 96c37ad..505542e 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 _0x0bd5=['pick','filter','merge','options','SquareMessage','count','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','set','Content-Range','save','destroy','then','end','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','filters','query','attributes','intersection','length','hasOwnProperty','nolimit','sort','where'];(function(_0x41fe65,_0x10e99d){var _0x2c55cd=function(_0x1d6a7a){while(--_0x1d6a7a){_0x41fe65['push'](_0x41fe65['shift']());}};_0x2c55cd(++_0x10e99d);}(_0x0bd5,0x189));var _0x50bd=function(_0x3020e7,_0x38d531){_0x3020e7=_0x3020e7-0x0;var _0x86dad0=_0x0bd5[_0x3020e7];return _0x86dad0;};'use strict';var emlformat=require(_0x50bd('0x0'));var rimraf=require(_0x50bd('0x1'));var zipdir=require(_0x50bd('0x2'));var jsonpatch=require(_0x50bd('0x3'));var rp=require(_0x50bd('0x4'));var moment=require(_0x50bd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x50bd('0x6'));var util=require(_0x50bd('0x7'));var path=require(_0x50bd('0x8'));var sox=require(_0x50bd('0x9'));var csv=require(_0x50bd('0xa'));var ejs=require(_0x50bd('0xb'));var fs=require('fs');var fs_extra=require(_0x50bd('0xc'));var _=require(_0x50bd('0xd'));var squel=require(_0x50bd('0xe'));var crypto=require(_0x50bd('0xf'));var jsforce=require(_0x50bd('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bd('0x11'));var Papa=require(_0x50bd('0x12'));var Redis=require('ioredis');var authService=require(_0x50bd('0x13'));var qs=require(_0x50bd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x50bd('0x15'));var logger=require('../../config/logger')(_0x50bd('0x16'));var utils=require(_0x50bd('0x17'));var config=require(_0x50bd('0x18'));var licenseUtil=require(_0x50bd('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ea8f3,_0x1c9867){_0x1c9867=_0x1c9867||0xcc;return function(_0x170450){if(_0x170450){return _0x4ea8f3['sendStatus'](_0x1c9867);}return _0x4ea8f3[_0x50bd('0x1a')](_0x1c9867)['end']();};}function respondWithResult(_0x7abc93,_0x105105){_0x105105=_0x105105||0xc8;return function(_0x309da3){if(_0x309da3){return _0x7abc93[_0x50bd('0x1a')](_0x105105)[_0x50bd('0x1b')](_0x309da3);}};}function respondWithFilteredResult(_0x4a2af7,_0x215948){return function(_0x139278){if(_0x139278){var _0x187619=typeof _0x215948[_0x50bd('0x1c')]===_0x50bd('0x1d')&&typeof _0x215948[_0x50bd('0x1e')]===_0x50bd('0x1d');var _0x15f29d=_0x139278['count'];var _0xdb3da0=_0x187619?0x0:_0x215948[_0x50bd('0x1c')];var _0x2b73bf=_0x187619?_0x139278['count']:_0x215948['offset']+_0x215948['limit'];var _0x291427;if(_0x2b73bf>=_0x15f29d){_0x2b73bf=_0x15f29d;_0x291427=0xc8;}else{_0x291427=0xce;}_0x4a2af7['status'](_0x291427);return _0x4a2af7[_0x50bd('0x1f')](_0x50bd('0x20'),_0xdb3da0+'-'+_0x2b73bf+'/'+_0x15f29d)[_0x50bd('0x1b')](_0x139278);}return null;};}function patchUpdates(_0x3a4222){return function(_0x42f80d){try{jsonpatch['apply'](_0x42f80d,_0x3a4222,!![]);}catch(_0x47d379){return BPromise['reject'](_0x47d379);}return _0x42f80d[_0x50bd('0x21')]();};}function saveUpdates(_0x5727de,_0x46163e){return function(_0x240540){if(_0x240540){return _0x240540['update'](_0x5727de)['then'](function(_0x40c7eb){return _0x40c7eb;});}return null;};}function removeEntity(_0x31026b,_0x4f6987){return function(_0x25facd){if(_0x25facd){return _0x25facd[_0x50bd('0x22')]()[_0x50bd('0x23')](function(){_0x31026b[_0x50bd('0x1a')](0xcc)[_0x50bd('0x24')]();});}};}function handleEntityNotFound(_0x363e9e,_0x34d2ba){return function(_0x38d3b0){if(!_0x38d3b0){_0x363e9e['sendStatus'](0x194);}return _0x38d3b0;};}function handleError(_0xe930f7,_0x471e42){_0x471e42=_0x471e42||0x1f4;return function(_0x2fa81b){logger[_0x50bd('0x25')](_0x2fa81b[_0x50bd('0x26')]);if(_0x2fa81b[_0x50bd('0x27')]){delete _0x2fa81b['name'];}_0xe930f7[_0x50bd('0x1a')](_0x471e42)[_0x50bd('0x28')](_0x2fa81b);};}exports[_0x50bd('0x29')]=function(_0x5e50a1,_0x200b9b){var _0x2ed69b={},_0x3771ee={},_0x257d4e={'count':0x0,'rows':[]};var _0x272e3f=_[_0x50bd('0x2a')](db['SquareMessage'][_0x50bd('0x2b')],function(_0x56e35d){return{'name':_0x56e35d['fieldName'],'type':_0x56e35d[_0x50bd('0x2c')][_0x50bd('0x2d')]};});_0x3771ee[_0x50bd('0x2e')]=_['map'](_0x272e3f,_0x50bd('0x27'));_0x3771ee['query']=_[_0x50bd('0x2f')](_0x5e50a1['query']);_0x3771ee[_0x50bd('0x30')]=_['intersection'](_0x3771ee[_0x50bd('0x2e')],_0x3771ee[_0x50bd('0x31')]);_0x2ed69b[_0x50bd('0x32')]=_[_0x50bd('0x33')](_0x3771ee['model'],qs['fields'](_0x5e50a1[_0x50bd('0x31')]['fields']));_0x2ed69b['attributes']=_0x2ed69b[_0x50bd('0x32')][_0x50bd('0x34')]?_0x2ed69b[_0x50bd('0x32')]:_0x3771ee[_0x50bd('0x2e')];if(!_0x5e50a1[_0x50bd('0x31')][_0x50bd('0x35')](_0x50bd('0x36'))){_0x2ed69b[_0x50bd('0x1e')]=qs[_0x50bd('0x1e')](_0x5e50a1['query']['limit']);_0x2ed69b[_0x50bd('0x1c')]=qs[_0x50bd('0x1c')](_0x5e50a1[_0x50bd('0x31')][_0x50bd('0x1c')]);}_0x2ed69b['order']=qs[_0x50bd('0x37')](_0x5e50a1[_0x50bd('0x31')]['sort']);_0x2ed69b[_0x50bd('0x38')]=qs['filters'](_[_0x50bd('0x39')](_0x5e50a1[_0x50bd('0x31')],_0x3771ee[_0x50bd('0x30')]),_0x272e3f);if(_0x5e50a1['query'][_0x50bd('0x3a')]){_0x2ed69b[_0x50bd('0x38')]=_[_0x50bd('0x3b')](_0x2ed69b['where'],{'$or':_[_0x50bd('0x2a')](_0x272e3f,function(_0x2bfbe9){if(_0x2bfbe9[_0x50bd('0x2c')]!=='VIRTUAL'){var _0x22a875={};_0x22a875[_0x2bfbe9['name']]={'$like':'%'+_0x5e50a1['query'][_0x50bd('0x3a')]+'%'};return _0x22a875;}})});}_0x2ed69b=_[_0x50bd('0x3b')]({},_0x2ed69b,_0x5e50a1[_0x50bd('0x3c')]);var _0x413a8c={'where':_0x2ed69b[_0x50bd('0x38')]};return db[_0x50bd('0x3d')][_0x50bd('0x3e')](_0x413a8c)['then'](function(_0x3455f5){_0x257d4e[_0x50bd('0x3e')]=_0x3455f5;if(_0x5e50a1[_0x50bd('0x31')][_0x50bd('0x3f')]){_0x2ed69b['include']=[{'all':!![]}];}return db[_0x50bd('0x3d')][_0x50bd('0x40')](_0x2ed69b);})[_0x50bd('0x23')](function(_0x247603){_0x257d4e[_0x50bd('0x41')]=_0x247603;return _0x257d4e;})['then'](respondWithFilteredResult(_0x200b9b,_0x2ed69b))[_0x50bd('0x42')](handleError(_0x200b9b,null));};exports[_0x50bd('0x43')]=function(_0x1f5984,_0x385b21){var _0x12d32b={'raw':!![],'where':{'id':_0x1f5984[_0x50bd('0x44')]['id']}},_0x230e0e={};_0x230e0e['model']=_['keys'](db[_0x50bd('0x3d')][_0x50bd('0x2b')]);_0x230e0e['query']=_[_0x50bd('0x2f')](_0x1f5984[_0x50bd('0x31')]);_0x230e0e[_0x50bd('0x30')]=_[_0x50bd('0x33')](_0x230e0e[_0x50bd('0x2e')],_0x230e0e['query']);_0x12d32b[_0x50bd('0x32')]=_[_0x50bd('0x33')](_0x230e0e[_0x50bd('0x2e')],qs[_0x50bd('0x45')](_0x1f5984[_0x50bd('0x31')][_0x50bd('0x45')]));_0x12d32b['attributes']=_0x12d32b[_0x50bd('0x32')][_0x50bd('0x34')]?_0x12d32b[_0x50bd('0x32')]:_0x230e0e[_0x50bd('0x2e')];if(_0x1f5984[_0x50bd('0x31')][_0x50bd('0x3f')]){_0x12d32b[_0x50bd('0x46')]=[{'all':!![]}];}_0x12d32b=_[_0x50bd('0x3b')]({},_0x12d32b,_0x1f5984[_0x50bd('0x3c')]);return db['SquareMessage'][_0x50bd('0x47')](_0x12d32b)[_0x50bd('0x23')](handleEntityNotFound(_0x385b21,null))[_0x50bd('0x23')](respondWithResult(_0x385b21,null))[_0x50bd('0x42')](handleError(_0x385b21,null));};exports[_0x50bd('0x48')]=function(_0x146d9a,_0x2644c8){return db[_0x50bd('0x3d')][_0x50bd('0x48')](_0x146d9a[_0x50bd('0x49')],{})[_0x50bd('0x23')](respondWithResult(_0x2644c8,0xc9))[_0x50bd('0x42')](handleError(_0x2644c8,null));};exports[_0x50bd('0x4a')]=function(_0x58b05d,_0x316bef){if(_0x58b05d[_0x50bd('0x49')]['id']){delete _0x58b05d[_0x50bd('0x49')]['id'];}return db[_0x50bd('0x3d')][_0x50bd('0x47')]({'where':{'id':_0x58b05d['params']['id']}})[_0x50bd('0x23')](handleEntityNotFound(_0x316bef,null))[_0x50bd('0x23')](saveUpdates(_0x58b05d[_0x50bd('0x49')],null))[_0x50bd('0x23')](respondWithResult(_0x316bef,null))[_0x50bd('0x42')](handleError(_0x316bef,null));};exports[_0x50bd('0x22')]=function(_0x57eb3d,_0x31b92e){return db[_0x50bd('0x3d')][_0x50bd('0x47')]({'where':{'id':_0x57eb3d[_0x50bd('0x44')]['id']}})[_0x50bd('0x23')](handleEntityNotFound(_0x31b92e,null))[_0x50bd('0x23')](removeEntity(_0x31b92e,null))[_0x50bd('0x42')](handleError(_0x31b92e,null));}; \ No newline at end of file +var _0x783c=['SquareMessage','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','create','body','destroy','find','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map'];(function(_0x35bf81,_0x5ee78a){var _0xad020a=function(_0x163fbb){while(--_0x163fbb){_0x35bf81['push'](_0x35bf81['shift']());}};_0xad020a(++_0x5ee78a);}(_0x783c,0xaf));var _0xc783=function(_0x7b4d6c,_0xa10636){_0x7b4d6c=_0x7b4d6c-0x0;var _0x5919cc=_0x783c[_0x7b4d6c];return _0x5919cc;};'use strict';var emlformat=require(_0xc783('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc783('0x1'));var jsonpatch=require(_0xc783('0x2'));var rp=require(_0xc783('0x3'));var moment=require('moment');var BPromise=require(_0xc783('0x4'));var Mustache=require('mustache');var util=require(_0xc783('0x5'));var path=require(_0xc783('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc783('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc783('0x8'));var jsforce=require(_0xc783('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc783('0xa'));var Papa=require(_0xc783('0xb'));var Redis=require(_0xc783('0xc'));var authService=require(_0xc783('0xd'));var qs=require(_0xc783('0xe'));var as=require(_0xc783('0xf'));var hardwareService=require(_0xc783('0x10'));var logger=require('../../config/logger')(_0xc783('0x11'));var utils=require(_0xc783('0x12'));var config=require(_0xc783('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc783('0x14'))['db'];function respondWithStatusCode(_0x22d535,_0xe21c3e){_0xe21c3e=_0xe21c3e||0xcc;return function(_0xfb8f0){if(_0xfb8f0){return _0x22d535[_0xc783('0x15')](_0xe21c3e);}return _0x22d535[_0xc783('0x16')](_0xe21c3e)['end']();};}function respondWithResult(_0x733116,_0x1bbd52){_0x1bbd52=_0x1bbd52||0xc8;return function(_0x1ba7f6){if(_0x1ba7f6){return _0x733116[_0xc783('0x16')](_0x1bbd52)[_0xc783('0x17')](_0x1ba7f6);}};}function respondWithFilteredResult(_0xf12081,_0x1e7ab9){return function(_0xb26d99){if(_0xb26d99){var _0x5b3ee5=typeof _0x1e7ab9[_0xc783('0x18')]==='undefined'&&typeof _0x1e7ab9['limit']===_0xc783('0x19');var _0x63103b=_0xb26d99[_0xc783('0x1a')];var _0x3e6056=_0x5b3ee5?0x0:_0x1e7ab9[_0xc783('0x18')];var _0x2bed66=_0x5b3ee5?_0xb26d99['count']:_0x1e7ab9['offset']+_0x1e7ab9[_0xc783('0x1b')];var _0x4a7196;if(_0x2bed66>=_0x63103b){_0x2bed66=_0x63103b;_0x4a7196=0xc8;}else{_0x4a7196=0xce;}_0xf12081[_0xc783('0x16')](_0x4a7196);return _0xf12081[_0xc783('0x1c')](_0xc783('0x1d'),_0x3e6056+'-'+_0x2bed66+'/'+_0x63103b)['json'](_0xb26d99);}return null;};}function patchUpdates(_0x2d3dfa){return function(_0x205e74){try{jsonpatch[_0xc783('0x1e')](_0x205e74,_0x2d3dfa,!![]);}catch(_0x125bb9){return BPromise['reject'](_0x125bb9);}return _0x205e74[_0xc783('0x1f')]();};}function saveUpdates(_0x169228,_0x5720f6){return function(_0x3db82f){if(_0x3db82f){return _0x3db82f[_0xc783('0x20')](_0x169228)[_0xc783('0x21')](function(_0x6e8724){return _0x6e8724;});}return null;};}function removeEntity(_0x2182df,_0x2c2132){return function(_0x378456){if(_0x378456){return _0x378456['destroy']()[_0xc783('0x21')](function(){_0x2182df[_0xc783('0x16')](0xcc)[_0xc783('0x22')]();});}};}function handleEntityNotFound(_0x3c4b51,_0x221d1d){return function(_0x37dad1){if(!_0x37dad1){_0x3c4b51[_0xc783('0x15')](0x194);}return _0x37dad1;};}function handleError(_0xf28a23,_0x42d4f4){_0x42d4f4=_0x42d4f4||0x1f4;return function(_0x220b62){logger[_0xc783('0x23')](_0x220b62[_0xc783('0x24')]);if(_0x220b62[_0xc783('0x25')]){delete _0x220b62[_0xc783('0x25')];}_0xf28a23['status'](_0x42d4f4)[_0xc783('0x26')](_0x220b62);};}exports[_0xc783('0x27')]=function(_0x3e9035,_0x3f2a3b){var _0x5c6f3e={},_0x54ca7c={},_0x19b0ca={'count':0x0,'rows':[]};var _0x56c0cd=_[_0xc783('0x28')](db[_0xc783('0x29')]['rawAttributes'],function(_0x4218cf){return{'name':_0x4218cf[_0xc783('0x2a')],'type':_0x4218cf[_0xc783('0x2b')][_0xc783('0x2c')]};});_0x54ca7c['model']=_[_0xc783('0x28')](_0x56c0cd,_0xc783('0x25'));_0x54ca7c[_0xc783('0x2d')]=_[_0xc783('0x2e')](_0x3e9035['query']);_0x54ca7c['filters']=_[_0xc783('0x2f')](_0x54ca7c[_0xc783('0x30')],_0x54ca7c[_0xc783('0x2d')]);_0x5c6f3e[_0xc783('0x31')]=_[_0xc783('0x2f')](_0x54ca7c['model'],qs['fields'](_0x3e9035[_0xc783('0x2d')][_0xc783('0x32')]));_0x5c6f3e[_0xc783('0x31')]=_0x5c6f3e[_0xc783('0x31')][_0xc783('0x33')]?_0x5c6f3e['attributes']:_0x54ca7c[_0xc783('0x30')];if(!_0x3e9035[_0xc783('0x2d')][_0xc783('0x34')](_0xc783('0x35'))){_0x5c6f3e['limit']=qs[_0xc783('0x1b')](_0x3e9035[_0xc783('0x2d')][_0xc783('0x1b')]);_0x5c6f3e[_0xc783('0x18')]=qs[_0xc783('0x18')](_0x3e9035[_0xc783('0x2d')][_0xc783('0x18')]);}_0x5c6f3e[_0xc783('0x36')]=qs[_0xc783('0x37')](_0x3e9035[_0xc783('0x2d')][_0xc783('0x37')]);_0x5c6f3e[_0xc783('0x38')]=qs[_0xc783('0x39')](_['pick'](_0x3e9035[_0xc783('0x2d')],_0x54ca7c[_0xc783('0x39')]),_0x56c0cd);if(_0x3e9035[_0xc783('0x2d')][_0xc783('0x3a')]){_0x5c6f3e[_0xc783('0x38')]=_[_0xc783('0x3b')](_0x5c6f3e[_0xc783('0x38')],{'$or':_['map'](_0x56c0cd,function(_0x462b88){if(_0x462b88[_0xc783('0x2b')]!==_0xc783('0x3c')){var _0x4a934d={};_0x4a934d[_0x462b88['name']]={'$like':'%'+_0x3e9035[_0xc783('0x2d')][_0xc783('0x3a')]+'%'};return _0x4a934d;}})});}_0x5c6f3e=_[_0xc783('0x3b')]({},_0x5c6f3e,_0x3e9035[_0xc783('0x3d')]);var _0x142894={'where':_0x5c6f3e[_0xc783('0x38')]};return db['SquareMessage'][_0xc783('0x1a')](_0x142894)[_0xc783('0x21')](function(_0x572978){_0x19b0ca[_0xc783('0x1a')]=_0x572978;if(_0x3e9035['query'][_0xc783('0x3e')]){_0x5c6f3e[_0xc783('0x3f')]=[{'all':!![]}];}return db[_0xc783('0x29')]['findAll'](_0x5c6f3e);})[_0xc783('0x21')](function(_0x163581){_0x19b0ca['rows']=_0x163581;return _0x19b0ca;})[_0xc783('0x21')](respondWithFilteredResult(_0x3f2a3b,_0x5c6f3e))[_0xc783('0x40')](handleError(_0x3f2a3b,null));};exports[_0xc783('0x41')]=function(_0x17a2ae,_0xcc2457){var _0x49019c={'raw':!![],'where':{'id':_0x17a2ae[_0xc783('0x42')]['id']}},_0x196f0c={};_0x196f0c[_0xc783('0x30')]=_['keys'](db[_0xc783('0x29')][_0xc783('0x43')]);_0x196f0c[_0xc783('0x2d')]=_[_0xc783('0x2e')](_0x17a2ae[_0xc783('0x2d')]);_0x196f0c[_0xc783('0x39')]=_[_0xc783('0x2f')](_0x196f0c[_0xc783('0x30')],_0x196f0c['query']);_0x49019c[_0xc783('0x31')]=_[_0xc783('0x2f')](_0x196f0c[_0xc783('0x30')],qs[_0xc783('0x32')](_0x17a2ae['query'][_0xc783('0x32')]));_0x49019c[_0xc783('0x31')]=_0x49019c[_0xc783('0x31')][_0xc783('0x33')]?_0x49019c[_0xc783('0x31')]:_0x196f0c['model'];if(_0x17a2ae[_0xc783('0x2d')][_0xc783('0x3e')]){_0x49019c[_0xc783('0x3f')]=[{'all':!![]}];}_0x49019c=_[_0xc783('0x3b')]({},_0x49019c,_0x17a2ae['options']);return db[_0xc783('0x29')]['find'](_0x49019c)[_0xc783('0x21')](handleEntityNotFound(_0xcc2457,null))['then'](respondWithResult(_0xcc2457,null))['catch'](handleError(_0xcc2457,null));};exports[_0xc783('0x44')]=function(_0x232de3,_0x1f2b3a){return db[_0xc783('0x29')]['create'](_0x232de3[_0xc783('0x45')],{})['then'](respondWithResult(_0x1f2b3a,0xc9))[_0xc783('0x40')](handleError(_0x1f2b3a,null));};exports[_0xc783('0x20')]=function(_0x5b40e1,_0x319875){if(_0x5b40e1['body']['id']){delete _0x5b40e1[_0xc783('0x45')]['id'];}return db[_0xc783('0x29')]['find']({'where':{'id':_0x5b40e1[_0xc783('0x42')]['id']}})[_0xc783('0x21')](handleEntityNotFound(_0x319875,null))[_0xc783('0x21')](saveUpdates(_0x5b40e1[_0xc783('0x45')],null))['then'](respondWithResult(_0x319875,null))[_0xc783('0x40')](handleError(_0x319875,null));};exports[_0xc783('0x46')]=function(_0x1674fa,_0x2249a5){return db[_0xc783('0x29')][_0xc783('0x47')]({'where':{'id':_0x1674fa[_0xc783('0x42')]['id']}})[_0xc783('0x21')](handleEntityNotFound(_0x2249a5,null))[_0xc783('0x21')](removeEntity(_0x2249a5,null))[_0xc783('0x40')](handleError(_0x2249a5,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 58d77b0..941662f 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 _0x0bb1=['./squareMessage.attributes','exports','define','SquareMessage','square_messages','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0x0bb1,0xd1));var _0x10bb=function(_0x50e0b4,_0x1057f7){_0x50e0b4=_0x50e0b4-0x0;var _0x2fa8b0=_0x0bb1[_0x50e0b4];return _0x2fa8b0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x10bb('0x0'))(_0x10bb('0x1'));var moment=require(_0x10bb('0x2'));var BPromise=require(_0x10bb('0x3'));var rp=require(_0x10bb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x10bb('0x5'));var config=require(_0x10bb('0x6'));var attributes=require(_0x10bb('0x7'));module[_0x10bb('0x8')]=function(_0x3829b3,_0x43d08c){return _0x3829b3[_0x10bb('0x9')](_0x10bb('0xa'),attributes,{'tableName':_0x10bb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2a2=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','lodash','util','../../config/logger'];(function(_0x561ef0,_0xcc769){var _0x6c60a0=function(_0x4d3db8){while(--_0x4d3db8){_0x561ef0['push'](_0x561ef0['shift']());}};_0x6c60a0(++_0xcc769);}(_0xf2a2,0x107));var _0x2f2a=function(_0x11a3a9,_0x2ca0a4){_0x11a3a9=_0x11a3a9-0x0;var _0x138011=_0xf2a2[_0x11a3a9];return _0x138011;};'use strict';var _=require(_0x2f2a('0x0'));var util=require(_0x2f2a('0x1'));var logger=require(_0x2f2a('0x2'))(_0x2f2a('0x3'));var moment=require(_0x2f2a('0x4'));var BPromise=require(_0x2f2a('0x5'));var rp=require(_0x2f2a('0x6'));var fs=require('fs');var path=require(_0x2f2a('0x7'));var rimraf=require(_0x2f2a('0x8'));var config=require(_0x2f2a('0x9'));var attributes=require(_0x2f2a('0xa'));module[_0x2f2a('0xb')]=function(_0x2a18e7,_0x13668f){return _0x2a18e7[_0x2f2a('0xc')](_0x2f2a('0xd'),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 b44653b..7a1a8d7 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 _0x9a4a=['../../config/environment','client','request','then','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','options','info','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9a4a,0x126));var _0xa9a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a4a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa9a4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa9a4('0x1'));var fs=require('fs');var Redis=require(_0xa9a4('0x2'));var db=require(_0xa9a4('0x3'))['db'];var utils=require(_0xa9a4('0x4'));var logger=require('../../config/logger')(_0xa9a4('0x5'));var config=require(_0xa9a4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa9a4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f3842,_0x11dcf9,_0x58b730){return new BPromise(function(_0x2f51bb,_0x3f1c5e){return client[_0xa9a4('0x8')](_0x5f3842,_0x58b730)[_0xa9a4('0x9')](function(_0x125780){logger['info'](_0xa9a4('0xa'),_0x11dcf9,'request\x20sent');logger[_0xa9a4('0xb')](_0xa9a4('0xc'),_0x11dcf9,_0xa9a4('0xd'),JSON[_0xa9a4('0xe')](_0x125780));if(_0x125780[_0xa9a4('0xf')]){if(_0x125780[_0xa9a4('0xf')][_0xa9a4('0x10')]===0x1f4){logger[_0xa9a4('0xf')]('SquareMessage,\x20%s,\x20%s',_0x11dcf9,_0x125780[_0xa9a4('0xf')][_0xa9a4('0x11')]);return _0x3f1c5e(_0x125780[_0xa9a4('0xf')][_0xa9a4('0x11')]);}logger[_0xa9a4('0xf')](_0xa9a4('0xa'),_0x11dcf9,_0x125780[_0xa9a4('0xf')]['message']);return _0x2f51bb(_0x125780['error'][_0xa9a4('0x11')]);}else{logger['info'](_0xa9a4('0xa'),_0x11dcf9,_0xa9a4('0xd'));_0x2f51bb(_0x125780[_0xa9a4('0x12')][_0xa9a4('0x11')]);}})[_0xa9a4('0x13')](function(_0x511c1d){logger['error']('SquareMessage,\x20%s,\x20%s',_0x11dcf9,_0x511c1d);_0x3f1c5e(_0x511c1d);});});}exports[_0xa9a4('0x14')]=function(_0x4f76ce){var _0x956be8=this;return new Promise(function(_0x27aa52,_0x5bd012){return db[_0xa9a4('0x15')][_0xa9a4('0x16')](_0x4f76ce['body'],{'raw':_0x4f76ce[_0xa9a4('0x17')]?_0x4f76ce[_0xa9a4('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xa9a4('0x9')](function(_0x1803f5){logger[_0xa9a4('0x18')](_0xa9a4('0x14'),_0x4f76ce);logger[_0xa9a4('0xb')](_0xa9a4('0x14'),_0x4f76ce,JSON[_0xa9a4('0xe')](_0x1803f5));_0x27aa52(_0x1803f5);})[_0xa9a4('0x13')](function(_0x1a1686){logger['error'](_0xa9a4('0x14'),_0x1a1686[_0xa9a4('0x11')],_0x4f76ce);_0x5bd012(_0x956be8[_0xa9a4('0xf')](0x1f4,_0x1a1686[_0xa9a4('0x11')]));});});}; \ No newline at end of file +var _0x47fa=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','options','raw','then','lodash'];(function(_0x5a91a5,_0x1eb099){var _0x8f99de=function(_0x579b28){while(--_0x579b28){_0x5a91a5['push'](_0x5a91a5['shift']());}};_0x8f99de(++_0x1eb099);}(_0x47fa,0xca));var _0xa47f=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0x47fa[_0x54a761];return _0x37d1da;};'use strict';var _=require(_0xa47f('0x0'));var util=require(_0xa47f('0x1'));var moment=require(_0xa47f('0x2'));var BPromise=require(_0xa47f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa47f('0x4'));var db=require(_0xa47f('0x5'))['db'];var utils=require(_0xa47f('0x6'));var logger=require('../../config/logger')(_0xa47f('0x7'));var config=require('../../config/environment');var jayson=require(_0xa47f('0x8'));var client=jayson[_0xa47f('0x9')][_0xa47f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x586f98,_0x43a8f6,_0x44ad1f){return new BPromise(function(_0x2e3896,_0x25120a){return client[_0xa47f('0xb')](_0x586f98,_0x44ad1f)['then'](function(_0x4db4d2){logger[_0xa47f('0xc')](_0xa47f('0xd'),_0x43a8f6,_0xa47f('0xe'));logger[_0xa47f('0xf')](_0xa47f('0x10'),_0x43a8f6,_0xa47f('0xe'),JSON[_0xa47f('0x11')](_0x4db4d2));if(_0x4db4d2['error']){if(_0x4db4d2[_0xa47f('0x12')][_0xa47f('0x13')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x43a8f6,_0x4db4d2[_0xa47f('0x12')][_0xa47f('0x14')]);return _0x25120a(_0x4db4d2['error'][_0xa47f('0x14')]);}logger[_0xa47f('0x12')](_0xa47f('0xd'),_0x43a8f6,_0x4db4d2[_0xa47f('0x12')]['message']);return _0x2e3896(_0x4db4d2[_0xa47f('0x12')][_0xa47f('0x14')]);}else{logger[_0xa47f('0xc')](_0xa47f('0xd'),_0x43a8f6,'request\x20sent');_0x2e3896(_0x4db4d2[_0xa47f('0x15')]['message']);}})[_0xa47f('0x16')](function(_0x56fe89){logger[_0xa47f('0x12')](_0xa47f('0xd'),_0x43a8f6,_0x56fe89);_0x25120a(_0x56fe89);});});}exports[_0xa47f('0x17')]=function(_0x2b3c76){var _0x30402b=this;return new Promise(function(_0x2b824d,_0x36ae3e){return db[_0xa47f('0x18')][_0xa47f('0x19')](_0x2b3c76['body'],{'raw':_0x2b3c76[_0xa47f('0x1a')]?_0x2b3c76['options'][_0xa47f('0x1b')]===undefined?!![]:![]:!![]})[_0xa47f('0x1c')](function(_0x4ac31c){logger[_0xa47f('0xc')](_0xa47f('0x17'),_0x2b3c76);logger[_0xa47f('0xf')](_0xa47f('0x17'),_0x2b3c76,JSON[_0xa47f('0x11')](_0x4ac31c));_0x2b824d(_0x4ac31c);})[_0xa47f('0x16')](function(_0x408b3b){logger[_0xa47f('0x12')](_0xa47f('0x17'),_0x408b3b[_0xa47f('0x14')],_0x2b3c76);_0x36ae3e(_0x30402b[_0xa47f('0x12')](0x1f4,_0x408b3b[_0xa47f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 7f64e0b..c91441f 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 _0x7644=['connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','show','15s','test','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x37d4ac,_0x4e47d6){var _0x5e727a=function(_0x5adbff){while(--_0x5adbff){_0x37d4ac['push'](_0x37d4ac['shift']());}};_0x5e727a(++_0x4e47d6);}(_0x7644,0x6f));var _0x4764=function(_0xa7e0de,_0x19fd51){_0xa7e0de=_0xa7e0de-0x0;var _0x53a09a=_0x7644[_0xa7e0de];return _0x53a09a;};'use strict';var multer=require(_0x4764('0x0'));var util=require(_0x4764('0x1'));var path=require(_0x4764('0x2'));var timeout=require(_0x4764('0x3'));var express=require('express');var router=express[_0x4764('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4764('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4764('0x6'));var controller=require('./squareOdbc.controller');router[_0x4764('0x7')]('/',auth[_0x4764('0x8')](),controller['index']);router[_0x4764('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4764('0x9')]);router[_0x4764('0x7')]('/:id/test',auth[_0x4764('0x8')](),timeout(_0x4764('0xa')),controller[_0x4764('0xb')]);router[_0x4764('0xc')]('/',auth[_0x4764('0x8')](),controller[_0x4764('0xd')]);router[_0x4764('0xe')]('/:id',auth[_0x4764('0x8')](),controller[_0x4764('0xf')]);router[_0x4764('0x10')]('/:id',auth[_0x4764('0x8')](),controller[_0x4764('0x11')]);module[_0x4764('0x12')]=router; \ No newline at end of file +var _0xf4a4=['index','/:id','isAuthenticated','/:id/test','test','post','put','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1865cd,_0x2a772d){var _0x3d7c98=function(_0x467bd0){while(--_0x467bd0){_0x1865cd['push'](_0x1865cd['shift']());}};_0x3d7c98(++_0x2a772d);}(_0xf4a4,0x1d1));var _0x4f4a=function(_0x1c18cd,_0x4f2373){_0x1c18cd=_0x1c18cd-0x0;var _0x3dbaf2=_0xf4a4[_0x1c18cd];return _0x3dbaf2;};'use strict';var multer=require('multer');var util=require(_0x4f4a('0x0'));var path=require(_0x4f4a('0x1'));var timeout=require(_0x4f4a('0x2'));var express=require(_0x4f4a('0x3'));var router=express[_0x4f4a('0x4')]();var fs_extra=require(_0x4f4a('0x5'));var auth=require(_0x4f4a('0x6'));var interaction=require(_0x4f4a('0x7'));var config=require(_0x4f4a('0x8'));var controller=require('./squareOdbc.controller');router[_0x4f4a('0x9')]('/',auth['isAuthenticated'](),controller[_0x4f4a('0xa')]);router[_0x4f4a('0x9')](_0x4f4a('0xb'),auth[_0x4f4a('0xc')](),controller['show']);router[_0x4f4a('0x9')](_0x4f4a('0xd'),auth['isAuthenticated'](),timeout('15s'),controller[_0x4f4a('0xe')]);router[_0x4f4a('0xf')]('/',auth[_0x4f4a('0xc')](),controller['create']);router[_0x4f4a('0x10')](_0x4f4a('0xb'),auth['isAuthenticated'](),controller[_0x4f4a('0x11')]);router['delete'](_0x4f4a('0xb'),auth[_0x4f4a('0xc')](),controller[_0x4f4a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 6abd296..060295e 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 _0xe91f=['name','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe91f,0x6a));var _0xfe91=function(_0x407f3c,_0x5edf64){_0x407f3c=_0x407f3c-0x0;var _0x1f6ae6=_0xe91f[_0x407f3c];return _0x1f6ae6;};'use strict';var Sequelize=require('sequelize');module[_0xfe91('0x0')]={'name':{'type':Sequelize[_0xfe91('0x1')],'unique':_0xfe91('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1bfb=['exports','STRING','sequelize'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x1bfb,0xda));var _0xb1bf=function(_0x4179e2,_0xf2dbb){_0x4179e2=_0x4179e2-0x0;var _0x24cb50=_0x1bfb[_0x4179e2];return _0x24cb50;};'use strict';var Sequelize=require(_0xb1bf('0x0'));module[_0xb1bf('0x1')]={'name':{'type':Sequelize[_0xb1bf('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xb1bf('0x2')]},'description':{'type':Sequelize[_0xb1bf('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 4227e04..40aa510 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 _0xbe24=['openSync','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','limit','count','apply','reject','update','then','get','UserProfileResource','sendStatus','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','dsn','odbc'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xbe24,0xfb));var _0x4be2=function(_0xbdd6d0,_0x202cc6){_0xbdd6d0=_0xbdd6d0-0x0;var _0x453542=_0xbe24[_0xbdd6d0];return _0x453542;};'use strict';var emlformat=require(_0x4be2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4be2('0x1'));var jsonpatch=require(_0x4be2('0x2'));var rp=require(_0x4be2('0x3'));var moment=require(_0x4be2('0x4'));var BPromise=require(_0x4be2('0x5'));var Mustache=require(_0x4be2('0x6'));var util=require(_0x4be2('0x7'));var path=require(_0x4be2('0x8'));var sox=require(_0x4be2('0x9'));var csv=require(_0x4be2('0xa'));var ejs=require(_0x4be2('0xb'));var fs=require('fs');var fs_extra=require(_0x4be2('0xc'));var _=require('lodash');var squel=require(_0x4be2('0xd'));var crypto=require(_0x4be2('0xe'));var jsforce=require(_0x4be2('0xf'));var deskjs=require(_0x4be2('0x10'));var toCsv=require(_0x4be2('0xa'));var querystring=require(_0x4be2('0x11'));var Papa=require(_0x4be2('0x12'));var Redis=require('ioredis');var authService=require(_0x4be2('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4be2('0x14'))(_0x4be2('0x15'));var utils=require(_0x4be2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4be2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5df99a,_0x284feb){_0x284feb=_0x284feb||0xcc;return function(_0x36ebad){if(_0x36ebad){return _0x5df99a['sendStatus'](_0x284feb);}return _0x5df99a[_0x4be2('0x18')](_0x284feb)[_0x4be2('0x19')]();};}function respondWithResult(_0x3e26c2,_0x2df7a2){_0x2df7a2=_0x2df7a2||0xc8;return function(_0x4bbc91){if(_0x4bbc91){return _0x3e26c2[_0x4be2('0x18')](_0x2df7a2)[_0x4be2('0x1a')](_0x4bbc91);}};}function respondWithFilteredResult(_0xa5420d,_0x16e8b0){return function(_0x58a6aa){if(_0x58a6aa){var _0x485b41=typeof _0x16e8b0[_0x4be2('0x1b')]==='undefined'&&typeof _0x16e8b0[_0x4be2('0x1c')]==='undefined';var _0xa37cc5=_0x58a6aa[_0x4be2('0x1d')];var _0x1102ae=_0x485b41?0x0:_0x16e8b0[_0x4be2('0x1b')];var _0x22f9be=_0x485b41?_0x58a6aa['count']:_0x16e8b0[_0x4be2('0x1b')]+_0x16e8b0[_0x4be2('0x1c')];var _0x23ffd0;if(_0x22f9be>=_0xa37cc5){_0x22f9be=_0xa37cc5;_0x23ffd0=0xc8;}else{_0x23ffd0=0xce;}_0xa5420d['status'](_0x23ffd0);return _0xa5420d['set']('Content-Range',_0x1102ae+'-'+_0x22f9be+'/'+_0xa37cc5)[_0x4be2('0x1a')](_0x58a6aa);}return null;};}function patchUpdates(_0x28dd22){return function(_0x28e497){try{jsonpatch[_0x4be2('0x1e')](_0x28e497,_0x28dd22,!![]);}catch(_0x256f87){return BPromise[_0x4be2('0x1f')](_0x256f87);}return _0x28e497['save']();};}function saveUpdates(_0x5967f7,_0x5592aa){return function(_0xb77ea8){if(_0xb77ea8){return _0xb77ea8[_0x4be2('0x20')](_0x5967f7)[_0x4be2('0x21')](function(_0x34f5c1){return _0x34f5c1;});}return null;};}function removeEntity(_0x2aa2da,_0x270e07){return function(_0x4d6b01){if(_0x4d6b01){return _0x4d6b01['destroy']()['then'](function(){var _0x2f686c=_0x4d6b01[_0x4be2('0x22')]({'plain':!![]});var _0x129d5f='ODBC';return db[_0x4be2('0x23')]['destroy']({'where':{'type':_0x129d5f,'resourceId':_0x2f686c['id']}})['then'](function(){return _0x4d6b01;});})[_0x4be2('0x21')](function(){_0x2aa2da[_0x4be2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ecb55,_0x813e7){return function(_0x3d272c){if(!_0x3d272c){_0x3ecb55[_0x4be2('0x24')](0x194);}return _0x3d272c;};}function handleError(_0x156435,_0x720ea4){_0x720ea4=_0x720ea4||0x1f4;return function(_0x4391ed){logger[_0x4be2('0x25')](_0x4391ed[_0x4be2('0x26')]);if(_0x4391ed[_0x4be2('0x27')]){delete _0x4391ed[_0x4be2('0x27')];}_0x156435[_0x4be2('0x18')](_0x720ea4)['send'](_0x4391ed);};}exports[_0x4be2('0x28')]=function(_0x52e3d9,_0x5942e8){var _0x48b6d3={},_0x5758e6={},_0x1f3e2e={'count':0x0,'rows':[]};var _0x1270bf=_[_0x4be2('0x29')](db[_0x4be2('0x2a')][_0x4be2('0x2b')],function(_0x8ae1f5){return{'name':_0x8ae1f5[_0x4be2('0x2c')],'type':_0x8ae1f5[_0x4be2('0x2d')]['key']};});_0x5758e6[_0x4be2('0x2e')]=_[_0x4be2('0x29')](_0x1270bf,'name');_0x5758e6[_0x4be2('0x2f')]=_[_0x4be2('0x30')](_0x52e3d9['query']);_0x5758e6[_0x4be2('0x31')]=_[_0x4be2('0x32')](_0x5758e6[_0x4be2('0x2e')],_0x5758e6[_0x4be2('0x2f')]);_0x48b6d3['attributes']=_['intersection'](_0x5758e6[_0x4be2('0x2e')],qs[_0x4be2('0x33')](_0x52e3d9[_0x4be2('0x2f')]['fields']));_0x48b6d3[_0x4be2('0x34')]=_0x48b6d3[_0x4be2('0x34')][_0x4be2('0x35')]?_0x48b6d3[_0x4be2('0x34')]:_0x5758e6['model'];if(!_0x52e3d9[_0x4be2('0x2f')]['hasOwnProperty'](_0x4be2('0x36'))){_0x48b6d3[_0x4be2('0x1c')]=qs['limit'](_0x52e3d9[_0x4be2('0x2f')]['limit']);_0x48b6d3[_0x4be2('0x1b')]=qs['offset'](_0x52e3d9['query'][_0x4be2('0x1b')]);}_0x48b6d3['order']=qs['sort'](_0x52e3d9[_0x4be2('0x2f')]['sort']);_0x48b6d3[_0x4be2('0x37')]=qs[_0x4be2('0x31')](_[_0x4be2('0x38')](_0x52e3d9['query'],_0x5758e6['filters']),_0x1270bf);if(_0x52e3d9[_0x4be2('0x2f')][_0x4be2('0x39')]){_0x48b6d3[_0x4be2('0x37')]=_[_0x4be2('0x3a')](_0x48b6d3[_0x4be2('0x37')],{'$or':_['map'](_0x1270bf,function(_0x49f8e2){if(_0x49f8e2[_0x4be2('0x2d')]!==_0x4be2('0x3b')){var _0x1d5c94={};_0x1d5c94[_0x49f8e2[_0x4be2('0x27')]]={'$like':'%'+_0x52e3d9['query'][_0x4be2('0x39')]+'%'};return _0x1d5c94;}})});}_0x48b6d3=_['merge']({},_0x48b6d3,_0x52e3d9[_0x4be2('0x3c')]);var _0x10a1ab={'where':_0x48b6d3[_0x4be2('0x37')]};return db[_0x4be2('0x2a')]['count'](_0x10a1ab)['then'](function(_0x43a915){_0x1f3e2e[_0x4be2('0x1d')]=_0x43a915;if(_0x52e3d9[_0x4be2('0x2f')][_0x4be2('0x3d')]){_0x48b6d3[_0x4be2('0x3e')]=[{'all':!![]}];}return db[_0x4be2('0x2a')][_0x4be2('0x3f')](_0x48b6d3);})[_0x4be2('0x21')](function(_0x377cca){_0x1f3e2e[_0x4be2('0x40')]=_0x377cca;return _0x1f3e2e;})[_0x4be2('0x21')](respondWithFilteredResult(_0x5942e8,_0x48b6d3))['catch'](handleError(_0x5942e8,null));};exports['show']=function(_0x29a00f,_0x21993c){var _0x87b1f9={'raw':!![],'where':{'id':_0x29a00f[_0x4be2('0x41')]['id']}},_0x16b5a6={};_0x16b5a6['model']=_[_0x4be2('0x30')](db['SquareOdbc']['rawAttributes']);_0x16b5a6[_0x4be2('0x2f')]=_[_0x4be2('0x30')](_0x29a00f[_0x4be2('0x2f')]);_0x16b5a6['filters']=_[_0x4be2('0x32')](_0x16b5a6[_0x4be2('0x2e')],_0x16b5a6[_0x4be2('0x2f')]);_0x87b1f9[_0x4be2('0x34')]=_[_0x4be2('0x32')](_0x16b5a6[_0x4be2('0x2e')],qs[_0x4be2('0x33')](_0x29a00f[_0x4be2('0x2f')][_0x4be2('0x33')]));_0x87b1f9[_0x4be2('0x34')]=_0x87b1f9[_0x4be2('0x34')]['length']?_0x87b1f9['attributes']:_0x16b5a6[_0x4be2('0x2e')];if(_0x29a00f[_0x4be2('0x2f')][_0x4be2('0x3d')]){_0x87b1f9[_0x4be2('0x3e')]=[{'all':!![]}];}_0x87b1f9=_[_0x4be2('0x3a')]({},_0x87b1f9,_0x29a00f[_0x4be2('0x3c')]);return db[_0x4be2('0x2a')][_0x4be2('0x42')](_0x87b1f9)['then'](handleEntityNotFound(_0x21993c,null))[_0x4be2('0x21')](respondWithResult(_0x21993c,null))[_0x4be2('0x43')](handleError(_0x21993c,null));};exports[_0x4be2('0x44')]=function(_0x388d80,_0x3217ca){return db[_0x4be2('0x2a')]['create'](_0x388d80['body'],{})[_0x4be2('0x21')](function(_0x5a34dc){var _0x3343ff=_0x388d80[_0x4be2('0x45')][_0x4be2('0x22')]({'plain':!![]});if(!_0x3343ff)throw new Error(_0x4be2('0x46'));if(_0x3343ff[_0x4be2('0x47')]===_0x4be2('0x45')){var _0x4fe962=_0x5a34dc['get']({'plain':!![]});var _0x3672c7=_0x4be2('0x48');return db[_0x4be2('0x49')][_0x4be2('0x42')]({'where':{'name':_0x3672c7,'userProfileId':_0x3343ff[_0x4be2('0x4a')]},'raw':!![]})[_0x4be2('0x21')](function(_0x899ed0){if(_0x899ed0&&_0x899ed0[_0x4be2('0x4b')]===0x0){return db[_0x4be2('0x23')][_0x4be2('0x44')]({'name':_0x4fe962['name'],'resourceId':_0x4fe962['id'],'type':_0x899ed0[_0x4be2('0x27')],'sectionId':_0x899ed0['id']},{})[_0x4be2('0x21')](function(){return _0x5a34dc;});}else{return _0x5a34dc;}})[_0x4be2('0x43')](function(_0x9f8d67){logger['error'](_0x4be2('0x4c'),_0x9f8d67);throw _0x9f8d67;});}return _0x5a34dc;})[_0x4be2('0x21')](respondWithResult(_0x3217ca,0xc9))['catch'](handleError(_0x3217ca,null));};exports[_0x4be2('0x20')]=function(_0x475745,_0x2ab309){if(_0x475745['body']['id']){delete _0x475745['body']['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x475745[_0x4be2('0x41')]['id']}})['then'](handleEntityNotFound(_0x2ab309,null))[_0x4be2('0x21')](saveUpdates(_0x475745[_0x4be2('0x4d')],null))['then'](respondWithResult(_0x2ab309,null))[_0x4be2('0x43')](handleError(_0x2ab309,null));};exports[_0x4be2('0x4e')]=function(_0x40514d,_0x14b442){return db[_0x4be2('0x2a')][_0x4be2('0x42')]({'where':{'id':_0x40514d[_0x4be2('0x41')]['id']}})[_0x4be2('0x21')](handleEntityNotFound(_0x14b442,null))[_0x4be2('0x21')](removeEntity(_0x14b442,null))[_0x4be2('0x43')](handleError(_0x14b442,null));};exports['test']=function(_0x355690,_0x382a14,_0x397437){var _0x221224;return db['SquareOdbc'][_0x4be2('0x42')]({'where':{'id':_0x355690[_0x4be2('0x41')]['id']},'attributes':['id',_0x4be2('0x4f')]})[_0x4be2('0x21')](handleEntityNotFound(_0x382a14,null))[_0x4be2('0x21')](function(_0x20efe7){if(_0x20efe7){var _0x7fb5ca=require(_0x4be2('0x50'))();_0x7fb5ca[_0x4be2('0x51')](_0x20efe7[_0x4be2('0x4f')]);_0x7fb5ca[_0x4be2('0x52')]();return _0x20efe7;}})[_0x4be2('0x21')](respondWithResult(_0x382a14,null))[_0x4be2('0x43')](handleError(_0x382a14,null));}; \ No newline at end of file +var _0xa222=['sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','then','ODBC','UserProfileResource','destroy','error','stack','name','send','index','type','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','SquareOdbc','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','user','role','get','UserProfileSection','find','userProfileId','autoAssociation','test','odbc','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x90e611,_0x5b80db){var _0x4db107=function(_0x1fc092){while(--_0x1fc092){_0x90e611['push'](_0x90e611['shift']());}};_0x4db107(++_0x5b80db);}(_0xa222,0xab));var _0x2a22=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0xa222[_0x2074db];return _0x27324c;};'use strict';var emlformat=require(_0x2a22('0x0'));var rimraf=require(_0x2a22('0x1'));var zipdir=require(_0x2a22('0x2'));var jsonpatch=require(_0x2a22('0x3'));var rp=require(_0x2a22('0x4'));var moment=require(_0x2a22('0x5'));var BPromise=require(_0x2a22('0x6'));var Mustache=require('mustache');var util=require(_0x2a22('0x7'));var path=require(_0x2a22('0x8'));var sox=require(_0x2a22('0x9'));var csv=require(_0x2a22('0xa'));var ejs=require(_0x2a22('0xb'));var fs=require('fs');var fs_extra=require(_0x2a22('0xc'));var _=require('lodash');var squel=require(_0x2a22('0xd'));var crypto=require(_0x2a22('0xe'));var jsforce=require(_0x2a22('0xf'));var deskjs=require(_0x2a22('0x10'));var toCsv=require(_0x2a22('0xa'));var querystring=require(_0x2a22('0x11'));var Papa=require(_0x2a22('0x12'));var Redis=require(_0x2a22('0x13'));var authService=require(_0x2a22('0x14'));var qs=require(_0x2a22('0x15'));var as=require(_0x2a22('0x16'));var hardwareService=require(_0x2a22('0x17'));var logger=require(_0x2a22('0x18'))(_0x2a22('0x19'));var utils=require(_0x2a22('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2a22('0x1b'))['db'];function respondWithStatusCode(_0x39bf29,_0x526283){_0x526283=_0x526283||0xcc;return function(_0x3feeff){if(_0x3feeff){return _0x39bf29[_0x2a22('0x1c')](_0x526283);}return _0x39bf29[_0x2a22('0x1d')](_0x526283)['end']();};}function respondWithResult(_0x3e139e,_0x5201b9){_0x5201b9=_0x5201b9||0xc8;return function(_0x3a0cb0){if(_0x3a0cb0){return _0x3e139e[_0x2a22('0x1d')](_0x5201b9)[_0x2a22('0x1e')](_0x3a0cb0);}};}function respondWithFilteredResult(_0x2ac022,_0x1a2c6c){return function(_0x1c36e0){if(_0x1c36e0){var _0x638e56=typeof _0x1a2c6c['offset']===_0x2a22('0x1f')&&typeof _0x1a2c6c[_0x2a22('0x20')]===_0x2a22('0x1f');var _0xc42a1e=_0x1c36e0[_0x2a22('0x21')];var _0x59a710=_0x638e56?0x0:_0x1a2c6c[_0x2a22('0x22')];var _0x229c22=_0x638e56?_0x1c36e0[_0x2a22('0x21')]:_0x1a2c6c[_0x2a22('0x22')]+_0x1a2c6c[_0x2a22('0x20')];var _0x9d36de;if(_0x229c22>=_0xc42a1e){_0x229c22=_0xc42a1e;_0x9d36de=0xc8;}else{_0x9d36de=0xce;}_0x2ac022[_0x2a22('0x1d')](_0x9d36de);return _0x2ac022['set'](_0x2a22('0x23'),_0x59a710+'-'+_0x229c22+'/'+_0xc42a1e)['json'](_0x1c36e0);}return null;};}function patchUpdates(_0xc4f02e){return function(_0x29d4b0){try{jsonpatch[_0x2a22('0x24')](_0x29d4b0,_0xc4f02e,!![]);}catch(_0x586c3e){return BPromise['reject'](_0x586c3e);}return _0x29d4b0[_0x2a22('0x25')]();};}function saveUpdates(_0x41436f,_0x2f7287){return function(_0x2f8538){if(_0x2f8538){return _0x2f8538['update'](_0x41436f)[_0x2a22('0x26')](function(_0x409119){return _0x409119;});}return null;};}function removeEntity(_0x74042b,_0x4ed3a0){return function(_0x308146){if(_0x308146){return _0x308146['destroy']()[_0x2a22('0x26')](function(){var _0x540f21=_0x308146['get']({'plain':!![]});var _0x1f73ed=_0x2a22('0x27');return db[_0x2a22('0x28')][_0x2a22('0x29')]({'where':{'type':_0x1f73ed,'resourceId':_0x540f21['id']}})[_0x2a22('0x26')](function(){return _0x308146;});})[_0x2a22('0x26')](function(){_0x74042b[_0x2a22('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a560b,_0x3a306a){return function(_0x98d3d4){if(!_0x98d3d4){_0x3a560b['sendStatus'](0x194);}return _0x98d3d4;};}function handleError(_0x443713,_0x5050a1){_0x5050a1=_0x5050a1||0x1f4;return function(_0x5032a2){logger[_0x2a22('0x2a')](_0x5032a2[_0x2a22('0x2b')]);if(_0x5032a2['name']){delete _0x5032a2[_0x2a22('0x2c')];}_0x443713['status'](_0x5050a1)[_0x2a22('0x2d')](_0x5032a2);};}exports[_0x2a22('0x2e')]=function(_0x5ce6eb,_0x55c6c8){var _0x29ead8={},_0x6abd79={},_0xc6c49a={'count':0x0,'rows':[]};var _0x6448e0=_['map'](db['SquareOdbc']['rawAttributes'],function(_0x57b9f5){return{'name':_0x57b9f5['fieldName'],'type':_0x57b9f5[_0x2a22('0x2f')][_0x2a22('0x30')]};});_0x6abd79['model']=_[_0x2a22('0x31')](_0x6448e0,_0x2a22('0x2c'));_0x6abd79[_0x2a22('0x32')]=_[_0x2a22('0x33')](_0x5ce6eb[_0x2a22('0x32')]);_0x6abd79['filters']=_['intersection'](_0x6abd79[_0x2a22('0x34')],_0x6abd79[_0x2a22('0x32')]);_0x29ead8[_0x2a22('0x35')]=_[_0x2a22('0x36')](_0x6abd79['model'],qs[_0x2a22('0x37')](_0x5ce6eb['query'][_0x2a22('0x37')]));_0x29ead8[_0x2a22('0x35')]=_0x29ead8[_0x2a22('0x35')][_0x2a22('0x38')]?_0x29ead8[_0x2a22('0x35')]:_0x6abd79[_0x2a22('0x34')];if(!_0x5ce6eb[_0x2a22('0x32')][_0x2a22('0x39')](_0x2a22('0x3a'))){_0x29ead8[_0x2a22('0x20')]=qs[_0x2a22('0x20')](_0x5ce6eb[_0x2a22('0x32')][_0x2a22('0x20')]);_0x29ead8[_0x2a22('0x22')]=qs[_0x2a22('0x22')](_0x5ce6eb['query']['offset']);}_0x29ead8[_0x2a22('0x3b')]=qs['sort'](_0x5ce6eb['query'][_0x2a22('0x3c')]);_0x29ead8[_0x2a22('0x3d')]=qs['filters'](_[_0x2a22('0x3e')](_0x5ce6eb['query'],_0x6abd79[_0x2a22('0x3f')]),_0x6448e0);if(_0x5ce6eb[_0x2a22('0x32')][_0x2a22('0x40')]){_0x29ead8[_0x2a22('0x3d')]=_[_0x2a22('0x41')](_0x29ead8[_0x2a22('0x3d')],{'$or':_[_0x2a22('0x31')](_0x6448e0,function(_0x2a788f){if(_0x2a788f[_0x2a22('0x2f')]!==_0x2a22('0x42')){var _0x4caa1a={};_0x4caa1a[_0x2a788f[_0x2a22('0x2c')]]={'$like':'%'+_0x5ce6eb[_0x2a22('0x32')]['filter']+'%'};return _0x4caa1a;}})});}_0x29ead8=_[_0x2a22('0x41')]({},_0x29ead8,_0x5ce6eb[_0x2a22('0x43')]);var _0x4c1681={'where':_0x29ead8['where']};return db['SquareOdbc'][_0x2a22('0x21')](_0x4c1681)['then'](function(_0x42439f){_0xc6c49a[_0x2a22('0x21')]=_0x42439f;if(_0x5ce6eb[_0x2a22('0x32')]['includeAll']){_0x29ead8['include']=[{'all':!![]}];}return db[_0x2a22('0x44')][_0x2a22('0x45')](_0x29ead8);})[_0x2a22('0x26')](function(_0x324516){_0xc6c49a[_0x2a22('0x46')]=_0x324516;return _0xc6c49a;})['then'](respondWithFilteredResult(_0x55c6c8,_0x29ead8))[_0x2a22('0x47')](handleError(_0x55c6c8,null));};exports[_0x2a22('0x48')]=function(_0x5d3181,_0x286a61){var _0x2178fb={'raw':!![],'where':{'id':_0x5d3181[_0x2a22('0x49')]['id']}},_0x179699={};_0x179699['model']=_['keys'](db['SquareOdbc'][_0x2a22('0x4a')]);_0x179699[_0x2a22('0x32')]=_['keys'](_0x5d3181[_0x2a22('0x32')]);_0x179699['filters']=_[_0x2a22('0x36')](_0x179699[_0x2a22('0x34')],_0x179699['query']);_0x2178fb[_0x2a22('0x35')]=_[_0x2a22('0x36')](_0x179699[_0x2a22('0x34')],qs['fields'](_0x5d3181[_0x2a22('0x32')]['fields']));_0x2178fb[_0x2a22('0x35')]=_0x2178fb[_0x2a22('0x35')][_0x2a22('0x38')]?_0x2178fb[_0x2a22('0x35')]:_0x179699[_0x2a22('0x34')];if(_0x5d3181[_0x2a22('0x32')][_0x2a22('0x4b')]){_0x2178fb['include']=[{'all':!![]}];}_0x2178fb=_[_0x2a22('0x41')]({},_0x2178fb,_0x5d3181['options']);return db[_0x2a22('0x44')]['find'](_0x2178fb)[_0x2a22('0x26')](handleEntityNotFound(_0x286a61,null))[_0x2a22('0x26')](respondWithResult(_0x286a61,null))[_0x2a22('0x47')](handleError(_0x286a61,null));};exports[_0x2a22('0x4c')]=function(_0x3ada09,_0x4db90b){return db[_0x2a22('0x44')]['create'](_0x3ada09[_0x2a22('0x4d')],{})['then'](function(_0x3bf828){var _0x1712b8=_0x3ada09[_0x2a22('0x4e')]['get']({'plain':!![]});if(!_0x1712b8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1712b8[_0x2a22('0x4f')]===_0x2a22('0x4e')){var _0x4de234=_0x3bf828[_0x2a22('0x50')]({'plain':!![]});var _0x5d17c8='ODBC';return db[_0x2a22('0x51')][_0x2a22('0x52')]({'where':{'name':_0x5d17c8,'userProfileId':_0x1712b8[_0x2a22('0x53')]},'raw':!![]})[_0x2a22('0x26')](function(_0x3277f0){if(_0x3277f0&&_0x3277f0[_0x2a22('0x54')]===0x0){return db[_0x2a22('0x28')]['create']({'name':_0x4de234[_0x2a22('0x2c')],'resourceId':_0x4de234['id'],'type':_0x3277f0[_0x2a22('0x2c')],'sectionId':_0x3277f0['id']},{})['then'](function(){return _0x3bf828;});}else{return _0x3bf828;}})[_0x2a22('0x47')](function(_0x189156){logger[_0x2a22('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x189156);throw _0x189156;});}return _0x3bf828;})[_0x2a22('0x26')](respondWithResult(_0x4db90b,0xc9))[_0x2a22('0x47')](handleError(_0x4db90b,null));};exports['update']=function(_0x5b2c26,_0x20f923){if(_0x5b2c26[_0x2a22('0x4d')]['id']){delete _0x5b2c26['body']['id'];}return db['SquareOdbc'][_0x2a22('0x52')]({'where':{'id':_0x5b2c26['params']['id']}})[_0x2a22('0x26')](handleEntityNotFound(_0x20f923,null))[_0x2a22('0x26')](saveUpdates(_0x5b2c26[_0x2a22('0x4d')],null))[_0x2a22('0x26')](respondWithResult(_0x20f923,null))['catch'](handleError(_0x20f923,null));};exports[_0x2a22('0x29')]=function(_0x122418,_0x36ea1b){return db[_0x2a22('0x44')][_0x2a22('0x52')]({'where':{'id':_0x122418[_0x2a22('0x49')]['id']}})[_0x2a22('0x26')](handleEntityNotFound(_0x36ea1b,null))[_0x2a22('0x26')](removeEntity(_0x36ea1b,null))[_0x2a22('0x47')](handleError(_0x36ea1b,null));};exports[_0x2a22('0x55')]=function(_0x34ad9e,_0x5aef94,_0x9a1953){var _0x431b86;return db[_0x2a22('0x44')][_0x2a22('0x52')]({'where':{'id':_0x34ad9e[_0x2a22('0x49')]['id']},'attributes':['id','dsn']})[_0x2a22('0x26')](handleEntityNotFound(_0x5aef94,null))[_0x2a22('0x26')](function(_0x35722a){if(_0x35722a){var _0x869099=require(_0x2a22('0x56'))();_0x869099[_0x2a22('0x57')](_0x35722a[_0x2a22('0x58')]);_0x869099[_0x2a22('0x59')]();return _0x35722a;}})[_0x2a22('0x26')](respondWithResult(_0x5aef94,null))[_0x2a22('0x47')](handleError(_0x5aef94,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 15de3ec..5dcabf7 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 _0x0677=['SquareOdbc','square_odbc','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x3e5d85,_0xd1e735){var _0xa51a42=function(_0x518e22){while(--_0x518e22){_0x3e5d85['push'](_0x3e5d85['shift']());}};_0xa51a42(++_0xd1e735);}(_0x0677,0xc5));var _0x7067=function(_0xfcbf57,_0x4b05fd){_0xfcbf57=_0xfcbf57-0x0;var _0x1078fa=_0x0677[_0xfcbf57];return _0x1078fa;};'use strict';var _=require('lodash');var util=require(_0x7067('0x0'));var logger=require(_0x7067('0x1'))(_0x7067('0x2'));var moment=require(_0x7067('0x3'));var BPromise=require(_0x7067('0x4'));var rp=require(_0x7067('0x5'));var fs=require('fs');var path=require(_0x7067('0x6'));var rimraf=require('rimraf');var config=require(_0x7067('0x7'));var attributes=require(_0x7067('0x8'));module[_0x7067('0x9')]=function(_0x9bb626,_0x3dd6ea){return _0x9bb626[_0x7067('0xa')](_0x7067('0xb'),attributes,{'tableName':_0x7067('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c00=['rimraf','../../config/environment','exports','define','square_odbc','util','../../config/logger','moment','request-promise','path'];(function(_0x3582fb,_0x402fc1){var _0x45b3fc=function(_0x57d78e){while(--_0x57d78e){_0x3582fb['push'](_0x3582fb['shift']());}};_0x45b3fc(++_0x402fc1);}(_0x5c00,0x145));var _0x05c0=function(_0x3f042c,_0x3d2cfe){_0x3f042c=_0x3f042c-0x0;var _0x280d2e=_0x5c00[_0x3f042c];return _0x280d2e;};'use strict';var _=require('lodash');var util=require(_0x05c0('0x0'));var logger=require(_0x05c0('0x1'))('api');var moment=require(_0x05c0('0x2'));var BPromise=require('bluebird');var rp=require(_0x05c0('0x3'));var fs=require('fs');var path=require(_0x05c0('0x4'));var rimraf=require(_0x05c0('0x5'));var config=require(_0x05c0('0x6'));var attributes=require('./squareOdbc.attributes');module[_0x05c0('0x7')]=function(_0x88effe,_0x2284d1){return _0x88effe[_0x05c0('0x8')]('SquareOdbc',attributes,{'tableName':_0x05c0('0x9'),'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 15abe8d..aa7e7bb 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 _0x07ff=['attributes','include','model','map','then','debug','ShowSquareOdbc','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SquareOdbc','find','options','where'];(function(_0x493c55,_0x458539){var _0x5e4e5a=function(_0x3b645e){while(--_0x3b645e){_0x493c55['push'](_0x493c55['shift']());}};_0x5e4e5a(++_0x458539);}(_0x07ff,0x1d9));var _0xf07f=function(_0x80307f,_0x418c11){_0x80307f=_0x80307f-0x0;var _0x210504=_0x07ff[_0x80307f];return _0x210504;};'use strict';var _=require(_0xf07f('0x0'));var util=require(_0xf07f('0x1'));var moment=require(_0xf07f('0x2'));var BPromise=require(_0xf07f('0x3'));var rs=require(_0xf07f('0x4'));var fs=require('fs');var Redis=require(_0xf07f('0x5'));var db=require(_0xf07f('0x6'))['db'];var utils=require(_0xf07f('0x7'));var logger=require(_0xf07f('0x8'))('rpc');var config=require(_0xf07f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf07f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47edba,_0x5c8ea3,_0x16294a){return new BPromise(function(_0x56bb37,_0x61e3d9){return client[_0xf07f('0xb')](_0x47edba,_0x16294a)['then'](function(_0x4ef0f8){logger[_0xf07f('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x5c8ea3,'request\x20sent');logger['debug'](_0xf07f('0xd'),_0x5c8ea3,_0xf07f('0xe'),JSON[_0xf07f('0xf')](_0x4ef0f8));if(_0x4ef0f8['error']){if(_0x4ef0f8[_0xf07f('0x10')][_0xf07f('0x11')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x5c8ea3,_0x4ef0f8[_0xf07f('0x10')]['message']);return _0x61e3d9(_0x4ef0f8[_0xf07f('0x10')][_0xf07f('0x12')]);}logger[_0xf07f('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x5c8ea3,_0x4ef0f8[_0xf07f('0x10')]['message']);return _0x56bb37(_0x4ef0f8[_0xf07f('0x10')][_0xf07f('0x12')]);}else{logger[_0xf07f('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x5c8ea3,_0xf07f('0xe'));_0x56bb37(_0x4ef0f8['result'][_0xf07f('0x12')]);}})['catch'](function(_0x37b931){logger[_0xf07f('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x5c8ea3,_0x37b931);_0x61e3d9(_0x37b931);});});}exports['ShowSquareOdbc']=function(_0x55662a){var _0x3b8290=this;return new Promise(function(_0x1d6215,_0xb995fe){return db[_0xf07f('0x13')][_0xf07f('0x14')]({'raw':_0x55662a[_0xf07f('0x15')]?_0x55662a['options']['raw']===undefined?!![]:![]:!![],'where':_0x55662a[_0xf07f('0x15')]?_0x55662a['options'][_0xf07f('0x16')]||null:null,'attributes':_0x55662a['options']?_0x55662a[_0xf07f('0x15')][_0xf07f('0x17')]||null:null,'include':_0x55662a['options']?_0x55662a['options'][_0xf07f('0x18')]?_['map'](_0x55662a[_0xf07f('0x15')]['include'],function(_0x2f2541){return{'model':db[_0x2f2541[_0xf07f('0x19')]],'as':_0x2f2541['as'],'attributes':_0x2f2541[_0xf07f('0x17')],'include':_0x2f2541[_0xf07f('0x18')]?_[_0xf07f('0x1a')](_0x2f2541[_0xf07f('0x18')],function(_0x1b8a71){return{'model':db[_0x1b8a71[_0xf07f('0x19')]],'as':_0x1b8a71['as'],'attributes':_0x1b8a71[_0xf07f('0x17')],'include':_0x1b8a71['include']?_['map'](_0x1b8a71['include'],function(_0x3d08d8){return{'model':db[_0x3d08d8['model']],'as':_0x3d08d8['as'],'attributes':_0x3d08d8[_0xf07f('0x17')]};}):[]};}):[]};}):[]:[]})[_0xf07f('0x1b')](function(_0x2b7b4f){logger[_0xf07f('0xc')]('ShowSquareOdbc',_0x55662a);logger[_0xf07f('0x1c')](_0xf07f('0x1d'),_0x55662a,JSON[_0xf07f('0xf')](_0x2b7b4f));_0x1d6215(_0x2b7b4f);})[_0xf07f('0x1e')](function(_0x1bbb5c){logger[_0xf07f('0x10')](_0xf07f('0x1d'),_0x1bbb5c[_0xf07f('0x12')],_0x55662a);_0xb995fe(_0x3b8290[_0xf07f('0x10')](0x1f4,_0x1bbb5c[_0xf07f('0x12')]));});});}; \ No newline at end of file +var _0x149f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','SquareOdbc,\x20%s,\x20%s','message','info','result','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','include','model','map','catch','lodash','util','moment'];(function(_0x4e5bfb,_0x62d628){var _0x1448d8=function(_0x1429e8){while(--_0x1429e8){_0x4e5bfb['push'](_0x4e5bfb['shift']());}};_0x1448d8(++_0x62d628);}(_0x149f,0x168));var _0xf149=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x149f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf149('0x0'));var util=require(_0xf149('0x1'));var moment=require(_0xf149('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf149('0x3'));var db=require(_0xf149('0x4'))['db'];var utils=require(_0xf149('0x5'));var logger=require(_0xf149('0x6'))(_0xf149('0x7'));var config=require(_0xf149('0x8'));var jayson=require(_0xf149('0x9'));var client=jayson[_0xf149('0xa')][_0xf149('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56cae3,_0x10e941,_0x4c40b0){return new BPromise(function(_0x58d8f6,_0x54831a){return client[_0xf149('0xc')](_0x56cae3,_0x4c40b0)[_0xf149('0xd')](function(_0x315dda){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x10e941,_0xf149('0xe'));logger[_0xf149('0xf')](_0xf149('0x10'),_0x10e941,_0xf149('0xe'),JSON[_0xf149('0x11')](_0x315dda));if(_0x315dda[_0xf149('0x12')]){if(_0x315dda['error']['code']===0x1f4){logger[_0xf149('0x12')](_0xf149('0x13'),_0x10e941,_0x315dda[_0xf149('0x12')]['message']);return _0x54831a(_0x315dda['error'][_0xf149('0x14')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x10e941,_0x315dda['error'][_0xf149('0x14')]);return _0x58d8f6(_0x315dda[_0xf149('0x12')][_0xf149('0x14')]);}else{logger[_0xf149('0x15')](_0xf149('0x13'),_0x10e941,'request\x20sent');_0x58d8f6(_0x315dda[_0xf149('0x16')]['message']);}})['catch'](function(_0x48ff76){logger[_0xf149('0x12')](_0xf149('0x13'),_0x10e941,_0x48ff76);_0x54831a(_0x48ff76);});});}exports[_0xf149('0x17')]=function(_0x223227){var _0x592ee5=this;return new Promise(function(_0x3eecc9,_0x20254f){return db[_0xf149('0x18')][_0xf149('0x19')]({'raw':_0x223227[_0xf149('0x1a')]?_0x223227[_0xf149('0x1a')][_0xf149('0x1b')]===undefined?!![]:![]:!![],'where':_0x223227[_0xf149('0x1a')]?_0x223227[_0xf149('0x1a')]['where']||null:null,'attributes':_0x223227[_0xf149('0x1a')]?_0x223227[_0xf149('0x1a')][_0xf149('0x1c')]||null:null,'include':_0x223227[_0xf149('0x1a')]?_0x223227[_0xf149('0x1a')][_0xf149('0x1d')]?_['map'](_0x223227[_0xf149('0x1a')][_0xf149('0x1d')],function(_0x438d70){return{'model':db[_0x438d70[_0xf149('0x1e')]],'as':_0x438d70['as'],'attributes':_0x438d70[_0xf149('0x1c')],'include':_0x438d70['include']?_['map'](_0x438d70[_0xf149('0x1d')],function(_0xd187e){return{'model':db[_0xd187e['model']],'as':_0xd187e['as'],'attributes':_0xd187e[_0xf149('0x1c')],'include':_0xd187e[_0xf149('0x1d')]?_[_0xf149('0x1f')](_0xd187e[_0xf149('0x1d')],function(_0x31f21e){return{'model':db[_0x31f21e[_0xf149('0x1e')]],'as':_0x31f21e['as'],'attributes':_0x31f21e[_0xf149('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf149('0xd')](function(_0x547cf3){logger[_0xf149('0x15')](_0xf149('0x17'),_0x223227);logger['debug']('ShowSquareOdbc',_0x223227,JSON['stringify'](_0x547cf3));_0x3eecc9(_0x547cf3);})[_0xf149('0x20')](function(_0x259bb2){logger[_0xf149('0x12')](_0xf149('0x17'),_0x259bb2['message'],_0x223227);_0x20254f(_0x592ee5[_0xf149('0x12')](0x1f4,_0x259bb2[_0xf149('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 3586866..2f11bf9 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 _0xb5fa=['post','create','addUsers','put','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','/:id','isAuthenticated','/:id/users','getUsers'];(function(_0x51bbb1,_0x27fd66){var _0x2d2ae8=function(_0x109de5){while(--_0x109de5){_0x51bbb1['push'](_0x51bbb1['shift']());}};_0x2d2ae8(++_0x27fd66);}(_0xb5fa,0xf8));var _0xab5f=function(_0x264a19,_0x41fb80){_0x264a19=_0x264a19-0x0;var _0x5c872f=_0xb5fa[_0x264a19];return _0x5c872f;};'use strict';var multer=require(_0xab5f('0x0'));var util=require(_0xab5f('0x1'));var path=require(_0xab5f('0x2'));var timeout=require(_0xab5f('0x3'));var express=require(_0xab5f('0x4'));var router=express[_0xab5f('0x5')]();var fs_extra=require(_0xab5f('0x6'));var auth=require(_0xab5f('0x7'));var interaction=require(_0xab5f('0x8'));var config=require(_0xab5f('0x9'));var controller=require(_0xab5f('0xa'));router[_0xab5f('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xab5f('0xc'),auth[_0xab5f('0xd')](),controller['show']);router[_0xab5f('0xb')](_0xab5f('0xe'),auth[_0xab5f('0xd')](),controller[_0xab5f('0xf')]);router[_0xab5f('0x10')]('/',auth['isAuthenticated'](),controller[_0xab5f('0x11')]);router['post'](_0xab5f('0xe'),auth['isAuthenticated'](),controller[_0xab5f('0x12')]);router[_0xab5f('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xab5f('0x14')](_0xab5f('0xc'),auth['isAuthenticated'](),controller[_0xab5f('0x15')]);router[_0xab5f('0x14')](_0xab5f('0xe'),auth[_0xab5f('0xd')](),controller[_0xab5f('0x16')]);module[_0xab5f('0x17')]=router; \ No newline at end of file +var _0xa3fe=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','getUsers','create','post','/:id/users','/:id','update','delete','removeUsers','exports','multer','path','connect-timeout','Router'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa3fe,0xd8));var _0xea3f=function(_0x298f6f,_0x1caad6){_0x298f6f=_0x298f6f-0x0;var _0x33abe8=_0xa3fe[_0x298f6f];return _0x33abe8;};'use strict';var multer=require(_0xea3f('0x0'));var util=require('util');var path=require(_0xea3f('0x1'));var timeout=require(_0xea3f('0x2'));var express=require('express');var router=express[_0xea3f('0x3')]();var fs_extra=require(_0xea3f('0x4'));var auth=require(_0xea3f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea3f('0x6'));var controller=require('./squareProject.controller');router[_0xea3f('0x7')]('/',auth[_0xea3f('0x8')](),controller[_0xea3f('0x9')]);router['get']('/:id',auth[_0xea3f('0x8')](),controller[_0xea3f('0xa')]);router[_0xea3f('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0xea3f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xea3f('0xc')]);router[_0xea3f('0xd')](_0xea3f('0xe'),auth['isAuthenticated'](),controller['addUsers']);router['put'](_0xea3f('0xf'),auth[_0xea3f('0x8')](),controller[_0xea3f('0x10')]);router[_0xea3f('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xea3f('0x11')](_0xea3f('0xe'),auth['isAuthenticated'](),controller[_0xea3f('0x12')]);module[_0xea3f('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index a0051c2..1798687 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 _0x5074=['STRING','name','TEXT','long','getDataValue','preproduction','utf8','BLOB','production','toString','DATE'];(function(_0x53efdf,_0x8a2087){var _0x5b2adb=function(_0x39204d){while(--_0x39204d){_0x53efdf['push'](_0x53efdf['shift']());}};_0x5b2adb(++_0x8a2087);}(_0x5074,0x6e));var _0x4507=function(_0x5ad0d7,_0x2645f8){_0x5ad0d7=_0x5ad0d7-0x0;var _0xd83bd=_0x5074[_0x5ad0d7];return _0xd83bd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4507('0x0')],'unique':_0x4507('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x4507('0x0')]},'notes':{'type':Sequelize[_0x4507('0x2')]},'preproduction':{'type':Sequelize['BLOB'](_0x4507('0x3')),'get':function(){if(this[_0x4507('0x4')](_0x4507('0x5'))){return this[_0x4507('0x4')](_0x4507('0x5'))['toString'](_0x4507('0x6'));}}},'production':{'type':Sequelize[_0x4507('0x7')](_0x4507('0x3')),'get':function(){if(this[_0x4507('0x4')](_0x4507('0x8'))){return this[_0x4507('0x4')](_0x4507('0x8'))[_0x4507('0x9')](_0x4507('0x6'));}}},'savedAt':{'type':Sequelize[_0x4507('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x363e=['sequelize','exports','name','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE'];(function(_0xe8d594,_0x5bf01c){var _0x52de47=function(_0x263299){while(--_0x263299){_0xe8d594['push'](_0xe8d594['shift']());}};_0x52de47(++_0x5bf01c);}(_0x363e,0x179));var _0xe363=function(_0x298f5b,_0xf3d6fb){_0x298f5b=_0x298f5b-0x0;var _0x558330=_0x363e[_0x298f5b];return _0x558330;};'use strict';var Sequelize=require(_0xe363('0x0'));module[_0xe363('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe363('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xe363('0x3')]},'notes':{'type':Sequelize[_0xe363('0x4')]},'preproduction':{'type':Sequelize[_0xe363('0x5')](_0xe363('0x6')),'get':function(){if(this[_0xe363('0x7')](_0xe363('0x8'))){return this[_0xe363('0x7')](_0xe363('0x8'))[_0xe363('0x9')](_0xe363('0xa'));}}},'production':{'type':Sequelize['BLOB'](_0xe363('0x6')),'get':function(){if(this[_0xe363('0x7')](_0xe363('0xb'))){return this[_0xe363('0x7')]('production')[_0xe363('0x9')](_0xe363('0xa'));}}},'savedAt':{'type':Sequelize[_0xe363('0xc')]},'publishedAt':{'type':Sequelize[_0xe363('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 5473e18..f44a354 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 _0xdadf=['count','offset','set','Content-Range','json','apply','reject','save','update','then','get','SquareProjects','UserProfileResource','end','error','stack','name','index','map','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','SquareProject','includeAll','include','rows','catch','show','create','body','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','addUsers','omit','ids','emit','userSquareProject:remove','findOne','rawAttributes','sort','pick','nolimit','getUsers','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','undefined','limit'];(function(_0x5304fa,_0x4d3642){var _0x193640=function(_0x396e5d){while(--_0x396e5d){_0x5304fa['push'](_0x5304fa['shift']());}};_0x193640(++_0x4d3642);}(_0xdadf,0x103));var _0xfdad=function(_0x8e9afc,_0x25c3af){_0x8e9afc=_0x8e9afc-0x0;var _0x300af7=_0xdadf[_0x8e9afc];return _0x300af7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfdad('0x0'));var jsonpatch=require(_0xfdad('0x1'));var rp=require(_0xfdad('0x2'));var moment=require(_0xfdad('0x3'));var BPromise=require(_0xfdad('0x4'));var Mustache=require(_0xfdad('0x5'));var util=require(_0xfdad('0x6'));var path=require(_0xfdad('0x7'));var sox=require('sox');var csv=require(_0xfdad('0x8'));var ejs=require(_0xfdad('0x9'));var fs=require('fs');var fs_extra=require(_0xfdad('0xa'));var _=require(_0xfdad('0xb'));var squel=require(_0xfdad('0xc'));var crypto=require(_0xfdad('0xd'));var jsforce=require(_0xfdad('0xe'));var deskjs=require(_0xfdad('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfdad('0x10'));var Redis=require(_0xfdad('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfdad('0x12'));var as=require(_0xfdad('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfdad('0x14'));var utils=require(_0xfdad('0x15'));var config=require(_0xfdad('0x16'));var licenseUtil=require(_0xfdad('0x17'));var db=require(_0xfdad('0x18'))['db'];config['redis']=_[_0xfdad('0x19')](config[_0xfdad('0x1a')],{'host':_0xfdad('0x1b'),'port':0x18eb});var socket=require(_0xfdad('0x1c'))(new Redis(config['redis']));require(_0xfdad('0x1d'))[_0xfdad('0x1e')](socket);function respondWithStatusCode(_0x83ed99,_0x5ac6be){_0x5ac6be=_0x5ac6be||0xcc;return function(_0x33d3f2){if(_0x33d3f2){return _0x83ed99[_0xfdad('0x1f')](_0x5ac6be);}return _0x83ed99['status'](_0x5ac6be)['end']();};}function respondWithResult(_0x5615c1,_0x4bff42){_0x4bff42=_0x4bff42||0xc8;return function(_0x50b685){if(_0x50b685){return _0x5615c1[_0xfdad('0x20')](_0x4bff42)['json'](_0x50b685);}};}function respondWithFilteredResult(_0x333f76,_0x5d4561){return function(_0x12bc12){if(_0x12bc12){var _0x378bc3=typeof _0x5d4561['offset']===_0xfdad('0x21')&&typeof _0x5d4561[_0xfdad('0x22')]===_0xfdad('0x21');var _0x5a385b=_0x12bc12[_0xfdad('0x23')];var _0x197179=_0x378bc3?0x0:_0x5d4561[_0xfdad('0x24')];var _0x169ee5=_0x378bc3?_0x12bc12[_0xfdad('0x23')]:_0x5d4561[_0xfdad('0x24')]+_0x5d4561[_0xfdad('0x22')];var _0x4d8980;if(_0x169ee5>=_0x5a385b){_0x169ee5=_0x5a385b;_0x4d8980=0xc8;}else{_0x4d8980=0xce;}_0x333f76[_0xfdad('0x20')](_0x4d8980);return _0x333f76[_0xfdad('0x25')](_0xfdad('0x26'),_0x197179+'-'+_0x169ee5+'/'+_0x5a385b)[_0xfdad('0x27')](_0x12bc12);}return null;};}function patchUpdates(_0x2b4ac2){return function(_0x286d98){try{jsonpatch[_0xfdad('0x28')](_0x286d98,_0x2b4ac2,!![]);}catch(_0x301976){return BPromise[_0xfdad('0x29')](_0x301976);}return _0x286d98[_0xfdad('0x2a')]();};}function saveUpdates(_0x5743aa,_0x418237){return function(_0x1cd775){if(_0x1cd775){return _0x1cd775[_0xfdad('0x2b')](_0x5743aa)[_0xfdad('0x2c')](function(_0x342002){return _0x342002;});}return null;};}function removeEntity(_0x178a7f,_0x1842c0){return function(_0x3c5b24){if(_0x3c5b24){return _0x3c5b24['destroy']()[_0xfdad('0x2c')](function(){var _0x5e7b4e=_0x3c5b24[_0xfdad('0x2d')]({'plain':!![]});var _0x2ba500=_0xfdad('0x2e');return db[_0xfdad('0x2f')]['destroy']({'where':{'type':_0x2ba500,'resourceId':_0x5e7b4e['id']}})['then'](function(){return _0x3c5b24;});})[_0xfdad('0x2c')](function(){_0x178a7f[_0xfdad('0x20')](0xcc)[_0xfdad('0x30')]();});}};}function handleEntityNotFound(_0x182985,_0x3f4655){return function(_0x9c7c22){if(!_0x9c7c22){_0x182985[_0xfdad('0x1f')](0x194);}return _0x9c7c22;};}function handleError(_0x5c60d9,_0x24c911){_0x24c911=_0x24c911||0x1f4;return function(_0x171504){logger[_0xfdad('0x31')](_0x171504[_0xfdad('0x32')]);if(_0x171504[_0xfdad('0x33')]){delete _0x171504[_0xfdad('0x33')];}_0x5c60d9['status'](_0x24c911)['send'](_0x171504);};}exports[_0xfdad('0x34')]=function(_0x1e4e97,_0x58a30c){var _0x2a2227={},_0x8bab58={},_0x39b104={'count':0x0,'rows':[]};var _0x26d1b6=_[_0xfdad('0x35')](db['SquareProject']['rawAttributes'],function(_0xfddd8e){return{'name':_0xfddd8e[_0xfdad('0x36')],'type':_0xfddd8e['type'][_0xfdad('0x37')]};});_0x8bab58['model']=_[_0xfdad('0x35')](_0x26d1b6,'name');_0x8bab58['query']=_[_0xfdad('0x38')](_0x1e4e97[_0xfdad('0x39')]);_0x8bab58[_0xfdad('0x3a')]=_[_0xfdad('0x3b')](_0x8bab58[_0xfdad('0x3c')],_0x8bab58[_0xfdad('0x39')]);_0x2a2227[_0xfdad('0x3d')]=_[_0xfdad('0x3b')](_0x8bab58[_0xfdad('0x3c')],qs[_0xfdad('0x3e')](_0x1e4e97[_0xfdad('0x39')][_0xfdad('0x3e')]));_0x2a2227[_0xfdad('0x3d')]=_0x2a2227[_0xfdad('0x3d')][_0xfdad('0x3f')]?_0x2a2227[_0xfdad('0x3d')]:_0x8bab58['model'];if(!_0x1e4e97[_0xfdad('0x39')][_0xfdad('0x40')]('nolimit')){_0x2a2227[_0xfdad('0x22')]=qs[_0xfdad('0x22')](_0x1e4e97[_0xfdad('0x39')][_0xfdad('0x22')]);_0x2a2227[_0xfdad('0x24')]=qs[_0xfdad('0x24')](_0x1e4e97[_0xfdad('0x39')][_0xfdad('0x24')]);}_0x2a2227[_0xfdad('0x41')]=qs['sort'](_0x1e4e97[_0xfdad('0x39')]['sort']);_0x2a2227[_0xfdad('0x42')]=qs[_0xfdad('0x3a')](_['pick'](_0x1e4e97['query'],_0x8bab58['filters']),_0x26d1b6);if(_0x1e4e97[_0xfdad('0x39')][_0xfdad('0x43')]){_0x2a2227[_0xfdad('0x42')]=_[_0xfdad('0x44')](_0x2a2227[_0xfdad('0x42')],{'$or':_[_0xfdad('0x35')](_0x26d1b6,function(_0x476ef3){if(_0x476ef3['type']!==_0xfdad('0x45')){var _0x42492={};_0x42492[_0x476ef3[_0xfdad('0x33')]]={'$like':'%'+_0x1e4e97[_0xfdad('0x39')][_0xfdad('0x43')]+'%'};return _0x42492;}})});}_0x2a2227=_[_0xfdad('0x44')]({},_0x2a2227,_0x1e4e97[_0xfdad('0x46')]);var _0x21316e={'where':_0x2a2227[_0xfdad('0x42')]};return db[_0xfdad('0x47')]['count'](_0x21316e)[_0xfdad('0x2c')](function(_0x3bcd63){_0x39b104[_0xfdad('0x23')]=_0x3bcd63;if(_0x1e4e97[_0xfdad('0x39')][_0xfdad('0x48')]){_0x2a2227[_0xfdad('0x49')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x2a2227);})[_0xfdad('0x2c')](function(_0x9bdf6e){_0x39b104[_0xfdad('0x4a')]=_0x9bdf6e;return _0x39b104;})['then'](respondWithFilteredResult(_0x58a30c,_0x2a2227))[_0xfdad('0x4b')](handleError(_0x58a30c,null));};exports[_0xfdad('0x4c')]=function(_0x11c737,_0x3c1984){var _0x5c8bdb={'raw':![],'where':{'id':_0x11c737['params']['id']}},_0x2c0661={};_0x2c0661[_0xfdad('0x3c')]=_[_0xfdad('0x38')](db['SquareProject']['rawAttributes']);_0x2c0661['query']=_[_0xfdad('0x38')](_0x11c737['query']);_0x2c0661[_0xfdad('0x3a')]=_[_0xfdad('0x3b')](_0x2c0661[_0xfdad('0x3c')],_0x2c0661[_0xfdad('0x39')]);_0x5c8bdb[_0xfdad('0x3d')]=_['intersection'](_0x2c0661['model'],qs[_0xfdad('0x3e')](_0x11c737[_0xfdad('0x39')][_0xfdad('0x3e')]));_0x5c8bdb['attributes']=_0x5c8bdb[_0xfdad('0x3d')]['length']?_0x5c8bdb['attributes']:_0x2c0661[_0xfdad('0x3c')];if(_0x11c737[_0xfdad('0x39')][_0xfdad('0x48')]){_0x5c8bdb[_0xfdad('0x49')]=[{'all':!![]}];}_0x5c8bdb=_[_0xfdad('0x44')]({},_0x5c8bdb,_0x11c737['options']);return db['SquareProject']['find'](_0x5c8bdb)['then'](handleEntityNotFound(_0x3c1984,null))[_0xfdad('0x2c')](respondWithResult(_0x3c1984,null))[_0xfdad('0x4b')](handleError(_0x3c1984,null));};exports[_0xfdad('0x4d')]=function(_0x1d5c4e,_0x3fc140){return db[_0xfdad('0x47')]['create'](_0x1d5c4e[_0xfdad('0x4e')],{})['then'](function(_0x25d33c){var _0xbc42c2=_0x1d5c4e[_0xfdad('0x4f')][_0xfdad('0x2d')]({'plain':!![]});if(!_0xbc42c2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbc42c2[_0xfdad('0x50')]===_0xfdad('0x4f')){var _0x2b8aeb=_0x25d33c[_0xfdad('0x2d')]({'plain':!![]});var _0x55ff32=_0xfdad('0x2e');return db[_0xfdad('0x51')][_0xfdad('0x52')]({'where':{'name':_0x55ff32,'userProfileId':_0xbc42c2['userProfileId']},'raw':!![]})[_0xfdad('0x2c')](function(_0x13a7b5){if(_0x13a7b5&&_0x13a7b5[_0xfdad('0x53')]===0x0){return db[_0xfdad('0x2f')][_0xfdad('0x4d')]({'name':_0x2b8aeb[_0xfdad('0x33')],'resourceId':_0x2b8aeb['id'],'type':_0x13a7b5[_0xfdad('0x33')],'sectionId':_0x13a7b5['id']},{})['then'](function(){return _0x25d33c;});}else{return _0x25d33c;}})[_0xfdad('0x4b')](function(_0x29fa77){logger[_0xfdad('0x31')](_0xfdad('0x54'),_0x29fa77);throw _0x29fa77;});}return _0x25d33c;})[_0xfdad('0x2c')](respondWithResult(_0x3fc140,0xc9))[_0xfdad('0x4b')](handleError(_0x3fc140,null));};exports[_0xfdad('0x2b')]=function(_0x9da877,_0x43367c){if(_0x9da877['body']['id']){delete _0x9da877[_0xfdad('0x4e')]['id'];}return db[_0xfdad('0x47')][_0xfdad('0x52')]({'where':{'id':_0x9da877[_0xfdad('0x55')]['id']}})['then'](handleEntityNotFound(_0x43367c,null))[_0xfdad('0x2c')](saveUpdates(_0x9da877['body'],null))[_0xfdad('0x2c')](respondWithResult(_0x43367c,null))[_0xfdad('0x4b')](handleError(_0x43367c,null));};exports[_0xfdad('0x56')]=function(_0x560f30,_0x46112c){return db[_0xfdad('0x47')]['find']({'where':{'id':_0x560f30[_0xfdad('0x55')]['id']}})['then'](handleEntityNotFound(_0x46112c,null))[_0xfdad('0x2c')](removeEntity(_0x46112c,null))[_0xfdad('0x4b')](handleError(_0x46112c,null));};exports[_0xfdad('0x57')]=function(_0xa407b,_0x51ab2b,_0x3ded1a){return db[_0xfdad('0x47')][_0xfdad('0x52')]({'where':{'id':_0xa407b[_0xfdad('0x55')]['id']}})[_0xfdad('0x2c')](handleEntityNotFound(_0x51ab2b,null))['then'](function(_0x3863dd){if(_0x3863dd){return _0x3863dd['addUsers'](_0xa407b[_0xfdad('0x4e')]['ids'],_[_0xfdad('0x58')](_0xa407b[_0xfdad('0x4e')],['ids','id'])||{});}})['then'](respondWithResult(_0x51ab2b,null))[_0xfdad('0x4b')](handleError(_0x51ab2b,null));};exports['removeUsers']=function(_0x225ec7,_0x5562fa,_0x3238d7){return db['SquareProject']['find']({'where':{'id':_0x225ec7[_0xfdad('0x55')]['id']}})[_0xfdad('0x2c')](handleEntityNotFound(_0x5562fa,null))[_0xfdad('0x2c')](function(_0x2b3c7b){if(_0x2b3c7b){return _0x2b3c7b['removeUsers'](_0x225ec7[_0xfdad('0x39')][_0xfdad('0x59')])[_0xfdad('0x2c')](function(){if(_['isArray'](_0x225ec7[_0xfdad('0x39')]['ids'])){for(var _0x216371=0x0;_0x216371<_0x225ec7[_0xfdad('0x39')]['ids'][_0xfdad('0x3f')];_0x216371+=0x1){socket[_0xfdad('0x5a')]('userSquareProject:remove',{'UserId':Number(_0x225ec7[_0xfdad('0x39')][_0xfdad('0x59')][_0x216371]),'SquareProjectId':Number(_0x225ec7[_0xfdad('0x55')]['id'])});}}else{socket[_0xfdad('0x5a')](_0xfdad('0x5b'),{'UserId':Number(_0x225ec7['query']['ids']),'SquareProjectId':Number(_0x225ec7['params']['id'])});}});}})[_0xfdad('0x2c')](respondWithStatusCode(_0x5562fa,null))[_0xfdad('0x4b')](handleError(_0x5562fa,null));};exports['getUsers']=function(_0x53287b,_0x4c1b1a,_0x496484){var _0x3ce7ed={};var _0x4e5607={};var _0x6dd443;var _0x424b40;return db[_0xfdad('0x47')][_0xfdad('0x5c')]({'where':{'id':_0x53287b[_0xfdad('0x55')]['id']}})[_0xfdad('0x2c')](handleEntityNotFound(_0x4c1b1a,null))[_0xfdad('0x2c')](function(_0x44facc){if(_0x44facc){_0x6dd443=_0x44facc;_0x4e5607[_0xfdad('0x3c')]=_[_0xfdad('0x38')](db['User'][_0xfdad('0x5d')]);_0x4e5607[_0xfdad('0x39')]=_[_0xfdad('0x38')](_0x53287b[_0xfdad('0x39')]);_0x4e5607['filters']=_[_0xfdad('0x3b')](_0x4e5607['model'],_0x4e5607[_0xfdad('0x39')]);_0x3ce7ed[_0xfdad('0x3d')]=_[_0xfdad('0x3b')](_0x4e5607['model'],qs[_0xfdad('0x3e')](_0x53287b[_0xfdad('0x39')]['fields']));_0x3ce7ed[_0xfdad('0x3d')]=_0x3ce7ed[_0xfdad('0x3d')][_0xfdad('0x3f')]?_0x3ce7ed[_0xfdad('0x3d')]:_0x4e5607[_0xfdad('0x3c')];_0x3ce7ed['order']=qs[_0xfdad('0x5e')](_0x53287b[_0xfdad('0x39')][_0xfdad('0x5e')]);_0x3ce7ed[_0xfdad('0x42')]=qs[_0xfdad('0x3a')](_[_0xfdad('0x5f')](_0x53287b[_0xfdad('0x39')],_0x4e5607['filters']));if(_0x53287b[_0xfdad('0x39')]['filter']){_0x3ce7ed[_0xfdad('0x42')]=_[_0xfdad('0x44')](_0x3ce7ed[_0xfdad('0x42')],{'$or':_[_0xfdad('0x35')](_0x3ce7ed[_0xfdad('0x3d')],function(_0x233c9e){var _0x26f00b={};_0x26f00b[_0x233c9e]={'$like':'%'+_0x53287b['query'][_0xfdad('0x43')]+'%'};return _0x26f00b;})});}_0x3ce7ed=_[_0xfdad('0x44')]({},_0x3ce7ed,_0x53287b[_0xfdad('0x46')]);return _0x6dd443['getUsers'](_0x3ce7ed);}})[_0xfdad('0x2c')](function(_0x38b089){if(_0x38b089){_0x424b40=_0x38b089[_0xfdad('0x3f')];if(!_0x53287b[_0xfdad('0x39')][_0xfdad('0x40')](_0xfdad('0x60'))){_0x3ce7ed['limit']=qs[_0xfdad('0x22')](_0x53287b[_0xfdad('0x39')][_0xfdad('0x22')]);_0x3ce7ed[_0xfdad('0x24')]=qs['offset'](_0x53287b[_0xfdad('0x39')][_0xfdad('0x24')]);}return _0x6dd443[_0xfdad('0x61')](_0x3ce7ed);}})['then'](function(_0x1bfa9f){if(_0x1bfa9f){return _0x1bfa9f?{'count':_0x424b40,'rows':_0x1bfa9f}:null;}})[_0xfdad('0x2c')](respondWithResult(_0x4c1b1a,null))[_0xfdad('0x4b')](handleError(_0x4c1b1a,null));}; \ No newline at end of file +var _0xee2d=['send','index','SquareProject','rawAttributes','fieldName','type','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','error','addUsers','ids','omit','emit','userSquareProject:remove','getUsers','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','redis','./squareProject.socket','register','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','SquareProjects','stack','name'];(function(_0x274b72,_0x26a049){var _0x15280c=function(_0x5281b0){while(--_0x5281b0){_0x274b72['push'](_0x274b72['shift']());}};_0x15280c(++_0x26a049);}(_0xee2d,0xdd));var _0xdee2=function(_0x59f244,_0x249db3){_0x59f244=_0x59f244-0x0;var _0x3cef17=_0xee2d[_0x59f244];return _0x3cef17;};'use strict';var emlformat=require(_0xdee2('0x0'));var rimraf=require(_0xdee2('0x1'));var zipdir=require(_0xdee2('0x2'));var jsonpatch=require(_0xdee2('0x3'));var rp=require(_0xdee2('0x4'));var moment=require(_0xdee2('0x5'));var BPromise=require(_0xdee2('0x6'));var Mustache=require(_0xdee2('0x7'));var util=require(_0xdee2('0x8'));var path=require(_0xdee2('0x9'));var sox=require(_0xdee2('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdee2('0xb'));var squel=require(_0xdee2('0xc'));var crypto=require(_0xdee2('0xd'));var jsforce=require(_0xdee2('0xe'));var deskjs=require(_0xdee2('0xf'));var toCsv=require(_0xdee2('0x10'));var querystring=require('querystring');var Papa=require(_0xdee2('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdee2('0x12'));var hardwareService=require(_0xdee2('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdee2('0x14'))['db'];config['redis']=_['defaults'](config[_0xdee2('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdee2('0x15')]));require(_0xdee2('0x16'))[_0xdee2('0x17')](socket);function respondWithStatusCode(_0x17ab90,_0x186a4a){_0x186a4a=_0x186a4a||0xcc;return function(_0x18aabc){if(_0x18aabc){return _0x17ab90['sendStatus'](_0x186a4a);}return _0x17ab90['status'](_0x186a4a)['end']();};}function respondWithResult(_0x2dff0a,_0x29378a){_0x29378a=_0x29378a||0xc8;return function(_0x92a67e){if(_0x92a67e){return _0x2dff0a[_0xdee2('0x18')](_0x29378a)[_0xdee2('0x19')](_0x92a67e);}};}function respondWithFilteredResult(_0x124a78,_0x18520e){return function(_0x1d8c82){if(_0x1d8c82){var _0x15d585=typeof _0x18520e['offset']==='undefined'&&typeof _0x18520e[_0xdee2('0x1a')]===_0xdee2('0x1b');var _0x4201c9=_0x1d8c82[_0xdee2('0x1c')];var _0x38015e=_0x15d585?0x0:_0x18520e[_0xdee2('0x1d')];var _0x136cdd=_0x15d585?_0x1d8c82[_0xdee2('0x1c')]:_0x18520e[_0xdee2('0x1d')]+_0x18520e[_0xdee2('0x1a')];var _0x7e271d;if(_0x136cdd>=_0x4201c9){_0x136cdd=_0x4201c9;_0x7e271d=0xc8;}else{_0x7e271d=0xce;}_0x124a78[_0xdee2('0x18')](_0x7e271d);return _0x124a78['set'](_0xdee2('0x1e'),_0x38015e+'-'+_0x136cdd+'/'+_0x4201c9)[_0xdee2('0x19')](_0x1d8c82);}return null;};}function patchUpdates(_0x14d1d9){return function(_0x1935c4){try{jsonpatch[_0xdee2('0x1f')](_0x1935c4,_0x14d1d9,!![]);}catch(_0x390a15){return BPromise[_0xdee2('0x20')](_0x390a15);}return _0x1935c4[_0xdee2('0x21')]();};}function saveUpdates(_0x5c93bd,_0x3eea76){return function(_0xf30535){if(_0xf30535){return _0xf30535[_0xdee2('0x22')](_0x5c93bd)[_0xdee2('0x23')](function(_0x48d699){return _0x48d699;});}return null;};}function removeEntity(_0x33408c,_0x5ded40){return function(_0x3675cc){if(_0x3675cc){return _0x3675cc[_0xdee2('0x24')]()[_0xdee2('0x23')](function(){var _0x5c2844=_0x3675cc['get']({'plain':!![]});var _0x47ad5c=_0xdee2('0x25');return db['UserProfileResource'][_0xdee2('0x24')]({'where':{'type':_0x47ad5c,'resourceId':_0x5c2844['id']}})[_0xdee2('0x23')](function(){return _0x3675cc;});})[_0xdee2('0x23')](function(){_0x33408c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b2c9c,_0x18de1c){return function(_0x1aa1d7){if(!_0x1aa1d7){_0x2b2c9c['sendStatus'](0x194);}return _0x1aa1d7;};}function handleError(_0x1367e3,_0x3dddfd){_0x3dddfd=_0x3dddfd||0x1f4;return function(_0x384a08){logger['error'](_0x384a08[_0xdee2('0x26')]);if(_0x384a08['name']){delete _0x384a08[_0xdee2('0x27')];}_0x1367e3['status'](_0x3dddfd)[_0xdee2('0x28')](_0x384a08);};}exports[_0xdee2('0x29')]=function(_0x8c43e6,_0x3de2d7){var _0x453b98={},_0x5a58cd={},_0x578a5c={'count':0x0,'rows':[]};var _0x2d3363=_['map'](db[_0xdee2('0x2a')][_0xdee2('0x2b')],function(_0x3f14a8){return{'name':_0x3f14a8[_0xdee2('0x2c')],'type':_0x3f14a8[_0xdee2('0x2d')]['key']};});_0x5a58cd[_0xdee2('0x2e')]=_[_0xdee2('0x2f')](_0x2d3363,'name');_0x5a58cd['query']=_[_0xdee2('0x30')](_0x8c43e6['query']);_0x5a58cd['filters']=_[_0xdee2('0x31')](_0x5a58cd[_0xdee2('0x2e')],_0x5a58cd[_0xdee2('0x32')]);_0x453b98[_0xdee2('0x33')]=_[_0xdee2('0x31')](_0x5a58cd['model'],qs[_0xdee2('0x34')](_0x8c43e6['query']['fields']));_0x453b98['attributes']=_0x453b98[_0xdee2('0x33')][_0xdee2('0x35')]?_0x453b98['attributes']:_0x5a58cd[_0xdee2('0x2e')];if(!_0x8c43e6['query'][_0xdee2('0x36')](_0xdee2('0x37'))){_0x453b98[_0xdee2('0x1a')]=qs[_0xdee2('0x1a')](_0x8c43e6['query'][_0xdee2('0x1a')]);_0x453b98[_0xdee2('0x1d')]=qs['offset'](_0x8c43e6[_0xdee2('0x32')][_0xdee2('0x1d')]);}_0x453b98[_0xdee2('0x38')]=qs['sort'](_0x8c43e6[_0xdee2('0x32')][_0xdee2('0x39')]);_0x453b98[_0xdee2('0x3a')]=qs['filters'](_[_0xdee2('0x3b')](_0x8c43e6[_0xdee2('0x32')],_0x5a58cd[_0xdee2('0x3c')]),_0x2d3363);if(_0x8c43e6[_0xdee2('0x32')]['filter']){_0x453b98[_0xdee2('0x3a')]=_[_0xdee2('0x3d')](_0x453b98[_0xdee2('0x3a')],{'$or':_['map'](_0x2d3363,function(_0x17e56e){if(_0x17e56e[_0xdee2('0x2d')]!==_0xdee2('0x3e')){var _0x3c9933={};_0x3c9933[_0x17e56e[_0xdee2('0x27')]]={'$like':'%'+_0x8c43e6[_0xdee2('0x32')][_0xdee2('0x3f')]+'%'};return _0x3c9933;}})});}_0x453b98=_[_0xdee2('0x3d')]({},_0x453b98,_0x8c43e6[_0xdee2('0x40')]);var _0x263dde={'where':_0x453b98[_0xdee2('0x3a')]};return db['SquareProject'][_0xdee2('0x1c')](_0x263dde)[_0xdee2('0x23')](function(_0x1c5e2c){_0x578a5c['count']=_0x1c5e2c;if(_0x8c43e6[_0xdee2('0x32')][_0xdee2('0x41')]){_0x453b98[_0xdee2('0x42')]=[{'all':!![]}];}return db[_0xdee2('0x2a')][_0xdee2('0x43')](_0x453b98);})[_0xdee2('0x23')](function(_0x551f60){_0x578a5c['rows']=_0x551f60;return _0x578a5c;})[_0xdee2('0x23')](respondWithFilteredResult(_0x3de2d7,_0x453b98))[_0xdee2('0x44')](handleError(_0x3de2d7,null));};exports[_0xdee2('0x45')]=function(_0x2fb903,_0x50cc3b){var _0x317310={'raw':![],'where':{'id':_0x2fb903[_0xdee2('0x46')]['id']}},_0x317fc1={};_0x317fc1['model']=_[_0xdee2('0x30')](db['SquareProject'][_0xdee2('0x2b')]);_0x317fc1[_0xdee2('0x32')]=_[_0xdee2('0x30')](_0x2fb903[_0xdee2('0x32')]);_0x317fc1[_0xdee2('0x3c')]=_[_0xdee2('0x31')](_0x317fc1[_0xdee2('0x2e')],_0x317fc1[_0xdee2('0x32')]);_0x317310[_0xdee2('0x33')]=_[_0xdee2('0x31')](_0x317fc1[_0xdee2('0x2e')],qs['fields'](_0x2fb903['query'][_0xdee2('0x34')]));_0x317310[_0xdee2('0x33')]=_0x317310[_0xdee2('0x33')][_0xdee2('0x35')]?_0x317310[_0xdee2('0x33')]:_0x317fc1['model'];if(_0x2fb903['query'][_0xdee2('0x41')]){_0x317310[_0xdee2('0x42')]=[{'all':!![]}];}_0x317310=_['merge']({},_0x317310,_0x2fb903[_0xdee2('0x40')]);return db[_0xdee2('0x2a')][_0xdee2('0x47')](_0x317310)[_0xdee2('0x23')](handleEntityNotFound(_0x50cc3b,null))[_0xdee2('0x23')](respondWithResult(_0x50cc3b,null))[_0xdee2('0x44')](handleError(_0x50cc3b,null));};exports[_0xdee2('0x48')]=function(_0x5ad95a,_0x56b719){return db[_0xdee2('0x2a')][_0xdee2('0x48')](_0x5ad95a[_0xdee2('0x49')],{})[_0xdee2('0x23')](function(_0x306733){var _0x2966a0=_0x5ad95a['user'][_0xdee2('0x4a')]({'plain':!![]});if(!_0x2966a0)throw new Error(_0xdee2('0x4b'));if(_0x2966a0['role']==='user'){var _0x4fe12c=_0x306733[_0xdee2('0x4a')]({'plain':!![]});var _0x2ce915=_0xdee2('0x25');return db[_0xdee2('0x4c')][_0xdee2('0x47')]({'where':{'name':_0x2ce915,'userProfileId':_0x2966a0[_0xdee2('0x4d')]},'raw':!![]})[_0xdee2('0x23')](function(_0x4aa96c){if(_0x4aa96c&&_0x4aa96c['autoAssociation']===0x0){return db[_0xdee2('0x4e')][_0xdee2('0x48')]({'name':_0x4fe12c['name'],'resourceId':_0x4fe12c['id'],'type':_0x4aa96c['name'],'sectionId':_0x4aa96c['id']},{})[_0xdee2('0x23')](function(){return _0x306733;});}else{return _0x306733;}})[_0xdee2('0x44')](function(_0x12b58d){logger[_0xdee2('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12b58d);throw _0x12b58d;});}return _0x306733;})[_0xdee2('0x23')](respondWithResult(_0x56b719,0xc9))[_0xdee2('0x44')](handleError(_0x56b719,null));};exports[_0xdee2('0x22')]=function(_0xbb23ae,_0x5afd1d){if(_0xbb23ae[_0xdee2('0x49')]['id']){delete _0xbb23ae[_0xdee2('0x49')]['id'];}return db[_0xdee2('0x2a')]['find']({'where':{'id':_0xbb23ae[_0xdee2('0x46')]['id']}})[_0xdee2('0x23')](handleEntityNotFound(_0x5afd1d,null))['then'](saveUpdates(_0xbb23ae[_0xdee2('0x49')],null))[_0xdee2('0x23')](respondWithResult(_0x5afd1d,null))[_0xdee2('0x44')](handleError(_0x5afd1d,null));};exports[_0xdee2('0x24')]=function(_0x84f6fc,_0x40f4a8){return db[_0xdee2('0x2a')]['find']({'where':{'id':_0x84f6fc[_0xdee2('0x46')]['id']}})['then'](handleEntityNotFound(_0x40f4a8,null))[_0xdee2('0x23')](removeEntity(_0x40f4a8,null))[_0xdee2('0x44')](handleError(_0x40f4a8,null));};exports[_0xdee2('0x50')]=function(_0x180413,_0x50db14,_0x2958d0){return db[_0xdee2('0x2a')][_0xdee2('0x47')]({'where':{'id':_0x180413[_0xdee2('0x46')]['id']}})['then'](handleEntityNotFound(_0x50db14,null))[_0xdee2('0x23')](function(_0x1d8d2e){if(_0x1d8d2e){return _0x1d8d2e[_0xdee2('0x50')](_0x180413[_0xdee2('0x49')][_0xdee2('0x51')],_[_0xdee2('0x52')](_0x180413[_0xdee2('0x49')],[_0xdee2('0x51'),'id'])||{});}})[_0xdee2('0x23')](respondWithResult(_0x50db14,null))[_0xdee2('0x44')](handleError(_0x50db14,null));};exports['removeUsers']=function(_0x10bb09,_0x49574c,_0x4f83af){return db[_0xdee2('0x2a')][_0xdee2('0x47')]({'where':{'id':_0x10bb09['params']['id']}})[_0xdee2('0x23')](handleEntityNotFound(_0x49574c,null))['then'](function(_0x232a55){if(_0x232a55){return _0x232a55['removeUsers'](_0x10bb09[_0xdee2('0x32')][_0xdee2('0x51')])[_0xdee2('0x23')](function(){if(_['isArray'](_0x10bb09['query'][_0xdee2('0x51')])){for(var _0x1bdf21=0x0;_0x1bdf21<_0x10bb09[_0xdee2('0x32')]['ids'][_0xdee2('0x35')];_0x1bdf21+=0x1){socket[_0xdee2('0x53')](_0xdee2('0x54'),{'UserId':Number(_0x10bb09[_0xdee2('0x32')][_0xdee2('0x51')][_0x1bdf21]),'SquareProjectId':Number(_0x10bb09['params']['id'])});}}else{socket[_0xdee2('0x53')](_0xdee2('0x54'),{'UserId':Number(_0x10bb09[_0xdee2('0x32')][_0xdee2('0x51')]),'SquareProjectId':Number(_0x10bb09[_0xdee2('0x46')]['id'])});}});}})[_0xdee2('0x23')](respondWithStatusCode(_0x49574c,null))['catch'](handleError(_0x49574c,null));};exports[_0xdee2('0x55')]=function(_0x4e43a3,_0x4107ed,_0x5f45e1){var _0x3d64f2={};var _0x91894f={};var _0x52a5ac;var _0x444fd9;return db[_0xdee2('0x2a')]['findOne']({'where':{'id':_0x4e43a3[_0xdee2('0x46')]['id']}})[_0xdee2('0x23')](handleEntityNotFound(_0x4107ed,null))['then'](function(_0x215c5c){if(_0x215c5c){_0x52a5ac=_0x215c5c;_0x91894f[_0xdee2('0x2e')]=_[_0xdee2('0x30')](db[_0xdee2('0x56')][_0xdee2('0x2b')]);_0x91894f[_0xdee2('0x32')]=_['keys'](_0x4e43a3[_0xdee2('0x32')]);_0x91894f[_0xdee2('0x3c')]=_['intersection'](_0x91894f['model'],_0x91894f[_0xdee2('0x32')]);_0x3d64f2[_0xdee2('0x33')]=_[_0xdee2('0x31')](_0x91894f[_0xdee2('0x2e')],qs[_0xdee2('0x34')](_0x4e43a3[_0xdee2('0x32')][_0xdee2('0x34')]));_0x3d64f2[_0xdee2('0x33')]=_0x3d64f2['attributes']['length']?_0x3d64f2['attributes']:_0x91894f[_0xdee2('0x2e')];_0x3d64f2['order']=qs[_0xdee2('0x39')](_0x4e43a3[_0xdee2('0x32')][_0xdee2('0x39')]);_0x3d64f2[_0xdee2('0x3a')]=qs[_0xdee2('0x3c')](_[_0xdee2('0x3b')](_0x4e43a3['query'],_0x91894f['filters']));if(_0x4e43a3[_0xdee2('0x32')]['filter']){_0x3d64f2[_0xdee2('0x3a')]=_[_0xdee2('0x3d')](_0x3d64f2['where'],{'$or':_[_0xdee2('0x2f')](_0x3d64f2[_0xdee2('0x33')],function(_0x4b49e2){var _0x512dd1={};_0x512dd1[_0x4b49e2]={'$like':'%'+_0x4e43a3[_0xdee2('0x32')][_0xdee2('0x3f')]+'%'};return _0x512dd1;})});}_0x3d64f2=_[_0xdee2('0x3d')]({},_0x3d64f2,_0x4e43a3[_0xdee2('0x40')]);return _0x52a5ac[_0xdee2('0x55')](_0x3d64f2);}})['then'](function(_0x5b3148){if(_0x5b3148){_0x444fd9=_0x5b3148[_0xdee2('0x35')];if(!_0x4e43a3[_0xdee2('0x32')][_0xdee2('0x36')]('nolimit')){_0x3d64f2[_0xdee2('0x1a')]=qs[_0xdee2('0x1a')](_0x4e43a3[_0xdee2('0x32')][_0xdee2('0x1a')]);_0x3d64f2[_0xdee2('0x1d')]=qs[_0xdee2('0x1d')](_0x4e43a3['query']['offset']);}return _0x52a5ac[_0xdee2('0x55')](_0x3d64f2);}})[_0xdee2('0x23')](function(_0x506b6b){if(_0x506b6b){return _0x506b6b?{'count':_0x444fd9,'rows':_0x506b6b}:null;}})[_0xdee2('0x23')](respondWithResult(_0x4107ed,null))[_0xdee2('0x44')](handleError(_0x4107ed,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 88c2dda..d91119f 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 _0x4274=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x416586,_0xbdf0b1){var _0x5cbb10=function(_0x274854){while(--_0x274854){_0x416586['push'](_0x416586['shift']());}};_0x5cbb10(++_0xbdf0b1);}(_0x4274,0x1e0));var _0x4427=function(_0x91e807,_0x4ce3d7){_0x91e807=_0x91e807-0x0;var _0x272a99=_0x4274[_0x91e807];return _0x272a99;};'use strict';var EventEmitter=require(_0x4427('0x0'));var SquareProject=require(_0x4427('0x1'))['db'][_0x4427('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x4427('0x3')](0x0);var events={'afterCreate':_0x4427('0x4'),'afterUpdate':_0x4427('0x5'),'afterDestroy':_0x4427('0x6')};function emitEvent(_0x3c4d07){return function(_0x4c62b2,_0x472bfa,_0x1b9667){SquareProjectEvents[_0x4427('0x7')](_0x3c4d07+':'+_0x4c62b2['id'],_0x4c62b2);SquareProjectEvents['emit'](_0x3c4d07,_0x4c62b2);_0x1b9667(null);};}for(var e in events){if(events[_0x4427('0x8')](e)){var event=events[e];SquareProject[_0x4427('0x9')](e,emitEvent(event));}}module[_0x4427('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0x6fa1=['hasOwnProperty','exports','SquareProject','setMaxListeners','remove','emit'];(function(_0x358b29,_0x5ed0ac){var _0x5457c8=function(_0x23748b){while(--_0x23748b){_0x358b29['push'](_0x358b29['shift']());}};_0x5457c8(++_0x5ed0ac);}(_0x6fa1,0x134));var _0x16fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6fa1[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0x16fa('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x16fa('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x16fa('0x2')};function emitEvent(_0x27ecf3){return function(_0xb69fa4,_0x30139f,_0x7b81ad){SquareProjectEvents['emit'](_0x27ecf3+':'+_0xb69fa4['id'],_0xb69fa4);SquareProjectEvents[_0x16fa('0x3')](_0x27ecf3,_0xb69fa4);_0x7b81ad(null);};}for(var e in events){if(events[_0x16fa('0x4')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x16fa('0x5')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 48af78b..a4b2147 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 _0x2cb1=['square_projects','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define'];(function(_0x307d17,_0x407db5){var _0x337c1b=function(_0x2e2603){while(--_0x2e2603){_0x307d17['push'](_0x307d17['shift']());}};_0x337c1b(++_0x407db5);}(_0x2cb1,0xc1));var _0x12cb=function(_0x57351c,_0x270cab){_0x57351c=_0x57351c-0x0;var _0x1b3a55=_0x2cb1[_0x57351c];return _0x1b3a55;};'use strict';var _=require('lodash');var util=require(_0x12cb('0x0'));var logger=require(_0x12cb('0x1'))(_0x12cb('0x2'));var moment=require('moment');var BPromise=require(_0x12cb('0x3'));var rp=require(_0x12cb('0x4'));var fs=require('fs');var path=require(_0x12cb('0x5'));var rimraf=require(_0x12cb('0x6'));var config=require(_0x12cb('0x7'));var attributes=require(_0x12cb('0x8'));module[_0x12cb('0x9')]=function(_0x380103,_0x209e69){return _0x380103[_0x12cb('0xa')]('SquareProject',attributes,{'tableName':_0x12cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e4f7e,_0x3cee5d,_0xabac1){if(_0x2e4f7e['changed'](_0x12cb('0xc'))){_0x2e4f7e['savedAt']=moment()[_0x12cb('0xd')](_0x12cb('0xe'));}if(_0x2e4f7e['changed'](_0x12cb('0xf'))){_0x2e4f7e[_0x12cb('0x10')]=moment()['format'](_0x12cb('0xe'));}_0xabac1(null,_0x2e4f7e);}}});}; \ No newline at end of file +var _0xc75a=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','SquareProject','savedAt','changed','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x381985,_0x56911e){var _0x1617bb=function(_0x54c47a){while(--_0x54c47a){_0x381985['push'](_0x381985['shift']());}};_0x1617bb(++_0x56911e);}(_0xc75a,0xb5));var _0xac75=function(_0xea6018,_0x4cf082){_0xea6018=_0xea6018-0x0;var _0x57b54d=_0xc75a[_0xea6018];return _0x57b54d;};'use strict';var _=require('lodash');var util=require(_0xac75('0x0'));var logger=require(_0xac75('0x1'))(_0xac75('0x2'));var moment=require('moment');var BPromise=require(_0xac75('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac75('0x4'));var rimraf=require(_0xac75('0x5'));var config=require(_0xac75('0x6'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x412f26,_0x35435e){return _0x412f26['define'](_0xac75('0x7'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1bb93c,_0x3be408,_0x2715c7){if(_0x1bb93c['changed']('preproduction')){_0x1bb93c[_0xac75('0x8')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1bb93c[_0xac75('0x9')]('production')){_0x1bb93c[_0xac75('0xa')]=moment()[_0xac75('0xb')](_0xac75('0xc'));}_0x2715c7(null,_0x1bb93c);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 72b8c88..4c707e7 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 _0xee0e=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSquareProject','find','options','raw','where','attributes','include','model','map','debug','lodash','util','moment','bluebird'];(function(_0x55734c,_0x5d4725){var _0x155efe=function(_0x4179a8){while(--_0x4179a8){_0x55734c['push'](_0x55734c['shift']());}};_0x155efe(++_0x5d4725);}(_0xee0e,0x71));var _0xeee0=function(_0x4503df,_0xfec122){_0x4503df=_0x4503df-0x0;var _0x3f1b2b=_0xee0e[_0x4503df];return _0x3f1b2b;};'use strict';var _=require(_0xeee0('0x0'));var util=require(_0xeee0('0x1'));var moment=require(_0xeee0('0x2'));var BPromise=require(_0xeee0('0x3'));var rs=require(_0xeee0('0x4'));var fs=require('fs');var Redis=require(_0xeee0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xeee0('0x6'));var logger=require(_0xeee0('0x7'))(_0xeee0('0x8'));var config=require(_0xeee0('0x9'));var jayson=require(_0xeee0('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xeee0('0xb')]=_[_0xeee0('0xc')](config[_0xeee0('0xb')],{'host':_0xeee0('0xd'),'port':0x18eb});var socket=require(_0xeee0('0xe'))(new Redis(config[_0xeee0('0xb')]));require(_0xeee0('0xf'))[_0xeee0('0x10')](socket);function respondWithRpcPromise(_0x54d430,_0x24049f,_0xce7b5){return new BPromise(function(_0x560dde,_0x55111a){return client[_0xeee0('0x11')](_0x54d430,_0xce7b5)[_0xeee0('0x12')](function(_0x46ea09){logger[_0xeee0('0x13')](_0xeee0('0x14'),_0x24049f,'request\x20sent');logger['debug'](_0xeee0('0x15'),_0x24049f,_0xeee0('0x16'),JSON[_0xeee0('0x17')](_0x46ea09));if(_0x46ea09[_0xeee0('0x18')]){if(_0x46ea09['error'][_0xeee0('0x19')]===0x1f4){logger[_0xeee0('0x18')](_0xeee0('0x14'),_0x24049f,_0x46ea09[_0xeee0('0x18')][_0xeee0('0x1a')]);return _0x55111a(_0x46ea09['error']['message']);}logger[_0xeee0('0x18')](_0xeee0('0x14'),_0x24049f,_0x46ea09[_0xeee0('0x18')]['message']);return _0x560dde(_0x46ea09[_0xeee0('0x18')][_0xeee0('0x1a')]);}else{logger['info'](_0xeee0('0x14'),_0x24049f,_0xeee0('0x16'));_0x560dde(_0x46ea09[_0xeee0('0x1b')][_0xeee0('0x1a')]);}})[_0xeee0('0x1c')](function(_0xf6ce44){logger[_0xeee0('0x18')](_0xeee0('0x14'),_0x24049f,_0xf6ce44);_0x55111a(_0xf6ce44);});});}exports[_0xeee0('0x1d')]=function(_0x202cdf){var _0x3c1f57=this;return new Promise(function(_0x317fdd,_0x265c1a){return db['SquareProject'][_0xeee0('0x1e')]({'raw':_0x202cdf[_0xeee0('0x1f')]?_0x202cdf[_0xeee0('0x1f')][_0xeee0('0x20')]===undefined?!![]:![]:!![],'where':_0x202cdf[_0xeee0('0x1f')]?_0x202cdf[_0xeee0('0x1f')][_0xeee0('0x21')]||null:null,'attributes':_0x202cdf['options']?_0x202cdf[_0xeee0('0x1f')][_0xeee0('0x22')]||null:null,'include':_0x202cdf[_0xeee0('0x1f')]?_0x202cdf[_0xeee0('0x1f')][_0xeee0('0x23')]?_['map'](_0x202cdf[_0xeee0('0x1f')][_0xeee0('0x23')],function(_0x3a1314){return{'model':db[_0x3a1314[_0xeee0('0x24')]],'as':_0x3a1314['as'],'attributes':_0x3a1314[_0xeee0('0x22')],'include':_0x3a1314[_0xeee0('0x23')]?_[_0xeee0('0x25')](_0x3a1314[_0xeee0('0x23')],function(_0x5248dc){return{'model':db[_0x5248dc['model']],'as':_0x5248dc['as'],'attributes':_0x5248dc[_0xeee0('0x22')],'include':_0x5248dc[_0xeee0('0x23')]?_[_0xeee0('0x25')](_0x5248dc[_0xeee0('0x23')],function(_0x47259b){return{'model':db[_0x47259b[_0xeee0('0x24')]],'as':_0x47259b['as'],'attributes':_0x47259b[_0xeee0('0x22')]};}):[]};}):[]};}):[]:[]})[_0xeee0('0x12')](function(_0x598f60){logger['info'](_0xeee0('0x1d'),_0x202cdf);logger[_0xeee0('0x26')](_0xeee0('0x1d'),_0x202cdf,JSON[_0xeee0('0x17')](_0x598f60));_0x317fdd(_0x598f60);})[_0xeee0('0x1c')](function(_0x3b79e1){logger[_0xeee0('0x18')](_0xeee0('0x1d'),_0x3b79e1[_0xeee0('0x1a')],_0x202cdf);_0x265c1a(_0x3c1f57[_0xeee0('0x18')](0x1f4,_0x3b79e1['message']));});});}; \ No newline at end of file +var _0x3f42=['../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x110d59,_0x50c4fb){var _0x2fce64=function(_0xc1dcd8){while(--_0xc1dcd8){_0x110d59['push'](_0x110d59['shift']());}};_0x2fce64(++_0x50c4fb);}(_0x3f42,0x1c2));var _0x23f4=function(_0xec729,_0x1d82ed){_0xec729=_0xec729-0x0;var _0xb729f1=_0x3f42[_0xec729];return _0xb729f1;};'use strict';var _=require(_0x23f4('0x0'));var util=require(_0x23f4('0x1'));var moment=require('moment');var BPromise=require(_0x23f4('0x2'));var rs=require(_0x23f4('0x3'));var fs=require('fs');var Redis=require(_0x23f4('0x4'));var db=require(_0x23f4('0x5'))['db'];var utils=require(_0x23f4('0x6'));var logger=require(_0x23f4('0x7'))('rpc');var config=require(_0x23f4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x23f4('0x9')][_0x23f4('0xa')]({'port':0x232a});config[_0x23f4('0xb')]=_[_0x23f4('0xc')](config['redis'],{'host':_0x23f4('0xd'),'port':0x18eb});var socket=require(_0x23f4('0xe'))(new Redis(config[_0x23f4('0xb')]));require('./squareProject.socket')[_0x23f4('0xf')](socket);function respondWithRpcPromise(_0x107470,_0x54ba31,_0x3f7ca3){return new BPromise(function(_0x2b2e98,_0x2cf530){return client[_0x23f4('0x10')](_0x107470,_0x3f7ca3)[_0x23f4('0x11')](function(_0x1e6c93){logger[_0x23f4('0x12')](_0x23f4('0x13'),_0x54ba31,_0x23f4('0x14'));logger[_0x23f4('0x15')](_0x23f4('0x16'),_0x54ba31,_0x23f4('0x14'),JSON[_0x23f4('0x17')](_0x1e6c93));if(_0x1e6c93['error']){if(_0x1e6c93[_0x23f4('0x18')]['code']===0x1f4){logger['error']('SquareProject,\x20%s,\x20%s',_0x54ba31,_0x1e6c93[_0x23f4('0x18')][_0x23f4('0x19')]);return _0x2cf530(_0x1e6c93['error']['message']);}logger[_0x23f4('0x18')]('SquareProject,\x20%s,\x20%s',_0x54ba31,_0x1e6c93[_0x23f4('0x18')]['message']);return _0x2b2e98(_0x1e6c93[_0x23f4('0x18')][_0x23f4('0x19')]);}else{logger[_0x23f4('0x12')]('SquareProject,\x20%s,\x20%s',_0x54ba31,_0x23f4('0x14'));_0x2b2e98(_0x1e6c93[_0x23f4('0x1a')][_0x23f4('0x19')]);}})['catch'](function(_0xa376a6){logger['error'](_0x23f4('0x13'),_0x54ba31,_0xa376a6);_0x2cf530(_0xa376a6);});});}exports[_0x23f4('0x1b')]=function(_0xbc22f){var _0xacfabe=this;return new Promise(function(_0x1e1240,_0x2f580d){return db[_0x23f4('0x1c')][_0x23f4('0x1d')]({'raw':_0xbc22f[_0x23f4('0x1e')]?_0xbc22f['options'][_0x23f4('0x1f')]===undefined?!![]:![]:!![],'where':_0xbc22f[_0x23f4('0x1e')]?_0xbc22f[_0x23f4('0x1e')][_0x23f4('0x20')]||null:null,'attributes':_0xbc22f['options']?_0xbc22f['options'][_0x23f4('0x21')]||null:null,'include':_0xbc22f[_0x23f4('0x1e')]?_0xbc22f[_0x23f4('0x1e')][_0x23f4('0x22')]?_[_0x23f4('0x23')](_0xbc22f[_0x23f4('0x1e')]['include'],function(_0x55c4c3){return{'model':db[_0x55c4c3[_0x23f4('0x24')]],'as':_0x55c4c3['as'],'attributes':_0x55c4c3['attributes'],'include':_0x55c4c3[_0x23f4('0x22')]?_[_0x23f4('0x23')](_0x55c4c3['include'],function(_0xe73e22){return{'model':db[_0xe73e22[_0x23f4('0x24')]],'as':_0xe73e22['as'],'attributes':_0xe73e22[_0x23f4('0x21')],'include':_0xe73e22[_0x23f4('0x22')]?_['map'](_0xe73e22['include'],function(_0x19bff2){return{'model':db[_0x19bff2['model']],'as':_0x19bff2['as'],'attributes':_0x19bff2[_0x23f4('0x21')]};}):[]};}):[]};}):[]:[]})[_0x23f4('0x11')](function(_0x33d55d){logger[_0x23f4('0x12')](_0x23f4('0x1b'),_0xbc22f);logger[_0x23f4('0x15')]('ShowSquareProject',_0xbc22f,JSON[_0x23f4('0x17')](_0x33d55d));_0x1e1240(_0x33d55d);})[_0x23f4('0x25')](function(_0x1be2ef){logger[_0x23f4('0x18')](_0x23f4('0x1b'),_0x1be2ef[_0x23f4('0x19')],_0xbc22f);_0x2f580d(_0xacfabe['error'](0x1f4,_0x1be2ef['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 97207cd..b722fa0 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 _0x5b2e=['update','emit','removeListener','register','length','squareProject:','./squareProject.events','save'];(function(_0x3e3259,_0x17f0c8){var _0x50c480=function(_0x4a1d6e){while(--_0x4a1d6e){_0x3e3259['push'](_0x3e3259['shift']());}};_0x50c480(++_0x17f0c8);}(_0x5b2e,0x13e));var _0xe5b2=function(_0x3876fd,_0x31a7af){_0x3876fd=_0x3876fd-0x0;var _0x59366e=_0x5b2e[_0x3876fd];return _0x59366e;};'use strict';var SquareProjectEvents=require(_0xe5b2('0x0'));var events=[_0xe5b2('0x1'),'remove',_0xe5b2('0x2')];function createListener(_0x5e0af5,_0x575903){return function(_0x14c078){_0x575903[_0xe5b2('0x3')](_0x5e0af5,_0x14c078);};}function removeListener(_0x17a3d3,_0x3d04bf){return function(){SquareProjectEvents[_0xe5b2('0x4')](_0x17a3d3,_0x3d04bf);};}exports[_0xe5b2('0x5')]=function(_0x4469db){for(var _0x145fbc=0x0,_0x29ab32=events[_0xe5b2('0x6')];_0x145fbc<_0x29ab32;_0x145fbc++){var _0x1f1ad5=events[_0x145fbc];var _0xb02831=createListener(_0xe5b2('0x7')+_0x1f1ad5,_0x4469db);SquareProjectEvents['on'](_0x1f1ad5,_0xb02831);}}; \ No newline at end of file +var _0xd283=['save','emit','removeListener','length','squareProject:','./squareProject.events'];(function(_0x4220da,_0x510794){var _0x4d0f2f=function(_0x1ffaf2){while(--_0x1ffaf2){_0x4220da['push'](_0x4220da['shift']());}};_0x4d0f2f(++_0x510794);}(_0xd283,0x95));var _0x3d28=function(_0x29741f,_0x13b29f){_0x29741f=_0x29741f-0x0;var _0xf7be1c=_0xd283[_0x29741f];return _0xf7be1c;};'use strict';var SquareProjectEvents=require(_0x3d28('0x0'));var events=[_0x3d28('0x1'),'remove','update'];function createListener(_0x2e0a37,_0x4c2944){return function(_0x2a5de3){_0x4c2944[_0x3d28('0x2')](_0x2e0a37,_0x2a5de3);};}function removeListener(_0x5d2827,_0x1bd08f){return function(){SquareProjectEvents[_0x3d28('0x3')](_0x5d2827,_0x1bd08f);};}exports['register']=function(_0x3ca671){for(var _0x2b67dd=0x0,_0x4d917b=events[_0x3d28('0x4')];_0x2b67dd<_0x4d917b;_0x2b67dd++){var _0x219b16=events[_0x2b67dd];var _0x386f09=createListener(_0x3d28('0x5')+_0x219b16,_0x3ca671);SquareProjectEvents['on'](_0x219b16,_0x386f09);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index f8d3d36..1da4739 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0xa3549b,_0x271ee9){var _0x33843d=function(_0x3d83f7){while(--_0x3d83f7){_0xa3549b['push'](_0xa3549b['shift']());}};_0x33843d(++_0x271ee9);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4faf96,_0x1db35c){_0x4faf96=_0x4faf96-0x0;var _0x28ff12=_0x7fbe[_0x4faf96];return _0x28ff12;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x4685b6,_0x8dc5b8){var _0x2cec3d=function(_0x2fc8e3){while(--_0x2fc8e3){_0x4685b6['push'](_0x4685b6['shift']());}};_0x2cec3d(++_0x8dc5b8);}(_0x814b,0x1a2));var _0xb814=function(_0x7767c3,_0x4825ac){_0x7767c3=_0x7767c3-0x0;var _0x1f22a1=_0x814b[_0x7767c3];return _0x1f22a1;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('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 f18b752..32d212b 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 _0x9957=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x7b3664,_0x143ea5){var _0x328539=function(_0x4546a2){while(--_0x4546a2){_0x7b3664['push'](_0x7b3664['shift']());}};_0x328539(++_0x143ea5);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7995('0x2')]},'extension':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x7995('0x2')]},'saveName':{'type':Sequelize[_0x7995('0x2')]},'filename':{'type':Sequelize[_0x7995('0x2')]},'savePath':{'type':Sequelize[_0x7995('0x2')]},'format':{'type':Sequelize[_0x7995('0x3')],'get':function(){var _0x326741='';var _0x4996ca=this[_0x7995('0x4')](_0x7995('0x5'));if(_0x4996ca){_0x326741=_0x4996ca['substring'](_0x4996ca[_0x7995('0x6')]('.'));}return _0x326741;}}}; \ No newline at end of file +var _0xb458=['sequelize','exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf'];(function(_0x433611,_0x5172d0){var _0x5ef82b=function(_0x1ad507){while(--_0x1ad507){_0x433611['push'](_0x433611['shift']());}};_0x5ef82b(++_0x5172d0);}(_0xb458,0x103));var _0x8b45=function(_0xaa8688,_0x210e26){_0xaa8688=_0xaa8688-0x0;var _0x321487=_0xb458[_0xaa8688];return _0x321487;};'use strict';var Sequelize=require(_0x8b45('0x0'));module[_0x8b45('0x1')]={'uniqueid':{'type':Sequelize[_0x8b45('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8b45('0x2')]},'extension':{'type':Sequelize[_0x8b45('0x2')]},'priority':{'type':Sequelize[_0x8b45('0x2')]},'accountcode':{'type':Sequelize[_0x8b45('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x8b45('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x8b45('0x2')]},'format':{'type':Sequelize[_0x8b45('0x3')],'get':function(){var _0x2daa9a='';var _0x3a8ccb=this[_0x8b45('0x4')]('savePath');if(_0x3a8ccb){_0x2daa9a=_0x3a8ccb[_0x8b45('0x5')](_0x3a8ccb[_0x8b45('0x6')]('.'));}return _0x2daa9a;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 83905e0..ae9d43a 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 _0x8652=['status','offset','undefined','count','Content-Range','json','apply','save','update','then','destroy','stack','name','send','SquareRecording','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','end','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus'];(function(_0x140931,_0x2ffeba){var _0x4718ab=function(_0x1f08f7){while(--_0x1f08f7){_0x140931['push'](_0x140931['shift']());}};_0x4718ab(++_0x2ffeba);}(_0x8652,0x165));var _0x2865=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x8652[_0x468b0f];return _0x3e74d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2865('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2865('0x1'));var rp=require(_0x2865('0x2'));var moment=require('moment');var BPromise=require(_0x2865('0x3'));var Mustache=require(_0x2865('0x4'));var util=require(_0x2865('0x5'));var path=require(_0x2865('0x6'));var sox=require(_0x2865('0x7'));var csv=require(_0x2865('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2865('0x9'));var _=require('lodash');var squel=require(_0x2865('0xa'));var crypto=require(_0x2865('0xb'));var jsforce=require(_0x2865('0xc'));var deskjs=require(_0x2865('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2865('0xe'));var Papa=require(_0x2865('0xf'));var Redis=require(_0x2865('0x10'));var authService=require(_0x2865('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2865('0x12'));var hardwareService=require(_0x2865('0x13'));var logger=require(_0x2865('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2865('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f0ea6,_0x2bb707){_0x2bb707=_0x2bb707||0xcc;return function(_0x12f100){if(_0x12f100){return _0x4f0ea6[_0x2865('0x16')](_0x2bb707);}return _0x4f0ea6[_0x2865('0x17')](_0x2bb707)['end']();};}function respondWithResult(_0x1a9d6e,_0x203945){_0x203945=_0x203945||0xc8;return function(_0x11cb28){if(_0x11cb28){return _0x1a9d6e[_0x2865('0x17')](_0x203945)['json'](_0x11cb28);}};}function respondWithFilteredResult(_0x5c3bd3,_0x5b67f2){return function(_0x41dfe8){if(_0x41dfe8){var _0x194ae6=typeof _0x5b67f2[_0x2865('0x18')]===_0x2865('0x19')&&typeof _0x5b67f2['limit']===_0x2865('0x19');var _0x4a602b=_0x41dfe8[_0x2865('0x1a')];var _0x43b54c=_0x194ae6?0x0:_0x5b67f2[_0x2865('0x18')];var _0xbd1f0f=_0x194ae6?_0x41dfe8[_0x2865('0x1a')]:_0x5b67f2[_0x2865('0x18')]+_0x5b67f2['limit'];var _0x2d2c77;if(_0xbd1f0f>=_0x4a602b){_0xbd1f0f=_0x4a602b;_0x2d2c77=0xc8;}else{_0x2d2c77=0xce;}_0x5c3bd3[_0x2865('0x17')](_0x2d2c77);return _0x5c3bd3['set'](_0x2865('0x1b'),_0x43b54c+'-'+_0xbd1f0f+'/'+_0x4a602b)[_0x2865('0x1c')](_0x41dfe8);}return null;};}function patchUpdates(_0xb4105a){return function(_0x1ecef7){try{jsonpatch[_0x2865('0x1d')](_0x1ecef7,_0xb4105a,!![]);}catch(_0x2da4b9){return BPromise['reject'](_0x2da4b9);}return _0x1ecef7[_0x2865('0x1e')]();};}function saveUpdates(_0x587bff,_0x3ffe19){return function(_0x99f046){if(_0x99f046){return _0x99f046[_0x2865('0x1f')](_0x587bff)[_0x2865('0x20')](function(_0x4a31e7){return _0x4a31e7;});}return null;};}function removeEntity(_0x20946a,_0x1df03b){return function(_0x520802){if(_0x520802){return _0x520802[_0x2865('0x21')]()['then'](function(){_0x20946a[_0x2865('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21e5df,_0x1ee3b2){return function(_0x4ac562){if(!_0x4ac562){_0x21e5df['sendStatus'](0x194);}return _0x4ac562;};}function handleError(_0x484fe1,_0x3adfad){_0x3adfad=_0x3adfad||0x1f4;return function(_0x459980){logger['error'](_0x459980[_0x2865('0x22')]);if(_0x459980[_0x2865('0x23')]){delete _0x459980[_0x2865('0x23')];}_0x484fe1[_0x2865('0x17')](_0x3adfad)[_0x2865('0x24')](_0x459980);};}exports['index']=function(_0x103711,_0x4a0d75){var _0x109dee={},_0x30f004={},_0x2eac00={'count':0x0,'rows':[]};var _0x18314a=_['map'](db[_0x2865('0x25')][_0x2865('0x26')],function(_0xe45255){return{'name':_0xe45255[_0x2865('0x27')],'type':_0xe45255[_0x2865('0x28')][_0x2865('0x29')]};});_0x30f004[_0x2865('0x2a')]=_[_0x2865('0x2b')](_0x18314a,_0x2865('0x23'));_0x30f004['query']=_['keys'](_0x103711[_0x2865('0x2c')]);_0x30f004[_0x2865('0x2d')]=_[_0x2865('0x2e')](_0x30f004[_0x2865('0x2a')],_0x30f004[_0x2865('0x2c')]);_0x109dee[_0x2865('0x2f')]=_[_0x2865('0x2e')](_0x30f004['model'],qs['fields'](_0x103711[_0x2865('0x2c')][_0x2865('0x30')]));_0x109dee[_0x2865('0x2f')]=_0x109dee[_0x2865('0x2f')]['length']?_0x109dee['attributes']:_0x30f004[_0x2865('0x2a')];if(!_0x103711[_0x2865('0x2c')][_0x2865('0x31')](_0x2865('0x32'))){_0x109dee['limit']=qs[_0x2865('0x33')](_0x103711[_0x2865('0x2c')][_0x2865('0x33')]);_0x109dee[_0x2865('0x18')]=qs[_0x2865('0x18')](_0x103711[_0x2865('0x2c')][_0x2865('0x18')]);}_0x109dee[_0x2865('0x34')]=qs[_0x2865('0x35')](_0x103711[_0x2865('0x2c')]['sort']);_0x109dee[_0x2865('0x36')]=qs[_0x2865('0x2d')](_[_0x2865('0x37')](_0x103711[_0x2865('0x2c')],_0x30f004[_0x2865('0x2d')]),_0x18314a);if(_0x103711[_0x2865('0x2c')][_0x2865('0x38')]){_0x109dee[_0x2865('0x36')]=_[_0x2865('0x39')](_0x109dee[_0x2865('0x36')],{'$or':_[_0x2865('0x2b')](_0x18314a,function(_0x4cd5bc){if(_0x4cd5bc[_0x2865('0x28')]!==_0x2865('0x3a')){var _0x6ce89e={};_0x6ce89e[_0x4cd5bc[_0x2865('0x23')]]={'$like':'%'+_0x103711[_0x2865('0x2c')][_0x2865('0x38')]+'%'};return _0x6ce89e;}})});}_0x109dee=_[_0x2865('0x39')]({},_0x109dee,_0x103711[_0x2865('0x3b')]);var _0x44d3a8={'where':_0x109dee[_0x2865('0x36')]};return db[_0x2865('0x25')][_0x2865('0x1a')](_0x44d3a8)[_0x2865('0x20')](function(_0x321835){_0x2eac00['count']=_0x321835;if(_0x103711[_0x2865('0x2c')][_0x2865('0x3c')]){_0x109dee[_0x2865('0x3d')]=[{'all':!![]}];}return db[_0x2865('0x25')][_0x2865('0x3e')](_0x109dee);})['then'](function(_0x593da0){_0x2eac00['rows']=_0x593da0;return _0x2eac00;})[_0x2865('0x20')](respondWithFilteredResult(_0x4a0d75,_0x109dee))[_0x2865('0x3f')](handleError(_0x4a0d75,null));};exports[_0x2865('0x40')]=function(_0x4f1b50,_0x47e2c9){var _0x431985={'raw':!![],'where':{'id':_0x4f1b50[_0x2865('0x41')]['id']}},_0x43f573={};_0x43f573[_0x2865('0x2a')]=_['keys'](db[_0x2865('0x25')][_0x2865('0x26')]);_0x43f573[_0x2865('0x2c')]=_[_0x2865('0x42')](_0x4f1b50['query']);_0x43f573['filters']=_[_0x2865('0x2e')](_0x43f573[_0x2865('0x2a')],_0x43f573['query']);_0x431985[_0x2865('0x2f')]=_[_0x2865('0x2e')](_0x43f573[_0x2865('0x2a')],qs[_0x2865('0x30')](_0x4f1b50[_0x2865('0x2c')][_0x2865('0x30')]));_0x431985[_0x2865('0x2f')]=_0x431985['attributes'][_0x2865('0x43')]?_0x431985[_0x2865('0x2f')]:_0x43f573['model'];if(_0x4f1b50[_0x2865('0x2c')][_0x2865('0x3c')]){_0x431985[_0x2865('0x3d')]=[{'all':!![]}];}_0x431985=_[_0x2865('0x39')]({},_0x431985,_0x4f1b50[_0x2865('0x3b')]);return db['SquareRecording'][_0x2865('0x44')](_0x431985)[_0x2865('0x20')](handleEntityNotFound(_0x47e2c9,null))[_0x2865('0x20')](respondWithResult(_0x47e2c9,null))['catch'](handleError(_0x47e2c9,null));};exports[_0x2865('0x45')]=function(_0x3e42d1,_0x42c9d9){return db[_0x2865('0x25')][_0x2865('0x45')](_0x3e42d1[_0x2865('0x46')],{})[_0x2865('0x20')](respondWithResult(_0x42c9d9,0xc9))[_0x2865('0x3f')](handleError(_0x42c9d9,null));};exports[_0x2865('0x1f')]=function(_0xf5d24c,_0xb45fd2){if(_0xf5d24c[_0x2865('0x46')]['id']){delete _0xf5d24c[_0x2865('0x46')]['id'];}return db[_0x2865('0x25')][_0x2865('0x44')]({'where':{'id':_0xf5d24c[_0x2865('0x41')]['id']}})['then'](handleEntityNotFound(_0xb45fd2,null))['then'](saveUpdates(_0xf5d24c['body'],null))[_0x2865('0x20')](respondWithResult(_0xb45fd2,null))[_0x2865('0x3f')](handleError(_0xb45fd2,null));};exports[_0x2865('0x47')]=function(_0x24cdd4,_0x2f29c2,_0x37328b){var _0x33862a=require('../../components/encryptor');var _0x2c67f8=![];var _0x95f7b5={};if(_0x24cdd4[_0x2865('0x2c')]['type']&&_0x24cdd4[_0x2865('0x2c')][_0x2865('0x28')]===_0x2865('0x48')){_0x95f7b5[_0x2865('0x48')]=_0x24cdd4[_0x2865('0x41')]['id'];}else{_0x95f7b5['id']=_0x24cdd4[_0x2865('0x41')]['id'];}return db[_0x2865('0x25')]['find']({'where':_0x95f7b5,'attributes':['id',_0x2865('0x49'),_0x2865('0x4a')],'raw':!![]})[_0x2865('0x20')](handleEntityNotFound(_0x2f29c2,null))[_0x2865('0x20')](function(_0x137a0f){if(_0x137a0f){var _0x9ad8bd=_0x137a0f[_0x2865('0x49')];var _0x376f3d=util[_0x2865('0x4b')](_0x2865('0x4c'),_0x9ad8bd);if(fs[_0x2865('0x4d')](_0x376f3d)){_0x2c67f8=!![];return _0x33862a[_0x2865('0x4e')](_0x376f3d,_0x9ad8bd,config[_0x2865('0x4f')][_0x2865('0x50')])[_0x2865('0x20')](function(){return _0x137a0f;});}return _0x137a0f;}})[_0x2865('0x20')](function(_0x300b86){if(_0x300b86){var _0x114236=_0x300b86[_0x2865('0x49')];if(!fs[_0x2865('0x4d')](_0x114236)){throw new db[(_0x2865('0x51'))][(_0x2865('0x52'))](_0x2865('0x53'));}if(_0x300b86[_0x2865('0x4a')]){return _0x2f29c2['download'](_0x114236,_0x300b86[_0x2865('0x4a')]+path['extname'](_0x114236),function(){if(_0x2c67f8){fs['unlink'](_0x114236);}});}else{return _0x2f29c2[_0x2865('0x47')](_0x114236,function(_0x3e0342){if(_0x2c67f8){fs[_0x2865('0x54')](_0x114236);}});}}})[_0x2865('0x3f')](function(_0x2a8c58){if(_0x2a8c58[_0x2865('0x55')]===_0x2865('0x53')){_0x2f29c2[_0x2865('0x17')](0x194)[_0x2865('0x24')]('Not\x20found');}else{return handleError(_0x2f29c2,null);}});};exports['destroy']=function(_0x5f2178,_0x4039c6){return db['SquareRecording'][_0x2865('0x44')]({'where':{'id':_0x5f2178['params']['id']}})['then'](function(_0x42eaf8){if(_['isNil'](_0x42eaf8)){throw new ReferenceError(_0x2865('0x56'));}return _0x42eaf8;})['then'](function(_0x43b24c){var _0x2c3180=_0x43b24c[_0x2865('0x49')];logger['info'](_0x2865('0x57'),_0x2c3180);if(!_[_0x2865('0x58')](_0x43b24c['savePath'])&&fs[_0x2865('0x4d')](_0x2c3180)){logger[_0x2865('0x59')](_0x2865('0x5a')+_0x2c3180+_0x2865('0x5b'));fs[_0x2865('0x5c')](_0x2c3180);}_0x2c3180=_0x2c3180+_0x2865('0x5d');if(!_[_0x2865('0x58')](_0x43b24c[_0x2865('0x49')])&&fs[_0x2865('0x4d')](_0x2c3180)){logger[_0x2865('0x59')](_0x2865('0x5a')+_0x2c3180+_0x2865('0x5b'));fs[_0x2865('0x5c')](_0x2c3180);}return _0x43b24c;})['then'](function(_0x12ed82){if(!_0x12ed82)throw new InternalError();return _0x12ed82[_0x2865('0x21')]();})[_0x2865('0x20')](function(){_0x4039c6[_0x2865('0x17')](0xcc)[_0x2865('0x5e')]();})[_0x2865('0x3f')](handleError(_0x4039c6,null));}; \ No newline at end of file +var _0x840e=['path','sox','to-csv','ejs','fs-extra','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','SquareRecording','fieldName','type','key','query','intersection','model','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','attributes','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','destroy','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','request-promise','mustache','util'];(function(_0x2e5f03,_0x45b348){var _0x39c200=function(_0x1c4382){while(--_0x1c4382){_0x2e5f03['push'](_0x2e5f03['shift']());}};_0x39c200(++_0x45b348);}(_0x840e,0x10d));var _0xe840=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0x840e[_0x365be9];return _0x185c12;};'use strict';var emlformat=require(_0xe840('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe840('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe840('0x2'));var util=require(_0xe840('0x3'));var path=require(_0xe840('0x4'));var sox=require(_0xe840('0x5'));var csv=require(_0xe840('0x6'));var ejs=require(_0xe840('0x7'));var fs=require('fs');var fs_extra=require(_0xe840('0x8'));var _=require('lodash');var squel=require(_0xe840('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe840('0xa'));var Redis=require(_0xe840('0xb'));var authService=require(_0xe840('0xc'));var qs=require(_0xe840('0xd'));var as=require(_0xe840('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe840('0xf'))('api');var utils=require(_0xe840('0x10'));var config=require(_0xe840('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xe840('0x12'))['db'];function respondWithStatusCode(_0x3b1cdc,_0x4aea0b){_0x4aea0b=_0x4aea0b||0xcc;return function(_0x31f81c){if(_0x31f81c){return _0x3b1cdc[_0xe840('0x13')](_0x4aea0b);}return _0x3b1cdc[_0xe840('0x14')](_0x4aea0b)[_0xe840('0x15')]();};}function respondWithResult(_0x4b6605,_0x11c239){_0x11c239=_0x11c239||0xc8;return function(_0xf60cef){if(_0xf60cef){return _0x4b6605[_0xe840('0x14')](_0x11c239)['json'](_0xf60cef);}};}function respondWithFilteredResult(_0x14e98f,_0x50fa54){return function(_0x40b645){if(_0x40b645){var _0x35c4d0=typeof _0x50fa54[_0xe840('0x16')]===_0xe840('0x17')&&typeof _0x50fa54[_0xe840('0x18')]==='undefined';var _0x3b4a80=_0x40b645[_0xe840('0x19')];var _0x18abd9=_0x35c4d0?0x0:_0x50fa54[_0xe840('0x16')];var _0x20eb7d=_0x35c4d0?_0x40b645[_0xe840('0x19')]:_0x50fa54[_0xe840('0x16')]+_0x50fa54[_0xe840('0x18')];var _0x58afdd;if(_0x20eb7d>=_0x3b4a80){_0x20eb7d=_0x3b4a80;_0x58afdd=0xc8;}else{_0x58afdd=0xce;}_0x14e98f[_0xe840('0x14')](_0x58afdd);return _0x14e98f[_0xe840('0x1a')](_0xe840('0x1b'),_0x18abd9+'-'+_0x20eb7d+'/'+_0x3b4a80)[_0xe840('0x1c')](_0x40b645);}return null;};}function patchUpdates(_0x36da42){return function(_0xa8be40){try{jsonpatch[_0xe840('0x1d')](_0xa8be40,_0x36da42,!![]);}catch(_0x256a7f){return BPromise[_0xe840('0x1e')](_0x256a7f);}return _0xa8be40[_0xe840('0x1f')]();};}function saveUpdates(_0xa3b904,_0x56e6e6){return function(_0x51bcff){if(_0x51bcff){return _0x51bcff[_0xe840('0x20')](_0xa3b904)[_0xe840('0x21')](function(_0x2aeb4a){return _0x2aeb4a;});}return null;};}function removeEntity(_0x2917fe,_0x52f1e2){return function(_0x518f09){if(_0x518f09){return _0x518f09['destroy']()[_0xe840('0x21')](function(){_0x2917fe[_0xe840('0x14')](0xcc)[_0xe840('0x15')]();});}};}function handleEntityNotFound(_0x1c33a1,_0x1708f3){return function(_0x59b661){if(!_0x59b661){_0x1c33a1[_0xe840('0x13')](0x194);}return _0x59b661;};}function handleError(_0x6f3db5,_0x5e413f){_0x5e413f=_0x5e413f||0x1f4;return function(_0x55955e){logger[_0xe840('0x22')](_0x55955e[_0xe840('0x23')]);if(_0x55955e[_0xe840('0x24')]){delete _0x55955e[_0xe840('0x24')];}_0x6f3db5[_0xe840('0x14')](_0x5e413f)['send'](_0x55955e);};}exports[_0xe840('0x25')]=function(_0x21071b,_0x14b86d){var _0x493c2c={},_0x57460b={},_0x103cd1={'count':0x0,'rows':[]};var _0x233511=_[_0xe840('0x26')](db[_0xe840('0x27')]['rawAttributes'],function(_0x541ef0){return{'name':_0x541ef0[_0xe840('0x28')],'type':_0x541ef0[_0xe840('0x29')][_0xe840('0x2a')]};});_0x57460b['model']=_[_0xe840('0x26')](_0x233511,_0xe840('0x24'));_0x57460b[_0xe840('0x2b')]=_['keys'](_0x21071b[_0xe840('0x2b')]);_0x57460b['filters']=_[_0xe840('0x2c')](_0x57460b['model'],_0x57460b[_0xe840('0x2b')]);_0x493c2c['attributes']=_['intersection'](_0x57460b[_0xe840('0x2d')],qs[_0xe840('0x2e')](_0x21071b[_0xe840('0x2b')][_0xe840('0x2e')]));_0x493c2c['attributes']=_0x493c2c['attributes'][_0xe840('0x2f')]?_0x493c2c['attributes']:_0x57460b[_0xe840('0x2d')];if(!_0x21071b['query'][_0xe840('0x30')]('nolimit')){_0x493c2c[_0xe840('0x18')]=qs['limit'](_0x21071b[_0xe840('0x2b')][_0xe840('0x18')]);_0x493c2c['offset']=qs[_0xe840('0x16')](_0x21071b[_0xe840('0x2b')]['offset']);}_0x493c2c[_0xe840('0x31')]=qs[_0xe840('0x32')](_0x21071b[_0xe840('0x2b')][_0xe840('0x32')]);_0x493c2c[_0xe840('0x33')]=qs[_0xe840('0x34')](_['pick'](_0x21071b[_0xe840('0x2b')],_0x57460b[_0xe840('0x34')]),_0x233511);if(_0x21071b[_0xe840('0x2b')][_0xe840('0x35')]){_0x493c2c[_0xe840('0x33')]=_[_0xe840('0x36')](_0x493c2c[_0xe840('0x33')],{'$or':_[_0xe840('0x26')](_0x233511,function(_0x423c40){if(_0x423c40[_0xe840('0x29')]!==_0xe840('0x37')){var _0x307f23={};_0x307f23[_0x423c40['name']]={'$like':'%'+_0x21071b[_0xe840('0x2b')][_0xe840('0x35')]+'%'};return _0x307f23;}})});}_0x493c2c=_[_0xe840('0x36')]({},_0x493c2c,_0x21071b[_0xe840('0x38')]);var _0x3d2721={'where':_0x493c2c[_0xe840('0x33')]};return db[_0xe840('0x27')][_0xe840('0x19')](_0x3d2721)[_0xe840('0x21')](function(_0x4f1440){_0x103cd1[_0xe840('0x19')]=_0x4f1440;if(_0x21071b[_0xe840('0x2b')][_0xe840('0x39')]){_0x493c2c[_0xe840('0x3a')]=[{'all':!![]}];}return db[_0xe840('0x27')][_0xe840('0x3b')](_0x493c2c);})[_0xe840('0x21')](function(_0x383145){_0x103cd1['rows']=_0x383145;return _0x103cd1;})['then'](respondWithFilteredResult(_0x14b86d,_0x493c2c))[_0xe840('0x3c')](handleError(_0x14b86d,null));};exports[_0xe840('0x3d')]=function(_0x17c88e,_0x43aaf8){var _0x7b40b1={'raw':!![],'where':{'id':_0x17c88e[_0xe840('0x3e')]['id']}},_0x321eb1={};_0x321eb1['model']=_[_0xe840('0x3f')](db[_0xe840('0x27')][_0xe840('0x40')]);_0x321eb1[_0xe840('0x2b')]=_[_0xe840('0x3f')](_0x17c88e[_0xe840('0x2b')]);_0x321eb1[_0xe840('0x34')]=_['intersection'](_0x321eb1[_0xe840('0x2d')],_0x321eb1[_0xe840('0x2b')]);_0x7b40b1[_0xe840('0x41')]=_[_0xe840('0x2c')](_0x321eb1[_0xe840('0x2d')],qs[_0xe840('0x2e')](_0x17c88e[_0xe840('0x2b')]['fields']));_0x7b40b1[_0xe840('0x41')]=_0x7b40b1[_0xe840('0x41')][_0xe840('0x2f')]?_0x7b40b1[_0xe840('0x41')]:_0x321eb1[_0xe840('0x2d')];if(_0x17c88e['query'][_0xe840('0x39')]){_0x7b40b1['include']=[{'all':!![]}];}_0x7b40b1=_['merge']({},_0x7b40b1,_0x17c88e[_0xe840('0x38')]);return db[_0xe840('0x27')][_0xe840('0x42')](_0x7b40b1)[_0xe840('0x21')](handleEntityNotFound(_0x43aaf8,null))[_0xe840('0x21')](respondWithResult(_0x43aaf8,null))[_0xe840('0x3c')](handleError(_0x43aaf8,null));};exports[_0xe840('0x43')]=function(_0x1bf998,_0x4bcc69){return db[_0xe840('0x27')][_0xe840('0x43')](_0x1bf998[_0xe840('0x44')],{})[_0xe840('0x21')](respondWithResult(_0x4bcc69,0xc9))[_0xe840('0x3c')](handleError(_0x4bcc69,null));};exports['update']=function(_0x3bbed3,_0x5d2f3b){if(_0x3bbed3['body']['id']){delete _0x3bbed3[_0xe840('0x44')]['id'];}return db[_0xe840('0x27')][_0xe840('0x42')]({'where':{'id':_0x3bbed3[_0xe840('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5d2f3b,null))[_0xe840('0x21')](saveUpdates(_0x3bbed3[_0xe840('0x44')],null))[_0xe840('0x21')](respondWithResult(_0x5d2f3b,null))[_0xe840('0x3c')](handleError(_0x5d2f3b,null));};exports[_0xe840('0x45')]=function(_0x41fb3e,_0x3c99c6,_0x1a4c04){var _0x149414=require(_0xe840('0x46'));var _0x58ecf3=![];var _0x52d882={};if(_0x41fb3e[_0xe840('0x2b')]['type']&&_0x41fb3e[_0xe840('0x2b')][_0xe840('0x29')]===_0xe840('0x47')){_0x52d882[_0xe840('0x47')]=_0x41fb3e[_0xe840('0x3e')]['id'];}else{_0x52d882['id']=_0x41fb3e[_0xe840('0x3e')]['id'];}return db[_0xe840('0x27')][_0xe840('0x42')]({'where':_0x52d882,'attributes':['id',_0xe840('0x48'),_0xe840('0x49')],'raw':!![]})[_0xe840('0x21')](handleEntityNotFound(_0x3c99c6,null))[_0xe840('0x21')](function(_0x1852dd){if(_0x1852dd){var _0x1f10c6=_0x1852dd[_0xe840('0x48')];var _0x993e64=util['format'](_0xe840('0x4a'),_0x1f10c6);if(fs['existsSync'](_0x993e64)){_0x58ecf3=!![];return _0x149414[_0xe840('0x4b')](_0x993e64,_0x1f10c6,config['secrets'][_0xe840('0x4c')])[_0xe840('0x21')](function(){return _0x1852dd;});}return _0x1852dd;}})[_0xe840('0x21')](function(_0x3e9944){if(_0x3e9944){var _0x462b99=_0x3e9944[_0xe840('0x48')];if(!fs[_0xe840('0x4d')](_0x462b99)){throw new db[(_0xe840('0x4e'))][(_0xe840('0x4f'))](_0xe840('0x50'));}if(_0x3e9944['filename']){return _0x3c99c6[_0xe840('0x45')](_0x462b99,_0x3e9944[_0xe840('0x49')]+path[_0xe840('0x51')](_0x462b99),function(){if(_0x58ecf3){fs[_0xe840('0x52')](_0x462b99);}});}else{return _0x3c99c6['download'](_0x462b99,function(_0x21bab0){if(_0x58ecf3){fs[_0xe840('0x52')](_0x462b99);}});}}})[_0xe840('0x3c')](function(_0x487393){if(_0x487393[_0xe840('0x53')]===_0xe840('0x50')){_0x3c99c6[_0xe840('0x14')](0x194)[_0xe840('0x54')](_0xe840('0x55'));}else{return handleError(_0x3c99c6,null);}});};exports[_0xe840('0x56')]=function(_0x3aa269,_0x9aab77){return db[_0xe840('0x27')][_0xe840('0x42')]({'where':{'id':_0x3aa269[_0xe840('0x3e')]['id']}})[_0xe840('0x21')](function(_0x5dba25){if(_[_0xe840('0x57')](_0x5dba25)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5dba25;})['then'](function(_0x19ec78){var _0x2a0a85=_0x19ec78[_0xe840('0x48')];logger[_0xe840('0x58')]('cancellazione\x20fisica\x20documento\x20%s',_0x2a0a85);if(!_[_0xe840('0x57')](_0x19ec78[_0xe840('0x48')])&&fs[_0xe840('0x4d')](_0x2a0a85)){logger['info']('File:\x20\x22'+_0x2a0a85+_0xe840('0x59'));fs['unlinkSync'](_0x2a0a85);}_0x2a0a85=_0x2a0a85+_0xe840('0x5a');if(!_[_0xe840('0x57')](_0x19ec78[_0xe840('0x48')])&&fs[_0xe840('0x4d')](_0x2a0a85)){logger[_0xe840('0x58')]('File:\x20\x22'+_0x2a0a85+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x2a0a85);}return _0x19ec78;})[_0xe840('0x21')](function(_0x429e39){if(!_0x429e39)throw new InternalError();return _0x429e39[_0xe840('0x56')]();})[_0xe840('0x21')](function(){_0x9aab77[_0xe840('0x14')](0xcc)[_0xe840('0x15')]();})[_0xe840('0x3c')](handleError(_0x9aab77,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 449a402..eaaec5b 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 _0xc812=['bluebird','request-promise','path','../../config/environment','./squareRecording.attributes','define','SquareRecording','square_recordings','lodash','util','../../config/logger','moment'];(function(_0x3e4a54,_0x52208f){var _0xffb7ed=function(_0x715df8){while(--_0x715df8){_0x3e4a54['push'](_0x3e4a54['shift']());}};_0xffb7ed(++_0x52208f);}(_0xc812,0xbc));var _0x2c81=function(_0x85a54c,_0x1e9540){_0x85a54c=_0x85a54c-0x0;var _0x5277b4=_0xc812[_0x85a54c];return _0x5277b4;};'use strict';var _=require(_0x2c81('0x0'));var util=require(_0x2c81('0x1'));var logger=require(_0x2c81('0x2'))('api');var moment=require(_0x2c81('0x3'));var BPromise=require(_0x2c81('0x4'));var rp=require(_0x2c81('0x5'));var fs=require('fs');var path=require(_0x2c81('0x6'));var rimraf=require('rimraf');var config=require(_0x2c81('0x7'));var attributes=require(_0x2c81('0x8'));module['exports']=function(_0x209191,_0x132a16){return _0x209191[_0x2c81('0x9')](_0x2c81('0xa'),attributes,{'tableName':_0x2c81('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa498=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareRecording'];(function(_0x512b05,_0x2c221d){var _0x5be119=function(_0x50d892){while(--_0x50d892){_0x512b05['push'](_0x512b05['shift']());}};_0x5be119(++_0x2c221d);}(_0xa498,0x1d6));var _0x8a49=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0xa498[_0x593564];return _0x211a89;};'use strict';var _=require('lodash');var util=require(_0x8a49('0x0'));var logger=require(_0x8a49('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8a49('0x2'));var rp=require(_0x8a49('0x3'));var fs=require('fs');var path=require(_0x8a49('0x4'));var rimraf=require(_0x8a49('0x5'));var config=require(_0x8a49('0x6'));var attributes=require('./squareRecording.attributes');module[_0x8a49('0x7')]=function(_0x5c5df6,_0x366d5b){return _0x5c5df6[_0x8a49('0x8')](_0x8a49('0x9'),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 655e6b3..515827e 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 _0x6a1d=['rpc','../../config/environment','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','message','result','CreateSquareRecording','SquareRecording','body','options','then','stringify','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a1d,0x18a));var _0xd6a1=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x6a1d[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xd6a1('0x0'));var util=require(_0xd6a1('0x1'));var moment=require('moment');var BPromise=require(_0xd6a1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6a1('0x3'));var db=require(_0xd6a1('0x4'))['db'];var utils=require(_0xd6a1('0x5'));var logger=require('../../config/logger')(_0xd6a1('0x6'));var config=require(_0xd6a1('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd6a1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xdcabaa,_0xebbe0d,_0x97d159){return new BPromise(function(_0x2e910d,_0x12017d){return client[_0xd6a1('0x9')](_0xdcabaa,_0x97d159)['then'](function(_0x2cf1d2){logger[_0xd6a1('0xa')](_0xd6a1('0xb'),_0xebbe0d,_0xd6a1('0xc'));logger[_0xd6a1('0xd')](_0xd6a1('0xe'),_0xebbe0d,_0xd6a1('0xc'),JSON['stringify'](_0x2cf1d2));if(_0x2cf1d2[_0xd6a1('0xf')]){if(_0x2cf1d2[_0xd6a1('0xf')]['code']===0x1f4){logger[_0xd6a1('0xf')](_0xd6a1('0xb'),_0xebbe0d,_0x2cf1d2[_0xd6a1('0xf')]['message']);return _0x12017d(_0x2cf1d2[_0xd6a1('0xf')][_0xd6a1('0x10')]);}logger[_0xd6a1('0xf')]('SquareRecording,\x20%s,\x20%s',_0xebbe0d,_0x2cf1d2[_0xd6a1('0xf')][_0xd6a1('0x10')]);return _0x2e910d(_0x2cf1d2[_0xd6a1('0xf')][_0xd6a1('0x10')]);}else{logger['info'](_0xd6a1('0xb'),_0xebbe0d,_0xd6a1('0xc'));_0x2e910d(_0x2cf1d2[_0xd6a1('0x11')][_0xd6a1('0x10')]);}})['catch'](function(_0x448e22){logger['error'](_0xd6a1('0xb'),_0xebbe0d,_0x448e22);_0x12017d(_0x448e22);});});}exports[_0xd6a1('0x12')]=function(_0x2b3747){var _0x4aac17=this;return new Promise(function(_0xf7f0f1,_0x4f3cdc){return db[_0xd6a1('0x13')]['create'](_0x2b3747[_0xd6a1('0x14')],{'raw':_0x2b3747[_0xd6a1('0x15')]?_0x2b3747[_0xd6a1('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xd6a1('0x16')](function(_0x444c04){logger[_0xd6a1('0xa')](_0xd6a1('0x12'),_0x2b3747);logger[_0xd6a1('0xd')]('CreateSquareRecording',_0x2b3747,JSON[_0xd6a1('0x17')](_0x444c04));_0xf7f0f1(_0x444c04);})[_0xd6a1('0x18')](function(_0x3c4024){logger['error']('CreateSquareRecording',_0x3c4024['message'],_0x2b3747);_0x4f3cdc(_0x4aac17['error'](0x1f4,_0x3c4024[_0xd6a1('0x10')]));});});}; \ No newline at end of file +var _0x3058=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSquareRecording','SquareRecording','create','body','options','raw'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3058,0x8d));var _0x8305=function(_0x3c711d,_0x219174){_0x3c711d=_0x3c711d-0x0;var _0x448b20=_0x3058[_0x3c711d];return _0x448b20;};'use strict';var _=require('lodash');var util=require(_0x8305('0x0'));var moment=require(_0x8305('0x1'));var BPromise=require(_0x8305('0x2'));var rs=require(_0x8305('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8305('0x4'))['db'];var utils=require(_0x8305('0x5'));var logger=require(_0x8305('0x6'))(_0x8305('0x7'));var config=require(_0x8305('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8305('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x428d48,_0x51380c,_0x51a099){return new BPromise(function(_0x20cb47,_0x33c369){return client[_0x8305('0xa')](_0x428d48,_0x51a099)[_0x8305('0xb')](function(_0x35864e){logger[_0x8305('0xc')](_0x8305('0xd'),_0x51380c,_0x8305('0xe'));logger[_0x8305('0xf')](_0x8305('0x10'),_0x51380c,_0x8305('0xe'),JSON['stringify'](_0x35864e));if(_0x35864e[_0x8305('0x11')]){if(_0x35864e[_0x8305('0x11')][_0x8305('0x12')]===0x1f4){logger['error'](_0x8305('0xd'),_0x51380c,_0x35864e['error'][_0x8305('0x13')]);return _0x33c369(_0x35864e[_0x8305('0x11')]['message']);}logger[_0x8305('0x11')](_0x8305('0xd'),_0x51380c,_0x35864e[_0x8305('0x11')][_0x8305('0x13')]);return _0x20cb47(_0x35864e['error']['message']);}else{logger[_0x8305('0xc')](_0x8305('0xd'),_0x51380c,_0x8305('0xe'));_0x20cb47(_0x35864e[_0x8305('0x14')][_0x8305('0x13')]);}})['catch'](function(_0x3b6ea6){logger[_0x8305('0x11')](_0x8305('0xd'),_0x51380c,_0x3b6ea6);_0x33c369(_0x3b6ea6);});});}exports[_0x8305('0x15')]=function(_0x3f5c9b){var _0x3c56de=this;return new Promise(function(_0xc68f14,_0x423dbd){return db[_0x8305('0x16')][_0x8305('0x17')](_0x3f5c9b[_0x8305('0x18')],{'raw':_0x3f5c9b[_0x8305('0x19')]?_0x3f5c9b[_0x8305('0x19')][_0x8305('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5c3a66){logger[_0x8305('0xc')](_0x8305('0x15'),_0x3f5c9b);logger[_0x8305('0xf')](_0x8305('0x15'),_0x3f5c9b,JSON['stringify'](_0x5c3a66));_0xc68f14(_0x5c3a66);})[_0x8305('0x1b')](function(_0x46fdcb){logger['error'](_0x8305('0x15'),_0x46fdcb[_0x8305('0x13')],_0x3f5c9b);_0x423dbd(_0x3c56de[_0x8305('0x11')](0x1f4,_0x46fdcb[_0x8305('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 1a4a29f..d2fcb61 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x508fb5,_0x4861dc){var _0x1dc2c9=function(_0x4b5324){while(--_0x4b5324){_0x508fb5['push'](_0x508fb5['shift']());}};_0x1dc2c9(++_0x4861dc);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 445e671..c921893 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 _0xb14f=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x165be3,_0x2e9010){var _0x4441ee=function(_0x34b6ad){while(--_0x34b6ad){_0x165be3['push'](_0x165be3['shift']());}};_0x4441ee(++_0x2e9010);}(_0xb14f,0x152));var _0xfb14=function(_0x2aaa90,_0xb74eb){_0x2aaa90=_0x2aaa90-0x0;var _0x560233=_0xb14f[_0x2aaa90];return _0x560233;};'use strict';var Sequelize=require(_0xfb14('0x0'));module[_0xfb14('0x1')]={'network':{'type':Sequelize[_0xfb14('0x2')]},'network_script':{'type':Sequelize[_0xfb14('0x2')]},'request':{'type':Sequelize[_0xfb14('0x2')]},'channel':{'type':Sequelize[_0xfb14('0x2')]},'language':{'type':Sequelize[_0xfb14('0x2')]},'type':{'type':Sequelize[_0xfb14('0x2')]},'uniqueid':{'type':Sequelize[_0xfb14('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xfb14('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xfb14('0x2')]},'callingani2':{'type':Sequelize[_0xfb14('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xfb14('0x2')]},'rdnis':{'type':Sequelize[_0xfb14('0x2')]},'context':{'type':Sequelize[_0xfb14('0x2')]},'extension':{'type':Sequelize[_0xfb14('0x2')]},'priority':{'type':Sequelize[_0xfb14('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xfb14('0x2')]},'threadid':{'type':Sequelize[_0xfb14('0x2')]},'project_name':{'type':Sequelize[_0xfb14('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xfb14('0x3')]},'bot':{'type':Sequelize[_0xfb14('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xbc1b=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x5519f4,_0x4c6cb7){var _0xa9adf6=function(_0x5034a8){while(--_0x5034a8){_0x5519f4['push'](_0x5519f4['shift']());}};_0xa9adf6(++_0x4c6cb7);}(_0xbc1b,0xb2));var _0xbbc1=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0xbc1b[_0x4c4037];return _0x357862;};'use strict';var Sequelize=require(_0xbbc1('0x0'));module[_0xbbc1('0x1')]={'network':{'type':Sequelize[_0xbbc1('0x2')]},'network_script':{'type':Sequelize[_0xbbc1('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xbbc1('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbbc1('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xbbc1('0x2')]},'callerid':{'type':Sequelize[_0xbbc1('0x2')]},'calleridname':{'type':Sequelize[_0xbbc1('0x2')]},'callingpres':{'type':Sequelize[_0xbbc1('0x2')]},'callingani2':{'type':Sequelize[_0xbbc1('0x2')]},'callington':{'type':Sequelize[_0xbbc1('0x2')]},'callingtns':{'type':Sequelize[_0xbbc1('0x2')]},'dnid':{'type':Sequelize[_0xbbc1('0x2')]},'rdnis':{'type':Sequelize[_0xbbc1('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xbbc1('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xbbc1('0x2')]},'accountcode':{'type':Sequelize[_0xbbc1('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xbbc1('0x3')]},'bot':{'type':Sequelize[_0xbbc1('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index a69b23a..7ce2ade 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 _0xe8b7=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','reject','save','then','destroy','stack','name','index','map','SquareReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis'];(function(_0x122740,_0x3ff069){var _0x3a1ede=function(_0x14bd66){while(--_0x14bd66){_0x122740['push'](_0x122740['shift']());}};_0x3a1ede(++_0x3ff069);}(_0xe8b7,0x1a7));var _0x7e8b=function(_0x591192,_0x5a39e3){_0x591192=_0x591192-0x0;var _0x3b0d9b=_0xe8b7[_0x591192];return _0x3b0d9b;};'use strict';var emlformat=require(_0x7e8b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e8b('0x1'));var jsonpatch=require(_0x7e8b('0x2'));var rp=require(_0x7e8b('0x3'));var moment=require(_0x7e8b('0x4'));var BPromise=require(_0x7e8b('0x5'));var Mustache=require(_0x7e8b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7e8b('0x7'));var csv=require(_0x7e8b('0x8'));var ejs=require(_0x7e8b('0x9'));var fs=require('fs');var fs_extra=require(_0x7e8b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7e8b('0xb'));var jsforce=require(_0x7e8b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7e8b('0xd'));var Papa=require('papaparse');var Redis=require(_0x7e8b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7e8b('0xf'));var as=require(_0x7e8b('0x10'));var hardwareService=require(_0x7e8b('0x11'));var logger=require(_0x7e8b('0x12'))(_0x7e8b('0x13'));var utils=require('../../config/utils');var config=require(_0x7e8b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7e8b('0x15'))['db'];function respondWithStatusCode(_0x13f7a2,_0x362e3d){_0x362e3d=_0x362e3d||0xcc;return function(_0x53a5af){if(_0x53a5af){return _0x13f7a2[_0x7e8b('0x16')](_0x362e3d);}return _0x13f7a2[_0x7e8b('0x17')](_0x362e3d)[_0x7e8b('0x18')]();};}function respondWithResult(_0x320fe9,_0x373a58){_0x373a58=_0x373a58||0xc8;return function(_0x11da30){if(_0x11da30){return _0x320fe9[_0x7e8b('0x17')](_0x373a58)[_0x7e8b('0x19')](_0x11da30);}};}function respondWithFilteredResult(_0x59e2ed,_0x184e18){return function(_0x15007d){if(_0x15007d){var _0x31a74e=typeof _0x184e18['offset']==='undefined'&&typeof _0x184e18[_0x7e8b('0x1a')]==='undefined';var _0xd04cdd=_0x15007d[_0x7e8b('0x1b')];var _0x21c14e=_0x31a74e?0x0:_0x184e18[_0x7e8b('0x1c')];var _0x31e708=_0x31a74e?_0x15007d[_0x7e8b('0x1b')]:_0x184e18[_0x7e8b('0x1c')]+_0x184e18['limit'];var _0x38edff;if(_0x31e708>=_0xd04cdd){_0x31e708=_0xd04cdd;_0x38edff=0xc8;}else{_0x38edff=0xce;}_0x59e2ed[_0x7e8b('0x17')](_0x38edff);return _0x59e2ed[_0x7e8b('0x1d')](_0x7e8b('0x1e'),_0x21c14e+'-'+_0x31e708+'/'+_0xd04cdd)[_0x7e8b('0x19')](_0x15007d);}return null;};}function patchUpdates(_0x3393d3){return function(_0x44664a){try{jsonpatch['apply'](_0x44664a,_0x3393d3,!![]);}catch(_0x18c6db){return BPromise[_0x7e8b('0x1f')](_0x18c6db);}return _0x44664a[_0x7e8b('0x20')]();};}function saveUpdates(_0x516c84,_0x2b8880){return function(_0x3c72b0){if(_0x3c72b0){return _0x3c72b0['update'](_0x516c84)[_0x7e8b('0x21')](function(_0x1853d7){return _0x1853d7;});}return null;};}function removeEntity(_0x4d9d4d,_0x2533a4){return function(_0x388af0){if(_0x388af0){return _0x388af0[_0x7e8b('0x22')]()[_0x7e8b('0x21')](function(){_0x4d9d4d[_0x7e8b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x213f3c,_0x2f4b33){return function(_0x3a326b){if(!_0x3a326b){_0x213f3c['sendStatus'](0x194);}return _0x3a326b;};}function handleError(_0x4c7c02,_0x3f49e6){_0x3f49e6=_0x3f49e6||0x1f4;return function(_0x2796f7){logger['error'](_0x2796f7[_0x7e8b('0x23')]);if(_0x2796f7[_0x7e8b('0x24')]){delete _0x2796f7['name'];}_0x4c7c02[_0x7e8b('0x17')](_0x3f49e6)['send'](_0x2796f7);};}exports[_0x7e8b('0x25')]=function(_0xdfa327,_0xe56619){var _0x254b91={},_0x2833c1={},_0x330238={'count':0x0,'rows':[]};var _0x534b1b=_[_0x7e8b('0x26')](db[_0x7e8b('0x27')][_0x7e8b('0x28')],function(_0x32370f){return{'name':_0x32370f[_0x7e8b('0x29')],'type':_0x32370f[_0x7e8b('0x2a')][_0x7e8b('0x2b')]};});_0x2833c1[_0x7e8b('0x2c')]=_[_0x7e8b('0x26')](_0x534b1b,'name');_0x2833c1['query']=_[_0x7e8b('0x2d')](_0xdfa327['query']);_0x2833c1[_0x7e8b('0x2e')]=_[_0x7e8b('0x2f')](_0x2833c1[_0x7e8b('0x2c')],_0x2833c1['query']);_0x254b91[_0x7e8b('0x30')]=_[_0x7e8b('0x2f')](_0x2833c1[_0x7e8b('0x2c')],qs[_0x7e8b('0x31')](_0xdfa327[_0x7e8b('0x32')][_0x7e8b('0x31')]));_0x254b91[_0x7e8b('0x30')]=_0x254b91[_0x7e8b('0x30')][_0x7e8b('0x33')]?_0x254b91[_0x7e8b('0x30')]:_0x2833c1[_0x7e8b('0x2c')];if(!_0xdfa327['query'][_0x7e8b('0x34')](_0x7e8b('0x35'))){_0x254b91[_0x7e8b('0x1a')]=qs[_0x7e8b('0x1a')](_0xdfa327['query'][_0x7e8b('0x1a')]);_0x254b91[_0x7e8b('0x1c')]=qs[_0x7e8b('0x1c')](_0xdfa327[_0x7e8b('0x32')][_0x7e8b('0x1c')]);}_0x254b91['order']=qs[_0x7e8b('0x36')](_0xdfa327[_0x7e8b('0x32')][_0x7e8b('0x36')]);_0x254b91[_0x7e8b('0x37')]=qs[_0x7e8b('0x2e')](_[_0x7e8b('0x38')](_0xdfa327[_0x7e8b('0x32')],_0x2833c1['filters']),_0x534b1b);if(_0xdfa327[_0x7e8b('0x32')][_0x7e8b('0x39')]){_0x254b91[_0x7e8b('0x37')]=_['merge'](_0x254b91[_0x7e8b('0x37')],{'$or':_[_0x7e8b('0x26')](_0x534b1b,function(_0x36c9f2){if(_0x36c9f2[_0x7e8b('0x2a')]!==_0x7e8b('0x3a')){var _0x405ff2={};_0x405ff2[_0x36c9f2[_0x7e8b('0x24')]]={'$like':'%'+_0xdfa327['query']['filter']+'%'};return _0x405ff2;}})});}_0x254b91=_[_0x7e8b('0x3b')]({},_0x254b91,_0xdfa327[_0x7e8b('0x3c')]);var _0x45997d={'where':_0x254b91[_0x7e8b('0x37')]};return db[_0x7e8b('0x27')][_0x7e8b('0x1b')](_0x45997d)[_0x7e8b('0x21')](function(_0x1473b3){_0x330238[_0x7e8b('0x1b')]=_0x1473b3;if(_0xdfa327['query']['includeAll']){_0x254b91[_0x7e8b('0x3d')]=[{'all':!![]}];}return db[_0x7e8b('0x27')][_0x7e8b('0x3e')](_0x254b91);})['then'](function(_0x5d062c){_0x330238[_0x7e8b('0x3f')]=_0x5d062c;return _0x330238;})[_0x7e8b('0x21')](respondWithFilteredResult(_0xe56619,_0x254b91))[_0x7e8b('0x40')](handleError(_0xe56619,null));};exports[_0x7e8b('0x41')]=function(_0x243f5f,_0x4c4fb8){var _0x21b306={'raw':!![],'where':{'id':_0x243f5f[_0x7e8b('0x42')]['id']}},_0x48ba2a={};_0x48ba2a[_0x7e8b('0x2c')]=_[_0x7e8b('0x2d')](db[_0x7e8b('0x27')][_0x7e8b('0x28')]);_0x48ba2a['query']=_[_0x7e8b('0x2d')](_0x243f5f[_0x7e8b('0x32')]);_0x48ba2a[_0x7e8b('0x2e')]=_[_0x7e8b('0x2f')](_0x48ba2a[_0x7e8b('0x2c')],_0x48ba2a[_0x7e8b('0x32')]);_0x21b306[_0x7e8b('0x30')]=_[_0x7e8b('0x2f')](_0x48ba2a['model'],qs['fields'](_0x243f5f[_0x7e8b('0x32')][_0x7e8b('0x31')]));_0x21b306[_0x7e8b('0x30')]=_0x21b306[_0x7e8b('0x30')][_0x7e8b('0x33')]?_0x21b306['attributes']:_0x48ba2a[_0x7e8b('0x2c')];if(_0x243f5f['query'][_0x7e8b('0x43')]){_0x21b306['include']=[{'all':!![]}];}_0x21b306=_['merge']({},_0x21b306,_0x243f5f[_0x7e8b('0x3c')]);return db['SquareReport'][_0x7e8b('0x44')](_0x21b306)[_0x7e8b('0x21')](handleEntityNotFound(_0x4c4fb8,null))[_0x7e8b('0x21')](respondWithResult(_0x4c4fb8,null))[_0x7e8b('0x40')](handleError(_0x4c4fb8,null));};exports[_0x7e8b('0x45')]=function(_0x5ce9fb,_0x329430){return db[_0x7e8b('0x27')][_0x7e8b('0x45')](_0x5ce9fb[_0x7e8b('0x46')],{})[_0x7e8b('0x21')](respondWithResult(_0x329430,0xc9))[_0x7e8b('0x40')](handleError(_0x329430,null));};exports[_0x7e8b('0x47')]=function(_0x3145b6,_0x13fd11){if(_0x3145b6[_0x7e8b('0x46')]['id']){delete _0x3145b6[_0x7e8b('0x46')]['id'];}return db[_0x7e8b('0x27')][_0x7e8b('0x44')]({'where':{'id':_0x3145b6['params']['id']}})[_0x7e8b('0x21')](handleEntityNotFound(_0x13fd11,null))[_0x7e8b('0x21')](saveUpdates(_0x3145b6[_0x7e8b('0x46')],null))[_0x7e8b('0x21')](respondWithResult(_0x13fd11,null))[_0x7e8b('0x40')](handleError(_0x13fd11,null));};exports['destroy']=function(_0x26e947,_0x4b7567){return db[_0x7e8b('0x27')][_0x7e8b('0x44')]({'where':{'id':_0x26e947[_0x7e8b('0x42')]['id']}})[_0x7e8b('0x21')](handleEntityNotFound(_0x4b7567,null))[_0x7e8b('0x21')](removeEntity(_0x4b7567,null))[_0x7e8b('0x40')](handleError(_0x4b7567,null));};exports[_0x7e8b('0x48')]=function(_0x597eca,_0x29e3e6){return db[_0x7e8b('0x27')][_0x7e8b('0x48')]()[_0x7e8b('0x21')](respondWithResult(_0x29e3e6,null))[_0x7e8b('0x40')](handleError(_0x29e3e6,null));}; \ No newline at end of file +var _0x999b=['create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','update','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','SquareReport','count','then','include','findAll','rows','catch','show','params','keys','options','find'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x999b,0xde));var _0xb999=function(_0x587ae4,_0x9fe213){_0x587ae4=_0x587ae4-0x0;var _0xfff66e=_0x999b[_0x587ae4];return _0xfff66e;};'use strict';var emlformat=require(_0xb999('0x0'));var rimraf=require(_0xb999('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb999('0x2'));var rp=require('request-promise');var moment=require(_0xb999('0x3'));var BPromise=require(_0xb999('0x4'));var Mustache=require(_0xb999('0x5'));var util=require(_0xb999('0x6'));var path=require(_0xb999('0x7'));var sox=require(_0xb999('0x8'));var csv=require('to-csv');var ejs=require(_0xb999('0x9'));var fs=require('fs');var fs_extra=require(_0xb999('0xa'));var _=require(_0xb999('0xb'));var squel=require(_0xb999('0xc'));var crypto=require(_0xb999('0xd'));var jsforce=require(_0xb999('0xe'));var deskjs=require(_0xb999('0xf'));var toCsv=require(_0xb999('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb999('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb999('0x12'));var as=require(_0xb999('0x13'));var hardwareService=require(_0xb999('0x14'));var logger=require('../../config/logger')(_0xb999('0x15'));var utils=require('../../config/utils');var config=require(_0xb999('0x16'));var licenseUtil=require(_0xb999('0x17'));var db=require(_0xb999('0x18'))['db'];function respondWithStatusCode(_0x5528b2,_0x2c5914){_0x2c5914=_0x2c5914||0xcc;return function(_0x3c5682){if(_0x3c5682){return _0x5528b2[_0xb999('0x19')](_0x2c5914);}return _0x5528b2[_0xb999('0x1a')](_0x2c5914)[_0xb999('0x1b')]();};}function respondWithResult(_0x5a4a7e,_0x3413bf){_0x3413bf=_0x3413bf||0xc8;return function(_0x54f17d){if(_0x54f17d){return _0x5a4a7e['status'](_0x3413bf)[_0xb999('0x1c')](_0x54f17d);}};}function respondWithFilteredResult(_0x4e7581,_0x4e5379){return function(_0x245538){if(_0x245538){var _0x4a6c16=typeof _0x4e5379[_0xb999('0x1d')]===_0xb999('0x1e')&&typeof _0x4e5379[_0xb999('0x1f')]==='undefined';var _0x4b31b1=_0x245538['count'];var _0x567a1a=_0x4a6c16?0x0:_0x4e5379[_0xb999('0x1d')];var _0x361e96=_0x4a6c16?_0x245538['count']:_0x4e5379[_0xb999('0x1d')]+_0x4e5379['limit'];var _0x1f590a;if(_0x361e96>=_0x4b31b1){_0x361e96=_0x4b31b1;_0x1f590a=0xc8;}else{_0x1f590a=0xce;}_0x4e7581[_0xb999('0x1a')](_0x1f590a);return _0x4e7581[_0xb999('0x20')]('Content-Range',_0x567a1a+'-'+_0x361e96+'/'+_0x4b31b1)[_0xb999('0x1c')](_0x245538);}return null;};}function patchUpdates(_0x2da479){return function(_0x4e3d1f){try{jsonpatch[_0xb999('0x21')](_0x4e3d1f,_0x2da479,!![]);}catch(_0x1fd0e0){return BPromise['reject'](_0x1fd0e0);}return _0x4e3d1f[_0xb999('0x22')]();};}function saveUpdates(_0x497a30,_0x51de7d){return function(_0x2f8c00){if(_0x2f8c00){return _0x2f8c00[_0xb999('0x23')](_0x497a30)['then'](function(_0x2d1496){return _0x2d1496;});}return null;};}function removeEntity(_0x16c722,_0x1968ac){return function(_0x17bdf1){if(_0x17bdf1){return _0x17bdf1[_0xb999('0x24')]()['then'](function(){_0x16c722[_0xb999('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c48e4,_0x173c9b){return function(_0x1217d0){if(!_0x1217d0){_0x5c48e4[_0xb999('0x19')](0x194);}return _0x1217d0;};}function handleError(_0x4b37ab,_0x5bdfe2){_0x5bdfe2=_0x5bdfe2||0x1f4;return function(_0x565101){logger['error'](_0x565101[_0xb999('0x25')]);if(_0x565101[_0xb999('0x26')]){delete _0x565101[_0xb999('0x26')];}_0x4b37ab['status'](_0x5bdfe2)['send'](_0x565101);};}exports['index']=function(_0x2e8e15,_0x574ead){var _0x50486c={},_0x308607={},_0x134576={'count':0x0,'rows':[]};var _0x5b1e3f=_[_0xb999('0x27')](db['SquareReport'][_0xb999('0x28')],function(_0x385ca4){return{'name':_0x385ca4[_0xb999('0x29')],'type':_0x385ca4[_0xb999('0x2a')][_0xb999('0x2b')]};});_0x308607[_0xb999('0x2c')]=_['map'](_0x5b1e3f,_0xb999('0x26'));_0x308607[_0xb999('0x2d')]=_['keys'](_0x2e8e15[_0xb999('0x2d')]);_0x308607['filters']=_['intersection'](_0x308607['model'],_0x308607[_0xb999('0x2d')]);_0x50486c[_0xb999('0x2e')]=_[_0xb999('0x2f')](_0x308607[_0xb999('0x2c')],qs['fields'](_0x2e8e15['query'][_0xb999('0x30')]));_0x50486c[_0xb999('0x2e')]=_0x50486c[_0xb999('0x2e')][_0xb999('0x31')]?_0x50486c[_0xb999('0x2e')]:_0x308607[_0xb999('0x2c')];if(!_0x2e8e15['query'][_0xb999('0x32')]('nolimit')){_0x50486c[_0xb999('0x1f')]=qs[_0xb999('0x1f')](_0x2e8e15[_0xb999('0x2d')][_0xb999('0x1f')]);_0x50486c['offset']=qs['offset'](_0x2e8e15['query'][_0xb999('0x1d')]);}_0x50486c[_0xb999('0x33')]=qs[_0xb999('0x34')](_0x2e8e15['query'][_0xb999('0x34')]);_0x50486c[_0xb999('0x35')]=qs[_0xb999('0x36')](_[_0xb999('0x37')](_0x2e8e15['query'],_0x308607[_0xb999('0x36')]),_0x5b1e3f);if(_0x2e8e15[_0xb999('0x2d')]['filter']){_0x50486c['where']=_[_0xb999('0x38')](_0x50486c[_0xb999('0x35')],{'$or':_[_0xb999('0x27')](_0x5b1e3f,function(_0x2731dc){if(_0x2731dc[_0xb999('0x2a')]!=='VIRTUAL'){var _0x5eb5f0={};_0x5eb5f0[_0x2731dc[_0xb999('0x26')]]={'$like':'%'+_0x2e8e15[_0xb999('0x2d')][_0xb999('0x39')]+'%'};return _0x5eb5f0;}})});}_0x50486c=_[_0xb999('0x38')]({},_0x50486c,_0x2e8e15['options']);var _0x195f3f={'where':_0x50486c['where']};return db[_0xb999('0x3a')][_0xb999('0x3b')](_0x195f3f)[_0xb999('0x3c')](function(_0x560000){_0x134576[_0xb999('0x3b')]=_0x560000;if(_0x2e8e15[_0xb999('0x2d')]['includeAll']){_0x50486c[_0xb999('0x3d')]=[{'all':!![]}];}return db['SquareReport'][_0xb999('0x3e')](_0x50486c);})[_0xb999('0x3c')](function(_0x33c12c){_0x134576[_0xb999('0x3f')]=_0x33c12c;return _0x134576;})[_0xb999('0x3c')](respondWithFilteredResult(_0x574ead,_0x50486c))[_0xb999('0x40')](handleError(_0x574ead,null));};exports[_0xb999('0x41')]=function(_0x3cd1f8,_0x3a9f43){var _0x377ee1={'raw':!![],'where':{'id':_0x3cd1f8[_0xb999('0x42')]['id']}},_0x1f5b7e={};_0x1f5b7e[_0xb999('0x2c')]=_[_0xb999('0x43')](db[_0xb999('0x3a')][_0xb999('0x28')]);_0x1f5b7e[_0xb999('0x2d')]=_[_0xb999('0x43')](_0x3cd1f8[_0xb999('0x2d')]);_0x1f5b7e[_0xb999('0x36')]=_['intersection'](_0x1f5b7e[_0xb999('0x2c')],_0x1f5b7e[_0xb999('0x2d')]);_0x377ee1[_0xb999('0x2e')]=_[_0xb999('0x2f')](_0x1f5b7e[_0xb999('0x2c')],qs[_0xb999('0x30')](_0x3cd1f8[_0xb999('0x2d')][_0xb999('0x30')]));_0x377ee1[_0xb999('0x2e')]=_0x377ee1['attributes']['length']?_0x377ee1[_0xb999('0x2e')]:_0x1f5b7e[_0xb999('0x2c')];if(_0x3cd1f8[_0xb999('0x2d')]['includeAll']){_0x377ee1[_0xb999('0x3d')]=[{'all':!![]}];}_0x377ee1=_[_0xb999('0x38')]({},_0x377ee1,_0x3cd1f8[_0xb999('0x44')]);return db[_0xb999('0x3a')][_0xb999('0x45')](_0x377ee1)[_0xb999('0x3c')](handleEntityNotFound(_0x3a9f43,null))[_0xb999('0x3c')](respondWithResult(_0x3a9f43,null))[_0xb999('0x40')](handleError(_0x3a9f43,null));};exports['create']=function(_0x31a2de,_0x449a72){return db[_0xb999('0x3a')][_0xb999('0x46')](_0x31a2de[_0xb999('0x47')],{})[_0xb999('0x3c')](respondWithResult(_0x449a72,0xc9))['catch'](handleError(_0x449a72,null));};exports[_0xb999('0x23')]=function(_0x3e8750,_0xecd077){if(_0x3e8750[_0xb999('0x47')]['id']){delete _0x3e8750[_0xb999('0x47')]['id'];}return db['SquareReport'][_0xb999('0x45')]({'where':{'id':_0x3e8750[_0xb999('0x42')]['id']}})[_0xb999('0x3c')](handleEntityNotFound(_0xecd077,null))[_0xb999('0x3c')](saveUpdates(_0x3e8750[_0xb999('0x47')],null))[_0xb999('0x3c')](respondWithResult(_0xecd077,null))[_0xb999('0x40')](handleError(_0xecd077,null));};exports[_0xb999('0x24')]=function(_0x1dbe09,_0x36c6c4){return db[_0xb999('0x3a')][_0xb999('0x45')]({'where':{'id':_0x1dbe09[_0xb999('0x42')]['id']}})[_0xb999('0x3c')](handleEntityNotFound(_0x36c6c4,null))[_0xb999('0x3c')](removeEntity(_0x36c6c4,null))[_0xb999('0x40')](handleError(_0x36c6c4,null));};exports[_0xb999('0x48')]=function(_0x4b708a,_0x53c2e7){return db[_0xb999('0x3a')]['describe']()[_0xb999('0x3c')](respondWithResult(_0x53c2e7,null))[_0xb999('0x40')](handleError(_0x53c2e7,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index a27d2aa..b5ed5ab 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 _0xcef5=['define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports'];(function(_0x34108a,_0x5a89c3){var _0x5a11b6=function(_0x3b24ca){while(--_0x3b24ca){_0x34108a['push'](_0x34108a['shift']());}};_0x5a11b6(++_0x5a89c3);}(_0xcef5,0x9f));var _0x5cef=function(_0x5d9d6c,_0x28c85d){_0x5d9d6c=_0x5d9d6c-0x0;var _0x43b8d0=_0xcef5[_0x5d9d6c];return _0x43b8d0;};'use strict';var _=require(_0x5cef('0x0'));var util=require(_0x5cef('0x1'));var logger=require(_0x5cef('0x2'))(_0x5cef('0x3'));var moment=require('moment');var BPromise=require(_0x5cef('0x4'));var rp=require(_0x5cef('0x5'));var fs=require('fs');var path=require(_0x5cef('0x6'));var rimraf=require(_0x5cef('0x7'));var config=require(_0x5cef('0x8'));var attributes=require(_0x5cef('0x9'));module[_0x5cef('0xa')]=function(_0x4a8551,_0x5de710){return _0x4a8551[_0x5cef('0xb')](_0x5cef('0xc'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x5cef('0xd'),'fields':[_0x5cef('0xe'),_0x5cef('0xf')]},{'name':_0x5cef('0x10'),'fields':[_0x5cef('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x44c4=['project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid'];(function(_0x3ef2f4,_0x1eb32b){var _0x5e7876=function(_0x156ee7){while(--_0x156ee7){_0x3ef2f4['push'](_0x3ef2f4['shift']());}};_0x5e7876(++_0x1eb32b);}(_0x44c4,0x123));var _0x444c=function(_0x5d6f53,_0xc619cb){_0x5d6f53=_0x5d6f53-0x0;var _0x4470a3=_0x44c4[_0x5d6f53];return _0x4470a3;};'use strict';var _=require(_0x444c('0x0'));var util=require(_0x444c('0x1'));var logger=require(_0x444c('0x2'))(_0x444c('0x3'));var moment=require(_0x444c('0x4'));var BPromise=require(_0x444c('0x5'));var rp=require(_0x444c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x444c('0x7'));var config=require(_0x444c('0x8'));var attributes=require(_0x444c('0x9'));module[_0x444c('0xa')]=function(_0x5dc613,_0x3766ca){return _0x5dc613['define'](_0x444c('0xb'),attributes,{'tableName':_0x444c('0xc'),'paranoid':![],'indexes':[{'name':_0x444c('0xd'),'fields':[_0x444c('0xe'),_0x444c('0xf')]},{'name':_0x444c('0x10'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index ccf1a3e..91fb9ad 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 _0xa0b6=['request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareReport','create','body','options','raw','CreateSquareReport','catch','update','where','attributes','limit','UpdateSquareReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s'];(function(_0x6b3841,_0x2d83f7){var _0x58dd41=function(_0x147bc8){while(--_0x147bc8){_0x6b3841['push'](_0x6b3841['shift']());}};_0x58dd41(++_0x2d83f7);}(_0xa0b6,0x158));var _0x6a0b=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0xa0b6[_0x386c3e];return _0x4b8e13;};'use strict';var _=require(_0x6a0b('0x0'));var util=require(_0x6a0b('0x1'));var moment=require(_0x6a0b('0x2'));var BPromise=require(_0x6a0b('0x3'));var rs=require(_0x6a0b('0x4'));var fs=require('fs');var Redis=require(_0x6a0b('0x5'));var db=require(_0x6a0b('0x6'))['db'];var utils=require(_0x6a0b('0x7'));var logger=require(_0x6a0b('0x8'))(_0x6a0b('0x9'));var config=require('../../config/environment');var jayson=require(_0x6a0b('0xa'));var client=jayson[_0x6a0b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d2afe,_0x27970c,_0x269fbf){return new BPromise(function(_0x34afb1,_0x29027b){return client[_0x6a0b('0xc')](_0x1d2afe,_0x269fbf)[_0x6a0b('0xd')](function(_0x52ac58){logger[_0x6a0b('0xe')](_0x6a0b('0xf'),_0x27970c,_0x6a0b('0x10'));logger[_0x6a0b('0x11')](_0x6a0b('0x12'),_0x27970c,_0x6a0b('0x10'),JSON[_0x6a0b('0x13')](_0x52ac58));if(_0x52ac58[_0x6a0b('0x14')]){if(_0x52ac58['error'][_0x6a0b('0x15')]===0x1f4){logger['error'](_0x6a0b('0xf'),_0x27970c,_0x52ac58[_0x6a0b('0x14')]['message']);return _0x29027b(_0x52ac58[_0x6a0b('0x14')][_0x6a0b('0x16')]);}logger[_0x6a0b('0x14')](_0x6a0b('0xf'),_0x27970c,_0x52ac58[_0x6a0b('0x14')][_0x6a0b('0x16')]);return _0x34afb1(_0x52ac58[_0x6a0b('0x14')][_0x6a0b('0x16')]);}else{logger['info'](_0x6a0b('0xf'),_0x27970c,_0x6a0b('0x10'));_0x34afb1(_0x52ac58[_0x6a0b('0x17')][_0x6a0b('0x16')]);}})['catch'](function(_0x151b39){logger[_0x6a0b('0x14')]('SquareReport,\x20%s,\x20%s',_0x27970c,_0x151b39);_0x29027b(_0x151b39);});});}exports['CreateSquareReport']=function(_0x411955){var _0xcbaff0=this;return new Promise(function(_0xc3817,_0x47022e){return db[_0x6a0b('0x18')][_0x6a0b('0x19')](_0x411955[_0x6a0b('0x1a')],{'raw':_0x411955[_0x6a0b('0x1b')]?_0x411955[_0x6a0b('0x1b')][_0x6a0b('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2cb099){logger[_0x6a0b('0xe')](_0x6a0b('0x1d'),_0x411955);logger[_0x6a0b('0x11')](_0x6a0b('0x1d'),_0x411955,JSON[_0x6a0b('0x13')](_0x2cb099));_0xc3817(_0x2cb099);})[_0x6a0b('0x1e')](function(_0x42fc0f){logger['error']('CreateSquareReport',_0x42fc0f[_0x6a0b('0x16')],_0x411955);_0x47022e(_0xcbaff0['error'](0x1f4,_0x42fc0f['message']));});});};exports['UpdateSquareReport']=function(_0x2ddb0e){var _0x1d961f=this;return new Promise(function(_0x179867,_0x688076){return db[_0x6a0b('0x18')][_0x6a0b('0x1f')](_0x2ddb0e[_0x6a0b('0x1a')],{'raw':_0x2ddb0e[_0x6a0b('0x1b')]?_0x2ddb0e['options'][_0x6a0b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ddb0e[_0x6a0b('0x1b')]?_0x2ddb0e['options'][_0x6a0b('0x20')]||null:null,'attributes':_0x2ddb0e[_0x6a0b('0x1b')]?_0x2ddb0e[_0x6a0b('0x1b')][_0x6a0b('0x21')]||null:null,'limit':_0x2ddb0e[_0x6a0b('0x1b')]?_0x2ddb0e[_0x6a0b('0x1b')][_0x6a0b('0x22')]||null:null})['then'](function(_0x3169f8){logger[_0x6a0b('0xe')](_0x6a0b('0x23'),_0x2ddb0e);logger[_0x6a0b('0x11')](_0x6a0b('0x23'),_0x2ddb0e,JSON[_0x6a0b('0x13')](_0x3169f8));_0x179867(_0x3169f8);})[_0x6a0b('0x1e')](function(_0xed0f60){logger[_0x6a0b('0x14')](_0x6a0b('0x23'),_0xed0f60[_0x6a0b('0x16')],_0x2ddb0e);_0x688076(_0x1d961f[_0x6a0b('0x14')](0x1f4,_0xed0f60[_0x6a0b('0x16')]));});});}; \ No newline at end of file +var _0xbdeb=['UpdateSquareReport','update','raw','where','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','SquareReport,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','catch','CreateSquareReport','SquareReport','create','body','options'];(function(_0x4bf264,_0x3be730){var _0x3c855f=function(_0xabf944){while(--_0xabf944){_0x4bf264['push'](_0x4bf264['shift']());}};_0x3c855f(++_0x3be730);}(_0xbdeb,0x69));var _0xbbde=function(_0x2db896,_0x165786){_0x2db896=_0x2db896-0x0;var _0x3a281f=_0xbdeb[_0x2db896];return _0x3a281f;};'use strict';var _=require(_0xbbde('0x0'));var util=require(_0xbbde('0x1'));var moment=require(_0xbbde('0x2'));var BPromise=require(_0xbbde('0x3'));var rs=require(_0xbbde('0x4'));var fs=require('fs');var Redis=require(_0xbbde('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbbde('0x6'));var logger=require(_0xbbde('0x7'))('rpc');var config=require(_0xbbde('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbbde('0x9')][_0xbbde('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5290a6,_0x33301b,_0x2e3588){return new BPromise(function(_0x2af7ef,_0x56e8e6){return client[_0xbbde('0xb')](_0x5290a6,_0x2e3588)['then'](function(_0x3d2023){logger[_0xbbde('0xc')](_0xbbde('0xd'),_0x33301b,'request\x20sent');logger[_0xbbde('0xe')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x33301b,'request\x20sent',JSON[_0xbbde('0xf')](_0x3d2023));if(_0x3d2023['error']){if(_0x3d2023['error'][_0xbbde('0x10')]===0x1f4){logger[_0xbbde('0x11')](_0xbbde('0xd'),_0x33301b,_0x3d2023[_0xbbde('0x11')]['message']);return _0x56e8e6(_0x3d2023[_0xbbde('0x11')][_0xbbde('0x12')]);}logger[_0xbbde('0x11')](_0xbbde('0xd'),_0x33301b,_0x3d2023[_0xbbde('0x11')]['message']);return _0x2af7ef(_0x3d2023[_0xbbde('0x11')][_0xbbde('0x12')]);}else{logger[_0xbbde('0xc')](_0xbbde('0xd'),_0x33301b,_0xbbde('0x13'));_0x2af7ef(_0x3d2023[_0xbbde('0x14')][_0xbbde('0x12')]);}})[_0xbbde('0x15')](function(_0x271c03){logger[_0xbbde('0x11')]('SquareReport,\x20%s,\x20%s',_0x33301b,_0x271c03);_0x56e8e6(_0x271c03);});});}exports[_0xbbde('0x16')]=function(_0x1a0739){var _0x1d9648=this;return new Promise(function(_0x23657f,_0x1b2c54){return db[_0xbbde('0x17')][_0xbbde('0x18')](_0x1a0739[_0xbbde('0x19')],{'raw':_0x1a0739[_0xbbde('0x1a')]?_0x1a0739[_0xbbde('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2b3b49){logger[_0xbbde('0xc')](_0xbbde('0x16'),_0x1a0739);logger[_0xbbde('0xe')]('CreateSquareReport',_0x1a0739,JSON[_0xbbde('0xf')](_0x2b3b49));_0x23657f(_0x2b3b49);})['catch'](function(_0x297ebf){logger[_0xbbde('0x11')]('CreateSquareReport',_0x297ebf[_0xbbde('0x12')],_0x1a0739);_0x1b2c54(_0x1d9648[_0xbbde('0x11')](0x1f4,_0x297ebf[_0xbbde('0x12')]));});});};exports[_0xbbde('0x1b')]=function(_0x46443e){var _0x4feea9=this;return new Promise(function(_0x1ef8aa,_0x4a7741){return db['SquareReport'][_0xbbde('0x1c')](_0x46443e[_0xbbde('0x19')],{'raw':_0x46443e[_0xbbde('0x1a')]?_0x46443e['options'][_0xbbde('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46443e[_0xbbde('0x1a')]?_0x46443e[_0xbbde('0x1a')][_0xbbde('0x1e')]||null:null,'attributes':_0x46443e[_0xbbde('0x1a')]?_0x46443e[_0xbbde('0x1a')]['attributes']||null:null,'limit':_0x46443e['options']?_0x46443e[_0xbbde('0x1a')][_0xbbde('0x1f')]||null:null})[_0xbbde('0x20')](function(_0x4dcb9e){logger[_0xbbde('0xc')]('UpdateSquareReport',_0x46443e);logger['debug']('UpdateSquareReport',_0x46443e,JSON['stringify'](_0x4dcb9e));_0x1ef8aa(_0x4dcb9e);})[_0xbbde('0x15')](function(_0x4a00f7){logger[_0xbbde('0x11')]('UpdateSquareReport',_0x4a00f7['message'],_0x46443e);_0x4a7741(_0x4feea9[_0xbbde('0x11')](0x1f4,_0x4a00f7[_0xbbde('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index bb5e849..19703be 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 _0xf3fc=['describe','/:id','show','post','create','put','update','destroy','util','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xf3fc,0x138));var _0xcf3f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf3fc[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require('multer');var util=require(_0xcf3f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcf3f('0x1')]();var fs_extra=require(_0xcf3f('0x2'));var auth=require(_0xcf3f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcf3f('0x4'));var controller=require('./squareReportDetail.controller');router[_0xcf3f('0x5')]('/',auth[_0xcf3f('0x6')](),controller['index']);router[_0xcf3f('0x5')](_0xcf3f('0x7'),auth[_0xcf3f('0x6')](),controller[_0xcf3f('0x8')]);router[_0xcf3f('0x5')](_0xcf3f('0x9'),auth[_0xcf3f('0x6')](),controller[_0xcf3f('0xa')]);router[_0xcf3f('0xb')]('/',auth[_0xcf3f('0x6')](),controller[_0xcf3f('0xc')]);router[_0xcf3f('0xd')](_0xcf3f('0x9'),auth[_0xcf3f('0x6')](),controller[_0xcf3f('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xcf3f('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe180=['post','create','put','update','delete','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x456032,_0x1a799d){var _0x1a53cd=function(_0x162cc8){while(--_0x162cc8){_0x456032['push'](_0x456032['shift']());}};_0x1a53cd(++_0x1a799d);}(_0xe180,0x79));var _0x0e18=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xe180[_0x39e84d];return _0x1991bc;};'use strict';var multer=require('multer');var util=require(_0x0e18('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0e18('0x1'));var router=express['Router']();var fs_extra=require(_0x0e18('0x2'));var auth=require(_0x0e18('0x3'));var interaction=require(_0x0e18('0x4'));var config=require(_0x0e18('0x5'));var controller=require(_0x0e18('0x6'));router[_0x0e18('0x7')]('/',auth[_0x0e18('0x8')](),controller[_0x0e18('0x9')]);router[_0x0e18('0x7')]('/describe',auth[_0x0e18('0x8')](),controller[_0x0e18('0xa')]);router[_0x0e18('0x7')](_0x0e18('0xb'),auth[_0x0e18('0x8')](),controller['show']);router[_0x0e18('0xc')]('/',auth[_0x0e18('0x8')](),controller[_0x0e18('0xd')]);router[_0x0e18('0xe')](_0x0e18('0xb'),auth['isAuthenticated'](),controller[_0x0e18('0xf')]);router[_0x0e18('0x10')](_0x0e18('0xb'),auth[_0x0e18('0x8')](),controller[_0x0e18('0x11')]);module[_0x0e18('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 8054927..187cf76 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 _0x7689=['STRING','TEXT','sequelize','exports'];(function(_0x4ce118,_0x3a5004){var _0x313f86=function(_0x489ba7){while(--_0x489ba7){_0x4ce118['push'](_0x4ce118['shift']());}};_0x313f86(++_0x3a5004);}(_0x7689,0x17e));var _0x9768=function(_0x170b42,_0x15af03){_0x170b42=_0x170b42-0x0;var _0x3f1649=_0x7689[_0x170b42];return _0x3f1649;};'use strict';var Sequelize=require(_0x9768('0x0'));module[_0x9768('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x9768('0x2')]},'application':{'type':Sequelize[_0x9768('0x2')]},'data':{'type':Sequelize[_0x9768('0x3')]},'project_name':{'type':Sequelize[_0x9768('0x2')]},'callerid':{'type':Sequelize[_0x9768('0x2')]}}; \ No newline at end of file +var _0x3815=['TEXT','sequelize','exports','STRING'];(function(_0x48c615,_0x4cc757){var _0x3d9e22=function(_0x1ee9f2){while(--_0x1ee9f2){_0x48c615['push'](_0x48c615['shift']());}};_0x3d9e22(++_0x4cc757);}(_0x3815,0x1d5));var _0x5381=function(_0x28b4f7,_0x329c87){_0x28b4f7=_0x28b4f7-0x0;var _0x2d8b63=_0x3815[_0x28b4f7];return _0x2d8b63;};'use strict';var Sequelize=require(_0x5381('0x0'));module[_0x5381('0x1')]={'uniqueid':{'type':Sequelize[_0x5381('0x2')]},'node':{'type':Sequelize[_0x5381('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x5381('0x3')]},'project_name':{'type':Sequelize[_0x5381('0x2')]},'callerid':{'type':Sequelize[_0x5381('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index aee5a5d..217913d 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 _0xb502=['filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where'];(function(_0x53172f,_0x6223d1){var _0x4f3349=function(_0x4af8a0){while(--_0x4af8a0){_0x53172f['push'](_0x53172f['shift']());}};_0x4f3349(++_0x6223d1);}(_0xb502,0x13e));var _0x2b50=function(_0x2ce730,_0x4bc5db){_0x2ce730=_0x2ce730-0x0;var _0x378a1c=_0xb502[_0x2ce730];return _0x378a1c;};'use strict';var emlformat=require(_0x2b50('0x0'));var rimraf=require(_0x2b50('0x1'));var zipdir=require(_0x2b50('0x2'));var jsonpatch=require(_0x2b50('0x3'));var rp=require('request-promise');var moment=require(_0x2b50('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2b50('0x5'));var path=require(_0x2b50('0x6'));var sox=require(_0x2b50('0x7'));var csv=require(_0x2b50('0x8'));var ejs=require(_0x2b50('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b50('0xa'));var squel=require(_0x2b50('0xb'));var crypto=require(_0x2b50('0xc'));var jsforce=require(_0x2b50('0xd'));var deskjs=require(_0x2b50('0xe'));var toCsv=require(_0x2b50('0x8'));var querystring=require(_0x2b50('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2b50('0x10'));var qs=require(_0x2b50('0x11'));var as=require(_0x2b50('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b50('0x13'))(_0x2b50('0x14'));var utils=require(_0x2b50('0x15'));var config=require(_0x2b50('0x16'));var licenseUtil=require(_0x2b50('0x17'));var db=require(_0x2b50('0x18'))['db'];function respondWithStatusCode(_0x31c0f7,_0xd704f2){_0xd704f2=_0xd704f2||0xcc;return function(_0x8cffd0){if(_0x8cffd0){return _0x31c0f7[_0x2b50('0x19')](_0xd704f2);}return _0x31c0f7[_0x2b50('0x1a')](_0xd704f2)['end']();};}function respondWithResult(_0x54abcb,_0x1f5834){_0x1f5834=_0x1f5834||0xc8;return function(_0x2121f4){if(_0x2121f4){return _0x54abcb[_0x2b50('0x1a')](_0x1f5834)[_0x2b50('0x1b')](_0x2121f4);}};}function respondWithFilteredResult(_0x3710d0,_0x32f0da){return function(_0x52445a){if(_0x52445a){var _0x10ad65=typeof _0x32f0da['offset']===_0x2b50('0x1c')&&typeof _0x32f0da['limit']===_0x2b50('0x1c');var _0xcd98bc=_0x52445a[_0x2b50('0x1d')];var _0x1c609d=_0x10ad65?0x0:_0x32f0da['offset'];var _0x5dd5e3=_0x10ad65?_0x52445a['count']:_0x32f0da[_0x2b50('0x1e')]+_0x32f0da['limit'];var _0x39f44b;if(_0x5dd5e3>=_0xcd98bc){_0x5dd5e3=_0xcd98bc;_0x39f44b=0xc8;}else{_0x39f44b=0xce;}_0x3710d0[_0x2b50('0x1a')](_0x39f44b);return _0x3710d0[_0x2b50('0x1f')](_0x2b50('0x20'),_0x1c609d+'-'+_0x5dd5e3+'/'+_0xcd98bc)[_0x2b50('0x1b')](_0x52445a);}return null;};}function patchUpdates(_0x3e7a0f){return function(_0x4244a0){try{jsonpatch[_0x2b50('0x21')](_0x4244a0,_0x3e7a0f,!![]);}catch(_0x3f4036){return BPromise[_0x2b50('0x22')](_0x3f4036);}return _0x4244a0[_0x2b50('0x23')]();};}function saveUpdates(_0x4eb5c5,_0x1246d0){return function(_0x9a1e3){if(_0x9a1e3){return _0x9a1e3[_0x2b50('0x24')](_0x4eb5c5)[_0x2b50('0x25')](function(_0x3b490c){return _0x3b490c;});}return null;};}function removeEntity(_0x443dde,_0x9adf7d){return function(_0x5a070e){if(_0x5a070e){return _0x5a070e[_0x2b50('0x26')]()[_0x2b50('0x25')](function(){_0x443dde[_0x2b50('0x1a')](0xcc)[_0x2b50('0x27')]();});}};}function handleEntityNotFound(_0x566fe8,_0x1d0f87){return function(_0x255ea2){if(!_0x255ea2){_0x566fe8[_0x2b50('0x19')](0x194);}return _0x255ea2;};}function handleError(_0x5c451e,_0xca4250){_0xca4250=_0xca4250||0x1f4;return function(_0x4b6182){logger[_0x2b50('0x28')](_0x4b6182[_0x2b50('0x29')]);if(_0x4b6182[_0x2b50('0x2a')]){delete _0x4b6182['name'];}_0x5c451e['status'](_0xca4250)[_0x2b50('0x2b')](_0x4b6182);};}exports[_0x2b50('0x2c')]=function(_0x517638,_0x2a20e6){var _0x28d06d={},_0x4ae75a={},_0xbec94c={'count':0x0,'rows':[]};var _0x24ae60=_[_0x2b50('0x2d')](db[_0x2b50('0x2e')][_0x2b50('0x2f')],function(_0x23bbbf){return{'name':_0x23bbbf[_0x2b50('0x30')],'type':_0x23bbbf[_0x2b50('0x31')]['key']};});_0x4ae75a[_0x2b50('0x32')]=_[_0x2b50('0x2d')](_0x24ae60,_0x2b50('0x2a'));_0x4ae75a[_0x2b50('0x33')]=_[_0x2b50('0x34')](_0x517638[_0x2b50('0x33')]);_0x4ae75a['filters']=_['intersection'](_0x4ae75a['model'],_0x4ae75a[_0x2b50('0x33')]);_0x28d06d[_0x2b50('0x35')]=_[_0x2b50('0x36')](_0x4ae75a[_0x2b50('0x32')],qs[_0x2b50('0x37')](_0x517638[_0x2b50('0x33')]['fields']));_0x28d06d[_0x2b50('0x35')]=_0x28d06d[_0x2b50('0x35')][_0x2b50('0x38')]?_0x28d06d['attributes']:_0x4ae75a[_0x2b50('0x32')];if(!_0x517638['query'][_0x2b50('0x39')](_0x2b50('0x3a'))){_0x28d06d[_0x2b50('0x3b')]=qs[_0x2b50('0x3b')](_0x517638[_0x2b50('0x33')][_0x2b50('0x3b')]);_0x28d06d[_0x2b50('0x1e')]=qs[_0x2b50('0x1e')](_0x517638['query'][_0x2b50('0x1e')]);}_0x28d06d['order']=qs[_0x2b50('0x3c')](_0x517638['query'][_0x2b50('0x3c')]);_0x28d06d[_0x2b50('0x3d')]=qs[_0x2b50('0x3e')](_[_0x2b50('0x3f')](_0x517638['query'],_0x4ae75a[_0x2b50('0x3e')]),_0x24ae60);if(_0x517638['query'][_0x2b50('0x40')]){_0x28d06d[_0x2b50('0x3d')]=_[_0x2b50('0x41')](_0x28d06d[_0x2b50('0x3d')],{'$or':_[_0x2b50('0x2d')](_0x24ae60,function(_0x11ad7c){if(_0x11ad7c[_0x2b50('0x31')]!==_0x2b50('0x42')){var _0x53db5c={};_0x53db5c[_0x11ad7c['name']]={'$like':'%'+_0x517638[_0x2b50('0x33')]['filter']+'%'};return _0x53db5c;}})});}_0x28d06d=_['merge']({},_0x28d06d,_0x517638[_0x2b50('0x43')]);var _0x20b5a0={'where':_0x28d06d['where']};return db[_0x2b50('0x2e')][_0x2b50('0x1d')](_0x20b5a0)[_0x2b50('0x25')](function(_0x5667e4){_0xbec94c['count']=_0x5667e4;if(_0x517638[_0x2b50('0x33')][_0x2b50('0x44')]){_0x28d06d[_0x2b50('0x45')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x28d06d);})[_0x2b50('0x25')](function(_0x3c96ce){_0xbec94c[_0x2b50('0x46')]=_0x3c96ce;return _0xbec94c;})[_0x2b50('0x25')](respondWithFilteredResult(_0x2a20e6,_0x28d06d))[_0x2b50('0x47')](handleError(_0x2a20e6,null));};exports['show']=function(_0x489416,_0x465047){var _0x53b7bd={'raw':!![],'where':{'id':_0x489416['params']['id']}},_0x23b3cc={};_0x23b3cc[_0x2b50('0x32')]=_[_0x2b50('0x34')](db['SquareDetailsReport'][_0x2b50('0x2f')]);_0x23b3cc[_0x2b50('0x33')]=_[_0x2b50('0x34')](_0x489416[_0x2b50('0x33')]);_0x23b3cc[_0x2b50('0x3e')]=_[_0x2b50('0x36')](_0x23b3cc['model'],_0x23b3cc[_0x2b50('0x33')]);_0x53b7bd[_0x2b50('0x35')]=_[_0x2b50('0x36')](_0x23b3cc['model'],qs[_0x2b50('0x37')](_0x489416[_0x2b50('0x33')][_0x2b50('0x37')]));_0x53b7bd[_0x2b50('0x35')]=_0x53b7bd[_0x2b50('0x35')][_0x2b50('0x38')]?_0x53b7bd[_0x2b50('0x35')]:_0x23b3cc[_0x2b50('0x32')];if(_0x489416[_0x2b50('0x33')][_0x2b50('0x44')]){_0x53b7bd[_0x2b50('0x45')]=[{'all':!![]}];}_0x53b7bd=_[_0x2b50('0x41')]({},_0x53b7bd,_0x489416['options']);return db[_0x2b50('0x2e')][_0x2b50('0x48')](_0x53b7bd)[_0x2b50('0x25')](handleEntityNotFound(_0x465047,null))[_0x2b50('0x25')](respondWithResult(_0x465047,null))[_0x2b50('0x47')](handleError(_0x465047,null));};exports['create']=function(_0x4d710a,_0x77d5aa){return db[_0x2b50('0x2e')]['create'](_0x4d710a[_0x2b50('0x49')],{})[_0x2b50('0x25')](respondWithResult(_0x77d5aa,0xc9))[_0x2b50('0x47')](handleError(_0x77d5aa,null));};exports['update']=function(_0x22b61c,_0x3d3eda){if(_0x22b61c[_0x2b50('0x49')]['id']){delete _0x22b61c[_0x2b50('0x49')]['id'];}return db['SquareDetailsReport'][_0x2b50('0x48')]({'where':{'id':_0x22b61c[_0x2b50('0x4a')]['id']}})[_0x2b50('0x25')](handleEntityNotFound(_0x3d3eda,null))[_0x2b50('0x25')](saveUpdates(_0x22b61c[_0x2b50('0x49')],null))['then'](respondWithResult(_0x3d3eda,null))[_0x2b50('0x47')](handleError(_0x3d3eda,null));};exports[_0x2b50('0x26')]=function(_0xcdb26c,_0x542ae1){return db['SquareDetailsReport'][_0x2b50('0x48')]({'where':{'id':_0xcdb26c[_0x2b50('0x4a')]['id']}})['then'](handleEntityNotFound(_0x542ae1,null))[_0x2b50('0x25')](removeEntity(_0x542ae1,null))[_0x2b50('0x47')](handleError(_0x542ae1,null));};exports['describe']=function(_0x5ac85c,_0x24102d){return db[_0x2b50('0x2e')][_0x2b50('0x4b')]()[_0x2b50('0x25')](respondWithResult(_0x24102d,null))[_0x2b50('0x47')](handleError(_0x24102d,null));}; \ No newline at end of file +var _0x2d5f=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','name','send','index','map','SquareDetailsReport','fieldName','type','key','query','keys','filters','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','rawAttributes','intersection','length','include','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash'];(function(_0x888385,_0x9cdc66){var _0x22d5c2=function(_0x3b1599){while(--_0x3b1599){_0x888385['push'](_0x888385['shift']());}};_0x22d5c2(++_0x9cdc66);}(_0x2d5f,0x1ee));var _0xf2d5=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0x2d5f[_0x454165];return _0x56db53;};'use strict';var emlformat=require(_0xf2d5('0x0'));var rimraf=require(_0xf2d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf2d5('0x2'));var rp=require(_0xf2d5('0x3'));var moment=require('moment');var BPromise=require(_0xf2d5('0x4'));var Mustache=require(_0xf2d5('0x5'));var util=require('util');var path=require(_0xf2d5('0x6'));var sox=require('sox');var csv=require(_0xf2d5('0x7'));var ejs=require(_0xf2d5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf2d5('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf2d5('0xa'));var deskjs=require(_0xf2d5('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf2d5('0xc'));var Papa=require('papaparse');var Redis=require(_0xf2d5('0xd'));var authService=require(_0xf2d5('0xe'));var qs=require(_0xf2d5('0xf'));var as=require(_0xf2d5('0x10'));var hardwareService=require(_0xf2d5('0x11'));var logger=require(_0xf2d5('0x12'))(_0xf2d5('0x13'));var utils=require(_0xf2d5('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf2d5('0x15'))['db'];function respondWithStatusCode(_0x16d350,_0x4b3179){_0x4b3179=_0x4b3179||0xcc;return function(_0x55d5d6){if(_0x55d5d6){return _0x16d350['sendStatus'](_0x4b3179);}return _0x16d350[_0xf2d5('0x16')](_0x4b3179)[_0xf2d5('0x17')]();};}function respondWithResult(_0xf703fe,_0x2cc6c2){_0x2cc6c2=_0x2cc6c2||0xc8;return function(_0x93d692){if(_0x93d692){return _0xf703fe[_0xf2d5('0x16')](_0x2cc6c2)[_0xf2d5('0x18')](_0x93d692);}};}function respondWithFilteredResult(_0x8e5b3,_0x465272){return function(_0x51e4c9){if(_0x51e4c9){var _0x32dc56=typeof _0x465272[_0xf2d5('0x19')]===_0xf2d5('0x1a')&&typeof _0x465272['limit']==='undefined';var _0xfb4994=_0x51e4c9[_0xf2d5('0x1b')];var _0x5aee81=_0x32dc56?0x0:_0x465272[_0xf2d5('0x19')];var _0x497342=_0x32dc56?_0x51e4c9[_0xf2d5('0x1b')]:_0x465272[_0xf2d5('0x19')]+_0x465272[_0xf2d5('0x1c')];var _0x2a431f;if(_0x497342>=_0xfb4994){_0x497342=_0xfb4994;_0x2a431f=0xc8;}else{_0x2a431f=0xce;}_0x8e5b3[_0xf2d5('0x16')](_0x2a431f);return _0x8e5b3['set'](_0xf2d5('0x1d'),_0x5aee81+'-'+_0x497342+'/'+_0xfb4994)[_0xf2d5('0x18')](_0x51e4c9);}return null;};}function patchUpdates(_0x18ac6f){return function(_0x548d30){try{jsonpatch[_0xf2d5('0x1e')](_0x548d30,_0x18ac6f,!![]);}catch(_0x120585){return BPromise[_0xf2d5('0x1f')](_0x120585);}return _0x548d30['save']();};}function saveUpdates(_0x2ba1ef,_0x9312){return function(_0x589f7b){if(_0x589f7b){return _0x589f7b[_0xf2d5('0x20')](_0x2ba1ef)[_0xf2d5('0x21')](function(_0x2baf66){return _0x2baf66;});}return null;};}function removeEntity(_0x154a4a,_0x1de55f){return function(_0x41f288){if(_0x41f288){return _0x41f288[_0xf2d5('0x22')]()['then'](function(){_0x154a4a[_0xf2d5('0x16')](0xcc)[_0xf2d5('0x17')]();});}};}function handleEntityNotFound(_0x10948e,_0x2e0021){return function(_0x11a2b6){if(!_0x11a2b6){_0x10948e[_0xf2d5('0x23')](0x194);}return _0x11a2b6;};}function handleError(_0x452cf4,_0x2c2d95){_0x2c2d95=_0x2c2d95||0x1f4;return function(_0x4addae){logger['error'](_0x4addae['stack']);if(_0x4addae['name']){delete _0x4addae[_0xf2d5('0x24')];}_0x452cf4['status'](_0x2c2d95)[_0xf2d5('0x25')](_0x4addae);};}exports[_0xf2d5('0x26')]=function(_0x14b6a8,_0x3138f4){var _0x27d6cb={},_0x2a0740={},_0x2db19c={'count':0x0,'rows':[]};var _0x4237c4=_[_0xf2d5('0x27')](db[_0xf2d5('0x28')]['rawAttributes'],function(_0x7c3d42){return{'name':_0x7c3d42[_0xf2d5('0x29')],'type':_0x7c3d42[_0xf2d5('0x2a')][_0xf2d5('0x2b')]};});_0x2a0740['model']=_[_0xf2d5('0x27')](_0x4237c4,_0xf2d5('0x24'));_0x2a0740[_0xf2d5('0x2c')]=_[_0xf2d5('0x2d')](_0x14b6a8[_0xf2d5('0x2c')]);_0x2a0740[_0xf2d5('0x2e')]=_['intersection'](_0x2a0740['model'],_0x2a0740[_0xf2d5('0x2c')]);_0x27d6cb[_0xf2d5('0x2f')]=_['intersection'](_0x2a0740[_0xf2d5('0x30')],qs[_0xf2d5('0x31')](_0x14b6a8['query'][_0xf2d5('0x31')]));_0x27d6cb[_0xf2d5('0x2f')]=_0x27d6cb['attributes']['length']?_0x27d6cb[_0xf2d5('0x2f')]:_0x2a0740[_0xf2d5('0x30')];if(!_0x14b6a8['query'][_0xf2d5('0x32')]('nolimit')){_0x27d6cb['limit']=qs[_0xf2d5('0x1c')](_0x14b6a8['query']['limit']);_0x27d6cb['offset']=qs['offset'](_0x14b6a8[_0xf2d5('0x2c')]['offset']);}_0x27d6cb[_0xf2d5('0x33')]=qs['sort'](_0x14b6a8['query'][_0xf2d5('0x34')]);_0x27d6cb[_0xf2d5('0x35')]=qs[_0xf2d5('0x2e')](_[_0xf2d5('0x36')](_0x14b6a8[_0xf2d5('0x2c')],_0x2a0740[_0xf2d5('0x2e')]),_0x4237c4);if(_0x14b6a8[_0xf2d5('0x2c')][_0xf2d5('0x37')]){_0x27d6cb[_0xf2d5('0x35')]=_[_0xf2d5('0x38')](_0x27d6cb[_0xf2d5('0x35')],{'$or':_[_0xf2d5('0x27')](_0x4237c4,function(_0x5cec85){if(_0x5cec85[_0xf2d5('0x2a')]!==_0xf2d5('0x39')){var _0x5f2381={};_0x5f2381[_0x5cec85[_0xf2d5('0x24')]]={'$like':'%'+_0x14b6a8['query'][_0xf2d5('0x37')]+'%'};return _0x5f2381;}})});}_0x27d6cb=_[_0xf2d5('0x38')]({},_0x27d6cb,_0x14b6a8['options']);var _0x1ac934={'where':_0x27d6cb[_0xf2d5('0x35')]};return db[_0xf2d5('0x28')][_0xf2d5('0x1b')](_0x1ac934)['then'](function(_0x160c5c){_0x2db19c[_0xf2d5('0x1b')]=_0x160c5c;if(_0x14b6a8[_0xf2d5('0x2c')][_0xf2d5('0x3a')]){_0x27d6cb['include']=[{'all':!![]}];}return db[_0xf2d5('0x28')]['findAll'](_0x27d6cb);})[_0xf2d5('0x21')](function(_0x2d1c1b){_0x2db19c[_0xf2d5('0x3b')]=_0x2d1c1b;return _0x2db19c;})['then'](respondWithFilteredResult(_0x3138f4,_0x27d6cb))[_0xf2d5('0x3c')](handleError(_0x3138f4,null));};exports[_0xf2d5('0x3d')]=function(_0x2a65a8,_0x195aac){var _0x4d3610={'raw':!![],'where':{'id':_0x2a65a8[_0xf2d5('0x3e')]['id']}},_0x2d7343={};_0x2d7343[_0xf2d5('0x30')]=_[_0xf2d5('0x2d')](db['SquareDetailsReport'][_0xf2d5('0x3f')]);_0x2d7343[_0xf2d5('0x2c')]=_[_0xf2d5('0x2d')](_0x2a65a8[_0xf2d5('0x2c')]);_0x2d7343[_0xf2d5('0x2e')]=_[_0xf2d5('0x40')](_0x2d7343[_0xf2d5('0x30')],_0x2d7343[_0xf2d5('0x2c')]);_0x4d3610[_0xf2d5('0x2f')]=_[_0xf2d5('0x40')](_0x2d7343[_0xf2d5('0x30')],qs[_0xf2d5('0x31')](_0x2a65a8['query'][_0xf2d5('0x31')]));_0x4d3610['attributes']=_0x4d3610[_0xf2d5('0x2f')][_0xf2d5('0x41')]?_0x4d3610[_0xf2d5('0x2f')]:_0x2d7343[_0xf2d5('0x30')];if(_0x2a65a8[_0xf2d5('0x2c')][_0xf2d5('0x3a')]){_0x4d3610[_0xf2d5('0x42')]=[{'all':!![]}];}_0x4d3610=_[_0xf2d5('0x38')]({},_0x4d3610,_0x2a65a8[_0xf2d5('0x43')]);return db[_0xf2d5('0x28')][_0xf2d5('0x44')](_0x4d3610)[_0xf2d5('0x21')](handleEntityNotFound(_0x195aac,null))[_0xf2d5('0x21')](respondWithResult(_0x195aac,null))[_0xf2d5('0x3c')](handleError(_0x195aac,null));};exports[_0xf2d5('0x45')]=function(_0x18a28c,_0x472d4c){return db['SquareDetailsReport'][_0xf2d5('0x45')](_0x18a28c[_0xf2d5('0x46')],{})['then'](respondWithResult(_0x472d4c,0xc9))[_0xf2d5('0x3c')](handleError(_0x472d4c,null));};exports['update']=function(_0x27acb9,_0x5ef077){if(_0x27acb9[_0xf2d5('0x46')]['id']){delete _0x27acb9['body']['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x27acb9['params']['id']}})[_0xf2d5('0x21')](handleEntityNotFound(_0x5ef077,null))['then'](saveUpdates(_0x27acb9[_0xf2d5('0x46')],null))[_0xf2d5('0x21')](respondWithResult(_0x5ef077,null))[_0xf2d5('0x3c')](handleError(_0x5ef077,null));};exports['destroy']=function(_0x30426f,_0x1388dc){return db[_0xf2d5('0x28')]['find']({'where':{'id':_0x30426f[_0xf2d5('0x3e')]['id']}})[_0xf2d5('0x21')](handleEntityNotFound(_0x1388dc,null))[_0xf2d5('0x21')](removeEntity(_0x1388dc,null))[_0xf2d5('0x3c')](handleError(_0x1388dc,null));};exports['describe']=function(_0x5d57a2,_0x1b6ff0){return db[_0xf2d5('0x28')][_0xf2d5('0x47')]()['then'](respondWithResult(_0x1b6ff0,null))[_0xf2d5('0x3c')](handleError(_0x1b6ff0,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index de080de..f300314 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 _0x5321=['../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x5321,0x148));var _0x1532=function(_0xed9ce6,_0x47ee88){_0xed9ce6=_0xed9ce6-0x0;var _0xd6456d=_0x5321[_0xed9ce6];return _0xd6456d;};'use strict';var _=require(_0x1532('0x0'));var util=require(_0x1532('0x1'));var logger=require(_0x1532('0x2'))(_0x1532('0x3'));var moment=require(_0x1532('0x4'));var BPromise=require(_0x1532('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1532('0x6'));var rimraf=require(_0x1532('0x7'));var config=require(_0x1532('0x8'));var attributes=require(_0x1532('0x9'));module[_0x1532('0xa')]=function(_0x373afe,_0x14977c){return _0x373afe[_0x1532('0xb')](_0x1532('0xc'),attributes,{'tableName':_0x1532('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeaac=['path','rimraf','../../config/environment','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','moment','bluebird'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0xeaac,0x14f));var _0xceaa=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xeaac[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xceaa('0x0'));var util=require(_0xceaa('0x1'));var logger=require(_0xceaa('0x2'))('api');var moment=require(_0xceaa('0x3'));var BPromise=require(_0xceaa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xceaa('0x5'));var rimraf=require(_0xceaa('0x6'));var config=require(_0xceaa('0x7'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x5e7029,_0x29aa1f){return _0x5e7029['define'](_0xceaa('0x8'),attributes,{'tableName':_0xceaa('0x9'),'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 5c29342..3baf532 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 _0x36ee=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw'];(function(_0x352f30,_0x33c4fa){var _0x5d8783=function(_0x2616d8){while(--_0x2616d8){_0x352f30['push'](_0x352f30['shift']());}};_0x5d8783(++_0x33c4fa);}(_0x36ee,0xe8));var _0xe36e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x36ee[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe36e('0x0'));var BPromise=require('bluebird');var rs=require(_0xe36e('0x1'));var fs=require('fs');var Redis=require(_0xe36e('0x2'));var db=require(_0xe36e('0x3'))['db'];var utils=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));var config=require(_0xe36e('0x7'));var jayson=require(_0xe36e('0x8'));var client=jayson[_0xe36e('0x9')][_0xe36e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21be0b,_0x1aa596,_0x51b4bd){return new BPromise(function(_0x74b4b7,_0x4aebdd){return client[_0xe36e('0xb')](_0x21be0b,_0x51b4bd)[_0xe36e('0xc')](function(_0x46f239){logger['info'](_0xe36e('0xd'),_0x1aa596,'request\x20sent');logger[_0xe36e('0xe')](_0xe36e('0xf'),_0x1aa596,_0xe36e('0x10'),JSON[_0xe36e('0x11')](_0x46f239));if(_0x46f239[_0xe36e('0x12')]){if(_0x46f239[_0xe36e('0x12')][_0xe36e('0x13')]===0x1f4){logger[_0xe36e('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x1aa596,_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);return _0x4aebdd(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}logger['error'](_0xe36e('0xd'),_0x1aa596,_0x46f239['error']['message']);return _0x74b4b7(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}else{logger[_0xe36e('0x15')](_0xe36e('0xd'),_0x1aa596,_0xe36e('0x10'));_0x74b4b7(_0x46f239[_0xe36e('0x16')][_0xe36e('0x14')]);}})[_0xe36e('0x17')](function(_0x387c37){logger[_0xe36e('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x1aa596,_0x387c37);_0x4aebdd(_0x387c37);});});}exports[_0xe36e('0x18')]=function(_0x2184ae){var _0x56c019=this;return new Promise(function(_0x21d9a3,_0x533c06){return db[_0xe36e('0x19')][_0xe36e('0x1a')](_0x2184ae['body'],{'raw':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x21e95e){logger[_0xe36e('0x15')](_0xe36e('0x18'),_0x2184ae);logger[_0xe36e('0xe')](_0xe36e('0x18'),_0x2184ae,JSON[_0xe36e('0x11')](_0x21e95e));_0x21d9a3(_0x21e95e);})['catch'](function(_0xd71137){logger[_0xe36e('0x12')](_0xe36e('0x18'),_0xd71137[_0xe36e('0x14')],_0x2184ae);_0x533c06(_0x56c019[_0xe36e('0x12')](0x1f4,_0xd71137['message']));});});}; \ No newline at end of file +var _0x94d4=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','SquareDetailsReport,\x20%s,\x20%s','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','then','stringify','lodash','util','bluebird'];(function(_0x4112e1,_0x3d364d){var _0x360dad=function(_0x2b0fda){while(--_0x2b0fda){_0x4112e1['push'](_0x4112e1['shift']());}};_0x360dad(++_0x3d364d);}(_0x94d4,0xa5));var _0x494d=function(_0x43232b,_0x3a34c5){_0x43232b=_0x43232b-0x0;var _0x587b94=_0x94d4[_0x43232b];return _0x587b94;};'use strict';var _=require(_0x494d('0x0'));var util=require(_0x494d('0x1'));var moment=require('moment');var BPromise=require(_0x494d('0x2'));var rs=require(_0x494d('0x3'));var fs=require('fs');var Redis=require(_0x494d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x494d('0x5'));var logger=require(_0x494d('0x6'))(_0x494d('0x7'));var config=require(_0x494d('0x8'));var jayson=require(_0x494d('0x9'));var client=jayson[_0x494d('0xa')][_0x494d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c53d7,_0x4f4576,_0x5269db){return new BPromise(function(_0x396280,_0x3f6b68){return client['request'](_0x4c53d7,_0x5269db)['then'](function(_0x456fe8){logger[_0x494d('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x4f4576,_0x494d('0xd'));logger[_0x494d('0xe')](_0x494d('0xf'),_0x4f4576,_0x494d('0xd'),JSON['stringify'](_0x456fe8));if(_0x456fe8[_0x494d('0x10')]){if(_0x456fe8[_0x494d('0x10')]['code']===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x4f4576,_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);return _0x3f6b68(_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);}logger[_0x494d('0x10')](_0x494d('0x12'),_0x4f4576,_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);return _0x396280(_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);}else{logger[_0x494d('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x4f4576,_0x494d('0xd'));_0x396280(_0x456fe8[_0x494d('0x13')][_0x494d('0x11')]);}})[_0x494d('0x14')](function(_0x120488){logger[_0x494d('0x10')](_0x494d('0x12'),_0x4f4576,_0x120488);_0x3f6b68(_0x120488);});});}exports[_0x494d('0x15')]=function(_0x4301fc){var _0x1552bb=this;return new Promise(function(_0x12a484,_0xd67ea4){return db[_0x494d('0x16')][_0x494d('0x17')](_0x4301fc[_0x494d('0x18')],{'raw':_0x4301fc[_0x494d('0x19')]?_0x4301fc[_0x494d('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x494d('0x1a')](function(_0x172763){logger[_0x494d('0xc')](_0x494d('0x15'),_0x4301fc);logger['debug']('CreateSquareDetailsReport',_0x4301fc,JSON[_0x494d('0x1b')](_0x172763));_0x12a484(_0x172763);})[_0x494d('0x14')](function(_0x56e992){logger['error'](_0x494d('0x15'),_0x56e992['message'],_0x4301fc);_0xd67ea4(_0x1552bb[_0x494d('0x10')](0x1f4,_0x56e992['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 7e44878..3f943f0 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 _0xd082=['../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess','exports','express','Router'];(function(_0x1d5126,_0x1a950a){var _0x1be76d=function(_0x357b99){while(--_0x357b99){_0x1d5126['push'](_0x1d5126['shift']());}};_0x1be76d(++_0x1a950a);}(_0xd082,0x73));var _0x2d08=function(_0x5f349e,_0x2b94d4){_0x5f349e=_0x5f349e-0x0;var _0x4121d8=_0xd082[_0x5f349e];return _0x4121d8;};'use strict';var express=require(_0x2d08('0x0'));var router=express[_0x2d08('0x1')]();var auth=require(_0x2d08('0x2'));var controller=require(_0x2d08('0x3'));router[_0x2d08('0x4')]('/',auth[_0x2d08('0x5')](),controller['index']);router[_0x2d08('0x4')](_0x2d08('0x6'),auth[_0x2d08('0x5')](),controller[_0x2d08('0x7')]);module[_0x2d08('0x8')]=router; \ No newline at end of file +var _0x18bc=['express','Router','../../components/auth/service','isAuthenticated','index','get','killProcess'];(function(_0x3a6974,_0x482a57){var _0x52ecf8=function(_0x1cb172){while(--_0x1cb172){_0x3a6974['push'](_0x3a6974['shift']());}};_0x52ecf8(++_0x482a57);}(_0x18bc,0xfc));var _0xc18b=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0x18bc[_0x49052b];return _0x48c045;};'use strict';var express=require(_0xc18b('0x0'));var router=express[_0xc18b('0x1')]();var auth=require(_0xc18b('0x2'));var controller=require('./system.controller');router['get']('/',auth[_0xc18b('0x3')](),controller[_0xc18b('0x4')]);router[_0xc18b('0x5')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0xc18b('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index ee53886..6531cc7 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 _0x131b=['lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','send','index','getAllData','then','catch','json','killProcess','components/import/cm','format','pid','length','indexOf','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird'];(function(_0x2e84ee,_0x283c59){var _0x5c82d0=function(_0x9cf8ca){while(--_0x9cf8ca){_0x2e84ee['push'](_0x2e84ee['shift']());}};_0x5c82d0(++_0x283c59);}(_0x131b,0xd1));var _0xb131=function(_0x3e9155,_0x38e9d2){_0x3e9155=_0x3e9155-0x0;var _0x5de67a=_0x131b[_0x3e9155];return _0x5de67a;};'use strict';var info=require(_0xb131('0x0'));var exec=require(_0xb131('0x1'))[_0xb131('0x2')];var logger=require(_0xb131('0x3'))(_0xb131('0x4'));var util=require(_0xb131('0x5'));var BPromise=require(_0xb131('0x6'));var _=require(_0xb131('0x7'));function handleError(_0x3cd609,_0x1db0a3,_0x4d49b4){_0x1db0a3=_0x1db0a3||0x1f4;return function(_0xf2fe87){logger[_0xb131('0x8')](_0xb131('0x9'),_0x4d49b4,_0x1db0a3,util['inspect'](_0xf2fe87,{'showHidden':![],'depth':null}));delete _0xf2fe87['name'];_0x3cd609[_0xb131('0xa')](_0x1db0a3)[_0xb131('0xb')](_0xf2fe87);};}exports[_0xb131('0xc')]=function(_0x55973e,_0x4d528e){return info[_0xb131('0xd')]()[_0xb131('0xe')](function(_0x2e14a0){return _0x4d528e[_0xb131('0xa')](0xc8)['json'](_0x2e14a0);})[_0xb131('0xf')](function(_0x42ea2f){return _0x4d528e[_0xb131('0xa')](0x1f4)[_0xb131('0x10')](_0x42ea2f);});};exports[_0xb131('0x11')]=function(_0x3c5d9b,_0x42c558){var _0x4f6703=[_0xb131('0x12')];return new BPromise(function(_0x3a6185,_0x4bb204){return exec(util[_0xb131('0x13')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x3c5d9b['params'][_0xb131('0x14')]),function(_0x44a969,_0x3ff2f7,_0x1a5238){if(_0x44a969){return _0x4bb204(_0x44a969);}return _0x3a6185(_0x3ff2f7);});})[_0xb131('0xe')](function(_0x5516bf){var _0x5e73a3=![];var _0x3f3c8c=_0x5516bf['split'](/\n/);for(var _0x3d21e7=0x0,_0x2e9d75=_0x4f6703[_0xb131('0x15')];_0x3d21e7<_0x2e9d75,_0x5e73a3===![];_0x3d21e7+=0x1){if(_0x5516bf[_0xb131('0x16')](_0x4f6703[_0x3d21e7])>=0x0){_0x5e73a3=!![];}}if(!_0x5e73a3){throw new Error(util[_0xb131('0x13')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x3c5d9b[_0xb131('0x17')][_0xb131('0x14')]));}process[_0xb131('0x18')](_0x3c5d9b[_0xb131('0x17')][_0xb131('0x14')],_0xb131('0x19'));return _0x42c558[_0xb131('0xa')](0xc8)[_0xb131('0x10')]({'message':util[_0xb131('0x13')](_0xb131('0x1a'),_0x3c5d9b[_0xb131('0x17')]['pid'])});})[_0xb131('0xf')](handleError(_0x42c558,null,'killProcess'));}; \ No newline at end of file +var _0x2a4b=['name','send','index','getAllData','then','json','catch','status','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','length','indexOf','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect'];(function(_0x1c2652,_0xb3df87){var _0x5bad6d=function(_0x17fec9){while(--_0x17fec9){_0x1c2652['push'](_0x1c2652['shift']());}};_0x5bad6d(++_0xb3df87);}(_0x2a4b,0x18b));var _0xb2a4=function(_0x3217d3,_0xeed3df){_0x3217d3=_0x3217d3-0x0;var _0x67517b=_0x2a4b[_0x3217d3];return _0x67517b;};'use strict';var info=require(_0xb2a4('0x0'));var exec=require(_0xb2a4('0x1'))['exec'];var logger=require(_0xb2a4('0x2'))(_0xb2a4('0x3'));var util=require(_0xb2a4('0x4'));var BPromise=require(_0xb2a4('0x5'));var _=require(_0xb2a4('0x6'));function handleError(_0x4ec43e,_0x13325e,_0x3eb80f){_0x13325e=_0x13325e||0x1f4;return function(_0x17d9bc){logger[_0xb2a4('0x7')](_0xb2a4('0x8'),_0x3eb80f,_0x13325e,util[_0xb2a4('0x9')](_0x17d9bc,{'showHidden':![],'depth':null}));delete _0x17d9bc[_0xb2a4('0xa')];_0x4ec43e['status'](_0x13325e)[_0xb2a4('0xb')](_0x17d9bc);};}exports[_0xb2a4('0xc')]=function(_0x430d00,_0x61ba28){return info[_0xb2a4('0xd')]()[_0xb2a4('0xe')](function(_0x247630){return _0x61ba28['status'](0xc8)[_0xb2a4('0xf')](_0x247630);})[_0xb2a4('0x10')](function(_0x1dac12){return _0x61ba28[_0xb2a4('0x11')](0x1f4)['json'](_0x1dac12);});};exports[_0xb2a4('0x12')]=function(_0xe3d106,_0x255c77){var _0x3b9ee9=['components/import/cm'];return new BPromise(function(_0x504a23,_0x16ef69){return exec(util[_0xb2a4('0x13')](_0xb2a4('0x14'),_0xe3d106['params'][_0xb2a4('0x15')]),function(_0x386ea0,_0x2d6237,_0x37ba3e){if(_0x386ea0){return _0x16ef69(_0x386ea0);}return _0x504a23(_0x2d6237);});})[_0xb2a4('0xe')](function(_0x5409a8){var _0x2d5d74=![];var _0x469bfd=_0x5409a8['split'](/\n/);for(var _0x31bc12=0x0,_0x10372d=_0x3b9ee9[_0xb2a4('0x16')];_0x31bc12<_0x10372d,_0x2d5d74===![];_0x31bc12+=0x1){if(_0x5409a8[_0xb2a4('0x17')](_0x3b9ee9[_0x31bc12])>=0x0){_0x2d5d74=!![];}}if(!_0x2d5d74){throw new Error(util[_0xb2a4('0x13')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0xe3d106['params'][_0xb2a4('0x15')]));}process['kill'](_0xe3d106[_0xb2a4('0x18')]['pid'],_0xb2a4('0x19'));return _0x255c77['status'](0xc8)[_0xb2a4('0xf')]({'message':util[_0xb2a4('0x13')](_0xb2a4('0x1a'),_0xe3d106[_0xb2a4('0x18')][_0xb2a4('0x15')])});})[_0xb2a4('0x10')](handleError(_0x255c77,null,_0xb2a4('0x12')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 0656498..14cedc3 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 _0xc1d7=['../../components/interaction/service','../../config/environment','./tag.controller','index','get','/:id','isAuthenticated','show','create','put','update','delete','exports','path','connect-timeout','express'];(function(_0xdc4996,_0x15bedc){var _0x20fbb9=function(_0x47c811){while(--_0x47c811){_0xdc4996['push'](_0xdc4996['shift']());}};_0x20fbb9(++_0x15bedc);}(_0xc1d7,0x1ed));var _0x7c1d=function(_0x396910,_0x397bda){_0x396910=_0x396910-0x0;var _0x217d81=_0xc1d7[_0x396910];return _0x217d81;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7c1d('0x0'));var timeout=require(_0x7c1d('0x1'));var express=require(_0x7c1d('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7c1d('0x3'));var config=require(_0x7c1d('0x4'));var controller=require(_0x7c1d('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x7c1d('0x6')]);router[_0x7c1d('0x7')](_0x7c1d('0x8'),auth[_0x7c1d('0x9')](),controller[_0x7c1d('0xa')]);router['post']('/',auth[_0x7c1d('0x9')](),controller[_0x7c1d('0xb')]);router[_0x7c1d('0xc')](_0x7c1d('0x8'),auth[_0x7c1d('0x9')](),controller[_0x7c1d('0xd')]);router[_0x7c1d('0xe')](_0x7c1d('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x7c1d('0xf')]=router; \ No newline at end of file +var _0x1f55=['create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post'];(function(_0x2a8842,_0x1acee2){var _0x101913=function(_0x151470){while(--_0x151470){_0x2a8842['push'](_0x2a8842['shift']());}};_0x101913(++_0x1acee2);}(_0x1f55,0x136));var _0x51f5=function(_0x5c6f56,_0x429d5f){_0x5c6f56=_0x5c6f56-0x0;var _0xa9ff82=_0x1f55[_0x5c6f56];return _0xa9ff82;};'use strict';var multer=require(_0x51f5('0x0'));var util=require(_0x51f5('0x1'));var path=require('path');var timeout=require(_0x51f5('0x2'));var express=require(_0x51f5('0x3'));var router=express[_0x51f5('0x4')]();var fs_extra=require(_0x51f5('0x5'));var auth=require(_0x51f5('0x6'));var interaction=require(_0x51f5('0x7'));var config=require(_0x51f5('0x8'));var controller=require('./tag.controller');router[_0x51f5('0x9')]('/',auth[_0x51f5('0xa')](),controller[_0x51f5('0xb')]);router[_0x51f5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x51f5('0xc')]('/',auth[_0x51f5('0xa')](),controller[_0x51f5('0xd')]);router[_0x51f5('0xe')](_0x51f5('0xf'),auth[_0x51f5('0xa')](),controller[_0x51f5('0x10')]);router[_0x51f5('0x11')](_0x51f5('0xf'),auth[_0x51f5('0xa')](),controller['destroy']);module[_0x51f5('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 70374dd..044326f 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 _0x2ca5=['exports','STRING','name','#0091EA'];(function(_0x1e8f35,_0x3db390){var _0x446c13=function(_0xa1e11e){while(--_0xa1e11e){_0x1e8f35['push'](_0x1e8f35['shift']());}};_0x446c13(++_0x3db390);}(_0x2ca5,0x108));var _0x52ca=function(_0x12363c,_0x464c7b){_0x12363c=_0x12363c-0x0;var _0x2ab2c2=_0x2ca5[_0x12363c];return _0x2ab2c2;};'use strict';var Sequelize=require('sequelize');module[_0x52ca('0x0')]={'name':{'type':Sequelize[_0x52ca('0x1')],'unique':_0x52ca('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x52ca('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x777d=['#0091EA','exports','STRING','name'];(function(_0x3fa43e,_0x249c4e){var _0x1ebd7f=function(_0x5d26e6){while(--_0x5d26e6){_0x3fa43e['push'](_0x3fa43e['shift']());}};_0x1ebd7f(++_0x249c4e);}(_0x777d,0xe9));var _0xd777=function(_0x3ef2d5,_0x423d46){_0x3ef2d5=_0x3ef2d5-0x0;var _0x2fefb2=_0x777d[_0x3ef2d5];return _0x2fefb2;};'use strict';var Sequelize=require('sequelize');module[_0xd777('0x0')]={'name':{'type':Sequelize[_0xd777('0x1')],'unique':_0xd777('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xd777('0x3')},'description':{'type':Sequelize[_0xd777('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index a607ade..e2bb32b 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 _0xd52d=['destroy','get','Tags','UserProfileResource','sendStatus','error','name','send','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','apply','reject','update','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd52d,0x1c7));var _0xdd52=function(_0xf99fcf,_0x8abb59){_0xf99fcf=_0xf99fcf-0x0;var _0x510ead=_0xd52d[_0xf99fcf];return _0x510ead;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd52('0x0'));var zipdir=require(_0xdd52('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd52('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdd52('0x3'));var util=require(_0xdd52('0x4'));var path=require(_0xdd52('0x5'));var sox=require(_0xdd52('0x6'));var csv=require(_0xdd52('0x7'));var ejs=require(_0xdd52('0x8'));var fs=require('fs');var fs_extra=require(_0xdd52('0x9'));var _=require(_0xdd52('0xa'));var squel=require('squel');var crypto=require(_0xdd52('0xb'));var jsforce=require(_0xdd52('0xc'));var deskjs=require(_0xdd52('0xd'));var toCsv=require(_0xdd52('0x7'));var querystring=require(_0xdd52('0xe'));var Papa=require(_0xdd52('0xf'));var Redis=require(_0xdd52('0x10'));var authService=require(_0xdd52('0x11'));var qs=require(_0xdd52('0x12'));var as=require(_0xdd52('0x13'));var hardwareService=require(_0xdd52('0x14'));var logger=require(_0xdd52('0x15'))(_0xdd52('0x16'));var utils=require('../../config/utils');var config=require(_0xdd52('0x17'));var licenseUtil=require(_0xdd52('0x18'));var db=require(_0xdd52('0x19'))['db'];function respondWithStatusCode(_0x2e940f,_0x19283f){_0x19283f=_0x19283f||0xcc;return function(_0xee8463){if(_0xee8463){return _0x2e940f['sendStatus'](_0x19283f);}return _0x2e940f[_0xdd52('0x1a')](_0x19283f)[_0xdd52('0x1b')]();};}function respondWithResult(_0x2e5642,_0x55b823){_0x55b823=_0x55b823||0xc8;return function(_0x3f6585){if(_0x3f6585){return _0x2e5642[_0xdd52('0x1a')](_0x55b823)[_0xdd52('0x1c')](_0x3f6585);}};}function respondWithFilteredResult(_0x181876,_0x336797){return function(_0x12c6da){if(_0x12c6da){var _0x25a2b7=typeof _0x336797[_0xdd52('0x1d')]==='undefined'&&typeof _0x336797[_0xdd52('0x1e')]==='undefined';var _0x2822be=_0x12c6da[_0xdd52('0x1f')];var _0x4568dc=_0x25a2b7?0x0:_0x336797[_0xdd52('0x1d')];var _0x4dc017=_0x25a2b7?_0x12c6da[_0xdd52('0x1f')]:_0x336797[_0xdd52('0x1d')]+_0x336797[_0xdd52('0x1e')];var _0x13f667;if(_0x4dc017>=_0x2822be){_0x4dc017=_0x2822be;_0x13f667=0xc8;}else{_0x13f667=0xce;}_0x181876['status'](_0x13f667);return _0x181876[_0xdd52('0x20')]('Content-Range',_0x4568dc+'-'+_0x4dc017+'/'+_0x2822be)[_0xdd52('0x1c')](_0x12c6da);}return null;};}function patchUpdates(_0x56e1db){return function(_0x30c411){try{jsonpatch[_0xdd52('0x21')](_0x30c411,_0x56e1db,!![]);}catch(_0x5a671a){return BPromise[_0xdd52('0x22')](_0x5a671a);}return _0x30c411['save']();};}function saveUpdates(_0x38c153,_0x59a041){return function(_0x14cd54){if(_0x14cd54){return _0x14cd54[_0xdd52('0x23')](_0x38c153)[_0xdd52('0x24')](function(_0xfd321){return _0xfd321;});}return null;};}function removeEntity(_0x1e8dbb,_0x455e74){return function(_0x3ce226){if(_0x3ce226){return _0x3ce226[_0xdd52('0x25')]()['then'](function(){var _0x1cedeb=_0x3ce226[_0xdd52('0x26')]({'plain':!![]});var _0x592f15=_0xdd52('0x27');return db[_0xdd52('0x28')][_0xdd52('0x25')]({'where':{'type':_0x592f15,'resourceId':_0x1cedeb['id']}})[_0xdd52('0x24')](function(){return _0x3ce226;});})['then'](function(){_0x1e8dbb[_0xdd52('0x1a')](0xcc)[_0xdd52('0x1b')]();});}};}function handleEntityNotFound(_0x70ed7b,_0x54edf6){return function(_0x515e78){if(!_0x515e78){_0x70ed7b[_0xdd52('0x29')](0x194);}return _0x515e78;};}function handleError(_0x4e8290,_0x38b4ae){_0x38b4ae=_0x38b4ae||0x1f4;return function(_0x3f96bd){logger[_0xdd52('0x2a')](_0x3f96bd['stack']);if(_0x3f96bd['name']){delete _0x3f96bd[_0xdd52('0x2b')];}_0x4e8290[_0xdd52('0x1a')](_0x38b4ae)[_0xdd52('0x2c')](_0x3f96bd);};}exports['index']=function(_0x48548d,_0x9b6070){var _0x566658={},_0x29c940={},_0x271353={'count':0x0,'rows':[]};var _0x1e1b3e=_[_0xdd52('0x2d')](db[_0xdd52('0x2e')][_0xdd52('0x2f')],function(_0x219226){return{'name':_0x219226[_0xdd52('0x30')],'type':_0x219226[_0xdd52('0x31')][_0xdd52('0x32')]};});_0x29c940[_0xdd52('0x33')]=_[_0xdd52('0x2d')](_0x1e1b3e,_0xdd52('0x2b'));_0x29c940[_0xdd52('0x34')]=_[_0xdd52('0x35')](_0x48548d[_0xdd52('0x34')]);_0x29c940[_0xdd52('0x36')]=_[_0xdd52('0x37')](_0x29c940[_0xdd52('0x33')],_0x29c940[_0xdd52('0x34')]);_0x566658[_0xdd52('0x38')]=_['intersection'](_0x29c940[_0xdd52('0x33')],qs[_0xdd52('0x39')](_0x48548d['query']['fields']));_0x566658['attributes']=_0x566658[_0xdd52('0x38')][_0xdd52('0x3a')]?_0x566658[_0xdd52('0x38')]:_0x29c940[_0xdd52('0x33')];if(!_0x48548d[_0xdd52('0x34')][_0xdd52('0x3b')](_0xdd52('0x3c'))){_0x566658[_0xdd52('0x1e')]=qs[_0xdd52('0x1e')](_0x48548d[_0xdd52('0x34')]['limit']);_0x566658[_0xdd52('0x1d')]=qs[_0xdd52('0x1d')](_0x48548d[_0xdd52('0x34')][_0xdd52('0x1d')]);}_0x566658[_0xdd52('0x3d')]=qs[_0xdd52('0x3e')](_0x48548d[_0xdd52('0x34')][_0xdd52('0x3e')]);_0x566658[_0xdd52('0x3f')]=qs[_0xdd52('0x36')](_[_0xdd52('0x40')](_0x48548d[_0xdd52('0x34')],_0x29c940[_0xdd52('0x36')]),_0x1e1b3e);if(_0x48548d[_0xdd52('0x34')][_0xdd52('0x41')]){_0x566658[_0xdd52('0x3f')]=_[_0xdd52('0x42')](_0x566658[_0xdd52('0x3f')],{'$or':_[_0xdd52('0x2d')](_0x1e1b3e,function(_0x2c3f3c){if(_0x2c3f3c[_0xdd52('0x31')]!=='VIRTUAL'){var _0x4c2e3b={};_0x4c2e3b[_0x2c3f3c[_0xdd52('0x2b')]]={'$like':'%'+_0x48548d[_0xdd52('0x34')][_0xdd52('0x41')]+'%'};return _0x4c2e3b;}})});}_0x566658=_[_0xdd52('0x42')]({},_0x566658,_0x48548d[_0xdd52('0x43')]);var _0x136b01={'where':_0x566658[_0xdd52('0x3f')]};return db[_0xdd52('0x2e')][_0xdd52('0x1f')](_0x136b01)[_0xdd52('0x24')](function(_0x4efd40){_0x271353[_0xdd52('0x1f')]=_0x4efd40;if(_0x48548d[_0xdd52('0x34')][_0xdd52('0x44')]){_0x566658['include']=[{'all':!![]}];}return db[_0xdd52('0x2e')][_0xdd52('0x45')](_0x566658);})[_0xdd52('0x24')](function(_0x2968b5){_0x271353[_0xdd52('0x46')]=_0x2968b5;return _0x271353;})[_0xdd52('0x24')](respondWithFilteredResult(_0x9b6070,_0x566658))['catch'](handleError(_0x9b6070,null));};exports[_0xdd52('0x47')]=function(_0x3b79cf,_0x1cd269){var _0x4cac5c={'raw':!![],'where':{'id':_0x3b79cf[_0xdd52('0x48')]['id']}},_0x9fd63f={};_0x9fd63f['model']=_[_0xdd52('0x35')](db['Tag'][_0xdd52('0x2f')]);_0x9fd63f['query']=_['keys'](_0x3b79cf['query']);_0x9fd63f[_0xdd52('0x36')]=_[_0xdd52('0x37')](_0x9fd63f[_0xdd52('0x33')],_0x9fd63f[_0xdd52('0x34')]);_0x4cac5c[_0xdd52('0x38')]=_[_0xdd52('0x37')](_0x9fd63f['model'],qs[_0xdd52('0x39')](_0x3b79cf[_0xdd52('0x34')][_0xdd52('0x39')]));_0x4cac5c['attributes']=_0x4cac5c[_0xdd52('0x38')][_0xdd52('0x3a')]?_0x4cac5c[_0xdd52('0x38')]:_0x9fd63f[_0xdd52('0x33')];if(_0x3b79cf['query'][_0xdd52('0x44')]){_0x4cac5c[_0xdd52('0x49')]=[{'all':!![]}];}_0x4cac5c=_['merge']({},_0x4cac5c,_0x3b79cf[_0xdd52('0x43')]);return db[_0xdd52('0x2e')][_0xdd52('0x4a')](_0x4cac5c)['then'](handleEntityNotFound(_0x1cd269,null))['then'](respondWithResult(_0x1cd269,null))[_0xdd52('0x4b')](handleError(_0x1cd269,null));};exports[_0xdd52('0x4c')]=function(_0x1017d6,_0x5adb59){return db[_0xdd52('0x2e')]['create'](_0x1017d6[_0xdd52('0x4d')],{})[_0xdd52('0x24')](function(_0x29e730){var _0x4d0f37=_0x1017d6['user'][_0xdd52('0x26')]({'plain':!![]});if(!_0x4d0f37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d0f37[_0xdd52('0x4e')]===_0xdd52('0x4f')){var _0x1ff2c3=_0x29e730[_0xdd52('0x26')]({'plain':!![]});var _0x2387ed=_0xdd52('0x27');return db['UserProfileSection'][_0xdd52('0x4a')]({'where':{'name':_0x2387ed,'userProfileId':_0x4d0f37[_0xdd52('0x50')]},'raw':!![]})[_0xdd52('0x24')](function(_0x411a69){if(_0x411a69&&_0x411a69['autoAssociation']===0x0){return db[_0xdd52('0x28')][_0xdd52('0x4c')]({'name':_0x1ff2c3[_0xdd52('0x2b')],'resourceId':_0x1ff2c3['id'],'type':_0x411a69['name'],'sectionId':_0x411a69['id']},{})[_0xdd52('0x24')](function(){return _0x29e730;});}else{return _0x29e730;}})[_0xdd52('0x4b')](function(_0x19bc88){logger[_0xdd52('0x2a')](_0xdd52('0x51'),_0x19bc88);throw _0x19bc88;});}return _0x29e730;})['then'](respondWithResult(_0x5adb59,0xc9))[_0xdd52('0x4b')](handleError(_0x5adb59,null));};exports[_0xdd52('0x23')]=function(_0x26133c,_0x41fcb6){if(_0x26133c[_0xdd52('0x4d')]['id']){delete _0x26133c['body']['id'];}return db[_0xdd52('0x2e')][_0xdd52('0x4a')]({'where':{'id':_0x26133c['params']['id']}})['then'](handleEntityNotFound(_0x41fcb6,null))[_0xdd52('0x24')](saveUpdates(_0x26133c['body'],null))[_0xdd52('0x24')](respondWithResult(_0x41fcb6,null))[_0xdd52('0x4b')](handleError(_0x41fcb6,null));};exports['destroy']=function(_0x1e6f5a,_0x5365ff){return db['Tag']['find']({'where':{'id':_0x1e6f5a[_0xdd52('0x48')]['id']}})[_0xdd52('0x24')](handleEntityNotFound(_0x5365ff,null))[_0xdd52('0x24')](removeEntity(_0x5365ff,null))[_0xdd52('0x4b')](handleError(_0x5365ff,null));}; \ No newline at end of file +var _0x0f9f=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','map','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','Tag','include','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','update','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x30c7d5,_0x3ed9ae){var _0x1b68da=function(_0x43af09){while(--_0x43af09){_0x30c7d5['push'](_0x30c7d5['shift']());}};_0x1b68da(++_0x3ed9ae);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x4979ad,_0x36df48){_0x4979ad=_0x4979ad-0x0;var _0x3e8c8e=_0x0f9f[_0x4979ad];return _0x3e8c8e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf0f9('0x0'));var zipdir=require(_0xf0f9('0x1'));var jsonpatch=require(_0xf0f9('0x2'));var rp=require('request-promise');var moment=require(_0xf0f9('0x3'));var BPromise=require(_0xf0f9('0x4'));var Mustache=require(_0xf0f9('0x5'));var util=require(_0xf0f9('0x6'));var path=require(_0xf0f9('0x7'));var sox=require(_0xf0f9('0x8'));var csv=require(_0xf0f9('0x9'));var ejs=require(_0xf0f9('0xa'));var fs=require('fs');var fs_extra=require(_0xf0f9('0xb'));var _=require(_0xf0f9('0xc'));var squel=require('squel');var crypto=require(_0xf0f9('0xd'));var jsforce=require(_0xf0f9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf0f9('0x9'));var querystring=require(_0xf0f9('0xf'));var Papa=require(_0xf0f9('0x10'));var Redis=require('ioredis');var authService=require(_0xf0f9('0x11'));var qs=require(_0xf0f9('0x12'));var as=require(_0xf0f9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf0f9('0x14'));var utils=require(_0xf0f9('0x15'));var config=require(_0xf0f9('0x16'));var licenseUtil=require(_0xf0f9('0x17'));var db=require(_0xf0f9('0x18'))['db'];function respondWithStatusCode(_0x32d17f,_0x2360eb){_0x2360eb=_0x2360eb||0xcc;return function(_0x4f27c2){if(_0x4f27c2){return _0x32d17f[_0xf0f9('0x19')](_0x2360eb);}return _0x32d17f[_0xf0f9('0x1a')](_0x2360eb)[_0xf0f9('0x1b')]();};}function respondWithResult(_0x200514,_0x524169){_0x524169=_0x524169||0xc8;return function(_0x51d78a){if(_0x51d78a){return _0x200514[_0xf0f9('0x1a')](_0x524169)[_0xf0f9('0x1c')](_0x51d78a);}};}function respondWithFilteredResult(_0xa7d48c,_0x2e2955){return function(_0x2b05e3){if(_0x2b05e3){var _0x2f5bec=typeof _0x2e2955[_0xf0f9('0x1d')]===_0xf0f9('0x1e')&&typeof _0x2e2955[_0xf0f9('0x1f')]===_0xf0f9('0x1e');var _0x4d3534=_0x2b05e3['count'];var _0x350a48=_0x2f5bec?0x0:_0x2e2955[_0xf0f9('0x1d')];var _0x4c4e17=_0x2f5bec?_0x2b05e3[_0xf0f9('0x20')]:_0x2e2955['offset']+_0x2e2955['limit'];var _0x42c157;if(_0x4c4e17>=_0x4d3534){_0x4c4e17=_0x4d3534;_0x42c157=0xc8;}else{_0x42c157=0xce;}_0xa7d48c[_0xf0f9('0x1a')](_0x42c157);return _0xa7d48c[_0xf0f9('0x21')](_0xf0f9('0x22'),_0x350a48+'-'+_0x4c4e17+'/'+_0x4d3534)[_0xf0f9('0x1c')](_0x2b05e3);}return null;};}function patchUpdates(_0x4ed9ff){return function(_0x5ccbc9){try{jsonpatch['apply'](_0x5ccbc9,_0x4ed9ff,!![]);}catch(_0x102336){return BPromise[_0xf0f9('0x23')](_0x102336);}return _0x5ccbc9[_0xf0f9('0x24')]();};}function saveUpdates(_0x5d87a9,_0x4a8726){return function(_0x209cd4){if(_0x209cd4){return _0x209cd4['update'](_0x5d87a9)[_0xf0f9('0x25')](function(_0x414f87){return _0x414f87;});}return null;};}function removeEntity(_0x173c79,_0x570c68){return function(_0x33dfca){if(_0x33dfca){return _0x33dfca[_0xf0f9('0x26')]()[_0xf0f9('0x25')](function(){var _0x49a2dd=_0x33dfca[_0xf0f9('0x27')]({'plain':!![]});var _0x33f070=_0xf0f9('0x28');return db[_0xf0f9('0x29')][_0xf0f9('0x26')]({'where':{'type':_0x33f070,'resourceId':_0x49a2dd['id']}})[_0xf0f9('0x25')](function(){return _0x33dfca;});})['then'](function(){_0x173c79[_0xf0f9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1288e0,_0x30e85c){return function(_0x519a46){if(!_0x519a46){_0x1288e0['sendStatus'](0x194);}return _0x519a46;};}function handleError(_0x119793,_0x50e7f6){_0x50e7f6=_0x50e7f6||0x1f4;return function(_0x2121b8){logger[_0xf0f9('0x2a')](_0x2121b8[_0xf0f9('0x2b')]);if(_0x2121b8[_0xf0f9('0x2c')]){delete _0x2121b8[_0xf0f9('0x2c')];}_0x119793[_0xf0f9('0x1a')](_0x50e7f6)[_0xf0f9('0x2d')](_0x2121b8);};}exports[_0xf0f9('0x2e')]=function(_0x37c093,_0x4e4e08){var _0x2e79f9={},_0x28da31={},_0x534083={'count':0x0,'rows':[]};var _0x48ef2a=_[_0xf0f9('0x2f')](db['Tag']['rawAttributes'],function(_0x14f3cb){return{'name':_0x14f3cb['fieldName'],'type':_0x14f3cb[_0xf0f9('0x30')][_0xf0f9('0x31')]};});_0x28da31['model']=_['map'](_0x48ef2a,_0xf0f9('0x2c'));_0x28da31[_0xf0f9('0x32')]=_[_0xf0f9('0x33')](_0x37c093[_0xf0f9('0x32')]);_0x28da31[_0xf0f9('0x34')]=_[_0xf0f9('0x35')](_0x28da31[_0xf0f9('0x36')],_0x28da31[_0xf0f9('0x32')]);_0x2e79f9[_0xf0f9('0x37')]=_[_0xf0f9('0x35')](_0x28da31[_0xf0f9('0x36')],qs[_0xf0f9('0x38')](_0x37c093[_0xf0f9('0x32')]['fields']));_0x2e79f9[_0xf0f9('0x37')]=_0x2e79f9['attributes'][_0xf0f9('0x39')]?_0x2e79f9[_0xf0f9('0x37')]:_0x28da31[_0xf0f9('0x36')];if(!_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x3a')](_0xf0f9('0x3b'))){_0x2e79f9[_0xf0f9('0x1f')]=qs['limit'](_0x37c093['query'][_0xf0f9('0x1f')]);_0x2e79f9[_0xf0f9('0x1d')]=qs[_0xf0f9('0x1d')](_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x1d')]);}_0x2e79f9['order']=qs[_0xf0f9('0x3c')](_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x3c')]);_0x2e79f9[_0xf0f9('0x3d')]=qs[_0xf0f9('0x34')](_['pick'](_0x37c093[_0xf0f9('0x32')],_0x28da31[_0xf0f9('0x34')]),_0x48ef2a);if(_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x3e')]){_0x2e79f9[_0xf0f9('0x3d')]=_[_0xf0f9('0x3f')](_0x2e79f9['where'],{'$or':_[_0xf0f9('0x2f')](_0x48ef2a,function(_0x1b84ef){if(_0x1b84ef[_0xf0f9('0x30')]!=='VIRTUAL'){var _0x3b52e3={};_0x3b52e3[_0x1b84ef[_0xf0f9('0x2c')]]={'$like':'%'+_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x3e')]+'%'};return _0x3b52e3;}})});}_0x2e79f9=_[_0xf0f9('0x3f')]({},_0x2e79f9,_0x37c093[_0xf0f9('0x40')]);var _0x1e1805={'where':_0x2e79f9[_0xf0f9('0x3d')]};return db[_0xf0f9('0x41')][_0xf0f9('0x20')](_0x1e1805)[_0xf0f9('0x25')](function(_0x149870){_0x534083[_0xf0f9('0x20')]=_0x149870;if(_0x37c093['query']['includeAll']){_0x2e79f9[_0xf0f9('0x42')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x2e79f9);})['then'](function(_0x2cb95d){_0x534083[_0xf0f9('0x43')]=_0x2cb95d;return _0x534083;})[_0xf0f9('0x25')](respondWithFilteredResult(_0x4e4e08,_0x2e79f9))[_0xf0f9('0x44')](handleError(_0x4e4e08,null));};exports[_0xf0f9('0x45')]=function(_0xfef8ad,_0xc0c34c){var _0x2e1556={'raw':!![],'where':{'id':_0xfef8ad['params']['id']}},_0x1a3a6b={};_0x1a3a6b[_0xf0f9('0x36')]=_[_0xf0f9('0x33')](db[_0xf0f9('0x41')]['rawAttributes']);_0x1a3a6b[_0xf0f9('0x32')]=_[_0xf0f9('0x33')](_0xfef8ad[_0xf0f9('0x32')]);_0x1a3a6b['filters']=_[_0xf0f9('0x35')](_0x1a3a6b[_0xf0f9('0x36')],_0x1a3a6b['query']);_0x2e1556[_0xf0f9('0x37')]=_[_0xf0f9('0x35')](_0x1a3a6b[_0xf0f9('0x36')],qs[_0xf0f9('0x38')](_0xfef8ad['query'][_0xf0f9('0x38')]));_0x2e1556[_0xf0f9('0x37')]=_0x2e1556[_0xf0f9('0x37')][_0xf0f9('0x39')]?_0x2e1556[_0xf0f9('0x37')]:_0x1a3a6b[_0xf0f9('0x36')];if(_0xfef8ad['query'][_0xf0f9('0x46')]){_0x2e1556['include']=[{'all':!![]}];}_0x2e1556=_[_0xf0f9('0x3f')]({},_0x2e1556,_0xfef8ad[_0xf0f9('0x40')]);return db[_0xf0f9('0x41')][_0xf0f9('0x47')](_0x2e1556)[_0xf0f9('0x25')](handleEntityNotFound(_0xc0c34c,null))[_0xf0f9('0x25')](respondWithResult(_0xc0c34c,null))[_0xf0f9('0x44')](handleError(_0xc0c34c,null));};exports[_0xf0f9('0x48')]=function(_0x1f47fa,_0x13bb13){return db[_0xf0f9('0x41')][_0xf0f9('0x48')](_0x1f47fa[_0xf0f9('0x49')],{})[_0xf0f9('0x25')](function(_0x45a165){var _0x3cb91a=_0x1f47fa[_0xf0f9('0x4a')][_0xf0f9('0x27')]({'plain':!![]});if(!_0x3cb91a)throw new Error(_0xf0f9('0x4b'));if(_0x3cb91a[_0xf0f9('0x4c')]===_0xf0f9('0x4a')){var _0x40711c=_0x45a165[_0xf0f9('0x27')]({'plain':!![]});var _0x37a928='Tags';return db['UserProfileSection'][_0xf0f9('0x47')]({'where':{'name':_0x37a928,'userProfileId':_0x3cb91a['userProfileId']},'raw':!![]})[_0xf0f9('0x25')](function(_0x2c364c){if(_0x2c364c&&_0x2c364c[_0xf0f9('0x4d')]===0x0){return db['UserProfileResource'][_0xf0f9('0x48')]({'name':_0x40711c['name'],'resourceId':_0x40711c['id'],'type':_0x2c364c[_0xf0f9('0x2c')],'sectionId':_0x2c364c['id']},{})[_0xf0f9('0x25')](function(){return _0x45a165;});}else{return _0x45a165;}})[_0xf0f9('0x44')](function(_0xfe9072){logger[_0xf0f9('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfe9072);throw _0xfe9072;});}return _0x45a165;})[_0xf0f9('0x25')](respondWithResult(_0x13bb13,0xc9))['catch'](handleError(_0x13bb13,null));};exports[_0xf0f9('0x4e')]=function(_0x1b0186,_0xb3467e){if(_0x1b0186[_0xf0f9('0x49')]['id']){delete _0x1b0186[_0xf0f9('0x49')]['id'];}return db['Tag'][_0xf0f9('0x47')]({'where':{'id':_0x1b0186[_0xf0f9('0x4f')]['id']}})[_0xf0f9('0x25')](handleEntityNotFound(_0xb3467e,null))[_0xf0f9('0x25')](saveUpdates(_0x1b0186[_0xf0f9('0x49')],null))[_0xf0f9('0x25')](respondWithResult(_0xb3467e,null))[_0xf0f9('0x44')](handleError(_0xb3467e,null));};exports[_0xf0f9('0x26')]=function(_0x15f3b3,_0x406b45){return db[_0xf0f9('0x41')][_0xf0f9('0x47')]({'where':{'id':_0x15f3b3[_0xf0f9('0x4f')]['id']}})[_0xf0f9('0x25')](handleEntityNotFound(_0x406b45,null))['then'](removeEntity(_0x406b45,null))[_0xf0f9('0x44')](handleError(_0x406b45,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index b20a156..f65d11b 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 _0x0dca=['Tag','api','moment','bluebird','request-promise','rimraf','./tag.attributes','exports','define'];(function(_0x3dde60,_0x3f4f2f){var _0x316913=function(_0x19a671){while(--_0x19a671){_0x3dde60['push'](_0x3dde60['shift']());}};_0x316913(++_0x3f4f2f);}(_0x0dca,0x18d));var _0xa0dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0dca[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa0dc('0x0'));var moment=require(_0xa0dc('0x1'));var BPromise=require(_0xa0dc('0x2'));var rp=require(_0xa0dc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa0dc('0x4'));var config=require('../../config/environment');var attributes=require(_0xa0dc('0x5'));module[_0xa0dc('0x6')]=function(_0x1d9140,_0x53a478){return _0x1d9140[_0xa0dc('0x7')](_0xa0dc('0x8'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb016=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define','tools_tags','lodash','util'];(function(_0x19001d,_0x2be211){var _0x55ea26=function(_0x2e151b){while(--_0x2e151b){_0x19001d['push'](_0x19001d['shift']());}};_0x55ea26(++_0x2be211);}(_0xb016,0x129));var _0x6b01=function(_0x10328e,_0xab5b4e){_0x10328e=_0x10328e-0x0;var _0x5aa2e3=_0xb016[_0x10328e];return _0x5aa2e3;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var logger=require(_0x6b01('0x2'))(_0x6b01('0x3'));var moment=require(_0x6b01('0x4'));var BPromise=require(_0x6b01('0x5'));var rp=require(_0x6b01('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b01('0x7'));var config=require(_0x6b01('0x8'));var attributes=require(_0x6b01('0x9'));module[_0x6b01('0xa')]=function(_0x7bc7b1,_0xe5c773){return _0x7bc7b1[_0x6b01('0xb')]('Tag',attributes,{'tableName':_0x6b01('0xc'),'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 5d95628..05fbe71 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 _0xc818=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x263204,_0x19286b){var _0xed3987=function(_0x282bf1){while(--_0x282bf1){_0x263204['push'](_0x263204['shift']());}};_0xed3987(++_0x19286b);}(_0xc818,0x1e3));var _0x8c81=function(_0x27ec84,_0x5c44b9){_0x27ec84=_0x27ec84-0x0;var _0x3cea02=_0xc818[_0x27ec84];return _0x3cea02;};'use strict';var _=require(_0x8c81('0x0'));var util=require(_0x8c81('0x1'));var moment=require(_0x8c81('0x2'));var BPromise=require(_0x8c81('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c81('0x4'));var db=require(_0x8c81('0x5'))['db'];var utils=require(_0x8c81('0x6'));var logger=require(_0x8c81('0x7'))(_0x8c81('0x8'));var config=require(_0x8c81('0x9'));var jayson=require(_0x8c81('0xa'));var client=jayson['client'][_0x8c81('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d663e,_0x32cf31,_0x43d142){return new BPromise(function(_0x501240,_0x1173cf){return client[_0x8c81('0xc')](_0x3d663e,_0x43d142)[_0x8c81('0xd')](function(_0x15ebff){logger[_0x8c81('0xe')](_0x8c81('0xf'),_0x32cf31,_0x8c81('0x10'));logger['debug'](_0x8c81('0x11'),_0x32cf31,_0x8c81('0x10'),JSON[_0x8c81('0x12')](_0x15ebff));if(_0x15ebff[_0x8c81('0x13')]){if(_0x15ebff['error'][_0x8c81('0x14')]===0x1f4){logger[_0x8c81('0x13')](_0x8c81('0xf'),_0x32cf31,_0x15ebff[_0x8c81('0x13')][_0x8c81('0x15')]);return _0x1173cf(_0x15ebff[_0x8c81('0x13')][_0x8c81('0x15')]);}logger[_0x8c81('0x13')](_0x8c81('0xf'),_0x32cf31,_0x15ebff['error']['message']);return _0x501240(_0x15ebff[_0x8c81('0x13')][_0x8c81('0x15')]);}else{logger[_0x8c81('0xe')](_0x8c81('0xf'),_0x32cf31,_0x8c81('0x10'));_0x501240(_0x15ebff[_0x8c81('0x16')]['message']);}})[_0x8c81('0x17')](function(_0x29ccb0){logger[_0x8c81('0x13')](_0x8c81('0xf'),_0x32cf31,_0x29ccb0);_0x1173cf(_0x29ccb0);});});} \ No newline at end of file +var _0xf0ba=['rpc','jayson/promise','then','info','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf0ba[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaf0b('0x0'));var util=require(_0xaf0b('0x1'));var moment=require(_0xaf0b('0x2'));var BPromise=require(_0xaf0b('0x3'));var rs=require(_0xaf0b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf0b('0x5'))['db'];var utils=require(_0xaf0b('0x6'));var logger=require('../../config/logger')(_0xaf0b('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf0b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53b32d,_0x1d260e,_0x17b6d5){return new BPromise(function(_0x3439d5,_0xd67a9){return client['request'](_0x53b32d,_0x17b6d5)[_0xaf0b('0x9')](function(_0x4242b1){logger[_0xaf0b('0xa')]('Tag,\x20%s,\x20%s',_0x1d260e,_0xaf0b('0xb'));logger['debug'](_0xaf0b('0xc'),_0x1d260e,_0xaf0b('0xb'),JSON[_0xaf0b('0xd')](_0x4242b1));if(_0x4242b1['error']){if(_0x4242b1[_0xaf0b('0xe')][_0xaf0b('0xf')]===0x1f4){logger[_0xaf0b('0xe')](_0xaf0b('0x10'),_0x1d260e,_0x4242b1[_0xaf0b('0xe')][_0xaf0b('0x11')]);return _0xd67a9(_0x4242b1['error'][_0xaf0b('0x11')]);}logger[_0xaf0b('0xe')](_0xaf0b('0x10'),_0x1d260e,_0x4242b1[_0xaf0b('0xe')]['message']);return _0x3439d5(_0x4242b1[_0xaf0b('0xe')][_0xaf0b('0x11')]);}else{logger[_0xaf0b('0xa')](_0xaf0b('0x10'),_0x1d260e,_0xaf0b('0xb'));_0x3439d5(_0x4242b1[_0xaf0b('0x12')][_0xaf0b('0x11')]);}})[_0xaf0b('0x13')](function(_0x4885da){logger[_0xaf0b('0xe')]('Tag,\x20%s,\x20%s',_0x1d260e,_0x4885da);_0xd67a9(_0x4885da);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 2296547..8ca5ff4 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 055f5fe..32754fe 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 _0x757a=['exports','STRING'];(function(_0x3d3bf0,_0x4a7191){var _0x3132c4=function(_0x1b73b7){while(--_0x1b73b7){_0x3d3bf0['push'](_0x3d3bf0['shift']());}};_0x3132c4(++_0x4a7191);}(_0x757a,0xde));var _0xa757=function(_0x466fa2,_0x1c7c3b){_0x466fa2=_0x466fa2-0x0;var _0x173992=_0x757a[_0x466fa2];return _0x173992;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xe706,0xa3));var _0x6e70=function(_0x16fa02,_0x3eaff5){_0x16fa02=_0x16fa02-0x0;var _0x58fa70=_0xe706[_0x16fa02];return _0x58fa70;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 8b9e3c5..c97c2e5 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 _0x5b6e=['fields','length','nolimit','order','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getQueues','findOne','channel','isValidChannel','Sequelize','capitalize','toLowerCase','Queue','filters','sort','Queues','addQueues','ValidationError','Unknown\x20channel','add','removeQueues','remove','addAgents','Voice','Mail','Sms','Whatsapp','sequelize','transaction','through','QueueId','penalty','User','findOrCreate','emit','Queue:save','ids','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','removeAgents','Fax','Openchannel','parse','getAgents','hasOwnProperty','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','update','then','destroy','get','Teams','UserProfileResource','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection'];(function(_0xf61c79,_0x43c6fa){var _0x127d26=function(_0x598bf6){while(--_0x598bf6){_0xf61c79['push'](_0xf61c79['shift']());}};_0x127d26(++_0x43c6fa);}(_0x5b6e,0x14c));var _0xe5b6=function(_0x25cfee,_0x26d9d1){_0x25cfee=_0x25cfee-0x0;var _0x181d92=_0x5b6e[_0x25cfee];return _0x181d92;};'use strict';var emlformat=require(_0xe5b6('0x0'));var rimraf=require(_0xe5b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe5b6('0x2'));var rp=require('request-promise');var moment=require(_0xe5b6('0x3'));var BPromise=require(_0xe5b6('0x4'));var Mustache=require(_0xe5b6('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe5b6('0x6'));var csv=require(_0xe5b6('0x7'));var ejs=require(_0xe5b6('0x8'));var fs=require('fs');var fs_extra=require(_0xe5b6('0x9'));var _=require('lodash');var squel=require(_0xe5b6('0xa'));var crypto=require(_0xe5b6('0xb'));var jsforce=require(_0xe5b6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe5b6('0x7'));var querystring=require('querystring');var Papa=require(_0xe5b6('0xd'));var Redis=require(_0xe5b6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe5b6('0xf'));var as=require(_0xe5b6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe5b6('0x11'))(_0xe5b6('0x12'));var utils=require('../../config/utils');var config=require(_0xe5b6('0x13'));var licenseUtil=require(_0xe5b6('0x14'));var db=require('../../mysqldb')['db'];config[_0xe5b6('0x15')]=_[_0xe5b6('0x16')](config[_0xe5b6('0x15')],{'host':_0xe5b6('0x17'),'port':0x18eb});var socket=require(_0xe5b6('0x18'))(new Redis(config['redis']));require(_0xe5b6('0x19'))[_0xe5b6('0x1a')](socket);function respondWithStatusCode(_0x172ea1,_0x444b97){_0x444b97=_0x444b97||0xcc;return function(_0x533025){if(_0x533025){return _0x172ea1[_0xe5b6('0x1b')](_0x444b97);}return _0x172ea1[_0xe5b6('0x1c')](_0x444b97)[_0xe5b6('0x1d')]();};}function respondWithResult(_0x117ccd,_0x1d3bd8){_0x1d3bd8=_0x1d3bd8||0xc8;return function(_0x2c9aec){if(_0x2c9aec){return _0x117ccd['status'](_0x1d3bd8)[_0xe5b6('0x1e')](_0x2c9aec);}};}function respondWithFilteredResult(_0x482a71,_0x532395){return function(_0x5b50b1){if(_0x5b50b1){var _0x1915c5=typeof _0x532395['offset']===_0xe5b6('0x1f')&&typeof _0x532395[_0xe5b6('0x20')]===_0xe5b6('0x1f');var _0x383f19=_0x5b50b1[_0xe5b6('0x21')];var _0x195160=_0x1915c5?0x0:_0x532395[_0xe5b6('0x22')];var _0x33d7d3=_0x1915c5?_0x5b50b1['count']:_0x532395[_0xe5b6('0x22')]+_0x532395[_0xe5b6('0x20')];var _0xc895ff;if(_0x33d7d3>=_0x383f19){_0x33d7d3=_0x383f19;_0xc895ff=0xc8;}else{_0xc895ff=0xce;}_0x482a71[_0xe5b6('0x1c')](_0xc895ff);return _0x482a71[_0xe5b6('0x23')]('Content-Range',_0x195160+'-'+_0x33d7d3+'/'+_0x383f19)[_0xe5b6('0x1e')](_0x5b50b1);}return null;};}function patchUpdates(_0x531e67){return function(_0x14aa89){try{jsonpatch['apply'](_0x14aa89,_0x531e67,!![]);}catch(_0x4a5fff){return BPromise['reject'](_0x4a5fff);}return _0x14aa89['save']();};}function saveUpdates(_0x2f0c1f,_0x449527){return function(_0x5bb96b){if(_0x5bb96b){return _0x5bb96b[_0xe5b6('0x24')](_0x2f0c1f)[_0xe5b6('0x25')](function(_0x24b85f){return _0x24b85f;});}return null;};}function removeEntity(_0x4c754b,_0x2f2561){return function(_0x5c778d){if(_0x5c778d){return _0x5c778d[_0xe5b6('0x26')]()[_0xe5b6('0x25')](function(){var _0x3b3914=_0x5c778d[_0xe5b6('0x27')]({'plain':!![]});var _0x1532f7=_0xe5b6('0x28');return db[_0xe5b6('0x29')][_0xe5b6('0x26')]({'where':{'type':_0x1532f7,'resourceId':_0x3b3914['id']}})[_0xe5b6('0x25')](function(){return _0x5c778d;});})[_0xe5b6('0x25')](function(){_0x4c754b[_0xe5b6('0x1c')](0xcc)[_0xe5b6('0x1d')]();});}};}function handleEntityNotFound(_0x2c53e2,_0x1ee399){return function(_0x28833c){if(!_0x28833c){_0x2c53e2['sendStatus'](0x194);}return _0x28833c;};}function handleError(_0x1aa008,_0x38a490){_0x38a490=_0x38a490||0x1f4;return function(_0x2dc870){logger[_0xe5b6('0x2a')](_0x2dc870[_0xe5b6('0x2b')]);if(_0x2dc870[_0xe5b6('0x2c')]){delete _0x2dc870[_0xe5b6('0x2c')];}_0x1aa008[_0xe5b6('0x1c')](_0x38a490)[_0xe5b6('0x2d')](_0x2dc870);};}exports[_0xe5b6('0x2e')]=function(_0x1b477e,_0x570893){var _0x2d04ad={},_0xbdc580={},_0x3d8ed4={'count':0x0,'rows':[]};var _0x463c12=_[_0xe5b6('0x2f')](db[_0xe5b6('0x30')][_0xe5b6('0x31')],function(_0x561c80){return{'name':_0x561c80[_0xe5b6('0x32')],'type':_0x561c80[_0xe5b6('0x33')][_0xe5b6('0x34')]};});_0xbdc580[_0xe5b6('0x35')]=_[_0xe5b6('0x2f')](_0x463c12,_0xe5b6('0x2c'));_0xbdc580['query']=_[_0xe5b6('0x36')](_0x1b477e[_0xe5b6('0x37')]);_0xbdc580['filters']=_['intersection'](_0xbdc580[_0xe5b6('0x35')],_0xbdc580['query']);_0x2d04ad[_0xe5b6('0x38')]=_[_0xe5b6('0x39')](_0xbdc580[_0xe5b6('0x35')],qs[_0xe5b6('0x3a')](_0x1b477e[_0xe5b6('0x37')][_0xe5b6('0x3a')]));_0x2d04ad[_0xe5b6('0x38')]=_0x2d04ad[_0xe5b6('0x38')][_0xe5b6('0x3b')]?_0x2d04ad[_0xe5b6('0x38')]:_0xbdc580['model'];if(!_0x1b477e[_0xe5b6('0x37')]['hasOwnProperty'](_0xe5b6('0x3c'))){_0x2d04ad['limit']=qs['limit'](_0x1b477e[_0xe5b6('0x37')][_0xe5b6('0x20')]);_0x2d04ad[_0xe5b6('0x22')]=qs[_0xe5b6('0x22')](_0x1b477e[_0xe5b6('0x37')][_0xe5b6('0x22')]);}_0x2d04ad[_0xe5b6('0x3d')]=qs['sort'](_0x1b477e[_0xe5b6('0x37')]['sort']);_0x2d04ad['where']=qs['filters'](_[_0xe5b6('0x3e')](_0x1b477e[_0xe5b6('0x37')],_0xbdc580['filters']),_0x463c12);if(_0x1b477e['query']['filter']){_0x2d04ad[_0xe5b6('0x3f')]=_[_0xe5b6('0x40')](_0x2d04ad[_0xe5b6('0x3f')],{'$or':_[_0xe5b6('0x2f')](_0x463c12,function(_0xc0fa71){if(_0xc0fa71[_0xe5b6('0x33')]!==_0xe5b6('0x41')){var _0xf5a773={};_0xf5a773[_0xc0fa71[_0xe5b6('0x2c')]]={'$like':'%'+_0x1b477e[_0xe5b6('0x37')]['filter']+'%'};return _0xf5a773;}})});}_0x2d04ad=_[_0xe5b6('0x40')]({},_0x2d04ad,_0x1b477e[_0xe5b6('0x42')]);var _0x1a69ce={'where':_0x2d04ad[_0xe5b6('0x3f')]};return db[_0xe5b6('0x30')][_0xe5b6('0x21')](_0x1a69ce)[_0xe5b6('0x25')](function(_0x4c509a){_0x3d8ed4[_0xe5b6('0x21')]=_0x4c509a;if(_0x1b477e[_0xe5b6('0x37')][_0xe5b6('0x43')]){_0x2d04ad[_0xe5b6('0x44')]=[{'all':!![]}];}return db[_0xe5b6('0x30')][_0xe5b6('0x45')](_0x2d04ad);})['then'](function(_0x2d9488){_0x3d8ed4[_0xe5b6('0x46')]=_0x2d9488;return _0x3d8ed4;})[_0xe5b6('0x25')](respondWithFilteredResult(_0x570893,_0x2d04ad))['catch'](handleError(_0x570893,null));};exports[_0xe5b6('0x47')]=function(_0x8a41,_0x21e657){var _0x77dceb={'raw':![],'where':{'id':_0x8a41['params']['id']}},_0x4b66a6={};_0x4b66a6[_0xe5b6('0x35')]=_[_0xe5b6('0x36')](db[_0xe5b6('0x30')]['rawAttributes']);_0x4b66a6[_0xe5b6('0x37')]=_[_0xe5b6('0x36')](_0x8a41[_0xe5b6('0x37')]);_0x4b66a6['filters']=_[_0xe5b6('0x39')](_0x4b66a6[_0xe5b6('0x35')],_0x4b66a6['query']);_0x77dceb[_0xe5b6('0x38')]=_['intersection'](_0x4b66a6[_0xe5b6('0x35')],qs[_0xe5b6('0x3a')](_0x8a41[_0xe5b6('0x37')][_0xe5b6('0x3a')]));_0x77dceb[_0xe5b6('0x38')]=_0x77dceb[_0xe5b6('0x38')][_0xe5b6('0x3b')]?_0x77dceb[_0xe5b6('0x38')]:_0x4b66a6[_0xe5b6('0x35')];if(_0x8a41['query']['includeAll']){_0x77dceb['include']=[{'all':!![]}];}_0x77dceb=_['merge']({},_0x77dceb,_0x8a41[_0xe5b6('0x42')]);return db[_0xe5b6('0x30')]['find'](_0x77dceb)['then'](handleEntityNotFound(_0x21e657,null))[_0xe5b6('0x25')](respondWithResult(_0x21e657,null))[_0xe5b6('0x48')](handleError(_0x21e657,null));};exports[_0xe5b6('0x49')]=function(_0x3bfb39,_0xa912d5){return db[_0xe5b6('0x30')][_0xe5b6('0x49')](_0x3bfb39[_0xe5b6('0x4a')],{})[_0xe5b6('0x25')](function(_0x76d669){var _0x4e91f8=_0x3bfb39[_0xe5b6('0x4b')][_0xe5b6('0x27')]({'plain':!![]});if(!_0x4e91f8)throw new Error(_0xe5b6('0x4c'));if(_0x4e91f8[_0xe5b6('0x4d')]===_0xe5b6('0x4b')){var _0x2499dd=_0x76d669[_0xe5b6('0x27')]({'plain':!![]});var _0x5da51e=_0xe5b6('0x28');return db['UserProfileSection'][_0xe5b6('0x4e')]({'where':{'name':_0x5da51e,'userProfileId':_0x4e91f8[_0xe5b6('0x4f')]},'raw':!![]})['then'](function(_0x280098){if(_0x280098&&_0x280098[_0xe5b6('0x50')]===0x0){return db['UserProfileResource'][_0xe5b6('0x49')]({'name':_0x2499dd['name'],'resourceId':_0x2499dd['id'],'type':_0x280098[_0xe5b6('0x2c')],'sectionId':_0x280098['id']},{})[_0xe5b6('0x25')](function(){return _0x76d669;});}else{return _0x76d669;}})['catch'](function(_0x4cfccc){logger[_0xe5b6('0x2a')](_0xe5b6('0x51'),_0x4cfccc);throw _0x4cfccc;});}return _0x76d669;})[_0xe5b6('0x25')](respondWithResult(_0xa912d5,0xc9))[_0xe5b6('0x48')](handleError(_0xa912d5,null));};exports[_0xe5b6('0x24')]=function(_0xb649f6,_0x9646a2){if(_0xb649f6[_0xe5b6('0x4a')]['id']){delete _0xb649f6[_0xe5b6('0x4a')]['id'];}return db[_0xe5b6('0x30')][_0xe5b6('0x4e')]({'where':{'id':_0xb649f6[_0xe5b6('0x52')]['id']}})[_0xe5b6('0x25')](handleEntityNotFound(_0x9646a2,null))[_0xe5b6('0x25')](saveUpdates(_0xb649f6[_0xe5b6('0x4a')],null))[_0xe5b6('0x25')](respondWithResult(_0x9646a2,null))[_0xe5b6('0x48')](handleError(_0x9646a2,null));};exports[_0xe5b6('0x26')]=function(_0x1ed396,_0x4a4dc5){return db[_0xe5b6('0x30')][_0xe5b6('0x4e')]({'where':{'id':_0x1ed396['params']['id']}})[_0xe5b6('0x25')](handleEntityNotFound(_0x4a4dc5,null))[_0xe5b6('0x25')](removeEntity(_0x4a4dc5,null))[_0xe5b6('0x48')](handleError(_0x4a4dc5,null));};exports[_0xe5b6('0x53')]=function(_0x3d2a32,_0x4ed818,_0x424d63){return db['Team'][_0xe5b6('0x54')]({'where':{'id':_0x3d2a32['params']['id']}})[_0xe5b6('0x25')](handleEntityNotFound(_0x4ed818,null))[_0xe5b6('0x25')](function(_0x50603a){if(!_0x3d2a32['query'][_0xe5b6('0x55')]||!utils[_0xe5b6('0x56')](_0x3d2a32[_0xe5b6('0x37')]['channel'])){throw new db[(_0xe5b6('0x57'))]['ValidationError']('Unknown\x20channel');}var _0x145547={};var _0x34562a={};_0x34562a[_0xe5b6('0x35')]=_[_0xe5b6('0x36')](db[_[_0xe5b6('0x58')](_0x3d2a32[_0xe5b6('0x37')][_0xe5b6('0x55')][_0xe5b6('0x59')]())+_0xe5b6('0x5a')][_0xe5b6('0x31')]);_0x34562a[_0xe5b6('0x37')]=_[_0xe5b6('0x36')](_0x3d2a32[_0xe5b6('0x37')]);_0x34562a[_0xe5b6('0x5b')]=_[_0xe5b6('0x39')](_0x34562a[_0xe5b6('0x35')],_0x34562a['query']);_0x145547[_0xe5b6('0x38')]=_[_0xe5b6('0x39')](_0x34562a['model'],qs['fields'](_0x3d2a32['query'][_0xe5b6('0x3a')]));_0x145547[_0xe5b6('0x38')]=_0x145547['attributes']['length']?_0x145547['attributes']:_0x34562a[_0xe5b6('0x35')];_0x145547[_0xe5b6('0x20')]=qs[_0xe5b6('0x20')](_0x3d2a32[_0xe5b6('0x37')][_0xe5b6('0x20')]);_0x145547[_0xe5b6('0x22')]=qs[_0xe5b6('0x22')](_0x3d2a32[_0xe5b6('0x37')][_0xe5b6('0x22')]);_0x145547['order']=qs[_0xe5b6('0x5c')](_0x3d2a32[_0xe5b6('0x37')][_0xe5b6('0x5c')]);_0x145547[_0xe5b6('0x3f')]=qs['filters'](_['pick'](_0x3d2a32[_0xe5b6('0x37')],_0x34562a[_0xe5b6('0x5b')]));_0x145547=_[_0xe5b6('0x40')]({},_0x145547,_0x3d2a32[_0xe5b6('0x42')]);return _0x50603a[_0xe5b6('0x27')+_[_0xe5b6('0x58')](_0x3d2a32['query'][_0xe5b6('0x55')][_0xe5b6('0x59')]())+_0xe5b6('0x5d')](_0x145547);})[_0xe5b6('0x25')](respondWithResult(_0x4ed818,null))[_0xe5b6('0x48')](handleError(_0x4ed818,null));};exports[_0xe5b6('0x5e')]=function(_0x8c7ae6,_0x2b451f,_0x2ee152){return db[_0xe5b6('0x30')]['findOne']({'where':{'id':_0x8c7ae6['params']['id']}})['then'](function(_0x589edc){if(_0x589edc){if(!_0x8c7ae6[_0xe5b6('0x4a')]['channel']||!utils[_0xe5b6('0x56')](_0x8c7ae6[_0xe5b6('0x4a')][_0xe5b6('0x55')])){throw new db[(_0xe5b6('0x57'))][(_0xe5b6('0x5f'))](_0xe5b6('0x60'));}return _0x589edc[_0xe5b6('0x61')+_[_0xe5b6('0x58')](_0x8c7ae6['body'][_0xe5b6('0x55')][_0xe5b6('0x59')]())+_0xe5b6('0x5d')](_0x8c7ae6[_0xe5b6('0x4a')]['ids']);}return null;})[_0xe5b6('0x25')](handleEntityNotFound(_0x2b451f,null))[_0xe5b6('0x25')](respondWithStatusCode(_0x2b451f,null))[_0xe5b6('0x48')](handleError(_0x2b451f,null));};exports[_0xe5b6('0x62')]=function(_0x4310a6,_0x26d030,_0x321f4d){return db['Team']['findOne']({'where':{'id':_0x4310a6[_0xe5b6('0x52')]['id']}})[_0xe5b6('0x25')](function(_0x529cfe){if(_0x529cfe){if(!_0x4310a6['query'][_0xe5b6('0x55')]||!utils[_0xe5b6('0x56')](_0x4310a6[_0xe5b6('0x37')][_0xe5b6('0x55')])){throw new db[(_0xe5b6('0x57'))][(_0xe5b6('0x5f'))](_0xe5b6('0x60'));}return _0x529cfe[_0xe5b6('0x63')+_[_0xe5b6('0x58')](_0x4310a6[_0xe5b6('0x37')][_0xe5b6('0x55')][_0xe5b6('0x59')]())+_0xe5b6('0x5d')](_0x4310a6['query']['ids']);}return null;})[_0xe5b6('0x25')](handleEntityNotFound(_0x26d030,null))[_0xe5b6('0x25')](respondWithStatusCode(_0x26d030,null))['catch'](handleError(_0x26d030,null));};exports[_0xe5b6('0x64')]=function(_0x23b6d6,_0x1950b5){return db[_0xe5b6('0x30')][_0xe5b6('0x4e')]({'where':{'id':_0x23b6d6[_0xe5b6('0x52')]['id']}})[_0xe5b6('0x25')](handleEntityNotFound(_0x1950b5,null))['then'](function(_0x1074ea){if(_0x1074ea){var _0x5a00c1=[_0xe5b6('0x65'),'Chat',_0xe5b6('0x66'),_0xe5b6('0x67'),'Fax','Openchannel',_0xe5b6('0x68')];return db[_0xe5b6('0x69')][_0xe5b6('0x6a')](function(_0x1b0820){var _0x3e8cb9=_[_0xe5b6('0x2f')](_0x5a00c1,function(_0x3c9605){var _0x47a091={'attributes':['id',_0xe5b6('0x2c')]};if(_0x3c9605===_0xe5b6('0x65')){_0x47a091[_0xe5b6('0x6b')]={'attributes':['penalty']};}return _0x1074ea[_0xe5b6('0x27')+_0x3c9605+_0xe5b6('0x5d')](_0x47a091)['then'](function(_0x528e56){var _0x15e3d5=_[_0xe5b6('0x2f')](_0x528e56,function(_0x1c1e1d){var _0x574403=_[_0xe5b6('0x2f')](_0x23b6d6[_0xe5b6('0x4a')]['ids'],function(_0x30d32a){var _0x476d97={'where':{'UserId':_0x30d32a,[_0x3c9605+_0xe5b6('0x6c')]:_0x1c1e1d['id']},'transaction':_0x1b0820};if(_0x3c9605===_0xe5b6('0x65')){_0x476d97['defaults']={'penalty':_0x1c1e1d['TeamVoiceQueue'][_0xe5b6('0x6d')]};}return db[_0xe5b6('0x6e')+_0x3c9605+_0xe5b6('0x5a')][_0xe5b6('0x6f')](_0x476d97)[_0xe5b6('0x25')](function(){socket[_0xe5b6('0x70')](_0xe5b6('0x4b')+_0x3c9605+_0xe5b6('0x71'),{'UserId':_0x30d32a,[_0x3c9605+_0xe5b6('0x6c')]:_0x1c1e1d['id']});if(_0x3c9605!==_0xe5b6('0x65'))return;return db[_0xe5b6('0x6e')][_0xe5b6('0x45')]({'where':{'id':_0x23b6d6[_0xe5b6('0x4a')][_0xe5b6('0x72')],'online':0x1},'attributes':['id',_0xe5b6('0x2c'),_0xe5b6('0x73'),'voicePause',_0xe5b6('0x74')],'raw':!![]})[_0xe5b6('0x25')](function(_0x434e69){var _0x34329e=_[_0xe5b6('0x2f')](_0x434e69,function(_0x1cdbad){return db[_0xe5b6('0x75')][_0xe5b6('0x76')]({'membername':_0x1cdbad[_0xe5b6('0x2c')],'UserId':_0x1cdbad['id'],'queue_name':_0x1c1e1d[_0xe5b6('0x2c')],'VoiceQueueId':_0x1c1e1d['id'],'interface':_[_0xe5b6('0x77')](_0x1cdbad[_0xe5b6('0x74')])?util[_0xe5b6('0x78')](_0xe5b6('0x79'),_0x1cdbad[_0xe5b6('0x2c')]):_0x1cdbad['interface'],'paused':_0x1cdbad['voicePause']||![],'penalty':_0x1c1e1d[_0xe5b6('0x7a')]['penalty']},{'transaction':_0x1b0820});});return Promise['all'](_0x34329e);});});});return Promise['all'](_0x574403);});return Promise[_0xe5b6('0x7b')](_0x15e3d5);});});return Promise['all'](_0x3e8cb9)['then'](function(){return _0x1074ea['addAgents'](_0x23b6d6[_0xe5b6('0x4a')][_0xe5b6('0x72')],{'transaction':_0x1b0820})['spread'](function(_0x2db84a){return _0x2db84a;});});});}})[_0xe5b6('0x25')](respondWithResult(_0x1950b5,null))[_0xe5b6('0x48')](handleError(_0x1950b5,null));};exports[_0xe5b6('0x7c')]=function(_0x55e5f8,_0x45d2f6){return db[_0xe5b6('0x30')][_0xe5b6('0x4e')]({'where':{'id':_0x55e5f8['params']['id']}})[_0xe5b6('0x25')](handleEntityNotFound(_0x45d2f6,null))[_0xe5b6('0x25')](function(_0xf96a55){if(_0xf96a55){var _0xa5c429=[_0xe5b6('0x65'),'Chat',_0xe5b6('0x66'),_0xe5b6('0x67'),_0xe5b6('0x7d'),_0xe5b6('0x7e'),_0xe5b6('0x68')];return db[_0xe5b6('0x69')][_0xe5b6('0x6a')](function(_0x510df3){var _0xc3c109=_['map'](_0xa5c429,function(_0x130c6e){var _0xc61ab1={'attributes':['id',_0xe5b6('0x2c')]};return _0xf96a55[_0xe5b6('0x27')+_0x130c6e+_0xe5b6('0x5d')](_0xc61ab1)[_0xe5b6('0x25')](function(_0x48a984){var _0x43dea7=_[_0xe5b6('0x2f')](_0x48a984,function(_0x2728ce){return _0x2728ce['removeAgents'](_0x55e5f8[_0xe5b6('0x37')]['ids'],{'transaction':_0x510df3})[_0xe5b6('0x25')](function(){var _0x5d24f7=JSON[_0xe5b6('0x7f')]('['+_0x55e5f8['query'][_0xe5b6('0x72')]+']');var _0x210164=_[_0xe5b6('0x2f')](_0x5d24f7,function(_0x359e3e){socket[_0xe5b6('0x70')](_0xe5b6('0x4b')+_0x130c6e+'Queue:remove',{'UserId':Number(_0x359e3e),[_0x130c6e+'QueueId']:_0x2728ce['id']});if(_0x130c6e!==_0xe5b6('0x65'))return;return db[_0xe5b6('0x75')][_0xe5b6('0x26')]({'where':{'VoiceQueueId':_0x2728ce['id'],'UserId':_0x359e3e},'transaction':_0x510df3});});return Promise[_0xe5b6('0x7b')](_0x210164);});});return Promise['all'](_0x43dea7);});});return Promise[_0xe5b6('0x7b')](_0xc3c109)[_0xe5b6('0x25')](function(){return _0xf96a55[_0xe5b6('0x7c')](_0x55e5f8[_0xe5b6('0x37')][_0xe5b6('0x72')],{'transaction':_0x510df3});});});}})[_0xe5b6('0x25')](respondWithStatusCode(_0x45d2f6,null))['catch'](handleError(_0x45d2f6,null));};exports['getAgents']=function(_0xb5219c,_0x588322,_0x4baaaf){var _0x30b385={};var _0x3857e9={};var _0x1c199a;var _0xff7f5b;return db[_0xe5b6('0x30')][_0xe5b6('0x54')]({'where':{'id':_0xb5219c[_0xe5b6('0x52')]['id']}})['then'](handleEntityNotFound(_0x588322,null))['then'](function(_0xc0664c){if(_0xc0664c){_0x1c199a=_0xc0664c;_0x3857e9['model']=_[_0xe5b6('0x36')](db[_0xe5b6('0x6e')][_0xe5b6('0x31')]);_0x3857e9[_0xe5b6('0x37')]=_[_0xe5b6('0x36')](_0xb5219c[_0xe5b6('0x37')]);_0x3857e9['filters']=_[_0xe5b6('0x39')](_0x3857e9[_0xe5b6('0x35')],_0x3857e9['query']);_0x30b385[_0xe5b6('0x38')]=_['intersection'](_0x3857e9[_0xe5b6('0x35')],qs[_0xe5b6('0x3a')](_0xb5219c['query'][_0xe5b6('0x3a')]));_0x30b385[_0xe5b6('0x38')]=_0x30b385['attributes'][_0xe5b6('0x3b')]?_0x30b385['attributes']:_0x3857e9[_0xe5b6('0x35')];_0x30b385['order']=qs[_0xe5b6('0x5c')](_0xb5219c['query'][_0xe5b6('0x5c')]);_0x30b385[_0xe5b6('0x3f')]=qs[_0xe5b6('0x5b')](_[_0xe5b6('0x3e')](_0xb5219c['query'],_0x3857e9[_0xe5b6('0x5b')]));if(_0xb5219c['query']['filter']){_0x30b385[_0xe5b6('0x3f')]=_[_0xe5b6('0x40')](_0x30b385[_0xe5b6('0x3f')],{'$or':_[_0xe5b6('0x2f')](_0x30b385[_0xe5b6('0x38')],function(_0x3b7e3a){var _0x1bb936={};_0x1bb936[_0x3b7e3a]={'$like':'%'+_0xb5219c[_0xe5b6('0x37')]['filter']+'%'};return _0x1bb936;})});}_0x30b385=_['merge']({},_0x30b385,_0xb5219c[_0xe5b6('0x42')]);return _0x1c199a[_0xe5b6('0x80')](_0x30b385);}})['then'](function(_0x9b242e){if(_0x9b242e){_0xff7f5b=_0x9b242e[_0xe5b6('0x3b')];if(!_0xb5219c[_0xe5b6('0x37')][_0xe5b6('0x81')](_0xe5b6('0x3c'))){_0x30b385[_0xe5b6('0x20')]=qs[_0xe5b6('0x20')](_0xb5219c['query']['limit']);_0x30b385[_0xe5b6('0x22')]=qs['offset'](_0xb5219c[_0xe5b6('0x37')][_0xe5b6('0x22')]);}return _0x1c199a[_0xe5b6('0x80')](_0x30b385);}})[_0xe5b6('0x25')](function(_0x389ff3){if(_0x389ff3){return _0x389ff3?{'count':_0xff7f5b,'rows':_0x389ff3}:null;}})[_0xe5b6('0x25')](respondWithResult(_0x588322,null))['catch'](handleError(_0x588322,null));}; \ No newline at end of file +var _0x2fd0=['key','model','map','keys','filters','intersection','attributes','fields','query','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','show','params','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getQueues','findOne','isValidChannel','channel','Sequelize','capitalize','toLowerCase','Queue','length','addQueues','ValidationError','Unknown\x20channel','add','Queues','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Openchannel','Whatsapp','sequelize','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','voicePause','UserVoiceQueueRt','upsert','isNil','format','all','spread','removeAgents','Fax','transaction','destroy','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','offset','limit','json','apply','reject','save','then','get','Teams','error','stack','name','index','Team','rawAttributes','fieldName'];(function(_0x46e806,_0x40b1cb){var _0x55d3a7=function(_0x177c2f){while(--_0x177c2f){_0x46e806['push'](_0x46e806['shift']());}};_0x55d3a7(++_0x40b1cb);}(_0x2fd0,0x1e1));var _0x02fd=function(_0x496c0c,_0x1497aa){_0x496c0c=_0x496c0c-0x0;var _0x2f673b=_0x2fd0[_0x496c0c];return _0x2f673b;};'use strict';var emlformat=require(_0x02fd('0x0'));var rimraf=require(_0x02fd('0x1'));var zipdir=require(_0x02fd('0x2'));var jsonpatch=require(_0x02fd('0x3'));var rp=require(_0x02fd('0x4'));var moment=require(_0x02fd('0x5'));var BPromise=require(_0x02fd('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x02fd('0x7'));var sox=require('sox');var csv=require(_0x02fd('0x8'));var ejs=require(_0x02fd('0x9'));var fs=require('fs');var fs_extra=require(_0x02fd('0xa'));var _=require('lodash');var squel=require(_0x02fd('0xb'));var crypto=require(_0x02fd('0xc'));var jsforce=require(_0x02fd('0xd'));var deskjs=require(_0x02fd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x02fd('0xf'));var Papa=require(_0x02fd('0x10'));var Redis=require(_0x02fd('0x11'));var authService=require(_0x02fd('0x12'));var qs=require(_0x02fd('0x13'));var as=require(_0x02fd('0x14'));var hardwareService=require(_0x02fd('0x15'));var logger=require('../../config/logger')(_0x02fd('0x16'));var utils=require('../../config/utils');var config=require(_0x02fd('0x17'));var licenseUtil=require(_0x02fd('0x18'));var db=require(_0x02fd('0x19'))['db'];config[_0x02fd('0x1a')]=_[_0x02fd('0x1b')](config['redis'],{'host':_0x02fd('0x1c'),'port':0x18eb});var socket=require(_0x02fd('0x1d'))(new Redis(config[_0x02fd('0x1a')]));require(_0x02fd('0x1e'))[_0x02fd('0x1f')](socket);function respondWithStatusCode(_0x134ff9,_0x484a55){_0x484a55=_0x484a55||0xcc;return function(_0x2ff9d9){if(_0x2ff9d9){return _0x134ff9[_0x02fd('0x20')](_0x484a55);}return _0x134ff9[_0x02fd('0x21')](_0x484a55)[_0x02fd('0x22')]();};}function respondWithResult(_0x28c4e5,_0x4e565e){_0x4e565e=_0x4e565e||0xc8;return function(_0x2a6fc5){if(_0x2a6fc5){return _0x28c4e5[_0x02fd('0x21')](_0x4e565e)['json'](_0x2a6fc5);}};}function respondWithFilteredResult(_0x2dffd9,_0x31f33c){return function(_0x4580f0){if(_0x4580f0){var _0x58fc60=typeof _0x31f33c[_0x02fd('0x23')]==='undefined'&&typeof _0x31f33c[_0x02fd('0x24')]==='undefined';var _0x10763e=_0x4580f0['count'];var _0x4c27ba=_0x58fc60?0x0:_0x31f33c[_0x02fd('0x23')];var _0x591028=_0x58fc60?_0x4580f0['count']:_0x31f33c[_0x02fd('0x23')]+_0x31f33c[_0x02fd('0x24')];var _0x24c31c;if(_0x591028>=_0x10763e){_0x591028=_0x10763e;_0x24c31c=0xc8;}else{_0x24c31c=0xce;}_0x2dffd9['status'](_0x24c31c);return _0x2dffd9['set']('Content-Range',_0x4c27ba+'-'+_0x591028+'/'+_0x10763e)[_0x02fd('0x25')](_0x4580f0);}return null;};}function patchUpdates(_0x17f538){return function(_0x33b024){try{jsonpatch[_0x02fd('0x26')](_0x33b024,_0x17f538,!![]);}catch(_0x494ee0){return BPromise[_0x02fd('0x27')](_0x494ee0);}return _0x33b024[_0x02fd('0x28')]();};}function saveUpdates(_0x4dc324,_0x1702a0){return function(_0x4e8bc3){if(_0x4e8bc3){return _0x4e8bc3['update'](_0x4dc324)[_0x02fd('0x29')](function(_0x43fa00){return _0x43fa00;});}return null;};}function removeEntity(_0x7a3ef0,_0x1a27ac){return function(_0x302e88){if(_0x302e88){return _0x302e88['destroy']()[_0x02fd('0x29')](function(){var _0x41b781=_0x302e88[_0x02fd('0x2a')]({'plain':!![]});var _0x510005=_0x02fd('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x510005,'resourceId':_0x41b781['id']}})[_0x02fd('0x29')](function(){return _0x302e88;});})[_0x02fd('0x29')](function(){_0x7a3ef0[_0x02fd('0x21')](0xcc)[_0x02fd('0x22')]();});}};}function handleEntityNotFound(_0xc80f75,_0x470eed){return function(_0xbc64be){if(!_0xbc64be){_0xc80f75[_0x02fd('0x20')](0x194);}return _0xbc64be;};}function handleError(_0x320470,_0x158cbc){_0x158cbc=_0x158cbc||0x1f4;return function(_0x20ea3e){logger[_0x02fd('0x2c')](_0x20ea3e[_0x02fd('0x2d')]);if(_0x20ea3e[_0x02fd('0x2e')]){delete _0x20ea3e['name'];}_0x320470[_0x02fd('0x21')](_0x158cbc)['send'](_0x20ea3e);};}exports[_0x02fd('0x2f')]=function(_0x168d0d,_0x46a1eb){var _0xc627c4={},_0x568892={},_0x4f4c0f={'count':0x0,'rows':[]};var _0xcc81e8=_['map'](db[_0x02fd('0x30')][_0x02fd('0x31')],function(_0x361419){return{'name':_0x361419[_0x02fd('0x32')],'type':_0x361419['type'][_0x02fd('0x33')]};});_0x568892[_0x02fd('0x34')]=_[_0x02fd('0x35')](_0xcc81e8,_0x02fd('0x2e'));_0x568892['query']=_[_0x02fd('0x36')](_0x168d0d['query']);_0x568892[_0x02fd('0x37')]=_[_0x02fd('0x38')](_0x568892[_0x02fd('0x34')],_0x568892['query']);_0xc627c4[_0x02fd('0x39')]=_[_0x02fd('0x38')](_0x568892[_0x02fd('0x34')],qs[_0x02fd('0x3a')](_0x168d0d[_0x02fd('0x3b')]['fields']));_0xc627c4[_0x02fd('0x39')]=_0xc627c4[_0x02fd('0x39')]['length']?_0xc627c4[_0x02fd('0x39')]:_0x568892['model'];if(!_0x168d0d[_0x02fd('0x3b')]['hasOwnProperty'](_0x02fd('0x3c'))){_0xc627c4['limit']=qs[_0x02fd('0x24')](_0x168d0d[_0x02fd('0x3b')]['limit']);_0xc627c4[_0x02fd('0x23')]=qs[_0x02fd('0x23')](_0x168d0d[_0x02fd('0x3b')][_0x02fd('0x23')]);}_0xc627c4[_0x02fd('0x3d')]=qs['sort'](_0x168d0d[_0x02fd('0x3b')][_0x02fd('0x3e')]);_0xc627c4[_0x02fd('0x3f')]=qs[_0x02fd('0x37')](_[_0x02fd('0x40')](_0x168d0d[_0x02fd('0x3b')],_0x568892['filters']),_0xcc81e8);if(_0x168d0d[_0x02fd('0x3b')][_0x02fd('0x41')]){_0xc627c4['where']=_[_0x02fd('0x42')](_0xc627c4['where'],{'$or':_['map'](_0xcc81e8,function(_0x47135e){if(_0x47135e[_0x02fd('0x43')]!==_0x02fd('0x44')){var _0x168966={};_0x168966[_0x47135e[_0x02fd('0x2e')]]={'$like':'%'+_0x168d0d[_0x02fd('0x3b')]['filter']+'%'};return _0x168966;}})});}_0xc627c4=_['merge']({},_0xc627c4,_0x168d0d['options']);var _0x43fc68={'where':_0xc627c4[_0x02fd('0x3f')]};return db[_0x02fd('0x30')]['count'](_0x43fc68)['then'](function(_0x407f0f){_0x4f4c0f[_0x02fd('0x45')]=_0x407f0f;if(_0x168d0d[_0x02fd('0x3b')][_0x02fd('0x46')]){_0xc627c4[_0x02fd('0x47')]=[{'all':!![]}];}return db[_0x02fd('0x30')][_0x02fd('0x48')](_0xc627c4);})[_0x02fd('0x29')](function(_0x439efc){_0x4f4c0f['rows']=_0x439efc;return _0x4f4c0f;})[_0x02fd('0x29')](respondWithFilteredResult(_0x46a1eb,_0xc627c4))['catch'](handleError(_0x46a1eb,null));};exports[_0x02fd('0x49')]=function(_0x2d1789,_0x251720){var _0x49be24={'raw':![],'where':{'id':_0x2d1789[_0x02fd('0x4a')]['id']}},_0x25e314={};_0x25e314[_0x02fd('0x34')]=_[_0x02fd('0x36')](db[_0x02fd('0x30')][_0x02fd('0x31')]);_0x25e314[_0x02fd('0x3b')]=_[_0x02fd('0x36')](_0x2d1789['query']);_0x25e314['filters']=_['intersection'](_0x25e314['model'],_0x25e314['query']);_0x49be24['attributes']=_['intersection'](_0x25e314[_0x02fd('0x34')],qs[_0x02fd('0x3a')](_0x2d1789[_0x02fd('0x3b')]['fields']));_0x49be24[_0x02fd('0x39')]=_0x49be24[_0x02fd('0x39')]['length']?_0x49be24[_0x02fd('0x39')]:_0x25e314['model'];if(_0x2d1789[_0x02fd('0x3b')][_0x02fd('0x46')]){_0x49be24[_0x02fd('0x47')]=[{'all':!![]}];}_0x49be24=_[_0x02fd('0x42')]({},_0x49be24,_0x2d1789[_0x02fd('0x4b')]);return db[_0x02fd('0x30')][_0x02fd('0x4c')](_0x49be24)['then'](handleEntityNotFound(_0x251720,null))[_0x02fd('0x29')](respondWithResult(_0x251720,null))['catch'](handleError(_0x251720,null));};exports[_0x02fd('0x4d')]=function(_0x21de1b,_0x271aca){return db[_0x02fd('0x30')][_0x02fd('0x4d')](_0x21de1b[_0x02fd('0x4e')],{})[_0x02fd('0x29')](function(_0x421af6){var _0x783f54=_0x21de1b[_0x02fd('0x4f')][_0x02fd('0x2a')]({'plain':!![]});if(!_0x783f54)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x783f54['role']===_0x02fd('0x4f')){var _0x3e3ad9=_0x421af6[_0x02fd('0x2a')]({'plain':!![]});var _0xe57798=_0x02fd('0x2b');return db[_0x02fd('0x50')]['find']({'where':{'name':_0xe57798,'userProfileId':_0x783f54[_0x02fd('0x51')]},'raw':!![]})[_0x02fd('0x29')](function(_0x112969){if(_0x112969&&_0x112969[_0x02fd('0x52')]===0x0){return db[_0x02fd('0x53')]['create']({'name':_0x3e3ad9[_0x02fd('0x2e')],'resourceId':_0x3e3ad9['id'],'type':_0x112969['name'],'sectionId':_0x112969['id']},{})[_0x02fd('0x29')](function(){return _0x421af6;});}else{return _0x421af6;}})[_0x02fd('0x54')](function(_0x580f4e){logger[_0x02fd('0x2c')](_0x02fd('0x55'),_0x580f4e);throw _0x580f4e;});}return _0x421af6;})[_0x02fd('0x29')](respondWithResult(_0x271aca,0xc9))[_0x02fd('0x54')](handleError(_0x271aca,null));};exports[_0x02fd('0x56')]=function(_0x5595e1,_0x4ed92e){if(_0x5595e1['body']['id']){delete _0x5595e1['body']['id'];}return db[_0x02fd('0x30')][_0x02fd('0x4c')]({'where':{'id':_0x5595e1[_0x02fd('0x4a')]['id']}})[_0x02fd('0x29')](handleEntityNotFound(_0x4ed92e,null))[_0x02fd('0x29')](saveUpdates(_0x5595e1[_0x02fd('0x4e')],null))[_0x02fd('0x29')](respondWithResult(_0x4ed92e,null))[_0x02fd('0x54')](handleError(_0x4ed92e,null));};exports['destroy']=function(_0x291c6c,_0x327b94){return db['Team'][_0x02fd('0x4c')]({'where':{'id':_0x291c6c[_0x02fd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x327b94,null))[_0x02fd('0x29')](removeEntity(_0x327b94,null))[_0x02fd('0x54')](handleError(_0x327b94,null));};exports[_0x02fd('0x57')]=function(_0x17abf0,_0x430f04,_0x5b38ad){return db[_0x02fd('0x30')][_0x02fd('0x58')]({'where':{'id':_0x17abf0['params']['id']}})[_0x02fd('0x29')](handleEntityNotFound(_0x430f04,null))[_0x02fd('0x29')](function(_0x23cd2e){if(!_0x17abf0[_0x02fd('0x3b')]['channel']||!utils[_0x02fd('0x59')](_0x17abf0[_0x02fd('0x3b')][_0x02fd('0x5a')])){throw new db[(_0x02fd('0x5b'))]['ValidationError']('Unknown\x20channel');}var _0x258403={};var _0x234a72={};_0x234a72[_0x02fd('0x34')]=_[_0x02fd('0x36')](db[_[_0x02fd('0x5c')](_0x17abf0[_0x02fd('0x3b')]['channel'][_0x02fd('0x5d')]())+_0x02fd('0x5e')][_0x02fd('0x31')]);_0x234a72[_0x02fd('0x3b')]=_[_0x02fd('0x36')](_0x17abf0[_0x02fd('0x3b')]);_0x234a72[_0x02fd('0x37')]=_['intersection'](_0x234a72[_0x02fd('0x34')],_0x234a72['query']);_0x258403[_0x02fd('0x39')]=_[_0x02fd('0x38')](_0x234a72[_0x02fd('0x34')],qs[_0x02fd('0x3a')](_0x17abf0[_0x02fd('0x3b')][_0x02fd('0x3a')]));_0x258403[_0x02fd('0x39')]=_0x258403[_0x02fd('0x39')][_0x02fd('0x5f')]?_0x258403['attributes']:_0x234a72[_0x02fd('0x34')];_0x258403[_0x02fd('0x24')]=qs[_0x02fd('0x24')](_0x17abf0['query'][_0x02fd('0x24')]);_0x258403[_0x02fd('0x23')]=qs[_0x02fd('0x23')](_0x17abf0[_0x02fd('0x3b')][_0x02fd('0x23')]);_0x258403[_0x02fd('0x3d')]=qs[_0x02fd('0x3e')](_0x17abf0[_0x02fd('0x3b')][_0x02fd('0x3e')]);_0x258403[_0x02fd('0x3f')]=qs[_0x02fd('0x37')](_['pick'](_0x17abf0[_0x02fd('0x3b')],_0x234a72[_0x02fd('0x37')]));_0x258403=_[_0x02fd('0x42')]({},_0x258403,_0x17abf0[_0x02fd('0x4b')]);return _0x23cd2e[_0x02fd('0x2a')+_[_0x02fd('0x5c')](_0x17abf0[_0x02fd('0x3b')][_0x02fd('0x5a')][_0x02fd('0x5d')]())+'Queues'](_0x258403);})[_0x02fd('0x29')](respondWithResult(_0x430f04,null))[_0x02fd('0x54')](handleError(_0x430f04,null));};exports[_0x02fd('0x60')]=function(_0x30eda5,_0x4f301e,_0xf2ee3c){return db[_0x02fd('0x30')][_0x02fd('0x58')]({'where':{'id':_0x30eda5[_0x02fd('0x4a')]['id']}})['then'](function(_0x1915e1){if(_0x1915e1){if(!_0x30eda5[_0x02fd('0x4e')][_0x02fd('0x5a')]||!utils['isValidChannel'](_0x30eda5[_0x02fd('0x4e')][_0x02fd('0x5a')])){throw new db['Sequelize'][(_0x02fd('0x61'))](_0x02fd('0x62'));}return _0x1915e1[_0x02fd('0x63')+_[_0x02fd('0x5c')](_0x30eda5[_0x02fd('0x4e')][_0x02fd('0x5a')][_0x02fd('0x5d')]())+_0x02fd('0x64')](_0x30eda5[_0x02fd('0x4e')][_0x02fd('0x65')]);}return null;})[_0x02fd('0x29')](handleEntityNotFound(_0x4f301e,null))[_0x02fd('0x29')](respondWithStatusCode(_0x4f301e,null))[_0x02fd('0x54')](handleError(_0x4f301e,null));};exports[_0x02fd('0x66')]=function(_0x22b791,_0x3f2af3,_0x360b7f){return db[_0x02fd('0x30')][_0x02fd('0x58')]({'where':{'id':_0x22b791['params']['id']}})[_0x02fd('0x29')](function(_0x287fa0){if(_0x287fa0){if(!_0x22b791['query'][_0x02fd('0x5a')]||!utils[_0x02fd('0x59')](_0x22b791[_0x02fd('0x3b')][_0x02fd('0x5a')])){throw new db[(_0x02fd('0x5b'))][(_0x02fd('0x61'))]('Unknown\x20channel');}return _0x287fa0[_0x02fd('0x67')+_[_0x02fd('0x5c')](_0x22b791['query'][_0x02fd('0x5a')][_0x02fd('0x5d')]())+_0x02fd('0x64')](_0x22b791[_0x02fd('0x3b')]['ids']);}return null;})[_0x02fd('0x29')](handleEntityNotFound(_0x3f2af3,null))['then'](respondWithStatusCode(_0x3f2af3,null))[_0x02fd('0x54')](handleError(_0x3f2af3,null));};exports[_0x02fd('0x68')]=function(_0x4980ec,_0x333e17){return db[_0x02fd('0x30')][_0x02fd('0x4c')]({'where':{'id':_0x4980ec[_0x02fd('0x4a')]['id']}})[_0x02fd('0x29')](handleEntityNotFound(_0x333e17,null))[_0x02fd('0x29')](function(_0x3b07e9){if(_0x3b07e9){var _0xf1bccf=[_0x02fd('0x69'),_0x02fd('0x6a'),_0x02fd('0x6b'),_0x02fd('0x6c'),'Fax',_0x02fd('0x6d'),_0x02fd('0x6e')];return db[_0x02fd('0x6f')]['transaction'](function(_0x1a0d27){var _0x362d65=_[_0x02fd('0x35')](_0xf1bccf,function(_0x11f4c1){var _0x13826e={'attributes':['id',_0x02fd('0x2e')]};if(_0x11f4c1===_0x02fd('0x69')){_0x13826e[_0x02fd('0x70')]={'attributes':[_0x02fd('0x71')]};}return _0x3b07e9[_0x02fd('0x2a')+_0x11f4c1+_0x02fd('0x64')](_0x13826e)[_0x02fd('0x29')](function(_0x1cd8e9){var _0x13f612=_[_0x02fd('0x35')](_0x1cd8e9,function(_0x1f673b){var _0x4ddb28=_['map'](_0x4980ec['body']['ids'],function(_0x6e96b0){var _0x2ed4fb={'where':{'UserId':_0x6e96b0,[_0x11f4c1+_0x02fd('0x72')]:_0x1f673b['id']},'transaction':_0x1a0d27};if(_0x11f4c1===_0x02fd('0x69')){_0x2ed4fb[_0x02fd('0x1b')]={'penalty':_0x1f673b[_0x02fd('0x73')][_0x02fd('0x71')]};}return db[_0x02fd('0x74')+_0x11f4c1+_0x02fd('0x5e')][_0x02fd('0x75')](_0x2ed4fb)[_0x02fd('0x29')](function(){socket[_0x02fd('0x76')](_0x02fd('0x4f')+_0x11f4c1+_0x02fd('0x77'),{'UserId':_0x6e96b0,[_0x11f4c1+_0x02fd('0x72')]:_0x1f673b['id']});if(_0x11f4c1!==_0x02fd('0x69'))return;return db[_0x02fd('0x74')][_0x02fd('0x48')]({'where':{'id':_0x4980ec[_0x02fd('0x4e')]['ids'],'online':0x1},'attributes':['id',_0x02fd('0x2e'),'online',_0x02fd('0x78'),'interface'],'raw':!![]})[_0x02fd('0x29')](function(_0x1564e4){var _0x457f4e=_[_0x02fd('0x35')](_0x1564e4,function(_0x4ac22f){return db[_0x02fd('0x79')][_0x02fd('0x7a')]({'membername':_0x4ac22f['name'],'UserId':_0x4ac22f['id'],'queue_name':_0x1f673b['name'],'VoiceQueueId':_0x1f673b['id'],'interface':_[_0x02fd('0x7b')](_0x4ac22f['interface'])?util[_0x02fd('0x7c')]('SIP/%s',_0x4ac22f[_0x02fd('0x2e')]):_0x4ac22f['interface'],'paused':_0x4ac22f[_0x02fd('0x78')]||![],'penalty':_0x1f673b[_0x02fd('0x73')][_0x02fd('0x71')]},{'transaction':_0x1a0d27});});return Promise[_0x02fd('0x7d')](_0x457f4e);});});});return Promise['all'](_0x4ddb28);});return Promise[_0x02fd('0x7d')](_0x13f612);});});return Promise[_0x02fd('0x7d')](_0x362d65)[_0x02fd('0x29')](function(){return _0x3b07e9['addAgents'](_0x4980ec[_0x02fd('0x4e')][_0x02fd('0x65')],{'transaction':_0x1a0d27})[_0x02fd('0x7e')](function(_0x43acbf){return _0x43acbf;});});});}})[_0x02fd('0x29')](respondWithResult(_0x333e17,null))['catch'](handleError(_0x333e17,null));};exports[_0x02fd('0x7f')]=function(_0x53ce8c,_0x20ee2b){return db[_0x02fd('0x30')]['find']({'where':{'id':_0x53ce8c[_0x02fd('0x4a')]['id']}})[_0x02fd('0x29')](handleEntityNotFound(_0x20ee2b,null))[_0x02fd('0x29')](function(_0x1f046b){if(_0x1f046b){var _0x203c66=[_0x02fd('0x69'),'Chat',_0x02fd('0x6b'),_0x02fd('0x6c'),_0x02fd('0x80'),_0x02fd('0x6d'),'Whatsapp'];return db['sequelize'][_0x02fd('0x81')](function(_0x53b77c){var _0x8247b6=_[_0x02fd('0x35')](_0x203c66,function(_0x3d8795){var _0x214938={'attributes':['id',_0x02fd('0x2e')]};return _0x1f046b[_0x02fd('0x2a')+_0x3d8795+_0x02fd('0x64')](_0x214938)[_0x02fd('0x29')](function(_0x4b5c6b){var _0xa15578=_[_0x02fd('0x35')](_0x4b5c6b,function(_0x71176f){return _0x71176f[_0x02fd('0x7f')](_0x53ce8c['query'][_0x02fd('0x65')],{'transaction':_0x53b77c})[_0x02fd('0x29')](function(){var _0x5211c1=JSON['parse']('['+_0x53ce8c[_0x02fd('0x3b')][_0x02fd('0x65')]+']');var _0x3aaa2f=_[_0x02fd('0x35')](_0x5211c1,function(_0x508780){socket[_0x02fd('0x76')](_0x02fd('0x4f')+_0x3d8795+'Queue:remove',{'UserId':Number(_0x508780),[_0x3d8795+_0x02fd('0x72')]:_0x71176f['id']});if(_0x3d8795!==_0x02fd('0x69'))return;return db[_0x02fd('0x79')][_0x02fd('0x82')]({'where':{'VoiceQueueId':_0x71176f['id'],'UserId':_0x508780},'transaction':_0x53b77c});});return Promise['all'](_0x3aaa2f);});});return Promise[_0x02fd('0x7d')](_0xa15578);});});return Promise[_0x02fd('0x7d')](_0x8247b6)['then'](function(){return _0x1f046b[_0x02fd('0x7f')](_0x53ce8c[_0x02fd('0x3b')][_0x02fd('0x65')],{'transaction':_0x53b77c});});});}})['then'](respondWithStatusCode(_0x20ee2b,null))[_0x02fd('0x54')](handleError(_0x20ee2b,null));};exports['getAgents']=function(_0xb77f24,_0x24f770,_0x43703d){var _0x119deb={};var _0x368df9={};var _0x4491c7;var _0x5dd258;return db[_0x02fd('0x30')][_0x02fd('0x58')]({'where':{'id':_0xb77f24[_0x02fd('0x4a')]['id']}})[_0x02fd('0x29')](handleEntityNotFound(_0x24f770,null))['then'](function(_0x2816dc){if(_0x2816dc){_0x4491c7=_0x2816dc;_0x368df9[_0x02fd('0x34')]=_[_0x02fd('0x36')](db[_0x02fd('0x74')][_0x02fd('0x31')]);_0x368df9['query']=_[_0x02fd('0x36')](_0xb77f24[_0x02fd('0x3b')]);_0x368df9[_0x02fd('0x37')]=_[_0x02fd('0x38')](_0x368df9[_0x02fd('0x34')],_0x368df9[_0x02fd('0x3b')]);_0x119deb[_0x02fd('0x39')]=_[_0x02fd('0x38')](_0x368df9[_0x02fd('0x34')],qs['fields'](_0xb77f24[_0x02fd('0x3b')][_0x02fd('0x3a')]));_0x119deb['attributes']=_0x119deb[_0x02fd('0x39')][_0x02fd('0x5f')]?_0x119deb[_0x02fd('0x39')]:_0x368df9[_0x02fd('0x34')];_0x119deb[_0x02fd('0x3d')]=qs[_0x02fd('0x3e')](_0xb77f24['query']['sort']);_0x119deb[_0x02fd('0x3f')]=qs[_0x02fd('0x37')](_['pick'](_0xb77f24[_0x02fd('0x3b')],_0x368df9[_0x02fd('0x37')]));if(_0xb77f24[_0x02fd('0x3b')]['filter']){_0x119deb[_0x02fd('0x3f')]=_[_0x02fd('0x42')](_0x119deb['where'],{'$or':_['map'](_0x119deb[_0x02fd('0x39')],function(_0x5dc612){var _0x2c626b={};_0x2c626b[_0x5dc612]={'$like':'%'+_0xb77f24[_0x02fd('0x3b')][_0x02fd('0x41')]+'%'};return _0x2c626b;})});}_0x119deb=_['merge']({},_0x119deb,_0xb77f24[_0x02fd('0x4b')]);return _0x4491c7[_0x02fd('0x83')](_0x119deb);}})[_0x02fd('0x29')](function(_0x26f922){if(_0x26f922){_0x5dd258=_0x26f922[_0x02fd('0x5f')];if(!_0xb77f24['query'][_0x02fd('0x84')](_0x02fd('0x3c'))){_0x119deb[_0x02fd('0x24')]=qs[_0x02fd('0x24')](_0xb77f24[_0x02fd('0x3b')][_0x02fd('0x24')]);_0x119deb[_0x02fd('0x23')]=qs[_0x02fd('0x23')](_0xb77f24[_0x02fd('0x3b')][_0x02fd('0x23')]);}return _0x4491c7[_0x02fd('0x83')](_0x119deb);}})[_0x02fd('0x29')](function(_0x509bba){if(_0x509bba){return _0x509bba?{'count':_0x5dd258,'rows':_0x509bba}:null;}})['then'](respondWithResult(_0x24f770,null))[_0x02fd('0x54')](handleError(_0x24f770,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 94d8458..307b297 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 _0x205e=['events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x57fa2a,_0x4a1aaa){var _0xeec6c4=function(_0xec1414){while(--_0xec1414){_0x57fa2a['push'](_0x57fa2a['shift']());}};_0xeec6c4(++_0x4a1aaa);}(_0x205e,0x1d6));var _0xe205=function(_0xf2e4f3,_0x9773ba){_0xf2e4f3=_0xf2e4f3-0x0;var _0x294398=_0x205e[_0xf2e4f3];return _0x294398;};'use strict';var EventEmitter=require(_0xe205('0x0'));var Team=require(_0xe205('0x1'))['db'][_0xe205('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xe205('0x3')](0x0);var events={'afterCreate':_0xe205('0x4'),'afterUpdate':_0xe205('0x5'),'afterDestroy':_0xe205('0x6')};function emitEvent(_0x40ec57){return function(_0x46500e,_0x978aa1,_0x1b8674){TeamEvents['emit'](_0x40ec57+':'+_0x46500e['id'],_0x46500e);TeamEvents[_0xe205('0x7')](_0x40ec57,_0x46500e);_0x1b8674(null);};}for(var e in events){if(events[_0xe205('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xe205('0x9')]=TeamEvents; \ No newline at end of file +var _0xcff4=['hook','exports','events','../../mysqldb','Team','save','emit'];(function(_0x405197,_0x51d92e){var _0x14fa96=function(_0x1f8e81){while(--_0x1f8e81){_0x405197['push'](_0x405197['shift']());}};_0x14fa96(++_0x51d92e);}(_0xcff4,0xfe));var _0x4cff=function(_0x43d155,_0x495872){_0x43d155=_0x43d155-0x0;var _0x55f9e3=_0xcff4[_0x43d155];return _0x55f9e3;};'use strict';var EventEmitter=require(_0x4cff('0x0'));var Team=require(_0x4cff('0x1'))['db'][_0x4cff('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4cff('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x549ebb){return function(_0xc81c3b,_0x1c9f22,_0x52ba23){TeamEvents['emit'](_0x549ebb+':'+_0xc81c3b['id'],_0xc81c3b);TeamEvents[_0x4cff('0x4')](_0x549ebb,_0xc81c3b);_0x52ba23(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x4cff('0x5')](e,emitEvent(event));}}module[_0x4cff('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index d2fc549..dacd434 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 _0x5f6c=['define','Team','teams','lodash','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x3462c3,_0x2719f7){var _0x34bc9a=function(_0x577bb8){while(--_0x577bb8){_0x3462c3['push'](_0x3462c3['shift']());}};_0x34bc9a(++_0x2719f7);}(_0x5f6c,0x1bb));var _0xc5f6=function(_0x3bf2e4,_0x47b9e4){_0x3bf2e4=_0x3bf2e4-0x0;var _0x2c6a72=_0x5f6c[_0x3bf2e4];return _0x2c6a72;};'use strict';var _=require(_0xc5f6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc5f6('0x1'));var moment=require(_0xc5f6('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5f6('0x3'));var rimraf=require(_0xc5f6('0x4'));var config=require(_0xc5f6('0x5'));var attributes=require('./team.attributes');module[_0xc5f6('0x6')]=function(_0x2d6d37,_0x39e789){return _0x2d6d37[_0xc5f6('0x7')](_0xc5f6('0x8'),attributes,{'tableName':_0xc5f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d74=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','Team','lodash'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x9d74,0xf9));var _0x49d7=function(_0x416468,_0x2e7a72){_0x416468=_0x416468-0x0;var _0x2ee9b7=_0x9d74[_0x416468];return _0x2ee9b7;};'use strict';var _=require(_0x49d7('0x0'));var util=require(_0x49d7('0x1'));var logger=require(_0x49d7('0x2'))(_0x49d7('0x3'));var moment=require(_0x49d7('0x4'));var BPromise=require(_0x49d7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x49d7('0x6'));var rimraf=require(_0x49d7('0x7'));var config=require(_0x49d7('0x8'));var attributes=require('./team.attributes');module['exports']=function(_0x158648,_0x4085c0){return _0x158648['define'](_0x49d7('0x9'),attributes,{'tableName':'teams','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 4ca35d3..cf2f45a 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 _0x8644=['client','http','redis','localhost','socket.io-emitter','./team.socket','register','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2ddfd9,_0x5877d0){var _0x2668f0=function(_0x70ad6f){while(--_0x70ad6f){_0x2ddfd9['push'](_0x2ddfd9['shift']());}};_0x2668f0(++_0x5877d0);}(_0x8644,0x12a));var _0x4864=function(_0x549f20,_0x23e210){_0x549f20=_0x549f20-0x0;var _0x56cbe0=_0x8644[_0x549f20];return _0x56cbe0;};'use strict';var _=require(_0x4864('0x0'));var util=require(_0x4864('0x1'));var moment=require(_0x4864('0x2'));var BPromise=require(_0x4864('0x3'));var rs=require(_0x4864('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4864('0x5'));var logger=require(_0x4864('0x6'))(_0x4864('0x7'));var config=require(_0x4864('0x8'));var jayson=require(_0x4864('0x9'));var client=jayson[_0x4864('0xa')][_0x4864('0xb')]({'port':0x232a});config[_0x4864('0xc')]=_['defaults'](config[_0x4864('0xc')],{'host':_0x4864('0xd'),'port':0x18eb});var socket=require(_0x4864('0xe'))(new Redis(config[_0x4864('0xc')]));require(_0x4864('0xf'))[_0x4864('0x10')](socket);function respondWithRpcPromise(_0x800709,_0x5bfdfa,_0x553d39){return new BPromise(function(_0x2339bf,_0x337db1){return client[_0x4864('0x11')](_0x800709,_0x553d39)['then'](function(_0x22bcf4){logger[_0x4864('0x12')](_0x4864('0x13'),_0x5bfdfa,_0x4864('0x14'));logger[_0x4864('0x15')](_0x4864('0x16'),_0x5bfdfa,_0x4864('0x14'),JSON[_0x4864('0x17')](_0x22bcf4));if(_0x22bcf4['error']){if(_0x22bcf4[_0x4864('0x18')]['code']===0x1f4){logger[_0x4864('0x18')](_0x4864('0x13'),_0x5bfdfa,_0x22bcf4['error'][_0x4864('0x19')]);return _0x337db1(_0x22bcf4[_0x4864('0x18')][_0x4864('0x19')]);}logger[_0x4864('0x18')](_0x4864('0x13'),_0x5bfdfa,_0x22bcf4[_0x4864('0x18')]['message']);return _0x2339bf(_0x22bcf4['error'][_0x4864('0x19')]);}else{logger[_0x4864('0x12')]('Team,\x20%s,\x20%s',_0x5bfdfa,'request\x20sent');_0x2339bf(_0x22bcf4[_0x4864('0x1a')]['message']);}})[_0x4864('0x1b')](function(_0x16c998){logger['error'](_0x4864('0x13'),_0x5bfdfa,_0x16c998);_0x337db1(_0x16c998);});});} \ No newline at end of file +var _0x16af=['redis','defaults','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x16af,0x111));var _0xf16a=function(_0x21fb37,_0x3166a3){_0x21fb37=_0x21fb37-0x0;var _0x2a512c=_0x16af[_0x21fb37];return _0x2a512c;};'use strict';var _=require(_0xf16a('0x0'));var util=require(_0xf16a('0x1'));var moment=require(_0xf16a('0x2'));var BPromise=require(_0xf16a('0x3'));var rs=require(_0xf16a('0x4'));var fs=require('fs');var Redis=require(_0xf16a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf16a('0x6'));var logger=require(_0xf16a('0x7'))(_0xf16a('0x8'));var config=require(_0xf16a('0x9'));var jayson=require(_0xf16a('0xa'));var client=jayson[_0xf16a('0xb')][_0xf16a('0xc')]({'port':0x232a});config[_0xf16a('0xd')]=_[_0xf16a('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf16a('0xf'))(new Redis(config[_0xf16a('0xd')]));require(_0xf16a('0x10'))[_0xf16a('0x11')](socket);function respondWithRpcPromise(_0x41660b,_0x356385,_0x5edb34){return new BPromise(function(_0x1b8bd3,_0x50ee74){return client[_0xf16a('0x12')](_0x41660b,_0x5edb34)[_0xf16a('0x13')](function(_0x1b246f){logger[_0xf16a('0x14')](_0xf16a('0x15'),_0x356385,'request\x20sent');logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x356385,_0xf16a('0x16'),JSON['stringify'](_0x1b246f));if(_0x1b246f[_0xf16a('0x17')]){if(_0x1b246f['error'][_0xf16a('0x18')]===0x1f4){logger[_0xf16a('0x17')]('Team,\x20%s,\x20%s',_0x356385,_0x1b246f[_0xf16a('0x17')][_0xf16a('0x19')]);return _0x50ee74(_0x1b246f['error'][_0xf16a('0x19')]);}logger[_0xf16a('0x17')](_0xf16a('0x15'),_0x356385,_0x1b246f[_0xf16a('0x17')][_0xf16a('0x19')]);return _0x1b8bd3(_0x1b246f[_0xf16a('0x17')][_0xf16a('0x19')]);}else{logger['info'](_0xf16a('0x15'),_0x356385,_0xf16a('0x16'));_0x1b8bd3(_0x1b246f['result']['message']);}})['catch'](function(_0x142f3c){logger[_0xf16a('0x17')]('Team,\x20%s,\x20%s',_0x356385,_0x142f3c);_0x50ee74(_0x142f3c);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 3ff5de6..ec502d8 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 _0x84cd=['emit','removeListener','length','team:','save','remove','update'];(function(_0x4ba162,_0x45efd3){var _0x1853a5=function(_0x39db78){while(--_0x39db78){_0x4ba162['push'](_0x4ba162['shift']());}};_0x1853a5(++_0x45efd3);}(_0x84cd,0x1e0));var _0xd84c=function(_0x4f6dd2,_0x2dc2af){_0x4f6dd2=_0x4f6dd2-0x0;var _0x4d425e=_0x84cd[_0x4f6dd2];return _0x4d425e;};'use strict';var TeamEvents=require('./team.events');var events=[_0xd84c('0x0'),_0xd84c('0x1'),_0xd84c('0x2')];function createListener(_0x37c84e,_0x171331){return function(_0x2d0111){_0x171331[_0xd84c('0x3')](_0x37c84e,_0x2d0111);};}function removeListener(_0x3e0297,_0x317a07){return function(){TeamEvents[_0xd84c('0x4')](_0x3e0297,_0x317a07);};}exports['register']=function(_0x45c648){for(var _0x1f6718=0x0,_0x352620=events[_0xd84c('0x5')];_0x1f6718<_0x352620;_0x1f6718++){var _0x5604f0=events[_0x1f6718];var _0x4b72b3=createListener(_0xd84c('0x6')+_0x5604f0,_0x45c648);TeamEvents['on'](_0x5604f0,_0x4b72b3);}}; \ No newline at end of file +var _0xab26=['./team.events','save','remove','removeListener','register','length','team:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xab26,0xd2));var _0x6ab2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xab26[_0x122ef9];return _0x42fba0;};'use strict';var TeamEvents=require(_0x6ab2('0x0'));var events=[_0x6ab2('0x1'),_0x6ab2('0x2'),'update'];function createListener(_0x2dfe5c,_0x2a9ffe){return function(_0x5ac05e){_0x2a9ffe['emit'](_0x2dfe5c,_0x5ac05e);};}function removeListener(_0x4c8cf,_0x51bdcd){return function(){TeamEvents[_0x6ab2('0x3')](_0x4c8cf,_0x51bdcd);};}exports[_0x6ab2('0x4')]=function(_0x31c9f1){for(var _0x56dc80=0x0,_0x41643a=events[_0x6ab2('0x5')];_0x56dc80<_0x41643a;_0x56dc80++){var _0x54bf93=events[_0x56dc80];var _0x140cc1=createListener(_0x6ab2('0x6')+_0x54bf93,_0x31c9f1);TeamEvents['on'](_0x54bf93,_0x140cc1);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 1511b0d..b5a8d34 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5e2152,_0x172f3d){var _0x5ddcf6=function(_0x30a5cc){while(--_0x30a5cc){_0x5e2152['push'](_0x5e2152['shift']());}};_0x5ddcf6(++_0x172f3d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2194a8,_0xdb9a){var _0x4d6a6e=function(_0xc0088e){while(--_0xc0088e){_0x2194a8['push'](_0x2194a8['shift']());}};_0x4d6a6e(++_0xdb9a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1c7889,_0x24cd26){_0x1c7889=_0x1c7889-0x0;var _0x2f14e5=_0xcb91[_0x1c7889];return _0x2f14e5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 420ac00..cc3c82f 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ec6=['sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x362c03,_0x18e75){_0x362c03=_0x362c03-0x0;var _0x455e00=_0x0ec6[_0x362c03];return _0x455e00;};'use strict';var Sequelize=require(_0x60ec('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xdcfc=['sequelize','INTEGER'];(function(_0xee4f42,_0x420db6){var _0xbe5831=function(_0x4d4e12){while(--_0x4d4e12){_0xee4f42['push'](_0xee4f42['shift']());}};_0xbe5831(++_0x420db6);}(_0xdcfc,0x1a2));var _0xcdcf=function(_0x3fb4af,_0x53b099){_0x3fb4af=_0x3fb4af-0x0;var _0x4da5fb=_0xdcfc[_0x3fb4af];return _0x4da5fb;};'use strict';var Sequelize=require(_0xcdcf('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xcdcf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 7730cec..ad7a864 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.model.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf50b=['bluebird','request-promise','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','api','moment'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0xf50b,0xc8));var _0xbf50=function(_0x438812,_0x5a130){_0x438812=_0x438812-0x0;var _0x4fa76a=_0xf50b[_0x438812];return _0x4fa76a;};'use strict';var _=require(_0xbf50('0x0'));var util=require(_0xbf50('0x1'));var logger=require('../../config/logger')(_0xbf50('0x2'));var moment=require(_0xbf50('0x3'));var BPromise=require(_0xbf50('0x4'));var rp=require(_0xbf50('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf50('0x6'));var config=require('../../config/environment');var attributes=require(_0xbf50('0x7'));module[_0xbf50('0x8')]=function(_0x1ecb62,_0x117cc8){return _0x1ecb62[_0xbf50('0x9')](_0xbf50('0xa'),attributes,{'tableName':_0xbf50('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde50=['../../config/logger','api','moment','bluebird','path','../../config/environment','define','TeamVoiceQueue'];(function(_0x7c6e09,_0x3675e8){var _0x5f1199=function(_0x317a23){while(--_0x317a23){_0x7c6e09['push'](_0x7c6e09['shift']());}};_0x5f1199(++_0x3675e8);}(_0xde50,0x140));var _0x0de5=function(_0x269ac3,_0x2f4ca9){_0x269ac3=_0x269ac3-0x0;var _0x591a45=_0xde50[_0x269ac3];return _0x591a45;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0de5('0x0'))(_0x0de5('0x1'));var moment=require(_0x0de5('0x2'));var BPromise=require(_0x0de5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0de5('0x4'));var rimraf=require('rimraf');var config=require(_0x0de5('0x5'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x5f05a1,_0x444955){return _0x5f05a1[_0x0de5('0x6')](_0x0de5('0x7'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index ab364ed..5c848e2 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba6c=['request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x25e7de,_0x24b676){var _0x5cd6b8=function(_0x38526c){while(--_0x38526c){_0x25e7de['push'](_0x25e7de['shift']());}};_0x5cd6b8(++_0x24b676);}(_0xba6c,0x113));var _0xcba6=function(_0x43b487,_0x21893a){_0x43b487=_0x43b487-0x0;var _0x2f707a=_0xba6c[_0x43b487];return _0x2f707a;};'use strict';var _=require(_0xcba6('0x0'));var util=require('util');var moment=require(_0xcba6('0x1'));var BPromise=require(_0xcba6('0x2'));var rs=require(_0xcba6('0x3'));var fs=require('fs');var Redis=require(_0xcba6('0x4'));var db=require(_0xcba6('0x5'))['db'];var utils=require(_0xcba6('0x6'));var logger=require(_0xcba6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcba6('0x8'));var client=jayson[_0xcba6('0x9')][_0xcba6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x137300,_0x3302a4,_0x95c2f1){return new BPromise(function(_0x308366,_0x503869){return client[_0xcba6('0xb')](_0x137300,_0x95c2f1)[_0xcba6('0xc')](function(_0x391375){logger['info'](_0xcba6('0xd'),_0x3302a4,_0xcba6('0xe'));logger[_0xcba6('0xf')](_0xcba6('0x10'),_0x3302a4,'request\x20sent',JSON[_0xcba6('0x11')](_0x391375));if(_0x391375['error']){if(_0x391375[_0xcba6('0x12')][_0xcba6('0x13')]===0x1f4){logger['error'](_0xcba6('0xd'),_0x3302a4,_0x391375['error'][_0xcba6('0x14')]);return _0x503869(_0x391375['error']['message']);}logger['error'](_0xcba6('0xd'),_0x3302a4,_0x391375[_0xcba6('0x12')][_0xcba6('0x14')]);return _0x308366(_0x391375[_0xcba6('0x12')][_0xcba6('0x14')]);}else{logger['info'](_0xcba6('0xd'),_0x3302a4,'request\x20sent');_0x308366(_0x391375[_0xcba6('0x15')][_0xcba6('0x14')]);}})['catch'](function(_0xd80373){logger[_0xcba6('0x12')](_0xcba6('0xd'),_0x3302a4,_0xd80373);_0x503869(_0xd80373);});});} \ No newline at end of file +var _0xea12=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x53b571,_0x20ff2d){var _0x306fb9=function(_0xaec001){while(--_0xaec001){_0x53b571['push'](_0x53b571['shift']());}};_0x306fb9(++_0x20ff2d);}(_0xea12,0x149));var _0x2ea1=function(_0x216131,_0x21ebbd){_0x216131=_0x216131-0x0;var _0x1a12e6=_0xea12[_0x216131];return _0x1a12e6;};'use strict';var _=require(_0x2ea1('0x0'));var util=require(_0x2ea1('0x1'));var moment=require(_0x2ea1('0x2'));var BPromise=require(_0x2ea1('0x3'));var rs=require(_0x2ea1('0x4'));var fs=require('fs');var Redis=require(_0x2ea1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ea1('0x6'));var logger=require(_0x2ea1('0x7'))('rpc');var config=require(_0x2ea1('0x8'));var jayson=require(_0x2ea1('0x9'));var client=jayson[_0x2ea1('0xa')][_0x2ea1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e7ab2,_0x3177fd,_0x16b11e){return new BPromise(function(_0x5efe62,_0x19bfe4){return client['request'](_0x4e7ab2,_0x16b11e)[_0x2ea1('0xc')](function(_0x4016f3){logger[_0x2ea1('0xd')](_0x2ea1('0xe'),_0x3177fd,_0x2ea1('0xf'));logger['debug'](_0x2ea1('0x10'),_0x3177fd,_0x2ea1('0xf'),JSON['stringify'](_0x4016f3));if(_0x4016f3['error']){if(_0x4016f3[_0x2ea1('0x11')][_0x2ea1('0x12')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x3177fd,_0x4016f3[_0x2ea1('0x11')][_0x2ea1('0x13')]);return _0x19bfe4(_0x4016f3['error'][_0x2ea1('0x13')]);}logger[_0x2ea1('0x11')](_0x2ea1('0xe'),_0x3177fd,_0x4016f3[_0x2ea1('0x11')][_0x2ea1('0x13')]);return _0x5efe62(_0x4016f3[_0x2ea1('0x11')]['message']);}else{logger[_0x2ea1('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3177fd,'request\x20sent');_0x5efe62(_0x4016f3[_0x2ea1('0x14')][_0x2ea1('0x13')]);}})[_0x2ea1('0x15')](function(_0x3d5736){logger[_0x2ea1('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3177fd,_0x3d5736);_0x19bfe4(_0x3d5736);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 5074e9a..128a05a 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 _0xde46=['get','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x2f2fd1,_0x1d9b50){var _0x19e858=function(_0xb4fdef){while(--_0xb4fdef){_0x2f2fd1['push'](_0x2f2fd1['shift']());}};_0x19e858(++_0x1d9b50);}(_0xde46,0x14e));var _0x6de4=function(_0x34d5c6,_0x4516eb){_0x34d5c6=_0x34d5c6-0x0;var _0x5e3b54=_0xde46[_0x34d5c6];return _0x5e3b54;};'use strict';var multer=require(_0x6de4('0x0'));var util=require(_0x6de4('0x1'));var path=require(_0x6de4('0x2'));var timeout=require(_0x6de4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6de4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6de4('0x5'));var config=require(_0x6de4('0x6'));var controller=require(_0x6de4('0x7'));router[_0x6de4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6de4('0x8')]('/:id',auth[_0x6de4('0x9')](),controller[_0x6de4('0xa')]);router['post']('/',auth[_0x6de4('0x9')](),controller[_0x6de4('0xb')]);router[_0x6de4('0xc')](_0x6de4('0xd'),auth[_0x6de4('0x9')](),controller[_0x6de4('0xe')]);router[_0x6de4('0xf')](_0x6de4('0xd'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x10')]);module[_0x6de4('0x11')]=router; \ No newline at end of file +var _0x870d=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','create','put','update','destroy'];(function(_0x16d4b8,_0xfd3c2e){var _0x398e7a=function(_0x5b2216){while(--_0x5b2216){_0x16d4b8['push'](_0x16d4b8['shift']());}};_0x398e7a(++_0xfd3c2e);}(_0x870d,0xde));var _0xd870=function(_0x21e2c1,_0x5b5c4c){_0x21e2c1=_0x21e2c1-0x0;var _0x1c904a=_0x870d[_0x21e2c1];return _0x1c904a;};'use strict';var multer=require('multer');var util=require(_0xd870('0x0'));var path=require(_0xd870('0x1'));var timeout=require(_0xd870('0x2'));var express=require(_0xd870('0x3'));var router=express[_0xd870('0x4')]();var fs_extra=require(_0xd870('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd870('0x6'));var config=require(_0xd870('0x7'));var controller=require(_0xd870('0x8'));router[_0xd870('0x9')]('/',auth[_0xd870('0xa')](),controller['index']);router[_0xd870('0x9')](_0xd870('0xb'),auth[_0xd870('0xa')](),controller['show']);router['post']('/',auth[_0xd870('0xa')](),controller[_0xd870('0xc')]);router[_0xd870('0xd')](_0xd870('0xb'),auth[_0xd870('0xa')](),controller[_0xd870('0xe')]);router['delete']('/:id',auth[_0xd870('0xa')](),controller[_0xd870('0xf')]);module[_0xd870('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 0fd984d..6bbff03 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 _0xf173=['exports','STRING','sequelize'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xf173,0x134));var _0x3f17=function(_0x532968,_0x482a67){_0x532968=_0x532968-0x0;var _0x3d0c0a=_0xf173[_0x532968];return _0x3d0c0a;};'use strict';var Sequelize=require(_0x3f17('0x0'));module[_0x3f17('0x1')]={'name':{'type':Sequelize[_0x3f17('0x2')]},'description':{'type':Sequelize[_0x3f17('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xfd7d=['exports','TEXT'];(function(_0x2c6147,_0x30daee){var _0x4bdee8=function(_0x4f8ee3){while(--_0x4f8ee3){_0x2c6147['push'](_0x2c6147['shift']());}};_0x4bdee8(++_0x30daee);}(_0xfd7d,0xa8));var _0xdfd7=function(_0x50b66d,_0x11c61c){_0x50b66d=_0x50b66d-0x0;var _0x41aa8e=_0xfd7d[_0x50b66d];return _0x41aa8e;};'use strict';var Sequelize=require('sequelize');module[_0xdfd7('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xdfd7('0x1')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 2ee0909..b0eda7d 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 _0xa120=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','UserProfileResource','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','then','destroy','get','Templates','error','stack','name','index','map','rawAttributes','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','Template','keys','catch','create'];(function(_0x49c695,_0x2aaf15){var _0x5dba82=function(_0x1b7bac){while(--_0x1b7bac){_0x49c695['push'](_0x49c695['shift']());}};_0x5dba82(++_0x2aaf15);}(_0xa120,0xef));var _0x0a12=function(_0x10e8ed,_0x384a0d){_0x10e8ed=_0x10e8ed-0x0;var _0x4aea4a=_0xa120[_0x10e8ed];return _0x4aea4a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0a12('0x0'));var jsonpatch=require(_0x0a12('0x1'));var rp=require(_0x0a12('0x2'));var moment=require(_0x0a12('0x3'));var BPromise=require(_0x0a12('0x4'));var Mustache=require(_0x0a12('0x5'));var util=require(_0x0a12('0x6'));var path=require(_0x0a12('0x7'));var sox=require(_0x0a12('0x8'));var csv=require(_0x0a12('0x9'));var ejs=require(_0x0a12('0xa'));var fs=require('fs');var fs_extra=require(_0x0a12('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0a12('0x9'));var querystring=require(_0x0a12('0xc'));var Papa=require('papaparse');var Redis=require(_0x0a12('0xd'));var authService=require(_0x0a12('0xe'));var qs=require(_0x0a12('0xf'));var as=require(_0x0a12('0x10'));var hardwareService=require(_0x0a12('0x11'));var logger=require('../../config/logger')(_0x0a12('0x12'));var utils=require(_0x0a12('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0a12('0x14'))['db'];function respondWithStatusCode(_0x4d7398,_0x37d1e6){_0x37d1e6=_0x37d1e6||0xcc;return function(_0x5b78a){if(_0x5b78a){return _0x4d7398[_0x0a12('0x15')](_0x37d1e6);}return _0x4d7398['status'](_0x37d1e6)[_0x0a12('0x16')]();};}function respondWithResult(_0x47a73b,_0x22eae1){_0x22eae1=_0x22eae1||0xc8;return function(_0x42d25e){if(_0x42d25e){return _0x47a73b['status'](_0x22eae1)['json'](_0x42d25e);}};}function respondWithFilteredResult(_0x5bcb0a,_0x1b0fe2){return function(_0x5ebe56){if(_0x5ebe56){var _0x458c52=typeof _0x1b0fe2[_0x0a12('0x17')]===_0x0a12('0x18')&&typeof _0x1b0fe2[_0x0a12('0x19')]==='undefined';var _0x1fb20c=_0x5ebe56[_0x0a12('0x1a')];var _0x2278fc=_0x458c52?0x0:_0x1b0fe2[_0x0a12('0x17')];var _0x27b448=_0x458c52?_0x5ebe56[_0x0a12('0x1a')]:_0x1b0fe2[_0x0a12('0x17')]+_0x1b0fe2[_0x0a12('0x19')];var _0x491396;if(_0x27b448>=_0x1fb20c){_0x27b448=_0x1fb20c;_0x491396=0xc8;}else{_0x491396=0xce;}_0x5bcb0a[_0x0a12('0x1b')](_0x491396);return _0x5bcb0a[_0x0a12('0x1c')](_0x0a12('0x1d'),_0x2278fc+'-'+_0x27b448+'/'+_0x1fb20c)[_0x0a12('0x1e')](_0x5ebe56);}return null;};}function patchUpdates(_0x10c9bf){return function(_0x167471){try{jsonpatch[_0x0a12('0x1f')](_0x167471,_0x10c9bf,!![]);}catch(_0x4e9f1c){return BPromise[_0x0a12('0x20')](_0x4e9f1c);}return _0x167471['save']();};}function saveUpdates(_0x174463,_0x132ca3){return function(_0x19ba27){if(_0x19ba27){return _0x19ba27['update'](_0x174463)[_0x0a12('0x21')](function(_0x36aeb6){return _0x36aeb6;});}return null;};}function removeEntity(_0x655786,_0x3177b3){return function(_0x10888c){if(_0x10888c){return _0x10888c[_0x0a12('0x22')]()[_0x0a12('0x21')](function(){var _0x58ada6=_0x10888c[_0x0a12('0x23')]({'plain':!![]});var _0x361c62=_0x0a12('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x361c62,'resourceId':_0x58ada6['id']}})[_0x0a12('0x21')](function(){return _0x10888c;});})[_0x0a12('0x21')](function(){_0x655786[_0x0a12('0x1b')](0xcc)[_0x0a12('0x16')]();});}};}function handleEntityNotFound(_0x1484a7,_0x3d34c5){return function(_0x8d865b){if(!_0x8d865b){_0x1484a7['sendStatus'](0x194);}return _0x8d865b;};}function handleError(_0x330704,_0xd062b2){_0xd062b2=_0xd062b2||0x1f4;return function(_0x4ce36c){logger[_0x0a12('0x25')](_0x4ce36c[_0x0a12('0x26')]);if(_0x4ce36c['name']){delete _0x4ce36c[_0x0a12('0x27')];}_0x330704[_0x0a12('0x1b')](_0xd062b2)['send'](_0x4ce36c);};}exports[_0x0a12('0x28')]=function(_0x138e6c,_0xfabc54){var _0x19d49f={},_0x5b53e5={},_0x3a2892={'count':0x0,'rows':[]};var _0x38be16=_[_0x0a12('0x29')](db['Template'][_0x0a12('0x2a')],function(_0x1f9bb6){return{'name':_0x1f9bb6['fieldName'],'type':_0x1f9bb6[_0x0a12('0x2b')]['key']};});_0x5b53e5[_0x0a12('0x2c')]=_[_0x0a12('0x29')](_0x38be16,_0x0a12('0x27'));_0x5b53e5['query']=_['keys'](_0x138e6c['query']);_0x5b53e5[_0x0a12('0x2d')]=_[_0x0a12('0x2e')](_0x5b53e5[_0x0a12('0x2c')],_0x5b53e5[_0x0a12('0x2f')]);_0x19d49f[_0x0a12('0x30')]=_[_0x0a12('0x2e')](_0x5b53e5[_0x0a12('0x2c')],qs['fields'](_0x138e6c[_0x0a12('0x2f')][_0x0a12('0x31')]));_0x19d49f[_0x0a12('0x30')]=_0x19d49f[_0x0a12('0x30')][_0x0a12('0x32')]?_0x19d49f[_0x0a12('0x30')]:_0x5b53e5[_0x0a12('0x2c')];if(!_0x138e6c['query'][_0x0a12('0x33')](_0x0a12('0x34'))){_0x19d49f[_0x0a12('0x19')]=qs['limit'](_0x138e6c[_0x0a12('0x2f')][_0x0a12('0x19')]);_0x19d49f[_0x0a12('0x17')]=qs[_0x0a12('0x17')](_0x138e6c['query'][_0x0a12('0x17')]);}_0x19d49f[_0x0a12('0x35')]=qs[_0x0a12('0x36')](_0x138e6c[_0x0a12('0x2f')]['sort']);_0x19d49f['where']=qs[_0x0a12('0x2d')](_['pick'](_0x138e6c[_0x0a12('0x2f')],_0x5b53e5[_0x0a12('0x2d')]),_0x38be16);if(_0x138e6c[_0x0a12('0x2f')]['filter']){_0x19d49f[_0x0a12('0x37')]=_[_0x0a12('0x38')](_0x19d49f[_0x0a12('0x37')],{'$or':_[_0x0a12('0x29')](_0x38be16,function(_0x26c944){if(_0x26c944['type']!==_0x0a12('0x39')){var _0x2dab6b={};_0x2dab6b[_0x26c944['name']]={'$like':'%'+_0x138e6c['query'][_0x0a12('0x3a')]+'%'};return _0x2dab6b;}})});}_0x19d49f=_[_0x0a12('0x38')]({},_0x19d49f,_0x138e6c[_0x0a12('0x3b')]);var _0x55d4a5={'where':_0x19d49f[_0x0a12('0x37')]};return db['Template'][_0x0a12('0x1a')](_0x55d4a5)[_0x0a12('0x21')](function(_0x17908c){_0x3a2892[_0x0a12('0x1a')]=_0x17908c;if(_0x138e6c[_0x0a12('0x2f')]['includeAll']){_0x19d49f[_0x0a12('0x3c')]=[{'all':!![]}];}return db['Template'][_0x0a12('0x3d')](_0x19d49f);})['then'](function(_0x4dc2e8){_0x3a2892[_0x0a12('0x3e')]=_0x4dc2e8;return _0x3a2892;})['then'](respondWithFilteredResult(_0xfabc54,_0x19d49f))['catch'](handleError(_0xfabc54,null));};exports[_0x0a12('0x3f')]=function(_0x27a95e,_0x252def){var _0x2bd451={'raw':!![],'where':{'id':_0x27a95e[_0x0a12('0x40')]['id']}},_0x6b9204={};_0x6b9204[_0x0a12('0x2c')]=_['keys'](db[_0x0a12('0x41')][_0x0a12('0x2a')]);_0x6b9204[_0x0a12('0x2f')]=_[_0x0a12('0x42')](_0x27a95e[_0x0a12('0x2f')]);_0x6b9204[_0x0a12('0x2d')]=_[_0x0a12('0x2e')](_0x6b9204[_0x0a12('0x2c')],_0x6b9204['query']);_0x2bd451[_0x0a12('0x30')]=_[_0x0a12('0x2e')](_0x6b9204[_0x0a12('0x2c')],qs[_0x0a12('0x31')](_0x27a95e['query']['fields']));_0x2bd451[_0x0a12('0x30')]=_0x2bd451['attributes']['length']?_0x2bd451[_0x0a12('0x30')]:_0x6b9204[_0x0a12('0x2c')];if(_0x27a95e[_0x0a12('0x2f')]['includeAll']){_0x2bd451[_0x0a12('0x3c')]=[{'all':!![]}];}_0x2bd451=_[_0x0a12('0x38')]({},_0x2bd451,_0x27a95e[_0x0a12('0x3b')]);return db[_0x0a12('0x41')]['find'](_0x2bd451)[_0x0a12('0x21')](handleEntityNotFound(_0x252def,null))[_0x0a12('0x21')](respondWithResult(_0x252def,null))[_0x0a12('0x43')](handleError(_0x252def,null));};exports[_0x0a12('0x44')]=function(_0x1edb40,_0x2871c5){return db['Template'][_0x0a12('0x44')](_0x1edb40[_0x0a12('0x45')],{})[_0x0a12('0x21')](function(_0x138572){var _0x31ae40=_0x1edb40[_0x0a12('0x46')][_0x0a12('0x23')]({'plain':!![]});if(!_0x31ae40)throw new Error(_0x0a12('0x47'));if(_0x31ae40['role']==='user'){var _0x59eeb4=_0x138572[_0x0a12('0x23')]({'plain':!![]});var _0x14c948=_0x0a12('0x24');return db[_0x0a12('0x48')][_0x0a12('0x49')]({'where':{'name':_0x14c948,'userProfileId':_0x31ae40['userProfileId']},'raw':!![]})[_0x0a12('0x21')](function(_0x236857){if(_0x236857&&_0x236857[_0x0a12('0x4a')]===0x0){return db[_0x0a12('0x4b')]['create']({'name':_0x59eeb4[_0x0a12('0x27')],'resourceId':_0x59eeb4['id'],'type':_0x236857[_0x0a12('0x27')],'sectionId':_0x236857['id']},{})[_0x0a12('0x21')](function(){return _0x138572;});}else{return _0x138572;}})[_0x0a12('0x43')](function(_0x562de7){logger[_0x0a12('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x562de7);throw _0x562de7;});}return _0x138572;})[_0x0a12('0x21')](respondWithResult(_0x2871c5,0xc9))[_0x0a12('0x43')](handleError(_0x2871c5,null));};exports[_0x0a12('0x4c')]=function(_0x57da3a,_0x291899){if(_0x57da3a[_0x0a12('0x45')]['id']){delete _0x57da3a[_0x0a12('0x45')]['id'];}return db['Template'][_0x0a12('0x49')]({'where':{'id':_0x57da3a[_0x0a12('0x40')]['id']}})['then'](handleEntityNotFound(_0x291899,null))[_0x0a12('0x21')](saveUpdates(_0x57da3a[_0x0a12('0x45')],null))[_0x0a12('0x21')](respondWithResult(_0x291899,null))[_0x0a12('0x43')](handleError(_0x291899,null));};exports[_0x0a12('0x22')]=function(_0x22e736,_0x8c4022){return db[_0x0a12('0x41')][_0x0a12('0x49')]({'where':{'id':_0x22e736[_0x0a12('0x40')]['id']}})[_0x0a12('0x21')](handleEntityNotFound(_0x8c4022,null))['then'](removeEntity(_0x8c4022,null))['catch'](handleError(_0x8c4022,null));}; \ No newline at end of file +var _0xf804=['role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','map','Template','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','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x597eb2,_0x165f5c){var _0x56875f=function(_0x5de36e){while(--_0x5de36e){_0x597eb2['push'](_0x597eb2['shift']());}};_0x56875f(++_0x165f5c);}(_0xf804,0x1c3));var _0x4f80=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf804[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x4f80('0x0'));var rimraf=require(_0x4f80('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4f80('0x2'));var moment=require(_0x4f80('0x3'));var BPromise=require(_0x4f80('0x4'));var Mustache=require(_0x4f80('0x5'));var util=require(_0x4f80('0x6'));var path=require(_0x4f80('0x7'));var sox=require(_0x4f80('0x8'));var csv=require(_0x4f80('0x9'));var ejs=require(_0x4f80('0xa'));var fs=require('fs');var fs_extra=require(_0x4f80('0xb'));var _=require(_0x4f80('0xc'));var squel=require(_0x4f80('0xd'));var crypto=require(_0x4f80('0xe'));var jsforce=require(_0x4f80('0xf'));var deskjs=require(_0x4f80('0x10'));var toCsv=require(_0x4f80('0x9'));var querystring=require('querystring');var Papa=require(_0x4f80('0x11'));var Redis=require(_0x4f80('0x12'));var authService=require(_0x4f80('0x13'));var qs=require(_0x4f80('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f80('0x15'))('api');var utils=require(_0x4f80('0x16'));var config=require(_0x4f80('0x17'));var licenseUtil=require(_0x4f80('0x18'));var db=require(_0x4f80('0x19'))['db'];function respondWithStatusCode(_0x548e97,_0x26c041){_0x26c041=_0x26c041||0xcc;return function(_0x238820){if(_0x238820){return _0x548e97[_0x4f80('0x1a')](_0x26c041);}return _0x548e97[_0x4f80('0x1b')](_0x26c041)[_0x4f80('0x1c')]();};}function respondWithResult(_0x2d54f7,_0x41799a){_0x41799a=_0x41799a||0xc8;return function(_0x405cb6){if(_0x405cb6){return _0x2d54f7['status'](_0x41799a)[_0x4f80('0x1d')](_0x405cb6);}};}function respondWithFilteredResult(_0x15b911,_0x29ec78){return function(_0x447620){if(_0x447620){var _0x46951a=typeof _0x29ec78[_0x4f80('0x1e')]===_0x4f80('0x1f')&&typeof _0x29ec78[_0x4f80('0x20')]==='undefined';var _0x693109=_0x447620[_0x4f80('0x21')];var _0x1f36eb=_0x46951a?0x0:_0x29ec78[_0x4f80('0x1e')];var _0x3dd3b8=_0x46951a?_0x447620[_0x4f80('0x21')]:_0x29ec78[_0x4f80('0x1e')]+_0x29ec78[_0x4f80('0x20')];var _0x74ab5e;if(_0x3dd3b8>=_0x693109){_0x3dd3b8=_0x693109;_0x74ab5e=0xc8;}else{_0x74ab5e=0xce;}_0x15b911[_0x4f80('0x1b')](_0x74ab5e);return _0x15b911[_0x4f80('0x22')](_0x4f80('0x23'),_0x1f36eb+'-'+_0x3dd3b8+'/'+_0x693109)[_0x4f80('0x1d')](_0x447620);}return null;};}function patchUpdates(_0x3944a1){return function(_0x11c6c2){try{jsonpatch[_0x4f80('0x24')](_0x11c6c2,_0x3944a1,!![]);}catch(_0x351140){return BPromise['reject'](_0x351140);}return _0x11c6c2[_0x4f80('0x25')]();};}function saveUpdates(_0x4d0478,_0x31aaa2){return function(_0x5b3666){if(_0x5b3666){return _0x5b3666[_0x4f80('0x26')](_0x4d0478)[_0x4f80('0x27')](function(_0x58caf0){return _0x58caf0;});}return null;};}function removeEntity(_0x13ea5b,_0x505ecc){return function(_0x2161a3){if(_0x2161a3){return _0x2161a3[_0x4f80('0x28')]()[_0x4f80('0x27')](function(){var _0x5b0b30=_0x2161a3[_0x4f80('0x29')]({'plain':!![]});var _0x195554=_0x4f80('0x2a');return db[_0x4f80('0x2b')][_0x4f80('0x28')]({'where':{'type':_0x195554,'resourceId':_0x5b0b30['id']}})[_0x4f80('0x27')](function(){return _0x2161a3;});})[_0x4f80('0x27')](function(){_0x13ea5b[_0x4f80('0x1b')](0xcc)[_0x4f80('0x1c')]();});}};}function handleEntityNotFound(_0x459cbf,_0x306a6d){return function(_0x45664c){if(!_0x45664c){_0x459cbf[_0x4f80('0x1a')](0x194);}return _0x45664c;};}function handleError(_0x5d4900,_0xc2688b){_0xc2688b=_0xc2688b||0x1f4;return function(_0x550e98){logger[_0x4f80('0x2c')](_0x550e98[_0x4f80('0x2d')]);if(_0x550e98['name']){delete _0x550e98[_0x4f80('0x2e')];}_0x5d4900[_0x4f80('0x1b')](_0xc2688b)[_0x4f80('0x2f')](_0x550e98);};}exports[_0x4f80('0x30')]=function(_0x49ddd7,_0xf96592){var _0x33599f={},_0x942467={},_0x19243b={'count':0x0,'rows':[]};var _0x5551d4=_[_0x4f80('0x31')](db[_0x4f80('0x32')][_0x4f80('0x33')],function(_0x4d2c81){return{'name':_0x4d2c81[_0x4f80('0x34')],'type':_0x4d2c81[_0x4f80('0x35')][_0x4f80('0x36')]};});_0x942467[_0x4f80('0x37')]=_[_0x4f80('0x31')](_0x5551d4,'name');_0x942467[_0x4f80('0x38')]=_[_0x4f80('0x39')](_0x49ddd7[_0x4f80('0x38')]);_0x942467[_0x4f80('0x3a')]=_[_0x4f80('0x3b')](_0x942467[_0x4f80('0x37')],_0x942467[_0x4f80('0x38')]);_0x33599f[_0x4f80('0x3c')]=_['intersection'](_0x942467[_0x4f80('0x37')],qs[_0x4f80('0x3d')](_0x49ddd7[_0x4f80('0x38')]['fields']));_0x33599f[_0x4f80('0x3c')]=_0x33599f[_0x4f80('0x3c')][_0x4f80('0x3e')]?_0x33599f[_0x4f80('0x3c')]:_0x942467[_0x4f80('0x37')];if(!_0x49ddd7['query'][_0x4f80('0x3f')](_0x4f80('0x40'))){_0x33599f[_0x4f80('0x20')]=qs[_0x4f80('0x20')](_0x49ddd7[_0x4f80('0x38')][_0x4f80('0x20')]);_0x33599f[_0x4f80('0x1e')]=qs[_0x4f80('0x1e')](_0x49ddd7[_0x4f80('0x38')]['offset']);}_0x33599f[_0x4f80('0x41')]=qs[_0x4f80('0x42')](_0x49ddd7[_0x4f80('0x38')][_0x4f80('0x42')]);_0x33599f[_0x4f80('0x43')]=qs[_0x4f80('0x3a')](_[_0x4f80('0x44')](_0x49ddd7[_0x4f80('0x38')],_0x942467[_0x4f80('0x3a')]),_0x5551d4);if(_0x49ddd7[_0x4f80('0x38')][_0x4f80('0x45')]){_0x33599f[_0x4f80('0x43')]=_[_0x4f80('0x46')](_0x33599f[_0x4f80('0x43')],{'$or':_[_0x4f80('0x31')](_0x5551d4,function(_0x3066f1){if(_0x3066f1[_0x4f80('0x35')]!==_0x4f80('0x47')){var _0x45c829={};_0x45c829[_0x3066f1[_0x4f80('0x2e')]]={'$like':'%'+_0x49ddd7[_0x4f80('0x38')][_0x4f80('0x45')]+'%'};return _0x45c829;}})});}_0x33599f=_['merge']({},_0x33599f,_0x49ddd7[_0x4f80('0x48')]);var _0x52b842={'where':_0x33599f[_0x4f80('0x43')]};return db[_0x4f80('0x32')][_0x4f80('0x21')](_0x52b842)[_0x4f80('0x27')](function(_0x24ccfa){_0x19243b[_0x4f80('0x21')]=_0x24ccfa;if(_0x49ddd7[_0x4f80('0x38')][_0x4f80('0x49')]){_0x33599f[_0x4f80('0x4a')]=[{'all':!![]}];}return db[_0x4f80('0x32')][_0x4f80('0x4b')](_0x33599f);})['then'](function(_0x330134){_0x19243b['rows']=_0x330134;return _0x19243b;})[_0x4f80('0x27')](respondWithFilteredResult(_0xf96592,_0x33599f))[_0x4f80('0x4c')](handleError(_0xf96592,null));};exports[_0x4f80('0x4d')]=function(_0x1e28d3,_0x55c35b){var _0x182457={'raw':!![],'where':{'id':_0x1e28d3[_0x4f80('0x4e')]['id']}},_0x2d46ae={};_0x2d46ae[_0x4f80('0x37')]=_['keys'](db[_0x4f80('0x32')]['rawAttributes']);_0x2d46ae[_0x4f80('0x38')]=_[_0x4f80('0x39')](_0x1e28d3[_0x4f80('0x38')]);_0x2d46ae[_0x4f80('0x3a')]=_[_0x4f80('0x3b')](_0x2d46ae[_0x4f80('0x37')],_0x2d46ae[_0x4f80('0x38')]);_0x182457[_0x4f80('0x3c')]=_['intersection'](_0x2d46ae[_0x4f80('0x37')],qs[_0x4f80('0x3d')](_0x1e28d3['query']['fields']));_0x182457[_0x4f80('0x3c')]=_0x182457[_0x4f80('0x3c')][_0x4f80('0x3e')]?_0x182457[_0x4f80('0x3c')]:_0x2d46ae[_0x4f80('0x37')];if(_0x1e28d3['query']['includeAll']){_0x182457[_0x4f80('0x4a')]=[{'all':!![]}];}_0x182457=_[_0x4f80('0x46')]({},_0x182457,_0x1e28d3[_0x4f80('0x48')]);return db[_0x4f80('0x32')][_0x4f80('0x4f')](_0x182457)[_0x4f80('0x27')](handleEntityNotFound(_0x55c35b,null))[_0x4f80('0x27')](respondWithResult(_0x55c35b,null))['catch'](handleError(_0x55c35b,null));};exports[_0x4f80('0x50')]=function(_0x456510,_0x5518b4){return db[_0x4f80('0x32')][_0x4f80('0x50')](_0x456510[_0x4f80('0x51')],{})[_0x4f80('0x27')](function(_0x52afad){var _0x491e56=_0x456510['user'][_0x4f80('0x29')]({'plain':!![]});if(!_0x491e56)throw new Error(_0x4f80('0x52'));if(_0x491e56[_0x4f80('0x53')]===_0x4f80('0x54')){var _0x48f6bc=_0x52afad['get']({'plain':!![]});var _0x50c307=_0x4f80('0x2a');return db[_0x4f80('0x55')][_0x4f80('0x4f')]({'where':{'name':_0x50c307,'userProfileId':_0x491e56[_0x4f80('0x56')]},'raw':!![]})[_0x4f80('0x27')](function(_0x42fc73){if(_0x42fc73&&_0x42fc73[_0x4f80('0x57')]===0x0){return db[_0x4f80('0x2b')][_0x4f80('0x50')]({'name':_0x48f6bc[_0x4f80('0x2e')],'resourceId':_0x48f6bc['id'],'type':_0x42fc73[_0x4f80('0x2e')],'sectionId':_0x42fc73['id']},{})['then'](function(){return _0x52afad;});}else{return _0x52afad;}})[_0x4f80('0x4c')](function(_0x328d4d){logger['error'](_0x4f80('0x58'),_0x328d4d);throw _0x328d4d;});}return _0x52afad;})[_0x4f80('0x27')](respondWithResult(_0x5518b4,0xc9))[_0x4f80('0x4c')](handleError(_0x5518b4,null));};exports['update']=function(_0x560d64,_0x5a23f5){if(_0x560d64[_0x4f80('0x51')]['id']){delete _0x560d64['body']['id'];}return db[_0x4f80('0x32')][_0x4f80('0x4f')]({'where':{'id':_0x560d64[_0x4f80('0x4e')]['id']}})[_0x4f80('0x27')](handleEntityNotFound(_0x5a23f5,null))[_0x4f80('0x27')](saveUpdates(_0x560d64[_0x4f80('0x51')],null))[_0x4f80('0x27')](respondWithResult(_0x5a23f5,null))[_0x4f80('0x4c')](handleError(_0x5a23f5,null));};exports['destroy']=function(_0x1ec382,_0x11e5d3){return db['Template'][_0x4f80('0x4f')]({'where':{'id':_0x1ec382[_0x4f80('0x4e')]['id']}})['then'](handleEntityNotFound(_0x11e5d3,null))[_0x4f80('0x27')](removeEntity(_0x11e5d3,null))[_0x4f80('0x4c')](handleError(_0x11e5d3,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 0b0adc5..a9c4cd4 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 _0x3686=['api','bluebird','rimraf','../../config/environment','./template.attributes','define','lodash','util','../../config/logger'];(function(_0x42671f,_0xf77fc3){var _0x35aa20=function(_0x1d3744){while(--_0x1d3744){_0x42671f['push'](_0x42671f['shift']());}};_0x35aa20(++_0xf77fc3);}(_0x3686,0x1bf));var _0x6368=function(_0x189ad4,_0x23f2b1){_0x189ad4=_0x189ad4-0x0;var _0x23bcb3=_0x3686[_0x189ad4];return _0x23bcb3;};'use strict';var _=require(_0x6368('0x0'));var util=require(_0x6368('0x1'));var logger=require(_0x6368('0x2'))(_0x6368('0x3'));var moment=require('moment');var BPromise=require(_0x6368('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6368('0x5'));var config=require(_0x6368('0x6'));var attributes=require(_0x6368('0x7'));module['exports']=function(_0xacd82a,_0x2c82a2){return _0xacd82a[_0x6368('0x8')]('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59b7=['request-promise','rimraf','../../config/environment','./template.attributes','Template','tools_templates','lodash','util','../../config/logger','bluebird'];(function(_0x495d7e,_0x6d8eba){var _0x19e320=function(_0x5bdb04){while(--_0x5bdb04){_0x495d7e['push'](_0x495d7e['shift']());}};_0x19e320(++_0x6d8eba);}(_0x59b7,0xa6));var _0x759b=function(_0x364792,_0x3ef5a5){_0x364792=_0x364792-0x0;var _0x4c6b93=_0x59b7[_0x364792];return _0x4c6b93;};'use strict';var _=require(_0x759b('0x0'));var util=require(_0x759b('0x1'));var logger=require(_0x759b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x759b('0x3'));var rp=require(_0x759b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x759b('0x5'));var config=require(_0x759b('0x6'));var attributes=require(_0x759b('0x7'));module['exports']=function(_0x58bf4a,_0x3582d9){return _0x58bf4a['define'](_0x759b('0x8'),attributes,{'tableName':_0x759b('0x9'),'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 b5b4d04..3719786 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 _0xeaa7=['../../mysqldb','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetTemplate','Template','findAll','options','where','limit','map','include','model','attributes','util','moment','bluebird','randomstring','ioredis'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xeaa7,0x13a));var _0x7eaa=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xeaa7[_0x1eda20];return _0x31b953;};'use strict';var _=require('lodash');var util=require(_0x7eaa('0x0'));var moment=require(_0x7eaa('0x1'));var BPromise=require(_0x7eaa('0x2'));var rs=require(_0x7eaa('0x3'));var fs=require('fs');var Redis=require(_0x7eaa('0x4'));var db=require(_0x7eaa('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7eaa('0x6'));var client=jayson[_0x7eaa('0x7')][_0x7eaa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7a8fc5,_0x2ed81e,_0x5b4717){return new BPromise(function(_0x303376,_0x2b0a68){return client[_0x7eaa('0x9')](_0x7a8fc5,_0x5b4717)[_0x7eaa('0xa')](function(_0x366e45){logger[_0x7eaa('0xb')](_0x7eaa('0xc'),_0x2ed81e,_0x7eaa('0xd'));logger[_0x7eaa('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x2ed81e,_0x7eaa('0xd'),JSON['stringify'](_0x366e45));if(_0x366e45['error']){if(_0x366e45['error']['code']===0x1f4){logger[_0x7eaa('0xf')](_0x7eaa('0xc'),_0x2ed81e,_0x366e45[_0x7eaa('0xf')][_0x7eaa('0x10')]);return _0x2b0a68(_0x366e45[_0x7eaa('0xf')][_0x7eaa('0x10')]);}logger[_0x7eaa('0xf')]('Template,\x20%s,\x20%s',_0x2ed81e,_0x366e45['error'][_0x7eaa('0x10')]);return _0x303376(_0x366e45[_0x7eaa('0xf')][_0x7eaa('0x10')]);}else{logger[_0x7eaa('0xb')](_0x7eaa('0xc'),_0x2ed81e,'request\x20sent');_0x303376(_0x366e45[_0x7eaa('0x11')][_0x7eaa('0x10')]);}})[_0x7eaa('0x12')](function(_0x11e054){logger[_0x7eaa('0xf')]('Template,\x20%s,\x20%s',_0x2ed81e,_0x11e054);_0x2b0a68(_0x11e054);});});}exports[_0x7eaa('0x13')]=function(_0x5da9e5){var _0x243305=this;return new Promise(function(_0x1399b9,_0xe3b943){return db[_0x7eaa('0x14')][_0x7eaa('0x15')]({'raw':_0x5da9e5[_0x7eaa('0x16')]?_0x5da9e5[_0x7eaa('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5da9e5[_0x7eaa('0x16')]?_0x5da9e5[_0x7eaa('0x16')][_0x7eaa('0x17')]||null:null,'attributes':_0x5da9e5[_0x7eaa('0x16')]?_0x5da9e5[_0x7eaa('0x16')]['attributes']||null:null,'limit':_0x5da9e5[_0x7eaa('0x16')]?_0x5da9e5[_0x7eaa('0x16')][_0x7eaa('0x18')]||null:null,'include':_0x5da9e5['options']?_0x5da9e5[_0x7eaa('0x16')]['include']?_[_0x7eaa('0x19')](_0x5da9e5[_0x7eaa('0x16')][_0x7eaa('0x1a')],function(_0x1f15bc){return{'model':db[_0x1f15bc[_0x7eaa('0x1b')]],'as':_0x1f15bc['as'],'attributes':_0x1f15bc[_0x7eaa('0x1c')],'include':_0x1f15bc['include']?_[_0x7eaa('0x19')](_0x1f15bc[_0x7eaa('0x1a')],function(_0xd89117){return{'model':db[_0xd89117[_0x7eaa('0x1b')]],'as':_0xd89117['as'],'attributes':_0xd89117[_0x7eaa('0x1c')],'include':_0xd89117['include']?_['map'](_0xd89117['include'],function(_0x41ba23){return{'model':db[_0x41ba23[_0x7eaa('0x1b')]],'as':_0x41ba23['as'],'attributes':_0x41ba23['attributes']};}):[]};}):[]};}):[]:[]})[_0x7eaa('0xa')](function(_0x3b4546){logger[_0x7eaa('0xb')](_0x7eaa('0x13'),_0x5da9e5);logger[_0x7eaa('0xe')](_0x7eaa('0x13'),_0x5da9e5,JSON['stringify'](_0x3b4546));_0x1399b9(_0x3b4546);})[_0x7eaa('0x12')](function(_0x473d64){logger['error'](_0x7eaa('0x13'),_0x473d64[_0x7eaa('0x10')],_0x5da9e5);_0xe3b943(_0x243305[_0x7eaa('0xf')](0x1f4,_0x473d64[_0x7eaa('0x10')]));});});}; \ No newline at end of file +var _0xa24a=['error','code','message','result','catch','GetTemplate','Template','findAll','options','where','attributes','limit','include','model','map','lodash','bluebird','randomstring','ioredis','../../config/utils','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'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xa24a,0x159));var _0xaa24=function(_0x35a164,_0x79ab5c){_0x35a164=_0x35a164-0x0;var _0x324c72=_0xa24a[_0x35a164];return _0x324c72;};'use strict';var _=require(_0xaa24('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaa24('0x1'));var rs=require(_0xaa24('0x2'));var fs=require('fs');var Redis=require(_0xaa24('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa24('0x4'));var logger=require('../../config/logger')(_0xaa24('0x5'));var config=require(_0xaa24('0x6'));var jayson=require(_0xaa24('0x7'));var client=jayson[_0xaa24('0x8')][_0xaa24('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30252b,_0x401df7,_0x5e99ef){return new BPromise(function(_0x137329,_0xbd51ed){return client[_0xaa24('0xa')](_0x30252b,_0x5e99ef)[_0xaa24('0xb')](function(_0x21a642){logger[_0xaa24('0xc')](_0xaa24('0xd'),_0x401df7,'request\x20sent');logger[_0xaa24('0xe')](_0xaa24('0xf'),_0x401df7,_0xaa24('0x10'),JSON[_0xaa24('0x11')](_0x21a642));if(_0x21a642[_0xaa24('0x12')]){if(_0x21a642[_0xaa24('0x12')][_0xaa24('0x13')]===0x1f4){logger['error'](_0xaa24('0xd'),_0x401df7,_0x21a642['error'][_0xaa24('0x14')]);return _0xbd51ed(_0x21a642[_0xaa24('0x12')][_0xaa24('0x14')]);}logger['error']('Template,\x20%s,\x20%s',_0x401df7,_0x21a642[_0xaa24('0x12')][_0xaa24('0x14')]);return _0x137329(_0x21a642[_0xaa24('0x12')]['message']);}else{logger[_0xaa24('0xc')](_0xaa24('0xd'),_0x401df7,_0xaa24('0x10'));_0x137329(_0x21a642[_0xaa24('0x15')][_0xaa24('0x14')]);}})[_0xaa24('0x16')](function(_0x48d886){logger[_0xaa24('0x12')]('Template,\x20%s,\x20%s',_0x401df7,_0x48d886);_0xbd51ed(_0x48d886);});});}exports[_0xaa24('0x17')]=function(_0x1d12ed){var _0x5ced63=this;return new Promise(function(_0x5622bb,_0x164ce9){return db[_0xaa24('0x18')][_0xaa24('0x19')]({'raw':_0x1d12ed[_0xaa24('0x1a')]?_0x1d12ed[_0xaa24('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1d12ed[_0xaa24('0x1a')]?_0x1d12ed['options'][_0xaa24('0x1b')]||null:null,'attributes':_0x1d12ed[_0xaa24('0x1a')]?_0x1d12ed[_0xaa24('0x1a')][_0xaa24('0x1c')]||null:null,'limit':_0x1d12ed['options']?_0x1d12ed['options'][_0xaa24('0x1d')]||null:null,'include':_0x1d12ed['options']?_0x1d12ed[_0xaa24('0x1a')][_0xaa24('0x1e')]?_['map'](_0x1d12ed[_0xaa24('0x1a')][_0xaa24('0x1e')],function(_0x5786b4){return{'model':db[_0x5786b4[_0xaa24('0x1f')]],'as':_0x5786b4['as'],'attributes':_0x5786b4['attributes'],'include':_0x5786b4[_0xaa24('0x1e')]?_[_0xaa24('0x20')](_0x5786b4[_0xaa24('0x1e')],function(_0x5c445c){return{'model':db[_0x5c445c[_0xaa24('0x1f')]],'as':_0x5c445c['as'],'attributes':_0x5c445c[_0xaa24('0x1c')],'include':_0x5c445c['include']?_[_0xaa24('0x20')](_0x5c445c['include'],function(_0xf2b63e){return{'model':db[_0xf2b63e[_0xaa24('0x1f')]],'as':_0xf2b63e['as'],'attributes':_0xf2b63e[_0xaa24('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaa24('0xb')](function(_0x13d67d){logger[_0xaa24('0xc')]('GetTemplate',_0x1d12ed);logger[_0xaa24('0xe')](_0xaa24('0x17'),_0x1d12ed,JSON[_0xaa24('0x11')](_0x13d67d));_0x5622bb(_0x13d67d);})['catch'](function(_0x1bedd1){logger[_0xaa24('0x12')](_0xaa24('0x17'),_0x1bedd1[_0xaa24('0x14')],_0x1d12ed);_0x164ce9(_0x5ced63[_0xaa24('0x12')](0x1f4,_0x1bedd1['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 39d6ffa..ac81744 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 _0x882c=['put','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','post','create','addAnyCondition'];(function(_0x1f0f68,_0x226d75){var _0x5a0bbe=function(_0xe479f4){while(--_0xe479f4){_0x1f0f68['push'](_0x1f0f68['shift']());}};_0x5a0bbe(++_0x226d75);}(_0x882c,0x6c));var _0xc882=function(_0x22c393,_0x1f2389){_0x22c393=_0x22c393-0x0;var _0x161580=_0x882c[_0x22c393];return _0x161580;};'use strict';var multer=require(_0xc882('0x0'));var util=require(_0xc882('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc882('0x2'));var router=express['Router']();var fs_extra=require(_0xc882('0x3'));var auth=require(_0xc882('0x4'));var interaction=require(_0xc882('0x5'));var config=require(_0xc882('0x6'));var controller=require('./trigger.controller');router[_0xc882('0x7')]('/',auth[_0xc882('0x8')](),controller['index']);router[_0xc882('0x7')](_0xc882('0x9'),auth[_0xc882('0x8')](),controller['show']);router['get'](_0xc882('0xa'),auth[_0xc882('0x8')](),controller[_0xc882('0xb')]);router['get']('/:id/any_conditions',auth[_0xc882('0x8')](),controller[_0xc882('0xc')]);router[_0xc882('0x7')](_0xc882('0xd'),auth['isAuthenticated'](),controller[_0xc882('0xe')]);router[_0xc882('0xf')]('/',auth[_0xc882('0x8')](),controller[_0xc882('0x10')]);router[_0xc882('0xf')](_0xc882('0xa'),auth[_0xc882('0x8')](),controller['addAllCondition']);router[_0xc882('0xf')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xc882('0x11')]);router['post'](_0xc882('0xd'),auth[_0xc882('0x8')](),controller['addAction']);router[_0xc882('0x12')](_0xc882('0x9'),auth[_0xc882('0x8')](),controller['update']);router[_0xc882('0x13')](_0xc882('0x9'),auth['isAuthenticated'](),controller[_0xc882('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb248=['destroy','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','addAllCondition','post','addAction','put','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb248,0x1b9));var _0x8b24=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xb248[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require(_0x8b24('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8b24('0x1'));var router=express[_0x8b24('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8b24('0x3'));var interaction=require(_0x8b24('0x4'));var config=require(_0x8b24('0x5'));var controller=require(_0x8b24('0x6'));router[_0x8b24('0x7')]('/',auth[_0x8b24('0x8')](),controller['index']);router[_0x8b24('0x7')](_0x8b24('0x9'),auth[_0x8b24('0x8')](),controller[_0x8b24('0xa')]);router[_0x8b24('0x7')](_0x8b24('0xb'),auth[_0x8b24('0x8')](),controller[_0x8b24('0xc')]);router['get'](_0x8b24('0xd'),auth[_0x8b24('0x8')](),controller['getAnyConditions']);router[_0x8b24('0x7')](_0x8b24('0xe'),auth[_0x8b24('0x8')](),controller[_0x8b24('0xf')]);router['post']('/',auth[_0x8b24('0x8')](),controller['create']);router['post'](_0x8b24('0xb'),auth[_0x8b24('0x8')](),controller[_0x8b24('0x10')]);router[_0x8b24('0x11')](_0x8b24('0xd'),auth['isAuthenticated'](),controller['addAnyCondition']);router[_0x8b24('0x11')]('/:id/actions',auth[_0x8b24('0x8')](),controller[_0x8b24('0x12')]);router[_0x8b24('0x13')](_0x8b24('0x9'),auth[_0x8b24('0x8')](),controller['update']);router[_0x8b24('0x14')](_0x8b24('0x9'),auth['isAuthenticated'](),controller[_0x8b24('0x15')]);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 5e6bb65..f2ac6a6 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 _0xb291=['exports','STRING','BOOLEAN'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb291,0x189));var _0x1b29=function(_0x2a3fe6,_0x42b1ab){_0x2a3fe6=_0x2a3fe6-0x0;var _0x5210e2=_0xb291[_0x2a3fe6];return _0x5210e2;};'use strict';var Sequelize=require('sequelize');module[_0x1b29('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1b29('0x1')]},'description':{'type':Sequelize[_0x1b29('0x1')]},'status':{'type':Sequelize[_0x1b29('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x9035=['STRING','BOOLEAN','sequelize','exports'];(function(_0x5cc26d,_0x3386c9){var _0x179a01=function(_0x3eec0f){while(--_0x3eec0f){_0x5cc26d['push'](_0x5cc26d['shift']());}};_0x179a01(++_0x3386c9);}(_0x9035,0xee));var _0x5903=function(_0x3c2ee6,_0x5ea99a){_0x3c2ee6=_0x3c2ee6-0x0;var _0x51227c=_0x9035[_0x3c2ee6];return _0x51227c;};'use strict';var Sequelize=require(_0x5903('0x0'));module[_0x5903('0x1')]={'name':{'type':Sequelize[_0x5903('0x2')]},'channel':{'type':Sequelize[_0x5903('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x5903('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index eb29d68..bb8703c 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 _0x436e=['Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','rawAttributes','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','undefined','offset','count','set','Content-Range','save','update','then','Triggers','UserProfileResource','destroy','error','stack','name','send','index','map','Trigger','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','addAllCondition','TriggerAllId'];(function(_0x153099,_0x24cc13){var _0x4a8c61=function(_0x15f5fd){while(--_0x15f5fd){_0x153099['push'](_0x153099['shift']());}};_0x4a8c61(++_0x24cc13);}(_0x436e,0x1e5));var _0xe436=function(_0x555d2d,_0x2509b4){_0x555d2d=_0x555d2d-0x0;var _0x2697a9=_0x436e[_0x555d2d];return _0x2697a9;};'use strict';var emlformat=require(_0xe436('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe436('0x1'));var jsonpatch=require(_0xe436('0x2'));var rp=require(_0xe436('0x3'));var moment=require(_0xe436('0x4'));var BPromise=require(_0xe436('0x5'));var Mustache=require('mustache');var util=require(_0xe436('0x6'));var path=require(_0xe436('0x7'));var sox=require(_0xe436('0x8'));var csv=require(_0xe436('0x9'));var ejs=require(_0xe436('0xa'));var fs=require('fs');var fs_extra=require(_0xe436('0xb'));var _=require(_0xe436('0xc'));var squel=require(_0xe436('0xd'));var crypto=require('crypto');var jsforce=require(_0xe436('0xe'));var deskjs=require(_0xe436('0xf'));var toCsv=require(_0xe436('0x9'));var querystring=require('querystring');var Papa=require(_0xe436('0x10'));var Redis=require(_0xe436('0x11'));var authService=require(_0xe436('0x12'));var qs=require(_0xe436('0x13'));var as=require(_0xe436('0x14'));var hardwareService=require(_0xe436('0x15'));var logger=require(_0xe436('0x16'))(_0xe436('0x17'));var utils=require(_0xe436('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43c533,_0x2c4759){_0x2c4759=_0x2c4759||0xcc;return function(_0x53e100){if(_0x53e100){return _0x43c533['sendStatus'](_0x2c4759);}return _0x43c533[_0xe436('0x19')](_0x2c4759)[_0xe436('0x1a')]();};}function respondWithResult(_0x1fd314,_0x30ba77){_0x30ba77=_0x30ba77||0xc8;return function(_0x26aaf2){if(_0x26aaf2){return _0x1fd314[_0xe436('0x19')](_0x30ba77)[_0xe436('0x1b')](_0x26aaf2);}};}function respondWithFilteredResult(_0x53e7e9,_0x14a1ca){return function(_0x213296){if(_0x213296){var _0x44c75c=typeof _0x14a1ca['offset']===_0xe436('0x1c')&&typeof _0x14a1ca['limit']==='undefined';var _0x46f731=_0x213296['count'];var _0x42e704=_0x44c75c?0x0:_0x14a1ca[_0xe436('0x1d')];var _0x5166df=_0x44c75c?_0x213296[_0xe436('0x1e')]:_0x14a1ca[_0xe436('0x1d')]+_0x14a1ca['limit'];var _0x2d1e46;if(_0x5166df>=_0x46f731){_0x5166df=_0x46f731;_0x2d1e46=0xc8;}else{_0x2d1e46=0xce;}_0x53e7e9[_0xe436('0x19')](_0x2d1e46);return _0x53e7e9[_0xe436('0x1f')](_0xe436('0x20'),_0x42e704+'-'+_0x5166df+'/'+_0x46f731)[_0xe436('0x1b')](_0x213296);}return null;};}function patchUpdates(_0x462c33){return function(_0x132e96){try{jsonpatch['apply'](_0x132e96,_0x462c33,!![]);}catch(_0x57d78c){return BPromise['reject'](_0x57d78c);}return _0x132e96[_0xe436('0x21')]();};}function saveUpdates(_0x7771be,_0x2c4af3){return function(_0x133d13){if(_0x133d13){return _0x133d13[_0xe436('0x22')](_0x7771be)[_0xe436('0x23')](function(_0x9c9042){return _0x9c9042;});}return null;};}function removeEntity(_0x468d54,_0x4edfc3){return function(_0x260bb8){if(_0x260bb8){return _0x260bb8['destroy']()[_0xe436('0x23')](function(){var _0x1bd997=_0x260bb8['get']({'plain':!![]});var _0x1e7ce9=_0xe436('0x24');return db[_0xe436('0x25')][_0xe436('0x26')]({'where':{'type':_0x1e7ce9,'resourceId':_0x1bd997['id']}})[_0xe436('0x23')](function(){return _0x260bb8;});})[_0xe436('0x23')](function(){_0x468d54[_0xe436('0x19')](0xcc)[_0xe436('0x1a')]();});}};}function handleEntityNotFound(_0x105f5d,_0x109608){return function(_0x573127){if(!_0x573127){_0x105f5d['sendStatus'](0x194);}return _0x573127;};}function handleError(_0x15ca31,_0x4fa70e){_0x4fa70e=_0x4fa70e||0x1f4;return function(_0x484ffe){logger[_0xe436('0x27')](_0x484ffe[_0xe436('0x28')]);if(_0x484ffe['name']){delete _0x484ffe[_0xe436('0x29')];}_0x15ca31[_0xe436('0x19')](_0x4fa70e)[_0xe436('0x2a')](_0x484ffe);};}exports[_0xe436('0x2b')]=function(_0x14e255,_0xf13fe9){var _0x3643fc={},_0x54ab96={},_0x4052a5={'count':0x0,'rows':[]};var _0x236325=_[_0xe436('0x2c')](db[_0xe436('0x2d')]['rawAttributes'],function(_0x10157a){return{'name':_0x10157a[_0xe436('0x2e')],'type':_0x10157a[_0xe436('0x2f')][_0xe436('0x30')]};});_0x54ab96[_0xe436('0x31')]=_['map'](_0x236325,'name');_0x54ab96[_0xe436('0x32')]=_[_0xe436('0x33')](_0x14e255[_0xe436('0x32')]);_0x54ab96['filters']=_[_0xe436('0x34')](_0x54ab96[_0xe436('0x31')],_0x54ab96['query']);_0x3643fc[_0xe436('0x35')]=_[_0xe436('0x34')](_0x54ab96[_0xe436('0x31')],qs[_0xe436('0x36')](_0x14e255['query'][_0xe436('0x36')]));_0x3643fc[_0xe436('0x35')]=_0x3643fc['attributes']['length']?_0x3643fc[_0xe436('0x35')]:_0x54ab96['model'];if(!_0x14e255[_0xe436('0x32')][_0xe436('0x37')](_0xe436('0x38'))){_0x3643fc['limit']=qs[_0xe436('0x39')](_0x14e255[_0xe436('0x32')]['limit']);_0x3643fc['offset']=qs[_0xe436('0x1d')](_0x14e255['query'][_0xe436('0x1d')]);}_0x3643fc[_0xe436('0x3a')]=qs[_0xe436('0x3b')](_0x14e255[_0xe436('0x32')][_0xe436('0x3b')]);_0x3643fc[_0xe436('0x3c')]=qs[_0xe436('0x3d')](_[_0xe436('0x3e')](_0x14e255[_0xe436('0x32')],_0x54ab96[_0xe436('0x3d')]),_0x236325);if(_0x14e255[_0xe436('0x32')][_0xe436('0x3f')]){_0x3643fc[_0xe436('0x3c')]=_[_0xe436('0x40')](_0x3643fc[_0xe436('0x3c')],{'$or':_['map'](_0x236325,function(_0x34ac75){if(_0x34ac75[_0xe436('0x2f')]!=='VIRTUAL'){var _0x728d25={};_0x728d25[_0x34ac75[_0xe436('0x29')]]={'$like':'%'+_0x14e255[_0xe436('0x32')][_0xe436('0x3f')]+'%'};return _0x728d25;}})});}_0x3643fc=_[_0xe436('0x40')]({},_0x3643fc,_0x14e255[_0xe436('0x41')]);var _0x1d183a={'where':_0x3643fc[_0xe436('0x3c')]};return db[_0xe436('0x2d')]['count'](_0x1d183a)[_0xe436('0x23')](function(_0xaa00c9){_0x4052a5[_0xe436('0x1e')]=_0xaa00c9;if(_0x14e255['query'][_0xe436('0x42')]){_0x3643fc[_0xe436('0x43')]=[{'all':!![]}];}return db[_0xe436('0x2d')][_0xe436('0x44')](_0x3643fc);})['then'](function(_0x240d76){_0x4052a5[_0xe436('0x45')]=_0x240d76;return _0x4052a5;})['then'](respondWithFilteredResult(_0xf13fe9,_0x3643fc))[_0xe436('0x46')](handleError(_0xf13fe9,null));};exports['show']=function(_0x2b4b05,_0x5af1ff){var _0x355ee2={'raw':![],'where':{'id':_0x2b4b05[_0xe436('0x47')]['id']}},_0x587761={};_0x587761[_0xe436('0x31')]=_[_0xe436('0x33')](db['Trigger']['rawAttributes']);_0x587761[_0xe436('0x32')]=_[_0xe436('0x33')](_0x2b4b05['query']);_0x587761[_0xe436('0x3d')]=_['intersection'](_0x587761[_0xe436('0x31')],_0x587761['query']);_0x355ee2[_0xe436('0x35')]=_[_0xe436('0x34')](_0x587761['model'],qs[_0xe436('0x36')](_0x2b4b05[_0xe436('0x32')][_0xe436('0x36')]));_0x355ee2[_0xe436('0x35')]=_0x355ee2[_0xe436('0x35')][_0xe436('0x48')]?_0x355ee2[_0xe436('0x35')]:_0x587761['model'];if(_0x2b4b05[_0xe436('0x32')][_0xe436('0x42')]){_0x355ee2[_0xe436('0x43')]=[{'all':!![]}];}_0x355ee2=_[_0xe436('0x40')]({},_0x355ee2,_0x2b4b05[_0xe436('0x41')]);return db[_0xe436('0x2d')][_0xe436('0x49')](_0x355ee2)[_0xe436('0x23')](handleEntityNotFound(_0x5af1ff,null))[_0xe436('0x23')](respondWithResult(_0x5af1ff,null))[_0xe436('0x46')](handleError(_0x5af1ff,null));};exports[_0xe436('0x4a')]=function(_0x53d47b,_0xbbb682){return db[_0xe436('0x2d')][_0xe436('0x4a')](_0x53d47b[_0xe436('0x4b')],{})[_0xe436('0x23')](function(_0x581f02){var _0x2c0fb4=_0x53d47b['user'][_0xe436('0x4c')]({'plain':!![]});if(!_0x2c0fb4)throw new Error(_0xe436('0x4d'));if(_0x2c0fb4[_0xe436('0x4e')]===_0xe436('0x4f')){var _0x3aa2c4=_0x581f02[_0xe436('0x4c')]({'plain':!![]});var _0x3d1da6=_0xe436('0x24');return db[_0xe436('0x50')][_0xe436('0x49')]({'where':{'name':_0x3d1da6,'userProfileId':_0x2c0fb4[_0xe436('0x51')]},'raw':!![]})['then'](function(_0x1671c1){if(_0x1671c1&&_0x1671c1[_0xe436('0x52')]===0x0){return db[_0xe436('0x25')][_0xe436('0x4a')]({'name':_0x3aa2c4[_0xe436('0x29')],'resourceId':_0x3aa2c4['id'],'type':_0x1671c1[_0xe436('0x29')],'sectionId':_0x1671c1['id']},{})['then'](function(){return _0x581f02;});}else{return _0x581f02;}})['catch'](function(_0x45303b){logger[_0xe436('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45303b);throw _0x45303b;});}return _0x581f02;})[_0xe436('0x23')](respondWithResult(_0xbbb682,0xc9))[_0xe436('0x46')](handleError(_0xbbb682,null));};exports[_0xe436('0x22')]=function(_0x25be01,_0x57a5b5){if(_0x25be01[_0xe436('0x4b')]['id']){delete _0x25be01['body']['id'];}return db[_0xe436('0x2d')][_0xe436('0x49')]({'where':{'id':_0x25be01['params']['id']}})['then'](handleEntityNotFound(_0x57a5b5,null))[_0xe436('0x23')](saveUpdates(_0x25be01['body'],null))[_0xe436('0x23')](respondWithResult(_0x57a5b5,null))[_0xe436('0x46')](handleError(_0x57a5b5,null));};exports[_0xe436('0x26')]=function(_0x5c95de,_0x17276a){return db[_0xe436('0x2d')][_0xe436('0x49')]({'where':{'id':_0x5c95de[_0xe436('0x47')]['id']}})[_0xe436('0x23')](handleEntityNotFound(_0x17276a,null))['then'](removeEntity(_0x17276a,null))[_0xe436('0x46')](handleError(_0x17276a,null));};exports[_0xe436('0x53')]=function(_0xe0fb36,_0x2b0eb5,_0x437b8d){if(_0xe0fb36[_0xe436('0x4b')]['id']){delete _0xe0fb36[_0xe436('0x4b')]['id'];}return db[_0xe436('0x2d')][_0xe436('0x49')]({'where':{'id':_0xe0fb36['params']['id']}})[_0xe436('0x23')](handleEntityNotFound(_0x2b0eb5,null))[_0xe436('0x23')](function(_0x8508e3){if(_0x8508e3){_0xe0fb36[_0xe436('0x4b')][_0xe436('0x54')]=_0x8508e3['id'];return db[_0xe436('0x55')][_0xe436('0x4a')](_0xe0fb36['body']);}})[_0xe436('0x23')](respondWithResult(_0x2b0eb5,null))['catch'](handleError(_0x2b0eb5,null));};exports[_0xe436('0x56')]=function(_0x14a57a,_0x3ffb8a,_0x1d4ee1){if(_0x14a57a[_0xe436('0x4b')]['id']){delete _0x14a57a['body']['id'];}return db[_0xe436('0x2d')]['find']({'where':{'id':_0x14a57a[_0xe436('0x47')]['id']}})[_0xe436('0x23')](handleEntityNotFound(_0x3ffb8a,null))['then'](function(_0x4a6759){if(_0x4a6759){_0x14a57a['body'][_0xe436('0x57')]=_0x4a6759['id'];return db[_0xe436('0x55')][_0xe436('0x4a')](_0x14a57a['body']);}})[_0xe436('0x23')](respondWithResult(_0x3ffb8a,null))[_0xe436('0x46')](handleError(_0x3ffb8a,null));};exports[_0xe436('0x58')]=function(_0x534eab,_0x1a1d89,_0x3e5a3){var _0x60f4f8={};var _0x39ba12={};var _0x4d03b3;var _0x45d714;return db[_0xe436('0x2d')][_0xe436('0x59')]({'where':{'id':_0x534eab[_0xe436('0x47')]['id']}})[_0xe436('0x23')](handleEntityNotFound(_0x1a1d89,null))[_0xe436('0x23')](function(_0x3431fb){if(_0x3431fb){_0x4d03b3=_0x3431fb;_0x39ba12[_0xe436('0x31')]=_[_0xe436('0x33')](db[_0xe436('0x55')]['rawAttributes']);_0x39ba12[_0xe436('0x32')]=_[_0xe436('0x33')](_0x534eab[_0xe436('0x32')]);_0x39ba12[_0xe436('0x3d')]=_['intersection'](_0x39ba12[_0xe436('0x31')],_0x39ba12['query']);_0x60f4f8[_0xe436('0x35')]=_[_0xe436('0x34')](_0x39ba12[_0xe436('0x31')],qs[_0xe436('0x36')](_0x534eab[_0xe436('0x32')]['fields']));_0x60f4f8[_0xe436('0x35')]=_0x60f4f8[_0xe436('0x35')][_0xe436('0x48')]?_0x60f4f8['attributes']:_0x39ba12['model'];_0x60f4f8[_0xe436('0x3a')]=qs[_0xe436('0x3b')](_0x534eab[_0xe436('0x32')][_0xe436('0x3b')]);_0x60f4f8[_0xe436('0x3c')]=qs[_0xe436('0x3d')](_[_0xe436('0x3e')](_0x534eab['query'],_0x39ba12[_0xe436('0x3d')]));if(_0x534eab[_0xe436('0x32')][_0xe436('0x3f')]){_0x60f4f8['where']=_[_0xe436('0x40')](_0x60f4f8[_0xe436('0x3c')],{'$or':_[_0xe436('0x2c')](_0x60f4f8[_0xe436('0x35')],function(_0x3d8970){var _0x57ce50={};_0x57ce50[_0x3d8970]={'$like':'%'+_0x534eab[_0xe436('0x32')][_0xe436('0x3f')]+'%'};return _0x57ce50;})});}_0x60f4f8=_[_0xe436('0x40')]({},_0x60f4f8,_0x534eab[_0xe436('0x41')]);return _0x4d03b3[_0xe436('0x58')](_0x60f4f8);}})[_0xe436('0x23')](function(_0x1f9b41){if(_0x1f9b41){_0x45d714=_0x1f9b41[_0xe436('0x48')];if(!_0x534eab[_0xe436('0x32')][_0xe436('0x37')](_0xe436('0x38'))){_0x60f4f8[_0xe436('0x39')]=qs[_0xe436('0x39')](_0x534eab[_0xe436('0x32')]['limit']);_0x60f4f8[_0xe436('0x1d')]=qs[_0xe436('0x1d')](_0x534eab[_0xe436('0x32')][_0xe436('0x1d')]);}return _0x4d03b3['getAllConditions'](_0x60f4f8);}})[_0xe436('0x23')](function(_0xa82906){if(_0xa82906){return _0xa82906?{'count':_0x45d714,'rows':_0xa82906}:null;}})[_0xe436('0x23')](respondWithResult(_0x1a1d89,null))[_0xe436('0x46')](handleError(_0x1a1d89,null));};exports[_0xe436('0x5a')]=function(_0x489a42,_0x3e3e27,_0x35bda3){var _0x322bd0={};var _0x1a3026={};var _0x5e1257;var _0x4ec533;return db['Trigger']['findOne']({'where':{'id':_0x489a42['params']['id']}})[_0xe436('0x23')](handleEntityNotFound(_0x3e3e27,null))[_0xe436('0x23')](function(_0x5153d2){if(_0x5153d2){_0x5e1257=_0x5153d2;_0x1a3026[_0xe436('0x31')]=_[_0xe436('0x33')](db['Condition'][_0xe436('0x5b')]);_0x1a3026[_0xe436('0x32')]=_['keys'](_0x489a42[_0xe436('0x32')]);_0x1a3026[_0xe436('0x3d')]=_[_0xe436('0x34')](_0x1a3026['model'],_0x1a3026[_0xe436('0x32')]);_0x322bd0[_0xe436('0x35')]=_[_0xe436('0x34')](_0x1a3026[_0xe436('0x31')],qs[_0xe436('0x36')](_0x489a42[_0xe436('0x32')][_0xe436('0x36')]));_0x322bd0[_0xe436('0x35')]=_0x322bd0[_0xe436('0x35')][_0xe436('0x48')]?_0x322bd0[_0xe436('0x35')]:_0x1a3026[_0xe436('0x31')];_0x322bd0[_0xe436('0x3a')]=qs[_0xe436('0x3b')](_0x489a42[_0xe436('0x32')][_0xe436('0x3b')]);_0x322bd0['where']=qs[_0xe436('0x3d')](_[_0xe436('0x3e')](_0x489a42[_0xe436('0x32')],_0x1a3026[_0xe436('0x3d')]));if(_0x489a42[_0xe436('0x32')]['filter']){_0x322bd0[_0xe436('0x3c')]=_[_0xe436('0x40')](_0x322bd0[_0xe436('0x3c')],{'$or':_[_0xe436('0x2c')](_0x322bd0[_0xe436('0x35')],function(_0x183ce4){var _0x2326fd={};_0x2326fd[_0x183ce4]={'$like':'%'+_0x489a42[_0xe436('0x32')][_0xe436('0x3f')]+'%'};return _0x2326fd;})});}_0x322bd0=_[_0xe436('0x40')]({},_0x322bd0,_0x489a42[_0xe436('0x41')]);return _0x5e1257[_0xe436('0x5a')](_0x322bd0);}})[_0xe436('0x23')](function(_0x1591f3){if(_0x1591f3){_0x4ec533=_0x1591f3[_0xe436('0x48')];if(!_0x489a42[_0xe436('0x32')][_0xe436('0x37')]('nolimit')){_0x322bd0[_0xe436('0x39')]=qs[_0xe436('0x39')](_0x489a42[_0xe436('0x32')]['limit']);_0x322bd0[_0xe436('0x1d')]=qs[_0xe436('0x1d')](_0x489a42['query']['offset']);}return _0x5e1257[_0xe436('0x5a')](_0x322bd0);}})[_0xe436('0x23')](function(_0x33b10a){if(_0x33b10a){return _0x33b10a?{'count':_0x4ec533,'rows':_0x33b10a}:null;}})[_0xe436('0x23')](respondWithResult(_0x3e3e27,null))['catch'](handleError(_0x3e3e27,null));};exports['addAction']=function(_0x5082a8,_0x1b0919,_0x5d24fb){if(_0x5082a8[_0xe436('0x4b')]['id']){delete _0x5082a8[_0xe436('0x4b')]['id'];}return db[_0xe436('0x2d')]['find']({'where':{'id':_0x5082a8[_0xe436('0x47')]['id']}})[_0xe436('0x23')](handleEntityNotFound(_0x1b0919,null))['then'](function(_0x50ee64){if(_0x50ee64){_0x5082a8[_0xe436('0x4b')][_0xe436('0x5c')]=_0x50ee64['id'];return db[_0xe436('0x5d')][_0xe436('0x4a')](_0x5082a8[_0xe436('0x4b')]);}})[_0xe436('0x23')](respondWithResult(_0x1b0919,null))[_0xe436('0x46')](handleError(_0x1b0919,null));};exports[_0xe436('0x5e')]=function(_0x4b820f,_0x60a253,_0x2b66a5){var _0x130004={};var _0x54d555={};var _0x494a17;var _0x85c517;return db[_0xe436('0x2d')][_0xe436('0x59')]({'where':{'id':_0x4b820f[_0xe436('0x47')]['id']}})[_0xe436('0x23')](handleEntityNotFound(_0x60a253,null))['then'](function(_0x1012a7){if(_0x1012a7){_0x494a17=_0x1012a7;_0x54d555[_0xe436('0x31')]=_[_0xe436('0x33')](db[_0xe436('0x5d')]['rawAttributes']);_0x54d555['query']=_[_0xe436('0x33')](_0x4b820f[_0xe436('0x32')]);_0x54d555[_0xe436('0x3d')]=_[_0xe436('0x34')](_0x54d555[_0xe436('0x31')],_0x54d555[_0xe436('0x32')]);_0x130004['attributes']=_[_0xe436('0x34')](_0x54d555[_0xe436('0x31')],qs[_0xe436('0x36')](_0x4b820f[_0xe436('0x32')][_0xe436('0x36')]));_0x130004[_0xe436('0x35')]=_0x130004[_0xe436('0x35')][_0xe436('0x48')]?_0x130004[_0xe436('0x35')]:_0x54d555[_0xe436('0x31')];_0x130004[_0xe436('0x3a')]=qs['sort'](_0x4b820f[_0xe436('0x32')][_0xe436('0x3b')]);_0x130004['where']=qs[_0xe436('0x3d')](_[_0xe436('0x3e')](_0x4b820f[_0xe436('0x32')],_0x54d555[_0xe436('0x3d')]));if(_0x4b820f['query'][_0xe436('0x3f')]){_0x130004[_0xe436('0x3c')]=_[_0xe436('0x40')](_0x130004[_0xe436('0x3c')],{'$or':_[_0xe436('0x2c')](_0x130004[_0xe436('0x35')],function(_0x126d84){var _0x59bb5f={};_0x59bb5f[_0x126d84]={'$like':'%'+_0x4b820f[_0xe436('0x32')][_0xe436('0x3f')]+'%'};return _0x59bb5f;})});}_0x130004=_[_0xe436('0x40')]({},_0x130004,_0x4b820f[_0xe436('0x41')]);return _0x494a17['getActions'](_0x130004);}})[_0xe436('0x23')](function(_0x512029){if(_0x512029){_0x85c517=_0x512029[_0xe436('0x48')];if(!_0x4b820f[_0xe436('0x32')][_0xe436('0x37')](_0xe436('0x38'))){_0x130004[_0xe436('0x39')]=qs[_0xe436('0x39')](_0x4b820f[_0xe436('0x32')][_0xe436('0x39')]);_0x130004[_0xe436('0x1d')]=qs['offset'](_0x4b820f[_0xe436('0x32')][_0xe436('0x1d')]);}return _0x494a17[_0xe436('0x5e')](_0x130004);}})[_0xe436('0x23')](function(_0xdbf46d){if(_0xdbf46d){return _0xdbf46d?{'count':_0x85c517,'rows':_0xdbf46d}:null;}})[_0xe436('0x23')](respondWithResult(_0x60a253,null))[_0xe436('0x46')](handleError(_0x60a253,null));}; \ No newline at end of file +var _0x3c4a=['../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','Triggers','UserProfileResource','end','stack','name','send','Trigger','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','find','create','body','user','get','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x3c4a,0xa4));var _0xa3c4=function(_0x506b51,_0x2d2b6d){_0x506b51=_0x506b51-0x0;var _0xca5779=_0x3c4a[_0x506b51];return _0xca5779;};'use strict';var emlformat=require(_0xa3c4('0x0'));var rimraf=require(_0xa3c4('0x1'));var zipdir=require(_0xa3c4('0x2'));var jsonpatch=require(_0xa3c4('0x3'));var rp=require(_0xa3c4('0x4'));var moment=require(_0xa3c4('0x5'));var BPromise=require(_0xa3c4('0x6'));var Mustache=require(_0xa3c4('0x7'));var util=require(_0xa3c4('0x8'));var path=require(_0xa3c4('0x9'));var sox=require(_0xa3c4('0xa'));var csv=require('to-csv');var ejs=require(_0xa3c4('0xb'));var fs=require('fs');var fs_extra=require(_0xa3c4('0xc'));var _=require('lodash');var squel=require(_0xa3c4('0xd'));var crypto=require(_0xa3c4('0xe'));var jsforce=require(_0xa3c4('0xf'));var deskjs=require(_0xa3c4('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa3c4('0x11'));var Papa=require(_0xa3c4('0x12'));var Redis=require(_0xa3c4('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa3c4('0x14'));var as=require(_0xa3c4('0x15'));var hardwareService=require(_0xa3c4('0x16'));var logger=require(_0xa3c4('0x17'))(_0xa3c4('0x18'));var utils=require(_0xa3c4('0x19'));var config=require(_0xa3c4('0x1a'));var licenseUtil=require(_0xa3c4('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x539b4f,_0x570d37){_0x570d37=_0x570d37||0xcc;return function(_0x2019b4){if(_0x2019b4){return _0x539b4f[_0xa3c4('0x1c')](_0x570d37);}return _0x539b4f[_0xa3c4('0x1d')](_0x570d37)['end']();};}function respondWithResult(_0x3c599d,_0x1ea548){_0x1ea548=_0x1ea548||0xc8;return function(_0x2c2e87){if(_0x2c2e87){return _0x3c599d[_0xa3c4('0x1d')](_0x1ea548)[_0xa3c4('0x1e')](_0x2c2e87);}};}function respondWithFilteredResult(_0x2f0278,_0x259f4c){return function(_0x594fcc){if(_0x594fcc){var _0x22db84=typeof _0x259f4c[_0xa3c4('0x1f')]===_0xa3c4('0x20')&&typeof _0x259f4c['limit']===_0xa3c4('0x20');var _0x37445a=_0x594fcc[_0xa3c4('0x21')];var _0x152487=_0x22db84?0x0:_0x259f4c[_0xa3c4('0x1f')];var _0x155398=_0x22db84?_0x594fcc[_0xa3c4('0x21')]:_0x259f4c[_0xa3c4('0x1f')]+_0x259f4c[_0xa3c4('0x22')];var _0xa8ccfb;if(_0x155398>=_0x37445a){_0x155398=_0x37445a;_0xa8ccfb=0xc8;}else{_0xa8ccfb=0xce;}_0x2f0278[_0xa3c4('0x1d')](_0xa8ccfb);return _0x2f0278[_0xa3c4('0x23')](_0xa3c4('0x24'),_0x152487+'-'+_0x155398+'/'+_0x37445a)[_0xa3c4('0x1e')](_0x594fcc);}return null;};}function patchUpdates(_0x34545b){return function(_0x386d0a){try{jsonpatch[_0xa3c4('0x25')](_0x386d0a,_0x34545b,!![]);}catch(_0xe803b2){return BPromise['reject'](_0xe803b2);}return _0x386d0a[_0xa3c4('0x26')]();};}function saveUpdates(_0x44736d,_0x38c9d2){return function(_0x5533c1){if(_0x5533c1){return _0x5533c1[_0xa3c4('0x27')](_0x44736d)[_0xa3c4('0x28')](function(_0x1883b0){return _0x1883b0;});}return null;};}function removeEntity(_0x5edc82,_0x3a95bc){return function(_0x25d8c4){if(_0x25d8c4){return _0x25d8c4[_0xa3c4('0x29')]()[_0xa3c4('0x28')](function(){var _0x5875d4=_0x25d8c4['get']({'plain':!![]});var _0x205e88=_0xa3c4('0x2a');return db[_0xa3c4('0x2b')]['destroy']({'where':{'type':_0x205e88,'resourceId':_0x5875d4['id']}})[_0xa3c4('0x28')](function(){return _0x25d8c4;});})[_0xa3c4('0x28')](function(){_0x5edc82[_0xa3c4('0x1d')](0xcc)[_0xa3c4('0x2c')]();});}};}function handleEntityNotFound(_0x1d4d9c,_0x1312cd){return function(_0x53b546){if(!_0x53b546){_0x1d4d9c[_0xa3c4('0x1c')](0x194);}return _0x53b546;};}function handleError(_0x15f384,_0x11162e){_0x11162e=_0x11162e||0x1f4;return function(_0xfa1de3){logger['error'](_0xfa1de3[_0xa3c4('0x2d')]);if(_0xfa1de3[_0xa3c4('0x2e')]){delete _0xfa1de3[_0xa3c4('0x2e')];}_0x15f384['status'](_0x11162e)[_0xa3c4('0x2f')](_0xfa1de3);};}exports['index']=function(_0x471717,_0x4e0a8a){var _0x7302cd={},_0xbba0df={},_0x179746={'count':0x0,'rows':[]};var _0x515cbc=_['map'](db[_0xa3c4('0x30')][_0xa3c4('0x31')],function(_0x4ff1ae){return{'name':_0x4ff1ae[_0xa3c4('0x32')],'type':_0x4ff1ae[_0xa3c4('0x33')]['key']};});_0xbba0df[_0xa3c4('0x34')]=_[_0xa3c4('0x35')](_0x515cbc,_0xa3c4('0x2e'));_0xbba0df[_0xa3c4('0x36')]=_[_0xa3c4('0x37')](_0x471717[_0xa3c4('0x36')]);_0xbba0df[_0xa3c4('0x38')]=_[_0xa3c4('0x39')](_0xbba0df['model'],_0xbba0df['query']);_0x7302cd[_0xa3c4('0x3a')]=_[_0xa3c4('0x39')](_0xbba0df[_0xa3c4('0x34')],qs['fields'](_0x471717['query'][_0xa3c4('0x3b')]));_0x7302cd[_0xa3c4('0x3a')]=_0x7302cd[_0xa3c4('0x3a')][_0xa3c4('0x3c')]?_0x7302cd[_0xa3c4('0x3a')]:_0xbba0df[_0xa3c4('0x34')];if(!_0x471717[_0xa3c4('0x36')][_0xa3c4('0x3d')](_0xa3c4('0x3e'))){_0x7302cd['limit']=qs[_0xa3c4('0x22')](_0x471717[_0xa3c4('0x36')][_0xa3c4('0x22')]);_0x7302cd[_0xa3c4('0x1f')]=qs[_0xa3c4('0x1f')](_0x471717['query'][_0xa3c4('0x1f')]);}_0x7302cd[_0xa3c4('0x3f')]=qs[_0xa3c4('0x40')](_0x471717['query'][_0xa3c4('0x40')]);_0x7302cd[_0xa3c4('0x41')]=qs[_0xa3c4('0x38')](_[_0xa3c4('0x42')](_0x471717['query'],_0xbba0df[_0xa3c4('0x38')]),_0x515cbc);if(_0x471717['query'][_0xa3c4('0x43')]){_0x7302cd[_0xa3c4('0x41')]=_[_0xa3c4('0x44')](_0x7302cd[_0xa3c4('0x41')],{'$or':_['map'](_0x515cbc,function(_0x468dc2){if(_0x468dc2[_0xa3c4('0x33')]!==_0xa3c4('0x45')){var _0x5b6b6f={};_0x5b6b6f[_0x468dc2[_0xa3c4('0x2e')]]={'$like':'%'+_0x471717[_0xa3c4('0x36')][_0xa3c4('0x43')]+'%'};return _0x5b6b6f;}})});}_0x7302cd=_[_0xa3c4('0x44')]({},_0x7302cd,_0x471717[_0xa3c4('0x46')]);var _0x15bb39={'where':_0x7302cd[_0xa3c4('0x41')]};return db[_0xa3c4('0x30')][_0xa3c4('0x21')](_0x15bb39)[_0xa3c4('0x28')](function(_0x2608b0){_0x179746['count']=_0x2608b0;if(_0x471717['query'][_0xa3c4('0x47')]){_0x7302cd[_0xa3c4('0x48')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x7302cd);})['then'](function(_0x455dad){_0x179746['rows']=_0x455dad;return _0x179746;})[_0xa3c4('0x28')](respondWithFilteredResult(_0x4e0a8a,_0x7302cd))[_0xa3c4('0x49')](handleError(_0x4e0a8a,null));};exports['show']=function(_0x126339,_0x47118c){var _0x3a7478={'raw':![],'where':{'id':_0x126339[_0xa3c4('0x4a')]['id']}},_0x24a3c1={};_0x24a3c1[_0xa3c4('0x34')]=_[_0xa3c4('0x37')](db[_0xa3c4('0x30')][_0xa3c4('0x31')]);_0x24a3c1[_0xa3c4('0x36')]=_[_0xa3c4('0x37')](_0x126339[_0xa3c4('0x36')]);_0x24a3c1[_0xa3c4('0x38')]=_[_0xa3c4('0x39')](_0x24a3c1[_0xa3c4('0x34')],_0x24a3c1[_0xa3c4('0x36')]);_0x3a7478[_0xa3c4('0x3a')]=_['intersection'](_0x24a3c1[_0xa3c4('0x34')],qs[_0xa3c4('0x3b')](_0x126339[_0xa3c4('0x36')][_0xa3c4('0x3b')]));_0x3a7478[_0xa3c4('0x3a')]=_0x3a7478[_0xa3c4('0x3a')][_0xa3c4('0x3c')]?_0x3a7478['attributes']:_0x24a3c1['model'];if(_0x126339[_0xa3c4('0x36')]['includeAll']){_0x3a7478[_0xa3c4('0x48')]=[{'all':!![]}];}_0x3a7478=_[_0xa3c4('0x44')]({},_0x3a7478,_0x126339[_0xa3c4('0x46')]);return db['Trigger'][_0xa3c4('0x4b')](_0x3a7478)[_0xa3c4('0x28')](handleEntityNotFound(_0x47118c,null))[_0xa3c4('0x28')](respondWithResult(_0x47118c,null))['catch'](handleError(_0x47118c,null));};exports[_0xa3c4('0x4c')]=function(_0x27035c,_0x25f655){return db[_0xa3c4('0x30')][_0xa3c4('0x4c')](_0x27035c[_0xa3c4('0x4d')],{})['then'](function(_0x56b463){var _0x531143=_0x27035c[_0xa3c4('0x4e')][_0xa3c4('0x4f')]({'plain':!![]});if(!_0x531143)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x531143[_0xa3c4('0x50')]==='user'){var _0x34d382=_0x56b463[_0xa3c4('0x4f')]({'plain':!![]});var _0x24a633=_0xa3c4('0x2a');return db[_0xa3c4('0x51')][_0xa3c4('0x4b')]({'where':{'name':_0x24a633,'userProfileId':_0x531143[_0xa3c4('0x52')]},'raw':!![]})[_0xa3c4('0x28')](function(_0x637305){if(_0x637305&&_0x637305['autoAssociation']===0x0){return db[_0xa3c4('0x2b')][_0xa3c4('0x4c')]({'name':_0x34d382['name'],'resourceId':_0x34d382['id'],'type':_0x637305[_0xa3c4('0x2e')],'sectionId':_0x637305['id']},{})[_0xa3c4('0x28')](function(){return _0x56b463;});}else{return _0x56b463;}})[_0xa3c4('0x49')](function(_0x195d48){logger[_0xa3c4('0x53')](_0xa3c4('0x54'),_0x195d48);throw _0x195d48;});}return _0x56b463;})[_0xa3c4('0x28')](respondWithResult(_0x25f655,0xc9))[_0xa3c4('0x49')](handleError(_0x25f655,null));};exports[_0xa3c4('0x27')]=function(_0x2ff9b8,_0x43e4da){if(_0x2ff9b8['body']['id']){delete _0x2ff9b8[_0xa3c4('0x4d')]['id'];}return db['Trigger'][_0xa3c4('0x4b')]({'where':{'id':_0x2ff9b8[_0xa3c4('0x4a')]['id']}})[_0xa3c4('0x28')](handleEntityNotFound(_0x43e4da,null))[_0xa3c4('0x28')](saveUpdates(_0x2ff9b8[_0xa3c4('0x4d')],null))[_0xa3c4('0x28')](respondWithResult(_0x43e4da,null))[_0xa3c4('0x49')](handleError(_0x43e4da,null));};exports[_0xa3c4('0x29')]=function(_0x282043,_0x270e84){return db['Trigger'][_0xa3c4('0x4b')]({'where':{'id':_0x282043[_0xa3c4('0x4a')]['id']}})[_0xa3c4('0x28')](handleEntityNotFound(_0x270e84,null))[_0xa3c4('0x28')](removeEntity(_0x270e84,null))[_0xa3c4('0x49')](handleError(_0x270e84,null));};exports['addAllCondition']=function(_0xfaf76c,_0x2d5ea5,_0x2706cf){if(_0xfaf76c[_0xa3c4('0x4d')]['id']){delete _0xfaf76c[_0xa3c4('0x4d')]['id'];}return db[_0xa3c4('0x30')][_0xa3c4('0x4b')]({'where':{'id':_0xfaf76c[_0xa3c4('0x4a')]['id']}})[_0xa3c4('0x28')](handleEntityNotFound(_0x2d5ea5,null))[_0xa3c4('0x28')](function(_0x231b9b){if(_0x231b9b){_0xfaf76c[_0xa3c4('0x4d')][_0xa3c4('0x55')]=_0x231b9b['id'];return db[_0xa3c4('0x56')][_0xa3c4('0x4c')](_0xfaf76c['body']);}})[_0xa3c4('0x28')](respondWithResult(_0x2d5ea5,null))[_0xa3c4('0x49')](handleError(_0x2d5ea5,null));};exports[_0xa3c4('0x57')]=function(_0x67903f,_0x3d3444,_0x8849cc){if(_0x67903f[_0xa3c4('0x4d')]['id']){delete _0x67903f[_0xa3c4('0x4d')]['id'];}return db[_0xa3c4('0x30')]['find']({'where':{'id':_0x67903f[_0xa3c4('0x4a')]['id']}})[_0xa3c4('0x28')](handleEntityNotFound(_0x3d3444,null))['then'](function(_0xbebbbd){if(_0xbebbbd){_0x67903f[_0xa3c4('0x4d')][_0xa3c4('0x58')]=_0xbebbbd['id'];return db[_0xa3c4('0x56')][_0xa3c4('0x4c')](_0x67903f[_0xa3c4('0x4d')]);}})[_0xa3c4('0x28')](respondWithResult(_0x3d3444,null))['catch'](handleError(_0x3d3444,null));};exports[_0xa3c4('0x59')]=function(_0x36e353,_0x50125c,_0xc159a3){var _0x16a46d={};var _0x142f88={};var _0x41fc64;var _0x167488;return db[_0xa3c4('0x30')][_0xa3c4('0x5a')]({'where':{'id':_0x36e353['params']['id']}})['then'](handleEntityNotFound(_0x50125c,null))['then'](function(_0x18d4e4){if(_0x18d4e4){_0x41fc64=_0x18d4e4;_0x142f88['model']=_[_0xa3c4('0x37')](db[_0xa3c4('0x56')][_0xa3c4('0x31')]);_0x142f88[_0xa3c4('0x36')]=_[_0xa3c4('0x37')](_0x36e353[_0xa3c4('0x36')]);_0x142f88[_0xa3c4('0x38')]=_[_0xa3c4('0x39')](_0x142f88[_0xa3c4('0x34')],_0x142f88[_0xa3c4('0x36')]);_0x16a46d[_0xa3c4('0x3a')]=_[_0xa3c4('0x39')](_0x142f88['model'],qs['fields'](_0x36e353[_0xa3c4('0x36')]['fields']));_0x16a46d[_0xa3c4('0x3a')]=_0x16a46d['attributes'][_0xa3c4('0x3c')]?_0x16a46d[_0xa3c4('0x3a')]:_0x142f88[_0xa3c4('0x34')];_0x16a46d['order']=qs['sort'](_0x36e353[_0xa3c4('0x36')][_0xa3c4('0x40')]);_0x16a46d[_0xa3c4('0x41')]=qs[_0xa3c4('0x38')](_[_0xa3c4('0x42')](_0x36e353[_0xa3c4('0x36')],_0x142f88[_0xa3c4('0x38')]));if(_0x36e353['query'][_0xa3c4('0x43')]){_0x16a46d[_0xa3c4('0x41')]=_[_0xa3c4('0x44')](_0x16a46d[_0xa3c4('0x41')],{'$or':_[_0xa3c4('0x35')](_0x16a46d[_0xa3c4('0x3a')],function(_0x2e16e4){var _0x2afff3={};_0x2afff3[_0x2e16e4]={'$like':'%'+_0x36e353[_0xa3c4('0x36')]['filter']+'%'};return _0x2afff3;})});}_0x16a46d=_[_0xa3c4('0x44')]({},_0x16a46d,_0x36e353[_0xa3c4('0x46')]);return _0x41fc64['getAllConditions'](_0x16a46d);}})[_0xa3c4('0x28')](function(_0x4b782b){if(_0x4b782b){_0x167488=_0x4b782b[_0xa3c4('0x3c')];if(!_0x36e353[_0xa3c4('0x36')][_0xa3c4('0x3d')](_0xa3c4('0x3e'))){_0x16a46d[_0xa3c4('0x22')]=qs[_0xa3c4('0x22')](_0x36e353[_0xa3c4('0x36')][_0xa3c4('0x22')]);_0x16a46d[_0xa3c4('0x1f')]=qs[_0xa3c4('0x1f')](_0x36e353['query'][_0xa3c4('0x1f')]);}return _0x41fc64[_0xa3c4('0x59')](_0x16a46d);}})[_0xa3c4('0x28')](function(_0x5cb09b){if(_0x5cb09b){return _0x5cb09b?{'count':_0x167488,'rows':_0x5cb09b}:null;}})[_0xa3c4('0x28')](respondWithResult(_0x50125c,null))['catch'](handleError(_0x50125c,null));};exports[_0xa3c4('0x5b')]=function(_0x4f24f2,_0x1102aa,_0x5770d6){var _0x17dcf9={};var _0x4e0f3c={};var _0x36dc1c;var _0x1d3114;return db[_0xa3c4('0x30')]['findOne']({'where':{'id':_0x4f24f2[_0xa3c4('0x4a')]['id']}})[_0xa3c4('0x28')](handleEntityNotFound(_0x1102aa,null))[_0xa3c4('0x28')](function(_0x54e50f){if(_0x54e50f){_0x36dc1c=_0x54e50f;_0x4e0f3c[_0xa3c4('0x34')]=_[_0xa3c4('0x37')](db[_0xa3c4('0x56')][_0xa3c4('0x31')]);_0x4e0f3c[_0xa3c4('0x36')]=_[_0xa3c4('0x37')](_0x4f24f2[_0xa3c4('0x36')]);_0x4e0f3c[_0xa3c4('0x38')]=_['intersection'](_0x4e0f3c[_0xa3c4('0x34')],_0x4e0f3c['query']);_0x17dcf9['attributes']=_[_0xa3c4('0x39')](_0x4e0f3c[_0xa3c4('0x34')],qs[_0xa3c4('0x3b')](_0x4f24f2[_0xa3c4('0x36')][_0xa3c4('0x3b')]));_0x17dcf9[_0xa3c4('0x3a')]=_0x17dcf9[_0xa3c4('0x3a')][_0xa3c4('0x3c')]?_0x17dcf9['attributes']:_0x4e0f3c['model'];_0x17dcf9[_0xa3c4('0x3f')]=qs['sort'](_0x4f24f2[_0xa3c4('0x36')][_0xa3c4('0x40')]);_0x17dcf9[_0xa3c4('0x41')]=qs[_0xa3c4('0x38')](_[_0xa3c4('0x42')](_0x4f24f2[_0xa3c4('0x36')],_0x4e0f3c[_0xa3c4('0x38')]));if(_0x4f24f2[_0xa3c4('0x36')][_0xa3c4('0x43')]){_0x17dcf9[_0xa3c4('0x41')]=_[_0xa3c4('0x44')](_0x17dcf9[_0xa3c4('0x41')],{'$or':_[_0xa3c4('0x35')](_0x17dcf9['attributes'],function(_0x372ef8){var _0x45cbae={};_0x45cbae[_0x372ef8]={'$like':'%'+_0x4f24f2[_0xa3c4('0x36')][_0xa3c4('0x43')]+'%'};return _0x45cbae;})});}_0x17dcf9=_[_0xa3c4('0x44')]({},_0x17dcf9,_0x4f24f2['options']);return _0x36dc1c[_0xa3c4('0x5b')](_0x17dcf9);}})['then'](function(_0x53135f){if(_0x53135f){_0x1d3114=_0x53135f[_0xa3c4('0x3c')];if(!_0x4f24f2[_0xa3c4('0x36')][_0xa3c4('0x3d')](_0xa3c4('0x3e'))){_0x17dcf9[_0xa3c4('0x22')]=qs[_0xa3c4('0x22')](_0x4f24f2[_0xa3c4('0x36')][_0xa3c4('0x22')]);_0x17dcf9[_0xa3c4('0x1f')]=qs['offset'](_0x4f24f2['query'][_0xa3c4('0x1f')]);}return _0x36dc1c[_0xa3c4('0x5b')](_0x17dcf9);}})[_0xa3c4('0x28')](function(_0xe9b5dd){if(_0xe9b5dd){return _0xe9b5dd?{'count':_0x1d3114,'rows':_0xe9b5dd}:null;}})[_0xa3c4('0x28')](respondWithResult(_0x1102aa,null))['catch'](handleError(_0x1102aa,null));};exports[_0xa3c4('0x5c')]=function(_0x210458,_0x408ff7,_0x128119){if(_0x210458[_0xa3c4('0x4d')]['id']){delete _0x210458['body']['id'];}return db[_0xa3c4('0x30')][_0xa3c4('0x4b')]({'where':{'id':_0x210458[_0xa3c4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x408ff7,null))[_0xa3c4('0x28')](function(_0x2206ca){if(_0x2206ca){_0x210458[_0xa3c4('0x4d')]['TriggerId']=_0x2206ca['id'];return db['Action'][_0xa3c4('0x4c')](_0x210458[_0xa3c4('0x4d')]);}})[_0xa3c4('0x28')](respondWithResult(_0x408ff7,null))[_0xa3c4('0x49')](handleError(_0x408ff7,null));};exports[_0xa3c4('0x5d')]=function(_0xf27e2a,_0x426b9d,_0x3dff74){var _0x3fa719={};var _0x26c453={};var _0x555f8b;var _0x1d2c97;return db[_0xa3c4('0x30')][_0xa3c4('0x5a')]({'where':{'id':_0xf27e2a[_0xa3c4('0x4a')]['id']}})[_0xa3c4('0x28')](handleEntityNotFound(_0x426b9d,null))[_0xa3c4('0x28')](function(_0x32213d){if(_0x32213d){_0x555f8b=_0x32213d;_0x26c453[_0xa3c4('0x34')]=_[_0xa3c4('0x37')](db[_0xa3c4('0x5e')][_0xa3c4('0x31')]);_0x26c453[_0xa3c4('0x36')]=_[_0xa3c4('0x37')](_0xf27e2a[_0xa3c4('0x36')]);_0x26c453[_0xa3c4('0x38')]=_[_0xa3c4('0x39')](_0x26c453[_0xa3c4('0x34')],_0x26c453[_0xa3c4('0x36')]);_0x3fa719[_0xa3c4('0x3a')]=_[_0xa3c4('0x39')](_0x26c453['model'],qs['fields'](_0xf27e2a[_0xa3c4('0x36')][_0xa3c4('0x3b')]));_0x3fa719['attributes']=_0x3fa719['attributes']['length']?_0x3fa719['attributes']:_0x26c453[_0xa3c4('0x34')];_0x3fa719[_0xa3c4('0x3f')]=qs['sort'](_0xf27e2a['query'][_0xa3c4('0x40')]);_0x3fa719[_0xa3c4('0x41')]=qs[_0xa3c4('0x38')](_[_0xa3c4('0x42')](_0xf27e2a[_0xa3c4('0x36')],_0x26c453[_0xa3c4('0x38')]));if(_0xf27e2a[_0xa3c4('0x36')]['filter']){_0x3fa719[_0xa3c4('0x41')]=_[_0xa3c4('0x44')](_0x3fa719['where'],{'$or':_['map'](_0x3fa719[_0xa3c4('0x3a')],function(_0xb53340){var _0x10e374={};_0x10e374[_0xb53340]={'$like':'%'+_0xf27e2a[_0xa3c4('0x36')][_0xa3c4('0x43')]+'%'};return _0x10e374;})});}_0x3fa719=_['merge']({},_0x3fa719,_0xf27e2a[_0xa3c4('0x46')]);return _0x555f8b[_0xa3c4('0x5d')](_0x3fa719);}})[_0xa3c4('0x28')](function(_0x5dbe4b){if(_0x5dbe4b){_0x1d2c97=_0x5dbe4b[_0xa3c4('0x3c')];if(!_0xf27e2a['query'][_0xa3c4('0x3d')](_0xa3c4('0x3e'))){_0x3fa719[_0xa3c4('0x22')]=qs[_0xa3c4('0x22')](_0xf27e2a[_0xa3c4('0x36')][_0xa3c4('0x22')]);_0x3fa719[_0xa3c4('0x1f')]=qs['offset'](_0xf27e2a[_0xa3c4('0x36')][_0xa3c4('0x1f')]);}return _0x555f8b[_0xa3c4('0x5d')](_0x3fa719);}})[_0xa3c4('0x28')](function(_0xd54d20){if(_0xd54d20){return _0xd54d20?{'count':_0x1d2c97,'rows':_0xd54d20}:null;}})[_0xa3c4('0x28')](respondWithResult(_0x426b9d,null))[_0xa3c4('0x49')](handleError(_0x426b9d,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 5d70c46..5d828ba 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 _0xae24=['../../config/logger','moment','bluebird','rimraf','./trigger.attributes','exports','define','Trigger','lodash'];(function(_0x185875,_0x47aee1){var _0x261eb2=function(_0x432ce2){while(--_0x432ce2){_0x185875['push'](_0x185875['shift']());}};_0x261eb2(++_0x47aee1);}(_0xae24,0x182));var _0x4ae2=function(_0x29926f,_0x5564ef){_0x29926f=_0x29926f-0x0;var _0x4e0164=_0xae24[_0x29926f];return _0x4e0164;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var logger=require(_0x4ae2('0x1'))('api');var moment=require(_0x4ae2('0x2'));var BPromise=require(_0x4ae2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ae2('0x4'));var config=require('../../config/environment');var attributes=require(_0x4ae2('0x5'));module[_0x4ae2('0x6')]=function(_0x20c85c,_0x3e6055){return _0x20c85c[_0x4ae2('0x7')](_0x4ae2('0x8'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ade=['define','Trigger','tools_triggers','lodash','util','moment','request-promise','path','./trigger.attributes','exports'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x9ade,0x107));var _0xe9ad=function(_0x2924d3,_0x43216b){_0x2924d3=_0x2924d3-0x0;var _0x4be4e4=_0x9ade[_0x2924d3];return _0x4be4e4;};'use strict';var _=require(_0xe9ad('0x0'));var util=require(_0xe9ad('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe9ad('0x2'));var BPromise=require('bluebird');var rp=require(_0xe9ad('0x3'));var fs=require('fs');var path=require(_0xe9ad('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe9ad('0x5'));module[_0xe9ad('0x6')]=function(_0xdd1549,_0x3e4092){return _0xdd1549[_0xe9ad('0x7')](_0xe9ad('0x8'),attributes,{'tableName':_0xe9ad('0x9'),'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 3606a95..35829ca 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 _0x7bbf=['find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','GetTrigger','ShowTrigger','Trigger'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x7bbf,0xfd));var _0xf7bb=function(_0x433439,_0x540e03){_0x433439=_0x433439-0x0;var _0x5101af=_0x7bbf[_0x433439];return _0x5101af;};'use strict';var _=require('lodash');var util=require(_0xf7bb('0x0'));var moment=require(_0xf7bb('0x1'));var BPromise=require(_0xf7bb('0x2'));var rs=require(_0xf7bb('0x3'));var fs=require('fs');var Redis=require(_0xf7bb('0x4'));var db=require(_0xf7bb('0x5'))['db'];var utils=require(_0xf7bb('0x6'));var logger=require(_0xf7bb('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf7bb('0x8'));var client=jayson[_0xf7bb('0x9')][_0xf7bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x270249,_0x259b41,_0x141442){return new BPromise(function(_0x4b8cbb,_0x42e94f){return client[_0xf7bb('0xb')](_0x270249,_0x141442)['then'](function(_0x132f02){logger['info'](_0xf7bb('0xc'),_0x259b41,_0xf7bb('0xd'));logger[_0xf7bb('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0x259b41,_0xf7bb('0xd'),JSON[_0xf7bb('0xf')](_0x132f02));if(_0x132f02[_0xf7bb('0x10')]){if(_0x132f02['error'][_0xf7bb('0x11')]===0x1f4){logger[_0xf7bb('0x10')](_0xf7bb('0xc'),_0x259b41,_0x132f02['error'][_0xf7bb('0x12')]);return _0x42e94f(_0x132f02['error'][_0xf7bb('0x12')]);}logger['error'](_0xf7bb('0xc'),_0x259b41,_0x132f02[_0xf7bb('0x10')][_0xf7bb('0x12')]);return _0x4b8cbb(_0x132f02[_0xf7bb('0x10')][_0xf7bb('0x12')]);}else{logger[_0xf7bb('0x13')]('Trigger,\x20%s,\x20%s',_0x259b41,_0xf7bb('0xd'));_0x4b8cbb(_0x132f02[_0xf7bb('0x14')][_0xf7bb('0x12')]);}})[_0xf7bb('0x15')](function(_0xb61674){logger[_0xf7bb('0x10')](_0xf7bb('0xc'),_0x259b41,_0xb61674);_0x42e94f(_0xb61674);});});}exports['GetTrigger']=function(_0x4255ab){var _0x437cc6=this;return new Promise(function(_0x47e4c4,_0x5bb3bc){return db['Trigger'][_0xf7bb('0x16')]({'raw':_0x4255ab['options']?_0x4255ab[_0xf7bb('0x17')][_0xf7bb('0x18')]===undefined?!![]:![]:!![],'where':_0x4255ab[_0xf7bb('0x17')]?_0x4255ab[_0xf7bb('0x17')][_0xf7bb('0x19')]||null:null,'attributes':_0x4255ab[_0xf7bb('0x17')]?_0x4255ab[_0xf7bb('0x17')][_0xf7bb('0x1a')]||null:null,'limit':_0x4255ab[_0xf7bb('0x17')]?_0x4255ab[_0xf7bb('0x17')][_0xf7bb('0x1b')]||null:null,'include':_0x4255ab[_0xf7bb('0x17')]?_0x4255ab['options'][_0xf7bb('0x1c')]?_['map'](_0x4255ab[_0xf7bb('0x17')][_0xf7bb('0x1c')],function(_0x33b672){return{'model':db[_0x33b672['model']],'as':_0x33b672['as'],'attributes':_0x33b672[_0xf7bb('0x1a')],'include':_0x33b672['include']?_[_0xf7bb('0x1d')](_0x33b672[_0xf7bb('0x1c')],function(_0x3ef77c){return{'model':db[_0x3ef77c[_0xf7bb('0x1e')]],'as':_0x3ef77c['as'],'attributes':_0x3ef77c[_0xf7bb('0x1a')],'include':_0x3ef77c[_0xf7bb('0x1c')]?_[_0xf7bb('0x1d')](_0x3ef77c['include'],function(_0x38c6ba){return{'model':db[_0x38c6ba[_0xf7bb('0x1e')]],'as':_0x38c6ba['as'],'attributes':_0x38c6ba[_0xf7bb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf7bb('0x1f')](function(_0x35df41){logger[_0xf7bb('0x13')](_0xf7bb('0x20'),_0x4255ab);logger[_0xf7bb('0xe')](_0xf7bb('0x20'),_0x4255ab,JSON[_0xf7bb('0xf')](_0x35df41));_0x47e4c4(_0x35df41);})[_0xf7bb('0x15')](function(_0x12e2d9){logger[_0xf7bb('0x10')]('GetTrigger',_0x12e2d9[_0xf7bb('0x12')],_0x4255ab);_0x5bb3bc(_0x437cc6[_0xf7bb('0x10')](0x1f4,_0x12e2d9[_0xf7bb('0x12')]));});});};exports[_0xf7bb('0x21')]=function(_0x52da75){var _0x562d86=this;return new Promise(function(_0x1c4ed1,_0x3d24c7){return db[_0xf7bb('0x22')][_0xf7bb('0x23')]({'raw':_0x52da75[_0xf7bb('0x17')]?_0x52da75[_0xf7bb('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x52da75[_0xf7bb('0x17')]?_0x52da75[_0xf7bb('0x17')][_0xf7bb('0x19')]||null:null,'attributes':_0x52da75[_0xf7bb('0x17')]?_0x52da75[_0xf7bb('0x17')]['attributes']||null:null,'include':_0x52da75[_0xf7bb('0x17')]?_0x52da75['options'][_0xf7bb('0x1c')]?_['map'](_0x52da75[_0xf7bb('0x17')][_0xf7bb('0x1c')],function(_0x43eedf){return{'model':db[_0x43eedf[_0xf7bb('0x1e')]],'as':_0x43eedf['as'],'attributes':_0x43eedf[_0xf7bb('0x1a')],'include':_0x43eedf[_0xf7bb('0x1c')]?_[_0xf7bb('0x1d')](_0x43eedf['include'],function(_0x415ac6){return{'model':db[_0x415ac6[_0xf7bb('0x1e')]],'as':_0x415ac6['as'],'attributes':_0x415ac6[_0xf7bb('0x1a')],'include':_0x415ac6[_0xf7bb('0x1c')]?_[_0xf7bb('0x1d')](_0x415ac6[_0xf7bb('0x1c')],function(_0x3f7b96){return{'model':db[_0x3f7b96['model']],'as':_0x3f7b96['as'],'attributes':_0x3f7b96[_0xf7bb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf7bb('0x1f')](function(_0x1adcd2){logger[_0xf7bb('0x13')](_0xf7bb('0x21'),_0x52da75);logger[_0xf7bb('0xe')]('ShowTrigger',_0x52da75,JSON[_0xf7bb('0xf')](_0x1adcd2));_0x1c4ed1(_0x1adcd2);})[_0xf7bb('0x15')](function(_0x47af7f){logger[_0xf7bb('0x10')](_0xf7bb('0x21'),_0x47af7f[_0xf7bb('0x12')],_0x52da75);_0x3d24c7(_0x562d86[_0xf7bb('0x10')](0x1f4,_0x47af7f[_0xf7bb('0x12')]));});});}; \ No newline at end of file +var _0x26ad=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','attributes','limit','include','map','model','ShowTrigger','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xb7e17c,_0x43b2af){var _0x1d6813=function(_0x43766f){while(--_0x43766f){_0xb7e17c['push'](_0xb7e17c['shift']());}};_0x1d6813(++_0x43b2af);}(_0x26ad,0x199));var _0xd26a=function(_0x36147b,_0x57f40b){_0x36147b=_0x36147b-0x0;var _0x141351=_0x26ad[_0x36147b];return _0x141351;};'use strict';var _=require(_0xd26a('0x0'));var util=require(_0xd26a('0x1'));var moment=require(_0xd26a('0x2'));var BPromise=require(_0xd26a('0x3'));var rs=require(_0xd26a('0x4'));var fs=require('fs');var Redis=require(_0xd26a('0x5'));var db=require(_0xd26a('0x6'))['db'];var utils=require(_0xd26a('0x7'));var logger=require('../../config/logger')(_0xd26a('0x8'));var config=require(_0xd26a('0x9'));var jayson=require(_0xd26a('0xa'));var client=jayson[_0xd26a('0xb')][_0xd26a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2a9588,_0x56e36f,_0x145934){return new BPromise(function(_0x2d9312,_0x21d5a8){return client[_0xd26a('0xd')](_0x2a9588,_0x145934)[_0xd26a('0xe')](function(_0x5a0d4f){logger[_0xd26a('0xf')]('Trigger,\x20%s,\x20%s',_0x56e36f,_0xd26a('0x10'));logger[_0xd26a('0x11')](_0xd26a('0x12'),_0x56e36f,'request\x20sent',JSON[_0xd26a('0x13')](_0x5a0d4f));if(_0x5a0d4f[_0xd26a('0x14')]){if(_0x5a0d4f[_0xd26a('0x14')]['code']===0x1f4){logger[_0xd26a('0x14')](_0xd26a('0x15'),_0x56e36f,_0x5a0d4f[_0xd26a('0x14')][_0xd26a('0x16')]);return _0x21d5a8(_0x5a0d4f['error'][_0xd26a('0x16')]);}logger[_0xd26a('0x14')]('Trigger,\x20%s,\x20%s',_0x56e36f,_0x5a0d4f['error'][_0xd26a('0x16')]);return _0x2d9312(_0x5a0d4f['error']['message']);}else{logger[_0xd26a('0xf')]('Trigger,\x20%s,\x20%s',_0x56e36f,_0xd26a('0x10'));_0x2d9312(_0x5a0d4f[_0xd26a('0x17')][_0xd26a('0x16')]);}})[_0xd26a('0x18')](function(_0x17a012){logger[_0xd26a('0x14')](_0xd26a('0x15'),_0x56e36f,_0x17a012);_0x21d5a8(_0x17a012);});});}exports[_0xd26a('0x19')]=function(_0x4b6eac){var _0xddf7f8=this;return new Promise(function(_0x2266f9,_0x5cfbe8){return db[_0xd26a('0x1a')][_0xd26a('0x1b')]({'raw':_0x4b6eac[_0xd26a('0x1c')]?_0x4b6eac[_0xd26a('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4b6eac[_0xd26a('0x1c')]?_0x4b6eac['options']['where']||null:null,'attributes':_0x4b6eac[_0xd26a('0x1c')]?_0x4b6eac[_0xd26a('0x1c')][_0xd26a('0x1d')]||null:null,'limit':_0x4b6eac[_0xd26a('0x1c')]?_0x4b6eac[_0xd26a('0x1c')][_0xd26a('0x1e')]||null:null,'include':_0x4b6eac['options']?_0x4b6eac['options'][_0xd26a('0x1f')]?_[_0xd26a('0x20')](_0x4b6eac[_0xd26a('0x1c')][_0xd26a('0x1f')],function(_0x13c462){return{'model':db[_0x13c462[_0xd26a('0x21')]],'as':_0x13c462['as'],'attributes':_0x13c462[_0xd26a('0x1d')],'include':_0x13c462[_0xd26a('0x1f')]?_['map'](_0x13c462[_0xd26a('0x1f')],function(_0x1d498d){return{'model':db[_0x1d498d[_0xd26a('0x21')]],'as':_0x1d498d['as'],'attributes':_0x1d498d[_0xd26a('0x1d')],'include':_0x1d498d[_0xd26a('0x1f')]?_['map'](_0x1d498d[_0xd26a('0x1f')],function(_0x3e5518){return{'model':db[_0x3e5518[_0xd26a('0x21')]],'as':_0x3e5518['as'],'attributes':_0x3e5518[_0xd26a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd26a('0xe')](function(_0x1cc9fe){logger['info']('GetTrigger',_0x4b6eac);logger[_0xd26a('0x11')](_0xd26a('0x19'),_0x4b6eac,JSON[_0xd26a('0x13')](_0x1cc9fe));_0x2266f9(_0x1cc9fe);})['catch'](function(_0x2e7abd){logger['error'](_0xd26a('0x19'),_0x2e7abd[_0xd26a('0x16')],_0x4b6eac);_0x5cfbe8(_0xddf7f8[_0xd26a('0x14')](0x1f4,_0x2e7abd['message']));});});};exports[_0xd26a('0x22')]=function(_0x4c990f){var _0x24e555=this;return new Promise(function(_0x1f17cf,_0x38b54b){return db['Trigger'][_0xd26a('0x23')]({'raw':_0x4c990f[_0xd26a('0x1c')]?_0x4c990f[_0xd26a('0x1c')][_0xd26a('0x24')]===undefined?!![]:![]:!![],'where':_0x4c990f[_0xd26a('0x1c')]?_0x4c990f['options'][_0xd26a('0x25')]||null:null,'attributes':_0x4c990f[_0xd26a('0x1c')]?_0x4c990f[_0xd26a('0x1c')][_0xd26a('0x1d')]||null:null,'include':_0x4c990f[_0xd26a('0x1c')]?_0x4c990f[_0xd26a('0x1c')][_0xd26a('0x1f')]?_['map'](_0x4c990f['options'][_0xd26a('0x1f')],function(_0x586199){return{'model':db[_0x586199[_0xd26a('0x21')]],'as':_0x586199['as'],'attributes':_0x586199[_0xd26a('0x1d')],'include':_0x586199[_0xd26a('0x1f')]?_['map'](_0x586199[_0xd26a('0x1f')],function(_0x24b62e){return{'model':db[_0x24b62e[_0xd26a('0x21')]],'as':_0x24b62e['as'],'attributes':_0x24b62e[_0xd26a('0x1d')],'include':_0x24b62e['include']?_[_0xd26a('0x20')](_0x24b62e[_0xd26a('0x1f')],function(_0x2e79f3){return{'model':db[_0x2e79f3[_0xd26a('0x21')]],'as':_0x2e79f3['as'],'attributes':_0x2e79f3['attributes']};}):[]};}):[]};}):[]:[]})[_0xd26a('0xe')](function(_0x111d35){logger[_0xd26a('0xf')](_0xd26a('0x22'),_0x4c990f);logger[_0xd26a('0x11')](_0xd26a('0x22'),_0x4c990f,JSON[_0xd26a('0x13')](_0x111d35));_0x1f17cf(_0x111d35);})[_0xd26a('0x18')](function(_0x1c4e7d){logger['error'](_0xd26a('0x22'),_0x1c4e7d[_0xd26a('0x16')],_0x4c990f);_0x38b54b(_0x24e555[_0xd26a('0x14')](0x1f4,_0x1c4e7d[_0xd26a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 1640dde..f6056bf 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 _0xbcce=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','show','/:id/clone','clone','post','create','put','delete','/:id','destroy','exports','multer','util','path'];(function(_0x4e6aac,_0x112644){var _0x395e0c=function(_0x1fa83a){while(--_0x1fa83a){_0x4e6aac['push'](_0x4e6aac['shift']());}};_0x395e0c(++_0x112644);}(_0xbcce,0x184));var _0xebcc=function(_0x1060ae,_0x555c65){_0x1060ae=_0x1060ae-0x0;var _0xcb159f=_0xbcce[_0x1060ae];return _0xcb159f;};'use strict';var multer=require(_0xebcc('0x0'));var util=require(_0xebcc('0x1'));var path=require(_0xebcc('0x2'));var timeout=require(_0xebcc('0x3'));var express=require(_0xebcc('0x4'));var router=express[_0xebcc('0x5')]();var fs_extra=require(_0xebcc('0x6'));var auth=require(_0xebcc('0x7'));var interaction=require(_0xebcc('0x8'));var config=require(_0xebcc('0x9'));var controller=require(_0xebcc('0xa'));router[_0xebcc('0xb')]('/',auth[_0xebcc('0xc')](),controller['index']);router[_0xebcc('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xebcc('0xd')]);router['post'](_0xebcc('0xe'),auth[_0xebcc('0xc')](),controller[_0xebcc('0xf')]);router[_0xebcc('0x10')]('/',auth[_0xebcc('0xc')](),controller[_0xebcc('0x11')]);router[_0xebcc('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xebcc('0x13')](_0xebcc('0x14'),auth[_0xebcc('0xc')](),controller[_0xebcc('0x15')]);module[_0xebcc('0x16')]=router; \ No newline at end of file +var _0xc689=['post','create','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','isAuthenticated','show','/:id/clone','clone'];(function(_0x41e870,_0x406df4){var _0x4e96ca=function(_0x2a0370){while(--_0x2a0370){_0x41e870['push'](_0x41e870['shift']());}};_0x4e96ca(++_0x406df4);}(_0xc689,0x149));var _0x9c68=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc689[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0x9c68('0x0'));var util=require(_0x9c68('0x1'));var path=require(_0x9c68('0x2'));var timeout=require(_0x9c68('0x3'));var express=require('express');var router=express[_0x9c68('0x4')]();var fs_extra=require(_0x9c68('0x5'));var auth=require(_0x9c68('0x6'));var interaction=require(_0x9c68('0x7'));var config=require(_0x9c68('0x8'));var controller=require(_0x9c68('0x9'));router[_0x9c68('0xa')]('/',auth['isAuthenticated'](),controller[_0x9c68('0xb')]);router[_0x9c68('0xa')]('/:id',auth[_0x9c68('0xc')](),controller[_0x9c68('0xd')]);router['post'](_0x9c68('0xe'),auth[_0x9c68('0xc')](),controller[_0x9c68('0xf')]);router[_0x9c68('0x10')]('/',auth[_0x9c68('0xc')](),controller[_0x9c68('0x11')]);router[_0x9c68('0x12')]('/:id',auth[_0x9c68('0xc')](),controller['update']);router[_0x9c68('0x13')](_0x9c68('0x14'),auth[_0x9c68('0xc')](),controller[_0x9c68('0x15')]);module[_0x9c68('0x16')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 214e0a4..4c5ad9a 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 _0xd6a4=['uas','pai','fingerprint','active','passive','dynamic','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','user','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','getDataValue','split','rfc2833','info','shortinfo','inband','yes','outgoing','nat','join','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','INTEGER','\x22\x22\x20<>','accept','refuse','originate','uac'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd6a4,0x14a));var _0x4d6a=function(_0x52166b,_0x2ffcef){_0x52166b=_0x52166b-0x0;var _0x556f07=_0xd6a4[_0x52166b];return _0x556f07;};'use strict';var Sequelize=require(_0x4d6a('0x0'));module[_0x4d6a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4d6a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4d6a('0x3')](_0x4d6a('0x4'),_0x4d6a('0x5'),'peer'),'allowNull':![],'defaultValue':_0x4d6a('0x4')},'context':{'type':Sequelize[_0x4d6a('0x6')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x4d6a('0x3')](_0x4d6a('0x7'),_0x4d6a('0x8'),_0x4d6a('0x9'),_0x4d6a('0xa'),_0x4d6a('0xb'),_0x4d6a('0xc'),_0x4d6a('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0x4d6a('0x6')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x4d6a('0x6')]},'md5secret':{'type':Sequelize[_0x4d6a('0x6')]},'remotesecret':{'type':Sequelize[_0x4d6a('0x6')]},'transport':{'type':Sequelize[_0x4d6a('0x6')],'defaultValue':_0x4d6a('0xe'),'set':function(_0x5f7790){this[_0x4d6a('0xf')](_0x4d6a('0x10'),_0x5f7790?_0x5f7790['join'](','):null);},'get':function(){return this[_0x4d6a('0x11')](_0x4d6a('0x10'))?this[_0x4d6a('0x11')](_0x4d6a('0x10'))[_0x4d6a('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x4d6a('0x3')](_0x4d6a('0x13'),_0x4d6a('0x14'),_0x4d6a('0x15'),_0x4d6a('0x16'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x4d6a('0x3')](_0x4d6a('0x17'),'no','nonat','update',_0x4d6a('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x4d6a('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x4d6a('0x6')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x16c6f0){this[_0x4d6a('0xf')](_0x4d6a('0x19'),_0x16c6f0?_0x16c6f0[_0x4d6a('0x1a')](','):null);},'get':function(){return this[_0x4d6a('0x11')]('nat')?this[_0x4d6a('0x11')](_0x4d6a('0x19'))[_0x4d6a('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x4d6a('0x6')]},'namedcallgroup':{'type':Sequelize[_0x4d6a('0x6')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x4d6a('0x6')]},'language':{'type':Sequelize[_0x4d6a('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4d6a('0x6')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x4d6a('0x6')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x4d6a('0x6')],'allowNull':![],'defaultValue':_0x4d6a('0x1b'),'set':function(_0x80e6cb){this['setDataValue']('allow',_0x80e6cb?_0x80e6cb[_0x4d6a('0x1a')](';'):_0x4d6a('0x1b'));},'get':function(){return this[_0x4d6a('0x11')]('allow')?this[_0x4d6a('0x11')](_0x4d6a('0x1c'))['split'](';'):null;},'comment':_0x4d6a('0x1d')},'autoframing':{'type':Sequelize[_0x4d6a('0x3')](_0x4d6a('0x17'),'no')},'insecure':{'type':Sequelize[_0x4d6a('0x6')],'defaultValue':_0x4d6a('0x1e'),'set':function(_0x22d8d3){this[_0x4d6a('0xf')](_0x4d6a('0x1f'),_0x22d8d3?_0x22d8d3['join'](','):null);},'get':function(){return this[_0x4d6a('0x11')](_0x4d6a('0x1f'))?this['getDataValue'](_0x4d6a('0x1f'))[_0x4d6a('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x4d6a('0x3')](_0x4d6a('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4d6a('0x3')](_0x4d6a('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4d6a('0x3')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0x4d6a('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0x4d6a('0x3')](_0x4d6a('0x17'),'no')},'accountcode':{'type':Sequelize[_0x4d6a('0x20')](0xb)},'setvar':{'type':Sequelize[_0x4d6a('0x6')]},'callerid':{'type':Sequelize[_0x4d6a('0x6')],'defaultValue':_0x4d6a('0x21')},'amaflags':{'type':Sequelize[_0x4d6a('0x6')]},'callcounter':{'type':Sequelize['ENUM'](_0x4d6a('0x17'),'no'),'defaultValue':_0x4d6a('0x17')},'busylevel':{'type':Sequelize[_0x4d6a('0x20')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x4d6a('0x17'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x4d6a('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x4d6a('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x4d6a('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x4d6a('0x6')]},'template':{'type':Sequelize[_0x4d6a('0x6')]},'videosupport':{'type':Sequelize[_0x4d6a('0x3')](_0x4d6a('0x17'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4d6a('0x20')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x4d6a('0x3')](_0x4d6a('0x17'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x4d6a('0x3')](_0x4d6a('0x22'),_0x4d6a('0x23'),_0x4d6a('0x24'))},'session_expires':{'type':Sequelize[_0x4d6a('0x20')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x4d6a('0x25'),_0x4d6a('0x26')),'defaultValue':_0x4d6a('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0x4d6a('0x6')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x4d6a('0x6')]},'fromuser':{'type':Sequelize[_0x4d6a('0x6')]},'port':{'type':Sequelize[_0x4d6a('0x20')](0x5)},'qualify':{'type':Sequelize[_0x4d6a('0x3')](_0x4d6a('0x17'),'no'),'defaultValue':_0x4d6a('0x17')},'keepalive':{'type':Sequelize[_0x4d6a('0x20')](0xb)},'defaultip':{'type':Sequelize[_0x4d6a('0x6')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x4d6a('0x20')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x4d6a('0x20')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x4d6a('0x17'),'no',_0x4d6a('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4d6a('0x6')]},'callbackextension':{'type':Sequelize[_0x4d6a('0x6')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x4d6a('0x20')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x4d6a('0x6')]},'contactacl':{'type':Sequelize[_0x4d6a('0x6')]},'unsolicited_mailbox':{'type':Sequelize[_0x4d6a('0x6')]},'use_q850_reason':{'type':Sequelize[_0x4d6a('0x6')]},'maxforwards':{'type':Sequelize[_0x4d6a('0x20')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x4d6a('0x17'),'no')},'force_avp':{'type':Sequelize[_0x4d6a('0x3')](_0x4d6a('0x17'),'no')},'icesupport':{'type':Sequelize[_0x4d6a('0x3')](_0x4d6a('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x4d6a('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x4d6a('0x17'),'no',_0x4d6a('0x28'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x4d6a('0x20')](0xb)},'dtlscertfile':{'type':Sequelize[_0x4d6a('0x6')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x4d6a('0x6')]},'dtlscafile':{'type':Sequelize[_0x4d6a('0x6')]},'dtlscapath':{'type':Sequelize[_0x4d6a('0x6')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x4d6a('0x29'),_0x4d6a('0x2a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4d6a('0x6')]},'usereqphone':{'type':Sequelize[_0x4d6a('0x3')](_0x4d6a('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4d6a('0x6')]},'recordofffeature':{'type':Sequelize[_0x4d6a('0x6')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x4d6a('0x17'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x4d6a('0x17'),'no')},'vmexten':{'type':Sequelize[_0x4d6a('0x6')]},'mohinterpret':{'type':Sequelize[_0x4d6a('0x6')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4d6a('0x6')],'defaultValue':_0x4d6a('0x2b')},'canreinvite':{'type':Sequelize[_0x4d6a('0x3')]('yes','no','nonat','update',_0x4d6a('0x2c')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x4d6a('0x6')]},'active':{'type':Sequelize[_0x4d6a('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x4d6a('0x6')],'defaultValue':'no'}}; \ No newline at end of file +var _0x8d0a=['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]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uac','uas','fingerprint','active','passive','actpass','dynamic','nonat','update','exports','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','outgoing','force_rport,comedia','nat'];(function(_0x23ccd1,_0x28832d){var _0xd8f6ee=function(_0xfbd25a){while(--_0xfbd25a){_0x23ccd1['push'](_0x23ccd1['shift']());}};_0xd8f6ee(++_0x28832d);}(_0x8d0a,0xe8));var _0xa8d0=function(_0x50c6ca,_0x120735){_0x50c6ca=_0x50c6ca-0x0;var _0x5f71be=_0x8d0a[_0x50c6ca];return _0x5f71be;};'use strict';var Sequelize=require('sequelize');module[_0xa8d0('0x0')]={'name':{'type':Sequelize[_0xa8d0('0x1')],'allowNull':![],'unique':_0xa8d0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x4'),'user',_0xa8d0('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xa8d0('0x1')],'allowNull':![],'defaultValue':_0xa8d0('0x6')},'callingpres':{'type':Sequelize[_0xa8d0('0x3')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0xa8d0('0x7'),_0xa8d0('0x8'),_0xa8d0('0x9'),_0xa8d0('0xa'),_0xa8d0('0xb'),_0xa8d0('0xc'))},'deny':{'type':Sequelize[_0xa8d0('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xa8d0('0x1')]},'remotesecret':{'type':Sequelize[_0xa8d0('0x1')]},'transport':{'type':Sequelize[_0xa8d0('0x1')],'defaultValue':_0xa8d0('0xd'),'set':function(_0x2e4404){this[_0xa8d0('0xe')]('transport',_0x2e4404?_0x2e4404[_0xa8d0('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xa8d0('0x10'))?this[_0xa8d0('0x11')]('transport')[_0xa8d0('0x12')](','):null;},'comment':_0xa8d0('0x13')},'dtmfmode':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x14'),_0xa8d0('0x15'),'shortinfo',_0xa8d0('0x16'),_0xa8d0('0x17')),'defaultValue':_0xa8d0('0x14')},'directmedia':{'type':Sequelize['ENUM'](_0xa8d0('0x18'),'no','nonat','update',_0xa8d0('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa8d0('0x1')]},'directmediadeny':{'type':Sequelize[_0xa8d0('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xa8d0('0x1a'),'set':function(_0x2e9204){this[_0xa8d0('0xe')](_0xa8d0('0x1b'),_0x2e9204?_0x2e9204[_0xa8d0('0xf')](','):null);},'get':function(){return this[_0xa8d0('0x11')](_0xa8d0('0x1b'))?this[_0xa8d0('0x11')](_0xa8d0('0x1b'))[_0xa8d0('0x12')](','):null;},'comment':_0xa8d0('0x1c')},'callgroup':{'type':Sequelize[_0xa8d0('0x1')]},'namedcallgroup':{'type':Sequelize[_0xa8d0('0x1')]},'pickupgroup':{'type':Sequelize[_0xa8d0('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xa8d0('0x1')]},'language':{'type':Sequelize[_0xa8d0('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xa8d0('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa8d0('0x1e'),'set':function(_0x2f15c3){this['setDataValue'](_0xa8d0('0x1f'),_0x2f15c3?_0x2f15c3[_0xa8d0('0xf')](';'):_0xa8d0('0x1e'));},'get':function(){return this['getDataValue'](_0xa8d0('0x1f'))?this[_0xa8d0('0x11')](_0xa8d0('0x1f'))['split'](';'):null;},'comment':_0xa8d0('0x20')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0xa8d0('0x1')],'defaultValue':_0xa8d0('0x21'),'set':function(_0x1a1bab){this[_0xa8d0('0xe')](_0xa8d0('0x22'),_0x1a1bab?_0x1a1bab[_0xa8d0('0xf')](','):null);},'get':function(){return this[_0xa8d0('0x11')]('insecure')?this[_0xa8d0('0x11')]('insecure')[_0xa8d0('0x12')](','):null;},'comment':_0xa8d0('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0xa8d0('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x18'),'no',_0xa8d0('0x24'))},'promiscredir':{'type':Sequelize['ENUM'](_0xa8d0('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xa8d0('0x1')]},'callerid':{'type':Sequelize[_0xa8d0('0x1')],'defaultValue':_0xa8d0('0x25')},'amaflags':{'type':Sequelize[_0xa8d0('0x1')]},'callcounter':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x18'),'no'),'defaultValue':_0xa8d0('0x18')},'busylevel':{'type':Sequelize[_0xa8d0('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xa8d0('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x18'),'no',_0xa8d0('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa8d0('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x18'),'no')},'mailbox':{'type':Sequelize[_0xa8d0('0x1')]},'session_timers':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x28'),_0xa8d0('0x29'),_0xa8d0('0x2a'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xa8d0('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x2b'),'uas'),'defaultValue':_0xa8d0('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0xa8d0('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xa8d0('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xa8d0('0x26')](0x5)},'qualify':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x18'),'no'),'defaultValue':_0xa8d0('0x18')},'keepalive':{'type':Sequelize[_0xa8d0('0x26')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xa8d0('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa8d0('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x18'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa8d0('0x1')]},'callbackextension':{'type':Sequelize[_0xa8d0('0x1')]},'timert1':{'type':Sequelize[_0xa8d0('0x26')](0xb)},'timerb':{'type':Sequelize[_0xa8d0('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0xa8d0('0x26')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xa8d0('0x1')]},'contactacl':{'type':Sequelize[_0xa8d0('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xa8d0('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xa8d0('0x26')](0xb)},'encryption':{'type':Sequelize[_0xa8d0('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x18'),'no')},'icesupport':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xa8d0('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0xa8d0('0x2d'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xa8d0('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0xa8d0('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xa8d0('0x1')]},'dtlscipher':{'type':Sequelize[_0xa8d0('0x1')]},'dtlscafile':{'type':Sequelize[_0xa8d0('0x1')]},'dtlscapath':{'type':Sequelize[_0xa8d0('0x1')]},'dtlssetup':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x2e'),_0xa8d0('0x2f'),_0xa8d0('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa8d0('0x1')]},'usereqphone':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xa8d0('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xa8d0('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize[_0xa8d0('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0xa8d0('0x1')]},'mohinterpret':{'type':Sequelize[_0xa8d0('0x1')]},'mohsuggest':{'type':Sequelize[_0xa8d0('0x1')]},'parkinglot':{'type':Sequelize[_0xa8d0('0x1')]},'description':{'type':Sequelize[_0xa8d0('0x1')]},'host':{'type':Sequelize[_0xa8d0('0x1')],'defaultValue':_0xa8d0('0x31')},'canreinvite':{'type':Sequelize[_0xa8d0('0x3')](_0xa8d0('0x18'),'no',_0xa8d0('0x32'),_0xa8d0('0x33'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xa8d0('0x1')]},'otherFields':{'type':Sequelize[_0xa8d0('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xa8d0('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 073ea7d..fa44a01 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 _0x6f0d=['server/files/templates/registry.ejs','utf8','render','writeFileSync','registry','Reload','chan_sip.so','user','UserProfileSection','autoAssociation','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','get','Trunks','UserProfileResource','end','stack','name','send','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','rawAttributes','find','updatedAt','body','omit','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','server/files/templates/trunk.ejs','join'];(function(_0x3f17dc,_0x32feb9){var _0x51fc09=function(_0x576d32){while(--_0x576d32){_0x3f17dc['push'](_0x3f17dc['shift']());}};_0x51fc09(++_0x32feb9);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x5c79a0,_0x230c46){_0x5c79a0=_0x5c79a0-0x0;var _0x57fe04=_0x6f0d[_0x5c79a0];return _0x57fe04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6f0('0x0'));var zipdir=require(_0xd6f0('0x1'));var jsonpatch=require(_0xd6f0('0x2'));var rp=require(_0xd6f0('0x3'));var moment=require('moment');var BPromise=require(_0xd6f0('0x4'));var Mustache=require(_0xd6f0('0x5'));var util=require(_0xd6f0('0x6'));var path=require(_0xd6f0('0x7'));var sox=require(_0xd6f0('0x8'));var csv=require('to-csv');var ejs=require(_0xd6f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd6f0('0x17'));var db=require(_0xd6f0('0x18'))['db'];var jayson=require(_0xd6f0('0x19'));var client=jayson[_0xd6f0('0x1a')][_0xd6f0('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x409549,_0x2bf5b8,_0x250999,_0x246dad){return new BPromise(function(_0x4ab979,_0x2b3f32){var _0x354846=_0x246dad||client;return _0x354846['request'](_0x409549,_0x250999)[_0xd6f0('0x1c')](function(_0x593abe){logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,_0xd6f0('0x1f'));logger[_0xd6f0('0x20')](_0xd6f0('0x21'),_0x2bf5b8,_0xd6f0('0x1f'),JSON[_0xd6f0('0x22')](_0x593abe));if(_0x593abe[_0xd6f0('0x23')]){if(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x24')]===0x1f4){logger[_0xd6f0('0x23')](_0xd6f0('0x1e'),_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x2b3f32(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x4ab979(_0x593abe[_0xd6f0('0x23')]['message']);}else{logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,'request\x20sent');_0x4ab979(_0x593abe[_0xd6f0('0x26')]['message']);}})[_0xd6f0('0x27')](function(_0x1c9d90){logger['error'](_0xd6f0('0x1e'),_0x2bf5b8,_0x1c9d90);_0x2b3f32(_0x1c9d90);});});}function respondWithStatusCode(_0x45e99c,_0x5ea2dd){_0x5ea2dd=_0x5ea2dd||0xcc;return function(_0x3dbdc3){if(_0x3dbdc3){return _0x45e99c[_0xd6f0('0x28')](_0x5ea2dd);}return _0x45e99c[_0xd6f0('0x29')](_0x5ea2dd)['end']();};}function respondWithResult(_0x2ca8bb,_0x3dc166){_0x3dc166=_0x3dc166||0xc8;return function(_0x5ecb16){if(_0x5ecb16){return _0x2ca8bb[_0xd6f0('0x29')](_0x3dc166)['json'](_0x5ecb16);}};}function respondWithFilteredResult(_0x2042d5,_0x3fb5c3){return function(_0x1630dc){if(_0x1630dc){var _0x3c1bff=typeof _0x3fb5c3[_0xd6f0('0x2a')]===_0xd6f0('0x2b')&&typeof _0x3fb5c3[_0xd6f0('0x2c')]===_0xd6f0('0x2b');var _0x48975d=_0x1630dc[_0xd6f0('0x2d')];var _0x1982d3=_0x3c1bff?0x0:_0x3fb5c3['offset'];var _0x38a3e9=_0x3c1bff?_0x1630dc[_0xd6f0('0x2d')]:_0x3fb5c3[_0xd6f0('0x2a')]+_0x3fb5c3[_0xd6f0('0x2c')];var _0x1a3967;if(_0x38a3e9>=_0x48975d){_0x38a3e9=_0x48975d;_0x1a3967=0xc8;}else{_0x1a3967=0xce;}_0x2042d5[_0xd6f0('0x29')](_0x1a3967);return _0x2042d5[_0xd6f0('0x2e')](_0xd6f0('0x2f'),_0x1982d3+'-'+_0x38a3e9+'/'+_0x48975d)[_0xd6f0('0x30')](_0x1630dc);}return null;};}function patchUpdates(_0x43f72f){return function(_0x1dff9b){try{jsonpatch[_0xd6f0('0x31')](_0x1dff9b,_0x43f72f,!![]);}catch(_0x348529){return BPromise[_0xd6f0('0x32')](_0x348529);}return _0x1dff9b[_0xd6f0('0x33')]();};}function saveUpdates(_0x2d7c90,_0x31c493){return function(_0x376890){if(_0x376890){return _0x376890[_0xd6f0('0x34')](_0x2d7c90)[_0xd6f0('0x1c')](function(_0x3906ca){return _0x3906ca;});}return null;};}function removeEntity(_0x26ab29,_0x4a8ebe){return function(_0x11124c){if(_0x11124c){return _0x11124c['destroy']()['then'](function(){var _0x43d588=_0x11124c[_0xd6f0('0x35')]({'plain':!![]});var _0x12a6fa=_0xd6f0('0x36');return db[_0xd6f0('0x37')]['destroy']({'where':{'type':_0x12a6fa,'resourceId':_0x43d588['id']}})[_0xd6f0('0x1c')](function(){return _0x11124c;});})['then'](function(){_0x26ab29[_0xd6f0('0x29')](0xcc)[_0xd6f0('0x38')]();});}};}function handleEntityNotFound(_0x42c01a,_0x1eecf0){return function(_0x518751){if(!_0x518751){_0x42c01a['sendStatus'](0x194);}return _0x518751;};}function handleError(_0x47b33d,_0x3b6463){_0x3b6463=_0x3b6463||0x1f4;return function(_0xe2958d){logger['error'](_0xe2958d[_0xd6f0('0x39')]);if(_0xe2958d['name']){delete _0xe2958d[_0xd6f0('0x3a')];}_0x47b33d[_0xd6f0('0x29')](_0x3b6463)[_0xd6f0('0x3b')](_0xe2958d);};}exports[_0xd6f0('0x3c')]=function(_0x451834,_0x3d1280){var _0x6b44fa={},_0x4fd4db={},_0x52203d={'count':0x0,'rows':[]};var _0x162537=_[_0xd6f0('0x3d')](db[_0xd6f0('0x3e')]['rawAttributes'],function(_0x59f905){return{'name':_0x59f905[_0xd6f0('0x3f')],'type':_0x59f905[_0xd6f0('0x40')][_0xd6f0('0x41')]};});_0x4fd4db[_0xd6f0('0x42')]=_[_0xd6f0('0x3d')](_0x162537,_0xd6f0('0x3a'));_0x4fd4db[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x451834['query']);_0x4fd4db[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],_0x4fd4db[_0xd6f0('0x43')]);_0x6b44fa['attributes']=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x6b44fa['attributes']=_0x6b44fa[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x6b44fa[_0xd6f0('0x48')]:_0x4fd4db['model'];if(!_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4a')]('nolimit')){_0x6b44fa['limit']=qs[_0xd6f0('0x2c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x2c')]);_0x6b44fa['offset']=qs[_0xd6f0('0x2a')](_0x451834[_0xd6f0('0x43')]['offset']);}_0x6b44fa[_0xd6f0('0x4b')]=qs[_0xd6f0('0x4c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4c')]);_0x6b44fa['where']=qs[_0xd6f0('0x45')](_[_0xd6f0('0x4d')](_0x451834[_0xd6f0('0x43')],_0x4fd4db[_0xd6f0('0x45')]),_0x162537);if(_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4e')]){_0x6b44fa[_0xd6f0('0x4f')]=_[_0xd6f0('0x50')](_0x6b44fa['where'],{'$or':_[_0xd6f0('0x3d')](_0x162537,function(_0x3d42ca){if(_0x3d42ca['type']!==_0xd6f0('0x51')){var _0x39ca69={};_0x39ca69[_0x3d42ca[_0xd6f0('0x3a')]]={'$like':'%'+_0x451834[_0xd6f0('0x43')]['filter']+'%'};return _0x39ca69;}})});}_0x6b44fa=_[_0xd6f0('0x50')]({},_0x6b44fa,_0x451834[_0xd6f0('0x52')]);var _0x494542={'where':_0x6b44fa['where']};return db[_0xd6f0('0x3e')]['count'](_0x494542)[_0xd6f0('0x1c')](function(_0x61b354){_0x52203d[_0xd6f0('0x2d')]=_0x61b354;if(_0x451834['query'][_0xd6f0('0x53')]){_0x6b44fa[_0xd6f0('0x54')]=[{'all':!![]}];}return db[_0xd6f0('0x3e')][_0xd6f0('0x55')](_0x6b44fa);})[_0xd6f0('0x1c')](function(_0x4c42ce){_0x52203d[_0xd6f0('0x56')]=_0x4c42ce;return _0x52203d;})['then'](respondWithFilteredResult(_0x3d1280,_0x6b44fa))[_0xd6f0('0x27')](handleError(_0x3d1280,null));};exports[_0xd6f0('0x57')]=function(_0x2eb338,_0x1dc320){var _0x554e37={'raw':![],'where':{'id':_0x2eb338[_0xd6f0('0x58')]['id']}},_0x5ceb6b={};_0x5ceb6b[_0xd6f0('0x42')]=_['keys'](db[_0xd6f0('0x3e')]['rawAttributes']);_0x5ceb6b[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x2eb338[_0xd6f0('0x43')]);_0x5ceb6b[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x5ceb6b['model'],_0x5ceb6b[_0xd6f0('0x43')]);_0x554e37[_0xd6f0('0x48')]=_[_0xd6f0('0x46')](_0x5ceb6b[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x554e37[_0xd6f0('0x48')]=_0x554e37['attributes'][_0xd6f0('0x49')]?_0x554e37[_0xd6f0('0x48')]:_0x5ceb6b[_0xd6f0('0x42')];if(_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x53')]){_0x554e37[_0xd6f0('0x54')]=[{'all':!![]}];}_0x554e37=_[_0xd6f0('0x50')]({},_0x554e37,_0x2eb338[_0xd6f0('0x52')]);return db[_0xd6f0('0x3e')]['find'](_0x554e37)[_0xd6f0('0x1c')](handleEntityNotFound(_0x1dc320,null))['then'](respondWithResult(_0x1dc320,null))['catch'](handleError(_0x1dc320,null));};exports[_0xd6f0('0x59')]=function(_0x55fd25,_0x539ef1){var _0x28c3c4={'where':{'id':_0x55fd25[_0xd6f0('0x58')]['id']}},_0x2d39a2={};_0x2d39a2['model']=_[_0xd6f0('0x44')](db[_0xd6f0('0x3e')][_0xd6f0('0x5a')]);_0x28c3c4['attributes']=_[_0xd6f0('0x46')](_0x2d39a2[_0xd6f0('0x42')],qs['fields'](_0x55fd25[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x28c3c4['attributes']=_0x28c3c4[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x28c3c4[_0xd6f0('0x48')]:_0x2d39a2[_0xd6f0('0x42')];if(_0x55fd25[_0xd6f0('0x43')]['includeAll']){_0x28c3c4[_0xd6f0('0x54')]=[{'all':!![]}];}_0x28c3c4=_[_0xd6f0('0x50')]({},_0x28c3c4,_0x55fd25['options']);return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')](_0x28c3c4)[_0xd6f0('0x1c')](handleEntityNotFound(_0x539ef1,null))['then'](function(_0x229f19){if(_0x229f19){var _0x5d75fa=_0x229f19['get']({'plain':!![]});_0x5d75fa=qs['omit'](_0x5d75fa,['id','createdAt',_0xd6f0('0x5c')]);_0x55fd25[_0xd6f0('0x5d')]=_[_0xd6f0('0x5e')](_0x55fd25[_0xd6f0('0x5d')],['id','createdAt',_0xd6f0('0x5c')]);return db['Trunk'][_0xd6f0('0x5f')](_[_0xd6f0('0x50')](_0x5d75fa,_0x55fd25[_0xd6f0('0x5d')]),{'include':_0x55fd25['query'][_0xd6f0('0x53')]?[{'all':!![]}]:undefined})[_0xd6f0('0x1c')](function(_0x269dd7){var _0x705eb=_0x55fd25['user'][_0xd6f0('0x35')]({'plain':!![]});if(!_0x705eb)throw new Error(_0xd6f0('0x60'));if(_0x705eb[_0xd6f0('0x61')]==='user'){var _0x5bc4e7=_0x269dd7[_0xd6f0('0x35')]({'plain':!![]});var _0x1fee47=_0xd6f0('0x36');return db['UserProfileSection'][_0xd6f0('0x5b')]({'where':{'name':_0x1fee47,'userProfileId':_0x705eb[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x282e9b){if(_0x282e9b&&_0x282e9b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5bc4e7['name'],'resourceId':_0x5bc4e7['id'],'type':_0x282e9b[_0xd6f0('0x3a')],'sectionId':_0x282e9b['id']},{})[_0xd6f0('0x1c')](function(){return _0x269dd7;});}else{return _0x269dd7;}})[_0xd6f0('0x27')](function(_0x30cd81){logger[_0xd6f0('0x23')](_0xd6f0('0x63'),_0x30cd81);throw _0x30cd81;});}return _0x269dd7;});}})[_0xd6f0('0x1c')](respondWithResult(_0x539ef1,0xc9))[_0xd6f0('0x27')](handleError(_0x539ef1,null));};exports[_0xd6f0('0x5f')]=function(_0x5ad146,_0x55f96e,_0x1b9728){var _0x5af4f6;return db[_0xd6f0('0x3e')][_0xd6f0('0x5f')](_0x5ad146[_0xd6f0('0x5d')],{'raw':!![]})[_0xd6f0('0x1c')](function(_0x14384f){_0x5af4f6=_0x14384f;return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})['then'](function(_0x3c8a3e){var _0x318a68=fs[_0xd6f0('0x64')](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x66')),'utf8');var _0xad50ac=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x1c6140=ejs[_0xd6f0('0x6a')](_0x318a68,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1c6140);if(_0x5af4f6[_0xd6f0('0x6c')]){var _0x205b6a=ejs[_0xd6f0('0x6a')](_0xad50ac,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_registers.conf',_0x205b6a);}})[_0xd6f0('0x1c')](function(){return respondWithRpcPromise(_0xd6f0('0x6d'),_0xd6f0('0x5f'),{'module':_0xd6f0('0x6e')});})[_0xd6f0('0x1c')](function(){var _0x12e0e5=_0x5ad146[_0xd6f0('0x6f')][_0xd6f0('0x35')]({'plain':!![]});if(!_0x12e0e5)throw new Error(_0xd6f0('0x60'));if(_0x12e0e5[_0xd6f0('0x61')]==='user'){var _0x440d5c=_0x5af4f6[_0xd6f0('0x35')]({'plain':!![]});return db[_0xd6f0('0x70')]['find']({'where':{'name':_0xd6f0('0x36'),'userProfileId':_0x12e0e5[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x406bc7){if(_0x406bc7&&_0x406bc7[_0xd6f0('0x71')]===0x0){return db[_0xd6f0('0x37')][_0xd6f0('0x5f')]({'name':_0x440d5c[_0xd6f0('0x3a')],'resourceId':_0x440d5c['id'],'type':_0x406bc7[_0xd6f0('0x3a')],'sectionId':_0x406bc7['id']},{})[_0xd6f0('0x1c')](function(){return _0x5af4f6;});}else{return _0x5af4f6;}})[_0xd6f0('0x27')](function(_0x5b3155){logger['error'](_0xd6f0('0x63'),_0x5b3155);throw _0x5b3155;});}return _0x5af4f6;})[_0xd6f0('0x1c')](respondWithResult(_0x55f96e,0xc9))[_0xd6f0('0x27')](handleError(_0x55f96e,null));};exports[_0xd6f0('0x34')]=function(_0x1da442,_0x5a781b,_0x15143a){var _0x2d38e6;return db['Trunk'][_0xd6f0('0x5b')]({'where':{'id':_0x1da442['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0x5a781b,null))[_0xd6f0('0x1c')](saveUpdates(_0x1da442[_0xd6f0('0x5d')],null))[_0xd6f0('0x1c')](function(_0x391c2a){if(_0x391c2a){_0x2d38e6=_0x391c2a;return db['Trunk']['findAll']({'raw':!![]});}})[_0xd6f0('0x1c')](function(_0x17b320){if(_0x17b320){var _0x484124=fs[_0xd6f0('0x64')](path['join'](config['root'],_0xd6f0('0x66')),'utf8');var _0x5dc1c7=fs['readFileSync'](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0xcfed18=ejs[_0xd6f0('0x6a')](_0x484124,{'trunks':_0x17b320||[]});fs[_0xd6f0('0x6b')](_0xd6f0('0x72'),_0xcfed18);var _0x381f88=ejs[_0xd6f0('0x6a')](_0x5dc1c7,{'trunks':_0x17b320||[]});fs['writeFileSync'](_0xd6f0('0x73'),_0x381f88);return respondWithRpcPromise('Reload','update',{'module':_0xd6f0('0x6e')});}return null;})[_0xd6f0('0x1c')](function(_0x397f2c){if(_0x397f2c){return _0x2d38e6;}})['then'](respondWithResult(_0x5a781b,null))[_0xd6f0('0x27')](handleError(_0x5a781b,null));};exports[_0xd6f0('0x74')]=function(_0xc0585c,_0xf7ade1,_0x41e738){var _0x202e37;return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')]({'where':{'id':_0xc0585c['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0xf7ade1,null))[_0xd6f0('0x1c')](removeEntity(_0xf7ade1,null))['then'](function(){return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})[_0xd6f0('0x1c')](function(_0x175ba6){var _0x403698=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config['root'],_0xd6f0('0x66')),_0xd6f0('0x69'));var _0x5c3659=fs['readFileSync'](path['join'](config['root'],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x2fdd59=ejs[_0xd6f0('0x6a')](_0x403698,{'trunks':_0x175ba6});var _0x427b95=ejs[_0xd6f0('0x6a')](_0x5c3659,{'trunks':_0x175ba6});fs['writeFileSync'](_0xd6f0('0x72'),_0x2fdd59);fs[_0xd6f0('0x6b')](_0xd6f0('0x73'),_0x427b95);return respondWithRpcPromise(_0xd6f0('0x6d'),'destroy',{'module':_0xd6f0('0x6e')});})['catch'](handleError(_0xf7ade1,null));}; \ No newline at end of file +var _0x00bb=['includeAll','findAll','rows','params','find','clone','rawAttributes','include','omit','createdAt','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','jayson/promise','client','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Trunk,\x20%s,\x20%s','result','catch','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Trunks','UserProfileResource','status','stack','name','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x7b3dd5,_0x236371){var _0x2eeed7=function(_0x4fb6e4){while(--_0x4fb6e4){_0x7b3dd5['push'](_0x7b3dd5['shift']());}};_0x2eeed7(++_0x236371);}(_0x00bb,0x1d8));var _0xb00b=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x00bb[_0x56482c];return _0x5aae7a;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];var jayson=require(_0xb00b('0x15'));var client=jayson[_0xb00b('0x16')][_0xb00b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xef5d52,_0x1f1c1d,_0x4ada81,_0x218de2){return new BPromise(function(_0xb0d42e,_0x482fe6){var _0x88d95e=_0x218de2||client;return _0x88d95e[_0xb00b('0x18')](_0xef5d52,_0x4ada81)['then'](function(_0x5da36b){logger[_0xb00b('0x19')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,'request\x20sent');logger[_0xb00b('0x1a')](_0xb00b('0x1b'),_0x1f1c1d,_0xb00b('0x1c'),JSON[_0xb00b('0x1d')](_0x5da36b));if(_0x5da36b['error']){if(_0x5da36b[_0xb00b('0x1e')]['code']===0x1f4){logger[_0xb00b('0x1e')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0x482fe6(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0xb0d42e(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}else{logger[_0xb00b('0x19')](_0xb00b('0x20'),_0x1f1c1d,'request\x20sent');_0xb0d42e(_0x5da36b[_0xb00b('0x21')]['message']);}})[_0xb00b('0x22')](function(_0x121ec7){logger['error'](_0xb00b('0x20'),_0x1f1c1d,_0x121ec7);_0x482fe6(_0x121ec7);});});}function respondWithStatusCode(_0x2896d1,_0x520444){_0x520444=_0x520444||0xcc;return function(_0x3ab3cc){if(_0x3ab3cc){return _0x2896d1[_0xb00b('0x23')](_0x520444);}return _0x2896d1['status'](_0x520444)[_0xb00b('0x24')]();};}function respondWithResult(_0x243fdb,_0x3c9500){_0x3c9500=_0x3c9500||0xc8;return function(_0x8caadf){if(_0x8caadf){return _0x243fdb['status'](_0x3c9500)['json'](_0x8caadf);}};}function respondWithFilteredResult(_0x3785e9,_0x490380){return function(_0x550587){if(_0x550587){var _0x4a635e=typeof _0x490380[_0xb00b('0x25')]===_0xb00b('0x26')&&typeof _0x490380[_0xb00b('0x27')]===_0xb00b('0x26');var _0x1f14fa=_0x550587[_0xb00b('0x28')];var _0x15d3b9=_0x4a635e?0x0:_0x490380['offset'];var _0x22c22d=_0x4a635e?_0x550587['count']:_0x490380[_0xb00b('0x25')]+_0x490380[_0xb00b('0x27')];var _0x5424ca;if(_0x22c22d>=_0x1f14fa){_0x22c22d=_0x1f14fa;_0x5424ca=0xc8;}else{_0x5424ca=0xce;}_0x3785e9['status'](_0x5424ca);return _0x3785e9[_0xb00b('0x29')](_0xb00b('0x2a'),_0x15d3b9+'-'+_0x22c22d+'/'+_0x1f14fa)[_0xb00b('0x2b')](_0x550587);}return null;};}function patchUpdates(_0x183233){return function(_0x303625){try{jsonpatch[_0xb00b('0x2c')](_0x303625,_0x183233,!![]);}catch(_0x2e160a){return BPromise[_0xb00b('0x2d')](_0x2e160a);}return _0x303625[_0xb00b('0x2e')]();};}function saveUpdates(_0x54e247,_0x2b5f41){return function(_0x44918d){if(_0x44918d){return _0x44918d['update'](_0x54e247)[_0xb00b('0x2f')](function(_0x2f3b37){return _0x2f3b37;});}return null;};}function removeEntity(_0x5a5e5a,_0x456241){return function(_0x4d2ee5){if(_0x4d2ee5){return _0x4d2ee5[_0xb00b('0x30')]()[_0xb00b('0x2f')](function(){var _0x322879=_0x4d2ee5[_0xb00b('0x31')]({'plain':!![]});var _0x338864=_0xb00b('0x32');return db[_0xb00b('0x33')]['destroy']({'where':{'type':_0x338864,'resourceId':_0x322879['id']}})['then'](function(){return _0x4d2ee5;});})['then'](function(){_0x5a5e5a[_0xb00b('0x34')](0xcc)[_0xb00b('0x24')]();});}};}function handleEntityNotFound(_0x45dcda,_0x2589cb){return function(_0x5cfa60){if(!_0x5cfa60){_0x45dcda[_0xb00b('0x23')](0x194);}return _0x5cfa60;};}function handleError(_0x266f8e,_0x341f46){_0x341f46=_0x341f46||0x1f4;return function(_0x1c7a9f){logger[_0xb00b('0x1e')](_0x1c7a9f[_0xb00b('0x35')]);if(_0x1c7a9f[_0xb00b('0x36')]){delete _0x1c7a9f[_0xb00b('0x36')];}_0x266f8e['status'](_0x341f46)['send'](_0x1c7a9f);};}exports[_0xb00b('0x37')]=function(_0x56022e,_0x1c8258){var _0x1c5400={},_0x29579b={},_0x45ca74={'count':0x0,'rows':[]};var _0x37c017=_[_0xb00b('0x38')](db[_0xb00b('0x39')]['rawAttributes'],function(_0x35f1ca){return{'name':_0x35f1ca[_0xb00b('0x3a')],'type':_0x35f1ca[_0xb00b('0x3b')][_0xb00b('0x3c')]};});_0x29579b[_0xb00b('0x3d')]=_[_0xb00b('0x38')](_0x37c017,'name');_0x29579b[_0xb00b('0x3e')]=_[_0xb00b('0x3f')](_0x56022e['query']);_0x29579b[_0xb00b('0x40')]=_[_0xb00b('0x41')](_0x29579b[_0xb00b('0x3d')],_0x29579b[_0xb00b('0x3e')]);_0x1c5400[_0xb00b('0x42')]=_['intersection'](_0x29579b[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x1c5400['attributes']=_0x1c5400['attributes'][_0xb00b('0x44')]?_0x1c5400[_0xb00b('0x42')]:_0x29579b[_0xb00b('0x3d')];if(!_0x56022e[_0xb00b('0x3e')][_0xb00b('0x45')](_0xb00b('0x46'))){_0x1c5400[_0xb00b('0x27')]=qs['limit'](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x27')]);_0x1c5400[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x25')]);}_0x1c5400[_0xb00b('0x47')]=qs[_0xb00b('0x48')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x48')]);_0x1c5400[_0xb00b('0x49')]=qs[_0xb00b('0x40')](_['pick'](_0x56022e[_0xb00b('0x3e')],_0x29579b[_0xb00b('0x40')]),_0x37c017);if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4a')]){_0x1c5400[_0xb00b('0x49')]=_[_0xb00b('0x4b')](_0x1c5400[_0xb00b('0x49')],{'$or':_[_0xb00b('0x38')](_0x37c017,function(_0x10ba60){if(_0x10ba60[_0xb00b('0x3b')]!==_0xb00b('0x4c')){var _0x3b3031={};_0x3b3031[_0x10ba60['name']]={'$like':'%'+_0x56022e['query']['filter']+'%'};return _0x3b3031;}})});}_0x1c5400=_[_0xb00b('0x4b')]({},_0x1c5400,_0x56022e[_0xb00b('0x4d')]);var _0x481154={'where':_0x1c5400[_0xb00b('0x49')]};return db[_0xb00b('0x39')][_0xb00b('0x28')](_0x481154)[_0xb00b('0x2f')](function(_0x4b62b3){_0x45ca74['count']=_0x4b62b3;if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x1c5400['include']=[{'all':!![]}];}return db['Trunk'][_0xb00b('0x4f')](_0x1c5400);})[_0xb00b('0x2f')](function(_0x4e0be4){_0x45ca74[_0xb00b('0x50')]=_0x4e0be4;return _0x45ca74;})['then'](respondWithFilteredResult(_0x1c8258,_0x1c5400))['catch'](handleError(_0x1c8258,null));};exports['show']=function(_0x465d90,_0x481515){var _0x1f7b86={'raw':![],'where':{'id':_0x465d90[_0xb00b('0x51')]['id']}},_0x3178aa={};_0x3178aa[_0xb00b('0x3d')]=_[_0xb00b('0x3f')](db[_0xb00b('0x39')]['rawAttributes']);_0x3178aa['query']=_[_0xb00b('0x3f')](_0x465d90[_0xb00b('0x3e')]);_0x3178aa['filters']=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],_0x3178aa['query']);_0x1f7b86[_0xb00b('0x42')]=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],qs['fields'](_0x465d90['query'][_0xb00b('0x43')]));_0x1f7b86[_0xb00b('0x42')]=_0x1f7b86[_0xb00b('0x42')][_0xb00b('0x44')]?_0x1f7b86['attributes']:_0x3178aa[_0xb00b('0x3d')];if(_0x465d90[_0xb00b('0x3e')]['includeAll']){_0x1f7b86['include']=[{'all':!![]}];}_0x1f7b86=_[_0xb00b('0x4b')]({},_0x1f7b86,_0x465d90['options']);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x1f7b86)[_0xb00b('0x2f')](handleEntityNotFound(_0x481515,null))[_0xb00b('0x2f')](respondWithResult(_0x481515,null))[_0xb00b('0x22')](handleError(_0x481515,null));};exports[_0xb00b('0x53')]=function(_0x5a3b85,_0x5d52a5){var _0x51c9e3={'where':{'id':_0x5a3b85[_0xb00b('0x51')]['id']}},_0x37d4d2={};_0x37d4d2[_0xb00b('0x3d')]=_['keys'](db[_0xb00b('0x39')][_0xb00b('0x54')]);_0x51c9e3[_0xb00b('0x42')]=_['intersection'](_0x37d4d2[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x51c9e3[_0xb00b('0x42')]=_0x51c9e3[_0xb00b('0x42')][_0xb00b('0x44')]?_0x51c9e3[_0xb00b('0x42')]:_0x37d4d2['model'];if(_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x51c9e3[_0xb00b('0x55')]=[{'all':!![]}];}_0x51c9e3=_['merge']({},_0x51c9e3,_0x5a3b85[_0xb00b('0x4d')]);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x51c9e3)[_0xb00b('0x2f')](handleEntityNotFound(_0x5d52a5,null))[_0xb00b('0x2f')](function(_0x4bfe0b){if(_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b[_0xb00b('0x31')]({'plain':!![]});_0xfd4ecc=qs[_0xb00b('0x56')](_0xfd4ecc,['id',_0xb00b('0x57'),'updatedAt']);_0x5a3b85[_0xb00b('0x58')]=_[_0xb00b('0x56')](_0x5a3b85[_0xb00b('0x58')],['id',_0xb00b('0x57'),_0xb00b('0x59')]);return db[_0xb00b('0x39')][_0xb00b('0x5a')](_['merge'](_0xfd4ecc,_0x5a3b85[_0xb00b('0x58')]),{'include':_0x5a3b85['query'][_0xb00b('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x3b3272){var _0x530d4a=_0x5a3b85[_0xb00b('0x5b')]['get']({'plain':!![]});if(!_0x530d4a)throw new Error(_0xb00b('0x5c'));if(_0x530d4a[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x4d1cec=_0x3b3272['get']({'plain':!![]});var _0x4f7a59=_0xb00b('0x32');return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0x4f7a59,'userProfileId':_0x530d4a['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37ae88){if(_0x37ae88&&_0x37ae88[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x4d1cec['name'],'resourceId':_0x4d1cec['id'],'type':_0x37ae88[_0xb00b('0x36')],'sectionId':_0x37ae88['id']},{})[_0xb00b('0x2f')](function(){return _0x3b3272;});}else{return _0x3b3272;}})['catch'](function(_0xe1316d){logger[_0xb00b('0x1e')](_0xb00b('0x60'),_0xe1316d);throw _0xe1316d;});}return _0x3b3272;});}})['then'](respondWithResult(_0x5d52a5,0xc9))['catch'](handleError(_0x5d52a5,null));};exports[_0xb00b('0x5a')]=function(_0x188da7,_0x23762e,_0x49f0a2){var _0x5aac5f;return db['Trunk']['create'](_0x188da7[_0xb00b('0x58')],{'raw':!![]})['then'](function(_0x2434a0){_0x5aac5f=_0x2434a0;return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x1e7f3a){var _0x2d21ec=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0x3d4482=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config[_0xb00b('0x65')],_0xb00b('0x66')),'utf8');var _0x27b3ae=ejs[_0xb00b('0x67')](_0x2d21ec,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x27b3ae);if(_0x5aac5f[_0xb00b('0x6a')]){var _0x432b68=ejs[_0xb00b('0x67')](_0x3d4482,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x432b68);}})[_0xb00b('0x2f')](function(){return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x5a'),{'module':_0xb00b('0x6c')});})[_0xb00b('0x2f')](function(){var _0xfb2b68=_0x188da7[_0xb00b('0x5b')][_0xb00b('0x31')]({'plain':!![]});if(!_0xfb2b68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfb2b68[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x7803a0=_0x5aac5f[_0xb00b('0x31')]({'plain':!![]});return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0xb00b('0x32'),'userProfileId':_0xfb2b68['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37a4c0){if(_0x37a4c0&&_0x37a4c0[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x7803a0[_0xb00b('0x36')],'resourceId':_0x7803a0['id'],'type':_0x37a4c0['name'],'sectionId':_0x37a4c0['id']},{})[_0xb00b('0x2f')](function(){return _0x5aac5f;});}else{return _0x5aac5f;}})['catch'](function(_0x135cbf){logger['error'](_0xb00b('0x60'),_0x135cbf);throw _0x135cbf;});}return _0x5aac5f;})[_0xb00b('0x2f')](respondWithResult(_0x23762e,0xc9))[_0xb00b('0x22')](handleError(_0x23762e,null));};exports['update']=function(_0x5287cc,_0x9ad1c6,_0x3c4850){var _0x33a483;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0x5287cc[_0xb00b('0x51')]['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x9ad1c6,null))[_0xb00b('0x2f')](saveUpdates(_0x5287cc[_0xb00b('0x58')],null))[_0xb00b('0x2f')](function(_0x257430){if(_0x257430){_0x33a483=_0x257430;return db[_0xb00b('0x39')][_0xb00b('0x4f')]({'raw':!![]});}})[_0xb00b('0x2f')](function(_0x4eb17d){if(_0x4eb17d){var _0x59503c=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],'server/files/templates/trunk.ejs'),_0xb00b('0x64'));var _0x391e98=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],_0xb00b('0x66')),_0xb00b('0x64'));var _0x45c9cd=ejs[_0xb00b('0x67')](_0x59503c,{'trunks':_0x4eb17d||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x45c9cd);var _0x4a9125=ejs[_0xb00b('0x67')](_0x391e98,{'trunks':_0x4eb17d||[]});fs['writeFileSync'](_0xb00b('0x6d'),_0x4a9125);return respondWithRpcPromise(_0xb00b('0x6b'),'update',{'module':_0xb00b('0x6c')});}return null;})[_0xb00b('0x2f')](function(_0xe80a21){if(_0xe80a21){return _0x33a483;}})[_0xb00b('0x2f')](respondWithResult(_0x9ad1c6,null))[_0xb00b('0x22')](handleError(_0x9ad1c6,null));};exports[_0xb00b('0x30')]=function(_0xc41c1f,_0x2423b2,_0x36ba5c){var _0x383d16;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0xc41c1f['params']['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x2423b2,null))[_0xb00b('0x2f')](removeEntity(_0x2423b2,null))[_0xb00b('0x2f')](function(){return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x17503d){var _0x32508b=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0xa4fe1e=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],'server/files/templates/registry.ejs'),_0xb00b('0x64'));var _0x202d5f=ejs[_0xb00b('0x67')](_0x32508b,{'trunks':_0x17503d});var _0x165442=ejs[_0xb00b('0x67')](_0xa4fe1e,{'trunks':_0x17503d});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x202d5f);fs[_0xb00b('0x68')](_0xb00b('0x6d'),_0x165442);return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x30'),{'module':'chan_sip.so'});})[_0xb00b('0x22')](handleError(_0x2423b2,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 0b76d64..97f68f9 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 _0x00e7=['request-promise','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','moment'];(function(_0x33773c,_0xf80333){var _0x3d2463=function(_0x449f33){while(--_0x449f33){_0x33773c['push'](_0x33773c['shift']());}};_0x3d2463(++_0xf80333);}(_0x00e7,0xa4));var _0x700e=function(_0x45ce90,_0x114609){_0x45ce90=_0x45ce90-0x0;var _0x313c45=_0x00e7[_0x45ce90];return _0x313c45;};'use strict';var _=require(_0x700e('0x0'));var util=require(_0x700e('0x1'));var logger=require(_0x700e('0x2'))('api');var moment=require(_0x700e('0x3'));var BPromise=require('bluebird');var rp=require(_0x700e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x700e('0x5'));var config=require(_0x700e('0x6'));var attributes=require(_0x700e('0x7'));module[_0x700e('0x8')]=function(_0x3ad687,_0x289eae){return _0x3ad687[_0x700e('0x9')](_0x700e('0xa'),attributes,{'tableName':_0x700e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3bd=['define','Trunk','tools_trunks','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports'];(function(_0x13c19c,_0x1d4a84){var _0x594ee4=function(_0x326bb8){while(--_0x326bb8){_0x13c19c['push'](_0x13c19c['shift']());}};_0x594ee4(++_0x1d4a84);}(_0xd3bd,0xb9));var _0xdd3b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd3bd[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdd3b('0x0'))(_0xdd3b('0x1'));var moment=require(_0xdd3b('0x2'));var BPromise=require(_0xdd3b('0x3'));var rp=require(_0xdd3b('0x4'));var fs=require('fs');var path=require(_0xdd3b('0x5'));var rimraf=require(_0xdd3b('0x6'));var config=require(_0xdd3b('0x7'));var attributes=require(_0xdd3b('0x8'));module[_0xdd3b('0x9')]=function(_0x4ebb03,_0x408254){return _0x4ebb03[_0xdd3b('0xa')](_0xdd3b('0xb'),attributes,{'tableName':_0xdd3b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index ea229c4..d8728f2 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 _0x04f1=['GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','model','map','include','catch','ShowTrunk','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','http','request','then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','result'];(function(_0x2925da,_0x588053){var _0x59882e=function(_0x4faf14){while(--_0x4faf14){_0x2925da['push'](_0x2925da['shift']());}};_0x59882e(++_0x588053);}(_0x04f1,0x92));var _0x104f=function(_0x27302b,_0xf9fe45){_0x27302b=_0x27302b-0x0;var _0x23c84f=_0x04f1[_0x27302b];return _0x23c84f;};'use strict';var _=require(_0x104f('0x0'));var util=require(_0x104f('0x1'));var moment=require(_0x104f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x104f('0x3'));var db=require(_0x104f('0x4'))['db'];var utils=require(_0x104f('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x104f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x289bb8,_0x5b7110,_0x1d5651){return new BPromise(function(_0x57acf5,_0x47582b){return client[_0x104f('0x7')](_0x289bb8,_0x1d5651)[_0x104f('0x8')](function(_0x37891c){logger['info']('Trunk,\x20%s,\x20%s',_0x5b7110,_0x104f('0x9'));logger[_0x104f('0xa')](_0x104f('0xb'),_0x5b7110,_0x104f('0x9'),JSON[_0x104f('0xc')](_0x37891c));if(_0x37891c[_0x104f('0xd')]){if(_0x37891c[_0x104f('0xd')][_0x104f('0xe')]===0x1f4){logger[_0x104f('0xd')](_0x104f('0xf'),_0x5b7110,_0x37891c['error'][_0x104f('0x10')]);return _0x47582b(_0x37891c[_0x104f('0xd')][_0x104f('0x10')]);}logger[_0x104f('0xd')](_0x104f('0xf'),_0x5b7110,_0x37891c[_0x104f('0xd')][_0x104f('0x10')]);return _0x57acf5(_0x37891c[_0x104f('0xd')][_0x104f('0x10')]);}else{logger[_0x104f('0x11')](_0x104f('0xf'),_0x5b7110,_0x104f('0x9'));_0x57acf5(_0x37891c[_0x104f('0x12')][_0x104f('0x10')]);}})['catch'](function(_0x12b9a6){logger[_0x104f('0xd')](_0x104f('0xf'),_0x5b7110,_0x12b9a6);_0x47582b(_0x12b9a6);});});}exports[_0x104f('0x13')]=function(_0x50fdd3){var _0x394255=this;return new Promise(function(_0x27a345,_0x570a14){return db[_0x104f('0x14')][_0x104f('0x15')]({'raw':_0x50fdd3['options']?_0x50fdd3[_0x104f('0x16')][_0x104f('0x17')]===undefined?!![]:![]:!![],'where':_0x50fdd3[_0x104f('0x16')]?_0x50fdd3[_0x104f('0x16')][_0x104f('0x18')]||null:null,'attributes':_0x50fdd3[_0x104f('0x16')]?_0x50fdd3['options'][_0x104f('0x19')]||null:null,'limit':_0x50fdd3['options']?_0x50fdd3['options'][_0x104f('0x1a')]||null:null,'include':_0x50fdd3[_0x104f('0x16')]?_0x50fdd3[_0x104f('0x16')]['include']?_['map'](_0x50fdd3[_0x104f('0x16')]['include'],function(_0x16abbd){return{'model':db[_0x16abbd[_0x104f('0x1b')]],'as':_0x16abbd['as'],'attributes':_0x16abbd[_0x104f('0x19')],'include':_0x16abbd['include']?_[_0x104f('0x1c')](_0x16abbd['include'],function(_0x19ddc1){return{'model':db[_0x19ddc1[_0x104f('0x1b')]],'as':_0x19ddc1['as'],'attributes':_0x19ddc1[_0x104f('0x19')],'include':_0x19ddc1['include']?_[_0x104f('0x1c')](_0x19ddc1[_0x104f('0x1d')],function(_0x307a45){return{'model':db[_0x307a45[_0x104f('0x1b')]],'as':_0x307a45['as'],'attributes':_0x307a45['attributes']};}):[]};}):[]};}):[]:[]})[_0x104f('0x8')](function(_0x48261e){logger[_0x104f('0x11')](_0x104f('0x13'),_0x50fdd3);logger['debug'](_0x104f('0x13'),_0x50fdd3,JSON['stringify'](_0x48261e));_0x27a345(_0x48261e);})[_0x104f('0x1e')](function(_0x202993){logger[_0x104f('0xd')](_0x104f('0x13'),_0x202993[_0x104f('0x10')],_0x50fdd3);_0x570a14(_0x394255[_0x104f('0xd')](0x1f4,_0x202993[_0x104f('0x10')]));});});};exports[_0x104f('0x1f')]=function(_0x1c396e){var _0x7824d0=this;return new Promise(function(_0x524196,_0x55d63c){return db[_0x104f('0x14')][_0x104f('0x20')]({'raw':_0x1c396e[_0x104f('0x16')]?_0x1c396e[_0x104f('0x16')][_0x104f('0x17')]===undefined?!![]:![]:!![],'where':_0x1c396e[_0x104f('0x16')]?_0x1c396e['options']['where']||null:null,'attributes':_0x1c396e[_0x104f('0x16')]?_0x1c396e[_0x104f('0x16')][_0x104f('0x19')]||null:null,'include':_0x1c396e[_0x104f('0x16')]?_0x1c396e[_0x104f('0x16')][_0x104f('0x1d')]?_['map'](_0x1c396e['options']['include'],function(_0xbf612e){return{'model':db[_0xbf612e[_0x104f('0x1b')]],'as':_0xbf612e['as'],'attributes':_0xbf612e['attributes'],'include':_0xbf612e[_0x104f('0x1d')]?_['map'](_0xbf612e['include'],function(_0x30198d){return{'model':db[_0x30198d['model']],'as':_0x30198d['as'],'attributes':_0x30198d['attributes'],'include':_0x30198d['include']?_[_0x104f('0x1c')](_0x30198d['include'],function(_0xab2121){return{'model':db[_0xab2121[_0x104f('0x1b')]],'as':_0xab2121['as'],'attributes':_0xab2121['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bf2e0){logger['info'](_0x104f('0x1f'),_0x1c396e);logger[_0x104f('0xa')]('ShowTrunk',_0x1c396e,JSON[_0x104f('0xc')](_0x2bf2e0));_0x524196(_0x2bf2e0);})['catch'](function(_0x56b86c){logger['error'](_0x104f('0x1f'),_0x56b86c[_0x104f('0x10')],_0x1c396e);_0x55d63c(_0x7824d0['error'](0x1f4,_0x56b86c['message']));});});}; \ No newline at end of file +var _0xe970=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Trunk','findAll','options','raw','where','attributes','map','include','model','GetTrunk','stringify','ShowTrunk','lodash'];(function(_0x53984d,_0x3a6e47){var _0x4ef422=function(_0x48962f){while(--_0x48962f){_0x53984d['push'](_0x53984d['shift']());}};_0x4ef422(++_0x3a6e47);}(_0xe970,0x18b));var _0x0e97=function(_0x9cc204,_0x5074b7){_0x9cc204=_0x9cc204-0x0;var _0x13a8ba=_0xe970[_0x9cc204];return _0x13a8ba;};'use strict';var _=require(_0x0e97('0x0'));var util=require(_0x0e97('0x1'));var moment=require(_0x0e97('0x2'));var BPromise=require(_0x0e97('0x3'));var rs=require(_0x0e97('0x4'));var fs=require('fs');var Redis=require(_0x0e97('0x5'));var db=require(_0x0e97('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0e97('0x7'))(_0x0e97('0x8'));var config=require('../../config/environment');var jayson=require(_0x0e97('0x9'));var client=jayson[_0x0e97('0xa')][_0x0e97('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x314db8,_0x3a1181,_0x22fb97){return new BPromise(function(_0xd3a9ba,_0x3090d0){return client[_0x0e97('0xc')](_0x314db8,_0x22fb97)[_0x0e97('0xd')](function(_0x4b6d3e){logger[_0x0e97('0xe')](_0x0e97('0xf'),_0x3a1181,_0x0e97('0x10'));logger[_0x0e97('0x11')](_0x0e97('0x12'),_0x3a1181,_0x0e97('0x10'),JSON['stringify'](_0x4b6d3e));if(_0x4b6d3e['error']){if(_0x4b6d3e[_0x0e97('0x13')][_0x0e97('0x14')]===0x1f4){logger[_0x0e97('0x13')](_0x0e97('0xf'),_0x3a1181,_0x4b6d3e[_0x0e97('0x13')][_0x0e97('0x15')]);return _0x3090d0(_0x4b6d3e['error'][_0x0e97('0x15')]);}logger[_0x0e97('0x13')](_0x0e97('0xf'),_0x3a1181,_0x4b6d3e['error'][_0x0e97('0x15')]);return _0xd3a9ba(_0x4b6d3e[_0x0e97('0x13')]['message']);}else{logger[_0x0e97('0xe')](_0x0e97('0xf'),_0x3a1181,_0x0e97('0x10'));_0xd3a9ba(_0x4b6d3e[_0x0e97('0x16')][_0x0e97('0x15')]);}})[_0x0e97('0x17')](function(_0x2bfe9f){logger[_0x0e97('0x13')]('Trunk,\x20%s,\x20%s',_0x3a1181,_0x2bfe9f);_0x3090d0(_0x2bfe9f);});});}exports['GetTrunk']=function(_0xa6e9a){var _0x44da5a=this;return new Promise(function(_0x58c592,_0x5f592b){return db[_0x0e97('0x18')][_0x0e97('0x19')]({'raw':_0xa6e9a[_0x0e97('0x1a')]?_0xa6e9a[_0x0e97('0x1a')][_0x0e97('0x1b')]===undefined?!![]:![]:!![],'where':_0xa6e9a[_0x0e97('0x1a')]?_0xa6e9a[_0x0e97('0x1a')][_0x0e97('0x1c')]||null:null,'attributes':_0xa6e9a[_0x0e97('0x1a')]?_0xa6e9a[_0x0e97('0x1a')][_0x0e97('0x1d')]||null:null,'limit':_0xa6e9a[_0x0e97('0x1a')]?_0xa6e9a['options']['limit']||null:null,'include':_0xa6e9a[_0x0e97('0x1a')]?_0xa6e9a[_0x0e97('0x1a')]['include']?_[_0x0e97('0x1e')](_0xa6e9a[_0x0e97('0x1a')][_0x0e97('0x1f')],function(_0x1e7bc8){return{'model':db[_0x1e7bc8[_0x0e97('0x20')]],'as':_0x1e7bc8['as'],'attributes':_0x1e7bc8[_0x0e97('0x1d')],'include':_0x1e7bc8['include']?_[_0x0e97('0x1e')](_0x1e7bc8[_0x0e97('0x1f')],function(_0x14034f){return{'model':db[_0x14034f[_0x0e97('0x20')]],'as':_0x14034f['as'],'attributes':_0x14034f[_0x0e97('0x1d')],'include':_0x14034f[_0x0e97('0x1f')]?_[_0x0e97('0x1e')](_0x14034f[_0x0e97('0x1f')],function(_0x158e43){return{'model':db[_0x158e43[_0x0e97('0x20')]],'as':_0x158e43['as'],'attributes':_0x158e43['attributes']};}):[]};}):[]};}):[]:[]})[_0x0e97('0xd')](function(_0x54249a){logger[_0x0e97('0xe')]('GetTrunk',_0xa6e9a);logger['debug'](_0x0e97('0x21'),_0xa6e9a,JSON[_0x0e97('0x22')](_0x54249a));_0x58c592(_0x54249a);})[_0x0e97('0x17')](function(_0x48266c){logger['error'](_0x0e97('0x21'),_0x48266c[_0x0e97('0x15')],_0xa6e9a);_0x5f592b(_0x44da5a[_0x0e97('0x13')](0x1f4,_0x48266c[_0x0e97('0x15')]));});});};exports['ShowTrunk']=function(_0x8ccbd5){var _0x374b2f=this;return new Promise(function(_0x1e300f,_0x40624d){return db[_0x0e97('0x18')]['find']({'raw':_0x8ccbd5['options']?_0x8ccbd5['options'][_0x0e97('0x1b')]===undefined?!![]:![]:!![],'where':_0x8ccbd5[_0x0e97('0x1a')]?_0x8ccbd5[_0x0e97('0x1a')]['where']||null:null,'attributes':_0x8ccbd5[_0x0e97('0x1a')]?_0x8ccbd5['options'][_0x0e97('0x1d')]||null:null,'include':_0x8ccbd5[_0x0e97('0x1a')]?_0x8ccbd5[_0x0e97('0x1a')][_0x0e97('0x1f')]?_[_0x0e97('0x1e')](_0x8ccbd5[_0x0e97('0x1a')][_0x0e97('0x1f')],function(_0x5cbc6b){return{'model':db[_0x5cbc6b[_0x0e97('0x20')]],'as':_0x5cbc6b['as'],'attributes':_0x5cbc6b[_0x0e97('0x1d')],'include':_0x5cbc6b[_0x0e97('0x1f')]?_[_0x0e97('0x1e')](_0x5cbc6b[_0x0e97('0x1f')],function(_0x1da529){return{'model':db[_0x1da529[_0x0e97('0x20')]],'as':_0x1da529['as'],'attributes':_0x1da529[_0x0e97('0x1d')],'include':_0x1da529[_0x0e97('0x1f')]?_[_0x0e97('0x1e')](_0x1da529[_0x0e97('0x1f')],function(_0x230b6c){return{'model':db[_0x230b6c[_0x0e97('0x20')]],'as':_0x230b6c['as'],'attributes':_0x230b6c[_0x0e97('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0e97('0xd')](function(_0x55d0a6){logger['info'](_0x0e97('0x23'),_0x8ccbd5);logger[_0x0e97('0x11')](_0x0e97('0x23'),_0x8ccbd5,JSON[_0x0e97('0x22')](_0x55d0a6));_0x1e300f(_0x55d0a6);})[_0x0e97('0x17')](function(_0xe1d5f1){logger[_0x0e97('0x13')](_0x0e97('0x23'),_0xe1d5f1[_0x0e97('0x15')],_0x8ccbd5);_0x40624d(_0x374b2f['error'](0x1f4,_0xe1d5f1['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 57254b3..dde14ab 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 _0x5452=['addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id','put','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','create','bulkCreate','diskStorage','join','root','format','%s-%s','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts'];(function(_0x143f48,_0x42934d){var _0x4ddde4=function(_0x29e77f){while(--_0x29e77f){_0x143f48['push'](_0x143f48['shift']());}};_0x4ddde4(++_0x42934d);}(_0x5452,0x16a));var _0x2545=function(_0x44d1e8,_0x49958e){_0x44d1e8=_0x44d1e8-0x0;var _0xc8e116=_0x5452[_0x44d1e8];return _0xc8e116;};'use strict';var multer=require(_0x2545('0x0'));var util=require('util');var path=require(_0x2545('0x1'));var timeout=require('connect-timeout');var express=require(_0x2545('0x2'));var router=express[_0x2545('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2545('0x4'));var interaction=require(_0x2545('0x5'));var config=require(_0x2545('0x6'));var controller=require(_0x2545('0x7'));router[_0x2545('0x8')]('/',auth[_0x2545('0x9')](),controller[_0x2545('0xa')]);router[_0x2545('0x8')](_0x2545('0xb'),auth['isAuthenticated'](),controller[_0x2545('0xc')]);router['get'](_0x2545('0xd'),auth['isAuthenticated'](),controller[_0x2545('0xe')]);router[_0x2545('0x8')]('/presence',auth[_0x2545('0x9')](),controller['getPresence']);router[_0x2545('0x8')]('/:id',auth[_0x2545('0x9')](),controller['show']);router[_0x2545('0x8')]('/:id/avatar',controller[_0x2545('0xf')]);router[_0x2545('0x8')]('/:id/open_tabs',auth['isAuthenticated'](),controller['getOpenTabs']);router[_0x2545('0x8')](_0x2545('0x10'),auth[_0x2545('0x9')](),controller[_0x2545('0x11')]);router[_0x2545('0x8')](_0x2545('0x12'),auth[_0x2545('0x9')](),controller[_0x2545('0x13')]);router[_0x2545('0x8')](_0x2545('0x14'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x2545('0x8')](_0x2545('0x15'),auth[_0x2545('0x9')](),controller[_0x2545('0x16')]);router[_0x2545('0x8')]('/:id/recordings',auth[_0x2545('0x9')](),controller[_0x2545('0x17')]);router['get'](_0x2545('0x18'),auth[_0x2545('0x9')](),controller['getScreenRecordings']);router[_0x2545('0x8')]('/:id/chat/interactions',auth[_0x2545('0x9')](),controller[_0x2545('0x19')]);router[_0x2545('0x8')](_0x2545('0x1a'),auth[_0x2545('0x9')](),controller[_0x2545('0x1b')]);router[_0x2545('0x8')](_0x2545('0x1c'),auth[_0x2545('0x9')](),controller[_0x2545('0x1d')]);router[_0x2545('0x8')](_0x2545('0x1e'),auth[_0x2545('0x9')](),controller[_0x2545('0x1f')]);router[_0x2545('0x8')](_0x2545('0x20'),auth[_0x2545('0x9')](),controller[_0x2545('0x21')]);router[_0x2545('0x8')](_0x2545('0x22'),auth[_0x2545('0x9')](),controller[_0x2545('0x23')]);router[_0x2545('0x8')](_0x2545('0x24'),auth[_0x2545('0x9')](),controller[_0x2545('0x25')]);router['get']('/:id/lists',auth[_0x2545('0x9')](),controller['getLists']);router[_0x2545('0x8')]('/:id/agents',auth['isAuthenticated'](),controller[_0x2545('0x26')]);router[_0x2545('0x8')](_0x2545('0x27'),auth[_0x2545('0x9')](),controller[_0x2545('0x28')]);router[_0x2545('0x8')](_0x2545('0x29'),auth[_0x2545('0x9')](),controller[_0x2545('0x2a')]);router[_0x2545('0x8')](_0x2545('0x2b'),auth[_0x2545('0x9')](),controller[_0x2545('0x2c')]);router[_0x2545('0x8')](_0x2545('0x2d'),auth[_0x2545('0x9')](),controller['getOpenchannelAccounts']);router[_0x2545('0x8')](_0x2545('0x2e'),auth['isAuthenticated'](),controller[_0x2545('0x2f')]);router[_0x2545('0x8')](_0x2545('0x30'),auth['isAuthenticated'](),controller[_0x2545('0x31')]);router['get'](_0x2545('0x32'),auth['isAuthenticated'](),controller[_0x2545('0x33')]);router[_0x2545('0x8')](_0x2545('0x34'),auth[_0x2545('0x9')](),controller[_0x2545('0x35')]);router[_0x2545('0x8')]('/:id/scheduled_calls',auth[_0x2545('0x9')](),controller[_0x2545('0x36')]);router['get'](_0x2545('0x37'),auth['isAuthenticated'](),controller[_0x2545('0x38')]);router[_0x2545('0x39')](_0x2545('0x10'),auth[_0x2545('0x9')](),controller['addContacts']);router[_0x2545('0x39')]('/',auth[_0x2545('0x9')](),controller[_0x2545('0x3a')]);router[_0x2545('0x39')]('/create_many',auth[_0x2545('0x9')](),controller[_0x2545('0x3b')]);router['post']('/:id/queues',auth[_0x2545('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0x2545('0x3c')]({'destination':function(_0x143240,_0x5384ba,_0x5d013f){_0x5d013f(null,path[_0x2545('0x3d')](config[_0x2545('0x3e')],'server/files/images/'));},'filename':function(_0x557ff3,_0xa4a5,_0x405c73){_0x405c73(null,util[_0x2545('0x3f')](_0x2545('0x40'),Date['now'](),_0xa4a5[_0x2545('0x41')]));}})});router[_0x2545('0x39')](_0x2545('0x42'),upload[_0x2545('0x43')](_0x2545('0x44')),controller[_0x2545('0x45')]);router[_0x2545('0x39')](_0x2545('0x46'),auth[_0x2545('0x9')](),controller[_0x2545('0x47')]);router[_0x2545('0x39')](_0x2545('0x48'),auth[_0x2545('0x9')](),controller[_0x2545('0x49')]);router[_0x2545('0x39')](_0x2545('0x4a'),auth['isAuthenticated'](),controller['pause']);router[_0x2545('0x39')](_0x2545('0x4b'),auth[_0x2545('0x9')](),controller[_0x2545('0x4c')]);router[_0x2545('0x39')](_0x2545('0x24'),auth[_0x2545('0x9')](),controller['addTeams']);router[_0x2545('0x39')](_0x2545('0x4d'),auth[_0x2545('0x9')](),controller[_0x2545('0x4e')]);router['post'](_0x2545('0x4f'),auth['isAuthenticated'](),controller[_0x2545('0x50')]);router['post']('/:id/fax_interactions',auth[_0x2545('0x9')](),controller[_0x2545('0x51')]);router['post'](_0x2545('0x52'),auth[_0x2545('0x9')](),controller[_0x2545('0x53')]);router[_0x2545('0x39')]('/:id/openchannel_interactions',auth[_0x2545('0x9')](),controller[_0x2545('0x54')]);router[_0x2545('0x39')](_0x2545('0x55'),auth[_0x2545('0x9')](),controller[_0x2545('0x56')]);router[_0x2545('0x39')](_0x2545('0x29'),auth[_0x2545('0x9')](),controller[_0x2545('0x57')]);router['post']('/:id/mail_accounts',auth[_0x2545('0x9')](),controller[_0x2545('0x58')]);router[_0x2545('0x39')](_0x2545('0x2d'),auth[_0x2545('0x9')](),controller[_0x2545('0x59')]);router[_0x2545('0x39')](_0x2545('0x2e'),auth[_0x2545('0x9')](),controller[_0x2545('0x5a')]);router[_0x2545('0x39')](_0x2545('0x30'),auth[_0x2545('0x9')](),controller[_0x2545('0x5b')]);router[_0x2545('0x39')](_0x2545('0x32'),auth[_0x2545('0x9')](),controller[_0x2545('0x5c')]);router['post'](_0x2545('0x34'),auth[_0x2545('0x9')](),controller[_0x2545('0x5d')]);router['post'](_0x2545('0x37'),auth['isAuthenticated'](),controller['createApiKey']);router['put'](_0x2545('0x5e'),auth[_0x2545('0x9')](),controller['update']);router[_0x2545('0x5f')](_0x2545('0x60'),auth[_0x2545('0x9')](),controller[_0x2545('0x61')]);router['delete'](_0x2545('0x12'),auth['isAuthenticated'](),controller[_0x2545('0x62')]);router[_0x2545('0x63')](_0x2545('0x24'),auth[_0x2545('0x9')](),controller[_0x2545('0x64')]);router['delete'](_0x2545('0x5e'),auth[_0x2545('0x9')](),controller[_0x2545('0x65')]);router[_0x2545('0x63')](_0x2545('0x4d'),auth[_0x2545('0x9')](),controller[_0x2545('0x66')]);router[_0x2545('0x63')](_0x2545('0x4f'),auth[_0x2545('0x9')](),controller[_0x2545('0x67')]);router[_0x2545('0x63')](_0x2545('0x68'),auth[_0x2545('0x9')](),controller[_0x2545('0x69')]);router[_0x2545('0x63')](_0x2545('0x52'),auth[_0x2545('0x9')](),controller['removeSmsInteractions']);router[_0x2545('0x63')](_0x2545('0x6a'),auth['isAuthenticated'](),controller[_0x2545('0x6b')]);router['delete'](_0x2545('0x55'),auth[_0x2545('0x9')](),controller['removeWhatsappInteractions']);router['delete'](_0x2545('0x29'),auth[_0x2545('0x9')](),controller[_0x2545('0x6c')]);router['delete'](_0x2545('0x2b'),auth[_0x2545('0x9')](),controller[_0x2545('0x6d')]);router[_0x2545('0x63')](_0x2545('0x2d'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router['delete'](_0x2545('0x2e'),auth[_0x2545('0x9')](),controller['removeSmsAccounts']);router[_0x2545('0x63')]('/:id/chat_websites',auth[_0x2545('0x9')](),controller['removeChatWebsites']);router[_0x2545('0x63')](_0x2545('0x32'),auth[_0x2545('0x9')](),controller[_0x2545('0x6e')]);router[_0x2545('0x63')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x2545('0x6f')]);router[_0x2545('0x63')](_0x2545('0x37'),auth[_0x2545('0x9')](),controller[_0x2545('0x70')]);module['exports']=router; \ No newline at end of file +var _0xb9f9=['/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','describe','/whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','/:id/agents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','/create_many','bulkCreate','post','diskStorage','join','root','server/files/images/','format','%s-%s','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addFaxInteractions','addSmsInteractions'];(function(_0x403ee7,_0x2b30d6){var _0x3d74ce=function(_0x513598){while(--_0x513598){_0x403ee7['push'](_0x403ee7['shift']());}};_0x3d74ce(++_0x2b30d6);}(_0xb9f9,0x113));var _0x9b9f=function(_0x4be2b0,_0x510c3e){_0x4be2b0=_0x4be2b0-0x0;var _0x373d00=_0xb9f9[_0x4be2b0];return _0x373d00;};'use strict';var multer=require(_0x9b9f('0x0'));var util=require('util');var path=require(_0x9b9f('0x1'));var timeout=require(_0x9b9f('0x2'));var express=require(_0x9b9f('0x3'));var router=express[_0x9b9f('0x4')]();var fs_extra=require(_0x9b9f('0x5'));var auth=require(_0x9b9f('0x6'));var interaction=require(_0x9b9f('0x7'));var config=require(_0x9b9f('0x8'));var controller=require(_0x9b9f('0x9'));router['get']('/',auth[_0x9b9f('0xa')](),controller[_0x9b9f('0xb')]);router[_0x9b9f('0xc')]('/describe',auth[_0x9b9f('0xa')](),controller[_0x9b9f('0xd')]);router[_0x9b9f('0xc')](_0x9b9f('0xe'),auth[_0x9b9f('0xa')](),controller['whoami']);router[_0x9b9f('0xc')](_0x9b9f('0xf'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x10')]);router['get'](_0x9b9f('0x11'),auth[_0x9b9f('0xa')](),controller['show']);router['get'](_0x9b9f('0x12'),controller[_0x9b9f('0x13')]);router[_0x9b9f('0xc')](_0x9b9f('0x14'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x15')]);router['get'](_0x9b9f('0x16'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x17')]);router[_0x9b9f('0xc')](_0x9b9f('0x18'),auth['isAuthenticated'](),controller[_0x9b9f('0x19')]);router[_0x9b9f('0xc')]('/:id/queues_rt',auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x1a')]);router['get'](_0x9b9f('0x1b'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x1c')]);router['get'](_0x9b9f('0x1d'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x1e')]);router['get'](_0x9b9f('0x1f'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x20')]);router[_0x9b9f('0xc')](_0x9b9f('0x21'),auth[_0x9b9f('0xa')](),controller['getChatInteractions']);router[_0x9b9f('0xc')](_0x9b9f('0x22'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x23')]);router['get'](_0x9b9f('0x24'),auth[_0x9b9f('0xa')](),controller['getMailInteractions']);router[_0x9b9f('0xc')](_0x9b9f('0x25'),auth['isAuthenticated'](),controller['getSmsInteractions']);router['get'](_0x9b9f('0x26'),auth['isAuthenticated'](),controller[_0x9b9f('0x27')]);router[_0x9b9f('0xc')](_0x9b9f('0x28'),auth[_0x9b9f('0xa')](),controller['getWhatsappInteractions']);router['get'](_0x9b9f('0x29'),auth['isAuthenticated'](),controller[_0x9b9f('0x2a')]);router[_0x9b9f('0xc')](_0x9b9f('0x2b'),auth[_0x9b9f('0xa')](),controller['getLists']);router['get'](_0x9b9f('0x2c'),auth[_0x9b9f('0xa')](),controller['getAgents']);router[_0x9b9f('0xc')](_0x9b9f('0x2d'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x2e')]);router[_0x9b9f('0xc')]('/:id/fax_accounts',auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x2f')]);router[_0x9b9f('0xc')](_0x9b9f('0x30'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x31')]);router['get']('/:id/openchannel_accounts',auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x32')]);router[_0x9b9f('0xc')](_0x9b9f('0x33'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x34')]);router[_0x9b9f('0xc')](_0x9b9f('0x35'),auth['isAuthenticated'](),controller[_0x9b9f('0x36')]);router[_0x9b9f('0xc')](_0x9b9f('0x37'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x38')]);router[_0x9b9f('0xc')]('/:id/square_projects',auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x39')]);router[_0x9b9f('0xc')](_0x9b9f('0x3a'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x3b')]);router['get'](_0x9b9f('0x3c'),auth['isAuthenticated'](),controller[_0x9b9f('0x3d')]);router['post'](_0x9b9f('0x16'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x3e')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x9b9f('0x3f'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x40')]);router[_0x9b9f('0x41')]('/:id/queues',auth[_0x9b9f('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0x9b9f('0x42')]({'destination':function(_0x2005ef,_0x58dddc,_0x93231f){_0x93231f(null,path[_0x9b9f('0x43')](config[_0x9b9f('0x44')],_0x9b9f('0x45')));},'filename':function(_0x3bb4cf,_0x56d43b,_0x237b3e){_0x237b3e(null,util[_0x9b9f('0x46')](_0x9b9f('0x47'),Date['now'](),_0x56d43b['originalname']));}})});router[_0x9b9f('0x41')](_0x9b9f('0x12'),upload[_0x9b9f('0x48')](_0x9b9f('0x49')),controller[_0x9b9f('0x4a')]);router[_0x9b9f('0x41')](_0x9b9f('0x4b'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x4c')]);router[_0x9b9f('0x41')](_0x9b9f('0x4d'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x4e')]);router[_0x9b9f('0x41')](_0x9b9f('0x4f'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x50')]);router[_0x9b9f('0x41')](_0x9b9f('0x51'),auth[_0x9b9f('0xa')](),controller['unpause']);router[_0x9b9f('0x41')](_0x9b9f('0x29'),auth['isAuthenticated'](),controller[_0x9b9f('0x52')]);router[_0x9b9f('0x41')](_0x9b9f('0x53'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x54')]);router[_0x9b9f('0x41')](_0x9b9f('0x55'),auth[_0x9b9f('0xa')](),controller['addMailInteractions']);router[_0x9b9f('0x41')]('/:id/fax_interactions',auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x56')]);router[_0x9b9f('0x41')]('/:id/sms_interactions',auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x57')]);router[_0x9b9f('0x41')](_0x9b9f('0x58'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x59')]);router[_0x9b9f('0x41')](_0x9b9f('0x5a'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x5b')]);router[_0x9b9f('0x41')](_0x9b9f('0x5c'),auth['isAuthenticated'](),controller[_0x9b9f('0x5d')]);router[_0x9b9f('0x41')]('/:id/mail_accounts',auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x5e')]);router[_0x9b9f('0x41')](_0x9b9f('0x5f'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x60')]);router[_0x9b9f('0x41')](_0x9b9f('0x33'),auth['isAuthenticated'](),controller[_0x9b9f('0x61')]);router[_0x9b9f('0x41')](_0x9b9f('0x35'),auth[_0x9b9f('0xa')](),controller['addChatWebsites']);router['post'](_0x9b9f('0x37'),auth['isAuthenticated'](),controller[_0x9b9f('0x62')]);router['post'](_0x9b9f('0x63'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x64')]);router['post'](_0x9b9f('0x3c'),auth['isAuthenticated'](),controller[_0x9b9f('0x65')]);router['put'](_0x9b9f('0x11'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x66')]);router[_0x9b9f('0x67')](_0x9b9f('0x68'),auth['isAuthenticated'](),controller[_0x9b9f('0x69')]);router[_0x9b9f('0x6a')](_0x9b9f('0x18'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x6b')]);router[_0x9b9f('0x6a')]('/:id/teams',auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x6c')]);router[_0x9b9f('0x6a')](_0x9b9f('0x11'),auth[_0x9b9f('0xa')](),controller['destroy']);router[_0x9b9f('0x6a')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x9b9f('0x6d')]);router[_0x9b9f('0x6a')]('/:id/mail_interactions',auth[_0x9b9f('0xa')](),controller['removeMailInteractions']);router['delete'](_0x9b9f('0x6e'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x6f')]);router['delete']('/:id/sms_interactions',auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x70')]);router[_0x9b9f('0x6a')](_0x9b9f('0x58'),auth[_0x9b9f('0xa')](),controller['removeOpenchannelInteractions']);router[_0x9b9f('0x6a')](_0x9b9f('0x5a'),auth['isAuthenticated'](),controller[_0x9b9f('0x71')]);router[_0x9b9f('0x6a')]('/:id/fax_accounts',auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x72')]);router[_0x9b9f('0x6a')](_0x9b9f('0x30'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x73')]);router[_0x9b9f('0x6a')]('/:id/openchannel_accounts',auth[_0x9b9f('0xa')](),controller['removeOpenchannelAccounts']);router[_0x9b9f('0x6a')](_0x9b9f('0x33'),auth['isAuthenticated'](),controller[_0x9b9f('0x74')]);router[_0x9b9f('0x6a')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x9b9f('0x75')]);router['delete'](_0x9b9f('0x37'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x76')]);router[_0x9b9f('0x6a')](_0x9b9f('0x63'),auth[_0x9b9f('0xa')](),controller['removeSquareProjects']);router['delete'](_0x9b9f('0x3c'),auth[_0x9b9f('0xa')](),controller[_0x9b9f('0x77')]);module[_0x9b9f('0x78')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 8f45ae8..4c744dc 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 _0xed5c=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','active','passive','actpass','update','TEXT','get','udp','encryption','force_avp','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','icesupport','dtlssetup','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','internal','email','toLowerCase','ENUM','user','telephone','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','peer','from-sip','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','rfc2833','shortinfo','inband','nonat','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure'];(function(_0x30fbc0,_0x2784b6){var _0x395255=function(_0x5374b3){while(--_0x5374b3){_0x30fbc0['push'](_0x30fbc0['shift']());}};_0x395255(++_0x2784b6);}(_0xed5c,0x81));var _0xced5=function(_0x1752bf,_0x430d27){_0x1752bf=_0x1752bf-0x0;var _0x1dc0a7=_0xed5c[_0x1752bf];return _0x1dc0a7;};'use strict';var Sequelize=require(_0xced5('0x0'));var moment=require(_0xced5('0x1'));var util=require(_0xced5('0x2'));var _=require(_0xced5('0x3'));module[_0xced5('0x4')]={'name':{'type':Sequelize[_0xced5('0x5')],'allowNull':![],'unique':_0xced5('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x395c27){this[_0xced5('0x7')](_0xced5('0x6'),_0x395c27);this['setDataValue'](_0xced5('0x8'),_0x395c27);},'comment':_0xced5('0x9')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5c59d1){this[_0xced5('0x7')](_0xced5('0xa'),_0x5c59d1);this[_0xced5('0x7')](_0xced5('0xb'),util[_0xced5('0xc')]('\x22%s\x22\x20<%s>',_0x5c59d1,this['getDataValue'](_0xced5('0xd'))));}},'alias':{'type':Sequelize[_0xced5('0x5')]},'email':{'type':Sequelize[_0xced5('0x5')],'allowNull':![],'unique':_0xced5('0xe'),'validate':{'isEmail':!![]},'set':function(_0x5b760e){if(_0x5b760e){this[_0xced5('0x7')]('email',_0x5b760e[_0xced5('0xf')]());}}},'role':{'type':Sequelize[_0xced5('0x10')]('admin',_0xced5('0x11'),'agent',_0xced5('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xced5('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xced5('0x5')],'defaultValue':_0xced5('0x13')},'internal':{'type':Sequelize[_0xced5('0x14')](0xb),'allowNull':![],'unique':_0xced5('0xd'),'set':function(_0x32b90a){this['setDataValue']('internal',_0x32b90a);this[_0xced5('0x7')](_0xced5('0x15'),_0x32b90a);this[_0xced5('0x7')]('callerid',util['format'](_0xced5('0x16'),this[_0xced5('0x17')](_0xced5('0xa')),_0x32b90a));}},'salt':{'type':Sequelize[_0xced5('0x5')]},'phone':{'type':Sequelize[_0xced5('0x5')]},'mobile':{'type':Sequelize[_0xced5('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xced5('0x5')]},'userpic':{'type':Sequelize[_0xced5('0x5')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xced5('0x5')]},'online':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xced5('0x19')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xced5('0x5')],'defaultValue':_0xced5('0x1a')},'lastPauseAt':{'type':Sequelize[_0xced5('0x19')]},'chatCapacity':{'type':Sequelize[_0xced5('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xced5('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xced5('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xced5('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xced5('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xced5('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xced5('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xced5('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xced5('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'description':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0xced5('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xced5('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xced5('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x1b'),_0xced5('0x11'),_0xced5('0x1c')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![],'defaultValue':_0xced5('0x1d')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0xced5('0x1e'),_0xced5('0x1f'),_0xced5('0x20'),_0xced5('0x21'),_0xced5('0x22')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x1bb977){this['setDataValue'](_0xced5('0x23'),_0x1bb977?_0x1bb977[_0xced5('0x24')](','):null);},'get':function(){return this[_0xced5('0x17')](_0xced5('0x23'))?this[_0xced5('0x17')](_0xced5('0x23'))[_0xced5('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x26'),'info',_0xced5('0x27'),_0xced5('0x28'),'auto'),'allowNull':!![],'defaultValue':_0xced5('0x26')},'directmedia':{'type':Sequelize[_0xced5('0x10')]('yes','no',_0xced5('0x29'),'update',_0xced5('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xced5('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xced5('0x2c'),'set':function(_0xe4ed0c){this['setDataValue'](_0xced5('0x2d'),_0xe4ed0c?_0xe4ed0c[_0xced5('0x24')](','):null);},'get':function(){return this['getDataValue'](_0xced5('0x2d'))?this[_0xced5('0x17')](_0xced5('0x2d'))['split'](','):null;},'comment':_0xced5('0x2e')},'callgroup':{'type':Sequelize[_0xced5('0x5')]},'namedcallgroup':{'type':Sequelize[_0xced5('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xced5('0x5')]},'language':{'type':Sequelize[_0xced5('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xced5('0x5')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xced5('0x2f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xced5('0x30'),'set':function(_0xfc45c7){this[_0xced5('0x7')](_0xced5('0x31'),_0xfc45c7?_0xfc45c7[_0xced5('0x24')](';'):_0xced5('0x30'));},'get':function(){return this[_0xced5('0x17')]('allow')?this[_0xced5('0x17')](_0xced5('0x31'))[_0xced5('0x25')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xced5('0x10')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![],'set':function(_0x3592de){this[_0xced5('0x7')](_0xced5('0x32'),_0x3592de?_0x3592de[_0xced5('0x24')](','):null);},'get':function(){return this[_0xced5('0x17')](_0xced5('0x32'))?this['getDataValue'](_0xced5('0x32'))['split'](','):null;},'comment':_0xced5('0x33')},'trustrpid':{'type':Sequelize[_0xced5('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x2b'),'no',_0xced5('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xced5('0x10')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xced5('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![],'defaultValue':_0xced5('0x35')},'amaflags':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x2b'),'no'),'allowNull':!![],'defaultValue':_0xced5('0x2b')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xced5('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x2b'),'no',_0xced5('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x37'),_0xced5('0x38'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xced5('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xced5('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x39'),_0xced5('0x3a')),'allowNull':!![],'defaultValue':_0xced5('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x2b'),'no'),'allowNull':!![],'defaultValue':_0xced5('0x2b')},'keepalive':{'type':Sequelize[_0xced5('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xced5('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xced5('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xced5('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xced5('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xced5('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xced5('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xced5('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xced5('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xced5('0x10')]('yes','no',_0xced5('0x3b'),_0xced5('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xced5('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x3d'),_0xced5('0x3e'),_0xced5('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xced5('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x2b'),'no',_0xced5('0x29'),_0xced5('0x40'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xced5('0x19')]},'passwordResetAt':{'type':Sequelize[_0xced5('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xced5('0x41')]},'showWebBar':{'type':Sequelize[_0xced5('0x14')],'defaultValue':0x0,'set':function(_0x25c284){this[_0xced5('0x7')]('showWebBar',_0x25c284);var _0x25fe23=this[_0xced5('0x42')]({'plain':!![]});switch(_0x25c284){case 0x0:case 0x1:var _0x4d54a2=_0x25fe23[_0xced5('0x23')]?_['isArray'](_0x25fe23['transport'])?_0x25fe23[_0xced5('0x23')][_0xced5('0x24')]():_0x25fe23[_0xced5('0x23')]:_0xced5('0x43');if(_0x4d54a2==='wss'){_0x4d54a2=_0xced5('0x43');}this[_0xced5('0x7')](_0xced5('0x23'),_0x4d54a2);this['setDataValue'](_0xced5('0x44'),'no');this[_0xced5('0x7')]('avpf',null);this['setDataValue'](_0xced5('0x45'),null);this[_0xced5('0x7')]('icesupport',null);this['setDataValue'](_0xced5('0x46'),null);this[_0xced5('0x7')](_0xced5('0x47'),null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0xced5('0x48'),null);this['setDataValue'](_0xced5('0x49'),null);this[_0xced5('0x7')](_0xced5('0x4a'),'no');break;case 0x2:this[_0xced5('0x7')](_0xced5('0x23'),'wss');this[_0xced5('0x7')](_0xced5('0x44'),_0xced5('0x2b'));this['setDataValue']('avpf',_0xced5('0x2b'));this['setDataValue']('force_avp',_0xced5('0x2b'));this['setDataValue'](_0xced5('0x4b'),'yes');this[_0xced5('0x7')](_0xced5('0x46'),_0xced5('0x2b'));this[_0xced5('0x7')](_0xced5('0x47'),'no');this['setDataValue'](_0xced5('0x4c'),_0xced5('0x3f'));this['setDataValue'](_0xced5('0x48'),_0x25fe23[_0xced5('0x48')]||'/etc/pki/tls/certs/motion.crt');this['setDataValue']('dtlsprivatekey',_0x25fe23[_0xced5('0x49')]||_0xced5('0x4d'));this[_0xced5('0x7')](_0xced5('0x4a'),_0xced5('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0xced5('0x41')],'set':function(_0x2525d6){this[_0xced5('0x7')]('permissions',_0x2525d6?_0x2525d6[_0xced5('0x24')](','):[]);},'get':function(){return this[_0xced5('0x17')](_0xced5('0x4e'))?_[_0xced5('0x4f')](this[_0xced5('0x17')](_0xced5('0x4e'))[_0xced5('0x25')](','),function(_0x425a1e){return parseInt(_0x425a1e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xced5('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xced5('0x5')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xced5('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xced5('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xced5('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xced5('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xced5('0x10')](_0xced5('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xced5('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xced5('0x5')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xced5('0x50')],'get':function(){return this['getDataValue'](_0xced5('0x51'))?this[_0xced5('0x17')](_0xced5('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'interface':{'type':Sequelize[_0xced5('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xced5('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![],'set':function(_0xdb0ae9){if(typeof _0xdb0ae9===_0xced5('0x52')){var _0x38a2e3=_0xdb0ae9==='1'?!![]:_0xdb0ae9==='0'?![]:_0xdb0ae9===_0xced5('0x53')?!![]:_0xdb0ae9===_0xced5('0x54')?![]:![];this['setDataValue'](_0xced5('0x55'),_0x38a2e3);}else{this[_0xced5('0x7')]('screenrecording',_0xdb0ae9);}}},'blocked':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![],'set':function(_0xa533b0){this['setDataValue'](_0xced5('0x56'),_0xa533b0);if(_0xa533b0===!![]){this[_0xced5('0x7')]('blockedAt',moment());this[_0xced5('0x7')](_0xced5('0x57'),0x0);}else{this['setDataValue'](_0xced5('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0xced5('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xced5('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xced5('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xced5('0x18')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xced5('0x14')](0x5)[_0xced5('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xced5('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xced5('0x18')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x16a6=['format','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','join','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<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','TEXT','get','isArray','wss','avpf','force_avp','icesupport','dtlsenable','dtlscertfile','dtlsprivatekey','encryption','dtlsverify','dtlssetup','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','UNSIGNED','sequelize','moment','lodash','exports','STRING','name','setDataValue','defaultuser','callerid','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','agent','local','INTEGER','accountcode'];(function(_0x3425db,_0x56b8d3){var _0x1b6dea=function(_0x2db359){while(--_0x2db359){_0x3425db['push'](_0x3425db['shift']());}};_0x1b6dea(++_0x56b8d3);}(_0x16a6,0x15c));var _0x616a=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0x16a6[_0x4017b0];return _0x5ed4f7;};'use strict';var Sequelize=require(_0x616a('0x0'));var moment=require(_0x616a('0x1'));var util=require('util');var _=require(_0x616a('0x2'));module[_0x616a('0x3')]={'name':{'type':Sequelize[_0x616a('0x4')],'allowNull':![],'unique':_0x616a('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x43e20b){this[_0x616a('0x6')]('name',_0x43e20b);this[_0x616a('0x6')](_0x616a('0x7'),_0x43e20b);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x938824){this[_0x616a('0x6')]('fullname',_0x938824);this['setDataValue'](_0x616a('0x8'),util['format'](_0x616a('0x9'),_0x938824,this['getDataValue'](_0x616a('0xa'))));}},'alias':{'type':Sequelize[_0x616a('0x4')]},'email':{'type':Sequelize[_0x616a('0x4')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x1ab052){if(_0x1ab052){this[_0x616a('0x6')](_0x616a('0xb'),_0x1ab052[_0x616a('0xc')]());}}},'role':{'type':Sequelize[_0x616a('0xd')](_0x616a('0xe'),_0x616a('0xf'),_0x616a('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x616a('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x616a('0x4')],'defaultValue':_0x616a('0x11')},'internal':{'type':Sequelize[_0x616a('0x12')](0xb),'allowNull':![],'unique':_0x616a('0xa'),'set':function(_0x4a33d5){this[_0x616a('0x6')](_0x616a('0xa'),_0x4a33d5);this[_0x616a('0x6')](_0x616a('0x13'),_0x4a33d5);this[_0x616a('0x6')]('callerid',util[_0x616a('0x14')](_0x616a('0x9'),this['getDataValue']('fullname'),_0x4a33d5));}},'salt':{'type':Sequelize[_0x616a('0x4')]},'phone':{'type':Sequelize[_0x616a('0x4')]},'mobile':{'type':Sequelize[_0x616a('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x616a('0x4')]},'userpic':{'type':Sequelize[_0x616a('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x616a('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x616a('0x16')]},'voicePause':{'type':Sequelize[_0x616a('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x616a('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x616a('0x17')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x616a('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x616a('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x616a('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x616a('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x616a('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x616a('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x616a('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x616a('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x616a('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x616a('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x616a('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x616a('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x616a('0xd')](_0x616a('0x18'),_0x616a('0xf'),_0x616a('0x19')),'allowNull':!![],'defaultValue':_0x616a('0x18')},'context':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![],'defaultValue':_0x616a('0x1a')},'callingpres':{'type':Sequelize['ENUM'](_0x616a('0x1b'),_0x616a('0x1c'),'ALLOWED_FAILED_SCREEN',_0x616a('0x1d'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x616a('0x1e'),_0x616a('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![],'defaultValue':_0x616a('0x20'),'set':function(_0x3bfbd1){this['setDataValue'](_0x616a('0x21'),_0x3bfbd1?_0x3bfbd1['join'](','):null);},'get':function(){return this[_0x616a('0x22')](_0x616a('0x21'))?this[_0x616a('0x22')]('transport')[_0x616a('0x23')](','):null;},'comment':_0x616a('0x24')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x616a('0x25'),_0x616a('0x26'),_0x616a('0x27'),_0x616a('0x28')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x616a('0x29'),_0x616a('0x2a'),_0x616a('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x616a('0xd')](_0x616a('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![],'defaultValue':_0x616a('0x2d'),'set':function(_0x151fff){this['setDataValue'](_0x616a('0x2e'),_0x151fff?_0x151fff['join'](','):null);},'get':function(){return this[_0x616a('0x22')](_0x616a('0x2e'))?this[_0x616a('0x22')](_0x616a('0x2e'))[_0x616a('0x23')](','):null;},'comment':_0x616a('0x2f')},'callgroup':{'type':Sequelize[_0x616a('0x4')]},'namedcallgroup':{'type':Sequelize[_0x616a('0x4')]},'pickupgroup':{'type':Sequelize[_0x616a('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x616a('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x616a('0x4')]},'disallow':{'type':Sequelize[_0x616a('0x4')],'allowNull':![],'defaultValue':_0x616a('0x30')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x616a('0x31'),'set':function(_0x4c6a76){this[_0x616a('0x6')]('allow',_0x4c6a76?_0x4c6a76[_0x616a('0x32')](';'):_0x616a('0x31'));},'get':function(){return this['getDataValue'](_0x616a('0x33'))?this['getDataValue'](_0x616a('0x33'))[_0x616a('0x23')](';'):null;},'comment':_0x616a('0x34')},'autoframing':{'type':Sequelize[_0x616a('0xd')](_0x616a('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![],'set':function(_0x3719b){this['setDataValue'](_0x616a('0x35'),_0x3719b?_0x3719b['join'](','):null);},'get':function(){return this[_0x616a('0x22')](_0x616a('0x35'))?this[_0x616a('0x22')]('insecure')[_0x616a('0x23')](','):null;},'comment':_0x616a('0x36')},'trustrpid':{'type':Sequelize[_0x616a('0xd')](_0x616a('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x616a('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x616a('0xd')](_0x616a('0x2c'),'no',_0x616a('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x616a('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x616a('0xd')](_0x616a('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x616a('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![],'defaultValue':_0x616a('0x38')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x616a('0xd')](_0x616a('0x2c'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x616a('0xd')](_0x616a('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x616a('0xd')](_0x616a('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x616a('0xd')](_0x616a('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x616a('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x616a('0x2c'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x616a('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x616a('0xd')](_0x616a('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x616a('0x39'),_0x616a('0x3a'),_0x616a('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x616a('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x616a('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x616a('0x3c'),_0x616a('0x3d')),'allowNull':!![],'defaultValue':_0x616a('0x3d')},'t38pt_usertpsource':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x616a('0xd')](_0x616a('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x616a('0x2c')},'keepalive':{'type':Sequelize[_0x616a('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x616a('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x616a('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x616a('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x616a('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x616a('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x616a('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x616a('0xd')](_0x616a('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x616a('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x616a('0xd')](_0x616a('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x616a('0xd')](_0x616a('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x616a('0xd')](_0x616a('0x2c'),'no',_0x616a('0x3e'),_0x616a('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x616a('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x616a('0x40'),_0x616a('0x41'),_0x616a('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x616a('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x616a('0xd')](_0x616a('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x616a('0xd')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x616a('0xd')]('yes','no','nonat','update',_0x616a('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x616a('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x616a('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x616a('0x44')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x5084d3){this[_0x616a('0x6')]('showWebBar',_0x5084d3);var _0x4d7410=this[_0x616a('0x45')]({'plain':!![]});switch(_0x5084d3){case 0x0:case 0x1:var _0x4dc663=_0x4d7410[_0x616a('0x21')]?_[_0x616a('0x46')](_0x4d7410[_0x616a('0x21')])?_0x4d7410[_0x616a('0x21')][_0x616a('0x32')]():_0x4d7410[_0x616a('0x21')]:_0x616a('0x20');if(_0x4dc663===_0x616a('0x47')){_0x4dc663='udp';}this['setDataValue'](_0x616a('0x21'),_0x4dc663);this[_0x616a('0x6')]('encryption','no');this[_0x616a('0x6')](_0x616a('0x48'),null);this['setDataValue'](_0x616a('0x49'),null);this[_0x616a('0x6')](_0x616a('0x4a'),null);this['setDataValue'](_0x616a('0x4b'),null);this[_0x616a('0x6')]('dtlsverify',null);this[_0x616a('0x6')]('dtlssetup',null);this[_0x616a('0x6')](_0x616a('0x4c'),null);this[_0x616a('0x6')](_0x616a('0x4d'),null);this[_0x616a('0x6')]('rtcp_mux','no');break;case 0x2:this[_0x616a('0x6')](_0x616a('0x21'),_0x616a('0x47'));this[_0x616a('0x6')](_0x616a('0x4e'),_0x616a('0x2c'));this['setDataValue'](_0x616a('0x48'),_0x616a('0x2c'));this[_0x616a('0x6')](_0x616a('0x49'),_0x616a('0x2c'));this[_0x616a('0x6')]('icesupport',_0x616a('0x2c'));this[_0x616a('0x6')](_0x616a('0x4b'),_0x616a('0x2c'));this[_0x616a('0x6')](_0x616a('0x4f'),'no');this[_0x616a('0x6')](_0x616a('0x50'),_0x616a('0x42'));this['setDataValue'](_0x616a('0x4c'),_0x4d7410[_0x616a('0x4c')]||'/etc/pki/tls/certs/motion.crt');this[_0x616a('0x6')]('dtlsprivatekey',_0x4d7410[_0x616a('0x4d')]||_0x616a('0x51'));this[_0x616a('0x6')](_0x616a('0x52'),_0x616a('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0x616a('0x44')],'set':function(_0x236ca4){this[_0x616a('0x6')](_0x616a('0x53'),_0x236ca4?_0x236ca4[_0x616a('0x32')](','):[]);},'get':function(){return this[_0x616a('0x22')]('permissions')?_['map'](this[_0x616a('0x22')]('permissions')[_0x616a('0x23')](','),function(_0x70b288){return parseInt(_0x70b288,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x616a('0x4')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x616a('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x616a('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x616a('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x616a('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x616a('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x616a('0xd')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x616a('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x616a('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x616a('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x616a('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x616a('0x54')],'get':function(){return this[_0x616a('0x22')](_0x616a('0x55'))?this['getDataValue'](_0x616a('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x616a('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x616a('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x616a('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x616a('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x616a('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x616a('0x15')],'defaultValue':![],'set':function(_0xe9c600){if(typeof _0xe9c600===_0x616a('0x56')){var _0x2029ad=_0xe9c600==='1'?!![]:_0xe9c600==='0'?![]:_0xe9c600===_0x616a('0x57')?!![]:_0xe9c600==='false'?![]:![];this[_0x616a('0x6')](_0x616a('0x58'),_0x2029ad);}else{this[_0x616a('0x6')]('screenrecording',_0xe9c600);}}},'blocked':{'type':Sequelize[_0x616a('0x15')],'defaultValue':![],'set':function(_0x5a2f64){this['setDataValue'](_0x616a('0x59'),_0x5a2f64);if(_0x5a2f64===!![]){this[_0x616a('0x6')](_0x616a('0x5a'),moment());this[_0x616a('0x6')]('loginAttempts',0x0);}else{this[_0x616a('0x6')](_0x616a('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0x616a('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x616a('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x616a('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x616a('0x12')](0x5)[_0x616a('0x5b')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x616a('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x616a('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x616a('0x15')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 28ef54b..76ef5f7 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 _0x0abf=['emit','Queue:save','voice','VoiceQueue','format','UserVoiceQueueRt','upsert','removeQueues','isArray','QueueId','Queue:remove','userpic','file','getAvatar','join','root','server/files/images/logos/default_profile.png','existsSync','download','server/files/images/','chat','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','getContacts','CmContact','CmList','Tag','Tags','tag','Queue','Unknown\x20role','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','UserId','VoiceRecording','ScreenRecording','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:forcelogout','headers','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','bulkCreate','concat','isMiddleware','resolve','logout','pause','QueuePause','DEFAULT\x20PAUSE','unpause','chatPause','openchannelPause','whatsapppause','pauseType','lastPauseAt','manual','%s%s','Pause','getTeams','addTeams','Team','setDataValue','Voice','getChatQueues','Chat','getMailQueues','Sms','getWhatsappQueues','getFaxQueues','Fax','Openchannel','addAgent','getDataValue','removeTeams','Mail','Whatsapp','flatten','transaction','removeAgent','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$gt','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','firstName','lastName','Contact','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','isEmpty','toString','asc','desc','substring','uniqBy','orderBy','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','QueryTypes','select','ui.','InteractionId','field','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./user.socket','register','jayson/promise','client','http','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','destroy','get','role','admin','Users','user','agent','Telephones','telephone','filter','ignore','map','value','find','name','UserProfileResource','stack','send','index','User','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','sequelize','col','lower','options','includeAll','includes','push','findAll','openTabs','true','dataValues','sms','rows','fax','mail','openchannel','whatsapp','all','catch','show','params','password','salt','keys','include','update','body','describe','addContacts','ids','omit','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)','SELECT','from','voicemail','mailbox','fullname','permissions','101','102','103','113','110','104','105','106','109','111','114','115','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','create','VoiceMail','UserProfileSection','Agents','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','changePassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread'];(function(_0x17d4dc,_0x408622){var _0x131443=function(_0x3e2685){while(--_0x3e2685){_0x17d4dc['push'](_0x17d4dc['shift']());}};_0x131443(++_0x408622);}(_0x0abf,0xe8));var _0xf0ab=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0abf[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var values;var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ab('0x11'));var logger=require('../../config/logger')(_0xf0ab('0x12'));var utils=require(_0xf0ab('0x13'));var config=require(_0xf0ab('0x14'));var licenseUtil=require(_0xf0ab('0x15'));var db=require(_0xf0ab('0x16'))['db'];config[_0xf0ab('0x17')]=_[_0xf0ab('0x18')](config['redis'],{'host':_0xf0ab('0x19'),'port':0x18eb});var socket=require(_0xf0ab('0x1a'))(new Redis(config[_0xf0ab('0x17')]));require(_0xf0ab('0x1b'))[_0xf0ab('0x1c')](socket);var jayson=require(_0xf0ab('0x1d'));var client=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x180d0b,_0x3c5bfd,_0x20f453,_0x221bac){return new BPromise(function(_0x200cf5,_0x2f4618){var _0x230f40=_0x221bac||client;return _0x230f40['request'](_0x180d0b,_0x20f453)[_0xf0ab('0x20')](function(_0x9e3b47){logger[_0xf0ab('0x21')](_0xf0ab('0x22'),_0x3c5bfd,_0xf0ab('0x23'));logger[_0xf0ab('0x24')](_0xf0ab('0x25'),_0x3c5bfd,_0xf0ab('0x23'),JSON[_0xf0ab('0x26')](_0x9e3b47));if(_0x9e3b47[_0xf0ab('0x27')]){if(_0x9e3b47[_0xf0ab('0x27')][_0xf0ab('0x28')]===0x1f4){logger[_0xf0ab('0x27')](_0xf0ab('0x22'),_0x3c5bfd,_0x9e3b47[_0xf0ab('0x27')][_0xf0ab('0x29')]);return _0x2f4618(_0x9e3b47['error'][_0xf0ab('0x29')]);}logger[_0xf0ab('0x27')](_0xf0ab('0x22'),_0x3c5bfd,_0x9e3b47[_0xf0ab('0x27')][_0xf0ab('0x29')]);return _0x200cf5(_0x9e3b47[_0xf0ab('0x27')][_0xf0ab('0x29')]);}else{logger[_0xf0ab('0x21')](_0xf0ab('0x22'),_0x3c5bfd,_0xf0ab('0x23'));_0x200cf5(_0x9e3b47[_0xf0ab('0x2a')]['message']);}})['catch'](function(_0x4eee21){logger[_0xf0ab('0x27')]('User,\x20%s,\x20%s',_0x3c5bfd,_0x4eee21);_0x2f4618(_0x4eee21);});});}function respondWithStatusCode(_0x3eca32,_0x16b979){_0x16b979=_0x16b979||0xcc;return function(_0x51ac90){if(_0x51ac90){return _0x3eca32[_0xf0ab('0x2b')](_0x16b979);}return _0x3eca32[_0xf0ab('0x2c')](_0x16b979)[_0xf0ab('0x2d')]();};}function respondWithResult(_0x38fb71,_0x7d4ff9){_0x7d4ff9=_0x7d4ff9||0xc8;return function(_0x502921){if(_0x502921){return _0x38fb71[_0xf0ab('0x2c')](_0x7d4ff9)['json'](_0x502921);}};}function respondWithFilteredResult(_0x55d799,_0x1dcd2e){return function(_0x4306c6){if(_0x4306c6){var _0x1b223d=typeof _0x1dcd2e[_0xf0ab('0x2e')]===_0xf0ab('0x2f')&&typeof _0x1dcd2e[_0xf0ab('0x30')]===_0xf0ab('0x2f');var _0x14da9c=_0x4306c6[_0xf0ab('0x31')];var _0x2f0fcd=_0x1b223d?0x0:_0x1dcd2e[_0xf0ab('0x2e')];var _0x199753=_0x1b223d?_0x4306c6['count']:_0x1dcd2e[_0xf0ab('0x2e')]+_0x1dcd2e[_0xf0ab('0x30')];var _0x5e073a;if(_0x199753>=_0x14da9c){_0x199753=_0x14da9c;_0x5e073a=0xc8;}else{_0x5e073a=0xce;}_0x55d799['status'](_0x5e073a);return _0x55d799[_0xf0ab('0x32')](_0xf0ab('0x33'),_0x2f0fcd+'-'+_0x199753+'/'+_0x14da9c)[_0xf0ab('0x34')](_0x4306c6);}return null;};}function patchUpdates(_0x4dd5b7){return function(_0x58efce){try{jsonpatch[_0xf0ab('0x35')](_0x58efce,_0x4dd5b7,!![]);}catch(_0x58fa03){return BPromise[_0xf0ab('0x36')](_0x58fa03);}return _0x58efce['save']();};}function saveUpdates(_0x3f66fa,_0x9b16fa){return function(_0x5074c9){if(_0x5074c9){return _0x5074c9['update'](_0x3f66fa)[_0xf0ab('0x20')](function(_0x27c6f9){return _0x27c6f9;});}return null;};}function removeEntity(_0x2a3fac,_0x6e06df){return function(_0x2519c7){if(_0x2519c7){return _0x2519c7[_0xf0ab('0x37')]()[_0xf0ab('0x20')](function(){var _0xf8f0f4=_0x2519c7[_0xf0ab('0x38')]({'plain':!![]});if(_0xf8f0f4[_0xf0ab('0x39')]===_0xf0ab('0x3a'))return;var _0x2ad3e2=[{'name':_0xf0ab('0x3b'),'value':_0xf0ab('0x3c'),'ignore':!![]},{'name':'Agents','value':_0xf0ab('0x3d'),'ignore':![]},{'name':_0xf0ab('0x3e'),'value':_0xf0ab('0x3f'),'ignore':![]}];var _0x5c9192=_(_0x2ad3e2)[_0xf0ab('0x40')](_0xf0ab('0x41'))[_0xf0ab('0x42')]('value')[_0xf0ab('0x43')]();if(_['includes'](_0x5c9192,_0xf8f0f4[_0xf0ab('0x39')])){return;}var _0x492d7c=_[_0xf0ab('0x44')](_0x2ad3e2,[_0xf0ab('0x43'),_0xf8f0f4[_0xf0ab('0x39')]])[_0xf0ab('0x45')];return db[_0xf0ab('0x46')][_0xf0ab('0x37')]({'where':{'type':_0x492d7c,'resourceId':_0xf8f0f4['id']}})['then'](function(){return _0x2519c7;});})[_0xf0ab('0x20')](function(){_0x2a3fac[_0xf0ab('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x207fbb,_0xce89bc){return function(_0x1d4eec){if(!_0x1d4eec){_0x207fbb[_0xf0ab('0x2b')](0x194);}return _0x1d4eec;};}function handleError(_0x31fa72,_0x11e3b7){_0x11e3b7=_0x11e3b7||0x1f4;return function(_0x28c20c){logger['error'](_0x28c20c[_0xf0ab('0x47')]);if(_0x28c20c[_0xf0ab('0x45')]){delete _0x28c20c[_0xf0ab('0x45')];}_0x31fa72['status'](_0x11e3b7)[_0xf0ab('0x48')](_0x28c20c);};}exports[_0xf0ab('0x49')]=function(_0x44077b,_0x32b237){var _0x2b7ed5={},_0x553d07={},_0x1b7974={'count':0x0,'rows':[]};var _0x39a212=_[_0xf0ab('0x42')](db[_0xf0ab('0x4a')][_0xf0ab('0x4b')],function(_0x17a73){return{'name':_0x17a73[_0xf0ab('0x4c')],'type':_0x17a73[_0xf0ab('0x4d')][_0xf0ab('0x4e')]};});_0x553d07[_0xf0ab('0x4f')]=_[_0xf0ab('0x50')](_[_0xf0ab('0x42')](_0x39a212,_0xf0ab('0x45')),['password','salt']);_0x553d07[_0xf0ab('0x51')]=_['keys'](_0x44077b[_0xf0ab('0x51')]);_0x553d07[_0xf0ab('0x52')]=_['intersection'](_0x553d07[_0xf0ab('0x4f')],_0x553d07[_0xf0ab('0x51')]);_0x2b7ed5['attributes']=_[_0xf0ab('0x53')](_0x553d07[_0xf0ab('0x4f')],qs[_0xf0ab('0x54')](_0x44077b[_0xf0ab('0x51')][_0xf0ab('0x54')]));_0x2b7ed5[_0xf0ab('0x55')]=_0x2b7ed5[_0xf0ab('0x55')][_0xf0ab('0x56')]?_0x2b7ed5[_0xf0ab('0x55')]:_0x553d07[_0xf0ab('0x4f')];if(!_0x44077b[_0xf0ab('0x51')][_0xf0ab('0x57')](_0xf0ab('0x58'))){_0x2b7ed5[_0xf0ab('0x30')]=qs['limit'](_0x44077b['query'][_0xf0ab('0x30')]);_0x2b7ed5['offset']=qs['offset'](_0x44077b['query'][_0xf0ab('0x2e')]);}_0x2b7ed5[_0xf0ab('0x59')]=qs[_0xf0ab('0x5a')](_0x44077b[_0xf0ab('0x51')][_0xf0ab('0x5a')]);_0x2b7ed5[_0xf0ab('0x5b')]=qs[_0xf0ab('0x52')](_[_0xf0ab('0x5c')](_0x44077b[_0xf0ab('0x51')],_0x553d07[_0xf0ab('0x52')]),_0x39a212);if(_0x44077b[_0xf0ab('0x51')][_0xf0ab('0x40')]){_0x2b7ed5['where']=_[_0xf0ab('0x5d')](_0x2b7ed5[_0xf0ab('0x5b')],{'$or':_[_0xf0ab('0x42')](_0x39a212,function(_0x46b998){if(_0x46b998[_0xf0ab('0x4d')]!==_0xf0ab('0x5e')){return db[_0xf0ab('0x5f')][_0xf0ab('0x5b')](db['sequelize']['fn']('lower',db['sequelize'][_0xf0ab('0x60')](_0x46b998[_0xf0ab('0x45')])),{'$like':db['sequelize']['fn'](_0xf0ab('0x61'),'%'+_0x44077b[_0xf0ab('0x51')]['filter']+'%')});}})});}_0x2b7ed5=_[_0xf0ab('0x5d')]({},_0x2b7ed5,_0x44077b[_0xf0ab('0x62')]);var _0x1352ac={'where':_0x2b7ed5[_0xf0ab('0x5b')]};return db[_0xf0ab('0x4a')][_0xf0ab('0x31')](_0x1352ac)[_0xf0ab('0x20')](function(_0x4d1606){_0x1b7974[_0xf0ab('0x31')]=_0x4d1606;if(_0x44077b['query'][_0xf0ab('0x63')]){_0x2b7ed5['include']=[{'all':!![]}];}if(!_[_0xf0ab('0x64')](_0x2b7ed5['attributes'],'id')){_0x2b7ed5['attributes'][_0xf0ab('0x65')]('id');}return db['User'][_0xf0ab('0x66')](_0x2b7ed5);})['then'](function(_0x2eff07){_0x1b7974['rows']=_0x2eff07;if(_0x44077b[_0xf0ab('0x51')][_0xf0ab('0x67')]===_0xf0ab('0x68')){var _0x57f9dd=[];for(var _0x47f270=0x0;_0x47f270<_0x1b7974['rows'][_0xf0ab('0x56')];_0x47f270++){_0x57f9dd[_0xf0ab('0x65')](get_open_tabs('chat',_0x1b7974['rows'][_0x47f270][_0xf0ab('0x69')]));_0x57f9dd[_0xf0ab('0x65')](get_open_tabs(_0xf0ab('0x6a'),_0x1b7974[_0xf0ab('0x6b')][_0x47f270][_0xf0ab('0x69')]));_0x57f9dd[_0xf0ab('0x65')](get_open_tabs(_0xf0ab('0x6c'),_0x1b7974[_0xf0ab('0x6b')][_0x47f270][_0xf0ab('0x69')]));_0x57f9dd[_0xf0ab('0x65')](get_open_tabs(_0xf0ab('0x6d'),_0x1b7974['rows'][_0x47f270][_0xf0ab('0x69')]));_0x57f9dd['push'](get_open_tabs(_0xf0ab('0x6e'),_0x1b7974[_0xf0ab('0x6b')][_0x47f270][_0xf0ab('0x69')]));_0x57f9dd[_0xf0ab('0x65')](get_open_tabs(_0xf0ab('0x6f'),_0x1b7974[_0xf0ab('0x6b')][_0x47f270][_0xf0ab('0x69')]));}return BPromise[_0xf0ab('0x70')](_0x57f9dd)[_0xf0ab('0x20')](function(_0x180ee6){return _0x1b7974;});}else{return _0x1b7974;}})['then'](respondWithFilteredResult(_0x32b237,_0x2b7ed5))[_0xf0ab('0x71')](handleError(_0x32b237,null));};exports[_0xf0ab('0x72')]=function(_0x4062b7,_0x1d4a72){var _0x2232eb={'raw':![],'where':{'id':_0x4062b7[_0xf0ab('0x73')]['id']}},_0x314a26={};_0x314a26[_0xf0ab('0x4f')]=_[_0xf0ab('0x50')](_['keys'](db['User'][_0xf0ab('0x4b')]),[_0xf0ab('0x74'),_0xf0ab('0x75')]);_0x314a26['query']=_[_0xf0ab('0x76')](_0x4062b7[_0xf0ab('0x51')]);_0x314a26[_0xf0ab('0x52')]=_['intersection'](_0x314a26[_0xf0ab('0x4f')],_0x314a26[_0xf0ab('0x51')]);_0x2232eb[_0xf0ab('0x55')]=_[_0xf0ab('0x53')](_0x314a26[_0xf0ab('0x4f')],qs['fields'](_0x4062b7[_0xf0ab('0x51')][_0xf0ab('0x54')]));_0x2232eb[_0xf0ab('0x55')]=_0x2232eb[_0xf0ab('0x55')][_0xf0ab('0x56')]?_0x2232eb[_0xf0ab('0x55')]:_0x314a26[_0xf0ab('0x4f')];if(_0x4062b7[_0xf0ab('0x51')][_0xf0ab('0x63')]){_0x2232eb[_0xf0ab('0x77')]=[{'all':!![]}];}_0x2232eb=_[_0xf0ab('0x5d')]({},_0x2232eb,_0x4062b7[_0xf0ab('0x62')]);if(!_[_0xf0ab('0x64')](_0x2232eb['attributes'],'id')){_0x2232eb['attributes'][_0xf0ab('0x65')]('id');}return db[_0xf0ab('0x4a')][_0xf0ab('0x44')](_0x2232eb)['then'](handleEntityNotFound(_0x1d4a72,null))[_0xf0ab('0x20')](function(_0x4b8496){var _0x1a32dc=[];values=_0x4b8496;if(_0x4062b7[_0xf0ab('0x51')][_0xf0ab('0x67')]==='true'){_0x1a32dc[_0xf0ab('0x65')](get_open_tabs('chat',_0x4b8496['dataValues']));_0x1a32dc[_0xf0ab('0x65')](get_open_tabs(_0xf0ab('0x6a'),_0x4b8496[_0xf0ab('0x69')]));_0x1a32dc['push'](get_open_tabs(_0xf0ab('0x6e'),_0x4b8496[_0xf0ab('0x69')]));_0x1a32dc[_0xf0ab('0x65')](get_open_tabs(_0xf0ab('0x6f'),_0x4b8496['dataValues']));_0x1a32dc['push'](get_open_tabs('fax',_0x4b8496[_0xf0ab('0x69')]));_0x1a32dc[_0xf0ab('0x65')](get_open_tabs(_0xf0ab('0x6d'),_0x4b8496[_0xf0ab('0x69')]));return BPromise[_0xf0ab('0x70')](_0x1a32dc);}else{return values;}})[_0xf0ab('0x20')](function(_0x3a5205){return values;})[_0xf0ab('0x20')](respondWithResult(_0x1d4a72,null))[_0xf0ab('0x71')](handleError(_0x1d4a72,null));};exports[_0xf0ab('0x78')]=function(_0x228334,_0x5154f5){if(_0x228334[_0xf0ab('0x79')]['id']){delete _0x228334[_0xf0ab('0x79')]['id'];}delete _0x228334[_0xf0ab('0x79')][_0xf0ab('0x39')];return db[_0xf0ab('0x4a')][_0xf0ab('0x44')]({'where':{'id':_0x228334[_0xf0ab('0x73')]['id']}})[_0xf0ab('0x20')](handleEntityNotFound(_0x5154f5,null))['then'](saveUpdates(_0x228334[_0xf0ab('0x79')],null))[_0xf0ab('0x20')](respondWithResult(_0x5154f5,null))['catch'](handleError(_0x5154f5,null));};exports['describe']=function(_0x4b1a28,_0x331433){return db[_0xf0ab('0x4a')][_0xf0ab('0x7a')]()[_0xf0ab('0x20')](respondWithResult(_0x331433,null))[_0xf0ab('0x71')](handleError(_0x331433,null));};exports[_0xf0ab('0x7b')]=function(_0x4d011e,_0x1053c0,_0x5e7d84){return db[_0xf0ab('0x4a')]['find']({'where':{'id':_0x4d011e[_0xf0ab('0x73')]['id']}})['then'](handleEntityNotFound(_0x1053c0,null))[_0xf0ab('0x20')](function(_0x4ffd8d){if(_0x4ffd8d){return _0x4ffd8d['addContacts'](_0x4d011e[_0xf0ab('0x79')][_0xf0ab('0x7c')],_[_0xf0ab('0x7d')](_0x4d011e[_0xf0ab('0x79')],[_0xf0ab('0x7c'),'id'])||{});}})[_0xf0ab('0x20')](respondWithResult(_0x1053c0,null))[_0xf0ab('0x71')](handleError(_0x1053c0,null));};function validateUser(_0x1280f0){return new BPromise(function(_0x23ba05,_0x3299bc){if(_0x1280f0[_0xf0ab('0x7e')])return _0x23ba05(_0x1280f0);return db[_0xf0ab('0x7f')][_0xf0ab('0x80')](0x1)['then'](function(_0x1f5e73){if(_0x1f5e73[_0xf0ab('0x81')])authService[_0xf0ab('0x82')](_0x1280f0[_0xf0ab('0x74')]);db[_0xf0ab('0x4a')][_0xf0ab('0x83')](_0xf0ab('0x7e'))[_0xf0ab('0x20')](function(_0xa0852a){if(_[_0xf0ab('0x84')](_0xa0852a)){_0x1280f0[_0xf0ab('0x7e')]=_0x1f5e73[_0xf0ab('0x85')]||0x1;return;}if(_['isNil'](_0x1f5e73[_0xf0ab('0x85')])||_0x1f5e73[_0xf0ab('0x85')]===_0xa0852a){_0x1280f0[_0xf0ab('0x7e')]=_0xa0852a+0x1;return;}if(_0x1f5e73[_0xf0ab('0x85')]>_0xa0852a){_0x1280f0['internal']=_0x1f5e73[_0xf0ab('0x85')];return;}return db[_0xf0ab('0x5f')][_0xf0ab('0x51')](_0xf0ab('0x86'),{'type':db[_0xf0ab('0x5f')]['QueryTypes'][_0xf0ab('0x87')]})[_0xf0ab('0x20')](function(_0x491dc3){if(_0x491dc3&&_0x491dc3[_0xf0ab('0x56')]){for(var _0x593539=0x0,_0x238833=_0x491dc3[_0xf0ab('0x56')];_0x593539<_0x238833&&_['isNil'](_0x1280f0[_0xf0ab('0x7e')]);_0x593539++){if(_0x1f5e73[_0xf0ab('0x85')]<=_0x491dc3[_0x593539]['from']){_0x1280f0['internal']=_0x491dc3[_0x593539][_0xf0ab('0x88')];}else if(_0x1f5e73['min_internal']>_0x491dc3[_0x593539][_0xf0ab('0x88')]&&_0x1f5e73[_0xf0ab('0x85')]<=_0x491dc3[_0x593539]['to']){_0x1280f0['internal']=_0x1f5e73['min_internal'];}}}if(_['isNil'](_0x1280f0[_0xf0ab('0x7e')])){_0x1280f0[_0xf0ab('0x7e')]=_0xa0852a+0x1;}return _0x23ba05(_0x1280f0);});});})[_0xf0ab('0x71')](function(_0x26715c){_0x3299bc(_0x26715c);});});}function updateUser(_0x49c89f){return new BPromise(function(_0x272f9c,_0x1b7098){try{if(_0x49c89f[_0xf0ab('0x89')]){_0x49c89f[_0xf0ab('0x8a')]=_0x49c89f[_0xf0ab('0x7e')];_0x49c89f['VoiceMail']={'mailbox':_0x49c89f['internal'],'password':_0x49c89f[_0xf0ab('0x74')],'fullname':_0x49c89f[_0xf0ab('0x8b')],'email':_0x49c89f['email']};}if(_0x49c89f['role']===_0xf0ab('0x3d')){if(!_0x49c89f[_0xf0ab('0x8c')])_0x49c89f[_0xf0ab('0x8c')]=[_0xf0ab('0x8d'),_0xf0ab('0x8e'),_0xf0ab('0x8f'),_0xf0ab('0x90'),_0xf0ab('0x91'),_0xf0ab('0x92'),_0xf0ab('0x93'),_0xf0ab('0x94'),'107','108',_0xf0ab('0x95'),'100',_0xf0ab('0x96'),_0xf0ab('0x97'),_0xf0ab('0x98')];}_0x272f9c(_0x49c89f);}catch(_0x1c4d2a){_0x1b7098(_0x1c4d2a);}});}exports['create']=function(_0x3942b5,_0x105a00){if(_0x3942b5[_0xf0ab('0x3c')][_0xf0ab('0x39')]===_0xf0ab('0x3d'))throw new Error(_0xf0ab('0x99'));if(_0x3942b5[_0xf0ab('0x79')][_0xf0ab('0x39')]===_0xf0ab('0x3c')&&_0x3942b5[_0xf0ab('0x3c')][_0xf0ab('0x39')]!==_0xf0ab('0x3a')){throw new Error(_0xf0ab('0x9a'));}if(_0x3942b5[_0xf0ab('0x79')]['role']===_0xf0ab('0x3a')&&_0x3942b5[_0xf0ab('0x3c')][_0xf0ab('0x39')]!==_0xf0ab('0x3a')){throw new Error(_0xf0ab('0x9b'));}return licenseUtil[_0xf0ab('0x9c')]([_0x3942b5[_0xf0ab('0x79')]])['then'](function(){return validateUser(_0x3942b5['body']);})[_0xf0ab('0x20')](function(_0x200a20){return updateUser(_0x200a20)[_0xf0ab('0x20')](function(_0x4815f9){if(_0x4815f9[_0xf0ab('0x39')]===_0xf0ab('0x3a')){_0x4815f9[_0xf0ab('0x9d')]=_0x3942b5[_0xf0ab('0x3c')][_0xf0ab('0x9d')];delete _0x4815f9['userProfileId'];}return _0x4815f9;});})['then'](function(_0x2a3dd3){return db['User'][_0xf0ab('0x9e')](_0x2a3dd3,{'include':[{'model':db[_0xf0ab('0x9f')],'as':'VoiceMail'}]});})[_0xf0ab('0x20')](function(_0x223090){if(_0x3942b5[_0xf0ab('0x79')][_0xf0ab('0x39')]===_0xf0ab('0x3c'))return _0x223090;if(_0x3942b5['user'][_0xf0ab('0x39')]!==_0xf0ab('0x3c'))return _0x223090;return db[_0xf0ab('0xa0')][_0xf0ab('0x44')]({'where':{'name':_0x223090[_0xf0ab('0x39')]==='agent'?_0xf0ab('0xa1'):_0xf0ab('0x3e'),'userProfileId':_0x3942b5[_0xf0ab('0x3c')][_0xf0ab('0xa2')]},'raw':!![]})[_0xf0ab('0x20')](function(_0x533f1c){if(!_0x533f1c||_0x533f1c[_0xf0ab('0xa3')]!=0x0)return _0x223090;return db[_0xf0ab('0x46')][_0xf0ab('0x9e')]({'name':_0x223090['name'],'resourceId':_0x223090['id'],'type':_0x533f1c[_0xf0ab('0x45')],'sectionId':_0x533f1c['id']},{})['then'](function(){return _0x223090;});})[_0xf0ab('0x71')](function(_0x467d6d){logger[_0xf0ab('0x27')](_0xf0ab('0xa4'),_0x467d6d);throw _0x467d6d;});})['then'](respondWithResult(_0x105a00,0xc9))[_0xf0ab('0x71')](handleError(_0x105a00,null));};exports['bulkCreate']=function(_0x542d27,_0x426da1){var _0x5578bb=_0x542d27['body'];var _0x270bc1=[];if(_0x542d27[_0xf0ab('0x3c')]['role']==='agent')throw new Error('Unauthorized');if(_['some'](_0x5578bb,[_0xf0ab('0x39'),_0xf0ab('0x3c')])&&_0x542d27[_0xf0ab('0x3c')][_0xf0ab('0x39')]!==_0xf0ab('0x3a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xf0ab('0xa5')](_0x5578bb,[_0xf0ab('0x39'),_0xf0ab('0x3a')])&&_0x542d27[_0xf0ab('0x3c')][_0xf0ab('0x39')]!==_0xf0ab('0x3a')){throw new Error(_0xf0ab('0xa6'));}return licenseUtil['checkUserLimits'](_0x5578bb)[_0xf0ab('0x20')](function(){return validateUser(_0x5578bb[0x0]);})[_0xf0ab('0x20')](function(){for(var _0x39633a=0x1;_0x39633a<_0x5578bb[_0xf0ab('0x56')];_0x39633a++){var _0x375813=_0x5578bb[_0x39633a-0x1][_0xf0ab('0x7e')];if(!_0x5578bb[_0x39633a]['internal'])_0x5578bb[_0x39633a][_0xf0ab('0x7e')]=_0x375813+0x1;_0x270bc1[_0xf0ab('0x65')](validateUser(_0x5578bb[_0x39633a]));}return BPromise[_0xf0ab('0x70')](_0x270bc1);})[_0xf0ab('0x20')](function(){_0x270bc1=[];for(var _0x4ca7a3=0x0;_0x4ca7a3<_0x5578bb[_0xf0ab('0x56')];_0x4ca7a3++){_0x270bc1[_0xf0ab('0x65')](updateUser(_0x5578bb[_0x4ca7a3]));}return BPromise['all'](_0x270bc1);})['then'](function(){return BPromise[_0xf0ab('0xa7')](_0x5578bb,function(_0x1e3c50){return db[_0xf0ab('0x4a')][_0xf0ab('0x9e')](_0x1e3c50,{'include':[{'model':db[_0xf0ab('0x9f')],'as':_0xf0ab('0x9f')}]})[_0xf0ab('0x20')](function(_0x151f44){_0x1e3c50['id']=_0x151f44['id'];return _0x1e3c50;});});})['then'](function(_0x463980){if(_0x542d27['body']['role']===_0xf0ab('0x3c'))return _0x463980;if(_0x542d27[_0xf0ab('0x3c')][_0xf0ab('0x39')]!==_0xf0ab('0x3c'))return _0x463980;var _0x409295=_[_0xf0ab('0xa5')](_0x463980,function(_0x40f19b){return _0x40f19b[_0xf0ab('0x39')]==='agent'||_0x40f19b[_0xf0ab('0x39')]===_0xf0ab('0x3f');});if(!_0x409295)return _0x463980;return db[_0xf0ab('0xa0')][_0xf0ab('0x66')]({'where':{'name':{'$or':[_0xf0ab('0xa1'),_0xf0ab('0x3e')]},'userProfileId':_0x542d27[_0xf0ab('0x3c')][_0xf0ab('0xa2')]},'raw':!![]})[_0xf0ab('0x20')](function(_0x1c77e4){if(_['isEmpty'](_0x1c77e4)||!_['some'](_0x1c77e4,['autoAssociation',0x0]))return _0x463980;_0x270bc1=[];var _0x2f339d=_(_0x1c77e4)['map'](function(_0x562b44){if(_0x562b44[_0xf0ab('0xa3')]===0x1)return;return _0x562b44[_0xf0ab('0x45')]===_0xf0ab('0xa1')?_0xf0ab('0x3d'):_0xf0ab('0x3f');})['compact']()[_0xf0ab('0x43')]();for(var _0x22129b=0x0;_0x22129b<_0x463980[_0xf0ab('0x56')];_0x22129b++){if(!_[_0xf0ab('0x64')](_0x2f339d,_0x463980[_0x22129b][_0xf0ab('0x39')]))return;var _0x1c7ced=_0x463980[_0x22129b][_0xf0ab('0x39')]===_0xf0ab('0x3d')?'Agents':_0xf0ab('0x3e');_0x270bc1['push'](db[_0xf0ab('0x46')][_0xf0ab('0x9e')]({'name':_0x463980[_0x22129b]['name'],'resourceId':_0x463980[_0x22129b]['id'],'type':_0x1c7ced,'sectionId':_[_0xf0ab('0x44')](_0x1c77e4,[_0xf0ab('0x45'),_0x1c7ced])['id']},{}));}return BPromise[_0xf0ab('0x70')](_0x270bc1);});})[_0xf0ab('0x20')](respondWithResult(_0x426da1,0xc9))[_0xf0ab('0x71')](handleError(_0x426da1,null));};exports[_0xf0ab('0xa8')]=function(_0x1f2efa,_0x1d12fb,_0xd86fc6){if(_0x1f2efa['body']['id']){delete _0x1f2efa[_0xf0ab('0x79')]['id'];}return db[_0xf0ab('0x4a')]['find']({'where':{'id':_0x1f2efa[_0xf0ab('0x73')]['id']}})[_0xf0ab('0x20')](function(_0x135a10){if(!_0x135a10)return null;if(_0x135a10['id']===_0x1f2efa[_0xf0ab('0x3c')]['id']){if(!_0x1f2efa['body']['oldPassword']||!_0x1f2efa[_0xf0ab('0x79')][_0xf0ab('0xa9')]){throw new db['Sequelize'][(_0xf0ab('0xaa'))](_0xf0ab('0xab'));}if(!_0x135a10[_0xf0ab('0xac')](_0x1f2efa[_0xf0ab('0x79')][_0xf0ab('0xad')])){throw new db[(_0xf0ab('0xae'))]['ValidationError'](_0xf0ab('0xaf'));}if(_0x1f2efa['body'][_0xf0ab('0xad')]===_0x1f2efa[_0xf0ab('0x79')][_0xf0ab('0xa9')]){throw new db['Sequelize'][(_0xf0ab('0xaa'))](_0xf0ab('0xb0'));}}else if(_0x1f2efa[_0xf0ab('0x3c')][_0xf0ab('0x39')]===_0xf0ab('0x3a')){if(!_0x1f2efa[_0xf0ab('0x79')][_0xf0ab('0xa9')]){throw new db[(_0xf0ab('0xae'))][(_0xf0ab('0xaa'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x1f2efa['user'][_0xf0ab('0x39')]===_0xf0ab('0x3c')){if(!_0x1f2efa[_0xf0ab('0x79')][_0xf0ab('0xa9')]){throw new db[(_0xf0ab('0xae'))][(_0xf0ab('0xaa'))](_0xf0ab('0xb1'));}if(_0x135a10[_0xf0ab('0x39')]!==_0xf0ab('0x3d')){throw new db[(_0xf0ab('0xae'))]['ValidationError'](_0xf0ab('0x99'));}}else{throw new db[(_0xf0ab('0xae'))][(_0xf0ab('0xaa'))](_0xf0ab('0x99'));}return _0x135a10;})[_0xf0ab('0x20')](handleEntityNotFound(_0x1d12fb,null))[_0xf0ab('0x20')](function(_0x57f44d){return db[_0xf0ab('0x7f')][_0xf0ab('0xb2')]({'attributes':['id',_0xf0ab('0x81'),'enforcePasswordHistory',_0xf0ab('0xb3')]})['then'](function(_0x562b06){if(_0x562b06[_0xf0ab('0x81')])authService[_0xf0ab('0x82')](_0x1f2efa[_0xf0ab('0x79')]['newPassword']);if(!_0x562b06[_0xf0ab('0xb4')]||!_0x57f44d[_0xf0ab('0xb5')])return _0x57f44d;authService[_0xf0ab('0xb6')](_0x1f2efa['body'][_0xf0ab('0xa9')],_0x57f44d[_0xf0ab('0xb5')],_0x562b06[_0xf0ab('0xb3')]);return _0x57f44d;})['then'](saveUpdates({'password':_0x1f2efa[_0xf0ab('0x79')][_0xf0ab('0xa9')],'passwordResetAt':_0x1f2efa[_0xf0ab('0x3c')]['id']==_0x1f2efa[_0xf0ab('0x73')]['id']?moment():null,'previousPasswords':authService[_0xf0ab('0xb7')](_0x1f2efa[_0xf0ab('0x79')][_0xf0ab('0xa9')],_0x57f44d[_0xf0ab('0xb5')])},null));})[_0xf0ab('0x20')](respondWithResult(_0x1d12fb,null))[_0xf0ab('0x71')](handleError(_0x1d12fb,null));};exports[_0xf0ab('0xb8')]=function(_0x5689d5,_0x2eadac,_0x240539){var _0x5abb0a=_0x5689d5['body'][_0xf0ab('0xb9')];return db[_0xf0ab('0x4a')]['find']({'where':{'id':_0x5689d5[_0xf0ab('0x73')]['id']},'attributes':['id','name',_0xf0ab('0x39'),_0xf0ab('0xba'),_0xf0ab('0xbb'),_0xf0ab('0xbc'),_0xf0ab('0xbd')]})[_0xf0ab('0x20')](handleEntityNotFound(_0x2eadac,null))[_0xf0ab('0x20')](function(_0x50b2ee){if(_0x50b2ee){if(!utils[_0xf0ab('0xbe')](_0x5abb0a)){throw new db[(_0xf0ab('0xae'))]['ValidationError'](_0xf0ab('0xbf'));}return _0x50b2ee[_0xf0ab('0xc0')+_[_0xf0ab('0xc1')](_0x5abb0a[_0xf0ab('0xc2')]())+_0xf0ab('0xc3')](_0x5689d5[_0xf0ab('0x79')]['ids'],{'penalty':_0x5689d5['body'][_0xf0ab('0xc4')]||0x0})[_0xf0ab('0xc5')](function(_0x564124){for(var _0x2e29aa=0x0;_0x2e29aa<_0x5689d5[_0xf0ab('0x79')][_0xf0ab('0x7c')]['length'];_0x2e29aa+=0x1){var _0x3030d7={'UserId':Number(_0x5689d5[_0xf0ab('0x73')]['id'])};_0x3030d7[_[_0xf0ab('0xc1')](_0x5abb0a[_0xf0ab('0xc2')]())+'QueueId']=Number(_0x5689d5[_0xf0ab('0x79')][_0xf0ab('0x7c')][_0x2e29aa]);socket[_0xf0ab('0xc6')]('user'+_['capitalize'](_0x5abb0a['toLowerCase']())+_0xf0ab('0xc7'),_0x3030d7);}return _0x564124;})[_0xf0ab('0x20')](function(){if(_0x5abb0a===_0xf0ab('0xc8')){return db[_0xf0ab('0xc9')]['findAll']({'where':{'id':_0x5689d5[_0xf0ab('0x79')]['ids']||[]},'raw':!![],'attributes':['id',_0xf0ab('0x45')]});}})[_0xf0ab('0x20')](function(_0x391cde){var _0x18158f=_0x50b2ee[_0xf0ab('0x38')]({'plain':!![]});var _0x283fe8=[];if(_0x5abb0a===_0xf0ab('0xc8')&&_0x18158f[_0xf0ab('0x39')]===_0xf0ab('0x3d')&&_0x18158f[_0xf0ab('0xba')]){for(var _0x482d2a=0x0;_0x482d2a<_0x391cde[_0xf0ab('0x56')];_0x482d2a+=0x1){_0x283fe8[_0xf0ab('0x65')]({'membername':_0x18158f[_0xf0ab('0x45')],'UserId':_0x18158f['id'],'queue_name':_0x391cde[_0x482d2a]['name'],'VoiceQueueId':_0x391cde[_0x482d2a]['id'],'interface':_[_0xf0ab('0x84')](_0x18158f[_0xf0ab('0xbd')])?util[_0xf0ab('0xca')]('SIP/%s',_0x18158f[_0xf0ab('0x45')]):_0x18158f[_0xf0ab('0xbd')],'paused':_0x18158f[_0xf0ab('0xbc')]||![],'penalty':_0x5689d5[_0xf0ab('0x79')]['penalty']||0x0});}return BPromise[_0xf0ab('0xa7')](_0x283fe8,function(_0x22a1ca){return db[_0xf0ab('0xcb')][_0xf0ab('0xcc')](_0x22a1ca);});}return _0x50b2ee;});}})[_0xf0ab('0x20')](respondWithStatusCode(_0x2eadac,null))[_0xf0ab('0x71')](handleError(_0x2eadac,null));};exports[_0xf0ab('0xcd')]=function(_0x2fbac2,_0x5bf34c,_0xadae03){var _0x550b00;return db[_0xf0ab('0x4a')][_0xf0ab('0x44')]({'where':{'id':_0x2fbac2[_0xf0ab('0x73')]['id']},'attributes':['id','name',_0xf0ab('0x39')]})[_0xf0ab('0x20')](handleEntityNotFound(_0x5bf34c,null))['then'](function(_0x5d62e4){if(_0x5d62e4){_0x550b00=_0x5d62e4;if(!_0x2fbac2['query']['channel']||!utils[_0xf0ab('0xbe')](_0x2fbac2['query']['channel'])){throw new db[(_0xf0ab('0xae'))][(_0xf0ab('0xaa'))](_0xf0ab('0xbf'));}return _0x5d62e4['remove'+_['capitalize'](_0x2fbac2[_0xf0ab('0x51')][_0xf0ab('0xb9')]['toLowerCase']())+_0xf0ab('0xc3')](_0x2fbac2[_0xf0ab('0x51')]['ids']);}})['then'](function(_0x4fe9b8){if(_[_0xf0ab('0xce')](_0x2fbac2[_0xf0ab('0x51')][_0xf0ab('0x7c')])){for(var _0x1e7516=0x0;_0x1e7516<_0x2fbac2['query'][_0xf0ab('0x7c')][_0xf0ab('0x56')];_0x1e7516+=0x1){var _0x2ed8f8={'UserId':Number(_0x2fbac2['params']['id'])};_0x2ed8f8[_['capitalize'](_0x2fbac2[_0xf0ab('0x51')]['channel'][_0xf0ab('0xc2')]())+_0xf0ab('0xcf')]=Number(_0x2fbac2[_0xf0ab('0x51')][_0xf0ab('0x7c')][_0x1e7516]);socket[_0xf0ab('0xc6')](_0xf0ab('0x3c')+_[_0xf0ab('0xc1')](_0x2fbac2[_0xf0ab('0x51')][_0xf0ab('0xb9')][_0xf0ab('0xc2')]())+_0xf0ab('0xd0'),_0x2ed8f8);}}else{var _0x2ed8f8={'UserId':Number(_0x2fbac2['params']['id'])};_0x2ed8f8[_[_0xf0ab('0xc1')](_0x2fbac2[_0xf0ab('0x51')][_0xf0ab('0xb9')]['toLowerCase']())+'QueueId']=Number(_0x2fbac2[_0xf0ab('0x51')][_0xf0ab('0x7c')]);socket[_0xf0ab('0xc6')](_0xf0ab('0x3c')+_[_0xf0ab('0xc1')](_0x2fbac2[_0xf0ab('0x51')][_0xf0ab('0xb9')][_0xf0ab('0xc2')]())+_0xf0ab('0xd0'),_0x2ed8f8);}return _0x4fe9b8;})[_0xf0ab('0x20')](function(){if(_0x2fbac2[_0xf0ab('0x51')][_0xf0ab('0xb9')]===_0xf0ab('0xc8')){return db[_0xf0ab('0xcb')][_0xf0ab('0x37')]({'where':{'UserId':_0x2fbac2[_0xf0ab('0x73')]['id'],'VoiceQueueId':_0x2fbac2[_0xf0ab('0x51')][_0xf0ab('0x7c')]},'individualHooks':!![]})[_0xf0ab('0x20')](function(){return _0x550b00;});}return _0x550b00;})[_0xf0ab('0x20')](respondWithStatusCode(_0x5bf34c,null))[_0xf0ab('0x71')](handleError(_0x5bf34c,null));};exports['addAvatar']=function(_0xcaf546,_0x5b1602,_0x400992){_0xcaf546[_0xf0ab('0x79')][_0xf0ab('0xd1')]=_0xcaf546[_0xf0ab('0xd2')]['filename'];return db[_0xf0ab('0x4a')]['find']({'where':{'id':_0xcaf546['params']['id']}})['then'](handleEntityNotFound(_0x5b1602,null))[_0xf0ab('0x20')](saveUpdates(_0xcaf546[_0xf0ab('0x79')],null))[_0xf0ab('0x20')](respondWithResult(_0x5b1602,null))['catch'](handleError(_0x5b1602,null));};exports[_0xf0ab('0xd3')]=function(_0x42bf23,_0x2cb0cf,_0x4f3960){var _0x369bda=path[_0xf0ab('0xd4')](config[_0xf0ab('0xd5')],_0xf0ab('0xd6'));return db[_0xf0ab('0x4a')][_0xf0ab('0x44')]({'where':{'id':_0x42bf23[_0xf0ab('0x73')]['id']},'attributes':['id',_0xf0ab('0xd1')],'raw':!![]})['then'](handleEntityNotFound(_0x2cb0cf,null))[_0xf0ab('0x20')](function(_0x2ca5e6){if(_0x2ca5e6){if(_[_0xf0ab('0x84')](_0x2ca5e6[_0xf0ab('0xd1')])){return _0x2cb0cf['download'](_0x369bda);}else{if(!fs[_0xf0ab('0xd7')](path['join'](config[_0xf0ab('0xd5')],'server/files/images/',_0x2ca5e6[_0xf0ab('0xd1')]))){return _0x2cb0cf[_0xf0ab('0xd8')](_0x369bda);}return _0x2cb0cf['download'](path[_0xf0ab('0xd4')](config[_0xf0ab('0xd5')],_0xf0ab('0xd9'),_0x2ca5e6[_0xf0ab('0xd1')]));}}})[_0xf0ab('0x71')](handleError(_0x2cb0cf,null));};exports['getOpenTabs']=function(_0x229e67,_0x3600d5,_0x3b14f5){return db['User']['find']({'where':{'id':_0x229e67[_0xf0ab('0x73')]['id']},'attributes':['id']})[_0xf0ab('0x20')](handleEntityNotFound(_0x3600d5,null))[_0xf0ab('0x20')](function(_0x3685ce){var _0x5d1c06=[];values=_0x3685ce['dataValues'];_0x5d1c06[_0xf0ab('0x65')](get_open_tabs(_0xf0ab('0xda'),_0x3685ce['dataValues']));_0x5d1c06['push'](get_open_tabs(_0xf0ab('0x6a'),_0x3685ce['dataValues']));_0x5d1c06[_0xf0ab('0x65')](get_open_tabs('openchannel',_0x3685ce[_0xf0ab('0x69')]));_0x5d1c06[_0xf0ab('0x65')](get_open_tabs(_0xf0ab('0x6f'),_0x3685ce[_0xf0ab('0x69')]));_0x5d1c06[_0xf0ab('0x65')](get_open_tabs(_0xf0ab('0x6c'),_0x3685ce[_0xf0ab('0x69')]));_0x5d1c06[_0xf0ab('0x65')](get_open_tabs('mail',_0x3685ce[_0xf0ab('0x69')]));return BPromise[_0xf0ab('0x70')](_0x5d1c06);})[_0xf0ab('0x20')](function(_0x15f041){var _0x34d2dd=[];if(_0x15f041){for(var _0x3545c1=0x0;_0x3545c1=_0x58c0d0){_0x4cef9c=_0x58c0d0;_0x53db78=0xc8;}else{_0x53db78=0xce;}_0x82b568[_0x3d94('0x29')](_0x53db78);return _0x82b568[_0x3d94('0x2f')](_0x3d94('0x30'),_0xef9644+'-'+_0x4cef9c+'/'+_0x58c0d0)[_0x3d94('0x2a')](_0x47d6ab);}return null;};}function patchUpdates(_0x50560c){return function(_0x18f854){try{jsonpatch['apply'](_0x18f854,_0x50560c,!![]);}catch(_0x1f9559){return BPromise[_0x3d94('0x31')](_0x1f9559);}return _0x18f854['save']();};}function saveUpdates(_0x5288da,_0x24bffe){return function(_0x280c73){if(_0x280c73){return _0x280c73[_0x3d94('0x32')](_0x5288da)['then'](function(_0x1e6dbc){return _0x1e6dbc;});}return null;};}function removeEntity(_0x3d29fd,_0x5426bd){return function(_0x242500){if(_0x242500){return _0x242500[_0x3d94('0x33')]()[_0x3d94('0x1d')](function(){var _0xbda334=_0x242500[_0x3d94('0x34')]({'plain':!![]});if(_0xbda334['role']===_0x3d94('0x35'))return;var _0x42b742=[{'name':_0x3d94('0x36'),'value':_0x3d94('0x37'),'ignore':!![]},{'name':_0x3d94('0x38'),'value':_0x3d94('0x39'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0xfe58eb=_(_0x42b742)[_0x3d94('0x3a')](_0x3d94('0x3b'))[_0x3d94('0x3c')](_0x3d94('0x3d'))[_0x3d94('0x3d')]();if(_[_0x3d94('0x3e')](_0xfe58eb,_0xbda334[_0x3d94('0x3f')])){return;}var _0x2e7b97=_[_0x3d94('0x40')](_0x42b742,['value',_0xbda334[_0x3d94('0x3f')]])[_0x3d94('0x41')];return db[_0x3d94('0x42')][_0x3d94('0x33')]({'where':{'type':_0x2e7b97,'resourceId':_0xbda334['id']}})['then'](function(){return _0x242500;});})[_0x3d94('0x1d')](function(){_0x3d29fd[_0x3d94('0x29')](0xcc)[_0x3d94('0x43')]();});}};}function handleEntityNotFound(_0x29eaa4,_0x22b7d2){return function(_0x4b5a1a){if(!_0x4b5a1a){_0x29eaa4[_0x3d94('0x44')](0x194);}return _0x4b5a1a;};}function handleError(_0x462ab6,_0x1d3d41){_0x1d3d41=_0x1d3d41||0x1f4;return function(_0x485066){logger['error'](_0x485066['stack']);if(_0x485066['name']){delete _0x485066[_0x3d94('0x41')];}_0x462ab6[_0x3d94('0x29')](_0x1d3d41)[_0x3d94('0x45')](_0x485066);};}exports[_0x3d94('0x46')]=function(_0x1a2348,_0x24a522){var _0x3a3898={},_0x5b6a17={},_0x52ea5e={'count':0x0,'rows':[]};var _0x118fda=_[_0x3d94('0x3c')](db['User'][_0x3d94('0x47')],function(_0x4af4b6){return{'name':_0x4af4b6[_0x3d94('0x48')],'type':_0x4af4b6[_0x3d94('0x49')][_0x3d94('0x4a')]};});_0x5b6a17[_0x3d94('0x4b')]=_[_0x3d94('0x4c')](_['map'](_0x118fda,_0x3d94('0x41')),[_0x3d94('0x4d'),_0x3d94('0x4e')]);_0x5b6a17['query']=_[_0x3d94('0x4f')](_0x1a2348['query']);_0x5b6a17['filters']=_[_0x3d94('0x50')](_0x5b6a17[_0x3d94('0x4b')],_0x5b6a17[_0x3d94('0x51')]);_0x3a3898[_0x3d94('0x52')]=_['intersection'](_0x5b6a17[_0x3d94('0x4b')],qs['fields'](_0x1a2348[_0x3d94('0x51')][_0x3d94('0x53')]));_0x3a3898[_0x3d94('0x52')]=_0x3a3898[_0x3d94('0x52')][_0x3d94('0x54')]?_0x3a3898[_0x3d94('0x52')]:_0x5b6a17[_0x3d94('0x4b')];if(!_0x1a2348['query'][_0x3d94('0x55')](_0x3d94('0x56'))){_0x3a3898['limit']=qs['limit'](_0x1a2348[_0x3d94('0x51')][_0x3d94('0x2e')]);_0x3a3898['offset']=qs[_0x3d94('0x2b')](_0x1a2348[_0x3d94('0x51')][_0x3d94('0x2b')]);}_0x3a3898[_0x3d94('0x57')]=qs[_0x3d94('0x58')](_0x1a2348[_0x3d94('0x51')][_0x3d94('0x58')]);_0x3a3898[_0x3d94('0x59')]=qs[_0x3d94('0x5a')](_[_0x3d94('0x5b')](_0x1a2348[_0x3d94('0x51')],_0x5b6a17[_0x3d94('0x5a')]),_0x118fda);if(_0x1a2348[_0x3d94('0x51')][_0x3d94('0x3a')]){_0x3a3898[_0x3d94('0x59')]=_['merge'](_0x3a3898[_0x3d94('0x59')],{'$or':_[_0x3d94('0x3c')](_0x118fda,function(_0x1a9338){if(_0x1a9338[_0x3d94('0x49')]!==_0x3d94('0x5c')){return db[_0x3d94('0x5d')][_0x3d94('0x59')](db[_0x3d94('0x5d')]['fn'](_0x3d94('0x5e'),db['sequelize'][_0x3d94('0x5f')](_0x1a9338['name'])),{'$like':db[_0x3d94('0x5d')]['fn'](_0x3d94('0x5e'),'%'+_0x1a2348['query'][_0x3d94('0x3a')]+'%')});}})});}_0x3a3898=_['merge']({},_0x3a3898,_0x1a2348['options']);var _0x335247={'where':_0x3a3898['where']};return db[_0x3d94('0x60')][_0x3d94('0x2d')](_0x335247)['then'](function(_0x426ccb){_0x52ea5e['count']=_0x426ccb;if(_0x1a2348['query'][_0x3d94('0x61')]){_0x3a3898[_0x3d94('0x62')]=[{'all':!![]}];}if(!_[_0x3d94('0x3e')](_0x3a3898[_0x3d94('0x52')],'id')){_0x3a3898[_0x3d94('0x52')][_0x3d94('0x63')]('id');}return db[_0x3d94('0x60')][_0x3d94('0x64')](_0x3a3898);})[_0x3d94('0x1d')](function(_0x584e1d){_0x52ea5e[_0x3d94('0x65')]=_0x584e1d;if(_0x1a2348[_0x3d94('0x51')][_0x3d94('0x66')]===_0x3d94('0x67')){var _0xe7d1dc=[];for(var _0x3e1992=0x0;_0x3e1992<_0x52ea5e[_0x3d94('0x65')][_0x3d94('0x54')];_0x3e1992++){_0xe7d1dc[_0x3d94('0x63')](get_open_tabs(_0x3d94('0x68'),_0x52ea5e[_0x3d94('0x65')][_0x3e1992]['dataValues']));_0xe7d1dc[_0x3d94('0x63')](get_open_tabs('sms',_0x52ea5e[_0x3d94('0x65')][_0x3e1992][_0x3d94('0x69')]));_0xe7d1dc[_0x3d94('0x63')](get_open_tabs(_0x3d94('0x6a'),_0x52ea5e[_0x3d94('0x65')][_0x3e1992][_0x3d94('0x69')]));_0xe7d1dc[_0x3d94('0x63')](get_open_tabs(_0x3d94('0x6b'),_0x52ea5e[_0x3d94('0x65')][_0x3e1992]['dataValues']));_0xe7d1dc['push'](get_open_tabs(_0x3d94('0x6c'),_0x52ea5e['rows'][_0x3e1992][_0x3d94('0x69')]));_0xe7d1dc[_0x3d94('0x63')](get_open_tabs('whatsapp',_0x52ea5e[_0x3d94('0x65')][_0x3e1992][_0x3d94('0x69')]));}return BPromise[_0x3d94('0x6d')](_0xe7d1dc)[_0x3d94('0x1d')](function(_0xcefff5){return _0x52ea5e;});}else{return _0x52ea5e;}})[_0x3d94('0x1d')](respondWithFilteredResult(_0x24a522,_0x3a3898))[_0x3d94('0x28')](handleError(_0x24a522,null));};exports['show']=function(_0x22dbf9,_0x351ea6){var _0x368581={'raw':![],'where':{'id':_0x22dbf9[_0x3d94('0x6e')]['id']}},_0x4b23b5={};_0x4b23b5[_0x3d94('0x4b')]=_[_0x3d94('0x4c')](_[_0x3d94('0x4f')](db['User']['rawAttributes']),[_0x3d94('0x4d'),_0x3d94('0x4e')]);_0x4b23b5[_0x3d94('0x51')]=_[_0x3d94('0x4f')](_0x22dbf9['query']);_0x4b23b5[_0x3d94('0x5a')]=_[_0x3d94('0x50')](_0x4b23b5['model'],_0x4b23b5[_0x3d94('0x51')]);_0x368581[_0x3d94('0x52')]=_[_0x3d94('0x50')](_0x4b23b5['model'],qs[_0x3d94('0x53')](_0x22dbf9[_0x3d94('0x51')][_0x3d94('0x53')]));_0x368581['attributes']=_0x368581[_0x3d94('0x52')][_0x3d94('0x54')]?_0x368581['attributes']:_0x4b23b5['model'];if(_0x22dbf9['query'][_0x3d94('0x61')]){_0x368581[_0x3d94('0x62')]=[{'all':!![]}];}_0x368581=_[_0x3d94('0x6f')]({},_0x368581,_0x22dbf9[_0x3d94('0x70')]);if(!_[_0x3d94('0x3e')](_0x368581['attributes'],'id')){_0x368581[_0x3d94('0x52')][_0x3d94('0x63')]('id');}return db[_0x3d94('0x60')][_0x3d94('0x40')](_0x368581)[_0x3d94('0x1d')](handleEntityNotFound(_0x351ea6,null))[_0x3d94('0x1d')](function(_0x59abcc){var _0x30673a=[];values=_0x59abcc;if(_0x22dbf9['query'][_0x3d94('0x66')]===_0x3d94('0x67')){_0x30673a[_0x3d94('0x63')](get_open_tabs(_0x3d94('0x68'),_0x59abcc[_0x3d94('0x69')]));_0x30673a[_0x3d94('0x63')](get_open_tabs('sms',_0x59abcc['dataValues']));_0x30673a[_0x3d94('0x63')](get_open_tabs('openchannel',_0x59abcc['dataValues']));_0x30673a['push'](get_open_tabs(_0x3d94('0x71'),_0x59abcc[_0x3d94('0x69')]));_0x30673a[_0x3d94('0x63')](get_open_tabs(_0x3d94('0x6a'),_0x59abcc[_0x3d94('0x69')]));_0x30673a[_0x3d94('0x63')](get_open_tabs(_0x3d94('0x6b'),_0x59abcc[_0x3d94('0x69')]));return BPromise['all'](_0x30673a);}else{return values;}})[_0x3d94('0x1d')](function(_0x5e55a4){return values;})[_0x3d94('0x1d')](respondWithResult(_0x351ea6,null))[_0x3d94('0x28')](handleError(_0x351ea6,null));};exports[_0x3d94('0x32')]=function(_0x50eb9b,_0x55084e){if(_0x50eb9b['body']['id']){delete _0x50eb9b[_0x3d94('0x72')]['id'];}delete _0x50eb9b[_0x3d94('0x72')][_0x3d94('0x3f')];return db[_0x3d94('0x60')][_0x3d94('0x40')]({'where':{'id':_0x50eb9b['params']['id']}})['then'](handleEntityNotFound(_0x55084e,null))[_0x3d94('0x1d')](saveUpdates(_0x50eb9b[_0x3d94('0x72')],null))[_0x3d94('0x1d')](respondWithResult(_0x55084e,null))['catch'](handleError(_0x55084e,null));};exports[_0x3d94('0x73')]=function(_0x53d471,_0x255d56){return db[_0x3d94('0x60')][_0x3d94('0x73')]()[_0x3d94('0x1d')](respondWithResult(_0x255d56,null))[_0x3d94('0x28')](handleError(_0x255d56,null));};exports[_0x3d94('0x74')]=function(_0x234bce,_0x19476d,_0x32d245){return db[_0x3d94('0x60')][_0x3d94('0x40')]({'where':{'id':_0x234bce[_0x3d94('0x6e')]['id']}})[_0x3d94('0x1d')](handleEntityNotFound(_0x19476d,null))['then'](function(_0x2a6df3){if(_0x2a6df3){return _0x2a6df3[_0x3d94('0x74')](_0x234bce[_0x3d94('0x72')][_0x3d94('0x75')],_['omit'](_0x234bce[_0x3d94('0x72')],['ids','id'])||{});}})['then'](respondWithResult(_0x19476d,null))[_0x3d94('0x28')](handleError(_0x19476d,null));};function validateUser(_0x55fed9){return new BPromise(function(_0x326bac,_0x45daa1){if(_0x55fed9['internal'])return _0x326bac(_0x55fed9);return db[_0x3d94('0x76')]['findById'](0x1)[_0x3d94('0x1d')](function(_0x23cd7a){if(_0x23cd7a['securePassword'])authService['validatePasswordPattern'](_0x55fed9['password']);db[_0x3d94('0x60')]['max']('internal')[_0x3d94('0x1d')](function(_0x39ea2a){if(_[_0x3d94('0x77')](_0x39ea2a)){_0x55fed9[_0x3d94('0x78')]=_0x23cd7a['min_internal']||0x1;return;}if(_[_0x3d94('0x77')](_0x23cd7a[_0x3d94('0x79')])||_0x23cd7a[_0x3d94('0x79')]===_0x39ea2a){_0x55fed9[_0x3d94('0x78')]=_0x39ea2a+0x1;return;}if(_0x23cd7a[_0x3d94('0x79')]>_0x39ea2a){_0x55fed9[_0x3d94('0x78')]=_0x23cd7a['min_internal'];return;}return db[_0x3d94('0x5d')][_0x3d94('0x51')](_0x3d94('0x7a'),{'type':db[_0x3d94('0x5d')][_0x3d94('0x7b')][_0x3d94('0x7c')]})[_0x3d94('0x1d')](function(_0x42d2c0){if(_0x42d2c0&&_0x42d2c0['length']){for(var _0x535d01=0x0,_0x2977ac=_0x42d2c0[_0x3d94('0x54')];_0x535d01<_0x2977ac&&_[_0x3d94('0x77')](_0x55fed9['internal']);_0x535d01++){if(_0x23cd7a[_0x3d94('0x79')]<=_0x42d2c0[_0x535d01][_0x3d94('0x7d')]){_0x55fed9[_0x3d94('0x78')]=_0x42d2c0[_0x535d01][_0x3d94('0x7d')];}else if(_0x23cd7a[_0x3d94('0x79')]>_0x42d2c0[_0x535d01]['from']&&_0x23cd7a['min_internal']<=_0x42d2c0[_0x535d01]['to']){_0x55fed9[_0x3d94('0x78')]=_0x23cd7a[_0x3d94('0x79')];}}}if(_[_0x3d94('0x77')](_0x55fed9[_0x3d94('0x78')])){_0x55fed9[_0x3d94('0x78')]=_0x39ea2a+0x1;}return _0x326bac(_0x55fed9);});});})[_0x3d94('0x28')](function(_0x152f3a){_0x45daa1(_0x152f3a);});});}function updateUser(_0x3bcc86){return new BPromise(function(_0x462e88,_0x35caf5){try{if(_0x3bcc86[_0x3d94('0x7e')]){_0x3bcc86[_0x3d94('0x7f')]=_0x3bcc86[_0x3d94('0x78')];_0x3bcc86['VoiceMail']={'mailbox':_0x3bcc86[_0x3d94('0x78')],'password':_0x3bcc86[_0x3d94('0x4d')],'fullname':_0x3bcc86['fullname'],'email':_0x3bcc86['email']};}if(_0x3bcc86[_0x3d94('0x3f')]===_0x3d94('0x39')){if(!_0x3bcc86[_0x3d94('0x80')])_0x3bcc86[_0x3d94('0x80')]=['101','102',_0x3d94('0x81'),_0x3d94('0x82'),_0x3d94('0x83'),_0x3d94('0x84'),_0x3d94('0x85'),'106',_0x3d94('0x86'),'108',_0x3d94('0x87'),_0x3d94('0x88'),_0x3d94('0x89'),'114',_0x3d94('0x8a')];}_0x462e88(_0x3bcc86);}catch(_0x141032){_0x35caf5(_0x141032);}});}exports['create']=function(_0x205b9d,_0x54297a){if(_0x205b9d[_0x3d94('0x37')][_0x3d94('0x3f')]===_0x3d94('0x39'))throw new Error('Unauthorized');if(_0x205b9d[_0x3d94('0x72')][_0x3d94('0x3f')]===_0x3d94('0x37')&&_0x205b9d['user'][_0x3d94('0x3f')]!==_0x3d94('0x35')){throw new Error(_0x3d94('0x8b'));}if(_0x205b9d[_0x3d94('0x72')][_0x3d94('0x3f')]===_0x3d94('0x35')&&_0x205b9d[_0x3d94('0x37')][_0x3d94('0x3f')]!=='admin'){throw new Error(_0x3d94('0x8c'));}return licenseUtil[_0x3d94('0x8d')]([_0x205b9d[_0x3d94('0x72')]])[_0x3d94('0x1d')](function(){return validateUser(_0x205b9d[_0x3d94('0x72')]);})[_0x3d94('0x1d')](function(_0x5716fd){return updateUser(_0x5716fd)[_0x3d94('0x1d')](function(_0x725417){if(_0x725417[_0x3d94('0x3f')]==='admin'){_0x725417[_0x3d94('0x8e')]=_0x205b9d['user'][_0x3d94('0x8e')];delete _0x725417[_0x3d94('0x8f')];}return _0x725417;});})['then'](function(_0x73b09c){return db[_0x3d94('0x60')]['create'](_0x73b09c,{'include':[{'model':db['VoiceMail'],'as':_0x3d94('0x90')}]});})[_0x3d94('0x1d')](function(_0x48a22f){if(_0x205b9d['body']['role']===_0x3d94('0x37'))return _0x48a22f;if(_0x205b9d[_0x3d94('0x37')][_0x3d94('0x3f')]!==_0x3d94('0x37'))return _0x48a22f;return db[_0x3d94('0x91')]['find']({'where':{'name':_0x48a22f[_0x3d94('0x3f')]===_0x3d94('0x39')?_0x3d94('0x38'):'Telephones','userProfileId':_0x205b9d[_0x3d94('0x37')]['userProfileId']},'raw':!![]})[_0x3d94('0x1d')](function(_0x26f8a1){if(!_0x26f8a1||_0x26f8a1[_0x3d94('0x92')]!=0x0)return _0x48a22f;return db[_0x3d94('0x42')][_0x3d94('0x93')]({'name':_0x48a22f['name'],'resourceId':_0x48a22f['id'],'type':_0x26f8a1['name'],'sectionId':_0x26f8a1['id']},{})[_0x3d94('0x1d')](function(){return _0x48a22f;});})[_0x3d94('0x28')](function(_0x479e71){logger[_0x3d94('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x479e71);throw _0x479e71;});})[_0x3d94('0x1d')](respondWithResult(_0x54297a,0xc9))[_0x3d94('0x28')](handleError(_0x54297a,null));};exports[_0x3d94('0x94')]=function(_0x5509a5,_0x406528){var _0x5ed9e7=_0x5509a5[_0x3d94('0x72')];var _0x3f7c35=[];if(_0x5509a5[_0x3d94('0x37')][_0x3d94('0x3f')]==='agent')throw new Error('Unauthorized');if(_[_0x3d94('0x95')](_0x5ed9e7,[_0x3d94('0x3f'),_0x3d94('0x37')])&&_0x5509a5[_0x3d94('0x37')]['role']!==_0x3d94('0x35')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x5ed9e7,['role',_0x3d94('0x35')])&&_0x5509a5[_0x3d94('0x37')][_0x3d94('0x3f')]!==_0x3d94('0x35')){throw new Error(_0x3d94('0x96'));}return licenseUtil[_0x3d94('0x8d')](_0x5ed9e7)[_0x3d94('0x1d')](function(){return validateUser(_0x5ed9e7[0x0]);})[_0x3d94('0x1d')](function(){for(var _0x2e2f9f=0x1;_0x2e2f9f<_0x5ed9e7[_0x3d94('0x54')];_0x2e2f9f++){var _0x213f3e=_0x5ed9e7[_0x2e2f9f-0x1][_0x3d94('0x78')];if(!_0x5ed9e7[_0x2e2f9f][_0x3d94('0x78')])_0x5ed9e7[_0x2e2f9f][_0x3d94('0x78')]=_0x213f3e+0x1;_0x3f7c35[_0x3d94('0x63')](validateUser(_0x5ed9e7[_0x2e2f9f]));}return BPromise['all'](_0x3f7c35);})['then'](function(){_0x3f7c35=[];for(var _0x14ec29=0x0;_0x14ec29<_0x5ed9e7[_0x3d94('0x54')];_0x14ec29++){_0x3f7c35[_0x3d94('0x63')](updateUser(_0x5ed9e7[_0x14ec29]));}return BPromise[_0x3d94('0x6d')](_0x3f7c35);})[_0x3d94('0x1d')](function(){return BPromise[_0x3d94('0x97')](_0x5ed9e7,function(_0x2d3c1a){return db['User'][_0x3d94('0x93')](_0x2d3c1a,{'include':[{'model':db[_0x3d94('0x90')],'as':_0x3d94('0x90')}]})[_0x3d94('0x1d')](function(_0x2096aa){_0x2d3c1a['id']=_0x2096aa['id'];return _0x2d3c1a;});});})[_0x3d94('0x1d')](function(_0x5aadef){if(_0x5509a5['body'][_0x3d94('0x3f')]==='user')return _0x5aadef;if(_0x5509a5[_0x3d94('0x37')][_0x3d94('0x3f')]!==_0x3d94('0x37'))return _0x5aadef;var _0x16853d=_[_0x3d94('0x95')](_0x5aadef,function(_0x36e600){return _0x36e600[_0x3d94('0x3f')]===_0x3d94('0x39')||_0x36e600['role']===_0x3d94('0x98');});if(!_0x16853d)return _0x5aadef;return db[_0x3d94('0x91')][_0x3d94('0x64')]({'where':{'name':{'$or':[_0x3d94('0x38'),_0x3d94('0x99')]},'userProfileId':_0x5509a5[_0x3d94('0x37')][_0x3d94('0x8f')]},'raw':!![]})[_0x3d94('0x1d')](function(_0x1c7315){if(_[_0x3d94('0x9a')](_0x1c7315)||!_[_0x3d94('0x95')](_0x1c7315,[_0x3d94('0x92'),0x0]))return _0x5aadef;_0x3f7c35=[];var _0x17b789=_(_0x1c7315)[_0x3d94('0x3c')](function(_0x2d02db){if(_0x2d02db[_0x3d94('0x92')]===0x1)return;return _0x2d02db[_0x3d94('0x41')]===_0x3d94('0x38')?_0x3d94('0x39'):_0x3d94('0x98');})[_0x3d94('0x9b')]()['value']();for(var _0x464960=0x0;_0x464960<_0x5aadef[_0x3d94('0x54')];_0x464960++){if(!_[_0x3d94('0x3e')](_0x17b789,_0x5aadef[_0x464960][_0x3d94('0x3f')]))return;var _0x434b19=_0x5aadef[_0x464960][_0x3d94('0x3f')]==='agent'?_0x3d94('0x38'):_0x3d94('0x99');_0x3f7c35[_0x3d94('0x63')](db[_0x3d94('0x42')][_0x3d94('0x93')]({'name':_0x5aadef[_0x464960][_0x3d94('0x41')],'resourceId':_0x5aadef[_0x464960]['id'],'type':_0x434b19,'sectionId':_['find'](_0x1c7315,[_0x3d94('0x41'),_0x434b19])['id']},{}));}return BPromise[_0x3d94('0x6d')](_0x3f7c35);});})['then'](respondWithResult(_0x406528,0xc9))['catch'](handleError(_0x406528,null));};exports['changePassword']=function(_0x3e1139,_0x77b79d,_0x20b52d){if(_0x3e1139[_0x3d94('0x72')]['id']){delete _0x3e1139[_0x3d94('0x72')]['id'];}return db['User'][_0x3d94('0x40')]({'where':{'id':_0x3e1139[_0x3d94('0x6e')]['id']}})[_0x3d94('0x1d')](function(_0x669d83){if(!_0x669d83)return null;if(_0x669d83['id']===_0x3e1139[_0x3d94('0x37')]['id']){if(!_0x3e1139[_0x3d94('0x72')]['oldPassword']||!_0x3e1139[_0x3d94('0x72')]['newPassword']){throw new db[(_0x3d94('0x9c'))][(_0x3d94('0x9d'))](_0x3d94('0x9e'));}if(!_0x669d83[_0x3d94('0x9f')](_0x3e1139['body'][_0x3d94('0xa0')])){throw new db[(_0x3d94('0x9c'))][(_0x3d94('0x9d'))](_0x3d94('0xa1'));}if(_0x3e1139['body']['oldPassword']===_0x3e1139[_0x3d94('0x72')][_0x3d94('0xa2')]){throw new db[(_0x3d94('0x9c'))]['ValidationError'](_0x3d94('0xa3'));}}else if(_0x3e1139['user']['role']===_0x3d94('0x35')){if(!_0x3e1139[_0x3d94('0x72')]['newPassword']){throw new db[(_0x3d94('0x9c'))][(_0x3d94('0x9d'))](_0x3d94('0xa4'));}}else if(_0x3e1139['user'][_0x3d94('0x3f')]===_0x3d94('0x37')){if(!_0x3e1139['body']['newPassword']){throw new db[(_0x3d94('0x9c'))][(_0x3d94('0x9d'))](_0x3d94('0xa4'));}if(_0x669d83[_0x3d94('0x3f')]!==_0x3d94('0x39')){throw new db[(_0x3d94('0x9c'))]['ValidationError']('Unauthorized');}}else{throw new db['Sequelize']['ValidationError'](_0x3d94('0xa5'));}return _0x669d83;})[_0x3d94('0x1d')](handleEntityNotFound(_0x77b79d,null))[_0x3d94('0x1d')](function(_0x1073d3){return db[_0x3d94('0x76')][_0x3d94('0xa6')]({'attributes':['id',_0x3d94('0xa7'),_0x3d94('0xa8'),_0x3d94('0xa9')]})[_0x3d94('0x1d')](function(_0x5e9c90){if(_0x5e9c90['securePassword'])authService[_0x3d94('0xaa')](_0x3e1139['body'][_0x3d94('0xa2')]);if(!_0x5e9c90[_0x3d94('0xa8')]||!_0x1073d3[_0x3d94('0xab')])return _0x1073d3;authService[_0x3d94('0xac')](_0x3e1139[_0x3d94('0x72')][_0x3d94('0xa2')],_0x1073d3[_0x3d94('0xab')],_0x5e9c90[_0x3d94('0xa9')]);return _0x1073d3;})['then'](saveUpdates({'password':_0x3e1139[_0x3d94('0x72')][_0x3d94('0xa2')],'passwordResetAt':_0x3e1139[_0x3d94('0x37')]['id']==_0x3e1139[_0x3d94('0x6e')]['id']?moment():null,'previousPasswords':authService[_0x3d94('0xad')](_0x3e1139[_0x3d94('0x72')][_0x3d94('0xa2')],_0x1073d3[_0x3d94('0xab')])},null));})['then'](respondWithResult(_0x77b79d,null))[_0x3d94('0x28')](handleError(_0x77b79d,null));};exports[_0x3d94('0xae')]=function(_0x1e2ea5,_0x22931a,_0x3b6df7){var _0x3d02d8=_0x1e2ea5[_0x3d94('0x72')][_0x3d94('0xaf')];return db['User'][_0x3d94('0x40')]({'where':{'id':_0x1e2ea5[_0x3d94('0x6e')]['id']},'attributes':['id','name',_0x3d94('0x3f'),_0x3d94('0xb0'),_0x3d94('0xb1'),_0x3d94('0xb2'),_0x3d94('0xb3')]})[_0x3d94('0x1d')](handleEntityNotFound(_0x22931a,null))[_0x3d94('0x1d')](function(_0x26ff56){if(_0x26ff56){if(!utils[_0x3d94('0xb4')](_0x3d02d8)){throw new db[(_0x3d94('0x9c'))][(_0x3d94('0x9d'))](_0x3d94('0xb5'));}return _0x26ff56[_0x3d94('0xb6')+_[_0x3d94('0xb7')](_0x3d02d8[_0x3d94('0xb8')]())+_0x3d94('0xb9')](_0x1e2ea5[_0x3d94('0x72')][_0x3d94('0x75')],{'penalty':_0x1e2ea5[_0x3d94('0x72')][_0x3d94('0xba')]||0x0})[_0x3d94('0xbb')](function(_0x4353ca){for(var _0x3852d5=0x0;_0x3852d5<_0x1e2ea5[_0x3d94('0x72')][_0x3d94('0x75')]['length'];_0x3852d5+=0x1){var _0x4efd7e={'UserId':Number(_0x1e2ea5[_0x3d94('0x6e')]['id'])};_0x4efd7e[_['capitalize'](_0x3d02d8['toLowerCase']())+_0x3d94('0xbc')]=Number(_0x1e2ea5[_0x3d94('0x72')][_0x3d94('0x75')][_0x3852d5]);socket[_0x3d94('0xbd')](_0x3d94('0x37')+_['capitalize'](_0x3d02d8[_0x3d94('0xb8')]())+'Queue:save',_0x4efd7e);}return _0x4353ca;})[_0x3d94('0x1d')](function(){if(_0x3d02d8===_0x3d94('0xbe')){return db[_0x3d94('0xbf')][_0x3d94('0x64')]({'where':{'id':_0x1e2ea5[_0x3d94('0x72')][_0x3d94('0x75')]||[]},'raw':!![],'attributes':['id',_0x3d94('0x41')]});}})[_0x3d94('0x1d')](function(_0x1a4c9c){var _0x35c44e=_0x26ff56[_0x3d94('0x34')]({'plain':!![]});var _0xef2427=[];if(_0x3d02d8===_0x3d94('0xbe')&&_0x35c44e[_0x3d94('0x3f')]===_0x3d94('0x39')&&_0x35c44e['online']){for(var _0x594e4f=0x0;_0x594e4f<_0x1a4c9c['length'];_0x594e4f+=0x1){_0xef2427[_0x3d94('0x63')]({'membername':_0x35c44e[_0x3d94('0x41')],'UserId':_0x35c44e['id'],'queue_name':_0x1a4c9c[_0x594e4f]['name'],'VoiceQueueId':_0x1a4c9c[_0x594e4f]['id'],'interface':_[_0x3d94('0x77')](_0x35c44e[_0x3d94('0xb3')])?util['format'](_0x3d94('0xc0'),_0x35c44e[_0x3d94('0x41')]):_0x35c44e[_0x3d94('0xb3')],'paused':_0x35c44e[_0x3d94('0xb2')]||![],'penalty':_0x1e2ea5[_0x3d94('0x72')]['penalty']||0x0});}return BPromise[_0x3d94('0x97')](_0xef2427,function(_0x23b564){return db[_0x3d94('0xc1')][_0x3d94('0xc2')](_0x23b564);});}return _0x26ff56;});}})[_0x3d94('0x1d')](respondWithStatusCode(_0x22931a,null))[_0x3d94('0x28')](handleError(_0x22931a,null));};exports[_0x3d94('0xc3')]=function(_0x24f111,_0xd4661,_0x4d54e7){var _0x26bf00;return db[_0x3d94('0x60')][_0x3d94('0x40')]({'where':{'id':_0x24f111[_0x3d94('0x6e')]['id']},'attributes':['id',_0x3d94('0x41'),_0x3d94('0x3f')]})['then'](handleEntityNotFound(_0xd4661,null))['then'](function(_0x336a7d){if(_0x336a7d){_0x26bf00=_0x336a7d;if(!_0x24f111[_0x3d94('0x51')]['channel']||!utils[_0x3d94('0xb4')](_0x24f111[_0x3d94('0x51')][_0x3d94('0xaf')])){throw new db[(_0x3d94('0x9c'))][(_0x3d94('0x9d'))]('Unknown\x20channel');}return _0x336a7d[_0x3d94('0xc4')+_['capitalize'](_0x24f111[_0x3d94('0x51')]['channel']['toLowerCase']())+_0x3d94('0xb9')](_0x24f111[_0x3d94('0x51')][_0x3d94('0x75')]);}})[_0x3d94('0x1d')](function(_0x17159c){if(_['isArray'](_0x24f111[_0x3d94('0x51')]['ids'])){for(var _0x564fe8=0x0;_0x564fe8<_0x24f111['query'][_0x3d94('0x75')]['length'];_0x564fe8+=0x1){var _0x3a8d00={'UserId':Number(_0x24f111[_0x3d94('0x6e')]['id'])};_0x3a8d00[_[_0x3d94('0xb7')](_0x24f111[_0x3d94('0x51')][_0x3d94('0xaf')]['toLowerCase']())+_0x3d94('0xbc')]=Number(_0x24f111[_0x3d94('0x51')][_0x3d94('0x75')][_0x564fe8]);socket[_0x3d94('0xbd')](_0x3d94('0x37')+_[_0x3d94('0xb7')](_0x24f111['query'][_0x3d94('0xaf')]['toLowerCase']())+'Queue:remove',_0x3a8d00);}}else{var _0x3a8d00={'UserId':Number(_0x24f111['params']['id'])};_0x3a8d00[_[_0x3d94('0xb7')](_0x24f111[_0x3d94('0x51')][_0x3d94('0xaf')]['toLowerCase']())+'QueueId']=Number(_0x24f111[_0x3d94('0x51')]['ids']);socket[_0x3d94('0xbd')](_0x3d94('0x37')+_['capitalize'](_0x24f111[_0x3d94('0x51')][_0x3d94('0xaf')][_0x3d94('0xb8')]())+_0x3d94('0xc5'),_0x3a8d00);}return _0x17159c;})[_0x3d94('0x1d')](function(){if(_0x24f111[_0x3d94('0x51')][_0x3d94('0xaf')]===_0x3d94('0xbe')){return db[_0x3d94('0xc1')][_0x3d94('0x33')]({'where':{'UserId':_0x24f111[_0x3d94('0x6e')]['id'],'VoiceQueueId':_0x24f111[_0x3d94('0x51')][_0x3d94('0x75')]},'individualHooks':!![]})[_0x3d94('0x1d')](function(){return _0x26bf00;});}return _0x26bf00;})[_0x3d94('0x1d')](respondWithStatusCode(_0xd4661,null))[_0x3d94('0x28')](handleError(_0xd4661,null));};exports[_0x3d94('0xc6')]=function(_0x4a473a,_0x475f85,_0x6c58a3){_0x4a473a[_0x3d94('0x72')][_0x3d94('0xc7')]=_0x4a473a[_0x3d94('0xc8')][_0x3d94('0xc9')];return db[_0x3d94('0x60')]['find']({'where':{'id':_0x4a473a['params']['id']}})['then'](handleEntityNotFound(_0x475f85,null))[_0x3d94('0x1d')](saveUpdates(_0x4a473a[_0x3d94('0x72')],null))['then'](respondWithResult(_0x475f85,null))['catch'](handleError(_0x475f85,null));};exports[_0x3d94('0xca')]=function(_0x426554,_0x4644e5,_0x1a75a5){var _0x49dfd3=path['join'](config['root'],_0x3d94('0xcb'));return db['User']['find']({'where':{'id':_0x426554[_0x3d94('0x6e')]['id']},'attributes':['id',_0x3d94('0xc7')],'raw':!![]})[_0x3d94('0x1d')](handleEntityNotFound(_0x4644e5,null))[_0x3d94('0x1d')](function(_0x348a17){if(_0x348a17){if(_[_0x3d94('0x77')](_0x348a17[_0x3d94('0xc7')])){return _0x4644e5['download'](_0x49dfd3);}else{if(!fs['existsSync'](path[_0x3d94('0xcc')](config[_0x3d94('0xcd')],_0x3d94('0xce'),_0x348a17[_0x3d94('0xc7')]))){return _0x4644e5[_0x3d94('0xcf')](_0x49dfd3);}return _0x4644e5[_0x3d94('0xcf')](path[_0x3d94('0xcc')](config['root'],_0x3d94('0xce'),_0x348a17['userpic']));}}})['catch'](handleError(_0x4644e5,null));};exports['getOpenTabs']=function(_0xc72f7e,_0x88d9d9,_0x3c9e55){return db[_0x3d94('0x60')]['find']({'where':{'id':_0xc72f7e[_0x3d94('0x6e')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x88d9d9,null))[_0x3d94('0x1d')](function(_0xef55c){var _0x2dbc7e=[];values=_0xef55c['dataValues'];_0x2dbc7e[_0x3d94('0x63')](get_open_tabs(_0x3d94('0x68'),_0xef55c['dataValues']));_0x2dbc7e['push'](get_open_tabs(_0x3d94('0xd0'),_0xef55c[_0x3d94('0x69')]));_0x2dbc7e[_0x3d94('0x63')](get_open_tabs(_0x3d94('0x6c'),_0xef55c['dataValues']));_0x2dbc7e['push'](get_open_tabs('whatsapp',_0xef55c[_0x3d94('0x69')]));_0x2dbc7e[_0x3d94('0x63')](get_open_tabs(_0x3d94('0x6a'),_0xef55c[_0x3d94('0x69')]));_0x2dbc7e[_0x3d94('0x63')](get_open_tabs(_0x3d94('0x6b'),_0xef55c[_0x3d94('0x69')]));return BPromise['all'](_0x2dbc7e);})['then'](function(_0xcd4f10){var _0x210bc8=[];if(_0xcd4f10){for(var _0x381e7c=0x0;_0x381e7c=_0x265b6f[_0x562b('0x53')]){throw new Error(_0x562b('0x54'));}})[_0x562b('0x12')](function(){if(_0x5c583d){return db['UserVoiceQueueRt'][_0x562b('0x4d')]({'where':{'membername':_0x5c583d[_0x562b('0x2a')]},'individualHooks':!![]});}})[_0x562b('0x12')](function(){if(_0x5c583d){return _0x5c583d[_0x562b('0x55')]({'raw':!![]});}})[_0x562b('0x12')](function(_0x1090d3){if(_0x5c583d){if(_0x1090d3){var _0x3e98f3=[];_0x41f8c0=_0x1090d3;if(_0x41f8c0['length']){for(var _0x1af285=0x0;_0x1af285<_0x41f8c0[_0x562b('0x2f')];_0x1af285++){_0x3e98f3[_0x562b('0x35')](db[_0x562b('0x2d')]['upsert']({'membername':_0x5c583d[_0x562b('0x2a')],'UserId':_0x5c583d['id'],'queue_name':_0x41f8c0[_0x1af285][_0x562b('0x2a')],'VoiceQueueId':_0x41f8c0[_0x1af285]['id'],'interface':_0x39690f,'paused':_0x5c583d[_0x562b('0x56')]||![],'penalty':_0x41f8c0[_0x1af285][_0x562b('0x57')]||0x0}));}return BPromise[_0x562b('0x4b')](_0x3e98f3);}}}})['then'](function(){if(_0x5c583d){return db['MemberReport'][_0x562b('0x1d')]({'where':{'membername':_0x5c583d[_0x562b('0x2a')],'exitAt':null}});}})[_0x562b('0x12')](function(_0x1d08be){if(_0x5c583d){if(_0x1d08be&&_0x1d08be[_0x562b('0x2f')]){var _0x252315=[];_0x1d08be[_0x562b('0x34')](function(_0x4b3daa){_0x252315[_0x562b('0x35')](_0x4b3daa[_0x562b('0x43')]({'exitAt':moment()['format'](_0x562b('0x31'))}));});return BPromise[_0x562b('0x4b')](_0x252315);}}})[_0x562b('0x12')](function(_0x2b3323){if(_0x5c583d){var _0x1f8ebf=[];var _0x31aa3f=[];var _0x47ad24=utils[_0x562b('0x33')]();var _0x18d138={'membername':_0x5c583d[_0x562b('0x2a')],'interface':_0x39690f,'enterAt':moment()[_0x562b('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x5c583d['role'],'internal':_0x5c583d['internal']};_0x47ad24[_0x562b('0x34')](function(_0x3c5c7f){_0x1f8ebf['push'](_[_0x562b('0x58')]({'channel':_0x3c5c7f,'type':_0x562b('0x59'),'data1':_0x562b('0x5a'),'data2':_0x39690f},_0x18d138));if(_0x5c583d['loginInPause']){_0x31aa3f[_0x562b('0x35')](_['merge']({'channel':_0x3c5c7f,'type':_0x562b('0x38'),'data1':_0x562b('0x5b')},_0x18d138));}});return db[_0x562b('0x2e')][_0x562b('0x5c')](_0x1f8ebf[_0x562b('0x5d')](_0x31aa3f),{'individualHooks':!![]});}})[_0x562b('0x12')](function(){if(_0x5c583d){return _0x5c583d['update']({'online':!![],'lastLoginAt':moment()['format'](_0x562b('0x31')),'voicePause':_0x5c583d[_0x562b('0x56')]||![],'mailPause':_0x5c583d[_0x562b('0x56')]||![],'chatPause':_0x5c583d[_0x562b('0x56')]||![],'faxPause':_0x5c583d['loginInPause']||![],'smsPause':_0x5c583d[_0x562b('0x56')]||![],'openchannelPause':_0x5c583d['loginInPause']||![],'pauseType':_0x5c583d[_0x562b('0x56')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0x562b('0x31')),'interface':_0x39690f});}})[_0x562b('0x12')](function(_0x4e7168){_0x2547c2(_0x4e7168);})[_0x562b('0x1a')](function(_0x2c7a16){_0x4e93c6(_0x38f2b5[_0x562b('0x16')](0x1f4,_0x2c7a16[_0x562b('0x18')]));});});}; \ No newline at end of file +var _0x485c=['getVoiceQueues','upsert','loginInPause','merge','concat','LOGININPAUSE','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./user.socket','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','User,\x20%s,\x20%s','message','catch','GetUser','User','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','find','ShowUser','PauseUser','name','internal','interface','UserVoiceQueueRt','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','isNil','SIP/%s','PAUSE','body','DEFAULT\x20PAUSE','bulkCreate','update','type','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','system','mail','chat','fax','sms','openchannel','whatsapp','set','%s%s','Pause','push','all','LogoutUser','destroy','LoginUser','role','mobile','phone','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x226ad4,_0x1027d1){var _0x2ad9ca=function(_0x3de069){while(--_0x3de069){_0x226ad4['push'](_0x226ad4['shift']());}};_0x2ad9ca(++_0x1027d1);}(_0x485c,0x117));var _0xc485=function(_0x48601a,_0x4c4efe){_0x48601a=_0x48601a-0x0;var _0x7f24a5=_0x485c[_0x48601a];return _0x7f24a5;};'use strict';var _=require(_0xc485('0x0'));var util=require(_0xc485('0x1'));var moment=require(_0xc485('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc485('0x3'))['db'];var utils=require(_0xc485('0x4'));var logger=require(_0xc485('0x5'))('rpc');var config=require(_0xc485('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc485('0x7')][_0xc485('0x8')]({'port':0x232a});config[_0xc485('0x9')]=_[_0xc485('0xa')](config[_0xc485('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xc485('0xb'))(new Redis(config[_0xc485('0x9')]));require(_0xc485('0xc'))['register'](socket);function respondWithRpcPromise(_0x460ca7,_0x26378e,_0x469419){return new BPromise(function(_0x7cf314,_0x1812b9){return client['request'](_0x460ca7,_0x469419)['then'](function(_0x5b4b7f){logger[_0xc485('0xd')]('User,\x20%s,\x20%s',_0x26378e,_0xc485('0xe'));logger[_0xc485('0xf')](_0xc485('0x10'),_0x26378e,_0xc485('0xe'),JSON['stringify'](_0x5b4b7f));if(_0x5b4b7f[_0xc485('0x11')]){if(_0x5b4b7f[_0xc485('0x11')][_0xc485('0x12')]===0x1f4){logger['error'](_0xc485('0x13'),_0x26378e,_0x5b4b7f[_0xc485('0x11')][_0xc485('0x14')]);return _0x1812b9(_0x5b4b7f[_0xc485('0x11')][_0xc485('0x14')]);}logger[_0xc485('0x11')](_0xc485('0x13'),_0x26378e,_0x5b4b7f['error']['message']);return _0x7cf314(_0x5b4b7f[_0xc485('0x11')][_0xc485('0x14')]);}else{logger[_0xc485('0xd')](_0xc485('0x13'),_0x26378e,'request\x20sent');_0x7cf314(_0x5b4b7f['result'][_0xc485('0x14')]);}})[_0xc485('0x15')](function(_0x4af8ad){logger[_0xc485('0x11')]('User,\x20%s,\x20%s',_0x26378e,_0x4af8ad);_0x1812b9(_0x4af8ad);});});}exports[_0xc485('0x16')]=function(_0x18bd3d){var _0x56177a=this;return new Promise(function(_0x525d72,_0x430a1d){return db[_0xc485('0x17')][_0xc485('0x18')]({'raw':_0x18bd3d[_0xc485('0x19')]?_0x18bd3d['options'][_0xc485('0x1a')]===undefined?!![]:![]:!![],'where':_0x18bd3d['options']?_0x18bd3d[_0xc485('0x19')][_0xc485('0x1b')]||null:null,'attributes':_0x18bd3d[_0xc485('0x19')]?_0x18bd3d[_0xc485('0x19')][_0xc485('0x1c')]||null:null,'limit':_0x18bd3d['options']?_0x18bd3d[_0xc485('0x19')][_0xc485('0x1d')]||null:null,'include':_0x18bd3d[_0xc485('0x19')]?_0x18bd3d['options'][_0xc485('0x1e')]?_[_0xc485('0x1f')](_0x18bd3d[_0xc485('0x19')]['include'],function(_0x5a5a91){return{'model':db[_0x5a5a91[_0xc485('0x20')]],'as':_0x5a5a91['as'],'attributes':_0x5a5a91[_0xc485('0x1c')],'include':_0x5a5a91[_0xc485('0x1e')]?_['map'](_0x5a5a91[_0xc485('0x1e')],function(_0x5b7383){return{'model':db[_0x5b7383['model']],'as':_0x5b7383['as'],'attributes':_0x5b7383[_0xc485('0x1c')],'include':_0x5b7383['include']?_[_0xc485('0x1f')](_0x5b7383[_0xc485('0x1e')],function(_0x5a6991){return{'model':db[_0x5a6991['model']],'as':_0x5a6991['as'],'attributes':_0x5a6991[_0xc485('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc485('0x21')](function(_0x1a6b27){logger[_0xc485('0xd')](_0xc485('0x16'),_0x18bd3d);logger['debug'](_0xc485('0x16'),_0x18bd3d,JSON[_0xc485('0x22')](_0x1a6b27));_0x525d72(_0x1a6b27);})['catch'](function(_0x410a5a){logger[_0xc485('0x11')](_0xc485('0x16'),_0x410a5a['message'],_0x18bd3d);_0x430a1d(_0x56177a[_0xc485('0x11')](0x1f4,_0x410a5a[_0xc485('0x14')]));});});};exports['ShowUser']=function(_0x4ca17d){var _0x1c98dd=this;return new Promise(function(_0x3ea53d,_0x4d0a52){return db['User'][_0xc485('0x23')]({'raw':_0x4ca17d[_0xc485('0x19')]?_0x4ca17d['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ca17d['options']?_0x4ca17d['options'][_0xc485('0x1b')]||null:null,'attributes':_0x4ca17d[_0xc485('0x19')]?_0x4ca17d[_0xc485('0x19')][_0xc485('0x1c')]||null:null,'include':_0x4ca17d[_0xc485('0x19')]?_0x4ca17d['options']['include']?_['map'](_0x4ca17d[_0xc485('0x19')][_0xc485('0x1e')],function(_0x19f81b){return{'model':db[_0x19f81b[_0xc485('0x20')]],'as':_0x19f81b['as'],'attributes':_0x19f81b[_0xc485('0x1c')],'include':_0x19f81b[_0xc485('0x1e')]?_[_0xc485('0x1f')](_0x19f81b['include'],function(_0xa292ed){return{'model':db[_0xa292ed[_0xc485('0x20')]],'as':_0xa292ed['as'],'attributes':_0xa292ed[_0xc485('0x1c')],'include':_0xa292ed[_0xc485('0x1e')]?_[_0xc485('0x1f')](_0xa292ed[_0xc485('0x1e')],function(_0x34132a){return{'model':db[_0x34132a[_0xc485('0x20')]],'as':_0x34132a['as'],'attributes':_0x34132a['attributes']};}):[]};}):[]};}):[]:[]})[_0xc485('0x21')](function(_0x231071){logger[_0xc485('0xd')](_0xc485('0x24'),_0x4ca17d);logger['debug'](_0xc485('0x24'),_0x4ca17d,JSON[_0xc485('0x22')](_0x231071));_0x3ea53d(_0x231071);})[_0xc485('0x15')](function(_0x435e3b){logger['error'](_0xc485('0x24'),_0x435e3b[_0xc485('0x14')],_0x4ca17d);_0x4d0a52(_0x1c98dd['error'](0x1f4,_0x435e3b[_0xc485('0x14')]));});});};exports[_0xc485('0x25')]=function(_0x4a32ce){var _0x1d53be=this;return new Promise(function(_0x215637,_0x25b9d8){var _0x57c78a;return db['User'][_0xc485('0x23')]({'where':_0x4a32ce[_0xc485('0x19')]['where']||{},'attributes':['id',_0xc485('0x26'),'role',_0xc485('0x27'),_0xc485('0x28')]})[_0xc485('0x21')](function(_0xf7ee5f){if(_0xf7ee5f){_0x57c78a=_0xf7ee5f;return db[_0xc485('0x29')]['update']({'paused':0x1},{'where':{'UserId':_0x57c78a['id']},'individualHooks':!![]});}})[_0xc485('0x21')](function(){if(_0x57c78a){return db[_0xc485('0x2a')][_0xc485('0x18')]({'where':{'membername':_0x57c78a[_0xc485('0x26')],'type':'PAUSE','exitAt':null}});}})[_0xc485('0x21')](function(_0x1c8085){if(_0x57c78a){if(_0x1c8085&&_0x1c8085[_0xc485('0x2b')]){var _0x43fc50=moment()[_0xc485('0x2c')](_0xc485('0x2d'));for(var _0x1062d1=0x0,_0xd9da5c=_0x1c8085[_0xc485('0x2b')];_0x1062d1<_0xd9da5c;_0x1062d1++){_0x1c8085[_0x1062d1]['updateAttributes']({'exitAt':_0x43fc50});}}}})['then'](function(){if(_0x57c78a){var _0xee2d66=[];var _0x3f03d9=utils[_0xc485('0x2e')]();_0x3f03d9[_0xc485('0x2f')](function(_0x13db0e){_0xee2d66['push']({'channel':_0x13db0e,'membername':_0x57c78a[_0xc485('0x26')],'interface':_[_0xc485('0x30')](_0x57c78a[_0xc485('0x28')])?util[_0xc485('0x2c')](_0xc485('0x31'),_0x57c78a[_0xc485('0x26')]):_0x57c78a[_0xc485('0x28')],'type':_0xc485('0x32'),'enterAt':moment()[_0xc485('0x2c')](_0xc485('0x2d')),'data1':_0x4a32ce[_0xc485('0x33')]['type']||_0xc485('0x34'),'role':_0x57c78a['role'],'internal':_0x57c78a[_0xc485('0x27')],'uniqueid':_0x4a32ce[_0xc485('0x33')]['uniqueid']||null});});return db['MemberReport'][_0xc485('0x35')](_0xee2d66,{'individualHooks':!![]});}})[_0xc485('0x21')](function(){if(_0x57c78a){return _0x57c78a[_0xc485('0x36')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4a32ce['body'][_0xc485('0x37')]||_0xc485('0x34'),'lastPauseAt':moment()['format'](_0xc485('0x2d'))});}})[_0xc485('0x21')](function(_0x1bf208){_0x215637(_0x1bf208);})[_0xc485('0x15')](function(_0x2e4083){_0x25b9d8(_0x1d53be['error'](0x1f4,_0x2e4083[_0xc485('0x14')]));});});};exports[_0xc485('0x38')]=function(_0x5088bc){var _0x1c6040=this;return new Promise(function(_0x55a48e,_0x7ec91c){var _0x2f0aa8;return db['User'][_0xc485('0x39')]({'where':_0x5088bc[_0xc485('0x19')][_0xc485('0x1b')]||{},'attributes':['id',_0xc485('0x26')]})[_0xc485('0x21')](function(_0x1e03ba){if(_0x1e03ba){_0x2f0aa8=_0x1e03ba;if(_0x5088bc[_0xc485('0x33')][_0xc485('0x3a')]&&!utils[_0xc485('0x3b')](_0x5088bc[_0xc485('0x33')][_0xc485('0x3a')])){throw new Error(_0xc485('0x3c'));}switch(_0x5088bc[_0xc485('0x33')]['channel']){case'voice':return db['UserVoiceQueueRt'][_0xc485('0x36')]({'paused':0x0},{'where':{'UserId':_0x2f0aa8['id']}})['then'](function(){return db[_0xc485('0x2a')][_0xc485('0x23')]({'where':{'channel':_0x5088bc[_0xc485('0x33')][_0xc485('0x3a')],'membername':_0x2f0aa8['name'],'type':'PAUSE','exitAt':null}});})[_0xc485('0x21')](function(_0x5c5875){if(_0x5c5875){return _0x5c5875[_0xc485('0x36')]({'exitAt':moment()[_0xc485('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xc485('0x3d')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x2f0aa8['update']({'voicePause':![]});});case _0xc485('0x3e'):case _0xc485('0x3f'):case _0xc485('0x40'):case _0xc485('0x41'):case _0xc485('0x42'):case _0xc485('0x43'):return db['MemberReport']['find']({'where':{'channel':_0x5088bc[_0xc485('0x33')]['channel'],'membername':_0x2f0aa8['name'],'type':'PAUSE','exitAt':null}})['then'](function(_0x6f7a35){return _0x6f7a35[_0xc485('0x36')]({'exitAt':moment()[_0xc485('0x2c')](_0xc485('0x2d')),'data2':_0xc485('0x3d')},{'individualHooks':!![]});})[_0xc485('0x21')](function(){var _0x5ea10e={};_[_0xc485('0x44')](_0x5ea10e,util[_0xc485('0x2c')](_0xc485('0x45'),_0x5088bc[_0xc485('0x33')][_0xc485('0x3a')],_0xc485('0x46')),![]);return _0x2f0aa8[_0xc485('0x36')](_0x5ea10e);});default:return db[_0xc485('0x29')][_0xc485('0x36')]({'paused':0x0},{'where':{'UserId':_0x2f0aa8['id']}})[_0xc485('0x21')](function(){return db[_0xc485('0x2a')][_0xc485('0x18')]({'where':{'membername':_0x2f0aa8[_0xc485('0x26')],'type':'PAUSE','exitAt':null}});})[_0xc485('0x21')](function(_0xdbde3c){var _0x306f9e=[];_0xdbde3c[_0xc485('0x2f')](function(_0x2ab2c8){_0x306f9e[_0xc485('0x47')](_0x2ab2c8['update']({'exitAt':moment()[_0xc485('0x2c')](_0xc485('0x2d')),'data2':_0xc485('0x3d')}));});return BPromise[_0xc485('0x48')](_0x306f9e);})[_0xc485('0x21')](function(){return _0x2f0aa8[_0xc485('0x36')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x336bb5){_0x55a48e(_0x336bb5);})[_0xc485('0x15')](function(_0x53568e){_0x7ec91c(_0x1c6040[_0xc485('0x11')](0x1f4,_0x53568e[_0xc485('0x14')]));});});};exports[_0xc485('0x49')]=function(_0x788d20){var _0x51c371=this;return new Promise(function(_0xcc31a0,_0x102b12){var _0x27330b;return db['User']['findOne']({'where':_0x788d20['options'][_0xc485('0x1b')]||{},'attributes':['id',_0xc485('0x26')]})[_0xc485('0x21')](function(_0x193030){if(_0x193030){_0x27330b=_0x193030;return db[_0xc485('0x29')][_0xc485('0x4a')]({'where':{'membername':_0x27330b[_0xc485('0x26')]},'individualHooks':!![]});}})[_0xc485('0x21')](function(){if(_0x27330b){return db[_0xc485('0x2a')][_0xc485('0x18')]({'where':{'membername':_0x27330b['name'],'exitAt':null}});}})[_0xc485('0x21')](function(_0x2501c9){if(_0x27330b){if(_0x2501c9&&_0x2501c9[_0xc485('0x2b')]){var _0x13d9e2=[];_0x2501c9[_0xc485('0x2f')](function(_0x35ea9a){_0x13d9e2[_0xc485('0x47')](_0x35ea9a[_0xc485('0x36')]({'exitAt':moment()[_0xc485('0x2c')](_0xc485('0x2d'))}));});return BPromise[_0xc485('0x48')](_0x13d9e2);}}})['then'](function(){if(_0x27330b){return _0x27330b['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x23976c){_0xcc31a0(_0x23976c);})['catch'](function(_0x2fb969){_0x102b12(_0x51c371['error'](0x1f4,_0x2fb969[_0xc485('0x14')]));});});};exports[_0xc485('0x4b')]=function(_0x247161){var _0x8872ba=this;return new Promise(function(_0x4981c1,_0x2c950e){var _0x2e0cd0;var _0x2888d3;var _0x380dfa;var _0x7dde3e;return db[_0xc485('0x17')]['findOne']({'where':_0x247161[_0xc485('0x19')][_0xc485('0x1b')]||{},'attributes':['id',_0xc485('0x26'),_0xc485('0x4c'),_0xc485('0x4d'),_0xc485('0x4e'),_0xc485('0x27'),'loginInPause','interface']})[_0xc485('0x21')](function(_0x1017b6){if(_0x1017b6){_0x2e0cd0=_0x1017b6;_0x7dde3e=_0x247161[_0xc485('0x33')][_0xc485('0x28')]?_0x247161[_0xc485('0x33')][_0xc485('0x28')]:util[_0xc485('0x2c')](_0xc485('0x31'),_0x2e0cd0[_0xc485('0x26')]);return db[_0xc485('0x17')][_0xc485('0x4f')]({'where':{'role':_0xc485('0x50'),'online':!![],'id':{'$ne':_0x2e0cd0['id']}}});}})[_0xc485('0x21')](function(_0x2768d5){if(_0x2768d5){_0x380dfa=_0x2768d5;return require(_0xc485('0x51'))[_0xc485('0x52')]();}})[_0xc485('0x21')](function(_0x54029e){if(_0x54029e&&_0x54029e['agents']&&_0x380dfa>=_0x54029e[_0xc485('0x53')]){throw new Error(_0xc485('0x54'));}})['then'](function(){if(_0x2e0cd0){return db[_0xc485('0x29')][_0xc485('0x4a')]({'where':{'membername':_0x2e0cd0['name']},'individualHooks':!![]});}})['then'](function(){if(_0x2e0cd0){return _0x2e0cd0[_0xc485('0x55')]({'raw':!![]});}})['then'](function(_0x731d38){if(_0x2e0cd0){if(_0x731d38){var _0x1a9df0=[];_0x2888d3=_0x731d38;if(_0x2888d3['length']){for(var _0x37a341=0x0;_0x37a341<_0x2888d3[_0xc485('0x2b')];_0x37a341++){_0x1a9df0[_0xc485('0x47')](db[_0xc485('0x29')][_0xc485('0x56')]({'membername':_0x2e0cd0[_0xc485('0x26')],'UserId':_0x2e0cd0['id'],'queue_name':_0x2888d3[_0x37a341][_0xc485('0x26')],'VoiceQueueId':_0x2888d3[_0x37a341]['id'],'interface':_0x7dde3e,'paused':_0x2e0cd0[_0xc485('0x57')]||![],'penalty':_0x2888d3[_0x37a341]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xc485('0x48')](_0x1a9df0);}}}})[_0xc485('0x21')](function(){if(_0x2e0cd0){return db[_0xc485('0x2a')]['findAll']({'where':{'membername':_0x2e0cd0[_0xc485('0x26')],'exitAt':null}});}})[_0xc485('0x21')](function(_0x3a0e99){if(_0x2e0cd0){if(_0x3a0e99&&_0x3a0e99['length']){var _0x42def7=[];_0x3a0e99[_0xc485('0x2f')](function(_0x68e412){_0x42def7[_0xc485('0x47')](_0x68e412[_0xc485('0x36')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xc485('0x48')](_0x42def7);}}})[_0xc485('0x21')](function(_0x459394){if(_0x2e0cd0){var _0x10ef0b=[];var _0xb88f78=[];var _0x4ba707=utils[_0xc485('0x2e')]();var _0x2014cf={'membername':_0x2e0cd0['name'],'interface':_0x7dde3e,'enterAt':moment()[_0xc485('0x2c')](_0xc485('0x2d')),'role':_0x2e0cd0[_0xc485('0x4c')],'internal':_0x2e0cd0[_0xc485('0x27')]};_0x4ba707[_0xc485('0x2f')](function(_0x4e9216){_0x10ef0b[_0xc485('0x47')](_['merge']({'channel':_0x4e9216,'type':'LOGIN','data1':'callysquare','data2':_0x7dde3e},_0x2014cf));if(_0x2e0cd0[_0xc485('0x57')]){_0xb88f78[_0xc485('0x47')](_[_0xc485('0x58')]({'channel':_0x4e9216,'type':'PAUSE','data1':'LOGININPAUSE'},_0x2014cf));}});return db['MemberReport'][_0xc485('0x35')](_0x10ef0b[_0xc485('0x59')](_0xb88f78),{'individualHooks':!![]});}})[_0xc485('0x21')](function(){if(_0x2e0cd0){return _0x2e0cd0[_0xc485('0x36')]({'online':!![],'lastLoginAt':moment()[_0xc485('0x2c')](_0xc485('0x2d')),'voicePause':_0x2e0cd0['loginInPause']||![],'mailPause':_0x2e0cd0['loginInPause']||![],'chatPause':_0x2e0cd0[_0xc485('0x57')]||![],'faxPause':_0x2e0cd0['loginInPause']||![],'smsPause':_0x2e0cd0[_0xc485('0x57')]||![],'openchannelPause':_0x2e0cd0[_0xc485('0x57')]||![],'pauseType':_0x2e0cd0['loginInPause']?_0xc485('0x5a'):null,'lastPauseAt':moment()['format'](_0xc485('0x2d')),'interface':_0x7dde3e});}})[_0xc485('0x21')](function(_0x4410af){_0x4981c1(_0x4410af);})['catch'](function(_0x1524ac){_0x2c950e(_0x8872ba[_0xc485('0x11')](0x1f4,_0x1524ac[_0xc485('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 687106f..2a183c9 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 _0x0ae4=['remove','emit','register','length','save'];(function(_0x3d641e,_0x1e921b){var _0x294d8e=function(_0x19c670){while(--_0x19c670){_0x3d641e['push'](_0x3d641e['shift']());}};_0x294d8e(++_0x1e921b);}(_0x0ae4,0x199));var _0x40ae=function(_0x1c2d81,_0x298a7b){_0x1c2d81=_0x1c2d81-0x0;var _0x119a78=_0x0ae4[_0x1c2d81];return _0x119a78;};'use strict';var UserEvents=require('./user.events');var events=[_0x40ae('0x0'),_0x40ae('0x1'),'update'];function createListener(_0x3c5ad3,_0x324965){return function(_0x497e1f){_0x324965[_0x40ae('0x2')](_0x3c5ad3,_0x497e1f);};}function removeListener(_0x3a21e1,_0x18f412){return function(){UserEvents['removeListener'](_0x3a21e1,_0x18f412);};}exports[_0x40ae('0x3')]=function(_0x3a3063){for(var _0x2b86e0=0x0,_0x4c31c1=events[_0x40ae('0x4')];_0x2b86e0<_0x4c31c1;_0x2b86e0++){var _0x1f1434=events[_0x2b86e0];var _0xf4fa8d=createListener('user:'+_0x1f1434,_0x3a3063);UserEvents['on'](_0x1f1434,_0xf4fa8d);}}; \ No newline at end of file +var _0x3c99=['user:','./user.events','save','remove','update','emit','removeListener','register','length'];(function(_0x1d6534,_0x2fb0ad){var _0x3a0131=function(_0x328b98){while(--_0x328b98){_0x1d6534['push'](_0x1d6534['shift']());}};_0x3a0131(++_0x2fb0ad);}(_0x3c99,0x88));var _0x93c9=function(_0x478d61,_0x1b4774){_0x478d61=_0x478d61-0x0;var _0x5a498e=_0x3c99[_0x478d61];return _0x5a498e;};'use strict';var UserEvents=require(_0x93c9('0x0'));var events=[_0x93c9('0x1'),_0x93c9('0x2'),_0x93c9('0x3')];function createListener(_0x8d1258,_0x27e432){return function(_0x26bd73){_0x27e432[_0x93c9('0x4')](_0x8d1258,_0x26bd73);};}function removeListener(_0x341cd2,_0x32e79b){return function(){UserEvents[_0x93c9('0x5')](_0x341cd2,_0x32e79b);};}exports[_0x93c9('0x6')]=function(_0x48325f){for(var _0x3c58d2=0x0,_0x585aa8=events[_0x93c9('0x7')];_0x3c58d2<_0x585aa8;_0x3c58d2++){var _0x32158e=events[_0x3c58d2];var _0x13a74f=createListener(_0x93c9('0x8')+_0x32158e,_0x48325f);UserEvents['on'](_0x32158e,_0x13a74f);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index d2d3c20..f9ebecf 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1c1172,_0x27c3c4){var _0x300943=function(_0x3f8b89){while(--_0x3f8b89){_0x1c1172['push'](_0x1c1172['shift']());}};_0x300943(++_0x27c3c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xaa9b1,_0x1c3b11){var _0x5e1c31=function(_0x174f3c){while(--_0x174f3c){_0xaa9b1['push'](_0xaa9b1['shift']());}};_0x5e1c31(++_0x1c3b11);}(_0xe706,0xa3));var _0x6e70=function(_0x1c5f93,_0x35de09){_0x1c5f93=_0x1c5f93-0x0;var _0x464e11=_0xe706[_0x1c5f93];return _0x464e11;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 4ccd755..c5fa79e 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 _0x5c48=['INTEGER','sequelize','exports'];(function(_0x3b993b,_0x4f3c35){var _0x5ae421=function(_0x32a7d1){while(--_0x32a7d1){_0x3b993b['push'](_0x3b993b['shift']());}};_0x5ae421(++_0x4f3c35);}(_0x5c48,0x172));var _0x85c4=function(_0x3dcd6d,_0x1f359e){_0x3dcd6d=_0x3dcd6d-0x0;var _0x43147e=_0x5c48[_0x3dcd6d];return _0x43147e;};'use strict';var Sequelize=require(_0x85c4('0x0'));module[_0x85c4('0x1')]={'penalty':{'type':Sequelize[_0x85c4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc03a=['sequelize','exports','INTEGER'];(function(_0x47d621,_0x54f4bc){var _0x15daad=function(_0x5ee16d){while(--_0x5ee16d){_0x47d621['push'](_0x47d621['shift']());}};_0x15daad(++_0x54f4bc);}(_0xc03a,0x1e3));var _0xac03=function(_0x5b0fb7,_0x24f3fa){_0x5b0fb7=_0x5b0fb7-0x0;var _0x224fca=_0xc03a[_0x5b0fb7];return _0x224fca;};'use strict';var Sequelize=require(_0xac03('0x0'));module[_0xac03('0x1')]={'penalty':{'type':Sequelize[_0xac03('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 9b315a0..193cdf3 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 _0xa00d=['rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','lodash','api','moment','bluebird','request-promise','path'];(function(_0x1a6269,_0x5deea5){var _0x536f68=function(_0x5911ce){while(--_0x5911ce){_0x1a6269['push'](_0x1a6269['shift']());}};_0x536f68(++_0x5deea5);}(_0xa00d,0x1b6));var _0xda00=function(_0x44d184,_0x74e256){_0x44d184=_0x44d184-0x0;var _0x8b9df=_0xa00d[_0x44d184];return _0x8b9df;};'use strict';var _=require(_0xda00('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xda00('0x1'));var moment=require(_0xda00('0x2'));var BPromise=require(_0xda00('0x3'));var rp=require(_0xda00('0x4'));var fs=require('fs');var path=require(_0xda00('0x5'));var rimraf=require(_0xda00('0x6'));var config=require(_0xda00('0x7'));var attributes=require(_0xda00('0x8'));module[_0xda00('0x9')]=function(_0x4012a2,_0x3e3e33){return _0x4012a2[_0xda00('0xa')](_0xda00('0xb'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaaee=['define','UserChatQueue','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xaaee,0x1f1));var _0xeaae=function(_0x1de328,_0x36ed5d){_0x1de328=_0x1de328-0x0;var _0x4b804c=_0xaaee[_0x1de328];return _0x4b804c;};'use strict';var _=require(_0xeaae('0x0'));var util=require(_0xeaae('0x1'));var logger=require(_0xeaae('0x2'))('api');var moment=require('moment');var BPromise=require(_0xeaae('0x3'));var rp=require(_0xeaae('0x4'));var fs=require('fs');var path=require(_0xeaae('0x5'));var rimraf=require('rimraf');var config=require(_0xeaae('0x6'));var attributes=require(_0xeaae('0x7'));module[_0xeaae('0x8')]=function(_0x2cd56a,_0x361ceb){return _0x2cd56a[_0xeaae('0x9')](_0xeaae('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index e9e99f6..e0b743a 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 _0x9073=['request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9073,0x1b1));var _0x3907=function(_0x73aef5,_0x5b2293){_0x73aef5=_0x73aef5-0x0;var _0x29be73=_0x9073[_0x73aef5];return _0x29be73;};'use strict';var _=require(_0x3907('0x0'));var util=require(_0x3907('0x1'));var moment=require('moment');var BPromise=require(_0x3907('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3907('0x3'));var logger=require(_0x3907('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3907('0x5'));var client=jayson['client'][_0x3907('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x58e748,_0x32d61d,_0x18b09e){return new BPromise(function(_0x448675,_0x1638ec){return client[_0x3907('0x7')](_0x58e748,_0x18b09e)[_0x3907('0x8')](function(_0x3d8411){logger[_0x3907('0x9')](_0x3907('0xa'),_0x32d61d,'request\x20sent');logger[_0x3907('0xb')](_0x3907('0xc'),_0x32d61d,_0x3907('0xd'),JSON[_0x3907('0xe')](_0x3d8411));if(_0x3d8411['error']){if(_0x3d8411[_0x3907('0xf')][_0x3907('0x10')]===0x1f4){logger[_0x3907('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x32d61d,_0x3d8411[_0x3907('0xf')][_0x3907('0x11')]);return _0x1638ec(_0x3d8411['error'][_0x3907('0x11')]);}logger['error'](_0x3907('0xa'),_0x32d61d,_0x3d8411[_0x3907('0xf')]['message']);return _0x448675(_0x3d8411[_0x3907('0xf')][_0x3907('0x11')]);}else{logger['info'](_0x3907('0xa'),_0x32d61d,_0x3907('0xd'));_0x448675(_0x3d8411[_0x3907('0x12')][_0x3907('0x11')]);}})[_0x3907('0x13')](function(_0x897d18){logger[_0x3907('0xf')](_0x3907('0xa'),_0x32d61d,_0x897d18);_0x1638ec(_0x897d18);});});} \ No newline at end of file +var _0x1a5b=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4b3330,_0x5e2cb4){var _0x4d9b82=function(_0x4f6161){while(--_0x4f6161){_0x4b3330['push'](_0x4b3330['shift']());}};_0x4d9b82(++_0x5e2cb4);}(_0x1a5b,0x17e));var _0xb1a5=function(_0x3068d7,_0xf137ed){_0x3068d7=_0x3068d7-0x0;var _0x122747=_0x1a5b[_0x3068d7];return _0x122747;};'use strict';var _=require(_0xb1a5('0x0'));var util=require(_0xb1a5('0x1'));var moment=require('moment');var BPromise=require(_0xb1a5('0x2'));var rs=require(_0xb1a5('0x3'));var fs=require('fs');var Redis=require(_0xb1a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb1a5('0x5'));var logger=require(_0xb1a5('0x6'))(_0xb1a5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb1a5('0x8')][_0xb1a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x476273,_0x26ee44,_0x4f7496){return new BPromise(function(_0x45364b,_0x25d78e){return client[_0xb1a5('0xa')](_0x476273,_0x4f7496)['then'](function(_0x383644){logger[_0xb1a5('0xb')](_0xb1a5('0xc'),_0x26ee44,_0xb1a5('0xd'));logger[_0xb1a5('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x26ee44,_0xb1a5('0xd'),JSON[_0xb1a5('0xf')](_0x383644));if(_0x383644[_0xb1a5('0x10')]){if(_0x383644[_0xb1a5('0x10')][_0xb1a5('0x11')]===0x1f4){logger[_0xb1a5('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x26ee44,_0x383644[_0xb1a5('0x10')]['message']);return _0x25d78e(_0x383644[_0xb1a5('0x10')]['message']);}logger[_0xb1a5('0x10')](_0xb1a5('0xc'),_0x26ee44,_0x383644[_0xb1a5('0x10')][_0xb1a5('0x12')]);return _0x45364b(_0x383644[_0xb1a5('0x10')][_0xb1a5('0x12')]);}else{logger[_0xb1a5('0xb')](_0xb1a5('0xc'),_0x26ee44,_0xb1a5('0xd'));_0x45364b(_0x383644[_0xb1a5('0x13')]['message']);}})[_0xb1a5('0x14')](function(_0x58b29e){logger['error'](_0xb1a5('0xc'),_0x26ee44,_0x58b29e);_0x25d78e(_0x58b29e);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 7874370..dd3db5c 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x499fde,_0x57deb9){var _0x316e5f=function(_0x26f55e){while(--_0x26f55e){_0x499fde['push'](_0x499fde['shift']());}};_0x316e5f(++_0x57deb9);}(_0xe706,0xa3));var _0x6e70=function(_0x49dd7e,_0x48b1e5){_0x49dd7e=_0x49dd7e-0x0;var _0x4c4f6e=_0xe706[_0x49dd7e];return _0x4c4f6e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2091b3,_0x151d4e){var _0x1af97e=function(_0x5b8d53){while(--_0x5b8d53){_0x2091b3['push'](_0x2091b3['shift']());}};_0x1af97e(++_0x151d4e);}(_0x70e0,0x17b));var _0x070e=function(_0x5b4cd6,_0x8ce3f6){_0x5b4cd6=_0x5b4cd6-0x0;var _0x10aaf4=_0x70e0[_0x5b4cd6];return _0x10aaf4;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 7c24848..5eb9641 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 _0xa4f5=['INTEGER','STRING'];(function(_0x1bb156,_0x5c4564){var _0x2c646c=function(_0x49ed0b){while(--_0x49ed0b){_0x1bb156['push'](_0x1bb156['shift']());}};_0x2c646c(++_0x5c4564);}(_0xa4f5,0x7c));var _0x5a4f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa4f5[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5a4f('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x5a4f('0x1')]}}; \ No newline at end of file +var _0x7e7d=['INTEGER','sequelize','exports'];(function(_0x17a39b,_0x12da76){var _0x4fda7e=function(_0x214a18){while(--_0x214a18){_0x17a39b['push'](_0x17a39b['shift']());}};_0x4fda7e(++_0x12da76);}(_0x7e7d,0x85));var _0xd7e7=function(_0x3c8275,_0x41d99c){_0x3c8275=_0x3c8275-0x0;var _0x384df5=_0x7e7d[_0x3c8275];return _0x384df5;};'use strict';var Sequelize=require(_0xd7e7('0x0'));module[_0xd7e7('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd7e7('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 89aa21b..408859d 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 _0x45ac=['bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','api'];(function(_0x2259f6,_0x3f444c){var _0x233257=function(_0x5ba613){while(--_0x5ba613){_0x2259f6['push'](_0x2259f6['shift']());}};_0x233257(++_0x3f444c);}(_0x45ac,0xb1));var _0xc45a=function(_0xb0fe92,_0x147e42){_0xb0fe92=_0xb0fe92-0x0;var _0x41787f=_0x45ac[_0xb0fe92];return _0x41787f;};'use strict';var _=require(_0xc45a('0x0'));var util=require(_0xc45a('0x1'));var logger=require('../../config/logger')(_0xc45a('0x2'));var moment=require('moment');var BPromise=require(_0xc45a('0x3'));var rp=require(_0xc45a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc45a('0x5'));var config=require(_0xc45a('0x6'));var attributes=require(_0xc45a('0x7'));module[_0xc45a('0x8')]=function(_0x34d888,_0x3f99bb){return _0x34d888[_0xc45a('0x9')](_0xc45a('0xa'),attributes,{'tableName':_0xc45a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5501=['UserFaxQueue','user_has_fax_queues','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define'];(function(_0x206338,_0x2d800b){var _0x2b87f2=function(_0x436c1c){while(--_0x436c1c){_0x206338['push'](_0x206338['shift']());}};_0x2b87f2(++_0x2d800b);}(_0x5501,0x106));var _0x1550=function(_0x16c391,_0x24456a){_0x16c391=_0x16c391-0x0;var _0x3ef702=_0x5501[_0x16c391];return _0x3ef702;};'use strict';var _=require('lodash');var util=require(_0x1550('0x0'));var logger=require(_0x1550('0x1'))('api');var moment=require(_0x1550('0x2'));var BPromise=require(_0x1550('0x3'));var rp=require(_0x1550('0x4'));var fs=require('fs');var path=require(_0x1550('0x5'));var rimraf=require(_0x1550('0x6'));var config=require(_0x1550('0x7'));var attributes=require(_0x1550('0x8'));module[_0x1550('0x9')]=function(_0x324a58,_0x3f582f){return _0x324a58[_0x1550('0xa')](_0x1550('0xb'),attributes,{'tableName':_0x1550('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 a345e72..7d7c004 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 _0xbbd6=['util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','catch'];(function(_0x1bf6b7,_0x12519b){var _0x5e2768=function(_0x2fb507){while(--_0x2fb507){_0x1bf6b7['push'](_0x1bf6b7['shift']());}};_0x5e2768(++_0x12519b);}(_0xbbd6,0x104));var _0x6bbd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbd6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x6bbd('0x0'));var moment=require(_0x6bbd('0x1'));var BPromise=require('bluebird');var rs=require(_0x6bbd('0x2'));var fs=require('fs');var Redis=require(_0x6bbd('0x3'));var db=require(_0x6bbd('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6bbd('0x5'));var config=require('../../config/environment');var jayson=require(_0x6bbd('0x6'));var client=jayson[_0x6bbd('0x7')][_0x6bbd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x521e67,_0x35d3d6,_0x4622d0){return new BPromise(function(_0x150b92,_0x5d11b1){return client[_0x6bbd('0x9')](_0x521e67,_0x4622d0)[_0x6bbd('0xa')](function(_0xdd97ce){logger[_0x6bbd('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x35d3d6,_0x6bbd('0xc'));logger[_0x6bbd('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x35d3d6,_0x6bbd('0xc'),JSON[_0x6bbd('0xe')](_0xdd97ce));if(_0xdd97ce[_0x6bbd('0xf')]){if(_0xdd97ce['error'][_0x6bbd('0x10')]===0x1f4){logger['error'](_0x6bbd('0x11'),_0x35d3d6,_0xdd97ce[_0x6bbd('0xf')][_0x6bbd('0x12')]);return _0x5d11b1(_0xdd97ce['error'][_0x6bbd('0x12')]);}logger[_0x6bbd('0xf')](_0x6bbd('0x11'),_0x35d3d6,_0xdd97ce[_0x6bbd('0xf')][_0x6bbd('0x12')]);return _0x150b92(_0xdd97ce['error'][_0x6bbd('0x12')]);}else{logger[_0x6bbd('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x35d3d6,_0x6bbd('0xc'));_0x150b92(_0xdd97ce['result'][_0x6bbd('0x12')]);}})[_0x6bbd('0x13')](function(_0x6c0d7c){logger[_0x6bbd('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x35d3d6,_0x6c0d7c);_0x5d11b1(_0x6c0d7c);});});} \ No newline at end of file +var _0x7e27=['http','request','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x17e771,_0x55fd17){var _0x1f3a6d=function(_0x346ee3){while(--_0x346ee3){_0x17e771['push'](_0x17e771['shift']());}};_0x1f3a6d(++_0x55fd17);}(_0x7e27,0x1ae));var _0x77e2=function(_0xc19f4e,_0x458dfb){_0xc19f4e=_0xc19f4e-0x0;var _0x23c2b9=_0x7e27[_0xc19f4e];return _0x23c2b9;};'use strict';var _=require('lodash');var util=require(_0x77e2('0x0'));var moment=require('moment');var BPromise=require(_0x77e2('0x1'));var rs=require(_0x77e2('0x2'));var fs=require('fs');var Redis=require(_0x77e2('0x3'));var db=require(_0x77e2('0x4'))['db'];var utils=require(_0x77e2('0x5'));var logger=require('../../config/logger')(_0x77e2('0x6'));var config=require(_0x77e2('0x7'));var jayson=require(_0x77e2('0x8'));var client=jayson[_0x77e2('0x9')][_0x77e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x153330,_0x8bb147,_0x3df6eb){return new BPromise(function(_0x5ca2c5,_0x4f8a82){return client[_0x77e2('0xb')](_0x153330,_0x3df6eb)['then'](function(_0x105fd9){logger[_0x77e2('0xc')](_0x77e2('0xd'),_0x8bb147,'request\x20sent');logger[_0x77e2('0xe')](_0x77e2('0xf'),_0x8bb147,_0x77e2('0x10'),JSON[_0x77e2('0x11')](_0x105fd9));if(_0x105fd9[_0x77e2('0x12')]){if(_0x105fd9[_0x77e2('0x12')]['code']===0x1f4){logger[_0x77e2('0x12')](_0x77e2('0xd'),_0x8bb147,_0x105fd9[_0x77e2('0x12')][_0x77e2('0x13')]);return _0x4f8a82(_0x105fd9[_0x77e2('0x12')][_0x77e2('0x13')]);}logger['error'](_0x77e2('0xd'),_0x8bb147,_0x105fd9[_0x77e2('0x12')][_0x77e2('0x13')]);return _0x5ca2c5(_0x105fd9[_0x77e2('0x12')][_0x77e2('0x13')]);}else{logger[_0x77e2('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x8bb147,_0x77e2('0x10'));_0x5ca2c5(_0x105fd9[_0x77e2('0x14')][_0x77e2('0x13')]);}})[_0x77e2('0x15')](function(_0x5d2a9a){logger[_0x77e2('0x12')](_0x77e2('0xd'),_0x8bb147,_0x5d2a9a);_0x4f8a82(_0x5d2a9a);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 6a5dc8f..63e2b8e 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5b0af8,_0x8c6aba){var _0x3c95cf=function(_0x1dc3c9){while(--_0x1dc3c9){_0x5b0af8['push'](_0x5b0af8['shift']());}};_0x3c95cf(++_0x8c6aba);}(_0xedd9,0xfc));var _0x9edd=function(_0x187e50,_0x3e59f3){_0x187e50=_0x187e50-0x0;var _0x41b7c1=_0xedd9[_0x187e50];return _0x41b7c1;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xa89c3e,_0x144268){var _0x48072f=function(_0x4a1fe2){while(--_0x4a1fe2){_0xa89c3e['push'](_0xa89c3e['shift']());}};_0x48072f(++_0x144268);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index cfc2b13..e84658b 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 _0x0e5d=['sequelize','exports'];(function(_0x4e9dec,_0x4b8b63){var _0x1b958c=function(_0x2cd39e){while(--_0x2cd39e){_0x4e9dec['push'](_0x4e9dec['shift']());}};_0x1b958c(++_0x4b8b63);}(_0x0e5d,0x152));var _0xd0e5=function(_0x9b6bbe,_0x3301aa){_0x9b6bbe=_0x9b6bbe-0x0;var _0x1456e8=_0x0e5d[_0x9b6bbe];return _0x1456e8;};'use strict';var Sequelize=require(_0xd0e5('0x0'));module[_0xd0e5('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4556=['INTEGER','sequelize'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x4556,0x8f));var _0x6455=function(_0x2df189,_0x342150){_0x2df189=_0x2df189-0x0;var _0x58ff63=_0x4556[_0x2df189];return _0x58ff63;};'use strict';var Sequelize=require(_0x6455('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6455('0x1')],'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 9aa0211..3d153ba 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 _0x3299=['UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userMailQueue.attributes','define'];(function(_0x8b01b6,_0x5361b7){var _0x162d8c=function(_0x419698){while(--_0x419698){_0x8b01b6['push'](_0x8b01b6['shift']());}};_0x162d8c(++_0x5361b7);}(_0x3299,0x92));var _0x9329=function(_0x138a3c,_0x43290d){_0x138a3c=_0x138a3c-0x0;var _0x31802a=_0x3299[_0x138a3c];return _0x31802a;};'use strict';var _=require(_0x9329('0x0'));var util=require(_0x9329('0x1'));var logger=require(_0x9329('0x2'))(_0x9329('0x3'));var moment=require(_0x9329('0x4'));var BPromise=require(_0x9329('0x5'));var rp=require(_0x9329('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9329('0x7'));var config=require('../../config/environment');var attributes=require(_0x9329('0x8'));module['exports']=function(_0x56866f,_0x390ae9){return _0x56866f[_0x9329('0x9')](_0x9329('0xa'),attributes,{'tableName':_0x9329('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3f1=['./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x307f21,_0x4ba135){var _0x204228=function(_0x2275d2){while(--_0x2275d2){_0x307f21['push'](_0x307f21['shift']());}};_0x204228(++_0x4ba135);}(_0xa3f1,0x101));var _0x1a3f=function(_0x4794d1,_0x12d2cb){_0x4794d1=_0x4794d1-0x0;var _0x543cf9=_0xa3f1[_0x4794d1];return _0x543cf9;};'use strict';var _=require(_0x1a3f('0x0'));var util=require(_0x1a3f('0x1'));var logger=require('../../config/logger')(_0x1a3f('0x2'));var moment=require(_0x1a3f('0x3'));var BPromise=require(_0x1a3f('0x4'));var rp=require(_0x1a3f('0x5'));var fs=require('fs');var path=require(_0x1a3f('0x6'));var rimraf=require(_0x1a3f('0x7'));var config=require(_0x1a3f('0x8'));var attributes=require(_0x1a3f('0x9'));module[_0x1a3f('0xa')]=function(_0x5d5f73,_0x119f14){return _0x5d5f73[_0x1a3f('0xb')](_0x1a3f('0xc'),attributes,{'tableName':_0x1a3f('0xd'),'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 e731068..bd767e2 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 _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2319bd,_0x1deb4e){var _0x553634=function(_0x3bb54f){while(--_0x3bb54f){_0x2319bd['push'](_0x2319bd['shift']());}};_0x553634(++_0x1deb4e);}(_0xa41a,0x6b));var _0xaa41=function(_0x315d08,_0x2a376a){_0x315d08=_0x315d08-0x0;var _0x7f00b9=_0xa41a[_0x315d08];return _0x7f00b9;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x169b2e,_0x556971){var _0x28a06e=function(_0x2fdee9){while(--_0x2fdee9){_0x169b2e['push'](_0x169b2e['shift']());}};_0x28a06e(++_0x556971);}(_0xa41a,0x6b));var _0xaa41=function(_0x35681e,_0x1fef00){_0x35681e=_0x35681e-0x0;var _0x146e5b=_0xa41a[_0x35681e];return _0x146e5b;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 44e2b8f..cc3953b 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 _0xb9f8=['isAuthenticated','sendUserNotification','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','post'];(function(_0x28c531,_0x50e6ec){var _0x402760=function(_0x26b948){while(--_0x26b948){_0x28c531['push'](_0x28c531['shift']());}};_0x402760(++_0x50e6ec);}(_0xb9f8,0x70));var _0x8b9f=function(_0x23032f,_0x4aa04e){_0x23032f=_0x23032f-0x0;var _0x4e2d39=_0xb9f8[_0x23032f];return _0x4e2d39;};'use strict';var multer=require(_0x8b9f('0x0'));var util=require('util');var path=require(_0x8b9f('0x1'));var timeout=require(_0x8b9f('0x2'));var express=require('express');var router=express[_0x8b9f('0x3')]();var fs_extra=require(_0x8b9f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8b9f('0x5'));var config=require(_0x8b9f('0x6'));var controller=require(_0x8b9f('0x7'));router[_0x8b9f('0x8')]('/',auth[_0x8b9f('0x9')](),controller[_0x8b9f('0xa')]);module['exports']=router; \ No newline at end of file +var _0x47c8=['post','isAuthenticated','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x5eeaef,_0x1ac59c){var _0x43e6fb=function(_0x36f82f){while(--_0x36f82f){_0x5eeaef['push'](_0x5eeaef['shift']());}};_0x43e6fb(++_0x1ac59c);}(_0x47c8,0x1d7));var _0x847c=function(_0x3d8fb4,_0x356e72){_0x3d8fb4=_0x3d8fb4-0x0;var _0x2ff44d=_0x47c8[_0x3d8fb4];return _0x2ff44d;};'use strict';var multer=require('multer');var util=require(_0x847c('0x0'));var path=require(_0x847c('0x1'));var timeout=require('connect-timeout');var express=require(_0x847c('0x2'));var router=express[_0x847c('0x3')]();var fs_extra=require(_0x847c('0x4'));var auth=require(_0x847c('0x5'));var interaction=require(_0x847c('0x6'));var config=require(_0x847c('0x7'));var controller=require(_0x847c('0x8'));router[_0x847c('0x9')]('/',auth[_0x847c('0xa')](),controller['sendUserNotification']);module[_0x847c('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 0e418df..91e3cda 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 _0xeac1=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x5ecf7e,_0x2fd321){var _0x395a47=function(_0x368da7){while(--_0x368da7){_0x5ecf7e['push'](_0x5ecf7e['shift']());}};_0x395a47(++_0x2fd321);}(_0xeac1,0x160));var _0x1eac=function(_0x31eddb,_0x49fedd){_0x31eddb=_0x31eddb-0x0;var _0x507c30=_0xeac1[_0x31eddb];return _0x507c30;};'use strict';var Sequelize=require(_0x1eac('0x0'));module[_0x1eac('0x1')]={'body':{'type':Sequelize[_0x1eac('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x1eac('0x2')]},'recipientsDescription':{'type':Sequelize[_0x1eac('0x3')]},'beep':{'type':Sequelize[_0x1eac('0x4')]}}; \ No newline at end of file +var _0x6170=['STRING','BOOLEAN','exports','TEXT'];(function(_0x3690c0,_0x324861){var _0x564430=function(_0x19afa5){while(--_0x19afa5){_0x3690c0['push'](_0x3690c0['shift']());}};_0x564430(++_0x324861);}(_0x6170,0x17a));var _0x0617=function(_0x2af049,_0x7e1677){_0x2af049=_0x2af049-0x0;var _0x10182f=_0x6170[_0x2af049];return _0x10182f;};'use strict';var Sequelize=require('sequelize');module[_0x0617('0x0')]={'body':{'type':Sequelize[_0x0617('0x1')]},'senderName':{'type':Sequelize[_0x0617('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x0617('0x2')]},'beep':{'type':Sequelize[_0x0617('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index d81d4dc..41e0539 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 _0x3a11=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','destroy','end','error','name','sendUserNotification','text','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','team','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','beep','SenderId','join','sequelize','transaction','UserNotification','create','recipient','emit','userNotification:send','catch','Template','findOne','html','view','forEach','startCase','toLowerCase','User','union','queue','replace','Queue','ids','push','all','flatten','getAgents','eml-format','rimraf'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3a11,0x127));var _0x13a1=function(_0x5f1617,_0x46277b){_0x5f1617=_0x5f1617-0x0;var _0x3af5da=_0x3a11[_0x5f1617];return _0x3af5da;};'use strict';var emlformat=require(_0x13a1('0x0'));var rimraf=require(_0x13a1('0x1'));var zipdir=require(_0x13a1('0x2'));var jsonpatch=require(_0x13a1('0x3'));var rp=require(_0x13a1('0x4'));var moment=require('moment');var BPromise=require(_0x13a1('0x5'));var Mustache=require(_0x13a1('0x6'));var util=require(_0x13a1('0x7'));var path=require('path');var sox=require(_0x13a1('0x8'));var csv=require(_0x13a1('0x9'));var ejs=require(_0x13a1('0xa'));var fs=require('fs');var fs_extra=require(_0x13a1('0xb'));var _=require(_0x13a1('0xc'));var squel=require(_0x13a1('0xd'));var crypto=require(_0x13a1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x13a1('0xf'));var toCsv=require(_0x13a1('0x9'));var querystring=require(_0x13a1('0x10'));var Papa=require('papaparse');var Redis=require(_0x13a1('0x11'));var authService=require(_0x13a1('0x12'));var qs=require(_0x13a1('0x13'));var as=require(_0x13a1('0x14'));var hardwareService=require(_0x13a1('0x15'));var logger=require(_0x13a1('0x16'))(_0x13a1('0x17'));var utils=require('../../config/utils');var config=require(_0x13a1('0x18'));var licenseUtil=require(_0x13a1('0x19'));var db=require(_0x13a1('0x1a'))['db'];config[_0x13a1('0x1b')]=_['defaults'](config[_0x13a1('0x1b')],{'host':_0x13a1('0x1c'),'port':0x18eb});var socket=require(_0x13a1('0x1d'))(new Redis(config[_0x13a1('0x1b')]));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x24437b,_0x1a88e7){_0x1a88e7=_0x1a88e7||0xcc;return function(_0x151a1d){if(_0x151a1d){return _0x24437b[_0x13a1('0x1e')](_0x1a88e7);}return _0x24437b[_0x13a1('0x1f')](_0x1a88e7)['end']();};}function respondWithResult(_0x53c5f2,_0x4cf1d6){_0x4cf1d6=_0x4cf1d6||0xc8;return function(_0x5cc1e6){if(_0x5cc1e6){return _0x53c5f2[_0x13a1('0x1f')](_0x4cf1d6)['json'](_0x5cc1e6);}};}function respondWithFilteredResult(_0x25c28a,_0x2584c5){return function(_0x243136){if(_0x243136){var _0xb519be=typeof _0x2584c5[_0x13a1('0x20')]===_0x13a1('0x21')&&typeof _0x2584c5['limit']===_0x13a1('0x21');var _0x1260f7=_0x243136['count'];var _0x4a42c9=_0xb519be?0x0:_0x2584c5['offset'];var _0x54851f=_0xb519be?_0x243136[_0x13a1('0x22')]:_0x2584c5[_0x13a1('0x20')]+_0x2584c5[_0x13a1('0x23')];var _0x4938ce;if(_0x54851f>=_0x1260f7){_0x54851f=_0x1260f7;_0x4938ce=0xc8;}else{_0x4938ce=0xce;}_0x25c28a[_0x13a1('0x1f')](_0x4938ce);return _0x25c28a[_0x13a1('0x24')](_0x13a1('0x25'),_0x4a42c9+'-'+_0x54851f+'/'+_0x1260f7)[_0x13a1('0x26')](_0x243136);}return null;};}function patchUpdates(_0x595955){return function(_0x226e9f){try{jsonpatch[_0x13a1('0x27')](_0x226e9f,_0x595955,!![]);}catch(_0x5fda7f){return BPromise['reject'](_0x5fda7f);}return _0x226e9f[_0x13a1('0x28')]();};}function saveUpdates(_0x8e4d01,_0x58fb6f){return function(_0x5a9722){if(_0x5a9722){return _0x5a9722['update'](_0x8e4d01)[_0x13a1('0x29')](function(_0x390bbb){return _0x390bbb;});}return null;};}function removeEntity(_0x3d3a13,_0x15806a){return function(_0x5aa16d){if(_0x5aa16d){return _0x5aa16d[_0x13a1('0x2a')]()['then'](function(){_0x3d3a13[_0x13a1('0x1f')](0xcc)[_0x13a1('0x2b')]();});}};}function handleEntityNotFound(_0x351185,_0x21ad19){return function(_0x30086d){if(!_0x30086d){_0x351185[_0x13a1('0x1e')](0x194);}return _0x30086d;};}function handleError(_0x40647f,_0x1577b3){_0x1577b3=_0x1577b3||0x1f4;return function(_0x35d32d){logger[_0x13a1('0x2c')](_0x35d32d['stack']);if(_0x35d32d[_0x13a1('0x2d')]){delete _0x35d32d[_0x13a1('0x2d')];}_0x40647f[_0x13a1('0x1f')](_0x1577b3)['send'](_0x35d32d);};}exports[_0x13a1('0x2e')]=function(_0x570e54,_0x471271,_0x4bc47d){if(!_0x570e54['body']['hasOwnProperty'](_0x13a1('0x2f'))&&!_0x570e54[_0x13a1('0x30')][_0x13a1('0x31')](_0x13a1('0x32'))){throw new db[(_0x13a1('0x33'))][(_0x13a1('0x34'))](_0x13a1('0x35'));}else{if(_0x570e54['body'][_0x13a1('0x31')](_0x13a1('0x32'))&&!_0x570e54[_0x13a1('0x30')][_0x13a1('0x31')]('view')){throw new db[(_0x13a1('0x33'))][(_0x13a1('0x34'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x570e54['body'][_0x13a1('0x31')](_0x13a1('0x36'))){throw new db[(_0x13a1('0x33'))]['ValidationError'](_0x13a1('0x37'));}else{try{var _0x5c1c87=JSON[_0x13a1('0x38')](_0x570e54['body'][_0x13a1('0x36')]);}catch(_0x1f1636){logger[_0x13a1('0x2c')](_0x1f1636);throw new db[(_0x13a1('0x33'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x477c1b=[_0x13a1('0x39'),_0x13a1('0x3a'),_0x13a1('0x3b'),'openchannelqueue',_0x13a1('0x3c'),_0x13a1('0x3d'),'whatsappqueue',_0x13a1('0x3e'),'user'];if(_[_0x13a1('0x3f')](_0x5c1c87,function(_0x3372b0){return!_[_0x13a1('0x40')](_0x477c1b,_0x3372b0[_0x13a1('0x41')]['toLowerCase']());})){throw new db[(_0x13a1('0x33'))][(_0x13a1('0x34'))](_0x13a1('0x42'));}}}var _0xd21c06={};_0xd21c06[_0x13a1('0x43')]=_0x570e54[_0x13a1('0x30')][_0x13a1('0x31')]('senderName')?_0x570e54[_0x13a1('0x30')][_0x13a1('0x43')]:_0x570e54[_0x13a1('0x44')][_0x13a1('0x45')];_0xd21c06[_0x13a1('0x46')]=_['isEmpty'](_0x570e54[_0x13a1('0x30')][_0x13a1('0x46')])?null:_0x570e54['body'][_0x13a1('0x46')];_0xd21c06['beep']=_0x570e54[_0x13a1('0x30')][_0x13a1('0x47')]||![];_0xd21c06[_0x13a1('0x48')]=_0x570e54['user']['id'];return getContent(_0x570e54[_0x13a1('0x30')])[_0x13a1('0x29')](function(_0x4c3cb3){_0xd21c06[_0x13a1('0x30')]=_0x4c3cb3;return getRecipients(_0x5c1c87);})[_0x13a1('0x29')](function(_0x2f71d2){_0xd21c06['recipientsId']=_['sortBy'](_0x2f71d2)[_0x13a1('0x49')](',');return db[_0x13a1('0x4a')][_0x13a1('0x4b')](function(_0x4f600d){return db[_0x13a1('0x4c')][_0x13a1('0x4d')](_0xd21c06,{'raw':!![],'transaction':_0x4f600d})[_0x13a1('0x29')](function(_0x2ddc33){var _0x311f9d={'sender':_0xd21c06[_0x13a1('0x43')],'description':_0xd21c06['recipientsDescription'],'content':_0xd21c06[_0x13a1('0x30')],'beep':_0xd21c06[_0x13a1('0x47')]};_0x2f71d2['forEach'](function(_0x4d9b83){_0x311f9d[_0x13a1('0x4e')]=_0x4d9b83;socket[_0x13a1('0x4f')](_0x13a1('0x50'),_0x311f9d);});return _0x2ddc33;});});})[_0x13a1('0x29')](respondWithResult(_0x471271,0xc9))[_0x13a1('0x51')](handleError(_0x471271,null));};function getContent(_0x6258c1){return new BPromise(function(_0x38f13b,_0x579fac){if(_0x6258c1[_0x13a1('0x2f')]){_0x38f13b(_0x6258c1['text']);return;}return db[_0x13a1('0x52')][_0x13a1('0x53')]({'attributes':[_0x13a1('0x54')],'where':{'id':_0x6258c1[_0x13a1('0x32')]},'raw':!![]})[_0x13a1('0x29')](function(_0x485e38){if(!_0x485e38)throw new db[(_0x13a1('0x33'))][(_0x13a1('0x34'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x101dea=Mustache['render'](_0x485e38[_0x13a1('0x54')],_0x6258c1[_0x13a1('0x55')]);_0x38f13b(_0x101dea);})[_0x13a1('0x51')](function(_0x49e157){_0x579fac(_0x49e157);});});}function getRecipients(_0x16ff15){return new BPromise(function(_0x270eef,_0x5f4db4){var _0x226b75=[];var _0x41a3d2=[];_0x16ff15[_0x13a1('0x56')](function(_0x2b3d29){var _0x334fee=_[_0x13a1('0x57')](_0x2b3d29[_0x13a1('0x41')][_0x13a1('0x58')]());if(_0x334fee===_0x13a1('0x59')){_0x226b75=_[_0x13a1('0x5a')](_0x226b75,_0x2b3d29['ids']);}else{if(_[_0x13a1('0x40')](_0x334fee,_0x13a1('0x5b')))_0x334fee=_0x334fee[_0x13a1('0x5c')](_0x13a1('0x5b'),_0x13a1('0x5d'));_0x2b3d29[_0x13a1('0x5e')][_0x13a1('0x56')](function(_0x14d2a6){_0x41a3d2[_0x13a1('0x5f')](getAgents(_0x334fee,_0x14d2a6));});}});return BPromise[_0x13a1('0x60')](_0x41a3d2)['then'](function(_0x4ce8ef){_0x226b75=_['union'](_0x226b75,_[_0x13a1('0x61')](_0x4ce8ef));_0x270eef(_0x226b75);})[_0x13a1('0x51')](function(_0x5af150){_0x5f4db4(_0x5af150);});});}function getAgents(_0x330adb,_0x246d84){return new BPromise(function(_0x422694,_0x1fef8b){return db[_0x330adb][_0x13a1('0x53')]({'where':{'id':_0x246d84}})[_0x13a1('0x29')](function(_0x1c8040){return _0x1c8040[_0x13a1('0x62')]({'attributes':['id'],'raw':!![]})['then'](function(_0x440977){var _0x19a597=_['map'](_0x440977,'id');_0x422694(_0x19a597);});})[_0x13a1('0x51')](function(_0x40b9db){_0x1fef8b(_0x40b9db);});});} \ No newline at end of file +var _0x061e=['recipientsId','join','sequelize','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','html','render','view','startCase','User','union','ids','queue','replace','Queue','push','findOne','getAgents','map','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Sequelize','Missing\x20\x27view\x27\x20parameter','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','smsqueue','voicequeue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId'];(function(_0x5c1345,_0x40116e){var _0x1c070d=function(_0x1e862f){while(--_0x1e862f){_0x5c1345['push'](_0x5c1345['shift']());}};_0x1c070d(++_0x40116e);}(_0x061e,0x13e));var _0xe061=function(_0x45ebef,_0x51a522){_0x45ebef=_0x45ebef-0x0;var _0x26dbe1=_0x061e[_0x45ebef];return _0x26dbe1;};'use strict';var emlformat=require(_0xe061('0x0'));var rimraf=require(_0xe061('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe061('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe061('0x3'));var util=require(_0xe061('0x4'));var path=require(_0xe061('0x5'));var sox=require(_0xe061('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe061('0x7'));var _=require(_0xe061('0x8'));var squel=require('squel');var crypto=require(_0xe061('0x9'));var jsforce=require(_0xe061('0xa'));var deskjs=require(_0xe061('0xb'));var toCsv=require(_0xe061('0xc'));var querystring=require(_0xe061('0xd'));var Papa=require(_0xe061('0xe'));var Redis=require('ioredis');var authService=require(_0xe061('0xf'));var qs=require(_0xe061('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe061('0x11'));var logger=require('../../config/logger')(_0xe061('0x12'));var utils=require(_0xe061('0x13'));var config=require(_0xe061('0x14'));var licenseUtil=require(_0xe061('0x15'));var db=require(_0xe061('0x16'))['db'];config[_0xe061('0x17')]=_['defaults'](config['redis'],{'host':_0xe061('0x18'),'port':0x18eb});var socket=require(_0xe061('0x19'))(new Redis(config['redis']));require(_0xe061('0x1a'))['register'](socket);function respondWithStatusCode(_0x5edaba,_0x38275d){_0x38275d=_0x38275d||0xcc;return function(_0x109ea7){if(_0x109ea7){return _0x5edaba[_0xe061('0x1b')](_0x38275d);}return _0x5edaba[_0xe061('0x1c')](_0x38275d)[_0xe061('0x1d')]();};}function respondWithResult(_0x9404c1,_0x56c0e8){_0x56c0e8=_0x56c0e8||0xc8;return function(_0x2a6124){if(_0x2a6124){return _0x9404c1[_0xe061('0x1c')](_0x56c0e8)['json'](_0x2a6124);}};}function respondWithFilteredResult(_0x431013,_0xb43e0f){return function(_0x4af481){if(_0x4af481){var _0x4689aa=typeof _0xb43e0f[_0xe061('0x1e')]===_0xe061('0x1f')&&typeof _0xb43e0f[_0xe061('0x20')]===_0xe061('0x1f');var _0x26dec3=_0x4af481['count'];var _0x53468c=_0x4689aa?0x0:_0xb43e0f[_0xe061('0x1e')];var _0x421fc2=_0x4689aa?_0x4af481[_0xe061('0x21')]:_0xb43e0f[_0xe061('0x1e')]+_0xb43e0f[_0xe061('0x20')];var _0x861bc9;if(_0x421fc2>=_0x26dec3){_0x421fc2=_0x26dec3;_0x861bc9=0xc8;}else{_0x861bc9=0xce;}_0x431013['status'](_0x861bc9);return _0x431013[_0xe061('0x22')](_0xe061('0x23'),_0x53468c+'-'+_0x421fc2+'/'+_0x26dec3)[_0xe061('0x24')](_0x4af481);}return null;};}function patchUpdates(_0x111e4c){return function(_0x310156){try{jsonpatch[_0xe061('0x25')](_0x310156,_0x111e4c,!![]);}catch(_0x40f91a){return BPromise[_0xe061('0x26')](_0x40f91a);}return _0x310156[_0xe061('0x27')]();};}function saveUpdates(_0x4f6901,_0x2be9e5){return function(_0x53ad7d){if(_0x53ad7d){return _0x53ad7d['update'](_0x4f6901)[_0xe061('0x28')](function(_0x156446){return _0x156446;});}return null;};}function removeEntity(_0x4eb1c3,_0x535ee6){return function(_0x1ad0fb){if(_0x1ad0fb){return _0x1ad0fb['destroy']()['then'](function(){_0x4eb1c3['status'](0xcc)[_0xe061('0x1d')]();});}};}function handleEntityNotFound(_0x5e15db,_0x1a695d){return function(_0x2c643c){if(!_0x2c643c){_0x5e15db[_0xe061('0x1b')](0x194);}return _0x2c643c;};}function handleError(_0x4f6c9d,_0xf3edcc){_0xf3edcc=_0xf3edcc||0x1f4;return function(_0x5e17c4){logger[_0xe061('0x29')](_0x5e17c4[_0xe061('0x2a')]);if(_0x5e17c4[_0xe061('0x2b')]){delete _0x5e17c4[_0xe061('0x2b')];}_0x4f6c9d[_0xe061('0x1c')](_0xf3edcc)[_0xe061('0x2c')](_0x5e17c4);};}exports[_0xe061('0x2d')]=function(_0x2813c9,_0x3d0aff,_0xa299c7){if(!_0x2813c9[_0xe061('0x2e')][_0xe061('0x2f')](_0xe061('0x30'))&&!_0x2813c9[_0xe061('0x2e')]['hasOwnProperty'](_0xe061('0x31'))){throw new db['Sequelize']['ValidationError'](_0xe061('0x32'));}else{if(_0x2813c9[_0xe061('0x2e')][_0xe061('0x2f')]('TemplateId')&&!_0x2813c9[_0xe061('0x2e')][_0xe061('0x2f')]('view')){throw new db[(_0xe061('0x33'))]['ValidationError'](_0xe061('0x34'));}if(!_0x2813c9[_0xe061('0x2e')]['hasOwnProperty']('recipients')){throw new db[(_0xe061('0x33'))][(_0xe061('0x35'))](_0xe061('0x36'));}else{try{var _0x53370b=JSON[_0xe061('0x37')](_0x2813c9['body'][_0xe061('0x38')]);}catch(_0x13d352){logger[_0xe061('0x29')](_0x13d352);throw new db[(_0xe061('0x33'))][(_0xe061('0x35'))](_0xe061('0x39'));}var _0x4f3f4c=[_0xe061('0x3a'),_0xe061('0x3b'),'mailqueue','openchannelqueue',_0xe061('0x3c'),_0xe061('0x3d'),'whatsappqueue',_0xe061('0x3e'),_0xe061('0x3f')];if(_[_0xe061('0x40')](_0x53370b,function(_0x1cac80){return!_[_0xe061('0x41')](_0x4f3f4c,_0x1cac80[_0xe061('0x42')][_0xe061('0x43')]());})){throw new db[(_0xe061('0x33'))][(_0xe061('0x35'))](_0xe061('0x44'));}}}var _0x3cb047={};_0x3cb047[_0xe061('0x45')]=_0x2813c9[_0xe061('0x2e')][_0xe061('0x2f')](_0xe061('0x45'))?_0x2813c9[_0xe061('0x2e')][_0xe061('0x45')]:_0x2813c9[_0xe061('0x3f')]['fullname'];_0x3cb047[_0xe061('0x46')]=_[_0xe061('0x47')](_0x2813c9[_0xe061('0x2e')][_0xe061('0x46')])?null:_0x2813c9[_0xe061('0x2e')][_0xe061('0x46')];_0x3cb047[_0xe061('0x48')]=_0x2813c9['body'][_0xe061('0x48')]||![];_0x3cb047[_0xe061('0x49')]=_0x2813c9[_0xe061('0x3f')]['id'];return getContent(_0x2813c9['body'])[_0xe061('0x28')](function(_0x25d24e){_0x3cb047[_0xe061('0x2e')]=_0x25d24e;return getRecipients(_0x53370b);})[_0xe061('0x28')](function(_0xbba26c){_0x3cb047[_0xe061('0x4a')]=_['sortBy'](_0xbba26c)[_0xe061('0x4b')](',');return db[_0xe061('0x4c')]['transaction'](function(_0xebe4a3){return db[_0xe061('0x4d')][_0xe061('0x4e')](_0x3cb047,{'raw':!![],'transaction':_0xebe4a3})['then'](function(_0x1d3ceb){var _0x10615d={'sender':_0x3cb047[_0xe061('0x45')],'description':_0x3cb047[_0xe061('0x46')],'content':_0x3cb047[_0xe061('0x2e')],'beep':_0x3cb047[_0xe061('0x48')]};_0xbba26c[_0xe061('0x4f')](function(_0x5d2ad7){_0x10615d[_0xe061('0x50')]=_0x5d2ad7;socket[_0xe061('0x51')](_0xe061('0x52'),_0x10615d);});return _0x1d3ceb;});});})[_0xe061('0x28')](respondWithResult(_0x3d0aff,0xc9))[_0xe061('0x53')](handleError(_0x3d0aff,null));};function getContent(_0x2ea2db){return new BPromise(function(_0x488595,_0x20ff7f){if(_0x2ea2db['text']){_0x488595(_0x2ea2db[_0xe061('0x30')]);return;}return db['Template']['findOne']({'attributes':[_0xe061('0x54')],'where':{'id':_0x2ea2db[_0xe061('0x31')]},'raw':!![]})[_0xe061('0x28')](function(_0x284b87){if(!_0x284b87)throw new db[(_0xe061('0x33'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x4270f8=Mustache[_0xe061('0x55')](_0x284b87[_0xe061('0x54')],_0x2ea2db[_0xe061('0x56')]);_0x488595(_0x4270f8);})[_0xe061('0x53')](function(_0x1e06ad){_0x20ff7f(_0x1e06ad);});});}function getRecipients(_0x3f71eb){return new BPromise(function(_0x59fa29,_0x162cff){var _0x4e5347=[];var _0x33e6a0=[];_0x3f71eb[_0xe061('0x4f')](function(_0x5c7521){var _0x10da0b=_[_0xe061('0x57')](_0x5c7521[_0xe061('0x42')][_0xe061('0x43')]());if(_0x10da0b===_0xe061('0x58')){_0x4e5347=_[_0xe061('0x59')](_0x4e5347,_0x5c7521[_0xe061('0x5a')]);}else{if(_['includes'](_0x10da0b,_0xe061('0x5b')))_0x10da0b=_0x10da0b[_0xe061('0x5c')](_0xe061('0x5b'),_0xe061('0x5d'));_0x5c7521['ids'][_0xe061('0x4f')](function(_0x2bbffc){_0x33e6a0[_0xe061('0x5e')](getAgents(_0x10da0b,_0x2bbffc));});}});return BPromise['all'](_0x33e6a0)[_0xe061('0x28')](function(_0x2212d0){_0x4e5347=_[_0xe061('0x59')](_0x4e5347,_['flatten'](_0x2212d0));_0x59fa29(_0x4e5347);})[_0xe061('0x53')](function(_0x412912){_0x162cff(_0x412912);});});}function getAgents(_0xef895c,_0x57fb2e){return new BPromise(function(_0x69602b,_0x3c6dc0){return db[_0xef895c][_0xe061('0x5f')]({'where':{'id':_0x57fb2e}})[_0xe061('0x28')](function(_0x480924){return _0x480924[_0xe061('0x60')]({'attributes':['id'],'raw':!![]})[_0xe061('0x28')](function(_0x15a53b){var _0x315408=_[_0xe061('0x61')](_0x15a53b,'id');_0x69602b(_0x315408);});})[_0xe061('0x53')](function(_0x36d556){_0x3c6dc0(_0x36d556);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index d6ef68a..952a679 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 _0xb1e1=['setMaxListeners','save','remove','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification'];(function(_0x165e8c,_0x39d736){var _0x463871=function(_0x3ae2e8){while(--_0x3ae2e8){_0x165e8c['push'](_0x165e8c['shift']());}};_0x463871(++_0x39d736);}(_0xb1e1,0x96));var _0x1b1e=function(_0x44c5d1,_0x38e605){_0x44c5d1=_0x44c5d1-0x0;var _0x57cb89=_0xb1e1[_0x44c5d1];return _0x57cb89;};'use strict';var EventEmitter=require(_0x1b1e('0x0'));var UserNotification=require(_0x1b1e('0x1'))['db'][_0x1b1e('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x1b1e('0x3')](0x0);var events={'afterCreate':_0x1b1e('0x4'),'afterUpdate':'update','afterDestroy':_0x1b1e('0x5')};function emitEvent(_0x58c09c){return function(_0x1345e5,_0x1f4b8b,_0x14c3d7){UserNotificationEvents['emit'](_0x58c09c+':'+_0x1345e5['id'],_0x1345e5);UserNotificationEvents['emit'](_0x58c09c,_0x1345e5);_0x14c3d7(null);};}for(var e in events){if(events[_0x1b1e('0x6')](e)){var event=events[e];UserNotification[_0x1b1e('0x7')](e,emitEvent(event));}}module[_0x1b1e('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xa278=['update','remove','emit','hook','exports','setMaxListeners','save'];(function(_0x15d1c7,_0x49d2fa){var _0x509d18=function(_0x99a8fe){while(--_0x99a8fe){_0x15d1c7['push'](_0x15d1c7['shift']());}};_0x509d18(++_0x49d2fa);}(_0xa278,0x155));var _0x8a27=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0xa278[_0x1c8cc6];return _0x522936;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x8a27('0x0')](0x0);var events={'afterCreate':_0x8a27('0x1'),'afterUpdate':_0x8a27('0x2'),'afterDestroy':_0x8a27('0x3')};function emitEvent(_0x421605){return function(_0x3c97aa,_0x55fa28,_0xa0bc76){UserNotificationEvents[_0x8a27('0x4')](_0x421605+':'+_0x3c97aa['id'],_0x3c97aa);UserNotificationEvents[_0x8a27('0x4')](_0x421605,_0x3c97aa);_0xa0bc76(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x8a27('0x5')](e,emitEvent(event));}}module[_0x8a27('0x6')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 82fb027..1834f3c 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 _0xb126=['path','./userNotification.attributes','exports','define','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise'];(function(_0x3b40c8,_0x3d41f5){var _0x3db4c5=function(_0x3a08c9){while(--_0x3a08c9){_0x3b40c8['push'](_0x3b40c8['shift']());}};_0x3db4c5(++_0x3d41f5);}(_0xb126,0x127));var _0x6b12=function(_0x3d4689,_0x14f517){_0x3d4689=_0x3d4689-0x0;var _0x2540e8=_0xb126[_0x3d4689];return _0x2540e8;};'use strict';var _=require(_0x6b12('0x0'));var util=require(_0x6b12('0x1'));var logger=require(_0x6b12('0x2'))(_0x6b12('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6b12('0x4'));var fs=require('fs');var path=require(_0x6b12('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6b12('0x6'));module[_0x6b12('0x7')]=function(_0x5a4bef,_0x57f9c4){return _0x5a4bef[_0x6b12('0x8')]('UserNotification',attributes,{'tableName':_0x6b12('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6b12('0xa'),'collate':_0x6b12('0xb')});}; \ No newline at end of file +var _0x8f5b=['bluebird','request-promise','path','rimraf','define','utf8mb4','utf8mb4_unicode_ci','util','api','moment'];(function(_0x1ff329,_0x33e086){var _0x28501d=function(_0x38b7c7){while(--_0x38b7c7){_0x1ff329['push'](_0x1ff329['shift']());}};_0x28501d(++_0x33e086);}(_0x8f5b,0x115));var _0xb8f5=function(_0x10c74e,_0x4182c1){_0x10c74e=_0x10c74e-0x0;var _0x5048a5=_0x8f5b[_0x10c74e];return _0x5048a5;};'use strict';var _=require('lodash');var util=require(_0xb8f5('0x0'));var logger=require('../../config/logger')(_0xb8f5('0x1'));var moment=require(_0xb8f5('0x2'));var BPromise=require(_0xb8f5('0x3'));var rp=require(_0xb8f5('0x4'));var fs=require('fs');var path=require(_0xb8f5('0x5'));var rimraf=require(_0xb8f5('0x6'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module['exports']=function(_0x25a3b2,_0xae7377){return _0x25a3b2[_0xb8f5('0x7')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb8f5('0x8'),'collate':_0xb8f5('0x9')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index c5ea81d..2a88875 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 _0x99e0=['defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x3b407d,_0x19cbdb){var _0x1fec09=function(_0x50c9e4){while(--_0x50c9e4){_0x3b407d['push'](_0x3b407d['shift']());}};_0x1fec09(++_0x19cbdb);}(_0x99e0,0x13f));var _0x099e=function(_0x202529,_0x1245ab){_0x202529=_0x202529-0x0;var _0x226151=_0x99e0[_0x202529];return _0x226151;};'use strict';var _=require(_0x099e('0x0'));var util=require('util');var moment=require(_0x099e('0x1'));var BPromise=require(_0x099e('0x2'));var rs=require(_0x099e('0x3'));var fs=require('fs');var Redis=require(_0x099e('0x4'));var db=require(_0x099e('0x5'))['db'];var utils=require(_0x099e('0x6'));var logger=require(_0x099e('0x7'))(_0x099e('0x8'));var config=require(_0x099e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x099e('0xa')]({'port':0x232a});config['redis']=_[_0x099e('0xb')](config[_0x099e('0xc')],{'host':_0x099e('0xd'),'port':0x18eb});var socket=require(_0x099e('0xe'))(new Redis(config[_0x099e('0xc')]));require(_0x099e('0xf'))[_0x099e('0x10')](socket);function respondWithRpcPromise(_0x42fe6b,_0x91e700,_0x2e9bdb){return new BPromise(function(_0x3833ad,_0xbed828){return client[_0x099e('0x11')](_0x42fe6b,_0x2e9bdb)[_0x099e('0x12')](function(_0x3bc300){logger['info'](_0x099e('0x13'),_0x91e700,'request\x20sent');logger[_0x099e('0x14')](_0x099e('0x15'),_0x91e700,_0x099e('0x16'),JSON[_0x099e('0x17')](_0x3bc300));if(_0x3bc300[_0x099e('0x18')]){if(_0x3bc300[_0x099e('0x18')][_0x099e('0x19')]===0x1f4){logger[_0x099e('0x18')](_0x099e('0x13'),_0x91e700,_0x3bc300[_0x099e('0x18')][_0x099e('0x1a')]);return _0xbed828(_0x3bc300[_0x099e('0x18')][_0x099e('0x1a')]);}logger[_0x099e('0x18')](_0x099e('0x13'),_0x91e700,_0x3bc300[_0x099e('0x18')]['message']);return _0x3833ad(_0x3bc300['error'][_0x099e('0x1a')]);}else{logger[_0x099e('0x1b')]('UserNotification,\x20%s,\x20%s',_0x91e700,_0x099e('0x16'));_0x3833ad(_0x3bc300[_0x099e('0x1c')]['message']);}})[_0x099e('0x1d')](function(_0x2d7fc8){logger[_0x099e('0x18')](_0x099e('0x13'),_0x91e700,_0x2d7fc8);_0xbed828(_0x2d7fc8);});});} \ No newline at end of file +var _0x1f1d=['request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserNotification,\x20%s,\x20%s','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','request','then','info'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x1f1d,0x78));var _0xd1f1=function(_0x524eb9,_0x5ad086){_0x524eb9=_0x524eb9-0x0;var _0x10105c=_0x1f1d[_0x524eb9];return _0x10105c;};'use strict';var _=require(_0xd1f1('0x0'));var util=require(_0xd1f1('0x1'));var moment=require(_0xd1f1('0x2'));var BPromise=require('bluebird');var rs=require(_0xd1f1('0x3'));var fs=require('fs');var Redis=require(_0xd1f1('0x4'));var db=require(_0xd1f1('0x5'))['db'];var utils=require(_0xd1f1('0x6'));var logger=require(_0xd1f1('0x7'))(_0xd1f1('0x8'));var config=require(_0xd1f1('0x9'));var jayson=require(_0xd1f1('0xa'));var client=jayson[_0xd1f1('0xb')][_0xd1f1('0xc')]({'port':0x232a});config[_0xd1f1('0xd')]=_['defaults'](config[_0xd1f1('0xd')],{'host':_0xd1f1('0xe'),'port':0x18eb});var socket=require(_0xd1f1('0xf'))(new Redis(config[_0xd1f1('0xd')]));require(_0xd1f1('0x10'))['register'](socket);function respondWithRpcPromise(_0x1179a2,_0x48f7b2,_0x4132a8){return new BPromise(function(_0x5276c6,_0x5918a3){return client[_0xd1f1('0x11')](_0x1179a2,_0x4132a8)[_0xd1f1('0x12')](function(_0x48af1c){logger[_0xd1f1('0x13')]('UserNotification,\x20%s,\x20%s',_0x48f7b2,_0xd1f1('0x14'));logger['debug'](_0xd1f1('0x15'),_0x48f7b2,_0xd1f1('0x14'),JSON[_0xd1f1('0x16')](_0x48af1c));if(_0x48af1c['error']){if(_0x48af1c[_0xd1f1('0x17')][_0xd1f1('0x18')]===0x1f4){logger[_0xd1f1('0x17')]('UserNotification,\x20%s,\x20%s',_0x48f7b2,_0x48af1c[_0xd1f1('0x17')]['message']);return _0x5918a3(_0x48af1c[_0xd1f1('0x17')][_0xd1f1('0x19')]);}logger['error'](_0xd1f1('0x1a'),_0x48f7b2,_0x48af1c[_0xd1f1('0x17')][_0xd1f1('0x19')]);return _0x5276c6(_0x48af1c[_0xd1f1('0x17')][_0xd1f1('0x19')]);}else{logger[_0xd1f1('0x13')]('UserNotification,\x20%s,\x20%s',_0x48f7b2,_0xd1f1('0x14'));_0x5276c6(_0x48af1c[_0xd1f1('0x1b')][_0xd1f1('0x19')]);}})['catch'](function(_0x1550ce){logger[_0xd1f1('0x17')](_0xd1f1('0x1a'),_0x48f7b2,_0x1550ce);_0x5918a3(_0x1550ce);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 9e5483a..048d15a 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 _0x7f67=['userNotification:','./userNotification.events','update','removeListener','register','length'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0x7f67,0x1a5));var _0x77f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7f67[_0x432682];return _0x463d05;};'use strict';var UserNotificationEvents=require(_0x77f6('0x0'));var events=['save','remove',_0x77f6('0x1')];function createListener(_0x5b2267,_0x6a215){return function(_0x1dbd63){_0x6a215['emit'](_0x5b2267,_0x1dbd63);};}function removeListener(_0x20950d,_0x18f753){return function(){UserNotificationEvents[_0x77f6('0x2')](_0x20950d,_0x18f753);};}exports[_0x77f6('0x3')]=function(_0x54525b){for(var _0x3e9273=0x0,_0x274a2b=events[_0x77f6('0x4')];_0x3e9273<_0x274a2b;_0x3e9273++){var _0x6ef788=events[_0x3e9273];var _0xa2a8d6=createListener(_0x77f6('0x5')+_0x6ef788,_0x54525b);UserNotificationEvents['on'](_0x6ef788,_0xa2a8d6);}}; \ No newline at end of file +var _0xc1af=['update','emit','removeListener','register','length','userNotification:','save','remove'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc1af,0x1c6));var _0xfc1a=function(_0x29e9ce,_0x3d2e73){_0x29e9ce=_0x29e9ce-0x0;var _0x458aa6=_0xc1af[_0x29e9ce];return _0x458aa6;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xfc1a('0x0'),_0xfc1a('0x1'),_0xfc1a('0x2')];function createListener(_0x5c7ae5,_0x45840e){return function(_0x23469d){_0x45840e[_0xfc1a('0x3')](_0x5c7ae5,_0x23469d);};}function removeListener(_0x1f4ca8,_0x57d33d){return function(){UserNotificationEvents[_0xfc1a('0x4')](_0x1f4ca8,_0x57d33d);};}exports[_0xfc1a('0x5')]=function(_0x295fe1){for(var _0x5dfa09=0x0,_0x504b1d=events[_0xfc1a('0x6')];_0x5dfa09<_0x504b1d;_0x5dfa09++){var _0x319094=events[_0x5dfa09];var _0x13a032=createListener(_0xfc1a('0x7')+_0x319094,_0x295fe1);UserNotificationEvents['on'](_0x319094,_0x13a032);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index cfedb9c..9c5efac 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5a43a7,_0x22ac89){var _0x137796=function(_0x6f46fb){while(--_0x6f46fb){_0x5a43a7['push'](_0x5a43a7['shift']());}};_0x137796(++_0x22ac89);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x38b2d9,_0x19fd42){var _0x23a3e1=function(_0xd8192f){while(--_0xd8192f){_0x38b2d9['push'](_0x38b2d9['shift']());}};_0x23a3e1(++_0x19fd42);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index e6f2e97..400b653 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 _0x8d61=['sequelize','exports','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8d61,0x1b3));var _0x18d6=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0x8d61[_0x223461];return _0x4dbe0a;};'use strict';var Sequelize=require(_0x18d6('0x0'));module[_0x18d6('0x1')]={'penalty':{'type':Sequelize[_0x18d6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x04e9=['exports'];(function(_0x2ad028,_0x3880da){var _0x5e5406=function(_0x327b5a){while(--_0x327b5a){_0x2ad028['push'](_0x2ad028['shift']());}};_0x5e5406(++_0x3880da);}(_0x04e9,0x7b));var _0x904e=function(_0x369244,_0x31242c){_0x369244=_0x369244-0x0;var _0x3752bb=_0x04e9[_0x369244];return _0x3752bb;};'use strict';var Sequelize=require('sequelize');module[_0x904e('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index ffddf2c..38a8546 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 _0x457e=['bluebird','request-promise','../../config/environment','./userOpenchannelQueue.attributes','exports','define','lodash','../../config/logger','moment'];(function(_0x1eb3ad,_0x427108){var _0x49e194=function(_0x42dcff){while(--_0x42dcff){_0x1eb3ad['push'](_0x1eb3ad['shift']());}};_0x49e194(++_0x427108);}(_0x457e,0x1ec));var _0xe457=function(_0xe4a793,_0x4edc4b){_0xe4a793=_0xe4a793-0x0;var _0x56d2e4=_0x457e[_0xe4a793];return _0x56d2e4;};'use strict';var _=require(_0xe457('0x0'));var util=require('util');var logger=require(_0xe457('0x1'))('api');var moment=require(_0xe457('0x2'));var BPromise=require(_0xe457('0x3'));var rp=require(_0xe457('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe457('0x5'));var attributes=require(_0xe457('0x6'));module[_0xe457('0x7')]=function(_0x252476,_0x1664dd){return _0x252476[_0xe457('0x8')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1fe3=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0x1fe3,0xc0));var _0x31fe=function(_0x5efec2,_0x43579b){_0x5efec2=_0x5efec2-0x0;var _0x370904=_0x1fe3[_0x5efec2];return _0x370904;};'use strict';var _=require(_0x31fe('0x0'));var util=require('util');var logger=require(_0x31fe('0x1'))('api');var moment=require(_0x31fe('0x2'));var BPromise=require('bluebird');var rp=require(_0x31fe('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31fe('0x4'));var config=require(_0x31fe('0x5'));var attributes=require(_0x31fe('0x6'));module[_0x31fe('0x7')]=function(_0xfe2c49,_0x2b0178){return _0xfe2c49[_0x31fe('0x8')](_0x31fe('0x9'),attributes,{'tableName':_0x31fe('0xa'),'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 727c71f..1521593 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 _0xfbdb=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x148cd4,_0x3bb783){var _0x1b8338=function(_0x50e4a5){while(--_0x50e4a5){_0x148cd4['push'](_0x148cd4['shift']());}};_0x1b8338(++_0x3bb783);}(_0xfbdb,0x1a5));var _0xbfbd=function(_0x3185b7,_0x1e8b49){_0x3185b7=_0x3185b7-0x0;var _0x3898fe=_0xfbdb[_0x3185b7];return _0x3898fe;};'use strict';var _=require(_0xbfbd('0x0'));var util=require('util');var moment=require(_0xbfbd('0x1'));var BPromise=require(_0xbfbd('0x2'));var rs=require(_0xbfbd('0x3'));var fs=require('fs');var Redis=require(_0xbfbd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbfbd('0x5'));var logger=require(_0xbfbd('0x6'))('rpc');var config=require(_0xbfbd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbfbd('0x8')][_0xbfbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bed71,_0x546dac,_0x33231b){return new BPromise(function(_0x34656e,_0x69d128){return client[_0xbfbd('0xa')](_0x4bed71,_0x33231b)[_0xbfbd('0xb')](function(_0x249ab0){logger['info'](_0xbfbd('0xc'),_0x546dac,'request\x20sent');logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x546dac,_0xbfbd('0xd'),JSON[_0xbfbd('0xe')](_0x249ab0));if(_0x249ab0[_0xbfbd('0xf')]){if(_0x249ab0[_0xbfbd('0xf')][_0xbfbd('0x10')]===0x1f4){logger[_0xbfbd('0xf')](_0xbfbd('0xc'),_0x546dac,_0x249ab0[_0xbfbd('0xf')]['message']);return _0x69d128(_0x249ab0[_0xbfbd('0xf')][_0xbfbd('0x11')]);}logger[_0xbfbd('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x546dac,_0x249ab0[_0xbfbd('0xf')][_0xbfbd('0x11')]);return _0x34656e(_0x249ab0['error']['message']);}else{logger[_0xbfbd('0x12')](_0xbfbd('0xc'),_0x546dac,_0xbfbd('0xd'));_0x34656e(_0x249ab0[_0xbfbd('0x13')][_0xbfbd('0x11')]);}})[_0xbfbd('0x14')](function(_0x56c10a){logger[_0xbfbd('0xf')](_0xbfbd('0xc'),_0x546dac,_0x56c10a);_0x69d128(_0x56c10a);});});} \ No newline at end of file +var _0x7c1a=['info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1661c8,_0x502da0){var _0x39f9b4=function(_0x5d6e4d){while(--_0x5d6e4d){_0x1661c8['push'](_0x1661c8['shift']());}};_0x39f9b4(++_0x502da0);}(_0x7c1a,0x163));var _0xa7c1=function(_0x448431,_0x5256d6){_0x448431=_0x448431-0x0;var _0x37f204=_0x7c1a[_0x448431];return _0x37f204;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa7c1('0x0'));var BPromise=require(_0xa7c1('0x1'));var rs=require(_0xa7c1('0x2'));var fs=require('fs');var Redis=require(_0xa7c1('0x3'));var db=require(_0xa7c1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7c1('0x5'))(_0xa7c1('0x6'));var config=require(_0xa7c1('0x7'));var jayson=require(_0xa7c1('0x8'));var client=jayson[_0xa7c1('0x9')][_0xa7c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c1f75,_0x5efb90,_0x317d36){return new BPromise(function(_0x2ffc2b,_0x152070){return client[_0xa7c1('0xb')](_0x4c1f75,_0x317d36)[_0xa7c1('0xc')](function(_0x1a3e02){logger[_0xa7c1('0xd')](_0xa7c1('0xe'),_0x5efb90,_0xa7c1('0xf'));logger[_0xa7c1('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5efb90,_0xa7c1('0xf'),JSON[_0xa7c1('0x11')](_0x1a3e02));if(_0x1a3e02['error']){if(_0x1a3e02[_0xa7c1('0x12')][_0xa7c1('0x13')]===0x1f4){logger[_0xa7c1('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5efb90,_0x1a3e02['error'][_0xa7c1('0x14')]);return _0x152070(_0x1a3e02[_0xa7c1('0x12')][_0xa7c1('0x14')]);}logger['error'](_0xa7c1('0xe'),_0x5efb90,_0x1a3e02['error'][_0xa7c1('0x14')]);return _0x2ffc2b(_0x1a3e02[_0xa7c1('0x12')][_0xa7c1('0x14')]);}else{logger['info'](_0xa7c1('0xe'),_0x5efb90,_0xa7c1('0xf'));_0x2ffc2b(_0x1a3e02[_0xa7c1('0x15')][_0xa7c1('0x14')]);}})[_0xa7c1('0x16')](function(_0x21d2fa){logger['error'](_0xa7c1('0xe'),_0x5efb90,_0x21d2fa);_0x152070(_0x21d2fa);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index c0755b9..54f54d8 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 _0x2609=['addSections','addResources','put','update','delete','removeSections','/:id/resources','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','/describe','describe','/:id','getSections','getResources','create','post','/:id/clone','clone','/:id/sections'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x2609,0x1da));var _0x9260=function(_0x1a0e70,_0x4728d8){_0x1a0e70=_0x1a0e70-0x0;var _0x5c6b4a=_0x2609[_0x1a0e70];return _0x5c6b4a;};'use strict';var multer=require(_0x9260('0x0'));var util=require(_0x9260('0x1'));var path=require(_0x9260('0x2'));var timeout=require(_0x9260('0x3'));var express=require(_0x9260('0x4'));var router=express[_0x9260('0x5')]();var fs_extra=require(_0x9260('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9260('0x7'));var config=require(_0x9260('0x8'));var controller=require(_0x9260('0x9'));router[_0x9260('0xa')]('/',auth[_0x9260('0xb')](),controller['index']);router[_0x9260('0xa')](_0x9260('0xc'),auth[_0x9260('0xb')](),controller[_0x9260('0xd')]);router[_0x9260('0xa')](_0x9260('0xe'),auth[_0x9260('0xb')](),controller['show']);router['get']('/:id/sections',auth['isAuthenticated'](),controller[_0x9260('0xf')]);router['get']('/:id/resources',auth[_0x9260('0xb')](),controller[_0x9260('0x10')]);router['post']('/',auth[_0x9260('0xb')](),controller[_0x9260('0x11')]);router[_0x9260('0x12')](_0x9260('0x13'),auth['isAuthenticated'](),controller[_0x9260('0x14')]);router[_0x9260('0x12')](_0x9260('0x15'),auth['isAuthenticated'](),controller[_0x9260('0x16')]);router[_0x9260('0x12')]('/:id/resources',auth['isAuthenticated'](),controller[_0x9260('0x17')]);router[_0x9260('0x18')](_0x9260('0xe'),auth['isAuthenticated'](),controller[_0x9260('0x19')]);router[_0x9260('0x1a')](_0x9260('0xe'),auth[_0x9260('0xb')](),controller['destroy']);router[_0x9260('0x1a')]('/:id/sections',auth[_0x9260('0xb')](),controller[_0x9260('0x1b')]);router[_0x9260('0x1a')](_0x9260('0x1c'),auth['isAuthenticated'](),controller[_0x9260('0x1d')]);module[_0x9260('0x1e')]=router; \ No newline at end of file +var _0x645d=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','getResources','post','create','clone','addSections','/:id/resources','delete','destroy','removeSections','exports'];(function(_0x27a4cb,_0x1d3220){var _0x4f7331=function(_0x5f2f69){while(--_0x5f2f69){_0x27a4cb['push'](_0x27a4cb['shift']());}};_0x4f7331(++_0x1d3220);}(_0x645d,0x17a));var _0xd645=function(_0xf4a942,_0x18ae8c){_0xf4a942=_0xf4a942-0x0;var _0x526f6d=_0x645d[_0xf4a942];return _0x526f6d;};'use strict';var multer=require('multer');var util=require(_0xd645('0x0'));var path=require(_0xd645('0x1'));var timeout=require(_0xd645('0x2'));var express=require('express');var router=express[_0xd645('0x3')]();var fs_extra=require(_0xd645('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd645('0x5'));var config=require(_0xd645('0x6'));var controller=require(_0xd645('0x7'));router[_0xd645('0x8')]('/',auth[_0xd645('0x9')](),controller[_0xd645('0xa')]);router[_0xd645('0x8')](_0xd645('0xb'),auth[_0xd645('0x9')](),controller[_0xd645('0xc')]);router[_0xd645('0x8')](_0xd645('0xd'),auth[_0xd645('0x9')](),controller[_0xd645('0xe')]);router[_0xd645('0x8')](_0xd645('0xf'),auth[_0xd645('0x9')](),controller[_0xd645('0x10')]);router[_0xd645('0x8')]('/:id/resources',auth['isAuthenticated'](),controller[_0xd645('0x11')]);router[_0xd645('0x12')]('/',auth[_0xd645('0x9')](),controller[_0xd645('0x13')]);router['post']('/:id/clone',auth[_0xd645('0x9')](),controller[_0xd645('0x14')]);router[_0xd645('0x12')](_0xd645('0xf'),auth[_0xd645('0x9')](),controller[_0xd645('0x15')]);router[_0xd645('0x12')](_0xd645('0x16'),auth[_0xd645('0x9')](),controller['addResources']);router['put'](_0xd645('0xd'),auth[_0xd645('0x9')](),controller['update']);router[_0xd645('0x17')](_0xd645('0xd'),auth['isAuthenticated'](),controller[_0xd645('0x18')]);router[_0xd645('0x17')]('/:id/sections',auth['isAuthenticated'](),controller[_0xd645('0x19')]);router[_0xd645('0x17')](_0xd645('0x16'),auth[_0xd645('0x9')](),controller['removeResources']);module[_0xd645('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 444a506..7e92f9b 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 _0x1b33=['setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','STRING'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0x1b33,0x86));var _0x31b3=function(_0x438e18,_0x52e2c5){_0x438e18=_0x438e18-0x0;var _0x50c6ea=_0x1b33[_0x438e18];return _0x50c6ea;};'use strict';var Sequelize=require(_0x31b3('0x0'));module['exports']={'name':{'type':Sequelize[_0x31b3('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x31b3('0x1')],'set':function(_0x4d76c3){this[_0x31b3('0x2')](_0x31b3('0x3'),_0x4d76c3?_0x4d76c3[_0x31b3('0x4')](''):[]);},'get':function(){return this[_0x31b3('0x5')](_0x31b3('0x3'))?this[_0x31b3('0x5')]('crudPermissions')[_0x31b3('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x31b3('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x31b3('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x31b3('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x31b3('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x31b3('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x31b3('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x31b3('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x31b3('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe4d3=['name','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0xfe328a,_0x40602a){var _0x54d9a4=function(_0x591e40){while(--_0x591e40){_0xfe328a['push'](_0xfe328a['shift']());}};_0x54d9a4(++_0x40602a);}(_0xe4d3,0xf9));var _0x3e4d=function(_0x3b267c,_0x486799){_0x3b267c=_0x3b267c-0x0;var _0x5ac422=_0xe4d3[_0x3b267c];return _0x5ac422;};'use strict';var Sequelize=require(_0x3e4d('0x0'));module[_0x3e4d('0x1')]={'name':{'type':Sequelize[_0x3e4d('0x2')],'allowNull':![],'unique':_0x3e4d('0x3')},'crudPermissions':{'type':Sequelize[_0x3e4d('0x2')],'set':function(_0x32acb9){this['setDataValue'](_0x3e4d('0x4'),_0x32acb9?_0x32acb9[_0x3e4d('0x5')](''):[]);},'get':function(){return this[_0x3e4d('0x6')](_0x3e4d('0x4'))?this['getDataValue'](_0x3e4d('0x4'))[_0x3e4d('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x3e4d('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x3e4d('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x3e4d('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x3e4d('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x3e4d('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x3e4d('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index c2cc1e5..4d4ed41 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 _0x65cb=['keys','length','includeAll','options','find','create','body','params','get','createdAt','updatedAt','omit','sequelize','transaction','UserProfileSection','each','sectionId','Resources','UserProfileResource','describe','addSections','destroy','userProfileId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','autoAssociation','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','UserProfile','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show'];(function(_0x25408e,_0x457e2d){var _0xd3099d=function(_0x44fe35){while(--_0x44fe35){_0x25408e['push'](_0x25408e['shift']());}};_0xd3099d(++_0x457e2d);}(_0x65cb,0xa4));var _0xb65c=function(_0x5d7dfc,_0xd984be){_0x5d7dfc=_0x5d7dfc-0x0;var _0x311c7a=_0x65cb[_0x5d7dfc];return _0x311c7a;};'use strict';var emlformat=require(_0xb65c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb65c('0x1'));var jsonpatch=require(_0xb65c('0x2'));var rp=require(_0xb65c('0x3'));var moment=require('moment');var BPromise=require(_0xb65c('0x4'));var Mustache=require(_0xb65c('0x5'));var util=require(_0xb65c('0x6'));var path=require(_0xb65c('0x7'));var sox=require(_0xb65c('0x8'));var csv=require('to-csv');var ejs=require(_0xb65c('0x9'));var fs=require('fs');var fs_extra=require(_0xb65c('0xa'));var _=require(_0xb65c('0xb'));var squel=require(_0xb65c('0xc'));var crypto=require(_0xb65c('0xd'));var jsforce=require(_0xb65c('0xe'));var deskjs=require(_0xb65c('0xf'));var toCsv=require(_0xb65c('0x10'));var querystring=require('querystring');var Papa=require(_0xb65c('0x11'));var Redis=require(_0xb65c('0x12'));var authService=require(_0xb65c('0x13'));var qs=require(_0xb65c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb65c('0x15'));var logger=require('../../config/logger')(_0xb65c('0x16'));var utils=require(_0xb65c('0x17'));var config=require(_0xb65c('0x18'));var licenseUtil=require(_0xb65c('0x19'));var db=require(_0xb65c('0x1a'))['db'];config[_0xb65c('0x1b')]=_['defaults'](config[_0xb65c('0x1b')],{'host':_0xb65c('0x1c'),'port':0x18eb});var socket=require(_0xb65c('0x1d'))(new Redis(config[_0xb65c('0x1b')]));require(_0xb65c('0x1e'))[_0xb65c('0x1f')](socket);function respondWithStatusCode(_0x2821e2,_0x48c337){_0x48c337=_0x48c337||0xcc;return function(_0x3bd91d){if(_0x3bd91d){return _0x2821e2[_0xb65c('0x20')](_0x48c337);}return _0x2821e2['status'](_0x48c337)[_0xb65c('0x21')]();};}function respondWithResult(_0x5c6d66,_0x32f4b5){_0x32f4b5=_0x32f4b5||0xc8;return function(_0x20b28e){if(_0x20b28e){return _0x5c6d66[_0xb65c('0x22')](_0x32f4b5)[_0xb65c('0x23')](_0x20b28e);}};}function respondWithFilteredResult(_0x24c1e2,_0x396eb2){return function(_0x1bca9d){if(_0x1bca9d){var _0x203c7b=typeof _0x396eb2[_0xb65c('0x24')]===_0xb65c('0x25')&&typeof _0x396eb2[_0xb65c('0x26')]===_0xb65c('0x25');var _0x2fe603=_0x1bca9d[_0xb65c('0x27')];var _0x1d36f9=_0x203c7b?0x0:_0x396eb2['offset'];var _0x2d54fc=_0x203c7b?_0x1bca9d[_0xb65c('0x27')]:_0x396eb2[_0xb65c('0x24')]+_0x396eb2[_0xb65c('0x26')];var _0x37b944;if(_0x2d54fc>=_0x2fe603){_0x2d54fc=_0x2fe603;_0x37b944=0xc8;}else{_0x37b944=0xce;}_0x24c1e2[_0xb65c('0x22')](_0x37b944);return _0x24c1e2[_0xb65c('0x28')](_0xb65c('0x29'),_0x1d36f9+'-'+_0x2d54fc+'/'+_0x2fe603)[_0xb65c('0x23')](_0x1bca9d);}return null;};}function patchUpdates(_0x33fa4c){return function(_0x1730ad){try{jsonpatch[_0xb65c('0x2a')](_0x1730ad,_0x33fa4c,!![]);}catch(_0xd04d5){return BPromise[_0xb65c('0x2b')](_0xd04d5);}return _0x1730ad[_0xb65c('0x2c')]();};}function saveUpdates(_0x5ed03,_0x108eb9){return function(_0x4ad9e4){if(_0x4ad9e4){return _0x4ad9e4[_0xb65c('0x2d')](_0x5ed03)[_0xb65c('0x2e')](function(_0x29c0c0){return _0x29c0c0;});}return null;};}function removeEntity(_0x585f93,_0x1b7e00){return function(_0x4c5627){if(_0x4c5627){return _0x4c5627['destroy']()['then'](function(){_0x585f93[_0xb65c('0x22')](0xcc)[_0xb65c('0x21')]();});}};}function handleEntityNotFound(_0xeb8e29,_0xc65b5a){return function(_0x4a9b0c){if(!_0x4a9b0c){_0xeb8e29[_0xb65c('0x20')](0x194);}return _0x4a9b0c;};}function handleError(_0x186f32,_0x3e372d){_0x3e372d=_0x3e372d||0x1f4;return function(_0x21cb9c){logger[_0xb65c('0x2f')](_0x21cb9c[_0xb65c('0x30')]);if(_0x21cb9c['name']){delete _0x21cb9c[_0xb65c('0x31')];}_0x186f32[_0xb65c('0x22')](_0x3e372d)[_0xb65c('0x32')](_0x21cb9c);};}exports['index']=function(_0x44fe3b,_0x5f5ca7){var _0x393320={},_0x1284cd={},_0x48eb26={'count':0x0,'rows':[]};var _0x123cf4=_[_0xb65c('0x33')](db[_0xb65c('0x34')][_0xb65c('0x35')],function(_0x1b3240){return{'name':_0x1b3240[_0xb65c('0x36')],'type':_0x1b3240[_0xb65c('0x37')][_0xb65c('0x38')]};});_0x1284cd['model']=_[_0xb65c('0x33')](_0x123cf4,_0xb65c('0x31'));_0x1284cd[_0xb65c('0x39')]=_['keys'](_0x44fe3b['query']);_0x1284cd[_0xb65c('0x3a')]=_['intersection'](_0x1284cd[_0xb65c('0x3b')],_0x1284cd['query']);_0x393320[_0xb65c('0x3c')]=_[_0xb65c('0x3d')](_0x1284cd[_0xb65c('0x3b')],qs[_0xb65c('0x3e')](_0x44fe3b['query'][_0xb65c('0x3e')]));_0x393320['attributes']=_0x393320[_0xb65c('0x3c')]['length']?_0x393320[_0xb65c('0x3c')]:_0x1284cd[_0xb65c('0x3b')];if(!_0x44fe3b[_0xb65c('0x39')][_0xb65c('0x3f')]('nolimit')){_0x393320[_0xb65c('0x26')]=qs[_0xb65c('0x26')](_0x44fe3b[_0xb65c('0x39')]['limit']);_0x393320[_0xb65c('0x24')]=qs[_0xb65c('0x24')](_0x44fe3b['query']['offset']);}_0x393320[_0xb65c('0x40')]=qs[_0xb65c('0x41')](_0x44fe3b[_0xb65c('0x39')][_0xb65c('0x41')]);_0x393320['where']=qs[_0xb65c('0x3a')](_[_0xb65c('0x42')](_0x44fe3b[_0xb65c('0x39')],_0x1284cd[_0xb65c('0x3a')]),_0x123cf4);if(_0x44fe3b['query'][_0xb65c('0x43')]){_0x393320[_0xb65c('0x44')]=_[_0xb65c('0x45')](_0x393320[_0xb65c('0x44')],{'$or':_[_0xb65c('0x33')](_0x123cf4,function(_0x12a8c0){if(_0x12a8c0[_0xb65c('0x37')]!==_0xb65c('0x46')){var _0xc83cb3={};_0xc83cb3[_0x12a8c0[_0xb65c('0x31')]]={'$like':'%'+_0x44fe3b[_0xb65c('0x39')][_0xb65c('0x43')]+'%'};return _0xc83cb3;}})});}_0x393320=_[_0xb65c('0x45')]({},_0x393320,_0x44fe3b['options']);var _0x4c9bd9={'where':_0x393320[_0xb65c('0x44')]};return db[_0xb65c('0x34')][_0xb65c('0x27')](_0x4c9bd9)['then'](function(_0x42acd6){_0x48eb26[_0xb65c('0x27')]=_0x42acd6;if(_0x44fe3b['query']['includeAll']){_0x393320[_0xb65c('0x47')]=[{'all':!![]}];}return db[_0xb65c('0x34')][_0xb65c('0x48')](_0x393320);})[_0xb65c('0x2e')](function(_0x199625){_0x48eb26[_0xb65c('0x49')]=_0x199625;return _0x48eb26;})['then'](respondWithFilteredResult(_0x5f5ca7,_0x393320))[_0xb65c('0x4a')](handleError(_0x5f5ca7,null));};exports[_0xb65c('0x4b')]=function(_0x2a384d,_0x8300c2){var _0x3851fa={'raw':![],'where':{'id':_0x2a384d['params']['id']}},_0x169b7f={};_0x169b7f[_0xb65c('0x3b')]=_[_0xb65c('0x4c')](db[_0xb65c('0x34')][_0xb65c('0x35')]);_0x169b7f[_0xb65c('0x39')]=_['keys'](_0x2a384d[_0xb65c('0x39')]);_0x169b7f[_0xb65c('0x3a')]=_[_0xb65c('0x3d')](_0x169b7f[_0xb65c('0x3b')],_0x169b7f[_0xb65c('0x39')]);_0x3851fa['attributes']=_['intersection'](_0x169b7f[_0xb65c('0x3b')],qs[_0xb65c('0x3e')](_0x2a384d[_0xb65c('0x39')][_0xb65c('0x3e')]));_0x3851fa['attributes']=_0x3851fa[_0xb65c('0x3c')][_0xb65c('0x4d')]?_0x3851fa['attributes']:_0x169b7f[_0xb65c('0x3b')];if(_0x2a384d['query'][_0xb65c('0x4e')]){_0x3851fa[_0xb65c('0x47')]=[{'all':!![]}];}_0x3851fa=_[_0xb65c('0x45')]({},_0x3851fa,_0x2a384d[_0xb65c('0x4f')]);return db['UserProfile'][_0xb65c('0x50')](_0x3851fa)[_0xb65c('0x2e')](handleEntityNotFound(_0x8300c2,null))[_0xb65c('0x2e')](respondWithResult(_0x8300c2,null))[_0xb65c('0x4a')](handleError(_0x8300c2,null));};exports[_0xb65c('0x51')]=function(_0x5e81e2,_0x481d4d){return db[_0xb65c('0x34')][_0xb65c('0x51')](_0x5e81e2[_0xb65c('0x52')],{})['then'](respondWithResult(_0x481d4d,0xc9))[_0xb65c('0x4a')](handleError(_0x481d4d,null));};exports['clone']=function(_0x2ca61f,_0x488f34){var _0x489eb3={'where':{'id':_0x2ca61f[_0xb65c('0x53')]['id']}},_0x50f16d={};_0x50f16d['model']=_['keys'](db[_0xb65c('0x34')][_0xb65c('0x35')]);_0x489eb3[_0xb65c('0x3c')]=_[_0xb65c('0x3d')](_0x50f16d[_0xb65c('0x3b')],qs[_0xb65c('0x3e')](_0x2ca61f['query']['fields']));_0x489eb3[_0xb65c('0x3c')]=_0x489eb3[_0xb65c('0x3c')]['length']?_0x489eb3[_0xb65c('0x3c')]:_0x50f16d[_0xb65c('0x3b')];if(_0x2ca61f[_0xb65c('0x39')]['includeAll']){_0x489eb3[_0xb65c('0x47')]=[{'all':!![]}];}_0x489eb3=_['merge']({},_0x489eb3,_0x2ca61f[_0xb65c('0x4f')]);return db[_0xb65c('0x34')][_0xb65c('0x50')](_0x489eb3)['then'](handleEntityNotFound(_0x488f34,null))['then'](function(_0x852886){if(_0x852886){var _0x1d3664=_0x852886[_0xb65c('0x54')]({'plain':!![]});_0x1d3664=qs['omit'](_0x1d3664,['id',_0xb65c('0x55'),_0xb65c('0x56'),'crudPermissions']);_0x2ca61f[_0xb65c('0x52')]=_[_0xb65c('0x57')](_0x2ca61f['body'],['id',_0xb65c('0x55'),_0xb65c('0x56')]);return db[_0xb65c('0x58')][_0xb65c('0x59')](function(_0x4f3af4){return db[_0xb65c('0x34')]['create'](_['merge'](_0x1d3664,_0x2ca61f[_0xb65c('0x52')]),{'include':_0x2ca61f[_0xb65c('0x39')][_0xb65c('0x4e')]?[{'all':!![]}]:undefined,'transaction':_0x4f3af4})[_0xb65c('0x2e')](function(_0x2677ad){var _0x3585d7=_0x2677ad[_0xb65c('0x54')]({'plain':!![]});return db[_0xb65c('0x5a')][_0xb65c('0x48')]({'where':{'userProfileId':_0x2ca61f['params']['id']},'raw':!![]})[_0xb65c('0x2e')](function(_0x584c2c){if(_0x584c2c){return BPromise[_0xb65c('0x5b')](_0x584c2c,function(_0x39fa16){return new BPromise(function(_0x866214,_0x76a3bd){if(_0x39fa16['autoAssociation']===null||_0x39fa16['autoAssociation']===0x1)_0x866214(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x39fa16['id']},'raw':!![]})[_0xb65c('0x2e')](function(_0x53605d){var _0x56727b=_['map'](_0x53605d,function(_0x3843de){return qs[_0xb65c('0x57')](_0x3843de,['id','createdAt',_0xb65c('0x56'),_0xb65c('0x5c')]);});_0x866214(_0x56727b);})['catch'](function(_0x48004c){_0x76a3bd(_0x48004c);});})[_0xb65c('0x2e')](function(_0x2634ab){var _0x4214ce=qs[_0xb65c('0x57')](_0x39fa16,['id','createdAt',_0xb65c('0x56')]);_0x4214ce['userProfileId']=_0x3585d7['id'];if(_0x2634ab)_0x4214ce[_0xb65c('0x5d')]=_0x2634ab;return _0x4214ce;})['then'](function(_0x359162){return db['UserProfileSection'][_0xb65c('0x51')](_0x359162,{'include':[{'model':db[_0xb65c('0x5e')],'as':_0xb65c('0x5d')}],'raw':!![],'transaction':_0x4f3af4});});})[_0xb65c('0x2e')](function(){return _0x3585d7;});}});});});}})[_0xb65c('0x2e')](respondWithResult(_0x488f34,0xc9))[_0xb65c('0x4a')](handleError(_0x488f34,null));};exports[_0xb65c('0x2d')]=function(_0x51e8f8,_0x4e17b2){if(_0x51e8f8[_0xb65c('0x52')]['id']){delete _0x51e8f8[_0xb65c('0x52')]['id'];}return db['UserProfile'][_0xb65c('0x50')]({'where':{'id':_0x51e8f8[_0xb65c('0x53')]['id']}})[_0xb65c('0x2e')](handleEntityNotFound(_0x4e17b2,null))['then'](saveUpdates(_0x51e8f8[_0xb65c('0x52')],null))[_0xb65c('0x2e')](respondWithResult(_0x4e17b2,null))[_0xb65c('0x4a')](handleError(_0x4e17b2,null));};exports['destroy']=function(_0x56fdee,_0x12616a){return db[_0xb65c('0x34')][_0xb65c('0x50')]({'where':{'id':_0x56fdee['params']['id']}})['then'](handleEntityNotFound(_0x12616a,null))[_0xb65c('0x2e')](removeEntity(_0x12616a,null))['catch'](handleError(_0x12616a,null));};exports[_0xb65c('0x5f')]=function(_0x619b13,_0x3dcc4b){return db[_0xb65c('0x34')][_0xb65c('0x5f')]()[_0xb65c('0x2e')](respondWithResult(_0x3dcc4b,null))[_0xb65c('0x4a')](handleError(_0x3dcc4b,null));};exports[_0xb65c('0x60')]=function(_0x5c5e55,_0x24f043){var _0x593af0=_0x5c5e55[_0xb65c('0x52')];return db[_0xb65c('0x34')][_0xb65c('0x50')]({'where':{'id':_0x5c5e55['params']['id']}})[_0xb65c('0x2e')](handleEntityNotFound(_0x24f043,null))[_0xb65c('0x2e')](function(_0x128a4e){if(_0x128a4e){return db[_0xb65c('0x58')][_0xb65c('0x59')](function(_0x683a98){return db[_0xb65c('0x5a')][_0xb65c('0x61')]({'where':{'userProfileId':_0x5c5e55[_0xb65c('0x53')]['id'],'sectionId':_['map'](_0x593af0,function(_0x3017fc){return _0x3017fc[_0xb65c('0x5c')];})},'transaction':_0x683a98})[_0xb65c('0x2e')](function(){var _0x10eaff=_[_0xb65c('0x33')](_0x593af0,function(_0x4611c5){_0x4611c5[_0xb65c('0x62')]=_0x5c5e55['params']['id'];return _0x4611c5;});var _0x4807ab=[];return BPromise[_0xb65c('0x5b')](_0x10eaff,function(_0x1c4ecf){return db['UserProfileSection'][_0xb65c('0x51')](_0x1c4ecf,{'include':[{'model':db[_0xb65c('0x5e')],'as':_0xb65c('0x5d')}],'raw':!![],'transaction':_0x683a98})[_0xb65c('0x2e')](function(_0xa78dd7){_0x4807ab[_0xb65c('0x63')](_0xa78dd7[_0xb65c('0x54')]({'plain':!![]}));});})[_0xb65c('0x2e')](function(){return _0x4807ab;});});});}})[_0xb65c('0x2e')](function(_0x4da99a){return _0x4da99a;})[_0xb65c('0x2e')](respondWithResult(_0x24f043,null))[_0xb65c('0x4a')](handleError(_0x24f043,null));};exports[_0xb65c('0x64')]=function(_0x3231c8,_0x1b7ff6){var _0x886490;return db[_0xb65c('0x34')][_0xb65c('0x50')]({'where':{'id':_0x3231c8[_0xb65c('0x53')]['id']},'attributes':['id',_0xb65c('0x31')]})['then'](handleEntityNotFound(_0x1b7ff6,null))[_0xb65c('0x2e')](function(_0x289919){if(_0x289919){_0x886490=_0x289919;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x3231c8[_0xb65c('0x53')]['id'],'sectionId':_0x3231c8[_0xb65c('0x39')][_0xb65c('0x65')]}});}})[_0xb65c('0x2e')](function(){return _0x886490;})[_0xb65c('0x2e')](respondWithStatusCode(_0x1b7ff6,null))[_0xb65c('0x4a')](handleError(_0x1b7ff6,null));};exports[_0xb65c('0x66')]=function(_0x48fcdb,_0x1228d9){var _0x158d91=[];var _0x5779ba=[];return db[_0xb65c('0x5a')][_0xb65c('0x48')]({'where':{'userProfileId':_0x48fcdb[_0xb65c('0x53')]['id']},'raw':!![]})['then'](function(_0x134248){_0x158d91=_['filter'](_0x134248,function(_0x5ee546){return _0x5ee546[_0xb65c('0x67')]===0x1||_[_0xb65c('0x68')]([0x3eb,0x709],_0x5ee546[_0xb65c('0x5c')]);});if(!_[_0xb65c('0x69')](_0x158d91)){return _[_0xb65c('0x33')](_0x158d91,function(_0x44cb52){return _0x44cb52[_0xb65c('0x5c')];});}else{return;}})['then'](function(_0x3c3b18){if(_0x3c3b18)_0x5779ba=_0x3c3b18;if(_['includes'](_0x5779ba,0x64)){var _0x306999=_[_0xb65c('0x50')](_0x158d91,{'sectionId':0x64});return hasDefaultDashboard(_0x306999)[_0xb65c('0x2e')](function(_0x997f9a){return _['map'](_0x158d91,function(_0x59f5f6){if(_0x59f5f6['sectionId']===0x64){_0x59f5f6[_0xb65c('0x6a')]=_0x997f9a;}return _0x59f5f6;});});}else{return;}})['then'](function(_0xf4eb64){if(_0xf4eb64)_0x158d91=_0xf4eb64;if(_[_0xb65c('0x68')](_0x5779ba,0x3eb)){var _0x2f8b7=_[_0xb65c('0x50')](_0x158d91,{'sectionId':0x3eb});return getCustomDashboards(_0x2f8b7)[_0xb65c('0x2e')](function(_0x1bbe90){return _[_0xb65c('0x33')](_0x158d91,function(_0x3bbfe7){if(_0x2f8b7[_0xb65c('0x67')]){if(_0x3bbfe7[_0xb65c('0x5c')]===0x3eb){_0x3bbfe7['subsections']=_0x1bbe90;}}else{if(_0x3bbfe7[_0xb65c('0x5c')]===0x64){_0x3bbfe7[_0xb65c('0x6a')]=_0x1bbe90;}}return _0x3bbfe7;});});}else{return;}})[_0xb65c('0x2e')](function(_0x398702){if(_0x398702)_0x158d91=_0x398702;if(_['includes'](_0x5779ba,0x709)){var _0x298722=_[_0xb65c('0x50')](_0x158d91,{'sectionId':0x709});return getPlugins(_0x298722)[_0xb65c('0x2e')](function(_0x318edf){if(_0x298722[_0xb65c('0x67')]){return _[_0xb65c('0x33')](_0x158d91,function(_0x14370b){if(_0x14370b[_0xb65c('0x5c')]===0x709){_0x14370b[_0xb65c('0x6a')]=_0x318edf;}return _0x14370b;});}else{var _0x113002={'sectionId':0x76c,'enabled':0x1,'subsections':_0x318edf};var _0x5b9e8d=_[_0xb65c('0x33')](_0x158d91);_0x5b9e8d[_0xb65c('0x63')](_0x113002);return _0x5b9e8d;}});}else{return;}})[_0xb65c('0x2e')](function(_0x4da2c0){if(_0x4da2c0)_0x158d91=_0x4da2c0;return _[_0xb65c('0x43')](_0x158d91,[_0xb65c('0x67'),0x1]);})[_0xb65c('0x2e')](respondWithResult(_0x1228d9,null))[_0xb65c('0x4a')](handleError(_0x1228d9,null));};function hasDefaultDashboard(_0x48f783){var _0x36be93=[0x65];return new BPromise(function(_0x128d17,_0x2e4f95){try{if(_0x48f783[_0xb65c('0x6b')]){_0x128d17(_0x36be93);}else{return db[_0xb65c('0x5e')][_0xb65c('0x6c')]({'where':{'sectionId':_0x48f783['id']},'raw':!![]})[_0xb65c('0x2e')](function(_0x3ab9c5){_0x3ab9c5?_0x128d17(_0x36be93):_0x128d17();});}}catch(_0x246a8b){_0x2e4f95(_0x246a8b);}});}function getCustomDashboards(_0x4afbb9){var _0xebb714=[];return new BPromise(function(_0xb31b06,_0x3a26e6){try{if(_0x4afbb9['autoAssociation']){return db[_0xb65c('0x6d')][_0xb65c('0x48')]({'raw':!![]})['then'](function(_0x1bca4b){_0x1bca4b[_0xb65c('0x6e')](function(_0x297efe){_0xebb714['push'](_0x297efe['id']+0x1869f);});_0xb31b06(_0xebb714);});}else{return db[_0xb65c('0x5e')]['findAll']({'where':{'sectionId':_0x4afbb9['id']},'raw':!![]})[_0xb65c('0x2e')](function(_0x1a9a26){_0x1a9a26[_0xb65c('0x6e')](function(_0x16c1f6){_0xebb714[_0xb65c('0x63')](_0x16c1f6[_0xb65c('0x6f')]+0x1869f);});_0xb31b06(_0xebb714);});}}catch(_0x37e121){_0x3a26e6(_0x37e121);}});}function getPlugins(_0x2cfc0b){var _0x33635c=[];return new BPromise(function(_0x56317c,_0x1fae00){try{if(_0x2cfc0b[_0xb65c('0x6b')]){return db[_0xb65c('0x70')][_0xb65c('0x48')]({'raw':!![]})['then'](function(_0x3f916f){_0x3f916f[_0xb65c('0x6e')](function(_0x35ef01){_0x33635c[_0xb65c('0x63')](_0x35ef01['id']+0x15b38);});_0x56317c(_0x33635c);});}else{return db['UserProfileResource'][_0xb65c('0x48')]({'where':{'sectionId':_0x2cfc0b['id']},'raw':!![]})[_0xb65c('0x2e')](function(_0x13afb6){_0x13afb6[_0xb65c('0x6e')](function(_0x560eac){_0x33635c[_0xb65c('0x63')](_0x560eac[_0xb65c('0x6f')]+0x15b38);});_0x56317c(_0x33635c);});}}catch(_0x51f2c6){_0x1fae00(_0x51f2c6);}});}exports[_0xb65c('0x71')]=function(_0x3c35ce,_0x1fc361){return db[_0xb65c('0x34')]['find']({'where':{'id':_0x3c35ce[_0xb65c('0x53')]['id']}})[_0xb65c('0x2e')](handleEntityNotFound(_0x1fc361,null))[_0xb65c('0x2e')](function(_0x1e79f5){if(_0x1e79f5){return db[_0xb65c('0x58')]['transaction'](function(_0x2c098c){return db[_0xb65c('0x5a')][_0xb65c('0x48')]({'where':{'userProfileId':_0x3c35ce[_0xb65c('0x53')]['id']},'attributes':['id'],'raw':!![]})[_0xb65c('0x2e')](function(_0x5e0970){if(_0x5e0970){return db[_0xb65c('0x5a')]['destroy']({'where':{'userProfileId':_0x3c35ce[_0xb65c('0x53')]['id'],'id':_['map'](_0x5e0970,function(_0x273495){return _0x273495['id'];})},'transaction':_0x2c098c});}})['then'](function(_0x5d506f){var _0xee82a3=_[_0xb65c('0x33')](_0x3c35ce[_0xb65c('0x52')],function(_0x164aed){_0x164aed[_0xb65c('0x62')]=_0x3c35ce[_0xb65c('0x53')]['id'];return _0x164aed;});return db[_0xb65c('0x5a')]['bulkCreate'](_0xee82a3,{'raw':!![],'transaction':_0x2c098c});})['then'](function(_0x3c63de){var _0x1f693d=_['filter'](_['map'](_0x3c63de,function(_0x53396c){return _0x53396c[_0xb65c('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x1f693d){return db[_0xb65c('0x5a')][_0xb65c('0x48')]({'where':{'userProfileId':_0x3c35ce[_0xb65c('0x53')]['id'],'sectionId':_['map'](_0x1f693d,function(_0x42b1cb){return _0x42b1cb[_0xb65c('0x5c')];})},'attributes':['id',_0xb65c('0x5c')],'raw':!![]})[_0xb65c('0x2e')](function(_0x8a1a1b){var _0x223515=_[_0xb65c('0x33')](_0x3c35ce[_0xb65c('0x52')],function(_0x2f8049){_0x2f8049[_0xb65c('0x62')]=_0x3c35ce[_0xb65c('0x53')]['id'];return _0x2f8049;});return db[_0xb65c('0x5e')][_0xb65c('0x72')](_0x223515,{'raw':!![],'transaction':_0x2c098c});});}})['catch'](handleError(_0x1fc361,null));});}})[_0xb65c('0x2e')](function(_0x2ca2a7){var _0x36726e=_[_0xb65c('0x33')](_0x2ca2a7,function(_0x2baef2){return _0x2baef2['get']({'plain':!![]});});})['then'](respondWithResult(_0x1fc361,null))[_0xb65c('0x4a')](handleError(_0x1fc361,null));};exports[_0xb65c('0x73')]=function(_0x1ddbb6,_0x179a2f,_0x47bc88){return db[_0xb65c('0x34')]['find']({'where':{'id':_0x1ddbb6[_0xb65c('0x53')]['id']}})[_0xb65c('0x2e')](handleEntityNotFound(_0x179a2f,null))['then'](function(_0xde12a8){if(_0xde12a8){return _0xde12a8['removeResources'](_0x1ddbb6[_0xb65c('0x39')]['ids']);}})[_0xb65c('0x2e')](respondWithStatusCode(_0x179a2f,null))['catch'](handleError(_0x179a2f,null));};exports[_0xb65c('0x74')]=function(_0x49a0bc,_0x3f6c2b){var _0x4ddaa5={};if(!_0x49a0bc[_0xb65c('0x39')]['section'])throw new Error(_0xb65c('0x75'));if(!_0x49a0bc[_0xb65c('0x39')][_0xb65c('0x3f')](_0xb65c('0x76'))){_0x4ddaa5[_0xb65c('0x26')]=qs[_0xb65c('0x26')](_0x49a0bc[_0xb65c('0x39')]['limit']);_0x4ddaa5[_0xb65c('0x24')]=qs[_0xb65c('0x24')](_0x49a0bc[_0xb65c('0x39')]['offset']);}return db[_0xb65c('0x34')][_0xb65c('0x50')]({'where':{'id':_0x49a0bc[_0xb65c('0x53')]['id']}})['then'](function(_0x574d34){if(!_0x574d34)throw new Error(_0xb65c('0x77')+_0x49a0bc[_0xb65c('0x53')]['id']);return db[_0xb65c('0x34')]['getResources'](_0x49a0bc);})[_0xb65c('0x2e')](respondWithFilteredResult(_0x3f6c2b,_0x4ddaa5))['catch'](handleError(_0x3f6c2b,null));}; \ No newline at end of file +var _0xdbc6=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','options','UserProfile','include','rows','catch','params','includeAll','create','body','find','omit','updatedAt','crudPermissions','createdAt','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','findAll','sectionId','userProfileId','Resources','describe','sequelize','get','removeSections','enabled','includes','isEmpty','subsections','push','findOne','resourceId','forEach','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xdbc6,0x13b));var _0x6dbc=function(_0x9302e8,_0x260fc6){_0x9302e8=_0x9302e8-0x0;var _0x4148af=_0xdbc6[_0x9302e8];return _0x4148af;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6dbc('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6dbc('0x1'));var moment=require(_0x6dbc('0x2'));var BPromise=require(_0x6dbc('0x3'));var Mustache=require(_0x6dbc('0x4'));var util=require(_0x6dbc('0x5'));var path=require(_0x6dbc('0x6'));var sox=require('sox');var csv=require(_0x6dbc('0x7'));var ejs=require(_0x6dbc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6dbc('0x9'));var squel=require(_0x6dbc('0xa'));var crypto=require(_0x6dbc('0xb'));var jsforce=require(_0x6dbc('0xc'));var deskjs=require(_0x6dbc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6dbc('0xe'));var Papa=require(_0x6dbc('0xf'));var Redis=require('ioredis');var authService=require(_0x6dbc('0x10'));var qs=require(_0x6dbc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6dbc('0x12'));var logger=require(_0x6dbc('0x13'))(_0x6dbc('0x14'));var utils=require(_0x6dbc('0x15'));var config=require(_0x6dbc('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x6dbc('0x17')]=_[_0x6dbc('0x18')](config[_0x6dbc('0x17')],{'host':_0x6dbc('0x19'),'port':0x18eb});var socket=require(_0x6dbc('0x1a'))(new Redis(config[_0x6dbc('0x17')]));require(_0x6dbc('0x1b'))[_0x6dbc('0x1c')](socket);function respondWithStatusCode(_0x297b6a,_0x5397af){_0x5397af=_0x5397af||0xcc;return function(_0x31d4ee){if(_0x31d4ee){return _0x297b6a[_0x6dbc('0x1d')](_0x5397af);}return _0x297b6a[_0x6dbc('0x1e')](_0x5397af)[_0x6dbc('0x1f')]();};}function respondWithResult(_0x25b8a8,_0x269fac){_0x269fac=_0x269fac||0xc8;return function(_0x3da417){if(_0x3da417){return _0x25b8a8[_0x6dbc('0x1e')](_0x269fac)['json'](_0x3da417);}};}function respondWithFilteredResult(_0x5a896d,_0x5ac04a){return function(_0x285ccd){if(_0x285ccd){var _0x18d95d=typeof _0x5ac04a[_0x6dbc('0x20')]===_0x6dbc('0x21')&&typeof _0x5ac04a[_0x6dbc('0x22')]==='undefined';var _0x44435c=_0x285ccd[_0x6dbc('0x23')];var _0xb270df=_0x18d95d?0x0:_0x5ac04a[_0x6dbc('0x20')];var _0x357ad1=_0x18d95d?_0x285ccd[_0x6dbc('0x23')]:_0x5ac04a[_0x6dbc('0x20')]+_0x5ac04a[_0x6dbc('0x22')];var _0x9edc7a;if(_0x357ad1>=_0x44435c){_0x357ad1=_0x44435c;_0x9edc7a=0xc8;}else{_0x9edc7a=0xce;}_0x5a896d[_0x6dbc('0x1e')](_0x9edc7a);return _0x5a896d[_0x6dbc('0x24')]('Content-Range',_0xb270df+'-'+_0x357ad1+'/'+_0x44435c)[_0x6dbc('0x25')](_0x285ccd);}return null;};}function patchUpdates(_0x2a1d0d){return function(_0x3306d0){try{jsonpatch['apply'](_0x3306d0,_0x2a1d0d,!![]);}catch(_0x1b8e84){return BPromise['reject'](_0x1b8e84);}return _0x3306d0[_0x6dbc('0x26')]();};}function saveUpdates(_0x3f290e,_0x15ac30){return function(_0x5390b9){if(_0x5390b9){return _0x5390b9[_0x6dbc('0x27')](_0x3f290e)[_0x6dbc('0x28')](function(_0x2be03c){return _0x2be03c;});}return null;};}function removeEntity(_0x8cc556,_0xd6dd78){return function(_0x3c7fdb){if(_0x3c7fdb){return _0x3c7fdb[_0x6dbc('0x29')]()[_0x6dbc('0x28')](function(){_0x8cc556['status'](0xcc)[_0x6dbc('0x1f')]();});}};}function handleEntityNotFound(_0xe10b16,_0x455f29){return function(_0x8a24fd){if(!_0x8a24fd){_0xe10b16[_0x6dbc('0x1d')](0x194);}return _0x8a24fd;};}function handleError(_0x224533,_0x1336d4){_0x1336d4=_0x1336d4||0x1f4;return function(_0x235e00){logger[_0x6dbc('0x2a')](_0x235e00['stack']);if(_0x235e00[_0x6dbc('0x2b')]){delete _0x235e00[_0x6dbc('0x2b')];}_0x224533[_0x6dbc('0x1e')](_0x1336d4)[_0x6dbc('0x2c')](_0x235e00);};}exports[_0x6dbc('0x2d')]=function(_0x491a19,_0x3e2788){var _0x30cefd={},_0x2e2be2={},_0x165f76={'count':0x0,'rows':[]};var _0x2b706a=_[_0x6dbc('0x2e')](db['UserProfile'][_0x6dbc('0x2f')],function(_0x1367b2){return{'name':_0x1367b2[_0x6dbc('0x30')],'type':_0x1367b2[_0x6dbc('0x31')][_0x6dbc('0x32')]};});_0x2e2be2[_0x6dbc('0x33')]=_[_0x6dbc('0x2e')](_0x2b706a,_0x6dbc('0x2b'));_0x2e2be2[_0x6dbc('0x34')]=_[_0x6dbc('0x35')](_0x491a19[_0x6dbc('0x34')]);_0x2e2be2[_0x6dbc('0x36')]=_[_0x6dbc('0x37')](_0x2e2be2[_0x6dbc('0x33')],_0x2e2be2[_0x6dbc('0x34')]);_0x30cefd[_0x6dbc('0x38')]=_[_0x6dbc('0x37')](_0x2e2be2[_0x6dbc('0x33')],qs[_0x6dbc('0x39')](_0x491a19[_0x6dbc('0x34')][_0x6dbc('0x39')]));_0x30cefd[_0x6dbc('0x38')]=_0x30cefd[_0x6dbc('0x38')][_0x6dbc('0x3a')]?_0x30cefd[_0x6dbc('0x38')]:_0x2e2be2[_0x6dbc('0x33')];if(!_0x491a19['query']['hasOwnProperty'](_0x6dbc('0x3b'))){_0x30cefd[_0x6dbc('0x22')]=qs[_0x6dbc('0x22')](_0x491a19['query'][_0x6dbc('0x22')]);_0x30cefd['offset']=qs['offset'](_0x491a19[_0x6dbc('0x34')][_0x6dbc('0x20')]);}_0x30cefd['order']=qs[_0x6dbc('0x3c')](_0x491a19[_0x6dbc('0x34')][_0x6dbc('0x3c')]);_0x30cefd[_0x6dbc('0x3d')]=qs[_0x6dbc('0x36')](_['pick'](_0x491a19[_0x6dbc('0x34')],_0x2e2be2['filters']),_0x2b706a);if(_0x491a19[_0x6dbc('0x34')][_0x6dbc('0x3e')]){_0x30cefd['where']=_[_0x6dbc('0x3f')](_0x30cefd[_0x6dbc('0x3d')],{'$or':_[_0x6dbc('0x2e')](_0x2b706a,function(_0x12ab6e){if(_0x12ab6e[_0x6dbc('0x31')]!=='VIRTUAL'){var _0x894e9e={};_0x894e9e[_0x12ab6e['name']]={'$like':'%'+_0x491a19['query']['filter']+'%'};return _0x894e9e;}})});}_0x30cefd=_[_0x6dbc('0x3f')]({},_0x30cefd,_0x491a19[_0x6dbc('0x40')]);var _0x3f4acd={'where':_0x30cefd[_0x6dbc('0x3d')]};return db[_0x6dbc('0x41')][_0x6dbc('0x23')](_0x3f4acd)[_0x6dbc('0x28')](function(_0x39df60){_0x165f76[_0x6dbc('0x23')]=_0x39df60;if(_0x491a19[_0x6dbc('0x34')]['includeAll']){_0x30cefd[_0x6dbc('0x42')]=[{'all':!![]}];}return db[_0x6dbc('0x41')]['findAll'](_0x30cefd);})[_0x6dbc('0x28')](function(_0x39adea){_0x165f76[_0x6dbc('0x43')]=_0x39adea;return _0x165f76;})[_0x6dbc('0x28')](respondWithFilteredResult(_0x3e2788,_0x30cefd))[_0x6dbc('0x44')](handleError(_0x3e2788,null));};exports['show']=function(_0x3ad943,_0x36a37f){var _0x25a407={'raw':![],'where':{'id':_0x3ad943[_0x6dbc('0x45')]['id']}},_0x3be5e5={};_0x3be5e5[_0x6dbc('0x33')]=_[_0x6dbc('0x35')](db['UserProfile'][_0x6dbc('0x2f')]);_0x3be5e5['query']=_[_0x6dbc('0x35')](_0x3ad943[_0x6dbc('0x34')]);_0x3be5e5[_0x6dbc('0x36')]=_[_0x6dbc('0x37')](_0x3be5e5[_0x6dbc('0x33')],_0x3be5e5[_0x6dbc('0x34')]);_0x25a407[_0x6dbc('0x38')]=_[_0x6dbc('0x37')](_0x3be5e5[_0x6dbc('0x33')],qs['fields'](_0x3ad943[_0x6dbc('0x34')][_0x6dbc('0x39')]));_0x25a407[_0x6dbc('0x38')]=_0x25a407[_0x6dbc('0x38')]['length']?_0x25a407['attributes']:_0x3be5e5[_0x6dbc('0x33')];if(_0x3ad943['query'][_0x6dbc('0x46')]){_0x25a407[_0x6dbc('0x42')]=[{'all':!![]}];}_0x25a407=_[_0x6dbc('0x3f')]({},_0x25a407,_0x3ad943[_0x6dbc('0x40')]);return db[_0x6dbc('0x41')]['find'](_0x25a407)[_0x6dbc('0x28')](handleEntityNotFound(_0x36a37f,null))[_0x6dbc('0x28')](respondWithResult(_0x36a37f,null))[_0x6dbc('0x44')](handleError(_0x36a37f,null));};exports['create']=function(_0x427210,_0x82ea74){return db['UserProfile'][_0x6dbc('0x47')](_0x427210[_0x6dbc('0x48')],{})[_0x6dbc('0x28')](respondWithResult(_0x82ea74,0xc9))['catch'](handleError(_0x82ea74,null));};exports['clone']=function(_0x53e422,_0x534f2c){var _0x8035fa={'where':{'id':_0x53e422[_0x6dbc('0x45')]['id']}},_0x441ea7={};_0x441ea7['model']=_[_0x6dbc('0x35')](db[_0x6dbc('0x41')][_0x6dbc('0x2f')]);_0x8035fa['attributes']=_['intersection'](_0x441ea7[_0x6dbc('0x33')],qs[_0x6dbc('0x39')](_0x53e422[_0x6dbc('0x34')][_0x6dbc('0x39')]));_0x8035fa[_0x6dbc('0x38')]=_0x8035fa['attributes'][_0x6dbc('0x3a')]?_0x8035fa[_0x6dbc('0x38')]:_0x441ea7['model'];if(_0x53e422[_0x6dbc('0x34')][_0x6dbc('0x46')]){_0x8035fa['include']=[{'all':!![]}];}_0x8035fa=_[_0x6dbc('0x3f')]({},_0x8035fa,_0x53e422[_0x6dbc('0x40')]);return db['UserProfile'][_0x6dbc('0x49')](_0x8035fa)[_0x6dbc('0x28')](handleEntityNotFound(_0x534f2c,null))[_0x6dbc('0x28')](function(_0x2907e5){if(_0x2907e5){var _0x5143ef=_0x2907e5['get']({'plain':!![]});_0x5143ef=qs[_0x6dbc('0x4a')](_0x5143ef,['id','createdAt',_0x6dbc('0x4b'),_0x6dbc('0x4c')]);_0x53e422[_0x6dbc('0x48')]=_[_0x6dbc('0x4a')](_0x53e422[_0x6dbc('0x48')],['id',_0x6dbc('0x4d'),_0x6dbc('0x4b')]);return db['sequelize'][_0x6dbc('0x4e')](function(_0x2413e8){return db[_0x6dbc('0x41')][_0x6dbc('0x47')](_[_0x6dbc('0x3f')](_0x5143ef,_0x53e422[_0x6dbc('0x48')]),{'include':_0x53e422[_0x6dbc('0x34')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2413e8})[_0x6dbc('0x28')](function(_0x2cce4c){var _0x48218a=_0x2cce4c['get']({'plain':!![]});return db[_0x6dbc('0x4f')]['findAll']({'where':{'userProfileId':_0x53e422[_0x6dbc('0x45')]['id']},'raw':!![]})[_0x6dbc('0x28')](function(_0x510f47){if(_0x510f47){return BPromise[_0x6dbc('0x50')](_0x510f47,function(_0x1dd723){return new BPromise(function(_0x114055,_0x4b71a0){if(_0x1dd723[_0x6dbc('0x51')]===null||_0x1dd723[_0x6dbc('0x51')]===0x1)_0x114055(null);return db[_0x6dbc('0x52')][_0x6dbc('0x53')]({'where':{'sectionId':_0x1dd723['id']},'raw':!![]})['then'](function(_0x280562){var _0x5ec883=_[_0x6dbc('0x2e')](_0x280562,function(_0xce1d40){return qs[_0x6dbc('0x4a')](_0xce1d40,['id',_0x6dbc('0x4d'),_0x6dbc('0x4b'),_0x6dbc('0x54')]);});_0x114055(_0x5ec883);})[_0x6dbc('0x44')](function(_0x68fb91){_0x4b71a0(_0x68fb91);});})[_0x6dbc('0x28')](function(_0x13775f){var _0x4a3fde=qs[_0x6dbc('0x4a')](_0x1dd723,['id',_0x6dbc('0x4d'),_0x6dbc('0x4b')]);_0x4a3fde[_0x6dbc('0x55')]=_0x48218a['id'];if(_0x13775f)_0x4a3fde[_0x6dbc('0x56')]=_0x13775f;return _0x4a3fde;})[_0x6dbc('0x28')](function(_0xdfec1b){return db[_0x6dbc('0x4f')][_0x6dbc('0x47')](_0xdfec1b,{'include':[{'model':db[_0x6dbc('0x52')],'as':_0x6dbc('0x56')}],'raw':!![],'transaction':_0x2413e8});});})[_0x6dbc('0x28')](function(){return _0x48218a;});}});});});}})[_0x6dbc('0x28')](respondWithResult(_0x534f2c,0xc9))['catch'](handleError(_0x534f2c,null));};exports[_0x6dbc('0x27')]=function(_0x108e81,_0x5b26bf){if(_0x108e81['body']['id']){delete _0x108e81[_0x6dbc('0x48')]['id'];}return db[_0x6dbc('0x41')][_0x6dbc('0x49')]({'where':{'id':_0x108e81[_0x6dbc('0x45')]['id']}})[_0x6dbc('0x28')](handleEntityNotFound(_0x5b26bf,null))[_0x6dbc('0x28')](saveUpdates(_0x108e81[_0x6dbc('0x48')],null))['then'](respondWithResult(_0x5b26bf,null))['catch'](handleError(_0x5b26bf,null));};exports[_0x6dbc('0x29')]=function(_0x56bab8,_0x5b3317){return db[_0x6dbc('0x41')]['find']({'where':{'id':_0x56bab8[_0x6dbc('0x45')]['id']}})[_0x6dbc('0x28')](handleEntityNotFound(_0x5b3317,null))[_0x6dbc('0x28')](removeEntity(_0x5b3317,null))[_0x6dbc('0x44')](handleError(_0x5b3317,null));};exports[_0x6dbc('0x57')]=function(_0x3b2b6d,_0xdb4a31){return db['UserProfile'][_0x6dbc('0x57')]()[_0x6dbc('0x28')](respondWithResult(_0xdb4a31,null))['catch'](handleError(_0xdb4a31,null));};exports['addSections']=function(_0x370034,_0x19948b){var _0x524370=_0x370034['body'];return db[_0x6dbc('0x41')][_0x6dbc('0x49')]({'where':{'id':_0x370034[_0x6dbc('0x45')]['id']}})[_0x6dbc('0x28')](handleEntityNotFound(_0x19948b,null))[_0x6dbc('0x28')](function(_0x4c3f50){if(_0x4c3f50){return db[_0x6dbc('0x58')]['transaction'](function(_0x1e888a){return db['UserProfileSection'][_0x6dbc('0x29')]({'where':{'userProfileId':_0x370034[_0x6dbc('0x45')]['id'],'sectionId':_[_0x6dbc('0x2e')](_0x524370,function(_0x5b767c){return _0x5b767c[_0x6dbc('0x54')];})},'transaction':_0x1e888a})[_0x6dbc('0x28')](function(){var _0x5e2a91=_['map'](_0x524370,function(_0x4628f5){_0x4628f5[_0x6dbc('0x55')]=_0x370034['params']['id'];return _0x4628f5;});var _0x1e2eb6=[];return BPromise[_0x6dbc('0x50')](_0x5e2a91,function(_0x36395a){return db[_0x6dbc('0x4f')][_0x6dbc('0x47')](_0x36395a,{'include':[{'model':db[_0x6dbc('0x52')],'as':_0x6dbc('0x56')}],'raw':!![],'transaction':_0x1e888a})[_0x6dbc('0x28')](function(_0x2669d1){_0x1e2eb6['push'](_0x2669d1[_0x6dbc('0x59')]({'plain':!![]}));});})[_0x6dbc('0x28')](function(){return _0x1e2eb6;});});});}})[_0x6dbc('0x28')](function(_0x40d53e){return _0x40d53e;})[_0x6dbc('0x28')](respondWithResult(_0x19948b,null))[_0x6dbc('0x44')](handleError(_0x19948b,null));};exports[_0x6dbc('0x5a')]=function(_0x33b29b,_0x39bc9a){var _0x231dc2;return db['UserProfile'][_0x6dbc('0x49')]({'where':{'id':_0x33b29b[_0x6dbc('0x45')]['id']},'attributes':['id',_0x6dbc('0x2b')]})[_0x6dbc('0x28')](handleEntityNotFound(_0x39bc9a,null))[_0x6dbc('0x28')](function(_0x36c432){if(_0x36c432){_0x231dc2=_0x36c432;return db[_0x6dbc('0x4f')][_0x6dbc('0x29')]({'where':{'userProfileId':_0x33b29b[_0x6dbc('0x45')]['id'],'sectionId':_0x33b29b[_0x6dbc('0x34')]['ids']}});}})[_0x6dbc('0x28')](function(){return _0x231dc2;})[_0x6dbc('0x28')](respondWithStatusCode(_0x39bc9a,null))[_0x6dbc('0x44')](handleError(_0x39bc9a,null));};exports['getSections']=function(_0x303ca9,_0x29a399){var _0x461179=[];var _0x1b61c1=[];return db[_0x6dbc('0x4f')][_0x6dbc('0x53')]({'where':{'userProfileId':_0x303ca9[_0x6dbc('0x45')]['id']},'raw':!![]})[_0x6dbc('0x28')](function(_0x4bbfa7){_0x461179=_['filter'](_0x4bbfa7,function(_0x585c2d){return _0x585c2d[_0x6dbc('0x5b')]===0x1||_[_0x6dbc('0x5c')]([0x3eb,0x709],_0x585c2d['sectionId']);});if(!_[_0x6dbc('0x5d')](_0x461179)){return _[_0x6dbc('0x2e')](_0x461179,function(_0x371d85){return _0x371d85[_0x6dbc('0x54')];});}else{return;}})[_0x6dbc('0x28')](function(_0x4d3609){if(_0x4d3609)_0x1b61c1=_0x4d3609;if(_['includes'](_0x1b61c1,0x64)){var _0x3395bb=_[_0x6dbc('0x49')](_0x461179,{'sectionId':0x64});return hasDefaultDashboard(_0x3395bb)[_0x6dbc('0x28')](function(_0x3068b6){return _[_0x6dbc('0x2e')](_0x461179,function(_0x4be16b){if(_0x4be16b[_0x6dbc('0x54')]===0x64){_0x4be16b[_0x6dbc('0x5e')]=_0x3068b6;}return _0x4be16b;});});}else{return;}})[_0x6dbc('0x28')](function(_0x144b2c){if(_0x144b2c)_0x461179=_0x144b2c;if(_['includes'](_0x1b61c1,0x3eb)){var _0x344ff8=_[_0x6dbc('0x49')](_0x461179,{'sectionId':0x3eb});return getCustomDashboards(_0x344ff8)[_0x6dbc('0x28')](function(_0x1ec3f4){return _['map'](_0x461179,function(_0x441ff8){if(_0x344ff8[_0x6dbc('0x5b')]){if(_0x441ff8[_0x6dbc('0x54')]===0x3eb){_0x441ff8[_0x6dbc('0x5e')]=_0x1ec3f4;}}else{if(_0x441ff8['sectionId']===0x64){_0x441ff8['subsections']=_0x1ec3f4;}}return _0x441ff8;});});}else{return;}})['then'](function(_0x3dede2){if(_0x3dede2)_0x461179=_0x3dede2;if(_[_0x6dbc('0x5c')](_0x1b61c1,0x709)){var _0x49f75d=_[_0x6dbc('0x49')](_0x461179,{'sectionId':0x709});return getPlugins(_0x49f75d)['then'](function(_0x366054){if(_0x49f75d[_0x6dbc('0x5b')]){return _[_0x6dbc('0x2e')](_0x461179,function(_0x4c721e){if(_0x4c721e[_0x6dbc('0x54')]===0x709){_0x4c721e[_0x6dbc('0x5e')]=_0x366054;}return _0x4c721e;});}else{var _0x50aee4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x366054};var _0x50721a=_[_0x6dbc('0x2e')](_0x461179);_0x50721a[_0x6dbc('0x5f')](_0x50aee4);return _0x50721a;}});}else{return;}})[_0x6dbc('0x28')](function(_0x118b97){if(_0x118b97)_0x461179=_0x118b97;return _[_0x6dbc('0x3e')](_0x461179,[_0x6dbc('0x5b'),0x1]);})[_0x6dbc('0x28')](respondWithResult(_0x29a399,null))[_0x6dbc('0x44')](handleError(_0x29a399,null));};function hasDefaultDashboard(_0x379f6e){var _0x3086ef=[0x65];return new BPromise(function(_0x1e7586,_0x12dabd){try{if(_0x379f6e['autoAssociation']){_0x1e7586(_0x3086ef);}else{return db[_0x6dbc('0x52')][_0x6dbc('0x60')]({'where':{'sectionId':_0x379f6e['id']},'raw':!![]})[_0x6dbc('0x28')](function(_0x265c32){_0x265c32?_0x1e7586(_0x3086ef):_0x1e7586();});}}catch(_0x54f35f){_0x12dabd(_0x54f35f);}});}function getCustomDashboards(_0x41c833){var _0x49c52e=[];return new BPromise(function(_0x4834b3,_0x41685f){try{if(_0x41c833['autoAssociation']){return db['Dashboard'][_0x6dbc('0x53')]({'raw':!![]})[_0x6dbc('0x28')](function(_0x3c654b){_0x3c654b['forEach'](function(_0x23cf39){_0x49c52e[_0x6dbc('0x5f')](_0x23cf39['id']+0x1869f);});_0x4834b3(_0x49c52e);});}else{return db[_0x6dbc('0x52')][_0x6dbc('0x53')]({'where':{'sectionId':_0x41c833['id']},'raw':!![]})[_0x6dbc('0x28')](function(_0x4e35d6){_0x4e35d6['forEach'](function(_0x5c10c2){_0x49c52e[_0x6dbc('0x5f')](_0x5c10c2[_0x6dbc('0x61')]+0x1869f);});_0x4834b3(_0x49c52e);});}}catch(_0xcf055d){_0x41685f(_0xcf055d);}});}function getPlugins(_0x1c2422){var _0xc31678=[];return new BPromise(function(_0x5dd88b,_0x3570d4){try{if(_0x1c2422[_0x6dbc('0x51')]){return db['Plugin']['findAll']({'raw':!![]})[_0x6dbc('0x28')](function(_0x497933){_0x497933['forEach'](function(_0x25f9c){_0xc31678[_0x6dbc('0x5f')](_0x25f9c['id']+0x15b38);});_0x5dd88b(_0xc31678);});}else{return db[_0x6dbc('0x52')][_0x6dbc('0x53')]({'where':{'sectionId':_0x1c2422['id']},'raw':!![]})['then'](function(_0x4336ff){_0x4336ff[_0x6dbc('0x62')](function(_0x3e96da){_0xc31678['push'](_0x3e96da[_0x6dbc('0x61')]+0x15b38);});_0x5dd88b(_0xc31678);});}}catch(_0x4ea395){_0x3570d4(_0x4ea395);}});}exports[_0x6dbc('0x63')]=function(_0x28de25,_0x8cf6f5){return db['UserProfile'][_0x6dbc('0x49')]({'where':{'id':_0x28de25[_0x6dbc('0x45')]['id']}})[_0x6dbc('0x28')](handleEntityNotFound(_0x8cf6f5,null))[_0x6dbc('0x28')](function(_0x2a6fd5){if(_0x2a6fd5){return db[_0x6dbc('0x58')]['transaction'](function(_0x721b34){return db[_0x6dbc('0x4f')][_0x6dbc('0x53')]({'where':{'userProfileId':_0x28de25[_0x6dbc('0x45')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x4fc176){if(_0x4fc176){return db[_0x6dbc('0x4f')]['destroy']({'where':{'userProfileId':_0x28de25[_0x6dbc('0x45')]['id'],'id':_[_0x6dbc('0x2e')](_0x4fc176,function(_0x3a5fcc){return _0x3a5fcc['id'];})},'transaction':_0x721b34});}})[_0x6dbc('0x28')](function(_0x5b1ef9){var _0x3ae100=_[_0x6dbc('0x2e')](_0x28de25['body'],function(_0x51e5ec){_0x51e5ec[_0x6dbc('0x55')]=_0x28de25[_0x6dbc('0x45')]['id'];return _0x51e5ec;});return db[_0x6dbc('0x4f')][_0x6dbc('0x64')](_0x3ae100,{'raw':!![],'transaction':_0x721b34});})[_0x6dbc('0x28')](function(_0x19f92f){var _0x2a9083=_[_0x6dbc('0x3e')](_[_0x6dbc('0x2e')](_0x19f92f,function(_0x21d23b){return _0x21d23b[_0x6dbc('0x59')]({'plain':!![]});}),{'includeAll':![]});if(_0x2a9083){return db[_0x6dbc('0x4f')][_0x6dbc('0x53')]({'where':{'userProfileId':_0x28de25['params']['id'],'sectionId':_[_0x6dbc('0x2e')](_0x2a9083,function(_0x413bc3){return _0x413bc3[_0x6dbc('0x54')];})},'attributes':['id',_0x6dbc('0x54')],'raw':!![]})[_0x6dbc('0x28')](function(_0x25f3f8){var _0x5c48f2=_[_0x6dbc('0x2e')](_0x28de25['body'],function(_0x1458c6){_0x1458c6[_0x6dbc('0x55')]=_0x28de25[_0x6dbc('0x45')]['id'];return _0x1458c6;});return db['UserProfileResource'][_0x6dbc('0x64')](_0x5c48f2,{'raw':!![],'transaction':_0x721b34});});}})[_0x6dbc('0x44')](handleError(_0x8cf6f5,null));});}})[_0x6dbc('0x28')](function(_0x485e83){var _0x8970f4=_[_0x6dbc('0x2e')](_0x485e83,function(_0x2bb616){return _0x2bb616['get']({'plain':!![]});});})[_0x6dbc('0x28')](respondWithResult(_0x8cf6f5,null))['catch'](handleError(_0x8cf6f5,null));};exports[_0x6dbc('0x65')]=function(_0x35ac11,_0x753caa,_0x115cd8){return db[_0x6dbc('0x41')][_0x6dbc('0x49')]({'where':{'id':_0x35ac11[_0x6dbc('0x45')]['id']}})[_0x6dbc('0x28')](handleEntityNotFound(_0x753caa,null))['then'](function(_0x4e643a){if(_0x4e643a){return _0x4e643a[_0x6dbc('0x65')](_0x35ac11[_0x6dbc('0x34')][_0x6dbc('0x66')]);}})[_0x6dbc('0x28')](respondWithStatusCode(_0x753caa,null))[_0x6dbc('0x44')](handleError(_0x753caa,null));};exports[_0x6dbc('0x67')]=function(_0x364e40,_0x170770){var _0x22972a={};if(!_0x364e40['query'][_0x6dbc('0x68')])throw new Error(_0x6dbc('0x69'));if(!_0x364e40['query'][_0x6dbc('0x6a')](_0x6dbc('0x3b'))){_0x22972a['limit']=qs['limit'](_0x364e40[_0x6dbc('0x34')][_0x6dbc('0x22')]);_0x22972a['offset']=qs[_0x6dbc('0x20')](_0x364e40[_0x6dbc('0x34')]['offset']);}return db[_0x6dbc('0x41')][_0x6dbc('0x49')]({'where':{'id':_0x364e40['params']['id']}})['then'](function(_0x22083f){if(!_0x22083f)throw new Error(_0x6dbc('0x6b')+_0x364e40['params']['id']);return db[_0x6dbc('0x41')][_0x6dbc('0x67')](_0x364e40);})['then'](respondWithFilteredResult(_0x170770,_0x22972a))[_0x6dbc('0x44')](handleError(_0x170770,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 13afc03..0d59a05 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 _0x5232=['UserProfile','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x28c2f5,_0x496b92){var _0x36703f=function(_0x51a5ab){while(--_0x51a5ab){_0x28c2f5['push'](_0x28c2f5['shift']());}};_0x36703f(++_0x496b92);}(_0x5232,0x1c9));var _0x2523=function(_0x13606d,_0x30f265){_0x13606d=_0x13606d-0x0;var _0x1b85b0=_0x5232[_0x13606d];return _0x1b85b0;};'use strict';var EventEmitter=require(_0x2523('0x0'));var UserProfile=require(_0x2523('0x1'))['db'][_0x2523('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x2523('0x3')](0x0);var events={'afterCreate':_0x2523('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3ce9f5){return function(_0xbc0786,_0x582108,_0x1fe9de){UserProfileEvents[_0x2523('0x5')](_0x3ce9f5+':'+_0xbc0786['id'],_0xbc0786);UserProfileEvents[_0x2523('0x5')](_0x3ce9f5,_0xbc0786);_0x1fe9de(null);};}for(var e in events){if(events[_0x2523('0x6')](e)){var event=events[e];UserProfile[_0x2523('0x7')](e,emitEvent(event));}}module[_0x2523('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xd26f=['emit','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0xd26f,0x113));var _0xfd26=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xd26f[_0x2b5eae];return _0x5f3ac9;};'use strict';var EventEmitter=require(_0xfd26('0x0'));var UserProfile=require(_0xfd26('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfd26('0x2'),'afterUpdate':_0xfd26('0x3'),'afterDestroy':_0xfd26('0x4')};function emitEvent(_0x3e3583){return function(_0x30e7fc,_0x29c235,_0x3983a2){UserProfileEvents[_0xfd26('0x5')](_0x3e3583+':'+_0x30e7fc['id'],_0x30e7fc);UserProfileEvents[_0xfd26('0x5')](_0x3e3583,_0x30e7fc);_0x3983a2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xfd26('0x6')](e,emitEvent(event));}}module[_0xfd26('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index f03dd87..6c18bc3 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 _0x65ef=['VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','agents','Users','admin','user','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','zohoaccounts','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','scheduler','sounds','tags','Tag','templates','Template','trunks','Trunk','variables','Variable','Plugin','extractedreports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','define','UserProfile','Invalid\x20section\x20\x27','length','push','all','ignore','isEmpty','union','find','autoAssociation','model','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','Tags','tag','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','value','findAll','associatedResources','map','catch','field','then','name','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','CmContact','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','role','Telephones','membername','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds'];(function(_0x1f52d5,_0x2fc3b7){var _0x59571c=function(_0x3dab65){while(--_0x3dab65){_0x1f52d5['push'](_0x1f52d5['shift']());}};_0x59571c(++_0x2fc3b7);}(_0x65ef,0x7d));var _0xf65e=function(_0x34df86,_0x460bf2){_0x34df86=_0x34df86-0x0;var _0x443041=_0x65ef[_0x34df86];return _0x443041;};'use strict';var _=require(_0xf65e('0x0'));var attributes=require(_0xf65e('0x1'));var qs=require(_0xf65e('0x2'));module[_0xf65e('0x3')]=function(_0x3fc930){var _0x4b861c=_0x3fc930[_0xf65e('0x4')];function _0x336952(_0xd92cce,_0x484345){return new Promise(function(_0x928948,_0x1c9c63){if(!_0x484345)return _0x928948(null);var _0x11fcca=_0x484345[_0xf65e('0x5')]?{[_0x484345[_0xf65e('0x5')]['field']]:_0x484345['filter'][_0xf65e('0x6')]}:undefined;return _0x4b861c[_0xd92cce][_0xf65e('0x7')]({'where':_0x11fcca,'raw':!![]})['then'](function(_0x1101ac){_0x484345[_0xf65e('0x8')]=_[_0xf65e('0x9')](_0x1101ac,'id');_0x928948(_0x484345);})[_0xf65e('0xa')](function(_0x2f9150){_0x1c9c63(_0x2f9150);});});}function _0x157b0a(_0x5bd81e,_0xf31fdf){return new Promise(function(_0x376962,_0x3bd983){var _0x157134=_0x5bd81e[_0xf65e('0x5')]?{[_0x5bd81e[_0xf65e('0x5')][_0xf65e('0xb')]]:_0x5bd81e['filter']['value']}:undefined;return _0x4b861c[_0x5bd81e['model']][_0xf65e('0x7')]({'where':_0x157134,'raw':!![]})[_0xf65e('0xc')](function(_0x20be78){_0xf31fdf['associatedResources']=_[_0xf65e('0x9')](_0x20be78,function(_0x5f0132){return _0x5f0132[_0xf65e('0xd')];});_0x376962(_0xf31fdf);})[_0xf65e('0xa')](function(_0x416edc){_0x3bd983(_0x416edc);});});}function _0x2700be(_0x3c465e,_0xa5e851,_0x295f5a){if(!_0xa5e851)return resolve(null);return new Promise(function(_0x49880d,_0x290fc6){return _0x4b861c[_0xf65e('0xe')]['findAll']({'where':{'sectionId':_0xa5e851['id']},'raw':!![]})[_0xf65e('0xc')](function(_0xcee864){if(_0x3c465e['field']&&_0x3c465e[_0xf65e('0xb')]!=='id'){_0xa5e851[_0xf65e('0x8')]=_[_0xf65e('0x9')](_0xcee864,function(_0x1a172b){return _0x1a172b[_0x3c465e[_0xf65e('0xb')]];});}else{if(_0x295f5a===_0xf65e('0xf')){_0xa5e851[_0xf65e('0x8')]=_[_0xf65e('0x9')](_0xcee864,function(_0x44213b){return{'id':_0x44213b[_0xf65e('0x10')],'type':_0x44213b[_0xf65e('0x11')]};});}else{_0xa5e851[_0xf65e('0x8')]=_[_0xf65e('0x9')](_0xcee864,function(_0x24eb9f){return _0x24eb9f[_0xf65e('0x10')];});}}_0x49880d(_0xa5e851);})[_0xf65e('0xa')](function(_0x28121d){_0x290fc6(_0x28121d);});});}function _0x5ad8c8(_0x21ffec,_0x3874c9){var _0x5b2cd9={'parentSections':[]};switch(_0x21ffec[_0xf65e('0x12')]()){case _0xf65e('0x13'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x15');break;case _0xf65e('0x16'):_0x5b2cd9['childModel']='SquareOdbc';break;case _0xf65e('0x17'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x18');_0x5b2cd9[_0xf65e('0x19')]=[{'name':_0xf65e('0x1a'),'field':_0xf65e('0xd'),'foreignKey':_0xf65e('0x1b')}];break;case _0xf65e('0x1c'):_0x5b2cd9[_0xf65e('0x14')]='JscriptyProject';break;case _0xf65e('0x1d'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x1e');_0x5b2cd9[_0xf65e('0x19')]=[{'name':_0xf65e('0x1f'),'field':'id','foreignKey':'ListId'}];break;case _0xf65e('0x20'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x21');break;case _0xf65e('0x22'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x23');break;case _0xf65e('0x24'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x25');break;case _0xf65e('0x26'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x27');break;case _0xf65e('0x28'):_0x5b2cd9[_0xf65e('0x14')]='ChatWebsite';break;case _0xf65e('0x29'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x2a');break;case _0xf65e('0x2b'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x2c');break;case _0xf65e('0x2d'):case'internalroutes':case _0xf65e('0x2e'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x2f');break;case _0xf65e('0x30'):_0x5b2cd9['childModel']=_0xf65e('0x31');break;case _0xf65e('0x32'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x33');break;case _0xf65e('0x34'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x35');_0x5b2cd9['parentSections']=[{'name':_0xf65e('0x36'),'field':_0xf65e('0xd'),'foreignKey':'membername','model':'User','filter':{'field':_0xf65e('0x37'),'value':['agent']}},{'name':_0xf65e('0x38'),'field':_0xf65e('0xd'),'foreignKey':_0xf65e('0x39'),'model':_0xf65e('0x3a'),'filter':{'field':'role','value':[_0xf65e('0x3b')]}},{'name':_0xf65e('0x3c'),'field':_0xf65e('0xd'),'foreignKey':_0xf65e('0x3d'),'model':_0xf65e('0x3e'),'filter':{'field':_0xf65e('0x11'),'value':[_0xf65e('0x3f')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0xf65e('0x3d'),'model':_0xf65e('0x3e'),'filter':{'field':'type','value':[_0xf65e('0x40')]}}];break;case _0xf65e('0x41'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x42');break;case'chanspies':_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x43');break;case _0xf65e('0x44'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x45');break;case'ivrcampaigns':_0x5b2cd9['childModel']=_0xf65e('0x46');break;case _0xf65e('0x47'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x48');break;case _0xf65e('0x49'):_0x5b2cd9[_0xf65e('0x14')]='MailAccount';break;case _0xf65e('0x4a'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x4b');break;case'openchannelqueues':_0x5b2cd9[_0xf65e('0x14')]='OpenchannelQueue';break;case _0xf65e('0x4c'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x4d');break;case'smsqueues':_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x4e');break;case _0xf65e('0x4f'):_0x5b2cd9['childModel']=_0xf65e('0x50');break;case _0xf65e('0x51'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x52');break;case _0xf65e('0x53'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x54');break;case _0xf65e('0x55'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x56');break;case _0xf65e('0x57'):case _0xf65e('0x58'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x3e');if(_0x3874c9){_0x5b2cd9[_0xf65e('0x19')]=[{'name':_0xf65e('0x3c')},{'name':_0xf65e('0x59')}];}break;case'users':case _0xf65e('0x5a'):case'telephones':_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x3a');if(_0x3874c9){_0x5b2cd9[_0xf65e('0x19')]=[{'name':_0xf65e('0x5b'),'filter':{'field':_0xf65e('0x37'),'value':[_0xf65e('0x5c'),_0xf65e('0x5d')]},'ignore':!![]},{'name':_0xf65e('0x36')},{'name':_0xf65e('0x38')}];}break;case'zendeskaccounts':_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x5e');break;case'salesforceaccounts':_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x5f');break;case _0xf65e('0x60'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x61');break;case'sugarcrmaccounts':_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x62');break;case _0xf65e('0x63'):_0x5b2cd9['childModel']='DeskAccount';break;case _0xf65e('0x64'):_0x5b2cd9['childModel']='ZohoAccount';break;case _0xf65e('0x65'):_0x5b2cd9['childModel']=_0xf65e('0x3a');break;case'cannedanswers':_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x66');break;case _0xf65e('0x67'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x68');break;case _0xf65e('0x69'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x6a');break;case'intervals':_0x5b2cd9['childModel']=_0xf65e('0x6b');break;case'pauses':_0x5b2cd9[_0xf65e('0x14')]='Pause';break;case _0xf65e('0x6c'):_0x5b2cd9[_0xf65e('0x14')]='Schedule';break;case _0xf65e('0x6d'):_0x5b2cd9[_0xf65e('0x14')]='Sound';break;case _0xf65e('0x6e'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x6f');break;case _0xf65e('0x70'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x71');break;case'triggers':_0x5b2cd9[_0xf65e('0x14')]='Trigger';break;case _0xf65e('0x72'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x73');break;case _0xf65e('0x74'):_0x5b2cd9['childModel']=_0xf65e('0x75');break;case'plugins':_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x76');break;case _0xf65e('0x77'):_0x5b2cd9['childModel']=_0xf65e('0xf');_0x5b2cd9[_0xf65e('0x19')]=[{'name':'Reports','field':'id','foreignKey':_0xf65e('0x78')}];break;case _0xf65e('0x79'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x7a');break;case _0xf65e('0x53'):_0x5b2cd9[_0xf65e('0x14')]=_0xf65e('0x54');break;}return _0x5b2cd9;}function _0x3980db(_0x5142b0,_0x42e4ff){var _0x11315b=_0x5142b0[_0xf65e('0x7b')](0x0)[_0xf65e('0x7c')]()+_0x5142b0[_0xf65e('0x7d')](0x1);var _0x154835={'type':_0x4b861c[_0xf65e('0x7e')][_0xf65e('0x7f')][_0xf65e('0x80')],'raw':!![]};return new BPromise(function(_0x256953,_0x1ae919){var _0x5a4513=squel[_0xf65e('0x81')]()[_0xf65e('0xb')](_0xf65e('0x82')+_0x11315b+'InteractionId','id')[_0xf65e('0xb')](_0xf65e('0x83'))[_0xf65e('0x84')](_0xf65e('0x85')+_0x5142b0+_0xf65e('0x86'),'ui')[_0xf65e('0x87')](_0xf65e('0x88'),_0x42e4ff['id']);return _0x4b861c[_0xf65e('0x89')][_0xf65e('0x8a')](_0x5a4513[_0xf65e('0x8b')](),_0x154835)[_0xf65e('0xc')](function(_0x842720){_0x42e4ff[_0x11315b+'OpenTabs']=_0x842720;_0x256953(_0x842720);})[_0xf65e('0xa')](function(_0x4e3acc){_0x1ae919(_0x4e3acc);});});}return _0x3fc930[_0xf65e('0x8c')](_0xf65e('0x8d'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3fbcc5){var _0x44a20a={'raw':![],'where':{}};var _0x15791e={};var _0x2d6ea5={'count':0x0,'rows':[]};var _0x707a5a=_0x3fbcc5[_0xf65e('0x8a')]['section'];var _0x1ad193=_0x3fbcc5[_0xf65e('0x8a')]['mergeResources']||![];var _0x3cdda7=_0x5ad8c8(_0x707a5a,_0x1ad193);if(!_0x3cdda7[_0xf65e('0x14')])throw new Error(_0xf65e('0x8e')+_0x707a5a+'\x27');var _0x19a233=[{'name':_0x707a5a}];if(!_['isEmpty'](_0x3cdda7[_0xf65e('0x19')]))_0x19a233=_0x3cdda7['parentSections'];var _0x3b47f7=[];for(var _0x2ea2d1=0x0;_0x2ea2d1<_0x19a233[_0xf65e('0x8f')];_0x2ea2d1++){_0x3b47f7[_0xf65e('0x90')](_0x4b861c['UserProfileSection']['find']({'where':{'userProfileId':_0x3fbcc5['params']['id'],'name':_0x19a233[_0x2ea2d1]['name']},'raw':!![]}));}return Promise[_0xf65e('0x91')](_0x3b47f7)[_0xf65e('0xc')](function(_0x101638){var _0xef57cb=_[_0xf65e('0x5')](_0x101638,function(_0x50fb01){return _0x50fb01?_0x50fb01:undefined;});var _0x3f05c8=_[_0xf65e('0x5')](_0x19a233,[_0xf65e('0x92'),!![]]);var _0x34c976=_[_0xf65e('0x93')](_0xef57cb)&&_[_0xf65e('0x93')](_0x3f05c8)?null:_[_0xf65e('0x94')](_0x3f05c8,_0xef57cb);if(!_0x34c976)return null;var _0xe30228=[];for(var _0x24d7fa=0x0;_0x24d7fa<_0x34c976['length'];_0x24d7fa++){var _0x84683b=_[_0xf65e('0x95')](_0x19a233,function(_0x3ad6fc){return _0x34c976[_0x24d7fa]?_0x3ad6fc[_0xf65e('0xd')]===_0x34c976[_0x24d7fa][_0xf65e('0xd')]:null;});if(_0x84683b){if(_0x34c976[_0x24d7fa]['ignore']){_0xe30228[_0xf65e('0x90')](_0x336952(_0x3cdda7[_0xf65e('0x14')],_0x34c976[_0x24d7fa]));}else{if(!_0x34c976[_0x24d7fa][_0xf65e('0x96')]){_0xe30228[_0xf65e('0x90')](_0x2700be(_0x84683b,_0x34c976[_0x24d7fa],_0x3cdda7[_0xf65e('0x14')]));}else{if(_0x84683b[_0xf65e('0x97')]){_0xe30228[_0xf65e('0x90')](_0x157b0a(_0x84683b,_0x34c976[_0x24d7fa]));}}}}}return Promise['all'](_0xe30228);})[_0xf65e('0xc')](function(_0x28f33a){var _0x43d76e=_0x28f33a;var _0x48155c=null;if(_0x43d76e){_0x48155c=_0x43d76e['length']===0x1?_0x43d76e[0x0]:null;}if(!_0x48155c&&!_0x43d76e)return _0x2d6ea5;var _0x19be84=_0x4b861c[_0x3cdda7[_0xf65e('0x14')]][_0xf65e('0x98')];_0x15791e[_0xf65e('0x97')]=_[_0xf65e('0x99')](_0x19be84);_0x15791e[_0xf65e('0x8a')]=_['keys'](_0x3fbcc5['query']);_0x15791e[_0xf65e('0x9a')]=_[_0xf65e('0x9b')](_0x15791e[_0xf65e('0x97')],_0x15791e[_0xf65e('0x8a')]);_0x44a20a[_0xf65e('0x9c')]=_[_0xf65e('0x9b')](_0x15791e[_0xf65e('0x97')],qs[_0xf65e('0x9d')](_0x3fbcc5[_0xf65e('0x8a')][_0xf65e('0x9d')]));_0x44a20a[_0xf65e('0x9c')]=_0x44a20a['attributes'][_0xf65e('0x8f')]?_0x44a20a[_0xf65e('0x9c')]:_0x15791e[_0xf65e('0x97')];if(!_0x3fbcc5['query'][_0xf65e('0x9e')](_0xf65e('0x9f'))){_0x44a20a[_0xf65e('0xa0')]=qs['limit'](_0x3fbcc5[_0xf65e('0x8a')][_0xf65e('0xa0')]);_0x44a20a[_0xf65e('0xa1')]=qs[_0xf65e('0xa1')](_0x3fbcc5[_0xf65e('0x8a')][_0xf65e('0xa1')]);}_0x44a20a[_0xf65e('0xa2')]=qs[_0xf65e('0xa3')](_0x3fbcc5[_0xf65e('0x8a')][_0xf65e('0xa3')]);_0x44a20a[_0xf65e('0x87')]=qs['filters'](_[_0xf65e('0xa4')](_0x3fbcc5[_0xf65e('0x8a')],_0x15791e['filters']));if(_0x3fbcc5[_0xf65e('0x8a')][_0xf65e('0x5')]){_0x44a20a[_0xf65e('0x87')]=_[_0xf65e('0xa5')](_0x44a20a[_0xf65e('0x87')],{'$or':_[_0xf65e('0x9')](_0x19be84,function(_0x235789){if(_0x235789[_0xf65e('0x11')][_0xf65e('0xa6')]!==_0xf65e('0xa7')){var _0x4c1315={};_0x4c1315[_0x235789[_0xf65e('0xb')]]={'$like':'%'+_0x3fbcc5[_0xf65e('0x8a')][_0xf65e('0x5')]+'%'};return _0x4c1315;}})});}var _0x236de9=[];if(_0x48155c){var _0x5bc438=_[_0xf65e('0x95')](_0x19a233,[_0xf65e('0xd'),_0x48155c[_0xf65e('0xd')]]);if(_0x5bc438[_0xf65e('0xb')]){var _0x4d4fdc={};if(_0x3cdda7[_0xf65e('0x14')]==='AnalyticExtractedReport'){_0x4d4fdc[_0x5bc438[_0xf65e('0xa8')]]=_[_0xf65e('0x9')](_0x48155c[_0xf65e('0x8')],'id');}else{_0x4d4fdc[_0x5bc438['foreignKey']]=_0x48155c['associatedResources'];}_0x236de9[_0xf65e('0x90')](_0x4d4fdc);}else{_0x44a20a[_0xf65e('0x87')]['id']=_0x48155c[_0xf65e('0x8')];}}else{for(var _0x48480f=0x0;_0x48480f<_0x43d76e[_0xf65e('0x8f')];_0x48480f++){var _0x5bc438=_['find'](_0x19a233,[_0xf65e('0xd'),_0x43d76e[_0x48480f][_0xf65e('0xd')]]);if(_0x5bc438[_0xf65e('0xb')]){var _0x4d4fdc={};_0x4d4fdc[_0x5bc438['foreignKey']]=_0x43d76e[_0x48480f][_0xf65e('0x8')];_0x236de9[_0xf65e('0x90')](_0x4d4fdc);}else{if(!_0x44a20a['where']['id'])_0x44a20a['where']['id']=[];_0x43d76e[_0x48480f][_0xf65e('0x8')][_0xf65e('0xa9')](function(_0x46ee36){_0x44a20a[_0xf65e('0x87')]['id']['push'](_0x46ee36);});}}}if(!_[_0xf65e('0x93')](_0x236de9)){_0x44a20a[_0xf65e('0x87')]=_['merge'](_0x44a20a[_0xf65e('0x87')],{'$and':{'$or':_0x236de9}});}_0x44a20a=_[_0xf65e('0xa5')]({},_0x44a20a,_0x3fbcc5[_0xf65e('0xaa')]);if(_0x48155c&&!_0x48155c[_0xf65e('0x96')]&&_0x3cdda7[_0xf65e('0x14')]===_0xf65e('0xf')){if(_0x3fbcc5[_0xf65e('0x8a')][_0xf65e('0xab')]){_0x44a20a[_0xf65e('0xac')]=[{'all':!![]}];}return _0x4b861c[_0x3cdda7['childModel']][_0xf65e('0x7')](_0x44a20a)[_0xf65e('0xc')](function(_0x10a0b9){var _0x52e371=[];_0x10a0b9[_0xf65e('0xa9')](function(_0x5e621a){var _0x295804;switch(_0x5e621a[_0xf65e('0xad')]){case _0xf65e('0xae'):_0x295804=_[_0xf65e('0x95')](_0x48155c['associatedResources'],function(_0x2ccdcd){return _0x2ccdcd['id']===_0x5e621a[_0xf65e('0x78')]&&_0x2ccdcd[_0xf65e('0x11')]===_0xf65e('0xaf');});break;case _0xf65e('0xb0'):_0x295804=_[_0xf65e('0x95')](_0x48155c[_0xf65e('0x8')],function(_0x510730){return _0x510730['id']===_0x5e621a[_0xf65e('0x78')]&&_0x510730[_0xf65e('0x11')]===_0xf65e('0xb1');});break;}if(_0x295804)_0x52e371[_0xf65e('0x90')](_0x5e621a);});_0x2d6ea5[_0xf65e('0xb2')]=_0x52e371[_0xf65e('0x8f')];_0x2d6ea5[_0xf65e('0xb3')]=_0x52e371;return _0x2d6ea5;});}else{return _0x4b861c[_0x3cdda7['childModel']]['count']({'where':_0x44a20a[_0xf65e('0x87')]})[_0xf65e('0xc')](function(_0x336015){_0x2d6ea5[_0xf65e('0xb2')]=_0x336015;if(_0x3fbcc5[_0xf65e('0x8a')][_0xf65e('0xab')]){if(_0x3cdda7['childModel']===_0xf65e('0x1e')){_0x44a20a[_0xf65e('0xac')]=[{'model':_0x4b861c[_0xf65e('0x6f')],'as':_0xf65e('0xb4'),'attributes':['id',_0xf65e('0xd'),'color'],'required':_0x3fbcc5['query'][_0xf65e('0xb5')]?!![]:![]},{'model':_0x4b861c[_0xf65e('0x6f')],'as':'ThroughTags','attributes':['id',_0xf65e('0xd'),'color'],'through':_0x3fbcc5[_0xf65e('0x8a')][_0xf65e('0xb5')]?{'attributes':[],'where':{'TagId':_0x3fbcc5[_0xf65e('0x8a')][_0xf65e('0xb5')]||undefined}}:{},'required':_0x3fbcc5['query']['tag']?!![]:![]}];}else{_0x44a20a[_0xf65e('0xac')]=[{'all':!![]}];}}return _0x4b861c[_0x3cdda7['childModel']][_0xf65e('0x7')](_0x44a20a);})[_0xf65e('0xc')](function(_0x21eff3){_0x2d6ea5[_0xf65e('0xb3')]=_0x21eff3;if(_0x707a5a===_0xf65e('0x36')&&_0x3fbcc5[_0xf65e('0x8a')][_0xf65e('0xb6')]===_0xf65e('0xb7')){var _0x486c1f=[];for(var _0x1a4df9=0x0;_0x1a4df9<_0x2d6ea5[_0xf65e('0xb3')][_0xf65e('0x8f')];_0x1a4df9++){_0x486c1f['push'](_0x3980db(_0xf65e('0xb8'),_0x2d6ea5[_0xf65e('0xb3')][_0x1a4df9][_0xf65e('0xb9')]));_0x486c1f[_0xf65e('0x90')](_0x3980db(_0xf65e('0xba'),_0x2d6ea5[_0xf65e('0xb3')][_0x1a4df9][_0xf65e('0xb9')]));_0x486c1f['push'](_0x3980db(_0xf65e('0xbb'),_0x2d6ea5[_0xf65e('0xb3')][_0x1a4df9][_0xf65e('0xb9')]));_0x486c1f[_0xf65e('0x90')](_0x3980db(_0xf65e('0xbc'),_0x2d6ea5[_0xf65e('0xb3')][_0x1a4df9][_0xf65e('0xb9')]));_0x486c1f[_0xf65e('0x90')](_0x3980db(_0xf65e('0xbd'),_0x2d6ea5[_0xf65e('0xb3')][_0x1a4df9][_0xf65e('0xb9')]));_0x486c1f[_0xf65e('0x90')](_0x3980db(_0xf65e('0xbe'),_0x2d6ea5[_0xf65e('0xb3')][_0x1a4df9][_0xf65e('0xb9')]));}return Promise[_0xf65e('0x91')](_0x486c1f)[_0xf65e('0xc')](function(){return _0x2d6ea5;});}return _0x2d6ea5;});}});}}});}; \ No newline at end of file +var _0x30b2=['lodash','../../components/parsers/qs','exports','filter','field','value','findAll','then','associatedResources','map','catch','model','name','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','SquareProject','SquareOdbc','parentSections','SquareProjects','projectName','projects','contacts','Lists','ListId','lists','childModel','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicerecordings','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','Tag','templates','Template','Trigger','trunks','Trunk','Variable','plugins','Plugin','Reports','reportId','charAt','toUpperCase','slice','Sequelize','select','ui.','InteractionId','ui.createdAt','from','where','ui.UserId\x20=\x20?','sequelize','UserProfile','user_profiles','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','all','ignore','union','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','offset','order','sort','merge','key','foreignKey','forEach','options','reportType','default','DefaultReports','custom','CustomReports','count','includeAll','CmContact','Tags','tag','color','include','rows','openTabs','true','chat','dataValues','fax','mail','openchannel','whatsapp'];(function(_0x251b02,_0x38c0f7){var _0x14017c=function(_0x7a976a){while(--_0x7a976a){_0x251b02['push'](_0x251b02['shift']());}};_0x14017c(++_0x38c0f7);}(_0x30b2,0xbb));var _0x230b=function(_0x2c77db,_0x5a332a){_0x2c77db=_0x2c77db-0x0;var _0x275bda=_0x30b2[_0x2c77db];return _0x275bda;};'use strict';var _=require(_0x230b('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x230b('0x1'));module[_0x230b('0x2')]=function(_0x4053a4){var _0x229c19=_0x4053a4['models'];function _0x3fc5ac(_0x1383c3,_0x1c9f2d){return new Promise(function(_0x245edf,_0x519843){if(!_0x1c9f2d)return _0x245edf(null);var _0x5cbb93=_0x1c9f2d[_0x230b('0x3')]?{[_0x1c9f2d[_0x230b('0x3')][_0x230b('0x4')]]:_0x1c9f2d[_0x230b('0x3')][_0x230b('0x5')]}:undefined;return _0x229c19[_0x1383c3][_0x230b('0x6')]({'where':_0x5cbb93,'raw':!![]})[_0x230b('0x7')](function(_0x10b177){_0x1c9f2d[_0x230b('0x8')]=_[_0x230b('0x9')](_0x10b177,'id');_0x245edf(_0x1c9f2d);})[_0x230b('0xa')](function(_0x16459a){_0x519843(_0x16459a);});});}function _0xb4471a(_0x3aa7fe,_0x31347f){return new Promise(function(_0x71ad45,_0x4faa31){var _0x539e94=_0x3aa7fe[_0x230b('0x3')]?{[_0x3aa7fe[_0x230b('0x3')][_0x230b('0x4')]]:_0x3aa7fe[_0x230b('0x3')]['value']}:undefined;return _0x229c19[_0x3aa7fe[_0x230b('0xb')]][_0x230b('0x6')]({'where':_0x539e94,'raw':!![]})[_0x230b('0x7')](function(_0x1fe66d){_0x31347f[_0x230b('0x8')]=_[_0x230b('0x9')](_0x1fe66d,function(_0x1445d3){return _0x1445d3[_0x230b('0xc')];});_0x71ad45(_0x31347f);})[_0x230b('0xa')](function(_0xe4c608){_0x4faa31(_0xe4c608);});});}function _0x49fde7(_0x189e77,_0x46e21c,_0x379038){if(!_0x46e21c)return resolve(null);return new Promise(function(_0x44d450,_0x4294d3){return _0x229c19[_0x230b('0xd')][_0x230b('0x6')]({'where':{'sectionId':_0x46e21c['id']},'raw':!![]})[_0x230b('0x7')](function(_0x5e7810){if(_0x189e77['field']&&_0x189e77[_0x230b('0x4')]!=='id'){_0x46e21c[_0x230b('0x8')]=_[_0x230b('0x9')](_0x5e7810,function(_0x2de38e){return _0x2de38e[_0x189e77[_0x230b('0x4')]];});}else{if(_0x379038===_0x230b('0xe')){_0x46e21c[_0x230b('0x8')]=_[_0x230b('0x9')](_0x5e7810,function(_0x1f3055){return{'id':_0x1f3055[_0x230b('0xf')],'type':_0x1f3055[_0x230b('0x10')]};});}else{_0x46e21c[_0x230b('0x8')]=_[_0x230b('0x9')](_0x5e7810,function(_0xb20be5){return _0xb20be5[_0x230b('0xf')];});}}_0x44d450(_0x46e21c);})[_0x230b('0xa')](function(_0x27514e){_0x4294d3(_0x27514e);});});}function _0x3dff95(_0x35b227,_0x321b8f){var _0x350f9e={'parentSections':[]};switch(_0x35b227[_0x230b('0x11')]()){case _0x230b('0x12'):_0x350f9e['childModel']=_0x230b('0x13');break;case'odbc':_0x350f9e['childModel']=_0x230b('0x14');break;case'squarerecordings':_0x350f9e['childModel']='SquareRecording';_0x350f9e[_0x230b('0x15')]=[{'name':_0x230b('0x16'),'field':'name','foreignKey':_0x230b('0x17')}];break;case _0x230b('0x18'):_0x350f9e['childModel']='JscriptyProject';break;case _0x230b('0x19'):_0x350f9e['childModel']='CmContact';_0x350f9e[_0x230b('0x15')]=[{'name':_0x230b('0x1a'),'field':'id','foreignKey':_0x230b('0x1b')}];break;case _0x230b('0x1c'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x1e');break;case _0x230b('0x1f'):_0x350f9e['childModel']=_0x230b('0x20');break;case _0x230b('0x21'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x22');break;case'chatqueues':_0x350f9e[_0x230b('0x1d')]='ChatQueue';break;case'chatwebsites':_0x350f9e[_0x230b('0x1d')]=_0x230b('0x23');break;case _0x230b('0x24'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x25');break;case _0x230b('0x26'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x27');break;case _0x230b('0x28'):case'internalroutes':case _0x230b('0x29'):_0x350f9e['childModel']=_0x230b('0x2a');break;case _0x230b('0x2b'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x2c');break;case'voicemails':_0x350f9e[_0x230b('0x1d')]='VoiceMail';break;case _0x230b('0x2d'):_0x350f9e[_0x230b('0x1d')]='VoiceRecording';_0x350f9e[_0x230b('0x15')]=[{'name':_0x230b('0x2e'),'field':_0x230b('0xc'),'foreignKey':_0x230b('0x2f'),'model':_0x230b('0x30'),'filter':{'field':_0x230b('0x31'),'value':[_0x230b('0x32')]}},{'name':_0x230b('0x33'),'field':_0x230b('0xc'),'foreignKey':_0x230b('0x2f'),'model':_0x230b('0x30'),'filter':{'field':_0x230b('0x31'),'value':[_0x230b('0x34')]}},{'name':_0x230b('0x35'),'field':_0x230b('0xc'),'foreignKey':'queue','model':_0x230b('0x36'),'filter':{'field':'type','value':[_0x230b('0x37')]}},{'name':_0x230b('0x38'),'field':_0x230b('0xc'),'foreignKey':_0x230b('0x39'),'model':_0x230b('0x36'),'filter':{'field':_0x230b('0x10'),'value':[_0x230b('0x3a')]}}];break;case'musiconholds':_0x350f9e['childModel']=_0x230b('0x3b');break;case _0x230b('0x3c'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x3d');break;case _0x230b('0x3e'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x3f');break;case _0x230b('0x40'):_0x350f9e[_0x230b('0x1d')]='Campaign';break;case _0x230b('0x41'):_0x350f9e['childModel']=_0x230b('0x42');break;case'mailaccounts':_0x350f9e['childModel']=_0x230b('0x43');break;case _0x230b('0x44'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x45');break;case _0x230b('0x46'):_0x350f9e['childModel']=_0x230b('0x47');break;case _0x230b('0x48'):_0x350f9e['childModel']='OpenchannelAccount';break;case _0x230b('0x49'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x4a');break;case _0x230b('0x4b'):_0x350f9e[_0x230b('0x1d')]='SmsAccount';break;case _0x230b('0x4c'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x4d');break;case _0x230b('0x4e'):_0x350f9e[_0x230b('0x1d')]='WhatsappAccount';break;case _0x230b('0x4f'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x50');break;case _0x230b('0x51'):case _0x230b('0x52'):_0x350f9e[_0x230b('0x1d')]='VoiceQueue';if(_0x321b8f){_0x350f9e['parentSections']=[{'name':_0x230b('0x35')},{'name':_0x230b('0x38')}];}break;case _0x230b('0x53'):case _0x230b('0x54'):case _0x230b('0x55'):_0x350f9e['childModel']=_0x230b('0x30');if(_0x321b8f){_0x350f9e[_0x230b('0x15')]=[{'name':_0x230b('0x56'),'filter':{'field':_0x230b('0x31'),'value':[_0x230b('0x57'),_0x230b('0x58')]},'ignore':!![]},{'name':_0x230b('0x2e')},{'name':_0x230b('0x33')}];}break;case _0x230b('0x59'):_0x350f9e['childModel']=_0x230b('0x5a');break;case'salesforceaccounts':_0x350f9e[_0x230b('0x1d')]=_0x230b('0x5b');break;case _0x230b('0x5c'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x5d');break;case _0x230b('0x5e'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x5f');break;case'deskaccounts':_0x350f9e[_0x230b('0x1d')]=_0x230b('0x60');break;case _0x230b('0x61'):_0x350f9e[_0x230b('0x1d')]='ZohoAccount';break;case _0x230b('0x62'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x30');break;case'cannedanswers':_0x350f9e[_0x230b('0x1d')]=_0x230b('0x63');break;case _0x230b('0x64'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x65');break;case _0x230b('0x66'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x67');break;case _0x230b('0x68'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x69');break;case _0x230b('0x6a'):_0x350f9e['childModel']=_0x230b('0x6b');break;case _0x230b('0x6c'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x6d');break;case _0x230b('0x6e'):_0x350f9e[_0x230b('0x1d')]='Sound';break;case _0x230b('0x6f'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x70');break;case _0x230b('0x71'):_0x350f9e['childModel']=_0x230b('0x72');break;case'triggers':_0x350f9e[_0x230b('0x1d')]=_0x230b('0x73');break;case _0x230b('0x74'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x75');break;case'variables':_0x350f9e[_0x230b('0x1d')]=_0x230b('0x76');break;case _0x230b('0x77'):_0x350f9e[_0x230b('0x1d')]=_0x230b('0x78');break;case'extractedreports':_0x350f9e[_0x230b('0x1d')]=_0x230b('0xe');_0x350f9e[_0x230b('0x15')]=[{'name':_0x230b('0x79'),'field':'id','foreignKey':_0x230b('0x7a')}];break;case'metrics':_0x350f9e[_0x230b('0x1d')]='AnalyticMetric';break;case _0x230b('0x4e'):_0x350f9e[_0x230b('0x1d')]='WhatsappAccount';break;}return _0x350f9e;}function _0x17ebbe(_0x38aafe,_0x28efb9){var _0xa1b867=_0x38aafe[_0x230b('0x7b')](0x0)[_0x230b('0x7c')]()+_0x38aafe[_0x230b('0x7d')](0x1);var _0x57da2b={'type':_0x229c19[_0x230b('0x7e')]['QueryTypes']['SELECT'],'raw':!![]};return new BPromise(function(_0x1cc366,_0x12270b){var _0x21bbb8=squel[_0x230b('0x7f')]()['field'](_0x230b('0x80')+_0xa1b867+_0x230b('0x81'),'id')[_0x230b('0x4')](_0x230b('0x82'))[_0x230b('0x83')]('user_has_'+_0x38aafe+'_interactions','ui')[_0x230b('0x84')](_0x230b('0x85'),_0x28efb9['id']);return _0x229c19[_0x230b('0x86')]['query'](_0x21bbb8['toString'](),_0x57da2b)[_0x230b('0x7')](function(_0x39daa1){_0x28efb9[_0xa1b867+'OpenTabs']=_0x39daa1;_0x1cc366(_0x39daa1);})[_0x230b('0xa')](function(_0x2da354){_0x12270b(_0x2da354);});});}return _0x4053a4['define'](_0x230b('0x87'),attributes,{'tableName':_0x230b('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xabd00b){var _0x46b162={'raw':![],'where':{}};var _0x5c9d0b={};var _0x4a6e21={'count':0x0,'rows':[]};var _0x1529bb=_0xabd00b[_0x230b('0x89')][_0x230b('0x8a')];var _0x17159f=_0xabd00b[_0x230b('0x89')][_0x230b('0x8b')]||![];var _0x2cbb0e=_0x3dff95(_0x1529bb,_0x17159f);if(!_0x2cbb0e[_0x230b('0x1d')])throw new Error(_0x230b('0x8c')+_0x1529bb+'\x27');var _0x2f7564=[{'name':_0x1529bb}];if(!_[_0x230b('0x8d')](_0x2cbb0e[_0x230b('0x15')]))_0x2f7564=_0x2cbb0e['parentSections'];var _0x5a33b2=[];for(var _0x4fc9fc=0x0;_0x4fc9fc<_0x2f7564[_0x230b('0x8e')];_0x4fc9fc++){_0x5a33b2[_0x230b('0x8f')](_0x229c19[_0x230b('0x90')][_0x230b('0x91')]({'where':{'userProfileId':_0xabd00b['params']['id'],'name':_0x2f7564[_0x4fc9fc][_0x230b('0xc')]},'raw':!![]}));}return Promise[_0x230b('0x92')](_0x5a33b2)['then'](function(_0x11031f){var _0x40bef9=_['filter'](_0x11031f,function(_0x462fb3){return _0x462fb3?_0x462fb3:undefined;});var _0x3fd4c5=_[_0x230b('0x3')](_0x2f7564,[_0x230b('0x93'),!![]]);var _0x497115=_[_0x230b('0x8d')](_0x40bef9)&&_['isEmpty'](_0x3fd4c5)?null:_[_0x230b('0x94')](_0x3fd4c5,_0x40bef9);if(!_0x497115)return null;var _0x7f3512=[];for(var _0x50bfb7=0x0;_0x50bfb7<_0x497115[_0x230b('0x8e')];_0x50bfb7++){var _0x1aebd8=_[_0x230b('0x91')](_0x2f7564,function(_0x301e64){return _0x497115[_0x50bfb7]?_0x301e64[_0x230b('0xc')]===_0x497115[_0x50bfb7][_0x230b('0xc')]:null;});if(_0x1aebd8){if(_0x497115[_0x50bfb7][_0x230b('0x93')]){_0x7f3512[_0x230b('0x8f')](_0x3fc5ac(_0x2cbb0e[_0x230b('0x1d')],_0x497115[_0x50bfb7]));}else{if(!_0x497115[_0x50bfb7][_0x230b('0x95')]){_0x7f3512[_0x230b('0x8f')](_0x49fde7(_0x1aebd8,_0x497115[_0x50bfb7],_0x2cbb0e['childModel']));}else{if(_0x1aebd8[_0x230b('0xb')]){_0x7f3512[_0x230b('0x8f')](_0xb4471a(_0x1aebd8,_0x497115[_0x50bfb7]));}}}}}return Promise[_0x230b('0x92')](_0x7f3512);})[_0x230b('0x7')](function(_0x934089){var _0x2ef29f=_0x934089;var _0x57c3de=null;if(_0x2ef29f){_0x57c3de=_0x2ef29f[_0x230b('0x8e')]===0x1?_0x2ef29f[0x0]:null;}if(!_0x57c3de&&!_0x2ef29f)return _0x4a6e21;var _0x554a5f=_0x229c19[_0x2cbb0e[_0x230b('0x1d')]][_0x230b('0x96')];_0x5c9d0b[_0x230b('0xb')]=_[_0x230b('0x97')](_0x554a5f);_0x5c9d0b[_0x230b('0x89')]=_['keys'](_0xabd00b[_0x230b('0x89')]);_0x5c9d0b[_0x230b('0x98')]=_[_0x230b('0x99')](_0x5c9d0b['model'],_0x5c9d0b[_0x230b('0x89')]);_0x46b162['attributes']=_[_0x230b('0x99')](_0x5c9d0b[_0x230b('0xb')],qs[_0x230b('0x9a')](_0xabd00b['query']['fields']));_0x46b162[_0x230b('0x9b')]=_0x46b162[_0x230b('0x9b')]['length']?_0x46b162[_0x230b('0x9b')]:_0x5c9d0b[_0x230b('0xb')];if(!_0xabd00b[_0x230b('0x89')][_0x230b('0x9c')]('nolimit')){_0x46b162[_0x230b('0x9d')]=qs[_0x230b('0x9d')](_0xabd00b[_0x230b('0x89')][_0x230b('0x9d')]);_0x46b162[_0x230b('0x9e')]=qs[_0x230b('0x9e')](_0xabd00b['query'][_0x230b('0x9e')]);}_0x46b162[_0x230b('0x9f')]=qs[_0x230b('0xa0')](_0xabd00b['query'][_0x230b('0xa0')]);_0x46b162[_0x230b('0x84')]=qs['filters'](_['pick'](_0xabd00b[_0x230b('0x89')],_0x5c9d0b[_0x230b('0x98')]));if(_0xabd00b['query'][_0x230b('0x3')]){_0x46b162[_0x230b('0x84')]=_[_0x230b('0xa1')](_0x46b162[_0x230b('0x84')],{'$or':_[_0x230b('0x9')](_0x554a5f,function(_0x18f2f0){if(_0x18f2f0[_0x230b('0x10')][_0x230b('0xa2')]!=='VIRTUAL'){var _0x45bef7={};_0x45bef7[_0x18f2f0[_0x230b('0x4')]]={'$like':'%'+_0xabd00b['query'][_0x230b('0x3')]+'%'};return _0x45bef7;}})});}var _0x245f4d=[];if(_0x57c3de){var _0x4f67b6=_[_0x230b('0x91')](_0x2f7564,[_0x230b('0xc'),_0x57c3de[_0x230b('0xc')]]);if(_0x4f67b6[_0x230b('0x4')]){var _0x209bec={};if(_0x2cbb0e['childModel']===_0x230b('0xe')){_0x209bec[_0x4f67b6[_0x230b('0xa3')]]=_['map'](_0x57c3de[_0x230b('0x8')],'id');}else{_0x209bec[_0x4f67b6[_0x230b('0xa3')]]=_0x57c3de[_0x230b('0x8')];}_0x245f4d[_0x230b('0x8f')](_0x209bec);}else{_0x46b162[_0x230b('0x84')]['id']=_0x57c3de[_0x230b('0x8')];}}else{for(var _0x5b95e7=0x0;_0x5b95e7<_0x2ef29f[_0x230b('0x8e')];_0x5b95e7++){var _0x4f67b6=_['find'](_0x2f7564,[_0x230b('0xc'),_0x2ef29f[_0x5b95e7][_0x230b('0xc')]]);if(_0x4f67b6[_0x230b('0x4')]){var _0x209bec={};_0x209bec[_0x4f67b6[_0x230b('0xa3')]]=_0x2ef29f[_0x5b95e7][_0x230b('0x8')];_0x245f4d[_0x230b('0x8f')](_0x209bec);}else{if(!_0x46b162[_0x230b('0x84')]['id'])_0x46b162['where']['id']=[];_0x2ef29f[_0x5b95e7][_0x230b('0x8')][_0x230b('0xa4')](function(_0xafd089){_0x46b162[_0x230b('0x84')]['id'][_0x230b('0x8f')](_0xafd089);});}}}if(!_[_0x230b('0x8d')](_0x245f4d)){_0x46b162['where']=_[_0x230b('0xa1')](_0x46b162[_0x230b('0x84')],{'$and':{'$or':_0x245f4d}});}_0x46b162=_[_0x230b('0xa1')]({},_0x46b162,_0xabd00b[_0x230b('0xa5')]);if(_0x57c3de&&!_0x57c3de[_0x230b('0x95')]&&_0x2cbb0e[_0x230b('0x1d')]==='AnalyticExtractedReport'){if(_0xabd00b[_0x230b('0x89')]['includeAll']){_0x46b162['include']=[{'all':!![]}];}return _0x229c19[_0x2cbb0e[_0x230b('0x1d')]]['findAll'](_0x46b162)[_0x230b('0x7')](function(_0x33d86e){var _0x966d4f=[];_0x33d86e[_0x230b('0xa4')](function(_0x2170aa){var _0x8a875b;switch(_0x2170aa[_0x230b('0xa6')]){case _0x230b('0xa7'):_0x8a875b=_[_0x230b('0x91')](_0x57c3de[_0x230b('0x8')],function(_0x3c7b56){return _0x3c7b56['id']===_0x2170aa[_0x230b('0x7a')]&&_0x3c7b56[_0x230b('0x10')]===_0x230b('0xa8');});break;case _0x230b('0xa9'):_0x8a875b=_[_0x230b('0x91')](_0x57c3de[_0x230b('0x8')],function(_0x12f47e){return _0x12f47e['id']===_0x2170aa['reportId']&&_0x12f47e[_0x230b('0x10')]===_0x230b('0xaa');});break;}if(_0x8a875b)_0x966d4f[_0x230b('0x8f')](_0x2170aa);});_0x4a6e21[_0x230b('0xab')]=_0x966d4f[_0x230b('0x8e')];_0x4a6e21['rows']=_0x966d4f;return _0x4a6e21;});}else{return _0x229c19[_0x2cbb0e[_0x230b('0x1d')]]['count']({'where':_0x46b162[_0x230b('0x84')]})['then'](function(_0x1eca11){_0x4a6e21[_0x230b('0xab')]=_0x1eca11;if(_0xabd00b[_0x230b('0x89')][_0x230b('0xac')]){if(_0x2cbb0e[_0x230b('0x1d')]===_0x230b('0xad')){_0x46b162['include']=[{'model':_0x229c19[_0x230b('0x70')],'as':_0x230b('0xae'),'attributes':['id','name','color'],'required':_0xabd00b[_0x230b('0x89')][_0x230b('0xaf')]?!![]:![]},{'model':_0x229c19[_0x230b('0x70')],'as':'ThroughTags','attributes':['id',_0x230b('0xc'),_0x230b('0xb0')],'through':_0xabd00b['query'][_0x230b('0xaf')]?{'attributes':[],'where':{'TagId':_0xabd00b[_0x230b('0x89')][_0x230b('0xaf')]||undefined}}:{},'required':_0xabd00b[_0x230b('0x89')]['tag']?!![]:![]}];}else{_0x46b162[_0x230b('0xb1')]=[{'all':!![]}];}}return _0x229c19[_0x2cbb0e[_0x230b('0x1d')]][_0x230b('0x6')](_0x46b162);})[_0x230b('0x7')](function(_0xcd6ae7){_0x4a6e21[_0x230b('0xb2')]=_0xcd6ae7;if(_0x1529bb===_0x230b('0x2e')&&_0xabd00b['query'][_0x230b('0xb3')]===_0x230b('0xb4')){var _0x2797af=[];for(var _0x5d5b37=0x0;_0x5d5b37<_0x4a6e21['rows'][_0x230b('0x8e')];_0x5d5b37++){_0x2797af[_0x230b('0x8f')](_0x17ebbe(_0x230b('0xb5'),_0x4a6e21[_0x230b('0xb2')][_0x5d5b37]['dataValues']));_0x2797af[_0x230b('0x8f')](_0x17ebbe('sms',_0x4a6e21[_0x230b('0xb2')][_0x5d5b37][_0x230b('0xb6')]));_0x2797af[_0x230b('0x8f')](_0x17ebbe(_0x230b('0xb7'),_0x4a6e21[_0x230b('0xb2')][_0x5d5b37]['dataValues']));_0x2797af['push'](_0x17ebbe(_0x230b('0xb8'),_0x4a6e21[_0x230b('0xb2')][_0x5d5b37]['dataValues']));_0x2797af[_0x230b('0x8f')](_0x17ebbe(_0x230b('0xb9'),_0x4a6e21[_0x230b('0xb2')][_0x5d5b37]['dataValues']));_0x2797af[_0x230b('0x8f')](_0x17ebbe(_0x230b('0xba'),_0x4a6e21[_0x230b('0xb2')][_0x5d5b37]['dataValues']));}return Promise[_0x230b('0x92')](_0x2797af)[_0x230b('0x7')](function(){return _0x4a6e21;});}return _0x4a6e21;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 055fc1b..627633a 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 _0x0424=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./userProfile.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','UserProfile,\x20%s,\x20%s','message'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0x0424,0x159));var _0x4042=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x0424[_0x1203f];return _0x365f0a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});config[_0x4042('0x9')]=_[_0x4042('0xa')](config[_0x4042('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4042('0x9')]));require(_0x4042('0xb'))[_0x4042('0xc')](socket);function respondWithRpcPromise(_0x4b92d2,_0x341152,_0x11c0f7){return new BPromise(function(_0x2376a4,_0x2cbc75){return client[_0x4042('0xd')](_0x4b92d2,_0x11c0f7)[_0x4042('0xe')](function(_0x380aa0){logger[_0x4042('0xf')]('UserProfile,\x20%s,\x20%s',_0x341152,_0x4042('0x10'));logger[_0x4042('0x11')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x341152,_0x4042('0x10'),JSON[_0x4042('0x12')](_0x380aa0));if(_0x380aa0[_0x4042('0x13')]){if(_0x380aa0[_0x4042('0x13')][_0x4042('0x14')]===0x1f4){logger[_0x4042('0x13')](_0x4042('0x15'),_0x341152,_0x380aa0['error'][_0x4042('0x16')]);return _0x2cbc75(_0x380aa0[_0x4042('0x13')]['message']);}logger[_0x4042('0x13')](_0x4042('0x15'),_0x341152,_0x380aa0[_0x4042('0x13')][_0x4042('0x16')]);return _0x2376a4(_0x380aa0[_0x4042('0x13')][_0x4042('0x16')]);}else{logger[_0x4042('0xf')](_0x4042('0x15'),_0x341152,_0x4042('0x10'));_0x2376a4(_0x380aa0['result'][_0x4042('0x16')]);}})['catch'](function(_0x9c8357){logger['error'](_0x4042('0x15'),_0x341152,_0x9c8357);_0x2cbc75(_0x9c8357);});});} \ No newline at end of file +var _0x8325=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','randomstring'];(function(_0x40e3c4,_0x58d6db){var _0x3a95aa=function(_0x5b6743){while(--_0x5b6743){_0x40e3c4['push'](_0x40e3c4['shift']());}};_0x3a95aa(++_0x58d6db);}(_0x8325,0x1f1));var _0x5832=function(_0x1055fb,_0x4cf1f1){_0x1055fb=_0x1055fb-0x0;var _0x25dcfc=_0x8325[_0x1055fb];return _0x25dcfc;};'use strict';var _=require(_0x5832('0x0'));var util=require('util');var moment=require(_0x5832('0x1'));var BPromise=require('bluebird');var rs=require(_0x5832('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5832('0x3'))['db'];var utils=require(_0x5832('0x4'));var logger=require(_0x5832('0x5'))(_0x5832('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5832('0x7')][_0x5832('0x8')]({'port':0x232a});config[_0x5832('0x9')]=_[_0x5832('0xa')](config[_0x5832('0x9')],{'host':_0x5832('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5832('0x9')]));require(_0x5832('0xc'))[_0x5832('0xd')](socket);function respondWithRpcPromise(_0x1cd204,_0x1bea07,_0x1aae71){return new BPromise(function(_0x369013,_0x43c40e){return client[_0x5832('0xe')](_0x1cd204,_0x1aae71)['then'](function(_0x5b8ed3){logger[_0x5832('0xf')](_0x5832('0x10'),_0x1bea07,_0x5832('0x11'));logger[_0x5832('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x1bea07,'request\x20sent',JSON[_0x5832('0x13')](_0x5b8ed3));if(_0x5b8ed3[_0x5832('0x14')]){if(_0x5b8ed3[_0x5832('0x14')][_0x5832('0x15')]===0x1f4){logger['error'](_0x5832('0x10'),_0x1bea07,_0x5b8ed3[_0x5832('0x14')][_0x5832('0x16')]);return _0x43c40e(_0x5b8ed3[_0x5832('0x14')]['message']);}logger[_0x5832('0x14')](_0x5832('0x10'),_0x1bea07,_0x5b8ed3[_0x5832('0x14')]['message']);return _0x369013(_0x5b8ed3[_0x5832('0x14')][_0x5832('0x16')]);}else{logger[_0x5832('0xf')](_0x5832('0x10'),_0x1bea07,_0x5832('0x11'));_0x369013(_0x5b8ed3[_0x5832('0x17')][_0x5832('0x16')]);}})[_0x5832('0x18')](function(_0x89efcd){logger[_0x5832('0x14')]('UserProfile,\x20%s,\x20%s',_0x1bea07,_0x89efcd);_0x43c40e(_0x89efcd);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index c4156cc..fd6da1c 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 _0xf29e=['userProfile:','./userProfile.events','save','remove','update','emit','removeListener','register','length'];(function(_0x1a39f3,_0x4d06ce){var _0x4cf744=function(_0x58cca0){while(--_0x58cca0){_0x1a39f3['push'](_0x1a39f3['shift']());}};_0x4cf744(++_0x4d06ce);}(_0xf29e,0x12a));var _0xef29=function(_0x1c97d8,_0x52878a){_0x1c97d8=_0x1c97d8-0x0;var _0x541fcb=_0xf29e[_0x1c97d8];return _0x541fcb;};'use strict';var UserProfileEvents=require(_0xef29('0x0'));var events=[_0xef29('0x1'),_0xef29('0x2'),_0xef29('0x3')];function createListener(_0x1f06b7,_0x3e45e9){return function(_0x483724){_0x3e45e9[_0xef29('0x4')](_0x1f06b7,_0x483724);};}function removeListener(_0x3a1eb4,_0x5a6681){return function(){UserProfileEvents[_0xef29('0x5')](_0x3a1eb4,_0x5a6681);};}exports[_0xef29('0x6')]=function(_0x3a08ce){for(var _0x576b16=0x0,_0x4bfdea=events[_0xef29('0x7')];_0x576b16<_0x4bfdea;_0x576b16++){var _0x5d653d=events[_0x576b16];var _0x3b9581=createListener(_0xef29('0x8')+_0x5d653d,_0x3a08ce);UserProfileEvents['on'](_0x5d653d,_0x3b9581);}}; \ No newline at end of file +var _0xb71c=['register','length','save','remove','update','removeListener'];(function(_0x26ebf2,_0x55a4f5){var _0xa94c6b=function(_0x2f9b3a){while(--_0x2f9b3a){_0x26ebf2['push'](_0x26ebf2['shift']());}};_0xa94c6b(++_0x55a4f5);}(_0xb71c,0x1a6));var _0xcb71=function(_0x59f842,_0x10790b){_0x59f842=_0x59f842-0x0;var _0x311130=_0xb71c[_0x59f842];return _0x311130;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xcb71('0x0'),_0xcb71('0x1'),_0xcb71('0x2')];function createListener(_0x270d58,_0x16d355){return function(_0x58dfdd){_0x16d355['emit'](_0x270d58,_0x58dfdd);};}function removeListener(_0x1ca514,_0x2b7fa9){return function(){UserProfileEvents[_0xcb71('0x3')](_0x1ca514,_0x2b7fa9);};}exports[_0xcb71('0x4')]=function(_0x105739){for(var _0x33ff57=0x0,_0xfc6deb=events[_0xcb71('0x5')];_0x33ff57<_0xfc6deb;_0x33ff57++){var _0x5aa1f1=events[_0x33ff57];var _0x28bb29=createListener('userProfile:'+_0x5aa1f1,_0x105739);UserProfileEvents['on'](_0x5aa1f1,_0x28bb29);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 17fb67b..2e9f8b1 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 _0xf72f=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','destroy','exports','multer'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0xf72f,0x1e3));var _0xff72=function(_0x56ffd3,_0x2c7c8d){_0x56ffd3=_0x56ffd3-0x0;var _0x287e28=_0xf72f[_0x56ffd3];return _0x287e28;};'use strict';var multer=require(_0xff72('0x0'));var util=require(_0xff72('0x1'));var path=require(_0xff72('0x2'));var timeout=require(_0xff72('0x3'));var express=require(_0xff72('0x4'));var router=express[_0xff72('0x5')]();var fs_extra=require(_0xff72('0x6'));var auth=require(_0xff72('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xff72('0x8'));var controller=require(_0xff72('0x9'));router[_0xff72('0xa')]('/',auth['isAuthenticated'](),controller[_0xff72('0xb')]);router['get'](_0xff72('0xc'),auth[_0xff72('0xd')](),controller[_0xff72('0xe')]);router[_0xff72('0xa')](_0xff72('0xf'),auth['isAuthenticated'](),controller[_0xff72('0x10')]);router[_0xff72('0x11')]('/',auth[_0xff72('0xd')](),controller[_0xff72('0x12')]);router['put']('/:id',auth[_0xff72('0xd')](),controller[_0xff72('0x13')]);router['delete'](_0xff72('0xf'),auth[_0xff72('0xd')](),controller[_0xff72('0x14')]);module[_0xff72('0x15')]=router; \ No newline at end of file +var _0x37fb=['delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','update'];(function(_0x45e802,_0x154387){var _0x13cc7a=function(_0x10deaf){while(--_0x10deaf){_0x45e802['push'](_0x45e802['shift']());}};_0x13cc7a(++_0x154387);}(_0x37fb,0x151));var _0xb37f=function(_0x1dfc45,_0x22b3ef){_0x1dfc45=_0x1dfc45-0x0;var _0x3cfcdf=_0x37fb[_0x1dfc45];return _0x3cfcdf;};'use strict';var multer=require(_0xb37f('0x0'));var util=require(_0xb37f('0x1'));var path=require(_0xb37f('0x2'));var timeout=require(_0xb37f('0x3'));var express=require(_0xb37f('0x4'));var router=express[_0xb37f('0x5')]();var fs_extra=require(_0xb37f('0x6'));var auth=require(_0xb37f('0x7'));var interaction=require(_0xb37f('0x8'));var config=require('../../config/environment');var controller=require(_0xb37f('0x9'));router[_0xb37f('0xa')]('/',auth[_0xb37f('0xb')](),controller[_0xb37f('0xc')]);router[_0xb37f('0xa')](_0xb37f('0xd'),auth[_0xb37f('0xb')](),controller[_0xb37f('0xe')]);router[_0xb37f('0xa')]('/:id',auth[_0xb37f('0xb')](),controller[_0xb37f('0xf')]);router[_0xb37f('0x10')]('/',auth[_0xb37f('0xb')](),controller[_0xb37f('0x11')]);router['put'](_0xb37f('0x12'),auth[_0xb37f('0xb')](),controller[_0xb37f('0x13')]);router[_0xb37f('0x14')](_0xb37f('0x12'),auth[_0xb37f('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 460eabb..4407cdc 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 _0x136b=['INTEGER','STRING','sequelize','exports'];(function(_0x3d232d,_0x272464){var _0x5adc5e=function(_0x3ae2f4){while(--_0x3ae2f4){_0x3d232d['push'](_0x3d232d['shift']());}};_0x5adc5e(++_0x272464);}(_0x136b,0x186));var _0xb136=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x136b[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0xb136('0x0'));module[_0xb136('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb136('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb136('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xdb9f=['exports','STRING','INTEGER','sequelize'];(function(_0x4afba1,_0x37c710){var _0x329112=function(_0x3202ce){while(--_0x3202ce){_0x4afba1['push'](_0x4afba1['shift']());}};_0x329112(++_0x37c710);}(_0xdb9f,0xa7));var _0xfdb9=function(_0x58cbde,_0x4b0f62){_0x58cbde=_0x58cbde-0x0;var _0x5799f3=_0xdb9f[_0x58cbde];return _0x5799f3;};'use strict';var Sequelize=require(_0xfdb9('0x0'));module[_0xfdb9('0x1')]={'name':{'type':Sequelize[_0xfdb9('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xfdb9('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xfdb9('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index df84a59..05b138b 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 _0x8952=['filter','VIRTUAL','merge','options','findAll','rows','show','params','keys','includeAll','include','catch','create','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','stack','name','map','UserProfileResource','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x8952,0x17e));var _0x2895=function(_0x5a5f2b,_0x1700ec){_0x5a5f2b=_0x5a5f2b-0x0;var _0x427954=_0x8952[_0x5a5f2b];return _0x427954;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2895('0x0'));var zipdir=require(_0x2895('0x1'));var jsonpatch=require(_0x2895('0x2'));var rp=require(_0x2895('0x3'));var moment=require(_0x2895('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2895('0x5'));var util=require(_0x2895('0x6'));var path=require(_0x2895('0x7'));var sox=require('sox');var csv=require(_0x2895('0x8'));var ejs=require(_0x2895('0x9'));var fs=require('fs');var fs_extra=require(_0x2895('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x8'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];function respondWithStatusCode(_0x3924be,_0x4b1342){_0x4b1342=_0x4b1342||0xcc;return function(_0x32574c){if(_0x32574c){return _0x3924be[_0x2895('0x15')](_0x4b1342);}return _0x3924be['status'](_0x4b1342)['end']();};}function respondWithResult(_0x1d1493,_0x2ca2ac){_0x2ca2ac=_0x2ca2ac||0xc8;return function(_0x5777a0){if(_0x5777a0){return _0x1d1493[_0x2895('0x16')](_0x2ca2ac)[_0x2895('0x17')](_0x5777a0);}};}function respondWithFilteredResult(_0x27b50e,_0x1ae013){return function(_0x1d3659){if(_0x1d3659){var _0x2627e6=typeof _0x1ae013[_0x2895('0x18')]===_0x2895('0x19')&&typeof _0x1ae013[_0x2895('0x1a')]===_0x2895('0x19');var _0x10a1bf=_0x1d3659[_0x2895('0x1b')];var _0xbf8b63=_0x2627e6?0x0:_0x1ae013[_0x2895('0x18')];var _0x155124=_0x2627e6?_0x1d3659[_0x2895('0x1b')]:_0x1ae013[_0x2895('0x18')]+_0x1ae013[_0x2895('0x1a')];var _0x5a8eab;if(_0x155124>=_0x10a1bf){_0x155124=_0x10a1bf;_0x5a8eab=0xc8;}else{_0x5a8eab=0xce;}_0x27b50e['status'](_0x5a8eab);return _0x27b50e['set'](_0x2895('0x1c'),_0xbf8b63+'-'+_0x155124+'/'+_0x10a1bf)[_0x2895('0x17')](_0x1d3659);}return null;};}function patchUpdates(_0x3ec4da){return function(_0x593e47){try{jsonpatch[_0x2895('0x1d')](_0x593e47,_0x3ec4da,!![]);}catch(_0x190b79){return BPromise[_0x2895('0x1e')](_0x190b79);}return _0x593e47[_0x2895('0x1f')]();};}function saveUpdates(_0x8b75e0,_0x5dbbfe){return function(_0x30c6c3){if(_0x30c6c3){return _0x30c6c3[_0x2895('0x20')](_0x8b75e0)['then'](function(_0x142e58){return _0x142e58;});}return null;};}function removeEntity(_0x384357,_0x6f8ad4){return function(_0x511286){if(_0x511286){return _0x511286['destroy']()[_0x2895('0x21')](function(){_0x384357[_0x2895('0x16')](0xcc)[_0x2895('0x22')]();});}};}function handleEntityNotFound(_0x4a21cf,_0x3d3320){return function(_0x3690ce){if(!_0x3690ce){_0x4a21cf['sendStatus'](0x194);}return _0x3690ce;};}function handleError(_0x293ad3,_0x127540){_0x127540=_0x127540||0x1f4;return function(_0x2cd4df){logger['error'](_0x2cd4df[_0x2895('0x23')]);if(_0x2cd4df[_0x2895('0x24')]){delete _0x2cd4df['name'];}_0x293ad3[_0x2895('0x16')](_0x127540)['send'](_0x2cd4df);};}exports['index']=function(_0x18a935,_0x4ee2cc){var _0xfa4f85={},_0x381538={},_0x4fdd94={'count':0x0,'rows':[]};var _0x5574bf=_[_0x2895('0x25')](db[_0x2895('0x26')][_0x2895('0x27')],function(_0x14e343){return{'name':_0x14e343[_0x2895('0x28')],'type':_0x14e343[_0x2895('0x29')][_0x2895('0x2a')]};});_0x381538['model']=_[_0x2895('0x25')](_0x5574bf,_0x2895('0x24'));_0x381538[_0x2895('0x2b')]=_['keys'](_0x18a935[_0x2895('0x2b')]);_0x381538[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],_0x381538['query']);_0xfa4f85[_0x2895('0x2f')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x18a935[_0x2895('0x2b')]['fields']));_0xfa4f85['attributes']=_0xfa4f85[_0x2895('0x2f')][_0x2895('0x31')]?_0xfa4f85['attributes']:_0x381538[_0x2895('0x2e')];if(!_0x18a935['query'][_0x2895('0x32')](_0x2895('0x33'))){_0xfa4f85['limit']=qs[_0x2895('0x1a')](_0x18a935['query'][_0x2895('0x1a')]);_0xfa4f85['offset']=qs['offset'](_0x18a935[_0x2895('0x2b')][_0x2895('0x18')]);}_0xfa4f85[_0x2895('0x34')]=qs['sort'](_0x18a935[_0x2895('0x2b')][_0x2895('0x35')]);_0xfa4f85[_0x2895('0x36')]=qs[_0x2895('0x2c')](_[_0x2895('0x37')](_0x18a935[_0x2895('0x2b')],_0x381538[_0x2895('0x2c')]),_0x5574bf);if(_0x18a935[_0x2895('0x2b')][_0x2895('0x38')]){_0xfa4f85[_0x2895('0x36')]=_['merge'](_0xfa4f85[_0x2895('0x36')],{'$or':_[_0x2895('0x25')](_0x5574bf,function(_0x47413d){if(_0x47413d[_0x2895('0x29')]!==_0x2895('0x39')){var _0x12d7d8={};_0x12d7d8[_0x47413d[_0x2895('0x24')]]={'$like':'%'+_0x18a935['query']['filter']+'%'};return _0x12d7d8;}})});}_0xfa4f85=_[_0x2895('0x3a')]({},_0xfa4f85,_0x18a935[_0x2895('0x3b')]);var _0x24b9e0={'where':_0xfa4f85[_0x2895('0x36')]};return db[_0x2895('0x26')][_0x2895('0x1b')](_0x24b9e0)['then'](function(_0x5d18ef){_0x4fdd94[_0x2895('0x1b')]=_0x5d18ef;if(_0x18a935[_0x2895('0x2b')]['includeAll']){_0xfa4f85['include']=[{'all':!![]}];}return db[_0x2895('0x26')][_0x2895('0x3c')](_0xfa4f85);})[_0x2895('0x21')](function(_0x28967f){_0x4fdd94[_0x2895('0x3d')]=_0x28967f;return _0x4fdd94;})[_0x2895('0x21')](respondWithFilteredResult(_0x4ee2cc,_0xfa4f85))['catch'](handleError(_0x4ee2cc,null));};exports[_0x2895('0x3e')]=function(_0x2cfb24,_0x18ca24){var _0x1537fd={'raw':![],'where':{'id':_0x2cfb24[_0x2895('0x3f')]['id']}},_0x4af6d6={};_0x4af6d6[_0x2895('0x2e')]=_[_0x2895('0x40')](db[_0x2895('0x26')]['rawAttributes']);_0x4af6d6['query']=_[_0x2895('0x40')](_0x2cfb24[_0x2895('0x2b')]);_0x4af6d6[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],_0x4af6d6['query']);_0x1537fd['attributes']=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x2cfb24[_0x2895('0x2b')][_0x2895('0x30')]));_0x1537fd[_0x2895('0x2f')]=_0x1537fd[_0x2895('0x2f')]['length']?_0x1537fd[_0x2895('0x2f')]:_0x4af6d6[_0x2895('0x2e')];if(_0x2cfb24[_0x2895('0x2b')][_0x2895('0x41')]){_0x1537fd[_0x2895('0x42')]=[{'all':!![]}];}_0x1537fd=_[_0x2895('0x3a')]({},_0x1537fd,_0x2cfb24[_0x2895('0x3b')]);return db[_0x2895('0x26')]['find'](_0x1537fd)[_0x2895('0x21')](handleEntityNotFound(_0x18ca24,null))[_0x2895('0x21')](respondWithResult(_0x18ca24,null))[_0x2895('0x43')](handleError(_0x18ca24,null));};exports['create']=function(_0xc85aa1,_0x5307a9){return db['UserProfileResource'][_0x2895('0x44')](_0xc85aa1[_0x2895('0x45')],{})[_0x2895('0x21')](respondWithResult(_0x5307a9,0xc9))[_0x2895('0x43')](handleError(_0x5307a9,null));};exports[_0x2895('0x20')]=function(_0x3cc331,_0x11e53a){if(_0x3cc331['body']['id']){delete _0x3cc331[_0x2895('0x45')]['id'];}return db[_0x2895('0x26')]['find']({'where':{'id':_0x3cc331['params']['id']}})['then'](handleEntityNotFound(_0x11e53a,null))[_0x2895('0x21')](saveUpdates(_0x3cc331[_0x2895('0x45')],null))[_0x2895('0x21')](respondWithResult(_0x11e53a,null))[_0x2895('0x43')](handleError(_0x11e53a,null));};exports[_0x2895('0x46')]=function(_0x3c5261,_0xaca46c){return db[_0x2895('0x26')][_0x2895('0x47')]({'where':{'id':_0x3c5261[_0x2895('0x3f')]['id']}})[_0x2895('0x21')](handleEntityNotFound(_0xaca46c,null))[_0x2895('0x21')](removeEntity(_0xaca46c,null))[_0x2895('0x43')](handleError(_0xaca46c,null));};exports[_0x2895('0x48')]=function(_0x356d35,_0x3c1135){return db[_0x2895('0x26')][_0x2895('0x48')]()[_0x2895('0x21')](respondWithResult(_0x3c1135,null))[_0x2895('0x43')](handleError(_0x3c1135,null));}; \ No newline at end of file +var _0x4975=['to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','UserProfileResource','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x227a28,_0x195583){var _0x40444a=function(_0x112ce7){while(--_0x112ce7){_0x227a28['push'](_0x227a28['shift']());}};_0x40444a(++_0x195583);}(_0x4975,0x86));var _0x5497=function(_0x51ec69,_0x1c3ccb){_0x51ec69=_0x51ec69-0x0;var _0x1549b0=_0x4975[_0x51ec69];return _0x1549b0;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['UserProfileResource']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['UserProfileResource'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));};exports['describe']=function(_0x1f73eb,_0x5b2c22){return db['UserProfileResource'][_0x5497('0x47')]()[_0x5497('0x24')](respondWithResult(_0x5b2c22,null))['catch'](handleError(_0x5b2c22,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 01d2fb5..acc9a77 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 _0x3cc8=['path','rimraf','../../config/environment','exports','define','compositeIndex','resourceId','../../config/logger','api','moment','request-promise'];(function(_0x27ec50,_0x1d8698){var _0x2da0f5=function(_0x206a3e){while(--_0x206a3e){_0x27ec50['push'](_0x27ec50['shift']());}};_0x2da0f5(++_0x1d8698);}(_0x3cc8,0x188));var _0x83cc=function(_0x47d51c,_0x10b7a0){_0x47d51c=_0x47d51c-0x0;var _0x1bc575=_0x3cc8[_0x47d51c];return _0x1bc575;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x83cc('0x0'))(_0x83cc('0x1'));var moment=require(_0x83cc('0x2'));var BPromise=require('bluebird');var rp=require(_0x83cc('0x3'));var fs=require('fs');var path=require(_0x83cc('0x4'));var rimraf=require(_0x83cc('0x5'));var config=require(_0x83cc('0x6'));var attributes=require('./userProfileResource.attributes');module[_0x83cc('0x7')]=function(_0x5e1d05,_0x5bcfc0){return _0x5e1d05[_0x83cc('0x8')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x83cc('0x9'),'fields':[_0x83cc('0xa'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5444=['compositeIndex','resourceId','sectionId','util','../../config/logger','api','path','./userProfileResource.attributes','exports','define','user_profile_has_resources'];(function(_0x13f255,_0xcc8b3b){var _0x360711=function(_0xf6e1ee){while(--_0xf6e1ee){_0x13f255['push'](_0x13f255['shift']());}};_0x360711(++_0xcc8b3b);}(_0x5444,0xdf));var _0x4544=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5444[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4544('0x0'));var logger=require(_0x4544('0x1'))(_0x4544('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4544('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4544('0x4'));module[_0x4544('0x5')]=function(_0x346cef,_0xa04251){return _0x346cef[_0x4544('0x6')]('UserProfileResource',attributes,{'tableName':_0x4544('0x7'),'paranoid':![],'indexes':[{'name':_0x4544('0x8'),'fields':[_0x4544('0x9'),_0x4544('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index e74c55c..2414ecc 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 _0xa814=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x4c9759,_0x27c520){var _0x3c7c4f=function(_0x1b28c2){while(--_0x1b28c2){_0x4c9759['push'](_0x4c9759['shift']());}};_0x3c7c4f(++_0x27c520);}(_0xa814,0xb9));var _0x4a81=function(_0x5068ab,_0x509309){_0x5068ab=_0x5068ab-0x0;var _0x145d33=_0xa814[_0x5068ab];return _0x145d33;};'use strict';var _=require(_0x4a81('0x0'));var util=require(_0x4a81('0x1'));var moment=require(_0x4a81('0x2'));var BPromise=require(_0x4a81('0x3'));var rs=require(_0x4a81('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a81('0x5'))['db'];var utils=require(_0x4a81('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4a81('0x7')][_0x4a81('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d1243,_0x41064e,_0x1082e2){return new BPromise(function(_0x21c71a,_0x17555d){return client[_0x4a81('0x9')](_0x5d1243,_0x1082e2)[_0x4a81('0xa')](function(_0x5a6dbc){logger[_0x4a81('0xb')](_0x4a81('0xc'),_0x41064e,_0x4a81('0xd'));logger['debug'](_0x4a81('0xe'),_0x41064e,_0x4a81('0xd'),JSON[_0x4a81('0xf')](_0x5a6dbc));if(_0x5a6dbc[_0x4a81('0x10')]){if(_0x5a6dbc[_0x4a81('0x10')][_0x4a81('0x11')]===0x1f4){logger[_0x4a81('0x10')](_0x4a81('0xc'),_0x41064e,_0x5a6dbc['error']['message']);return _0x17555d(_0x5a6dbc['error'][_0x4a81('0x12')]);}logger[_0x4a81('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x41064e,_0x5a6dbc['error'][_0x4a81('0x12')]);return _0x21c71a(_0x5a6dbc[_0x4a81('0x10')][_0x4a81('0x12')]);}else{logger['info'](_0x4a81('0xc'),_0x41064e,'request\x20sent');_0x21c71a(_0x5a6dbc[_0x4a81('0x13')]['message']);}})['catch'](function(_0x1804f1){logger[_0x4a81('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x41064e,_0x1804f1);_0x17555d(_0x1804f1);});});} \ No newline at end of file +var _0xcbb0=['../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1792a8,_0x4217f3){var _0x18e67d=function(_0x332d6d){while(--_0x332d6d){_0x1792a8['push'](_0x1792a8['shift']());}};_0x18e67d(++_0x4217f3);}(_0xcbb0,0x16a));var _0x0cbb=function(_0x102b2c,_0x3f03ec){_0x102b2c=_0x102b2c-0x0;var _0x2d902f=_0xcbb0[_0x102b2c];return _0x2d902f;};'use strict';var _=require(_0x0cbb('0x0'));var util=require(_0x0cbb('0x1'));var moment=require(_0x0cbb('0x2'));var BPromise=require(_0x0cbb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0cbb('0x4'));var db=require(_0x0cbb('0x5'))['db'];var utils=require(_0x0cbb('0x6'));var logger=require(_0x0cbb('0x7'))(_0x0cbb('0x8'));var config=require(_0x0cbb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0cbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x419550,_0x5d6283,_0x15e0a7){return new BPromise(function(_0x48de11,_0x10f227){return client['request'](_0x419550,_0x15e0a7)[_0x0cbb('0xb')](function(_0x464d77){logger[_0x0cbb('0xc')](_0x0cbb('0xd'),_0x5d6283,'request\x20sent');logger[_0x0cbb('0xe')](_0x0cbb('0xf'),_0x5d6283,'request\x20sent',JSON[_0x0cbb('0x10')](_0x464d77));if(_0x464d77['error']){if(_0x464d77[_0x0cbb('0x11')][_0x0cbb('0x12')]===0x1f4){logger[_0x0cbb('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x5d6283,_0x464d77[_0x0cbb('0x11')][_0x0cbb('0x13')]);return _0x10f227(_0x464d77[_0x0cbb('0x11')][_0x0cbb('0x13')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x5d6283,_0x464d77[_0x0cbb('0x11')][_0x0cbb('0x13')]);return _0x48de11(_0x464d77[_0x0cbb('0x11')][_0x0cbb('0x13')]);}else{logger[_0x0cbb('0xc')](_0x0cbb('0xd'),_0x5d6283,_0x0cbb('0x14'));_0x48de11(_0x464d77[_0x0cbb('0x15')][_0x0cbb('0x13')]);}})[_0x0cbb('0x16')](function(_0x47a7df){logger[_0x0cbb('0x11')](_0x0cbb('0xd'),_0x5d6283,_0x47a7df);_0x10f227(_0x47a7df);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index b59548c..e436f0d 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 _0xa4c0=['isAuthenticated','index','get','/describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xa4c0,0x12b));var _0x0a4c=function(_0x408357,_0x56042b){_0x408357=_0x408357-0x0;var _0x55812f=_0xa4c0[_0x408357];return _0x55812f;};'use strict';var multer=require(_0x0a4c('0x0'));var util=require(_0x0a4c('0x1'));var path=require('path');var timeout=require(_0x0a4c('0x2'));var express=require('express');var router=express[_0x0a4c('0x3')]();var fs_extra=require(_0x0a4c('0x4'));var auth=require(_0x0a4c('0x5'));var interaction=require(_0x0a4c('0x6'));var config=require(_0x0a4c('0x7'));var controller=require(_0x0a4c('0x8'));router['get']('/',auth[_0x0a4c('0x9')](),controller[_0x0a4c('0xa')]);router[_0x0a4c('0xb')](_0x0a4c('0xc'),auth[_0x0a4c('0x9')](),controller['describe']);router[_0x0a4c('0xb')]('/:id',auth[_0x0a4c('0x9')](),controller[_0x0a4c('0xd')]);router[_0x0a4c('0xe')]('/',auth[_0x0a4c('0x9')](),controller[_0x0a4c('0xf')]);router[_0x0a4c('0x10')](_0x0a4c('0x11'),auth['isAuthenticated'](),controller[_0x0a4c('0x12')]);router[_0x0a4c('0x13')](_0x0a4c('0x11'),auth['isAuthenticated'](),controller[_0x0a4c('0x14')]);module[_0x0a4c('0x15')]=router; \ No newline at end of file +var _0x8082=['/describe','/:id','post','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x5e8eae,_0x4f81e0){var _0xdd09cd=function(_0x28c85c){while(--_0x28c85c){_0x5e8eae['push'](_0x5e8eae['shift']());}};_0xdd09cd(++_0x4f81e0);}(_0x8082,0xbb));var _0x2808=function(_0xbb6806,_0x25b440){_0xbb6806=_0xbb6806-0x0;var _0x183cc2=_0x8082[_0xbb6806];return _0x183cc2;};'use strict';var multer=require(_0x2808('0x0'));var util=require(_0x2808('0x1'));var path=require(_0x2808('0x2'));var timeout=require('connect-timeout');var express=require(_0x2808('0x3'));var router=express[_0x2808('0x4')]();var fs_extra=require(_0x2808('0x5'));var auth=require(_0x2808('0x6'));var interaction=require(_0x2808('0x7'));var config=require(_0x2808('0x8'));var controller=require('./userProfileSection.controller');router['get']('/',auth[_0x2808('0x9')](),controller[_0x2808('0xa')]);router['get'](_0x2808('0xb'),auth[_0x2808('0x9')](),controller['describe']);router['get'](_0x2808('0xc'),auth[_0x2808('0x9')](),controller['show']);router[_0x2808('0xd')]('/',auth[_0x2808('0x9')](),controller['create']);router[_0x2808('0xe')](_0x2808('0xc'),auth[_0x2808('0x9')](),controller['update']);router[_0x2808('0xf')](_0x2808('0xc'),auth[_0x2808('0x9')](),controller[_0x2808('0x10')]);module[_0x2808('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 53a6183..6ba7bce 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 _0xd824=['STRING','setDataValue','getDataValue','crudPermissions','split','sequelize','exports','INTEGER','BOOLEAN'];(function(_0x485303,_0x503f27){var _0x15532f=function(_0x4a28c4){while(--_0x4a28c4){_0x485303['push'](_0x485303['shift']());}};_0x15532f(++_0x503f27);}(_0xd824,0xc2));var _0x4d82=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd824[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4d82('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4d82('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4d82('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4d82('0x4')],'set':function(_0x287fbf){this[_0x4d82('0x5')]('crudPermissions',_0x287fbf?_0x287fbf['join'](''):[]);},'get':function(){return this[_0x4d82('0x6')]('crudPermissions')?this['getDataValue'](_0x4d82('0x7'))[_0x4d82('0x8')](''):[];}}}; \ No newline at end of file +var _0x9ffd=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0x56b878,_0x4be9aa){var _0x32b9ec=function(_0x1511ea){while(--_0x1511ea){_0x56b878['push'](_0x56b878['shift']());}};_0x32b9ec(++_0x4be9aa);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2688dc,_0x500741){_0x2688dc=_0x2688dc-0x0;var _0x2f1f38=_0x9ffd[_0x2688dc];return _0x2f1f38;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'name':{'type':Sequelize[_0xd9ff('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd9ff('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd9ff('0x2')],'set':function(_0x53e962){this[_0xd9ff('0x5')](_0xd9ff('0x6'),_0x53e962?_0x53e962['join'](''):[]);},'get':function(){return this[_0xd9ff('0x7')](_0xd9ff('0x6'))?this[_0xd9ff('0x7')](_0xd9ff('0x6'))[_0xd9ff('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 33f3072..870c5cd 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 _0xd088=['error','stack','name','send','index','map','UserProfileSection','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','body','find','describe','rimraf','zip-dir','request-promise','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x12ba09,_0x4285b2){var _0x3d9064=function(_0x327389){while(--_0x327389){_0x12ba09['push'](_0x12ba09['shift']());}};_0x3d9064(++_0x4285b2);}(_0xd088,0x1ed));var _0x8d08=function(_0x544d98,_0x3b9056){_0x544d98=_0x544d98-0x0;var _0x19ab0d=_0xd088[_0x544d98];return _0x19ab0d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d08('0x0'));var zipdir=require(_0x8d08('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d08('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8d08('0x3'));var util=require(_0x8d08('0x4'));var path=require('path');var sox=require(_0x8d08('0x5'));var csv=require('to-csv');var ejs=require(_0x8d08('0x6'));var fs=require('fs');var fs_extra=require(_0x8d08('0x7'));var _=require('lodash');var squel=require(_0x8d08('0x8'));var crypto=require(_0x8d08('0x9'));var jsforce=require(_0x8d08('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8d08('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8d08('0xc'));var authService=require(_0x8d08('0xd'));var qs=require(_0x8d08('0xe'));var as=require(_0x8d08('0xf'));var hardwareService=require(_0x8d08('0x10'));var logger=require(_0x8d08('0x11'))(_0x8d08('0x12'));var utils=require(_0x8d08('0x13'));var config=require(_0x8d08('0x14'));var licenseUtil=require(_0x8d08('0x15'));var db=require(_0x8d08('0x16'))['db'];function respondWithStatusCode(_0x38d5eb,_0x5bdc2b){_0x5bdc2b=_0x5bdc2b||0xcc;return function(_0x47820e){if(_0x47820e){return _0x38d5eb[_0x8d08('0x17')](_0x5bdc2b);}return _0x38d5eb[_0x8d08('0x18')](_0x5bdc2b)[_0x8d08('0x19')]();};}function respondWithResult(_0x55c429,_0x277618){_0x277618=_0x277618||0xc8;return function(_0x2b6628){if(_0x2b6628){return _0x55c429[_0x8d08('0x18')](_0x277618)[_0x8d08('0x1a')](_0x2b6628);}};}function respondWithFilteredResult(_0x12d145,_0x27b6e1){return function(_0x8bd524){if(_0x8bd524){var _0x392e23=typeof _0x27b6e1[_0x8d08('0x1b')]==='undefined'&&typeof _0x27b6e1[_0x8d08('0x1c')]===_0x8d08('0x1d');var _0x38db6a=_0x8bd524[_0x8d08('0x1e')];var _0x1f7099=_0x392e23?0x0:_0x27b6e1[_0x8d08('0x1b')];var _0x4ecf4e=_0x392e23?_0x8bd524[_0x8d08('0x1e')]:_0x27b6e1[_0x8d08('0x1b')]+_0x27b6e1[_0x8d08('0x1c')];var _0x5b3d06;if(_0x4ecf4e>=_0x38db6a){_0x4ecf4e=_0x38db6a;_0x5b3d06=0xc8;}else{_0x5b3d06=0xce;}_0x12d145['status'](_0x5b3d06);return _0x12d145[_0x8d08('0x1f')](_0x8d08('0x20'),_0x1f7099+'-'+_0x4ecf4e+'/'+_0x38db6a)[_0x8d08('0x1a')](_0x8bd524);}return null;};}function patchUpdates(_0x532ca2){return function(_0x5b2f0b){try{jsonpatch[_0x8d08('0x21')](_0x5b2f0b,_0x532ca2,!![]);}catch(_0x30d222){return BPromise[_0x8d08('0x22')](_0x30d222);}return _0x5b2f0b[_0x8d08('0x23')]();};}function saveUpdates(_0x2f3d8a,_0x235e3b){return function(_0x3ed849){if(_0x3ed849){return _0x3ed849[_0x8d08('0x24')](_0x2f3d8a)[_0x8d08('0x25')](function(_0x1fc105){return _0x1fc105;});}return null;};}function removeEntity(_0x2a775b,_0x26a8e0){return function(_0x10c2d9){if(_0x10c2d9){return _0x10c2d9[_0x8d08('0x26')]()[_0x8d08('0x25')](function(){_0x2a775b[_0x8d08('0x18')](0xcc)[_0x8d08('0x19')]();});}};}function handleEntityNotFound(_0x544aed,_0x4103a4){return function(_0x124567){if(!_0x124567){_0x544aed[_0x8d08('0x17')](0x194);}return _0x124567;};}function handleError(_0x2208b3,_0x4498b1){_0x4498b1=_0x4498b1||0x1f4;return function(_0x3e0069){logger[_0x8d08('0x27')](_0x3e0069[_0x8d08('0x28')]);if(_0x3e0069[_0x8d08('0x29')]){delete _0x3e0069[_0x8d08('0x29')];}_0x2208b3['status'](_0x4498b1)[_0x8d08('0x2a')](_0x3e0069);};}exports[_0x8d08('0x2b')]=function(_0xe84971,_0xd5be13){var _0x41cb67={},_0x18021b={},_0x203059={'count':0x0,'rows':[]};var _0x46dfbc=_[_0x8d08('0x2c')](db[_0x8d08('0x2d')][_0x8d08('0x2e')],function(_0x2be8ab){return{'name':_0x2be8ab['fieldName'],'type':_0x2be8ab[_0x8d08('0x2f')][_0x8d08('0x30')]};});_0x18021b[_0x8d08('0x31')]=_['map'](_0x46dfbc,'name');_0x18021b[_0x8d08('0x32')]=_[_0x8d08('0x33')](_0xe84971[_0x8d08('0x32')]);_0x18021b[_0x8d08('0x34')]=_[_0x8d08('0x35')](_0x18021b['model'],_0x18021b[_0x8d08('0x32')]);_0x41cb67[_0x8d08('0x36')]=_['intersection'](_0x18021b[_0x8d08('0x31')],qs[_0x8d08('0x37')](_0xe84971[_0x8d08('0x32')]['fields']));_0x41cb67[_0x8d08('0x36')]=_0x41cb67[_0x8d08('0x36')][_0x8d08('0x38')]?_0x41cb67[_0x8d08('0x36')]:_0x18021b[_0x8d08('0x31')];if(!_0xe84971['query'][_0x8d08('0x39')]('nolimit')){_0x41cb67['limit']=qs[_0x8d08('0x1c')](_0xe84971[_0x8d08('0x32')]['limit']);_0x41cb67[_0x8d08('0x1b')]=qs['offset'](_0xe84971[_0x8d08('0x32')][_0x8d08('0x1b')]);}_0x41cb67[_0x8d08('0x3a')]=qs[_0x8d08('0x3b')](_0xe84971[_0x8d08('0x32')][_0x8d08('0x3b')]);_0x41cb67[_0x8d08('0x3c')]=qs['filters'](_[_0x8d08('0x3d')](_0xe84971['query'],_0x18021b['filters']),_0x46dfbc);if(_0xe84971[_0x8d08('0x32')][_0x8d08('0x3e')]){_0x41cb67['where']=_[_0x8d08('0x3f')](_0x41cb67[_0x8d08('0x3c')],{'$or':_[_0x8d08('0x2c')](_0x46dfbc,function(_0x51ab82){if(_0x51ab82[_0x8d08('0x2f')]!==_0x8d08('0x40')){var _0x470b77={};_0x470b77[_0x51ab82['name']]={'$like':'%'+_0xe84971[_0x8d08('0x32')][_0x8d08('0x3e')]+'%'};return _0x470b77;}})});}_0x41cb67=_['merge']({},_0x41cb67,_0xe84971[_0x8d08('0x41')]);var _0x279004={'where':_0x41cb67[_0x8d08('0x3c')]};return db[_0x8d08('0x2d')][_0x8d08('0x1e')](_0x279004)['then'](function(_0x1c9162){_0x203059[_0x8d08('0x1e')]=_0x1c9162;if(_0xe84971[_0x8d08('0x32')]['includeAll']){_0x41cb67[_0x8d08('0x42')]=[{'all':!![]}];}return db[_0x8d08('0x2d')][_0x8d08('0x43')](_0x41cb67);})[_0x8d08('0x25')](function(_0x3ef080){_0x203059[_0x8d08('0x44')]=_0x3ef080;return _0x203059;})['then'](respondWithFilteredResult(_0xd5be13,_0x41cb67))[_0x8d08('0x45')](handleError(_0xd5be13,null));};exports[_0x8d08('0x46')]=function(_0x3f4d5b,_0x325e71){var _0x570220={'raw':![],'where':{'id':_0x3f4d5b[_0x8d08('0x47')]['id']}},_0x1b61db={};_0x1b61db[_0x8d08('0x31')]=_[_0x8d08('0x33')](db['UserProfileSection'][_0x8d08('0x2e')]);_0x1b61db[_0x8d08('0x32')]=_['keys'](_0x3f4d5b[_0x8d08('0x32')]);_0x1b61db[_0x8d08('0x34')]=_[_0x8d08('0x35')](_0x1b61db['model'],_0x1b61db['query']);_0x570220[_0x8d08('0x36')]=_[_0x8d08('0x35')](_0x1b61db[_0x8d08('0x31')],qs['fields'](_0x3f4d5b[_0x8d08('0x32')]['fields']));_0x570220['attributes']=_0x570220[_0x8d08('0x36')]['length']?_0x570220['attributes']:_0x1b61db['model'];if(_0x3f4d5b[_0x8d08('0x32')][_0x8d08('0x48')]){_0x570220[_0x8d08('0x42')]=[{'all':!![]}];}_0x570220=_[_0x8d08('0x3f')]({},_0x570220,_0x3f4d5b[_0x8d08('0x41')]);return db[_0x8d08('0x2d')]['find'](_0x570220)['then'](handleEntityNotFound(_0x325e71,null))[_0x8d08('0x25')](respondWithResult(_0x325e71,null))[_0x8d08('0x45')](handleError(_0x325e71,null));};exports['create']=function(_0x3f504a,_0x485aa4){return db[_0x8d08('0x2d')]['create'](_0x3f504a['body'],{})[_0x8d08('0x25')](respondWithResult(_0x485aa4,0xc9))[_0x8d08('0x45')](handleError(_0x485aa4,null));};exports[_0x8d08('0x24')]=function(_0x4be80e,_0x5c7e15){if(_0x4be80e[_0x8d08('0x49')]['id']){delete _0x4be80e[_0x8d08('0x49')]['id'];}return db[_0x8d08('0x2d')][_0x8d08('0x4a')]({'where':{'id':_0x4be80e['params']['id']}})[_0x8d08('0x25')](handleEntityNotFound(_0x5c7e15,null))[_0x8d08('0x25')](saveUpdates(_0x4be80e[_0x8d08('0x49')],null))[_0x8d08('0x25')](respondWithResult(_0x5c7e15,null))[_0x8d08('0x45')](handleError(_0x5c7e15,null));};exports[_0x8d08('0x26')]=function(_0x45f0ea,_0x302f3e){return db[_0x8d08('0x2d')][_0x8d08('0x4a')]({'where':{'id':_0x45f0ea[_0x8d08('0x47')]['id']}})[_0x8d08('0x25')](handleEntityNotFound(_0x302f3e,null))[_0x8d08('0x25')](removeEntity(_0x302f3e,null))['catch'](handleError(_0x302f3e,null));};exports[_0x8d08('0x4b')]=function(_0x53d3a9,_0x3d27d9){return db[_0x8d08('0x2d')][_0x8d08('0x4b')]()[_0x8d08('0x25')](respondWithResult(_0x3d27d9,null))[_0x8d08('0x45')](handleError(_0x3d27d9,null));}; \ No newline at end of file +var _0xa9e9=['mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','end','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','rows','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x318ea0,_0x3d10bc){var _0x3631f1=function(_0x25451e){while(--_0x25451e){_0x318ea0['push'](_0x318ea0['shift']());}};_0x3631f1(++_0x3d10bc);}(_0xa9e9,0xdb));var _0x9a9e=function(_0x2c79fb,_0x1f5bc5){_0x2c79fb=_0x2c79fb-0x0;var _0x3a70c8=_0xa9e9[_0x2c79fb];return _0x3a70c8;};'use strict';var emlformat=require(_0x9a9e('0x0'));var rimraf=require(_0x9a9e('0x1'));var zipdir=require(_0x9a9e('0x2'));var jsonpatch=require(_0x9a9e('0x3'));var rp=require(_0x9a9e('0x4'));var moment=require(_0x9a9e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9a9e('0x6'));var util=require(_0x9a9e('0x7'));var path=require('path');var sox=require(_0x9a9e('0x8'));var csv=require(_0x9a9e('0x9'));var ejs=require(_0x9a9e('0xa'));var fs=require('fs');var fs_extra=require(_0x9a9e('0xb'));var _=require(_0x9a9e('0xc'));var squel=require(_0x9a9e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9a9e('0xe'));var toCsv=require(_0x9a9e('0x9'));var querystring=require(_0x9a9e('0xf'));var Papa=require(_0x9a9e('0x10'));var Redis=require('ioredis');var authService=require(_0x9a9e('0x11'));var qs=require(_0x9a9e('0x12'));var as=require(_0x9a9e('0x13'));var hardwareService=require(_0x9a9e('0x14'));var logger=require('../../config/logger')(_0x9a9e('0x15'));var utils=require(_0x9a9e('0x16'));var config=require(_0x9a9e('0x17'));var licenseUtil=require(_0x9a9e('0x18'));var db=require(_0x9a9e('0x19'))['db'];function respondWithStatusCode(_0x122db4,_0x2afa0d){_0x2afa0d=_0x2afa0d||0xcc;return function(_0x1d9163){if(_0x1d9163){return _0x122db4[_0x9a9e('0x1a')](_0x2afa0d);}return _0x122db4[_0x9a9e('0x1b')](_0x2afa0d)['end']();};}function respondWithResult(_0x534e52,_0x51eefd){_0x51eefd=_0x51eefd||0xc8;return function(_0x3f1ced){if(_0x3f1ced){return _0x534e52['status'](_0x51eefd)[_0x9a9e('0x1c')](_0x3f1ced);}};}function respondWithFilteredResult(_0x2d451d,_0x5ddf14){return function(_0x130d28){if(_0x130d28){var _0x3c43b5=typeof _0x5ddf14[_0x9a9e('0x1d')]==='undefined'&&typeof _0x5ddf14['limit']===_0x9a9e('0x1e');var _0x324d96=_0x130d28[_0x9a9e('0x1f')];var _0x216000=_0x3c43b5?0x0:_0x5ddf14[_0x9a9e('0x1d')];var _0x249439=_0x3c43b5?_0x130d28[_0x9a9e('0x1f')]:_0x5ddf14[_0x9a9e('0x1d')]+_0x5ddf14[_0x9a9e('0x20')];var _0x5f149c;if(_0x249439>=_0x324d96){_0x249439=_0x324d96;_0x5f149c=0xc8;}else{_0x5f149c=0xce;}_0x2d451d[_0x9a9e('0x1b')](_0x5f149c);return _0x2d451d[_0x9a9e('0x21')](_0x9a9e('0x22'),_0x216000+'-'+_0x249439+'/'+_0x324d96)[_0x9a9e('0x1c')](_0x130d28);}return null;};}function patchUpdates(_0x19b3a1){return function(_0x3b24c4){try{jsonpatch[_0x9a9e('0x23')](_0x3b24c4,_0x19b3a1,!![]);}catch(_0x356df8){return BPromise['reject'](_0x356df8);}return _0x3b24c4[_0x9a9e('0x24')]();};}function saveUpdates(_0x3cf9d0,_0x1fc370){return function(_0x10697c){if(_0x10697c){return _0x10697c['update'](_0x3cf9d0)[_0x9a9e('0x25')](function(_0x3518be){return _0x3518be;});}return null;};}function removeEntity(_0x34eef9,_0x3587dc){return function(_0x57a493){if(_0x57a493){return _0x57a493[_0x9a9e('0x26')]()[_0x9a9e('0x25')](function(){_0x34eef9[_0x9a9e('0x1b')](0xcc)[_0x9a9e('0x27')]();});}};}function handleEntityNotFound(_0x442cd9,_0x5d785a){return function(_0x5be8af){if(!_0x5be8af){_0x442cd9['sendStatus'](0x194);}return _0x5be8af;};}function handleError(_0x19edad,_0x1927dc){_0x1927dc=_0x1927dc||0x1f4;return function(_0x4915a9){logger['error'](_0x4915a9[_0x9a9e('0x28')]);if(_0x4915a9[_0x9a9e('0x29')]){delete _0x4915a9[_0x9a9e('0x29')];}_0x19edad[_0x9a9e('0x1b')](_0x1927dc)[_0x9a9e('0x2a')](_0x4915a9);};}exports[_0x9a9e('0x2b')]=function(_0x53c418,_0x3fd796){var _0x2b0862={},_0x55bc81={},_0x347f1d={'count':0x0,'rows':[]};var _0x104f64=_['map'](db[_0x9a9e('0x2c')][_0x9a9e('0x2d')],function(_0x11d7f8){return{'name':_0x11d7f8[_0x9a9e('0x2e')],'type':_0x11d7f8[_0x9a9e('0x2f')]['key']};});_0x55bc81[_0x9a9e('0x30')]=_[_0x9a9e('0x31')](_0x104f64,_0x9a9e('0x29'));_0x55bc81[_0x9a9e('0x32')]=_['keys'](_0x53c418[_0x9a9e('0x32')]);_0x55bc81[_0x9a9e('0x33')]=_[_0x9a9e('0x34')](_0x55bc81[_0x9a9e('0x30')],_0x55bc81['query']);_0x2b0862[_0x9a9e('0x35')]=_['intersection'](_0x55bc81[_0x9a9e('0x30')],qs[_0x9a9e('0x36')](_0x53c418[_0x9a9e('0x32')][_0x9a9e('0x36')]));_0x2b0862[_0x9a9e('0x35')]=_0x2b0862[_0x9a9e('0x35')][_0x9a9e('0x37')]?_0x2b0862[_0x9a9e('0x35')]:_0x55bc81[_0x9a9e('0x30')];if(!_0x53c418['query'][_0x9a9e('0x38')](_0x9a9e('0x39'))){_0x2b0862[_0x9a9e('0x20')]=qs['limit'](_0x53c418['query']['limit']);_0x2b0862[_0x9a9e('0x1d')]=qs[_0x9a9e('0x1d')](_0x53c418[_0x9a9e('0x32')][_0x9a9e('0x1d')]);}_0x2b0862[_0x9a9e('0x3a')]=qs[_0x9a9e('0x3b')](_0x53c418[_0x9a9e('0x32')][_0x9a9e('0x3b')]);_0x2b0862['where']=qs['filters'](_['pick'](_0x53c418[_0x9a9e('0x32')],_0x55bc81[_0x9a9e('0x33')]),_0x104f64);if(_0x53c418['query'][_0x9a9e('0x3c')]){_0x2b0862[_0x9a9e('0x3d')]=_['merge'](_0x2b0862[_0x9a9e('0x3d')],{'$or':_['map'](_0x104f64,function(_0x475cb4){if(_0x475cb4[_0x9a9e('0x2f')]!=='VIRTUAL'){var _0x454797={};_0x454797[_0x475cb4['name']]={'$like':'%'+_0x53c418['query']['filter']+'%'};return _0x454797;}})});}_0x2b0862=_[_0x9a9e('0x3e')]({},_0x2b0862,_0x53c418[_0x9a9e('0x3f')]);var _0x177e2e={'where':_0x2b0862[_0x9a9e('0x3d')]};return db['UserProfileSection'][_0x9a9e('0x1f')](_0x177e2e)[_0x9a9e('0x25')](function(_0x9bb35a){_0x347f1d[_0x9a9e('0x1f')]=_0x9bb35a;if(_0x53c418['query'][_0x9a9e('0x40')]){_0x2b0862[_0x9a9e('0x41')]=[{'all':!![]}];}return db[_0x9a9e('0x2c')]['findAll'](_0x2b0862);})[_0x9a9e('0x25')](function(_0x26a525){_0x347f1d[_0x9a9e('0x42')]=_0x26a525;return _0x347f1d;})[_0x9a9e('0x25')](respondWithFilteredResult(_0x3fd796,_0x2b0862))['catch'](handleError(_0x3fd796,null));};exports[_0x9a9e('0x43')]=function(_0x1ec53b,_0x467417){var _0x565282={'raw':![],'where':{'id':_0x1ec53b[_0x9a9e('0x44')]['id']}},_0x145c17={};_0x145c17[_0x9a9e('0x30')]=_[_0x9a9e('0x45')](db[_0x9a9e('0x2c')][_0x9a9e('0x2d')]);_0x145c17['query']=_['keys'](_0x1ec53b[_0x9a9e('0x32')]);_0x145c17[_0x9a9e('0x33')]=_[_0x9a9e('0x34')](_0x145c17[_0x9a9e('0x30')],_0x145c17['query']);_0x565282[_0x9a9e('0x35')]=_[_0x9a9e('0x34')](_0x145c17[_0x9a9e('0x30')],qs[_0x9a9e('0x36')](_0x1ec53b['query'][_0x9a9e('0x36')]));_0x565282[_0x9a9e('0x35')]=_0x565282[_0x9a9e('0x35')][_0x9a9e('0x37')]?_0x565282[_0x9a9e('0x35')]:_0x145c17[_0x9a9e('0x30')];if(_0x1ec53b[_0x9a9e('0x32')][_0x9a9e('0x40')]){_0x565282[_0x9a9e('0x41')]=[{'all':!![]}];}_0x565282=_['merge']({},_0x565282,_0x1ec53b[_0x9a9e('0x3f')]);return db[_0x9a9e('0x2c')][_0x9a9e('0x46')](_0x565282)[_0x9a9e('0x25')](handleEntityNotFound(_0x467417,null))[_0x9a9e('0x25')](respondWithResult(_0x467417,null))[_0x9a9e('0x47')](handleError(_0x467417,null));};exports[_0x9a9e('0x48')]=function(_0x21d3f9,_0x488943){return db['UserProfileSection']['create'](_0x21d3f9[_0x9a9e('0x49')],{})[_0x9a9e('0x25')](respondWithResult(_0x488943,0xc9))['catch'](handleError(_0x488943,null));};exports['update']=function(_0x193549,_0x13ef70){if(_0x193549[_0x9a9e('0x49')]['id']){delete _0x193549[_0x9a9e('0x49')]['id'];}return db[_0x9a9e('0x2c')][_0x9a9e('0x46')]({'where':{'id':_0x193549[_0x9a9e('0x44')]['id']}})[_0x9a9e('0x25')](handleEntityNotFound(_0x13ef70,null))[_0x9a9e('0x25')](saveUpdates(_0x193549[_0x9a9e('0x49')],null))[_0x9a9e('0x25')](respondWithResult(_0x13ef70,null))['catch'](handleError(_0x13ef70,null));};exports[_0x9a9e('0x26')]=function(_0x2e98a1,_0x401292){return db[_0x9a9e('0x2c')][_0x9a9e('0x46')]({'where':{'id':_0x2e98a1[_0x9a9e('0x44')]['id']}})[_0x9a9e('0x25')](handleEntityNotFound(_0x401292,null))[_0x9a9e('0x25')](removeEntity(_0x401292,null))[_0x9a9e('0x47')](handleError(_0x401292,null));};exports[_0x9a9e('0x4a')]=function(_0x1f8ef0,_0x5ae4af){return db['UserProfileSection'][_0x9a9e('0x4a')]()[_0x9a9e('0x25')](respondWithResult(_0x5ae4af,null))[_0x9a9e('0x47')](handleError(_0x5ae4af,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index d7cede8..09dcbcb 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 _0x4a5a=['exports','user_profile_has_sections','compositeIndex','sectionId','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes'];(function(_0x222666,_0x17c683){var _0x578af4=function(_0x5c849a){while(--_0x5c849a){_0x222666['push'](_0x222666['shift']());}};_0x578af4(++_0x17c683);}(_0x4a5a,0xe0));var _0xa4a5=function(_0x52b3ce,_0x221c19){_0x52b3ce=_0x52b3ce-0x0;var _0x42b91e=_0x4a5a[_0x52b3ce];return _0x42b91e;};'use strict';var _=require('lodash');var util=require(_0xa4a5('0x0'));var logger=require(_0xa4a5('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa4a5('0x2'));var rp=require(_0xa4a5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4a5('0x4'));var config=require(_0xa4a5('0x5'));var attributes=require(_0xa4a5('0x6'));module[_0xa4a5('0x7')]=function(_0x3d2837,_0x9670ce){return _0x3d2837['define']('UserProfileSection',attributes,{'tableName':_0xa4a5('0x8'),'paranoid':![],'indexes':[{'name':_0xa4a5('0x9'),'fields':[_0xa4a5('0xa'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x24c6=['sectionId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./userProfileSection.attributes','exports','UserProfileSection','compositeIndex'];(function(_0x40a443,_0x340329){var _0x522176=function(_0x42cf91){while(--_0x42cf91){_0x40a443['push'](_0x40a443['shift']());}};_0x522176(++_0x340329);}(_0x24c6,0x90));var _0x624c=function(_0x209e58,_0x4c3ab4){_0x209e58=_0x209e58-0x0;var _0x43775b=_0x24c6[_0x209e58];return _0x43775b;};'use strict';var _=require(_0x624c('0x0'));var util=require(_0x624c('0x1'));var logger=require(_0x624c('0x2'))(_0x624c('0x3'));var moment=require(_0x624c('0x4'));var BPromise=require(_0x624c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x624c('0x6'));var rimraf=require(_0x624c('0x7'));var config=require('../../config/environment');var attributes=require(_0x624c('0x8'));module[_0x624c('0x9')]=function(_0x4831cc,_0x187c9e){return _0x4831cc['define'](_0x624c('0xa'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x624c('0xb'),'fields':[_0x624c('0xc'),'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 b81f9b4..08fc5f0 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 _0xb0ec=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','request','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','UserProfileSection,\x20%s,\x20%s','message','result'];(function(_0x55456f,_0x3f561a){var _0x34d223=function(_0x5814eb){while(--_0x5814eb){_0x55456f['push'](_0x55456f['shift']());}};_0x34d223(++_0x3f561a);}(_0xb0ec,0x10e));var _0xcb0e=function(_0x5b1812,_0x113519){_0x5b1812=_0x5b1812-0x0;var _0x38a914=_0xb0ec[_0x5b1812];return _0x38a914;};'use strict';var _=require(_0xcb0e('0x0'));var util=require(_0xcb0e('0x1'));var moment=require(_0xcb0e('0x2'));var BPromise=require(_0xcb0e('0x3'));var rs=require(_0xcb0e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb0e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb0e('0x6'))(_0xcb0e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x569d67,_0xd3d458,_0x4cc4db){return new BPromise(function(_0x4a1001,_0x45c824){return client[_0xcb0e('0x8')](_0x569d67,_0x4cc4db)['then'](function(_0x449abe){logger[_0xcb0e('0x9')]('UserProfileSection,\x20%s,\x20%s',_0xd3d458,_0xcb0e('0xa'));logger[_0xcb0e('0xb')](_0xcb0e('0xc'),_0xd3d458,_0xcb0e('0xa'),JSON['stringify'](_0x449abe));if(_0x449abe[_0xcb0e('0xd')]){if(_0x449abe[_0xcb0e('0xd')][_0xcb0e('0xe')]===0x1f4){logger[_0xcb0e('0xd')](_0xcb0e('0xf'),_0xd3d458,_0x449abe[_0xcb0e('0xd')]['message']);return _0x45c824(_0x449abe[_0xcb0e('0xd')][_0xcb0e('0x10')]);}logger[_0xcb0e('0xd')](_0xcb0e('0xf'),_0xd3d458,_0x449abe[_0xcb0e('0xd')]['message']);return _0x4a1001(_0x449abe[_0xcb0e('0xd')][_0xcb0e('0x10')]);}else{logger[_0xcb0e('0x9')](_0xcb0e('0xf'),_0xd3d458,_0xcb0e('0xa'));_0x4a1001(_0x449abe[_0xcb0e('0x11')][_0xcb0e('0x10')]);}})['catch'](function(_0x8020b0){logger[_0xcb0e('0xd')](_0xcb0e('0xf'),_0xd3d458,_0x8020b0);_0x45c824(_0x8020b0);});});} \ No newline at end of file +var _0xd97b=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UserProfileSection,\x20%s,\x20%s','lodash','util','moment','bluebird'];(function(_0x250669,_0xb15e88){var _0x131447=function(_0x5bc014){while(--_0x5bc014){_0x250669['push'](_0x250669['shift']());}};_0x131447(++_0xb15e88);}(_0xd97b,0x176));var _0xbd97=function(_0x264b98,_0x2e2233){_0x264b98=_0x264b98-0x0;var _0x3f9225=_0xd97b[_0x264b98];return _0x3f9225;};'use strict';var _=require(_0xbd97('0x0'));var util=require(_0xbd97('0x1'));var moment=require(_0xbd97('0x2'));var BPromise=require(_0xbd97('0x3'));var rs=require(_0xbd97('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd97('0x5'))['db'];var utils=require(_0xbd97('0x6'));var logger=require('../../config/logger')(_0xbd97('0x7'));var config=require('../../config/environment');var jayson=require(_0xbd97('0x8'));var client=jayson[_0xbd97('0x9')][_0xbd97('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a2af6,_0x431008,_0x5c2e15){return new BPromise(function(_0x11f46b,_0x48046c){return client[_0xbd97('0xb')](_0x5a2af6,_0x5c2e15)[_0xbd97('0xc')](function(_0x152372){logger[_0xbd97('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x431008,'request\x20sent');logger['debug'](_0xbd97('0xe'),_0x431008,_0xbd97('0xf'),JSON[_0xbd97('0x10')](_0x152372));if(_0x152372[_0xbd97('0x11')]){if(_0x152372['error'][_0xbd97('0x12')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x431008,_0x152372[_0xbd97('0x11')][_0xbd97('0x13')]);return _0x48046c(_0x152372['error']['message']);}logger[_0xbd97('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x431008,_0x152372[_0xbd97('0x11')]['message']);return _0x11f46b(_0x152372[_0xbd97('0x11')][_0xbd97('0x13')]);}else{logger[_0xbd97('0xd')](_0xbd97('0x14'),_0x431008,_0xbd97('0xf'));_0x11f46b(_0x152372['result'][_0xbd97('0x13')]);}})['catch'](function(_0x1eda70){logger[_0xbd97('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x431008,_0x1eda70);_0x48046c(_0x1eda70);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 18133bd..e371677 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1bfe85,_0x56781a){var _0xf9effa=function(_0xf3cc9b){while(--_0xf3cc9b){_0x1bfe85['push'](_0x1bfe85['shift']());}};_0xf9effa(++_0x56781a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2181fc,_0x7283aa){_0x2181fc=_0x2181fc-0x0;var _0x315da1=_0xcb91[_0x2181fc];return _0x315da1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x125597,_0x1d5ddd){var _0x5a6818=function(_0x4943f5){while(--_0x4943f5){_0x125597['push'](_0x125597['shift']());}};_0x5a6818(++_0x1d5ddd);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 5195cf7..0f8f8c5 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 _0x3b87=['exports','INTEGER','sequelize'];(function(_0x47be4f,_0x5a0bb0){var _0x697bf5=function(_0x381803){while(--_0x381803){_0x47be4f['push'](_0x47be4f['shift']());}};_0x697bf5(++_0x5a0bb0);}(_0x3b87,0x7d));var _0x73b8=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3b87[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0x73b8('0x0'));module[_0x73b8('0x1')]={'penalty':{'type':Sequelize[_0x73b8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8743=['INTEGER','sequelize','exports'];(function(_0xe42af2,_0x4e359c){var _0x30388c=function(_0x5d22a6){while(--_0x5d22a6){_0xe42af2['push'](_0xe42af2['shift']());}};_0x30388c(++_0x4e359c);}(_0x8743,0xa3));var _0x3874=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x8743[_0x1e7b16];return _0x37fadc;};'use strict';var Sequelize=require(_0x3874('0x0'));module[_0x3874('0x1')]={'penalty':{'type':Sequelize[_0x3874('0x2')],'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 e1fe480..2640035 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 _0x3e24=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','lodash'];(function(_0x7bb167,_0x388b1c){var _0x3c9b01=function(_0x2ce004){while(--_0x2ce004){_0x7bb167['push'](_0x7bb167['shift']());}};_0x3c9b01(++_0x388b1c);}(_0x3e24,0x167));var _0x43e2=function(_0x538af4,_0x38f152){_0x538af4=_0x538af4-0x0;var _0x28d15f=_0x3e24[_0x538af4];return _0x28d15f;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var logger=require(_0x43e2('0x2'))(_0x43e2('0x3'));var moment=require(_0x43e2('0x4'));var BPromise=require('bluebird');var rp=require(_0x43e2('0x5'));var fs=require('fs');var path=require(_0x43e2('0x6'));var rimraf=require('rimraf');var config=require(_0x43e2('0x7'));var attributes=require(_0x43e2('0x8'));module[_0x43e2('0x9')]=function(_0x28b144,_0x43b5a7){return _0x28b144[_0x43e2('0xa')](_0x43e2('0xb'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed1c=['exports','UserSmsQueue','user_has_sms_queues','lodash','util','request-promise','path','rimraf','./userSmsQueue.attributes'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xed1c,0xe4));var _0xced1=function(_0x398c1d,_0x4db529){_0x398c1d=_0x398c1d-0x0;var _0x5e1b04=_0xed1c[_0x398c1d];return _0x5e1b04;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xced1('0x2'));var fs=require('fs');var path=require(_0xced1('0x3'));var rimraf=require(_0xced1('0x4'));var config=require('../../config/environment');var attributes=require(_0xced1('0x5'));module[_0xced1('0x6')]=function(_0x466657,_0x37b22b){return _0x466657['define'](_0xced1('0x7'),attributes,{'tableName':_0xced1('0x8'),'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 f308e8d..215117b 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 _0x2654=['request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s'];(function(_0x4f61a1,_0x35820b){var _0xae8b64=function(_0x4f784c){while(--_0x4f784c){_0x4f61a1['push'](_0x4f61a1['shift']());}};_0xae8b64(++_0x35820b);}(_0x2654,0xa3));var _0x4265=function(_0x4c7410,_0x43bf77){_0x4c7410=_0x4c7410-0x0;var _0x2cf87d=_0x2654[_0x4c7410];return _0x2cf87d;};'use strict';var _=require('lodash');var util=require(_0x4265('0x0'));var moment=require(_0x4265('0x1'));var BPromise=require(_0x4265('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4265('0x3'));var db=require(_0x4265('0x4'))['db'];var utils=require(_0x4265('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4265('0x6'));var client=jayson[_0x4265('0x7')][_0x4265('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4076d9,_0x28d4ad,_0x83ea8c){return new BPromise(function(_0x3f1f6a,_0x3dd3e9){return client[_0x4265('0x9')](_0x4076d9,_0x83ea8c)[_0x4265('0xa')](function(_0x52b132){logger[_0x4265('0xb')](_0x4265('0xc'),_0x28d4ad,_0x4265('0xd'));logger[_0x4265('0xe')](_0x4265('0xf'),_0x28d4ad,_0x4265('0xd'),JSON[_0x4265('0x10')](_0x52b132));if(_0x52b132['error']){if(_0x52b132['error'][_0x4265('0x11')]===0x1f4){logger[_0x4265('0x12')](_0x4265('0xc'),_0x28d4ad,_0x52b132[_0x4265('0x12')][_0x4265('0x13')]);return _0x3dd3e9(_0x52b132[_0x4265('0x12')][_0x4265('0x13')]);}logger[_0x4265('0x12')](_0x4265('0xc'),_0x28d4ad,_0x52b132[_0x4265('0x12')][_0x4265('0x13')]);return _0x3f1f6a(_0x52b132[_0x4265('0x12')][_0x4265('0x13')]);}else{logger[_0x4265('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x28d4ad,_0x4265('0xd'));_0x3f1f6a(_0x52b132[_0x4265('0x14')]['message']);}})[_0x4265('0x15')](function(_0x2f0e71){logger[_0x4265('0x12')](_0x4265('0xc'),_0x28d4ad,_0x2f0e71);_0x3dd3e9(_0x2f0e71);});});} \ No newline at end of file +var _0x0b37=['../../config/utils','../../config/logger','rpc','../../config/environment','then','info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x171ac7,_0x339c8d){var _0x94478d=function(_0xedf6e6){while(--_0xedf6e6){_0x171ac7['push'](_0x171ac7['shift']());}};_0x94478d(++_0x339c8d);}(_0x0b37,0x164));var _0x70b3=function(_0x3e238c,_0x21c788){_0x3e238c=_0x3e238c-0x0;var _0x252992=_0x0b37[_0x3e238c];return _0x252992;};'use strict';var _=require(_0x70b3('0x0'));var util=require(_0x70b3('0x1'));var moment=require(_0x70b3('0x2'));var BPromise=require(_0x70b3('0x3'));var rs=require(_0x70b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x70b3('0x5'));var logger=require(_0x70b3('0x6'))(_0x70b3('0x7'));var config=require(_0x70b3('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d890a,_0x14503e,_0x2f7a6c){return new BPromise(function(_0x4675b5,_0x547417){return client['request'](_0x3d890a,_0x2f7a6c)[_0x70b3('0x9')](function(_0x331074){logger[_0x70b3('0xa')](_0x70b3('0xb'),_0x14503e,'request\x20sent');logger['debug'](_0x70b3('0xc'),_0x14503e,_0x70b3('0xd'),JSON[_0x70b3('0xe')](_0x331074));if(_0x331074['error']){if(_0x331074['error'][_0x70b3('0xf')]===0x1f4){logger[_0x70b3('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x14503e,_0x331074['error'][_0x70b3('0x11')]);return _0x547417(_0x331074['error'][_0x70b3('0x11')]);}logger[_0x70b3('0x10')](_0x70b3('0xb'),_0x14503e,_0x331074['error'][_0x70b3('0x11')]);return _0x4675b5(_0x331074[_0x70b3('0x10')][_0x70b3('0x11')]);}else{logger[_0x70b3('0xa')]('UserSmsQueue,\x20%s,\x20%s',_0x14503e,_0x70b3('0xd'));_0x4675b5(_0x331074['result']['message']);}})[_0x70b3('0x12')](function(_0x2832a9){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x14503e,_0x2832a9);_0x547417(_0x2832a9);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index a10e8ca..d4b77c4 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1a873f,_0x5139ee){var _0x9b35e3=function(_0x30f2a6){while(--_0x30f2a6){_0x1a873f['push'](_0x1a873f['shift']());}};_0x9b35e3(++_0x5139ee);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2867d8,_0xef3ee0){_0x2867d8=_0x2867d8-0x0;var _0x3b8176=_0xcb91[_0x2867d8];return _0x3b8176;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x479bf2,_0x443252){var _0x21fec8=function(_0x98a0f6){while(--_0x98a0f6){_0x479bf2['push'](_0x479bf2['shift']());}};_0x21fec8(++_0x443252);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 0e2d6ab..2b1542c 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 _0x00dd=['INTEGER'];(function(_0x13d587,_0x2e64d4){var _0x330e7b=function(_0x396826){while(--_0x396826){_0x13d587['push'](_0x13d587['shift']());}};_0x330e7b(++_0x2e64d4);}(_0x00dd,0xb9));var _0xd00d=function(_0x2d48fa,_0x103065){_0x2d48fa=_0x2d48fa-0x0;var _0x4645b7=_0x00dd[_0x2d48fa];return _0x4645b7;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xd00d('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc418=['INTEGER','sequelize','exports'];(function(_0x511d17,_0x9ad3ba){var _0x4f42e3=function(_0x5cc40f){while(--_0x5cc40f){_0x511d17['push'](_0x511d17['shift']());}};_0x4f42e3(++_0x9ad3ba);}(_0xc418,0xd9));var _0x8c41=function(_0x5a57b0,_0x51a8d1){_0x5a57b0=_0x5a57b0-0x0;var _0x4ab977=_0xc418[_0x5a57b0];return _0x4ab977;};'use strict';var Sequelize=require(_0x8c41('0x0'));module[_0x8c41('0x1')]={'penalty':{'type':Sequelize[_0x8c41('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 926f7a1..00ab673 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 _0x34e4=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x1e03fd,_0x305996){var _0x5dc753=function(_0x558231){while(--_0x558231){_0x1e03fd['push'](_0x1e03fd['shift']());}};_0x5dc753(++_0x305996);}(_0x34e4,0x13f));var _0x434e=function(_0x2be3ca,_0x44a62a){_0x2be3ca=_0x2be3ca-0x0;var _0x1640aa=_0x34e4[_0x2be3ca];return _0x1640aa;};'use strict';var _=require(_0x434e('0x0'));var util=require(_0x434e('0x1'));var logger=require(_0x434e('0x2'))(_0x434e('0x3'));var moment=require(_0x434e('0x4'));var BPromise=require(_0x434e('0x5'));var rp=require(_0x434e('0x6'));var fs=require('fs');var path=require(_0x434e('0x7'));var rimraf=require(_0x434e('0x8'));var config=require(_0x434e('0x9'));var attributes=require('./userVoiceQueue.attributes');module[_0x434e('0xa')]=function(_0x47cdf1,_0x160bfc){return _0x47cdf1[_0x434e('0xb')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a60=['lodash','api','moment','request-promise','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues'];(function(_0x2de0a2,_0x2ea27d){var _0x1e2669=function(_0x304b1b){while(--_0x304b1b){_0x2de0a2['push'](_0x2de0a2['shift']());}};_0x1e2669(++_0x2ea27d);}(_0x5a60,0x1a0));var _0x05a6=function(_0x243d6f,_0x4a88bc){_0x243d6f=_0x243d6f-0x0;var _0x23b7ae=_0x5a60[_0x243d6f];return _0x23b7ae;};'use strict';var _=require(_0x05a6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x05a6('0x1'));var moment=require(_0x05a6('0x2'));var BPromise=require('bluebird');var rp=require(_0x05a6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x05a6('0x4'));module[_0x05a6('0x5')]=function(_0x179e37,_0x580e4d){return _0x179e37['define'](_0x05a6('0x6'),attributes,{'tableName':_0x05a6('0x7'),'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 2ee47a5..a5c291b 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 _0x3fbc=['stringify','error','code','message','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserVoiceQueue,\x20%s,\x20%s','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x14ed1b,_0x206a48){var _0x3c3c94=function(_0x470a49){while(--_0x470a49){_0x14ed1b['push'](_0x14ed1b['shift']());}};_0x3c3c94(++_0x206a48);}(_0x3fbc,0xc2));var _0xc3fb=function(_0x1a338b,_0x1b4344){_0x1a338b=_0x1a338b-0x0;var _0x2c8159=_0x3fbc[_0x1a338b];return _0x2c8159;};'use strict';var _=require('lodash');var util=require(_0xc3fb('0x0'));var moment=require('moment');var BPromise=require(_0xc3fb('0x1'));var rs=require(_0xc3fb('0x2'));var fs=require('fs');var Redis=require(_0xc3fb('0x3'));var db=require(_0xc3fb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc3fb('0x5'))(_0xc3fb('0x6'));var config=require(_0xc3fb('0x7'));var jayson=require(_0xc3fb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1bc7f2,_0x5d096b,_0x16c0a4){return new BPromise(function(_0x58b61d,_0xeada20){return client[_0xc3fb('0x9')](_0x1bc7f2,_0x16c0a4)[_0xc3fb('0xa')](function(_0x48ceae){logger[_0xc3fb('0xb')](_0xc3fb('0xc'),_0x5d096b,'request\x20sent');logger['debug'](_0xc3fb('0xd'),_0x5d096b,_0xc3fb('0xe'),JSON[_0xc3fb('0xf')](_0x48ceae));if(_0x48ceae[_0xc3fb('0x10')]){if(_0x48ceae['error'][_0xc3fb('0x11')]===0x1f4){logger[_0xc3fb('0x10')](_0xc3fb('0xc'),_0x5d096b,_0x48ceae[_0xc3fb('0x10')][_0xc3fb('0x12')]);return _0xeada20(_0x48ceae[_0xc3fb('0x10')]['message']);}logger['error'](_0xc3fb('0xc'),_0x5d096b,_0x48ceae[_0xc3fb('0x10')]['message']);return _0x58b61d(_0x48ceae[_0xc3fb('0x10')][_0xc3fb('0x12')]);}else{logger[_0xc3fb('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x5d096b,_0xc3fb('0xe'));_0x58b61d(_0x48ceae['result']['message']);}})['catch'](function(_0x88f159){logger[_0xc3fb('0x10')](_0xc3fb('0xc'),_0x5d096b,_0x88f159);_0xeada20(_0x88f159);});});} \ No newline at end of file +var _0xf688=['../../config/environment','jayson/promise','request','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xf688,0x175));var _0x8f68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf688[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8f68('0x0'));var moment=require(_0x8f68('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f68('0x2'));var fs=require('fs');var Redis=require(_0x8f68('0x3'));var db=require(_0x8f68('0x4'))['db'];var utils=require(_0x8f68('0x5'));var logger=require('../../config/logger')(_0x8f68('0x6'));var config=require(_0x8f68('0x7'));var jayson=require(_0x8f68('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5140d9,_0x4a2b14,_0x46566c){return new BPromise(function(_0xb173f0,_0x17b817){return client[_0x8f68('0x9')](_0x5140d9,_0x46566c)['then'](function(_0x35b73a){logger[_0x8f68('0xa')](_0x8f68('0xb'),_0x4a2b14,'request\x20sent');logger[_0x8f68('0xc')](_0x8f68('0xd'),_0x4a2b14,_0x8f68('0xe'),JSON[_0x8f68('0xf')](_0x35b73a));if(_0x35b73a[_0x8f68('0x10')]){if(_0x35b73a[_0x8f68('0x10')][_0x8f68('0x11')]===0x1f4){logger[_0x8f68('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x4a2b14,_0x35b73a[_0x8f68('0x10')]['message']);return _0x17b817(_0x35b73a[_0x8f68('0x10')][_0x8f68('0x12')]);}logger['error'](_0x8f68('0xb'),_0x4a2b14,_0x35b73a['error'][_0x8f68('0x12')]);return _0xb173f0(_0x35b73a[_0x8f68('0x10')]['message']);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x4a2b14,'request\x20sent');_0xb173f0(_0x35b73a[_0x8f68('0x13')][_0x8f68('0x12')]);}})['catch'](function(_0x402588){logger[_0x8f68('0x10')](_0x8f68('0xb'),_0x4a2b14,_0x402588);_0x17b817(_0x402588);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 2a65137..849249f 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xf3a275,_0x256c71){var _0x3c6e9e=function(_0x58b8aa){while(--_0x58b8aa){_0xf3a275['push'](_0xf3a275['shift']());}};_0x3c6e9e(++_0x256c71);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0xcb91[_0x500c0];return _0xdd146f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 82418a0..4e74f54 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 _0x3e58=['Required\x20by\x20Asterisk','STRING','queue_interface','exports','INTEGER'];(function(_0x1760ea,_0x351d1c){var _0x3cb58b=function(_0x317794){while(--_0x317794){_0x1760ea['push'](_0x1760ea['shift']());}};_0x3cb58b(++_0x351d1c);}(_0x3e58,0xee));var _0x83e5=function(_0x7611ce,_0x4a4441){_0x7611ce=_0x7611ce-0x0;var _0x67d3ab=_0x3e58[_0x7611ce];return _0x67d3ab;};'use strict';var Sequelize=require('sequelize');module[_0x83e5('0x0')]={'uniqueid':{'type':Sequelize[_0x83e5('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x83e5('0x2')},'membername':{'type':Sequelize[_0x83e5('0x3')],'allowNull':![],'comment':_0x83e5('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x83e5('0x3')],'allowNull':![],'unique':_0x83e5('0x4'),'comment':_0x83e5('0x2')},'VoiceQueueId':{'type':Sequelize[_0x83e5('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x83e5('0x3')],'allowNull':![],'unique':_0x83e5('0x4'),'comment':_0x83e5('0x2')},'penalty':{'type':Sequelize[_0x83e5('0x1')](0xb),'defaultValue':0x0,'comment':_0x83e5('0x2')},'paused':{'type':Sequelize[_0x83e5('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x15d7=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x12d93a,_0x460b08){var _0x5e0913=function(_0x353783){while(--_0x353783){_0x12d93a['push'](_0x12d93a['shift']());}};_0x5e0913(++_0x460b08);}(_0x15d7,0x19d));var _0x715d=function(_0x1d78b9,_0xc81f91){_0x1d78b9=_0x1d78b9-0x0;var _0x5b6466=_0x15d7[_0x1d78b9];return _0x5b6466;};'use strict';var Sequelize=require(_0x715d('0x0'));module[_0x715d('0x1')]={'uniqueid':{'type':Sequelize[_0x715d('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x715d('0x3')},'membername':{'type':Sequelize[_0x715d('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x715d('0x4')],'allowNull':![],'unique':_0x715d('0x5'),'comment':_0x715d('0x3')},'VoiceQueueId':{'type':Sequelize[_0x715d('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x715d('0x4')],'allowNull':![],'unique':_0x715d('0x5'),'comment':_0x715d('0x3')},'penalty':{'type':Sequelize[_0x715d('0x2')](0xb),'defaultValue':0x0,'comment':_0x715d('0x3')},'paused':{'type':Sequelize[_0x715d('0x2')](0xb),'defaultValue':0x0,'comment':_0x715d('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 374e062..e4be35f 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 _0x1dbb=['save','update','emit','hasOwnProperty','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x5122cd,_0x111d88){var _0x25412e=function(_0x5b1385){while(--_0x5b1385){_0x5122cd['push'](_0x5122cd['shift']());}};_0x25412e(++_0x111d88);}(_0x1dbb,0x1b5));var _0xb1db=function(_0x89ec8e,_0x432d5b){_0x89ec8e=_0x89ec8e-0x0;var _0x3e5cab=_0x1dbb[_0x89ec8e];return _0x3e5cab;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xb1db('0x0'))['db'][_0xb1db('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xb1db('0x2')](0x0);var events={'afterCreate':_0xb1db('0x3'),'afterUpdate':_0xb1db('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1673bb){return function(_0x304ef0,_0x449a68,_0x39d57a){UserVoiceQueueRtEvents['emit'](_0x1673bb+':'+_0x304ef0['id'],_0x304ef0);UserVoiceQueueRtEvents[_0xb1db('0x5')](_0x1673bb,_0x304ef0);_0x39d57a(null);};}for(var e in events){if(events[_0xb1db('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xb1db('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x1a51=['exports','events','UserVoiceQueueRt','save','update','emit','hasOwnProperty','hook'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1a51,0x89));var _0x11a5=function(_0x50acdf,_0x13e757){_0x50acdf=_0x50acdf-0x0;var _0x330999=_0x1a51[_0x50acdf];return _0x330999;};'use strict';var EventEmitter=require(_0x11a5('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x11a5('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x11a5('0x2'),'afterUpdate':_0x11a5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1e5653){return function(_0x526770,_0x51f440,_0x827b62){UserVoiceQueueRtEvents[_0x11a5('0x4')](_0x1e5653+':'+_0x526770['id'],_0x526770);UserVoiceQueueRtEvents[_0x11a5('0x4')](_0x1e5653,_0x526770);_0x827b62(null);};}for(var e in events){if(events[_0x11a5('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x11a5('0x6')](e,emitEvent(event));}}module[_0x11a5('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 8ecbeff..d56a5ff 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 _0xa0c7=['user_has_voice_queues_rt','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt'];(function(_0x16cb74,_0x3b524c){var _0x4bf5a2=function(_0x11964c){while(--_0x11964c){_0x16cb74['push'](_0x16cb74['shift']());}};_0x4bf5a2(++_0x3b524c);}(_0xa0c7,0x135));var _0x7a0c=function(_0x26294a,_0x4d8c82){_0x26294a=_0x26294a-0x0;var _0xf7960f=_0xa0c7[_0x26294a];return _0xf7960f;};'use strict';var _=require('lodash');var util=require(_0x7a0c('0x0'));var logger=require(_0x7a0c('0x1'))(_0x7a0c('0x2'));var moment=require('moment');var BPromise=require(_0x7a0c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7a0c('0x4'));var config=require(_0x7a0c('0x5'));var attributes=require(_0x7a0c('0x6'));module[_0x7a0c('0x7')]=function(_0x3c1a97,_0x1494db){return _0x3c1a97[_0x7a0c('0x8')](_0x7a0c('0x9'),attributes,{'tableName':_0x7a0c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52c5=['request-promise','path','rimraf','exports','UserVoiceQueueRt','user_has_voice_queues_rt','../../config/logger','api','moment','bluebird'];(function(_0x577d20,_0x3ead66){var _0x53acd7=function(_0x585b19){while(--_0x585b19){_0x577d20['push'](_0x577d20['shift']());}};_0x53acd7(++_0x3ead66);}(_0x52c5,0xe2));var _0x552c=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0x52c5[_0x21353c];return _0xa99120;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x552c('0x0'))(_0x552c('0x1'));var moment=require(_0x552c('0x2'));var BPromise=require(_0x552c('0x3'));var rp=require(_0x552c('0x4'));var fs=require('fs');var path=require(_0x552c('0x5'));var rimraf=require(_0x552c('0x6'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0x552c('0x7')]=function(_0x2afa74,_0x3b96cd){return _0x2afa74['define'](_0x552c('0x8'),attributes,{'tableName':_0x552c('0x9'),'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 bdce08b..19b8a0f 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 _0xf563=['UserVoiceQueueRt,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./userVoiceQueueRt.socket','then','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x314bd4,_0x477adb){var _0x10010c=function(_0xddd101){while(--_0xddd101){_0x314bd4['push'](_0x314bd4['shift']());}};_0x10010c(++_0x477adb);}(_0xf563,0x126));var _0x3f56=function(_0x352754,_0x30a6ea){_0x352754=_0x352754-0x0;var _0x3c9d6e=_0xf563[_0x352754];return _0x3c9d6e;};'use strict';var _=require(_0x3f56('0x0'));var util=require('util');var moment=require(_0x3f56('0x1'));var BPromise=require(_0x3f56('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f56('0x3'));var db=require(_0x3f56('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3f56('0x5'))(_0x3f56('0x6'));var config=require(_0x3f56('0x7'));var jayson=require(_0x3f56('0x8'));var client=jayson['client'][_0x3f56('0x9')]({'port':0x232a});config[_0x3f56('0xa')]=_[_0x3f56('0xb')](config[_0x3f56('0xa')],{'host':_0x3f56('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f56('0xa')]));require(_0x3f56('0xd'))['register'](socket);function respondWithRpcPromise(_0x40171d,_0x193b1c,_0x47d0b7){return new BPromise(function(_0x405032,_0x4adb19){return client['request'](_0x40171d,_0x47d0b7)[_0x3f56('0xe')](function(_0x4d89fb){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x193b1c,_0x3f56('0xf'));logger[_0x3f56('0x10')](_0x3f56('0x11'),_0x193b1c,_0x3f56('0xf'),JSON[_0x3f56('0x12')](_0x4d89fb));if(_0x4d89fb[_0x3f56('0x13')]){if(_0x4d89fb['error'][_0x3f56('0x14')]===0x1f4){logger[_0x3f56('0x13')](_0x3f56('0x15'),_0x193b1c,_0x4d89fb[_0x3f56('0x13')][_0x3f56('0x16')]);return _0x4adb19(_0x4d89fb[_0x3f56('0x13')][_0x3f56('0x16')]);}logger['error'](_0x3f56('0x15'),_0x193b1c,_0x4d89fb[_0x3f56('0x13')][_0x3f56('0x16')]);return _0x405032(_0x4d89fb[_0x3f56('0x13')][_0x3f56('0x16')]);}else{logger[_0x3f56('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x193b1c,_0x3f56('0xf'));_0x405032(_0x4d89fb[_0x3f56('0x18')][_0x3f56('0x16')]);}})[_0x3f56('0x19')](function(_0x3d1667){logger[_0x3f56('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x193b1c,_0x3d1667);_0x4adb19(_0x3d1667);});});}exports[_0x3f56('0x1a')]=function(_0x4a0d03){var _0x26ba07=this;return new Promise(function(_0x367a13,_0x429298){return db[_0x3f56('0x1b')][_0x3f56('0x1c')]({'raw':_0x4a0d03[_0x3f56('0x1d')]?_0x4a0d03[_0x3f56('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4a0d03[_0x3f56('0x1d')]?_0x4a0d03[_0x3f56('0x1d')][_0x3f56('0x1e')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x3f56('0x1f')]['fn']('IF',db[_0x3f56('0x1f')][_0x3f56('0x20')](_0x3f56('0x21')))),_0x3f56('0x22')]]})['then'](function(_0x428c58){logger[_0x3f56('0x17')]('GetVoiceQueueRtPauses',_0x4a0d03);logger[_0x3f56('0x10')](_0x3f56('0x1a'),_0x4a0d03,JSON['stringify'](_0x428c58));_0x367a13(_0x428c58);})[_0x3f56('0x19')](function(_0x4b187d){logger[_0x3f56('0x13')](_0x3f56('0x1a'),_0x4b187d[_0x3f56('0x16')],_0x4a0d03);_0x429298(_0x26ba07[_0x3f56('0x13')](0x1f4,_0x4b187d[_0x3f56('0x16')]));});});}; \ No newline at end of file +var _0x8fe5=['`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UserVoiceQueueRt','options','raw','where','COUNT','sequelize'];(function(_0x24681b,_0x31424e){var _0x10d992=function(_0x1c04bc){while(--_0x1c04bc){_0x24681b['push'](_0x24681b['shift']());}};_0x10d992(++_0x31424e);}(_0x8fe5,0x1c0));var _0x58fe=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8fe5[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x58fe('0x0'));var util=require(_0x58fe('0x1'));var moment=require(_0x58fe('0x2'));var BPromise=require(_0x58fe('0x3'));var rs=require(_0x58fe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58fe('0x5'))['db'];var utils=require(_0x58fe('0x6'));var logger=require(_0x58fe('0x7'))(_0x58fe('0x8'));var config=require(_0x58fe('0x9'));var jayson=require(_0x58fe('0xa'));var client=jayson[_0x58fe('0xb')][_0x58fe('0xc')]({'port':0x232a});config[_0x58fe('0xd')]=_['defaults'](config[_0x58fe('0xd')],{'host':_0x58fe('0xe'),'port':0x18eb});var socket=require(_0x58fe('0xf'))(new Redis(config[_0x58fe('0xd')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x5b2338,_0x54cc15,_0x311fea){return new BPromise(function(_0x364430,_0x5d5fb7){return client['request'](_0x5b2338,_0x311fea)['then'](function(_0x25577d){logger[_0x58fe('0x10')](_0x58fe('0x11'),_0x54cc15,'request\x20sent');logger[_0x58fe('0x12')](_0x58fe('0x13'),_0x54cc15,_0x58fe('0x14'),JSON[_0x58fe('0x15')](_0x25577d));if(_0x25577d[_0x58fe('0x16')]){if(_0x25577d['error'][_0x58fe('0x17')]===0x1f4){logger['error'](_0x58fe('0x11'),_0x54cc15,_0x25577d['error'][_0x58fe('0x18')]);return _0x5d5fb7(_0x25577d[_0x58fe('0x16')]['message']);}logger[_0x58fe('0x16')](_0x58fe('0x11'),_0x54cc15,_0x25577d[_0x58fe('0x16')]['message']);return _0x364430(_0x25577d['error'][_0x58fe('0x18')]);}else{logger[_0x58fe('0x10')](_0x58fe('0x11'),_0x54cc15,_0x58fe('0x14'));_0x364430(_0x25577d[_0x58fe('0x19')][_0x58fe('0x18')]);}})[_0x58fe('0x1a')](function(_0x539417){logger[_0x58fe('0x16')](_0x58fe('0x11'),_0x54cc15,_0x539417);_0x5d5fb7(_0x539417);});});}exports['GetVoiceQueueRtPauses']=function(_0x1e25be){var _0x405f9a=this;return new Promise(function(_0x556262,_0x170f20){return db[_0x58fe('0x1b')]['findAll']({'raw':_0x1e25be[_0x58fe('0x1c')]?_0x1e25be[_0x58fe('0x1c')][_0x58fe('0x1d')]===undefined?!![]:![]:!![],'where':_0x1e25be[_0x58fe('0x1c')]?_0x1e25be['options'][_0x58fe('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0x58fe('0x1f'),db[_0x58fe('0x20')]['fn']('IF',db[_0x58fe('0x20')]['literal'](_0x58fe('0x21')))),_0x58fe('0x22')]]})[_0x58fe('0x23')](function(_0x1b4c2c){logger[_0x58fe('0x10')](_0x58fe('0x24'),_0x1e25be);logger[_0x58fe('0x12')](_0x58fe('0x24'),_0x1e25be,JSON[_0x58fe('0x15')](_0x1b4c2c));_0x556262(_0x1b4c2c);})[_0x58fe('0x1a')](function(_0x12bb01){logger[_0x58fe('0x16')]('GetVoiceQueueRtPauses',_0x12bb01[_0x58fe('0x18')],_0x1e25be);_0x170f20(_0x405f9a['error'](0x1f4,_0x12bb01[_0x58fe('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index ccf2cf7..263a102 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 _0x0c23=['remove','update','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x5d53e6,_0x1447cd){var _0x44aedc=function(_0x1ea9fa){while(--_0x1ea9fa){_0x5d53e6['push'](_0x5d53e6['shift']());}};_0x44aedc(++_0x1447cd);}(_0x0c23,0x13e));var _0x30c2=function(_0x5157c3,_0x1093fa){_0x5157c3=_0x5157c3-0x0;var _0x4c994a=_0x0c23[_0x5157c3];return _0x4c994a;};'use strict';var UserVoiceQueueRtEvents=require(_0x30c2('0x0'));var events=[_0x30c2('0x1'),_0x30c2('0x2'),_0x30c2('0x3')];function createListener(_0x14066d,_0x1447df){return function(_0x6b7a72){_0x1447df['emit'](_0x14066d,_0x6b7a72);};}function removeListener(_0x2972f4,_0x2aa353){return function(){UserVoiceQueueRtEvents[_0x30c2('0x4')](_0x2972f4,_0x2aa353);};}exports[_0x30c2('0x5')]=function(_0x28630b){for(var _0x166e7a=0x0,_0x4f1eba=events[_0x30c2('0x6')];_0x166e7a<_0x4f1eba;_0x166e7a++){var _0x41b74d=events[_0x166e7a];var _0x202dfe=createListener(_0x30c2('0x7')+_0x41b74d,_0x28630b);UserVoiceQueueRtEvents['on'](_0x41b74d,_0x202dfe);}}; \ No newline at end of file +var _0xa423=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x5575c1,_0x11b31a){var _0x50ea4e=function(_0x225d89){while(--_0x225d89){_0x5575c1['push'](_0x5575c1['shift']());}};_0x50ea4e(++_0x11b31a);}(_0xa423,0x16c));var _0x3a42=function(_0x11612a,_0xe7bf7a){_0x11612a=_0x11612a-0x0;var _0x3b6cfd=_0xa423[_0x11612a];return _0x3b6cfd;};'use strict';var UserVoiceQueueRtEvents=require(_0x3a42('0x0'));var events=[_0x3a42('0x1'),_0x3a42('0x2'),_0x3a42('0x3')];function createListener(_0x27fd92,_0x599118){return function(_0x28bbcd){_0x599118[_0x3a42('0x4')](_0x27fd92,_0x28bbcd);};}function removeListener(_0x5c4f6a,_0xc6780b){return function(){UserVoiceQueueRtEvents[_0x3a42('0x5')](_0x5c4f6a,_0xc6780b);};}exports[_0x3a42('0x6')]=function(_0x1bbd5b){for(var _0x3a83e1=0x0,_0x563134=events[_0x3a42('0x7')];_0x3a83e1<_0x563134;_0x3a83e1++){var _0x439418=events[_0x3a83e1];var _0x3a51c5=createListener(_0x3a42('0x8')+_0x439418,_0x1bbd5b);UserVoiceQueueRtEvents['on'](_0x439418,_0x3a51c5);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index b7ea58b..138a195 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x127779,_0x1a661e){var _0x5bbd23=function(_0x3dc9b0){while(--_0x3dc9b0){_0x127779['push'](_0x127779['shift']());}};_0x5bbd23(++_0x1a661e);}(_0x70e0,0x17b));var _0x070e=function(_0x5587bf,_0x1c7dcd){_0x5587bf=_0x5587bf-0x0;var _0x10783d=_0x70e0[_0x5587bf];return _0x10783d;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3336dd,_0x12b235){var _0x36338e=function(_0x3d9bdf){while(--_0x3d9bdf){_0x3336dd['push'](_0x3336dd['shift']());}};_0x36338e(++_0x12b235);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 7da806d..8d6eb5c 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 _0x234f=['exports','INTEGER','sequelize'];(function(_0x1633a5,_0x2cde87){var _0x57eb76=function(_0x219443){while(--_0x219443){_0x1633a5['push'](_0x1633a5['shift']());}};_0x57eb76(++_0x2cde87);}(_0x234f,0xb6));var _0xf234=function(_0xa27bf5,_0x1bd1c2){_0xa27bf5=_0xa27bf5-0x0;var _0x5daad1=_0x234f[_0xa27bf5];return _0x5daad1;};'use strict';var Sequelize=require(_0xf234('0x0'));module[_0xf234('0x1')]={'penalty':{'type':Sequelize[_0xf234('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0970=['exports','INTEGER'];(function(_0x242ab0,_0x444081){var _0x44e451=function(_0x3c8311){while(--_0x3c8311){_0x242ab0['push'](_0x242ab0['shift']());}};_0x44e451(++_0x444081);}(_0x0970,0x11e));var _0x0097=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0970[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0x0097('0x0')]={'penalty':{'type':Sequelize[_0x0097('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 b8d6dc6..7094de6 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 _0xed64=['./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2ec59e,_0x20cbbf){var _0x589b50=function(_0x490806){while(--_0x490806){_0x2ec59e['push'](_0x2ec59e['shift']());}};_0x589b50(++_0x20cbbf);}(_0xed64,0x1f3));var _0x4ed6=function(_0x206711,_0x4125b4){_0x206711=_0x206711-0x0;var _0x4fe02b=_0xed64[_0x206711];return _0x4fe02b;};'use strict';var _=require('lodash');var util=require(_0x4ed6('0x0'));var logger=require(_0x4ed6('0x1'))(_0x4ed6('0x2'));var moment=require(_0x4ed6('0x3'));var BPromise=require(_0x4ed6('0x4'));var rp=require(_0x4ed6('0x5'));var fs=require('fs');var path=require(_0x4ed6('0x6'));var rimraf=require('rimraf');var config=require(_0x4ed6('0x7'));var attributes=require(_0x4ed6('0x8'));module[_0x4ed6('0x9')]=function(_0x3e7848,_0x15428b){return _0x3e7848[_0x4ed6('0xa')](_0x4ed6('0xb'),attributes,{'tableName':_0x4ed6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4284=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','util','../../config/logger'];(function(_0x56c948,_0x16572e){var _0x2e26a6=function(_0x438032){while(--_0x438032){_0x56c948['push'](_0x56c948['shift']());}};_0x2e26a6(++_0x16572e);}(_0x4284,0x1e7));var _0x4428=function(_0xde17e9,_0x33e4bc){_0xde17e9=_0xde17e9-0x0;var _0x1b1363=_0x4284[_0xde17e9];return _0x1b1363;};'use strict';var _=require(_0x4428('0x0'));var util=require(_0x4428('0x1'));var logger=require(_0x4428('0x2'))(_0x4428('0x3'));var moment=require(_0x4428('0x4'));var BPromise=require(_0x4428('0x5'));var rp=require(_0x4428('0x6'));var fs=require('fs');var path=require(_0x4428('0x7'));var rimraf=require(_0x4428('0x8'));var config=require(_0x4428('0x9'));var attributes=require(_0x4428('0xa'));module[_0x4428('0xb')]=function(_0x1ea6c5,_0x4fcdda){return _0x1ea6c5[_0x4428('0xc')]('UserWhatsappQueue',attributes,{'tableName':_0x4428('0xd'),'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 59089a1..d03f267 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 _0xf0eb=['message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','info','request\x20sent','error','code','UserWhatsappQueue,\x20%s,\x20%s'];(function(_0x4f692b,_0x1f8fd6){var _0x105684=function(_0x395880){while(--_0x395880){_0x4f692b['push'](_0x4f692b['shift']());}};_0x105684(++_0x1f8fd6);}(_0xf0eb,0x123));var _0xbf0e=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0xf0eb[_0x291f8b];return _0x275171;};'use strict';var _=require(_0xbf0e('0x0'));var util=require(_0xbf0e('0x1'));var moment=require(_0xbf0e('0x2'));var BPromise=require(_0xbf0e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf0e('0x4'))['db'];var utils=require(_0xbf0e('0x5'));var logger=require('../../config/logger')(_0xbf0e('0x6'));var config=require(_0xbf0e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbf0e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54808d,_0x96ae18,_0x2e91b9){return new BPromise(function(_0x27b5ce,_0x4aedf0){return client[_0xbf0e('0x9')](_0x54808d,_0x2e91b9)['then'](function(_0x5b6828){logger[_0xbf0e('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x96ae18,_0xbf0e('0xb'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x96ae18,_0xbf0e('0xb'),JSON['stringify'](_0x5b6828));if(_0x5b6828[_0xbf0e('0xc')]){if(_0x5b6828[_0xbf0e('0xc')][_0xbf0e('0xd')]===0x1f4){logger[_0xbf0e('0xc')](_0xbf0e('0xe'),_0x96ae18,_0x5b6828[_0xbf0e('0xc')][_0xbf0e('0xf')]);return _0x4aedf0(_0x5b6828[_0xbf0e('0xc')][_0xbf0e('0xf')]);}logger[_0xbf0e('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x96ae18,_0x5b6828[_0xbf0e('0xc')][_0xbf0e('0xf')]);return _0x27b5ce(_0x5b6828[_0xbf0e('0xc')]['message']);}else{logger[_0xbf0e('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x96ae18,_0xbf0e('0xb'));_0x27b5ce(_0x5b6828[_0xbf0e('0x10')]['message']);}})[_0xbf0e('0x11')](function(_0x391c1f){logger['error'](_0xbf0e('0xe'),_0x96ae18,_0x391c1f);_0x4aedf0(_0x391c1f);});});} \ No newline at end of file +var _0x6c0a=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3e0b8f,_0x1cddeb){var _0x22f742=function(_0xacb1bc){while(--_0xacb1bc){_0x3e0b8f['push'](_0x3e0b8f['shift']());}};_0x22f742(++_0x1cddeb);}(_0x6c0a,0x171));var _0xa6c0=function(_0x24bbbd,_0x2f4986){_0x24bbbd=_0x24bbbd-0x0;var _0x57173a=_0x6c0a[_0x24bbbd];return _0x57173a;};'use strict';var _=require(_0xa6c0('0x0'));var util=require(_0xa6c0('0x1'));var moment=require(_0xa6c0('0x2'));var BPromise=require(_0xa6c0('0x3'));var rs=require(_0xa6c0('0x4'));var fs=require('fs');var Redis=require(_0xa6c0('0x5'));var db=require(_0xa6c0('0x6'))['db'];var utils=require(_0xa6c0('0x7'));var logger=require('../../config/logger')(_0xa6c0('0x8'));var config=require(_0xa6c0('0x9'));var jayson=require(_0xa6c0('0xa'));var client=jayson[_0xa6c0('0xb')][_0xa6c0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2712d9,_0x458d2d,_0x2372e7){return new BPromise(function(_0x141a7e,_0x58533a){return client[_0xa6c0('0xd')](_0x2712d9,_0x2372e7)[_0xa6c0('0xe')](function(_0x461d46){logger['info'](_0xa6c0('0xf'),_0x458d2d,_0xa6c0('0x10'));logger['debug'](_0xa6c0('0x11'),_0x458d2d,_0xa6c0('0x10'),JSON[_0xa6c0('0x12')](_0x461d46));if(_0x461d46[_0xa6c0('0x13')]){if(_0x461d46[_0xa6c0('0x13')]['code']===0x1f4){logger[_0xa6c0('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x458d2d,_0x461d46[_0xa6c0('0x13')][_0xa6c0('0x14')]);return _0x58533a(_0x461d46[_0xa6c0('0x13')][_0xa6c0('0x14')]);}logger[_0xa6c0('0x13')](_0xa6c0('0xf'),_0x458d2d,_0x461d46[_0xa6c0('0x13')][_0xa6c0('0x14')]);return _0x141a7e(_0x461d46['error'][_0xa6c0('0x14')]);}else{logger[_0xa6c0('0x15')](_0xa6c0('0xf'),_0x458d2d,'request\x20sent');_0x141a7e(_0x461d46[_0xa6c0('0x16')][_0xa6c0('0x14')]);}})[_0xa6c0('0x17')](function(_0x43d8e2){logger['error'](_0xa6c0('0xf'),_0x458d2d,_0x43d8e2);_0x58533a(_0x43d8e2);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 918a7e6..6954004 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 _0xcee0=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer','util'];(function(_0x51ebb3,_0x52ce46){var _0x36dc3c=function(_0x1ca64c){while(--_0x1ca64c){_0x51ebb3['push'](_0x51ebb3['shift']());}};_0x36dc3c(++_0x52ce46);}(_0xcee0,0x1e1));var _0x0cee=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0xcee0[_0x13137e];return _0x346261;};'use strict';var multer=require(_0x0cee('0x0'));var util=require(_0x0cee('0x1'));var path=require(_0x0cee('0x2'));var timeout=require(_0x0cee('0x3'));var express=require(_0x0cee('0x4'));var router=express[_0x0cee('0x5')]();var fs_extra=require(_0x0cee('0x6'));var auth=require(_0x0cee('0x7'));var interaction=require(_0x0cee('0x8'));var config=require('../../config/environment');var controller=require(_0x0cee('0x9'));router[_0x0cee('0xa')]('/',auth[_0x0cee('0xb')](),controller[_0x0cee('0xc')]);router[_0x0cee('0xa')]('/:id',auth[_0x0cee('0xb')](),controller[_0x0cee('0xd')]);router[_0x0cee('0xe')]('/',auth[_0x0cee('0xb')](),controller[_0x0cee('0xf')]);router[_0x0cee('0x10')](_0x0cee('0x11'),auth[_0x0cee('0xb')](),controller[_0x0cee('0x12')]);router[_0x0cee('0x13')](_0x0cee('0x11'),auth[_0x0cee('0xb')](),controller['destroy']);module[_0x0cee('0x14')]=router; \ No newline at end of file +var _0x225c=['/:id','show','post','create','update','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated'];(function(_0x130cc3,_0x1153fc){var _0x202fdf=function(_0x306539){while(--_0x306539){_0x130cc3['push'](_0x130cc3['shift']());}};_0x202fdf(++_0x1153fc);}(_0x225c,0x106));var _0xc225=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x225c[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xc225('0x0'));var util=require(_0xc225('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc225('0x2'));var router=express['Router']();var fs_extra=require(_0xc225('0x3'));var auth=require(_0xc225('0x4'));var interaction=require(_0xc225('0x5'));var config=require(_0xc225('0x6'));var controller=require(_0xc225('0x7'));router[_0xc225('0x8')]('/',auth[_0xc225('0x9')](),controller['index']);router[_0xc225('0x8')](_0xc225('0xa'),auth[_0xc225('0x9')](),controller[_0xc225('0xb')]);router[_0xc225('0xc')]('/',auth['isAuthenticated'](),controller[_0xc225('0xd')]);router['put'](_0xc225('0xa'),auth[_0xc225('0x9')](),controller[_0xc225('0xe')]);router['delete'](_0xc225('0xa'),auth[_0xc225('0x9')](),controller[_0xc225('0xf')]);module[_0xc225('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 448c6ca..69ec4fc 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 _0xbb97=['STRING','sequelize'];(function(_0xab58e1,_0x5d47ce){var _0x295351=function(_0x43f2a7){while(--_0x43f2a7){_0xab58e1['push'](_0xab58e1['shift']());}};_0x295351(++_0x5d47ce);}(_0xbb97,0x10f));var _0x7bb9=function(_0x3167ef,_0x18fa48){_0x3167ef=_0x3167ef-0x0;var _0x5f4eaa=_0xbb97[_0x3167ef];return _0x5f4eaa;};'use strict';var Sequelize=require(_0x7bb9('0x0'));module['exports']={'name':{'type':Sequelize[_0x7bb9('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7bb9('0x1')]}}; \ No newline at end of file +var _0xec12=['exports','name','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec12,0x1bf));var _0x2ec1=function(_0xab33e8,_0x39de98){_0xab33e8=_0xab33e8-0x0;var _0x160dc0=_0xec12[_0xab33e8];return _0x160dc0;};'use strict';var Sequelize=require(_0x2ec1('0x0'));module[_0x2ec1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2ec1('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2ec1('0x3')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 91e270f..1a7ef55 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 _0x1e15=['undefined','limit','count','set','Content-Range','apply','reject','destroy','then','get','Variables','sendStatus','stack','name','send','Variable','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','catch','create','body','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','offset'];(function(_0x9ae47d,_0x3e4816){var _0x178c1d=function(_0x3a8e28){while(--_0x3a8e28){_0x9ae47d['push'](_0x9ae47d['shift']());}};_0x178c1d(++_0x3e4816);}(_0x1e15,0x81));var _0x51e1=function(_0x33be19,_0x515ad0){_0x33be19=_0x33be19-0x0;var _0x360b58=_0x1e15[_0x33be19];return _0x360b58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x51e1('0x0'));var zipdir=require(_0x51e1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51e1('0x2'));var moment=require(_0x51e1('0x3'));var BPromise=require(_0x51e1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x51e1('0x5'));var sox=require(_0x51e1('0x6'));var csv=require(_0x51e1('0x7'));var ejs=require(_0x51e1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x51e1('0x9'));var crypto=require(_0x51e1('0xa'));var jsforce=require(_0x51e1('0xb'));var deskjs=require(_0x51e1('0xc'));var toCsv=require(_0x51e1('0x7'));var querystring=require('querystring');var Papa=require(_0x51e1('0xd'));var Redis=require(_0x51e1('0xe'));var authService=require(_0x51e1('0xf'));var qs=require(_0x51e1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x51e1('0x11'));var logger=require(_0x51e1('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x51e1('0x13'));var licenseUtil=require(_0x51e1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e5661,_0x538ecc){_0x538ecc=_0x538ecc||0xcc;return function(_0x127cd6){if(_0x127cd6){return _0x2e5661['sendStatus'](_0x538ecc);}return _0x2e5661[_0x51e1('0x15')](_0x538ecc)[_0x51e1('0x16')]();};}function respondWithResult(_0x3b7d09,_0x2c76d2){_0x2c76d2=_0x2c76d2||0xc8;return function(_0x1a2bc7){if(_0x1a2bc7){return _0x3b7d09['status'](_0x2c76d2)[_0x51e1('0x17')](_0x1a2bc7);}};}function respondWithFilteredResult(_0x2dc8a8,_0x25cac8){return function(_0x3940fa){if(_0x3940fa){var _0x1fc69d=typeof _0x25cac8[_0x51e1('0x18')]===_0x51e1('0x19')&&typeof _0x25cac8[_0x51e1('0x1a')]===_0x51e1('0x19');var _0x5d1253=_0x3940fa[_0x51e1('0x1b')];var _0x2aa35d=_0x1fc69d?0x0:_0x25cac8[_0x51e1('0x18')];var _0x4af5c1=_0x1fc69d?_0x3940fa[_0x51e1('0x1b')]:_0x25cac8[_0x51e1('0x18')]+_0x25cac8[_0x51e1('0x1a')];var _0x207253;if(_0x4af5c1>=_0x5d1253){_0x4af5c1=_0x5d1253;_0x207253=0xc8;}else{_0x207253=0xce;}_0x2dc8a8[_0x51e1('0x15')](_0x207253);return _0x2dc8a8[_0x51e1('0x1c')](_0x51e1('0x1d'),_0x2aa35d+'-'+_0x4af5c1+'/'+_0x5d1253)['json'](_0x3940fa);}return null;};}function patchUpdates(_0x3e794f){return function(_0x516f5d){try{jsonpatch[_0x51e1('0x1e')](_0x516f5d,_0x3e794f,!![]);}catch(_0x5ed972){return BPromise[_0x51e1('0x1f')](_0x5ed972);}return _0x516f5d['save']();};}function saveUpdates(_0x4cf93d,_0x3654c2){return function(_0x1d179e){if(_0x1d179e){return _0x1d179e['update'](_0x4cf93d)['then'](function(_0x42cc91){return _0x42cc91;});}return null;};}function removeEntity(_0x2c9c2c,_0x11ffaf){return function(_0x276b15){if(_0x276b15){return _0x276b15[_0x51e1('0x20')]()[_0x51e1('0x21')](function(){var _0x368307=_0x276b15[_0x51e1('0x22')]({'plain':!![]});var _0xe12920=_0x51e1('0x23');return db['UserProfileResource'][_0x51e1('0x20')]({'where':{'type':_0xe12920,'resourceId':_0x368307['id']}})[_0x51e1('0x21')](function(){return _0x276b15;});})[_0x51e1('0x21')](function(){_0x2c9c2c[_0x51e1('0x15')](0xcc)[_0x51e1('0x16')]();});}};}function handleEntityNotFound(_0x362ed0,_0x23a59c){return function(_0x290b77){if(!_0x290b77){_0x362ed0[_0x51e1('0x24')](0x194);}return _0x290b77;};}function handleError(_0x3d57dc,_0x49b6da){_0x49b6da=_0x49b6da||0x1f4;return function(_0x30f82e){logger['error'](_0x30f82e[_0x51e1('0x25')]);if(_0x30f82e['name']){delete _0x30f82e[_0x51e1('0x26')];}_0x3d57dc[_0x51e1('0x15')](_0x49b6da)[_0x51e1('0x27')](_0x30f82e);};}exports['index']=function(_0x24f0a1,_0x23be98){var _0x515282={},_0x20296d={},_0x402ebe={'count':0x0,'rows':[]};var _0x39fbb1=_['map'](db[_0x51e1('0x28')][_0x51e1('0x29')],function(_0x243fae){return{'name':_0x243fae['fieldName'],'type':_0x243fae[_0x51e1('0x2a')]['key']};});_0x20296d[_0x51e1('0x2b')]=_['map'](_0x39fbb1,_0x51e1('0x26'));_0x20296d['query']=_[_0x51e1('0x2c')](_0x24f0a1[_0x51e1('0x2d')]);_0x20296d[_0x51e1('0x2e')]=_['intersection'](_0x20296d[_0x51e1('0x2b')],_0x20296d['query']);_0x515282['attributes']=_[_0x51e1('0x2f')](_0x20296d[_0x51e1('0x2b')],qs[_0x51e1('0x30')](_0x24f0a1['query'][_0x51e1('0x30')]));_0x515282['attributes']=_0x515282[_0x51e1('0x31')][_0x51e1('0x32')]?_0x515282[_0x51e1('0x31')]:_0x20296d[_0x51e1('0x2b')];if(!_0x24f0a1[_0x51e1('0x2d')][_0x51e1('0x33')]('nolimit')){_0x515282[_0x51e1('0x1a')]=qs['limit'](_0x24f0a1[_0x51e1('0x2d')]['limit']);_0x515282[_0x51e1('0x18')]=qs[_0x51e1('0x18')](_0x24f0a1[_0x51e1('0x2d')][_0x51e1('0x18')]);}_0x515282[_0x51e1('0x34')]=qs[_0x51e1('0x35')](_0x24f0a1[_0x51e1('0x2d')][_0x51e1('0x35')]);_0x515282['where']=qs[_0x51e1('0x2e')](_[_0x51e1('0x36')](_0x24f0a1[_0x51e1('0x2d')],_0x20296d['filters']),_0x39fbb1);if(_0x24f0a1['query']['filter']){_0x515282[_0x51e1('0x37')]=_[_0x51e1('0x38')](_0x515282[_0x51e1('0x37')],{'$or':_[_0x51e1('0x39')](_0x39fbb1,function(_0x3b3483){if(_0x3b3483[_0x51e1('0x2a')]!==_0x51e1('0x3a')){var _0x13ee9b={};_0x13ee9b[_0x3b3483[_0x51e1('0x26')]]={'$like':'%'+_0x24f0a1[_0x51e1('0x2d')][_0x51e1('0x3b')]+'%'};return _0x13ee9b;}})});}_0x515282=_[_0x51e1('0x38')]({},_0x515282,_0x24f0a1[_0x51e1('0x3c')]);var _0x5e3372={'where':_0x515282[_0x51e1('0x37')]};return db['Variable']['count'](_0x5e3372)['then'](function(_0x5a01fc){_0x402ebe[_0x51e1('0x1b')]=_0x5a01fc;if(_0x24f0a1['query'][_0x51e1('0x3d')]){_0x515282[_0x51e1('0x3e')]=[{'all':!![]}];}return db[_0x51e1('0x28')][_0x51e1('0x3f')](_0x515282);})[_0x51e1('0x21')](function(_0x4ec94b){_0x402ebe[_0x51e1('0x40')]=_0x4ec94b;return _0x402ebe;})[_0x51e1('0x21')](respondWithFilteredResult(_0x23be98,_0x515282))['catch'](handleError(_0x23be98,null));};exports['show']=function(_0x4d1b54,_0x126a26){var _0x3d8e9b={'raw':!![],'where':{'id':_0x4d1b54[_0x51e1('0x41')]['id']}},_0x50d772={};_0x50d772[_0x51e1('0x2b')]=_[_0x51e1('0x2c')](db[_0x51e1('0x28')][_0x51e1('0x29')]);_0x50d772[_0x51e1('0x2d')]=_[_0x51e1('0x2c')](_0x4d1b54[_0x51e1('0x2d')]);_0x50d772[_0x51e1('0x2e')]=_[_0x51e1('0x2f')](_0x50d772[_0x51e1('0x2b')],_0x50d772[_0x51e1('0x2d')]);_0x3d8e9b[_0x51e1('0x31')]=_[_0x51e1('0x2f')](_0x50d772['model'],qs[_0x51e1('0x30')](_0x4d1b54[_0x51e1('0x2d')][_0x51e1('0x30')]));_0x3d8e9b[_0x51e1('0x31')]=_0x3d8e9b[_0x51e1('0x31')][_0x51e1('0x32')]?_0x3d8e9b['attributes']:_0x50d772[_0x51e1('0x2b')];if(_0x4d1b54['query'][_0x51e1('0x3d')]){_0x3d8e9b[_0x51e1('0x3e')]=[{'all':!![]}];}_0x3d8e9b=_['merge']({},_0x3d8e9b,_0x4d1b54['options']);return db['Variable'][_0x51e1('0x42')](_0x3d8e9b)[_0x51e1('0x21')](handleEntityNotFound(_0x126a26,null))[_0x51e1('0x21')](respondWithResult(_0x126a26,null))[_0x51e1('0x43')](handleError(_0x126a26,null));};exports['create']=function(_0x45de62,_0x4ad518){return db[_0x51e1('0x28')][_0x51e1('0x44')](_0x45de62[_0x51e1('0x45')],{})[_0x51e1('0x21')](function(_0x34c296){var _0x4af42e=_0x45de62[_0x51e1('0x46')]['get']({'plain':!![]});if(!_0x4af42e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4af42e['role']===_0x51e1('0x46')){var _0x3e6efc=_0x34c296['get']({'plain':!![]});var _0x28e690=_0x51e1('0x23');return db[_0x51e1('0x47')]['find']({'where':{'name':_0x28e690,'userProfileId':_0x4af42e[_0x51e1('0x48')]},'raw':!![]})[_0x51e1('0x21')](function(_0xb02498){if(_0xb02498&&_0xb02498[_0x51e1('0x49')]===0x0){return db['UserProfileResource'][_0x51e1('0x44')]({'name':_0x3e6efc['name'],'resourceId':_0x3e6efc['id'],'type':_0xb02498[_0x51e1('0x26')],'sectionId':_0xb02498['id']},{})['then'](function(){return _0x34c296;});}else{return _0x34c296;}})[_0x51e1('0x43')](function(_0x311c63){logger[_0x51e1('0x4a')](_0x51e1('0x4b'),_0x311c63);throw _0x311c63;});}return _0x34c296;})[_0x51e1('0x21')](respondWithResult(_0x4ad518,0xc9))[_0x51e1('0x43')](handleError(_0x4ad518,null));};exports[_0x51e1('0x4c')]=function(_0x4bd955,_0x54c568){if(_0x4bd955[_0x51e1('0x45')]['id']){delete _0x4bd955[_0x51e1('0x45')]['id'];}return db[_0x51e1('0x28')][_0x51e1('0x42')]({'where':{'id':_0x4bd955[_0x51e1('0x41')]['id']}})['then'](handleEntityNotFound(_0x54c568,null))['then'](saveUpdates(_0x4bd955[_0x51e1('0x45')],null))[_0x51e1('0x21')](respondWithResult(_0x54c568,null))[_0x51e1('0x43')](handleError(_0x54c568,null));};exports[_0x51e1('0x20')]=function(_0x7f2a9e,_0x45b57d){return db[_0x51e1('0x28')]['find']({'where':{'id':_0x7f2a9e['params']['id']}})[_0x51e1('0x21')](handleEntityNotFound(_0x45b57d,null))[_0x51e1('0x21')](removeEntity(_0x45b57d,null))[_0x51e1('0x43')](handleError(_0x45b57d,null));}; \ No newline at end of file +var _0xc894=['error','stack','name','send','index','map','Variable','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Variables','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x45f569,_0x49e9d4){var _0x2bb653=function(_0x1a99fb){while(--_0x1a99fb){_0x45f569['push'](_0x45f569['shift']());}};_0x2bb653(++_0x49e9d4);}(_0xc894,0x12d));var _0x4c89=function(_0xbce0b9,_0x5c748d){_0xbce0b9=_0xbce0b9-0x0;var _0xb9ebce=_0xc894[_0xbce0b9];return _0xb9ebce;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c89('0x0'));var jsonpatch=require(_0x4c89('0x1'));var rp=require(_0x4c89('0x2'));var moment=require('moment');var BPromise=require(_0x4c89('0x3'));var Mustache=require(_0x4c89('0x4'));var util=require('util');var path=require(_0x4c89('0x5'));var sox=require(_0x4c89('0x6'));var csv=require(_0x4c89('0x7'));var ejs=require(_0x4c89('0x8'));var fs=require('fs');var fs_extra=require(_0x4c89('0x9'));var _=require(_0x4c89('0xa'));var squel=require(_0x4c89('0xb'));var crypto=require(_0x4c89('0xc'));var jsforce=require(_0x4c89('0xd'));var deskjs=require(_0x4c89('0xe'));var toCsv=require(_0x4c89('0x7'));var querystring=require(_0x4c89('0xf'));var Papa=require(_0x4c89('0x10'));var Redis=require(_0x4c89('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4c89('0x12'));var as=require(_0x4c89('0x13'));var hardwareService=require(_0x4c89('0x14'));var logger=require(_0x4c89('0x15'))(_0x4c89('0x16'));var utils=require(_0x4c89('0x17'));var config=require(_0x4c89('0x18'));var licenseUtil=require(_0x4c89('0x19'));var db=require(_0x4c89('0x1a'))['db'];function respondWithStatusCode(_0x1d7ab2,_0x5a2a8c){_0x5a2a8c=_0x5a2a8c||0xcc;return function(_0x3aba65){if(_0x3aba65){return _0x1d7ab2[_0x4c89('0x1b')](_0x5a2a8c);}return _0x1d7ab2['status'](_0x5a2a8c)[_0x4c89('0x1c')]();};}function respondWithResult(_0x1c905e,_0x2428b1){_0x2428b1=_0x2428b1||0xc8;return function(_0x508169){if(_0x508169){return _0x1c905e[_0x4c89('0x1d')](_0x2428b1)[_0x4c89('0x1e')](_0x508169);}};}function respondWithFilteredResult(_0x2d06cf,_0x51ffba){return function(_0x5ca04a){if(_0x5ca04a){var _0x3189df=typeof _0x51ffba[_0x4c89('0x1f')]===_0x4c89('0x20')&&typeof _0x51ffba[_0x4c89('0x21')]===_0x4c89('0x20');var _0x1c340c=_0x5ca04a[_0x4c89('0x22')];var _0x304a9c=_0x3189df?0x0:_0x51ffba[_0x4c89('0x1f')];var _0x130674=_0x3189df?_0x5ca04a[_0x4c89('0x22')]:_0x51ffba[_0x4c89('0x1f')]+_0x51ffba['limit'];var _0x1d898d;if(_0x130674>=_0x1c340c){_0x130674=_0x1c340c;_0x1d898d=0xc8;}else{_0x1d898d=0xce;}_0x2d06cf[_0x4c89('0x1d')](_0x1d898d);return _0x2d06cf[_0x4c89('0x23')](_0x4c89('0x24'),_0x304a9c+'-'+_0x130674+'/'+_0x1c340c)[_0x4c89('0x1e')](_0x5ca04a);}return null;};}function patchUpdates(_0xbab41f){return function(_0x5c01d4){try{jsonpatch[_0x4c89('0x25')](_0x5c01d4,_0xbab41f,!![]);}catch(_0x3acfc8){return BPromise[_0x4c89('0x26')](_0x3acfc8);}return _0x5c01d4[_0x4c89('0x27')]();};}function saveUpdates(_0x5b7b2b,_0x3c3b8c){return function(_0x28bae1){if(_0x28bae1){return _0x28bae1[_0x4c89('0x28')](_0x5b7b2b)['then'](function(_0x12bfe7){return _0x12bfe7;});}return null;};}function removeEntity(_0x304c7b,_0x95fafe){return function(_0x5cf11b){if(_0x5cf11b){return _0x5cf11b[_0x4c89('0x29')]()[_0x4c89('0x2a')](function(){var _0x1ae0f4=_0x5cf11b['get']({'plain':!![]});var _0x3c049f='Variables';return db['UserProfileResource']['destroy']({'where':{'type':_0x3c049f,'resourceId':_0x1ae0f4['id']}})['then'](function(){return _0x5cf11b;});})[_0x4c89('0x2a')](function(){_0x304c7b[_0x4c89('0x1d')](0xcc)[_0x4c89('0x1c')]();});}};}function handleEntityNotFound(_0x5be318,_0x5526e0){return function(_0x18102e){if(!_0x18102e){_0x5be318[_0x4c89('0x1b')](0x194);}return _0x18102e;};}function handleError(_0x222a3b,_0x4395cf){_0x4395cf=_0x4395cf||0x1f4;return function(_0x37ccb7){logger[_0x4c89('0x2b')](_0x37ccb7[_0x4c89('0x2c')]);if(_0x37ccb7[_0x4c89('0x2d')]){delete _0x37ccb7[_0x4c89('0x2d')];}_0x222a3b[_0x4c89('0x1d')](_0x4395cf)[_0x4c89('0x2e')](_0x37ccb7);};}exports[_0x4c89('0x2f')]=function(_0x314224,_0xb2811c){var _0x21f363={},_0x2ce649={},_0x1b350c={'count':0x0,'rows':[]};var _0x3065a5=_[_0x4c89('0x30')](db[_0x4c89('0x31')][_0x4c89('0x32')],function(_0x2af9c4){return{'name':_0x2af9c4['fieldName'],'type':_0x2af9c4['type']['key']};});_0x2ce649[_0x4c89('0x33')]=_['map'](_0x3065a5,_0x4c89('0x2d'));_0x2ce649[_0x4c89('0x34')]=_[_0x4c89('0x35')](_0x314224[_0x4c89('0x34')]);_0x2ce649[_0x4c89('0x36')]=_[_0x4c89('0x37')](_0x2ce649[_0x4c89('0x33')],_0x2ce649[_0x4c89('0x34')]);_0x21f363['attributes']=_[_0x4c89('0x37')](_0x2ce649[_0x4c89('0x33')],qs[_0x4c89('0x38')](_0x314224[_0x4c89('0x34')][_0x4c89('0x38')]));_0x21f363['attributes']=_0x21f363[_0x4c89('0x39')][_0x4c89('0x3a')]?_0x21f363[_0x4c89('0x39')]:_0x2ce649[_0x4c89('0x33')];if(!_0x314224['query'][_0x4c89('0x3b')](_0x4c89('0x3c'))){_0x21f363['limit']=qs['limit'](_0x314224['query'][_0x4c89('0x21')]);_0x21f363['offset']=qs['offset'](_0x314224[_0x4c89('0x34')]['offset']);}_0x21f363[_0x4c89('0x3d')]=qs[_0x4c89('0x3e')](_0x314224['query'][_0x4c89('0x3e')]);_0x21f363['where']=qs['filters'](_[_0x4c89('0x3f')](_0x314224[_0x4c89('0x34')],_0x2ce649[_0x4c89('0x36')]),_0x3065a5);if(_0x314224[_0x4c89('0x34')][_0x4c89('0x40')]){_0x21f363[_0x4c89('0x41')]=_[_0x4c89('0x42')](_0x21f363[_0x4c89('0x41')],{'$or':_['map'](_0x3065a5,function(_0x18de9d){if(_0x18de9d['type']!==_0x4c89('0x43')){var _0x5a8674={};_0x5a8674[_0x18de9d['name']]={'$like':'%'+_0x314224[_0x4c89('0x34')][_0x4c89('0x40')]+'%'};return _0x5a8674;}})});}_0x21f363=_[_0x4c89('0x42')]({},_0x21f363,_0x314224['options']);var _0x2d6a24={'where':_0x21f363[_0x4c89('0x41')]};return db[_0x4c89('0x31')]['count'](_0x2d6a24)[_0x4c89('0x2a')](function(_0x9dd283){_0x1b350c[_0x4c89('0x22')]=_0x9dd283;if(_0x314224[_0x4c89('0x34')][_0x4c89('0x44')]){_0x21f363[_0x4c89('0x45')]=[{'all':!![]}];}return db[_0x4c89('0x31')][_0x4c89('0x46')](_0x21f363);})[_0x4c89('0x2a')](function(_0x2046cf){_0x1b350c['rows']=_0x2046cf;return _0x1b350c;})[_0x4c89('0x2a')](respondWithFilteredResult(_0xb2811c,_0x21f363))[_0x4c89('0x47')](handleError(_0xb2811c,null));};exports[_0x4c89('0x48')]=function(_0x2650c0,_0x13f975){var _0x39d081={'raw':!![],'where':{'id':_0x2650c0['params']['id']}},_0x3e0606={};_0x3e0606[_0x4c89('0x33')]=_[_0x4c89('0x35')](db['Variable'][_0x4c89('0x32')]);_0x3e0606[_0x4c89('0x34')]=_[_0x4c89('0x35')](_0x2650c0['query']);_0x3e0606[_0x4c89('0x36')]=_[_0x4c89('0x37')](_0x3e0606['model'],_0x3e0606['query']);_0x39d081[_0x4c89('0x39')]=_[_0x4c89('0x37')](_0x3e0606[_0x4c89('0x33')],qs['fields'](_0x2650c0[_0x4c89('0x34')][_0x4c89('0x38')]));_0x39d081[_0x4c89('0x39')]=_0x39d081['attributes']['length']?_0x39d081[_0x4c89('0x39')]:_0x3e0606[_0x4c89('0x33')];if(_0x2650c0[_0x4c89('0x34')][_0x4c89('0x44')]){_0x39d081['include']=[{'all':!![]}];}_0x39d081=_[_0x4c89('0x42')]({},_0x39d081,_0x2650c0[_0x4c89('0x49')]);return db[_0x4c89('0x31')][_0x4c89('0x4a')](_0x39d081)['then'](handleEntityNotFound(_0x13f975,null))[_0x4c89('0x2a')](respondWithResult(_0x13f975,null))[_0x4c89('0x47')](handleError(_0x13f975,null));};exports[_0x4c89('0x4b')]=function(_0x15265e,_0x470e03){return db[_0x4c89('0x31')][_0x4c89('0x4b')](_0x15265e[_0x4c89('0x4c')],{})[_0x4c89('0x2a')](function(_0x5bb9f4){var _0xb11e65=_0x15265e[_0x4c89('0x4d')]['get']({'plain':!![]});if(!_0xb11e65)throw new Error(_0x4c89('0x4e'));if(_0xb11e65['role']==='user'){var _0xd6080=_0x5bb9f4[_0x4c89('0x4f')]({'plain':!![]});var _0x1e485f=_0x4c89('0x50');return db[_0x4c89('0x51')]['find']({'where':{'name':_0x1e485f,'userProfileId':_0xb11e65['userProfileId']},'raw':!![]})[_0x4c89('0x2a')](function(_0x2e1d02){if(_0x2e1d02&&_0x2e1d02[_0x4c89('0x52')]===0x0){return db[_0x4c89('0x53')][_0x4c89('0x4b')]({'name':_0xd6080[_0x4c89('0x2d')],'resourceId':_0xd6080['id'],'type':_0x2e1d02[_0x4c89('0x2d')],'sectionId':_0x2e1d02['id']},{})[_0x4c89('0x2a')](function(){return _0x5bb9f4;});}else{return _0x5bb9f4;}})[_0x4c89('0x47')](function(_0x2e46d3){logger[_0x4c89('0x2b')](_0x4c89('0x54'),_0x2e46d3);throw _0x2e46d3;});}return _0x5bb9f4;})[_0x4c89('0x2a')](respondWithResult(_0x470e03,0xc9))[_0x4c89('0x47')](handleError(_0x470e03,null));};exports[_0x4c89('0x28')]=function(_0x173bdb,_0x4b61b1){if(_0x173bdb[_0x4c89('0x4c')]['id']){delete _0x173bdb[_0x4c89('0x4c')]['id'];}return db[_0x4c89('0x31')][_0x4c89('0x4a')]({'where':{'id':_0x173bdb['params']['id']}})[_0x4c89('0x2a')](handleEntityNotFound(_0x4b61b1,null))['then'](saveUpdates(_0x173bdb[_0x4c89('0x4c')],null))[_0x4c89('0x2a')](respondWithResult(_0x4b61b1,null))[_0x4c89('0x47')](handleError(_0x4b61b1,null));};exports[_0x4c89('0x29')]=function(_0x5b54a9,_0x9f9f4a){return db[_0x4c89('0x31')][_0x4c89('0x4a')]({'where':{'id':_0x5b54a9[_0x4c89('0x55')]['id']}})[_0x4c89('0x2a')](handleEntityNotFound(_0x9f9f4a,null))[_0x4c89('0x2a')](removeEntity(_0x9f9f4a,null))['catch'](handleError(_0x9f9f4a,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 9e3426a..e44c7f3 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 _0x6743=['moment','bluebird','request-promise','path','rimraf','./variable.attributes','exports','define','Variable','tools_variables'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6743,0x190));var _0x3674=function(_0x9a3e0f,_0x2f796d){_0x9a3e0f=_0x9a3e0f-0x0;var _0x3d2a9a=_0x6743[_0x9a3e0f];return _0x3d2a9a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3674('0x0'));var BPromise=require(_0x3674('0x1'));var rp=require(_0x3674('0x2'));var fs=require('fs');var path=require(_0x3674('0x3'));var rimraf=require(_0x3674('0x4'));var config=require('../../config/environment');var attributes=require(_0x3674('0x5'));module[_0x3674('0x6')]=function(_0x29036c,_0x32e998){return _0x29036c[_0x3674('0x7')](_0x3674('0x8'),attributes,{'tableName':_0x3674('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc91b=['../../config/environment','exports','define','tools_variables','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc91b,0x1bc));var _0xbc91=function(_0x3ce17b,_0x429815){_0x3ce17b=_0x3ce17b-0x0;var _0x35392a=_0xc91b[_0x3ce17b];return _0x35392a;};'use strict';var _=require('lodash');var util=require(_0xbc91('0x0'));var logger=require(_0xbc91('0x1'))(_0xbc91('0x2'));var moment=require(_0xbc91('0x3'));var BPromise=require('bluebird');var rp=require(_0xbc91('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbc91('0x5'));var config=require(_0xbc91('0x6'));var attributes=require('./variable.attributes');module[_0xbc91('0x7')]=function(_0x43494c,_0x5a7e6b){return _0x43494c[_0xbc91('0x8')]('Variable',attributes,{'tableName':_0xbc91('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 8733ef2..ebb9799 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 _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x4866c6,_0x364034){var _0x333879=function(_0x41a140){while(--_0x41a140){_0x4866c6['push'](_0x4866c6['shift']());}};_0x333879(++_0x364034);}(_0xabce,0x103));var _0xeabc=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xabce[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file +var _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x5a3b7c,_0xdfbe40){var _0x724d23=function(_0xd6fb54){while(--_0xd6fb54){_0x5a3b7c['push'](_0x5a3b7c['shift']());}};_0x724d23(++_0xdfbe40);}(_0xabce,0x103));var _0xeabc=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xabce[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index c8f4013..7689830 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 _0x90a7=['migrations','exports','express','Router','../../components/auth/service','./version.controller','index','get','/fetch','isAuthenticated','/reset','canUpdate','/pull','pull','/restart','restart','/migrations'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x90a7,0x1cd));var _0x790a=function(_0x4bd2af,_0x36e3a7){_0x4bd2af=_0x4bd2af-0x0;var _0xb824a8=_0x90a7[_0x4bd2af];return _0xb824a8;};'use strict';var express=require(_0x790a('0x0'));var router=express[_0x790a('0x1')]();var auth=require(_0x790a('0x2'));var controller=require(_0x790a('0x3'));router['get']('/',controller[_0x790a('0x4')]);router[_0x790a('0x5')](_0x790a('0x6'),auth[_0x790a('0x7')](),auth['canUpdate'](),controller['fetch']);router[_0x790a('0x5')](_0x790a('0x8'),auth[_0x790a('0x7')](),auth[_0x790a('0x9')](),controller['reset']);router[_0x790a('0x5')](_0x790a('0xa'),auth[_0x790a('0x7')](),auth[_0x790a('0x9')](),controller[_0x790a('0xb')]);router['get'](_0x790a('0xc'),auth[_0x790a('0x7')](),controller[_0x790a('0xd')]);router[_0x790a('0x5')](_0x790a('0xe'),controller[_0x790a('0xf')]);module[_0x790a('0x10')]=router; \ No newline at end of file +var _0x490d=['isAuthenticated','fetch','/reset','reset','/pull','canUpdate','/restart','restart','/migrations','migrations','exports','Router','../../components/auth/service','get','index','/fetch'];(function(_0x33e4a7,_0x2e80a2){var _0x598620=function(_0x65d618){while(--_0x65d618){_0x33e4a7['push'](_0x33e4a7['shift']());}};_0x598620(++_0x2e80a2);}(_0x490d,0x17b));var _0xd490=function(_0x58fe99,_0x2772e7){_0x58fe99=_0x58fe99-0x0;var _0x24788a=_0x490d[_0x58fe99];return _0x24788a;};'use strict';var express=require('express');var router=express[_0xd490('0x0')]();var auth=require(_0xd490('0x1'));var controller=require('./version.controller');router[_0xd490('0x2')]('/',controller[_0xd490('0x3')]);router['get'](_0xd490('0x4'),auth[_0xd490('0x5')](),auth['canUpdate'](),controller[_0xd490('0x6')]);router[_0xd490('0x2')](_0xd490('0x7'),auth[_0xd490('0x5')](),auth['canUpdate'](),controller[_0xd490('0x8')]);router[_0xd490('0x2')](_0xd490('0x9'),auth[_0xd490('0x5')](),auth[_0xd490('0xa')](),controller['pull']);router['get'](_0xd490('0xb'),auth[_0xd490('0x5')](),controller[_0xd490('0xc')]);router[_0xd490('0x2')](_0xd490('0xd'),controller[_0xd490('0xe')]);module[_0xd490('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index aa18b9b..c99e450 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 _0x0acb=['pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','query','latest','fetch','tags','exports','2.0.0','status','json','master','git\x20fetch','reset','--hard','error','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then'];(function(_0x56306c,_0x32bb82){var _0x5d8aaf=function(_0xa2b22f){while(--_0xa2b22f){_0x56306c['push'](_0x56306c['shift']());}};_0x5d8aaf(++_0x32bb82);}(_0x0acb,0x83));var _0xb0ac=function(_0x2e939c,_0x3b1f7b){_0x2e939c=_0x2e939c-0x0;var _0x5f4710=_0x0acb[_0x2e939c];return _0x5f4710;};'use strict';var Umzug=require(_0xb0ac('0x0'));var path=require(_0xb0ac('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xb0ac('0x2'))(module,_0xb0ac('0x3'));var compareVersions=require(_0xb0ac('0x4'));var exec=require(_0xb0ac('0x5'))[_0xb0ac('0x6')];var db=require(_0xb0ac('0x7'))['db'];var config=require(_0xb0ac('0x8'));var pm2=require(_0xb0ac('0x9'));var logger=require(_0xb0ac('0xa'))(_0xb0ac('0xb'));var git=require(_0xb0ac('0xc'))(config['root']);exports['index']=function(_0xfdb835,_0xa67bad){var _0x2fa13d={'current':module['exports']['version'],'phonebar':0x2};if(_0xfdb835[_0xb0ac('0xd')]&&_0xfdb835[_0xb0ac('0xd')][_0xb0ac('0xe')]){return git[_0xb0ac('0xf')]()[_0xb0ac('0x10')](function(_0x534793,_0x24c0d9){_0x2fa13d[_0xb0ac('0xe')]=(_0x534793?module[_0xb0ac('0x11')]['version']:_0x24c0d9[_0xb0ac('0xe')])||_0xb0ac('0x12');return _0xa67bad[_0xb0ac('0x13')](0xc8)[_0xb0ac('0x14')](_0x2fa13d);});}else{return _0xa67bad[_0xb0ac('0x13')](0xc8)['json'](_0x2fa13d);}};exports['fetch']=function(_0x3dd409,_0xa120be){return git[_0xb0ac('0xf')](['origin',_0xb0ac('0x15')],function(_0x61822e){if(_0x61822e){logger['error'](_0x61822e);return _0xa120be[_0xb0ac('0x13')](0x1f4)[_0xb0ac('0x14')](_0x61822e);}logger['info'](_0xb0ac('0x16'));return _0xa120be[_0xb0ac('0x13')](0xc8)[_0xb0ac('0x14')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xb0ac('0x17')]=function(_0xf5a495,_0x218f75){return git[_0xb0ac('0x17')]([_0xb0ac('0x18'),'FETCH_HEAD'],function(_0x43a0ab){if(_0x43a0ab){logger[_0xb0ac('0x19')](_0x43a0ab);return _0x218f75[_0xb0ac('0x13')](0x1f4)[_0xb0ac('0x14')](_0x43a0ab);}logger[_0xb0ac('0x1a')](_0xb0ac('0x1b'));return _0x218f75[_0xb0ac('0x13')](0xc8)['json']({'output':_0xb0ac('0x1c')});});};exports[_0xb0ac('0x1d')]=function(_0x52bad3,_0x494d72){exec(_0xb0ac('0x1e'),function(_0x32bf7a,_0x41bf85,_0x4efb2c){logger[_0xb0ac('0x1a')](_0x41bf85);logger['info'](_0x4efb2c);if(_0x32bf7a){logger[_0xb0ac('0x19')](_0x32bf7a);return _0x494d72[_0xb0ac('0x13')](0x1f4)['json'](_0x32bf7a);}return _0x494d72[_0xb0ac('0x13')](0xc8)[_0xb0ac('0x14')]({'output':_0x41bf85});});};exports[_0xb0ac('0x1f')]=function(_0x40897a,_0x2f2189){return pm2[_0xb0ac('0x1f')](_0xb0ac('0x20'))[_0xb0ac('0x21')](function(_0x1d21e6){logger[_0xb0ac('0x1a')](_0xb0ac('0x22'),_0x1d21e6);return _0x2f2189[_0xb0ac('0x13')](0xc8)[_0xb0ac('0x14')]({'output':_0xb0ac('0x23')});})[_0xb0ac('0x24')](function(_0x2e25fc){logger[_0xb0ac('0x19')](_0x2e25fc);return _0x2f2189[_0xb0ac('0x13')](0x1f4)[_0xb0ac('0x14')](_0x2e25fc);});};exports[_0xb0ac('0x25')]=function(_0x533033,_0x368ae0){var _0x36a11d=fs[_0xb0ac('0x26')](path[_0xb0ac('0x27')](config[_0xb0ac('0x28')],_0xb0ac('0x29'),_0xb0ac('0x25')));var _0xb82e5a=[];for(var _0x12a157=0x0;_0x12a157<_0x36a11d[_0xb0ac('0x2a')];_0x12a157++){var _0x27f0d1=_0x36a11d[_0x12a157][_0xb0ac('0x2b')](_0xb0ac('0x2c'),'');if(compareVersions(module[_0xb0ac('0x11')]['version'],_0x27f0d1)===-0x1){_0xb82e5a['push'](_0x27f0d1);}}if(_0xb82e5a[_0xb0ac('0x2a')]){var _0x1a3f2e=_0xb82e5a[_0xb0ac('0x2d')](compareVersions);var _0x2e40b8=new Umzug({'storage':_0xb0ac('0x2e'),'storageOptions':{'model':db[_0xb0ac('0x2f')],'modelName':_0xb0ac('0x2f'),'columnName':_0xb0ac('0x3')},'migrations':{'params':[db[_0xb0ac('0x2e')][_0xb0ac('0x30')](),db[_0xb0ac('0x2e')][_0xb0ac('0x31')],function(){throw new Error(_0xb0ac('0x32'));}],'path':path[_0xb0ac('0x27')](config['root'],'server',_0xb0ac('0x25')),'pattern':/\.js$/}});_0x2e40b8['up']({'migrations':_['map'](_0x1a3f2e,function(_0x4fca6b){return _0x4fca6b+_0xb0ac('0x2c');})})['then'](function(){return _0x368ae0[_0xb0ac('0x13')](0xc8)[_0xb0ac('0x14')]({'output':_0xb0ac('0x33')+module[_0xb0ac('0x11')][_0xb0ac('0x3')]+'\x20to\x20'+_[_0xb0ac('0x34')](_0x1a3f2e),'migrations':_[_0xb0ac('0x27')](_0x1a3f2e)});})[_0xb0ac('0x24')](function(_0x207643){if(_0x207643 instanceof db[_0xb0ac('0x2e')][_0xb0ac('0x35')]){return _0x368ae0[_0xb0ac('0x13')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x368ae0[_0xb0ac('0x13')](0x1f4)[_0xb0ac('0x14')](_0x207643);}});}else{return _0x368ae0[_0xb0ac('0x13')](0xc8)['json']({'output':_0xb0ac('0x36')});}}; \ No newline at end of file +var _0xdc42=['sort','sequelize','Migration','getQueryInterface','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','root','index','exports','version','query','latest','fetch','tags','2.0.0','json','status','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','error','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','.js','push'];(function(_0x434f53,_0x41a9da){var _0x51c7b1=function(_0x2d7098){while(--_0x2d7098){_0x434f53['push'](_0x434f53['shift']());}};_0x51c7b1(++_0x41a9da);}(_0xdc42,0x193));var _0x2dc4=function(_0x3c9d74,_0x5419a3){_0x3c9d74=_0x3c9d74-0x0;var _0x9ef548=_0xdc42[_0x3c9d74];return _0x9ef548;};'use strict';var Umzug=require(_0x2dc4('0x0'));var path=require(_0x2dc4('0x1'));var fs=require('fs');var _=require(_0x2dc4('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x2dc4('0x3'));var exec=require(_0x2dc4('0x4'))[_0x2dc4('0x5')];var db=require(_0x2dc4('0x6'))['db'];var config=require(_0x2dc4('0x7'));var pm2=require('../../config/pm2');var logger=require(_0x2dc4('0x8'))(_0x2dc4('0x9'));var git=require('simple-git')(config[_0x2dc4('0xa')]);exports[_0x2dc4('0xb')]=function(_0x44749e,_0x4677fe){var _0x63d656={'current':module[_0x2dc4('0xc')][_0x2dc4('0xd')],'phonebar':0x2};if(_0x44749e[_0x2dc4('0xe')]&&_0x44749e[_0x2dc4('0xe')][_0x2dc4('0xf')]){return git[_0x2dc4('0x10')]()[_0x2dc4('0x11')](function(_0xe0a7a8,_0x1ef652){_0x63d656['latest']=(_0xe0a7a8?module[_0x2dc4('0xc')][_0x2dc4('0xd')]:_0x1ef652[_0x2dc4('0xf')])||_0x2dc4('0x12');return _0x4677fe['status'](0xc8)[_0x2dc4('0x13')](_0x63d656);});}else{return _0x4677fe[_0x2dc4('0x14')](0xc8)[_0x2dc4('0x13')](_0x63d656);}};exports['fetch']=function(_0x39765c,_0x51f48d){return git[_0x2dc4('0x10')]([_0x2dc4('0x15'),_0x2dc4('0x16')],function(_0x46ff27){if(_0x46ff27){logger['error'](_0x46ff27);return _0x51f48d[_0x2dc4('0x14')](0x1f4)[_0x2dc4('0x13')](_0x46ff27);}logger[_0x2dc4('0x17')](_0x2dc4('0x18'));return _0x51f48d[_0x2dc4('0x14')](0xc8)[_0x2dc4('0x13')]({'output':_0x2dc4('0x19')});});};exports[_0x2dc4('0x1a')]=function(_0x3c7620,_0x13ab90){return git[_0x2dc4('0x1a')](['--hard','FETCH_HEAD'],function(_0x5be267){if(_0x5be267){logger[_0x2dc4('0x1b')](_0x5be267);return _0x13ab90[_0x2dc4('0x14')](0x1f4)[_0x2dc4('0x13')](_0x5be267);}logger['info'](_0x2dc4('0x1c'));return _0x13ab90[_0x2dc4('0x14')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports[_0x2dc4('0x1d')]=function(_0x505269,_0x2084bd){exec(_0x2dc4('0x1e'),function(_0x2a8dc8,_0x171210,_0x3278c8){logger['info'](_0x171210);logger[_0x2dc4('0x17')](_0x3278c8);if(_0x2a8dc8){logger[_0x2dc4('0x1b')](_0x2a8dc8);return _0x2084bd[_0x2dc4('0x14')](0x1f4)['json'](_0x2a8dc8);}return _0x2084bd['status'](0xc8)[_0x2dc4('0x13')]({'output':_0x171210});});};exports[_0x2dc4('0x1f')]=function(_0x5d15b0,_0x4f2e45){return pm2[_0x2dc4('0x1f')](_0x2dc4('0x20'))[_0x2dc4('0x21')](function(_0x4cadfc){logger[_0x2dc4('0x17')](_0x2dc4('0x22'),_0x4cadfc);return _0x4f2e45[_0x2dc4('0x14')](0xc8)[_0x2dc4('0x13')]({'output':_0x2dc4('0x23')});})[_0x2dc4('0x24')](function(_0x22cd46){logger[_0x2dc4('0x1b')](_0x22cd46);return _0x4f2e45[_0x2dc4('0x14')](0x1f4)[_0x2dc4('0x13')](_0x22cd46);});};exports[_0x2dc4('0x25')]=function(_0x32bad2,_0xc8e53f){var _0x52326c=fs[_0x2dc4('0x26')](path[_0x2dc4('0x27')](config[_0x2dc4('0xa')],_0x2dc4('0x28'),_0x2dc4('0x25')));var _0x5bab58=[];for(var _0x1e50d4=0x0;_0x1e50d4<_0x52326c[_0x2dc4('0x29')];_0x1e50d4++){var _0x3b855e=_0x52326c[_0x1e50d4][_0x2dc4('0x2a')](_0x2dc4('0x2b'),'');if(compareVersions(module[_0x2dc4('0xc')][_0x2dc4('0xd')],_0x3b855e)===-0x1){_0x5bab58[_0x2dc4('0x2c')](_0x3b855e);}}if(_0x5bab58['length']){var _0x1b3099=_0x5bab58[_0x2dc4('0x2d')](compareVersions);var _0x4a65f2=new Umzug({'storage':_0x2dc4('0x2e'),'storageOptions':{'model':db[_0x2dc4('0x2f')],'modelName':_0x2dc4('0x2f'),'columnName':'version'},'migrations':{'params':[db[_0x2dc4('0x2e')][_0x2dc4('0x30')](),db[_0x2dc4('0x2e')][_0x2dc4('0x31')],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[_0x2dc4('0x27')](config['root'],_0x2dc4('0x28'),_0x2dc4('0x25')),'pattern':/\.js$/}});_0x4a65f2['up']({'migrations':_[_0x2dc4('0x32')](_0x1b3099,function(_0x378991){return _0x378991+_0x2dc4('0x2b');})})[_0x2dc4('0x21')](function(){return _0xc8e53f[_0x2dc4('0x14')](0xc8)['json']({'output':_0x2dc4('0x33')+module['exports'][_0x2dc4('0xd')]+_0x2dc4('0x34')+_[_0x2dc4('0x35')](_0x1b3099),'migrations':_[_0x2dc4('0x27')](_0x1b3099)});})[_0x2dc4('0x24')](function(_0x34a5a6){if(_0x34a5a6 instanceof db['sequelize'][_0x2dc4('0x36')]){return _0xc8e53f[_0x2dc4('0x14')](0xc8)['json']({'output':_0x2dc4('0x37')});}else{return _0xc8e53f['status'](0x1f4)[_0x2dc4('0x13')](_0x34a5a6);}});}else{return _0xc8e53f[_0x2dc4('0x14')](0xc8)[_0x2dc4('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 9dfe650..3a0dfee 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 _0x4fad=['delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0x4fad,0x10a));var _0xd4fa=function(_0x5db863,_0x18f3c9){_0x5db863=_0x5db863-0x0;var _0x184aab=_0x4fad[_0x5db863];return _0x184aab;};'use strict';var multer=require('multer');var util=require(_0xd4fa('0x0'));var path=require(_0xd4fa('0x1'));var timeout=require(_0xd4fa('0x2'));var express=require(_0xd4fa('0x3'));var router=express[_0xd4fa('0x4')]();var fs_extra=require(_0xd4fa('0x5'));var auth=require(_0xd4fa('0x6'));var interaction=require(_0xd4fa('0x7'));var config=require(_0xd4fa('0x8'));var controller=require(_0xd4fa('0x9'));router[_0xd4fa('0xa')]('/',auth[_0xd4fa('0xb')](),controller[_0xd4fa('0xc')]);router[_0xd4fa('0xa')](_0xd4fa('0xd'),auth[_0xd4fa('0xb')](),controller['describe']);router[_0xd4fa('0xa')](_0xd4fa('0xe'),auth['isAuthenticated'](),controller[_0xd4fa('0xf')]);router[_0xd4fa('0x10')]('/',auth[_0xd4fa('0xb')](),controller[_0xd4fa('0x11')]);router[_0xd4fa('0x12')]('/:id',auth[_0xd4fa('0xb')](),controller[_0xd4fa('0x13')]);router[_0xd4fa('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd4fa('0x15')]=router; \ No newline at end of file +var _0x33a8=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','describe','post','create','/:id','update','destroy','exports'];(function(_0x315f61,_0x3ec001){var _0x26c853=function(_0x3f1950){while(--_0x3f1950){_0x315f61['push'](_0x315f61['shift']());}};_0x26c853(++_0x3ec001);}(_0x33a8,0xea));var _0x833a=function(_0x1d3765,_0x1ce094){_0x1d3765=_0x1d3765-0x0;var _0x9763f8=_0x33a8[_0x1d3765];return _0x9763f8;};'use strict';var multer=require(_0x833a('0x0'));var util=require(_0x833a('0x1'));var path=require('path');var timeout=require(_0x833a('0x2'));var express=require(_0x833a('0x3'));var router=express[_0x833a('0x4')]();var fs_extra=require(_0x833a('0x5'));var auth=require(_0x833a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x833a('0x7'));var controller=require(_0x833a('0x8'));router[_0x833a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x833a('0x9')]('/describe',auth[_0x833a('0xa')](),controller[_0x833a('0xb')]);router['get']('/:id',auth[_0x833a('0xa')](),controller['show']);router[_0x833a('0xc')]('/',auth[_0x833a('0xa')](),controller[_0x833a('0xd')]);router['put'](_0x833a('0xe'),auth[_0x833a('0xa')](),controller[_0x833a('0xf')]);router['delete'](_0x833a('0xe'),auth['isAuthenticated'](),controller[_0x833a('0x10')]);module[_0x833a('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 9907fc6..113a5e1 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 _0xd523=['BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x173b20,_0x13f6e0){var _0x235ff2=function(_0x4f66db){while(--_0x4f66db){_0x173b20['push'](_0x173b20['shift']());}};_0x235ff2(++_0x13f6e0);}(_0xd523,0x153));var _0x3d52=function(_0x4bb169,_0x471f38){_0x4bb169=_0x4bb169-0x0;var _0x2df81e=_0xd523[_0x4bb169];return _0x2df81e;};'use strict';var Sequelize=require(_0x3d52('0x0'));module[_0x3d52('0x1')]={'type':{'type':Sequelize[_0x3d52('0x2')]},'uniqueid':{'type':Sequelize[_0x3d52('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3d52('0x2')]},'queue':{'type':Sequelize[_0x3d52('0x2')]},'interface':{'type':Sequelize[_0x3d52('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x3d52('0x3')]},'agentconnectAt':{'type':Sequelize[_0x3d52('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x3d52('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x3d52('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x3d52('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x3d52('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x3d52('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x3d52('0x5')]},'agentacw':{'type':Sequelize[_0x3d52('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3d52('0x5')]},'reason':{'type':Sequelize[_0x3d52('0x2')]},'lastevent':{'type':Sequelize[_0x3d52('0x2')]},'channel':{'type':Sequelize[_0x3d52('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x3d52('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3d52('0x2')]},'connectedlinename':{'type':Sequelize[_0x3d52('0x2')]},'language':{'type':Sequelize[_0x3d52('0x2')]},'accountcode':{'type':Sequelize[_0x3d52('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3d52('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x3d52('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x3d52('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x3d52('0x2')]},'destlanguage':{'type':Sequelize[_0x3d52('0x2')]},'destaccountcode':{'type':Sequelize[_0x3d52('0x2')]},'destcontext':{'type':Sequelize[_0x3d52('0x2')]},'destexten':{'type':Sequelize[_0x3d52('0x2')]},'destpriority':{'type':Sequelize[_0x3d52('0x2')]},'destuniqueid':{'type':Sequelize[_0x3d52('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x3d52('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x3d52('0x2')]},'transfer':{'type':Sequelize[_0x3d52('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3d52('0x2')],'comment':_0x3d52('0x6')},'transferexten':{'type':Sequelize[_0x3d52('0x2')]},'transferuniqueid':{'type':Sequelize[_0x3d52('0x2')]},'agententerreason':{'type':Sequelize[_0x3d52('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb9be=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x5e704b,_0x5edb54){var _0x20e55e=function(_0x318863){while(--_0x318863){_0x5e704b['push'](_0x5e704b['shift']());}};_0x20e55e(++_0x5edb54);}(_0xb9be,0xc5));var _0xeb9b=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0xb9be[_0x622035];return _0x326cf2;};'use strict';var Sequelize=require(_0xeb9b('0x0'));module[_0xeb9b('0x1')]={'type':{'type':Sequelize[_0xeb9b('0x2')]},'uniqueid':{'type':Sequelize[_0xeb9b('0x2')]},'calleridnum':{'type':Sequelize[_0xeb9b('0x2')]},'calleridname':{'type':Sequelize[_0xeb9b('0x2')]},'queue':{'type':Sequelize[_0xeb9b('0x2')]},'interface':{'type':Sequelize[_0xeb9b('0x2')]},'membername':{'type':Sequelize[_0xeb9b('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xeb9b('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xeb9b('0x3')]},'agentdumpAt':{'type':Sequelize[_0xeb9b('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xeb9b('0x5')]},'agentacw':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xeb9b('0x5')]},'reason':{'type':Sequelize[_0xeb9b('0x2')]},'lastevent':{'type':Sequelize[_0xeb9b('0x2')]},'channel':{'type':Sequelize[_0xeb9b('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xeb9b('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xeb9b('0x2')]},'accountcode':{'type':Sequelize[_0xeb9b('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xeb9b('0x2')]},'priority':{'type':Sequelize[_0xeb9b('0x2')]},'destchannel':{'type':Sequelize[_0xeb9b('0x2')]},'destchannelstate':{'type':Sequelize[_0xeb9b('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xeb9b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xeb9b('0x2')]},'destlanguage':{'type':Sequelize[_0xeb9b('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xeb9b('0x2')]},'destuniqueid':{'type':Sequelize[_0xeb9b('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xeb9b('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xeb9b('0x2')]},'transfer':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xeb9b('0x2')],'comment':_0xeb9b('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xeb9b('0x2')]},'agententerreason':{'type':Sequelize[_0xeb9b('0x5')],'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 f76e5a2..a2b765a 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 00e6457..d83a378 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 _0xa4dc=['moment','bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','destuniqueid','lodash','util'];(function(_0x15368f,_0x4a057d){var _0x4a55bf=function(_0x4470e7){while(--_0x4470e7){_0x15368f['push'](_0x15368f['shift']());}};_0x4a55bf(++_0x4a057d);}(_0xa4dc,0x16a));var _0xca4d=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xa4dc[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require(_0xca4d('0x0'));var util=require(_0xca4d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xca4d('0x2'));var BPromise=require(_0xca4d('0x3'));var rp=require(_0xca4d('0x4'));var fs=require('fs');var path=require(_0xca4d('0x5'));var rimraf=require(_0xca4d('0x6'));var config=require('../../config/environment');var attributes=require(_0xca4d('0x7'));module[_0xca4d('0x8')]=function(_0x1b60f4,_0x51470b){return _0x1b60f4[_0xca4d('0x9')]('VoiceAgentReport',attributes,{'tableName':_0xca4d('0xa'),'paranoid':![],'indexes':[{'fields':[_0xca4d('0xb'),_0xca4d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x44ae=['VoiceAgentReport','report_agent','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define'];(function(_0x4474fc,_0x243413){var _0x3a36bf=function(_0x450d22){while(--_0x450d22){_0x4474fc['push'](_0x4474fc['shift']());}};_0x3a36bf(++_0x243413);}(_0x44ae,0x17d));var _0xe44a=function(_0x420f45,_0x82ba43){_0x420f45=_0x420f45-0x0;var _0x115f02=_0x44ae[_0x420f45];return _0x115f02;};'use strict';var _=require(_0xe44a('0x0'));var util=require(_0xe44a('0x1'));var logger=require(_0xe44a('0x2'))(_0xe44a('0x3'));var moment=require('moment');var BPromise=require(_0xe44a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe44a('0x5'));var rimraf=require(_0xe44a('0x6'));var config=require(_0xe44a('0x7'));var attributes=require(_0xe44a('0x8'));module[_0xe44a('0x9')]=function(_0x3f9763,_0x5c1c49){return _0x3f9763[_0xe44a('0xa')](_0xe44a('0xb'),attributes,{'tableName':_0xe44a('0xc'),'paranoid':![],'indexes':[{'fields':[_0xe44a('0xd'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index ba85153..249db9a 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 _0x8ede=['CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','debug','UpdateVoiceAgentReport','update','body','where','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ede,0x169));var _0xe8ed=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ede[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe8ed('0x0'));var util=require(_0xe8ed('0x1'));var moment=require(_0xe8ed('0x2'));var BPromise=require('bluebird');var rs=require(_0xe8ed('0x3'));var fs=require('fs');var Redis=require(_0xe8ed('0x4'));var db=require(_0xe8ed('0x5'))['db'];var utils=require(_0xe8ed('0x6'));var logger=require(_0xe8ed('0x7'))(_0xe8ed('0x8'));var config=require(_0xe8ed('0x9'));var jayson=require(_0xe8ed('0xa'));var client=jayson[_0xe8ed('0xb')][_0xe8ed('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xdc853e,_0x135d01,_0x245eea){return new BPromise(function(_0x7d3dba,_0x2b0da7){return client[_0xe8ed('0xd')](_0xdc853e,_0x245eea)[_0xe8ed('0xe')](function(_0x128773){logger[_0xe8ed('0xf')](_0xe8ed('0x10'),_0x135d01,_0xe8ed('0x11'));logger['debug'](_0xe8ed('0x12'),_0x135d01,_0xe8ed('0x11'),JSON[_0xe8ed('0x13')](_0x128773));if(_0x128773[_0xe8ed('0x14')]){if(_0x128773['error']['code']===0x1f4){logger[_0xe8ed('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x135d01,_0x128773[_0xe8ed('0x14')][_0xe8ed('0x15')]);return _0x2b0da7(_0x128773[_0xe8ed('0x14')][_0xe8ed('0x15')]);}logger['error'](_0xe8ed('0x10'),_0x135d01,_0x128773[_0xe8ed('0x14')][_0xe8ed('0x15')]);return _0x7d3dba(_0x128773[_0xe8ed('0x14')][_0xe8ed('0x15')]);}else{logger['info'](_0xe8ed('0x10'),_0x135d01,_0xe8ed('0x11'));_0x7d3dba(_0x128773[_0xe8ed('0x16')]['message']);}})[_0xe8ed('0x17')](function(_0x71d1be){logger[_0xe8ed('0x14')](_0xe8ed('0x10'),_0x135d01,_0x71d1be);_0x2b0da7(_0x71d1be);});});}exports[_0xe8ed('0x18')]=function(_0x1179c8){var _0x47569f=this;return new Promise(function(_0xf27e4d,_0x12187d){return db[_0xe8ed('0x19')][_0xe8ed('0x1a')](_0x1179c8['body'],{'raw':_0x1179c8[_0xe8ed('0x1b')]?_0x1179c8[_0xe8ed('0x1b')][_0xe8ed('0x1c')]===undefined?!![]:![]:!![]})[_0xe8ed('0xe')](function(_0x25cff6){logger[_0xe8ed('0xf')]('CreateVoiceAgentReport',_0x1179c8);logger[_0xe8ed('0x1d')](_0xe8ed('0x18'),_0x1179c8,JSON[_0xe8ed('0x13')](_0x25cff6));_0xf27e4d(_0x25cff6);})[_0xe8ed('0x17')](function(_0x13185f){logger[_0xe8ed('0x14')]('CreateVoiceAgentReport',_0x13185f[_0xe8ed('0x15')],_0x1179c8);_0x12187d(_0x47569f[_0xe8ed('0x14')](0x1f4,_0x13185f['message']));});});};exports[_0xe8ed('0x1e')]=function(_0x57e4f5){var _0x3b2f27=this;return new Promise(function(_0x2322de,_0xca5675){return db[_0xe8ed('0x19')][_0xe8ed('0x1f')](_0x57e4f5[_0xe8ed('0x20')],{'raw':_0x57e4f5[_0xe8ed('0x1b')]?_0x57e4f5[_0xe8ed('0x1b')][_0xe8ed('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57e4f5[_0xe8ed('0x1b')]?_0x57e4f5[_0xe8ed('0x1b')][_0xe8ed('0x21')]||null:null,'attributes':_0x57e4f5['options']?_0x57e4f5[_0xe8ed('0x1b')]['attributes']||null:null,'limit':_0x57e4f5[_0xe8ed('0x1b')]?_0x57e4f5[_0xe8ed('0x1b')][_0xe8ed('0x22')]||null:null})[_0xe8ed('0xe')](function(_0xdcd386){logger[_0xe8ed('0xf')](_0xe8ed('0x1e'),_0x57e4f5);logger['debug']('UpdateVoiceAgentReport',_0x57e4f5,JSON['stringify'](_0xdcd386));_0x2322de(_0xdcd386);})['catch'](function(_0x21a474){logger[_0xe8ed('0x14')](_0xe8ed('0x1e'),_0x21a474[_0xe8ed('0x15')],_0x57e4f5);_0xca5675(_0x3b2f27[_0xe8ed('0x14')](0x1f4,_0x21a474[_0xe8ed('0x15')]));});});}; \ No newline at end of file +var _0x73c1=['options','debug','UpdateVoiceAgentReport','update','raw','attributes','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateVoiceAgentReport','create','body'];(function(_0x8bfa8d,_0xb1b086){var _0x27081b=function(_0x374c18){while(--_0x374c18){_0x8bfa8d['push'](_0x8bfa8d['shift']());}};_0x27081b(++_0xb1b086);}(_0x73c1,0x166));var _0x173c=function(_0x229acb,_0x3bd579){_0x229acb=_0x229acb-0x0;var _0xeef7f7=_0x73c1[_0x229acb];return _0xeef7f7;};'use strict';var _=require(_0x173c('0x0'));var util=require(_0x173c('0x1'));var moment=require('moment');var BPromise=require(_0x173c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x173c('0x3'))['db'];var utils=require(_0x173c('0x4'));var logger=require(_0x173c('0x5'))(_0x173c('0x6'));var config=require(_0x173c('0x7'));var jayson=require(_0x173c('0x8'));var client=jayson[_0x173c('0x9')][_0x173c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a0d8a,_0x38f6bc,_0x3fdc7a){return new BPromise(function(_0x36256f,_0x4745ef){return client[_0x173c('0xb')](_0x4a0d8a,_0x3fdc7a)[_0x173c('0xc')](function(_0x4d1c53){logger[_0x173c('0xd')](_0x173c('0xe'),_0x38f6bc,'request\x20sent');logger['debug'](_0x173c('0xf'),_0x38f6bc,'request\x20sent',JSON[_0x173c('0x10')](_0x4d1c53));if(_0x4d1c53[_0x173c('0x11')]){if(_0x4d1c53['error'][_0x173c('0x12')]===0x1f4){logger[_0x173c('0x11')](_0x173c('0xe'),_0x38f6bc,_0x4d1c53[_0x173c('0x11')][_0x173c('0x13')]);return _0x4745ef(_0x4d1c53[_0x173c('0x11')]['message']);}logger[_0x173c('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x38f6bc,_0x4d1c53[_0x173c('0x11')][_0x173c('0x13')]);return _0x36256f(_0x4d1c53[_0x173c('0x11')][_0x173c('0x13')]);}else{logger['info'](_0x173c('0xe'),_0x38f6bc,_0x173c('0x14'));_0x36256f(_0x4d1c53[_0x173c('0x15')][_0x173c('0x13')]);}})[_0x173c('0x16')](function(_0x4642f8){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x38f6bc,_0x4642f8);_0x4745ef(_0x4642f8);});});}exports[_0x173c('0x17')]=function(_0x29b669){var _0x119948=this;return new Promise(function(_0x3242f9,_0x4783b8){return db['VoiceAgentReport'][_0x173c('0x18')](_0x29b669[_0x173c('0x19')],{'raw':_0x29b669[_0x173c('0x1a')]?_0x29b669[_0x173c('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x173c('0xc')](function(_0x1f7911){logger[_0x173c('0xd')](_0x173c('0x17'),_0x29b669);logger[_0x173c('0x1b')]('CreateVoiceAgentReport',_0x29b669,JSON[_0x173c('0x10')](_0x1f7911));_0x3242f9(_0x1f7911);})[_0x173c('0x16')](function(_0x28a278){logger['error'](_0x173c('0x17'),_0x28a278[_0x173c('0x13')],_0x29b669);_0x4783b8(_0x119948[_0x173c('0x11')](0x1f4,_0x28a278['message']));});});};exports[_0x173c('0x1c')]=function(_0x5f278d){var _0x24a746=this;return new Promise(function(_0x1d2f65,_0x4a10ab){return db['VoiceAgentReport'][_0x173c('0x1d')](_0x5f278d[_0x173c('0x19')],{'raw':_0x5f278d[_0x173c('0x1a')]?_0x5f278d[_0x173c('0x1a')][_0x173c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f278d[_0x173c('0x1a')]?_0x5f278d[_0x173c('0x1a')]['where']||null:null,'attributes':_0x5f278d[_0x173c('0x1a')]?_0x5f278d['options'][_0x173c('0x1f')]||null:null,'limit':_0x5f278d[_0x173c('0x1a')]?_0x5f278d[_0x173c('0x1a')]['limit']||null:null})[_0x173c('0xc')](function(_0x132e20){logger[_0x173c('0xd')](_0x173c('0x1c'),_0x5f278d);logger[_0x173c('0x1b')](_0x173c('0x1c'),_0x5f278d,JSON[_0x173c('0x10')](_0x132e20));_0x1d2f65(_0x132e20);})[_0x173c('0x16')](function(_0x2e84f4){logger['error'](_0x173c('0x1c'),_0x2e84f4[_0x173c('0x13')],_0x5f278d);_0x4a10ab(_0x24a746[_0x173c('0x11')](0x1f4,_0x2e84f4['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 0260399..6e7f677 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 _0x84ab=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','/describe','describe','isAuthenticated','post','create','update','delete','/:id','destroy','multer'];(function(_0x11c032,_0x4ca503){var _0x55919f=function(_0x97e42c){while(--_0x97e42c){_0x11c032['push'](_0x11c032['shift']());}};_0x55919f(++_0x4ca503);}(_0x84ab,0x12f));var _0xb84a=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x84ab[_0x1477ef];return _0x164acd;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var fs_extra=require(_0xb84a('0x5'));var auth=require(_0xb84a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb84a('0x7'));var controller=require(_0xb84a('0x8'));router[_0xb84a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router[_0xb84a('0x9')]('/:id',auth[_0xb84a('0xc')](),controller['show']);router[_0xb84a('0xd')]('/',auth[_0xb84a('0xc')](),controller[_0xb84a('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb84a('0xf')]);router[_0xb84a('0x10')](_0xb84a('0x11'),auth[_0xb84a('0xc')](),controller[_0xb84a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x24ca=['create','update','delete','destroy','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','/describe','isAuthenticated','describe','/:id','post'];(function(_0x24065b,_0x1775ba){var _0x88b0b7=function(_0x1143fc){while(--_0x1143fc){_0x24065b['push'](_0x24065b['shift']());}};_0x88b0b7(++_0x1775ba);}(_0x24ca,0x8c));var _0xa24c=function(_0xb7b878,_0x5c3b92){_0xb7b878=_0xb7b878-0x0;var _0x3c84b9=_0x24ca[_0xb7b878];return _0x3c84b9;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa24c('0x1'));var express=require('express');var router=express[_0xa24c('0x2')]();var fs_extra=require(_0xa24c('0x3'));var auth=require(_0xa24c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa24c('0x5'));var controller=require(_0xa24c('0x6'));router[_0xa24c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa24c('0x8'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xa')]);router[_0xa24c('0x7')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller['show']);router[_0xa24c('0xc')]('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xd')]);router['put']('/:id',auth[_0xa24c('0x9')](),controller[_0xa24c('0xe')]);router[_0xa24c('0xf')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 7d82c68..a0c4163 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 _0x5a28=['outbound','inbound-fax','outbound-fax','dialer','DATE','sequelize','exports','STRING','ENUM','inbound'];(function(_0x46400a,_0x134088){var _0x3ef23f=function(_0x6ff3d2){while(--_0x6ff3d2){_0x46400a['push'](_0x46400a['shift']());}};_0x3ef23f(++_0x134088);}(_0x5a28,0x1c7));var _0x85a2=function(_0x105c50,_0x29ba3e){_0x105c50=_0x105c50-0x0;var _0x570327=_0x5a28[_0x105c50];return _0x570327;};'use strict';var Sequelize=require(_0x85a2('0x0'));module[_0x85a2('0x1')]={'uniqueid':{'type':Sequelize[_0x85a2('0x2')]},'type':{'type':Sequelize[_0x85a2('0x3')](_0x85a2('0x4'),'internal',_0x85a2('0x5'),_0x85a2('0x6'),_0x85a2('0x7'),_0x85a2('0x8'))},'tag':{'type':Sequelize[_0x85a2('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x85a2('0x2')]},'destination':{'type':Sequelize[_0x85a2('0x2')]},'destinationcontext':{'type':Sequelize[_0x85a2('0x2')]},'callerid':{'type':Sequelize[_0x85a2('0x2')]},'channel':{'type':Sequelize[_0x85a2('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x85a2('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x85a2('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x85a2('0x9')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x85a2('0x2')]},'amaflags':{'type':Sequelize[_0x85a2('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x85a2('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x85a2('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x85a2('0x2')]},'note':{'type':Sequelize[_0x85a2('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x85a2('0x2')]}}; \ No newline at end of file +var _0xd01d=['inbound','internal','outbound','inbound-fax','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','exports','ENUM'];(function(_0xc68650,_0x258343){var _0x57bd40=function(_0x8d9e8c){while(--_0x8d9e8c){_0xc68650['push'](_0xc68650['shift']());}};_0x57bd40(++_0x258343);}(_0xd01d,0xbe));var _0xdd01=function(_0x5a338f,_0xe8d08e){_0x5a338f=_0x5a338f-0x0;var _0x5daad7=_0xd01d[_0x5a338f];return _0x5daad7;};'use strict';var Sequelize=require('sequelize');module[_0xdd01('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xdd01('0x1')](_0xdd01('0x2'),_0xdd01('0x3'),_0xdd01('0x4'),_0xdd01('0x5'),_0xdd01('0x6'),_0xdd01('0x7'))},'tag':{'type':Sequelize[_0xdd01('0x8')]},'accountcode':{'type':Sequelize[_0xdd01('0x8')]},'source':{'type':Sequelize[_0xdd01('0x8')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xdd01('0x8')]},'channel':{'type':Sequelize[_0xdd01('0x8')]},'destinationchannel':{'type':Sequelize[_0xdd01('0x8')]},'lastapplication':{'type':Sequelize[_0xdd01('0x8')]},'lastdata':{'type':Sequelize[_0xdd01('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xdd01('0xa')]},'answertime':{'type':Sequelize[_0xdd01('0xa')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xdd01('0xb')]},'mohtime':{'type':Sequelize[_0xdd01('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdd01('0x8')]},'amaflags':{'type':Sequelize[_0xdd01('0x8')]},'userfield':{'type':Sequelize[_0xdd01('0x8')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xdd01('0x8')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xdd01('0x8')]},'routeid':{'type':Sequelize[_0xdd01('0xb')]},'sipcallid':{'type':Sequelize[_0xdd01('0x8')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index b70256b..8c5f83d 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x2ef3,0xba));var _0x32ef=function(_0x5b2f96,_0x228a64){_0x5b2f96=_0x5b2f96-0x0;var _0x2c87f0=_0x2ef3[_0x5b2f96];return _0x2c87f0;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0x5f2f,0x73));var _0xf5f2=function(_0x28fb5c,_0x1e7097){_0x28fb5c=_0x28fb5c-0x0;var _0x221b69=_0x5f2f[_0x28fb5c];return _0x221b69;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index b943ab4..8f4a308 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 _0x78db=['request-promise','rimraf','../../config/environment','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2a276d,_0x482b0c){var _0x2914cd=function(_0x452b8b){while(--_0x452b8b){_0x2a276d['push'](_0x2a276d['shift']());}};_0x2914cd(++_0x482b0c);}(_0x78db,0xcc));var _0xb78d=function(_0x1bab70,_0x399ccf){_0x1bab70=_0x1bab70-0x0;var _0x44a639=_0x78db[_0x1bab70];return _0x44a639;};'use strict';var _=require(_0xb78d('0x0'));var util=require(_0xb78d('0x1'));var logger=require(_0xb78d('0x2'))(_0xb78d('0x3'));var moment=require(_0xb78d('0x4'));var BPromise=require(_0xb78d('0x5'));var rp=require(_0xb78d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb78d('0x7'));var config=require(_0xb78d('0x8'));var attributes=require('./voiceCallReport.attributes');module[_0xb78d('0x9')]=function(_0x5d7dfe,_0x129afc){return _0x5d7dfe[_0xb78d('0xa')](_0xb78d('0xb'),attributes,{'tableName':_0xb78d('0xc'),'paranoid':![],'indexes':[{'fields':[_0xb78d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x797a=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x141dd8,_0x48363d){var _0x348080=function(_0x3beb35){while(--_0x3beb35){_0x141dd8['push'](_0x141dd8['shift']());}};_0x348080(++_0x48363d);}(_0x797a,0x18d));var _0xa797=function(_0x47d9d9,_0x4dfe52){_0x47d9d9=_0x47d9d9-0x0;var _0x2be962=_0x797a[_0x47d9d9];return _0x2be962;};'use strict';var _=require(_0xa797('0x0'));var util=require(_0xa797('0x1'));var logger=require(_0xa797('0x2'))('api');var moment=require(_0xa797('0x3'));var BPromise=require(_0xa797('0x4'));var rp=require(_0xa797('0x5'));var fs=require('fs');var path=require(_0xa797('0x6'));var rimraf=require(_0xa797('0x7'));var config=require(_0xa797('0x8'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x162669,_0x37d84a){return _0x162669[_0xa797('0x9')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xa797('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index c5fe8cc..d5672cc 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 _0x6b56=['lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','VoiceCallReport,\x20%s,\x20%s','message','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','limit','map','include','model','attributes','CreateVoiceCallReport','create','debug','stringify','UpdateVoiceCallReport','update','body'];(function(_0x34a765,_0x165925){var _0x1d3bd9=function(_0x2e0f87){while(--_0x2e0f87){_0x34a765['push'](_0x34a765['shift']());}};_0x1d3bd9(++_0x165925);}(_0x6b56,0xb9));var _0x66b5=function(_0x5bfea1,_0x494abb){_0x5bfea1=_0x5bfea1-0x0;var _0x42d2fa=_0x6b56[_0x5bfea1];return _0x42d2fa;};'use strict';var _=require(_0x66b5('0x0'));var util=require(_0x66b5('0x1'));var moment=require(_0x66b5('0x2'));var BPromise=require(_0x66b5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66b5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x66b5('0x5'))(_0x66b5('0x6'));var config=require('../../config/environment');var jayson=require(_0x66b5('0x7'));var client=jayson[_0x66b5('0x8')][_0x66b5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x261124,_0x220396,_0x175ccf){return new BPromise(function(_0x185672,_0x2bfe30){return client[_0x66b5('0xa')](_0x261124,_0x175ccf)[_0x66b5('0xb')](function(_0x46421a){logger[_0x66b5('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x220396,_0x66b5('0xd'));logger['debug'](_0x66b5('0xe'),_0x220396,_0x66b5('0xd'),JSON['stringify'](_0x46421a));if(_0x46421a['error']){if(_0x46421a[_0x66b5('0xf')][_0x66b5('0x10')]===0x1f4){logger[_0x66b5('0xf')](_0x66b5('0x11'),_0x220396,_0x46421a[_0x66b5('0xf')][_0x66b5('0x12')]);return _0x2bfe30(_0x46421a['error'][_0x66b5('0x12')]);}logger[_0x66b5('0xf')](_0x66b5('0x11'),_0x220396,_0x46421a[_0x66b5('0xf')][_0x66b5('0x12')]);return _0x185672(_0x46421a[_0x66b5('0xf')][_0x66b5('0x12')]);}else{logger[_0x66b5('0xc')](_0x66b5('0x11'),_0x220396,'request\x20sent');_0x185672(_0x46421a['result'][_0x66b5('0x12')]);}})[_0x66b5('0x13')](function(_0x3bda10){logger[_0x66b5('0xf')](_0x66b5('0x11'),_0x220396,_0x3bda10);_0x2bfe30(_0x3bda10);});});}exports[_0x66b5('0x14')]=function(_0x1f6295){var _0x52c025=this;return new Promise(function(_0x291083,_0x5d6b7a){return db[_0x66b5('0x15')]['findAll']({'raw':_0x1f6295[_0x66b5('0x16')]?_0x1f6295[_0x66b5('0x16')][_0x66b5('0x17')]===undefined?!![]:![]:!![],'where':_0x1f6295[_0x66b5('0x16')]?_0x1f6295[_0x66b5('0x16')][_0x66b5('0x18')]||null:null,'attributes':_0x1f6295[_0x66b5('0x16')]?_0x1f6295['options']['attributes']||null:null,'limit':_0x1f6295['options']?_0x1f6295[_0x66b5('0x16')][_0x66b5('0x19')]||null:null,'include':_0x1f6295[_0x66b5('0x16')]?_0x1f6295['options']['include']?_[_0x66b5('0x1a')](_0x1f6295[_0x66b5('0x16')][_0x66b5('0x1b')],function(_0x59778e){return{'model':db[_0x59778e[_0x66b5('0x1c')]],'as':_0x59778e['as'],'attributes':_0x59778e['attributes'],'include':_0x59778e[_0x66b5('0x1b')]?_[_0x66b5('0x1a')](_0x59778e[_0x66b5('0x1b')],function(_0x4693c8){return{'model':db[_0x4693c8[_0x66b5('0x1c')]],'as':_0x4693c8['as'],'attributes':_0x4693c8[_0x66b5('0x1d')],'include':_0x4693c8[_0x66b5('0x1b')]?_[_0x66b5('0x1a')](_0x4693c8[_0x66b5('0x1b')],function(_0x19fc70){return{'model':db[_0x19fc70[_0x66b5('0x1c')]],'as':_0x19fc70['as'],'attributes':_0x19fc70[_0x66b5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x66b5('0xb')](function(_0x899dd5){logger[_0x66b5('0xc')]('GetVoiceCallReport',_0x1f6295);logger['debug'](_0x66b5('0x14'),_0x1f6295,JSON['stringify'](_0x899dd5));_0x291083(_0x899dd5);})[_0x66b5('0x13')](function(_0x4ba515){logger[_0x66b5('0xf')](_0x66b5('0x14'),_0x4ba515[_0x66b5('0x12')],_0x1f6295);_0x5d6b7a(_0x52c025[_0x66b5('0xf')](0x1f4,_0x4ba515[_0x66b5('0x12')]));});});};exports[_0x66b5('0x1e')]=function(_0x5c3c3e){var _0x63c84b=this;return new Promise(function(_0x2ddff6,_0x3b237b){return db[_0x66b5('0x15')][_0x66b5('0x1f')](_0x5c3c3e['body'],{'raw':_0x5c3c3e[_0x66b5('0x16')]?_0x5c3c3e[_0x66b5('0x16')][_0x66b5('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x196742){logger[_0x66b5('0xc')](_0x66b5('0x1e'),_0x5c3c3e);logger[_0x66b5('0x20')](_0x66b5('0x1e'),_0x5c3c3e,JSON[_0x66b5('0x21')](_0x196742));_0x2ddff6(_0x196742);})['catch'](function(_0x58f668){logger[_0x66b5('0xf')](_0x66b5('0x1e'),_0x58f668[_0x66b5('0x12')],_0x5c3c3e);_0x3b237b(_0x63c84b['error'](0x1f4,_0x58f668['message']));});});};exports[_0x66b5('0x22')]=function(_0x315f50){var _0x229609=this;return new Promise(function(_0x3a2942,_0x1b4763){return db[_0x66b5('0x15')][_0x66b5('0x23')](_0x315f50[_0x66b5('0x24')],{'raw':_0x315f50[_0x66b5('0x16')]?_0x315f50[_0x66b5('0x16')][_0x66b5('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x315f50[_0x66b5('0x16')]?_0x315f50[_0x66b5('0x16')][_0x66b5('0x18')]||null:null,'attributes':_0x315f50['options']?_0x315f50[_0x66b5('0x16')][_0x66b5('0x1d')]||null:null,'limit':_0x315f50[_0x66b5('0x16')]?_0x315f50[_0x66b5('0x16')][_0x66b5('0x19')]||null:null})[_0x66b5('0xb')](function(_0x5ea49b){logger[_0x66b5('0xc')](_0x66b5('0x22'),_0x315f50);logger[_0x66b5('0x20')](_0x66b5('0x22'),_0x315f50,JSON[_0x66b5('0x21')](_0x5ea49b));_0x3a2942(_0x5ea49b);})[_0x66b5('0x13')](function(_0xf227a1){logger[_0x66b5('0xf')](_0x66b5('0x22'),_0xf227a1['message'],_0x315f50);_0x1b4763(_0x229609[_0x66b5('0xf')](0x1f4,_0xf227a1[_0x66b5('0x12')]));});});}; \ No newline at end of file +var _0xbf1d=['UpdateVoiceCallReport','body','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','catch','VoiceCallReport','findAll','options','raw','include','map','model','attributes','GetVoiceCallReport','CreateVoiceCallReport'];(function(_0x54db36,_0x273d4a){var _0x6cda93=function(_0x57a6de){while(--_0x57a6de){_0x54db36['push'](_0x54db36['shift']());}};_0x6cda93(++_0x273d4a);}(_0xbf1d,0x1a5));var _0xdbf1=function(_0x28fae6,_0x129cab){_0x28fae6=_0x28fae6-0x0;var _0x27d561=_0xbf1d[_0x28fae6];return _0x27d561;};'use strict';var _=require(_0xdbf1('0x0'));var util=require(_0xdbf1('0x1'));var moment=require(_0xdbf1('0x2'));var BPromise=require(_0xdbf1('0x3'));var rs=require(_0xdbf1('0x4'));var fs=require('fs');var Redis=require(_0xdbf1('0x5'));var db=require(_0xdbf1('0x6'))['db'];var utils=require(_0xdbf1('0x7'));var logger=require(_0xdbf1('0x8'))('rpc');var config=require(_0xdbf1('0x9'));var jayson=require(_0xdbf1('0xa'));var client=jayson[_0xdbf1('0xb')][_0xdbf1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2be2e5,_0x230d68,_0x5e6bb0){return new BPromise(function(_0x1412f9,_0x5ad271){return client[_0xdbf1('0xd')](_0x2be2e5,_0x5e6bb0)[_0xdbf1('0xe')](function(_0x314506){logger[_0xdbf1('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x230d68,_0xdbf1('0x10'));logger[_0xdbf1('0x11')](_0xdbf1('0x12'),_0x230d68,_0xdbf1('0x10'),JSON[_0xdbf1('0x13')](_0x314506));if(_0x314506[_0xdbf1('0x14')]){if(_0x314506['error'][_0xdbf1('0x15')]===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x230d68,_0x314506[_0xdbf1('0x14')]['message']);return _0x5ad271(_0x314506[_0xdbf1('0x14')]['message']);}logger['error'](_0xdbf1('0x16'),_0x230d68,_0x314506['error'][_0xdbf1('0x17')]);return _0x1412f9(_0x314506['error'][_0xdbf1('0x17')]);}else{logger[_0xdbf1('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x230d68,_0xdbf1('0x10'));_0x1412f9(_0x314506['result'][_0xdbf1('0x17')]);}})[_0xdbf1('0x18')](function(_0x3c1133){logger[_0xdbf1('0x14')](_0xdbf1('0x16'),_0x230d68,_0x3c1133);_0x5ad271(_0x3c1133);});});}exports['GetVoiceCallReport']=function(_0xfc9e6c){var _0x168244=this;return new Promise(function(_0x1a7618,_0x557ca1){return db[_0xdbf1('0x19')][_0xdbf1('0x1a')]({'raw':_0xfc9e6c[_0xdbf1('0x1b')]?_0xfc9e6c[_0xdbf1('0x1b')][_0xdbf1('0x1c')]===undefined?!![]:![]:!![],'where':_0xfc9e6c[_0xdbf1('0x1b')]?_0xfc9e6c[_0xdbf1('0x1b')]['where']||null:null,'attributes':_0xfc9e6c[_0xdbf1('0x1b')]?_0xfc9e6c['options']['attributes']||null:null,'limit':_0xfc9e6c[_0xdbf1('0x1b')]?_0xfc9e6c[_0xdbf1('0x1b')]['limit']||null:null,'include':_0xfc9e6c[_0xdbf1('0x1b')]?_0xfc9e6c[_0xdbf1('0x1b')][_0xdbf1('0x1d')]?_[_0xdbf1('0x1e')](_0xfc9e6c['options'][_0xdbf1('0x1d')],function(_0x359a3e){return{'model':db[_0x359a3e[_0xdbf1('0x1f')]],'as':_0x359a3e['as'],'attributes':_0x359a3e['attributes'],'include':_0x359a3e[_0xdbf1('0x1d')]?_[_0xdbf1('0x1e')](_0x359a3e[_0xdbf1('0x1d')],function(_0x450325){return{'model':db[_0x450325['model']],'as':_0x450325['as'],'attributes':_0x450325[_0xdbf1('0x20')],'include':_0x450325[_0xdbf1('0x1d')]?_[_0xdbf1('0x1e')](_0x450325[_0xdbf1('0x1d')],function(_0x418c60){return{'model':db[_0x418c60[_0xdbf1('0x1f')]],'as':_0x418c60['as'],'attributes':_0x418c60[_0xdbf1('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdbf1('0xe')](function(_0x25cf49){logger['info'](_0xdbf1('0x21'),_0xfc9e6c);logger['debug']('GetVoiceCallReport',_0xfc9e6c,JSON['stringify'](_0x25cf49));_0x1a7618(_0x25cf49);})[_0xdbf1('0x18')](function(_0x50b8a5){logger['error'](_0xdbf1('0x21'),_0x50b8a5[_0xdbf1('0x17')],_0xfc9e6c);_0x557ca1(_0x168244[_0xdbf1('0x14')](0x1f4,_0x50b8a5[_0xdbf1('0x17')]));});});};exports[_0xdbf1('0x22')]=function(_0x351bb8){var _0x61ed26=this;return new Promise(function(_0x1f3d3d,_0xdd0f75){return db[_0xdbf1('0x19')]['create'](_0x351bb8['body'],{'raw':_0x351bb8[_0xdbf1('0x1b')]?_0x351bb8[_0xdbf1('0x1b')][_0xdbf1('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x25aead){logger[_0xdbf1('0xf')](_0xdbf1('0x22'),_0x351bb8);logger[_0xdbf1('0x11')](_0xdbf1('0x22'),_0x351bb8,JSON[_0xdbf1('0x13')](_0x25aead));_0x1f3d3d(_0x25aead);})[_0xdbf1('0x18')](function(_0x415b77){logger[_0xdbf1('0x14')](_0xdbf1('0x22'),_0x415b77[_0xdbf1('0x17')],_0x351bb8);_0xdd0f75(_0x61ed26[_0xdbf1('0x14')](0x1f4,_0x415b77['message']));});});};exports[_0xdbf1('0x23')]=function(_0x485c70){var _0x407a38=this;return new Promise(function(_0x4f340a,_0x40b471){return db[_0xdbf1('0x19')]['update'](_0x485c70[_0xdbf1('0x24')],{'raw':_0x485c70['options']?_0x485c70['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x485c70[_0xdbf1('0x1b')]?_0x485c70[_0xdbf1('0x1b')]['where']||null:null,'attributes':_0x485c70[_0xdbf1('0x1b')]?_0x485c70[_0xdbf1('0x1b')][_0xdbf1('0x20')]||null:null,'limit':_0x485c70[_0xdbf1('0x1b')]?_0x485c70[_0xdbf1('0x1b')][_0xdbf1('0x25')]||null:null})[_0xdbf1('0xe')](function(_0x3d3424){logger[_0xdbf1('0xf')](_0xdbf1('0x23'),_0x485c70);logger[_0xdbf1('0x11')](_0xdbf1('0x23'),_0x485c70,JSON['stringify'](_0x3d3424));_0x4f340a(_0x3d3424);})[_0xdbf1('0x18')](function(_0x12a8b4){logger[_0xdbf1('0x14')](_0xdbf1('0x23'),_0x12a8b4['message'],_0x485c70);_0x40b471(_0x407a38[_0xdbf1('0x14')](0x1f4,_0x12a8b4['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index db82ac6..d1ce77c 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 _0xb1a3=['util','path','connect-timeout','express','fs-extra','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer'];(function(_0x743d90,_0x13d1ce){var _0x4e15df=function(_0x391e43){while(--_0x391e43){_0x743d90['push'](_0x743d90['shift']());}};_0x4e15df(++_0x13d1ce);}(_0xb1a3,0x167));var _0x3b1a=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xb1a3[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x3b1a('0x0'));var util=require(_0x3b1a('0x1'));var path=require(_0x3b1a('0x2'));var timeout=require(_0x3b1a('0x3'));var express=require(_0x3b1a('0x4'));var router=express['Router']();var fs_extra=require(_0x3b1a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3b1a('0x6'));var controller=require(_0x3b1a('0x7'));router[_0x3b1a('0x8')]('/',auth[_0x3b1a('0x9')](),controller[_0x3b1a('0xa')]);router[_0x3b1a('0x8')](_0x3b1a('0xb'),auth[_0x3b1a('0x9')](),controller[_0x3b1a('0xc')]);router[_0x3b1a('0xd')]('/',auth[_0x3b1a('0x9')](),controller[_0x3b1a('0xe')]);router[_0x3b1a('0xf')]('/:id',auth[_0x3b1a('0x9')](),controller[_0x3b1a('0x10')]);router['delete'](_0x3b1a('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x3b1a('0x11')]=router; \ No newline at end of file +var _0x55ef=['path','connect-timeout','express','fs-extra','../../components/interaction/service','./voiceChanSpy.controller','isAuthenticated','index','get','show','post','create','put','delete','/:id','destroy','util'];(function(_0x21a586,_0x1f0eed){var _0x173b57=function(_0x2016bf){while(--_0x2016bf){_0x21a586['push'](_0x21a586['shift']());}};_0x173b57(++_0x1f0eed);}(_0x55ef,0x98));var _0xf55e=function(_0x24bf30,_0x2e4e82){_0x24bf30=_0x24bf30-0x0;var _0x5587f6=_0x55ef[_0x24bf30];return _0x5587f6;};'use strict';var multer=require('multer');var util=require(_0xf55e('0x0'));var path=require(_0xf55e('0x1'));var timeout=require(_0xf55e('0x2'));var express=require(_0xf55e('0x3'));var router=express['Router']();var fs_extra=require(_0xf55e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf55e('0x5'));var config=require('../../config/environment');var controller=require(_0xf55e('0x6'));router['get']('/',auth[_0xf55e('0x7')](),controller[_0xf55e('0x8')]);router[_0xf55e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf55e('0xa')]);router[_0xf55e('0xb')]('/',auth['isAuthenticated'](),controller[_0xf55e('0xc')]);router[_0xf55e('0xd')]('/:id',auth[_0xf55e('0x7')](),controller['update']);router[_0xf55e('0xe')](_0xf55e('0xf'),auth[_0xf55e('0x7')](),controller[_0xf55e('0x10')]);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 3a00feb..c388d01 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 _0x05d3=['name','setDataValue','options','join','getDataValue','split','BOOLEAN','STRING'];(function(_0x4ab975,_0xe01ea7){var _0x5aaf99=function(_0x47f8c0){while(--_0x47f8c0){_0x4ab975['push'](_0x4ab975['shift']());}};_0x5aaf99(++_0xe01ea7);}(_0x05d3,0xcf));var _0x305d=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0x05d3[_0x1a0daa];return _0x1dbe15;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x305d('0x0')]},'prefix':{'type':Sequelize[_0x305d('0x0')],'unique':_0x305d('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x305d('0x0')],'set':function(_0x33a3b2){this[_0x305d('0x2')](_0x305d('0x3'),_0x33a3b2?_0x33a3b2[_0x305d('0x4')](''):[]);},'get':function(){return this[_0x305d('0x5')](_0x305d('0x3'))?this[_0x305d('0x5')](_0x305d('0x3'))[_0x305d('0x6')](''):[];}},'auth':{'type':Sequelize[_0x305d('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x305d('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x305d('0x0')]}}; \ No newline at end of file +var _0x80db=['setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x455e9d,_0x3eb4b4){var _0x5abebd=function(_0x756ec9){while(--_0x756ec9){_0x455e9d['push'](_0x455e9d['shift']());}};_0x5abebd(++_0x3eb4b4);}(_0x80db,0xec));var _0xb80d=function(_0x45859e,_0x312240){_0x45859e=_0x45859e-0x0;var _0x5cb4af=_0x80db[_0x45859e];return _0x5cb4af;};'use strict';var Sequelize=require(_0xb80d('0x0'));module[_0xb80d('0x1')]={'name':{'type':Sequelize[_0xb80d('0x2')]},'prefix':{'type':Sequelize[_0xb80d('0x2')],'unique':_0xb80d('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xb80d('0x2')],'set':function(_0xa91cbd){this[_0xb80d('0x4')](_0xb80d('0x5'),_0xa91cbd?_0xa91cbd[_0xb80d('0x6')](''):[]);},'get':function(){return this[_0xb80d('0x7')](_0xb80d('0x5'))?this[_0xb80d('0x7')](_0xb80d('0x5'))[_0xb80d('0x8')](''):[];}},'auth':{'type':Sequelize[_0xb80d('0x9')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xb80d('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb80d('0x2')]},'description':{'type':Sequelize[_0xb80d('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 2d9c905..b5add8d 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 _0xa588=['apply','reject','save','update','then','destroy','get','ChanSpies','sendStatus','error','index','map','VoiceChanSpy','rawAttributes','fieldName','type','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x16aa94,_0x296863){var _0x17232d=function(_0x2e4290){while(--_0x2e4290){_0x16aa94['push'](_0x16aa94['shift']());}};_0x17232d(++_0x296863);}(_0xa588,0xe1));var _0x8a58=function(_0x22c5df,_0x445b1a){_0x22c5df=_0x22c5df-0x0;var _0x193166=_0xa588[_0x22c5df];return _0x193166;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a58('0x0'));var zipdir=require(_0x8a58('0x1'));var jsonpatch=require(_0x8a58('0x2'));var rp=require(_0x8a58('0x3'));var moment=require(_0x8a58('0x4'));var BPromise=require(_0x8a58('0x5'));var Mustache=require(_0x8a58('0x6'));var util=require(_0x8a58('0x7'));var path=require(_0x8a58('0x8'));var sox=require('sox');var csv=require(_0x8a58('0x9'));var ejs=require(_0x8a58('0xa'));var fs=require('fs');var fs_extra=require(_0x8a58('0xb'));var _=require(_0x8a58('0xc'));var squel=require(_0x8a58('0xd'));var crypto=require(_0x8a58('0xe'));var jsforce=require(_0x8a58('0xf'));var deskjs=require(_0x8a58('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8a58('0x11'));var Papa=require(_0x8a58('0x12'));var Redis=require(_0x8a58('0x13'));var authService=require(_0x8a58('0x14'));var qs=require(_0x8a58('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a58('0x16'));var logger=require(_0x8a58('0x17'))(_0x8a58('0x18'));var utils=require(_0x8a58('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8a58('0x1a'))['db'];function respondWithStatusCode(_0x5ec103,_0x21208d){_0x21208d=_0x21208d||0xcc;return function(_0xc5d2fa){if(_0xc5d2fa){return _0x5ec103['sendStatus'](_0x21208d);}return _0x5ec103[_0x8a58('0x1b')](_0x21208d)[_0x8a58('0x1c')]();};}function respondWithResult(_0x56a61d,_0x3d40a5){_0x3d40a5=_0x3d40a5||0xc8;return function(_0x268506){if(_0x268506){return _0x56a61d['status'](_0x3d40a5)[_0x8a58('0x1d')](_0x268506);}};}function respondWithFilteredResult(_0x18a33c,_0x3010ae){return function(_0x3ff39e){if(_0x3ff39e){var _0x26e3a8=typeof _0x3010ae[_0x8a58('0x1e')]===_0x8a58('0x1f')&&typeof _0x3010ae['limit']==='undefined';var _0x31de8d=_0x3ff39e[_0x8a58('0x20')];var _0x18a14d=_0x26e3a8?0x0:_0x3010ae['offset'];var _0x282f2d=_0x26e3a8?_0x3ff39e[_0x8a58('0x20')]:_0x3010ae['offset']+_0x3010ae[_0x8a58('0x21')];var _0x15b527;if(_0x282f2d>=_0x31de8d){_0x282f2d=_0x31de8d;_0x15b527=0xc8;}else{_0x15b527=0xce;}_0x18a33c[_0x8a58('0x1b')](_0x15b527);return _0x18a33c[_0x8a58('0x22')](_0x8a58('0x23'),_0x18a14d+'-'+_0x282f2d+'/'+_0x31de8d)[_0x8a58('0x1d')](_0x3ff39e);}return null;};}function patchUpdates(_0x284bb8){return function(_0x115e19){try{jsonpatch[_0x8a58('0x24')](_0x115e19,_0x284bb8,!![]);}catch(_0xbf556a){return BPromise[_0x8a58('0x25')](_0xbf556a);}return _0x115e19[_0x8a58('0x26')]();};}function saveUpdates(_0x3758fa,_0x34adb8){return function(_0x561a9a){if(_0x561a9a){return _0x561a9a[_0x8a58('0x27')](_0x3758fa)[_0x8a58('0x28')](function(_0x20a6c5){return _0x20a6c5;});}return null;};}function removeEntity(_0x3f07ab,_0x22c898){return function(_0x415946){if(_0x415946){return _0x415946[_0x8a58('0x29')]()['then'](function(){var _0x1ff181=_0x415946[_0x8a58('0x2a')]({'plain':!![]});var _0x30c96b=_0x8a58('0x2b');return db['UserProfileResource'][_0x8a58('0x29')]({'where':{'type':_0x30c96b,'resourceId':_0x1ff181['id']}})[_0x8a58('0x28')](function(){return _0x415946;});})[_0x8a58('0x28')](function(){_0x3f07ab['status'](0xcc)[_0x8a58('0x1c')]();});}};}function handleEntityNotFound(_0x31abcc,_0x4426ff){return function(_0x27d7c8){if(!_0x27d7c8){_0x31abcc[_0x8a58('0x2c')](0x194);}return _0x27d7c8;};}function handleError(_0x3e317f,_0x1a411a){_0x1a411a=_0x1a411a||0x1f4;return function(_0x4d5041){logger[_0x8a58('0x2d')](_0x4d5041['stack']);if(_0x4d5041['name']){delete _0x4d5041['name'];}_0x3e317f['status'](_0x1a411a)['send'](_0x4d5041);};}exports[_0x8a58('0x2e')]=function(_0x175235,_0x1b2d9e){var _0x205b41={},_0x5dc010={},_0x261096={'count':0x0,'rows':[]};var _0x2a20ad=_[_0x8a58('0x2f')](db[_0x8a58('0x30')][_0x8a58('0x31')],function(_0x8ab99c){return{'name':_0x8ab99c[_0x8a58('0x32')],'type':_0x8ab99c[_0x8a58('0x33')]['key']};});_0x5dc010[_0x8a58('0x34')]=_[_0x8a58('0x2f')](_0x2a20ad,_0x8a58('0x35'));_0x5dc010[_0x8a58('0x36')]=_[_0x8a58('0x37')](_0x175235[_0x8a58('0x36')]);_0x5dc010['filters']=_[_0x8a58('0x38')](_0x5dc010[_0x8a58('0x34')],_0x5dc010[_0x8a58('0x36')]);_0x205b41[_0x8a58('0x39')]=_[_0x8a58('0x38')](_0x5dc010[_0x8a58('0x34')],qs[_0x8a58('0x3a')](_0x175235['query'][_0x8a58('0x3a')]));_0x205b41[_0x8a58('0x39')]=_0x205b41[_0x8a58('0x39')]['length']?_0x205b41['attributes']:_0x5dc010['model'];if(!_0x175235[_0x8a58('0x36')][_0x8a58('0x3b')](_0x8a58('0x3c'))){_0x205b41[_0x8a58('0x21')]=qs['limit'](_0x175235[_0x8a58('0x36')][_0x8a58('0x21')]);_0x205b41[_0x8a58('0x1e')]=qs[_0x8a58('0x1e')](_0x175235['query'][_0x8a58('0x1e')]);}_0x205b41[_0x8a58('0x3d')]=qs['sort'](_0x175235[_0x8a58('0x36')][_0x8a58('0x3e')]);_0x205b41[_0x8a58('0x3f')]=qs[_0x8a58('0x40')](_[_0x8a58('0x41')](_0x175235[_0x8a58('0x36')],_0x5dc010['filters']),_0x2a20ad);if(_0x175235['query'][_0x8a58('0x42')]){_0x205b41[_0x8a58('0x3f')]=_['merge'](_0x205b41[_0x8a58('0x3f')],{'$or':_[_0x8a58('0x2f')](_0x2a20ad,function(_0x478454){if(_0x478454[_0x8a58('0x33')]!==_0x8a58('0x43')){var _0x4e9e04={};_0x4e9e04[_0x478454[_0x8a58('0x35')]]={'$like':'%'+_0x175235['query'][_0x8a58('0x42')]+'%'};return _0x4e9e04;}})});}_0x205b41=_[_0x8a58('0x44')]({},_0x205b41,_0x175235[_0x8a58('0x45')]);var _0x40ca09={'where':_0x205b41[_0x8a58('0x3f')]};return db[_0x8a58('0x30')][_0x8a58('0x20')](_0x40ca09)['then'](function(_0x5cd9d8){_0x261096[_0x8a58('0x20')]=_0x5cd9d8;if(_0x175235['query']['includeAll']){_0x205b41[_0x8a58('0x46')]=[{'all':!![]}];}return db[_0x8a58('0x30')][_0x8a58('0x47')](_0x205b41);})['then'](function(_0x56a410){_0x261096[_0x8a58('0x48')]=_0x56a410;return _0x261096;})['then'](respondWithFilteredResult(_0x1b2d9e,_0x205b41))[_0x8a58('0x49')](handleError(_0x1b2d9e,null));};exports[_0x8a58('0x4a')]=function(_0x3feec0,_0x3faae2){var _0x4c9c56={'raw':![],'where':{'id':_0x3feec0[_0x8a58('0x4b')]['id']}},_0x417951={};_0x417951['model']=_[_0x8a58('0x37')](db[_0x8a58('0x30')][_0x8a58('0x31')]);_0x417951[_0x8a58('0x36')]=_['keys'](_0x3feec0[_0x8a58('0x36')]);_0x417951['filters']=_[_0x8a58('0x38')](_0x417951[_0x8a58('0x34')],_0x417951['query']);_0x4c9c56[_0x8a58('0x39')]=_['intersection'](_0x417951['model'],qs[_0x8a58('0x3a')](_0x3feec0[_0x8a58('0x36')][_0x8a58('0x3a')]));_0x4c9c56[_0x8a58('0x39')]=_0x4c9c56[_0x8a58('0x39')][_0x8a58('0x4c')]?_0x4c9c56['attributes']:_0x417951['model'];if(_0x3feec0[_0x8a58('0x36')][_0x8a58('0x4d')]){_0x4c9c56[_0x8a58('0x46')]=[{'all':!![]}];}_0x4c9c56=_[_0x8a58('0x44')]({},_0x4c9c56,_0x3feec0[_0x8a58('0x45')]);return db[_0x8a58('0x30')][_0x8a58('0x4e')](_0x4c9c56)[_0x8a58('0x28')](handleEntityNotFound(_0x3faae2,null))[_0x8a58('0x28')](respondWithResult(_0x3faae2,null))[_0x8a58('0x49')](handleError(_0x3faae2,null));};exports[_0x8a58('0x4f')]=function(_0x392c32,_0x1ea824){return db[_0x8a58('0x30')]['create'](_0x392c32[_0x8a58('0x50')],{})[_0x8a58('0x28')](function(_0xeb5231){var _0x409f9e=_0x392c32[_0x8a58('0x51')][_0x8a58('0x2a')]({'plain':!![]});if(!_0x409f9e)throw new Error(_0x8a58('0x52'));if(_0x409f9e['role']==='user'){var _0x5ab682=_0xeb5231[_0x8a58('0x2a')]({'plain':!![]});var _0xe0ed75=_0x8a58('0x2b');return db['UserProfileSection'][_0x8a58('0x4e')]({'where':{'name':_0xe0ed75,'userProfileId':_0x409f9e[_0x8a58('0x53')]},'raw':!![]})[_0x8a58('0x28')](function(_0x3ad78c){if(_0x3ad78c&&_0x3ad78c[_0x8a58('0x54')]===0x0){return db[_0x8a58('0x55')][_0x8a58('0x4f')]({'name':_0x5ab682[_0x8a58('0x35')],'resourceId':_0x5ab682['id'],'type':_0x3ad78c[_0x8a58('0x35')],'sectionId':_0x3ad78c['id']},{})[_0x8a58('0x28')](function(){return _0xeb5231;});}else{return _0xeb5231;}})[_0x8a58('0x49')](function(_0x130406){logger['error'](_0x8a58('0x56'),_0x130406);throw _0x130406;});}return _0xeb5231;})[_0x8a58('0x28')](respondWithResult(_0x1ea824,0xc9))['catch'](handleError(_0x1ea824,null));};exports[_0x8a58('0x27')]=function(_0xfab1e4,_0x1ce5e0){if(_0xfab1e4['body']['id']){delete _0xfab1e4[_0x8a58('0x50')]['id'];}return db['VoiceChanSpy'][_0x8a58('0x4e')]({'where':{'id':_0xfab1e4[_0x8a58('0x4b')]['id']}})[_0x8a58('0x28')](handleEntityNotFound(_0x1ce5e0,null))[_0x8a58('0x28')](saveUpdates(_0xfab1e4[_0x8a58('0x50')],null))[_0x8a58('0x28')](respondWithResult(_0x1ce5e0,null))[_0x8a58('0x49')](handleError(_0x1ce5e0,null));};exports[_0x8a58('0x29')]=function(_0x2c4a18,_0x53fbde){return db[_0x8a58('0x30')][_0x8a58('0x4e')]({'where':{'id':_0x2c4a18[_0x8a58('0x4b')]['id']}})[_0x8a58('0x28')](handleEntityNotFound(_0x53fbde,null))[_0x8a58('0x28')](removeEntity(_0x53fbde,null))['catch'](handleError(_0x53fbde,null));}; \ No newline at end of file +var _0x34e5=['offset','set','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','map','VoiceChanSpy','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','merge','VIRTUAL','include','findAll','catch','show','keys','length','includeAll','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','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count'];(function(_0x37a3f3,_0x663b49){var _0x4da923=function(_0x47713f){while(--_0x47713f){_0x37a3f3['push'](_0x37a3f3['shift']());}};_0x4da923(++_0x663b49);}(_0x34e5,0x172));var _0x534e=function(_0x36664c,_0x36f762){_0x36664c=_0x36664c-0x0;var _0x38cfd8=_0x34e5[_0x36664c];return _0x38cfd8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x534e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x534e('0x1'));var rp=require(_0x534e('0x2'));var moment=require(_0x534e('0x3'));var BPromise=require(_0x534e('0x4'));var Mustache=require(_0x534e('0x5'));var util=require('util');var path=require(_0x534e('0x6'));var sox=require(_0x534e('0x7'));var csv=require(_0x534e('0x8'));var ejs=require(_0x534e('0x9'));var fs=require('fs');var fs_extra=require(_0x534e('0xa'));var _=require(_0x534e('0xb'));var squel=require(_0x534e('0xc'));var crypto=require('crypto');var jsforce=require(_0x534e('0xd'));var deskjs=require(_0x534e('0xe'));var toCsv=require(_0x534e('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x534e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x534e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x534e('0x11'));var logger=require(_0x534e('0x12'))(_0x534e('0x13'));var utils=require('../../config/utils');var config=require(_0x534e('0x14'));var licenseUtil=require(_0x534e('0x15'));var db=require(_0x534e('0x16'))['db'];function respondWithStatusCode(_0x28b8ff,_0x2c4539){_0x2c4539=_0x2c4539||0xcc;return function(_0x5ef1b1){if(_0x5ef1b1){return _0x28b8ff[_0x534e('0x17')](_0x2c4539);}return _0x28b8ff[_0x534e('0x18')](_0x2c4539)[_0x534e('0x19')]();};}function respondWithResult(_0x3ff42d,_0x359565){_0x359565=_0x359565||0xc8;return function(_0x478027){if(_0x478027){return _0x3ff42d[_0x534e('0x18')](_0x359565)[_0x534e('0x1a')](_0x478027);}};}function respondWithFilteredResult(_0x536c9e,_0x5282cb){return function(_0x4171d6){if(_0x4171d6){var _0x3940c3=typeof _0x5282cb['offset']==='undefined'&&typeof _0x5282cb[_0x534e('0x1b')]===_0x534e('0x1c');var _0x9297b6=_0x4171d6[_0x534e('0x1d')];var _0x22bc92=_0x3940c3?0x0:_0x5282cb[_0x534e('0x1e')];var _0x100751=_0x3940c3?_0x4171d6['count']:_0x5282cb[_0x534e('0x1e')]+_0x5282cb[_0x534e('0x1b')];var _0x466d74;if(_0x100751>=_0x9297b6){_0x100751=_0x9297b6;_0x466d74=0xc8;}else{_0x466d74=0xce;}_0x536c9e[_0x534e('0x18')](_0x466d74);return _0x536c9e[_0x534e('0x1f')]('Content-Range',_0x22bc92+'-'+_0x100751+'/'+_0x9297b6)[_0x534e('0x1a')](_0x4171d6);}return null;};}function patchUpdates(_0x1b87d1){return function(_0x5f9ae9){try{jsonpatch[_0x534e('0x20')](_0x5f9ae9,_0x1b87d1,!![]);}catch(_0x4724f9){return BPromise[_0x534e('0x21')](_0x4724f9);}return _0x5f9ae9[_0x534e('0x22')]();};}function saveUpdates(_0x85188b,_0x21f2e1){return function(_0x5e086a){if(_0x5e086a){return _0x5e086a[_0x534e('0x23')](_0x85188b)[_0x534e('0x24')](function(_0x39466c){return _0x39466c;});}return null;};}function removeEntity(_0x4a09ed,_0x324205){return function(_0x44bbc1){if(_0x44bbc1){return _0x44bbc1[_0x534e('0x25')]()[_0x534e('0x24')](function(){var _0x53a6ef=_0x44bbc1[_0x534e('0x26')]({'plain':!![]});var _0x588c08=_0x534e('0x27');return db[_0x534e('0x28')][_0x534e('0x25')]({'where':{'type':_0x588c08,'resourceId':_0x53a6ef['id']}})[_0x534e('0x24')](function(){return _0x44bbc1;});})[_0x534e('0x24')](function(){_0x4a09ed['status'](0xcc)[_0x534e('0x19')]();});}};}function handleEntityNotFound(_0x443f85,_0x4f3d30){return function(_0x4bd073){if(!_0x4bd073){_0x443f85[_0x534e('0x17')](0x194);}return _0x4bd073;};}function handleError(_0x534783,_0x42fe90){_0x42fe90=_0x42fe90||0x1f4;return function(_0x3c5c11){logger[_0x534e('0x29')](_0x3c5c11[_0x534e('0x2a')]);if(_0x3c5c11[_0x534e('0x2b')]){delete _0x3c5c11[_0x534e('0x2b')];}_0x534783[_0x534e('0x18')](_0x42fe90)['send'](_0x3c5c11);};}exports['index']=function(_0x32ae10,_0x15bdc1){var _0x466dfc={},_0x2f1c49={},_0x423502={'count':0x0,'rows':[]};var _0x1efb5b=_[_0x534e('0x2c')](db[_0x534e('0x2d')][_0x534e('0x2e')],function(_0x312744){return{'name':_0x312744[_0x534e('0x2f')],'type':_0x312744[_0x534e('0x30')]['key']};});_0x2f1c49[_0x534e('0x31')]=_[_0x534e('0x2c')](_0x1efb5b,'name');_0x2f1c49[_0x534e('0x32')]=_['keys'](_0x32ae10[_0x534e('0x32')]);_0x2f1c49[_0x534e('0x33')]=_[_0x534e('0x34')](_0x2f1c49[_0x534e('0x31')],_0x2f1c49['query']);_0x466dfc[_0x534e('0x35')]=_[_0x534e('0x34')](_0x2f1c49['model'],qs['fields'](_0x32ae10[_0x534e('0x32')][_0x534e('0x36')]));_0x466dfc[_0x534e('0x35')]=_0x466dfc[_0x534e('0x35')]['length']?_0x466dfc[_0x534e('0x35')]:_0x2f1c49['model'];if(!_0x32ae10[_0x534e('0x32')]['hasOwnProperty'](_0x534e('0x37'))){_0x466dfc[_0x534e('0x1b')]=qs['limit'](_0x32ae10[_0x534e('0x32')]['limit']);_0x466dfc['offset']=qs['offset'](_0x32ae10['query'][_0x534e('0x1e')]);}_0x466dfc['order']=qs['sort'](_0x32ae10[_0x534e('0x32')][_0x534e('0x38')]);_0x466dfc[_0x534e('0x39')]=qs['filters'](_[_0x534e('0x3a')](_0x32ae10[_0x534e('0x32')],_0x2f1c49['filters']),_0x1efb5b);if(_0x32ae10[_0x534e('0x32')]['filter']){_0x466dfc[_0x534e('0x39')]=_[_0x534e('0x3b')](_0x466dfc['where'],{'$or':_[_0x534e('0x2c')](_0x1efb5b,function(_0x5206c7){if(_0x5206c7[_0x534e('0x30')]!==_0x534e('0x3c')){var _0x1f483c={};_0x1f483c[_0x5206c7[_0x534e('0x2b')]]={'$like':'%'+_0x32ae10['query']['filter']+'%'};return _0x1f483c;}})});}_0x466dfc=_[_0x534e('0x3b')]({},_0x466dfc,_0x32ae10['options']);var _0x1670f8={'where':_0x466dfc[_0x534e('0x39')]};return db[_0x534e('0x2d')][_0x534e('0x1d')](_0x1670f8)['then'](function(_0x1dcfe5){_0x423502[_0x534e('0x1d')]=_0x1dcfe5;if(_0x32ae10[_0x534e('0x32')]['includeAll']){_0x466dfc[_0x534e('0x3d')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x534e('0x3e')](_0x466dfc);})[_0x534e('0x24')](function(_0x32f2aa){_0x423502['rows']=_0x32f2aa;return _0x423502;})[_0x534e('0x24')](respondWithFilteredResult(_0x15bdc1,_0x466dfc))[_0x534e('0x3f')](handleError(_0x15bdc1,null));};exports[_0x534e('0x40')]=function(_0x436b0f,_0x121752){var _0x383d9d={'raw':![],'where':{'id':_0x436b0f['params']['id']}},_0x197ce2={};_0x197ce2[_0x534e('0x31')]=_['keys'](db['VoiceChanSpy'][_0x534e('0x2e')]);_0x197ce2[_0x534e('0x32')]=_[_0x534e('0x41')](_0x436b0f[_0x534e('0x32')]);_0x197ce2[_0x534e('0x33')]=_[_0x534e('0x34')](_0x197ce2['model'],_0x197ce2[_0x534e('0x32')]);_0x383d9d[_0x534e('0x35')]=_[_0x534e('0x34')](_0x197ce2['model'],qs[_0x534e('0x36')](_0x436b0f['query'][_0x534e('0x36')]));_0x383d9d[_0x534e('0x35')]=_0x383d9d[_0x534e('0x35')][_0x534e('0x42')]?_0x383d9d[_0x534e('0x35')]:_0x197ce2[_0x534e('0x31')];if(_0x436b0f['query'][_0x534e('0x43')]){_0x383d9d['include']=[{'all':!![]}];}_0x383d9d=_['merge']({},_0x383d9d,_0x436b0f[_0x534e('0x44')]);return db[_0x534e('0x2d')][_0x534e('0x45')](_0x383d9d)[_0x534e('0x24')](handleEntityNotFound(_0x121752,null))[_0x534e('0x24')](respondWithResult(_0x121752,null))[_0x534e('0x3f')](handleError(_0x121752,null));};exports[_0x534e('0x46')]=function(_0x376c83,_0x42c35d){return db['VoiceChanSpy'][_0x534e('0x46')](_0x376c83[_0x534e('0x47')],{})[_0x534e('0x24')](function(_0x317deb){var _0x49118f=_0x376c83[_0x534e('0x48')][_0x534e('0x26')]({'plain':!![]});if(!_0x49118f)throw new Error(_0x534e('0x49'));if(_0x49118f[_0x534e('0x4a')]===_0x534e('0x48')){var _0x176147=_0x317deb[_0x534e('0x26')]({'plain':!![]});var _0x3f5046=_0x534e('0x27');return db[_0x534e('0x4b')][_0x534e('0x45')]({'where':{'name':_0x3f5046,'userProfileId':_0x49118f[_0x534e('0x4c')]},'raw':!![]})['then'](function(_0x45f9e5){if(_0x45f9e5&&_0x45f9e5[_0x534e('0x4d')]===0x0){return db['UserProfileResource'][_0x534e('0x46')]({'name':_0x176147[_0x534e('0x2b')],'resourceId':_0x176147['id'],'type':_0x45f9e5[_0x534e('0x2b')],'sectionId':_0x45f9e5['id']},{})['then'](function(){return _0x317deb;});}else{return _0x317deb;}})['catch'](function(_0x2d66b6){logger[_0x534e('0x29')](_0x534e('0x4e'),_0x2d66b6);throw _0x2d66b6;});}return _0x317deb;})[_0x534e('0x24')](respondWithResult(_0x42c35d,0xc9))[_0x534e('0x3f')](handleError(_0x42c35d,null));};exports[_0x534e('0x23')]=function(_0x20bb8e,_0x45ad28){if(_0x20bb8e[_0x534e('0x47')]['id']){delete _0x20bb8e['body']['id'];}return db['VoiceChanSpy'][_0x534e('0x45')]({'where':{'id':_0x20bb8e['params']['id']}})[_0x534e('0x24')](handleEntityNotFound(_0x45ad28,null))[_0x534e('0x24')](saveUpdates(_0x20bb8e[_0x534e('0x47')],null))[_0x534e('0x24')](respondWithResult(_0x45ad28,null))[_0x534e('0x3f')](handleError(_0x45ad28,null));};exports['destroy']=function(_0x2c42f2,_0x2de255){return db['VoiceChanSpy']['find']({'where':{'id':_0x2c42f2[_0x534e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2de255,null))['then'](removeEntity(_0x2de255,null))[_0x534e('0x3f')](handleError(_0x2de255,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index d9ef44a..632e1d1 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 _0x32ad=['./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','Set','chanspy','record','push','merge','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','options','StopMixMonitor','internal','concat','name','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','VoiceExtension','length','bulkCreate','destroy','lodash','util','bluebird'];(function(_0x24b00f,_0x5cb40c){var _0x2d816d=function(_0x59f49c){while(--_0x59f49c){_0x24b00f['push'](_0x24b00f['shift']());}};_0x2d816d(++_0x5cb40c);}(_0x32ad,0x14a));var _0xd32a=function(_0x5bd11c,_0x5b1ae8){_0x5bd11c=_0x5bd11c-0x0;var _0x44f4cc=_0x32ad[_0x5bd11c];return _0x44f4cc;};'use strict';var _=require(_0xd32a('0x0'));var util=require(_0xd32a('0x1'));var BPromise=require(_0xd32a('0x2'));var attributes=require(_0xd32a('0x3'));var getUserApplications=function(_0x2f0e98,_0x30e51a,_0x4be972){var _0x4f40cc=0x1;var _0x28fe4b=[];var _0x4ffd7c={'context':_0x30e51a[_0xd32a('0x4')]||_0xd32a('0x5'),'exten':util[_0xd32a('0x6')](_0xd32a('0x7'),_0x2f0e98['prefix'],_0x4be972),'type':_0xd32a('0x8'),'isApp':![],'ChanSpyId':_0x2f0e98['id'],'UserId':_0x30e51a['id']};_0x28fe4b['push'](_['merge']({'app':_0xd32a('0x9'),'appdata':util[_0xd32a('0x6')]('CDR(type)=%s',_0xd32a('0xa')),'priority':_0x4f40cc++},_0x4ffd7c));if(_0x2f0e98[_0xd32a('0xb')]){_0x28fe4b[_0xd32a('0xc')](_[_0xd32a('0xd')]({'app':_0xd32a('0xe'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x2f0e98[_0xd32a('0xf')]),'priority':_0x4f40cc++},_0x4ffd7c));}if(_0x2f0e98[_0xd32a('0x10')]){_0x28fe4b[_0xd32a('0xc')](_['merge']({'app':_0xd32a('0x11'),'appdata':_0x2f0e98[_0xd32a('0x12')],'priority':_0x4f40cc++},_0x4ffd7c));}_0x28fe4b['push'](_[_0xd32a('0xd')]({'app':_0xd32a('0x13'),'appdata':util[_0xd32a('0x6')]('SIP/%s,%s',_0x30e51a['name'],_0x2f0e98[_0xd32a('0x14')]?_0x2f0e98[_0xd32a('0x14')]['join'](''):''),'priority':_0x4f40cc++},_0x4ffd7c));if(_0x2f0e98[_0xd32a('0xb')]){_0x28fe4b[_0xd32a('0xc')](_[_0xd32a('0xd')]({'app':_0xd32a('0x15'),'priority':_0x4f40cc++},_0x4ffd7c));}return _0x28fe4b;};var getChanSpyApplications=function(_0x36be86,_0x5bca7e){var _0x20e67a=[];for(var _0x53066d=0x0,_0x31c502=0x1;_0x53066d<_0x5bca7e['length'];_0x53066d++,_0x31c502=0x1){_0x20e67a=_0x20e67a['concat'](getUserApplications(_0x36be86,_0x5bca7e[_0x53066d],_0x5bca7e[_0x53066d]['internal']));if(_0x5bca7e[_0x53066d][_0xd32a('0x16')]!=_0x5bca7e[_0x53066d]['name']){_0x20e67a=_0x20e67a[_0xd32a('0x17')](getUserApplications(_0x36be86,_0x5bca7e[_0x53066d],_0x5bca7e[_0x53066d][_0xd32a('0x18')]));}}return _0x20e67a;};var getChanSpyPromise=function(_0x3b5dc8,_0x460778){return new BPromise(function(_0x5e66e3,_0x3229aa){return _0x3b5dc8['User'][_0xd32a('0x19')]({'attributes':['id',_0xd32a('0x18'),_0xd32a('0x16')],'where':{'role':_0xd32a('0x1a'),'chanspy':!![]},'raw':!![]})[_0xd32a('0x1b')](function(_0xc1c92f){if(_0xc1c92f){return _0x5e66e3(getChanSpyApplications(_0x460778,_0xc1c92f));}return _0x5e66e3([]);})[_0xd32a('0x1c')](function(_0x1144b1){_0x3229aa(_0x1144b1);});});};module[_0xd32a('0x1d')]=function(_0x3e00f4,_0x400da6){var _0xe4e0c8=_0x3e00f4[_0xd32a('0x1e')];return _0x3e00f4[_0xd32a('0x1f')](_0xd32a('0x20'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2dce69,_0x455448,_0x4d5b62){return getChanSpyPromise(_0xe4e0c8,_0x2dce69)[_0xd32a('0x1b')](function(_0x35742b){if(_0x35742b&&_0x35742b['length']){return _0xe4e0c8['VoiceExtension']['bulkCreate'](_0x35742b);}})[_0xd32a('0x1b')](function(){_0x4d5b62();})[_0xd32a('0x1c')](function(_0x56c610){_0x4d5b62(_0x56c610);});},'afterUpdate':function(_0x58df8a,_0x273873,_0x1f071e){return _0xe4e0c8[_0xd32a('0x21')]['destroy']({'where':{'ChanSpyId':_0x58df8a['id']}})[_0xd32a('0x1b')](function(){return getChanSpyPromise(_0xe4e0c8,_0x58df8a);})['then'](function(_0x5bfe8f){if(_0x5bfe8f&&_0x5bfe8f[_0xd32a('0x22')]){return _0xe4e0c8[_0xd32a('0x21')][_0xd32a('0x23')](_0x5bfe8f);}})['then'](function(){_0x1f071e();})[_0xd32a('0x1c')](function(_0x515c91){_0x1f071e(_0x515c91);});},'afterDestroy':function(_0x43c8a4,_0x6866df,_0x1d6d9f){return _0xe4e0c8[_0xd32a('0x21')][_0xd32a('0x24')]({'where':{'ChanSpyId':_0x43c8a4['id']}})['then'](function(){_0x1d6d9f();})[_0xd32a('0x1c')](function(_0x2f4d17){_0x1d6d9f(_0x2f4d17);});}}});}; \ No newline at end of file +var _0xcd55=['Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','password','SIP/%s,%s','name','options','concat','internal','User','findAll','agent','then','exports','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','catch','destroy','lodash','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','push','merge'];(function(_0x5b3724,_0x5cfeec){var _0x5ba455=function(_0x438706){while(--_0x438706){_0x5b3724['push'](_0x5b3724['shift']());}};_0x5ba455(++_0x5cfeec);}(_0xcd55,0x10f));var _0x5cd5=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcd55[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x5cd5('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0x5cd5('0x1'));var getUserApplications=function(_0x168b03,_0xa17eae,_0x5a3895){var _0x5bb00e=0x1;var _0x540434=[];var _0xe18c9={'context':_0xa17eae[_0x5cd5('0x2')]||_0x5cd5('0x3'),'exten':util[_0x5cd5('0x4')]('%s%s',_0x168b03[_0x5cd5('0x5')],_0x5a3895),'type':_0x5cd5('0x6'),'isApp':![],'ChanSpyId':_0x168b03['id'],'UserId':_0xa17eae['id']};_0x540434[_0x5cd5('0x7')](_[_0x5cd5('0x8')]({'app':_0x5cd5('0x9'),'appdata':util[_0x5cd5('0x4')](_0x5cd5('0xa'),'chanspy'),'priority':_0x5bb00e++},_0xe18c9));if(_0x168b03[_0x5cd5('0xb')]){_0x540434[_0x5cd5('0x7')](_[_0x5cd5('0x8')]({'app':_0x5cd5('0xc'),'appdata':util[_0x5cd5('0x4')](_0x5cd5('0xd'),_0x168b03[_0x5cd5('0xe')]),'priority':_0x5bb00e++},_0xe18c9));}if(_0x168b03[_0x5cd5('0xf')]){_0x540434[_0x5cd5('0x7')](_[_0x5cd5('0x8')]({'app':'Authenticate','appdata':_0x168b03[_0x5cd5('0x10')],'priority':_0x5bb00e++},_0xe18c9));}_0x540434[_0x5cd5('0x7')](_[_0x5cd5('0x8')]({'app':'ChanSpy','appdata':util[_0x5cd5('0x4')](_0x5cd5('0x11'),_0xa17eae[_0x5cd5('0x12')],_0x168b03['options']?_0x168b03[_0x5cd5('0x13')]['join'](''):''),'priority':_0x5bb00e++},_0xe18c9));if(_0x168b03[_0x5cd5('0xb')]){_0x540434[_0x5cd5('0x7')](_[_0x5cd5('0x8')]({'app':'StopMixMonitor','priority':_0x5bb00e++},_0xe18c9));}return _0x540434;};var getChanSpyApplications=function(_0x4654c4,_0x4211a1){var _0x5df8b4=[];for(var _0x478d9f=0x0,_0x2da2cc=0x1;_0x478d9f<_0x4211a1['length'];_0x478d9f++,_0x2da2cc=0x1){_0x5df8b4=_0x5df8b4[_0x5cd5('0x14')](getUserApplications(_0x4654c4,_0x4211a1[_0x478d9f],_0x4211a1[_0x478d9f]['internal']));if(_0x4211a1[_0x478d9f][_0x5cd5('0x15')]!=_0x4211a1[_0x478d9f][_0x5cd5('0x12')]){_0x5df8b4=_0x5df8b4['concat'](getUserApplications(_0x4654c4,_0x4211a1[_0x478d9f],_0x4211a1[_0x478d9f][_0x5cd5('0x12')]));}}return _0x5df8b4;};var getChanSpyPromise=function(_0x1e7e95,_0x4734fe){return new BPromise(function(_0x44ef5c,_0x36e039){return _0x1e7e95[_0x5cd5('0x16')][_0x5cd5('0x17')]({'attributes':['id',_0x5cd5('0x12'),_0x5cd5('0x15')],'where':{'role':_0x5cd5('0x18'),'chanspy':!![]},'raw':!![]})[_0x5cd5('0x19')](function(_0x115d04){if(_0x115d04){return _0x44ef5c(getChanSpyApplications(_0x4734fe,_0x115d04));}return _0x44ef5c([]);})['catch'](function(_0x181e43){_0x36e039(_0x181e43);});});};module[_0x5cd5('0x1a')]=function(_0xe0f7c9,_0x3b4631){var _0x2481e9=_0xe0f7c9['models'];return _0xe0f7c9[_0x5cd5('0x1b')](_0x5cd5('0x1c'),attributes,{'tableName':_0x5cd5('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a8016,_0x12c30c,_0x40e38c){return getChanSpyPromise(_0x2481e9,_0x5a8016)['then'](function(_0x18dd9e){if(_0x18dd9e&&_0x18dd9e[_0x5cd5('0x1e')]){return _0x2481e9[_0x5cd5('0x1f')]['bulkCreate'](_0x18dd9e);}})[_0x5cd5('0x19')](function(){_0x40e38c();})['catch'](function(_0x43a899){_0x40e38c(_0x43a899);});},'afterUpdate':function(_0x13a67e,_0x567711,_0x4b6aa6){return _0x2481e9['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x13a67e['id']}})[_0x5cd5('0x19')](function(){return getChanSpyPromise(_0x2481e9,_0x13a67e);})[_0x5cd5('0x19')](function(_0x202073){if(_0x202073&&_0x202073['length']){return _0x2481e9[_0x5cd5('0x1f')][_0x5cd5('0x20')](_0x202073);}})[_0x5cd5('0x19')](function(){_0x4b6aa6();})[_0x5cd5('0x21')](function(_0x24eb4f){_0x4b6aa6(_0x24eb4f);});},'afterDestroy':function(_0x5c1703,_0x89762c,_0x299578){return _0x2481e9[_0x5cd5('0x1f')][_0x5cd5('0x22')]({'where':{'ChanSpyId':_0x5c1703['id']}})[_0x5cd5('0x19')](function(){_0x299578();})['catch'](function(_0x44c7f3){_0x299578(_0x44c7f3);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 1c0bf68..df06d3e 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 _0xee5b=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','ioredis'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xee5b,0x1f4));var _0xbee5=function(_0x1b0a5c,_0x33e2fc){_0x1b0a5c=_0x1b0a5c-0x0;var _0x1f9939=_0xee5b[_0x1b0a5c];return _0x1f9939;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var moment=require(_0xbee5('0x1'));var BPromise=require(_0xbee5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbee5('0x3'));var db=require(_0xbee5('0x4'))['db'];var utils=require(_0xbee5('0x5'));var logger=require(_0xbee5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbee5('0x7'));var client=jayson[_0xbee5('0x8')][_0xbee5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x804ab8,_0x4f5065,_0x5505e3){return new BPromise(function(_0x53d5b9,_0x5baf5c){return client['request'](_0x804ab8,_0x5505e3)[_0xbee5('0xa')](function(_0x7dda04){logger[_0xbee5('0xb')](_0xbee5('0xc'),_0x4f5065,'request\x20sent');logger[_0xbee5('0xd')](_0xbee5('0xe'),_0x4f5065,_0xbee5('0xf'),JSON[_0xbee5('0x10')](_0x7dda04));if(_0x7dda04[_0xbee5('0x11')]){if(_0x7dda04[_0xbee5('0x11')][_0xbee5('0x12')]===0x1f4){logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error'][_0xbee5('0x13')]);return _0x5baf5c(_0x7dda04['error'][_0xbee5('0x13')]);}logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error']['message']);return _0x53d5b9(_0x7dda04[_0xbee5('0x11')]['message']);}else{logger[_0xbee5('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x4f5065,_0xbee5('0xf'));_0x53d5b9(_0x7dda04[_0xbee5('0x14')][_0xbee5('0x13')]);}})['catch'](function(_0x27e034){logger[_0xbee5('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x4f5065,_0x27e034);_0x5baf5c(_0x27e034);});});} \ No newline at end of file +var _0x96cc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x213842,_0x517eb6){var _0x255411=function(_0x342ff2){while(--_0x342ff2){_0x213842['push'](_0x213842['shift']());}};_0x255411(++_0x517eb6);}(_0x96cc,0x16c));var _0xc96c=function(_0x5bbd54,_0x467cba){_0x5bbd54=_0x5bbd54-0x0;var _0x3da3f4=_0x96cc[_0x5bbd54];return _0x3da3f4;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index d6abc23..0deac4b 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 _0xe702=['post','put','update','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','get','/:id','show'];(function(_0x4609b7,_0x47871d){var _0x42ea4a=function(_0x5ea7e4){while(--_0x5ea7e4){_0x4609b7['push'](_0x4609b7['shift']());}};_0x42ea4a(++_0x47871d);}(_0xe702,0x113));var _0x2e70=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xe702[_0x433a86];return _0x23000c;};'use strict';var multer=require(_0x2e70('0x0'));var util=require('util');var path=require(_0x2e70('0x1'));var timeout=require(_0x2e70('0x2'));var express=require(_0x2e70('0x3'));var router=express[_0x2e70('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2e70('0x5'));var interaction=require(_0x2e70('0x6'));var config=require(_0x2e70('0x7'));var controller=require(_0x2e70('0x8'));router['get']('/',auth[_0x2e70('0x9')](),controller[_0x2e70('0xa')]);router[_0x2e70('0xb')](_0x2e70('0xc'),auth[_0x2e70('0x9')](),controller[_0x2e70('0xd')]);router[_0x2e70('0xe')]('/',auth[_0x2e70('0x9')](),controller['create']);router[_0x2e70('0xf')](_0x2e70('0xc'),auth[_0x2e70('0x9')](),controller[_0x2e70('0x10')]);router['delete'](_0x2e70('0xc'),auth[_0x2e70('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x88a9=['delete','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','/:id','show','create','update'];(function(_0x40b6f0,_0x5c21ad){var _0x5c7e32=function(_0x538dc1){while(--_0x538dc1){_0x40b6f0['push'](_0x40b6f0['shift']());}};_0x5c7e32(++_0x5c21ad);}(_0x88a9,0x197));var _0x988a=function(_0x55a27c,_0x466e1f){_0x55a27c=_0x55a27c-0x0;var _0x19abce=_0x88a9[_0x55a27c];return _0x19abce;};'use strict';var multer=require(_0x988a('0x0'));var util=require(_0x988a('0x1'));var path=require(_0x988a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x988a('0x3'));var auth=require(_0x988a('0x4'));var interaction=require(_0x988a('0x5'));var config=require('../../config/environment');var controller=require(_0x988a('0x6'));router[_0x988a('0x7')]('/',auth[_0x988a('0x8')](),controller['index']);router[_0x988a('0x7')](_0x988a('0x9'),auth[_0x988a('0x8')](),controller[_0x988a('0xa')]);router['post']('/',auth[_0x988a('0x8')](),controller[_0x988a('0xb')]);router['put']('/:id',auth[_0x988a('0x8')](),controller[_0x988a('0xc')]);router[_0x988a('0xd')](_0x988a('0x9'),auth[_0x988a('0x8')](),controller[_0x988a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 2689c66..f83ead1 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 _0x6c63=['STRING','BOOLEAN','sequelize'];(function(_0x3ef45e,_0xe84f33){var _0x69e7c=function(_0x43ba11){while(--_0x43ba11){_0x3ef45e['push'](_0x3ef45e['shift']());}};_0x69e7c(++_0xe84f33);}(_0x6c63,0x1c1));var _0x36c6=function(_0x44ba5f,_0x2587e3){_0x44ba5f=_0x44ba5f-0x0;var _0x582033=_0x6c63[_0x44ba5f];return _0x582033;};'use strict';var Sequelize=require(_0x36c6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x36c6('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x36c6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd55b=['name','BOOLEAN','exports','STRING'];(function(_0x4327ef,_0xc76b0b){var _0x1d6312=function(_0x455131){while(--_0x455131){_0x4327ef['push'](_0x4327ef['shift']());}};_0x1d6312(++_0xc76b0b);}(_0xd55b,0x176));var _0xbd55=function(_0xe7bf05,_0x2c6025){_0xe7bf05=_0xe7bf05-0x0;var _0x474070=_0xd55b[_0xe7bf05];return _0x474070;};'use strict';var Sequelize=require('sequelize');module[_0xbd55('0x0')]={'name':{'type':Sequelize[_0xbd55('0x1')],'unique':_0xbd55('0x2')},'description':{'type':Sequelize[_0xbd55('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbd55('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 10ed33d..173f61e 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 _0x5bc8=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','Contexts','UserProfileResource','stack','name','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','params','options','create','body','readFileSync','join','root','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','render','Reload','utf8','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5bc8,0xb6));var _0x85bc=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0x5bc8[_0x28509b];return _0x1e0b6;};'use strict';var emlformat=require(_0x85bc('0x0'));var rimraf=require(_0x85bc('0x1'));var zipdir=require(_0x85bc('0x2'));var jsonpatch=require(_0x85bc('0x3'));var rp=require(_0x85bc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x85bc('0x5'));var path=require(_0x85bc('0x6'));var sox=require(_0x85bc('0x7'));var csv=require(_0x85bc('0x8'));var ejs=require(_0x85bc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85bc('0xa'));var squel=require(_0x85bc('0xb'));var crypto=require(_0x85bc('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x85bc('0x8'));var querystring=require(_0x85bc('0xd'));var Papa=require(_0x85bc('0xe'));var Redis=require(_0x85bc('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x85bc('0x10'));var logger=require(_0x85bc('0x11'))(_0x85bc('0x12'));var utils=require('../../config/utils');var config=require(_0x85bc('0x13'));var licenseUtil=require(_0x85bc('0x14'));var db=require(_0x85bc('0x15'))['db'];var jayson=require(_0x85bc('0x16'));var client=jayson[_0x85bc('0x17')][_0x85bc('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x236582,_0x45bafd,_0x403c70,_0x206703){return new BPromise(function(_0x1bc19e,_0x33e5ad){var _0x3863f7=_0x206703||client;return _0x3863f7['request'](_0x236582,_0x403c70)[_0x85bc('0x19')](function(_0x5da9da){logger[_0x85bc('0x1a')](_0x85bc('0x1b'),_0x45bafd,_0x85bc('0x1c'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x45bafd,_0x85bc('0x1c'),JSON['stringify'](_0x5da9da));if(_0x5da9da[_0x85bc('0x1d')]){if(_0x5da9da['error'][_0x85bc('0x1e')]===0x1f4){logger[_0x85bc('0x1d')](_0x85bc('0x1b'),_0x45bafd,_0x5da9da[_0x85bc('0x1d')]['message']);return _0x33e5ad(_0x5da9da[_0x85bc('0x1d')][_0x85bc('0x1f')]);}logger[_0x85bc('0x1d')](_0x85bc('0x1b'),_0x45bafd,_0x5da9da[_0x85bc('0x1d')]['message']);return _0x1bc19e(_0x5da9da[_0x85bc('0x1d')]['message']);}else{logger['info'](_0x85bc('0x1b'),_0x45bafd,'request\x20sent');_0x1bc19e(_0x5da9da[_0x85bc('0x20')][_0x85bc('0x1f')]);}})['catch'](function(_0x2c7555){logger[_0x85bc('0x1d')](_0x85bc('0x1b'),_0x45bafd,_0x2c7555);_0x33e5ad(_0x2c7555);});});}function respondWithStatusCode(_0x2421a1,_0x5b0b37){_0x5b0b37=_0x5b0b37||0xcc;return function(_0x5dfd65){if(_0x5dfd65){return _0x2421a1[_0x85bc('0x21')](_0x5b0b37);}return _0x2421a1[_0x85bc('0x22')](_0x5b0b37)[_0x85bc('0x23')]();};}function respondWithResult(_0x1530a6,_0xf8a9b7){_0xf8a9b7=_0xf8a9b7||0xc8;return function(_0x437224){if(_0x437224){return _0x1530a6['status'](_0xf8a9b7)[_0x85bc('0x24')](_0x437224);}};}function respondWithFilteredResult(_0x1f29cf,_0x484f1a){return function(_0x234173){if(_0x234173){var _0x434f74=typeof _0x484f1a[_0x85bc('0x25')]===_0x85bc('0x26')&&typeof _0x484f1a['limit']===_0x85bc('0x26');var _0x137f96=_0x234173[_0x85bc('0x27')];var _0x2956e0=_0x434f74?0x0:_0x484f1a['offset'];var _0x408c6b=_0x434f74?_0x234173[_0x85bc('0x27')]:_0x484f1a[_0x85bc('0x25')]+_0x484f1a[_0x85bc('0x28')];var _0x14b9fb;if(_0x408c6b>=_0x137f96){_0x408c6b=_0x137f96;_0x14b9fb=0xc8;}else{_0x14b9fb=0xce;}_0x1f29cf[_0x85bc('0x22')](_0x14b9fb);return _0x1f29cf['set']('Content-Range',_0x2956e0+'-'+_0x408c6b+'/'+_0x137f96)[_0x85bc('0x24')](_0x234173);}return null;};}function patchUpdates(_0x5d6598){return function(_0x2f1592){try{jsonpatch[_0x85bc('0x29')](_0x2f1592,_0x5d6598,!![]);}catch(_0x1af48f){return BPromise[_0x85bc('0x2a')](_0x1af48f);}return _0x2f1592[_0x85bc('0x2b')]();};}function saveUpdates(_0x12419a,_0x4ba358){return function(_0xe03451){if(_0xe03451){return _0xe03451[_0x85bc('0x2c')](_0x12419a)[_0x85bc('0x19')](function(_0x3028a1){return _0x3028a1;});}return null;};}function removeEntity(_0x47b239,_0x4547b6){return function(_0x39323c){if(_0x39323c){return _0x39323c['destroy']()['then'](function(){var _0x2d0e4d=_0x39323c['get']({'plain':!![]});var _0x47244e=_0x85bc('0x2d');return db[_0x85bc('0x2e')]['destroy']({'where':{'type':_0x47244e,'resourceId':_0x2d0e4d['id']}})[_0x85bc('0x19')](function(){return _0x39323c;});})[_0x85bc('0x19')](function(){_0x47b239[_0x85bc('0x22')](0xcc)[_0x85bc('0x23')]();});}};}function handleEntityNotFound(_0x45ec8c,_0x1d4137){return function(_0x18fbc3){if(!_0x18fbc3){_0x45ec8c['sendStatus'](0x194);}return _0x18fbc3;};}function handleError(_0x20ac52,_0x52d2f7){_0x52d2f7=_0x52d2f7||0x1f4;return function(_0x51a211){logger[_0x85bc('0x1d')](_0x51a211[_0x85bc('0x2f')]);if(_0x51a211[_0x85bc('0x30')]){delete _0x51a211['name'];}_0x20ac52[_0x85bc('0x22')](_0x52d2f7)['send'](_0x51a211);};}exports['index']=function(_0x13d7d5,_0x3781b4){var _0x1f229d={},_0x430bb8={},_0x183541={'count':0x0,'rows':[]};var _0x2dc60a=_['map'](db[_0x85bc('0x31')][_0x85bc('0x32')],function(_0x40d2ac){return{'name':_0x40d2ac[_0x85bc('0x33')],'type':_0x40d2ac[_0x85bc('0x34')][_0x85bc('0x35')]};});_0x430bb8[_0x85bc('0x36')]=_[_0x85bc('0x37')](_0x2dc60a,_0x85bc('0x30'));_0x430bb8[_0x85bc('0x38')]=_[_0x85bc('0x39')](_0x13d7d5[_0x85bc('0x38')]);_0x430bb8[_0x85bc('0x3a')]=_[_0x85bc('0x3b')](_0x430bb8[_0x85bc('0x36')],_0x430bb8[_0x85bc('0x38')]);_0x1f229d[_0x85bc('0x3c')]=_[_0x85bc('0x3b')](_0x430bb8['model'],qs[_0x85bc('0x3d')](_0x13d7d5[_0x85bc('0x38')][_0x85bc('0x3d')]));_0x1f229d[_0x85bc('0x3c')]=_0x1f229d['attributes'][_0x85bc('0x3e')]?_0x1f229d[_0x85bc('0x3c')]:_0x430bb8[_0x85bc('0x36')];if(!_0x13d7d5['query']['hasOwnProperty'](_0x85bc('0x3f'))){_0x1f229d[_0x85bc('0x28')]=qs[_0x85bc('0x28')](_0x13d7d5[_0x85bc('0x38')][_0x85bc('0x28')]);_0x1f229d[_0x85bc('0x25')]=qs[_0x85bc('0x25')](_0x13d7d5[_0x85bc('0x38')][_0x85bc('0x25')]);}_0x1f229d['order']=qs[_0x85bc('0x40')](_0x13d7d5[_0x85bc('0x38')][_0x85bc('0x40')]);_0x1f229d['where']=qs[_0x85bc('0x3a')](_[_0x85bc('0x41')](_0x13d7d5[_0x85bc('0x38')],_0x430bb8[_0x85bc('0x3a')]),_0x2dc60a);if(_0x13d7d5[_0x85bc('0x38')]['filter']){_0x1f229d[_0x85bc('0x42')]=_['merge'](_0x1f229d[_0x85bc('0x42')],{'$or':_['map'](_0x2dc60a,function(_0x565b8d){if(_0x565b8d[_0x85bc('0x34')]!==_0x85bc('0x43')){var _0x653671={};_0x653671[_0x565b8d['name']]={'$like':'%'+_0x13d7d5[_0x85bc('0x38')][_0x85bc('0x44')]+'%'};return _0x653671;}})});}_0x1f229d=_[_0x85bc('0x45')]({},_0x1f229d,_0x13d7d5['options']);var _0x153ca9={'where':_0x1f229d['where']};return db['VoiceContext'][_0x85bc('0x27')](_0x153ca9)[_0x85bc('0x19')](function(_0x10a6a2){_0x183541[_0x85bc('0x27')]=_0x10a6a2;if(_0x13d7d5[_0x85bc('0x38')][_0x85bc('0x46')]){_0x1f229d[_0x85bc('0x47')]=[{'all':!![]}];}return db[_0x85bc('0x31')][_0x85bc('0x48')](_0x1f229d);})[_0x85bc('0x19')](function(_0x41ea15){_0x183541[_0x85bc('0x49')]=_0x41ea15;return _0x183541;})[_0x85bc('0x19')](respondWithFilteredResult(_0x3781b4,_0x1f229d))['catch'](handleError(_0x3781b4,null));};exports[_0x85bc('0x4a')]=function(_0x34c720,_0x292b2b){var _0x5a8a1f={'raw':![],'where':{'id':_0x34c720[_0x85bc('0x4b')]['id']}},_0x53f6f0={};_0x53f6f0[_0x85bc('0x36')]=_['keys'](db[_0x85bc('0x31')][_0x85bc('0x32')]);_0x53f6f0[_0x85bc('0x38')]=_[_0x85bc('0x39')](_0x34c720[_0x85bc('0x38')]);_0x53f6f0[_0x85bc('0x3a')]=_[_0x85bc('0x3b')](_0x53f6f0[_0x85bc('0x36')],_0x53f6f0[_0x85bc('0x38')]);_0x5a8a1f[_0x85bc('0x3c')]=_[_0x85bc('0x3b')](_0x53f6f0[_0x85bc('0x36')],qs[_0x85bc('0x3d')](_0x34c720[_0x85bc('0x38')]['fields']));_0x5a8a1f[_0x85bc('0x3c')]=_0x5a8a1f[_0x85bc('0x3c')][_0x85bc('0x3e')]?_0x5a8a1f['attributes']:_0x53f6f0[_0x85bc('0x36')];if(_0x34c720[_0x85bc('0x38')]['includeAll']){_0x5a8a1f[_0x85bc('0x47')]=[{'all':!![]}];}_0x5a8a1f=_[_0x85bc('0x45')]({},_0x5a8a1f,_0x34c720[_0x85bc('0x4c')]);return db[_0x85bc('0x31')]['find'](_0x5a8a1f)['then'](handleEntityNotFound(_0x292b2b,null))[_0x85bc('0x19')](respondWithResult(_0x292b2b,null))['catch'](handleError(_0x292b2b,null));};exports[_0x85bc('0x4d')]=function(_0x42e2c1,_0x479a59,_0x211def){var _0x4df0f3;return db[_0x85bc('0x31')]['create'](_0x42e2c1[_0x85bc('0x4e')],{'raw':!![]})[_0x85bc('0x19')](function(_0x4cce88){_0x4df0f3=_0x4cce88;return db[_0x85bc('0x31')][_0x85bc('0x48')]({'raw':!![]});})[_0x85bc('0x19')](function(_0x47ff55){var _0x1c81c6=fs[_0x85bc('0x4f')](path[_0x85bc('0x50')](config[_0x85bc('0x51')],_0x85bc('0x52')),'utf8');var _0x1e724e=ejs['render'](_0x1c81c6,{'contexts':_0x47ff55||[]});fs[_0x85bc('0x53')](_0x85bc('0x54'),_0x1e724e);})[_0x85bc('0x19')](function(){return respondWithRpcPromise('Reload',_0x85bc('0x4d'),{'module':_0x85bc('0x55')});})[_0x85bc('0x19')](function(){var _0x2bf1ab=_0x42e2c1[_0x85bc('0x56')]['get']({'plain':!![]});if(!_0x2bf1ab)throw new Error(_0x85bc('0x57'));if(_0x2bf1ab['role']===_0x85bc('0x56')){var _0x17e010=_0x4df0f3[_0x85bc('0x58')]({'plain':!![]});return db[_0x85bc('0x59')][_0x85bc('0x5a')]({'where':{'name':_0x85bc('0x2d'),'userProfileId':_0x2bf1ab[_0x85bc('0x5b')]},'raw':!![]})[_0x85bc('0x19')](function(_0x488510){if(_0x488510&&_0x488510[_0x85bc('0x5c')]===0x0){return db[_0x85bc('0x2e')]['create']({'name':_0x17e010[_0x85bc('0x30')],'resourceId':_0x17e010['id'],'type':_0x488510[_0x85bc('0x30')],'sectionId':_0x488510['id']},{})[_0x85bc('0x19')](function(){return _0x4df0f3;});}else{return _0x4df0f3;}})['catch'](function(_0x1ece50){logger['error'](_0x85bc('0x5d'),_0x1ece50);throw _0x1ece50;});}return _0x4df0f3;})[_0x85bc('0x19')](respondWithResult(_0x479a59,0xc9))[_0x85bc('0x5e')](handleError(_0x479a59,null));};exports[_0x85bc('0x2c')]=function(_0x9bc2ff,_0x1a5bf1,_0x17e214){var _0x3a0bbb;return db['VoiceContext']['find']({'where':{'id':_0x9bc2ff[_0x85bc('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1a5bf1,null))['then'](saveUpdates(_0x9bc2ff[_0x85bc('0x4e')],null))[_0x85bc('0x19')](function(_0x3e43c4){if(_0x3e43c4){_0x3a0bbb=_0x3e43c4;return db[_0x85bc('0x31')][_0x85bc('0x48')]({'raw':!![]});}})['then'](function(_0x1c30a1){var _0x2d0993=fs[_0x85bc('0x4f')](path[_0x85bc('0x50')](config[_0x85bc('0x51')],_0x85bc('0x52')),'utf8');var _0x5cca57=ejs[_0x85bc('0x5f')](_0x2d0993,{'contexts':_0x1c30a1||[]});fs[_0x85bc('0x53')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5cca57);})[_0x85bc('0x19')](function(){return respondWithRpcPromise(_0x85bc('0x60'),'update',{'module':'chan_sip.so'});})['then'](function(){return _0x3a0bbb;})['then'](respondWithResult(_0x1a5bf1,null))[_0x85bc('0x5e')](handleError(_0x1a5bf1,null));};exports['destroy']=function(_0x217773,_0x2ca667,_0x309bb3){var _0x2b03b1;return db[_0x85bc('0x31')]['find']({'where':{'id':_0x217773[_0x85bc('0x4b')]['id']}})[_0x85bc('0x19')](handleEntityNotFound(_0x2ca667,null))['then'](removeEntity(_0x2ca667,null))[_0x85bc('0x19')](function(){return db[_0x85bc('0x31')][_0x85bc('0x48')]({'raw':!![]});})['then'](function(_0x3d192b){var _0x112012=fs[_0x85bc('0x4f')](path[_0x85bc('0x50')](config[_0x85bc('0x51')],_0x85bc('0x52')),_0x85bc('0x61'));var _0x1f8c7b=ejs[_0x85bc('0x5f')](_0x112012,{'contexts':_0x3d192b});fs[_0x85bc('0x53')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x1f8c7b);return respondWithRpcPromise('Reload',_0x85bc('0x62'),{'module':'chan_sip.so'});})[_0x85bc('0x5e')](handleError(_0x2ca667,null));}; \ No newline at end of file +var _0xeaf6=['create','body','readFileSync','join','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','writeFileSync','Reload','utf8','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','params','length','options','find'];(function(_0x38040b,_0x2054ae){var _0x344827=function(_0x2ac8d6){while(--_0x2ac8d6){_0x38040b['push'](_0x38040b['shift']());}};_0x344827(++_0x2054ae);}(_0xeaf6,0x7b));var _0x6eaf=function(_0x316045,_0x19f105){_0x316045=_0x316045-0x0;var _0x58c267=_0xeaf6[_0x316045];return _0x58c267;};'use strict';var emlformat=require(_0x6eaf('0x0'));var rimraf=require(_0x6eaf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6eaf('0x2'));var rp=require(_0x6eaf('0x3'));var moment=require(_0x6eaf('0x4'));var BPromise=require(_0x6eaf('0x5'));var Mustache=require(_0x6eaf('0x6'));var util=require(_0x6eaf('0x7'));var path=require(_0x6eaf('0x8'));var sox=require(_0x6eaf('0x9'));var csv=require(_0x6eaf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6eaf('0xb'));var squel=require(_0x6eaf('0xc'));var crypto=require(_0x6eaf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6eaf('0xe'));var toCsv=require(_0x6eaf('0xa'));var querystring=require(_0x6eaf('0xf'));var Papa=require(_0x6eaf('0x10'));var Redis=require(_0x6eaf('0x11'));var authService=require(_0x6eaf('0x12'));var qs=require(_0x6eaf('0x13'));var as=require(_0x6eaf('0x14'));var hardwareService=require(_0x6eaf('0x15'));var logger=require(_0x6eaf('0x16'))(_0x6eaf('0x17'));var utils=require('../../config/utils');var config=require(_0x6eaf('0x18'));var licenseUtil=require(_0x6eaf('0x19'));var db=require(_0x6eaf('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x6eaf('0x1b')][_0x6eaf('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x400ae8,_0x1e5c91,_0x5d633c,_0x5f1167){return new BPromise(function(_0x10e8b4,_0x5910a2){var _0x53e6c7=_0x5f1167||client;return _0x53e6c7['request'](_0x400ae8,_0x5d633c)['then'](function(_0x2da929){logger[_0x6eaf('0x1d')](_0x6eaf('0x1e'),_0x1e5c91,_0x6eaf('0x1f'));logger[_0x6eaf('0x20')](_0x6eaf('0x21'),_0x1e5c91,'request\x20sent',JSON['stringify'](_0x2da929));if(_0x2da929['error']){if(_0x2da929[_0x6eaf('0x22')]['code']===0x1f4){logger[_0x6eaf('0x22')](_0x6eaf('0x1e'),_0x1e5c91,_0x2da929['error'][_0x6eaf('0x23')]);return _0x5910a2(_0x2da929[_0x6eaf('0x22')][_0x6eaf('0x23')]);}logger[_0x6eaf('0x22')](_0x6eaf('0x1e'),_0x1e5c91,_0x2da929[_0x6eaf('0x22')][_0x6eaf('0x23')]);return _0x10e8b4(_0x2da929[_0x6eaf('0x22')][_0x6eaf('0x23')]);}else{logger[_0x6eaf('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x1e5c91,_0x6eaf('0x1f'));_0x10e8b4(_0x2da929[_0x6eaf('0x24')][_0x6eaf('0x23')]);}})[_0x6eaf('0x25')](function(_0x445038){logger[_0x6eaf('0x22')](_0x6eaf('0x1e'),_0x1e5c91,_0x445038);_0x5910a2(_0x445038);});});}function respondWithStatusCode(_0x1f4968,_0x42dc43){_0x42dc43=_0x42dc43||0xcc;return function(_0x270c62){if(_0x270c62){return _0x1f4968[_0x6eaf('0x26')](_0x42dc43);}return _0x1f4968['status'](_0x42dc43)[_0x6eaf('0x27')]();};}function respondWithResult(_0x1ebd21,_0x4076c0){_0x4076c0=_0x4076c0||0xc8;return function(_0x7e0c6c){if(_0x7e0c6c){return _0x1ebd21['status'](_0x4076c0)['json'](_0x7e0c6c);}};}function respondWithFilteredResult(_0x5d8168,_0x50fcf9){return function(_0x89b409){if(_0x89b409){var _0x32f947=typeof _0x50fcf9[_0x6eaf('0x28')]===_0x6eaf('0x29')&&typeof _0x50fcf9[_0x6eaf('0x2a')]===_0x6eaf('0x29');var _0x2e53d5=_0x89b409['count'];var _0x3be3cb=_0x32f947?0x0:_0x50fcf9[_0x6eaf('0x28')];var _0x643cc8=_0x32f947?_0x89b409[_0x6eaf('0x2b')]:_0x50fcf9['offset']+_0x50fcf9['limit'];var _0x58ba7a;if(_0x643cc8>=_0x2e53d5){_0x643cc8=_0x2e53d5;_0x58ba7a=0xc8;}else{_0x58ba7a=0xce;}_0x5d8168[_0x6eaf('0x2c')](_0x58ba7a);return _0x5d8168[_0x6eaf('0x2d')](_0x6eaf('0x2e'),_0x3be3cb+'-'+_0x643cc8+'/'+_0x2e53d5)[_0x6eaf('0x2f')](_0x89b409);}return null;};}function patchUpdates(_0x413a13){return function(_0x2637df){try{jsonpatch[_0x6eaf('0x30')](_0x2637df,_0x413a13,!![]);}catch(_0x244395){return BPromise[_0x6eaf('0x31')](_0x244395);}return _0x2637df[_0x6eaf('0x32')]();};}function saveUpdates(_0x340022,_0x516be2){return function(_0x5f2648){if(_0x5f2648){return _0x5f2648[_0x6eaf('0x33')](_0x340022)[_0x6eaf('0x34')](function(_0x514c5f){return _0x514c5f;});}return null;};}function removeEntity(_0x667874,_0xb418f9){return function(_0x5cd0ad){if(_0x5cd0ad){return _0x5cd0ad[_0x6eaf('0x35')]()[_0x6eaf('0x34')](function(){var _0x280fb3=_0x5cd0ad[_0x6eaf('0x36')]({'plain':!![]});var _0x4e6718=_0x6eaf('0x37');return db[_0x6eaf('0x38')][_0x6eaf('0x35')]({'where':{'type':_0x4e6718,'resourceId':_0x280fb3['id']}})[_0x6eaf('0x34')](function(){return _0x5cd0ad;});})['then'](function(){_0x667874['status'](0xcc)[_0x6eaf('0x27')]();});}};}function handleEntityNotFound(_0x4f1ac4,_0x5263a8){return function(_0x593024){if(!_0x593024){_0x4f1ac4['sendStatus'](0x194);}return _0x593024;};}function handleError(_0x44050a,_0x234b1e){_0x234b1e=_0x234b1e||0x1f4;return function(_0x19e4be){logger[_0x6eaf('0x22')](_0x19e4be[_0x6eaf('0x39')]);if(_0x19e4be[_0x6eaf('0x3a')]){delete _0x19e4be['name'];}_0x44050a[_0x6eaf('0x2c')](_0x234b1e)[_0x6eaf('0x3b')](_0x19e4be);};}exports[_0x6eaf('0x3c')]=function(_0x361986,_0x4b9b61){var _0x76bcc4={},_0xe84f8d={},_0x2776b3={'count':0x0,'rows':[]};var _0x30487a=_[_0x6eaf('0x3d')](db[_0x6eaf('0x3e')][_0x6eaf('0x3f')],function(_0x500fc0){return{'name':_0x500fc0[_0x6eaf('0x40')],'type':_0x500fc0[_0x6eaf('0x41')][_0x6eaf('0x42')]};});_0xe84f8d['model']=_[_0x6eaf('0x3d')](_0x30487a,_0x6eaf('0x3a'));_0xe84f8d[_0x6eaf('0x43')]=_[_0x6eaf('0x44')](_0x361986[_0x6eaf('0x43')]);_0xe84f8d[_0x6eaf('0x45')]=_[_0x6eaf('0x46')](_0xe84f8d['model'],_0xe84f8d[_0x6eaf('0x43')]);_0x76bcc4['attributes']=_[_0x6eaf('0x46')](_0xe84f8d[_0x6eaf('0x47')],qs[_0x6eaf('0x48')](_0x361986['query'][_0x6eaf('0x48')]));_0x76bcc4[_0x6eaf('0x49')]=_0x76bcc4[_0x6eaf('0x49')]['length']?_0x76bcc4['attributes']:_0xe84f8d[_0x6eaf('0x47')];if(!_0x361986[_0x6eaf('0x43')]['hasOwnProperty'](_0x6eaf('0x4a'))){_0x76bcc4[_0x6eaf('0x2a')]=qs[_0x6eaf('0x2a')](_0x361986[_0x6eaf('0x43')]['limit']);_0x76bcc4[_0x6eaf('0x28')]=qs[_0x6eaf('0x28')](_0x361986[_0x6eaf('0x43')][_0x6eaf('0x28')]);}_0x76bcc4[_0x6eaf('0x4b')]=qs[_0x6eaf('0x4c')](_0x361986[_0x6eaf('0x43')][_0x6eaf('0x4c')]);_0x76bcc4[_0x6eaf('0x4d')]=qs['filters'](_[_0x6eaf('0x4e')](_0x361986[_0x6eaf('0x43')],_0xe84f8d[_0x6eaf('0x45')]),_0x30487a);if(_0x361986[_0x6eaf('0x43')][_0x6eaf('0x4f')]){_0x76bcc4[_0x6eaf('0x4d')]=_[_0x6eaf('0x50')](_0x76bcc4['where'],{'$or':_['map'](_0x30487a,function(_0x2825e7){if(_0x2825e7[_0x6eaf('0x41')]!==_0x6eaf('0x51')){var _0x2decf5={};_0x2decf5[_0x2825e7[_0x6eaf('0x3a')]]={'$like':'%'+_0x361986['query'][_0x6eaf('0x4f')]+'%'};return _0x2decf5;}})});}_0x76bcc4=_[_0x6eaf('0x50')]({},_0x76bcc4,_0x361986['options']);var _0x1c23d2={'where':_0x76bcc4[_0x6eaf('0x4d')]};return db['VoiceContext'][_0x6eaf('0x2b')](_0x1c23d2)[_0x6eaf('0x34')](function(_0x37c307){_0x2776b3[_0x6eaf('0x2b')]=_0x37c307;if(_0x361986[_0x6eaf('0x43')][_0x6eaf('0x52')]){_0x76bcc4['include']=[{'all':!![]}];}return db['VoiceContext'][_0x6eaf('0x53')](_0x76bcc4);})[_0x6eaf('0x34')](function(_0x5d7023){_0x2776b3[_0x6eaf('0x54')]=_0x5d7023;return _0x2776b3;})[_0x6eaf('0x34')](respondWithFilteredResult(_0x4b9b61,_0x76bcc4))[_0x6eaf('0x25')](handleError(_0x4b9b61,null));};exports['show']=function(_0x4753dd,_0x40f906){var _0x58670a={'raw':![],'where':{'id':_0x4753dd[_0x6eaf('0x55')]['id']}},_0x4e97c8={};_0x4e97c8[_0x6eaf('0x47')]=_[_0x6eaf('0x44')](db[_0x6eaf('0x3e')][_0x6eaf('0x3f')]);_0x4e97c8['query']=_['keys'](_0x4753dd[_0x6eaf('0x43')]);_0x4e97c8[_0x6eaf('0x45')]=_[_0x6eaf('0x46')](_0x4e97c8['model'],_0x4e97c8[_0x6eaf('0x43')]);_0x58670a[_0x6eaf('0x49')]=_[_0x6eaf('0x46')](_0x4e97c8[_0x6eaf('0x47')],qs['fields'](_0x4753dd[_0x6eaf('0x43')][_0x6eaf('0x48')]));_0x58670a[_0x6eaf('0x49')]=_0x58670a[_0x6eaf('0x49')][_0x6eaf('0x56')]?_0x58670a[_0x6eaf('0x49')]:_0x4e97c8[_0x6eaf('0x47')];if(_0x4753dd[_0x6eaf('0x43')]['includeAll']){_0x58670a['include']=[{'all':!![]}];}_0x58670a=_[_0x6eaf('0x50')]({},_0x58670a,_0x4753dd[_0x6eaf('0x57')]);return db[_0x6eaf('0x3e')][_0x6eaf('0x58')](_0x58670a)[_0x6eaf('0x34')](handleEntityNotFound(_0x40f906,null))[_0x6eaf('0x34')](respondWithResult(_0x40f906,null))[_0x6eaf('0x25')](handleError(_0x40f906,null));};exports[_0x6eaf('0x59')]=function(_0x1597b0,_0x339e4b,_0x5ecf72){var _0x49940d;return db['VoiceContext'][_0x6eaf('0x59')](_0x1597b0[_0x6eaf('0x5a')],{'raw':!![]})[_0x6eaf('0x34')](function(_0x24ed7a){_0x49940d=_0x24ed7a;return db[_0x6eaf('0x3e')][_0x6eaf('0x53')]({'raw':!![]});})[_0x6eaf('0x34')](function(_0x12278e){var _0x4f9817=fs[_0x6eaf('0x5b')](path[_0x6eaf('0x5c')](config['root'],_0x6eaf('0x5d')),'utf8');var _0x1d7a50=ejs[_0x6eaf('0x5e')](_0x4f9817,{'contexts':_0x12278e||[]});fs['writeFileSync'](_0x6eaf('0x5f'),_0x1d7a50);})['then'](function(){return respondWithRpcPromise('Reload',_0x6eaf('0x59'),{'module':_0x6eaf('0x60')});})[_0x6eaf('0x34')](function(){var _0x11fff3=_0x1597b0[_0x6eaf('0x61')]['get']({'plain':!![]});if(!_0x11fff3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11fff3[_0x6eaf('0x62')]==='user'){var _0x57b4a6=_0x49940d[_0x6eaf('0x36')]({'plain':!![]});return db[_0x6eaf('0x63')]['find']({'where':{'name':_0x6eaf('0x37'),'userProfileId':_0x11fff3[_0x6eaf('0x64')]},'raw':!![]})[_0x6eaf('0x34')](function(_0x556946){if(_0x556946&&_0x556946['autoAssociation']===0x0){return db['UserProfileResource'][_0x6eaf('0x59')]({'name':_0x57b4a6[_0x6eaf('0x3a')],'resourceId':_0x57b4a6['id'],'type':_0x556946[_0x6eaf('0x3a')],'sectionId':_0x556946['id']},{})[_0x6eaf('0x34')](function(){return _0x49940d;});}else{return _0x49940d;}})[_0x6eaf('0x25')](function(_0x39cc4d){logger['error'](_0x6eaf('0x65'),_0x39cc4d);throw _0x39cc4d;});}return _0x49940d;})[_0x6eaf('0x34')](respondWithResult(_0x339e4b,0xc9))['catch'](handleError(_0x339e4b,null));};exports[_0x6eaf('0x33')]=function(_0x2f3d8b,_0x2bc42a,_0x4fc002){var _0x5a5ff3;return db[_0x6eaf('0x3e')][_0x6eaf('0x58')]({'where':{'id':_0x2f3d8b[_0x6eaf('0x55')]['id']}})['then'](handleEntityNotFound(_0x2bc42a,null))[_0x6eaf('0x34')](saveUpdates(_0x2f3d8b[_0x6eaf('0x5a')],null))[_0x6eaf('0x34')](function(_0xb3fca6){if(_0xb3fca6){_0x5a5ff3=_0xb3fca6;return db[_0x6eaf('0x3e')][_0x6eaf('0x53')]({'raw':!![]});}})['then'](function(_0x20d78a){var _0x429409=fs[_0x6eaf('0x5b')](path[_0x6eaf('0x5c')](config[_0x6eaf('0x66')],_0x6eaf('0x5d')),'utf8');var _0x170727=ejs['render'](_0x429409,{'contexts':_0x20d78a||[]});fs[_0x6eaf('0x67')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x170727);})[_0x6eaf('0x34')](function(){return respondWithRpcPromise(_0x6eaf('0x68'),_0x6eaf('0x33'),{'module':'chan_sip.so'});})[_0x6eaf('0x34')](function(){return _0x5a5ff3;})[_0x6eaf('0x34')](respondWithResult(_0x2bc42a,null))['catch'](handleError(_0x2bc42a,null));};exports['destroy']=function(_0x4e6d7c,_0x77e61b,_0x52301a){var _0x9e4df7;return db[_0x6eaf('0x3e')]['find']({'where':{'id':_0x4e6d7c['params']['id']}})[_0x6eaf('0x34')](handleEntityNotFound(_0x77e61b,null))[_0x6eaf('0x34')](removeEntity(_0x77e61b,null))[_0x6eaf('0x34')](function(){return db[_0x6eaf('0x3e')]['findAll']({'raw':!![]});})[_0x6eaf('0x34')](function(_0x7b4e08){var _0x44d52c=fs['readFileSync'](path[_0x6eaf('0x5c')](config['root'],_0x6eaf('0x5d')),_0x6eaf('0x69'));var _0x47bd50=ejs[_0x6eaf('0x5e')](_0x44d52c,{'contexts':_0x7b4e08});fs[_0x6eaf('0x67')](_0x6eaf('0x5f'),_0x47bd50);return respondWithRpcPromise('Reload','destroy',{'module':'chan_sip.so'});})[_0x6eaf('0x25')](handleError(_0x77e61b,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 7b202ad..83f1778 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 _0xc0ef=['./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3c994c,_0x56aebc){var _0x1f8b78=function(_0x301942){while(--_0x301942){_0x3c994c['push'](_0x3c994c['shift']());}};_0x1f8b78(++_0x56aebc);}(_0xc0ef,0xee));var _0xfc0e=function(_0x2cb755,_0x33f9e9){_0x2cb755=_0x2cb755-0x0;var _0x2b6af3=_0xc0ef[_0x2cb755];return _0x2b6af3;};'use strict';var _=require(_0xfc0e('0x0'));var util=require(_0xfc0e('0x1'));var logger=require(_0xfc0e('0x2'))(_0xfc0e('0x3'));var moment=require(_0xfc0e('0x4'));var BPromise=require(_0xfc0e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc0e('0x6'));var rimraf=require(_0xfc0e('0x7'));var config=require(_0xfc0e('0x8'));var attributes=require(_0xfc0e('0x9'));module[_0xfc0e('0xa')]=function(_0x3b2cc0,_0x5efd00){return _0x3b2cc0[_0xfc0e('0xb')](_0xfc0e('0xc'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x081c=['./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1471de,_0x1ddf52){var _0x45b4b6=function(_0x4a145d){while(--_0x4a145d){_0x1471de['push'](_0x1471de['shift']());}};_0x45b4b6(++_0x1ddf52);}(_0x081c,0xd7));var _0xc081=function(_0x5ea7a8,_0x257068){_0x5ea7a8=_0x5ea7a8-0x0;var _0x1b2e3a=_0x081c[_0x5ea7a8];return _0x1b2e3a;};'use strict';var _=require(_0xc081('0x0'));var util=require(_0xc081('0x1'));var logger=require(_0xc081('0x2'))(_0xc081('0x3'));var moment=require(_0xc081('0x4'));var BPromise=require(_0xc081('0x5'));var rp=require(_0xc081('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc081('0x7'));var config=require(_0xc081('0x8'));var attributes=require(_0xc081('0x9'));module[_0xc081('0xa')]=function(_0x1f120d,_0x2cbd9d){return _0x1f120d[_0xc081('0xb')](_0xc081('0xc'),attributes,{'tableName':_0xc081('0xd'),'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 cbaa5f6..2726032 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 _0x7ae6=['info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x7ae6,0x94));var _0x67ae=function(_0xac0780,_0xa51501){_0xac0780=_0xac0780-0x0;var _0x182f12=_0x7ae6[_0xac0780];return _0x182f12;};'use strict';var _=require('lodash');var util=require(_0x67ae('0x0'));var moment=require('moment');var BPromise=require(_0x67ae('0x1'));var rs=require(_0x67ae('0x2'));var fs=require('fs');var Redis=require(_0x67ae('0x3'));var db=require(_0x67ae('0x4'))['db'];var utils=require(_0x67ae('0x5'));var logger=require(_0x67ae('0x6'))('rpc');var config=require(_0x67ae('0x7'));var jayson=require(_0x67ae('0x8'));var client=jayson[_0x67ae('0x9')][_0x67ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33bc99,_0x51f7f2,_0x456ca9){return new BPromise(function(_0x460304,_0x2591a1){return client[_0x67ae('0xb')](_0x33bc99,_0x456ca9)[_0x67ae('0xc')](function(_0x11c49a){logger[_0x67ae('0xd')](_0x67ae('0xe'),_0x51f7f2,_0x67ae('0xf'));logger[_0x67ae('0x10')](_0x67ae('0x11'),_0x51f7f2,_0x67ae('0xf'),JSON[_0x67ae('0x12')](_0x11c49a));if(_0x11c49a[_0x67ae('0x13')]){if(_0x11c49a[_0x67ae('0x13')][_0x67ae('0x14')]===0x1f4){logger[_0x67ae('0x13')](_0x67ae('0xe'),_0x51f7f2,_0x11c49a[_0x67ae('0x13')][_0x67ae('0x15')]);return _0x2591a1(_0x11c49a[_0x67ae('0x13')][_0x67ae('0x15')]);}logger[_0x67ae('0x13')](_0x67ae('0xe'),_0x51f7f2,_0x11c49a['error'][_0x67ae('0x15')]);return _0x460304(_0x11c49a[_0x67ae('0x13')][_0x67ae('0x15')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x51f7f2,_0x67ae('0xf'));_0x460304(_0x11c49a['result']['message']);}})[_0x67ae('0x16')](function(_0x2c47f9){logger['error']('VoiceContext,\x20%s,\x20%s',_0x51f7f2,_0x2c47f9);_0x2591a1(_0x2c47f9);});});} \ No newline at end of file +var _0x6244=['../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x386812,_0x27c823){var _0x4704d2=function(_0x513971){while(--_0x513971){_0x386812['push'](_0x386812['shift']());}};_0x4704d2(++_0x27c823);}(_0x6244,0x1ad));var _0x4624=function(_0x54f5fd,_0x202b7d){_0x54f5fd=_0x54f5fd-0x0;var _0x231e28=_0x6244[_0x54f5fd];return _0x231e28;};'use strict';var _=require(_0x4624('0x0'));var util=require(_0x4624('0x1'));var moment=require('moment');var BPromise=require(_0x4624('0x2'));var rs=require(_0x4624('0x3'));var fs=require('fs');var Redis=require(_0x4624('0x4'));var db=require(_0x4624('0x5'))['db'];var utils=require(_0x4624('0x6'));var logger=require('../../config/logger')(_0x4624('0x7'));var config=require(_0x4624('0x8'));var jayson=require(_0x4624('0x9'));var client=jayson[_0x4624('0xa')][_0x4624('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x473fbd,_0x493c0c,_0x44a1c7){return new BPromise(function(_0x4e75b2,_0x25ff64){return client[_0x4624('0xc')](_0x473fbd,_0x44a1c7)[_0x4624('0xd')](function(_0x4e78d5){logger[_0x4624('0xe')](_0x4624('0xf'),_0x493c0c,_0x4624('0x10'));logger[_0x4624('0x11')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x493c0c,_0x4624('0x10'),JSON[_0x4624('0x12')](_0x4e78d5));if(_0x4e78d5[_0x4624('0x13')]){if(_0x4e78d5['error'][_0x4624('0x14')]===0x1f4){logger[_0x4624('0x13')](_0x4624('0xf'),_0x493c0c,_0x4e78d5[_0x4624('0x13')][_0x4624('0x15')]);return _0x25ff64(_0x4e78d5[_0x4624('0x13')][_0x4624('0x15')]);}logger[_0x4624('0x13')](_0x4624('0xf'),_0x493c0c,_0x4e78d5['error'][_0x4624('0x15')]);return _0x4e75b2(_0x4e78d5['error']['message']);}else{logger['info'](_0x4624('0xf'),_0x493c0c,'request\x20sent');_0x4e75b2(_0x4e78d5[_0x4624('0x16')][_0x4624('0x15')]);}})['catch'](function(_0x2785f8){logger[_0x4624('0x13')](_0x4624('0xf'),_0x493c0c,_0x2785f8);_0x25ff64(_0x2785f8);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 73979d4..4ad7a9c 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 _0x010f=['./voiceDialReport.controller','get','/describe','isAuthenticated','/:id','show','post','put','update','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0x764874,_0x3ed544){var _0x29f9d5=function(_0x152dad){while(--_0x152dad){_0x764874['push'](_0x764874['shift']());}};_0x29f9d5(++_0x3ed544);}(_0x010f,0xa4));var _0xf010=function(_0x595590,_0x14d83a){_0x595590=_0x595590-0x0;var _0x33988d=_0x010f[_0x595590];return _0x33988d;};'use strict';var multer=require('multer');var util=require(_0xf010('0x0'));var path=require(_0xf010('0x1'));var timeout=require('connect-timeout');var express=require(_0xf010('0x2'));var router=express[_0xf010('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf010('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf010('0x5'));var controller=require(_0xf010('0x6'));router[_0xf010('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf010('0x7')](_0xf010('0x8'),auth[_0xf010('0x9')](),controller['describe']);router[_0xf010('0x7')](_0xf010('0xa'),auth[_0xf010('0x9')](),controller[_0xf010('0xb')]);router[_0xf010('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf010('0xd')](_0xf010('0xa'),auth[_0xf010('0x9')](),controller[_0xf010('0xe')]);router['delete'](_0xf010('0xa'),auth['isAuthenticated'](),controller[_0xf010('0xf')]);module[_0xf010('0x10')]=router; \ No newline at end of file +var _0xfd4f=['create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','index','get','/describe','isAuthenticated','post'];(function(_0x52dbc3,_0x44998e){var _0x34615a=function(_0x46b55b){while(--_0x46b55b){_0x52dbc3['push'](_0x52dbc3['shift']());}};_0x34615a(++_0x44998e);}(_0xfd4f,0x133));var _0xffd4=function(_0x125b31,_0x4419b2){_0x125b31=_0x125b31-0x0;var _0x36ec43=_0xfd4f[_0x125b31];return _0x36ec43;};'use strict';var multer=require(_0xffd4('0x0'));var util=require(_0xffd4('0x1'));var path=require(_0xffd4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xffd4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xffd4('0x4'));var interaction=require(_0xffd4('0x5'));var config=require(_0xffd4('0x6'));var controller=require(_0xffd4('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xffd4('0x8')]);router[_0xffd4('0x9')](_0xffd4('0xa'),auth[_0xffd4('0xb')](),controller['describe']);router[_0xffd4('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xffd4('0xc')]('/',auth[_0xffd4('0xb')](),controller[_0xffd4('0xd')]);router[_0xffd4('0xe')](_0xffd4('0xf'),auth[_0xffd4('0xb')](),controller[_0xffd4('0x10')]);router[_0xffd4('0x11')](_0xffd4('0xf'),auth[_0xffd4('0xb')](),controller[_0xffd4('0x12')]);module[_0xffd4('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index d61c965..209ff12 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 _0xf2ca=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x2f09fa,_0x187337){var _0x2bca7a=function(_0x5341a1){while(--_0x5341a1){_0x2f09fa['push'](_0x2f09fa['shift']());}};_0x2bca7a(++_0x187337);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xf2ca[_0x5f309e];return _0x487b5e;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'privilege':{'type':Sequelize[_0xaf2c('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xaf2c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaf2c('0x2')]},'calleridnum':{'type':Sequelize[_0xaf2c('0x2')]},'calleridname':{'type':Sequelize[_0xaf2c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaf2c('0x2')]},'connectedlinename':{'type':Sequelize[_0xaf2c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xaf2c('0x2')]},'context':{'type':Sequelize[_0xaf2c('0x2')]},'exten':{'type':Sequelize[_0xaf2c('0x2')]},'priority':{'type':Sequelize[_0xaf2c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xaf2c('0x2')]},'destchannel':{'type':Sequelize[_0xaf2c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xaf2c('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xaf2c('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xaf2c('0x2')]},'destlanguage':{'type':Sequelize[_0xaf2c('0x2')]},'destaccountcode':{'type':Sequelize[_0xaf2c('0x2')]},'destcontext':{'type':Sequelize[_0xaf2c('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'destlinkedid':{'type':Sequelize[_0xaf2c('0x2')]},'dialstring':{'type':Sequelize[_0xaf2c('0x2')]},'dialstatus':{'type':Sequelize[_0xaf2c('0x2')]},'starttime':{'type':Sequelize[_0xaf2c('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xaf2c('0x2')],'comment':_0xaf2c('0x5')},'routeId':{'type':Sequelize[_0xaf2c('0x3')]},'duration':{'type':Sequelize[_0xaf2c('0x3')]},'holdtime':{'type':Sequelize[_0xaf2c('0x3')]},'billableseconds':{'type':Sequelize[_0xaf2c('0x3')]}}; \ No newline at end of file +var _0x9c44=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0x49c4('0x0')]},'channel':{'type':Sequelize[_0x49c4('0x0')]},'channelstate':{'type':Sequelize[_0x49c4('0x1')]},'channelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'calleridnum':{'type':Sequelize[_0x49c4('0x0')]},'calleridname':{'type':Sequelize[_0x49c4('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x49c4('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x49c4('0x0')]},'exten':{'type':Sequelize[_0x49c4('0x0')]},'priority':{'type':Sequelize[_0x49c4('0x1')]},'uniqueid':{'type':Sequelize[_0x49c4('0x0')]},'linkedid':{'type':Sequelize[_0x49c4('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x49c4('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridnum':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridname':{'type':Sequelize[_0x49c4('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x49c4('0x0')]},'destaccountcode':{'type':Sequelize[_0x49c4('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x49c4('0x0')]},'destpriority':{'type':Sequelize[_0x49c4('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x49c4('0x0')]},'dialstatus':{'type':Sequelize[_0x49c4('0x0')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x49c4('0x2')]},'endtime':{'type':Sequelize[_0x49c4('0x2')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x49c4('0x3')},'routeId':{'type':Sequelize[_0x49c4('0x1')]},'duration':{'type':Sequelize[_0x49c4('0x1')]},'holdtime':{'type':Sequelize[_0x49c4('0x1')]},'billableseconds':{'type':Sequelize[_0x49c4('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 1ad3673..ed7bd77 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 _0x8fc3=['where','filters','pick','filter','merge','type','includeAll','include','findAll','options','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort'];(function(_0x363725,_0x1eee67){var _0x6af43b=function(_0x3c2a3e){while(--_0x3c2a3e){_0x363725['push'](_0x363725['shift']());}};_0x6af43b(++_0x1eee67);}(_0x8fc3,0x128));var _0x38fc=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0x8fc3[_0x1f7839];return _0x36b42e;};'use strict';var emlformat=require(_0x38fc('0x0'));var rimraf=require(_0x38fc('0x1'));var zipdir=require(_0x38fc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x38fc('0x3'));var BPromise=require(_0x38fc('0x4'));var Mustache=require(_0x38fc('0x5'));var util=require('util');var path=require('path');var sox=require(_0x38fc('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38fc('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x38fc('0x8'));var deskjs=require(_0x38fc('0x9'));var toCsv=require(_0x38fc('0xa'));var querystring=require(_0x38fc('0xb'));var Papa=require(_0x38fc('0xc'));var Redis=require(_0x38fc('0xd'));var authService=require(_0x38fc('0xe'));var qs=require(_0x38fc('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x38fc('0x10'))('api');var utils=require(_0x38fc('0x11'));var config=require(_0x38fc('0x12'));var licenseUtil=require(_0x38fc('0x13'));var db=require(_0x38fc('0x14'))['db'];function respondWithStatusCode(_0x18d8bd,_0x344165){_0x344165=_0x344165||0xcc;return function(_0x486871){if(_0x486871){return _0x18d8bd[_0x38fc('0x15')](_0x344165);}return _0x18d8bd[_0x38fc('0x16')](_0x344165)[_0x38fc('0x17')]();};}function respondWithResult(_0x2c2813,_0x249b91){_0x249b91=_0x249b91||0xc8;return function(_0x1e92fb){if(_0x1e92fb){return _0x2c2813[_0x38fc('0x16')](_0x249b91)[_0x38fc('0x18')](_0x1e92fb);}};}function respondWithFilteredResult(_0x4c16f0,_0x5273ce){return function(_0x49aedf){if(_0x49aedf){var _0x539aa8=typeof _0x5273ce[_0x38fc('0x19')]===_0x38fc('0x1a')&&typeof _0x5273ce['limit']==='undefined';var _0x86ec11=_0x49aedf[_0x38fc('0x1b')];var _0x2b88fb=_0x539aa8?0x0:_0x5273ce[_0x38fc('0x19')];var _0x5b8513=_0x539aa8?_0x49aedf[_0x38fc('0x1b')]:_0x5273ce[_0x38fc('0x19')]+_0x5273ce['limit'];var _0x5ae118;if(_0x5b8513>=_0x86ec11){_0x5b8513=_0x86ec11;_0x5ae118=0xc8;}else{_0x5ae118=0xce;}_0x4c16f0[_0x38fc('0x16')](_0x5ae118);return _0x4c16f0[_0x38fc('0x1c')](_0x38fc('0x1d'),_0x2b88fb+'-'+_0x5b8513+'/'+_0x86ec11)[_0x38fc('0x18')](_0x49aedf);}return null;};}function patchUpdates(_0x5a88ac){return function(_0x3a1c4a){try{jsonpatch['apply'](_0x3a1c4a,_0x5a88ac,!![]);}catch(_0x1c9824){return BPromise['reject'](_0x1c9824);}return _0x3a1c4a[_0x38fc('0x1e')]();};}function saveUpdates(_0x90f4b8,_0x12f3a7){return function(_0x4f8072){if(_0x4f8072){return _0x4f8072[_0x38fc('0x1f')](_0x90f4b8)[_0x38fc('0x20')](function(_0xabe012){return _0xabe012;});}return null;};}function removeEntity(_0x52bfd0,_0x4a62d5){return function(_0x1e2539){if(_0x1e2539){return _0x1e2539[_0x38fc('0x21')]()[_0x38fc('0x20')](function(){_0x52bfd0[_0x38fc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4776c3,_0x46b051){return function(_0x304b1e){if(!_0x304b1e){_0x4776c3[_0x38fc('0x15')](0x194);}return _0x304b1e;};}function handleError(_0x2be891,_0xe3c3e5){_0xe3c3e5=_0xe3c3e5||0x1f4;return function(_0x3966bf){logger[_0x38fc('0x22')](_0x3966bf[_0x38fc('0x23')]);if(_0x3966bf[_0x38fc('0x24')]){delete _0x3966bf[_0x38fc('0x24')];}_0x2be891[_0x38fc('0x16')](_0xe3c3e5)['send'](_0x3966bf);};}exports[_0x38fc('0x25')]=function(_0x3d54cd,_0x554a89){var _0x21b63e={},_0x22f8ea={},_0x416f7c={'count':0x0,'rows':[]};var _0x5b99c2=_[_0x38fc('0x26')](db[_0x38fc('0x27')][_0x38fc('0x28')],function(_0x59652d){return{'name':_0x59652d[_0x38fc('0x29')],'type':_0x59652d['type'][_0x38fc('0x2a')]};});_0x22f8ea[_0x38fc('0x2b')]=_[_0x38fc('0x26')](_0x5b99c2,_0x38fc('0x24'));_0x22f8ea[_0x38fc('0x2c')]=_[_0x38fc('0x2d')](_0x3d54cd[_0x38fc('0x2c')]);_0x22f8ea['filters']=_['intersection'](_0x22f8ea[_0x38fc('0x2b')],_0x22f8ea[_0x38fc('0x2c')]);_0x21b63e[_0x38fc('0x2e')]=_[_0x38fc('0x2f')](_0x22f8ea[_0x38fc('0x2b')],qs['fields'](_0x3d54cd[_0x38fc('0x2c')][_0x38fc('0x30')]));_0x21b63e['attributes']=_0x21b63e[_0x38fc('0x2e')][_0x38fc('0x31')]?_0x21b63e[_0x38fc('0x2e')]:_0x22f8ea[_0x38fc('0x2b')];if(!_0x3d54cd[_0x38fc('0x2c')][_0x38fc('0x32')]('nolimit')){_0x21b63e[_0x38fc('0x33')]=qs[_0x38fc('0x33')](_0x3d54cd['query'][_0x38fc('0x33')]);_0x21b63e[_0x38fc('0x19')]=qs[_0x38fc('0x19')](_0x3d54cd[_0x38fc('0x2c')]['offset']);}_0x21b63e[_0x38fc('0x34')]=qs[_0x38fc('0x35')](_0x3d54cd['query'][_0x38fc('0x35')]);_0x21b63e[_0x38fc('0x36')]=qs[_0x38fc('0x37')](_[_0x38fc('0x38')](_0x3d54cd[_0x38fc('0x2c')],_0x22f8ea[_0x38fc('0x37')]),_0x5b99c2);if(_0x3d54cd[_0x38fc('0x2c')][_0x38fc('0x39')]){_0x21b63e['where']=_[_0x38fc('0x3a')](_0x21b63e[_0x38fc('0x36')],{'$or':_[_0x38fc('0x26')](_0x5b99c2,function(_0x474f0c){if(_0x474f0c[_0x38fc('0x3b')]!=='VIRTUAL'){var _0x3bdd46={};_0x3bdd46[_0x474f0c[_0x38fc('0x24')]]={'$like':'%'+_0x3d54cd['query'][_0x38fc('0x39')]+'%'};return _0x3bdd46;}})});}_0x21b63e=_[_0x38fc('0x3a')]({},_0x21b63e,_0x3d54cd['options']);var _0x20bf02={'where':_0x21b63e[_0x38fc('0x36')]};return db['VoiceDialReport'][_0x38fc('0x1b')](_0x20bf02)[_0x38fc('0x20')](function(_0x4ad986){_0x416f7c[_0x38fc('0x1b')]=_0x4ad986;if(_0x3d54cd[_0x38fc('0x2c')][_0x38fc('0x3c')]){_0x21b63e[_0x38fc('0x3d')]=[{'all':!![]}];}return db[_0x38fc('0x27')][_0x38fc('0x3e')](_0x21b63e);})[_0x38fc('0x20')](function(_0x3af5a3){_0x416f7c['rows']=_0x3af5a3;return _0x416f7c;})['then'](respondWithFilteredResult(_0x554a89,_0x21b63e))['catch'](handleError(_0x554a89,null));};exports['show']=function(_0x41f21f,_0x5d199b){var _0x355242={'raw':!![],'where':{'id':_0x41f21f['params']['id']}},_0xb6d2b6={};_0xb6d2b6['model']=_[_0x38fc('0x2d')](db['VoiceDialReport']['rawAttributes']);_0xb6d2b6[_0x38fc('0x2c')]=_[_0x38fc('0x2d')](_0x41f21f[_0x38fc('0x2c')]);_0xb6d2b6[_0x38fc('0x37')]=_['intersection'](_0xb6d2b6[_0x38fc('0x2b')],_0xb6d2b6[_0x38fc('0x2c')]);_0x355242[_0x38fc('0x2e')]=_['intersection'](_0xb6d2b6[_0x38fc('0x2b')],qs[_0x38fc('0x30')](_0x41f21f[_0x38fc('0x2c')][_0x38fc('0x30')]));_0x355242[_0x38fc('0x2e')]=_0x355242['attributes'][_0x38fc('0x31')]?_0x355242[_0x38fc('0x2e')]:_0xb6d2b6['model'];if(_0x41f21f[_0x38fc('0x2c')][_0x38fc('0x3c')]){_0x355242[_0x38fc('0x3d')]=[{'all':!![]}];}_0x355242=_['merge']({},_0x355242,_0x41f21f[_0x38fc('0x3f')]);return db['VoiceDialReport'][_0x38fc('0x40')](_0x355242)[_0x38fc('0x20')](handleEntityNotFound(_0x5d199b,null))[_0x38fc('0x20')](respondWithResult(_0x5d199b,null))[_0x38fc('0x41')](handleError(_0x5d199b,null));};exports['create']=function(_0x1795b5,_0x2aa120){return db[_0x38fc('0x27')][_0x38fc('0x42')](_0x1795b5['body'],{})[_0x38fc('0x20')](respondWithResult(_0x2aa120,0xc9))[_0x38fc('0x41')](handleError(_0x2aa120,null));};exports[_0x38fc('0x1f')]=function(_0x3afbf3,_0x4f9dd3){if(_0x3afbf3[_0x38fc('0x43')]['id']){delete _0x3afbf3[_0x38fc('0x43')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x3afbf3[_0x38fc('0x44')]['id']}})[_0x38fc('0x20')](handleEntityNotFound(_0x4f9dd3,null))[_0x38fc('0x20')](saveUpdates(_0x3afbf3['body'],null))['then'](respondWithResult(_0x4f9dd3,null))[_0x38fc('0x41')](handleError(_0x4f9dd3,null));};exports[_0x38fc('0x21')]=function(_0xde703b,_0x79842d){return db[_0x38fc('0x27')][_0x38fc('0x40')]({'where':{'id':_0xde703b[_0x38fc('0x44')]['id']}})[_0x38fc('0x20')](handleEntityNotFound(_0x79842d,null))['then'](removeEntity(_0x79842d,null))[_0x38fc('0x41')](handleError(_0x79842d,null));};exports[_0x38fc('0x45')]=function(_0x26b73b,_0x35c69c){return db[_0x38fc('0x27')][_0x38fc('0x45')]()[_0x38fc('0x20')](respondWithResult(_0x35c69c,null))[_0x38fc('0x41')](handleError(_0x35c69c,null));}; \ No newline at end of file +var _0x58cb=['to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','error','name','send','index','VoiceDialReport','rawAttributes','fieldName','type','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','options','includeAll','rows','catch','show','params','model','include','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js'];(function(_0x45eaca,_0x4e991e){var _0x213a3f=function(_0x34e9d4){while(--_0x34e9d4){_0x45eaca['push'](_0x45eaca['shift']());}};_0x213a3f(++_0x4e991e);}(_0x58cb,0x81));var _0xb58c=function(_0x134c4f,_0x3036fb){_0x134c4f=_0x134c4f-0x0;var _0x78dd46=_0x58cb[_0x134c4f];return _0x78dd46;};'use strict';var emlformat=require(_0xb58c('0x0'));var rimraf=require(_0xb58c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb58c('0x2'));var rp=require(_0xb58c('0x3'));var moment=require(_0xb58c('0x4'));var BPromise=require(_0xb58c('0x5'));var Mustache=require(_0xb58c('0x6'));var util=require(_0xb58c('0x7'));var path=require(_0xb58c('0x8'));var sox=require(_0xb58c('0x9'));var csv=require('to-csv');var ejs=require(_0xb58c('0xa'));var fs=require('fs');var fs_extra=require(_0xb58c('0xb'));var _=require(_0xb58c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb58c('0xd'));var deskjs=require(_0xb58c('0xe'));var toCsv=require(_0xb58c('0xf'));var querystring=require(_0xb58c('0x10'));var Papa=require('papaparse');var Redis=require(_0xb58c('0x11'));var authService=require(_0xb58c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb58c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb58c('0x14'));var utils=require('../../config/utils');var config=require(_0xb58c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb58c('0x16'))['db'];function respondWithStatusCode(_0xf790e8,_0x476d8d){_0x476d8d=_0x476d8d||0xcc;return function(_0x3b626c){if(_0x3b626c){return _0xf790e8[_0xb58c('0x17')](_0x476d8d);}return _0xf790e8['status'](_0x476d8d)[_0xb58c('0x18')]();};}function respondWithResult(_0x26ce1c,_0x26134f){_0x26134f=_0x26134f||0xc8;return function(_0x1f11aa){if(_0x1f11aa){return _0x26ce1c['status'](_0x26134f)[_0xb58c('0x19')](_0x1f11aa);}};}function respondWithFilteredResult(_0x419778,_0x4a7699){return function(_0x12d9f0){if(_0x12d9f0){var _0x47a303=typeof _0x4a7699[_0xb58c('0x1a')]==='undefined'&&typeof _0x4a7699['limit']===_0xb58c('0x1b');var _0x237e29=_0x12d9f0[_0xb58c('0x1c')];var _0x192635=_0x47a303?0x0:_0x4a7699[_0xb58c('0x1a')];var _0x8504c5=_0x47a303?_0x12d9f0[_0xb58c('0x1c')]:_0x4a7699[_0xb58c('0x1a')]+_0x4a7699[_0xb58c('0x1d')];var _0x52fdae;if(_0x8504c5>=_0x237e29){_0x8504c5=_0x237e29;_0x52fdae=0xc8;}else{_0x52fdae=0xce;}_0x419778[_0xb58c('0x1e')](_0x52fdae);return _0x419778[_0xb58c('0x1f')](_0xb58c('0x20'),_0x192635+'-'+_0x8504c5+'/'+_0x237e29)[_0xb58c('0x19')](_0x12d9f0);}return null;};}function patchUpdates(_0x2ffae8){return function(_0x5458fc){try{jsonpatch[_0xb58c('0x21')](_0x5458fc,_0x2ffae8,!![]);}catch(_0x4d2dd0){return BPromise[_0xb58c('0x22')](_0x4d2dd0);}return _0x5458fc[_0xb58c('0x23')]();};}function saveUpdates(_0x5b90aa,_0x3e736a){return function(_0x539020){if(_0x539020){return _0x539020[_0xb58c('0x24')](_0x5b90aa)[_0xb58c('0x25')](function(_0x21a409){return _0x21a409;});}return null;};}function removeEntity(_0x31b8de,_0x7c15fd){return function(_0xc81f14){if(_0xc81f14){return _0xc81f14['destroy']()[_0xb58c('0x25')](function(){_0x31b8de['status'](0xcc)[_0xb58c('0x18')]();});}};}function handleEntityNotFound(_0x5c2adb,_0x264395){return function(_0x3fb705){if(!_0x3fb705){_0x5c2adb[_0xb58c('0x17')](0x194);}return _0x3fb705;};}function handleError(_0x505e92,_0x1e27d3){_0x1e27d3=_0x1e27d3||0x1f4;return function(_0xf1d8aa){logger[_0xb58c('0x26')](_0xf1d8aa['stack']);if(_0xf1d8aa[_0xb58c('0x27')]){delete _0xf1d8aa[_0xb58c('0x27')];}_0x505e92[_0xb58c('0x1e')](_0x1e27d3)[_0xb58c('0x28')](_0xf1d8aa);};}exports[_0xb58c('0x29')]=function(_0x2434f2,_0x1ee3a3){var _0x2b3c8d={},_0xa0cda8={},_0x502f1d={'count':0x0,'rows':[]};var _0x37b49e=_['map'](db[_0xb58c('0x2a')][_0xb58c('0x2b')],function(_0x565728){return{'name':_0x565728[_0xb58c('0x2c')],'type':_0x565728[_0xb58c('0x2d')]['key']};});_0xa0cda8['model']=_[_0xb58c('0x2e')](_0x37b49e,_0xb58c('0x27'));_0xa0cda8[_0xb58c('0x2f')]=_[_0xb58c('0x30')](_0x2434f2['query']);_0xa0cda8[_0xb58c('0x31')]=_[_0xb58c('0x32')](_0xa0cda8['model'],_0xa0cda8[_0xb58c('0x2f')]);_0x2b3c8d[_0xb58c('0x33')]=_['intersection'](_0xa0cda8['model'],qs[_0xb58c('0x34')](_0x2434f2['query'][_0xb58c('0x34')]));_0x2b3c8d['attributes']=_0x2b3c8d[_0xb58c('0x33')]['length']?_0x2b3c8d[_0xb58c('0x33')]:_0xa0cda8['model'];if(!_0x2434f2['query'][_0xb58c('0x35')]('nolimit')){_0x2b3c8d['limit']=qs['limit'](_0x2434f2[_0xb58c('0x2f')][_0xb58c('0x1d')]);_0x2b3c8d['offset']=qs[_0xb58c('0x1a')](_0x2434f2[_0xb58c('0x2f')][_0xb58c('0x1a')]);}_0x2b3c8d['order']=qs[_0xb58c('0x36')](_0x2434f2[_0xb58c('0x2f')]['sort']);_0x2b3c8d['where']=qs['filters'](_[_0xb58c('0x37')](_0x2434f2['query'],_0xa0cda8['filters']),_0x37b49e);if(_0x2434f2['query'][_0xb58c('0x38')]){_0x2b3c8d[_0xb58c('0x39')]=_[_0xb58c('0x3a')](_0x2b3c8d['where'],{'$or':_['map'](_0x37b49e,function(_0xa57654){if(_0xa57654[_0xb58c('0x2d')]!=='VIRTUAL'){var _0x5d6468={};_0x5d6468[_0xa57654[_0xb58c('0x27')]]={'$like':'%'+_0x2434f2[_0xb58c('0x2f')][_0xb58c('0x38')]+'%'};return _0x5d6468;}})});}_0x2b3c8d=_[_0xb58c('0x3a')]({},_0x2b3c8d,_0x2434f2[_0xb58c('0x3b')]);var _0x2015fb={'where':_0x2b3c8d[_0xb58c('0x39')]};return db[_0xb58c('0x2a')][_0xb58c('0x1c')](_0x2015fb)[_0xb58c('0x25')](function(_0x21ffa8){_0x502f1d[_0xb58c('0x1c')]=_0x21ffa8;if(_0x2434f2[_0xb58c('0x2f')][_0xb58c('0x3c')]){_0x2b3c8d['include']=[{'all':!![]}];}return db[_0xb58c('0x2a')]['findAll'](_0x2b3c8d);})['then'](function(_0x54c2a1){_0x502f1d[_0xb58c('0x3d')]=_0x54c2a1;return _0x502f1d;})[_0xb58c('0x25')](respondWithFilteredResult(_0x1ee3a3,_0x2b3c8d))[_0xb58c('0x3e')](handleError(_0x1ee3a3,null));};exports[_0xb58c('0x3f')]=function(_0x412f22,_0xc1d720){var _0x56fbd6={'raw':!![],'where':{'id':_0x412f22[_0xb58c('0x40')]['id']}},_0x300c7d={};_0x300c7d[_0xb58c('0x41')]=_[_0xb58c('0x30')](db[_0xb58c('0x2a')][_0xb58c('0x2b')]);_0x300c7d[_0xb58c('0x2f')]=_['keys'](_0x412f22[_0xb58c('0x2f')]);_0x300c7d[_0xb58c('0x31')]=_[_0xb58c('0x32')](_0x300c7d[_0xb58c('0x41')],_0x300c7d[_0xb58c('0x2f')]);_0x56fbd6[_0xb58c('0x33')]=_[_0xb58c('0x32')](_0x300c7d['model'],qs[_0xb58c('0x34')](_0x412f22[_0xb58c('0x2f')][_0xb58c('0x34')]));_0x56fbd6[_0xb58c('0x33')]=_0x56fbd6[_0xb58c('0x33')]['length']?_0x56fbd6[_0xb58c('0x33')]:_0x300c7d[_0xb58c('0x41')];if(_0x412f22[_0xb58c('0x2f')][_0xb58c('0x3c')]){_0x56fbd6[_0xb58c('0x42')]=[{'all':!![]}];}_0x56fbd6=_[_0xb58c('0x3a')]({},_0x56fbd6,_0x412f22['options']);return db[_0xb58c('0x2a')][_0xb58c('0x43')](_0x56fbd6)[_0xb58c('0x25')](handleEntityNotFound(_0xc1d720,null))[_0xb58c('0x25')](respondWithResult(_0xc1d720,null))['catch'](handleError(_0xc1d720,null));};exports[_0xb58c('0x44')]=function(_0x4c49bb,_0x59930e){return db['VoiceDialReport'][_0xb58c('0x44')](_0x4c49bb[_0xb58c('0x45')],{})['then'](respondWithResult(_0x59930e,0xc9))[_0xb58c('0x3e')](handleError(_0x59930e,null));};exports['update']=function(_0x95740b,_0x198b7e){if(_0x95740b['body']['id']){delete _0x95740b['body']['id'];}return db[_0xb58c('0x2a')][_0xb58c('0x43')]({'where':{'id':_0x95740b['params']['id']}})[_0xb58c('0x25')](handleEntityNotFound(_0x198b7e,null))['then'](saveUpdates(_0x95740b[_0xb58c('0x45')],null))[_0xb58c('0x25')](respondWithResult(_0x198b7e,null))[_0xb58c('0x3e')](handleError(_0x198b7e,null));};exports[_0xb58c('0x46')]=function(_0x5a4fae,_0x595f6a){return db[_0xb58c('0x2a')][_0xb58c('0x43')]({'where':{'id':_0x5a4fae[_0xb58c('0x40')]['id']}})[_0xb58c('0x25')](handleEntityNotFound(_0x595f6a,null))['then'](removeEntity(_0x595f6a,null))['catch'](handleError(_0x595f6a,null));};exports[_0xb58c('0x47')]=function(_0x14ff51,_0x262515){return db['VoiceDialReport'][_0xb58c('0x47')]()['then'](respondWithResult(_0x262515,null))[_0xb58c('0x3e')](handleError(_0x262515,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index a6deb53..d3e7289 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 _0x5dbc=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','report_dial','lodash'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x5dbc,0x16a));var _0xc5db=function(_0x2d1ce1,_0x18f04c){_0x2d1ce1=_0x2d1ce1-0x0;var _0x44243d=_0x5dbc[_0x2d1ce1];return _0x44243d;};'use strict';var _=require(_0xc5db('0x0'));var util=require('util');var logger=require(_0xc5db('0x1'))(_0xc5db('0x2'));var moment=require(_0xc5db('0x3'));var BPromise=require(_0xc5db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc5db('0x5'));var config=require(_0xc5db('0x6'));var attributes=require(_0xc5db('0x7'));module[_0xc5db('0x8')]=function(_0x3e85bd,_0x1e7408){return _0x3e85bd['define'](_0xc5db('0x9'),attributes,{'tableName':_0xc5db('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4944=['exports','define','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceDialReport.attributes'];(function(_0x10bb32,_0x3970a2){var _0x2fd0eb=function(_0x190669){while(--_0x190669){_0x10bb32['push'](_0x10bb32['shift']());}};_0x2fd0eb(++_0x3970a2);}(_0x4944,0x6d));var _0x4494=function(_0x2f1a1b,_0xb5769){_0x2f1a1b=_0x2f1a1b-0x0;var _0x5cd5c9=_0x4944[_0x2f1a1b];return _0x5cd5c9;};'use strict';var _=require(_0x4494('0x0'));var util=require('util');var logger=require(_0x4494('0x1'))(_0x4494('0x2'));var moment=require(_0x4494('0x3'));var BPromise=require(_0x4494('0x4'));var rp=require(_0x4494('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4494('0x6'));var config=require('../../config/environment');var attributes=require(_0x4494('0x7'));module[_0x4494('0x8')]=function(_0x38480d,_0xb94d02){return _0x38480d[_0x4494('0x9')](_0x4494('0xa'),attributes,{'tableName':_0x4494('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4494('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 8080262..c803520 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 _0xd4a5=['../../config/utils','../../config/logger','rpc','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','create','body','options','CreateVoiceDialReport','UpdateVoiceDialReport','VoiceDialReport','update','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b7a20,_0x470a22){var _0x302aa4=function(_0x23d637){while(--_0x23d637){_0x4b7a20['push'](_0x4b7a20['shift']());}};_0x302aa4(++_0x470a22);}(_0xd4a5,0xc5));var _0x5d4a=function(_0x47645c,_0x256804){_0x47645c=_0x47645c-0x0;var _0x406b5e=_0xd4a5[_0x47645c];return _0x406b5e;};'use strict';var _=require(_0x5d4a('0x0'));var util=require(_0x5d4a('0x1'));var moment=require(_0x5d4a('0x2'));var BPromise=require(_0x5d4a('0x3'));var rs=require(_0x5d4a('0x4'));var fs=require('fs');var Redis=require(_0x5d4a('0x5'));var db=require(_0x5d4a('0x6'))['db'];var utils=require(_0x5d4a('0x7'));var logger=require(_0x5d4a('0x8'))(_0x5d4a('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5d4a('0xa')][_0x5d4a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x531031,_0x44eaa5,_0x57d693){return new BPromise(function(_0x222ada,_0x29e402){return client[_0x5d4a('0xc')](_0x531031,_0x57d693)[_0x5d4a('0xd')](function(_0x1b8a72){logger[_0x5d4a('0xe')](_0x5d4a('0xf'),_0x44eaa5,_0x5d4a('0x10'));logger[_0x5d4a('0x11')](_0x5d4a('0x12'),_0x44eaa5,_0x5d4a('0x10'),JSON[_0x5d4a('0x13')](_0x1b8a72));if(_0x1b8a72[_0x5d4a('0x14')]){if(_0x1b8a72['error'][_0x5d4a('0x15')]===0x1f4){logger[_0x5d4a('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x44eaa5,_0x1b8a72[_0x5d4a('0x14')][_0x5d4a('0x16')]);return _0x29e402(_0x1b8a72[_0x5d4a('0x14')][_0x5d4a('0x16')]);}logger['error'](_0x5d4a('0xf'),_0x44eaa5,_0x1b8a72[_0x5d4a('0x14')][_0x5d4a('0x16')]);return _0x222ada(_0x1b8a72[_0x5d4a('0x14')][_0x5d4a('0x16')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x44eaa5,'request\x20sent');_0x222ada(_0x1b8a72[_0x5d4a('0x17')]['message']);}})['catch'](function(_0x2c1ada){logger[_0x5d4a('0x14')](_0x5d4a('0xf'),_0x44eaa5,_0x2c1ada);_0x29e402(_0x2c1ada);});});}exports['CreateVoiceDialReport']=function(_0x3e64ee){var _0x3d73a2=this;return new Promise(function(_0x1a022b,_0x5db292){return db['VoiceDialReport'][_0x5d4a('0x18')](_0x3e64ee[_0x5d4a('0x19')],{'raw':_0x3e64ee[_0x5d4a('0x1a')]?_0x3e64ee[_0x5d4a('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x5d4a('0xd')](function(_0x207131){logger[_0x5d4a('0xe')](_0x5d4a('0x1b'),_0x3e64ee);logger['debug'](_0x5d4a('0x1b'),_0x3e64ee,JSON[_0x5d4a('0x13')](_0x207131));_0x1a022b(_0x207131);})['catch'](function(_0x53a9c4){logger[_0x5d4a('0x14')](_0x5d4a('0x1b'),_0x53a9c4[_0x5d4a('0x16')],_0x3e64ee);_0x5db292(_0x3d73a2[_0x5d4a('0x14')](0x1f4,_0x53a9c4[_0x5d4a('0x16')]));});});};exports[_0x5d4a('0x1c')]=function(_0x1a2c2f){var _0x261f34=this;return new Promise(function(_0x262632,_0x3b1ecb){return db[_0x5d4a('0x1d')][_0x5d4a('0x1e')](_0x1a2c2f[_0x5d4a('0x19')],{'raw':_0x1a2c2f[_0x5d4a('0x1a')]?_0x1a2c2f[_0x5d4a('0x1a')][_0x5d4a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a2c2f[_0x5d4a('0x1a')]?_0x1a2c2f[_0x5d4a('0x1a')][_0x5d4a('0x20')]||null:null,'attributes':_0x1a2c2f[_0x5d4a('0x1a')]?_0x1a2c2f['options'][_0x5d4a('0x21')]||null:null,'limit':_0x1a2c2f[_0x5d4a('0x1a')]?_0x1a2c2f[_0x5d4a('0x1a')]['limit']||null:null})[_0x5d4a('0xd')](function(_0x37c6e4){logger[_0x5d4a('0xe')]('UpdateVoiceDialReport',_0x1a2c2f);logger['debug'](_0x5d4a('0x1c'),_0x1a2c2f,JSON[_0x5d4a('0x13')](_0x37c6e4));_0x262632(_0x37c6e4);})['catch'](function(_0x152325){logger[_0x5d4a('0x14')]('UpdateVoiceDialReport',_0x152325[_0x5d4a('0x16')],_0x1a2c2f);_0x3b1ecb(_0x261f34[_0x5d4a('0x14')](0x1f4,_0x152325[_0x5d4a('0x16')]));});});}; \ No newline at end of file +var _0x63f1=['jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','catch','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1f21b1,_0x427236){var _0x437f1a=function(_0x5c716b){while(--_0x5c716b){_0x1f21b1['push'](_0x1f21b1['shift']());}};_0x437f1a(++_0x427236);}(_0x63f1,0x9a));var _0x163f=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x63f1[_0x35885a];return _0xe86249;};'use strict';var _=require(_0x163f('0x0'));var util=require(_0x163f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x163f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x163f('0x3'))['db'];var utils=require(_0x163f('0x4'));var logger=require(_0x163f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x163f('0x6'));var client=jayson[_0x163f('0x7')][_0x163f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x491c3d,_0x2ac04e,_0x44cd96){return new BPromise(function(_0x53c581,_0x522fa2){return client[_0x163f('0x9')](_0x491c3d,_0x44cd96)[_0x163f('0xa')](function(_0x28991a){logger[_0x163f('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x2ac04e,'request\x20sent');logger[_0x163f('0xc')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x2ac04e,_0x163f('0xd'),JSON[_0x163f('0xe')](_0x28991a));if(_0x28991a[_0x163f('0xf')]){if(_0x28991a[_0x163f('0xf')][_0x163f('0x10')]===0x1f4){logger[_0x163f('0xf')](_0x163f('0x11'),_0x2ac04e,_0x28991a[_0x163f('0xf')]['message']);return _0x522fa2(_0x28991a['error']['message']);}logger['error'](_0x163f('0x11'),_0x2ac04e,_0x28991a[_0x163f('0xf')][_0x163f('0x12')]);return _0x53c581(_0x28991a[_0x163f('0xf')][_0x163f('0x12')]);}else{logger[_0x163f('0xb')](_0x163f('0x11'),_0x2ac04e,_0x163f('0xd'));_0x53c581(_0x28991a[_0x163f('0x13')][_0x163f('0x12')]);}})['catch'](function(_0x372ed5){logger[_0x163f('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x2ac04e,_0x372ed5);_0x522fa2(_0x372ed5);});});}exports[_0x163f('0x14')]=function(_0x40d2d5){var _0x39b367=this;return new Promise(function(_0x441038,_0x488476){return db[_0x163f('0x15')][_0x163f('0x16')](_0x40d2d5[_0x163f('0x17')],{'raw':_0x40d2d5['options']?_0x40d2d5[_0x163f('0x18')][_0x163f('0x19')]===undefined?!![]:![]:!![]})[_0x163f('0xa')](function(_0x3a328b){logger[_0x163f('0xb')](_0x163f('0x14'),_0x40d2d5);logger[_0x163f('0xc')](_0x163f('0x14'),_0x40d2d5,JSON[_0x163f('0xe')](_0x3a328b));_0x441038(_0x3a328b);})[_0x163f('0x1a')](function(_0x304a39){logger[_0x163f('0xf')](_0x163f('0x14'),_0x304a39['message'],_0x40d2d5);_0x488476(_0x39b367[_0x163f('0xf')](0x1f4,_0x304a39['message']));});});};exports[_0x163f('0x1b')]=function(_0x13659c){var _0x47fdc5=this;return new Promise(function(_0x3c570b,_0x74b04c){return db[_0x163f('0x15')][_0x163f('0x1c')](_0x13659c[_0x163f('0x17')],{'raw':_0x13659c[_0x163f('0x18')]?_0x13659c[_0x163f('0x18')][_0x163f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13659c[_0x163f('0x18')]?_0x13659c['options'][_0x163f('0x1d')]||null:null,'attributes':_0x13659c[_0x163f('0x18')]?_0x13659c[_0x163f('0x18')][_0x163f('0x1e')]||null:null,'limit':_0x13659c[_0x163f('0x18')]?_0x13659c['options'][_0x163f('0x1f')]||null:null})[_0x163f('0xa')](function(_0x2dbf30){logger[_0x163f('0xb')](_0x163f('0x1b'),_0x13659c);logger['debug']('UpdateVoiceDialReport',_0x13659c,JSON['stringify'](_0x2dbf30));_0x3c570b(_0x2dbf30);})[_0x163f('0x1a')](function(_0x51b7c9){logger[_0x163f('0xf')](_0x163f('0x1b'),_0x51b7c9['message'],_0x13659c);_0x74b04c(_0x47fdc5[_0x163f('0xf')](0x1f4,_0x51b7c9[_0x163f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 278f17a..3f2fe98 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 _0x36d4=['isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x36d4,0xc0));var _0x436d=function(_0x32d7e8,_0x2ad5d8){_0x32d7e8=_0x32d7e8-0x0;var _0x33f098=_0x36d4[_0x32d7e8];return _0x33f098;};'use strict';var multer=require(_0x436d('0x0'));var util=require('util');var path=require(_0x436d('0x1'));var timeout=require(_0x436d('0x2'));var express=require('express');var router=express[_0x436d('0x3')]();var fs_extra=require(_0x436d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x436d('0x5'));var config=require(_0x436d('0x6'));var controller=require('./voiceExtension.controller');router[_0x436d('0x7')]('/',auth[_0x436d('0x8')](),controller[_0x436d('0x9')]);router[_0x436d('0x7')](_0x436d('0xa'),auth[_0x436d('0x8')](),controller[_0x436d('0xb')]);router[_0x436d('0xc')]('/',auth[_0x436d('0x8')](),controller[_0x436d('0xd')]);router[_0x436d('0xc')](_0x436d('0xe'),auth[_0x436d('0x8')](),controller[_0x436d('0xf')]);router[_0x436d('0x10')](_0x436d('0xa'),auth[_0x436d('0x8')](),controller[_0x436d('0x11')]);router[_0x436d('0x12')](_0x436d('0xa'),auth[_0x436d('0x8')](),controller[_0x436d('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2373=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','/:id/applications','addApplications','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x118758,_0x58232a){var _0x429d4b=function(_0x49dc87){while(--_0x49dc87){_0x118758['push'](_0x118758['shift']());}};_0x429d4b(++_0x58232a);}(_0x2373,0x64));var _0x3237=function(_0x1a34f8,_0xfd6d9){_0x1a34f8=_0x1a34f8-0x0;var _0xf89411=_0x2373[_0x1a34f8];return _0xf89411;};'use strict';var multer=require('multer');var util=require(_0x3237('0x0'));var path=require(_0x3237('0x1'));var timeout=require(_0x3237('0x2'));var express=require(_0x3237('0x3'));var router=express[_0x3237('0x4')]();var fs_extra=require(_0x3237('0x5'));var auth=require(_0x3237('0x6'));var interaction=require(_0x3237('0x7'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0x3237('0x8')]('/',auth[_0x3237('0x9')](),controller[_0x3237('0xa')]);router[_0x3237('0x8')]('/:id',auth[_0x3237('0x9')](),controller[_0x3237('0xb')]);router[_0x3237('0xc')]('/',auth[_0x3237('0x9')](),controller[_0x3237('0xd')]);router[_0x3237('0xc')](_0x3237('0xe'),auth['isAuthenticated'](),controller[_0x3237('0xf')]);router[_0x3237('0x10')](_0x3237('0x11'),auth[_0x3237('0x9')](),controller[_0x3237('0x12')]);router[_0x3237('0x13')](_0x3237('0x11'),auth[_0x3237('0x9')](),controller['destroy']);module[_0x3237('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 99d9b1c..894b55f 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 _0x7928=['VIRTUAL','exten','sequelize','exports','STRING','compositeIndex','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER','wav'];(function(_0x2c3255,_0x4e00ae){var _0x282aba=function(_0x5721d5){while(--_0x5721d5){_0x2c3255['push'](_0x2c3255['shift']());}};_0x282aba(++_0x4e00ae);}(_0x7928,0x1a0));var _0x8792=function(_0x51a171,_0x204491){_0x51a171=_0x51a171-0x0;var _0x41f474=_0x7928[_0x51a171];return _0x41f474;};'use strict';var Sequelize=require(_0x8792('0x0'));module[_0x8792('0x1')]={'context':{'type':Sequelize[_0x8792('0x2')],'allowNull':![],'unique':_0x8792('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x8792('0x2')],'allowNull':![],'unique':_0x8792('0x3')},'priority':{'type':Sequelize[_0x8792('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x8792('0x3')},'tag':{'type':Sequelize[_0x8792('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x8792('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x8792('0x4')](_0x8792('0x5'),_0x8792('0x6'),_0x8792('0x7'),_0x8792('0x8'),_0x8792('0x9'),_0x8792('0xa'),_0x8792('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x8792('0x2')]},'interval':{'type':Sequelize[_0x8792('0x2')],'allowNull':![],'defaultValue':_0x8792('0xc')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x8792('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x8792('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x8792('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x8792('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x8792('0xe')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x8792('0xf')},'answer':{'type':Sequelize[_0x8792('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x8792('0x10')],'get':function(_0x107710){return this['getDataValue'](_0x8792('0x11'));}},'alias':{'type':Sequelize[_0x8792('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x928f=['INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','compositeIndex','STRING','NoOp','outbound','inbound-fax','outbound-fax','system','any'];(function(_0x2849bd,_0x166aaf){var _0x4ed88a=function(_0x4201d1){while(--_0x4201d1){_0x2849bd['push'](_0x2849bd['shift']());}};_0x4ed88a(++_0x166aaf);}(_0x928f,0x76));var _0xf928=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x928f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xf928('0x0'));module[_0xf928('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf928('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xf928('0x3')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xf928('0x3')],'allowNull':![],'defaultValue':'1','unique':_0xf928('0x2')},'tag':{'type':Sequelize[_0xf928('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf928('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound',_0xf928('0x5'),'internal',_0xf928('0x6'),_0xf928('0x7'),_0xf928('0x8'),_0xf928('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xf928('0x3')]},'interval':{'type':Sequelize[_0xf928('0x3')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xf928('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xf928('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0xf928('0x3')],'allowNull':!![]},'record':{'type':Sequelize[_0xf928('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xf928('0x3')],'defaultValue':_0xf928('0xc')},'answer':{'type':Sequelize[_0xf928('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0xf928('0xd')],'get':function(_0x1337b3){return this[_0xf928('0xe')](_0xf928('0xf'));}},'alias':{'type':Sequelize[_0xf928('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index de042dc..dcc9c50 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 _0x5953=['autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','alias','addApplications','findOne','sequelize','transaction','params','isApp','rewriteDial','bulkCreate','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','inbound','outbound','InternalRoutes','internal','filter','ignore','value','type','find','name','UserProfileResource','destroy','error','stack','map','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','options','VoiceExtension','include','rows','rawAttributes','length','includeAll','catch','body','startsWith','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','OutboundRoutes','userProfileId'];(function(_0x32f92f,_0x174e52){var _0x3f3891=function(_0x130076){while(--_0x130076){_0x32f92f['push'](_0x32f92f['shift']());}};_0x3f3891(++_0x174e52);}(_0x5953,0x7d));var _0x3595=function(_0x31e9eb,_0x588a45){_0x31e9eb=_0x31e9eb-0x0;var _0x2215ee=_0x5953[_0x31e9eb];return _0x2215ee;};'use strict';var emlformat=require(_0x3595('0x0'));var rimraf=require(_0x3595('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3595('0x2'));var rp=require(_0x3595('0x3'));var moment=require(_0x3595('0x4'));var BPromise=require(_0x3595('0x5'));var Mustache=require(_0x3595('0x6'));var util=require(_0x3595('0x7'));var path=require(_0x3595('0x8'));var sox=require(_0x3595('0x9'));var csv=require(_0x3595('0xa'));var ejs=require(_0x3595('0xb'));var fs=require('fs');var fs_extra=require(_0x3595('0xc'));var _=require(_0x3595('0xd'));var squel=require(_0x3595('0xe'));var crypto=require(_0x3595('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3595('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3595('0x11'));var Papa=require(_0x3595('0x12'));var Redis=require(_0x3595('0x13'));var authService=require(_0x3595('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3595('0x15'));var hardwareService=require(_0x3595('0x16'));var logger=require(_0x3595('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x3595('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3595('0x19'))['db'];config[_0x3595('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3595('0x1b'))(new Redis(config[_0x3595('0x1a')]));require(_0x3595('0x1c'))[_0x3595('0x1d')](socket);function respondWithStatusCode(_0x315fb6,_0x1441c8){_0x1441c8=_0x1441c8||0xcc;return function(_0x473aa1){if(_0x473aa1){return _0x315fb6[_0x3595('0x1e')](_0x1441c8);}return _0x315fb6['status'](_0x1441c8)[_0x3595('0x1f')]();};}function respondWithResult(_0x1ed18f,_0x35d1d7){_0x35d1d7=_0x35d1d7||0xc8;return function(_0x15a42c){if(_0x15a42c){return _0x1ed18f[_0x3595('0x20')](_0x35d1d7)[_0x3595('0x21')](_0x15a42c);}};}function respondWithFilteredResult(_0x2b204b,_0x5ba9b8){return function(_0x3ddf79){if(_0x3ddf79){var _0x4ca2a7=typeof _0x5ba9b8['offset']==='undefined'&&typeof _0x5ba9b8[_0x3595('0x22')]==='undefined';var _0x537d9a=_0x3ddf79[_0x3595('0x23')];var _0xc377e=_0x4ca2a7?0x0:_0x5ba9b8[_0x3595('0x24')];var _0x14fd3d=_0x4ca2a7?_0x3ddf79['count']:_0x5ba9b8[_0x3595('0x24')]+_0x5ba9b8[_0x3595('0x22')];var _0xce41a;if(_0x14fd3d>=_0x537d9a){_0x14fd3d=_0x537d9a;_0xce41a=0xc8;}else{_0xce41a=0xce;}_0x2b204b[_0x3595('0x20')](_0xce41a);return _0x2b204b[_0x3595('0x25')](_0x3595('0x26'),_0xc377e+'-'+_0x14fd3d+'/'+_0x537d9a)[_0x3595('0x21')](_0x3ddf79);}return null;};}function patchUpdates(_0x5d6fd8){return function(_0x47f400){try{jsonpatch[_0x3595('0x27')](_0x47f400,_0x5d6fd8,!![]);}catch(_0x4b85b1){return BPromise[_0x3595('0x28')](_0x4b85b1);}return _0x47f400[_0x3595('0x29')]();};}function saveUpdates(_0x3c4b28,_0x589f13){return function(_0x492638){if(_0x492638){return _0x492638[_0x3595('0x2a')](_0x3c4b28)[_0x3595('0x2b')](function(_0x2f01e8){return _0x2f01e8;});}return null;};}function removeEntity(_0x444a30,_0x592090){return function(_0x80ff9f){if(_0x80ff9f){return _0x80ff9f['destroy']()[_0x3595('0x2b')](function(){var _0x1915cd=_0x80ff9f['get']({'plain':!![]});var _0x2a9400=[{'name':'InboundRoutes','value':_0x3595('0x2c'),'ignore':![]},{'name':'OutboundRoutes','value':_0x3595('0x2d'),'ignore':![]},{'name':_0x3595('0x2e'),'value':_0x3595('0x2f'),'ignore':![]}];var _0x2ad334=_(_0x2a9400)[_0x3595('0x30')](_0x3595('0x31'))['map'](_0x3595('0x32'))[_0x3595('0x32')]();if(_['includes'](_0x2ad334,_0x1915cd[_0x3595('0x33')])){return;}var _0x2a1e9d=_[_0x3595('0x34')](_0x2a9400,['value',_0x1915cd[_0x3595('0x33')]])[_0x3595('0x35')];return db[_0x3595('0x36')][_0x3595('0x37')]({'where':{'type':_0x2a1e9d,'resourceId':_0x1915cd['id']}})[_0x3595('0x2b')](function(){return _0x80ff9f;});})[_0x3595('0x2b')](function(){_0x444a30[_0x3595('0x20')](0xcc)[_0x3595('0x1f')]();});}};}function handleEntityNotFound(_0x54cb9a,_0x2b60d7){return function(_0x549334){if(!_0x549334){_0x54cb9a['sendStatus'](0x194);}return _0x549334;};}function handleError(_0x4ad92e,_0x1b05e6){_0x1b05e6=_0x1b05e6||0x1f4;return function(_0x32f65b){logger[_0x3595('0x38')](_0x32f65b[_0x3595('0x39')]);if(_0x32f65b[_0x3595('0x35')]){delete _0x32f65b['name'];}_0x4ad92e[_0x3595('0x20')](_0x1b05e6)['send'](_0x32f65b);};}exports['index']=function(_0xd28df6,_0x1ddfa7){var _0x5bb4f8={},_0x44a28c={},_0x3b7e91={'count':0x0,'rows':[]};var _0x5e8f55=_[_0x3595('0x3a')](db['VoiceExtension']['rawAttributes'],function(_0x5c32ab){return{'name':_0x5c32ab['fieldName'],'type':_0x5c32ab['type'][_0x3595('0x3b')]};});_0x44a28c[_0x3595('0x3c')]=_[_0x3595('0x3a')](_0x5e8f55,_0x3595('0x35'));_0x44a28c[_0x3595('0x3d')]=_[_0x3595('0x3e')](_0xd28df6['query']);_0x44a28c['filters']=_['intersection'](_0x44a28c['model'],_0x44a28c[_0x3595('0x3d')]);_0x5bb4f8[_0x3595('0x3f')]=_['intersection'](_0x44a28c[_0x3595('0x3c')],qs[_0x3595('0x40')](_0xd28df6['query'][_0x3595('0x40')]));_0x5bb4f8[_0x3595('0x3f')]=_0x5bb4f8[_0x3595('0x3f')]['length']?_0x5bb4f8['attributes']:_0x44a28c['model'];if(!_0xd28df6[_0x3595('0x3d')][_0x3595('0x41')](_0x3595('0x42'))){_0x5bb4f8['limit']=qs[_0x3595('0x22')](_0xd28df6[_0x3595('0x3d')][_0x3595('0x22')]);_0x5bb4f8[_0x3595('0x24')]=qs['offset'](_0xd28df6[_0x3595('0x3d')][_0x3595('0x24')]);}_0x5bb4f8[_0x3595('0x43')]=qs[_0x3595('0x44')](_0xd28df6['query']['sort']);_0x5bb4f8['where']=qs[_0x3595('0x45')](_[_0x3595('0x46')](_0xd28df6[_0x3595('0x3d')],_0x44a28c[_0x3595('0x45')]),_0x5e8f55);if(_0xd28df6[_0x3595('0x3d')][_0x3595('0x30')]){_0x5bb4f8[_0x3595('0x47')]=_[_0x3595('0x48')](_0x5bb4f8['where'],{'$or':_['map'](_0x5e8f55,function(_0x10ca1f){if(_0x10ca1f['type']!=='VIRTUAL'){var _0x31981f={};_0x31981f[_0x10ca1f[_0x3595('0x35')]]={'$like':'%'+_0xd28df6[_0x3595('0x3d')][_0x3595('0x30')]+'%'};return _0x31981f;}})});}_0x5bb4f8=_[_0x3595('0x48')]({},_0x5bb4f8,_0xd28df6[_0x3595('0x49')]);var _0x412ba4={'where':_0x5bb4f8['where']};return db[_0x3595('0x4a')][_0x3595('0x23')](_0x412ba4)['then'](function(_0x157c93){_0x3b7e91['count']=_0x157c93;if(_0xd28df6[_0x3595('0x3d')]['includeAll']){_0x5bb4f8[_0x3595('0x4b')]=[{'all':!![]}];}return db[_0x3595('0x4a')]['findAll'](_0x5bb4f8);})[_0x3595('0x2b')](function(_0x23f93b){_0x3b7e91[_0x3595('0x4c')]=_0x23f93b;return _0x3b7e91;})[_0x3595('0x2b')](respondWithFilteredResult(_0x1ddfa7,_0x5bb4f8))['catch'](handleError(_0x1ddfa7,null));};exports['show']=function(_0x4838af,_0x3e8b7f){var _0x24f92d={'raw':![],'where':{'id':_0x4838af['params']['id']}},_0x4e7755={};_0x4e7755[_0x3595('0x3c')]=_[_0x3595('0x3e')](db[_0x3595('0x4a')][_0x3595('0x4d')]);_0x4e7755[_0x3595('0x3d')]=_['keys'](_0x4838af[_0x3595('0x3d')]);_0x4e7755[_0x3595('0x45')]=_['intersection'](_0x4e7755[_0x3595('0x3c')],_0x4e7755[_0x3595('0x3d')]);_0x24f92d[_0x3595('0x3f')]=_['intersection'](_0x4e7755['model'],qs['fields'](_0x4838af['query']['fields']));_0x24f92d[_0x3595('0x3f')]=_0x24f92d['attributes'][_0x3595('0x4e')]?_0x24f92d[_0x3595('0x3f')]:_0x4e7755[_0x3595('0x3c')];if(_0x4838af[_0x3595('0x3d')][_0x3595('0x4f')]){_0x24f92d[_0x3595('0x4b')]=[{'all':!![]}];}_0x24f92d=_['merge']({},_0x24f92d,_0x4838af[_0x3595('0x49')]);return db[_0x3595('0x4a')][_0x3595('0x34')](_0x24f92d)[_0x3595('0x2b')](handleEntityNotFound(_0x3e8b7f,null))[_0x3595('0x2b')](respondWithResult(_0x3e8b7f,null))[_0x3595('0x50')](handleError(_0x3e8b7f,null));};exports[_0x3595('0x37')]=function(_0x22df72,_0x412b79){return db[_0x3595('0x4a')]['find']({'where':{'id':_0x22df72['params']['id']}})[_0x3595('0x2b')](handleEntityNotFound(_0x412b79,null))[_0x3595('0x2b')](removeEntity(_0x412b79,null))['catch'](handleError(_0x412b79,null));};exports['create']=function(_0x1bef0d,_0x19a2b4){if(_0x1bef0d[_0x3595('0x51')]['type']===_0x3595('0x2d')&&!_[_0x3595('0x52')](_0x1bef0d[_0x3595('0x51')][_0x3595('0x53')],'_')){_0x1bef0d['body'][_0x3595('0x53')]='_'[_0x3595('0x54')](_0x1bef0d['body']['exten']);}return db['VoiceExtension']['create'](_0x1bef0d[_0x3595('0x51')],{'raw':![]})[_0x3595('0x2b')](function(_0x19b38c){var _0x33089b=_0x1bef0d[_0x3595('0x55')][_0x3595('0x56')]({'plain':!![]});if(!_0x33089b)throw new Error(_0x3595('0x57'));if(_0x33089b['role']==='user'){var _0x64f83d=_0x19b38c['get']({'plain':!![]});var _0x1ebe31=[{'name':_0x3595('0x58'),'value':_0x3595('0x2c')},{'name':_0x3595('0x59'),'value':'outbound'},{'name':'InternalRoutes','value':_0x3595('0x2f')}];var _0x472a0e=_[_0x3595('0x34')](_0x1ebe31,[_0x3595('0x32'),_0x64f83d['type']])[_0x3595('0x35')];return db['UserProfileSection'][_0x3595('0x34')]({'where':{'name':_0x472a0e,'userProfileId':_0x33089b[_0x3595('0x5a')]},'raw':!![]})[_0x3595('0x2b')](function(_0x4eb26a){if(_0x4eb26a&&_0x4eb26a[_0x3595('0x5b')]===0x0){return db[_0x3595('0x36')][_0x3595('0x5c')]({'name':_0x64f83d[_0x3595('0x35')],'resourceId':_0x64f83d['id'],'type':_0x4eb26a[_0x3595('0x35')],'sectionId':_0x4eb26a['id']},{})[_0x3595('0x2b')](function(){return _0x19b38c;});}else{return _0x19b38c;}})[_0x3595('0x50')](function(_0x462dc6){logger[_0x3595('0x38')](_0x3595('0x5d'),_0x462dc6);throw _0x462dc6;});}return _0x19b38c;})[_0x3595('0x2b')](respondWithResult(_0x19a2b4,0xc9))['catch'](handleError(_0x19a2b4,null));};exports[_0x3595('0x2a')]=function(_0x27a9a1,_0x1b8720){if(_0x27a9a1[_0x3595('0x51')]['id']){delete _0x27a9a1[_0x3595('0x51')]['id'];}return db[_0x3595('0x4a')][_0x3595('0x34')]({'where':{'id':_0x27a9a1['params']['id']}})[_0x3595('0x2b')](handleEntityNotFound(_0x1b8720,null))[_0x3595('0x2b')](function(_0xa49973){if(_0xa49973){return db[_0x3595('0x4a')]['update'](_['pick'](_0x27a9a1['body'],['exten',_0x3595('0x5e'),_0x3595('0x5f'),_0x3595('0x60'),_0x3595('0x61'),'mandatoryDisposition',_0x3595('0x62')]),{'where':{'context':_0xa49973[_0x3595('0x5e')],'exten':_0xa49973[_0x3595('0x53')]},'individualHooks':!![]})[_0x3595('0x2b')](function(_0x3cf785){return _0x3cf785;});}return null;})[_0x3595('0x2b')](respondWithStatusCode(_0x1b8720,null))[_0x3595('0x50')](handleError(_0x1b8720,null));};exports[_0x3595('0x63')]=function(_0x21fb20,_0x2d58a6){return db[_0x3595('0x4a')][_0x3595('0x64')]({'where':{'id':_0x21fb20['params']['id']}})[_0x3595('0x2b')](function(_0x58566a){if(_0x58566a){return db[_0x3595('0x65')][_0x3595('0x66')](function(_0x494555){return db[_0x3595('0x4a')][_0x3595('0x37')]({'where':{'VoiceExtensionId':_0x21fb20[_0x3595('0x67')]['id']},'transaction':_0x494555})[_0x3595('0x2b')](function(){var _0x42be6a=_[_0x3595('0x3a')](_0x21fb20[_0x3595('0x51')],function(_0x13e77c){_0x13e77c['VoiceExtensionId']=_0x21fb20[_0x3595('0x67')]['id'];_0x13e77c[_0x3595('0x68')]=!![];return _0x13e77c;});var _0x21e97b=_0x21fb20[_0x3595('0x3d')][_0x3595('0x69')]&&_0x21fb20[_0x3595('0x3d')][_0x3595('0x69')]['toLowerCase']()==='true'?!![]:![];return _0x58566a['createRouting'](_0x42be6a,_0x21e97b);})[_0x3595('0x2b')](function(_0x3d6538){return db[_0x3595('0x4a')][_0x3595('0x6a')](_0x3d6538,{'transaction':_0x494555});});})[_0x3595('0x2b')](function(){return db['VoiceExtension'][_0x3595('0x6b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x21fb20['params']['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0x2d58a6,null))[_0x3595('0x50')](handleError(_0x2d58a6,null));}; \ No newline at end of file +var _0xe703=['sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','inbound','OutboundRoutes','InternalRoutes','filter','ignore','map','value','includes','type','find','name','UserProfileResource','end','error','stack','VoiceExtension','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','includeAll','include','findAll','catch','show','params','length','create','body','outbound','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','VoiceExtensionId','isApp','rewriteDial','toLowerCase','true','bulkCreate','findAndCountAll','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register'];(function(_0x3dc8b0,_0x5ba9b8){var _0x20b261=function(_0x35d708){while(--_0x35d708){_0x3dc8b0['push'](_0x3dc8b0['shift']());}};_0x20b261(++_0x5ba9b8);}(_0xe703,0x131));var _0x3e70=function(_0x4ab32c,_0x44ab5e){_0x4ab32c=_0x4ab32c-0x0;var _0x2b9644=_0xe703[_0x4ab32c];return _0x2b9644;};'use strict';var emlformat=require(_0x3e70('0x0'));var rimraf=require(_0x3e70('0x1'));var zipdir=require(_0x3e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3e70('0x3'));var moment=require(_0x3e70('0x4'));var BPromise=require(_0x3e70('0x5'));var Mustache=require(_0x3e70('0x6'));var util=require(_0x3e70('0x7'));var path=require('path');var sox=require(_0x3e70('0x8'));var csv=require(_0x3e70('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e70('0xa'));var squel=require('squel');var crypto=require(_0x3e70('0xb'));var jsforce=require(_0x3e70('0xc'));var deskjs=require(_0x3e70('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3e70('0xe'));var Redis=require(_0x3e70('0xf'));var authService=require(_0x3e70('0x10'));var qs=require(_0x3e70('0x11'));var as=require(_0x3e70('0x12'));var hardwareService=require(_0x3e70('0x13'));var logger=require(_0x3e70('0x14'))('api');var utils=require(_0x3e70('0x15'));var config=require(_0x3e70('0x16'));var licenseUtil=require(_0x3e70('0x17'));var db=require(_0x3e70('0x18'))['db'];config[_0x3e70('0x19')]=_[_0x3e70('0x1a')](config[_0x3e70('0x19')],{'host':_0x3e70('0x1b'),'port':0x18eb});var socket=require(_0x3e70('0x1c'))(new Redis(config[_0x3e70('0x19')]));require(_0x3e70('0x1d'))[_0x3e70('0x1e')](socket);function respondWithStatusCode(_0x32c1c0,_0xff4a9a){_0xff4a9a=_0xff4a9a||0xcc;return function(_0x48511c){if(_0x48511c){return _0x32c1c0[_0x3e70('0x1f')](_0xff4a9a);}return _0x32c1c0[_0x3e70('0x20')](_0xff4a9a)['end']();};}function respondWithResult(_0x65aacb,_0x1c30eb){_0x1c30eb=_0x1c30eb||0xc8;return function(_0x16cb78){if(_0x16cb78){return _0x65aacb[_0x3e70('0x20')](_0x1c30eb)['json'](_0x16cb78);}};}function respondWithFilteredResult(_0x70f8f6,_0x27d770){return function(_0x15601f){if(_0x15601f){var _0xbce0e2=typeof _0x27d770[_0x3e70('0x21')]===_0x3e70('0x22')&&typeof _0x27d770[_0x3e70('0x23')]===_0x3e70('0x22');var _0x4a6582=_0x15601f[_0x3e70('0x24')];var _0x9ace81=_0xbce0e2?0x0:_0x27d770[_0x3e70('0x21')];var _0x5baa48=_0xbce0e2?_0x15601f[_0x3e70('0x24')]:_0x27d770['offset']+_0x27d770['limit'];var _0x501725;if(_0x5baa48>=_0x4a6582){_0x5baa48=_0x4a6582;_0x501725=0xc8;}else{_0x501725=0xce;}_0x70f8f6[_0x3e70('0x20')](_0x501725);return _0x70f8f6[_0x3e70('0x25')](_0x3e70('0x26'),_0x9ace81+'-'+_0x5baa48+'/'+_0x4a6582)[_0x3e70('0x27')](_0x15601f);}return null;};}function patchUpdates(_0x3ff1b2){return function(_0x356f3f){try{jsonpatch[_0x3e70('0x28')](_0x356f3f,_0x3ff1b2,!![]);}catch(_0x5a2513){return BPromise[_0x3e70('0x29')](_0x5a2513);}return _0x356f3f[_0x3e70('0x2a')]();};}function saveUpdates(_0x2b6bd5,_0x518593){return function(_0x4f28b5){if(_0x4f28b5){return _0x4f28b5['update'](_0x2b6bd5)[_0x3e70('0x2b')](function(_0x483786){return _0x483786;});}return null;};}function removeEntity(_0x4b2128,_0x325ae6){return function(_0x24bc93){if(_0x24bc93){return _0x24bc93[_0x3e70('0x2c')]()['then'](function(){var _0xfa8b69=_0x24bc93[_0x3e70('0x2d')]({'plain':!![]});var _0x3921bd=[{'name':'InboundRoutes','value':_0x3e70('0x2e'),'ignore':![]},{'name':_0x3e70('0x2f'),'value':'outbound','ignore':![]},{'name':_0x3e70('0x30'),'value':'internal','ignore':![]}];var _0x257321=_(_0x3921bd)[_0x3e70('0x31')](_0x3e70('0x32'))[_0x3e70('0x33')](_0x3e70('0x34'))[_0x3e70('0x34')]();if(_[_0x3e70('0x35')](_0x257321,_0xfa8b69[_0x3e70('0x36')])){return;}var _0x374742=_[_0x3e70('0x37')](_0x3921bd,['value',_0xfa8b69[_0x3e70('0x36')]])[_0x3e70('0x38')];return db[_0x3e70('0x39')][_0x3e70('0x2c')]({'where':{'type':_0x374742,'resourceId':_0xfa8b69['id']}})['then'](function(){return _0x24bc93;});})[_0x3e70('0x2b')](function(){_0x4b2128[_0x3e70('0x20')](0xcc)[_0x3e70('0x3a')]();});}};}function handleEntityNotFound(_0x595e8a,_0x339069){return function(_0x34a1cd){if(!_0x34a1cd){_0x595e8a[_0x3e70('0x1f')](0x194);}return _0x34a1cd;};}function handleError(_0x4a6daa,_0x3abcfa){_0x3abcfa=_0x3abcfa||0x1f4;return function(_0xc67ecb){logger[_0x3e70('0x3b')](_0xc67ecb[_0x3e70('0x3c')]);if(_0xc67ecb['name']){delete _0xc67ecb[_0x3e70('0x38')];}_0x4a6daa[_0x3e70('0x20')](_0x3abcfa)['send'](_0xc67ecb);};}exports['index']=function(_0x41d9fa,_0x388164){var _0x576a63={},_0x41bda0={},_0x39cfec={'count':0x0,'rows':[]};var _0x5c7e9a=_[_0x3e70('0x33')](db[_0x3e70('0x3d')][_0x3e70('0x3e')],function(_0x14e5e4){return{'name':_0x14e5e4[_0x3e70('0x3f')],'type':_0x14e5e4[_0x3e70('0x36')]['key']};});_0x41bda0[_0x3e70('0x40')]=_['map'](_0x5c7e9a,_0x3e70('0x38'));_0x41bda0[_0x3e70('0x41')]=_[_0x3e70('0x42')](_0x41d9fa[_0x3e70('0x41')]);_0x41bda0[_0x3e70('0x43')]=_[_0x3e70('0x44')](_0x41bda0['model'],_0x41bda0[_0x3e70('0x41')]);_0x576a63[_0x3e70('0x45')]=_[_0x3e70('0x44')](_0x41bda0[_0x3e70('0x40')],qs[_0x3e70('0x46')](_0x41d9fa[_0x3e70('0x41')]['fields']));_0x576a63[_0x3e70('0x45')]=_0x576a63[_0x3e70('0x45')]['length']?_0x576a63[_0x3e70('0x45')]:_0x41bda0[_0x3e70('0x40')];if(!_0x41d9fa[_0x3e70('0x41')][_0x3e70('0x47')](_0x3e70('0x48'))){_0x576a63['limit']=qs[_0x3e70('0x23')](_0x41d9fa[_0x3e70('0x41')]['limit']);_0x576a63[_0x3e70('0x21')]=qs[_0x3e70('0x21')](_0x41d9fa[_0x3e70('0x41')][_0x3e70('0x21')]);}_0x576a63['order']=qs[_0x3e70('0x49')](_0x41d9fa[_0x3e70('0x41')][_0x3e70('0x49')]);_0x576a63[_0x3e70('0x4a')]=qs['filters'](_[_0x3e70('0x4b')](_0x41d9fa[_0x3e70('0x41')],_0x41bda0[_0x3e70('0x43')]),_0x5c7e9a);if(_0x41d9fa[_0x3e70('0x41')]['filter']){_0x576a63[_0x3e70('0x4a')]=_[_0x3e70('0x4c')](_0x576a63['where'],{'$or':_[_0x3e70('0x33')](_0x5c7e9a,function(_0x2ca6aa){if(_0x2ca6aa[_0x3e70('0x36')]!=='VIRTUAL'){var _0x31a9f8={};_0x31a9f8[_0x2ca6aa['name']]={'$like':'%'+_0x41d9fa[_0x3e70('0x41')][_0x3e70('0x31')]+'%'};return _0x31a9f8;}})});}_0x576a63=_['merge']({},_0x576a63,_0x41d9fa['options']);var _0x596377={'where':_0x576a63['where']};return db[_0x3e70('0x3d')][_0x3e70('0x24')](_0x596377)[_0x3e70('0x2b')](function(_0x22e540){_0x39cfec[_0x3e70('0x24')]=_0x22e540;if(_0x41d9fa['query'][_0x3e70('0x4d')]){_0x576a63[_0x3e70('0x4e')]=[{'all':!![]}];}return db[_0x3e70('0x3d')][_0x3e70('0x4f')](_0x576a63);})[_0x3e70('0x2b')](function(_0x471345){_0x39cfec['rows']=_0x471345;return _0x39cfec;})[_0x3e70('0x2b')](respondWithFilteredResult(_0x388164,_0x576a63))[_0x3e70('0x50')](handleError(_0x388164,null));};exports[_0x3e70('0x51')]=function(_0x944a63,_0x2963d3){var _0x301a76={'raw':![],'where':{'id':_0x944a63[_0x3e70('0x52')]['id']}},_0x115168={};_0x115168['model']=_['keys'](db['VoiceExtension']['rawAttributes']);_0x115168[_0x3e70('0x41')]=_[_0x3e70('0x42')](_0x944a63[_0x3e70('0x41')]);_0x115168[_0x3e70('0x43')]=_['intersection'](_0x115168[_0x3e70('0x40')],_0x115168[_0x3e70('0x41')]);_0x301a76[_0x3e70('0x45')]=_['intersection'](_0x115168['model'],qs[_0x3e70('0x46')](_0x944a63[_0x3e70('0x41')][_0x3e70('0x46')]));_0x301a76[_0x3e70('0x45')]=_0x301a76[_0x3e70('0x45')][_0x3e70('0x53')]?_0x301a76[_0x3e70('0x45')]:_0x115168[_0x3e70('0x40')];if(_0x944a63[_0x3e70('0x41')]['includeAll']){_0x301a76[_0x3e70('0x4e')]=[{'all':!![]}];}_0x301a76=_[_0x3e70('0x4c')]({},_0x301a76,_0x944a63['options']);return db[_0x3e70('0x3d')][_0x3e70('0x37')](_0x301a76)[_0x3e70('0x2b')](handleEntityNotFound(_0x2963d3,null))[_0x3e70('0x2b')](respondWithResult(_0x2963d3,null))[_0x3e70('0x50')](handleError(_0x2963d3,null));};exports[_0x3e70('0x2c')]=function(_0x5486e4,_0x3191a1){return db[_0x3e70('0x3d')]['find']({'where':{'id':_0x5486e4[_0x3e70('0x52')]['id']}})[_0x3e70('0x2b')](handleEntityNotFound(_0x3191a1,null))[_0x3e70('0x2b')](removeEntity(_0x3191a1,null))['catch'](handleError(_0x3191a1,null));};exports[_0x3e70('0x54')]=function(_0x23bf52,_0x1b14cd){if(_0x23bf52[_0x3e70('0x55')][_0x3e70('0x36')]===_0x3e70('0x56')&&!_['startsWith'](_0x23bf52['body'][_0x3e70('0x57')],'_')){_0x23bf52[_0x3e70('0x55')][_0x3e70('0x57')]='_'['concat'](_0x23bf52[_0x3e70('0x55')][_0x3e70('0x57')]);}return db[_0x3e70('0x3d')][_0x3e70('0x54')](_0x23bf52['body'],{'raw':![]})[_0x3e70('0x2b')](function(_0xbd0f8e){var _0x380d69=_0x23bf52[_0x3e70('0x58')]['get']({'plain':!![]});if(!_0x380d69)throw new Error(_0x3e70('0x59'));if(_0x380d69[_0x3e70('0x5a')]===_0x3e70('0x58')){var _0x44c7f5=_0xbd0f8e[_0x3e70('0x2d')]({'plain':!![]});var _0x38a345=[{'name':'InboundRoutes','value':_0x3e70('0x2e')},{'name':_0x3e70('0x2f'),'value':_0x3e70('0x56')},{'name':_0x3e70('0x30'),'value':'internal'}];var _0x4cad07=_[_0x3e70('0x37')](_0x38a345,[_0x3e70('0x34'),_0x44c7f5[_0x3e70('0x36')]])[_0x3e70('0x38')];return db[_0x3e70('0x5b')][_0x3e70('0x37')]({'where':{'name':_0x4cad07,'userProfileId':_0x380d69[_0x3e70('0x5c')]},'raw':!![]})[_0x3e70('0x2b')](function(_0xcff127){if(_0xcff127&&_0xcff127[_0x3e70('0x5d')]===0x0){return db['UserProfileResource'][_0x3e70('0x54')]({'name':_0x44c7f5['name'],'resourceId':_0x44c7f5['id'],'type':_0xcff127[_0x3e70('0x38')],'sectionId':_0xcff127['id']},{})[_0x3e70('0x2b')](function(){return _0xbd0f8e;});}else{return _0xbd0f8e;}})[_0x3e70('0x50')](function(_0x168f51){logger[_0x3e70('0x3b')](_0x3e70('0x5e'),_0x168f51);throw _0x168f51;});}return _0xbd0f8e;})[_0x3e70('0x2b')](respondWithResult(_0x1b14cd,0xc9))[_0x3e70('0x50')](handleError(_0x1b14cd,null));};exports[_0x3e70('0x5f')]=function(_0x1ed599,_0x4a700e){if(_0x1ed599[_0x3e70('0x55')]['id']){delete _0x1ed599[_0x3e70('0x55')]['id'];}return db[_0x3e70('0x3d')][_0x3e70('0x37')]({'where':{'id':_0x1ed599[_0x3e70('0x52')]['id']}})[_0x3e70('0x2b')](handleEntityNotFound(_0x4a700e,null))['then'](function(_0x14bb8e){if(_0x14bb8e){return db[_0x3e70('0x3d')][_0x3e70('0x5f')](_[_0x3e70('0x4b')](_0x1ed599[_0x3e70('0x55')],[_0x3e70('0x57'),'context',_0x3e70('0x60'),_0x3e70('0x61'),_0x3e70('0x62'),_0x3e70('0x63'),_0x3e70('0x64')]),{'where':{'context':_0x14bb8e[_0x3e70('0x65')],'exten':_0x14bb8e[_0x3e70('0x57')]},'individualHooks':!![]})[_0x3e70('0x2b')](function(_0x454a89){return _0x454a89;});}return null;})[_0x3e70('0x2b')](respondWithStatusCode(_0x4a700e,null))[_0x3e70('0x50')](handleError(_0x4a700e,null));};exports[_0x3e70('0x66')]=function(_0x82488e,_0xdbb96e){return db[_0x3e70('0x3d')]['findOne']({'where':{'id':_0x82488e['params']['id']}})[_0x3e70('0x2b')](function(_0x216a69){if(_0x216a69){return db[_0x3e70('0x67')][_0x3e70('0x68')](function(_0x47b834){return db[_0x3e70('0x3d')][_0x3e70('0x2c')]({'where':{'VoiceExtensionId':_0x82488e[_0x3e70('0x52')]['id']},'transaction':_0x47b834})[_0x3e70('0x2b')](function(){var _0x24ade6=_[_0x3e70('0x33')](_0x82488e[_0x3e70('0x55')],function(_0x4efaeb){_0x4efaeb[_0x3e70('0x69')]=_0x82488e[_0x3e70('0x52')]['id'];_0x4efaeb[_0x3e70('0x6a')]=!![];return _0x4efaeb;});var _0x2fb873=_0x82488e[_0x3e70('0x41')][_0x3e70('0x6b')]&&_0x82488e[_0x3e70('0x41')][_0x3e70('0x6b')][_0x3e70('0x6c')]()===_0x3e70('0x6d')?!![]:![];return _0x216a69['createRouting'](_0x24ade6,_0x2fb873);})['then'](function(_0x1c3058){return db[_0x3e70('0x3d')][_0x3e70('0x6e')](_0x1c3058,{'transaction':_0x47b834});});})['then'](function(){return db[_0x3e70('0x3d')][_0x3e70('0x6f')]({'where':{'isApp':!![],'VoiceExtensionId':_0x82488e['params']['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x3e70('0x2b')](respondWithResult(_0xdbb96e,null))[_0x3e70('0x50')](handleError(_0xdbb96e,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index b158bec..a617475 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 _0x0409=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','VoiceExtension'];(function(_0x7ad123,_0xeeeef3){var _0x37d073=function(_0x51367b){while(--_0x51367b){_0x7ad123['push'](_0x7ad123['shift']());}};_0x37d073(++_0xeeeef3);}(_0x0409,0x69));var _0x9040=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x0409[_0x484e36];return _0xafc85d;};'use strict';var EventEmitter=require(_0x9040('0x0'));var VoiceExtension=require(_0x9040('0x1'))['db'][_0x9040('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9040('0x3')](0x0);var events={'afterCreate':_0x9040('0x4'),'afterUpdate':_0x9040('0x5'),'afterDestroy':'remove'};function emitEvent(_0xd1d25){return function(_0x529dc4,_0x3aa4cb,_0x8fc656){VoiceExtensionEvents[_0x9040('0x6')](_0xd1d25+':'+_0x529dc4['id'],_0x529dc4);VoiceExtensionEvents[_0x9040('0x6')](_0xd1d25,_0x529dc4);_0x8fc656(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x9040('0x7')](e,emitEvent(event));}}module[_0x9040('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x47db=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','VoiceExtension'];(function(_0x508e7b,_0x1b38a5){var _0x9e6ceb=function(_0x2f4c38){while(--_0x2f4c38){_0x508e7b['push'](_0x508e7b['shift']());}};_0x9e6ceb(++_0x1b38a5);}(_0x47db,0x15c));var _0xb47d=function(_0x1aabf8,_0x259ad1){_0x1aabf8=_0x1aabf8-0x0;var _0xded9ae=_0x47db[_0x1aabf8];return _0xded9ae;};'use strict';var EventEmitter=require(_0xb47d('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xb47d('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb47d('0x2')](0x0);var events={'afterCreate':_0xb47d('0x3'),'afterUpdate':_0xb47d('0x4'),'afterDestroy':_0xb47d('0x5')};function emitEvent(_0x22c53a){return function(_0x1916d6,_0x5eab66,_0x510505){VoiceExtensionEvents[_0xb47d('0x6')](_0x22c53a+':'+_0x1916d6['id'],_0x1916d6);VoiceExtensionEvents['emit'](_0x22c53a,_0x1916d6);_0x510505(null);};}for(var e in events){if(events[_0xb47d('0x7')](e)){var event=events[e];VoiceExtension[_0xb47d('0x8')](e,emitEvent(event));}}module[_0xb47d('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 64ae129..d47823b 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 _0x3089=['wav','trunk','options','url','split','length','param','phone','prefix','${EXTEN:','${EXTEN}','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','queue','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','Hangup','util','lodash','type','Set','CDR(type)=','context','exten','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_FORMAT='];(function(_0x3b81eb,_0x175f32){var _0x149491=function(_0x454753){while(--_0x454753){_0x3b81eb['push'](_0x3b81eb['shift']());}};_0x149491(++_0x175f32);}(_0x3089,0x110));var _0x9308=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x3089[_0x2d8fc2];return _0x3a9e53;};'use strict';var util=require(_0x9308('0x0'));var _=require(_0x9308('0x1'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x4420ab){var _0x4caae0=_0x4420ab['models'];function _0x356e5b(_0x2e7c8e){var _0x5b6985=0x2;var _0x1bef8f=[{'type':_0x2e7c8e[_0x9308('0x2')],'app':_0x9308('0x3'),'appdata':_0x9308('0x4')+_0x2e7c8e[_0x9308('0x2')],'context':_0x2e7c8e[_0x9308('0x5')],'exten':_0x2e7c8e[_0x9308('0x6')],'priority':_0x5b6985++,'VoiceExtensionId':_0x2e7c8e['id']},{'type':_0x2e7c8e[_0x9308('0x2')],'app':_0x2e7c8e['alias']?_0x9308('0x3'):_0x9308('0x7'),'appdata':_0x2e7c8e[_0x9308('0x8')]?_0x9308('0x9')+_0x2e7c8e[_0x9308('0x8')]:_0x9308('0xa'),'context':_0x2e7c8e['context'],'exten':_0x2e7c8e[_0x9308('0x6')],'priority':_0x5b6985++,'VoiceExtensionId':_0x2e7c8e['id']}];if(_0x2e7c8e['type']===_0x9308('0xb')){_0x1bef8f['push']({'type':_0x9308('0xb'),'app':_0x9308('0x3'),'appdata':_0x9308('0xc')+_0x2e7c8e['id'],'context':_0x2e7c8e['context'],'exten':_0x2e7c8e['exten'],'priority':_0x5b6985++,'VoiceExtensionId':_0x2e7c8e['id']});}_0x1bef8f[_0x9308('0xd')]({'type':_0x2e7c8e[_0x9308('0x2')],'app':'Set','appdata':_0x9308('0xe'),'context':_0x2e7c8e[_0x9308('0x5')],'exten':_0x2e7c8e[_0x9308('0x6')],'priority':_0x5b6985++,'VoiceExtensionId':_0x2e7c8e['id']},{'type':_0x2e7c8e[_0x9308('0x2')],'app':_0x9308('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2e7c8e[_0x9308('0x5')],'exten':_0x2e7c8e[_0x9308('0x6')],'priority':_0x5b6985++,'VoiceExtensionId':_0x2e7c8e['id']},{'type':_0x2e7c8e['type'],'app':_0x9308('0x3'),'appdata':_0x9308('0xf'),'context':_0x2e7c8e[_0x9308('0x5')],'exten':_0x2e7c8e[_0x9308('0x6')],'priority':_0x5b6985++,'VoiceExtensionId':_0x2e7c8e['id']});return _0x1bef8f;}function _0x5cad40(_0x2e48a2){var _0x5383ed=0x2;var _0x562499=[{'type':_0x9308('0x10'),'app':_0x9308('0x3'),'appdata':_0x9308('0x11'),'context':_0x2e48a2[_0x9308('0x5')],'exten':_0x2e48a2[_0x9308('0x6')],'priority':_0x5383ed++,'VoiceExtensionId':_0x2e48a2['id']},{'type':_0x9308('0x10'),'app':_0x2e48a2['alias']?_0x9308('0x3'):_0x9308('0x7'),'appdata':_0x2e48a2[_0x9308('0x8')]?_0x9308('0x9')+_0x2e48a2[_0x9308('0x8')]:_0x9308('0xa'),'context':_0x2e48a2[_0x9308('0x5')],'exten':_0x2e48a2['exten'],'priority':_0x5383ed++,'VoiceExtensionId':_0x2e48a2['id']},{'type':'outbound','app':'Set','appdata':_0x9308('0x12')+(_0x2e48a2['cutdigits']?'${EXTEN:'+_0x2e48a2[_0x9308('0x13')]+'}':'${EXTEN}'),'context':_0x2e48a2['context'],'exten':_0x2e48a2[_0x9308('0x6')],'priority':_0x5383ed++,'VoiceExtensionId':_0x2e48a2['id']},{'type':_0x9308('0x10'),'app':_0x9308('0x3'),'appdata':_0x9308('0xc')+_0x2e48a2['id'],'context':_0x2e48a2[_0x9308('0x5')],'exten':_0x2e48a2[_0x9308('0x6')],'priority':_0x5383ed++,'VoiceExtensionId':_0x2e48a2['id']},{'type':'outbound','app':_0x9308('0x14'),'appdata':_0x9308('0x15')+(_0x5383ed+0x2)+'):Goto('+(_0x5383ed+0x1)+')','context':_0x2e48a2[_0x9308('0x5')],'exten':_0x2e48a2[_0x9308('0x6')],'priority':_0x5383ed++,'VoiceExtensionId':_0x2e48a2['id']},{'type':_0x9308('0x10'),'app':_0x9308('0x3'),'appdata':_0x2e48a2[_0x9308('0x13')]?_0x9308('0x16')+_0x2e48a2['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x2e48a2[_0x9308('0x5')],'exten':_0x2e48a2[_0x9308('0x6')],'priority':_0x5383ed++,'VoiceExtensionId':_0x2e48a2['id']},{'type':_0x9308('0x10'),'app':_0x9308('0x3'),'appdata':_0x9308('0xe'),'context':_0x2e48a2[_0x9308('0x5')],'exten':_0x2e48a2[_0x9308('0x6')],'priority':_0x5383ed++,'VoiceExtensionId':_0x2e48a2['id']},{'type':_0x9308('0x10'),'app':'Set','appdata':_0x9308('0x17'),'context':_0x2e48a2[_0x9308('0x5')],'exten':_0x2e48a2[_0x9308('0x6')],'priority':_0x5383ed++,'VoiceExtensionId':_0x2e48a2['id']},{'type':'outbound','app':_0x9308('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0x2e48a2[_0x9308('0x5')],'exten':_0x2e48a2['exten'],'priority':_0x5383ed++,'VoiceExtensionId':_0x2e48a2['id']},{'type':_0x9308('0x10'),'app':_0x9308('0x3'),'appdata':_0x9308('0x18')+_0x2e48a2['id'],'context':_0x2e48a2[_0x9308('0x5')],'exten':_0x2e48a2[_0x9308('0x6')],'priority':_0x5383ed++,'VoiceExtensionId':_0x2e48a2['id']}];if(_0x2e48a2[_0x9308('0x19')](_0x9308('0x1a'))&&_0x2e48a2['recordingFormat']!=='none'){_0x562499[_0x9308('0xd')]({'type':_0x9308('0x10'),'app':_0x9308('0x3'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x2e48a2[_0x9308('0x5')],'exten':_0x2e48a2[_0x9308('0x6')],'priority':_0x5383ed++,'VoiceExtensionId':_0x2e48a2['id']},{'type':'outbound','app':_0x9308('0x3'),'appdata':_0x9308('0x1b')+_0x2e48a2['recordingFormat']||_0x9308('0x1c'),'context':_0x2e48a2['context'],'exten':_0x2e48a2[_0x9308('0x6')],'priority':_0x5383ed++,'VoiceExtensionId':_0x2e48a2['id']});}return _0x562499;}function _0x172fbc(_0x2d769f){var _0x137335=[{'name':_0x9308('0x1d'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x9308('0x1e'),'param':0x2},{'name':_0x9308('0x1f'),'param':0x3}];var _0x44f67f={};var _0x412e1a=_0x2d769f[_0x9308('0x20')](',');var _0x475532=[];for(var _0x3a0110=0x0;_0x3a0110<_0x137335[_0x9308('0x21')];_0x3a0110++){switch(_0x137335[_0x3a0110]['name']){case'trunk':_0x44f67f[_0x9308('0x1d')]=_0x412e1a[_0x137335[_0x3a0110][_0x9308('0x22')]][_0x9308('0x20')]('/')[0x1];_0x44f67f[_0x9308('0x23')]=_0x412e1a[_0x137335[_0x3a0110][_0x9308('0x22')]]['split']('/')[0x2];_0x44f67f[_0x9308('0x24')]=_0x44f67f[_0x9308('0x23')]?_0x44f67f[_0x9308('0x23')][_0x9308('0x20')]('$')[0x0]:undefined;_0x44f67f['phone']=route[_0x9308('0x13')]?(_0x44f67f[_0x9308('0x24')]||'')+_0x9308('0x25')+route[_0x9308('0x13')]+'}':(_0x44f67f[_0x9308('0x24')]||'')+_0x9308('0x26');_0x475532[_0x137335[_0x3a0110]['param']]=['SIP',_0x44f67f['trunk'],_0x44f67f['phone']][_0x9308('0x27')]('/');break;case'options':_0x44f67f[_0x9308('0x1e')]=_0x412e1a[_0x137335[_0x3a0110][_0x9308('0x22')]];if(route[_0x9308('0x1a')]!=='none'){if(_0x44f67f[_0x9308('0x1e')][_0x9308('0x28')](_0x9308('0x29'))<0x0){_0x44f67f[_0x9308('0x1e')]+='U(xcally-mixmonitor-context)';}}else{_0x44f67f['options']=_0x44f67f[_0x9308('0x1e')]['replace'](_0x9308('0x29'),'');}_0x475532[_0x137335[_0x3a0110][_0x9308('0x22')]]=_0x44f67f[_0x9308('0x1e')];break;default:_0x475532[_0x137335[_0x3a0110][_0x9308('0x22')]]=_0x412e1a[_0x137335[_0x3a0110][_0x9308('0x22')]];}}return _0x475532[_0x9308('0x27')](',');}function _0x1f6299(_0x3e4669,_0x3be2d0,_0x86a250,_0x376efb){return new Promise(function(_0x403e5e,_0x8ca5f5){var _0x134c64=[];if(_[_0x9308('0x2a')](_0x3be2d0))return _0x403e5e(_0x134c64);_0x4caae0[_0x9308('0x2b')][_0x9308('0x2c')]({'attributes':['id',_0x9308('0x2d'),'IntervalId'],'raw':!![]})['then'](function(_0x298a3d){for(var _0x1a398e=0x0,_0x1727f8=0x0;_0x1a398e<_0x3be2d0[_0x9308('0x21')];_0x1a398e++,_0x1727f8=0x0){var _0x279717=_0x3be2d0[_0x1a398e];var _0x3eccd4=[];var _0x412dd9=[];if(_0x279717[_0x9308('0x2d')]!==_0x9308('0x2e')){_0x279717[_0x9308('0x2f')]=[_0x279717[_0x9308('0x2d')]];}else{_0x279717['intervals']=_0x279717[_0x9308('0x30')]?_[_0x9308('0x31')](_[_0x9308('0x32')](_0x298a3d,{'IntervalId':_0x279717[_0x9308('0x30')]}),_0x9308('0x2d')):[];}_0x279717['context']=_0x3e4669['context'];_0x279717[_0x9308('0x6')]=_0x3e4669[_0x9308('0x6')];if(_0x279717['type'])_0x279717[_0x9308('0x2')]=_0x279717['type'][_0x9308('0x33')]();if(_0x3e4669[_0x9308('0x2')]===_0x9308('0x10')){if(_0x279717[_0x9308('0x19')](_0x9308('0x34'))&&_0x279717['tag']&&_0x279717[_0x9308('0x34')]!=='--'){_0x3eccd4[_0x9308('0xd')]({'type':_0x279717[_0x9308('0x2')][_0x9308('0x33')](),'app':_0x9308('0x3'),'appdata':'CDR(tag)='+_0x279717[_0x9308('0x34')],'context':_0x3e4669[_0x9308('0x5')],'exten':_0x3e4669[_0x9308('0x6')],'priority':_0x279717[_0x9308('0x2f')][_0x9308('0x21')]+_0x86a250+_0x1727f8++,'VoiceExtensionId':_0x3e4669['id']});}_0x3eccd4['push']({'type':_0x279717['type'][_0x9308('0x33')](),'app':_0x9308('0x14'),'appdata':_0x9308('0x35')+(_0x279717[_0x9308('0x36')]?_0x9308('0x37')+_0x279717[_0x9308('0x36')]+')':'NoOp(No\x20number\x20available)'),'context':_0x3e4669['context'],'exten':_0x3e4669[_0x9308('0x6')],'priority':_0x279717['intervals']['length']+_0x86a250+_0x1727f8++,'VoiceExtensionId':_0x3e4669['id']});}else{if(_0x279717[_0x9308('0x19')]('answer')){if([_0x9308('0x38'),'playback'][_0x9308('0x39')](_0x279717[_0x9308('0x3a')][_0x9308('0x33')]())&&_0x279717[_0x9308('0x3b')]!==_0x9308('0x3c')){if(_0x279717['answer']){_0x3eccd4[_0x9308('0xd')]({'type':_0x279717[_0x9308('0x2')][_0x9308('0x33')](),'app':_0x9308('0x14'),'appdata':_0x9308('0x3d'),'context':_0x3e4669[_0x9308('0x5')],'exten':_0x3e4669[_0x9308('0x6')],'priority':_0x279717[_0x9308('0x2f')][_0x9308('0x21')]+_0x86a250+_0x1727f8++,'VoiceExtensionId':_0x3e4669['id']});_0x3eccd4['push']({'type':_0x279717[_0x9308('0x2')][_0x9308('0x33')](),'app':_0x9308('0x3'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3e4669[_0x9308('0x5')],'exten':_0x3e4669[_0x9308('0x6')],'priority':_0x279717[_0x9308('0x2f')][_0x9308('0x21')]+_0x86a250+_0x1727f8++,'VoiceExtensionId':_0x3e4669['id']});}else{_0x3eccd4[_0x9308('0xd')]({'type':_0x279717['type']['toLowerCase'](),'app':_0x9308('0x14'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3e4669[_0x9308('0x5')],'exten':_0x3e4669[_0x9308('0x6')],'priority':_0x279717[_0x9308('0x2f')][_0x9308('0x21')]+_0x86a250+_0x1727f8++,'VoiceExtensionId':_0x3e4669['id']});_0x3eccd4[_0x9308('0xd')]({'type':_0x279717[_0x9308('0x2')]['toLowerCase'](),'app':_0x9308('0x3'),'appdata':_0x9308('0x3e'),'context':_0x3e4669[_0x9308('0x5')],'exten':_0x3e4669[_0x9308('0x6')],'priority':_0x279717[_0x9308('0x2f')][_0x9308('0x21')]+_0x86a250+_0x1727f8++,'VoiceExtensionId':_0x3e4669['id']});}}}}for(var _0x5540a6=0x0;_0x5540a6<_0x279717['intervals'][_0x9308('0x21')];_0x5540a6++){var _0x231f85=_0x86a250+_0x279717[_0x9308('0x2f')][_0x9308('0x21')];var _0x54d5ee=_0x5540a6===_0x279717[_0x9308('0x2f')][_0x9308('0x21')]-0x1?_0x86a250+_0x3eccd4[_0x9308('0x21')]+_0x412dd9[_0x9308('0x21')]+0x2:_0x86a250+_0x5540a6+0x1;_0x3eccd4[_0x9308('0x3f')](_0x5540a6,0x0,{'type':_0x3e4669[_0x9308('0x2')],'app':'GotoIfTime','appdata':_0x279717['intervals'][_0x5540a6]+'?'+_0x3e4669[_0x9308('0x5')]+_0x9308('0x40')+_0x231f85+':'+_0x3e4669['context']+_0x9308('0x40')+_0x54d5ee,'exten':_0x3e4669[_0x9308('0x6')],'context':_0x3e4669[_0x9308('0x5')],'priority':_0x86a250+_0x5540a6,'VoiceExtensionId':_0x3e4669['id']});}if(_0x376efb&&_0x279717[_0x9308('0x3b')]===_0x9308('0x41'))_0x279717[_0x9308('0x42')]=_0x172fbc(_0x279717[_0x9308('0x42')]);_0x279717[_0x9308('0x43')]=_0x3eccd4[_0x9308('0x21')]?_[_0x9308('0x44')](_0x3eccd4)['priority']+0x1:_0x86a250;_0x134c64=_[_0x9308('0x45')](_0x134c64,_0x3eccd4,[_0x279717],_0x412dd9);_0x86a250=_[_0x9308('0x44')](_0x134c64)['priority']+0x1;}return _0x403e5e(_0x134c64);})[_0x9308('0x46')](function(_0x3a01a6){_0x8ca5f5(_0x3a01a6);});});}return _0x4420ab[_0x9308('0x47')](_0x9308('0x48'),attributes,{'tableName':_0x9308('0x49'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1cb93c,_0xfe4ea2){var _0x5a110d=this;var _0x27c231=_0x5a110d[_0x9308('0x2')]===_0x9308('0x10')?_0x5cad40(_0x5a110d):_0x356e5b(_0x5a110d);return _0x1f6299(_0x5a110d,_0x1cb93c,_['last'](_0x27c231)[_0x9308('0x43')]+0x1,_0xfe4ea2)['then'](function(_0x524eb9){var _0x3e5f8d=_[_0x9308('0x45')](_0x27c231,_0x524eb9);_0x3e5f8d[_0x9308('0xd')]({'type':_0x5a110d[_0x9308('0x2')],'app':_0x9308('0x4a'),'exten':_0x5a110d[_0x9308('0x6')],'context':_0x5a110d['context'],'priority':_[_0x9308('0x44')](_0x3e5f8d)[_0x9308('0x43')]+0x1,'VoiceExtensionId':_0x5a110d['id']});return _0x3e5f8d;});}}});}; \ No newline at end of file +var _0x96ee=['phone','prefix','${EXTEN:','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','hasOwnProperty','tag','CDR(tag)=','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','playback','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','define','voice_extensions','Hangup','util','lodash','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','length','name','param'];(function(_0x3a0956,_0x46169e){var _0x4b5e18=function(_0x5ce670){while(--_0x5ce670){_0x3a0956['push'](_0x3a0956['shift']());}};_0x4b5e18(++_0x46169e);}(_0x96ee,0x12b));var _0xe96e=function(_0x19c315,_0x2b2e84){_0x19c315=_0x19c315-0x0;var _0x3dc378=_0x96ee[_0x19c315];return _0x3dc378;};'use strict';var util=require(_0xe96e('0x0'));var _=require(_0xe96e('0x1'));var attributes=require(_0xe96e('0x2'));module[_0xe96e('0x3')]=function(_0x54b908){var _0x35da8b=_0x54b908[_0xe96e('0x4')];function _0x1bdd11(_0x4f6189){var _0x51068b=0x2;var _0x2aeea5=[{'type':_0x4f6189['type'],'app':_0xe96e('0x5'),'appdata':_0xe96e('0x6')+_0x4f6189[_0xe96e('0x7')],'context':_0x4f6189[_0xe96e('0x8')],'exten':_0x4f6189[_0xe96e('0x9')],'priority':_0x51068b++,'VoiceExtensionId':_0x4f6189['id']},{'type':_0x4f6189[_0xe96e('0x7')],'app':_0x4f6189[_0xe96e('0xa')]?_0xe96e('0x5'):_0xe96e('0xb'),'appdata':_0x4f6189[_0xe96e('0xa')]?_0xe96e('0xc')+_0x4f6189['alias']:_0xe96e('0xd'),'context':_0x4f6189[_0xe96e('0x8')],'exten':_0x4f6189[_0xe96e('0x9')],'priority':_0x51068b++,'VoiceExtensionId':_0x4f6189['id']}];if(_0x4f6189[_0xe96e('0x7')]===_0xe96e('0xe')){_0x2aeea5['push']({'type':'inbound','app':_0xe96e('0x5'),'appdata':'CDR(routeid)='+_0x4f6189['id'],'context':_0x4f6189['context'],'exten':_0x4f6189[_0xe96e('0x9')],'priority':_0x51068b++,'VoiceExtensionId':_0x4f6189['id']});}_0x2aeea5[_0xe96e('0xf')]({'type':_0x4f6189[_0xe96e('0x7')],'app':_0xe96e('0x5'),'appdata':_0xe96e('0x10'),'context':_0x4f6189[_0xe96e('0x8')],'exten':_0x4f6189[_0xe96e('0x9')],'priority':_0x51068b++,'VoiceExtensionId':_0x4f6189['id']},{'type':_0x4f6189[_0xe96e('0x7')],'app':_0xe96e('0x5'),'appdata':_0xe96e('0x11'),'context':_0x4f6189[_0xe96e('0x8')],'exten':_0x4f6189['exten'],'priority':_0x51068b++,'VoiceExtensionId':_0x4f6189['id']},{'type':_0x4f6189[_0xe96e('0x7')],'app':_0xe96e('0x5'),'appdata':_0xe96e('0x12'),'context':_0x4f6189[_0xe96e('0x8')],'exten':_0x4f6189[_0xe96e('0x9')],'priority':_0x51068b++,'VoiceExtensionId':_0x4f6189['id']});return _0x2aeea5;}function _0x2c06c7(_0x559115){var _0x1a13d8=0x2;var _0x38e963=[{'type':_0xe96e('0x13'),'app':_0xe96e('0x5'),'appdata':_0xe96e('0x14'),'context':_0x559115[_0xe96e('0x8')],'exten':_0x559115[_0xe96e('0x9')],'priority':_0x1a13d8++,'VoiceExtensionId':_0x559115['id']},{'type':'outbound','app':_0x559115[_0xe96e('0xa')]?'Set':_0xe96e('0xb'),'appdata':_0x559115[_0xe96e('0xa')]?_0xe96e('0xc')+_0x559115[_0xe96e('0xa')]:_0xe96e('0xd'),'context':_0x559115[_0xe96e('0x8')],'exten':_0x559115[_0xe96e('0x9')],'priority':_0x1a13d8++,'VoiceExtensionId':_0x559115['id']},{'type':'outbound','app':_0xe96e('0x5'),'appdata':_0xe96e('0x15')+(_0x559115[_0xe96e('0x16')]?'${EXTEN:'+_0x559115[_0xe96e('0x16')]+'}':_0xe96e('0x17')),'context':_0x559115[_0xe96e('0x8')],'exten':_0x559115[_0xe96e('0x9')],'priority':_0x1a13d8++,'VoiceExtensionId':_0x559115['id']},{'type':'outbound','app':_0xe96e('0x5'),'appdata':_0xe96e('0x18')+_0x559115['id'],'context':_0x559115[_0xe96e('0x8')],'exten':_0x559115[_0xe96e('0x9')],'priority':_0x1a13d8++,'VoiceExtensionId':_0x559115['id']},{'type':_0xe96e('0x13'),'app':_0xe96e('0x19'),'appdata':_0xe96e('0x1a')+(_0x1a13d8+0x2)+_0xe96e('0x1b')+(_0x1a13d8+0x1)+')','context':_0x559115['context'],'exten':_0x559115[_0xe96e('0x9')],'priority':_0x1a13d8++,'VoiceExtensionId':_0x559115['id']},{'type':'outbound','app':_0xe96e('0x5'),'appdata':_0x559115[_0xe96e('0x16')]?'CDR(prefix)=${EXTEN:0:'+_0x559115[_0xe96e('0x16')]+'}':_0xe96e('0x1c'),'context':_0x559115['context'],'exten':_0x559115[_0xe96e('0x9')],'priority':_0x1a13d8++,'VoiceExtensionId':_0x559115['id']},{'type':_0xe96e('0x13'),'app':_0xe96e('0x5'),'appdata':_0xe96e('0x10'),'context':_0x559115['context'],'exten':_0x559115['exten'],'priority':_0x1a13d8++,'VoiceExtensionId':_0x559115['id']},{'type':_0xe96e('0x13'),'app':_0xe96e('0x5'),'appdata':_0xe96e('0x11'),'context':_0x559115[_0xe96e('0x8')],'exten':_0x559115[_0xe96e('0x9')],'priority':_0x1a13d8++,'VoiceExtensionId':_0x559115['id']},{'type':'outbound','app':_0xe96e('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x559115['context'],'exten':_0x559115[_0xe96e('0x9')],'priority':_0x1a13d8++,'VoiceExtensionId':_0x559115['id']},{'type':_0xe96e('0x13'),'app':_0xe96e('0x5'),'appdata':_0xe96e('0x1d')+_0x559115['id'],'context':_0x559115['context'],'exten':_0x559115[_0xe96e('0x9')],'priority':_0x1a13d8++,'VoiceExtensionId':_0x559115['id']}];if(_0x559115['hasOwnProperty'](_0xe96e('0x1e'))&&_0x559115[_0xe96e('0x1e')]!==_0xe96e('0x1f')){_0x38e963[_0xe96e('0xf')]({'type':_0xe96e('0x13'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x559115[_0xe96e('0x8')],'exten':_0x559115[_0xe96e('0x9')],'priority':_0x1a13d8++,'VoiceExtensionId':_0x559115['id']},{'type':_0xe96e('0x13'),'app':_0xe96e('0x5'),'appdata':_0xe96e('0x20')+_0x559115[_0xe96e('0x1e')]||_0xe96e('0x21'),'context':_0x559115['context'],'exten':_0x559115[_0xe96e('0x9')],'priority':_0x1a13d8++,'VoiceExtensionId':_0x559115['id']});}return _0x38e963;}function _0x3e2f3c(_0x255ea8){var _0x186e56=[{'name':_0xe96e('0x22'),'param':0x0},{'name':_0xe96e('0x23'),'param':0x1},{'name':_0xe96e('0x24'),'param':0x2},{'name':'url','param':0x3}];var _0x17535d={};var _0x365828=_0x255ea8[_0xe96e('0x25')](',');var _0x3de089=[];for(var _0x529d13=0x0;_0x529d13<_0x186e56[_0xe96e('0x26')];_0x529d13++){switch(_0x186e56[_0x529d13][_0xe96e('0x27')]){case'trunk':_0x17535d['trunk']=_0x365828[_0x186e56[_0x529d13][_0xe96e('0x28')]][_0xe96e('0x25')]('/')[0x1];_0x17535d[_0xe96e('0x29')]=_0x365828[_0x186e56[_0x529d13][_0xe96e('0x28')]][_0xe96e('0x25')]('/')[0x2];_0x17535d[_0xe96e('0x2a')]=_0x17535d[_0xe96e('0x29')]?_0x17535d['phone']['split']('$')[0x0]:undefined;_0x17535d['phone']=route[_0xe96e('0x16')]?(_0x17535d[_0xe96e('0x2a')]||'')+_0xe96e('0x2b')+route[_0xe96e('0x16')]+'}':(_0x17535d['prefix']||'')+_0xe96e('0x17');_0x3de089[_0x186e56[_0x529d13][_0xe96e('0x28')]]=['SIP',_0x17535d[_0xe96e('0x22')],_0x17535d[_0xe96e('0x29')]][_0xe96e('0x2c')]('/');break;case _0xe96e('0x24'):_0x17535d[_0xe96e('0x24')]=_0x365828[_0x186e56[_0x529d13][_0xe96e('0x28')]];if(route['recordingFormat']!==_0xe96e('0x1f')){if(_0x17535d[_0xe96e('0x24')][_0xe96e('0x2d')](_0xe96e('0x2e'))<0x0){_0x17535d[_0xe96e('0x24')]+=_0xe96e('0x2e');}}else{_0x17535d[_0xe96e('0x24')]=_0x17535d[_0xe96e('0x24')][_0xe96e('0x2f')](_0xe96e('0x2e'),'');}_0x3de089[_0x186e56[_0x529d13][_0xe96e('0x28')]]=_0x17535d[_0xe96e('0x24')];break;default:_0x3de089[_0x186e56[_0x529d13][_0xe96e('0x28')]]=_0x365828[_0x186e56[_0x529d13][_0xe96e('0x28')]];}}return _0x3de089[_0xe96e('0x2c')](',');}function _0x33f744(_0x39af40,_0x12b0e0,_0x4a5c52,_0x234049){return new Promise(function(_0x54e558,_0x3d8236){var _0x4a03bb=[];if(_[_0xe96e('0x30')](_0x12b0e0))return _0x54e558(_0x4a03bb);_0x35da8b[_0xe96e('0x31')][_0xe96e('0x32')]({'attributes':['id',_0xe96e('0x33'),_0xe96e('0x34')],'raw':!![]})[_0xe96e('0x35')](function(_0x34d3ae){for(var _0x4eff5e=0x0,_0x145a90=0x0;_0x4eff5e<_0x12b0e0[_0xe96e('0x26')];_0x4eff5e++,_0x145a90=0x0){var _0x438487=_0x12b0e0[_0x4eff5e];var _0x40b262=[];var _0x102696=[];if(_0x438487[_0xe96e('0x33')]!==_0xe96e('0x36')){_0x438487['intervals']=[_0x438487[_0xe96e('0x33')]];}else{_0x438487[_0xe96e('0x37')]=_0x438487[_0xe96e('0x34')]?_[_0xe96e('0x38')](_[_0xe96e('0x39')](_0x34d3ae,{'IntervalId':_0x438487[_0xe96e('0x34')]}),_0xe96e('0x33')):[];}_0x438487[_0xe96e('0x8')]=_0x39af40[_0xe96e('0x8')];_0x438487[_0xe96e('0x9')]=_0x39af40[_0xe96e('0x9')];if(_0x438487['type'])_0x438487[_0xe96e('0x7')]=_0x438487[_0xe96e('0x7')]['toLowerCase']();if(_0x39af40[_0xe96e('0x7')]===_0xe96e('0x13')){if(_0x438487[_0xe96e('0x3a')](_0xe96e('0x3b'))&&_0x438487[_0xe96e('0x3b')]&&_0x438487[_0xe96e('0x3b')]!=='--'){_0x40b262[_0xe96e('0xf')]({'type':_0x438487[_0xe96e('0x7')]['toLowerCase'](),'app':_0xe96e('0x5'),'appdata':_0xe96e('0x3c')+_0x438487[_0xe96e('0x3b')],'context':_0x39af40[_0xe96e('0x8')],'exten':_0x39af40['exten'],'priority':_0x438487[_0xe96e('0x37')][_0xe96e('0x26')]+_0x4a5c52+_0x145a90++,'VoiceExtensionId':_0x39af40['id']});}_0x40b262[_0xe96e('0xf')]({'type':_0x438487[_0xe96e('0x7')][_0xe96e('0x3d')](),'app':_0xe96e('0x19'),'appdata':_0xe96e('0x3e')+(_0x438487[_0xe96e('0x3f')]?_0xe96e('0x40')+_0x438487[_0xe96e('0x3f')]+')':_0xe96e('0x41')),'context':_0x39af40['context'],'exten':_0x39af40[_0xe96e('0x9')],'priority':_0x438487[_0xe96e('0x37')][_0xe96e('0x26')]+_0x4a5c52+_0x145a90++,'VoiceExtensionId':_0x39af40['id']});}else{if(_0x438487['hasOwnProperty'](_0xe96e('0x42'))){if(['queue',_0xe96e('0x43')]['includes'](_0x438487[_0xe96e('0x44')]['toLowerCase']())&&_0x438487[_0xe96e('0x45')]!==_0xe96e('0x46')){if(_0x438487[_0xe96e('0x42')]){_0x40b262[_0xe96e('0xf')]({'type':_0x438487[_0xe96e('0x7')]['toLowerCase'](),'app':_0xe96e('0x19'),'appdata':_0xe96e('0x47'),'context':_0x39af40[_0xe96e('0x8')],'exten':_0x39af40[_0xe96e('0x9')],'priority':_0x438487[_0xe96e('0x37')][_0xe96e('0x26')]+_0x4a5c52+_0x145a90++,'VoiceExtensionId':_0x39af40['id']});_0x40b262[_0xe96e('0xf')]({'type':_0x438487[_0xe96e('0x7')][_0xe96e('0x3d')](),'app':_0xe96e('0x5'),'appdata':_0xe96e('0x48'),'context':_0x39af40[_0xe96e('0x8')],'exten':_0x39af40[_0xe96e('0x9')],'priority':_0x438487[_0xe96e('0x37')][_0xe96e('0x26')]+_0x4a5c52+_0x145a90++,'VoiceExtensionId':_0x39af40['id']});}else{_0x40b262[_0xe96e('0xf')]({'type':_0x438487[_0xe96e('0x7')][_0xe96e('0x3d')](),'app':_0xe96e('0x19'),'appdata':_0xe96e('0x49'),'context':_0x39af40[_0xe96e('0x8')],'exten':_0x39af40[_0xe96e('0x9')],'priority':_0x438487['intervals']['length']+_0x4a5c52+_0x145a90++,'VoiceExtensionId':_0x39af40['id']});_0x40b262[_0xe96e('0xf')]({'type':_0x438487['type'][_0xe96e('0x3d')](),'app':_0xe96e('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x39af40['context'],'exten':_0x39af40[_0xe96e('0x9')],'priority':_0x438487[_0xe96e('0x37')][_0xe96e('0x26')]+_0x4a5c52+_0x145a90++,'VoiceExtensionId':_0x39af40['id']});}}}}for(var _0x23cb0a=0x0;_0x23cb0a<_0x438487[_0xe96e('0x37')][_0xe96e('0x26')];_0x23cb0a++){var _0x3aeab9=_0x4a5c52+_0x438487[_0xe96e('0x37')]['length'];var _0x39b6f4=_0x23cb0a===_0x438487[_0xe96e('0x37')]['length']-0x1?_0x4a5c52+_0x40b262[_0xe96e('0x26')]+_0x102696[_0xe96e('0x26')]+0x2:_0x4a5c52+_0x23cb0a+0x1;_0x40b262[_0xe96e('0x4a')](_0x23cb0a,0x0,{'type':_0x39af40[_0xe96e('0x7')],'app':_0xe96e('0x4b'),'appdata':_0x438487['intervals'][_0x23cb0a]+'?'+_0x39af40[_0xe96e('0x8')]+',${EXTEN},'+_0x3aeab9+':'+_0x39af40[_0xe96e('0x8')]+_0xe96e('0x4c')+_0x39b6f4,'exten':_0x39af40[_0xe96e('0x9')],'context':_0x39af40[_0xe96e('0x8')],'priority':_0x4a5c52+_0x23cb0a,'VoiceExtensionId':_0x39af40['id']});}if(_0x234049&&_0x438487[_0xe96e('0x45')]===_0xe96e('0x4d'))_0x438487[_0xe96e('0x4e')]=_0x3e2f3c(_0x438487[_0xe96e('0x4e')]);_0x438487[_0xe96e('0x4f')]=_0x40b262[_0xe96e('0x26')]?_[_0xe96e('0x50')](_0x40b262)[_0xe96e('0x4f')]+0x1:_0x4a5c52;_0x4a03bb=_[_0xe96e('0x51')](_0x4a03bb,_0x40b262,[_0x438487],_0x102696);_0x4a5c52=_['last'](_0x4a03bb)[_0xe96e('0x4f')]+0x1;}return _0x54e558(_0x4a03bb);})['catch'](function(_0xb35296){_0x3d8236(_0xb35296);});});}return _0x54b908[_0xe96e('0x52')]('VoiceExtension',attributes,{'tableName':_0xe96e('0x53'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x9b8792,_0x540eff){var _0x48ded9=this;var _0xdc3940=_0x48ded9[_0xe96e('0x7')]===_0xe96e('0x13')?_0x2c06c7(_0x48ded9):_0x1bdd11(_0x48ded9);return _0x33f744(_0x48ded9,_0x9b8792,_[_0xe96e('0x50')](_0xdc3940)[_0xe96e('0x4f')]+0x1,_0x540eff)[_0xe96e('0x35')](function(_0x23c922){var _0x2844fe=_[_0xe96e('0x51')](_0xdc3940,_0x23c922);_0x2844fe['push']({'type':_0x48ded9[_0xe96e('0x7')],'app':_0xe96e('0x54'),'exten':_0x48ded9['exten'],'context':_0x48ded9[_0xe96e('0x8')],'priority':_['last'](_0x2844fe)[_0xe96e('0x4f')]+0x1,'VoiceExtensionId':_0x48ded9['id']});return _0x2844fe;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 7f316c7..d74925d 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 _0x10dc=['GetVoiceExtension','VoiceExtension','findAll','options','raw','limit','include','model','attributes','map','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceExtension,\x20%s,\x20%s','result','catch'];(function(_0x595861,_0x5b5a63){var _0x276379=function(_0x528dab){while(--_0x528dab){_0x595861['push'](_0x595861['shift']());}};_0x276379(++_0x5b5a63);}(_0x10dc,0x107));var _0xc10d=function(_0x3d0247,_0x2e5a09){_0x3d0247=_0x3d0247-0x0;var _0x5d2f3a=_0x10dc[_0x3d0247];return _0x5d2f3a;};'use strict';var _=require(_0xc10d('0x0'));var util=require(_0xc10d('0x1'));var moment=require('moment');var BPromise=require(_0xc10d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc10d('0x3'));var db=require(_0xc10d('0x4'))['db'];var utils=require(_0xc10d('0x5'));var logger=require(_0xc10d('0x6'))(_0xc10d('0x7'));var config=require(_0xc10d('0x8'));var jayson=require(_0xc10d('0x9'));var client=jayson[_0xc10d('0xa')]['http']({'port':0x232a});config[_0xc10d('0xb')]=_['defaults'](config['redis'],{'host':_0xc10d('0xc'),'port':0x18eb});var socket=require(_0xc10d('0xd'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0xc10d('0xe')](socket);function respondWithRpcPromise(_0x3ff52a,_0x1363e1,_0x1443ba){return new BPromise(function(_0x1b6b16,_0x4f2cf3){return client['request'](_0x3ff52a,_0x1443ba)[_0xc10d('0xf')](function(_0x5ef4ba){logger[_0xc10d('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x1363e1,_0xc10d('0x11'));logger['debug'](_0xc10d('0x12'),_0x1363e1,_0xc10d('0x11'),JSON[_0xc10d('0x13')](_0x5ef4ba));if(_0x5ef4ba[_0xc10d('0x14')]){if(_0x5ef4ba[_0xc10d('0x14')]['code']===0x1f4){logger[_0xc10d('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x1363e1,_0x5ef4ba[_0xc10d('0x14')][_0xc10d('0x15')]);return _0x4f2cf3(_0x5ef4ba[_0xc10d('0x14')][_0xc10d('0x15')]);}logger[_0xc10d('0x14')](_0xc10d('0x16'),_0x1363e1,_0x5ef4ba[_0xc10d('0x14')][_0xc10d('0x15')]);return _0x1b6b16(_0x5ef4ba['error']['message']);}else{logger[_0xc10d('0x10')](_0xc10d('0x16'),_0x1363e1,_0xc10d('0x11'));_0x1b6b16(_0x5ef4ba[_0xc10d('0x17')][_0xc10d('0x15')]);}})[_0xc10d('0x18')](function(_0x8c8cae){logger[_0xc10d('0x14')](_0xc10d('0x16'),_0x1363e1,_0x8c8cae);_0x4f2cf3(_0x8c8cae);});});}exports[_0xc10d('0x19')]=function(_0x28f7b5){var _0xb1016b=this;return new Promise(function(_0x2dccea,_0x49d9d5){return db[_0xc10d('0x1a')][_0xc10d('0x1b')]({'raw':_0x28f7b5['options']?_0x28f7b5[_0xc10d('0x1c')][_0xc10d('0x1d')]===undefined?!![]:![]:!![],'where':_0x28f7b5['options']?_0x28f7b5[_0xc10d('0x1c')]['where']||null:null,'attributes':_0x28f7b5['options']?_0x28f7b5[_0xc10d('0x1c')]['attributes']||null:null,'limit':_0x28f7b5['options']?_0x28f7b5[_0xc10d('0x1c')][_0xc10d('0x1e')]||null:null,'include':_0x28f7b5[_0xc10d('0x1c')]?_0x28f7b5[_0xc10d('0x1c')][_0xc10d('0x1f')]?_['map'](_0x28f7b5['options'][_0xc10d('0x1f')],function(_0x22b732){return{'model':db[_0x22b732[_0xc10d('0x20')]],'as':_0x22b732['as'],'attributes':_0x22b732[_0xc10d('0x21')],'include':_0x22b732['include']?_[_0xc10d('0x22')](_0x22b732[_0xc10d('0x1f')],function(_0x298de1){return{'model':db[_0x298de1['model']],'as':_0x298de1['as'],'attributes':_0x298de1['attributes'],'include':_0x298de1[_0xc10d('0x1f')]?_[_0xc10d('0x22')](_0x298de1[_0xc10d('0x1f')],function(_0x497b8a){return{'model':db[_0x497b8a[_0xc10d('0x20')]],'as':_0x497b8a['as'],'attributes':_0x497b8a['attributes']};}):[]};}):[]};}):[]:[]})[_0xc10d('0xf')](function(_0x568a38){logger['info']('GetVoiceExtension',_0x28f7b5);logger[_0xc10d('0x23')](_0xc10d('0x19'),_0x28f7b5,JSON[_0xc10d('0x13')](_0x568a38));_0x2dccea(_0x568a38);})[_0xc10d('0x18')](function(_0x487f08){logger[_0xc10d('0x14')](_0xc10d('0x19'),_0x487f08[_0xc10d('0x15')],_0x28f7b5);_0x49d9d5(_0xb1016b[_0xc10d('0x14')](0x1f4,_0x487f08[_0xc10d('0x15')]));});});}; \ No newline at end of file +var _0x8e20=['socket.io-emitter','./voiceExtension.socket','register','request','then','request\x20sent','error','code','message','info','VoiceExtension,\x20%s,\x20%s','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','include','map','model','debug','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8e20,0x1af));var _0x08e2=function(_0x512c83,_0x42a67a){_0x512c83=_0x512c83-0x0;var _0x1f7f25=_0x8e20[_0x512c83];return _0x1f7f25;};'use strict';var _=require(_0x08e2('0x0'));var util=require(_0x08e2('0x1'));var moment=require(_0x08e2('0x2'));var BPromise=require('bluebird');var rs=require(_0x08e2('0x3'));var fs=require('fs');var Redis=require(_0x08e2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x08e2('0x5'));var logger=require(_0x08e2('0x6'))(_0x08e2('0x7'));var config=require(_0x08e2('0x8'));var jayson=require(_0x08e2('0x9'));var client=jayson['client'][_0x08e2('0xa')]({'port':0x232a});config[_0x08e2('0xb')]=_['defaults'](config[_0x08e2('0xb')],{'host':_0x08e2('0xc'),'port':0x18eb});var socket=require(_0x08e2('0xd'))(new Redis(config[_0x08e2('0xb')]));require(_0x08e2('0xe'))[_0x08e2('0xf')](socket);function respondWithRpcPromise(_0x59365f,_0x127f5f,_0x4eb644){return new BPromise(function(_0x4b66b8,_0x1ae554){return client[_0x08e2('0x10')](_0x59365f,_0x4eb644)[_0x08e2('0x11')](function(_0x2538c8){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x127f5f,_0x08e2('0x12'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x127f5f,_0x08e2('0x12'),JSON['stringify'](_0x2538c8));if(_0x2538c8[_0x08e2('0x13')]){if(_0x2538c8['error'][_0x08e2('0x14')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x127f5f,_0x2538c8['error'][_0x08e2('0x15')]);return _0x1ae554(_0x2538c8[_0x08e2('0x13')][_0x08e2('0x15')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x127f5f,_0x2538c8['error']['message']);return _0x4b66b8(_0x2538c8['error']['message']);}else{logger[_0x08e2('0x16')](_0x08e2('0x17'),_0x127f5f,_0x08e2('0x12'));_0x4b66b8(_0x2538c8[_0x08e2('0x18')][_0x08e2('0x15')]);}})[_0x08e2('0x19')](function(_0x38f6d1){logger[_0x08e2('0x13')](_0x08e2('0x17'),_0x127f5f,_0x38f6d1);_0x1ae554(_0x38f6d1);});});}exports[_0x08e2('0x1a')]=function(_0x2384a3){var _0x5d1568=this;return new Promise(function(_0x5e3cba,_0x52787e){return db[_0x08e2('0x1b')][_0x08e2('0x1c')]({'raw':_0x2384a3['options']?_0x2384a3[_0x08e2('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2384a3[_0x08e2('0x1d')]?_0x2384a3['options'][_0x08e2('0x1e')]||null:null,'attributes':_0x2384a3[_0x08e2('0x1d')]?_0x2384a3[_0x08e2('0x1d')][_0x08e2('0x1f')]||null:null,'limit':_0x2384a3[_0x08e2('0x1d')]?_0x2384a3['options']['limit']||null:null,'include':_0x2384a3['options']?_0x2384a3[_0x08e2('0x1d')][_0x08e2('0x20')]?_[_0x08e2('0x21')](_0x2384a3[_0x08e2('0x1d')][_0x08e2('0x20')],function(_0x4dbf2c){return{'model':db[_0x4dbf2c['model']],'as':_0x4dbf2c['as'],'attributes':_0x4dbf2c[_0x08e2('0x1f')],'include':_0x4dbf2c[_0x08e2('0x20')]?_[_0x08e2('0x21')](_0x4dbf2c[_0x08e2('0x20')],function(_0x4d1b29){return{'model':db[_0x4d1b29[_0x08e2('0x22')]],'as':_0x4d1b29['as'],'attributes':_0x4d1b29['attributes'],'include':_0x4d1b29[_0x08e2('0x20')]?_[_0x08e2('0x21')](_0x4d1b29[_0x08e2('0x20')],function(_0x5cdfb2){return{'model':db[_0x5cdfb2[_0x08e2('0x22')]],'as':_0x5cdfb2['as'],'attributes':_0x5cdfb2[_0x08e2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x08e2('0x11')](function(_0x24a633){logger['info'](_0x08e2('0x1a'),_0x2384a3);logger[_0x08e2('0x23')](_0x08e2('0x1a'),_0x2384a3,JSON[_0x08e2('0x24')](_0x24a633));_0x5e3cba(_0x24a633);})['catch'](function(_0x2ab732){logger[_0x08e2('0x13')]('GetVoiceExtension',_0x2ab732[_0x08e2('0x15')],_0x2384a3);_0x52787e(_0x5d1568['error'](0x1f4,_0x2ab732['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index a28489c..010a4ce 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 _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x5949b2,_0x14752f){var _0x1209b1=function(_0x1d8f4b){while(--_0x1d8f4b){_0x5949b2['push'](_0x5949b2['shift']());}};_0x1209b1(++_0x14752f);}(_0xf494,0x1c6));var _0x4f49=function(_0x1a5149,_0x19970e){_0x1a5149=_0x1a5149-0x0;var _0x56be1c=_0xf494[_0x1a5149];return _0x56be1c;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file +var _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x814b,0x1a2));var _0xb814=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x814b[_0x35e92e];return _0x1205a8;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index fb03675..035adec 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 _0xf2e3=['/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get'];(function(_0x6eda7e,_0x4d800d){var _0x59e4ea=function(_0x1ff792){while(--_0x1ff792){_0x6eda7e['push'](_0x6eda7e['shift']());}};_0x59e4ea(++_0x4d800d);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xf2e3[_0x4a53d];return _0x27410e;};'use strict';var multer=require(_0x3f2e('0x0'));var util=require('util');var path=require(_0x3f2e('0x1'));var timeout=require(_0x3f2e('0x2'));var express=require(_0x3f2e('0x3'));var router=express[_0x3f2e('0x4')]();var fs_extra=require(_0x3f2e('0x5'));var auth=require(_0x3f2e('0x6'));var interaction=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var controller=require(_0x3f2e('0x9'));router['get']('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xb')]);router[_0x3f2e('0xc')](_0x3f2e('0xd'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xe')]);router[_0x3f2e('0xc')](_0x3f2e('0xf'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x10')]);router[_0x3f2e('0x11')]('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x12')]);router[_0x3f2e('0x13')](_0x3f2e('0xd'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x14')]);router[_0x3f2e('0x15')](_0x3f2e('0xd'),auth['isAuthenticated'](),controller[_0x3f2e('0x16')]);module[_0x3f2e('0x17')]=router; \ No newline at end of file +var _0x4819=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','/:id','show','get','/:id/messages','getMessages','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x4fce39,_0x12a415){var _0x2bcbf8=function(_0x9d5e3a){while(--_0x9d5e3a){_0x4fce39['push'](_0x4fce39['shift']());}};_0x2bcbf8(++_0x12a415);}(_0x4819,0xcd));var _0x9481=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0x4819[_0xfedc72];return _0x2c7c78;};'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 fs_extra=require(_0x9481('0x5'));var auth=require(_0x9481('0x6'));var interaction=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var controller=require(_0x9481('0x9'));router['get']('/',auth[_0x9481('0xa')](),controller['index']);router['get'](_0x9481('0xb'),auth[_0x9481('0xa')](),controller[_0x9481('0xc')]);router[_0x9481('0xd')](_0x9481('0xe'),auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['post']('/',auth[_0x9481('0xa')](),controller['create']);router[_0x9481('0x10')](_0x9481('0xb'),auth[_0x9481('0xa')](),controller[_0x9481('0x11')]);router[_0x9481('0x12')](_0x9481('0xb'),auth[_0x9481('0xa')](),controller[_0x9481('0x13')]);module[_0x9481('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index f95652f..5c96e5d 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 _0xef34=['trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0x4dd8b2,_0x7421f7){var _0x28fb0a=function(_0x3882fd){while(--_0x3882fd){_0x4dd8b2['push'](_0x4dd8b2['shift']());}};_0x28fb0a(++_0x7421f7);}(_0xef34,0xc9));var _0x4ef3=function(_0x19db2d,_0x5eba20){_0x19db2d=_0x19db2d-0x0;var _0x4b3a51=_0xef34[_0x19db2d];return _0x4b3a51;};'use strict';var Sequelize=require(_0x4ef3('0x0'));module[_0x4ef3('0x1')]={'customer_id':{'type':Sequelize[_0x4ef3('0x2')]},'context':{'type':Sequelize[_0x4ef3('0x2')],'defaultValue':_0x4ef3('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x4ef3('0x4')},'password':{'type':Sequelize[_0x4ef3('0x2')]},'fullname':{'type':Sequelize[_0x4ef3('0x2')]},'email':{'type':Sequelize[_0x4ef3('0x2')],'validate':{'isEmail':!![]},'set':function(_0x21d3aa){this[_0x4ef3('0x5')](_0x4ef3('0x6'),typeof _0x21d3aa===_0x4ef3('0x7')&&_0x21d3aa['trim']()?_0x21d3aa[_0x4ef3('0x8')]():null);}},'pager':{'type':Sequelize[_0x4ef3('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x4ef3('0x9')},'attach':{'type':Sequelize[_0x4ef3('0xa')](_0x4ef3('0xb'),'no'),'defaultValue':_0x4ef3('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0x4ef3('0xa')](_0x4ef3('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x4ef3('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0x4ef3('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x4ef3('0xa')](_0x4ef3('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x4ef3('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x4ef3('0xa')](_0x4ef3('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4ef3('0xa')](_0x4ef3('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4ef3('0xa')](_0x4ef3('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4ef3('0xa')](_0x4ef3('0xb'),'no'),'defaultValue':_0x4ef3('0xb'),'allowNull':![]},'forcename':{'type':Sequelize[_0x4ef3('0xa')](_0x4ef3('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x4ef3('0xa')](_0x4ef3('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4ef3('0xa')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x4ef3('0xc')},'emailsubject':{'type':Sequelize[_0x4ef3('0x2')]},'emailbody':{'type':Sequelize[_0x4ef3('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x4ef3('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4ef3('0xe')],'get':function(){return this[_0x4ef3('0xf')](_0x4ef3('0x10'))+_0x4ef3('0x11')+this[_0x4ef3('0xf')](_0x4ef3('0x12'));}}}; \ No newline at end of file +var _0x7e10=['sequelize','exports','STRING','contest_mailbox','setDataValue','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox'];(function(_0x25dc23,_0x255897){var _0x54ffa2=function(_0x3484ac){while(--_0x3484ac){_0x25dc23['push'](_0x25dc23['shift']());}};_0x54ffa2(++_0x255897);}(_0x7e10,0x120));var _0x07e1=function(_0x4b8c44,_0x4af940){_0x4b8c44=_0x4b8c44-0x0;var _0x10ac00=_0x7e10[_0x4b8c44];return _0x10ac00;};'use strict';var Sequelize=require(_0x07e1('0x0'));module[_0x07e1('0x1')]={'customer_id':{'type':Sequelize[_0x07e1('0x2')]},'context':{'type':Sequelize[_0x07e1('0x2')],'defaultValue':'from-voicemail','unique':_0x07e1('0x3')},'mailbox':{'type':Sequelize[_0x07e1('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x07e1('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x07e1('0x2')],'validate':{'isEmail':!![]},'set':function(_0x19c53e){this[_0x07e1('0x4')]('email',typeof _0x19c53e==='string'&&_0x19c53e[_0x07e1('0x5')]()?_0x19c53e['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x07e1('0x2')],'defaultValue':_0x07e1('0x6')},'attach':{'type':Sequelize[_0x07e1('0x7')](_0x07e1('0x8'),'no'),'defaultValue':_0x07e1('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x07e1('0x7')](_0x07e1('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x07e1('0x2')]},'callback':{'type':Sequelize[_0x07e1('0x2')]},'review':{'type':Sequelize[_0x07e1('0x7')](_0x07e1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x07e1('0x7')](_0x07e1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x07e1('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x07e1('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x07e1('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x07e1('0x8'),'no'),'defaultValue':_0x07e1('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x07e1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x07e1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x07e1('0x7')](_0x07e1('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x07e1('0xa')},'emailsubject':{'type':Sequelize[_0x07e1('0x2')]},'emailbody':{'type':Sequelize[_0x07e1('0x2')]},'maxsecs':{'type':Sequelize[_0x07e1('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x07e1('0xc')],'get':function(){return this[_0x07e1('0xd')](_0x07e1('0xe'))+'\x20-\x20'+this[_0x07e1('0xd')](_0x07e1('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 321e5df..da178ad 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 _0x58a4=['catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','pick','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x5ab7c8,_0x19b852){var _0x2884ea=function(_0x4976f9){while(--_0x4976f9){_0x5ab7c8['push'](_0x5ab7c8['shift']());}};_0x2884ea(++_0x19b852);}(_0x58a4,0xbf));var _0x458a=function(_0x2170b1,_0x5c99e9){_0x2170b1=_0x2170b1-0x0;var _0x4be2c3=_0x58a4[_0x2170b1];return _0x4be2c3;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];function respondWithStatusCode(_0xee09c6,_0x2a4934){_0x2a4934=_0x2a4934||0xcc;return function(_0x2e788b){if(_0x2e788b){return _0xee09c6['sendStatus'](_0x2a4934);}return _0xee09c6['status'](_0x2a4934)[_0x458a('0x1a')]();};}function respondWithResult(_0x56436f,_0x2c7528){_0x2c7528=_0x2c7528||0xc8;return function(_0x44f683){if(_0x44f683){return _0x56436f[_0x458a('0x1b')](_0x2c7528)[_0x458a('0x1c')](_0x44f683);}};}function respondWithFilteredResult(_0xad80f9,_0x29acee){return function(_0x507b0f){if(_0x507b0f){var _0x4b26be=typeof _0x29acee['offset']===_0x458a('0x1d')&&typeof _0x29acee[_0x458a('0x1e')]===_0x458a('0x1d');var _0x5c5b41=_0x507b0f[_0x458a('0x1f')];var _0x260c87=_0x4b26be?0x0:_0x29acee[_0x458a('0x20')];var _0x392986=_0x4b26be?_0x507b0f[_0x458a('0x1f')]:_0x29acee['offset']+_0x29acee['limit'];var _0x178db9;if(_0x392986>=_0x5c5b41){_0x392986=_0x5c5b41;_0x178db9=0xc8;}else{_0x178db9=0xce;}_0xad80f9['status'](_0x178db9);return _0xad80f9[_0x458a('0x21')](_0x458a('0x22'),_0x260c87+'-'+_0x392986+'/'+_0x5c5b41)['json'](_0x507b0f);}return null;};}function patchUpdates(_0x468416){return function(_0x55a588){try{jsonpatch[_0x458a('0x23')](_0x55a588,_0x468416,!![]);}catch(_0x1c79cb){return BPromise['reject'](_0x1c79cb);}return _0x55a588[_0x458a('0x24')]();};}function saveUpdates(_0xead884,_0x5a2bcb){return function(_0xa6b8ff){if(_0xa6b8ff){return _0xa6b8ff['update'](_0xead884)[_0x458a('0x25')](function(_0x5bca42){return _0x5bca42;});}return null;};}function removeEntity(_0x4080fc,_0x5dfc6c){return function(_0x36b08e){if(_0x36b08e){return _0x36b08e[_0x458a('0x26')]()[_0x458a('0x25')](function(){var _0xcda8cc=_0x36b08e[_0x458a('0x27')]({'plain':!![]});var _0x19bd5=_0x458a('0x28');return db[_0x458a('0x29')][_0x458a('0x26')]({'where':{'type':_0x19bd5,'resourceId':_0xcda8cc['id']}})[_0x458a('0x25')](function(){return _0x36b08e;});})[_0x458a('0x25')](function(){_0x4080fc[_0x458a('0x1b')](0xcc)[_0x458a('0x1a')]();});}};}function handleEntityNotFound(_0x5a55b7,_0xb94bd9){return function(_0x112fa6){if(!_0x112fa6){_0x5a55b7['sendStatus'](0x194);}return _0x112fa6;};}function handleError(_0x5df150,_0x41b23d){_0x41b23d=_0x41b23d||0x1f4;return function(_0x596fe2){logger[_0x458a('0x2a')](_0x596fe2[_0x458a('0x2b')]);if(_0x596fe2[_0x458a('0x2c')]){delete _0x596fe2['name'];}_0x5df150[_0x458a('0x1b')](_0x41b23d)[_0x458a('0x2d')](_0x596fe2);};}exports[_0x458a('0x2e')]=function(_0x562c36,_0x47e20d){var _0x18c890={},_0x4cf059={},_0x185f1c={'count':0x0,'rows':[]};var _0x56e0b9=_[_0x458a('0x2f')](db[_0x458a('0x30')]['rawAttributes'],function(_0x309a6a){return{'name':_0x309a6a[_0x458a('0x31')],'type':_0x309a6a[_0x458a('0x32')]['key']};});_0x4cf059[_0x458a('0x33')]=_[_0x458a('0x2f')](_0x56e0b9,_0x458a('0x2c'));_0x4cf059[_0x458a('0x34')]=_[_0x458a('0x35')](_0x562c36['query']);_0x4cf059[_0x458a('0x36')]=_[_0x458a('0x37')](_0x4cf059[_0x458a('0x33')],_0x4cf059[_0x458a('0x34')]);_0x18c890[_0x458a('0x38')]=_[_0x458a('0x37')](_0x4cf059['model'],qs[_0x458a('0x39')](_0x562c36[_0x458a('0x34')][_0x458a('0x39')]));_0x18c890[_0x458a('0x38')]=_0x18c890[_0x458a('0x38')][_0x458a('0x3a')]?_0x18c890[_0x458a('0x38')]:_0x4cf059[_0x458a('0x33')];if(!_0x562c36[_0x458a('0x34')]['hasOwnProperty'](_0x458a('0x3b'))){_0x18c890[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x562c36[_0x458a('0x34')][_0x458a('0x1e')]);_0x18c890[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x562c36[_0x458a('0x34')][_0x458a('0x20')]);}_0x18c890[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x562c36[_0x458a('0x34')][_0x458a('0x3d')]);_0x18c890[_0x458a('0x3e')]=qs[_0x458a('0x36')](_['pick'](_0x562c36[_0x458a('0x34')],_0x4cf059[_0x458a('0x36')]),_0x56e0b9);if(_0x562c36[_0x458a('0x34')][_0x458a('0x3f')]){_0x18c890[_0x458a('0x3e')]=_[_0x458a('0x40')](_0x18c890[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x56e0b9,function(_0x41d125){if(_0x41d125[_0x458a('0x32')]!==_0x458a('0x41')){var _0x4efbeb={};_0x4efbeb[_0x41d125[_0x458a('0x2c')]]={'$like':'%'+_0x562c36[_0x458a('0x34')]['filter']+'%'};return _0x4efbeb;}})});}_0x18c890=_[_0x458a('0x40')]({},_0x18c890,_0x562c36[_0x458a('0x42')]);var _0x4286a3={'where':_0x18c890['where']};return db[_0x458a('0x30')][_0x458a('0x1f')](_0x4286a3)[_0x458a('0x25')](function(_0x1e51d2){_0x185f1c[_0x458a('0x1f')]=_0x1e51d2;if(_0x562c36[_0x458a('0x34')][_0x458a('0x43')]){_0x18c890[_0x458a('0x44')]=[{'all':!![]}];}return db['VoiceMail'][_0x458a('0x45')](_0x18c890);})[_0x458a('0x25')](function(_0x2b9030){_0x185f1c['rows']=_0x2b9030;return _0x185f1c;})[_0x458a('0x25')](respondWithFilteredResult(_0x47e20d,_0x18c890))[_0x458a('0x46')](handleError(_0x47e20d,null));};exports['show']=function(_0x598707,_0x124f64){var _0x2be08f={'raw':!![],'where':{'id':_0x598707[_0x458a('0x47')]['id']}},_0x36c391={};_0x36c391['model']=_['keys'](db[_0x458a('0x30')][_0x458a('0x48')]);_0x36c391[_0x458a('0x34')]=_[_0x458a('0x35')](_0x598707['query']);_0x36c391[_0x458a('0x36')]=_[_0x458a('0x37')](_0x36c391['model'],_0x36c391[_0x458a('0x34')]);_0x2be08f['attributes']=_[_0x458a('0x37')](_0x36c391[_0x458a('0x33')],qs[_0x458a('0x39')](_0x598707['query'][_0x458a('0x39')]));_0x2be08f[_0x458a('0x38')]=_0x2be08f[_0x458a('0x38')]['length']?_0x2be08f['attributes']:_0x36c391[_0x458a('0x33')];if(_0x598707[_0x458a('0x34')][_0x458a('0x43')]){_0x2be08f['include']=[{'all':!![]}];}_0x2be08f=_['merge']({},_0x2be08f,_0x598707[_0x458a('0x42')]);return db[_0x458a('0x30')][_0x458a('0x49')](_0x2be08f)[_0x458a('0x25')](handleEntityNotFound(_0x124f64,null))[_0x458a('0x25')](respondWithResult(_0x124f64,null))[_0x458a('0x46')](handleError(_0x124f64,null));};exports[_0x458a('0x4a')]=function(_0x30cdaf,_0xb22232){return db[_0x458a('0x30')][_0x458a('0x4a')](_0x30cdaf[_0x458a('0x4b')],{})[_0x458a('0x25')](function(_0x1b0c11){var _0x1ddc39=_0x30cdaf[_0x458a('0x4c')]['get']({'plain':!![]});if(!_0x1ddc39)throw new Error(_0x458a('0x4d'));if(_0x1ddc39[_0x458a('0x4e')]===_0x458a('0x4c')){var _0x396bb3=_0x1b0c11[_0x458a('0x27')]({'plain':!![]});var _0x5630cf='Voicemails';return db['UserProfileSection'][_0x458a('0x49')]({'where':{'name':_0x5630cf,'userProfileId':_0x1ddc39['userProfileId']},'raw':!![]})[_0x458a('0x25')](function(_0x58946){if(_0x58946&&_0x58946[_0x458a('0x4f')]===0x0){return db[_0x458a('0x29')][_0x458a('0x4a')]({'name':_0x396bb3['name'],'resourceId':_0x396bb3['id'],'type':_0x58946['name'],'sectionId':_0x58946['id']},{})[_0x458a('0x25')](function(){return _0x1b0c11;});}else{return _0x1b0c11;}})[_0x458a('0x46')](function(_0x2587a1){logger[_0x458a('0x2a')](_0x458a('0x50'),_0x2587a1);throw _0x2587a1;});}return _0x1b0c11;})['then'](respondWithResult(_0xb22232,0xc9))[_0x458a('0x46')](handleError(_0xb22232,null));};exports['update']=function(_0xa51e28,_0x5b428c){if(_0xa51e28[_0x458a('0x4b')]['id']){delete _0xa51e28['body']['id'];}return db['VoiceMail']['find']({'where':{'id':_0xa51e28[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x5b428c,null))['then'](saveUpdates(_0xa51e28[_0x458a('0x4b')],null))[_0x458a('0x25')](respondWithResult(_0x5b428c,null))[_0x458a('0x46')](handleError(_0x5b428c,null));};exports['destroy']=function(_0x2c1230,_0x212de5){return db[_0x458a('0x30')][_0x458a('0x49')]({'where':{'id':_0x2c1230[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x212de5,null))['then'](removeEntity(_0x212de5,null))[_0x458a('0x46')](handleError(_0x212de5,null));};exports[_0x458a('0x51')]=function(_0x45325f,_0x39e5b5,_0x3ab86a){return db[_0x458a('0x30')][_0x458a('0x52')]({'where':{'id':_0x45325f[_0x458a('0x47')]['id']}})['then'](handleEntityNotFound(_0x39e5b5,null))[_0x458a('0x25')](function(_0x4abe93){var _0x1f93ad;var _0x2921ba={},_0x222aa4={};_0x222aa4[_0x458a('0x33')]=_['keys'](db['VoiceMailMessage'][_0x458a('0x48')]);_0x222aa4[_0x458a('0x34')]=_[_0x458a('0x35')](_0x45325f[_0x458a('0x34')]);_0x222aa4[_0x458a('0x36')]=_[_0x458a('0x37')](_0x222aa4['model'],_0x222aa4[_0x458a('0x34')]);_0x2921ba[_0x458a('0x38')]=_['intersection'](_0x222aa4[_0x458a('0x33')],qs['fields'](_0x45325f[_0x458a('0x34')][_0x458a('0x39')]));_0x2921ba[_0x458a('0x38')]=_0x2921ba[_0x458a('0x38')][_0x458a('0x3a')]?_0x2921ba[_0x458a('0x38')]:_0x222aa4[_0x458a('0x33')];if(!_0x45325f[_0x458a('0x34')]['hasOwnProperty'](_0x458a('0x3b'))){_0x2921ba[_0x458a('0x1e')]=qs['limit'](_0x45325f[_0x458a('0x34')][_0x458a('0x1e')]);_0x2921ba['offset']=qs[_0x458a('0x20')](_0x45325f[_0x458a('0x34')]['offset']);}_0x2921ba[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x45325f['query'][_0x458a('0x3d')]);_0x2921ba[_0x458a('0x3e')]=qs[_0x458a('0x36')](_[_0x458a('0x53')](_0x45325f[_0x458a('0x34')],_0x222aa4[_0x458a('0x36')]));if(_0x45325f[_0x458a('0x34')][_0x458a('0x3f')]){_0x2921ba['where']=_[_0x458a('0x40')](_0x2921ba[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x2921ba[_0x458a('0x38')],function(_0x250238){var _0x2930ae={};_0x2930ae[_0x250238]={'$like':'%'+_0x45325f[_0x458a('0x34')][_0x458a('0x3f')]+'%'};return _0x2930ae;})});}_0x2921ba[_0x458a('0x3e')]=_[_0x458a('0x40')](_0x2921ba['where'],{'mailboxuser':_0x4abe93[_0x458a('0x54')]});_0x2921ba=_['merge']({},_0x2921ba,_0x45325f[_0x458a('0x42')]);return db[_0x458a('0x55')][_0x458a('0x56')](_0x2921ba)[_0x458a('0x25')](respondWithFilteredResult(_0x39e5b5,_0x2921ba));})[_0x458a('0x46')](handleError(_0x39e5b5,null));}; \ No newline at end of file +var _0x9354=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','map','VIRTUAL','filter','merge','options','VoiceMail','include','findAll','catch','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','VoiceMailMessage','pick','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service'];(function(_0x255692,_0x3ae94e){var _0x309e18=function(_0x2072ec){while(--_0x2072ec){_0x255692['push'](_0x255692['shift']());}};_0x309e18(++_0x3ae94e);}(_0x9354,0x96));var _0x4935=function(_0x3c40f4,_0x500b8a){_0x3c40f4=_0x3c40f4-0x0;var _0x1209d=_0x9354[_0x3c40f4];return _0x1209d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4935('0x0'));var zipdir=require(_0x4935('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4935('0x2'));var moment=require(_0x4935('0x3'));var BPromise=require(_0x4935('0x4'));var Mustache=require(_0x4935('0x5'));var util=require('util');var path=require(_0x4935('0x6'));var sox=require(_0x4935('0x7'));var csv=require(_0x4935('0x8'));var ejs=require(_0x4935('0x9'));var fs=require('fs');var fs_extra=require(_0x4935('0xa'));var _=require(_0x4935('0xb'));var squel=require(_0x4935('0xc'));var crypto=require(_0x4935('0xd'));var jsforce=require(_0x4935('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4935('0x8'));var querystring=require('querystring');var Papa=require(_0x4935('0xf'));var Redis=require(_0x4935('0x10'));var authService=require(_0x4935('0x11'));var qs=require(_0x4935('0x12'));var as=require(_0x4935('0x13'));var hardwareService=require(_0x4935('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4935('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4935('0x16'))['db'];function respondWithStatusCode(_0x32916f,_0x3bb388){_0x3bb388=_0x3bb388||0xcc;return function(_0x1c6c22){if(_0x1c6c22){return _0x32916f[_0x4935('0x17')](_0x3bb388);}return _0x32916f[_0x4935('0x18')](_0x3bb388)[_0x4935('0x19')]();};}function respondWithResult(_0x3a7c30,_0x57549f){_0x57549f=_0x57549f||0xc8;return function(_0x237e28){if(_0x237e28){return _0x3a7c30[_0x4935('0x18')](_0x57549f)[_0x4935('0x1a')](_0x237e28);}};}function respondWithFilteredResult(_0xa41961,_0x3652c4){return function(_0x24cc99){if(_0x24cc99){var _0x395a43=typeof _0x3652c4['offset']===_0x4935('0x1b')&&typeof _0x3652c4[_0x4935('0x1c')]===_0x4935('0x1b');var _0x123300=_0x24cc99[_0x4935('0x1d')];var _0x429ef3=_0x395a43?0x0:_0x3652c4['offset'];var _0xd70eff=_0x395a43?_0x24cc99[_0x4935('0x1d')]:_0x3652c4['offset']+_0x3652c4[_0x4935('0x1c')];var _0x10407f;if(_0xd70eff>=_0x123300){_0xd70eff=_0x123300;_0x10407f=0xc8;}else{_0x10407f=0xce;}_0xa41961[_0x4935('0x18')](_0x10407f);return _0xa41961['set']('Content-Range',_0x429ef3+'-'+_0xd70eff+'/'+_0x123300)[_0x4935('0x1a')](_0x24cc99);}return null;};}function patchUpdates(_0x6b849f){return function(_0x1ae059){try{jsonpatch[_0x4935('0x1e')](_0x1ae059,_0x6b849f,!![]);}catch(_0x41d76e){return BPromise[_0x4935('0x1f')](_0x41d76e);}return _0x1ae059[_0x4935('0x20')]();};}function saveUpdates(_0xe482a5,_0x58b2f3){return function(_0x2f520a){if(_0x2f520a){return _0x2f520a[_0x4935('0x21')](_0xe482a5)[_0x4935('0x22')](function(_0x2c701f){return _0x2c701f;});}return null;};}function removeEntity(_0x52c65a,_0x53530f){return function(_0x4dc1f5){if(_0x4dc1f5){return _0x4dc1f5[_0x4935('0x23')]()[_0x4935('0x22')](function(){var _0x3786ff=_0x4dc1f5[_0x4935('0x24')]({'plain':!![]});var _0x344e51=_0x4935('0x25');return db[_0x4935('0x26')][_0x4935('0x23')]({'where':{'type':_0x344e51,'resourceId':_0x3786ff['id']}})[_0x4935('0x22')](function(){return _0x4dc1f5;});})[_0x4935('0x22')](function(){_0x52c65a[_0x4935('0x18')](0xcc)[_0x4935('0x19')]();});}};}function handleEntityNotFound(_0x2c47ab,_0xbb00d6){return function(_0x359522){if(!_0x359522){_0x2c47ab['sendStatus'](0x194);}return _0x359522;};}function handleError(_0x5c3aaa,_0x5cec4d){_0x5cec4d=_0x5cec4d||0x1f4;return function(_0x1fc218){logger[_0x4935('0x27')](_0x1fc218['stack']);if(_0x1fc218[_0x4935('0x28')]){delete _0x1fc218[_0x4935('0x28')];}_0x5c3aaa[_0x4935('0x18')](_0x5cec4d)[_0x4935('0x29')](_0x1fc218);};}exports[_0x4935('0x2a')]=function(_0x24262e,_0x28afc2){var _0x2fe6da={},_0x5b3c8e={},_0xb7fe2a={'count':0x0,'rows':[]};var _0x2dcb0b=_['map'](db['VoiceMail'][_0x4935('0x2b')],function(_0x479d28){return{'name':_0x479d28[_0x4935('0x2c')],'type':_0x479d28[_0x4935('0x2d')][_0x4935('0x2e')]};});_0x5b3c8e['model']=_['map'](_0x2dcb0b,_0x4935('0x28'));_0x5b3c8e[_0x4935('0x2f')]=_['keys'](_0x24262e[_0x4935('0x2f')]);_0x5b3c8e[_0x4935('0x30')]=_[_0x4935('0x31')](_0x5b3c8e[_0x4935('0x32')],_0x5b3c8e[_0x4935('0x2f')]);_0x2fe6da['attributes']=_['intersection'](_0x5b3c8e[_0x4935('0x32')],qs[_0x4935('0x33')](_0x24262e['query']['fields']));_0x2fe6da[_0x4935('0x34')]=_0x2fe6da['attributes'][_0x4935('0x35')]?_0x2fe6da[_0x4935('0x34')]:_0x5b3c8e[_0x4935('0x32')];if(!_0x24262e[_0x4935('0x2f')][_0x4935('0x36')](_0x4935('0x37'))){_0x2fe6da['limit']=qs[_0x4935('0x1c')](_0x24262e['query'][_0x4935('0x1c')]);_0x2fe6da['offset']=qs[_0x4935('0x38')](_0x24262e['query'][_0x4935('0x38')]);}_0x2fe6da[_0x4935('0x39')]=qs[_0x4935('0x3a')](_0x24262e[_0x4935('0x2f')][_0x4935('0x3a')]);_0x2fe6da[_0x4935('0x3b')]=qs[_0x4935('0x30')](_['pick'](_0x24262e['query'],_0x5b3c8e[_0x4935('0x30')]),_0x2dcb0b);if(_0x24262e['query']['filter']){_0x2fe6da[_0x4935('0x3b')]=_['merge'](_0x2fe6da[_0x4935('0x3b')],{'$or':_[_0x4935('0x3c')](_0x2dcb0b,function(_0x2d67e3){if(_0x2d67e3[_0x4935('0x2d')]!==_0x4935('0x3d')){var _0x53aac5={};_0x53aac5[_0x2d67e3['name']]={'$like':'%'+_0x24262e[_0x4935('0x2f')][_0x4935('0x3e')]+'%'};return _0x53aac5;}})});}_0x2fe6da=_[_0x4935('0x3f')]({},_0x2fe6da,_0x24262e[_0x4935('0x40')]);var _0x4d9436={'where':_0x2fe6da[_0x4935('0x3b')]};return db[_0x4935('0x41')][_0x4935('0x1d')](_0x4d9436)['then'](function(_0x4e94f6){_0xb7fe2a[_0x4935('0x1d')]=_0x4e94f6;if(_0x24262e[_0x4935('0x2f')]['includeAll']){_0x2fe6da[_0x4935('0x42')]=[{'all':!![]}];}return db[_0x4935('0x41')][_0x4935('0x43')](_0x2fe6da);})[_0x4935('0x22')](function(_0x52ab0c){_0xb7fe2a['rows']=_0x52ab0c;return _0xb7fe2a;})[_0x4935('0x22')](respondWithFilteredResult(_0x28afc2,_0x2fe6da))[_0x4935('0x44')](handleError(_0x28afc2,null));};exports['show']=function(_0x1eaa47,_0x40f5ff){var _0x2195da={'raw':!![],'where':{'id':_0x1eaa47[_0x4935('0x45')]['id']}},_0x5135fd={};_0x5135fd[_0x4935('0x32')]=_[_0x4935('0x46')](db[_0x4935('0x41')][_0x4935('0x2b')]);_0x5135fd[_0x4935('0x2f')]=_[_0x4935('0x46')](_0x1eaa47[_0x4935('0x2f')]);_0x5135fd[_0x4935('0x30')]=_[_0x4935('0x31')](_0x5135fd[_0x4935('0x32')],_0x5135fd[_0x4935('0x2f')]);_0x2195da[_0x4935('0x34')]=_[_0x4935('0x31')](_0x5135fd[_0x4935('0x32')],qs[_0x4935('0x33')](_0x1eaa47[_0x4935('0x2f')][_0x4935('0x33')]));_0x2195da['attributes']=_0x2195da[_0x4935('0x34')]['length']?_0x2195da[_0x4935('0x34')]:_0x5135fd[_0x4935('0x32')];if(_0x1eaa47[_0x4935('0x2f')][_0x4935('0x47')]){_0x2195da['include']=[{'all':!![]}];}_0x2195da=_[_0x4935('0x3f')]({},_0x2195da,_0x1eaa47[_0x4935('0x40')]);return db[_0x4935('0x41')][_0x4935('0x48')](_0x2195da)[_0x4935('0x22')](handleEntityNotFound(_0x40f5ff,null))[_0x4935('0x22')](respondWithResult(_0x40f5ff,null))[_0x4935('0x44')](handleError(_0x40f5ff,null));};exports[_0x4935('0x49')]=function(_0x29b932,_0x392cba){return db['VoiceMail'][_0x4935('0x49')](_0x29b932[_0x4935('0x4a')],{})['then'](function(_0x447a64){var _0x2636f4=_0x29b932[_0x4935('0x4b')][_0x4935('0x24')]({'plain':!![]});if(!_0x2636f4)throw new Error(_0x4935('0x4c'));if(_0x2636f4[_0x4935('0x4d')]===_0x4935('0x4b')){var _0x471fb1=_0x447a64['get']({'plain':!![]});var _0x57d0d9='Voicemails';return db['UserProfileSection'][_0x4935('0x48')]({'where':{'name':_0x57d0d9,'userProfileId':_0x2636f4[_0x4935('0x4e')]},'raw':!![]})[_0x4935('0x22')](function(_0x2072df){if(_0x2072df&&_0x2072df[_0x4935('0x4f')]===0x0){return db['UserProfileResource'][_0x4935('0x49')]({'name':_0x471fb1[_0x4935('0x28')],'resourceId':_0x471fb1['id'],'type':_0x2072df[_0x4935('0x28')],'sectionId':_0x2072df['id']},{})[_0x4935('0x22')](function(){return _0x447a64;});}else{return _0x447a64;}})[_0x4935('0x44')](function(_0x8196b4){logger[_0x4935('0x27')](_0x4935('0x50'),_0x8196b4);throw _0x8196b4;});}return _0x447a64;})[_0x4935('0x22')](respondWithResult(_0x392cba,0xc9))[_0x4935('0x44')](handleError(_0x392cba,null));};exports['update']=function(_0x24b83b,_0x4e99bb){if(_0x24b83b[_0x4935('0x4a')]['id']){delete _0x24b83b[_0x4935('0x4a')]['id'];}return db['VoiceMail'][_0x4935('0x48')]({'where':{'id':_0x24b83b['params']['id']}})['then'](handleEntityNotFound(_0x4e99bb,null))['then'](saveUpdates(_0x24b83b[_0x4935('0x4a')],null))[_0x4935('0x22')](respondWithResult(_0x4e99bb,null))[_0x4935('0x44')](handleError(_0x4e99bb,null));};exports[_0x4935('0x23')]=function(_0xd5a489,_0x56db7f){return db['VoiceMail'][_0x4935('0x48')]({'where':{'id':_0xd5a489[_0x4935('0x45')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x56db7f,null))['then'](removeEntity(_0x56db7f,null))[_0x4935('0x44')](handleError(_0x56db7f,null));};exports[_0x4935('0x51')]=function(_0x24141a,_0xc92288,_0x5009c9){return db[_0x4935('0x41')]['findOne']({'where':{'id':_0x24141a['params']['id']}})['then'](handleEntityNotFound(_0xc92288,null))[_0x4935('0x22')](function(_0x10cd78){var _0x47e73d;var _0x3190d2={},_0x395eba={};_0x395eba['model']=_[_0x4935('0x46')](db[_0x4935('0x52')][_0x4935('0x2b')]);_0x395eba[_0x4935('0x2f')]=_[_0x4935('0x46')](_0x24141a[_0x4935('0x2f')]);_0x395eba[_0x4935('0x30')]=_['intersection'](_0x395eba[_0x4935('0x32')],_0x395eba['query']);_0x3190d2['attributes']=_[_0x4935('0x31')](_0x395eba[_0x4935('0x32')],qs['fields'](_0x24141a['query'][_0x4935('0x33')]));_0x3190d2[_0x4935('0x34')]=_0x3190d2[_0x4935('0x34')]['length']?_0x3190d2[_0x4935('0x34')]:_0x395eba['model'];if(!_0x24141a[_0x4935('0x2f')][_0x4935('0x36')](_0x4935('0x37'))){_0x3190d2[_0x4935('0x1c')]=qs[_0x4935('0x1c')](_0x24141a['query'][_0x4935('0x1c')]);_0x3190d2[_0x4935('0x38')]=qs['offset'](_0x24141a[_0x4935('0x2f')][_0x4935('0x38')]);}_0x3190d2[_0x4935('0x39')]=qs[_0x4935('0x3a')](_0x24141a[_0x4935('0x2f')][_0x4935('0x3a')]);_0x3190d2[_0x4935('0x3b')]=qs[_0x4935('0x30')](_[_0x4935('0x53')](_0x24141a[_0x4935('0x2f')],_0x395eba[_0x4935('0x30')]));if(_0x24141a['query'][_0x4935('0x3e')]){_0x3190d2[_0x4935('0x3b')]=_[_0x4935('0x3f')](_0x3190d2[_0x4935('0x3b')],{'$or':_[_0x4935('0x3c')](_0x3190d2[_0x4935('0x34')],function(_0x2c06f5){var _0x9023e={};_0x9023e[_0x2c06f5]={'$like':'%'+_0x24141a[_0x4935('0x2f')][_0x4935('0x3e')]+'%'};return _0x9023e;})});}_0x3190d2[_0x4935('0x3b')]=_[_0x4935('0x3f')](_0x3190d2[_0x4935('0x3b')],{'mailboxuser':_0x10cd78['mailbox']});_0x3190d2=_['merge']({},_0x3190d2,_0x24141a[_0x4935('0x40')]);return db[_0x4935('0x52')]['findAndCountAll'](_0x3190d2)[_0x4935('0x22')](respondWithFilteredResult(_0xc92288,_0x3190d2));})[_0x4935('0x44')](handleError(_0xc92288,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index d8f8884..1e25e33 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 _0xe423=['request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xe423,0x6a));var _0x3e42=function(_0x1ba6ae,_0x42cf56){_0x1ba6ae=_0x1ba6ae-0x0;var _0x44605c=_0xe423[_0x1ba6ae];return _0x44605c;};'use strict';var _=require(_0x3e42('0x0'));var util=require(_0x3e42('0x1'));var logger=require(_0x3e42('0x2'))(_0x3e42('0x3'));var moment=require(_0x3e42('0x4'));var BPromise=require(_0x3e42('0x5'));var rp=require(_0x3e42('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e42('0x7'));var config=require(_0x3e42('0x8'));var attributes=require(_0x3e42('0x9'));module[_0x3e42('0xa')]=function(_0x595d00,_0x2e1e89){return _0x595d00[_0x3e42('0xb')](_0x3e42('0xc'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x3e42('0xd'),'fields':[_0x3e42('0xe'),_0x3e42('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfafd=['request-promise','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','mailbox','context','lodash','../../config/logger','api','moment','bluebird'];(function(_0x20ffa0,_0x2b1e42){var _0x55a793=function(_0xcad519){while(--_0xcad519){_0x20ffa0['push'](_0x20ffa0['shift']());}};_0x55a793(++_0x2b1e42);}(_0xfafd,0x15a));var _0xdfaf=function(_0x22ce8c,_0xa7be0){_0x22ce8c=_0x22ce8c-0x0;var _0x2d7db5=_0xfafd[_0x22ce8c];return _0x2d7db5;};'use strict';var _=require(_0xdfaf('0x0'));var util=require('util');var logger=require(_0xdfaf('0x1'))(_0xdfaf('0x2'));var moment=require(_0xdfaf('0x3'));var BPromise=require(_0xdfaf('0x4'));var rp=require(_0xdfaf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdfaf('0x6'));module[_0xdfaf('0x7')]=function(_0x3d4ffe,_0x4c6839){return _0x3d4ffe[_0xdfaf('0x8')]('VoiceMail',attributes,{'tableName':_0xdfaf('0x9'),'paranoid':![],'indexes':[{'name':_0xdfaf('0xa'),'fields':[_0xdfaf('0xb'),_0xdfaf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 097768b..907b501 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 _0xfc5c=['../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3f90ab,_0x2dd92a){var _0xe7eedf=function(_0x5cfc99){while(--_0x5cfc99){_0x3f90ab['push'](_0x3f90ab['shift']());}};_0xe7eedf(++_0x2dd92a);}(_0xfc5c,0xbf));var _0xcfc5=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xfc5c[_0x334841];return _0x5beb4b;};'use strict';var _=require('lodash');var util=require(_0xcfc5('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcfc5('0x1'));var fs=require('fs');var Redis=require(_0xcfc5('0x2'));var db=require(_0xcfc5('0x3'))['db'];var utils=require(_0xcfc5('0x4'));var logger=require(_0xcfc5('0x5'))(_0xcfc5('0x6'));var config=require(_0xcfc5('0x7'));var jayson=require(_0xcfc5('0x8'));var client=jayson['client'][_0xcfc5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3841f3,_0x5c607d,_0x3d9a24){return new BPromise(function(_0xdfc473,_0x558ddc){return client[_0xcfc5('0xa')](_0x3841f3,_0x3d9a24)[_0xcfc5('0xb')](function(_0x22dc62){logger[_0xcfc5('0xc')](_0xcfc5('0xd'),_0x5c607d,_0xcfc5('0xe'));logger[_0xcfc5('0xf')](_0xcfc5('0x10'),_0x5c607d,_0xcfc5('0xe'),JSON['stringify'](_0x22dc62));if(_0x22dc62[_0xcfc5('0x11')]){if(_0x22dc62[_0xcfc5('0x11')][_0xcfc5('0x12')]===0x1f4){logger['error'](_0xcfc5('0xd'),_0x5c607d,_0x22dc62[_0xcfc5('0x11')][_0xcfc5('0x13')]);return _0x558ddc(_0x22dc62[_0xcfc5('0x11')][_0xcfc5('0x13')]);}logger['error'](_0xcfc5('0xd'),_0x5c607d,_0x22dc62['error'][_0xcfc5('0x13')]);return _0xdfc473(_0x22dc62[_0xcfc5('0x11')][_0xcfc5('0x13')]);}else{logger[_0xcfc5('0xc')](_0xcfc5('0xd'),_0x5c607d,_0xcfc5('0xe'));_0xdfc473(_0x22dc62[_0xcfc5('0x14')][_0xcfc5('0x13')]);}})[_0xcfc5('0x15')](function(_0x4d363f){logger[_0xcfc5('0x11')](_0xcfc5('0xd'),_0x5c607d,_0x4d363f);_0x558ddc(_0x4d363f);});});} \ No newline at end of file +var _0xfdad=['rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x32fba5,_0x492d81){var _0x23fd41=function(_0x16fa44){while(--_0x16fa44){_0x32fba5['push'](_0x32fba5['shift']());}};_0x23fd41(++_0x492d81);}(_0xfdad,0x188));var _0xdfda=function(_0x46bb06,_0x5af763){_0x46bb06=_0x46bb06-0x0;var _0x70a4a=_0xfdad[_0x46bb06];return _0x70a4a;};'use strict';var _=require(_0xdfda('0x0'));var util=require(_0xdfda('0x1'));var moment=require(_0xdfda('0x2'));var BPromise=require('bluebird');var rs=require(_0xdfda('0x3'));var fs=require('fs');var Redis=require(_0xdfda('0x4'));var db=require(_0xdfda('0x5'))['db'];var utils=require(_0xdfda('0x6'));var logger=require(_0xdfda('0x7'))(_0xdfda('0x8'));var config=require(_0xdfda('0x9'));var jayson=require(_0xdfda('0xa'));var client=jayson[_0xdfda('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23c57e,_0x5e5af1,_0x29d66a){return new BPromise(function(_0x9e0549,_0x5d5c12){return client[_0xdfda('0xc')](_0x23c57e,_0x29d66a)[_0xdfda('0xd')](function(_0x53211c){logger[_0xdfda('0xe')](_0xdfda('0xf'),_0x5e5af1,_0xdfda('0x10'));logger[_0xdfda('0x11')](_0xdfda('0x12'),_0x5e5af1,'request\x20sent',JSON[_0xdfda('0x13')](_0x53211c));if(_0x53211c[_0xdfda('0x14')]){if(_0x53211c[_0xdfda('0x14')][_0xdfda('0x15')]===0x1f4){logger[_0xdfda('0x14')](_0xdfda('0xf'),_0x5e5af1,_0x53211c['error'][_0xdfda('0x16')]);return _0x5d5c12(_0x53211c[_0xdfda('0x14')][_0xdfda('0x16')]);}logger['error'](_0xdfda('0xf'),_0x5e5af1,_0x53211c[_0xdfda('0x14')]['message']);return _0x9e0549(_0x53211c['error']['message']);}else{logger[_0xdfda('0xe')](_0xdfda('0xf'),_0x5e5af1,_0xdfda('0x10'));_0x9e0549(_0x53211c[_0xdfda('0x17')][_0xdfda('0x16')]);}})[_0xdfda('0x18')](function(_0x13c007){logger[_0xdfda('0x14')](_0xdfda('0xf'),_0x5e5af1,_0x13c007);_0x5d5c12(_0x13c007);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index e6ca1f2..3027ba0 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 _0x0fdd=['Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports','multer','util','path','express'];(function(_0xe3e22b,_0x5c3c50){var _0x48090e=function(_0x995c97){while(--_0x995c97){_0xe3e22b['push'](_0xe3e22b['shift']());}};_0x48090e(++_0x5c3c50);}(_0x0fdd,0xb9));var _0xd0fd=function(_0x104cfb,_0x3c2f84){_0x104cfb=_0x104cfb-0x0;var _0x4c7889=_0x0fdd[_0x104cfb];return _0x4c7889;};'use strict';var multer=require(_0xd0fd('0x0'));var util=require(_0xd0fd('0x1'));var path=require(_0xd0fd('0x2'));var timeout=require('connect-timeout');var express=require(_0xd0fd('0x3'));var router=express[_0xd0fd('0x4')]();var fs_extra=require(_0xd0fd('0x5'));var auth=require(_0xd0fd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd0fd('0x7'));var controller=require(_0xd0fd('0x8'));router['get']('/',auth[_0xd0fd('0x9')](),controller['index']);router[_0xd0fd('0xa')](_0xd0fd('0xb'),auth[_0xd0fd('0x9')](),controller[_0xd0fd('0xc')]);router[_0xd0fd('0xa')](_0xd0fd('0xd'),auth['isAuthenticated'](),controller[_0xd0fd('0xe')]);router[_0xd0fd('0xf')]('/',auth['isAuthenticated'](),controller[_0xd0fd('0x10')]);router[_0xd0fd('0x11')](_0xd0fd('0xb'),auth[_0xd0fd('0x9')](),controller['update']);router[_0xd0fd('0x12')](_0xd0fd('0xb'),auth[_0xd0fd('0x9')](),controller[_0xd0fd('0x13')]);module[_0xd0fd('0x14')]=router; \ No newline at end of file +var _0x0c21=['post','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','show','/:id/download','download'];(function(_0x3b33a1,_0x275cdb){var _0x29504d=function(_0x2a5184){while(--_0x2a5184){_0x3b33a1['push'](_0x3b33a1['shift']());}};_0x29504d(++_0x275cdb);}(_0x0c21,0x180));var _0x10c2=function(_0x36037c,_0x433159){_0x36037c=_0x36037c-0x0;var _0x13fc23=_0x0c21[_0x36037c];return _0x13fc23;};'use strict';var multer=require(_0x10c2('0x0'));var util=require('util');var path=require(_0x10c2('0x1'));var timeout=require(_0x10c2('0x2'));var express=require(_0x10c2('0x3'));var router=express[_0x10c2('0x4')]();var fs_extra=require(_0x10c2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x10c2('0x6'));var config=require(_0x10c2('0x7'));var controller=require(_0x10c2('0x8'));router[_0x10c2('0x9')]('/',auth[_0x10c2('0xa')](),controller[_0x10c2('0xb')]);router[_0x10c2('0x9')]('/:id',auth[_0x10c2('0xa')](),controller[_0x10c2('0xc')]);router['get'](_0x10c2('0xd'),auth['isAuthenticated'](),controller[_0x10c2('0xe')]);router[_0x10c2('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x10c2('0xa')](),controller[_0x10c2('0x10')]);router[_0x10c2('0x11')](_0x10c2('0x12'),auth[_0x10c2('0xa')](),controller[_0x10c2('0x13')]);module[_0x10c2('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 399ae5a..8918f5b 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 _0x7b27=['BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','INTEGER','STRING'];(function(_0x1eb070,_0x3ea934){var _0x1f116c=function(_0x304cc6){while(--_0x304cc6){_0x1eb070['push'](_0x1eb070['shift']());}};_0x1f116c(++_0x3ea934);}(_0x7b27,0x181));var _0x77b2=function(_0xc8a170,_0x24827c){_0xc8a170=_0xc8a170-0x0;var _0x53b5c1=_0x7b27[_0xc8a170];return _0x53b5c1;};'use strict';var Sequelize=require(_0x77b2('0x0'));module[_0x77b2('0x1')]={'name':{'type':Sequelize[_0x77b2('0x2')],'get':function(_0x756624){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x77b2('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x77b2('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x77b2('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x77b2('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x77b2('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x77b2('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x77b2('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x77b2('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x77b2('0x5')](_0x77b2('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x77b2('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x77b2('0x4')],'defaultValue':''},'stamp':{'type':_0x77b2('0x7'),'defaultValue':Sequelize[_0x77b2('0x8')](_0x77b2('0x9'))}}; \ No newline at end of file +var _0x435d=['STRING','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','VIRTUAL'];(function(_0x40de73,_0x42cbca){var _0x28f247=function(_0x56e083){while(--_0x56e083){_0x40de73['push'](_0x40de73['shift']());}};_0x28f247(++_0x42cbca);}(_0x435d,0x15d));var _0xd435=function(_0x219313,_0x1bdd42){_0x219313=_0x219313-0x0;var _0x588c0d=_0x435d[_0x219313];return _0x588c0d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd435('0x0')],'get':function(_0x277012){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xd435('0x1')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xd435('0x1')],'defaultValue':''},'origtime':{'type':Sequelize[_0xd435('0x1')],'defaultValue':''},'duration':{'type':Sequelize[_0xd435('0x1')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xd435('0x2')),'defaultValue':null},'flag':{'type':Sequelize[_0xd435('0x1')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xd435('0x1')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xd435('0x3')](_0xd435('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index b5b3874..1760d94 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 _0x6601=['order','sort','where','pick','filters','filter','merge','options','include','VoiceMailMessage','findAll','rows','catch','show','params','keys','find','body','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x6601,0xc5));var _0x1660=function(_0x363f61,_0x2d608e){_0x363f61=_0x363f61-0x0;var _0x2e1497=_0x6601[_0x363f61];return _0x2e1497;};'use strict';var emlformat=require(_0x1660('0x0'));var rimraf=require(_0x1660('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1660('0x2'));var BPromise=require(_0x1660('0x3'));var Mustache=require('mustache');var util=require(_0x1660('0x4'));var path=require(_0x1660('0x5'));var sox=require(_0x1660('0x6'));var csv=require('to-csv');var ejs=require(_0x1660('0x7'));var fs=require('fs');var fs_extra=require(_0x1660('0x8'));var _=require(_0x1660('0x9'));var squel=require(_0x1660('0xa'));var crypto=require(_0x1660('0xb'));var jsforce=require(_0x1660('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1660('0xd'));var querystring=require('querystring');var Papa=require(_0x1660('0xe'));var Redis=require(_0x1660('0xf'));var authService=require(_0x1660('0x10'));var qs=require(_0x1660('0x11'));var as=require(_0x1660('0x12'));var hardwareService=require(_0x1660('0x13'));var logger=require(_0x1660('0x14'))(_0x1660('0x15'));var utils=require(_0x1660('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1660('0x17'));var db=require(_0x1660('0x18'))['db'];function respondWithStatusCode(_0x11d007,_0x473367){_0x473367=_0x473367||0xcc;return function(_0x33a53d){if(_0x33a53d){return _0x11d007[_0x1660('0x19')](_0x473367);}return _0x11d007[_0x1660('0x1a')](_0x473367)[_0x1660('0x1b')]();};}function respondWithResult(_0x3e904c,_0x3c890a){_0x3c890a=_0x3c890a||0xc8;return function(_0x105492){if(_0x105492){return _0x3e904c[_0x1660('0x1a')](_0x3c890a)[_0x1660('0x1c')](_0x105492);}};}function respondWithFilteredResult(_0x909df6,_0x3aaed9){return function(_0x413a1d){if(_0x413a1d){var _0x3b21ef=typeof _0x3aaed9[_0x1660('0x1d')]==='undefined'&&typeof _0x3aaed9[_0x1660('0x1e')]===_0x1660('0x1f');var _0x52babf=_0x413a1d['count'];var _0x37a3d9=_0x3b21ef?0x0:_0x3aaed9['offset'];var _0x4509e3=_0x3b21ef?_0x413a1d[_0x1660('0x20')]:_0x3aaed9[_0x1660('0x1d')]+_0x3aaed9['limit'];var _0x466222;if(_0x4509e3>=_0x52babf){_0x4509e3=_0x52babf;_0x466222=0xc8;}else{_0x466222=0xce;}_0x909df6[_0x1660('0x1a')](_0x466222);return _0x909df6[_0x1660('0x21')](_0x1660('0x22'),_0x37a3d9+'-'+_0x4509e3+'/'+_0x52babf)[_0x1660('0x1c')](_0x413a1d);}return null;};}function patchUpdates(_0x3eedf6){return function(_0x567ccc){try{jsonpatch[_0x1660('0x23')](_0x567ccc,_0x3eedf6,!![]);}catch(_0x49ec6e){return BPromise[_0x1660('0x24')](_0x49ec6e);}return _0x567ccc[_0x1660('0x25')]();};}function saveUpdates(_0x246288,_0x2a5383){return function(_0x517491){if(_0x517491){return _0x517491[_0x1660('0x26')](_0x246288)[_0x1660('0x27')](function(_0x1514a8){return _0x1514a8;});}return null;};}function removeEntity(_0x5cea10,_0x136d57){return function(_0x52aa9e){if(_0x52aa9e){return _0x52aa9e[_0x1660('0x28')]()[_0x1660('0x27')](function(){_0x5cea10[_0x1660('0x1a')](0xcc)[_0x1660('0x1b')]();});}};}function handleEntityNotFound(_0x325113,_0x58a283){return function(_0x386f4d){if(!_0x386f4d){_0x325113[_0x1660('0x19')](0x194);}return _0x386f4d;};}function handleError(_0xf69221,_0x1e70bc){_0x1e70bc=_0x1e70bc||0x1f4;return function(_0x155a11){logger[_0x1660('0x29')](_0x155a11[_0x1660('0x2a')]);if(_0x155a11[_0x1660('0x2b')]){delete _0x155a11[_0x1660('0x2b')];}_0xf69221[_0x1660('0x1a')](_0x1e70bc)[_0x1660('0x2c')](_0x155a11);};}exports[_0x1660('0x2d')]=function(_0x1592fa,_0x4b381e){var _0x2dd7d2={},_0x23182f={},_0x8b3482={'count':0x0,'rows':[]};var _0x178151=_[_0x1660('0x2e')](db['VoiceMailMessage'][_0x1660('0x2f')],function(_0x3340cd){return{'name':_0x3340cd[_0x1660('0x30')],'type':_0x3340cd[_0x1660('0x31')][_0x1660('0x32')]};});_0x23182f[_0x1660('0x33')]=_['differenceBy'](_['map'](_0x178151,_0x1660('0x2b')),[_0x1660('0x2b')]);_0x23182f[_0x1660('0x34')]=_['keys'](_0x1592fa[_0x1660('0x34')]);_0x23182f['filters']=_[_0x1660('0x35')](_0x23182f[_0x1660('0x33')],_0x23182f[_0x1660('0x34')]);_0x2dd7d2[_0x1660('0x36')]=_[_0x1660('0x35')](_0x23182f[_0x1660('0x33')],qs[_0x1660('0x37')](_0x1592fa['query']['fields']));_0x2dd7d2[_0x1660('0x36')]=_0x2dd7d2[_0x1660('0x36')][_0x1660('0x38')]?_0x2dd7d2[_0x1660('0x36')]:_0x23182f[_0x1660('0x33')];if(!_0x1592fa[_0x1660('0x34')]['hasOwnProperty'](_0x1660('0x39'))){_0x2dd7d2['limit']=qs['limit'](_0x1592fa['query']['limit']);_0x2dd7d2[_0x1660('0x1d')]=qs[_0x1660('0x1d')](_0x1592fa['query'][_0x1660('0x1d')]);}_0x2dd7d2[_0x1660('0x3a')]=qs[_0x1660('0x3b')](_0x1592fa[_0x1660('0x34')][_0x1660('0x3b')]);_0x2dd7d2[_0x1660('0x3c')]=qs['filters'](_[_0x1660('0x3d')](_0x1592fa[_0x1660('0x34')],_0x23182f[_0x1660('0x3e')]),_0x178151);if(_0x1592fa['query'][_0x1660('0x3f')]){_0x2dd7d2[_0x1660('0x3c')]=_[_0x1660('0x40')](_0x2dd7d2[_0x1660('0x3c')],{'$or':_[_0x1660('0x2e')](_0x178151,function(_0x4d7fa0){if(_0x4d7fa0['type']!=='VIRTUAL'){var _0x3c5a23={};_0x3c5a23[_0x4d7fa0[_0x1660('0x2b')]]={'$like':'%'+_0x1592fa[_0x1660('0x34')][_0x1660('0x3f')]+'%'};return _0x3c5a23;}})});}_0x2dd7d2=_[_0x1660('0x40')]({},_0x2dd7d2,_0x1592fa[_0x1660('0x41')]);var _0x1ebae3={'where':_0x2dd7d2[_0x1660('0x3c')]};return db['VoiceMailMessage'][_0x1660('0x20')](_0x1ebae3)[_0x1660('0x27')](function(_0x3e645d){_0x8b3482[_0x1660('0x20')]=_0x3e645d;if(_0x1592fa[_0x1660('0x34')]['includeAll']){_0x2dd7d2[_0x1660('0x42')]=[{'all':!![]}];}return db[_0x1660('0x43')][_0x1660('0x44')](_0x2dd7d2);})[_0x1660('0x27')](function(_0x28487c){_0x8b3482[_0x1660('0x45')]=_0x28487c;return _0x8b3482;})[_0x1660('0x27')](respondWithFilteredResult(_0x4b381e,_0x2dd7d2))[_0x1660('0x46')](handleError(_0x4b381e,null));};exports[_0x1660('0x47')]=function(_0x2be22f,_0x4d182d){var _0xde723a={'raw':!![],'where':{'id':_0x2be22f[_0x1660('0x48')]['id']}},_0x3aba0c={};_0x3aba0c[_0x1660('0x33')]=_[_0x1660('0x49')](db[_0x1660('0x43')][_0x1660('0x2f')]);_0x3aba0c[_0x1660('0x34')]=_[_0x1660('0x49')](_0x2be22f[_0x1660('0x34')]);_0x3aba0c[_0x1660('0x3e')]=_[_0x1660('0x35')](_0x3aba0c[_0x1660('0x33')],_0x3aba0c['query']);_0xde723a['attributes']=_[_0x1660('0x35')](_0x3aba0c[_0x1660('0x33')],qs[_0x1660('0x37')](_0x2be22f[_0x1660('0x34')][_0x1660('0x37')]));_0xde723a[_0x1660('0x36')]=_0xde723a[_0x1660('0x36')][_0x1660('0x38')]?_0xde723a[_0x1660('0x36')]:_0x3aba0c['model'];if(_0x2be22f['query']['includeAll']){_0xde723a[_0x1660('0x42')]=[{'all':!![]}];}_0xde723a=_[_0x1660('0x40')]({},_0xde723a,_0x2be22f[_0x1660('0x41')]);return db[_0x1660('0x43')][_0x1660('0x4a')](_0xde723a)['then'](handleEntityNotFound(_0x4d182d,null))[_0x1660('0x27')](respondWithResult(_0x4d182d,null))[_0x1660('0x46')](handleError(_0x4d182d,null));};exports['create']=function(_0x49b841,_0x5b92c8){return db[_0x1660('0x43')]['create'](_0x49b841[_0x1660('0x4b')],{})[_0x1660('0x27')](respondWithResult(_0x5b92c8,0xc9))[_0x1660('0x46')](handleError(_0x5b92c8,null));};exports['update']=function(_0x241ae5,_0x2f77bd){if(_0x241ae5[_0x1660('0x4b')]['id']){delete _0x241ae5[_0x1660('0x4b')]['id'];}return db['VoiceMailMessage'][_0x1660('0x4a')]({'where':{'id':_0x241ae5[_0x1660('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f77bd,null))['then'](saveUpdates(_0x241ae5[_0x1660('0x4b')],null))['then'](respondWithResult(_0x2f77bd,null))[_0x1660('0x46')](handleError(_0x2f77bd,null));};exports[_0x1660('0x28')]=function(_0x1863a3,_0x4fc20a){return db[_0x1660('0x43')]['find']({'where':{'id':_0x1863a3[_0x1660('0x48')]['id']}})[_0x1660('0x27')](handleEntityNotFound(_0x4fc20a,null))[_0x1660('0x27')](removeEntity(_0x4fc20a,null))[_0x1660('0x46')](handleError(_0x4fc20a,null));};exports['download']=function(_0x449f00,_0x7a16fa,_0x9ae9fc){return db[_0x1660('0x43')][_0x1660('0x4a')]({'where':{'id':_0x449f00[_0x1660('0x48')]['id']},'attributes':['id',_0x1660('0x4c'),_0x1660('0x4d')]})[_0x1660('0x27')](handleEntityNotFound(_0x7a16fa,null))[_0x1660('0x27')](function(_0xc03e0b){if(_0xc03e0b){if(!_0xc03e0b['recording']){throw new db['Sequelize'][(_0x1660('0x4e'))](_0x1660('0x4f'));}var _0x1ae66c={'Content-Type':_0x1660('0x50'),'Content-Disposition':_0x1660('0x51')};if(_0xc03e0b[_0x1660('0x4d')]){_0x1ae66c[_0x1660('0x52')]=_0x1660('0x53')+_0xc03e0b['msg_id']+_0x1660('0x54');}_0x7a16fa['set'](_0x1ae66c);return _0x7a16fa['send'](new Buffer(_0xc03e0b[_0x1660('0x4c')]));}})[_0x1660('0x46')](handleError(_0x7a16fa,null));}; \ No newline at end of file +var _0x57cd=['end','json','offset','limit','undefined','count','apply','save','update','then','destroy','error','send','index','map','fieldName','type','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','VoiceMailMessage','findAll','rows','catch','show','params','keys','rawAttributes','create','body','find','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x2c7c6f,_0x131ff7){var _0x183efa=function(_0x58ecf4){while(--_0x58ecf4){_0x2c7c6f['push'](_0x2c7c6f['shift']());}};_0x183efa(++_0x131ff7);}(_0x57cd,0x131));var _0xd57c=function(_0x735ffd,_0x56e258){_0x735ffd=_0x735ffd-0x0;var _0xbbed93=_0x57cd[_0x735ffd];return _0xbbed93;};'use strict';var emlformat=require(_0xd57c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd57c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd57c('0x2'));var Mustache=require(_0xd57c('0x3'));var util=require(_0xd57c('0x4'));var path=require(_0xd57c('0x5'));var sox=require(_0xd57c('0x6'));var csv=require(_0xd57c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd57c('0x8'));var _=require(_0xd57c('0x9'));var squel=require(_0xd57c('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd57c('0xb'));var toCsv=require(_0xd57c('0x7'));var querystring=require(_0xd57c('0xc'));var Papa=require(_0xd57c('0xd'));var Redis=require(_0xd57c('0xe'));var authService=require(_0xd57c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd57c('0x10'));var logger=require(_0xd57c('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd57c('0x12'));var licenseUtil=require(_0xd57c('0x13'));var db=require(_0xd57c('0x14'))['db'];function respondWithStatusCode(_0xf0f24,_0x34395e){_0x34395e=_0x34395e||0xcc;return function(_0x29d651){if(_0x29d651){return _0xf0f24[_0xd57c('0x15')](_0x34395e);}return _0xf0f24[_0xd57c('0x16')](_0x34395e)[_0xd57c('0x17')]();};}function respondWithResult(_0xb6eb47,_0x2074cf){_0x2074cf=_0x2074cf||0xc8;return function(_0x2f388c){if(_0x2f388c){return _0xb6eb47[_0xd57c('0x16')](_0x2074cf)[_0xd57c('0x18')](_0x2f388c);}};}function respondWithFilteredResult(_0x25a123,_0xf9a94a){return function(_0x4b2fff){if(_0x4b2fff){var _0x427eec=typeof _0xf9a94a[_0xd57c('0x19')]==='undefined'&&typeof _0xf9a94a[_0xd57c('0x1a')]===_0xd57c('0x1b');var _0xb7643c=_0x4b2fff[_0xd57c('0x1c')];var _0x1a3ae7=_0x427eec?0x0:_0xf9a94a[_0xd57c('0x19')];var _0x4ba55d=_0x427eec?_0x4b2fff[_0xd57c('0x1c')]:_0xf9a94a[_0xd57c('0x19')]+_0xf9a94a[_0xd57c('0x1a')];var _0x233d51;if(_0x4ba55d>=_0xb7643c){_0x4ba55d=_0xb7643c;_0x233d51=0xc8;}else{_0x233d51=0xce;}_0x25a123[_0xd57c('0x16')](_0x233d51);return _0x25a123['set']('Content-Range',_0x1a3ae7+'-'+_0x4ba55d+'/'+_0xb7643c)['json'](_0x4b2fff);}return null;};}function patchUpdates(_0x126df6){return function(_0x880279){try{jsonpatch[_0xd57c('0x1d')](_0x880279,_0x126df6,!![]);}catch(_0x3298ed){return BPromise['reject'](_0x3298ed);}return _0x880279[_0xd57c('0x1e')]();};}function saveUpdates(_0x58a332,_0x11a44c){return function(_0xa80587){if(_0xa80587){return _0xa80587[_0xd57c('0x1f')](_0x58a332)[_0xd57c('0x20')](function(_0xf1dc53){return _0xf1dc53;});}return null;};}function removeEntity(_0x36c32f,_0x3b420f){return function(_0x2faaad){if(_0x2faaad){return _0x2faaad[_0xd57c('0x21')]()[_0xd57c('0x20')](function(){_0x36c32f[_0xd57c('0x16')](0xcc)[_0xd57c('0x17')]();});}};}function handleEntityNotFound(_0x198164,_0x4614bf){return function(_0x401088){if(!_0x401088){_0x198164[_0xd57c('0x15')](0x194);}return _0x401088;};}function handleError(_0x2b4d6d,_0x3d7add){_0x3d7add=_0x3d7add||0x1f4;return function(_0x5b3826){logger[_0xd57c('0x22')](_0x5b3826['stack']);if(_0x5b3826['name']){delete _0x5b3826['name'];}_0x2b4d6d[_0xd57c('0x16')](_0x3d7add)[_0xd57c('0x23')](_0x5b3826);};}exports[_0xd57c('0x24')]=function(_0x505ab9,_0x543fbc){var _0x1fa3d9={},_0x517d4a={},_0x5bf78d={'count':0x0,'rows':[]};var _0x512a21=_[_0xd57c('0x25')](db['VoiceMailMessage']['rawAttributes'],function(_0xd682ce){return{'name':_0xd682ce[_0xd57c('0x26')],'type':_0xd682ce[_0xd57c('0x27')]['key']};});_0x517d4a['model']=_['differenceBy'](_[_0xd57c('0x25')](_0x512a21,_0xd57c('0x28')),[_0xd57c('0x28')]);_0x517d4a[_0xd57c('0x29')]=_['keys'](_0x505ab9[_0xd57c('0x29')]);_0x517d4a[_0xd57c('0x2a')]=_[_0xd57c('0x2b')](_0x517d4a[_0xd57c('0x2c')],_0x517d4a[_0xd57c('0x29')]);_0x1fa3d9[_0xd57c('0x2d')]=_[_0xd57c('0x2b')](_0x517d4a[_0xd57c('0x2c')],qs[_0xd57c('0x2e')](_0x505ab9[_0xd57c('0x29')][_0xd57c('0x2e')]));_0x1fa3d9[_0xd57c('0x2d')]=_0x1fa3d9[_0xd57c('0x2d')][_0xd57c('0x2f')]?_0x1fa3d9[_0xd57c('0x2d')]:_0x517d4a[_0xd57c('0x2c')];if(!_0x505ab9[_0xd57c('0x29')][_0xd57c('0x30')](_0xd57c('0x31'))){_0x1fa3d9[_0xd57c('0x1a')]=qs['limit'](_0x505ab9['query'][_0xd57c('0x1a')]);_0x1fa3d9[_0xd57c('0x19')]=qs[_0xd57c('0x19')](_0x505ab9[_0xd57c('0x29')][_0xd57c('0x19')]);}_0x1fa3d9[_0xd57c('0x32')]=qs[_0xd57c('0x33')](_0x505ab9[_0xd57c('0x29')]['sort']);_0x1fa3d9[_0xd57c('0x34')]=qs[_0xd57c('0x2a')](_['pick'](_0x505ab9[_0xd57c('0x29')],_0x517d4a[_0xd57c('0x2a')]),_0x512a21);if(_0x505ab9[_0xd57c('0x29')][_0xd57c('0x35')]){_0x1fa3d9[_0xd57c('0x34')]=_[_0xd57c('0x36')](_0x1fa3d9[_0xd57c('0x34')],{'$or':_['map'](_0x512a21,function(_0xe8d542){if(_0xe8d542[_0xd57c('0x27')]!==_0xd57c('0x37')){var _0x14a96d={};_0x14a96d[_0xe8d542['name']]={'$like':'%'+_0x505ab9[_0xd57c('0x29')][_0xd57c('0x35')]+'%'};return _0x14a96d;}})});}_0x1fa3d9=_['merge']({},_0x1fa3d9,_0x505ab9[_0xd57c('0x38')]);var _0x5c88fe={'where':_0x1fa3d9['where']};return db['VoiceMailMessage']['count'](_0x5c88fe)[_0xd57c('0x20')](function(_0x5821fb){_0x5bf78d[_0xd57c('0x1c')]=_0x5821fb;if(_0x505ab9[_0xd57c('0x29')][_0xd57c('0x39')]){_0x1fa3d9[_0xd57c('0x3a')]=[{'all':!![]}];}return db[_0xd57c('0x3b')][_0xd57c('0x3c')](_0x1fa3d9);})['then'](function(_0x2ce649){_0x5bf78d[_0xd57c('0x3d')]=_0x2ce649;return _0x5bf78d;})[_0xd57c('0x20')](respondWithFilteredResult(_0x543fbc,_0x1fa3d9))[_0xd57c('0x3e')](handleError(_0x543fbc,null));};exports[_0xd57c('0x3f')]=function(_0x54dc28,_0x1f746a){var _0x30deaf={'raw':!![],'where':{'id':_0x54dc28[_0xd57c('0x40')]['id']}},_0x141a03={};_0x141a03['model']=_[_0xd57c('0x41')](db[_0xd57c('0x3b')][_0xd57c('0x42')]);_0x141a03['query']=_[_0xd57c('0x41')](_0x54dc28[_0xd57c('0x29')]);_0x141a03[_0xd57c('0x2a')]=_[_0xd57c('0x2b')](_0x141a03[_0xd57c('0x2c')],_0x141a03[_0xd57c('0x29')]);_0x30deaf[_0xd57c('0x2d')]=_[_0xd57c('0x2b')](_0x141a03[_0xd57c('0x2c')],qs[_0xd57c('0x2e')](_0x54dc28[_0xd57c('0x29')]['fields']));_0x30deaf[_0xd57c('0x2d')]=_0x30deaf[_0xd57c('0x2d')]['length']?_0x30deaf[_0xd57c('0x2d')]:_0x141a03[_0xd57c('0x2c')];if(_0x54dc28['query'][_0xd57c('0x39')]){_0x30deaf['include']=[{'all':!![]}];}_0x30deaf=_[_0xd57c('0x36')]({},_0x30deaf,_0x54dc28[_0xd57c('0x38')]);return db[_0xd57c('0x3b')]['find'](_0x30deaf)[_0xd57c('0x20')](handleEntityNotFound(_0x1f746a,null))[_0xd57c('0x20')](respondWithResult(_0x1f746a,null))['catch'](handleError(_0x1f746a,null));};exports[_0xd57c('0x43')]=function(_0x123b51,_0x113fcf){return db[_0xd57c('0x3b')][_0xd57c('0x43')](_0x123b51[_0xd57c('0x44')],{})[_0xd57c('0x20')](respondWithResult(_0x113fcf,0xc9))[_0xd57c('0x3e')](handleError(_0x113fcf,null));};exports[_0xd57c('0x1f')]=function(_0x7248ca,_0x3cd0a3){if(_0x7248ca[_0xd57c('0x44')]['id']){delete _0x7248ca[_0xd57c('0x44')]['id'];}return db[_0xd57c('0x3b')][_0xd57c('0x45')]({'where':{'id':_0x7248ca['params']['id']}})[_0xd57c('0x20')](handleEntityNotFound(_0x3cd0a3,null))[_0xd57c('0x20')](saveUpdates(_0x7248ca[_0xd57c('0x44')],null))[_0xd57c('0x20')](respondWithResult(_0x3cd0a3,null))[_0xd57c('0x3e')](handleError(_0x3cd0a3,null));};exports[_0xd57c('0x21')]=function(_0xc1876,_0x4183ef){return db['VoiceMailMessage']['find']({'where':{'id':_0xc1876[_0xd57c('0x40')]['id']}})[_0xd57c('0x20')](handleEntityNotFound(_0x4183ef,null))['then'](removeEntity(_0x4183ef,null))[_0xd57c('0x3e')](handleError(_0x4183ef,null));};exports[_0xd57c('0x46')]=function(_0x474c25,_0x332ac8,_0x3a8be0){return db[_0xd57c('0x3b')]['find']({'where':{'id':_0x474c25[_0xd57c('0x40')]['id']},'attributes':['id',_0xd57c('0x47'),_0xd57c('0x48')]})['then'](handleEntityNotFound(_0x332ac8,null))[_0xd57c('0x20')](function(_0x1c2bc5){if(_0x1c2bc5){if(!_0x1c2bc5[_0xd57c('0x47')]){throw new db[(_0xd57c('0x49'))][(_0xd57c('0x4a'))](_0xd57c('0x4b'));}var _0x19e693={'Content-Type':_0xd57c('0x4c'),'Content-Disposition':_0xd57c('0x4d')};if(_0x1c2bc5[_0xd57c('0x48')]){_0x19e693[_0xd57c('0x4e')]=_0xd57c('0x4f')+_0x1c2bc5[_0xd57c('0x48')]+_0xd57c('0x50');}_0x332ac8[_0xd57c('0x51')](_0x19e693);return _0x332ac8['send'](new Buffer(_0x1c2bc5[_0xd57c('0x47')]));}})['catch'](handleError(_0x332ac8,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index a2458bd..9e67d20 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 _0x4ca2=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util','api'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0x4ca2,0x1d2));var _0x24ca=function(_0x7d8569,_0x2810c8){_0x7d8569=_0x7d8569-0x0;var _0x1b7291=_0x4ca2[_0x7d8569];return _0x1b7291;};'use strict';var _=require('lodash');var util=require(_0x24ca('0x0'));var logger=require('../../config/logger')(_0x24ca('0x1'));var moment=require(_0x24ca('0x2'));var BPromise=require(_0x24ca('0x3'));var rp=require(_0x24ca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x24ca('0x5'));var config=require(_0x24ca('0x6'));var attributes=require('./voiceMailMessage.attributes');module[_0x24ca('0x7')]=function(_0x22bfdb,_0x3305ab){return _0x22bfdb[_0x24ca('0x8')](_0x24ca('0x9'),attributes,{'tableName':_0x24ca('0xa'),'paranoid':![],'indexes':[{'name':_0x24ca('0xb'),'fields':[_0x24ca('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xffcc=['exports','define','VoiceMailMessage','dir','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMailMessage.attributes'];(function(_0xbdf259,_0xfa339c){var _0xce7aa2=function(_0x21b762){while(--_0x21b762){_0xbdf259['push'](_0xbdf259['shift']());}};_0xce7aa2(++_0xfa339c);}(_0xffcc,0x154));var _0xcffc=function(_0x49cf32,_0x3c68f8){_0x49cf32=_0x49cf32-0x0;var _0x1e4e46=_0xffcc[_0x49cf32];return _0x1e4e46;};'use strict';var _=require(_0xcffc('0x0'));var util=require(_0xcffc('0x1'));var logger=require(_0xcffc('0x2'))(_0xcffc('0x3'));var moment=require(_0xcffc('0x4'));var BPromise=require(_0xcffc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcffc('0x6'));var rimraf=require(_0xcffc('0x7'));var config=require(_0xcffc('0x8'));var attributes=require(_0xcffc('0x9'));module[_0xcffc('0xa')]=function(_0x529aaf,_0x4a1509){return _0x529aaf[_0xcffc('0xb')](_0xcffc('0xc'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0xcffc('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index f586eeb..86dda7b 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 _0xfb68=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','message','VoiceMailMessage,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2dc834,_0x105534){var _0x3b6c17=function(_0x3af8be){while(--_0x3af8be){_0x2dc834['push'](_0x2dc834['shift']());}};_0x3b6c17(++_0x105534);}(_0xfb68,0xd5));var _0x8fb6=function(_0x1d5047,_0x1338b2){_0x1d5047=_0x1d5047-0x0;var _0xb39520=_0xfb68[_0x1d5047];return _0xb39520;};'use strict';var _=require(_0x8fb6('0x0'));var util=require(_0x8fb6('0x1'));var moment=require(_0x8fb6('0x2'));var BPromise=require(_0x8fb6('0x3'));var rs=require(_0x8fb6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fb6('0x5'))['db'];var utils=require(_0x8fb6('0x6'));var logger=require(_0x8fb6('0x7'))(_0x8fb6('0x8'));var config=require(_0x8fb6('0x9'));var jayson=require(_0x8fb6('0xa'));var client=jayson['client'][_0x8fb6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbd9524,_0x3e2b29,_0x11d177){return new BPromise(function(_0xf3aa28,_0x343873){return client[_0x8fb6('0xc')](_0xbd9524,_0x11d177)[_0x8fb6('0xd')](function(_0x400153){logger[_0x8fb6('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x3e2b29,_0x8fb6('0xf'));logger[_0x8fb6('0x10')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x3e2b29,'request\x20sent',JSON[_0x8fb6('0x11')](_0x400153));if(_0x400153[_0x8fb6('0x12')]){if(_0x400153[_0x8fb6('0x12')][_0x8fb6('0x13')]===0x1f4){logger[_0x8fb6('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x3e2b29,_0x400153[_0x8fb6('0x12')][_0x8fb6('0x14')]);return _0x343873(_0x400153['error']['message']);}logger['error'](_0x8fb6('0x15'),_0x3e2b29,_0x400153['error'][_0x8fb6('0x14')]);return _0xf3aa28(_0x400153[_0x8fb6('0x12')]['message']);}else{logger[_0x8fb6('0xe')](_0x8fb6('0x15'),_0x3e2b29,_0x8fb6('0xf'));_0xf3aa28(_0x400153['result'][_0x8fb6('0x14')]);}})['catch'](function(_0x18f734){logger[_0x8fb6('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x3e2b29,_0x18f734);_0x343873(_0x18f734);});});} \ No newline at end of file +var _0x0007=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0007,0x71));var _0x7000=function(_0x272fa4,_0xf712d1){_0x272fa4=_0x272fa4-0x0;var _0x25ec85=_0x0007[_0x272fa4];return _0x25ec85;};'use strict';var _=require(_0x7000('0x0'));var util=require(_0x7000('0x1'));var moment=require(_0x7000('0x2'));var BPromise=require(_0x7000('0x3'));var rs=require(_0x7000('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7000('0x5'))['db'];var utils=require(_0x7000('0x6'));var logger=require(_0x7000('0x7'))(_0x7000('0x8'));var config=require(_0x7000('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7000('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a1110,_0x4b6f83,_0x4d8c32){return new BPromise(function(_0xbfbdd,_0x5ad9dc){return client[_0x7000('0xb')](_0x4a1110,_0x4d8c32)[_0x7000('0xc')](function(_0x3bb52c){logger[_0x7000('0xd')](_0x7000('0xe'),_0x4b6f83,_0x7000('0xf'));logger[_0x7000('0x10')](_0x7000('0x11'),_0x4b6f83,'request\x20sent',JSON[_0x7000('0x12')](_0x3bb52c));if(_0x3bb52c['error']){if(_0x3bb52c[_0x7000('0x13')][_0x7000('0x14')]===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x4b6f83,_0x3bb52c[_0x7000('0x13')]['message']);return _0x5ad9dc(_0x3bb52c[_0x7000('0x13')][_0x7000('0x15')]);}logger[_0x7000('0x13')](_0x7000('0xe'),_0x4b6f83,_0x3bb52c[_0x7000('0x13')][_0x7000('0x15')]);return _0xbfbdd(_0x3bb52c[_0x7000('0x13')][_0x7000('0x15')]);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x4b6f83,_0x7000('0xf'));_0xbfbdd(_0x3bb52c['result'][_0x7000('0x15')]);}})[_0x7000('0x16')](function(_0x3d5b16){logger[_0x7000('0x13')](_0x7000('0xe'),_0x4b6f83,_0x3d5b16);_0x5ad9dc(_0x3d5b16);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 246694f..910cfa5 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 _0xb2b1=['exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','getSounds','post','create','/:id/sounds','addSound','put','update','delete','destroy','/:id/sounds/:id2'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xb2b1,0x151));var _0x1b2b=function(_0x3097ff,_0x3747ec){_0x3097ff=_0x3097ff-0x0;var _0x14f09e=_0xb2b1[_0x3097ff];return _0x14f09e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1b2b('0x0'));var timeout=require('connect-timeout');var express=require(_0x1b2b('0x1'));var router=express['Router']();var fs_extra=require(_0x1b2b('0x2'));var auth=require(_0x1b2b('0x3'));var interaction=require(_0x1b2b('0x4'));var config=require(_0x1b2b('0x5'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1b2b('0x6')]);router['get'](_0x1b2b('0x7'),auth[_0x1b2b('0x8')](),controller[_0x1b2b('0x9')]);router['get']('/:id/sounds',auth[_0x1b2b('0x8')](),controller[_0x1b2b('0xa')]);router[_0x1b2b('0xb')]('/',auth[_0x1b2b('0x8')](),controller[_0x1b2b('0xc')]);router[_0x1b2b('0xb')](_0x1b2b('0xd'),auth[_0x1b2b('0x8')](),controller[_0x1b2b('0xe')]);router[_0x1b2b('0xf')](_0x1b2b('0x7'),auth[_0x1b2b('0x8')](),controller[_0x1b2b('0x10')]);router[_0x1b2b('0x11')](_0x1b2b('0x7'),auth[_0x1b2b('0x8')](),controller[_0x1b2b('0x12')]);router['delete'](_0x1b2b('0x13'),auth[_0x1b2b('0x8')](),controller['removeSound']);module[_0x1b2b('0x14')]=router; \ No newline at end of file +var _0x4ddb=['removeSound','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','destroy'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x4ddb,0x1a0));var _0xb4dd=function(_0x3a84a5,_0x238da3){_0x3a84a5=_0x3a84a5-0x0;var _0x1f1e6a=_0x4ddb[_0x3a84a5];return _0x1f1e6a;};'use strict';var multer=require(_0xb4dd('0x0'));var util=require(_0xb4dd('0x1'));var path=require(_0xb4dd('0x2'));var timeout=require('connect-timeout');var express=require(_0xb4dd('0x3'));var router=express[_0xb4dd('0x4')]();var fs_extra=require(_0xb4dd('0x5'));var auth=require(_0xb4dd('0x6'));var interaction=require(_0xb4dd('0x7'));var config=require(_0xb4dd('0x8'));var controller=require(_0xb4dd('0x9'));router[_0xb4dd('0xa')]('/',auth[_0xb4dd('0xb')](),controller['index']);router[_0xb4dd('0xa')](_0xb4dd('0xc'),auth[_0xb4dd('0xb')](),controller[_0xb4dd('0xd')]);router[_0xb4dd('0xa')](_0xb4dd('0xe'),auth[_0xb4dd('0xb')](),controller[_0xb4dd('0xf')]);router[_0xb4dd('0x10')]('/',auth[_0xb4dd('0xb')](),controller[_0xb4dd('0x11')]);router[_0xb4dd('0x10')](_0xb4dd('0xe'),auth[_0xb4dd('0xb')](),controller[_0xb4dd('0x12')]);router[_0xb4dd('0x13')](_0xb4dd('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb4dd('0x14')]);router['delete']('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xb4dd('0x15')]);module[_0xb4dd('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index d4384f9..3bf8503 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 _0x94a1=['STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','alpha','BOOLEAN','sequelize'];(function(_0x18daf5,_0x24f596){var _0x2339de=function(_0x4fc045){while(--_0x4fc045){_0x18daf5['push'](_0x18daf5['shift']());}};_0x2339de(++_0x24f596);}(_0x94a1,0x8b));var _0x194a=function(_0x116ff7,_0x3e0ae2){_0x116ff7=_0x116ff7-0x0;var _0x1701ce=_0x94a1[_0x116ff7];return _0x1701ce;};'use strict';var Sequelize=require(_0x194a('0x0'));module['exports']={'name':{'type':Sequelize[_0x194a('0x1')],'allowNull':![],'unique':_0x194a('0x2')},'mode':{'type':Sequelize[_0x194a('0x3')](_0x194a('0x4'),_0x194a('0x5'),_0x194a('0x6'),_0x194a('0x7'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':_0x194a('0x5')},'directory':{'type':Sequelize[_0x194a('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x194a('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x194a('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x194a('0x8')},'format':{'type':Sequelize[_0x194a('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x194a('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x59b7=['mp3nb','quietmp3nb','quietmp3','mp3','STRING','alpha','BOOLEAN','sequelize','exports','name','custom','files'];(function(_0x38bbc3,_0x4367f5){var _0x3072c7=function(_0x23ccce){while(--_0x23ccce){_0x38bbc3['push'](_0x38bbc3['shift']());}};_0x3072c7(++_0x4367f5);}(_0x59b7,0x17b));var _0x759b=function(_0x15910f,_0x4ae758){_0x15910f=_0x15910f-0x0;var _0x1dba26=_0x59b7[_0x15910f];return _0x1dba26;};'use strict';var Sequelize=require(_0x759b('0x0'));module[_0x759b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x759b('0x2')},'mode':{'type':Sequelize['ENUM'](_0x759b('0x3'),_0x759b('0x4'),_0x759b('0x5'),_0x759b('0x6'),_0x759b('0x7'),_0x759b('0x8')),'allowNull':!![],'defaultValue':_0x759b('0x4')},'directory':{'type':Sequelize[_0x759b('0x9')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x759b('0xa')},'format':{'type':Sequelize[_0x759b('0x9')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x759b('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 e972f07..f85c17e 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 _0x73cb=['VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','include','find','body','sequelize','transaction','files','directory','join','root','server/files/moh','create','mode','mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','params','converted_format','createdAt','server/files/sounds/converted','format','basename','extname','save_name','%s.%s','symlinkSync','removeSound','findOne','id2','Sound','ValidationError','getSounds','nolimit','fast-json-patch','moment','bluebird','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where'];(function(_0x50c50b,_0x3a6fb3){var _0x423c29=function(_0x223cf6){while(--_0x223cf6){_0x50c50b['push'](_0x50c50b['shift']());}};_0x423c29(++_0x3a6fb3);}(_0x73cb,0x1ee));var _0xb73c=function(_0x244883,_0x556cfb){_0x244883=_0x244883-0x0;var _0x4db93a=_0x73cb[_0x244883];return _0x4db93a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb73c('0x0'));var rp=require('request-promise');var moment=require(_0xb73c('0x1'));var BPromise=require(_0xb73c('0x2'));var Mustache=require('mustache');var util=require(_0xb73c('0x3'));var path=require(_0xb73c('0x4'));var sox=require('sox');var csv=require(_0xb73c('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb73c('0x6'));var _=require(_0xb73c('0x7'));var squel=require('squel');var crypto=require(_0xb73c('0x8'));var jsforce=require(_0xb73c('0x9'));var deskjs=require(_0xb73c('0xa'));var toCsv=require(_0xb73c('0x5'));var querystring=require(_0xb73c('0xb'));var Papa=require(_0xb73c('0xc'));var Redis=require('ioredis');var authService=require(_0xb73c('0xd'));var qs=require(_0xb73c('0xe'));var as=require(_0xb73c('0xf'));var hardwareService=require(_0xb73c('0x10'));var logger=require(_0xb73c('0x11'))('api');var utils=require(_0xb73c('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xb73c('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x107640,_0x1ba097){_0x1ba097=_0x1ba097||0xcc;return function(_0x5718e1){if(_0x5718e1){return _0x107640[_0xb73c('0x14')](_0x1ba097);}return _0x107640[_0xb73c('0x15')](_0x1ba097)[_0xb73c('0x16')]();};}function respondWithResult(_0x3282f0,_0x90ca7a){_0x90ca7a=_0x90ca7a||0xc8;return function(_0x30aa95){if(_0x30aa95){return _0x3282f0[_0xb73c('0x15')](_0x90ca7a)[_0xb73c('0x17')](_0x30aa95);}};}function respondWithFilteredResult(_0x25a3d4,_0x24e0d0){return function(_0x8ce249){if(_0x8ce249){var _0x870468=typeof _0x24e0d0[_0xb73c('0x18')]===_0xb73c('0x19')&&typeof _0x24e0d0[_0xb73c('0x1a')]===_0xb73c('0x19');var _0xf196a6=_0x8ce249[_0xb73c('0x1b')];var _0x38e99a=_0x870468?0x0:_0x24e0d0[_0xb73c('0x18')];var _0x1b1c27=_0x870468?_0x8ce249[_0xb73c('0x1b')]:_0x24e0d0[_0xb73c('0x18')]+_0x24e0d0[_0xb73c('0x1a')];var _0xb2d452;if(_0x1b1c27>=_0xf196a6){_0x1b1c27=_0xf196a6;_0xb2d452=0xc8;}else{_0xb2d452=0xce;}_0x25a3d4[_0xb73c('0x15')](_0xb2d452);return _0x25a3d4[_0xb73c('0x1c')](_0xb73c('0x1d'),_0x38e99a+'-'+_0x1b1c27+'/'+_0xf196a6)[_0xb73c('0x17')](_0x8ce249);}return null;};}function patchUpdates(_0x21e58e){return function(_0x5be2ca){try{jsonpatch[_0xb73c('0x1e')](_0x5be2ca,_0x21e58e,!![]);}catch(_0x2c15c4){return BPromise[_0xb73c('0x1f')](_0x2c15c4);}return _0x5be2ca['save']();};}function saveUpdates(_0x53a22f,_0x388151){return function(_0x5c3763){if(_0x5c3763){return _0x5c3763[_0xb73c('0x20')](_0x53a22f)[_0xb73c('0x21')](function(_0x5d909d){return _0x5d909d;});}return null;};}function removeEntity(_0x48e7d3,_0x40d541){return function(_0x27a6c8){if(_0x27a6c8){return _0x27a6c8[_0xb73c('0x22')]()[_0xb73c('0x21')](function(){var _0x5b89e9=_0x27a6c8[_0xb73c('0x23')]({'plain':!![]});var _0xb9fadd=_0xb73c('0x24');return db[_0xb73c('0x25')]['destroy']({'where':{'type':_0xb9fadd,'resourceId':_0x5b89e9['id']}})[_0xb73c('0x21')](function(){return _0x27a6c8;});})[_0xb73c('0x21')](function(){_0x48e7d3[_0xb73c('0x15')](0xcc)[_0xb73c('0x16')]();});}};}function handleEntityNotFound(_0xcff58d,_0x43e3eb){return function(_0xc85da3){if(!_0xc85da3){_0xcff58d['sendStatus'](0x194);}return _0xc85da3;};}function handleError(_0x5bf74b,_0x5248ad){_0x5248ad=_0x5248ad||0x1f4;return function(_0x2aff3d){logger[_0xb73c('0x26')](_0x2aff3d[_0xb73c('0x27')]);if(_0x2aff3d['name']){delete _0x2aff3d[_0xb73c('0x28')];}_0x5bf74b['status'](_0x5248ad)[_0xb73c('0x29')](_0x2aff3d);};}exports[_0xb73c('0x2a')]=function(_0x5e0feb,_0x1d51f6){var _0x54b6c6={},_0x391561={},_0x2575ca={'count':0x0,'rows':[]};var _0xa7f049=_[_0xb73c('0x2b')](db[_0xb73c('0x2c')][_0xb73c('0x2d')],function(_0x508091){return{'name':_0x508091[_0xb73c('0x2e')],'type':_0x508091[_0xb73c('0x2f')][_0xb73c('0x30')]};});_0x391561['model']=_[_0xb73c('0x2b')](_0xa7f049,'name');_0x391561[_0xb73c('0x31')]=_[_0xb73c('0x32')](_0x5e0feb[_0xb73c('0x31')]);_0x391561[_0xb73c('0x33')]=_[_0xb73c('0x34')](_0x391561[_0xb73c('0x35')],_0x391561[_0xb73c('0x31')]);_0x54b6c6[_0xb73c('0x36')]=_[_0xb73c('0x34')](_0x391561['model'],qs[_0xb73c('0x37')](_0x5e0feb[_0xb73c('0x31')][_0xb73c('0x37')]));_0x54b6c6[_0xb73c('0x36')]=_0x54b6c6['attributes'][_0xb73c('0x38')]?_0x54b6c6[_0xb73c('0x36')]:_0x391561[_0xb73c('0x35')];if(!_0x5e0feb[_0xb73c('0x31')][_0xb73c('0x39')]('nolimit')){_0x54b6c6[_0xb73c('0x1a')]=qs[_0xb73c('0x1a')](_0x5e0feb[_0xb73c('0x31')]['limit']);_0x54b6c6[_0xb73c('0x18')]=qs[_0xb73c('0x18')](_0x5e0feb['query'][_0xb73c('0x18')]);}_0x54b6c6[_0xb73c('0x3a')]=qs[_0xb73c('0x3b')](_0x5e0feb[_0xb73c('0x31')]['sort']);delete _0x5e0feb[_0xb73c('0x31')][_0xb73c('0x3b')];_0x54b6c6[_0xb73c('0x3c')]=qs[_0xb73c('0x33')](_['pick'](_0x5e0feb[_0xb73c('0x31')],_0x391561[_0xb73c('0x33')]),_0xa7f049);if(_0x5e0feb[_0xb73c('0x31')]['filter']){_0x54b6c6['where']=_['merge'](_0x54b6c6[_0xb73c('0x3c')],{'$or':_['map'](_0xa7f049,function(_0x4f2165){if(_0x4f2165[_0xb73c('0x2f')]!==_0xb73c('0x3d')){var _0x2c8424={};_0x2c8424[_0x4f2165['name']]={'$like':'%'+_0x5e0feb['query'][_0xb73c('0x3e')]+'%'};return _0x2c8424;}})});}_0x54b6c6=_[_0xb73c('0x3f')]({},_0x54b6c6,_0x5e0feb[_0xb73c('0x40')]);var _0x31a62a={'where':_0x54b6c6['where']};return db[_0xb73c('0x2c')]['count'](_0x31a62a)[_0xb73c('0x21')](function(_0x5dab2f){_0x2575ca[_0xb73c('0x1b')]=_0x5dab2f;if(_0x5e0feb[_0xb73c('0x31')][_0xb73c('0x41')]){_0x54b6c6['include']=[{'all':!![]}];}return db[_0xb73c('0x2c')][_0xb73c('0x42')](_0x54b6c6);})[_0xb73c('0x21')](function(_0x1b70cd){_0x2575ca['rows']=_0x1b70cd;return _0x2575ca;})[_0xb73c('0x21')](respondWithFilteredResult(_0x1d51f6,_0x54b6c6))[_0xb73c('0x43')](handleError(_0x1d51f6,null));};exports[_0xb73c('0x44')]=function(_0x244e5b,_0x1522de){var _0x390e09={'raw':![],'where':{'id':_0x244e5b['params']['id']}},_0x2e793b={};_0x2e793b[_0xb73c('0x35')]=_[_0xb73c('0x32')](db[_0xb73c('0x2c')]['rawAttributes']);_0x2e793b['query']=_[_0xb73c('0x32')](_0x244e5b[_0xb73c('0x31')]);_0x2e793b['filters']=_['intersection'](_0x2e793b['model'],_0x2e793b[_0xb73c('0x31')]);_0x390e09[_0xb73c('0x36')]=_[_0xb73c('0x34')](_0x2e793b[_0xb73c('0x35')],qs['fields'](_0x244e5b[_0xb73c('0x31')][_0xb73c('0x37')]));_0x390e09['attributes']=_0x390e09[_0xb73c('0x36')]['length']?_0x390e09[_0xb73c('0x36')]:_0x2e793b[_0xb73c('0x35')];if(_0x244e5b[_0xb73c('0x31')][_0xb73c('0x41')]){_0x390e09[_0xb73c('0x45')]=[{'all':!![]}];}_0x390e09=_[_0xb73c('0x3f')]({},_0x390e09,_0x244e5b[_0xb73c('0x40')]);return db[_0xb73c('0x2c')][_0xb73c('0x46')](_0x390e09)[_0xb73c('0x21')](handleEntityNotFound(_0x1522de,null))[_0xb73c('0x21')](respondWithResult(_0x1522de,null))[_0xb73c('0x43')](handleError(_0x1522de,null));};exports['update']=function(_0x5e3ab0,_0x180725){if(_0x5e3ab0[_0xb73c('0x47')]['id']){delete _0x5e3ab0[_0xb73c('0x47')]['id'];}return db['VoiceMusicOnHold'][_0xb73c('0x46')]({'where':{'id':_0x5e3ab0['params']['id']}})[_0xb73c('0x21')](handleEntityNotFound(_0x180725,null))['then'](saveUpdates(_0x5e3ab0[_0xb73c('0x47')],null))['then'](respondWithResult(_0x180725,null))[_0xb73c('0x43')](handleError(_0x180725,null));};exports['create']=function(_0x9eb66,_0x5a65dc,_0x573214){return db[_0xb73c('0x48')][_0xb73c('0x49')](function(_0x2a5878){if(_0x9eb66[_0xb73c('0x47')]['mode']===_0xb73c('0x4a')){_0x9eb66['body'][_0xb73c('0x4b')]=path[_0xb73c('0x4c')](config[_0xb73c('0x4d')],_0xb73c('0x4e'),_0x9eb66[_0xb73c('0x47')][_0xb73c('0x28')]);}return db[_0xb73c('0x2c')][_0xb73c('0x4f')](_0x9eb66[_0xb73c('0x47')],{'transaction':_0x2a5878})[_0xb73c('0x21')](function(_0x145fbb){if(_0x9eb66[_0xb73c('0x47')][_0xb73c('0x50')]==='files'){fs[_0xb73c('0x51')](_0x145fbb[_0xb73c('0x4b')],parseInt('0777',0x8));}var _0x172a6f=_0x9eb66['user']['get']({'plain':!![]});if(!_0x172a6f)throw new Error(_0xb73c('0x52'));if(_0x172a6f[_0xb73c('0x53')]===_0xb73c('0x54')){var _0x3e0c3f=_0x145fbb[_0xb73c('0x23')]({'plain':!![]});return db['UserProfileSection'][_0xb73c('0x46')]({'where':{'name':_0xb73c('0x24'),'userProfileId':_0x172a6f[_0xb73c('0x55')]},'raw':!![]})['then'](function(_0x3e87b5){if(_0x3e87b5&&_0x3e87b5[_0xb73c('0x56')]===0x0){return db['UserProfileResource'][_0xb73c('0x4f')]({'name':_0x3e0c3f['name'],'resourceId':_0x3e0c3f['id'],'type':_0x3e87b5['name'],'sectionId':_0x3e87b5['id']},{})[_0xb73c('0x21')](function(){return _0x145fbb;});}else{return _0x145fbb;}})[_0xb73c('0x43')](function(_0x3657c3){logger[_0xb73c('0x26')](_0xb73c('0x57'),_0x3657c3);});}return _0x145fbb;});})[_0xb73c('0x21')](respondWithResult(_0x5a65dc,0xc9))[_0xb73c('0x43')](handleError(_0x5a65dc,null));};exports['destroy']=function(_0x5098a1,_0xb56a4b,_0x3dcb98){var _0xf745cf;return db['VoiceMusicOnHold'][_0xb73c('0x46')]({'where':{'id':_0x5098a1['params']['id']}})['then'](function(_0x330b15){if(_0x330b15){return db[_0xb73c('0x48')][_0xb73c('0x49')](function(_0x2801f6){return _0x330b15[_0xb73c('0x22')]({'transaction':_0x2801f6,'raw':!![]})[_0xb73c('0x21')](function(_0x3d5f71){if(_0x3d5f71[_0xb73c('0x4b')]){fs['readdirSync'](_0x3d5f71[_0xb73c('0x4b')])[_0xb73c('0x58')](function(_0x3f7c28){fs[_0xb73c('0x59')](path[_0xb73c('0x4c')](_0x3d5f71[_0xb73c('0x4b')],_0x3f7c28));});fs[_0xb73c('0x5a')](_0x3d5f71['directory']);}return _0x3d5f71;});})[_0xb73c('0x43')](function(_0x3f6147){throw new db[(_0xb73c('0x5b'))]['ValidationError'](_0x3f6147[_0xb73c('0x5c')]);});}})[_0xb73c('0x21')](handleEntityNotFound(_0xb56a4b,null))[_0xb73c('0x21')](removeEntity(_0xb56a4b,null))['catch'](handleError(_0xb56a4b,null));};exports[_0xb73c('0x5d')]=function(_0x541d8e,_0x1a33f7,_0x1e3e76){return db[_0xb73c('0x48')][_0xb73c('0x49')](function(_0x3425d2){var _0x49a141;return db[_0xb73c('0x2c')]['find']({'where':{'id':_0x541d8e[_0xb73c('0x5e')]['id']}})[_0xb73c('0x21')](function(_0x41b97a){if(_0x41b97a){_0x49a141=_0x41b97a;return _0x41b97a[_0xb73c('0x5d')](_0x541d8e[_0xb73c('0x47')]['id'],{'transaction':_0x3425d2});}})['then'](function(_0x1ab0fa){if(_0x1ab0fa){return db['Sound']['findOne']({'where':{'id':_0x541d8e[_0xb73c('0x47')]['id']},'attributes':['id',_0xb73c('0x28'),'save_name',_0xb73c('0x5f'),_0xb73c('0x60')],'raw':!![]});}})[_0xb73c('0x21')](function(_0x53e40e){if(_0x53e40e){var _0x483dd5=path[_0xb73c('0x4c')](config[_0xb73c('0x4d')],_0xb73c('0x61'),util[_0xb73c('0x62')]('%s.%s',path[_0xb73c('0x63')](_0x53e40e['save_name'],path[_0xb73c('0x64')](_0x53e40e[_0xb73c('0x65')])),_0x53e40e[_0xb73c('0x5f')]));var _0x42d367=path[_0xb73c('0x4c')](config[_0xb73c('0x4d')],_0xb73c('0x4e'),_0x49a141[_0xb73c('0x28')],util[_0xb73c('0x62')](_0xb73c('0x66'),_0x53e40e[_0xb73c('0x28')],_0x53e40e[_0xb73c('0x5f')]));fs[_0xb73c('0x67')](_0x483dd5,_0x42d367);return _0x53e40e;}})[_0xb73c('0x43')](function(_0x34f8ba){throw new db[(_0xb73c('0x5b'))]['ValidationError'](_0x34f8ba[_0xb73c('0x5c')]);});})[_0xb73c('0x21')](handleEntityNotFound(_0x1a33f7,null))['then'](respondWithResult(_0x1a33f7,0xc9))[_0xb73c('0x43')](handleError(_0x1a33f7,null));};exports[_0xb73c('0x68')]=function(_0x3d5cb3,_0x440abb,_0xa1f521){return db[_0xb73c('0x48')][_0xb73c('0x49')](function(_0x3d8707){var _0x229cfd;return db['VoiceMusicOnHold'][_0xb73c('0x69')]({'where':{'id':_0x3d5cb3[_0xb73c('0x5e')]['id']}})['then'](handleEntityNotFound(_0x440abb,null))[_0xb73c('0x21')](function(_0x433d12){if(_0x433d12){_0x229cfd=_0x433d12;return _0x433d12['removeSound'](_0x3d5cb3[_0xb73c('0x5e')][_0xb73c('0x6a')]);}})['then'](function(_0x123c37){if(_0x123c37){return db[_0xb73c('0x6b')][_0xb73c('0x69')]({'where':{'id':_0x3d5cb3['params'][_0xb73c('0x6a')]},'attributes':['id',_0xb73c('0x28'),'save_name',_0xb73c('0x5f'),'createdAt'],'raw':!![]});}})[_0xb73c('0x21')](function(_0x3f0fd9){if(_0x3f0fd9){fs['unlinkSync'](path[_0xb73c('0x4c')](_0x229cfd[_0xb73c('0x4b')],util[_0xb73c('0x62')](_0xb73c('0x66'),_0x3f0fd9[_0xb73c('0x28')],_0x3f0fd9[_0xb73c('0x5f')])));return _0x3f0fd9;}})['catch'](function(_0x181b06){throw new db[(_0xb73c('0x5b'))][(_0xb73c('0x6c'))](_0x181b06[_0xb73c('0x5c')]);});})[_0xb73c('0x21')](handleEntityNotFound(_0x440abb,null))['then'](respondWithStatusCode(_0x440abb,0xcc))[_0xb73c('0x43')](handleError(_0x440abb,null));};exports[_0xb73c('0x6d')]=function(_0x14eaf4,_0x86d8f1,_0x477f4e){var _0x1d18ab={};var _0x13970f={};var _0x266b21;var _0x1f374e;return db['VoiceMusicOnHold'][_0xb73c('0x69')]({'where':{'id':_0x14eaf4[_0xb73c('0x5e')]['id']}})[_0xb73c('0x21')](handleEntityNotFound(_0x86d8f1,null))['then'](function(_0x12452a){if(_0x12452a){_0x266b21=_0x12452a;_0x13970f['model']=_[_0xb73c('0x32')](db[_0xb73c('0x6b')][_0xb73c('0x2d')]);_0x13970f['query']=_[_0xb73c('0x32')](_0x14eaf4[_0xb73c('0x31')]);_0x13970f[_0xb73c('0x33')]=_[_0xb73c('0x34')](_0x13970f['model'],_0x13970f[_0xb73c('0x31')]);_0x1d18ab[_0xb73c('0x36')]=_[_0xb73c('0x34')](_0x13970f[_0xb73c('0x35')],qs['fields'](_0x14eaf4['query'][_0xb73c('0x37')]));_0x1d18ab['attributes']=_0x1d18ab[_0xb73c('0x36')][_0xb73c('0x38')]?_0x1d18ab[_0xb73c('0x36')]:_0x13970f[_0xb73c('0x35')];_0x1d18ab[_0xb73c('0x3a')]=qs[_0xb73c('0x3b')](_0x14eaf4[_0xb73c('0x31')][_0xb73c('0x3b')]);_0x1d18ab[_0xb73c('0x3c')]=qs[_0xb73c('0x33')](_['pick'](_0x14eaf4[_0xb73c('0x31')],_0x13970f[_0xb73c('0x33')]));if(_0x14eaf4[_0xb73c('0x31')]['filter']){_0x1d18ab[_0xb73c('0x3c')]=_['merge'](_0x1d18ab[_0xb73c('0x3c')],{'$or':_[_0xb73c('0x2b')](_0x1d18ab[_0xb73c('0x36')],function(_0x32cdec){var _0x52469b={};_0x52469b[_0x32cdec]={'$like':'%'+_0x14eaf4[_0xb73c('0x31')][_0xb73c('0x3e')]+'%'};return _0x52469b;})});}_0x1d18ab=_['merge']({},_0x1d18ab,_0x14eaf4[_0xb73c('0x40')]);return _0x266b21[_0xb73c('0x6d')](_0x1d18ab);}})['then'](function(_0x592523){if(_0x592523){_0x1f374e=_0x592523[_0xb73c('0x38')];if(!_0x14eaf4[_0xb73c('0x31')][_0xb73c('0x39')](_0xb73c('0x6e'))){_0x1d18ab['limit']=qs[_0xb73c('0x1a')](_0x14eaf4[_0xb73c('0x31')]['limit']);_0x1d18ab[_0xb73c('0x18')]=qs['offset'](_0x14eaf4['query'][_0xb73c('0x18')]);}return _0x266b21[_0xb73c('0x6d')](_0x1d18ab);}})[_0xb73c('0x21')](function(_0x5bc343){if(_0x5bc343){return _0x5bc343?{'count':_0x1f374e,'rows':_0x5bc343}:null;}})['then'](respondWithResult(_0x86d8f1,null))['catch'](handleError(_0x86d8f1,null));}; \ No newline at end of file +var _0x2fde=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','reject','update','then','get','MusicOnHolds','UserProfileResource','destroy','end','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','where','merge','VIRTUAL','filter','options','VoiceMusicOnHold','catch','params','includeAll','find','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','forEach','unlinkSync','rmdirSync','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','getSounds','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0x1290a5,_0x5baae4){var _0x384d7a=function(_0x504167){while(--_0x504167){_0x1290a5['push'](_0x1290a5['shift']());}};_0x384d7a(++_0x5baae4);}(_0x2fde,0xc3));var _0xe2fd=function(_0xf86508,_0x46069b){_0xf86508=_0xf86508-0x0;var _0x4819e7=_0x2fde[_0xf86508];return _0x4819e7;};'use strict';var emlformat=require(_0xe2fd('0x0'));var rimraf=require(_0xe2fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe2fd('0x2'));var rp=require(_0xe2fd('0x3'));var moment=require(_0xe2fd('0x4'));var BPromise=require(_0xe2fd('0x5'));var Mustache=require('mustache');var util=require(_0xe2fd('0x6'));var path=require(_0xe2fd('0x7'));var sox=require(_0xe2fd('0x8'));var csv=require(_0xe2fd('0x9'));var ejs=require(_0xe2fd('0xa'));var fs=require('fs');var fs_extra=require(_0xe2fd('0xb'));var _=require(_0xe2fd('0xc'));var squel=require(_0xe2fd('0xd'));var crypto=require(_0xe2fd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe2fd('0xf'));var toCsv=require(_0xe2fd('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe2fd('0x10'));var authService=require(_0xe2fd('0x11'));var qs=require(_0xe2fd('0x12'));var as=require(_0xe2fd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe2fd('0x14'));var utils=require(_0xe2fd('0x15'));var config=require(_0xe2fd('0x16'));var licenseUtil=require(_0xe2fd('0x17'));var db=require(_0xe2fd('0x18'))['db'];function respondWithStatusCode(_0x4c6fac,_0xc009d){_0xc009d=_0xc009d||0xcc;return function(_0x2e6f74){if(_0x2e6f74){return _0x4c6fac[_0xe2fd('0x19')](_0xc009d);}return _0x4c6fac[_0xe2fd('0x1a')](_0xc009d)['end']();};}function respondWithResult(_0x3916dd,_0x5b4487){_0x5b4487=_0x5b4487||0xc8;return function(_0x23839e){if(_0x23839e){return _0x3916dd['status'](_0x5b4487)[_0xe2fd('0x1b')](_0x23839e);}};}function respondWithFilteredResult(_0xe3613b,_0x173275){return function(_0x405125){if(_0x405125){var _0x3725e8=typeof _0x173275['offset']===_0xe2fd('0x1c')&&typeof _0x173275['limit']===_0xe2fd('0x1c');var _0x3707f1=_0x405125[_0xe2fd('0x1d')];var _0x574774=_0x3725e8?0x0:_0x173275[_0xe2fd('0x1e')];var _0x20b5cc=_0x3725e8?_0x405125[_0xe2fd('0x1d')]:_0x173275[_0xe2fd('0x1e')]+_0x173275['limit'];var _0x5cf4ba;if(_0x20b5cc>=_0x3707f1){_0x20b5cc=_0x3707f1;_0x5cf4ba=0xc8;}else{_0x5cf4ba=0xce;}_0xe3613b[_0xe2fd('0x1a')](_0x5cf4ba);return _0xe3613b[_0xe2fd('0x1f')](_0xe2fd('0x20'),_0x574774+'-'+_0x20b5cc+'/'+_0x3707f1)[_0xe2fd('0x1b')](_0x405125);}return null;};}function patchUpdates(_0x56cb7c){return function(_0x123ad9){try{jsonpatch[_0xe2fd('0x21')](_0x123ad9,_0x56cb7c,!![]);}catch(_0x3d5f2e){return BPromise[_0xe2fd('0x22')](_0x3d5f2e);}return _0x123ad9['save']();};}function saveUpdates(_0x23c5b4,_0x4f4ac3){return function(_0x237e10){if(_0x237e10){return _0x237e10[_0xe2fd('0x23')](_0x23c5b4)[_0xe2fd('0x24')](function(_0x1e9197){return _0x1e9197;});}return null;};}function removeEntity(_0x16ab49,_0x3d2885){return function(_0x36964d){if(_0x36964d){return _0x36964d['destroy']()['then'](function(){var _0x121405=_0x36964d[_0xe2fd('0x25')]({'plain':!![]});var _0x555f66=_0xe2fd('0x26');return db[_0xe2fd('0x27')][_0xe2fd('0x28')]({'where':{'type':_0x555f66,'resourceId':_0x121405['id']}})[_0xe2fd('0x24')](function(){return _0x36964d;});})[_0xe2fd('0x24')](function(){_0x16ab49['status'](0xcc)[_0xe2fd('0x29')]();});}};}function handleEntityNotFound(_0x370908,_0x9b6e2b){return function(_0x395419){if(!_0x395419){_0x370908['sendStatus'](0x194);}return _0x395419;};}function handleError(_0x4fa814,_0x26eb75){_0x26eb75=_0x26eb75||0x1f4;return function(_0x43d4c7){logger[_0xe2fd('0x2a')](_0x43d4c7['stack']);if(_0x43d4c7[_0xe2fd('0x2b')]){delete _0x43d4c7['name'];}_0x4fa814[_0xe2fd('0x1a')](_0x26eb75)['send'](_0x43d4c7);};}exports[_0xe2fd('0x2c')]=function(_0x41a0f8,_0x4d86fd){var _0x3dd4c3={},_0xc22149={},_0x260b41={'count':0x0,'rows':[]};var _0x49c56a=_[_0xe2fd('0x2d')](db['VoiceMusicOnHold'][_0xe2fd('0x2e')],function(_0x14f7d4){return{'name':_0x14f7d4[_0xe2fd('0x2f')],'type':_0x14f7d4[_0xe2fd('0x30')][_0xe2fd('0x31')]};});_0xc22149[_0xe2fd('0x32')]=_['map'](_0x49c56a,_0xe2fd('0x2b'));_0xc22149[_0xe2fd('0x33')]=_[_0xe2fd('0x34')](_0x41a0f8['query']);_0xc22149['filters']=_[_0xe2fd('0x35')](_0xc22149[_0xe2fd('0x32')],_0xc22149[_0xe2fd('0x33')]);_0x3dd4c3[_0xe2fd('0x36')]=_[_0xe2fd('0x35')](_0xc22149[_0xe2fd('0x32')],qs[_0xe2fd('0x37')](_0x41a0f8[_0xe2fd('0x33')][_0xe2fd('0x37')]));_0x3dd4c3[_0xe2fd('0x36')]=_0x3dd4c3[_0xe2fd('0x36')][_0xe2fd('0x38')]?_0x3dd4c3[_0xe2fd('0x36')]:_0xc22149['model'];if(!_0x41a0f8[_0xe2fd('0x33')][_0xe2fd('0x39')](_0xe2fd('0x3a'))){_0x3dd4c3[_0xe2fd('0x3b')]=qs['limit'](_0x41a0f8[_0xe2fd('0x33')][_0xe2fd('0x3b')]);_0x3dd4c3[_0xe2fd('0x1e')]=qs[_0xe2fd('0x1e')](_0x41a0f8[_0xe2fd('0x33')][_0xe2fd('0x1e')]);}_0x3dd4c3[_0xe2fd('0x3c')]=qs[_0xe2fd('0x3d')](_0x41a0f8['query'][_0xe2fd('0x3d')]);delete _0x41a0f8[_0xe2fd('0x33')][_0xe2fd('0x3d')];_0x3dd4c3['where']=qs['filters'](_[_0xe2fd('0x3e')](_0x41a0f8['query'],_0xc22149[_0xe2fd('0x3f')]),_0x49c56a);if(_0x41a0f8[_0xe2fd('0x33')]['filter']){_0x3dd4c3[_0xe2fd('0x40')]=_[_0xe2fd('0x41')](_0x3dd4c3[_0xe2fd('0x40')],{'$or':_['map'](_0x49c56a,function(_0x3264e1){if(_0x3264e1[_0xe2fd('0x30')]!==_0xe2fd('0x42')){var _0x455ed9={};_0x455ed9[_0x3264e1['name']]={'$like':'%'+_0x41a0f8[_0xe2fd('0x33')][_0xe2fd('0x43')]+'%'};return _0x455ed9;}})});}_0x3dd4c3=_[_0xe2fd('0x41')]({},_0x3dd4c3,_0x41a0f8[_0xe2fd('0x44')]);var _0xa65b2b={'where':_0x3dd4c3[_0xe2fd('0x40')]};return db[_0xe2fd('0x45')][_0xe2fd('0x1d')](_0xa65b2b)[_0xe2fd('0x24')](function(_0x2f222b){_0x260b41[_0xe2fd('0x1d')]=_0x2f222b;if(_0x41a0f8[_0xe2fd('0x33')]['includeAll']){_0x3dd4c3['include']=[{'all':!![]}];}return db[_0xe2fd('0x45')]['findAll'](_0x3dd4c3);})[_0xe2fd('0x24')](function(_0x16d56d){_0x260b41['rows']=_0x16d56d;return _0x260b41;})[_0xe2fd('0x24')](respondWithFilteredResult(_0x4d86fd,_0x3dd4c3))[_0xe2fd('0x46')](handleError(_0x4d86fd,null));};exports['show']=function(_0xa7eaee,_0x5c9a3b){var _0x4feca5={'raw':![],'where':{'id':_0xa7eaee[_0xe2fd('0x47')]['id']}},_0x385975={};_0x385975[_0xe2fd('0x32')]=_[_0xe2fd('0x34')](db[_0xe2fd('0x45')]['rawAttributes']);_0x385975[_0xe2fd('0x33')]=_[_0xe2fd('0x34')](_0xa7eaee[_0xe2fd('0x33')]);_0x385975[_0xe2fd('0x3f')]=_[_0xe2fd('0x35')](_0x385975['model'],_0x385975[_0xe2fd('0x33')]);_0x4feca5[_0xe2fd('0x36')]=_[_0xe2fd('0x35')](_0x385975[_0xe2fd('0x32')],qs[_0xe2fd('0x37')](_0xa7eaee[_0xe2fd('0x33')][_0xe2fd('0x37')]));_0x4feca5['attributes']=_0x4feca5[_0xe2fd('0x36')][_0xe2fd('0x38')]?_0x4feca5[_0xe2fd('0x36')]:_0x385975[_0xe2fd('0x32')];if(_0xa7eaee[_0xe2fd('0x33')][_0xe2fd('0x48')]){_0x4feca5['include']=[{'all':!![]}];}_0x4feca5=_['merge']({},_0x4feca5,_0xa7eaee['options']);return db[_0xe2fd('0x45')][_0xe2fd('0x49')](_0x4feca5)[_0xe2fd('0x24')](handleEntityNotFound(_0x5c9a3b,null))['then'](respondWithResult(_0x5c9a3b,null))[_0xe2fd('0x46')](handleError(_0x5c9a3b,null));};exports[_0xe2fd('0x23')]=function(_0x1187bd,_0x52405c){if(_0x1187bd[_0xe2fd('0x4a')]['id']){delete _0x1187bd[_0xe2fd('0x4a')]['id'];}return db['VoiceMusicOnHold'][_0xe2fd('0x49')]({'where':{'id':_0x1187bd[_0xe2fd('0x47')]['id']}})['then'](handleEntityNotFound(_0x52405c,null))['then'](saveUpdates(_0x1187bd[_0xe2fd('0x4a')],null))[_0xe2fd('0x24')](respondWithResult(_0x52405c,null))[_0xe2fd('0x46')](handleError(_0x52405c,null));};exports[_0xe2fd('0x4b')]=function(_0x1fc9ea,_0x136e5a,_0x2667ca){return db[_0xe2fd('0x4c')][_0xe2fd('0x4d')](function(_0x69d368){if(_0x1fc9ea['body'][_0xe2fd('0x4e')]===_0xe2fd('0x4f')){_0x1fc9ea[_0xe2fd('0x4a')][_0xe2fd('0x50')]=path[_0xe2fd('0x51')](config[_0xe2fd('0x52')],_0xe2fd('0x53'),_0x1fc9ea[_0xe2fd('0x4a')][_0xe2fd('0x2b')]);}return db[_0xe2fd('0x45')][_0xe2fd('0x4b')](_0x1fc9ea[_0xe2fd('0x4a')],{'transaction':_0x69d368})[_0xe2fd('0x24')](function(_0x5bbcc5){if(_0x1fc9ea[_0xe2fd('0x4a')][_0xe2fd('0x4e')]===_0xe2fd('0x4f')){fs['mkdirSync'](_0x5bbcc5[_0xe2fd('0x50')],parseInt('0777',0x8));}var _0x4e831a=_0x1fc9ea[_0xe2fd('0x54')][_0xe2fd('0x25')]({'plain':!![]});if(!_0x4e831a)throw new Error(_0xe2fd('0x55'));if(_0x4e831a[_0xe2fd('0x56')]===_0xe2fd('0x54')){var _0x36b2ee=_0x5bbcc5['get']({'plain':!![]});return db[_0xe2fd('0x57')][_0xe2fd('0x49')]({'where':{'name':'MusicOnHolds','userProfileId':_0x4e831a['userProfileId']},'raw':!![]})[_0xe2fd('0x24')](function(_0x4fe683){if(_0x4fe683&&_0x4fe683[_0xe2fd('0x58')]===0x0){return db[_0xe2fd('0x27')][_0xe2fd('0x4b')]({'name':_0x36b2ee[_0xe2fd('0x2b')],'resourceId':_0x36b2ee['id'],'type':_0x4fe683[_0xe2fd('0x2b')],'sectionId':_0x4fe683['id']},{})[_0xe2fd('0x24')](function(){return _0x5bbcc5;});}else{return _0x5bbcc5;}})[_0xe2fd('0x46')](function(_0x364ee0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x364ee0);});}return _0x5bbcc5;});})[_0xe2fd('0x24')](respondWithResult(_0x136e5a,0xc9))[_0xe2fd('0x46')](handleError(_0x136e5a,null));};exports[_0xe2fd('0x28')]=function(_0x5d6c2d,_0x171a22,_0x4e1950){var _0x57306c;return db[_0xe2fd('0x45')][_0xe2fd('0x49')]({'where':{'id':_0x5d6c2d[_0xe2fd('0x47')]['id']}})[_0xe2fd('0x24')](function(_0x4187a2){if(_0x4187a2){return db[_0xe2fd('0x4c')][_0xe2fd('0x4d')](function(_0x48b4dc){return _0x4187a2[_0xe2fd('0x28')]({'transaction':_0x48b4dc,'raw':!![]})[_0xe2fd('0x24')](function(_0x104a5c){if(_0x104a5c[_0xe2fd('0x50')]){fs['readdirSync'](_0x104a5c[_0xe2fd('0x50')])[_0xe2fd('0x59')](function(_0x2dcfb2){fs[_0xe2fd('0x5a')](path[_0xe2fd('0x51')](_0x104a5c[_0xe2fd('0x50')],_0x2dcfb2));});fs[_0xe2fd('0x5b')](_0x104a5c[_0xe2fd('0x50')]);}return _0x104a5c;});})[_0xe2fd('0x46')](function(_0x3f0ff0){throw new db['Sequelize'][(_0xe2fd('0x5c'))](_0x3f0ff0[_0xe2fd('0x5d')]);});}})['then'](handleEntityNotFound(_0x171a22,null))[_0xe2fd('0x24')](removeEntity(_0x171a22,null))[_0xe2fd('0x46')](handleError(_0x171a22,null));};exports['addSound']=function(_0x52c939,_0x3bd285,_0x4039d5){return db[_0xe2fd('0x4c')][_0xe2fd('0x4d')](function(_0x7f082b){var _0x597bae;return db[_0xe2fd('0x45')][_0xe2fd('0x49')]({'where':{'id':_0x52c939[_0xe2fd('0x47')]['id']}})[_0xe2fd('0x24')](function(_0xa4347e){if(_0xa4347e){_0x597bae=_0xa4347e;return _0xa4347e[_0xe2fd('0x5e')](_0x52c939[_0xe2fd('0x4a')]['id'],{'transaction':_0x7f082b});}})[_0xe2fd('0x24')](function(_0x1b96bb){if(_0x1b96bb){return db[_0xe2fd('0x5f')][_0xe2fd('0x60')]({'where':{'id':_0x52c939['body']['id']},'attributes':['id',_0xe2fd('0x2b'),_0xe2fd('0x61'),_0xe2fd('0x62'),_0xe2fd('0x63')],'raw':!![]});}})[_0xe2fd('0x24')](function(_0x166c4f){if(_0x166c4f){var _0x468d41=path[_0xe2fd('0x51')](config[_0xe2fd('0x52')],'server/files/sounds/converted',util[_0xe2fd('0x64')](_0xe2fd('0x65'),path[_0xe2fd('0x66')](_0x166c4f[_0xe2fd('0x61')],path[_0xe2fd('0x67')](_0x166c4f['save_name'])),_0x166c4f[_0xe2fd('0x62')]));var _0x33c574=path[_0xe2fd('0x51')](config['root'],_0xe2fd('0x53'),_0x597bae['name'],util[_0xe2fd('0x64')]('%s.%s',_0x166c4f['name'],_0x166c4f['converted_format']));fs[_0xe2fd('0x68')](_0x468d41,_0x33c574);return _0x166c4f;}})[_0xe2fd('0x46')](function(_0x50aaea){throw new db['Sequelize'][(_0xe2fd('0x5c'))](_0x50aaea[_0xe2fd('0x5d')]);});})[_0xe2fd('0x24')](handleEntityNotFound(_0x3bd285,null))[_0xe2fd('0x24')](respondWithResult(_0x3bd285,0xc9))[_0xe2fd('0x46')](handleError(_0x3bd285,null));};exports['removeSound']=function(_0x4e063f,_0x3d597b,_0x165f56){return db[_0xe2fd('0x4c')]['transaction'](function(_0x577513){var _0x44fb87;return db[_0xe2fd('0x45')]['findOne']({'where':{'id':_0x4e063f[_0xe2fd('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d597b,null))[_0xe2fd('0x24')](function(_0x67321b){if(_0x67321b){_0x44fb87=_0x67321b;return _0x67321b[_0xe2fd('0x69')](_0x4e063f[_0xe2fd('0x47')][_0xe2fd('0x6a')]);}})['then'](function(_0x2c4c0a){if(_0x2c4c0a){return db['Sound'][_0xe2fd('0x60')]({'where':{'id':_0x4e063f[_0xe2fd('0x47')][_0xe2fd('0x6a')]},'attributes':['id','name','save_name',_0xe2fd('0x62'),_0xe2fd('0x63')],'raw':!![]});}})[_0xe2fd('0x24')](function(_0x2e8543){if(_0x2e8543){fs[_0xe2fd('0x5a')](path[_0xe2fd('0x51')](_0x44fb87['directory'],util[_0xe2fd('0x64')]('%s.%s',_0x2e8543[_0xe2fd('0x2b')],_0x2e8543[_0xe2fd('0x62')])));return _0x2e8543;}})[_0xe2fd('0x46')](function(_0x5be0cf){throw new db['Sequelize'][(_0xe2fd('0x5c'))](_0x5be0cf['message']);});})[_0xe2fd('0x24')](handleEntityNotFound(_0x3d597b,null))[_0xe2fd('0x24')](respondWithStatusCode(_0x3d597b,0xcc))[_0xe2fd('0x46')](handleError(_0x3d597b,null));};exports[_0xe2fd('0x6b')]=function(_0x8a1d55,_0x1a8e88,_0x3f0955){var _0x14b373={};var _0x106610={};var _0x24c140;var _0x36b036;return db[_0xe2fd('0x45')]['findOne']({'where':{'id':_0x8a1d55[_0xe2fd('0x47')]['id']}})[_0xe2fd('0x24')](handleEntityNotFound(_0x1a8e88,null))[_0xe2fd('0x24')](function(_0x71291c){if(_0x71291c){_0x24c140=_0x71291c;_0x106610[_0xe2fd('0x32')]=_[_0xe2fd('0x34')](db[_0xe2fd('0x5f')]['rawAttributes']);_0x106610[_0xe2fd('0x33')]=_[_0xe2fd('0x34')](_0x8a1d55[_0xe2fd('0x33')]);_0x106610[_0xe2fd('0x3f')]=_[_0xe2fd('0x35')](_0x106610[_0xe2fd('0x32')],_0x106610['query']);_0x14b373[_0xe2fd('0x36')]=_[_0xe2fd('0x35')](_0x106610[_0xe2fd('0x32')],qs[_0xe2fd('0x37')](_0x8a1d55[_0xe2fd('0x33')][_0xe2fd('0x37')]));_0x14b373[_0xe2fd('0x36')]=_0x14b373[_0xe2fd('0x36')][_0xe2fd('0x38')]?_0x14b373['attributes']:_0x106610[_0xe2fd('0x32')];_0x14b373[_0xe2fd('0x3c')]=qs[_0xe2fd('0x3d')](_0x8a1d55[_0xe2fd('0x33')][_0xe2fd('0x3d')]);_0x14b373['where']=qs[_0xe2fd('0x3f')](_['pick'](_0x8a1d55[_0xe2fd('0x33')],_0x106610[_0xe2fd('0x3f')]));if(_0x8a1d55[_0xe2fd('0x33')][_0xe2fd('0x43')]){_0x14b373[_0xe2fd('0x40')]=_[_0xe2fd('0x41')](_0x14b373[_0xe2fd('0x40')],{'$or':_[_0xe2fd('0x2d')](_0x14b373[_0xe2fd('0x36')],function(_0x2a57d9){var _0xfe6829={};_0xfe6829[_0x2a57d9]={'$like':'%'+_0x8a1d55[_0xe2fd('0x33')]['filter']+'%'};return _0xfe6829;})});}_0x14b373=_['merge']({},_0x14b373,_0x8a1d55['options']);return _0x24c140['getSounds'](_0x14b373);}})['then'](function(_0x56aecb){if(_0x56aecb){_0x36b036=_0x56aecb[_0xe2fd('0x38')];if(!_0x8a1d55[_0xe2fd('0x33')][_0xe2fd('0x39')](_0xe2fd('0x3a'))){_0x14b373[_0xe2fd('0x3b')]=qs['limit'](_0x8a1d55[_0xe2fd('0x33')]['limit']);_0x14b373[_0xe2fd('0x1e')]=qs[_0xe2fd('0x1e')](_0x8a1d55['query'][_0xe2fd('0x1e')]);}return _0x24c140[_0xe2fd('0x6b')](_0x14b373);}})['then'](function(_0x59d262){if(_0x59d262){return _0x59d262?{'count':_0x36b036,'rows':_0x59d262}:null;}})['then'](respondWithResult(_0x1a8e88,null))[_0xe2fd('0x46')](handleError(_0x1a8e88,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 3baadd8..3b6a4eb 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 _0x5ba2=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5ba2,0x16b));var _0x25ba=function(_0x2e9187,_0x3763f6){_0x2e9187=_0x2e9187-0x0;var _0x1fc3a8=_0x5ba2[_0x2e9187];return _0x1fc3a8;};'use strict';var _=require('lodash');var util=require(_0x25ba('0x0'));var logger=require(_0x25ba('0x1'))(_0x25ba('0x2'));var moment=require(_0x25ba('0x3'));var BPromise=require(_0x25ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x25ba('0x5'));var rimraf=require('rimraf');var config=require(_0x25ba('0x6'));var attributes=require(_0x25ba('0x7'));module[_0x25ba('0x8')]=function(_0x8bd050,_0x330942){return _0x8bd050[_0x25ba('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0x25ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x965d=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','VoiceMusicOnHold','util'];(function(_0x4d6ac0,_0x201628){var _0x5296c4=function(_0x3d0b3d){while(--_0x3d0b3d){_0x4d6ac0['push'](_0x4d6ac0['shift']());}};_0x5296c4(++_0x201628);}(_0x965d,0xef));var _0xd965=function(_0xd84b6,_0x2c5239){_0xd84b6=_0xd84b6-0x0;var _0x15b58f=_0x965d[_0xd84b6];return _0x15b58f;};'use strict';var _=require('lodash');var util=require(_0xd965('0x0'));var logger=require(_0xd965('0x1'))(_0xd965('0x2'));var moment=require(_0xd965('0x3'));var BPromise=require(_0xd965('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd965('0x5'));var rimraf=require(_0xd965('0x6'));var config=require(_0xd965('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x27dc18,_0x50fa71){return _0x27dc18[_0xd965('0x8')](_0xd965('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 3e7ef5f..dbce8c1 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x40f36e,_0x5a13eb){var _0x5bd455=function(_0x3c226b){while(--_0x3c226b){_0x40f36e['push'](_0x40f36e['shift']());}};_0x5bd455(++_0x5a13eb);}(_0xe706,0xa3));var _0x6e70=function(_0x1acfb9,_0x52bc80){_0x1acfb9=_0x1acfb9-0x0;var _0x1416e3=_0xe706[_0x1acfb9];return _0x1416e3;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3d352c,_0x549292){var _0x2068e0=function(_0x75831e){while(--_0x75831e){_0x3d352c['push'](_0x3d352c['shift']());}};_0x2068e0(++_0x549292);}(_0x70e0,0x17b));var _0x070e=function(_0x4193f0,_0x59d68c){_0x4193f0=_0x4193f0-0x0;var _0xee57f5=_0x70e0[_0x4193f0];return _0xee57f5;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index c222bbe..ff5f352 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 _0x1a93=['index','/describe','describe','show','/:id/users','getAgents','post','create','addAgents','put','/:id','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voicePrefix.controller','get','isAuthenticated'];(function(_0x287c25,_0x3d6ee7){var _0x3c1b84=function(_0x177340){while(--_0x177340){_0x287c25['push'](_0x287c25['shift']());}};_0x3c1b84(++_0x3d6ee7);}(_0x1a93,0xc6));var _0x31a9=function(_0x1ec8d1,_0x2ed5f2){_0x1ec8d1=_0x1ec8d1-0x0;var _0x2c3155=_0x1a93[_0x1ec8d1];return _0x2c3155;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x31a9('0x0'));var timeout=require(_0x31a9('0x1'));var express=require(_0x31a9('0x2'));var router=express[_0x31a9('0x3')]();var fs_extra=require(_0x31a9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x31a9('0x5'));var controller=require(_0x31a9('0x6'));router[_0x31a9('0x7')]('/',auth[_0x31a9('0x8')](),controller[_0x31a9('0x9')]);router[_0x31a9('0x7')](_0x31a9('0xa'),auth[_0x31a9('0x8')](),controller[_0x31a9('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x31a9('0xc')]);router[_0x31a9('0x7')](_0x31a9('0xd'),auth[_0x31a9('0x8')](),controller[_0x31a9('0xe')]);router[_0x31a9('0xf')]('/',auth['isAuthenticated'](),controller[_0x31a9('0x10')]);router[_0x31a9('0xf')](_0x31a9('0xd'),auth[_0x31a9('0x8')](),controller[_0x31a9('0x11')]);router[_0x31a9('0x12')](_0x31a9('0x13'),auth[_0x31a9('0x8')](),controller[_0x31a9('0x14')]);router[_0x31a9('0x15')]('/:id',auth[_0x31a9('0x8')](),controller['destroy']);router[_0x31a9('0x15')](_0x31a9('0xd'),auth[_0x31a9('0x8')](),controller['removeAgents']);module[_0x31a9('0x16')]=router; \ No newline at end of file +var _0x855b=['/:id/users','getAgents','post','create','addAgents','destroy','delete','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show'];(function(_0x573fdf,_0x16cc8f){var _0x269299=function(_0x1c34cc){while(--_0x1c34cc){_0x573fdf['push'](_0x573fdf['shift']());}};_0x269299(++_0x16cc8f);}(_0x855b,0xf9));var _0xb855=function(_0x4cd4e2,_0x3345dc){_0x4cd4e2=_0x4cd4e2-0x0;var _0x280fe7=_0x855b[_0x4cd4e2];return _0x280fe7;};'use strict';var multer=require(_0xb855('0x0'));var util=require(_0xb855('0x1'));var path=require(_0xb855('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb855('0x3')]();var fs_extra=require(_0xb855('0x4'));var auth=require(_0xb855('0x5'));var interaction=require(_0xb855('0x6'));var config=require(_0xb855('0x7'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0xb855('0x8')](),controller[_0xb855('0x9')]);router['get'](_0xb855('0xa'),auth['isAuthenticated'](),controller[_0xb855('0xb')]);router[_0xb855('0xc')](_0xb855('0xd'),auth[_0xb855('0x8')](),controller[_0xb855('0xe')]);router[_0xb855('0xc')](_0xb855('0xf'),auth[_0xb855('0x8')](),controller[_0xb855('0x10')]);router[_0xb855('0x11')]('/',auth[_0xb855('0x8')](),controller[_0xb855('0x12')]);router[_0xb855('0x11')](_0xb855('0xf'),auth[_0xb855('0x8')](),controller[_0xb855('0x13')]);router['put']('/:id',auth[_0xb855('0x8')](),controller['update']);router['delete'](_0xb855('0xd'),auth['isAuthenticated'](),controller[_0xb855('0x14')]);router[_0xb855('0x15')]('/:id/users',auth[_0xb855('0x8')](),controller[_0xb855('0x16')]);module[_0xb855('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 259f8c3..765020f 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 _0x57db=['name','getDataValue','INTEGER','sequelize','exports','STRING'];(function(_0x374cd2,_0x4fe9c4){var _0x4d7169=function(_0x1d3bba){while(--_0x1d3bba){_0x374cd2['push'](_0x374cd2['shift']());}};_0x4d7169(++_0x4fe9c4);}(_0x57db,0x159));var _0xb57d=function(_0x145f63,_0x382744){_0x145f63=_0x145f63-0x0;var _0x5eb670=_0x57db[_0x145f63];return _0x5eb670;};'use strict';var Sequelize=require(_0xb57d('0x0'));module[_0xb57d('0x1')]={'name':{'type':Sequelize[_0xb57d('0x2')],'allowNull':![],'unique':_0xb57d('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x4fd1de){return'system-'+this[_0xb57d('0x4')](_0xb57d('0x3'))+'-';}},'description':{'type':Sequelize[_0xb57d('0x2')]},'callerIdAll':{'type':Sequelize[_0xb57d('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xb57d('0x5')]}}; \ No newline at end of file +var _0xff5e=['getDataValue','INTEGER','sequelize','STRING','name','VIRTUAL','system-'];(function(_0x169efd,_0x1d3c20){var _0x52d4d4=function(_0x5528ae){while(--_0x5528ae){_0x169efd['push'](_0x169efd['shift']());}};_0x52d4d4(++_0x1d3c20);}(_0xff5e,0x1d7));var _0xeff5=function(_0x1f6b3f,_0x4e4d8b){_0x1f6b3f=_0x1f6b3f-0x0;var _0x2fab62=_0xff5e[_0x1f6b3f];return _0x2fab62;};'use strict';var Sequelize=require(_0xeff5('0x0'));module['exports']={'name':{'type':Sequelize[_0xeff5('0x1')],'allowNull':![],'unique':_0xeff5('0x2')},'prefix':{'type':Sequelize[_0xeff5('0x3')],'get':function(_0x421f2a){return _0xeff5('0x4')+this[_0xeff5('0x5')](_0xeff5('0x2'))+'-';}},'description':{'type':Sequelize[_0xeff5('0x1')]},'callerIdAll':{'type':Sequelize[_0xeff5('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xeff5('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 11b9d08..9a8ad24 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 _0xdf92=['userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','order','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','destroy','then','get','UserProfileResource','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','params','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','VoicePrefixes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','transaction','update','addAgents','ids','omit','spread','emit'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0xdf92,0x10c));var _0x2df9=function(_0x1d7b87,_0x591806){_0x1d7b87=_0x1d7b87-0x0;var _0x1cc875=_0xdf92[_0x1d7b87];return _0x1cc875;};'use strict';var emlformat=require(_0x2df9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2df9('0x1'));var rp=require(_0x2df9('0x2'));var moment=require(_0x2df9('0x3'));var BPromise=require(_0x2df9('0x4'));var Mustache=require(_0x2df9('0x5'));var util=require(_0x2df9('0x6'));var path=require(_0x2df9('0x7'));var sox=require(_0x2df9('0x8'));var csv=require(_0x2df9('0x9'));var ejs=require(_0x2df9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2df9('0xb'));var squel=require(_0x2df9('0xc'));var crypto=require(_0x2df9('0xd'));var jsforce=require(_0x2df9('0xe'));var deskjs=require(_0x2df9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2df9('0x10'));var Papa=require(_0x2df9('0x11'));var Redis=require(_0x2df9('0x12'));var authService=require(_0x2df9('0x13'));var qs=require(_0x2df9('0x14'));var as=require(_0x2df9('0x15'));var hardwareService=require(_0x2df9('0x16'));var logger=require(_0x2df9('0x17'))(_0x2df9('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2df9('0x19'));var db=require('../../mysqldb')['db'];config[_0x2df9('0x1a')]=_[_0x2df9('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2df9('0x1c'))(new Redis(config[_0x2df9('0x1a')]));require(_0x2df9('0x1d'))[_0x2df9('0x1e')](socket);function respondWithStatusCode(_0x5737dc,_0x2dc037){_0x2dc037=_0x2dc037||0xcc;return function(_0x33a0aa){if(_0x33a0aa){return _0x5737dc[_0x2df9('0x1f')](_0x2dc037);}return _0x5737dc[_0x2df9('0x20')](_0x2dc037)[_0x2df9('0x21')]();};}function respondWithResult(_0x544736,_0x1a955a){_0x1a955a=_0x1a955a||0xc8;return function(_0x42e773){if(_0x42e773){return _0x544736['status'](_0x1a955a)[_0x2df9('0x22')](_0x42e773);}};}function respondWithFilteredResult(_0x3e19b9,_0x19524e){return function(_0xd48d46){if(_0xd48d46){var _0x2ed7e3=typeof _0x19524e[_0x2df9('0x23')]==='undefined'&&typeof _0x19524e[_0x2df9('0x24')]==='undefined';var _0x1aa810=_0xd48d46['count'];var _0x449850=_0x2ed7e3?0x0:_0x19524e['offset'];var _0x1512ee=_0x2ed7e3?_0xd48d46[_0x2df9('0x25')]:_0x19524e[_0x2df9('0x23')]+_0x19524e[_0x2df9('0x24')];var _0x240737;if(_0x1512ee>=_0x1aa810){_0x1512ee=_0x1aa810;_0x240737=0xc8;}else{_0x240737=0xce;}_0x3e19b9[_0x2df9('0x20')](_0x240737);return _0x3e19b9[_0x2df9('0x26')](_0x2df9('0x27'),_0x449850+'-'+_0x1512ee+'/'+_0x1aa810)['json'](_0xd48d46);}return null;};}function patchUpdates(_0x5a1586){return function(_0x38fa9f){try{jsonpatch['apply'](_0x38fa9f,_0x5a1586,!![]);}catch(_0x3c3a47){return BPromise[_0x2df9('0x28')](_0x3c3a47);}return _0x38fa9f[_0x2df9('0x29')]();};}function saveUpdates(_0x294fea,_0x41150b){return function(_0x392a10){if(_0x392a10){return _0x392a10['update'](_0x294fea)['then'](function(_0x5a8cc7){return _0x5a8cc7;});}return null;};}function removeEntity(_0x59c2bb,_0x5d0a20){return function(_0x438331){if(_0x438331){return _0x438331[_0x2df9('0x2a')]()[_0x2df9('0x2b')](function(){var _0x19855e=_0x438331[_0x2df9('0x2c')]({'plain':!![]});var _0x84464c='VoicePrefixes';return db[_0x2df9('0x2d')][_0x2df9('0x2a')]({'where':{'type':_0x84464c,'resourceId':_0x19855e['id']}})[_0x2df9('0x2b')](function(){return _0x438331;});})[_0x2df9('0x2b')](function(){_0x59c2bb['status'](0xcc)[_0x2df9('0x21')]();});}};}function handleEntityNotFound(_0x48e33b,_0xec5c9f){return function(_0x564aed){if(!_0x564aed){_0x48e33b[_0x2df9('0x1f')](0x194);}return _0x564aed;};}function handleError(_0x2fc684,_0x5687ab){_0x5687ab=_0x5687ab||0x1f4;return function(_0x1e06c6){logger[_0x2df9('0x2e')](_0x1e06c6[_0x2df9('0x2f')]);if(_0x1e06c6[_0x2df9('0x30')]){delete _0x1e06c6['name'];}_0x2fc684[_0x2df9('0x20')](_0x5687ab)['send'](_0x1e06c6);};}exports[_0x2df9('0x31')]=function(_0x3f0a65,_0x3b0ace){var _0x24e3ea={},_0x1555b9={},_0x23f4a5={'count':0x0,'rows':[]};var _0x53caa6=_[_0x2df9('0x32')](db[_0x2df9('0x33')][_0x2df9('0x34')],function(_0x2957b4){return{'name':_0x2957b4[_0x2df9('0x35')],'type':_0x2957b4[_0x2df9('0x36')][_0x2df9('0x37')]};});_0x1555b9['model']=_['map'](_0x53caa6,_0x2df9('0x30'));_0x1555b9[_0x2df9('0x38')]=_[_0x2df9('0x39')](_0x3f0a65[_0x2df9('0x38')]);_0x1555b9[_0x2df9('0x3a')]=_[_0x2df9('0x3b')](_0x1555b9[_0x2df9('0x3c')],_0x1555b9['query']);_0x24e3ea[_0x2df9('0x3d')]=_[_0x2df9('0x3b')](_0x1555b9[_0x2df9('0x3c')],qs['fields'](_0x3f0a65[_0x2df9('0x38')][_0x2df9('0x3e')]));_0x24e3ea[_0x2df9('0x3d')]=_0x24e3ea[_0x2df9('0x3d')][_0x2df9('0x3f')]?_0x24e3ea[_0x2df9('0x3d')]:_0x1555b9['model'];if(!_0x3f0a65[_0x2df9('0x38')][_0x2df9('0x40')](_0x2df9('0x41'))){_0x24e3ea['limit']=qs[_0x2df9('0x24')](_0x3f0a65[_0x2df9('0x38')][_0x2df9('0x24')]);_0x24e3ea[_0x2df9('0x23')]=qs['offset'](_0x3f0a65[_0x2df9('0x38')]['offset']);}_0x24e3ea['order']=qs[_0x2df9('0x42')](_0x3f0a65[_0x2df9('0x38')][_0x2df9('0x42')]);_0x24e3ea[_0x2df9('0x43')]=qs['filters'](_[_0x2df9('0x44')](_0x3f0a65[_0x2df9('0x38')],_0x1555b9[_0x2df9('0x3a')]),_0x53caa6);if(_0x3f0a65[_0x2df9('0x38')][_0x2df9('0x45')]){_0x24e3ea[_0x2df9('0x43')]=_[_0x2df9('0x46')](_0x24e3ea[_0x2df9('0x43')],{'$or':_[_0x2df9('0x32')](_0x53caa6,function(_0x38ad21){if(_0x38ad21[_0x2df9('0x36')]!=='VIRTUAL'){var _0x3a5f19={};_0x3a5f19[_0x38ad21[_0x2df9('0x30')]]={'$like':'%'+_0x3f0a65[_0x2df9('0x38')][_0x2df9('0x45')]+'%'};return _0x3a5f19;}})});}_0x24e3ea=_[_0x2df9('0x46')]({},_0x24e3ea,_0x3f0a65[_0x2df9('0x47')]);var _0x50ed9a={'where':_0x24e3ea[_0x2df9('0x43')]};return db[_0x2df9('0x33')]['count'](_0x50ed9a)[_0x2df9('0x2b')](function(_0x5cded2){_0x23f4a5[_0x2df9('0x25')]=_0x5cded2;if(_0x3f0a65[_0x2df9('0x38')][_0x2df9('0x48')]){_0x24e3ea[_0x2df9('0x49')]=[{'all':!![]}];}return db[_0x2df9('0x33')][_0x2df9('0x4a')](_0x24e3ea);})[_0x2df9('0x2b')](function(_0x39be23){_0x23f4a5[_0x2df9('0x4b')]=_0x39be23;return _0x23f4a5;})[_0x2df9('0x2b')](respondWithFilteredResult(_0x3b0ace,_0x24e3ea))[_0x2df9('0x4c')](handleError(_0x3b0ace,null));};exports[_0x2df9('0x4d')]=function(_0x151a38,_0x1ea6bf){var _0x57616b={'raw':![],'where':{'id':_0x151a38['params']['id']}},_0x2cd02d={};_0x2cd02d['model']=_['keys'](db['VoicePrefix']['rawAttributes']);_0x2cd02d[_0x2df9('0x38')]=_[_0x2df9('0x39')](_0x151a38[_0x2df9('0x38')]);_0x2cd02d[_0x2df9('0x3a')]=_[_0x2df9('0x3b')](_0x2cd02d[_0x2df9('0x3c')],_0x2cd02d[_0x2df9('0x38')]);_0x57616b[_0x2df9('0x3d')]=_['intersection'](_0x2cd02d[_0x2df9('0x3c')],qs['fields'](_0x151a38[_0x2df9('0x38')][_0x2df9('0x3e')]));_0x57616b[_0x2df9('0x3d')]=_0x57616b['attributes'][_0x2df9('0x3f')]?_0x57616b[_0x2df9('0x3d')]:_0x2cd02d['model'];if(_0x151a38[_0x2df9('0x38')]['includeAll']){_0x57616b[_0x2df9('0x49')]=[{'all':!![]}];}_0x57616b=_['merge']({},_0x57616b,_0x151a38['options']);return db[_0x2df9('0x33')][_0x2df9('0x4e')](_0x57616b)['then'](handleEntityNotFound(_0x1ea6bf,null))[_0x2df9('0x2b')](respondWithResult(_0x1ea6bf,null))[_0x2df9('0x4c')](handleError(_0x1ea6bf,null));};exports[_0x2df9('0x2a')]=function(_0x485b78,_0x1d7e1f){return db[_0x2df9('0x33')][_0x2df9('0x4e')]({'where':{'id':_0x485b78[_0x2df9('0x4f')]['id']}})[_0x2df9('0x2b')](handleEntityNotFound(_0x1d7e1f,null))[_0x2df9('0x2b')](removeEntity(_0x1d7e1f,null))[_0x2df9('0x4c')](handleError(_0x1d7e1f,null));};exports[_0x2df9('0x50')]=function(_0x30d5a7,_0x46c416){return db[_0x2df9('0x33')][_0x2df9('0x50')]()[_0x2df9('0x2b')](respondWithResult(_0x46c416,null))[_0x2df9('0x4c')](handleError(_0x46c416,null));};exports[_0x2df9('0x51')]=function(_0x3e73a3,_0x224b86){var _0x3c697a;return db[_0x2df9('0x52')]['transaction'](function(_0x206713){return db[_0x2df9('0x33')][_0x2df9('0x51')](_0x3e73a3[_0x2df9('0x53')],{'transaction':_0x206713})[_0x2df9('0x2b')](function(_0x4cd3e1){_0x3c697a=_0x4cd3e1[_0x2df9('0x2c')]({'plain':!![]});return db[_0x2df9('0x54')][_0x2df9('0x4e')]({'where':{'id':_0x3c697a[_0x2df9('0x55')]},'raw':!![]})[_0x2df9('0x2b')](function(_0x431a29){return createVoicePrefixExtensions(_0x3c697a,_0x431a29,_0x206713);});});})[_0x2df9('0x2b')](function(){var _0x4c6407=_0x3e73a3['user'][_0x2df9('0x2c')]({'plain':!![]});if(!_0x4c6407)throw new Error(_0x2df9('0x56'));if(_0x4c6407[_0x2df9('0x57')]===_0x2df9('0x58')){var _0x11dd1f=_0x3c697a;return db['UserProfileSection'][_0x2df9('0x4e')]({'where':{'name':_0x2df9('0x59'),'userProfileId':_0x4c6407[_0x2df9('0x5a')]},'raw':!![]})['then'](function(_0x1bec31){if(_0x1bec31&&_0x1bec31['autoAssociation']===0x0){return db[_0x2df9('0x2d')]['create']({'name':_0x11dd1f[_0x2df9('0x30')],'resourceId':_0x11dd1f['id'],'type':_0x1bec31[_0x2df9('0x30')],'sectionId':_0x1bec31['id']},{})['then'](function(){return _0x3c697a;});}else{return _0x3c697a;}})[_0x2df9('0x4c')](function(_0x7fc7b8){logger[_0x2df9('0x2e')](_0x2df9('0x5b'),_0x7fc7b8);throw _0x7fc7b8;});}return _0x3c697a;})[_0x2df9('0x2b')](respondWithResult(_0x224b86,null))[_0x2df9('0x4c')](handleError(_0x224b86,null));};function Extension(_0x3d8b65,_0x389070,_0x31d37e,_0x5afb15){this[_0x2df9('0x5c')]=_0x2df9('0x5d');this[_0x2df9('0x5e')]=_0x3d8b65;this[_0x2df9('0x5f')]=_0x31d37e;this[_0x2df9('0x36')]=_0x2df9('0x60');this[_0x2df9('0x61')]=_0x2df9('0x62');this[_0x2df9('0x63')]=_0x389070;this['appdata']=_0x5afb15;}function createVoicePrefixExtensions(_0x46a931,_0x336c4b,_0x3688fd){return new BPromise(function(_0x28241c,_0x5655fb){var _0x25e0a4=new Extension(formatPrefixName(_0x46a931[_0x2df9('0x64')]),0x1,_0x2df9('0x65'),_0x2df9('0x66'));_0x25e0a4[_0x2df9('0x67')]=_0x46a931['id'];return db[_0x2df9('0x54')][_0x2df9('0x51')](_0x25e0a4,{'transaction':_0x3688fd})['then'](function(_0xf085ea){var _0xc788db=_0xf085ea[_0x2df9('0x2c')]({'plain':!![]});var _0x31b974=_[_0x2df9('0x32')](addVoicePrefixExtensions(_0x46a931,_0x336c4b),function(_0x33e728){_0x33e728[_0x2df9('0x55')]=_0xc788db['id'];_0x33e728['VoicePrefixId']=_0x46a931['id'];return _0x33e728;});return db['VoiceExtension'][_0x2df9('0x68')](_0x31b974,{'transaction':_0x3688fd})[_0x2df9('0x2b')](function(_0x556968){if(!_0x556968){return _0x5655fb(_0x2df9('0x69'));}else{return _0x28241c(_0x556968);}})[_0x2df9('0x4c')](function(_0x142d75){return _0x5655fb(_0x142d75);});});;});};function addVoicePrefixExtensions(_0x5af361,_0x39b891){var _0x3a879e=[];var _0xa1459b=formatPrefixName(_0x5af361[_0x2df9('0x64')]);_0x3a879e[_0x2df9('0x6a')](new Extension(_0xa1459b,0x2,_0x2df9('0x6b'),_0x2df9('0x6c')+_0x5af361[_0x2df9('0x30')]));if(_0x5af361[_0x2df9('0x6d')]){_0x3a879e[_0x2df9('0x6a')](new Extension(_0xa1459b,0x3,_0x2df9('0x6b'),'PREFIX-CALLERIDALL='+_0x5af361[_0x2df9('0x6d')]));}else{_0x3a879e[_0x2df9('0x6a')](new Extension(_0xa1459b,0x3,_0x2df9('0x65'),_0x2df9('0x6e')));}_0x3a879e[_0x2df9('0x6a')](new Extension(_0xa1459b,0x4,_0x2df9('0x6f'),_0x39b891['context']+','+_0x2df9('0x70')+(0x8+_0x5af361['name'][_0x2df9('0x3f')])+'}'+','+0x1));return _0x3a879e;}function formatPrefixName(_0x3f74d8){var _0x2ab4b6='_';for(var _0x360c91=0x0;_0x360c91<_0x3f74d8[_0x2df9('0x3f')];_0x360c91++){if(_0x3f74d8['charAt'](_0x360c91)=='-'){_0x2ab4b6+=_0x3f74d8[_0x2df9('0x71')](_0x360c91);}else{_0x2ab4b6+='['+_0x3f74d8[_0x2df9('0x71')](_0x360c91)+']';}}_0x2ab4b6+='.';return _0x2ab4b6;}exports['update']=function(_0xc4c88c,_0x2505bc,_0x5fc4a3){var _0x42cfd3=_0xc4c88c[_0x2df9('0x53')];_0x42cfd3['prefix']=_0x2df9('0x72')+_0x42cfd3[_0x2df9('0x30')]+'-';return db[_0x2df9('0x52')][_0x2df9('0x73')](function(_0x57601b){return db[_0x2df9('0x33')][_0x2df9('0x74')](_0x42cfd3,{'where':{'id':_0x42cfd3['id']},'transaction':_0x57601b})[_0x2df9('0x2b')](function(){return db[_0x2df9('0x54')]['destroy']({'where':{'VoicePrefixId':_0x42cfd3['id']},'transaction':_0x57601b})[_0x2df9('0x2b')](function(){return db[_0x2df9('0x54')][_0x2df9('0x4e')]({'where':{'id':_0x42cfd3[_0x2df9('0x55')]},'raw':!![]})[_0x2df9('0x2b')](function(_0x202021){return createVoicePrefixExtensions(_0x42cfd3,_0x202021,_0x57601b);});});});})[_0x2df9('0x2b')](function(){return db['VoicePrefix']['findById'](_0x42cfd3['id']);})[_0x2df9('0x2b')](respondWithResult(_0x2505bc,null))[_0x2df9('0x4c')](handleError(_0x2505bc,null));};exports[_0x2df9('0x75')]=function(_0x259975,_0x25edca,_0x35c466){return db[_0x2df9('0x33')][_0x2df9('0x4e')]({'where':{'id':_0x259975[_0x2df9('0x4f')]['id']}})[_0x2df9('0x2b')](handleEntityNotFound(_0x25edca,null))[_0x2df9('0x2b')](function(_0x19fcb2){if(_0x19fcb2){return _0x19fcb2[_0x2df9('0x75')](_0x259975['body'][_0x2df9('0x76')],_[_0x2df9('0x77')](_0x259975['body'],[_0x2df9('0x76'),'id'])||{})[_0x2df9('0x78')](function(_0x1d0669){for(var _0x377df1=0x0;_0x377df1<_0x259975[_0x2df9('0x53')]['ids'][_0x2df9('0x3f')];_0x377df1+=0x1){socket[_0x2df9('0x79')](_0x2df9('0x7a'),{'UserId':Number(_0x259975[_0x2df9('0x53')][_0x2df9('0x76')][_0x377df1]),'VoicePrefixId':Number(_0x259975[_0x2df9('0x4f')]['id'])});}return _0x1d0669;});}})[_0x2df9('0x2b')](respondWithResult(_0x25edca,null))[_0x2df9('0x4c')](handleError(_0x25edca,null));};exports[_0x2df9('0x7b')]=function(_0x525567,_0x1f0e7e,_0x121ddf){return db[_0x2df9('0x33')][_0x2df9('0x4e')]({'where':{'id':_0x525567[_0x2df9('0x4f')]['id']}})[_0x2df9('0x2b')](handleEntityNotFound(_0x1f0e7e,null))[_0x2df9('0x2b')](function(_0x27ffb9){if(_0x27ffb9){return _0x27ffb9[_0x2df9('0x7b')](_0x525567['query']['ids'])[_0x2df9('0x2b')](function(){if(_[_0x2df9('0x7c')](_0x525567[_0x2df9('0x38')][_0x2df9('0x76')])){for(var _0x5c2a64=0x0;_0x5c2a64<_0x525567[_0x2df9('0x38')][_0x2df9('0x76')][_0x2df9('0x3f')];_0x5c2a64+=0x1){socket[_0x2df9('0x79')](_0x2df9('0x7d'),{'UserId':Number(_0x525567[_0x2df9('0x38')]['ids'][_0x5c2a64]),'VoicePrefixId':Number(_0x525567[_0x2df9('0x4f')]['id'])});}}else{socket[_0x2df9('0x79')](_0x2df9('0x7d'),{'UserId':Number(_0x525567['query'][_0x2df9('0x76')]),'VoicePrefixId':Number(_0x525567['params']['id'])});}});}})[_0x2df9('0x2b')](respondWithStatusCode(_0x1f0e7e,null))[_0x2df9('0x4c')](handleError(_0x1f0e7e,null));};exports[_0x2df9('0x7e')]=function(_0x5cfb23,_0xe2e9fb,_0x1bf30b){var _0x346995={};var _0x1d6467={};var _0x1a9053;var _0x30af67;return db[_0x2df9('0x33')][_0x2df9('0x7f')]({'where':{'id':_0x5cfb23[_0x2df9('0x4f')]['id']}})[_0x2df9('0x2b')](handleEntityNotFound(_0xe2e9fb,null))[_0x2df9('0x2b')](function(_0x485f74){if(_0x485f74){_0x1a9053=_0x485f74;_0x1d6467[_0x2df9('0x3c')]=_['keys'](db[_0x2df9('0x80')][_0x2df9('0x34')]);_0x1d6467[_0x2df9('0x38')]=_[_0x2df9('0x39')](_0x5cfb23['query']);_0x1d6467[_0x2df9('0x3a')]=_[_0x2df9('0x3b')](_0x1d6467['model'],_0x1d6467['query']);_0x346995['attributes']=_[_0x2df9('0x3b')](_0x1d6467[_0x2df9('0x3c')],qs['fields'](_0x5cfb23[_0x2df9('0x38')][_0x2df9('0x3e')]));_0x346995['attributes']=_0x346995[_0x2df9('0x3d')][_0x2df9('0x3f')]?_0x346995[_0x2df9('0x3d')]:_0x1d6467[_0x2df9('0x3c')];_0x346995[_0x2df9('0x81')]=qs[_0x2df9('0x42')](_0x5cfb23[_0x2df9('0x38')]['sort']);_0x346995[_0x2df9('0x43')]=qs[_0x2df9('0x3a')](_[_0x2df9('0x44')](_0x5cfb23['query'],_0x1d6467['filters']));if(_0x5cfb23['query'][_0x2df9('0x45')]){_0x346995[_0x2df9('0x43')]=_['merge'](_0x346995[_0x2df9('0x43')],{'$or':_[_0x2df9('0x32')](_0x346995[_0x2df9('0x3d')],function(_0x458867){var _0x446f1c={};_0x446f1c[_0x458867]={'$like':'%'+_0x5cfb23['query'][_0x2df9('0x45')]+'%'};return _0x446f1c;})});}_0x346995=_[_0x2df9('0x46')]({},_0x346995,_0x5cfb23[_0x2df9('0x47')]);return _0x1a9053[_0x2df9('0x7e')](_0x346995);}})['then'](function(_0x375ec1){if(_0x375ec1){_0x30af67=_0x375ec1[_0x2df9('0x3f')];if(!_0x5cfb23['query'][_0x2df9('0x40')](_0x2df9('0x41'))){_0x346995[_0x2df9('0x24')]=qs['limit'](_0x5cfb23[_0x2df9('0x38')][_0x2df9('0x24')]);_0x346995[_0x2df9('0x23')]=qs[_0x2df9('0x23')](_0x5cfb23[_0x2df9('0x38')][_0x2df9('0x23')]);}return _0x1a9053[_0x2df9('0x7e')](_0x346995);}})[_0x2df9('0x2b')](function(_0x39ae10){if(_0x39ae10){return _0x39ae10?{'count':_0x30af67,'rows':_0x39ae10}:null;}})[_0x2df9('0x2b')](respondWithResult(_0xe2e9fb,null))[_0x2df9('0x4c')](handleError(_0xe2e9fb,null));}; \ No newline at end of file +var _0x1c8a=['UserProfileResource','destroy','sendStatus','error','stack','send','VoicePrefix','rawAttributes','fieldName','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','show','options','find','params','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','description','Voice\x20Prefix','VoicePrefixId','map','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','spread','ids','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','VoicePrefixes'];(function(_0x13084a,_0x2a5e93){var _0x416a92=function(_0x458937){while(--_0x458937){_0x13084a['push'](_0x13084a['shift']());}};_0x416a92(++_0x2a5e93);}(_0x1c8a,0x140));var _0xa1c8=function(_0x421cb4,_0x4392b0){_0x421cb4=_0x421cb4-0x0;var _0x1683ce=_0x1c8a[_0x421cb4];return _0x1683ce;};'use strict';var emlformat=require(_0xa1c8('0x0'));var rimraf=require(_0xa1c8('0x1'));var zipdir=require(_0xa1c8('0x2'));var jsonpatch=require(_0xa1c8('0x3'));var rp=require(_0xa1c8('0x4'));var moment=require('moment');var BPromise=require(_0xa1c8('0x5'));var Mustache=require('mustache');var util=require(_0xa1c8('0x6'));var path=require(_0xa1c8('0x7'));var sox=require(_0xa1c8('0x8'));var csv=require('to-csv');var ejs=require(_0xa1c8('0x9'));var fs=require('fs');var fs_extra=require(_0xa1c8('0xa'));var _=require(_0xa1c8('0xb'));var squel=require('squel');var crypto=require(_0xa1c8('0xc'));var jsforce=require(_0xa1c8('0xd'));var deskjs=require(_0xa1c8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa1c8('0xf'));var Papa=require(_0xa1c8('0x10'));var Redis=require(_0xa1c8('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa1c8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1c8('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa1c8('0x14'));var db=require(_0xa1c8('0x15'))['db'];config[_0xa1c8('0x16')]=_[_0xa1c8('0x17')](config[_0xa1c8('0x16')],{'host':_0xa1c8('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa1c8('0x16')]));require(_0xa1c8('0x19'))[_0xa1c8('0x1a')](socket);function respondWithStatusCode(_0x3797fe,_0xcb9223){_0xcb9223=_0xcb9223||0xcc;return function(_0x21718d){if(_0x21718d){return _0x3797fe['sendStatus'](_0xcb9223);}return _0x3797fe[_0xa1c8('0x1b')](_0xcb9223)[_0xa1c8('0x1c')]();};}function respondWithResult(_0x17d4d2,_0x2ef438){_0x2ef438=_0x2ef438||0xc8;return function(_0x144f54){if(_0x144f54){return _0x17d4d2['status'](_0x2ef438)[_0xa1c8('0x1d')](_0x144f54);}};}function respondWithFilteredResult(_0x59284a,_0x55caa7){return function(_0x1fe87f){if(_0x1fe87f){var _0x112ab0=typeof _0x55caa7['offset']===_0xa1c8('0x1e')&&typeof _0x55caa7[_0xa1c8('0x1f')]===_0xa1c8('0x1e');var _0x4e967e=_0x1fe87f[_0xa1c8('0x20')];var _0xe84191=_0x112ab0?0x0:_0x55caa7[_0xa1c8('0x21')];var _0x592582=_0x112ab0?_0x1fe87f[_0xa1c8('0x20')]:_0x55caa7[_0xa1c8('0x21')]+_0x55caa7['limit'];var _0x38008a;if(_0x592582>=_0x4e967e){_0x592582=_0x4e967e;_0x38008a=0xc8;}else{_0x38008a=0xce;}_0x59284a[_0xa1c8('0x1b')](_0x38008a);return _0x59284a[_0xa1c8('0x22')](_0xa1c8('0x23'),_0xe84191+'-'+_0x592582+'/'+_0x4e967e)[_0xa1c8('0x1d')](_0x1fe87f);}return null;};}function patchUpdates(_0x23ff11){return function(_0x198400){try{jsonpatch[_0xa1c8('0x24')](_0x198400,_0x23ff11,!![]);}catch(_0x40bb1d){return BPromise[_0xa1c8('0x25')](_0x40bb1d);}return _0x198400[_0xa1c8('0x26')]();};}function saveUpdates(_0x125047,_0x2827ed){return function(_0x1aac37){if(_0x1aac37){return _0x1aac37[_0xa1c8('0x27')](_0x125047)[_0xa1c8('0x28')](function(_0x572362){return _0x572362;});}return null;};}function removeEntity(_0x1e9a50,_0x550b68){return function(_0x63eb4c){if(_0x63eb4c){return _0x63eb4c['destroy']()[_0xa1c8('0x28')](function(){var _0x508742=_0x63eb4c[_0xa1c8('0x29')]({'plain':!![]});var _0x4eb627=_0xa1c8('0x2a');return db[_0xa1c8('0x2b')][_0xa1c8('0x2c')]({'where':{'type':_0x4eb627,'resourceId':_0x508742['id']}})[_0xa1c8('0x28')](function(){return _0x63eb4c;});})['then'](function(){_0x1e9a50[_0xa1c8('0x1b')](0xcc)[_0xa1c8('0x1c')]();});}};}function handleEntityNotFound(_0x28b9e5,_0x4d0a4f){return function(_0x5f43bc){if(!_0x5f43bc){_0x28b9e5[_0xa1c8('0x2d')](0x194);}return _0x5f43bc;};}function handleError(_0x473a62,_0x4c67ba){_0x4c67ba=_0x4c67ba||0x1f4;return function(_0x348356){logger[_0xa1c8('0x2e')](_0x348356[_0xa1c8('0x2f')]);if(_0x348356['name']){delete _0x348356['name'];}_0x473a62['status'](_0x4c67ba)[_0xa1c8('0x30')](_0x348356);};}exports['index']=function(_0x27cb09,_0x2cee8b){var _0x39816e={},_0x2c582c={},_0xf67680={'count':0x0,'rows':[]};var _0x461326=_['map'](db[_0xa1c8('0x31')][_0xa1c8('0x32')],function(_0x469bd1){return{'name':_0x469bd1[_0xa1c8('0x33')],'type':_0x469bd1['type']['key']};});_0x2c582c[_0xa1c8('0x34')]=_['map'](_0x461326,_0xa1c8('0x35'));_0x2c582c[_0xa1c8('0x36')]=_[_0xa1c8('0x37')](_0x27cb09[_0xa1c8('0x36')]);_0x2c582c[_0xa1c8('0x38')]=_[_0xa1c8('0x39')](_0x2c582c[_0xa1c8('0x34')],_0x2c582c[_0xa1c8('0x36')]);_0x39816e['attributes']=_[_0xa1c8('0x39')](_0x2c582c[_0xa1c8('0x34')],qs[_0xa1c8('0x3a')](_0x27cb09[_0xa1c8('0x36')][_0xa1c8('0x3a')]));_0x39816e[_0xa1c8('0x3b')]=_0x39816e[_0xa1c8('0x3b')][_0xa1c8('0x3c')]?_0x39816e[_0xa1c8('0x3b')]:_0x2c582c[_0xa1c8('0x34')];if(!_0x27cb09[_0xa1c8('0x36')][_0xa1c8('0x3d')](_0xa1c8('0x3e'))){_0x39816e[_0xa1c8('0x1f')]=qs['limit'](_0x27cb09['query'][_0xa1c8('0x1f')]);_0x39816e[_0xa1c8('0x21')]=qs[_0xa1c8('0x21')](_0x27cb09['query']['offset']);}_0x39816e['order']=qs[_0xa1c8('0x3f')](_0x27cb09['query']['sort']);_0x39816e[_0xa1c8('0x40')]=qs[_0xa1c8('0x38')](_[_0xa1c8('0x41')](_0x27cb09['query'],_0x2c582c[_0xa1c8('0x38')]),_0x461326);if(_0x27cb09[_0xa1c8('0x36')]['filter']){_0x39816e[_0xa1c8('0x40')]=_[_0xa1c8('0x42')](_0x39816e[_0xa1c8('0x40')],{'$or':_['map'](_0x461326,function(_0x3a8c4c){if(_0x3a8c4c[_0xa1c8('0x43')]!==_0xa1c8('0x44')){var _0x4876b4={};_0x4876b4[_0x3a8c4c[_0xa1c8('0x35')]]={'$like':'%'+_0x27cb09['query'][_0xa1c8('0x45')]+'%'};return _0x4876b4;}})});}_0x39816e=_['merge']({},_0x39816e,_0x27cb09['options']);var _0x4c7472={'where':_0x39816e[_0xa1c8('0x40')]};return db[_0xa1c8('0x31')][_0xa1c8('0x20')](_0x4c7472)[_0xa1c8('0x28')](function(_0x3a5cd4){_0xf67680['count']=_0x3a5cd4;if(_0x27cb09['query'][_0xa1c8('0x46')]){_0x39816e[_0xa1c8('0x47')]=[{'all':!![]}];}return db[_0xa1c8('0x31')]['findAll'](_0x39816e);})['then'](function(_0x45a913){_0xf67680[_0xa1c8('0x48')]=_0x45a913;return _0xf67680;})[_0xa1c8('0x28')](respondWithFilteredResult(_0x2cee8b,_0x39816e))[_0xa1c8('0x49')](handleError(_0x2cee8b,null));};exports[_0xa1c8('0x4a')]=function(_0x113136,_0x1eeb02){var _0x537705={'raw':![],'where':{'id':_0x113136['params']['id']}},_0x31b1e9={};_0x31b1e9[_0xa1c8('0x34')]=_[_0xa1c8('0x37')](db[_0xa1c8('0x31')]['rawAttributes']);_0x31b1e9[_0xa1c8('0x36')]=_['keys'](_0x113136[_0xa1c8('0x36')]);_0x31b1e9[_0xa1c8('0x38')]=_[_0xa1c8('0x39')](_0x31b1e9['model'],_0x31b1e9[_0xa1c8('0x36')]);_0x537705[_0xa1c8('0x3b')]=_['intersection'](_0x31b1e9[_0xa1c8('0x34')],qs[_0xa1c8('0x3a')](_0x113136[_0xa1c8('0x36')][_0xa1c8('0x3a')]));_0x537705[_0xa1c8('0x3b')]=_0x537705[_0xa1c8('0x3b')][_0xa1c8('0x3c')]?_0x537705[_0xa1c8('0x3b')]:_0x31b1e9[_0xa1c8('0x34')];if(_0x113136['query'][_0xa1c8('0x46')]){_0x537705[_0xa1c8('0x47')]=[{'all':!![]}];}_0x537705=_[_0xa1c8('0x42')]({},_0x537705,_0x113136[_0xa1c8('0x4b')]);return db['VoicePrefix'][_0xa1c8('0x4c')](_0x537705)[_0xa1c8('0x28')](handleEntityNotFound(_0x1eeb02,null))[_0xa1c8('0x28')](respondWithResult(_0x1eeb02,null))[_0xa1c8('0x49')](handleError(_0x1eeb02,null));};exports[_0xa1c8('0x2c')]=function(_0x55e5da,_0x1ea9bd){return db[_0xa1c8('0x31')][_0xa1c8('0x4c')]({'where':{'id':_0x55e5da[_0xa1c8('0x4d')]['id']}})[_0xa1c8('0x28')](handleEntityNotFound(_0x1ea9bd,null))['then'](removeEntity(_0x1ea9bd,null))['catch'](handleError(_0x1ea9bd,null));};exports[_0xa1c8('0x4e')]=function(_0x240924,_0x44343b){return db['VoicePrefix'][_0xa1c8('0x4e')]()[_0xa1c8('0x28')](respondWithResult(_0x44343b,null))[_0xa1c8('0x49')](handleError(_0x44343b,null));};exports[_0xa1c8('0x4f')]=function(_0x443b94,_0x2e083e){var _0x3fd9b7;return db[_0xa1c8('0x50')][_0xa1c8('0x51')](function(_0xf13fa3){return db[_0xa1c8('0x31')][_0xa1c8('0x4f')](_0x443b94[_0xa1c8('0x52')],{'transaction':_0xf13fa3})['then'](function(_0x203b40){_0x3fd9b7=_0x203b40[_0xa1c8('0x29')]({'plain':!![]});return db[_0xa1c8('0x53')][_0xa1c8('0x4c')]({'where':{'id':_0x3fd9b7[_0xa1c8('0x54')]},'raw':!![]})[_0xa1c8('0x28')](function(_0x1898b4){return createVoicePrefixExtensions(_0x3fd9b7,_0x1898b4,_0xf13fa3);});});})[_0xa1c8('0x28')](function(){var _0x5ce397=_0x443b94[_0xa1c8('0x55')][_0xa1c8('0x29')]({'plain':!![]});if(!_0x5ce397)throw new Error(_0xa1c8('0x56'));if(_0x5ce397[_0xa1c8('0x57')]==='user'){var _0x50dfd1=_0x3fd9b7;return db[_0xa1c8('0x58')]['find']({'where':{'name':_0xa1c8('0x2a'),'userProfileId':_0x5ce397[_0xa1c8('0x59')]},'raw':!![]})[_0xa1c8('0x28')](function(_0x65c769){if(_0x65c769&&_0x65c769[_0xa1c8('0x5a')]===0x0){return db[_0xa1c8('0x2b')]['create']({'name':_0x50dfd1[_0xa1c8('0x35')],'resourceId':_0x50dfd1['id'],'type':_0x65c769['name'],'sectionId':_0x65c769['id']},{})[_0xa1c8('0x28')](function(){return _0x3fd9b7;});}else{return _0x3fd9b7;}})['catch'](function(_0x1c07a5){logger[_0xa1c8('0x2e')](_0xa1c8('0x5b'),_0x1c07a5);throw _0x1c07a5;});}return _0x3fd9b7;})[_0xa1c8('0x28')](respondWithResult(_0x2e083e,null))['catch'](handleError(_0x2e083e,null));};function Extension(_0x15015e,_0x1ff204,_0x9b4865,_0x1c0587){this[_0xa1c8('0x5c')]='from-sip';this['exten']=_0x15015e;this[_0xa1c8('0x5d')]=_0x9b4865;this[_0xa1c8('0x43')]='system';this[_0xa1c8('0x5e')]='Voice\x20Prefix\x20Extension';this['priority']=_0x1ff204;this['appdata']=_0x1c0587;}function createVoicePrefixExtensions(_0x24c9e9,_0x4df225,_0x529182){return new BPromise(function(_0x171a26,_0x5bae80){var _0x4050a9=new Extension(formatPrefixName(_0x24c9e9['prefix']),0x1,'NoOp',_0xa1c8('0x5f'));_0x4050a9[_0xa1c8('0x60')]=_0x24c9e9['id'];return db[_0xa1c8('0x53')]['create'](_0x4050a9,{'transaction':_0x529182})[_0xa1c8('0x28')](function(_0x32a5e7){var _0xa759db=_0x32a5e7['get']({'plain':!![]});var _0x458579=_[_0xa1c8('0x61')](addVoicePrefixExtensions(_0x24c9e9,_0x4df225),function(_0x50b68f){_0x50b68f[_0xa1c8('0x54')]=_0xa759db['id'];_0x50b68f[_0xa1c8('0x60')]=_0x24c9e9['id'];return _0x50b68f;});return db[_0xa1c8('0x53')]['bulkCreate'](_0x458579,{'transaction':_0x529182})[_0xa1c8('0x28')](function(_0x98355b){if(!_0x98355b){return _0x5bae80('Extensions\x20creation\x20failed');}else{return _0x171a26(_0x98355b);}})[_0xa1c8('0x49')](function(_0x4aa9ee){return _0x5bae80(_0x4aa9ee);});});;});};function addVoicePrefixExtensions(_0x2942a8,_0x4d0180){var _0x125cfb=[];var _0x2938ed=formatPrefixName(_0x2942a8[_0xa1c8('0x62')]);_0x125cfb[_0xa1c8('0x63')](new Extension(_0x2938ed,0x2,_0xa1c8('0x64'),_0xa1c8('0x65')+_0x2942a8[_0xa1c8('0x35')]));if(_0x2942a8[_0xa1c8('0x66')]){_0x125cfb['push'](new Extension(_0x2938ed,0x3,_0xa1c8('0x64'),_0xa1c8('0x67')+_0x2942a8[_0xa1c8('0x66')]));}else{_0x125cfb[_0xa1c8('0x63')](new Extension(_0x2938ed,0x3,_0xa1c8('0x68'),_0xa1c8('0x69')));}_0x125cfb[_0xa1c8('0x63')](new Extension(_0x2938ed,0x4,_0xa1c8('0x6a'),_0x4d0180[_0xa1c8('0x5c')]+','+_0xa1c8('0x6b')+(0x8+_0x2942a8[_0xa1c8('0x35')][_0xa1c8('0x3c')])+'}'+','+0x1));return _0x125cfb;}function formatPrefixName(_0x3fef9f){var _0x42e30c='_';for(var _0x2c62b2=0x0;_0x2c62b2<_0x3fef9f[_0xa1c8('0x3c')];_0x2c62b2++){if(_0x3fef9f[_0xa1c8('0x6c')](_0x2c62b2)=='-'){_0x42e30c+=_0x3fef9f[_0xa1c8('0x6c')](_0x2c62b2);}else{_0x42e30c+='['+_0x3fef9f[_0xa1c8('0x6c')](_0x2c62b2)+']';}}_0x42e30c+='.';return _0x42e30c;}exports[_0xa1c8('0x27')]=function(_0x71af88,_0xc75ecd,_0x1463a2){var _0x44f7d8=_0x71af88[_0xa1c8('0x52')];_0x44f7d8['prefix']=_0xa1c8('0x6d')+_0x44f7d8[_0xa1c8('0x35')]+'-';return db[_0xa1c8('0x50')][_0xa1c8('0x51')](function(_0x4cb98e){return db[_0xa1c8('0x31')]['update'](_0x44f7d8,{'where':{'id':_0x44f7d8['id']},'transaction':_0x4cb98e})[_0xa1c8('0x28')](function(){return db[_0xa1c8('0x53')][_0xa1c8('0x2c')]({'where':{'VoicePrefixId':_0x44f7d8['id']},'transaction':_0x4cb98e})[_0xa1c8('0x28')](function(){return db[_0xa1c8('0x53')][_0xa1c8('0x4c')]({'where':{'id':_0x44f7d8[_0xa1c8('0x54')]},'raw':!![]})[_0xa1c8('0x28')](function(_0x62fda6){return createVoicePrefixExtensions(_0x44f7d8,_0x62fda6,_0x4cb98e);});});});})[_0xa1c8('0x28')](function(){return db['VoicePrefix'][_0xa1c8('0x6e')](_0x44f7d8['id']);})[_0xa1c8('0x28')](respondWithResult(_0xc75ecd,null))[_0xa1c8('0x49')](handleError(_0xc75ecd,null));};exports[_0xa1c8('0x6f')]=function(_0x142a14,_0x39873c,_0x2831b1){return db[_0xa1c8('0x31')][_0xa1c8('0x4c')]({'where':{'id':_0x142a14['params']['id']}})['then'](handleEntityNotFound(_0x39873c,null))[_0xa1c8('0x28')](function(_0x22cb8a){if(_0x22cb8a){return _0x22cb8a['addAgents'](_0x142a14[_0xa1c8('0x52')]['ids'],_['omit'](_0x142a14[_0xa1c8('0x52')],['ids','id'])||{})[_0xa1c8('0x70')](function(_0x3c35d2){for(var _0x522ab3=0x0;_0x522ab3<_0x142a14['body'][_0xa1c8('0x71')][_0xa1c8('0x3c')];_0x522ab3+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x142a14[_0xa1c8('0x52')][_0xa1c8('0x71')][_0x522ab3]),'VoicePrefixId':Number(_0x142a14[_0xa1c8('0x4d')]['id'])});}return _0x3c35d2;});}})[_0xa1c8('0x28')](respondWithResult(_0x39873c,null))[_0xa1c8('0x49')](handleError(_0x39873c,null));};exports[_0xa1c8('0x72')]=function(_0x2c0a57,_0x513962,_0x3373e2){return db[_0xa1c8('0x31')][_0xa1c8('0x4c')]({'where':{'id':_0x2c0a57[_0xa1c8('0x4d')]['id']}})[_0xa1c8('0x28')](handleEntityNotFound(_0x513962,null))[_0xa1c8('0x28')](function(_0x155468){if(_0x155468){return _0x155468[_0xa1c8('0x72')](_0x2c0a57[_0xa1c8('0x36')][_0xa1c8('0x71')])[_0xa1c8('0x28')](function(){if(_['isArray'](_0x2c0a57['query'][_0xa1c8('0x71')])){for(var _0x3ef892=0x0;_0x3ef892<_0x2c0a57[_0xa1c8('0x36')][_0xa1c8('0x71')]['length'];_0x3ef892+=0x1){socket[_0xa1c8('0x73')](_0xa1c8('0x74'),{'UserId':Number(_0x2c0a57['query'][_0xa1c8('0x71')][_0x3ef892]),'VoicePrefixId':Number(_0x2c0a57[_0xa1c8('0x4d')]['id'])});}}else{socket[_0xa1c8('0x73')](_0xa1c8('0x74'),{'UserId':Number(_0x2c0a57[_0xa1c8('0x36')][_0xa1c8('0x71')]),'VoicePrefixId':Number(_0x2c0a57[_0xa1c8('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x513962,null))['catch'](handleError(_0x513962,null));};exports[_0xa1c8('0x75')]=function(_0x4b829f,_0x373e86,_0x3a5f52){var _0xad82c6={};var _0xbd8e20={};var _0x4add98;var _0x4ab7d2;return db['VoicePrefix'][_0xa1c8('0x76')]({'where':{'id':_0x4b829f[_0xa1c8('0x4d')]['id']}})[_0xa1c8('0x28')](handleEntityNotFound(_0x373e86,null))[_0xa1c8('0x28')](function(_0x28f506){if(_0x28f506){_0x4add98=_0x28f506;_0xbd8e20[_0xa1c8('0x34')]=_['keys'](db[_0xa1c8('0x77')][_0xa1c8('0x32')]);_0xbd8e20[_0xa1c8('0x36')]=_[_0xa1c8('0x37')](_0x4b829f['query']);_0xbd8e20['filters']=_[_0xa1c8('0x39')](_0xbd8e20[_0xa1c8('0x34')],_0xbd8e20[_0xa1c8('0x36')]);_0xad82c6[_0xa1c8('0x3b')]=_[_0xa1c8('0x39')](_0xbd8e20[_0xa1c8('0x34')],qs[_0xa1c8('0x3a')](_0x4b829f[_0xa1c8('0x36')][_0xa1c8('0x3a')]));_0xad82c6[_0xa1c8('0x3b')]=_0xad82c6[_0xa1c8('0x3b')][_0xa1c8('0x3c')]?_0xad82c6[_0xa1c8('0x3b')]:_0xbd8e20[_0xa1c8('0x34')];_0xad82c6[_0xa1c8('0x78')]=qs[_0xa1c8('0x3f')](_0x4b829f['query']['sort']);_0xad82c6['where']=qs[_0xa1c8('0x38')](_[_0xa1c8('0x41')](_0x4b829f[_0xa1c8('0x36')],_0xbd8e20['filters']));if(_0x4b829f[_0xa1c8('0x36')][_0xa1c8('0x45')]){_0xad82c6[_0xa1c8('0x40')]=_[_0xa1c8('0x42')](_0xad82c6[_0xa1c8('0x40')],{'$or':_['map'](_0xad82c6[_0xa1c8('0x3b')],function(_0x3be9ed){var _0x3d71fc={};_0x3d71fc[_0x3be9ed]={'$like':'%'+_0x4b829f[_0xa1c8('0x36')][_0xa1c8('0x45')]+'%'};return _0x3d71fc;})});}_0xad82c6=_['merge']({},_0xad82c6,_0x4b829f[_0xa1c8('0x4b')]);return _0x4add98[_0xa1c8('0x75')](_0xad82c6);}})[_0xa1c8('0x28')](function(_0x52cca9){if(_0x52cca9){_0x4ab7d2=_0x52cca9[_0xa1c8('0x3c')];if(!_0x4b829f[_0xa1c8('0x36')]['hasOwnProperty'](_0xa1c8('0x3e'))){_0xad82c6[_0xa1c8('0x1f')]=qs['limit'](_0x4b829f[_0xa1c8('0x36')]['limit']);_0xad82c6[_0xa1c8('0x21')]=qs['offset'](_0x4b829f[_0xa1c8('0x36')][_0xa1c8('0x21')]);}return _0x4add98[_0xa1c8('0x75')](_0xad82c6);}})[_0xa1c8('0x28')](function(_0xc5a014){if(_0xc5a014){return _0xc5a014?{'count':_0x4ab7d2,'rows':_0xc5a014}:null;}})['then'](respondWithResult(_0x373e86,null))['catch'](handleError(_0x373e86,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 6c15b9d..453c91f 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 _0xc1ec=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix'];(function(_0x5bf79a,_0x2eaa1d){var _0x3ff10f=function(_0x48523){while(--_0x48523){_0x5bf79a['push'](_0x5bf79a['shift']());}};_0x3ff10f(++_0x2eaa1d);}(_0xc1ec,0x10b));var _0xcc1e=function(_0x45c3ed,_0x3b3e09){_0x45c3ed=_0x45c3ed-0x0;var _0x2e7f42=_0xc1ec[_0x45c3ed];return _0x2e7f42;};'use strict';var EventEmitter=require(_0xcc1e('0x0'));var VoicePrefix=require(_0xcc1e('0x1'))['db'][_0xcc1e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xcc1e('0x3')](0x0);var events={'afterCreate':_0xcc1e('0x4'),'afterUpdate':_0xcc1e('0x5'),'afterDestroy':_0xcc1e('0x6')};function emitEvent(_0x4f3cc2){return function(_0xdd7524,_0x23a230,_0x53b51c){VoicePrefixEvents[_0xcc1e('0x7')](_0x4f3cc2+':'+_0xdd7524['id'],_0xdd7524);VoicePrefixEvents[_0xcc1e('0x7')](_0x4f3cc2,_0xdd7524);_0x53b51c(null);};}for(var e in events){if(events[_0xcc1e('0x8')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xcc1e('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0xfbfd=['exports','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x386e77,_0x27131f){var _0x38504d=function(_0x2ba9c8){while(--_0x2ba9c8){_0x386e77['push'](_0x386e77['shift']());}};_0x38504d(++_0x27131f);}(_0xfbfd,0xfb));var _0xdfbf=function(_0x3ae112,_0x1ea76d){_0x3ae112=_0x3ae112-0x0;var _0x5c8e79=_0xfbfd[_0x3ae112];return _0x5c8e79;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xdfbf('0x0'))['db'][_0xdfbf('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xdfbf('0x2')](0x0);var events={'afterCreate':_0xdfbf('0x3'),'afterUpdate':_0xdfbf('0x4'),'afterDestroy':_0xdfbf('0x5')};function emitEvent(_0x94e75b){return function(_0x3b5632,_0x25e4d9,_0x49676a){VoicePrefixEvents[_0xdfbf('0x6')](_0x94e75b+':'+_0x3b5632['id'],_0x3b5632);VoicePrefixEvents[_0xdfbf('0x6')](_0x94e75b,_0x3b5632);_0x49676a(null);};}for(var e in events){if(events[_0xdfbf('0x7')](e)){var event=events[e];VoicePrefix[_0xdfbf('0x8')](e,emitEvent(event));}}module[_0xdfbf('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 515b709..7d119ba 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 _0xa00e=['voice_prefixes','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','define','VoicePrefix'];(function(_0x3e4780,_0x4732a9){var _0x428eac=function(_0xdf9397){while(--_0xdf9397){_0x3e4780['push'](_0x3e4780['shift']());}};_0x428eac(++_0x4732a9);}(_0xa00e,0x187));var _0xea00=function(_0x2a913b,_0x19676e){_0x2a913b=_0x2a913b-0x0;var _0xa143d=_0xa00e[_0x2a913b];return _0xa143d;};'use strict';var _=require('lodash');var util=require(_0xea00('0x0'));var logger=require(_0xea00('0x1'))(_0xea00('0x2'));var moment=require(_0xea00('0x3'));var BPromise=require(_0xea00('0x4'));var rp=require(_0xea00('0x5'));var fs=require('fs');var path=require(_0xea00('0x6'));var rimraf=require(_0xea00('0x7'));var config=require(_0xea00('0x8'));var attributes=require(_0xea00('0x9'));module['exports']=function(_0x2c723b,_0x4f2c46){return _0x2c723b[_0xea00('0xa')](_0xea00('0xb'),attributes,{'tableName':_0xea00('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d2f=['../../config/environment','./voicePrefix.attributes','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0x3d2f,0x115));var _0xf3d2=function(_0x33a17b,_0x4e04ff){_0x33a17b=_0x33a17b-0x0;var _0x57e182=_0x3d2f[_0x33a17b];return _0x57e182;};'use strict';var _=require(_0xf3d2('0x0'));var util=require(_0xf3d2('0x1'));var logger=require(_0xf3d2('0x2'))(_0xf3d2('0x3'));var moment=require(_0xf3d2('0x4'));var BPromise=require(_0xf3d2('0x5'));var rp=require(_0xf3d2('0x6'));var fs=require('fs');var path=require(_0xf3d2('0x7'));var rimraf=require(_0xf3d2('0x8'));var config=require(_0xf3d2('0x9'));var attributes=require(_0xf3d2('0xa'));module['exports']=function(_0x37e853,_0x508025){return _0x37e853['define'](_0xf3d2('0xb'),attributes,{'tableName':_0xf3d2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index ebaa3d3..e915381 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 _0xf435=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf435,0x174));var _0x5f43=function(_0x3f3fb4,_0x1ce6a4){_0x3f3fb4=_0x3f3fb4-0x0;var _0x367bf1=_0xf435[_0x3f3fb4];return _0x367bf1;};'use strict';var _=require('lodash');var util=require(_0x5f43('0x0'));var moment=require(_0x5f43('0x1'));var BPromise=require(_0x5f43('0x2'));var rs=require(_0x5f43('0x3'));var fs=require('fs');var Redis=require(_0x5f43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f43('0x5'));var logger=require(_0x5f43('0x6'))(_0x5f43('0x7'));var config=require(_0x5f43('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5f43('0x9')][_0x5f43('0xa')]({'port':0x232a});config[_0x5f43('0xb')]=_['defaults'](config[_0x5f43('0xb')],{'host':_0x5f43('0xc'),'port':0x18eb});var socket=require(_0x5f43('0xd'))(new Redis(config[_0x5f43('0xb')]));require(_0x5f43('0xe'))[_0x5f43('0xf')](socket);function respondWithRpcPromise(_0x233acb,_0x43a927,_0x35d958){return new BPromise(function(_0x43468d,_0x1c9040){return client['request'](_0x233acb,_0x35d958)['then'](function(_0x1a3d7f){logger[_0x5f43('0x10')](_0x5f43('0x11'),_0x43a927,_0x5f43('0x12'));logger[_0x5f43('0x13')](_0x5f43('0x14'),_0x43a927,_0x5f43('0x12'),JSON[_0x5f43('0x15')](_0x1a3d7f));if(_0x1a3d7f['error']){if(_0x1a3d7f[_0x5f43('0x16')]['code']===0x1f4){logger[_0x5f43('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x43a927,_0x1a3d7f[_0x5f43('0x16')][_0x5f43('0x17')]);return _0x1c9040(_0x1a3d7f[_0x5f43('0x16')][_0x5f43('0x17')]);}logger['error'](_0x5f43('0x11'),_0x43a927,_0x1a3d7f[_0x5f43('0x16')][_0x5f43('0x17')]);return _0x43468d(_0x1a3d7f['error'][_0x5f43('0x17')]);}else{logger[_0x5f43('0x10')](_0x5f43('0x11'),_0x43a927,_0x5f43('0x12'));_0x43468d(_0x1a3d7f[_0x5f43('0x18')][_0x5f43('0x17')]);}})['catch'](function(_0x74fd9d){logger[_0x5f43('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x43a927,_0x74fd9d);_0x1c9040(_0x74fd9d);});});} \ No newline at end of file +var _0x2d78=['client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x2d78,0x199));var _0x82d7=function(_0x3f994d,_0x249d72){_0x3f994d=_0x3f994d-0x0;var _0x5309b4=_0x2d78[_0x3f994d];return _0x5309b4;};'use strict';var _=require(_0x82d7('0x0'));var util=require(_0x82d7('0x1'));var moment=require(_0x82d7('0x2'));var BPromise=require('bluebird');var rs=require(_0x82d7('0x3'));var fs=require('fs');var Redis=require(_0x82d7('0x4'));var db=require(_0x82d7('0x5'))['db'];var utils=require(_0x82d7('0x6'));var logger=require(_0x82d7('0x7'))(_0x82d7('0x8'));var config=require(_0x82d7('0x9'));var jayson=require(_0x82d7('0xa'));var client=jayson[_0x82d7('0xb')][_0x82d7('0xc')]({'port':0x232a});config[_0x82d7('0xd')]=_[_0x82d7('0xe')](config[_0x82d7('0xd')],{'host':_0x82d7('0xf'),'port':0x18eb});var socket=require(_0x82d7('0x10'))(new Redis(config[_0x82d7('0xd')]));require(_0x82d7('0x11'))[_0x82d7('0x12')](socket);function respondWithRpcPromise(_0x1c069a,_0x254aa6,_0x84711){return new BPromise(function(_0x24ae3e,_0x27dd6b){return client[_0x82d7('0x13')](_0x1c069a,_0x84711)[_0x82d7('0x14')](function(_0x383bec){logger[_0x82d7('0x15')](_0x82d7('0x16'),_0x254aa6,'request\x20sent');logger[_0x82d7('0x17')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x254aa6,_0x82d7('0x18'),JSON['stringify'](_0x383bec));if(_0x383bec[_0x82d7('0x19')]){if(_0x383bec[_0x82d7('0x19')][_0x82d7('0x1a')]===0x1f4){logger[_0x82d7('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x254aa6,_0x383bec[_0x82d7('0x19')][_0x82d7('0x1b')]);return _0x27dd6b(_0x383bec[_0x82d7('0x19')][_0x82d7('0x1b')]);}logger[_0x82d7('0x19')](_0x82d7('0x16'),_0x254aa6,_0x383bec[_0x82d7('0x19')][_0x82d7('0x1b')]);return _0x24ae3e(_0x383bec[_0x82d7('0x19')][_0x82d7('0x1b')]);}else{logger['info'](_0x82d7('0x16'),_0x254aa6,_0x82d7('0x18'));_0x24ae3e(_0x383bec[_0x82d7('0x1c')][_0x82d7('0x1b')]);}})[_0x82d7('0x1d')](function(_0x3de097){logger[_0x82d7('0x19')](_0x82d7('0x16'),_0x254aa6,_0x3de097);_0x27dd6b(_0x3de097);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index a7f0d12..fc93d31 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 _0x7a72=['removeListener','voicePrefix:','save','remove'];(function(_0x596284,_0x1cd02b){var _0x5313c6=function(_0x77db49){while(--_0x77db49){_0x596284['push'](_0x596284['shift']());}};_0x5313c6(++_0x1cd02b);}(_0x7a72,0x1be));var _0x27a7=function(_0x1cf336,_0x256dff){_0x1cf336=_0x1cf336-0x0;var _0x5896b0=_0x7a72[_0x1cf336];return _0x5896b0;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x27a7('0x0'),_0x27a7('0x1'),'update'];function createListener(_0x316bd3,_0x4b4ed5){return function(_0x15d71f){_0x4b4ed5['emit'](_0x316bd3,_0x15d71f);};}function removeListener(_0x30a1a8,_0x502521){return function(){VoicePrefixEvents[_0x27a7('0x2')](_0x30a1a8,_0x502521);};}exports['register']=function(_0x320fad){for(var _0x372bb8=0x0,_0x5d7305=events['length'];_0x372bb8<_0x5d7305;_0x372bb8++){var _0x1de957=events[_0x372bb8];var _0x54e6ee=createListener(_0x27a7('0x3')+_0x1de957,_0x320fad);VoicePrefixEvents['on'](_0x1de957,_0x54e6ee);}}; \ No newline at end of file +var _0xa0bc=['save','remove','emit','removeListener','register','length'];(function(_0x4fc25d,_0x3a3e85){var _0x29959e=function(_0x1e2f9c){while(--_0x1e2f9c){_0x4fc25d['push'](_0x4fc25d['shift']());}};_0x29959e(++_0x3a3e85);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xca0b('0x0'),_0xca0b('0x1'),'update'];function createListener(_0x2cc2bf,_0x3031b2){return function(_0x113486){_0x3031b2[_0xca0b('0x2')](_0x2cc2bf,_0x113486);};}function removeListener(_0x2f7b56,_0x3a53b4){return function(){VoicePrefixEvents[_0xca0b('0x3')](_0x2f7b56,_0x3a53b4);};}exports[_0xca0b('0x4')]=function(_0x3cb084){for(var _0x1aac00=0x0,_0xbe64c7=events[_0xca0b('0x5')];_0x1aac00<_0xbe64c7;_0x1aac00++){var _0xa506a4=events[_0x1aac00];var _0x19acc2=createListener('voicePrefix:'+_0xa506a4,_0x3cb084);VoicePrefixEvents['on'](_0xa506a4,_0x19acc2);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index f379ed1..c3d2326 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 _0xa572=['create','/:id/clone','clone','addTeams','post','/:id/lists','addLists','put','update','delete','destroy','/:id/teams','removeTeams','removeAgents','removeLists','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','/:id','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/users','getAgents','/:id/members','/:id/blacklists','getBlackLists'];(function(_0x33a97b,_0x291407){var _0x13d691=function(_0x267cff){while(--_0x267cff){_0x33a97b['push'](_0x33a97b['shift']());}};_0x13d691(++_0x291407);}(_0xa572,0x138));var _0x2a57=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xa572[_0x236d24];return _0x1574cf;};'use strict';var multer=require(_0x2a57('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2a57('0x1'));var router=express[_0x2a57('0x2')]();var fs_extra=require(_0x2a57('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2a57('0x4'));var config=require(_0x2a57('0x5'));var controller=require(_0x2a57('0x6'));router[_0x2a57('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2a57('0x7')](_0x2a57('0x8'),auth[_0x2a57('0x9')](),controller['show']);router[_0x2a57('0x7')](_0x2a57('0xa'),auth[_0x2a57('0x9')](),controller[_0x2a57('0xb')]);router[_0x2a57('0x7')](_0x2a57('0xc'),auth[_0x2a57('0x9')](),controller[_0x2a57('0xd')]);router[_0x2a57('0x7')](_0x2a57('0xe'),auth[_0x2a57('0x9')](),controller[_0x2a57('0xf')]);router[_0x2a57('0x7')]('/:id/hopper_black',auth[_0x2a57('0x9')](),controller['getHopperBlacks']);router[_0x2a57('0x7')]('/:id/teams',auth[_0x2a57('0x9')](),controller['getTeams']);router[_0x2a57('0x7')](_0x2a57('0x10'),auth['isAuthenticated'](),controller[_0x2a57('0x11')]);router[_0x2a57('0x7')](_0x2a57('0x12'),auth['isAuthenticated'](),controller['getMembers']);router[_0x2a57('0x7')]('/:id/lists',auth[_0x2a57('0x9')](),controller['getLists']);router[_0x2a57('0x7')](_0x2a57('0x13'),auth[_0x2a57('0x9')](),controller[_0x2a57('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2a57('0x15')]);router['post'](_0x2a57('0x16'),auth[_0x2a57('0x9')](),controller[_0x2a57('0x17')]);router['post']('/:id/teams',auth[_0x2a57('0x9')](),controller[_0x2a57('0x18')]);router[_0x2a57('0x19')]('/:id/users',auth[_0x2a57('0x9')](),controller['addAgents']);router['post'](_0x2a57('0x1a'),auth[_0x2a57('0x9')](),controller[_0x2a57('0x1b')]);router['post'](_0x2a57('0x13'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0x2a57('0x1c')](_0x2a57('0x8'),auth[_0x2a57('0x9')](),controller[_0x2a57('0x1d')]);router[_0x2a57('0x1e')](_0x2a57('0x8'),auth[_0x2a57('0x9')](),controller[_0x2a57('0x1f')]);router[_0x2a57('0x1e')](_0x2a57('0x20'),auth[_0x2a57('0x9')](),controller[_0x2a57('0x21')]);router['delete'](_0x2a57('0x10'),auth[_0x2a57('0x9')](),controller[_0x2a57('0x22')]);router[_0x2a57('0x1e')](_0x2a57('0x1a'),auth['isAuthenticated'](),controller[_0x2a57('0x23')]);router[_0x2a57('0x1e')](_0x2a57('0x13'),auth[_0x2a57('0x9')](),controller['removeBlackLists']);module[_0x2a57('0x24')]=router; \ No newline at end of file +var _0xb7a0=['../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','addTeams','addBlackLists','put','update','delete','removeAgents','removeLists','removeBlackLists','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0xb7a0,0xf7));var _0x0b7a=function(_0x4f867c,_0x3f4293){_0x4f867c=_0x4f867c-0x0;var _0x280f61=_0xb7a0[_0x4f867c];return _0x280f61;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0b7a('0x0'));var timeout=require(_0x0b7a('0x1'));var express=require(_0x0b7a('0x2'));var router=express[_0x0b7a('0x3')]();var fs_extra=require(_0x0b7a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0b7a('0x5'));var config=require('../../config/environment');var controller=require(_0x0b7a('0x6'));router[_0x0b7a('0x7')]('/',auth[_0x0b7a('0x8')](),controller[_0x0b7a('0x9')]);router[_0x0b7a('0x7')](_0x0b7a('0xa'),auth[_0x0b7a('0x8')](),controller[_0x0b7a('0xb')]);router['get'](_0x0b7a('0xc'),auth[_0x0b7a('0x8')](),controller[_0x0b7a('0xd')]);router[_0x0b7a('0x7')](_0x0b7a('0xe'),auth[_0x0b7a('0x8')](),controller[_0x0b7a('0xf')]);router[_0x0b7a('0x7')](_0x0b7a('0x10'),auth[_0x0b7a('0x8')](),controller[_0x0b7a('0x11')]);router['get'](_0x0b7a('0x12'),auth[_0x0b7a('0x8')](),controller[_0x0b7a('0x13')]);router[_0x0b7a('0x7')](_0x0b7a('0x14'),auth['isAuthenticated'](),controller[_0x0b7a('0x15')]);router[_0x0b7a('0x7')](_0x0b7a('0x16'),auth[_0x0b7a('0x8')](),controller[_0x0b7a('0x17')]);router['get'](_0x0b7a('0x18'),auth['isAuthenticated'](),controller[_0x0b7a('0x19')]);router[_0x0b7a('0x7')](_0x0b7a('0x1a'),auth[_0x0b7a('0x8')](),controller[_0x0b7a('0x1b')]);router[_0x0b7a('0x7')](_0x0b7a('0x1c'),auth[_0x0b7a('0x8')](),controller['getBlackLists']);router[_0x0b7a('0x1d')]('/',auth[_0x0b7a('0x8')](),controller[_0x0b7a('0x1e')]);router[_0x0b7a('0x1d')](_0x0b7a('0x1f'),auth[_0x0b7a('0x8')](),controller[_0x0b7a('0x20')]);router[_0x0b7a('0x1d')]('/:id/teams',auth[_0x0b7a('0x8')](),controller[_0x0b7a('0x21')]);router['post'](_0x0b7a('0x16'),auth[_0x0b7a('0x8')](),controller['addAgents']);router[_0x0b7a('0x1d')](_0x0b7a('0x1a'),auth[_0x0b7a('0x8')](),controller['addLists']);router[_0x0b7a('0x1d')](_0x0b7a('0x1c'),auth[_0x0b7a('0x8')](),controller[_0x0b7a('0x22')]);router[_0x0b7a('0x23')]('/:id',auth['isAuthenticated'](),controller[_0x0b7a('0x24')]);router[_0x0b7a('0x25')](_0x0b7a('0xa'),auth[_0x0b7a('0x8')](),controller['destroy']);router[_0x0b7a('0x25')](_0x0b7a('0x14'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x0b7a('0x25')]('/:id/users',auth[_0x0b7a('0x8')](),controller[_0x0b7a('0x26')]);router[_0x0b7a('0x25')](_0x0b7a('0x1a'),auth[_0x0b7a('0x8')](),controller[_0x0b7a('0x27')]);router[_0x0b7a('0x25')](_0x0b7a('0x1c'),auth[_0x0b7a('0x8')](),controller[_0x0b7a('0x28')]);module[_0x0b7a('0x29')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index dff6841..fcd562d 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 _0xbe52=['never','onlyIfOpen','Active/Disactive\x20AMD','#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)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','outbound','inbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','rrordered','strategy','getDataValue','type','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','setDataValue','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','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)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xbe52,0x164));var _0x2be5=function(_0x1e9eab,_0x3962ab){_0x1e9eab=_0x1e9eab-0x0;var _0x211a73=_0xbe52[_0x1e9eab];return _0x211a73;};'use strict';var Sequelize=require(_0x2be5('0x0'));module[_0x2be5('0x1')]={'name':{'type':Sequelize[_0x2be5('0x2')],'allowNull':![],'unique':_0x2be5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2be5('0x4')]('inbound',_0x2be5('0x5')),'allowNull':![],'defaultValue':_0x2be5('0x6')},'musiconhold':{'type':Sequelize[_0x2be5('0x2')],'defaultValue':_0x2be5('0x7')},'announce':{'type':Sequelize[_0x2be5('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x2be5('0x4')]('rr',_0x2be5('0x8'),_0x2be5('0x9'),_0x2be5('0xa'),_0x2be5('0xb'),_0x2be5('0xc'),_0x2be5('0xd'),'wrandom',_0x2be5('0xe')),'allowNull':![],'defaultValue':_0x2be5('0x8'),'set':function(_0x3bdce2){this['setDataValue'](_0x2be5('0xf'),_0x3bdce2?_0x3bdce2:'rrmemory');},'get':function(){var _0x4c71ad=this[_0x2be5('0x10')](_0x2be5('0x11'));var _0x158fa5=this[_0x2be5('0x10')]('dialMethod');var _0x136b16=this[_0x2be5('0x10')]('strategy');if(_0x4c71ad==='inbound'){return _0x136b16;}if(_0x158fa5===_0x2be5('0x12')&&_0x136b16===_0x2be5('0xc')||_0x158fa5==='booked'&&_0x136b16===_0x2be5('0x13')){return _0x136b16;}if(_0x158fa5===_0x2be5('0x14')||_0x158fa5===_0x2be5('0x15')||_0x158fa5===_0x2be5('0x16')){return _0x136b16;}return null;}},'servicelevel':{'type':Sequelize[_0x2be5('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x2be5('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x2be5('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x2be5('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x2be5('0x4')](_0x2be5('0x18'),'no'),'defaultValue':_0x2be5('0x18')},'autopause':{'type':Sequelize['ENUM'](_0x2be5('0x18'),'no',_0x2be5('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x2be5('0x4')](_0x2be5('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x2be5('0x4')](_0x2be5('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x2be5('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x2be5('0x4')](_0x2be5('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x2be5('0x4')](_0x2be5('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x2be5('0x4')](_0x2be5('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x2be5('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x2be5('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x2be5('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x2be5('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x2be5('0x4')](_0x2be5('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x2be5('0x4')](_0x2be5('0x18'),'no'),'defaultValue':_0x2be5('0x18')},'announce_holdtime':{'type':Sequelize[_0x2be5('0x4')]('yes','no',_0x2be5('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x2be5('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x2be5('0x4')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x2be5('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x2be5('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x2be5('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x2be5('0x2')]},'queue_youarenext':{'type':Sequelize[_0x2be5('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x2be5('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x2be5('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x2be5('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x2be5('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x2be5('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x2be5('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x2be5('0x2')]},'queue_quantity1':{'type':Sequelize[_0x2be5('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x2be5('0x2')]},'queue_less_than':{'type':Sequelize[_0x2be5('0x2')]},'periodic_announce':{'type':Sequelize[_0x2be5('0x1b')],'set':function(_0x38d727){this[_0x2be5('0x1c')](_0x2be5('0x1d'),_0x38d727?_0x38d727[_0x2be5('0x1e')](','):[]);},'get':function(){return this['getDataValue'](_0x2be5('0x1d'))?this[_0x2be5('0x10')](_0x2be5('0x1d'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x2be5('0x2')],'defaultValue':_0x2be5('0x18'),'set':function(_0x4dd9ff){this[_0x2be5('0x1c')](_0x2be5('0x1f'),_0x4dd9ff?_0x4dd9ff[_0x2be5('0x1e')](','):undefined);},'get':function(){return this[_0x2be5('0x10')]('joinempty')?this[_0x2be5('0x10')](_0x2be5('0x1f'))[_0x2be5('0x20')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x5acbfb){this[_0x2be5('0x1c')](_0x2be5('0x21'),_0x5acbfb?_0x5acbfb[_0x2be5('0x1e')](','):undefined);},'get':function(){return this[_0x2be5('0x10')](_0x2be5('0x21'))?this[_0x2be5('0x10')]('leavewhenempty')[_0x2be5('0x20')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x2be5('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x2be5('0x4')](_0x2be5('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x2be5('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x2be5('0x2')]},'description':{'type':Sequelize[_0x2be5('0x2')]},'acw':{'type':Sequelize[_0x2be5('0x22')],'defaultValue':0x0,'set':function(_0x1644be){this[_0x2be5('0x1c')](_0x2be5('0x23'),_0x1644be);if(_0x1644be){if(this[_0x2be5('0x10')](_0x2be5('0x24'))<0x2){this[_0x2be5('0x1c')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x2be5('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x2be5('0x22')],'defaultValue':0x0,'comment':_0x2be5('0x25')},'dialMethod':{'type':Sequelize['ENUM'](_0x2be5('0x26'),_0x2be5('0x14'),_0x2be5('0x16'),'predictive','booked'),'defaultValue':_0x2be5('0x14'),'comment':_0x2be5('0x27')},'dialLimitChannel':{'type':Sequelize[_0x2be5('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2be5('0x28')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x2be5('0x29')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2be5('0x2a')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x2be5('0x29')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x2be5('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0x2be5('0x4')](_0x2be5('0x2c'),'dropRate'),'defaultValue':'dropRate','comment':_0x2be5('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x2be5('0x2e')](0x2)[_0x2be5('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x2be5('0x2f')},'dialPredictiveInterval':{'type':Sequelize[_0x2be5('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x2be5('0x30')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2be5('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x2be5('0x17')](0x3)[_0x2be5('0x29')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2be5('0x31')},'dialQueueOptions':{'type':Sequelize[_0x2be5('0x2')],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x2be5('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x2be5('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x2be5('0x17')](0x3)[_0x2be5('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2be5('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2be5('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0x2be5('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x2be5('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2be5('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2be5('0x17')](0x5)[_0x2be5('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x2be5('0x17')](0x3)[_0x2be5('0x29')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2be5('0x34')},'dialTimezone':{'type':Sequelize[_0x2be5('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x2be5('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x2be5('0x4')](_0x2be5('0x35'),_0x2be5('0x36'),_0x2be5('0x37')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x2be5('0x22')],'defaultValue':0x0,'comment':_0x2be5('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0x2be5('0x17')](0x9)[_0x2be5('0x29')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2be5('0x39')},'dialAMDGreeting':{'type':Sequelize[_0x2be5('0x17')](0x9)[_0x2be5('0x29')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x2be5('0x29')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2be5('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2be5('0x17')](0x9)[_0x2be5('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2be5('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x2be5('0x17')](0x9)[_0x2be5('0x29')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2be5('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2be5('0x17')](0x9)[_0x2be5('0x29')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x2be5('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2be5('0x17')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2be5('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2be5('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2be5('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x2be5('0x17')](0x9)[_0x2be5('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2be5('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x2be5('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x2be5('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x2be5('0x22')],'defaultValue':0x0,'comment':_0x2be5('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2be5('0x4')](_0x2be5('0x43'),_0x2be5('0x44')),'defaultValue':_0x2be5('0x43')},'dialQueueProject2':{'type':Sequelize[_0x2be5('0x2')],'comment':_0x2be5('0x45')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x2be5('0x22')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x2be5('0x22')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2be5('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x2be5('0x17')](0x3)[_0x2be5('0x29')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2be5('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2be5('0x17')](0x3)[_0x2be5('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2be5('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2be5('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x2be5('0x17')](0x3)[_0x2be5('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2be5('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0x2be5('0x17')](0x5)[_0x2be5('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2be5('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2be5('0x17')](0x3)[_0x2be5('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2be5('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2be5('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2be5('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x2be5('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2be5('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2be5('0x17')](0x5)[_0x2be5('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2be5('0x17')](0x3)[_0x2be5('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2be5('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2be5('0x17')](0x5)[_0x2be5('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2be5('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2be5('0x17')],'allowNull':!![],'comment':_0x2be5('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0x2be5('0x22')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x92e004){if(!_0x92e004)this[_0x2be5('0x1c')](_0x2be5('0x50'),null);this['setDataValue'](_0x2be5('0x51'),_0x92e004);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x2be5('0x29')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x2be5('0x29')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x0cd6=['join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','ENUM','outbound','inbound','STRING','ringall','fewestcalls','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','booked','roundrobin','progressive','power','INTEGER','yes','all','periodic_announce'];(function(_0x2fc8b9,_0x2843cb){var _0x599fbe=function(_0x45ba2a){while(--_0x45ba2a){_0x2fc8b9['push'](_0x2fc8b9['shift']());}};_0x599fbe(++_0x2843cb);}(_0x0cd6,0x113));var _0x60cd=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0x0cd6[_0x2053ea];return _0x2232c4;};'use strict';var Sequelize=require(_0x60cd('0x0'));module[_0x60cd('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x60cd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x60cd('0x3')]('inbound',_0x60cd('0x4')),'allowNull':![],'defaultValue':_0x60cd('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0x60cd('0x6')],'defaultValue':''},'strategy':{'type':Sequelize[_0x60cd('0x3')]('rr',_0x60cd('0x7'),'leastrecent',_0x60cd('0x8'),'random',_0x60cd('0x9'),_0x60cd('0xa'),_0x60cd('0xb'),_0x60cd('0xc')),'allowNull':![],'defaultValue':_0x60cd('0x7'),'set':function(_0x3f2991){this[_0x60cd('0xd')](_0x60cd('0xe'),_0x3f2991?_0x3f2991:_0x60cd('0x9'));},'get':function(){var _0x5d82b7=this[_0x60cd('0xf')](_0x60cd('0x10'));var _0x516c6a=this[_0x60cd('0xf')]('dialMethod');var _0x38a0ee=this[_0x60cd('0xf')]('strategy');if(_0x5d82b7===_0x60cd('0x5')){return _0x38a0ee;}if(_0x516c6a===_0x60cd('0x11')&&_0x38a0ee===_0x60cd('0x9')||_0x516c6a==='booked'&&_0x38a0ee===_0x60cd('0x12')){return _0x38a0ee;}if(_0x516c6a===_0x60cd('0x13')||_0x516c6a==='predictive'||_0x516c6a===_0x60cd('0x14')){return _0x38a0ee;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x60cd('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x60cd('0x15')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x60cd('0x6')]},'weight':{'type':Sequelize[_0x60cd('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x60cd('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x60cd('0x16'),'no'),'defaultValue':_0x60cd('0x16')},'autopause':{'type':Sequelize[_0x60cd('0x3')](_0x60cd('0x16'),'no',_0x60cd('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x60cd('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x60cd('0x3')](_0x60cd('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x60cd('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x60cd('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x60cd('0x3')](_0x60cd('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x60cd('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x60cd('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x60cd('0x6')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x60cd('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x60cd('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x60cd('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x60cd('0x16'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x60cd('0x3')](_0x60cd('0x16'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x60cd('0x3')](_0x60cd('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x60cd('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x60cd('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x60cd('0x6')]},'queue_youarenext':{'type':Sequelize[_0x60cd('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x60cd('0x6')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x60cd('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x60cd('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x60cd('0x6')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x60cd('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x60cd('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x60cd('0x6')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x60cd('0x6')]},'queue_periodic_announce':{'type':Sequelize[_0x60cd('0x6')]},'queue_less_than':{'type':Sequelize[_0x60cd('0x6')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x3f5b23){this['setDataValue'](_0x60cd('0x18'),_0x3f5b23?_0x3f5b23[_0x60cd('0x19')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0x60cd('0xf')](_0x60cd('0x18'))[_0x60cd('0x1a')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x60cd('0x16'),'set':function(_0x2b4959){this[_0x60cd('0xd')](_0x60cd('0x1b'),_0x2b4959?_0x2b4959[_0x60cd('0x19')](','):undefined);},'get':function(){return this[_0x60cd('0xf')](_0x60cd('0x1b'))?this['getDataValue'](_0x60cd('0x1b'))[_0x60cd('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x60cd('0x6')],'defaultValue':'no','set':function(_0x3eea02){this[_0x60cd('0xd')](_0x60cd('0x1c'),_0x3eea02?_0x3eea02['join'](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this[_0x60cd('0xf')](_0x60cd('0x1c'))[_0x60cd('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x60cd('0x3')](_0x60cd('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x60cd('0x3')](_0x60cd('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x60cd('0x3')](_0x60cd('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x60cd('0x6')]},'description':{'type':Sequelize[_0x60cd('0x6')]},'acw':{'type':Sequelize[_0x60cd('0x1d')],'defaultValue':0x0,'set':function(_0x1d04f7){this[_0x60cd('0xd')](_0x60cd('0x1e'),_0x1d04f7);if(_0x1d04f7){if(this[_0x60cd('0xf')]('wrapuptime')<0x2){this[_0x60cd('0xd')](_0x60cd('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x60cd('0x20')},'dialMethod':{'type':Sequelize[_0x60cd('0x3')](_0x60cd('0x21'),_0x60cd('0x13'),_0x60cd('0x14'),'predictive',_0x60cd('0x11')),'defaultValue':_0x60cd('0x13'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x60cd('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x60cd('0x23')},'dialLimitQueue':{'type':Sequelize[_0x60cd('0x15')](0x4)[_0x60cd('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x60cd('0x24')},'dialPowerLevel':{'type':Sequelize[_0x60cd('0x25')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x60cd('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0x60cd('0x3')](_0x60cd('0x27'),_0x60cd('0x28')),'defaultValue':_0x60cd('0x28'),'comment':_0x60cd('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x60cd('0x25')](0x2)[_0x60cd('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x60cd('0x2a')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x60cd('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x60cd('0x6')]},'dialOriginateTimeout':{'type':Sequelize[_0x60cd('0x15')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0x60cd('0x2b')},'dialQueueTimeout':{'type':Sequelize[_0x60cd('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x60cd('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0x60cd('0x15')](0x3)[_0x60cd('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60cd('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x60cd('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x60cd('0x2e')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x60cd('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60cd('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize[_0x60cd('0x15')](0x5)[_0x60cd('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x60cd('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x60cd('0x22')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x60cd('0x15')](0x5)[_0x60cd('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x60cd('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x60cd('0x31')},'dialTimezone':{'type':Sequelize[_0x60cd('0x6')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x60cd('0x6')],'defaultValue':_0x60cd('0x32')},'dialPrefix':{'type':Sequelize[_0x60cd('0x6')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x60cd('0x3')](_0x60cd('0x33'),_0x60cd('0x34'),_0x60cd('0x35')),'defaultValue':_0x60cd('0x33')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x60cd('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x60cd('0x36')},'dialAMDGreeting':{'type':Sequelize[_0x60cd('0x15')](0x9)[_0x60cd('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x60cd('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x60cd('0x15')](0x9)[_0x60cd('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x60cd('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x60cd('0x15')](0x9)[_0x60cd('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x60cd('0x15')](0x9)[_0x60cd('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x60cd('0x39')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x60cd('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x60cd('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x60cd('0x15')](0x9)[_0x60cd('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x60cd('0x3b')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x60cd('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x60cd('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x60cd('0x3c')},'dialRecallInQueue':{'type':Sequelize[_0x60cd('0x1d')],'defaultValue':0x0,'comment':_0x60cd('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x60cd('0x3')](_0x60cd('0x3e'),'ASC'),'defaultValue':_0x60cd('0x3e')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x60cd('0x2c')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x60cd('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x60cd('0x15')](0x3)[_0x60cd('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x60cd('0x3f')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x60cd('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x60cd('0x15')](0x3)[_0x60cd('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x60cd('0x15')](0x5)[_0x60cd('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x60cd('0x40')},'dialDropMaxRetry':{'type':Sequelize[_0x60cd('0x15')](0x3)[_0x60cd('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60cd('0x41')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x60cd('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x60cd('0x42')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x60cd('0x15')](0x3)[_0x60cd('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60cd('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x60cd('0x15')](0x5)[_0x60cd('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x60cd('0x44')},'dialMachineMaxRetry':{'type':Sequelize[_0x60cd('0x15')](0x3)[_0x60cd('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60cd('0x45')},'dialMachineRetryFrequency':{'type':Sequelize[_0x60cd('0x15')](0x5)[_0x60cd('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x60cd('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x60cd('0x15')](0x3)[_0x60cd('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x60cd('0x15')](0x5)[_0x60cd('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x60cd('0x47')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x60cd('0x15')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x60cd('0x1d')],'defaultValue':![],'comment':_0x60cd('0x48'),'set':function(_0x3b8a29){if(!_0x3b8a29)this[_0x60cd('0xd')](_0x60cd('0x49'),null);this['setDataValue'](_0x60cd('0x4a'),_0x3b8a29);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x60cd('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x60cd('0x15')](0x3)[_0x60cd('0x22')],'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 65da545..f9e9502 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 _0x08cb=['CmHopperHistory','getHopperFinals','VoiceQueueId','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','penalty','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','forEach','emit','removeTeams','select','field','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','SELECT','every','TeamId','includes','all','union','compact','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','push','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','ContactId','phone','NOW()','scheduledAt','CmListId','toString','ListId','from','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','filter','map','value','find','type','name','UserProfileResource','end','stack','send','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VoiceQueue','includeAll','include','findAll','catch','show','params','rawAttributes','create','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','getHoppers','findOne','CmHopper','sort','pick','options','rows','getHopperHistories'];(function(_0x11296e,_0x14241e){var _0x31bca0=function(_0x4ca952){while(--_0x4ca952){_0x11296e['push'](_0x11296e['shift']());}};_0x31bca0(++_0x14241e);}(_0x08cb,0x109));var _0xb08c=function(_0x1ca4be,_0x2b81e3){_0x1ca4be=_0x1ca4be-0x0;var _0x5bb12b=_0x08cb[_0x1ca4be];return _0x5bb12b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb08c('0x0'));var zipdir=require(_0xb08c('0x1'));var jsonpatch=require(_0xb08c('0x2'));var rp=require('request-promise');var moment=require(_0xb08c('0x3'));var BPromise=require(_0xb08c('0x4'));var Mustache=require('mustache');var util=require(_0xb08c('0x5'));var path=require(_0xb08c('0x6'));var sox=require(_0xb08c('0x7'));var csv=require(_0xb08c('0x8'));var ejs=require(_0xb08c('0x9'));var fs=require('fs');var fs_extra=require(_0xb08c('0xa'));var _=require('lodash');var squel=require(_0xb08c('0xb'));var crypto=require(_0xb08c('0xc'));var jsforce=require(_0xb08c('0xd'));var deskjs=require(_0xb08c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb08c('0xf'));var Papa=require(_0xb08c('0x10'));var Redis=require(_0xb08c('0x11'));var authService=require(_0xb08c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb08c('0x13'))('api');var utils=require(_0xb08c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb08c('0x15'));var db=require(_0xb08c('0x16'))['db'];config['redis']=_[_0xb08c('0x17')](config['redis'],{'host':_0xb08c('0x18'),'port':0x18eb});var socket=require(_0xb08c('0x19'))(new Redis(config[_0xb08c('0x1a')]));require('./voiceQueue.socket')[_0xb08c('0x1b')](socket);function respondWithStatusCode(_0x5c94c3,_0x5df2be){_0x5df2be=_0x5df2be||0xcc;return function(_0x10e1eb){if(_0x10e1eb){return _0x5c94c3[_0xb08c('0x1c')](_0x5df2be);}return _0x5c94c3[_0xb08c('0x1d')](_0x5df2be)['end']();};}function respondWithResult(_0xc9b077,_0x3b6a03){_0x3b6a03=_0x3b6a03||0xc8;return function(_0x194474){if(_0x194474){return _0xc9b077[_0xb08c('0x1d')](_0x3b6a03)[_0xb08c('0x1e')](_0x194474);}};}function respondWithFilteredResult(_0xa046d1,_0x39fb2e){return function(_0x37bcdc){if(_0x37bcdc){var _0x340c75=typeof _0x39fb2e['offset']===_0xb08c('0x1f')&&typeof _0x39fb2e[_0xb08c('0x20')]==='undefined';var _0x238d76=_0x37bcdc[_0xb08c('0x21')];var _0x4a6720=_0x340c75?0x0:_0x39fb2e[_0xb08c('0x22')];var _0x3a6cdd=_0x340c75?_0x37bcdc[_0xb08c('0x21')]:_0x39fb2e[_0xb08c('0x22')]+_0x39fb2e[_0xb08c('0x20')];var _0x87b97c;if(_0x3a6cdd>=_0x238d76){_0x3a6cdd=_0x238d76;_0x87b97c=0xc8;}else{_0x87b97c=0xce;}_0xa046d1[_0xb08c('0x1d')](_0x87b97c);return _0xa046d1[_0xb08c('0x23')](_0xb08c('0x24'),_0x4a6720+'-'+_0x3a6cdd+'/'+_0x238d76)['json'](_0x37bcdc);}return null;};}function patchUpdates(_0x1b9ef1){return function(_0x288a90){try{jsonpatch['apply'](_0x288a90,_0x1b9ef1,!![]);}catch(_0x5314b5){return BPromise[_0xb08c('0x25')](_0x5314b5);}return _0x288a90['save']();};}function saveUpdates(_0x52d52c,_0x26ee35){return function(_0x3e640b){if(_0x3e640b){return _0x3e640b[_0xb08c('0x26')](_0x52d52c)[_0xb08c('0x27')](function(_0x3526e1){return _0x3526e1;});}return null;};}function removeEntity(_0x4c9017,_0x17349f){return function(_0x6d571a){if(_0x6d571a){return _0x6d571a[_0xb08c('0x28')]()['then'](function(){var _0xc722ae=_0x6d571a[_0xb08c('0x29')]({'plain':!![]});var _0x9a08ce=[{'name':_0xb08c('0x2a'),'value':'inbound','ignore':![]},{'name':_0xb08c('0x2b'),'value':_0xb08c('0x2c'),'ignore':![]}];var _0x5a63ed=_(_0x9a08ce)[_0xb08c('0x2d')]('ignore')[_0xb08c('0x2e')](_0xb08c('0x2f'))[_0xb08c('0x2f')]();if(_['includes'](_0x5a63ed,_0xc722ae['type'])){return;}var _0x10a176=_[_0xb08c('0x30')](_0x9a08ce,[_0xb08c('0x2f'),_0xc722ae[_0xb08c('0x31')]])[_0xb08c('0x32')];return db[_0xb08c('0x33')][_0xb08c('0x28')]({'where':{'type':_0x10a176,'resourceId':_0xc722ae['id']}})['then'](function(){return _0x6d571a;});})['then'](function(){_0x4c9017[_0xb08c('0x1d')](0xcc)[_0xb08c('0x34')]();});}};}function handleEntityNotFound(_0x2dd1d2,_0x579af9){return function(_0x383271){if(!_0x383271){_0x2dd1d2[_0xb08c('0x1c')](0x194);}return _0x383271;};}function handleError(_0x43ad38,_0x1b1c5b){_0x1b1c5b=_0x1b1c5b||0x1f4;return function(_0x20be39){logger['error'](_0x20be39[_0xb08c('0x35')]);if(_0x20be39[_0xb08c('0x32')]){delete _0x20be39[_0xb08c('0x32')];}_0x43ad38['status'](_0x1b1c5b)[_0xb08c('0x36')](_0x20be39);};}exports['index']=function(_0x5d1b7d,_0x458d79){var _0x2513e6={},_0xdce307={},_0xb51de9={'count':0x0,'rows':[]};var _0x55fc1b=_[_0xb08c('0x2e')](db['VoiceQueue']['rawAttributes'],function(_0x2982b1){return{'name':_0x2982b1[_0xb08c('0x37')],'type':_0x2982b1[_0xb08c('0x31')][_0xb08c('0x38')]};});_0xdce307['model']=_[_0xb08c('0x2e')](_0x55fc1b,_0xb08c('0x32'));_0xdce307[_0xb08c('0x39')]=_[_0xb08c('0x3a')](_0x5d1b7d[_0xb08c('0x39')]);_0xdce307[_0xb08c('0x3b')]=_[_0xb08c('0x3c')](_0xdce307[_0xb08c('0x3d')],_0xdce307[_0xb08c('0x39')]);_0x2513e6[_0xb08c('0x3e')]=_[_0xb08c('0x3c')](_0xdce307[_0xb08c('0x3d')],qs[_0xb08c('0x3f')](_0x5d1b7d[_0xb08c('0x39')][_0xb08c('0x3f')]));_0x2513e6[_0xb08c('0x3e')]=_0x2513e6['attributes'][_0xb08c('0x40')]?_0x2513e6[_0xb08c('0x3e')]:_0xdce307[_0xb08c('0x3d')];if(!_0x5d1b7d['query'][_0xb08c('0x41')](_0xb08c('0x42'))){_0x2513e6['limit']=qs[_0xb08c('0x20')](_0x5d1b7d['query'][_0xb08c('0x20')]);_0x2513e6[_0xb08c('0x22')]=qs['offset'](_0x5d1b7d[_0xb08c('0x39')][_0xb08c('0x22')]);}_0x2513e6[_0xb08c('0x43')]=qs['sort'](_0x5d1b7d[_0xb08c('0x39')]['sort']);_0x2513e6[_0xb08c('0x44')]=qs['filters'](_['pick'](_0x5d1b7d[_0xb08c('0x39')],_0xdce307[_0xb08c('0x3b')]),_0x55fc1b);if(_0x5d1b7d[_0xb08c('0x39')][_0xb08c('0x2d')]){_0x2513e6[_0xb08c('0x44')]=_['merge'](_0x2513e6[_0xb08c('0x44')],{'$or':_['map'](_0x55fc1b,function(_0x4eaa60){if(_0x4eaa60[_0xb08c('0x31')]!=='VIRTUAL'){var _0x2fcae0={};_0x2fcae0[_0x4eaa60[_0xb08c('0x32')]]={'$like':'%'+_0x5d1b7d[_0xb08c('0x39')]['filter']+'%'};return _0x2fcae0;}})});}_0x2513e6=_[_0xb08c('0x45')]({},_0x2513e6,_0x5d1b7d['options']);var _0x37e3ec={'where':_0x2513e6[_0xb08c('0x44')]};return db[_0xb08c('0x46')]['count'](_0x37e3ec)[_0xb08c('0x27')](function(_0x48310a){_0xb51de9['count']=_0x48310a;if(_0x5d1b7d['query'][_0xb08c('0x47')]){_0x2513e6[_0xb08c('0x48')]=[{'all':!![]}];}return db[_0xb08c('0x46')][_0xb08c('0x49')](_0x2513e6);})[_0xb08c('0x27')](function(_0x510380){_0xb51de9['rows']=_0x510380;return _0xb51de9;})[_0xb08c('0x27')](respondWithFilteredResult(_0x458d79,_0x2513e6))[_0xb08c('0x4a')](handleError(_0x458d79,null));};exports[_0xb08c('0x4b')]=function(_0x2e7e6b,_0x3c398b){var _0x4e0425={'raw':![],'where':{'id':_0x2e7e6b[_0xb08c('0x4c')]['id']}},_0x4a5030={};_0x4a5030[_0xb08c('0x3d')]=_['keys'](db[_0xb08c('0x46')][_0xb08c('0x4d')]);_0x4a5030[_0xb08c('0x39')]=_[_0xb08c('0x3a')](_0x2e7e6b[_0xb08c('0x39')]);_0x4a5030['filters']=_[_0xb08c('0x3c')](_0x4a5030['model'],_0x4a5030[_0xb08c('0x39')]);_0x4e0425['attributes']=_[_0xb08c('0x3c')](_0x4a5030[_0xb08c('0x3d')],qs['fields'](_0x2e7e6b[_0xb08c('0x39')]['fields']));_0x4e0425[_0xb08c('0x3e')]=_0x4e0425['attributes'][_0xb08c('0x40')]?_0x4e0425[_0xb08c('0x3e')]:_0x4a5030[_0xb08c('0x3d')];if(_0x2e7e6b[_0xb08c('0x39')]['includeAll']){_0x4e0425[_0xb08c('0x48')]=[{'all':!![]}];}_0x4e0425=_[_0xb08c('0x45')]({},_0x4e0425,_0x2e7e6b['options']);return db['VoiceQueue'][_0xb08c('0x30')](_0x4e0425)[_0xb08c('0x27')](handleEntityNotFound(_0x3c398b,null))[_0xb08c('0x27')](respondWithResult(_0x3c398b,null))[_0xb08c('0x4a')](handleError(_0x3c398b,null));};exports['create']=function(_0x53c18b,_0x436a7b){return db[_0xb08c('0x46')][_0xb08c('0x4e')](_0x53c18b['body'],{})[_0xb08c('0x27')](function(_0x32c2f6){var _0x449b60=_0x53c18b['user'][_0xb08c('0x29')]({'plain':!![]});if(!_0x449b60)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x449b60['role']===_0xb08c('0x4f')){var _0x17fd37=_0x32c2f6[_0xb08c('0x29')]({'plain':!![]});var _0x16561f=[{'name':_0xb08c('0x2a'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xb08c('0x2c')}];var _0x4480db=_[_0xb08c('0x30')](_0x16561f,['value',_0x17fd37[_0xb08c('0x31')]])['name'];return db[_0xb08c('0x50')][_0xb08c('0x30')]({'where':{'name':_0x4480db,'userProfileId':_0x449b60[_0xb08c('0x51')]},'raw':!![]})[_0xb08c('0x27')](function(_0x2682af){if(_0x2682af&&_0x2682af[_0xb08c('0x52')]===0x0){return db[_0xb08c('0x33')]['create']({'name':_0x17fd37['name'],'resourceId':_0x17fd37['id'],'type':_0x2682af['name'],'sectionId':_0x2682af['id']},{})[_0xb08c('0x27')](function(){return _0x32c2f6;});}else{return _0x32c2f6;}})['catch'](function(_0x45917d){logger[_0xb08c('0x53')](_0xb08c('0x54'),_0x45917d);throw _0x45917d;});}return _0x32c2f6;})[_0xb08c('0x27')](respondWithResult(_0x436a7b,0xc9))[_0xb08c('0x4a')](handleError(_0x436a7b,null));};exports[_0xb08c('0x55')]=function(_0x454b60,_0x52f708){var _0x9435d0={'where':{'id':_0x454b60[_0xb08c('0x4c')]['id']}},_0x435ecc={};_0x435ecc[_0xb08c('0x3d')]=_['keys'](db[_0xb08c('0x46')][_0xb08c('0x4d')]);_0x9435d0[_0xb08c('0x3e')]=_[_0xb08c('0x3c')](_0x435ecc[_0xb08c('0x3d')],qs[_0xb08c('0x3f')](_0x454b60[_0xb08c('0x39')][_0xb08c('0x3f')]));_0x9435d0[_0xb08c('0x3e')]=_0x9435d0[_0xb08c('0x3e')]['length']?_0x9435d0[_0xb08c('0x3e')]:_0x435ecc[_0xb08c('0x3d')];if(_0x454b60[_0xb08c('0x39')][_0xb08c('0x47')]){_0x9435d0[_0xb08c('0x48')]=[{'all':!![]}];}_0x9435d0=_[_0xb08c('0x45')]({},_0x9435d0,_0x454b60['options']);return db[_0xb08c('0x46')][_0xb08c('0x30')](_0x9435d0)['then'](handleEntityNotFound(_0x52f708,null))['then'](function(_0x411749){if(_0x411749){var _0x42867=_0x411749[_0xb08c('0x29')]({'plain':!![]});_0x42867=qs[_0xb08c('0x56')](_0x42867,['id','createdAt',_0xb08c('0x57')]);_0x454b60[_0xb08c('0x58')]=_['omit'](_0x454b60[_0xb08c('0x58')],['id',_0xb08c('0x59'),_0xb08c('0x57')]);return db[_0xb08c('0x46')]['create'](_[_0xb08c('0x45')](_0x42867,_0x454b60[_0xb08c('0x58')]),{'include':_0x454b60[_0xb08c('0x39')][_0xb08c('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x700455){var _0x4dd3ca=_0x454b60['user'][_0xb08c('0x29')]({'plain':!![]});if(!_0x4dd3ca)throw new Error(_0xb08c('0x5a'));if(_0x4dd3ca[_0xb08c('0x5b')]===_0xb08c('0x4f')){var _0x34544c=_0x700455[_0xb08c('0x29')]({'plain':!![]});var _0x48c74f=[{'name':_0xb08c('0x2a'),'value':_0xb08c('0x5c')},{'name':'QueueCampaigns','value':_0xb08c('0x2c')}];var _0x4e4699=_[_0xb08c('0x30')](_0x48c74f,['value',_0x34544c[_0xb08c('0x31')]])[_0xb08c('0x32')];return db[_0xb08c('0x50')]['find']({'where':{'name':_0x4e4699,'userProfileId':_0x4dd3ca['userProfileId']},'raw':!![]})[_0xb08c('0x27')](function(_0x5806c4){if(_0x5806c4&&_0x5806c4[_0xb08c('0x52')]===0x0){return db[_0xb08c('0x33')][_0xb08c('0x4e')]({'name':_0x34544c[_0xb08c('0x32')],'resourceId':_0x34544c['id'],'type':_0x5806c4[_0xb08c('0x32')],'sectionId':_0x5806c4['id']},{})[_0xb08c('0x27')](function(){return _0x700455;});}else{return _0x700455;}})[_0xb08c('0x4a')](function(_0x5426f5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5426f5);throw _0x5426f5;});}return _0x700455;});}})[_0xb08c('0x27')](respondWithResult(_0x52f708,0xc9))['catch'](handleError(_0x52f708,null));};exports['update']=function(_0x7c432,_0x23ce2d){if(_0x7c432[_0xb08c('0x58')]['id']){delete _0x7c432[_0xb08c('0x58')]['id'];}return db[_0xb08c('0x46')]['find']({'where':{'id':_0x7c432[_0xb08c('0x4c')]['id']}})[_0xb08c('0x27')](handleEntityNotFound(_0x23ce2d,null))['then'](saveUpdates(_0x7c432[_0xb08c('0x58')],null))[_0xb08c('0x27')](respondWithResult(_0x23ce2d,null))['catch'](handleError(_0x23ce2d,null));};exports[_0xb08c('0x28')]=function(_0x477ee1,_0x1a25d9){return db[_0xb08c('0x46')][_0xb08c('0x30')]({'where':{'id':_0x477ee1[_0xb08c('0x4c')]['id']}})[_0xb08c('0x27')](handleEntityNotFound(_0x1a25d9,null))[_0xb08c('0x27')](removeEntity(_0x1a25d9,null))['catch'](handleError(_0x1a25d9,null));};exports[_0xb08c('0x5d')]=function(_0x248c92,_0x228068,_0x19c8c6){var _0x61935={'raw':![],'where':{}};var _0x3c1177={};var _0x3d93d7={'count':0x0,'rows':[]};return db[_0xb08c('0x46')][_0xb08c('0x5e')]({'where':{'id':_0x248c92[_0xb08c('0x4c')]['id']}})[_0xb08c('0x27')](handleEntityNotFound(_0x228068,null))[_0xb08c('0x27')](function(_0x5872d8){if(_0x5872d8){_0x3c1177[_0xb08c('0x3d')]=_[_0xb08c('0x3a')](db[_0xb08c('0x5f')]['rawAttributes']);_0x3c1177[_0xb08c('0x39')]=_[_0xb08c('0x3a')](_0x248c92[_0xb08c('0x39')]);_0x3c1177[_0xb08c('0x3b')]=_[_0xb08c('0x3c')](_0x3c1177['model'],_0x3c1177[_0xb08c('0x39')]);_0x61935[_0xb08c('0x3e')]=_[_0xb08c('0x3c')](_0x3c1177[_0xb08c('0x3d')],qs['fields'](_0x248c92[_0xb08c('0x39')][_0xb08c('0x3f')]));_0x61935[_0xb08c('0x3e')]=_0x61935[_0xb08c('0x3e')][_0xb08c('0x40')]?_0x61935[_0xb08c('0x3e')]:_0x3c1177[_0xb08c('0x3d')];if(!_0x248c92[_0xb08c('0x39')][_0xb08c('0x41')]('nolimit')){_0x61935[_0xb08c('0x20')]=qs['limit'](_0x248c92[_0xb08c('0x39')][_0xb08c('0x20')]);_0x61935[_0xb08c('0x22')]=qs[_0xb08c('0x22')](_0x248c92['query'][_0xb08c('0x22')]);}_0x61935[_0xb08c('0x43')]=qs[_0xb08c('0x60')](_0x248c92[_0xb08c('0x39')][_0xb08c('0x60')]);_0x61935[_0xb08c('0x44')]=qs[_0xb08c('0x3b')](_[_0xb08c('0x61')](_0x248c92[_0xb08c('0x39')],_0x3c1177[_0xb08c('0x3b')]));_0x61935['where']['VoiceQueueId']=_0x5872d8['id'];if(_0x248c92['query'][_0xb08c('0x2d')]){_0x61935[_0xb08c('0x44')]=_[_0xb08c('0x45')](_0x61935[_0xb08c('0x44')],{'$or':_[_0xb08c('0x2e')](_0x61935[_0xb08c('0x3e')],function(_0x29dc42){var _0x405c78={};_0x405c78[_0x29dc42]={'$like':'%'+_0x248c92['query']['filter']+'%'};return _0x405c78;})});}_0x61935=_[_0xb08c('0x45')]({},_0x61935,_0x248c92[_0xb08c('0x62')]);return db[_0xb08c('0x5f')][_0xb08c('0x21')]({'where':_0x61935[_0xb08c('0x44')]})[_0xb08c('0x27')](function(_0x3eb806){_0x3d93d7['count']=_0x3eb806;if(_0x248c92[_0xb08c('0x39')][_0xb08c('0x47')]){_0x61935[_0xb08c('0x48')]=[{'all':!![]}];}return db['CmHopper'][_0xb08c('0x49')](_0x61935);})[_0xb08c('0x27')](function(_0x3678ac){_0x3d93d7[_0xb08c('0x63')]=_0x3678ac;return _0x3d93d7;});}})[_0xb08c('0x27')](respondWithFilteredResult(_0x228068,_0x61935))[_0xb08c('0x4a')](handleError(_0x228068,null));};exports[_0xb08c('0x64')]=function(_0x34747f,_0x9a62b1,_0x557366){var _0x57a867={'raw':!![],'where':{}};var _0x250d5a={};var _0x136c47={'count':0x0,'rows':[]};return db[_0xb08c('0x46')][_0xb08c('0x5e')]({'where':{'id':_0x34747f[_0xb08c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x9a62b1,null))[_0xb08c('0x27')](function(_0x2ee322){if(_0x2ee322){_0x250d5a[_0xb08c('0x3d')]=_[_0xb08c('0x3a')](db[_0xb08c('0x65')][_0xb08c('0x4d')]);_0x250d5a['query']=_[_0xb08c('0x3a')](_0x34747f['query']);_0x250d5a[_0xb08c('0x3b')]=_[_0xb08c('0x3c')](_0x250d5a[_0xb08c('0x3d')],_0x250d5a[_0xb08c('0x39')]);_0x57a867[_0xb08c('0x3e')]=_[_0xb08c('0x3c')](_0x250d5a[_0xb08c('0x3d')],qs[_0xb08c('0x3f')](_0x34747f[_0xb08c('0x39')][_0xb08c('0x3f')]));_0x57a867[_0xb08c('0x3e')]=_0x57a867[_0xb08c('0x3e')][_0xb08c('0x40')]?_0x57a867[_0xb08c('0x3e')]:_0x250d5a[_0xb08c('0x3d')];if(!_0x34747f[_0xb08c('0x39')][_0xb08c('0x41')](_0xb08c('0x42'))){_0x57a867[_0xb08c('0x20')]=qs['limit'](_0x34747f[_0xb08c('0x39')][_0xb08c('0x20')]);_0x57a867[_0xb08c('0x22')]=qs[_0xb08c('0x22')](_0x34747f[_0xb08c('0x39')]['offset']);}_0x57a867[_0xb08c('0x43')]=qs[_0xb08c('0x60')](_0x34747f[_0xb08c('0x39')][_0xb08c('0x60')]);_0x57a867[_0xb08c('0x44')]=qs['filters'](_[_0xb08c('0x61')](_0x34747f['query'],_0x250d5a[_0xb08c('0x3b')]));_0x57a867[_0xb08c('0x44')]['VoiceQueueId']=_0x2ee322['id'];if(_0x34747f[_0xb08c('0x39')][_0xb08c('0x2d')]){_0x57a867[_0xb08c('0x44')]=_[_0xb08c('0x45')](_0x57a867['where'],{'$or':_[_0xb08c('0x2e')](_0x57a867[_0xb08c('0x3e')],function(_0x521c09){var _0x11064e={};_0x11064e[_0x521c09]={'$like':'%'+_0x34747f[_0xb08c('0x39')][_0xb08c('0x2d')]+'%'};return _0x11064e;})});}_0x57a867=_[_0xb08c('0x45')]({},_0x57a867,_0x34747f[_0xb08c('0x62')]);return db['CmHopperHistory'][_0xb08c('0x21')]({'where':_0x57a867[_0xb08c('0x44')]})[_0xb08c('0x27')](function(_0x212ebc){_0x136c47['count']=_0x212ebc;if(_0x34747f['query'][_0xb08c('0x47')]){_0x57a867[_0xb08c('0x48')]=[{'all':!![]}];}return db[_0xb08c('0x65')][_0xb08c('0x49')](_0x57a867);})[_0xb08c('0x27')](function(_0x24ab1f){_0x136c47[_0xb08c('0x63')]=_0x24ab1f;return _0x136c47;});}})[_0xb08c('0x27')](respondWithFilteredResult(_0x9a62b1,_0x57a867))[_0xb08c('0x4a')](handleError(_0x9a62b1,null));};exports[_0xb08c('0x66')]=function(_0xa93de2,_0x40dd0f,_0x56517e){var _0xe4fa9e={'raw':!![],'where':{}};var _0x56b2d6={};var _0x35d0b6={'count':0x0,'rows':[]};return db[_0xb08c('0x46')][_0xb08c('0x5e')]({'where':{'id':_0xa93de2[_0xb08c('0x4c')]['id']}})[_0xb08c('0x27')](handleEntityNotFound(_0x40dd0f,null))[_0xb08c('0x27')](function(_0x63cc5d){if(_0x63cc5d){_0x56b2d6[_0xb08c('0x3d')]=_[_0xb08c('0x3a')](db['CmHopperFinal']['rawAttributes']);_0x56b2d6[_0xb08c('0x39')]=_[_0xb08c('0x3a')](_0xa93de2[_0xb08c('0x39')]);_0x56b2d6['filters']=_['intersection'](_0x56b2d6[_0xb08c('0x3d')],_0x56b2d6['query']);_0xe4fa9e[_0xb08c('0x3e')]=_[_0xb08c('0x3c')](_0x56b2d6['model'],qs[_0xb08c('0x3f')](_0xa93de2['query'][_0xb08c('0x3f')]));_0xe4fa9e[_0xb08c('0x3e')]=_0xe4fa9e[_0xb08c('0x3e')][_0xb08c('0x40')]?_0xe4fa9e[_0xb08c('0x3e')]:_0x56b2d6[_0xb08c('0x3d')];if(!_0xa93de2[_0xb08c('0x39')][_0xb08c('0x41')](_0xb08c('0x42'))){_0xe4fa9e[_0xb08c('0x20')]=qs[_0xb08c('0x20')](_0xa93de2[_0xb08c('0x39')]['limit']);_0xe4fa9e[_0xb08c('0x22')]=qs[_0xb08c('0x22')](_0xa93de2[_0xb08c('0x39')]['offset']);}_0xe4fa9e[_0xb08c('0x43')]=qs['sort'](_0xa93de2[_0xb08c('0x39')][_0xb08c('0x60')]);_0xe4fa9e[_0xb08c('0x44')]=qs['filters'](_['pick'](_0xa93de2[_0xb08c('0x39')],_0x56b2d6['filters']));_0xe4fa9e[_0xb08c('0x44')][_0xb08c('0x67')]=_0x63cc5d['id'];if(_0xa93de2['query'][_0xb08c('0x2d')]){_0xe4fa9e[_0xb08c('0x44')]=_[_0xb08c('0x45')](_0xe4fa9e[_0xb08c('0x44')],{'$or':_[_0xb08c('0x2e')](_0xe4fa9e[_0xb08c('0x3e')],function(_0x3438d0){var _0x43751f={};_0x43751f[_0x3438d0]={'$like':'%'+_0xa93de2['query']['filter']+'%'};return _0x43751f;})});}_0xe4fa9e=_[_0xb08c('0x45')]({},_0xe4fa9e,_0xa93de2[_0xb08c('0x62')]);return db[_0xb08c('0x68')][_0xb08c('0x21')]({'where':_0xe4fa9e[_0xb08c('0x44')]})[_0xb08c('0x27')](function(_0x28d6a1){_0x35d0b6[_0xb08c('0x21')]=_0x28d6a1;if(_0xa93de2['query'][_0xb08c('0x47')]){_0xe4fa9e[_0xb08c('0x48')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb08c('0x49')](_0xe4fa9e);})[_0xb08c('0x27')](function(_0x12e4e0){_0x35d0b6['rows']=_0x12e4e0;return _0x35d0b6;});}})[_0xb08c('0x27')](respondWithFilteredResult(_0x40dd0f,_0xe4fa9e))[_0xb08c('0x4a')](handleError(_0x40dd0f,null));};exports['getHopperBlacks']=function(_0x54a36c,_0x1cef6f,_0x34a9f6){var _0x2eaa3a={'raw':!![],'where':{}};var _0x378906={};var _0x524cdd={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xb08c('0x5e')]({'where':{'id':_0x54a36c[_0xb08c('0x4c')]['id']}})[_0xb08c('0x27')](handleEntityNotFound(_0x1cef6f,null))['then'](function(_0x1a8cf9){if(_0x1a8cf9){_0x378906['model']=_[_0xb08c('0x3a')](db[_0xb08c('0x69')][_0xb08c('0x4d')]);_0x378906[_0xb08c('0x39')]=_[_0xb08c('0x3a')](_0x54a36c[_0xb08c('0x39')]);_0x378906[_0xb08c('0x3b')]=_['intersection'](_0x378906[_0xb08c('0x3d')],_0x378906[_0xb08c('0x39')]);_0x2eaa3a[_0xb08c('0x3e')]=_[_0xb08c('0x3c')](_0x378906['model'],qs[_0xb08c('0x3f')](_0x54a36c[_0xb08c('0x39')][_0xb08c('0x3f')]));_0x2eaa3a[_0xb08c('0x3e')]=_0x2eaa3a[_0xb08c('0x3e')][_0xb08c('0x40')]?_0x2eaa3a[_0xb08c('0x3e')]:_0x378906[_0xb08c('0x3d')];if(!_0x54a36c['query'][_0xb08c('0x41')](_0xb08c('0x42'))){_0x2eaa3a[_0xb08c('0x20')]=qs[_0xb08c('0x20')](_0x54a36c[_0xb08c('0x39')][_0xb08c('0x20')]);_0x2eaa3a[_0xb08c('0x22')]=qs[_0xb08c('0x22')](_0x54a36c[_0xb08c('0x39')]['offset']);}_0x2eaa3a[_0xb08c('0x43')]=qs[_0xb08c('0x60')](_0x54a36c['query'][_0xb08c('0x60')]);_0x2eaa3a[_0xb08c('0x44')]=qs[_0xb08c('0x3b')](_[_0xb08c('0x61')](_0x54a36c[_0xb08c('0x39')],_0x378906[_0xb08c('0x3b')]));_0x2eaa3a[_0xb08c('0x44')][_0xb08c('0x67')]=_0x1a8cf9['id'];if(_0x54a36c[_0xb08c('0x39')]['filter']){_0x2eaa3a[_0xb08c('0x44')]=_['merge'](_0x2eaa3a[_0xb08c('0x44')],{'$or':_['map'](_0x2eaa3a['attributes'],function(_0x172f6b){var _0x30db2e={};_0x30db2e[_0x172f6b]={'$like':'%'+_0x54a36c[_0xb08c('0x39')][_0xb08c('0x2d')]+'%'};return _0x30db2e;})});}_0x2eaa3a=_[_0xb08c('0x45')]({},_0x2eaa3a,_0x54a36c[_0xb08c('0x62')]);return db[_0xb08c('0x69')][_0xb08c('0x21')]({'where':_0x2eaa3a[_0xb08c('0x44')]})[_0xb08c('0x27')](function(_0x5cb2bb){_0x524cdd[_0xb08c('0x21')]=_0x5cb2bb;if(_0x54a36c[_0xb08c('0x39')][_0xb08c('0x47')]){_0x2eaa3a[_0xb08c('0x48')]=[{'all':!![]}];}return db[_0xb08c('0x69')][_0xb08c('0x49')](_0x2eaa3a);})[_0xb08c('0x27')](function(_0x2901f6){_0x524cdd[_0xb08c('0x63')]=_0x2901f6;return _0x524cdd;});}})[_0xb08c('0x27')](respondWithFilteredResult(_0x1cef6f,_0x2eaa3a))['catch'](handleError(_0x1cef6f,null));};exports[_0xb08c('0x6a')]=function(_0x20caf5,_0x35b01d,_0x30d1bf){var _0x4a201d={};var _0x138a32={};var _0x217c6b;var _0x15c071;return db['VoiceQueue'][_0xb08c('0x5e')]({'where':{'id':_0x20caf5[_0xb08c('0x4c')]['id']}})[_0xb08c('0x27')](handleEntityNotFound(_0x35b01d,null))[_0xb08c('0x27')](function(_0x5d39ef){if(_0x5d39ef){_0x217c6b=_0x5d39ef;_0x138a32['model']=_[_0xb08c('0x3a')](db[_0xb08c('0x6b')][_0xb08c('0x4d')]);_0x138a32[_0xb08c('0x39')]=_[_0xb08c('0x3a')](_0x20caf5[_0xb08c('0x39')]);_0x138a32[_0xb08c('0x3b')]=_[_0xb08c('0x3c')](_0x138a32[_0xb08c('0x3d')],_0x138a32[_0xb08c('0x39')]);_0x4a201d[_0xb08c('0x3e')]=_[_0xb08c('0x3c')](_0x138a32[_0xb08c('0x3d')],qs[_0xb08c('0x3f')](_0x20caf5[_0xb08c('0x39')][_0xb08c('0x3f')]));_0x4a201d[_0xb08c('0x3e')]=_0x4a201d[_0xb08c('0x3e')][_0xb08c('0x40')]?_0x4a201d['attributes']:_0x138a32['model'];_0x4a201d['order']=qs[_0xb08c('0x60')](_0x20caf5[_0xb08c('0x39')]['sort']);_0x4a201d[_0xb08c('0x44')]=qs[_0xb08c('0x3b')](_['pick'](_0x20caf5[_0xb08c('0x39')],_0x138a32[_0xb08c('0x3b')]));if(_0x20caf5[_0xb08c('0x39')][_0xb08c('0x2d')]){_0x4a201d[_0xb08c('0x44')]=_['merge'](_0x4a201d[_0xb08c('0x44')],{'$or':_[_0xb08c('0x2e')](_0x4a201d[_0xb08c('0x3e')],function(_0x5d7fa0){var _0xe8e20d={};_0xe8e20d[_0x5d7fa0]={'$like':'%'+_0x20caf5[_0xb08c('0x39')][_0xb08c('0x2d')]+'%'};return _0xe8e20d;})});}_0x4a201d=_[_0xb08c('0x45')]({},_0x4a201d,_0x20caf5[_0xb08c('0x62')]);return _0x217c6b[_0xb08c('0x6a')](_0x4a201d);}})[_0xb08c('0x27')](function(_0xdec19e){if(_0xdec19e){_0x15c071=_0xdec19e['length'];if(!_0x20caf5[_0xb08c('0x39')][_0xb08c('0x41')](_0xb08c('0x42'))){_0x4a201d['limit']=qs['limit'](_0x20caf5[_0xb08c('0x39')][_0xb08c('0x20')]);_0x4a201d[_0xb08c('0x22')]=qs[_0xb08c('0x22')](_0x20caf5[_0xb08c('0x39')][_0xb08c('0x22')]);}return _0x217c6b[_0xb08c('0x6a')](_0x4a201d);}})[_0xb08c('0x27')](function(_0x277aef){if(_0x277aef){return _0x277aef?{'count':_0x15c071,'rows':_0x277aef}:null;}})[_0xb08c('0x27')](respondWithResult(_0x35b01d,null))[_0xb08c('0x4a')](handleError(_0x35b01d,null));};exports[_0xb08c('0x6c')]=function(_0x27e84e,_0x4d9791,_0x31eb01){var _0xe523c9=_0x27e84e[_0xb08c('0x58')][_0xb08c('0x6d')];var _0x32d689=_['map'](_0xe523c9,'id');return db[_0xb08c('0x6b')][_0xb08c('0x49')]({'where':{'id':_0x32d689},'attributes':['id'],'include':[{'model':db[_0xb08c('0x6e')],'as':_0xb08c('0x6f'),'attributes':['id','name',_0xb08c('0x70'),_0xb08c('0x71'),_0xb08c('0x72')],'raw':!![]}]})[_0xb08c('0x27')](function(_0x36b55e){if(_0x36b55e){var _0x5a09fb=_[_0xb08c('0x73')](_0x36b55e,function(_0x409948){var _0x4547bd=_0x409948['get']({'plain':!![]});_0x4547bd[_0xb08c('0x6f')]['forEach'](function(_0x471a29){_0x471a29[_0xb08c('0x74')]=_[_0xb08c('0x30')](_0xe523c9,{'id':_0x4547bd['id']})[_0xb08c('0x74')];});return _0x4547bd[_0xb08c('0x6f')];});return db[_0xb08c('0x46')][_0xb08c('0x30')]({'where':{'id':_0x27e84e[_0xb08c('0x4c')]['id']}})[_0xb08c('0x27')](function(_0x43b3e3){return db['sequelize'][_0xb08c('0x75')](function(_0x2c4e28){return _0x43b3e3[_0xb08c('0x6c')](_0x32d689,{'transaction':_0x2c4e28})['then'](function(){return BPromise[_0xb08c('0x76')](_0xe523c9,function(_0x3cec89){return db['TeamVoiceQueue'][_0xb08c('0x77')]({'TeamId':_0x3cec89['id'],'VoiceQueueId':_0x27e84e[_0xb08c('0x4c')]['id'],'penalty':_0x3cec89[_0xb08c('0x74')]},{'transaction':_0x2c4e28});});})[_0xb08c('0x27')](function(){return BPromise['each'](_0x5a09fb,function(_0x10d471){return db[_0xb08c('0x78')][_0xb08c('0x79')]({'where':{'UserId':_0x10d471['id'],'VoiceQueueId':_0x27e84e[_0xb08c('0x4c')]['id']},'defaults':{'penalty':_0x10d471[_0xb08c('0x74')]},'transaction':_0x2c4e28});});})[_0xb08c('0x27')](function(){return BPromise['each'](_['filter'](_0x5a09fb,{'online':!![]}),function(_0x7c92b1){return db[_0xb08c('0x7a')][_0xb08c('0x77')]({'membername':_0x7c92b1[_0xb08c('0x32')],'UserId':_0x7c92b1['id'],'queue_name':_0x43b3e3[_0xb08c('0x32')],'VoiceQueueId':_0x43b3e3['id'],'interface':_[_0xb08c('0x7b')](_0x7c92b1[_0xb08c('0x72')])?util[_0xb08c('0x7c')](_0xb08c('0x7d'),_0x7c92b1['name']):_0x7c92b1[_0xb08c('0x72')],'paused':_0x7c92b1['voicePause']||![],'penalty':_0x7c92b1[_0xb08c('0x74')]},{'transaction':_0x2c4e28});});})['then'](function(){_0x5a09fb[_0xb08c('0x7e')](function(_0x256af3){socket[_0xb08c('0x7f')]('userVoiceQueue:save',{'UserId':_0x256af3['id'],'VoiceQueueId':_0x43b3e3['id']});});});});});}})[_0xb08c('0x27')](respondWithStatusCode(_0x4d9791,null))['catch'](handleError(_0x4d9791,null));};exports[_0xb08c('0x80')]=function(_0x3203e9,_0x585ae5,_0x369601){return db[_0xb08c('0x6b')][_0xb08c('0x49')]({'where':{'id':_0x3203e9['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xb08c('0x6e')],'as':_0xb08c('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x585ae5,null))[_0xb08c('0x27')](function(_0x6e1557){var _0x8f97df=_['map'](_0x6e1557,'id');var _0x4d44a0=[];var _0x47844e=[];var _0x37da29=squel[_0xb08c('0x81')]();_0x37da29[_0xb08c('0x82')]('tq.TeamId')['from'](_0xb08c('0x83'),'tq')[_0xb08c('0x84')]('user_has_teams','ut',_0xb08c('0x85'))[_0xb08c('0x44')](_0xb08c('0x86'),_0x3203e9[_0xb08c('0x4c')]['id']);for(var _0x16ac9a=0x0;_0x16ac9a<_0x6e1557[_0xb08c('0x40')];_0x16ac9a+=0x1){let _0x2abba1=_0x6e1557[_0x16ac9a];for(var _0x4c52e9=0x0;_0x4c52e9<_0x2abba1[_0xb08c('0x6f')]['length'];_0x4c52e9+=0x1){let _0x21dd09=_0x2abba1[_0xb08c('0x6f')][_0x4c52e9];var _0x6e3fbf=_0x37da29[_0xb08c('0x55')]();_0x6e3fbf['where'](_0xb08c('0x87'),_0x21dd09['id']);_0x47844e['push'](db[_0xb08c('0x88')][_0xb08c('0x39')](_0x6e3fbf['toString'](),{'type':db[_0xb08c('0x88')]['QueryTypes'][_0xb08c('0x89')]})[_0xb08c('0x27')](function(_0x372ef0){if(_0x372ef0[_0xb08c('0x40')]===0x1){return _0x21dd09['id'];}else{var _0x3a410f=_[_0xb08c('0x8a')](_['map'](_0x372ef0,_0xb08c('0x8b')),function(_0x2a5d56){return _[_0xb08c('0x8c')](_0x8f97df,_0x2a5d56);});if(_0x3a410f){return _0x21dd09['id'];}}}));}}return BPromise[_0xb08c('0x8d')](_0x47844e)[_0xb08c('0x27')](function(_0x43f5c0){_0x4d44a0=_(_0x4d44a0)[_0xb08c('0x8e')](_0x43f5c0)[_0xb08c('0x8f')]()[_0xb08c('0x2f')]();return db[_0xb08c('0x46')][_0xb08c('0x30')]({'where':{'id':_0x3203e9[_0xb08c('0x4c')]['id']}})[_0xb08c('0x27')](function(_0x123d63){return db[_0xb08c('0x88')][_0xb08c('0x75')](function(_0x118baf){return _0x123d63[_0xb08c('0x80')](_0x3203e9[_0xb08c('0x39')][_0xb08c('0x90')],{'transaction':_0x118baf})[_0xb08c('0x27')](function(){if(!_[_0xb08c('0x91')](_0x4d44a0)){return _0x123d63[_0xb08c('0x92')](_0x4d44a0,{'transaction':_0x118baf})[_0xb08c('0x27')](function(){return db[_0xb08c('0x7a')][_0xb08c('0x28')]({'where':{'VoiceQueueId':_0x3203e9[_0xb08c('0x4c')]['id'],'UserId':_0x4d44a0},'transaction':_0x118baf});});}})[_0xb08c('0x27')](function(){_0x4d44a0[_0xb08c('0x7e')](function(_0x1aa854){socket[_0xb08c('0x7f')](_0xb08c('0x93'),{'UserId':_0x1aa854,'VoiceQueueId':_0x123d63['id']});});});});});});})[_0xb08c('0x27')](respondWithStatusCode(_0x585ae5,null))['catch'](handleError(_0x585ae5,null));};exports['addAgents']=function(_0x4fefed,_0x1a5164,_0x4bdb69){var _0x9fc668,_0x4f51ab;return db[_0xb08c('0x46')][_0xb08c('0x30')]({'where':{'id':_0x4fefed[_0xb08c('0x4c')]['id']}})[_0xb08c('0x27')](handleEntityNotFound(_0x1a5164,null))[_0xb08c('0x27')](function(_0x47a1ee){if(_0x47a1ee){_0x4f51ab=_0x47a1ee;return _0x47a1ee[_0xb08c('0x94')](_0x4fefed['body'][_0xb08c('0x90')],_['omit'](_0x4fefed[_0xb08c('0x58')],[_0xb08c('0x90'),'id'])||{})[_0xb08c('0x95')](function(_0x23ae79){for(var _0x332b72=0x0;_0x332b72<_0x4fefed[_0xb08c('0x58')]['ids'][_0xb08c('0x40')];_0x332b72+=0x1){socket['emit'](_0xb08c('0x96'),{'UserId':Number(_0x4fefed['body']['ids'][_0x332b72]),'VoiceQueueId':Number(_0x4fefed[_0xb08c('0x4c')]['id'])});}return _0x23ae79;});}})['then'](function(_0x302790){_0x9fc668=_0x302790||[];if(_0x4f51ab){return db[_0xb08c('0x6e')][_0xb08c('0x49')]({'where':{'id':_0x4fefed['body'][_0xb08c('0x90')]},'attributes':['id','name',_0xb08c('0x70'),_0xb08c('0x71'),'interface'],'raw':!![]});}})['then'](function(_0x2d4358){if(!_[_0xb08c('0x91')](_0x2d4358)){var _0x46064d=[];for(var _0x2c7540=0x0;_0x2c7540<_0x2d4358[_0xb08c('0x40')];_0x2c7540++){if(_0x2d4358[_0x2c7540][_0xb08c('0x70')]){_0x46064d[_0xb08c('0x97')](db[_0xb08c('0x7a')][_0xb08c('0x77')]({'membername':_0x2d4358[_0x2c7540][_0xb08c('0x32')],'UserId':_0x2d4358[_0x2c7540]['id'],'queue_name':_0x4f51ab[_0xb08c('0x32')],'VoiceQueueId':_0x4f51ab['id'],'interface':_['isNil'](_0x2d4358[_0x2c7540][_0xb08c('0x72')])?util[_0xb08c('0x7c')](_0xb08c('0x7d'),_0x2d4358[_0x2c7540][_0xb08c('0x32')]):_0x2d4358[_0x2c7540][_0xb08c('0x72')],'paused':_0x2d4358[_0x2c7540][_0xb08c('0x71')]||![],'penalty':_0x4fefed[_0xb08c('0x58')][_0xb08c('0x74')]||0x0}));}}return BPromise[_0xb08c('0x8d')](_0x46064d);}})[_0xb08c('0x27')](function(){return _0x9fc668;})[_0xb08c('0x27')](respondWithResult(_0x1a5164,null))['catch'](handleError(_0x1a5164,null));};exports[_0xb08c('0x92')]=function(_0x108505,_0x362f61,_0xd31dd8){return db['VoiceQueue']['find']({'where':{'id':_0x108505[_0xb08c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x362f61,null))[_0xb08c('0x27')](function(_0x1fb6f5){if(_0x1fb6f5){return _0x1fb6f5['removeAgents'](_0x108505[_0xb08c('0x39')][_0xb08c('0x90')])[_0xb08c('0x27')](function(){if(_[_0xb08c('0x98')](_0x108505[_0xb08c('0x39')][_0xb08c('0x90')])){for(var _0x2b6b69=0x0;_0x2b6b69<_0x108505['query'][_0xb08c('0x90')][_0xb08c('0x40')];_0x2b6b69+=0x1){socket['emit'](_0xb08c('0x93'),{'UserId':Number(_0x108505[_0xb08c('0x39')][_0xb08c('0x90')][_0x2b6b69]),'VoiceQueueId':Number(_0x108505['params']['id'])});}}else{socket[_0xb08c('0x7f')](_0xb08c('0x93'),{'UserId':Number(_0x108505[_0xb08c('0x39')][_0xb08c('0x90')]),'VoiceQueueId':Number(_0x108505[_0xb08c('0x4c')]['id'])});}});}})['then'](function(_0x5e57c6){return db[_0xb08c('0x7a')][_0xb08c('0x28')]({'where':{'VoiceQueueId':_0x108505[_0xb08c('0x4c')]['id'],'UserId':_0x108505['query'][_0xb08c('0x90')]}})[_0xb08c('0x27')](function(){return _0x5e57c6;});})[_0xb08c('0x27')](respondWithStatusCode(_0x362f61,null))['catch'](handleError(_0x362f61,null));};exports[_0xb08c('0x99')]=function(_0x3c58fd,_0x52bd71,_0x551179){var _0x288500={};var _0x587ac4={};var _0x2e032f;var _0x3619e2;return db['VoiceQueue'][_0xb08c('0x5e')]({'where':{'id':_0x3c58fd['params']['id']}})[_0xb08c('0x27')](handleEntityNotFound(_0x52bd71,null))[_0xb08c('0x27')](function(_0x281ecc){if(_0x281ecc){_0x2e032f=_0x281ecc;_0x587ac4['model']=_['keys'](db[_0xb08c('0x6e')][_0xb08c('0x4d')]);_0x587ac4['query']=_[_0xb08c('0x3a')](_0x3c58fd[_0xb08c('0x39')]);_0x587ac4[_0xb08c('0x3b')]=_[_0xb08c('0x3c')](_0x587ac4[_0xb08c('0x3d')],_0x587ac4[_0xb08c('0x39')]);_0x288500[_0xb08c('0x3e')]=_[_0xb08c('0x3c')](_0x587ac4[_0xb08c('0x3d')],qs[_0xb08c('0x3f')](_0x3c58fd[_0xb08c('0x39')][_0xb08c('0x3f')]));_0x288500['attributes']=_0x288500['attributes'][_0xb08c('0x40')]?_0x288500['attributes']:_0x587ac4[_0xb08c('0x3d')];_0x288500[_0xb08c('0x43')]=qs['sort'](_0x3c58fd[_0xb08c('0x39')][_0xb08c('0x60')]);_0x288500[_0xb08c('0x44')]=qs[_0xb08c('0x3b')](_[_0xb08c('0x61')](_0x3c58fd['query'],_0x587ac4[_0xb08c('0x3b')]));if(_0x3c58fd[_0xb08c('0x39')]['filter']){_0x288500['where']=_[_0xb08c('0x45')](_0x288500[_0xb08c('0x44')],{'$or':_['map'](_0x288500['attributes'],function(_0x3d9c4b){var _0x5aa7b1={};_0x5aa7b1[_0x3d9c4b]={'$like':'%'+_0x3c58fd[_0xb08c('0x39')][_0xb08c('0x2d')]+'%'};return _0x5aa7b1;})});}_0x288500=_['merge']({},_0x288500,_0x3c58fd[_0xb08c('0x62')]);return _0x2e032f[_0xb08c('0x99')](_0x288500);}})[_0xb08c('0x27')](function(_0x3d8006){if(_0x3d8006){_0x3619e2=_0x3d8006[_0xb08c('0x40')];if(!_0x3c58fd[_0xb08c('0x39')][_0xb08c('0x41')](_0xb08c('0x42'))){_0x288500['limit']=qs['limit'](_0x3c58fd[_0xb08c('0x39')][_0xb08c('0x20')]);_0x288500[_0xb08c('0x22')]=qs[_0xb08c('0x22')](_0x3c58fd[_0xb08c('0x39')][_0xb08c('0x22')]);}return _0x2e032f[_0xb08c('0x99')](_0x288500);}})[_0xb08c('0x27')](function(_0x7cd24d){if(_0x7cd24d){return _0x7cd24d?{'count':_0x3619e2,'rows':_0x7cd24d}:null;}})[_0xb08c('0x27')](respondWithResult(_0x52bd71,null))[_0xb08c('0x4a')](handleError(_0x52bd71,null));};exports[_0xb08c('0x9a')]=function(_0x5f308e,_0x4e4eaa,_0x14643a){var _0xbcb53c={};var _0x5990df={};var _0x50a0d4;var _0x3e2924;return db[_0xb08c('0x46')][_0xb08c('0x5e')]({'where':{'id':_0x5f308e[_0xb08c('0x4c')]['id']}})[_0xb08c('0x27')](handleEntityNotFound(_0x4e4eaa,null))[_0xb08c('0x27')](function(_0x40cc77){if(_0x40cc77){_0x50a0d4=_0x40cc77;_0x5990df[_0xb08c('0x3d')]=_[_0xb08c('0x3a')](db[_0xb08c('0x7a')][_0xb08c('0x4d')]);_0x5990df[_0xb08c('0x39')]=_[_0xb08c('0x3a')](_0x5f308e[_0xb08c('0x39')]);_0x5990df[_0xb08c('0x3b')]=_[_0xb08c('0x3c')](_0x5990df['model'],_0x5990df[_0xb08c('0x39')]);_0xbcb53c[_0xb08c('0x3e')]=_[_0xb08c('0x3c')](_0x5990df[_0xb08c('0x3d')],qs[_0xb08c('0x3f')](_0x5f308e[_0xb08c('0x39')]['fields']));_0xbcb53c[_0xb08c('0x3e')]=_0xbcb53c[_0xb08c('0x3e')]['length']?_0xbcb53c[_0xb08c('0x3e')]:_0x5990df[_0xb08c('0x3d')];_0xbcb53c[_0xb08c('0x43')]=qs['sort'](_0x5f308e[_0xb08c('0x39')]['sort']);_0xbcb53c[_0xb08c('0x44')]=qs[_0xb08c('0x3b')](_[_0xb08c('0x61')](_0x5f308e['query'],_0x5990df[_0xb08c('0x3b')]));if(_0x5f308e[_0xb08c('0x39')][_0xb08c('0x2d')]){_0xbcb53c['where']=_['merge'](_0xbcb53c[_0xb08c('0x44')],{'$or':_[_0xb08c('0x2e')](_0xbcb53c[_0xb08c('0x3e')],function(_0x3856b2){var _0x230f50={};_0x230f50[_0x3856b2]={'$like':'%'+_0x5f308e[_0xb08c('0x39')]['filter']+'%'};return _0x230f50;})});}_0xbcb53c=_[_0xb08c('0x45')]({},_0xbcb53c,_0x5f308e[_0xb08c('0x62')]);return _0x50a0d4[_0xb08c('0x9a')](_0xbcb53c);}})[_0xb08c('0x27')](function(_0x367531){if(_0x367531){_0x3e2924=_0x367531[_0xb08c('0x40')];if(!_0x5f308e['query']['hasOwnProperty']('nolimit')){_0xbcb53c['limit']=qs[_0xb08c('0x20')](_0x5f308e[_0xb08c('0x39')]['limit']);_0xbcb53c[_0xb08c('0x22')]=qs['offset'](_0x5f308e['query']['offset']);}return _0x50a0d4[_0xb08c('0x9a')](_0xbcb53c);}})['then'](function(_0x36a943){return _0x36a943?{'count':_0x3e2924,'rows':_0x36a943}:null;})[_0xb08c('0x27')](respondWithResult(_0x4e4eaa,null))['catch'](handleError(_0x4e4eaa,null));};exports[_0xb08c('0x9b')]=function(_0x1e9e28,_0x11ed44,_0x2a2113){var _0x5298a2={};var _0x51cd8b={};var _0x2e6e8e;var _0x4e2b70;return db[_0xb08c('0x46')][_0xb08c('0x5e')]({'where':{'id':_0x1e9e28['params']['id']}})['then'](handleEntityNotFound(_0x11ed44,null))[_0xb08c('0x27')](function(_0x404744){if(_0x404744){_0x2e6e8e=_0x404744;_0x51cd8b[_0xb08c('0x3d')]=_[_0xb08c('0x3a')](db[_0xb08c('0x9c')][_0xb08c('0x4d')]);_0x51cd8b['query']=_['keys'](_0x1e9e28[_0xb08c('0x39')]);_0x51cd8b[_0xb08c('0x3b')]=_[_0xb08c('0x3c')](_0x51cd8b[_0xb08c('0x3d')],_0x51cd8b['query']);_0x5298a2['attributes']=_[_0xb08c('0x3c')](_0x51cd8b[_0xb08c('0x3d')],qs[_0xb08c('0x3f')](_0x1e9e28['query'][_0xb08c('0x3f')]));_0x5298a2[_0xb08c('0x3e')]=_0x5298a2[_0xb08c('0x3e')][_0xb08c('0x40')]?_0x5298a2[_0xb08c('0x3e')]:_0x51cd8b[_0xb08c('0x3d')];_0x5298a2[_0xb08c('0x43')]=qs[_0xb08c('0x60')](_0x1e9e28[_0xb08c('0x39')][_0xb08c('0x60')]);_0x5298a2[_0xb08c('0x44')]=qs[_0xb08c('0x3b')](_[_0xb08c('0x61')](_0x1e9e28['query'],_0x51cd8b['filters']));if(_0x1e9e28[_0xb08c('0x39')]['filter']){_0x5298a2[_0xb08c('0x44')]=_[_0xb08c('0x45')](_0x5298a2[_0xb08c('0x44')],{'$or':_['map'](_0x5298a2[_0xb08c('0x3e')],function(_0x3f8917){var _0x392731={};_0x392731[_0x3f8917]={'$like':'%'+_0x1e9e28['query'][_0xb08c('0x2d')]+'%'};return _0x392731;})});}_0x5298a2=_[_0xb08c('0x45')]({},_0x5298a2,_0x1e9e28[_0xb08c('0x62')]);return _0x2e6e8e[_0xb08c('0x9b')](_0x5298a2);}})[_0xb08c('0x27')](function(_0x223c7b){if(_0x223c7b){_0x4e2b70=_0x223c7b['length'];if(!_0x1e9e28[_0xb08c('0x39')][_0xb08c('0x41')](_0xb08c('0x42'))){_0x5298a2[_0xb08c('0x20')]=qs[_0xb08c('0x20')](_0x1e9e28[_0xb08c('0x39')]['limit']);_0x5298a2[_0xb08c('0x22')]=qs[_0xb08c('0x22')](_0x1e9e28[_0xb08c('0x39')][_0xb08c('0x22')]);}return _0x2e6e8e[_0xb08c('0x9b')](_0x5298a2);}})[_0xb08c('0x27')](function(_0x54501c){if(_0x54501c){return _0x54501c?{'count':_0x4e2b70,'rows':_0x54501c}:null;}})[_0xb08c('0x27')](respondWithResult(_0x11ed44,null))['catch'](handleError(_0x11ed44,null));};exports[_0xb08c('0x9d')]=function(_0x175c0f,_0x4ff7b3,_0x1a0934){var _0x27d917,_0x237900;return db[_0xb08c('0x46')][_0xb08c('0x30')]({'where':{'id':_0x175c0f[_0xb08c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4ff7b3,null))['then'](function(_0x2dd781){if(_0x2dd781){_0x237900=_0x2dd781;return _0x2dd781[_0xb08c('0x9d')](_0x175c0f[_0xb08c('0x58')][_0xb08c('0x90')],_[_0xb08c('0x56')](_0x175c0f[_0xb08c('0x58')],[_0xb08c('0x90'),'id'])||{});}return null;})[_0xb08c('0x95')](function(_0x232fff){var _0x209808;_0x27d917=_0x232fff||[];var _0x4d6411=[];if(_0x232fff){for(var _0x375d7f=0x0;_0x375d7f<_0x232fff[_0xb08c('0x40')];_0x375d7f+=0x1){var _0xbf3482=_0x232fff[_0x375d7f][_0xb08c('0x29')]({'plain':!![]});_0x237900[_0xb08c('0x9e')]=_0x175c0f[_0xb08c('0x58')][_0xb08c('0x9e')]?_0x175c0f[_0xb08c('0x58')][_0xb08c('0x9e')]:_0x237900[_0xb08c('0x9e')];switch(_0x237900[_0xb08c('0x9e')]){case _0xb08c('0x9f'):_0x209808=squel[_0xb08c('0xa0')]()[_0xb08c('0xa1')]('cm_hopper')[_0xb08c('0xa2')](['phone','scheduledAt',_0xb08c('0xa3'),'ListId',_0xb08c('0x67'),'createdAt','updatedAt'],squel[_0xb08c('0x81')]()[_0xb08c('0x82')](_0xb08c('0xa4'),_0xb08c('0xa4'))[_0xb08c('0x82')](_0xb08c('0xa5'),_0xb08c('0xa6'))[_0xb08c('0x82')]('id',_0xb08c('0xa3'))[_0xb08c('0x82')](_0xbf3482[_0xb08c('0xa7')][_0xb08c('0xa8')](),_0xb08c('0xa9'))[_0xb08c('0x82')](_0x175c0f['params']['id'][_0xb08c('0xa8')](),_0xb08c('0x67'))[_0xb08c('0x82')](_0xb08c('0xa5'),_0xb08c('0x59'))[_0xb08c('0x82')](_0xb08c('0xa5'),'updatedAt')[_0xb08c('0xaa')]('cm_contacts')['where'](_0xb08c('0xab'))[_0xb08c('0x44')]('ListId\x20=\x20?',_0xbf3482[_0xb08c('0xa7')][_0xb08c('0xa8')]())[_0xb08c('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0xb08c('0x44')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xb08c('0x82')]('COALESCE(calleridnum,\x27\x27)')[_0xb08c('0xaa')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x175c0f[_0xb08c('0x4c')]['id'][_0xb08c('0xa8')]()))[_0xb08c('0x44')](_0xb08c('0xac'),squel[_0xb08c('0x81')]()[_0xb08c('0x82')](_0xb08c('0xad'))['from'](_0xb08c('0xae'))[_0xb08c('0x44')](_0xb08c('0x86'),_0x175c0f[_0xb08c('0x4c')]['id'][_0xb08c('0xa8')]())))[_0xb08c('0xa8')]();break;case'onlyIfOpen':_0x209808=squel[_0xb08c('0xa0')]()[_0xb08c('0xa1')](_0xb08c('0xae'))[_0xb08c('0xa2')]([_0xb08c('0xa4'),'scheduledAt',_0xb08c('0xa3'),'ListId',_0xb08c('0x67'),_0xb08c('0x59'),_0xb08c('0x57')],squel['select']()[_0xb08c('0x82')](_0xb08c('0xa4'),_0xb08c('0xa4'))[_0xb08c('0x82')]('NOW()',_0xb08c('0xa6'))['field']('id',_0xb08c('0xa3'))[_0xb08c('0x82')](_0xbf3482[_0xb08c('0xa7')]['toString'](),_0xb08c('0xa9'))[_0xb08c('0x82')](_0x175c0f[_0xb08c('0x4c')]['id']['toString'](),_0xb08c('0x67'))[_0xb08c('0x82')]('NOW()','createdAt')[_0xb08c('0x82')](_0xb08c('0xa5'),_0xb08c('0x57'))[_0xb08c('0xaa')](_0xb08c('0xaf'))[_0xb08c('0x44')](_0xb08c('0xab'))[_0xb08c('0x44')](_0xb08c('0xb0'),_0xbf3482['CmListId'][_0xb08c('0xa8')]())[_0xb08c('0x44')](_0xb08c('0xb1'))[_0xb08c('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb08c('0x81')]()[_0xb08c('0x82')](_0xb08c('0xad'))['from'](_0xb08c('0xae'))[_0xb08c('0x44')](_0xb08c('0x86'),_0x175c0f['params']['id'][_0xb08c('0xa8')]())))[_0xb08c('0xa8')]();break;default:_0x209808=squel[_0xb08c('0xa0')]()[_0xb08c('0xa1')](_0xb08c('0xae'))[_0xb08c('0xa2')]([_0xb08c('0xa4'),_0xb08c('0xa6'),_0xb08c('0xa3'),_0xb08c('0xa9'),_0xb08c('0x67'),_0xb08c('0x59'),_0xb08c('0x57')],squel['select']()[_0xb08c('0x82')](_0xb08c('0xa4'),_0xb08c('0xa4'))['field'](_0xb08c('0xa5'),'scheduledAt')[_0xb08c('0x82')]('id','ContactId')[_0xb08c('0x82')](_0xbf3482[_0xb08c('0xa7')][_0xb08c('0xa8')](),'ListId')['field'](_0x175c0f[_0xb08c('0x4c')]['id'][_0xb08c('0xa8')](),_0xb08c('0x67'))[_0xb08c('0x82')]('NOW()',_0xb08c('0x59'))[_0xb08c('0x82')](_0xb08c('0xa5'),'updatedAt')[_0xb08c('0xaa')](_0xb08c('0xaf'))[_0xb08c('0x44')](_0xb08c('0xab'))[_0xb08c('0x44')](_0xb08c('0xb0'),_0xbf3482['CmListId'][_0xb08c('0xa8')]())[_0xb08c('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0xb08c('0xa8')]();}_0x4d6411[_0xb08c('0x97')](db['sequelize']['query'](_0x209808));}return BPromise[_0xb08c('0x8d')](_0x4d6411);}})[_0xb08c('0x27')](function(){return _0x27d917;})[_0xb08c('0x27')](respondWithResult(_0x4ff7b3,null))[_0xb08c('0x4a')](handleError(_0x4ff7b3,null));};exports[_0xb08c('0xb2')]=function(_0x3b4bd3,_0x55103b,_0x419887){return db['VoiceQueue'][_0xb08c('0x30')]({'where':{'id':_0x3b4bd3['params']['id']}})['then'](handleEntityNotFound(_0x55103b,null))[_0xb08c('0x27')](function(_0x88ccae){if(_0x88ccae){return _0x88ccae[_0xb08c('0xb2')](_0x3b4bd3['query']['ids']);}})[_0xb08c('0x27')](function(_0x5794ad){if(_0x5794ad){return db[_0xb08c('0x5f')][_0xb08c('0x28')]({'where':{'ListId':_0x3b4bd3[_0xb08c('0x39')]['ids'],'VoiceQueueId':_0x3b4bd3[_0xb08c('0x4c')]['id']}})['then'](function(){return _0x5794ad;});}})['then'](respondWithStatusCode(_0x55103b,null))[_0xb08c('0x4a')](handleError(_0x55103b,null));};exports[_0xb08c('0xb3')]=function(_0x2a8a98,_0x421a75,_0x1b7924){var _0x2660b7={};var _0x43f190={};var _0x23e02;var _0x47aa8b;return db['VoiceQueue'][_0xb08c('0x5e')]({'where':{'id':_0x2a8a98[_0xb08c('0x4c')]['id']}})[_0xb08c('0x27')](handleEntityNotFound(_0x421a75,null))[_0xb08c('0x27')](function(_0x11dd2c){if(_0x11dd2c){_0x23e02=_0x11dd2c;_0x43f190[_0xb08c('0x3d')]=_['keys'](db['CmList'][_0xb08c('0x4d')]);_0x43f190[_0xb08c('0x39')]=_[_0xb08c('0x3a')](_0x2a8a98[_0xb08c('0x39')]);_0x43f190['filters']=_['intersection'](_0x43f190['model'],_0x43f190[_0xb08c('0x39')]);_0x2660b7['attributes']=_[_0xb08c('0x3c')](_0x43f190[_0xb08c('0x3d')],qs['fields'](_0x2a8a98[_0xb08c('0x39')][_0xb08c('0x3f')]));_0x2660b7[_0xb08c('0x3e')]=_0x2660b7['attributes'][_0xb08c('0x40')]?_0x2660b7[_0xb08c('0x3e')]:_0x43f190[_0xb08c('0x3d')];_0x2660b7[_0xb08c('0x43')]=qs[_0xb08c('0x60')](_0x2a8a98[_0xb08c('0x39')]['sort']);_0x2660b7[_0xb08c('0x44')]=qs[_0xb08c('0x3b')](_[_0xb08c('0x61')](_0x2a8a98[_0xb08c('0x39')],_0x43f190[_0xb08c('0x3b')]));if(_0x2a8a98['query'][_0xb08c('0x2d')]){_0x2660b7[_0xb08c('0x44')]=_[_0xb08c('0x45')](_0x2660b7[_0xb08c('0x44')],{'$or':_[_0xb08c('0x2e')](_0x2660b7[_0xb08c('0x3e')],function(_0x50f33a){var _0xfbd9f1={};_0xfbd9f1[_0x50f33a]={'$like':'%'+_0x2a8a98['query'][_0xb08c('0x2d')]+'%'};return _0xfbd9f1;})});}_0x2660b7=_[_0xb08c('0x45')]({},_0x2660b7,_0x2a8a98['options']);return _0x23e02[_0xb08c('0xb3')](_0x2660b7);}})['then'](function(_0x397af2){if(_0x397af2){_0x47aa8b=_0x397af2[_0xb08c('0x40')];if(!_0x2a8a98['query'][_0xb08c('0x41')]('nolimit')){_0x2660b7[_0xb08c('0x20')]=qs[_0xb08c('0x20')](_0x2a8a98[_0xb08c('0x39')][_0xb08c('0x20')]);_0x2660b7[_0xb08c('0x22')]=qs[_0xb08c('0x22')](_0x2a8a98[_0xb08c('0x39')][_0xb08c('0x22')]);}return _0x23e02[_0xb08c('0xb3')](_0x2660b7);}})[_0xb08c('0x27')](function(_0x3fd7e3){if(_0x3fd7e3){return _0x3fd7e3?{'count':_0x47aa8b,'rows':_0x3fd7e3}:null;}})[_0xb08c('0x27')](respondWithResult(_0x421a75,null))['catch'](handleError(_0x421a75,null));};exports[_0xb08c('0xb4')]=function(_0x5ef1fa,_0x16aa65,_0x209e15){var _0x34edbf,_0x484f19;return db[_0xb08c('0x46')][_0xb08c('0x30')]({'where':{'id':_0x5ef1fa[_0xb08c('0x4c')]['id']}})[_0xb08c('0x27')](handleEntityNotFound(_0x16aa65,null))[_0xb08c('0x27')](function(_0x7408e8){if(_0x7408e8){_0x484f19=_0x7408e8;return _0x7408e8[_0xb08c('0xb4')](_0x5ef1fa[_0xb08c('0x58')][_0xb08c('0x90')],_[_0xb08c('0x56')](_0x5ef1fa[_0xb08c('0x58')],[_0xb08c('0x90'),'id'])||{});}return null;})[_0xb08c('0x95')](function(_0x4cb109){var _0x483224;_0x34edbf=_0x4cb109||[];var _0x5474d6=[];if(_0x4cb109){for(var _0x8a229a=0x0;_0x8a229a<_0x4cb109[_0xb08c('0x40')];_0x8a229a+=0x1){var _0x2d9e68=_0x4cb109[_0x8a229a][_0xb08c('0x29')]({'plain':!![]});_0x483224=squel[_0xb08c('0xa0')]()[_0xb08c('0xa1')](_0xb08c('0xb5'))[_0xb08c('0xa2')]([_0xb08c('0xa4'),_0xb08c('0xa3'),'ListId','VoiceQueueId',_0xb08c('0x59'),_0xb08c('0x57')],squel[_0xb08c('0x81')]()['field'](_0xb08c('0xa4'),_0xb08c('0xa4'))[_0xb08c('0x82')]('id','ContactId')[_0xb08c('0x82')](_0x2d9e68[_0xb08c('0xa7')]['toString'](),'ListId')['field'](_0x5ef1fa[_0xb08c('0x4c')]['id']['toString'](),'VoiceQueueId')[_0xb08c('0x82')](_0xb08c('0xa5'),_0xb08c('0x59'))[_0xb08c('0x82')](_0xb08c('0xa5'),_0xb08c('0x57'))['from'](_0xb08c('0xaf'))[_0xb08c('0x44')]('deletedAt\x20IS\x20NULL')[_0xb08c('0x44')](_0xb08c('0xb0'),_0x2d9e68[_0xb08c('0xa7')][_0xb08c('0xa8')]())['where'](_0xb08c('0xb1')))[_0xb08c('0xa8')]();_0x5474d6['push'](db[_0xb08c('0x88')][_0xb08c('0x39')](_0x483224));}return BPromise[_0xb08c('0x8d')](_0x5474d6);}})[_0xb08c('0x27')](function(){return _0x34edbf;})[_0xb08c('0x27')](respondWithResult(_0x16aa65,null))[_0xb08c('0x4a')](handleError(_0x16aa65,null));};exports[_0xb08c('0xb6')]=function(_0x558ec6,_0x2e92d9,_0x5abeae){return db['VoiceQueue']['find']({'where':{'id':_0x558ec6[_0xb08c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2e92d9,null))[_0xb08c('0x27')](function(_0xdffeae){if(_0xdffeae){return _0xdffeae['removeBlackLists'](_0x558ec6[_0xb08c('0x39')][_0xb08c('0x90')]);}})[_0xb08c('0x27')](function(_0x534975){if(_0x534975){return db[_0xb08c('0x69')][_0xb08c('0x28')]({'where':{'ListId':_0x558ec6['query']['ids'],'VoiceQueueId':_0x558ec6[_0xb08c('0x4c')]['id']}})[_0xb08c('0x27')](function(){return _0x534975;});}})[_0xb08c('0x27')](respondWithStatusCode(_0x2e92d9,null))[_0xb08c('0x4a')](handleError(_0x2e92d9,null));}; \ No newline at end of file +var _0x9be4=['ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','all','union','compact','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','emit','userVoiceQueue:save','push','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','cm_contacts','removeLists','getBlackLists','addBlackLists','cm_hopper_black','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','outbound','filter','ignore','map','value','includes','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','keys','omit','createdAt','body','updatedAt','autoAssociation','params','getHoppers','findOne','CmHopper','hasOwnProperty','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','isNil','format','SIP/%s','voicePause','removeTeams','ids','select','field','from','team_has_voice_queues','user_has_teams'];(function(_0x2f2f70,_0x4d0a75){var _0x4c1c88=function(_0x3de1cb){while(--_0x3de1cb){_0x2f2f70['push'](_0x2f2f70['shift']());}};_0x4c1c88(++_0x4d0a75);}(_0x9be4,0xee));var _0x49be=function(_0x2c892e,_0x28332e){_0x2c892e=_0x2c892e-0x0;var _0x1bb02c=_0x9be4[_0x2c892e];return _0x1bb02c;};'use strict';var emlformat=require(_0x49be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x49be('0x1'));var jsonpatch=require(_0x49be('0x2'));var rp=require('request-promise');var moment=require(_0x49be('0x3'));var BPromise=require(_0x49be('0x4'));var Mustache=require(_0x49be('0x5'));var util=require('util');var path=require(_0x49be('0x6'));var sox=require(_0x49be('0x7'));var csv=require('to-csv');var ejs=require(_0x49be('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x49be('0x9'));var squel=require(_0x49be('0xa'));var crypto=require(_0x49be('0xb'));var jsforce=require(_0x49be('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x49be('0xd'));var querystring=require(_0x49be('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49be('0xf'));var as=require(_0x49be('0x10'));var hardwareService=require(_0x49be('0x11'));var logger=require(_0x49be('0x12'))(_0x49be('0x13'));var utils=require('../../config/utils');var config=require(_0x49be('0x14'));var licenseUtil=require(_0x49be('0x15'));var db=require(_0x49be('0x16'))['db'];config['redis']=_[_0x49be('0x17')](config[_0x49be('0x18')],{'host':_0x49be('0x19'),'port':0x18eb});var socket=require(_0x49be('0x1a'))(new Redis(config[_0x49be('0x18')]));require(_0x49be('0x1b'))[_0x49be('0x1c')](socket);function respondWithStatusCode(_0x4e3b6f,_0x5dce80){_0x5dce80=_0x5dce80||0xcc;return function(_0x5b7085){if(_0x5b7085){return _0x4e3b6f[_0x49be('0x1d')](_0x5dce80);}return _0x4e3b6f[_0x49be('0x1e')](_0x5dce80)[_0x49be('0x1f')]();};}function respondWithResult(_0x281bd2,_0x4edace){_0x4edace=_0x4edace||0xc8;return function(_0xeadcf){if(_0xeadcf){return _0x281bd2[_0x49be('0x1e')](_0x4edace)['json'](_0xeadcf);}};}function respondWithFilteredResult(_0x2e712c,_0x10b0a4){return function(_0x4244f8){if(_0x4244f8){var _0x5c42cd=typeof _0x10b0a4[_0x49be('0x20')]===_0x49be('0x21')&&typeof _0x10b0a4[_0x49be('0x22')]===_0x49be('0x21');var _0x12a04d=_0x4244f8['count'];var _0xdc6c2e=_0x5c42cd?0x0:_0x10b0a4[_0x49be('0x20')];var _0x16e5da=_0x5c42cd?_0x4244f8[_0x49be('0x23')]:_0x10b0a4[_0x49be('0x20')]+_0x10b0a4[_0x49be('0x22')];var _0xb744e9;if(_0x16e5da>=_0x12a04d){_0x16e5da=_0x12a04d;_0xb744e9=0xc8;}else{_0xb744e9=0xce;}_0x2e712c[_0x49be('0x1e')](_0xb744e9);return _0x2e712c[_0x49be('0x24')](_0x49be('0x25'),_0xdc6c2e+'-'+_0x16e5da+'/'+_0x12a04d)[_0x49be('0x26')](_0x4244f8);}return null;};}function patchUpdates(_0x1e0c3d){return function(_0x195328){try{jsonpatch[_0x49be('0x27')](_0x195328,_0x1e0c3d,!![]);}catch(_0x35bdba){return BPromise[_0x49be('0x28')](_0x35bdba);}return _0x195328[_0x49be('0x29')]();};}function saveUpdates(_0x58b760,_0x32faee){return function(_0x1dc2a0){if(_0x1dc2a0){return _0x1dc2a0[_0x49be('0x2a')](_0x58b760)[_0x49be('0x2b')](function(_0xdd8312){return _0xdd8312;});}return null;};}function removeEntity(_0x1becc0,_0x4f6b30){return function(_0xa27c5a){if(_0xa27c5a){return _0xa27c5a[_0x49be('0x2c')]()[_0x49be('0x2b')](function(){var _0xb79fe0=_0xa27c5a[_0x49be('0x2d')]({'plain':!![]});var _0x4c4af1=[{'name':_0x49be('0x2e'),'value':_0x49be('0x2f'),'ignore':![]},{'name':'QueueCampaigns','value':_0x49be('0x30'),'ignore':![]}];var _0x313c6d=_(_0x4c4af1)[_0x49be('0x31')](_0x49be('0x32'))[_0x49be('0x33')]('value')[_0x49be('0x34')]();if(_[_0x49be('0x35')](_0x313c6d,_0xb79fe0[_0x49be('0x36')])){return;}var _0x21a42e=_['find'](_0x4c4af1,[_0x49be('0x34'),_0xb79fe0['type']])[_0x49be('0x37')];return db[_0x49be('0x38')][_0x49be('0x2c')]({'where':{'type':_0x21a42e,'resourceId':_0xb79fe0['id']}})[_0x49be('0x2b')](function(){return _0xa27c5a;});})[_0x49be('0x2b')](function(){_0x1becc0['status'](0xcc)[_0x49be('0x1f')]();});}};}function handleEntityNotFound(_0x5f10f5,_0xaeb826){return function(_0x36d505){if(!_0x36d505){_0x5f10f5[_0x49be('0x1d')](0x194);}return _0x36d505;};}function handleError(_0x24b5af,_0x4fb943){_0x4fb943=_0x4fb943||0x1f4;return function(_0x2a1ff2){logger[_0x49be('0x39')](_0x2a1ff2[_0x49be('0x3a')]);if(_0x2a1ff2[_0x49be('0x37')]){delete _0x2a1ff2[_0x49be('0x37')];}_0x24b5af['status'](_0x4fb943)[_0x49be('0x3b')](_0x2a1ff2);};}exports[_0x49be('0x3c')]=function(_0x36d56b,_0x2642de){var _0x5e61d0={},_0x5ac435={},_0x7df8d6={'count':0x0,'rows':[]};var _0x2923f0=_[_0x49be('0x33')](db[_0x49be('0x3d')][_0x49be('0x3e')],function(_0x21392c){return{'name':_0x21392c[_0x49be('0x3f')],'type':_0x21392c[_0x49be('0x36')]['key']};});_0x5ac435[_0x49be('0x40')]=_[_0x49be('0x33')](_0x2923f0,_0x49be('0x37'));_0x5ac435[_0x49be('0x41')]=_['keys'](_0x36d56b[_0x49be('0x41')]);_0x5ac435[_0x49be('0x42')]=_[_0x49be('0x43')](_0x5ac435['model'],_0x5ac435['query']);_0x5e61d0['attributes']=_[_0x49be('0x43')](_0x5ac435[_0x49be('0x40')],qs['fields'](_0x36d56b[_0x49be('0x41')][_0x49be('0x44')]));_0x5e61d0[_0x49be('0x45')]=_0x5e61d0[_0x49be('0x45')][_0x49be('0x46')]?_0x5e61d0[_0x49be('0x45')]:_0x5ac435[_0x49be('0x40')];if(!_0x36d56b['query']['hasOwnProperty'](_0x49be('0x47'))){_0x5e61d0[_0x49be('0x22')]=qs['limit'](_0x36d56b[_0x49be('0x41')][_0x49be('0x22')]);_0x5e61d0['offset']=qs[_0x49be('0x20')](_0x36d56b[_0x49be('0x41')][_0x49be('0x20')]);}_0x5e61d0[_0x49be('0x48')]=qs['sort'](_0x36d56b[_0x49be('0x41')][_0x49be('0x49')]);_0x5e61d0[_0x49be('0x4a')]=qs['filters'](_[_0x49be('0x4b')](_0x36d56b[_0x49be('0x41')],_0x5ac435['filters']),_0x2923f0);if(_0x36d56b[_0x49be('0x41')][_0x49be('0x31')]){_0x5e61d0['where']=_[_0x49be('0x4c')](_0x5e61d0[_0x49be('0x4a')],{'$or':_['map'](_0x2923f0,function(_0x3784a8){if(_0x3784a8[_0x49be('0x36')]!==_0x49be('0x4d')){var _0x312378={};_0x312378[_0x3784a8[_0x49be('0x37')]]={'$like':'%'+_0x36d56b['query'][_0x49be('0x31')]+'%'};return _0x312378;}})});}_0x5e61d0=_[_0x49be('0x4c')]({},_0x5e61d0,_0x36d56b[_0x49be('0x4e')]);var _0x3f9be3={'where':_0x5e61d0['where']};return db[_0x49be('0x3d')][_0x49be('0x23')](_0x3f9be3)[_0x49be('0x2b')](function(_0x1618f6){_0x7df8d6[_0x49be('0x23')]=_0x1618f6;if(_0x36d56b['query']['includeAll']){_0x5e61d0[_0x49be('0x4f')]=[{'all':!![]}];}return db[_0x49be('0x3d')][_0x49be('0x50')](_0x5e61d0);})[_0x49be('0x2b')](function(_0x5b0b77){_0x7df8d6[_0x49be('0x51')]=_0x5b0b77;return _0x7df8d6;})[_0x49be('0x2b')](respondWithFilteredResult(_0x2642de,_0x5e61d0))[_0x49be('0x52')](handleError(_0x2642de,null));};exports['show']=function(_0x3b37ac,_0xb6a2d2){var _0x5ca815={'raw':![],'where':{'id':_0x3b37ac['params']['id']}},_0x3054dd={};_0x3054dd[_0x49be('0x40')]=_['keys'](db[_0x49be('0x3d')][_0x49be('0x3e')]);_0x3054dd[_0x49be('0x41')]=_['keys'](_0x3b37ac['query']);_0x3054dd[_0x49be('0x42')]=_[_0x49be('0x43')](_0x3054dd[_0x49be('0x40')],_0x3054dd[_0x49be('0x41')]);_0x5ca815[_0x49be('0x45')]=_[_0x49be('0x43')](_0x3054dd['model'],qs['fields'](_0x3b37ac[_0x49be('0x41')][_0x49be('0x44')]));_0x5ca815[_0x49be('0x45')]=_0x5ca815[_0x49be('0x45')][_0x49be('0x46')]?_0x5ca815[_0x49be('0x45')]:_0x3054dd['model'];if(_0x3b37ac[_0x49be('0x41')][_0x49be('0x53')]){_0x5ca815[_0x49be('0x4f')]=[{'all':!![]}];}_0x5ca815=_[_0x49be('0x4c')]({},_0x5ca815,_0x3b37ac['options']);return db['VoiceQueue'][_0x49be('0x54')](_0x5ca815)['then'](handleEntityNotFound(_0xb6a2d2,null))[_0x49be('0x2b')](respondWithResult(_0xb6a2d2,null))[_0x49be('0x52')](handleError(_0xb6a2d2,null));};exports[_0x49be('0x55')]=function(_0x24568d,_0x1e4ec5){return db[_0x49be('0x3d')][_0x49be('0x55')](_0x24568d['body'],{})[_0x49be('0x2b')](function(_0x3b2e04){var _0x28d590=_0x24568d[_0x49be('0x56')][_0x49be('0x2d')]({'plain':!![]});if(!_0x28d590)throw new Error(_0x49be('0x57'));if(_0x28d590[_0x49be('0x58')]===_0x49be('0x56')){var _0x21e011=_0x3b2e04['get']({'plain':!![]});var _0xc3c722=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x49be('0x59'),'value':_0x49be('0x30')}];var _0x3bee52=_[_0x49be('0x54')](_0xc3c722,['value',_0x21e011[_0x49be('0x36')]])['name'];return db[_0x49be('0x5a')]['find']({'where':{'name':_0x3bee52,'userProfileId':_0x28d590[_0x49be('0x5b')]},'raw':!![]})[_0x49be('0x2b')](function(_0x33caeb){if(_0x33caeb&&_0x33caeb['autoAssociation']===0x0){return db[_0x49be('0x38')][_0x49be('0x55')]({'name':_0x21e011[_0x49be('0x37')],'resourceId':_0x21e011['id'],'type':_0x33caeb[_0x49be('0x37')],'sectionId':_0x33caeb['id']},{})[_0x49be('0x2b')](function(){return _0x3b2e04;});}else{return _0x3b2e04;}})[_0x49be('0x52')](function(_0x540e0f){logger[_0x49be('0x39')](_0x49be('0x5c'),_0x540e0f);throw _0x540e0f;});}return _0x3b2e04;})['then'](respondWithResult(_0x1e4ec5,0xc9))[_0x49be('0x52')](handleError(_0x1e4ec5,null));};exports[_0x49be('0x5d')]=function(_0x2192d9,_0xa7754f){var _0x77f90e={'where':{'id':_0x2192d9['params']['id']}},_0x9ae96c={};_0x9ae96c[_0x49be('0x40')]=_[_0x49be('0x5e')](db[_0x49be('0x3d')][_0x49be('0x3e')]);_0x77f90e[_0x49be('0x45')]=_[_0x49be('0x43')](_0x9ae96c['model'],qs[_0x49be('0x44')](_0x2192d9[_0x49be('0x41')][_0x49be('0x44')]));_0x77f90e['attributes']=_0x77f90e[_0x49be('0x45')][_0x49be('0x46')]?_0x77f90e[_0x49be('0x45')]:_0x9ae96c[_0x49be('0x40')];if(_0x2192d9[_0x49be('0x41')]['includeAll']){_0x77f90e[_0x49be('0x4f')]=[{'all':!![]}];}_0x77f90e=_[_0x49be('0x4c')]({},_0x77f90e,_0x2192d9[_0x49be('0x4e')]);return db[_0x49be('0x3d')][_0x49be('0x54')](_0x77f90e)['then'](handleEntityNotFound(_0xa7754f,null))['then'](function(_0x135ecc){if(_0x135ecc){var _0x9fb1bb=_0x135ecc['get']({'plain':!![]});_0x9fb1bb=qs[_0x49be('0x5f')](_0x9fb1bb,['id',_0x49be('0x60'),'updatedAt']);_0x2192d9[_0x49be('0x61')]=_[_0x49be('0x5f')](_0x2192d9[_0x49be('0x61')],['id',_0x49be('0x60'),_0x49be('0x62')]);return db[_0x49be('0x3d')][_0x49be('0x55')](_[_0x49be('0x4c')](_0x9fb1bb,_0x2192d9[_0x49be('0x61')]),{'include':_0x2192d9[_0x49be('0x41')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x17a3e8){var _0x153b24=_0x2192d9[_0x49be('0x56')]['get']({'plain':!![]});if(!_0x153b24)throw new Error(_0x49be('0x57'));if(_0x153b24['role']===_0x49be('0x56')){var _0x555f0e=_0x17a3e8[_0x49be('0x2d')]({'plain':!![]});var _0x167ce3=[{'name':_0x49be('0x2e'),'value':'inbound'},{'name':_0x49be('0x59'),'value':_0x49be('0x30')}];var _0x55fb55=_[_0x49be('0x54')](_0x167ce3,['value',_0x555f0e[_0x49be('0x36')]])[_0x49be('0x37')];return db[_0x49be('0x5a')][_0x49be('0x54')]({'where':{'name':_0x55fb55,'userProfileId':_0x153b24['userProfileId']},'raw':!![]})[_0x49be('0x2b')](function(_0x2c551e){if(_0x2c551e&&_0x2c551e[_0x49be('0x63')]===0x0){return db['UserProfileResource'][_0x49be('0x55')]({'name':_0x555f0e[_0x49be('0x37')],'resourceId':_0x555f0e['id'],'type':_0x2c551e[_0x49be('0x37')],'sectionId':_0x2c551e['id']},{})[_0x49be('0x2b')](function(){return _0x17a3e8;});}else{return _0x17a3e8;}})['catch'](function(_0x392d8e){logger[_0x49be('0x39')](_0x49be('0x5c'),_0x392d8e);throw _0x392d8e;});}return _0x17a3e8;});}})[_0x49be('0x2b')](respondWithResult(_0xa7754f,0xc9))[_0x49be('0x52')](handleError(_0xa7754f,null));};exports[_0x49be('0x2a')]=function(_0x3b6379,_0x4052c7){if(_0x3b6379['body']['id']){delete _0x3b6379[_0x49be('0x61')]['id'];}return db[_0x49be('0x3d')][_0x49be('0x54')]({'where':{'id':_0x3b6379['params']['id']}})[_0x49be('0x2b')](handleEntityNotFound(_0x4052c7,null))['then'](saveUpdates(_0x3b6379[_0x49be('0x61')],null))[_0x49be('0x2b')](respondWithResult(_0x4052c7,null))[_0x49be('0x52')](handleError(_0x4052c7,null));};exports[_0x49be('0x2c')]=function(_0x20e373,_0x36b242){return db['VoiceQueue'][_0x49be('0x54')]({'where':{'id':_0x20e373[_0x49be('0x64')]['id']}})[_0x49be('0x2b')](handleEntityNotFound(_0x36b242,null))[_0x49be('0x2b')](removeEntity(_0x36b242,null))[_0x49be('0x52')](handleError(_0x36b242,null));};exports[_0x49be('0x65')]=function(_0x5a5dbc,_0xb37970,_0x5e63f6){var _0x71bef={'raw':![],'where':{}};var _0x4f9780={};var _0x251cb1={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x49be('0x66')]({'where':{'id':_0x5a5dbc[_0x49be('0x64')]['id']}})['then'](handleEntityNotFound(_0xb37970,null))['then'](function(_0x390ee2){if(_0x390ee2){_0x4f9780[_0x49be('0x40')]=_[_0x49be('0x5e')](db[_0x49be('0x67')][_0x49be('0x3e')]);_0x4f9780[_0x49be('0x41')]=_['keys'](_0x5a5dbc[_0x49be('0x41')]);_0x4f9780[_0x49be('0x42')]=_[_0x49be('0x43')](_0x4f9780[_0x49be('0x40')],_0x4f9780[_0x49be('0x41')]);_0x71bef[_0x49be('0x45')]=_['intersection'](_0x4f9780['model'],qs[_0x49be('0x44')](_0x5a5dbc[_0x49be('0x41')][_0x49be('0x44')]));_0x71bef[_0x49be('0x45')]=_0x71bef[_0x49be('0x45')]['length']?_0x71bef[_0x49be('0x45')]:_0x4f9780[_0x49be('0x40')];if(!_0x5a5dbc[_0x49be('0x41')][_0x49be('0x68')](_0x49be('0x47'))){_0x71bef['limit']=qs[_0x49be('0x22')](_0x5a5dbc[_0x49be('0x41')]['limit']);_0x71bef[_0x49be('0x20')]=qs[_0x49be('0x20')](_0x5a5dbc[_0x49be('0x41')][_0x49be('0x20')]);}_0x71bef[_0x49be('0x48')]=qs[_0x49be('0x49')](_0x5a5dbc[_0x49be('0x41')][_0x49be('0x49')]);_0x71bef[_0x49be('0x4a')]=qs[_0x49be('0x42')](_['pick'](_0x5a5dbc[_0x49be('0x41')],_0x4f9780[_0x49be('0x42')]));_0x71bef[_0x49be('0x4a')][_0x49be('0x69')]=_0x390ee2['id'];if(_0x5a5dbc['query'][_0x49be('0x31')]){_0x71bef['where']=_[_0x49be('0x4c')](_0x71bef[_0x49be('0x4a')],{'$or':_[_0x49be('0x33')](_0x71bef[_0x49be('0x45')],function(_0x48685c){var _0x20eb7d={};_0x20eb7d[_0x48685c]={'$like':'%'+_0x5a5dbc[_0x49be('0x41')]['filter']+'%'};return _0x20eb7d;})});}_0x71bef=_[_0x49be('0x4c')]({},_0x71bef,_0x5a5dbc[_0x49be('0x4e')]);return db[_0x49be('0x67')][_0x49be('0x23')]({'where':_0x71bef[_0x49be('0x4a')]})[_0x49be('0x2b')](function(_0x433d26){_0x251cb1['count']=_0x433d26;if(_0x5a5dbc[_0x49be('0x41')]['includeAll']){_0x71bef[_0x49be('0x4f')]=[{'all':!![]}];}return db[_0x49be('0x67')][_0x49be('0x50')](_0x71bef);})[_0x49be('0x2b')](function(_0x1ad3c5){_0x251cb1['rows']=_0x1ad3c5;return _0x251cb1;});}})[_0x49be('0x2b')](respondWithFilteredResult(_0xb37970,_0x71bef))[_0x49be('0x52')](handleError(_0xb37970,null));};exports[_0x49be('0x6a')]=function(_0x31a56d,_0x291e91,_0x33fc8b){var _0x565cf9={'raw':!![],'where':{}};var _0x4d2318={};var _0x38d51e={'count':0x0,'rows':[]};return db[_0x49be('0x3d')][_0x49be('0x66')]({'where':{'id':_0x31a56d[_0x49be('0x64')]['id']}})[_0x49be('0x2b')](handleEntityNotFound(_0x291e91,null))[_0x49be('0x2b')](function(_0x505dda){if(_0x505dda){_0x4d2318[_0x49be('0x40')]=_[_0x49be('0x5e')](db[_0x49be('0x6b')][_0x49be('0x3e')]);_0x4d2318[_0x49be('0x41')]=_[_0x49be('0x5e')](_0x31a56d['query']);_0x4d2318[_0x49be('0x42')]=_[_0x49be('0x43')](_0x4d2318[_0x49be('0x40')],_0x4d2318['query']);_0x565cf9['attributes']=_[_0x49be('0x43')](_0x4d2318[_0x49be('0x40')],qs[_0x49be('0x44')](_0x31a56d[_0x49be('0x41')][_0x49be('0x44')]));_0x565cf9[_0x49be('0x45')]=_0x565cf9[_0x49be('0x45')][_0x49be('0x46')]?_0x565cf9[_0x49be('0x45')]:_0x4d2318[_0x49be('0x40')];if(!_0x31a56d[_0x49be('0x41')]['hasOwnProperty'](_0x49be('0x47'))){_0x565cf9[_0x49be('0x22')]=qs[_0x49be('0x22')](_0x31a56d[_0x49be('0x41')][_0x49be('0x22')]);_0x565cf9[_0x49be('0x20')]=qs[_0x49be('0x20')](_0x31a56d[_0x49be('0x41')]['offset']);}_0x565cf9[_0x49be('0x48')]=qs[_0x49be('0x49')](_0x31a56d[_0x49be('0x41')][_0x49be('0x49')]);_0x565cf9['where']=qs['filters'](_[_0x49be('0x4b')](_0x31a56d['query'],_0x4d2318[_0x49be('0x42')]));_0x565cf9[_0x49be('0x4a')]['VoiceQueueId']=_0x505dda['id'];if(_0x31a56d['query'][_0x49be('0x31')]){_0x565cf9[_0x49be('0x4a')]=_[_0x49be('0x4c')](_0x565cf9[_0x49be('0x4a')],{'$or':_[_0x49be('0x33')](_0x565cf9[_0x49be('0x45')],function(_0x5d819f){var _0x50cda2={};_0x50cda2[_0x5d819f]={'$like':'%'+_0x31a56d[_0x49be('0x41')][_0x49be('0x31')]+'%'};return _0x50cda2;})});}_0x565cf9=_[_0x49be('0x4c')]({},_0x565cf9,_0x31a56d[_0x49be('0x4e')]);return db[_0x49be('0x6b')][_0x49be('0x23')]({'where':_0x565cf9[_0x49be('0x4a')]})[_0x49be('0x2b')](function(_0x3bdbf9){_0x38d51e['count']=_0x3bdbf9;if(_0x31a56d[_0x49be('0x41')][_0x49be('0x53')]){_0x565cf9[_0x49be('0x4f')]=[{'all':!![]}];}return db[_0x49be('0x6b')][_0x49be('0x50')](_0x565cf9);})[_0x49be('0x2b')](function(_0x2500cf){_0x38d51e['rows']=_0x2500cf;return _0x38d51e;});}})['then'](respondWithFilteredResult(_0x291e91,_0x565cf9))[_0x49be('0x52')](handleError(_0x291e91,null));};exports[_0x49be('0x6c')]=function(_0x477a7b,_0x50c27a,_0x55717c){var _0x5bb77e={'raw':!![],'where':{}};var _0x50b3b1={};var _0x39605c={'count':0x0,'rows':[]};return db[_0x49be('0x3d')][_0x49be('0x66')]({'where':{'id':_0x477a7b[_0x49be('0x64')]['id']}})[_0x49be('0x2b')](handleEntityNotFound(_0x50c27a,null))['then'](function(_0x5d7756){if(_0x5d7756){_0x50b3b1[_0x49be('0x40')]=_[_0x49be('0x5e')](db[_0x49be('0x6d')][_0x49be('0x3e')]);_0x50b3b1[_0x49be('0x41')]=_['keys'](_0x477a7b[_0x49be('0x41')]);_0x50b3b1['filters']=_[_0x49be('0x43')](_0x50b3b1[_0x49be('0x40')],_0x50b3b1['query']);_0x5bb77e['attributes']=_[_0x49be('0x43')](_0x50b3b1[_0x49be('0x40')],qs[_0x49be('0x44')](_0x477a7b['query']['fields']));_0x5bb77e['attributes']=_0x5bb77e['attributes']['length']?_0x5bb77e['attributes']:_0x50b3b1[_0x49be('0x40')];if(!_0x477a7b[_0x49be('0x41')][_0x49be('0x68')](_0x49be('0x47'))){_0x5bb77e['limit']=qs[_0x49be('0x22')](_0x477a7b[_0x49be('0x41')]['limit']);_0x5bb77e[_0x49be('0x20')]=qs['offset'](_0x477a7b[_0x49be('0x41')][_0x49be('0x20')]);}_0x5bb77e[_0x49be('0x48')]=qs[_0x49be('0x49')](_0x477a7b[_0x49be('0x41')][_0x49be('0x49')]);_0x5bb77e[_0x49be('0x4a')]=qs[_0x49be('0x42')](_[_0x49be('0x4b')](_0x477a7b[_0x49be('0x41')],_0x50b3b1['filters']));_0x5bb77e[_0x49be('0x4a')][_0x49be('0x69')]=_0x5d7756['id'];if(_0x477a7b[_0x49be('0x41')][_0x49be('0x31')]){_0x5bb77e['where']=_[_0x49be('0x4c')](_0x5bb77e['where'],{'$or':_[_0x49be('0x33')](_0x5bb77e[_0x49be('0x45')],function(_0x32cddf){var _0x536af6={};_0x536af6[_0x32cddf]={'$like':'%'+_0x477a7b[_0x49be('0x41')][_0x49be('0x31')]+'%'};return _0x536af6;})});}_0x5bb77e=_[_0x49be('0x4c')]({},_0x5bb77e,_0x477a7b['options']);return db[_0x49be('0x6d')][_0x49be('0x23')]({'where':_0x5bb77e[_0x49be('0x4a')]})[_0x49be('0x2b')](function(_0x49f88d){_0x39605c[_0x49be('0x23')]=_0x49f88d;if(_0x477a7b[_0x49be('0x41')][_0x49be('0x53')]){_0x5bb77e[_0x49be('0x4f')]=[{'all':!![]}];}return db[_0x49be('0x6d')][_0x49be('0x50')](_0x5bb77e);})[_0x49be('0x2b')](function(_0x2b60c6){_0x39605c[_0x49be('0x51')]=_0x2b60c6;return _0x39605c;});}})[_0x49be('0x2b')](respondWithFilteredResult(_0x50c27a,_0x5bb77e))['catch'](handleError(_0x50c27a,null));};exports[_0x49be('0x6e')]=function(_0x1a9153,_0x4fe505,_0x58d20e){var _0x2f95b6={'raw':!![],'where':{}};var _0x175cb6={};var _0x4084c2={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x49be('0x66')]({'where':{'id':_0x1a9153['params']['id']}})[_0x49be('0x2b')](handleEntityNotFound(_0x4fe505,null))[_0x49be('0x2b')](function(_0x112080){if(_0x112080){_0x175cb6[_0x49be('0x40')]=_[_0x49be('0x5e')](db[_0x49be('0x6f')][_0x49be('0x3e')]);_0x175cb6['query']=_[_0x49be('0x5e')](_0x1a9153[_0x49be('0x41')]);_0x175cb6[_0x49be('0x42')]=_[_0x49be('0x43')](_0x175cb6[_0x49be('0x40')],_0x175cb6['query']);_0x2f95b6[_0x49be('0x45')]=_['intersection'](_0x175cb6['model'],qs[_0x49be('0x44')](_0x1a9153[_0x49be('0x41')]['fields']));_0x2f95b6['attributes']=_0x2f95b6[_0x49be('0x45')][_0x49be('0x46')]?_0x2f95b6['attributes']:_0x175cb6['model'];if(!_0x1a9153[_0x49be('0x41')][_0x49be('0x68')](_0x49be('0x47'))){_0x2f95b6[_0x49be('0x22')]=qs[_0x49be('0x22')](_0x1a9153[_0x49be('0x41')][_0x49be('0x22')]);_0x2f95b6[_0x49be('0x20')]=qs[_0x49be('0x20')](_0x1a9153[_0x49be('0x41')][_0x49be('0x20')]);}_0x2f95b6['order']=qs['sort'](_0x1a9153['query'][_0x49be('0x49')]);_0x2f95b6['where']=qs[_0x49be('0x42')](_[_0x49be('0x4b')](_0x1a9153['query'],_0x175cb6[_0x49be('0x42')]));_0x2f95b6[_0x49be('0x4a')][_0x49be('0x69')]=_0x112080['id'];if(_0x1a9153[_0x49be('0x41')][_0x49be('0x31')]){_0x2f95b6[_0x49be('0x4a')]=_['merge'](_0x2f95b6['where'],{'$or':_[_0x49be('0x33')](_0x2f95b6['attributes'],function(_0x39c929){var _0x32f22d={};_0x32f22d[_0x39c929]={'$like':'%'+_0x1a9153[_0x49be('0x41')][_0x49be('0x31')]+'%'};return _0x32f22d;})});}_0x2f95b6=_[_0x49be('0x4c')]({},_0x2f95b6,_0x1a9153['options']);return db[_0x49be('0x6f')]['count']({'where':_0x2f95b6[_0x49be('0x4a')]})[_0x49be('0x2b')](function(_0x3e5d27){_0x4084c2['count']=_0x3e5d27;if(_0x1a9153['query'][_0x49be('0x53')]){_0x2f95b6[_0x49be('0x4f')]=[{'all':!![]}];}return db[_0x49be('0x6f')][_0x49be('0x50')](_0x2f95b6);})[_0x49be('0x2b')](function(_0x180191){_0x4084c2[_0x49be('0x51')]=_0x180191;return _0x4084c2;});}})['then'](respondWithFilteredResult(_0x4fe505,_0x2f95b6))[_0x49be('0x52')](handleError(_0x4fe505,null));};exports[_0x49be('0x70')]=function(_0x3125e9,_0x138bdf,_0x14356c){var _0xb060f9={};var _0x9f8861={};var _0x41d969;var _0x88be38;return db[_0x49be('0x3d')][_0x49be('0x66')]({'where':{'id':_0x3125e9[_0x49be('0x64')]['id']}})[_0x49be('0x2b')](handleEntityNotFound(_0x138bdf,null))[_0x49be('0x2b')](function(_0x534d1c){if(_0x534d1c){_0x41d969=_0x534d1c;_0x9f8861[_0x49be('0x40')]=_[_0x49be('0x5e')](db[_0x49be('0x71')][_0x49be('0x3e')]);_0x9f8861[_0x49be('0x41')]=_[_0x49be('0x5e')](_0x3125e9[_0x49be('0x41')]);_0x9f8861[_0x49be('0x42')]=_[_0x49be('0x43')](_0x9f8861[_0x49be('0x40')],_0x9f8861['query']);_0xb060f9[_0x49be('0x45')]=_[_0x49be('0x43')](_0x9f8861[_0x49be('0x40')],qs['fields'](_0x3125e9[_0x49be('0x41')][_0x49be('0x44')]));_0xb060f9[_0x49be('0x45')]=_0xb060f9[_0x49be('0x45')]['length']?_0xb060f9['attributes']:_0x9f8861[_0x49be('0x40')];_0xb060f9['order']=qs[_0x49be('0x49')](_0x3125e9['query'][_0x49be('0x49')]);_0xb060f9[_0x49be('0x4a')]=qs['filters'](_[_0x49be('0x4b')](_0x3125e9['query'],_0x9f8861[_0x49be('0x42')]));if(_0x3125e9[_0x49be('0x41')][_0x49be('0x31')]){_0xb060f9[_0x49be('0x4a')]=_[_0x49be('0x4c')](_0xb060f9[_0x49be('0x4a')],{'$or':_[_0x49be('0x33')](_0xb060f9['attributes'],function(_0x4cd05b){var _0x22c863={};_0x22c863[_0x4cd05b]={'$like':'%'+_0x3125e9[_0x49be('0x41')][_0x49be('0x31')]+'%'};return _0x22c863;})});}_0xb060f9=_[_0x49be('0x4c')]({},_0xb060f9,_0x3125e9[_0x49be('0x4e')]);return _0x41d969[_0x49be('0x70')](_0xb060f9);}})[_0x49be('0x2b')](function(_0x3fc50a){if(_0x3fc50a){_0x88be38=_0x3fc50a[_0x49be('0x46')];if(!_0x3125e9[_0x49be('0x41')][_0x49be('0x68')](_0x49be('0x47'))){_0xb060f9[_0x49be('0x22')]=qs[_0x49be('0x22')](_0x3125e9['query'][_0x49be('0x22')]);_0xb060f9[_0x49be('0x20')]=qs[_0x49be('0x20')](_0x3125e9['query'][_0x49be('0x20')]);}return _0x41d969[_0x49be('0x70')](_0xb060f9);}})['then'](function(_0x26fb5a){if(_0x26fb5a){return _0x26fb5a?{'count':_0x88be38,'rows':_0x26fb5a}:null;}})[_0x49be('0x2b')](respondWithResult(_0x138bdf,null))[_0x49be('0x52')](handleError(_0x138bdf,null));};exports[_0x49be('0x72')]=function(_0x15dabe,_0x246040,_0x492381){var _0x433136=_0x15dabe[_0x49be('0x61')][_0x49be('0x73')];var _0x2d6593=_[_0x49be('0x33')](_0x433136,'id');return db['Team'][_0x49be('0x50')]({'where':{'id':_0x2d6593},'attributes':['id'],'include':[{'model':db[_0x49be('0x74')],'as':'Agents','attributes':['id','name',_0x49be('0x75'),'voicePause',_0x49be('0x76')],'raw':!![]}]})[_0x49be('0x2b')](function(_0x3dcd14){if(_0x3dcd14){var _0x2d136e=_[_0x49be('0x77')](_0x3dcd14,function(_0x365d18){var _0x258c49=_0x365d18[_0x49be('0x2d')]({'plain':!![]});_0x258c49[_0x49be('0x78')][_0x49be('0x79')](function(_0x403629){_0x403629['penalty']=_[_0x49be('0x54')](_0x433136,{'id':_0x258c49['id']})[_0x49be('0x7a')];});return _0x258c49[_0x49be('0x78')];});return db[_0x49be('0x3d')]['find']({'where':{'id':_0x15dabe[_0x49be('0x64')]['id']}})[_0x49be('0x2b')](function(_0x341e57){return db[_0x49be('0x7b')][_0x49be('0x7c')](function(_0x40fe03){return _0x341e57['addTeams'](_0x2d6593,{'transaction':_0x40fe03})[_0x49be('0x2b')](function(){return BPromise[_0x49be('0x7d')](_0x433136,function(_0x36e688){return db[_0x49be('0x7e')][_0x49be('0x7f')]({'TeamId':_0x36e688['id'],'VoiceQueueId':_0x15dabe[_0x49be('0x64')]['id'],'penalty':_0x36e688['penalty']},{'transaction':_0x40fe03});});})[_0x49be('0x2b')](function(){return BPromise[_0x49be('0x7d')](_0x2d136e,function(_0x4f2f1b){return db['UserVoiceQueue'][_0x49be('0x80')]({'where':{'UserId':_0x4f2f1b['id'],'VoiceQueueId':_0x15dabe[_0x49be('0x64')]['id']},'defaults':{'penalty':_0x4f2f1b[_0x49be('0x7a')]},'transaction':_0x40fe03});});})[_0x49be('0x2b')](function(){return BPromise[_0x49be('0x7d')](_['filter'](_0x2d136e,{'online':!![]}),function(_0x98d5fc){return db['UserVoiceQueueRt'][_0x49be('0x7f')]({'membername':_0x98d5fc[_0x49be('0x37')],'UserId':_0x98d5fc['id'],'queue_name':_0x341e57[_0x49be('0x37')],'VoiceQueueId':_0x341e57['id'],'interface':_[_0x49be('0x81')](_0x98d5fc[_0x49be('0x76')])?util[_0x49be('0x82')](_0x49be('0x83'),_0x98d5fc['name']):_0x98d5fc[_0x49be('0x76')],'paused':_0x98d5fc[_0x49be('0x84')]||![],'penalty':_0x98d5fc[_0x49be('0x7a')]},{'transaction':_0x40fe03});});})['then'](function(){_0x2d136e[_0x49be('0x79')](function(_0x113938){socket['emit']('userVoiceQueue:save',{'UserId':_0x113938['id'],'VoiceQueueId':_0x341e57['id']});});});});});}})[_0x49be('0x2b')](respondWithStatusCode(_0x246040,null))[_0x49be('0x52')](handleError(_0x246040,null));};exports[_0x49be('0x85')]=function(_0x357c74,_0x1cd042,_0x34be17){return db['Team'][_0x49be('0x50')]({'where':{'id':_0x357c74[_0x49be('0x41')][_0x49be('0x86')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x49be('0x78'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1cd042,null))['then'](function(_0x2c9674){var _0x3c2d65=_[_0x49be('0x33')](_0x2c9674,'id');var _0x6489c8=[];var _0x120d7f=[];var _0x4811af=squel[_0x49be('0x87')]();_0x4811af[_0x49be('0x88')]('tq.TeamId')[_0x49be('0x89')](_0x49be('0x8a'),'tq')['join'](_0x49be('0x8b'),'ut',_0x49be('0x8c'))[_0x49be('0x4a')](_0x49be('0x8d'),_0x357c74[_0x49be('0x64')]['id']);for(var _0x2538b1=0x0;_0x2538b1<_0x2c9674[_0x49be('0x46')];_0x2538b1+=0x1){let _0x3ad8f8=_0x2c9674[_0x2538b1];for(var _0x603da9=0x0;_0x603da9<_0x3ad8f8[_0x49be('0x78')][_0x49be('0x46')];_0x603da9+=0x1){let _0xa737c6=_0x3ad8f8[_0x49be('0x78')][_0x603da9];var _0xa3a0e2=_0x4811af[_0x49be('0x5d')]();_0xa3a0e2[_0x49be('0x4a')](_0x49be('0x8e'),_0xa737c6['id']);_0x120d7f['push'](db[_0x49be('0x7b')][_0x49be('0x41')](_0xa3a0e2[_0x49be('0x8f')](),{'type':db[_0x49be('0x7b')][_0x49be('0x90')][_0x49be('0x91')]})[_0x49be('0x2b')](function(_0x223af1){if(_0x223af1[_0x49be('0x46')]===0x1){return _0xa737c6['id'];}else{var _0x19f5ff=_[_0x49be('0x92')](_['map'](_0x223af1,'TeamId'),function(_0x5ee036){return _['includes'](_0x3c2d65,_0x5ee036);});if(_0x19f5ff){return _0xa737c6['id'];}}}));}}return BPromise[_0x49be('0x93')](_0x120d7f)['then'](function(_0x4072d3){_0x6489c8=_(_0x6489c8)[_0x49be('0x94')](_0x4072d3)[_0x49be('0x95')]()[_0x49be('0x34')]();return db[_0x49be('0x3d')][_0x49be('0x54')]({'where':{'id':_0x357c74[_0x49be('0x64')]['id']}})[_0x49be('0x2b')](function(_0x41bf10){return db[_0x49be('0x7b')][_0x49be('0x7c')](function(_0x27be0d){return _0x41bf10[_0x49be('0x85')](_0x357c74['query'][_0x49be('0x86')],{'transaction':_0x27be0d})[_0x49be('0x2b')](function(){if(!_[_0x49be('0x96')](_0x6489c8)){return _0x41bf10[_0x49be('0x97')](_0x6489c8,{'transaction':_0x27be0d})[_0x49be('0x2b')](function(){return db[_0x49be('0x98')][_0x49be('0x2c')]({'where':{'VoiceQueueId':_0x357c74[_0x49be('0x64')]['id'],'UserId':_0x6489c8},'transaction':_0x27be0d});});}})[_0x49be('0x2b')](function(){_0x6489c8[_0x49be('0x79')](function(_0xd5e876){socket['emit'](_0x49be('0x99'),{'UserId':_0xd5e876,'VoiceQueueId':_0x41bf10['id']});});});});});});})[_0x49be('0x2b')](respondWithStatusCode(_0x1cd042,null))[_0x49be('0x52')](handleError(_0x1cd042,null));};exports[_0x49be('0x9a')]=function(_0x2ec6cf,_0x2ceb2b,_0x37db9e){var _0x38385f,_0x444315;return db[_0x49be('0x3d')][_0x49be('0x54')]({'where':{'id':_0x2ec6cf['params']['id']}})[_0x49be('0x2b')](handleEntityNotFound(_0x2ceb2b,null))[_0x49be('0x2b')](function(_0x137bc6){if(_0x137bc6){_0x444315=_0x137bc6;return _0x137bc6[_0x49be('0x9a')](_0x2ec6cf[_0x49be('0x61')][_0x49be('0x86')],_['omit'](_0x2ec6cf[_0x49be('0x61')],['ids','id'])||{})[_0x49be('0x9b')](function(_0xc2d90e){for(var _0x1c1a15=0x0;_0x1c1a15<_0x2ec6cf[_0x49be('0x61')]['ids'][_0x49be('0x46')];_0x1c1a15+=0x1){socket[_0x49be('0x9c')](_0x49be('0x9d'),{'UserId':Number(_0x2ec6cf['body'][_0x49be('0x86')][_0x1c1a15]),'VoiceQueueId':Number(_0x2ec6cf[_0x49be('0x64')]['id'])});}return _0xc2d90e;});}})['then'](function(_0x2cb8ab){_0x38385f=_0x2cb8ab||[];if(_0x444315){return db[_0x49be('0x74')][_0x49be('0x50')]({'where':{'id':_0x2ec6cf[_0x49be('0x61')][_0x49be('0x86')]},'attributes':['id','name',_0x49be('0x75'),_0x49be('0x84'),'interface'],'raw':!![]});}})['then'](function(_0xb6479f){if(!_['isEmpty'](_0xb6479f)){var _0x47ab76=[];for(var _0x741d17=0x0;_0x741d17<_0xb6479f[_0x49be('0x46')];_0x741d17++){if(_0xb6479f[_0x741d17][_0x49be('0x75')]){_0x47ab76[_0x49be('0x9e')](db[_0x49be('0x98')][_0x49be('0x7f')]({'membername':_0xb6479f[_0x741d17][_0x49be('0x37')],'UserId':_0xb6479f[_0x741d17]['id'],'queue_name':_0x444315[_0x49be('0x37')],'VoiceQueueId':_0x444315['id'],'interface':_['isNil'](_0xb6479f[_0x741d17][_0x49be('0x76')])?util['format']('SIP/%s',_0xb6479f[_0x741d17]['name']):_0xb6479f[_0x741d17][_0x49be('0x76')],'paused':_0xb6479f[_0x741d17][_0x49be('0x84')]||![],'penalty':_0x2ec6cf[_0x49be('0x61')]['penalty']||0x0}));}}return BPromise[_0x49be('0x93')](_0x47ab76);}})[_0x49be('0x2b')](function(){return _0x38385f;})[_0x49be('0x2b')](respondWithResult(_0x2ceb2b,null))[_0x49be('0x52')](handleError(_0x2ceb2b,null));};exports[_0x49be('0x97')]=function(_0x3c01ae,_0x471492,_0x27a6cc){return db[_0x49be('0x3d')][_0x49be('0x54')]({'where':{'id':_0x3c01ae[_0x49be('0x64')]['id']}})[_0x49be('0x2b')](handleEntityNotFound(_0x471492,null))['then'](function(_0x34cc18){if(_0x34cc18){return _0x34cc18['removeAgents'](_0x3c01ae[_0x49be('0x41')][_0x49be('0x86')])['then'](function(){if(_[_0x49be('0x9f')](_0x3c01ae['query'][_0x49be('0x86')])){for(var _0x185d4e=0x0;_0x185d4e<_0x3c01ae[_0x49be('0x41')]['ids']['length'];_0x185d4e+=0x1){socket[_0x49be('0x9c')](_0x49be('0x99'),{'UserId':Number(_0x3c01ae[_0x49be('0x41')][_0x49be('0x86')][_0x185d4e]),'VoiceQueueId':Number(_0x3c01ae[_0x49be('0x64')]['id'])});}}else{socket[_0x49be('0x9c')](_0x49be('0x99'),{'UserId':Number(_0x3c01ae[_0x49be('0x41')][_0x49be('0x86')]),'VoiceQueueId':Number(_0x3c01ae[_0x49be('0x64')]['id'])});}});}})[_0x49be('0x2b')](function(_0x36bb38){return db[_0x49be('0x98')]['destroy']({'where':{'VoiceQueueId':_0x3c01ae[_0x49be('0x64')]['id'],'UserId':_0x3c01ae[_0x49be('0x41')]['ids']}})['then'](function(){return _0x36bb38;});})[_0x49be('0x2b')](respondWithStatusCode(_0x471492,null))['catch'](handleError(_0x471492,null));};exports[_0x49be('0xa0')]=function(_0x508f99,_0x2b927b,_0x184f6d){var _0x306449={};var _0x19a930={};var _0x1a3aa1;var _0x5b56ce;return db[_0x49be('0x3d')]['findOne']({'where':{'id':_0x508f99[_0x49be('0x64')]['id']}})['then'](handleEntityNotFound(_0x2b927b,null))['then'](function(_0x474929){if(_0x474929){_0x1a3aa1=_0x474929;_0x19a930[_0x49be('0x40')]=_['keys'](db[_0x49be('0x74')][_0x49be('0x3e')]);_0x19a930[_0x49be('0x41')]=_[_0x49be('0x5e')](_0x508f99[_0x49be('0x41')]);_0x19a930[_0x49be('0x42')]=_[_0x49be('0x43')](_0x19a930[_0x49be('0x40')],_0x19a930[_0x49be('0x41')]);_0x306449[_0x49be('0x45')]=_[_0x49be('0x43')](_0x19a930[_0x49be('0x40')],qs['fields'](_0x508f99[_0x49be('0x41')][_0x49be('0x44')]));_0x306449['attributes']=_0x306449[_0x49be('0x45')]['length']?_0x306449[_0x49be('0x45')]:_0x19a930[_0x49be('0x40')];_0x306449[_0x49be('0x48')]=qs[_0x49be('0x49')](_0x508f99[_0x49be('0x41')][_0x49be('0x49')]);_0x306449[_0x49be('0x4a')]=qs[_0x49be('0x42')](_[_0x49be('0x4b')](_0x508f99[_0x49be('0x41')],_0x19a930[_0x49be('0x42')]));if(_0x508f99[_0x49be('0x41')][_0x49be('0x31')]){_0x306449['where']=_[_0x49be('0x4c')](_0x306449[_0x49be('0x4a')],{'$or':_['map'](_0x306449[_0x49be('0x45')],function(_0x54a9ee){var _0x3c1022={};_0x3c1022[_0x54a9ee]={'$like':'%'+_0x508f99[_0x49be('0x41')]['filter']+'%'};return _0x3c1022;})});}_0x306449=_[_0x49be('0x4c')]({},_0x306449,_0x508f99['options']);return _0x1a3aa1[_0x49be('0xa0')](_0x306449);}})['then'](function(_0x52980e){if(_0x52980e){_0x5b56ce=_0x52980e[_0x49be('0x46')];if(!_0x508f99[_0x49be('0x41')][_0x49be('0x68')]('nolimit')){_0x306449[_0x49be('0x22')]=qs[_0x49be('0x22')](_0x508f99['query']['limit']);_0x306449[_0x49be('0x20')]=qs[_0x49be('0x20')](_0x508f99['query'][_0x49be('0x20')]);}return _0x1a3aa1[_0x49be('0xa0')](_0x306449);}})['then'](function(_0x2a1d83){if(_0x2a1d83){return _0x2a1d83?{'count':_0x5b56ce,'rows':_0x2a1d83}:null;}})[_0x49be('0x2b')](respondWithResult(_0x2b927b,null))[_0x49be('0x52')](handleError(_0x2b927b,null));};exports[_0x49be('0xa1')]=function(_0x1a09d2,_0x48d4d0,_0x4af51b){var _0x2902aa={};var _0xaee3a4={};var _0x40a083;var _0x286c9f;return db[_0x49be('0x3d')][_0x49be('0x66')]({'where':{'id':_0x1a09d2['params']['id']}})[_0x49be('0x2b')](handleEntityNotFound(_0x48d4d0,null))[_0x49be('0x2b')](function(_0x5669f7){if(_0x5669f7){_0x40a083=_0x5669f7;_0xaee3a4[_0x49be('0x40')]=_[_0x49be('0x5e')](db[_0x49be('0x98')][_0x49be('0x3e')]);_0xaee3a4[_0x49be('0x41')]=_['keys'](_0x1a09d2[_0x49be('0x41')]);_0xaee3a4[_0x49be('0x42')]=_[_0x49be('0x43')](_0xaee3a4[_0x49be('0x40')],_0xaee3a4[_0x49be('0x41')]);_0x2902aa['attributes']=_[_0x49be('0x43')](_0xaee3a4[_0x49be('0x40')],qs[_0x49be('0x44')](_0x1a09d2[_0x49be('0x41')][_0x49be('0x44')]));_0x2902aa[_0x49be('0x45')]=_0x2902aa[_0x49be('0x45')]['length']?_0x2902aa[_0x49be('0x45')]:_0xaee3a4[_0x49be('0x40')];_0x2902aa['order']=qs[_0x49be('0x49')](_0x1a09d2[_0x49be('0x41')][_0x49be('0x49')]);_0x2902aa['where']=qs[_0x49be('0x42')](_[_0x49be('0x4b')](_0x1a09d2[_0x49be('0x41')],_0xaee3a4[_0x49be('0x42')]));if(_0x1a09d2[_0x49be('0x41')]['filter']){_0x2902aa[_0x49be('0x4a')]=_['merge'](_0x2902aa['where'],{'$or':_[_0x49be('0x33')](_0x2902aa[_0x49be('0x45')],function(_0xe718d2){var _0x277bdc={};_0x277bdc[_0xe718d2]={'$like':'%'+_0x1a09d2[_0x49be('0x41')][_0x49be('0x31')]+'%'};return _0x277bdc;})});}_0x2902aa=_[_0x49be('0x4c')]({},_0x2902aa,_0x1a09d2['options']);return _0x40a083['getMembers'](_0x2902aa);}})[_0x49be('0x2b')](function(_0x47448d){if(_0x47448d){_0x286c9f=_0x47448d[_0x49be('0x46')];if(!_0x1a09d2[_0x49be('0x41')]['hasOwnProperty']('nolimit')){_0x2902aa['limit']=qs[_0x49be('0x22')](_0x1a09d2[_0x49be('0x41')]['limit']);_0x2902aa[_0x49be('0x20')]=qs['offset'](_0x1a09d2['query'][_0x49be('0x20')]);}return _0x40a083[_0x49be('0xa1')](_0x2902aa);}})['then'](function(_0x4a9501){return _0x4a9501?{'count':_0x286c9f,'rows':_0x4a9501}:null;})[_0x49be('0x2b')](respondWithResult(_0x48d4d0,null))[_0x49be('0x52')](handleError(_0x48d4d0,null));};exports[_0x49be('0xa2')]=function(_0x39c1b6,_0x1f38a1,_0x45dda7){var _0x31932a={};var _0x24ad71={};var _0x3f423a;var _0x9d01dd;return db[_0x49be('0x3d')][_0x49be('0x66')]({'where':{'id':_0x39c1b6[_0x49be('0x64')]['id']}})[_0x49be('0x2b')](handleEntityNotFound(_0x1f38a1,null))[_0x49be('0x2b')](function(_0x164847){if(_0x164847){_0x3f423a=_0x164847;_0x24ad71['model']=_[_0x49be('0x5e')](db[_0x49be('0xa3')][_0x49be('0x3e')]);_0x24ad71[_0x49be('0x41')]=_[_0x49be('0x5e')](_0x39c1b6[_0x49be('0x41')]);_0x24ad71[_0x49be('0x42')]=_[_0x49be('0x43')](_0x24ad71[_0x49be('0x40')],_0x24ad71[_0x49be('0x41')]);_0x31932a[_0x49be('0x45')]=_['intersection'](_0x24ad71[_0x49be('0x40')],qs['fields'](_0x39c1b6['query'][_0x49be('0x44')]));_0x31932a[_0x49be('0x45')]=_0x31932a[_0x49be('0x45')][_0x49be('0x46')]?_0x31932a[_0x49be('0x45')]:_0x24ad71[_0x49be('0x40')];_0x31932a[_0x49be('0x48')]=qs[_0x49be('0x49')](_0x39c1b6[_0x49be('0x41')]['sort']);_0x31932a[_0x49be('0x4a')]=qs[_0x49be('0x42')](_[_0x49be('0x4b')](_0x39c1b6[_0x49be('0x41')],_0x24ad71[_0x49be('0x42')]));if(_0x39c1b6['query'][_0x49be('0x31')]){_0x31932a[_0x49be('0x4a')]=_[_0x49be('0x4c')](_0x31932a[_0x49be('0x4a')],{'$or':_[_0x49be('0x33')](_0x31932a[_0x49be('0x45')],function(_0x224d81){var _0x40b15b={};_0x40b15b[_0x224d81]={'$like':'%'+_0x39c1b6[_0x49be('0x41')][_0x49be('0x31')]+'%'};return _0x40b15b;})});}_0x31932a=_[_0x49be('0x4c')]({},_0x31932a,_0x39c1b6[_0x49be('0x4e')]);return _0x3f423a[_0x49be('0xa2')](_0x31932a);}})[_0x49be('0x2b')](function(_0x449cf6){if(_0x449cf6){_0x9d01dd=_0x449cf6[_0x49be('0x46')];if(!_0x39c1b6[_0x49be('0x41')][_0x49be('0x68')](_0x49be('0x47'))){_0x31932a[_0x49be('0x22')]=qs[_0x49be('0x22')](_0x39c1b6[_0x49be('0x41')][_0x49be('0x22')]);_0x31932a[_0x49be('0x20')]=qs[_0x49be('0x20')](_0x39c1b6['query'][_0x49be('0x20')]);}return _0x3f423a[_0x49be('0xa2')](_0x31932a);}})[_0x49be('0x2b')](function(_0x270111){if(_0x270111){return _0x270111?{'count':_0x9d01dd,'rows':_0x270111}:null;}})[_0x49be('0x2b')](respondWithResult(_0x1f38a1,null))[_0x49be('0x52')](handleError(_0x1f38a1,null));};exports[_0x49be('0xa4')]=function(_0x311f60,_0x361c46,_0x1b6ea0){var _0x191b6e,_0x4c140c;return db[_0x49be('0x3d')][_0x49be('0x54')]({'where':{'id':_0x311f60[_0x49be('0x64')]['id']}})['then'](handleEntityNotFound(_0x361c46,null))[_0x49be('0x2b')](function(_0x5e976d){if(_0x5e976d){_0x4c140c=_0x5e976d;return _0x5e976d[_0x49be('0xa4')](_0x311f60[_0x49be('0x61')][_0x49be('0x86')],_[_0x49be('0x5f')](_0x311f60['body'],['ids','id'])||{});}return null;})[_0x49be('0x9b')](function(_0x3c8118){var _0x4b4fd7;_0x191b6e=_0x3c8118||[];var _0x1cb869=[];if(_0x3c8118){for(var _0x57a165=0x0;_0x57a165<_0x3c8118[_0x49be('0x46')];_0x57a165+=0x1){var _0x49e0d6=_0x3c8118[_0x57a165][_0x49be('0x2d')]({'plain':!![]});_0x4c140c[_0x49be('0xa5')]=_0x311f60[_0x49be('0x61')][_0x49be('0xa5')]?_0x311f60[_0x49be('0x61')][_0x49be('0xa5')]:_0x4c140c[_0x49be('0xa5')];switch(_0x4c140c[_0x49be('0xa5')]){case'always':_0x4b4fd7=squel[_0x49be('0xa6')]()[_0x49be('0xa7')]('cm_hopper')[_0x49be('0xa8')]([_0x49be('0xa9'),_0x49be('0xaa'),_0x49be('0xab'),_0x49be('0xac'),_0x49be('0x69'),_0x49be('0x60'),_0x49be('0x62')],squel[_0x49be('0x87')]()[_0x49be('0x88')](_0x49be('0xa9'),'phone')[_0x49be('0x88')](_0x49be('0xad'),_0x49be('0xaa'))[_0x49be('0x88')]('id',_0x49be('0xab'))[_0x49be('0x88')](_0x49e0d6[_0x49be('0xae')]['toString'](),_0x49be('0xac'))[_0x49be('0x88')](_0x311f60['params']['id'][_0x49be('0x8f')](),_0x49be('0x69'))[_0x49be('0x88')](_0x49be('0xad'),_0x49be('0x60'))[_0x49be('0x88')](_0x49be('0xad'),_0x49be('0x62'))[_0x49be('0x89')]('cm_contacts')[_0x49be('0x4a')](_0x49be('0xaf'))[_0x49be('0x4a')](_0x49be('0xb0'),_0x49e0d6[_0x49be('0xae')][_0x49be('0x8f')]())[_0x49be('0x4a')](_0x49be('0xb1'))[_0x49be('0x4a')](_0x49be('0xb2'),squel[_0x49be('0x87')]()['field'](_0x49be('0xb3'))[_0x49be('0x89')](_0x49be('0xb4'))['where'](_0x49be('0x8d'),_0x311f60[_0x49be('0x64')]['id'][_0x49be('0x8f')]()))['where'](_0x49be('0xb2'),squel['select']()[_0x49be('0x88')](_0x49be('0xb5'))[_0x49be('0x89')](_0x49be('0xb6'))[_0x49be('0x4a')](_0x49be('0x8d'),_0x311f60[_0x49be('0x64')]['id'][_0x49be('0x8f')]())))['toString']();break;case _0x49be('0xb7'):_0x4b4fd7=squel[_0x49be('0xa6')]()[_0x49be('0xa7')](_0x49be('0xb6'))[_0x49be('0xa8')]([_0x49be('0xa9'),_0x49be('0xaa'),_0x49be('0xab'),_0x49be('0xac'),_0x49be('0x69'),_0x49be('0x60'),_0x49be('0x62')],squel[_0x49be('0x87')]()[_0x49be('0x88')]('phone',_0x49be('0xa9'))['field']('NOW()',_0x49be('0xaa'))[_0x49be('0x88')]('id',_0x49be('0xab'))['field'](_0x49e0d6[_0x49be('0xae')]['toString'](),_0x49be('0xac'))[_0x49be('0x88')](_0x311f60[_0x49be('0x64')]['id']['toString'](),_0x49be('0x69'))[_0x49be('0x88')](_0x49be('0xad'),'createdAt')[_0x49be('0x88')]('NOW()',_0x49be('0x62'))[_0x49be('0x89')](_0x49be('0xb8'))[_0x49be('0x4a')](_0x49be('0xaf'))[_0x49be('0x4a')](_0x49be('0xb0'),_0x49e0d6[_0x49be('0xae')][_0x49be('0x8f')]())['where'](_0x49be('0xb1'))[_0x49be('0x4a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x49be('0x87')]()[_0x49be('0x88')](_0x49be('0xb5'))[_0x49be('0x89')]('cm_hopper')['where'](_0x49be('0x8d'),_0x311f60[_0x49be('0x64')]['id'][_0x49be('0x8f')]())))[_0x49be('0x8f')]();break;default:_0x4b4fd7=squel['insert']()[_0x49be('0xa7')](_0x49be('0xb6'))[_0x49be('0xa8')](['phone',_0x49be('0xaa'),'ContactId',_0x49be('0xac'),_0x49be('0x69'),_0x49be('0x60'),'updatedAt'],squel[_0x49be('0x87')]()[_0x49be('0x88')](_0x49be('0xa9'),'phone')[_0x49be('0x88')](_0x49be('0xad'),_0x49be('0xaa'))[_0x49be('0x88')]('id',_0x49be('0xab'))[_0x49be('0x88')](_0x49e0d6['CmListId'][_0x49be('0x8f')](),_0x49be('0xac'))[_0x49be('0x88')](_0x311f60['params']['id'][_0x49be('0x8f')](),_0x49be('0x69'))['field'](_0x49be('0xad'),'createdAt')[_0x49be('0x88')](_0x49be('0xad'),_0x49be('0x62'))[_0x49be('0x89')](_0x49be('0xb8'))[_0x49be('0x4a')](_0x49be('0xaf'))['where'](_0x49be('0xb0'),_0x49e0d6[_0x49be('0xae')][_0x49be('0x8f')]())[_0x49be('0x4a')](_0x49be('0xb1')))[_0x49be('0x8f')]();}_0x1cb869[_0x49be('0x9e')](db[_0x49be('0x7b')][_0x49be('0x41')](_0x4b4fd7));}return BPromise['all'](_0x1cb869);}})['then'](function(){return _0x191b6e;})[_0x49be('0x2b')](respondWithResult(_0x361c46,null))['catch'](handleError(_0x361c46,null));};exports[_0x49be('0xb9')]=function(_0x1935c3,_0x35c544,_0x4ba0d7){return db[_0x49be('0x3d')][_0x49be('0x54')]({'where':{'id':_0x1935c3[_0x49be('0x64')]['id']}})[_0x49be('0x2b')](handleEntityNotFound(_0x35c544,null))[_0x49be('0x2b')](function(_0x516cc1){if(_0x516cc1){return _0x516cc1[_0x49be('0xb9')](_0x1935c3['query']['ids']);}})[_0x49be('0x2b')](function(_0x1027cb){if(_0x1027cb){return db[_0x49be('0x67')][_0x49be('0x2c')]({'where':{'ListId':_0x1935c3['query'][_0x49be('0x86')],'VoiceQueueId':_0x1935c3[_0x49be('0x64')]['id']}})['then'](function(){return _0x1027cb;});}})[_0x49be('0x2b')](respondWithStatusCode(_0x35c544,null))['catch'](handleError(_0x35c544,null));};exports[_0x49be('0xba')]=function(_0x323903,_0x25ad79,_0x1e1a3d){var _0x1de282={};var _0x3b4849={};var _0x22446b;var _0x24c55e;return db[_0x49be('0x3d')][_0x49be('0x66')]({'where':{'id':_0x323903[_0x49be('0x64')]['id']}})[_0x49be('0x2b')](handleEntityNotFound(_0x25ad79,null))[_0x49be('0x2b')](function(_0x974f03){if(_0x974f03){_0x22446b=_0x974f03;_0x3b4849['model']=_[_0x49be('0x5e')](db['CmList']['rawAttributes']);_0x3b4849['query']=_[_0x49be('0x5e')](_0x323903['query']);_0x3b4849[_0x49be('0x42')]=_['intersection'](_0x3b4849[_0x49be('0x40')],_0x3b4849[_0x49be('0x41')]);_0x1de282[_0x49be('0x45')]=_['intersection'](_0x3b4849['model'],qs['fields'](_0x323903[_0x49be('0x41')][_0x49be('0x44')]));_0x1de282[_0x49be('0x45')]=_0x1de282['attributes'][_0x49be('0x46')]?_0x1de282[_0x49be('0x45')]:_0x3b4849[_0x49be('0x40')];_0x1de282[_0x49be('0x48')]=qs['sort'](_0x323903['query'][_0x49be('0x49')]);_0x1de282[_0x49be('0x4a')]=qs[_0x49be('0x42')](_[_0x49be('0x4b')](_0x323903[_0x49be('0x41')],_0x3b4849[_0x49be('0x42')]));if(_0x323903[_0x49be('0x41')][_0x49be('0x31')]){_0x1de282[_0x49be('0x4a')]=_[_0x49be('0x4c')](_0x1de282[_0x49be('0x4a')],{'$or':_[_0x49be('0x33')](_0x1de282['attributes'],function(_0x1407ca){var _0x472eee={};_0x472eee[_0x1407ca]={'$like':'%'+_0x323903[_0x49be('0x41')]['filter']+'%'};return _0x472eee;})});}_0x1de282=_[_0x49be('0x4c')]({},_0x1de282,_0x323903[_0x49be('0x4e')]);return _0x22446b[_0x49be('0xba')](_0x1de282);}})[_0x49be('0x2b')](function(_0x1e20c9){if(_0x1e20c9){_0x24c55e=_0x1e20c9[_0x49be('0x46')];if(!_0x323903['query'][_0x49be('0x68')]('nolimit')){_0x1de282['limit']=qs[_0x49be('0x22')](_0x323903[_0x49be('0x41')][_0x49be('0x22')]);_0x1de282['offset']=qs[_0x49be('0x20')](_0x323903[_0x49be('0x41')][_0x49be('0x20')]);}return _0x22446b[_0x49be('0xba')](_0x1de282);}})[_0x49be('0x2b')](function(_0x27381d){if(_0x27381d){return _0x27381d?{'count':_0x24c55e,'rows':_0x27381d}:null;}})[_0x49be('0x2b')](respondWithResult(_0x25ad79,null))[_0x49be('0x52')](handleError(_0x25ad79,null));};exports[_0x49be('0xbb')]=function(_0x24c3cd,_0x4f5251,_0x2d5085){var _0x11817d,_0x334aaa;return db[_0x49be('0x3d')]['find']({'where':{'id':_0x24c3cd[_0x49be('0x64')]['id']}})[_0x49be('0x2b')](handleEntityNotFound(_0x4f5251,null))[_0x49be('0x2b')](function(_0x177321){if(_0x177321){_0x334aaa=_0x177321;return _0x177321[_0x49be('0xbb')](_0x24c3cd[_0x49be('0x61')][_0x49be('0x86')],_[_0x49be('0x5f')](_0x24c3cd[_0x49be('0x61')],[_0x49be('0x86'),'id'])||{});}return null;})['spread'](function(_0x47873e){var _0x551f44;_0x11817d=_0x47873e||[];var _0xe79bae=[];if(_0x47873e){for(var _0x3273a9=0x0;_0x3273a9<_0x47873e[_0x49be('0x46')];_0x3273a9+=0x1){var _0x5859a2=_0x47873e[_0x3273a9]['get']({'plain':!![]});_0x551f44=squel['insert']()['into'](_0x49be('0xbc'))[_0x49be('0xa8')](['phone','ContactId',_0x49be('0xac'),'VoiceQueueId','createdAt',_0x49be('0x62')],squel[_0x49be('0x87')]()['field'](_0x49be('0xa9'),_0x49be('0xa9'))['field']('id',_0x49be('0xab'))[_0x49be('0x88')](_0x5859a2[_0x49be('0xae')]['toString'](),_0x49be('0xac'))['field'](_0x24c3cd[_0x49be('0x64')]['id'][_0x49be('0x8f')](),_0x49be('0x69'))[_0x49be('0x88')](_0x49be('0xad'),_0x49be('0x60'))['field'](_0x49be('0xad'),_0x49be('0x62'))[_0x49be('0x89')](_0x49be('0xb8'))[_0x49be('0x4a')](_0x49be('0xaf'))[_0x49be('0x4a')]('ListId\x20=\x20?',_0x5859a2[_0x49be('0xae')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x49be('0x8f')]();_0xe79bae['push'](db[_0x49be('0x7b')][_0x49be('0x41')](_0x551f44));}return BPromise['all'](_0xe79bae);}})[_0x49be('0x2b')](function(){return _0x11817d;})[_0x49be('0x2b')](respondWithResult(_0x4f5251,null))[_0x49be('0x52')](handleError(_0x4f5251,null));};exports['removeBlackLists']=function(_0x214d1d,_0x2996a2,_0x1e79ca){return db[_0x49be('0x3d')][_0x49be('0x54')]({'where':{'id':_0x214d1d[_0x49be('0x64')]['id']}})[_0x49be('0x2b')](handleEntityNotFound(_0x2996a2,null))[_0x49be('0x2b')](function(_0x53b5fc){if(_0x53b5fc){return _0x53b5fc['removeBlackLists'](_0x214d1d[_0x49be('0x41')][_0x49be('0x86')]);}})[_0x49be('0x2b')](function(_0x8ee2fa){if(_0x8ee2fa){return db[_0x49be('0x6f')][_0x49be('0x2c')]({'where':{'ListId':_0x214d1d[_0x49be('0x41')][_0x49be('0x86')],'VoiceQueueId':_0x214d1d[_0x49be('0x64')]['id']}})[_0x49be('0x2b')](function(){return _0x8ee2fa;});}})[_0x49be('0x2b')](respondWithStatusCode(_0x2996a2,null))[_0x49be('0x52')](handleError(_0x2996a2,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 7a0420e..df2befc 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 _0x0929=['exports','events','setMaxListeners','update','remove','emit','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0929,0x17b));var _0x9092=function(_0x48e4f2,_0x1b4b48){_0x48e4f2=_0x48e4f2-0x0;var _0x5de8eb=_0x0929[_0x48e4f2];return _0x5de8eb;};'use strict';var EventEmitter=require(_0x9092('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9092('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9092('0x2'),'afterDestroy':_0x9092('0x3')};function emitEvent(_0x5c8e4d){return function(_0xd2f307,_0x18683a,_0x25e28a){VoiceQueueEvents[_0x9092('0x4')](_0x5c8e4d+':'+_0xd2f307['id'],_0xd2f307);VoiceQueueEvents[_0x9092('0x4')](_0x5c8e4d,_0xd2f307);_0x25e28a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x9092('0x5')](e,emitEvent(event));}}module[_0x9092('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x604c=['VoiceQueue','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x5d9a35,_0x406f92){var _0x669f15=function(_0x30c64f){while(--_0x30c64f){_0x5d9a35['push'](_0x5d9a35['shift']());}};_0x669f15(++_0x406f92);}(_0x604c,0x115));var _0xc604=function(_0xa1df20,_0x1f3c48){_0xa1df20=_0xa1df20-0x0;var _0x26970e=_0x604c[_0xa1df20];return _0x26970e;};'use strict';var EventEmitter=require(_0xc604('0x0'));var VoiceQueue=require(_0xc604('0x1'))['db'][_0xc604('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xc604('0x3')](0x0);var events={'afterCreate':_0xc604('0x4'),'afterUpdate':_0xc604('0x5'),'afterDestroy':_0xc604('0x6')};function emitEvent(_0x452e24){return function(_0x1c1e31,_0x337b38,_0x5062ee){VoiceQueueEvents[_0xc604('0x7')](_0x452e24+':'+_0x1c1e31['id'],_0x1c1e31);VoiceQueueEvents[_0xc604('0x7')](_0x452e24,_0x1c1e31);_0x5062ee(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xc604('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index b07faee..bcad5de 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x464b97,_0xe0db95){var _0x45cdcd=function(_0x4f5d1e){while(--_0x4f5d1e){_0x464b97['push'](_0x464b97['shift']());}};_0x45cdcd(++_0xe0db95);}(_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 logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x6899c7,_0x363413){var _0x5186ee=function(_0x2f83a9){while(--_0x2f83a9){_0x6899c7['push'](_0x6899c7['shift']());}};_0x5186ee(++_0x363413);}(_0x3e74,0x175));var _0x43e7=function(_0x3fe406,_0x516846){_0x3fe406=_0x3fe406-0x0;var _0x35c3b3=_0x3e74[_0x3fe406];return _0x35c3b3;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 1f81c0f..d430906 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 _0x33ee=['lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','map','model','include','catch','find','raw','ShowVoiceQueue'];(function(_0x1b2bde,_0x32ea63){var _0x1743b9=function(_0x1202ca){while(--_0x1202ca){_0x1b2bde['push'](_0x1b2bde['shift']());}};_0x1743b9(++_0x32ea63);}(_0x33ee,0x1c3));var _0xe33e=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0x33ee[_0x41c381];return _0x427981;};'use strict';var _=require(_0xe33e('0x0'));var util=require(_0xe33e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe33e('0x2'));var db=require(_0xe33e('0x3'))['db'];var utils=require(_0xe33e('0x4'));var logger=require(_0xe33e('0x5'))(_0xe33e('0x6'));var config=require(_0xe33e('0x7'));var jayson=require(_0xe33e('0x8'));var client=jayson[_0xe33e('0x9')][_0xe33e('0xa')]({'port':0x232a});config['redis']=_[_0xe33e('0xb')](config[_0xe33e('0xc')],{'host':_0xe33e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe33e('0xc')]));require('./voiceQueue.socket')[_0xe33e('0xe')](socket);function respondWithRpcPromise(_0x52e447,_0x4a8826,_0x39acff){return new BPromise(function(_0x1dc4b4,_0x36c54f){return client[_0xe33e('0xf')](_0x52e447,_0x39acff)[_0xe33e('0x10')](function(_0x39883a){logger['info'](_0xe33e('0x11'),_0x4a8826,_0xe33e('0x12'));logger[_0xe33e('0x13')](_0xe33e('0x14'),_0x4a8826,_0xe33e('0x12'),JSON[_0xe33e('0x15')](_0x39883a));if(_0x39883a['error']){if(_0x39883a[_0xe33e('0x16')][_0xe33e('0x17')]===0x1f4){logger[_0xe33e('0x16')](_0xe33e('0x11'),_0x4a8826,_0x39883a[_0xe33e('0x16')]['message']);return _0x36c54f(_0x39883a[_0xe33e('0x16')][_0xe33e('0x18')]);}logger[_0xe33e('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x4a8826,_0x39883a[_0xe33e('0x16')][_0xe33e('0x18')]);return _0x1dc4b4(_0x39883a['error'][_0xe33e('0x18')]);}else{logger[_0xe33e('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x4a8826,_0xe33e('0x12'));_0x1dc4b4(_0x39883a[_0xe33e('0x1a')]['message']);}})['catch'](function(_0x459ea4){logger[_0xe33e('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x4a8826,_0x459ea4);_0x36c54f(_0x459ea4);});});}exports[_0xe33e('0x1b')]=function(_0x5b5131){var _0xd0e2c2=this;return new Promise(function(_0x434d52,_0x4204bd){return db[_0xe33e('0x1c')][_0xe33e('0x1d')]({'raw':_0x5b5131[_0xe33e('0x1e')]?_0x5b5131[_0xe33e('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x5b5131[_0xe33e('0x1e')]?_0x5b5131[_0xe33e('0x1e')][_0xe33e('0x1f')]||null:null,'attributes':_0x5b5131['options']?_0x5b5131[_0xe33e('0x1e')][_0xe33e('0x20')]||null:null,'limit':_0x5b5131['options']?_0x5b5131['options'][_0xe33e('0x21')]||null:null,'include':_0x5b5131['options']?_0x5b5131[_0xe33e('0x1e')]['include']?_[_0xe33e('0x22')](_0x5b5131[_0xe33e('0x1e')]['include'],function(_0x2d5d2e){return{'model':db[_0x2d5d2e[_0xe33e('0x23')]],'as':_0x2d5d2e['as'],'attributes':_0x2d5d2e[_0xe33e('0x20')],'include':_0x2d5d2e[_0xe33e('0x24')]?_[_0xe33e('0x22')](_0x2d5d2e[_0xe33e('0x24')],function(_0x2c53ba){return{'model':db[_0x2c53ba['model']],'as':_0x2c53ba['as'],'attributes':_0x2c53ba[_0xe33e('0x20')],'include':_0x2c53ba['include']?_['map'](_0x2c53ba[_0xe33e('0x24')],function(_0x28d9ea){return{'model':db[_0x28d9ea[_0xe33e('0x23')]],'as':_0x28d9ea['as'],'attributes':_0x28d9ea[_0xe33e('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe33e('0x10')](function(_0x21f1a8){logger['info']('GetVoiceQueue',_0x5b5131);logger[_0xe33e('0x13')](_0xe33e('0x1b'),_0x5b5131,JSON[_0xe33e('0x15')](_0x21f1a8));_0x434d52(_0x21f1a8);})[_0xe33e('0x25')](function(_0x35f08f){logger[_0xe33e('0x16')](_0xe33e('0x1b'),_0x35f08f['message'],_0x5b5131);_0x4204bd(_0xd0e2c2[_0xe33e('0x16')](0x1f4,_0x35f08f[_0xe33e('0x18')]));});});};exports['ShowVoiceQueue']=function(_0x1d5f4c){var _0x5543d5=this;return new Promise(function(_0xa51feb,_0x5d5c83){return db[_0xe33e('0x1c')][_0xe33e('0x26')]({'raw':_0x1d5f4c['options']?_0x1d5f4c[_0xe33e('0x1e')][_0xe33e('0x27')]===undefined?!![]:![]:!![],'where':_0x1d5f4c[_0xe33e('0x1e')]?_0x1d5f4c['options'][_0xe33e('0x1f')]||null:null,'attributes':_0x1d5f4c['options']?_0x1d5f4c[_0xe33e('0x1e')][_0xe33e('0x20')]||null:null,'include':_0x1d5f4c[_0xe33e('0x1e')]?_0x1d5f4c[_0xe33e('0x1e')][_0xe33e('0x24')]?_['map'](_0x1d5f4c[_0xe33e('0x1e')]['include'],function(_0x51301e){return{'model':db[_0x51301e[_0xe33e('0x23')]],'as':_0x51301e['as'],'attributes':_0x51301e[_0xe33e('0x20')],'include':_0x51301e['include']?_['map'](_0x51301e[_0xe33e('0x24')],function(_0x3783fe){return{'model':db[_0x3783fe['model']],'as':_0x3783fe['as'],'attributes':_0x3783fe['attributes'],'include':_0x3783fe[_0xe33e('0x24')]?_[_0xe33e('0x22')](_0x3783fe[_0xe33e('0x24')],function(_0x8a3f6f){return{'model':db[_0x8a3f6f[_0xe33e('0x23')]],'as':_0x8a3f6f['as'],'attributes':_0x8a3f6f[_0xe33e('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe33e('0x10')](function(_0x37191d){logger[_0xe33e('0x19')]('ShowVoiceQueue',_0x1d5f4c);logger[_0xe33e('0x13')]('ShowVoiceQueue',_0x1d5f4c,JSON[_0xe33e('0x15')](_0x37191d));_0xa51feb(_0x37191d);})['catch'](function(_0x127cf8){logger[_0xe33e('0x16')](_0xe33e('0x28'),_0x127cf8['message'],_0x1d5f4c);_0x5d5c83(_0x5543d5[_0xe33e('0x16')](0x1f4,_0x127cf8[_0xe33e('0x18')]));});});}; \ No newline at end of file +var _0x74aa=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceQueue','options','where','attributes','limit','include','model','map','find','raw','ShowVoiceQueue','lodash','util'];(function(_0x3fde30,_0x5ecc2e){var _0x56bec0=function(_0x41ad7a){while(--_0x41ad7a){_0x3fde30['push'](_0x3fde30['shift']());}};_0x56bec0(++_0x5ecc2e);}(_0x74aa,0x12e));var _0xa74a=function(_0x458448,_0xc5e1b1){_0x458448=_0x458448-0x0;var _0x55d57a=_0x74aa[_0x458448];return _0x55d57a;};'use strict';var _=require(_0xa74a('0x0'));var util=require(_0xa74a('0x1'));var moment=require('moment');var BPromise=require(_0xa74a('0x2'));var rs=require(_0xa74a('0x3'));var fs=require('fs');var Redis=require(_0xa74a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa74a('0x5'));var logger=require(_0xa74a('0x6'))('rpc');var config=require(_0xa74a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa74a('0x8')][_0xa74a('0x9')]({'port':0x232a});config[_0xa74a('0xa')]=_[_0xa74a('0xb')](config[_0xa74a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa74a('0xc'))(new Redis(config[_0xa74a('0xa')]));require(_0xa74a('0xd'))[_0xa74a('0xe')](socket);function respondWithRpcPromise(_0x4f1f46,_0x16f16c,_0x30b777){return new BPromise(function(_0x56796a,_0x294504){return client[_0xa74a('0xf')](_0x4f1f46,_0x30b777)[_0xa74a('0x10')](function(_0x478eb9){logger[_0xa74a('0x11')](_0xa74a('0x12'),_0x16f16c,_0xa74a('0x13'));logger[_0xa74a('0x14')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x16f16c,'request\x20sent',JSON[_0xa74a('0x15')](_0x478eb9));if(_0x478eb9['error']){if(_0x478eb9[_0xa74a('0x16')][_0xa74a('0x17')]===0x1f4){logger[_0xa74a('0x16')](_0xa74a('0x12'),_0x16f16c,_0x478eb9[_0xa74a('0x16')][_0xa74a('0x18')]);return _0x294504(_0x478eb9[_0xa74a('0x16')][_0xa74a('0x18')]);}logger[_0xa74a('0x16')](_0xa74a('0x12'),_0x16f16c,_0x478eb9[_0xa74a('0x16')]['message']);return _0x56796a(_0x478eb9[_0xa74a('0x16')][_0xa74a('0x18')]);}else{logger['info'](_0xa74a('0x12'),_0x16f16c,_0xa74a('0x13'));_0x56796a(_0x478eb9[_0xa74a('0x19')]['message']);}})[_0xa74a('0x1a')](function(_0x1dd9a4){logger[_0xa74a('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x16f16c,_0x1dd9a4);_0x294504(_0x1dd9a4);});});}exports[_0xa74a('0x1b')]=function(_0x47b7b3){var _0x5187fd=this;return new Promise(function(_0x4fe4eb,_0x50103d){return db['VoiceQueue']['findAll']({'raw':_0x47b7b3['options']?_0x47b7b3[_0xa74a('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x47b7b3['options']?_0x47b7b3[_0xa74a('0x1c')][_0xa74a('0x1d')]||null:null,'attributes':_0x47b7b3['options']?_0x47b7b3[_0xa74a('0x1c')][_0xa74a('0x1e')]||null:null,'limit':_0x47b7b3['options']?_0x47b7b3[_0xa74a('0x1c')][_0xa74a('0x1f')]||null:null,'include':_0x47b7b3['options']?_0x47b7b3[_0xa74a('0x1c')][_0xa74a('0x20')]?_['map'](_0x47b7b3[_0xa74a('0x1c')]['include'],function(_0x5e06af){return{'model':db[_0x5e06af[_0xa74a('0x21')]],'as':_0x5e06af['as'],'attributes':_0x5e06af['attributes'],'include':_0x5e06af[_0xa74a('0x20')]?_['map'](_0x5e06af['include'],function(_0x134405){return{'model':db[_0x134405['model']],'as':_0x134405['as'],'attributes':_0x134405[_0xa74a('0x1e')],'include':_0x134405[_0xa74a('0x20')]?_[_0xa74a('0x22')](_0x134405[_0xa74a('0x20')],function(_0x3604aa){return{'model':db[_0x3604aa[_0xa74a('0x21')]],'as':_0x3604aa['as'],'attributes':_0x3604aa[_0xa74a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa74a('0x10')](function(_0x1ff4e3){logger[_0xa74a('0x11')](_0xa74a('0x1b'),_0x47b7b3);logger['debug'](_0xa74a('0x1b'),_0x47b7b3,JSON[_0xa74a('0x15')](_0x1ff4e3));_0x4fe4eb(_0x1ff4e3);})[_0xa74a('0x1a')](function(_0x33520f){logger[_0xa74a('0x16')](_0xa74a('0x1b'),_0x33520f[_0xa74a('0x18')],_0x47b7b3);_0x50103d(_0x5187fd[_0xa74a('0x16')](0x1f4,_0x33520f[_0xa74a('0x18')]));});});};exports['ShowVoiceQueue']=function(_0x1fe2a6){var _0x3f71c9=this;return new Promise(function(_0x46e6b7,_0x5e9733){return db['VoiceQueue'][_0xa74a('0x23')]({'raw':_0x1fe2a6[_0xa74a('0x1c')]?_0x1fe2a6[_0xa74a('0x1c')][_0xa74a('0x24')]===undefined?!![]:![]:!![],'where':_0x1fe2a6['options']?_0x1fe2a6[_0xa74a('0x1c')][_0xa74a('0x1d')]||null:null,'attributes':_0x1fe2a6['options']?_0x1fe2a6[_0xa74a('0x1c')][_0xa74a('0x1e')]||null:null,'include':_0x1fe2a6[_0xa74a('0x1c')]?_0x1fe2a6[_0xa74a('0x1c')][_0xa74a('0x20')]?_['map'](_0x1fe2a6['options'][_0xa74a('0x20')],function(_0xc2e4a8){return{'model':db[_0xc2e4a8[_0xa74a('0x21')]],'as':_0xc2e4a8['as'],'attributes':_0xc2e4a8[_0xa74a('0x1e')],'include':_0xc2e4a8['include']?_[_0xa74a('0x22')](_0xc2e4a8[_0xa74a('0x20')],function(_0x105aaa){return{'model':db[_0x105aaa['model']],'as':_0x105aaa['as'],'attributes':_0x105aaa[_0xa74a('0x1e')],'include':_0x105aaa['include']?_[_0xa74a('0x22')](_0x105aaa[_0xa74a('0x20')],function(_0x43d2db){return{'model':db[_0x43d2db['model']],'as':_0x43d2db['as'],'attributes':_0x43d2db[_0xa74a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa74a('0x10')](function(_0x328425){logger['info']('ShowVoiceQueue',_0x1fe2a6);logger['debug'](_0xa74a('0x25'),_0x1fe2a6,JSON[_0xa74a('0x15')](_0x328425));_0x46e6b7(_0x328425);})['catch'](function(_0x5382cd){logger[_0xa74a('0x16')](_0xa74a('0x25'),_0x5382cd['message'],_0x1fe2a6);_0x5e9733(_0x3f71c9[_0xa74a('0x16')](0x1f4,_0x5382cd[_0xa74a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index ece6f38..e761c51 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 _0xf589=['length','voiceQueue:','./voiceQueue.events','save','update','emit','removeListener','register'];(function(_0x4a7ae8,_0xaef47e){var _0x45e44f=function(_0xd416e){while(--_0xd416e){_0x4a7ae8['push'](_0x4a7ae8['shift']());}};_0x45e44f(++_0xaef47e);}(_0xf589,0x8a));var _0x9f58=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf589[_0x432682];return _0x463d05;};'use strict';var VoiceQueueEvents=require(_0x9f58('0x0'));var events=[_0x9f58('0x1'),'remove',_0x9f58('0x2')];function createListener(_0x453586,_0x1ede0e){return function(_0x55aff6){_0x1ede0e[_0x9f58('0x3')](_0x453586,_0x55aff6);};}function removeListener(_0x201d2f,_0x31b556){return function(){VoiceQueueEvents[_0x9f58('0x4')](_0x201d2f,_0x31b556);};}exports[_0x9f58('0x5')]=function(_0x4323c4){for(var _0x565b1e=0x0,_0x20bb80=events[_0x9f58('0x6')];_0x565b1e<_0x20bb80;_0x565b1e++){var _0x5978e5=events[_0x565b1e];var _0x168868=createListener(_0x9f58('0x7')+_0x5978e5,_0x4323c4);VoiceQueueEvents['on'](_0x5978e5,_0x168868);}}; \ No newline at end of file +var _0x25f4=['./voiceQueue.events','remove','update','emit','removeListener','register','length'];(function(_0x48fffc,_0x5694f9){var _0x500c71=function(_0x3beb7f){while(--_0x3beb7f){_0x48fffc['push'](_0x48fffc['shift']());}};_0x500c71(++_0x5694f9);}(_0x25f4,0x1ce));var _0x425f=function(_0x4ca056,_0x5bd326){_0x4ca056=_0x4ca056-0x0;var _0x4afbdf=_0x25f4[_0x4ca056];return _0x4afbdf;};'use strict';var VoiceQueueEvents=require(_0x425f('0x0'));var events=['save',_0x425f('0x1'),_0x425f('0x2')];function createListener(_0x481918,_0x469a90){return function(_0x5062ce){_0x469a90[_0x425f('0x3')](_0x481918,_0x5062ce);};}function removeListener(_0x4e4c2a,_0x23e70){return function(){VoiceQueueEvents[_0x425f('0x4')](_0x4e4c2a,_0x23e70);};}exports[_0x425f('0x5')]=function(_0x57866f){for(var _0x45d785=0x0,_0x1b941a=events[_0x425f('0x6')];_0x45d785<_0x1b941a;_0x45d785++){var _0x17fbdf=events[_0x45d785];var _0x28327a=createListener('voiceQueue:'+_0x17fbdf,_0x57866f);VoiceQueueEvents['on'](_0x17fbdf,_0x28327a);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 29aec4b..f262e6a 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 _0xa617=['/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index'];(function(_0x24df34,_0x50aa1a){var _0x3980e8=function(_0x24c43f){while(--_0x24c43f){_0x24df34['push'](_0x24df34['shift']());}};_0x3980e8(++_0x50aa1a);}(_0xa617,0x90));var _0x7a61=function(_0x423fcc,_0x3c0dc9){_0x423fcc=_0x423fcc-0x0;var _0x109298=_0xa617[_0x423fcc];return _0x109298;};'use strict';var multer=require(_0x7a61('0x0'));var util=require(_0x7a61('0x1'));var path=require(_0x7a61('0x2'));var timeout=require(_0x7a61('0x3'));var express=require(_0x7a61('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7a61('0x5'));var config=require(_0x7a61('0x6'));var controller=require(_0x7a61('0x7'));router[_0x7a61('0x8')]('/',auth['isAuthenticated'](),controller[_0x7a61('0x9')]);router[_0x7a61('0x8')](_0x7a61('0xa'),auth[_0x7a61('0xb')](),controller[_0x7a61('0xc')]);router['get'](_0x7a61('0xd'),auth[_0x7a61('0xb')](),controller[_0x7a61('0xe')]);router[_0x7a61('0x8')](_0x7a61('0xf'),auth[_0x7a61('0xb')](),controller['show']);router[_0x7a61('0x10')]('/',auth['isAuthenticated'](),controller[_0x7a61('0x11')]);router['put'](_0x7a61('0xf'),auth[_0x7a61('0xb')](),controller[_0x7a61('0x12')]);router[_0x7a61('0x13')](_0x7a61('0xf'),auth[_0x7a61('0xb')](),controller[_0x7a61('0x14')]);module[_0x7a61('0x15')]=router; \ No newline at end of file +var _0x014e=['/index','getVoiceQueuesReport','/:id','show','create','put','delete','destroy','exports','multer','util','connect-timeout','fs-extra','get','isAuthenticated'];(function(_0x4c616c,_0x15a956){var _0x21cabd=function(_0x61f105){while(--_0x61f105){_0x4c616c['push'](_0x4c616c['shift']());}};_0x21cabd(++_0x15a956);}(_0x014e,0x180));var _0xe014=function(_0x50d042,_0x370c19){_0x50d042=_0x50d042-0x0;var _0x27b652=_0x014e[_0x50d042];return _0x27b652;};'use strict';var multer=require(_0xe014('0x0'));var util=require(_0xe014('0x1'));var path=require('path');var timeout=require(_0xe014('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe014('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0xe014('0x4')]('/',auth[_0xe014('0x5')](),controller['index']);router[_0xe014('0x4')]('/describe',auth[_0xe014('0x5')](),controller['describe']);router[_0xe014('0x4')](_0xe014('0x6'),auth['isAuthenticated'](),controller[_0xe014('0x7')]);router[_0xe014('0x4')](_0xe014('0x8'),auth[_0xe014('0x5')](),controller[_0xe014('0x9')]);router['post']('/',auth[_0xe014('0x5')](),controller[_0xe014('0xa')]);router[_0xe014('0xb')](_0xe014('0x8'),auth[_0xe014('0x5')](),controller['update']);router[_0xe014('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xe014('0xd')]);module[_0xe014('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 933b6e5..d2e5c50 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 _0xbe32=['INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds'];(function(_0x5b9648,_0x24a210){var _0xaf90e4=function(_0x57a1c8){while(--_0x57a1c8){_0x5b9648['push'](_0x5b9648['shift']());}};_0xaf90e4(++_0x24a210);}(_0xbe32,0xe1));var _0x2be3=function(_0x3c1a13,_0x386e50){_0x3c1a13=_0x3c1a13-0x0;var _0x483bb7=_0xbe32[_0x3c1a13];return _0x483bb7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2be3('0x0'));module[_0x2be3('0x1')]={'type':{'type':Sequelize[_0x2be3('0x2')]},'uniqueid':{'type':Sequelize[_0x2be3('0x2')]},'calleridnum':{'type':Sequelize[_0x2be3('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x2be3('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x2be3('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x2be3('0x3')],'set':function(_0x418f53){var _0x45c7c4=moment(_0x418f53);var _0x16caf1=moment(this[_0x2be3('0x4')](_0x2be3('0x5')))[_0x2be3('0x6')](_0x2be3('0x7'));var _0x5be91a=_0x45c7c4['diff'](_0x16caf1,_0x2be3('0x8'));this['setDataValue']('queuecallerleaveAt',_0x418f53);this['setDataValue']('holdtime',_0x5be91a||null);}},'position':{'type':Sequelize[_0x2be3('0x9')]},'count':{'type':Sequelize[_0x2be3('0x9')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2be3('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x2be3('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x2be3('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x2be3('0x2')],'comment':_0x2be3('0xb')},'originalposition':{'type':Sequelize[_0x2be3('0x9')]},'channel':{'type':Sequelize[_0x2be3('0x2')]},'connectedlinenum':{'type':Sequelize[_0x2be3('0x2')]},'connectedlinename':{'type':Sequelize[_0x2be3('0x2')]},'accountcode':{'type':Sequelize[_0x2be3('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x2be3('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x2be3('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2be3('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x2be3('0x2')]},'transfer':{'type':Sequelize[_0x2be3('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2be3('0x2')],'comment':_0x2be3('0xc')},'transferexten':{'type':Sequelize[_0x2be3('0x2')]},'transferuniqueid':{'type':Sequelize[_0x2be3('0x2')]},'disposition':{'type':Sequelize[_0x2be3('0x2')]},'secondDisposition':{'type':Sequelize[_0x2be3('0x2')]},'thirdDisposition':{'type':Sequelize[_0x2be3('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x2be3('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6ef3=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','diff','seconds','setDataValue','INTEGER'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x6ef3,0x1ca));var _0x36ef=function(_0x45158e,_0x2e0642){_0x45158e=_0x45158e-0x0;var _0x3abfff=_0x6ef3[_0x45158e];return _0x3abfff;};'use strict';var Sequelize=require(_0x36ef('0x0'));var moment=require('moment');module[_0x36ef('0x1')]={'type':{'type':Sequelize[_0x36ef('0x2')]},'uniqueid':{'type':Sequelize[_0x36ef('0x2')]},'calleridnum':{'type':Sequelize[_0x36ef('0x2')]},'calleridname':{'type':Sequelize[_0x36ef('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x36ef('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x36ef('0x3')],'set':function(_0x1718de){var _0x93313d=moment(_0x1718de);var _0x444611=moment(this[_0x36ef('0x4')](_0x36ef('0x5')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x577f29=_0x93313d[_0x36ef('0x6')](_0x444611,_0x36ef('0x7'));this[_0x36ef('0x8')]('queuecallerleaveAt',_0x1718de);this[_0x36ef('0x8')]('holdtime',_0x577f29||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x36ef('0x9')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x36ef('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x36ef('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x36ef('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x36ef('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x36ef('0x2')],'comment':_0x36ef('0xb')},'originalposition':{'type':Sequelize[_0x36ef('0x9')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x36ef('0x2')]},'connectedlinename':{'type':Sequelize[_0x36ef('0x2')]},'accountcode':{'type':Sequelize[_0x36ef('0x2')]},'context':{'type':Sequelize[_0x36ef('0x2')]},'exten':{'type':Sequelize[_0x36ef('0x2')]},'priority':{'type':Sequelize[_0x36ef('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x36ef('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x36ef('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x36ef('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x36ef('0x2')],'comment':_0x36ef('0xc')},'transferexten':{'type':Sequelize[_0x36ef('0x2')]},'transferuniqueid':{'type':Sequelize[_0x36ef('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x36ef('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x36ef('0x9')],'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 dcd528a..d3fdb3a 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 _0x6998=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','VoiceQueueReport','count','includeAll','include','rows','catch','show','keys','length','find','create','body','params','describe','findAll','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x39a4fd,_0x170525){var _0x5ce39c=function(_0x15034a){while(--_0x15034a){_0x39a4fd['push'](_0x39a4fd['shift']());}};_0x5ce39c(++_0x170525);}(_0x6998,0x95));var _0x8699=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x6998[_0xd0b415];return _0x2bdf2c;};'use strict';var emlformat=require(_0x8699('0x0'));var rimraf=require(_0x8699('0x1'));var zipdir=require(_0x8699('0x2'));var jsonpatch=require(_0x8699('0x3'));var rp=require(_0x8699('0x4'));var moment=require(_0x8699('0x5'));var BPromise=require(_0x8699('0x6'));var Mustache=require('mustache');var util=require(_0x8699('0x7'));var path=require(_0x8699('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8699('0x9'));var fs=require('fs');var fs_extra=require(_0x8699('0xa'));var _=require(_0x8699('0xb'));var squel=require(_0x8699('0xc'));var crypto=require(_0x8699('0xd'));var jsforce=require(_0x8699('0xe'));var deskjs=require(_0x8699('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8699('0x10'));var Papa=require(_0x8699('0x11'));var Redis=require('ioredis');var authService=require(_0x8699('0x12'));var qs=require(_0x8699('0x13'));var as=require(_0x8699('0x14'));var hardwareService=require(_0x8699('0x15'));var logger=require(_0x8699('0x16'))(_0x8699('0x17'));var utils=require('../../config/utils');var config=require(_0x8699('0x18'));var licenseUtil=require(_0x8699('0x19'));var db=require(_0x8699('0x1a'))['db'];config[_0x8699('0x1b')]=_[_0x8699('0x1c')](config['redis'],{'host':_0x8699('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8699('0x1b')]));require('./voiceQueueReport.socket')[_0x8699('0x1e')](socket);function respondWithStatusCode(_0x1f9a86,_0xea5e55){_0xea5e55=_0xea5e55||0xcc;return function(_0x589563){if(_0x589563){return _0x1f9a86[_0x8699('0x1f')](_0xea5e55);}return _0x1f9a86['status'](_0xea5e55)['end']();};}function respondWithResult(_0xe1a6b8,_0x3b09f6){_0x3b09f6=_0x3b09f6||0xc8;return function(_0xf35400){if(_0xf35400){return _0xe1a6b8[_0x8699('0x20')](_0x3b09f6)[_0x8699('0x21')](_0xf35400);}};}function respondWithFilteredResult(_0x3dfbf5,_0x2a136b){return function(_0x42202b){if(_0x42202b){var _0x46a2d1=typeof _0x2a136b[_0x8699('0x22')]===_0x8699('0x23')&&typeof _0x2a136b[_0x8699('0x24')]===_0x8699('0x23');var _0x2dc3fb=_0x42202b['count'];var _0x2d325e=_0x46a2d1?0x0:_0x2a136b[_0x8699('0x22')];var _0x5ee772=_0x46a2d1?_0x42202b['count']:_0x2a136b['offset']+_0x2a136b[_0x8699('0x24')];var _0x16b46c;if(_0x5ee772>=_0x2dc3fb){_0x5ee772=_0x2dc3fb;_0x16b46c=0xc8;}else{_0x16b46c=0xce;}_0x3dfbf5['status'](_0x16b46c);return _0x3dfbf5[_0x8699('0x25')](_0x8699('0x26'),_0x2d325e+'-'+_0x5ee772+'/'+_0x2dc3fb)[_0x8699('0x21')](_0x42202b);}return null;};}function patchUpdates(_0x29cbdb){return function(_0xa05383){try{jsonpatch[_0x8699('0x27')](_0xa05383,_0x29cbdb,!![]);}catch(_0x4e0205){return BPromise[_0x8699('0x28')](_0x4e0205);}return _0xa05383[_0x8699('0x29')]();};}function saveUpdates(_0x45e244,_0x19109f){return function(_0x1f043c){if(_0x1f043c){return _0x1f043c[_0x8699('0x2a')](_0x45e244)[_0x8699('0x2b')](function(_0x3c3893){return _0x3c3893;});}return null;};}function removeEntity(_0x5bd1ca,_0x9409cd){return function(_0x361844){if(_0x361844){return _0x361844[_0x8699('0x2c')]()[_0x8699('0x2b')](function(){_0x5bd1ca[_0x8699('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5c5e,_0x2c1118){return function(_0x31024f){if(!_0x31024f){_0x3c5c5e[_0x8699('0x1f')](0x194);}return _0x31024f;};}function handleError(_0x226910,_0x207279){_0x207279=_0x207279||0x1f4;return function(_0x105444){logger[_0x8699('0x2d')](_0x105444[_0x8699('0x2e')]);if(_0x105444[_0x8699('0x2f')]){delete _0x105444['name'];}_0x226910[_0x8699('0x20')](_0x207279)['send'](_0x105444);};}exports[_0x8699('0x30')]=function(_0x56e24b,_0x55ca69){var _0x3e514e={},_0x2773a4={},_0x53fbbe={'count':0x0,'rows':[]};var _0x581d09=_[_0x8699('0x31')](db['VoiceQueueReport'][_0x8699('0x32')],function(_0x526cad){return{'name':_0x526cad[_0x8699('0x33')],'type':_0x526cad[_0x8699('0x34')][_0x8699('0x35')]};});_0x2773a4['model']=_[_0x8699('0x31')](_0x581d09,'name');_0x2773a4[_0x8699('0x36')]=_['keys'](_0x56e24b['query']);_0x2773a4[_0x8699('0x37')]=_['intersection'](_0x2773a4[_0x8699('0x38')],_0x2773a4[_0x8699('0x36')]);_0x3e514e[_0x8699('0x39')]=_[_0x8699('0x3a')](_0x2773a4['model'],qs['fields'](_0x56e24b[_0x8699('0x36')][_0x8699('0x3b')]));_0x3e514e[_0x8699('0x39')]=_0x3e514e[_0x8699('0x39')]['length']?_0x3e514e[_0x8699('0x39')]:_0x2773a4['model'];if(!_0x56e24b[_0x8699('0x36')][_0x8699('0x3c')](_0x8699('0x3d'))){_0x3e514e[_0x8699('0x24')]=qs[_0x8699('0x24')](_0x56e24b[_0x8699('0x36')]['limit']);_0x3e514e[_0x8699('0x22')]=qs[_0x8699('0x22')](_0x56e24b[_0x8699('0x36')]['offset']);}_0x3e514e['order']=qs[_0x8699('0x3e')](_0x56e24b['query']['sort']);_0x3e514e[_0x8699('0x3f')]=qs[_0x8699('0x37')](_[_0x8699('0x40')](_0x56e24b[_0x8699('0x36')],_0x2773a4[_0x8699('0x37')]),_0x581d09);if(_0x56e24b[_0x8699('0x36')]['filter']){_0x3e514e[_0x8699('0x3f')]=_[_0x8699('0x41')](_0x3e514e[_0x8699('0x3f')],{'$or':_[_0x8699('0x31')](_0x581d09,function(_0x4111cd){if(_0x4111cd[_0x8699('0x34')]!==_0x8699('0x42')){var _0x40c6c9={};_0x40c6c9[_0x4111cd[_0x8699('0x2f')]]={'$like':'%'+_0x56e24b[_0x8699('0x36')][_0x8699('0x43')]+'%'};return _0x40c6c9;}})});}_0x3e514e=_[_0x8699('0x41')]({},_0x3e514e,_0x56e24b[_0x8699('0x44')]);var _0x5d143b={'where':_0x3e514e[_0x8699('0x3f')]};return db[_0x8699('0x45')]['count'](_0x5d143b)['then'](function(_0x16e3e2){_0x53fbbe[_0x8699('0x46')]=_0x16e3e2;if(_0x56e24b[_0x8699('0x36')][_0x8699('0x47')]){_0x3e514e[_0x8699('0x48')]=[{'all':!![]}];}return db[_0x8699('0x45')]['findAll'](_0x3e514e);})['then'](function(_0x54a7b8){_0x53fbbe[_0x8699('0x49')]=_0x54a7b8;return _0x53fbbe;})[_0x8699('0x2b')](respondWithFilteredResult(_0x55ca69,_0x3e514e))[_0x8699('0x4a')](handleError(_0x55ca69,null));};exports[_0x8699('0x4b')]=function(_0xcf10f4,_0x4144bd){var _0xaf82ad={'raw':![],'where':{'id':_0xcf10f4['params']['id']}},_0x98d73f={};_0x98d73f[_0x8699('0x38')]=_[_0x8699('0x4c')](db[_0x8699('0x45')][_0x8699('0x32')]);_0x98d73f['query']=_['keys'](_0xcf10f4[_0x8699('0x36')]);_0x98d73f[_0x8699('0x37')]=_[_0x8699('0x3a')](_0x98d73f[_0x8699('0x38')],_0x98d73f[_0x8699('0x36')]);_0xaf82ad[_0x8699('0x39')]=_['intersection'](_0x98d73f[_0x8699('0x38')],qs[_0x8699('0x3b')](_0xcf10f4[_0x8699('0x36')][_0x8699('0x3b')]));_0xaf82ad[_0x8699('0x39')]=_0xaf82ad[_0x8699('0x39')][_0x8699('0x4d')]?_0xaf82ad[_0x8699('0x39')]:_0x98d73f['model'];if(_0xcf10f4['query'][_0x8699('0x47')]){_0xaf82ad[_0x8699('0x48')]=[{'all':!![]}];}_0xaf82ad=_[_0x8699('0x41')]({},_0xaf82ad,_0xcf10f4['options']);return db[_0x8699('0x45')][_0x8699('0x4e')](_0xaf82ad)[_0x8699('0x2b')](handleEntityNotFound(_0x4144bd,null))['then'](respondWithResult(_0x4144bd,null))[_0x8699('0x4a')](handleError(_0x4144bd,null));};exports[_0x8699('0x4f')]=function(_0x2924b6,_0x39de2c){return db['VoiceQueueReport'][_0x8699('0x4f')](_0x2924b6[_0x8699('0x50')],{})['then'](respondWithResult(_0x39de2c,0xc9))[_0x8699('0x4a')](handleError(_0x39de2c,null));};exports['update']=function(_0x31d0ba,_0x427df4){if(_0x31d0ba[_0x8699('0x50')]['id']){delete _0x31d0ba[_0x8699('0x50')]['id'];}return db[_0x8699('0x45')][_0x8699('0x4e')]({'where':{'id':_0x31d0ba[_0x8699('0x51')]['id']}})[_0x8699('0x2b')](handleEntityNotFound(_0x427df4,null))[_0x8699('0x2b')](saveUpdates(_0x31d0ba[_0x8699('0x50')],null))['then'](respondWithResult(_0x427df4,null))['catch'](handleError(_0x427df4,null));};exports[_0x8699('0x2c')]=function(_0x150c06,_0x2eb402){return db['VoiceQueueReport'][_0x8699('0x4e')]({'where':{'id':_0x150c06[_0x8699('0x51')]['id']}})[_0x8699('0x2b')](handleEntityNotFound(_0x2eb402,null))[_0x8699('0x2b')](removeEntity(_0x2eb402,null))['catch'](handleError(_0x2eb402,null));};exports['describe']=function(_0x1f531c,_0x428e54){return db[_0x8699('0x45')][_0x8699('0x52')]()['then'](respondWithResult(_0x428e54,null))[_0x8699('0x4a')](handleError(_0x428e54,null));};exports['getVoiceQueuesReport']=function(_0x53e2a8,_0x5b1db7){var _0x1303e5={},_0x5ec25c={},_0x49cefc={'count':0x0,'rows':[]};_0x5ec25c[_0x8699('0x38')]=_[_0x8699('0x4c')](db[_0x8699('0x45')][_0x8699('0x32')]);_0x5ec25c[_0x8699('0x36')]=_[_0x8699('0x4c')](_0x53e2a8['query']);_0x5ec25c[_0x8699('0x37')]=_[_0x8699('0x3a')](_0x5ec25c[_0x8699('0x38')],_0x5ec25c['query']);_0x1303e5[_0x8699('0x39')]=_[_0x8699('0x3a')](_0x5ec25c[_0x8699('0x38')],qs['fields'](_0x53e2a8[_0x8699('0x36')][_0x8699('0x3b')]));_0x1303e5[_0x8699('0x39')]=_0x1303e5[_0x8699('0x39')][_0x8699('0x4d')]?_0x1303e5[_0x8699('0x39')]:_0x5ec25c[_0x8699('0x38')];if(!_0x53e2a8[_0x8699('0x36')][_0x8699('0x3c')](_0x8699('0x3d'))){_0x1303e5['limit']=qs[_0x8699('0x24')](_0x53e2a8[_0x8699('0x36')][_0x8699('0x24')]);_0x1303e5[_0x8699('0x22')]=qs['offset'](_0x53e2a8[_0x8699('0x36')][_0x8699('0x22')]);}_0x1303e5['order']=qs[_0x8699('0x3e')](_0x53e2a8['query'][_0x8699('0x3e')]);_0x1303e5['where']=qs[_0x8699('0x37')](_[_0x8699('0x40')](_0x53e2a8['query'],_0x5ec25c[_0x8699('0x37')]));if(_0x53e2a8[_0x8699('0x36')][_0x8699('0x43')]){_0x1303e5['where']=_[_0x8699('0x41')](_0x1303e5[_0x8699('0x3f')],{'$or':_['map'](_0x1303e5[_0x8699('0x39')],function(_0xf05f3d){var _0x30b5e5={};_0x30b5e5[_0xf05f3d]={'$like':'%'+_0x53e2a8[_0x8699('0x36')][_0x8699('0x43')]+'%'};return _0x30b5e5;})});}_0x1303e5=_[_0x8699('0x41')]({},_0x1303e5,_0x53e2a8['options']);var _0x2d8bc8={'where':_0x1303e5[_0x8699('0x3f')]};return db[_0x8699('0x45')][_0x8699('0x46')](_0x2d8bc8)[_0x8699('0x2b')](function(_0x2a08df){_0x49cefc[_0x8699('0x46')]=_0x2a08df;if(_0x53e2a8['query'][_0x8699('0x47')]){_0x1303e5['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x8699('0x53')](_0x1303e5);})['then'](function(_0x443c36){_0x49cefc[_0x8699('0x49')]=_0x443c36;return _0x49cefc;})[_0x8699('0x2b')](respondWithFilteredResult(_0x5b1db7,_0x1303e5,'getVoiceQueuesReport'))[_0x8699('0x4a')](handleError(_0x5b1db7,null,_0x8699('0x54')));}; \ No newline at end of file +var _0xb4f0=['params','rawAttributes','keys','find','create','body','update','describe','getVoiceQueuesReport','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','save','then','destroy','end','error','name','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','VoiceQueueReport','includeAll','include','findAll','rows','catch','show'];(function(_0x13ed26,_0x1b113e){var _0x1bdd62=function(_0xdfc6ba){while(--_0xdfc6ba){_0x13ed26['push'](_0x13ed26['shift']());}};_0x1bdd62(++_0x1b113e);}(_0xb4f0,0x14d));var _0x0b4f=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0xb4f0[_0x367e5b];return _0x4b909e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0b4f('0x0'));var jsonpatch=require(_0x0b4f('0x1'));var rp=require('request-promise');var moment=require(_0x0b4f('0x2'));var BPromise=require(_0x0b4f('0x3'));var Mustache=require(_0x0b4f('0x4'));var util=require(_0x0b4f('0x5'));var path=require(_0x0b4f('0x6'));var sox=require(_0x0b4f('0x7'));var csv=require(_0x0b4f('0x8'));var ejs=require(_0x0b4f('0x9'));var fs=require('fs');var fs_extra=require(_0x0b4f('0xa'));var _=require(_0x0b4f('0xb'));var squel=require('squel');var crypto=require(_0x0b4f('0xc'));var jsforce=require(_0x0b4f('0xd'));var deskjs=require(_0x0b4f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0b4f('0xf'));var Papa=require(_0x0b4f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0b4f('0x11'));var as=require(_0x0b4f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b4f('0x13'))(_0x0b4f('0x14'));var utils=require(_0x0b4f('0x15'));var config=require(_0x0b4f('0x16'));var licenseUtil=require(_0x0b4f('0x17'));var db=require(_0x0b4f('0x18'))['db'];config[_0x0b4f('0x19')]=_['defaults'](config[_0x0b4f('0x19')],{'host':_0x0b4f('0x1a'),'port':0x18eb});var socket=require(_0x0b4f('0x1b'))(new Redis(config['redis']));require(_0x0b4f('0x1c'))['register'](socket);function respondWithStatusCode(_0x37a286,_0x4ac0cf){_0x4ac0cf=_0x4ac0cf||0xcc;return function(_0x6242f4){if(_0x6242f4){return _0x37a286[_0x0b4f('0x1d')](_0x4ac0cf);}return _0x37a286[_0x0b4f('0x1e')](_0x4ac0cf)['end']();};}function respondWithResult(_0x345697,_0x662d7e){_0x662d7e=_0x662d7e||0xc8;return function(_0x1effae){if(_0x1effae){return _0x345697[_0x0b4f('0x1e')](_0x662d7e)[_0x0b4f('0x1f')](_0x1effae);}};}function respondWithFilteredResult(_0x27d49c,_0x49c05c){return function(_0x3f3ea9){if(_0x3f3ea9){var _0x57cb50=typeof _0x49c05c['offset']===_0x0b4f('0x20')&&typeof _0x49c05c['limit']==='undefined';var _0x3e84a9=_0x3f3ea9[_0x0b4f('0x21')];var _0xab9a02=_0x57cb50?0x0:_0x49c05c[_0x0b4f('0x22')];var _0x7e0a3d=_0x57cb50?_0x3f3ea9['count']:_0x49c05c['offset']+_0x49c05c[_0x0b4f('0x23')];var _0x52d29e;if(_0x7e0a3d>=_0x3e84a9){_0x7e0a3d=_0x3e84a9;_0x52d29e=0xc8;}else{_0x52d29e=0xce;}_0x27d49c[_0x0b4f('0x1e')](_0x52d29e);return _0x27d49c[_0x0b4f('0x24')]('Content-Range',_0xab9a02+'-'+_0x7e0a3d+'/'+_0x3e84a9)[_0x0b4f('0x1f')](_0x3f3ea9);}return null;};}function patchUpdates(_0x371781){return function(_0x1ad7d3){try{jsonpatch[_0x0b4f('0x25')](_0x1ad7d3,_0x371781,!![]);}catch(_0x448dc0){return BPromise[_0x0b4f('0x26')](_0x448dc0);}return _0x1ad7d3[_0x0b4f('0x27')]();};}function saveUpdates(_0x269327,_0x263571){return function(_0x1648fb){if(_0x1648fb){return _0x1648fb['update'](_0x269327)[_0x0b4f('0x28')](function(_0x296011){return _0x296011;});}return null;};}function removeEntity(_0x3b0dea,_0x419a8d){return function(_0x4fc5d6){if(_0x4fc5d6){return _0x4fc5d6[_0x0b4f('0x29')]()[_0x0b4f('0x28')](function(){_0x3b0dea[_0x0b4f('0x1e')](0xcc)[_0x0b4f('0x2a')]();});}};}function handleEntityNotFound(_0xd4c1d9,_0x39c720){return function(_0x23fd3e){if(!_0x23fd3e){_0xd4c1d9[_0x0b4f('0x1d')](0x194);}return _0x23fd3e;};}function handleError(_0x18f558,_0x3daafb){_0x3daafb=_0x3daafb||0x1f4;return function(_0x3e65bf){logger[_0x0b4f('0x2b')](_0x3e65bf['stack']);if(_0x3e65bf[_0x0b4f('0x2c')]){delete _0x3e65bf[_0x0b4f('0x2c')];}_0x18f558[_0x0b4f('0x1e')](_0x3daafb)['send'](_0x3e65bf);};}exports[_0x0b4f('0x2d')]=function(_0x5be3e9,_0x5b511e){var _0x74b38f={},_0x25c445={},_0x3c320e={'count':0x0,'rows':[]};var _0x269fb8=_[_0x0b4f('0x2e')](db['VoiceQueueReport']['rawAttributes'],function(_0x5cffa3){return{'name':_0x5cffa3[_0x0b4f('0x2f')],'type':_0x5cffa3[_0x0b4f('0x30')][_0x0b4f('0x31')]};});_0x25c445[_0x0b4f('0x32')]=_[_0x0b4f('0x2e')](_0x269fb8,_0x0b4f('0x2c'));_0x25c445['query']=_['keys'](_0x5be3e9[_0x0b4f('0x33')]);_0x25c445[_0x0b4f('0x34')]=_[_0x0b4f('0x35')](_0x25c445[_0x0b4f('0x32')],_0x25c445[_0x0b4f('0x33')]);_0x74b38f['attributes']=_[_0x0b4f('0x35')](_0x25c445[_0x0b4f('0x32')],qs[_0x0b4f('0x36')](_0x5be3e9['query'][_0x0b4f('0x36')]));_0x74b38f[_0x0b4f('0x37')]=_0x74b38f['attributes'][_0x0b4f('0x38')]?_0x74b38f[_0x0b4f('0x37')]:_0x25c445['model'];if(!_0x5be3e9['query'][_0x0b4f('0x39')](_0x0b4f('0x3a'))){_0x74b38f[_0x0b4f('0x23')]=qs['limit'](_0x5be3e9['query'][_0x0b4f('0x23')]);_0x74b38f[_0x0b4f('0x22')]=qs[_0x0b4f('0x22')](_0x5be3e9[_0x0b4f('0x33')][_0x0b4f('0x22')]);}_0x74b38f['order']=qs[_0x0b4f('0x3b')](_0x5be3e9[_0x0b4f('0x33')][_0x0b4f('0x3b')]);_0x74b38f['where']=qs[_0x0b4f('0x34')](_[_0x0b4f('0x3c')](_0x5be3e9['query'],_0x25c445[_0x0b4f('0x34')]),_0x269fb8);if(_0x5be3e9[_0x0b4f('0x33')][_0x0b4f('0x3d')]){_0x74b38f[_0x0b4f('0x3e')]=_[_0x0b4f('0x3f')](_0x74b38f[_0x0b4f('0x3e')],{'$or':_[_0x0b4f('0x2e')](_0x269fb8,function(_0x215e19){if(_0x215e19[_0x0b4f('0x30')]!=='VIRTUAL'){var _0x1f893d={};_0x1f893d[_0x215e19[_0x0b4f('0x2c')]]={'$like':'%'+_0x5be3e9[_0x0b4f('0x33')]['filter']+'%'};return _0x1f893d;}})});}_0x74b38f=_['merge']({},_0x74b38f,_0x5be3e9[_0x0b4f('0x40')]);var _0x44fe4c={'where':_0x74b38f[_0x0b4f('0x3e')]};return db[_0x0b4f('0x41')][_0x0b4f('0x21')](_0x44fe4c)['then'](function(_0x1d6ec8){_0x3c320e[_0x0b4f('0x21')]=_0x1d6ec8;if(_0x5be3e9[_0x0b4f('0x33')][_0x0b4f('0x42')]){_0x74b38f[_0x0b4f('0x43')]=[{'all':!![]}];}return db[_0x0b4f('0x41')][_0x0b4f('0x44')](_0x74b38f);})[_0x0b4f('0x28')](function(_0x453f7d){_0x3c320e[_0x0b4f('0x45')]=_0x453f7d;return _0x3c320e;})[_0x0b4f('0x28')](respondWithFilteredResult(_0x5b511e,_0x74b38f))[_0x0b4f('0x46')](handleError(_0x5b511e,null));};exports[_0x0b4f('0x47')]=function(_0x2ab870,_0x49a7f2){var _0x3e7ed6={'raw':![],'where':{'id':_0x2ab870[_0x0b4f('0x48')]['id']}},_0x46f589={};_0x46f589[_0x0b4f('0x32')]=_['keys'](db['VoiceQueueReport'][_0x0b4f('0x49')]);_0x46f589[_0x0b4f('0x33')]=_[_0x0b4f('0x4a')](_0x2ab870[_0x0b4f('0x33')]);_0x46f589['filters']=_[_0x0b4f('0x35')](_0x46f589['model'],_0x46f589[_0x0b4f('0x33')]);_0x3e7ed6[_0x0b4f('0x37')]=_['intersection'](_0x46f589[_0x0b4f('0x32')],qs['fields'](_0x2ab870[_0x0b4f('0x33')][_0x0b4f('0x36')]));_0x3e7ed6['attributes']=_0x3e7ed6[_0x0b4f('0x37')][_0x0b4f('0x38')]?_0x3e7ed6[_0x0b4f('0x37')]:_0x46f589['model'];if(_0x2ab870[_0x0b4f('0x33')][_0x0b4f('0x42')]){_0x3e7ed6[_0x0b4f('0x43')]=[{'all':!![]}];}_0x3e7ed6=_[_0x0b4f('0x3f')]({},_0x3e7ed6,_0x2ab870[_0x0b4f('0x40')]);return db[_0x0b4f('0x41')][_0x0b4f('0x4b')](_0x3e7ed6)[_0x0b4f('0x28')](handleEntityNotFound(_0x49a7f2,null))[_0x0b4f('0x28')](respondWithResult(_0x49a7f2,null))[_0x0b4f('0x46')](handleError(_0x49a7f2,null));};exports[_0x0b4f('0x4c')]=function(_0x37684d,_0x24170a){return db[_0x0b4f('0x41')][_0x0b4f('0x4c')](_0x37684d[_0x0b4f('0x4d')],{})[_0x0b4f('0x28')](respondWithResult(_0x24170a,0xc9))[_0x0b4f('0x46')](handleError(_0x24170a,null));};exports[_0x0b4f('0x4e')]=function(_0x6f6119,_0x180bf3){if(_0x6f6119[_0x0b4f('0x4d')]['id']){delete _0x6f6119[_0x0b4f('0x4d')]['id'];}return db[_0x0b4f('0x41')][_0x0b4f('0x4b')]({'where':{'id':_0x6f6119['params']['id']}})[_0x0b4f('0x28')](handleEntityNotFound(_0x180bf3,null))[_0x0b4f('0x28')](saveUpdates(_0x6f6119[_0x0b4f('0x4d')],null))[_0x0b4f('0x28')](respondWithResult(_0x180bf3,null))[_0x0b4f('0x46')](handleError(_0x180bf3,null));};exports[_0x0b4f('0x29')]=function(_0x2fdadc,_0x12293c){return db[_0x0b4f('0x41')][_0x0b4f('0x4b')]({'where':{'id':_0x2fdadc[_0x0b4f('0x48')]['id']}})[_0x0b4f('0x28')](handleEntityNotFound(_0x12293c,null))[_0x0b4f('0x28')](removeEntity(_0x12293c,null))[_0x0b4f('0x46')](handleError(_0x12293c,null));};exports[_0x0b4f('0x4f')]=function(_0x3d2e42,_0x3b5082){return db['VoiceQueueReport']['describe']()[_0x0b4f('0x28')](respondWithResult(_0x3b5082,null))[_0x0b4f('0x46')](handleError(_0x3b5082,null));};exports[_0x0b4f('0x50')]=function(_0x214d01,_0x16323b){var _0xe2daae={},_0x502315={},_0x36b7e4={'count':0x0,'rows':[]};_0x502315[_0x0b4f('0x32')]=_[_0x0b4f('0x4a')](db[_0x0b4f('0x41')][_0x0b4f('0x49')]);_0x502315[_0x0b4f('0x33')]=_[_0x0b4f('0x4a')](_0x214d01['query']);_0x502315['filters']=_[_0x0b4f('0x35')](_0x502315[_0x0b4f('0x32')],_0x502315[_0x0b4f('0x33')]);_0xe2daae[_0x0b4f('0x37')]=_['intersection'](_0x502315['model'],qs[_0x0b4f('0x36')](_0x214d01[_0x0b4f('0x33')][_0x0b4f('0x36')]));_0xe2daae[_0x0b4f('0x37')]=_0xe2daae['attributes'][_0x0b4f('0x38')]?_0xe2daae[_0x0b4f('0x37')]:_0x502315['model'];if(!_0x214d01[_0x0b4f('0x33')][_0x0b4f('0x39')](_0x0b4f('0x3a'))){_0xe2daae[_0x0b4f('0x23')]=qs[_0x0b4f('0x23')](_0x214d01[_0x0b4f('0x33')][_0x0b4f('0x23')]);_0xe2daae[_0x0b4f('0x22')]=qs['offset'](_0x214d01[_0x0b4f('0x33')]['offset']);}_0xe2daae['order']=qs[_0x0b4f('0x3b')](_0x214d01[_0x0b4f('0x33')]['sort']);_0xe2daae[_0x0b4f('0x3e')]=qs[_0x0b4f('0x34')](_['pick'](_0x214d01['query'],_0x502315['filters']));if(_0x214d01[_0x0b4f('0x33')][_0x0b4f('0x3d')]){_0xe2daae[_0x0b4f('0x3e')]=_[_0x0b4f('0x3f')](_0xe2daae[_0x0b4f('0x3e')],{'$or':_['map'](_0xe2daae[_0x0b4f('0x37')],function(_0xcedd46){var _0x423cec={};_0x423cec[_0xcedd46]={'$like':'%'+_0x214d01['query'][_0x0b4f('0x3d')]+'%'};return _0x423cec;})});}_0xe2daae=_[_0x0b4f('0x3f')]({},_0xe2daae,_0x214d01[_0x0b4f('0x40')]);var _0x110e6d={'where':_0xe2daae[_0x0b4f('0x3e')]};return db[_0x0b4f('0x41')][_0x0b4f('0x21')](_0x110e6d)['then'](function(_0x1c5c62){_0x36b7e4[_0x0b4f('0x21')]=_0x1c5c62;if(_0x214d01['query'][_0x0b4f('0x42')]){_0xe2daae['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x0b4f('0x44')](_0xe2daae);})[_0x0b4f('0x28')](function(_0x15f341){_0x36b7e4['rows']=_0x15f341;return _0x36b7e4;})[_0x0b4f('0x28')](respondWithFilteredResult(_0x16323b,_0xe2daae,'getVoiceQueuesReport'))[_0x0b4f('0x46')](handleError(_0x16323b,null,_0x0b4f('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index eb6036c..8b6373c 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 _0x4610=['remove','emit','hasOwnProperty','hook','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update'];(function(_0x141f96,_0x42d5ae){var _0x551225=function(_0x30b30c){while(--_0x30b30c){_0x141f96['push'](_0x141f96['shift']());}};_0x551225(++_0x42d5ae);}(_0x4610,0x15a));var _0x0461=function(_0x40b2ed,_0x2b1765){_0x40b2ed=_0x40b2ed-0x0;var _0x18397d=_0x4610[_0x40b2ed];return _0x18397d;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x0461('0x0'))['db'][_0x0461('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x0461('0x2')](0x0);var events={'afterCreate':_0x0461('0x3'),'afterUpdate':_0x0461('0x4'),'afterDestroy':_0x0461('0x5')};function emitEvent(_0x45256b){return function(_0x926f9c,_0xa5c871,_0x1d732d){VoiceQueueReportEvents[_0x0461('0x6')](_0x45256b+':'+_0x926f9c['id'],_0x926f9c);VoiceQueueReportEvents[_0x0461('0x6')](_0x45256b,_0x926f9c);_0x1d732d(null);};}for(var e in events){if(events[_0x0461('0x7')](e)){var event=events[e];VoiceQueueReport[_0x0461('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xe23e=['VoiceQueueReport','save','update','emit','exports','events','../../mysqldb'];(function(_0x5bff92,_0x49d24f){var _0xcaf413=function(_0x4af50e){while(--_0x4af50e){_0x5bff92['push'](_0x5bff92['shift']());}};_0xcaf413(++_0x49d24f);}(_0xe23e,0xe5));var _0xee23=function(_0x25eaea,_0x1a544c){_0x25eaea=_0x25eaea-0x0;var _0x59aa0a=_0xe23e[_0x25eaea];return _0x59aa0a;};'use strict';var EventEmitter=require(_0xee23('0x0'));var VoiceQueueReport=require(_0xee23('0x1'))['db'][_0xee23('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xee23('0x3'),'afterUpdate':_0xee23('0x4'),'afterDestroy':'remove'};function emitEvent(_0x198199){return function(_0x2a70ea,_0x546e6a,_0x377a98){VoiceQueueReportEvents['emit'](_0x198199+':'+_0x2a70ea['id'],_0x2a70ea);VoiceQueueReportEvents[_0xee23('0x5')](_0x198199,_0x2a70ea);_0x377a98(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xee23('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 4c1ddd0..b7797be 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 _0x20c2=['./voiceQueueReport.attributes','define','report_queue','calleridnum','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x2c4f9f,_0x54f77b){var _0x26df4a=function(_0x59f306){while(--_0x59f306){_0x2c4f9f['push'](_0x2c4f9f['shift']());}};_0x26df4a(++_0x54f77b);}(_0x20c2,0x185));var _0x220c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x20c2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x220c('0x0'));var util=require(_0x220c('0x1'));var logger=require(_0x220c('0x2'))('api');var moment=require(_0x220c('0x3'));var BPromise=require(_0x220c('0x4'));var rp=require(_0x220c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x220c('0x6'));var attributes=require(_0x220c('0x7'));module['exports']=function(_0x30b1e4,_0x4f4381){return _0x30b1e4[_0x220c('0x8')]('VoiceQueueReport',attributes,{'tableName':_0x220c('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x220c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9396=['calleridnum','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','uniqueid'];(function(_0x1e9e58,_0x2cb974){var _0x5eb5c3=function(_0xf6e4e9){while(--_0xf6e4e9){_0x1e9e58['push'](_0x1e9e58['shift']());}};_0x5eb5c3(++_0x2cb974);}(_0x9396,0x10b));var _0x6939=function(_0x1f4f26,_0x16c293){_0x1f4f26=_0x1f4f26-0x0;var _0x4e8d43=_0x9396[_0x1f4f26];return _0x4e8d43;};'use strict';var _=require(_0x6939('0x0'));var util=require('util');var logger=require(_0x6939('0x1'))(_0x6939('0x2'));var moment=require(_0x6939('0x3'));var BPromise=require(_0x6939('0x4'));var rp=require(_0x6939('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6939('0x6'));var config=require(_0x6939('0x7'));var attributes=require(_0x6939('0x8'));module['exports']=function(_0x6081f0,_0x226a9c){return _0x6081f0[_0x6939('0x9')](_0x6939('0xa'),attributes,{'tableName':_0x6939('0xb'),'paranoid':![],'indexes':[{'fields':[_0x6939('0xc')]},{'fields':[_0x6939('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 b72fcab..2eae21d 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 _0x4751=['util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./voiceQueueReport.socket','register','request','request\x20sent','debug','code','error','message','info','VoiceQueueReport,\x20%s,\x20%s','catch','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVoiceQueueReport','stringify','CreateVoiceQueueReport','body','update','UpdateVoiceQueueReport','lodash'];(function(_0x11fb47,_0x50fbf8){var _0xa0d270=function(_0x2d6c3e){while(--_0x2d6c3e){_0x11fb47['push'](_0x11fb47['shift']());}};_0xa0d270(++_0x50fbf8);}(_0x4751,0xef));var _0x1475=function(_0x4b334b,_0x1432ee){_0x4b334b=_0x4b334b-0x0;var _0x3b4e5d=_0x4751[_0x4b334b];return _0x3b4e5d;};'use strict';var _=require(_0x1475('0x0'));var util=require(_0x1475('0x1'));var moment=require(_0x1475('0x2'));var BPromise=require(_0x1475('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1475('0x4'));var logger=require(_0x1475('0x5'))('rpc');var config=require(_0x1475('0x6'));var jayson=require(_0x1475('0x7'));var client=jayson['client'][_0x1475('0x8')]({'port':0x232a});config[_0x1475('0x9')]=_[_0x1475('0xa')](config['redis'],{'host':_0x1475('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1475('0x9')]));require(_0x1475('0xc'))[_0x1475('0xd')](socket);function respondWithRpcPromise(_0x2700c4,_0x440cb3,_0x3bf737){return new BPromise(function(_0x35c32d,_0x2bf11e){return client[_0x1475('0xe')](_0x2700c4,_0x3bf737)['then'](function(_0x151812){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x440cb3,_0x1475('0xf'));logger[_0x1475('0x10')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x440cb3,_0x1475('0xf'),JSON['stringify'](_0x151812));if(_0x151812['error']){if(_0x151812['error'][_0x1475('0x11')]===0x1f4){logger[_0x1475('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x440cb3,_0x151812[_0x1475('0x12')][_0x1475('0x13')]);return _0x2bf11e(_0x151812[_0x1475('0x12')][_0x1475('0x13')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x440cb3,_0x151812[_0x1475('0x12')][_0x1475('0x13')]);return _0x35c32d(_0x151812['error'][_0x1475('0x13')]);}else{logger[_0x1475('0x14')](_0x1475('0x15'),_0x440cb3,'request\x20sent');_0x35c32d(_0x151812['result'][_0x1475('0x13')]);}})[_0x1475('0x16')](function(_0x4eb6c9){logger[_0x1475('0x12')](_0x1475('0x15'),_0x440cb3,_0x4eb6c9);_0x2bf11e(_0x4eb6c9);});});}exports['GetVoiceQueueReport']=function(_0x112b72){var _0x3b11b2=this;return new Promise(function(_0x2cbaf3,_0x31833a){return db[_0x1475('0x17')][_0x1475('0x18')]({'raw':_0x112b72[_0x1475('0x19')]?_0x112b72[_0x1475('0x19')][_0x1475('0x1a')]===undefined?!![]:![]:!![],'where':_0x112b72[_0x1475('0x19')]?_0x112b72['options'][_0x1475('0x1b')]||null:null,'attributes':_0x112b72[_0x1475('0x19')]?_0x112b72[_0x1475('0x19')][_0x1475('0x1c')]||null:null,'limit':_0x112b72[_0x1475('0x19')]?_0x112b72[_0x1475('0x19')][_0x1475('0x1d')]||null:null,'include':_0x112b72['options']?_0x112b72[_0x1475('0x19')][_0x1475('0x1e')]?_[_0x1475('0x1f')](_0x112b72[_0x1475('0x19')]['include'],function(_0xec634b){return{'model':db[_0xec634b['model']],'as':_0xec634b['as'],'attributes':_0xec634b['attributes'],'include':_0xec634b[_0x1475('0x1e')]?_[_0x1475('0x1f')](_0xec634b['include'],function(_0x42c22f){return{'model':db[_0x42c22f['model']],'as':_0x42c22f['as'],'attributes':_0x42c22f[_0x1475('0x1c')],'include':_0x42c22f[_0x1475('0x1e')]?_[_0x1475('0x1f')](_0x42c22f['include'],function(_0x157196){return{'model':db[_0x157196[_0x1475('0x20')]],'as':_0x157196['as'],'attributes':_0x157196[_0x1475('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1475('0x21')](function(_0x17b7cf){logger[_0x1475('0x14')](_0x1475('0x22'),_0x112b72);logger[_0x1475('0x10')](_0x1475('0x22'),_0x112b72,JSON[_0x1475('0x23')](_0x17b7cf));_0x2cbaf3(_0x17b7cf);})[_0x1475('0x16')](function(_0x2f7db7){logger['error'](_0x1475('0x22'),_0x2f7db7[_0x1475('0x13')],_0x112b72);_0x31833a(_0x3b11b2[_0x1475('0x12')](0x1f4,_0x2f7db7['message']));});});};exports[_0x1475('0x24')]=function(_0x1f819a){var _0x5679ce=this;return new Promise(function(_0x3daacc,_0x2d950d){return db[_0x1475('0x17')]['create'](_0x1f819a[_0x1475('0x25')],{'raw':_0x1f819a[_0x1475('0x19')]?_0x1f819a[_0x1475('0x19')][_0x1475('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x35953d){logger['info']('CreateVoiceQueueReport',_0x1f819a);logger['debug']('CreateVoiceQueueReport',_0x1f819a,JSON[_0x1475('0x23')](_0x35953d));_0x3daacc(_0x35953d);})[_0x1475('0x16')](function(_0x48fb9){logger[_0x1475('0x12')](_0x1475('0x24'),_0x48fb9['message'],_0x1f819a);_0x2d950d(_0x5679ce['error'](0x1f4,_0x48fb9['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x4ec62d){var _0xfa863=this;return new Promise(function(_0x3d9dc3,_0x49c36b){return db['VoiceQueueReport'][_0x1475('0x26')](_0x4ec62d[_0x1475('0x25')],{'raw':_0x4ec62d['options']?_0x4ec62d['options'][_0x1475('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ec62d[_0x1475('0x19')]?_0x4ec62d['options'][_0x1475('0x1b')]||null:null,'attributes':_0x4ec62d[_0x1475('0x19')]?_0x4ec62d['options'][_0x1475('0x1c')]||null:null,'limit':_0x4ec62d[_0x1475('0x19')]?_0x4ec62d[_0x1475('0x19')][_0x1475('0x1d')]||null:null})[_0x1475('0x21')](function(_0x31dfd9){logger['info'](_0x1475('0x27'),_0x4ec62d);logger['debug'](_0x1475('0x27'),_0x4ec62d,JSON[_0x1475('0x23')](_0x31dfd9));_0x3d9dc3(_0x31dfd9);})[_0x1475('0x16')](function(_0x989514){logger[_0x1475('0x12')](_0x1475('0x27'),_0x989514[_0x1475('0x13')],_0x4ec62d);_0x49c36b(_0xfa863[_0x1475('0x12')](0x1f4,_0x989514['message']));});});}; \ No newline at end of file +var _0xdac7=['options','raw','attributes','include','map','model','stringify','create','CreateVoiceQueueReport','catch','update','body','where','limit','UpdateVoiceQueueReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport'];(function(_0x5c9266,_0x158a9f){var _0x3e27ac=function(_0x3ec8d8){while(--_0x3ec8d8){_0x5c9266['push'](_0x5c9266['shift']());}};_0x3e27ac(++_0x158a9f);}(_0xdac7,0x15f));var _0x7dac=function(_0x1b21df,_0x136277){_0x1b21df=_0x1b21df-0x0;var _0x23f129=_0xdac7[_0x1b21df];return _0x23f129;};'use strict';var _=require(_0x7dac('0x0'));var util=require('util');var moment=require(_0x7dac('0x1'));var BPromise=require('bluebird');var rs=require(_0x7dac('0x2'));var fs=require('fs');var Redis=require(_0x7dac('0x3'));var db=require(_0x7dac('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7dac('0x5'))('rpc');var config=require(_0x7dac('0x6'));var jayson=require(_0x7dac('0x7'));var client=jayson[_0x7dac('0x8')][_0x7dac('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x7dac('0xa')],{'host':_0x7dac('0xb'),'port':0x18eb});var socket=require(_0x7dac('0xc'))(new Redis(config[_0x7dac('0xa')]));require(_0x7dac('0xd'))[_0x7dac('0xe')](socket);function respondWithRpcPromise(_0x2185bc,_0x428754,_0x9979b9){return new BPromise(function(_0x3f9e76,_0x2651d6){return client['request'](_0x2185bc,_0x9979b9)[_0x7dac('0xf')](function(_0x3d591b){logger[_0x7dac('0x10')](_0x7dac('0x11'),_0x428754,_0x7dac('0x12'));logger[_0x7dac('0x13')](_0x7dac('0x14'),_0x428754,'request\x20sent',JSON['stringify'](_0x3d591b));if(_0x3d591b[_0x7dac('0x15')]){if(_0x3d591b[_0x7dac('0x15')][_0x7dac('0x16')]===0x1f4){logger[_0x7dac('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x428754,_0x3d591b[_0x7dac('0x15')][_0x7dac('0x17')]);return _0x2651d6(_0x3d591b[_0x7dac('0x15')][_0x7dac('0x17')]);}logger[_0x7dac('0x15')](_0x7dac('0x11'),_0x428754,_0x3d591b[_0x7dac('0x15')][_0x7dac('0x17')]);return _0x3f9e76(_0x3d591b[_0x7dac('0x15')]['message']);}else{logger[_0x7dac('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x428754,_0x7dac('0x12'));_0x3f9e76(_0x3d591b[_0x7dac('0x18')][_0x7dac('0x17')]);}})['catch'](function(_0x52b566){logger[_0x7dac('0x15')](_0x7dac('0x11'),_0x428754,_0x52b566);_0x2651d6(_0x52b566);});});}exports[_0x7dac('0x19')]=function(_0x41cf32){var _0x3c3a52=this;return new Promise(function(_0x375e78,_0x2de647){return db[_0x7dac('0x1a')]['findAll']({'raw':_0x41cf32[_0x7dac('0x1b')]?_0x41cf32[_0x7dac('0x1b')][_0x7dac('0x1c')]===undefined?!![]:![]:!![],'where':_0x41cf32[_0x7dac('0x1b')]?_0x41cf32[_0x7dac('0x1b')]['where']||null:null,'attributes':_0x41cf32[_0x7dac('0x1b')]?_0x41cf32[_0x7dac('0x1b')][_0x7dac('0x1d')]||null:null,'limit':_0x41cf32[_0x7dac('0x1b')]?_0x41cf32['options']['limit']||null:null,'include':_0x41cf32[_0x7dac('0x1b')]?_0x41cf32[_0x7dac('0x1b')][_0x7dac('0x1e')]?_[_0x7dac('0x1f')](_0x41cf32[_0x7dac('0x1b')][_0x7dac('0x1e')],function(_0x2e9215){return{'model':db[_0x2e9215[_0x7dac('0x20')]],'as':_0x2e9215['as'],'attributes':_0x2e9215[_0x7dac('0x1d')],'include':_0x2e9215[_0x7dac('0x1e')]?_[_0x7dac('0x1f')](_0x2e9215[_0x7dac('0x1e')],function(_0x3e2227){return{'model':db[_0x3e2227[_0x7dac('0x20')]],'as':_0x3e2227['as'],'attributes':_0x3e2227[_0x7dac('0x1d')],'include':_0x3e2227['include']?_['map'](_0x3e2227[_0x7dac('0x1e')],function(_0x5409bf){return{'model':db[_0x5409bf[_0x7dac('0x20')]],'as':_0x5409bf['as'],'attributes':_0x5409bf[_0x7dac('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x142adf){logger['info'](_0x7dac('0x19'),_0x41cf32);logger[_0x7dac('0x13')](_0x7dac('0x19'),_0x41cf32,JSON[_0x7dac('0x21')](_0x142adf));_0x375e78(_0x142adf);})['catch'](function(_0x24affe){logger[_0x7dac('0x15')](_0x7dac('0x19'),_0x24affe[_0x7dac('0x17')],_0x41cf32);_0x2de647(_0x3c3a52[_0x7dac('0x15')](0x1f4,_0x24affe['message']));});});};exports['CreateVoiceQueueReport']=function(_0x48da61){var _0x2f9ff6=this;return new Promise(function(_0x32c56f,_0x2b7f06){return db[_0x7dac('0x1a')][_0x7dac('0x22')](_0x48da61['body'],{'raw':_0x48da61[_0x7dac('0x1b')]?_0x48da61[_0x7dac('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x7dac('0xf')](function(_0x1ca2bd){logger[_0x7dac('0x10')](_0x7dac('0x23'),_0x48da61);logger[_0x7dac('0x13')](_0x7dac('0x23'),_0x48da61,JSON[_0x7dac('0x21')](_0x1ca2bd));_0x32c56f(_0x1ca2bd);})[_0x7dac('0x24')](function(_0x5aa5d1){logger[_0x7dac('0x15')]('CreateVoiceQueueReport',_0x5aa5d1[_0x7dac('0x17')],_0x48da61);_0x2b7f06(_0x2f9ff6[_0x7dac('0x15')](0x1f4,_0x5aa5d1[_0x7dac('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x3503ef){var _0x4072c4=this;return new Promise(function(_0x2f63cc,_0x226d0a){return db[_0x7dac('0x1a')][_0x7dac('0x25')](_0x3503ef[_0x7dac('0x26')],{'raw':_0x3503ef[_0x7dac('0x1b')]?_0x3503ef[_0x7dac('0x1b')][_0x7dac('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3503ef[_0x7dac('0x1b')]?_0x3503ef['options'][_0x7dac('0x27')]||null:null,'attributes':_0x3503ef[_0x7dac('0x1b')]?_0x3503ef['options'][_0x7dac('0x1d')]||null:null,'limit':_0x3503ef[_0x7dac('0x1b')]?_0x3503ef[_0x7dac('0x1b')][_0x7dac('0x28')]||null:null})[_0x7dac('0xf')](function(_0x36df87){logger[_0x7dac('0x10')]('UpdateVoiceQueueReport',_0x3503ef);logger['debug'](_0x7dac('0x29'),_0x3503ef,JSON['stringify'](_0x36df87));_0x2f63cc(_0x36df87);})[_0x7dac('0x24')](function(_0x4581b6){logger[_0x7dac('0x15')](_0x7dac('0x29'),_0x4581b6[_0x7dac('0x17')],_0x3503ef);_0x226d0a(_0x4072c4[_0x7dac('0x15')](0x1f4,_0x4581b6['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 2c7d279..e1f312d 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 _0xfafd=['removeListener','register','length','voiceQueueReport:','save','remove','update','emit'];(function(_0x5e8422,_0xb949e2){var _0x4144b8=function(_0x49e171){while(--_0x49e171){_0x5e8422['push'](_0x5e8422['shift']());}};_0x4144b8(++_0xb949e2);}(_0xfafd,0xcc));var _0xdfaf=function(_0x525c2b,_0x140fd3){_0x525c2b=_0x525c2b-0x0;var _0x41edd6=_0xfafd[_0x525c2b];return _0x41edd6;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xdfaf('0x0'),_0xdfaf('0x1'),_0xdfaf('0x2')];function createListener(_0x3c7fd6,_0x2c31c9){return function(_0x28f37e){_0x2c31c9[_0xdfaf('0x3')](_0x3c7fd6,_0x28f37e);};}function removeListener(_0x2ca36c,_0x7e3bc7){return function(){VoiceQueueReportEvents[_0xdfaf('0x4')](_0x2ca36c,_0x7e3bc7);};}exports[_0xdfaf('0x5')]=function(_0x2ac56f){for(var _0x3b455a=0x0,_0x3bbc49=events[_0xdfaf('0x6')];_0x3b455a<_0x3bbc49;_0x3b455a++){var _0x57fcb8=events[_0x3b455a];var _0x19f205=createListener(_0xdfaf('0x7')+_0x57fcb8,_0x2ac56f);VoiceQueueReportEvents['on'](_0x57fcb8,_0x19f205);}}; \ No newline at end of file +var _0xc0aa=['removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0xc0aa,0x64));var _0xac0a=function(_0x2bcdcd,_0xae4100){_0x2bcdcd=_0x2bcdcd-0x0;var _0x28a76f=_0xc0aa[_0x2bcdcd];return _0x28a76f;};'use strict';var VoiceQueueReportEvents=require(_0xac0a('0x0'));var events=[_0xac0a('0x1'),_0xac0a('0x2'),_0xac0a('0x3')];function createListener(_0x19f5f6,_0x3bb217){return function(_0x3f960f){_0x3bb217['emit'](_0x19f5f6,_0x3f960f);};}function removeListener(_0x4de31a,_0x36dc47){return function(){VoiceQueueReportEvents[_0xac0a('0x4')](_0x4de31a,_0x36dc47);};}exports[_0xac0a('0x5')]=function(_0x344600){for(var _0x54b72f=0x0,_0x53d877=events[_0xac0a('0x6')];_0x54b72f<_0x53d877;_0x54b72f++){var _0x469929=events[_0x54b72f];var _0x2fa0cc=createListener(_0xac0a('0x7')+_0x469929,_0x344600);VoiceQueueReportEvents['on'](_0x469929,_0x2fa0cc);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 71df8ff..56eaa00 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 _0x94c9=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x40eb63,_0x202350){var _0x370c82=function(_0x3a54c6){while(--_0x3a54c6){_0x40eb63['push'](_0x40eb63['shift']());}};_0x370c82(++_0x202350);}(_0x94c9,0x1dd));var _0x994c=function(_0x1e7581,_0x25526e){_0x1e7581=_0x1e7581-0x0;var _0x51ad01=_0x94c9[_0x1e7581];return _0x51ad01;};'use strict';var multer=require(_0x994c('0x0'));var util=require(_0x994c('0x1'));var path=require(_0x994c('0x2'));var timeout=require('connect-timeout');var express=require(_0x994c('0x3'));var router=express[_0x994c('0x4')]();var fs_extra=require(_0x994c('0x5'));var auth=require(_0x994c('0x6'));var interaction=require(_0x994c('0x7'));var config=require('../../config/environment');var controller=require(_0x994c('0x8'));router[_0x994c('0x9')]('/',auth[_0x994c('0xa')](),controller[_0x994c('0xb')]);router[_0x994c('0x9')](_0x994c('0xc'),auth[_0x994c('0xa')](),controller[_0x994c('0xd')]);router['post']('/',auth[_0x994c('0xa')](),controller[_0x994c('0xe')]);router[_0x994c('0xf')](_0x994c('0xc'),auth[_0x994c('0xa')](),controller[_0x994c('0x10')]);router[_0x994c('0x11')](_0x994c('0xc'),auth[_0x994c('0xa')](),controller[_0x994c('0x12')]);module[_0x994c('0x13')]=router; \ No newline at end of file +var _0x36cf=['get','/:id','show','post','put','update','delete','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x36cf,0xbc));var _0xf36c=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x36cf[_0x4b2863];return _0x567d67;};'use strict';var multer=require(_0xf36c('0x0'));var util=require(_0xf36c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf36c('0x2'));var router=express['Router']();var fs_extra=require(_0xf36c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf36c('0x4'));var config=require(_0xf36c('0x5'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth[_0xf36c('0x6')](),controller['index']);router[_0xf36c('0x7')](_0xf36c('0x8'),auth['isAuthenticated'](),controller[_0xf36c('0x9')]);router[_0xf36c('0xa')]('/',auth[_0xf36c('0x6')](),controller['create']);router[_0xf36c('0xb')](_0xf36c('0x8'),auth[_0xf36c('0x6')](),controller[_0xf36c('0xc')]);router[_0xf36c('0xd')](_0xf36c('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xf36c('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 557f16e..25ef6dd 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 _0xa8f5=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','STRING'];(function(_0x3c6741,_0x24c6f0){var _0x5d3310=function(_0x504ffb){while(--_0x504ffb){_0x3c6741['push'](_0x3c6741['shift']());}};_0x5d3310(++_0x24c6f0);}(_0xa8f5,0xb1));var _0x5a8f=function(_0x245728,_0x1e8ca4){_0x245728=_0x245728-0x0;var _0x1be470=_0xa8f5[_0x245728];return _0x1be470;};'use strict';var Sequelize=require(_0x5a8f('0x0'));var moment=require(_0x5a8f('0x1'));module['exports']={'time':{'type':Sequelize[_0x5a8f('0x2')]},'callid':{'type':Sequelize[_0x5a8f('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x5a8f('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x5a8f('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x5a8f('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x5a8f('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x5a8f('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x5a8f('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x5a8f('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x5a8f('0x3')](_0x5a8f('0x4'))}}; \ No newline at end of file +var _0x8825=['format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING','DATE'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x8825,0x9e));var _0x5882=function(_0x205330,_0x529ffb){_0x205330=_0x205330-0x0;var _0x3498ac=_0x8825[_0x205330];return _0x3498ac;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5882('0x0'));module[_0x5882('0x1')]={'time':{'type':Sequelize[_0x5882('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x5882('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x5882('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x5882('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x5882('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x5882('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x5882('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x5882('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x5882('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x5882('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x5882('0x3')],'allowNull':![],'defaultValue':moment()[_0x5882('0x4')](_0x5882('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index d73e14d..e5064ab 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 _0x68db=['../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','stack','name','send','map','VoiceQueuesLog','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x68db,0x1d4));var _0xb68d=function(_0x1e730d,_0x405daf){_0x1e730d=_0x1e730d-0x0;var _0x412557=_0x68db[_0x1e730d];return _0x412557;};'use strict';var emlformat=require(_0xb68d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb68d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb68d('0x2'));var moment=require(_0xb68d('0x3'));var BPromise=require(_0xb68d('0x4'));var Mustache=require(_0xb68d('0x5'));var util=require(_0xb68d('0x6'));var path=require(_0xb68d('0x7'));var sox=require(_0xb68d('0x8'));var csv=require(_0xb68d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb68d('0xa'));var _=require(_0xb68d('0xb'));var squel=require('squel');var crypto=require(_0xb68d('0xc'));var jsforce=require(_0xb68d('0xd'));var deskjs=require(_0xb68d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb68d('0xf'));var Papa=require(_0xb68d('0x10'));var Redis=require('ioredis');var authService=require(_0xb68d('0x11'));var qs=require(_0xb68d('0x12'));var as=require(_0xb68d('0x13'));var hardwareService=require(_0xb68d('0x14'));var logger=require('../../config/logger')(_0xb68d('0x15'));var utils=require(_0xb68d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb68d('0x17'));var db=require(_0xb68d('0x18'))['db'];function respondWithStatusCode(_0xe1277e,_0x770608){_0x770608=_0x770608||0xcc;return function(_0x9719a6){if(_0x9719a6){return _0xe1277e['sendStatus'](_0x770608);}return _0xe1277e[_0xb68d('0x19')](_0x770608)[_0xb68d('0x1a')]();};}function respondWithResult(_0x26f9c2,_0x366e76){_0x366e76=_0x366e76||0xc8;return function(_0xbdefb1){if(_0xbdefb1){return _0x26f9c2[_0xb68d('0x19')](_0x366e76)[_0xb68d('0x1b')](_0xbdefb1);}};}function respondWithFilteredResult(_0x49cb41,_0x5adb6e){return function(_0x351ac4){if(_0x351ac4){var _0x37715b=typeof _0x5adb6e[_0xb68d('0x1c')]===_0xb68d('0x1d')&&typeof _0x5adb6e[_0xb68d('0x1e')]===_0xb68d('0x1d');var _0x1bd656=_0x351ac4[_0xb68d('0x1f')];var _0xdea0a7=_0x37715b?0x0:_0x5adb6e[_0xb68d('0x1c')];var _0x2d0a97=_0x37715b?_0x351ac4[_0xb68d('0x1f')]:_0x5adb6e['offset']+_0x5adb6e[_0xb68d('0x1e')];var _0x537374;if(_0x2d0a97>=_0x1bd656){_0x2d0a97=_0x1bd656;_0x537374=0xc8;}else{_0x537374=0xce;}_0x49cb41[_0xb68d('0x19')](_0x537374);return _0x49cb41['set'](_0xb68d('0x20'),_0xdea0a7+'-'+_0x2d0a97+'/'+_0x1bd656)['json'](_0x351ac4);}return null;};}function patchUpdates(_0x280f3b){return function(_0x5ddc3a){try{jsonpatch['apply'](_0x5ddc3a,_0x280f3b,!![]);}catch(_0x50f3a0){return BPromise['reject'](_0x50f3a0);}return _0x5ddc3a[_0xb68d('0x21')]();};}function saveUpdates(_0x22037d,_0x486ac4){return function(_0x387ff4){if(_0x387ff4){return _0x387ff4[_0xb68d('0x22')](_0x22037d)[_0xb68d('0x23')](function(_0x215439){return _0x215439;});}return null;};}function removeEntity(_0xe61af6,_0xe77687){return function(_0x4717ed){if(_0x4717ed){return _0x4717ed[_0xb68d('0x24')]()['then'](function(){_0xe61af6[_0xb68d('0x19')](0xcc)[_0xb68d('0x1a')]();});}};}function handleEntityNotFound(_0x46d0de,_0x4b60a1){return function(_0x217a36){if(!_0x217a36){_0x46d0de['sendStatus'](0x194);}return _0x217a36;};}function handleError(_0x10c0f5,_0xf40a2){_0xf40a2=_0xf40a2||0x1f4;return function(_0x2ef8ca){logger['error'](_0x2ef8ca[_0xb68d('0x25')]);if(_0x2ef8ca[_0xb68d('0x26')]){delete _0x2ef8ca[_0xb68d('0x26')];}_0x10c0f5[_0xb68d('0x19')](_0xf40a2)[_0xb68d('0x27')](_0x2ef8ca);};}exports['index']=function(_0x12871c,_0x54ca71){var _0x3d1517={},_0x22580a={},_0x598081={'count':0x0,'rows':[]};var _0x5e22fa=_[_0xb68d('0x28')](db[_0xb68d('0x29')]['rawAttributes'],function(_0x21b77f){return{'name':_0x21b77f[_0xb68d('0x2a')],'type':_0x21b77f[_0xb68d('0x2b')][_0xb68d('0x2c')]};});_0x22580a['model']=_[_0xb68d('0x28')](_0x5e22fa,_0xb68d('0x26'));_0x22580a[_0xb68d('0x2d')]=_[_0xb68d('0x2e')](_0x12871c[_0xb68d('0x2d')]);_0x22580a[_0xb68d('0x2f')]=_[_0xb68d('0x30')](_0x22580a[_0xb68d('0x31')],_0x22580a[_0xb68d('0x2d')]);_0x3d1517['attributes']=_[_0xb68d('0x30')](_0x22580a[_0xb68d('0x31')],qs['fields'](_0x12871c[_0xb68d('0x2d')][_0xb68d('0x32')]));_0x3d1517[_0xb68d('0x33')]=_0x3d1517[_0xb68d('0x33')][_0xb68d('0x34')]?_0x3d1517[_0xb68d('0x33')]:_0x22580a['model'];if(!_0x12871c['query']['hasOwnProperty']('nolimit')){_0x3d1517[_0xb68d('0x1e')]=qs[_0xb68d('0x1e')](_0x12871c[_0xb68d('0x2d')][_0xb68d('0x1e')]);_0x3d1517[_0xb68d('0x1c')]=qs['offset'](_0x12871c[_0xb68d('0x2d')]['offset']);}_0x3d1517['order']=qs[_0xb68d('0x35')](_0x12871c[_0xb68d('0x2d')][_0xb68d('0x35')]);_0x3d1517['where']=qs[_0xb68d('0x2f')](_[_0xb68d('0x36')](_0x12871c[_0xb68d('0x2d')],_0x22580a['filters']),_0x5e22fa);if(_0x12871c[_0xb68d('0x2d')][_0xb68d('0x37')]){_0x3d1517['where']=_[_0xb68d('0x38')](_0x3d1517[_0xb68d('0x39')],{'$or':_[_0xb68d('0x28')](_0x5e22fa,function(_0x3e8a3e){if(_0x3e8a3e[_0xb68d('0x2b')]!==_0xb68d('0x3a')){var _0x35d167={};_0x35d167[_0x3e8a3e[_0xb68d('0x26')]]={'$like':'%'+_0x12871c[_0xb68d('0x2d')][_0xb68d('0x37')]+'%'};return _0x35d167;}})});}_0x3d1517=_[_0xb68d('0x38')]({},_0x3d1517,_0x12871c[_0xb68d('0x3b')]);var _0x3192a8={'where':_0x3d1517[_0xb68d('0x39')]};return db['VoiceQueuesLog'][_0xb68d('0x1f')](_0x3192a8)[_0xb68d('0x23')](function(_0x3357d9){_0x598081[_0xb68d('0x1f')]=_0x3357d9;if(_0x12871c['query'][_0xb68d('0x3c')]){_0x3d1517[_0xb68d('0x3d')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xb68d('0x3e')](_0x3d1517);})['then'](function(_0x34668e){_0x598081[_0xb68d('0x3f')]=_0x34668e;return _0x598081;})[_0xb68d('0x23')](respondWithFilteredResult(_0x54ca71,_0x3d1517))[_0xb68d('0x40')](handleError(_0x54ca71,null));};exports[_0xb68d('0x41')]=function(_0xb022f,_0x21f604){var _0x5aa47a={'raw':!![],'where':{'id':_0xb022f[_0xb68d('0x42')]['id']}},_0x6fd5c4={};_0x6fd5c4[_0xb68d('0x31')]=_[_0xb68d('0x2e')](db['VoiceQueuesLog']['rawAttributes']);_0x6fd5c4['query']=_[_0xb68d('0x2e')](_0xb022f[_0xb68d('0x2d')]);_0x6fd5c4['filters']=_['intersection'](_0x6fd5c4[_0xb68d('0x31')],_0x6fd5c4[_0xb68d('0x2d')]);_0x5aa47a[_0xb68d('0x33')]=_['intersection'](_0x6fd5c4[_0xb68d('0x31')],qs[_0xb68d('0x32')](_0xb022f[_0xb68d('0x2d')][_0xb68d('0x32')]));_0x5aa47a['attributes']=_0x5aa47a[_0xb68d('0x33')][_0xb68d('0x34')]?_0x5aa47a['attributes']:_0x6fd5c4[_0xb68d('0x31')];if(_0xb022f['query'][_0xb68d('0x3c')]){_0x5aa47a[_0xb68d('0x3d')]=[{'all':!![]}];}_0x5aa47a=_[_0xb68d('0x38')]({},_0x5aa47a,_0xb022f['options']);return db[_0xb68d('0x29')]['find'](_0x5aa47a)[_0xb68d('0x23')](handleEntityNotFound(_0x21f604,null))[_0xb68d('0x23')](respondWithResult(_0x21f604,null))[_0xb68d('0x40')](handleError(_0x21f604,null));};exports[_0xb68d('0x43')]=function(_0x5f4945,_0x55ced9){return db[_0xb68d('0x29')][_0xb68d('0x43')](_0x5f4945[_0xb68d('0x44')],{})['then'](respondWithResult(_0x55ced9,0xc9))[_0xb68d('0x40')](handleError(_0x55ced9,null));};exports['update']=function(_0x5789c2,_0x3f0425){if(_0x5789c2[_0xb68d('0x44')]['id']){delete _0x5789c2[_0xb68d('0x44')]['id'];}return db[_0xb68d('0x29')][_0xb68d('0x45')]({'where':{'id':_0x5789c2[_0xb68d('0x42')]['id']}})[_0xb68d('0x23')](handleEntityNotFound(_0x3f0425,null))[_0xb68d('0x23')](saveUpdates(_0x5789c2[_0xb68d('0x44')],null))[_0xb68d('0x23')](respondWithResult(_0x3f0425,null))[_0xb68d('0x40')](handleError(_0x3f0425,null));};exports[_0xb68d('0x24')]=function(_0x1fdf12,_0x487b5a){return db[_0xb68d('0x29')]['find']({'where':{'id':_0x1fdf12['params']['id']}})['then'](handleEntityNotFound(_0x487b5a,null))['then'](removeEntity(_0x487b5a,null))[_0xb68d('0x40')](handleError(_0x487b5a,null));}; \ No newline at end of file +var _0xe5df=['filters','intersection','query','fields','attributes','hasOwnProperty','order','sort','filter','where','type','merge','options','includeAll','include','findAll','show','params','keys','length','find','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','key','model'];(function(_0x53d0ee,_0x4a8367){var _0x4747c5=function(_0x38d989){while(--_0x38d989){_0x53d0ee['push'](_0x53d0ee['shift']());}};_0x4747c5(++_0x4a8367);}(_0xe5df,0x1b5));var _0xfe5d=function(_0x3d7e2e,_0x179498){_0x3d7e2e=_0x3d7e2e-0x0;var _0x326977=_0xe5df[_0x3d7e2e];return _0x326977;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe5d('0x0'));var zipdir=require(_0xfe5d('0x1'));var jsonpatch=require(_0xfe5d('0x2'));var rp=require(_0xfe5d('0x3'));var moment=require(_0xfe5d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfe5d('0x5'));var path=require(_0xfe5d('0x6'));var sox=require(_0xfe5d('0x7'));var csv=require(_0xfe5d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfe5d('0x9'));var crypto=require(_0xfe5d('0xa'));var jsforce=require(_0xfe5d('0xb'));var deskjs=require(_0xfe5d('0xc'));var toCsv=require(_0xfe5d('0x8'));var querystring=require(_0xfe5d('0xd'));var Papa=require(_0xfe5d('0xe'));var Redis=require('ioredis');var authService=require(_0xfe5d('0xf'));var qs=require(_0xfe5d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe5d('0x11'));var logger=require(_0xfe5d('0x12'))(_0xfe5d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfe5d('0x14'))['db'];function respondWithStatusCode(_0x15f792,_0x5da313){_0x5da313=_0x5da313||0xcc;return function(_0x544b25){if(_0x544b25){return _0x15f792[_0xfe5d('0x15')](_0x5da313);}return _0x15f792['status'](_0x5da313)[_0xfe5d('0x16')]();};}function respondWithResult(_0x3f3330,_0x53c422){_0x53c422=_0x53c422||0xc8;return function(_0x2c35e6){if(_0x2c35e6){return _0x3f3330[_0xfe5d('0x17')](_0x53c422)['json'](_0x2c35e6);}};}function respondWithFilteredResult(_0x3cd1ff,_0x16c66c){return function(_0x3ef07d){if(_0x3ef07d){var _0x42bf7e=typeof _0x16c66c[_0xfe5d('0x18')]==='undefined'&&typeof _0x16c66c[_0xfe5d('0x19')]===_0xfe5d('0x1a');var _0xcde3a5=_0x3ef07d['count'];var _0x524615=_0x42bf7e?0x0:_0x16c66c['offset'];var _0x2b0121=_0x42bf7e?_0x3ef07d[_0xfe5d('0x1b')]:_0x16c66c[_0xfe5d('0x18')]+_0x16c66c['limit'];var _0x4625b2;if(_0x2b0121>=_0xcde3a5){_0x2b0121=_0xcde3a5;_0x4625b2=0xc8;}else{_0x4625b2=0xce;}_0x3cd1ff['status'](_0x4625b2);return _0x3cd1ff[_0xfe5d('0x1c')](_0xfe5d('0x1d'),_0x524615+'-'+_0x2b0121+'/'+_0xcde3a5)[_0xfe5d('0x1e')](_0x3ef07d);}return null;};}function patchUpdates(_0x2cdb09){return function(_0x19e850){try{jsonpatch[_0xfe5d('0x1f')](_0x19e850,_0x2cdb09,!![]);}catch(_0x2be90c){return BPromise[_0xfe5d('0x20')](_0x2be90c);}return _0x19e850[_0xfe5d('0x21')]();};}function saveUpdates(_0x84fda8,_0x55cb17){return function(_0x55d022){if(_0x55d022){return _0x55d022[_0xfe5d('0x22')](_0x84fda8)[_0xfe5d('0x23')](function(_0x1b3f59){return _0x1b3f59;});}return null;};}function removeEntity(_0x320e41,_0x1cb269){return function(_0x267c37){if(_0x267c37){return _0x267c37[_0xfe5d('0x24')]()[_0xfe5d('0x23')](function(){_0x320e41[_0xfe5d('0x17')](0xcc)[_0xfe5d('0x16')]();});}};}function handleEntityNotFound(_0x2864b1,_0x5c0863){return function(_0x38d05e){if(!_0x38d05e){_0x2864b1[_0xfe5d('0x15')](0x194);}return _0x38d05e;};}function handleError(_0x35ef43,_0x402155){_0x402155=_0x402155||0x1f4;return function(_0x2fd004){logger['error'](_0x2fd004[_0xfe5d('0x25')]);if(_0x2fd004['name']){delete _0x2fd004[_0xfe5d('0x26')];}_0x35ef43['status'](_0x402155)[_0xfe5d('0x27')](_0x2fd004);};}exports['index']=function(_0x96a9b1,_0x5099ab){var _0x2b74a5={},_0x2fb473={},_0x137ae1={'count':0x0,'rows':[]};var _0x12c881=_[_0xfe5d('0x28')](db[_0xfe5d('0x29')][_0xfe5d('0x2a')],function(_0x3d7d73){return{'name':_0x3d7d73[_0xfe5d('0x2b')],'type':_0x3d7d73['type'][_0xfe5d('0x2c')]};});_0x2fb473[_0xfe5d('0x2d')]=_['map'](_0x12c881,_0xfe5d('0x26'));_0x2fb473['query']=_['keys'](_0x96a9b1['query']);_0x2fb473[_0xfe5d('0x2e')]=_[_0xfe5d('0x2f')](_0x2fb473[_0xfe5d('0x2d')],_0x2fb473[_0xfe5d('0x30')]);_0x2b74a5['attributes']=_[_0xfe5d('0x2f')](_0x2fb473['model'],qs['fields'](_0x96a9b1[_0xfe5d('0x30')][_0xfe5d('0x31')]));_0x2b74a5[_0xfe5d('0x32')]=_0x2b74a5[_0xfe5d('0x32')]['length']?_0x2b74a5['attributes']:_0x2fb473[_0xfe5d('0x2d')];if(!_0x96a9b1[_0xfe5d('0x30')][_0xfe5d('0x33')]('nolimit')){_0x2b74a5[_0xfe5d('0x19')]=qs[_0xfe5d('0x19')](_0x96a9b1[_0xfe5d('0x30')][_0xfe5d('0x19')]);_0x2b74a5[_0xfe5d('0x18')]=qs[_0xfe5d('0x18')](_0x96a9b1[_0xfe5d('0x30')][_0xfe5d('0x18')]);}_0x2b74a5[_0xfe5d('0x34')]=qs['sort'](_0x96a9b1[_0xfe5d('0x30')][_0xfe5d('0x35')]);_0x2b74a5['where']=qs[_0xfe5d('0x2e')](_['pick'](_0x96a9b1['query'],_0x2fb473[_0xfe5d('0x2e')]),_0x12c881);if(_0x96a9b1[_0xfe5d('0x30')][_0xfe5d('0x36')]){_0x2b74a5[_0xfe5d('0x37')]=_['merge'](_0x2b74a5[_0xfe5d('0x37')],{'$or':_[_0xfe5d('0x28')](_0x12c881,function(_0x49417a){if(_0x49417a[_0xfe5d('0x38')]!=='VIRTUAL'){var _0x2cfd10={};_0x2cfd10[_0x49417a['name']]={'$like':'%'+_0x96a9b1['query'][_0xfe5d('0x36')]+'%'};return _0x2cfd10;}})});}_0x2b74a5=_[_0xfe5d('0x39')]({},_0x2b74a5,_0x96a9b1[_0xfe5d('0x3a')]);var _0x2be9d8={'where':_0x2b74a5[_0xfe5d('0x37')]};return db[_0xfe5d('0x29')][_0xfe5d('0x1b')](_0x2be9d8)[_0xfe5d('0x23')](function(_0x18421e){_0x137ae1[_0xfe5d('0x1b')]=_0x18421e;if(_0x96a9b1['query'][_0xfe5d('0x3b')]){_0x2b74a5[_0xfe5d('0x3c')]=[{'all':!![]}];}return db[_0xfe5d('0x29')][_0xfe5d('0x3d')](_0x2b74a5);})[_0xfe5d('0x23')](function(_0x389cd4){_0x137ae1['rows']=_0x389cd4;return _0x137ae1;})[_0xfe5d('0x23')](respondWithFilteredResult(_0x5099ab,_0x2b74a5))['catch'](handleError(_0x5099ab,null));};exports[_0xfe5d('0x3e')]=function(_0x1b6089,_0x570d63){var _0x421cbd={'raw':!![],'where':{'id':_0x1b6089[_0xfe5d('0x3f')]['id']}},_0xdce4f8={};_0xdce4f8[_0xfe5d('0x2d')]=_[_0xfe5d('0x40')](db[_0xfe5d('0x29')][_0xfe5d('0x2a')]);_0xdce4f8[_0xfe5d('0x30')]=_[_0xfe5d('0x40')](_0x1b6089['query']);_0xdce4f8[_0xfe5d('0x2e')]=_['intersection'](_0xdce4f8[_0xfe5d('0x2d')],_0xdce4f8[_0xfe5d('0x30')]);_0x421cbd[_0xfe5d('0x32')]=_[_0xfe5d('0x2f')](_0xdce4f8[_0xfe5d('0x2d')],qs[_0xfe5d('0x31')](_0x1b6089['query'][_0xfe5d('0x31')]));_0x421cbd['attributes']=_0x421cbd['attributes'][_0xfe5d('0x41')]?_0x421cbd['attributes']:_0xdce4f8['model'];if(_0x1b6089[_0xfe5d('0x30')]['includeAll']){_0x421cbd[_0xfe5d('0x3c')]=[{'all':!![]}];}_0x421cbd=_['merge']({},_0x421cbd,_0x1b6089['options']);return db['VoiceQueuesLog'][_0xfe5d('0x42')](_0x421cbd)['then'](handleEntityNotFound(_0x570d63,null))[_0xfe5d('0x23')](respondWithResult(_0x570d63,null))['catch'](handleError(_0x570d63,null));};exports['create']=function(_0x318bfa,_0x53433a){return db[_0xfe5d('0x29')]['create'](_0x318bfa[_0xfe5d('0x43')],{})[_0xfe5d('0x23')](respondWithResult(_0x53433a,0xc9))[_0xfe5d('0x44')](handleError(_0x53433a,null));};exports[_0xfe5d('0x22')]=function(_0x22e89f,_0x29e3a2){if(_0x22e89f[_0xfe5d('0x43')]['id']){delete _0x22e89f[_0xfe5d('0x43')]['id'];}return db[_0xfe5d('0x29')][_0xfe5d('0x42')]({'where':{'id':_0x22e89f[_0xfe5d('0x3f')]['id']}})[_0xfe5d('0x23')](handleEntityNotFound(_0x29e3a2,null))[_0xfe5d('0x23')](saveUpdates(_0x22e89f[_0xfe5d('0x43')],null))[_0xfe5d('0x23')](respondWithResult(_0x29e3a2,null))[_0xfe5d('0x44')](handleError(_0x29e3a2,null));};exports[_0xfe5d('0x24')]=function(_0x1ab2f6,_0x17b509){return db[_0xfe5d('0x29')][_0xfe5d('0x42')]({'where':{'id':_0x1ab2f6[_0xfe5d('0x3f')]['id']}})[_0xfe5d('0x23')](handleEntityNotFound(_0x17b509,null))[_0xfe5d('0x23')](removeEntity(_0x17b509,null))[_0xfe5d('0x44')](handleError(_0x17b509,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 077c11d..5a5d465 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 _0x3caa=['exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','util','../../config/logger','api','bluebird','../../config/environment','./voiceQueuesLog.attributes'];(function(_0xeff2c3,_0x3a5a82){var _0x2cade6=function(_0x5a26a1){while(--_0x5a26a1){_0xeff2c3['push'](_0xeff2c3['shift']());}};_0x2cade6(++_0x3a5a82);}(_0x3caa,0xb0));var _0xa3ca=function(_0x76c6d,_0x162d5f){_0x76c6d=_0x76c6d-0x0;var _0x419678=_0x3caa[_0x76c6d];return _0x419678;};'use strict';var _=require('lodash');var util=require(_0xa3ca('0x0'));var logger=require(_0xa3ca('0x1'))(_0xa3ca('0x2'));var moment=require('moment');var BPromise=require(_0xa3ca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa3ca('0x4'));var attributes=require(_0xa3ca('0x5'));module[_0xa3ca('0x6')]=function(_0x54b884,_0xfde181){return _0x54b884[_0xa3ca('0x7')](_0xa3ca('0x8'),attributes,{'tableName':_0xa3ca('0x9'),'paranoid':![],'indexes':[{'name':_0xa3ca('0xa'),'fields':[_0xa3ca('0xb'),_0xa3ca('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xf969=['exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x50bf36,_0x1edc8c){var _0x15bac6=function(_0x15e7b7){while(--_0x15e7b7){_0x50bf36['push'](_0x50bf36['shift']());}};_0x15bac6(++_0x1edc8c);}(_0xf969,0x13a));var _0x9f96=function(_0x35d913,_0x27e9ba){_0x35d913=_0x35d913-0x0;var _0xb9ac9f=_0xf969[_0x35d913];return _0xb9ac9f;};'use strict';var _=require(_0x9f96('0x0'));var util=require(_0x9f96('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9f96('0x2'));var BPromise=require(_0x9f96('0x3'));var rp=require(_0x9f96('0x4'));var fs=require('fs');var path=require(_0x9f96('0x5'));var rimraf=require(_0x9f96('0x6'));var config=require(_0x9f96('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0x9f96('0x8')]=function(_0x4439c5,_0x1c927c){return _0x4439c5['define'](_0x9f96('0x9'),attributes,{'tableName':_0x9f96('0xa'),'paranoid':![],'indexes':[{'name':_0x9f96('0xb'),'fields':[_0x9f96('0xc'),_0x9f96('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index b7b7f97..b3648cc 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 _0x1d07=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2da17e,_0x3ebaee){var _0x3e2f64=function(_0x1a0cac){while(--_0x1a0cac){_0x2da17e['push'](_0x2da17e['shift']());}};_0x3e2f64(++_0x3ebaee);}(_0x1d07,0x100));var _0x71d0=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x1d07[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require(_0x71d0('0x0'));var moment=require(_0x71d0('0x1'));var BPromise=require(_0x71d0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71d0('0x3'));var db=require(_0x71d0('0x4'))['db'];var utils=require(_0x71d0('0x5'));var logger=require(_0x71d0('0x6'))(_0x71d0('0x7'));var config=require(_0x71d0('0x8'));var jayson=require(_0x71d0('0x9'));var client=jayson[_0x71d0('0xa')][_0x71d0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52a6db,_0x2d7aa0,_0x106f10){return new BPromise(function(_0x2e9de5,_0xb22db1){return client[_0x71d0('0xc')](_0x52a6db,_0x106f10)[_0x71d0('0xd')](function(_0x552aab){logger[_0x71d0('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2d7aa0,_0x71d0('0xf'));logger[_0x71d0('0x10')](_0x71d0('0x11'),_0x2d7aa0,_0x71d0('0xf'),JSON['stringify'](_0x552aab));if(_0x552aab[_0x71d0('0x12')]){if(_0x552aab[_0x71d0('0x12')][_0x71d0('0x13')]===0x1f4){logger[_0x71d0('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2d7aa0,_0x552aab[_0x71d0('0x12')][_0x71d0('0x14')]);return _0xb22db1(_0x552aab['error'][_0x71d0('0x14')]);}logger[_0x71d0('0x12')](_0x71d0('0x15'),_0x2d7aa0,_0x552aab[_0x71d0('0x12')]['message']);return _0x2e9de5(_0x552aab['error'][_0x71d0('0x14')]);}else{logger['info'](_0x71d0('0x15'),_0x2d7aa0,_0x71d0('0xf'));_0x2e9de5(_0x552aab[_0x71d0('0x16')][_0x71d0('0x14')]);}})[_0x71d0('0x17')](function(_0x35879a){logger[_0x71d0('0x12')](_0x71d0('0x15'),_0x2d7aa0,_0x35879a);_0xb22db1(_0x35879a);});});} \ No newline at end of file +var _0x2c59=['stringify','code','error','VoiceQueuesLog,\x20%s,\x20%s','message','info','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent'];(function(_0x50513f,_0x3da510){var _0x4f6d63=function(_0x5ec436){while(--_0x5ec436){_0x50513f['push'](_0x50513f['shift']());}};_0x4f6d63(++_0x3da510);}(_0x2c59,0xb7));var _0x92c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c59[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x92c5('0x0'));var BPromise=require(_0x92c5('0x1'));var rs=require(_0x92c5('0x2'));var fs=require('fs');var Redis=require(_0x92c5('0x3'));var db=require(_0x92c5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x92c5('0x5'))(_0x92c5('0x6'));var config=require(_0x92c5('0x7'));var jayson=require(_0x92c5('0x8'));var client=jayson[_0x92c5('0x9')][_0x92c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6fef34,_0x1bff7b,_0x20f742){return new BPromise(function(_0x14690e,_0x36079d){return client[_0x92c5('0xb')](_0x6fef34,_0x20f742)[_0x92c5('0xc')](function(_0x2fdb8b){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x1bff7b,'request\x20sent');logger[_0x92c5('0xd')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x1bff7b,_0x92c5('0xe'),JSON[_0x92c5('0xf')](_0x2fdb8b));if(_0x2fdb8b['error']){if(_0x2fdb8b['error'][_0x92c5('0x10')]===0x1f4){logger[_0x92c5('0x11')](_0x92c5('0x12'),_0x1bff7b,_0x2fdb8b['error'][_0x92c5('0x13')]);return _0x36079d(_0x2fdb8b[_0x92c5('0x11')][_0x92c5('0x13')]);}logger['error'](_0x92c5('0x12'),_0x1bff7b,_0x2fdb8b[_0x92c5('0x11')][_0x92c5('0x13')]);return _0x14690e(_0x2fdb8b[_0x92c5('0x11')][_0x92c5('0x13')]);}else{logger[_0x92c5('0x14')](_0x92c5('0x12'),_0x1bff7b,_0x92c5('0xe'));_0x14690e(_0x2fdb8b['result'][_0x92c5('0x13')]);}})[_0x92c5('0x15')](function(_0x4f14da){logger[_0x92c5('0x11')](_0x92c5('0x12'),_0x1bff7b,_0x4f14da);_0x36079d(_0x4f14da);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index f27c843..6a2ee56 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 _0x7ab5=['downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','/:id','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceRecording.controller','get','index','isAuthenticated','describe','show','/:id/download','download','/:id/downloads'];(function(_0x171e5a,_0x47f32e){var _0x29002e=function(_0x95a15d){while(--_0x95a15d){_0x171e5a['push'](_0x171e5a['shift']());}};_0x29002e(++_0x47f32e);}(_0x7ab5,0x119));var _0x57ab=function(_0x258db4,_0x3c3e60){_0x258db4=_0x258db4-0x0;var _0x35d7ca=_0x7ab5[_0x258db4];return _0x35d7ca;};'use strict';var multer=require(_0x57ab('0x0'));var util=require('util');var path=require(_0x57ab('0x1'));var timeout=require(_0x57ab('0x2'));var express=require(_0x57ab('0x3'));var router=express[_0x57ab('0x4')]();var fs_extra=require(_0x57ab('0x5'));var auth=require(_0x57ab('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x57ab('0x7'));router[_0x57ab('0x8')]('/',auth['isAuthenticated'](),controller[_0x57ab('0x9')]);router[_0x57ab('0x8')]('/describe',auth[_0x57ab('0xa')](),controller[_0x57ab('0xb')]);router['get']('/:id',auth[_0x57ab('0xa')](),controller[_0x57ab('0xc')]);router['get'](_0x57ab('0xd'),auth[_0x57ab('0xa')](),controller[_0x57ab('0xe')]);router[_0x57ab('0x8')](_0x57ab('0xf'),controller[_0x57ab('0x10')]);router[_0x57ab('0x8')](_0x57ab('0x11'),auth[_0x57ab('0xa')](),controller[_0x57ab('0x12')]);router[_0x57ab('0x13')]('/',auth['isAuthenticated'](),controller[_0x57ab('0x14')]);router[_0x57ab('0x13')]('/:id/transcribe',auth[_0x57ab('0xa')](),controller[_0x57ab('0x15')]);router[_0x57ab('0x16')]('/:id',auth[_0x57ab('0xa')](),controller[_0x57ab('0x17')]);router[_0x57ab('0x18')](_0x57ab('0x19'),auth[_0x57ab('0xa')](),controller[_0x57ab('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x8377=['../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x58b44a,_0x1a7aa6){var _0xd6779d=function(_0x40d8f3){while(--_0x40d8f3){_0x58b44a['push'](_0x58b44a['shift']());}};_0xd6779d(++_0x1a7aa6);}(_0x8377,0xca));var _0x7837=function(_0x3111df,_0x5e20a7){_0x3111df=_0x3111df-0x0;var _0x37471=_0x8377[_0x3111df];return _0x37471;};'use strict';var multer=require(_0x7837('0x0'));var util=require(_0x7837('0x1'));var path=require(_0x7837('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7837('0x3')]();var fs_extra=require(_0x7837('0x4'));var auth=require(_0x7837('0x5'));var interaction=require(_0x7837('0x6'));var config=require(_0x7837('0x7'));var controller=require(_0x7837('0x8'));router[_0x7837('0x9')]('/',auth[_0x7837('0xa')](),controller[_0x7837('0xb')]);router[_0x7837('0x9')](_0x7837('0xc'),auth[_0x7837('0xa')](),controller['describe']);router[_0x7837('0x9')](_0x7837('0xd'),auth[_0x7837('0xa')](),controller['show']);router[_0x7837('0x9')](_0x7837('0xe'),auth[_0x7837('0xa')](),controller[_0x7837('0xf')]);router['get'](_0x7837('0x10'),controller[_0x7837('0x11')]);router['get'](_0x7837('0x12'),auth['isAuthenticated'](),controller[_0x7837('0x13')]);router[_0x7837('0x14')]('/',auth['isAuthenticated'](),controller[_0x7837('0x15')]);router[_0x7837('0x14')](_0x7837('0x12'),auth[_0x7837('0xa')](),controller[_0x7837('0x16')]);router['put'](_0x7837('0xd'),auth[_0x7837('0xa')](),controller['update']);router[_0x7837('0x17')](_0x7837('0xd'),auth['isAuthenticated'](),controller[_0x7837('0x18')]);module[_0x7837('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 9087f04..9b0ca93 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index cc8b870..f079bc0 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 _0x07e5=['[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Buckets','bucket','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','fieldName','key','query','keys','intersection','model','attributes','fields','nolimit','limit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','VoiceRecording','findAll','rows','catch','show','rawAttributes','length','include','find','create','body','params','describe','download','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','push','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','info','unlinkSync','createBucket','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync'];(function(_0x543067,_0x3f0843){var _0x230fc1=function(_0x774c0c){while(--_0x774c0c){_0x543067['push'](_0x543067['shift']());}};_0x230fc1(++_0x3f0843);}(_0x07e5,0x15d));var _0x507e=function(_0x31e9a5,_0x520323){_0x31e9a5=_0x31e9a5-0x0;var _0x96859d=_0x07e5[_0x31e9a5];return _0x96859d;};'use strict';var emlformat=require(_0x507e('0x0'));var rimraf=require(_0x507e('0x1'));var zipdir=require(_0x507e('0x2'));var jsonpatch=require(_0x507e('0x3'));var rp=require(_0x507e('0x4'));var moment=require('moment');var BPromise=require(_0x507e('0x5'));var Mustache=require('mustache');var util=require(_0x507e('0x6'));var path=require(_0x507e('0x7'));var sox=require(_0x507e('0x8'));var csv=require('to-csv');var ejs=require(_0x507e('0x9'));var fs=require('fs');var fs_extra=require(_0x507e('0xa'));var _=require(_0x507e('0xb'));var squel=require(_0x507e('0xc'));var crypto=require(_0x507e('0xd'));var jsforce=require(_0x507e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x507e('0xf'));var Papa=require('papaparse');var AWS=require(_0x507e('0x10'));var uuidv4=require(_0x507e('0x11'));var Redis=require(_0x507e('0x12'));var authService=require(_0x507e('0x13'));var qs=require(_0x507e('0x14'));var as=require(_0x507e('0x15'));var hardwareService=require(_0x507e('0x16'));var logger=require('../../config/logger')(_0x507e('0x17'));var utils=require(_0x507e('0x18'));var config=require(_0x507e('0x19'));var licenseUtil=require(_0x507e('0x1a'));var db=require(_0x507e('0x1b'))['db'];function respondWithStatusCode(_0x7c65a4,_0x38347c){_0x38347c=_0x38347c||0xcc;return function(_0x3aee0f){if(_0x3aee0f){return _0x7c65a4[_0x507e('0x1c')](_0x38347c);}return _0x7c65a4[_0x507e('0x1d')](_0x38347c)[_0x507e('0x1e')]();};}function respondWithResult(_0x59aaca,_0x5a3f7b){_0x5a3f7b=_0x5a3f7b||0xc8;return function(_0x8fda65){if(_0x8fda65){return _0x59aaca[_0x507e('0x1d')](_0x5a3f7b)[_0x507e('0x1f')](_0x8fda65);}};}function respondWithFilteredResult(_0x20842c,_0x312f76){return function(_0x2a1236){if(_0x2a1236){var _0x2f0a86=typeof _0x312f76['offset']===_0x507e('0x20')&&typeof _0x312f76['limit']===_0x507e('0x20');var _0x3c6429=_0x2a1236[_0x507e('0x21')];var _0x4de0e9=_0x2f0a86?0x0:_0x312f76['offset'];var _0x2476b4=_0x2f0a86?_0x2a1236['count']:_0x312f76[_0x507e('0x22')]+_0x312f76['limit'];var _0x3a8836;if(_0x2476b4>=_0x3c6429){_0x2476b4=_0x3c6429;_0x3a8836=0xc8;}else{_0x3a8836=0xce;}_0x20842c['status'](_0x3a8836);return _0x20842c[_0x507e('0x23')](_0x507e('0x24'),_0x4de0e9+'-'+_0x2476b4+'/'+_0x3c6429)[_0x507e('0x1f')](_0x2a1236);}return null;};}function patchUpdates(_0x420b17){return function(_0x385def){try{jsonpatch[_0x507e('0x25')](_0x385def,_0x420b17,!![]);}catch(_0x7ea47){return BPromise[_0x507e('0x26')](_0x7ea47);}return _0x385def[_0x507e('0x27')]();};}function saveUpdates(_0x3cf114,_0x3a4642){return function(_0x2e4639){if(_0x2e4639){return _0x2e4639[_0x507e('0x28')](_0x3cf114)[_0x507e('0x29')](function(_0x2bcb27){return _0x2bcb27;});}return null;};}function removeEntity(_0xf5910b,_0x442028){return function(_0x5e2ef3){if(_0x5e2ef3){return _0x5e2ef3[_0x507e('0x2a')]()[_0x507e('0x29')](function(){_0xf5910b[_0x507e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3af47b,_0x404f06){return function(_0x443632){if(!_0x443632){_0x3af47b[_0x507e('0x1c')](0x194);}return _0x443632;};}function handleError(_0x477ce8,_0x1348e4){_0x1348e4=_0x1348e4||0x1f4;return function(_0x1ef518){logger['error'](_0x1ef518[_0x507e('0x2b')]);if(_0x1ef518[_0x507e('0x2c')]){delete _0x1ef518[_0x507e('0x2c')];}_0x477ce8['status'](_0x1348e4)[_0x507e('0x2d')](_0x1ef518);};}exports[_0x507e('0x2e')]=function(_0x1db57a,_0x1064d8){var _0xffed40={},_0x14872a={},_0x389056={'count':0x0,'rows':[]};var _0x14e8cd=_[_0x507e('0x2f')](db['VoiceRecording']['rawAttributes'],function(_0x139e37){return{'name':_0x139e37[_0x507e('0x30')],'type':_0x139e37['type'][_0x507e('0x31')]};});_0x14872a['model']=_['differenceBy'](_[_0x507e('0x2f')](_0x14e8cd,_0x507e('0x2c')),['format']);_0x14872a[_0x507e('0x32')]=_[_0x507e('0x33')](_0x1db57a[_0x507e('0x32')]);_0x14872a['filters']=_[_0x507e('0x34')](_0x14872a[_0x507e('0x35')],_0x14872a[_0x507e('0x32')]);_0xffed40[_0x507e('0x36')]=_[_0x507e('0x34')](_0x14872a['model'],qs[_0x507e('0x37')](_0x1db57a[_0x507e('0x32')][_0x507e('0x37')]));_0xffed40[_0x507e('0x36')]=_0xffed40[_0x507e('0x36')]['length']?_0xffed40[_0x507e('0x36')]:_0x14872a[_0x507e('0x35')];if(!_0x1db57a[_0x507e('0x32')]['hasOwnProperty'](_0x507e('0x38'))){_0xffed40[_0x507e('0x39')]=qs[_0x507e('0x39')](_0x1db57a['query'][_0x507e('0x39')]);_0xffed40[_0x507e('0x22')]=qs[_0x507e('0x22')](_0x1db57a['query']['offset']);}_0xffed40[_0x507e('0x3a')]=qs[_0x507e('0x3b')](_0x1db57a[_0x507e('0x32')][_0x507e('0x3b')]);_0xffed40['where']=qs[_0x507e('0x3c')](_[_0x507e('0x3d')](_0x1db57a['query'],_0x14872a[_0x507e('0x3c')]),_0x14e8cd);if(_0x1db57a[_0x507e('0x32')][_0x507e('0x3e')]){_0xffed40[_0x507e('0x3f')]=_[_0x507e('0x40')](_0xffed40['where'],{'$or':_[_0x507e('0x2f')](_0x14e8cd,function(_0x402b10){if(_0x402b10[_0x507e('0x41')]!==_0x507e('0x42')){var _0x4d6d3d={};_0x4d6d3d[_0x402b10[_0x507e('0x2c')]]={'$like':'%'+_0x1db57a[_0x507e('0x32')][_0x507e('0x3e')]+'%'};return _0x4d6d3d;}})});}_0xffed40=_[_0x507e('0x40')]({},_0xffed40,_0x1db57a[_0x507e('0x43')]);var _0x10524d={'where':_0xffed40[_0x507e('0x3f')]};return db[_0x507e('0x44')][_0x507e('0x21')](_0x10524d)[_0x507e('0x29')](function(_0x57ff51){_0x389056['count']=_0x57ff51;if(_0x1db57a[_0x507e('0x32')]['includeAll']){_0xffed40['include']=[{'all':!![]}];}return db[_0x507e('0x44')][_0x507e('0x45')](_0xffed40);})['then'](function(_0x6fd932){_0x389056[_0x507e('0x46')]=_0x6fd932;return _0x389056;})[_0x507e('0x29')](respondWithFilteredResult(_0x1064d8,_0xffed40))[_0x507e('0x47')](handleError(_0x1064d8,null));};exports[_0x507e('0x48')]=function(_0x885647,_0x3aefeb){var _0x3d3175={'raw':![],'where':{'id':_0x885647['params']['id']}},_0x1f32b3={};_0x1f32b3[_0x507e('0x35')]=_['keys'](db[_0x507e('0x44')][_0x507e('0x49')]);_0x1f32b3[_0x507e('0x32')]=_[_0x507e('0x33')](_0x885647[_0x507e('0x32')]);_0x1f32b3[_0x507e('0x3c')]=_['intersection'](_0x1f32b3['model'],_0x1f32b3['query']);_0x3d3175[_0x507e('0x36')]=_[_0x507e('0x34')](_0x1f32b3[_0x507e('0x35')],qs[_0x507e('0x37')](_0x885647[_0x507e('0x32')][_0x507e('0x37')]));_0x3d3175['attributes']=_0x3d3175['attributes'][_0x507e('0x4a')]?_0x3d3175[_0x507e('0x36')]:_0x1f32b3[_0x507e('0x35')];if(_0x885647['query']['includeAll']){_0x3d3175[_0x507e('0x4b')]=[{'all':!![]}];}_0x3d3175=_[_0x507e('0x40')]({},_0x3d3175,_0x885647[_0x507e('0x43')]);return db[_0x507e('0x44')][_0x507e('0x4c')](_0x3d3175)[_0x507e('0x29')](handleEntityNotFound(_0x3aefeb,null))[_0x507e('0x29')](respondWithResult(_0x3aefeb,null))[_0x507e('0x47')](handleError(_0x3aefeb,null));};exports['create']=function(_0x43d519,_0xfaf726){return db['VoiceRecording'][_0x507e('0x4d')](_0x43d519[_0x507e('0x4e')],{})[_0x507e('0x29')](respondWithResult(_0xfaf726,0xc9))['catch'](handleError(_0xfaf726,null));};exports[_0x507e('0x28')]=function(_0x14bb5d,_0x30f369){if(_0x14bb5d[_0x507e('0x4e')]['id']){delete _0x14bb5d[_0x507e('0x4e')]['id'];}return db[_0x507e('0x44')][_0x507e('0x4c')]({'where':{'id':_0x14bb5d[_0x507e('0x4f')]['id']}})[_0x507e('0x29')](handleEntityNotFound(_0x30f369,null))[_0x507e('0x29')](saveUpdates(_0x14bb5d[_0x507e('0x4e')],null))[_0x507e('0x29')](respondWithResult(_0x30f369,null))[_0x507e('0x47')](handleError(_0x30f369,null));};exports['describe']=function(_0x3f2c60,_0x290c81){return db[_0x507e('0x44')][_0x507e('0x50')]()['then'](respondWithResult(_0x290c81,null))['catch'](handleError(_0x290c81,null));};exports[_0x507e('0x51')]=function(_0x302499,_0xa2ea2b,_0x10d237){var _0x177600=require('../../components/encryptor');var _0x588fba=![];var _0x3ebdca={};if(_0x302499['query'][_0x507e('0x41')]&&_0x302499[_0x507e('0x32')][_0x507e('0x41')]===_0x507e('0x52')){_0x3ebdca['uniqueid']=_0x302499[_0x507e('0x4f')]['id'];}else{_0x3ebdca['id']=_0x302499['params']['id'];}return db[_0x507e('0x44')]['find']({'where':_0x3ebdca,'attributes':['id',_0x507e('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0xa2ea2b,null))[_0x507e('0x29')](function(_0x484f3f){if(_0x484f3f){var _0xcd7e8d=_0x484f3f[_0x507e('0x53')];var _0x196fbf=util[_0x507e('0x54')](_0x507e('0x55'),_0xcd7e8d);if(fs[_0x507e('0x56')](_0x196fbf)){_0x588fba=!![];return _0x177600[_0x507e('0x57')](_0x196fbf,_0xcd7e8d,config[_0x507e('0x58')][_0x507e('0x59')])[_0x507e('0x29')](function(){return _0x484f3f;});}return _0x484f3f;}})[_0x507e('0x29')](function(_0x44db04){if(_0x44db04){var _0x325f25=_0x44db04['value'];if(!fs[_0x507e('0x56')](_0x325f25)){throw new db[(_0x507e('0x5a'))][(_0x507e('0x5b'))](_0x507e('0x5c'));}if(_0x44db04['filename']){return _0xa2ea2b[_0x507e('0x51')](_0x325f25,_0x44db04[_0x507e('0x5d')]+path[_0x507e('0x5e')](_0x325f25),function(){if(_0x588fba){fs['unlink'](_0x325f25);}});}else{return _0xa2ea2b['download'](_0x325f25,function(_0x5b6005){if(_0x588fba){fs[_0x507e('0x5f')](_0x325f25);}});}}})[_0x507e('0x47')](function(_0x45cf44){if(_0x45cf44['message']==='VoiceRecording\x20not\x20found'){_0xa2ea2b[_0x507e('0x1d')](0x194)[_0x507e('0x2d')](_0x507e('0x60'));}else{return handleError(_0xa2ea2b,null);}});};exports[_0x507e('0x61')]=function(_0x51350e,_0x43c781,_0x4c18ae){var _0x31d33b=require(_0x507e('0x62'));var _0x5d2fe5=![];var _0x392e27={'$and':[db['sequelize'][_0x507e('0x3f')](db[_0x507e('0x63')]['fn'](_0x507e('0x64'),db[_0x507e('0x63')][_0x507e('0x65')](_0x507e('0x52'))),_0x51350e[_0x507e('0x32')][_0x507e('0x66')])]};if(_0x51350e[_0x507e('0x32')][_0x507e('0x41')]&&_0x51350e[_0x507e('0x32')][_0x507e('0x41')]===_0x507e('0x52')){_0x392e27[_0x507e('0x67')][_0x507e('0x68')]({'uniqueid':_0x51350e[_0x507e('0x4f')]['id']});}else{_0x392e27['$and'][_0x507e('0x68')]({'id':_0x51350e[_0x507e('0x4f')]['id']});}return db[_0x507e('0x44')]['find']({'where':_0x392e27,'attributes':['id',_0x507e('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x43c781,null))[_0x507e('0x29')](function(_0x4174fe){if(_0x4174fe){var _0x541537=util[_0x507e('0x54')](_0x507e('0x55'),_0x4174fe['value']);if(fs[_0x507e('0x56')](_0x541537)){_0x5d2fe5=!![];return _0x31d33b['decryptFile'](_0x541537,_0x4174fe[_0x507e('0x53')],config['secrets'][_0x507e('0x59')])[_0x507e('0x29')](function(){return _0x4174fe;});}return _0x4174fe;}})[_0x507e('0x29')](function(_0x3ce19f){if(_0x3ce19f){if(!fs[_0x507e('0x56')](_0x3ce19f['value'])){throw new db[(_0x507e('0x5a'))]['ValidationError'](_0x507e('0x5c'));}if(_0x3ce19f[_0x507e('0x5d')]){return _0x43c781['download'](_0x3ce19f[_0x507e('0x53')],_0x3ce19f[_0x507e('0x5d')]+path[_0x507e('0x5e')](_0x3ce19f[_0x507e('0x53')]),function(){if(_0x5d2fe5){fs[_0x507e('0x5f')](_0x3ce19f[_0x507e('0x53')]);}});}else{return _0x43c781['download'](_0x3ce19f[_0x507e('0x53')],function(_0x284b9e){if(_0x5d2fe5){fs['unlink'](_0x3ce19f[_0x507e('0x53')]);}});}}})[_0x507e('0x47')](handleError(_0x43c781,null));};exports[_0x507e('0x2a')]=function(_0x1e31d9,_0x193642){return db[_0x507e('0x44')]['find']({'where':{'id':_0x1e31d9[_0x507e('0x4f')]['id']}})[_0x507e('0x29')](function(_0x299abe){if(_['isNil'](_0x299abe)){throw new ReferenceError('Entity\x20not\x20found');}return _0x299abe;})[_0x507e('0x29')](function(_0x2a8b79){var _0x5af06a=_0x2a8b79[_0x507e('0x53')];logger['info'](_0x507e('0x69'),_0x5af06a);if(!_[_0x507e('0x6a')](_0x2a8b79[_0x507e('0x53')])&&fs[_0x507e('0x56')](_0x5af06a)){logger['info']('File:\x20\x22'+_0x5af06a+_0x507e('0x6b'));fs['unlinkSync'](_0x5af06a);}_0x5af06a=_0x5af06a+_0x507e('0x6c');if(!_[_0x507e('0x6a')](_0x2a8b79[_0x507e('0x53')])&&fs[_0x507e('0x56')](_0x5af06a)){logger[_0x507e('0x6d')]('File:\x20\x22'+_0x5af06a+_0x507e('0x6b'));fs[_0x507e('0x6e')](_0x5af06a);}return _0x2a8b79;})['then'](function(_0xc3948e){if(!_0xc3948e)throw new InternalError();return _0xc3948e[_0x507e('0x2a')]();})[_0x507e('0x29')](function(){_0x193642['status'](0xcc)[_0x507e('0x1e')]();})[_0x507e('0x47')](handleError(_0x193642,null));};function getBucketslist(_0x457699,_0x31247a,_0x223f17){return new Promise(function(_0x1444ca,_0x2eb1b3){var _0x102814=new AWS['S3']({'accessKeyId':_0x31247a,'secretAccessKey':_0x457699,'region':_0x223f17});_0x102814['listBuckets']({},function(_0x509730,_0x247c9c){if(_0x509730){return _0x2eb1b3(_0x509730);}else{return _0x1444ca(_0x247c9c);}});});}function createBucket(_0x1fade1,_0x5cf344,_0x5c8ae8,_0x209b17){return new Promise(function(_0x565cf1,_0x1ddc94){var _0xc09019=new AWS['S3']({'accessKeyId':_0x5cf344,'secretAccessKey':_0x1fade1,'region':_0x5c8ae8});_0xc09019[_0x507e('0x6f')]({'Bucket':_0x209b17},function(_0x5b627f,_0x2919de){if(_0x5b627f){return _0x1ddc94(_0x5b627f);}else{return _0x565cf1(_0x2919de);}});});}function uploadFile(_0x497f3b,_0x19676a,_0x31960c,_0x367128,_0x185f4b,_0x2fb364){return new Promise(function(_0x48748c,_0x44f6e8){var _0x10cb20=new AWS['S3']({'accessKeyId':_0x19676a,'secretAccessKey':_0x497f3b,'region':_0x31960c});_0x10cb20['upload']({'Bucket':_0x367128,'Key':_0x185f4b,'Body':_0x2fb364},function(_0x17dfde,_0xc4c05c){if(_0x17dfde){return _0x44f6e8(_0x17dfde);}else{return _0x48748c(_0xc4c05c);}});});}function startTranscribe(_0x561731,_0xca9ab,_0x1b0fe4,_0x43691b,_0x40945e,_0x3856f4){return new Promise(function(_0x3a6159,_0x322476){var _0x504254=new AWS['TranscribeService']({'accessKeyId':_0xca9ab,'secretAccessKey':_0x561731,'region':_0x1b0fe4});_0x504254[_0x507e('0x70')]({'TranscriptionJobName':_0x43691b,'LanguageCode':_0x40945e,'Media':{'MediaFileUri':_0x3856f4}},function(_0xdf32c4,_0xe5925f){if(_0xdf32c4){return _0x322476(_0xdf32c4);}else{return _0x3a6159(_0xe5925f);}});});}function transcribe(_0x2ae46c,_0x4b9c2f,_0x3b5498,_0x4cc130,_0xb4b25a,_0x2b56c7,_0x78bf55){return new Promise(function(_0x42fdfe,_0x2c307c){var _0x38831c={};logger['info'](util['format'](_0x507e('0x71'),_0x2ae46c,_0xb4b25a));return uploadFile(_0x4b9c2f,_0x3b5498,_0x4cc130,_0xb4b25a,path[_0x507e('0x72')](_0x2b56c7),fs[_0x507e('0x73')](_0x2b56c7))[_0x507e('0x29')](function(_0x4f6bc5){logger[_0x507e('0x6d')](util['format'](_0x507e('0x74'),_0x2ae46c,_0xb4b25a,_0x4f6bc5['Location']));_0x38831c['bucket']=_0x4f6bc5['Bucket'];_0x38831c[_0x507e('0x75')]=_0x4f6bc5[_0x507e('0x76')];logger[_0x507e('0x6d')](util[_0x507e('0x54')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x2ae46c));return startTranscribe(_0x4b9c2f,_0x3b5498,_0x4cc130,uuidv4(),_0x78bf55,_0x4f6bc5[_0x507e('0x76')]);})[_0x507e('0x29')](function(_0xd62edd){logger[_0x507e('0x6d')](util['format'](_0x507e('0x77'),_0x2ae46c,_0xd62edd[_0x507e('0x78')][_0x507e('0x79')]));_0x38831c[_0x507e('0x7a')]=_0xd62edd[_0x507e('0x78')]['TranscriptionJobName'];_0x38831c['transcribeStatus']=_0xd62edd[_0x507e('0x78')][_0x507e('0x7b')];return _0x42fdfe(_0x38831c);})['catch'](function(_0x2685ab){return _0x2c307c(_0x2685ab);});});}exports[_0x507e('0x7c')]=function(_0x1241ac,_0x31edf2,_0x3a73a1){var _0x1416a4;var _0x35a9ec;var _0x5bf1fd;var _0x651174=require(_0x507e('0x62'));return db[_0x507e('0x44')]['findOne']({'where':{'id':_0x1241ac[_0x507e('0x4f')]['id']}})[_0x507e('0x29')](function(_0x1132bd){if(_0x1132bd){var _0x45829a=util[_0x507e('0x54')](_0x507e('0x55'),_0x1132bd['value']);if(fs[_0x507e('0x56')](_0x45829a)){cypher=!![];return _0x651174[_0x507e('0x57')](_0x45829a,_0x1132bd[_0x507e('0x53')],config[_0x507e('0x58')][_0x507e('0x59')])[_0x507e('0x29')](function(){return _0x1132bd;});}return _0x1132bd;}})[_0x507e('0x29')](function(_0x5c867c){if(!_0x5c867c){throw new db[(_0x507e('0x5a'))]['ValidationError'](_0x507e('0x7d'));}_0x35a9ec=_0x5c867c;return db[_0x507e('0x7e')][_0x507e('0x7f')]({'where':{'id':0x1}});})[_0x507e('0x29')](handleEntityNotFound(_0x31edf2,null))[_0x507e('0x29')](function(_0x30c8ea){if(_0x30c8ea){_0x1416a4=_0x30c8ea;if(!_0x1416a4['transcribe']||!_0x1416a4[_0x507e('0x80')]||!_0x1416a4[_0x507e('0x81')]||!_0x1416a4[_0x507e('0x82')]||!_0x1416a4['bucket']){throw new db[(_0x507e('0x5a'))]['ValidationError'](_0x507e('0x83'));}if(_0x1241ac[_0x507e('0x4e')][_0x507e('0x84')]&&(!_0x1416a4['sentiment']||!_0x1416a4[_0x507e('0x85')]||!_0x1416a4[_0x507e('0x86')]||!_0x1416a4[_0x507e('0x82')]||!_0x1416a4['bucket'])){throw new db[(_0x507e('0x5a'))]['ValidationError'](_0x507e('0x87'));}return db[_0x507e('0x88')]['findOne']({'where':{'id':_0x1416a4[_0x507e('0x80')]}});}})['then'](function(_0x1b95e7){if(!_0x1b95e7){throw new db[(_0x507e('0x5a'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x1b95e7[_0x507e('0x89')]||!_0x1b95e7[_0x507e('0x8a')]){throw new db[(_0x507e('0x5a'))][(_0x507e('0x5b'))]('Cloud\x20Provider\x20not\x20configured');}_0x5bf1fd=_0x1b95e7;return getBucketslist(_0x5bf1fd['data1'],_0x5bf1fd['data2'],_0x1416a4['transcribeRegion']);})[_0x507e('0x29')](function(_0x4b0577){if(_0x4b0577&&_0x4b0577['Buckets']){var _0x39025a=_[_0x507e('0x4c')](_0x4b0577[_0x507e('0x8b')],function(_0x10b20d){return _0x10b20d['Name']===_0x1416a4[_0x507e('0x8c')];});if(!_0x39025a){logger[_0x507e('0x6d')](util['format'](_0x507e('0x8d'),_0x1241ac[_0x507e('0x4f')]['id'],_0x1416a4[_0x507e('0x8c')]));return createBucket(_0x5bf1fd['data1'],_0x5bf1fd[_0x507e('0x8a')],_0x1416a4[_0x507e('0x81')],_0x1416a4[_0x507e('0x8c')]);}logger['info'](util[_0x507e('0x54')](_0x507e('0x8e'),_0x1241ac[_0x507e('0x4f')]['id'],_0x1416a4['bucket']));return;}})[_0x507e('0x29')](function(_0x49b9a2){if(_0x35a9ec[_0x507e('0x8f')]===_0x507e('0x90')){return transcribe(_0x1241ac[_0x507e('0x4f')]['id'],_0x5bf1fd[_0x507e('0x89')],_0x5bf1fd['data2'],_0x1416a4['transcribeRegion'],_0x1416a4['bucket'],_0x35a9ec[_0x507e('0x53')],_0x1416a4[_0x507e('0x82')]);}else{logger[_0x507e('0x6d')](util['format'](_0x507e('0x91'),_0x1241ac['params']['id']));return{'transcribeStatus':_0x507e('0x92')};}})[_0x507e('0x29')](function(_0x2e50a7){if(_0x2e50a7){_0x2e50a7[_0x507e('0x93')]=_0x1241ac[_0x507e('0x4e')][_0x507e('0x84')];return _0x35a9ec['updateAttributes'](_0x2e50a7);}})[_0x507e('0x29')](respondWithResult(_0x31edf2,null))[_0x507e('0x47')](handleError(_0x31edf2,null));};function writeFile(_0x15f050,_0x53963e){return new Promise(function(_0x143d96,_0x375a5c){fs[_0x507e('0x94')](_0x53963e,_0x15f050,function(_0x3f8f92,_0x32e50f){if(_0x3f8f92){return _0x375a5c(_0x3f8f92);}else{return _0x143d96(_0x32e50f);}});});}exports[_0x507e('0x95')]=function(_0x4ed0cb,_0x7e288f,_0x3bb1c0){return db[_0x507e('0x44')]['findOne']({'where':{'id':_0x4ed0cb[_0x507e('0x4f')]['id']}})[_0x507e('0x29')](handleEntityNotFound(_0x7e288f))[_0x507e('0x29')](function(_0x3179c3){if(_0x3179c3&&_0x3179c3[_0x507e('0x96')]){var _0x5f0615=_0x3179c3[_0x507e('0x96')];var _0x1a1695=config[_0x507e('0x97')]+_0x507e('0x98')+_0x3179c3['id']+_0x507e('0x99');if(fs[_0x507e('0x56')](_0x1a1695)){return _0x1a1695;}return writeFile(_0x5f0615,_0x1a1695)[_0x507e('0x29')](function(){return _0x1a1695;});}else{throw new db[(_0x507e('0x5a'))][(_0x507e('0x5b'))](_0x507e('0x9a'));}})['then'](function(_0x5bf73f){return _0x7e288f[_0x507e('0x51')](_0x5bf73f);})[_0x507e('0x47')](handleError(_0x7e288f));}; \ No newline at end of file +var _0x93e7=['downloads','sequelize','MD5','col','uniqueid','token','$and','push','decryptFile','secrets','ValidationError','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','data1','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','VoiceRecording','fieldName','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','describe','../../components/encryptor','params','value','format','%s.cypher','existsSync','recording','Sequelize','VoiceRecording\x20not\x20found','download','filename','extname','unlink','message','Not\x20found'];(function(_0xaecf40,_0x5ec3aa){var _0x5b6d23=function(_0x285dfe){while(--_0x285dfe){_0xaecf40['push'](_0xaecf40['shift']());}};_0x5b6d23(++_0x5ec3aa);}(_0x93e7,0x176));var _0x793e=function(_0x39ff5c,_0x3de001){_0x39ff5c=_0x39ff5c-0x0;var _0x1eba54=_0x93e7[_0x39ff5c];return _0x1eba54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x793e('0x0'));var zipdir=require(_0x793e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x793e('0x2'));var moment=require(_0x793e('0x3'));var BPromise=require(_0x793e('0x4'));var Mustache=require('mustache');var util=require(_0x793e('0x5'));var path=require('path');var sox=require(_0x793e('0x6'));var csv=require(_0x793e('0x7'));var ejs=require(_0x793e('0x8'));var fs=require('fs');var fs_extra=require(_0x793e('0x9'));var _=require(_0x793e('0xa'));var squel=require(_0x793e('0xb'));var crypto=require(_0x793e('0xc'));var jsforce=require(_0x793e('0xd'));var deskjs=require(_0x793e('0xe'));var toCsv=require(_0x793e('0x7'));var querystring=require('querystring');var Papa=require(_0x793e('0xf'));var AWS=require(_0x793e('0x10'));var uuidv4=require(_0x793e('0x11'));var Redis=require('ioredis');var authService=require(_0x793e('0x12'));var qs=require(_0x793e('0x13'));var as=require(_0x793e('0x14'));var hardwareService=require(_0x793e('0x15'));var logger=require(_0x793e('0x16'))(_0x793e('0x17'));var utils=require(_0x793e('0x18'));var config=require(_0x793e('0x19'));var licenseUtil=require(_0x793e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d504b,_0x5c53c5){_0x5c53c5=_0x5c53c5||0xcc;return function(_0x1cf128){if(_0x1cf128){return _0x4d504b['sendStatus'](_0x5c53c5);}return _0x4d504b[_0x793e('0x1b')](_0x5c53c5)[_0x793e('0x1c')]();};}function respondWithResult(_0x4256d5,_0x499320){_0x499320=_0x499320||0xc8;return function(_0x14e5ff){if(_0x14e5ff){return _0x4256d5[_0x793e('0x1b')](_0x499320)[_0x793e('0x1d')](_0x14e5ff);}};}function respondWithFilteredResult(_0x404dd6,_0x529f3a){return function(_0x2543f5){if(_0x2543f5){var _0x2cee19=typeof _0x529f3a['offset']==='undefined'&&typeof _0x529f3a[_0x793e('0x1e')]===_0x793e('0x1f');var _0x576817=_0x2543f5[_0x793e('0x20')];var _0x256bda=_0x2cee19?0x0:_0x529f3a[_0x793e('0x21')];var _0x25b17a=_0x2cee19?_0x2543f5['count']:_0x529f3a[_0x793e('0x21')]+_0x529f3a[_0x793e('0x1e')];var _0x3f6e8d;if(_0x25b17a>=_0x576817){_0x25b17a=_0x576817;_0x3f6e8d=0xc8;}else{_0x3f6e8d=0xce;}_0x404dd6['status'](_0x3f6e8d);return _0x404dd6[_0x793e('0x22')](_0x793e('0x23'),_0x256bda+'-'+_0x25b17a+'/'+_0x576817)[_0x793e('0x1d')](_0x2543f5);}return null;};}function patchUpdates(_0xaa3129){return function(_0x17a725){try{jsonpatch[_0x793e('0x24')](_0x17a725,_0xaa3129,!![]);}catch(_0xf7df78){return BPromise['reject'](_0xf7df78);}return _0x17a725[_0x793e('0x25')]();};}function saveUpdates(_0x1dcd36,_0x410775){return function(_0x1e892d){if(_0x1e892d){return _0x1e892d[_0x793e('0x26')](_0x1dcd36)[_0x793e('0x27')](function(_0x40eaa5){return _0x40eaa5;});}return null;};}function removeEntity(_0x356208,_0x6f0981){return function(_0x320b59){if(_0x320b59){return _0x320b59[_0x793e('0x28')]()[_0x793e('0x27')](function(){_0x356208[_0x793e('0x1b')](0xcc)[_0x793e('0x1c')]();});}};}function handleEntityNotFound(_0x3c84fd,_0x2dad42){return function(_0x241fa8){if(!_0x241fa8){_0x3c84fd['sendStatus'](0x194);}return _0x241fa8;};}function handleError(_0x590a61,_0x2aba3e){_0x2aba3e=_0x2aba3e||0x1f4;return function(_0x2b303b){logger[_0x793e('0x29')](_0x2b303b[_0x793e('0x2a')]);if(_0x2b303b[_0x793e('0x2b')]){delete _0x2b303b['name'];}_0x590a61[_0x793e('0x1b')](_0x2aba3e)[_0x793e('0x2c')](_0x2b303b);};}exports[_0x793e('0x2d')]=function(_0x171c2b,_0x1e6da6){var _0x3bde7c={},_0x268c33={},_0x2c37cf={'count':0x0,'rows':[]};var _0x4aeaaf=_['map'](db[_0x793e('0x2e')]['rawAttributes'],function(_0x3419c3){return{'name':_0x3419c3[_0x793e('0x2f')],'type':_0x3419c3['type'][_0x793e('0x30')]};});_0x268c33['model']=_['differenceBy'](_[_0x793e('0x31')](_0x4aeaaf,'name'),['format']);_0x268c33[_0x793e('0x32')]=_['keys'](_0x171c2b[_0x793e('0x32')]);_0x268c33[_0x793e('0x33')]=_['intersection'](_0x268c33[_0x793e('0x34')],_0x268c33[_0x793e('0x32')]);_0x3bde7c[_0x793e('0x35')]=_[_0x793e('0x36')](_0x268c33[_0x793e('0x34')],qs[_0x793e('0x37')](_0x171c2b[_0x793e('0x32')][_0x793e('0x37')]));_0x3bde7c['attributes']=_0x3bde7c[_0x793e('0x35')][_0x793e('0x38')]?_0x3bde7c[_0x793e('0x35')]:_0x268c33['model'];if(!_0x171c2b[_0x793e('0x32')][_0x793e('0x39')]('nolimit')){_0x3bde7c[_0x793e('0x1e')]=qs['limit'](_0x171c2b['query'][_0x793e('0x1e')]);_0x3bde7c['offset']=qs[_0x793e('0x21')](_0x171c2b[_0x793e('0x32')][_0x793e('0x21')]);}_0x3bde7c[_0x793e('0x3a')]=qs[_0x793e('0x3b')](_0x171c2b[_0x793e('0x32')][_0x793e('0x3b')]);_0x3bde7c[_0x793e('0x3c')]=qs['filters'](_[_0x793e('0x3d')](_0x171c2b[_0x793e('0x32')],_0x268c33['filters']),_0x4aeaaf);if(_0x171c2b[_0x793e('0x32')][_0x793e('0x3e')]){_0x3bde7c[_0x793e('0x3c')]=_[_0x793e('0x3f')](_0x3bde7c['where'],{'$or':_['map'](_0x4aeaaf,function(_0x193e82){if(_0x193e82[_0x793e('0x40')]!==_0x793e('0x41')){var _0x4b3669={};_0x4b3669[_0x193e82[_0x793e('0x2b')]]={'$like':'%'+_0x171c2b[_0x793e('0x32')][_0x793e('0x3e')]+'%'};return _0x4b3669;}})});}_0x3bde7c=_[_0x793e('0x3f')]({},_0x3bde7c,_0x171c2b[_0x793e('0x42')]);var _0x1eaac7={'where':_0x3bde7c[_0x793e('0x3c')]};return db[_0x793e('0x2e')]['count'](_0x1eaac7)[_0x793e('0x27')](function(_0x2cc2ca){_0x2c37cf[_0x793e('0x20')]=_0x2cc2ca;if(_0x171c2b['query'][_0x793e('0x43')]){_0x3bde7c[_0x793e('0x44')]=[{'all':!![]}];}return db[_0x793e('0x2e')][_0x793e('0x45')](_0x3bde7c);})['then'](function(_0x361171){_0x2c37cf[_0x793e('0x46')]=_0x361171;return _0x2c37cf;})[_0x793e('0x27')](respondWithFilteredResult(_0x1e6da6,_0x3bde7c))[_0x793e('0x47')](handleError(_0x1e6da6,null));};exports[_0x793e('0x48')]=function(_0x3fab79,_0x3b23cd){var _0x9fab23={'raw':![],'where':{'id':_0x3fab79['params']['id']}},_0x10d0b0={};_0x10d0b0['model']=_[_0x793e('0x49')](db[_0x793e('0x2e')][_0x793e('0x4a')]);_0x10d0b0[_0x793e('0x32')]=_['keys'](_0x3fab79[_0x793e('0x32')]);_0x10d0b0[_0x793e('0x33')]=_[_0x793e('0x36')](_0x10d0b0['model'],_0x10d0b0[_0x793e('0x32')]);_0x9fab23['attributes']=_[_0x793e('0x36')](_0x10d0b0['model'],qs[_0x793e('0x37')](_0x3fab79[_0x793e('0x32')][_0x793e('0x37')]));_0x9fab23[_0x793e('0x35')]=_0x9fab23['attributes'][_0x793e('0x38')]?_0x9fab23[_0x793e('0x35')]:_0x10d0b0[_0x793e('0x34')];if(_0x3fab79['query'][_0x793e('0x43')]){_0x9fab23[_0x793e('0x44')]=[{'all':!![]}];}_0x9fab23=_['merge']({},_0x9fab23,_0x3fab79['options']);return db[_0x793e('0x2e')][_0x793e('0x4b')](_0x9fab23)[_0x793e('0x27')](handleEntityNotFound(_0x3b23cd,null))[_0x793e('0x27')](respondWithResult(_0x3b23cd,null))['catch'](handleError(_0x3b23cd,null));};exports[_0x793e('0x4c')]=function(_0x38b302,_0x3e34dd){return db[_0x793e('0x2e')][_0x793e('0x4c')](_0x38b302[_0x793e('0x4d')],{})[_0x793e('0x27')](respondWithResult(_0x3e34dd,0xc9))['catch'](handleError(_0x3e34dd,null));};exports[_0x793e('0x26')]=function(_0x4b2067,_0x4039dc){if(_0x4b2067[_0x793e('0x4d')]['id']){delete _0x4b2067[_0x793e('0x4d')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x4b2067['params']['id']}})[_0x793e('0x27')](handleEntityNotFound(_0x4039dc,null))[_0x793e('0x27')](saveUpdates(_0x4b2067[_0x793e('0x4d')],null))['then'](respondWithResult(_0x4039dc,null))[_0x793e('0x47')](handleError(_0x4039dc,null));};exports[_0x793e('0x4e')]=function(_0x3498cd,_0x45199e){return db[_0x793e('0x2e')][_0x793e('0x4e')]()[_0x793e('0x27')](respondWithResult(_0x45199e,null))[_0x793e('0x47')](handleError(_0x45199e,null));};exports['download']=function(_0x5de29e,_0x2663e3,_0x5c31e4){var _0x5b4591=require(_0x793e('0x4f'));var _0x5916f6=![];var _0x424ea5={};if(_0x5de29e[_0x793e('0x32')][_0x793e('0x40')]&&_0x5de29e[_0x793e('0x32')][_0x793e('0x40')]==='uniqueid'){_0x424ea5['uniqueid']=_0x5de29e[_0x793e('0x50')]['id'];}else{_0x424ea5['id']=_0x5de29e[_0x793e('0x50')]['id'];}return db[_0x793e('0x2e')]['find']({'where':_0x424ea5,'attributes':['id',_0x793e('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x2663e3,null))[_0x793e('0x27')](function(_0x40436c){if(_0x40436c){var _0x3043e8=_0x40436c[_0x793e('0x51')];var _0x1faaa2=util[_0x793e('0x52')](_0x793e('0x53'),_0x3043e8);if(fs[_0x793e('0x54')](_0x1faaa2)){_0x5916f6=!![];return _0x5b4591['decryptFile'](_0x1faaa2,_0x3043e8,config['secrets'][_0x793e('0x55')])[_0x793e('0x27')](function(){return _0x40436c;});}return _0x40436c;}})[_0x793e('0x27')](function(_0x45708d){if(_0x45708d){var _0x2871e9=_0x45708d['value'];if(!fs[_0x793e('0x54')](_0x2871e9)){throw new db[(_0x793e('0x56'))]['ValidationError'](_0x793e('0x57'));}if(_0x45708d['filename']){return _0x2663e3[_0x793e('0x58')](_0x2871e9,_0x45708d[_0x793e('0x59')]+path[_0x793e('0x5a')](_0x2871e9),function(){if(_0x5916f6){fs[_0x793e('0x5b')](_0x2871e9);}});}else{return _0x2663e3[_0x793e('0x58')](_0x2871e9,function(_0x2f5e05){if(_0x5916f6){fs[_0x793e('0x5b')](_0x2871e9);}});}}})[_0x793e('0x47')](function(_0x2a781){if(_0x2a781[_0x793e('0x5c')]===_0x793e('0x57')){_0x2663e3[_0x793e('0x1b')](0x194)['send'](_0x793e('0x5d'));}else{return handleError(_0x2663e3,null);}});};exports[_0x793e('0x5e')]=function(_0x2d7467,_0x2b9ef7,_0x2c1c4c){var _0x405f66=require('../../components/encryptor');var _0x5dc362=![];var _0x3ffed3={'$and':[db['sequelize'][_0x793e('0x3c')](db[_0x793e('0x5f')]['fn'](_0x793e('0x60'),db[_0x793e('0x5f')][_0x793e('0x61')](_0x793e('0x62'))),_0x2d7467[_0x793e('0x32')][_0x793e('0x63')])]};if(_0x2d7467[_0x793e('0x32')][_0x793e('0x40')]&&_0x2d7467[_0x793e('0x32')]['type']==='uniqueid'){_0x3ffed3[_0x793e('0x64')][_0x793e('0x65')]({'uniqueid':_0x2d7467[_0x793e('0x50')]['id']});}else{_0x3ffed3[_0x793e('0x64')][_0x793e('0x65')]({'id':_0x2d7467['params']['id']});}return db['VoiceRecording'][_0x793e('0x4b')]({'where':_0x3ffed3,'attributes':['id',_0x793e('0x51')],'raw':!![]})[_0x793e('0x27')](handleEntityNotFound(_0x2b9ef7,null))[_0x793e('0x27')](function(_0x3e594a){if(_0x3e594a){var _0x567295=util[_0x793e('0x52')](_0x793e('0x53'),_0x3e594a[_0x793e('0x51')]);if(fs['existsSync'](_0x567295)){_0x5dc362=!![];return _0x405f66[_0x793e('0x66')](_0x567295,_0x3e594a[_0x793e('0x51')],config[_0x793e('0x67')][_0x793e('0x55')])[_0x793e('0x27')](function(){return _0x3e594a;});}return _0x3e594a;}})[_0x793e('0x27')](function(_0x4c5484){if(_0x4c5484){if(!fs[_0x793e('0x54')](_0x4c5484[_0x793e('0x51')])){throw new db[(_0x793e('0x56'))][(_0x793e('0x68'))](_0x793e('0x57'));}if(_0x4c5484[_0x793e('0x59')]){return _0x2b9ef7[_0x793e('0x58')](_0x4c5484[_0x793e('0x51')],_0x4c5484[_0x793e('0x59')]+path[_0x793e('0x5a')](_0x4c5484[_0x793e('0x51')]),function(){if(_0x5dc362){fs[_0x793e('0x5b')](_0x4c5484[_0x793e('0x51')]);}});}else{return _0x2b9ef7[_0x793e('0x58')](_0x4c5484[_0x793e('0x51')],function(_0x134be8){if(_0x5dc362){fs[_0x793e('0x5b')](_0x4c5484[_0x793e('0x51')]);}});}}})[_0x793e('0x47')](handleError(_0x2b9ef7,null));};exports[_0x793e('0x28')]=function(_0x1685d0,_0x52de02){return db[_0x793e('0x2e')]['find']({'where':{'id':_0x1685d0[_0x793e('0x50')]['id']}})[_0x793e('0x27')](function(_0x50b084){if(_[_0x793e('0x69')](_0x50b084)){throw new ReferenceError(_0x793e('0x6a'));}return _0x50b084;})[_0x793e('0x27')](function(_0x1822a0){var _0x32fe46=_0x1822a0['value'];logger[_0x793e('0x6b')](_0x793e('0x6c'),_0x32fe46);if(!_['isNil'](_0x1822a0[_0x793e('0x51')])&&fs[_0x793e('0x54')](_0x32fe46)){logger[_0x793e('0x6b')](_0x793e('0x6d')+_0x32fe46+_0x793e('0x6e'));fs[_0x793e('0x6f')](_0x32fe46);}_0x32fe46=_0x32fe46+_0x793e('0x70');if(!_['isNil'](_0x1822a0[_0x793e('0x51')])&&fs['existsSync'](_0x32fe46)){logger[_0x793e('0x6b')](_0x793e('0x6d')+_0x32fe46+_0x793e('0x6e'));fs[_0x793e('0x6f')](_0x32fe46);}return _0x1822a0;})[_0x793e('0x27')](function(_0x30c5df){if(!_0x30c5df)throw new InternalError();return _0x30c5df[_0x793e('0x28')]();})[_0x793e('0x27')](function(){_0x52de02['status'](0xcc)[_0x793e('0x1c')]();})['catch'](handleError(_0x52de02,null));};function getBucketslist(_0x2acf5e,_0x38541f,_0x1eec66){return new Promise(function(_0xf9a5d3,_0x22d37e){var _0x12074d=new AWS['S3']({'accessKeyId':_0x38541f,'secretAccessKey':_0x2acf5e,'region':_0x1eec66});_0x12074d[_0x793e('0x71')]({},function(_0x370916,_0x5dac57){if(_0x370916){return _0x22d37e(_0x370916);}else{return _0xf9a5d3(_0x5dac57);}});});}function createBucket(_0x3b22e8,_0x4fe285,_0x31d47d,_0x35ef2f){return new Promise(function(_0x1916ad,_0x3d28ad){var _0x3e68b9=new AWS['S3']({'accessKeyId':_0x4fe285,'secretAccessKey':_0x3b22e8,'region':_0x31d47d});_0x3e68b9[_0x793e('0x72')]({'Bucket':_0x35ef2f},function(_0x29e600,_0x53b666){if(_0x29e600){return _0x3d28ad(_0x29e600);}else{return _0x1916ad(_0x53b666);}});});}function uploadFile(_0x279ad8,_0x478b52,_0x5f550c,_0x3a7072,_0x5d940d,_0x1925d9){return new Promise(function(_0x315c3f,_0x4dbe6b){var _0x3cc261=new AWS['S3']({'accessKeyId':_0x478b52,'secretAccessKey':_0x279ad8,'region':_0x5f550c});_0x3cc261[_0x793e('0x73')]({'Bucket':_0x3a7072,'Key':_0x5d940d,'Body':_0x1925d9},function(_0x205df2,_0x196672){if(_0x205df2){return _0x4dbe6b(_0x205df2);}else{return _0x315c3f(_0x196672);}});});}function startTranscribe(_0x32217b,_0x2b3e76,_0x1528c8,_0x36c290,_0x399552,_0x1428fc){return new Promise(function(_0x49e3d6,_0x1e02c1){var _0x49ed00=new AWS[(_0x793e('0x74'))]({'accessKeyId':_0x2b3e76,'secretAccessKey':_0x32217b,'region':_0x1528c8});_0x49ed00[_0x793e('0x75')]({'TranscriptionJobName':_0x36c290,'LanguageCode':_0x399552,'Media':{'MediaFileUri':_0x1428fc}},function(_0xa77a76,_0x418e2){if(_0xa77a76){return _0x1e02c1(_0xa77a76);}else{return _0x49e3d6(_0x418e2);}});});}function transcribe(_0x1d448e,_0x3ea44f,_0x543a00,_0x453d28,_0x153c53,_0x2bf5ad,_0x4fb70d){return new Promise(function(_0x236846,_0x308324){var _0x2a4df7={};logger[_0x793e('0x6b')](util[_0x793e('0x52')](_0x793e('0x76'),_0x1d448e,_0x153c53));return uploadFile(_0x3ea44f,_0x543a00,_0x453d28,_0x153c53,path['basename'](_0x2bf5ad),fs[_0x793e('0x77')](_0x2bf5ad))['then'](function(_0x8bc886){logger[_0x793e('0x6b')](util[_0x793e('0x52')](_0x793e('0x78'),_0x1d448e,_0x153c53,_0x8bc886[_0x793e('0x79')]));_0x2a4df7[_0x793e('0x7a')]=_0x8bc886['Bucket'];_0x2a4df7['location']=_0x8bc886[_0x793e('0x79')];logger[_0x793e('0x6b')](util[_0x793e('0x52')](_0x793e('0x7b'),_0x1d448e));return startTranscribe(_0x3ea44f,_0x543a00,_0x453d28,uuidv4(),_0x4fb70d,_0x8bc886[_0x793e('0x79')]);})[_0x793e('0x27')](function(_0x5b4be0){logger['info'](util[_0x793e('0x52')](_0x793e('0x7c'),_0x1d448e,_0x5b4be0[_0x793e('0x7d')][_0x793e('0x7e')]));_0x2a4df7['transcribeName']=_0x5b4be0[_0x793e('0x7d')][_0x793e('0x7e')];_0x2a4df7[_0x793e('0x7f')]=_0x5b4be0['TranscriptionJob'][_0x793e('0x80')];return _0x236846(_0x2a4df7);})[_0x793e('0x47')](function(_0x91b141){return _0x308324(_0x91b141);});});}exports[_0x793e('0x81')]=function(_0x18af26,_0xfa7624,_0x5c1cfb){var _0x541169;var _0x16e5f9;var _0x3151fc;var _0x2379b8=require(_0x793e('0x4f'));return db['VoiceRecording'][_0x793e('0x82')]({'where':{'id':_0x18af26[_0x793e('0x50')]['id']}})[_0x793e('0x27')](function(_0x28ddc9){if(_0x28ddc9){var _0x5dc901=util['format']('%s.cypher',_0x28ddc9['value']);if(fs[_0x793e('0x54')](_0x5dc901)){cypher=!![];return _0x2379b8[_0x793e('0x66')](_0x5dc901,_0x28ddc9[_0x793e('0x51')],config[_0x793e('0x67')][_0x793e('0x55')])['then'](function(){return _0x28ddc9;});}return _0x28ddc9;}})['then'](function(_0x5b418c){if(!_0x5b418c){throw new db[(_0x793e('0x56'))][(_0x793e('0x68'))]('Voice\x20Recording\x20not\x20found');}_0x16e5f9=_0x5b418c;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x793e('0x27')](handleEntityNotFound(_0xfa7624,null))['then'](function(_0x4a7ab8){if(_0x4a7ab8){_0x541169=_0x4a7ab8;if(!_0x541169['transcribe']||!_0x541169[_0x793e('0x83')]||!_0x541169['transcribeRegion']||!_0x541169[_0x793e('0x84')]||!_0x541169[_0x793e('0x7a')]){throw new db[(_0x793e('0x56'))][(_0x793e('0x68'))](_0x793e('0x85'));}if(_0x18af26[_0x793e('0x4d')][_0x793e('0x86')]&&(!_0x541169[_0x793e('0x87')]||!_0x541169['sentimentAccountId']||!_0x541169[_0x793e('0x88')]||!_0x541169[_0x793e('0x84')]||!_0x541169['bucket'])){throw new db[(_0x793e('0x56'))][(_0x793e('0x68'))](_0x793e('0x89'));}return db[_0x793e('0x8a')]['findOne']({'where':{'id':_0x541169['transcribeAccountId']}});}})[_0x793e('0x27')](function(_0x4a14b9){if(!_0x4a14b9){throw new db['Sequelize'][(_0x793e('0x68'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4a14b9['data1']||!_0x4a14b9[_0x793e('0x8b')]){throw new db[(_0x793e('0x56'))][(_0x793e('0x68'))](_0x793e('0x8c'));}_0x3151fc=_0x4a14b9;return getBucketslist(_0x3151fc['data1'],_0x3151fc[_0x793e('0x8b')],_0x541169[_0x793e('0x8d')]);})[_0x793e('0x27')](function(_0x483b41){if(_0x483b41&&_0x483b41[_0x793e('0x8e')]){var _0x5d9791=_['find'](_0x483b41['Buckets'],function(_0x393460){return _0x393460[_0x793e('0x8f')]===_0x541169[_0x793e('0x7a')];});if(!_0x5d9791){logger[_0x793e('0x6b')](util[_0x793e('0x52')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x18af26[_0x793e('0x50')]['id'],_0x541169[_0x793e('0x7a')]));return createBucket(_0x3151fc[_0x793e('0x90')],_0x3151fc['data2'],_0x541169[_0x793e('0x8d')],_0x541169[_0x793e('0x7a')]);}logger[_0x793e('0x6b')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x18af26[_0x793e('0x50')]['id'],_0x541169[_0x793e('0x7a')]));return;}})['then'](function(_0x5a85cc){if(_0x16e5f9['transcribeStatus']===_0x793e('0x91')){return transcribe(_0x18af26[_0x793e('0x50')]['id'],_0x3151fc[_0x793e('0x90')],_0x3151fc[_0x793e('0x8b')],_0x541169[_0x793e('0x8d')],_0x541169['bucket'],_0x16e5f9[_0x793e('0x51')],_0x541169[_0x793e('0x84')]);}else{logger[_0x793e('0x6b')](util[_0x793e('0x52')](_0x793e('0x92'),_0x18af26[_0x793e('0x50')]['id']));return{'transcribeStatus':_0x793e('0x93')};}})[_0x793e('0x27')](function(_0x40ca85){if(_0x40ca85){_0x40ca85[_0x793e('0x94')]=_0x18af26[_0x793e('0x4d')][_0x793e('0x86')];return _0x16e5f9[_0x793e('0x95')](_0x40ca85);}})[_0x793e('0x27')](respondWithResult(_0xfa7624,null))['catch'](handleError(_0xfa7624,null));};function writeFile(_0xb5fd8e,_0x18888d){return new Promise(function(_0x551c76,_0x50eb4a){fs[_0x793e('0x96')](_0x18888d,_0xb5fd8e,function(_0x41c142,_0x13dfab){if(_0x41c142){return _0x50eb4a(_0x41c142);}else{return _0x551c76(_0x13dfab);}});});}exports[_0x793e('0x97')]=function(_0x4752ee,_0x35c34e,_0x3daeb8){return db[_0x793e('0x2e')][_0x793e('0x82')]({'where':{'id':_0x4752ee[_0x793e('0x50')]['id']}})['then'](handleEntityNotFound(_0x35c34e))['then'](function(_0x357772){if(_0x357772&&_0x357772['fileText']){var _0x562a57=_0x357772[_0x793e('0x98')];var _0x394110=config[_0x793e('0x99')]+_0x793e('0x9a')+_0x357772['id']+_0x793e('0x9b');if(fs[_0x793e('0x54')](_0x394110)){return _0x394110;}return writeFile(_0x562a57,_0x394110)[_0x793e('0x27')](function(){return _0x394110;});}else{throw new db[(_0x793e('0x56'))][(_0x793e('0x68'))]('Transcript\x20not\x20available');}})[_0x793e('0x27')](function(_0x55ed03){return _0x35c34e[_0x793e('0x58')](_0x55ed03);})[_0x793e('0x47')](handleError(_0x35c34e));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 4fc1625..85b36b9 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 _0xa164=['../../config/environment','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x253dfd,_0x75e86c){var _0x399cf6=function(_0x294a06){while(--_0x294a06){_0x253dfd['push'](_0x253dfd['shift']());}};_0x399cf6(++_0x75e86c);}(_0xa164,0x19e));var _0x4a16=function(_0x38835a,_0x294338){_0x38835a=_0x38835a-0x0;var _0x310190=_0xa164[_0x38835a];return _0x310190;};'use strict';var _=require('lodash');var util=require(_0x4a16('0x0'));var logger=require(_0x4a16('0x1'))(_0x4a16('0x2'));var moment=require(_0x4a16('0x3'));var BPromise=require(_0x4a16('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4a16('0x5'));var config=require(_0x4a16('0x6'));var attributes=require(_0x4a16('0x7'));module[_0x4a16('0x8')]=function(_0x207d5b,_0x1cc4f1){return _0x207d5b['define'](_0x4a16('0x9'),attributes,{'tableName':_0x4a16('0xa'),'paranoid':![],'indexes':[{'name':_0x4a16('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x753e=['../../config/environment','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x158ab3,_0x4b5908){var _0x302830=function(_0x19fa14){while(--_0x19fa14){_0x158ab3['push'](_0x158ab3['shift']());}};_0x302830(++_0x4b5908);}(_0x753e,0x18c));var _0xe753=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x753e[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0xe753('0x0'));var util=require(_0xe753('0x1'));var logger=require(_0xe753('0x2'))(_0xe753('0x3'));var moment=require(_0xe753('0x4'));var BPromise=require(_0xe753('0x5'));var rp=require(_0xe753('0x6'));var fs=require('fs');var path=require(_0xe753('0x7'));var rimraf=require(_0xe753('0x8'));var config=require(_0xe753('0x9'));var attributes=require(_0xe753('0xa'));module[_0xe753('0xb')]=function(_0x7ade6,_0x2742a2){return _0x7ade6[_0xe753('0xc')]('VoiceRecording',attributes,{'tableName':_0xe753('0xd'),'paranoid':![],'indexes':[{'name':_0xe753('0xe'),'fields':[_0xe753('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 50ac699..43f5399 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 _0x8e3f=['where','attributes','limit','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw'];(function(_0x42bfb7,_0x25a3ec){var _0x5c497d=function(_0x48e83e){while(--_0x48e83e){_0x42bfb7['push'](_0x42bfb7['shift']());}};_0x5c497d(++_0x25a3ec);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8e3f[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ee9f3,_0x4e9e57,_0x4504dd){return new BPromise(function(_0x2e39b7,_0x17f56c){return client[_0xf8e3('0xb')](_0x1ee9f3,_0x4504dd)[_0xf8e3('0xc')](function(_0x4055e2){logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));logger[_0xf8e3('0x10')](_0xf8e3('0x11'),_0x4e9e57,_0xf8e3('0xf'),JSON['stringify'](_0x4055e2));if(_0x4055e2[_0xf8e3('0x12')]){if(_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x13')]===0x1f4){logger['error'](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x14')]);return _0x17f56c(_0x4055e2[_0xf8e3('0x12')]['message']);}logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')]['message']);return _0x2e39b7(_0x4055e2[_0xf8e3('0x12')]['message']);}else{logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));_0x2e39b7(_0x4055e2['result']['message']);}})[_0xf8e3('0x15')](function(_0x385dde){logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x385dde);_0x17f56c(_0x385dde);});});}exports[_0xf8e3('0x16')]=function(_0x11d4cc){var _0x7a81c3=this;return new Promise(function(_0x2e27e3,_0x1337ae){return db[_0xf8e3('0x17')]['update'](_0x11d4cc[_0xf8e3('0x18')],{'raw':_0x11d4cc[_0xf8e3('0x19')]?_0x11d4cc[_0xf8e3('0x19')][_0xf8e3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11d4cc[_0xf8e3('0x19')]?_0x11d4cc[_0xf8e3('0x19')][_0xf8e3('0x1b')]||null:null,'attributes':_0x11d4cc[_0xf8e3('0x19')]?_0x11d4cc['options'][_0xf8e3('0x1c')]||null:null,'limit':_0x11d4cc[_0xf8e3('0x19')]?_0x11d4cc[_0xf8e3('0x19')][_0xf8e3('0x1d')]||null:null})['then'](function(_0x39df34){logger['info'](_0xf8e3('0x16'),_0x11d4cc);logger[_0xf8e3('0x10')](_0xf8e3('0x16'),_0x11d4cc,JSON[_0xf8e3('0x1e')](_0x39df34));_0x2e27e3(_0x39df34);})[_0xf8e3('0x15')](function(_0x3ac384){logger['error'](_0xf8e3('0x16'),_0x3ac384[_0xf8e3('0x14')],_0x11d4cc);_0x1337ae(_0x7a81c3[_0xf8e3('0x12')](0x1f4,_0x3ac384[_0xf8e3('0x14')]));});});};exports[_0xf8e3('0x1f')]=function(_0x3b41a1){var _0x2963ed=this;return new Promise(function(_0x157a2d,_0x56fa8e){var _0x356e0a=require(_0xf8e3('0x20'));var _0x12ebd2;return db[_0xf8e3('0x21')][_0xf8e3('0x22')]({'attributes':['id',_0xf8e3('0x23')],'where':{'id':0x1},'raw':!![]})[_0xf8e3('0xc')](function(_0xfaf15d){_0x12ebd2=_0xfaf15d;return db['VoiceRecording'][_0xf8e3('0x24')](_0x3b41a1[_0xf8e3('0x18')]);})[_0xf8e3('0xc')](function(_0x28b2f2){if(_0x12ebd2['callRecordingEncryption']&&fs[_0xf8e3('0x25')](_0x28b2f2[_0xf8e3('0x26')])){var _0x40f64d=util[_0xf8e3('0x27')](_0xf8e3('0x28'),_0x28b2f2[_0xf8e3('0x26')]);return _0x356e0a[_0xf8e3('0x29')](_0x28b2f2[_0xf8e3('0x26')],_0x40f64d,config['secrets'][_0xf8e3('0x2a')])[_0xf8e3('0xc')](function(){fs['unlink'](_0x28b2f2['value']);logger['info'](_0xf8e3('0x2b'));return _0x28b2f2;});}return _0x28b2f2;})['then'](function(_0x2559ea){logger[_0xf8e3('0xd')](_0xf8e3('0x1f'),_0x3b41a1);logger[_0xf8e3('0x10')]('CreateVoiceRecording',_0x3b41a1,JSON['stringify'](_0x2559ea));_0x157a2d(_0x2559ea);})[_0xf8e3('0x15')](function(_0x2f87d8){logger[_0xf8e3('0x12')](_0xf8e3('0x1f'),_0x2f87d8[_0xf8e3('0x14')],_0x3b41a1);_0x56fa8e(_0x2963ed[_0xf8e3('0x12')](0x1f4,_0x2f87d8['message']));});});}; \ No newline at end of file +var _0xd824=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','then','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash'];(function(_0x26d3ab,_0x1ece96){var _0x5252ba=function(_0x1bcfae){while(--_0x1bcfae){_0x26d3ab['push'](_0x26d3ab['shift']());}};_0x5252ba(++_0x1ece96);}(_0xd824,0xc2));var _0x4d82=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd824[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b842f,_0x464caf,_0xb54db2){return new BPromise(function(_0x13d624,_0x5cccb6){return client[_0x4d82('0x9')](_0x4b842f,_0xb54db2)['then'](function(_0x5356cd){logger[_0x4d82('0xa')](_0x4d82('0xb'),_0x464caf,_0x4d82('0xc'));logger['debug'](_0x4d82('0xd'),_0x464caf,'request\x20sent',JSON[_0x4d82('0xe')](_0x5356cd));if(_0x5356cd[_0x4d82('0xf')]){if(_0x5356cd[_0x4d82('0xf')]['code']===0x1f4){logger['error'](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')][_0x4d82('0x10')]);return _0x5cccb6(_0x5356cd[_0x4d82('0xf')]['message']);}logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')]['message']);return _0x13d624(_0x5356cd[_0x4d82('0xf')]['message']);}else{logger[_0x4d82('0xa')]('VoiceRecording,\x20%s,\x20%s',_0x464caf,_0x4d82('0xc'));_0x13d624(_0x5356cd['result'][_0x4d82('0x10')]);}})[_0x4d82('0x11')](function(_0x461476){logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x461476);_0x5cccb6(_0x461476);});});}exports[_0x4d82('0x12')]=function(_0x258c59){var _0x217b72=this;return new Promise(function(_0x2f2127,_0x5ef783){return db[_0x4d82('0x13')][_0x4d82('0x14')](_0x258c59[_0x4d82('0x15')],{'raw':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')][_0x4d82('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')][_0x4d82('0x18')]||null:null,'attributes':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')]['attributes']||null:null,'limit':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')]['limit']||null:null})[_0x4d82('0x19')](function(_0x41f194){logger[_0x4d82('0xa')](_0x4d82('0x12'),_0x258c59);logger[_0x4d82('0x1a')](_0x4d82('0x12'),_0x258c59,JSON[_0x4d82('0xe')](_0x41f194));_0x2f2127(_0x41f194);})[_0x4d82('0x11')](function(_0x12feab){logger[_0x4d82('0xf')](_0x4d82('0x12'),_0x12feab[_0x4d82('0x10')],_0x258c59);_0x5ef783(_0x217b72[_0x4d82('0xf')](0x1f4,_0x12feab[_0x4d82('0x10')]));});});};exports[_0x4d82('0x1b')]=function(_0x4af6da){var _0x5e0b03=this;return new Promise(function(_0x3dcb0f,_0x2548de){var _0x2a0572=require(_0x4d82('0x1c'));var _0x5cbd7e;return db[_0x4d82('0x1d')][_0x4d82('0x1e')]({'attributes':['id',_0x4d82('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x4d82('0x19')](function(_0x5ce98b){_0x5cbd7e=_0x5ce98b;return db[_0x4d82('0x13')]['create'](_0x4af6da['body']);})['then'](function(_0x52533b){if(_0x5cbd7e[_0x4d82('0x1f')]&&fs[_0x4d82('0x20')](_0x52533b[_0x4d82('0x21')])){var _0x52e320=util[_0x4d82('0x22')](_0x4d82('0x23'),_0x52533b['value']);return _0x2a0572['encryptFile'](_0x52533b[_0x4d82('0x21')],_0x52e320,config[_0x4d82('0x24')][_0x4d82('0x25')])[_0x4d82('0x19')](function(){fs['unlink'](_0x52533b[_0x4d82('0x21')]);logger['info'](_0x4d82('0x26'));return _0x52533b;});}return _0x52533b;})[_0x4d82('0x19')](function(_0x4a2a45){logger['info'](_0x4d82('0x1b'),_0x4af6da);logger[_0x4d82('0x1a')](_0x4d82('0x1b'),_0x4af6da,JSON[_0x4d82('0xe')](_0x4a2a45));_0x3dcb0f(_0x4a2a45);})[_0x4d82('0x11')](function(_0x420b28){logger[_0x4d82('0xf')](_0x4d82('0x1b'),_0x420b28[_0x4d82('0x10')],_0x4af6da);_0x2548de(_0x5e0b03[_0x4d82('0xf')](0x1f4,_0x420b28['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index eb4814c..cf36623 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 _0x2c89=['fs-extra','../../components/interaction/service','get','isAuthenticated','describe','create','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x360295,_0x361b1c){var _0xb3687a=function(_0x5ca16a){while(--_0x5ca16a){_0x360295['push'](_0x360295['shift']());}};_0xb3687a(++_0x361b1c);}(_0x2c89,0x90));var _0x92c8=function(_0x38ae1a,_0x1b7ebd){_0x38ae1a=_0x38ae1a-0x0;var _0x32b0cc=_0x2c89[_0x38ae1a];return _0x32b0cc;};'use strict';var multer=require(_0x92c8('0x0'));var util=require(_0x92c8('0x1'));var path=require(_0x92c8('0x2'));var timeout=require(_0x92c8('0x3'));var express=require(_0x92c8('0x4'));var router=express[_0x92c8('0x5')]();var fs_extra=require(_0x92c8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x92c8('0x7'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x92c8('0x8')]('/',auth[_0x92c8('0x9')](),controller['index']);router[_0x92c8('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x92c8('0xa')]);router['get']('/:id',auth[_0x92c8('0x9')](),controller['show']);router['post']('/',auth[_0x92c8('0x9')](),controller[_0x92c8('0xb')]);router['put'](_0x92c8('0xc'),auth[_0x92c8('0x9')](),controller['update']);router['delete'](_0x92c8('0xc'),auth['isAuthenticated'](),controller[_0x92c8('0xd')]);module[_0x92c8('0xe')]=router; \ No newline at end of file +var _0xfead=['create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','describe','show','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfead,0x167));var _0xdfea=function(_0x152ede,_0x1dfb09){_0x152ede=_0x152ede-0x0;var _0x419044=_0xfead[_0x152ede];return _0x419044;};'use strict';var multer=require(_0xdfea('0x0'));var util=require(_0xdfea('0x1'));var path=require(_0xdfea('0x2'));var timeout=require(_0xdfea('0x3'));var express=require('express');var router=express[_0xdfea('0x4')]();var fs_extra=require(_0xdfea('0x5'));var auth=require(_0xdfea('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdfea('0x7'));var controller=require(_0xdfea('0x8'));router[_0xdfea('0x9')]('/',auth[_0xdfea('0xa')](),controller[_0xdfea('0xb')]);router[_0xdfea('0x9')]('/describe',auth[_0xdfea('0xa')](),controller[_0xdfea('0xc')]);router[_0xdfea('0x9')]('/:id',auth[_0xdfea('0xa')](),controller[_0xdfea('0xd')]);router[_0xdfea('0xe')]('/',auth['isAuthenticated'](),controller[_0xdfea('0xf')]);router[_0xdfea('0x10')]('/:id',auth[_0xdfea('0xa')](),controller[_0xdfea('0x11')]);router[_0xdfea('0x12')](_0xdfea('0x13'),auth[_0xdfea('0xa')](),controller[_0xdfea('0x14')]);module[_0xdfea('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index a619d4e..3227d40 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 _0xf23e=['attended','STRING','Yes','sequelize','moment','exports','ENUM'];(function(_0x483e05,_0x3acb18){var _0x2978f4=function(_0x489450){while(--_0x489450){_0x483e05['push'](_0x483e05['shift']());}};_0x2978f4(++_0x3acb18);}(_0xf23e,0x130));var _0xef23=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xf23e[_0x2d34d6];return _0x1d3d12;};'use strict';var Sequelize=require(_0xef23('0x0'));var moment=require(_0xef23('0x1'));module[_0xef23('0x2')]={'type':{'type':Sequelize[_0xef23('0x3')]('blind',_0xef23('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xef23('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xef23('0x5')]},'transferercalleridname':{'type':Sequelize[_0xef23('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xef23('0x5')]},'transfererexten':{'type':Sequelize[_0xef23('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xef23('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xef23('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xef23('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xef23('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xef23('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xef23('0x5')]},'transfereecontext':{'type':Sequelize[_0xef23('0x5')]},'transfereeexten':{'type':Sequelize[_0xef23('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xef23('0x5')]},'isexternal':{'type':Sequelize[_0xef23('0x3')](_0xef23('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xef23('0x5')]}}; \ No newline at end of file +var _0xf30c=['attended','STRING','sequelize','exports','ENUM','blind'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xf30c,0x1e8));var _0xcf30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf30c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xcf30('0x0'));var moment=require('moment');module[_0xcf30('0x1')]={'type':{'type':Sequelize[_0xcf30('0x2')](_0xcf30('0x3'),_0xcf30('0x4'))},'result':{'type':Sequelize[_0xcf30('0x5')]},'transfererchannel':{'type':Sequelize[_0xcf30('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xcf30('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xcf30('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xcf30('0x5')]},'transferercontext':{'type':Sequelize[_0xcf30('0x5')]},'transfererexten':{'type':Sequelize[_0xcf30('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xcf30('0x5')]},'transfereechannel':{'type':Sequelize[_0xcf30('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xcf30('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xcf30('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xcf30('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xcf30('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xcf30('0x5')]},'transfereecontext':{'type':Sequelize[_0xcf30('0x5')]},'transfereeexten':{'type':Sequelize[_0xcf30('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xcf30('0x5')]},'isexternal':{'type':Sequelize[_0xcf30('0x2')]('Yes','No')},'context':{'type':Sequelize[_0xcf30('0x5')]},'extension':{'type':Sequelize[_0xcf30('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 008076f..9fd88a4 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 _0xb9dc=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','limit','count','set','json','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0xb9dc,0xd4));var _0xcb9d=function(_0x4d1c61,_0x569520){_0x4d1c61=_0x4d1c61-0x0;var _0x2ed02d=_0xb9dc[_0x4d1c61];return _0x2ed02d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb9d('0x0'));var zipdir=require(_0xcb9d('0x1'));var jsonpatch=require(_0xcb9d('0x2'));var rp=require(_0xcb9d('0x3'));var moment=require(_0xcb9d('0x4'));var BPromise=require(_0xcb9d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcb9d('0x6'));var sox=require(_0xcb9d('0x7'));var csv=require(_0xcb9d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb9d('0x9'));var _=require(_0xcb9d('0xa'));var squel=require(_0xcb9d('0xb'));var crypto=require(_0xcb9d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcb9d('0xd'));var toCsv=require(_0xcb9d('0x8'));var querystring=require(_0xcb9d('0xe'));var Papa=require(_0xcb9d('0xf'));var Redis=require(_0xcb9d('0x10'));var authService=require(_0xcb9d('0x11'));var qs=require(_0xcb9d('0x12'));var as=require(_0xcb9d('0x13'));var hardwareService=require(_0xcb9d('0x14'));var logger=require(_0xcb9d('0x15'))(_0xcb9d('0x16'));var utils=require(_0xcb9d('0x17'));var config=require(_0xcb9d('0x18'));var licenseUtil=require(_0xcb9d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a2998,_0x4e81c9){_0x4e81c9=_0x4e81c9||0xcc;return function(_0x3f8653){if(_0x3f8653){return _0x3a2998[_0xcb9d('0x1a')](_0x4e81c9);}return _0x3a2998[_0xcb9d('0x1b')](_0x4e81c9)[_0xcb9d('0x1c')]();};}function respondWithResult(_0x2dac06,_0x38eee7){_0x38eee7=_0x38eee7||0xc8;return function(_0x296403){if(_0x296403){return _0x2dac06[_0xcb9d('0x1b')](_0x38eee7)['json'](_0x296403);}};}function respondWithFilteredResult(_0x26984b,_0x19a64c){return function(_0x14f886){if(_0x14f886){var _0x12623e=typeof _0x19a64c['offset']==='undefined'&&typeof _0x19a64c[_0xcb9d('0x1d')]==='undefined';var _0x4d1ff=_0x14f886[_0xcb9d('0x1e')];var _0x444aee=_0x12623e?0x0:_0x19a64c['offset'];var _0x4cb555=_0x12623e?_0x14f886['count']:_0x19a64c['offset']+_0x19a64c['limit'];var _0x32d7e2;if(_0x4cb555>=_0x4d1ff){_0x4cb555=_0x4d1ff;_0x32d7e2=0xc8;}else{_0x32d7e2=0xce;}_0x26984b[_0xcb9d('0x1b')](_0x32d7e2);return _0x26984b[_0xcb9d('0x1f')]('Content-Range',_0x444aee+'-'+_0x4cb555+'/'+_0x4d1ff)[_0xcb9d('0x20')](_0x14f886);}return null;};}function patchUpdates(_0xf4cb89){return function(_0x1d4893){try{jsonpatch[_0xcb9d('0x21')](_0x1d4893,_0xf4cb89,!![]);}catch(_0x1fa527){return BPromise[_0xcb9d('0x22')](_0x1fa527);}return _0x1d4893[_0xcb9d('0x23')]();};}function saveUpdates(_0x334642,_0xbe8abe){return function(_0xae141d){if(_0xae141d){return _0xae141d[_0xcb9d('0x24')](_0x334642)[_0xcb9d('0x25')](function(_0xf10bf8){return _0xf10bf8;});}return null;};}function removeEntity(_0x50275d,_0x2334d5){return function(_0x2120c8){if(_0x2120c8){return _0x2120c8[_0xcb9d('0x26')]()['then'](function(){_0x50275d[_0xcb9d('0x1b')](0xcc)[_0xcb9d('0x1c')]();});}};}function handleEntityNotFound(_0x26327e,_0x15c775){return function(_0x4b50e2){if(!_0x4b50e2){_0x26327e['sendStatus'](0x194);}return _0x4b50e2;};}function handleError(_0x1c27b2,_0x48d566){_0x48d566=_0x48d566||0x1f4;return function(_0x4c13ef){logger[_0xcb9d('0x27')](_0x4c13ef['stack']);if(_0x4c13ef[_0xcb9d('0x28')]){delete _0x4c13ef['name'];}_0x1c27b2[_0xcb9d('0x1b')](_0x48d566)[_0xcb9d('0x29')](_0x4c13ef);};}exports[_0xcb9d('0x2a')]=function(_0x167de6,_0x3f01bd){var _0x1a27d8={},_0x19e73f={},_0x1c4e5f={'count':0x0,'rows':[]};var _0x116ab0=_[_0xcb9d('0x2b')](db[_0xcb9d('0x2c')]['rawAttributes'],function(_0x47018d){return{'name':_0x47018d[_0xcb9d('0x2d')],'type':_0x47018d[_0xcb9d('0x2e')][_0xcb9d('0x2f')]};});_0x19e73f[_0xcb9d('0x30')]=_[_0xcb9d('0x2b')](_0x116ab0,_0xcb9d('0x28'));_0x19e73f['query']=_['keys'](_0x167de6[_0xcb9d('0x31')]);_0x19e73f[_0xcb9d('0x32')]=_[_0xcb9d('0x33')](_0x19e73f[_0xcb9d('0x30')],_0x19e73f[_0xcb9d('0x31')]);_0x1a27d8[_0xcb9d('0x34')]=_[_0xcb9d('0x33')](_0x19e73f[_0xcb9d('0x30')],qs[_0xcb9d('0x35')](_0x167de6['query'][_0xcb9d('0x35')]));_0x1a27d8[_0xcb9d('0x34')]=_0x1a27d8[_0xcb9d('0x34')][_0xcb9d('0x36')]?_0x1a27d8[_0xcb9d('0x34')]:_0x19e73f[_0xcb9d('0x30')];if(!_0x167de6[_0xcb9d('0x31')][_0xcb9d('0x37')](_0xcb9d('0x38'))){_0x1a27d8[_0xcb9d('0x1d')]=qs[_0xcb9d('0x1d')](_0x167de6[_0xcb9d('0x31')][_0xcb9d('0x1d')]);_0x1a27d8[_0xcb9d('0x39')]=qs[_0xcb9d('0x39')](_0x167de6[_0xcb9d('0x31')][_0xcb9d('0x39')]);}_0x1a27d8[_0xcb9d('0x3a')]=qs[_0xcb9d('0x3b')](_0x167de6[_0xcb9d('0x31')][_0xcb9d('0x3b')]);_0x1a27d8[_0xcb9d('0x3c')]=qs[_0xcb9d('0x32')](_['pick'](_0x167de6[_0xcb9d('0x31')],_0x19e73f[_0xcb9d('0x32')]),_0x116ab0);if(_0x167de6[_0xcb9d('0x31')][_0xcb9d('0x3d')]){_0x1a27d8[_0xcb9d('0x3c')]=_['merge'](_0x1a27d8[_0xcb9d('0x3c')],{'$or':_[_0xcb9d('0x2b')](_0x116ab0,function(_0x4aa158){if(_0x4aa158[_0xcb9d('0x2e')]!=='VIRTUAL'){var _0x4efcb6={};_0x4efcb6[_0x4aa158[_0xcb9d('0x28')]]={'$like':'%'+_0x167de6[_0xcb9d('0x31')][_0xcb9d('0x3d')]+'%'};return _0x4efcb6;}})});}_0x1a27d8=_[_0xcb9d('0x3e')]({},_0x1a27d8,_0x167de6[_0xcb9d('0x3f')]);var _0x26649d={'where':_0x1a27d8[_0xcb9d('0x3c')]};return db[_0xcb9d('0x2c')]['count'](_0x26649d)[_0xcb9d('0x25')](function(_0x50dbe6){_0x1c4e5f['count']=_0x50dbe6;if(_0x167de6[_0xcb9d('0x31')][_0xcb9d('0x40')]){_0x1a27d8[_0xcb9d('0x41')]=[{'all':!![]}];}return db[_0xcb9d('0x2c')][_0xcb9d('0x42')](_0x1a27d8);})[_0xcb9d('0x25')](function(_0x436689){_0x1c4e5f[_0xcb9d('0x43')]=_0x436689;return _0x1c4e5f;})[_0xcb9d('0x25')](respondWithFilteredResult(_0x3f01bd,_0x1a27d8))['catch'](handleError(_0x3f01bd,null));};exports['show']=function(_0x53903c,_0x50f016){var _0x298021={'raw':!![],'where':{'id':_0x53903c[_0xcb9d('0x44')]['id']}},_0x14fe28={};_0x14fe28[_0xcb9d('0x30')]=_[_0xcb9d('0x45')](db[_0xcb9d('0x2c')][_0xcb9d('0x46')]);_0x14fe28[_0xcb9d('0x31')]=_[_0xcb9d('0x45')](_0x53903c['query']);_0x14fe28[_0xcb9d('0x32')]=_[_0xcb9d('0x33')](_0x14fe28['model'],_0x14fe28['query']);_0x298021['attributes']=_[_0xcb9d('0x33')](_0x14fe28[_0xcb9d('0x30')],qs[_0xcb9d('0x35')](_0x53903c[_0xcb9d('0x31')]['fields']));_0x298021[_0xcb9d('0x34')]=_0x298021[_0xcb9d('0x34')][_0xcb9d('0x36')]?_0x298021[_0xcb9d('0x34')]:_0x14fe28[_0xcb9d('0x30')];if(_0x53903c[_0xcb9d('0x31')][_0xcb9d('0x40')]){_0x298021[_0xcb9d('0x41')]=[{'all':!![]}];}_0x298021=_[_0xcb9d('0x3e')]({},_0x298021,_0x53903c[_0xcb9d('0x3f')]);return db[_0xcb9d('0x2c')][_0xcb9d('0x47')](_0x298021)[_0xcb9d('0x25')](handleEntityNotFound(_0x50f016,null))[_0xcb9d('0x25')](respondWithResult(_0x50f016,null))[_0xcb9d('0x48')](handleError(_0x50f016,null));};exports['create']=function(_0x3efc09,_0x2c371f){return db[_0xcb9d('0x2c')][_0xcb9d('0x49')](_0x3efc09['body'],{})[_0xcb9d('0x25')](respondWithResult(_0x2c371f,0xc9))[_0xcb9d('0x48')](handleError(_0x2c371f,null));};exports['update']=function(_0x4483bc,_0x67fc8d){if(_0x4483bc[_0xcb9d('0x4a')]['id']){delete _0x4483bc['body']['id'];}return db[_0xcb9d('0x2c')][_0xcb9d('0x47')]({'where':{'id':_0x4483bc[_0xcb9d('0x44')]['id']}})[_0xcb9d('0x25')](handleEntityNotFound(_0x67fc8d,null))[_0xcb9d('0x25')](saveUpdates(_0x4483bc[_0xcb9d('0x4a')],null))[_0xcb9d('0x25')](respondWithResult(_0x67fc8d,null))[_0xcb9d('0x48')](handleError(_0x67fc8d,null));};exports['destroy']=function(_0x2ddd73,_0x2f2be0){return db[_0xcb9d('0x2c')]['find']({'where':{'id':_0x2ddd73[_0xcb9d('0x44')]['id']}})[_0xcb9d('0x25')](handleEntityNotFound(_0x2f2be0,null))[_0xcb9d('0x25')](removeEntity(_0x2f2be0,null))[_0xcb9d('0x48')](handleError(_0x2f2be0,null));};exports[_0xcb9d('0x4b')]=function(_0x50faa6,_0x421a0c){return db[_0xcb9d('0x2c')][_0xcb9d('0x4b')]()[_0xcb9d('0x25')](respondWithResult(_0x421a0c,null))[_0xcb9d('0x48')](handleError(_0x421a0c,null));}; \ No newline at end of file +var _0xf986=['map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','then','rows','catch','show','params','length','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','offset','limit','undefined','count','Content-Range','apply','update','stack','name','VoiceTransferReport','rawAttributes','fieldName','type','key'];(function(_0x1a4d99,_0x506ad4){var _0x49619a=function(_0x186392){while(--_0x186392){_0x1a4d99['push'](_0x1a4d99['shift']());}};_0x49619a(++_0x506ad4);}(_0xf986,0xaf));var _0x6f98=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf986[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x6f98('0x0'));var rimraf=require(_0x6f98('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f98('0x2'));var rp=require(_0x6f98('0x3'));var moment=require(_0x6f98('0x4'));var BPromise=require(_0x6f98('0x5'));var Mustache=require(_0x6f98('0x6'));var util=require('util');var path=require(_0x6f98('0x7'));var sox=require(_0x6f98('0x8'));var csv=require(_0x6f98('0x9'));var ejs=require(_0x6f98('0xa'));var fs=require('fs');var fs_extra=require(_0x6f98('0xb'));var _=require('lodash');var squel=require(_0x6f98('0xc'));var crypto=require('crypto');var jsforce=require(_0x6f98('0xd'));var deskjs=require(_0x6f98('0xe'));var toCsv=require(_0x6f98('0x9'));var querystring=require(_0x6f98('0xf'));var Papa=require(_0x6f98('0x10'));var Redis=require(_0x6f98('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6f98('0x12'));var as=require(_0x6f98('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f98('0x14'))(_0x6f98('0x15'));var utils=require(_0x6f98('0x16'));var config=require(_0x6f98('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f53d6,_0x1031a6){_0x1031a6=_0x1031a6||0xcc;return function(_0x4c9d54){if(_0x4c9d54){return _0x3f53d6['sendStatus'](_0x1031a6);}return _0x3f53d6['status'](_0x1031a6)[_0x6f98('0x18')]();};}function respondWithResult(_0x1d7842,_0x3c289c){_0x3c289c=_0x3c289c||0xc8;return function(_0x4092f6){if(_0x4092f6){return _0x1d7842[_0x6f98('0x19')](_0x3c289c)[_0x6f98('0x1a')](_0x4092f6);}};}function respondWithFilteredResult(_0x33a1a4,_0x11c25a){return function(_0x4b56ee){if(_0x4b56ee){var _0x4cdb46=typeof _0x11c25a[_0x6f98('0x1b')]==='undefined'&&typeof _0x11c25a[_0x6f98('0x1c')]===_0x6f98('0x1d');var _0x566dfd=_0x4b56ee[_0x6f98('0x1e')];var _0x7de05e=_0x4cdb46?0x0:_0x11c25a['offset'];var _0x40c4ec=_0x4cdb46?_0x4b56ee[_0x6f98('0x1e')]:_0x11c25a[_0x6f98('0x1b')]+_0x11c25a[_0x6f98('0x1c')];var _0x2ca198;if(_0x40c4ec>=_0x566dfd){_0x40c4ec=_0x566dfd;_0x2ca198=0xc8;}else{_0x2ca198=0xce;}_0x33a1a4[_0x6f98('0x19')](_0x2ca198);return _0x33a1a4['set'](_0x6f98('0x1f'),_0x7de05e+'-'+_0x40c4ec+'/'+_0x566dfd)['json'](_0x4b56ee);}return null;};}function patchUpdates(_0x4a56cc){return function(_0xdba2c6){try{jsonpatch[_0x6f98('0x20')](_0xdba2c6,_0x4a56cc,!![]);}catch(_0x1ca9d7){return BPromise['reject'](_0x1ca9d7);}return _0xdba2c6['save']();};}function saveUpdates(_0x1037ca,_0x40c978){return function(_0x26eef1){if(_0x26eef1){return _0x26eef1[_0x6f98('0x21')](_0x1037ca)['then'](function(_0x2a922e){return _0x2a922e;});}return null;};}function removeEntity(_0x14ae79,_0x2e9535){return function(_0x35ed34){if(_0x35ed34){return _0x35ed34['destroy']()['then'](function(){_0x14ae79['status'](0xcc)[_0x6f98('0x18')]();});}};}function handleEntityNotFound(_0x1e4542,_0x4c0c32){return function(_0x511a9f){if(!_0x511a9f){_0x1e4542['sendStatus'](0x194);}return _0x511a9f;};}function handleError(_0x4a3ba4,_0x4ebeed){_0x4ebeed=_0x4ebeed||0x1f4;return function(_0x563d31){logger['error'](_0x563d31[_0x6f98('0x22')]);if(_0x563d31[_0x6f98('0x23')]){delete _0x563d31[_0x6f98('0x23')];}_0x4a3ba4[_0x6f98('0x19')](_0x4ebeed)['send'](_0x563d31);};}exports['index']=function(_0x3d7ed2,_0x18327f){var _0x593227={},_0x3b750a={},_0x5298ef={'count':0x0,'rows':[]};var _0x124c74=_['map'](db[_0x6f98('0x24')][_0x6f98('0x25')],function(_0x421548){return{'name':_0x421548[_0x6f98('0x26')],'type':_0x421548[_0x6f98('0x27')][_0x6f98('0x28')]};});_0x3b750a['model']=_[_0x6f98('0x29')](_0x124c74,_0x6f98('0x23'));_0x3b750a[_0x6f98('0x2a')]=_[_0x6f98('0x2b')](_0x3d7ed2[_0x6f98('0x2a')]);_0x3b750a[_0x6f98('0x2c')]=_[_0x6f98('0x2d')](_0x3b750a[_0x6f98('0x2e')],_0x3b750a[_0x6f98('0x2a')]);_0x593227[_0x6f98('0x2f')]=_['intersection'](_0x3b750a[_0x6f98('0x2e')],qs['fields'](_0x3d7ed2['query'][_0x6f98('0x30')]));_0x593227['attributes']=_0x593227[_0x6f98('0x2f')]['length']?_0x593227[_0x6f98('0x2f')]:_0x3b750a[_0x6f98('0x2e')];if(!_0x3d7ed2[_0x6f98('0x2a')][_0x6f98('0x31')](_0x6f98('0x32'))){_0x593227[_0x6f98('0x1c')]=qs['limit'](_0x3d7ed2[_0x6f98('0x2a')][_0x6f98('0x1c')]);_0x593227[_0x6f98('0x1b')]=qs[_0x6f98('0x1b')](_0x3d7ed2[_0x6f98('0x2a')][_0x6f98('0x1b')]);}_0x593227[_0x6f98('0x33')]=qs[_0x6f98('0x34')](_0x3d7ed2[_0x6f98('0x2a')]['sort']);_0x593227[_0x6f98('0x35')]=qs[_0x6f98('0x2c')](_[_0x6f98('0x36')](_0x3d7ed2['query'],_0x3b750a[_0x6f98('0x2c')]),_0x124c74);if(_0x3d7ed2['query'][_0x6f98('0x37')]){_0x593227[_0x6f98('0x35')]=_[_0x6f98('0x38')](_0x593227[_0x6f98('0x35')],{'$or':_[_0x6f98('0x29')](_0x124c74,function(_0x43355a){if(_0x43355a[_0x6f98('0x27')]!==_0x6f98('0x39')){var _0x23303e={};_0x23303e[_0x43355a['name']]={'$like':'%'+_0x3d7ed2[_0x6f98('0x2a')][_0x6f98('0x37')]+'%'};return _0x23303e;}})});}_0x593227=_['merge']({},_0x593227,_0x3d7ed2['options']);var _0x40fcbb={'where':_0x593227[_0x6f98('0x35')]};return db[_0x6f98('0x24')][_0x6f98('0x1e')](_0x40fcbb)['then'](function(_0x9ff38b){_0x5298ef[_0x6f98('0x1e')]=_0x9ff38b;if(_0x3d7ed2[_0x6f98('0x2a')][_0x6f98('0x3a')]){_0x593227[_0x6f98('0x3b')]=[{'all':!![]}];}return db[_0x6f98('0x24')][_0x6f98('0x3c')](_0x593227);})[_0x6f98('0x3d')](function(_0x27c51c){_0x5298ef[_0x6f98('0x3e')]=_0x27c51c;return _0x5298ef;})[_0x6f98('0x3d')](respondWithFilteredResult(_0x18327f,_0x593227))[_0x6f98('0x3f')](handleError(_0x18327f,null));};exports[_0x6f98('0x40')]=function(_0x27c4f4,_0x5ba9f8){var _0x4d9926={'raw':!![],'where':{'id':_0x27c4f4[_0x6f98('0x41')]['id']}},_0x35225a={};_0x35225a[_0x6f98('0x2e')]=_[_0x6f98('0x2b')](db[_0x6f98('0x24')][_0x6f98('0x25')]);_0x35225a['query']=_['keys'](_0x27c4f4[_0x6f98('0x2a')]);_0x35225a[_0x6f98('0x2c')]=_[_0x6f98('0x2d')](_0x35225a[_0x6f98('0x2e')],_0x35225a['query']);_0x4d9926[_0x6f98('0x2f')]=_[_0x6f98('0x2d')](_0x35225a['model'],qs['fields'](_0x27c4f4[_0x6f98('0x2a')][_0x6f98('0x30')]));_0x4d9926[_0x6f98('0x2f')]=_0x4d9926[_0x6f98('0x2f')][_0x6f98('0x42')]?_0x4d9926['attributes']:_0x35225a[_0x6f98('0x2e')];if(_0x27c4f4[_0x6f98('0x2a')][_0x6f98('0x3a')]){_0x4d9926[_0x6f98('0x3b')]=[{'all':!![]}];}_0x4d9926=_[_0x6f98('0x38')]({},_0x4d9926,_0x27c4f4[_0x6f98('0x43')]);return db[_0x6f98('0x24')][_0x6f98('0x44')](_0x4d9926)[_0x6f98('0x3d')](handleEntityNotFound(_0x5ba9f8,null))[_0x6f98('0x3d')](respondWithResult(_0x5ba9f8,null))[_0x6f98('0x3f')](handleError(_0x5ba9f8,null));};exports[_0x6f98('0x45')]=function(_0x315144,_0x58596b){return db[_0x6f98('0x24')]['create'](_0x315144['body'],{})[_0x6f98('0x3d')](respondWithResult(_0x58596b,0xc9))[_0x6f98('0x3f')](handleError(_0x58596b,null));};exports[_0x6f98('0x21')]=function(_0x253af5,_0x5aef62){if(_0x253af5[_0x6f98('0x46')]['id']){delete _0x253af5[_0x6f98('0x46')]['id'];}return db['VoiceTransferReport'][_0x6f98('0x44')]({'where':{'id':_0x253af5[_0x6f98('0x41')]['id']}})[_0x6f98('0x3d')](handleEntityNotFound(_0x5aef62,null))['then'](saveUpdates(_0x253af5[_0x6f98('0x46')],null))[_0x6f98('0x3d')](respondWithResult(_0x5aef62,null))[_0x6f98('0x3f')](handleError(_0x5aef62,null));};exports['destroy']=function(_0x58ba45,_0x1b16fa){return db[_0x6f98('0x24')][_0x6f98('0x44')]({'where':{'id':_0x58ba45[_0x6f98('0x41')]['id']}})[_0x6f98('0x3d')](handleEntityNotFound(_0x1b16fa,null))['then'](removeEntity(_0x1b16fa,null))['catch'](handleError(_0x1b16fa,null));};exports[_0x6f98('0x47')]=function(_0xcb628d,_0x197f53){return db[_0x6f98('0x24')][_0x6f98('0x47')]()[_0x6f98('0x3d')](respondWithResult(_0x197f53,null))['catch'](handleError(_0x197f53,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 9b173f8..2fdbd0e 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 _0xf9c6=['VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define'];(function(_0x1f23b1,_0x57c83f){var _0x3c9197=function(_0x2f6e4a){while(--_0x2f6e4a){_0x1f23b1['push'](_0x1f23b1['shift']());}};_0x3c9197(++_0x57c83f);}(_0xf9c6,0xdf));var _0x6f9c=function(_0x1c2d73,_0x436800){_0x1c2d73=_0x1c2d73-0x0;var _0x22004d=_0xf9c6[_0x1c2d73];return _0x22004d;};'use strict';var _=require(_0x6f9c('0x0'));var util=require(_0x6f9c('0x1'));var logger=require(_0x6f9c('0x2'))(_0x6f9c('0x3'));var moment=require(_0x6f9c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f9c('0x5'));var rimraf=require(_0x6f9c('0x6'));var config=require(_0x6f9c('0x7'));var attributes=require(_0x6f9c('0x8'));module[_0x6f9c('0x9')]=function(_0x112027,_0x3cea4a){return _0x112027[_0x6f9c('0xa')](_0x6f9c('0xb'),attributes,{'tableName':_0x6f9c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b9a=['rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash','../../config/logger','bluebird','request-promise'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x9b9a,0x9c));var _0xa9b9=function(_0x55ef0d,_0x8adac9){_0x55ef0d=_0x55ef0d-0x0;var _0x4ba78b=_0x9b9a[_0x55ef0d];return _0x4ba78b;};'use strict';var _=require(_0xa9b9('0x0'));var util=require('util');var logger=require(_0xa9b9('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa9b9('0x2'));var rp=require(_0xa9b9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9b9('0x4'));var config=require(_0xa9b9('0x5'));var attributes=require(_0xa9b9('0x6'));module[_0xa9b9('0x7')]=function(_0x4782e1,_0x1abcfc){return _0x4782e1[_0xa9b9('0x8')](_0xa9b9('0x9'),attributes,{'tableName':'report_call_transfer','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 00c8058..3ce4b44 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 _0x4cef=['request','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x364e9c,_0x43d5e0){var _0x2299a3=function(_0x103b04){while(--_0x103b04){_0x364e9c['push'](_0x364e9c['shift']());}};_0x2299a3(++_0x43d5e0);}(_0x4cef,0x1ed));var _0xf4ce=function(_0x4d275c,_0x522396){_0x4d275c=_0x4d275c-0x0;var _0x55b75f=_0x4cef[_0x4d275c];return _0x55b75f;};'use strict';var _=require('lodash');var util=require(_0xf4ce('0x0'));var moment=require(_0xf4ce('0x1'));var BPromise=require(_0xf4ce('0x2'));var rs=require(_0xf4ce('0x3'));var fs=require('fs');var Redis=require(_0xf4ce('0x4'));var db=require(_0xf4ce('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4ce('0x6'))(_0xf4ce('0x7'));var config=require('../../config/environment');var jayson=require(_0xf4ce('0x8'));var client=jayson[_0xf4ce('0x9')][_0xf4ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb81f05,_0x311d3f,_0x5a915a){return new BPromise(function(_0x53ac1b,_0x58db43){return client[_0xf4ce('0xb')](_0xb81f05,_0x5a915a)['then'](function(_0x2fa864){logger['info'](_0xf4ce('0xc'),_0x311d3f,'request\x20sent');logger[_0xf4ce('0xd')](_0xf4ce('0xe'),_0x311d3f,_0xf4ce('0xf'),JSON['stringify'](_0x2fa864));if(_0x2fa864[_0xf4ce('0x10')]){if(_0x2fa864[_0xf4ce('0x10')][_0xf4ce('0x11')]===0x1f4){logger[_0xf4ce('0x10')](_0xf4ce('0xc'),_0x311d3f,_0x2fa864[_0xf4ce('0x10')][_0xf4ce('0x12')]);return _0x58db43(_0x2fa864[_0xf4ce('0x10')][_0xf4ce('0x12')]);}logger[_0xf4ce('0x10')](_0xf4ce('0xc'),_0x311d3f,_0x2fa864[_0xf4ce('0x10')][_0xf4ce('0x12')]);return _0x53ac1b(_0x2fa864[_0xf4ce('0x10')]['message']);}else{logger[_0xf4ce('0x13')](_0xf4ce('0xc'),_0x311d3f,_0xf4ce('0xf'));_0x53ac1b(_0x2fa864[_0xf4ce('0x14')][_0xf4ce('0x12')]);}})[_0xf4ce('0x15')](function(_0x3a605a){logger[_0xf4ce('0x10')](_0xf4ce('0xc'),_0x311d3f,_0x3a605a);_0x58db43(_0x3a605a);});});}exports[_0xf4ce('0x16')]=function(_0x18f77b){var _0x249287=this;return new Promise(function(_0x5df566,_0x312dab){return db[_0xf4ce('0x17')]['create'](_0x18f77b[_0xf4ce('0x18')],{'raw':_0x18f77b[_0xf4ce('0x19')]?_0x18f77b['options'][_0xf4ce('0x1a')]===undefined?!![]:![]:!![]})[_0xf4ce('0x1b')](function(_0x4733e8){logger[_0xf4ce('0x13')](_0xf4ce('0x16'),_0x18f77b);logger[_0xf4ce('0xd')]('CreateVoiceTransferReport',_0x18f77b,JSON['stringify'](_0x4733e8));_0x5df566(_0x4733e8);})[_0xf4ce('0x15')](function(_0x1507b3){logger['error']('CreateVoiceTransferReport',_0x1507b3[_0xf4ce('0x12')],_0x18f77b);_0x312dab(_0x249287['error'](0x1f4,_0x1507b3[_0xf4ce('0x12')]));});});}; \ No newline at end of file +var _0x3e87=['stringify','error','code','message','request\x20sent','result','create','body','options','raw','CreateVoiceTransferReport','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','VoiceTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0x3e87,0x1b5));var _0x73e8=function(_0x537c31,_0xdcdec8){_0x537c31=_0x537c31-0x0;var _0x35a848=_0x3e87[_0x537c31];return _0x35a848;};'use strict';var _=require(_0x73e8('0x0'));var util=require(_0x73e8('0x1'));var moment=require('moment');var BPromise=require(_0x73e8('0x2'));var rs=require(_0x73e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73e8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x73e8('0x5'));var jayson=require(_0x73e8('0x6'));var client=jayson['client'][_0x73e8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xbeee9b,_0x53d8be,_0x582d5c){return new BPromise(function(_0x87df69,_0x162101){return client[_0x73e8('0x8')](_0xbeee9b,_0x582d5c)[_0x73e8('0x9')](function(_0x191079){logger[_0x73e8('0xa')](_0x73e8('0xb'),_0x53d8be,'request\x20sent');logger['debug'](_0x73e8('0xc'),_0x53d8be,'request\x20sent',JSON[_0x73e8('0xd')](_0x191079));if(_0x191079['error']){if(_0x191079[_0x73e8('0xe')][_0x73e8('0xf')]===0x1f4){logger[_0x73e8('0xe')](_0x73e8('0xb'),_0x53d8be,_0x191079[_0x73e8('0xe')]['message']);return _0x162101(_0x191079['error'][_0x73e8('0x10')]);}logger[_0x73e8('0xe')](_0x73e8('0xb'),_0x53d8be,_0x191079[_0x73e8('0xe')][_0x73e8('0x10')]);return _0x87df69(_0x191079[_0x73e8('0xe')]['message']);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x53d8be,_0x73e8('0x11'));_0x87df69(_0x191079[_0x73e8('0x12')][_0x73e8('0x10')]);}})['catch'](function(_0x401e92){logger[_0x73e8('0xe')](_0x73e8('0xb'),_0x53d8be,_0x401e92);_0x162101(_0x401e92);});});}exports['CreateVoiceTransferReport']=function(_0x2c6dda){var _0x1913f6=this;return new Promise(function(_0x411b3e,_0x5a2a0c){return db['VoiceTransferReport'][_0x73e8('0x13')](_0x2c6dda[_0x73e8('0x14')],{'raw':_0x2c6dda[_0x73e8('0x15')]?_0x2c6dda[_0x73e8('0x15')][_0x73e8('0x16')]===undefined?!![]:![]:!![]})[_0x73e8('0x9')](function(_0x19a90b){logger[_0x73e8('0xa')](_0x73e8('0x17'),_0x2c6dda);logger['debug'](_0x73e8('0x17'),_0x2c6dda,JSON[_0x73e8('0xd')](_0x19a90b));_0x411b3e(_0x19a90b);})[_0x73e8('0x18')](function(_0x2436d1){logger[_0x73e8('0xe')](_0x73e8('0x17'),_0x2436d1[_0x73e8('0x10')],_0x2c6dda);_0x5a2a0c(_0x1913f6[_0x73e8('0xe')](0x1f4,_0x2436d1[_0x73e8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 9d3b6f4..1450202 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 _0xb343=['/transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','canUpdate','originate','/hangup','/answer','answer','/hold','isAuthenticated','/unhold','unhold','/calls','calls'];(function(_0x3829cc,_0x40b575){var _0x15d749=function(_0x191e64){while(--_0x191e64){_0x3829cc['push'](_0x3829cc['shift']());}};_0x15d749(++_0x40b575);}(_0xb343,0x1dd));var _0x3b34=function(_0x383722,_0x582f){_0x383722=_0x383722-0x0;var _0x22db6d=_0xb343[_0x383722];return _0x22db6d;};'use strict';var express=require(_0x3b34('0x0'));var router=express[_0x3b34('0x1')]();var auth=require(_0x3b34('0x2'));var controller=require(_0x3b34('0x3'));router[_0x3b34('0x4')](_0x3b34('0x5'),auth['isAuthenticated'](),auth[_0x3b34('0x6')](),controller[_0x3b34('0x7')]);router[_0x3b34('0x4')](_0x3b34('0x8'),auth['isAuthenticated'](),auth[_0x3b34('0x6')](),controller['hangup']);router[_0x3b34('0x4')](_0x3b34('0x9'),auth['isAuthenticated'](),auth[_0x3b34('0x6')](),controller[_0x3b34('0xa')]);router[_0x3b34('0x4')](_0x3b34('0xb'),auth[_0x3b34('0xc')](),auth['canUpdate'](),controller['hold']);router[_0x3b34('0x4')](_0x3b34('0xd'),auth['isAuthenticated'](),auth[_0x3b34('0x6')](),controller[_0x3b34('0xe')]);router[_0x3b34('0x4')](_0x3b34('0xf'),auth['isAuthenticated'](),auth[_0x3b34('0x6')](),controller[_0x3b34('0x10')]);router[_0x3b34('0x4')](_0x3b34('0x11'),auth['isAuthenticated'](),auth[_0x3b34('0x6')](),controller['transfer']);module[_0x3b34('0x12')]=router; \ No newline at end of file +var _0xbe36=['originate','post','isAuthenticated','hangup','/answer','answer','/hold','hold','unhold','/calls','calls','/transfer','transfer','exports','Router','./webbar.controller','/originate','canUpdate'];(function(_0x4819e3,_0x5dcdb1){var _0x3255c8=function(_0x38092f){while(--_0x38092f){_0x4819e3['push'](_0x4819e3['shift']());}};_0x3255c8(++_0x5dcdb1);}(_0xbe36,0x152));var _0x6be3=function(_0xae3692,_0x14d7f8){_0xae3692=_0xae3692-0x0;var _0x471156=_0xbe36[_0xae3692];return _0x471156;};'use strict';var express=require('express');var router=express[_0x6be3('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x6be3('0x1'));router['post'](_0x6be3('0x2'),auth['isAuthenticated'](),auth[_0x6be3('0x3')](),controller[_0x6be3('0x4')]);router[_0x6be3('0x5')]('/hangup',auth[_0x6be3('0x6')](),auth['canUpdate'](),controller[_0x6be3('0x7')]);router['post'](_0x6be3('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x6be3('0x9')]);router['post'](_0x6be3('0xa'),auth[_0x6be3('0x6')](),auth[_0x6be3('0x3')](),controller[_0x6be3('0xb')]);router[_0x6be3('0x5')]('/unhold',auth[_0x6be3('0x6')](),auth[_0x6be3('0x3')](),controller[_0x6be3('0xc')]);router[_0x6be3('0x5')](_0x6be3('0xd'),auth[_0x6be3('0x6')](),auth[_0x6be3('0x3')](),controller[_0x6be3('0xe')]);router[_0x6be3('0x5')](_0x6be3('0xf'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x6be3('0x10')]);module[_0x6be3('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 1b736f7..3a67e77 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 _0x9a19=['defaults','validate','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','log','handleError:','error','stack','name','status','send','NotFound','then','message','result','catch','agent','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','json','body','userId','callNumber','callerId','entityFound:','format','user:%s','hangup','hangup\x20fired:','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','calls','calls\x20fired:','VoiceChannels','rows','conference','conference\x20fired:','webbar:conference','transfer','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis'];(function(_0x1f9b0c,_0xc49ca7){var _0x20f15a=function(_0x472014){while(--_0x472014){_0x1f9b0c['push'](_0x1f9b0c['shift']());}};_0x20f15a(++_0xc49ca7);}(_0x9a19,0x114));var _0x99a1=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x9a19[_0x2b9b7f];return _0x4ed19a;};'use strict';var path=require(_0x99a1('0x0'));var fs=require('fs');var _=require(_0x99a1('0x1'));var db=require(_0x99a1('0x2'))['db'];var config=require('../../config/environment');var util=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var jayson=require(_0x99a1('0x5'));var amiClient=jayson[_0x99a1('0x6')][_0x99a1('0x7')]({'port':0x232a});var logger=require(_0x99a1('0x8'))(_0x99a1('0x9'));var Redis=require(_0x99a1('0xa'));config[_0x99a1('0xb')]=_[_0x99a1('0xc')](config[_0x99a1('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x99a1('0xd'));var originateValidation=new Schema({'userId':{'type':_0x99a1('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x99a1('0xf')]},'callerId':{'type':_0x99a1('0x10')},'callbackUrl':{'type':_0x99a1('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x99a1('0xe'),'required':[!![],_0x99a1('0x11')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x99a1('0xe'),'required':[!![],_0x99a1('0x11')]},'sessionId':{'type':_0x99a1('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x99a1('0xe'),'required':[!![],_0x99a1('0x11')]},'sessionId':{'type':_0x99a1('0x10'),'required':[!![],_0x99a1('0x12')]},'transferNumber':{'type':_0x99a1('0x10'),'required':[!![],_0x99a1('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x99a1('0xe'),'required':[!![],_0x99a1('0x11')]},'sessionId':{'type':_0x99a1('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x99a1('0xe'),'required':[!![],_0x99a1('0x11')]},'sessionId':{'type':_0x99a1('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x99a1('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0x99a1('0xe'),'required':[!![],_0x99a1('0x11')]}});function emit(_0x3d40cc,_0x384f05,_0x33e2c1){logger[_0x99a1('0x14')](_0x3d40cc,_0x384f05,JSON['stringify'](_0x33e2c1));io['to'](_0x3d40cc)['emit'](_0x384f05,_0x33e2c1);}function handleError(_0x6702d8){return function(_0xbf62f1){console[_0x99a1('0x15')](_0x99a1('0x16'),_0xbf62f1,_0xbf62f1 instanceof RangeError);logger[_0x99a1('0x17')](_0xbf62f1[_0x99a1('0x18')]);if(_0xbf62f1 instanceof RangeError){if(_0xbf62f1[_0x99a1('0x19')]){delete _0xbf62f1[_0x99a1('0x19')];}_0x6702d8[_0x99a1('0x1a')](0x194)[_0x99a1('0x1b')](_0xbf62f1);}else{if(_0xbf62f1[_0x99a1('0x19')]){delete _0xbf62f1['name'];}_0x6702d8[_0x99a1('0x1a')](0x1f4)[_0x99a1('0x1b')](_0xbf62f1);}};}function checkError(){return function(_0x5bed38){if(!_0x5bed38){throw new RangeError(_0x99a1('0x1c'));}return _0x5bed38;};}function respondWithRpcPromise(_0x53093d,_0x458ed3){return new BPromise(function(_0x2927b0,_0x2d6f20){var _0x2d3b82=amiClient;return _0x2d3b82['request'](_0x53093d,_0x458ed3)[_0x99a1('0x1d')](function(_0x1268a7){if(_0x1268a7['error']){if(_0x1268a7[_0x99a1('0x17')]['code']===0x1f4){return _0x2d6f20(_0x1268a7[_0x99a1('0x17')][_0x99a1('0x1e')]);}return _0x2927b0(_0x1268a7[_0x99a1('0x17')][_0x99a1('0x1e')]);}else{_0x2927b0(_0x1268a7[_0x99a1('0x1f')]);}})[_0x99a1('0x20')](function(_0x4fe7f7){_0x2d6f20(_0x4fe7f7);});});}function getAgent(_0x114b38){return db['User']['findOne']({'where':{'id':_0x114b38,'role':_0x99a1('0x21')}})[_0x99a1('0x1d')](checkError());}function getAgentCheckSession(_0xa6799b,_0x15a0b6){return new BPromise(function(_0x25d560,_0x309b93){var _0x183037=respondWithRpcPromise('VoiceChannels');var _0xf41b0d=getAgent(_0xa6799b);Promise['all']([_0x183037,_0xf41b0d])[_0x99a1('0x1d')](function(_0x1137f2){var _0x26fbae=_0x1137f2[0x0];var _0x523668=_0x1137f2[0x1];var _0x371edf=_[_0x99a1('0x22')](_0x26fbae['rows'],function(_0x37514e){return _0x37514e[_0x99a1('0x23')]==_0x523668['id']&&_0x37514e[_0x99a1('0x24')]==_0x15a0b6;});if(_0x371edf[_0x99a1('0x25')]==0x1){_0x25d560(_0x523668);}else{_0x309b93(new RangeError(_0x99a1('0x26')+_0x15a0b6+_0x99a1('0x27')));}});});}exports[_0x99a1('0x28')]=function(_0x26c23c,_0x52da8d){logger['info'](_0x99a1('0x29'),_0x26c23c['body']);var _0x38e383=originateValidation[_0x99a1('0xd')](_0x26c23c['body']);if(_0x38e383[_0x99a1('0x25')]>0x0){return _0x52da8d[_0x99a1('0x1a')](0x190)[_0x99a1('0x2a')](_0x38e383);}var _0x547ed3=_0x26c23c[_0x99a1('0x2b')][_0x99a1('0x2c')];var _0x3081cd=_0x26c23c[_0x99a1('0x2b')][_0x99a1('0x2d')];var _0x432fbc=_0x26c23c[_0x99a1('0x2b')][_0x99a1('0x2e')];var _0x215c18=_0x26c23c[_0x99a1('0x2b')]['callbackUrl'];return getAgent(_0x547ed3)['then'](function(_0x46e3f2){logger[_0x99a1('0x14')](_0x99a1('0x2f'),_0x46e3f2[_0x99a1('0x19')]);emit(util[_0x99a1('0x30')](_0x99a1('0x31'),_0x46e3f2[_0x99a1('0x19')]),'webbar:originate',{'callNumber':_0x3081cd,'callerId':_0x432fbc,'callbackUrl':_0x215c18});return _0x52da8d[_0x99a1('0x1a')](0xc8)[_0x99a1('0x2a')]({'error':![],'message':'originate\x20executed!'});})[_0x99a1('0x20')](handleError(_0x52da8d));};exports[_0x99a1('0x32')]=function(_0x391afa,_0x3cd1a0){logger[_0x99a1('0x14')](_0x99a1('0x33'),_0x391afa[_0x99a1('0x2b')]);var _0x2f8135=hangupValidation[_0x99a1('0xd')](_0x391afa[_0x99a1('0x2b')]);if(_0x2f8135[_0x99a1('0x25')]>0x0){return _0x3cd1a0[_0x99a1('0x1a')](0x190)[_0x99a1('0x2a')](_0x2f8135);}var _0x5018e9=_0x391afa['body']['userId'];var _0x29e884=_0x391afa[_0x99a1('0x2b')][_0x99a1('0x24')];return getAgent(_0x5018e9)[_0x99a1('0x1d')](function(_0x40613a){logger['info'](_0x99a1('0x2f'),_0x40613a[_0x99a1('0x19')]);emit(util[_0x99a1('0x30')]('user:%s',_0x40613a['name']),_0x99a1('0x34'),{'sessionId':_0x29e884});return _0x3cd1a0[_0x99a1('0x1a')](0xc8)[_0x99a1('0x2a')]({'error':![],'message':'hangup\x20executed!'});})[_0x99a1('0x20')](handleError(_0x3cd1a0));};exports[_0x99a1('0x35')]=function(_0x1b5d2d,_0x394762){logger[_0x99a1('0x14')](_0x99a1('0x36'),_0x1b5d2d[_0x99a1('0x2b')]);var _0x29d0a0=answerValidation[_0x99a1('0xd')](_0x1b5d2d[_0x99a1('0x2b')]);if(_0x29d0a0['length']>0x0){return _0x394762[_0x99a1('0x1a')](0x190)[_0x99a1('0x2a')](_0x29d0a0);}var _0x3d5373=_0x1b5d2d['body'][_0x99a1('0x2c')];var _0x51536d=_0x1b5d2d[_0x99a1('0x2b')][_0x99a1('0x24')];return getAgent(_0x3d5373)[_0x99a1('0x1d')](function(_0x3d7ec7){logger[_0x99a1('0x14')](_0x99a1('0x2f'),_0x3d7ec7['name']);emit(util[_0x99a1('0x30')]('user:%s',_0x3d7ec7[_0x99a1('0x19')]),_0x99a1('0x37'),{'sessionId':_0x51536d});return _0x394762[_0x99a1('0x1a')](0xc8)[_0x99a1('0x2a')]({'error':![],'message':_0x99a1('0x38')});})[_0x99a1('0x20')](handleError(_0x394762));};exports[_0x99a1('0x39')]=function(_0x3861b6,_0x61c259){logger[_0x99a1('0x14')](_0x99a1('0x3a'),_0x3861b6['body']);var _0x3c1f55=holdValidation[_0x99a1('0xd')](_0x3861b6['body']);if(_0x3c1f55[_0x99a1('0x25')]>0x0){return _0x61c259[_0x99a1('0x1a')](0x190)[_0x99a1('0x2a')](_0x3c1f55);}var _0x2e377b=_0x3861b6[_0x99a1('0x2b')][_0x99a1('0x2c')];var _0x2e3bef=_0x3861b6['body'][_0x99a1('0x24')];return getAgent(_0x2e377b)['then'](function(_0x1d4d3f){logger[_0x99a1('0x14')]('entityFound:',_0x1d4d3f['name']);emit(util[_0x99a1('0x30')](_0x99a1('0x31'),_0x1d4d3f[_0x99a1('0x19')]),_0x99a1('0x3b'),{'sessionId':_0x2e3bef});return _0x61c259[_0x99a1('0x1a')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x61c259));};exports[_0x99a1('0x3c')]=function(_0x4ae90e,_0x463e49){logger[_0x99a1('0x14')](_0x99a1('0x3d'),_0x4ae90e[_0x99a1('0x2b')]);var _0x1059b1=unholdValidation['validate'](_0x4ae90e[_0x99a1('0x2b')]);if(_0x1059b1[_0x99a1('0x25')]>0x0){return _0x463e49[_0x99a1('0x1a')](0x190)['json'](_0x1059b1);}var _0x81e218=_0x4ae90e['body']['userId'];var _0x1b9598=_0x4ae90e[_0x99a1('0x2b')][_0x99a1('0x24')];return getAgent(_0x81e218)[_0x99a1('0x1d')](function(_0x11632d){logger[_0x99a1('0x14')](_0x99a1('0x2f'),_0x11632d[_0x99a1('0x19')]);emit(util[_0x99a1('0x30')]('user:%s',_0x11632d[_0x99a1('0x19')]),'webbar:unhold',{'sessionId':_0x1b9598});return _0x463e49[_0x99a1('0x1a')](0xc8)[_0x99a1('0x2a')]({'error':![],'message':'unhold\x20executed!'});})[_0x99a1('0x20')](handleError(_0x463e49));};exports[_0x99a1('0x3e')]=function(_0x469e10,_0x2b2d63){logger[_0x99a1('0x14')](_0x99a1('0x3f'),_0x2b2d63[_0x99a1('0x2b')]);var _0x1a5658=callsValidation[_0x99a1('0xd')](_0x469e10[_0x99a1('0x2b')]);if(_0x1a5658[_0x99a1('0x25')]>0x0){return _0x2b2d63[_0x99a1('0x1a')](0x190)['json'](_0x1a5658);}var _0x4f64b7=_0x469e10[_0x99a1('0x2b')][_0x99a1('0x2c')];var _0x28caeb=respondWithRpcPromise(_0x99a1('0x40'));var _0x213719=getAgent(_0x4f64b7);return Promise['all']([_0x28caeb,_0x213719])[_0x99a1('0x1d')](function(_0x35f4a8){var _0x529f66=_0x35f4a8[0x0];var _0x6107cd=_0x35f4a8[0x1];var _0x95f20a=_[_0x99a1('0x22')](_0x529f66[_0x99a1('0x41')],function(_0x2b0e5f){return _0x2b0e5f['UserId']==_0x6107cd['id'];});return _0x2b2d63[_0x99a1('0x1a')](0xc8)[_0x99a1('0x2a')]({'count':_0x95f20a[_0x99a1('0x25')],'rows':_0x95f20a});})[_0x99a1('0x20')](handleError(_0x2b2d63));};exports[_0x99a1('0x42')]=function(_0x10289c,_0x59260e){logger[_0x99a1('0x14')](_0x99a1('0x43'),_0x10289c['body']);var _0x33feb9=conferenceValidation[_0x99a1('0xd')](_0x10289c[_0x99a1('0x2b')]);if(_0x33feb9[_0x99a1('0x25')]>0x0){return _0x59260e[_0x99a1('0x1a')](0x190)['json'](_0x33feb9);}var _0x52f450=_0x10289c['body']['userId'];return getAgent(_0x52f450)['then'](function(_0x38ce3c){logger[_0x99a1('0x14')]('entityFound:',_0x38ce3c['name']);emit(util[_0x99a1('0x30')]('user:%s',_0x38ce3c[_0x99a1('0x19')]),_0x99a1('0x44'));return _0x59260e[_0x99a1('0x1a')](0xc8)[_0x99a1('0x2a')]({'error':![],'message':'conference\x20executed!'});})[_0x99a1('0x20')](handleError(_0x59260e));};exports[_0x99a1('0x45')]=function(_0x11b1c1,_0x4fbfb3){logger[_0x99a1('0x14')]('transfer\x20fired:',_0x11b1c1[_0x99a1('0x2b')]);var _0x186615=transferValidation[_0x99a1('0xd')](_0x11b1c1[_0x99a1('0x2b')]);if(_0x186615[_0x99a1('0x25')]>0x0){return _0x4fbfb3['status'](0x190)['json'](_0x186615);}var _0x4fc962=_0x11b1c1[_0x99a1('0x2b')][_0x99a1('0x2c')];var _0x4ad713=_0x11b1c1['body'][_0x99a1('0x24')];var _0x2f5587=_0x11b1c1[_0x99a1('0x2b')]['transferNumber'];return getAgent(_0x4fc962)['then'](function(_0x2b8df8){logger['info'](_0x99a1('0x2f'),_0x2b8df8[_0x99a1('0x19')]);emit(util[_0x99a1('0x30')]('user:%s',_0x2b8df8[_0x99a1('0x19')]),_0x99a1('0x46'),{'sessionId':_0x4ad713,'transferNumber':_0x2f5587});return _0x4fbfb3['status'](0xc8)['json']({'error':![],'message':_0x99a1('0x47')});})['catch'](handleError(_0x4fbfb3));}; \ No newline at end of file +var _0x54f3=['sessionId\x20is\x20required','transferNumber\x20is\x20required','number','info','stringify','emit','log','error','stack','name','status','send','request','then','code','message','result','findOne','agent','all','filter','rows','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','catch','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','sessionId','webbar:answer','answer\x20executed!','hold','hold\x20fired:','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','VoiceChannels','UserId','conference\x20fired:','transfer','transfer\x20fired:','transferNumber','webbar:transfer','lodash','../../mysqldb','../../config/environment','util','bluebird','http','../../config/logger','webbarapi','defaults','localhost','socket.io-emitter','redis','validate','userId\x20is\x20required','callNumber\x20is\x20required','string'];(function(_0x390456,_0x1b21aa){var _0x1f9c18=function(_0x85c20e){while(--_0x85c20e){_0x390456['push'](_0x390456['shift']());}};_0x1f9c18(++_0x1b21aa);}(_0x54f3,0x120));var _0x354f=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x54f3[_0x178e48];return _0x440d7e;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x354f('0x0'));var db=require(_0x354f('0x1'))['db'];var config=require(_0x354f('0x2'));var util=require(_0x354f('0x3'));var BPromise=require(_0x354f('0x4'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x354f('0x5')]({'port':0x232a});var logger=require(_0x354f('0x6'))(_0x354f('0x7'));var Redis=require('ioredis');config['redis']=_[_0x354f('0x8')](config['redis'],{'host':_0x354f('0x9'),'port':0x18eb});var io=require(_0x354f('0xa'))(new Redis(config[_0x354f('0xb')]));var Schema=require(_0x354f('0xc'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x354f('0xd')]},'callNumber':{'type':'string','required':[!![],_0x354f('0xe')]},'callerId':{'type':_0x354f('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x354f('0xd')]},'sessionId':{'type':_0x354f('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x354f('0xd')]},'sessionId':{'type':_0x354f('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x354f('0xd')]},'sessionId':{'type':_0x354f('0xf'),'required':[!![],_0x354f('0x10')]},'transferNumber':{'type':_0x354f('0xf'),'required':[!![],_0x354f('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x354f('0x12'),'required':[!![],_0x354f('0xd')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x354f('0x12'),'required':[!![],_0x354f('0xd')]},'sessionId':{'type':_0x354f('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x354f('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x354f('0x12'),'required':[!![],_0x354f('0xd')]}});function emit(_0x4cc0e9,_0x588741,_0x1a02eb){logger[_0x354f('0x13')](_0x4cc0e9,_0x588741,JSON[_0x354f('0x14')](_0x1a02eb));io['to'](_0x4cc0e9)[_0x354f('0x15')](_0x588741,_0x1a02eb);}function handleError(_0x3703bb){return function(_0x36402d){console[_0x354f('0x16')]('handleError:',_0x36402d,_0x36402d instanceof RangeError);logger[_0x354f('0x17')](_0x36402d[_0x354f('0x18')]);if(_0x36402d instanceof RangeError){if(_0x36402d[_0x354f('0x19')]){delete _0x36402d['name'];}_0x3703bb[_0x354f('0x1a')](0x194)['send'](_0x36402d);}else{if(_0x36402d[_0x354f('0x19')]){delete _0x36402d[_0x354f('0x19')];}_0x3703bb['status'](0x1f4)[_0x354f('0x1b')](_0x36402d);}};}function checkError(){return function(_0x39898c){if(!_0x39898c){throw new RangeError('NotFound');}return _0x39898c;};}function respondWithRpcPromise(_0x4c2c4f,_0x25ea69){return new BPromise(function(_0x574753,_0x52e7cb){var _0xa6050f=amiClient;return _0xa6050f[_0x354f('0x1c')](_0x4c2c4f,_0x25ea69)[_0x354f('0x1d')](function(_0x2f4277){if(_0x2f4277[_0x354f('0x17')]){if(_0x2f4277[_0x354f('0x17')][_0x354f('0x1e')]===0x1f4){return _0x52e7cb(_0x2f4277['error'][_0x354f('0x1f')]);}return _0x574753(_0x2f4277['error']['message']);}else{_0x574753(_0x2f4277[_0x354f('0x20')]);}})['catch'](function(_0x4b1820){_0x52e7cb(_0x4b1820);});});}function getAgent(_0xdb861e){return db['User'][_0x354f('0x21')]({'where':{'id':_0xdb861e,'role':_0x354f('0x22')}})['then'](checkError());}function getAgentCheckSession(_0x73c95e,_0x3c5c38){return new BPromise(function(_0x1467e7,_0x4c62c3){var _0x1a968d=respondWithRpcPromise('VoiceChannels');var _0x227d9b=getAgent(_0x73c95e);Promise[_0x354f('0x23')]([_0x1a968d,_0x227d9b])[_0x354f('0x1d')](function(_0x2816cf){var _0x596b48=_0x2816cf[0x0];var _0x21c121=_0x2816cf[0x1];var _0xb50aec=_[_0x354f('0x24')](_0x596b48[_0x354f('0x25')],function(_0x223464){return _0x223464['UserId']==_0x21c121['id']&&_0x223464['sessionId']==_0x3c5c38;});if(_0xb50aec[_0x354f('0x26')]==0x1){_0x1467e7(_0x21c121);}else{_0x4c62c3(new RangeError(_0x354f('0x27')+_0x3c5c38+_0x354f('0x28')));}});});}exports[_0x354f('0x29')]=function(_0x5c38d7,_0x576a95){logger[_0x354f('0x13')](_0x354f('0x2a'),_0x5c38d7[_0x354f('0x2b')]);var _0x8ef91e=originateValidation['validate'](_0x5c38d7[_0x354f('0x2b')]);if(_0x8ef91e[_0x354f('0x26')]>0x0){return _0x576a95[_0x354f('0x1a')](0x190)[_0x354f('0x2c')](_0x8ef91e);}var _0x4cd19e=_0x5c38d7['body'][_0x354f('0x2d')];var _0xc3b77d=_0x5c38d7[_0x354f('0x2b')][_0x354f('0x2e')];var _0x33bd5a=_0x5c38d7[_0x354f('0x2b')][_0x354f('0x2f')];var _0xf3b83b=_0x5c38d7[_0x354f('0x2b')][_0x354f('0x30')];return getAgent(_0x4cd19e)[_0x354f('0x1d')](function(_0x4d59f3){logger[_0x354f('0x13')]('entityFound:',_0x4d59f3[_0x354f('0x19')]);emit(util[_0x354f('0x31')](_0x354f('0x32'),_0x4d59f3[_0x354f('0x19')]),_0x354f('0x33'),{'callNumber':_0xc3b77d,'callerId':_0x33bd5a,'callbackUrl':_0xf3b83b});return _0x576a95[_0x354f('0x1a')](0xc8)['json']({'error':![],'message':_0x354f('0x34')});})[_0x354f('0x35')](handleError(_0x576a95));};exports['hangup']=function(_0x89dcb6,_0x944fda){logger[_0x354f('0x13')]('hangup\x20fired:',_0x89dcb6[_0x354f('0x2b')]);var _0x269871=hangupValidation[_0x354f('0xc')](_0x89dcb6[_0x354f('0x2b')]);if(_0x269871['length']>0x0){return _0x944fda[_0x354f('0x1a')](0x190)['json'](_0x269871);}var _0x2f6873=_0x89dcb6[_0x354f('0x2b')][_0x354f('0x2d')];var _0x22682a=_0x89dcb6[_0x354f('0x2b')]['sessionId'];return getAgent(_0x2f6873)['then'](function(_0x162a10){logger[_0x354f('0x13')](_0x354f('0x36'),_0x162a10[_0x354f('0x19')]);emit(util[_0x354f('0x31')](_0x354f('0x32'),_0x162a10['name']),_0x354f('0x37'),{'sessionId':_0x22682a});return _0x944fda[_0x354f('0x1a')](0xc8)[_0x354f('0x2c')]({'error':![],'message':_0x354f('0x38')});})['catch'](handleError(_0x944fda));};exports[_0x354f('0x39')]=function(_0x46956e,_0x3a7180){logger[_0x354f('0x13')](_0x354f('0x3a'),_0x46956e[_0x354f('0x2b')]);var _0x5f33b2=answerValidation[_0x354f('0xc')](_0x46956e[_0x354f('0x2b')]);if(_0x5f33b2[_0x354f('0x26')]>0x0){return _0x3a7180['status'](0x190)['json'](_0x5f33b2);}var _0x7835a0=_0x46956e[_0x354f('0x2b')][_0x354f('0x2d')];var _0x3b34ca=_0x46956e[_0x354f('0x2b')][_0x354f('0x3b')];return getAgent(_0x7835a0)[_0x354f('0x1d')](function(_0x445b7d){logger['info'](_0x354f('0x36'),_0x445b7d[_0x354f('0x19')]);emit(util[_0x354f('0x31')](_0x354f('0x32'),_0x445b7d[_0x354f('0x19')]),_0x354f('0x3c'),{'sessionId':_0x3b34ca});return _0x3a7180[_0x354f('0x1a')](0xc8)[_0x354f('0x2c')]({'error':![],'message':_0x354f('0x3d')});})['catch'](handleError(_0x3a7180));};exports[_0x354f('0x3e')]=function(_0x577fa6,_0x5503d6){logger['info'](_0x354f('0x3f'),_0x577fa6[_0x354f('0x2b')]);var _0x4d26a9=holdValidation[_0x354f('0xc')](_0x577fa6[_0x354f('0x2b')]);if(_0x4d26a9[_0x354f('0x26')]>0x0){return _0x5503d6['status'](0x190)['json'](_0x4d26a9);}var _0x178313=_0x577fa6[_0x354f('0x2b')][_0x354f('0x2d')];var _0x1d6952=_0x577fa6[_0x354f('0x2b')][_0x354f('0x3b')];return getAgent(_0x178313)['then'](function(_0x55f2c9){logger[_0x354f('0x13')]('entityFound:',_0x55f2c9[_0x354f('0x19')]);emit(util[_0x354f('0x31')](_0x354f('0x32'),_0x55f2c9['name']),'webbar:hold',{'sessionId':_0x1d6952});return _0x5503d6[_0x354f('0x1a')](0xc8)[_0x354f('0x2c')]({'error':![],'message':'hold\x20executed!'});})[_0x354f('0x35')](handleError(_0x5503d6));};exports[_0x354f('0x40')]=function(_0xf71a4f,_0x2dd012){logger[_0x354f('0x13')](_0x354f('0x41'),_0xf71a4f[_0x354f('0x2b')]);var _0x4deff4=unholdValidation[_0x354f('0xc')](_0xf71a4f[_0x354f('0x2b')]);if(_0x4deff4[_0x354f('0x26')]>0x0){return _0x2dd012[_0x354f('0x1a')](0x190)[_0x354f('0x2c')](_0x4deff4);}var _0x4bb00c=_0xf71a4f[_0x354f('0x2b')][_0x354f('0x2d')];var _0x576e1d=_0xf71a4f['body'][_0x354f('0x3b')];return getAgent(_0x4bb00c)[_0x354f('0x1d')](function(_0x54914c){logger['info'](_0x354f('0x36'),_0x54914c[_0x354f('0x19')]);emit(util['format'](_0x354f('0x32'),_0x54914c[_0x354f('0x19')]),_0x354f('0x42'),{'sessionId':_0x576e1d});return _0x2dd012[_0x354f('0x1a')](0xc8)[_0x354f('0x2c')]({'error':![],'message':_0x354f('0x43')});})[_0x354f('0x35')](handleError(_0x2dd012));};exports['calls']=function(_0x2ca633,_0x4535cb){logger[_0x354f('0x13')](_0x354f('0x44'),_0x4535cb['body']);var _0x2edb7c=callsValidation[_0x354f('0xc')](_0x2ca633[_0x354f('0x2b')]);if(_0x2edb7c[_0x354f('0x26')]>0x0){return _0x4535cb['status'](0x190)[_0x354f('0x2c')](_0x2edb7c);}var _0x1e9558=_0x2ca633[_0x354f('0x2b')][_0x354f('0x2d')];var _0x58c25f=respondWithRpcPromise(_0x354f('0x45'));var _0x16a32f=getAgent(_0x1e9558);return Promise[_0x354f('0x23')]([_0x58c25f,_0x16a32f])[_0x354f('0x1d')](function(_0x6164f7){var _0x294518=_0x6164f7[0x0];var _0x3d32de=_0x6164f7[0x1];var _0x3f1770=_[_0x354f('0x24')](_0x294518[_0x354f('0x25')],function(_0x102f91){return _0x102f91[_0x354f('0x46')]==_0x3d32de['id'];});return _0x4535cb[_0x354f('0x1a')](0xc8)['json']({'count':_0x3f1770[_0x354f('0x26')],'rows':_0x3f1770});})[_0x354f('0x35')](handleError(_0x4535cb));};exports['conference']=function(_0x575b76,_0xa3d1cb){logger['info'](_0x354f('0x47'),_0x575b76[_0x354f('0x2b')]);var _0x2e08e2=conferenceValidation[_0x354f('0xc')](_0x575b76[_0x354f('0x2b')]);if(_0x2e08e2[_0x354f('0x26')]>0x0){return _0xa3d1cb[_0x354f('0x1a')](0x190)[_0x354f('0x2c')](_0x2e08e2);}var _0x5dbf67=_0x575b76[_0x354f('0x2b')][_0x354f('0x2d')];return getAgent(_0x5dbf67)[_0x354f('0x1d')](function(_0x583d97){logger[_0x354f('0x13')](_0x354f('0x36'),_0x583d97[_0x354f('0x19')]);emit(util[_0x354f('0x31')](_0x354f('0x32'),_0x583d97[_0x354f('0x19')]),'webbar:conference');return _0xa3d1cb[_0x354f('0x1a')](0xc8)[_0x354f('0x2c')]({'error':![],'message':'conference\x20executed!'});})[_0x354f('0x35')](handleError(_0xa3d1cb));};exports[_0x354f('0x48')]=function(_0x1c8401,_0x1088d2){logger['info'](_0x354f('0x49'),_0x1c8401['body']);var _0x4b9a9f=transferValidation[_0x354f('0xc')](_0x1c8401[_0x354f('0x2b')]);if(_0x4b9a9f[_0x354f('0x26')]>0x0){return _0x1088d2[_0x354f('0x1a')](0x190)[_0x354f('0x2c')](_0x4b9a9f);}var _0x4ca3df=_0x1c8401['body'][_0x354f('0x2d')];var _0x41b1a5=_0x1c8401[_0x354f('0x2b')][_0x354f('0x3b')];var _0x5681d9=_0x1c8401[_0x354f('0x2b')][_0x354f('0x4a')];return getAgent(_0x4ca3df)['then'](function(_0x1139b8){logger[_0x354f('0x13')](_0x354f('0x36'),_0x1139b8[_0x354f('0x19')]);emit(util[_0x354f('0x31')](_0x354f('0x32'),_0x1139b8[_0x354f('0x19')]),_0x354f('0x4b'),{'sessionId':_0x41b1a5,'transferNumber':_0x5681d9});return _0x1088d2[_0x354f('0x1a')](0xc8)[_0x354f('0x2c')]({'error':![],'message':'transfer\x20executed!'});})[_0x354f('0x35')](handleError(_0x1088d2));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 27c70a7..ff6ddb4 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 _0x781d=['post','addDisposition','/:id/canned_answers','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications'];(function(_0x2fdce0,_0x496242){var _0x36f07e=function(_0x44c8c6){while(--_0x44c8c6){_0x2fdce0['push'](_0x2fdce0['shift']());}};_0x36f07e(++_0x496242);}(_0x781d,0x14a));var _0xd781=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x781d[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd781('0x2'));var router=express[_0xd781('0x3')]();var fs_extra=require(_0xd781('0x4'));var auth=require(_0xd781('0x5'));var interaction=require(_0xd781('0x6'));var config=require(_0xd781('0x7'));var controller=require(_0xd781('0x8'));router[_0xd781('0x9')]('/',auth[_0xd781('0xa')](),controller[_0xd781('0xb')]);router['get'](_0xd781('0xc'),auth[_0xd781('0xa')](),controller[_0xd781('0xd')]);router[_0xd781('0x9')]('/:id',auth[_0xd781('0xa')](),controller['show']);router[_0xd781('0x9')](_0xd781('0xe'),auth['isAuthenticated'](),controller[_0xd781('0xf')]);router[_0xd781('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xd781('0x10')]);router[_0xd781('0x9')](_0xd781('0x11'),auth[_0xd781('0xa')](),controller[_0xd781('0x12')]);router[_0xd781('0x9')](_0xd781('0x13'),auth[_0xd781('0xa')](),controller[_0xd781('0x14')]);router[_0xd781('0x15')]('/',auth[_0xd781('0xa')](),controller['create']);router[_0xd781('0x15')](_0xd781('0xe'),auth['isAuthenticated'](),controller[_0xd781('0x16')]);router['post'](_0xd781('0x17'),auth[_0xd781('0xa')](),controller[_0xd781('0x18')]);router[_0xd781('0x15')](_0xd781('0x11'),auth[_0xd781('0xa')](),controller[_0xd781('0x19')]);router['post'](_0xd781('0x13'),auth[_0xd781('0xa')](),controller[_0xd781('0x1a')]);router[_0xd781('0x15')](_0xd781('0x1b'),controller[_0xd781('0x1c')]);router[_0xd781('0x15')](_0xd781('0x1d'),auth['isAuthenticated'](),controller[_0xd781('0x1e')]);router[_0xd781('0x1f')](_0xd781('0x20'),auth[_0xd781('0xa')](),controller[_0xd781('0x21')]);router[_0xd781('0x22')](_0xd781('0x20'),auth['isAuthenticated'](),controller[_0xd781('0x23')]);router['delete']('/:id/dispositions',auth[_0xd781('0xa')](),controller['removeDispositions']);router[_0xd781('0x22')](_0xd781('0x17'),auth[_0xd781('0xa')](),controller[_0xd781('0x24')]);router[_0xd781('0x22')](_0xd781('0x11'),auth[_0xd781('0xa')](),controller[_0xd781('0x25')]);module[_0xd781('0x26')]=router; \ No newline at end of file +var _0x9536=['getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addApplications','/:id/notify','notify','send','put','delete','destroy','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x286943,_0x11a3cc){var _0x2f6283=function(_0x30679d){while(--_0x30679d){_0x286943['push'](_0x286943['shift']());}};_0x2f6283(++_0x11a3cc);}(_0x9536,0x179));var _0x6953=function(_0x259d17,_0x220710){_0x259d17=_0x259d17-0x0;var _0x407535=_0x9536[_0x259d17];return _0x407535;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require(_0x6953('0x3'));var express=require('express');var router=express[_0x6953('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6953('0x5'));var interaction=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var controller=require(_0x6953('0x8'));router[_0x6953('0x9')]('/',auth['isAuthenticated'](),controller[_0x6953('0xa')]);router[_0x6953('0x9')](_0x6953('0xb'),auth[_0x6953('0xc')](),controller[_0x6953('0xd')]);router['get'](_0x6953('0xe'),auth[_0x6953('0xc')](),controller[_0x6953('0xf')]);router['get'](_0x6953('0x10'),auth[_0x6953('0xc')](),controller[_0x6953('0x11')]);router[_0x6953('0x9')](_0x6953('0x12'),auth[_0x6953('0xc')](),controller[_0x6953('0x13')]);router[_0x6953('0x9')](_0x6953('0x14'),auth['isAuthenticated'](),controller[_0x6953('0x15')]);router['get'](_0x6953('0x16'),auth[_0x6953('0xc')](),controller[_0x6953('0x17')]);router[_0x6953('0x18')]('/',auth[_0x6953('0xc')](),controller[_0x6953('0x19')]);router[_0x6953('0x18')](_0x6953('0x10'),auth[_0x6953('0xc')](),controller[_0x6953('0x1a')]);router[_0x6953('0x18')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x6953('0x1b')]);router[_0x6953('0x18')](_0x6953('0x14'),auth[_0x6953('0xc')](),controller['addAgents']);router[_0x6953('0x18')](_0x6953('0x16'),auth['isAuthenticated'](),controller[_0x6953('0x1c')]);router[_0x6953('0x18')](_0x6953('0x1d'),controller[_0x6953('0x1e')]);router[_0x6953('0x18')]('/:id/send',auth[_0x6953('0xc')](),controller[_0x6953('0x1f')]);router[_0x6953('0x20')](_0x6953('0xe'),auth[_0x6953('0xc')](),controller['update']);router[_0x6953('0x21')](_0x6953('0xe'),auth['isAuthenticated'](),controller[_0x6953('0x22')]);router[_0x6953('0x21')](_0x6953('0x10'),auth[_0x6953('0xc')](),controller['removeDispositions']);router[_0x6953('0x21')](_0x6953('0x12'),auth[_0x6953('0xc')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0x6953('0xc')](),controller[_0x6953('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 5868b98..82822b4 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 _0x24d4=['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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','STRING','name'];(function(_0x249d76,_0x16de0e){var _0x2a0e84=function(_0x2f144d){while(--_0x2f144d){_0x249d76['push'](_0x249d76['shift']());}};_0x2a0e84(++_0x16de0e);}(_0x24d4,0x136));var _0x424d=function(_0x53e19d,_0x604957){_0x53e19d=_0x53e19d-0x0;var _0x5ba332=_0x24d4[_0x53e19d];return _0x5ba332;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x424d('0x0')],'unique':_0x424d('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0x424d('0x0')],'allowNull':![]},'remote':{'type':Sequelize[_0x424d('0x0')],'allowNull':![]},'token':{'type':Sequelize[_0x424d('0x0')],'defaultValue':function(){return rs[_0x424d('0x2')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x424d('0x3')](_0x424d('0x4'))},'accountSid':{'type':Sequelize[_0x424d('0x0')]},'authToken':{'type':Sequelize[_0x424d('0x0')]},'notificationTemplate':{'type':Sequelize[_0x424d('0x5')],'defaultValue':function(){return _0x424d('0x6');}},'notificationSound':{'type':Sequelize[_0x424d('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x424d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x424d('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x424d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x424d('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x424d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x424d('0x8')],'comment':_0x424d('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x424d('0x7')],'defaultValue':![],'comment':_0x424d('0xa'),'set':function(_0x4a51bc){if(!_0x4a51bc){this[_0x424d('0xb')](_0x424d('0xc'),null);}this[_0x424d('0xb')]('mandatoryDisposition',_0x4a51bc);}},'description':{'type':Sequelize[_0x424d('0x0')]}}; \ No newline at end of file +var _0xecc2=['ENUM','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','exports','name','STRING','generate'];(function(_0x1ecd33,_0xc34eef){var _0xffa5a3=function(_0x1097a3){while(--_0x1097a3){_0x1ecd33['push'](_0x1ecd33['shift']());}};_0xffa5a3(++_0xc34eef);}(_0xecc2,0x18e));var _0x2ecc=function(_0x4a77e1,_0x213125){_0x4a77e1=_0x4a77e1-0x0;var _0x1bd46d=_0xecc2[_0x4a77e1];return _0x1bd46d;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x2ecc('0x0'));module[_0x2ecc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2ecc('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x2ecc('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x2ecc('0x3')],'defaultValue':function(){return rs[_0x2ecc('0x4')]();}},'phone':{'type':Sequelize[_0x2ecc('0x3')]},'type':{'type':Sequelize[_0x2ecc('0x5')]('twilio')},'accountSid':{'type':Sequelize[_0x2ecc('0x3')]},'authToken':{'type':Sequelize[_0x2ecc('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x2ecc('0x6');}},'notificationSound':{'type':Sequelize[_0x2ecc('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2ecc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2ecc('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2ecc('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2ecc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2ecc('0x8')],'comment':_0x2ecc('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x2ecc('0x7')],'defaultValue':![],'comment':_0x2ecc('0xa'),'set':function(_0x541f4c){if(!_0x541f4c){this[_0x2ecc('0xb')]('mandatoryDispositionPauseId',null);}this[_0x2ecc('0xb')](_0x2ecc('0xc'),_0x541f4c);}},'description':{'type':Sequelize[_0x2ecc('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index a8e7d4a..1cde844 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 _0xeb18=['interaction','created','autoclose','close','unmanaged','*,*,*,*','WhatsappMessage','messageId','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','\x0a','CmList','List','out','Messages','dataValues','push','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','show','params','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','Disposition','getDispositions','findOne','WhatsappAccountId','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','account','applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','MessageSid','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','Contacts','DESC','list','contact','WhatsappInteraction'];(function(_0xe2e527,_0x2d6d4b){var _0x3f4778=function(_0x49a782){while(--_0x49a782){_0xe2e527['push'](_0xe2e527['shift']());}};_0x3f4778(++_0x2d6d4b);}(_0xeb18,0xd8));var _0x8eb1=function(_0x3b8f97,_0x18771){_0x3b8f97=_0x3b8f97-0x0;var _0x36667d=_0xeb18[_0x3b8f97];return _0x36667d;};'use strict';var emlformat=require(_0x8eb1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8eb1('0x1'));var jsonpatch=require(_0x8eb1('0x2'));var rp=require(_0x8eb1('0x3'));var moment=require(_0x8eb1('0x4'));var BPromise=require(_0x8eb1('0x5'));var Mustache=require(_0x8eb1('0x6'));var util=require(_0x8eb1('0x7'));var path=require(_0x8eb1('0x8'));var sox=require(_0x8eb1('0x9'));var csv=require('to-csv');var ejs=require(_0x8eb1('0xa'));var fs=require('fs');var fs_extra=require(_0x8eb1('0xb'));var _=require(_0x8eb1('0xc'));var squel=require(_0x8eb1('0xd'));var crypto=require(_0x8eb1('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8eb1('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8eb1('0x10'));var qs=require(_0x8eb1('0x11'));var as=require(_0x8eb1('0x12'));var hardwareService=require(_0x8eb1('0x13'));var logger=require('../../config/logger')(_0x8eb1('0x14'));var utils=require(_0x8eb1('0x15'));var config=require(_0x8eb1('0x16'));var licenseUtil=require(_0x8eb1('0x17'));var db=require('../../mysqldb')['db'];config[_0x8eb1('0x18')]=_[_0x8eb1('0x19')](config[_0x8eb1('0x18')],{'host':_0x8eb1('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8eb1('0x1b'))[_0x8eb1('0x1c')](socket);var jayson=require(_0x8eb1('0x1d'));var client=jayson[_0x8eb1('0x1e')][_0x8eb1('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x40dc96,_0x282ef4,_0xf3a7a4,_0x55adc7){return new BPromise(function(_0x3054ab,_0x340053){var _0x49888d=_0x55adc7||client;return _0x49888d[_0x8eb1('0x20')](_0x40dc96,_0xf3a7a4)[_0x8eb1('0x21')](function(_0x380dee){logger[_0x8eb1('0x22')](_0x8eb1('0x23'),_0x282ef4,_0x8eb1('0x24'));logger[_0x8eb1('0x25')](_0x8eb1('0x26'),_0x282ef4,_0x8eb1('0x24'),JSON[_0x8eb1('0x27')](_0x380dee));if(_0x380dee[_0x8eb1('0x28')]){if(_0x380dee['error'][_0x8eb1('0x29')]===0x1f4){logger['error'](_0x8eb1('0x23'),_0x282ef4,_0x380dee[_0x8eb1('0x28')][_0x8eb1('0x2a')]);return _0x340053(_0x380dee['error'][_0x8eb1('0x2a')]);}logger[_0x8eb1('0x28')](_0x8eb1('0x23'),_0x282ef4,_0x380dee[_0x8eb1('0x28')]['message']);return _0x3054ab(_0x380dee[_0x8eb1('0x28')][_0x8eb1('0x2a')]);}else{logger['info'](_0x8eb1('0x23'),_0x282ef4,_0x8eb1('0x24'));_0x3054ab(_0x380dee['result'][_0x8eb1('0x2a')]);}})[_0x8eb1('0x2b')](function(_0x5e1811){logger[_0x8eb1('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x282ef4,_0x5e1811);_0x340053(_0x5e1811);});});}function respondWithStatusCode(_0x46eb4e,_0x27fec8){_0x27fec8=_0x27fec8||0xcc;return function(_0x59da32){if(_0x59da32){return _0x46eb4e['sendStatus'](_0x27fec8);}return _0x46eb4e[_0x8eb1('0x2c')](_0x27fec8)[_0x8eb1('0x2d')]();};}function respondWithResult(_0x364f04,_0x1a7ace){_0x1a7ace=_0x1a7ace||0xc8;return function(_0x3b29dd){if(_0x3b29dd){return _0x364f04[_0x8eb1('0x2c')](_0x1a7ace)[_0x8eb1('0x2e')](_0x3b29dd);}};}function respondWithFilteredResult(_0x53686b,_0x4a14b5){return function(_0xef661a){if(_0xef661a){var _0x10d038=typeof _0x4a14b5[_0x8eb1('0x2f')]===_0x8eb1('0x30')&&typeof _0x4a14b5[_0x8eb1('0x31')]===_0x8eb1('0x30');var _0x282ffd=_0xef661a['count'];var _0x176c87=_0x10d038?0x0:_0x4a14b5[_0x8eb1('0x2f')];var _0x32327f=_0x10d038?_0xef661a[_0x8eb1('0x32')]:_0x4a14b5[_0x8eb1('0x2f')]+_0x4a14b5[_0x8eb1('0x31')];var _0x52be75;if(_0x32327f>=_0x282ffd){_0x32327f=_0x282ffd;_0x52be75=0xc8;}else{_0x52be75=0xce;}_0x53686b[_0x8eb1('0x2c')](_0x52be75);return _0x53686b[_0x8eb1('0x33')]('Content-Range',_0x176c87+'-'+_0x32327f+'/'+_0x282ffd)[_0x8eb1('0x2e')](_0xef661a);}return null;};}function patchUpdates(_0x4b00c2){return function(_0x481cb6){try{jsonpatch[_0x8eb1('0x34')](_0x481cb6,_0x4b00c2,!![]);}catch(_0x21ca81){return BPromise[_0x8eb1('0x35')](_0x21ca81);}return _0x481cb6[_0x8eb1('0x36')]();};}function saveUpdates(_0x564c2a,_0x314e2c){return function(_0xbdb931){if(_0xbdb931){return _0xbdb931[_0x8eb1('0x37')](_0x564c2a)[_0x8eb1('0x21')](function(_0x5a0d97){return _0x5a0d97;});}return null;};}function removeEntity(_0x1dde35,_0x3074ef){return function(_0x4cece2){if(_0x4cece2){return _0x4cece2[_0x8eb1('0x38')]()['then'](function(){var _0x38b8e1=_0x4cece2['get']({'plain':!![]});var _0x232c9c=_0x8eb1('0x39');return db[_0x8eb1('0x3a')]['destroy']({'where':{'type':_0x232c9c,'resourceId':_0x38b8e1['id']}})[_0x8eb1('0x21')](function(){return _0x4cece2;});})[_0x8eb1('0x21')](function(){_0x1dde35[_0x8eb1('0x2c')](0xcc)[_0x8eb1('0x2d')]();});}};}function handleEntityNotFound(_0x61001e,_0x1d3b2e){return function(_0x3877ce){if(!_0x3877ce){_0x61001e[_0x8eb1('0x3b')](0x194);}return _0x3877ce;};}function handleError(_0x1aa4c0,_0xdc03d2){_0xdc03d2=_0xdc03d2||0x1f4;return function(_0x3b636f){logger[_0x8eb1('0x28')](_0x3b636f[_0x8eb1('0x3c')]);if(_0x3b636f[_0x8eb1('0x3d')]){delete _0x3b636f[_0x8eb1('0x3d')];}_0x1aa4c0[_0x8eb1('0x2c')](_0xdc03d2)['send'](_0x3b636f);};}exports[_0x8eb1('0x3e')]=function(_0xc4eddf,_0x19b578){var _0x2855f8={'include':[{'model':db[_0x8eb1('0x3f')],'as':_0x8eb1('0x40')}]},_0x54de75={},_0x27c8aa={'count':0x0,'rows':[]};var _0x55b3d0=_[_0x8eb1('0x41')](db['WhatsappAccount'][_0x8eb1('0x42')],function(_0x570e36){return{'name':_0x570e36['fieldName'],'type':_0x570e36[_0x8eb1('0x43')]['key']};});_0x54de75[_0x8eb1('0x44')]=_['map'](_0x55b3d0,_0x8eb1('0x3d'));_0x54de75[_0x8eb1('0x45')]=_[_0x8eb1('0x46')](_0xc4eddf[_0x8eb1('0x45')]);_0x54de75[_0x8eb1('0x47')]=_[_0x8eb1('0x48')](_0x54de75[_0x8eb1('0x44')],_0x54de75[_0x8eb1('0x45')]);_0x2855f8[_0x8eb1('0x49')]=_[_0x8eb1('0x48')](_0x54de75['model'],qs[_0x8eb1('0x4a')](_0xc4eddf['query']['fields']));_0x2855f8[_0x8eb1('0x49')]=_0x2855f8[_0x8eb1('0x49')][_0x8eb1('0x4b')]?_0x2855f8[_0x8eb1('0x49')]:_0x54de75[_0x8eb1('0x44')];if(!_0xc4eddf['query'][_0x8eb1('0x4c')](_0x8eb1('0x4d'))){_0x2855f8[_0x8eb1('0x31')]=qs[_0x8eb1('0x31')](_0xc4eddf[_0x8eb1('0x45')]['limit']);_0x2855f8[_0x8eb1('0x2f')]=qs[_0x8eb1('0x2f')](_0xc4eddf[_0x8eb1('0x45')][_0x8eb1('0x2f')]);}_0x2855f8[_0x8eb1('0x4e')]=qs['sort'](_0xc4eddf[_0x8eb1('0x45')][_0x8eb1('0x4f')]);_0x2855f8[_0x8eb1('0x50')]=qs[_0x8eb1('0x47')](_[_0x8eb1('0x51')](_0xc4eddf['query'],_0x54de75['filters']),_0x55b3d0);if(_0xc4eddf[_0x8eb1('0x45')][_0x8eb1('0x52')]){_0x2855f8[_0x8eb1('0x50')]=_[_0x8eb1('0x53')](_0x2855f8[_0x8eb1('0x50')],{'$or':_[_0x8eb1('0x41')](_0x55b3d0,function(_0x28b09e){if(_0x28b09e[_0x8eb1('0x43')]!==_0x8eb1('0x54')){var _0x2ae5ba={};_0x2ae5ba[_0x28b09e[_0x8eb1('0x3d')]]={'$like':'%'+_0xc4eddf['query'][_0x8eb1('0x52')]+'%'};return _0x2ae5ba;}})});}_0x2855f8=_[_0x8eb1('0x53')]({},_0x2855f8,_0xc4eddf[_0x8eb1('0x55')]);var _0x4adb22={'where':_0x2855f8[_0x8eb1('0x50')]};return db[_0x8eb1('0x56')][_0x8eb1('0x32')](_0x4adb22)[_0x8eb1('0x21')](function(_0x220e4f){_0x27c8aa[_0x8eb1('0x32')]=_0x220e4f;if(_0xc4eddf['query'][_0x8eb1('0x57')]){_0x2855f8[_0x8eb1('0x58')]=[{'all':!![]}];}return db[_0x8eb1('0x56')][_0x8eb1('0x59')](_0x2855f8);})['then'](function(_0x2dd8ad){_0x27c8aa[_0x8eb1('0x5a')]=_0x2dd8ad;return _0x27c8aa;})['then'](respondWithFilteredResult(_0x19b578,_0x2855f8))[_0x8eb1('0x2b')](handleError(_0x19b578,null));};exports[_0x8eb1('0x5b')]=function(_0x1adbac,_0x26bd48){var _0x3f83b8={'raw':![],'where':{'id':_0x1adbac[_0x8eb1('0x5c')]['id']},'include':[{'model':db[_0x8eb1('0x3f')],'as':_0x8eb1('0x40')}]},_0x2ea87d={};_0x2ea87d['model']=_[_0x8eb1('0x46')](db[_0x8eb1('0x56')][_0x8eb1('0x42')]);_0x2ea87d[_0x8eb1('0x45')]=_[_0x8eb1('0x46')](_0x1adbac[_0x8eb1('0x45')]);_0x2ea87d['filters']=_['intersection'](_0x2ea87d['model'],_0x2ea87d[_0x8eb1('0x45')]);_0x3f83b8[_0x8eb1('0x49')]=_[_0x8eb1('0x48')](_0x2ea87d[_0x8eb1('0x44')],qs['fields'](_0x1adbac[_0x8eb1('0x45')][_0x8eb1('0x4a')]));_0x3f83b8['attributes']=_0x3f83b8['attributes'][_0x8eb1('0x4b')]?_0x3f83b8[_0x8eb1('0x49')]:_0x2ea87d[_0x8eb1('0x44')];if(_0x1adbac['query'][_0x8eb1('0x57')]){_0x3f83b8[_0x8eb1('0x58')]=[{'all':!![]}];}_0x3f83b8=_[_0x8eb1('0x53')]({},_0x3f83b8,_0x1adbac[_0x8eb1('0x55')]);return db['WhatsappAccount']['find'](_0x3f83b8)[_0x8eb1('0x21')](handleEntityNotFound(_0x26bd48,null))[_0x8eb1('0x21')](respondWithResult(_0x26bd48,null))[_0x8eb1('0x2b')](handleError(_0x26bd48,null));};exports['create']=function(_0x51afc3,_0x5045d5){return db[_0x8eb1('0x56')]['create'](_0x51afc3['body'],{})[_0x8eb1('0x21')](function(_0x11a6fc){var _0x265fe7=_0x51afc3['user'][_0x8eb1('0x5d')]({'plain':!![]});if(!_0x265fe7)throw new Error(_0x8eb1('0x5e'));if(_0x265fe7[_0x8eb1('0x5f')]===_0x8eb1('0x60')){var _0xd0a752=_0x11a6fc[_0x8eb1('0x5d')]({'plain':!![]});var _0xed8174=_0x8eb1('0x39');return db[_0x8eb1('0x61')][_0x8eb1('0x62')]({'where':{'name':_0xed8174,'userProfileId':_0x265fe7['userProfileId']},'raw':!![]})['then'](function(_0x309394){if(_0x309394&&_0x309394[_0x8eb1('0x63')]===0x0){return db[_0x8eb1('0x3a')][_0x8eb1('0x64')]({'name':_0xd0a752['name'],'resourceId':_0xd0a752['id'],'type':_0x309394[_0x8eb1('0x3d')],'sectionId':_0x309394['id']},{})[_0x8eb1('0x21')](function(){return _0x11a6fc;});}else{return _0x11a6fc;}})[_0x8eb1('0x2b')](function(_0x158fd7){logger['error'](_0x8eb1('0x65'),_0x158fd7);throw _0x158fd7;});}return _0x11a6fc;})[_0x8eb1('0x21')](respondWithResult(_0x5045d5,0xc9))[_0x8eb1('0x2b')](handleError(_0x5045d5,null));};exports[_0x8eb1('0x37')]=function(_0x5638d8,_0x4df95d){if(_0x5638d8[_0x8eb1('0x66')]['id']){delete _0x5638d8[_0x8eb1('0x66')]['id'];}return db['WhatsappAccount'][_0x8eb1('0x62')]({'where':{'id':_0x5638d8[_0x8eb1('0x5c')]['id']},'include':[{'model':db[_0x8eb1('0x3f')],'as':_0x8eb1('0x40')}]})[_0x8eb1('0x21')](handleEntityNotFound(_0x4df95d,null))['then'](saveUpdates(_0x5638d8[_0x8eb1('0x66')],null))['then'](respondWithResult(_0x4df95d,null))[_0x8eb1('0x2b')](handleError(_0x4df95d,null));};exports[_0x8eb1('0x38')]=function(_0x55ea16,_0x3ca327){return db[_0x8eb1('0x56')]['find']({'where':{'id':_0x55ea16[_0x8eb1('0x5c')]['id']}})[_0x8eb1('0x21')](handleEntityNotFound(_0x3ca327,null))['then'](removeEntity(_0x3ca327,null))[_0x8eb1('0x2b')](handleError(_0x3ca327,null));};exports[_0x8eb1('0x67')]=function(_0x5ce63a,_0xb0651f){return db[_0x8eb1('0x56')][_0x8eb1('0x67')]()['then'](respondWithResult(_0xb0651f,null))[_0x8eb1('0x2b')](handleError(_0xb0651f,null));};exports['addDisposition']=function(_0x53ca03,_0x2fa078,_0x538a81){if(_0x53ca03[_0x8eb1('0x66')]['id']){delete _0x53ca03[_0x8eb1('0x66')]['id'];}return db[_0x8eb1('0x56')][_0x8eb1('0x62')]({'where':{'id':_0x53ca03[_0x8eb1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2fa078,null))[_0x8eb1('0x21')](function(_0x3e3766){if(_0x3e3766){_0x53ca03[_0x8eb1('0x66')]['WhatsappAccountId']=_0x3e3766['id'];return db[_0x8eb1('0x68')][_0x8eb1('0x64')](_0x53ca03[_0x8eb1('0x66')]);}})[_0x8eb1('0x21')](respondWithResult(_0x2fa078,null))['catch'](handleError(_0x2fa078,null));};exports[_0x8eb1('0x69')]=function(_0x26a6d9,_0x5eb2ab,_0xe0a63){var _0x3d3a94={'raw':![],'where':{}};var _0x4c0410={};var _0x12ed6f={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x8eb1('0x6a')]({'where':{'id':_0x26a6d9[_0x8eb1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5eb2ab,null))[_0x8eb1('0x21')](function(_0x109187){if(_0x109187){_0x4c0410[_0x8eb1('0x44')]=_['keys'](db[_0x8eb1('0x68')][_0x8eb1('0x42')]);_0x4c0410[_0x8eb1('0x45')]=_[_0x8eb1('0x46')](_0x26a6d9[_0x8eb1('0x45')]);_0x4c0410[_0x8eb1('0x47')]=_[_0x8eb1('0x48')](_0x4c0410['model'],_0x4c0410[_0x8eb1('0x45')]);_0x3d3a94[_0x8eb1('0x49')]=_[_0x8eb1('0x48')](_0x4c0410['model'],qs[_0x8eb1('0x4a')](_0x26a6d9[_0x8eb1('0x45')][_0x8eb1('0x4a')]));_0x3d3a94['attributes']=_0x3d3a94[_0x8eb1('0x49')][_0x8eb1('0x4b')]?_0x3d3a94[_0x8eb1('0x49')]:_0x4c0410[_0x8eb1('0x44')];if(!_0x26a6d9[_0x8eb1('0x45')][_0x8eb1('0x4c')](_0x8eb1('0x4d'))){_0x3d3a94[_0x8eb1('0x31')]=qs['limit'](_0x26a6d9[_0x8eb1('0x45')][_0x8eb1('0x31')]);_0x3d3a94[_0x8eb1('0x2f')]=qs[_0x8eb1('0x2f')](_0x26a6d9[_0x8eb1('0x45')][_0x8eb1('0x2f')]);}_0x3d3a94[_0x8eb1('0x4e')]=qs[_0x8eb1('0x4f')](_0x26a6d9[_0x8eb1('0x45')][_0x8eb1('0x4f')]);_0x3d3a94['where']=qs[_0x8eb1('0x47')](_[_0x8eb1('0x51')](_0x26a6d9[_0x8eb1('0x45')],_0x4c0410[_0x8eb1('0x47')]));_0x3d3a94[_0x8eb1('0x50')][_0x8eb1('0x6b')]=_0x109187['id'];if(_0x26a6d9[_0x8eb1('0x45')][_0x8eb1('0x52')]){_0x3d3a94['where']=_[_0x8eb1('0x53')](_0x3d3a94[_0x8eb1('0x50')],{'$or':_['map'](_0x3d3a94[_0x8eb1('0x49')],function(_0x4ffb03){var _0x1c1345={};_0x1c1345[_0x4ffb03]={'$like':'%'+_0x26a6d9['query'][_0x8eb1('0x52')]+'%'};return _0x1c1345;})});}_0x3d3a94=_[_0x8eb1('0x53')]({},_0x3d3a94,_0x26a6d9[_0x8eb1('0x55')]);return db['Disposition'][_0x8eb1('0x32')]({'where':_0x3d3a94['where']})[_0x8eb1('0x21')](function(_0x1c2749){_0x12ed6f['count']=_0x1c2749;if(_0x26a6d9[_0x8eb1('0x45')][_0x8eb1('0x57')]){_0x3d3a94[_0x8eb1('0x58')]=[{'all':!![]}];}return db[_0x8eb1('0x68')][_0x8eb1('0x59')](_0x3d3a94);})[_0x8eb1('0x21')](function(_0x2a10e8){_0x12ed6f['rows']=_0x2a10e8;return _0x12ed6f;});}})[_0x8eb1('0x21')](respondWithFilteredResult(_0x5eb2ab,_0x3d3a94))[_0x8eb1('0x2b')](handleError(_0x5eb2ab,null));};exports[_0x8eb1('0x6c')]=function(_0x2a9ec4,_0x40bc9b,_0x3b1bb1){return db['WhatsappAccount'][_0x8eb1('0x62')]({'where':{'id':_0x2a9ec4[_0x8eb1('0x5c')]['id']}})[_0x8eb1('0x21')](handleEntityNotFound(_0x40bc9b,null))['then'](function(_0x2e1ee0){if(_0x2e1ee0){return _0x2e1ee0['removeDispositions'](_0x2a9ec4['query']['ids']);}})[_0x8eb1('0x21')](respondWithStatusCode(_0x40bc9b,null))[_0x8eb1('0x2b')](handleError(_0x40bc9b,null));};exports[_0x8eb1('0x6d')]=function(_0x51d167,_0x1f6723,_0x4b210a){if(_0x51d167[_0x8eb1('0x66')]['id']){delete _0x51d167[_0x8eb1('0x66')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x51d167[_0x8eb1('0x5c')]['id']}})[_0x8eb1('0x21')](handleEntityNotFound(_0x1f6723,null))[_0x8eb1('0x21')](function(_0x361b8f){if(_0x361b8f){_0x51d167[_0x8eb1('0x66')][_0x8eb1('0x6b')]=_0x361b8f['id'];return db[_0x8eb1('0x6e')][_0x8eb1('0x64')](_0x51d167['body']);}})[_0x8eb1('0x21')](respondWithResult(_0x1f6723,null))[_0x8eb1('0x2b')](handleError(_0x1f6723,null));};exports['getAnswers']=function(_0x1ed716,_0x338ecd,_0x59a6db){var _0x42d347={'raw':![],'where':{}};var _0x36e9fa={};var _0x374804={'count':0x0,'rows':[]};return db[_0x8eb1('0x56')][_0x8eb1('0x6a')]({'where':{'id':_0x1ed716[_0x8eb1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x338ecd,null))[_0x8eb1('0x21')](function(_0x6e4637){if(_0x6e4637){_0x36e9fa[_0x8eb1('0x44')]=_['keys'](db[_0x8eb1('0x6e')]['rawAttributes']);_0x36e9fa['query']=_[_0x8eb1('0x46')](_0x1ed716[_0x8eb1('0x45')]);_0x36e9fa[_0x8eb1('0x47')]=_['intersection'](_0x36e9fa[_0x8eb1('0x44')],_0x36e9fa[_0x8eb1('0x45')]);_0x42d347[_0x8eb1('0x49')]=_[_0x8eb1('0x48')](_0x36e9fa['model'],qs['fields'](_0x1ed716[_0x8eb1('0x45')][_0x8eb1('0x4a')]));_0x42d347[_0x8eb1('0x49')]=_0x42d347['attributes'][_0x8eb1('0x4b')]?_0x42d347['attributes']:_0x36e9fa[_0x8eb1('0x44')];if(!_0x1ed716[_0x8eb1('0x45')][_0x8eb1('0x4c')](_0x8eb1('0x4d'))){_0x42d347[_0x8eb1('0x31')]=qs[_0x8eb1('0x31')](_0x1ed716['query'][_0x8eb1('0x31')]);_0x42d347['offset']=qs[_0x8eb1('0x2f')](_0x1ed716[_0x8eb1('0x45')]['offset']);}_0x42d347[_0x8eb1('0x4e')]=qs['sort'](_0x1ed716[_0x8eb1('0x45')]['sort']);_0x42d347[_0x8eb1('0x50')]=qs[_0x8eb1('0x47')](_[_0x8eb1('0x51')](_0x1ed716[_0x8eb1('0x45')],_0x36e9fa[_0x8eb1('0x47')]));_0x42d347[_0x8eb1('0x50')]['WhatsappAccountId']=_0x6e4637['id'];if(_0x1ed716[_0x8eb1('0x45')]['filter']){_0x42d347[_0x8eb1('0x50')]=_[_0x8eb1('0x53')](_0x42d347[_0x8eb1('0x50')],{'$or':_['map'](_0x42d347[_0x8eb1('0x49')],function(_0x23c861){var _0x232c3e={};_0x232c3e[_0x23c861]={'$like':'%'+_0x1ed716[_0x8eb1('0x45')][_0x8eb1('0x52')]+'%'};return _0x232c3e;})});}_0x42d347=_[_0x8eb1('0x53')]({},_0x42d347,_0x1ed716[_0x8eb1('0x55')]);return db['CannedAnswer'][_0x8eb1('0x32')]({'where':_0x42d347['where']})[_0x8eb1('0x21')](function(_0xb59403){_0x374804['count']=_0xb59403;if(_0x1ed716[_0x8eb1('0x45')][_0x8eb1('0x57')]){_0x42d347[_0x8eb1('0x58')]=[{'all':!![]}];}return db[_0x8eb1('0x6e')]['findAll'](_0x42d347);})[_0x8eb1('0x21')](function(_0x4c841c){_0x374804[_0x8eb1('0x5a')]=_0x4c841c;return _0x374804;});}})['then'](respondWithFilteredResult(_0x338ecd,_0x42d347))[_0x8eb1('0x2b')](handleError(_0x338ecd,null));};exports[_0x8eb1('0x6f')]=function(_0x593736,_0x234cfb,_0x1b97e9){return db['WhatsappAccount'][_0x8eb1('0x62')]({'where':{'id':_0x593736['params']['id']}})[_0x8eb1('0x21')](handleEntityNotFound(_0x234cfb,null))['then'](function(_0x2e5d40){if(_0x2e5d40){return _0x2e5d40[_0x8eb1('0x6f')](_0x593736[_0x8eb1('0x45')][_0x8eb1('0x70')]);}})[_0x8eb1('0x21')](respondWithStatusCode(_0x234cfb,null))[_0x8eb1('0x2b')](handleError(_0x234cfb,null));};exports[_0x8eb1('0x71')]=function(_0x398fcc,_0x21dceb,_0x22e5bc){return db[_0x8eb1('0x56')][_0x8eb1('0x62')]({'where':{'id':_0x398fcc['params']['id']}})['then'](handleEntityNotFound(_0x21dceb,null))['then'](function(_0x127d66){if(_0x127d66){return _0x127d66[_0x8eb1('0x71')](_0x398fcc[_0x8eb1('0x66')][_0x8eb1('0x70')],_[_0x8eb1('0x72')](_0x398fcc[_0x8eb1('0x66')],['ids','id'])||{})[_0x8eb1('0x73')](function(_0x37d026){for(var _0x2943ae=0x0;_0x2943ae<_0x398fcc[_0x8eb1('0x66')][_0x8eb1('0x70')]['length'];_0x2943ae+=0x1){socket[_0x8eb1('0x74')](_0x8eb1('0x75'),{'UserId':Number(_0x398fcc['body'][_0x8eb1('0x70')][_0x2943ae]),'WhatsappAccountId':Number(_0x398fcc['params']['id'])});}return _0x37d026;});}})[_0x8eb1('0x21')](respondWithResult(_0x21dceb,null))['catch'](handleError(_0x21dceb,null));};exports[_0x8eb1('0x76')]=function(_0x594268,_0x4e0c85,_0x4c4f2c){return db[_0x8eb1('0x56')]['find']({'where':{'id':_0x594268['params']['id']}})[_0x8eb1('0x21')](handleEntityNotFound(_0x4e0c85,null))[_0x8eb1('0x21')](function(_0x8c30a9){if(_0x8c30a9){return _0x8c30a9[_0x8eb1('0x76')](_0x594268[_0x8eb1('0x45')]['ids'])[_0x8eb1('0x21')](function(){if(_[_0x8eb1('0x77')](_0x594268[_0x8eb1('0x45')][_0x8eb1('0x70')])){for(var _0x147389=0x0;_0x147389<_0x594268[_0x8eb1('0x45')][_0x8eb1('0x70')][_0x8eb1('0x4b')];_0x147389+=0x1){socket[_0x8eb1('0x74')](_0x8eb1('0x78'),{'UserId':Number(_0x594268[_0x8eb1('0x45')][_0x8eb1('0x70')][_0x147389]),'WhatsappAccountId':Number(_0x594268[_0x8eb1('0x5c')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x594268['query'][_0x8eb1('0x70')]),'WhatsappAccountId':Number(_0x594268[_0x8eb1('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x4e0c85,null))[_0x8eb1('0x2b')](handleError(_0x4e0c85,null));};exports[_0x8eb1('0x79')]=function(_0x4e6829,_0x246bc1,_0xd0a6c7){var _0x2c3369={};var _0x5d6eef={};var _0x5dbc1b;var _0x437fe2;return db['WhatsappAccount']['findOne']({'where':{'id':_0x4e6829['params']['id']}})[_0x8eb1('0x21')](handleEntityNotFound(_0x246bc1,null))['then'](function(_0x370aaf){if(_0x370aaf){_0x5dbc1b=_0x370aaf;_0x5d6eef[_0x8eb1('0x44')]=_[_0x8eb1('0x46')](db[_0x8eb1('0x7a')][_0x8eb1('0x42')]);_0x5d6eef[_0x8eb1('0x45')]=_[_0x8eb1('0x46')](_0x4e6829[_0x8eb1('0x45')]);_0x5d6eef[_0x8eb1('0x47')]=_['intersection'](_0x5d6eef[_0x8eb1('0x44')],_0x5d6eef[_0x8eb1('0x45')]);_0x2c3369[_0x8eb1('0x49')]=_[_0x8eb1('0x48')](_0x5d6eef['model'],qs[_0x8eb1('0x4a')](_0x4e6829['query'][_0x8eb1('0x4a')]));_0x2c3369['attributes']=_0x2c3369[_0x8eb1('0x49')][_0x8eb1('0x4b')]?_0x2c3369[_0x8eb1('0x49')]:_0x5d6eef[_0x8eb1('0x44')];_0x2c3369['order']=qs[_0x8eb1('0x4f')](_0x4e6829['query'][_0x8eb1('0x4f')]);_0x2c3369['where']=qs['filters'](_[_0x8eb1('0x51')](_0x4e6829[_0x8eb1('0x45')],_0x5d6eef[_0x8eb1('0x47')]));if(_0x4e6829[_0x8eb1('0x45')][_0x8eb1('0x52')]){_0x2c3369['where']=_[_0x8eb1('0x53')](_0x2c3369['where'],{'$or':_[_0x8eb1('0x41')](_0x2c3369[_0x8eb1('0x49')],function(_0x358086){var _0x1d6f4d={};_0x1d6f4d[_0x358086]={'$like':'%'+_0x4e6829['query'][_0x8eb1('0x52')]+'%'};return _0x1d6f4d;})});}_0x2c3369=_[_0x8eb1('0x53')]({},_0x2c3369,_0x4e6829[_0x8eb1('0x55')]);return _0x5dbc1b['getAgents'](_0x2c3369);}})[_0x8eb1('0x21')](function(_0x530b63){if(_0x530b63){_0x437fe2=_0x530b63[_0x8eb1('0x4b')];if(!_0x4e6829[_0x8eb1('0x45')][_0x8eb1('0x4c')](_0x8eb1('0x4d'))){_0x2c3369[_0x8eb1('0x31')]=qs[_0x8eb1('0x31')](_0x4e6829[_0x8eb1('0x45')][_0x8eb1('0x31')]);_0x2c3369[_0x8eb1('0x2f')]=qs['offset'](_0x4e6829['query'][_0x8eb1('0x2f')]);}return _0x5dbc1b[_0x8eb1('0x79')](_0x2c3369);}})[_0x8eb1('0x21')](function(_0x2a970c){if(_0x2a970c){return _0x2a970c?{'count':_0x437fe2,'rows':_0x2a970c}:null;}})[_0x8eb1('0x21')](respondWithResult(_0x246bc1,null))['catch'](handleError(_0x246bc1,null));};exports[_0x8eb1('0x7b')]=function(_0x10bca3,_0x114bd4,_0x913e81){return db[_0x8eb1('0x56')][_0x8eb1('0x6a')]({'where':{'id':_0x10bca3[_0x8eb1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x114bd4,null))[_0x8eb1('0x21')](function(_0x2bb08a){if(_0x2bb08a){return db['sequelize'][_0x8eb1('0x7c')](function(_0x2e5d8a){return db[_0x8eb1('0x7d')][_0x8eb1('0x38')]({'where':{'WhatsappAccountId':_0x10bca3[_0x8eb1('0x5c')]['id']},'transaction':_0x2e5d8a})[_0x8eb1('0x21')](function(_0x2a58bb){var _0x36c557=_[_0x8eb1('0x41')](_0x10bca3[_0x8eb1('0x66')],function(_0xee77e9){_0xee77e9['WhatsappAccountId']=_0x10bca3['params']['id'];return _0xee77e9;});return db[_0x8eb1('0x7d')][_0x8eb1('0x7e')](_0x36c557,{'transaction':_0x2e5d8a});});})[_0x8eb1('0x21')](function(){return db[_0x8eb1('0x7d')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x10bca3[_0x8eb1('0x5c')]['id']},'order':_0x8eb1('0x7f')});});}})[_0x8eb1('0x21')](respondWithResult(_0x114bd4,null))[_0x8eb1('0x2b')](handleError(_0x114bd4,null));};exports['getApplications']=function(_0x4c7b3b,_0x591e94,_0x58acb4){var _0x52b707={};var _0x1a99a1={};var _0x33560e;var _0x2a3906;return db[_0x8eb1('0x56')][_0x8eb1('0x6a')]({'where':{'id':_0x4c7b3b['params']['id']}})[_0x8eb1('0x21')](handleEntityNotFound(_0x591e94,null))[_0x8eb1('0x21')](function(_0x57045e){if(_0x57045e){_0x33560e=_0x57045e;_0x1a99a1[_0x8eb1('0x44')]=_['keys'](db[_0x8eb1('0x7d')][_0x8eb1('0x42')]);_0x1a99a1[_0x8eb1('0x45')]=_[_0x8eb1('0x46')](_0x4c7b3b[_0x8eb1('0x45')]);_0x1a99a1[_0x8eb1('0x47')]=_[_0x8eb1('0x48')](_0x1a99a1[_0x8eb1('0x44')],_0x1a99a1[_0x8eb1('0x45')]);_0x52b707[_0x8eb1('0x49')]=_[_0x8eb1('0x48')](_0x1a99a1[_0x8eb1('0x44')],qs[_0x8eb1('0x4a')](_0x4c7b3b[_0x8eb1('0x45')][_0x8eb1('0x4a')]));_0x52b707[_0x8eb1('0x49')]=_0x52b707[_0x8eb1('0x49')][_0x8eb1('0x4b')]?_0x52b707['attributes']:_0x1a99a1[_0x8eb1('0x44')];_0x52b707['order']=qs[_0x8eb1('0x4f')](_0x4c7b3b[_0x8eb1('0x45')]['sort']);_0x52b707[_0x8eb1('0x50')]=qs[_0x8eb1('0x47')](_[_0x8eb1('0x51')](_0x4c7b3b[_0x8eb1('0x45')],_0x1a99a1['filters']));if(_0x4c7b3b['query'][_0x8eb1('0x52')]){_0x52b707[_0x8eb1('0x50')]=_[_0x8eb1('0x53')](_0x52b707[_0x8eb1('0x50')],{'$or':_[_0x8eb1('0x41')](_0x52b707[_0x8eb1('0x49')],function(_0x3839d4){var _0x37a178={};_0x37a178[_0x3839d4]={'$like':'%'+_0x4c7b3b[_0x8eb1('0x45')][_0x8eb1('0x52')]+'%'};return _0x37a178;})});}_0x52b707=_[_0x8eb1('0x53')]({},_0x52b707,_0x4c7b3b['options']);return _0x33560e['getApplications'](_0x52b707);}})['then'](function(_0x29fe8a){if(_0x29fe8a){_0x2a3906=_0x29fe8a['length'];if(!_0x4c7b3b[_0x8eb1('0x45')]['hasOwnProperty'](_0x8eb1('0x4d'))){_0x52b707[_0x8eb1('0x31')]=qs[_0x8eb1('0x31')](_0x4c7b3b[_0x8eb1('0x45')]['limit']);_0x52b707['offset']=qs[_0x8eb1('0x2f')](_0x4c7b3b[_0x8eb1('0x45')][_0x8eb1('0x2f')]);}return _0x33560e[_0x8eb1('0x80')](_0x52b707);}})['then'](function(_0x10f134){if(_0x10f134){return _0x10f134?{'count':_0x2a3906,'rows':_0x10f134}:null;}})['then'](respondWithResult(_0x591e94,null))['catch'](handleError(_0x591e94,null));};exports[_0x8eb1('0x81')]=function(_0x48ad4e,_0x1b7829,_0x1733c5){var _0x1807ef={'channel':_0x8eb1('0x82')};var _0xe9f868=[];var _0x10cef3=[];var _0x24b6ae={};return db[_0x8eb1('0x56')][_0x8eb1('0x62')]({'where':{'id':_0x48ad4e[_0x8eb1('0x5c')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x8eb1('0x83')}]})[_0x8eb1('0x21')](handleEntityNotFound(_0x1b7829,null))[_0x8eb1('0x21')](function(_0x18611d){_0x1807ef[_0x8eb1('0x84')]=_0x18611d;_0x1807ef[_0x8eb1('0x85')]=_['orderBy'](_0x18611d[_0x8eb1('0x83')],[_0x8eb1('0x7f')],['asc']);if(_0x1807ef[_0x8eb1('0x84')][_0x8eb1('0x83')]){delete _0x1807ef[_0x8eb1('0x84')][_0x8eb1('0x83')];}return db[_0x8eb1('0x86')]['describe']();})[_0x8eb1('0x21')](function(_0x4afbd0){if(!_0x4afbd0){throw new db[(_0x8eb1('0x87'))][(_0x8eb1('0x88'))](_0x8eb1('0x89'));}_0xe9f868=_[_0x8eb1('0x8a')](_['keys'](_0x4afbd0),[_0x8eb1('0x8b'),_0x8eb1('0x8c')]);_0x10cef3=_[_0x8eb1('0x8a')](_['keys'](_0x4afbd0),[_0x8eb1('0x8b'),_0x8eb1('0x8c'),_0x8eb1('0x8d'),_0x8eb1('0x8e')]);_0x1807ef[_0x8eb1('0x66')]={'mapKey':_0x8eb1('0x8f')};if(_0x1807ef[_0x8eb1('0x84')][_0x8eb1('0x43')]&&_0x1807ef[_0x8eb1('0x84')][_0x8eb1('0x43')]===_0x8eb1('0x90')){_0x1807ef[_0x8eb1('0x66')][_0x8eb1('0x91')]=_0x48ad4e[_0x8eb1('0x66')][_0x8eb1('0x92')][_0x8eb1('0x93')](_0x8eb1('0x94'),'');_0x1807ef[_0x8eb1('0x66')][_0x8eb1('0x66')]=_0x48ad4e[_0x8eb1('0x66')][_0x8eb1('0x95')];_0x1807ef[_0x8eb1('0x66')]['messageId']=_0x48ad4e[_0x8eb1('0x66')][_0x8eb1('0x96')];}if(_0x1807ef[_0x8eb1('0x66')]['id']){delete _0x1807ef[_0x8eb1('0x66')]['id'];}if(_[_0x8eb1('0x97')](_0x1807ef[_0x8eb1('0x66')][_0x8eb1('0x91')])){throw new db[(_0x8eb1('0x87'))][(_0x8eb1('0x88'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x1807ef[_0x8eb1('0x66')]['body'])||_0x1807ef['body'][_0x8eb1('0x66')]===''){throw new db[(_0x8eb1('0x87'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8eb1('0x97')](_0x1807ef[_0x8eb1('0x66')][_0x8eb1('0x98')])){throw new db['Sequelize'][(_0x8eb1('0x88'))](_0x8eb1('0x99')+_0x10cef3);}if(!_[_0x8eb1('0x9a')](_0x10cef3,_0x1807ef[_0x8eb1('0x66')]['mapKey'])){throw new db['Sequelize'][(_0x8eb1('0x88'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x10cef3);}_0x24b6ae[_0x1807ef[_0x8eb1('0x66')]['mapKey']]=_0x1807ef[_0x8eb1('0x66')]['from'];return db['CmList']['find']({'where':{'id':_0x1807ef[_0x8eb1('0x84')][_0x8eb1('0x8e')]},'include':[{'model':db['CmContact'],'as':_0x8eb1('0x9b'),'where':_0x24b6ae,'limit':0x1,'order':[[_0x8eb1('0x8c'),_0x8eb1('0x9c')]]}]});})[_0x8eb1('0x21')](handleEntityNotFound(_0x1b7829,null))['then'](function(_0x414dc2){if(_0x414dc2){_0x1807ef[_0x8eb1('0x9d')]=_['omit'](_0x414dc2,['Contacts']);if(_0x414dc2[_0x8eb1('0x9b')][_0x8eb1('0x4b')]){return _0x414dc2[_0x8eb1('0x9b')][0x0];}var _0x4f3278=_[_0x8eb1('0x19')](_0x1807ef[_0x8eb1('0x66')],{'firstName':_0x1807ef[_0x8eb1('0x66')][_0x8eb1('0x91')],'ListId':_0x414dc2['id']});_0x4f3278[_0x1807ef['body'][_0x8eb1('0x98')]]=_0x1807ef[_0x8eb1('0x66')]['from'];return db[_0x8eb1('0x86')][_0x8eb1('0x64')](_0x4f3278,{'fields':_0xe9f868,'raw':!![]});}})['then'](handleEntityNotFound(_0x1b7829,null))['then'](function(_0x47ca97){if(_0x47ca97){_0x1807ef[_0x8eb1('0x9e')]=_0x47ca97;var _0xc0932b={'ContactId':_0x47ca97['id'],'phone':_0x1807ef['body'][_0x8eb1('0x91')],'WhatsappAccountId':_0x48ad4e[_0x8eb1('0x5c')]['id']};var _0x421fea={'ContactId':_0x47ca97['id'],'WhatsappAccountId':_0x48ad4e[_0x8eb1('0x5c')]['id'],'closed':![]};return db[_0x8eb1('0x9f')][_0x8eb1('0x62')]({'where':_0x421fea})[_0x8eb1('0x21')](function(_0x40aaa9){if(_0x40aaa9){return[_0x40aaa9,![]];}return db[_0x8eb1('0x9f')][_0x8eb1('0x64')](_0xc0932b)[_0x8eb1('0x21')](function(_0x5063f4){return[_0x5063f4,!![]];});});}})[_0x8eb1('0x73')](function(_0x2bc514,_0x1461a5){_0x1807ef[_0x8eb1('0xa0')]=_0x2bc514[_0x8eb1('0x5d')]({'plain':!![]});_0x1807ef[_0x8eb1('0xa0')][_0x8eb1('0xa1')]=![];if(_0x1461a5){if(_0x1807ef[_0x8eb1('0x84')][_0x8eb1('0xa2')]){_0x1807ef[_0x8eb1('0x85')]['push']({'id':0x0,'priority':_0x1807ef[_0x8eb1('0x85')][_0x8eb1('0x4b')]+0x1,'app':_0x8eb1('0xa3'),'appdata':_0x8eb1('0xa4'),'interval':_0x8eb1('0xa5')});}_0x1807ef[_0x8eb1('0xa0')]['created']=!![];}return db[_0x8eb1('0xa6')]['create']({'phone':_0x1807ef['body'][_0x8eb1('0x91')],'messageId':_0x1807ef['body'][_0x8eb1('0xa7')],'body':_0x1807ef[_0x8eb1('0x66')][_0x8eb1('0x66')],'WhatsappAccountId':_0x48ad4e[_0x8eb1('0x5c')]['id'],'WhatsappInteractionId':_0x2bc514['id'],'direction':'in','ContactId':_0x2bc514[_0x8eb1('0xa8')],'AttachmentId':_0x1807ef[_0x8eb1('0x66')][_0x8eb1('0xa9')]});})[_0x8eb1('0x21')](function(_0x2b40b8){_0x1807ef[_0x8eb1('0x2a')]=_0x2b40b8;if(_0x1807ef[_0x8eb1('0xa0')][_0x8eb1('0xaa')]){return db['User'][_0x8eb1('0x62')]({'attributes':['id',_0x8eb1('0x3d')],'where':{'id':_0x1807ef[_0x8eb1('0xa0')][_0x8eb1('0xaa')]}})['then'](function(_0x562c1a){if(_0x562c1a){_0x1807ef[_0x8eb1('0x85')][_0x8eb1('0xab')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x562c1a[_0x8eb1('0x3d')]+','+(_0x1807ef[_0x8eb1('0x84')][_0x8eb1('0xac')]||0xa),'interval':_0x8eb1('0xa5')});}return respondWithRpcPromise(_0x8eb1('0xad'),_0x8eb1('0xae'),_0x1807ef);});}return respondWithRpcPromise(_0x8eb1('0xad'),_0x8eb1('0xae'),_0x1807ef);})['then'](function(_0x5ca2a5){if(_0x5ca2a5){var _0x1ff2f5=0xc8;var _0x17007d=_0x8eb1('0xaf');logger[_0x8eb1('0x22')](_0x8eb1('0x26'),_0x17007d,_0x1ff2f5,_0x8eb1('0xb0'));logger[_0x8eb1('0x25')](_0x8eb1('0xb1'),_0x17007d,_0x1ff2f5,_0x8eb1('0xb0'),JSON[_0x8eb1('0x27')](_0x5ca2a5));if(_0x1807ef['account'][_0x8eb1('0x43')]===_0x8eb1('0x90')){return _0x1b7829['status'](_0x1ff2f5)[_0x8eb1('0x33')](_0x8eb1('0xb2'),_0x8eb1('0xb3'))[_0x8eb1('0xb4')](_0x8eb1('0xb5'));}else{return _0x1b7829[_0x8eb1('0x2c')](_0x1ff2f5)[_0x8eb1('0x2e')](_0x5ca2a5);}}})[_0x8eb1('0x2b')](handleError(_0x1b7829,null));};exports[_0x8eb1('0xb4')]=function(_0x33d2bc,_0x398fb8,_0x320ff1){var _0x23fa71,_0x5d21ca,_0x59e2ff;if(_[_0x8eb1('0x97')](_0x33d2bc[_0x8eb1('0x66')][_0x8eb1('0x66')])||_0x33d2bc['body'][_0x8eb1('0x66')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8eb1('0x97')](_0x33d2bc['body']['to'])){throw new db[(_0x8eb1('0x87'))][(_0x8eb1('0x88'))]('to\x20is\x20mandatory');}_0x23fa71=_0x33d2bc['body']['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x33d2bc[_0x8eb1('0x5c')]['id']},'include':[{'model':db[_0x8eb1('0xb6')],'as':'List','include':[{'model':db['CmContact'],'as':_0x8eb1('0x9b'),'where':{'mobile':_0x23fa71},'limit':0x1,'order':[[_0x8eb1('0x8c'),_0x8eb1('0x9c')]]}]}]})[_0x8eb1('0x21')](handleEntityNotFound(_0x398fb8,null))[_0x8eb1('0x21')](function(_0x2721de){if(_0x2721de&&_0x2721de[_0x8eb1('0xb7')]){_0x5d21ca=_0x2721de[_0x8eb1('0x5d')]({'plain':!![]});if(_0x5d21ca[_0x8eb1('0xb7')]&&_0x5d21ca['List'][_0x8eb1('0x9b')][_0x8eb1('0x4b')]){return _0x5d21ca[_0x8eb1('0xb7')][_0x8eb1('0x9b')][0x0];}return db[_0x8eb1('0x86')][_0x8eb1('0x64')](_[_0x8eb1('0x19')](_0x33d2bc[_0x8eb1('0x66')],{'firstName':_0x23fa71,'mobile':_0x23fa71,'phone':_0x23fa71,'ListId':_0x5d21ca[_0x8eb1('0x8e')]}));}})[_0x8eb1('0x21')](handleEntityNotFound(_0x398fb8,null))['then'](function(_0x256b60){if(_0x256b60){_0x59e2ff=_0x256b60;return db[_0x8eb1('0x9f')][_0x8eb1('0x62')]({'where':{'ContactId':_0x59e2ff['id'],'closed':![],'WhatsappAccountId':_0x5d21ca['id']}})[_0x8eb1('0x21')](function(_0x25a146){if(_0x25a146){return[_0x25a146,![]];}return db[_0x8eb1('0x9f')][_0x8eb1('0x64')]({'UserId':_0x33d2bc[_0x8eb1('0x60')]['id'],'ContactId':_0x59e2ff['id'],'WhatsappAccountId':_0x5d21ca['id'],'phone':_0x23fa71,'firstMsgDirection':_0x8eb1('0xb8'),'Messages':[_[_0x8eb1('0x53')](_0x33d2bc[_0x8eb1('0x66')],{'read':![],'body':_0x33d2bc[_0x8eb1('0x66')][_0x8eb1('0x66')],'phone':_0x23fa71,'WhatsappAccountId':_0x5d21ca['id'],'UserId':_0x33d2bc['user']['id'],'ContactId':_0x59e2ff['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x8eb1('0xb9')}]})[_0x8eb1('0x21')](function(_0x587fc9){return[_0x587fc9,!![]];});});}})['spread'](function(_0xed0286,_0x16b211){if(_0x16b211){return _0xed0286;}return db[_0x8eb1('0xa6')][_0x8eb1('0x64')](_['merge'](_0x33d2bc[_0x8eb1('0x66')],{'read':![],'body':_0x33d2bc[_0x8eb1('0x66')][_0x8eb1('0x66')],'phone':_0x23fa71,'WhatsappAccountId':_0x5d21ca['id'],'WhatsappInteractionId':_0xed0286['id'],'UserId':_0x33d2bc[_0x8eb1('0x60')]['id'],'ContactId':_0x59e2ff['id']}))['then'](function(_0x3faf96){_0xed0286[_0x8eb1('0xba')]['Messages']=[];_0xed0286[_0x8eb1('0xba')][_0x8eb1('0xb9')][_0x8eb1('0xbb')](_0x3faf96['dataValues']);return _0xed0286;});})[_0x8eb1('0x21')](respondWithResult(_0x398fb8,null))[_0x8eb1('0x2b')](handleError(_0x398fb8,null));}; \ No newline at end of file +var _0x79a1=['count','includeAll','include','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','mandatoryDispositionPause','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','order','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','Applications','applications','orderBy','priority','asc','account','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','messageId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','CmContact','DESC','list','Contacts','contact','from','WhatsappInteraction','interaction','created','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','to\x20is\x20mandatory','List','WhatsappMessage','Messages','spread','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise','http','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','options'];(function(_0x5aab92,_0x193292){var _0x5258bb=function(_0x1ae533){while(--_0x1ae533){_0x5aab92['push'](_0x5aab92['shift']());}};_0x5258bb(++_0x193292);}(_0x79a1,0x123));var _0x179a=function(_0x15675a,_0x3be638){_0x15675a=_0x15675a-0x0;var _0x391662=_0x79a1[_0x15675a];return _0x391662;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x179a('0x0'));var zipdir=require(_0x179a('0x1'));var jsonpatch=require(_0x179a('0x2'));var rp=require(_0x179a('0x3'));var moment=require(_0x179a('0x4'));var BPromise=require(_0x179a('0x5'));var Mustache=require(_0x179a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x179a('0x7'));var csv=require(_0x179a('0x8'));var ejs=require(_0x179a('0x9'));var fs=require('fs');var fs_extra=require(_0x179a('0xa'));var _=require(_0x179a('0xb'));var squel=require('squel');var crypto=require(_0x179a('0xc'));var jsforce=require(_0x179a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x179a('0x8'));var querystring=require(_0x179a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x179a('0xf'));var qs=require(_0x179a('0x10'));var as=require(_0x179a('0x11'));var hardwareService=require(_0x179a('0x12'));var logger=require('../../config/logger')(_0x179a('0x13'));var utils=require(_0x179a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x179a('0x15'));var db=require(_0x179a('0x16'))['db'];config[_0x179a('0x17')]=_[_0x179a('0x18')](config[_0x179a('0x17')],{'host':_0x179a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x179a('0x17')]));require(_0x179a('0x1a'))[_0x179a('0x1b')](socket);var jayson=require(_0x179a('0x1c'));var client=jayson['client'][_0x179a('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x2b3480,_0x21740f,_0x4fc590,_0x55d2d0){return new BPromise(function(_0x1a2107,_0x1a2547){var _0x441a38=_0x55d2d0||client;return _0x441a38['request'](_0x2b3480,_0x4fc590)['then'](function(_0x57c9a3){logger[_0x179a('0x1e')](_0x179a('0x1f'),_0x21740f,_0x179a('0x20'));logger[_0x179a('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x21740f,_0x179a('0x20'),JSON['stringify'](_0x57c9a3));if(_0x57c9a3[_0x179a('0x22')]){if(_0x57c9a3[_0x179a('0x22')]['code']===0x1f4){logger[_0x179a('0x22')](_0x179a('0x1f'),_0x21740f,_0x57c9a3[_0x179a('0x22')][_0x179a('0x23')]);return _0x1a2547(_0x57c9a3[_0x179a('0x22')][_0x179a('0x23')]);}logger[_0x179a('0x22')](_0x179a('0x1f'),_0x21740f,_0x57c9a3['error']['message']);return _0x1a2107(_0x57c9a3[_0x179a('0x22')][_0x179a('0x23')]);}else{logger[_0x179a('0x1e')](_0x179a('0x1f'),_0x21740f,_0x179a('0x20'));_0x1a2107(_0x57c9a3[_0x179a('0x24')][_0x179a('0x23')]);}})[_0x179a('0x25')](function(_0x325a59){logger[_0x179a('0x22')](_0x179a('0x1f'),_0x21740f,_0x325a59);_0x1a2547(_0x325a59);});});}function respondWithStatusCode(_0x447d77,_0x219adf){_0x219adf=_0x219adf||0xcc;return function(_0x17f624){if(_0x17f624){return _0x447d77[_0x179a('0x26')](_0x219adf);}return _0x447d77[_0x179a('0x27')](_0x219adf)[_0x179a('0x28')]();};}function respondWithResult(_0x3135d1,_0x41773c){_0x41773c=_0x41773c||0xc8;return function(_0x27882f){if(_0x27882f){return _0x3135d1[_0x179a('0x27')](_0x41773c)[_0x179a('0x29')](_0x27882f);}};}function respondWithFilteredResult(_0x174680,_0x7e9a2b){return function(_0xd11cc0){if(_0xd11cc0){var _0x3de939=typeof _0x7e9a2b[_0x179a('0x2a')]===_0x179a('0x2b')&&typeof _0x7e9a2b[_0x179a('0x2c')]===_0x179a('0x2b');var _0xe226df=_0xd11cc0['count'];var _0x2e1b20=_0x3de939?0x0:_0x7e9a2b['offset'];var _0x49c2ab=_0x3de939?_0xd11cc0['count']:_0x7e9a2b['offset']+_0x7e9a2b[_0x179a('0x2c')];var _0x182d8d;if(_0x49c2ab>=_0xe226df){_0x49c2ab=_0xe226df;_0x182d8d=0xc8;}else{_0x182d8d=0xce;}_0x174680[_0x179a('0x27')](_0x182d8d);return _0x174680[_0x179a('0x2d')](_0x179a('0x2e'),_0x2e1b20+'-'+_0x49c2ab+'/'+_0xe226df)['json'](_0xd11cc0);}return null;};}function patchUpdates(_0x51c63c){return function(_0x188537){try{jsonpatch['apply'](_0x188537,_0x51c63c,!![]);}catch(_0x20f3ca){return BPromise[_0x179a('0x2f')](_0x20f3ca);}return _0x188537[_0x179a('0x30')]();};}function saveUpdates(_0x571114,_0x36c101){return function(_0x1739eb){if(_0x1739eb){return _0x1739eb[_0x179a('0x31')](_0x571114)[_0x179a('0x32')](function(_0x5a824b){return _0x5a824b;});}return null;};}function removeEntity(_0x5816d5,_0x19c1c4){return function(_0x136523){if(_0x136523){return _0x136523[_0x179a('0x33')]()[_0x179a('0x32')](function(){var _0x39080e=_0x136523['get']({'plain':!![]});var _0xb97ba7=_0x179a('0x34');return db[_0x179a('0x35')][_0x179a('0x33')]({'where':{'type':_0xb97ba7,'resourceId':_0x39080e['id']}})['then'](function(){return _0x136523;});})[_0x179a('0x32')](function(){_0x5816d5[_0x179a('0x27')](0xcc)[_0x179a('0x28')]();});}};}function handleEntityNotFound(_0x4eea4a,_0x87dbc0){return function(_0x111ae6){if(!_0x111ae6){_0x4eea4a[_0x179a('0x26')](0x194);}return _0x111ae6;};}function handleError(_0x3ca787,_0x2b16f8){_0x2b16f8=_0x2b16f8||0x1f4;return function(_0x311c21){logger[_0x179a('0x22')](_0x311c21[_0x179a('0x36')]);if(_0x311c21[_0x179a('0x37')]){delete _0x311c21[_0x179a('0x37')];}_0x3ca787[_0x179a('0x27')](_0x2b16f8)[_0x179a('0x38')](_0x311c21);};}exports[_0x179a('0x39')]=function(_0x55878e,_0x520f4b){var _0x2f36d0={'include':[{'model':db[_0x179a('0x3a')],'as':'mandatoryDispositionPause'}]},_0x4801f8={},_0x1040b6={'count':0x0,'rows':[]};var _0x5a126c=_['map'](db[_0x179a('0x3b')][_0x179a('0x3c')],function(_0x2620b1){return{'name':_0x2620b1[_0x179a('0x3d')],'type':_0x2620b1[_0x179a('0x3e')][_0x179a('0x3f')]};});_0x4801f8[_0x179a('0x40')]=_['map'](_0x5a126c,_0x179a('0x37'));_0x4801f8[_0x179a('0x41')]=_[_0x179a('0x42')](_0x55878e['query']);_0x4801f8[_0x179a('0x43')]=_[_0x179a('0x44')](_0x4801f8[_0x179a('0x40')],_0x4801f8[_0x179a('0x41')]);_0x2f36d0[_0x179a('0x45')]=_[_0x179a('0x44')](_0x4801f8[_0x179a('0x40')],qs[_0x179a('0x46')](_0x55878e['query'][_0x179a('0x46')]));_0x2f36d0[_0x179a('0x45')]=_0x2f36d0[_0x179a('0x45')]['length']?_0x2f36d0[_0x179a('0x45')]:_0x4801f8[_0x179a('0x40')];if(!_0x55878e[_0x179a('0x41')][_0x179a('0x47')](_0x179a('0x48'))){_0x2f36d0[_0x179a('0x2c')]=qs[_0x179a('0x2c')](_0x55878e[_0x179a('0x41')][_0x179a('0x2c')]);_0x2f36d0[_0x179a('0x2a')]=qs[_0x179a('0x2a')](_0x55878e[_0x179a('0x41')]['offset']);}_0x2f36d0['order']=qs[_0x179a('0x49')](_0x55878e[_0x179a('0x41')][_0x179a('0x49')]);_0x2f36d0[_0x179a('0x4a')]=qs['filters'](_[_0x179a('0x4b')](_0x55878e['query'],_0x4801f8[_0x179a('0x43')]),_0x5a126c);if(_0x55878e[_0x179a('0x41')][_0x179a('0x4c')]){_0x2f36d0['where']=_['merge'](_0x2f36d0[_0x179a('0x4a')],{'$or':_[_0x179a('0x4d')](_0x5a126c,function(_0x58de1e){if(_0x58de1e['type']!==_0x179a('0x4e')){var _0x10fc6f={};_0x10fc6f[_0x58de1e[_0x179a('0x37')]]={'$like':'%'+_0x55878e[_0x179a('0x41')]['filter']+'%'};return _0x10fc6f;}})});}_0x2f36d0=_[_0x179a('0x4f')]({},_0x2f36d0,_0x55878e[_0x179a('0x50')]);var _0x319805={'where':_0x2f36d0[_0x179a('0x4a')]};return db['WhatsappAccount'][_0x179a('0x51')](_0x319805)[_0x179a('0x32')](function(_0x373ff9){_0x1040b6[_0x179a('0x51')]=_0x373ff9;if(_0x55878e[_0x179a('0x41')][_0x179a('0x52')]){_0x2f36d0[_0x179a('0x53')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x2f36d0);})[_0x179a('0x32')](function(_0x3ba6e3){_0x1040b6['rows']=_0x3ba6e3;return _0x1040b6;})[_0x179a('0x32')](respondWithFilteredResult(_0x520f4b,_0x2f36d0))[_0x179a('0x25')](handleError(_0x520f4b,null));};exports[_0x179a('0x54')]=function(_0x4a4a22,_0xc9f12a){var _0xe5f059={'raw':![],'where':{'id':_0x4a4a22[_0x179a('0x55')]['id']},'include':[{'model':db[_0x179a('0x3a')],'as':'mandatoryDispositionPause'}]},_0xd8993b={};_0xd8993b[_0x179a('0x40')]=_[_0x179a('0x42')](db[_0x179a('0x3b')][_0x179a('0x3c')]);_0xd8993b['query']=_[_0x179a('0x42')](_0x4a4a22[_0x179a('0x41')]);_0xd8993b[_0x179a('0x43')]=_[_0x179a('0x44')](_0xd8993b['model'],_0xd8993b[_0x179a('0x41')]);_0xe5f059[_0x179a('0x45')]=_['intersection'](_0xd8993b[_0x179a('0x40')],qs[_0x179a('0x46')](_0x4a4a22[_0x179a('0x41')][_0x179a('0x46')]));_0xe5f059['attributes']=_0xe5f059[_0x179a('0x45')][_0x179a('0x56')]?_0xe5f059[_0x179a('0x45')]:_0xd8993b[_0x179a('0x40')];if(_0x4a4a22['query'][_0x179a('0x52')]){_0xe5f059['include']=[{'all':!![]}];}_0xe5f059=_['merge']({},_0xe5f059,_0x4a4a22[_0x179a('0x50')]);return db[_0x179a('0x3b')][_0x179a('0x57')](_0xe5f059)['then'](handleEntityNotFound(_0xc9f12a,null))[_0x179a('0x32')](respondWithResult(_0xc9f12a,null))[_0x179a('0x25')](handleError(_0xc9f12a,null));};exports[_0x179a('0x58')]=function(_0x138936,_0x5241d3){return db[_0x179a('0x3b')][_0x179a('0x58')](_0x138936['body'],{})['then'](function(_0x57f47a){var _0x4189d9=_0x138936[_0x179a('0x59')]['get']({'plain':!![]});if(!_0x4189d9)throw new Error(_0x179a('0x5a'));if(_0x4189d9['role']===_0x179a('0x59')){var _0x2f0c17=_0x57f47a[_0x179a('0x5b')]({'plain':!![]});var _0x32db42=_0x179a('0x34');return db[_0x179a('0x5c')][_0x179a('0x57')]({'where':{'name':_0x32db42,'userProfileId':_0x4189d9[_0x179a('0x5d')]},'raw':!![]})[_0x179a('0x32')](function(_0x426bce){if(_0x426bce&&_0x426bce[_0x179a('0x5e')]===0x0){return db[_0x179a('0x35')][_0x179a('0x58')]({'name':_0x2f0c17[_0x179a('0x37')],'resourceId':_0x2f0c17['id'],'type':_0x426bce[_0x179a('0x37')],'sectionId':_0x426bce['id']},{})[_0x179a('0x32')](function(){return _0x57f47a;});}else{return _0x57f47a;}})[_0x179a('0x25')](function(_0x52f154){logger[_0x179a('0x22')](_0x179a('0x5f'),_0x52f154);throw _0x52f154;});}return _0x57f47a;})['then'](respondWithResult(_0x5241d3,0xc9))[_0x179a('0x25')](handleError(_0x5241d3,null));};exports[_0x179a('0x31')]=function(_0x83e4ad,_0x58f79c){if(_0x83e4ad[_0x179a('0x60')]['id']){delete _0x83e4ad[_0x179a('0x60')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x83e4ad['params']['id']},'include':[{'model':db[_0x179a('0x3a')],'as':_0x179a('0x61')}]})[_0x179a('0x32')](handleEntityNotFound(_0x58f79c,null))['then'](saveUpdates(_0x83e4ad[_0x179a('0x60')],null))[_0x179a('0x32')](respondWithResult(_0x58f79c,null))['catch'](handleError(_0x58f79c,null));};exports[_0x179a('0x33')]=function(_0x513c91,_0x998d87){return db[_0x179a('0x3b')][_0x179a('0x57')]({'where':{'id':_0x513c91[_0x179a('0x55')]['id']}})[_0x179a('0x32')](handleEntityNotFound(_0x998d87,null))[_0x179a('0x32')](removeEntity(_0x998d87,null))[_0x179a('0x25')](handleError(_0x998d87,null));};exports['describe']=function(_0xe17f7d,_0x47972c){return db['WhatsappAccount']['describe']()[_0x179a('0x32')](respondWithResult(_0x47972c,null))[_0x179a('0x25')](handleError(_0x47972c,null));};exports[_0x179a('0x62')]=function(_0x180df6,_0x403188,_0x70f4b3){if(_0x180df6[_0x179a('0x60')]['id']){delete _0x180df6[_0x179a('0x60')]['id'];}return db[_0x179a('0x3b')][_0x179a('0x57')]({'where':{'id':_0x180df6['params']['id']}})[_0x179a('0x32')](handleEntityNotFound(_0x403188,null))[_0x179a('0x32')](function(_0x152e83){if(_0x152e83){_0x180df6[_0x179a('0x60')][_0x179a('0x63')]=_0x152e83['id'];return db[_0x179a('0x64')][_0x179a('0x58')](_0x180df6[_0x179a('0x60')]);}})[_0x179a('0x32')](respondWithResult(_0x403188,null))[_0x179a('0x25')](handleError(_0x403188,null));};exports[_0x179a('0x65')]=function(_0x2d5b90,_0xf5017a,_0x49b78f){var _0x2a50ad={'raw':![],'where':{}};var _0x2a265f={};var _0x447af6={'count':0x0,'rows':[]};return db[_0x179a('0x3b')][_0x179a('0x66')]({'where':{'id':_0x2d5b90[_0x179a('0x55')]['id']}})[_0x179a('0x32')](handleEntityNotFound(_0xf5017a,null))['then'](function(_0x5f18b7){if(_0x5f18b7){_0x2a265f[_0x179a('0x40')]=_['keys'](db[_0x179a('0x64')][_0x179a('0x3c')]);_0x2a265f['query']=_[_0x179a('0x42')](_0x2d5b90[_0x179a('0x41')]);_0x2a265f['filters']=_['intersection'](_0x2a265f[_0x179a('0x40')],_0x2a265f[_0x179a('0x41')]);_0x2a50ad['attributes']=_[_0x179a('0x44')](_0x2a265f[_0x179a('0x40')],qs['fields'](_0x2d5b90[_0x179a('0x41')]['fields']));_0x2a50ad[_0x179a('0x45')]=_0x2a50ad[_0x179a('0x45')][_0x179a('0x56')]?_0x2a50ad[_0x179a('0x45')]:_0x2a265f[_0x179a('0x40')];if(!_0x2d5b90[_0x179a('0x41')][_0x179a('0x47')](_0x179a('0x48'))){_0x2a50ad[_0x179a('0x2c')]=qs[_0x179a('0x2c')](_0x2d5b90[_0x179a('0x41')][_0x179a('0x2c')]);_0x2a50ad['offset']=qs['offset'](_0x2d5b90[_0x179a('0x41')][_0x179a('0x2a')]);}_0x2a50ad[_0x179a('0x67')]=qs[_0x179a('0x49')](_0x2d5b90[_0x179a('0x41')][_0x179a('0x49')]);_0x2a50ad['where']=qs[_0x179a('0x43')](_['pick'](_0x2d5b90['query'],_0x2a265f['filters']));_0x2a50ad[_0x179a('0x4a')][_0x179a('0x63')]=_0x5f18b7['id'];if(_0x2d5b90[_0x179a('0x41')][_0x179a('0x4c')]){_0x2a50ad[_0x179a('0x4a')]=_[_0x179a('0x4f')](_0x2a50ad[_0x179a('0x4a')],{'$or':_[_0x179a('0x4d')](_0x2a50ad[_0x179a('0x45')],function(_0x13ec41){var _0x1dd517={};_0x1dd517[_0x13ec41]={'$like':'%'+_0x2d5b90[_0x179a('0x41')]['filter']+'%'};return _0x1dd517;})});}_0x2a50ad=_['merge']({},_0x2a50ad,_0x2d5b90[_0x179a('0x50')]);return db[_0x179a('0x64')][_0x179a('0x51')]({'where':_0x2a50ad[_0x179a('0x4a')]})[_0x179a('0x32')](function(_0x157f79){_0x447af6[_0x179a('0x51')]=_0x157f79;if(_0x2d5b90[_0x179a('0x41')][_0x179a('0x52')]){_0x2a50ad['include']=[{'all':!![]}];}return db[_0x179a('0x64')]['findAll'](_0x2a50ad);})['then'](function(_0x52eacd){_0x447af6[_0x179a('0x68')]=_0x52eacd;return _0x447af6;});}})['then'](respondWithFilteredResult(_0xf5017a,_0x2a50ad))[_0x179a('0x25')](handleError(_0xf5017a,null));};exports[_0x179a('0x69')]=function(_0x3a15e7,_0x1a577b,_0x52be58){return db[_0x179a('0x3b')]['find']({'where':{'id':_0x3a15e7[_0x179a('0x55')]['id']}})[_0x179a('0x32')](handleEntityNotFound(_0x1a577b,null))[_0x179a('0x32')](function(_0x11ceec){if(_0x11ceec){return _0x11ceec['removeDispositions'](_0x3a15e7[_0x179a('0x41')]['ids']);}})['then'](respondWithStatusCode(_0x1a577b,null))['catch'](handleError(_0x1a577b,null));};exports[_0x179a('0x6a')]=function(_0x1cb667,_0x35099e,_0x39ebc9){if(_0x1cb667[_0x179a('0x60')]['id']){delete _0x1cb667['body']['id'];}return db[_0x179a('0x3b')][_0x179a('0x57')]({'where':{'id':_0x1cb667[_0x179a('0x55')]['id']}})[_0x179a('0x32')](handleEntityNotFound(_0x35099e,null))['then'](function(_0x431bfa){if(_0x431bfa){_0x1cb667[_0x179a('0x60')][_0x179a('0x63')]=_0x431bfa['id'];return db[_0x179a('0x6b')][_0x179a('0x58')](_0x1cb667['body']);}})['then'](respondWithResult(_0x35099e,null))['catch'](handleError(_0x35099e,null));};exports[_0x179a('0x6c')]=function(_0x75dafa,_0x151ab8,_0xc272c6){var _0x41fd26={'raw':![],'where':{}};var _0x45395f={};var _0x33ede4={'count':0x0,'rows':[]};return db[_0x179a('0x3b')]['findOne']({'where':{'id':_0x75dafa[_0x179a('0x55')]['id']}})['then'](handleEntityNotFound(_0x151ab8,null))[_0x179a('0x32')](function(_0x1c8f15){if(_0x1c8f15){_0x45395f[_0x179a('0x40')]=_[_0x179a('0x42')](db[_0x179a('0x6b')][_0x179a('0x3c')]);_0x45395f[_0x179a('0x41')]=_['keys'](_0x75dafa[_0x179a('0x41')]);_0x45395f[_0x179a('0x43')]=_['intersection'](_0x45395f[_0x179a('0x40')],_0x45395f[_0x179a('0x41')]);_0x41fd26[_0x179a('0x45')]=_[_0x179a('0x44')](_0x45395f['model'],qs['fields'](_0x75dafa[_0x179a('0x41')][_0x179a('0x46')]));_0x41fd26['attributes']=_0x41fd26['attributes'][_0x179a('0x56')]?_0x41fd26[_0x179a('0x45')]:_0x45395f['model'];if(!_0x75dafa[_0x179a('0x41')][_0x179a('0x47')]('nolimit')){_0x41fd26['limit']=qs[_0x179a('0x2c')](_0x75dafa[_0x179a('0x41')][_0x179a('0x2c')]);_0x41fd26[_0x179a('0x2a')]=qs[_0x179a('0x2a')](_0x75dafa[_0x179a('0x41')][_0x179a('0x2a')]);}_0x41fd26[_0x179a('0x67')]=qs[_0x179a('0x49')](_0x75dafa[_0x179a('0x41')]['sort']);_0x41fd26['where']=qs[_0x179a('0x43')](_[_0x179a('0x4b')](_0x75dafa['query'],_0x45395f[_0x179a('0x43')]));_0x41fd26['where'][_0x179a('0x63')]=_0x1c8f15['id'];if(_0x75dafa[_0x179a('0x41')][_0x179a('0x4c')]){_0x41fd26[_0x179a('0x4a')]=_[_0x179a('0x4f')](_0x41fd26[_0x179a('0x4a')],{'$or':_[_0x179a('0x4d')](_0x41fd26[_0x179a('0x45')],function(_0x756c49){var _0x72b78f={};_0x72b78f[_0x756c49]={'$like':'%'+_0x75dafa[_0x179a('0x41')][_0x179a('0x4c')]+'%'};return _0x72b78f;})});}_0x41fd26=_['merge']({},_0x41fd26,_0x75dafa[_0x179a('0x50')]);return db['CannedAnswer'][_0x179a('0x51')]({'where':_0x41fd26[_0x179a('0x4a')]})[_0x179a('0x32')](function(_0x569d30){_0x33ede4['count']=_0x569d30;if(_0x75dafa[_0x179a('0x41')][_0x179a('0x52')]){_0x41fd26[_0x179a('0x53')]=[{'all':!![]}];}return db[_0x179a('0x6b')]['findAll'](_0x41fd26);})[_0x179a('0x32')](function(_0x457837){_0x33ede4[_0x179a('0x68')]=_0x457837;return _0x33ede4;});}})[_0x179a('0x32')](respondWithFilteredResult(_0x151ab8,_0x41fd26))[_0x179a('0x25')](handleError(_0x151ab8,null));};exports['removeAnswers']=function(_0x2a6f6f,_0x43fdfb,_0x16b605){return db[_0x179a('0x3b')]['find']({'where':{'id':_0x2a6f6f[_0x179a('0x55')]['id']}})[_0x179a('0x32')](handleEntityNotFound(_0x43fdfb,null))[_0x179a('0x32')](function(_0x218789){if(_0x218789){return _0x218789[_0x179a('0x6d')](_0x2a6f6f[_0x179a('0x41')][_0x179a('0x6e')]);}})['then'](respondWithStatusCode(_0x43fdfb,null))[_0x179a('0x25')](handleError(_0x43fdfb,null));};exports[_0x179a('0x6f')]=function(_0x2e8c7e,_0x2f389e,_0x4e366f){return db[_0x179a('0x3b')][_0x179a('0x57')]({'where':{'id':_0x2e8c7e[_0x179a('0x55')]['id']}})['then'](handleEntityNotFound(_0x2f389e,null))[_0x179a('0x32')](function(_0x4a1ccd){if(_0x4a1ccd){return _0x4a1ccd[_0x179a('0x6f')](_0x2e8c7e[_0x179a('0x60')][_0x179a('0x6e')],_[_0x179a('0x70')](_0x2e8c7e[_0x179a('0x60')],['ids','id'])||{})['spread'](function(_0x86c8fa){for(var _0x44a8ce=0x0;_0x44a8ce<_0x2e8c7e['body'][_0x179a('0x6e')]['length'];_0x44a8ce+=0x1){socket[_0x179a('0x71')](_0x179a('0x72'),{'UserId':Number(_0x2e8c7e[_0x179a('0x60')][_0x179a('0x6e')][_0x44a8ce]),'WhatsappAccountId':Number(_0x2e8c7e[_0x179a('0x55')]['id'])});}return _0x86c8fa;});}})[_0x179a('0x32')](respondWithResult(_0x2f389e,null))['catch'](handleError(_0x2f389e,null));};exports[_0x179a('0x73')]=function(_0x2fa312,_0x110ab6,_0x53f760){return db[_0x179a('0x3b')][_0x179a('0x57')]({'where':{'id':_0x2fa312[_0x179a('0x55')]['id']}})[_0x179a('0x32')](handleEntityNotFound(_0x110ab6,null))['then'](function(_0x1e15e3){if(_0x1e15e3){return _0x1e15e3[_0x179a('0x73')](_0x2fa312[_0x179a('0x41')]['ids'])['then'](function(){if(_[_0x179a('0x74')](_0x2fa312[_0x179a('0x41')][_0x179a('0x6e')])){for(var _0x41e354=0x0;_0x41e354<_0x2fa312[_0x179a('0x41')][_0x179a('0x6e')][_0x179a('0x56')];_0x41e354+=0x1){socket[_0x179a('0x71')]('userWhatsappAccount:remove',{'UserId':Number(_0x2fa312[_0x179a('0x41')][_0x179a('0x6e')][_0x41e354]),'WhatsappAccountId':Number(_0x2fa312[_0x179a('0x55')]['id'])});}}else{socket[_0x179a('0x71')](_0x179a('0x75'),{'UserId':Number(_0x2fa312['query'][_0x179a('0x6e')]),'WhatsappAccountId':Number(_0x2fa312['params']['id'])});}});}})[_0x179a('0x32')](respondWithStatusCode(_0x110ab6,null))[_0x179a('0x25')](handleError(_0x110ab6,null));};exports[_0x179a('0x76')]=function(_0x2dce85,_0x449eb3,_0x1ee81d){var _0x5ca41a={};var _0xaf20d0={};var _0x4c878a;var _0xaac05d;return db[_0x179a('0x3b')][_0x179a('0x66')]({'where':{'id':_0x2dce85[_0x179a('0x55')]['id']}})['then'](handleEntityNotFound(_0x449eb3,null))[_0x179a('0x32')](function(_0x818b1){if(_0x818b1){_0x4c878a=_0x818b1;_0xaf20d0['model']=_['keys'](db[_0x179a('0x77')]['rawAttributes']);_0xaf20d0[_0x179a('0x41')]=_['keys'](_0x2dce85[_0x179a('0x41')]);_0xaf20d0[_0x179a('0x43')]=_['intersection'](_0xaf20d0[_0x179a('0x40')],_0xaf20d0['query']);_0x5ca41a[_0x179a('0x45')]=_[_0x179a('0x44')](_0xaf20d0[_0x179a('0x40')],qs[_0x179a('0x46')](_0x2dce85[_0x179a('0x41')]['fields']));_0x5ca41a[_0x179a('0x45')]=_0x5ca41a[_0x179a('0x45')][_0x179a('0x56')]?_0x5ca41a[_0x179a('0x45')]:_0xaf20d0[_0x179a('0x40')];_0x5ca41a[_0x179a('0x67')]=qs[_0x179a('0x49')](_0x2dce85[_0x179a('0x41')][_0x179a('0x49')]);_0x5ca41a[_0x179a('0x4a')]=qs[_0x179a('0x43')](_[_0x179a('0x4b')](_0x2dce85[_0x179a('0x41')],_0xaf20d0['filters']));if(_0x2dce85[_0x179a('0x41')][_0x179a('0x4c')]){_0x5ca41a[_0x179a('0x4a')]=_[_0x179a('0x4f')](_0x5ca41a['where'],{'$or':_[_0x179a('0x4d')](_0x5ca41a['attributes'],function(_0x1e03e2){var _0xdc8b00={};_0xdc8b00[_0x1e03e2]={'$like':'%'+_0x2dce85['query'][_0x179a('0x4c')]+'%'};return _0xdc8b00;})});}_0x5ca41a=_['merge']({},_0x5ca41a,_0x2dce85[_0x179a('0x50')]);return _0x4c878a[_0x179a('0x76')](_0x5ca41a);}})[_0x179a('0x32')](function(_0x218a83){if(_0x218a83){_0xaac05d=_0x218a83['length'];if(!_0x2dce85[_0x179a('0x41')][_0x179a('0x47')](_0x179a('0x48'))){_0x5ca41a[_0x179a('0x2c')]=qs[_0x179a('0x2c')](_0x2dce85[_0x179a('0x41')][_0x179a('0x2c')]);_0x5ca41a[_0x179a('0x2a')]=qs['offset'](_0x2dce85[_0x179a('0x41')][_0x179a('0x2a')]);}return _0x4c878a[_0x179a('0x76')](_0x5ca41a);}})[_0x179a('0x32')](function(_0x1d6da3){if(_0x1d6da3){return _0x1d6da3?{'count':_0xaac05d,'rows':_0x1d6da3}:null;}})[_0x179a('0x32')](respondWithResult(_0x449eb3,null))[_0x179a('0x25')](handleError(_0x449eb3,null));};exports['addApplications']=function(_0x291349,_0x49e86d,_0x59a894){return db[_0x179a('0x3b')][_0x179a('0x66')]({'where':{'id':_0x291349[_0x179a('0x55')]['id']}})[_0x179a('0x32')](handleEntityNotFound(_0x49e86d,null))['then'](function(_0x217917){if(_0x217917){return db[_0x179a('0x78')][_0x179a('0x79')](function(_0x467705){return db[_0x179a('0x7a')][_0x179a('0x33')]({'where':{'WhatsappAccountId':_0x291349[_0x179a('0x55')]['id']},'transaction':_0x467705})['then'](function(_0x429674){var _0x27d9cb=_[_0x179a('0x4d')](_0x291349[_0x179a('0x60')],function(_0x272fd3){_0x272fd3[_0x179a('0x63')]=_0x291349[_0x179a('0x55')]['id'];return _0x272fd3;});return db[_0x179a('0x7a')][_0x179a('0x7b')](_0x27d9cb,{'transaction':_0x467705});});})[_0x179a('0x32')](function(){return db[_0x179a('0x7a')][_0x179a('0x7c')]({'where':{'WhatsappAccountId':_0x291349[_0x179a('0x55')]['id']},'order':'priority'});});}})[_0x179a('0x32')](respondWithResult(_0x49e86d,null))[_0x179a('0x25')](handleError(_0x49e86d,null));};exports[_0x179a('0x7d')]=function(_0x510789,_0x131032,_0x2f29aa){var _0x2bdf31={};var _0x4421e3={};var _0x33e36f;var _0x5806d5;return db[_0x179a('0x3b')]['findOne']({'where':{'id':_0x510789['params']['id']}})[_0x179a('0x32')](handleEntityNotFound(_0x131032,null))[_0x179a('0x32')](function(_0x4a7ec4){if(_0x4a7ec4){_0x33e36f=_0x4a7ec4;_0x4421e3[_0x179a('0x40')]=_['keys'](db['WhatsappApplication'][_0x179a('0x3c')]);_0x4421e3[_0x179a('0x41')]=_[_0x179a('0x42')](_0x510789['query']);_0x4421e3[_0x179a('0x43')]=_[_0x179a('0x44')](_0x4421e3[_0x179a('0x40')],_0x4421e3['query']);_0x2bdf31[_0x179a('0x45')]=_[_0x179a('0x44')](_0x4421e3[_0x179a('0x40')],qs[_0x179a('0x46')](_0x510789['query'][_0x179a('0x46')]));_0x2bdf31[_0x179a('0x45')]=_0x2bdf31[_0x179a('0x45')][_0x179a('0x56')]?_0x2bdf31[_0x179a('0x45')]:_0x4421e3[_0x179a('0x40')];_0x2bdf31[_0x179a('0x67')]=qs[_0x179a('0x49')](_0x510789[_0x179a('0x41')][_0x179a('0x49')]);_0x2bdf31[_0x179a('0x4a')]=qs[_0x179a('0x43')](_[_0x179a('0x4b')](_0x510789['query'],_0x4421e3[_0x179a('0x43')]));if(_0x510789[_0x179a('0x41')][_0x179a('0x4c')]){_0x2bdf31[_0x179a('0x4a')]=_[_0x179a('0x4f')](_0x2bdf31[_0x179a('0x4a')],{'$or':_[_0x179a('0x4d')](_0x2bdf31['attributes'],function(_0x2eaf49){var _0x8a8c86={};_0x8a8c86[_0x2eaf49]={'$like':'%'+_0x510789[_0x179a('0x41')][_0x179a('0x4c')]+'%'};return _0x8a8c86;})});}_0x2bdf31=_[_0x179a('0x4f')]({},_0x2bdf31,_0x510789['options']);return _0x33e36f['getApplications'](_0x2bdf31);}})[_0x179a('0x32')](function(_0x45d07c){if(_0x45d07c){_0x5806d5=_0x45d07c[_0x179a('0x56')];if(!_0x510789[_0x179a('0x41')][_0x179a('0x47')]('nolimit')){_0x2bdf31[_0x179a('0x2c')]=qs[_0x179a('0x2c')](_0x510789[_0x179a('0x41')][_0x179a('0x2c')]);_0x2bdf31['offset']=qs[_0x179a('0x2a')](_0x510789[_0x179a('0x41')][_0x179a('0x2a')]);}return _0x33e36f[_0x179a('0x7d')](_0x2bdf31);}})[_0x179a('0x32')](function(_0x818b56){if(_0x818b56){return _0x818b56?{'count':_0x5806d5,'rows':_0x818b56}:null;}})[_0x179a('0x32')](respondWithResult(_0x131032,null))['catch'](handleError(_0x131032,null));};exports[_0x179a('0x7e')]=function(_0x403e61,_0x5e8c7b,_0x4b2a28){var _0x5be160={'channel':_0x179a('0x7f')};var _0xf2e05b=[];var _0x366c83=[];var _0x1d91a2={};return db[_0x179a('0x3b')][_0x179a('0x57')]({'where':{'id':_0x403e61[_0x179a('0x55')]['id']},'include':[{'model':db[_0x179a('0x7a')],'as':_0x179a('0x80')}]})[_0x179a('0x32')](handleEntityNotFound(_0x5e8c7b,null))['then'](function(_0xab8291){_0x5be160['account']=_0xab8291;_0x5be160[_0x179a('0x81')]=_[_0x179a('0x82')](_0xab8291[_0x179a('0x80')],[_0x179a('0x83')],[_0x179a('0x84')]);if(_0x5be160[_0x179a('0x85')][_0x179a('0x80')]){delete _0x5be160[_0x179a('0x85')]['Applications'];}return db['CmContact'][_0x179a('0x86')]();})['then'](function(_0x52b527){if(!_0x52b527){throw new db[(_0x179a('0x87'))][(_0x179a('0x88'))](_0x179a('0x89'));}_0xf2e05b=_[_0x179a('0x8a')](_[_0x179a('0x42')](_0x52b527),[_0x179a('0x8b'),'updatedAt']);_0x366c83=_[_0x179a('0x8a')](_['keys'](_0x52b527),['createdAt',_0x179a('0x8c'),_0x179a('0x8d'),_0x179a('0x8e')]);_0x5be160[_0x179a('0x60')]={'mapKey':_0x179a('0x8f')};if(_0x5be160[_0x179a('0x85')][_0x179a('0x3e')]&&_0x5be160['account']['type']===_0x179a('0x90')){_0x5be160[_0x179a('0x60')]['from']=_0x403e61[_0x179a('0x60')][_0x179a('0x91')][_0x179a('0x92')]('whatsapp:','');_0x5be160[_0x179a('0x60')][_0x179a('0x60')]=_0x403e61[_0x179a('0x60')]['Body'];_0x5be160[_0x179a('0x60')][_0x179a('0x93')]=_0x403e61[_0x179a('0x60')]['MessageSid'];}if(_0x5be160[_0x179a('0x60')]['id']){delete _0x5be160[_0x179a('0x60')]['id'];}if(_[_0x179a('0x94')](_0x5be160[_0x179a('0x60')]['from'])){throw new db[(_0x179a('0x87'))][(_0x179a('0x88'))]('from\x20is\x20mandatory');}if(_[_0x179a('0x94')](_0x5be160[_0x179a('0x60')]['body'])||_0x5be160[_0x179a('0x60')][_0x179a('0x60')]===''){throw new db[(_0x179a('0x87'))]['ValidationError'](_0x179a('0x95'));}if(_['isNil'](_0x5be160[_0x179a('0x60')][_0x179a('0x96')])){throw new db[(_0x179a('0x87'))][(_0x179a('0x88'))](_0x179a('0x97')+_0x366c83);}if(!_[_0x179a('0x98')](_0x366c83,_0x5be160[_0x179a('0x60')][_0x179a('0x96')])){throw new db['Sequelize'][(_0x179a('0x88'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x366c83);}_0x1d91a2[_0x5be160['body'][_0x179a('0x96')]]=_0x5be160[_0x179a('0x60')]['from'];return db[_0x179a('0x99')][_0x179a('0x57')]({'where':{'id':_0x5be160[_0x179a('0x85')][_0x179a('0x8e')]},'include':[{'model':db[_0x179a('0x9a')],'as':'Contacts','where':_0x1d91a2,'limit':0x1,'order':[[_0x179a('0x8c'),_0x179a('0x9b')]]}]});})[_0x179a('0x32')](handleEntityNotFound(_0x5e8c7b,null))['then'](function(_0x161bc9){if(_0x161bc9){_0x5be160[_0x179a('0x9c')]=_[_0x179a('0x70')](_0x161bc9,[_0x179a('0x9d')]);if(_0x161bc9[_0x179a('0x9d')][_0x179a('0x56')]){return _0x161bc9[_0x179a('0x9d')][0x0];}var _0x35d29f=_[_0x179a('0x18')](_0x5be160[_0x179a('0x60')],{'firstName':_0x5be160['body']['from'],'ListId':_0x161bc9['id']});_0x35d29f[_0x5be160[_0x179a('0x60')][_0x179a('0x96')]]=_0x5be160['body']['from'];return db[_0x179a('0x9a')][_0x179a('0x58')](_0x35d29f,{'fields':_0xf2e05b,'raw':!![]});}})['then'](handleEntityNotFound(_0x5e8c7b,null))[_0x179a('0x32')](function(_0x3d6f60){if(_0x3d6f60){_0x5be160[_0x179a('0x9e')]=_0x3d6f60;var _0x3dec8f={'ContactId':_0x3d6f60['id'],'phone':_0x5be160[_0x179a('0x60')][_0x179a('0x9f')],'WhatsappAccountId':_0x403e61[_0x179a('0x55')]['id']};var _0x12098c={'ContactId':_0x3d6f60['id'],'WhatsappAccountId':_0x403e61[_0x179a('0x55')]['id'],'closed':![]};return db[_0x179a('0xa0')]['find']({'where':_0x12098c})[_0x179a('0x32')](function(_0x1d403){if(_0x1d403){return[_0x1d403,![]];}return db[_0x179a('0xa0')][_0x179a('0x58')](_0x3dec8f)[_0x179a('0x32')](function(_0x33e2da){return[_0x33e2da,!![]];});});}})['spread'](function(_0x3f529a,_0x87e727){_0x5be160[_0x179a('0xa1')]=_0x3f529a['get']({'plain':!![]});_0x5be160[_0x179a('0xa1')][_0x179a('0xa2')]=![];if(_0x87e727){if(_0x5be160[_0x179a('0x85')]['autoclose']){_0x5be160['applications'][_0x179a('0xa3')]({'id':0x0,'priority':_0x5be160[_0x179a('0x81')][_0x179a('0x56')]+0x1,'app':_0x179a('0xa4'),'appdata':_0x179a('0xa5'),'interval':_0x179a('0xa6')});}_0x5be160[_0x179a('0xa1')]['created']=!![];}return db['WhatsappMessage'][_0x179a('0x58')]({'phone':_0x5be160[_0x179a('0x60')][_0x179a('0x9f')],'messageId':_0x5be160[_0x179a('0x60')][_0x179a('0x93')],'body':_0x5be160[_0x179a('0x60')][_0x179a('0x60')],'WhatsappAccountId':_0x403e61[_0x179a('0x55')]['id'],'WhatsappInteractionId':_0x3f529a['id'],'direction':'in','ContactId':_0x3f529a['ContactId'],'AttachmentId':_0x5be160['body'][_0x179a('0xa7')]});})[_0x179a('0x32')](function(_0x2ea999){_0x5be160[_0x179a('0x23')]=_0x2ea999;if(_0x5be160[_0x179a('0xa1')][_0x179a('0xa8')]){return db[_0x179a('0x77')][_0x179a('0x57')]({'attributes':['id','name'],'where':{'id':_0x5be160[_0x179a('0xa1')][_0x179a('0xa8')]}})[_0x179a('0x32')](function(_0x224949){if(_0x224949){_0x5be160['applications'][_0x179a('0xa9')]({'id':0x0,'priority':0x0,'app':_0x179a('0xaa'),'appdata':_0x224949[_0x179a('0x37')]+','+(_0x5be160[_0x179a('0x85')][_0x179a('0xab')]||0xa),'interval':_0x179a('0xa6')});}return respondWithRpcPromise(_0x179a('0xac'),_0x179a('0xad'),_0x5be160);});}return respondWithRpcPromise('Start',_0x179a('0xad'),_0x5be160);})[_0x179a('0x32')](function(_0x3298ed){if(_0x3298ed){var _0x64862c=0xc8;var _0x4ac586=_0x179a('0xae');logger[_0x179a('0x1e')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4ac586,_0x64862c,_0x179a('0xaf'));logger[_0x179a('0x21')](_0x179a('0xb0'),_0x4ac586,_0x64862c,_0x179a('0xaf'),JSON[_0x179a('0xb1')](_0x3298ed));if(_0x5be160[_0x179a('0x85')]['type']==='twilio'){return _0x5e8c7b['status'](_0x64862c)[_0x179a('0x2d')](_0x179a('0xb2'),_0x179a('0xb3'))[_0x179a('0x38')]('\x0a');}else{return _0x5e8c7b['status'](_0x64862c)[_0x179a('0x29')](_0x3298ed);}}})[_0x179a('0x25')](handleError(_0x5e8c7b,null));};exports['send']=function(_0x736f44,_0xf24f39,_0x314dce){var _0xa61974,_0x8a11ba,_0x137774;if(_[_0x179a('0x94')](_0x736f44[_0x179a('0x60')][_0x179a('0x60')])||_0x736f44['body'][_0x179a('0x60')]===''){throw new db[(_0x179a('0x87'))][(_0x179a('0x88'))](_0x179a('0x95'));}if(_[_0x179a('0x94')](_0x736f44['body']['to'])){throw new db['Sequelize'][(_0x179a('0x88'))](_0x179a('0xb4'));}_0xa61974=_0x736f44[_0x179a('0x60')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x736f44['params']['id']},'include':[{'model':db[_0x179a('0x99')],'as':_0x179a('0xb5'),'include':[{'model':db[_0x179a('0x9a')],'as':_0x179a('0x9d'),'where':{'mobile':_0xa61974},'limit':0x1,'order':[['updatedAt',_0x179a('0x9b')]]}]}]})['then'](handleEntityNotFound(_0xf24f39,null))['then'](function(_0x3d5b74){if(_0x3d5b74&&_0x3d5b74[_0x179a('0xb5')]){_0x8a11ba=_0x3d5b74['get']({'plain':!![]});if(_0x8a11ba[_0x179a('0xb5')]&&_0x8a11ba[_0x179a('0xb5')][_0x179a('0x9d')][_0x179a('0x56')]){return _0x8a11ba[_0x179a('0xb5')][_0x179a('0x9d')][0x0];}return db[_0x179a('0x9a')][_0x179a('0x58')](_['defaults'](_0x736f44[_0x179a('0x60')],{'firstName':_0xa61974,'mobile':_0xa61974,'phone':_0xa61974,'ListId':_0x8a11ba[_0x179a('0x8e')]}));}})[_0x179a('0x32')](handleEntityNotFound(_0xf24f39,null))[_0x179a('0x32')](function(_0x171b79){if(_0x171b79){_0x137774=_0x171b79;return db[_0x179a('0xa0')]['find']({'where':{'ContactId':_0x137774['id'],'closed':![],'WhatsappAccountId':_0x8a11ba['id']}})[_0x179a('0x32')](function(_0xf9906e){if(_0xf9906e){return[_0xf9906e,![]];}return db[_0x179a('0xa0')][_0x179a('0x58')]({'UserId':_0x736f44[_0x179a('0x59')]['id'],'ContactId':_0x137774['id'],'WhatsappAccountId':_0x8a11ba['id'],'phone':_0xa61974,'firstMsgDirection':'out','Messages':[_[_0x179a('0x4f')](_0x736f44['body'],{'read':![],'body':_0x736f44[_0x179a('0x60')][_0x179a('0x60')],'phone':_0xa61974,'WhatsappAccountId':_0x8a11ba['id'],'UserId':_0x736f44[_0x179a('0x59')]['id'],'ContactId':_0x137774['id']})]},{'include':[{'model':db[_0x179a('0xb6')],'as':_0x179a('0xb7')}]})[_0x179a('0x32')](function(_0x14aa2a){return[_0x14aa2a,!![]];});});}})[_0x179a('0xb8')](function(_0x389f8e,_0x3c1da9){if(_0x3c1da9){return _0x389f8e;}return db[_0x179a('0xb6')][_0x179a('0x58')](_[_0x179a('0x4f')](_0x736f44[_0x179a('0x60')],{'read':![],'body':_0x736f44[_0x179a('0x60')][_0x179a('0x60')],'phone':_0xa61974,'WhatsappAccountId':_0x8a11ba['id'],'WhatsappInteractionId':_0x389f8e['id'],'UserId':_0x736f44[_0x179a('0x59')]['id'],'ContactId':_0x137774['id']}))['then'](function(_0x495ea6){_0x389f8e[_0x179a('0xb9')][_0x179a('0xb7')]=[];_0x389f8e['dataValues'][_0x179a('0xb7')]['push'](_0x495ea6[_0x179a('0xb9')]);return _0x389f8e;});})[_0x179a('0x32')](respondWithResult(_0xf24f39,null))['catch'](handleError(_0xf24f39,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index ec77241..d42797b 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 _0x9e0f=['../../mysqldb','WhatsappAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3a04ab,_0x31b9fd){var _0x4bff6d=function(_0x125f7e){while(--_0x125f7e){_0x3a04ab['push'](_0x3a04ab['shift']());}};_0x4bff6d(++_0x31b9fd);}(_0x9e0f,0x1c1));var _0xf9e0=function(_0x2c4ba3,_0x2d24ba){_0x2c4ba3=_0x2c4ba3-0x0;var _0x150a93=_0x9e0f[_0x2c4ba3];return _0x150a93;};'use strict';var EventEmitter=require(_0xf9e0('0x0'));var WhatsappAccount=require(_0xf9e0('0x1'))['db'][_0xf9e0('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf9e0('0x3')](0x0);var events={'afterCreate':_0xf9e0('0x4'),'afterUpdate':'update','afterDestroy':_0xf9e0('0x5')};function emitEvent(_0x351694){return function(_0x103876,_0x4ff3d3,_0x44bcfc){WhatsappAccountEvents[_0xf9e0('0x6')](_0x351694+':'+_0x103876['id'],_0x103876);WhatsappAccountEvents['emit'](_0x351694,_0x103876);_0x44bcfc(null);};}for(var e in events){if(events[_0xf9e0('0x7')](e)){var event=events[e];WhatsappAccount[_0xf9e0('0x8')](e,emitEvent(event));}}module[_0xf9e0('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x514c=['exports','events','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5c72cc,_0x4c4ffe){var _0xc39bb4=function(_0x5b8f79){while(--_0x5b8f79){_0x5c72cc['push'](_0x5c72cc['shift']());}};_0xc39bb4(++_0x4c4ffe);}(_0x514c,0x88));var _0xc514=function(_0x15e7a2,_0x13b2b7){_0x15e7a2=_0x15e7a2-0x0;var _0x53f6f1=_0x514c[_0x15e7a2];return _0x53f6f1;};'use strict';var EventEmitter=require(_0xc514('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0xc514('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xc514('0x2')](0x0);var events={'afterCreate':_0xc514('0x3'),'afterUpdate':_0xc514('0x4'),'afterDestroy':_0xc514('0x5')};function emitEvent(_0x4b068c){return function(_0x16c356,_0x5c41bd,_0x913b79){WhatsappAccountEvents[_0xc514('0x6')](_0x4b068c+':'+_0x16c356['id'],_0x16c356);WhatsappAccountEvents['emit'](_0x4b068c,_0x16c356);_0x913b79(null);};}for(var e in events){if(events[_0xc514('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xc514('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index a4045c7..32b1428 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 _0x67b7=['lodash','util','../../config/logger','api','bluebird','rimraf','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x67b7,0x64));var _0x767b=function(_0x31f91a,_0x7c6501){_0x31f91a=_0x31f91a-0x0;var _0x1009e4=_0x67b7[_0x31f91a];return _0x1009e4;};'use strict';var _=require(_0x767b('0x0'));var util=require(_0x767b('0x1'));var logger=require(_0x767b('0x2'))(_0x767b('0x3'));var moment=require('moment');var BPromise=require(_0x767b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x767b('0x5'));var config=require('../../config/environment');var attributes=require(_0x767b('0x6'));module['exports']=function(_0x3de86a,_0x4ba654){return _0x3de86a[_0x767b('0x7')](_0x767b('0x8'),attributes,{'tableName':_0x767b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34a2=['define','WhatsappAccount','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./whatsappAccount.attributes'];(function(_0x5485bf,_0x4a2aac){var _0x58052c=function(_0x5136af){while(--_0x5136af){_0x5485bf['push'](_0x5485bf['shift']());}};_0x58052c(++_0x4a2aac);}(_0x34a2,0xc8));var _0x234a=function(_0x22c1e8,_0x2d0638){_0x22c1e8=_0x22c1e8-0x0;var _0x1acc9c=_0x34a2[_0x22c1e8];return _0x1acc9c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x234a('0x0'))(_0x234a('0x1'));var moment=require(_0x234a('0x2'));var BPromise=require(_0x234a('0x3'));var rp=require(_0x234a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x234a('0x5'));var attributes=require(_0x234a('0x6'));module['exports']=function(_0x5eafd5,_0x1494e1){return _0x5eafd5[_0x234a('0x7')](_0x234a('0x8'),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 6373670..e718b04 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 _0x1ab0=['randomstring','../../config/utils','../../config/logger','rpc','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','attributes','include','map','model','stringify','lodash','util','bluebird'];(function(_0x33e9dc,_0x2cceb0){var _0x4e1507=function(_0x26466f){while(--_0x26466f){_0x33e9dc['push'](_0x33e9dc['shift']());}};_0x4e1507(++_0x2cceb0);}(_0x1ab0,0x168));var _0x01ab=function(_0x9752d0,_0x4eaa6d){_0x9752d0=_0x9752d0-0x0;var _0x547059=_0x1ab0[_0x9752d0];return _0x547059;};'use strict';var _=require(_0x01ab('0x0'));var util=require(_0x01ab('0x1'));var moment=require('moment');var BPromise=require(_0x01ab('0x2'));var rs=require(_0x01ab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x01ab('0x4'));var logger=require(_0x01ab('0x5'))(_0x01ab('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x01ab('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x01ab('0x8')],{'host':_0x01ab('0x9'),'port':0x18eb});var socket=require(_0x01ab('0xa'))(new Redis(config[_0x01ab('0x8')]));require(_0x01ab('0xb'))[_0x01ab('0xc')](socket);function respondWithRpcPromise(_0x343059,_0x7086d7,_0x49d424){return new BPromise(function(_0x2e9a3b,_0x2888fa){return client[_0x01ab('0xd')](_0x343059,_0x49d424)[_0x01ab('0xe')](function(_0x3a9101){logger[_0x01ab('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x7086d7,_0x01ab('0x10'));logger['debug'](_0x01ab('0x11'),_0x7086d7,_0x01ab('0x10'),JSON['stringify'](_0x3a9101));if(_0x3a9101[_0x01ab('0x12')]){if(_0x3a9101[_0x01ab('0x12')][_0x01ab('0x13')]===0x1f4){logger[_0x01ab('0x12')](_0x01ab('0x14'),_0x7086d7,_0x3a9101['error']['message']);return _0x2888fa(_0x3a9101[_0x01ab('0x12')][_0x01ab('0x15')]);}logger[_0x01ab('0x12')](_0x01ab('0x14'),_0x7086d7,_0x3a9101[_0x01ab('0x12')]['message']);return _0x2e9a3b(_0x3a9101['error']['message']);}else{logger[_0x01ab('0xf')](_0x01ab('0x14'),_0x7086d7,_0x01ab('0x10'));_0x2e9a3b(_0x3a9101[_0x01ab('0x16')]['message']);}})[_0x01ab('0x17')](function(_0x4952da){logger[_0x01ab('0x12')](_0x01ab('0x14'),_0x7086d7,_0x4952da);_0x2888fa(_0x4952da);});});}exports[_0x01ab('0x18')]=function(_0x1cd7a2){var _0x1ed91d=this;return new Promise(function(_0x573ca4,_0x166e16){return db[_0x01ab('0x19')][_0x01ab('0x1a')]({'raw':_0x1cd7a2['options']?_0x1cd7a2[_0x01ab('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1cd7a2['options']?_0x1cd7a2[_0x01ab('0x1b')]['where']||null:null,'attributes':_0x1cd7a2[_0x01ab('0x1b')]?_0x1cd7a2['options'][_0x01ab('0x1c')]||null:null,'include':_0x1cd7a2[_0x01ab('0x1b')]?_0x1cd7a2[_0x01ab('0x1b')][_0x01ab('0x1d')]?_[_0x01ab('0x1e')](_0x1cd7a2[_0x01ab('0x1b')]['include'],function(_0x71e0a2){return{'model':db[_0x71e0a2[_0x01ab('0x1f')]],'as':_0x71e0a2['as'],'attributes':_0x71e0a2[_0x01ab('0x1c')],'include':_0x71e0a2['include']?_[_0x01ab('0x1e')](_0x71e0a2['include'],function(_0xe055a6){return{'model':db[_0xe055a6[_0x01ab('0x1f')]],'as':_0xe055a6['as'],'attributes':_0xe055a6[_0x01ab('0x1c')],'include':_0xe055a6['include']?_['map'](_0xe055a6[_0x01ab('0x1d')],function(_0x75d1ca){return{'model':db[_0x75d1ca[_0x01ab('0x1f')]],'as':_0x75d1ca['as'],'attributes':_0x75d1ca[_0x01ab('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fd7fd){logger[_0x01ab('0xf')](_0x01ab('0x18'),_0x1cd7a2);logger['debug'](_0x01ab('0x18'),_0x1cd7a2,JSON[_0x01ab('0x20')](_0x3fd7fd));_0x573ca4(_0x3fd7fd);})[_0x01ab('0x17')](function(_0x4a39a5){logger['error'](_0x01ab('0x18'),_0x4a39a5[_0x01ab('0x15')],_0x1cd7a2);_0x166e16(_0x1ed91d[_0x01ab('0x12')](0x1f4,_0x4a39a5[_0x01ab('0x15')]));});});}; \ No newline at end of file +var _0x5c0f=['result','catch','WhatsappAccount','find','options','where','attributes','include','model','map','then','ShowWhatsappAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','register','request','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0xd45156,_0x3620dd){var _0x297c3b=function(_0x3df541){while(--_0x3df541){_0xd45156['push'](_0xd45156['shift']());}};_0x297c3b(++_0x3620dd);}(_0x5c0f,0x160));var _0xf5c0=function(_0x232fa0,_0x4a81da){_0x232fa0=_0x232fa0-0x0;var _0x2d913b=_0x5c0f[_0x232fa0];return _0x2d913b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf5c0('0x0'));var BPromise=require(_0xf5c0('0x1'));var rs=require(_0xf5c0('0x2'));var fs=require('fs');var Redis=require(_0xf5c0('0x3'));var db=require(_0xf5c0('0x4'))['db'];var utils=require(_0xf5c0('0x5'));var logger=require('../../config/logger')(_0xf5c0('0x6'));var config=require(_0xf5c0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf5c0('0x8')]['http']({'port':0x232a});config[_0xf5c0('0x9')]=_[_0xf5c0('0xa')](config[_0xf5c0('0x9')],{'host':_0xf5c0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5c0('0x9')]));require('./whatsappAccount.socket')[_0xf5c0('0xc')](socket);function respondWithRpcPromise(_0x55b94d,_0x50a9aa,_0x1fb25b){return new BPromise(function(_0x3c45e0,_0x3815f1){return client[_0xf5c0('0xd')](_0x55b94d,_0x1fb25b)['then'](function(_0x3593c4){logger[_0xf5c0('0xe')](_0xf5c0('0xf'),_0x50a9aa,'request\x20sent');logger[_0xf5c0('0x10')](_0xf5c0('0x11'),_0x50a9aa,_0xf5c0('0x12'),JSON[_0xf5c0('0x13')](_0x3593c4));if(_0x3593c4[_0xf5c0('0x14')]){if(_0x3593c4[_0xf5c0('0x14')]['code']===0x1f4){logger[_0xf5c0('0x14')](_0xf5c0('0xf'),_0x50a9aa,_0x3593c4[_0xf5c0('0x14')][_0xf5c0('0x15')]);return _0x3815f1(_0x3593c4[_0xf5c0('0x14')][_0xf5c0('0x15')]);}logger[_0xf5c0('0x14')](_0xf5c0('0xf'),_0x50a9aa,_0x3593c4[_0xf5c0('0x14')][_0xf5c0('0x15')]);return _0x3c45e0(_0x3593c4[_0xf5c0('0x14')][_0xf5c0('0x15')]);}else{logger[_0xf5c0('0xe')](_0xf5c0('0xf'),_0x50a9aa,'request\x20sent');_0x3c45e0(_0x3593c4[_0xf5c0('0x16')][_0xf5c0('0x15')]);}})[_0xf5c0('0x17')](function(_0x17f81b){logger[_0xf5c0('0x14')](_0xf5c0('0xf'),_0x50a9aa,_0x17f81b);_0x3815f1(_0x17f81b);});});}exports['ShowWhatsappAccount']=function(_0x919742){var _0xf6e3e=this;return new Promise(function(_0x541314,_0x165a11){return db[_0xf5c0('0x18')][_0xf5c0('0x19')]({'raw':_0x919742[_0xf5c0('0x1a')]?_0x919742['options']['raw']===undefined?!![]:![]:!![],'where':_0x919742['options']?_0x919742[_0xf5c0('0x1a')][_0xf5c0('0x1b')]||null:null,'attributes':_0x919742['options']?_0x919742[_0xf5c0('0x1a')][_0xf5c0('0x1c')]||null:null,'include':_0x919742[_0xf5c0('0x1a')]?_0x919742[_0xf5c0('0x1a')][_0xf5c0('0x1d')]?_['map'](_0x919742[_0xf5c0('0x1a')][_0xf5c0('0x1d')],function(_0x5720f8){return{'model':db[_0x5720f8[_0xf5c0('0x1e')]],'as':_0x5720f8['as'],'attributes':_0x5720f8[_0xf5c0('0x1c')],'include':_0x5720f8['include']?_[_0xf5c0('0x1f')](_0x5720f8[_0xf5c0('0x1d')],function(_0x43e82e){return{'model':db[_0x43e82e['model']],'as':_0x43e82e['as'],'attributes':_0x43e82e[_0xf5c0('0x1c')],'include':_0x43e82e[_0xf5c0('0x1d')]?_[_0xf5c0('0x1f')](_0x43e82e[_0xf5c0('0x1d')],function(_0x28fe35){return{'model':db[_0x28fe35[_0xf5c0('0x1e')]],'as':_0x28fe35['as'],'attributes':_0x28fe35[_0xf5c0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf5c0('0x20')](function(_0x4e5444){logger['info']('ShowWhatsappAccount',_0x919742);logger['debug'](_0xf5c0('0x21'),_0x919742,JSON['stringify'](_0x4e5444));_0x541314(_0x4e5444);})[_0xf5c0('0x17')](function(_0x2e57c2){logger['error'](_0xf5c0('0x21'),_0x2e57c2[_0xf5c0('0x15')],_0x919742);_0x165a11(_0xf6e3e[_0xf5c0('0x14')](0x1f4,_0x2e57c2[_0xf5c0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index c321414..73f60a9 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 _0xbb55=['save','remove','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x3d83c6,_0x16f414){var _0x2401ee=function(_0x8b06c7){while(--_0x8b06c7){_0x3d83c6['push'](_0x3d83c6['shift']());}};_0x2401ee(++_0x16f414);}(_0xbb55,0x1af));var _0x5bb5=function(_0xa8aefd,_0x19a133){_0xa8aefd=_0xa8aefd-0x0;var _0x10349b=_0xbb55[_0xa8aefd];return _0x10349b;};'use strict';var WhatsappAccountEvents=require(_0x5bb5('0x0'));var events=[_0x5bb5('0x1'),_0x5bb5('0x2'),'update'];function createListener(_0xbddcbb,_0x201172){return function(_0x26dc81){_0x201172[_0x5bb5('0x3')](_0xbddcbb,_0x26dc81);};}function removeListener(_0x50d7d0,_0x36c578){return function(){WhatsappAccountEvents[_0x5bb5('0x4')](_0x50d7d0,_0x36c578);};}exports[_0x5bb5('0x5')]=function(_0x4dbf29){for(var _0x2fd08c=0x0,_0x4e65ba=events[_0x5bb5('0x6')];_0x2fd08c<_0x4e65ba;_0x2fd08c++){var _0x1ee619=events[_0x2fd08c];var _0x637d1d=createListener(_0x5bb5('0x7')+_0x1ee619,_0x4dbf29);WhatsappAccountEvents['on'](_0x1ee619,_0x637d1d);}}; \ No newline at end of file +var _0x36a1=['save','remove','removeListener','length','./whatsappAccount.events'];(function(_0x8b9e62,_0x173b44){var _0x31a9a0=function(_0x5cacf7){while(--_0x5cacf7){_0x8b9e62['push'](_0x8b9e62['shift']());}};_0x31a9a0(++_0x173b44);}(_0x36a1,0xd6));var _0x136a=function(_0x305b13,_0x59ac38){_0x305b13=_0x305b13-0x0;var _0x1bdbf1=_0x36a1[_0x305b13];return _0x1bdbf1;};'use strict';var WhatsappAccountEvents=require(_0x136a('0x0'));var events=[_0x136a('0x1'),_0x136a('0x2'),'update'];function createListener(_0x4cf880,_0x3ee599){return function(_0x465f47){_0x3ee599['emit'](_0x4cf880,_0x465f47);};}function removeListener(_0x3660d3,_0x14ca19){return function(){WhatsappAccountEvents[_0x136a('0x3')](_0x3660d3,_0x14ca19);};}exports['register']=function(_0x2b4598){for(var _0x46580a=0x0,_0x5e4486=events[_0x136a('0x4')];_0x46580a<_0x5e4486;_0x46580a++){var _0x4653a1=events[_0x46580a];var _0xaefb10=createListener('whatsappAccount:'+_0x4653a1,_0x2b4598);WhatsappAccountEvents['on'](_0x4653a1,_0xaefb10);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 8ca0bcf..8fa4b18 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 _0x0d66=['post','create','put','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x0d66,0xf3));var _0x60d6=function(_0xb875ee,_0x583042){_0xb875ee=_0xb875ee-0x0;var _0x4c7f3a=_0x0d66[_0xb875ee];return _0x4c7f3a;};'use strict';var multer=require(_0x60d6('0x0'));var util=require(_0x60d6('0x1'));var path=require(_0x60d6('0x2'));var timeout=require(_0x60d6('0x3'));var express=require('express');var router=express[_0x60d6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x60d6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x60d6('0x6'));var controller=require(_0x60d6('0x7'));router[_0x60d6('0x8')]('/',auth[_0x60d6('0x9')](),controller['index']);router['get'](_0x60d6('0xa'),auth[_0x60d6('0x9')](),controller[_0x60d6('0xb')]);router[_0x60d6('0xc')]('/',auth[_0x60d6('0x9')](),controller[_0x60d6('0xd')]);router[_0x60d6('0xe')](_0x60d6('0xa'),auth[_0x60d6('0x9')](),controller[_0x60d6('0xf')]);router['delete']('/:id',auth[_0x60d6('0x9')](),controller['destroy']);module[_0x60d6('0x10')]=router; \ No newline at end of file +var _0xb41b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','index','/:id','post','update','delete','multer','path','connect-timeout'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb41b,0xdd));var _0xbb41=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb41b[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xbb41('0x0'));var util=require('util');var path=require(_0xbb41('0x1'));var timeout=require(_0xbb41('0x2'));var express=require(_0xbb41('0x3'));var router=express[_0xbb41('0x4')]();var fs_extra=require(_0xbb41('0x5'));var auth=require(_0xbb41('0x6'));var interaction=require(_0xbb41('0x7'));var config=require('../../config/environment');var controller=require(_0xbb41('0x8'));router[_0xbb41('0x9')]('/',auth[_0xbb41('0xa')](),controller[_0xbb41('0xb')]);router['get'](_0xbb41('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbb41('0xd')]('/',auth[_0xbb41('0xa')](),controller['create']);router['put'](_0xbb41('0xc'),auth[_0xbb41('0xa')](),controller[_0xbb41('0xe')]);router[_0xbb41('0xf')]('/:id',auth[_0xbb41('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index e7a52f7..be58919 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 _0xcd19=['sequelize','exports','STRING','noop','TEXT'];(function(_0xc24cc4,_0x414db2){var _0x310e33=function(_0x3d8be3){while(--_0x3d8be3){_0xc24cc4['push'](_0xc24cc4['shift']());}};_0x310e33(++_0x414db2);}(_0xcd19,0x82));var _0x9cd1=function(_0x4fa0ea,_0x2cd534){_0x4fa0ea=_0x4fa0ea-0x0;var _0x51d027=_0xcd19[_0x4fa0ea];return _0x51d027;};'use strict';var Sequelize=require(_0x9cd1('0x0'));module[_0x9cd1('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9cd1('0x2')],'allowNull':![],'defaultValue':_0x9cd1('0x3')},'appdata':{'type':Sequelize[_0x9cd1('0x4')]()},'description':{'type':Sequelize[_0x9cd1('0x2')]},'interval':{'type':Sequelize[_0x9cd1('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xab14=['TEXT','STRING','*,*,*,*','sequelize','INTEGER','noop'];(function(_0xa1aa49,_0x328edf){var _0x368658=function(_0x23a88a){while(--_0x23a88a){_0xa1aa49['push'](_0xa1aa49['shift']());}};_0x368658(++_0x328edf);}(_0xab14,0x93));var _0x4ab1=function(_0x25484e,_0x45ae39){_0x25484e=_0x25484e-0x0;var _0x3550f4=_0xab14[_0x25484e];return _0x3550f4;};'use strict';var Sequelize=require(_0x4ab1('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4ab1('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4ab1('0x2')},'appdata':{'type':Sequelize[_0x4ab1('0x3')]()},'description':{'type':Sequelize[_0x4ab1('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x4ab1('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index edcf041..ff10f15 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 _0x676c=['sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','update','destroy','then','error','stack','name','index','map','WhatsappApplication','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x676c,0x198));var _0xc676=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x676c[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xc676('0x0'));var rimraf=require(_0xc676('0x1'));var zipdir=require(_0xc676('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc676('0x3'));var moment=require(_0xc676('0x4'));var BPromise=require(_0xc676('0x5'));var Mustache=require(_0xc676('0x6'));var util=require(_0xc676('0x7'));var path=require(_0xc676('0x8'));var sox=require('sox');var csv=require(_0xc676('0x9'));var ejs=require(_0xc676('0xa'));var fs=require('fs');var fs_extra=require(_0xc676('0xb'));var _=require(_0xc676('0xc'));var squel=require(_0xc676('0xd'));var crypto=require('crypto');var jsforce=require(_0xc676('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc676('0xf'));var Papa=require(_0xc676('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc676('0x11'));var as=require(_0xc676('0x12'));var hardwareService=require(_0xc676('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xc676('0x14'));var config=require(_0xc676('0x15'));var licenseUtil=require(_0xc676('0x16'));var db=require(_0xc676('0x17'))['db'];function respondWithStatusCode(_0x5e8565,_0xc15629){_0xc15629=_0xc15629||0xcc;return function(_0xfb2c57){if(_0xfb2c57){return _0x5e8565[_0xc676('0x18')](_0xc15629);}return _0x5e8565[_0xc676('0x19')](_0xc15629)[_0xc676('0x1a')]();};}function respondWithResult(_0xcee1c5,_0xa07c6d){_0xa07c6d=_0xa07c6d||0xc8;return function(_0x4f8832){if(_0x4f8832){return _0xcee1c5[_0xc676('0x19')](_0xa07c6d)['json'](_0x4f8832);}};}function respondWithFilteredResult(_0x59deda,_0x2ea1e0){return function(_0x4e0f49){if(_0x4e0f49){var _0x51e6d4=typeof _0x2ea1e0['offset']===_0xc676('0x1b')&&typeof _0x2ea1e0['limit']===_0xc676('0x1b');var _0x1468bc=_0x4e0f49[_0xc676('0x1c')];var _0x3b3215=_0x51e6d4?0x0:_0x2ea1e0[_0xc676('0x1d')];var _0x215ea6=_0x51e6d4?_0x4e0f49['count']:_0x2ea1e0[_0xc676('0x1d')]+_0x2ea1e0[_0xc676('0x1e')];var _0x4fe489;if(_0x215ea6>=_0x1468bc){_0x215ea6=_0x1468bc;_0x4fe489=0xc8;}else{_0x4fe489=0xce;}_0x59deda[_0xc676('0x19')](_0x4fe489);return _0x59deda[_0xc676('0x1f')](_0xc676('0x20'),_0x3b3215+'-'+_0x215ea6+'/'+_0x1468bc)[_0xc676('0x21')](_0x4e0f49);}return null;};}function patchUpdates(_0x26a00b){return function(_0x87b27d){try{jsonpatch[_0xc676('0x22')](_0x87b27d,_0x26a00b,!![]);}catch(_0xc533a9){return BPromise['reject'](_0xc533a9);}return _0x87b27d['save']();};}function saveUpdates(_0x502e6f,_0x399461){return function(_0x5ca0a2){if(_0x5ca0a2){return _0x5ca0a2[_0xc676('0x23')](_0x502e6f)['then'](function(_0x54389a){return _0x54389a;});}return null;};}function removeEntity(_0x3b55c5,_0x575de4){return function(_0x113ec5){if(_0x113ec5){return _0x113ec5[_0xc676('0x24')]()[_0xc676('0x25')](function(){_0x3b55c5[_0xc676('0x19')](0xcc)[_0xc676('0x1a')]();});}};}function handleEntityNotFound(_0x4ca666,_0x187960){return function(_0x24f330){if(!_0x24f330){_0x4ca666[_0xc676('0x18')](0x194);}return _0x24f330;};}function handleError(_0x56215c,_0x36bd5b){_0x36bd5b=_0x36bd5b||0x1f4;return function(_0x4b61aa){logger[_0xc676('0x26')](_0x4b61aa[_0xc676('0x27')]);if(_0x4b61aa['name']){delete _0x4b61aa[_0xc676('0x28')];}_0x56215c[_0xc676('0x19')](_0x36bd5b)['send'](_0x4b61aa);};}exports[_0xc676('0x29')]=function(_0x230b36,_0x32056c){var _0x4e4834={},_0x278ccc={},_0x2d521d={'count':0x0,'rows':[]};var _0x181e3d=_[_0xc676('0x2a')](db[_0xc676('0x2b')]['rawAttributes'],function(_0x1bd277){return{'name':_0x1bd277[_0xc676('0x2c')],'type':_0x1bd277[_0xc676('0x2d')][_0xc676('0x2e')]};});_0x278ccc[_0xc676('0x2f')]=_['map'](_0x181e3d,_0xc676('0x28'));_0x278ccc[_0xc676('0x30')]=_[_0xc676('0x31')](_0x230b36[_0xc676('0x30')]);_0x278ccc['filters']=_[_0xc676('0x32')](_0x278ccc[_0xc676('0x2f')],_0x278ccc[_0xc676('0x30')]);_0x4e4834[_0xc676('0x33')]=_[_0xc676('0x32')](_0x278ccc[_0xc676('0x2f')],qs[_0xc676('0x34')](_0x230b36[_0xc676('0x30')][_0xc676('0x34')]));_0x4e4834['attributes']=_0x4e4834['attributes']['length']?_0x4e4834[_0xc676('0x33')]:_0x278ccc[_0xc676('0x2f')];if(!_0x230b36[_0xc676('0x30')][_0xc676('0x35')]('nolimit')){_0x4e4834[_0xc676('0x1e')]=qs[_0xc676('0x1e')](_0x230b36[_0xc676('0x30')][_0xc676('0x1e')]);_0x4e4834[_0xc676('0x1d')]=qs[_0xc676('0x1d')](_0x230b36['query']['offset']);}_0x4e4834[_0xc676('0x36')]=qs['sort'](_0x230b36[_0xc676('0x30')][_0xc676('0x37')]);_0x4e4834[_0xc676('0x38')]=qs[_0xc676('0x39')](_['pick'](_0x230b36['query'],_0x278ccc['filters']),_0x181e3d);if(_0x230b36[_0xc676('0x30')][_0xc676('0x3a')]){_0x4e4834[_0xc676('0x38')]=_[_0xc676('0x3b')](_0x4e4834[_0xc676('0x38')],{'$or':_[_0xc676('0x2a')](_0x181e3d,function(_0x30148a){if(_0x30148a[_0xc676('0x2d')]!==_0xc676('0x3c')){var _0x45fad7={};_0x45fad7[_0x30148a[_0xc676('0x28')]]={'$like':'%'+_0x230b36[_0xc676('0x30')][_0xc676('0x3a')]+'%'};return _0x45fad7;}})});}_0x4e4834=_[_0xc676('0x3b')]({},_0x4e4834,_0x230b36[_0xc676('0x3d')]);var _0x2cba1a={'where':_0x4e4834[_0xc676('0x38')]};return db['WhatsappApplication'][_0xc676('0x1c')](_0x2cba1a)[_0xc676('0x25')](function(_0x2020d7){_0x2d521d['count']=_0x2020d7;if(_0x230b36[_0xc676('0x30')][_0xc676('0x3e')]){_0x4e4834[_0xc676('0x3f')]=[{'all':!![]}];}return db[_0xc676('0x2b')][_0xc676('0x40')](_0x4e4834);})[_0xc676('0x25')](function(_0x18bd1a){_0x2d521d['rows']=_0x18bd1a;return _0x2d521d;})[_0xc676('0x25')](respondWithFilteredResult(_0x32056c,_0x4e4834))['catch'](handleError(_0x32056c,null));};exports[_0xc676('0x41')]=function(_0x1e7bb5,_0x5dcfd8){var _0x3fc05b={'raw':!![],'where':{'id':_0x1e7bb5[_0xc676('0x42')]['id']}},_0x3869f6={};_0x3869f6[_0xc676('0x2f')]=_[_0xc676('0x31')](db['WhatsappApplication'][_0xc676('0x43')]);_0x3869f6[_0xc676('0x30')]=_[_0xc676('0x31')](_0x1e7bb5['query']);_0x3869f6[_0xc676('0x39')]=_[_0xc676('0x32')](_0x3869f6[_0xc676('0x2f')],_0x3869f6[_0xc676('0x30')]);_0x3fc05b['attributes']=_[_0xc676('0x32')](_0x3869f6['model'],qs[_0xc676('0x34')](_0x1e7bb5[_0xc676('0x30')][_0xc676('0x34')]));_0x3fc05b['attributes']=_0x3fc05b[_0xc676('0x33')]['length']?_0x3fc05b['attributes']:_0x3869f6[_0xc676('0x2f')];if(_0x1e7bb5['query'][_0xc676('0x3e')]){_0x3fc05b['include']=[{'all':!![]}];}_0x3fc05b=_['merge']({},_0x3fc05b,_0x1e7bb5[_0xc676('0x3d')]);return db['WhatsappApplication'][_0xc676('0x44')](_0x3fc05b)['then'](handleEntityNotFound(_0x5dcfd8,null))[_0xc676('0x25')](respondWithResult(_0x5dcfd8,null))[_0xc676('0x45')](handleError(_0x5dcfd8,null));};exports[_0xc676('0x46')]=function(_0xf2d3a0,_0x4d8d1d){return db['WhatsappApplication'][_0xc676('0x46')](_0xf2d3a0[_0xc676('0x47')],{})['then'](respondWithResult(_0x4d8d1d,0xc9))[_0xc676('0x45')](handleError(_0x4d8d1d,null));};exports[_0xc676('0x23')]=function(_0x59be1a,_0x38d1bc){if(_0x59be1a[_0xc676('0x47')]['id']){delete _0x59be1a[_0xc676('0x47')]['id'];}return db[_0xc676('0x2b')][_0xc676('0x44')]({'where':{'id':_0x59be1a['params']['id']}})[_0xc676('0x25')](handleEntityNotFound(_0x38d1bc,null))[_0xc676('0x25')](saveUpdates(_0x59be1a['body'],null))[_0xc676('0x25')](respondWithResult(_0x38d1bc,null))[_0xc676('0x45')](handleError(_0x38d1bc,null));};exports[_0xc676('0x24')]=function(_0x238ebf,_0x5c643e){return db[_0xc676('0x2b')][_0xc676('0x44')]({'where':{'id':_0x238ebf[_0xc676('0x42')]['id']}})[_0xc676('0x25')](handleEntityNotFound(_0x5c643e,null))['then'](removeEntity(_0x5c643e,null))[_0xc676('0x45')](handleError(_0x5c643e,null));}; \ No newline at end of file +var _0x2b29=['VIRTUAL','where','includeAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','name','index','map','WhatsappApplication','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','merge'];(function(_0x378629,_0x16773c){var _0x2f7778=function(_0x4cc5b0){while(--_0x4cc5b0){_0x378629['push'](_0x378629['shift']());}};_0x2f7778(++_0x16773c);}(_0x2b29,0x163));var _0x92b2=function(_0x3a5046,_0x175a54){_0x3a5046=_0x3a5046-0x0;var _0x304155=_0x2b29[_0x3a5046];return _0x304155;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x92b2('0x0'));var zipdir=require(_0x92b2('0x1'));var jsonpatch=require(_0x92b2('0x2'));var rp=require(_0x92b2('0x3'));var moment=require('moment');var BPromise=require(_0x92b2('0x4'));var Mustache=require(_0x92b2('0x5'));var util=require(_0x92b2('0x6'));var path=require(_0x92b2('0x7'));var sox=require(_0x92b2('0x8'));var csv=require(_0x92b2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92b2('0xa'));var _=require('lodash');var squel=require(_0x92b2('0xb'));var crypto=require(_0x92b2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x92b2('0xd'));var toCsv=require(_0x92b2('0x9'));var querystring=require(_0x92b2('0xe'));var Papa=require(_0x92b2('0xf'));var Redis=require('ioredis');var authService=require(_0x92b2('0x10'));var qs=require(_0x92b2('0x11'));var as=require(_0x92b2('0x12'));var hardwareService=require(_0x92b2('0x13'));var logger=require(_0x92b2('0x14'))(_0x92b2('0x15'));var utils=require(_0x92b2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x92b2('0x17'));var db=require(_0x92b2('0x18'))['db'];function respondWithStatusCode(_0x160e75,_0x58b009){_0x58b009=_0x58b009||0xcc;return function(_0x1b7dd6){if(_0x1b7dd6){return _0x160e75[_0x92b2('0x19')](_0x58b009);}return _0x160e75[_0x92b2('0x1a')](_0x58b009)[_0x92b2('0x1b')]();};}function respondWithResult(_0x12c2d1,_0x179834){_0x179834=_0x179834||0xc8;return function(_0x52ef07){if(_0x52ef07){return _0x12c2d1[_0x92b2('0x1a')](_0x179834)['json'](_0x52ef07);}};}function respondWithFilteredResult(_0x299a9d,_0x2be641){return function(_0x2ac0c8){if(_0x2ac0c8){var _0x4899fa=typeof _0x2be641['offset']===_0x92b2('0x1c')&&typeof _0x2be641['limit']===_0x92b2('0x1c');var _0x4d51db=_0x2ac0c8[_0x92b2('0x1d')];var _0x1a7866=_0x4899fa?0x0:_0x2be641[_0x92b2('0x1e')];var _0xceaa2f=_0x4899fa?_0x2ac0c8[_0x92b2('0x1d')]:_0x2be641[_0x92b2('0x1e')]+_0x2be641[_0x92b2('0x1f')];var _0x692704;if(_0xceaa2f>=_0x4d51db){_0xceaa2f=_0x4d51db;_0x692704=0xc8;}else{_0x692704=0xce;}_0x299a9d[_0x92b2('0x1a')](_0x692704);return _0x299a9d[_0x92b2('0x20')](_0x92b2('0x21'),_0x1a7866+'-'+_0xceaa2f+'/'+_0x4d51db)[_0x92b2('0x22')](_0x2ac0c8);}return null;};}function patchUpdates(_0x20395d){return function(_0x422ab6){try{jsonpatch[_0x92b2('0x23')](_0x422ab6,_0x20395d,!![]);}catch(_0x4d2850){return BPromise[_0x92b2('0x24')](_0x4d2850);}return _0x422ab6['save']();};}function saveUpdates(_0x2f5d19,_0xe6f05f){return function(_0x2b372c){if(_0x2b372c){return _0x2b372c[_0x92b2('0x25')](_0x2f5d19)[_0x92b2('0x26')](function(_0x574c3e){return _0x574c3e;});}return null;};}function removeEntity(_0x547848,_0x131b6b){return function(_0x31567c){if(_0x31567c){return _0x31567c[_0x92b2('0x27')]()[_0x92b2('0x26')](function(){_0x547848[_0x92b2('0x1a')](0xcc)[_0x92b2('0x1b')]();});}};}function handleEntityNotFound(_0x15faf5,_0x49b81e){return function(_0xbbbfa7){if(!_0xbbbfa7){_0x15faf5['sendStatus'](0x194);}return _0xbbbfa7;};}function handleError(_0xd31d50,_0x57c1ff){_0x57c1ff=_0x57c1ff||0x1f4;return function(_0x183f81){logger['error'](_0x183f81['stack']);if(_0x183f81[_0x92b2('0x28')]){delete _0x183f81[_0x92b2('0x28')];}_0xd31d50[_0x92b2('0x1a')](_0x57c1ff)['send'](_0x183f81);};}exports[_0x92b2('0x29')]=function(_0x482706,_0x124a0d){var _0x2c19f6={},_0x1f40c0={},_0x2d528d={'count':0x0,'rows':[]};var _0x368998=_[_0x92b2('0x2a')](db[_0x92b2('0x2b')]['rawAttributes'],function(_0x4dda21){return{'name':_0x4dda21['fieldName'],'type':_0x4dda21[_0x92b2('0x2c')][_0x92b2('0x2d')]};});_0x1f40c0[_0x92b2('0x2e')]=_['map'](_0x368998,'name');_0x1f40c0[_0x92b2('0x2f')]=_[_0x92b2('0x30')](_0x482706[_0x92b2('0x2f')]);_0x1f40c0[_0x92b2('0x31')]=_[_0x92b2('0x32')](_0x1f40c0['model'],_0x1f40c0['query']);_0x2c19f6['attributes']=_[_0x92b2('0x32')](_0x1f40c0[_0x92b2('0x2e')],qs['fields'](_0x482706[_0x92b2('0x2f')][_0x92b2('0x33')]));_0x2c19f6[_0x92b2('0x34')]=_0x2c19f6[_0x92b2('0x34')][_0x92b2('0x35')]?_0x2c19f6[_0x92b2('0x34')]:_0x1f40c0[_0x92b2('0x2e')];if(!_0x482706[_0x92b2('0x2f')]['hasOwnProperty'](_0x92b2('0x36'))){_0x2c19f6[_0x92b2('0x1f')]=qs[_0x92b2('0x1f')](_0x482706['query'][_0x92b2('0x1f')]);_0x2c19f6['offset']=qs[_0x92b2('0x1e')](_0x482706[_0x92b2('0x2f')]['offset']);}_0x2c19f6['order']=qs[_0x92b2('0x37')](_0x482706[_0x92b2('0x2f')]['sort']);_0x2c19f6['where']=qs[_0x92b2('0x31')](_[_0x92b2('0x38')](_0x482706['query'],_0x1f40c0[_0x92b2('0x31')]),_0x368998);if(_0x482706[_0x92b2('0x2f')][_0x92b2('0x39')]){_0x2c19f6['where']=_[_0x92b2('0x3a')](_0x2c19f6['where'],{'$or':_[_0x92b2('0x2a')](_0x368998,function(_0x23609c){if(_0x23609c[_0x92b2('0x2c')]!==_0x92b2('0x3b')){var _0x181b88={};_0x181b88[_0x23609c[_0x92b2('0x28')]]={'$like':'%'+_0x482706['query'][_0x92b2('0x39')]+'%'};return _0x181b88;}})});}_0x2c19f6=_[_0x92b2('0x3a')]({},_0x2c19f6,_0x482706['options']);var _0x2e670e={'where':_0x2c19f6[_0x92b2('0x3c')]};return db[_0x92b2('0x2b')][_0x92b2('0x1d')](_0x2e670e)[_0x92b2('0x26')](function(_0x312e1c){_0x2d528d[_0x92b2('0x1d')]=_0x312e1c;if(_0x482706['query'][_0x92b2('0x3d')]){_0x2c19f6['include']=[{'all':!![]}];}return db[_0x92b2('0x2b')]['findAll'](_0x2c19f6);})[_0x92b2('0x26')](function(_0xefc848){_0x2d528d[_0x92b2('0x3e')]=_0xefc848;return _0x2d528d;})['then'](respondWithFilteredResult(_0x124a0d,_0x2c19f6))[_0x92b2('0x3f')](handleError(_0x124a0d,null));};exports[_0x92b2('0x40')]=function(_0x44cf73,_0x5ca038){var _0x28297f={'raw':!![],'where':{'id':_0x44cf73[_0x92b2('0x41')]['id']}},_0x19fe8f={};_0x19fe8f[_0x92b2('0x2e')]=_['keys'](db['WhatsappApplication']['rawAttributes']);_0x19fe8f[_0x92b2('0x2f')]=_[_0x92b2('0x30')](_0x44cf73[_0x92b2('0x2f')]);_0x19fe8f['filters']=_[_0x92b2('0x32')](_0x19fe8f['model'],_0x19fe8f[_0x92b2('0x2f')]);_0x28297f[_0x92b2('0x34')]=_[_0x92b2('0x32')](_0x19fe8f[_0x92b2('0x2e')],qs[_0x92b2('0x33')](_0x44cf73[_0x92b2('0x2f')][_0x92b2('0x33')]));_0x28297f[_0x92b2('0x34')]=_0x28297f[_0x92b2('0x34')][_0x92b2('0x35')]?_0x28297f[_0x92b2('0x34')]:_0x19fe8f[_0x92b2('0x2e')];if(_0x44cf73['query'][_0x92b2('0x3d')]){_0x28297f['include']=[{'all':!![]}];}_0x28297f=_[_0x92b2('0x3a')]({},_0x28297f,_0x44cf73['options']);return db[_0x92b2('0x2b')][_0x92b2('0x42')](_0x28297f)[_0x92b2('0x26')](handleEntityNotFound(_0x5ca038,null))['then'](respondWithResult(_0x5ca038,null))[_0x92b2('0x3f')](handleError(_0x5ca038,null));};exports['create']=function(_0xd89d2,_0x10123b){return db['WhatsappApplication'][_0x92b2('0x43')](_0xd89d2[_0x92b2('0x44')],{})[_0x92b2('0x26')](respondWithResult(_0x10123b,0xc9))[_0x92b2('0x3f')](handleError(_0x10123b,null));};exports[_0x92b2('0x25')]=function(_0x7d6dcf,_0x2c4531){if(_0x7d6dcf[_0x92b2('0x44')]['id']){delete _0x7d6dcf[_0x92b2('0x44')]['id'];}return db[_0x92b2('0x2b')][_0x92b2('0x42')]({'where':{'id':_0x7d6dcf[_0x92b2('0x41')]['id']}})[_0x92b2('0x26')](handleEntityNotFound(_0x2c4531,null))[_0x92b2('0x26')](saveUpdates(_0x7d6dcf['body'],null))[_0x92b2('0x26')](respondWithResult(_0x2c4531,null))[_0x92b2('0x3f')](handleError(_0x2c4531,null));};exports['destroy']=function(_0x5a62f7,_0x4987c3){return db[_0x92b2('0x2b')][_0x92b2('0x42')]({'where':{'id':_0x5a62f7['params']['id']}})['then'](handleEntityNotFound(_0x4987c3,null))['then'](removeEntity(_0x4987c3,null))[_0x92b2('0x3f')](handleError(_0x4987c3,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index c7b4224..3b6d787 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 _0xaa5c=['../../config/logger','api','rimraf','exports','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x434e41,_0x142830){_0x434e41=_0x434e41-0x0;var _0x56d302=_0xaa5c[_0x434e41];return _0x56d302;};'use strict';var _=require(_0xcaa5('0x0'));var util=require(_0xcaa5('0x1'));var logger=require(_0xcaa5('0x2'))(_0xcaa5('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(_0xcaa5('0x4'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module[_0xcaa5('0x5')]=function(_0x42afd4,_0x1877d0){return _0x42afd4['define'](_0xcaa5('0x6'),attributes,{'tableName':_0xcaa5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcaa5('0x8'),'collate':_0xcaa5('0x9')});}; \ No newline at end of file +var _0x5183=['../../config/logger','bluebird','request-promise','path','rimraf','exports','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x334f9a,_0x542f01){var _0x2b219d=function(_0x25bb3e){while(--_0x25bb3e){_0x334f9a['push'](_0x334f9a['shift']());}};_0x2b219d(++_0x542f01);}(_0x5183,0x13e));var _0x3518=function(_0xd69c0b,_0x4070ce){_0xd69c0b=_0xd69c0b-0x0;var _0x21265e=_0x5183[_0xd69c0b];return _0x21265e;};'use strict';var _=require(_0x3518('0x0'));var util=require(_0x3518('0x1'));var logger=require(_0x3518('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3518('0x3'));var rp=require(_0x3518('0x4'));var fs=require('fs');var path=require(_0x3518('0x5'));var rimraf=require(_0x3518('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module[_0x3518('0x7')]=function(_0x1031a9,_0x2c019c){return _0x1031a9['define']('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3518('0x8'),'collate':_0x3518('0x9')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 3896ded..cf70348 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 _0x17ba=['code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x50df10,_0x41ca50){var _0x4411b0=function(_0x30a414){while(--_0x30a414){_0x50df10['push'](_0x50df10['shift']());}};_0x4411b0(++_0x41ca50);}(_0x17ba,0xab));var _0xa17b=function(_0x3d2636,_0x4d5726){_0x3d2636=_0x3d2636-0x0;var _0x3b6e82=_0x17ba[_0x3d2636];return _0x3b6e82;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var moment=require('moment');var BPromise=require(_0xa17b('0x2'));var rs=require(_0xa17b('0x3'));var fs=require('fs');var Redis=require(_0xa17b('0x4'));var db=require(_0xa17b('0x5'))['db'];var utils=require(_0xa17b('0x6'));var logger=require(_0xa17b('0x7'))(_0xa17b('0x8'));var config=require(_0xa17b('0x9'));var jayson=require(_0xa17b('0xa'));var client=jayson[_0xa17b('0xb')][_0xa17b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e3d43,_0x1957be,_0x57f9cd){return new BPromise(function(_0x2ca4d3,_0x17d1d2){return client[_0xa17b('0xd')](_0x2e3d43,_0x57f9cd)[_0xa17b('0xe')](function(_0x15bdfc){logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));logger[_0xa17b('0x11')](_0xa17b('0x12'),_0x1957be,_0xa17b('0x10'),JSON[_0xa17b('0x13')](_0x15bdfc));if(_0x15bdfc[_0xa17b('0x14')]){if(_0x15bdfc['error'][_0xa17b('0x15')]===0x1f4){logger[_0xa17b('0x14')](_0xa17b('0xf'),_0x1957be,_0x15bdfc['error'][_0xa17b('0x16')]);return _0x17d1d2(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}logger[_0xa17b('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x1957be,_0x15bdfc[_0xa17b('0x14')]['message']);return _0x2ca4d3(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}else{logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));_0x2ca4d3(_0x15bdfc[_0xa17b('0x17')][_0xa17b('0x16')]);}})['catch'](function(_0x98a295){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x1957be,_0x98a295);_0x17d1d2(_0x98a295);});});} \ No newline at end of file +var _0x8d0e=['info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then'];(function(_0x1bb853,_0x24e908){var _0x564177=function(_0x4e8133){while(--_0x4e8133){_0x1bb853['push'](_0x1bb853['shift']());}};_0x564177(++_0x24e908);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x306ab0,_0x36c59d){_0x306ab0=_0x306ab0-0x0;var _0x3fdebd=_0x8d0e[_0x306ab0];return _0x3fdebd;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var moment=require(_0xe8d0('0x2'));var BPromise=require(_0xe8d0('0x3'));var rs=require(_0xe8d0('0x4'));var fs=require('fs');var Redis=require(_0xe8d0('0x5'));var db=require(_0xe8d0('0x6'))['db'];var utils=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('rpc');var config=require(_0xe8d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe8d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92483d,_0x469d37,_0xcc03d0){return new BPromise(function(_0x2b6dce,_0x13aa63){return client[_0xe8d0('0xb')](_0x92483d,_0xcc03d0)[_0xe8d0('0xc')](function(_0x5605a0){logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,_0xe8d0('0xf'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x469d37,_0xe8d0('0xf'),JSON[_0xe8d0('0x10')](_0x5605a0));if(_0x5605a0[_0xe8d0('0x11')]){if(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x12')]===0x1f4){logger[_0xe8d0('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x13aa63(_0x5605a0['error'][_0xe8d0('0x13')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x2b6dce(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);}else{logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,'request\x20sent');_0x2b6dce(_0x5605a0[_0xe8d0('0x14')]['message']);}})[_0xe8d0('0x15')](function(_0x3c526c){logger[_0xe8d0('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x469d37,_0x3c526c);_0x13aa63(_0x3c526c);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 004d764..287bef8 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 _0x7d9f=['isAuthenticated','describe','/:id','show','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','index','get'];(function(_0x5354d6,_0x44aa60){var _0x162721=function(_0x525b17){while(--_0x525b17){_0x5354d6['push'](_0x5354d6['shift']());}};_0x162721(++_0x44aa60);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x2ffcb1,_0x559b0d){_0x2ffcb1=_0x2ffcb1-0x0;var _0x333da2=_0x7d9f[_0x2ffcb1];return _0x333da2;};'use strict';var multer=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var path=require(_0xf7d9('0x2'));var timeout=require(_0xf7d9('0x3'));var express=require(_0xf7d9('0x4'));var router=express['Router']();var fs_extra=require(_0xf7d9('0x5'));var auth=require(_0xf7d9('0x6'));var interaction=require(_0xf7d9('0x7'));var config=require(_0xf7d9('0x8'));var controller=require(_0xf7d9('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf7d9('0xa')]);router[_0xf7d9('0xb')]('/describe',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0xd')]);router['get'](_0xf7d9('0xe'),auth['isAuthenticated'](),controller[_0xf7d9('0xf')]);router[_0xf7d9('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0xf7d9('0x10')]);router[_0xf7d9('0xb')](_0xf7d9('0x11'),auth['isAuthenticated'](),controller['download']);router[_0xf7d9('0x12')]('/',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0x13')]);router[_0xf7d9('0x12')]('/:id/messages',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0x14')]);router[_0xf7d9('0x12')](_0xf7d9('0x15'),auth['isAuthenticated'](),interaction[_0xf7d9('0x16')](_0xf7d9('0x17'),_0xf7d9('0x18')),controller[_0xf7d9('0x19')]);router['put'](_0xf7d9('0xe'),auth[_0xf7d9('0xc')](),interaction[_0xf7d9('0x16')]('whatsapp','whatsappinteraction:update'),controller[_0xf7d9('0x1a')]);router[_0xf7d9('0x1b')](_0xf7d9('0xe'),auth['isAuthenticated'](),interaction[_0xf7d9('0x16')](_0xf7d9('0x17'),'whatsappinteraction:destroy'),controller[_0xf7d9('0x1c')]);router['delete'](_0xf7d9('0x15'),auth[_0xf7d9('0xc')](),controller['removeTags']);module[_0xf7d9('0x1d')]=router; \ No newline at end of file +var _0xba34=['removeTags','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','destroy','delete'];(function(_0x8abadf,_0x6c33bf){var _0x4b6012=function(_0x1e2263){while(--_0x1e2263){_0x8abadf['push'](_0x8abadf['shift']());}};_0x4b6012(++_0x6c33bf);}(_0xba34,0x119));var _0x4ba3=function(_0x45b15b,_0x33c4ff){_0x45b15b=_0x45b15b-0x0;var _0xb81294=_0xba34[_0x45b15b];return _0xb81294;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0x8')](_0x4ba3('0xe'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x8')]('/:id/download',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x10')]);router['post']('/',auth[_0x4ba3('0x9')](),controller['create']);router[_0x4ba3('0x11')]('/:id/messages',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x12')]);router[_0x4ba3('0x11')](_0x4ba3('0x13'),auth[_0x4ba3('0x9')](),interaction[_0x4ba3('0x14')](_0x4ba3('0x15'),_0x4ba3('0x16')),controller[_0x4ba3('0x17')]);router[_0x4ba3('0x18')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),interaction[_0x4ba3('0x14')](_0x4ba3('0x15'),_0x4ba3('0x19')),controller[_0x4ba3('0x1a')]);router['delete'](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),interaction[_0x4ba3('0x14')](_0x4ba3('0x15'),'whatsappinteraction:destroy'),controller[_0x4ba3('0x1b')]);router[_0x4ba3('0x1c')](_0x4ba3('0x13'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x1d')]);module[_0x4ba3('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 15ac3ea..c01054e 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 _0xe626=['STRING','DATE','ENUM','sequelize','moment','exports','BOOLEAN'];(function(_0x2c0830,_0x1df98b){var _0x3df376=function(_0x38e519){while(--_0x38e519){_0x2c0830['push'](_0x2c0830['shift']());}};_0x3df376(++_0x1df98b);}(_0xe626,0x9d));var _0x6e62=function(_0x45d2bd,_0x256e51){_0x45d2bd=_0x45d2bd-0x0;var _0x3a5000=_0xe626[_0x45d2bd];return _0x3a5000;};'use strict';var Sequelize=require(_0x6e62('0x0'));var moment=require(_0x6e62('0x1'));module[_0x6e62('0x2')]={'closed':{'type':Sequelize[_0x6e62('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6e62('0x4')]},'secondDisposition':{'type':Sequelize[_0x6e62('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6e62('0x4')]},'note':{'type':Sequelize[_0x6e62('0x4')]},'phone':{'type':Sequelize[_0x6e62('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6e62('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x6e62('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6e62('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc9b9=['STRING','ENUM','out','exports','BOOLEAN','DATE'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc9b9,0x18f));var _0x9c9b=function(_0x6eb833,_0x2bb5e5){_0x6eb833=_0x6eb833-0x0;var _0xdfc38c=_0xc9b9[_0x6eb833];return _0xdfc38c;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x9c9b('0x0')]={'closed':{'type':Sequelize[_0x9c9b('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9c9b('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x9c9b('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9c9b('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x9c9b('0x4')]('in',_0x9c9b('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9c9b('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index c6b3bcc..9018938 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 _0xb95a=['i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','catch','show','intersection','includeAll','include','options','create','body','params','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','emit','removeTags','download','join','root','files','attachments','CmContact','firstName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closed','closedAt','disposition','basename','existsSync','pipe','createWriteStream','out','System','lastName','renderFile','views','downloadInteraction.ejs','log','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','index','WhatsappInteraction','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','Contact','operator','$substring','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?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','role','user','i.WhatsappAccountId\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'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xb95a,0x13b));var _0xab95=function(_0x2cad75,_0x32c075){_0x2cad75=_0x2cad75-0x0;var _0x502da4=_0xb95a[_0x2cad75];return _0x502da4;};'use strict';var emlformat=require(_0xab95('0x0'));var rimraf=require(_0xab95('0x1'));var zipdir=require(_0xab95('0x2'));var jsonpatch=require(_0xab95('0x3'));var rp=require(_0xab95('0x4'));var moment=require(_0xab95('0x5'));var BPromise=require(_0xab95('0x6'));var Mustache=require(_0xab95('0x7'));var util=require(_0xab95('0x8'));var path=require(_0xab95('0x9'));var sox=require(_0xab95('0xa'));var csv=require(_0xab95('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab95('0xc'));var _=require(_0xab95('0xd'));var squel=require(_0xab95('0xe'));var crypto=require('crypto');var jsforce=require(_0xab95('0xf'));var deskjs=require(_0xab95('0x10'));var toCsv=require(_0xab95('0xb'));var querystring=require(_0xab95('0x11'));var Papa=require(_0xab95('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xab95('0x13'));var as=require(_0xab95('0x14'));var pdf=require(_0xab95('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xab95('0x16'))(_0xab95('0x17'));var utils=require(_0xab95('0x18'));var config=require(_0xab95('0x19'));var licenseUtil=require(_0xab95('0x1a'));var db=require(_0xab95('0x1b'))['db'];config[_0xab95('0x1c')]=_[_0xab95('0x1d')](config[_0xab95('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xab95('0x1e'))(new Redis(config[_0xab95('0x1c')]));require(_0xab95('0x1f'))[_0xab95('0x20')](socket);function respondWithStatusCode(_0x25118f,_0x4cb628){_0x4cb628=_0x4cb628||0xcc;return function(_0x2158ea){if(_0x2158ea){return _0x25118f[_0xab95('0x21')](_0x4cb628);}return _0x25118f[_0xab95('0x22')](_0x4cb628)[_0xab95('0x23')]();};}function respondWithResult(_0x4dcbd3,_0x7d66d7){_0x7d66d7=_0x7d66d7||0xc8;return function(_0x182d34){if(_0x182d34){return _0x4dcbd3[_0xab95('0x22')](_0x7d66d7)[_0xab95('0x24')](_0x182d34);}};}function respondWithFilteredResult(_0x484f03,_0x1e2fc3){return function(_0x5dae74){if(_0x5dae74){var _0x3874a2=typeof _0x1e2fc3[_0xab95('0x25')]===_0xab95('0x26')&&typeof _0x1e2fc3[_0xab95('0x27')]===_0xab95('0x26');var _0x5e0fd4=_0x5dae74['count'];var _0x1295a9=_0x3874a2?0x0:_0x1e2fc3[_0xab95('0x25')];var _0xbccb79=_0x3874a2?_0x5dae74[_0xab95('0x28')]:_0x1e2fc3[_0xab95('0x25')]+_0x1e2fc3[_0xab95('0x27')];var _0x33a79a;if(_0xbccb79>=_0x5e0fd4){_0xbccb79=_0x5e0fd4;_0x33a79a=0xc8;}else{_0x33a79a=0xce;}_0x484f03['status'](_0x33a79a);return _0x484f03[_0xab95('0x29')](_0xab95('0x2a'),_0x1295a9+'-'+_0xbccb79+'/'+_0x5e0fd4)[_0xab95('0x24')](_0x5dae74);}return null;};}function patchUpdates(_0x49e89e){return function(_0x47857e){try{jsonpatch[_0xab95('0x2b')](_0x47857e,_0x49e89e,!![]);}catch(_0x19c6d4){return BPromise[_0xab95('0x2c')](_0x19c6d4);}return _0x47857e[_0xab95('0x2d')]();};}function saveUpdates(_0x5e0c45,_0x399185){return function(_0x2f9f5a){if(_0x2f9f5a){return _0x2f9f5a[_0xab95('0x2e')](_0x5e0c45)[_0xab95('0x2f')](function(_0x3430d8){return _0x3430d8;});}return null;};}function removeEntity(_0x3c3178,_0x55108e){return function(_0x53e14f){if(_0x53e14f){return _0x53e14f[_0xab95('0x30')]()['then'](function(){_0x3c3178[_0xab95('0x22')](0xcc)[_0xab95('0x23')]();});}};}function handleEntityNotFound(_0xf0caeb,_0x39f683){return function(_0x1a0245){if(!_0x1a0245){_0xf0caeb[_0xab95('0x21')](0x194);}return _0x1a0245;};}function handleError(_0x3f8b25,_0x3efc76){_0x3efc76=_0x3efc76||0x1f4;return function(_0x598eff){logger['error'](_0x598eff['stack']);if(_0x598eff[_0xab95('0x31')]){delete _0x598eff['name'];}_0x3f8b25[_0xab95('0x22')](_0x3efc76)[_0xab95('0x32')](_0x598eff);};}function getInteractionUsers(_0x3313a8,_0x47dff8){return new BPromise(function(_0x14c3a5,_0x52d288){try{if(_0x47dff8[_0x3313a8['id']]){_0x3313a8[_0xab95('0x33')]=_[_0xab95('0x34')](_0x47dff8[_0x3313a8['id']],function(_0x34fc8e){return{'id':_0x34fc8e['id'],'fullname':_0x34fc8e[_0xab95('0x35')]};});}}catch(_0x3508ab){_0x52d288(_0x3508ab);}_0x14c3a5(_0x3313a8);});}function getInteractionTags(_0x14fe8f,_0x359470){return new BPromise(function(_0x1e1dca,_0xe65789){try{if(_0x14fe8f[_0xab95('0x36')]){_0x14fe8f[_0xab95('0x37')]=[];_0x14fe8f[_0xab95('0x36')][_0xab95('0x38')](',')[_0xab95('0x39')](function(_0x5acd62){_0x14fe8f[_0xab95('0x37')][_0xab95('0x3a')](_0x359470[_0x5acd62]);});}delete _0x14fe8f[_0xab95('0x36')];}catch(_0x4778d6){_0xe65789(_0x4778d6);}_0x1e1dca(_0x14fe8f);});}function updateWhatsappInteraction(_0x27a0e3,_0x18e3ef,_0x440f2b){return new BPromise(function(_0x3948e5,_0xe9122e){return getInteractionUsers(_0x27a0e3,_0x440f2b)[_0xab95('0x2f')](function(_0x211267){return getInteractionTags(_0x211267,_0x18e3ef);})['then'](function(_0x2f459d){_0x3948e5(_0x2f459d);})['catch'](function(_0x51389d){_0xe9122e(_0x51389d);});});}exports[_0xab95('0x3b')]=function(_0x4fa177,_0x2139d7){var _0x5e220d={},_0x1e605f={},_0x1c893c={'count':0x0,'rows':[]};var _0x323308=_[_0xab95('0x34')](db[_0xab95('0x3c')][_0xab95('0x3d')],function(_0x5c079d){return{'name':_0x5c079d['fieldName'],'type':_0x5c079d[_0xab95('0x3e')][_0xab95('0x3f')]};});_0x1e605f[_0xab95('0x40')]=_['map'](_0x323308,_0xab95('0x31'));_0x1e605f[_0xab95('0x41')]=_[_0xab95('0x42')](_0x4fa177[_0xab95('0x41')]);_0x1e605f[_0xab95('0x43')]=_['intersection'](_0x1e605f[_0xab95('0x40')],_0x1e605f[_0xab95('0x41')]);_0x5e220d[_0xab95('0x44')]=_['intersection'](_0x1e605f[_0xab95('0x40')],qs['fields'](_0x4fa177['query'][_0xab95('0x45')]));_0x5e220d[_0xab95('0x44')]=_0x5e220d['attributes'][_0xab95('0x46')]?_0x5e220d[_0xab95('0x44')]:_0x1e605f['model'];if(!_0x4fa177['query'][_0xab95('0x47')](_0xab95('0x48'))){_0x5e220d[_0xab95('0x27')]=qs[_0xab95('0x27')](_0x4fa177['query']['limit']);_0x5e220d['offset']=qs['offset'](_0x4fa177['query'][_0xab95('0x25')]);}_0x5e220d[_0xab95('0x49')]=qs[_0xab95('0x4a')](_0x4fa177['query'][_0xab95('0x4a')]);_0x5e220d[_0xab95('0x4b')]=qs[_0xab95('0x43')](_[_0xab95('0x4c')](_0x4fa177[_0xab95('0x41')],_0x1e605f['filters']),_0x323308);var _0x51a1d8=[];var _0xf27cf1=squel[_0xab95('0x4d')]()[_0xab95('0x4e')]('id')[_0xab95('0x4e')](_0xab95('0x31'))[_0xab95('0x4e')](_0xab95('0x4f'))[_0xab95('0x50')](_0xab95('0x51'));var _0x2825aa=squel[_0xab95('0x4d')]()['field']('u.id')[_0xab95('0x4e')](_0xab95('0x52'))[_0xab95('0x4e')](_0xab95('0x53'))[_0xab95('0x50')](_0xab95('0x54'),'ui')[_0xab95('0x55')](_0xab95('0x56'),'u',_0xab95('0x57'));var _0x56be0d=squel[_0xab95('0x4d')]()['from']('whatsapp_interactions','i')[_0xab95('0x55')](_0xab95('0x58'),'c',_0xab95('0x59'))['left_join'](_0xab95('0x56'),'o',_0xab95('0x5a'))['left_join'](_0xab95('0x5b'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xab95('0x55')](_0xab95('0x5c'),'me',_0xab95('0x5d'))['left_join']('whatsapp_interaction_has_tags','it',_0xab95('0x5e'))[_0xab95('0x55')](_0xab95('0x51'),'t',_0xab95('0x5f'));var _0x14541b=squel[_0xab95('0x60')]();var _0x5fab0=[];var _0xeb6be1=squel[_0xab95('0x60')]();var _0x540e60;if(_0x4fa177['query'][_0xab95('0x61')]){_0x540e60=as[_0xab95('0x62')](_0x4fa177[_0xab95('0x41')][_0xab95('0x61')]);var _0x298d50=_0x540e60[_0xab95('0x63')];for(var _0x304a09=0x0;_0x304a09<_0x540e60[_0xab95('0x64')]['length'];_0x304a09++){var _0xb272f6=_0x540e60[_0xab95('0x64')][_0x304a09];var _0xefe114='i';var _0x523695=_[_0xab95('0x65')](_0x323308,[_0xab95('0x31'),_0xb272f6[_0xab95('0x4e')]]);if(!_0x523695){switch(_0xb272f6['field']){case'unreadMessages':if(_0xb272f6[_0xab95('0x66')]==0x1){_0x56be0d[_0xab95('0x67')]('`'+_0xb272f6['field']+_0xab95('0x68'));}else{_0x56be0d[_0xab95('0x67')]('`'+_0xb272f6[_0xab95('0x4e')]+'`\x20>\x200');}break;case _0xab95('0x69'):if(_0xb272f6[_0xab95('0x6a')]===_0xab95('0x6b')){if(_0xb272f6[_0xab95('0x66')]['split']('\x20')['length']>0x1){_0x14541b[_0x298d50](_0xab95('0x6c'),qs['getFullTextValue'](_0xb272f6[_0xab95('0x66')]),null);}else{var _0x3a91cf='%'+_0xb272f6[_0xab95('0x66')]+'%';_0x14541b[_0x298d50](_0xab95('0x6d'),_0x3a91cf,_0x3a91cf,_0x3a91cf);}}else{_0x523695=_[_0xab95('0x65')](_0x323308,[_0xab95('0x31'),'ContactId']);_0xb272f6[_0xab95('0x4e')]=_0xab95('0x6e');_0x2eb503=as[_0xab95('0x6f')](_0xefe114,_0x523695[_0xab95('0x3e')],_0xb272f6);_0x14541b[_0x298d50](_0x2eb503[_0xab95('0x70')],_0x2eb503[_0xab95('0x66')][_0xab95('0x71')],_0x2eb503['value'][_0xab95('0x23')]);}break;case _0xab95('0x72'):var _0x487364=_0xb272f6['value'][_0xab95('0x38')](',')[_0xab95('0x34')](function(_0x753a6d){return Number(_0x753a6d);});_0x487364[_0xab95('0x39')](function(_0x4e05dc){_0xeb6be1['or'](_0xab95('0x73'),'%,'+_0x4e05dc+',%');});_0x5fab0=_[_0xab95('0x74')](_0x5fab0,_0x487364);break;case _0xab95('0x75'):if(_0xb272f6['operator']===_0xab95('0x6b')){_0x14541b[_0x298d50](_0xab95('0x76'),'%'+_0xb272f6[_0xab95('0x66')]+'%',null);}else{_0x523695=_[_0xab95('0x65')](_0x323308,[_0xab95('0x31'),_0xab95('0x77')]);_0xb272f6[_0xab95('0x4e')]=_0xab95('0x77');_0x2eb503=as[_0xab95('0x6f')](_0xefe114,_0x523695[_0xab95('0x3e')],_0xb272f6);_0x14541b[_0x298d50](_0x2eb503[_0xab95('0x70')],_0x2eb503[_0xab95('0x66')][_0xab95('0x71')],_0x2eb503['value'][_0xab95('0x23')]);}break;case'body':_0x2eb503=as['buildExpression']('me',null,_0xb272f6);_0x14541b[_0x298d50](_0x2eb503[_0xab95('0x70')],_0x2eb503[_0xab95('0x66')][_0xab95('0x71')],_0x2eb503[_0xab95('0x66')][_0xab95('0x23')]);break;}}else{var _0x2eb503=as[_0xab95('0x6f')](_0xefe114,_0x523695[_0xab95('0x3e')],_0xb272f6);_0x14541b[_0x298d50](_0x2eb503[_0xab95('0x70')],_0x2eb503[_0xab95('0x66')][_0xab95('0x71')],_0x2eb503['value'][_0xab95('0x23')]);}}}else{var _0x30f758=_(_0x4fa177[_0xab95('0x41')])[_0xab95('0x42')]()[_0xab95('0x34')](function(_0x139b4a){return _[_0xab95('0x78')](_0x323308,[_0xab95('0x31'),_0x139b4a])?_0x139b4a:undefined;})[_0xab95('0x79')]()['value']();if(!_[_0xab95('0x7a')](_0x30f758)){_0x30f758['forEach'](function(_0x53ebfb){if(_0x53ebfb===_0xab95('0x7b')){_0x56be0d[_0xab95('0x4b')](_0xab95('0x7c'),[][_0xab95('0x7d')](_0x4fa177[_0xab95('0x41')][_0x53ebfb]));}else if(_0x53ebfb==='createdAt'){var _0x186d26=JSON[_0xab95('0x7e')](_0x4fa177[_0xab95('0x41')][_0x53ebfb])['$gte'];var _0x5658cc=JSON['parse'](_0x4fa177[_0xab95('0x41')][_0x53ebfb])['$lte'];_0x56be0d[_0xab95('0x4b')](_0xab95('0x7f'),_0x186d26,_0x5658cc);}else{if(_0x4fa177['query'][_0x53ebfb]===_0xab95('0x80')){_0x56be0d[_0xab95('0x4b')]('i.'+_0x53ebfb+_0xab95('0x81'));}else{_0x56be0d[_0xab95('0x4b')]('i.'+_0x53ebfb+_0xab95('0x82'),_0x4fa177[_0xab95('0x41')][_0x53ebfb]);}}});}if(_0x4fa177['query']['read']){if(_0x4fa177['query']['read']==0x1){_0x56be0d[_0xab95('0x67')](_0xab95('0x83'));}else{_0x56be0d[_0xab95('0x67')](_0xab95('0x84'));}}if(_0x4fa177[_0xab95('0x41')]['tag']){_0x5fab0=_['isArray'](_0x4fa177[_0xab95('0x41')][_0xab95('0x85')])?_0x4fa177[_0xab95('0x41')][_0xab95('0x85')]:new Array(_0x4fa177[_0xab95('0x41')][_0xab95('0x85')]);_0x5fab0[_0xab95('0x39')](function(_0xe128a){_0xeb6be1['or'](_0xab95('0x73'),'%,'+_0xe128a+',%');});}if(_0x4fa177[_0xab95('0x41')][_0xab95('0x86')]){var _0x3bb41a=_0x4fa177[_0xab95('0x41')][_0xab95('0x86')][_0xab95('0x87')]('\x5c','\x5c\x5c')[_0xab95('0x87')](/'/g,'\x27\x27');if(qs[_0xab95('0x88')](_0x3bb41a)){_0x14541b['or'](_0xab95('0x89'),_0x3bb41a+'%')['or']('i.phone\x20LIKE\x20?',_0x3bb41a+'%');}else{_0x14541b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xab95('0x8a')](_0x3bb41a))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3bb41a+'%');}}}_0x56be0d['where'](_0x14541b);_0x56be0d['group'](_0xab95('0x8b'));var _0x2c78a3={'type':db[_0xab95('0x8c')]['QueryTypes'][_0xab95('0x8d')],'raw':!![]};var _0x50a754=_0x56be0d['clone']();_0x50a754[_0xab95('0x4e')]('i.id');_0x50a754['field'](_0xab95('0x8e'),_0xab95('0x8f'));if(_0x5e220d[_0xab95('0x49')]){_0x5e220d['order']['forEach'](function(_0x234466){var _0x504b3e=_0x234466[0x0]===_0xab95('0x90')?_0x234466[0x0]:'i.'+_0x234466[0x0];_0x56be0d[_0xab95('0x49')](_0x504b3e,_0x234466[0x1]===_0xab95('0x91')?![]:!![]);});}if(!_[_0xab95('0x7a')](_0x5fab0)){_0x56be0d['having'](_0xeb6be1);_0x50a754['where'](_0xab95('0x92'),_0x5fab0);}BPromise[_0xab95('0x93')]()['then'](function(){if(!_0x540e60){if(_0x4fa177[_0xab95('0x41')][_0xab95('0x7b')])return;_0x50a754['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x56be0d[_0xab95('0x4b')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4fa177['user'][_0xab95('0x94')]!=='agent')return;return _0x4fa177[_0xab95('0x95')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0xab95('0x2f')](function(_0x3f0fe9){if(_[_0xab95('0x7a')](_0x3f0fe9)){_0x50a754[_0xab95('0x4b')](_0xab95('0x96'));_0x56be0d[_0xab95('0x4b')](_0xab95('0x96'));}else{_0x50a754[_0xab95('0x4b')](_0xab95('0x7c'),_[_0xab95('0x34')](_0x3f0fe9,'id'));_0x56be0d[_0xab95('0x4b')](_0xab95('0x7c'),_[_0xab95('0x34')](_0x3f0fe9,'id'));}});})[_0xab95('0x2f')](function(){if(_0x4fa177[_0xab95('0x95')][_0xab95('0x94')]==='agent'&&!_0x540e60&&!_0x4fa177[_0xab95('0x41')]['WhatsappAccountId'])return[];return db[_0xab95('0x97')]['query'](_0x50a754[_0xab95('0x98')](),_0x2c78a3);})['then'](function(_0xb1776c){_0x1c893c[_0xab95('0x28')]=_0xb1776c[_0xab95('0x46')];if(_0x1c893c[_0xab95('0x28')]===0x0)return[];return db[_0xab95('0x97')][_0xab95('0x41')](_0xf27cf1['toString'](),_0x2c78a3)[_0xab95('0x2f')](function(_0x5582e4){_0x51a1d8=_['keyBy'](_0x5582e4,'id');_0x2c78a3=_[_0xab95('0x99')](_0x2c78a3,{'model':db[_0xab95('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4fa177[_0xab95('0x41')][_0xab95('0x45')]){_0x5e220d[_0xab95('0x44')]['forEach'](function(_0x31018f){_0x56be0d[_0xab95('0x4e')]('i.'+_0x31018f);});}else{_0x56be0d[_0xab95('0x4e')](_0xab95('0x8e'),_0xab95('0x8f'));_0x56be0d[_0xab95('0x4e')](_0xab95('0x9a'),_0xab95('0x9b'));_0x56be0d[_0xab95('0x4e')](_0xab95('0x9c'),_0xab95('0x9d'));_0x56be0d[_0xab95('0x4e')](_0xab95('0x9e'),_0xab95('0x90'));_0x56be0d[_0xab95('0x4e')](_0xab95('0x9f'));_0x56be0d[_0xab95('0x4e')](_0xab95('0xa0'),'Contact.firstName');_0x56be0d[_0xab95('0x4e')](_0xab95('0xa1'),_0xab95('0xa2'));_0x56be0d['field'](_0xab95('0xa3'),_0xab95('0xa4'));_0x56be0d[_0xab95('0x4e')]('c.phone',_0xab95('0xa5'));_0x56be0d[_0xab95('0x4e')](_0xab95('0xa6'),'Contact.mobile');_0x56be0d['field'](_0xab95('0xa7'),_0xab95('0xa8'));_0x56be0d[_0xab95('0x4e')](_0xab95('0xa9'),_0xab95('0xaa'));_0x56be0d[_0xab95('0x4e')](_0xab95('0xab'),_0xab95('0xac'));_0x56be0d[_0xab95('0x4e')](_0xab95('0xad'),'TagIds');}if(_0x5e220d[_0xab95('0x27')])_0x56be0d['limit'](_0x5e220d[_0xab95('0x27')]);if(_0x5e220d[_0xab95('0x25')])_0x56be0d[_0xab95('0x25')](_0x5e220d['offset']);return db['sequelize'][_0xab95('0x41')](_0x56be0d[_0xab95('0x98')](),_0x2c78a3);})[_0xab95('0x2f')](function(_0xe0e262){if(_0xe0e262[_0xab95('0x46')]>0x0)_0x2825aa['where'](_0xab95('0xae'),_['map'](_0xe0e262,'id'));return db['sequelize']['query'](_0x2825aa[_0xab95('0x98')](),_0x2c78a3)[_0xab95('0x2f')](function(_0x57f551){var _0x72fc2c=_[_0xab95('0xaf')](_0x57f551,_0xab95('0xb0'));var _0x3e531d=[];_0xe0e262[_0xab95('0x39')](function(_0x461bbd){_0x3e531d['push'](updateWhatsappInteraction(_0x461bbd,_0x51a1d8,_0x72fc2c));});return BPromise[_0xab95('0xb1')](_0x3e531d);});});})[_0xab95('0x2f')](function(_0x3f6325){_0x1c893c[_0xab95('0xb2')]=_0x3f6325;return _0x1c893c;})['then'](respondWithFilteredResult(_0x2139d7,_0x5e220d))[_0xab95('0xb3')](handleError(_0x2139d7,null));};exports[_0xab95('0xb4')]=function(_0x5147e2,_0x504f14){var _0x2fd4e4={'raw':![],'where':{'id':_0x5147e2['params']['id']}},_0x32b76d={};_0x32b76d[_0xab95('0x40')]=_[_0xab95('0x42')](db[_0xab95('0x3c')][_0xab95('0x3d')]);_0x32b76d[_0xab95('0x41')]=_[_0xab95('0x42')](_0x5147e2[_0xab95('0x41')]);_0x32b76d[_0xab95('0x43')]=_[_0xab95('0xb5')](_0x32b76d['model'],_0x32b76d[_0xab95('0x41')]);_0x2fd4e4[_0xab95('0x44')]=_[_0xab95('0xb5')](_0x32b76d['model'],qs[_0xab95('0x45')](_0x5147e2[_0xab95('0x41')][_0xab95('0x45')]));_0x2fd4e4[_0xab95('0x44')]=_0x2fd4e4[_0xab95('0x44')][_0xab95('0x46')]?_0x2fd4e4['attributes']:_0x32b76d[_0xab95('0x40')];if(_0x5147e2['query'][_0xab95('0xb6')]){_0x2fd4e4[_0xab95('0xb7')]=[{'all':!![]}];}_0x2fd4e4=_[_0xab95('0x99')]({},_0x2fd4e4,_0x5147e2[_0xab95('0xb8')]);return db[_0xab95('0x3c')]['find'](_0x2fd4e4)[_0xab95('0x2f')](handleEntityNotFound(_0x504f14,null))[_0xab95('0x2f')](respondWithResult(_0x504f14,null))[_0xab95('0xb3')](handleError(_0x504f14,null));};exports['create']=function(_0x4473cb,_0x409608){return db['WhatsappInteraction'][_0xab95('0xb9')](_0x4473cb[_0xab95('0xba')],{})[_0xab95('0x2f')](respondWithResult(_0x409608,0xc9))['catch'](handleError(_0x409608,null));};exports[_0xab95('0x2e')]=function(_0x72fa97,_0x127446){if(_0x72fa97[_0xab95('0xba')]['id']){delete _0x72fa97['body']['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0x72fa97[_0xab95('0xbb')]['id']}})[_0xab95('0x2f')](handleEntityNotFound(_0x127446,null))[_0xab95('0x2f')](saveUpdates(_0x72fa97[_0xab95('0xba')],null))[_0xab95('0x2f')](respondWithResult(_0x127446,null))[_0xab95('0xb3')](handleError(_0x127446,null));};exports[_0xab95('0x30')]=function(_0x3e00b8,_0x2e98d9){return db[_0xab95('0x3c')][_0xab95('0x65')]({'where':{'id':_0x3e00b8['params']['id']}})[_0xab95('0x2f')](handleEntityNotFound(_0x2e98d9,null))[_0xab95('0x2f')](removeEntity(_0x2e98d9,null))[_0xab95('0xb3')](handleError(_0x2e98d9,null));};exports[_0xab95('0xbc')]=function(_0x28ed37,_0x1cea28){return db[_0xab95('0x3c')][_0xab95('0xbc')]()['then'](respondWithResult(_0x1cea28,null))[_0xab95('0xb3')](handleError(_0x1cea28,null));};exports[_0xab95('0xbd')]=function(_0x2c8b4b,_0x1398f0,_0x4b19b3){return db[_0xab95('0xbe')][_0xab95('0x65')]({'where':{'id':_0x2c8b4b[_0xab95('0xbb')]['id']}})[_0xab95('0x2f')](handleEntityNotFound(_0x1398f0,null))[_0xab95('0x2f')](function(_0x2f44bd){if(_0x2f44bd){return _0x2f44bd[_0xab95('0xbd')](_0x2c8b4b['body']['ids'],_['omit'](_0x2c8b4b['body'],[_0xab95('0xbf'),'id'])||{});}})[_0xab95('0x2f')](respondWithResult(_0x1398f0,null))[_0xab95('0xb3')](handleError(_0x1398f0,null));};exports[_0xab95('0xc0')]=function(_0xe24af0,_0x2e0578,_0x2ddf48){var _0x2baf14={'raw':![],'where':{}};var _0x524bbd={};var _0x48cc21={'count':0x0,'rows':[]};return db[_0xab95('0x3c')][_0xab95('0xc1')]({'where':{'id':_0xe24af0['params']['id']}})[_0xab95('0x2f')](handleEntityNotFound(_0x2e0578,null))[_0xab95('0x2f')](function(_0x70d3e9){if(_0x70d3e9){_0x524bbd[_0xab95('0x40')]=_[_0xab95('0x42')](db[_0xab95('0xbe')][_0xab95('0x3d')]);_0x524bbd[_0xab95('0x41')]=_[_0xab95('0x42')](_0xe24af0[_0xab95('0x41')]);_0x524bbd[_0xab95('0x43')]=_[_0xab95('0xb5')](_0x524bbd[_0xab95('0x40')],_0x524bbd[_0xab95('0x41')]);_0x2baf14[_0xab95('0x44')]=_['intersection'](_0x524bbd[_0xab95('0x40')],qs[_0xab95('0x45')](_0xe24af0[_0xab95('0x41')][_0xab95('0x45')]));_0x2baf14[_0xab95('0x44')]=_0x2baf14[_0xab95('0x44')]['length']?_0x2baf14['attributes']:_0x524bbd[_0xab95('0x40')];if(!_0xe24af0[_0xab95('0x41')]['hasOwnProperty']('nolimit')){_0x2baf14[_0xab95('0x27')]=qs[_0xab95('0x27')](_0xe24af0[_0xab95('0x41')]['limit']);_0x2baf14[_0xab95('0x25')]=qs[_0xab95('0x25')](_0xe24af0['query'][_0xab95('0x25')]);}_0x2baf14[_0xab95('0x49')]=qs[_0xab95('0x4a')](_0xe24af0[_0xab95('0x41')][_0xab95('0x4a')]);_0x2baf14['where']=qs[_0xab95('0x43')](_[_0xab95('0x4c')](_0xe24af0['query'],_0x524bbd[_0xab95('0x43')]));_0x2baf14[_0xab95('0x4b')]['WhatsappInteractionId']=_0x70d3e9['id'];if(_0xe24af0['query'][_0xab95('0x86')]){_0x2baf14[_0xab95('0x4b')]=_[_0xab95('0x99')](_0x2baf14['where'],{'$or':_[_0xab95('0x34')](_0x2baf14[_0xab95('0x44')],function(_0x1c1df8){var _0x5ae813={};_0x5ae813[_0x1c1df8]={'$like':'%'+_0xe24af0['query']['filter']+'%'};return _0x5ae813;})});}if(_0xe24af0[_0xab95('0x41')]['$gte']){var _0x2b44d8=_0xe24af0[_0xab95('0x41')][_0xab95('0xc2')][_0xab95('0x38')](',');var _0x529333={};_0x529333[_0x2b44d8[0x0]]={'$gte':moment(_0x2b44d8[0x1])[_0xab95('0xc3')](_0xab95('0xc4'))};_0x2baf14[_0xab95('0x4b')]=_['merge'](_0x2baf14[_0xab95('0x4b')],_0x529333);}_0x2baf14=_['merge']({},_0x2baf14,_0xe24af0[_0xab95('0xb8')]);return db[_0xab95('0xbe')][_0xab95('0x28')]({'where':_0x2baf14[_0xab95('0x4b')]})[_0xab95('0x2f')](function(_0xf521e6){_0x48cc21['count']=_0xf521e6;if(_0xe24af0['query'][_0xab95('0xb6')]){_0x2baf14[_0xab95('0xb7')]=[{'all':!![]}];}return db[_0xab95('0xbe')][_0xab95('0xc5')](_0x2baf14);})['then'](function(_0x5d813b){_0x48cc21['rows']=_0x5d813b;return _0x48cc21;});}})[_0xab95('0x2f')](respondWithFilteredResult(_0x2e0578,_0x2baf14))[_0xab95('0xb3')](handleError(_0x2e0578,null));};exports[_0xab95('0xc6')]=function(_0x35988a,_0x1ee9ea,_0x1aac94){return db[_0xab95('0x3c')][_0xab95('0x65')]({'where':{'id':_0x35988a[_0xab95('0xbb')]['id']}})[_0xab95('0x2f')](handleEntityNotFound(_0x1ee9ea,null))['then'](function(_0x2fb302){if(_0x2fb302){return _0x2fb302[_0xab95('0xc7')](_0x35988a[_0xab95('0xba')]['ids'],_[_0xab95('0xc8')](_0x35988a[_0xab95('0xba')],[_0xab95('0xbf'),'id'])||{})['spread'](function(){return db[_0xab95('0x72')][_0xab95('0xc5')]({'attributes':['id',_0xab95('0x31'),_0xab95('0x4f')],'where':{'id':_0x35988a['body'][_0xab95('0xbf')]}});})[_0xab95('0x2f')](function(_0xb8ae9){socket[_0xab95('0xc9')]('whatsappInteractionTags:save',{'id':Number(_0x35988a[_0xab95('0xbb')]['id']),'tags':_0xb8ae9||[]});return{'id':Number(_0x35988a['params']['id']),'tags':_0xb8ae9||[]};});}})[_0xab95('0x2f')](respondWithResult(_0x1ee9ea,null))['catch'](handleError(_0x1ee9ea,null));};exports[_0xab95('0xca')]=function(_0x53d8aa,_0x435300,_0x52ce0e){return db['WhatsappInteraction'][_0xab95('0x65')]({'where':{'id':_0x53d8aa['params']['id']}})['then'](handleEntityNotFound(_0x435300,null))['then'](function(_0x37a894){if(_0x37a894){return _0x37a894[_0xab95('0xca')](_0x53d8aa[_0xab95('0x41')][_0xab95('0xbf')]);}})['then'](respondWithStatusCode(_0x435300,null))[_0xab95('0xb3')](handleError(_0x435300,null));};exports[_0xab95('0xcb')]=function(_0x35cf3a,_0x1f64e4){var _0x481aea=moment()['unix']()[_0xab95('0x98')]();var _0x2e9b6c=path[_0xab95('0xcc')](config[_0xab95('0xcd')],'server',_0xab95('0xce'),'tmp');var _0x1bba74=path['join'](config['root'],'server',_0xab95('0xce'),_0xab95('0xcf'));var _0x14021b=path[_0xab95('0xcc')](_0x2e9b6c,_0x481aea);var _0x42ec91=util['format']('transcript-%d-%s.zip',_0x35cf3a['params']['id'],_0x481aea);var _0x365624=path[_0xab95('0xcc')](_0x2e9b6c,_0x42ec91);var _0x13eeb4=[];_0x13eeb4[_0xab95('0x3a')]({'model':db[_0xab95('0x75')],'as':_0xab95('0x75'),'attributes':['id',_0xab95('0x35')],'raw':!![]});_0x13eeb4[_0xab95('0x3a')]({'model':db[_0xab95('0xd0')],'as':_0xab95('0x69'),'attributes':['id',_0xab95('0xd1'),'lastName'],'raw':!![]});if(_0x35cf3a[_0xab95('0x41')][_0xab95('0xcf')]){_0x13eeb4['push']({'model':db[_0xab95('0xd2')],'as':_0xab95('0xd2'),'raw':!![]});}var _0x23d29e=[{'model':db['WhatsappMessage'],'as':_0xab95('0xd3'),'attributes':['id','body',_0xab95('0xd4'),_0xab95('0xd5'),_0xab95('0xd6'),_0xab95('0xd7')],'include':_0x13eeb4}];_0x23d29e['push']({'model':db[_0xab95('0xd8')],'as':_0xab95('0xd9'),'attributes':['id',_0xab95('0x31')]});_0x23d29e[_0xab95('0x3a')]({'model':db[_0xab95('0x75')],'as':_0xab95('0xda'),'attributes':['id',_0xab95('0x35')]});return db[_0xab95('0x3c')][_0xab95('0x65')]({'where':{'id':_0x35cf3a[_0xab95('0xbb')]['id']},'include':_0x23d29e})[_0xab95('0x2f')](handleEntityNotFound(_0x1f64e4,null))[_0xab95('0x2f')](function(_0x10b2f6){if(_0x10b2f6){var _0x3b202e=_0x10b2f6[_0xab95('0xdb')]({'plain':!![]});fs[_0xab95('0xdc')](_0x14021b);var _0x574d62={'channel':_0xab95('0xdd'),'account':_0x3b202e[_0xab95('0xd9')][_0xab95('0x31')],'agent':_0x3b202e[_0xab95('0xda')]?_0x3b202e[_0xab95('0xda')]['fullname']:_0xab95('0xde'),'createdAt':moment(_0x3b202e[_0xab95('0xd4')])[_0xab95('0xc3')](_0xab95('0xc4'))[_0xab95('0x98')](),'closedAt':_0x3b202e[_0xab95('0xdf')]?moment(_0x3b202e[_0xab95('0xe0')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xab95('0x98')]():'','disposition':_0x3b202e[_0xab95('0xe1')],'messages':_(_0x3b202e[_0xab95('0xd3')])[_0xab95('0x86')]({'secret':![]})['map'](function(_0x254742){if(_0x254742[_0xab95('0xd2')]){var _0x5506df=path['join'](_0x1bba74,_0x254742['Attachment'][_0xab95('0xe2')]);if(fs[_0xab95('0xe3')](_0x5506df)){fs['createReadStream'](_0x5506df)[_0xab95('0xe4')](fs[_0xab95('0xe5')](path[_0xab95('0xcc')](_0x14021b,_0x254742[_0xab95('0xd2')][_0xab95('0xe2')])));}}return{'date':moment(_0x254742[_0xab95('0xd4')])['format'](_0xab95('0xc4'))[_0xab95('0x98')](),'sender':_0x254742[_0xab95('0xd5')]===_0xab95('0xe6')?_0x254742[_0xab95('0x75')]?_0x254742[_0xab95('0x75')][_0xab95('0x35')]:_0xab95('0xe7'):_0x254742[_0xab95('0x69')][_0xab95('0xd1')]+(_0x254742[_0xab95('0x69')][_0xab95('0xe8')]?'\x20'+_0x254742[_0xab95('0x69')][_0xab95('0xe8')]:''),'body':_0x254742['Attachment']?_0x254742[_0xab95('0xd2')]['basename']:_0x254742[_0xab95('0xba')],'direction':_0x254742['direction']===_0xab95('0xe6')?'A':'C','secret':_0x254742[_0xab95('0xd6')],'read':_0x254742[_0xab95('0xd7')],'attachment':_0x254742[_0xab95('0xd2')]};})[_0xab95('0x66')]()};return ejs[_0xab95('0xe9')](path[_0xab95('0xcc')](config['root'],'server',_0xab95('0xea'),_0xab95('0xeb')),{'interaction':_0x574d62})[_0xab95('0x2f')](function(_0x46956b){var _0x54a0d9=path[_0xab95('0xcc')](_0x14021b,'transcript-'+_0x3b202e['id']+'-'+_0x481aea+'.pdf');var _0x439075={'path':_0x54a0d9,'channel':_0xab95('0xdd'),'interactionId':_0x3b202e['id']};return pdf['createPdfFromHTML'](_0x46956b,_0x439075);})['then'](function(){return new BPromise(function(_0x17128b,_0x213e8a){zipdir(_0x14021b,{'saveTo':_0x365624},function(_0x186f76,_0x1e8edb){if(_0x186f76)return _0x213e8a(_0x186f76);return _0x17128b(_0x1e8edb);});})[_0xab95('0x2f')](function(){return new BPromise(function(_0x71296c,_0x46e486){rimraf(_0x14021b,function(_0x16e274){if(_0x16e274)_0x46e486(_0x16e274);return _0x71296c();});});})[_0xab95('0x2f')](function(){return _0x1f64e4[_0xab95('0xcb')](_0x365624,_0x42ec91,function(_0x41f0c6){if(_0x41f0c6){console[_0xab95('0xec')]('err',_0x41f0c6);}else{fs['unlinkSync'](_0x365624);}});});});}else{return _0x1f64e4['sendStatus'](0xc8);}})[_0xab95('0xb3')](handleError(_0x1f64e4,null));}; \ No newline at end of file +var _0x34e8=['destroy','describe','WhatsappMessage','addMessage','ids','omit','findOne','WhatsappInteractionId','format','rows','addTags','setTags','findAll','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','fullname','CmContact','Contact','firstName','lastName','Messages','direction','secret','Owner','get','mkdirSync','Whatsapp','Account','N.A.','closed','YYYY-MM-DD\x20HH:mm:ss','disposition','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','sendStatus','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','offset','undefined','limit','count','set','reject','then','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','catch','index','rawAttributes','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','filters','select','field','color','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','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','type','start','body','keys','some','compact','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','getWhatsappAccounts','user','sequelize','toString','keyBy','merge','WhatsappInteraction','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','push','all','show','params','includeAll','include','options','create'];(function(_0x1c4cac,_0x318193){var _0x324766=function(_0x4e9191){while(--_0x4e9191){_0x1c4cac['push'](_0x1c4cac['shift']());}};_0x324766(++_0x318193);}(_0x34e8,0x12c));var _0x834e=function(_0x1bee5b,_0x165511){_0x1bee5b=_0x1bee5b-0x0;var _0x25022c=_0x34e8[_0x1bee5b];return _0x25022c;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var pdf=require(_0x834e('0x16'));var hardwareService=require(_0x834e('0x17'));var logger=require(_0x834e('0x18'))(_0x834e('0x19'));var utils=require(_0x834e('0x1a'));var config=require(_0x834e('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x834e('0x1c'))['db'];config[_0x834e('0x1d')]=_['defaults'](config[_0x834e('0x1d')],{'host':_0x834e('0x1e'),'port':0x18eb});var socket=require(_0x834e('0x1f'))(new Redis(config[_0x834e('0x1d')]));require('./whatsappInteraction.socket')[_0x834e('0x20')](socket);function respondWithStatusCode(_0x302cbd,_0x57274a){_0x57274a=_0x57274a||0xcc;return function(_0x316205){if(_0x316205){return _0x302cbd['sendStatus'](_0x57274a);}return _0x302cbd[_0x834e('0x21')](_0x57274a)[_0x834e('0x22')]();};}function respondWithResult(_0x478afe,_0x43ac41){_0x43ac41=_0x43ac41||0xc8;return function(_0x22106e){if(_0x22106e){return _0x478afe[_0x834e('0x21')](_0x43ac41)['json'](_0x22106e);}};}function respondWithFilteredResult(_0x283e56,_0x211e9a){return function(_0x34e41a){if(_0x34e41a){var _0xb993a1=typeof _0x211e9a[_0x834e('0x23')]===_0x834e('0x24')&&typeof _0x211e9a[_0x834e('0x25')]==='undefined';var _0x2545b4=_0x34e41a[_0x834e('0x26')];var _0x113ff4=_0xb993a1?0x0:_0x211e9a[_0x834e('0x23')];var _0x4ab05d=_0xb993a1?_0x34e41a[_0x834e('0x26')]:_0x211e9a[_0x834e('0x23')]+_0x211e9a['limit'];var _0x1b4bdf;if(_0x4ab05d>=_0x2545b4){_0x4ab05d=_0x2545b4;_0x1b4bdf=0xc8;}else{_0x1b4bdf=0xce;}_0x283e56[_0x834e('0x21')](_0x1b4bdf);return _0x283e56[_0x834e('0x27')]('Content-Range',_0x113ff4+'-'+_0x4ab05d+'/'+_0x2545b4)['json'](_0x34e41a);}return null;};}function patchUpdates(_0x231619){return function(_0x34563b){try{jsonpatch['apply'](_0x34563b,_0x231619,!![]);}catch(_0x25ee1d){return BPromise[_0x834e('0x28')](_0x25ee1d);}return _0x34563b['save']();};}function saveUpdates(_0x3bc4f7,_0x2e1983){return function(_0x338636){if(_0x338636){return _0x338636['update'](_0x3bc4f7)[_0x834e('0x29')](function(_0x3e310f){return _0x3e310f;});}return null;};}function removeEntity(_0x5e1cc5,_0x5bef62){return function(_0x1e713a){if(_0x1e713a){return _0x1e713a['destroy']()[_0x834e('0x29')](function(){_0x5e1cc5[_0x834e('0x21')](0xcc)[_0x834e('0x22')]();});}};}function handleEntityNotFound(_0x2cc2eb,_0x3cd928){return function(_0x130cc5){if(!_0x130cc5){_0x2cc2eb['sendStatus'](0x194);}return _0x130cc5;};}function handleError(_0x510780,_0x4dc64a){_0x4dc64a=_0x4dc64a||0x1f4;return function(_0x58c1d7){logger[_0x834e('0x2a')](_0x58c1d7[_0x834e('0x2b')]);if(_0x58c1d7[_0x834e('0x2c')]){delete _0x58c1d7['name'];}_0x510780[_0x834e('0x21')](_0x4dc64a)[_0x834e('0x2d')](_0x58c1d7);};}function getInteractionUsers(_0x1f3671,_0x1e026a){return new BPromise(function(_0x4551f5,_0x390119){try{if(_0x1e026a[_0x1f3671['id']]){_0x1f3671[_0x834e('0x2e')]=_[_0x834e('0x2f')](_0x1e026a[_0x1f3671['id']],function(_0x278db3){return{'id':_0x278db3['id'],'fullname':_0x278db3['fullname']};});}}catch(_0xef9ec2){_0x390119(_0xef9ec2);}_0x4551f5(_0x1f3671);});}function getInteractionTags(_0x5cad11,_0x2c75c2){return new BPromise(function(_0x3787b0,_0x9ab921){try{if(_0x5cad11[_0x834e('0x30')]){_0x5cad11[_0x834e('0x31')]=[];_0x5cad11[_0x834e('0x30')][_0x834e('0x32')](',')[_0x834e('0x33')](function(_0x358c31){_0x5cad11[_0x834e('0x31')]['push'](_0x2c75c2[_0x358c31]);});}delete _0x5cad11[_0x834e('0x30')];}catch(_0x2f408a){_0x9ab921(_0x2f408a);}_0x3787b0(_0x5cad11);});}function updateWhatsappInteraction(_0x24a9df,_0xaf01f4,_0x595cc0){return new BPromise(function(_0x3f88ad,_0x379d60){return getInteractionUsers(_0x24a9df,_0x595cc0)['then'](function(_0x496533){return getInteractionTags(_0x496533,_0xaf01f4);})['then'](function(_0x3e58fa){_0x3f88ad(_0x3e58fa);})[_0x834e('0x34')](function(_0x20c6ae){_0x379d60(_0x20c6ae);});});}exports[_0x834e('0x35')]=function(_0x339e28,_0x1b76dd){var _0x4c2ef6={},_0x2c2d94={},_0x513f36={'count':0x0,'rows':[]};var _0xe103fe=_[_0x834e('0x2f')](db['WhatsappInteraction'][_0x834e('0x36')],function(_0x2f56c7){return{'name':_0x2f56c7['fieldName'],'type':_0x2f56c7['type'][_0x834e('0x37')]};});_0x2c2d94[_0x834e('0x38')]=_[_0x834e('0x2f')](_0xe103fe,_0x834e('0x2c'));_0x2c2d94[_0x834e('0x39')]=_['keys'](_0x339e28[_0x834e('0x39')]);_0x2c2d94['filters']=_['intersection'](_0x2c2d94[_0x834e('0x38')],_0x2c2d94['query']);_0x4c2ef6[_0x834e('0x3a')]=_[_0x834e('0x3b')](_0x2c2d94[_0x834e('0x38')],qs[_0x834e('0x3c')](_0x339e28[_0x834e('0x39')]['fields']));_0x4c2ef6[_0x834e('0x3a')]=_0x4c2ef6[_0x834e('0x3a')][_0x834e('0x3d')]?_0x4c2ef6['attributes']:_0x2c2d94[_0x834e('0x38')];if(!_0x339e28[_0x834e('0x39')]['hasOwnProperty'](_0x834e('0x3e'))){_0x4c2ef6['limit']=qs[_0x834e('0x25')](_0x339e28[_0x834e('0x39')]['limit']);_0x4c2ef6['offset']=qs[_0x834e('0x23')](_0x339e28[_0x834e('0x39')][_0x834e('0x23')]);}_0x4c2ef6[_0x834e('0x3f')]=qs[_0x834e('0x40')](_0x339e28[_0x834e('0x39')][_0x834e('0x40')]);_0x4c2ef6['where']=qs[_0x834e('0x41')](_['pick'](_0x339e28[_0x834e('0x39')],_0x2c2d94['filters']),_0xe103fe);var _0x1df5b0=[];var _0x5a5807=squel[_0x834e('0x42')]()[_0x834e('0x43')]('id')['field'](_0x834e('0x2c'))[_0x834e('0x43')](_0x834e('0x44'))[_0x834e('0x45')](_0x834e('0x46'));var _0x1a7149=squel[_0x834e('0x42')]()[_0x834e('0x43')](_0x834e('0x47'))[_0x834e('0x43')]('u.fullname')[_0x834e('0x43')](_0x834e('0x48'))['from'](_0x834e('0x49'),'ui')[_0x834e('0x4a')](_0x834e('0x4b'),'u',_0x834e('0x4c'));var _0x19b5ef=squel[_0x834e('0x42')]()['from']('whatsapp_interactions','i')[_0x834e('0x4a')](_0x834e('0x4d'),'c',_0x834e('0x4e'))[_0x834e('0x4a')](_0x834e('0x4b'),'o',_0x834e('0x4f'))[_0x834e('0x4a')](_0x834e('0x50'),'a',_0x834e('0x51'))[_0x834e('0x4a')](_0x834e('0x52'),'me',_0x834e('0x53'))[_0x834e('0x4a')](_0x834e('0x54'),'it',_0x834e('0x55'))[_0x834e('0x4a')](_0x834e('0x46'),'t',_0x834e('0x56'));var _0x420841=squel[_0x834e('0x57')]();var _0x4cfacd=[];var _0x1cc0b8=squel[_0x834e('0x57')]();var _0x4e73e0;if(_0x339e28[_0x834e('0x39')][_0x834e('0x58')]){_0x4e73e0=as['parseSearch'](_0x339e28[_0x834e('0x39')][_0x834e('0x58')]);var _0x2cbc6f=_0x4e73e0[_0x834e('0x59')];for(var _0x4288e4=0x0;_0x4288e4<_0x4e73e0[_0x834e('0x5a')][_0x834e('0x3d')];_0x4288e4++){var _0x4a8b32=_0x4e73e0[_0x834e('0x5a')][_0x4288e4];var _0x8bc6c6='i';var _0x3e0550=_[_0x834e('0x5b')](_0xe103fe,[_0x834e('0x2c'),_0x4a8b32[_0x834e('0x43')]]);if(!_0x3e0550){switch(_0x4a8b32[_0x834e('0x43')]){case _0x834e('0x5c'):if(_0x4a8b32['value']==0x1){_0x19b5ef[_0x834e('0x5d')]('`'+_0x4a8b32['field']+_0x834e('0x5e'));}else{_0x19b5ef['having']('`'+_0x4a8b32[_0x834e('0x43')]+'`\x20>\x200');}break;case'Contact':if(_0x4a8b32[_0x834e('0x5f')]===_0x834e('0x60')){if(_0x4a8b32['value']['split']('\x20')[_0x834e('0x3d')]>0x1){_0x420841[_0x2cbc6f](_0x834e('0x61'),qs[_0x834e('0x62')](_0x4a8b32[_0x834e('0x63')]),null);}else{var _0x21c417='%'+_0x4a8b32[_0x834e('0x63')]+'%';_0x420841[_0x2cbc6f](_0x834e('0x64'),_0x21c417,_0x21c417,_0x21c417);}}else{_0x3e0550=_[_0x834e('0x5b')](_0xe103fe,['name',_0x834e('0x65')]);_0x4a8b32[_0x834e('0x43')]='ContactId';_0x4ca099=as[_0x834e('0x66')](_0x8bc6c6,_0x3e0550['type'],_0x4a8b32);_0x420841[_0x2cbc6f](_0x4ca099[_0x834e('0x67')],_0x4ca099[_0x834e('0x63')]['start'],_0x4ca099[_0x834e('0x63')][_0x834e('0x22')]);}break;case _0x834e('0x68'):var _0x25f720=_0x4a8b32['value'][_0x834e('0x32')](',')[_0x834e('0x2f')](function(_0x1dfd5f){return Number(_0x1dfd5f);});_0x25f720['forEach'](function(_0x246b8e){_0x1cc0b8['or'](_0x834e('0x69'),'%,'+_0x246b8e+',%');});_0x4cfacd=_[_0x834e('0x6a')](_0x4cfacd,_0x25f720);break;case _0x834e('0x6b'):if(_0x4a8b32[_0x834e('0x5f')]===_0x834e('0x60')){_0x420841[_0x2cbc6f](_0x834e('0x6c'),'%'+_0x4a8b32[_0x834e('0x63')]+'%',null);}else{_0x3e0550=_[_0x834e('0x5b')](_0xe103fe,[_0x834e('0x2c'),_0x834e('0x6d')]);_0x4a8b32[_0x834e('0x43')]=_0x834e('0x6d');_0x4ca099=as[_0x834e('0x66')](_0x8bc6c6,_0x3e0550[_0x834e('0x6e')],_0x4a8b32);_0x420841[_0x2cbc6f](_0x4ca099[_0x834e('0x67')],_0x4ca099[_0x834e('0x63')][_0x834e('0x6f')],_0x4ca099[_0x834e('0x63')][_0x834e('0x22')]);}break;case _0x834e('0x70'):_0x4ca099=as[_0x834e('0x66')]('me',null,_0x4a8b32);_0x420841[_0x2cbc6f](_0x4ca099['text'],_0x4ca099[_0x834e('0x63')][_0x834e('0x6f')],_0x4ca099[_0x834e('0x63')][_0x834e('0x22')]);break;}}else{var _0x4ca099=as[_0x834e('0x66')](_0x8bc6c6,_0x3e0550['type'],_0x4a8b32);_0x420841[_0x2cbc6f](_0x4ca099['text'],_0x4ca099[_0x834e('0x63')][_0x834e('0x6f')],_0x4ca099[_0x834e('0x63')][_0x834e('0x22')]);}}}else{var _0x216105=_(_0x339e28[_0x834e('0x39')])[_0x834e('0x71')]()[_0x834e('0x2f')](function(_0x525ed3){return _[_0x834e('0x72')](_0xe103fe,['name',_0x525ed3])?_0x525ed3:undefined;})[_0x834e('0x73')]()[_0x834e('0x63')]();if(!_['isEmpty'](_0x216105)){_0x216105['forEach'](function(_0x4a4def){if(_0x4a4def===_0x834e('0x74')){_0x19b5ef[_0x834e('0x75')](_0x834e('0x76'),[][_0x834e('0x77')](_0x339e28['query'][_0x4a4def]));}else if(_0x4a4def===_0x834e('0x78')){var _0x15018f=JSON[_0x834e('0x79')](_0x339e28[_0x834e('0x39')][_0x4a4def])[_0x834e('0x7a')];var _0x28b5c9=JSON[_0x834e('0x79')](_0x339e28[_0x834e('0x39')][_0x4a4def])[_0x834e('0x7b')];_0x19b5ef[_0x834e('0x75')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x15018f,_0x28b5c9);}else{if(_0x339e28[_0x834e('0x39')][_0x4a4def]===_0x834e('0x7c')){_0x19b5ef[_0x834e('0x75')]('i.'+_0x4a4def+_0x834e('0x7d'));}else{_0x19b5ef['where']('i.'+_0x4a4def+_0x834e('0x7e'),_0x339e28['query'][_0x4a4def]);}}});}if(_0x339e28['query']['read']){if(_0x339e28[_0x834e('0x39')][_0x834e('0x7f')]==0x1){_0x19b5ef['having'](_0x834e('0x80'));}else{_0x19b5ef[_0x834e('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x339e28[_0x834e('0x39')][_0x834e('0x81')]){_0x4cfacd=_['isArray'](_0x339e28['query'][_0x834e('0x81')])?_0x339e28[_0x834e('0x39')][_0x834e('0x81')]:new Array(_0x339e28[_0x834e('0x39')][_0x834e('0x81')]);_0x4cfacd['forEach'](function(_0x264a6f){_0x1cc0b8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x264a6f+',%');});}if(_0x339e28[_0x834e('0x39')][_0x834e('0x82')]){var _0x2c758c=_0x339e28['query'][_0x834e('0x82')][_0x834e('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x834e('0x84')](_0x2c758c)){_0x420841['or'](_0x834e('0x85'),_0x2c758c+'%')['or'](_0x834e('0x86'),_0x2c758c+'%');}else{_0x420841['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x834e('0x62')](_0x2c758c))['or'](_0x834e('0x87'),_0x2c758c+'%');}}}_0x19b5ef[_0x834e('0x75')](_0x420841);_0x19b5ef[_0x834e('0x88')](_0x834e('0x89'));var _0x29bfd7={'type':db[_0x834e('0x8a')][_0x834e('0x8b')][_0x834e('0x8c')],'raw':!![]};var _0x1691d5=_0x19b5ef['clone']();_0x1691d5['field']('i.id');_0x1691d5[_0x834e('0x43')](_0x834e('0x8d'),_0x834e('0x5c'));if(_0x4c2ef6[_0x834e('0x3f')]){_0x4c2ef6[_0x834e('0x3f')]['forEach'](function(_0x483bae){var _0x4520fc=_0x483bae[0x0]===_0x834e('0x8e')?_0x483bae[0x0]:'i.'+_0x483bae[0x0];_0x19b5ef[_0x834e('0x3f')](_0x4520fc,_0x483bae[0x1]===_0x834e('0x8f')?![]:!![]);});}if(!_[_0x834e('0x90')](_0x4cfacd)){_0x19b5ef['having'](_0x1cc0b8);_0x1691d5[_0x834e('0x75')](_0x834e('0x91'),_0x4cfacd);}BPromise[_0x834e('0x92')]()['then'](function(){if(!_0x4e73e0){if(_0x339e28[_0x834e('0x39')][_0x834e('0x74')])return;_0x1691d5[_0x834e('0x75')](_0x834e('0x93'));_0x19b5ef[_0x834e('0x75')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x339e28['user'][_0x834e('0x94')]!==_0x834e('0x95'))return;return _0x339e28['user'][_0x834e('0x96')]({'attributes':['id'],'raw':!![]})['then'](function(_0x40c401){if(_[_0x834e('0x90')](_0x40c401)){_0x1691d5[_0x834e('0x75')]('i.WhatsappAccountId\x20IS\x20NULL');_0x19b5ef[_0x834e('0x75')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x1691d5['where']('i.WhatsappAccountId\x20IN\x20?',_[_0x834e('0x2f')](_0x40c401,'id'));_0x19b5ef[_0x834e('0x75')](_0x834e('0x76'),_[_0x834e('0x2f')](_0x40c401,'id'));}});})[_0x834e('0x29')](function(){if(_0x339e28[_0x834e('0x97')][_0x834e('0x94')]===_0x834e('0x95')&&!_0x4e73e0&&!_0x339e28[_0x834e('0x39')]['WhatsappAccountId'])return[];return db[_0x834e('0x98')]['query'](_0x1691d5[_0x834e('0x99')](),_0x29bfd7);})[_0x834e('0x29')](function(_0x38bfa4){_0x513f36[_0x834e('0x26')]=_0x38bfa4[_0x834e('0x3d')];if(_0x513f36[_0x834e('0x26')]===0x0)return[];return db['sequelize']['query'](_0x5a5807[_0x834e('0x99')](),_0x29bfd7)[_0x834e('0x29')](function(_0x4eff8d){_0x1df5b0=_[_0x834e('0x9a')](_0x4eff8d,'id');_0x29bfd7=_[_0x834e('0x9b')](_0x29bfd7,{'model':db[_0x834e('0x9c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x339e28[_0x834e('0x39')][_0x834e('0x3c')]){_0x4c2ef6['attributes'][_0x834e('0x33')](function(_0x78917b){_0x19b5ef['field']('i.'+_0x78917b);});}else{_0x19b5ef['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x834e('0x5c'));_0x19b5ef[_0x834e('0x43')]('a.key',_0x834e('0x9d'));_0x19b5ef[_0x834e('0x43')]('a.mandatoryDisposition',_0x834e('0x9e'));_0x19b5ef['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',_0x834e('0x8e'));_0x19b5ef[_0x834e('0x43')](_0x834e('0x9f'));_0x19b5ef[_0x834e('0x43')]('c.firstName',_0x834e('0xa0'));_0x19b5ef[_0x834e('0x43')](_0x834e('0xa1'),_0x834e('0xa2'));_0x19b5ef[_0x834e('0x43')](_0x834e('0xa3'),_0x834e('0xa4'));_0x19b5ef[_0x834e('0x43')](_0x834e('0xa5'),_0x834e('0xa6'));_0x19b5ef[_0x834e('0x43')](_0x834e('0xa7'),_0x834e('0xa8'));_0x19b5ef[_0x834e('0x43')](_0x834e('0xa9'),_0x834e('0xaa'));_0x19b5ef[_0x834e('0x43')](_0x834e('0xab'),_0x834e('0xac'));_0x19b5ef[_0x834e('0x43')](_0x834e('0xad'),_0x834e('0xae'));_0x19b5ef['field'](_0x834e('0xaf'),_0x834e('0x30'));}if(_0x4c2ef6[_0x834e('0x25')])_0x19b5ef[_0x834e('0x25')](_0x4c2ef6[_0x834e('0x25')]);if(_0x4c2ef6[_0x834e('0x23')])_0x19b5ef[_0x834e('0x23')](_0x4c2ef6[_0x834e('0x23')]);return db[_0x834e('0x98')]['query'](_0x19b5ef['toString'](),_0x29bfd7);})['then'](function(_0x150ed8){if(_0x150ed8['length']>0x0)_0x1a7149[_0x834e('0x75')](_0x834e('0xb0'),_[_0x834e('0x2f')](_0x150ed8,'id'));return db['sequelize'][_0x834e('0x39')](_0x1a7149[_0x834e('0x99')](),_0x29bfd7)[_0x834e('0x29')](function(_0x1594ef){var _0x3ef0ad=_[_0x834e('0xb1')](_0x1594ef,'WhatsappInteractionId');var _0x10dd7b=[];_0x150ed8[_0x834e('0x33')](function(_0x24ff45){_0x10dd7b[_0x834e('0xb2')](updateWhatsappInteraction(_0x24ff45,_0x1df5b0,_0x3ef0ad));});return BPromise[_0x834e('0xb3')](_0x10dd7b);});});})['then'](function(_0x4ebeba){_0x513f36['rows']=_0x4ebeba;return _0x513f36;})['then'](respondWithFilteredResult(_0x1b76dd,_0x4c2ef6))[_0x834e('0x34')](handleError(_0x1b76dd,null));};exports[_0x834e('0xb4')]=function(_0x56fc05,_0x3bd1e7){var _0xf9fec9={'raw':![],'where':{'id':_0x56fc05[_0x834e('0xb5')]['id']}},_0x4fb709={};_0x4fb709[_0x834e('0x38')]=_[_0x834e('0x71')](db[_0x834e('0x9c')][_0x834e('0x36')]);_0x4fb709[_0x834e('0x39')]=_['keys'](_0x56fc05['query']);_0x4fb709[_0x834e('0x41')]=_[_0x834e('0x3b')](_0x4fb709[_0x834e('0x38')],_0x4fb709['query']);_0xf9fec9[_0x834e('0x3a')]=_[_0x834e('0x3b')](_0x4fb709['model'],qs[_0x834e('0x3c')](_0x56fc05[_0x834e('0x39')][_0x834e('0x3c')]));_0xf9fec9[_0x834e('0x3a')]=_0xf9fec9['attributes'][_0x834e('0x3d')]?_0xf9fec9['attributes']:_0x4fb709['model'];if(_0x56fc05[_0x834e('0x39')][_0x834e('0xb6')]){_0xf9fec9[_0x834e('0xb7')]=[{'all':!![]}];}_0xf9fec9=_[_0x834e('0x9b')]({},_0xf9fec9,_0x56fc05[_0x834e('0xb8')]);return db[_0x834e('0x9c')]['find'](_0xf9fec9)['then'](handleEntityNotFound(_0x3bd1e7,null))[_0x834e('0x29')](respondWithResult(_0x3bd1e7,null))[_0x834e('0x34')](handleError(_0x3bd1e7,null));};exports[_0x834e('0xb9')]=function(_0x1421b3,_0x476cb1){return db[_0x834e('0x9c')][_0x834e('0xb9')](_0x1421b3['body'],{})[_0x834e('0x29')](respondWithResult(_0x476cb1,0xc9))[_0x834e('0x34')](handleError(_0x476cb1,null));};exports['update']=function(_0x4278ab,_0x6a507a){if(_0x4278ab[_0x834e('0x70')]['id']){delete _0x4278ab[_0x834e('0x70')]['id'];}return db[_0x834e('0x9c')][_0x834e('0x5b')]({'where':{'id':_0x4278ab[_0x834e('0xb5')]['id']}})[_0x834e('0x29')](handleEntityNotFound(_0x6a507a,null))[_0x834e('0x29')](saveUpdates(_0x4278ab[_0x834e('0x70')],null))[_0x834e('0x29')](respondWithResult(_0x6a507a,null))[_0x834e('0x34')](handleError(_0x6a507a,null));};exports[_0x834e('0xba')]=function(_0x1306d9,_0x5673e6){return db[_0x834e('0x9c')][_0x834e('0x5b')]({'where':{'id':_0x1306d9['params']['id']}})[_0x834e('0x29')](handleEntityNotFound(_0x5673e6,null))['then'](removeEntity(_0x5673e6,null))[_0x834e('0x34')](handleError(_0x5673e6,null));};exports['describe']=function(_0x16a42b,_0x560d10){return db[_0x834e('0x9c')][_0x834e('0xbb')]()[_0x834e('0x29')](respondWithResult(_0x560d10,null))[_0x834e('0x34')](handleError(_0x560d10,null));};exports['addMessage']=function(_0x3d4608,_0x38085e,_0x375fec){return db[_0x834e('0xbc')][_0x834e('0x5b')]({'where':{'id':_0x3d4608[_0x834e('0xb5')]['id']}})[_0x834e('0x29')](handleEntityNotFound(_0x38085e,null))[_0x834e('0x29')](function(_0x2aa430){if(_0x2aa430){return _0x2aa430[_0x834e('0xbd')](_0x3d4608[_0x834e('0x70')][_0x834e('0xbe')],_[_0x834e('0xbf')](_0x3d4608[_0x834e('0x70')],[_0x834e('0xbe'),'id'])||{});}})[_0x834e('0x29')](respondWithResult(_0x38085e,null))[_0x834e('0x34')](handleError(_0x38085e,null));};exports['getMessages']=function(_0x4b7277,_0x2df814,_0x349685){var _0x3f52b9={'raw':![],'where':{}};var _0x213303={};var _0x3bf1b6={'count':0x0,'rows':[]};return db[_0x834e('0x9c')][_0x834e('0xc0')]({'where':{'id':_0x4b7277[_0x834e('0xb5')]['id']}})[_0x834e('0x29')](handleEntityNotFound(_0x2df814,null))[_0x834e('0x29')](function(_0x25f1f9){if(_0x25f1f9){_0x213303[_0x834e('0x38')]=_['keys'](db[_0x834e('0xbc')]['rawAttributes']);_0x213303[_0x834e('0x39')]=_[_0x834e('0x71')](_0x4b7277[_0x834e('0x39')]);_0x213303['filters']=_[_0x834e('0x3b')](_0x213303[_0x834e('0x38')],_0x213303['query']);_0x3f52b9['attributes']=_[_0x834e('0x3b')](_0x213303[_0x834e('0x38')],qs['fields'](_0x4b7277[_0x834e('0x39')][_0x834e('0x3c')]));_0x3f52b9[_0x834e('0x3a')]=_0x3f52b9[_0x834e('0x3a')][_0x834e('0x3d')]?_0x3f52b9['attributes']:_0x213303['model'];if(!_0x4b7277[_0x834e('0x39')]['hasOwnProperty']('nolimit')){_0x3f52b9['limit']=qs[_0x834e('0x25')](_0x4b7277[_0x834e('0x39')]['limit']);_0x3f52b9[_0x834e('0x23')]=qs[_0x834e('0x23')](_0x4b7277[_0x834e('0x39')][_0x834e('0x23')]);}_0x3f52b9['order']=qs[_0x834e('0x40')](_0x4b7277[_0x834e('0x39')][_0x834e('0x40')]);_0x3f52b9['where']=qs[_0x834e('0x41')](_['pick'](_0x4b7277[_0x834e('0x39')],_0x213303['filters']));_0x3f52b9[_0x834e('0x75')][_0x834e('0xc1')]=_0x25f1f9['id'];if(_0x4b7277['query'][_0x834e('0x82')]){_0x3f52b9[_0x834e('0x75')]=_[_0x834e('0x9b')](_0x3f52b9[_0x834e('0x75')],{'$or':_[_0x834e('0x2f')](_0x3f52b9[_0x834e('0x3a')],function(_0x5bb5ff){var _0x2d4b29={};_0x2d4b29[_0x5bb5ff]={'$like':'%'+_0x4b7277[_0x834e('0x39')][_0x834e('0x82')]+'%'};return _0x2d4b29;})});}if(_0x4b7277[_0x834e('0x39')][_0x834e('0x7a')]){var _0x1b8e67=_0x4b7277['query'][_0x834e('0x7a')]['split'](',');var _0x4d5afa={};_0x4d5afa[_0x1b8e67[0x0]]={'$gte':moment(_0x1b8e67[0x1])[_0x834e('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3f52b9['where']=_[_0x834e('0x9b')](_0x3f52b9[_0x834e('0x75')],_0x4d5afa);}_0x3f52b9=_[_0x834e('0x9b')]({},_0x3f52b9,_0x4b7277[_0x834e('0xb8')]);return db[_0x834e('0xbc')][_0x834e('0x26')]({'where':_0x3f52b9[_0x834e('0x75')]})[_0x834e('0x29')](function(_0x1d3ca9){_0x3bf1b6[_0x834e('0x26')]=_0x1d3ca9;if(_0x4b7277[_0x834e('0x39')][_0x834e('0xb6')]){_0x3f52b9[_0x834e('0xb7')]=[{'all':!![]}];}return db[_0x834e('0xbc')]['findAll'](_0x3f52b9);})[_0x834e('0x29')](function(_0x4874e1){_0x3bf1b6[_0x834e('0xc3')]=_0x4874e1;return _0x3bf1b6;});}})[_0x834e('0x29')](respondWithFilteredResult(_0x2df814,_0x3f52b9))[_0x834e('0x34')](handleError(_0x2df814,null));};exports[_0x834e('0xc4')]=function(_0x5ab11f,_0x5f558a,_0x37d8dd){return db[_0x834e('0x9c')]['find']({'where':{'id':_0x5ab11f[_0x834e('0xb5')]['id']}})[_0x834e('0x29')](handleEntityNotFound(_0x5f558a,null))['then'](function(_0x231970){if(_0x231970){return _0x231970[_0x834e('0xc5')](_0x5ab11f[_0x834e('0x70')][_0x834e('0xbe')],_['omit'](_0x5ab11f['body'],['ids','id'])||{})['spread'](function(){return db[_0x834e('0x68')][_0x834e('0xc6')]({'attributes':['id','name',_0x834e('0x44')],'where':{'id':_0x5ab11f['body'][_0x834e('0xbe')]}});})[_0x834e('0x29')](function(_0x343a59){socket[_0x834e('0xc7')](_0x834e('0xc8'),{'id':Number(_0x5ab11f[_0x834e('0xb5')]['id']),'tags':_0x343a59||[]});return{'id':Number(_0x5ab11f[_0x834e('0xb5')]['id']),'tags':_0x343a59||[]};});}})['then'](respondWithResult(_0x5f558a,null))[_0x834e('0x34')](handleError(_0x5f558a,null));};exports[_0x834e('0xc9')]=function(_0x59ac23,_0x22f4c7,_0x4551cb){return db['WhatsappInteraction']['find']({'where':{'id':_0x59ac23['params']['id']}})[_0x834e('0x29')](handleEntityNotFound(_0x22f4c7,null))[_0x834e('0x29')](function(_0x29105a){if(_0x29105a){return _0x29105a['removeTags'](_0x59ac23[_0x834e('0x39')][_0x834e('0xbe')]);}})[_0x834e('0x29')](respondWithStatusCode(_0x22f4c7,null))[_0x834e('0x34')](handleError(_0x22f4c7,null));};exports[_0x834e('0xca')]=function(_0xad7b72,_0x19cb0b){var _0x13af70=moment()[_0x834e('0xcb')]()[_0x834e('0x99')]();var _0x48b6c4=path['join'](config[_0x834e('0xcc')],_0x834e('0xcd'),_0x834e('0xce'),_0x834e('0xcf'));var _0x4303a6=path[_0x834e('0xd0')](config[_0x834e('0xcc')],_0x834e('0xcd'),_0x834e('0xce'),_0x834e('0xd1'));var _0x264adc=path[_0x834e('0xd0')](_0x48b6c4,_0x13af70);var _0x13b354=util['format'](_0x834e('0xd2'),_0xad7b72[_0x834e('0xb5')]['id'],_0x13af70);var _0x3f5b2e=path[_0x834e('0xd0')](_0x48b6c4,_0x13b354);var _0x495697=[];_0x495697['push']({'model':db['User'],'as':_0x834e('0x6b'),'attributes':['id',_0x834e('0xd3')],'raw':!![]});_0x495697[_0x834e('0xb2')]({'model':db[_0x834e('0xd4')],'as':_0x834e('0xd5'),'attributes':['id',_0x834e('0xd6'),_0x834e('0xd7')],'raw':!![]});if(_0xad7b72[_0x834e('0x39')]['attachments']){_0x495697['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x2024dd=[{'model':db[_0x834e('0xbc')],'as':_0x834e('0xd8'),'attributes':['id',_0x834e('0x70'),_0x834e('0x78'),_0x834e('0xd9'),_0x834e('0xda'),_0x834e('0x7f')],'include':_0x495697}];_0x2024dd[_0x834e('0xb2')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id','name']});_0x2024dd['push']({'model':db[_0x834e('0x6b')],'as':_0x834e('0xdb'),'attributes':['id',_0x834e('0xd3')]});return db[_0x834e('0x9c')][_0x834e('0x5b')]({'where':{'id':_0xad7b72[_0x834e('0xb5')]['id']},'include':_0x2024dd})[_0x834e('0x29')](handleEntityNotFound(_0x19cb0b,null))[_0x834e('0x29')](function(_0x86d08c){if(_0x86d08c){var _0xcd64c2=_0x86d08c[_0x834e('0xdc')]({'plain':!![]});fs[_0x834e('0xdd')](_0x264adc);var _0x1fd72b={'channel':_0x834e('0xde'),'account':_0xcd64c2[_0x834e('0xdf')][_0x834e('0x2c')],'agent':_0xcd64c2['Owner']?_0xcd64c2[_0x834e('0xdb')]['fullname']:_0x834e('0xe0'),'createdAt':moment(_0xcd64c2[_0x834e('0x78')])[_0x834e('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0x834e('0x99')](),'closedAt':_0xcd64c2[_0x834e('0xe1')]?moment(_0xcd64c2['closedAt'])['format'](_0x834e('0xe2'))[_0x834e('0x99')]():'','disposition':_0xcd64c2[_0x834e('0xe3')],'messages':_(_0xcd64c2[_0x834e('0xd8')])[_0x834e('0x82')]({'secret':![]})[_0x834e('0x2f')](function(_0x3eb2e8){if(_0x3eb2e8[_0x834e('0xe4')]){var _0x569a80=path[_0x834e('0xd0')](_0x4303a6,_0x3eb2e8[_0x834e('0xe4')][_0x834e('0xe5')]);if(fs[_0x834e('0xe6')](_0x569a80)){fs[_0x834e('0xe7')](_0x569a80)[_0x834e('0xe8')](fs[_0x834e('0xe9')](path['join'](_0x264adc,_0x3eb2e8[_0x834e('0xe4')]['basename'])));}}return{'date':moment(_0x3eb2e8['createdAt'])[_0x834e('0xc2')](_0x834e('0xe2'))['toString'](),'sender':_0x3eb2e8[_0x834e('0xd9')]===_0x834e('0xea')?_0x3eb2e8['User']?_0x3eb2e8[_0x834e('0x6b')][_0x834e('0xd3')]:'System':_0x3eb2e8['Contact'][_0x834e('0xd6')]+(_0x3eb2e8[_0x834e('0xd5')]['lastName']?'\x20'+_0x3eb2e8['Contact'][_0x834e('0xd7')]:''),'body':_0x3eb2e8[_0x834e('0xe4')]?_0x3eb2e8['Attachment']['basename']:_0x3eb2e8['body'],'direction':_0x3eb2e8['direction']===_0x834e('0xea')?'A':'C','secret':_0x3eb2e8['secret'],'read':_0x3eb2e8[_0x834e('0x7f')],'attachment':_0x3eb2e8['Attachment']};})[_0x834e('0x63')]()};return ejs[_0x834e('0xeb')](path[_0x834e('0xd0')](config[_0x834e('0xcc')],'server',_0x834e('0xec'),_0x834e('0xed')),{'interaction':_0x1fd72b})[_0x834e('0x29')](function(_0x37bb7b){var _0x3a3a6c=path[_0x834e('0xd0')](_0x264adc,_0x834e('0xee')+_0xcd64c2['id']+'-'+_0x13af70+_0x834e('0xef'));var _0x464ae6={'path':_0x3a3a6c,'channel':_0x834e('0xde'),'interactionId':_0xcd64c2['id']};return pdf['createPdfFromHTML'](_0x37bb7b,_0x464ae6);})[_0x834e('0x29')](function(){return new BPromise(function(_0x48f8da,_0x3980c0){zipdir(_0x264adc,{'saveTo':_0x3f5b2e},function(_0x376850,_0x2eedc5){if(_0x376850)return _0x3980c0(_0x376850);return _0x48f8da(_0x2eedc5);});})[_0x834e('0x29')](function(){return new BPromise(function(_0x185167,_0x507578){rimraf(_0x264adc,function(_0x41698e){if(_0x41698e)_0x507578(_0x41698e);return _0x185167();});});})['then'](function(){return _0x19cb0b['download'](_0x3f5b2e,_0x13b354,function(_0x21bf6a){if(_0x21bf6a){console[_0x834e('0xf0')](_0x834e('0xf1'),_0x21bf6a);}else{fs['unlinkSync'](_0x3f5b2e);}});});});}else{return _0x19cb0b[_0x834e('0xf2')](0xc8);}})[_0x834e('0x34')](handleError(_0x19cb0b,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 75ca523..78d6503 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 _0xc718=['unreadMessages','length','emit','catch','hasOwnProperty','exports','events','WhatsappInteraction','../../mysqldb','setMaxListeners','save','getUsers','setDataValue','Users','map','then'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0xc718,0xb6));var _0x8c71=function(_0x2fa9a,_0x4a2048){_0x2fa9a=_0x2fa9a-0x0;var _0xaafcd6=_0xc718[_0x2fa9a];return _0xaafcd6;};'use strict';var EventEmitter=require(_0x8c71('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x8c71('0x1')];var WhatsappMessage=require(_0x8c71('0x2'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x8c71('0x3')](0x0);var events={'afterCreate':_0x8c71('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x159c61){return function(_0x52aa93,_0x5aa87e,_0x49ce50){_0x52aa93[_0x8c71('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0xf122c7){_0x52aa93[_0x8c71('0x6')](_0x8c71('0x7'),_0xf122c7[_0x8c71('0x8')](function(_0x45e21c){return{'id':_0x45e21c['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x52aa93['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8c71('0x9')](function(_0xa09e14){_0x52aa93[_0x8c71('0x6')](_0x8c71('0xa'),_0xa09e14[_0x8c71('0xb')]);WhatsappInteractionEvents[_0x8c71('0xc')](_0x159c61+':'+_0x52aa93['id'],_0x52aa93);WhatsappInteractionEvents[_0x8c71('0xc')](_0x159c61,_0x52aa93);_0x49ce50(null);})[_0x8c71('0xd')](_0x49ce50(null));};}for(var e in events){if(events[_0x8c71('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x8c71('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x9e9b=['WhatsappMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x9e9b,0x1a7));var _0xb9e9=function(_0x9cbfe0,_0x56aada){_0x9cbfe0=_0x9cbfe0-0x0;var _0x1f1534=_0x9e9b[_0x9cbfe0];return _0x1f1534;};'use strict';var EventEmitter=require(_0xb9e9('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xb9e9('0x1'))['db'][_0xb9e9('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb9e9('0x3')](0x0);var events={'afterCreate':_0xb9e9('0x4'),'afterUpdate':'update','afterDestroy':_0xb9e9('0x5')};function emitEvent(_0x394a8e){return function(_0x557e37,_0x433bb4,_0x7b18d5){_0x557e37[_0xb9e9('0x6')]({'attributes':['id'],'raw':!![]})[_0xb9e9('0x7')](function(_0x3329cf){_0x557e37[_0xb9e9('0x8')](_0xb9e9('0x9'),_0x3329cf[_0xb9e9('0xa')](function(_0x127c61){return{'id':_0x127c61['id']};}));return WhatsappMessage[_0xb9e9('0xb')]({'where':{'WhatsappInteractionId':_0x557e37['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb9e9('0x7')](function(_0x4369b0){_0x557e37['setDataValue'](_0xb9e9('0xc'),_0x4369b0[_0xb9e9('0xd')]);WhatsappInteractionEvents['emit'](_0x394a8e+':'+_0x557e37['id'],_0x557e37);WhatsappInteractionEvents[_0xb9e9('0xe')](_0x394a8e,_0x557e37);_0x7b18d5(null);})[_0xb9e9('0xf')](_0x7b18d5(null));};}for(var e in events){if(events[_0xb9e9('0x10')](e)){var event=events[e];WhatsappInteraction['hook'](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 a922a8e..3a976a8 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 _0xfd33=['bluebird','request-promise','path','../../config/environment','define','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x5df09d,_0x42b378){var _0x50f93c=function(_0x2003fa){while(--_0x2003fa){_0x5df09d['push'](_0x5df09d['shift']());}};_0x50f93c(++_0x42b378);}(_0xfd33,0x154));var _0x3fd3=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xfd33[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0x3fd3('0x0'));var util=require(_0x3fd3('0x1'));var logger=require(_0x3fd3('0x2'))(_0x3fd3('0x3'));var moment=require(_0x3fd3('0x4'));var BPromise=require(_0x3fd3('0x5'));var rp=require(_0x3fd3('0x6'));var fs=require('fs');var path=require(_0x3fd3('0x7'));var rimraf=require('rimraf');var config=require(_0x3fd3('0x8'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x34f657,_0x50e459){return _0x34f657[_0x3fd3('0x9')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4580c6,_0x9c5e43,_0x4e7f04){if(_0x4580c6[_0x3fd3('0xa')](_0x3fd3('0xb'))){_0x4580c6[_0x3fd3('0xc')]=moment()[_0x3fd3('0xd')](_0x3fd3('0xe'));}_0x4e7f04(null,_0x4580c6);}}});}; \ No newline at end of file +var _0x204c=['changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction'];(function(_0x489243,_0x256a8a){var _0x70acca=function(_0x2d8834){while(--_0x2d8834){_0x489243['push'](_0x489243['shift']());}};_0x70acca(++_0x256a8a);}(_0x204c,0xdc));var _0xc204=function(_0x2ba570,_0x2aabe2){_0x2ba570=_0x2ba570-0x0;var _0x421e6c=_0x204c[_0x2ba570];return _0x421e6c;};'use strict';var _=require(_0xc204('0x0'));var util=require(_0xc204('0x1'));var logger=require(_0xc204('0x2'))(_0xc204('0x3'));var moment=require(_0xc204('0x4'));var BPromise=require(_0xc204('0x5'));var rp=require(_0xc204('0x6'));var fs=require('fs');var path=require(_0xc204('0x7'));var rimraf=require(_0xc204('0x8'));var config=require(_0xc204('0x9'));var attributes=require(_0xc204('0xa'));module[_0xc204('0xb')]=function(_0x5cb76f,_0x33557b){return _0x5cb76f[_0xc204('0xc')](_0xc204('0xd'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x44ddcd,_0x4be484,_0x2f810d){if(_0x44ddcd[_0xc204('0xe')]('closed')){_0x44ddcd[_0xc204('0xf')]=moment()[_0xc204('0x10')](_0xc204('0x11'));}_0x2f810d(null,_0x44ddcd);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 7ffc485..71864f5 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 _0x63b8=['update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','addTags','ids','omit','AddTags','lodash','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction'];(function(_0x2c5d87,_0x952835){var _0x410d30=function(_0x46c325){while(--_0x46c325){_0x2c5d87['push'](_0x2c5d87['shift']());}};_0x410d30(++_0x952835);}(_0x63b8,0x1ae));var _0x863b=function(_0x3f74e1,_0x2d9a18){_0x3f74e1=_0x3f74e1-0x0;var _0x2df189=_0x63b8[_0x3f74e1];return _0x2df189;};'use strict';var _=require(_0x863b('0x0'));var util=require('util');var moment=require(_0x863b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x863b('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x863b('0x3'))(_0x863b('0x4'));var config=require('../../config/environment');var jayson=require(_0x863b('0x5'));var client=jayson['client'][_0x863b('0x6')]({'port':0x232a});config[_0x863b('0x7')]=_['defaults'](config[_0x863b('0x7')],{'host':_0x863b('0x8'),'port':0x18eb});var socket=require(_0x863b('0x9'))(new Redis(config[_0x863b('0x7')]));require(_0x863b('0xa'))[_0x863b('0xb')](socket);function respondWithRpcPromise(_0x5a8667,_0x2335c3,_0x45d0a4){return new BPromise(function(_0x93e4a1,_0x52f081){return client[_0x863b('0xc')](_0x5a8667,_0x45d0a4)[_0x863b('0xd')](function(_0x2b6170){logger['info'](_0x863b('0xe'),_0x2335c3,_0x863b('0xf'));logger[_0x863b('0x10')](_0x863b('0x11'),_0x2335c3,_0x863b('0xf'),JSON[_0x863b('0x12')](_0x2b6170));if(_0x2b6170[_0x863b('0x13')]){if(_0x2b6170[_0x863b('0x13')]['code']===0x1f4){logger[_0x863b('0x13')](_0x863b('0xe'),_0x2335c3,_0x2b6170[_0x863b('0x13')][_0x863b('0x14')]);return _0x52f081(_0x2b6170[_0x863b('0x13')]['message']);}logger['error'](_0x863b('0xe'),_0x2335c3,_0x2b6170[_0x863b('0x13')][_0x863b('0x14')]);return _0x93e4a1(_0x2b6170[_0x863b('0x13')]['message']);}else{logger[_0x863b('0x15')](_0x863b('0xe'),_0x2335c3,_0x863b('0xf'));_0x93e4a1(_0x2b6170[_0x863b('0x16')][_0x863b('0x14')]);}})[_0x863b('0x17')](function(_0x54c491){logger[_0x863b('0x13')](_0x863b('0xe'),_0x2335c3,_0x54c491);_0x52f081(_0x54c491);});});}exports[_0x863b('0x18')]=function(_0x5aac33){var _0x24f826=this;return new Promise(function(_0x20dc1e,_0x5c474d){return db[_0x863b('0x19')][_0x863b('0x1a')](_0x5aac33[_0x863b('0x1b')],{'raw':_0x5aac33[_0x863b('0x1c')]?_0x5aac33[_0x863b('0x1c')][_0x863b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5aac33[_0x863b('0x1c')]?_0x5aac33[_0x863b('0x1c')][_0x863b('0x1e')]||null:null,'attributes':_0x5aac33[_0x863b('0x1c')]?_0x5aac33[_0x863b('0x1c')][_0x863b('0x1f')]||null:null,'limit':_0x5aac33['options']?_0x5aac33['options'][_0x863b('0x20')]||null:null})['then'](function(_0x354680){logger[_0x863b('0x15')]('UpdateWhatsappInteraction',_0x5aac33);logger[_0x863b('0x10')]('UpdateWhatsappInteraction',_0x5aac33,JSON['stringify'](_0x354680));_0x20dc1e(_0x354680);})[_0x863b('0x17')](function(_0x25f92e){logger[_0x863b('0x13')](_0x863b('0x18'),_0x25f92e[_0x863b('0x14')],_0x5aac33);_0x5c474d(_0x24f826['error'](0x1f4,_0x25f92e[_0x863b('0x14')]));});});};exports[_0x863b('0x21')]=function(_0x27d0d8){return new Promise(function(_0x2e2b3d,_0x2cee75){return db['WhatsappInteraction']['find']({'where':_0x27d0d8[_0x863b('0x1c')]?_0x27d0d8[_0x863b('0x1c')][_0x863b('0x1e')]||null:null})[_0x863b('0xd')](function(_0x1ba99c){if(_0x1ba99c){return _0x1ba99c[_0x863b('0x22')](_0x27d0d8[_0x863b('0x1b')][_0x863b('0x23')],_[_0x863b('0x24')](_0x27d0d8[_0x863b('0x1b')],[_0x863b('0x23'),'id'])||{});}})['spread'](function(_0xe4bff3){logger[_0x863b('0x15')]('AddTags',_0x27d0d8);logger[_0x863b('0x10')]('AddTags',_0x27d0d8,JSON[_0x863b('0x12')](_0xe4bff3));_0x2e2b3d(_0xe4bff3);})[_0x863b('0x17')](function(_0x3155d7){logger[_0x863b('0x13')](_0x863b('0x25'),_0x3155d7[_0x863b('0x14')],_0x27d0d8);_0x2cee75(_this[_0x863b('0x13')](0x1f4,_0x3155d7[_0x863b('0x14')]));});});}; \ No newline at end of file +var _0x3062=['then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','attributes','limit','AddTagsToWhatsappInteraction','find','where','ids','omit','AddTags','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0x3062,0x138));var _0x2306=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x3062[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x2306('0x0'));var util=require(_0x2306('0x1'));var moment=require(_0x2306('0x2'));var BPromise=require(_0x2306('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2306('0x4'));var db=require(_0x2306('0x5'))['db'];var utils=require(_0x2306('0x6'));var logger=require(_0x2306('0x7'))('rpc');var config=require(_0x2306('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2306('0x9')]({'port':0x232a});config[_0x2306('0xa')]=_[_0x2306('0xb')](config[_0x2306('0xa')],{'host':_0x2306('0xc'),'port':0x18eb});var socket=require(_0x2306('0xd'))(new Redis(config[_0x2306('0xa')]));require(_0x2306('0xe'))[_0x2306('0xf')](socket);function respondWithRpcPromise(_0x52e894,_0x32090c,_0xd32fb4){return new BPromise(function(_0x439d75,_0x338b94){return client['request'](_0x52e894,_0xd32fb4)[_0x2306('0x10')](function(_0x1bf32e){logger[_0x2306('0x11')](_0x2306('0x12'),_0x32090c,_0x2306('0x13'));logger[_0x2306('0x14')](_0x2306('0x15'),_0x32090c,_0x2306('0x13'),JSON[_0x2306('0x16')](_0x1bf32e));if(_0x1bf32e['error']){if(_0x1bf32e['error'][_0x2306('0x17')]===0x1f4){logger[_0x2306('0x18')](_0x2306('0x12'),_0x32090c,_0x1bf32e[_0x2306('0x18')][_0x2306('0x19')]);return _0x338b94(_0x1bf32e['error'][_0x2306('0x19')]);}logger[_0x2306('0x18')](_0x2306('0x12'),_0x32090c,_0x1bf32e['error'][_0x2306('0x19')]);return _0x439d75(_0x1bf32e[_0x2306('0x18')]['message']);}else{logger[_0x2306('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x32090c,_0x2306('0x13'));_0x439d75(_0x1bf32e['result'][_0x2306('0x19')]);}})['catch'](function(_0x200123){logger['error'](_0x2306('0x12'),_0x32090c,_0x200123);_0x338b94(_0x200123);});});}exports[_0x2306('0x1a')]=function(_0x4ca793){var _0xfb3948=this;return new Promise(function(_0x51acca,_0x684adb){return db[_0x2306('0x1b')][_0x2306('0x1c')](_0x4ca793[_0x2306('0x1d')],{'raw':_0x4ca793[_0x2306('0x1e')]?_0x4ca793[_0x2306('0x1e')][_0x2306('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ca793[_0x2306('0x1e')]?_0x4ca793['options']['where']||null:null,'attributes':_0x4ca793['options']?_0x4ca793['options'][_0x2306('0x20')]||null:null,'limit':_0x4ca793['options']?_0x4ca793[_0x2306('0x1e')][_0x2306('0x21')]||null:null})[_0x2306('0x10')](function(_0x1ba4d3){logger[_0x2306('0x11')](_0x2306('0x1a'),_0x4ca793);logger[_0x2306('0x14')](_0x2306('0x1a'),_0x4ca793,JSON['stringify'](_0x1ba4d3));_0x51acca(_0x1ba4d3);})['catch'](function(_0x41ab82){logger[_0x2306('0x18')](_0x2306('0x1a'),_0x41ab82['message'],_0x4ca793);_0x684adb(_0xfb3948['error'](0x1f4,_0x41ab82['message']));});});};exports[_0x2306('0x22')]=function(_0x414f3a){return new Promise(function(_0x47ca94,_0x178711){return db[_0x2306('0x1b')][_0x2306('0x23')]({'where':_0x414f3a['options']?_0x414f3a[_0x2306('0x1e')][_0x2306('0x24')]||null:null})[_0x2306('0x10')](function(_0x1b0467){if(_0x1b0467){return _0x1b0467['addTags'](_0x414f3a[_0x2306('0x1d')][_0x2306('0x25')],_[_0x2306('0x26')](_0x414f3a[_0x2306('0x1d')],['ids','id'])||{});}})['spread'](function(_0x2610f7){logger[_0x2306('0x11')]('AddTags',_0x414f3a);logger[_0x2306('0x14')](_0x2306('0x27'),_0x414f3a,JSON[_0x2306('0x16')](_0x2610f7));_0x47ca94(_0x2610f7);})[_0x2306('0x28')](function(_0x3dba22){logger['error'](_0x2306('0x27'),_0x3dba22[_0x2306('0x19')],_0x414f3a);_0x178711(_this[_0x2306('0x18')](0x1f4,_0x3dba22[_0x2306('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 92e66d0..d4f699d 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 _0x0538=['remove','update','emit','removeListener','length','whatsappInteraction:','save'];(function(_0x4e5ec3,_0xd26846){var _0x3510c2=function(_0x199c99){while(--_0x199c99){_0x4e5ec3['push'](_0x4e5ec3['shift']());}};_0x3510c2(++_0xd26846);}(_0x0538,0x1db));var _0x8053=function(_0x92713a,_0x68f8b0){_0x92713a=_0x92713a-0x0;var _0x1893e1=_0x0538[_0x92713a];return _0x1893e1;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x8053('0x0'),_0x8053('0x1'),_0x8053('0x2')];function createListener(_0x108cbb,_0x30ce84){return function(_0x50b324){_0x30ce84[_0x8053('0x3')](_0x108cbb,_0x50b324);};}function removeListener(_0x13590a,_0x424bbd){return function(){WhatsappInteractionEvents[_0x8053('0x4')](_0x13590a,_0x424bbd);};}exports['register']=function(_0x2204a7){for(var _0x132dd1=0x0,_0x222cb6=events[_0x8053('0x5')];_0x132dd1<_0x222cb6;_0x132dd1++){var _0x298a1a=events[_0x132dd1];var _0x31b81a=createListener(_0x8053('0x6')+_0x298a1a,_0x2204a7);WhatsappInteractionEvents['on'](_0x298a1a,_0x31b81a);}}; \ No newline at end of file +var _0x498f=['save','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x47d785,_0x1e2441){var _0x530d1f=function(_0x5c9b1a){while(--_0x5c9b1a){_0x47d785['push'](_0x47d785['shift']());}};_0x530d1f(++_0x1e2441);}(_0x498f,0x92));var _0xf498=function(_0x421baa,_0xb49260){_0x421baa=_0x421baa-0x0;var _0x3a0960=_0x498f[_0x421baa];return _0x3a0960;};'use strict';var WhatsappInteractionEvents=require(_0xf498('0x0'));var events=[_0xf498('0x1'),'remove','update'];function createListener(_0xdbe133,_0x280ce9){return function(_0x57830d){_0x280ce9[_0xf498('0x2')](_0xdbe133,_0x57830d);};}function removeListener(_0x29b916,_0x5e9450){return function(){WhatsappInteractionEvents[_0xf498('0x3')](_0x29b916,_0x5e9450);};}exports[_0xf498('0x4')]=function(_0x2350ca){for(var _0x5a15c8=0x0,_0x5ab263=events[_0xf498('0x5')];_0x5a15c8<_0x5ab263;_0x5a15c8++){var _0x46dc8b=events[_0x5a15c8];var _0x472b53=createListener(_0xf498('0x6')+_0x46dc8b,_0x2350ca);WhatsappInteractionEvents['on'](_0x46dc8b,_0x472b53);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index fe822c4..d1cce14 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 _0x52dd=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','describe','show','tracked','whatsapp','whatsappmessage:create','create','post','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x49e584,_0x2886f8){var _0x58b1be=function(_0x40397c){while(--_0x40397c){_0x49e584['push'](_0x49e584['shift']());}};_0x58b1be(++_0x2886f8);}(_0x52dd,0x136));var _0xd52d=function(_0x2c5ebc,_0x5a7e55){_0x2c5ebc=_0x2c5ebc-0x0;var _0x3b58eb=_0x52dd[_0x2c5ebc];return _0x3b58eb;};'use strict';var multer=require(_0xd52d('0x0'));var util=require(_0xd52d('0x1'));var path=require('path');var timeout=require(_0xd52d('0x2'));var express=require(_0xd52d('0x3'));var router=express[_0xd52d('0x4')]();var fs_extra=require(_0xd52d('0x5'));var auth=require(_0xd52d('0x6'));var interaction=require(_0xd52d('0x7'));var config=require(_0xd52d('0x8'));var controller=require(_0xd52d('0x9'));router[_0xd52d('0xa')]('/',auth[_0xd52d('0xb')](),controller[_0xd52d('0xc')]);router[_0xd52d('0xa')]('/describe',auth[_0xd52d('0xb')](),controller[_0xd52d('0xd')]);router[_0xd52d('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd52d('0xe')]);router['post']('/',auth[_0xd52d('0xb')](),interaction[_0xd52d('0xf')](_0xd52d('0x10'),_0xd52d('0x11')),controller[_0xd52d('0x12')]);router[_0xd52d('0x13')]('/:id/status',controller[_0xd52d('0x14')]);router[_0xd52d('0x15')](_0xd52d('0x16'),auth[_0xd52d('0xb')](),controller[_0xd52d('0x17')]);router[_0xd52d('0x15')](_0xd52d('0x18'),auth[_0xd52d('0xb')](),controller[_0xd52d('0x19')]);router['put'](_0xd52d('0x1a'),auth[_0xd52d('0xb')](),controller[_0xd52d('0x1b')]);router[_0xd52d('0x1c')](_0xd52d('0x16'),auth[_0xd52d('0xb')](),controller[_0xd52d('0x1d')]);module[_0xd52d('0x1e')]=router; \ No newline at end of file +var _0xbe79=['accept','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','/describe','describe','/:id','post','tracked','whatsapp','create','/:id/status','status','put','update','/:id/accept'];(function(_0x1628b5,_0x953a06){var _0x42644a=function(_0x2519bd){while(--_0x2519bd){_0x1628b5['push'](_0x1628b5['shift']());}};_0x42644a(++_0x953a06);}(_0xbe79,0x9f));var _0x9be7=function(_0x3de6fe,_0x1e6e91){_0x3de6fe=_0x3de6fe-0x0;var _0x303dec=_0xbe79[_0x3de6fe];return _0x303dec;};'use strict';var multer=require(_0x9be7('0x0'));var util=require(_0x9be7('0x1'));var path=require(_0x9be7('0x2'));var timeout=require('connect-timeout');var express=require(_0x9be7('0x3'));var router=express[_0x9be7('0x4')]();var fs_extra=require(_0x9be7('0x5'));var auth=require(_0x9be7('0x6'));var interaction=require(_0x9be7('0x7'));var config=require(_0x9be7('0x8'));var controller=require(_0x9be7('0x9'));router['get']('/',auth[_0x9be7('0xa')](),controller['index']);router['get'](_0x9be7('0xb'),auth[_0x9be7('0xa')](),controller[_0x9be7('0xc')]);router['get'](_0x9be7('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x9be7('0xe')]('/',auth[_0x9be7('0xa')](),interaction[_0x9be7('0xf')](_0x9be7('0x10'),'whatsappmessage:create'),controller[_0x9be7('0x11')]);router['post'](_0x9be7('0x12'),controller[_0x9be7('0x13')]);router[_0x9be7('0x14')](_0x9be7('0xd'),auth['isAuthenticated'](),controller[_0x9be7('0x15')]);router['put'](_0x9be7('0x16'),auth['isAuthenticated'](),controller[_0x9be7('0x17')]);router['put']('/:id/reject',auth[_0x9be7('0xa')](),controller['reject']);router['delete'](_0x9be7('0xd'),auth[_0x9be7('0xa')](),controller[_0x9be7('0x18')]);module[_0x9be7('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index dccf5ae..7a662cd 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 _0x8d5a=['exports','TEXT','medium','ENUM','STRING','DATE','BOOLEAN','sequelize'];(function(_0x33b259,_0x2036be){var _0xf95548=function(_0x5b3424){while(--_0x5b3424){_0x33b259['push'](_0x33b259['shift']());}};_0xf95548(++_0x2036be);}(_0x8d5a,0x9f));var _0xa8d5=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x8d5a[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0xa8d5('0x0'));module[_0xa8d5('0x1')]={'body':{'type':Sequelize[_0xa8d5('0x2')](_0xa8d5('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa8d5('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xa8d5('0x5')]},'readAt':{'type':Sequelize[_0xa8d5('0x6')]},'secret':{'type':Sequelize[_0xa8d5('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa8d5('0x5')]},'providerResponse':{'type':Sequelize[_0xa8d5('0x2')]}}; \ No newline at end of file +var _0x3c7e=['STRING','DATE','TEXT','exports','medium','BOOLEAN','ENUM','out'];(function(_0x2288d1,_0x7ce616){var _0x1298fe=function(_0x1e6b99){while(--_0x1e6b99){_0x2288d1['push'](_0x2288d1['shift']());}};_0x1298fe(++_0x7ce616);}(_0x3c7e,0xdb));var _0xe3c7=function(_0x487f15,_0x1cf5fb){_0x487f15=_0x487f15-0x0;var _0x32c8a1=_0x3c7e[_0x487f15];return _0x32c8a1;};'use strict';var Sequelize=require('sequelize');module[_0xe3c7('0x0')]={'body':{'type':Sequelize['TEXT'](_0xe3c7('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xe3c7('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe3c7('0x3')]('in',_0xe3c7('0x4')),'defaultValue':_0xe3c7('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe3c7('0x5')](0xbe)},'phone':{'type':Sequelize[_0xe3c7('0x5')]},'readAt':{'type':Sequelize[_0xe3c7('0x6')]},'secret':{'type':Sequelize[_0xe3c7('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe3c7('0x5')]},'providerResponse':{'type':Sequelize[_0xe3c7('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 0f437b8..c550526 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 _0xcfa1=['role','RejectMessage','rejectMessage','contact','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','json','undefined','count','offset','limit','status','set','Content-Range','apply','reject','destroy','end','sendStatus','stack','name','send','index','WhatsappMessage','fieldName','type','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','body','update','describe','../../config/logger','accept','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','whatsapp-interactions','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x16efa6,_0x545448){var _0x556a4c=function(_0x120925){while(--_0x120925){_0x16efa6['push'](_0x16efa6['shift']());}};_0x556a4c(++_0x545448);}(_0xcfa1,0x99));var _0x1cfa=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xcfa1[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x1cfa('0x0'));var rimraf=require(_0x1cfa('0x1'));var zipdir=require(_0x1cfa('0x2'));var jsonpatch=require(_0x1cfa('0x3'));var rp=require(_0x1cfa('0x4'));var moment=require('moment');var BPromise=require(_0x1cfa('0x5'));var Mustache=require('mustache');var util=require(_0x1cfa('0x6'));var path=require(_0x1cfa('0x7'));var sox=require(_0x1cfa('0x8'));var csv=require(_0x1cfa('0x9'));var ejs=require(_0x1cfa('0xa'));var fs=require('fs');var fs_extra=require(_0x1cfa('0xb'));var _=require(_0x1cfa('0xc'));var squel=require(_0x1cfa('0xd'));var crypto=require(_0x1cfa('0xe'));var jsforce=require(_0x1cfa('0xf'));var deskjs=require(_0x1cfa('0x10'));var toCsv=require(_0x1cfa('0x9'));var querystring=require(_0x1cfa('0x11'));var Papa=require(_0x1cfa('0x12'));var Redis=require(_0x1cfa('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1cfa('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1cfa('0x15'));var utils=require('../../config/utils');var config=require(_0x1cfa('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1cfa('0x17')]=_[_0x1cfa('0x18')](config['redis'],{'host':_0x1cfa('0x19'),'port':0x18eb});var socket=require(_0x1cfa('0x1a'))(new Redis(config['redis']));require(_0x1cfa('0x1b'))[_0x1cfa('0x1c')](socket);var jayson=require(_0x1cfa('0x1d'));var client=jayson[_0x1cfa('0x1e')][_0x1cfa('0x1f')]({'port':0x232c});var client9002=jayson[_0x1cfa('0x1e')][_0x1cfa('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5d38c4,_0x369d87,_0x15bbce,_0xda6e18){return new BPromise(function(_0x543255,_0x540b7b){var _0x49e18f=_0xda6e18||client;return _0x49e18f[_0x1cfa('0x20')](_0x5d38c4,_0x15bbce)[_0x1cfa('0x21')](function(_0x8bd25d){logger[_0x1cfa('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x369d87,_0x1cfa('0x23'));logger[_0x1cfa('0x24')](_0x1cfa('0x25'),_0x369d87,_0x1cfa('0x23'),JSON['stringify'](_0x8bd25d));if(_0x8bd25d[_0x1cfa('0x26')]){if(_0x8bd25d[_0x1cfa('0x26')]['code']===0x1f4){logger[_0x1cfa('0x26')](_0x1cfa('0x27'),_0x369d87,_0x8bd25d[_0x1cfa('0x26')]['message']);return _0x540b7b(_0x8bd25d['error'][_0x1cfa('0x28')]);}logger[_0x1cfa('0x26')](_0x1cfa('0x27'),_0x369d87,_0x8bd25d['error'][_0x1cfa('0x28')]);return _0x543255(_0x8bd25d[_0x1cfa('0x26')][_0x1cfa('0x28')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x369d87,_0x1cfa('0x23'));_0x543255(_0x8bd25d[_0x1cfa('0x29')][_0x1cfa('0x28')]);}})[_0x1cfa('0x2a')](function(_0x3a3f19){logger[_0x1cfa('0x26')](_0x1cfa('0x27'),_0x369d87,_0x3a3f19);_0x540b7b(_0x3a3f19);});});}function respondWithStatusCode(_0x22571b,_0x79f820){_0x79f820=_0x79f820||0xcc;return function(_0xa801d3){if(_0xa801d3){return _0x22571b['sendStatus'](_0x79f820);}return _0x22571b['status'](_0x79f820)['end']();};}function respondWithResult(_0xf46c99,_0x32bcfa){_0x32bcfa=_0x32bcfa||0xc8;return function(_0x1d169b){if(_0x1d169b){return _0xf46c99['status'](_0x32bcfa)[_0x1cfa('0x2b')](_0x1d169b);}};}function respondWithFilteredResult(_0x3a3774,_0x1200f3){return function(_0x155641){if(_0x155641){var _0x2226ad=typeof _0x1200f3['offset']===_0x1cfa('0x2c')&&typeof _0x1200f3['limit']===_0x1cfa('0x2c');var _0x3b72dd=_0x155641[_0x1cfa('0x2d')];var _0x7336ea=_0x2226ad?0x0:_0x1200f3['offset'];var _0x166a1a=_0x2226ad?_0x155641['count']:_0x1200f3[_0x1cfa('0x2e')]+_0x1200f3[_0x1cfa('0x2f')];var _0x2687f4;if(_0x166a1a>=_0x3b72dd){_0x166a1a=_0x3b72dd;_0x2687f4=0xc8;}else{_0x2687f4=0xce;}_0x3a3774[_0x1cfa('0x30')](_0x2687f4);return _0x3a3774[_0x1cfa('0x31')](_0x1cfa('0x32'),_0x7336ea+'-'+_0x166a1a+'/'+_0x3b72dd)['json'](_0x155641);}return null;};}function patchUpdates(_0x20cf30){return function(_0x14ad94){try{jsonpatch[_0x1cfa('0x33')](_0x14ad94,_0x20cf30,!![]);}catch(_0x2a31d4){return BPromise[_0x1cfa('0x34')](_0x2a31d4);}return _0x14ad94['save']();};}function saveUpdates(_0x489055,_0x14674f){return function(_0x5998e8){if(_0x5998e8){return _0x5998e8['update'](_0x489055)[_0x1cfa('0x21')](function(_0x570191){return _0x570191;});}return null;};}function removeEntity(_0x400bd4,_0x27957d){return function(_0x2f53f8){if(_0x2f53f8){return _0x2f53f8[_0x1cfa('0x35')]()[_0x1cfa('0x21')](function(){_0x400bd4[_0x1cfa('0x30')](0xcc)[_0x1cfa('0x36')]();});}};}function handleEntityNotFound(_0x219c53,_0x349fa9){return function(_0x212a50){if(!_0x212a50){_0x219c53[_0x1cfa('0x37')](0x194);}return _0x212a50;};}function handleError(_0x47d5f8,_0x4d939a){_0x4d939a=_0x4d939a||0x1f4;return function(_0x1ed6e4){logger[_0x1cfa('0x26')](_0x1ed6e4[_0x1cfa('0x38')]);if(_0x1ed6e4['name']){delete _0x1ed6e4[_0x1cfa('0x39')];}_0x47d5f8[_0x1cfa('0x30')](_0x4d939a)[_0x1cfa('0x3a')](_0x1ed6e4);};}exports[_0x1cfa('0x3b')]=function(_0x2611f5,_0x125bd8){var _0x46ab6e={},_0x94cfcc={},_0x40141c={'count':0x0,'rows':[]};var _0x8245e5=_['map'](db[_0x1cfa('0x3c')]['rawAttributes'],function(_0x2f69cf){return{'name':_0x2f69cf[_0x1cfa('0x3d')],'type':_0x2f69cf[_0x1cfa('0x3e')]['key']};});_0x94cfcc[_0x1cfa('0x3f')]=_[_0x1cfa('0x40')](_0x8245e5,_0x1cfa('0x39'));_0x94cfcc[_0x1cfa('0x41')]=_['keys'](_0x2611f5[_0x1cfa('0x41')]);_0x94cfcc[_0x1cfa('0x42')]=_['intersection'](_0x94cfcc[_0x1cfa('0x3f')],_0x94cfcc[_0x1cfa('0x41')]);_0x46ab6e[_0x1cfa('0x43')]=_[_0x1cfa('0x44')](_0x94cfcc[_0x1cfa('0x3f')],qs[_0x1cfa('0x45')](_0x2611f5[_0x1cfa('0x41')][_0x1cfa('0x45')]));_0x46ab6e[_0x1cfa('0x43')]=_0x46ab6e[_0x1cfa('0x43')][_0x1cfa('0x46')]?_0x46ab6e['attributes']:_0x94cfcc[_0x1cfa('0x3f')];if(!_0x2611f5[_0x1cfa('0x41')][_0x1cfa('0x47')](_0x1cfa('0x48'))){_0x46ab6e[_0x1cfa('0x2f')]=qs[_0x1cfa('0x2f')](_0x2611f5[_0x1cfa('0x41')][_0x1cfa('0x2f')]);_0x46ab6e[_0x1cfa('0x2e')]=qs[_0x1cfa('0x2e')](_0x2611f5[_0x1cfa('0x41')][_0x1cfa('0x2e')]);}_0x46ab6e['order']=qs[_0x1cfa('0x49')](_0x2611f5[_0x1cfa('0x41')][_0x1cfa('0x49')]);_0x46ab6e[_0x1cfa('0x4a')]=qs[_0x1cfa('0x42')](_['pick'](_0x2611f5[_0x1cfa('0x41')],_0x94cfcc[_0x1cfa('0x42')]),_0x8245e5);if(_0x2611f5[_0x1cfa('0x41')][_0x1cfa('0x4b')]){_0x46ab6e[_0x1cfa('0x4a')]=_['merge'](_0x46ab6e[_0x1cfa('0x4a')],{'$or':_['map'](_0x8245e5,function(_0x401924){if(_0x401924[_0x1cfa('0x3e')]!=='VIRTUAL'){var _0x2c4de1={};_0x2c4de1[_0x401924[_0x1cfa('0x39')]]={'$like':'%'+_0x2611f5[_0x1cfa('0x41')][_0x1cfa('0x4b')]+'%'};return _0x2c4de1;}})});}_0x46ab6e=_[_0x1cfa('0x4c')]({},_0x46ab6e,_0x2611f5[_0x1cfa('0x4d')]);var _0x3d10cb={'where':_0x46ab6e[_0x1cfa('0x4a')]};return db[_0x1cfa('0x3c')][_0x1cfa('0x2d')](_0x3d10cb)[_0x1cfa('0x21')](function(_0x570fec){_0x40141c[_0x1cfa('0x2d')]=_0x570fec;if(_0x2611f5[_0x1cfa('0x41')]['includeAll']){_0x46ab6e[_0x1cfa('0x4e')]=[{'all':!![]}];}return db[_0x1cfa('0x3c')][_0x1cfa('0x4f')](_0x46ab6e);})[_0x1cfa('0x21')](function(_0x5c1372){_0x40141c[_0x1cfa('0x50')]=_0x5c1372;return _0x40141c;})[_0x1cfa('0x21')](respondWithFilteredResult(_0x125bd8,_0x46ab6e))[_0x1cfa('0x2a')](handleError(_0x125bd8,null));};exports[_0x1cfa('0x51')]=function(_0x4da3e1,_0xfd7f97){var _0x1f6d8e={'raw':!![],'where':{'id':_0x4da3e1[_0x1cfa('0x52')]['id']}},_0x3b29e3={};_0x3b29e3[_0x1cfa('0x3f')]=_[_0x1cfa('0x53')](db[_0x1cfa('0x3c')][_0x1cfa('0x54')]);_0x3b29e3[_0x1cfa('0x41')]=_['keys'](_0x4da3e1[_0x1cfa('0x41')]);_0x3b29e3[_0x1cfa('0x42')]=_[_0x1cfa('0x44')](_0x3b29e3[_0x1cfa('0x3f')],_0x3b29e3['query']);_0x1f6d8e[_0x1cfa('0x43')]=_['intersection'](_0x3b29e3['model'],qs['fields'](_0x4da3e1[_0x1cfa('0x41')][_0x1cfa('0x45')]));_0x1f6d8e['attributes']=_0x1f6d8e[_0x1cfa('0x43')]['length']?_0x1f6d8e[_0x1cfa('0x43')]:_0x3b29e3['model'];if(_0x4da3e1[_0x1cfa('0x41')][_0x1cfa('0x55')]){_0x1f6d8e['include']=[{'all':!![]}];}_0x1f6d8e=_['merge']({},_0x1f6d8e,_0x4da3e1['options']);return db[_0x1cfa('0x3c')][_0x1cfa('0x56')](_0x1f6d8e)[_0x1cfa('0x21')](handleEntityNotFound(_0xfd7f97,null))[_0x1cfa('0x21')](respondWithResult(_0xfd7f97,null))[_0x1cfa('0x2a')](handleError(_0xfd7f97,null));};exports['create']=function(_0x181994,_0x59bd9e){return db[_0x1cfa('0x3c')]['create'](_0x181994[_0x1cfa('0x57')],{})[_0x1cfa('0x21')](respondWithResult(_0x59bd9e,0xc9))[_0x1cfa('0x2a')](handleError(_0x59bd9e,null));};exports[_0x1cfa('0x58')]=function(_0x1a9970,_0x21d5f7){if(_0x1a9970[_0x1cfa('0x57')]['id']){delete _0x1a9970['body']['id'];}return db[_0x1cfa('0x3c')][_0x1cfa('0x56')]({'where':{'id':_0x1a9970['params']['id']}})[_0x1cfa('0x21')](handleEntityNotFound(_0x21d5f7,null))[_0x1cfa('0x21')](saveUpdates(_0x1a9970[_0x1cfa('0x57')],null))[_0x1cfa('0x21')](respondWithResult(_0x21d5f7,null))[_0x1cfa('0x2a')](handleError(_0x21d5f7,null));};exports[_0x1cfa('0x35')]=function(_0x2b9334,_0x1c36ee){return db[_0x1cfa('0x3c')][_0x1cfa('0x56')]({'where':{'id':_0x2b9334[_0x1cfa('0x52')]['id']}})['then'](handleEntityNotFound(_0x1c36ee,null))[_0x1cfa('0x21')](removeEntity(_0x1c36ee,null))[_0x1cfa('0x2a')](handleError(_0x1c36ee,null));};exports[_0x1cfa('0x59')]=function(_0x4083b6,_0x5e1241){return db[_0x1cfa('0x3c')][_0x1cfa('0x59')]()[_0x1cfa('0x21')](respondWithResult(_0x5e1241,null))[_0x1cfa('0x2a')](handleError(_0x5e1241,null));};var interaction_log=require(_0x1cfa('0x5a'))('whatsapp-interactions');exports[_0x1cfa('0x5b')]=function(_0x2432bb,_0x4f5a31,_0x2a6986){var _0x319c5b={'agent':{},'channel':'whatsapp'};if(_0x2432bb['body']['id']){delete _0x2432bb[_0x1cfa('0x57')]['id'];}_0x2432bb[_0x1cfa('0x57')][_0x1cfa('0x5c')]=!![];_0x2432bb[_0x1cfa('0x57')][_0x1cfa('0x5d')]=moment()[_0x1cfa('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x2432bb['body'][_0x1cfa('0x5f')]=_0x2432bb[_0x1cfa('0x57')][_0x1cfa('0x5f')]||_0x2432bb[_0x1cfa('0x60')]['id'];_0x319c5b[_0x1cfa('0x61')]['id']=_0x2432bb['body'][_0x1cfa('0x5f')];return db['WhatsappMessage'][_0x1cfa('0x56')]({'where':{'id':_0x2432bb['params']['id'],'UserId':null}})[_0x1cfa('0x21')](handleEntityNotFound(_0x4f5a31,null))['then'](saveUpdates(_0x2432bb[_0x1cfa('0x57')],null))['then'](function(_0x561b6b){if(_0x561b6b){_0x319c5b['message']=_0x561b6b[_0x1cfa('0x62')]({'plain':!![]});return db[_0x1cfa('0x63')][_0x1cfa('0x56')]({'where':{'id':_0x561b6b[_0x1cfa('0x64')]}});}return null;})[_0x1cfa('0x21')](handleEntityNotFound(_0x4f5a31,null))['then'](function(_0x14a34c){if(_0x14a34c){return _0x14a34c[_0x1cfa('0x58')]({'UserId':_0x2432bb[_0x1cfa('0x57')][_0x1cfa('0x5f')],'read1stAt':_[_0x1cfa('0x65')](_0x14a34c[_0x1cfa('0x66')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4983ee){if(_0x4983ee){_0x319c5b[_0x1cfa('0x67')]=_0x4983ee[_0x1cfa('0x62')]({'plain':!![]});interaction_log[_0x1cfa('0x22')](_0x1cfa('0x68'),_0x2432bb[_0x1cfa('0x60')]['id'],_0x2432bb[_0x1cfa('0x60')][_0x1cfa('0x39')],_0x2432bb['user']['role'],_0x319c5b[_0x1cfa('0x67')]['id'],_0x2432bb['body']?JSON[_0x1cfa('0x69')](_0x2432bb[_0x1cfa('0x57')]):_0x1cfa('0x6a'));return respondWithRpcPromise(_0x1cfa('0x6b'),_0x1cfa('0x6c'),_0x319c5b);}return null;})[_0x1cfa('0x21')](function(_0x456802){var _0x38a512='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x456802[_0x1cfa('0x28')][_0x1cfa('0x6d')];return db['sequelize'][_0x1cfa('0x41')](_0x38a512,{'type':db[_0x1cfa('0x6e')][_0x1cfa('0x6f')][_0x1cfa('0x70')],'raw':!![]})[_0x1cfa('0x21')](function(_0x17bf26){return _0x17bf26;});})[_0x1cfa('0x21')](function(_0x5da84d){if(_0x5da84d){_0x319c5b[_0x1cfa('0x28')]['contact']=_0x5da84d[0x0];if(!_0x2432bb['body']['UserId'])return;return db[_0x1cfa('0x71')][_0x1cfa('0x56')]({'where':{'id':_0x2432bb[_0x1cfa('0x57')][_0x1cfa('0x5f')],'role':_0x1cfa('0x61')},'attributes':['id','name',_0x1cfa('0x72'),'email','internal'],'raw':!![]});}return null;})[_0x1cfa('0x21')](function(_0x1a3529){if(!_0x1a3529)return null;_0x319c5b[_0x1cfa('0x28')][_0x1cfa('0x61')]=_0x1a3529;return _0x319c5b;})['then'](function(_0x3d198e){if(_0x3d198e){if(_0x2432bb[_0x1cfa('0x57')][_0x1cfa('0x73')]){_0x319c5b[_0x1cfa('0x28')][_0x1cfa('0x74')]=util[_0x1cfa('0x5e')](_0x1cfa('0x75'),_0x2432bb['user']['name']);_0x319c5b[_0x1cfa('0x28')][_0x1cfa('0x76')]=_0x319c5b['channel'];_0x319c5b[_0x1cfa('0x28')][_0x1cfa('0x77')]='accept';return respondWithRpcPromise(_0x1cfa('0x78'),_0x1cfa('0x78'),{'event':_0x1cfa('0x79'),'message':_0x319c5b[_0x1cfa('0x28')]},client9002)['then'](function(){return _0x319c5b;});}return _0x319c5b;}return null;})[_0x1cfa('0x21')](respondWithResult(_0x4f5a31,null))[_0x1cfa('0x2a')](handleError(_0x4f5a31,null));};var interaction_log=require('../../config/logger')(_0x1cfa('0x7a'));exports[_0x1cfa('0x34')]=function(_0x57883c,_0x2fba4,_0x2c369c){var _0x1914bb={'agent':{},'channel':_0x1cfa('0x7b')};if(_0x57883c[_0x1cfa('0x57')]['id']){delete _0x57883c[_0x1cfa('0x57')]['id'];}_0x57883c[_0x1cfa('0x57')][_0x1cfa('0x5f')]=_0x57883c[_0x1cfa('0x57')]['UserId']||_0x57883c['user']['id'];_0x1914bb[_0x1cfa('0x61')]['id']=_0x57883c[_0x1cfa('0x57')][_0x1cfa('0x5f')];return db['WhatsappMessage']['find']({'where':{'id':_0x57883c['params']['id'],'UserId':null}})[_0x1cfa('0x21')](handleEntityNotFound(_0x2fba4,null))[_0x1cfa('0x21')](function(_0x2a6b9d){if(_0x2a6b9d){_0x1914bb[_0x1cfa('0x28')]=_0x2a6b9d[_0x1cfa('0x62')]({'plain':!![]});return db[_0x1cfa('0x63')][_0x1cfa('0x56')]({'where':{'id':_0x2a6b9d[_0x1cfa('0x64')]}});}return null;})[_0x1cfa('0x21')](handleEntityNotFound(_0x2fba4,null))['then'](function(_0x4207cf){if(_0x4207cf){_0x1914bb[_0x1cfa('0x67')]=_0x4207cf[_0x1cfa('0x62')]({'plain':!![]});interaction_log[_0x1cfa('0x22')](_0x1cfa('0x7c'),_0x57883c[_0x1cfa('0x60')]['id'],_0x57883c[_0x1cfa('0x60')][_0x1cfa('0x39')],_0x57883c[_0x1cfa('0x60')][_0x1cfa('0x7d')],_0x1914bb[_0x1cfa('0x67')]['id'],_0x57883c[_0x1cfa('0x57')]?JSON['stringify'](_0x57883c[_0x1cfa('0x57')]):_0x1cfa('0x6a'));return respondWithRpcPromise(_0x1cfa('0x7e'),_0x1cfa('0x7f'),_0x1914bb);}return null;})['then'](function(_0x2727d0){var _0x161805='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2727d0[_0x1cfa('0x28')][_0x1cfa('0x6d')];return db['sequelize'][_0x1cfa('0x41')](_0x161805,{'type':db[_0x1cfa('0x6e')][_0x1cfa('0x6f')][_0x1cfa('0x70')],'raw':!![]})[_0x1cfa('0x21')](function(_0x12a928){return _0x12a928;});})[_0x1cfa('0x21')](function(_0x51e6bf){if(_0x51e6bf){_0x1914bb[_0x1cfa('0x28')][_0x1cfa('0x80')]=_0x51e6bf[0x0];if(!_0x57883c[_0x1cfa('0x57')]['UserId'])return;return db[_0x1cfa('0x71')][_0x1cfa('0x56')]({'where':{'id':_0x57883c[_0x1cfa('0x57')][_0x1cfa('0x5f')],'role':_0x1cfa('0x61')},'attributes':['id',_0x1cfa('0x39'),_0x1cfa('0x72'),'email','internal'],'raw':!![]});}return null;})[_0x1cfa('0x21')](function(_0xbedf50){if(!_0xbedf50)return null;_0x1914bb[_0x1cfa('0x28')]['agent']=_0xbedf50;return _0x1914bb;})['then'](function(_0x237a50){if(_0x237a50){_0x237a50['message'][_0x1cfa('0x74')]=util[_0x1cfa('0x5e')](_0x1cfa('0x75'),_0x57883c[_0x1cfa('0x60')][_0x1cfa('0x39')]);_0x237a50[_0x1cfa('0x28')][_0x1cfa('0x76')]=_0x1914bb[_0x1cfa('0x76')];_0x237a50[_0x1cfa('0x28')][_0x1cfa('0x77')]='reject';respondWithRpcPromise('EventManager',_0x1cfa('0x78'),{'event':_0x1cfa('0x81'),'message':_0x237a50['message']},client9002);return _0x1914bb;}return null;})['then'](respondWithResult(_0x2fba4,null))[_0x1cfa('0x2a')](handleError(_0x2fba4,null));};exports[_0x1cfa('0x30')]=function(_0x19a6d3,_0x1eec7a,_0x21ebca){if(_0x19a6d3[_0x1cfa('0x57')]['id']){delete _0x19a6d3[_0x1cfa('0x57')]['id'];}var _0x52a86b;return db[_0x1cfa('0x3c')]['find']({'where':{'id':_0x19a6d3['params']['id']}})[_0x1cfa('0x21')](handleEntityNotFound(_0x1eec7a,null))[_0x1cfa('0x21')](function(_0x4a2a50){if(_0x4a2a50){_0x52a86b=_0x4a2a50;return db[_0x1cfa('0x82')][_0x1cfa('0x56')]({'where':{'id':_0x4a2a50[_0x1cfa('0x83')]}});}})[_0x1cfa('0x21')](handleEntityNotFound(_0x1eec7a,null))['then'](function(_0x3a00f5){if(_0x3a00f5){logger[_0x1cfa('0x24')](_0x1cfa('0x84'),_0x1cfa('0x30'),_0x1cfa('0x85'),_0x3a00f5[_0x1cfa('0x3e')],util[_0x1cfa('0x86')](_0x19a6d3['body'],{'showHidden':![],'depth':null}));switch(_0x3a00f5[_0x1cfa('0x3e')]){case _0x1cfa('0x87'):if(_0x19a6d3[_0x1cfa('0x57')][_0x1cfa('0x88')]&&_0x19a6d3['body'][_0x1cfa('0x88')]===_0x52a86b['messageId']&&_0x19a6d3[_0x1cfa('0x57')][_0x1cfa('0x89')]&&_0x19a6d3[_0x1cfa('0x57')]['MessageStatus']===_0x1cfa('0x5c')){return _0x52a86b[_0x1cfa('0x58')]({'read':!![]});}else{logger[_0x1cfa('0x26')](_0x1cfa('0x8a'),_0x1cfa('0x30'),_0x1cfa('0x87'),util[_0x1cfa('0x86')](_0x19a6d3['body'],{'showHidden':![],'depth':null}));}break;}return _0x52a86b;}})['then'](respondWithResult(_0x1eec7a,null))[_0x1cfa('0x2a')](handleError(_0x1eec7a,null));}; \ No newline at end of file +var _0x2f66=['destroy','stack','name','WhatsappMessage','rawAttributes','key','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','type','options','include','findAll','rows','show','model','intersection','includeAll','find','create','body','params','whatsapp-interactions','accept','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','channel','EventManager','acceptmessage','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SIP/%s','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','http','client','request','then','info','request\x20sent','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update'];(function(_0x56b604,_0x1a2925){var _0x3d1c7c=function(_0x3c6a7c){while(--_0x3c6a7c){_0x56b604['push'](_0x56b604['shift']());}};_0x3d1c7c(++_0x1a2925);}(_0x2f66,0x1ea));var _0x62f6=function(_0x6b4f52,_0x4a17d1){_0x6b4f52=_0x6b4f52-0x0;var _0xa387e5=_0x2f66[_0x6b4f52];return _0xa387e5;};'use strict';var emlformat=require(_0x62f6('0x0'));var rimraf=require(_0x62f6('0x1'));var zipdir=require(_0x62f6('0x2'));var jsonpatch=require(_0x62f6('0x3'));var rp=require(_0x62f6('0x4'));var moment=require(_0x62f6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x62f6('0x6'));var util=require('util');var path=require(_0x62f6('0x7'));var sox=require(_0x62f6('0x8'));var csv=require('to-csv');var ejs=require(_0x62f6('0x9'));var fs=require('fs');var fs_extra=require(_0x62f6('0xa'));var _=require(_0x62f6('0xb'));var squel=require(_0x62f6('0xc'));var crypto=require(_0x62f6('0xd'));var jsforce=require(_0x62f6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x62f6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x62f6('0x10'));var as=require(_0x62f6('0x11'));var hardwareService=require(_0x62f6('0x12'));var logger=require(_0x62f6('0x13'))(_0x62f6('0x14'));var utils=require('../../config/utils');var config=require(_0x62f6('0x15'));var licenseUtil=require(_0x62f6('0x16'));var db=require(_0x62f6('0x17'))['db'];config[_0x62f6('0x18')]=_[_0x62f6('0x19')](config[_0x62f6('0x18')],{'host':_0x62f6('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x62f6('0x18')]));require(_0x62f6('0x1b'))[_0x62f6('0x1c')](socket);var jayson=require(_0x62f6('0x1d'));var client=jayson['client'][_0x62f6('0x1e')]({'port':0x232c});var client9002=jayson[_0x62f6('0x1f')][_0x62f6('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x487f49,_0x237849,_0x5be8d8,_0x443830){return new BPromise(function(_0x2a69b1,_0x277b2a){var _0x473c8c=_0x443830||client;return _0x473c8c[_0x62f6('0x20')](_0x487f49,_0x5be8d8)[_0x62f6('0x21')](function(_0x37b50b){logger[_0x62f6('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x237849,_0x62f6('0x23'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x237849,_0x62f6('0x23'),JSON[_0x62f6('0x24')](_0x37b50b));if(_0x37b50b[_0x62f6('0x25')]){if(_0x37b50b[_0x62f6('0x25')][_0x62f6('0x26')]===0x1f4){logger[_0x62f6('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x237849,_0x37b50b['error'][_0x62f6('0x27')]);return _0x277b2a(_0x37b50b['error'][_0x62f6('0x27')]);}logger[_0x62f6('0x25')](_0x62f6('0x28'),_0x237849,_0x37b50b[_0x62f6('0x25')][_0x62f6('0x27')]);return _0x2a69b1(_0x37b50b['error']['message']);}else{logger[_0x62f6('0x22')](_0x62f6('0x28'),_0x237849,_0x62f6('0x23'));_0x2a69b1(_0x37b50b['result']['message']);}})[_0x62f6('0x29')](function(_0x4e8ca7){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x237849,_0x4e8ca7);_0x277b2a(_0x4e8ca7);});});}function respondWithStatusCode(_0x4b395e,_0x7933b1){_0x7933b1=_0x7933b1||0xcc;return function(_0x32f712){if(_0x32f712){return _0x4b395e[_0x62f6('0x2a')](_0x7933b1);}return _0x4b395e['status'](_0x7933b1)[_0x62f6('0x2b')]();};}function respondWithResult(_0x1aa39e,_0xa54c8b){_0xa54c8b=_0xa54c8b||0xc8;return function(_0x483a14){if(_0x483a14){return _0x1aa39e[_0x62f6('0x2c')](_0xa54c8b)[_0x62f6('0x2d')](_0x483a14);}};}function respondWithFilteredResult(_0x58b7ad,_0x8cceea){return function(_0x3ee158){if(_0x3ee158){var _0x3e465b=typeof _0x8cceea[_0x62f6('0x2e')]===_0x62f6('0x2f')&&typeof _0x8cceea[_0x62f6('0x30')]===_0x62f6('0x2f');var _0x4f7417=_0x3ee158[_0x62f6('0x31')];var _0x5c6d30=_0x3e465b?0x0:_0x8cceea[_0x62f6('0x2e')];var _0x3a9b3a=_0x3e465b?_0x3ee158[_0x62f6('0x31')]:_0x8cceea[_0x62f6('0x2e')]+_0x8cceea[_0x62f6('0x30')];var _0x332dc9;if(_0x3a9b3a>=_0x4f7417){_0x3a9b3a=_0x4f7417;_0x332dc9=0xc8;}else{_0x332dc9=0xce;}_0x58b7ad[_0x62f6('0x2c')](_0x332dc9);return _0x58b7ad[_0x62f6('0x32')](_0x62f6('0x33'),_0x5c6d30+'-'+_0x3a9b3a+'/'+_0x4f7417)[_0x62f6('0x2d')](_0x3ee158);}return null;};}function patchUpdates(_0x3cb15c){return function(_0x4ff112){try{jsonpatch['apply'](_0x4ff112,_0x3cb15c,!![]);}catch(_0x33d6a1){return BPromise[_0x62f6('0x34')](_0x33d6a1);}return _0x4ff112['save']();};}function saveUpdates(_0x11bdb8,_0x320e30){return function(_0x37557f){if(_0x37557f){return _0x37557f[_0x62f6('0x35')](_0x11bdb8)[_0x62f6('0x21')](function(_0x469d36){return _0x469d36;});}return null;};}function removeEntity(_0xe7403c,_0x5d1280){return function(_0x1571d6){if(_0x1571d6){return _0x1571d6[_0x62f6('0x36')]()[_0x62f6('0x21')](function(){_0xe7403c[_0x62f6('0x2c')](0xcc)[_0x62f6('0x2b')]();});}};}function handleEntityNotFound(_0x138a8a,_0x2384ef){return function(_0x573734){if(!_0x573734){_0x138a8a[_0x62f6('0x2a')](0x194);}return _0x573734;};}function handleError(_0x21262c,_0x2bbe80){_0x2bbe80=_0x2bbe80||0x1f4;return function(_0x27527a){logger[_0x62f6('0x25')](_0x27527a[_0x62f6('0x37')]);if(_0x27527a[_0x62f6('0x38')]){delete _0x27527a[_0x62f6('0x38')];}_0x21262c['status'](_0x2bbe80)['send'](_0x27527a);};}exports['index']=function(_0xfd874e,_0x20b94c){var _0xda9894={},_0x1f0c18={},_0x560ce0={'count':0x0,'rows':[]};var _0x5619cb=_['map'](db[_0x62f6('0x39')][_0x62f6('0x3a')],function(_0x1bc681){return{'name':_0x1bc681['fieldName'],'type':_0x1bc681['type'][_0x62f6('0x3b')]};});_0x1f0c18['model']=_['map'](_0x5619cb,_0x62f6('0x38'));_0x1f0c18[_0x62f6('0x3c')]=_[_0x62f6('0x3d')](_0xfd874e['query']);_0x1f0c18['filters']=_['intersection'](_0x1f0c18['model'],_0x1f0c18[_0x62f6('0x3c')]);_0xda9894['attributes']=_['intersection'](_0x1f0c18['model'],qs['fields'](_0xfd874e['query'][_0x62f6('0x3e')]));_0xda9894['attributes']=_0xda9894[_0x62f6('0x3f')][_0x62f6('0x40')]?_0xda9894['attributes']:_0x1f0c18['model'];if(!_0xfd874e[_0x62f6('0x3c')][_0x62f6('0x41')](_0x62f6('0x42'))){_0xda9894['limit']=qs[_0x62f6('0x30')](_0xfd874e[_0x62f6('0x3c')]['limit']);_0xda9894[_0x62f6('0x2e')]=qs[_0x62f6('0x2e')](_0xfd874e['query'][_0x62f6('0x2e')]);}_0xda9894[_0x62f6('0x43')]=qs[_0x62f6('0x44')](_0xfd874e['query']['sort']);_0xda9894[_0x62f6('0x45')]=qs['filters'](_[_0x62f6('0x46')](_0xfd874e[_0x62f6('0x3c')],_0x1f0c18[_0x62f6('0x47')]),_0x5619cb);if(_0xfd874e[_0x62f6('0x3c')][_0x62f6('0x48')]){_0xda9894[_0x62f6('0x45')]=_[_0x62f6('0x49')](_0xda9894[_0x62f6('0x45')],{'$or':_[_0x62f6('0x4a')](_0x5619cb,function(_0x5dce21){if(_0x5dce21[_0x62f6('0x4b')]!=='VIRTUAL'){var _0x424e13={};_0x424e13[_0x5dce21[_0x62f6('0x38')]]={'$like':'%'+_0xfd874e[_0x62f6('0x3c')][_0x62f6('0x48')]+'%'};return _0x424e13;}})});}_0xda9894=_[_0x62f6('0x49')]({},_0xda9894,_0xfd874e[_0x62f6('0x4c')]);var _0x2c03d6={'where':_0xda9894[_0x62f6('0x45')]};return db[_0x62f6('0x39')][_0x62f6('0x31')](_0x2c03d6)['then'](function(_0x1febaf){_0x560ce0['count']=_0x1febaf;if(_0xfd874e[_0x62f6('0x3c')]['includeAll']){_0xda9894[_0x62f6('0x4d')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x62f6('0x4e')](_0xda9894);})[_0x62f6('0x21')](function(_0x581ee9){_0x560ce0[_0x62f6('0x4f')]=_0x581ee9;return _0x560ce0;})['then'](respondWithFilteredResult(_0x20b94c,_0xda9894))[_0x62f6('0x29')](handleError(_0x20b94c,null));};exports[_0x62f6('0x50')]=function(_0x4f8235,_0x5c96de){var _0x4b4972={'raw':!![],'where':{'id':_0x4f8235['params']['id']}},_0x1678c4={};_0x1678c4[_0x62f6('0x51')]=_[_0x62f6('0x3d')](db['WhatsappMessage'][_0x62f6('0x3a')]);_0x1678c4[_0x62f6('0x3c')]=_[_0x62f6('0x3d')](_0x4f8235[_0x62f6('0x3c')]);_0x1678c4[_0x62f6('0x47')]=_[_0x62f6('0x52')](_0x1678c4[_0x62f6('0x51')],_0x1678c4[_0x62f6('0x3c')]);_0x4b4972[_0x62f6('0x3f')]=_['intersection'](_0x1678c4[_0x62f6('0x51')],qs[_0x62f6('0x3e')](_0x4f8235['query'][_0x62f6('0x3e')]));_0x4b4972['attributes']=_0x4b4972[_0x62f6('0x3f')][_0x62f6('0x40')]?_0x4b4972[_0x62f6('0x3f')]:_0x1678c4['model'];if(_0x4f8235['query'][_0x62f6('0x53')]){_0x4b4972[_0x62f6('0x4d')]=[{'all':!![]}];}_0x4b4972=_[_0x62f6('0x49')]({},_0x4b4972,_0x4f8235['options']);return db[_0x62f6('0x39')][_0x62f6('0x54')](_0x4b4972)[_0x62f6('0x21')](handleEntityNotFound(_0x5c96de,null))[_0x62f6('0x21')](respondWithResult(_0x5c96de,null))[_0x62f6('0x29')](handleError(_0x5c96de,null));};exports[_0x62f6('0x55')]=function(_0x5c95ad,_0x4c414a){return db[_0x62f6('0x39')][_0x62f6('0x55')](_0x5c95ad[_0x62f6('0x56')],{})['then'](respondWithResult(_0x4c414a,0xc9))[_0x62f6('0x29')](handleError(_0x4c414a,null));};exports[_0x62f6('0x35')]=function(_0x3e4ba2,_0x246509){if(_0x3e4ba2[_0x62f6('0x56')]['id']){delete _0x3e4ba2['body']['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x3e4ba2['params']['id']}})['then'](handleEntityNotFound(_0x246509,null))[_0x62f6('0x21')](saveUpdates(_0x3e4ba2[_0x62f6('0x56')],null))[_0x62f6('0x21')](respondWithResult(_0x246509,null))[_0x62f6('0x29')](handleError(_0x246509,null));};exports[_0x62f6('0x36')]=function(_0x1db14d,_0x316454){return db[_0x62f6('0x39')][_0x62f6('0x54')]({'where':{'id':_0x1db14d[_0x62f6('0x57')]['id']}})[_0x62f6('0x21')](handleEntityNotFound(_0x316454,null))[_0x62f6('0x21')](removeEntity(_0x316454,null))[_0x62f6('0x29')](handleError(_0x316454,null));};exports['describe']=function(_0xbf4d14,_0x5f2078){return db[_0x62f6('0x39')]['describe']()[_0x62f6('0x21')](respondWithResult(_0x5f2078,null))[_0x62f6('0x29')](handleError(_0x5f2078,null));};var interaction_log=require('../../config/logger')(_0x62f6('0x58'));exports[_0x62f6('0x59')]=function(_0xf52424,_0x76e004,_0x5d7725){var _0x35fd92={'agent':{},'channel':'whatsapp'};if(_0xf52424[_0x62f6('0x56')]['id']){delete _0xf52424[_0x62f6('0x56')]['id'];}_0xf52424['body']['read']=!![];_0xf52424['body']['readAt']=moment()[_0x62f6('0x5a')](_0x62f6('0x5b'));_0xf52424['body'][_0x62f6('0x5c')]=_0xf52424['body'][_0x62f6('0x5c')]||_0xf52424[_0x62f6('0x5d')]['id'];_0x35fd92[_0x62f6('0x5e')]['id']=_0xf52424[_0x62f6('0x56')][_0x62f6('0x5c')];return db[_0x62f6('0x39')][_0x62f6('0x54')]({'where':{'id':_0xf52424[_0x62f6('0x57')]['id'],'UserId':null}})[_0x62f6('0x21')](handleEntityNotFound(_0x76e004,null))[_0x62f6('0x21')](saveUpdates(_0xf52424['body'],null))['then'](function(_0x36c573){if(_0x36c573){_0x35fd92['message']=_0x36c573[_0x62f6('0x5f')]({'plain':!![]});return db[_0x62f6('0x60')]['find']({'where':{'id':_0x36c573[_0x62f6('0x61')]}});}return null;})[_0x62f6('0x21')](handleEntityNotFound(_0x76e004,null))['then'](function(_0x5b6d86){if(_0x5b6d86){return _0x5b6d86[_0x62f6('0x35')]({'UserId':_0xf52424['body'][_0x62f6('0x5c')],'read1stAt':_[_0x62f6('0x62')](_0x5b6d86['read1stAt'])?moment()['format'](_0x62f6('0x5b')):undefined});}return null;})[_0x62f6('0x21')](function(_0xbd7f51){if(_0xbd7f51){_0x35fd92[_0x62f6('0x63')]=_0xbd7f51[_0x62f6('0x5f')]({'plain':!![]});interaction_log[_0x62f6('0x22')](_0x62f6('0x64'),_0xf52424[_0x62f6('0x5d')]['id'],_0xf52424[_0x62f6('0x5d')]['name'],_0xf52424[_0x62f6('0x5d')]['role'],_0x35fd92[_0x62f6('0x63')]['id'],_0xf52424[_0x62f6('0x56')]?JSON[_0x62f6('0x24')](_0xf52424[_0x62f6('0x56')]):_0x62f6('0x65'));return respondWithRpcPromise(_0x62f6('0x66'),_0x62f6('0x67'),_0x35fd92);}return null;})[_0x62f6('0x21')](function(_0x365ddd){var _0x235e65=_0x62f6('0x68')+_0x365ddd[_0x62f6('0x27')][_0x62f6('0x69')];return db[_0x62f6('0x6a')][_0x62f6('0x3c')](_0x235e65,{'type':db[_0x62f6('0x6b')][_0x62f6('0x6c')]['SELECT'],'raw':!![]})['then'](function(_0x5960cb){return _0x5960cb;});})['then'](function(_0x236c1e){if(_0x236c1e){_0x35fd92[_0x62f6('0x27')][_0x62f6('0x6d')]=_0x236c1e[0x0];if(!_0xf52424[_0x62f6('0x56')][_0x62f6('0x5c')])return;return db[_0x62f6('0x6e')][_0x62f6('0x54')]({'where':{'id':_0xf52424[_0x62f6('0x56')][_0x62f6('0x5c')],'role':_0x62f6('0x5e')},'attributes':['id',_0x62f6('0x38'),_0x62f6('0x6f'),_0x62f6('0x70'),_0x62f6('0x71')],'raw':!![]});}return null;})[_0x62f6('0x21')](function(_0x5baae7){if(!_0x5baae7)return null;_0x35fd92[_0x62f6('0x27')]['agent']=_0x5baae7;return _0x35fd92;})[_0x62f6('0x21')](function(_0x1ecda7){if(_0x1ecda7){if(_0xf52424[_0x62f6('0x56')][_0x62f6('0x72')]){_0x35fd92[_0x62f6('0x27')][_0x62f6('0x73')]=util[_0x62f6('0x5a')]('SIP/%s',_0xf52424[_0x62f6('0x5d')]['name']);_0x35fd92[_0x62f6('0x27')]['channel']=_0x35fd92[_0x62f6('0x74')];_0x35fd92['message']['event']=_0x62f6('0x59');return respondWithRpcPromise(_0x62f6('0x75'),_0x62f6('0x75'),{'event':_0x62f6('0x76'),'message':_0x35fd92[_0x62f6('0x27')]},client9002)[_0x62f6('0x21')](function(){return _0x35fd92;});}return _0x35fd92;}return null;})['then'](respondWithResult(_0x76e004,null))['catch'](handleError(_0x76e004,null));};var interaction_log=require(_0x62f6('0x13'))(_0x62f6('0x58'));exports['reject']=function(_0x37c739,_0x2ca26f,_0x14f92a){var _0x2dabcf={'agent':{},'channel':_0x62f6('0x77')};if(_0x37c739[_0x62f6('0x56')]['id']){delete _0x37c739[_0x62f6('0x56')]['id'];}_0x37c739[_0x62f6('0x56')][_0x62f6('0x5c')]=_0x37c739[_0x62f6('0x56')][_0x62f6('0x5c')]||_0x37c739[_0x62f6('0x5d')]['id'];_0x2dabcf[_0x62f6('0x5e')]['id']=_0x37c739[_0x62f6('0x56')][_0x62f6('0x5c')];return db[_0x62f6('0x39')][_0x62f6('0x54')]({'where':{'id':_0x37c739[_0x62f6('0x57')]['id'],'UserId':null}})[_0x62f6('0x21')](handleEntityNotFound(_0x2ca26f,null))['then'](function(_0x17e750){if(_0x17e750){_0x2dabcf[_0x62f6('0x27')]=_0x17e750[_0x62f6('0x5f')]({'plain':!![]});return db[_0x62f6('0x60')][_0x62f6('0x54')]({'where':{'id':_0x17e750[_0x62f6('0x61')]}});}return null;})[_0x62f6('0x21')](handleEntityNotFound(_0x2ca26f,null))[_0x62f6('0x21')](function(_0x5bc66e){if(_0x5bc66e){_0x2dabcf['interaction']=_0x5bc66e[_0x62f6('0x5f')]({'plain':!![]});interaction_log[_0x62f6('0x22')](_0x62f6('0x78'),_0x37c739[_0x62f6('0x5d')]['id'],_0x37c739['user'][_0x62f6('0x38')],_0x37c739[_0x62f6('0x5d')][_0x62f6('0x79')],_0x2dabcf[_0x62f6('0x63')]['id'],_0x37c739[_0x62f6('0x56')]?JSON[_0x62f6('0x24')](_0x37c739[_0x62f6('0x56')]):_0x62f6('0x65'));return respondWithRpcPromise('RejectMessage',_0x62f6('0x7a'),_0x2dabcf);}return null;})[_0x62f6('0x21')](function(_0x386b3b){var _0x53d2a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x386b3b['message']['ContactId'];return db['sequelize'][_0x62f6('0x3c')](_0x53d2a,{'type':db[_0x62f6('0x6b')][_0x62f6('0x6c')]['SELECT'],'raw':!![]})[_0x62f6('0x21')](function(_0x422402){return _0x422402;});})[_0x62f6('0x21')](function(_0x6a17de){if(_0x6a17de){_0x2dabcf[_0x62f6('0x27')][_0x62f6('0x6d')]=_0x6a17de[0x0];if(!_0x37c739[_0x62f6('0x56')][_0x62f6('0x5c')])return;return db[_0x62f6('0x6e')][_0x62f6('0x54')]({'where':{'id':_0x37c739[_0x62f6('0x56')][_0x62f6('0x5c')],'role':_0x62f6('0x5e')},'attributes':['id',_0x62f6('0x38'),_0x62f6('0x6f'),_0x62f6('0x70'),_0x62f6('0x71')],'raw':!![]});}return null;})[_0x62f6('0x21')](function(_0x47662e){if(!_0x47662e)return null;_0x2dabcf['message'][_0x62f6('0x5e')]=_0x47662e;return _0x2dabcf;})[_0x62f6('0x21')](function(_0x25bcbf){if(_0x25bcbf){_0x25bcbf[_0x62f6('0x27')][_0x62f6('0x73')]=util['format'](_0x62f6('0x7b'),_0x37c739[_0x62f6('0x5d')][_0x62f6('0x38')]);_0x25bcbf[_0x62f6('0x27')]['channel']=_0x2dabcf[_0x62f6('0x74')];_0x25bcbf[_0x62f6('0x27')]['event']=_0x62f6('0x34');respondWithRpcPromise(_0x62f6('0x75'),'EventManager',{'event':'rejectmessage','message':_0x25bcbf['message']},client9002);return _0x2dabcf;}return null;})[_0x62f6('0x21')](respondWithResult(_0x2ca26f,null))[_0x62f6('0x29')](handleError(_0x2ca26f,null));};exports[_0x62f6('0x2c')]=function(_0x3f018b,_0x435cb4,_0x53d011){if(_0x3f018b[_0x62f6('0x56')]['id']){delete _0x3f018b[_0x62f6('0x56')]['id'];}var _0x329272;return db[_0x62f6('0x39')][_0x62f6('0x54')]({'where':{'id':_0x3f018b[_0x62f6('0x57')]['id']}})['then'](handleEntityNotFound(_0x435cb4,null))[_0x62f6('0x21')](function(_0x5d9076){if(_0x5d9076){_0x329272=_0x5d9076;return db[_0x62f6('0x7c')][_0x62f6('0x54')]({'where':{'id':_0x5d9076[_0x62f6('0x7d')]}});}})[_0x62f6('0x21')](handleEntityNotFound(_0x435cb4,null))['then'](function(_0x8b0cf3){if(_0x8b0cf3){logger[_0x62f6('0x7e')](_0x62f6('0x7f'),_0x62f6('0x2c'),_0x62f6('0x80'),_0x8b0cf3[_0x62f6('0x4b')],util[_0x62f6('0x81')](_0x3f018b['body'],{'showHidden':![],'depth':null}));switch(_0x8b0cf3['type']){case _0x62f6('0x82'):if(_0x3f018b[_0x62f6('0x56')][_0x62f6('0x83')]&&_0x3f018b['body'][_0x62f6('0x83')]===_0x329272[_0x62f6('0x84')]&&_0x3f018b[_0x62f6('0x56')][_0x62f6('0x85')]&&_0x3f018b[_0x62f6('0x56')][_0x62f6('0x85')]===_0x62f6('0x86')){return _0x329272[_0x62f6('0x35')]({'read':!![]});}else{logger[_0x62f6('0x25')](_0x62f6('0x87'),_0x62f6('0x2c'),'twilio',util[_0x62f6('0x81')](_0x3f018b['body'],{'showHidden':![],'depth':null}));}break;}return _0x329272;}})['then'](respondWithResult(_0x435cb4,null))['catch'](handleError(_0x435cb4,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 4453a72..89582ff 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 _0x5423=['hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5423,0xe3));var _0x3542=function(_0x2d46a1,_0x3d49bf){_0x2d46a1=_0x2d46a1-0x0;var _0x26f267=_0x5423[_0x2d46a1];return _0x26f267;};'use strict';var EventEmitter=require(_0x3542('0x0'));var WhatsappMessage=require(_0x3542('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x3542('0x2')](0x0);var events={'afterCreate':_0x3542('0x3'),'afterUpdate':'update','afterDestroy':_0x3542('0x4')};function emitEvent(_0x1202d5){return function(_0xf0835,_0x2a1864,_0x54ea2f){WhatsappMessageEvents[_0x3542('0x5')](_0x1202d5+':'+_0xf0835['id'],_0xf0835);WhatsappMessageEvents[_0x3542('0x5')](_0x1202d5,_0xf0835);_0x54ea2f(null);};}for(var e in events){if(events[_0x3542('0x6')](e)){var event=events[e];WhatsappMessage[_0x3542('0x7')](e,emitEvent(event));}}module[_0x3542('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0x57f8=['emit','hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove'];(function(_0x185417,_0xe896f0){var _0x5de625=function(_0x2732ed){while(--_0x2732ed){_0x185417['push'](_0x185417['shift']());}};_0x5de625(++_0xe896f0);}(_0x57f8,0x198));var _0x857f=function(_0xa71f02,_0x5c9690){_0xa71f02=_0xa71f02-0x0;var _0x19798a=_0x57f8[_0xa71f02];return _0x19798a;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x857f('0x0'))['db'][_0x857f('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x857f('0x2')](0x0);var events={'afterCreate':_0x857f('0x3'),'afterUpdate':_0x857f('0x4'),'afterDestroy':_0x857f('0x5')};function emitEvent(_0x2ff336){return function(_0x6f054b,_0x318050,_0xced48e){WhatsappMessageEvents[_0x857f('0x6')](_0x2ff336+':'+_0x6f054b['id'],_0x6f054b);WhatsappMessageEvents[_0x857f('0x6')](_0x2ff336,_0x6f054b);_0xced48e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x857f('0x7')](e,emitEvent(event));}}module[_0x857f('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 8d87a35..80cbcfe 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 _0xbaa9=['error','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token'];(function(_0x5e77db,_0x356d1c){var _0x34b675=function(_0x4914b5){while(--_0x4914b5){_0x5e77db['push'](_0x5e77db['shift']());}};_0x34b675(++_0x356d1c);}(_0xbaa9,0x188));var _0x9baa=function(_0x391b04,_0x300f83){_0x391b04=_0x391b04-0x0;var _0x1e7c0a=_0xbaa9[_0x391b04];return _0x1e7c0a;};'use strict';var _=require(_0x9baa('0x0'));var util=require('util');var logger=require(_0x9baa('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9baa('0x2'));var rp=require(_0x9baa('0x3'));var fs=require('fs');var path=require(_0x9baa('0x4'));var rimraf=require(_0x9baa('0x5'));var config=require(_0x9baa('0x6'));var attributes=require(_0x9baa('0x7'));module['exports']=function(_0x3d1743,_0x5be12a){return _0x3d1743[_0x9baa('0x8')](_0x9baa('0x9'),attributes,{'tableName':_0x9baa('0xa'),'paranoid':![],'indexes':[{'name':_0x9baa('0xb'),'fields':[_0x9baa('0xb')]},{'name':'fti_whatsapp_messages','fields':[_0x9baa('0xc')],'type':_0x9baa('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa24295,_0x32133d,_0x338b3e){var _0x38f7c4=_0x3d1743[_0x9baa('0xe')];var _0x22010b=_0xa24295['get']({'plain':!![]});if(_0x22010b[_0x9baa('0xf')][_0x9baa('0x10')]()==='in'||_0x22010b[_0x9baa('0xf')][_0x9baa('0x10')]()===_0x9baa('0x11')&&!_0x22010b[_0x9baa('0x12')]&&!_[_0x9baa('0x13')](_0x22010b[_0x9baa('0x14')])){_0x38f7c4[_0x9baa('0x15')][_0x9baa('0x16')]({'where':{'id':_0x22010b[_0x9baa('0x17')]}})[_0x9baa('0x18')](function(_0x4800fe){if(_0x4800fe){_0x4800fe[_0x9baa('0x19')]({'lastMsgAt':_0x22010b[_0x9baa('0x1a')],'lastMsgDirection':_0x22010b[_0x9baa('0xf')][_0x9baa('0x10')]()});}})[_0x9baa('0x1b')](function(_0x30e514){console['error'](_0x30e514);});}if(_0x22010b['direction']===_0x9baa('0x11')&&!_0x22010b[_0x9baa('0x12')]){var _0x1e3a68;_0x38f7c4[_0x9baa('0x1c')][_0x9baa('0x1d')]({'where':{'id':_0x22010b['WhatsappAccountId']},'raw':!![]})['then'](function(_0x4587f0){_0x1e3a68=_0x4587f0;if(_0x1e3a68&&_0x1e3a68[_0x9baa('0x1e')]){switch(_0x1e3a68[_0x9baa('0x1e')]){case _0x9baa('0x1f'):var _0x1f087a=require(_0x9baa('0x1f'));if(_0x1e3a68[_0x9baa('0x20')]&&_0x1e3a68[_0x9baa('0x21')]&&_0x1e3a68[_0x9baa('0x22')]){var _0x346662=new _0x1f087a(_0x1e3a68[_0x9baa('0x20')],_0x1e3a68['authToken']);_0x346662['messages']['create']({'body':_0x22010b['body'],'to':_0x9baa('0x23')+_0x22010b['phone'],'from':_0x9baa('0x23')+_0x1e3a68[_0x9baa('0x22')],'statusCallback':_0x1e3a68[_0x9baa('0x24')]+_0x9baa('0x25')+_0x22010b['id']+_0x9baa('0x26')+_0x1e3a68[_0x9baa('0x27')]})[_0x9baa('0x18')](function(_0xd6038d){if(_0xd6038d['sid']){return _0xa24295[_0x9baa('0x19')]({'messageId':_0xd6038d['sid']});}})[_0x9baa('0x1b')](function(_0x497217){logger[_0x9baa('0x28')](_0x9baa('0x29'),'afterCreate','twilio',util[_0x9baa('0x2a')](_0x497217,{'showHidden':![],'depth':null}));});}else{logger[_0x9baa('0x28')](_0x9baa('0x29'),_0x9baa('0x2b'),_0x9baa('0x1f'),_0x9baa('0x2c'));}break;}}})[_0x9baa('0x2d')](function(){_0x338b3e();});}else{_0x338b3e();}}},'charset':_0x9baa('0x2e'),'collate':_0x9baa('0x2f')});}; \ No newline at end of file +var _0x71dd=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','create','phone','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally'];(function(_0x49e2c6,_0x115cef){var _0x113b2f=function(_0x253544){while(--_0x253544){_0x49e2c6['push'](_0x49e2c6['shift']());}};_0x113b2f(++_0x115cef);}(_0x71dd,0xf6));var _0xd71d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x71dd[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd71d('0x0'));var util=require('util');var logger=require(_0xd71d('0x1'))(_0xd71d('0x2'));var moment=require(_0xd71d('0x3'));var BPromise=require(_0xd71d('0x4'));var rp=require(_0xd71d('0x5'));var fs=require('fs');var path=require(_0xd71d('0x6'));var rimraf=require(_0xd71d('0x7'));var config=require(_0xd71d('0x8'));var attributes=require(_0xd71d('0x9'));module[_0xd71d('0xa')]=function(_0x3c6a12,_0x5dd52d){return _0x3c6a12[_0xd71d('0xb')](_0xd71d('0xc'),attributes,{'tableName':_0xd71d('0xd'),'paranoid':![],'indexes':[{'name':_0xd71d('0xe'),'fields':[_0xd71d('0xe')]},{'name':'fti_whatsapp_messages','fields':[_0xd71d('0xf')],'type':_0xd71d('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x16e90c,_0x1edbe4,_0x51ec75){var _0x2ff9a6=_0x3c6a12[_0xd71d('0x11')];var _0x1a3e18=_0x16e90c['get']({'plain':!![]});if(_0x1a3e18[_0xd71d('0x12')][_0xd71d('0x13')]()==='in'||_0x1a3e18[_0xd71d('0x12')][_0xd71d('0x13')]()===_0xd71d('0x14')&&!_0x1a3e18[_0xd71d('0x15')]&&!_['isNil'](_0x1a3e18[_0xd71d('0x16')])){_0x2ff9a6[_0xd71d('0x17')][_0xd71d('0x18')]({'where':{'id':_0x1a3e18[_0xd71d('0x19')]}})[_0xd71d('0x1a')](function(_0x209c0e){if(_0x209c0e){_0x209c0e[_0xd71d('0x1b')]({'lastMsgAt':_0x1a3e18[_0xd71d('0x1c')],'lastMsgDirection':_0x1a3e18['direction'][_0xd71d('0x13')]()});}})[_0xd71d('0x1d')](function(_0x48f121){console[_0xd71d('0x1e')](_0x48f121);});}if(_0x1a3e18['direction']===_0xd71d('0x14')&&!_0x1a3e18['secret']){var _0xce7a74;_0x2ff9a6[_0xd71d('0x1f')][_0xd71d('0x20')]({'where':{'id':_0x1a3e18[_0xd71d('0x21')]},'raw':!![]})[_0xd71d('0x1a')](function(_0x102b6c){_0xce7a74=_0x102b6c;if(_0xce7a74&&_0xce7a74[_0xd71d('0x22')]){switch(_0xce7a74[_0xd71d('0x22')]){case _0xd71d('0x23'):var _0x5ecaca=require(_0xd71d('0x23'));if(_0xce7a74['accountSid']&&_0xce7a74['authToken']&&_0xce7a74['phone']){var _0x3d14fd=new _0x5ecaca(_0xce7a74[_0xd71d('0x24')],_0xce7a74['authToken']);_0x3d14fd['messages'][_0xd71d('0x25')]({'body':_0x1a3e18[_0xd71d('0xf')],'to':'whatsapp:'+_0x1a3e18[_0xd71d('0x26')],'from':_0xd71d('0x27')+_0xce7a74[_0xd71d('0x26')],'statusCallback':_0xce7a74['remote']+_0xd71d('0x28')+_0x1a3e18['id']+_0xd71d('0x29')+_0xce7a74[_0xd71d('0x2a')]})['then'](function(_0x43f25f){if(_0x43f25f[_0xd71d('0x2b')]){return _0x16e90c[_0xd71d('0x1b')]({'messageId':_0x43f25f['sid']});}})[_0xd71d('0x1d')](function(_0x2b9457){logger[_0xd71d('0x1e')](_0xd71d('0x2c'),_0xd71d('0x2d'),_0xd71d('0x23'),util['inspect'](_0x2b9457,{'showHidden':![],'depth':null}));});}else{logger[_0xd71d('0x1e')](_0xd71d('0x2c'),'afterCreate',_0xd71d('0x23'),_0xd71d('0x2e'));}break;}}})[_0xd71d('0x2f')](function(){_0x51ec75();});}else{_0x51ec75();}}},'charset':'utf8mb4','collate':_0xd71d('0x30')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 999581c..f18d17d 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 _0xced0=['socket.io-emitter','./whatsappMessage.socket','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost'];(function(_0x4f0ffc,_0x303dd3){var _0x1685a4=function(_0x455e5b){while(--_0x455e5b){_0x4f0ffc['push'](_0x4f0ffc['shift']());}};_0x1685a4(++_0x303dd3);}(_0xced0,0xe1));var _0x0ced=function(_0x387fe4,_0x186656){_0x387fe4=_0x387fe4-0x0;var _0x43c1c1=_0xced0[_0x387fe4];return _0x43c1c1;};'use strict';var _=require(_0x0ced('0x0'));var util=require('util');var moment=require(_0x0ced('0x1'));var BPromise=require(_0x0ced('0x2'));var rs=require(_0x0ced('0x3'));var fs=require('fs');var Redis=require(_0x0ced('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ced('0x5'));var logger=require(_0x0ced('0x6'))(_0x0ced('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ced('0x8'));var client=jayson['client'][_0x0ced('0x9')]({'port':0x232a});config[_0x0ced('0xa')]=_[_0x0ced('0xb')](config[_0x0ced('0xa')],{'host':_0x0ced('0xc'),'port':0x18eb});var socket=require(_0x0ced('0xd'))(new Redis(config['redis']));require(_0x0ced('0xe'))['register'](socket);function respondWithRpcPromise(_0x44c849,_0x53375e,_0x173618){return new BPromise(function(_0x8346ee,_0x1101a4){return client[_0x0ced('0xf')](_0x44c849,_0x173618)[_0x0ced('0x10')](function(_0x2e0f13){logger[_0x0ced('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x53375e,_0x0ced('0x12'));logger[_0x0ced('0x13')](_0x0ced('0x14'),_0x53375e,'request\x20sent',JSON['stringify'](_0x2e0f13));if(_0x2e0f13[_0x0ced('0x15')]){if(_0x2e0f13['error'][_0x0ced('0x16')]===0x1f4){logger[_0x0ced('0x15')](_0x0ced('0x17'),_0x53375e,_0x2e0f13[_0x0ced('0x15')]['message']);return _0x1101a4(_0x2e0f13['error'][_0x0ced('0x18')]);}logger['error'](_0x0ced('0x17'),_0x53375e,_0x2e0f13[_0x0ced('0x15')][_0x0ced('0x18')]);return _0x8346ee(_0x2e0f13[_0x0ced('0x15')][_0x0ced('0x18')]);}else{logger[_0x0ced('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x53375e,_0x0ced('0x12'));_0x8346ee(_0x2e0f13[_0x0ced('0x19')]['message']);}})['catch'](function(_0x236bfa){logger[_0x0ced('0x15')](_0x0ced('0x17'),_0x53375e,_0x236bfa);_0x1101a4(_0x236bfa);});});}exports[_0x0ced('0x1a')]=function(_0x2f30b6){var _0x39837a=this;return new Promise(function(_0x296855,_0x5d4c53){return db[_0x0ced('0x1b')][_0x0ced('0x1c')](_0x2f30b6[_0x0ced('0x1d')],{'raw':_0x2f30b6[_0x0ced('0x1e')]?_0x2f30b6[_0x0ced('0x1e')][_0x0ced('0x1f')]===undefined?!![]:![]:!![]})[_0x0ced('0x10')](function(_0x228ab0){logger[_0x0ced('0x11')]('CreateWhatsappMessage',_0x2f30b6);logger['debug'](_0x0ced('0x1a'),_0x2f30b6,JSON[_0x0ced('0x20')](_0x228ab0));_0x296855(_0x228ab0);})[_0x0ced('0x21')](function(_0x408ab8){logger[_0x0ced('0x15')](_0x0ced('0x1a'),_0x408ab8[_0x0ced('0x18')],_0x2f30b6);_0x5d4c53(_0x39837a[_0x0ced('0x15')](0x1f4,_0x408ab8[_0x0ced('0x18')]));});});}; \ No newline at end of file +var _0xe3ed=['options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','debug','request\x20sent','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','create'];(function(_0x4c3004,_0x275e31){var _0xe90a2e=function(_0xe67de){while(--_0xe67de){_0x4c3004['push'](_0x4c3004['shift']());}};_0xe90a2e(++_0x275e31);}(_0xe3ed,0x169));var _0xde3e=function(_0x103b5d,_0x25aee0){_0x103b5d=_0x103b5d-0x0;var _0x53d2ec=_0xe3ed[_0x103b5d];return _0x53d2ec;};'use strict';var _=require(_0xde3e('0x0'));var util=require(_0xde3e('0x1'));var moment=require(_0xde3e('0x2'));var BPromise=require(_0xde3e('0x3'));var rs=require(_0xde3e('0x4'));var fs=require('fs');var Redis=require(_0xde3e('0x5'));var db=require(_0xde3e('0x6'))['db'];var utils=require(_0xde3e('0x7'));var logger=require(_0xde3e('0x8'))(_0xde3e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xde3e('0xa')]['http']({'port':0x232a});config[_0xde3e('0xb')]=_['defaults'](config['redis'],{'host':_0xde3e('0xc'),'port':0x18eb});var socket=require(_0xde3e('0xd'))(new Redis(config[_0xde3e('0xb')]));require(_0xde3e('0xe'))[_0xde3e('0xf')](socket);function respondWithRpcPromise(_0x3f97be,_0x2269c1,_0x585c71){return new BPromise(function(_0x22bbde,_0x9cb1c8){return client[_0xde3e('0x10')](_0x3f97be,_0x585c71)[_0xde3e('0x11')](function(_0x3b61cb){logger[_0xde3e('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x2269c1,'request\x20sent');logger[_0xde3e('0x13')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x2269c1,_0xde3e('0x14'),JSON['stringify'](_0x3b61cb));if(_0x3b61cb[_0xde3e('0x15')]){if(_0x3b61cb[_0xde3e('0x15')][_0xde3e('0x16')]===0x1f4){logger[_0xde3e('0x15')](_0xde3e('0x17'),_0x2269c1,_0x3b61cb['error'][_0xde3e('0x18')]);return _0x9cb1c8(_0x3b61cb[_0xde3e('0x15')][_0xde3e('0x18')]);}logger[_0xde3e('0x15')](_0xde3e('0x17'),_0x2269c1,_0x3b61cb[_0xde3e('0x15')][_0xde3e('0x18')]);return _0x22bbde(_0x3b61cb[_0xde3e('0x15')][_0xde3e('0x18')]);}else{logger[_0xde3e('0x12')](_0xde3e('0x17'),_0x2269c1,_0xde3e('0x14'));_0x22bbde(_0x3b61cb[_0xde3e('0x19')][_0xde3e('0x18')]);}})[_0xde3e('0x1a')](function(_0x22def0){logger[_0xde3e('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x2269c1,_0x22def0);_0x9cb1c8(_0x22def0);});});}exports[_0xde3e('0x1b')]=function(_0x1a7380){var _0x4acc19=this;return new Promise(function(_0x9f629b,_0x4cb983){return db['WhatsappMessage'][_0xde3e('0x1c')](_0x1a7380['body'],{'raw':_0x1a7380[_0xde3e('0x1d')]?_0x1a7380[_0xde3e('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xde3e('0x11')](function(_0x579100){logger[_0xde3e('0x12')](_0xde3e('0x1b'),_0x1a7380);logger[_0xde3e('0x13')]('CreateWhatsappMessage',_0x1a7380,JSON['stringify'](_0x579100));_0x9f629b(_0x579100);})[_0xde3e('0x1a')](function(_0x5bc354){logger['error'](_0xde3e('0x1b'),_0x5bc354[_0xde3e('0x18')],_0x1a7380);_0x4cb983(_0x4acc19[_0xde3e('0x15')](0x1f4,_0x5bc354[_0xde3e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index f08488e..c10fcc1 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 _0x0138=['update','emit','removeListener','register','length','./whatsappMessage.events','save','remove'];(function(_0x5d4898,_0x57d66e){var _0x4d2ebc=function(_0x53026d){while(--_0x53026d){_0x5d4898['push'](_0x5d4898['shift']());}};_0x4d2ebc(++_0x57d66e);}(_0x0138,0x195));var _0x8013=function(_0x583412,_0x46fc28){_0x583412=_0x583412-0x0;var _0x2aea3f=_0x0138[_0x583412];return _0x2aea3f;};'use strict';var WhatsappMessageEvents=require(_0x8013('0x0'));var events=[_0x8013('0x1'),_0x8013('0x2'),_0x8013('0x3')];function createListener(_0x4e2878,_0x1802a8){return function(_0x2076c2){_0x1802a8[_0x8013('0x4')](_0x4e2878,_0x2076c2);};}function removeListener(_0x561513,_0x52b957){return function(){WhatsappMessageEvents[_0x8013('0x5')](_0x561513,_0x52b957);};}exports[_0x8013('0x6')]=function(_0x4d49a0){for(var _0x87e7ee=0x0,_0x59ef96=events[_0x8013('0x7')];_0x87e7ee<_0x59ef96;_0x87e7ee++){var _0x27b468=events[_0x87e7ee];var _0x1cb2d9=createListener('whatsappMessage:'+_0x27b468,_0x4d49a0);WhatsappMessageEvents['on'](_0x27b468,_0x1cb2d9);}}; \ No newline at end of file +var _0x17e1=['./whatsappMessage.events','save','update','emit','removeListener','length'];(function(_0x6a86df,_0x54ffeb){var _0x22c60e=function(_0x2abb02){while(--_0x2abb02){_0x6a86df['push'](_0x6a86df['shift']());}};_0x22c60e(++_0x54ffeb);}(_0x17e1,0xa8));var _0x117e=function(_0x352b3e,_0x40b47e){_0x352b3e=_0x352b3e-0x0;var _0x348197=_0x17e1[_0x352b3e];return _0x348197;};'use strict';var WhatsappMessageEvents=require(_0x117e('0x0'));var events=[_0x117e('0x1'),'remove',_0x117e('0x2')];function createListener(_0x51d7e4,_0x1e760b){return function(_0x47f9e4){_0x1e760b[_0x117e('0x3')](_0x51d7e4,_0x47f9e4);};}function removeListener(_0x49223a,_0x18e4c3){return function(){WhatsappMessageEvents[_0x117e('0x4')](_0x49223a,_0x18e4c3);};}exports['register']=function(_0x4b9542){for(var _0x3ca6a4=0x0,_0x37fc67=events[_0x117e('0x5')];_0x3ca6a4<_0x37fc67;_0x3ca6a4++){var _0x1b8664=events[_0x3ca6a4];var _0x49d156=createListener('whatsappMessage:'+_0x1b8664,_0x4b9542);WhatsappMessageEvents['on'](_0x1b8664,_0x49d156);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 0c12bcf..b58928c 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 _0xafc4=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','update','delete','destroy','removeTeams','removeAgents'];(function(_0x30c2dc,_0x4f66d5){var _0x27ec6d=function(_0x3dd9f5){while(--_0x3dd9f5){_0x30c2dc['push'](_0x30c2dc['shift']());}};_0x27ec6d(++_0x4f66d5);}(_0xafc4,0x69));var _0x4afc=function(_0x34e824,_0x99108f){_0x34e824=_0x34e824-0x0;var _0x359760=_0xafc4[_0x34e824];return _0x359760;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var fs_extra=require(_0x4afc('0x4'));var auth=require(_0x4afc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0x4afc('0x6')]('/',auth[_0x4afc('0x7')](),controller[_0x4afc('0x8')]);router[_0x4afc('0x6')](_0x4afc('0x9'),auth[_0x4afc('0x7')](),controller['describe']);router[_0x4afc('0x6')](_0x4afc('0xa'),auth[_0x4afc('0x7')](),controller[_0x4afc('0xb')]);router[_0x4afc('0x6')](_0x4afc('0xc'),auth['isAuthenticated'](),controller['getMembers']);router[_0x4afc('0x6')]('/:id/teams',auth[_0x4afc('0x7')](),controller[_0x4afc('0xd')]);router['get'](_0x4afc('0xe'),auth[_0x4afc('0x7')](),controller[_0x4afc('0xf')]);router[_0x4afc('0x10')]('/',auth[_0x4afc('0x7')](),controller[_0x4afc('0x11')]);router[_0x4afc('0x10')](_0x4afc('0x12'),auth['isAuthenticated'](),controller[_0x4afc('0x13')]);router[_0x4afc('0x10')](_0x4afc('0xe'),auth[_0x4afc('0x7')](),controller['addAgents']);router['put'](_0x4afc('0xa'),auth['isAuthenticated'](),controller[_0x4afc('0x14')]);router[_0x4afc('0x15')](_0x4afc('0xa'),auth[_0x4afc('0x7')](),controller[_0x4afc('0x16')]);router[_0x4afc('0x15')](_0x4afc('0x12'),auth[_0x4afc('0x7')](),controller[_0x4afc('0x17')]);router[_0x4afc('0x15')](_0x4afc('0xe'),auth['isAuthenticated'](),controller[_0x4afc('0x18')]);module[_0x4afc('0x19')]=router; \ No newline at end of file +var _0x6ad6=['/:id/users','post','/:id/teams','addTeams','addAgents','update','delete','/:id','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','describe','show','/:id/members','getTeams'];(function(_0x6feb24,_0x3b541b){var _0xb2e633=function(_0x56a491){while(--_0x56a491){_0x6feb24['push'](_0x6feb24['shift']());}};_0xb2e633(++_0x3b541b);}(_0x6ad6,0x1e7));var _0x66ad=function(_0x55cce7,_0x125e47){_0x55cce7=_0x55cce7-0x0;var _0xb4453b=_0x6ad6[_0x55cce7];return _0xb4453b;};'use strict';var multer=require(_0x66ad('0x0'));var util=require(_0x66ad('0x1'));var path=require(_0x66ad('0x2'));var timeout=require(_0x66ad('0x3'));var express=require(_0x66ad('0x4'));var router=express[_0x66ad('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x66ad('0x6'));var interaction=require(_0x66ad('0x7'));var config=require(_0x66ad('0x8'));var controller=require(_0x66ad('0x9'));router[_0x66ad('0xa')]('/',auth[_0x66ad('0xb')](),controller[_0x66ad('0xc')]);router[_0x66ad('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x66ad('0xd')]);router[_0x66ad('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x66ad('0xe')]);router[_0x66ad('0xa')](_0x66ad('0xf'),auth[_0x66ad('0xb')](),controller['getMembers']);router[_0x66ad('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0x66ad('0x10')]);router[_0x66ad('0xa')](_0x66ad('0x11'),auth[_0x66ad('0xb')](),controller['getAgents']);router[_0x66ad('0x12')]('/',auth[_0x66ad('0xb')](),controller['create']);router[_0x66ad('0x12')](_0x66ad('0x13'),auth[_0x66ad('0xb')](),controller[_0x66ad('0x14')]);router['post'](_0x66ad('0x11'),auth[_0x66ad('0xb')](),controller[_0x66ad('0x15')]);router['put']('/:id',auth[_0x66ad('0xb')](),controller[_0x66ad('0x16')]);router[_0x66ad('0x17')](_0x66ad('0x18'),auth[_0x66ad('0xb')](),controller[_0x66ad('0x19')]);router['delete'](_0x66ad('0x13'),auth[_0x66ad('0xb')](),controller[_0x66ad('0x1a')]);router[_0x66ad('0x17')](_0x66ad('0x11'),auth['isAuthenticated'](),controller[_0x66ad('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 82bfc0f..16fe807 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 _0x4627=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4627,0x115));var _0x7462=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0x4627[_0x3e2fcf];return _0x497db7;};'use strict';var Sequelize=require(_0x7462('0x0'));module[_0x7462('0x1')]={'name':{'type':Sequelize[_0x7462('0x2')],'unique':_0x7462('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x7462('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7462('0x5')](_0x7462('0x6'),_0x7462('0x7'),_0x7462('0x8'))},'description':{'type':Sequelize[_0x7462('0x2')]}}; \ No newline at end of file +var _0x2bc6=['exports','STRING','beepall','sequelize'];(function(_0x353f52,_0xe40124){var _0x44e3ec=function(_0x3c1be5){while(--_0x3c1be5){_0x353f52['push'](_0x353f52['shift']());}};_0x44e3ec(++_0xe40124);}(_0x2bc6,0x163));var _0x62bc=function(_0xee8a44,_0x5bc189){_0xee8a44=_0xee8a44-0x0;var _0x1a4d46=_0x2bc6[_0xee8a44];return _0x1a4d46;};'use strict';var Sequelize=require(_0x62bc('0x0'));module[_0x62bc('0x1')]={'name':{'type':Sequelize[_0x62bc('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x62bc('0x3'),'roundrobin')},'description':{'type':Sequelize[_0x62bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 92b2773..654748b 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 _0xa5f0=['isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','get','WhatsappQueues','UserProfileResource','destroy','end','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','params','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','agent','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','User','online','interface','sequelize','findOrCreate','emit','userWhatsappQueue:save','removeTeams','ids','Agents','field','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value'];(function(_0x3d970,_0xa75c09){var _0x339a57=function(_0x4f4bd5){while(--_0x4f4bd5){_0x3d970['push'](_0x3d970['shift']());}};_0x339a57(++_0xa75c09);}(_0xa5f0,0x1ad));var _0x0a5f=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xa5f0[_0x1b6c6d];return _0x290d9d;};'use strict';var emlformat=require(_0x0a5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a5f('0x1'));var jsonpatch=require(_0x0a5f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0a5f('0x3'));var Mustache=require('mustache');var util=require(_0x0a5f('0x4'));var path=require(_0x0a5f('0x5'));var sox=require(_0x0a5f('0x6'));var csv=require(_0x0a5f('0x7'));var ejs=require(_0x0a5f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a5f('0x9'));var squel=require(_0x0a5f('0xa'));var crypto=require(_0x0a5f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0a5f('0xc'));var toCsv=require(_0x0a5f('0x7'));var querystring=require('querystring');var Papa=require(_0x0a5f('0xd'));var Redis=require(_0x0a5f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0a5f('0xf'));var as=require(_0x0a5f('0x10'));var hardwareService=require(_0x0a5f('0x11'));var logger=require(_0x0a5f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x0a5f('0x13'));var licenseUtil=require(_0x0a5f('0x14'));var db=require(_0x0a5f('0x15'))['db'];config[_0x0a5f('0x16')]=_[_0x0a5f('0x17')](config[_0x0a5f('0x16')],{'host':_0x0a5f('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a5f('0x16')]));require(_0x0a5f('0x19'))[_0x0a5f('0x1a')](socket);function respondWithStatusCode(_0x289d8f,_0x49803f){_0x49803f=_0x49803f||0xcc;return function(_0x3b2b11){if(_0x3b2b11){return _0x289d8f[_0x0a5f('0x1b')](_0x49803f);}return _0x289d8f[_0x0a5f('0x1c')](_0x49803f)['end']();};}function respondWithResult(_0x54254d,_0x5dc870){_0x5dc870=_0x5dc870||0xc8;return function(_0x46b7d8){if(_0x46b7d8){return _0x54254d[_0x0a5f('0x1c')](_0x5dc870)[_0x0a5f('0x1d')](_0x46b7d8);}};}function respondWithFilteredResult(_0x42510a,_0xa182be){return function(_0x2c0bf6){if(_0x2c0bf6){var _0x20865e=typeof _0xa182be[_0x0a5f('0x1e')]==='undefined'&&typeof _0xa182be[_0x0a5f('0x1f')]===_0x0a5f('0x20');var _0x4dc853=_0x2c0bf6[_0x0a5f('0x21')];var _0x4ef962=_0x20865e?0x0:_0xa182be['offset'];var _0x19fa4a=_0x20865e?_0x2c0bf6[_0x0a5f('0x21')]:_0xa182be[_0x0a5f('0x1e')]+_0xa182be[_0x0a5f('0x1f')];var _0x4c4710;if(_0x19fa4a>=_0x4dc853){_0x19fa4a=_0x4dc853;_0x4c4710=0xc8;}else{_0x4c4710=0xce;}_0x42510a[_0x0a5f('0x1c')](_0x4c4710);return _0x42510a[_0x0a5f('0x22')](_0x0a5f('0x23'),_0x4ef962+'-'+_0x19fa4a+'/'+_0x4dc853)[_0x0a5f('0x1d')](_0x2c0bf6);}return null;};}function patchUpdates(_0x1c6007){return function(_0x37e681){try{jsonpatch[_0x0a5f('0x24')](_0x37e681,_0x1c6007,!![]);}catch(_0x5752a3){return BPromise[_0x0a5f('0x25')](_0x5752a3);}return _0x37e681['save']();};}function saveUpdates(_0x2a8f3b,_0x390c73){return function(_0x187baf){if(_0x187baf){return _0x187baf[_0x0a5f('0x26')](_0x2a8f3b)[_0x0a5f('0x27')](function(_0x4c4939){return _0x4c4939;});}return null;};}function removeEntity(_0x43a8bb,_0x47393d){return function(_0x298c4a){if(_0x298c4a){return _0x298c4a['destroy']()[_0x0a5f('0x27')](function(){var _0x2bcaa8=_0x298c4a[_0x0a5f('0x28')]({'plain':!![]});var _0x1de23c=_0x0a5f('0x29');return db[_0x0a5f('0x2a')][_0x0a5f('0x2b')]({'where':{'type':_0x1de23c,'resourceId':_0x2bcaa8['id']}})['then'](function(){return _0x298c4a;});})[_0x0a5f('0x27')](function(){_0x43a8bb['status'](0xcc)[_0x0a5f('0x2c')]();});}};}function handleEntityNotFound(_0x23810f,_0x93fe22){return function(_0x43c77b){if(!_0x43c77b){_0x23810f[_0x0a5f('0x1b')](0x194);}return _0x43c77b;};}function handleError(_0x483557,_0x2ec544){_0x2ec544=_0x2ec544||0x1f4;return function(_0x5e075d){logger[_0x0a5f('0x2d')](_0x5e075d[_0x0a5f('0x2e')]);if(_0x5e075d[_0x0a5f('0x2f')]){delete _0x5e075d[_0x0a5f('0x2f')];}_0x483557[_0x0a5f('0x1c')](_0x2ec544)[_0x0a5f('0x30')](_0x5e075d);};}exports[_0x0a5f('0x31')]=function(_0x5cd3ff,_0x26afc8){var _0xef0e0e={},_0x600730={},_0x308817={'count':0x0,'rows':[]};var _0x12bcc3=_[_0x0a5f('0x32')](db[_0x0a5f('0x33')][_0x0a5f('0x34')],function(_0x380fa7){return{'name':_0x380fa7[_0x0a5f('0x35')],'type':_0x380fa7[_0x0a5f('0x36')][_0x0a5f('0x37')]};});_0x600730[_0x0a5f('0x38')]=_[_0x0a5f('0x32')](_0x12bcc3,_0x0a5f('0x2f'));_0x600730[_0x0a5f('0x39')]=_['keys'](_0x5cd3ff[_0x0a5f('0x39')]);_0x600730[_0x0a5f('0x3a')]=_[_0x0a5f('0x3b')](_0x600730[_0x0a5f('0x38')],_0x600730['query']);_0xef0e0e['attributes']=_[_0x0a5f('0x3b')](_0x600730[_0x0a5f('0x38')],qs[_0x0a5f('0x3c')](_0x5cd3ff[_0x0a5f('0x39')][_0x0a5f('0x3c')]));_0xef0e0e[_0x0a5f('0x3d')]=_0xef0e0e[_0x0a5f('0x3d')]['length']?_0xef0e0e[_0x0a5f('0x3d')]:_0x600730['model'];if(!_0x5cd3ff['query'][_0x0a5f('0x3e')](_0x0a5f('0x3f'))){_0xef0e0e[_0x0a5f('0x1f')]=qs['limit'](_0x5cd3ff[_0x0a5f('0x39')][_0x0a5f('0x1f')]);_0xef0e0e[_0x0a5f('0x1e')]=qs[_0x0a5f('0x1e')](_0x5cd3ff[_0x0a5f('0x39')]['offset']);}_0xef0e0e[_0x0a5f('0x40')]=qs[_0x0a5f('0x41')](_0x5cd3ff['query'][_0x0a5f('0x41')]);_0xef0e0e['where']=qs[_0x0a5f('0x3a')](_[_0x0a5f('0x42')](_0x5cd3ff[_0x0a5f('0x39')],_0x600730['filters']),_0x12bcc3);if(_0x5cd3ff[_0x0a5f('0x39')][_0x0a5f('0x43')]){_0xef0e0e[_0x0a5f('0x44')]=_[_0x0a5f('0x45')](_0xef0e0e[_0x0a5f('0x44')],{'$or':_[_0x0a5f('0x32')](_0x12bcc3,function(_0xc437ff){if(_0xc437ff[_0x0a5f('0x36')]!==_0x0a5f('0x46')){var _0x2c6ae1={};_0x2c6ae1[_0xc437ff[_0x0a5f('0x2f')]]={'$like':'%'+_0x5cd3ff[_0x0a5f('0x39')]['filter']+'%'};return _0x2c6ae1;}})});}_0xef0e0e=_[_0x0a5f('0x45')]({},_0xef0e0e,_0x5cd3ff[_0x0a5f('0x47')]);var _0x45c9d3={'where':_0xef0e0e[_0x0a5f('0x44')]};return db[_0x0a5f('0x33')][_0x0a5f('0x21')](_0x45c9d3)[_0x0a5f('0x27')](function(_0x2fac80){_0x308817['count']=_0x2fac80;if(_0x5cd3ff[_0x0a5f('0x39')][_0x0a5f('0x48')]){_0xef0e0e[_0x0a5f('0x49')]=[{'all':!![]}];}return db[_0x0a5f('0x33')][_0x0a5f('0x4a')](_0xef0e0e);})[_0x0a5f('0x27')](function(_0xaec4fe){_0x308817[_0x0a5f('0x4b')]=_0xaec4fe;return _0x308817;})[_0x0a5f('0x27')](respondWithFilteredResult(_0x26afc8,_0xef0e0e))[_0x0a5f('0x4c')](handleError(_0x26afc8,null));};exports['show']=function(_0x363d3a,_0x5e056b){var _0x4c84b8={'raw':!![],'where':{'id':_0x363d3a['params']['id']}},_0x266aad={};_0x266aad[_0x0a5f('0x38')]=_[_0x0a5f('0x4d')](db[_0x0a5f('0x33')][_0x0a5f('0x34')]);_0x266aad[_0x0a5f('0x39')]=_[_0x0a5f('0x4d')](_0x363d3a[_0x0a5f('0x39')]);_0x266aad['filters']=_[_0x0a5f('0x3b')](_0x266aad['model'],_0x266aad[_0x0a5f('0x39')]);_0x4c84b8[_0x0a5f('0x3d')]=_[_0x0a5f('0x3b')](_0x266aad[_0x0a5f('0x38')],qs[_0x0a5f('0x3c')](_0x363d3a['query']['fields']));_0x4c84b8['attributes']=_0x4c84b8['attributes'][_0x0a5f('0x4e')]?_0x4c84b8[_0x0a5f('0x3d')]:_0x266aad[_0x0a5f('0x38')];if(_0x363d3a['query'][_0x0a5f('0x48')]){_0x4c84b8['include']=[{'all':!![]}];}_0x4c84b8=_[_0x0a5f('0x45')]({},_0x4c84b8,_0x363d3a[_0x0a5f('0x47')]);return db['WhatsappQueue'][_0x0a5f('0x4f')](_0x4c84b8)[_0x0a5f('0x27')](handleEntityNotFound(_0x5e056b,null))['then'](respondWithResult(_0x5e056b,null))[_0x0a5f('0x4c')](handleError(_0x5e056b,null));};exports[_0x0a5f('0x50')]=function(_0x1797c9,_0x597632){return db['WhatsappQueue']['create'](_0x1797c9['body'],{})[_0x0a5f('0x27')](function(_0x2a11f4){var _0x287f4b=_0x1797c9[_0x0a5f('0x51')][_0x0a5f('0x28')]({'plain':!![]});if(!_0x287f4b)throw new Error(_0x0a5f('0x52'));if(_0x287f4b[_0x0a5f('0x53')]==='user'){var _0x18ec46=_0x2a11f4[_0x0a5f('0x28')]({'plain':!![]});var _0x316c44=_0x0a5f('0x29');return db[_0x0a5f('0x54')][_0x0a5f('0x4f')]({'where':{'name':_0x316c44,'userProfileId':_0x287f4b[_0x0a5f('0x55')]},'raw':!![]})[_0x0a5f('0x27')](function(_0x2dc391){if(_0x2dc391&&_0x2dc391[_0x0a5f('0x56')]===0x0){return db['UserProfileResource'][_0x0a5f('0x50')]({'name':_0x18ec46['name'],'resourceId':_0x18ec46['id'],'type':_0x2dc391['name'],'sectionId':_0x2dc391['id']},{})['then'](function(){return _0x2a11f4;});}else{return _0x2a11f4;}})[_0x0a5f('0x4c')](function(_0x41ba54){logger[_0x0a5f('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41ba54);throw _0x41ba54;});}return _0x2a11f4;})['then'](respondWithResult(_0x597632,0xc9))[_0x0a5f('0x4c')](handleError(_0x597632,null));};exports[_0x0a5f('0x26')]=function(_0x488f9d,_0xdcd344){if(_0x488f9d[_0x0a5f('0x57')]['id']){delete _0x488f9d[_0x0a5f('0x57')]['id'];}return db['WhatsappQueue'][_0x0a5f('0x4f')]({'where':{'id':_0x488f9d['params']['id']}})[_0x0a5f('0x27')](handleEntityNotFound(_0xdcd344,null))[_0x0a5f('0x27')](saveUpdates(_0x488f9d[_0x0a5f('0x57')],null))[_0x0a5f('0x27')](respondWithResult(_0xdcd344,null))[_0x0a5f('0x4c')](handleError(_0xdcd344,null));};exports[_0x0a5f('0x2b')]=function(_0x54f93c,_0xd9ee00){return db['WhatsappQueue'][_0x0a5f('0x4f')]({'where':{'id':_0x54f93c[_0x0a5f('0x58')]['id']}})['then'](handleEntityNotFound(_0xd9ee00,null))['then'](removeEntity(_0xd9ee00,null))[_0x0a5f('0x4c')](handleError(_0xd9ee00,null));};exports[_0x0a5f('0x59')]=function(_0xc683bf,_0x237b7c){return db[_0x0a5f('0x33')]['describe']()[_0x0a5f('0x27')](respondWithResult(_0x237b7c,null))[_0x0a5f('0x4c')](handleError(_0x237b7c,null));};exports[_0x0a5f('0x5a')]=function(_0x4cb52f,_0x29ab7a,_0x46ffa1){var _0x48f837={'raw':!![],'where':{}},_0x289f93={},_0x1514cf;return db[_0x0a5f('0x33')][_0x0a5f('0x5b')]({'where':{'id':_0x4cb52f[_0x0a5f('0x58')]['id']}})[_0x0a5f('0x27')](handleEntityNotFound(_0x29ab7a,null))[_0x0a5f('0x27')](function(_0x2ed700){if(_0x2ed700){_0x1514cf=_0x2ed700['get']({'plain':!![]});_0x289f93[_0x0a5f('0x38')]=_[_0x0a5f('0x4d')](db[_0x0a5f('0x5c')]['rawAttributes']);_0x289f93['query']=_[_0x0a5f('0x4d')](_0x4cb52f['query']);_0x289f93[_0x0a5f('0x3a')]=_[_0x0a5f('0x3b')](_0x289f93[_0x0a5f('0x38')],_0x289f93[_0x0a5f('0x39')]);_0x48f837[_0x0a5f('0x3d')]=_[_0x0a5f('0x3b')](_0x289f93[_0x0a5f('0x38')],qs[_0x0a5f('0x3c')](_0x4cb52f['query'][_0x0a5f('0x3c')]));_0x48f837[_0x0a5f('0x3d')]=_0x48f837[_0x0a5f('0x3d')][_0x0a5f('0x4e')]?_0x48f837[_0x0a5f('0x3d')]:_0x289f93[_0x0a5f('0x38')];if(!_0x4cb52f[_0x0a5f('0x39')]['hasOwnProperty']('nolimit')){_0x48f837[_0x0a5f('0x1f')]=qs[_0x0a5f('0x1f')](_0x4cb52f[_0x0a5f('0x39')]['limit']);_0x48f837[_0x0a5f('0x1e')]=qs[_0x0a5f('0x1e')](_0x4cb52f[_0x0a5f('0x39')][_0x0a5f('0x1e')]);}_0x48f837[_0x0a5f('0x40')]=qs[_0x0a5f('0x41')](_0x4cb52f['query'][_0x0a5f('0x41')]);_0x48f837[_0x0a5f('0x44')]=qs[_0x0a5f('0x3a')](_[_0x0a5f('0x42')](_0x4cb52f['query'],_0x289f93[_0x0a5f('0x3a')]));_0x48f837[_0x0a5f('0x44')][_0x0a5f('0x5d')]=_0x2ed700['id'];if(_0x4cb52f[_0x0a5f('0x39')][_0x0a5f('0x43')]){_0x48f837[_0x0a5f('0x44')]=_['merge'](_0x48f837[_0x0a5f('0x44')],{'$or':_[_0x0a5f('0x32')](_0x48f837[_0x0a5f('0x3d')],function(_0x202987){var _0x3d7b3e={};_0x3d7b3e[_0x202987]={'$like':'%'+_0x4cb52f[_0x0a5f('0x39')][_0x0a5f('0x43')]+'%'};return _0x3d7b3e;})});}_0x48f837=_[_0x0a5f('0x45')]({},_0x48f837,_0x4cb52f[_0x0a5f('0x47')]);return db[_0x0a5f('0x5c')][_0x0a5f('0x4a')](_0x48f837);}})[_0x0a5f('0x27')](function(_0x3b2070){if(_0x3b2070){return db['User'][_0x0a5f('0x5e')]({'where':{'id':_[_0x0a5f('0x32')](_0x3b2070,'UserId'),'role':_0x0a5f('0x5f')},'attributes':['id',_0x0a5f('0x2f'),_0x0a5f('0x60'),'updatedAt',_0x0a5f('0x61')]});}})['then'](function(_0x97609a){if(_0x97609a){return{'count':_0x97609a['count'],'rows':_['map'](_0x97609a['rows'],function(_0x15f3ba){return{'membername':_0x15f3ba[_0x0a5f('0x2f')],'UserId':_0x15f3ba['id'],'queue_name':_0x1514cf['name'],'WhatsappQueueId':_0x1514cf['id'],'interface':util[_0x0a5f('0x62')](_0x0a5f('0x63'),_0x0a5f('0x64'),_0x15f3ba[_0x0a5f('0x2f')]),'penalty':0x0,'paused':_0x15f3ba[_0x0a5f('0x60')],'createdAt':_0x15f3ba[_0x0a5f('0x61')],'updatedAt':_0x15f3ba[_0x0a5f('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0a5f('0x27')](respondWithFilteredResult(_0x29ab7a,_0x48f837))[_0x0a5f('0x4c')](handleError(_0x29ab7a,null));};exports[_0x0a5f('0x66')]=function(_0x489018,_0x52a44b,_0x55ef1e){var _0x4a3546={};var _0x433101={};var _0x212ac1;var _0x5f054f;return db[_0x0a5f('0x33')][_0x0a5f('0x5b')]({'where':{'id':_0x489018[_0x0a5f('0x58')]['id']}})[_0x0a5f('0x27')](handleEntityNotFound(_0x52a44b,null))[_0x0a5f('0x27')](function(_0x41e3f2){if(_0x41e3f2){_0x212ac1=_0x41e3f2;_0x433101[_0x0a5f('0x38')]=_[_0x0a5f('0x4d')](db[_0x0a5f('0x67')][_0x0a5f('0x34')]);_0x433101['query']=_[_0x0a5f('0x4d')](_0x489018[_0x0a5f('0x39')]);_0x433101[_0x0a5f('0x3a')]=_[_0x0a5f('0x3b')](_0x433101[_0x0a5f('0x38')],_0x433101['query']);_0x4a3546[_0x0a5f('0x3d')]=_[_0x0a5f('0x3b')](_0x433101[_0x0a5f('0x38')],qs[_0x0a5f('0x3c')](_0x489018['query'][_0x0a5f('0x3c')]));_0x4a3546[_0x0a5f('0x3d')]=_0x4a3546[_0x0a5f('0x3d')]['length']?_0x4a3546[_0x0a5f('0x3d')]:_0x433101[_0x0a5f('0x38')];_0x4a3546['order']=qs[_0x0a5f('0x41')](_0x489018[_0x0a5f('0x39')][_0x0a5f('0x41')]);_0x4a3546['where']=qs[_0x0a5f('0x3a')](_[_0x0a5f('0x42')](_0x489018[_0x0a5f('0x39')],_0x433101[_0x0a5f('0x3a')]));if(_0x489018[_0x0a5f('0x39')][_0x0a5f('0x43')]){_0x4a3546[_0x0a5f('0x44')]=_[_0x0a5f('0x45')](_0x4a3546[_0x0a5f('0x44')],{'$or':_[_0x0a5f('0x32')](_0x4a3546[_0x0a5f('0x3d')],function(_0x586453){var _0x30f176={};_0x30f176[_0x586453]={'$like':'%'+_0x489018['query'][_0x0a5f('0x43')]+'%'};return _0x30f176;})});}_0x4a3546=_['merge']({},_0x4a3546,_0x489018[_0x0a5f('0x47')]);return _0x212ac1[_0x0a5f('0x66')](_0x4a3546);}})['then'](function(_0x454eb4){if(_0x454eb4){_0x5f054f=_0x454eb4['length'];if(!_0x489018[_0x0a5f('0x39')]['hasOwnProperty'](_0x0a5f('0x3f'))){_0x4a3546[_0x0a5f('0x1f')]=qs[_0x0a5f('0x1f')](_0x489018[_0x0a5f('0x39')][_0x0a5f('0x1f')]);_0x4a3546[_0x0a5f('0x1e')]=qs[_0x0a5f('0x1e')](_0x489018[_0x0a5f('0x39')][_0x0a5f('0x1e')]);}return _0x212ac1[_0x0a5f('0x66')](_0x4a3546);}})[_0x0a5f('0x27')](function(_0x476648){if(_0x476648){return _0x476648?{'count':_0x5f054f,'rows':_0x476648}:null;}})[_0x0a5f('0x27')](respondWithResult(_0x52a44b,null))[_0x0a5f('0x4c')](handleError(_0x52a44b,null));};exports[_0x0a5f('0x68')]=function(_0x4b7a36,_0x3a434a,_0x29f9d2){var _0x157068=_0x4b7a36[_0x0a5f('0x57')]['ids'];return db[_0x0a5f('0x67')]['findAll']({'where':{'id':_0x157068},'attributes':['id'],'include':[{'model':db[_0x0a5f('0x69')],'as':'Agents','attributes':['id',_0x0a5f('0x2f'),_0x0a5f('0x6a'),'voicePause',_0x0a5f('0x6b')],'raw':!![]}]})[_0x0a5f('0x27')](function(_0x3e16ca){if(_0x3e16ca){var _0xd41243=_['flatMap'](_0x3e16ca,function(_0x3eed5a){var _0x362486=_0x3eed5a[_0x0a5f('0x28')]({'plain':!![]});return _0x362486['Agents'];});return db[_0x0a5f('0x33')][_0x0a5f('0x4f')]({'where':{'id':_0x4b7a36[_0x0a5f('0x58')]['id']}})[_0x0a5f('0x27')](function(_0x365b9b){return db[_0x0a5f('0x6c')]['transaction'](function(_0x48dc78){return _0x365b9b[_0x0a5f('0x68')](_0x157068,{'transaction':_0x48dc78})[_0x0a5f('0x27')](function(){return BPromise['each'](_0xd41243,function(_0x3b2ec8){return db['UserWhatsappQueue'][_0x0a5f('0x6d')]({'where':{'UserId':_0x3b2ec8['id'],'WhatsappQueueId':_0x4b7a36[_0x0a5f('0x58')]['id']},'transaction':_0x48dc78});});})['then'](function(){_0xd41243['forEach'](function(_0x417f72){socket[_0x0a5f('0x6e')](_0x0a5f('0x6f'),{'UserId':_0x417f72['id'],'WhatsappQueueId':_0x365b9b['id']});});});});});}})['then'](respondWithStatusCode(_0x3a434a,null))['catch'](handleError(_0x3a434a,null));};exports[_0x0a5f('0x70')]=function(_0x509536,_0x13bf8c,_0x4265b5){return db[_0x0a5f('0x67')][_0x0a5f('0x4a')]({'where':{'id':_0x509536[_0x0a5f('0x39')][_0x0a5f('0x71')]},'attributes':['id'],'include':[{'model':db[_0x0a5f('0x69')],'as':_0x0a5f('0x72'),'attributes':['id'],'raw':!![]}]})[_0x0a5f('0x27')](handleEntityNotFound(_0x13bf8c,null))['then'](function(_0x27b835){var _0xca2487=_['map'](_0x27b835,'id');var _0x35e86b=[];var _0xa8fe63=[];var _0x129704=squel['select']();_0x129704[_0x0a5f('0x73')]('tq.TeamId')[_0x0a5f('0x74')](_0x0a5f('0x75'),'tq')['join'](_0x0a5f('0x76'),'ut',_0x0a5f('0x77'))[_0x0a5f('0x44')]('WhatsappQueueId\x20=\x20?',_0x509536[_0x0a5f('0x58')]['id']);for(var _0x3c8419=0x0;_0x3c8419<_0x27b835[_0x0a5f('0x4e')];_0x3c8419+=0x1){let _0x315658=_0x27b835[_0x3c8419];for(var _0x371094=0x0;_0x371094<_0x315658[_0x0a5f('0x72')][_0x0a5f('0x4e')];_0x371094+=0x1){let _0xcfae07=_0x315658[_0x0a5f('0x72')][_0x371094];var _0x5e0074=_0x129704['clone']();_0x5e0074[_0x0a5f('0x44')](_0x0a5f('0x78'),_0xcfae07['id']);_0xa8fe63[_0x0a5f('0x79')](db[_0x0a5f('0x6c')][_0x0a5f('0x39')](_0x5e0074[_0x0a5f('0x7a')](),{'type':db['sequelize'][_0x0a5f('0x7b')][_0x0a5f('0x7c')]})[_0x0a5f('0x27')](function(_0x3835eb){if(_0x3835eb[_0x0a5f('0x4e')]===0x1){return _0xcfae07['id'];}else{var _0x3dce0a=_['every'](_[_0x0a5f('0x32')](_0x3835eb,_0x0a5f('0x7d')),function(_0x38624d){return _[_0x0a5f('0x7e')](_0xca2487,_0x38624d);});if(_0x3dce0a){return _0xcfae07['id'];}}}));}}return BPromise[_0x0a5f('0x7f')](_0xa8fe63)[_0x0a5f('0x27')](function(_0x190ca2){_0x35e86b=_(_0x35e86b)[_0x0a5f('0x80')](_0x190ca2)[_0x0a5f('0x81')]()[_0x0a5f('0x82')]();return db[_0x0a5f('0x33')][_0x0a5f('0x4f')]({'where':{'id':_0x509536[_0x0a5f('0x58')]['id']}})[_0x0a5f('0x27')](function(_0x3ff925){return db[_0x0a5f('0x6c')]['transaction'](function(_0x19b0b2){return _0x3ff925['removeTeams'](_0x509536[_0x0a5f('0x39')][_0x0a5f('0x71')],{'transaction':_0x19b0b2})[_0x0a5f('0x27')](function(){if(!_[_0x0a5f('0x83')](_0x35e86b)){return _0x3ff925[_0x0a5f('0x84')](_0x35e86b,{'transaction':_0x19b0b2});}})[_0x0a5f('0x27')](function(){_0x35e86b[_0x0a5f('0x85')](function(_0x536945){socket[_0x0a5f('0x6e')](_0x0a5f('0x86'),{'UserId':_0x536945,'WhatsappQueueId':_0x3ff925['id']});});});});});});})[_0x0a5f('0x27')](respondWithStatusCode(_0x13bf8c,null))[_0x0a5f('0x4c')](handleError(_0x13bf8c,null));};exports[_0x0a5f('0x87')]=function(_0x5536a4,_0x1fd6e4,_0x4396af){return db[_0x0a5f('0x33')][_0x0a5f('0x4f')]({'where':{'id':_0x5536a4[_0x0a5f('0x58')]['id']}})[_0x0a5f('0x27')](handleEntityNotFound(_0x1fd6e4,null))[_0x0a5f('0x27')](function(_0x1dde1b){if(_0x1dde1b){return _0x1dde1b[_0x0a5f('0x87')](_0x5536a4['body'][_0x0a5f('0x71')],_[_0x0a5f('0x88')](_0x5536a4[_0x0a5f('0x57')],['ids','id'])||{})[_0x0a5f('0x89')](function(_0x301a06){for(var _0x544c45=0x0;_0x544c45<_0x5536a4['body'][_0x0a5f('0x71')][_0x0a5f('0x4e')];_0x544c45+=0x1){socket[_0x0a5f('0x6e')](_0x0a5f('0x6f'),{'UserId':Number(_0x5536a4[_0x0a5f('0x57')]['ids'][_0x544c45]),'WhatsappQueueId':Number(_0x5536a4[_0x0a5f('0x58')]['id'])});}return _0x301a06;});}})[_0x0a5f('0x27')](respondWithResult(_0x1fd6e4,null))[_0x0a5f('0x4c')](handleError(_0x1fd6e4,null));};exports[_0x0a5f('0x84')]=function(_0x3903ce,_0x2dcf49,_0x9ce5be){return db['WhatsappQueue'][_0x0a5f('0x4f')]({'where':{'id':_0x3903ce['params']['id']}})[_0x0a5f('0x27')](handleEntityNotFound(_0x2dcf49,null))['then'](function(_0x20be2e){if(_0x20be2e){return _0x20be2e[_0x0a5f('0x84')](_0x3903ce[_0x0a5f('0x39')][_0x0a5f('0x71')])['then'](function(){if(_[_0x0a5f('0x8a')](_0x3903ce[_0x0a5f('0x39')][_0x0a5f('0x71')])){for(var _0x3fba6e=0x0;_0x3fba6e<_0x3903ce[_0x0a5f('0x39')]['ids'][_0x0a5f('0x4e')];_0x3fba6e+=0x1){socket[_0x0a5f('0x6e')](_0x0a5f('0x86'),{'UserId':Number(_0x3903ce[_0x0a5f('0x39')][_0x0a5f('0x71')][_0x3fba6e]),'WhatsappQueueId':Number(_0x3903ce[_0x0a5f('0x58')]['id'])});}}else{socket[_0x0a5f('0x6e')](_0x0a5f('0x86'),{'UserId':Number(_0x3903ce[_0x0a5f('0x39')][_0x0a5f('0x71')]),'WhatsappQueueId':Number(_0x3903ce['params']['id'])});}});}})[_0x0a5f('0x27')](respondWithStatusCode(_0x2dcf49,null))[_0x0a5f('0x4c')](handleError(_0x2dcf49,null));};exports['getAgents']=function(_0x3e7e63,_0x3c3a78,_0x5587d1){var _0x4a8b73={};var _0x33f41b={};var _0x4e2676;var _0x595c5b;return db[_0x0a5f('0x33')][_0x0a5f('0x5b')]({'where':{'id':_0x3e7e63[_0x0a5f('0x58')]['id']}})[_0x0a5f('0x27')](handleEntityNotFound(_0x3c3a78,null))[_0x0a5f('0x27')](function(_0x1cbd08){if(_0x1cbd08){_0x4e2676=_0x1cbd08;_0x33f41b[_0x0a5f('0x38')]=_[_0x0a5f('0x4d')](db[_0x0a5f('0x69')][_0x0a5f('0x34')]);_0x33f41b[_0x0a5f('0x39')]=_[_0x0a5f('0x4d')](_0x3e7e63[_0x0a5f('0x39')]);_0x33f41b[_0x0a5f('0x3a')]=_[_0x0a5f('0x3b')](_0x33f41b[_0x0a5f('0x38')],_0x33f41b[_0x0a5f('0x39')]);_0x4a8b73['attributes']=_['intersection'](_0x33f41b[_0x0a5f('0x38')],qs[_0x0a5f('0x3c')](_0x3e7e63[_0x0a5f('0x39')]['fields']));_0x4a8b73[_0x0a5f('0x3d')]=_0x4a8b73[_0x0a5f('0x3d')][_0x0a5f('0x4e')]?_0x4a8b73[_0x0a5f('0x3d')]:_0x33f41b[_0x0a5f('0x38')];_0x4a8b73['order']=qs[_0x0a5f('0x41')](_0x3e7e63[_0x0a5f('0x39')][_0x0a5f('0x41')]);_0x4a8b73[_0x0a5f('0x44')]=qs[_0x0a5f('0x3a')](_[_0x0a5f('0x42')](_0x3e7e63['query'],_0x33f41b[_0x0a5f('0x3a')]));if(_0x3e7e63[_0x0a5f('0x39')][_0x0a5f('0x43')]){_0x4a8b73[_0x0a5f('0x44')]=_['merge'](_0x4a8b73['where'],{'$or':_['map'](_0x4a8b73['attributes'],function(_0x29b337){var _0x3907f2={};_0x3907f2[_0x29b337]={'$like':'%'+_0x3e7e63['query'][_0x0a5f('0x43')]+'%'};return _0x3907f2;})});}_0x4a8b73=_[_0x0a5f('0x45')]({},_0x4a8b73,_0x3e7e63['options']);return _0x4e2676['getAgents'](_0x4a8b73);}})[_0x0a5f('0x27')](function(_0x33bb83){if(_0x33bb83){_0x595c5b=_0x33bb83[_0x0a5f('0x4e')];if(!_0x3e7e63[_0x0a5f('0x39')]['hasOwnProperty'](_0x0a5f('0x3f'))){_0x4a8b73[_0x0a5f('0x1f')]=qs[_0x0a5f('0x1f')](_0x3e7e63[_0x0a5f('0x39')]['limit']);_0x4a8b73[_0x0a5f('0x1e')]=qs[_0x0a5f('0x1e')](_0x3e7e63[_0x0a5f('0x39')]['offset']);}return _0x4e2676[_0x0a5f('0x8b')](_0x4a8b73);}})[_0x0a5f('0x27')](function(_0x5a8ed4){if(_0x5a8ed4){return _0x5a8ed4?{'count':_0x595c5b,'rows':_0x5a8ed4}:null;}})[_0x0a5f('0x27')](respondWithResult(_0x3c3a78,null))[_0x0a5f('0x4c')](handleError(_0x3c3a78,null));}; \ No newline at end of file +var _0xcb3f=['options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','sort','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','format','createdAt','getTeams','Team','addTeams','ids','Agents','flatMap','each','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','compact','value','transaction','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','then','get','WhatsappQueues','UserProfileResource','sendStatus','error','name','send','map','WhatsappQueue','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys'];(function(_0x101c41,_0x421818){var _0x3078c4=function(_0x5bc95f){while(--_0x5bc95f){_0x101c41['push'](_0x101c41['shift']());}};_0x3078c4(++_0x421818);}(_0xcb3f,0x1e6));var _0xfcb3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xcb3f[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0xfcb3('0x0'));var rimraf=require(_0xfcb3('0x1'));var zipdir=require(_0xfcb3('0x2'));var jsonpatch=require(_0xfcb3('0x3'));var rp=require('request-promise');var moment=require(_0xfcb3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfcb3('0x5'));var util=require(_0xfcb3('0x6'));var path=require(_0xfcb3('0x7'));var sox=require(_0xfcb3('0x8'));var csv=require(_0xfcb3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfcb3('0xa'));var _=require('lodash');var squel=require(_0xfcb3('0xb'));var crypto=require(_0xfcb3('0xc'));var jsforce=require(_0xfcb3('0xd'));var deskjs=require(_0xfcb3('0xe'));var toCsv=require(_0xfcb3('0x9'));var querystring=require(_0xfcb3('0xf'));var Papa=require(_0xfcb3('0x10'));var Redis=require(_0xfcb3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfcb3('0x12'));var as=require(_0xfcb3('0x13'));var hardwareService=require(_0xfcb3('0x14'));var logger=require(_0xfcb3('0x15'))('api');var utils=require(_0xfcb3('0x16'));var config=require(_0xfcb3('0x17'));var licenseUtil=require(_0xfcb3('0x18'));var db=require(_0xfcb3('0x19'))['db'];config[_0xfcb3('0x1a')]=_[_0xfcb3('0x1b')](config[_0xfcb3('0x1a')],{'host':_0xfcb3('0x1c'),'port':0x18eb});var socket=require(_0xfcb3('0x1d'))(new Redis(config[_0xfcb3('0x1a')]));require(_0xfcb3('0x1e'))['register'](socket);function respondWithStatusCode(_0x55a40c,_0x4c5ead){_0x4c5ead=_0x4c5ead||0xcc;return function(_0x5c6aee){if(_0x5c6aee){return _0x55a40c['sendStatus'](_0x4c5ead);}return _0x55a40c['status'](_0x4c5ead)[_0xfcb3('0x1f')]();};}function respondWithResult(_0x5b1ead,_0x234563){_0x234563=_0x234563||0xc8;return function(_0xe19c25){if(_0xe19c25){return _0x5b1ead['status'](_0x234563)[_0xfcb3('0x20')](_0xe19c25);}};}function respondWithFilteredResult(_0x163dc2,_0x3e882e){return function(_0x4da98b){if(_0x4da98b){var _0x29a7a6=typeof _0x3e882e[_0xfcb3('0x21')]===_0xfcb3('0x22')&&typeof _0x3e882e[_0xfcb3('0x23')]===_0xfcb3('0x22');var _0x59dc30=_0x4da98b['count'];var _0x546282=_0x29a7a6?0x0:_0x3e882e[_0xfcb3('0x21')];var _0x218ab4=_0x29a7a6?_0x4da98b[_0xfcb3('0x24')]:_0x3e882e[_0xfcb3('0x21')]+_0x3e882e[_0xfcb3('0x23')];var _0x5f2054;if(_0x218ab4>=_0x59dc30){_0x218ab4=_0x59dc30;_0x5f2054=0xc8;}else{_0x5f2054=0xce;}_0x163dc2[_0xfcb3('0x25')](_0x5f2054);return _0x163dc2[_0xfcb3('0x26')](_0xfcb3('0x27'),_0x546282+'-'+_0x218ab4+'/'+_0x59dc30)[_0xfcb3('0x20')](_0x4da98b);}return null;};}function patchUpdates(_0x3b7e24){return function(_0x5ab3e9){try{jsonpatch[_0xfcb3('0x28')](_0x5ab3e9,_0x3b7e24,!![]);}catch(_0x2fafbc){return BPromise[_0xfcb3('0x29')](_0x2fafbc);}return _0x5ab3e9[_0xfcb3('0x2a')]();};}function saveUpdates(_0x272647,_0x4573ef){return function(_0x24d977){if(_0x24d977){return _0x24d977[_0xfcb3('0x2b')](_0x272647)['then'](function(_0x2dc42c){return _0x2dc42c;});}return null;};}function removeEntity(_0x42ba42,_0x60fb5){return function(_0x13dfff){if(_0x13dfff){return _0x13dfff[_0xfcb3('0x2c')]()[_0xfcb3('0x2d')](function(){var _0x37c126=_0x13dfff[_0xfcb3('0x2e')]({'plain':!![]});var _0x300488=_0xfcb3('0x2f');return db[_0xfcb3('0x30')][_0xfcb3('0x2c')]({'where':{'type':_0x300488,'resourceId':_0x37c126['id']}})[_0xfcb3('0x2d')](function(){return _0x13dfff;});})[_0xfcb3('0x2d')](function(){_0x42ba42['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3689fd,_0x3608bd){return function(_0xcb2023){if(!_0xcb2023){_0x3689fd[_0xfcb3('0x31')](0x194);}return _0xcb2023;};}function handleError(_0x579d74,_0x4e5a10){_0x4e5a10=_0x4e5a10||0x1f4;return function(_0x3280d6){logger[_0xfcb3('0x32')](_0x3280d6['stack']);if(_0x3280d6[_0xfcb3('0x33')]){delete _0x3280d6[_0xfcb3('0x33')];}_0x579d74[_0xfcb3('0x25')](_0x4e5a10)[_0xfcb3('0x34')](_0x3280d6);};}exports['index']=function(_0x5444b5,_0x461223){var _0x5b7145={},_0x1f754e={},_0x15cc71={'count':0x0,'rows':[]};var _0x2b5430=_[_0xfcb3('0x35')](db[_0xfcb3('0x36')]['rawAttributes'],function(_0x4302a8){return{'name':_0x4302a8[_0xfcb3('0x37')],'type':_0x4302a8[_0xfcb3('0x38')][_0xfcb3('0x39')]};});_0x1f754e[_0xfcb3('0x3a')]=_['map'](_0x2b5430,_0xfcb3('0x33'));_0x1f754e['query']=_['keys'](_0x5444b5[_0xfcb3('0x3b')]);_0x1f754e['filters']=_[_0xfcb3('0x3c')](_0x1f754e[_0xfcb3('0x3a')],_0x1f754e[_0xfcb3('0x3b')]);_0x5b7145['attributes']=_['intersection'](_0x1f754e['model'],qs['fields'](_0x5444b5['query'][_0xfcb3('0x3d')]));_0x5b7145[_0xfcb3('0x3e')]=_0x5b7145['attributes'][_0xfcb3('0x3f')]?_0x5b7145[_0xfcb3('0x3e')]:_0x1f754e[_0xfcb3('0x3a')];if(!_0x5444b5[_0xfcb3('0x3b')][_0xfcb3('0x40')](_0xfcb3('0x41'))){_0x5b7145[_0xfcb3('0x23')]=qs[_0xfcb3('0x23')](_0x5444b5[_0xfcb3('0x3b')][_0xfcb3('0x23')]);_0x5b7145[_0xfcb3('0x21')]=qs[_0xfcb3('0x21')](_0x5444b5[_0xfcb3('0x3b')]['offset']);}_0x5b7145[_0xfcb3('0x42')]=qs['sort'](_0x5444b5[_0xfcb3('0x3b')]['sort']);_0x5b7145[_0xfcb3('0x43')]=qs[_0xfcb3('0x44')](_[_0xfcb3('0x45')](_0x5444b5[_0xfcb3('0x3b')],_0x1f754e['filters']),_0x2b5430);if(_0x5444b5[_0xfcb3('0x3b')][_0xfcb3('0x46')]){_0x5b7145[_0xfcb3('0x43')]=_[_0xfcb3('0x47')](_0x5b7145[_0xfcb3('0x43')],{'$or':_[_0xfcb3('0x35')](_0x2b5430,function(_0x497080){if(_0x497080[_0xfcb3('0x38')]!==_0xfcb3('0x48')){var _0x1c7a33={};_0x1c7a33[_0x497080[_0xfcb3('0x33')]]={'$like':'%'+_0x5444b5['query'][_0xfcb3('0x46')]+'%'};return _0x1c7a33;}})});}_0x5b7145=_['merge']({},_0x5b7145,_0x5444b5['options']);var _0xdce275={'where':_0x5b7145[_0xfcb3('0x43')]};return db[_0xfcb3('0x36')][_0xfcb3('0x24')](_0xdce275)[_0xfcb3('0x2d')](function(_0x1343be){_0x15cc71[_0xfcb3('0x24')]=_0x1343be;if(_0x5444b5[_0xfcb3('0x3b')][_0xfcb3('0x49')]){_0x5b7145[_0xfcb3('0x4a')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xfcb3('0x4b')](_0x5b7145);})[_0xfcb3('0x2d')](function(_0x6f6f9e){_0x15cc71[_0xfcb3('0x4c')]=_0x6f6f9e;return _0x15cc71;})['then'](respondWithFilteredResult(_0x461223,_0x5b7145))[_0xfcb3('0x4d')](handleError(_0x461223,null));};exports[_0xfcb3('0x4e')]=function(_0x2194cd,_0x298180){var _0x28a791={'raw':!![],'where':{'id':_0x2194cd[_0xfcb3('0x4f')]['id']}},_0x5669f4={};_0x5669f4['model']=_['keys'](db['WhatsappQueue'][_0xfcb3('0x50')]);_0x5669f4[_0xfcb3('0x3b')]=_[_0xfcb3('0x51')](_0x2194cd[_0xfcb3('0x3b')]);_0x5669f4[_0xfcb3('0x44')]=_[_0xfcb3('0x3c')](_0x5669f4[_0xfcb3('0x3a')],_0x5669f4[_0xfcb3('0x3b')]);_0x28a791[_0xfcb3('0x3e')]=_[_0xfcb3('0x3c')](_0x5669f4[_0xfcb3('0x3a')],qs[_0xfcb3('0x3d')](_0x2194cd[_0xfcb3('0x3b')]['fields']));_0x28a791[_0xfcb3('0x3e')]=_0x28a791['attributes'][_0xfcb3('0x3f')]?_0x28a791['attributes']:_0x5669f4[_0xfcb3('0x3a')];if(_0x2194cd[_0xfcb3('0x3b')][_0xfcb3('0x49')]){_0x28a791[_0xfcb3('0x4a')]=[{'all':!![]}];}_0x28a791=_[_0xfcb3('0x47')]({},_0x28a791,_0x2194cd[_0xfcb3('0x52')]);return db[_0xfcb3('0x36')]['find'](_0x28a791)[_0xfcb3('0x2d')](handleEntityNotFound(_0x298180,null))[_0xfcb3('0x2d')](respondWithResult(_0x298180,null))[_0xfcb3('0x4d')](handleError(_0x298180,null));};exports[_0xfcb3('0x53')]=function(_0x242fc4,_0x3a9be2){return db[_0xfcb3('0x36')][_0xfcb3('0x53')](_0x242fc4[_0xfcb3('0x54')],{})[_0xfcb3('0x2d')](function(_0x3b46a6){var _0x38583a=_0x242fc4[_0xfcb3('0x55')][_0xfcb3('0x2e')]({'plain':!![]});if(!_0x38583a)throw new Error(_0xfcb3('0x56'));if(_0x38583a[_0xfcb3('0x57')]===_0xfcb3('0x55')){var _0x1ba1a5=_0x3b46a6[_0xfcb3('0x2e')]({'plain':!![]});var _0x3d2f9e=_0xfcb3('0x2f');return db['UserProfileSection'][_0xfcb3('0x58')]({'where':{'name':_0x3d2f9e,'userProfileId':_0x38583a['userProfileId']},'raw':!![]})['then'](function(_0x2361e7){if(_0x2361e7&&_0x2361e7[_0xfcb3('0x59')]===0x0){return db[_0xfcb3('0x30')][_0xfcb3('0x53')]({'name':_0x1ba1a5[_0xfcb3('0x33')],'resourceId':_0x1ba1a5['id'],'type':_0x2361e7[_0xfcb3('0x33')],'sectionId':_0x2361e7['id']},{})['then'](function(){return _0x3b46a6;});}else{return _0x3b46a6;}})[_0xfcb3('0x4d')](function(_0x2a8d78){logger[_0xfcb3('0x32')](_0xfcb3('0x5a'),_0x2a8d78);throw _0x2a8d78;});}return _0x3b46a6;})[_0xfcb3('0x2d')](respondWithResult(_0x3a9be2,0xc9))[_0xfcb3('0x4d')](handleError(_0x3a9be2,null));};exports[_0xfcb3('0x2b')]=function(_0x419ec4,_0x2b1ac7){if(_0x419ec4['body']['id']){delete _0x419ec4[_0xfcb3('0x54')]['id'];}return db['WhatsappQueue'][_0xfcb3('0x58')]({'where':{'id':_0x419ec4[_0xfcb3('0x4f')]['id']}})[_0xfcb3('0x2d')](handleEntityNotFound(_0x2b1ac7,null))['then'](saveUpdates(_0x419ec4[_0xfcb3('0x54')],null))['then'](respondWithResult(_0x2b1ac7,null))[_0xfcb3('0x4d')](handleError(_0x2b1ac7,null));};exports['destroy']=function(_0x440d63,_0x4215c3){return db['WhatsappQueue'][_0xfcb3('0x58')]({'where':{'id':_0x440d63[_0xfcb3('0x4f')]['id']}})[_0xfcb3('0x2d')](handleEntityNotFound(_0x4215c3,null))[_0xfcb3('0x2d')](removeEntity(_0x4215c3,null))[_0xfcb3('0x4d')](handleError(_0x4215c3,null));};exports[_0xfcb3('0x5b')]=function(_0x2d5f11,_0x2e802e){return db['WhatsappQueue']['describe']()['then'](respondWithResult(_0x2e802e,null))['catch'](handleError(_0x2e802e,null));};exports[_0xfcb3('0x5c')]=function(_0x69b31c,_0x1af6dd,_0x1e5dd6){var _0x2b4e0e={'raw':!![],'where':{}},_0x2eedb6={},_0x4f03d8;return db[_0xfcb3('0x36')][_0xfcb3('0x5d')]({'where':{'id':_0x69b31c[_0xfcb3('0x4f')]['id']}})[_0xfcb3('0x2d')](handleEntityNotFound(_0x1af6dd,null))[_0xfcb3('0x2d')](function(_0xbbd73a){if(_0xbbd73a){_0x4f03d8=_0xbbd73a[_0xfcb3('0x2e')]({'plain':!![]});_0x2eedb6[_0xfcb3('0x3a')]=_[_0xfcb3('0x51')](db[_0xfcb3('0x5e')][_0xfcb3('0x50')]);_0x2eedb6[_0xfcb3('0x3b')]=_[_0xfcb3('0x51')](_0x69b31c[_0xfcb3('0x3b')]);_0x2eedb6[_0xfcb3('0x44')]=_['intersection'](_0x2eedb6['model'],_0x2eedb6['query']);_0x2b4e0e[_0xfcb3('0x3e')]=_[_0xfcb3('0x3c')](_0x2eedb6[_0xfcb3('0x3a')],qs['fields'](_0x69b31c[_0xfcb3('0x3b')][_0xfcb3('0x3d')]));_0x2b4e0e['attributes']=_0x2b4e0e['attributes'][_0xfcb3('0x3f')]?_0x2b4e0e[_0xfcb3('0x3e')]:_0x2eedb6['model'];if(!_0x69b31c[_0xfcb3('0x3b')]['hasOwnProperty']('nolimit')){_0x2b4e0e[_0xfcb3('0x23')]=qs[_0xfcb3('0x23')](_0x69b31c[_0xfcb3('0x3b')][_0xfcb3('0x23')]);_0x2b4e0e[_0xfcb3('0x21')]=qs[_0xfcb3('0x21')](_0x69b31c[_0xfcb3('0x3b')][_0xfcb3('0x21')]);}_0x2b4e0e[_0xfcb3('0x42')]=qs[_0xfcb3('0x5f')](_0x69b31c[_0xfcb3('0x3b')][_0xfcb3('0x5f')]);_0x2b4e0e['where']=qs[_0xfcb3('0x44')](_[_0xfcb3('0x45')](_0x69b31c[_0xfcb3('0x3b')],_0x2eedb6[_0xfcb3('0x44')]));_0x2b4e0e[_0xfcb3('0x43')][_0xfcb3('0x60')]=_0xbbd73a['id'];if(_0x69b31c[_0xfcb3('0x3b')]['filter']){_0x2b4e0e[_0xfcb3('0x43')]=_['merge'](_0x2b4e0e[_0xfcb3('0x43')],{'$or':_[_0xfcb3('0x35')](_0x2b4e0e[_0xfcb3('0x3e')],function(_0x315ee6){var _0x32af7a={};_0x32af7a[_0x315ee6]={'$like':'%'+_0x69b31c[_0xfcb3('0x3b')][_0xfcb3('0x46')]+'%'};return _0x32af7a;})});}_0x2b4e0e=_['merge']({},_0x2b4e0e,_0x69b31c[_0xfcb3('0x52')]);return db['UserWhatsappQueue']['findAll'](_0x2b4e0e);}})['then'](function(_0x5b832c){if(_0x5b832c){return db[_0xfcb3('0x61')][_0xfcb3('0x62')]({'where':{'id':_[_0xfcb3('0x35')](_0x5b832c,'UserId'),'role':_0xfcb3('0x63')},'attributes':['id',_0xfcb3('0x33'),_0xfcb3('0x64'),'updatedAt','createdAt']});}})[_0xfcb3('0x2d')](function(_0x4c0345){if(_0x4c0345){return{'count':_0x4c0345[_0xfcb3('0x24')],'rows':_[_0xfcb3('0x35')](_0x4c0345['rows'],function(_0x1b4026){return{'membername':_0x1b4026[_0xfcb3('0x33')],'UserId':_0x1b4026['id'],'queue_name':_0x4f03d8[_0xfcb3('0x33')],'WhatsappQueueId':_0x4f03d8['id'],'interface':util[_0xfcb3('0x65')]('%s/%s','SIP',_0x1b4026[_0xfcb3('0x33')]),'penalty':0x0,'paused':_0x1b4026[_0xfcb3('0x64')],'createdAt':_0x1b4026[_0xfcb3('0x66')],'updatedAt':_0x1b4026['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfcb3('0x2d')](respondWithFilteredResult(_0x1af6dd,_0x2b4e0e))[_0xfcb3('0x4d')](handleError(_0x1af6dd,null));};exports[_0xfcb3('0x67')]=function(_0x56601f,_0x4cc823,_0x55cf3d){var _0xc47c78={};var _0xca82f5={};var _0x251fb8;var _0x149f83;return db[_0xfcb3('0x36')]['findOne']({'where':{'id':_0x56601f[_0xfcb3('0x4f')]['id']}})[_0xfcb3('0x2d')](handleEntityNotFound(_0x4cc823,null))[_0xfcb3('0x2d')](function(_0x1238e4){if(_0x1238e4){_0x251fb8=_0x1238e4;_0xca82f5[_0xfcb3('0x3a')]=_[_0xfcb3('0x51')](db[_0xfcb3('0x68')][_0xfcb3('0x50')]);_0xca82f5['query']=_[_0xfcb3('0x51')](_0x56601f[_0xfcb3('0x3b')]);_0xca82f5[_0xfcb3('0x44')]=_[_0xfcb3('0x3c')](_0xca82f5[_0xfcb3('0x3a')],_0xca82f5[_0xfcb3('0x3b')]);_0xc47c78[_0xfcb3('0x3e')]=_[_0xfcb3('0x3c')](_0xca82f5['model'],qs[_0xfcb3('0x3d')](_0x56601f[_0xfcb3('0x3b')][_0xfcb3('0x3d')]));_0xc47c78[_0xfcb3('0x3e')]=_0xc47c78[_0xfcb3('0x3e')]['length']?_0xc47c78[_0xfcb3('0x3e')]:_0xca82f5[_0xfcb3('0x3a')];_0xc47c78[_0xfcb3('0x42')]=qs[_0xfcb3('0x5f')](_0x56601f[_0xfcb3('0x3b')][_0xfcb3('0x5f')]);_0xc47c78[_0xfcb3('0x43')]=qs['filters'](_[_0xfcb3('0x45')](_0x56601f[_0xfcb3('0x3b')],_0xca82f5[_0xfcb3('0x44')]));if(_0x56601f[_0xfcb3('0x3b')][_0xfcb3('0x46')]){_0xc47c78[_0xfcb3('0x43')]=_['merge'](_0xc47c78[_0xfcb3('0x43')],{'$or':_[_0xfcb3('0x35')](_0xc47c78[_0xfcb3('0x3e')],function(_0x3cc461){var _0x439ddf={};_0x439ddf[_0x3cc461]={'$like':'%'+_0x56601f[_0xfcb3('0x3b')][_0xfcb3('0x46')]+'%'};return _0x439ddf;})});}_0xc47c78=_['merge']({},_0xc47c78,_0x56601f[_0xfcb3('0x52')]);return _0x251fb8[_0xfcb3('0x67')](_0xc47c78);}})[_0xfcb3('0x2d')](function(_0x26716f){if(_0x26716f){_0x149f83=_0x26716f['length'];if(!_0x56601f['query'][_0xfcb3('0x40')](_0xfcb3('0x41'))){_0xc47c78['limit']=qs[_0xfcb3('0x23')](_0x56601f[_0xfcb3('0x3b')][_0xfcb3('0x23')]);_0xc47c78[_0xfcb3('0x21')]=qs['offset'](_0x56601f['query'][_0xfcb3('0x21')]);}return _0x251fb8[_0xfcb3('0x67')](_0xc47c78);}})[_0xfcb3('0x2d')](function(_0xae5d63){if(_0xae5d63){return _0xae5d63?{'count':_0x149f83,'rows':_0xae5d63}:null;}})[_0xfcb3('0x2d')](respondWithResult(_0x4cc823,null))[_0xfcb3('0x4d')](handleError(_0x4cc823,null));};exports[_0xfcb3('0x69')]=function(_0x2a07cd,_0x45a51d,_0x1f38bf){var _0x596aef=_0x2a07cd[_0xfcb3('0x54')][_0xfcb3('0x6a')];return db[_0xfcb3('0x68')][_0xfcb3('0x4b')]({'where':{'id':_0x596aef},'attributes':['id'],'include':[{'model':db[_0xfcb3('0x61')],'as':_0xfcb3('0x6b'),'attributes':['id',_0xfcb3('0x33'),'online','voicePause','interface'],'raw':!![]}]})[_0xfcb3('0x2d')](function(_0xde6384){if(_0xde6384){var _0x1ee845=_[_0xfcb3('0x6c')](_0xde6384,function(_0x5e5764){var _0x225fde=_0x5e5764[_0xfcb3('0x2e')]({'plain':!![]});return _0x225fde[_0xfcb3('0x6b')];});return db[_0xfcb3('0x36')][_0xfcb3('0x58')]({'where':{'id':_0x2a07cd[_0xfcb3('0x4f')]['id']}})['then'](function(_0x44a381){return db['sequelize']['transaction'](function(_0x2181c2){return _0x44a381[_0xfcb3('0x69')](_0x596aef,{'transaction':_0x2181c2})[_0xfcb3('0x2d')](function(){return BPromise[_0xfcb3('0x6d')](_0x1ee845,function(_0x5871e9){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x5871e9['id'],'WhatsappQueueId':_0x2a07cd[_0xfcb3('0x4f')]['id']},'transaction':_0x2181c2});});})[_0xfcb3('0x2d')](function(){_0x1ee845['forEach'](function(_0x167d54){socket['emit'](_0xfcb3('0x6e'),{'UserId':_0x167d54['id'],'WhatsappQueueId':_0x44a381['id']});});});});});}})[_0xfcb3('0x2d')](respondWithStatusCode(_0x45a51d,null))[_0xfcb3('0x4d')](handleError(_0x45a51d,null));};exports[_0xfcb3('0x6f')]=function(_0x29d95b,_0x5ceeba,_0x3aff41){return db[_0xfcb3('0x68')][_0xfcb3('0x4b')]({'where':{'id':_0x29d95b[_0xfcb3('0x3b')][_0xfcb3('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xfcb3('0x61')],'as':_0xfcb3('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xfcb3('0x2d')](handleEntityNotFound(_0x5ceeba,null))['then'](function(_0x3282aa){var _0x42684c=_[_0xfcb3('0x35')](_0x3282aa,'id');var _0xce8af3=[];var _0x407224=[];var _0x6b080b=squel[_0xfcb3('0x70')]();_0x6b080b[_0xfcb3('0x71')](_0xfcb3('0x72'))[_0xfcb3('0x73')](_0xfcb3('0x74'),'tq')[_0xfcb3('0x75')](_0xfcb3('0x76'),'ut',_0xfcb3('0x77'))[_0xfcb3('0x43')](_0xfcb3('0x78'),_0x29d95b[_0xfcb3('0x4f')]['id']);for(var _0x547bc9=0x0;_0x547bc9<_0x3282aa[_0xfcb3('0x3f')];_0x547bc9+=0x1){let _0x38ec29=_0x3282aa[_0x547bc9];for(var _0x537ba4=0x0;_0x537ba4<_0x38ec29[_0xfcb3('0x6b')][_0xfcb3('0x3f')];_0x537ba4+=0x1){let _0x31b91a=_0x38ec29['Agents'][_0x537ba4];var _0x3b9c13=_0x6b080b[_0xfcb3('0x79')]();_0x3b9c13[_0xfcb3('0x43')](_0xfcb3('0x7a'),_0x31b91a['id']);_0x407224[_0xfcb3('0x7b')](db[_0xfcb3('0x7c')][_0xfcb3('0x3b')](_0x3b9c13[_0xfcb3('0x7d')](),{'type':db[_0xfcb3('0x7c')][_0xfcb3('0x7e')]['SELECT']})[_0xfcb3('0x2d')](function(_0x5dbdb9){if(_0x5dbdb9[_0xfcb3('0x3f')]===0x1){return _0x31b91a['id'];}else{var _0x5b098e=_[_0xfcb3('0x7f')](_[_0xfcb3('0x35')](_0x5dbdb9,_0xfcb3('0x80')),function(_0x37756c){return _[_0xfcb3('0x81')](_0x42684c,_0x37756c);});if(_0x5b098e){return _0x31b91a['id'];}}}));}}return BPromise[_0xfcb3('0x82')](_0x407224)['then'](function(_0x42c95a){_0xce8af3=_(_0xce8af3)['union'](_0x42c95a)[_0xfcb3('0x83')]()[_0xfcb3('0x84')]();return db['WhatsappQueue'][_0xfcb3('0x58')]({'where':{'id':_0x29d95b[_0xfcb3('0x4f')]['id']}})['then'](function(_0x1fad5f){return db[_0xfcb3('0x7c')][_0xfcb3('0x85')](function(_0x41b098){return _0x1fad5f[_0xfcb3('0x6f')](_0x29d95b[_0xfcb3('0x3b')][_0xfcb3('0x6a')],{'transaction':_0x41b098})[_0xfcb3('0x2d')](function(){if(!_[_0xfcb3('0x86')](_0xce8af3)){return _0x1fad5f[_0xfcb3('0x87')](_0xce8af3,{'transaction':_0x41b098});}})['then'](function(){_0xce8af3['forEach'](function(_0x189352){socket[_0xfcb3('0x88')](_0xfcb3('0x89'),{'UserId':_0x189352,'WhatsappQueueId':_0x1fad5f['id']});});});});});});})[_0xfcb3('0x2d')](respondWithStatusCode(_0x5ceeba,null))[_0xfcb3('0x4d')](handleError(_0x5ceeba,null));};exports[_0xfcb3('0x8a')]=function(_0x3c286a,_0x5eba91,_0x1f6055){return db[_0xfcb3('0x36')][_0xfcb3('0x58')]({'where':{'id':_0x3c286a[_0xfcb3('0x4f')]['id']}})[_0xfcb3('0x2d')](handleEntityNotFound(_0x5eba91,null))['then'](function(_0x31248a){if(_0x31248a){return _0x31248a[_0xfcb3('0x8a')](_0x3c286a[_0xfcb3('0x54')][_0xfcb3('0x6a')],_[_0xfcb3('0x8b')](_0x3c286a['body'],[_0xfcb3('0x6a'),'id'])||{})[_0xfcb3('0x8c')](function(_0x23d902){for(var _0x587458=0x0;_0x587458<_0x3c286a['body'][_0xfcb3('0x6a')][_0xfcb3('0x3f')];_0x587458+=0x1){socket[_0xfcb3('0x88')]('userWhatsappQueue:save',{'UserId':Number(_0x3c286a[_0xfcb3('0x54')][_0xfcb3('0x6a')][_0x587458]),'WhatsappQueueId':Number(_0x3c286a[_0xfcb3('0x4f')]['id'])});}return _0x23d902;});}})['then'](respondWithResult(_0x5eba91,null))[_0xfcb3('0x4d')](handleError(_0x5eba91,null));};exports[_0xfcb3('0x87')]=function(_0x1fd052,_0x1eae64,_0x4dff13){return db[_0xfcb3('0x36')][_0xfcb3('0x58')]({'where':{'id':_0x1fd052['params']['id']}})['then'](handleEntityNotFound(_0x1eae64,null))[_0xfcb3('0x2d')](function(_0x5635b6){if(_0x5635b6){return _0x5635b6[_0xfcb3('0x87')](_0x1fd052[_0xfcb3('0x3b')][_0xfcb3('0x6a')])[_0xfcb3('0x2d')](function(){if(_['isArray'](_0x1fd052['query']['ids'])){for(var _0x4c7ce0=0x0;_0x4c7ce0<_0x1fd052[_0xfcb3('0x3b')][_0xfcb3('0x6a')]['length'];_0x4c7ce0+=0x1){socket[_0xfcb3('0x88')](_0xfcb3('0x89'),{'UserId':Number(_0x1fd052[_0xfcb3('0x3b')][_0xfcb3('0x6a')][_0x4c7ce0]),'WhatsappQueueId':Number(_0x1fd052[_0xfcb3('0x4f')]['id'])});}}else{socket[_0xfcb3('0x88')]('userWhatsappQueue:remove',{'UserId':Number(_0x1fd052['query'][_0xfcb3('0x6a')]),'WhatsappQueueId':Number(_0x1fd052[_0xfcb3('0x4f')]['id'])});}});}})[_0xfcb3('0x2d')](respondWithStatusCode(_0x1eae64,null))[_0xfcb3('0x4d')](handleError(_0x1eae64,null));};exports[_0xfcb3('0x8d')]=function(_0x34f026,_0x4e07f1,_0x30a89d){var _0x1e5193={};var _0x4c2a95={};var _0x42202b;var _0x1b6006;return db[_0xfcb3('0x36')][_0xfcb3('0x5d')]({'where':{'id':_0x34f026['params']['id']}})['then'](handleEntityNotFound(_0x4e07f1,null))[_0xfcb3('0x2d')](function(_0x4592bb){if(_0x4592bb){_0x42202b=_0x4592bb;_0x4c2a95['model']=_[_0xfcb3('0x51')](db[_0xfcb3('0x61')][_0xfcb3('0x50')]);_0x4c2a95[_0xfcb3('0x3b')]=_['keys'](_0x34f026['query']);_0x4c2a95[_0xfcb3('0x44')]=_[_0xfcb3('0x3c')](_0x4c2a95[_0xfcb3('0x3a')],_0x4c2a95[_0xfcb3('0x3b')]);_0x1e5193[_0xfcb3('0x3e')]=_[_0xfcb3('0x3c')](_0x4c2a95[_0xfcb3('0x3a')],qs[_0xfcb3('0x3d')](_0x34f026[_0xfcb3('0x3b')][_0xfcb3('0x3d')]));_0x1e5193[_0xfcb3('0x3e')]=_0x1e5193['attributes'][_0xfcb3('0x3f')]?_0x1e5193[_0xfcb3('0x3e')]:_0x4c2a95[_0xfcb3('0x3a')];_0x1e5193[_0xfcb3('0x42')]=qs[_0xfcb3('0x5f')](_0x34f026[_0xfcb3('0x3b')][_0xfcb3('0x5f')]);_0x1e5193[_0xfcb3('0x43')]=qs[_0xfcb3('0x44')](_[_0xfcb3('0x45')](_0x34f026[_0xfcb3('0x3b')],_0x4c2a95[_0xfcb3('0x44')]));if(_0x34f026['query'][_0xfcb3('0x46')]){_0x1e5193[_0xfcb3('0x43')]=_[_0xfcb3('0x47')](_0x1e5193[_0xfcb3('0x43')],{'$or':_[_0xfcb3('0x35')](_0x1e5193[_0xfcb3('0x3e')],function(_0x36592d){var _0x18985b={};_0x18985b[_0x36592d]={'$like':'%'+_0x34f026[_0xfcb3('0x3b')][_0xfcb3('0x46')]+'%'};return _0x18985b;})});}_0x1e5193=_['merge']({},_0x1e5193,_0x34f026[_0xfcb3('0x52')]);return _0x42202b[_0xfcb3('0x8d')](_0x1e5193);}})['then'](function(_0x53839c){if(_0x53839c){_0x1b6006=_0x53839c[_0xfcb3('0x3f')];if(!_0x34f026[_0xfcb3('0x3b')][_0xfcb3('0x40')](_0xfcb3('0x41'))){_0x1e5193[_0xfcb3('0x23')]=qs[_0xfcb3('0x23')](_0x34f026[_0xfcb3('0x3b')]['limit']);_0x1e5193['offset']=qs['offset'](_0x34f026[_0xfcb3('0x3b')][_0xfcb3('0x21')]);}return _0x42202b['getAgents'](_0x1e5193);}})[_0xfcb3('0x2d')](function(_0x1d687a){if(_0x1d687a){return _0x1d687a?{'count':_0x1b6006,'rows':_0x1d687a}:null;}})[_0xfcb3('0x2d')](respondWithResult(_0x4e07f1,null))[_0xfcb3('0x4d')](handleError(_0x4e07f1,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index f59fe12..e3f3a92 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 _0x86b1=['../../mysqldb','WhatsappQueue','save','update','emit','hook','events'];(function(_0x3a9e70,_0x2d93ee){var _0x2b1931=function(_0x33396f){while(--_0x33396f){_0x3a9e70['push'](_0x3a9e70['shift']());}};_0x2b1931(++_0x2d93ee);}(_0x86b1,0x68));var _0x186b=function(_0x3f7c4a,_0x5d45e9){_0x3f7c4a=_0x3f7c4a-0x0;var _0x31620a=_0x86b1[_0x3f7c4a];return _0x31620a;};'use strict';var EventEmitter=require(_0x186b('0x0'));var WhatsappQueue=require(_0x186b('0x1'))['db'][_0x186b('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x186b('0x3'),'afterUpdate':_0x186b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x268d8d){return function(_0xbbbe46,_0x48781c,_0x4e1502){WhatsappQueueEvents[_0x186b('0x5')](_0x268d8d+':'+_0xbbbe46['id'],_0xbbbe46);WhatsappQueueEvents['emit'](_0x268d8d,_0xbbbe46);_0x4e1502(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x186b('0x6')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x579d=['WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0xcd2dc0,_0x57aaf0){var _0x334d36=function(_0x594bca){while(--_0x594bca){_0xcd2dc0['push'](_0xcd2dc0['shift']());}};_0x334d36(++_0x57aaf0);}(_0x579d,0x1e9));var _0xd579=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x579d[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xd579('0x0'))['db'][_0xd579('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd579('0x2')](0x0);var events={'afterCreate':_0xd579('0x3'),'afterUpdate':_0xd579('0x4'),'afterDestroy':_0xd579('0x5')};function emitEvent(_0x2369f2){return function(_0x4f8d3c,_0x5f09fc,_0x2772d0){WhatsappQueueEvents[_0xd579('0x6')](_0x2369f2+':'+_0x4f8d3c['id'],_0x4f8d3c);WhatsappQueueEvents[_0xd579('0x6')](_0x2369f2,_0x4f8d3c);_0x2772d0(null);};}for(var e in events){if(events[_0xd579('0x7')](e)){var event=events[e];WhatsappQueue[_0xd579('0x8')](e,emitEvent(event));}}module[_0xd579('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 03ca081..3b1eb41 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 _0x1384=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','whatsapp_queues'];(function(_0x1e8f99,_0x5cbee7){var _0x283bce=function(_0x752fec){while(--_0x752fec){_0x1e8f99['push'](_0x1e8f99['shift']());}};_0x283bce(++_0x5cbee7);}(_0x1384,0x12c));var _0x4138=function(_0x5c58af,_0xd9900e){_0x5c58af=_0x5c58af-0x0;var _0x2eced2=_0x1384[_0x5c58af];return _0x2eced2;};'use strict';var _=require(_0x4138('0x0'));var util=require(_0x4138('0x1'));var logger=require(_0x4138('0x2'))(_0x4138('0x3'));var moment=require(_0x4138('0x4'));var BPromise=require(_0x4138('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4138('0x6'));var rimraf=require(_0x4138('0x7'));var config=require(_0x4138('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0x4138('0x9')]=function(_0x5a4e6d,_0x8ef77b){return _0x5a4e6d[_0x4138('0xa')]('WhatsappQueue',attributes,{'tableName':_0x4138('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3931=['../../config/environment','exports','define','whatsapp_queues','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x21d7a2,_0x5aecda){var _0x1da981=function(_0x4c86f2){while(--_0x4c86f2){_0x21d7a2['push'](_0x21d7a2['shift']());}};_0x1da981(++_0x5aecda);}(_0x3931,0x67));var _0x1393=function(_0x5bbb21,_0x4d0b03){_0x5bbb21=_0x5bbb21-0x0;var _0x59130c=_0x3931[_0x5bbb21];return _0x59130c;};'use strict';var _=require(_0x1393('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1393('0x1'));var moment=require(_0x1393('0x2'));var BPromise=require(_0x1393('0x3'));var rp=require(_0x1393('0x4'));var fs=require('fs');var path=require(_0x1393('0x5'));var rimraf=require(_0x1393('0x6'));var config=require(_0x1393('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0x1393('0x8')]=function(_0x23f895,_0x636a2e){return _0x23f895[_0x1393('0x9')]('WhatsappQueue',attributes,{'tableName':_0x1393('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 0e379fd..c092ebe 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 _0xc2d8=['defaults','localhost','socket.io-emitter','redis','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowWhatsappQueue','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x273c0c,_0x1d81a3){var _0x1d9c4c=function(_0x1a110b){while(--_0x1a110b){_0x273c0c['push'](_0x273c0c['shift']());}};_0x1d9c4c(++_0x1d81a3);}(_0xc2d8,0x1af));var _0x8c2d=function(_0x407a91,_0x2263d5){_0x407a91=_0x407a91-0x0;var _0x1d56ff=_0xc2d8[_0x407a91];return _0x1d56ff;};'use strict';var _=require(_0x8c2d('0x0'));var util=require('util');var moment=require(_0x8c2d('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c2d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c2d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c2d('0x4'))(_0x8c2d('0x5'));var config=require('../../config/environment');var jayson=require(_0x8c2d('0x6'));var client=jayson[_0x8c2d('0x7')][_0x8c2d('0x8')]({'port':0x232a});config['redis']=_[_0x8c2d('0x9')](config['redis'],{'host':_0x8c2d('0xa'),'port':0x18eb});var socket=require(_0x8c2d('0xb'))(new Redis(config[_0x8c2d('0xc')]));require(_0x8c2d('0xd'))[_0x8c2d('0xe')](socket);function respondWithRpcPromise(_0x5c9132,_0x5e0afb,_0x2dacfa){return new BPromise(function(_0x4d417a,_0x5e9ffe){return client[_0x8c2d('0xf')](_0x5c9132,_0x2dacfa)[_0x8c2d('0x10')](function(_0x29b985){logger[_0x8c2d('0x11')](_0x8c2d('0x12'),_0x5e0afb,'request\x20sent');logger[_0x8c2d('0x13')](_0x8c2d('0x14'),_0x5e0afb,_0x8c2d('0x15'),JSON[_0x8c2d('0x16')](_0x29b985));if(_0x29b985['error']){if(_0x29b985[_0x8c2d('0x17')][_0x8c2d('0x18')]===0x1f4){logger[_0x8c2d('0x17')](_0x8c2d('0x12'),_0x5e0afb,_0x29b985[_0x8c2d('0x17')][_0x8c2d('0x19')]);return _0x5e9ffe(_0x29b985[_0x8c2d('0x17')][_0x8c2d('0x19')]);}logger[_0x8c2d('0x17')](_0x8c2d('0x12'),_0x5e0afb,_0x29b985['error']['message']);return _0x4d417a(_0x29b985['error'][_0x8c2d('0x19')]);}else{logger['info'](_0x8c2d('0x12'),_0x5e0afb,_0x8c2d('0x15'));_0x4d417a(_0x29b985[_0x8c2d('0x1a')][_0x8c2d('0x19')]);}})[_0x8c2d('0x1b')](function(_0x3c8cd){logger[_0x8c2d('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x5e0afb,_0x3c8cd);_0x5e9ffe(_0x3c8cd);});});}exports[_0x8c2d('0x1c')]=function(_0x2f0d8e){var _0x1c7ae2=this;return new Promise(function(_0x2fd38c,_0x2735a6){return db[_0x8c2d('0x1d')][_0x8c2d('0x1e')]({'raw':_0x2f0d8e[_0x8c2d('0x1f')]?_0x2f0d8e[_0x8c2d('0x1f')][_0x8c2d('0x20')]===undefined?!![]:![]:!![],'where':_0x2f0d8e[_0x8c2d('0x1f')]?_0x2f0d8e['options'][_0x8c2d('0x21')]||null:null,'attributes':_0x2f0d8e[_0x8c2d('0x1f')]?_0x2f0d8e['options']['attributes']||null:null,'limit':_0x2f0d8e['options']?_0x2f0d8e[_0x8c2d('0x1f')][_0x8c2d('0x22')]||null:null,'include':_0x2f0d8e[_0x8c2d('0x1f')]?_0x2f0d8e[_0x8c2d('0x1f')][_0x8c2d('0x23')]?_[_0x8c2d('0x24')](_0x2f0d8e['options'][_0x8c2d('0x23')],function(_0x7f0235){return{'model':db[_0x7f0235['model']],'as':_0x7f0235['as'],'attributes':_0x7f0235['attributes'],'include':_0x7f0235[_0x8c2d('0x23')]?_[_0x8c2d('0x24')](_0x7f0235['include'],function(_0x1ba5db){return{'model':db[_0x1ba5db[_0x8c2d('0x25')]],'as':_0x1ba5db['as'],'attributes':_0x1ba5db[_0x8c2d('0x26')],'include':_0x1ba5db[_0x8c2d('0x23')]?_[_0x8c2d('0x24')](_0x1ba5db[_0x8c2d('0x23')],function(_0x596a3d){return{'model':db[_0x596a3d[_0x8c2d('0x25')]],'as':_0x596a3d['as'],'attributes':_0x596a3d[_0x8c2d('0x26')]};}):[]};}):[]};}):[]:[]})[_0x8c2d('0x10')](function(_0x4af515){logger[_0x8c2d('0x11')](_0x8c2d('0x1c'),_0x2f0d8e);logger[_0x8c2d('0x13')]('GetWhatsappQueue',_0x2f0d8e,JSON['stringify'](_0x4af515));_0x2fd38c(_0x4af515);})[_0x8c2d('0x1b')](function(_0x3f7dea){logger['error']('GetWhatsappQueue',_0x3f7dea[_0x8c2d('0x19')],_0x2f0d8e);_0x2735a6(_0x1c7ae2[_0x8c2d('0x17')](0x1f4,_0x3f7dea[_0x8c2d('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x4435c7){var _0x4fd110=this;return new Promise(function(_0xca0c0a,_0x4d961b){return db[_0x8c2d('0x1d')]['find']({'raw':_0x4435c7[_0x8c2d('0x1f')]?_0x4435c7['options'][_0x8c2d('0x20')]===undefined?!![]:![]:!![],'where':_0x4435c7[_0x8c2d('0x1f')]?_0x4435c7[_0x8c2d('0x1f')][_0x8c2d('0x21')]||null:null,'attributes':_0x4435c7['options']?_0x4435c7[_0x8c2d('0x1f')][_0x8c2d('0x26')]||null:null,'include':_0x4435c7[_0x8c2d('0x1f')]?_0x4435c7[_0x8c2d('0x1f')][_0x8c2d('0x23')]?_[_0x8c2d('0x24')](_0x4435c7[_0x8c2d('0x1f')][_0x8c2d('0x23')],function(_0x4f5391){return{'model':db[_0x4f5391['model']],'as':_0x4f5391['as'],'attributes':_0x4f5391[_0x8c2d('0x26')],'include':_0x4f5391['include']?_[_0x8c2d('0x24')](_0x4f5391[_0x8c2d('0x23')],function(_0x5c74b1){return{'model':db[_0x5c74b1['model']],'as':_0x5c74b1['as'],'attributes':_0x5c74b1[_0x8c2d('0x26')],'include':_0x5c74b1[_0x8c2d('0x23')]?_['map'](_0x5c74b1[_0x8c2d('0x23')],function(_0xad1eba){return{'model':db[_0xad1eba[_0x8c2d('0x25')]],'as':_0xad1eba['as'],'attributes':_0xad1eba[_0x8c2d('0x26')]};}):[]};}):[]};}):[]:[]})[_0x8c2d('0x10')](function(_0x56baa4){logger[_0x8c2d('0x11')](_0x8c2d('0x27'),_0x4435c7);logger['debug'](_0x8c2d('0x27'),_0x4435c7,JSON[_0x8c2d('0x16')](_0x56baa4));_0xca0c0a(_0x56baa4);})[_0x8c2d('0x1b')](function(_0x463c78){logger[_0x8c2d('0x17')](_0x8c2d('0x27'),_0x463c78[_0x8c2d('0x19')],_0x4435c7);_0x4d961b(_0x4fd110['error'](0x1f4,_0x463c78[_0x8c2d('0x19')]));});});}; \ No newline at end of file +var _0xc651=['error','code','message','result','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetWhatsappQueue','catch','find','debug','ShowWhatsappQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','WhatsappQueue,\x20%s,\x20%s','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x35f174,_0x43cb9c){var _0x16557b=function(_0x476a37){while(--_0x476a37){_0x35f174['push'](_0x35f174['shift']());}};_0x16557b(++_0x43cb9c);}(_0xc651,0x110));var _0x1c65=function(_0xa71cd1,_0x56a063){_0xa71cd1=_0xa71cd1-0x0;var _0x53cdf7=_0xc651[_0xa71cd1];return _0x53cdf7;};'use strict';var _=require(_0x1c65('0x0'));var util=require('util');var moment=require(_0x1c65('0x1'));var BPromise=require(_0x1c65('0x2'));var rs=require(_0x1c65('0x3'));var fs=require('fs');var Redis=require(_0x1c65('0x4'));var db=require(_0x1c65('0x5'))['db'];var utils=require(_0x1c65('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1c65('0x7'));var jayson=require(_0x1c65('0x8'));var client=jayson[_0x1c65('0x9')][_0x1c65('0xa')]({'port':0x232a});config[_0x1c65('0xb')]=_[_0x1c65('0xc')](config['redis'],{'host':_0x1c65('0xd'),'port':0x18eb});var socket=require(_0x1c65('0xe'))(new Redis(config[_0x1c65('0xb')]));require('./whatsappQueue.socket')[_0x1c65('0xf')](socket);function respondWithRpcPromise(_0x3f5b28,_0x45ba6b,_0x4695f8){return new BPromise(function(_0x465c75,_0x5f1326){return client[_0x1c65('0x10')](_0x3f5b28,_0x4695f8)['then'](function(_0x54a928){logger[_0x1c65('0x11')](_0x1c65('0x12'),_0x45ba6b,'request\x20sent');logger['debug'](_0x1c65('0x13'),_0x45ba6b,_0x1c65('0x14'),JSON[_0x1c65('0x15')](_0x54a928));if(_0x54a928[_0x1c65('0x16')]){if(_0x54a928[_0x1c65('0x16')][_0x1c65('0x17')]===0x1f4){logger[_0x1c65('0x16')](_0x1c65('0x12'),_0x45ba6b,_0x54a928[_0x1c65('0x16')]['message']);return _0x5f1326(_0x54a928[_0x1c65('0x16')][_0x1c65('0x18')]);}logger[_0x1c65('0x16')](_0x1c65('0x12'),_0x45ba6b,_0x54a928['error'][_0x1c65('0x18')]);return _0x465c75(_0x54a928['error'][_0x1c65('0x18')]);}else{logger['info'](_0x1c65('0x12'),_0x45ba6b,_0x1c65('0x14'));_0x465c75(_0x54a928[_0x1c65('0x19')]['message']);}})['catch'](function(_0x215cc5){logger[_0x1c65('0x16')](_0x1c65('0x12'),_0x45ba6b,_0x215cc5);_0x5f1326(_0x215cc5);});});}exports['GetWhatsappQueue']=function(_0x4c8804){var _0x3c6e87=this;return new Promise(function(_0x25fe30,_0x2095ac){return db[_0x1c65('0x1a')][_0x1c65('0x1b')]({'raw':_0x4c8804[_0x1c65('0x1c')]?_0x4c8804[_0x1c65('0x1c')][_0x1c65('0x1d')]===undefined?!![]:![]:!![],'where':_0x4c8804['options']?_0x4c8804[_0x1c65('0x1c')][_0x1c65('0x1e')]||null:null,'attributes':_0x4c8804[_0x1c65('0x1c')]?_0x4c8804[_0x1c65('0x1c')][_0x1c65('0x1f')]||null:null,'limit':_0x4c8804['options']?_0x4c8804[_0x1c65('0x1c')][_0x1c65('0x20')]||null:null,'include':_0x4c8804[_0x1c65('0x1c')]?_0x4c8804['options'][_0x1c65('0x21')]?_[_0x1c65('0x22')](_0x4c8804[_0x1c65('0x1c')][_0x1c65('0x21')],function(_0x2e2034){return{'model':db[_0x2e2034[_0x1c65('0x23')]],'as':_0x2e2034['as'],'attributes':_0x2e2034['attributes'],'include':_0x2e2034['include']?_[_0x1c65('0x22')](_0x2e2034[_0x1c65('0x21')],function(_0x3f05ce){return{'model':db[_0x3f05ce[_0x1c65('0x23')]],'as':_0x3f05ce['as'],'attributes':_0x3f05ce['attributes'],'include':_0x3f05ce[_0x1c65('0x21')]?_[_0x1c65('0x22')](_0x3f05ce[_0x1c65('0x21')],function(_0xe919c5){return{'model':db[_0xe919c5[_0x1c65('0x23')]],'as':_0xe919c5['as'],'attributes':_0xe919c5[_0x1c65('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1c65('0x24')](function(_0x217b87){logger['info'](_0x1c65('0x25'),_0x4c8804);logger['debug'](_0x1c65('0x25'),_0x4c8804,JSON['stringify'](_0x217b87));_0x25fe30(_0x217b87);})[_0x1c65('0x26')](function(_0x75df7d){logger['error'](_0x1c65('0x25'),_0x75df7d[_0x1c65('0x18')],_0x4c8804);_0x2095ac(_0x3c6e87['error'](0x1f4,_0x75df7d[_0x1c65('0x18')]));});});};exports['ShowWhatsappQueue']=function(_0x21a73d){var _0x149e65=this;return new Promise(function(_0x3fd073,_0x316f55){return db['WhatsappQueue'][_0x1c65('0x27')]({'raw':_0x21a73d[_0x1c65('0x1c')]?_0x21a73d[_0x1c65('0x1c')][_0x1c65('0x1d')]===undefined?!![]:![]:!![],'where':_0x21a73d[_0x1c65('0x1c')]?_0x21a73d['options']['where']||null:null,'attributes':_0x21a73d[_0x1c65('0x1c')]?_0x21a73d[_0x1c65('0x1c')]['attributes']||null:null,'include':_0x21a73d[_0x1c65('0x1c')]?_0x21a73d[_0x1c65('0x1c')][_0x1c65('0x21')]?_[_0x1c65('0x22')](_0x21a73d[_0x1c65('0x1c')]['include'],function(_0x32f505){return{'model':db[_0x32f505[_0x1c65('0x23')]],'as':_0x32f505['as'],'attributes':_0x32f505[_0x1c65('0x1f')],'include':_0x32f505[_0x1c65('0x21')]?_[_0x1c65('0x22')](_0x32f505[_0x1c65('0x21')],function(_0xea1c55){return{'model':db[_0xea1c55['model']],'as':_0xea1c55['as'],'attributes':_0xea1c55[_0x1c65('0x1f')],'include':_0xea1c55[_0x1c65('0x21')]?_[_0x1c65('0x22')](_0xea1c55[_0x1c65('0x21')],function(_0xff3b4){return{'model':db[_0xff3b4['model']],'as':_0xff3b4['as'],'attributes':_0xff3b4[_0x1c65('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1c65('0x24')](function(_0xd86f6c){logger[_0x1c65('0x11')]('ShowWhatsappQueue',_0x21a73d);logger[_0x1c65('0x28')](_0x1c65('0x29'),_0x21a73d,JSON[_0x1c65('0x15')](_0xd86f6c));_0x3fd073(_0xd86f6c);})[_0x1c65('0x26')](function(_0x5a384f){logger[_0x1c65('0x16')](_0x1c65('0x29'),_0x5a384f[_0x1c65('0x18')],_0x21a73d);_0x316f55(_0x149e65[_0x1c65('0x16')](0x1f4,_0x5a384f[_0x1c65('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 6e1e571..e74314d 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 _0xf08c=['removeListener','length','./whatsappQueue.events','save','remove','emit'];(function(_0x21090b,_0x39dd3b){var _0x3c68d7=function(_0x28ecd4){while(--_0x28ecd4){_0x21090b['push'](_0x21090b['shift']());}};_0x3c68d7(++_0x39dd3b);}(_0xf08c,0x176));var _0xcf08=function(_0x395802,_0x283e13){_0x395802=_0x395802-0x0;var _0x39e0b9=_0xf08c[_0x395802];return _0x39e0b9;};'use strict';var WhatsappQueueEvents=require(_0xcf08('0x0'));var events=[_0xcf08('0x1'),_0xcf08('0x2'),'update'];function createListener(_0x1ef301,_0x448826){return function(_0x1643d8){_0x448826[_0xcf08('0x3')](_0x1ef301,_0x1643d8);};}function removeListener(_0x23ba6b,_0x147d88){return function(){WhatsappQueueEvents[_0xcf08('0x4')](_0x23ba6b,_0x147d88);};}exports['register']=function(_0x4f1c16){for(var _0xec4dd8=0x0,_0x57e18a=events[_0xcf08('0x5')];_0xec4dd8<_0x57e18a;_0xec4dd8++){var _0x55e2ac=events[_0xec4dd8];var _0x2aa048=createListener('whatsappQueue:'+_0x55e2ac,_0x4f1c16);WhatsappQueueEvents['on'](_0x55e2ac,_0x2aa048);}}; \ No newline at end of file +var _0xe952=['save','remove','update','emit','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x5426e2,_0x5f2968){var _0x920dc=function(_0x3a87c6){while(--_0x3a87c6){_0x5426e2['push'](_0x5426e2['shift']());}};_0x920dc(++_0x5f2968);}(_0xe952,0x1b8));var _0x2e95=function(_0x3c701f,_0x17c827){_0x3c701f=_0x3c701f-0x0;var _0x52fbc4=_0xe952[_0x3c701f];return _0x52fbc4;};'use strict';var WhatsappQueueEvents=require(_0x2e95('0x0'));var events=[_0x2e95('0x1'),_0x2e95('0x2'),_0x2e95('0x3')];function createListener(_0x1d488c,_0x2d3a6b){return function(_0x3ae699){_0x2d3a6b[_0x2e95('0x4')](_0x1d488c,_0x3ae699);};}function removeListener(_0x146581,_0x5bf476){return function(){WhatsappQueueEvents['removeListener'](_0x146581,_0x5bf476);};}exports['register']=function(_0x2dbdc4){for(var _0x108d25=0x0,_0x36446e=events[_0x2e95('0x5')];_0x108d25<_0x36446e;_0x108d25++){var _0x19b8e1=events[_0x108d25];var _0x3eb529=createListener(_0x2e95('0x6')+_0x19b8e1,_0x2dbdc4);WhatsappQueueEvents['on'](_0x19b8e1,_0x3eb529);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index dd080ea..cd28449 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 _0x6dc1=['express','Router','fs-extra','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout'];(function(_0x5e7623,_0x5713f2){var _0x2d5120=function(_0x3e9b2a){while(--_0x3e9b2a){_0x5e7623['push'](_0x5e7623['shift']());}};_0x2d5120(++_0x5713f2);}(_0x6dc1,0x1b2));var _0x16dc=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x6dc1[_0x164eca];return _0x2ce562;};'use strict';var multer=require('multer');var util=require(_0x16dc('0x0'));var path=require(_0x16dc('0x1'));var timeout=require(_0x16dc('0x2'));var express=require(_0x16dc('0x3'));var router=express[_0x16dc('0x4')]();var fs_extra=require(_0x16dc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x16dc('0x6'));var config=require('../../config/environment');var controller=require(_0x16dc('0x7'));router[_0x16dc('0x8')]('/',auth[_0x16dc('0x9')](),controller[_0x16dc('0xa')]);router[_0x16dc('0x8')]('/describe',auth[_0x16dc('0x9')](),controller['describe']);router[_0x16dc('0x8')](_0x16dc('0xb'),auth[_0x16dc('0x9')](),controller[_0x16dc('0xc')]);router[_0x16dc('0xd')]('/',auth['isAuthenticated'](),controller[_0x16dc('0xe')]);router[_0x16dc('0xf')](_0x16dc('0xb'),auth[_0x16dc('0x9')](),controller[_0x16dc('0x10')]);router[_0x16dc('0x11')](_0x16dc('0xb'),auth[_0x16dc('0x9')](),controller['destroy']);module[_0x16dc('0x12')]=router; \ No newline at end of file +var _0x32cc=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','exports','multer'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x32cc,0xaa));var _0xc32c=function(_0xc487b9,_0x13b645){_0xc487b9=_0xc487b9-0x0;var _0x239f28=_0x32cc[_0xc487b9];return _0x239f28;};'use strict';var multer=require(_0xc32c('0x0'));var util=require(_0xc32c('0x1'));var path=require(_0xc32c('0x2'));var timeout=require(_0xc32c('0x3'));var express=require(_0xc32c('0x4'));var router=express[_0xc32c('0x5')]();var fs_extra=require(_0xc32c('0x6'));var auth=require(_0xc32c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc32c('0x8'));var controller=require(_0xc32c('0x9'));router[_0xc32c('0xa')]('/',auth[_0xc32c('0xb')](),controller['index']);router[_0xc32c('0xa')](_0xc32c('0xc'),auth['isAuthenticated'](),controller[_0xc32c('0xd')]);router[_0xc32c('0xa')](_0xc32c('0xe'),auth[_0xc32c('0xb')](),controller[_0xc32c('0xf')]);router[_0xc32c('0x10')]('/',auth[_0xc32c('0xb')](),controller['create']);router[_0xc32c('0x11')]('/:id',auth[_0xc32c('0xb')](),controller['update']);router['delete'](_0xc32c('0xe'),auth[_0xc32c('0xb')](),controller['destroy']);module[_0xc32c('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 6c702d3..9d70990 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x3a9e96,_0x4a849){var _0x2c3537=function(_0x5d8474){while(--_0x5d8474){_0x3a9e96['push'](_0x3a9e96['shift']());}};_0x2c3537(++_0x4a849);}(_0x7a54,0x106));var _0x47a5=function(_0x596b94,_0xcc2e95){_0x596b94=_0x596b94-0x0;var _0x13d9bc=_0x7a54[_0x596b94];return _0x13d9bc;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0xf909b3,_0x568283){var _0x2942f1=function(_0x167a0f){while(--_0x167a0f){_0xf909b3['push'](_0xf909b3['shift']());}};_0x2942f1(++_0x568283);}(_0x7a54,0x106));var _0x47a5=function(_0x5f3e1b,_0xf15758){_0x5f3e1b=_0x5f3e1b-0x0;var _0x7a11c2=_0x7a54[_0x5f3e1b];return _0x7a11c2;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 9204e02..82cd077 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 _0x8f59=['../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service'];(function(_0x48f77f,_0x42df3){var _0x2760f4=function(_0x5dfd17){while(--_0x5dfd17){_0x48f77f['push'](_0x48f77f['shift']());}};_0x2760f4(++_0x42df3);}(_0x8f59,0x11d));var _0x98f5=function(_0x12246f,_0x2c06da){_0x12246f=_0x12246f-0x0;var _0x5a435e=_0x8f59[_0x12246f];return _0x5a435e;};'use strict';var emlformat=require(_0x98f5('0x0'));var rimraf=require(_0x98f5('0x1'));var zipdir=require(_0x98f5('0x2'));var jsonpatch=require(_0x98f5('0x3'));var rp=require(_0x98f5('0x4'));var moment=require(_0x98f5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x98f5('0x6'));var util=require(_0x98f5('0x7'));var path=require(_0x98f5('0x8'));var sox=require(_0x98f5('0x9'));var csv=require('to-csv');var ejs=require(_0x98f5('0xa'));var fs=require('fs');var fs_extra=require(_0x98f5('0xb'));var _=require(_0x98f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98f5('0xd'));var deskjs=require(_0x98f5('0xe'));var toCsv=require(_0x98f5('0xf'));var querystring=require('querystring');var Papa=require(_0x98f5('0x10'));var Redis=require(_0x98f5('0x11'));var authService=require(_0x98f5('0x12'));var qs=require(_0x98f5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98f5('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x98f5('0x15'));var config=require(_0x98f5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x98f5('0x17'))['db'];function respondWithStatusCode(_0x259abe,_0x1f00e8){_0x1f00e8=_0x1f00e8||0xcc;return function(_0x160626){if(_0x160626){return _0x259abe[_0x98f5('0x18')](_0x1f00e8);}return _0x259abe[_0x98f5('0x19')](_0x1f00e8)['end']();};}function respondWithResult(_0x24a7a9,_0xbade31){_0xbade31=_0xbade31||0xc8;return function(_0x5b8bab){if(_0x5b8bab){return _0x24a7a9[_0x98f5('0x19')](_0xbade31)[_0x98f5('0x1a')](_0x5b8bab);}};}function respondWithFilteredResult(_0xaa951a,_0x4ae70d){return function(_0x2437e7){if(_0x2437e7){var _0xc7a49b=typeof _0x4ae70d[_0x98f5('0x1b')]==='undefined'&&typeof _0x4ae70d[_0x98f5('0x1c')]===_0x98f5('0x1d');var _0x574644=_0x2437e7[_0x98f5('0x1e')];var _0x51a567=_0xc7a49b?0x0:_0x4ae70d[_0x98f5('0x1b')];var _0x9e42dd=_0xc7a49b?_0x2437e7[_0x98f5('0x1e')]:_0x4ae70d[_0x98f5('0x1b')]+_0x4ae70d[_0x98f5('0x1c')];var _0xa4477c;if(_0x9e42dd>=_0x574644){_0x9e42dd=_0x574644;_0xa4477c=0xc8;}else{_0xa4477c=0xce;}_0xaa951a['status'](_0xa4477c);return _0xaa951a[_0x98f5('0x1f')]('Content-Range',_0x51a567+'-'+_0x9e42dd+'/'+_0x574644)[_0x98f5('0x1a')](_0x2437e7);}return null;};}function patchUpdates(_0x191f23){return function(_0x5deca0){try{jsonpatch[_0x98f5('0x20')](_0x5deca0,_0x191f23,!![]);}catch(_0x2933d1){return BPromise[_0x98f5('0x21')](_0x2933d1);}return _0x5deca0[_0x98f5('0x22')]();};}function saveUpdates(_0x3b2d9d,_0x3dc7c2){return function(_0x38b46d){if(_0x38b46d){return _0x38b46d['update'](_0x3b2d9d)[_0x98f5('0x23')](function(_0x49ee4e){return _0x49ee4e;});}return null;};}function removeEntity(_0xcb10d6,_0x495889){return function(_0x44bfbb){if(_0x44bfbb){return _0x44bfbb[_0x98f5('0x24')]()[_0x98f5('0x23')](function(){_0xcb10d6[_0x98f5('0x19')](0xcc)[_0x98f5('0x25')]();});}};}function handleEntityNotFound(_0x18052d,_0x46dbd4){return function(_0x58d506){if(!_0x58d506){_0x18052d[_0x98f5('0x18')](0x194);}return _0x58d506;};}function handleError(_0x2b80a1,_0x5d7423){_0x5d7423=_0x5d7423||0x1f4;return function(_0x1a1c55){logger[_0x98f5('0x26')](_0x1a1c55[_0x98f5('0x27')]);if(_0x1a1c55[_0x98f5('0x28')]){delete _0x1a1c55[_0x98f5('0x28')];}_0x2b80a1[_0x98f5('0x19')](_0x5d7423)[_0x98f5('0x29')](_0x1a1c55);};}exports[_0x98f5('0x2a')]=function(_0x576c4b,_0x4c10b8){var _0x428c85={},_0x71661e={},_0x18bb29={'count':0x0,'rows':[]};var _0x209d15=_[_0x98f5('0x2b')](db[_0x98f5('0x2c')]['rawAttributes'],function(_0x29e1f5){return{'name':_0x29e1f5[_0x98f5('0x2d')],'type':_0x29e1f5[_0x98f5('0x2e')][_0x98f5('0x2f')]};});_0x71661e[_0x98f5('0x30')]=_[_0x98f5('0x2b')](_0x209d15,'name');_0x71661e[_0x98f5('0x31')]=_[_0x98f5('0x32')](_0x576c4b[_0x98f5('0x31')]);_0x71661e[_0x98f5('0x33')]=_['intersection'](_0x71661e[_0x98f5('0x30')],_0x71661e[_0x98f5('0x31')]);_0x428c85[_0x98f5('0x34')]=_[_0x98f5('0x35')](_0x71661e[_0x98f5('0x30')],qs[_0x98f5('0x36')](_0x576c4b[_0x98f5('0x31')][_0x98f5('0x36')]));_0x428c85[_0x98f5('0x34')]=_0x428c85[_0x98f5('0x34')][_0x98f5('0x37')]?_0x428c85[_0x98f5('0x34')]:_0x71661e[_0x98f5('0x30')];if(!_0x576c4b[_0x98f5('0x31')][_0x98f5('0x38')](_0x98f5('0x39'))){_0x428c85[_0x98f5('0x1c')]=qs[_0x98f5('0x1c')](_0x576c4b[_0x98f5('0x31')][_0x98f5('0x1c')]);_0x428c85['offset']=qs[_0x98f5('0x1b')](_0x576c4b['query']['offset']);}_0x428c85[_0x98f5('0x3a')]=qs[_0x98f5('0x3b')](_0x576c4b[_0x98f5('0x31')][_0x98f5('0x3b')]);_0x428c85['where']=qs[_0x98f5('0x33')](_[_0x98f5('0x3c')](_0x576c4b[_0x98f5('0x31')],_0x71661e['filters']),_0x209d15);if(_0x576c4b[_0x98f5('0x31')][_0x98f5('0x3d')]){_0x428c85['where']=_[_0x98f5('0x3e')](_0x428c85[_0x98f5('0x3f')],{'$or':_[_0x98f5('0x2b')](_0x209d15,function(_0x580f19){if(_0x580f19[_0x98f5('0x2e')]!==_0x98f5('0x40')){var _0x19f045={};_0x19f045[_0x580f19[_0x98f5('0x28')]]={'$like':'%'+_0x576c4b[_0x98f5('0x31')]['filter']+'%'};return _0x19f045;}})});}_0x428c85=_['merge']({},_0x428c85,_0x576c4b[_0x98f5('0x41')]);var _0x14faf2={'where':_0x428c85[_0x98f5('0x3f')]};return db[_0x98f5('0x2c')][_0x98f5('0x1e')](_0x14faf2)[_0x98f5('0x23')](function(_0x58064e){_0x18bb29['count']=_0x58064e;if(_0x576c4b[_0x98f5('0x31')][_0x98f5('0x42')]){_0x428c85[_0x98f5('0x43')]=[{'all':!![]}];}return db[_0x98f5('0x2c')]['findAll'](_0x428c85);})['then'](function(_0x2dafcd){_0x18bb29[_0x98f5('0x44')]=_0x2dafcd;return _0x18bb29;})[_0x98f5('0x23')](respondWithFilteredResult(_0x4c10b8,_0x428c85))[_0x98f5('0x45')](handleError(_0x4c10b8,null));};exports['show']=function(_0x51ae92,_0x3db067){var _0x3a191f={'raw':!![],'where':{'id':_0x51ae92['params']['id']}},_0x372c33={};_0x372c33[_0x98f5('0x30')]=_['keys'](db[_0x98f5('0x2c')]['rawAttributes']);_0x372c33[_0x98f5('0x31')]=_[_0x98f5('0x32')](_0x51ae92[_0x98f5('0x31')]);_0x372c33['filters']=_[_0x98f5('0x35')](_0x372c33[_0x98f5('0x30')],_0x372c33['query']);_0x3a191f[_0x98f5('0x34')]=_[_0x98f5('0x35')](_0x372c33['model'],qs[_0x98f5('0x36')](_0x51ae92['query'][_0x98f5('0x36')]));_0x3a191f[_0x98f5('0x34')]=_0x3a191f['attributes']['length']?_0x3a191f['attributes']:_0x372c33['model'];if(_0x51ae92[_0x98f5('0x31')]['includeAll']){_0x3a191f[_0x98f5('0x43')]=[{'all':!![]}];}_0x3a191f=_[_0x98f5('0x3e')]({},_0x3a191f,_0x51ae92[_0x98f5('0x41')]);return db[_0x98f5('0x2c')][_0x98f5('0x46')](_0x3a191f)[_0x98f5('0x23')](handleEntityNotFound(_0x3db067,null))['then'](respondWithResult(_0x3db067,null))[_0x98f5('0x45')](handleError(_0x3db067,null));};exports[_0x98f5('0x47')]=function(_0x4b3fa8,_0x2c3cef){return db[_0x98f5('0x2c')][_0x98f5('0x47')](_0x4b3fa8['body'],{})[_0x98f5('0x23')](respondWithResult(_0x2c3cef,0xc9))[_0x98f5('0x45')](handleError(_0x2c3cef,null));};exports[_0x98f5('0x48')]=function(_0x1d4b3b,_0x4a0cda){if(_0x1d4b3b[_0x98f5('0x49')]['id']){delete _0x1d4b3b[_0x98f5('0x49')]['id'];}return db[_0x98f5('0x2c')][_0x98f5('0x46')]({'where':{'id':_0x1d4b3b[_0x98f5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4a0cda,null))[_0x98f5('0x23')](saveUpdates(_0x1d4b3b[_0x98f5('0x49')],null))['then'](respondWithResult(_0x4a0cda,null))[_0x98f5('0x45')](handleError(_0x4a0cda,null));};exports['destroy']=function(_0x27ed57,_0x4cb157){return db[_0x98f5('0x2c')][_0x98f5('0x46')]({'where':{'id':_0x27ed57[_0x98f5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4cb157,null))[_0x98f5('0x23')](removeEntity(_0x4cb157,null))[_0x98f5('0x45')](handleError(_0x4cb157,null));};exports[_0x98f5('0x4b')]=function(_0x2953e3,_0xde3d2d){return db[_0x98f5('0x2c')][_0x98f5('0x4b')]()[_0x98f5('0x23')](respondWithResult(_0xde3d2d,null))[_0x98f5('0x45')](handleError(_0xde3d2d,null));}; \ No newline at end of file +var _0x5b12=['options','includeAll','include','findAll','then','show','params','rawAttributes','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','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','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','Content-Range','apply','reject','update','destroy','error','name','index','map','WhatsappQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x50ed5a,_0x2f7a2d){var _0x166b26=function(_0x272a16){while(--_0x272a16){_0x50ed5a['push'](_0x50ed5a['shift']());}};_0x166b26(++_0x2f7a2d);}(_0x5b12,0xa3));var _0x25b1=function(_0x29103b,_0x4979c4){_0x29103b=_0x29103b-0x0;var _0x4700ec=_0x5b12[_0x29103b];return _0x4700ec;};'use strict';var emlformat=require(_0x25b1('0x0'));var rimraf=require(_0x25b1('0x1'));var zipdir=require(_0x25b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25b1('0x3'));var moment=require('moment');var BPromise=require(_0x25b1('0x4'));var Mustache=require(_0x25b1('0x5'));var util=require('util');var path=require(_0x25b1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x25b1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');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('0xc'));var querystring=require(_0x25b1('0xd'));var Papa=require(_0x25b1('0xe'));var Redis=require(_0x25b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b1('0x10'));var as=require(_0x25b1('0x11'));var hardwareService=require(_0x25b1('0x12'));var logger=require(_0x25b1('0x13'))(_0x25b1('0x14'));var utils=require(_0x25b1('0x15'));var config=require(_0x25b1('0x16'));var licenseUtil=require(_0x25b1('0x17'));var db=require(_0x25b1('0x18'))['db'];function respondWithStatusCode(_0x459070,_0xbdd348){_0xbdd348=_0xbdd348||0xcc;return function(_0x1c5421){if(_0x1c5421){return _0x459070[_0x25b1('0x19')](_0xbdd348);}return _0x459070[_0x25b1('0x1a')](_0xbdd348)[_0x25b1('0x1b')]();};}function respondWithResult(_0x76b5c4,_0x4ee40c){_0x4ee40c=_0x4ee40c||0xc8;return function(_0x2c337a){if(_0x2c337a){return _0x76b5c4[_0x25b1('0x1a')](_0x4ee40c)['json'](_0x2c337a);}};}function respondWithFilteredResult(_0xb5b9cf,_0x4bb1bb){return function(_0xe32e02){if(_0xe32e02){var _0x4a5a58=typeof _0x4bb1bb['offset']===_0x25b1('0x1c')&&typeof _0x4bb1bb['limit']===_0x25b1('0x1c');var _0x2ca567=_0xe32e02[_0x25b1('0x1d')];var _0x27ccc9=_0x4a5a58?0x0:_0x4bb1bb[_0x25b1('0x1e')];var _0x2a7d14=_0x4a5a58?_0xe32e02[_0x25b1('0x1d')]:_0x4bb1bb[_0x25b1('0x1e')]+_0x4bb1bb['limit'];var _0x4ecff1;if(_0x2a7d14>=_0x2ca567){_0x2a7d14=_0x2ca567;_0x4ecff1=0xc8;}else{_0x4ecff1=0xce;}_0xb5b9cf[_0x25b1('0x1a')](_0x4ecff1);return _0xb5b9cf['set'](_0x25b1('0x1f'),_0x27ccc9+'-'+_0x2a7d14+'/'+_0x2ca567)['json'](_0xe32e02);}return null;};}function patchUpdates(_0x3bfd7d){return function(_0x59aa37){try{jsonpatch[_0x25b1('0x20')](_0x59aa37,_0x3bfd7d,!![]);}catch(_0x529310){return BPromise[_0x25b1('0x21')](_0x529310);}return _0x59aa37['save']();};}function saveUpdates(_0x4e3f48,_0x565cfd){return function(_0x3bca9f){if(_0x3bca9f){return _0x3bca9f[_0x25b1('0x22')](_0x4e3f48)['then'](function(_0x19bab8){return _0x19bab8;});}return null;};}function removeEntity(_0x26b555,_0x1e5915){return function(_0x246acd){if(_0x246acd){return _0x246acd[_0x25b1('0x23')]()['then'](function(){_0x26b555[_0x25b1('0x1a')](0xcc)[_0x25b1('0x1b')]();});}};}function handleEntityNotFound(_0xd22469,_0x282187){return function(_0x1f37ed){if(!_0x1f37ed){_0xd22469[_0x25b1('0x19')](0x194);}return _0x1f37ed;};}function handleError(_0x5d9ed7,_0x3c05c6){_0x3c05c6=_0x3c05c6||0x1f4;return function(_0x27dd68){logger[_0x25b1('0x24')](_0x27dd68['stack']);if(_0x27dd68[_0x25b1('0x25')]){delete _0x27dd68[_0x25b1('0x25')];}_0x5d9ed7[_0x25b1('0x1a')](_0x3c05c6)['send'](_0x27dd68);};}exports[_0x25b1('0x26')]=function(_0x54ce2d,_0x19ecd1){var _0x3febb8={},_0x3a4475={},_0x293413={'count':0x0,'rows':[]};var _0x362118=_[_0x25b1('0x27')](db[_0x25b1('0x28')]['rawAttributes'],function(_0x30d455){return{'name':_0x30d455[_0x25b1('0x29')],'type':_0x30d455[_0x25b1('0x2a')][_0x25b1('0x2b')]};});_0x3a4475[_0x25b1('0x2c')]=_['map'](_0x362118,_0x25b1('0x25'));_0x3a4475[_0x25b1('0x2d')]=_[_0x25b1('0x2e')](_0x54ce2d[_0x25b1('0x2d')]);_0x3a4475[_0x25b1('0x2f')]=_['intersection'](_0x3a4475['model'],_0x3a4475[_0x25b1('0x2d')]);_0x3febb8['attributes']=_[_0x25b1('0x30')](_0x3a4475[_0x25b1('0x2c')],qs[_0x25b1('0x31')](_0x54ce2d['query']['fields']));_0x3febb8[_0x25b1('0x32')]=_0x3febb8[_0x25b1('0x32')][_0x25b1('0x33')]?_0x3febb8['attributes']:_0x3a4475[_0x25b1('0x2c')];if(!_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x34')](_0x25b1('0x35'))){_0x3febb8['limit']=qs[_0x25b1('0x36')](_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x36')]);_0x3febb8['offset']=qs['offset'](_0x54ce2d[_0x25b1('0x2d')]['offset']);}_0x3febb8[_0x25b1('0x37')]=qs[_0x25b1('0x38')](_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x38')]);_0x3febb8[_0x25b1('0x39')]=qs[_0x25b1('0x2f')](_[_0x25b1('0x3a')](_0x54ce2d[_0x25b1('0x2d')],_0x3a4475[_0x25b1('0x2f')]),_0x362118);if(_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3b')]){_0x3febb8[_0x25b1('0x39')]=_[_0x25b1('0x3c')](_0x3febb8[_0x25b1('0x39')],{'$or':_[_0x25b1('0x27')](_0x362118,function(_0x4837d5){if(_0x4837d5[_0x25b1('0x2a')]!==_0x25b1('0x3d')){var _0x53423d={};_0x53423d[_0x4837d5[_0x25b1('0x25')]]={'$like':'%'+_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3b')]+'%'};return _0x53423d;}})});}_0x3febb8=_[_0x25b1('0x3c')]({},_0x3febb8,_0x54ce2d[_0x25b1('0x3e')]);var _0x5bdefd={'where':_0x3febb8[_0x25b1('0x39')]};return db['WhatsappQueueReport'][_0x25b1('0x1d')](_0x5bdefd)['then'](function(_0x2e8747){_0x293413[_0x25b1('0x1d')]=_0x2e8747;if(_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3f')]){_0x3febb8[_0x25b1('0x40')]=[{'all':!![]}];}return db[_0x25b1('0x28')][_0x25b1('0x41')](_0x3febb8);})[_0x25b1('0x42')](function(_0x3f9754){_0x293413['rows']=_0x3f9754;return _0x293413;})[_0x25b1('0x42')](respondWithFilteredResult(_0x19ecd1,_0x3febb8))['catch'](handleError(_0x19ecd1,null));};exports[_0x25b1('0x43')]=function(_0x2f56ac,_0x4d4e32){var _0x52d3f8={'raw':!![],'where':{'id':_0x2f56ac[_0x25b1('0x44')]['id']}},_0x39b4c7={};_0x39b4c7[_0x25b1('0x2c')]=_[_0x25b1('0x2e')](db[_0x25b1('0x28')][_0x25b1('0x45')]);_0x39b4c7[_0x25b1('0x2d')]=_[_0x25b1('0x2e')](_0x2f56ac[_0x25b1('0x2d')]);_0x39b4c7[_0x25b1('0x2f')]=_[_0x25b1('0x30')](_0x39b4c7[_0x25b1('0x2c')],_0x39b4c7[_0x25b1('0x2d')]);_0x52d3f8[_0x25b1('0x32')]=_[_0x25b1('0x30')](_0x39b4c7[_0x25b1('0x2c')],qs[_0x25b1('0x31')](_0x2f56ac['query']['fields']));_0x52d3f8['attributes']=_0x52d3f8[_0x25b1('0x32')]['length']?_0x52d3f8[_0x25b1('0x32')]:_0x39b4c7['model'];if(_0x2f56ac[_0x25b1('0x2d')][_0x25b1('0x3f')]){_0x52d3f8[_0x25b1('0x40')]=[{'all':!![]}];}_0x52d3f8=_[_0x25b1('0x3c')]({},_0x52d3f8,_0x2f56ac[_0x25b1('0x3e')]);return db[_0x25b1('0x28')]['find'](_0x52d3f8)[_0x25b1('0x42')](handleEntityNotFound(_0x4d4e32,null))[_0x25b1('0x42')](respondWithResult(_0x4d4e32,null))[_0x25b1('0x46')](handleError(_0x4d4e32,null));};exports[_0x25b1('0x47')]=function(_0x58ae67,_0x489f73){return db[_0x25b1('0x28')][_0x25b1('0x47')](_0x58ae67['body'],{})[_0x25b1('0x42')](respondWithResult(_0x489f73,0xc9))['catch'](handleError(_0x489f73,null));};exports[_0x25b1('0x22')]=function(_0x4b6181,_0x543f9b){if(_0x4b6181[_0x25b1('0x48')]['id']){delete _0x4b6181[_0x25b1('0x48')]['id'];}return db[_0x25b1('0x28')][_0x25b1('0x49')]({'where':{'id':_0x4b6181['params']['id']}})[_0x25b1('0x42')](handleEntityNotFound(_0x543f9b,null))['then'](saveUpdates(_0x4b6181[_0x25b1('0x48')],null))['then'](respondWithResult(_0x543f9b,null))[_0x25b1('0x46')](handleError(_0x543f9b,null));};exports[_0x25b1('0x23')]=function(_0x1fcc79,_0x4fb92e){return db[_0x25b1('0x28')][_0x25b1('0x49')]({'where':{'id':_0x1fcc79[_0x25b1('0x44')]['id']}})[_0x25b1('0x42')](handleEntityNotFound(_0x4fb92e,null))[_0x25b1('0x42')](removeEntity(_0x4fb92e,null))[_0x25b1('0x46')](handleError(_0x4fb92e,null));};exports['describe']=function(_0x134c64,_0x133f50){return db[_0x25b1('0x28')][_0x25b1('0x4a')]()[_0x25b1('0x42')](respondWithResult(_0x133f50,null))[_0x25b1('0x46')](handleError(_0x133f50,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 67130c3..a56f5fc 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 _0xb8ba=['bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x324277,_0xa7681f){var _0x42965e=function(_0x5689e6){while(--_0x5689e6){_0x324277['push'](_0x324277['shift']());}};_0x42965e(++_0xa7681f);}(_0xb8ba,0x1c3));var _0xab8b=function(_0xeed2c4,_0x48a15e){_0xeed2c4=_0xeed2c4-0x0;var _0x3e0539=_0xb8ba[_0xeed2c4];return _0x3e0539;};'use strict';var _=require(_0xab8b('0x0'));var util=require(_0xab8b('0x1'));var logger=require(_0xab8b('0x2'))('api');var moment=require(_0xab8b('0x3'));var BPromise=require(_0xab8b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab8b('0x5'));var rimraf=require(_0xab8b('0x6'));var config=require(_0xab8b('0x7'));var attributes=require(_0xab8b('0x8'));module[_0xab8b('0x9')]=function(_0x41aee0,_0x1cbc0f){return _0x41aee0[_0xab8b('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0xab8b('0xb'),'paranoid':![],'indexes':[{'name':_0xab8b('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4208=['../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2bc612,_0x2052c1){var _0x1a5b3c=function(_0x504d57){while(--_0x504d57){_0x2bc612['push'](_0x2bc612['shift']());}};_0x1a5b3c(++_0x2052c1);}(_0x4208,0x1a6));var _0x8420=function(_0x2c94d4,_0x43af5a){_0x2c94d4=_0x2c94d4-0x0;var _0x138a94=_0x4208[_0x2c94d4];return _0x138a94;};'use strict';var _=require(_0x8420('0x0'));var util=require('util');var logger=require(_0x8420('0x1'))('api');var moment=require(_0x8420('0x2'));var BPromise=require(_0x8420('0x3'));var rp=require(_0x8420('0x4'));var fs=require('fs');var path=require(_0x8420('0x5'));var rimraf=require(_0x8420('0x6'));var config=require(_0x8420('0x7'));var attributes=require(_0x8420('0x8'));module[_0x8420('0x9')]=function(_0x3c4abc,_0x2fb56b){return _0x3c4abc[_0x8420('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0x8420('0xb'),'paranoid':![],'indexes':[{'name':_0x8420('0xc'),'fields':[_0x8420('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 85d809a..0ba42d0 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 _0x8cb8=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','debug','UpdateWhatsappQueueReport','update','where','attributes','limit','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4e19aa,_0xabe3ad){var _0x5732b7=function(_0x54e05a){while(--_0x54e05a){_0x4e19aa['push'](_0x4e19aa['shift']());}};_0x5732b7(++_0xabe3ad);}(_0x8cb8,0x187));var _0x88cb=function(_0x44039a,_0x2ac8a8){_0x44039a=_0x44039a-0x0;var _0x525de5=_0x8cb8[_0x44039a];return _0x525de5;};'use strict';var _=require(_0x88cb('0x0'));var util=require(_0x88cb('0x1'));var moment=require(_0x88cb('0x2'));var BPromise=require(_0x88cb('0x3'));var rs=require(_0x88cb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x88cb('0x5'));var logger=require(_0x88cb('0x6'))(_0x88cb('0x7'));var config=require(_0x88cb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x88cb('0x9')][_0x88cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x138c86,_0x269dea,_0x5c1521){return new BPromise(function(_0x2c7d53,_0xa93e33){return client[_0x88cb('0xb')](_0x138c86,_0x5c1521)[_0x88cb('0xc')](function(_0x4c7c03){logger[_0x88cb('0xd')](_0x88cb('0xe'),_0x269dea,_0x88cb('0xf'));logger['debug'](_0x88cb('0x10'),_0x269dea,_0x88cb('0xf'),JSON[_0x88cb('0x11')](_0x4c7c03));if(_0x4c7c03['error']){if(_0x4c7c03[_0x88cb('0x12')]['code']===0x1f4){logger[_0x88cb('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x269dea,_0x4c7c03[_0x88cb('0x12')][_0x88cb('0x13')]);return _0xa93e33(_0x4c7c03[_0x88cb('0x12')][_0x88cb('0x13')]);}logger[_0x88cb('0x12')](_0x88cb('0xe'),_0x269dea,_0x4c7c03['error']['message']);return _0x2c7d53(_0x4c7c03['error']['message']);}else{logger[_0x88cb('0xd')](_0x88cb('0xe'),_0x269dea,'request\x20sent');_0x2c7d53(_0x4c7c03[_0x88cb('0x14')][_0x88cb('0x13')]);}})['catch'](function(_0x33506f){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x269dea,_0x33506f);_0xa93e33(_0x33506f);});});}exports[_0x88cb('0x15')]=function(_0x2402d3){var _0xa8327=this;return new Promise(function(_0x23c7c9,_0x5d31d0){return db[_0x88cb('0x16')][_0x88cb('0x17')](_0x2402d3[_0x88cb('0x18')],{'raw':_0x2402d3['options']?_0x2402d3[_0x88cb('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x88cb('0xc')](function(_0x68acef){logger['info']('CreateWhatsappQueueReport',_0x2402d3);logger[_0x88cb('0x1a')](_0x88cb('0x15'),_0x2402d3,JSON[_0x88cb('0x11')](_0x68acef));_0x23c7c9(_0x68acef);})['catch'](function(_0x5c66d1){logger[_0x88cb('0x12')](_0x88cb('0x15'),_0x5c66d1['message'],_0x2402d3);_0x5d31d0(_0xa8327[_0x88cb('0x12')](0x1f4,_0x5c66d1[_0x88cb('0x13')]));});});};exports[_0x88cb('0x1b')]=function(_0x3af519){var _0x5822ad=this;return new Promise(function(_0x52e8af,_0x5c5a99){return db[_0x88cb('0x16')][_0x88cb('0x1c')](_0x3af519[_0x88cb('0x18')],{'raw':_0x3af519[_0x88cb('0x19')]?_0x3af519[_0x88cb('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3af519[_0x88cb('0x19')]?_0x3af519[_0x88cb('0x19')][_0x88cb('0x1d')]||null:null,'attributes':_0x3af519['options']?_0x3af519[_0x88cb('0x19')][_0x88cb('0x1e')]||null:null,'limit':_0x3af519[_0x88cb('0x19')]?_0x3af519[_0x88cb('0x19')][_0x88cb('0x1f')]||null:null})[_0x88cb('0xc')](function(_0xb9c868){logger[_0x88cb('0xd')]('UpdateWhatsappQueueReport',_0x3af519);logger[_0x88cb('0x1a')](_0x88cb('0x1b'),_0x3af519,JSON[_0x88cb('0x11')](_0xb9c868));_0x52e8af(_0xb9c868);})[_0x88cb('0x20')](function(_0x40e9ca){logger[_0x88cb('0x12')](_0x88cb('0x1b'),_0x40e9ca['message'],_0x3af519);_0x5c5a99(_0x5822ad[_0x88cb('0x12')](0x1f4,_0x40e9ca[_0x88cb('0x13')]));});});}; \ No newline at end of file +var _0x9637=['catch','WhatsappQueueReport','update','attributes','limit','UpdateWhatsappQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateWhatsappQueueReport','create','body','options','then'];(function(_0x11d548,_0x1190a4){var _0x25523f=function(_0xa0dc59){while(--_0xa0dc59){_0x11d548['push'](_0x11d548['shift']());}};_0x25523f(++_0x1190a4);}(_0x9637,0x166));var _0x7963=function(_0x2b87ff,_0x2e6520){_0x2b87ff=_0x2b87ff-0x0;var _0x13ea50=_0x9637[_0x2b87ff];return _0x13ea50;};'use strict';var _=require(_0x7963('0x0'));var util=require(_0x7963('0x1'));var moment=require('moment');var BPromise=require(_0x7963('0x2'));var rs=require(_0x7963('0x3'));var fs=require('fs');var Redis=require(_0x7963('0x4'));var db=require(_0x7963('0x5'))['db'];var utils=require(_0x7963('0x6'));var logger=require('../../config/logger')(_0x7963('0x7'));var config=require('../../config/environment');var jayson=require(_0x7963('0x8'));var client=jayson[_0x7963('0x9')][_0x7963('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xce32c4,_0x3a9e60,_0x189843){return new BPromise(function(_0xdc239b,_0x47fb6d){return client[_0x7963('0xb')](_0xce32c4,_0x189843)['then'](function(_0x2fd08e){logger[_0x7963('0xc')](_0x7963('0xd'),_0x3a9e60,_0x7963('0xe'));logger[_0x7963('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3a9e60,_0x7963('0xe'),JSON[_0x7963('0x10')](_0x2fd08e));if(_0x2fd08e[_0x7963('0x11')]){if(_0x2fd08e[_0x7963('0x11')][_0x7963('0x12')]===0x1f4){logger[_0x7963('0x11')](_0x7963('0xd'),_0x3a9e60,_0x2fd08e[_0x7963('0x11')]['message']);return _0x47fb6d(_0x2fd08e[_0x7963('0x11')][_0x7963('0x13')]);}logger['error'](_0x7963('0xd'),_0x3a9e60,_0x2fd08e[_0x7963('0x11')][_0x7963('0x13')]);return _0xdc239b(_0x2fd08e[_0x7963('0x11')][_0x7963('0x13')]);}else{logger[_0x7963('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3a9e60,_0x7963('0xe'));_0xdc239b(_0x2fd08e[_0x7963('0x14')][_0x7963('0x13')]);}})['catch'](function(_0x10e36a){logger['error'](_0x7963('0xd'),_0x3a9e60,_0x10e36a);_0x47fb6d(_0x10e36a);});});}exports[_0x7963('0x15')]=function(_0x3fd598){var _0x4d24b3=this;return new Promise(function(_0x2e638a,_0x2dbc8a){return db['WhatsappQueueReport'][_0x7963('0x16')](_0x3fd598[_0x7963('0x17')],{'raw':_0x3fd598[_0x7963('0x18')]?_0x3fd598[_0x7963('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x7963('0x19')](function(_0x586de3){logger[_0x7963('0xc')](_0x7963('0x15'),_0x3fd598);logger[_0x7963('0xf')](_0x7963('0x15'),_0x3fd598,JSON['stringify'](_0x586de3));_0x2e638a(_0x586de3);})[_0x7963('0x1a')](function(_0x395826){logger[_0x7963('0x11')](_0x7963('0x15'),_0x395826['message'],_0x3fd598);_0x2dbc8a(_0x4d24b3[_0x7963('0x11')](0x1f4,_0x395826['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x2a1f12){var _0x5af13a=this;return new Promise(function(_0x253a7f,_0x4d684d){return db[_0x7963('0x1b')][_0x7963('0x1c')](_0x2a1f12[_0x7963('0x17')],{'raw':_0x2a1f12[_0x7963('0x18')]?_0x2a1f12[_0x7963('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a1f12[_0x7963('0x18')]?_0x2a1f12[_0x7963('0x18')]['where']||null:null,'attributes':_0x2a1f12[_0x7963('0x18')]?_0x2a1f12[_0x7963('0x18')][_0x7963('0x1d')]||null:null,'limit':_0x2a1f12[_0x7963('0x18')]?_0x2a1f12[_0x7963('0x18')][_0x7963('0x1e')]||null:null})[_0x7963('0x19')](function(_0x53b3b2){logger['info'](_0x7963('0x1f'),_0x2a1f12);logger['debug'](_0x7963('0x1f'),_0x2a1f12,JSON['stringify'](_0x53b3b2));_0x253a7f(_0x53b3b2);})[_0x7963('0x1a')](function(_0x242fe7){logger['error'](_0x7963('0x1f'),_0x242fe7[_0x7963('0x13')],_0x2a1f12);_0x4d684d(_0x5af13a[_0x7963('0x11')](0x1f4,_0x242fe7[_0x7963('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index ead8d62..9406544 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 _0xc5f1=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer'];(function(_0x5f49c0,_0x27a1b4){var _0x5ab653=function(_0x4de962){while(--_0x4de962){_0x5f49c0['push'](_0x5f49c0['shift']());}};_0x5ab653(++_0x27a1b4);}(_0xc5f1,0x186));var _0x1c5f=function(_0x496fdc,_0x2ff401){_0x496fdc=_0x496fdc-0x0;var _0x1a5877=_0xc5f1[_0x496fdc];return _0x1a5877;};'use strict';var multer=require(_0x1c5f('0x0'));var util=require('util');var path=require(_0x1c5f('0x1'));var timeout=require(_0x1c5f('0x2'));var express=require(_0x1c5f('0x3'));var router=express[_0x1c5f('0x4')]();var fs_extra=require(_0x1c5f('0x5'));var auth=require(_0x1c5f('0x6'));var interaction=require(_0x1c5f('0x7'));var config=require(_0x1c5f('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0x1c5f('0x9')]('/',auth[_0x1c5f('0xa')](),controller[_0x1c5f('0xb')]);router[_0x1c5f('0x9')](_0x1c5f('0xc'),auth['isAuthenticated'](),controller[_0x1c5f('0xd')]);router[_0x1c5f('0x9')]('/:id',auth[_0x1c5f('0xa')](),controller[_0x1c5f('0xe')]);router[_0x1c5f('0xf')]('/',auth[_0x1c5f('0xa')](),controller[_0x1c5f('0x10')]);router[_0x1c5f('0x11')]('/:id',auth[_0x1c5f('0xa')](),controller[_0x1c5f('0x12')]);router[_0x1c5f('0x13')](_0x1c5f('0x14'),auth[_0x1c5f('0xa')](),controller[_0x1c5f('0x15')]);module[_0x1c5f('0x16')]=router; \ No newline at end of file +var _0x2d35=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util'];(function(_0x23ca4d,_0x5c2a32){var _0x435432=function(_0xe1a5e5){while(--_0xe1a5e5){_0x23ca4d['push'](_0x23ca4d['shift']());}};_0x435432(++_0x5c2a32);}(_0x2d35,0xd0));var _0x52d3=function(_0x99c38c,_0x5fd3d2){_0x99c38c=_0x99c38c-0x0;var _0x2f1f81=_0x2d35[_0x99c38c];return _0x2f1f81;};'use strict';var multer=require(_0x52d3('0x0'));var util=require(_0x52d3('0x1'));var path=require(_0x52d3('0x2'));var timeout=require(_0x52d3('0x3'));var express=require(_0x52d3('0x4'));var router=express[_0x52d3('0x5')]();var fs_extra=require(_0x52d3('0x6'));var auth=require(_0x52d3('0x7'));var interaction=require(_0x52d3('0x8'));var config=require(_0x52d3('0x9'));var controller=require(_0x52d3('0xa'));router[_0x52d3('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x52d3('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x52d3('0xc'),auth[_0x52d3('0xd')](),controller[_0x52d3('0xe')]);router[_0x52d3('0xf')]('/',auth['isAuthenticated'](),controller[_0x52d3('0x10')]);router['put'](_0x52d3('0xc'),auth[_0x52d3('0xd')](),controller[_0x52d3('0x11')]);router[_0x52d3('0x12')](_0x52d3('0xc'),auth[_0x52d3('0xd')](),controller[_0x52d3('0x13')]);module[_0x52d3('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 86d50c1..5a345c3 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 _0xf3e2=['sequelize','exports','STRING','ENUM','account','agent','queue','DATE'];(function(_0x30182f,_0x30ce41){var _0x5207db=function(_0x50a417){while(--_0x50a417){_0x30182f['push'](_0x30182f['shift']());}};_0x5207db(++_0x30ce41);}(_0xf3e2,0x168));var _0x2f3e=function(_0x2ab365,_0xa3812e){_0x2ab365=_0x2ab365-0x0;var _0x49fef3=_0xf3e2[_0x2ab365];return _0x49fef3;};'use strict';var Sequelize=require(_0x2f3e('0x0'));module[_0x2f3e('0x1')]={'uniqueid':{'type':Sequelize[_0x2f3e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2f3e('0x3')](_0x2f3e('0x4'),_0x2f3e('0x5'),_0x2f3e('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x2f3e('0x7')]}}; \ No newline at end of file +var _0xa32b=['STRING','agent','queue','DATE','sequelize'];(function(_0x2068ee,_0x42966a){var _0xa36814=function(_0x35dba2){while(--_0x35dba2){_0x2068ee['push'](_0x2068ee['shift']());}};_0xa36814(++_0x42966a);}(_0xa32b,0x68));var _0xba32=function(_0x9861ff,_0x41fb17){_0x9861ff=_0x9861ff-0x0;var _0x48852b=_0xa32b[_0x9861ff];return _0x48852b;};'use strict';var Sequelize=require(_0xba32('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xba32('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xba32('0x2'),_0xba32('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xba32('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index f9b1958..0a4495c 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 _0x8cce=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','set','Content-Range','reject','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','include','show','params','includeAll','find','create','body','catch','describe','rimraf','request-promise'];(function(_0x146f56,_0x33cfbf){var _0x3367e3=function(_0x57f589){while(--_0x57f589){_0x146f56['push'](_0x146f56['shift']());}};_0x3367e3(++_0x33cfbf);}(_0x8cce,0xd6));var _0xe8cc=function(_0x133457,_0x45ac92){_0x133457=_0x133457-0x0;var _0x573d4b=_0x8cce[_0x133457];return _0x573d4b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe8cc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe8cc('0x1'));var moment=require(_0xe8cc('0x2'));var BPromise=require(_0xe8cc('0x3'));var Mustache=require(_0xe8cc('0x4'));var util=require(_0xe8cc('0x5'));var path=require(_0xe8cc('0x6'));var sox=require(_0xe8cc('0x7'));var csv=require(_0xe8cc('0x8'));var ejs=require(_0xe8cc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe8cc('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe8cc('0xb'));var toCsv=require(_0xe8cc('0x8'));var querystring=require('querystring');var Papa=require(_0xe8cc('0xc'));var Redis=require('ioredis');var authService=require(_0xe8cc('0xd'));var qs=require(_0xe8cc('0xe'));var as=require(_0xe8cc('0xf'));var hardwareService=require(_0xe8cc('0x10'));var logger=require(_0xe8cc('0x11'))(_0xe8cc('0x12'));var utils=require('../../config/utils');var config=require(_0xe8cc('0x13'));var licenseUtil=require(_0xe8cc('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ca304,_0x3a047f){_0x3a047f=_0x3a047f||0xcc;return function(_0x5d6c68){if(_0x5d6c68){return _0x4ca304['sendStatus'](_0x3a047f);}return _0x4ca304[_0xe8cc('0x15')](_0x3a047f)['end']();};}function respondWithResult(_0x2bafa2,_0x3e79dc){_0x3e79dc=_0x3e79dc||0xc8;return function(_0x141b81){if(_0x141b81){return _0x2bafa2['status'](_0x3e79dc)[_0xe8cc('0x16')](_0x141b81);}};}function respondWithFilteredResult(_0x3c4a50,_0x3728a2){return function(_0x19e100){if(_0x19e100){var _0xe2003b=typeof _0x3728a2[_0xe8cc('0x17')]===_0xe8cc('0x18')&&typeof _0x3728a2[_0xe8cc('0x19')]===_0xe8cc('0x18');var _0x9dd2ae=_0x19e100['count'];var _0x53656f=_0xe2003b?0x0:_0x3728a2[_0xe8cc('0x17')];var _0xb703cc=_0xe2003b?_0x19e100['count']:_0x3728a2['offset']+_0x3728a2[_0xe8cc('0x19')];var _0xcd967b;if(_0xb703cc>=_0x9dd2ae){_0xb703cc=_0x9dd2ae;_0xcd967b=0xc8;}else{_0xcd967b=0xce;}_0x3c4a50[_0xe8cc('0x15')](_0xcd967b);return _0x3c4a50[_0xe8cc('0x1a')](_0xe8cc('0x1b'),_0x53656f+'-'+_0xb703cc+'/'+_0x9dd2ae)[_0xe8cc('0x16')](_0x19e100);}return null;};}function patchUpdates(_0x445f4f){return function(_0x3cece3){try{jsonpatch['apply'](_0x3cece3,_0x445f4f,!![]);}catch(_0x5a15c4){return BPromise[_0xe8cc('0x1c')](_0x5a15c4);}return _0x3cece3['save']();};}function saveUpdates(_0x528c4a,_0x342829){return function(_0xf79d53){if(_0xf79d53){return _0xf79d53[_0xe8cc('0x1d')](_0x528c4a)['then'](function(_0x121444){return _0x121444;});}return null;};}function removeEntity(_0x370172,_0x2360ce){return function(_0xf27cbc){if(_0xf27cbc){return _0xf27cbc[_0xe8cc('0x1e')]()[_0xe8cc('0x1f')](function(){_0x370172[_0xe8cc('0x15')](0xcc)[_0xe8cc('0x20')]();});}};}function handleEntityNotFound(_0x58cd29,_0x2741ff){return function(_0x34d6e0){if(!_0x34d6e0){_0x58cd29[_0xe8cc('0x21')](0x194);}return _0x34d6e0;};}function handleError(_0x437e2f,_0x1df19b){_0x1df19b=_0x1df19b||0x1f4;return function(_0x2709b4){logger[_0xe8cc('0x22')](_0x2709b4[_0xe8cc('0x23')]);if(_0x2709b4[_0xe8cc('0x24')]){delete _0x2709b4[_0xe8cc('0x24')];}_0x437e2f[_0xe8cc('0x15')](_0x1df19b)[_0xe8cc('0x25')](_0x2709b4);};}exports[_0xe8cc('0x26')]=function(_0x35029c,_0x4a1bc9){var _0x22046f={},_0x278b5a={},_0x4bed04={'count':0x0,'rows':[]};var _0x31b070=_[_0xe8cc('0x27')](db[_0xe8cc('0x28')][_0xe8cc('0x29')],function(_0x2df31){return{'name':_0x2df31[_0xe8cc('0x2a')],'type':_0x2df31[_0xe8cc('0x2b')][_0xe8cc('0x2c')]};});_0x278b5a[_0xe8cc('0x2d')]=_['map'](_0x31b070,_0xe8cc('0x24'));_0x278b5a[_0xe8cc('0x2e')]=_[_0xe8cc('0x2f')](_0x35029c[_0xe8cc('0x2e')]);_0x278b5a[_0xe8cc('0x30')]=_[_0xe8cc('0x31')](_0x278b5a[_0xe8cc('0x2d')],_0x278b5a[_0xe8cc('0x2e')]);_0x22046f[_0xe8cc('0x32')]=_[_0xe8cc('0x31')](_0x278b5a[_0xe8cc('0x2d')],qs[_0xe8cc('0x33')](_0x35029c['query']['fields']));_0x22046f['attributes']=_0x22046f['attributes'][_0xe8cc('0x34')]?_0x22046f[_0xe8cc('0x32')]:_0x278b5a[_0xe8cc('0x2d')];if(!_0x35029c['query'][_0xe8cc('0x35')](_0xe8cc('0x36'))){_0x22046f[_0xe8cc('0x19')]=qs[_0xe8cc('0x19')](_0x35029c['query'][_0xe8cc('0x19')]);_0x22046f['offset']=qs[_0xe8cc('0x17')](_0x35029c[_0xe8cc('0x2e')]['offset']);}_0x22046f[_0xe8cc('0x37')]=qs[_0xe8cc('0x38')](_0x35029c[_0xe8cc('0x2e')]['sort']);_0x22046f[_0xe8cc('0x39')]=qs[_0xe8cc('0x30')](_['pick'](_0x35029c[_0xe8cc('0x2e')],_0x278b5a[_0xe8cc('0x30')]),_0x31b070);if(_0x35029c[_0xe8cc('0x2e')][_0xe8cc('0x3a')]){_0x22046f[_0xe8cc('0x39')]=_[_0xe8cc('0x3b')](_0x22046f[_0xe8cc('0x39')],{'$or':_[_0xe8cc('0x27')](_0x31b070,function(_0x205309){if(_0x205309[_0xe8cc('0x2b')]!==_0xe8cc('0x3c')){var _0x2c3110={};_0x2c3110[_0x205309[_0xe8cc('0x24')]]={'$like':'%'+_0x35029c[_0xe8cc('0x2e')][_0xe8cc('0x3a')]+'%'};return _0x2c3110;}})});}_0x22046f=_['merge']({},_0x22046f,_0x35029c[_0xe8cc('0x3d')]);var _0x51ea3d={'where':_0x22046f[_0xe8cc('0x39')]};return db[_0xe8cc('0x28')][_0xe8cc('0x3e')](_0x51ea3d)[_0xe8cc('0x1f')](function(_0x34f598){_0x4bed04['count']=_0x34f598;if(_0x35029c['query']['includeAll']){_0x22046f[_0xe8cc('0x3f')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x22046f);})['then'](function(_0xf1c50e){_0x4bed04['rows']=_0xf1c50e;return _0x4bed04;})['then'](respondWithFilteredResult(_0x4a1bc9,_0x22046f))['catch'](handleError(_0x4a1bc9,null));};exports[_0xe8cc('0x40')]=function(_0x2cddeb,_0x4c7a78){var _0x282239={'raw':!![],'where':{'id':_0x2cddeb[_0xe8cc('0x41')]['id']}},_0x36546c={};_0x36546c[_0xe8cc('0x2d')]=_[_0xe8cc('0x2f')](db['WhatsappTransferReport'][_0xe8cc('0x29')]);_0x36546c['query']=_[_0xe8cc('0x2f')](_0x2cddeb[_0xe8cc('0x2e')]);_0x36546c['filters']=_['intersection'](_0x36546c[_0xe8cc('0x2d')],_0x36546c[_0xe8cc('0x2e')]);_0x282239['attributes']=_[_0xe8cc('0x31')](_0x36546c['model'],qs[_0xe8cc('0x33')](_0x2cddeb[_0xe8cc('0x2e')][_0xe8cc('0x33')]));_0x282239[_0xe8cc('0x32')]=_0x282239['attributes'][_0xe8cc('0x34')]?_0x282239['attributes']:_0x36546c['model'];if(_0x2cddeb[_0xe8cc('0x2e')][_0xe8cc('0x42')]){_0x282239[_0xe8cc('0x3f')]=[{'all':!![]}];}_0x282239=_['merge']({},_0x282239,_0x2cddeb[_0xe8cc('0x3d')]);return db['WhatsappTransferReport'][_0xe8cc('0x43')](_0x282239)['then'](handleEntityNotFound(_0x4c7a78,null))[_0xe8cc('0x1f')](respondWithResult(_0x4c7a78,null))['catch'](handleError(_0x4c7a78,null));};exports[_0xe8cc('0x44')]=function(_0x325f69,_0x27d867){return db[_0xe8cc('0x28')][_0xe8cc('0x44')](_0x325f69[_0xe8cc('0x45')],{})['then'](respondWithResult(_0x27d867,0xc9))[_0xe8cc('0x46')](handleError(_0x27d867,null));};exports[_0xe8cc('0x1d')]=function(_0x171498,_0x3c1acd){if(_0x171498[_0xe8cc('0x45')]['id']){delete _0x171498['body']['id'];}return db[_0xe8cc('0x28')]['find']({'where':{'id':_0x171498[_0xe8cc('0x41')]['id']}})[_0xe8cc('0x1f')](handleEntityNotFound(_0x3c1acd,null))[_0xe8cc('0x1f')](saveUpdates(_0x171498['body'],null))[_0xe8cc('0x1f')](respondWithResult(_0x3c1acd,null))[_0xe8cc('0x46')](handleError(_0x3c1acd,null));};exports['destroy']=function(_0x52d9ea,_0x42bd62){return db[_0xe8cc('0x28')][_0xe8cc('0x43')]({'where':{'id':_0x52d9ea[_0xe8cc('0x41')]['id']}})[_0xe8cc('0x1f')](handleEntityNotFound(_0x42bd62,null))[_0xe8cc('0x1f')](removeEntity(_0x42bd62,null))['catch'](handleError(_0x42bd62,null));};exports[_0xe8cc('0x47')]=function(_0x479fe1,_0x9882dd){return db[_0xe8cc('0x28')][_0xe8cc('0x47')]()[_0xe8cc('0x1f')](respondWithResult(_0x9882dd,null))['catch'](handleError(_0x9882dd,null));}; \ No newline at end of file +var _0xa62c=['includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x31ad86,_0x2fce0e){var _0x5e3989=function(_0x5bc82c){while(--_0x5bc82c){_0x31ad86['push'](_0x31ad86['shift']());}};_0x5e3989(++_0x2fce0e);}(_0xa62c,0x186));var _0xca62=function(_0x26b622,_0x237e9e){_0x26b622=_0x26b622-0x0;var _0x58a028=_0xa62c[_0x26b622];return _0x58a028;};'use strict';var emlformat=require(_0xca62('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca62('0x1'));var jsonpatch=require(_0xca62('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xca62('0x3'));var Mustache=require(_0xca62('0x4'));var util=require(_0xca62('0x5'));var path=require(_0xca62('0x6'));var sox=require(_0xca62('0x7'));var csv=require(_0xca62('0x8'));var ejs=require(_0xca62('0x9'));var fs=require('fs');var fs_extra=require(_0xca62('0xa'));var _=require(_0xca62('0xb'));var squel=require(_0xca62('0xc'));var crypto=require(_0xca62('0xd'));var jsforce=require(_0xca62('0xe'));var deskjs=require(_0xca62('0xf'));var toCsv=require(_0xca62('0x8'));var querystring=require(_0xca62('0x10'));var Papa=require(_0xca62('0x11'));var Redis=require(_0xca62('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xca62('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xca62('0x14'))(_0xca62('0x15'));var utils=require(_0xca62('0x16'));var config=require(_0xca62('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xca62('0x18'))['db'];function respondWithStatusCode(_0x3b1270,_0x55f097){_0x55f097=_0x55f097||0xcc;return function(_0x2b9155){if(_0x2b9155){return _0x3b1270[_0xca62('0x19')](_0x55f097);}return _0x3b1270[_0xca62('0x1a')](_0x55f097)[_0xca62('0x1b')]();};}function respondWithResult(_0xd1bf6d,_0x539fd6){_0x539fd6=_0x539fd6||0xc8;return function(_0x37ce7f){if(_0x37ce7f){return _0xd1bf6d[_0xca62('0x1a')](_0x539fd6)[_0xca62('0x1c')](_0x37ce7f);}};}function respondWithFilteredResult(_0x1979fb,_0x159006){return function(_0x374717){if(_0x374717){var _0x5f0b7c=typeof _0x159006[_0xca62('0x1d')]===_0xca62('0x1e')&&typeof _0x159006['limit']==='undefined';var _0x1fa7b9=_0x374717[_0xca62('0x1f')];var _0x47b7c2=_0x5f0b7c?0x0:_0x159006['offset'];var _0x51ccef=_0x5f0b7c?_0x374717[_0xca62('0x1f')]:_0x159006[_0xca62('0x1d')]+_0x159006[_0xca62('0x20')];var _0x249d37;if(_0x51ccef>=_0x1fa7b9){_0x51ccef=_0x1fa7b9;_0x249d37=0xc8;}else{_0x249d37=0xce;}_0x1979fb[_0xca62('0x1a')](_0x249d37);return _0x1979fb[_0xca62('0x21')](_0xca62('0x22'),_0x47b7c2+'-'+_0x51ccef+'/'+_0x1fa7b9)[_0xca62('0x1c')](_0x374717);}return null;};}function patchUpdates(_0x182a46){return function(_0x1afe8e){try{jsonpatch['apply'](_0x1afe8e,_0x182a46,!![]);}catch(_0x4697fc){return BPromise[_0xca62('0x23')](_0x4697fc);}return _0x1afe8e[_0xca62('0x24')]();};}function saveUpdates(_0x3648a5,_0x4e5a0d){return function(_0x286880){if(_0x286880){return _0x286880[_0xca62('0x25')](_0x3648a5)[_0xca62('0x26')](function(_0x42690b){return _0x42690b;});}return null;};}function removeEntity(_0x44f949,_0xb8521){return function(_0x27dfa3){if(_0x27dfa3){return _0x27dfa3[_0xca62('0x27')]()[_0xca62('0x26')](function(){_0x44f949[_0xca62('0x1a')](0xcc)[_0xca62('0x1b')]();});}};}function handleEntityNotFound(_0x4aaf15,_0x50658f){return function(_0xd80d5b){if(!_0xd80d5b){_0x4aaf15[_0xca62('0x19')](0x194);}return _0xd80d5b;};}function handleError(_0x3c27c5,_0x3957ea){_0x3957ea=_0x3957ea||0x1f4;return function(_0x58226b){logger['error'](_0x58226b[_0xca62('0x28')]);if(_0x58226b[_0xca62('0x29')]){delete _0x58226b[_0xca62('0x29')];}_0x3c27c5[_0xca62('0x1a')](_0x3957ea)[_0xca62('0x2a')](_0x58226b);};}exports[_0xca62('0x2b')]=function(_0xd1b389,_0x5b2a89){var _0x57d24a={},_0x5e36e7={},_0x20f75f={'count':0x0,'rows':[]};var _0x5153ac=_[_0xca62('0x2c')](db[_0xca62('0x2d')][_0xca62('0x2e')],function(_0x3a9e2a){return{'name':_0x3a9e2a[_0xca62('0x2f')],'type':_0x3a9e2a[_0xca62('0x30')][_0xca62('0x31')]};});_0x5e36e7[_0xca62('0x32')]=_[_0xca62('0x2c')](_0x5153ac,_0xca62('0x29'));_0x5e36e7[_0xca62('0x33')]=_[_0xca62('0x34')](_0xd1b389[_0xca62('0x33')]);_0x5e36e7[_0xca62('0x35')]=_[_0xca62('0x36')](_0x5e36e7[_0xca62('0x32')],_0x5e36e7[_0xca62('0x33')]);_0x57d24a[_0xca62('0x37')]=_['intersection'](_0x5e36e7[_0xca62('0x32')],qs[_0xca62('0x38')](_0xd1b389[_0xca62('0x33')][_0xca62('0x38')]));_0x57d24a[_0xca62('0x37')]=_0x57d24a[_0xca62('0x37')][_0xca62('0x39')]?_0x57d24a[_0xca62('0x37')]:_0x5e36e7[_0xca62('0x32')];if(!_0xd1b389['query']['hasOwnProperty'](_0xca62('0x3a'))){_0x57d24a[_0xca62('0x20')]=qs[_0xca62('0x20')](_0xd1b389[_0xca62('0x33')]['limit']);_0x57d24a[_0xca62('0x1d')]=qs['offset'](_0xd1b389['query'][_0xca62('0x1d')]);}_0x57d24a[_0xca62('0x3b')]=qs[_0xca62('0x3c')](_0xd1b389[_0xca62('0x33')][_0xca62('0x3c')]);_0x57d24a[_0xca62('0x3d')]=qs[_0xca62('0x35')](_[_0xca62('0x3e')](_0xd1b389[_0xca62('0x33')],_0x5e36e7[_0xca62('0x35')]),_0x5153ac);if(_0xd1b389[_0xca62('0x33')][_0xca62('0x3f')]){_0x57d24a[_0xca62('0x3d')]=_[_0xca62('0x40')](_0x57d24a[_0xca62('0x3d')],{'$or':_[_0xca62('0x2c')](_0x5153ac,function(_0x4f1fb5){if(_0x4f1fb5[_0xca62('0x30')]!==_0xca62('0x41')){var _0x24c092={};_0x24c092[_0x4f1fb5[_0xca62('0x29')]]={'$like':'%'+_0xd1b389[_0xca62('0x33')][_0xca62('0x3f')]+'%'};return _0x24c092;}})});}_0x57d24a=_['merge']({},_0x57d24a,_0xd1b389['options']);var _0x5bec1a={'where':_0x57d24a[_0xca62('0x3d')]};return db['WhatsappTransferReport'][_0xca62('0x1f')](_0x5bec1a)[_0xca62('0x26')](function(_0x4ed1df){_0x20f75f[_0xca62('0x1f')]=_0x4ed1df;if(_0xd1b389[_0xca62('0x33')][_0xca62('0x42')]){_0x57d24a[_0xca62('0x43')]=[{'all':!![]}];}return db[_0xca62('0x2d')][_0xca62('0x44')](_0x57d24a);})['then'](function(_0x1cdd4c){_0x20f75f[_0xca62('0x45')]=_0x1cdd4c;return _0x20f75f;})['then'](respondWithFilteredResult(_0x5b2a89,_0x57d24a))[_0xca62('0x46')](handleError(_0x5b2a89,null));};exports['show']=function(_0x51e763,_0x10329){var _0x11df14={'raw':!![],'where':{'id':_0x51e763[_0xca62('0x47')]['id']}},_0x119f7b={};_0x119f7b[_0xca62('0x32')]=_[_0xca62('0x34')](db['WhatsappTransferReport'][_0xca62('0x2e')]);_0x119f7b['query']=_[_0xca62('0x34')](_0x51e763[_0xca62('0x33')]);_0x119f7b['filters']=_[_0xca62('0x36')](_0x119f7b[_0xca62('0x32')],_0x119f7b[_0xca62('0x33')]);_0x11df14[_0xca62('0x37')]=_['intersection'](_0x119f7b[_0xca62('0x32')],qs[_0xca62('0x38')](_0x51e763[_0xca62('0x33')][_0xca62('0x38')]));_0x11df14[_0xca62('0x37')]=_0x11df14[_0xca62('0x37')][_0xca62('0x39')]?_0x11df14[_0xca62('0x37')]:_0x119f7b[_0xca62('0x32')];if(_0x51e763[_0xca62('0x33')][_0xca62('0x42')]){_0x11df14['include']=[{'all':!![]}];}_0x11df14=_[_0xca62('0x40')]({},_0x11df14,_0x51e763['options']);return db[_0xca62('0x2d')][_0xca62('0x48')](_0x11df14)['then'](handleEntityNotFound(_0x10329,null))[_0xca62('0x26')](respondWithResult(_0x10329,null))[_0xca62('0x46')](handleError(_0x10329,null));};exports[_0xca62('0x49')]=function(_0x41aa9f,_0x58bf88){return db[_0xca62('0x2d')][_0xca62('0x49')](_0x41aa9f[_0xca62('0x4a')],{})[_0xca62('0x26')](respondWithResult(_0x58bf88,0xc9))[_0xca62('0x46')](handleError(_0x58bf88,null));};exports[_0xca62('0x25')]=function(_0x5227d1,_0x1a1a0d){if(_0x5227d1[_0xca62('0x4a')]['id']){delete _0x5227d1[_0xca62('0x4a')]['id'];}return db['WhatsappTransferReport'][_0xca62('0x48')]({'where':{'id':_0x5227d1[_0xca62('0x47')]['id']}})[_0xca62('0x26')](handleEntityNotFound(_0x1a1a0d,null))[_0xca62('0x26')](saveUpdates(_0x5227d1['body'],null))['then'](respondWithResult(_0x1a1a0d,null))[_0xca62('0x46')](handleError(_0x1a1a0d,null));};exports[_0xca62('0x27')]=function(_0xce236c,_0x535477){return db[_0xca62('0x2d')][_0xca62('0x48')]({'where':{'id':_0xce236c[_0xca62('0x47')]['id']}})[_0xca62('0x26')](handleEntityNotFound(_0x535477,null))[_0xca62('0x26')](removeEntity(_0x535477,null))['catch'](handleError(_0x535477,null));};exports[_0xca62('0x4b')]=function(_0x4e1e4a,_0xd834be){return db[_0xca62('0x2d')]['describe']()[_0xca62('0x26')](respondWithResult(_0xd834be,null))[_0xca62('0x46')](handleError(_0xd834be,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index ce9b2f5..dbe4f4d 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 _0x302c=['api','moment','bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger'];(function(_0x507d86,_0x4f94c2){var _0x3b9708=function(_0x30f90b){while(--_0x30f90b){_0x507d86['push'](_0x507d86['shift']());}};_0x3b9708(++_0x4f94c2);}(_0x302c,0xc2));var _0xc302=function(_0x26b5cf,_0x185928){_0x26b5cf=_0x26b5cf-0x0;var _0x34c35b=_0x302c[_0x26b5cf];return _0x34c35b;};'use strict';var _=require(_0xc302('0x0'));var util=require('util');var logger=require(_0xc302('0x1'))(_0xc302('0x2'));var moment=require(_0xc302('0x3'));var BPromise=require(_0xc302('0x4'));var rp=require(_0xc302('0x5'));var fs=require('fs');var path=require(_0xc302('0x6'));var rimraf=require(_0xc302('0x7'));var config=require('../../config/environment');var attributes=require(_0xc302('0x8'));module[_0xc302('0x9')]=function(_0x556fd9,_0x14e544){return _0x556fd9[_0xc302('0xa')](_0xc302('0xb'),attributes,{'tableName':_0xc302('0xc'),'paranoid':![],'indexes':[{'name':_0xc302('0xd'),'fields':[_0xc302('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x144a=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','report_whatsapp_transfer','uniqueid'];(function(_0x18b344,_0x271f68){var _0x5ef6bb=function(_0x3345b3){while(--_0x3345b3){_0x18b344['push'](_0x18b344['shift']());}};_0x5ef6bb(++_0x271f68);}(_0x144a,0x108));var _0xa144=function(_0x43ab1a,_0x1df7a0){_0x43ab1a=_0x43ab1a-0x0;var _0x51044a=_0x144a[_0x43ab1a];return _0x51044a;};'use strict';var _=require(_0xa144('0x0'));var util=require('util');var logger=require(_0xa144('0x1'))(_0xa144('0x2'));var moment=require(_0xa144('0x3'));var BPromise=require(_0xa144('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa144('0x5'));var rimraf=require(_0xa144('0x6'));var config=require(_0xa144('0x7'));var attributes=require(_0xa144('0x8'));module[_0xa144('0x9')]=function(_0x2a8f74,_0x30f6af){return _0x2a8f74['define']('WhatsappTransferReport',attributes,{'tableName':_0xa144('0xa'),'paranoid':![],'indexes':[{'name':_0xa144('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 5a3c8eb..5646145 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 _0x8d2e=['WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info'];(function(_0x42ebba,_0x4cbf87){var _0x3fd2af=function(_0x26d999){while(--_0x26d999){_0x42ebba['push'](_0x42ebba['shift']());}};_0x3fd2af(++_0x4cbf87);}(_0x8d2e,0x198));var _0xe8d2=function(_0x4aacb3,_0x37ae4e){_0x4aacb3=_0x4aacb3-0x0;var _0x56dd9b=_0x8d2e[_0x4aacb3];return _0x56dd9b;};'use strict';var _=require(_0xe8d2('0x0'));var util=require(_0xe8d2('0x1'));var moment=require(_0xe8d2('0x2'));var BPromise=require(_0xe8d2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe8d2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe8d2('0x5'));var logger=require(_0xe8d2('0x6'))(_0xe8d2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe8d2('0x8')][_0xe8d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18094f,_0x96e9f5,_0x11e98d){return new BPromise(function(_0x20c837,_0x4c8228){return client['request'](_0x18094f,_0x11e98d)[_0xe8d2('0xa')](function(_0x16764d){logger[_0xe8d2('0xb')](_0xe8d2('0xc'),_0x96e9f5,_0xe8d2('0xd'));logger[_0xe8d2('0xe')](_0xe8d2('0xf'),_0x96e9f5,_0xe8d2('0xd'),JSON[_0xe8d2('0x10')](_0x16764d));if(_0x16764d['error']){if(_0x16764d['error'][_0xe8d2('0x11')]===0x1f4){logger['error'](_0xe8d2('0xc'),_0x96e9f5,_0x16764d[_0xe8d2('0x12')]['message']);return _0x4c8228(_0x16764d['error'][_0xe8d2('0x13')]);}logger['error'](_0xe8d2('0xc'),_0x96e9f5,_0x16764d[_0xe8d2('0x12')][_0xe8d2('0x13')]);return _0x20c837(_0x16764d[_0xe8d2('0x12')]['message']);}else{logger[_0xe8d2('0xb')](_0xe8d2('0xc'),_0x96e9f5,_0xe8d2('0xd'));_0x20c837(_0x16764d[_0xe8d2('0x14')][_0xe8d2('0x13')]);}})['catch'](function(_0xcc1f92){logger[_0xe8d2('0x12')](_0xe8d2('0xc'),_0x96e9f5,_0xcc1f92);_0x4c8228(_0xcc1f92);});});} \ No newline at end of file +var _0x7732=['rpc','../../config/environment','jayson/promise','client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x33227c,_0x57ed78){var _0x50f140=function(_0x237af0){while(--_0x237af0){_0x33227c['push'](_0x33227c['shift']());}};_0x50f140(++_0x57ed78);}(_0x7732,0x6f));var _0x2773=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0x7732[_0x20b29c];return _0x20d81b;};'use strict';var _=require(_0x2773('0x0'));var util=require(_0x2773('0x1'));var moment=require(_0x2773('0x2'));var BPromise=require(_0x2773('0x3'));var rs=require(_0x2773('0x4'));var fs=require('fs');var Redis=require(_0x2773('0x5'));var db=require(_0x2773('0x6'))['db'];var utils=require(_0x2773('0x7'));var logger=require(_0x2773('0x8'))(_0x2773('0x9'));var config=require(_0x2773('0xa'));var jayson=require(_0x2773('0xb'));var client=jayson[_0x2773('0xc')][_0x2773('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2d155a,_0x2f6fd3,_0x59c46d){return new BPromise(function(_0x528442,_0x5922a4){return client[_0x2773('0xe')](_0x2d155a,_0x59c46d)['then'](function(_0x49a66a){logger[_0x2773('0xf')](_0x2773('0x10'),_0x2f6fd3,_0x2773('0x11'));logger[_0x2773('0x12')](_0x2773('0x13'),_0x2f6fd3,_0x2773('0x11'),JSON[_0x2773('0x14')](_0x49a66a));if(_0x49a66a[_0x2773('0x15')]){if(_0x49a66a['error']['code']===0x1f4){logger[_0x2773('0x15')](_0x2773('0x10'),_0x2f6fd3,_0x49a66a['error']['message']);return _0x5922a4(_0x49a66a[_0x2773('0x15')][_0x2773('0x16')]);}logger[_0x2773('0x15')](_0x2773('0x10'),_0x2f6fd3,_0x49a66a[_0x2773('0x15')][_0x2773('0x16')]);return _0x528442(_0x49a66a[_0x2773('0x15')][_0x2773('0x16')]);}else{logger[_0x2773('0xf')](_0x2773('0x10'),_0x2f6fd3,_0x2773('0x11'));_0x528442(_0x49a66a[_0x2773('0x17')][_0x2773('0x16')]);}})['catch'](function(_0x1b9759){logger['error'](_0x2773('0x10'),_0x2f6fd3,_0x1b9759);_0x5922a4(_0x1b9759);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 87ecace..170c116 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe634=['then','listen','start','info','Online\x20apps:','map','filter','online','Offline\x20apps:','status','name','join','None','seedDB','./config/seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./rpc','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0xe634,0x18c));var _0x4e63=function(_0x4cf99a,_0xb086ff){_0x4cf99a=_0x4cf99a-0x0;var _0x52139c=_0xe634[_0x4cf99a];return _0x52139c;};'use strict';var _=require(_0x4e63('0x0'));var mysqldb=require(_0x4e63('0x1'));var rpc=require(_0x4e63('0x2'));var config=require('./config/environment');var logger=require(_0x4e63('0x3'))(_0x4e63('0x4'));var pm2=require(_0x4e63('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x4e63('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x4e63('0x7'));var transcribe=require(_0x4e63('0x8'));function main(){return mysqldb['db'][_0x4e63('0x9')]['sync']()[_0x4e63('0xa')](function(){return rpc[_0x4e63('0xb')]();})[_0x4e63('0xa')](function(_0x569e4f){logger['info'](_0x569e4f);return chat[_0x4e63('0xc')]();})[_0x4e63('0xa')](function(){return whatsapp[_0x4e63('0xc')]();})[_0x4e63('0xa')](function(){return schedule['start']();})[_0x4e63('0xa')](function(){return transcribe[_0x4e63('0xc')]();})[_0x4e63('0xa')](function(_0x4c4589){logger[_0x4e63('0xd')](_0x4c4589);return pm2[_0x4e63('0xc')](pm2Config);})['then'](function(_0x532c0e){logger[_0x4e63('0xd')](_0x4e63('0xe'),_[_0x4e63('0xf')](_[_0x4e63('0x10')](_0x532c0e,{'status':_0x4e63('0x11')}),'name')['join']());logger[_0x4e63('0xd')](_0x4e63('0x12'),_['map'](_[_0x4e63('0x10')](_0x532c0e,function(_0x35a0fc){return _0x35a0fc[_0x4e63('0x13')]!==_0x4e63('0x11');}),_0x4e63('0x14'))[_0x4e63('0x15')]()||_0x4e63('0x16'));config[_0x4e63('0x17')]&&require(_0x4e63('0x18'))[_0x4e63('0x19')]();require(_0x4e63('0x1a'))['default']();})[_0x4e63('0x1b')](function(_0x89b295){logger['error'](_0x4e63('0x1c'),_0x89b295);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x272f=['map','filter','online','name','join','Offline\x20apps:','status','None','seedDB','./config/seedDB','./config/license','default','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','info','start','Online\x20apps:'];(function(_0x26e094,_0x457b77){var _0x110519=function(_0x356b6d){while(--_0x356b6d){_0x26e094['push'](_0x26e094['shift']());}};_0x110519(++_0x457b77);}(_0x272f,0xe1));var _0xf272=function(_0x4b0527,_0x390ced){_0x4b0527=_0x4b0527-0x0;var _0x597f1d=_0x272f[_0x4b0527];return _0x597f1d;};'use strict';var _=require('lodash');var mysqldb=require(_0xf272('0x0'));var rpc=require(_0xf272('0x1'));var config=require(_0xf272('0x2'));var logger=require('./config/logger')(_0xf272('0x3'));var pm2=require(_0xf272('0x4'));var pm2Config=require(_0xf272('0x5'));var schedule=require(_0xf272('0x6'));var chat=require(_0xf272('0x7'));var whatsapp=require(_0xf272('0x8'));var transcribe=require(_0xf272('0x9'));function main(){return mysqldb['db']['sequelize'][_0xf272('0xa')]()['then'](function(){return rpc['listen']();})[_0xf272('0xb')](function(_0x13cc6f){logger[_0xf272('0xc')](_0x13cc6f);return chat[_0xf272('0xd')]();})[_0xf272('0xb')](function(){return whatsapp['start']();})[_0xf272('0xb')](function(){return schedule[_0xf272('0xd')]();})[_0xf272('0xb')](function(){return transcribe[_0xf272('0xd')]();})[_0xf272('0xb')](function(_0x893e17){logger['info'](_0x893e17);return pm2[_0xf272('0xd')](pm2Config);})[_0xf272('0xb')](function(_0x11fad9){logger[_0xf272('0xc')](_0xf272('0xe'),_[_0xf272('0xf')](_[_0xf272('0x10')](_0x11fad9,{'status':_0xf272('0x11')}),_0xf272('0x12'))[_0xf272('0x13')]());logger[_0xf272('0xc')](_0xf272('0x14'),_['map'](_['filter'](_0x11fad9,function(_0x2f7c99){return _0x2f7c99[_0xf272('0x15')]!==_0xf272('0x11');}),_0xf272('0x12'))[_0xf272('0x13')]()||_0xf272('0x16'));config[_0xf272('0x17')]&&require(_0xf272('0x18'))['default']();require(_0xf272('0x19'))[_0xf272('0x1a')]();})['catch'](function(_0x287510){logger[_0xf272('0x1b')](_0xf272('0x1c'),_0x287510);process[_0xf272('0x1d')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 41a0071..9195fea 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 _0xf06e=['promisify','sign','secret','payload','verify','toString','hex','floor','now','../../config/environment','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','fullname','name','internal','md5secret','smsPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','disposition','closed','status','json','catch','authorization','startsWith','headers','Basic','find','then','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','sub','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','disabled','blocked','blockedAt','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','getUuid','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','unshift','encryptString','join'];(function(_0x28d2e9,_0x56209f){var _0x1205c3=function(_0x97eb97){while(--_0x97eb97){_0x28d2e9['push'](_0x28d2e9['shift']());}};_0x1205c3(++_0x56209f);}(_0xf06e,0xf5));var _0xef06=function(_0x1022d9,_0x40df80){_0x1022d9=_0x1022d9-0x0;var _0x2ed171=_0xf06e[_0x1022d9];return _0x2ed171;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xef06('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0xef06('0x1'));var jwt=require(_0xef06('0x2'));var expressJwt=require(_0xef06('0x3'));var compose=require(_0xef06('0x4'));var basicAuth=require(_0xef06('0x5'));var crypto=require(_0xef06('0x6'));var BPromise=require(_0xef06('0x7'));var util=require(_0xef06('0x8'));var moment=require(_0xef06('0x9'));var validateJwt=expressJwt({'secret':config[_0xef06('0xa')][_0xef06('0xb')]});var userAttributes=['id','role',_0xef06('0xc'),_0xef06('0xd'),_0xef06('0xe'),'email','userpic','permissions',_0xef06('0xf'),'voicePause','chatPause','mailPause','faxPause',_0xef06('0x10'),'openchannelPause',_0xef06('0x11'),_0xef06('0x12'),'lastLoginAt',_0xef06('0x13'),_0xef06('0x14'),_0xef06('0x15'),_0xef06('0x16'),_0xef06('0x17'),_0xef06('0x18'),_0xef06('0x19'),_0xef06('0x1a'),_0xef06('0x1b'),_0xef06('0x1c'),_0xef06('0x1d'),_0xef06('0x1e'),_0xef06('0x1f'),_0xef06('0x20'),_0xef06('0x21'),_0xef06('0x22'),'interface',_0xef06('0x23'),_0xef06('0x24'),_0xef06('0x25'),_0xef06('0x26'),_0xef06('0x27'),_0xef06('0x28'),_0xef06('0x29')];exports[_0xef06('0x2a')]=function(){return this[_0xef06('0x2b')](!![])[_0xef06('0x2c')](function(_0xbff75,_0x2db559,_0x2c65bd){if(_0xbff75[_0xef06('0x2d')]){_0x2c65bd();}else{return db[_0xef06('0x2e')][_0xef06('0x2f')]({'where':{'id':_0xbff75[_0xef06('0x30')]['id']},'attributes':['id','closed',_0xef06('0x31')],'raw':!![]})['then'](function(_0x478d37){if(_0x478d37&&_0x478d37[_0xef06('0x32')]){return _0x2db559[_0xef06('0x33')](_0x478d37[_0xef06('0x31')]==='unmanaged'?0x195:0x193)[_0xef06('0x34')]({'message':_0x478d37[_0xef06('0x31')]==='unmanaged'?'Unmanaged.':'Forbidden.'});}else{_0x2c65bd();}})[_0xef06('0x35')](function(_0x48409f){_0x2c65bd(_0x48409f);});}});};exports['isAuthenticated']=function isAuthenticated(_0x490146){return compose()[_0xef06('0x2c')](function(_0xb6a485,_0x57aae3,_0x42f14c){var _0x15660c;if(_0xb6a485['headers'][_0xef06('0x36')]){if(_[_0xef06('0x37')](_0xb6a485[_0xef06('0x38')][_0xef06('0x36')],_0xef06('0x39'))){var _0x368ce7=basicAuth(_0xb6a485);db['User'][_0xef06('0x3a')]({'where':{'name':_0x368ce7['name']}})[_0xef06('0x3b')](function(_0x2f4644){if(!_0x2f4644||!_0x2f4644['authenticate'](_0x368ce7[_0xef06('0x3c')])){return _0x57aae3[_0xef06('0x33')](0x191)[_0xef06('0x34')]({'message':_0xef06('0x3d')});}_0xb6a485['user']={'id':_0x2f4644['id']};_0x42f14c();})[_0xef06('0x35')](function(_0x4ead9a){_0x42f14c(_0x4ead9a);});}else if(_[_0xef06('0x37')](_0xb6a485[_0xef06('0x38')][_0xef06('0x36')],_0xef06('0x3e'))){validateJwt(_0xb6a485,_0x57aae3,_0x42f14c);}else{if(_0x490146){_0x42f14c();}else{return _0x57aae3['status'](0x193)[_0xef06('0x34')]({'message':_0xef06('0x3f')});}}}else if(_0xb6a485[_0xef06('0x40')][_0xef06('0x41')]){try{var _0x5b4081={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0xb6a485[_0xef06('0x40')][_0xef06('0x41')],_0x5b4081)[_0xef06('0x3b')](function(_0x4093e6){return db['User']['find']({'where':{'id':_0x4093e6[_0xef06('0x42')]}})[_0xef06('0x3b')](function(_0x56558a){_0x15660c=_0x56558a;return db['Setting'][_0xef06('0x2f')]({'where':{'id':0x1},'attributes':[_0xef06('0x43'),_0xef06('0x44')],'raw':!![]});})['then'](function(_0x36732e){if(!_0x15660c||!_['isEqual'](_0x15660c[_0xef06('0x45')],_0x4093e6[_0xef06('0x46')])){return _0x57aae3[_0xef06('0x33')](0x191)[_0xef06('0x34')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x15660c[_0xef06('0x47')]){return _0x57aae3[_0xef06('0x33')](0x191)[_0xef06('0x34')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x15660c[_0xef06('0x48')]){if(_0x36732e[_0xef06('0x44')]>0x0){if(moment(_0x15660c[_0xef06('0x49')])['add'](_0x36732e[_0xef06('0x44')],_0xef06('0x4a'))>moment()){return _0x57aae3[_0xef06('0x33')](0x191)[_0xef06('0x34')]({'message':_0xef06('0x4b')});}}else{return _0x57aae3[_0xef06('0x33')](0x191)[_0xef06('0x34')]({'message':_0xef06('0x4b')});}}_0xb6a485['user']={'id':_0x15660c['id']};_0x42f14c();});})[_0xef06('0x35')](function(){return _0x57aae3[_0xef06('0x33')](0x191)[_0xef06('0x34')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x4d289c){_0x42f14c(_0x4d289c);}}else if(_0x490146){_0x42f14c();}else{return _0x57aae3['status'](0x193)['json']({'message':_0xef06('0x3f')});}})[_0xef06('0x2c')](function(_0x1959fe,_0x574d8b,_0x4e1075){if(_0x1959fe['user']){db['User'][_0xef06('0x3a')]({'where':{'id':_0x1959fe['user']['id']},'attributes':userAttributes})[_0xef06('0x3b')](function(_0x5f5b18){if(!_0x5f5b18){return _0x574d8b[_0xef06('0x33')](0x194)[_0xef06('0x34')]({'message':_0xef06('0x4c')});}_0x1959fe[_0xef06('0x2d')]=_0x5f5b18;_0x4e1075();})[_0xef06('0x35')](function(_0x2e7045){_0x4e1075(_0x2e7045);});}else if(_0x490146){_0x4e1075();}else{return _0x574d8b[_0xef06('0x33')](0x194)['json']({'message':_0xef06('0x4d')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xef06('0x2c')](function(_0x7d09ee,_0x1ac75e,_0x47a12a){return licenseUtil[_0xef06('0x4e')]()[_0xef06('0x3b')](function(_0x1521a1){if(_0x1521a1[_0xef06('0x4f')]){_0x47a12a();}else{return _0x1ac75e[_0xef06('0x33')](0x193)[_0xef06('0x34')]({'message':_0xef06('0x50')});}})[_0xef06('0x35')](function(_0xb6bdc3){_0x47a12a(_0xb6bdc3);});});};exports[_0xef06('0x51')]=function(_0x532355,_0x2ebfe2,_0x47d056){_0x532355[_0xef06('0x51')]=!![];return _0x47d056();};exports[_0xef06('0x52')]=function signToken(_0x507025){return signJwt(_0x507025);};exports[_0xef06('0x53')]=function(_0x2eeab0,_0x4c7b0a){if(!_0x2eeab0[_0xef06('0x2d')]){return _0x4c7b0a[_0xef06('0x33')](0x194)[_0xef06('0x34')]({'message':_0xef06('0x54')});}var _0x120cbf={'payload':{'id':_0x2eeab0[_0xef06('0x2d')]['id'],'role':_0x2eeab0[_0xef06('0x2d')][_0xef06('0x55')]},'options':{'expiresIn':0x15180}};return signJwt(_0x120cbf)['then'](function(_0x476eff){_0x4c7b0a[_0xef06('0x56')](_0xef06('0x57'),_0x476eff);_0x4c7b0a['redirect'](_0xef06('0x58'));})[_0xef06('0x35')](function(_0x3dbac7){return _0x4c7b0a[_0xef06('0x33')](0x1f4)[_0xef06('0x59')](_0x3dbac7);});};exports[_0xef06('0x5a')]=function(_0x24e6a9){if(_['isNil'](_0x24e6a9['apiKeyNonce'])||_[_0xef06('0x5b')](_0x24e6a9[_0xef06('0x5c')])){return null;}else{return createJwt(_0x24e6a9);}};exports[_0xef06('0x5d')]=function(_0x4fa2cd){_0x4fa2cd[_0xef06('0x45')]=generateNonce();_0x4fa2cd['apiKeyIat']=generateIssuedAt();return createJwt(_0x4fa2cd);};exports['regenerateApiKey']=function(_0xa4ff9d,_0x3d0666){var _0x265a52=_0xa4ff9d[_0xef06('0x40')]['apikey'];if(_0x265a52){var _0x57e1bb={'nonce':_0x3d0666[_0xef06('0x45')],'iat':_0x3d0666['apiKeyIat'],'audience':hardwareConf[_0xef06('0x5e')](),'issuer':hardwareConf[_0xef06('0x5e')]()};return verifyJwt(_0x265a52,_0x57e1bb)[_0xef06('0x3b')](function(){return generateApiKey(_0x3d0666);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xef06('0x5f')]=function(_0x5087ae){var _0x4dba0c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4dba0c[_0xef06('0x60')](_0x5087ae))throw new db[(_0xef06('0x61'))][(_0xef06('0x62'))](_0xef06('0x63'));return;};exports[_0xef06('0x64')]=function(_0x229885,_0x2f2cbb,_0x9025e){var _0x320728=encryptor['decryptString'](_0x2f2cbb)[_0xef06('0x65')](',');for(var _0x5c46d1=0x0;_0x5c46d1<_0x9025e;_0x5c46d1++){if(!_0x320728[_0x5c46d1])break;if(_0x229885['toLowerCase']()===_0x320728[_0x5c46d1][_0xef06('0x66')]()){var _0x14e94b=util[_0xef06('0x67')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x9025e);if(_0x9025e===0x1){_0x14e94b=_0xef06('0x68');}throw new db[(_0xef06('0x61'))]['ValidationError'](_0x14e94b);}}return;};exports['updatePasswordsHistory']=function(_0x3f8869,_0x3196cf){var _0x5f1f05=_0x3196cf?encryptor['decryptString'](_0x3196cf)[_0xef06('0x65')](','):[];if(_0x5f1f05[_0xef06('0x69')]===0x5){_0x5f1f05['splice'](-0x1,0x1);}_0x5f1f05[_0xef06('0x6a')](_0x3f8869);return encryptor[_0xef06('0x6b')](_0x5f1f05[_0xef06('0x6c')](','));};function signJwt(_0x4c59b2){var _0x20ad40=BPromise[_0xef06('0x6d')](jwt[_0xef06('0x6e')],{'context':jwt});var _0x213a11=_0x4c59b2[_0xef06('0x6f')]||config[_0xef06('0xa')][_0xef06('0xb')];return new BPromise(function(_0xe4a0ec,_0x1d3af8){_0x20ad40(_0x4c59b2[_0xef06('0x70')],_0x213a11,_0x4c59b2['options'])['then'](function(_0x4e106c){_0xe4a0ec(_0x4e106c);})['catch'](function(_0x365350){_0x1d3af8(_0x365350);});});}function verifyJwt(_0x437bda,_0x5504e3,_0x22041e){var _0x33d6ec=BPromise['promisify'](jwt[_0xef06('0x71')],{'context':jwt});var _0x15d606=_0x22041e||config[_0xef06('0xa')]['session'];return new BPromise(function(_0x21a3bc,_0x38cb6d){_0x33d6ec(_0x437bda,_0x15d606,_0x5504e3)[_0xef06('0x3b')](function(_0x153078){_0x21a3bc(_0x153078);})['catch'](function(_0x22b703){_0x38cb6d(_0x22b703);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xef06('0x72')](_0xef06('0x73'));}function generateIssuedAt(){return Math[_0xef06('0x74')](Date[_0xef06('0x75')]()/0x3e8)[_0xef06('0x72')]();}function createJwt(_0x59c504){var _0x3b5de9={'payload':{'iat':_0x59c504[_0xef06('0x5c')],'nonce':_0x59c504[_0xef06('0x45')]},'options':{'algorithm':'HS512','subject':_0x59c504['id'][_0xef06('0x72')](),'issuer':hardwareConf[_0xef06('0x5e')](),'audience':hardwareConf[_0xef06('0x5e')]()}};return signJwt(_0x3b5de9)[_0xef06('0x3b')](function(_0x52f5fb){return{'iat':_0x59c504[_0xef06('0x5c')],'nonce':_0x59c504['apiKeyNonce'],'token':_0x52f5fb};});} \ No newline at end of file +var _0xb40f=['The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secret','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','util','secrets','session','role','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','userProfileId','privacyEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','user','ChatInteraction','findOne','params','closed','disposition','unmanaged','catch','headers','startsWith','authorization','Basic','User','find','then','authenticate','status','json','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','use','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','generateApiKey','regenerateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xb40f,0x1a6));var _0xfb40=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0xb40f[_0x3a0c4f];return _0x247049;};'use strict';var db=require(_0xfb40('0x0'))['db'];var config=require(_0xfb40('0x1'));var hardwareConf=require(_0xfb40('0x2'));var licenseUtil=require(_0xfb40('0x3'));var encryptor=require(_0xfb40('0x4'));var _=require(_0xfb40('0x5'));var jwt=require(_0xfb40('0x6'));var expressJwt=require(_0xfb40('0x7'));var compose=require(_0xfb40('0x8'));var basicAuth=require(_0xfb40('0x9'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0xfb40('0xa'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xfb40('0xb')][_0xfb40('0xc')]});var userAttributes=['id',_0xfb40('0xd'),'fullname',_0xfb40('0xe'),_0xfb40('0xf'),_0xfb40('0x10'),_0xfb40('0x11'),_0xfb40('0x12'),_0xfb40('0x13'),_0xfb40('0x14'),_0xfb40('0x15'),_0xfb40('0x16'),_0xfb40('0x17'),_0xfb40('0x18'),_0xfb40('0x19'),_0xfb40('0x1a'),'showWebBar',_0xfb40('0x1b'),_0xfb40('0x1c'),_0xfb40('0x1d'),_0xfb40('0x1e'),_0xfb40('0x1f'),_0xfb40('0x20'),_0xfb40('0x21'),_0xfb40('0x22'),_0xfb40('0x23'),_0xfb40('0x24'),_0xfb40('0x25'),_0xfb40('0x26'),_0xfb40('0x27'),_0xfb40('0x28'),'phoneBarRemoteControl',_0xfb40('0x29'),_0xfb40('0x2a'),'interface',_0xfb40('0x2b'),_0xfb40('0x2c'),'settingsEnabled',_0xfb40('0x2d'),'downloadVoiceRecordings',_0xfb40('0x2e'),_0xfb40('0x2f')];exports[_0xfb40('0x30')]=function(){return this['isAuthenticated'](!![])['use'](function(_0xdd43a7,_0x1b51ef,_0x22d6de){if(_0xdd43a7[_0xfb40('0x31')]){_0x22d6de();}else{return db[_0xfb40('0x32')][_0xfb40('0x33')]({'where':{'id':_0xdd43a7[_0xfb40('0x34')]['id']},'attributes':['id',_0xfb40('0x35'),'disposition'],'raw':!![]})['then'](function(_0xc39788){if(_0xc39788&&_0xc39788[_0xfb40('0x35')]){return _0x1b51ef['status'](_0xc39788[_0xfb40('0x36')]==='unmanaged'?0x195:0x193)['json']({'message':_0xc39788['disposition']===_0xfb40('0x37')?'Unmanaged.':'Forbidden.'});}else{_0x22d6de();}})[_0xfb40('0x38')](function(_0x51239e){_0x22d6de(_0x51239e);});}});};exports['isAuthenticated']=function isAuthenticated(_0x3e4a97){return compose()['use'](function(_0x4b0324,_0x33eeb6,_0x285dd4){var _0x1bc38e;if(_0x4b0324[_0xfb40('0x39')]['authorization']){if(_[_0xfb40('0x3a')](_0x4b0324['headers'][_0xfb40('0x3b')],_0xfb40('0x3c'))){var _0x30907d=basicAuth(_0x4b0324);db[_0xfb40('0x3d')][_0xfb40('0x3e')]({'where':{'name':_0x30907d['name']}})[_0xfb40('0x3f')](function(_0x38f3ea){if(!_0x38f3ea||!_0x38f3ea[_0xfb40('0x40')](_0x30907d['pass'])){return _0x33eeb6[_0xfb40('0x41')](0x191)[_0xfb40('0x42')]({'message':_0xfb40('0x43')});}_0x4b0324['user']={'id':_0x38f3ea['id']};_0x285dd4();})[_0xfb40('0x38')](function(_0x1149c3){_0x285dd4(_0x1149c3);});}else if(_[_0xfb40('0x3a')](_0x4b0324[_0xfb40('0x39')][_0xfb40('0x3b')],_0xfb40('0x44'))){validateJwt(_0x4b0324,_0x33eeb6,_0x285dd4);}else{if(_0x3e4a97){_0x285dd4();}else{return _0x33eeb6[_0xfb40('0x41')](0x193)[_0xfb40('0x42')]({'message':_0xfb40('0x45')});}}}else if(_0x4b0324[_0xfb40('0x46')][_0xfb40('0x47')]){try{var _0x11ab7c={'audience':hardwareConf[_0xfb40('0x48')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x4b0324[_0xfb40('0x46')][_0xfb40('0x47')],_0x11ab7c)[_0xfb40('0x3f')](function(_0x56f6a6){return db[_0xfb40('0x3d')][_0xfb40('0x3e')]({'where':{'id':_0x56f6a6[_0xfb40('0x49')]}})[_0xfb40('0x3f')](function(_0x71ef40){_0x1bc38e=_0x71ef40;return db[_0xfb40('0x4a')][_0xfb40('0x33')]({'where':{'id':0x1},'attributes':[_0xfb40('0x4b'),'blockDuration'],'raw':!![]});})['then'](function(_0x123013){if(!_0x1bc38e||!_['isEqual'](_0x1bc38e[_0xfb40('0x4c')],_0x56f6a6[_0xfb40('0x4d')])){return _0x33eeb6[_0xfb40('0x41')](0x191)[_0xfb40('0x42')]({'message':_0xfb40('0x4e')});}if(_0x1bc38e[_0xfb40('0x4f')]){return _0x33eeb6['status'](0x191)['json']({'message':_0xfb40('0x50')});}if(_0x1bc38e[_0xfb40('0x51')]){if(_0x123013[_0xfb40('0x52')]>0x0){if(moment(_0x1bc38e[_0xfb40('0x53')])[_0xfb40('0x54')](_0x123013['blockDuration'],_0xfb40('0x55'))>moment()){return _0x33eeb6[_0xfb40('0x41')](0x191)[_0xfb40('0x42')]({'message':_0xfb40('0x50')});}}else{return _0x33eeb6[_0xfb40('0x41')](0x191)[_0xfb40('0x42')]({'message':_0xfb40('0x50')});}}_0x4b0324['user']={'id':_0x1bc38e['id']};_0x285dd4();});})[_0xfb40('0x38')](function(){return _0x33eeb6[_0xfb40('0x41')](0x191)['json']({'message':_0xfb40('0x50')});});}catch(_0x79c9c2){_0x285dd4(_0x79c9c2);}}else if(_0x3e4a97){_0x285dd4();}else{return _0x33eeb6[_0xfb40('0x41')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0xfb40('0x56')](function(_0x35c20d,_0xf06b4a,_0x3c43a8){if(_0x35c20d[_0xfb40('0x31')]){db[_0xfb40('0x3d')][_0xfb40('0x3e')]({'where':{'id':_0x35c20d[_0xfb40('0x31')]['id']},'attributes':userAttributes})[_0xfb40('0x3f')](function(_0x2f6bd9){if(!_0x2f6bd9){return _0xf06b4a[_0xfb40('0x41')](0x194)[_0xfb40('0x42')]({'message':_0xfb40('0x57')});}_0x35c20d[_0xfb40('0x31')]=_0x2f6bd9;_0x3c43a8();})[_0xfb40('0x38')](function(_0x2ea624){_0x3c43a8(_0x2ea624);});}else if(_0x3e4a97){_0x3c43a8();}else{return _0xf06b4a[_0xfb40('0x41')](0x194)['json']({'message':_0xfb40('0x58')});}});};exports[_0xfb40('0x59')]=function canUpdate(){return compose()[_0xfb40('0x56')](function(_0x720219,_0x1214a1,_0x436b6b){return licenseUtil[_0xfb40('0x5a')]()[_0xfb40('0x3f')](function(_0x68801c){if(_0x68801c[_0xfb40('0x5b')]){_0x436b6b();}else{return _0x1214a1[_0xfb40('0x41')](0x193)['json']({'message':_0xfb40('0x5c')});}})[_0xfb40('0x38')](function(_0x39b721){_0x436b6b(_0x39b721);});});};exports['isMiddleware']=function(_0x54686b,_0xba02af,_0x2fbf5e){_0x54686b[_0xfb40('0x5d')]=!![];return _0x2fbf5e();};exports[_0xfb40('0x5e')]=function signToken(_0x26b94c){return signJwt(_0x26b94c);};exports[_0xfb40('0x5f')]=function(_0x57126a,_0x49d427){if(!_0x57126a[_0xfb40('0x31')]){return _0x49d427[_0xfb40('0x41')](0x194)[_0xfb40('0x42')]({'message':_0xfb40('0x60')});}var _0x7f93af={'payload':{'id':_0x57126a[_0xfb40('0x31')]['id'],'role':_0x57126a[_0xfb40('0x31')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x7f93af)[_0xfb40('0x3f')](function(_0x536715){_0x49d427[_0xfb40('0x61')](_0xfb40('0x62'),_0x536715);_0x49d427[_0xfb40('0x63')]('/dashboards/general');})['catch'](function(_0x207ce1){return _0x49d427[_0xfb40('0x41')](0x1f4)[_0xfb40('0x64')](_0x207ce1);});};exports[_0xfb40('0x65')]=function(_0x528f4d){if(_[_0xfb40('0x66')](_0x528f4d[_0xfb40('0x4c')])||_['isNil'](_0x528f4d['apiKeyIat'])){return null;}else{return createJwt(_0x528f4d);}};exports[_0xfb40('0x67')]=function(_0x1980b3){_0x1980b3[_0xfb40('0x4c')]=generateNonce();_0x1980b3['apiKeyIat']=generateIssuedAt();return createJwt(_0x1980b3);};exports[_0xfb40('0x68')]=function(_0x47d496,_0x47042b){var _0x10b3b2=_0x47d496[_0xfb40('0x46')][_0xfb40('0x47')];if(_0x10b3b2){var _0x30391e={'nonce':_0x47042b[_0xfb40('0x4c')],'iat':_0x47042b[_0xfb40('0x69')],'audience':hardwareConf[_0xfb40('0x48')](),'issuer':hardwareConf[_0xfb40('0x48')]()};return verifyJwt(_0x10b3b2,_0x30391e)[_0xfb40('0x3f')](function(){return generateApiKey(_0x47042b);});}else{throw{'message':_0xfb40('0x6a')};}};exports[_0xfb40('0x6b')]=function(_0x3754a0){var _0x4c880d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4c880d[_0xfb40('0x6c')](_0x3754a0))throw new db['Sequelize'][(_0xfb40('0x6d'))](_0xfb40('0x6e'));return;};exports['validatePasswordHistory']=function(_0x29dcaa,_0x3d3f4c,_0x1f0e29){var _0x1d7e0e=encryptor[_0xfb40('0x6f')](_0x3d3f4c)[_0xfb40('0x70')](',');for(var _0x37ba70=0x0;_0x37ba70<_0x1f0e29;_0x37ba70++){if(!_0x1d7e0e[_0x37ba70])break;if(_0x29dcaa[_0xfb40('0x71')]()===_0x1d7e0e[_0x37ba70][_0xfb40('0x71')]()){var _0x3a3e3f=util[_0xfb40('0x72')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x1f0e29);if(_0x1f0e29===0x1){_0x3a3e3f='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xfb40('0x73'))]['ValidationError'](_0x3a3e3f);}}return;};exports[_0xfb40('0x74')]=function(_0x2d1663,_0x5bda55){var _0x40b1df=_0x5bda55?encryptor[_0xfb40('0x6f')](_0x5bda55)[_0xfb40('0x70')](','):[];if(_0x40b1df[_0xfb40('0x75')]===0x5){_0x40b1df[_0xfb40('0x76')](-0x1,0x1);}_0x40b1df[_0xfb40('0x77')](_0x2d1663);return encryptor[_0xfb40('0x78')](_0x40b1df[_0xfb40('0x79')](','));};function signJwt(_0x3838c5){var _0x68215f=BPromise[_0xfb40('0x7a')](jwt[_0xfb40('0x7b')],{'context':jwt});var _0x57089e=_0x3838c5[_0xfb40('0x7c')]||config[_0xfb40('0xb')][_0xfb40('0xc')];return new BPromise(function(_0x1ac3d0,_0x286c5a){_0x68215f(_0x3838c5['payload'],_0x57089e,_0x3838c5[_0xfb40('0x7d')])[_0xfb40('0x3f')](function(_0x55e3cf){_0x1ac3d0(_0x55e3cf);})[_0xfb40('0x38')](function(_0x300c7b){_0x286c5a(_0x300c7b);});});}function verifyJwt(_0x330462,_0x36a50c,_0x1fa977){var _0x596a7c=BPromise[_0xfb40('0x7a')](jwt[_0xfb40('0x7e')],{'context':jwt});var _0x60ac6a=_0x1fa977||config[_0xfb40('0xb')]['session'];return new BPromise(function(_0x2b4acb,_0x25ef29){_0x596a7c(_0x330462,_0x60ac6a,_0x36a50c)[_0xfb40('0x3f')](function(_0x15263c){_0x2b4acb(_0x15263c);})[_0xfb40('0x38')](function(_0x301fce){_0x25ef29(_0x301fce);});});}function generateNonce(){return crypto[_0xfb40('0x7f')](0x10)[_0xfb40('0x80')](_0xfb40('0x81'));}function generateIssuedAt(){return Math[_0xfb40('0x82')](Date[_0xfb40('0x83')]()/0x3e8)['toString']();}function createJwt(_0x2a2fde){var _0x27d074={'payload':{'iat':_0x2a2fde[_0xfb40('0x69')],'nonce':_0x2a2fde[_0xfb40('0x4c')]},'options':{'algorithm':_0xfb40('0x84'),'subject':_0x2a2fde['id'][_0xfb40('0x80')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xfb40('0x48')]()}};return signJwt(_0x27d074)[_0xfb40('0x3f')](function(_0x51e2f6){return{'iat':_0x2a2fde['apiKeyIat'],'nonce':_0x2a2fde[_0xfb40('0x4c')],'token':_0x51e2f6};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index d3df828..ed42c00 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 _0x5763=['algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','close','decryptFile','createDecipher','unlink','encryptString','secret','utf8','base64','decryptString','bluebird','lodash','../../config/environment','aes-256-ctr','encrypt'];(function(_0x38fa36,_0x49c221){var _0xd8263e=function(_0x335ee2){while(--_0x335ee2){_0x38fa36['push'](_0x38fa36['shift']());}};_0xd8263e(++_0x49c221);}(_0x5763,0xbb));var _0x3576=function(_0x3d8455,_0x35008f){_0x3d8455=_0x3d8455-0x0;var _0x39c94e=_0x5763[_0x3d8455];return _0x39c94e;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x3576('0x0'));var _=require(_0x3576('0x1'));var config=require(_0x3576('0x2'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':_0x3576('0x3')};const fileOptions={'algorithm':'aes192'};if(config[_0x3576('0x4')]&&config[_0x3576('0x4')][_0x3576('0x5')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0x3576('0x5')]=config['encrypt'][_0x3576('0x5')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x3576('0x6')](',\x20');logger[_0x3576('0x7')](config[_0x3576('0x4')][_0x3576('0x5')],_0x3576('0x8'),supportedAlgorithms);}}function isASupportedCipher(_0x429406){return AES_SUPPORTED_RX[_0x3576('0x9')](_0x429406);}function getSupportedCiphers(){return crypto[_0x3576('0xa')]()[_0x3576('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x334c32){return getSupportedCiphers()['indexOf'](_0x334c32)>-0x1;}function combineOptions(_0x1e46be){var _0x29a995={};for(var _0x560268 in fileOptions){if(fileOptions[_0x3576('0xc')](_0x560268)){_0x29a995[_0x560268]=fileOptions[_0x560268];}}if(_0x1e46be){for(var _0x2ce005 in _0x1e46be){if(_0x1e46be['hasOwnProperty'](_0x2ce005)){_0x29a995[_0x2ce005]=_0x1e46be[_0x2ce005];}}}return _0x29a995;}exports[_0x3576('0xd')]=function(_0x567897,_0x32aed2,_0x533d65,_0x48cb89){return new BPromise(function(_0x229ce3,_0x1a848b){_0x48cb89=combineOptions(_0x48cb89);var _0xb900c8=new Buffer(_0x533d65);var _0x4005a9=fs[_0x3576('0xe')](_0x567897);var _0x59723c=fs[_0x3576('0xf')](_0x32aed2);var _0x5554f4=crypto[_0x3576('0x10')](_0x48cb89[_0x3576('0x5')],_0xb900c8);_0x4005a9['on'](_0x3576('0x11'),function(_0x54eb49){var _0x143dd5=new Buffer(_0x5554f4[_0x3576('0x12')](_0x54eb49),_0x3576('0x13'));_0x59723c[_0x3576('0x14')](_0x143dd5);});_0x4005a9['on'](_0x3576('0x15'),function(){try{var _0x4d3fad=new Buffer(_0x5554f4[_0x3576('0x16')](_0x3576('0x13')),_0x3576('0x13'));_0x59723c[_0x3576('0x14')](_0x4d3fad);_0x59723c['end']();_0x59723c['on'](_0x3576('0x17'),function(){return _0x229ce3(_0x32aed2);});}catch(_0x3ecf39){fs['unlink'](_0x32aed2);return _0x1a848b(_0x3ecf39);}});});};exports[_0x3576('0x18')]=function(_0x16fd56,_0x51247d,_0x41785d,_0x809707){return new BPromise(function(_0xa60407,_0x3cad0f){_0x809707=combineOptions(_0x809707);var _0x276803=new Buffer(_0x41785d);var _0x108103=fs[_0x3576('0xe')](_0x16fd56);var _0x24e384=fs[_0x3576('0xf')](_0x51247d);var _0x1c83e7=crypto[_0x3576('0x19')](_0x809707[_0x3576('0x5')],_0x276803);_0x108103['on'](_0x3576('0x11'),function(_0x152b59){var _0x3f29b7=new Buffer(_0x1c83e7[_0x3576('0x12')](_0x152b59),_0x3576('0x13'));_0x24e384['write'](_0x3f29b7);});_0x108103['on']('end',function(){try{var _0x52c99d=new Buffer(_0x1c83e7['final']('binary'),'binary');_0x24e384[_0x3576('0x14')](_0x52c99d);_0x24e384[_0x3576('0x15')]();_0x24e384['on']('close',function(){return _0xa60407(_0x51247d);});}catch(_0xa51261){fs[_0x3576('0x1a')](_0x51247d);return _0x3cad0f(_0xa51261);}});});};exports[_0x3576('0x1b')]=function(_0x6a631e,_0xa894f0,_0x2705ea){var _0x398d5b=_0x2705ea||stringOptions[_0x3576('0x5')];var _0x1a830c=_0xa894f0||stringOptions[_0x3576('0x1c')];var _0x41d233=crypto[_0x3576('0x10')](_0x398d5b,_0x1a830c);var _0x20a438=_0x41d233[_0x3576('0x12')](_0x6a631e,_0x3576('0x1d'),_0x3576('0x1e'));_0x20a438+=_0x41d233[_0x3576('0x16')](_0x3576('0x1e'));return _0x20a438;};exports[_0x3576('0x1f')]=function(_0xe1032d,_0x1ed745,_0x6bb1ee){var _0x8150d8=_0x6bb1ee||stringOptions[_0x3576('0x5')];var _0x11fabd=_0x1ed745||stringOptions['secret'];var _0x10d530=crypto[_0x3576('0x19')](_0x8150d8,_0x11fabd);var _0x85f109=_0x10d530[_0x3576('0x12')](_0xe1032d,_0x3576('0x1e'),_0x3576('0x1d'));_0x85f109+=_0x10d530[_0x3576('0x16')]('utf8');return _0x85f109;}; \ No newline at end of file +var _0x7f65=['bluebird','lodash','../../config/environment','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','binary','end','write','unlink','decryptFile','createDecipher','final','secret','createCipher','utf8','base64','decryptString','crypto'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x7f65,0xa9));var _0x57f6=function(_0x4ff04d,_0x1c4ec7){_0x4ff04d=_0x4ff04d-0x0;var _0x565e33=_0x7f65[_0x4ff04d];return _0x565e33;};'use strict';var crypto=require(_0x57f6('0x0'));var fs=require('fs');var BPromise=require(_0x57f6('0x1'));var _=require(_0x57f6('0x2'));var config=require(_0x57f6('0x3'));var logger=require(_0x57f6('0x4'))(_0x57f6('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x57f6('0x6')]['session'],'algorithm':_0x57f6('0x7')};const fileOptions={'algorithm':_0x57f6('0x8')};if(config['encrypt']&&config[_0x57f6('0x9')][_0x57f6('0xa')]){var isSupported=isAlgorithmSupported(config[_0x57f6('0x9')][_0x57f6('0xa')]);if(isSupported){fileOptions['algorithm']=config[_0x57f6('0x9')][_0x57f6('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x57f6('0xb')](',\x20');logger['error'](config[_0x57f6('0x9')]['algorithm'],_0x57f6('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x43ca3d){return AES_SUPPORTED_RX[_0x57f6('0xd')](_0x43ca3d);}function getSupportedCiphers(){return crypto[_0x57f6('0xe')]()[_0x57f6('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x9c53a){return getSupportedCiphers()['indexOf'](_0x9c53a)>-0x1;}function combineOptions(_0x417e69){var _0x50229a={};for(var _0x4a9963 in fileOptions){if(fileOptions['hasOwnProperty'](_0x4a9963)){_0x50229a[_0x4a9963]=fileOptions[_0x4a9963];}}if(_0x417e69){for(var _0x3deb5e in _0x417e69){if(_0x417e69[_0x57f6('0x10')](_0x3deb5e)){_0x50229a[_0x3deb5e]=_0x417e69[_0x3deb5e];}}}return _0x50229a;}exports[_0x57f6('0x11')]=function(_0x366a8b,_0x3be877,_0x4546b7,_0x35a5e6){return new BPromise(function(_0x4d2e4c,_0x3f594c){_0x35a5e6=combineOptions(_0x35a5e6);var _0x5b43e8=new Buffer(_0x4546b7);var _0x3e306d=fs[_0x57f6('0x12')](_0x366a8b);var _0xbf696a=fs[_0x57f6('0x13')](_0x3be877);var _0x49d5b5=crypto['createCipher'](_0x35a5e6[_0x57f6('0xa')],_0x5b43e8);_0x3e306d['on'](_0x57f6('0x14'),function(_0x8beace){var _0x23e5f3=new Buffer(_0x49d5b5[_0x57f6('0x15')](_0x8beace),_0x57f6('0x16'));_0xbf696a['write'](_0x23e5f3);});_0x3e306d['on'](_0x57f6('0x17'),function(){try{var _0x3402ae=new Buffer(_0x49d5b5['final'](_0x57f6('0x16')),_0x57f6('0x16'));_0xbf696a[_0x57f6('0x18')](_0x3402ae);_0xbf696a[_0x57f6('0x17')]();_0xbf696a['on']('close',function(){return _0x4d2e4c(_0x3be877);});}catch(_0x2603a8){fs[_0x57f6('0x19')](_0x3be877);return _0x3f594c(_0x2603a8);}});});};exports[_0x57f6('0x1a')]=function(_0x5e3b30,_0x753bd4,_0x21070b,_0x405e2d){return new BPromise(function(_0x2755b8,_0x5e982e){_0x405e2d=combineOptions(_0x405e2d);var _0x34be48=new Buffer(_0x21070b);var _0x27f3e4=fs[_0x57f6('0x12')](_0x5e3b30);var _0x359ae1=fs[_0x57f6('0x13')](_0x753bd4);var _0xf3a822=crypto[_0x57f6('0x1b')](_0x405e2d[_0x57f6('0xa')],_0x34be48);_0x27f3e4['on'](_0x57f6('0x14'),function(_0x564fa3){var _0x5308eb=new Buffer(_0xf3a822[_0x57f6('0x15')](_0x564fa3),'binary');_0x359ae1[_0x57f6('0x18')](_0x5308eb);});_0x27f3e4['on'](_0x57f6('0x17'),function(){try{var _0x37f369=new Buffer(_0xf3a822[_0x57f6('0x1c')](_0x57f6('0x16')),_0x57f6('0x16'));_0x359ae1[_0x57f6('0x18')](_0x37f369);_0x359ae1[_0x57f6('0x17')]();_0x359ae1['on']('close',function(){return _0x2755b8(_0x753bd4);});}catch(_0xbc9e29){fs[_0x57f6('0x19')](_0x753bd4);return _0x5e982e(_0xbc9e29);}});});};exports['encryptString']=function(_0x500a49,_0x49f800,_0x258419){var _0x482e31=_0x258419||stringOptions[_0x57f6('0xa')];var _0x3350cf=_0x49f800||stringOptions[_0x57f6('0x1d')];var _0x428c73=crypto[_0x57f6('0x1e')](_0x482e31,_0x3350cf);var _0x327e53=_0x428c73['update'](_0x500a49,_0x57f6('0x1f'),_0x57f6('0x20'));_0x327e53+=_0x428c73[_0x57f6('0x1c')](_0x57f6('0x20'));return _0x327e53;};exports[_0x57f6('0x21')]=function(_0x288ab1,_0x3ffe1b,_0x7c34a9){var _0x2b0905=_0x7c34a9||stringOptions[_0x57f6('0xa')];var _0x31671b=_0x3ffe1b||stringOptions['secret'];var _0x4f25a9=crypto[_0x57f6('0x1b')](_0x2b0905,_0x31671b);var _0x1867ad=_0x4f25a9['update'](_0x288ab1,'base64','utf8');_0x1867ad+=_0x4f25a9[_0x57f6('0x1c')](_0x57f6('0x1f'));return _0x1867ad;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index d6d2a2a..173e8d9 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 _0x9c00=['each','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.csv','existsSync','join'];(function(_0x1c7adc,_0x481633){var _0x5d9f12=function(_0x2542ea){while(--_0x2542ea){_0x1c7adc['push'](_0x1c7adc['shift']());}};_0x5d9f12(++_0x481633);}(_0x9c00,0x1a0));var _0x09c0=function(_0x389c88,_0x46d30a){_0x389c88=_0x389c88-0x0;var _0x32b899=_0x9c00[_0x389c88];return _0x32b899;};'use strict';var util=require(_0x09c0('0x0'));var path=require(_0x09c0('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x09c0('0x2'));var zipdir=require(_0x09c0('0x3'));var rimraf=require('rimraf');var db=require(_0x09c0('0x4'))['db'];var dbH=require(_0x09c0('0x4'))[_0x09c0('0x5')];var logger=require(_0x09c0('0x6'))(_0x09c0('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x09c0('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x17d11f,_0x1b633b){var _0x3187aa={'status':_0x17d11f};var _0x17cd9d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1b633b){_0x3187aa['savename']=_0x1b633b;}return db[_0x09c0('0x9')][_0x09c0('0xa')](_0x3187aa,_0x17cd9d);}function main(){var _0xa20b5c=0x1388;var _0x1feb1d;logger[_0x09c0('0xb')](util[_0x09c0('0xc')](_0x09c0('0xd'),EXTRACTED_REPORT_ID,_0x09c0('0xe')));return db[_0x09c0('0xf')][_0x09c0('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x09c0('0x11'),_0x09c0('0x12')]})[_0x09c0('0x13')](function(_0x144271){if(_0x144271){_0x1feb1d=_0x144271;_0xa20b5c=_0x1feb1d[_0x09c0('0x12')]||0x1388;}})[_0x09c0('0x13')](function(){return dbH[_0x09c0('0x14')][_0x09c0('0x15')](util[_0x09c0('0xc')](_0x09c0('0x16'),QUERY),{'type':dbH[_0x09c0('0x14')][_0x09c0('0x17')][_0x09c0('0x18')]});})[_0x09c0('0x13')](function(_0x33c3d6){if(!_0x33c3d6[0x0][_0x09c0('0x19')]){return analyticExtractedReport('Empty');}var _0x590129=[];var _0x558b4f=0x0;var _0x42030d=!![];if(_0x33c3d6&&_0x33c3d6[_0x09c0('0x1a')]){var _0x3991c6=_0x33c3d6[0x0][_0x09c0('0x19')]%(_0x558b4f+_0xa20b5c);if(_0x1feb1d['split']){for(;_0x42030d;_0x558b4f+=_0xa20b5c,_0x3991c6=_0x33c3d6[0x0][_0x09c0('0x19')]%(_0x558b4f+_0xa20b5c)){if(_0x3991c6==0x0||_0x3991c6==_0x33c3d6[0x0]['num']){_0x42030d=![];}_0x590129['push'](dbH[_0x09c0('0x14')]['query'](util[_0x09c0('0xc')](_0x09c0('0x1b'),QUERY,_0xa20b5c,_0x558b4f),{'type':dbH[_0x09c0('0x14')]['QueryTypes'][_0x09c0('0x18')]}));}}else{_0x590129[_0x09c0('0x1c')](dbH[_0x09c0('0x14')][_0x09c0('0x15')](QUERY,{'type':dbH[_0x09c0('0x14')][_0x09c0('0x17')][_0x09c0('0x18')]}));}}var _0x5d5391=path[_0x09c0('0x1d')](PATH);var _0x46f171=path[_0x09c0('0x1e')](PATH,_0x09c0('0x1f'));var _0x59a76a=_0x1feb1d['split']&&_0x590129[_0x09c0('0x1a')]>0x1;var _0x25fdb5=[];if(!fs[_0x09c0('0x20')](path[_0x09c0('0x21')](_0x5d5391,_0x46f171))&&_0x59a76a){fs['mkdirSync'](path[_0x09c0('0x21')](_0x5d5391,_0x46f171));}return BPromise[_0x09c0('0x22')](_0x590129,function(_0x56d883){_0x25fdb5[_0x09c0('0x1c')](_0x56d883);})[_0x09c0('0x13')](function(){for(var _0x2e3d4d=0x0;_0x2e3d4d<_0x25fdb5[_0x09c0('0x1a')];_0x2e3d4d+=0x1){var _0x1f8131;var _0x1d2d9d=_0x25fdb5[_0x2e3d4d];if(_0x59a76a){_0x1f8131=path[_0x09c0('0x21')](_0x5d5391,_0x46f171,util[_0x09c0('0xc')](_0x09c0('0x23'),_0x46f171,_0x2e3d4d,_0x09c0('0x24')));}else{_0x1f8131=path[_0x09c0('0x21')](_0x5d5391,util['format'](_0x09c0('0x25'),_0x46f171,_0x09c0('0x24')));}fs['writeFileSync'](_0x1f8131,csv(_0x1d2d9d));}})[_0x09c0('0x13')](function(){if(_0x59a76a){zipdir(path['join'](_0x5d5391,_0x46f171),{'saveTo':path[_0x09c0('0x21')](_0x5d5391,util['format'](_0x09c0('0x25'),_0x46f171,_0x09c0('0x26')))},function(_0x108409,_0x4159bc){});rimraf(path['join'](_0x5d5391,_0x46f171),function(){});}})['then'](function(){logger[_0x09c0('0xb')](util[_0x09c0('0xc')](_0x09c0('0x27'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x09c0('0x28'),_0x59a76a?util['format'](_0x09c0('0x25'),_0x46f171,_0x59a76a?_0x09c0('0x26'):_0x09c0('0x24')):null);});})['catch'](function(_0x1b170d){logger[_0x09c0('0xb')](util[_0x09c0('0xc')](_0x09c0('0x29'),EXTRACTED_REPORT_ID,_0x09c0('0xe')),util[_0x09c0('0x2a')](_0x1b170d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x09c0('0x2b'));})['finally'](function(){process[_0x09c0('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x41bb=['then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','length','QueryTypes','SELECT','dirname','.csv','existsSync','mkdirSync','join','%s%d.%s','csv','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','util','path','to-csv','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','CSV','find','split','splitSizeCsv'];(function(_0x45513e,_0x433f83){var _0x59331f=function(_0x3d2c8c){while(--_0x3d2c8c){_0x45513e['push'](_0x45513e['shift']());}};_0x59331f(++_0x433f83);}(_0x41bb,0xc5));var _0xb41b=function(_0x16f4cd,_0x125cb3){_0x16f4cd=_0x16f4cd-0x0;var _0x3bb8fa=_0x41bb[_0x16f4cd];return _0x3bb8fa;};'use strict';var util=require(_0xb41b('0x0'));var path=require(_0xb41b('0x1'));var _=require('lodash');var csv=require(_0xb41b('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xb41b('0x3'));var rimraf=require(_0xb41b('0x4'));var db=require(_0xb41b('0x5'))['db'];var dbH=require(_0xb41b('0x5'))['dbH'];var logger=require(_0xb41b('0x6'))(_0xb41b('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xb41b('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x497242,_0x2704f0){var _0x29c30d={'status':_0x497242};var _0x53722a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2704f0){_0x29c30d[_0xb41b('0x9')]=_0x2704f0;}return db[_0xb41b('0xa')][_0xb41b('0xb')](_0x29c30d,_0x53722a);}function main(){var _0xa2aa66=0x1388;var _0x26d531;logger[_0xb41b('0xc')](util[_0xb41b('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb41b('0xe')));return db['Setting'][_0xb41b('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb41b('0x10'),_0xb41b('0x11')]})[_0xb41b('0x12')](function(_0x2066d5){if(_0x2066d5){_0x26d531=_0x2066d5;_0xa2aa66=_0x26d531['splitSizeCsv']||0x1388;}})[_0xb41b('0x12')](function(){return dbH[_0xb41b('0x13')][_0xb41b('0x14')](util[_0xb41b('0xd')](_0xb41b('0x15'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0xb41b('0x12')](function(_0xdc5fb0){if(!_0xdc5fb0[0x0][_0xb41b('0x16')]){return analyticExtractedReport(_0xb41b('0x17'));}var _0x29ea51=[];var _0x54591e=0x0;var _0x2f3673=!![];if(_0xdc5fb0&&_0xdc5fb0[_0xb41b('0x18')]){var _0x401dd9=_0xdc5fb0[0x0][_0xb41b('0x16')]%(_0x54591e+_0xa2aa66);if(_0x26d531[_0xb41b('0x10')]){for(;_0x2f3673;_0x54591e+=_0xa2aa66,_0x401dd9=_0xdc5fb0[0x0][_0xb41b('0x16')]%(_0x54591e+_0xa2aa66)){if(_0x401dd9==0x0||_0x401dd9==_0xdc5fb0[0x0][_0xb41b('0x16')]){_0x2f3673=![];}_0x29ea51['push'](dbH['sequelize']['query'](util[_0xb41b('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xa2aa66,_0x54591e),{'type':dbH[_0xb41b('0x13')][_0xb41b('0x19')][_0xb41b('0x1a')]}));}}else{_0x29ea51['push'](dbH['sequelize'][_0xb41b('0x14')](QUERY,{'type':dbH[_0xb41b('0x13')][_0xb41b('0x19')][_0xb41b('0x1a')]}));}}var _0x232ff1=path[_0xb41b('0x1b')](PATH);var _0x4c73da=path['basename'](PATH,_0xb41b('0x1c'));var _0x21045f=_0x26d531[_0xb41b('0x10')]&&_0x29ea51['length']>0x1;var _0x14e9c8=[];if(!fs[_0xb41b('0x1d')](path['join'](_0x232ff1,_0x4c73da))&&_0x21045f){fs[_0xb41b('0x1e')](path[_0xb41b('0x1f')](_0x232ff1,_0x4c73da));}return BPromise['each'](_0x29ea51,function(_0xed3c7e){_0x14e9c8['push'](_0xed3c7e);})[_0xb41b('0x12')](function(){for(var _0x4c6a91=0x0;_0x4c6a91<_0x14e9c8['length'];_0x4c6a91+=0x1){var _0x3af2c;var _0x4265b8=_0x14e9c8[_0x4c6a91];if(_0x21045f){_0x3af2c=path['join'](_0x232ff1,_0x4c73da,util['format'](_0xb41b('0x20'),_0x4c73da,_0x4c6a91,_0xb41b('0x21')));}else{_0x3af2c=path[_0xb41b('0x1f')](_0x232ff1,util[_0xb41b('0xd')](_0xb41b('0x22'),_0x4c73da,_0xb41b('0x21')));}fs[_0xb41b('0x23')](_0x3af2c,csv(_0x4265b8));}})['then'](function(){if(_0x21045f){zipdir(path[_0xb41b('0x1f')](_0x232ff1,_0x4c73da),{'saveTo':path[_0xb41b('0x1f')](_0x232ff1,util['format'](_0xb41b('0x22'),_0x4c73da,'zip'))},function(_0x38277f,_0x31d4cd){});rimraf(path['join'](_0x232ff1,_0x4c73da),function(){});}})[_0xb41b('0x12')](function(){logger['info'](util[_0xb41b('0xd')](_0xb41b('0x24'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xb41b('0x25'),_0x21045f?util[_0xb41b('0xd')](_0xb41b('0x22'),_0x4c73da,_0x21045f?_0xb41b('0x26'):_0xb41b('0x21')):null);});})[_0xb41b('0x27')](function(_0x157048){logger[_0xb41b('0xc')](util[_0xb41b('0xd')](_0xb41b('0x28'),EXTRACTED_REPORT_ID,'CSV'),util[_0xb41b('0x29')](_0x157048,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xb41b('0x2a')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 5b66903..9170856 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 _0xf551=['Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','PDF','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','error','end','createPdfFromHTML','lodash','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','name','startDate','header','pageBreak','before','landscape','\x20/\x20','footer','black','right','num','dirname','basename','pdf','Setting','split','splitSizePdf','then','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','all','flatten','createPdfKitDocument','%s%d.%s','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV'];(function(_0x29782b,_0x33ff83){var _0x5c2c1f=function(_0x57e6b6){while(--_0x57e6b6){_0x29782b['push'](_0x29782b['shift']());}};_0x5c2c1f(++_0x33ff83);}(_0xf551,0x1df));var _0x1f55=function(_0x42476f,_0xc14d8c){_0x42476f=_0x42476f-0x0;var _0x53fcd1=_0xf551[_0x42476f];return _0x53fcd1;};'use strict';var _=require(_0x1f55('0x0'));var fs=require('fs');var util=require(_0x1f55('0x1'));var path=require(_0x1f55('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0x1f55('0x3'));var PdfPrinter=require(_0x1f55('0x4'));var zipdir=require(_0x1f55('0x5'));var rimraf=require(_0x1f55('0x6'));var JSDOM=require(_0x1f55('0x7'))[_0x1f55('0x8')];var window=new JSDOM('')[_0x1f55('0x9')];var db=require(_0x1f55('0xa'))['db'];var dbH=require(_0x1f55('0xa'))[_0x1f55('0xb')];var logger=require(_0x1f55('0xc'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x1f55('0xd')][0x2]);var QUERY=process[_0x1f55('0xd')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x1f55('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x364945,_0x1d924a){var _0x2d74c0={'status':_0x364945};var _0x1c9b6f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1d924a){_0x2d74c0[_0x1f55('0xf')]=_0x1d924a;}return db[_0x1f55('0x10')]['update'](_0x2d74c0,_0x1c9b6f);}function getHeaders(_0x2463cf){return _[_0x1f55('0x11')](_0x2463cf,function(_0x1364fc){return{'text':_0x1364fc,'style':_0x1f55('0x12')};});}function getRows(_0x236a5c,_0x11b677){return _[_0x1f55('0x11')](_0x11b677,function(_0x533413){return _(_0x533413)[_0x1f55('0x13')](_0x236a5c)['map'](function(_0x363663){return _0x363663?_[_0x1f55('0x14')](_0x363663):'';})[_0x1f55('0x15')]();});}function createTable(_0x213440,_0x32a869){var _0x304873={'widths':_[_0x1f55('0x16')](Array(_0x213440[_0x1f55('0x17')]),0x91),'heights':function(_0x1041d8){return _0x1041d8===0x0?_0x1f55('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4c4e6d=getHeaders(_0x213440);_0x304873[_0x1f55('0x19')][_0x1f55('0x1a')](_0x4c4e6d);var _0xd4029e=getRows(_0x213440,_0x32a869);_0x304873[_0x1f55('0x19')]=_0x304873[_0x1f55('0x19')][_0x1f55('0x1b')](_0xd4029e);return _0x304873;}function createTables(_0x205c78){var _0x3bc6b8=[];var _0x16f2a3=_[_0x1f55('0x1c')](Object[_0x1f55('0x1d')](_0x205c78[0x0]),0x5);_0x16f2a3[_0x1f55('0x1e')](function(_0x18ba5c){_0x3bc6b8[_0x1f55('0x1a')](createTable(_0x18ba5c,_0x205c78));});return _0x3bc6b8;}function getPDFDocDefinition(_0x11d533){var _0xdef9f6=util[_0x1f55('0x1f')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x1f55('0x20')],moment(EXTRACTED_REPORT[_0x1f55('0x21')])[_0x1f55('0x1f')](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x5b10cd=[];for(var _0x1ea21f=0x0;_0x1ea21f<_0x11d533['length'];_0x1ea21f++){var _0x59c80a=[];if(_0x1ea21f===0x0){_0x59c80a['push']({'text':_0xdef9f6,'style':_0x1f55('0x22')});}var _0x25586c={'table':_0x11d533[_0x1ea21f]};if(_0x1ea21f>0x0){_0x25586c[_0x1f55('0x23')]=_0x1f55('0x24');_0x25586c['margin']=[0x0,0x46,0x0,0x0];}_0x59c80a[_0x1f55('0x1a')](_0x25586c);_0x5b10cd['push'](_0x59c80a);}return{'pageSize':'A4','pageOrientation':_0x1f55('0x25'),'content':_0x5b10cd,'footer':function(_0x472bde,_0x4a3149){return{'text':_0x472bde['toString']()+_0x1f55('0x26')+_0x4a3149,'style':_0x1f55('0x27')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1f55('0x28')},'footer':{'alignment':_0x1f55('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x515912){var _0x252a18=0x1388;var _0x2bac79;if(!_0x515912[0x0][_0x1f55('0x2a')]){return analyticExtractedReport('Empty');}var _0x1fd188=[];var _0x38815d=0x0;var _0xeaa1c7=!![];var _0x3bf046=path[_0x1f55('0x2b')](PATH);var _0x3fc81e=path[_0x1f55('0x2c')](PATH,'.pdf');var _0x6d2ae=path['join'](_0x3bf046,util[_0x1f55('0x1f')]('%s.%s',_0x3fc81e,_0x1f55('0x2d')));var _0x3828fe=![];return db[_0x1f55('0x2e')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1f55('0x2f'),_0x1f55('0x30')]})[_0x1f55('0x31')](function(_0x70f5e7){if(_0x70f5e7){_0x2bac79=_0x70f5e7;_0x252a18=_0x2bac79[_0x1f55('0x30')]||0x3e8;}})[_0x1f55('0x31')](function(){if(_0x515912&&_0x515912[_0x1f55('0x17')]){var _0x468bcb=_0x515912[0x0][_0x1f55('0x2a')]%(_0x38815d+_0x252a18);if(_0x2bac79[_0x1f55('0x2f')]){for(;_0xeaa1c7;_0x38815d+=_0x252a18,_0x468bcb=_0x515912[0x0][_0x1f55('0x2a')]%(_0x38815d+_0x252a18)){if(_0x468bcb==0x0||_0x468bcb==_0x515912[0x0][_0x1f55('0x2a')]){_0xeaa1c7=![];}_0x1fd188[_0x1f55('0x1a')](dbH[_0x1f55('0x32')][_0x1f55('0x33')](util[_0x1f55('0x1f')](_0x1f55('0x34'),QUERY,_0x252a18,_0x38815d),{'type':dbH['sequelize'][_0x1f55('0x35')][_0x1f55('0x36')]}));}}else{_0x1fd188[_0x1f55('0x1a')](dbH[_0x1f55('0x32')][_0x1f55('0x33')](QUERY,{'type':dbH[_0x1f55('0x32')][_0x1f55('0x35')][_0x1f55('0x36')]}));}}_0x3828fe=_0x2bac79[_0x1f55('0x2f')]&&_0x1fd188['length']>0x1;if(!fs[_0x1f55('0x37')](path[_0x1f55('0x38')](_0x3bf046,_0x3fc81e))&&_0x3828fe){fs[_0x1f55('0x39')](path['join'](_0x3bf046,_0x3fc81e));}return Promise[_0x1f55('0x3a')](_0x1fd188);})[_0x1f55('0x31')](function(_0x486467){return createTables(_[_0x1f55('0x3b')](_0x486467));})[_0x1f55('0x31')](function(_0x3b95c5){var _0x6f76ff=getPDFDocDefinition(_0x3b95c5);var _0x44ab69=getPDFPrinter();var _0x393454=_0x44ab69[_0x1f55('0x3c')](_0x6f76ff);if(_0x3828fe)_0x6d2ae=path['join'](_0x3bf046,_0x3fc81e,util['format'](_0x1f55('0x3d'),_0x3fc81e,index,_0x1f55('0x2d')));return writePDFDocument(_0x393454,_0x6d2ae);})[_0x1f55('0x31')](function(){if(!_0x3828fe)return;zipdir(path[_0x1f55('0x38')](_0x3bf046,_0x3fc81e),{'saveTo':path[_0x1f55('0x38')](_0x3bf046,util[_0x1f55('0x1f')](_0x1f55('0x3e'),_0x3fc81e,_0x1f55('0x3f')))},function(_0x3692b0){if(_0x3692b0)throw _0x3692b0;return;});})[_0x1f55('0x31')](function(){if(!_0x3828fe)return;rimraf(path[_0x1f55('0x38')](_0x3bf046,_0x3fc81e),function(){});})[_0x1f55('0x31')](function(){logger[_0x1f55('0x40')](util[_0x1f55('0x1f')](_0x1f55('0x41'),EXTRACTED_REPORT_ID,_0x1f55('0x42')));return analyticExtractedReport(_0x1f55('0x43'),_0x3828fe?util[_0x1f55('0x1f')](_0x1f55('0x3e'),_0x3fc81e,_0x3828fe?_0x1f55('0x3f'):_0x1f55('0x2d')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1f55('0x40')](util[_0x1f55('0x1f')](_0x1f55('0x44'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x1f55('0x10')][_0x1f55('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1f55('0x31')](function(_0x1a5c83){EXTRACTED_REPORT=_0x1a5c83;return dbH[_0x1f55('0x32')]['query'](util[_0x1f55('0x1f')](_0x1f55('0x46'),QUERY),{'type':dbH['sequelize'][_0x1f55('0x35')][_0x1f55('0x36')]});})[_0x1f55('0x31')](extractReport)[_0x1f55('0x47')](function(_0x52b00d){logger[_0x1f55('0x40')](util[_0x1f55('0x1f')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1f55('0x48')),util[_0x1f55('0x49')](_0x52b00d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1f55('0x4a'));})['finally'](function(){process[_0x1f55('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2064fc=new PdfPrinter({'Arial':{'normal':__dirname+_0x1f55('0x4c'),'bold':__dirname+_0x1f55('0x4d'),'italics':__dirname+_0x1f55('0x4e'),'bolditalics':__dirname+_0x1f55('0x4f')}});return _0x2064fc;}function getPDFDocDefinitionFromHTML(_0x35c2b3,_0x463dc0){var _0x19b560=util[_0x1f55('0x1f')](_0x1f55('0x50'),_0x463dc0[_0x1f55('0x51')],_0x463dc0[_0x1f55('0x52')]);var _0x1c4e30=moment()['format'](_0x1f55('0x53'))['toString']();var _0x1fa138=htmlToPdfmake(_0x35c2b3,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1fa138],'defaultStyle':{'font':_0x1f55('0x54')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x1f55('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x1f55('0x55')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x1f55('0x22')}];},'footer':function(_0x412c50,_0x27cdc9){return[{'text':util[_0x1f55('0x1f')](_0x1f55('0x56'),_0x19b560,_0x412c50,_0x27cdc9,_0x1c4e30),'style':_0x1f55('0x27')}];}};}function writePDFDocument(_0x140a37,_0x482e16){return new Promise(function(_0x319381,_0x2acf22){var _0x3775a4=_0x140a37['pipe'](fs['createWriteStream'](_0x482e16));_0x3775a4['on'](_0x1f55('0x57'),function(){_0x319381(_0x1f55('0x57'));});_0x3775a4['on'](_0x1f55('0x58'),function(_0x461389){_0x2acf22(_0x461389);});_0x140a37[_0x1f55('0x59')]();});}exports[_0x1f55('0x5a')]=function(_0x31c14d,_0x30e267){var _0x209deb=getPDFPrinter();var _0x1cee19=getPDFDocDefinitionFromHTML(_0x31c14d,_0x30e267);var _0x62650f=_0x209deb[_0x1f55('0x3c')](_0x1cee19);return writePDFDocument(_0x62650f,_0x30e267[_0x1f55('0x2')])[_0x1f55('0x47')](function(_0x21555b){throw _0x21555b;});}; \ No newline at end of file +var _0xbca7=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','value','fill','auto','body','push','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','length','pageBreak','before','margin','toString','\x20/\x20','footer','Arial','black','right','num','Empty','dirname','basename','.pdf','join','%s.%s','pdf','Setting','split','splitSizePdf','then','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','mkdirSync','createPdfKitDocument','%s%d.%s','zip','info','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne'];(function(_0x55123f,_0x15d8ec){var _0x5de0f0=function(_0x24473c){while(--_0x24473c){_0x55123f['push'](_0x55123f['shift']());}};_0x5de0f0(++_0x15d8ec);}(_0xbca7,0xd2));var _0x7bca=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xbca7[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x7bca('0x0'));var fs=require('fs');var util=require(_0x7bca('0x1'));var path=require(_0x7bca('0x2'));var moment=require(_0x7bca('0x3'));var htmlToPdfmake=require(_0x7bca('0x4'));var PdfPrinter=require(_0x7bca('0x5'));var zipdir=require(_0x7bca('0x6'));var rimraf=require(_0x7bca('0x7'));var JSDOM=require(_0x7bca('0x8'))[_0x7bca('0x9')];var window=new JSDOM('')[_0x7bca('0xa')];var db=require(_0x7bca('0xb'))['db'];var dbH=require('../../mysqldb')[_0x7bca('0xc')];var logger=require(_0x7bca('0xd'))(_0x7bca('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0x7bca('0xf')][0x2]);var QUERY=process[_0x7bca('0xf')][0x3];var PATH=process[_0x7bca('0xf')][0x4];var NAME=process[_0x7bca('0xf')][0x5];var FORMAT=_0x7bca('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x497120,_0x83c1a8){var _0x42eeaf={'status':_0x497120};var _0x4433b3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x83c1a8){_0x42eeaf[_0x7bca('0x11')]=_0x83c1a8;}return db[_0x7bca('0x12')][_0x7bca('0x13')](_0x42eeaf,_0x4433b3);}function getHeaders(_0x20449a){return _[_0x7bca('0x14')](_0x20449a,function(_0x2af58c){return{'text':_0x2af58c,'style':'tableHeader'};});}function getRows(_0x8be5e2,_0x337ce3){return _[_0x7bca('0x14')](_0x337ce3,function(_0x4d94f3){return _(_0x4d94f3)['pick'](_0x8be5e2)['map'](function(_0x23cbdf){return _0x23cbdf?_['toString'](_0x23cbdf):'';})[_0x7bca('0x15')]();});}function createTable(_0x40d912,_0x401be3){var _0x1e89c6={'widths':_[_0x7bca('0x16')](Array(_0x40d912['length']),0x91),'heights':function(_0x2a9514){return _0x2a9514===0x0?_0x7bca('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x926810=getHeaders(_0x40d912);_0x1e89c6[_0x7bca('0x18')][_0x7bca('0x19')](_0x926810);var _0x38e87a=getRows(_0x40d912,_0x401be3);_0x1e89c6[_0x7bca('0x18')]=_0x1e89c6[_0x7bca('0x18')][_0x7bca('0x1a')](_0x38e87a);return _0x1e89c6;}function createTables(_0x101cc2){var _0x554c91=[];var _0x8e7508=_[_0x7bca('0x1b')](Object[_0x7bca('0x1c')](_0x101cc2[0x0]),0x5);_0x8e7508[_0x7bca('0x1d')](function(_0x356c9b){_0x554c91[_0x7bca('0x19')](createTable(_0x356c9b,_0x101cc2));});return _0x554c91;}function getPDFDocDefinition(_0x5132fe){var _0xb62fce=util['format'](_0x7bca('0x1e'),NAME,EXTRACTED_REPORT[_0x7bca('0x1f')],moment(EXTRACTED_REPORT[_0x7bca('0x20')])[_0x7bca('0x21')](FORMAT),moment(EXTRACTED_REPORT[_0x7bca('0x22')])['format'](FORMAT));var _0x43c41e=[];for(var _0x532cca=0x0;_0x532cca<_0x5132fe[_0x7bca('0x23')];_0x532cca++){var _0x5265bf=[];if(_0x532cca===0x0){_0x5265bf[_0x7bca('0x19')]({'text':_0xb62fce,'style':'header'});}var _0x5c9a1b={'table':_0x5132fe[_0x532cca]};if(_0x532cca>0x0){_0x5c9a1b[_0x7bca('0x24')]=_0x7bca('0x25');_0x5c9a1b[_0x7bca('0x26')]=[0x0,0x46,0x0,0x0];}_0x5265bf[_0x7bca('0x19')](_0x5c9a1b);_0x43c41e['push'](_0x5265bf);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x43c41e,'footer':function(_0x5f22b4,_0x378a54){return{'text':_0x5f22b4[_0x7bca('0x27')]()+_0x7bca('0x28')+_0x378a54,'style':_0x7bca('0x29')};},'defaultStyle':{'font':_0x7bca('0x2a')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x7bca('0x2b')},'footer':{'alignment':_0x7bca('0x2c'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x296bfe){var _0x5c3ebc=0x1388;var _0x516ceb;if(!_0x296bfe[0x0][_0x7bca('0x2d')]){return analyticExtractedReport(_0x7bca('0x2e'));}var _0x55afce=[];var _0x2f1488=0x0;var _0x13a204=!![];var _0x1a9f29=path[_0x7bca('0x2f')](PATH);var _0x407d5d=path[_0x7bca('0x30')](PATH,_0x7bca('0x31'));var _0x3084f6=path[_0x7bca('0x32')](_0x1a9f29,util[_0x7bca('0x21')](_0x7bca('0x33'),_0x407d5d,_0x7bca('0x34')));var _0x5d3d46=![];return db[_0x7bca('0x35')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7bca('0x36'),_0x7bca('0x37')]})[_0x7bca('0x38')](function(_0x11af01){if(_0x11af01){_0x516ceb=_0x11af01;_0x5c3ebc=_0x516ceb['splitSizePdf']||0x3e8;}})[_0x7bca('0x38')](function(){if(_0x296bfe&&_0x296bfe[_0x7bca('0x23')]){var _0x4e9ca4=_0x296bfe[0x0][_0x7bca('0x2d')]%(_0x2f1488+_0x5c3ebc);if(_0x516ceb['split']){for(;_0x13a204;_0x2f1488+=_0x5c3ebc,_0x4e9ca4=_0x296bfe[0x0][_0x7bca('0x2d')]%(_0x2f1488+_0x5c3ebc)){if(_0x4e9ca4==0x0||_0x4e9ca4==_0x296bfe[0x0][_0x7bca('0x2d')]){_0x13a204=![];}_0x55afce[_0x7bca('0x19')](dbH[_0x7bca('0x39')][_0x7bca('0x3a')](util[_0x7bca('0x21')](_0x7bca('0x3b'),QUERY,_0x5c3ebc,_0x2f1488),{'type':dbH[_0x7bca('0x39')][_0x7bca('0x3c')][_0x7bca('0x3d')]}));}}else{_0x55afce[_0x7bca('0x19')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x7bca('0x39')][_0x7bca('0x3c')][_0x7bca('0x3d')]}));}}_0x5d3d46=_0x516ceb['split']&&_0x55afce[_0x7bca('0x23')]>0x1;if(!fs['existsSync'](path[_0x7bca('0x32')](_0x1a9f29,_0x407d5d))&&_0x5d3d46){fs[_0x7bca('0x3e')](path[_0x7bca('0x32')](_0x1a9f29,_0x407d5d));}return Promise['all'](_0x55afce);})[_0x7bca('0x38')](function(_0x5a06bf){return createTables(_['flatten'](_0x5a06bf));})['then'](function(_0x3a4a03){var _0x4d47ce=getPDFDocDefinition(_0x3a4a03);var _0x189dea=getPDFPrinter();var _0x452afb=_0x189dea[_0x7bca('0x3f')](_0x4d47ce);if(_0x5d3d46)_0x3084f6=path[_0x7bca('0x32')](_0x1a9f29,_0x407d5d,util[_0x7bca('0x21')](_0x7bca('0x40'),_0x407d5d,index,'pdf'));return writePDFDocument(_0x452afb,_0x3084f6);})['then'](function(){if(!_0x5d3d46)return;zipdir(path[_0x7bca('0x32')](_0x1a9f29,_0x407d5d),{'saveTo':path[_0x7bca('0x32')](_0x1a9f29,util[_0x7bca('0x21')](_0x7bca('0x33'),_0x407d5d,_0x7bca('0x41')))},function(_0x484886){if(_0x484886)throw _0x484886;return;});})[_0x7bca('0x38')](function(){if(!_0x5d3d46)return;rimraf(path[_0x7bca('0x32')](_0x1a9f29,_0x407d5d),function(){});})['then'](function(){logger[_0x7bca('0x42')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x7bca('0x43')));return analyticExtractedReport(_0x7bca('0x44'),_0x5d3d46?util[_0x7bca('0x21')](_0x7bca('0x33'),_0x407d5d,_0x5d3d46?_0x7bca('0x41'):_0x7bca('0x34')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x7bca('0x42')](util[_0x7bca('0x21')](_0x7bca('0x45'),EXTRACTED_REPORT_ID,_0x7bca('0x46')));return db[_0x7bca('0x12')][_0x7bca('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x7bca('0x38')](function(_0xf010e7){EXTRACTED_REPORT=_0xf010e7;return dbH[_0x7bca('0x39')][_0x7bca('0x3a')](util[_0x7bca('0x21')](_0x7bca('0x48'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x7bca('0x3d')]});})[_0x7bca('0x38')](extractReport)[_0x7bca('0x49')](function(_0x4683b3){logger[_0x7bca('0x42')](util[_0x7bca('0x21')](_0x7bca('0x4a'),EXTRACTED_REPORT_ID,_0x7bca('0x46')),util[_0x7bca('0x4b')](_0x4683b3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7bca('0x4c'));})['finally'](function(){process[_0x7bca('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x43bd80=new PdfPrinter({'Arial':{'normal':__dirname+_0x7bca('0x4e'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x7bca('0x4f'),'bolditalics':__dirname+_0x7bca('0x50')}});return _0x43bd80;}function getPDFDocDefinitionFromHTML(_0x4e3f6d,_0x4d7ac1){var _0x43f9d7=util[_0x7bca('0x21')](_0x7bca('0x51'),_0x4d7ac1['channel'],_0x4d7ac1[_0x7bca('0x52')]);var _0xccb663=moment()[_0x7bca('0x21')](_0x7bca('0x53'))['toString']();var _0x2a38b1=htmlToPdfmake(_0x4e3f6d,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2a38b1],'defaultStyle':{'font':_0x7bca('0x2a')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x7bca('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x7bca('0x54')}},'header':function(){return[{'text':_0x7bca('0x55'),'style':_0x7bca('0x56')}];},'footer':function(_0x2b4c1e,_0x23bb4e){return[{'text':util[_0x7bca('0x21')](_0x7bca('0x57'),_0x43f9d7,_0x2b4c1e,_0x23bb4e,_0xccb663),'style':'footer'}];}};}function writePDFDocument(_0x3972b2,_0x1a99c5){return new Promise(function(_0x5c0da8,_0x460edc){var _0x17a55c=_0x3972b2[_0x7bca('0x58')](fs[_0x7bca('0x59')](_0x1a99c5));_0x17a55c['on'](_0x7bca('0x5a'),function(){_0x5c0da8(_0x7bca('0x5a'));});_0x17a55c['on'](_0x7bca('0x5b'),function(_0x45fd37){_0x460edc(_0x45fd37);});_0x3972b2[_0x7bca('0x5c')]();});}exports[_0x7bca('0x5d')]=function(_0xc04e29,_0x598676){var _0x5238cb=getPDFPrinter();var _0x5f17ca=getPDFDocDefinitionFromHTML(_0xc04e29,_0x598676);var _0x249548=_0x5238cb[_0x7bca('0x3f')](_0x5f17ca);return writePDFDocument(_0x249548,_0x598676[_0x7bca('0x2')])[_0x7bca('0x49')](function(_0x326bd4){throw _0x326bd4;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 7d1ff77..71aa795 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 _0xbe70=['rimraf','../../mysqldb','dbH','analytics','argv','savename','update','info','format','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','split','length','QueryTypes','push','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','path','lodash','json2xls','zip-dir'];(function(_0x4c1d61,_0x3d1cc0){var _0x3b470f=function(_0x1bf9d1){while(--_0x1bf9d1){_0x4c1d61['push'](_0x4c1d61['shift']());}};_0x3b470f(++_0x3d1cc0);}(_0xbe70,0xd3));var _0x0be7=function(_0x1e68f4,_0x1c72bf){_0x1e68f4=_0x1e68f4-0x0;var _0x4229cd=_0xbe70[_0x1e68f4];return _0x4229cd;};'use strict';var util=require('util');var path=require(_0x0be7('0x0'));var _=require(_0x0be7('0x1'));var fs=require('fs');var json2xls=require(_0x0be7('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x0be7('0x3'));var rimraf=require(_0x0be7('0x4'));var db=require(_0x0be7('0x5'))['db'];var dbH=require('../../mysqldb')[_0x0be7('0x6')];var logger=require('../../config/logger')(_0x0be7('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x0be7('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x0be7('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3cc27e,_0x4fb26f){var _0x43378a={'status':_0x3cc27e};var _0x109da2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4fb26f){_0x43378a[_0x0be7('0x9')]=_0x4fb26f;}return db['AnalyticExtractedReport'][_0x0be7('0xa')](_0x43378a,_0x109da2);}function main(){var _0x5a3afe=0x1388;var _0x88434a;logger[_0x0be7('0xb')](util[_0x0be7('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0x0be7('0xd')][_0x0be7('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0be7('0xf')]})['then'](function(_0x4f9abf){if(_0x4f9abf){_0x88434a=_0x4f9abf;_0x5a3afe=_0x88434a[_0x0be7('0xf')]||0x1388;}})[_0x0be7('0x10')](function(){return dbH[_0x0be7('0x11')][_0x0be7('0x12')](util[_0x0be7('0xc')](_0x0be7('0x13'),QUERY),{'type':dbH[_0x0be7('0x11')]['QueryTypes'][_0x0be7('0x14')]});})['then'](function(_0x3e2fec){if(!_0x3e2fec[0x0][_0x0be7('0x15')]){return analyticExtractedReport('Empty');}var _0x38677e=[];var _0x19f2e0=0x0;var _0x555709=!![];if(_0x88434a[_0x0be7('0x16')]){if(_0x3e2fec&&_0x3e2fec[_0x0be7('0x17')]){var _0x416481=_0x3e2fec[0x0][_0x0be7('0x15')]%(_0x19f2e0+_0x5a3afe);for(;_0x555709;_0x19f2e0+=_0x5a3afe,_0x416481=_0x3e2fec[0x0][_0x0be7('0x15')]%(_0x19f2e0+_0x5a3afe)){if(_0x416481==0x0||_0x416481==_0x3e2fec[0x0][_0x0be7('0x15')]){_0x555709=![];}_0x38677e['push'](dbH[_0x0be7('0x11')][_0x0be7('0x12')](util[_0x0be7('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5a3afe,_0x19f2e0),{'type':dbH[_0x0be7('0x11')][_0x0be7('0x18')][_0x0be7('0x14')]}));}}}else{_0x38677e[_0x0be7('0x19')](dbH['sequelize'][_0x0be7('0x12')](QUERY,{'type':dbH['sequelize'][_0x0be7('0x18')][_0x0be7('0x14')]}));}var _0x4e25e3=path['dirname'](PATH);var _0x361e4d=path['basename'](PATH,_0x0be7('0x1a'));var _0x82ab3d=_0x88434a[_0x0be7('0x16')]&&_0x38677e[_0x0be7('0x17')]>0x1;var _0x1c3258=[];if(!fs[_0x0be7('0x1b')](path[_0x0be7('0x1c')](_0x4e25e3,_0x361e4d))&&_0x82ab3d){fs[_0x0be7('0x1d')](path[_0x0be7('0x1c')](_0x4e25e3,_0x361e4d));}return BPromise[_0x0be7('0x1e')](_0x38677e,function(_0x2ef3ba){_0x1c3258[_0x0be7('0x19')](_0x2ef3ba);})[_0x0be7('0x10')](function(){for(var _0x58d394=0x0;_0x58d394<_0x1c3258[_0x0be7('0x17')];_0x58d394+=0x1){var _0x7607f;var _0x2f6910=_0x1c3258[_0x58d394];if(_0x82ab3d){_0x7607f=path[_0x0be7('0x1c')](_0x4e25e3,_0x361e4d,util['format'](_0x0be7('0x1f'),_0x361e4d,_0x58d394,_0x0be7('0x20')));}else{_0x7607f=path[_0x0be7('0x1c')](_0x4e25e3,util['format'](_0x0be7('0x21'),_0x361e4d,'xlsx'));}fs[_0x0be7('0x22')](_0x7607f,json2xls(_0x2f6910),_0x0be7('0x23'));}})['then'](function(){if(_0x82ab3d){zipdir(path[_0x0be7('0x1c')](_0x4e25e3,_0x361e4d),{'saveTo':path['join'](_0x4e25e3,util[_0x0be7('0xc')]('%s.%s',_0x361e4d,'zip'))},function(_0x59996f,_0x113286){});rimraf(path[_0x0be7('0x1c')](_0x4e25e3,_0x361e4d),function(){});}})[_0x0be7('0x10')](function(){logger[_0x0be7('0xb')](util[_0x0be7('0xc')](_0x0be7('0x24'),EXTRACTED_REPORT_ID,_0x0be7('0x25')));return analyticExtractedReport(_0x0be7('0x26'),_0x82ab3d?util[_0x0be7('0xc')](_0x0be7('0x21'),_0x361e4d,_0x82ab3d?_0x0be7('0x27'):_0x0be7('0x20')):null);});})['catch'](function(_0x256770){logger[_0x0be7('0xb')](util[_0x0be7('0xc')](_0x0be7('0x28'),EXTRACTED_REPORT_ID,_0x0be7('0x25')),util[_0x0be7('0x29')](_0x256770,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0be7('0x2a')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xdbe8=['writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','rimraf','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','split','length','num','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0xdbe8,0x14c));var _0x8dbe=function(_0x545589,_0x40fc2e){_0x545589=_0x545589-0x0;var _0x3dc4de=_0xdbe8[_0x545589];return _0x3dc4de;};'use strict';var util=require(_0x8dbe('0x0'));var path=require(_0x8dbe('0x1'));var _=require(_0x8dbe('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x8dbe('0x3'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x8dbe('0x4')];var logger=require(_0x8dbe('0x5'))(_0x8dbe('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x8dbe('0x7')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5cf7fa,_0x3c4adc){var _0x51ce98={'status':_0x5cf7fa};var _0x51fd13={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3c4adc){_0x51ce98['savename']=_0x3c4adc;}return db[_0x8dbe('0x8')]['update'](_0x51ce98,_0x51fd13);}function main(){var _0x4d9844=0x1388;var _0x2b27fa;logger[_0x8dbe('0x9')](util[_0x8dbe('0xa')](_0x8dbe('0xb'),EXTRACTED_REPORT_ID,_0x8dbe('0xc')));return db[_0x8dbe('0xd')][_0x8dbe('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8dbe('0xf')]})[_0x8dbe('0x10')](function(_0x37d667){if(_0x37d667){_0x2b27fa=_0x37d667;_0x4d9844=_0x2b27fa[_0x8dbe('0xf')]||0x1388;}})[_0x8dbe('0x10')](function(){return dbH[_0x8dbe('0x11')][_0x8dbe('0x12')](util[_0x8dbe('0xa')](_0x8dbe('0x13'),QUERY),{'type':dbH[_0x8dbe('0x11')][_0x8dbe('0x14')][_0x8dbe('0x15')]});})[_0x8dbe('0x10')](function(_0x532351){if(!_0x532351[0x0]['num']){return analyticExtractedReport(_0x8dbe('0x16'));}var _0x170457=[];var _0x15cc66=0x0;var _0x397f61=!![];if(_0x2b27fa[_0x8dbe('0x17')]){if(_0x532351&&_0x532351[_0x8dbe('0x18')]){var _0x2ea18d=_0x532351[0x0][_0x8dbe('0x19')]%(_0x15cc66+_0x4d9844);for(;_0x397f61;_0x15cc66+=_0x4d9844,_0x2ea18d=_0x532351[0x0][_0x8dbe('0x19')]%(_0x15cc66+_0x4d9844)){if(_0x2ea18d==0x0||_0x2ea18d==_0x532351[0x0][_0x8dbe('0x19')]){_0x397f61=![];}_0x170457['push'](dbH[_0x8dbe('0x11')][_0x8dbe('0x12')](util['format'](_0x8dbe('0x1a'),QUERY,_0x4d9844,_0x15cc66),{'type':dbH[_0x8dbe('0x11')][_0x8dbe('0x14')][_0x8dbe('0x15')]}));}}}else{_0x170457[_0x8dbe('0x1b')](dbH[_0x8dbe('0x11')][_0x8dbe('0x12')](QUERY,{'type':dbH[_0x8dbe('0x11')]['QueryTypes'][_0x8dbe('0x15')]}));}var _0x384968=path[_0x8dbe('0x1c')](PATH);var _0xd2430e=path['basename'](PATH,'.xlsx');var _0x47b82f=_0x2b27fa[_0x8dbe('0x17')]&&_0x170457[_0x8dbe('0x18')]>0x1;var _0x19b3e1=[];if(!fs[_0x8dbe('0x1d')](path[_0x8dbe('0x1e')](_0x384968,_0xd2430e))&&_0x47b82f){fs[_0x8dbe('0x1f')](path[_0x8dbe('0x1e')](_0x384968,_0xd2430e));}return BPromise[_0x8dbe('0x20')](_0x170457,function(_0x5de65d){_0x19b3e1[_0x8dbe('0x1b')](_0x5de65d);})[_0x8dbe('0x10')](function(){for(var _0x521c30=0x0;_0x521c30<_0x19b3e1[_0x8dbe('0x18')];_0x521c30+=0x1){var _0x45c986;var _0xb57310=_0x19b3e1[_0x521c30];if(_0x47b82f){_0x45c986=path[_0x8dbe('0x1e')](_0x384968,_0xd2430e,util[_0x8dbe('0xa')](_0x8dbe('0x21'),_0xd2430e,_0x521c30,_0x8dbe('0x22')));}else{_0x45c986=path[_0x8dbe('0x1e')](_0x384968,util[_0x8dbe('0xa')](_0x8dbe('0x23'),_0xd2430e,_0x8dbe('0x22')));}fs[_0x8dbe('0x24')](_0x45c986,json2xls(_0xb57310),_0x8dbe('0x25'));}})[_0x8dbe('0x10')](function(){if(_0x47b82f){zipdir(path['join'](_0x384968,_0xd2430e),{'saveTo':path[_0x8dbe('0x1e')](_0x384968,util[_0x8dbe('0xa')](_0x8dbe('0x23'),_0xd2430e,_0x8dbe('0x26')))},function(_0x5472c4,_0x3a1a15){});rimraf(path[_0x8dbe('0x1e')](_0x384968,_0xd2430e),function(){});}})[_0x8dbe('0x10')](function(){logger[_0x8dbe('0x9')](util[_0x8dbe('0xa')](_0x8dbe('0x27'),EXTRACTED_REPORT_ID,_0x8dbe('0xc')));return analyticExtractedReport(_0x8dbe('0x28'),_0x47b82f?util[_0x8dbe('0xa')](_0x8dbe('0x23'),_0xd2430e,_0x47b82f?'zip':_0x8dbe('0x22')):null);});})[_0x8dbe('0x29')](function(_0x476975){logger[_0x8dbe('0x9')](util[_0x8dbe('0xa')](_0x8dbe('0x2a'),EXTRACTED_REPORT_ID,_0x8dbe('0xc')),util['inspect'](_0x476975,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8dbe('0x2b'));})[_0x8dbe('0x2c')](function(){process[_0x8dbe('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index f2f3b50..23a8e88 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 _0x314c=['extensions','extension','find','type','format','CDR(type)=%s','context','VoiceExtensionId','Set','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','priority','push','ExecIf','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','*,*,*,*','interval','hasOwnProperty','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','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','rewrite','models','findAll','intervals','VoiceExtension','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback'];(function(_0x2bd881,_0x476731){var _0x2e7269=function(_0x176311){while(--_0x176311){_0x2bd881['push'](_0x2bd881['shift']());}};_0x2e7269(++_0x476731);}(_0x314c,0x1dc));var _0xc314=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x314c[_0x31ced5];return _0x10d9e5;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x214165,_0x52c6a7){var _0x569fa9=this;return _0x214165[_0xc314('0x0')]['Interval'][_0xc314('0x1')]({'raw':!![]})['then'](function(_0x1e49d0){_0x569fa9[_0xc314('0x2')]=_0x1e49d0;return _0x214165[_0xc314('0x0')][_0xc314('0x3')][_0xc314('0x1')]({'where':{'IntervalId':_0x52c6a7[_0xc314('0x4')]},'raw':!![]});})[_0xc314('0x5')](function(_0x5d7daf){return _0x214165[_0xc314('0x0')]['VoiceExtension'][_0xc314('0x1')]({'where':{'exten':{'$in':_[_0xc314('0x6')](_[_0xc314('0x7')](_0x5d7daf,_0xc314('0x8')))}},'order':[{'raw':_0xc314('0x9')}],'raw':!![]});})[_0xc314('0x5')](function(_0x531e90){var _0x3976a8=_['filter'](_0x531e90,{'priority':'1'});var _0x268f89=_[_0xc314('0xa')](_0x531e90,{'isApp':0x1});var _0x19b9de=_[_0xc314('0xb')](_0x268f89,_0xc314('0x8'));var _0x5a5c0a=[_0xc314('0xc'),_0xc314('0xd')];var _0x4685e0=[];var _0x1005c8=[];for(var _0x4003ad in _0x19b9de){if(_0x19b9de['hasOwnProperty'](_0x4003ad)){_0x569fa9['priority']=0x2;_0x569fa9[_0xc314('0xe')]=[];_0x569fa9[_0xc314('0xf')]=_[_0xc314('0x10')](_0x3976a8,{'exten':_0x19b9de[_0x4003ad][0x0][_0xc314('0x8')]});_0x569fa9[_0xc314('0xe')]['push']({'type':_0x19b9de[_0x4003ad][0x0][_0xc314('0x11')],'app':'Set','appdata':util[_0xc314('0x12')](_0xc314('0x13'),_0x19b9de[_0x4003ad][0x0][_0xc314('0x11')]),'context':_0x19b9de[_0x4003ad][0x0][_0xc314('0x14')],'exten':_0x19b9de[_0x4003ad][0x0][_0xc314('0x8')],'priority':_0x569fa9['priority']++,'VoiceExtensionId':_0x19b9de[_0x4003ad][0x0][_0xc314('0x15')]});if(_0x19b9de[_0x4003ad][0x0]['type']==='inbound'){_0x569fa9['extensions']['push']({'type':_0x19b9de[_0x4003ad][0x0]['type'],'app':_0xc314('0x16'),'appdata':_0xc314('0x17')+_0x19b9de[_0x4003ad][0x0][_0xc314('0x15')],'context':_0x19b9de[_0x4003ad][0x0]['context'],'exten':_0x19b9de[_0x4003ad][0x0]['exten'],'priority':_0x569fa9['priority']++,'VoiceExtensionId':_0x19b9de[_0x4003ad][0x0][_0xc314('0x15')]});}else if(_0x19b9de[_0x4003ad][0x0][_0xc314('0x11')]===_0xc314('0x18')){if(_0x569fa9['extension']){_0x569fa9[_0xc314('0xe')]['push']({'type':_0x19b9de[_0x4003ad][0x0][_0xc314('0x11')],'app':'Set','appdata':_0xc314('0x19')+(_0x569fa9['extension'][_0xc314('0x1a')]?_0xc314('0x1b')+_0x569fa9[_0xc314('0xf')][_0xc314('0x1a')]+'}':_0xc314('0x1c')),'context':_0x19b9de[_0x4003ad][0x0]['context'],'exten':_0x19b9de[_0x4003ad][0x0][_0xc314('0x8')],'priority':_0x569fa9[_0xc314('0x1d')]++,'VoiceExtensionId':_0x19b9de[_0x4003ad][0x0][_0xc314('0x15')]});}_0x569fa9['extensions'][_0xc314('0x1e')]({'type':_0x19b9de[_0x4003ad][0x0][_0xc314('0x11')],'app':_0xc314('0x16'),'appdata':_0xc314('0x17')+_0x19b9de[_0x4003ad][0x0][_0xc314('0x15')],'context':_0x19b9de[_0x4003ad][0x0][_0xc314('0x14')],'exten':_0x19b9de[_0x4003ad][0x0]['exten'],'priority':_0x569fa9[_0xc314('0x1d')]++,'VoiceExtensionId':_0x19b9de[_0x4003ad][0x0][_0xc314('0x15')]});var _0x51cdfa=_0x569fa9['priority']++;_0x569fa9['extensions'][_0xc314('0x1e')]({'type':_0x19b9de[_0x4003ad][0x0][_0xc314('0x11')],'app':_0xc314('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x51cdfa+0x2)+_0xc314('0x20')+(_0x51cdfa+0x1)+')','context':_0x19b9de[_0x4003ad][0x0][_0xc314('0x14')],'exten':_0x19b9de[_0x4003ad][0x0][_0xc314('0x8')],'priority':_0x51cdfa,'VoiceExtensionId':_0x19b9de[_0x4003ad][0x0]['VoiceExtensionId']});if(_0x569fa9[_0xc314('0xf')]){_0x569fa9[_0xc314('0xe')][_0xc314('0x1e')]({'type':_0x19b9de[_0x4003ad][0x0]['type'],'app':_0xc314('0x16'),'appdata':_0x569fa9[_0xc314('0xf')][_0xc314('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0x569fa9[_0xc314('0xf')][_0xc314('0x1a')]+'}':_0xc314('0x21'),'context':_0x19b9de[_0x4003ad][0x0][_0xc314('0x14')],'exten':_0x19b9de[_0x4003ad][0x0][_0xc314('0x8')],'priority':_0x569fa9[_0xc314('0x1d')]++,'VoiceExtensionId':_0x19b9de[_0x4003ad][0x0]['VoiceExtensionId']});}_0x569fa9[_0xc314('0xe')][_0xc314('0x1e')]({'type':_0x19b9de[_0x4003ad][0x0][_0xc314('0x11')],'app':_0xc314('0x16'),'appdata':_0xc314('0x22')+_0x19b9de[_0x4003ad][0x0][_0xc314('0x15')],'context':_0x19b9de[_0x4003ad][0x0][_0xc314('0x14')],'exten':_0x19b9de[_0x4003ad][0x0][_0xc314('0x8')],'priority':_0x569fa9[_0xc314('0x1d')]++,'VoiceExtensionId':_0x19b9de[_0x4003ad][0x0]['VoiceExtensionId']});if(_0x569fa9[_0xc314('0xf')]&&_0x569fa9[_0xc314('0xf')]['hasOwnProperty'](_0xc314('0x23'))&&_0x569fa9['extension'][_0xc314('0x23')]!==_0xc314('0x24')){_0x569fa9[_0xc314('0xe')]['push']({'type':_0x19b9de[_0x4003ad][0x0][_0xc314('0x11')],'app':_0xc314('0x16'),'appdata':_0xc314('0x25'),'context':_0x19b9de[_0x4003ad][0x0][_0xc314('0x14')],'exten':_0x19b9de[_0x4003ad][0x0]['exten'],'priority':_0x569fa9['priority']++,'VoiceExtensionId':_0x19b9de[_0x4003ad][0x0][_0xc314('0x15')]});_0x569fa9[_0xc314('0xe')][_0xc314('0x1e')]({'type':_0x19b9de[_0x4003ad][0x0][_0xc314('0x11')],'app':'Set','appdata':_0xc314('0x26')+_0x569fa9[_0xc314('0xf')]['recordingFormat']||_0xc314('0x27'),'context':_0x19b9de[_0x4003ad][0x0]['context'],'exten':_0x19b9de[_0x4003ad][0x0][_0xc314('0x8')],'priority':_0x569fa9[_0xc314('0x1d')]++,'VoiceExtensionId':_0x19b9de[_0x4003ad][0x0]['VoiceExtensionId']});}}_0x569fa9[_0xc314('0xe')]['push']({'type':_0x19b9de[_0x4003ad][0x0]['type'],'app':_0xc314('0x16'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x19b9de[_0x4003ad][0x0][_0xc314('0x14')],'exten':_0x19b9de[_0x4003ad][0x0]['exten'],'priority':_0x569fa9['priority']++,'VoiceExtensionId':_0x19b9de[_0x4003ad][0x0][_0xc314('0x15')]});_0x569fa9[_0xc314('0xe')][_0xc314('0x1e')]({'type':_0x19b9de[_0x4003ad][0x0][_0xc314('0x11')],'app':_0xc314('0x16'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x19b9de[_0x4003ad][0x0][_0xc314('0x14')],'exten':_0x19b9de[_0x4003ad][0x0]['exten'],'priority':_0x569fa9[_0xc314('0x1d')]++,'VoiceExtensionId':_0x19b9de[_0x4003ad][0x0][_0xc314('0x15')]});_0x569fa9[_0xc314('0xe')][_0xc314('0x1e')]({'type':_0x19b9de[_0x4003ad][0x0][_0xc314('0x11')],'app':_0xc314('0x16'),'appdata':_0xc314('0x28'),'context':_0x19b9de[_0x4003ad][0x0]['context'],'exten':_0x19b9de[_0x4003ad][0x0][_0xc314('0x8')],'priority':_0x569fa9[_0xc314('0x1d')]++,'VoiceExtensionId':_0x19b9de[_0x4003ad][0x0][_0xc314('0x15')]});for(var _0x5a26b0=0x0,_0xba6c3b=0x0;_0x5a26b0<_0x19b9de[_0x4003ad][_0xc314('0x29')];_0x5a26b0+=0x1,_0xba6c3b=0x0){var _0x554bea=_0x19b9de[_0x4003ad][_0x5a26b0];if(_0x554bea[_0xc314('0x11')]){_0x554bea['type']=_0x554bea[_0xc314('0x11')][_0xc314('0x2a')]();}var _0xe8bc9=[];var _0x26fee6=[];delete _0x554bea['id'];delete _0x554bea['createdAt'];delete _0x554bea[_0xc314('0x2b')];var _0x157d98=_0x554bea['interval']!==_0xc314('0x2c')?[_0x554bea[_0xc314('0x2d')]]:_0x554bea['IntervalId']?_[_0xc314('0x7')](_[_0xc314('0xa')](_0x569fa9['intervals'],{'IntervalId':_0x554bea['IntervalId']}),_0xc314('0x2d')):[];if(_0x554bea[_0xc314('0x2e')]('tag')){if(_0x554bea[_0xc314('0x2f')]&&_0x554bea['tag']!=='--'){_0xe8bc9['push']({'type':_0x554bea[_0xc314('0x11')],'app':_0xc314('0x16'),'appdata':_0xc314('0x30')+_0x554bea[_0xc314('0x2f')],'context':_0x554bea[_0xc314('0x14')],'exten':_0x554bea[_0xc314('0x8')],'priority':_0x157d98['length']+_0x569fa9[_0xc314('0x1d')]+_0xba6c3b++,'VoiceExtensionId':_0x554bea[_0xc314('0x15')]});}}if(_0x554bea[_0xc314('0x11')]==='outbound'&&_0x554bea[_0xc314('0x2e')](_0xc314('0x31'))){if(_0x554bea['callerID']){_0xe8bc9[_0xc314('0x1e')]({'type':_0x554bea['type'],'app':_0xc314('0x1f'),'appdata':_0xc314('0x32')+_0x554bea[_0xc314('0x31')]+')','context':_0x554bea['context'],'exten':_0x554bea[_0xc314('0x8')],'priority':_0x157d98['length']+_0x569fa9[_0xc314('0x1d')]+_0xba6c3b++,'VoiceExtensionId':_0x554bea[_0xc314('0x15')]});}else{_0xe8bc9[_0xc314('0x1e')]({'type':_0x554bea['type'],'app':_0xc314('0x1f'),'appdata':_0xc314('0x33'),'context':_0x554bea[_0xc314('0x14')],'exten':_0x554bea[_0xc314('0x8')],'priority':_0x157d98[_0xc314('0x29')]+_0x569fa9[_0xc314('0x1d')]+_0xba6c3b++,'VoiceExtensionId':_0x554bea[_0xc314('0x15')]});}}if(_0x554bea[_0xc314('0x2e')](_0xc314('0x34'))){if(_0x5a5c0a['indexOf'](_0x554bea[_0xc314('0x35')][_0xc314('0x2a')]())>=0x0&&_0x554bea[_0xc314('0x36')]!==_0xc314('0x37')){if(_0x554bea['answer']){_0xe8bc9[_0xc314('0x1e')]({'type':_0x554bea[_0xc314('0x11')],'app':'ExecIf','appdata':_0xc314('0x38'),'context':_0x554bea['context'],'exten':_0x554bea['exten'],'priority':_0x157d98['length']+_0x569fa9[_0xc314('0x1d')]+_0xba6c3b++,'VoiceExtensionId':_0x554bea['VoiceExtensionId']});_0xe8bc9[_0xc314('0x1e')]({'type':_0x554bea['type'],'app':_0xc314('0x16'),'appdata':_0xc314('0x39'),'context':_0x554bea['context'],'exten':_0x554bea[_0xc314('0x8')],'priority':_0x157d98['length']+_0x569fa9[_0xc314('0x1d')]+_0xba6c3b++,'VoiceExtensionId':_0x554bea['VoiceExtensionId']});}else{_0xe8bc9['push']({'type':_0x554bea[_0xc314('0x11')],'app':_0xc314('0x1f'),'appdata':_0xc314('0x3a'),'context':_0x554bea[_0xc314('0x14')],'exten':_0x554bea[_0xc314('0x8')],'priority':_0x157d98[_0xc314('0x29')]+_0x569fa9[_0xc314('0x1d')]+_0xba6c3b++,'VoiceExtensionId':_0x554bea[_0xc314('0x15')]});_0xe8bc9[_0xc314('0x1e')]({'type':_0x554bea[_0xc314('0x11')],'app':_0xc314('0x16'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x554bea[_0xc314('0x14')],'exten':_0x554bea[_0xc314('0x8')],'priority':_0x157d98[_0xc314('0x29')]+_0x569fa9[_0xc314('0x1d')]+_0xba6c3b++,'VoiceExtensionId':_0x554bea[_0xc314('0x15')]});}}}for(var _0x2e9a6e=0x0;_0x2e9a6e<_0x157d98['length'];_0x2e9a6e+=0x1){var _0x205391=_0x569fa9[_0xc314('0x1d')]+_0x157d98[_0xc314('0x29')];var _0x4260f0=_0x2e9a6e===_0x157d98[_0xc314('0x29')]-0x1?_0x569fa9['priority']+_0xe8bc9[_0xc314('0x29')]+_0x26fee6[_0xc314('0x29')]+0x2:_0x569fa9[_0xc314('0x1d')]+_0x2e9a6e+0x1;_0xe8bc9[_0xc314('0x3b')](_0x2e9a6e,0x0,{'type':_0x554bea[_0xc314('0x11')],'app':'GotoIfTime','appdata':_0x157d98[_0x2e9a6e]+'?'+_0x554bea[_0xc314('0x14')]+_0xc314('0x3c')+_0x205391+':'+_0x554bea[_0xc314('0x14')]+_0xc314('0x3c')+_0x4260f0,'exten':_0x554bea[_0xc314('0x8')],'context':_0x554bea[_0xc314('0x14')],'priority':_0x569fa9['priority']+_0x2e9a6e,'VoiceExtensionId':_0x19b9de[_0x4003ad][0x0]['VoiceExtensionId']});}_0x554bea[_0xc314('0x1d')]=_0xe8bc9[_0xc314('0x29')]?_[_0xc314('0x3d')](_0xe8bc9)[_0xc314('0x1d')]+0x1:_0x569fa9[_0xc314('0x1d')];_0x569fa9['priority']=(_0x26fee6[_0xc314('0x29')]?_[_0xc314('0x3d')](_0x26fee6)[_0xc314('0x1d')]:_0x554bea[_0xc314('0x1d')])+0x1;_0x569fa9[_0xc314('0xe')]=_[_0xc314('0x3e')](_0x569fa9[_0xc314('0xe')],_0xe8bc9,[_0x554bea],_0x26fee6);}_0x569fa9[_0xc314('0xe')][_0xc314('0x1e')]({'type':_0x19b9de[_0x4003ad][0x0][_0xc314('0x11')],'app':_0xc314('0x3f'),'exten':_0x19b9de[_0x4003ad][0x0][_0xc314('0x8')],'context':_0x19b9de[_0x4003ad][0x0][_0xc314('0x14')],'priority':_0x569fa9[_0xc314('0x1d')],'VoiceExtensionId':_0x19b9de[_0x4003ad][0x0][_0xc314('0x15')]});_0x4685e0[_0xc314('0x1e')](_0x19b9de[_0x4003ad][0x0]['VoiceExtensionId']);_0x1005c8=_['concat'](_0x1005c8,_0x569fa9[_0xc314('0xe')]);}}return _0x214165['transaction'](function(_0x2e860d){return _0x214165[_0xc314('0x0')]['VoiceExtension'][_0xc314('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x4685e0}},'transaction':_0x2e860d})[_0xc314('0x5')](function(_0x504d7d){return _0x214165[_0xc314('0x0')][_0xc314('0x3')][_0xc314('0x41')](_[_0xc314('0x42')](_0x1005c8,_0xc314('0x1d')),{'transaction':_0x2e860d});});});})[_0xc314('0x43')](function(_0x54edb1){console[_0xc314('0x44')](_0x54edb1);});}exports[_0xc314('0x45')]=rewrite; \ No newline at end of file +var _0xdcbb=['extensions','extension','push','Set','CDR(type)=%s','type','context','priority','VoiceExtensionId','inbound','CDR(routeid)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','MONITOR_OPTIONS=ab','length','updatedAt','interval','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','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','Interval','findAll','then','models','VoiceExtension','IntervalId','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdcbb,0x136));var _0xbdcb=function(_0x5595ad,_0x4b634d){_0x5595ad=_0x5595ad-0x0;var _0x1d4f04=_0xdcbb[_0x5595ad];return _0x1d4f04;};'use strict';var _=require(_0xbdcb('0x0'));var util=require(_0xbdcb('0x1'));function rewrite(_0x1d58df,_0x3617cb){var _0xf1b1bc=this;return _0x1d58df['models'][_0xbdcb('0x2')][_0xbdcb('0x3')]({'raw':!![]})[_0xbdcb('0x4')](function(_0x430dda){_0xf1b1bc['intervals']=_0x430dda;return _0x1d58df[_0xbdcb('0x5')][_0xbdcb('0x6')][_0xbdcb('0x3')]({'where':{'IntervalId':_0x3617cb[_0xbdcb('0x7')]},'raw':!![]});})[_0xbdcb('0x4')](function(_0x4ff951){return _0x1d58df[_0xbdcb('0x5')]['VoiceExtension'][_0xbdcb('0x3')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x4ff951,_0xbdcb('0x8')))}},'order':[{'raw':_0xbdcb('0x9')}],'raw':!![]});})[_0xbdcb('0x4')](function(_0x2b3e3b){var _0x1e58b8=_[_0xbdcb('0xa')](_0x2b3e3b,{'priority':'1'});var _0x295073=_[_0xbdcb('0xa')](_0x2b3e3b,{'isApp':0x1});var _0x556581=_[_0xbdcb('0xb')](_0x295073,_0xbdcb('0x8'));var _0x2cdb04=[_0xbdcb('0xc'),_0xbdcb('0xd')];var _0x4f6b45=[];var _0x5dd441=[];for(var _0xf867e8 in _0x556581){if(_0x556581[_0xbdcb('0xe')](_0xf867e8)){_0xf1b1bc['priority']=0x2;_0xf1b1bc[_0xbdcb('0xf')]=[];_0xf1b1bc[_0xbdcb('0x10')]=_['find'](_0x1e58b8,{'exten':_0x556581[_0xf867e8][0x0][_0xbdcb('0x8')]});_0xf1b1bc[_0xbdcb('0xf')][_0xbdcb('0x11')]({'type':_0x556581[_0xf867e8][0x0]['type'],'app':_0xbdcb('0x12'),'appdata':util['format'](_0xbdcb('0x13'),_0x556581[_0xf867e8][0x0][_0xbdcb('0x14')]),'context':_0x556581[_0xf867e8][0x0][_0xbdcb('0x15')],'exten':_0x556581[_0xf867e8][0x0]['exten'],'priority':_0xf1b1bc[_0xbdcb('0x16')]++,'VoiceExtensionId':_0x556581[_0xf867e8][0x0][_0xbdcb('0x17')]});if(_0x556581[_0xf867e8][0x0]['type']===_0xbdcb('0x18')){_0xf1b1bc[_0xbdcb('0xf')]['push']({'type':_0x556581[_0xf867e8][0x0][_0xbdcb('0x14')],'app':_0xbdcb('0x12'),'appdata':_0xbdcb('0x19')+_0x556581[_0xf867e8][0x0][_0xbdcb('0x17')],'context':_0x556581[_0xf867e8][0x0][_0xbdcb('0x15')],'exten':_0x556581[_0xf867e8][0x0]['exten'],'priority':_0xf1b1bc[_0xbdcb('0x16')]++,'VoiceExtensionId':_0x556581[_0xf867e8][0x0][_0xbdcb('0x17')]});}else if(_0x556581[_0xf867e8][0x0][_0xbdcb('0x14')]==='outbound'){if(_0xf1b1bc[_0xbdcb('0x10')]){_0xf1b1bc[_0xbdcb('0xf')][_0xbdcb('0x11')]({'type':_0x556581[_0xf867e8][0x0]['type'],'app':_0xbdcb('0x12'),'appdata':'CDR(destination)='+(_0xf1b1bc[_0xbdcb('0x10')][_0xbdcb('0x1a')]?'${EXTEN:'+_0xf1b1bc[_0xbdcb('0x10')][_0xbdcb('0x1a')]+'}':_0xbdcb('0x1b')),'context':_0x556581[_0xf867e8][0x0]['context'],'exten':_0x556581[_0xf867e8][0x0][_0xbdcb('0x8')],'priority':_0xf1b1bc[_0xbdcb('0x16')]++,'VoiceExtensionId':_0x556581[_0xf867e8][0x0]['VoiceExtensionId']});}_0xf1b1bc[_0xbdcb('0xf')][_0xbdcb('0x11')]({'type':_0x556581[_0xf867e8][0x0][_0xbdcb('0x14')],'app':_0xbdcb('0x12'),'appdata':_0xbdcb('0x19')+_0x556581[_0xf867e8][0x0][_0xbdcb('0x17')],'context':_0x556581[_0xf867e8][0x0][_0xbdcb('0x15')],'exten':_0x556581[_0xf867e8][0x0][_0xbdcb('0x8')],'priority':_0xf1b1bc[_0xbdcb('0x16')]++,'VoiceExtensionId':_0x556581[_0xf867e8][0x0][_0xbdcb('0x17')]});var _0xefdcdd=_0xf1b1bc['priority']++;_0xf1b1bc[_0xbdcb('0xf')][_0xbdcb('0x11')]({'type':_0x556581[_0xf867e8][0x0][_0xbdcb('0x14')],'app':_0xbdcb('0x1c'),'appdata':_0xbdcb('0x1d')+(_0xefdcdd+0x2)+_0xbdcb('0x1e')+(_0xefdcdd+0x1)+')','context':_0x556581[_0xf867e8][0x0][_0xbdcb('0x15')],'exten':_0x556581[_0xf867e8][0x0]['exten'],'priority':_0xefdcdd,'VoiceExtensionId':_0x556581[_0xf867e8][0x0]['VoiceExtensionId']});if(_0xf1b1bc['extension']){_0xf1b1bc[_0xbdcb('0xf')][_0xbdcb('0x11')]({'type':_0x556581[_0xf867e8][0x0][_0xbdcb('0x14')],'app':_0xbdcb('0x12'),'appdata':_0xf1b1bc[_0xbdcb('0x10')][_0xbdcb('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0xf1b1bc[_0xbdcb('0x10')]['cutdigits']+'}':_0xbdcb('0x1f'),'context':_0x556581[_0xf867e8][0x0]['context'],'exten':_0x556581[_0xf867e8][0x0][_0xbdcb('0x8')],'priority':_0xf1b1bc[_0xbdcb('0x16')]++,'VoiceExtensionId':_0x556581[_0xf867e8][0x0][_0xbdcb('0x17')]});}_0xf1b1bc[_0xbdcb('0xf')][_0xbdcb('0x11')]({'type':_0x556581[_0xf867e8][0x0]['type'],'app':_0xbdcb('0x12'),'appdata':_0xbdcb('0x20')+_0x556581[_0xf867e8][0x0][_0xbdcb('0x17')],'context':_0x556581[_0xf867e8][0x0]['context'],'exten':_0x556581[_0xf867e8][0x0]['exten'],'priority':_0xf1b1bc[_0xbdcb('0x16')]++,'VoiceExtensionId':_0x556581[_0xf867e8][0x0][_0xbdcb('0x17')]});if(_0xf1b1bc['extension']&&_0xf1b1bc['extension'][_0xbdcb('0xe')](_0xbdcb('0x21'))&&_0xf1b1bc[_0xbdcb('0x10')]['recordingFormat']!=='none'){_0xf1b1bc[_0xbdcb('0xf')]['push']({'type':_0x556581[_0xf867e8][0x0][_0xbdcb('0x14')],'app':_0xbdcb('0x12'),'appdata':_0xbdcb('0x22'),'context':_0x556581[_0xf867e8][0x0][_0xbdcb('0x15')],'exten':_0x556581[_0xf867e8][0x0][_0xbdcb('0x8')],'priority':_0xf1b1bc[_0xbdcb('0x16')]++,'VoiceExtensionId':_0x556581[_0xf867e8][0x0]['VoiceExtensionId']});_0xf1b1bc[_0xbdcb('0xf')][_0xbdcb('0x11')]({'type':_0x556581[_0xf867e8][0x0]['type'],'app':'Set','appdata':_0xbdcb('0x23')+_0xf1b1bc[_0xbdcb('0x10')][_0xbdcb('0x21')]||_0xbdcb('0x24'),'context':_0x556581[_0xf867e8][0x0][_0xbdcb('0x15')],'exten':_0x556581[_0xf867e8][0x0][_0xbdcb('0x8')],'priority':_0xf1b1bc[_0xbdcb('0x16')]++,'VoiceExtensionId':_0x556581[_0xf867e8][0x0][_0xbdcb('0x17')]});}}_0xf1b1bc[_0xbdcb('0xf')]['push']({'type':_0x556581[_0xf867e8][0x0][_0xbdcb('0x14')],'app':_0xbdcb('0x12'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x556581[_0xf867e8][0x0][_0xbdcb('0x15')],'exten':_0x556581[_0xf867e8][0x0]['exten'],'priority':_0xf1b1bc[_0xbdcb('0x16')]++,'VoiceExtensionId':_0x556581[_0xf867e8][0x0][_0xbdcb('0x17')]});_0xf1b1bc[_0xbdcb('0xf')][_0xbdcb('0x11')]({'type':_0x556581[_0xf867e8][0x0][_0xbdcb('0x14')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x556581[_0xf867e8][0x0][_0xbdcb('0x15')],'exten':_0x556581[_0xf867e8][0x0][_0xbdcb('0x8')],'priority':_0xf1b1bc[_0xbdcb('0x16')]++,'VoiceExtensionId':_0x556581[_0xf867e8][0x0]['VoiceExtensionId']});_0xf1b1bc[_0xbdcb('0xf')][_0xbdcb('0x11')]({'type':_0x556581[_0xf867e8][0x0][_0xbdcb('0x14')],'app':'Set','appdata':_0xbdcb('0x25'),'context':_0x556581[_0xf867e8][0x0]['context'],'exten':_0x556581[_0xf867e8][0x0][_0xbdcb('0x8')],'priority':_0xf1b1bc[_0xbdcb('0x16')]++,'VoiceExtensionId':_0x556581[_0xf867e8][0x0][_0xbdcb('0x17')]});for(var _0x916075=0x0,_0x4ee183=0x0;_0x916075<_0x556581[_0xf867e8][_0xbdcb('0x26')];_0x916075+=0x1,_0x4ee183=0x0){var _0x4fd035=_0x556581[_0xf867e8][_0x916075];if(_0x4fd035[_0xbdcb('0x14')]){_0x4fd035[_0xbdcb('0x14')]=_0x4fd035['type']['toLowerCase']();}var _0x103eff=[];var _0x4dcd18=[];delete _0x4fd035['id'];delete _0x4fd035['createdAt'];delete _0x4fd035[_0xbdcb('0x27')];var _0x33d47c=_0x4fd035[_0xbdcb('0x28')]!=='*,*,*,*'?[_0x4fd035[_0xbdcb('0x28')]]:_0x4fd035[_0xbdcb('0x7')]?_['map'](_[_0xbdcb('0xa')](_0xf1b1bc[_0xbdcb('0x29')],{'IntervalId':_0x4fd035[_0xbdcb('0x7')]}),'interval'):[];if(_0x4fd035[_0xbdcb('0xe')](_0xbdcb('0x2a'))){if(_0x4fd035[_0xbdcb('0x2a')]&&_0x4fd035[_0xbdcb('0x2a')]!=='--'){_0x103eff[_0xbdcb('0x11')]({'type':_0x4fd035[_0xbdcb('0x14')],'app':_0xbdcb('0x12'),'appdata':_0xbdcb('0x2b')+_0x4fd035[_0xbdcb('0x2a')],'context':_0x4fd035[_0xbdcb('0x15')],'exten':_0x4fd035['exten'],'priority':_0x33d47c[_0xbdcb('0x26')]+_0xf1b1bc['priority']+_0x4ee183++,'VoiceExtensionId':_0x4fd035[_0xbdcb('0x17')]});}}if(_0x4fd035[_0xbdcb('0x14')]==='outbound'&&_0x4fd035[_0xbdcb('0xe')](_0xbdcb('0x2c'))){if(_0x4fd035[_0xbdcb('0x2c')]){_0x103eff[_0xbdcb('0x11')]({'type':_0x4fd035[_0xbdcb('0x14')],'app':_0xbdcb('0x1c'),'appdata':_0xbdcb('0x2d')+_0x4fd035[_0xbdcb('0x2c')]+')','context':_0x4fd035[_0xbdcb('0x15')],'exten':_0x4fd035[_0xbdcb('0x8')],'priority':_0x33d47c[_0xbdcb('0x26')]+_0xf1b1bc[_0xbdcb('0x16')]+_0x4ee183++,'VoiceExtensionId':_0x4fd035['VoiceExtensionId']});}else{_0x103eff[_0xbdcb('0x11')]({'type':_0x4fd035['type'],'app':_0xbdcb('0x1c'),'appdata':_0xbdcb('0x2e'),'context':_0x4fd035['context'],'exten':_0x4fd035[_0xbdcb('0x8')],'priority':_0x33d47c[_0xbdcb('0x26')]+_0xf1b1bc['priority']+_0x4ee183++,'VoiceExtensionId':_0x4fd035[_0xbdcb('0x17')]});}}if(_0x4fd035['hasOwnProperty'](_0xbdcb('0x2f'))){if(_0x2cdb04[_0xbdcb('0x30')](_0x4fd035['app']['toLowerCase']())>=0x0&&_0x4fd035[_0xbdcb('0x31')]!==_0xbdcb('0x32')){if(_0x4fd035['answer']){_0x103eff[_0xbdcb('0x11')]({'type':_0x4fd035[_0xbdcb('0x14')],'app':_0xbdcb('0x1c'),'appdata':_0xbdcb('0x33'),'context':_0x4fd035['context'],'exten':_0x4fd035[_0xbdcb('0x8')],'priority':_0x33d47c[_0xbdcb('0x26')]+_0xf1b1bc[_0xbdcb('0x16')]+_0x4ee183++,'VoiceExtensionId':_0x4fd035[_0xbdcb('0x17')]});_0x103eff['push']({'type':_0x4fd035[_0xbdcb('0x14')],'app':_0xbdcb('0x12'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4fd035[_0xbdcb('0x15')],'exten':_0x4fd035[_0xbdcb('0x8')],'priority':_0x33d47c['length']+_0xf1b1bc[_0xbdcb('0x16')]+_0x4ee183++,'VoiceExtensionId':_0x4fd035[_0xbdcb('0x17')]});}else{_0x103eff['push']({'type':_0x4fd035[_0xbdcb('0x14')],'app':_0xbdcb('0x1c'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4fd035[_0xbdcb('0x15')],'exten':_0x4fd035[_0xbdcb('0x8')],'priority':_0x33d47c[_0xbdcb('0x26')]+_0xf1b1bc[_0xbdcb('0x16')]+_0x4ee183++,'VoiceExtensionId':_0x4fd035[_0xbdcb('0x17')]});_0x103eff[_0xbdcb('0x11')]({'type':_0x4fd035[_0xbdcb('0x14')],'app':_0xbdcb('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4fd035[_0xbdcb('0x15')],'exten':_0x4fd035['exten'],'priority':_0x33d47c[_0xbdcb('0x26')]+_0xf1b1bc['priority']+_0x4ee183++,'VoiceExtensionId':_0x4fd035[_0xbdcb('0x17')]});}}}for(var _0x3d62c3=0x0;_0x3d62c3<_0x33d47c[_0xbdcb('0x26')];_0x3d62c3+=0x1){var _0x59775d=_0xf1b1bc['priority']+_0x33d47c['length'];var _0x20b14c=_0x3d62c3===_0x33d47c[_0xbdcb('0x26')]-0x1?_0xf1b1bc['priority']+_0x103eff[_0xbdcb('0x26')]+_0x4dcd18['length']+0x2:_0xf1b1bc[_0xbdcb('0x16')]+_0x3d62c3+0x1;_0x103eff[_0xbdcb('0x34')](_0x3d62c3,0x0,{'type':_0x4fd035[_0xbdcb('0x14')],'app':_0xbdcb('0x35'),'appdata':_0x33d47c[_0x3d62c3]+'?'+_0x4fd035['context']+_0xbdcb('0x36')+_0x59775d+':'+_0x4fd035['context']+_0xbdcb('0x36')+_0x20b14c,'exten':_0x4fd035['exten'],'context':_0x4fd035['context'],'priority':_0xf1b1bc[_0xbdcb('0x16')]+_0x3d62c3,'VoiceExtensionId':_0x556581[_0xf867e8][0x0][_0xbdcb('0x17')]});}_0x4fd035['priority']=_0x103eff['length']?_[_0xbdcb('0x37')](_0x103eff)[_0xbdcb('0x16')]+0x1:_0xf1b1bc[_0xbdcb('0x16')];_0xf1b1bc[_0xbdcb('0x16')]=(_0x4dcd18[_0xbdcb('0x26')]?_['last'](_0x4dcd18)[_0xbdcb('0x16')]:_0x4fd035[_0xbdcb('0x16')])+0x1;_0xf1b1bc[_0xbdcb('0xf')]=_[_0xbdcb('0x38')](_0xf1b1bc['extensions'],_0x103eff,[_0x4fd035],_0x4dcd18);}_0xf1b1bc[_0xbdcb('0xf')][_0xbdcb('0x11')]({'type':_0x556581[_0xf867e8][0x0][_0xbdcb('0x14')],'app':_0xbdcb('0x39'),'exten':_0x556581[_0xf867e8][0x0][_0xbdcb('0x8')],'context':_0x556581[_0xf867e8][0x0]['context'],'priority':_0xf1b1bc[_0xbdcb('0x16')],'VoiceExtensionId':_0x556581[_0xf867e8][0x0][_0xbdcb('0x17')]});_0x4f6b45[_0xbdcb('0x11')](_0x556581[_0xf867e8][0x0][_0xbdcb('0x17')]);_0x5dd441=_['concat'](_0x5dd441,_0xf1b1bc[_0xbdcb('0xf')]);}}return _0x1d58df[_0xbdcb('0x3a')](function(_0x535ee4){return _0x1d58df['models'][_0xbdcb('0x6')][_0xbdcb('0x3b')]({'where':{'VoiceExtensionId':{'$in':_0x4f6b45}},'transaction':_0x535ee4})[_0xbdcb('0x4')](function(_0x594cbf){return _0x1d58df[_0xbdcb('0x5')]['VoiceExtension'][_0xbdcb('0x3c')](_[_0xbdcb('0x3d')](_0x5dd441,'priority'),{'transaction':_0x535ee4});});});})[_0xbdcb('0x3e')](function(_0x8b8cc5){console[_0xbdcb('0x3f')](_0x8b8cc5);});}exports[_0xbdcb('0x40')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index a4f7365..f4fda9b 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 _0xfaf3=['defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','cmContact','checkHopper','into','createdAt','updatedAt','field','NOW()','scheduledAt','ContactId','toString','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','cm_hopper','\x20=\x20?','insert','fromQuery','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','query','VoiceQueueId','onlyIfOpen','sequelize','all','VoiceQueue','CampaignId','Campaign','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resume','Unable\x20to\x20delete\x20temp\x20file:','exit','CSV\x20import\x20process\x20stopped!','resolve','parse','pause','CSV\x20parsed\x20correctly!','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfaf3,0xd1));var _0x3faf=function(_0x1bef40,_0x1cef5b){_0x1bef40=_0x1bef40-0x0;var _0x2c1e7d=_0xfaf3[_0x1bef40];return _0x2c1e7d;};'use strict';var BPromise=require(_0x3faf('0x0'));var util=require('util');var _=require(_0x3faf('0x1'));var fs=require('fs');var squel=require(_0x3faf('0x2'));var Papa=require(_0x3faf('0x3'));var Redis=require(_0x3faf('0x4'));var db=require(_0x3faf('0x5'))['db'];var config=require(_0x3faf('0x6'));var logger=require('../../../config/logger')(_0x3faf('0x7'));config[_0x3faf('0x8')]=_[_0x3faf('0x9')](config[_0x3faf('0x8')],{'host':_0x3faf('0xa'),'port':0x18eb});var socket=require(_0x3faf('0xb'))(new Redis(config['redis']));require(_0x3faf('0xc'))[_0x3faf('0xd')](socket);try{if(!process[_0x3faf('0xe')][0x2]||process[_0x3faf('0xe')][0x2]===_0x3faf('0xf')||process[_0x3faf('0xe')][0x2]===_0x3faf('0x10')){throw new Error(_0x3faf('0x11'));}var FILEPATH=process['argv'][0x2];if(!process[_0x3faf('0xe')][0x3]||process['argv'][0x3]===_0x3faf('0xf')||process[_0x3faf('0xe')][0x3]===_0x3faf('0x10')||!process['argv'][0x4]||process[_0x3faf('0xe')][0x4]==='undefined'||process['argv'][0x4]==='null'){throw new Error(_0x3faf('0x12'));}var FIELDS=_['zipObject'](process[_0x3faf('0xe')][0x3][_0x3faf('0x13')](','),process[_0x3faf('0xe')][0x4][_0x3faf('0x13')](','));if(!process[_0x3faf('0xe')][0x5]||process[_0x3faf('0xe')][0x5]==='undefined'||process['argv'][0x5]===_0x3faf('0x10')){throw new Error(_0x3faf('0x14'));}var LISTID=process[_0x3faf('0xe')][0x5];var COMPANYID=process[_0x3faf('0xe')][0x6]&&process[_0x3faf('0xe')][0x6]!==_0x3faf('0xf')&&process[_0x3faf('0xe')][0x6]!==_0x3faf('0x10')?process[_0x3faf('0xe')][0x6]:null;var DUPLICATES=process[_0x3faf('0xe')][0x7]&&process[_0x3faf('0xe')][0x7]!=='undefined'&&process[_0x3faf('0xe')][0x7]!==_0x3faf('0x10')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]==='undefined'||process[_0x3faf('0xe')][0x8]===_0x3faf('0x10')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3faf('0xe')][0x8];}catch(_0x420cf7){logger[_0x3faf('0x15')](_0x420cf7);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(_0x1460c6,_0x14863c,_0x54b475,_0x4748bf){var _0xf0f693={'message':_0x14863c};_0xf0f693[_0x1460c6]=!![];if(_0x54b475){_0xf0f693[_0x3faf('0x16')]=_0x54b475;}if(_0x4748bf){_0xf0f693[_0x3faf('0x17')]=_0x4748bf;}return _0xf0f693;}function isEmail(_0x38ffbc){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))*$/[_0x3faf('0x18')](_0x38ffbc);}function checkRow(_0x53b51f,_0x48fbc1,_0x25749e){return new BPromise(function(_0x5267ff,_0x345ac3){if(_[_0x3faf('0x19')](_0x53b51f)){return _0x345ac3(handleCheckRowError(_0x3faf('0x15'),_0x3faf('0x1a'),null,_0x25749e));}if(_0x53b51f[_0x3faf('0x1b')]&&_0x53b51f[_0x3faf('0x1b')][_0x3faf('0x1c')]){var _0x46307d=_[_0x3faf('0x1d')](_0x53b51f[_0x3faf('0x1b')],'message')[_0x3faf('0x1e')](';');return _0x345ac3(handleCheckRowError('error',_0x46307d,null,_0x25749e));}var _0xc94eb4={};for(var _0x15ed30 in FIELDS){if(FIELDS[_0x3faf('0x1f')](_0x15ed30)&&FIELDS[_0x15ed30]){_0xc94eb4[_0x15ed30]=_0x53b51f[_0x3faf('0x20')][0x0][FIELDS[_0x15ed30]]||_0x53b51f[_0x3faf('0x20')][0x0]['\ufeff'+FIELDS[_0x15ed30]];}}if(!_0xc94eb4['firstName']){return _0x345ac3(handleCheckRowError('error',_0x3faf('0x21'),null,_0x25749e));}if(!_0xc94eb4[_0x3faf('0x22')]){return _0x345ac3(handleCheckRowError('error',_0x3faf('0x23'),null,_0x25749e));}if(_0xc94eb4['birthDate']){var _0x22f7a6=moment(_0xc94eb4['birthDate'],_0x3faf('0x24'));if(!_0x22f7a6[_0x3faf('0x25')]()){return _0x345ac3(handleCheckRowError('error',_0x3faf('0x26'),null,_0x25749e));}}if(_0xc94eb4[_0x3faf('0x27')]){if(!isEmail(_0xc94eb4[_0x3faf('0x27')])){return _0x345ac3(handleCheckRowError('error',_0x3faf('0x28'),null,_0x25749e));}}_0xc94eb4[_0x3faf('0x29')]=LISTID;_0xc94eb4['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3faf('0x1c')]&&_0x48fbc1){var _0x249023={};for(var _0x21501b=0x0,_0x3d8d44=DUPLICATES[_0x3faf('0x1c')];_0x21501b<_0x3d8d44;_0x21501b+=0x1){_0x249023[DUPLICATES[_0x21501b]]=_0xc94eb4[DUPLICATES[_0x21501b]];}var _0x32ba62=_['find'](_0x48fbc1,_0x249023);if(_0x32ba62){return _0x345ac3(handleCheckRowError(_0x3faf('0x2a'),_0x3faf('0x2b'),_0x32ba62,_0x25749e));}}return db[_0x3faf('0x2c')][_0x3faf('0x2d')](_0xc94eb4,{'raw':!![],'hooks':![],'fields':_[_0x3faf('0x2e')](_0xc94eb4)})[_0x3faf('0x2f')](function(_0x54229e){if(DUPLICATES&&DUPLICATES[_0x3faf('0x1c')]&&_0x48fbc1){_0x48fbc1[_0x3faf('0x30')](_[_0x3faf('0x31')](_0xc94eb4,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x54229e['id'];return _0x5267ff();})[_0x3faf('0x32')](function(_0x28ff34){return _0x345ac3(handleCheckRowError(_0x3faf('0x15'),_0x3faf('0x33')+(_0x28ff34[_0x3faf('0x34')]||JSON['stringify'](_0x28ff34)),null,_0x25749e));});});}function checkHopper(){function _0x4b984f(){return function(_0x5711b8){logger[_0x3faf('0x15')](_0x3faf('0x35'),_0x3faf('0x36'),util['inspect'](_0x5711b8,{'showHidden':![],'depth':null}));};}var _0x42d777=function(_0x5ef838,_0x26b44b){var _0x3e96c3=squel['insert']()[_0x3faf('0x37')]('cm_hopper')['fromQuery'](['phone','scheduledAt','ContactId',_0x3faf('0x29'),_0x26b44b,_0x3faf('0x38'),_0x3faf('0x39')],squel['select']()[_0x3faf('0x3a')](_0x3faf('0x22'),'phone')[_0x3faf('0x3a')](_0x3faf('0x3b'),_0x3faf('0x3c'))[_0x3faf('0x3a')]('id',_0x3faf('0x3d'))['field'](LISTID[_0x3faf('0x3e')](),_0x3faf('0x29'))['field'](_0x5ef838['id'][_0x3faf('0x3e')](),_0x26b44b)[_0x3faf('0x3a')](_0x3faf('0x3b'),_0x3faf('0x38'))[_0x3faf('0x3a')](_0x3faf('0x3b'),_0x3faf('0x39'))[_0x3faf('0x3f')](_0x3faf('0x40'))[_0x3faf('0x41')]('deletedAt\x20IS\x20NULL')[_0x3faf('0x41')](_0x3faf('0x42'),LISTID[_0x3faf('0x3e')]())['where'](_0x3faf('0x43'))[_0x3faf('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3faf('0x44')]()[_0x3faf('0x3a')](_0x3faf('0x22'))[_0x3faf('0x3f')](_0x3faf('0x45'))[_0x3faf('0x41')](_0x26b44b+_0x3faf('0x46'),_0x5ef838['id'][_0x3faf('0x3e')]())))[_0x3faf('0x3e')]();return _0x3e96c3;};var _0x1ba0f7=function(_0x56ec5f,_0x327c24){var _0x543eff=squel[_0x3faf('0x47')]()[_0x3faf('0x37')](_0x3faf('0x45'))[_0x3faf('0x48')]([_0x3faf('0x22'),_0x3faf('0x3c'),_0x3faf('0x3d'),_0x3faf('0x29'),_0x327c24,_0x3faf('0x38'),_0x3faf('0x39')],squel['select']()['field'](_0x3faf('0x22'),_0x3faf('0x22'))['field'](_0x3faf('0x3b'),_0x3faf('0x3c'))[_0x3faf('0x3a')]('id',_0x3faf('0x3d'))[_0x3faf('0x3a')](LISTID[_0x3faf('0x3e')](),'ListId')[_0x3faf('0x3a')](_0x56ec5f['id']['toString'](),_0x327c24)[_0x3faf('0x3a')]('NOW()',_0x3faf('0x38'))[_0x3faf('0x3a')](_0x3faf('0x3b'),_0x3faf('0x39'))[_0x3faf('0x3f')](_0x3faf('0x40'))[_0x3faf('0x41')](_0x3faf('0x49'))[_0x3faf('0x41')](_0x3faf('0x42'),LISTID[_0x3faf('0x3e')]())[_0x3faf('0x41')](_0x3faf('0x4a'),squel[_0x3faf('0x4b')](hopperContacts))[_0x3faf('0x41')]('phone\x20IS\x20NOT\x20NULL')[_0x3faf('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3faf('0x44')]()[_0x3faf('0x3a')](_0x3faf('0x4c'))[_0x3faf('0x3f')]('cm_hopper_final')[_0x3faf('0x41')](_0x327c24+_0x3faf('0x46'),_0x56ec5f['id'][_0x3faf('0x3e')]()))[_0x3faf('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3faf('0x3a')](_0x3faf('0x22'))[_0x3faf('0x3f')]('cm_hopper')['where'](_0x327c24+_0x3faf('0x46'),_0x56ec5f['id'][_0x3faf('0x3e')]())))[_0x3faf('0x3e')]();return _0x543eff;};function _0x233eef(_0x32bfdb,_0x503e82){var _0x59ff61=squel[_0x3faf('0x47')]()[_0x3faf('0x37')](_0x3faf('0x45'))[_0x3faf('0x48')]([_0x3faf('0x22'),_0x3faf('0x3c'),_0x3faf('0x3d'),'ListId',_0x503e82,'createdAt',_0x3faf('0x39')],squel[_0x3faf('0x44')]()[_0x3faf('0x3a')]('phone','phone')[_0x3faf('0x3a')](_0x3faf('0x3b'),'scheduledAt')['field']('id',_0x3faf('0x3d'))['field'](LISTID[_0x3faf('0x3e')](),_0x3faf('0x29'))[_0x3faf('0x3a')](_0x32bfdb['id'][_0x3faf('0x3e')](),_0x503e82)[_0x3faf('0x3a')](_0x3faf('0x3b'),'createdAt')[_0x3faf('0x3a')](_0x3faf('0x3b'),_0x3faf('0x39'))[_0x3faf('0x3f')](_0x3faf('0x40'))[_0x3faf('0x41')](_0x3faf('0x49'))[_0x3faf('0x41')](_0x3faf('0x42'),LISTID['toString']())[_0x3faf('0x41')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x3faf('0x41')](_0x3faf('0x43')))[_0x3faf('0x3e')]();return _0x59ff61;}function _0x1edeb8(_0x4f0a50,_0x3f6ee8){var _0x1055be=squel[_0x3faf('0x47')]()[_0x3faf('0x37')]('cm_hopper_black')[_0x3faf('0x48')]([_0x3faf('0x22'),_0x3faf('0x3d'),_0x3faf('0x29'),_0x3f6ee8,_0x3faf('0x38'),'updatedAt'],squel[_0x3faf('0x44')]()[_0x3faf('0x3a')](_0x3faf('0x22'),'phone')[_0x3faf('0x3a')]('id',_0x3faf('0x3d'))[_0x3faf('0x3a')](LISTID['toString'](),_0x3faf('0x29'))[_0x3faf('0x3a')](_0x4f0a50['id']['toString'](),_0x3f6ee8)[_0x3faf('0x3a')](_0x3faf('0x3b'),'createdAt')[_0x3faf('0x3a')]('NOW()',_0x3faf('0x39'))[_0x3faf('0x3f')]('cm_contacts')['where'](_0x3faf('0x49'))[_0x3faf('0x41')]('ListId\x20=\x20?',LISTID[_0x3faf('0x3e')]())['where'](_0x3faf('0x4a'),squel[_0x3faf('0x4b')](hopperContacts))[_0x3faf('0x41')](_0x3faf('0x43')))[_0x3faf('0x3e')]();return _0x1055be;}return db['VoiceQueue'][_0x3faf('0x4d')]({'where':{'type':_0x3faf('0x4e')},'attributes':['id',_0x3faf('0x4f')],'include':[{'model':db[_0x3faf('0x50')],'as':_0x3faf('0x51'),'where':{'id':LISTID}}]})['then'](function(_0x4e6508){var _0x504730=[];if(_0x4e6508){var _0x10e6f4;for(var _0x26e180=0x0,_0x1d1f6a;_0x26e180<_0x4e6508[_0x3faf('0x1c')];_0x26e180+=0x1){_0x1d1f6a=_0x4e6508[_0x26e180][_0x3faf('0x52')]({'plain':!![]});switch(_0x1d1f6a['dialCheckDuplicateType']){case'always':_0x504730[_0x3faf('0x30')](db['sequelize'][_0x3faf('0x53')](_0x1ba0f7(_0x1d1f6a,_0x3faf('0x54')))[_0x3faf('0x2f')](function(){})[_0x3faf('0x32')](_0x4b984f()));break;case _0x3faf('0x55'):_0x504730[_0x3faf('0x30')](db['sequelize'][_0x3faf('0x53')](_0x42d777(_0x1d1f6a,'VoiceQueueId'))['then'](function(){})[_0x3faf('0x32')](_0x4b984f()));break;default:_0x504730[_0x3faf('0x30')](db[_0x3faf('0x56')]['query'](_0x233eef(_0x1d1f6a,_0x3faf('0x54')))['then'](function(){})[_0x3faf('0x32')](_0x4b984f()));}}}return _0x504730;})[_0x3faf('0x57')]()['then'](function(){return db[_0x3faf('0x58')][_0x3faf('0x4d')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x3faf('0x50')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3faf('0x2f')](function(_0x1980f9){var _0xfe8f13=[];if(_0x1980f9){var _0x2449ef;for(var _0x7b9fb9=0x0,_0x1311ae;_0x7b9fb9<_0x1980f9[_0x3faf('0x1c')];_0x7b9fb9+=0x1){_0x1311ae=_0x1980f9[_0x7b9fb9][_0x3faf('0x52')]({'plain':!![]});_0xfe8f13[_0x3faf('0x30')](db[_0x3faf('0x56')]['query'](_0x1edeb8(_0x1311ae,_0x3faf('0x54')))[_0x3faf('0x2f')](function(){})['catch'](_0x4b984f()));}}return _0xfe8f13;})['all']();})[_0x3faf('0x2f')](function(){return db['Campaign'][_0x3faf('0x4d')]({'attributes':['id',_0x3faf('0x4f')],'include':[{'model':db[_0x3faf('0x50')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x1a7296){var _0x11e48e=[];if(_0x1a7296){for(var _0x4c46aa=0x0,_0x350a0c;_0x4c46aa<_0x1a7296[_0x3faf('0x1c')];_0x4c46aa+=0x1){_0x350a0c=_0x1a7296[_0x4c46aa][_0x3faf('0x52')]({'plain':!![]});switch(_0x350a0c[_0x3faf('0x4f')]){case'always':_0x11e48e['push'](db[_0x3faf('0x56')][_0x3faf('0x53')](_0x1ba0f7(_0x350a0c,_0x3faf('0x59')))[_0x3faf('0x2f')](function(){})[_0x3faf('0x32')](_0x4b984f()));break;case'onlyIfOpen':_0x11e48e[_0x3faf('0x30')](db[_0x3faf('0x56')][_0x3faf('0x53')](_0x42d777(_0x350a0c,_0x3faf('0x59')))[_0x3faf('0x2f')](function(){})[_0x3faf('0x32')](_0x4b984f()));break;default:_0x11e48e[_0x3faf('0x30')](db[_0x3faf('0x56')][_0x3faf('0x53')](_0x233eef(_0x350a0c,_0x3faf('0x59')))['then'](function(){})[_0x3faf('0x32')](_0x4b984f()));}}}return _0x11e48e;})[_0x3faf('0x57')]();})[_0x3faf('0x2f')](function(){return db[_0x3faf('0x5a')][_0x3faf('0x4d')]({'attributes':['id'],'include':[{'model':db[_0x3faf('0x50')],'as':_0x3faf('0x5b'),'where':{'id':LISTID}}]})['then'](function(_0x49dc8c){var _0xe40ce7=[];if(_0x49dc8c){for(var _0x45cd79=0x0,_0x20e824;_0x45cd79<_0x49dc8c[_0x3faf('0x1c')];_0x45cd79+=0x1){_0x20e824=_0x49dc8c[_0x45cd79][_0x3faf('0x52')]({'plain':!![]});_0xe40ce7['push'](db[_0x3faf('0x56')][_0x3faf('0x53')](_0x1edeb8(_0x20e824,_0x3faf('0x59')))[_0x3faf('0x2f')](function(){})[_0x3faf('0x32')](_0x4b984f()));}}return _0xe40ce7;})[_0x3faf('0x57')]();})['catch'](function(_0x3f38f4){logger[_0x3faf('0x15')](_0x3faf('0x5c'),'generalCheckHopper',_0x3f38f4[_0x3faf('0x34')]);});}var processPromises=function(_0x82b835){return BPromise[_0x3faf('0x57')](promises)['then'](function(_0x4f48e2){})[_0x3faf('0x32')](function(_0x200ac0){logger['error'](_0x3faf('0x5d'),JSON[_0x3faf('0x5e')](_0x200ac0));})[_0x3faf('0x5f')](function(){socket[_0x3faf('0x60')](_0x3faf('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x82b835){return _0x82b835[_0x3faf('0x62')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x3faf('0x60')](_0x3faf('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x34a58a){logger[_0x3faf('0x15')](_0x3faf('0x63'),JSON[_0x3faf('0x5e')](_0x34a58a));}finally{process[_0x3faf('0x64')](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0x3faf('0x65'));endCsv();});function main(){return BPromise[_0x3faf('0x66')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x3faf('0x13')](',');return db[_0x3faf('0x2c')][_0x3faf('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3faf('0x2f')](function(_0x59108e){var _0x38981f=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x3faf('0x67')](_0x38981f,{'header':!![],'skipEmptyLines':!![],'step':function(_0x530f67,_0x540bff){total+=0x1;var _0x40851e=total;promises['push'](checkRow(_0x530f67,_0x59108e,_0x40851e)['then'](function(){success+=0x1;})[_0x3faf('0x32')](function(_0x4b13db){if(_0x4b13db[_0x3faf('0x15')]){errors+=0x1;delete _0x4b13db[_0x3faf('0x15')];}else if(_0x4b13db[_0x3faf('0x2a')]){duplicates+=0x1;delete _0x4b13db[_0x3faf('0x2a')];}rows[_0x3faf('0x30')](_0x4b13db);}));if(total%0xc8===0x0){_0x540bff[_0x3faf('0x68')]();return processPromises(_0x540bff);}},'complete':function(){return processPromises()[_0x3faf('0x2f')](function(){logger['info'](_0x3faf('0x69'));endCsv();});},'error':function(_0x41b1e9,_0x1db4db){logger[_0x3faf('0x6a')](_0x3faf('0x6b'),JSON['stringify'](_0x41b1e9));endCsv();}});})[_0x3faf('0x32')](function(_0x4304ee){logger[_0x3faf('0x15')](_0x3faf('0x6c'),JSON[_0x3faf('0x5e')](_0x4304ee));});}main(); \ No newline at end of file +var _0x15fa=['../../../config/logger','api','redis','defaults','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','into','ListId\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','phone\x20IS\x20NOT\x20NULL','findAll','dialCheckDuplicateType','get','always','push','sequelize','query','onlyIfOpen','VoiceQueueId','VoiceQueue','outbound','CmList','BlackLists','Campaign','CampaignId','all','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','CSV\x20parse\x20error','bluebird','util','lodash','ioredis','../../../mysqldb','../../../config/environment'];(function(_0x40be9d,_0x9294ce){var _0x4fb656=function(_0x4cd05e){while(--_0x4cd05e){_0x40be9d['push'](_0x40be9d['shift']());}};_0x4fb656(++_0x9294ce);}(_0x15fa,0x67));var _0xa15f=function(_0x50f3fd,_0x3b3bc7){_0x50f3fd=_0x50f3fd-0x0;var _0x35f76d=_0x15fa[_0x50f3fd];return _0x35f76d;};'use strict';var BPromise=require(_0xa15f('0x0'));var util=require(_0xa15f('0x1'));var _=require(_0xa15f('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0xa15f('0x3'));var db=require(_0xa15f('0x4'))['db'];var config=require(_0xa15f('0x5'));var logger=require(_0xa15f('0x6'))(_0xa15f('0x7'));config[_0xa15f('0x8')]=_[_0xa15f('0x9')](config[_0xa15f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xa15f('0xa'))(new Redis(config[_0xa15f('0x8')]));require('../../../api/cmContact/cmContact.socket')[_0xa15f('0xb')](socket);try{if(!process[_0xa15f('0xc')][0x2]||process['argv'][0x2]===_0xa15f('0xd')||process['argv'][0x2]===_0xa15f('0xe')){throw new Error(_0xa15f('0xf'));}var FILEPATH=process[_0xa15f('0xc')][0x2];if(!process[_0xa15f('0xc')][0x3]||process[_0xa15f('0xc')][0x3]==='undefined'||process[_0xa15f('0xc')][0x3]===_0xa15f('0xe')||!process[_0xa15f('0xc')][0x4]||process[_0xa15f('0xc')][0x4]===_0xa15f('0xd')||process[_0xa15f('0xc')][0x4]===_0xa15f('0xe')){throw new Error(_0xa15f('0x10'));}var FIELDS=_[_0xa15f('0x11')](process['argv'][0x3][_0xa15f('0x12')](','),process['argv'][0x4][_0xa15f('0x12')](','));if(!process[_0xa15f('0xc')][0x5]||process[_0xa15f('0xc')][0x5]===_0xa15f('0xd')||process[_0xa15f('0xc')][0x5]===_0xa15f('0xe')){throw new Error(_0xa15f('0x13'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xa15f('0xc')][0x6]&&process[_0xa15f('0xc')][0x6]!==_0xa15f('0xd')&&process['argv'][0x6]!==_0xa15f('0xe')?process[_0xa15f('0xc')][0x6]:null;var DUPLICATES=process[_0xa15f('0xc')][0x7]&&process[_0xa15f('0xc')][0x7]!==_0xa15f('0xd')&&process['argv'][0x7]!==_0xa15f('0xe')?process[_0xa15f('0xc')][0x7]:null;if(!process[_0xa15f('0xc')][0x8]||process[_0xa15f('0xc')][0x8]===_0xa15f('0xd')||process[_0xa15f('0xc')][0x8]===_0xa15f('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xa15f('0xc')][0x8];}catch(_0x3c24d4){logger['error'](_0x3c24d4);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(_0x402bd2,_0x39324b,_0x321672,_0x48c7b7){var _0x23ece9={'message':_0x39324b};_0x23ece9[_0x402bd2]=!![];if(_0x321672){_0x23ece9['contact']=_0x321672;}if(_0x48c7b7){_0x23ece9['index']=_0x48c7b7;}return _0x23ece9;}function isEmail(_0x5a3f76){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))*$/[_0xa15f('0x14')](_0x5a3f76);}function checkRow(_0x4f95bb,_0xec2027,_0x7c0b81){return new BPromise(function(_0x50a582,_0x33ba22){if(_[_0xa15f('0x15')](_0x4f95bb)){return _0x33ba22(handleCheckRowError(_0xa15f('0x16'),_0xa15f('0x17'),null,_0x7c0b81));}if(_0x4f95bb['errors']&&_0x4f95bb[_0xa15f('0x18')][_0xa15f('0x19')]){var _0x885a36=_['map'](_0x4f95bb[_0xa15f('0x18')],_0xa15f('0x1a'))[_0xa15f('0x1b')](';');return _0x33ba22(handleCheckRowError('error',_0x885a36,null,_0x7c0b81));}var _0x47293d={};for(var _0x179dd8 in FIELDS){if(FIELDS[_0xa15f('0x1c')](_0x179dd8)&&FIELDS[_0x179dd8]){_0x47293d[_0x179dd8]=_0x4f95bb[_0xa15f('0x1d')][0x0][FIELDS[_0x179dd8]]||_0x4f95bb[_0xa15f('0x1d')][0x0]['\ufeff'+FIELDS[_0x179dd8]];}}if(!_0x47293d[_0xa15f('0x1e')]){return _0x33ba22(handleCheckRowError(_0xa15f('0x16'),_0xa15f('0x1f'),null,_0x7c0b81));}if(!_0x47293d[_0xa15f('0x20')]){return _0x33ba22(handleCheckRowError(_0xa15f('0x16'),'phone\x20not\x20specified!',null,_0x7c0b81));}if(_0x47293d[_0xa15f('0x21')]){var _0x48875a=moment(_0x47293d[_0xa15f('0x21')],_0xa15f('0x22'));if(!_0x48875a[_0xa15f('0x23')]()){return _0x33ba22(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x7c0b81));}}if(_0x47293d[_0xa15f('0x24')]){if(!isEmail(_0x47293d[_0xa15f('0x24')])){return _0x33ba22(handleCheckRowError(_0xa15f('0x16'),_0xa15f('0x25'),null,_0x7c0b81));}}_0x47293d[_0xa15f('0x26')]=LISTID;_0x47293d[_0xa15f('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xa15f('0x19')]&&_0xec2027){var _0x574efa={};for(var _0x13898d=0x0,_0x2672ff=DUPLICATES[_0xa15f('0x19')];_0x13898d<_0x2672ff;_0x13898d+=0x1){_0x574efa[DUPLICATES[_0x13898d]]=_0x47293d[DUPLICATES[_0x13898d]];}var _0xca5c18=_[_0xa15f('0x28')](_0xec2027,_0x574efa);if(_0xca5c18){return _0x33ba22(handleCheckRowError(_0xa15f('0x29'),'Duplicate\x20Contact',_0xca5c18,_0x7c0b81));}}return db[_0xa15f('0x2a')][_0xa15f('0x2b')](_0x47293d,{'raw':!![],'hooks':![],'fields':_[_0xa15f('0x2c')](_0x47293d)})[_0xa15f('0x2d')](function(_0x14ab90){if(DUPLICATES&&DUPLICATES['length']&&_0xec2027){_0xec2027['push'](_['pick'](_0x47293d,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x14ab90['id'];return _0x50a582();})[_0xa15f('0x2e')](function(_0x2be591){return _0x33ba22(handleCheckRowError(_0xa15f('0x16'),_0xa15f('0x2f')+(_0x2be591[_0xa15f('0x1a')]||JSON['stringify'](_0x2be591)),null,_0x7c0b81));});});}function checkHopper(){function _0x5f03c2(){return function(_0x43dfc3){logger[_0xa15f('0x16')](_0xa15f('0x30'),_0xa15f('0x31'),util[_0xa15f('0x32')](_0x43dfc3,{'showHidden':![],'depth':null}));};}var _0x14f2b4=function(_0x4196e5,_0x5c041a){var _0x50eba9=squel['insert']()['into'](_0xa15f('0x33'))[_0xa15f('0x34')]([_0xa15f('0x20'),_0xa15f('0x35'),_0xa15f('0x36'),_0xa15f('0x26'),_0x5c041a,_0xa15f('0x37'),_0xa15f('0x38')],squel[_0xa15f('0x39')]()['field'](_0xa15f('0x20'),'phone')[_0xa15f('0x3a')](_0xa15f('0x3b'),'scheduledAt')[_0xa15f('0x3a')]('id',_0xa15f('0x36'))[_0xa15f('0x3a')](LISTID[_0xa15f('0x3c')](),_0xa15f('0x26'))['field'](_0x4196e5['id'][_0xa15f('0x3c')](),_0x5c041a)[_0xa15f('0x3a')](_0xa15f('0x3b'),'createdAt')['field'](_0xa15f('0x3b'),_0xa15f('0x38'))[_0xa15f('0x3d')](_0xa15f('0x3e'))[_0xa15f('0x3f')](_0xa15f('0x40'))['where']('ListId\x20=\x20?',LISTID[_0xa15f('0x3c')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0xa15f('0x41'),squel[_0xa15f('0x39')]()[_0xa15f('0x3a')](_0xa15f('0x20'))[_0xa15f('0x3d')]('cm_hopper')[_0xa15f('0x3f')](_0x5c041a+_0xa15f('0x42'),_0x4196e5['id']['toString']())))[_0xa15f('0x3c')]();return _0x50eba9;};var _0x3362ea=function(_0x23d41d,_0x179731){var _0x461d5d=squel[_0xa15f('0x43')]()[_0xa15f('0x44')](_0xa15f('0x33'))['fromQuery']([_0xa15f('0x20'),_0xa15f('0x35'),'ContactId',_0xa15f('0x26'),_0x179731,'createdAt',_0xa15f('0x38')],squel[_0xa15f('0x39')]()[_0xa15f('0x3a')]('phone',_0xa15f('0x20'))['field'](_0xa15f('0x3b'),_0xa15f('0x35'))['field']('id',_0xa15f('0x36'))[_0xa15f('0x3a')](LISTID[_0xa15f('0x3c')](),'ListId')['field'](_0x23d41d['id']['toString'](),_0x179731)[_0xa15f('0x3a')]('NOW()',_0xa15f('0x37'))[_0xa15f('0x3a')](_0xa15f('0x3b'),'updatedAt')['from'](_0xa15f('0x3e'))[_0xa15f('0x3f')]('deletedAt\x20IS\x20NULL')[_0xa15f('0x3f')](_0xa15f('0x45'),LISTID[_0xa15f('0x3c')]())[_0xa15f('0x3f')](_0xa15f('0x46'),squel[_0xa15f('0x47')](hopperContacts))[_0xa15f('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0xa15f('0x3f')](_0xa15f('0x41'),squel[_0xa15f('0x39')]()[_0xa15f('0x3a')](_0xa15f('0x48'))['from'](_0xa15f('0x49'))[_0xa15f('0x3f')](_0x179731+_0xa15f('0x42'),_0x23d41d['id']['toString']()))[_0xa15f('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa15f('0x39')]()[_0xa15f('0x3a')](_0xa15f('0x20'))[_0xa15f('0x3d')]('cm_hopper')[_0xa15f('0x3f')](_0x179731+_0xa15f('0x42'),_0x23d41d['id']['toString']())))[_0xa15f('0x3c')]();return _0x461d5d;};function _0x123626(_0xf7c8d4,_0x1ba906){var _0x4754d0=squel['insert']()[_0xa15f('0x44')]('cm_hopper')[_0xa15f('0x34')]([_0xa15f('0x20'),_0xa15f('0x35'),_0xa15f('0x36'),'ListId',_0x1ba906,_0xa15f('0x37'),'updatedAt'],squel[_0xa15f('0x39')]()[_0xa15f('0x3a')](_0xa15f('0x20'),'phone')['field']('NOW()',_0xa15f('0x35'))[_0xa15f('0x3a')]('id',_0xa15f('0x36'))[_0xa15f('0x3a')](LISTID['toString'](),_0xa15f('0x26'))[_0xa15f('0x3a')](_0xf7c8d4['id'][_0xa15f('0x3c')](),_0x1ba906)[_0xa15f('0x3a')](_0xa15f('0x3b'),_0xa15f('0x37'))[_0xa15f('0x3a')](_0xa15f('0x3b'),'updatedAt')['from'](_0xa15f('0x3e'))[_0xa15f('0x3f')](_0xa15f('0x40'))[_0xa15f('0x3f')]('ListId\x20=\x20?',LISTID[_0xa15f('0x3c')]())['where'](_0xa15f('0x46'),squel[_0xa15f('0x47')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x4754d0;}function _0x58ce85(_0x194429,_0x3cf617){var _0x2f7655=squel[_0xa15f('0x43')]()['into'](_0xa15f('0x4a'))['fromQuery']([_0xa15f('0x20'),'ContactId',_0xa15f('0x26'),_0x3cf617,_0xa15f('0x37'),_0xa15f('0x38')],squel[_0xa15f('0x39')]()[_0xa15f('0x3a')](_0xa15f('0x20'),_0xa15f('0x20'))['field']('id',_0xa15f('0x36'))['field'](LISTID['toString'](),_0xa15f('0x26'))[_0xa15f('0x3a')](_0x194429['id'][_0xa15f('0x3c')](),_0x3cf617)['field']('NOW()',_0xa15f('0x37'))['field'](_0xa15f('0x3b'),_0xa15f('0x38'))[_0xa15f('0x3d')](_0xa15f('0x3e'))[_0xa15f('0x3f')](_0xa15f('0x40'))[_0xa15f('0x3f')](_0xa15f('0x45'),LISTID[_0xa15f('0x3c')]())[_0xa15f('0x3f')](_0xa15f('0x46'),squel['str'](hopperContacts))['where'](_0xa15f('0x4b')))[_0xa15f('0x3c')]();return _0x2f7655;}return db['VoiceQueue'][_0xa15f('0x4c')]({'where':{'type':'outbound'},'attributes':['id',_0xa15f('0x4d')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xa15f('0x2d')](function(_0x5b853a){var _0x449ae7=[];if(_0x5b853a){var _0x2762c8;for(var _0x49a3f4=0x0,_0x5b3781;_0x49a3f4<_0x5b853a[_0xa15f('0x19')];_0x49a3f4+=0x1){_0x5b3781=_0x5b853a[_0x49a3f4][_0xa15f('0x4e')]({'plain':!![]});switch(_0x5b3781[_0xa15f('0x4d')]){case _0xa15f('0x4f'):_0x449ae7[_0xa15f('0x50')](db[_0xa15f('0x51')][_0xa15f('0x52')](_0x3362ea(_0x5b3781,'VoiceQueueId'))[_0xa15f('0x2d')](function(){})['catch'](_0x5f03c2()));break;case _0xa15f('0x53'):_0x449ae7['push'](db[_0xa15f('0x51')]['query'](_0x14f2b4(_0x5b3781,_0xa15f('0x54')))['then'](function(){})[_0xa15f('0x2e')](_0x5f03c2()));break;default:_0x449ae7[_0xa15f('0x50')](db['sequelize'][_0xa15f('0x52')](_0x123626(_0x5b3781,_0xa15f('0x54')))[_0xa15f('0x2d')](function(){})[_0xa15f('0x2e')](_0x5f03c2()));}}}return _0x449ae7;})['all']()['then'](function(){return db[_0xa15f('0x55')][_0xa15f('0x4c')]({'where':{'type':_0xa15f('0x56')},'attributes':['id'],'include':[{'model':db[_0xa15f('0x57')],'as':_0xa15f('0x58'),'where':{'id':LISTID}}]})[_0xa15f('0x2d')](function(_0x2961b6){var _0x4da718=[];if(_0x2961b6){var _0x185ecb;for(var _0x31fa3e=0x0,_0x3c7ad7;_0x31fa3e<_0x2961b6[_0xa15f('0x19')];_0x31fa3e+=0x1){_0x3c7ad7=_0x2961b6[_0x31fa3e][_0xa15f('0x4e')]({'plain':!![]});_0x4da718[_0xa15f('0x50')](db[_0xa15f('0x51')][_0xa15f('0x52')](_0x58ce85(_0x3c7ad7,_0xa15f('0x54')))[_0xa15f('0x2d')](function(){})[_0xa15f('0x2e')](_0x5f03c2()));}}return _0x4da718;})['all']();})[_0xa15f('0x2d')](function(){return db[_0xa15f('0x59')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xa15f('0x57')],'as':'Lists','where':{'id':LISTID}}]})[_0xa15f('0x2d')](function(_0x6c7903){var _0x1d5451=[];if(_0x6c7903){for(var _0x28639a=0x0,_0x214105;_0x28639a<_0x6c7903[_0xa15f('0x19')];_0x28639a+=0x1){_0x214105=_0x6c7903[_0x28639a][_0xa15f('0x4e')]({'plain':!![]});switch(_0x214105[_0xa15f('0x4d')]){case'always':_0x1d5451['push'](db['sequelize'][_0xa15f('0x52')](_0x3362ea(_0x214105,'CampaignId'))[_0xa15f('0x2d')](function(){})['catch'](_0x5f03c2()));break;case _0xa15f('0x53'):_0x1d5451[_0xa15f('0x50')](db[_0xa15f('0x51')][_0xa15f('0x52')](_0x14f2b4(_0x214105,'CampaignId'))[_0xa15f('0x2d')](function(){})['catch'](_0x5f03c2()));break;default:_0x1d5451[_0xa15f('0x50')](db[_0xa15f('0x51')]['query'](_0x123626(_0x214105,_0xa15f('0x5a')))[_0xa15f('0x2d')](function(){})[_0xa15f('0x2e')](_0x5f03c2()));}}}return _0x1d5451;})['all']();})[_0xa15f('0x2d')](function(){return db[_0xa15f('0x59')][_0xa15f('0x4c')]({'attributes':['id'],'include':[{'model':db[_0xa15f('0x57')],'as':_0xa15f('0x58'),'where':{'id':LISTID}}]})[_0xa15f('0x2d')](function(_0x5c84db){var _0x3db560=[];if(_0x5c84db){for(var _0x21a6b1=0x0,_0x5ac77f;_0x21a6b1<_0x5c84db[_0xa15f('0x19')];_0x21a6b1+=0x1){_0x5ac77f=_0x5c84db[_0x21a6b1]['get']({'plain':!![]});_0x3db560[_0xa15f('0x50')](db['sequelize'][_0xa15f('0x52')](_0x58ce85(_0x5ac77f,_0xa15f('0x5a')))[_0xa15f('0x2d')](function(){})[_0xa15f('0x2e')](_0x5f03c2()));}}return _0x3db560;})[_0xa15f('0x5b')]();})['catch'](function(_0x4b83f5){logger[_0xa15f('0x16')](_0xa15f('0x5c'),_0xa15f('0x5d'),_0x4b83f5[_0xa15f('0x1a')]);});}var processPromises=function(_0x3e78fb){return BPromise['all'](promises)[_0xa15f('0x2d')](function(_0x481e80){})['catch'](function(_0x249544){logger['error'](_0xa15f('0x5e'),JSON[_0xa15f('0x5f')](_0x249544));})[_0xa15f('0x60')](function(){socket[_0xa15f('0x61')](_0xa15f('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3e78fb){return _0x3e78fb[_0xa15f('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0xa15f('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0xa15f('0x2d')](function(){socket[_0xa15f('0x61')](_0xa15f('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xa15f('0x64')](FILEPATH);}catch(_0x475562){logger[_0xa15f('0x16')](_0xa15f('0x65'),JSON[_0xa15f('0x5f')](_0x475562));}finally{process['exit'](0x0);}});};process['on'](_0xa15f('0x66'),function(){logger[_0xa15f('0x67')](_0xa15f('0x68'));endCsv();});function main(){return BPromise[_0xa15f('0x69')]()[_0xa15f('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xa15f('0x12')](',');return db['CmContact'][_0xa15f('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa15f('0x2d')](function(_0x2d023e){var _0x14cea0=fs[_0xa15f('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa15f('0x6b')](_0x14cea0,{'header':!![],'skipEmptyLines':!![],'step':function(_0x77ab62,_0x4f32db){total+=0x1;var _0x583fe8=total;promises[_0xa15f('0x50')](checkRow(_0x77ab62,_0x2d023e,_0x583fe8)[_0xa15f('0x2d')](function(){success+=0x1;})[_0xa15f('0x2e')](function(_0x12dc7d){if(_0x12dc7d['error']){errors+=0x1;delete _0x12dc7d['error'];}else if(_0x12dc7d[_0xa15f('0x29')]){duplicates+=0x1;delete _0x12dc7d[_0xa15f('0x29')];}rows['push'](_0x12dc7d);}));if(total%0xc8===0x0){_0x4f32db['pause']();return processPromises(_0x4f32db);}},'complete':function(){return processPromises()[_0xa15f('0x2d')](function(){logger[_0xa15f('0x67')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x12b719,_0x5e110a){logger[_0xa15f('0x67')](_0xa15f('0x6c'),JSON['stringify'](_0x12b719));endCsv();}});})[_0xa15f('0x2e')](function(_0x573005){logger[_0xa15f('0x16')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xa15f('0x5f')](_0x573005));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 7432a2c..9fcccc4 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 _0xf978=['arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','ioredis','../../../mysqldb','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','.id\x20=\x20','where','\x20=\x20','join','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_hopper_black','cm_contacts','field','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','message','exit','errors','code','sequelize','spread','catch','error','main','stringify','send','start','binding','socket_timestamp','root','.csv','header','writeFileSync','createReadStream','data','rows','replace','isValid','push','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','length','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','each','then','finish','affectedRows','emit','unlink','complete','argv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf978,0x1a9));var _0x8f97=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xf978[_0x1d24eb];return _0x1dc576;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x8f97('0x0'));var Papa=require(_0x8f97('0x1'));var util=require(_0x8f97('0x2'));var BPromise=require(_0x8f97('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0x8f97('0x4'));var db=require(_0x8f97('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x8f97('0x6'))(_0x8f97('0x7'));config[_0x8f97('0x8')]=_['defaults'](config[_0x8f97('0x8')],{'host':_0x8f97('0x9'),'port':0x18eb});var socket=require(_0x8f97('0xa'))(new Redis(config[_0x8f97('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x8f97('0xb')](_0x8f97('0xc'));function isEmail(_0x2b4c74){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))*$/[_0x8f97('0xd')](_0x2b4c74);}function selectNotIn(_0x536a7c,_0x9da192,_0x544c57,_0x208dc4,_0x2774bf){return squel[_0x8f97('0xe')]()['field'](_0x8f97('0xf'))[_0x8f97('0x10')](_0x208dc4)['join'](_0x9da192,null,_0x9da192+_0x8f97('0x11')+_0x208dc4+'.'+_0x544c57)[_0x8f97('0x12')](_0x208dc4+'.'+_0x544c57+_0x8f97('0x13')+_0x536a7c+'.'+_0x544c57)['where'](_0x9da192+'.dialCheckDuplicateType\x20IN\x20('+_0x2774bf[_0x8f97('0x14')]()+')');}function insertCmHopper(_0x313e74,_0x82c7eb,_0x6b0fa4,_0xa37b10,_0x759c06){var _0x2d5f4c=['cm_contacts.phone',_0x8f97('0x15'),_0x8f97('0x16'),_0x8f97('0x17'),_0x82c7eb+'.'+_0xa37b10,_0x8f97('0x18'),_0x8f97('0x19'),_0x8f97('0x1a'),_0x8f97('0x1b'),'\x22'+_0x759c06+'\x22'];return squel[_0x8f97('0x1c')]()[_0x8f97('0x1d')](_0x8f97('0x1e'))[_0x8f97('0x1f')]([_0x8f97('0xf'),_0x8f97('0x20'),_0x8f97('0x21'),_0x8f97('0x22'),_0xa37b10,_0x8f97('0x23'),_0x8f97('0x24'),_0x8f97('0x25'),'UserId',_0x8f97('0x26')],squel[_0x8f97('0xe')]()[_0x8f97('0x27')](_0x2d5f4c)[_0x8f97('0x10')](_0x82c7eb)['join']('cm_contacts',null,_0x8f97('0x28')+_0x82c7eb+_0x8f97('0x29'))['join'](_0x6b0fa4,null,_0x6b0fa4+_0x8f97('0x11')+_0x82c7eb+'.'+_0xa37b10)[_0x8f97('0x12')](_0x82c7eb+_0x8f97('0x2a'),_0x313e74)[_0x8f97('0x12')](_0x8f97('0x2b'),NOW)[_0x8f97('0x12')](_0x8f97('0x2c'),selectNotIn(_0x82c7eb,_0x6b0fa4,_0xa37b10,_0x8f97('0x1e'),[_0x8f97('0x2d'),_0x8f97('0x2e')]))[_0x8f97('0x12')](_0x8f97('0x2c'),selectNotIn(_0x82c7eb,_0x6b0fa4,_0xa37b10,_0x8f97('0x1e'),['\x22always\x22'])))[_0x8f97('0x2f')]();}function insertCmHopperBlack(_0x2d5ad3,_0x5f5de4,_0x3b0c74,_0x2f6fe9){var _0x180509=[_0x8f97('0x30'),_0x8f97('0x16'),_0x8f97('0x17'),_0x5f5de4+'.'+_0x2f6fe9,_0x8f97('0x18'),_0x8f97('0x19')];return squel['insert']()[_0x8f97('0x1d')](_0x8f97('0x31'))['fromQuery']([_0x8f97('0xf'),'ContactId','ListId',_0x2f6fe9,'createdAt',_0x8f97('0x24')],squel[_0x8f97('0xe')]()[_0x8f97('0x27')](_0x180509)[_0x8f97('0x10')](_0x5f5de4)['join'](_0x8f97('0x32'),null,'cm_contacts.ListId\x20=\x20'+_0x5f5de4+_0x8f97('0x29'))[_0x8f97('0x14')](_0x3b0c74,null,_0x3b0c74+_0x8f97('0x11')+_0x5f5de4+'.'+_0x2f6fe9)['where'](_0x5f5de4+'.CmListId\x20=\x20?',_0x2d5ad3)[_0x8f97('0x12')](_0x8f97('0x2b'),NOW)[_0x8f97('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x8f97('0xe')]()[_0x8f97('0x33')](_0x8f97('0xf'))[_0x8f97('0x10')](_0x8f97('0x31'))[_0x8f97('0x12')](_0x8f97('0x34'),_0x2d5ad3)['where'](_0x2f6fe9+_0x8f97('0x35'),_0x5f5de4+'.'+_0x2f6fe9)))[_0x8f97('0x2f')]();}function insertCmContact(_0x3f9458,_0x52a864,_0x5a73ce,_0x3e19ed){var _0x47f6c5=_[_0x8f97('0x36')](_[_0x8f97('0x37')](_0x3e19ed),[_0x8f97('0x22'),_0x8f97('0x38'),_0x8f97('0x23'),_0x8f97('0x24')]);return squel[_0x8f97('0x1c')]()['into'](_0x8f97('0x32'))['fromQuery'](_0x47f6c5,squel[_0x8f97('0xe')]()[_0x8f97('0x27')](_0x47f6c5)[_0x8f97('0x10')](_0x52a864)[_0x8f97('0x12')]('('+_0x5a73ce['join'](',')+_0x8f97('0x39'),squel['select']()['fields'](_0x5a73ce)['from'](_0x8f97('0x32'))[_0x8f97('0x12')](_0x8f97('0x34'),_0x3f9458)[_0x8f97('0x12')](_0x8f97('0x3a')))['where'](_0x8f97('0x3b'),squel[_0x8f97('0xe')]()['field'](_0x8f97('0x3c'),'min_id')[_0x8f97('0x10')](_0x52a864)[_0x8f97('0x3d')](_0x5a73ce[_0x8f97('0x14')](','))))[_0x8f97('0x2f')]();}function handleStop(){logger[_0x8f97('0x3e')](_0x8f97('0x3f'));stopped=!![];}function handleUncaughtException(_0x52bdf2){logger['error'](_0x52bdf2[_0x8f97('0x40')]);process[_0x8f97('0x41')](0x1);}function handleError(_0x51ca4e,_0x579fb8){stats[_0x8f97('0x42')]['push']({'name':_0x579fb8[_0x8f97('0x43')],'message':_0x579fb8[_0x8f97('0x40')],'row':_0x51ca4e});}function handleQuery(_0x1a3561){logger[_0x8f97('0x3e')](_0x1a3561);return db[_0x8f97('0x44')]['query'](_0x1a3561)[_0x8f97('0x45')](function(_0x29e176){results['push'](_0x29e176);})[_0x8f97('0x46')](function(_0x1f6ae2){logger[_0x8f97('0x47')](_0x1f6ae2[_0x8f97('0x40')]);});}function main(_0x1e3014,_0x1e621f,_0x206d42,_0x2822b2){logger[_0x8f97('0x3e')](_0x8f97('0x48'),_0x1e3014,JSON[_0x8f97('0x49')](_0x1e621f));process[_0x8f97('0x4a')](_0x8f97('0x4b'));var _0x45622d=_0x1e621f[_0x8f97('0x4c')];var _0x4a5fd9=_0x1e621f[_0x8f97('0x4d')];var _0x394164=path[_0x8f97('0x14')](config[_0x8f97('0x4e')],'server/files/tmp',_0x4a5fd9+_0x8f97('0x4f'));var _0x297b0b=_['keys'](_0x45622d)[_0x8f97('0x14')]();logger[_0x8f97('0x3e')](_0x8f97('0x50'),_0x297b0b);fs[_0x8f97('0x51')](_0x394164,_0x297b0b+'\x0a');Papa['parse'](fs[_0x8f97('0x52')](_0x1e3014),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4bd3a9,_0x53f642){try{for(var _0x26cd26=0x0,_0x113e36=[];_0x26cd26<_0x4bd3a9[_0x8f97('0x53')]['length'];_0x26cd26++){stats[_0x8f97('0x54')]+=0x1;if(_0x4bd3a9[_0x8f97('0x42')][_0x26cd26]){handleError(_0x4bd3a9[_0x8f97('0x53')][_0x26cd26],_0x4bd3a9['errors'][_0x26cd26]);}else{var _0x4416bf=[];for(var _0x27a381 in _0x45622d){if(_0x45622d['hasOwnProperty'](_0x27a381)){if(_0x4bd3a9[_0x8f97('0x53')][_0x26cd26][_0x45622d[_0x27a381]]){var _0x68792c=_['trim'](_0x4bd3a9[_0x8f97('0x53')][_0x26cd26][_0x45622d[_0x27a381]][_0x8f97('0x55')](/"/g,'\x27'));switch(_0x27a381){case _0x8f97('0x20'):var _0x3a07e4=moment(_0x68792c,_0x8f97('0xc'),!![]);if(_0x3a07e4[_0x8f97('0x56')]()){_0x113e36[_0x8f97('0x57')]('\x22'+_0x68792c+'\x22');}else{_0x4416bf[_0x8f97('0x57')](_0x8f97('0x58'));}break;case _0x8f97('0x25'):var _0x342680=parseInt(_0x68792c);_0x68792c=_[_0x8f97('0x59')](_0x342680)||_0x342680<0x0||_0x342680>0x4?_0x2822b2?0x3:0x2:_0x342680;_0x113e36['push']('\x22'+_0x68792c+'\x22');break;case'UserId':var _0x3a47ad=parseInt(_0x68792c);if(_[_0x8f97('0x5a')](_0x3a47ad)&&_[_0x8f97('0x5b')](_0x206d42,_0x3a47ad)){_0x113e36[_0x8f97('0x57')]('\x22'+_0x3a47ad+'\x22');}else{_0x4416bf[_0x8f97('0x57')]('agent\x20not\x20exists');}break;case _0x8f97('0x5c'):if(isEmail(_0x68792c)){_0x113e36[_0x8f97('0x57')]('\x22'+_0x68792c+'\x22');}else{_0x4416bf[_0x8f97('0x57')]('email\x20wrong\x20format');}break;case _0x8f97('0x5d'):var _0x1da118=moment(_0x68792c,_0x8f97('0x5e'),!![]);if(_0x1da118[_0x8f97('0x56')]()){_0x113e36[_0x8f97('0x57')]('\x22'+_0x68792c+'\x22');}else{_0x4416bf[_0x8f97('0x57')](_0x8f97('0x5f'));}break;default:_0x113e36[_0x8f97('0x57')]('\x22'+_0x68792c+'\x22');}}else{switch(_0x27a381){case _0x8f97('0x60'):case _0x8f97('0xf'):_0x4416bf[_0x8f97('0x57')](_0x27a381+'\x20not\x20specified');break;default:_0x113e36[_0x8f97('0x57')]('\x22\x22');}}}}if(_0x4416bf[_0x8f97('0x61')]){handleError(_0x4bd3a9[_0x8f97('0x53')][_0x26cd26],{'code':_0x8f97('0x62'),'message':_0x4416bf[_0x8f97('0x14')]()});}else{fs[_0x8f97('0x63')](_0x394164,_0x113e36[_0x8f97('0x14')]()+'\x0a');}_0x113e36=[];}if(!(stats[_0x8f97('0x54')]%0xc8)){socket['emit'](_0x8f97('0x64')+_0x4a5fd9,stats);stats[_0x8f97('0x42')]=[];}}if(stopped){logger[_0x8f97('0x3e')](_0x8f97('0x65'));_0x53f642[_0x8f97('0x66')]();}}catch(_0x55370e){handleError(_0x4bd3a9['data'][_0x26cd26],{'code':'SystemError','message':_0x55370e[_0x8f97('0x40')]});logger['error'](_0x8f97('0x67'),_0x55370e[_0x8f97('0x40')]);}},'complete':function(){try{var _0x5656d2=[];var _0x3da7df=_0x8f97('0x32');if(_0x1e621f[_0x8f97('0x68')]&&_0x1e621f[_0x8f97('0x68')][_0x8f97('0x61')]){_0x3da7df=_0x8f97('0x69')+_0x4a5fd9;_0x5656d2[_0x8f97('0x57')]('CREATE\x20TABLE\x20'+_0x3da7df+'\x20LIKE\x20cm_contacts;');}var _0x4e4778=util['format']('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',_0x394164,_0x3da7df,_0x297b0b,_0x1e621f[_0x8f97('0x22')],_0x1e621f['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x45622d[_0x8f97('0x20')])){_0x4e4778+=_0x8f97('0x6a');}_0x5656d2[_0x8f97('0x57')](_0x4e4778);if(_0x1e621f[_0x8f97('0x68')]&&_0x1e621f[_0x8f97('0x68')][_0x8f97('0x61')]){_0x5656d2[_0x8f97('0x57')](insertCmContact(_0x1e621f[_0x8f97('0x22')],_0x3da7df,_0x1e621f[_0x8f97('0x68')],_0x45622d));_0x5656d2['push'](_0x8f97('0x6b')+_0x3da7df+';');}_0x5656d2['push'](insertCmHopper(_0x1e621f['ListId'],'voice_queues_has_cm_lists',_0x8f97('0x6c'),_0x8f97('0x6d'),_0x2822b2));_0x5656d2[_0x8f97('0x57')](insertCmHopperBlack(_0x1e621f[_0x8f97('0x22')],_0x8f97('0x6e'),_0x8f97('0x6c'),_0x8f97('0x6d')));_0x5656d2[_0x8f97('0x57')](insertCmHopper(_0x1e621f[_0x8f97('0x22')],_0x8f97('0x6f'),_0x8f97('0x70'),'CampaignId',_0x2822b2));_0x5656d2[_0x8f97('0x57')](insertCmHopperBlack(_0x1e621f[_0x8f97('0x22')],_0x8f97('0x71'),_0x8f97('0x70'),_0x8f97('0x72')));BPromise[_0x8f97('0x73')](_0x5656d2,handleQuery)[_0x8f97('0x74')](function(_0x4cecf5){stats[_0x8f97('0x75')]=!![];stats['affectedRows']=_0x1e621f['duplicates']&&_0x1e621f[_0x8f97('0x68')][_0x8f97('0x61')]?results[0x2][_0x8f97('0x76')]:results[0x0][_0x8f97('0x76')];socket[_0x8f97('0x77')](_0x8f97('0x64')+_0x4a5fd9,stats);fs[_0x8f97('0x78')](_0x1e3014);fs['unlink'](_0x394164);process[_0x8f97('0x41')](0x0);})[_0x8f97('0x46')](function(_0x5a7b44){logger[_0x8f97('0x47')](_0x5a7b44['message']);process[_0x8f97('0x41')](0x1);});}catch(_0x45a82c){logger[_0x8f97('0x47')](_0x8f97('0x79'),_0x45a82c[_0x8f97('0x40')]);process['exit'](0x1);}},'error':function(_0x2012a9,_0x143a5a,_0x43c4e2,_0x212c4a){throw new Error(_0x212c4a);}});}function validate(){if(process[_0x8f97('0x7a')]&&process['argv'][_0x8f97('0x61')]<0x4){throw new Error(_0x8f97('0x7b'));}var _0x53ff4e=path[_0x8f97('0x14')](config[_0x8f97('0x4e')],_0x8f97('0x7c'),process[_0x8f97('0x7a')][0x2]);if(!fs[_0x8f97('0x7d')](_0x53ff4e)){throw new Error(_0x8f97('0x7e'));}var _0x252299={};try{_0x252299=JSON[_0x8f97('0x7f')](process[_0x8f97('0x7a')][0x3]);if(!_0x252299['binding']){throw new Error(_0x8f97('0x80'));}if(!_0x252299[_0x8f97('0x4c')][_0x8f97('0xf')]){throw new Error(_0x8f97('0x81'));}if(!_0x252299[_0x8f97('0x4c')]['firstName']){throw new Error(_0x8f97('0x82'));}var _0x3d04c3=0x0;if(_0x252299['binding'][_0x8f97('0x83')]){_0x3d04c3=0x1;}if(!_0x252299[_0x8f97('0x22')]){throw new Error(_0x8f97('0x84'));}}catch(_0x2dbf50){throw new Error(_0x8f97('0x85'));}var _0x544296=[];try{_0x544296=_['map'](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x5b487a){logger['info'](_0x8f97('0x86'));}main(_0x53ff4e,_0x252299,_0x544296,_0x3d04c3);}validate();process['on'](_0x8f97('0x87'),handleStop);process['on'](_0x8f97('0x88'),handleUncaughtException); \ No newline at end of file +var _0xdef1=['arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','squel','ioredis','../../../mysqldb','../../../config/logger','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','join','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','from','cm_contacts.ListId\x20=\x20','.id\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','cm_hopper_black','.CmListId','.CmListId\x20=\x20?','concat','CompanyId','cm_contacts','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','main','stringify','send','start','binding','socket_timestamp','server/files/tmp','.csv','header','parse','createReadStream','data','length','rows','hasOwnProperty','trim','replace','isValid','isNaN','UserId','isNumber','includes','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','emit','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','voice_queues_has_cm_lists','voice_queues_has_cm_blacklists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','each','finish','affectedRows','contact:import:','unlink','complete','argv'];(function(_0x22490e,_0x4935bd){var _0x5b6459=function(_0x46ab8e){while(--_0x46ab8e){_0x22490e['push'](_0x22490e['shift']());}};_0x5b6459(++_0x4935bd);}(_0xdef1,0x116));var _0x1def=function(_0x3ae799,_0xbc1a81){_0x3ae799=_0x3ae799-0x0;var _0x308a2b=_0xdef1[_0x3ae799];return _0x308a2b;};'use strict';var fs=require('fs');var path=require(_0x1def('0x0'));var _=require(_0x1def('0x1'));var Papa=require(_0x1def('0x2'));var util=require(_0x1def('0x3'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x1def('0x4'));var Redis=require(_0x1def('0x5'));var db=require(_0x1def('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x1def('0x7'))('import');config[_0x1def('0x8')]=_['defaults'](config[_0x1def('0x8')],{'host':_0x1def('0x9'),'port':0x18eb});var socket=require(_0x1def('0xa'))(new Redis(config[_0x1def('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x1def('0xb')](_0x1def('0xc'));function isEmail(_0x2c5a6d){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))*$/[_0x1def('0xd')](_0x2c5a6d);}function selectNotIn(_0x5db480,_0x3dc3f0,_0x2d1b78,_0x5e8c63,_0x12d71c){return squel[_0x1def('0xe')]()[_0x1def('0xf')](_0x1def('0x10'))['from'](_0x5e8c63)[_0x1def('0x11')](_0x3dc3f0,null,_0x3dc3f0+'.id\x20=\x20'+_0x5e8c63+'.'+_0x2d1b78)['where'](_0x5e8c63+'.'+_0x2d1b78+_0x1def('0x12')+_0x5db480+'.'+_0x2d1b78)[_0x1def('0x13')](_0x3dc3f0+_0x1def('0x14')+_0x12d71c[_0x1def('0x11')]()+')');}function insertCmHopper(_0x3a7589,_0x46fb30,_0x2410a3,_0x4f1d95,_0x2dd2d9){var _0x1e36a8=[_0x1def('0x15'),_0x1def('0x16'),_0x1def('0x17'),_0x1def('0x18'),_0x46fb30+'.'+_0x4f1d95,_0x1def('0x19'),_0x1def('0x1a'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x2dd2d9+'\x22'];return squel['insert']()[_0x1def('0x1b')]('cm_hopper')[_0x1def('0x1c')]([_0x1def('0x10'),_0x1def('0x1d'),_0x1def('0x1e'),_0x1def('0x1f'),_0x4f1d95,_0x1def('0x20'),_0x1def('0x21'),_0x1def('0x22'),'UserId',_0x1def('0x23')],squel[_0x1def('0xe')]()[_0x1def('0x24')](_0x1e36a8)[_0x1def('0x25')](_0x46fb30)[_0x1def('0x11')]('cm_contacts',null,_0x1def('0x26')+_0x46fb30+'.CmListId')[_0x1def('0x11')](_0x2410a3,null,_0x2410a3+_0x1def('0x27')+_0x46fb30+'.'+_0x4f1d95)[_0x1def('0x13')](_0x46fb30+'.CmListId\x20=\x20?',_0x3a7589)['where'](_0x1def('0x28'),NOW)[_0x1def('0x13')](_0x1def('0x29'),selectNotIn(_0x46fb30,_0x2410a3,_0x4f1d95,_0x1def('0x2a'),[_0x1def('0x2b'),_0x1def('0x2c')]))[_0x1def('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x46fb30,_0x2410a3,_0x4f1d95,'cm_hopper',[_0x1def('0x2b')])))[_0x1def('0x2d')]();}function insertCmHopperBlack(_0x4cb6e0,_0x2cc185,_0x1fdd63,_0x3baf00){var _0x56fa11=[_0x1def('0x15'),_0x1def('0x17'),_0x1def('0x18'),_0x2cc185+'.'+_0x3baf00,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x1def('0x2e')]()[_0x1def('0x1b')](_0x1def('0x2f'))[_0x1def('0x1c')]([_0x1def('0x10'),_0x1def('0x1e'),'ListId',_0x3baf00,_0x1def('0x20'),_0x1def('0x21')],squel[_0x1def('0xe')]()[_0x1def('0x24')](_0x56fa11)[_0x1def('0x25')](_0x2cc185)[_0x1def('0x11')]('cm_contacts',null,_0x1def('0x26')+_0x2cc185+_0x1def('0x30'))[_0x1def('0x11')](_0x1fdd63,null,_0x1fdd63+_0x1def('0x27')+_0x2cc185+'.'+_0x3baf00)['where'](_0x2cc185+_0x1def('0x31'),_0x4cb6e0)[_0x1def('0x13')](_0x1def('0x28'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x1def('0xe')]()[_0x1def('0xf')]('phone')[_0x1def('0x25')]('cm_hopper_black')[_0x1def('0x13')]('ListId\x20=\x20?',_0x4cb6e0)[_0x1def('0x13')](_0x3baf00+'\x20=\x20?',_0x2cc185+'.'+_0x3baf00)))[_0x1def('0x2d')]();}function insertCmContact(_0x48a468,_0x14f166,_0x1cb059,_0x35d40f){var _0x2fa70a=_[_0x1def('0x32')](_['keys'](_0x35d40f),[_0x1def('0x1f'),_0x1def('0x33'),_0x1def('0x20'),_0x1def('0x21')]);return squel[_0x1def('0x2e')]()[_0x1def('0x1b')](_0x1def('0x34'))[_0x1def('0x1c')](_0x2fa70a,squel['select']()[_0x1def('0x24')](_0x2fa70a)[_0x1def('0x25')](_0x14f166)['where']('('+_0x1cb059['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x1def('0xe')]()[_0x1def('0x24')](_0x1cb059)[_0x1def('0x25')](_0x1def('0x34'))['where'](_0x1def('0x35'),_0x48a468)['where'](_0x1def('0x36')))['where'](_0x1def('0x37'),squel[_0x1def('0xe')]()['field'](_0x1def('0x38'),_0x1def('0x39'))[_0x1def('0x25')](_0x14f166)['group'](_0x1cb059['join'](','))))[_0x1def('0x2d')]();}function handleStop(){logger[_0x1def('0x3a')](_0x1def('0x3b'));stopped=!![];}function handleUncaughtException(_0x409df2){logger[_0x1def('0x3c')](_0x409df2[_0x1def('0x3d')]);process[_0x1def('0x3e')](0x1);}function handleError(_0x21f9ea,_0x51868e){stats[_0x1def('0x3f')][_0x1def('0x40')]({'name':_0x51868e[_0x1def('0x41')],'message':_0x51868e[_0x1def('0x3d')],'row':_0x21f9ea});}function handleQuery(_0x51bbcf){logger['info'](_0x51bbcf);return db[_0x1def('0x42')][_0x1def('0x43')](_0x51bbcf)[_0x1def('0x44')](function(_0x5ca97f){results[_0x1def('0x40')](_0x5ca97f);})[_0x1def('0x45')](function(_0x2dd073){logger['error'](_0x2dd073[_0x1def('0x3d')]);});}function main(_0x4c809a,_0x476a63,_0x506271,_0x3a2daa){logger[_0x1def('0x3a')](_0x1def('0x46'),_0x4c809a,JSON[_0x1def('0x47')](_0x476a63));process[_0x1def('0x48')](_0x1def('0x49'));var _0x366f67=_0x476a63[_0x1def('0x4a')];var _0x495cf3=_0x476a63[_0x1def('0x4b')];var _0xcd0f6e=path['join'](config['root'],_0x1def('0x4c'),_0x495cf3+_0x1def('0x4d'));var _0x15977d=_['keys'](_0x366f67)[_0x1def('0x11')]();logger[_0x1def('0x3a')](_0x1def('0x4e'),_0x15977d);fs['writeFileSync'](_0xcd0f6e,_0x15977d+'\x0a');Papa[_0x1def('0x4f')](fs[_0x1def('0x50')](_0x4c809a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4c8601,_0x3c798f){try{for(var _0x51f819=0x0,_0x39bdbf=[];_0x51f819<_0x4c8601[_0x1def('0x51')][_0x1def('0x52')];_0x51f819++){stats[_0x1def('0x53')]+=0x1;if(_0x4c8601[_0x1def('0x3f')][_0x51f819]){handleError(_0x4c8601[_0x1def('0x51')][_0x51f819],_0x4c8601[_0x1def('0x3f')][_0x51f819]);}else{var _0xba1d43=[];for(var _0x347762 in _0x366f67){if(_0x366f67[_0x1def('0x54')](_0x347762)){if(_0x4c8601[_0x1def('0x51')][_0x51f819][_0x366f67[_0x347762]]){var _0x4c098b=_[_0x1def('0x55')](_0x4c8601['data'][_0x51f819][_0x366f67[_0x347762]][_0x1def('0x56')](/"/g,'\x27'));switch(_0x347762){case'scheduledat':var _0x2a8811=moment(_0x4c098b,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x2a8811[_0x1def('0x57')]()){_0x39bdbf['push']('\x22'+_0x4c098b+'\x22');}else{_0xba1d43[_0x1def('0x40')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x1def('0x22'):var _0x493bff=parseInt(_0x4c098b);_0x4c098b=_[_0x1def('0x58')](_0x493bff)||_0x493bff<0x0||_0x493bff>0x4?_0x3a2daa?0x3:0x2:_0x493bff;_0x39bdbf['push']('\x22'+_0x4c098b+'\x22');break;case _0x1def('0x59'):var _0x137dff=parseInt(_0x4c098b);if(_[_0x1def('0x5a')](_0x137dff)&&_[_0x1def('0x5b')](_0x506271,_0x137dff)){_0x39bdbf[_0x1def('0x40')]('\x22'+_0x137dff+'\x22');}else{_0xba1d43[_0x1def('0x40')]('agent\x20not\x20exists');}break;case _0x1def('0x5c'):if(isEmail(_0x4c098b)){_0x39bdbf['push']('\x22'+_0x4c098b+'\x22');}else{_0xba1d43['push']('email\x20wrong\x20format');}break;case _0x1def('0x5d'):var _0x3e39a4=moment(_0x4c098b,_0x1def('0x5e'),!![]);if(_0x3e39a4['isValid']()){_0x39bdbf[_0x1def('0x40')]('\x22'+_0x4c098b+'\x22');}else{_0xba1d43[_0x1def('0x40')](_0x1def('0x5f'));}break;default:_0x39bdbf[_0x1def('0x40')]('\x22'+_0x4c098b+'\x22');}}else{switch(_0x347762){case _0x1def('0x60'):case _0x1def('0x10'):_0xba1d43[_0x1def('0x40')](_0x347762+_0x1def('0x61'));break;default:_0x39bdbf[_0x1def('0x40')]('\x22\x22');}}}}if(_0xba1d43['length']){handleError(_0x4c8601[_0x1def('0x51')][_0x51f819],{'code':_0x1def('0x62'),'message':_0xba1d43['join']()});}else{fs['appendFileSync'](_0xcd0f6e,_0x39bdbf[_0x1def('0x11')]()+'\x0a');}_0x39bdbf=[];}if(!(stats[_0x1def('0x53')]%0xc8)){socket[_0x1def('0x63')]('contact:import:'+_0x495cf3,stats);stats[_0x1def('0x3f')]=[];}}if(stopped){logger[_0x1def('0x3a')]('Abort\x20parser');_0x3c798f[_0x1def('0x64')]();}}catch(_0x21c197){handleError(_0x4c8601[_0x1def('0x51')][_0x51f819],{'code':_0x1def('0x65'),'message':_0x21c197[_0x1def('0x3d')]});logger[_0x1def('0x3c')](_0x1def('0x66'),_0x21c197['message']);}},'complete':function(){try{var _0x5aeae6=[];var _0x1e2038='cm_contacts';if(_0x476a63['duplicates']&&_0x476a63[_0x1def('0x67')][_0x1def('0x52')]){_0x1e2038=_0x1def('0x68')+_0x495cf3;_0x5aeae6[_0x1def('0x40')](_0x1def('0x69')+_0x1e2038+_0x1def('0x6a'));}var _0xb096e6=util[_0x1def('0xb')](_0x1def('0x6b'),_0xcd0f6e,_0x1e2038,_0x15977d,_0x476a63['ListId'],_0x476a63[_0x1def('0x33')]||null,NOW,NOW);if(_[_0x1def('0x6c')](_0x366f67[_0x1def('0x1d')])){_0xb096e6+=_0x1def('0x6d');}_0x5aeae6[_0x1def('0x40')](_0xb096e6);if(_0x476a63[_0x1def('0x67')]&&_0x476a63[_0x1def('0x67')][_0x1def('0x52')]){_0x5aeae6['push'](insertCmContact(_0x476a63[_0x1def('0x1f')],_0x1e2038,_0x476a63[_0x1def('0x67')],_0x366f67));_0x5aeae6[_0x1def('0x40')]('DROP\x20TABLE\x20'+_0x1e2038+';');}_0x5aeae6[_0x1def('0x40')](insertCmHopper(_0x476a63[_0x1def('0x1f')],_0x1def('0x6e'),'voice_queues','VoiceQueueId',_0x3a2daa));_0x5aeae6[_0x1def('0x40')](insertCmHopperBlack(_0x476a63[_0x1def('0x1f')],_0x1def('0x6f'),_0x1def('0x70'),_0x1def('0x71')));_0x5aeae6[_0x1def('0x40')](insertCmHopper(_0x476a63['ListId'],_0x1def('0x72'),_0x1def('0x73'),_0x1def('0x74'),_0x3a2daa));_0x5aeae6[_0x1def('0x40')](insertCmHopperBlack(_0x476a63[_0x1def('0x1f')],'campaigns_has_cm_blacklists',_0x1def('0x73'),_0x1def('0x74')));BPromise[_0x1def('0x75')](_0x5aeae6,handleQuery)['then'](function(_0x1191af){stats[_0x1def('0x76')]=!![];stats[_0x1def('0x77')]=_0x476a63[_0x1def('0x67')]&&_0x476a63['duplicates'][_0x1def('0x52')]?results[0x2][_0x1def('0x77')]:results[0x0][_0x1def('0x77')];socket[_0x1def('0x63')](_0x1def('0x78')+_0x495cf3,stats);fs[_0x1def('0x79')](_0x4c809a);fs['unlink'](_0xcd0f6e);process[_0x1def('0x3e')](0x0);})[_0x1def('0x45')](function(_0x3b018b){logger[_0x1def('0x3c')](_0x3b018b[_0x1def('0x3d')]);process[_0x1def('0x3e')](0x1);});}catch(_0x161261){logger[_0x1def('0x3c')](_0x1def('0x7a'),_0x161261[_0x1def('0x3d')]);process[_0x1def('0x3e')](0x1);}},'error':function(_0x4617c1,_0x4a0f60,_0x5d7611,_0x422653){throw new Error(_0x422653);}});}function validate(){if(process[_0x1def('0x7b')]&&process[_0x1def('0x7b')][_0x1def('0x52')]<0x4){throw new Error(_0x1def('0x7c'));}var _0x3a1bd7=path[_0x1def('0x11')](config['root'],_0x1def('0x4c'),process[_0x1def('0x7b')][0x2]);if(!fs[_0x1def('0x7d')](_0x3a1bd7)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x38b1b7={};try{_0x38b1b7=JSON[_0x1def('0x4f')](process[_0x1def('0x7b')][0x3]);if(!_0x38b1b7[_0x1def('0x4a')]){throw new Error(_0x1def('0x7e'));}if(!_0x38b1b7[_0x1def('0x4a')][_0x1def('0x10')]){throw new Error(_0x1def('0x7f'));}if(!_0x38b1b7['binding'][_0x1def('0x60')]){throw new Error(_0x1def('0x80'));}var _0x36c62e=0x0;if(_0x38b1b7[_0x1def('0x4a')]['UserId']){_0x36c62e=0x1;}if(!_0x38b1b7[_0x1def('0x1f')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x15502a){throw new Error(_0x1def('0x81'));}var _0x5ca1fe=[];try{_0x5ca1fe=_[_0x1def('0x82')](JSON['parse'](process[_0x1def('0x7b')][0x4]),'id');}catch(_0x5f4b97){logger[_0x1def('0x3a')](_0x1def('0x83'));}main(_0x3a1bd7,_0x38b1b7,_0x5ca1fe,_0x36c62e);}validate();process['on'](_0x1def('0x84'),handleStop);process['on'](_0x1def('0x85'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index b6687bd..5ab923a 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 _0x532f=['voice','toLowerCase','inbound','push','variable','queue','calleridnum','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','calleridname','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','outbound','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','Complete\x20Time','endtime','Duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]'];(function(_0x11c308,_0x51d3d9){var _0x524a86=function(_0x4dc091){while(--_0x4dc091){_0x11c308['push'](_0x11c308['shift']());}};_0x524a86(++_0x51d3d9);}(_0x532f,0x1e9));var _0xf532=function(_0x373750,_0x4bcf13){_0x373750=_0x373750-0x0;var _0x1d5716=_0x532f[_0x373750];return _0x1d5716;};'use strict';exports[_0xf532('0x0')]=function(_0x1f6053,_0xa3ef2){var _0x10bdf3=[{'type':_0xf532('0x1'),'content':_0xf532('0x2'),'variableName':null}];switch(_0x1f6053['toLowerCase']()){case _0xf532('0x3'):switch(_0xa3ef2[_0xf532('0x4')]()){case _0xf532('0x5'):_0x10bdf3[_0xf532('0x6')]({'type':_0xf532('0x7'),'content':'','variableName':_0xf532('0x8')});_0x10bdf3[_0xf532('0x6')]({'type':_0xf532('0x7'),'content':'','variableName':_0xf532('0x9')});break;case'outbound':_0x10bdf3[_0xf532('0x6')]({'type':_0xf532('0x1'),'content':_0xf532('0xa'),'variableName':null});_0x10bdf3[_0xf532('0x6')]({'type':'variable','content':'','variableName':_0xf532('0xb')});break;}}return _0x10bdf3;};exports[_0xf532('0xc')]=function(_0x4bb628,_0x4ec5f5){var _0x5ce908=[];switch(_0x4bb628[_0xf532('0x4')]()){case _0xf532('0x3'):switch(_0x4ec5f5['toLowerCase']()){case _0xf532('0x5'):_0x5ce908=[{'type':'string','content':_0xf532('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xf532('0xe'),'content':'','key':'Caller\x20Number','keyType':_0xf532('0x7'),'variableName':_0xf532('0x9')},{'type':_0xf532('0xe'),'content':'','key':_0xf532('0xf'),'keyType':_0xf532('0x7'),'variableName':_0xf532('0x10')},{'type':_0xf532('0xe'),'content':'','key':'Call\x20To','keyType':_0xf532('0x7'),'variableName':'destexten'},{'type':_0xf532('0xe'),'content':'','key':'Queue','keyType':_0xf532('0x7'),'variableName':_0xf532('0x8')},{'type':_0xf532('0xe'),'content':'','key':_0xf532('0x11'),'keyType':'variable','variableName':_0xf532('0x12')},{'type':_0xf532('0xe'),'content':'','key':_0xf532('0x13'),'keyType':_0xf532('0x7'),'variableName':_0xf532('0x14')},{'type':_0xf532('0x1'),'content':_0xf532('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0xf532('0xe'),'content':'','key':'Agent\x20Name','keyType':_0xf532('0x7'),'variableName':'destcalleridname'},{'type':_0xf532('0xe'),'content':'','key':_0xf532('0x16'),'keyType':_0xf532('0x7'),'variableName':'destcalleridnum'},{'type':_0xf532('0x1'),'content':_0xf532('0x17'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xf532('0x18'),'keyType':_0xf532('0x7'),'variableName':'agentcalledAt'},{'type':'keyValue','content':'','key':_0xf532('0x19'),'keyType':'variable','variableName':_0xf532('0x1a')},{'type':_0xf532('0xe'),'content':'','key':_0xf532('0x1b'),'keyType':_0xf532('0x7'),'variableName':_0xf532('0x1c')},{'type':_0xf532('0xe'),'content':'','key':_0xf532('0x1d'),'keyType':'variable','variableName':_0xf532('0x1e')},{'type':_0xf532('0xe'),'content':'','key':'Talk\x20Time','keyType':_0xf532('0x7'),'variableName':'talktime'}];break;case _0xf532('0x1f'):_0x5ce908=[{'type':'string','content':_0xf532('0xd'),'variableName':null},{'type':_0xf532('0xe'),'content':'','key':_0xf532('0x20'),'keyType':_0xf532('0x7'),'keyContent':'','variableName':_0xf532('0xb')},{'type':'keyValue','content':'','key':_0xf532('0x21'),'keyType':'variable','keyContent':'','variableName':_0xf532('0x22')},{'type':_0xf532('0xe'),'content':'','key':_0xf532('0x11'),'keyType':_0xf532('0x7'),'keyContent':'','variableName':_0xf532('0x12')},{'type':_0xf532('0xe'),'content':'','key':_0xf532('0x13'),'keyType':_0xf532('0x7'),'keyContent':'','variableName':_0xf532('0x23')},{'type':_0xf532('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xf532('0xe'),'content':'','key':_0xf532('0x24'),'keyType':_0xf532('0x7'),'keyContent':'','variableName':'answertime'},{'type':_0xf532('0xe'),'content':'','key':_0xf532('0x25'),'keyType':_0xf532('0x7'),'keyContent':'','variableName':_0xf532('0x26')},{'type':_0xf532('0xe'),'content':'','key':_0xf532('0x27'),'keyType':_0xf532('0x7'),'keyContent':'','variableName':'duration'},{'type':'keyValue','content':'','key':'Billable\x20Time','keyType':_0xf532('0x7'),'keyContent':'','variableName':_0xf532('0x28')}];break;}}return _0x5ce908;}; \ No newline at end of file +var _0x28c5=['string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','push','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridname','Call\x20To','destexten','queue','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','membername','uniqueid','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','Complete\x20Time','Duration','duration','Billable\x20Time','getSubjects'];(function(_0x44ecff,_0x292f31){var _0x3f7962=function(_0x39fb07){while(--_0x39fb07){_0x44ecff['push'](_0x44ecff['shift']());}};_0x3f7962(++_0x292f31);}(_0x28c5,0x125));var _0x528c=function(_0x432dcd,_0x4bcd17){_0x432dcd=_0x432dcd-0x0;var _0x441551=_0x28c5[_0x432dcd];return _0x441551;};'use strict';exports[_0x528c('0x0')]=function(_0x43141b,_0x2a905a){var _0x1f3e8e=[{'type':_0x528c('0x1'),'content':_0x528c('0x2'),'variableName':null}];switch(_0x43141b[_0x528c('0x3')]()){case _0x528c('0x4'):switch(_0x2a905a['toLowerCase']()){case _0x528c('0x5'):_0x1f3e8e['push']({'type':_0x528c('0x6'),'content':'','variableName':'queue'});_0x1f3e8e[_0x528c('0x7')]({'type':_0x528c('0x6'),'content':'','variableName':_0x528c('0x8')});break;case _0x528c('0x9'):_0x1f3e8e[_0x528c('0x7')]({'type':_0x528c('0x1'),'content':_0x528c('0xa'),'variableName':null});_0x1f3e8e[_0x528c('0x7')]({'type':_0x528c('0x6'),'content':'','variableName':_0x528c('0xb')});break;}}return _0x1f3e8e;};exports[_0x528c('0xc')]=function(_0x18b68e,_0x3a65a9){var _0x30cd1e=[];switch(_0x18b68e[_0x528c('0x3')]()){case _0x528c('0x4'):switch(_0x3a65a9[_0x528c('0x3')]()){case _0x528c('0x5'):_0x30cd1e=[{'type':_0x528c('0x1'),'content':_0x528c('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0x528c('0xe'),'content':'','key':_0x528c('0xf'),'keyType':_0x528c('0x6'),'variableName':_0x528c('0x8')},{'type':_0x528c('0xe'),'content':'','key':'Caller\x20Name','keyType':_0x528c('0x6'),'variableName':_0x528c('0x10')},{'type':_0x528c('0xe'),'content':'','key':_0x528c('0x11'),'keyType':_0x528c('0x6'),'variableName':_0x528c('0x12')},{'type':_0x528c('0xe'),'content':'','key':'Queue','keyType':_0x528c('0x6'),'variableName':_0x528c('0x13')},{'type':_0x528c('0xe'),'content':'','key':_0x528c('0x14'),'keyType':_0x528c('0x6'),'variableName':'uniqueid'},{'type':_0x528c('0xe'),'content':'','key':_0x528c('0x15'),'keyType':_0x528c('0x6'),'variableName':_0x528c('0x16')},{'type':_0x528c('0x1'),'content':_0x528c('0x17'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':_0x528c('0x6'),'variableName':'destcalleridname'},{'type':_0x528c('0xe'),'content':'','key':'Agent\x20Number','keyType':'variable','variableName':_0x528c('0xb')},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0x528c('0x6'),'variableName':_0x528c('0x16')},{'type':_0x528c('0xe'),'content':'','key':_0x528c('0x18'),'keyType':_0x528c('0x6'),'variableName':_0x528c('0x19')},{'type':_0x528c('0xe'),'content':'','key':_0x528c('0x1a'),'keyType':'variable','variableName':_0x528c('0x1b')},{'type':_0x528c('0xe'),'content':'','key':_0x528c('0x1c'),'keyType':_0x528c('0x6'),'variableName':_0x528c('0x1d')},{'type':_0x528c('0xe'),'content':'','key':_0x528c('0x1e'),'keyType':_0x528c('0x6'),'variableName':_0x528c('0x1f')}];break;case'outbound':_0x30cd1e=[{'type':'string','content':_0x528c('0xd'),'variableName':null},{'type':_0x528c('0xe'),'content':'','key':_0x528c('0x20'),'keyType':_0x528c('0x6'),'keyContent':'','variableName':_0x528c('0xb')},{'type':_0x528c('0xe'),'content':'','key':'Member\x20Name','keyType':_0x528c('0x6'),'keyContent':'','variableName':_0x528c('0x21')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x528c('0x6'),'keyContent':'','variableName':_0x528c('0x22')},{'type':_0x528c('0xe'),'content':'','key':_0x528c('0x15'),'keyType':_0x528c('0x6'),'keyContent':'','variableName':_0x528c('0x23')},{'type':_0x528c('0x1'),'content':_0x528c('0x24')},{'type':_0x528c('0xe'),'content':'','key':_0x528c('0x25'),'keyType':_0x528c('0x6'),'keyContent':'','variableName':'answertime'},{'type':_0x528c('0xe'),'content':'','key':_0x528c('0x26'),'keyType':_0x528c('0x6'),'keyContent':'','variableName':'endtime'},{'type':'keyValue','content':'','key':_0x528c('0x27'),'keyType':_0x528c('0x6'),'keyContent':'','variableName':_0x528c('0x28')},{'type':_0x528c('0xe'),'content':'','key':_0x528c('0x29'),'keyType':_0x528c('0x6'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x30cd1e;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 4d4a9db..722ff62 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 _0xf861=['catch','error','user','query','clone','body','omit','html','phone','fax','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','toLowerCase','name','role','stringify','null','Interaction','findOne','then','update'];(function(_0x558633,_0x48f4d5){var _0x2ee1fd=function(_0x70966c){while(--_0x70966c){_0x558633['push'](_0x558633['shift']());}};_0x2ee1fd(++_0x48f4d5);}(_0xf861,0xdc));var _0x1f86=function(_0x2f3363,_0x4a1ccc){_0x2f3363=_0x2f3363-0x0;var _0x54e7e2=_0xf861[_0x2f3363];return _0x54e7e2;};'use strict';var _=require(_0x1f86('0x0'));var db=require(_0x1f86('0x1'))['db'];var loggers={'openchannel':require(_0x1f86('0x2'))(_0x1f86('0x3')),'mail':require(_0x1f86('0x2'))(_0x1f86('0x4')),'fax':require(_0x1f86('0x2'))(_0x1f86('0x5')),'sms':require(_0x1f86('0x2'))('sms-interactions'),'chat':require(_0x1f86('0x2'))(_0x1f86('0x6')),'whatsapp':require(_0x1f86('0x2'))(_0x1f86('0x7'))};function getInteractionId(_0x33689a,_0x268bb1,_0x4df0a5){if(_0x33689a&&_0x33689a[_['upperFirst'](_0x4df0a5)+_0x1f86('0x8')]){return _0x33689a[_[_0x1f86('0x9')](_0x4df0a5)+_0x1f86('0x8')];}else if(_0x33689a&&_0x33689a['id']){return _0x33689a['id'];}else if(_0x268bb1&&_0x268bb1['id']){return _0x268bb1['id'];}else{return _0x1f86('0xa');}}function log(_0x358722,_0x52e42,_0x7a7c34,_0x9a75c1,_0x14b0b5,_0x4f9b52){loggers[_0x14b0b5[_0x1f86('0xb')]()][_0x358722]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4f9b52['toUpperCase'](),_0x52e42?_0x52e42['id']:null,_0x52e42?_0x52e42[_0x1f86('0xc')]:null,_0x52e42?_0x52e42[_0x1f86('0xd')]:null,getInteractionId(_0x7a7c34,_0x9a75c1,_0x14b0b5),_0x7a7c34?JSON[_0x1f86('0xe')](_0x7a7c34):_0x1f86('0xf'));}function updateUser(_0x114907,_0x2b40a7,_0xad69ba,_0x5214df,_0x28540b){db[_[_0x1f86('0x9')](_0x5214df)+_0x1f86('0x10')][_0x1f86('0x11')]({'where':{'id':getInteractionId(_0x2b40a7,_0xad69ba,_0x5214df)}})[_0x1f86('0x12')](function(_0x41f0df){if(_0x41f0df){return _0x41f0df[_0x1f86('0x13')]({'UserId':_0x114907?_0x114907['id']:null});}})[_0x1f86('0x12')](function(_0x177d0b){if(_0x177d0b){log('info',_0x114907,_0x2b40a7,_0xad69ba,_0x5214df,_0x28540b);}})[_0x1f86('0x14')](function(){log(_0x1f86('0x15'),_0x114907,_0x2b40a7,_0xad69ba,_0x5214df,_0x28540b);});}exports['tracked']=function(_0x1c2bf0,_0x50ff32){return function(_0x399d91,_0x18a026,_0xf1217e){var _0x100b91=_0x399d91[_0x1f86('0x16')];var _0x491b07={};var _0x2cc0e3=_0x399d91[_0x1f86('0x17')];if(_0x491b07){_0x491b07=_[_0x1f86('0x18')](_0x399d91[_0x1f86('0x19')]);_0x491b07=_[_0x1f86('0x1a')](_0x491b07,[_0x1f86('0x19'),_0x1f86('0x1b'),_0x1f86('0x1c'),_0x1f86('0x1d'),'mobile']);}updateUser(_0x100b91,_0x491b07,_0x2cc0e3,_0x1c2bf0,_0x50ff32);_0xf1217e(null);};}; \ No newline at end of file +var _0xb85f=['fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','Interaction','findOne','then','info','catch','error','tracked','user','query','clone','body','omit','html','phone'];(function(_0x56e063,_0x453233){var _0x766fcf=function(_0x59415a){while(--_0x59415a){_0x56e063['push'](_0x56e063['shift']());}};_0x766fcf(++_0x453233);}(_0xb85f,0x176));var _0xfb85=function(_0xbbf3b,_0x5d27ab){_0xbbf3b=_0xbbf3b-0x0;var _0x56bad2=_0xb85f[_0xbbf3b];return _0x56bad2;};'use strict';var _=require(_0xfb85('0x0'));var db=require(_0xfb85('0x1'))['db'];var loggers={'openchannel':require(_0xfb85('0x2'))(_0xfb85('0x3')),'mail':require(_0xfb85('0x2'))('mail-interactions'),'fax':require(_0xfb85('0x2'))(_0xfb85('0x4')),'sms':require(_0xfb85('0x2'))(_0xfb85('0x5')),'chat':require(_0xfb85('0x2'))(_0xfb85('0x6')),'whatsapp':require(_0xfb85('0x2'))(_0xfb85('0x7'))};function getInteractionId(_0x5b1b17,_0x45293f,_0x31f738){if(_0x5b1b17&&_0x5b1b17[_[_0xfb85('0x8')](_0x31f738)+_0xfb85('0x9')]){return _0x5b1b17[_[_0xfb85('0x8')](_0x31f738)+_0xfb85('0x9')];}else if(_0x5b1b17&&_0x5b1b17['id']){return _0x5b1b17['id'];}else if(_0x45293f&&_0x45293f['id']){return _0x45293f['id'];}else{return _0xfb85('0xa');}}function log(_0x527395,_0x59809b,_0x371473,_0x25c605,_0x1d0d62,_0x5de2bf){loggers[_0x1d0d62['toLowerCase']()][_0x527395](_0xfb85('0xb'),_0x5de2bf[_0xfb85('0xc')](),_0x59809b?_0x59809b['id']:null,_0x59809b?_0x59809b[_0xfb85('0xd')]:null,_0x59809b?_0x59809b['role']:null,getInteractionId(_0x371473,_0x25c605,_0x1d0d62),_0x371473?JSON[_0xfb85('0xe')](_0x371473):'null');}function updateUser(_0x36f7c8,_0x3bb1a1,_0x505630,_0x3e5529,_0x50ba33){db[_[_0xfb85('0x8')](_0x3e5529)+_0xfb85('0xf')][_0xfb85('0x10')]({'where':{'id':getInteractionId(_0x3bb1a1,_0x505630,_0x3e5529)}})[_0xfb85('0x11')](function(_0x30b25c){if(_0x30b25c){return _0x30b25c['update']({'UserId':_0x36f7c8?_0x36f7c8['id']:null});}})[_0xfb85('0x11')](function(_0x844484){if(_0x844484){log(_0xfb85('0x12'),_0x36f7c8,_0x3bb1a1,_0x505630,_0x3e5529,_0x50ba33);}})[_0xfb85('0x13')](function(){log(_0xfb85('0x14'),_0x36f7c8,_0x3bb1a1,_0x505630,_0x3e5529,_0x50ba33);});}exports[_0xfb85('0x15')]=function(_0x2f9d68,_0x3368bd){return function(_0x338d4a,_0x4055b8,_0x4ef143){var _0x3dbc9f=_0x338d4a[_0xfb85('0x16')];var _0x9f45fd={};var _0x23d63d=_0x338d4a[_0xfb85('0x17')];if(_0x9f45fd){_0x9f45fd=_[_0xfb85('0x18')](_0x338d4a[_0xfb85('0x19')]);_0x9f45fd=_[_0xfb85('0x1a')](_0x9f45fd,[_0xfb85('0x19'),_0xfb85('0x1b'),_0xfb85('0x1c'),_0xfb85('0x1d'),_0xfb85('0x1e')]);}updateUser(_0x3dbc9f,_0x9f45fd,_0x23d63d,_0x2f9d68,_0x3368bd);_0x4ef143(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index d0f0c2d..6a72442 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 _0x6df1=['then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','findOne'];(function(_0x3ac063,_0x52424f){var _0xa682d=function(_0x47af4a){while(--_0x47af4a){_0x3ac063['push'](_0x3ac063['shift']());}};_0xa682d(++_0x52424f);}(_0x6df1,0x1e8));var _0x16df=function(_0x40b003,_0x3ae3aa){_0x40b003=_0x40b003-0x0;var _0x3d0edc=_0x6df1[_0x40b003];return _0x3d0edc;};'use strict';var crypto=require('crypto');var util=require(_0x16df('0x0'));var compose=require(_0x16df('0x1'));var db=require(_0x16df('0x2'))['db'];var config=require(_0x16df('0x3'));function getValueFromLicense(_0x3b4677,_0x394247){if(_0x3b4677&&_0x394247){if(_0x394247[_0x16df('0x4')]&&_0x394247['license']){var _0x519806=_0x394247[_0x16df('0x4')];var _0x40c7c4=_0x394247[_0x16df('0x5')];var _0x4d9218=_0x519806[_0x16df('0x6')]('-')[0x4];var _0x7a6687=_0x519806[_0x16df('0x6')]('-')[0x0];var _0x22d98f=crypto[_0x16df('0x7')]('aes-256-ctr',util[_0x16df('0x8')](_0x16df('0x9'),_0x4d9218,_0x519806,_0x7a6687));var _0xe78e2=_0x22d98f[_0x16df('0xa')](_0x40c7c4,_0x16df('0xb'),_0x16df('0xc'));_0xe78e2+=_0x22d98f[_0x16df('0xd')](_0x16df('0xc'));var _0x4136d4=JSON['parse'](_0xe78e2);return _0x4136d4[_0x16df('0xe')](_0x3b4677)?_0x4136d4[_0x3b4677]:null;}}return null;}function isLimit(_0x49a23d,_0xb4fb67,_0x96d9f7,_0x641d20){var _0x219b16=_0xb4fb67;return compose()['use'](function(_0x663e68,_0x4d7927,_0x34bb36){return db['License'][_0x16df('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x16df('0x10')](function(_0x705641){var _0x1017cd=getValueFromLicense(_0x49a23d,_0x705641);return _0x1017cd?_0x1017cd:_0x219b16;})[_0x16df('0x10')](function(_0x580bfc){_0x219b16=_0x580bfc;return _0x96d9f7[_0x16df('0x11')](_0x641d20);})[_0x16df('0x10')](function(_0x4391eb){if(_0x4391eb>=_0x219b16){return _0x4d7927[_0x16df('0x12')](0x193)[_0x16df('0x13')]({'message':util['format'](_0x16df('0x14'),_0x49a23d)});}_0x34bb36();})[_0x16df('0x15')](function(_0x2987d5){_0x34bb36(_0x2987d5);});});}function isUserLimit(){return isLimit(_0x16df('0x16'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x16df('0x17')]=isUserLimit; \ No newline at end of file +var _0x91a2=['User','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license','split','createDecipher','%s:%s:%s','update','utf8','final','parse','hasOwnProperty','use','License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users'];(function(_0x18799b,_0x17b1da){var _0x411b80=function(_0x1a8a73){while(--_0x1a8a73){_0x18799b['push'](_0x18799b['shift']());}};_0x411b80(++_0x17b1da);}(_0x91a2,0x67));var _0x291a=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0x91a2[_0x52f1e6];return _0x21f104;};'use strict';var crypto=require(_0x291a('0x0'));var util=require(_0x291a('0x1'));var compose=require(_0x291a('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x291a('0x3'));function getValueFromLicense(_0x3fb209,_0x58b91d){if(_0x3fb209&&_0x58b91d){if(_0x58b91d[_0x291a('0x4')]&&_0x58b91d[_0x291a('0x5')]){var _0x42f1c0=_0x58b91d[_0x291a('0x4')];var _0x5f2be1=_0x58b91d['license'];var _0x327045=_0x42f1c0[_0x291a('0x6')]('-')[0x4];var _0x408326=_0x42f1c0['split']('-')[0x0];var _0x1c3691=crypto[_0x291a('0x7')]('aes-256-ctr',util['format'](_0x291a('0x8'),_0x327045,_0x42f1c0,_0x408326));var _0x1391cb=_0x1c3691[_0x291a('0x9')](_0x5f2be1,'base64',_0x291a('0xa'));_0x1391cb+=_0x1c3691[_0x291a('0xb')](_0x291a('0xa'));var _0x5212bf=JSON[_0x291a('0xc')](_0x1391cb);return _0x5212bf[_0x291a('0xd')](_0x3fb209)?_0x5212bf[_0x3fb209]:null;}}return null;}function isLimit(_0x53b211,_0x1d30cf,_0x29a60f,_0x5ba215){var _0x78d4d9=_0x1d30cf;return compose()[_0x291a('0xe')](function(_0x30ce37,_0x9275a0,_0x21b85f){return db[_0x291a('0xf')][_0x291a('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x12f353){var _0x2a98f5=getValueFromLicense(_0x53b211,_0x12f353);return _0x2a98f5?_0x2a98f5:_0x78d4d9;})[_0x291a('0x11')](function(_0x33ff40){_0x78d4d9=_0x33ff40;return _0x29a60f['count'](_0x5ba215);})[_0x291a('0x11')](function(_0x351970){if(_0x351970>=_0x78d4d9){return _0x9275a0[_0x291a('0x12')](0x193)[_0x291a('0x13')]({'message':util['format'](_0x291a('0x14'),_0x53b211)});}_0x21b85f();})['catch'](function(_0x3b2943){_0x21b85f(_0x3b2943);});});}function isUserLimit(){return isLimit(_0x291a('0x15'),0x1,db[_0x291a('0x16')],{'where':{'$or':[{'role':'admin'},{'role':_0x291a('0x17')}]}});}exports[_0x291a('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index b8eb7b5..f26f88c 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 _0x6f99=['seconds','parseSearch','startsWith','[$or]','replace','[$and]','split','slice','match','forEach','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','$startsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','shift','pop','utcOffset','add','minutes'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x6f99,0x1de));var _0x96f9=function(_0x5092b0,_0x53d64d){_0x5092b0=_0x5092b0-0x0;var _0x3fe915=_0x6f99[_0x5092b0];return _0x3fe915;};'use strict';var _=require('lodash');var moment=require('moment');exports[_0x96f9('0x0')]=function(_0x107646){var _0x499ef8={'conditions':[]};_0x499ef8['sqlOperator']=_[_0x96f9('0x1')](_0x107646,_0x96f9('0x2'))?'or':'and';var _0x82ffb7=_0x107646[_0x96f9('0x3')](_0x96f9('0x4'),'')[_0x96f9('0x3')](_0x96f9('0x2'),'')[_0x96f9('0x5')]('||');for(var _0x4fd747=0x0;_0x4fd747<_0x82ffb7['length'];_0x4fd747++){var _0x2896a9=_0x82ffb7[_0x4fd747][_0x96f9('0x5')](':=');var _0xc25e1b=_0x2896a9[0x0];var _0x69f13f=_0x2896a9[_0x96f9('0x6')](0x1);_0x69f13f['forEach'](function(_0x489117){var _0x38b73f=_0x489117[_0x96f9('0x5')]('[')['shift']();var _0xbfac89=_0x489117[_0x96f9('0x7')](/\[(.*?)\]/g);_0xbfac89[_0x96f9('0x8')](function(_0x12d1e7){var _0x32a284=_0x12d1e7['split']('[')['filter'](function(_0x14efbc){return _0x14efbc[_0x96f9('0x9')](']')>-0x1;})[_0x96f9('0xa')](function(_0xb27c2f){return _0xb27c2f[_0x96f9('0x5')](']')[0x0];})[0x0];_0x499ef8[_0x96f9('0xb')][_0x96f9('0xc')]({'field':_0xc25e1b,'operator':_0x38b73f,'value':_0x32a284});});});}return _0x499ef8;};exports[_0x96f9('0xd')]=function(_0x114576,_0x44f2bb,_0x367e94){var _0xbce1a6={};if(_0x44f2bb===_0x96f9('0xe')){if(_0x367e94[_0x96f9('0xf')]===_0x96f9('0x10')){_0x367e94['operator']=_0x96f9('0x11');_0x367e94[_0x96f9('0x12')]+=','+_0x367e94['value'];}else if(_[_0x96f9('0x13')]([_0x96f9('0x14'),_0x96f9('0x15')],_0x367e94[_0x96f9('0xf')])){_0x367e94['value']=moment(_0x367e94[_0x96f9('0x12')])['add'](0x1,_0x96f9('0x16'))[_0x96f9('0x17')](_0x96f9('0x18'));}}if(_0x367e94[_0x96f9('0x19')]){_0x44f2bb=_0x367e94[_0x96f9('0x19')];_0xbce1a6[_0x96f9('0x1a')]=_0x96f9('0x1b')+_0x114576+'.'+_0x367e94['field']+_0x96f9('0x1c')+_0x367e94[_0x96f9('0x19')]+')\x20'+parseOperator(_0x367e94[_0x96f9('0xf')]);}else{_0xbce1a6[_0x96f9('0x1a')]=_0x114576+'.'+_0x367e94[_0x96f9('0x1d')]+'\x20'+parseOperator(_0x367e94[_0x96f9('0xf')]);}if(_[_0x96f9('0x13')]([_0x96f9('0x1e'),_0x96f9('0x1f')],_0x367e94[_0x96f9('0xf')]))_0xbce1a6['text']='('+_0xbce1a6['text']+_0x96f9('0x20')+_0x114576+'.'+_0x367e94[_0x96f9('0x1d')]+_0x96f9('0x21');_0xbce1a6[_0x96f9('0x12')]=parseValue(_0x44f2bb,_0x367e94[_0x96f9('0xf')],_0x367e94['value']);return _0xbce1a6;};function parseOperator(_0x2fd1e9){var _0xf6143e;switch(_0x2fd1e9){case'$in':_0xf6143e=_0x96f9('0x22');break;case _0x96f9('0x1f'):_0xf6143e=_0x96f9('0x23');break;case _0x96f9('0x10'):_0xf6143e=_0x96f9('0x24');break;case _0x96f9('0x1e'):_0xf6143e='<>\x20?';break;case'$substring':case _0x96f9('0x25'):case'$endsWith':_0xf6143e='LIKE\x20?';break;case _0x96f9('0x26'):_0xf6143e=_0x96f9('0x27');break;case _0x96f9('0x14'):_0xf6143e=_0x96f9('0x28');break;case _0x96f9('0x15'):_0xf6143e=_0x96f9('0x29');break;case _0x96f9('0x2a'):_0xf6143e=_0x96f9('0x2b');break;case'$between':_0xf6143e=_0x96f9('0x2c');break;}return _0xf6143e;}function parseValue(_0xbccd66,_0x26a0c1,_0x53ea82){var _0x21213a={'start':undefined,'end':undefined};switch(_0x26a0c1){case'$in':case _0x96f9('0x1f'):_0x21213a[_0x96f9('0x2d')]=_0x53ea82[_0x96f9('0x5')](',');break;case'$substring':_0x21213a[_0x96f9('0x2d')]='%'+_0x53ea82+'%';break;case _0x96f9('0x25'):_0x21213a[_0x96f9('0x2d')]=_0x53ea82+'%';break;case _0x96f9('0x2e'):_0x21213a['start']='%'+_0x53ea82;break;case _0x96f9('0x11'):var _0x3deb2f=_0x53ea82[_0x96f9('0x5')](',');var _0x53ea82=_0x3deb2f[_0x96f9('0x2f')]();var _0x4907d7=_0x3deb2f[_0x96f9('0x30')]();if(_0xbccd66===_0x96f9('0xe')){_0x53ea82=moment(_0x53ea82)[_0x96f9('0x31')](0x0,!![])[_0x96f9('0x17')]();_0x4907d7=moment(_0x4907d7)[_0x96f9('0x31')](0x0,!![])[_0x96f9('0x32')](0x17,'hours')['add'](0x3b,_0x96f9('0x33'))[_0x96f9('0x32')](0x3b,_0x96f9('0x34'))[_0x96f9('0x17')]();}_0x21213a={'start':_0x53ea82,'end':_0x4907d7};break;default:_0x21213a['start']=_0x53ea82;break;}return _0x21213a;} \ No newline at end of file +var _0xdd77=['$lt','<\x20?','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','pop','utcOffset','format','seconds','lodash','sqlOperator','startsWith','[$or]','replace','[$and]','split','shift','match','forEach','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','$gt','$lte','add','YYYY-MM-DD','castTo','CAST(','field','text','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?'];(function(_0x2a2166,_0x3a077f){var _0x3bcf50=function(_0x3f0300){while(--_0x3f0300){_0x2a2166['push'](_0x2a2166['shift']());}};_0x3bcf50(++_0x3a077f);}(_0xdd77,0x74));var _0x7dd7=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xdd77[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x7dd7('0x0'));var moment=require('moment');exports['parseSearch']=function(_0xec9a5a){var _0x4427f1={'conditions':[]};_0x4427f1[_0x7dd7('0x1')]=_[_0x7dd7('0x2')](_0xec9a5a,_0x7dd7('0x3'))?'or':'and';var _0x3c9d06=_0xec9a5a[_0x7dd7('0x4')](_0x7dd7('0x5'),'')[_0x7dd7('0x4')](_0x7dd7('0x3'),'')[_0x7dd7('0x6')]('||');for(var _0x166e43=0x0;_0x166e43<_0x3c9d06['length'];_0x166e43++){var _0x20e5e2=_0x3c9d06[_0x166e43]['split'](':=');var _0x1396af=_0x20e5e2[0x0];var _0xd1ffd4=_0x20e5e2['slice'](0x1);_0xd1ffd4['forEach'](function(_0x4da87f){var _0x13799b=_0x4da87f['split']('[')[_0x7dd7('0x7')]();var _0x5eecce=_0x4da87f[_0x7dd7('0x8')](/\[(.*?)\]/g);_0x5eecce[_0x7dd7('0x9')](function(_0x3f1882){var _0x183fbf=_0x3f1882[_0x7dd7('0x6')]('[')[_0x7dd7('0xa')](function(_0x1d3e3b){return _0x1d3e3b[_0x7dd7('0xb')](']')>-0x1;})[_0x7dd7('0xc')](function(_0x5a17f4){return _0x5a17f4[_0x7dd7('0x6')](']')[0x0];})[0x0];_0x4427f1[_0x7dd7('0xd')][_0x7dd7('0xe')]({'field':_0x1396af,'operator':_0x13799b,'value':_0x183fbf});});});}return _0x4427f1;};exports[_0x7dd7('0xf')]=function(_0x221a9f,_0x4d61c8,_0x499613){var _0x2ee38e={};if(_0x4d61c8===_0x7dd7('0x10')){if(_0x499613[_0x7dd7('0x11')]===_0x7dd7('0x12')){_0x499613[_0x7dd7('0x11')]=_0x7dd7('0x13');_0x499613['value']+=','+_0x499613[_0x7dd7('0x14')];}else if(_['includes']([_0x7dd7('0x15'),_0x7dd7('0x16')],_0x499613['operator'])){_0x499613[_0x7dd7('0x14')]=moment(_0x499613[_0x7dd7('0x14')])[_0x7dd7('0x17')](0x1,'days')['format'](_0x7dd7('0x18'));}}if(_0x499613[_0x7dd7('0x19')]){_0x4d61c8=_0x499613[_0x7dd7('0x19')];_0x2ee38e['text']=_0x7dd7('0x1a')+_0x221a9f+'.'+_0x499613[_0x7dd7('0x1b')]+'\x20AS\x20'+_0x499613[_0x7dd7('0x19')]+')\x20'+parseOperator(_0x499613[_0x7dd7('0x11')]);}else{_0x2ee38e[_0x7dd7('0x1c')]=_0x221a9f+'.'+_0x499613[_0x7dd7('0x1b')]+'\x20'+parseOperator(_0x499613[_0x7dd7('0x11')]);}if(_['includes']([_0x7dd7('0x1d'),_0x7dd7('0x1e')],_0x499613[_0x7dd7('0x11')]))_0x2ee38e[_0x7dd7('0x1c')]='('+_0x2ee38e[_0x7dd7('0x1c')]+'\x20OR\x20'+_0x221a9f+'.'+_0x499613[_0x7dd7('0x1b')]+_0x7dd7('0x1f');_0x2ee38e[_0x7dd7('0x14')]=parseValue(_0x4d61c8,_0x499613[_0x7dd7('0x11')],_0x499613[_0x7dd7('0x14')]);return _0x2ee38e;};function parseOperator(_0x11ff4d){var _0x505bb3;switch(_0x11ff4d){case _0x7dd7('0x20'):_0x505bb3=_0x7dd7('0x21');break;case _0x7dd7('0x1e'):_0x505bb3=_0x7dd7('0x22');break;case'$eq':_0x505bb3=_0x7dd7('0x23');break;case'$ne':_0x505bb3=_0x7dd7('0x24');break;case _0x7dd7('0x25'):case'$startsWith':case _0x7dd7('0x26'):_0x505bb3=_0x7dd7('0x27');break;case _0x7dd7('0x28'):_0x505bb3=_0x7dd7('0x29');break;case _0x7dd7('0x15'):_0x505bb3=_0x7dd7('0x2a');break;case'$lte':_0x505bb3='<=\x20?';break;case _0x7dd7('0x2b'):_0x505bb3=_0x7dd7('0x2c');break;case _0x7dd7('0x13'):_0x505bb3=_0x7dd7('0x2d');break;}return _0x505bb3;}function parseValue(_0x538eae,_0x424810,_0x2fb569){var _0x28396f={'start':undefined,'end':undefined};switch(_0x424810){case _0x7dd7('0x20'):case _0x7dd7('0x1e'):_0x28396f[_0x7dd7('0x2e')]=_0x2fb569[_0x7dd7('0x6')](',');break;case'$substring':_0x28396f[_0x7dd7('0x2e')]='%'+_0x2fb569+'%';break;case _0x7dd7('0x2f'):_0x28396f[_0x7dd7('0x2e')]=_0x2fb569+'%';break;case'$endsWith':_0x28396f[_0x7dd7('0x2e')]='%'+_0x2fb569;break;case _0x7dd7('0x13'):var _0x49208c=_0x2fb569[_0x7dd7('0x6')](',');var _0x2fb569=_0x49208c[_0x7dd7('0x7')]();var _0x2cc39e=_0x49208c[_0x7dd7('0x30')]();if(_0x538eae===_0x7dd7('0x10')){_0x2fb569=moment(_0x2fb569)[_0x7dd7('0x31')](0x0,!![])[_0x7dd7('0x32')]();_0x2cc39e=moment(_0x2cc39e)[_0x7dd7('0x31')](0x0,!![])[_0x7dd7('0x17')](0x17,'hours')[_0x7dd7('0x17')](0x3b,'minutes')[_0x7dd7('0x17')](0x3b,_0x7dd7('0x33'))[_0x7dd7('0x32')]();}_0x28396f={'start':_0x2fb569,'end':_0x2cc39e};break;default:_0x28396f[_0x7dd7('0x2e')]=_0x2fb569;break;}return _0x28396f;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 7354f18..7431358 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 _0xf2f4=['isObject','isString','unset','isEmail','match','getFullTextValue','forEach','replace','push','getOptions','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','merge','VIRTUAL','options','sequelize','moment','fields','filters','isEmpty','type','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','name','isArray','split','map','indexOf','priority','col','unsigned','substr','DESC','cast','omit','length'];(function(_0x415aac,_0x16e2bb){var _0x4e8a37=function(_0x3c4dd9){while(--_0x3c4dd9){_0x415aac['push'](_0x415aac['shift']());}};_0x4e8a37(++_0x16e2bb);}(_0xf2f4,0x1b2));var _0x4f2f=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xf2f4[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require('lodash');var sequelize=require(_0x4f2f('0x0'));var moment=require(_0x4f2f('0x1'));var LIMIT_VALUE=0xfa;exports[_0x4f2f('0x2')]=function(_0x470500){var _0x4fc1bc=null;if(_0x470500){_0x4fc1bc=_0x470500['split'](',');}return _0x4fc1bc;};exports[_0x4f2f('0x3')]=function(_0x1918fc,_0x665eac){var _0x29b880={};if(!_[_0x4f2f('0x4')](_0x1918fc)){_['forOwn'](_0x1918fc,function(_0x3aba82,_0x13ea8e){try{if(_0x665eac){var _0x4acdee=_['find'](_0x665eac,{'name':_0x13ea8e})||{};if(_0x4acdee[_0x4f2f('0x5')]==='DATE'&&_[_0x4f2f('0x6')](_0x3aba82)){var _0x498c42=JSON[_0x4f2f('0x7')](_0x3aba82);var _0x147efd={'$gte':moment(moment(_0x498c42[_0x4f2f('0x8')])[_0x4f2f('0x9')](_0x4f2f('0xa')))[_0x4f2f('0xb')]()[_0x4f2f('0x9')](),'$lte':moment(moment(_0x498c42['$lte'])['format'](_0x4f2f('0xa')))['utc']()['subtract'](0x1,'s')[_0x4f2f('0x9')]()};_0x29b880[_0x13ea8e]=_0x147efd;}else if(_0x4acdee[_0x4f2f('0xc')]==='uniqueid'){_0x29b880[_0x13ea8e]=_0x3aba82;}else{_0x29b880[_0x13ea8e]=_['isArray'](_0x3aba82)?_0x3aba82:JSON[_0x4f2f('0x7')](_0x3aba82);}}else{_0x29b880[_0x13ea8e]=_[_0x4f2f('0xd')](_0x3aba82)?_0x3aba82:JSON['parse'](_0x3aba82);}}catch(_0x272e1b){_0x29b880[_0x13ea8e]=_0x3aba82[_0x4f2f('0xe')](',');}});}return _0x29b880;};exports['limit']=function(_0x53c9cf){_0x53c9cf=parseInt(_0x53c9cf,0xa);if(!_0x53c9cf||_0x53c9cf<0x0){_0x53c9cf=LIMIT_VALUE;}return _0x53c9cf;};exports['offset']=function(_0x20cc79){_0x20cc79=parseInt(_0x20cc79,0xa);if(!_0x20cc79||_0x20cc79<0x0){_0x20cc79=0x0;}return _0x20cc79;};exports['sort']=function(_0x19cf8e){var _0x58d159,_0x1fb92e=null;if(_0x19cf8e){_0x58d159=_0x19cf8e[_0x4f2f('0xe')](',');_0x1fb92e=_[_0x4f2f('0xf')](_0x58d159,function(_0x5ec21b){if(_0x5ec21b[_0x4f2f('0x10')]('-')===0x0){return[_0x5ec21b===_0x4f2f('0x11')?sequelize['cast'](sequelize[_0x4f2f('0x12')](_0x4f2f('0x11')),_0x4f2f('0x13')):_0x5ec21b[_0x4f2f('0x14')](0x1),_0x4f2f('0x15')];}else{return[_0x5ec21b===_0x4f2f('0x11')?sequelize[_0x4f2f('0x16')](sequelize[_0x4f2f('0x12')](_0x4f2f('0x11')),'unsigned'):_0x5ec21b,'ASC'];}});}return _0x1fb92e;};exports[_0x4f2f('0x17')]=function(_0x40e823,_0x5007c7){if(_[_0x4f2f('0x4')](_0x40e823)){return _0x40e823;}if(_[_0x4f2f('0xd')](_0x40e823)){for(var _0x5d78ee=0x0;_0x5d78ee<_0x40e823[_0x4f2f('0x18')];_0x5d78ee+=0x1){_0x40e823[_0x5d78ee]=this[_0x4f2f('0x17')](_0x40e823[_0x5d78ee],_0x5007c7);}return _0x40e823;}if(!_[_0x4f2f('0x19')](_0x40e823)){return _0x40e823;}if(_[_0x4f2f('0x1a')](_0x5007c7)){_0x5007c7=[_0x5007c7];}if(!_[_0x4f2f('0xd')](_0x5007c7)){return _0x40e823;}for(var _0x2e189f=0x0;_0x2e189f<_0x5007c7['length'];_0x2e189f+=0x1){_[_0x4f2f('0x1b')](_0x40e823,_0x5007c7[_0x2e189f]);}for(var _0x4832c3 in _0x40e823){if(_0x40e823['hasOwnProperty'](_0x4832c3)){_0x40e823[_0x4832c3]=this[_0x4f2f('0x17')](_0x40e823[_0x4832c3],_0x5007c7);}}return _0x40e823;};exports['isNumeric']=function(_0x40c54d){return _0x40c54d['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x4f2f('0x1c')]=function(_0x527f38){return _0x527f38[_0x4f2f('0x1d')](/^\S+@\S+$/)?!![]:![];};exports[_0x4f2f('0x1e')]=function(_0x276987){var _0x16518c=[];_0x276987['split'](/[ ,]+/)[_0x4f2f('0x1f')](function(_0x5bb71d){_0x5bb71d=_0x5bb71d[_0x4f2f('0x20')](/([^:]")"+/g,'$1');_0x5bb71d='+'+_0x5bb71d+'*';if(_0x5bb71d['includes']('@'))_0x5bb71d='\x22'+_0x5bb71d+'\x22';_0x16518c[_0x4f2f('0x21')](_0x5bb71d);});return _0x16518c['join']('\x20');};exports[_0x4f2f('0x22')]=function(_0x20ccc3,_0x29065e){var _0x2986bd={},_0x442fc6={};_0x2986bd[_0x4f2f('0x23')]=_[_0x4f2f('0xf')](_0x20ccc3,_0x4f2f('0xc'));_0x2986bd[_0x4f2f('0x24')]=_[_0x4f2f('0x25')](_0x29065e['query']);_0x2986bd[_0x4f2f('0x3')]=_[_0x4f2f('0x26')](_0x2986bd[_0x4f2f('0x23')],_0x2986bd[_0x4f2f('0x24')]);_0x442fc6['attributes']=_[_0x4f2f('0x26')](_0x2986bd[_0x4f2f('0x23')],this[_0x4f2f('0x2')](_0x29065e[_0x4f2f('0x24')][_0x4f2f('0x2')]));_0x442fc6[_0x4f2f('0x27')]=_0x442fc6[_0x4f2f('0x27')][_0x4f2f('0x18')]?_0x442fc6[_0x4f2f('0x27')]:_0x2986bd['model'];if(!_0x29065e[_0x4f2f('0x24')][_0x4f2f('0x28')](_0x4f2f('0x29'))){_0x442fc6['limit']=this[_0x4f2f('0x2a')](_0x29065e[_0x4f2f('0x24')][_0x4f2f('0x2a')]);_0x442fc6[_0x4f2f('0x2b')]=this[_0x4f2f('0x2b')](_0x29065e['query'][_0x4f2f('0x2b')]);}_0x442fc6[_0x4f2f('0x2c')]=this['sort'](_0x29065e[_0x4f2f('0x24')][_0x4f2f('0x2d')]);_0x442fc6[_0x4f2f('0x2e')]=this[_0x4f2f('0x3')](_[_0x4f2f('0x2f')](_0x29065e[_0x4f2f('0x24')],_0x2986bd[_0x4f2f('0x3')]),_0x20ccc3);if(_0x29065e[_0x4f2f('0x24')]['filter']){_0x442fc6[_0x4f2f('0x2e')]=_[_0x4f2f('0x30')](_0x442fc6[_0x4f2f('0x2e')],{'$or':_[_0x4f2f('0xf')](_0x20ccc3,function(_0x14aa74){if(_0x14aa74['type']!==_0x4f2f('0x31')){var _0x148287={};_0x148287[_0x14aa74[_0x4f2f('0xc')]]={'$like':'%'+_0x29065e[_0x4f2f('0x24')]['filter']+'%'};return _0x148287;}})});}_0x442fc6=_[_0x4f2f('0x30')]({},_0x442fc6,_0x29065e[_0x4f2f('0x32')]);return _0x442fc6;}; \ No newline at end of file +var _0x0a80=['$gte','format','YYYY-MM-DD','utc','subtract','isArray','limit','offset','sort','map','indexOf','priority','col','unsigned','substr','DESC','ASC','isObject','isString','length','unset','hasOwnProperty','omit','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','includes','push','join','getOptions','keys','intersection','model','query','attributes','nolimit','order','where','filter','merge','VIRTUAL','options','lodash','moment','fields','split','filters','isEmpty','type','DATE','parse'];(function(_0x5a5c3d,_0xaec30c){var _0x185ba4=function(_0x3f4abf){while(--_0x3f4abf){_0x5a5c3d['push'](_0x5a5c3d['shift']());}};_0x185ba4(++_0xaec30c);}(_0x0a80,0x1dd));var _0x00a8=function(_0x3d70ff,_0x9ce260){_0x3d70ff=_0x3d70ff-0x0;var _0x4e0b39=_0x0a80[_0x3d70ff];return _0x4e0b39;};'use strict';var _=require(_0x00a8('0x0'));var sequelize=require('sequelize');var moment=require(_0x00a8('0x1'));var LIMIT_VALUE=0xfa;exports[_0x00a8('0x2')]=function(_0x3b57f4){var _0x4227ed=null;if(_0x3b57f4){_0x4227ed=_0x3b57f4[_0x00a8('0x3')](',');}return _0x4227ed;};exports[_0x00a8('0x4')]=function(_0x516b52,_0x22ba6e){var _0x235704={};if(!_[_0x00a8('0x5')](_0x516b52)){_['forOwn'](_0x516b52,function(_0x3872e6,_0x5dcd94){try{if(_0x22ba6e){var _0x5ace18=_['find'](_0x22ba6e,{'name':_0x5dcd94})||{};if(_0x5ace18[_0x00a8('0x6')]===_0x00a8('0x7')&&_['isPlainObject'](_0x3872e6)){var _0x201680=JSON[_0x00a8('0x8')](_0x3872e6);var _0x46b76d={'$gte':moment(moment(_0x201680[_0x00a8('0x9')])[_0x00a8('0xa')](_0x00a8('0xb')))['utc']()[_0x00a8('0xa')](),'$lte':moment(moment(_0x201680['$lte'])[_0x00a8('0xa')]('YYYY-MM-DD'))[_0x00a8('0xc')]()[_0x00a8('0xd')](0x1,'s')[_0x00a8('0xa')]()};_0x235704[_0x5dcd94]=_0x46b76d;}else if(_0x5ace18['name']==='uniqueid'){_0x235704[_0x5dcd94]=_0x3872e6;}else{_0x235704[_0x5dcd94]=_[_0x00a8('0xe')](_0x3872e6)?_0x3872e6:JSON[_0x00a8('0x8')](_0x3872e6);}}else{_0x235704[_0x5dcd94]=_[_0x00a8('0xe')](_0x3872e6)?_0x3872e6:JSON[_0x00a8('0x8')](_0x3872e6);}}catch(_0x58b61d){_0x235704[_0x5dcd94]=_0x3872e6[_0x00a8('0x3')](',');}});}return _0x235704;};exports[_0x00a8('0xf')]=function(_0x213daf){_0x213daf=parseInt(_0x213daf,0xa);if(!_0x213daf||_0x213daf<0x0){_0x213daf=LIMIT_VALUE;}return _0x213daf;};exports[_0x00a8('0x10')]=function(_0x41385c){_0x41385c=parseInt(_0x41385c,0xa);if(!_0x41385c||_0x41385c<0x0){_0x41385c=0x0;}return _0x41385c;};exports[_0x00a8('0x11')]=function(_0x598f0c){var _0x1dfd55,_0x1d6785=null;if(_0x598f0c){_0x1dfd55=_0x598f0c[_0x00a8('0x3')](',');_0x1d6785=_[_0x00a8('0x12')](_0x1dfd55,function(_0x5f5735){if(_0x5f5735[_0x00a8('0x13')]('-')===0x0){return[_0x5f5735===_0x00a8('0x14')?sequelize['cast'](sequelize[_0x00a8('0x15')](_0x00a8('0x14')),_0x00a8('0x16')):_0x5f5735[_0x00a8('0x17')](0x1),_0x00a8('0x18')];}else{return[_0x5f5735===_0x00a8('0x14')?sequelize['cast'](sequelize[_0x00a8('0x15')](_0x00a8('0x14')),'unsigned'):_0x5f5735,_0x00a8('0x19')];}});}return _0x1d6785;};exports['omit']=function(_0x2b0061,_0x535768){if(_[_0x00a8('0x5')](_0x2b0061)){return _0x2b0061;}if(_[_0x00a8('0xe')](_0x2b0061)){for(var _0x1e5e54=0x0;_0x1e5e54<_0x2b0061['length'];_0x1e5e54+=0x1){_0x2b0061[_0x1e5e54]=this['omit'](_0x2b0061[_0x1e5e54],_0x535768);}return _0x2b0061;}if(!_[_0x00a8('0x1a')](_0x2b0061)){return _0x2b0061;}if(_[_0x00a8('0x1b')](_0x535768)){_0x535768=[_0x535768];}if(!_[_0x00a8('0xe')](_0x535768)){return _0x2b0061;}for(var _0x2ad0a0=0x0;_0x2ad0a0<_0x535768[_0x00a8('0x1c')];_0x2ad0a0+=0x1){_[_0x00a8('0x1d')](_0x2b0061,_0x535768[_0x2ad0a0]);}for(var _0x38e417 in _0x2b0061){if(_0x2b0061[_0x00a8('0x1e')](_0x38e417)){_0x2b0061[_0x38e417]=this[_0x00a8('0x1f')](_0x2b0061[_0x38e417],_0x535768);}}return _0x2b0061;};exports[_0x00a8('0x20')]=function(_0x47babe){return _0x47babe['match'](RegExp(_0x00a8('0x21')))?!![]:![];};exports[_0x00a8('0x22')]=function(_0x490036){return _0x490036[_0x00a8('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0x00a8('0x24')]=function(_0x5c3d16){var _0x37d779=[];_0x5c3d16[_0x00a8('0x3')](/[ ,]+/)[_0x00a8('0x25')](function(_0x3bb4fd){_0x3bb4fd=_0x3bb4fd['replace'](/([^:]")"+/g,'$1');_0x3bb4fd='+'+_0x3bb4fd+'*';if(_0x3bb4fd[_0x00a8('0x26')]('@'))_0x3bb4fd='\x22'+_0x3bb4fd+'\x22';_0x37d779[_0x00a8('0x27')](_0x3bb4fd);});return _0x37d779[_0x00a8('0x28')]('\x20');};exports[_0x00a8('0x29')]=function(_0x5e87ed,_0x436fee){var _0x458180={},_0x1ca6ea={};_0x458180['model']=_['map'](_0x5e87ed,'name');_0x458180['query']=_[_0x00a8('0x2a')](_0x436fee['query']);_0x458180[_0x00a8('0x4')]=_[_0x00a8('0x2b')](_0x458180[_0x00a8('0x2c')],_0x458180[_0x00a8('0x2d')]);_0x1ca6ea['attributes']=_[_0x00a8('0x2b')](_0x458180[_0x00a8('0x2c')],this[_0x00a8('0x2')](_0x436fee[_0x00a8('0x2d')][_0x00a8('0x2')]));_0x1ca6ea[_0x00a8('0x2e')]=_0x1ca6ea[_0x00a8('0x2e')][_0x00a8('0x1c')]?_0x1ca6ea[_0x00a8('0x2e')]:_0x458180[_0x00a8('0x2c')];if(!_0x436fee[_0x00a8('0x2d')][_0x00a8('0x1e')](_0x00a8('0x2f'))){_0x1ca6ea[_0x00a8('0xf')]=this[_0x00a8('0xf')](_0x436fee['query'][_0x00a8('0xf')]);_0x1ca6ea[_0x00a8('0x10')]=this[_0x00a8('0x10')](_0x436fee['query'][_0x00a8('0x10')]);}_0x1ca6ea[_0x00a8('0x30')]=this[_0x00a8('0x11')](_0x436fee['query'][_0x00a8('0x11')]);_0x1ca6ea[_0x00a8('0x31')]=this[_0x00a8('0x4')](_['pick'](_0x436fee[_0x00a8('0x2d')],_0x458180[_0x00a8('0x4')]),_0x5e87ed);if(_0x436fee['query'][_0x00a8('0x32')]){_0x1ca6ea[_0x00a8('0x31')]=_[_0x00a8('0x33')](_0x1ca6ea[_0x00a8('0x31')],{'$or':_[_0x00a8('0x12')](_0x5e87ed,function(_0x100132){if(_0x100132[_0x00a8('0x6')]!==_0x00a8('0x34')){var _0x2a3ad9={};_0x2a3ad9[_0x100132['name']]={'$like':'%'+_0x436fee['query'][_0x00a8('0x32')]+'%'};return _0x2a3ad9;}})});}_0x1ca6ea=_['merge']({},_0x1ca6ea,_0x436fee[_0x00a8('0x35')]);return _0x1ca6ea;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index ab3e5cf..d41e115 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcd4=['root','public','join','client','use','json\x20replacer','split','static','views','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','body-parser','cookie-parser','errorhandler','path','passport','./environment','../mysqldb','get','env','production','set','appPath'];(function(_0x53574d,_0x1bf1ee){var _0x44b55c=function(_0x31f941){while(--_0x31f941){_0x53574d['push'](_0x53574d['shift']());}};_0x44b55c(++_0x1bf1ee);}(_0xfcd4,0x93));var _0x4fcd=function(_0x10a187,_0xd916cd){_0x10a187=_0x10a187-0x0;var _0x505e94=_0xfcd4[_0x10a187];return _0x505e94;};'use strict';var express=require(_0x4fcd('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x4fcd('0x1'));var methodOverride=require('method-override');var cookieParser=require(_0x4fcd('0x2'));var errorHandler=require(_0x4fcd('0x3'));var path=require(_0x4fcd('0x4'));var passport=require(_0x4fcd('0x5'));var cors=require('cors');var moment=require('moment');var config=require(_0x4fcd('0x6'));var db=require(_0x4fcd('0x7'))['db'];exports['default']=function(_0x4c6649){var _0x3568cd=_0x4c6649[_0x4fcd('0x8')](_0x4fcd('0x9'));if(_0x3568cd===_0x4fcd('0xa')){_0x4c6649[_0x4fcd('0xb')](_0x4fcd('0xc'),path['join'](config[_0x4fcd('0xd')],_0x4fcd('0xe')));}if(_0x3568cd==='development'||_0x3568cd==='test'){_0x4c6649[_0x4fcd('0xb')]('appPath',path[_0x4fcd('0xf')](config[_0x4fcd('0xd')],_0x4fcd('0x10')));_0x4c6649[_0x4fcd('0x11')](errorHandler());}_0x4c6649[_0x4fcd('0xb')](_0x4fcd('0x12'),function(_0x44448a,_0x1664b2){if(this[_0x44448a]instanceof Date){_0x1664b2=this[_0x44448a]['toISOString']()[_0x4fcd('0x13')]('.')[0x0]+'Z';}return _0x1664b2;});_0x4c6649[_0x4fcd('0x11')](express[_0x4fcd('0x14')](_0x4c6649[_0x4fcd('0x8')](_0x4fcd('0xc'))));_0x4c6649['set'](_0x4fcd('0x15'),config['root']+_0x4fcd('0x16'));_0x4c6649[_0x4fcd('0x17')](_0x4fcd('0x18'),require(_0x4fcd('0x19'))[_0x4fcd('0x1a')]);_0x4c6649['set'](_0x4fcd('0x1b'),'html');_0x4c6649[_0x4fcd('0x11')](bodyParser[_0x4fcd('0x1c')]({'limit':_0x4fcd('0x1d'),'extended':!![]}));_0x4c6649[_0x4fcd('0x11')](bodyParser[_0x4fcd('0x1e')]({'limit':_0x4fcd('0x1d')}));_0x4c6649[_0x4fcd('0x11')](cors());_0x4c6649[_0x4fcd('0x11')](methodOverride());_0x4c6649[_0x4fcd('0x11')](cookieParser());_0x4c6649[_0x4fcd('0x11')](passport[_0x4fcd('0x1f')]());}; \ No newline at end of file +var _0xfcc8=['get','env','production','set','appPath','join','root','public','development','use','json\x20replacer','split','static','views','ejs','renderFile','html','urlencoded','json','initialize','serve-favicon','body-parser','method-override','errorhandler','passport','moment','./environment','../mysqldb','default'];(function(_0x1f4e74,_0x2be248){var _0x31ddd1=function(_0x473df2){while(--_0x473df2){_0x1f4e74['push'](_0x1f4e74['shift']());}};_0x31ddd1(++_0x2be248);}(_0xfcc8,0x136));var _0x8fcc=function(_0x54e5b0,_0x2a0cde){_0x54e5b0=_0x54e5b0-0x0;var _0x32761f=_0xfcc8[_0x54e5b0];return _0x32761f;};'use strict';var express=require('express');var favicon=require(_0x8fcc('0x0'));var bodyParser=require(_0x8fcc('0x1'));var methodOverride=require(_0x8fcc('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x8fcc('0x3'));var path=require('path');var passport=require(_0x8fcc('0x4'));var cors=require('cors');var moment=require(_0x8fcc('0x5'));var config=require(_0x8fcc('0x6'));var db=require(_0x8fcc('0x7'))['db'];exports[_0x8fcc('0x8')]=function(_0x8925a1){var _0x502d64=_0x8925a1[_0x8fcc('0x9')](_0x8fcc('0xa'));if(_0x502d64===_0x8fcc('0xb')){_0x8925a1[_0x8fcc('0xc')](_0x8fcc('0xd'),path[_0x8fcc('0xe')](config[_0x8fcc('0xf')],_0x8fcc('0x10')));}if(_0x502d64===_0x8fcc('0x11')||_0x502d64==='test'){_0x8925a1[_0x8fcc('0xc')](_0x8fcc('0xd'),path[_0x8fcc('0xe')](config[_0x8fcc('0xf')],'client'));_0x8925a1[_0x8fcc('0x12')](errorHandler());}_0x8925a1['set'](_0x8fcc('0x13'),function(_0x418838,_0xe0a118){if(this[_0x418838]instanceof Date){_0xe0a118=this[_0x418838]['toISOString']()[_0x8fcc('0x14')]('.')[0x0]+'Z';}return _0xe0a118;});_0x8925a1[_0x8fcc('0x12')](express[_0x8fcc('0x15')](_0x8925a1[_0x8fcc('0x9')](_0x8fcc('0xd'))));_0x8925a1[_0x8fcc('0xc')](_0x8fcc('0x16'),config[_0x8fcc('0xf')]+'/server/views');_0x8925a1['engine']('html',require(_0x8fcc('0x17'))[_0x8fcc('0x18')]);_0x8925a1[_0x8fcc('0xc')]('view\x20engine',_0x8fcc('0x19'));_0x8925a1[_0x8fcc('0x12')](bodyParser[_0x8fcc('0x1a')]({'limit':'50mb','extended':!![]}));_0x8925a1[_0x8fcc('0x12')](bodyParser[_0x8fcc('0x1b')]({'limit':'50mb'}));_0x8925a1['use'](cors());_0x8925a1['use'](methodOverride());_0x8925a1[_0x8fcc('0x12')](cookieParser());_0x8925a1[_0x8fcc('0x12')](passport[_0x8fcc('0x1c')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 0d8162c..bb3df27 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 _0x370f=['keys','length','filter','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','model','join','createHash','md5','update','digest','hex','platform','licenseToken','test','win32','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces'];(function(_0x270408,_0x347a76){var _0x52f74d=function(_0x3eb508){while(--_0x3eb508){_0x270408['push'](_0x270408['shift']());}};_0x52f74d(++_0x347a76);}(_0x370f,0x1f2));var _0xf370=function(_0x57a987,_0x144d15){_0x57a987=_0x57a987-0x0;var _0x5baf73=_0x370f[_0x57a987];return _0x5baf73;};'use strict';var _=require(_0xf370('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xf370('0x1'));var exec=require(_0xf370('0x2'))[_0xf370('0x3')];var config=require(_0xf370('0x4'));function getInterfaces(){var _0x34c574=[];var _0x3246cb=os[_0xf370('0x5')]();var _0x299f45=_['orderBy'](_[_0xf370('0x6')](_0x3246cb));for(var _0x24dd7f=0x0;_0x24dd7f<_0x299f45[_0xf370('0x7')];_0x24dd7f++){var _0x1849da=_0x3246cb[_0x299f45[_0x24dd7f]][_0xf370('0x8')](function(_0x34c558){return _0x34c558['family']==='IPv4'&&_0x34c558[_0xf370('0x9')]===![];});_0x34c574=_0x34c574[_0xf370('0xa')](_0x1849da);}return _0x34c574;}function getFirstInterface(){var _0x19d706=_[_0xf370('0xb')](getInterfaces());return{'macAddress':_0x19d706&&_0x19d706[_0xf370('0xc')]?_0x19d706[_0xf370('0xc')]:_0xf370('0xd'),'ipAddress':_0x19d706&&_0x19d706[_0xf370('0xe')]?_0x19d706[_0xf370('0xe')]:_0xf370('0xf')};}exports[_0xf370('0x10')]=getFirstInterface;function getCPUhash(){var _0x50a418=_[_0xf370('0x11')](os[_0xf370('0x12')]()['map'](function(_0x422052){return _0x422052[_0xf370('0x13')];}))[_0xf370('0x14')](':');return crypto[_0xf370('0x15')](_0xf370('0x16'))[_0xf370('0x17')](_0x50a418)[_0xf370('0x18')](_0xf370('0x19'));}exports['getUuid']=function(){var _0x3345fe=os[_0xf370('0x1a')]();var _0xccfa6b=/[0-9a-f-]{36}/;if(config[_0xf370('0x1b')]&&_0xccfa6b[_0xf370('0x1c')](config[_0xf370('0x1b')])){return config['licenseToken'];}else if(_0x3345fe===_0xf370('0x1d')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xf370('0x1e')})[_0xf370('0x1f')]('\x0d\x0a','');}else{var _0x1b2c0d=getFirstInterface();var _0x4a5413=getCPUhash();var _0x55c15b=_0x4a5413+'|'+os[_0xf370('0x20')]()+'|'+_0x1b2c0d[_0xf370('0x21')]+'|'+_0x1b2c0d[_0xf370('0x22')];var _0x329e84=crypto['createHash'](_0xf370('0x16'))[_0xf370('0x17')](_0x55c15b)[_0xf370('0x18')]('hex');return _0x329e84['substring'](0x0,0x8)+'-'+_0x329e84[_0xf370('0x23')](0x8,0xc)+'-'+_0x329e84[_0xf370('0x23')](0xc,0x10)+'-'+_0x329e84[_0xf370('0x23')](0x10,0x14)+'-'+_0x329e84[_0xf370('0x23')](0x14);}}; \ No newline at end of file +var _0xb245=['dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','createHash','update','getUuid','licenseToken','test','win32'];(function(_0x306e42,_0xce9794){var _0x4ac9f3=function(_0x34b09a){while(--_0x34b09a){_0x306e42['push'](_0x306e42['shift']());}};_0x4ac9f3(++_0xce9794);}(_0xb245,0xbc));var _0x5b24=function(_0x211187,_0x19a479){_0x211187=_0x211187-0x0;var _0x382a9c=_0xb245[_0x211187];return _0x382a9c;};'use strict';var _=require(_0x5b24('0x0'));var os=require('os');var crypto=require(_0x5b24('0x1'));var machine=require(_0x5b24('0x2'));var exec=require(_0x5b24('0x3'))[_0x5b24('0x4')];var config=require('../environment');function getInterfaces(){var _0x757205=[];var _0x479ae0=os[_0x5b24('0x5')]();var _0x20616a=_[_0x5b24('0x6')](_[_0x5b24('0x7')](_0x479ae0));for(var _0x7f9059=0x0;_0x7f9059<_0x20616a[_0x5b24('0x8')];_0x7f9059++){var _0x57d47b=_0x479ae0[_0x20616a[_0x7f9059]][_0x5b24('0x9')](function(_0x14c116){return _0x14c116[_0x5b24('0xa')]===_0x5b24('0xb')&&_0x14c116[_0x5b24('0xc')]===![];});_0x757205=_0x757205['concat'](_0x57d47b);}return _0x757205;}function getFirstInterface(){var _0x84fcba=_[_0x5b24('0xd')](getInterfaces());return{'macAddress':_0x84fcba&&_0x84fcba[_0x5b24('0xe')]?_0x84fcba['mac']:_0x5b24('0xf'),'ipAddress':_0x84fcba&&_0x84fcba['address']?_0x84fcba[_0x5b24('0x10')]:_0x5b24('0x11')};}exports[_0x5b24('0x12')]=getFirstInterface;function getCPUhash(){var _0x27978f=_['orderBy'](os[_0x5b24('0x13')]()[_0x5b24('0x14')](function(_0x6a76f5){return _0x6a76f5[_0x5b24('0x15')];}))['join'](':');return crypto[_0x5b24('0x16')]('md5')[_0x5b24('0x17')](_0x27978f)['digest']('hex');}exports[_0x5b24('0x18')]=function(){var _0x31b407=os['platform']();var _0x2ed0f0=/[0-9a-f-]{36}/;if(config[_0x5b24('0x19')]&&_0x2ed0f0[_0x5b24('0x1a')](config['licenseToken'])){return config[_0x5b24('0x19')];}else if(_0x31b407===_0x5b24('0x1b')){return exec(_0x5b24('0x1c'),{'encoding':_0x5b24('0x1d')})[_0x5b24('0x1e')]('\x0d\x0a','');}else{var _0xccbedc=getFirstInterface();var _0x59be77=getCPUhash();var _0x97c569=_0x59be77+'|'+os[_0x5b24('0x1f')]()+'|'+_0xccbedc[_0x5b24('0x20')]+'|'+_0xccbedc[_0x5b24('0x21')];var _0x16e95f=crypto[_0x5b24('0x16')]('md5')[_0x5b24('0x17')](_0x97c569)[_0x5b24('0x22')]('hex');return _0x16e95f[_0x5b24('0x23')](0x0,0x8)+'-'+_0x16e95f[_0x5b24('0x23')](0x8,0xc)+'-'+_0x16e95f[_0x5b24('0x23')](0xc,0x10)+'-'+_0x16e95f['substring'](0x10,0x14)+'-'+_0x16e95f[_0x5b24('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index f867fc9..70ffd2f 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 _0x47fd=['findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','then','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License'];(function(_0x31c14d,_0x25ab5f){var _0x29557c=function(_0x3ce5c7){while(--_0x3ce5c7){_0x31c14d['push'](_0x31c14d['shift']());}};_0x29557c(++_0x25ab5f);}(_0x47fd,0x1e8));var _0xd47f=function(_0x2e4a84,_0x3de6e1){_0x2e4a84=_0x2e4a84-0x0;var _0x16ffe8=_0x47fd[_0x2e4a84];return _0x16ffe8;};'use strict';var util=require(_0xd47f('0x0'));var moment=require(_0xd47f('0x1'));var rp=require(_0xd47f('0x2'));var BPromise=require(_0xd47f('0x3'));var pkginfo=require(_0xd47f('0x4'))(module,_0xd47f('0x5'));var db=require(_0xd47f('0x6'))['db'];var encryptor=require(_0xd47f('0x7'));var hardware=require(_0xd47f('0x8'));var logger=require(_0xd47f('0x9'))(_0xd47f('0xa'));var HOST=_0xd47f('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xb7dfac){return new BPromise(function(_0x5036a9,_0x2d3226){var _0x31b252=util[_0xd47f('0xc')](_0xd47f('0xd'),HOST,_0xb7dfac,module['exports'][_0xd47f('0x5')]);if(oldToken){_0x31b252=util[_0xd47f('0xc')](_0xd47f('0xe'),HOST,_0xb7dfac,module['exports'][_0xd47f('0x5')],oldToken);}var _0x39122a={'uri':_0x31b252,'method':_0xd47f('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x39122a)['then'](function(_0x22f03e){_0x5036a9(_0x22f03e);})[_0xd47f('0x10')](function(_0x4dc1c1){_0x2d3226(_0x4dc1c1);});});}function manageLicense(_0xf8c7ff,_0x385d73){var _0x54e0ef=_0x385d73[_0xd47f('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x54e0ef[_0xd47f('0x12')]!==_0xf8c7ff&&!_0x54e0ef[_0xd47f('0x13')]){oldToken=_0x54e0ef['data1'];}httpRequest(_0xf8c7ff)[_0xd47f('0x14')](function(_0x24a270){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x24a270['active']){isOldTokenSent=![];if(!_0x54e0ef[_0xd47f('0xa')]&&_0x54e0ef[_0xd47f('0xa')]!=_0x24a270[_0xd47f('0xa')]||_0x54e0ef[_0xd47f('0xa')]&&_0x54e0ef['data2']){logger[_0xd47f('0x15')](_0xd47f('0x16'));}if(_0x54e0ef[_0xd47f('0xa')]&&!_0x54e0ef[_0xd47f('0x13')]&&_0x54e0ef[_0xd47f('0xa')]!=_0x24a270['license']){logger[_0xd47f('0x15')](_0xd47f('0x17'));}if(_0x54e0ef[_0xd47f('0xa')]&&!_0x54e0ef[_0xd47f('0x13')]&&_0x54e0ef[_0xd47f('0xa')]==_0x24a270[_0xd47f('0xa')]){return _0x385d73;}return _0x385d73['update']({'data1':_0xf8c7ff,'data2':null,'license':_0x24a270[_0xd47f('0xa')]});}else{if(_0x24a270[_0xd47f('0xa')]||_0x54e0ef['license']){if(!_0x54e0ef[_0xd47f('0x13')]){if(_0x54e0ef[_0xd47f('0x12')]==_0xf8c7ff){GRAY_PERIOD_REASON=_0xd47f('0x18');logger['info'](_0xd47f('0x19'));}else{GRAY_PERIOD_REASON=_0xd47f('0x1a');logger[_0xd47f('0x15')](_0xd47f('0x1b'),_0x54e0ef[_0xd47f('0x12')],_0xf8c7ff);}logger[_0xd47f('0x15')](_0xd47f('0x1c'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xd47f('0xc')](_0xd47f('0x1d')));return _0x385d73[_0xd47f('0x1e')]({'data2':encryptor[_0xd47f('0x1f')](moment()[_0xd47f('0xc')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xd47f('0x20')](encryptor[_0xd47f('0x21')](_0x54e0ef[_0xd47f('0x13')]),'days')>DAYS){logger['info'](_0xd47f('0x22'),moment()[_0xd47f('0xc')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x385d73[_0xd47f('0x1e')]({'data1':_0xf8c7ff,'data2':null,'license':null});}}}else{if(_0x54e0ef[_0xd47f('0x12')]!=_0xf8c7ff){logger[_0xd47f('0x15')](_0xd47f('0x1b'),_0x54e0ef[_0xd47f('0x12')],_0xf8c7ff);return _0x385d73[_0xd47f('0x1e')]({'data1':_0xf8c7ff,'data2':null,'license':null});}}}return _0x385d73;})[_0xd47f('0x14')](function(_0x554431){_0x385d73=_0x554431;})[_0xd47f('0x10')](function(_0x5eb7f0){logger[_0xd47f('0x23')](_0x5eb7f0[_0xd47f('0x24')]);})[_0xd47f('0x25')](function(){setTimeout(function(){manageLicense(hardware[_0xd47f('0x26')](),_0x385d73);},TIME);});}function defaultLicense(){var _0x52ba55=hardware[_0xd47f('0x26')]();if(_0x52ba55){return db[_0xd47f('0x27')][_0xd47f('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x52ba55}})[_0xd47f('0x29')](function(_0x123033,_0x30d842){logger['info'](_0xd47f('0x2a'),_0x52ba55);manageLicense(_0x52ba55,_0x123033);})['catch'](function(_0x4f4a6e){logger['error'](_0x4f4a6e[_0xd47f('0x24')]);});}}exports[_0xd47f('0x2b')]=defaultLicense; \ No newline at end of file +var _0xafed=['GET','then','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','moment','request-promise','bluebird','pkginfo','../../mysqldb','../logger','license','format','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s'];(function(_0x129eb8,_0x14b076){var _0x2c9e6e=function(_0x511226){while(--_0x511226){_0x129eb8['push'](_0x129eb8['shift']());}};_0x2c9e6e(++_0x14b076);}(_0xafed,0x197));var _0xdafe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xafed[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var moment=require(_0xdafe('0x0'));var rp=require(_0xdafe('0x1'));var BPromise=require(_0xdafe('0x2'));var pkginfo=require(_0xdafe('0x3'))(module,'version');var db=require(_0xdafe('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0xdafe('0x5'))(_0xdafe('0x6'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1092a7){return new BPromise(function(_0x466b68,_0x5de79c){var _0x587fb1=util[_0xdafe('0x7')]('%s/api/servers/%s/check?version=%s',HOST,_0x1092a7,module[_0xdafe('0x8')][_0xdafe('0x9')]);if(oldToken){_0x587fb1=util['format'](_0xdafe('0xa'),HOST,_0x1092a7,module[_0xdafe('0x8')][_0xdafe('0x9')],oldToken);}var _0x2f54fc={'uri':_0x587fb1,'method':_0xdafe('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x2f54fc)[_0xdafe('0xc')](function(_0x107d88){_0x466b68(_0x107d88);})['catch'](function(_0xc56dda){_0x5de79c(_0xc56dda);});});}function manageLicense(_0x7be36a,_0xfa78f8){var _0x1df604=_0xfa78f8[_0xdafe('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x1df604[_0xdafe('0xe')]!==_0x7be36a&&!_0x1df604[_0xdafe('0xf')]){oldToken=_0x1df604[_0xdafe('0xe')];}httpRequest(_0x7be36a)[_0xdafe('0xc')](function(_0x10b2da){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x10b2da[_0xdafe('0x10')]){isOldTokenSent=![];if(!_0x1df604[_0xdafe('0x6')]&&_0x1df604[_0xdafe('0x6')]!=_0x10b2da[_0xdafe('0x6')]||_0x1df604['license']&&_0x1df604[_0xdafe('0xf')]){logger[_0xdafe('0x11')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x1df604[_0xdafe('0x6')]&&!_0x1df604['data2']&&_0x1df604[_0xdafe('0x6')]!=_0x10b2da['license']){logger[_0xdafe('0x11')](_0xdafe('0x12'));}if(_0x1df604[_0xdafe('0x6')]&&!_0x1df604[_0xdafe('0xf')]&&_0x1df604[_0xdafe('0x6')]==_0x10b2da[_0xdafe('0x6')]){return _0xfa78f8;}return _0xfa78f8[_0xdafe('0x13')]({'data1':_0x7be36a,'data2':null,'license':_0x10b2da[_0xdafe('0x6')]});}else{if(_0x10b2da[_0xdafe('0x6')]||_0x1df604[_0xdafe('0x6')]){if(!_0x1df604[_0xdafe('0xf')]){if(_0x1df604[_0xdafe('0xe')]==_0x7be36a){GRAY_PERIOD_REASON=_0xdafe('0x14');logger[_0xdafe('0x11')](_0xdafe('0x15'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xdafe('0x11')](_0xdafe('0x16'),_0x1df604['data1'],_0x7be36a);}logger[_0xdafe('0x11')](_0xdafe('0x17'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xdafe('0x7')](_0xdafe('0x18')));return _0xfa78f8['update']({'data2':encryptor[_0xdafe('0x19')](moment()[_0xdafe('0x7')](_0xdafe('0x18')))});}else{if(moment()[_0xdafe('0x1a')](encryptor['decryptString'](_0x1df604[_0xdafe('0xf')]),_0xdafe('0x1b'))>DAYS){logger[_0xdafe('0x11')](_0xdafe('0x1c'),moment()[_0xdafe('0x7')](_0xdafe('0x18')));isOldTokenSent=![];return _0xfa78f8[_0xdafe('0x13')]({'data1':_0x7be36a,'data2':null,'license':null});}}}else{if(_0x1df604[_0xdafe('0xe')]!=_0x7be36a){logger[_0xdafe('0x11')](_0xdafe('0x16'),_0x1df604['data1'],_0x7be36a);return _0xfa78f8['update']({'data1':_0x7be36a,'data2':null,'license':null});}}}return _0xfa78f8;})[_0xdafe('0xc')](function(_0x5ea1de){_0xfa78f8=_0x5ea1de;})[_0xdafe('0x1d')](function(_0xc51433){logger[_0xdafe('0x1e')](_0xc51433[_0xdafe('0x1f')]);})[_0xdafe('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0xdafe('0x21')](),_0xfa78f8);},TIME);});}function defaultLicense(){var _0x5dd15f=hardware['getUuid']();if(_0x5dd15f){return db[_0xdafe('0x22')][_0xdafe('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x5dd15f}})[_0xdafe('0x24')](function(_0x3fbae7,_0x34086a){logger[_0xdafe('0x11')](_0xdafe('0x25'),_0x5dd15f);manageLicense(_0x5dd15f,_0x3fbae7);})[_0xdafe('0x1d')](function(_0x2e6ea1){logger[_0xdafe('0x1e')](_0x2e6ea1[_0xdafe('0x1f')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index dad0b1f..25dcad3 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 _0xe4df=['users','admin','pick','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','defaults','then','catch','uuid','data1','License\x20key\x20value\x20not\x20found','decryptString','format','%s:%s:%s','parse','gray','deadline','days','grayReason','machineUuid','changed','message','User','findAll','role','sequelize','COUNT','count','user','telephone'];(function(_0x439322,_0x196c97){var _0x4aa070=function(_0x43a434){while(--_0x43a434){_0x439322['push'](_0x439322['shift']());}};_0x4aa070(++_0x196c97);}(_0xe4df,0xad));var _0xfe4d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe4df[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xfe4d('0x0'));var _=require(_0xfe4d('0x1'));var moment=require(_0xfe4d('0x2'));var BPromise=require(_0xfe4d('0x3'));var hardware=require(_0xfe4d('0x4'));var encryptor=require(_0xfe4d('0x5'));var db=require(_0xfe4d('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xfe4d('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xfe4d('0x8'),'machineUuid':hardware[_0xfe4d('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xfe4d('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xfe4d('0xa'),'machineUuid':hardware[_0xfe4d('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x33cb48){return new BPromise(function(_0x2ef6ad,_0x2c85b8){return db['License'][_0xfe4d('0xb')](_[_0xfe4d('0xc')](_0x33cb48,{'raw':!![],'where':{'id':0x1}}))[_0xfe4d('0xd')](function(_0x40b1cf){return checkLicense(_0x40b1cf,null);})[_0xfe4d('0xd')](function(_0x3bd3a5){_0x2ef6ad(_0x3bd3a5);return;})[_0xfe4d('0xe')](function(_0x11f56e){_0x2c85b8(_0x11f56e);});});}function checkLicense(_0x2b83b2,_0x414c92){if(!_0x2b83b2){demoLicense[_0xfe4d('0xf')]=_0x2b83b2[_0xfe4d('0x10')];return demoLicense;}try{var _0x13b33b=_0x414c92||_0x2b83b2['license'];if(_['isEmpty'](_0x13b33b)){throw new Error(_0xfe4d('0x11'));}var _0x58b859=_0x2b83b2['data1'];var _0x3801d4=_0x2b83b2['data2'];var _0x536691=_0x58b859['split']('-')[0x4];var _0x212318=_0x58b859['split']('-')[0x0];var _0x5157a5=encryptor[_0xfe4d('0x12')](_0x13b33b,util[_0xfe4d('0x13')](_0xfe4d('0x14'),_0x536691,_0x58b859,_0x212318));var _0x564228=JSON[_0xfe4d('0x15')](_0x5157a5);_0x564228['demo']=![];_0x564228[_0xfe4d('0xf')]=_0x58b859;_0x564228['machineUuid']=hardware[_0xfe4d('0x9')]();if(_0x3801d4){var _0x3d0adc=encryptor[_0xfe4d('0x12')](_0x3801d4);_0x564228[_0xfe4d('0x16')]=_0x3d0adc;_0x564228[_0xfe4d('0x17')]=moment(_0x3d0adc)['add'](0x7,_0xfe4d('0x18'))[_0xfe4d('0x13')]();_0x564228[_0xfe4d('0x19')]=_0x564228['uuid']!=_0x564228[_0xfe4d('0x1a')]?_0xfe4d('0x1b'):'disabled';}return _0x564228;}catch(_0x24078a){breakingLicense[_0xfe4d('0xf')]=_0x2b83b2[_0xfe4d('0x10')];breakingLicense[_0xfe4d('0x1c')]=_0x24078a[_0xfe4d('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4d1827,_0x2587a8){getLicense()[_0xfe4d('0xd')](function(_0x4fa195){return db[_0xfe4d('0x1d')][_0xfe4d('0x1e')]({'attributes':[_0xfe4d('0x1f'),[db[_0xfe4d('0x20')]['fn'](_0xfe4d('0x21'),db[_0xfe4d('0x20')]['col'](_0xfe4d('0x1f'))),_0xfe4d('0x22')]],'group':_0xfe4d('0x1f'),'where':{'role':{'$or':['admin',_0xfe4d('0x23'),_0xfe4d('0x24')]}},'raw':!![]})[_0xfe4d('0xd')](function(_0x460afa){var _0x169a3b={'user':_0x4fa195[_0xfe4d('0x25')]||0x0,'telephone':_0x4fa195['telephones']||0x0};_0x460afa['forEach'](function(_0x7551e5){var _0x327efe=_0x7551e5[_0xfe4d('0x1f')]===_0xfe4d('0x26')?'user':_0x7551e5[_0xfe4d('0x1f')];_0x169a3b[_0x327efe]-=_0x7551e5[_0xfe4d('0x22')];if(_0x169a3b[_0x327efe]<0x0)_0x169a3b[_0x327efe]=0x0;});_0x4d1827(_0x169a3b);return;});})[_0xfe4d('0xe')](function(_0x15642b){_0x2587a8(_0x15642b);});});}function checkUserLimits(_0x5b1c60){return new BPromise(function(_0x48c247,_0x54c2ba){getLimits()['then'](function(_0x33322b){var _0x254d81=_[_0xfe4d('0x27')](_['countBy'](_0x5b1c60,_0xfe4d('0x1f')),[_0xfe4d('0x26'),_0xfe4d('0x23'),_0xfe4d('0x24')]);var _0x324535=(_0x254d81['admin']||0x0)+(_0x254d81[_0xfe4d('0x23')]||0x0);var _0x574af=_0x254d81[_0xfe4d('0x24')]||0x0;if(_0x324535>_0x33322b['user'])return _0x54c2ba(_0xfe4d('0x28'));if(_0x574af>_0x33322b[_0xfe4d('0x24')])return _0x54c2ba('License\x20limit\x20reached\x20for\x20telephones');return _0x48c247();})['catch'](function(_0x5ea8d6){_0x54c2ba(_0x5ea8d6);});});}module[_0xfe4d('0x29')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xf594=['User','findAll','role','sequelize','COUNT','admin','user','telephone','users','telephones','forEach','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','parse','demo','gray','deadline','add','grayReason','machineUuid','changed','disabled','message'];(function(_0x17a32f,_0x5a51a){var _0x15a293=function(_0x55fbd3){while(--_0x55fbd3){_0x17a32f['push'](_0x17a32f['shift']());}};_0x15a293(++_0x5a51a);}(_0xf594,0x106));var _0x4f59=function(_0x30fbc7,_0x3782b2){_0x30fbc7=_0x30fbc7-0x0;var _0x153fb2=_0xf594[_0x30fbc7];return _0x153fb2;};'use strict';var util=require('util');var _=require(_0x4f59('0x0'));var moment=require(_0x4f59('0x1'));var BPromise=require(_0x4f59('0x2'));var hardware=require(_0x4f59('0x3'));var encryptor=require(_0x4f59('0x4'));var db=require(_0x4f59('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4f59('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'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':'Breaking\x20license','machineUuid':hardware[_0x4f59('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4217bf){return new BPromise(function(_0x5c2505,_0x388daf){return db[_0x4f59('0x8')][_0x4f59('0x9')](_[_0x4f59('0xa')](_0x4217bf,{'raw':!![],'where':{'id':0x1}}))[_0x4f59('0xb')](function(_0x3a2ee4){return checkLicense(_0x3a2ee4,null);})[_0x4f59('0xb')](function(_0x6bd77e){_0x5c2505(_0x6bd77e);return;})[_0x4f59('0xc')](function(_0x36dcb7){_0x388daf(_0x36dcb7);});});}function checkLicense(_0x16b6e6,_0x504f1a){if(!_0x16b6e6){demoLicense[_0x4f59('0xd')]=_0x16b6e6[_0x4f59('0xe')];return demoLicense;}try{var _0x46721f=_0x504f1a||_0x16b6e6[_0x4f59('0xf')];if(_[_0x4f59('0x10')](_0x46721f)){throw new Error(_0x4f59('0x11'));}var _0x54377d=_0x16b6e6[_0x4f59('0xe')];var _0x5c749b=_0x16b6e6['data2'];var _0x1fb977=_0x54377d[_0x4f59('0x12')]('-')[0x4];var _0x19b26e=_0x54377d[_0x4f59('0x12')]('-')[0x0];var _0x45f3d7=encryptor[_0x4f59('0x13')](_0x46721f,util[_0x4f59('0x14')](_0x4f59('0x15'),_0x1fb977,_0x54377d,_0x19b26e));var _0x3936de=JSON[_0x4f59('0x16')](_0x45f3d7);_0x3936de[_0x4f59('0x17')]=![];_0x3936de[_0x4f59('0xd')]=_0x54377d;_0x3936de['machineUuid']=hardware[_0x4f59('0x7')]();if(_0x5c749b){var _0x175a81=encryptor['decryptString'](_0x5c749b);_0x3936de[_0x4f59('0x18')]=_0x175a81;_0x3936de[_0x4f59('0x19')]=moment(_0x175a81)[_0x4f59('0x1a')](0x7,'days')[_0x4f59('0x14')]();_0x3936de[_0x4f59('0x1b')]=_0x3936de[_0x4f59('0xd')]!=_0x3936de[_0x4f59('0x1c')]?_0x4f59('0x1d'):_0x4f59('0x1e');}return _0x3936de;}catch(_0xa415e6){breakingLicense[_0x4f59('0xd')]=_0x16b6e6['data1'];breakingLicense[_0x4f59('0x1f')]=_0xa415e6[_0x4f59('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x405d70,_0x62ebbb){getLicense()[_0x4f59('0xb')](function(_0x5d09fb){return db[_0x4f59('0x20')][_0x4f59('0x21')]({'attributes':[_0x4f59('0x22'),[db[_0x4f59('0x23')]['fn'](_0x4f59('0x24'),db[_0x4f59('0x23')]['col'](_0x4f59('0x22'))),'count']],'group':_0x4f59('0x22'),'where':{'role':{'$or':[_0x4f59('0x25'),_0x4f59('0x26'),_0x4f59('0x27')]}},'raw':!![]})[_0x4f59('0xb')](function(_0x117905){var _0x300f2d={'user':_0x5d09fb[_0x4f59('0x28')]||0x0,'telephone':_0x5d09fb[_0x4f59('0x29')]||0x0};_0x117905[_0x4f59('0x2a')](function(_0x1156fc){var _0x27649b=_0x1156fc['role']===_0x4f59('0x25')?_0x4f59('0x26'):_0x1156fc[_0x4f59('0x22')];_0x300f2d[_0x27649b]-=_0x1156fc[_0x4f59('0x2b')];if(_0x300f2d[_0x27649b]<0x0)_0x300f2d[_0x27649b]=0x0;});_0x405d70(_0x300f2d);return;});})[_0x4f59('0xc')](function(_0x3071ec){_0x62ebbb(_0x3071ec);});});}function checkUserLimits(_0x36fe39){return new BPromise(function(_0x42e5fc,_0x2b9370){getLimits()[_0x4f59('0xb')](function(_0x18dac4){var _0x2042c3=_[_0x4f59('0x2c')](_[_0x4f59('0x2d')](_0x36fe39,_0x4f59('0x22')),[_0x4f59('0x25'),_0x4f59('0x26'),_0x4f59('0x27')]);var _0x1d94c4=(_0x2042c3['admin']||0x0)+(_0x2042c3[_0x4f59('0x26')]||0x0);var _0x44d96e=_0x2042c3[_0x4f59('0x27')]||0x0;if(_0x1d94c4>_0x18dac4[_0x4f59('0x26')])return _0x2b9370(_0x4f59('0x2e'));if(_0x44d96e>_0x18dac4[_0x4f59('0x27')])return _0x2b9370(_0x4f59('0x2f'));return _0x42e5fc();})[_0x4f59('0xc')](function(_0x41a85b){_0x2b9370(_0x41a85b);});});}module[_0x4f59('0x30')]={'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 bf4cf08..c44b1dd 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 _0x1a37=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x1aed80,_0x3ca6f6){var _0x43961e=function(_0x43bf2b){while(--_0x43bf2b){_0x1aed80['push'](_0x1aed80['shift']());}};_0x43961e(++_0x3ca6f6);}(_0x1a37,0xb4));var _0x71a3=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x1a37[_0x2fc012];return _0x2891f9;};'use strict';module[_0x71a3('0x0')]={'DOMAIN':_0x71a3('0x1'),'SESSION_SECRET':_0x71a3('0x2'),'GOOGLE_ID':_0x71a3('0x3'),'GOOGLE_SECRET':_0x71a3('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x1c9a=['myappanuglar-secret','secret','exports'];(function(_0x2a84a1,_0x17226a){var _0x829472=function(_0x40a3cd){while(--_0x40a3cd){_0x2a84a1['push'](_0x2a84a1['shift']());}};_0x829472(++_0x17226a);}(_0x1c9a,0x98));var _0xa1c9=function(_0x49e249,_0x232a06){_0x49e249=_0x49e249-0x0;var _0x2ab40a=_0x1c9a[_0x49e249];return _0x2ab40a;};'use strict';module[_0xa1c9('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xa1c9('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xa1c9('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index ff0a713..a62f156 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa00f=['log','xcally','format','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','winston','util','INFO','/var'];(function(_0x3dbd94,_0x232b4f){var _0x4b6021=function(_0x3c15ba){while(--_0x3c15ba){_0x3dbd94['push'](_0x3dbd94['shift']());}};_0x4b6021(++_0x232b4f);}(_0xa00f,0xeb));var _0xfa00=function(_0x716888,_0x39df30){_0x716888=_0x716888-0x0;var _0x470fb2=_0xa00f[_0x716888];return _0x470fb2;};'use strict';var moment=require(_0xfa00('0x0'));var winston=require(_0xfa00('0x1'));var util=require(_0xfa00('0x2'));var path=require('path');var debugLevel=_0xfa00('0x3');function filename(_0x480c19,_0x1ffdf0){return path['join'](_0xfa00('0x4'),_0xfa00('0x5'),_0xfa00('0x6'),util[_0xfa00('0x7')]('%s-%s.log',_0x480c19,_0x1ffdf0));}function formatter(_0x209abd,_0x2e430c){_0x2e430c[_0xfa00('0x8')]=_0x2e430c[_0xfa00('0x8')][_0xfa00('0x9')](/@@{/g,_0xfa00('0xa'))[_0xfa00('0x9')](/}@@/g,'}}}')[_0xfa00('0x9')](/@{/g,'{{')[_0xfa00('0x9')](/}@/g,'}}');return util[_0xfa00('0x7')](_0xfa00('0xb'),moment()[_0xfa00('0x7')](_0xfa00('0xc')),_0x2e430c[_0xfa00('0xd')][_0xfa00('0xe')](),_0x209abd,_0x2e430c[_0xfa00('0x8')]);}module['exports']=function(_0x4057ff){return new winston[(_0xfa00('0xf'))]({'transports':[new winston[(_0xfa00('0x10'))][(_0xfa00('0x11'))]({'name':util[_0xfa00('0x7')](_0xfa00('0x12'),_0x4057ff,_0xfa00('0x13')),'filename':filename(_0x4057ff,_0xfa00('0x13')),'level':_0xfa00('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3d4091){return formatter(_0x4057ff,_0x3d4091);}}),new winston[(_0xfa00('0x10'))]['File']({'name':util['format'](_0xfa00('0x12'),_0x4057ff,'info'),'filename':filename(_0x4057ff,_0xfa00('0x14')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x43096a){return formatter(_0x4057ff,_0x43096a);}}),new winston[(_0xfa00('0x10'))][(_0xfa00('0x15'))]({'level':process[_0xfa00('0x16')][_0xfa00('0x17')]||debugLevel,'json':![],'formatter':function(_0x120af7){return formatter(_0x4057ff,_0x120af7);}})]});}; \ No newline at end of file +var _0xafc4=['}}}','YYYY-MM-DD\x20HH:mm:ss','level','exports','transports','File','%s-%s','error','info','Console','env','debugLevel','winston','util','path','INFO','join','/var','format','%s-%s.log','message','replace','{{{'];(function(_0x448ce0,_0x368759){var _0x276827=function(_0x20c835){while(--_0x20c835){_0x448ce0['push'](_0x448ce0['shift']());}};_0x276827(++_0x368759);}(_0xafc4,0x1c1));var _0x4afc=function(_0x4db09c,_0x174ee5){_0x4db09c=_0x4db09c-0x0;var _0x2f118b=_0xafc4[_0x4db09c];return _0x2f118b;};'use strict';var moment=require('moment');var winston=require(_0x4afc('0x0'));var util=require(_0x4afc('0x1'));var path=require(_0x4afc('0x2'));var debugLevel=_0x4afc('0x3');function filename(_0x38467b,_0x3181dd){return path[_0x4afc('0x4')](_0x4afc('0x5'),'log','xcally',util[_0x4afc('0x6')](_0x4afc('0x7'),_0x38467b,_0x3181dd));}function formatter(_0x1c76c2,_0x5af0d0){_0x5af0d0['message']=_0x5af0d0[_0x4afc('0x8')][_0x4afc('0x9')](/@@{/g,_0x4afc('0xa'))[_0x4afc('0x9')](/}@@/g,_0x4afc('0xb'))[_0x4afc('0x9')](/@{/g,'{{')[_0x4afc('0x9')](/}@/g,'}}');return util[_0x4afc('0x6')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x4afc('0x6')](_0x4afc('0xc')),_0x5af0d0[_0x4afc('0xd')]['toUpperCase'](),_0x1c76c2,_0x5af0d0[_0x4afc('0x8')]);}module[_0x4afc('0xe')]=function(_0x4651a2){return new winston['Logger']({'transports':[new winston[(_0x4afc('0xf'))][(_0x4afc('0x10'))]({'name':util[_0x4afc('0x6')](_0x4afc('0x11'),_0x4651a2,_0x4afc('0x12')),'filename':filename(_0x4651a2,_0x4afc('0x12')),'level':_0x4afc('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5d5ad6){return formatter(_0x4651a2,_0x5d5ad6);}}),new winston['transports'][(_0x4afc('0x10'))]({'name':util[_0x4afc('0x6')]('%s-%s',_0x4651a2,_0x4afc('0x13')),'filename':filename(_0x4651a2,_0x4afc('0x13')),'level':_0x4afc('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3f3c9b){return formatter(_0x4651a2,_0x3f3c9b);}}),new winston[(_0x4afc('0xf'))][(_0x4afc('0x14'))]({'level':process[_0x4afc('0x15')][_0x4afc('0x16')]||debugLevel,'json':![],'formatter':function(_0x4a76d3){return formatter(_0x4651a2,_0x4a76d3);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 6f31c3b..3d10fc6 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 _0xc32d=['email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','express','join','ami','../../services/ami/index.js','../../services/agi/index.js'];(function(_0x15cfed,_0x831d46){var _0x4597ad=function(_0x2a1cdc){while(--_0x2a1cdc){_0x15cfed['push'](_0x15cfed['shift']());}};_0x4597ad(++_0x831d46);}(_0xc32d,0x186));var _0xdc32=function(_0x2775e5,_0x530104){_0x2775e5=_0x2775e5-0x0;var _0x2f7f19=_0xc32d[_0x2775e5];return _0x2f7f19;};'use strict';var path=require(_0xdc32('0x0'));var os=require('os');var config={'apps':[{'name':_0xdc32('0x1'),'script':path[_0xdc32('0x2')](__dirname,'../../services/express/index.js')},{'name':_0xdc32('0x3'),'script':path[_0xdc32('0x2')](__dirname,_0xdc32('0x4'))},{'name':'agi','script':path[_0xdc32('0x2')](__dirname,_0xdc32('0x5'))},{'name':_0xdc32('0x6'),'script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0xdc32('0x7'),'script':path[_0xdc32('0x2')](__dirname,_0xdc32('0x8'))},{'name':_0xdc32('0x9'),'script':path[_0xdc32('0x2')](__dirname,_0xdc32('0xa'))}]};module['exports']=config; \ No newline at end of file +var _0xd76c=['path','express','ami','join','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','../../services/routing/index.js','exports'];(function(_0x17d426,_0x42a325){var _0x1ad3b4=function(_0x548457){while(--_0x548457){_0x17d426['push'](_0x17d426['shift']());}};_0x1ad3b4(++_0x42a325);}(_0xd76c,0x15e));var _0xcd76=function(_0x3438cf,_0x73b174){_0x3438cf=_0x3438cf-0x0;var _0x278698=_0xd76c[_0x3438cf];return _0x278698;};'use strict';var path=require(_0xcd76('0x0'));var os=require('os');var config={'apps':[{'name':_0xcd76('0x1'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0xcd76('0x2'),'script':path[_0xcd76('0x3')](__dirname,_0xcd76('0x4'))},{'name':_0xcd76('0x5'),'script':path[_0xcd76('0x3')](__dirname,_0xcd76('0x6'))},{'name':'email','script':path[_0xcd76('0x3')](__dirname,_0xcd76('0x7'))},{'name':'routing','script':path[_0xcd76('0x3')](__dirname,_0xcd76('0x8'))},{'name':'xdr','script':path[_0xcd76('0x3')](__dirname,'../../services/xdr/index.js')}]};module[_0xcd76('0x9')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 772ea8f..20cb08c 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 _0x2f02=['delete','dump','saved','pm2','bluebird','./config','connect','connected','start','disconnect','stop','restart','then','list','describe'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2f02,0x8a));var _0x22f0=function(_0x56b794,_0x50003f){_0x56b794=_0x56b794-0x0;var _0x80c80=_0x2f02[_0x56b794];return _0x80c80;};'use strict';var pm2=require(_0x22f0('0x0'));var BPromise=require(_0x22f0('0x1'));var config=require(_0x22f0('0x2'));function connect(){return new BPromise(function(_0x18913a,_0x1e37ca){return pm2[_0x22f0('0x3')](function(_0x31b9f9){if(_0x31b9f9){return _0x1e37ca(_0x31b9f9);}return _0x18913a(_0x22f0('0x4'));});});};exports[_0x22f0('0x5')]=function(_0x2e0dd0){return connect()['then'](function(){return new BPromise(function(_0x3fdd4f,_0xfce0a3){return pm2['start'](_0x2e0dd0,function(_0xf67a7b,_0x586ffa){if(_0xf67a7b){return _0xfce0a3(_0xf67a7b);}pm2[_0x22f0('0x6')]();return _0x3fdd4f(_0x586ffa);});});});};exports[_0x22f0('0x7')]=function(_0x1325eb){return connect()['then'](function(){return new BPromise(function(_0x3dfd7e,_0x27edac){return pm2[_0x22f0('0x7')](_0x1325eb,function(_0x47dd22,_0x3c61dd){if(_0x47dd22){return _0x27edac(_0x47dd22);}pm2[_0x22f0('0x6')]();return _0x3dfd7e(_0x3c61dd);});});});};exports[_0x22f0('0x8')]=function(_0x13c11e){return connect()[_0x22f0('0x9')](function(){return new BPromise(function(_0xb519b7,_0x181e12){return pm2[_0x22f0('0x8')](_0x13c11e,function(_0x45bc72,_0x30a808){if(_0x45bc72){return _0x181e12(_0x45bc72);}pm2[_0x22f0('0x6')]();return _0xb519b7(_0x30a808);});});});};exports[_0x22f0('0xa')]=function(){return connect()[_0x22f0('0x9')](function(){return new BPromise(function(_0x15554a,_0x25b7d3){return pm2['list'](function(_0xd1313,_0x5e3a85){if(_0xd1313){return _0x25b7d3(_0xd1313);}pm2[_0x22f0('0x6')]();return _0x15554a(_0x5e3a85);});});});};exports[_0x22f0('0xb')]=function(_0x595259){return connect()['then'](function(){return new BPromise(function(_0x4a03a3,_0x3a930b){return pm2['describe'](_0x595259,function(_0x1b897d,_0x3a89a6){if(_0x1b897d){return _0x3a930b(_0x1b897d);}pm2[_0x22f0('0x6')]();return _0x4a03a3(_0x3a89a6);});});});};exports[_0x22f0('0xc')]=function(_0x27c655){return connect()[_0x22f0('0x9')](function(){return new BPromise(function(_0x4ae801,_0x6bc96f){return pm2[_0x22f0('0xc')](_0x27c655,function(_0x5a09a9,_0x5dc069){if(_0x5a09a9){return _0x6bc96f(_0x5a09a9);}pm2[_0x22f0('0x6')]();return _0x4ae801(_0x5dc069);});});});};exports[_0x22f0('0xd')]=function(){return connect()[_0x22f0('0x9')](function(){return new BPromise(function(_0x121d8b,_0x18d393){return pm2['dump'](function(_0x397ab0){if(_0x397ab0){return _0x18d393(_0x397ab0);}return _0x121d8b(_0x22f0('0xe'));});});});}; \ No newline at end of file +var _0x0ad9=['delete','dump','saved','pm2','bluebird','./config','connect','connected','start','then','stop','disconnect','restart','list','describe'];(function(_0x3fd603,_0x5f5b06){var _0x5026af=function(_0x5f199d){while(--_0x5f199d){_0x3fd603['push'](_0x3fd603['shift']());}};_0x5026af(++_0x5f5b06);}(_0x0ad9,0x1f2));var _0x90ad=function(_0x576078,_0x5a16b3){_0x576078=_0x576078-0x0;var _0x4bd52=_0x0ad9[_0x576078];return _0x4bd52;};'use strict';var pm2=require(_0x90ad('0x0'));var BPromise=require(_0x90ad('0x1'));var config=require(_0x90ad('0x2'));function connect(){return new BPromise(function(_0x18fae7,_0x335a6c){return pm2[_0x90ad('0x3')](function(_0x1c8e63){if(_0x1c8e63){return _0x335a6c(_0x1c8e63);}return _0x18fae7(_0x90ad('0x4'));});});};exports[_0x90ad('0x5')]=function(_0x29c407){return connect()[_0x90ad('0x6')](function(){return new BPromise(function(_0x383307,_0x5868d8){return pm2[_0x90ad('0x5')](_0x29c407,function(_0x387c47,_0x5c1302){if(_0x387c47){return _0x5868d8(_0x387c47);}pm2['disconnect']();return _0x383307(_0x5c1302);});});});};exports[_0x90ad('0x7')]=function(_0x32df35){return connect()[_0x90ad('0x6')](function(){return new BPromise(function(_0x34ee47,_0x3a9c3e){return pm2[_0x90ad('0x7')](_0x32df35,function(_0x3b3428,_0x18271b){if(_0x3b3428){return _0x3a9c3e(_0x3b3428);}pm2[_0x90ad('0x8')]();return _0x34ee47(_0x18271b);});});});};exports[_0x90ad('0x9')]=function(_0x221eb0){return connect()[_0x90ad('0x6')](function(){return new BPromise(function(_0x59ae25,_0x3ddf24){return pm2[_0x90ad('0x9')](_0x221eb0,function(_0x185c9e,_0x2c8ce7){if(_0x185c9e){return _0x3ddf24(_0x185c9e);}pm2['disconnect']();return _0x59ae25(_0x2c8ce7);});});});};exports[_0x90ad('0xa')]=function(){return connect()[_0x90ad('0x6')](function(){return new BPromise(function(_0x3e9870,_0x5102d5){return pm2['list'](function(_0x21c811,_0x26d777){if(_0x21c811){return _0x5102d5(_0x21c811);}pm2['disconnect']();return _0x3e9870(_0x26d777);});});});};exports[_0x90ad('0xb')]=function(_0x43ebb2){return connect()[_0x90ad('0x6')](function(){return new BPromise(function(_0x1069c1,_0x23cc16){return pm2[_0x90ad('0xb')](_0x43ebb2,function(_0x831f10,_0x45dec2){if(_0x831f10){return _0x23cc16(_0x831f10);}pm2[_0x90ad('0x8')]();return _0x1069c1(_0x45dec2);});});});};exports[_0x90ad('0xc')]=function(_0x42175e){return connect()['then'](function(){return new BPromise(function(_0x434dc,_0xaced80){return pm2[_0x90ad('0xc')](_0x42175e,function(_0x3fedf4,_0x5ed891){if(_0x3fedf4){return _0xaced80(_0x3fedf4);}pm2['disconnect']();return _0x434dc(_0x5ed891);});});});};exports[_0x90ad('0xd')]=function(){return connect()[_0x90ad('0x6')](function(){return new BPromise(function(_0x209e4b,_0x4edab4){return pm2[_0x90ad('0xd')](function(_0x8c29){if(_0x8c29){return _0x4edab4(_0x8c29);}return _0x209e4b(_0x90ad('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index a7e2a99..2920f43 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 _0x5342=['minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','inspect','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','ChatInteraction','findAll','subtract'];(function(_0x3a8693,_0x21b229){var _0x461730=function(_0x483b4f){while(--_0x483b4f){_0x3a8693['push'](_0x3a8693['shift']());}};_0x461730(++_0x21b229);}(_0x5342,0x12f));var _0x2534=function(_0x89fffe,_0x1ef3ba){_0x89fffe=_0x89fffe-0x0;var _0x4a9fad=_0x5342[_0x89fffe];return _0x4a9fad;};'use strict';var _=require(_0x2534('0x0'));var moment=require('moment');var Redis=require(_0x2534('0x1'));var util=require(_0x2534('0x2'));var config=require(_0x2534('0x3'));var db=require(_0x2534('0x4'))['db'];var logger=require(_0x2534('0x5'))(_0x2534('0x6'));config[_0x2534('0x7')]=_[_0x2534('0x8')](config[_0x2534('0x7')],{'host':_0x2534('0x9'),'port':0x18eb});var io=require(_0x2534('0xa'))(new Redis(config[_0x2534('0x7')]));function closeInteractions(){var _0xdeb6ee=0x0;var _0x43a594=[];return db[_0x2534('0xb')]['find']({'raw':!![],'attributes':['id',_0x2534('0xc')],'where':{'id':0x1}})['then'](function(_0x522fcd){_0xdeb6ee=_0x522fcd[_0x2534('0xc')];if(_0xdeb6ee){return db[_0x2534('0xd')][_0x2534('0xe')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2534('0xf')](_0x522fcd[_0x2534('0xc')],_0x2534('0x10'))}}});}else{return[];}})['then'](function(_0x3304ee){if(_0x3304ee&&_0x3304ee[_0x2534('0x11')]){_0x43a594=_[_0x2534('0x12')](_0x3304ee||[],'id');logger['info'](_0x2534('0x13'),_0x43a594[_0x2534('0x14')]());return db[_0x2534('0xd')][_0x2534('0x15')]({'closeReason':'system','disposition':_0x2534('0x16'),'closed':!![],'closedAt':moment()[_0x2534('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x43a594}});}})['then'](function(){if(_0x43a594&&_0x43a594[_0x2534('0x11')]){logger[_0x2534('0x18')](_0x2534('0x19'),_0x43a594[_0x2534('0x14')]());for(var _0x17d82d=0x0;_0x17d82d<_0x43a594[_0x2534('0x11')];_0x17d82d++){io[_0x2534('0x1a')]('chatInteraction:update',{'id':_0x43a594[_0x17d82d],'closed':!![]});}}})[_0x2534('0x1b')](function(_0x32ee56){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x32ee56?util[_0x2534('0x1c')](_0x32ee56,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9678=['emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','../../mysqldb','../logger','schedule','defaults','redis','localhost','Setting','find','then','chatTimeout','findAll','lastMsgAt','subtract','minutes','info','join','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0xdaa63f,_0x1409b7){var _0x1e2181=function(_0x3abeb7){while(--_0x3abeb7){_0xdaa63f['push'](_0xdaa63f['shift']());}};_0x1e2181(++_0x1409b7);}(_0x9678,0xa6));var _0x8967=function(_0x502584,_0x1f62a3){_0x502584=_0x502584-0x0;var _0x19a3b9=_0x9678[_0x502584];return _0x19a3b9;};'use strict';var _=require('lodash');var moment=require(_0x8967('0x0'));var Redis=require(_0x8967('0x1'));var util=require('util');var config=require('../../config/environment');var db=require(_0x8967('0x2'))['db'];var logger=require(_0x8967('0x3'))(_0x8967('0x4'));config['redis']=_[_0x8967('0x5')](config[_0x8967('0x6')],{'host':_0x8967('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8967('0x6')]));function closeInteractions(){var _0x3464db=0x0;var _0x2a416e=[];return db[_0x8967('0x8')][_0x8967('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x8967('0xa')](function(_0x2d851e){_0x3464db=_0x2d851e[_0x8967('0xb')];if(_0x3464db){return db['ChatInteraction'][_0x8967('0xc')]({'raw':!![],'attributes':['id',_0x8967('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x8967('0xe')](_0x2d851e[_0x8967('0xb')],_0x8967('0xf'))}}});}else{return[];}})[_0x8967('0xa')](function(_0x542447){if(_0x542447&&_0x542447['length']){_0x2a416e=_['map'](_0x542447||[],'id');logger[_0x8967('0x10')]('[CHAT]\x20Interactions\x20to\x20close:',_0x2a416e[_0x8967('0x11')]());return db[_0x8967('0x12')][_0x8967('0x13')]({'closeReason':_0x8967('0x14'),'disposition':_0x8967('0x15'),'closed':!![],'closedAt':moment()[_0x8967('0x16')](_0x8967('0x17'))},{'where':{'id':_0x2a416e}});}})[_0x8967('0xa')](function(){if(_0x2a416e&&_0x2a416e[_0x8967('0x18')]){logger['info'](_0x8967('0x19'),_0x2a416e['join']());for(var _0x27e9a7=0x0;_0x27e9a7<_0x2a416e['length'];_0x27e9a7++){io[_0x8967('0x1a')](_0x8967('0x1b'),{'id':_0x2a416e[_0x27e9a7],'closed':!![]});}}})[_0x8967('0x1c')](function(_0x3c5e0a){logger[_0x8967('0x1d')](_0x8967('0x1e'),_0x3c5e0a?util[_0x8967('0x1f')](_0x3c5e0a,{'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 b6dd185..a2281c4 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 _0x6094=['../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','format','basename','extname','zip','existsSync','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','email\x20sent','catch','stringify','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','toRun','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','update','update\x20cron','stop\x20cron','run','start','util','lodash','moment','cron-job-manager','jayson/promise','bluebird'];(function(_0x47ee23,_0x58aad2){var _0x5b4718=function(_0x25cd81){while(--_0x25cd81){_0x47ee23['push'](_0x47ee23['shift']());}};_0x5b4718(++_0x58aad2);}(_0x6094,0x1c6));var _0x4609=function(_0x33e05f,_0x32d9ae){_0x33e05f=_0x33e05f-0x0;var _0x5633b9=_0x6094[_0x33e05f];return _0x5633b9;};'use strict';var fs=require('fs');var util=require(_0x4609('0x0'));var path=require('path');var _=require(_0x4609('0x1'));var moment=require(_0x4609('0x2'));var CronJobManager=require(_0x4609('0x3'));var jayson=require(_0x4609('0x4'));var BPromise=require(_0x4609('0x5'));var logger=require(_0x4609('0x6'))(_0x4609('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x4609('0x8'));var analyticDefaultReportController=require(_0x4609('0x9'));var client=jayson[_0x4609('0xa')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x469882,_0x4bd1ba){return function(){logger[_0x4609('0xb')](_0x4609('0xc'),_0x469882[_0x4609('0xd')]);var _0x4fd511=!![];var _0x38db46={'tls':{'rejectUnauthorized':![]}};if(_0x469882[_0x4609('0xe')][_0x4609('0xf')][_0x4609('0x10')]){_0x38db46[_0x4609('0x10')]=_0x469882[_0x4609('0xe')][_0x4609('0xf')][_0x4609('0x10')];}else{_0x38db46[_0x4609('0x11')]=_0x469882[_0x4609('0xe')]['Smtp']['host'];_0x38db46[_0x4609('0x12')]=_0x469882[_0x4609('0xe')][_0x4609('0xf')][_0x4609('0x12')];_0x38db46[_0x4609('0x13')]=_0x469882[_0x4609('0xe')][_0x4609('0xf')][_0x4609('0x13')];}if(_0x469882[_0x4609('0xe')][_0x4609('0xf')][_0x4609('0x14')]){_0x38db46[_0x4609('0x15')]={'user':_0x469882['MailAccount']['Smtp']['user'],'pass':_0x469882[_0x4609('0xe')]['Smtp'][_0x4609('0x16')]};}var _0x4b96d3={'account':_0x38db46,'message':{'from':util['format'](_0x4609('0x17'),_0x469882[_0x4609('0xe')][_0x4609('0x18')],_0x469882['MailAccount'][_0x4609('0xd')]||_0x469882['MailAccount']['Smtp'][_0x4609('0x19')]),'to':_0x469882['email'],'cc':_0x469882['cc'],'bcc':_0x469882[_0x4609('0x1a')],'subject':util['format'](_0x4609('0x1b'),_0x4bd1ba[_0x4609('0x18')],_0x469882[_0x4609('0x1c')],_0x469882[_0x4609('0x1d')])}};var _0x294cdf=path[_0x4609('0x1e')](__dirname,_0x4609('0x1f'));var _0xb2ea21=_0x4bd1ba[_0x4609('0x20')];var _0x58b24a=util[_0x4609('0x21')]('%s.%s',path[_0x4609('0x22')](_0x4bd1ba[_0x4609('0x20')],path[_0x4609('0x23')](_0x4bd1ba[_0x4609('0x20')])),_0x4609('0x24'));var _0x1bd8ed=path[_0x4609('0x1e')](_0x294cdf,_0xb2ea21);var _0x4ec809=path[_0x4609('0x1e')](_0x294cdf,_0x58b24a);if(fs[_0x4609('0x25')](_0x1bd8ed)){_0x4bd1ba[_0x4609('0x26')]=_0x4609('0x27');_0x4b96d3['message'][_0x4609('0x28')]=[{'filename':_0xb2ea21,'path':_0x1bd8ed}];_0x4b96d3[_0x4609('0x29')][_0x4609('0x2a')]=util[_0x4609('0x21')](_0x4609('0x2b'),JSON['stringify'](_0x4bd1ba,null,0x2));}else if(fs['existsSync'](_0x4ec809)){_0x4bd1ba[_0x4609('0x26')]=_0x4609('0x27');_0x4b96d3[_0x4609('0x29')][_0x4609('0x28')]=[{'filename':_0x58b24a,'path':_0x4ec809}];}else{_0x4b96d3[_0x4609('0x29')][_0x4609('0x2a')]=_0x4609('0x2c');if(!_0x469882[_0x4609('0x2d')]){_0x4fd511=![];logger[_0x4609('0xb')](_0x4609('0x2e'));}}if(_0x4fd511){return client['request'](_0x4609('0x2f'),_0x4b96d3)[_0x4609('0x30')](function(_0x21faa3){if(_0x21faa3['error']){return logger[_0x4609('0x31')](_0x4609('0x32'),JSON['stringify'](_0x21faa3));}return logger[_0x4609('0xb')](_0x4609('0x33'));})[_0x4609('0x34')](function(_0x380464){return logger['error'](_0x4609('0x32'),JSON['stringify'](_0x380464));});}};}function handleError(){return function(_0x394a27){return logger[_0x4609('0x31')](JSON[_0x4609('0x35')](_0x394a27));};}function handleResult(_0x52637f){return function(_0xcfa196){logger[_0x4609('0xb')](_0x4609('0x36'),JSON['stringify'](_0xcfa196));if(_0x52637f[_0x4609('0xe')]&&_0x52637f['MailAccount'][_0x4609('0xf')]&&!_[_0x4609('0x37')](_0x52637f[_0x4609('0xd')])){setTimeout(handleSendEmail(_0x52637f,_0xcfa196),0x3c*0x3e8);}};}function handleJob(_0x267369){return function(){try{if(_[_0x4609('0x37')](_0x267369[_0x4609('0x1c')])){return logger[_0x4609('0xb')](_0x4609('0x38'));}if(_[_0x4609('0x37')](_0x267369[_0x4609('0x1d')])){return logger[_0x4609('0xb')](_0x4609('0x39'));}var _0x27f50d={'startDate':moment()['subtract'](_0x267369[_0x4609('0x1c')],_0x267369['subtractUnit'])[_0x4609('0x21')](_0x4609('0x3a')),'endDate':moment()['format'](_0x4609('0x3a')),'type':'scheduled','output':_0x267369[_0x4609('0x3b')],'name':_0x267369[_0x4609('0x18')]};if(!_[_0x4609('0x37')](_0x267369[_0x4609('0x3c')])){logger['info'](_0x4609('0x3d'),_0x267369[_0x4609('0x3c')]);return analyticDefaultReportController[_0x4609('0x3e')]({'id':_0x267369[_0x4609('0x3c')]},_0x27f50d)[_0x4609('0x30')](handleResult(_0x267369))[_0x4609('0x34')](handleError());}if(!_[_0x4609('0x37')](_0x267369[_0x4609('0x3f')])){logger[_0x4609('0xb')](_0x4609('0x40'),_0x267369[_0x4609('0x3f')]);return analyticCustomReportController[_0x4609('0x3e')]({'id':_0x267369['CustomReportId']},_0x27f50d)[_0x4609('0x30')](handleResult(_0x267369))[_0x4609('0x34')](handleError());}}catch(_0x47c775){logger[_0x4609('0x31')](JSON[_0x4609('0x35')](_0x47c775));}return logger[_0x4609('0xb')](_0x4609('0x41'));};}function getJobs(_0x3af11c){var _0x28580f={};if(_0x3af11c){_0x28580f['id']=_0x3af11c;}return db[_0x4609('0x42')][_0x4609('0x43')]({'where':_0x28580f,'include':[{'model':db[_0x4609('0xe')],'attributes':['id',_0x4609('0x18'),_0x4609('0xd')],'include':[{'model':db[_0x4609('0x44')],'as':_0x4609('0xf')}]}]})[_0x4609('0x30')](function(_0x5c5166){var _0x17c536=_['keys'](manager[_0x4609('0x45')]);var _0x2d788c=_[_0x4609('0x46')](_0x5c5166,function(_0x491ef8){return _0x491ef8['id'][_0x4609('0x47')]();});var _0x2b8af5=_[_0x4609('0x48')](_0x5c5166,function(_0x436be1){return _0x436be1['id'][_0x4609('0x47')]();});var _0x519da1=_0x3af11c?_0x2d788c:_[_0x4609('0x49')](_0x2d788c,_0x17c536);var _0x193a8e=_[_0x4609('0x4a')](_0x2d788c,_0x17c536);var _0xf7fc31=_[_0x4609('0x49')](_0x17c536,_0x2d788c);var _0x59dd01;var _0x4d731c;for(_0x59dd01=0x0;_0x59dd01<_0xf7fc31[_0x4609('0x4b')]&&!_0x3af11c;_0x59dd01+=0x1){_0x4d731c=_0xf7fc31[_0x59dd01][_0x4609('0x47')]();if(manager[_0x4609('0x4c')](_0x4d731c)){manager[_0x4609('0x4d')](_0x4d731c);manager[_0x4609('0x4e')](_0x4d731c);logger[_0x4609('0xb')]('delete\x20cron',_0x4d731c);}}logger['info'](_0x4609('0x4f'),JSON['stringify'](_0x519da1));for(_0x59dd01=0x0;_0x59dd01<_0x519da1[_0x4609('0x4b')];_0x59dd01+=0x1){_0x4d731c=_0x519da1[_0x59dd01][_0x4609('0x47')]();logger['info']('index',_0x4d731c);if(_0x3af11c){logger[_0x4609('0xb')](_0x4609('0x50'),_0x3af11c);logger[_0x4609('0xb')](JSON[_0x4609('0x35')](_0x2b8af5[_0x4d731c]));BPromise['resolve']()[_0x4609('0x30')](handleJob(_0x2b8af5[_0x4d731c]));logger['info'](_0x4609('0x51'),_0x2b8af5[_0x4d731c]['name'],_0x2b8af5[_0x4d731c][_0x4609('0x52')]);}else if(_0x2b8af5[_0x4d731c][_0x4609('0x52')]&&_0x2b8af5[_0x4d731c][_0x4609('0x53')]&&moment()[_0x4609('0x54')](_0x2b8af5[_0x4d731c][_0x4609('0x55')],_0x2b8af5[_0x4d731c][_0x4609('0x56')])){manager['add'](_0x4d731c,_0x2b8af5[_0x4d731c][_0x4609('0x52')],handleJob(_0x2b8af5[_0x4d731c]));manager['start'](_0x4d731c);logger[_0x4609('0xb')]('add\x20cron',_0x2b8af5[_0x4d731c][_0x4609('0x18')],_0x2b8af5[_0x4d731c][_0x4609('0x52')]);}else if(manager['exists'](_0x4d731c)){manager['stop'](_0x4d731c);manager[_0x4609('0x4e')](_0x4d731c);logger[_0x4609('0xb')]('stop\x20cron',_0x2b8af5[_0x4d731c][_0x4609('0x18')],_0x2b8af5[_0x4d731c]['cron']);}}for(_0x59dd01=0x0,_0x4d731c;_0x59dd01<_0x193a8e[_0x4609('0x4b')]&&!_0x3af11c;_0x59dd01+=0x1){_0x4d731c=_0x193a8e[_0x59dd01][_0x4609('0x47')]();if(manager[_0x4609('0x4c')](_0x4d731c)){if(_0x2b8af5[_0x4d731c][_0x4609('0x52')]&&_0x2b8af5[_0x4d731c][_0x4609('0x53')]&&moment()[_0x4609('0x54')](_0x2b8af5[_0x4d731c][_0x4609('0x55')],_0x2b8af5[_0x4d731c]['endAt'])){manager[_0x4609('0x57')](_0x4d731c,_0x2b8af5[_0x4d731c]['cron'],handleJob(_0x2b8af5[_0x4d731c]));logger[_0x4609('0xb')](_0x4609('0x58'),_0x2b8af5[_0x4d731c][_0x4609('0x18')],_0x2b8af5[_0x4d731c][_0x4609('0x52')]);}else{manager['stop'](_0x4d731c);manager['deleteJob'](_0x4d731c);logger[_0x4609('0xb')](_0x4609('0x59'),_0x2b8af5[_0x4d731c][_0x4609('0x18')],_0x2b8af5[_0x4d731c][_0x4609('0x52')]);}}}})[_0x4609('0x34')](function(_0xbc85e7){logger[_0x4609('0x31')](JSON[_0x4609('0x35')](_0xbc85e7));});}exports[_0x4609('0x5a')]=function(_0x79a2d9){return getJobs(_0x79a2d9);};exports[_0x4609('0x5b')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x14ed=['path','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','zip','existsSync','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error\x20mail','email\x20sent','catch','error','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','toString','keyBy','difference','intersection','exists','stop','deleteJob','delete\x20cron','length','my\x20id','resolve','run\x20job','cron','startAt','endAt','start','add\x20cron','stop\x20cron','active','isBetween','update','run','util'];(function(_0x4b87e8,_0x5c2f52){var _0x228888=function(_0x369e9e){while(--_0x369e9e){_0x4b87e8['push'](_0x4b87e8['shift']());}};_0x228888(++_0x5c2f52);}(_0x14ed,0x1d0));var _0xd14e=function(_0x45793b,_0x543050){_0x45793b=_0x45793b-0x0;var _0xa21b36=_0x14ed[_0x45793b];return _0xa21b36;};'use strict';var fs=require('fs');var util=require(_0xd14e('0x0'));var path=require(_0xd14e('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0xd14e('0x2'));var jayson=require(_0xd14e('0x3'));var BPromise=require(_0xd14e('0x4'));var logger=require(_0xd14e('0x5'))(_0xd14e('0x6'));var db=require(_0xd14e('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xd14e('0x8')][_0xd14e('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x242619,_0x4228c0){return function(){logger['info'](_0xd14e('0xa'),_0x242619[_0xd14e('0xb')]);var _0x55d8c3=!![];var _0x4ef4aa={'tls':{'rejectUnauthorized':![]}};if(_0x242619[_0xd14e('0xc')][_0xd14e('0xd')][_0xd14e('0xe')]){_0x4ef4aa[_0xd14e('0xe')]=_0x242619[_0xd14e('0xc')][_0xd14e('0xd')][_0xd14e('0xe')];}else{_0x4ef4aa['host']=_0x242619[_0xd14e('0xc')][_0xd14e('0xd')][_0xd14e('0xf')];_0x4ef4aa[_0xd14e('0x10')]=_0x242619['MailAccount'][_0xd14e('0xd')][_0xd14e('0x10')];_0x4ef4aa[_0xd14e('0x11')]=_0x242619[_0xd14e('0xc')]['Smtp'][_0xd14e('0x11')];}if(_0x242619[_0xd14e('0xc')]['Smtp']['authentication']){_0x4ef4aa[_0xd14e('0x12')]={'user':_0x242619[_0xd14e('0xc')]['Smtp'][_0xd14e('0x13')],'pass':_0x242619['MailAccount'][_0xd14e('0xd')][_0xd14e('0x14')]};}var _0x7ce935={'account':_0x4ef4aa,'message':{'from':util[_0xd14e('0x15')](_0xd14e('0x16'),_0x242619[_0xd14e('0xc')][_0xd14e('0x17')],_0x242619['MailAccount']['email']||_0x242619['MailAccount']['Smtp'][_0xd14e('0x13')]),'to':_0x242619[_0xd14e('0xb')],'cc':_0x242619['cc'],'bcc':_0x242619[_0xd14e('0x18')],'subject':util['format'](_0xd14e('0x19'),_0x4228c0['name'],_0x242619[_0xd14e('0x1a')],_0x242619[_0xd14e('0x1b')])}};var _0x2affe6=path[_0xd14e('0x1c')](__dirname,_0xd14e('0x1d'));var _0x207c82=_0x4228c0[_0xd14e('0x1e')];var _0x12092b=util['format'](_0xd14e('0x1f'),path[_0xd14e('0x20')](_0x4228c0['savename'],path['extname'](_0x4228c0[_0xd14e('0x1e')])),_0xd14e('0x21'));var _0x5d11d1=path[_0xd14e('0x1c')](_0x2affe6,_0x207c82);var _0x58b7bd=path[_0xd14e('0x1c')](_0x2affe6,_0x12092b);if(fs[_0xd14e('0x22')](_0x5d11d1)){_0x4228c0[_0xd14e('0x23')]=_0xd14e('0x24');_0x7ce935['message'][_0xd14e('0x25')]=[{'filename':_0x207c82,'path':_0x5d11d1}];_0x7ce935[_0xd14e('0x26')][_0xd14e('0x27')]=util[_0xd14e('0x15')](_0xd14e('0x28'),JSON[_0xd14e('0x29')](_0x4228c0,null,0x2));}else if(fs[_0xd14e('0x22')](_0x58b7bd)){_0x4228c0[_0xd14e('0x23')]=_0xd14e('0x24');_0x7ce935[_0xd14e('0x26')][_0xd14e('0x25')]=[{'filename':_0x12092b,'path':_0x58b7bd}];}else{_0x7ce935[_0xd14e('0x26')]['text']=_0xd14e('0x2a');if(!_0x242619[_0xd14e('0x2b')]){_0x55d8c3=![];logger[_0xd14e('0x2c')](_0xd14e('0x2d'));}}if(_0x55d8c3){return client[_0xd14e('0x2e')](_0xd14e('0x2f'),_0x7ce935)['then'](function(_0x169ab1){if(_0x169ab1['error']){return logger['error'](_0xd14e('0x30'),JSON[_0xd14e('0x29')](_0x169ab1));}return logger[_0xd14e('0x2c')](_0xd14e('0x31'));})[_0xd14e('0x32')](function(_0x73235c){return logger['error'](_0xd14e('0x30'),JSON[_0xd14e('0x29')](_0x73235c));});}};}function handleError(){return function(_0x192f79){return logger[_0xd14e('0x33')](JSON['stringify'](_0x192f79));};}function handleResult(_0x1b27b8){return function(_0x444ed9){logger[_0xd14e('0x2c')](_0xd14e('0x34'),JSON[_0xd14e('0x29')](_0x444ed9));if(_0x1b27b8[_0xd14e('0xc')]&&_0x1b27b8[_0xd14e('0xc')][_0xd14e('0xd')]&&!_[_0xd14e('0x35')](_0x1b27b8['email'])){setTimeout(handleSendEmail(_0x1b27b8,_0x444ed9),0x3c*0x3e8);}};}function handleJob(_0x464e1e){return function(){try{if(_[_0xd14e('0x35')](_0x464e1e[_0xd14e('0x1a')])){return logger[_0xd14e('0x2c')](_0xd14e('0x36'));}if(_[_0xd14e('0x35')](_0x464e1e[_0xd14e('0x1b')])){return logger[_0xd14e('0x2c')](_0xd14e('0x37'));}var _0x4257ab={'startDate':moment()[_0xd14e('0x38')](_0x464e1e[_0xd14e('0x1a')],_0x464e1e[_0xd14e('0x1b')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xd14e('0x15')](_0xd14e('0x39')),'type':_0xd14e('0x3a'),'output':_0x464e1e[_0xd14e('0x3b')],'name':_0x464e1e[_0xd14e('0x17')]};if(!_[_0xd14e('0x35')](_0x464e1e[_0xd14e('0x3c')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x464e1e[_0xd14e('0x3c')]);return analyticDefaultReportController[_0xd14e('0x3d')]({'id':_0x464e1e['DefaultReportId']},_0x4257ab)[_0xd14e('0x3e')](handleResult(_0x464e1e))['catch'](handleError());}if(!_[_0xd14e('0x35')](_0x464e1e[_0xd14e('0x3f')])){logger['info'](_0xd14e('0x40'),_0x464e1e[_0xd14e('0x3f')]);return analyticCustomReportController['runReport']({'id':_0x464e1e[_0xd14e('0x3f')]},_0x4257ab)['then'](handleResult(_0x464e1e))['catch'](handleError());}}catch(_0x5c878e){logger[_0xd14e('0x33')](JSON[_0xd14e('0x29')](_0x5c878e));}return logger[_0xd14e('0x2c')](_0xd14e('0x41'));};}function getJobs(_0x547c18){var _0x3a5950={};if(_0x547c18){_0x3a5950['id']=_0x547c18;}return db[_0xd14e('0x42')][_0xd14e('0x43')]({'where':_0x3a5950,'include':[{'model':db[_0xd14e('0xc')],'attributes':['id','name',_0xd14e('0xb')],'include':[{'model':db[_0xd14e('0x44')],'as':_0xd14e('0xd')}]}]})[_0xd14e('0x3e')](function(_0x4209a9){var _0x4516d6=_[_0xd14e('0x45')](manager[_0xd14e('0x46')]);var _0x1768d8=_['map'](_0x4209a9,function(_0x3ab948){return _0x3ab948['id'][_0xd14e('0x47')]();});var _0xdf8d84=_[_0xd14e('0x48')](_0x4209a9,function(_0x1b5725){return _0x1b5725['id']['toString']();});var _0xae8df3=_0x547c18?_0x1768d8:_[_0xd14e('0x49')](_0x1768d8,_0x4516d6);var _0x53c556=_[_0xd14e('0x4a')](_0x1768d8,_0x4516d6);var _0x375248=_[_0xd14e('0x49')](_0x4516d6,_0x1768d8);var _0xe88f07;var _0x5890a0;for(_0xe88f07=0x0;_0xe88f07<_0x375248['length']&&!_0x547c18;_0xe88f07+=0x1){_0x5890a0=_0x375248[_0xe88f07][_0xd14e('0x47')]();if(manager[_0xd14e('0x4b')](_0x5890a0)){manager[_0xd14e('0x4c')](_0x5890a0);manager[_0xd14e('0x4d')](_0x5890a0);logger[_0xd14e('0x2c')](_0xd14e('0x4e'),_0x5890a0);}}logger['info']('toRun',JSON[_0xd14e('0x29')](_0xae8df3));for(_0xe88f07=0x0;_0xe88f07<_0xae8df3[_0xd14e('0x4f')];_0xe88f07+=0x1){_0x5890a0=_0xae8df3[_0xe88f07][_0xd14e('0x47')]();logger[_0xd14e('0x2c')]('index',_0x5890a0);if(_0x547c18){logger[_0xd14e('0x2c')](_0xd14e('0x50'),_0x547c18);logger[_0xd14e('0x2c')](JSON[_0xd14e('0x29')](_0xdf8d84[_0x5890a0]));BPromise[_0xd14e('0x51')]()[_0xd14e('0x3e')](handleJob(_0xdf8d84[_0x5890a0]));logger['info'](_0xd14e('0x52'),_0xdf8d84[_0x5890a0][_0xd14e('0x17')],_0xdf8d84[_0x5890a0]['cron']);}else if(_0xdf8d84[_0x5890a0][_0xd14e('0x53')]&&_0xdf8d84[_0x5890a0]['active']&&moment()['isBetween'](_0xdf8d84[_0x5890a0][_0xd14e('0x54')],_0xdf8d84[_0x5890a0][_0xd14e('0x55')])){manager['add'](_0x5890a0,_0xdf8d84[_0x5890a0][_0xd14e('0x53')],handleJob(_0xdf8d84[_0x5890a0]));manager[_0xd14e('0x56')](_0x5890a0);logger[_0xd14e('0x2c')](_0xd14e('0x57'),_0xdf8d84[_0x5890a0][_0xd14e('0x17')],_0xdf8d84[_0x5890a0][_0xd14e('0x53')]);}else if(manager[_0xd14e('0x4b')](_0x5890a0)){manager[_0xd14e('0x4c')](_0x5890a0);manager[_0xd14e('0x4d')](_0x5890a0);logger[_0xd14e('0x2c')](_0xd14e('0x58'),_0xdf8d84[_0x5890a0][_0xd14e('0x17')],_0xdf8d84[_0x5890a0][_0xd14e('0x53')]);}}for(_0xe88f07=0x0,_0x5890a0;_0xe88f07<_0x53c556['length']&&!_0x547c18;_0xe88f07+=0x1){_0x5890a0=_0x53c556[_0xe88f07][_0xd14e('0x47')]();if(manager[_0xd14e('0x4b')](_0x5890a0)){if(_0xdf8d84[_0x5890a0][_0xd14e('0x53')]&&_0xdf8d84[_0x5890a0][_0xd14e('0x59')]&&moment()[_0xd14e('0x5a')](_0xdf8d84[_0x5890a0][_0xd14e('0x54')],_0xdf8d84[_0x5890a0][_0xd14e('0x55')])){manager[_0xd14e('0x5b')](_0x5890a0,_0xdf8d84[_0x5890a0][_0xd14e('0x53')],handleJob(_0xdf8d84[_0x5890a0]));logger[_0xd14e('0x2c')]('update\x20cron',_0xdf8d84[_0x5890a0]['name'],_0xdf8d84[_0x5890a0][_0xd14e('0x53')]);}else{manager[_0xd14e('0x4c')](_0x5890a0);manager[_0xd14e('0x4d')](_0x5890a0);logger[_0xd14e('0x2c')]('stop\x20cron',_0xdf8d84[_0x5890a0][_0xd14e('0x17')],_0xdf8d84[_0x5890a0]['cron']);}}}})[_0xd14e('0x32')](function(_0x3163a4){logger[_0xd14e('0x33')](JSON[_0xd14e('0x29')](_0x3163a4));});}exports[_0xd14e('0x5c')]=function(_0x33fe13){return getJobs(_0x33fe13);};exports[_0xd14e('0x56')]=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 a69b097..ed4d1ae 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 _0x1d90=['resolve','sentiment','sentimentAccountId','bucket','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Positive','name','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','SequelizeValidationError','start','lodash','request-promise','bluebird','../../config/logger','transcribe','TranscribeService','detectSentiment','substring','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','results','transcripts','length','fileText','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed'];(function(_0x34e62a,_0x114969){var _0x5f57ee=function(_0x275a5d){while(--_0x275a5d){_0x34e62a['push'](_0x34e62a['shift']());}};_0x5f57ee(++_0x114969);}(_0x1d90,0x13e));var _0x01d9=function(_0x909398,_0x2e6d0b){_0x909398=_0x909398-0x0;var _0x16e1f3=_0x1d90[_0x909398];return _0x16e1f3;};var _=require(_0x01d9('0x0'));var AWS=require('aws-sdk');var rp=require(_0x01d9('0x1'));var util=require('util');var BPromise=require(_0x01d9('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x01d9('0x3'))(_0x01d9('0x4'));function getTranscriptionJob(_0x47e13e,_0x2f2e27,_0x405f55,_0xc03631){return new Promise(function(_0x549267,_0x500fb7){var _0x1664eb=new AWS[(_0x01d9('0x5'))]({'accessKeyId':_0x2f2e27,'secretAccessKey':_0x47e13e,'region':_0x405f55});_0x1664eb['getTranscriptionJob']({'TranscriptionJobName':_0xc03631},function(_0xef9d5b,_0x479447){if(_0xef9d5b){return _0x500fb7(_0xef9d5b);}else{return _0x549267(_0x479447);}});});}function sentiment(_0x497d40,_0x45a579,_0x2b8e06,_0x332f6a,_0x553073){return new Promise(function(_0x2745e4,_0x2a7727){var _0x2d1ca0=new AWS['Comprehend']({'accessKeyId':_0x45a579,'secretAccessKey':_0x497d40,'region':_0x2b8e06});_0x2d1ca0[_0x01d9('0x6')]({'Text':_0x332f6a,'LanguageCode':_0x553073[_0x01d9('0x7')](0x0,0x2)},function(_0x5fc001,_0x2b0a92){if(_0x5fc001){return _0x2a7727(_0x5fc001);}else{return _0x2745e4(_0x2b0a92);}});});}function checkTranscribeJob(_0xf99df2,_0x3c43c5,_0x411e2e){var _0x2895dd;return new BPromise(function(_0x2325c5,_0x3254a5){logger[_0x01d9('0x8')](util[_0x01d9('0x9')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0xf99df2['id'],_0xf99df2[_0x01d9('0xa')]));return getTranscriptionJob(_0x411e2e[_0x01d9('0xb')],_0x411e2e[_0x01d9('0xc')],_0x3c43c5[_0x01d9('0xd')],_0xf99df2['transcribeName'])[_0x01d9('0xe')](function(_0x5bc7fc){logger[_0x01d9('0x8')](util[_0x01d9('0x9')](_0x01d9('0xf'),_0xf99df2['id'],_0xf99df2['transcribeName'],_0x5bc7fc[_0x01d9('0x10')][_0x01d9('0x11')]));if(!_0xf99df2['fileText']){switch(_0x5bc7fc[_0x01d9('0x10')][_0x01d9('0x11')]){case _0x01d9('0x12'):var _0x4aceee={'transcribeStatus':_0x5bc7fc['TranscriptionJob'][_0x01d9('0x11')],'fileUri':_0x5bc7fc['TranscriptionJob']['Transcript'][_0x01d9('0x13')]};logger[_0x01d9('0x8')](util[_0x01d9('0x9')](_0x01d9('0x14'),_0xf99df2['id']));return rp({'uri':_0x5bc7fc['TranscriptionJob'][_0x01d9('0x15')][_0x01d9('0x13')],'json':!![]})['then'](function(_0x216a49){logger[_0x01d9('0x8')](util[_0x01d9('0x9')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0xf99df2['id']));if(_0x216a49&&_0x216a49[_0x01d9('0x16')]&&_0x216a49[_0x01d9('0x16')][_0x01d9('0x17')]&&_0x216a49[_0x01d9('0x16')]['transcripts'][_0x01d9('0x18')]){_0x4aceee['fileText']='';for(var _0x294b95=0x0;_0x294b95<_0x216a49[_0x01d9('0x16')][_0x01d9('0x17')][_0x01d9('0x18')];_0x294b95++){_0x4aceee[_0x01d9('0x19')]+=_0x216a49[_0x01d9('0x16')][_0x01d9('0x17')][_0x294b95][_0x01d9('0x1a')]+'';}}return _0xf99df2[_0x01d9('0x1b')](_0x4aceee);})[_0x01d9('0xe')](function(){logger[_0x01d9('0x8')](util[_0x01d9('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xf99df2['id']));if(!_0xf99df2[_0x01d9('0x1c')]){throw new db[(_0x01d9('0x1d'))][(_0x01d9('0x1e'))](_0x01d9('0x1f'));}if(!_0x3c43c5['sentiment']||!_0x3c43c5['sentimentAccountId']||!_0x3c43c5[_0x01d9('0x20')]||!_0x3c43c5[_0x01d9('0x21')]||!_0x3c43c5['bucket']){throw new db[(_0x01d9('0x1d'))]['ValidationError'](_0x01d9('0x22'));}if(!_0x4aceee[_0x01d9('0x19')]){throw new Error('Transcript\x20not\x20available');}if(_0x3c43c5['sentimentAccountId']===_0x411e2e['id']){return _0x411e2e;}else{return db[_0x01d9('0x23')][_0x01d9('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x01d9('0xe')](function(_0x5dae9f){if(!_0x5dae9f){throw new db[(_0x01d9('0x1d'))][(_0x01d9('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5dae9f[_0x01d9('0xb')]||!_0x5dae9f[_0x01d9('0xc')]){throw new db[(_0x01d9('0x1d'))][(_0x01d9('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x2895dd=_0x5dae9f;logger['info'](util[_0x01d9('0x9')](_0x01d9('0x25'),_0xf99df2['id']));return sentiment(_0x2895dd[_0x01d9('0xb')],_0x2895dd['data2'],_0x3c43c5[_0x01d9('0x20')],_0x4aceee[_0x01d9('0x19')],_0x3c43c5[_0x01d9('0x21')]);})[_0x01d9('0xe')](function(_0x2f6152){logger[_0x01d9('0x8')](util[_0x01d9('0x9')](_0x01d9('0x26'),_0xf99df2['id']));return _0xf99df2[_0x01d9('0x1b')]({'sentiment':_0x2f6152[_0x01d9('0x27')],'sPositive':_0x2f6152[_0x01d9('0x28')]['Positive'],'sNegative':_0x2f6152[_0x01d9('0x28')][_0x01d9('0x29')],'sMixed':_0x2f6152[_0x01d9('0x28')][_0x01d9('0x2a')],'sNeutral':_0x2f6152[_0x01d9('0x28')][_0x01d9('0x2b')]});})[_0x01d9('0xe')](function(){logger['info'](util[_0x01d9('0x9')](_0x01d9('0x2c'),_0xf99df2['id']));_0x2325c5();});case _0x01d9('0x2d'):return _0xf99df2[_0x01d9('0x1b')]({'transcribeStatus':'FAILED','failureReason':_0x5bc7fc[_0x01d9('0x10')]['FailureReason']})['then'](function(){logger['info'](util[_0x01d9('0x9')](_0x01d9('0x2c'),_0xf99df2['id']));_0x2325c5();});default:logger['info'](util[_0x01d9('0x9')](_0x01d9('0x2e'),_0xf99df2['id']));break;}}else{return BPromise[_0x01d9('0x2f')]()[_0x01d9('0xe')](function(){if(!_0xf99df2['tempSentiment']){throw new db[(_0x01d9('0x1d'))][(_0x01d9('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3c43c5[_0x01d9('0x30')]||!_0x3c43c5[_0x01d9('0x31')]||!_0x3c43c5[_0x01d9('0x20')]||!_0x3c43c5[_0x01d9('0x21')]||!_0x3c43c5[_0x01d9('0x32')]){throw new db[(_0x01d9('0x1d'))][(_0x01d9('0x1e'))](_0x01d9('0x22'));}if(!_0xf99df2['fileText']){throw new Error(_0x01d9('0x33'));}if(_0x3c43c5[_0x01d9('0x31')]===_0x411e2e['id']){return _0x411e2e;}else{return db[_0x01d9('0x23')][_0x01d9('0x24')]({'where':{'id':_settings[_0x01d9('0x31')]}});}})[_0x01d9('0xe')](function(_0xa84480){if(!_0xa84480){throw new db[(_0x01d9('0x1d'))][(_0x01d9('0x1e'))](_0x01d9('0x34'));}if(!_0xa84480[_0x01d9('0xb')]||!_0xa84480[_0x01d9('0xc')]){throw new db['Sequelize'][(_0x01d9('0x1e'))](_0x01d9('0x35'));}_0x2895dd=_0xa84480;logger[_0x01d9('0x8')](util[_0x01d9('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0xf99df2['id']));return sentiment(_0x2895dd['data1'],_0x2895dd[_0x01d9('0xc')],_0x3c43c5['sentimentRegion'],_0xf99df2[_0x01d9('0x19')],_0x3c43c5[_0x01d9('0x21')]);})['then'](function(_0x35a8f2){logger[_0x01d9('0x8')](util[_0x01d9('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xf99df2['id']));return _0xf99df2['update']({'sentiment':_0x35a8f2[_0x01d9('0x27')],'sPositive':_0x35a8f2['SentimentScore'][_0x01d9('0x36')],'sNegative':_0x35a8f2[_0x01d9('0x28')][_0x01d9('0x29')],'sMixed':_0x35a8f2[_0x01d9('0x28')][_0x01d9('0x2a')],'sNeutral':_0x35a8f2[_0x01d9('0x28')][_0x01d9('0x2b')],'transcribeStatus':_0x01d9('0x12')});})[_0x01d9('0xe')](function(){logger[_0x01d9('0x8')](util['format'](_0x01d9('0x2c'),_0xf99df2['id']));_0x2325c5();});}})['catch'](function(_0x40f86c){if(_0x40f86c){if(!_0x40f86c[_0x01d9('0x37')]||_0x40f86c[_0x01d9('0x37')]!=='SequelizeValidationError'){logger[_0x01d9('0x38')](util['format'](_0x01d9('0x39'),_0xf99df2['id']),util[_0x01d9('0x3a')](_0x40f86c,{'showHidden':![],'depth':null}));}}_0x2325c5();});});}function checkTranscribe(){var _0x39a325;var _0x51ebf7;var _0x27cea2;return db[_0x01d9('0x3b')][_0x01d9('0x3c')]({'where':{'transcribeStatus':_0x01d9('0x3d')}})['then'](function(_0x80801b){if(!_0x80801b||!_0x80801b[_0x01d9('0x18')]){throw new db['Sequelize']['ValidationError'](_0x01d9('0x3e'));}_0x39a325=_0x80801b;return db[_0x01d9('0x3f')][_0x01d9('0x24')]({'where':{'id':0x1}});})['then'](function(_0x3e92cb){if(!_0x3e92cb){throw new db[(_0x01d9('0x1d'))][(_0x01d9('0x1e'))](_0x01d9('0x40'));}_0x51ebf7=_0x3e92cb;if(!_0x51ebf7[_0x01d9('0x4')]||!_0x51ebf7[_0x01d9('0x41')]||!_0x51ebf7['transcribeRegion']||!_0x51ebf7[_0x01d9('0x21')]||!_0x51ebf7['bucket']){throw new db['Sequelize'][(_0x01d9('0x1e'))](_0x01d9('0x42'));}return db['CloudProvider'][_0x01d9('0x24')]({'where':{'id':_0x51ebf7[_0x01d9('0x41')]}});})[_0x01d9('0xe')](function(_0x5a8595){if(!_0x5a8595){throw new db[(_0x01d9('0x1d'))]['ValidationError'](_0x01d9('0x34'));}if(!_0x5a8595[_0x01d9('0xb')]||!_0x5a8595[_0x01d9('0xc')]){throw new db[(_0x01d9('0x1d'))][(_0x01d9('0x1e'))](_0x01d9('0x35'));}_0x27cea2=_0x5a8595;var _0x1d6b41=[];_0x39a325[_0x01d9('0x43')](function(_0xe8cf19){_0x1d6b41[_0x01d9('0x44')](checkTranscribeJob(_0xe8cf19,_0x51ebf7,_0x27cea2));});return BPromise[_0x01d9('0x45')](_0x1d6b41);})[_0x01d9('0x46')](function(_0x576725){if(_0x576725){if(!_0x576725[_0x01d9('0x37')]||_0x576725[_0x01d9('0x37')]!==_0x01d9('0x47')){logger['error'](util['inspect'](_0x576725,{'showHidden':![],'depth':null}));}}});}exports[_0x01d9('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xfb71=['SequelizeValidationError','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','start','lodash','aws-sdk','request-promise','util','bluebird','transcribe','TranscribeService','getTranscriptionJob','substring','info','transcribeName','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','sentimentAccountId','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','COMPLETED','catch','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb71,0x1ef));var _0x1fb7=function(_0x5dbd48,_0x58ffc9){_0x5dbd48=_0x5dbd48-0x0;var _0x1f230a=_0xfb71[_0x5dbd48];return _0x1f230a;};var _=require(_0x1fb7('0x0'));var AWS=require(_0x1fb7('0x1'));var rp=require(_0x1fb7('0x2'));var util=require(_0x1fb7('0x3'));var BPromise=require(_0x1fb7('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x1fb7('0x5'));function getTranscriptionJob(_0x31aa32,_0x17a8d7,_0x4b9066,_0x45ed1c){return new Promise(function(_0x29532a,_0x2babe0){var _0x2112f8=new AWS[(_0x1fb7('0x6'))]({'accessKeyId':_0x17a8d7,'secretAccessKey':_0x31aa32,'region':_0x4b9066});_0x2112f8[_0x1fb7('0x7')]({'TranscriptionJobName':_0x45ed1c},function(_0x4abac2,_0x287b4a){if(_0x4abac2){return _0x2babe0(_0x4abac2);}else{return _0x29532a(_0x287b4a);}});});}function sentiment(_0x1a9e9e,_0x4e98ec,_0x968df9,_0x181677,_0xdc2350){return new Promise(function(_0x3ed2a3,_0x412503){var _0x437f79=new AWS['Comprehend']({'accessKeyId':_0x4e98ec,'secretAccessKey':_0x1a9e9e,'region':_0x968df9});_0x437f79['detectSentiment']({'Text':_0x181677,'LanguageCode':_0xdc2350[_0x1fb7('0x8')](0x0,0x2)},function(_0x2fde8d,_0x3d230c){if(_0x2fde8d){return _0x412503(_0x2fde8d);}else{return _0x3ed2a3(_0x3d230c);}});});}function checkTranscribeJob(_0x55f8ae,_0x49ac10,_0x195eb2){var _0x3cc07d;return new BPromise(function(_0x52ce28,_0x498776){logger[_0x1fb7('0x9')](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x55f8ae['id'],_0x55f8ae[_0x1fb7('0xa')]));return getTranscriptionJob(_0x195eb2['data1'],_0x195eb2[_0x1fb7('0xb')],_0x49ac10[_0x1fb7('0xc')],_0x55f8ae[_0x1fb7('0xa')])[_0x1fb7('0xd')](function(_0xf4c50f){logger[_0x1fb7('0x9')](util[_0x1fb7('0xe')](_0x1fb7('0xf'),_0x55f8ae['id'],_0x55f8ae[_0x1fb7('0xa')],_0xf4c50f['TranscriptionJob'][_0x1fb7('0x10')]));if(!_0x55f8ae[_0x1fb7('0x11')]){switch(_0xf4c50f[_0x1fb7('0x12')]['TranscriptionJobStatus']){case'COMPLETED':var _0xbb110c={'transcribeStatus':_0xf4c50f[_0x1fb7('0x12')][_0x1fb7('0x10')],'fileUri':_0xf4c50f[_0x1fb7('0x12')][_0x1fb7('0x13')]['TranscriptFileUri']};logger['info'](util[_0x1fb7('0xe')](_0x1fb7('0x14'),_0x55f8ae['id']));return rp({'uri':_0xf4c50f['TranscriptionJob'][_0x1fb7('0x13')][_0x1fb7('0x15')],'json':!![]})['then'](function(_0x5792d1){logger[_0x1fb7('0x9')](util[_0x1fb7('0xe')](_0x1fb7('0x16'),_0x55f8ae['id']));if(_0x5792d1&&_0x5792d1[_0x1fb7('0x17')]&&_0x5792d1[_0x1fb7('0x17')][_0x1fb7('0x18')]&&_0x5792d1[_0x1fb7('0x17')]['transcripts'][_0x1fb7('0x19')]){_0xbb110c[_0x1fb7('0x11')]='';for(var _0x538ac2=0x0;_0x538ac2<_0x5792d1[_0x1fb7('0x17')]['transcripts']['length'];_0x538ac2++){_0xbb110c[_0x1fb7('0x11')]+=_0x5792d1[_0x1fb7('0x17')][_0x1fb7('0x18')][_0x538ac2]['transcript']+'';}}return _0x55f8ae[_0x1fb7('0x1a')](_0xbb110c);})[_0x1fb7('0xd')](function(){logger[_0x1fb7('0x9')](util[_0x1fb7('0xe')](_0x1fb7('0x1b'),_0x55f8ae['id']));if(!_0x55f8ae[_0x1fb7('0x1c')]){throw new db[(_0x1fb7('0x1d'))][(_0x1fb7('0x1e'))](_0x1fb7('0x1f'));}if(!_0x49ac10[_0x1fb7('0x20')]||!_0x49ac10['sentimentAccountId']||!_0x49ac10[_0x1fb7('0x21')]||!_0x49ac10[_0x1fb7('0x22')]||!_0x49ac10[_0x1fb7('0x23')]){throw new db[(_0x1fb7('0x1d'))][(_0x1fb7('0x1e'))](_0x1fb7('0x24'));}if(!_0xbb110c['fileText']){throw new Error(_0x1fb7('0x25'));}if(_0x49ac10['sentimentAccountId']===_0x195eb2['id']){return _0x195eb2;}else{return db['CloudProvider'][_0x1fb7('0x26')]({'where':{'id':_settings[_0x1fb7('0x27')]}});}})[_0x1fb7('0xd')](function(_0x241573){if(!_0x241573){throw new db['Sequelize'][(_0x1fb7('0x1e'))](_0x1fb7('0x28'));}if(!_0x241573['data1']||!_0x241573[_0x1fb7('0xb')]){throw new db[(_0x1fb7('0x1d'))][(_0x1fb7('0x1e'))](_0x1fb7('0x29'));}_0x3cc07d=_0x241573;logger['info'](util[_0x1fb7('0xe')](_0x1fb7('0x2a'),_0x55f8ae['id']));return sentiment(_0x3cc07d[_0x1fb7('0x2b')],_0x3cc07d[_0x1fb7('0xb')],_0x49ac10[_0x1fb7('0x21')],_0xbb110c[_0x1fb7('0x11')],_0x49ac10[_0x1fb7('0x22')]);})[_0x1fb7('0xd')](function(_0x55c3dd){logger['info'](util[_0x1fb7('0xe')](_0x1fb7('0x2c'),_0x55f8ae['id']));return _0x55f8ae[_0x1fb7('0x1a')]({'sentiment':_0x55c3dd[_0x1fb7('0x2d')],'sPositive':_0x55c3dd[_0x1fb7('0x2e')][_0x1fb7('0x2f')],'sNegative':_0x55c3dd[_0x1fb7('0x2e')][_0x1fb7('0x30')],'sMixed':_0x55c3dd[_0x1fb7('0x2e')][_0x1fb7('0x31')],'sNeutral':_0x55c3dd[_0x1fb7('0x2e')][_0x1fb7('0x32')]});})[_0x1fb7('0xd')](function(){logger[_0x1fb7('0x9')](util[_0x1fb7('0xe')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x55f8ae['id']));_0x52ce28();});case _0x1fb7('0x33'):return _0x55f8ae[_0x1fb7('0x1a')]({'transcribeStatus':_0x1fb7('0x33'),'failureReason':_0xf4c50f[_0x1fb7('0x12')]['FailureReason']})[_0x1fb7('0xd')](function(){logger['info'](util[_0x1fb7('0xe')](_0x1fb7('0x1b'),_0x55f8ae['id']));_0x52ce28();});default:logger['info'](util[_0x1fb7('0xe')](_0x1fb7('0x34'),_0x55f8ae['id']));break;}}else{return BPromise[_0x1fb7('0x35')]()[_0x1fb7('0xd')](function(){if(!_0x55f8ae[_0x1fb7('0x1c')]){throw new db[(_0x1fb7('0x1d'))][(_0x1fb7('0x1e'))](_0x1fb7('0x1f'));}if(!_0x49ac10[_0x1fb7('0x20')]||!_0x49ac10[_0x1fb7('0x27')]||!_0x49ac10[_0x1fb7('0x21')]||!_0x49ac10[_0x1fb7('0x22')]||!_0x49ac10[_0x1fb7('0x23')]){throw new db[(_0x1fb7('0x1d'))][(_0x1fb7('0x1e'))](_0x1fb7('0x24'));}if(!_0x55f8ae['fileText']){throw new Error(_0x1fb7('0x25'));}if(_0x49ac10[_0x1fb7('0x27')]===_0x195eb2['id']){return _0x195eb2;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x1fb7('0x27')]}});}})[_0x1fb7('0xd')](function(_0x516431){if(!_0x516431){throw new db[(_0x1fb7('0x1d'))][(_0x1fb7('0x1e'))](_0x1fb7('0x28'));}if(!_0x516431['data1']||!_0x516431[_0x1fb7('0xb')]){throw new db[(_0x1fb7('0x1d'))][(_0x1fb7('0x1e'))](_0x1fb7('0x29'));}_0x3cc07d=_0x516431;logger[_0x1fb7('0x9')](util[_0x1fb7('0xe')](_0x1fb7('0x2a'),_0x55f8ae['id']));return sentiment(_0x3cc07d[_0x1fb7('0x2b')],_0x3cc07d[_0x1fb7('0xb')],_0x49ac10['sentimentRegion'],_0x55f8ae[_0x1fb7('0x11')],_0x49ac10[_0x1fb7('0x22')]);})[_0x1fb7('0xd')](function(_0x1e621d){logger['info'](util[_0x1fb7('0xe')](_0x1fb7('0x2c'),_0x55f8ae['id']));return _0x55f8ae[_0x1fb7('0x1a')]({'sentiment':_0x1e621d[_0x1fb7('0x2d')],'sPositive':_0x1e621d[_0x1fb7('0x2e')][_0x1fb7('0x2f')],'sNegative':_0x1e621d[_0x1fb7('0x2e')][_0x1fb7('0x30')],'sMixed':_0x1e621d['SentimentScore'][_0x1fb7('0x31')],'sNeutral':_0x1e621d[_0x1fb7('0x2e')][_0x1fb7('0x32')],'transcribeStatus':_0x1fb7('0x36')});})[_0x1fb7('0xd')](function(){logger[_0x1fb7('0x9')](util[_0x1fb7('0xe')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x55f8ae['id']));_0x52ce28();});}})[_0x1fb7('0x37')](function(_0x209d69){if(_0x209d69){if(!_0x209d69['name']||_0x209d69[_0x1fb7('0x38')]!==_0x1fb7('0x39')){logger['error'](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x55f8ae['id']),util[_0x1fb7('0x3a')](_0x209d69,{'showHidden':![],'depth':null}));}}_0x52ce28();});});}function checkTranscribe(){var _0x10f371;var _0x496726;var _0x368685;return db[_0x1fb7('0x3b')][_0x1fb7('0x3c')]({'where':{'transcribeStatus':_0x1fb7('0x3d')}})[_0x1fb7('0xd')](function(_0x438734){if(!_0x438734||!_0x438734[_0x1fb7('0x19')]){throw new db[(_0x1fb7('0x1d'))][(_0x1fb7('0x1e'))](_0x1fb7('0x3e'));}_0x10f371=_0x438734;return db['Setting'][_0x1fb7('0x26')]({'where':{'id':0x1}});})['then'](function(_0x5a233d){if(!_0x5a233d){throw new db[(_0x1fb7('0x1d'))][(_0x1fb7('0x1e'))](_0x1fb7('0x3f'));}_0x496726=_0x5a233d;if(!_0x496726['transcribe']||!_0x496726[_0x1fb7('0x40')]||!_0x496726[_0x1fb7('0xc')]||!_0x496726[_0x1fb7('0x22')]||!_0x496726['bucket']){throw new db[(_0x1fb7('0x1d'))][(_0x1fb7('0x1e'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x1fb7('0x26')]({'where':{'id':_0x496726['transcribeAccountId']}});})['then'](function(_0x9c5766){if(!_0x9c5766){throw new db[(_0x1fb7('0x1d'))][(_0x1fb7('0x1e'))](_0x1fb7('0x28'));}if(!_0x9c5766[_0x1fb7('0x2b')]||!_0x9c5766[_0x1fb7('0xb')]){throw new db[(_0x1fb7('0x1d'))]['ValidationError'](_0x1fb7('0x29'));}_0x368685=_0x9c5766;var _0x8aa405=[];_0x10f371[_0x1fb7('0x41')](function(_0x21f345){_0x8aa405[_0x1fb7('0x42')](checkTranscribeJob(_0x21f345,_0x496726,_0x368685));});return BPromise[_0x1fb7('0x43')](_0x8aa405);})[_0x1fb7('0x37')](function(_0x4dc26f){if(_0x4dc26f){if(!_0x4dc26f[_0x1fb7('0x38')]||_0x4dc26f[_0x1fb7('0x38')]!=='SequelizeValidationError'){logger['error'](util[_0x1fb7('0x3a')](_0x4dc26f,{'showHidden':![],'depth':null}));}}});}exports[_0x1fb7('0x44')]=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 8eb9aad..73819e0 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 _0x7110=['length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','info','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../config/environment','../logger','schedule','redis','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then'];(function(_0x55cb01,_0x28b6af){var _0x200824=function(_0x39bd5e){while(--_0x39bd5e){_0x55cb01['push'](_0x55cb01['shift']());}};_0x200824(++_0x28b6af);}(_0x7110,0xca));var _0x0711=function(_0x5f4ab3,_0x163769){_0x5f4ab3=_0x5f4ab3-0x0;var _0x398e16=_0x7110[_0x5f4ab3];return _0x398e16;};'use strict';var _=require(_0x0711('0x0'));var moment=require('moment');var Redis=require(_0x0711('0x1'));var util=require(_0x0711('0x2'));var config=require(_0x0711('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x0711('0x4'))(_0x0711('0x5'));config[_0x0711('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0711('0x7'))(new Redis(config[_0x0711('0x6')]));function closeInteractions(){var _0x16b818=[];return db[_0x0711('0x8')][_0x0711('0x9')]({'raw':!![],'attributes':['id',_0x0711('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x0711('0xb')](0x18,_0x0711('0xc'))}}})[_0x0711('0xd')](function(_0x3fa7f9){if(_0x3fa7f9&&_0x3fa7f9[_0x0711('0xe')]){_0x16b818=_[_0x0711('0xf')](_0x3fa7f9||[],'id');logger['info'](_0x0711('0x10'),_0x16b818[_0x0711('0x11')]());return db['WhatsappInteraction']['update']({'closeReason':_0x0711('0x12'),'disposition':_0x0711('0x13'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x16b818}});}})[_0x0711('0xd')](function(){if(_0x16b818&&_0x16b818[_0x0711('0xe')]){logger[_0x0711('0x14')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x16b818[_0x0711('0x11')]());for(var _0x4b4fc7=0x0;_0x4b4fc7<_0x16b818['length'];_0x4b4fc7++){io['emit'](_0x0711('0x15'),{'id':_0x16b818[_0x4b4fc7],'closed':!![]});}}})[_0x0711('0x16')](function(_0x4c3c67){logger[_0x0711('0x17')](_0x0711('0x18'),_0x4c3c67?util[_0x0711('0x19')](_0x4c3c67,{'showHidden':![],'depth':null}):'');});}exports[_0x0711('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3e6a=['../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','start','lodash','ioredis','util'];(function(_0x19f262,_0x4200ae){var _0x229347=function(_0x547120){while(--_0x547120){_0x19f262['push'](_0x19f262['shift']());}};_0x229347(++_0x4200ae);}(_0x3e6a,0x10b));var _0xa3e6=function(_0x4cc312,_0x277dc4){_0x4cc312=_0x4cc312-0x0;var _0x9bae7e=_0x3e6a[_0x4cc312];return _0x9bae7e;};'use strict';var _=require(_0xa3e6('0x0'));var moment=require('moment');var Redis=require(_0xa3e6('0x1'));var util=require(_0xa3e6('0x2'));var config=require('../../config/environment');var db=require(_0xa3e6('0x3'))['db'];var logger=require(_0xa3e6('0x4'))(_0xa3e6('0x5'));config['redis']=_[_0xa3e6('0x6')](config[_0xa3e6('0x7')],{'host':_0xa3e6('0x8'),'port':0x18eb});var io=require(_0xa3e6('0x9'))(new Redis(config[_0xa3e6('0x7')]));function closeInteractions(){var _0xd4c7a7=[];return db['WhatsappInteraction'][_0xa3e6('0xa')]({'raw':!![],'attributes':['id',_0xa3e6('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xa3e6('0xc')](0x18,_0xa3e6('0xd'))}}})[_0xa3e6('0xe')](function(_0xb09229){if(_0xb09229&&_0xb09229[_0xa3e6('0xf')]){_0xd4c7a7=_[_0xa3e6('0x10')](_0xb09229||[],'id');logger[_0xa3e6('0x11')](_0xa3e6('0x12'),_0xd4c7a7[_0xa3e6('0x13')]());return db['WhatsappInteraction'][_0xa3e6('0x14')]({'closeReason':_0xa3e6('0x15'),'disposition':_0xa3e6('0x16'),'closed':!![],'closedAt':moment()[_0xa3e6('0x17')](_0xa3e6('0x18'))},{'where':{'id':_0xd4c7a7}});}})[_0xa3e6('0xe')](function(){if(_0xd4c7a7&&_0xd4c7a7['length']){logger[_0xa3e6('0x11')](_0xa3e6('0x19'),_0xd4c7a7[_0xa3e6('0x13')]());for(var _0x24987b=0x0;_0x24987b<_0xd4c7a7[_0xa3e6('0xf')];_0x24987b++){io[_0xa3e6('0x1a')]('whatsappInteraction:update',{'id':_0xd4c7a7[_0x24987b],'closed':!![]});}}})[_0xa3e6('0x1b')](function(_0x46d084){logger[_0xa3e6('0x1c')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x46d084?util['inspect'](_0x46d084,{'showHidden':![],'depth':null}):'');});}exports[_0xa3e6('0x1d')]=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 fdbd9db..cb2dc36 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d86=['hopper2','catch','../mysqldb','push','Innocenzo','now','Biondo','@xcally.com','CmContact','destroy','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','hopper1'];(function(_0xe43485,_0x4a4b53){var _0x2b5baa=function(_0x4e0fbb){while(--_0x4e0fbb){_0xe43485['push'](_0xe43485['shift']());}};_0x2b5baa(++_0x4a4b53);}(_0x6d86,0x9b));var _0x66d8=function(_0x9349d8,_0x5c03bd){_0x9349d8=_0x9349d8-0x0;var _0xbce61a=_0x6d86[_0x9349d8];return _0xbce61a;};'use strict';var util=require('util');var db=require(_0x66d8('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x66d8('0x1')]({'id':i,'firstName':_0x66d8('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x66d8('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x66d8('0x3')](),'updatedAt':Date[_0x66d8('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x66d8('0x2')+i,'lastName':_0x66d8('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x66d8('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x66d8('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x66d8('0x3')]()});}db[_0x66d8('0x6')][_0x66d8('0x7')]({'where':{}})['then'](function(){return db[_0x66d8('0x6')][_0x66d8('0x8')](contacts);})[_0x66d8('0x9')](function(){console[_0x66d8('0xa')](_0x66d8('0xb'),_0x66d8('0xc'));return db[_0x66d8('0xd')][_0x66d8('0x7')]({'where':{}});})[_0x66d8('0x9')](function(){return db[_0x66d8('0xd')][_0x66d8('0x8')](hopper);})['then'](function(){console['log'](_0x66d8('0xb'),_0x66d8('0xe'));return db[_0x66d8('0x6')][_0x66d8('0x8')](contacts2);})['then'](function(){console[_0x66d8('0xa')](_0x66d8('0xb'),'contacts2');return db[_0x66d8('0xd')]['bulkCreate'](hopper2);})[_0x66d8('0x9')](function(){console[_0x66d8('0xa')](_0x66d8('0xb'),_0x66d8('0xf'));})[_0x66d8('0x10')](function(_0x101b5a){console[_0x66d8('0xa')](_0x101b5a);}); \ No newline at end of file +var _0xd433=['@xcally.com','now','CmContact','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo'];(function(_0x33a528,_0x216f14){var _0x168145=function(_0x169aac){while(--_0x169aac){_0x33a528['push'](_0x33a528['shift']());}};_0x168145(++_0x216f14);}(_0xd433,0xa5));var _0x3d43=function(_0x2653df,_0x202e0c){_0x2653df=_0x2653df-0x0;var _0x527b3f=_0xd433[_0x2653df];return _0x527b3f;};'use strict';var util=require(_0x3d43('0x0'));var db=require(_0x3d43('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x3d43('0x2')]({'id':i,'firstName':_0x3d43('0x3')+i,'lastName':_0x3d43('0x4')+i,'phone':0xf879fb460+i,'email':_0x3d43('0x5')+i+_0x3d43('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x3d43('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x3d43('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x3d43('0x4')+i,'phone':0xf879fb460+i,'email':_0x3d43('0x5')+i+_0x3d43('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x3d43('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x3d43('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3d43('0x7')](),'updatedAt':Date[_0x3d43('0x7')]()});}db[_0x3d43('0x8')]['destroy']({'where':{}})['then'](function(){return db[_0x3d43('0x8')]['bulkCreate'](contacts);})[_0x3d43('0x9')](function(){console[_0x3d43('0xa')](_0x3d43('0xb'),_0x3d43('0xc'));return db[_0x3d43('0xd')]['destroy']({'where':{}});})['then'](function(){return db['CmHopper'][_0x3d43('0xe')](hopper);})['then'](function(){console[_0x3d43('0xa')](_0x3d43('0xb'),_0x3d43('0xf'));return db[_0x3d43('0x8')]['bulkCreate'](contacts2);})[_0x3d43('0x9')](function(){console[_0x3d43('0xa')]('finished\x20populating',_0x3d43('0x10'));return db[_0x3d43('0xd')]['bulkCreate'](hopper2);})[_0x3d43('0x9')](function(){console[_0x3d43('0xa')](_0x3d43('0xb'),_0x3d43('0x11'));})[_0x3d43('0x12')](function(_0x27c319){console[_0x3d43('0xa')](_0x27c319);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 3ea7626..d38f209 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf807=['actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x1fa183,_0x4c9162){var _0x1bff33=function(_0x45a949){while(--_0x45a949){_0x1fa183['push'](_0x1fa183['shift']());}};_0x1bff33(++_0x4c9162);}(_0xf807,0x92));var _0x7f80=function(_0x3ba2a3,_0x34d0ba){_0x3ba2a3=_0x3ba2a3-0x0;var _0x2d0e38=_0xf807[_0x3ba2a3];return _0x2d0e38;};'use strict';var util=require(_0x7f80('0x0'));var db=require(_0x7f80('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x7f80('0x2')]({'name':util[_0x7f80('0x3')](_0x7f80('0x4'),_0x7f80('0x5'),i),'fullname':util['format'](_0x7f80('0x4'),_0x7f80('0x5'),i),'email':util[_0x7f80('0x3')](_0x7f80('0x6'),_0x7f80('0x5'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0x7f80('0x7'),'transport':[_0x7f80('0x8'),'ws',_0x7f80('0x9')],'disallow':[_0x7f80('0xa')],'allow':[_0x7f80('0xb')],'defaultuser':util[_0x7f80('0x3')]('%s%s','agent',i),'encryption':_0x7f80('0xc'),'avpf':_0x7f80('0xc'),'force_avp':_0x7f80('0xc'),'icesupport':_0x7f80('0xc'),'dtlsenable':_0x7f80('0xc'),'dtlsverify':'no','dtlscertfile':_0x7f80('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x7f80('0xe'),'callerid':util[_0x7f80('0x3')](_0x7f80('0xf'),util['format'](_0x7f80('0x4'),_0x7f80('0x5'),i),0xfa0+i)});}db[_0x7f80('0x10')]['bulkCreate'](users)[_0x7f80('0x11')](function(){console[_0x7f80('0x12')](_0x7f80('0x13'));})['catch'](function(_0x2ad04e){console[_0x7f80('0x12')](_0x2ad04e);}); \ No newline at end of file +var _0x9f3e=['wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x9f3e,0x14f));var _0xe9f3=function(_0x4a5bdc,_0x5c9bf1){_0x4a5bdc=_0x4a5bdc-0x0;var _0x2fccda=_0x9f3e[_0x4a5bdc];return _0x2fccda;};'use strict';var util=require(_0xe9f3('0x0'));var db=require(_0xe9f3('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xe9f3('0x2')]({'name':util[_0xe9f3('0x3')](_0xe9f3('0x4'),_0xe9f3('0x5'),i),'fullname':util[_0xe9f3('0x3')](_0xe9f3('0x4'),'agent',i),'email':util[_0xe9f3('0x3')](_0xe9f3('0x6'),_0xe9f3('0x5'),i),'role':_0xe9f3('0x5'),'password':'password','internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0xe9f3('0x7')],'disallow':[_0xe9f3('0x8')],'allow':[_0xe9f3('0x9')],'defaultuser':util[_0xe9f3('0x3')](_0xe9f3('0x4'),_0xe9f3('0x5'),i),'encryption':'yes','avpf':_0xe9f3('0xa'),'force_avp':_0xe9f3('0xa'),'icesupport':'yes','dtlsenable':_0xe9f3('0xa'),'dtlsverify':'no','dtlscertfile':_0xe9f3('0xb'),'dtlsprivatekey':_0xe9f3('0xc'),'dtlssetup':'actpass','callerid':util[_0xe9f3('0x3')]('\x22%s\x22\x20<%s>',util[_0xe9f3('0x3')]('%s%s','agent',i),0xfa0+i)});}db[_0xe9f3('0xd')][_0xe9f3('0xe')](users)[_0xe9f3('0xf')](function(){console[_0xe9f3('0x10')](_0xe9f3('0x11'));})[_0xe9f3('0x12')](function(_0x1adbf9){console['log'](_0x1adbf9);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index cba5936..4c2043d 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83de=['VoiceQueues','FaxQueues','SmsQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','then','map','resourceId','where','Campaign','format','%s:queue:%s','length','user:%s','query','find','role','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','hasOwnProperty','include','VoiceQueue','push','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:outbound','ChatQueues','userProfileId','ChatQueue','MailQueues','MailQueue','agent','getChatQueues','getSmsQueues','getWhatsappQueues','all','voice','chat','mail','whatsapp','telephone:%s','trunk:%s','leave','user_has_chat_interactions:remove','emit','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','../mysqldb','./environment','Agents','User','name','telephone','type','ivr','autoAssociation'];(function(_0x13ae3b,_0x4ddd7c){var _0x145764=function(_0x4ab5e0){while(--_0x4ab5e0){_0x13ae3b['push'](_0x13ae3b['shift']());}};_0x145764(++_0x4ddd7c);}(_0x83de,0x116));var _0xe83d=function(_0x3eb81c,_0x19cfb3){_0x3eb81c=_0x3eb81c-0x0;var _0x2f8166=_0x83de[_0x3eb81c];return _0x2f8166;};'use strict';var _=require('lodash');var util=require(_0xe83d('0x0'));var BPromise=require('bluebird');var db=require(_0xe83d('0x1'))['db'];var config=require(_0xe83d('0x2'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xe83d('0x3'),'model':db[_0xe83d('0x4')],'attributes':['id',_0xe83d('0x5'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xe83d('0x5')],'where':{'role':_0xe83d('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0xe83d('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xe83d('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xe83d('0x7')],'where':{'type':_0xe83d('0x8')}};function getAssociatedResources(_0xa747c0,_0x4d2aa0,_0x1527f5){return db['UserProfileSection']['findOne']({'where':{'name':_0xa747c0,'userProfileId':_0x4d2aa0},'raw':!![]})['then'](function(_0x34dd26){if(_0x34dd26){if(_0x34dd26[_0xe83d('0x9')]){switch(_0xa747c0){case _0xe83d('0xa'):case'ChatQueues':case _0xe83d('0xb'):case _0xe83d('0xc'):case'MailQueues':case _0xe83d('0xd'):case'WhatsappQueues':return db[_0x1527f5][_0xe83d('0xe')](queryQueues);case _0xe83d('0xf'):return db[_0x1527f5][_0xe83d('0xe')](queryTelephones);case _0xe83d('0x10'):return db[_0x1527f5][_0xe83d('0xe')](queryTrunks);case _0xe83d('0x11'):return db[_0x1527f5][_0xe83d('0xe')](queryCampaigns);}}else{return db[_0xe83d('0x12')][_0xe83d('0xe')]({'attributes':['resourceId'],'where':{'sectionId':_0x34dd26['id']},'raw':!![]})[_0xe83d('0x13')](function(_0x4c707d){if(_0x4c707d){var _0x36487e={'where':{'id':_[_0xe83d('0x14')](_0x4c707d,_0xe83d('0x15'))},'raw':!![]};switch(_0x1527f5){case _0xe83d('0x4'):_0x36487e[_0xe83d('0x16')]['role']=_0xe83d('0x6');break;case _0xe83d('0x17'):_0x36487e[_0xe83d('0x16')][_0xe83d('0x7')]=_0xe83d('0x8');break;}return db[_0x1527f5][_0xe83d('0xe')](_0x36487e);}else{return[];}});}}else{return[];}})[_0xe83d('0x13')](function(_0x550f4f){return _0x550f4f;});}function joinOrLeaveQueues(_0xb2f3c3,_0x3e3dc1,_0x576a8d,_0x250b41){_0xb2f3c3[_0x3e3dc1](util[_0xe83d('0x18')](_0xe83d('0x19'),_0x576a8d,_0x250b41['name']));if(_0x250b41['Agents']){for(var _0xb4b46e=0x0;_0xb4b46e<_0x250b41[_0xe83d('0x3')][_0xe83d('0x1a')];_0xb4b46e+=0x1){_0xb2f3c3[_0x3e3dc1](util[_0xe83d('0x18')](_0xe83d('0x1b'),_0x250b41['Agents'][_0xb4b46e][_0xe83d('0x5')]));}}}function joinOrLeave(_0x12bcbf,_0x254551,_0x4ea9eb){var _0x1dff3f;if(_0x12bcbf['handshake'][_0xe83d('0x1c')]['id']){db[_0xe83d('0x4')][_0xe83d('0x1d')]({'attributes':['id',_0xe83d('0x5'),_0xe83d('0x1e'),'userProfileId'],'where':{'id':_0x12bcbf['handshake']['query']['id']},'include':[{'model':db[_0xe83d('0x1f')],'as':_0xe83d('0x20'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xe83d('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xe83d('0x22')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe83d('0x23')],'as':_0xe83d('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xe83d('0x25')],'as':_0xe83d('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xe83d('0x27')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x2afbab){if(_0x2afbab){_0x1dff3f=_0x2afbab;_0x12bcbf[_0x254551](util[_0xe83d('0x18')](_0xe83d('0x1b'),_0x2afbab[_0xe83d('0x5')]));var _0x4083b0=[];switch(_0x2afbab[_0xe83d('0x1e')]){case _0xe83d('0x28'):_0x12bcbf[_0x254551](_0xe83d('0x29'));_0x12bcbf[_0x254551]('voice:outbound');if(queryQueues[_0xe83d('0x2a')](_0xe83d('0x2b'))){delete queryQueues['include'];}_0x4083b0['push'](db[_0xe83d('0x2c')][_0xe83d('0xe')](queryQueues));_0x4083b0[_0xe83d('0x2d')](db['ChatQueue'][_0xe83d('0xe')](queryQueues));_0x4083b0[_0xe83d('0x2d')](db[_0xe83d('0x2e')]['findAll'](queryQueues));_0x4083b0[_0xe83d('0x2d')](db[_0xe83d('0x2f')][_0xe83d('0xe')](queryQueues));_0x4083b0['push'](db['MailQueue'][_0xe83d('0xe')](queryQueues));_0x4083b0[_0xe83d('0x2d')](db[_0xe83d('0x30')][_0xe83d('0xe')](queryQueues));_0x4083b0[_0xe83d('0x2d')](db[_0xe83d('0x31')][_0xe83d('0xe')](queryQueues));_0x4083b0[_0xe83d('0x2d')](db['User'][_0xe83d('0xe')](queryTelephones));_0x4083b0[_0xe83d('0x2d')](db[_0xe83d('0x32')][_0xe83d('0xe')](queryTrunks));_0x4083b0[_0xe83d('0x2d')](db['Campaign'][_0xe83d('0xe')](queryCampaigns));_0x4083b0['push'](db[_0xe83d('0x4')][_0xe83d('0xe')](queryAgents));break;case _0xe83d('0x33'):_0x12bcbf[_0x254551]('voice:inbound');_0x12bcbf[_0x254551](_0xe83d('0x34'));_0x4083b0['push'](getAssociatedResources(_0xe83d('0xa'),_0x2afbab['userProfileId'],_0xe83d('0x2c')));_0x4083b0[_0xe83d('0x2d')](getAssociatedResources(_0xe83d('0x35'),_0x2afbab[_0xe83d('0x36')],_0xe83d('0x37')));_0x4083b0[_0xe83d('0x2d')](getAssociatedResources('FaxQueues',_0x2afbab['userProfileId'],'FaxQueue'));_0x4083b0[_0xe83d('0x2d')](getAssociatedResources(_0xe83d('0xc'),_0x2afbab[_0xe83d('0x36')],_0xe83d('0x2f')));_0x4083b0['push'](getAssociatedResources(_0xe83d('0x38'),_0x2afbab[_0xe83d('0x36')],_0xe83d('0x39')));_0x4083b0[_0xe83d('0x2d')](getAssociatedResources(_0xe83d('0xd'),_0x2afbab[_0xe83d('0x36')],'OpenchannelQueue'));_0x4083b0[_0xe83d('0x2d')](getAssociatedResources('WhatsappQueues',_0x2afbab[_0xe83d('0x36')],_0xe83d('0x31')));_0x4083b0['push'](getAssociatedResources(_0xe83d('0xf'),_0x2afbab[_0xe83d('0x36')],'User'));_0x4083b0['push'](getAssociatedResources(_0xe83d('0x10'),_0x2afbab[_0xe83d('0x36')],_0xe83d('0x32')));_0x4083b0[_0xe83d('0x2d')](getAssociatedResources(_0xe83d('0x11'),_0x2afbab[_0xe83d('0x36')],_0xe83d('0x17')));_0x4083b0['push'](db[_0xe83d('0x4')]['findAll'](queryAgents));break;case _0xe83d('0x3a'):_0x12bcbf[_0x254551]('voice:inbound');_0x12bcbf[_0x254551](_0xe83d('0x34'));_0x4083b0[_0xe83d('0x2d')](_0x2afbab['getVoiceQueues']({'attributes':['id',_0xe83d('0x5')]}));_0x4083b0['push'](_0x2afbab[_0xe83d('0x3b')]({'attributes':['id',_0xe83d('0x5')]}));_0x4083b0[_0xe83d('0x2d')](_0x2afbab['getFaxQueues']({'attributes':['id','name']}));_0x4083b0[_0xe83d('0x2d')](_0x2afbab[_0xe83d('0x3c')]({'attributes':['id',_0xe83d('0x5')]}));_0x4083b0[_0xe83d('0x2d')](_0x2afbab['getMailQueues']({'attributes':['id',_0xe83d('0x5')]}));_0x4083b0[_0xe83d('0x2d')](_0x2afbab['getOpenchannelQueues']({'attributes':['id','name']}));_0x4083b0[_0xe83d('0x2d')](_0x2afbab[_0xe83d('0x3d')]({'attributes':['id',_0xe83d('0x5')]}));break;}return BPromise[_0xe83d('0x3e')](_0x4083b0);}})[_0xe83d('0x13')](function(_0xed190b){if(_0xed190b&&_0xed190b[_0xe83d('0x1a')]){for(var _0x5ca1de=0x0;_0x5ca1de<_0xed190b[_0xe83d('0x1a')];_0x5ca1de+=0x1){for(var _0x1725c3=0x0;_0x1725c3<_0xed190b[_0x5ca1de][_0xe83d('0x1a')];_0x1725c3+=0x1){switch(_0x5ca1de){case 0x0:joinOrLeaveQueues(_0x12bcbf,_0x254551,_0xe83d('0x3f'),_0xed190b[_0x5ca1de][_0x1725c3]);break;case 0x1:joinOrLeaveQueues(_0x12bcbf,_0x254551,_0xe83d('0x40'),_0xed190b[_0x5ca1de][_0x1725c3]);break;case 0x2:joinOrLeaveQueues(_0x12bcbf,_0x254551,'fax',_0xed190b[_0x5ca1de][_0x1725c3]);break;case 0x3:joinOrLeaveQueues(_0x12bcbf,_0x254551,'sms',_0xed190b[_0x5ca1de][_0x1725c3]);break;case 0x4:joinOrLeaveQueues(_0x12bcbf,_0x254551,_0xe83d('0x41'),_0xed190b[_0x5ca1de][_0x1725c3]);break;case 0x5:joinOrLeaveQueues(_0x12bcbf,_0x254551,'openchannel',_0xed190b[_0x5ca1de][_0x1725c3]);break;case 0x6:joinOrLeaveQueues(_0x12bcbf,_0x254551,_0xe83d('0x42'),_0xed190b[_0x5ca1de][_0x1725c3]);break;case 0x7:if(_0x1dff3f[_0xe83d('0x1e')]!==_0xe83d('0x3a'))_0x12bcbf[_0x254551](util['format'](_0xe83d('0x43'),_0xed190b[_0x5ca1de][_0x1725c3][_0xe83d('0x5')]));break;case 0x8:if(_0x1dff3f[_0xe83d('0x1e')]!==_0xe83d('0x3a'))_0x12bcbf[_0x254551](util[_0xe83d('0x18')](_0xe83d('0x44'),_0xed190b[_0x5ca1de][_0x1725c3]['name']));break;case 0x9:if(_0x1dff3f['role']!==_0xe83d('0x3a'))_0x12bcbf[_0x254551](util['format']('campaign:%s:%s',_0xed190b[_0x5ca1de][_0x1725c3][_0xe83d('0x7')],_0xed190b[_0x5ca1de][_0x1725c3][_0xe83d('0x5')]));break;case 0xa:_0x12bcbf[_0x254551](util[_0xe83d('0x18')](_0xe83d('0x1b'),_0xed190b[_0x5ca1de][_0x1725c3][_0xe83d('0x5')]));break;}}}}})[_0xe83d('0x13')](function(){if(_0x254551===_0xe83d('0x45')){var _0x89dcb7=_[_0xe83d('0x14')](_0x1dff3f[_0xe83d('0x20')],'id');return _0x1dff3f['removeChatInteractions'](_0x89dcb7)[_0xe83d('0x13')](function(){for(var _0x22fb6b=0x0;_0x22fb6b<_0x89dcb7[_0xe83d('0x1a')];_0x22fb6b+=0x1){_0x4ea9eb['emit'](_0xe83d('0x46'),{'ChatInteractionId':Number(_0x89dcb7[_0x22fb6b]),'UserId':Number(_0x1dff3f['id'])});}});}})[_0xe83d('0x13')](function(){if(_0x254551==='leave'){var _0x1ad5d2=_[_0xe83d('0x14')](_0x1dff3f[_0xe83d('0x21')],'id');return _0x1dff3f['removeMailInteractions'](_0x1ad5d2)[_0xe83d('0x13')](function(){for(var _0x48fe0c=0x0;_0x48fe0c<_0x1ad5d2['length'];_0x48fe0c+=0x1){_0x4ea9eb[_0xe83d('0x47')](_0xe83d('0x48'),{'MailInteractionId':Number(_0x1ad5d2[_0x48fe0c]),'UserId':Number(_0x1dff3f['id'])});}});}})['then'](function(){if(_0x254551===_0xe83d('0x45')){var _0x382338=_[_0xe83d('0x14')](_0x1dff3f[_0xe83d('0x49')],'id');return _0x1dff3f[_0xe83d('0x4a')](_0x382338)[_0xe83d('0x13')](function(){for(var _0x256a5f=0x0;_0x256a5f<_0x382338[_0xe83d('0x1a')];_0x256a5f+=0x1){_0x4ea9eb[_0xe83d('0x47')](_0xe83d('0x4b'),{'FaxInteractionId':Number(_0x382338[_0x256a5f]),'UserId':Number(_0x1dff3f['id'])});}});}})[_0xe83d('0x13')](function(){if(_0x254551===_0xe83d('0x45')){var _0x5add88=_[_0xe83d('0x14')](_0x1dff3f['SmsInteractions'],'id');return _0x1dff3f[_0xe83d('0x4c')](_0x5add88)[_0xe83d('0x13')](function(){for(var _0x55cd45=0x0;_0x55cd45<_0x5add88['length'];_0x55cd45+=0x1){_0x4ea9eb['emit'](_0xe83d('0x4d'),{'SmsInteractionId':Number(_0x5add88[_0x55cd45]),'UserId':Number(_0x1dff3f['id'])});}});}})[_0xe83d('0x13')](function(){if(_0x254551===_0xe83d('0x45')){var _0x4b850c=_['map'](_0x1dff3f['OpenchannelInteractions'],'id');return _0x1dff3f[_0xe83d('0x4e')](_0x4b850c)[_0xe83d('0x13')](function(){for(var _0x173cab=0x0;_0x173cab<_0x4b850c[_0xe83d('0x1a')];_0x173cab+=0x1){_0x4ea9eb[_0xe83d('0x47')](_0xe83d('0x4f'),{'OpenchannelInteractionId':Number(_0x4b850c[_0x173cab]),'UserId':Number(_0x1dff3f['id'])});}});}})[_0xe83d('0x13')](function(){if(_0x254551==='leave'){var _0x165056=_[_0xe83d('0x14')](_0x1dff3f['WhatsappInteractions'],'id');return _0x1dff3f[_0xe83d('0x50')](_0x165056)['then'](function(){for(var _0x48c6b3=0x0;_0x48c6b3<_0x165056[_0xe83d('0x1a')];_0x48c6b3+=0x1){_0x4ea9eb[_0xe83d('0x47')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x165056[_0x48c6b3]),'UserId':Number(_0x1dff3f['id'])});}});}})[_0xe83d('0x51')](function(_0x5da6f4){_0x12bcbf[_0xe83d('0x52')](_0x5da6f4);});}}function onDisconnect(_0x5d98fe,_0x20021f){joinOrLeave(_0x5d98fe,_0xe83d('0x45'),_0x20021f);}function onConnect(_0x3f7e85){joinOrLeave(_0x3f7e85,_0xe83d('0x53'));}exports[_0xe83d('0x54')]=function(_0x3dc356){_0x3dc356['on'](_0xe83d('0x55'),function(_0x532879){_0x532879['setMaxListeners'](0x0);_0x532879[_0xe83d('0x56')]=_0x532879[_0xe83d('0x57')]['connection'][_0xe83d('0x58')]+':'+_0x532879[_0xe83d('0x57')][_0xe83d('0x55')][_0xe83d('0x59')];_0x532879[_0xe83d('0x5a')]=new Date();_0x532879[_0xe83d('0x52')]=function(_0xb58079){console[_0xe83d('0x52')](_0xe83d('0x5b')+_0x532879[_0xe83d('0x5c')][_0xe83d('0x5')]+'['+_0x532879[_0xe83d('0x56')]+']',_0xb58079);};_0x532879['on'](_0xe83d('0x5d'),function(){onDisconnect(_0x532879,_0x3dc356);_0x532879[_0xe83d('0x52')](_0xe83d('0x5e'));});onConnect(_0x532879);_0x532879[_0xe83d('0x52')](_0xe83d('0x5f'));});}; \ No newline at end of file +var _0xf08c=['autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','UserProfileResource','resourceId','map','telephone','Campaign','type','ivr','format','user:%s','handshake','find','role','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueue','FaxQueue','Trunks','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','request','remoteAddress','remotePort','SocketIO\x20','nsp','address','DISCONNECTED','lodash','util','bluebird','./environment','name','Agents','User','agent','UserProfileSection','findOne','then'];(function(_0x220c36,_0x482808){var _0x1bb87b=function(_0x5d639f){while(--_0x5d639f){_0x220c36['push'](_0x220c36['shift']());}};_0x1bb87b(++_0x482808);}(_0xf08c,0xb5));var _0xcf08=function(_0x5b7398,_0x3ae190){_0x5b7398=_0x5b7398-0x0;var _0x505eb5=_0xf08c[_0x5b7398];return _0x505eb5;};'use strict';var _=require(_0xcf08('0x0'));var util=require(_0xcf08('0x1'));var BPromise=require(_0xcf08('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xcf08('0x3'));var queryQueues={'attributes':['id',_0xcf08('0x4')],'include':[{'as':_0xcf08('0x5'),'model':db[_0xcf08('0x6')],'attributes':['id','name','role'],'raw':!![],'where':{'role':_0xcf08('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xcf08('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xcf08('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xcf08('0x4')],'where':{'role':_0xcf08('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xcf08('0x4'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x312188,_0x57cad4,_0x1ab45d){return db[_0xcf08('0x8')][_0xcf08('0x9')]({'where':{'name':_0x312188,'userProfileId':_0x57cad4},'raw':!![]})[_0xcf08('0xa')](function(_0x5aae0b){if(_0x5aae0b){if(_0x5aae0b[_0xcf08('0xb')]){switch(_0x312188){case _0xcf08('0xc'):case _0xcf08('0xd'):case _0xcf08('0xe'):case _0xcf08('0xf'):case _0xcf08('0x10'):case _0xcf08('0x11'):case _0xcf08('0x12'):return db[_0x1ab45d][_0xcf08('0x13')](queryQueues);case _0xcf08('0x14'):return db[_0x1ab45d][_0xcf08('0x13')](queryTelephones);case'Trunks':return db[_0x1ab45d]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x1ab45d][_0xcf08('0x13')](queryCampaigns);}}else{return db[_0xcf08('0x15')]['findAll']({'attributes':[_0xcf08('0x16')],'where':{'sectionId':_0x5aae0b['id']},'raw':!![]})[_0xcf08('0xa')](function(_0x8c9d32){if(_0x8c9d32){var _0x2b0135={'where':{'id':_[_0xcf08('0x17')](_0x8c9d32,'resourceId')},'raw':!![]};switch(_0x1ab45d){case _0xcf08('0x6'):_0x2b0135['where']['role']=_0xcf08('0x18');break;case _0xcf08('0x19'):_0x2b0135['where'][_0xcf08('0x1a')]=_0xcf08('0x1b');break;}return db[_0x1ab45d][_0xcf08('0x13')](_0x2b0135);}else{return[];}});}}else{return[];}})[_0xcf08('0xa')](function(_0x2450c9){return _0x2450c9;});}function joinOrLeaveQueues(_0x3b9a4b,_0x5f03e1,_0x386fe3,_0x2f9899){_0x3b9a4b[_0x5f03e1](util[_0xcf08('0x1c')]('%s:queue:%s',_0x386fe3,_0x2f9899[_0xcf08('0x4')]));if(_0x2f9899['Agents']){for(var _0x633937=0x0;_0x633937<_0x2f9899[_0xcf08('0x5')]['length'];_0x633937+=0x1){_0x3b9a4b[_0x5f03e1](util[_0xcf08('0x1c')](_0xcf08('0x1d'),_0x2f9899[_0xcf08('0x5')][_0x633937][_0xcf08('0x4')]));}}}function joinOrLeave(_0x4dd1f0,_0x31aceb,_0x208f1d){var _0x52968a;if(_0x4dd1f0[_0xcf08('0x1e')]['query']['id']){db[_0xcf08('0x6')][_0xcf08('0x1f')]({'attributes':['id','name',_0xcf08('0x20'),_0xcf08('0x21')],'where':{'id':_0x4dd1f0[_0xcf08('0x1e')][_0xcf08('0x22')]['id']},'include':[{'model':db[_0xcf08('0x23')],'as':_0xcf08('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xcf08('0x25')],'as':_0xcf08('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xcf08('0x27')],'as':_0xcf08('0x28'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xcf08('0x29')],'as':_0xcf08('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xcf08('0x2b'),'attributes':['id'],'raw':!![]}]})[_0xcf08('0xa')](function(_0x347835){if(_0x347835){_0x52968a=_0x347835;_0x4dd1f0[_0x31aceb](util[_0xcf08('0x1c')](_0xcf08('0x1d'),_0x347835[_0xcf08('0x4')]));var _0x5753f7=[];switch(_0x347835[_0xcf08('0x20')]){case _0xcf08('0x2c'):_0x4dd1f0[_0x31aceb](_0xcf08('0x2d'));_0x4dd1f0[_0x31aceb](_0xcf08('0x2e'));if(queryQueues[_0xcf08('0x2f')](_0xcf08('0x30'))){delete queryQueues[_0xcf08('0x30')];}_0x5753f7[_0xcf08('0x31')](db['VoiceQueue'][_0xcf08('0x13')](queryQueues));_0x5753f7['push'](db['ChatQueue'][_0xcf08('0x13')](queryQueues));_0x5753f7['push'](db['FaxQueue']['findAll'](queryQueues));_0x5753f7[_0xcf08('0x31')](db[_0xcf08('0x32')][_0xcf08('0x13')](queryQueues));_0x5753f7['push'](db['MailQueue'][_0xcf08('0x13')](queryQueues));_0x5753f7[_0xcf08('0x31')](db[_0xcf08('0x33')][_0xcf08('0x13')](queryQueues));_0x5753f7[_0xcf08('0x31')](db[_0xcf08('0x34')][_0xcf08('0x13')](queryQueues));_0x5753f7['push'](db[_0xcf08('0x6')]['findAll'](queryTelephones));_0x5753f7[_0xcf08('0x31')](db[_0xcf08('0x35')]['findAll'](queryTrunks));_0x5753f7[_0xcf08('0x31')](db[_0xcf08('0x19')][_0xcf08('0x13')](queryCampaigns));_0x5753f7['push'](db['User'][_0xcf08('0x13')](queryAgents));break;case _0xcf08('0x36'):_0x4dd1f0[_0x31aceb](_0xcf08('0x2d'));_0x4dd1f0[_0x31aceb](_0xcf08('0x2e'));_0x5753f7[_0xcf08('0x31')](getAssociatedResources(_0xcf08('0xc'),_0x347835[_0xcf08('0x21')],_0xcf08('0x37')));_0x5753f7[_0xcf08('0x31')](getAssociatedResources(_0xcf08('0xd'),_0x347835['userProfileId'],'ChatQueue'));_0x5753f7[_0xcf08('0x31')](getAssociatedResources(_0xcf08('0xe'),_0x347835[_0xcf08('0x21')],_0xcf08('0x38')));_0x5753f7[_0xcf08('0x31')](getAssociatedResources(_0xcf08('0xf'),_0x347835[_0xcf08('0x21')],_0xcf08('0x32')));_0x5753f7['push'](getAssociatedResources(_0xcf08('0x10'),_0x347835[_0xcf08('0x21')],'MailQueue'));_0x5753f7[_0xcf08('0x31')](getAssociatedResources('OpenchannelQueues',_0x347835[_0xcf08('0x21')],_0xcf08('0x33')));_0x5753f7[_0xcf08('0x31')](getAssociatedResources(_0xcf08('0x12'),_0x347835[_0xcf08('0x21')],_0xcf08('0x34')));_0x5753f7[_0xcf08('0x31')](getAssociatedResources(_0xcf08('0x14'),_0x347835['userProfileId'],_0xcf08('0x6')));_0x5753f7[_0xcf08('0x31')](getAssociatedResources(_0xcf08('0x39'),_0x347835['userProfileId'],'Trunk'));_0x5753f7[_0xcf08('0x31')](getAssociatedResources(_0xcf08('0x3a'),_0x347835[_0xcf08('0x21')],_0xcf08('0x19')));_0x5753f7['push'](db[_0xcf08('0x6')]['findAll'](queryAgents));break;case _0xcf08('0x7'):_0x4dd1f0[_0x31aceb](_0xcf08('0x2d'));_0x4dd1f0[_0x31aceb](_0xcf08('0x2e'));_0x5753f7['push'](_0x347835[_0xcf08('0x3b')]({'attributes':['id',_0xcf08('0x4')]}));_0x5753f7[_0xcf08('0x31')](_0x347835[_0xcf08('0x3c')]({'attributes':['id',_0xcf08('0x4')]}));_0x5753f7[_0xcf08('0x31')](_0x347835[_0xcf08('0x3d')]({'attributes':['id',_0xcf08('0x4')]}));_0x5753f7[_0xcf08('0x31')](_0x347835['getSmsQueues']({'attributes':['id',_0xcf08('0x4')]}));_0x5753f7[_0xcf08('0x31')](_0x347835[_0xcf08('0x3e')]({'attributes':['id',_0xcf08('0x4')]}));_0x5753f7[_0xcf08('0x31')](_0x347835['getOpenchannelQueues']({'attributes':['id',_0xcf08('0x4')]}));_0x5753f7[_0xcf08('0x31')](_0x347835[_0xcf08('0x3f')]({'attributes':['id',_0xcf08('0x4')]}));break;}return BPromise[_0xcf08('0x40')](_0x5753f7);}})[_0xcf08('0xa')](function(_0x3ebdfd){if(_0x3ebdfd&&_0x3ebdfd[_0xcf08('0x41')]){for(var _0x1e8551=0x0;_0x1e8551<_0x3ebdfd[_0xcf08('0x41')];_0x1e8551+=0x1){for(var _0x1eb437=0x0;_0x1eb437<_0x3ebdfd[_0x1e8551][_0xcf08('0x41')];_0x1eb437+=0x1){switch(_0x1e8551){case 0x0:joinOrLeaveQueues(_0x4dd1f0,_0x31aceb,_0xcf08('0x42'),_0x3ebdfd[_0x1e8551][_0x1eb437]);break;case 0x1:joinOrLeaveQueues(_0x4dd1f0,_0x31aceb,_0xcf08('0x43'),_0x3ebdfd[_0x1e8551][_0x1eb437]);break;case 0x2:joinOrLeaveQueues(_0x4dd1f0,_0x31aceb,_0xcf08('0x44'),_0x3ebdfd[_0x1e8551][_0x1eb437]);break;case 0x3:joinOrLeaveQueues(_0x4dd1f0,_0x31aceb,_0xcf08('0x45'),_0x3ebdfd[_0x1e8551][_0x1eb437]);break;case 0x4:joinOrLeaveQueues(_0x4dd1f0,_0x31aceb,_0xcf08('0x46'),_0x3ebdfd[_0x1e8551][_0x1eb437]);break;case 0x5:joinOrLeaveQueues(_0x4dd1f0,_0x31aceb,_0xcf08('0x47'),_0x3ebdfd[_0x1e8551][_0x1eb437]);break;case 0x6:joinOrLeaveQueues(_0x4dd1f0,_0x31aceb,_0xcf08('0x48'),_0x3ebdfd[_0x1e8551][_0x1eb437]);break;case 0x7:if(_0x52968a['role']!=='agent')_0x4dd1f0[_0x31aceb](util[_0xcf08('0x1c')](_0xcf08('0x49'),_0x3ebdfd[_0x1e8551][_0x1eb437][_0xcf08('0x4')]));break;case 0x8:if(_0x52968a[_0xcf08('0x20')]!==_0xcf08('0x7'))_0x4dd1f0[_0x31aceb](util[_0xcf08('0x1c')]('trunk:%s',_0x3ebdfd[_0x1e8551][_0x1eb437][_0xcf08('0x4')]));break;case 0x9:if(_0x52968a[_0xcf08('0x20')]!==_0xcf08('0x7'))_0x4dd1f0[_0x31aceb](util[_0xcf08('0x1c')](_0xcf08('0x4a'),_0x3ebdfd[_0x1e8551][_0x1eb437][_0xcf08('0x1a')],_0x3ebdfd[_0x1e8551][_0x1eb437]['name']));break;case 0xa:_0x4dd1f0[_0x31aceb](util[_0xcf08('0x1c')](_0xcf08('0x1d'),_0x3ebdfd[_0x1e8551][_0x1eb437][_0xcf08('0x4')]));break;}}}}})['then'](function(){if(_0x31aceb===_0xcf08('0x4b')){var _0x2b7633=_[_0xcf08('0x17')](_0x52968a[_0xcf08('0x24')],'id');return _0x52968a[_0xcf08('0x4c')](_0x2b7633)[_0xcf08('0xa')](function(){for(var _0x524273=0x0;_0x524273<_0x2b7633[_0xcf08('0x41')];_0x524273+=0x1){_0x208f1d[_0xcf08('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x2b7633[_0x524273]),'UserId':Number(_0x52968a['id'])});}});}})[_0xcf08('0xa')](function(){if(_0x31aceb===_0xcf08('0x4b')){var _0x46d9af=_['map'](_0x52968a['MailInteractions'],'id');return _0x52968a[_0xcf08('0x4e')](_0x46d9af)[_0xcf08('0xa')](function(){for(var _0xc059dd=0x0;_0xc059dd<_0x46d9af[_0xcf08('0x41')];_0xc059dd+=0x1){_0x208f1d[_0xcf08('0x4d')](_0xcf08('0x4f'),{'MailInteractionId':Number(_0x46d9af[_0xc059dd]),'UserId':Number(_0x52968a['id'])});}});}})[_0xcf08('0xa')](function(){if(_0x31aceb===_0xcf08('0x4b')){var _0x387567=_[_0xcf08('0x17')](_0x52968a['FaxInteractions'],'id');return _0x52968a['removeFaxInteractions'](_0x387567)[_0xcf08('0xa')](function(){for(var _0x531673=0x0;_0x531673<_0x387567[_0xcf08('0x41')];_0x531673+=0x1){_0x208f1d[_0xcf08('0x4d')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x387567[_0x531673]),'UserId':Number(_0x52968a['id'])});}});}})[_0xcf08('0xa')](function(){if(_0x31aceb===_0xcf08('0x4b')){var _0x59e80a=_[_0xcf08('0x17')](_0x52968a['SmsInteractions'],'id');return _0x52968a[_0xcf08('0x50')](_0x59e80a)['then'](function(){for(var _0x4c7bc6=0x0;_0x4c7bc6<_0x59e80a[_0xcf08('0x41')];_0x4c7bc6+=0x1){_0x208f1d['emit'](_0xcf08('0x51'),{'SmsInteractionId':Number(_0x59e80a[_0x4c7bc6]),'UserId':Number(_0x52968a['id'])});}});}})[_0xcf08('0xa')](function(){if(_0x31aceb===_0xcf08('0x4b')){var _0x36f27b=_['map'](_0x52968a[_0xcf08('0x2a')],'id');return _0x52968a['removeOpenchannelInteractions'](_0x36f27b)[_0xcf08('0xa')](function(){for(var _0x537bce=0x0;_0x537bce<_0x36f27b['length'];_0x537bce+=0x1){_0x208f1d['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x36f27b[_0x537bce]),'UserId':Number(_0x52968a['id'])});}});}})[_0xcf08('0xa')](function(){if(_0x31aceb==='leave'){var _0x41a665=_[_0xcf08('0x17')](_0x52968a[_0xcf08('0x2b')],'id');return _0x52968a[_0xcf08('0x52')](_0x41a665)[_0xcf08('0xa')](function(){for(var _0x2fa18f=0x0;_0x2fa18f<_0x41a665[_0xcf08('0x41')];_0x2fa18f+=0x1){_0x208f1d[_0xcf08('0x4d')](_0xcf08('0x53'),{'WhatsappInteractionId':Number(_0x41a665[_0x2fa18f]),'UserId':Number(_0x52968a['id'])});}});}})[_0xcf08('0x54')](function(_0x2cd636){_0x4dd1f0[_0xcf08('0x55')](_0x2cd636);});}}function onDisconnect(_0x1f3c7d,_0x3b86b0){joinOrLeave(_0x1f3c7d,'leave',_0x3b86b0);}function onConnect(_0x3b3e18){joinOrLeave(_0x3b3e18,_0xcf08('0x56'));}exports['default']=function(_0x640a7){_0x640a7['on'](_0xcf08('0x57'),function(_0x2fcf5c){_0x2fcf5c[_0xcf08('0x58')](0x0);_0x2fcf5c['address']=_0x2fcf5c[_0xcf08('0x59')][_0xcf08('0x57')][_0xcf08('0x5a')]+':'+_0x2fcf5c['request'][_0xcf08('0x57')][_0xcf08('0x5b')];_0x2fcf5c['connectedAt']=new Date();_0x2fcf5c[_0xcf08('0x55')]=function(_0x853439){console['log'](_0xcf08('0x5c')+_0x2fcf5c[_0xcf08('0x5d')][_0xcf08('0x4')]+'['+_0x2fcf5c[_0xcf08('0x5e')]+']',_0x853439);};_0x2fcf5c['on']('disconnect',function(){onDisconnect(_0x2fcf5c,_0x640a7);_0x2fcf5c['log'](_0xcf08('0x5f'));});onConnect(_0x2fcf5c);_0x2fcf5c['log']('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index bb00190..ee4c659 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 _0xa0a1=['lodash','client','http','ChatInteraction','afterCreate','newinteraction','Chat','ChatMessage','Sms','SmsInteraction','afterUpdate','closedinteraction','newmessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','Trigger,\x20%s','EventManager','error','code','catch','get','channel','event','direction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','then','contact','User','find','name','fullname','email','internal','interface','format','opened','closed','ContactId','UserId','SIP/%s','agent','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa0a1,0x18f));var _0x1a0a=function(_0x3423b9,_0x492eea){_0x3423b9=_0x3423b9-0x0;var _0x48f7ac=_0xa0a1[_0x3423b9];return _0x48f7ac;};'use strict';var util=require(_0x1a0a('0x0'));var db=require(_0x1a0a('0x1'))['db'];var jayson=require(_0x1a0a('0x2'));var logger=require('../logger')('triggers');var _=require(_0x1a0a('0x3'));var client=jayson[_0x1a0a('0x4')][_0x1a0a('0x5')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x1a0a('0x6'),'event':_0x1a0a('0x7'),'condition':_0x1a0a('0x8'),'callback':afterCreate},{'channel':'Chat','model':_0x1a0a('0x6'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1a0a('0x9'),'model':_0x1a0a('0xa'),'event':_0x1a0a('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x1a0a('0xb'),'model':'SmsInteraction','event':_0x1a0a('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':'Sms','model':_0x1a0a('0xc'),'event':_0x1a0a('0xd'),'condition':_0x1a0a('0xe'),'callback':afterUpdate},{'channel':_0x1a0a('0xb'),'model':'SmsMessage','event':_0x1a0a('0x7'),'condition':_0x1a0a('0xf'),'callback':afterCreateMessage},{'channel':_0x1a0a('0x10'),'model':'WhatsappInteraction','event':'afterCreate','condition':_0x1a0a('0x8'),'callback':afterCreate},{'channel':_0x1a0a('0x10'),'model':_0x1a0a('0x11'),'event':_0x1a0a('0xd'),'condition':_0x1a0a('0xe'),'callback':afterUpdate},{'channel':_0x1a0a('0x10'),'model':_0x1a0a('0x12'),'event':_0x1a0a('0x7'),'condition':_0x1a0a('0xf'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x1a0a('0x13'),'event':'afterCreate','condition':_0x1a0a('0x8'),'callback':afterCreate},{'channel':'Fax','model':_0x1a0a('0x13'),'event':_0x1a0a('0xd'),'condition':_0x1a0a('0xe'),'callback':afterUpdate},{'channel':_0x1a0a('0x14'),'model':_0x1a0a('0x15'),'event':_0x1a0a('0x7'),'condition':_0x1a0a('0xf'),'callback':afterCreateMessage},{'channel':_0x1a0a('0x16'),'model':_0x1a0a('0x17'),'event':'afterCreate','condition':_0x1a0a('0x8'),'callback':afterCreate},{'channel':_0x1a0a('0x16'),'model':_0x1a0a('0x17'),'event':_0x1a0a('0xd'),'condition':_0x1a0a('0xe'),'callback':afterUpdate},{'channel':_0x1a0a('0x16'),'model':_0x1a0a('0x18'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x1a0a('0x19'),'model':_0x1a0a('0x1a'),'event':_0x1a0a('0x7'),'condition':_0x1a0a('0x8'),'callback':afterCreate},{'channel':_0x1a0a('0x19'),'model':_0x1a0a('0x1a'),'event':_0x1a0a('0xd'),'condition':_0x1a0a('0xe'),'callback':afterUpdate},{'channel':_0x1a0a('0x19'),'model':_0x1a0a('0x1b'),'event':_0x1a0a('0x7'),'condition':_0x1a0a('0xf'),'callback':afterCreateMessage}];function request(_0x176e40){return client['request']('EventManager',_0x176e40)['then'](function(_0x5e12dc){logger['info'](_0x1a0a('0x1c'),_0x1a0a('0x1d'),_0x5e12dc);if(_0x5e12dc[_0x1a0a('0x1e')]){if(_0x5e12dc[_0x1a0a('0x1e')][_0x1a0a('0x1f')]===0x1f4){logger[_0x1a0a('0x1e')](_0x1a0a('0x1c'),_0x1a0a('0x1d'),_0x5e12dc['error']);}}})[_0x1a0a('0x20')](function(_0x55142b){logger[_0x1a0a('0x1e')](_0x1a0a('0x1c'),_0x1a0a('0x1d'),_0x55142b);});}function afterCreateMessage(_0x303225,_0x47eeb6){return function(_0x1447c6,_0x522ca7){_0x1447c6=_0x1447c6[_0x1a0a('0x21')]({'plain':!![]});_0x1447c6[_0x1a0a('0x22')]=_0x303225;_0x1447c6[_0x1a0a('0x23')]=_0x1447c6[_0x1a0a('0x24')];var _0x47e26e=_0x1a0a('0x25')+_0x1447c6['ContactId'];return db[_0x1a0a('0x26')][_0x1a0a('0x27')](_0x47e26e,{'type':db[_0x1a0a('0x28')][_0x1a0a('0x29')][_0x1a0a('0x2a')],'raw':!![]})[_0x1a0a('0x2b')](function(_0x4c8be9){return _0x4c8be9;})[_0x1a0a('0x2b')](function(_0x4da2c0){if(_0x4da2c0){_0x1447c6[_0x1a0a('0x2c')]=_0x4da2c0[0x0];}if(_0x1447c6['UserId']){return db[_0x1a0a('0x2d')][_0x1a0a('0x2e')]({'where':{'id':_0x1447c6['UserId']},'attributes':['id',_0x1a0a('0x2f'),_0x1a0a('0x30'),_0x1a0a('0x31'),_0x1a0a('0x32')],'raw':!![]})['then'](function(_0x103c5b){_0x1447c6[_0x1a0a('0x33')]=util[_0x1a0a('0x34')]('SIP/%s',_0x103c5b[_0x1a0a('0x2f')]);_0x1447c6['channel']=_0x303225;_0x1447c6['agent']=_0x103c5b;return request({'event':'incomingmessage','message':_0x1447c6});})['catch'](function(_0x5b3613){console['error'](_0x5b3613);});}else{return request({'event':'outgoingmessage','message':_0x1447c6});}});};}function afterCreate(_0x5c1145,_0x1188b9){return function(_0x181310,_0xd5dd4d){_0x181310=_0x181310[_0x1a0a('0x21')]({'plain':!![]});_0x181310[_0x1a0a('0x22')]=_0x5c1145;_0x181310['event']=_0x1a0a('0x35');var _0x80b719=_0x1a0a('0x25')+_0x181310['ContactId'];return db[_0x1a0a('0x26')][_0x1a0a('0x27')](_0x80b719,{'type':db['Sequelize']['QueryTypes'][_0x1a0a('0x2a')],'raw':!![]})[_0x1a0a('0x2b')](function(_0xd540a3){return _0xd540a3;})[_0x1a0a('0x2b')](function(_0x2badcf){if(_0x2badcf){_0x181310[_0x1a0a('0x2c')]=_0x2badcf[0x0];}return request({'event':_0x1188b9,'message':_0x181310});});};}function afterUpdate(_0x2b0cb8,_0x52196a){return function(_0x118c1b,_0x4a4917){if(_0x118c1b['changed'](_0x1a0a('0x36'))&&_0x118c1b[_0x1a0a('0x36')]){_0x118c1b=_0x118c1b[_0x1a0a('0x21')]({'plain':!![]});_0x118c1b[_0x1a0a('0x22')]=_0x2b0cb8;_0x118c1b[_0x1a0a('0x23')]=_0x1a0a('0x36');var _0x4be0b2=_0x1a0a('0x25')+_0x118c1b[_0x1a0a('0x37')];return db['sequelize'][_0x1a0a('0x27')](_0x4be0b2,{'type':db['Sequelize']['QueryTypes'][_0x1a0a('0x2a')],'raw':!![]})[_0x1a0a('0x2b')](function(_0x3e62fb){return _0x3e62fb;})['then'](function(_0x31f94f){if(_0x31f94f){_0x118c1b[_0x1a0a('0x2c')]=_0x31f94f[0x0];}if(_0x118c1b[_0x1a0a('0x38')]){return db['User'][_0x1a0a('0x2e')]({'where':{'id':_0x118c1b['UserId']},'attributes':['id',_0x1a0a('0x2f'),_0x1a0a('0x30'),_0x1a0a('0x31'),'internal'],'raw':!![]})[_0x1a0a('0x2b')](function(_0x28a18c){_0x118c1b[_0x1a0a('0x33')]=util['format'](_0x1a0a('0x39'),_0x28a18c[_0x1a0a('0x2f')]);_0x118c1b[_0x1a0a('0x3a')]=_0x28a18c;return request({'event':_0x52196a,'message':_0x118c1b});})['catch'](function(_0x147d46){console[_0x1a0a('0x1e')](_0x147d46);});}else{return request({'event':_0x52196a,'message':_0x118c1b});}});}};}exports[_0x1a0a('0x3b')]=function(){for(var _0x7788a6=0x0;_0x7788a6=_0x1645eb[_0xef25('0x12')]){throw Error(_0xef25('0x13'));}_0x11b87c(_0x19ce58);})[_0xef25('0x14')](function(_0x2847d9){_0x4c6b8a(_0x2847d9);});});}; \ No newline at end of file +var _0xb91d=['isValidChannel','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','../mysqldb','./license/util','voice','mail','chat','fax','sms','whatsapp','getChannels'];(function(_0x1dc7f5,_0x136891){var _0xfa622a=function(_0x1c8112){while(--_0x1c8112){_0x1dc7f5['push'](_0x1dc7f5['shift']());}};_0xfa622a(++_0x136891);}(_0xb91d,0x109));var _0xdb91=function(_0x35c5a8,_0x8ecb48){_0x35c5a8=_0x35c5a8-0x0;var _0x34782c=_0xb91d[_0x35c5a8];return _0x34782c;};'use strict';var _=require('lodash');var BPromise=require(_0xdb91('0x0'));var db=require(_0xdb91('0x1'))['db'];var util=require(_0xdb91('0x2'));var channels=[_0xdb91('0x3'),_0xdb91('0x4'),_0xdb91('0x5'),_0xdb91('0x6'),_0xdb91('0x7'),_0xdb91('0x8'),'openchannel'];exports[_0xdb91('0x9')]=function(){return channels;};exports[_0xdb91('0xa')]=function(_0x3fd503){_0x3fd503=_0x3fd503['toLowerCase']();return _[_0xdb91('0xb')](channels,_0x3fd503);};exports[_0xdb91('0xc')]=function(_0x147a3c,_0x12facd,_0x2b8ace,_0x168896){var _0x343ebc={'loginAttempts':_0x12facd,'blocked':_0x2b8ace};if(!_[_0xdb91('0xd')](_0x168896)){_0x343ebc[_0xdb91('0xe')]=_0x168896;}return _0x147a3c[_0xdb91('0xf')](_0x343ebc);};exports[_0xdb91('0x10')]=function(_0x1074b4){return new BPromise(function(_0x3542f7,_0x258591){var _0x55754f=0x0;if(_0x1074b4[_0xdb91('0x11')]!==_0xdb91('0x12')){_0x3542f7(_0x1074b4);}db[_0xdb91('0x13')][_0xdb91('0x14')]({'where':{'role':_0xdb91('0x12'),'online':!![],'id':{'$ne':_0x1074b4['id']}}})[_0xdb91('0x15')](function(_0x3eaa3a){_0x55754f=_0x3eaa3a;return util[_0xdb91('0x10')]();})[_0xdb91('0x15')](function(_0x1235ad){if(_0x1235ad&&_0x1235ad[_0xdb91('0x16')]&&_0x55754f>=_0x1235ad[_0xdb91('0x16')]){throw Error(_0xdb91('0x17'));}_0x3542f7(_0x1074b4);})[_0xdb91('0x18')](function(_0x2ff093){_0x258591(_0x2ff093);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 139ba80..fc1204c 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39c4=['json','send','404','status','render'];(function(_0x3fafb4,_0x16f7d4){var _0x333aff=function(_0x218438){while(--_0x218438){_0x3fafb4['push'](_0x3fafb4['shift']());}};_0x333aff(++_0x16f7d4);}(_0x39c4,0x174));var _0x439c=function(_0x582fc2,_0xc944f8){_0x582fc2=_0x582fc2-0x0;var _0x12907a=_0x39c4[_0x582fc2];return _0x12907a;};'use strict';module['exports'][0x194]=function pageNotFound(_0x1d3f1f,_0x5b1ddb){var _0x5397c7=_0x439c('0x0');var _0x27f9f7=0x194;var _0x59b938={'status':_0x27f9f7};_0x5b1ddb['status'](_0x59b938[_0x439c('0x1')]);_0x5b1ddb[_0x439c('0x2')](_0x5397c7,{},function(_0xb13c0f,_0x146f44){if(_0xb13c0f){return _0x5b1ddb[_0x439c('0x1')](_0x59b938[_0x439c('0x1')])[_0x439c('0x3')](_0x59b938);}_0x5b1ddb[_0x439c('0x4')](_0x146f44);});}; \ No newline at end of file +var _0x22a4=['404','status','render','send','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x22a4,0x1cb));var _0x422a=function(_0x1a1892,_0x1325d7){_0x1a1892=_0x1a1892-0x0;var _0x2d6d78=_0x22a4[_0x1a1892];return _0x2d6d78;};'use strict';module[_0x422a('0x0')][0x194]=function pageNotFound(_0x767d8d,_0xc33e81){var _0x3d7f34=_0x422a('0x1');var _0x3835c8=0x194;var _0x4725b0={'status':_0x3835c8};_0xc33e81[_0x422a('0x2')](_0x4725b0['status']);_0xc33e81[_0x422a('0x3')](_0x3d7f34,{},function(_0x10cc65,_0x1d5d59){if(_0x10cc65){return _0xc33e81[_0x422a('0x2')](_0x4725b0[_0x422a('0x2')])['json'](_0x4725b0);}_0xc33e81[_0x422a('0x4')](_0x1d5d59);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 2d56ce8..fdaedc6 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1f9=['../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','../api/tag/tag.model','Template','Variable','../api/variable/variable.model','Integration','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','Realtime','../api/realtime/realtime.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','VoiceMail','cascade','UserId','Recordings','hasMany','UserVoiceQueueRt','VoiceQueuesRt','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','belongsTo','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','VoicePrefixes','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','user_has_square_projects','ChanSpyId','VoiceContext','Applications','Sound','Sounds','moh_has_sounds','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','IntervalId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceRecording','mailbox','mailboxuser','QueueCalls','AgentReports','uniqueid','Contact','ContactId','MailAccountId','Imap','Smtp','Dispositions','Messages','List','ListId','mandatoryDispositionPause','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Tag','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','restrict','Dashboard','Items','Answers','Interactions','Exntensions','TagId','FaxInteractionId','FaxAccountId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','openchannel_interaction_has_tags','OpenchannelInteractionId','ProactiveActions','Agent','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','Members','CompanyId','cm_contact_has_tags','Queue','CampaignId','OwnerId','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','SubjectId','Descriptions','DescriptionId','FieldId','Description','VariableId','Subjects','Subject','Field','DeskConfiguration','int_desk_configuration_has_tags','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskField','Dynamics365Account','Dynamics365Configuration','FreshsalesConfiguration','FromId','ToId','SessionId','ProjectId','JscriptyAnswerReport','team_has_openchannel_queues','Hoppers','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToUserId','ToAgent','ToChatQueueId','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','userProfileId','UserProfileSections','UserProfileResource','Resources','WhatsappAccountId','WhatsappMessage','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','path','../config/environment','sequelize','lodash','jstz','defaultsDeep','motion2','xcall','xC@LL1234','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','127.0.0.1','mysql','username','password','options','database','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue'];(function(_0x54825e,_0x3692e4){var _0x51f829=function(_0x167a57){while(--_0x167a57){_0x54825e['push'](_0x54825e['shift']());}};_0x51f829(++_0x3692e4);}(_0xf1f9,0x1cd));var _0x9f1f=function(_0x4aa2b4,_0x181d12){_0x4aa2b4=_0x4aa2b4-0x0;var _0x4a4955=_0xf1f9[_0x4aa2b4];return _0x4a4955;};'use strict';var path=require(_0x9f1f('0x0'));var config=require(_0x9f1f('0x1'));var Sequelize=require(_0x9f1f('0x2'));var _=require(_0x9f1f('0x3'));var jstz=require(_0x9f1f('0x4'));var timezone=jstz['determine']();config[_0x9f1f('0x2')]=_[_0x9f1f('0x5')](config[_0x9f1f('0x2')],{'database':_0x9f1f('0x6'),'username':_0x9f1f('0x7'),'password':_0x9f1f('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x9f1f('0x9')},'logging':![],'timezone':timezone[_0x9f1f('0xa')](),'define':{'charset':_0x9f1f('0xb'),'collate':_0x9f1f('0xc')}}});config['sequelizeHistory']=_[_0x9f1f('0x5')](config[_0x9f1f('0xd')],{'database':_0x9f1f('0x6'),'username':_0x9f1f('0x7'),'password':_0x9f1f('0x8'),'options':{'host':_0x9f1f('0xe'),'port':0xcea,'dialect':_0x9f1f('0xf'),'dialectOptions':{'charset':_0x9f1f('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x9f1f('0xb'),'collate':_0x9f1f('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9f1f('0x2')]['database'],config['sequelize'][_0x9f1f('0x10')],config['sequelize'][_0x9f1f('0x11')],config[_0x9f1f('0x2')][_0x9f1f('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9f1f('0xd')][_0x9f1f('0x13')],config[_0x9f1f('0xd')][_0x9f1f('0x10')],config['sequelizeHistory'][_0x9f1f('0x11')],config['sequelizeHistory'][_0x9f1f('0x12')])};db[_0x9f1f('0x14')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x16'));db['VoiceChanSpy']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x17'));db['VoiceContext']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x18'));db[_0x9f1f('0x19')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0x1a'));db[_0x9f1f('0x1b')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x9f1f('0x1c')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0x1d'));db['VoiceRecording']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x1e'));db[_0x9f1f('0x1f')]=db[_0x9f1f('0x2')]['import']('../api/screenRecording/screenRecording.model');db['VoiceMail']=db['sequelize']['import'](_0x9f1f('0x20'));db[_0x9f1f('0x21')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0x22'));db[_0x9f1f('0x23')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x24'));db[_0x9f1f('0x25')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x26'));db[_0x9f1f('0x27')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x28'));db[_0x9f1f('0x29')]=db['sequelize']['import'](_0x9f1f('0x2a'));db[_0x9f1f('0x2b')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0x2c'));db[_0x9f1f('0x2d')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x2e'));db[_0x9f1f('0x2f')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0x30'));db['UserVoiceQueueRt']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x31'));db[_0x9f1f('0x32')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0x33'));db[_0x9f1f('0x34')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x35'));db[_0x9f1f('0x36')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x37'));db[_0x9f1f('0x38')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x39'));db[_0x9f1f('0x3a')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x3b'));db['UserOpenchannelQueue']=db[_0x9f1f('0x2')]['import'](_0x9f1f('0x3c'));db[_0x9f1f('0x3d')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x3e'));db[_0x9f1f('0x3f')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x40'));db[_0x9f1f('0x41')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x42'));db['MailAccount']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x43'));db[_0x9f1f('0x44')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x45'));db[_0x9f1f('0x46')]=db['sequelize'][_0x9f1f('0x15')]('../api/mailSubstatus/mailSubstatus.model');db[_0x9f1f('0x47')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x48'));db[_0x9f1f('0x49')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/mailMessage/mailMessage.model');db[_0x9f1f('0x4a')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x4b'));db[_0x9f1f('0x4c')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0x4d'));db['Dashboard']=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/dashboard/dashboard.model');db[_0x9f1f('0x4e')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x4f'));db[_0x9f1f('0x50')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0x51'));db[_0x9f1f('0x52')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x53'));db[_0x9f1f('0x54')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x55'));db[_0x9f1f('0x56')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0x57'));db[_0x9f1f('0x58')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x59'));db[_0x9f1f('0x5a')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x5b'));db[_0x9f1f('0x5c')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0x5d'));db[_0x9f1f('0x5e')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x5f'));db[_0x9f1f('0x60')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x61'));db[_0x9f1f('0x62')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0x63'));db['SmsQueue']=db['sequelize'][_0x9f1f('0x15')]('../api/smsQueue/smsQueue.model');db[_0x9f1f('0x64')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0x65'));db[_0x9f1f('0x66')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0x67'));db[_0x9f1f('0x68')]=db[_0x9f1f('0x2')]['import']('../api/openchannelInteraction/openchannelInteraction.model');db[_0x9f1f('0x69')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x6a'));db[_0x9f1f('0x6b')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0x6c'));db[_0x9f1f('0x6d')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0x6e'));db[_0x9f1f('0x6f')]=db['sequelize'][_0x9f1f('0x15')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x9f1f('0x70')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/chatApplication/chatApplication.model');db[_0x9f1f('0x71')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x72'));db[_0x9f1f('0x73')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0x74'));db['ChatOfflineMessage']=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0x75'));db[_0x9f1f('0x76')]=db['sequelize'][_0x9f1f('0x15')]('../api/chatQueue/chatQueue.model');db[_0x9f1f('0x77')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0x78'));db[_0x9f1f('0x79')]=db['sequelize']['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0x9f1f('0x7a')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0x7b'));db[_0x9f1f('0x7c')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x7d'));db[_0x9f1f('0x7e')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x7f'));db[_0x9f1f('0x80')]=db['sequelize'][_0x9f1f('0x15')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x9f1f('0x81')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0x82'));db[_0x9f1f('0x83')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x84'));db[_0x9f1f('0x85')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0x86'));db[_0x9f1f('0x87')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0x88'));db[_0x9f1f('0x89')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0x8a'));db[_0x9f1f('0x8b')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x8c'));db[_0x9f1f('0x8d')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x8e'));db[_0x9f1f('0x8f')]=db['sequelize']['import'](_0x9f1f('0x90'));db[_0x9f1f('0x91')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x92'));db[_0x9f1f('0x93')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/interval/interval.model');db[_0x9f1f('0x94')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x95'));db['Cdr']=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x9f1f('0x96')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x97'));db['Sound']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x98'));db['Tag']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x99'));db[_0x9f1f('0x9a')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/template/template.model');db['Trigger']=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/trigger/trigger.model');db[_0x9f1f('0x9b')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x9c'));db[_0x9f1f('0x9d')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/integration/integration.model');db[_0x9f1f('0x9e')]=db['sequelize'][_0x9f1f('0x15')]('../api/integrationReport/integrationReport.model');db[_0x9f1f('0x9f')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xa0'));db[_0x9f1f('0xa1')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xa2'));db['AnalyticExtractedReport']=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0xa3'));db[_0x9f1f('0xa4')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0xa5'));db[_0x9f1f('0xa6')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xa7'));db['AnalyticTreeReport']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xa8'));db[_0x9f1f('0xa9')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x9f1f('0xaa')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xab'));db[_0x9f1f('0xac')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0xad'));db[_0x9f1f('0xae')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x9f1f('0xaf')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xb0'));db[_0x9f1f('0xb1')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0xb2'));db[_0x9f1f('0xb3')]=db[_0x9f1f('0x2')]['import']('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db[_0x9f1f('0x2')]['import'](_0x9f1f('0xb4'));db[_0x9f1f('0xb5')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xb6'));db[_0x9f1f('0xb7')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xb8'));db[_0x9f1f('0xb9')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xba'));db[_0x9f1f('0xbb')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0xbc'));db[_0x9f1f('0xbd')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xbe'));db[_0x9f1f('0xbf')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db['sequelize']['import'](_0x9f1f('0xc0'));db[_0x9f1f('0xc1')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xc2'));db['FreshdeskField']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xc3'));db[_0x9f1f('0xc4')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0xc5'));db[_0x9f1f('0xc6')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0xc7'));db[_0x9f1f('0xc8')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/intVtigerField/intVtigerField.model');db[_0x9f1f('0xc9')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0xca'));db[_0x9f1f('0xcb')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0xcc'));db[_0x9f1f('0xcd')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0xce'));db['Dynamics365Account']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xcf'));db['Dynamics365Configuration']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xd0'));db[_0x9f1f('0xd1')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xd2'));db[_0x9f1f('0xd3')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xd4'));db['FreshsalesConfiguration']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xd5'));db[_0x9f1f('0xd6')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xd7'));db[_0x9f1f('0x9d')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0xd8'));db['Network']=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/network/network.model');db[_0x9f1f('0xd9')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/chatQueueReport/chatQueueReport.model');db[_0x9f1f('0xda')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0xdb'));db['JscriptyAnswerReport']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xdc'));db[_0x9f1f('0xdd')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0xde'));db[_0x9f1f('0xdf')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xe0'));db[_0x9f1f('0xe1')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/smsQueueReport/smsQueueReport.model');db[_0x9f1f('0xe2')]=db[_0x9f1f('0x2')]['import']('../api/squareReport/squareReport.model');db[_0x9f1f('0xe3')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/squareReportDetail/squareReportDetail.model');db[_0x9f1f('0xe4')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xe5'));db[_0x9f1f('0xe6')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0xe7'));db[_0x9f1f('0xe8')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xe9'));db[_0x9f1f('0xea')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0xeb'));db['SquareRecording']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xec'));db['SquareMessage']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xed'));db[_0x9f1f('0xee')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xef'));db[_0x9f1f('0xf0')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xf1'));db[_0x9f1f('0xf2')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0xf3'));db[_0x9f1f('0xf4')]=db['sequelize'][_0x9f1f('0x15')]('../api/migration/migration.model');db[_0x9f1f('0xf5')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xf6'));db[_0x9f1f('0xf7')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xf8'));db[_0x9f1f('0xf9')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0xfa'));db['ChatTransferReport']=db[_0x9f1f('0x2')]['import'](_0x9f1f('0xfb'));db[_0x9f1f('0xfc')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0xfd'));db['OpenchannelTransferReport']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0xfe'));db[_0x9f1f('0xff')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0x100'));db[_0x9f1f('0x101')]=db[_0x9f1f('0x2')]['import'](_0x9f1f('0x102'));db[_0x9f1f('0x103')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x104'));db[_0x9f1f('0x105')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x106'));db[_0x9f1f('0x107')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0x108'));db['UserProfileResource']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x109'));db[_0x9f1f('0x10a')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x10b'));db[_0x9f1f('0x10c')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/whatsappAccount/whatsappAccount.model');db[_0x9f1f('0x10d')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x10e'));db[_0x9f1f('0x10f')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0x110'));db['WhatsappMessage']=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x111'));db[_0x9f1f('0x112')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x113'));db['WhatsappTransferReport']=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x9f1f('0x114')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')]('../api/whatsappQueue/whatsappQueue.model');db[_0x9f1f('0x115')]=db['sequelize'][_0x9f1f('0x15')](_0x9f1f('0x116'));db[_0x9f1f('0x117')]=db[_0x9f1f('0x2')][_0x9f1f('0x15')](_0x9f1f('0x118'));db[_0x9f1f('0x119')]=db['sequelize']['import'](_0x9f1f('0x11a'));db[_0x9f1f('0x14')][_0x9f1f('0x11b')](db[_0x9f1f('0x11c')],{'as':_0x9f1f('0x11c'),'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x11e')});db[_0x9f1f('0x14')]['hasMany'](db['VoiceRecording'],{'as':_0x9f1f('0x11f'),'foreignKey':_0x9f1f('0x11e')});db[_0x9f1f('0x14')][_0x9f1f('0x120')](db[_0x9f1f('0x121')],{'as':_0x9f1f('0x122'),'foreignKey':_0x9f1f('0x11e')});db[_0x9f1f('0x14')][_0x9f1f('0x120')](db[_0x9f1f('0x19')],{'as':'Extensions','onDelete':_0x9f1f('0x11d'),'hooks':!![]});db['User'][_0x9f1f('0x120')](db[_0x9f1f('0x81')],{'as':_0x9f1f('0x123'),'foreignKey':'UserId'});db['User'][_0x9f1f('0x120')](db[_0x9f1f('0x83')],{'as':_0x9f1f('0x124'),'foreignKey':_0x9f1f('0x11e')});db['User'][_0x9f1f('0x120')](db[_0x9f1f('0x85')],{'as':_0x9f1f('0x85'),'foreignKey':_0x9f1f('0x11e')});db[_0x9f1f('0x14')][_0x9f1f('0x120')](db['OpenchannelInteraction'],{'as':_0x9f1f('0x125'),'foreignKey':_0x9f1f('0x11e')});db['User'][_0x9f1f('0x120')](db[_0x9f1f('0x71')],{'as':_0x9f1f('0x126'),'foreignKey':_0x9f1f('0x11e')});db[_0x9f1f('0x14')]['hasMany'](db[_0x9f1f('0x60')],{'as':_0x9f1f('0x127'),'foreignKey':'UserId'});db[_0x9f1f('0x14')]['hasMany'](db[_0x9f1f('0x54')],{'as':_0x9f1f('0x128'),'foreignKey':_0x9f1f('0x11e')});db[_0x9f1f('0x14')][_0x9f1f('0x120')](db[_0x9f1f('0x47')],{'as':_0x9f1f('0x129'),'foreignKey':'UserId'});db['User'][_0x9f1f('0x120')](db[_0x9f1f('0x10f')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0x9f1f('0x14')][_0x9f1f('0x120')](db[_0x9f1f('0x10a')],{'as':'UserNotifications','foreignKey':'SenderId'});db[_0x9f1f('0x14')][_0x9f1f('0x12a')](db[_0x9f1f('0x105')],{'as':_0x9f1f('0x105'),'foreignKey':'userProfileId'});db[_0x9f1f('0x14')][_0x9f1f('0x12b')](db['ChatGroup'],{'as':_0x9f1f('0x12c'),'through':_0x9f1f('0x12d')});db[_0x9f1f('0x14')][_0x9f1f('0x12b')](db[_0x9f1f('0x7c')],{'as':_0x9f1f('0x12e'),'through':_0x9f1f('0x12f')});db[_0x9f1f('0x14')][_0x9f1f('0x12b')](db['CmList'],{'as':_0x9f1f('0x130'),'through':_0x9f1f('0x131')});db['User'][_0x9f1f('0x12b')](db[_0x9f1f('0xee')],{'through':_0x9f1f('0x132')});db['User'][_0x9f1f('0x12b')](db[_0x9f1f('0x47')],{'as':_0x9f1f('0x129'),'through':_0x9f1f('0x133')});db[_0x9f1f('0x14')][_0x9f1f('0x12b')](db[_0x9f1f('0x71')],{'as':'ChatInteractions','through':_0x9f1f('0x134')});db['User'][_0x9f1f('0x12b')](db[_0x9f1f('0x54')],{'as':'FaxInteractions','through':_0x9f1f('0x135')});db[_0x9f1f('0x14')][_0x9f1f('0x12b')](db[_0x9f1f('0x60')],{'as':_0x9f1f('0x127'),'through':_0x9f1f('0x136')});db[_0x9f1f('0x14')]['belongsToMany'](db['OpenchannelInteraction'],{'as':_0x9f1f('0x125'),'through':_0x9f1f('0x137')});db[_0x9f1f('0x14')][_0x9f1f('0x12b')](db[_0x9f1f('0x10f')],{'as':'WhatsappInteractions','through':_0x9f1f('0x138')});db[_0x9f1f('0x14')][_0x9f1f('0x12b')](db['VoiceQueue'],{'as':_0x9f1f('0x139'),'through':_0x9f1f('0x32'),'required':![]});db[_0x9f1f('0x14')][_0x9f1f('0x12b')](db[_0x9f1f('0x44')],{'as':_0x9f1f('0x13a'),'through':_0x9f1f('0x36'),'required':![]});db[_0x9f1f('0x14')][_0x9f1f('0x12b')](db['ChatQueue'],{'as':_0x9f1f('0x13b'),'through':_0x9f1f('0x34'),'required':![],'hooks':!![]});db[_0x9f1f('0x14')]['belongsToMany'](db['FaxQueue'],{'as':_0x9f1f('0x13c'),'through':_0x9f1f('0x38'),'required':![]});db[_0x9f1f('0x14')][_0x9f1f('0x12b')](db['SmsQueue'],{'as':_0x9f1f('0x13d'),'through':_0x9f1f('0x3a'),'required':![]});db[_0x9f1f('0x14')][_0x9f1f('0x12b')](db[_0x9f1f('0x6b')],{'as':_0x9f1f('0x13e'),'through':_0x9f1f('0x13f'),'required':![]});db['User']['belongsToMany'](db[_0x9f1f('0x114')],{'as':_0x9f1f('0x140'),'through':_0x9f1f('0x3d'),'required':![]});db[_0x9f1f('0x14')][_0x9f1f('0x12b')](db[_0x9f1f('0x101')],{'through':_0x9f1f('0x131')});db[_0x9f1f('0x14')]['belongsToMany'](db[_0x9f1f('0x103')],{'as':_0x9f1f('0x141'),'through':'user_has_voice_prefixes','required':![]});db[_0x9f1f('0x14')][_0x9f1f('0x12b')](db[_0x9f1f('0x6d')],{'as':'ChatWebsites','through':_0x9f1f('0x142')});db[_0x9f1f('0x14')][_0x9f1f('0x12b')](db[_0x9f1f('0x50')],{'as':_0x9f1f('0x143'),'through':_0x9f1f('0x144')});db['User'][_0x9f1f('0x12b')](db[_0x9f1f('0x145')],{'as':_0x9f1f('0x146'),'through':'user_has_mail_accounts'});db[_0x9f1f('0x14')][_0x9f1f('0x12b')](db[_0x9f1f('0x64')],{'as':'OpenchannelAccounts','through':_0x9f1f('0x147')});db[_0x9f1f('0x14')][_0x9f1f('0x12b')](db[_0x9f1f('0x5c')],{'as':'SmsAccounts','through':_0x9f1f('0x148')});db[_0x9f1f('0x14')][_0x9f1f('0x12b')](db[_0x9f1f('0x10c')],{'as':_0x9f1f('0x149'),'through':'user_has_whatsapp_accounts'});db[_0x9f1f('0x14')][_0x9f1f('0x12b')](db['SquareProject'],{'as':_0x9f1f('0x14a'),'through':_0x9f1f('0x14b')});db['VoiceChanSpy'][_0x9f1f('0x120')](db[_0x9f1f('0x19')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0x9f1f('0x14c')});db[_0x9f1f('0x14d')][_0x9f1f('0x120')](db[_0x9f1f('0x19')],{'onDelete':'cascade'});db[_0x9f1f('0x19')][_0x9f1f('0x120')](db[_0x9f1f('0x19')],{'as':_0x9f1f('0x14e'),'onDelete':_0x9f1f('0x11d')});db['VoiceMusicOnHold'][_0x9f1f('0x12b')](db[_0x9f1f('0x14f')],{'as':_0x9f1f('0x150'),'through':_0x9f1f('0x151')});db[_0x9f1f('0x1c')][_0x9f1f('0x120')](db[_0x9f1f('0x121')],{'as':'Members','foreignKey':_0x9f1f('0x152')});db['VoiceQueue']['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db[_0x9f1f('0x1c')][_0x9f1f('0x120')](db['CmHopperFinal'],{'as':_0x9f1f('0x123'),'foreignKey':'VoiceQueueId'});db[_0x9f1f('0x1c')]['hasMany'](db[_0x9f1f('0x83')],{'as':_0x9f1f('0x153'),'foreignKey':_0x9f1f('0x152')});db['VoiceQueue'][_0x9f1f('0x120')](db[_0x9f1f('0x85')],{'as':_0x9f1f('0x85'),'foreignKey':_0x9f1f('0x152')});db[_0x9f1f('0x1c')]['hasMany'](db[_0x9f1f('0x80')],{'as':_0x9f1f('0x154'),'foreignKey':_0x9f1f('0x152')});db[_0x9f1f('0x1c')][_0x9f1f('0x120')](db['JscriptySessionReport'],{'as':_0x9f1f('0x155'),'foreignKey':_0x9f1f('0x152')});db[_0x9f1f('0x1c')]['belongsTo'](db[_0x9f1f('0x2d')],{'as':'Trunk','foreignKey':_0x9f1f('0x156')});db[_0x9f1f('0x1c')][_0x9f1f('0x12a')](db[_0x9f1f('0x2d')],{'as':_0x9f1f('0x157'),'foreignKey':'TrunkBackupId'});db[_0x9f1f('0x1c')][_0x9f1f('0x12a')](db[_0x9f1f('0x93')],{'as':_0x9f1f('0x93'),'foreignKey':_0x9f1f('0x158')});db[_0x9f1f('0x1c')][_0x9f1f('0x12a')](db[_0x9f1f('0x94')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x9f1f('0x1c')]['belongsToMany'](db[_0x9f1f('0x101')],{'as':_0x9f1f('0x130'),'through':_0x9f1f('0x159')});db[_0x9f1f('0x1c')][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x15a'),'through':'UserVoiceQueue'});db[_0x9f1f('0x1c')][_0x9f1f('0x12b')](db[_0x9f1f('0xee')],{'as':_0x9f1f('0x15b'),'through':_0x9f1f('0x119')});db[_0x9f1f('0x1c')][_0x9f1f('0x12b')](db[_0x9f1f('0x101')],{'as':_0x9f1f('0x15c'),'through':_0x9f1f('0x15d')});db[_0x9f1f('0x15e')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x14'),'foreignKey':_0x9f1f('0x11e')});db[_0x9f1f('0x1f')]['belongsTo'](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x14'),'foreignKey':_0x9f1f('0x11e')});db[_0x9f1f('0x11c')][_0x9f1f('0x120')](db[_0x9f1f('0x21')],{'as':'Messages','onDelete':_0x9f1f('0x11d'),'foreignKey':'mailboxuser','sourceKey':_0x9f1f('0x15f')});db['VoiceMailMessage'][_0x9f1f('0x12a')](db[_0x9f1f('0x11c')],{'foreignKey':_0x9f1f('0x160'),'targetKey':_0x9f1f('0x15f')});db[_0x9f1f('0x23')]['hasMany'](db[_0x9f1f('0x29')],{'as':_0x9f1f('0x161'),'foreignKey':'uniqueid','constraints':![]});db[_0x9f1f('0x23')][_0x9f1f('0x120')](db[_0x9f1f('0x27')],{'as':_0x9f1f('0x162'),'foreignKey':_0x9f1f('0x163'),'constraints':![]});db[_0x9f1f('0x23')][_0x9f1f('0x12a')](db['User'],{'as':_0x9f1f('0x14'),'foreignKey':_0x9f1f('0x11e')});db['VoiceCallReport']['belongsTo'](db[_0x9f1f('0x7c')],{'as':_0x9f1f('0x164'),'foreignKey':_0x9f1f('0x165')});db[_0x9f1f('0x3f')]['belongsTo'](db[_0x9f1f('0x145')],{'as':_0x9f1f('0x145'),'foreignKey':'MailAccountId'});db[_0x9f1f('0x41')][_0x9f1f('0x12a')](db[_0x9f1f('0x145')],{'as':_0x9f1f('0x145'),'foreignKey':_0x9f1f('0x166')});db[_0x9f1f('0x145')][_0x9f1f('0x11b')](db[_0x9f1f('0x3f')],{'as':_0x9f1f('0x167'),'onDelete':'cascade'});db[_0x9f1f('0x145')][_0x9f1f('0x11b')](db[_0x9f1f('0x41')],{'as':_0x9f1f('0x168'),'onDelete':_0x9f1f('0x11d')});db[_0x9f1f('0x145')][_0x9f1f('0x120')](db[_0x9f1f('0x8f')],{'as':_0x9f1f('0x169'),'foreignKey':_0x9f1f('0x166')});db[_0x9f1f('0x145')][_0x9f1f('0x120')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x9f1f('0x166')});db['MailAccount'][_0x9f1f('0x120')](db['MailMessage'],{'as':_0x9f1f('0x16a'),'foreignKey':_0x9f1f('0x166')});db[_0x9f1f('0x145')]['hasMany'](db[_0x9f1f('0x47')],{'as':'Interactions'});db['MailAccount']['hasMany'](db[_0x9f1f('0x4a')],{'as':'Applications'});db[_0x9f1f('0x145')][_0x9f1f('0x12a')](db[_0x9f1f('0x101')],{'as':_0x9f1f('0x16b'),'foreignKey':_0x9f1f('0x16c')});db[_0x9f1f('0x145')][_0x9f1f('0x12a')](db[_0x9f1f('0x9a')],{'as':'Template','foreignKey':'TemplateId'});db[_0x9f1f('0x145')][_0x9f1f('0x12a')](db['Pause'],{'as':_0x9f1f('0x16d'),'foreignKey':_0x9f1f('0x16e')});db['MailAccount'][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x15a'),'through':'user_has_mail_accounts'});db[_0x9f1f('0x44')][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x15a'),'through':_0x9f1f('0x36')});db['MailQueue'][_0x9f1f('0x12b')](db['Team'],{'through':_0x9f1f('0x16f'),'as':_0x9f1f('0x15b')});db[_0x9f1f('0x47')][_0x9f1f('0x120')](db[_0x9f1f('0x49')],{'as':_0x9f1f('0x16a'),'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x170')});db[_0x9f1f('0x47')][_0x9f1f('0x12a')](db[_0x9f1f('0x145')],{'as':_0x9f1f('0x171'),'foreignKey':'MailAccountId'});db['MailInteraction'][_0x9f1f('0x12a')](db['CmContact'],{'as':'Contact','foreignKey':_0x9f1f('0x165')});db[_0x9f1f('0x47')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x172'),'foreignKey':_0x9f1f('0x11e')});db[_0x9f1f('0x47')][_0x9f1f('0x12b')](db['Tag'],{'through':_0x9f1f('0x173'),'as':_0x9f1f('0x174')});db[_0x9f1f('0x47')][_0x9f1f('0x12b')](db[_0x9f1f('0x175')],{'through':_0x9f1f('0x173'),'as':_0x9f1f('0x176')});db[_0x9f1f('0x47')][_0x9f1f('0x12b')](db['User'],{'as':_0x9f1f('0x177'),'through':_0x9f1f('0x133'),'foreignKey':'MailInteractionId'});db['MailMessage']['hasMany'](db[_0x9f1f('0xf5')],{'as':_0x9f1f('0x178'),'onDelete':_0x9f1f('0x11d')});db[_0x9f1f('0x49')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x14')});db[_0x9f1f('0x49')]['belongsTo'](db['CmContact'],{'onDelete':_0x9f1f('0x11d'),'as':_0x9f1f('0x164')});db['MailMessage'][_0x9f1f('0x12a')](db[_0x9f1f('0x47')],{'as':_0x9f1f('0x179'),'foreignKey':_0x9f1f('0x170')});db[_0x9f1f('0x49')][_0x9f1f('0x12a')](db[_0x9f1f('0x145')],{'as':_0x9f1f('0x171'),'foreignKey':_0x9f1f('0x166')});db[_0x9f1f('0x49')][_0x9f1f('0x12a')](db[_0x9f1f('0x6d')],{'as':'ChatWebsite','foreignKey':_0x9f1f('0x17a')});db[_0x9f1f('0x49')][_0x9f1f('0x12a')](db['ChatOfflineMessage'],{'as':_0x9f1f('0x17b'),'foreignKey':'ChatOfflineMessageId'});db[_0x9f1f('0x4a')][_0x9f1f('0x12a')](db['User'],{'onDelete':_0x9f1f('0x17c')});db[_0x9f1f('0x4a')][_0x9f1f('0x12a')](db[_0x9f1f('0x44')],{'onDelete':_0x9f1f('0x17c')});db['MailApplication'][_0x9f1f('0x12a')](db[_0x9f1f('0x145')],{'onDelete':_0x9f1f('0x17c')});db[_0x9f1f('0x4a')]['belongsTo'](db[_0x9f1f('0x93')],{'onDelete':'restrict','foreignKey':_0x9f1f('0x158')});db[_0x9f1f('0x4a')][_0x9f1f('0x12a')](db['Tag'],{'onDelete':_0x9f1f('0x17c'),'foreignKey':'TagId'});db[_0x9f1f('0x4c')][_0x9f1f('0x12a')](db[_0x9f1f('0x145')],{});db[_0x9f1f('0x4c')][_0x9f1f('0x12a')](db[_0x9f1f('0x101')],{'as':'List','foreignKey':_0x9f1f('0x16c')});db[_0x9f1f('0x4c')]['belongsTo'](db[_0x9f1f('0x7c')],{'as':_0x9f1f('0x164'),'foreignKey':_0x9f1f('0x165')});db['MailQueueReport'][_0x9f1f('0x12a')](db[_0x9f1f('0x47')],{});db['MailQueueReport'][_0x9f1f('0x12a')](db[_0x9f1f('0x49')],{});db[_0x9f1f('0x4c')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{});db[_0x9f1f('0x4c')]['belongsTo'](db[_0x9f1f('0x44')],{});db[_0x9f1f('0x17d')][_0x9f1f('0x120')](db[_0x9f1f('0x4e')],{'as':_0x9f1f('0x17e'),'onDelete':_0x9f1f('0x11d')});db[_0x9f1f('0x50')][_0x9f1f('0x120')](db[_0x9f1f('0x8f')],{'as':'Dispositions','foreignKey':'FaxAccountId'});db[_0x9f1f('0x50')][_0x9f1f('0x120')](db[_0x9f1f('0x8d')],{'as':_0x9f1f('0x17f'),'foreignKey':'FaxAccountId'});db[_0x9f1f('0x50')][_0x9f1f('0x120')](db[_0x9f1f('0x54')],{'as':_0x9f1f('0x180')});db[_0x9f1f('0x50')][_0x9f1f('0x120')](db[_0x9f1f('0x52')],{'as':_0x9f1f('0x14e')});db[_0x9f1f('0x50')][_0x9f1f('0x120')](db[_0x9f1f('0x19')],{'as':_0x9f1f('0x181'),'onDelete':'cascade'});db[_0x9f1f('0x50')][_0x9f1f('0x120')](db['FaxMessage'],{'as':'Messages'});db[_0x9f1f('0x50')]['belongsTo'](db[_0x9f1f('0x2d')],{'as':'Trunk'});db['FaxAccount'][_0x9f1f('0x12a')](db[_0x9f1f('0x101')],{'as':_0x9f1f('0x16b'),'foreignKey':_0x9f1f('0x16c')});db[_0x9f1f('0x50')][_0x9f1f('0x12a')](db['Pause'],{'as':_0x9f1f('0x16d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9f1f('0x50')][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':'Agents','through':_0x9f1f('0x144')});db[_0x9f1f('0x52')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'onDelete':'restrict'});db[_0x9f1f('0x52')]['belongsTo'](db[_0x9f1f('0x58')],{'onDelete':_0x9f1f('0x17c')});db[_0x9f1f('0x52')][_0x9f1f('0x12a')](db[_0x9f1f('0x50')],{'onDelete':_0x9f1f('0x17c')});db[_0x9f1f('0x52')][_0x9f1f('0x12a')](db['Tag'],{'onDelete':_0x9f1f('0x17c'),'foreignKey':_0x9f1f('0x182')});db[_0x9f1f('0x54')]['hasMany'](db['FaxMessage'],{'as':_0x9f1f('0x16a'),'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x183')});db[_0x9f1f('0x54')][_0x9f1f('0x12a')](db[_0x9f1f('0x50')],{'as':_0x9f1f('0x171'),'foreignKey':_0x9f1f('0x184')});db['FaxInteraction'][_0x9f1f('0x12a')](db[_0x9f1f('0x7c')],{'as':_0x9f1f('0x164'),'foreignKey':_0x9f1f('0x165')});db['FaxInteraction'][_0x9f1f('0x12a')](db['User'],{'as':_0x9f1f('0x172'),'foreignKey':_0x9f1f('0x11e')});db[_0x9f1f('0x54')][_0x9f1f('0x12b')](db[_0x9f1f('0x175')],{'through':_0x9f1f('0x185'),'as':'Tags'});db[_0x9f1f('0x54')][_0x9f1f('0x12b')](db['Tag'],{'through':_0x9f1f('0x185'),'as':_0x9f1f('0x176')});db[_0x9f1f('0x54')]['belongsToMany'](db['User'],{'as':_0x9f1f('0x177'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x9f1f('0x12a')](db['User'],{'onDelete':_0x9f1f('0x11d'),'as':'User'});db[_0x9f1f('0x56')][_0x9f1f('0x12a')](db['FaxInteraction'],{'as':_0x9f1f('0x179'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x9f1f('0x12a')](db[_0x9f1f('0x7c')],{'onDelete':'cascade','as':_0x9f1f('0x164')});db[_0x9f1f('0x56')][_0x9f1f('0x12a')](db[_0x9f1f('0xf5')],{'as':_0x9f1f('0xf5'),'foreignKey':_0x9f1f('0x186')});db['FaxMessage'][_0x9f1f('0x12a')](db[_0x9f1f('0x50')],{'as':_0x9f1f('0x171'),'foreignKey':_0x9f1f('0x184')});db[_0x9f1f('0x58')][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':'Agents','through':_0x9f1f('0x38')});db[_0x9f1f('0x58')][_0x9f1f('0x12b')](db[_0x9f1f('0xee')],{'through':_0x9f1f('0x187'),'as':'Teams'});db[_0x9f1f('0x5a')]['belongsTo'](db['FaxAccount'],{});db['FaxQueueReport'][_0x9f1f('0x12a')](db[_0x9f1f('0x101')],{'as':_0x9f1f('0x16b'),'foreignKey':'ListId'});db[_0x9f1f('0x5a')][_0x9f1f('0x12a')](db[_0x9f1f('0x7c')],{'as':_0x9f1f('0x164'),'foreignKey':_0x9f1f('0x165')});db[_0x9f1f('0x5a')][_0x9f1f('0x12a')](db[_0x9f1f('0x54')],{});db['FaxQueueReport']['belongsTo'](db['FaxMessage'],{});db[_0x9f1f('0x5a')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{});db[_0x9f1f('0x5a')]['belongsTo'](db[_0x9f1f('0x58')],{});db['SmsAccount'][_0x9f1f('0x120')](db[_0x9f1f('0x8f')],{'as':_0x9f1f('0x169'),'foreignKey':_0x9f1f('0x188')});db[_0x9f1f('0x5c')][_0x9f1f('0x120')](db[_0x9f1f('0x8d')],{'as':_0x9f1f('0x17f'),'foreignKey':_0x9f1f('0x188')});db['SmsAccount'][_0x9f1f('0x120')](db[_0x9f1f('0x62')],{'as':'Messages','foreignKey':_0x9f1f('0x188')});db[_0x9f1f('0x5c')][_0x9f1f('0x120')](db[_0x9f1f('0x60')],{'as':'Interactions'});db['SmsAccount'][_0x9f1f('0x120')](db['SmsApplication'],{'as':_0x9f1f('0x14e')});db[_0x9f1f('0x5c')]['belongsTo'](db['CmList'],{'as':_0x9f1f('0x16b'),'foreignKey':_0x9f1f('0x16c')});db[_0x9f1f('0x5c')]['belongsTo'](db[_0x9f1f('0x94')],{'as':_0x9f1f('0x16d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9f1f('0x5c')]['belongsToMany'](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x15a'),'through':_0x9f1f('0x148')});db[_0x9f1f('0x5e')][_0x9f1f('0x12a')](db['User'],{'onDelete':'restrict'});db[_0x9f1f('0x5e')][_0x9f1f('0x12a')](db['SmsQueue'],{'onDelete':'restrict'});db['SmsApplication'][_0x9f1f('0x12a')](db[_0x9f1f('0x5c')],{'onDelete':_0x9f1f('0x17c')});db[_0x9f1f('0x5e')][_0x9f1f('0x12a')](db['Interval'],{'onDelete':_0x9f1f('0x17c'),'foreignKey':_0x9f1f('0x158')});db[_0x9f1f('0x5e')][_0x9f1f('0x12a')](db['Tag'],{'onDelete':_0x9f1f('0x17c'),'foreignKey':_0x9f1f('0x182')});db[_0x9f1f('0x60')][_0x9f1f('0x120')](db[_0x9f1f('0x62')],{'as':_0x9f1f('0x16a'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x9f1f('0x60')][_0x9f1f('0x12a')](db[_0x9f1f('0x5c')],{'as':_0x9f1f('0x171'),'foreignKey':'SmsAccountId'});db['SmsInteraction'][_0x9f1f('0x12a')](db[_0x9f1f('0x7c')],{'as':_0x9f1f('0x164'),'foreignKey':_0x9f1f('0x165')});db[_0x9f1f('0x60')]['belongsTo'](db[_0x9f1f('0x14')],{'as':'Owner','foreignKey':_0x9f1f('0x11e')});db[_0x9f1f('0x60')][_0x9f1f('0x12b')](db[_0x9f1f('0x175')],{'through':_0x9f1f('0x189'),'as':_0x9f1f('0x174')});db[_0x9f1f('0x60')]['belongsToMany'](db[_0x9f1f('0x175')],{'through':_0x9f1f('0x189'),'as':_0x9f1f('0x176')});db[_0x9f1f('0x60')][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x177'),'through':_0x9f1f('0x136'),'foreignKey':'SmsInteractionId'});db[_0x9f1f('0x62')][_0x9f1f('0x12a')](db['User'],{'as':_0x9f1f('0x14')});db[_0x9f1f('0x62')]['belongsTo'](db[_0x9f1f('0x7c')],{'onDelete':_0x9f1f('0x11d'),'as':_0x9f1f('0x164')});db[_0x9f1f('0x62')][_0x9f1f('0x12a')](db[_0x9f1f('0x60')],{'onDelete':_0x9f1f('0x11d'),'as':_0x9f1f('0x179'),'foreignKey':_0x9f1f('0x18a')});db['SmsMessage']['belongsTo'](db[_0x9f1f('0x5c')],{'as':_0x9f1f('0x171'),'foreignKey':_0x9f1f('0x188')});db[_0x9f1f('0x18b')][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x15a'),'through':'UserSmsQueue','foreignKey':_0x9f1f('0x18c')});db[_0x9f1f('0x18b')]['belongsToMany'](db[_0x9f1f('0xee')],{'through':_0x9f1f('0x18d'),'as':_0x9f1f('0x15b')});db[_0x9f1f('0x64')]['hasMany'](db[_0x9f1f('0x8f')],{'as':_0x9f1f('0x169'),'foreignKey':_0x9f1f('0x18e')});db['OpenchannelAccount'][_0x9f1f('0x120')](db['CannedAnswer'],{'as':_0x9f1f('0x17f'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db[_0x9f1f('0x68')],{'as':_0x9f1f('0x180'),'foreignKey':_0x9f1f('0x18e')});db[_0x9f1f('0x64')][_0x9f1f('0x120')](db[_0x9f1f('0x69')],{'as':'Messages','foreignKey':_0x9f1f('0x18e')});db[_0x9f1f('0x64')][_0x9f1f('0x120')](db[_0x9f1f('0x66')],{'as':_0x9f1f('0x14e'),'foreignKey':_0x9f1f('0x18e')});db[_0x9f1f('0x64')][_0x9f1f('0x12a')](db[_0x9f1f('0x101')],{'as':_0x9f1f('0x16b'),'foreignKey':_0x9f1f('0x16c')});db[_0x9f1f('0x64')][_0x9f1f('0x12a')](db[_0x9f1f('0x94')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x9f1f('0x64')]['belongsToMany'](db['User'],{'as':_0x9f1f('0x15a'),'through':'user_has_openchannel_accounts'});db[_0x9f1f('0x66')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'onDelete':_0x9f1f('0x17c')});db['OpenchannelApplication'][_0x9f1f('0x12a')](db[_0x9f1f('0x6b')],{'onDelete':_0x9f1f('0x17c'),'foreignKey':'OpenchannelQueueId'});db[_0x9f1f('0x66')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x9f1f('0x17c'),'foreignKey':_0x9f1f('0x18e')});db[_0x9f1f('0x66')][_0x9f1f('0x12a')](db[_0x9f1f('0x93')],{'onDelete':'restrict','foreignKey':_0x9f1f('0x158')});db[_0x9f1f('0x66')]['belongsTo'](db['Tag'],{'onDelete':_0x9f1f('0x17c'),'foreignKey':_0x9f1f('0x182')});db[_0x9f1f('0x68')][_0x9f1f('0x120')](db[_0x9f1f('0x69')],{'as':'Messages','onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0x9f1f('0x68')][_0x9f1f('0x12a')](db[_0x9f1f('0x64')],{'as':_0x9f1f('0x171'),'foreignKey':_0x9f1f('0x18e')});db[_0x9f1f('0x68')][_0x9f1f('0x12a')](db[_0x9f1f('0x7c')],{'as':_0x9f1f('0x164'),'foreignKey':'ContactId'});db['OpenchannelInteraction'][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'as':'Owner','foreignKey':_0x9f1f('0x11e')});db[_0x9f1f('0x68')][_0x9f1f('0x12b')](db[_0x9f1f('0x175')],{'through':_0x9f1f('0x18f'),'as':_0x9f1f('0x174')});db[_0x9f1f('0x68')][_0x9f1f('0x12b')](db['Tag'],{'through':_0x9f1f('0x18f'),'as':_0x9f1f('0x176')});db['OpenchannelInteraction'][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x177'),'through':_0x9f1f('0x137'),'foreignKey':_0x9f1f('0x190')});db[_0x9f1f('0x69')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'onDelete':_0x9f1f('0x11d'),'as':_0x9f1f('0x14')});db[_0x9f1f('0x69')][_0x9f1f('0x12a')](db[_0x9f1f('0x7c')],{'onDelete':_0x9f1f('0x11d'),'as':'Contact'});db[_0x9f1f('0x69')][_0x9f1f('0x12a')](db[_0x9f1f('0x68')],{'onDelete':_0x9f1f('0x11d'),'as':'Interaction','foreignKey':_0x9f1f('0x190')});db[_0x9f1f('0x69')]['belongsTo'](db[_0x9f1f('0xf5')],{'as':_0x9f1f('0xf5'),'foreignKey':'AttachmentId'});db[_0x9f1f('0x69')]['belongsTo'](db['OpenchannelAccount'],{'as':_0x9f1f('0x171'),'foreignKey':_0x9f1f('0x18e')});db['OpenchannelQueue'][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x15a'),'through':_0x9f1f('0x13f'),'foreignKey':'OpenchannelQueueId'});db[_0x9f1f('0x6b')]['belongsToMany'](db[_0x9f1f('0xee')],{'through':'team_has_openchannel_queues','as':_0x9f1f('0x15b')});db[_0x9f1f('0x6d')][_0x9f1f('0x120')](db[_0x9f1f('0x8f')],{'as':_0x9f1f('0x169'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite']['hasMany'](db[_0x9f1f('0x8d')],{'as':_0x9f1f('0x17f'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x9f1f('0x120')](db[_0x9f1f('0x79')],{'as':_0x9f1f('0x191')});db[_0x9f1f('0x6d')][_0x9f1f('0x120')](db[_0x9f1f('0x71')],{'as':'Interactions'});db[_0x9f1f('0x6d')]['hasMany'](db['ChatApplication'],{'as':_0x9f1f('0x14e')});db[_0x9f1f('0x6d')][_0x9f1f('0x120')](db[_0x9f1f('0x73')],{'as':_0x9f1f('0x16a')});db['ChatWebsite'][_0x9f1f('0x12a')](db['CmList'],{'as':'List','foreignKey':_0x9f1f('0x16c')});db['ChatWebsite'][_0x9f1f('0x12a')](db[_0x9f1f('0x93')],{'as':_0x9f1f('0x93'),'foreignKey':_0x9f1f('0x158')});db['ChatWebsite'][_0x9f1f('0x12a')](db[_0x9f1f('0x145')],{'as':_0x9f1f('0x145'),'foreignKey':_0x9f1f('0x166')});db[_0x9f1f('0x6d')]['belongsTo'](db[_0x9f1f('0x94')],{'as':_0x9f1f('0x16d'),'foreignKey':_0x9f1f('0x16e')});db['ChatWebsite'][_0x9f1f('0x12b')](db['User'],{'as':_0x9f1f('0x15a'),'through':_0x9f1f('0x142')});db[_0x9f1f('0x6f')][_0x9f1f('0x12a')](db[_0x9f1f('0x64')],{});db[_0x9f1f('0x6f')][_0x9f1f('0x12a')](db[_0x9f1f('0x101')],{'as':_0x9f1f('0x16b'),'foreignKey':_0x9f1f('0x16c')});db['OpenchannelQueueReport'][_0x9f1f('0x12a')](db[_0x9f1f('0x7c')],{'as':_0x9f1f('0x164'),'foreignKey':_0x9f1f('0x165')});db[_0x9f1f('0x6f')][_0x9f1f('0x12a')](db[_0x9f1f('0x68')],{});db[_0x9f1f('0x6f')][_0x9f1f('0x12a')](db[_0x9f1f('0x69')],{});db[_0x9f1f('0x6f')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{});db['OpenchannelQueueReport'][_0x9f1f('0x12a')](db[_0x9f1f('0x6b')],{});db[_0x9f1f('0x70')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x192'),'foreignKey':_0x9f1f('0x11e'),'onDelete':_0x9f1f('0x17c')});db[_0x9f1f('0x70')]['belongsTo'](db[_0x9f1f('0x76')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x9f1f('0x17c')});db[_0x9f1f('0x70')][_0x9f1f('0x12a')](db[_0x9f1f('0x6d')],{'as':_0x9f1f('0x193'),'foreignKey':'ChatWebsiteId','onDelete':_0x9f1f('0x17c')});db[_0x9f1f('0x70')][_0x9f1f('0x12a')](db[_0x9f1f('0x175')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x9f1f('0x71')][_0x9f1f('0x120')](db[_0x9f1f('0x73')],{'as':_0x9f1f('0x16a'),'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x194')});db[_0x9f1f('0x71')][_0x9f1f('0x12a')](db['ChatWebsite'],{'as':_0x9f1f('0x171'),'foreignKey':_0x9f1f('0x17a')});db[_0x9f1f('0x71')][_0x9f1f('0x12a')](db['CmContact'],{'as':_0x9f1f('0x164'),'foreignKey':_0x9f1f('0x165')});db['ChatInteraction'][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x172'),'foreignKey':'UserId'});db[_0x9f1f('0x71')][_0x9f1f('0x12b')](db['Tag'],{'through':_0x9f1f('0x195'),'as':_0x9f1f('0x174')});db['ChatInteraction'][_0x9f1f('0x12b')](db[_0x9f1f('0x175')],{'through':'chat_interaction_has_tags','as':_0x9f1f('0x176')});db[_0x9f1f('0x71')][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x177'),'through':_0x9f1f('0x134'),'foreignKey':_0x9f1f('0x194')});db[_0x9f1f('0x73')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'onDelete':_0x9f1f('0x11d'),'as':_0x9f1f('0x14')});db[_0x9f1f('0x73')]['belongsTo'](db[_0x9f1f('0x7c')],{'onDelete':_0x9f1f('0x11d'),'as':_0x9f1f('0x164'),'foreignKey':_0x9f1f('0x165')});db[_0x9f1f('0x73')][_0x9f1f('0x12a')](db[_0x9f1f('0x71')],{'onDelete':_0x9f1f('0x11d'),'as':_0x9f1f('0x179'),'foreignKey':_0x9f1f('0x194')});db[_0x9f1f('0x73')][_0x9f1f('0x12a')](db[_0x9f1f('0xf5')],{'as':_0x9f1f('0xf5'),'foreignKey':'AttachmentId'});db['ChatMessage']['belongsTo'](db[_0x9f1f('0x6d')],{'as':_0x9f1f('0x171'),'foreignKey':_0x9f1f('0x17a')});db[_0x9f1f('0x17b')]['hasMany'](db['Attachment'],{'as':_0x9f1f('0x178'),'foreignKey':_0x9f1f('0x196'),'onDelete':'cascade','hooks':!![]});db[_0x9f1f('0x17b')][_0x9f1f('0x12a')](db[_0x9f1f('0x7c')],{'onDelete':'cascade','as':_0x9f1f('0x164'),'foreignKey':'ContactId'});db[_0x9f1f('0x17b')]['belongsTo'](db[_0x9f1f('0x6d')],{'as':'Account','foreignKey':_0x9f1f('0x17a')});db[_0x9f1f('0x76')][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x15a'),'through':_0x9f1f('0x34'),'hooks':!![]});db['ChatQueue'][_0x9f1f('0x12b')](db['Team'],{'through':_0x9f1f('0x197'),'as':_0x9f1f('0x15b')});db[_0x9f1f('0x77')]['hasMany'](db['ChatInternalMessage'],{'as':_0x9f1f('0x16a'),'foreignKey':_0x9f1f('0x198'),'onDelete':'cascade'});db[_0x9f1f('0x77')][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x199'),'through':'chat_group_has_users'});db[_0x9f1f('0x79')][_0x9f1f('0x12a')](db[_0x9f1f('0x6d')],{'as':_0x9f1f('0x193'),'foreignKey':_0x9f1f('0x17a')});db[_0x9f1f('0x7a')]['hasMany'](db['CmContact'],{'as':'Contacts','foreignKey':_0x9f1f('0x19a')});db['CmContact']['hasMany'](db[_0x9f1f('0x7e')],{'as':'Hoppers','foreignKey':_0x9f1f('0x165')});db[_0x9f1f('0x7c')][_0x9f1f('0x120')](db[_0x9f1f('0x81')],{'as':_0x9f1f('0x123'),'foreignKey':_0x9f1f('0x165')});db[_0x9f1f('0x7c')][_0x9f1f('0x120')](db[_0x9f1f('0x83')],{'as':_0x9f1f('0x153'),'foreignKey':_0x9f1f('0x165')});db[_0x9f1f('0x7c')][_0x9f1f('0x120')](db[_0x9f1f('0x85')],{'as':_0x9f1f('0x85'),'foreignKey':_0x9f1f('0x165')});db['CmContact'][_0x9f1f('0x120')](db[_0x9f1f('0xdf')],{'as':_0x9f1f('0x155'),'foreignKey':_0x9f1f('0x165')});db[_0x9f1f('0x7c')][_0x9f1f('0x120')](db[_0x9f1f('0x68')],{'as':_0x9f1f('0x125'),'foreignKey':_0x9f1f('0x165'),'onDelete':_0x9f1f('0x17c')});db['CmContact']['hasMany'](db[_0x9f1f('0x71')],{'as':_0x9f1f('0x126'),'foreignKey':_0x9f1f('0x165'),'onDelete':_0x9f1f('0x17c')});db[_0x9f1f('0x7c')][_0x9f1f('0x120')](db[_0x9f1f('0x60')],{'as':_0x9f1f('0x127'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x9f1f('0x7c')][_0x9f1f('0x120')](db[_0x9f1f('0x54')],{'as':_0x9f1f('0x128'),'foreignKey':'ContactId','onDelete':_0x9f1f('0x17c')});db['CmContact'][_0x9f1f('0x120')](db[_0x9f1f('0x47')],{'as':_0x9f1f('0x129'),'foreignKey':_0x9f1f('0x165'),'onDelete':'restrict'});db[_0x9f1f('0x7c')][_0x9f1f('0x12a')](db[_0x9f1f('0x7a')],{'as':'Company','foreignKey':_0x9f1f('0x19a')});db[_0x9f1f('0x7c')]['belongsTo'](db[_0x9f1f('0x101')],{'as':_0x9f1f('0x16b'),'foreignKey':_0x9f1f('0x16c'),'onDelete':_0x9f1f('0x11d')});db[_0x9f1f('0x7c')][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':'Users','through':_0x9f1f('0x12f')});db[_0x9f1f('0x7c')]['belongsToMany'](db[_0x9f1f('0x175')],{'as':_0x9f1f('0x174'),'through':'cm_contact_has_tags'});db['CmContact'][_0x9f1f('0x12b')](db[_0x9f1f('0x175')],{'through':_0x9f1f('0x19b'),'as':_0x9f1f('0x176')});db['CmHopper'][_0x9f1f('0x12a')](db['CmContact'],{'as':_0x9f1f('0x164'),'foreignKey':_0x9f1f('0x165'),'onDelete':_0x9f1f('0x11d')});db['CmHopper'][_0x9f1f('0x12a')](db[_0x9f1f('0x101')],{'as':_0x9f1f('0x16b'),'foreignKey':_0x9f1f('0x16c'),'onDelete':_0x9f1f('0x11d')});db[_0x9f1f('0x7e')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x192'),'foreignKey':_0x9f1f('0x11e')});db[_0x9f1f('0x7e')][_0x9f1f('0x12a')](db[_0x9f1f('0x1c')],{'as':_0x9f1f('0x19c'),'foreignKey':_0x9f1f('0x152'),'onDelete':_0x9f1f('0x11d')});db[_0x9f1f('0x7e')][_0x9f1f('0x12a')](db[_0x9f1f('0xf2')],{'as':_0x9f1f('0xf2'),'foreignKey':_0x9f1f('0x19d'),'onDelete':_0x9f1f('0x11d')});db['CmHopper'][_0x9f1f('0x12a')](db['User'],{'as':_0x9f1f('0x172'),'foreignKey':_0x9f1f('0x19e')});db[_0x9f1f('0x80')][_0x9f1f('0x12a')](db[_0x9f1f('0x7c')],{'as':_0x9f1f('0x164'),'foreignKey':_0x9f1f('0x165'),'onDelete':_0x9f1f('0x11d')});db[_0x9f1f('0x80')]['belongsTo'](db['CmList'],{'as':_0x9f1f('0x16b'),'foreignKey':_0x9f1f('0x16c'),'onDelete':'cascade'});db[_0x9f1f('0x80')][_0x9f1f('0x12a')](db[_0x9f1f('0x1c')],{'as':_0x9f1f('0x19c'),'foreignKey':'VoiceQueueId','onDelete':_0x9f1f('0x11d')});db[_0x9f1f('0x80')][_0x9f1f('0x12a')](db[_0x9f1f('0xf2')],{'as':_0x9f1f('0xf2'),'foreignKey':_0x9f1f('0x19d'),'onDelete':_0x9f1f('0x11d')});db[_0x9f1f('0x8b')][_0x9f1f('0x120')](db[_0x9f1f('0x91')],{'as':{'plural':_0x9f1f('0x19f'),'singular':_0x9f1f('0x1a0')},'foreignKey':_0x9f1f('0x1a1'),'onDelete':'cascade','hooks':!![]});db[_0x9f1f('0x8b')][_0x9f1f('0x120')](db[_0x9f1f('0x91')],{'as':{'plural':'Any','singular':_0x9f1f('0x1a2')},'foreignKey':_0x9f1f('0x1a3'),'onDelete':_0x9f1f('0x11d'),'hooks':!![]});db[_0x9f1f('0x8b')][_0x9f1f('0x120')](db[_0x9f1f('0x89')],{'as':_0x9f1f('0x1a4'),'foreignKey':_0x9f1f('0x1a5'),'onDelete':_0x9f1f('0x11d'),'hooks':!![]});db[_0x9f1f('0x8f')]['hasMany'](db[_0x9f1f('0x8f')],{'as':_0x9f1f('0x169'),'foreignKey':_0x9f1f('0x1a6'),'onDelete':_0x9f1f('0x11d')});db[_0x9f1f('0x93')][_0x9f1f('0x120')](db['Interval'],{'as':_0x9f1f('0x1a7'),'foreignKey':_0x9f1f('0x158'),'onDelete':_0x9f1f('0x11d'),'hooks':!![],'required':![]});db[_0x9f1f('0x93')][_0x9f1f('0x120')](db[_0x9f1f('0x19')],{'as':_0x9f1f('0x1a8'),'foreignKey':_0x9f1f('0x158'),'onDelete':_0x9f1f('0x17c')});db['Interval'][_0x9f1f('0x120')](db['MailApplication'],{'as':_0x9f1f('0x1a9'),'foreignKey':_0x9f1f('0x158')});db[_0x9f1f('0x93')][_0x9f1f('0x120')](db['ChatApplication'],{'as':_0x9f1f('0x1aa'),'foreignKey':_0x9f1f('0x158')});db[_0x9f1f('0x93')][_0x9f1f('0x120')](db[_0x9f1f('0x52')],{'as':_0x9f1f('0x1ab'),'foreignKey':_0x9f1f('0x158')});db[_0x9f1f('0x93')][_0x9f1f('0x120')](db[_0x9f1f('0x5e')],{'as':_0x9f1f('0x1ac'),'foreignKey':'IntervalId'});db[_0x9f1f('0x96')][_0x9f1f('0x12a')](db[_0x9f1f('0x145')],{});db['Schedule'][_0x9f1f('0x12a')](db[_0x9f1f('0xa1')],{'foreignKey':_0x9f1f('0x1ad')});db[_0x9f1f('0x96')][_0x9f1f('0x12a')](db[_0x9f1f('0x9f')],{'foreignKey':_0x9f1f('0x1ae')});db['Sound'][_0x9f1f('0x12b')](db[_0x9f1f('0x1b')],{'as':_0x9f1f('0x1af'),'through':_0x9f1f('0x151'),'onDelete':_0x9f1f('0x17c')});db[_0x9f1f('0x175')]['belongsToMany'](db[_0x9f1f('0x7c')],{'through':_0x9f1f('0x19b')});db[_0x9f1f('0x175')][_0x9f1f('0x12b')](db[_0x9f1f('0x71')],{'through':_0x9f1f('0x195')});db[_0x9f1f('0x175')]['belongsToMany'](db['MailInteraction'],{'through':_0x9f1f('0x173')});db[_0x9f1f('0x175')][_0x9f1f('0x12b')](db[_0x9f1f('0x60')],{'through':_0x9f1f('0x189')});db['Tag'][_0x9f1f('0x12b')](db[_0x9f1f('0x54')],{'through':_0x9f1f('0x185')});db[_0x9f1f('0x175')][_0x9f1f('0x12b')](db[_0x9f1f('0x68')],{'through':_0x9f1f('0x18f')});db[_0x9f1f('0x175')][_0x9f1f('0x12b')](db['WhatsappInteraction'],{'through':_0x9f1f('0x1b0')});db[_0x9f1f('0x1b1')]['hasMany'](db[_0x9f1f('0x91')],{'as':{'plural':_0x9f1f('0x1b2'),'singular':_0x9f1f('0x1b3')},'foreignKey':_0x9f1f('0x1b4'),'onDelete':_0x9f1f('0x11d'),'hooks':!![]});db[_0x9f1f('0x1b1')][_0x9f1f('0x120')](db[_0x9f1f('0x91')],{'as':{'plural':_0x9f1f('0x1b5'),'singular':_0x9f1f('0x1b6')},'foreignKey':_0x9f1f('0x1b7'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x9f1f('0x120')](db[_0x9f1f('0x89')],{'as':'Actions','foreignKey':_0x9f1f('0x1b8'),'onDelete':'cascade','hooks':!![]});db[_0x9f1f('0x9f')][_0x9f1f('0x120')](db[_0x9f1f('0xa6')],{'as':'Fields','onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1ae'),'hooks':!![]});db[_0x9f1f('0xa1')][_0x9f1f('0x120')](db[_0x9f1f('0xa6')],{'as':_0x9f1f('0x1b9'),'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1ad')});db[_0x9f1f('0xa4')]['hasMany'](db[_0x9f1f('0xa6')],{'as':_0x9f1f('0x1b9'),'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1ba')});db['AnalyticFieldReport'][_0x9f1f('0x12a')](db['AnalyticMetric'],{'foreignKey':_0x9f1f('0x1ba')});db[_0x9f1f('0xa9')][_0x9f1f('0x120')](db[_0x9f1f('0xaa')],{'as':_0x9f1f('0x1bb'),'onDelete':'cascade','foreignKey':_0x9f1f('0x1bc')});db[_0x9f1f('0xaa')][_0x9f1f('0x120')](db[_0x9f1f('0xac')],{'as':'Subjects','onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1bd')});db[_0x9f1f('0xaa')]['hasMany'](db[_0x9f1f('0xac')],{'as':_0x9f1f('0x1be'),'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1bf')});db[_0x9f1f('0xaa')][_0x9f1f('0x120')](db[_0x9f1f('0xac')],{'as':_0x9f1f('0x1b9'),'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1c0')});db[_0x9f1f('0xaa')]['belongsTo'](db[_0x9f1f('0xa9')],{'as':_0x9f1f('0x171'),'foreignKey':_0x9f1f('0x1bc')});db[_0x9f1f('0xac')][_0x9f1f('0x120')](db['SalesforceField'],{'as':'Subject','foreignKey':'SubjectId'});db['SalesforceField'][_0x9f1f('0x120')](db[_0x9f1f('0xac')],{'as':_0x9f1f('0x1c1'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0x9f1f('0x120')](db[_0x9f1f('0xac')],{'as':'Field','foreignKey':'FieldId'});db[_0x9f1f('0xac')][_0x9f1f('0x12a')](db['Variable'],{'as':_0x9f1f('0x9b'),'foreignKey':_0x9f1f('0x1c2')});db['SugarcrmAccount'][_0x9f1f('0x120')](db[_0x9f1f('0xaf')],{'as':_0x9f1f('0x1bb'),'onDelete':_0x9f1f('0x11d'),'foreignKey':'AccountId'});db[_0x9f1f('0xaf')][_0x9f1f('0x120')](db['SugarcrmField'],{'as':_0x9f1f('0x1c3'),'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1bd')});db[_0x9f1f('0xaf')][_0x9f1f('0x120')](db[_0x9f1f('0xb1')],{'as':_0x9f1f('0x1be'),'onDelete':_0x9f1f('0x11d'),'foreignKey':'DescriptionId'});db[_0x9f1f('0xaf')][_0x9f1f('0x120')](db[_0x9f1f('0xb1')],{'as':'Fields','onDelete':_0x9f1f('0x11d'),'foreignKey':'FieldId'});db[_0x9f1f('0xaf')][_0x9f1f('0x12a')](db[_0x9f1f('0xae')],{'as':_0x9f1f('0x171'),'foreignKey':_0x9f1f('0x1bc')});db[_0x9f1f('0xb1')][_0x9f1f('0x120')](db['SugarcrmField'],{'as':_0x9f1f('0x1c4'),'foreignKey':_0x9f1f('0x1bd')});db['SugarcrmField'][_0x9f1f('0x120')](db[_0x9f1f('0xb1')],{'as':_0x9f1f('0x1c1'),'foreignKey':_0x9f1f('0x1bf')});db[_0x9f1f('0xb1')]['hasMany'](db['SugarcrmField'],{'as':_0x9f1f('0x1c5'),'foreignKey':_0x9f1f('0x1c0')});db[_0x9f1f('0xb1')][_0x9f1f('0x12a')](db['Variable'],{'as':_0x9f1f('0x9b'),'foreignKey':'VariableId'});db[_0x9f1f('0xb3')]['hasMany'](db[_0x9f1f('0x1c6')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db['DeskConfiguration'][_0x9f1f('0x120')](db[_0x9f1f('0xb5')],{'as':_0x9f1f('0x1c3'),'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1bd')});db[_0x9f1f('0x1c6')][_0x9f1f('0x120')](db[_0x9f1f('0xb5')],{'as':_0x9f1f('0x1be'),'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1bf')});db[_0x9f1f('0x1c6')][_0x9f1f('0x120')](db[_0x9f1f('0xb5')],{'as':'Fields','onDelete':_0x9f1f('0x11d'),'foreignKey':'FieldId'});db[_0x9f1f('0x1c6')][_0x9f1f('0x12a')](db[_0x9f1f('0xb3')],{'as':_0x9f1f('0x171'),'foreignKey':_0x9f1f('0x1bc')});db['DeskConfiguration'][_0x9f1f('0x12b')](db[_0x9f1f('0x175')],{'through':_0x9f1f('0x1c7')});db[_0x9f1f('0xb5')][_0x9f1f('0x120')](db[_0x9f1f('0xb5')],{'as':_0x9f1f('0x1c4'),'foreignKey':_0x9f1f('0x1bd')});db[_0x9f1f('0xb5')]['hasMany'](db['DeskField'],{'as':_0x9f1f('0x1c1'),'foreignKey':'DescriptionId'});db[_0x9f1f('0xb5')][_0x9f1f('0x120')](db['DeskField'],{'as':_0x9f1f('0x1c5'),'foreignKey':_0x9f1f('0x1c0')});db['DeskField']['belongsTo'](db[_0x9f1f('0x9b')],{'as':'Variable','foreignKey':_0x9f1f('0x1c2')});db[_0x9f1f('0xb7')][_0x9f1f('0x120')](db['ZohoConfiguration'],{'as':_0x9f1f('0x1bb'),'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1bc')});db['ZohoConfiguration']['hasMany'](db['ZohoField'],{'as':_0x9f1f('0x1c3'),'onDelete':'cascade','foreignKey':_0x9f1f('0x1bd')});db[_0x9f1f('0xb9')][_0x9f1f('0x120')](db[_0x9f1f('0xbb')],{'as':_0x9f1f('0x1be'),'onDelete':'cascade','foreignKey':_0x9f1f('0x1bf')});db[_0x9f1f('0xb9')][_0x9f1f('0x120')](db[_0x9f1f('0xbb')],{'as':'Fields','onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1c0')});db[_0x9f1f('0xb9')][_0x9f1f('0x12a')](db[_0x9f1f('0xb7')],{'as':_0x9f1f('0x171'),'foreignKey':_0x9f1f('0x1bc')});db[_0x9f1f('0xbb')][_0x9f1f('0x120')](db[_0x9f1f('0xbb')],{'as':_0x9f1f('0x1c4'),'foreignKey':_0x9f1f('0x1bd')});db[_0x9f1f('0xbb')][_0x9f1f('0x120')](db[_0x9f1f('0xbb')],{'as':_0x9f1f('0x1c1'),'foreignKey':'DescriptionId'});db[_0x9f1f('0xbb')][_0x9f1f('0x120')](db[_0x9f1f('0xbb')],{'as':_0x9f1f('0x1c5'),'foreignKey':'FieldId'});db['ZohoField'][_0x9f1f('0x12a')](db[_0x9f1f('0x9b')],{'as':'Variable','foreignKey':_0x9f1f('0x1c2')});db[_0x9f1f('0xbd')][_0x9f1f('0x120')](db[_0x9f1f('0x1c8')],{'as':_0x9f1f('0x1bb'),'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1bc')});db[_0x9f1f('0x1c8')][_0x9f1f('0x120')](db[_0x9f1f('0xbf')],{'as':_0x9f1f('0x1c3'),'foreignKey':_0x9f1f('0x1bd')});db['ZendeskConfiguration']['hasMany'](db[_0x9f1f('0xbf')],{'as':_0x9f1f('0x1be'),'foreignKey':'DescriptionId'});db[_0x9f1f('0x1c8')][_0x9f1f('0x120')](db[_0x9f1f('0xbf')],{'as':_0x9f1f('0x1b9'),'foreignKey':_0x9f1f('0x1c0')});db[_0x9f1f('0x1c8')][_0x9f1f('0x12a')](db[_0x9f1f('0xbd')],{'as':_0x9f1f('0x171'),'foreignKey':_0x9f1f('0x1bc')});db[_0x9f1f('0x1c8')][_0x9f1f('0x12b')](db[_0x9f1f('0x175')],{'through':_0x9f1f('0x1c9')});db[_0x9f1f('0xbf')][_0x9f1f('0x120')](db[_0x9f1f('0xbf')],{'as':_0x9f1f('0x1c4'),'foreignKey':_0x9f1f('0x1bd')});db[_0x9f1f('0xbf')]['hasMany'](db[_0x9f1f('0xbf')],{'as':'Description','foreignKey':_0x9f1f('0x1bf')});db['ZendeskField'][_0x9f1f('0x120')](db[_0x9f1f('0xbf')],{'as':_0x9f1f('0x1c5'),'foreignKey':_0x9f1f('0x1c0')});db[_0x9f1f('0xbf')]['belongsTo'](db[_0x9f1f('0x9b')],{'as':_0x9f1f('0x9b'),'foreignKey':'VariableId'});db[_0x9f1f('0x1ca')]['hasMany'](db[_0x9f1f('0xc1')],{'as':_0x9f1f('0x1bb'),'onDelete':_0x9f1f('0x11d'),'foreignKey':'AccountId'});db['FreshdeskConfiguration']['hasMany'](db[_0x9f1f('0x1cb')],{'as':_0x9f1f('0x1c3'),'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1bd')});db[_0x9f1f('0xc1')][_0x9f1f('0x120')](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1bf')});db[_0x9f1f('0xc1')][_0x9f1f('0x120')](db[_0x9f1f('0x1cb')],{'as':_0x9f1f('0x1b9'),'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1c0')});db['FreshdeskConfiguration']['belongsTo'](db[_0x9f1f('0x1ca')],{'as':_0x9f1f('0x171'),'foreignKey':_0x9f1f('0x1bc')});db[_0x9f1f('0xc1')][_0x9f1f('0x12b')](db[_0x9f1f('0x175')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x9f1f('0x1cb')][_0x9f1f('0x120')](db[_0x9f1f('0x1cb')],{'as':_0x9f1f('0x1c4'),'foreignKey':_0x9f1f('0x1bd')});db[_0x9f1f('0x1cb')]['hasMany'](db['FreshdeskField'],{'as':'Description','foreignKey':_0x9f1f('0x1bf')});db[_0x9f1f('0x1cb')][_0x9f1f('0x120')](db[_0x9f1f('0x1cb')],{'as':_0x9f1f('0x1c5'),'foreignKey':_0x9f1f('0x1c0')});db[_0x9f1f('0x1cb')][_0x9f1f('0x12a')](db['Variable'],{'as':_0x9f1f('0x9b'),'foreignKey':'VariableId'});db[_0x9f1f('0xc4')]['hasMany'](db[_0x9f1f('0xc6')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x9f1f('0x1bc')});db[_0x9f1f('0xc6')][_0x9f1f('0x120')](db[_0x9f1f('0xc8')],{'as':_0x9f1f('0x1c3'),'foreignKey':_0x9f1f('0x1bd')});db[_0x9f1f('0xc6')][_0x9f1f('0x120')](db['VtigerField'],{'as':_0x9f1f('0x1be'),'foreignKey':_0x9f1f('0x1bf')});db['VtigerConfiguration'][_0x9f1f('0x120')](db[_0x9f1f('0xc8')],{'as':_0x9f1f('0x1b9'),'foreignKey':_0x9f1f('0x1c0')});db[_0x9f1f('0xc6')]['belongsTo'](db[_0x9f1f('0xc4')],{'as':_0x9f1f('0x171'),'foreignKey':_0x9f1f('0x1bc')});db['VtigerField'][_0x9f1f('0x120')](db[_0x9f1f('0xc8')],{'as':_0x9f1f('0x1c4'),'foreignKey':_0x9f1f('0x1bd')});db[_0x9f1f('0xc8')][_0x9f1f('0x120')](db['VtigerField'],{'as':'Description','foreignKey':_0x9f1f('0x1bf')});db[_0x9f1f('0xc8')][_0x9f1f('0x120')](db[_0x9f1f('0xc8')],{'as':'Field','foreignKey':_0x9f1f('0x1c0')});db[_0x9f1f('0xc8')][_0x9f1f('0x12a')](db[_0x9f1f('0x9b')],{'as':_0x9f1f('0x9b'),'foreignKey':'VariableId'});db['ServicenowAccount'][_0x9f1f('0x120')](db[_0x9f1f('0xcb')],{'as':_0x9f1f('0x1bb'),'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1bc')});db['ServicenowConfiguration'][_0x9f1f('0x120')](db[_0x9f1f('0xcd')],{'as':_0x9f1f('0x1c3'),'foreignKey':'SubjectId'});db[_0x9f1f('0xcb')]['hasMany'](db[_0x9f1f('0xcd')],{'as':_0x9f1f('0x1be'),'foreignKey':_0x9f1f('0x1bf')});db[_0x9f1f('0xcb')][_0x9f1f('0x120')](db[_0x9f1f('0xcd')],{'as':_0x9f1f('0x1b9'),'foreignKey':'FieldId'});db[_0x9f1f('0xcb')]['belongsTo'](db['ServicenowAccount'],{'as':'Account','foreignKey':_0x9f1f('0x1bc')});db[_0x9f1f('0xcd')]['hasMany'](db['ServicenowField'],{'as':_0x9f1f('0x1c4'),'foreignKey':'SubjectId'});db['ServicenowField']['hasMany'](db[_0x9f1f('0xcd')],{'as':'Description','foreignKey':_0x9f1f('0x1bf')});db['ServicenowField']['hasMany'](db[_0x9f1f('0xcd')],{'as':_0x9f1f('0x1c5'),'foreignKey':_0x9f1f('0x1c0')});db['ServicenowField'][_0x9f1f('0x12a')](db[_0x9f1f('0x9b')],{'as':'Variable','foreignKey':_0x9f1f('0x1c2')});db[_0x9f1f('0x1cc')][_0x9f1f('0x120')](db[_0x9f1f('0x1cd')],{'as':_0x9f1f('0x1bb'),'onDelete':'cascade','foreignKey':_0x9f1f('0x1bc')});db[_0x9f1f('0x1cd')][_0x9f1f('0x120')](db[_0x9f1f('0xd1')],{'as':'Subjects','onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1bd')});db['Dynamics365Configuration'][_0x9f1f('0x120')](db[_0x9f1f('0xd1')],{'as':_0x9f1f('0x1be'),'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1bf')});db['Dynamics365Configuration'][_0x9f1f('0x120')](db[_0x9f1f('0xd1')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x9f1f('0x12a')](db['Dynamics365Account'],{'as':_0x9f1f('0x171'),'foreignKey':_0x9f1f('0x1bc')});db[_0x9f1f('0xd1')][_0x9f1f('0x120')](db[_0x9f1f('0xd1')],{'as':_0x9f1f('0x1c4'),'foreignKey':_0x9f1f('0x1bd')});db[_0x9f1f('0xd1')][_0x9f1f('0x120')](db['Dynamics365Field'],{'as':_0x9f1f('0x1c1'),'foreignKey':_0x9f1f('0x1bf')});db[_0x9f1f('0xd1')][_0x9f1f('0x120')](db[_0x9f1f('0xd1')],{'as':_0x9f1f('0x1c5'),'foreignKey':'FieldId'});db[_0x9f1f('0xd1')][_0x9f1f('0x12a')](db['Variable'],{'as':_0x9f1f('0x9b'),'foreignKey':_0x9f1f('0x1c2')});db['FreshsalesAccount'][_0x9f1f('0x120')](db['FreshsalesConfiguration'],{'as':_0x9f1f('0x1bb'),'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1bc')});db['FreshsalesConfiguration'][_0x9f1f('0x120')](db['FreshsalesField'],{'as':_0x9f1f('0x1c3'),'foreignKey':'SubjectId'});db[_0x9f1f('0x1ce')][_0x9f1f('0x120')](db[_0x9f1f('0xd6')],{'as':_0x9f1f('0x1be'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x9f1f('0x120')](db[_0x9f1f('0xd6')],{'as':_0x9f1f('0x1b9'),'foreignKey':_0x9f1f('0x1c0')});db[_0x9f1f('0x1ce')][_0x9f1f('0x12a')](db[_0x9f1f('0xd3')],{'as':_0x9f1f('0x171'),'foreignKey':'AccountId'});db['FreshsalesField'][_0x9f1f('0x120')](db[_0x9f1f('0xd6')],{'as':'Subject','foreignKey':_0x9f1f('0x1bd')});db[_0x9f1f('0xd6')][_0x9f1f('0x120')](db[_0x9f1f('0xd6')],{'as':_0x9f1f('0x1c1'),'foreignKey':_0x9f1f('0x1bf')});db[_0x9f1f('0xd6')][_0x9f1f('0x120')](db[_0x9f1f('0xd6')],{'as':'Field','foreignKey':_0x9f1f('0x1c0')});db[_0x9f1f('0xd6')][_0x9f1f('0x12a')](db[_0x9f1f('0x9b')],{'as':_0x9f1f('0x9b'),'foreignKey':'VariableId'});db['ChatQueueReport'][_0x9f1f('0x12a')](db[_0x9f1f('0x6d')],{});db[_0x9f1f('0xd9')][_0x9f1f('0x12a')](db[_0x9f1f('0x101')],{'as':_0x9f1f('0x16b'),'foreignKey':'ListId'});db[_0x9f1f('0xd9')][_0x9f1f('0x12a')](db[_0x9f1f('0x7c')],{'as':_0x9f1f('0x164'),'foreignKey':_0x9f1f('0x165')});db[_0x9f1f('0xd9')][_0x9f1f('0x12a')](db[_0x9f1f('0x71')],{});db[_0x9f1f('0xd9')][_0x9f1f('0x12a')](db[_0x9f1f('0x73')],{});db[_0x9f1f('0xd9')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{});db[_0x9f1f('0xd9')][_0x9f1f('0x12a')](db[_0x9f1f('0x76')],{});db[_0x9f1f('0xda')]['belongsTo'](db[_0x9f1f('0x14')],{'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1cf')});db[_0x9f1f('0xda')]['belongsTo'](db[_0x9f1f('0x14')],{'onDelete':_0x9f1f('0x11d'),'foreignKey':_0x9f1f('0x1d0')});db[_0x9f1f('0xdf')]['hasMany'](db[_0x9f1f('0xdd')],{'foreignKey':'SessionId','onDelete':_0x9f1f('0x11d')});db['JscriptySessionReport']['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x9f1f('0x1d1'),'onDelete':_0x9f1f('0x11d')});db['SmsQueueReport']['belongsTo'](db[_0x9f1f('0x5c')],{});db[_0x9f1f('0xe1')][_0x9f1f('0x12a')](db[_0x9f1f('0x101')],{'as':_0x9f1f('0x16b'),'foreignKey':_0x9f1f('0x16c')});db[_0x9f1f('0xe1')][_0x9f1f('0x12a')](db[_0x9f1f('0x7c')],{'as':_0x9f1f('0x164'),'foreignKey':_0x9f1f('0x165')});db[_0x9f1f('0xe1')][_0x9f1f('0x12a')](db['SmsInteraction'],{});db[_0x9f1f('0xe1')]['belongsTo'](db[_0x9f1f('0x62')],{});db[_0x9f1f('0xe1')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{});db[_0x9f1f('0xe1')][_0x9f1f('0x12a')](db[_0x9f1f('0x18b')],{});db[_0x9f1f('0xe4')][_0x9f1f('0x120')](db['JscriptySessionReport'],{'foreignKey':_0x9f1f('0x1d2')});db[_0x9f1f('0xe4')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0x9f1f('0xe4')][_0x9f1f('0x120')](db[_0x9f1f('0x1d3')],{'foreignKey':_0x9f1f('0x1d2')});db['SquareProject']['belongsToMany'](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x177'),'through':'user_has_square_projects'});db[_0x9f1f('0xee')][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x15a'),'through':_0x9f1f('0x132')});db[_0x9f1f('0xee')][_0x9f1f('0x12b')](db[_0x9f1f('0x1c')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db[_0x9f1f('0xee')][_0x9f1f('0x12b')](db[_0x9f1f('0x44')],{'through':'team_has_mail_queues','as':_0x9f1f('0x13a')});db[_0x9f1f('0xee')]['belongsToMany'](db[_0x9f1f('0x76')],{'through':_0x9f1f('0x197'),'as':_0x9f1f('0x13b')});db[_0x9f1f('0xee')]['belongsToMany'](db['FaxQueue'],{'through':_0x9f1f('0x187'),'as':_0x9f1f('0x13c')});db[_0x9f1f('0xee')][_0x9f1f('0x12b')](db[_0x9f1f('0x18b')],{'through':'team_has_sms_queues','as':_0x9f1f('0x13d')});db['Team'][_0x9f1f('0x12b')](db[_0x9f1f('0x6b')],{'through':_0x9f1f('0x1d4'),'as':_0x9f1f('0x13e')});db[_0x9f1f('0xee')][_0x9f1f('0x12b')](db[_0x9f1f('0x114')],{'through':'team_has_whatsapp_queues','as':_0x9f1f('0x140')});db['Campaign'][_0x9f1f('0x120')](db[_0x9f1f('0x7e')],{'as':_0x9f1f('0x1d5'),'foreignKey':'CampaignId'});db[_0x9f1f('0xf2')]['hasMany'](db[_0x9f1f('0x81')],{'as':'HopperFinals','foreignKey':_0x9f1f('0x19d')});db['Campaign']['hasMany'](db[_0x9f1f('0x83')],{'as':_0x9f1f('0x153'),'foreignKey':_0x9f1f('0x19d')});db[_0x9f1f('0xf2')]['hasMany'](db[_0x9f1f('0x80')],{'as':_0x9f1f('0x154'),'foreignKey':_0x9f1f('0x19d')});db['Campaign'][_0x9f1f('0x12a')](db[_0x9f1f('0x2d')],{'as':_0x9f1f('0x2d'),'foreignKey':_0x9f1f('0x156')});db[_0x9f1f('0xf2')]['belongsTo'](db[_0x9f1f('0x2d')],{'as':_0x9f1f('0x157'),'foreignKey':_0x9f1f('0x1d6')});db[_0x9f1f('0xf2')][_0x9f1f('0x12a')](db[_0x9f1f('0x93')],{'as':'Interval','foreignKey':_0x9f1f('0x158')});db[_0x9f1f('0xf2')][_0x9f1f('0x12a')](db[_0x9f1f('0xea')],{'as':_0x9f1f('0xea'),'foreignKey':_0x9f1f('0x1d7')});db['Campaign'][_0x9f1f('0x12b')](db['CmList'],{'as':_0x9f1f('0x130'),'through':_0x9f1f('0x1d8')});db['Campaign']['belongsToMany'](db[_0x9f1f('0x101')],{'as':_0x9f1f('0x15c'),'through':_0x9f1f('0x1d9')});db[_0x9f1f('0xf5')][_0x9f1f('0x12a')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x9f1f('0x196')});db['MailTransferReport'][_0x9f1f('0x12a')](db['MailMessage'],{});db[_0x9f1f('0xf9')][_0x9f1f('0x12a')](db[_0x9f1f('0x47')],{});db[_0x9f1f('0xf9')][_0x9f1f('0x12a')](db['MailAccount'],{'foreignKey':_0x9f1f('0x1da'),'as':_0x9f1f('0x1db')});db[_0x9f1f('0xf9')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'foreignKey':_0x9f1f('0x1dc'),'as':_0x9f1f('0x1dd')});db['MailTransferReport'][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x9f1f('0xf9')][_0x9f1f('0x12a')](db[_0x9f1f('0x44')],{'foreignKey':'ToMailQueueId','as':_0x9f1f('0x1de')});db[_0x9f1f('0xf9')]['belongsTo'](db[_0x9f1f('0x145')],{'foreignKey':_0x9f1f('0x1df'),'as':_0x9f1f('0x1e0')});db[_0x9f1f('0x1e1')][_0x9f1f('0x12a')](db[_0x9f1f('0x73')],{});db[_0x9f1f('0x1e1')][_0x9f1f('0x12a')](db[_0x9f1f('0x71')],{});db[_0x9f1f('0x1e1')]['belongsTo'](db[_0x9f1f('0x6d')],{'foreignKey':_0x9f1f('0x1e2'),'as':_0x9f1f('0x1db')});db[_0x9f1f('0x1e1')][_0x9f1f('0x12a')](db['User'],{'foreignKey':'FromUserId','as':_0x9f1f('0x1dd')});db[_0x9f1f('0x1e1')]['belongsTo'](db['User'],{'foreignKey':_0x9f1f('0x1e3'),'as':_0x9f1f('0x1e4')});db[_0x9f1f('0x1e1')][_0x9f1f('0x12a')](db[_0x9f1f('0x76')],{'foreignKey':_0x9f1f('0x1e5'),'as':_0x9f1f('0x1de')});db[_0x9f1f('0x1e1')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x9f1f('0x1e6'),'as':_0x9f1f('0x1e0')});db[_0x9f1f('0xfc')][_0x9f1f('0x12a')](db[_0x9f1f('0x56')],{});db['FaxTransferReport'][_0x9f1f('0x12a')](db[_0x9f1f('0x54')],{});db['FaxTransferReport']['belongsTo'](db[_0x9f1f('0x50')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0x9f1f('0xfc')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'foreignKey':_0x9f1f('0x1dc'),'as':_0x9f1f('0x1dd')});db[_0x9f1f('0xfc')][_0x9f1f('0x12a')](db['User'],{'foreignKey':_0x9f1f('0x1e3'),'as':_0x9f1f('0x1e4')});db[_0x9f1f('0xfc')][_0x9f1f('0x12a')](db[_0x9f1f('0x58')],{'foreignKey':_0x9f1f('0x1e7'),'as':_0x9f1f('0x1de')});db['FaxTransferReport'][_0x9f1f('0x12a')](db[_0x9f1f('0x50')],{'foreignKey':_0x9f1f('0x1e8'),'as':_0x9f1f('0x1e0')});db['OpenchannelTransferReport'][_0x9f1f('0x12a')](db['OpenchannelMessage'],{});db[_0x9f1f('0x1e9')]['belongsTo'](db[_0x9f1f('0x68')],{});db[_0x9f1f('0x1e9')][_0x9f1f('0x12a')](db[_0x9f1f('0x64')],{'foreignKey':_0x9f1f('0x1ea'),'as':_0x9f1f('0x1db')});db[_0x9f1f('0x1e9')]['belongsTo'](db[_0x9f1f('0x14')],{'foreignKey':_0x9f1f('0x1dc'),'as':_0x9f1f('0x1dd')});db[_0x9f1f('0x1e9')]['belongsTo'](db[_0x9f1f('0x14')],{'foreignKey':_0x9f1f('0x1e3'),'as':_0x9f1f('0x1e4')});db[_0x9f1f('0x1e9')][_0x9f1f('0x12a')](db[_0x9f1f('0x6b')],{'foreignKey':_0x9f1f('0x1eb'),'as':_0x9f1f('0x1de')});db[_0x9f1f('0x1e9')][_0x9f1f('0x12a')](db['OpenchannelAccount'],{'foreignKey':_0x9f1f('0x1ec'),'as':'ToAccount'});db[_0x9f1f('0xff')][_0x9f1f('0x12a')](db[_0x9f1f('0x62')],{});db['SmsTransferReport'][_0x9f1f('0x12a')](db[_0x9f1f('0x60')],{});db[_0x9f1f('0xff')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x9f1f('0x1ed'),'as':_0x9f1f('0x1db')});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x9f1f('0x1dc'),'as':_0x9f1f('0x1dd')});db[_0x9f1f('0xff')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x9f1f('0xff')][_0x9f1f('0x12a')](db[_0x9f1f('0x18b')],{'foreignKey':_0x9f1f('0x1ee'),'as':'ToQueue'});db[_0x9f1f('0xff')][_0x9f1f('0x12a')](db[_0x9f1f('0x5c')],{'foreignKey':_0x9f1f('0x1ef'),'as':'ToAccount'});db[_0x9f1f('0x101')][_0x9f1f('0x120')](db['Disposition'],{'as':_0x9f1f('0x169'),'foreignKey':'ListId'});db['CmList'][_0x9f1f('0x120')](db[_0x9f1f('0x87')],{'as':_0x9f1f('0x1f0'),'foreignKey':_0x9f1f('0x16c')});db['CmList'][_0x9f1f('0x120')](db[_0x9f1f('0x7c')],{'as':_0x9f1f('0x12e'),'onDelete':_0x9f1f('0x11d'),'foreignKey':'ListId'});db['CmList'][_0x9f1f('0x120')](db[_0x9f1f('0x81')],{'as':'HopperFinals','foreignKey':_0x9f1f('0x16c')});db[_0x9f1f('0x101')][_0x9f1f('0x120')](db[_0x9f1f('0x83')],{'as':_0x9f1f('0x124'),'foreignKey':_0x9f1f('0x16c')});db[_0x9f1f('0x101')][_0x9f1f('0x120')](db['ReportAgentPreview'],{'as':_0x9f1f('0x85'),'foreignKey':_0x9f1f('0x16c')});db['CmList'][_0x9f1f('0x12b')](db['VoiceQueue'],{'as':_0x9f1f('0x1f1'),'through':_0x9f1f('0x159')});db[_0x9f1f('0x101')][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x15a'),'through':_0x9f1f('0x131')});db[_0x9f1f('0x103')]['hasMany'](db[_0x9f1f('0x19')],{'as':'Extensions','onDelete':_0x9f1f('0x11d')});db[_0x9f1f('0x103')][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x15a'),'through':'user_has_voice_prefixes'});db['UserProfile'][_0x9f1f('0x120')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x177'),'foreignKey':_0x9f1f('0x1f2')});db[_0x9f1f('0x105')][_0x9f1f('0x120')](db[_0x9f1f('0x107')],{'as':_0x9f1f('0x1f3'),'foreignKey':_0x9f1f('0x1f2'),'onDelete':'cascade'});db[_0x9f1f('0x107')]['hasMany'](db[_0x9f1f('0x1f4')],{'as':_0x9f1f('0x1f5'),'foreignKey':'sectionId','onDelete':_0x9f1f('0x11d')});db[_0x9f1f('0x10c')]['hasMany'](db['Disposition'],{'as':_0x9f1f('0x169'),'foreignKey':_0x9f1f('0x1f6')});db['WhatsappAccount'][_0x9f1f('0x120')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x9f1f('0x1f6')});db['WhatsappAccount']['hasMany'](db[_0x9f1f('0x1f7')],{'as':_0x9f1f('0x16a'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount']['hasMany'](db[_0x9f1f('0x10f')],{'as':_0x9f1f('0x180')});db[_0x9f1f('0x10c')][_0x9f1f('0x120')](db['WhatsappApplication'],{'as':_0x9f1f('0x14e')});db[_0x9f1f('0x10c')][_0x9f1f('0x12a')](db[_0x9f1f('0x101')],{'as':_0x9f1f('0x16b'),'foreignKey':'ListId'});db[_0x9f1f('0x10c')][_0x9f1f('0x12a')](db[_0x9f1f('0x94')],{'as':'mandatoryDispositionPause','foreignKey':_0x9f1f('0x16e')});db[_0x9f1f('0x10c')][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x15a'),'through':_0x9f1f('0x1f8')});db['WhatsappApplication'][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'onDelete':_0x9f1f('0x17c')});db['WhatsappApplication']['belongsTo'](db[_0x9f1f('0x114')],{'onDelete':_0x9f1f('0x17c')});db[_0x9f1f('0x10d')][_0x9f1f('0x12a')](db[_0x9f1f('0x10c')],{'onDelete':'restrict'});db[_0x9f1f('0x10d')]['belongsTo'](db[_0x9f1f('0x93')],{'onDelete':_0x9f1f('0x17c'),'foreignKey':_0x9f1f('0x158')});db['WhatsappApplication']['belongsTo'](db[_0x9f1f('0x175')],{'onDelete':_0x9f1f('0x17c'),'foreignKey':_0x9f1f('0x182')});db[_0x9f1f('0x10f')]['hasMany'](db[_0x9f1f('0x1f7')],{'as':_0x9f1f('0x16a'),'onDelete':_0x9f1f('0x11d'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction']['belongsTo'](db[_0x9f1f('0x10c')],{'as':_0x9f1f('0x171'),'foreignKey':_0x9f1f('0x1f6')});db[_0x9f1f('0x10f')][_0x9f1f('0x12a')](db[_0x9f1f('0x7c')],{'as':_0x9f1f('0x164'),'foreignKey':_0x9f1f('0x165')});db[_0x9f1f('0x10f')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x172'),'foreignKey':_0x9f1f('0x11e')});db['WhatsappInteraction']['belongsToMany'](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x9f1f('0x174')});db[_0x9f1f('0x10f')]['belongsToMany'](db[_0x9f1f('0x175')],{'through':_0x9f1f('0x1b0'),'as':_0x9f1f('0x176')});db[_0x9f1f('0x10f')][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x177'),'through':_0x9f1f('0x138'),'foreignKey':_0x9f1f('0x1f9')});db[_0x9f1f('0x1f7')]['belongsTo'](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x14')});db['WhatsappMessage'][_0x9f1f('0x12a')](db[_0x9f1f('0x7c')],{'onDelete':_0x9f1f('0x11d'),'as':'Contact'});db[_0x9f1f('0x1f7')]['belongsTo'](db[_0x9f1f('0x10f')],{'onDelete':_0x9f1f('0x11d'),'as':_0x9f1f('0x179'),'foreignKey':_0x9f1f('0x1f9')});db[_0x9f1f('0x1f7')][_0x9f1f('0x12a')](db[_0x9f1f('0x10c')],{'as':'Account','foreignKey':_0x9f1f('0x1f6')});db['WhatsappQueueReport'][_0x9f1f('0x12a')](db[_0x9f1f('0x10c')],{});db[_0x9f1f('0x112')]['belongsTo'](db[_0x9f1f('0x101')],{'as':_0x9f1f('0x16b'),'foreignKey':_0x9f1f('0x16c')});db[_0x9f1f('0x112')][_0x9f1f('0x12a')](db[_0x9f1f('0x7c')],{'as':_0x9f1f('0x164'),'foreignKey':_0x9f1f('0x165')});db['WhatsappQueueReport'][_0x9f1f('0x12a')](db[_0x9f1f('0x10f')],{});db[_0x9f1f('0x112')][_0x9f1f('0x12a')](db[_0x9f1f('0x114')],{});db[_0x9f1f('0x112')][_0x9f1f('0x12a')](db[_0x9f1f('0x1f7')],{});db[_0x9f1f('0x112')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{});db[_0x9f1f('0x1fa')]['belongsTo'](db['WhatsappMessage'],{});db['WhatsappTransferReport'][_0x9f1f('0x12a')](db[_0x9f1f('0x10f')],{});db[_0x9f1f('0x1fa')][_0x9f1f('0x12a')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0x9f1f('0x1db')});db[_0x9f1f('0x1fa')][_0x9f1f('0x12a')](db[_0x9f1f('0x10c')],{'foreignKey':_0x9f1f('0x1fb'),'as':_0x9f1f('0x1e0')});db[_0x9f1f('0x1fa')][_0x9f1f('0x12a')](db['WhatsappQueue'],{'foreignKey':_0x9f1f('0x1fc'),'as':_0x9f1f('0x1de')});db[_0x9f1f('0x1fa')][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'foreignKey':_0x9f1f('0x1dc'),'as':'FromAgent'});db['WhatsappTransferReport'][_0x9f1f('0x12a')](db[_0x9f1f('0x14')],{'foreignKey':_0x9f1f('0x1e3'),'as':'ToAgent'});db[_0x9f1f('0x114')][_0x9f1f('0x12b')](db[_0x9f1f('0x14')],{'as':_0x9f1f('0x15a'),'through':'UserWhatsappQueue','foreignKey':_0x9f1f('0x1fd')});db[_0x9f1f('0x114')][_0x9f1f('0x12b')](db[_0x9f1f('0xee')],{'through':_0x9f1f('0x1fe'),'as':'Teams'});module[_0x9f1f('0x1ff')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa7b5=['AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','../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','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','UserId','hasMany','VoiceQueuesRt','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','userProfileId','ChatGroup','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','belongsToMany','Lists','user_has_mail_interactions','ChatInteraction','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueues','WhatsappQueues','cm_user_has_lists','VoicePrefix','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccount','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','HopperBlacks','belongsTo','Trunk','TrunkBackup','Pause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Team','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','MailAccountId','MailServerIn','Imap','Answers','Interactions','List','ListId','Agents','team_has_mail_queues','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','Attachment','Attachments','Interaction','ChatWebsiteId','restrict','IntervalId','TagId','DashboardItem','Items','FaxAccountId','FaxInteraction','Exntensions','FaxMessage','FaxQueue','FaxInteractionId','fax_interaction_has_tags','Tags','ThroughTags','Users','AttachmentId','team_has_fax_queues','Dispositions','SmsAccountId','SmsMessage','mandatoryDispositionPause','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','Teams','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','team_has_chat_queues','ChatInternalMessage','ChatGroupId','CompanyId','Company','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','AutomationAnyId','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','AnalyticFieldReport','Fields','CustomReportId','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','Variable','VariableId','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','ChatQueueReport','FromId','ToId','SessionId','ProjectId','SmsQueues','OpenchannelQueues','WhatsappQueue','TrunkId','TrunkBackupId','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','ChatTransferReport','FromUserId','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','Extensions','UserProfileSections','Resources','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','team_has_whatsapp_queues','exports','path','sequelize','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','password','User','import','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxMessage/faxMessage.model','FaxQueueReport','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model'];(function(_0x3ae34a,_0x143082){var _0x4c9edc=function(_0x2796c8){while(--_0x2796c8){_0x3ae34a['push'](_0x3ae34a['shift']());}};_0x4c9edc(++_0x143082);}(_0xa7b5,0x15a));var _0x5a7b=function(_0x1a0e37,_0x1edae0){_0x1a0e37=_0x1a0e37-0x0;var _0x4ff965=_0xa7b5[_0x1a0e37];return _0x4ff965;};'use strict';var path=require(_0x5a7b('0x0'));var config=require('../config/environment');var Sequelize=require(_0x5a7b('0x1'));var _=require('lodash');var jstz=require(_0x5a7b('0x2'));var timezone=jstz[_0x5a7b('0x3')]();config[_0x5a7b('0x1')]=_[_0x5a7b('0x4')](config[_0x5a7b('0x1')],{'database':_0x5a7b('0x5'),'username':_0x5a7b('0x6'),'password':_0x5a7b('0x7'),'options':{'host':_0x5a7b('0x8'),'port':0xcea,'dialect':_0x5a7b('0x9'),'dialectOptions':{'charset':_0x5a7b('0xa')},'logging':![],'timezone':timezone[_0x5a7b('0xb')](),'define':{'charset':_0x5a7b('0xc'),'collate':_0x5a7b('0xd')}}});config[_0x5a7b('0xe')]=_[_0x5a7b('0x4')](config[_0x5a7b('0xe')],{'database':_0x5a7b('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':_0x5a7b('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x5a7b('0xa')},'logging':![],'timezone':timezone[_0x5a7b('0xb')](),'define':{'charset':_0x5a7b('0xc'),'collate':_0x5a7b('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5a7b('0x1')][_0x5a7b('0xf')],config[_0x5a7b('0x1')][_0x5a7b('0x10')],config[_0x5a7b('0x1')][_0x5a7b('0x11')],config[_0x5a7b('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5a7b('0xe')][_0x5a7b('0xf')],config[_0x5a7b('0xe')][_0x5a7b('0x10')],config['sequelizeHistory'][_0x5a7b('0x11')],config[_0x5a7b('0xe')]['options'])};db[_0x5a7b('0x12')]=db['sequelize'][_0x5a7b('0x13')]('../api/user/user.model');db[_0x5a7b('0x14')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x5a7b('0x15')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0x16'));db[_0x5a7b('0x17')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x18'));db[_0x5a7b('0x19')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x1a'));db[_0x5a7b('0x1b')]=db['sequelize']['import'](_0x5a7b('0x1c'));db[_0x5a7b('0x1d')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x1e'));db['ScreenRecording']=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0x1f'));db[_0x5a7b('0x20')]=db[_0x5a7b('0x1')]['import']('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x21'));db[_0x5a7b('0x22')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x23'));db['VoiceDialReport']=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x24'));db[_0x5a7b('0x25')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x26'));db[_0x5a7b('0x27')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x28'));db[_0x5a7b('0x29')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x2a'));db['Trunk']=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x2b'));db[_0x5a7b('0x2c')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x5a7b('0x2d')]=db['sequelize'][_0x5a7b('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x5a7b('0x2e')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x2f'));db[_0x5a7b('0x30')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0x5a7b('0x31')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0x32'));db[_0x5a7b('0x33')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x34'));db[_0x5a7b('0x35')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/userSmsQueue/userSmsQueue.model');db[_0x5a7b('0x36')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x5a7b('0x37')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x38'));db['MailServerIn']=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x39'));db[_0x5a7b('0x3a')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x3b'));db[_0x5a7b('0x3c')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x3d'));db[_0x5a7b('0x3e')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x3f'));db[_0x5a7b('0x40')]=db['sequelize']['import']('../api/mailSubstatus/mailSubstatus.model');db[_0x5a7b('0x41')]=db['sequelize'][_0x5a7b('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0x5a7b('0x42')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x43'));db[_0x5a7b('0x44')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0x45'));db[_0x5a7b('0x46')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0x47'));db[_0x5a7b('0x48')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x49'));db['DashboardItem']=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x4a'));db['FaxAccount']=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x4b'));db[_0x5a7b('0x4c')]=db['sequelize']['import'](_0x5a7b('0x4d'));db['FaxInteraction']=db[_0x5a7b('0x1')]['import']('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x4e'));db['FaxQueue']=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/faxQueue/faxQueue.model');db[_0x5a7b('0x4f')]=db['sequelize'][_0x5a7b('0x13')]('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x50'));db[_0x5a7b('0x51')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x52'));db[_0x5a7b('0x53')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x54'));db[_0x5a7b('0x55')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/smsQueue/smsQueue.model');db[_0x5a7b('0x56')]=db['sequelize']['import'](_0x5a7b('0x57'));db[_0x5a7b('0x58')]=db['sequelize']['import']('../api/openchannelApplication/openchannelApplication.model');db[_0x5a7b('0x59')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x5a'));db[_0x5a7b('0x5b')]=db['sequelize'][_0x5a7b('0x13')]('../api/openchannelMessage/openchannelMessage.model');db[_0x5a7b('0x5c')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x5d'));db[_0x5a7b('0x5e')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0x5f'));db[_0x5a7b('0x60')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0x61'));db[_0x5a7b('0x62')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0x63'));db['ChatInteraction']=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0x5a7b('0x64')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x65'));db[_0x5a7b('0x66')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x5a7b('0x67')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x68'));db[_0x5a7b('0x69')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x6a'));db[_0x5a7b('0x6b')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x6c'));db['CmContact']=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/cmContact/cmContact.model');db[_0x5a7b('0x6d')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x6e'));db['CmHopperBlack']=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x6f'));db[_0x5a7b('0x70')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x71'));db[_0x5a7b('0x72')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x73'));db['ReportAgentPreview']=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0x74'));db[_0x5a7b('0x75')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0x76'));db[_0x5a7b('0x77')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x78'));db[_0x5a7b('0x79')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x7a'));db[_0x5a7b('0x7b')]=db['sequelize'][_0x5a7b('0x13')]('../api/cannedAnswer/cannedAnswer.model');db[_0x5a7b('0x7c')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0x7d'));db[_0x5a7b('0x7e')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/condition/condition.model');db[_0x5a7b('0x7f')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/interval/interval.model');db['Pause']=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x80'));db[_0x5a7b('0x81')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x82'));db[_0x5a7b('0x83')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x84'));db[_0x5a7b('0x85')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0x86'));db[_0x5a7b('0x87')]=db[_0x5a7b('0x1')]['import']('../api/sound/sound.model');db[_0x5a7b('0x88')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x89'));db[_0x5a7b('0x8a')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x8b'));db[_0x5a7b('0x8c')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x8d'));db['Variable']=db[_0x5a7b('0x1')]['import']('../api/variable/variable.model');db[_0x5a7b('0x8e')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x8f'));db[_0x5a7b('0x90')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0x91'));db[_0x5a7b('0x92')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0x93'));db[_0x5a7b('0x94')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x95'));db[_0x5a7b('0x96')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x97'));db[_0x5a7b('0x98')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0x99'));db['AnalyticFieldReport']=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x9a'));db[_0x5a7b('0x9b')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x9c'));db[_0x5a7b('0x9d')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0x9e'));db['SalesforceField']=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x9f'));db[_0x5a7b('0xa0')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xa1'));db[_0x5a7b('0xa2')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x5a7b('0xa3')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x5a7b('0xa4')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xa5'));db[_0x5a7b('0xa6')]=db['sequelize'][_0x5a7b('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x5a7b('0xa7')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0xa8'));db[_0x5a7b('0xa9')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xaa'));db[_0x5a7b('0xab')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xac'));db[_0x5a7b('0xad')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0xae'));db[_0x5a7b('0xaf')]=db['sequelize'][_0x5a7b('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x5a7b('0xb0')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0xb1'));db[_0x5a7b('0xb2')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xb3'));db[_0x5a7b('0xb4')]=db[_0x5a7b('0x1')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x5a7b('0xb5')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xb6'));db[_0x5a7b('0xb7')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xb8'));db[_0x5a7b('0xb9')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x5a7b('0xba')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xbb'));db[_0x5a7b('0xbc')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xbd'));db['ServicenowAccount']=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x5a7b('0xbe')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xbf'));db[_0x5a7b('0xc0')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xc1'));db[_0x5a7b('0xc2')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0xc3'));db['Dynamics365Field']=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xc4'));db['FreshsalesAccount']=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x5a7b('0xc5')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xc6'));db[_0x5a7b('0xc7')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xc8'));db[_0x5a7b('0x8e')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x8f'));db[_0x5a7b('0xc9')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0xca'));db['ChatQueueReport']=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xcb'));db['ChatInternalMessage']=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xcc'));db[_0x5a7b('0xcd')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0xce'));db[_0x5a7b('0xcf')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xd0'));db[_0x5a7b('0xd1')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xd2'));db[_0x5a7b('0xd3')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0xd4'));db[_0x5a7b('0xd5')]=db['sequelize']['import'](_0x5a7b('0xd6'));db[_0x5a7b('0xd7')]=db[_0x5a7b('0x1')]['import']('../api/squareReportDetail/squareReportDetail.model');db[_0x5a7b('0xd8')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xd9'));db[_0x5a7b('0xda')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xdb'));db[_0x5a7b('0xdc')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xdd'));db[_0x5a7b('0xde')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/squareRecording/squareRecording.model');db[_0x5a7b('0xdf')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0xe0'));db['Team']=db[_0x5a7b('0x1')]['import'](_0x5a7b('0xe1'));db[_0x5a7b('0xe2')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xe3'));db[_0x5a7b('0xe4')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/campaign/campaign.model');db[_0x5a7b('0xe5')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xe6'));db['Attachment']=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xe7'));db[_0x5a7b('0xe8')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0xe9'));db[_0x5a7b('0xea')]=db[_0x5a7b('0x1')]['import']('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/chatTransferReport/chatTransferReport.model');db[_0x5a7b('0xeb')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0xec'));db[_0x5a7b('0xed')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xee'));db[_0x5a7b('0xef')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xf0'));db[_0x5a7b('0xf1')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xf2'));db['VoicePrefix']=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0xf3'));db[_0x5a7b('0xf4')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/userProfile/userProfile.model');db[_0x5a7b('0xf5')]=db['sequelize'][_0x5a7b('0x13')]('../api/userProfileSection/userProfileSection.model');db[_0x5a7b('0xf6')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xf7'));db[_0x5a7b('0xf8')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0xf9'));db[_0x5a7b('0xfa')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0xfb'));db[_0x5a7b('0xfc')]=db[_0x5a7b('0x1')]['import'](_0x5a7b('0xfd'));db[_0x5a7b('0xfe')]=db['sequelize'][_0x5a7b('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x5a7b('0xff')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0x100'));db[_0x5a7b('0x101')]=db['sequelize']['import'](_0x5a7b('0x102'));db[_0x5a7b('0x103')]=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x104'));db['WhatsappQueue']=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x105'));db['CloudProvider']=db[_0x5a7b('0x1')][_0x5a7b('0x13')](_0x5a7b('0x106'));db['Realtime']=db[_0x5a7b('0x1')][_0x5a7b('0x13')]('../api/realtime/realtime.model');db[_0x5a7b('0x107')]=db['sequelize'][_0x5a7b('0x13')](_0x5a7b('0x108'));db[_0x5a7b('0x12')][_0x5a7b('0x109')](db[_0x5a7b('0x20')],{'as':_0x5a7b('0x20'),'onDelete':_0x5a7b('0x10a'),'foreignKey':'UserId'});db[_0x5a7b('0x12')]['hasMany'](db[_0x5a7b('0x1d')],{'as':'Recordings','foreignKey':_0x5a7b('0x10b')});db['User'][_0x5a7b('0x10c')](db['UserVoiceQueueRt'],{'as':_0x5a7b('0x10d'),'foreignKey':_0x5a7b('0x10b')});db['User'][_0x5a7b('0x10c')](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0x5a7b('0x12')]['hasMany'](db['CmHopperFinal'],{'as':_0x5a7b('0x10e'),'foreignKey':_0x5a7b('0x10b')});db[_0x5a7b('0x12')]['hasMany'](db[_0x5a7b('0x72')],{'as':_0x5a7b('0x10f'),'foreignKey':_0x5a7b('0x10b')});db[_0x5a7b('0x12')][_0x5a7b('0x10c')](db[_0x5a7b('0x110')],{'as':_0x5a7b('0x110'),'foreignKey':_0x5a7b('0x10b')});db['User'][_0x5a7b('0x10c')](db[_0x5a7b('0x59')],{'as':_0x5a7b('0x111'),'foreignKey':'UserId'});db[_0x5a7b('0x12')][_0x5a7b('0x10c')](db['ChatInteraction'],{'as':_0x5a7b('0x112'),'foreignKey':_0x5a7b('0x10b')});db[_0x5a7b('0x12')][_0x5a7b('0x10c')](db[_0x5a7b('0x53')],{'as':_0x5a7b('0x113'),'foreignKey':'UserId'});db['User'][_0x5a7b('0x10c')](db['FaxInteraction'],{'as':_0x5a7b('0x114'),'foreignKey':'UserId'});db[_0x5a7b('0x12')][_0x5a7b('0x10c')](db[_0x5a7b('0x41')],{'as':_0x5a7b('0x115'),'foreignKey':_0x5a7b('0x10b')});db['User'][_0x5a7b('0x10c')](db[_0x5a7b('0xfe')],{'as':_0x5a7b('0x116'),'foreignKey':_0x5a7b('0x10b')});db[_0x5a7b('0x12')][_0x5a7b('0x10c')](db[_0x5a7b('0xf8')],{'as':_0x5a7b('0x117'),'foreignKey':'SenderId'});db[_0x5a7b('0x12')]['belongsTo'](db[_0x5a7b('0xf4')],{'as':_0x5a7b('0xf4'),'foreignKey':_0x5a7b('0x118')});db['User']['belongsToMany'](db[_0x5a7b('0x119')],{'as':_0x5a7b('0x11a'),'through':_0x5a7b('0x11b')});db[_0x5a7b('0x12')]['belongsToMany'](db[_0x5a7b('0x11c')],{'as':_0x5a7b('0x11d'),'through':_0x5a7b('0x11e')});db['User'][_0x5a7b('0x11f')](db[_0x5a7b('0xf1')],{'as':_0x5a7b('0x120'),'through':'cm_user_has_lists'});db[_0x5a7b('0x12')][_0x5a7b('0x11f')](db['Team'],{'through':'user_has_teams'});db[_0x5a7b('0x12')][_0x5a7b('0x11f')](db[_0x5a7b('0x41')],{'as':_0x5a7b('0x115'),'through':_0x5a7b('0x121')});db[_0x5a7b('0x12')]['belongsToMany'](db[_0x5a7b('0x122')],{'as':_0x5a7b('0x112'),'through':_0x5a7b('0x123')});db[_0x5a7b('0x12')][_0x5a7b('0x11f')](db['FaxInteraction'],{'as':_0x5a7b('0x114'),'through':_0x5a7b('0x124')});db[_0x5a7b('0x12')][_0x5a7b('0x11f')](db['SmsInteraction'],{'as':_0x5a7b('0x113'),'through':'user_has_sms_interactions'});db['User']['belongsToMany'](db[_0x5a7b('0x59')],{'as':_0x5a7b('0x111'),'through':_0x5a7b('0x125')});db[_0x5a7b('0x12')][_0x5a7b('0x11f')](db[_0x5a7b('0xfe')],{'as':_0x5a7b('0x116'),'through':_0x5a7b('0x126')});db[_0x5a7b('0x12')][_0x5a7b('0x11f')](db['VoiceQueue'],{'as':_0x5a7b('0x127'),'through':_0x5a7b('0x2e'),'required':![]});db['User']['belongsToMany'](db[_0x5a7b('0x3e')],{'as':_0x5a7b('0x128'),'through':'UserMailQueue','required':![]});db[_0x5a7b('0x12')][_0x5a7b('0x11f')](db[_0x5a7b('0x67')],{'as':_0x5a7b('0x129'),'through':_0x5a7b('0x30'),'required':![],'hooks':!![]});db[_0x5a7b('0x12')]['belongsToMany'](db['FaxQueue'],{'as':_0x5a7b('0x12a'),'through':_0x5a7b('0x33'),'required':![]});db[_0x5a7b('0x12')][_0x5a7b('0x11f')](db[_0x5a7b('0x55')],{'as':'SmsQueues','through':_0x5a7b('0x35'),'required':![]});db[_0x5a7b('0x12')]['belongsToMany'](db[_0x5a7b('0x5c')],{'as':'OpenchannelQueues','through':_0x5a7b('0x36'),'required':![]});db['User'][_0x5a7b('0x11f')](db['WhatsappQueue'],{'as':_0x5a7b('0x12b'),'through':'UserWhatsappQueue','required':![]});db[_0x5a7b('0x12')][_0x5a7b('0x11f')](db[_0x5a7b('0xf1')],{'through':_0x5a7b('0x12c')});db['User'][_0x5a7b('0x11f')](db[_0x5a7b('0x12d')],{'as':_0x5a7b('0x12e'),'through':_0x5a7b('0x12f'),'required':![]});db[_0x5a7b('0x12')][_0x5a7b('0x11f')](db[_0x5a7b('0x5e')],{'as':_0x5a7b('0x130'),'through':_0x5a7b('0x131')});db[_0x5a7b('0x12')]['belongsToMany'](db[_0x5a7b('0x132')],{'as':'FaxAccounts','through':_0x5a7b('0x133')});db[_0x5a7b('0x12')][_0x5a7b('0x11f')](db[_0x5a7b('0x3c')],{'as':_0x5a7b('0x134'),'through':_0x5a7b('0x135')});db[_0x5a7b('0x12')][_0x5a7b('0x11f')](db['OpenchannelAccount'],{'as':_0x5a7b('0x136'),'through':_0x5a7b('0x137')});db[_0x5a7b('0x12')][_0x5a7b('0x11f')](db[_0x5a7b('0x138')],{'as':_0x5a7b('0x139'),'through':_0x5a7b('0x13a')});db['User'][_0x5a7b('0x11f')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0x5a7b('0x13b')});db[_0x5a7b('0x12')][_0x5a7b('0x11f')](db[_0x5a7b('0xdc')],{'as':_0x5a7b('0x13c'),'through':_0x5a7b('0x13d')});db[_0x5a7b('0x14')][_0x5a7b('0x10c')](db[_0x5a7b('0x17')],{'as':'SpiedAgents','onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x13e')});db['VoiceContext']['hasMany'](db[_0x5a7b('0x17')],{'onDelete':_0x5a7b('0x10a')});db[_0x5a7b('0x17')]['hasMany'](db[_0x5a7b('0x17')],{'as':_0x5a7b('0x13f'),'onDelete':'cascade'});db['VoiceMusicOnHold'][_0x5a7b('0x11f')](db['Sound'],{'as':_0x5a7b('0x140'),'through':_0x5a7b('0x141')});db[_0x5a7b('0x1b')][_0x5a7b('0x10c')](db[_0x5a7b('0x2d')],{'as':_0x5a7b('0x142'),'foreignKey':_0x5a7b('0x143')});db[_0x5a7b('0x1b')]['hasMany'](db[_0x5a7b('0x6d')],{'as':_0x5a7b('0x144'),'foreignKey':_0x5a7b('0x143')});db[_0x5a7b('0x1b')][_0x5a7b('0x10c')](db[_0x5a7b('0x70')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0x5a7b('0x1b')][_0x5a7b('0x10c')](db[_0x5a7b('0x72')],{'as':_0x5a7b('0x145'),'foreignKey':_0x5a7b('0x143')});db['VoiceQueue'][_0x5a7b('0x10c')](db[_0x5a7b('0x110')],{'as':_0x5a7b('0x110'),'foreignKey':_0x5a7b('0x143')});db[_0x5a7b('0x1b')][_0x5a7b('0x10c')](db[_0x5a7b('0x146')],{'as':_0x5a7b('0x147'),'foreignKey':_0x5a7b('0x143')});db[_0x5a7b('0x1b')][_0x5a7b('0x10c')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x5a7b('0x143')});db[_0x5a7b('0x1b')][_0x5a7b('0x148')](db[_0x5a7b('0x149')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x5a7b('0x1b')][_0x5a7b('0x148')](db[_0x5a7b('0x149')],{'as':_0x5a7b('0x14a'),'foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0x5a7b('0x148')](db[_0x5a7b('0x7f')],{'as':_0x5a7b('0x7f'),'foreignKey':'IntervalId'});db[_0x5a7b('0x1b')]['belongsTo'](db[_0x5a7b('0x14b')],{'as':'mandatoryDispositionPause','foreignKey':_0x5a7b('0x14c')});db[_0x5a7b('0x1b')]['belongsToMany'](db['CmList'],{'as':_0x5a7b('0x120'),'through':_0x5a7b('0x14d')});db[_0x5a7b('0x1b')][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':'Agents','through':'UserVoiceQueue'});db['VoiceQueue'][_0x5a7b('0x11f')](db[_0x5a7b('0x14e')],{'as':'Teams','through':_0x5a7b('0x107')});db['VoiceQueue'][_0x5a7b('0x11f')](db[_0x5a7b('0xf1')],{'as':'BlackLists','through':_0x5a7b('0x14f')});db[_0x5a7b('0x1d')]['belongsTo'](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x12'),'foreignKey':_0x5a7b('0x10b')});db['ScreenRecording'][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x12'),'foreignKey':_0x5a7b('0x10b')});db[_0x5a7b('0x20')][_0x5a7b('0x10c')](db[_0x5a7b('0x150')],{'as':_0x5a7b('0x151'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x152'),'sourceKey':_0x5a7b('0x153')});db[_0x5a7b('0x150')][_0x5a7b('0x148')](db[_0x5a7b('0x20')],{'foreignKey':_0x5a7b('0x152'),'targetKey':'mailbox'});db[_0x5a7b('0x22')][_0x5a7b('0x10c')](db[_0x5a7b('0x27')],{'as':_0x5a7b('0x154'),'foreignKey':_0x5a7b('0x155'),'constraints':![]});db[_0x5a7b('0x22')][_0x5a7b('0x10c')](db[_0x5a7b('0x25')],{'as':_0x5a7b('0x156'),'foreignKey':_0x5a7b('0x155'),'constraints':![]});db[_0x5a7b('0x22')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x12'),'foreignKey':_0x5a7b('0x10b')});db['VoiceCallReport']['belongsTo'](db[_0x5a7b('0x11c')],{'as':_0x5a7b('0x157'),'foreignKey':'ContactId'});db['MailServerIn'][_0x5a7b('0x148')](db['MailAccount'],{'as':_0x5a7b('0x3c'),'foreignKey':_0x5a7b('0x158')});db['MailServerOut'][_0x5a7b('0x148')](db[_0x5a7b('0x3c')],{'as':_0x5a7b('0x3c'),'foreignKey':_0x5a7b('0x158')});db[_0x5a7b('0x3c')][_0x5a7b('0x109')](db[_0x5a7b('0x159')],{'as':_0x5a7b('0x15a'),'onDelete':_0x5a7b('0x10a')});db[_0x5a7b('0x3c')][_0x5a7b('0x109')](db['MailServerOut'],{'as':'Smtp','onDelete':_0x5a7b('0x10a')});db[_0x5a7b('0x3c')]['hasMany'](db[_0x5a7b('0x7c')],{'as':'Dispositions','foreignKey':'MailAccountId'});db['MailAccount'][_0x5a7b('0x10c')](db[_0x5a7b('0x7b')],{'as':_0x5a7b('0x15b'),'foreignKey':'MailAccountId'});db[_0x5a7b('0x3c')][_0x5a7b('0x10c')](db['MailMessage'],{'as':_0x5a7b('0x151'),'foreignKey':_0x5a7b('0x158')});db[_0x5a7b('0x3c')][_0x5a7b('0x10c')](db[_0x5a7b('0x41')],{'as':_0x5a7b('0x15c')});db[_0x5a7b('0x3c')]['hasMany'](db[_0x5a7b('0x44')],{'as':_0x5a7b('0x13f')});db[_0x5a7b('0x3c')][_0x5a7b('0x148')](db['CmList'],{'as':_0x5a7b('0x15d'),'foreignKey':_0x5a7b('0x15e')});db[_0x5a7b('0x3c')][_0x5a7b('0x148')](db['Template'],{'as':'Template','foreignKey':'TemplateId'});db['MailAccount']['belongsTo'](db[_0x5a7b('0x14b')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x5a7b('0x3c')][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x15f'),'through':'user_has_mail_accounts'});db[_0x5a7b('0x3e')]['belongsToMany'](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x15f'),'through':_0x5a7b('0x31')});db['MailQueue']['belongsToMany'](db[_0x5a7b('0x14e')],{'through':_0x5a7b('0x160'),'as':'Teams'});db[_0x5a7b('0x41')]['hasMany'](db[_0x5a7b('0x42')],{'as':_0x5a7b('0x151'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x161')});db[_0x5a7b('0x41')]['belongsTo'](db[_0x5a7b('0x3c')],{'as':_0x5a7b('0x162'),'foreignKey':'MailAccountId'});db['MailInteraction'][_0x5a7b('0x148')](db[_0x5a7b('0x11c')],{'as':_0x5a7b('0x157'),'foreignKey':_0x5a7b('0x163')});db[_0x5a7b('0x41')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x164'),'foreignKey':_0x5a7b('0x10b')});db[_0x5a7b('0x41')][_0x5a7b('0x11f')](db[_0x5a7b('0x88')],{'through':'mail_interaction_has_tags','as':'Tags'});db['MailInteraction'][_0x5a7b('0x11f')](db[_0x5a7b('0x88')],{'through':_0x5a7b('0x165'),'as':'ThroughTags'});db[_0x5a7b('0x41')]['belongsToMany'](db[_0x5a7b('0x12')],{'as':'Users','through':_0x5a7b('0x121'),'foreignKey':_0x5a7b('0x161')});db[_0x5a7b('0x42')][_0x5a7b('0x10c')](db[_0x5a7b('0x166')],{'as':_0x5a7b('0x167'),'onDelete':_0x5a7b('0x10a')});db[_0x5a7b('0x42')][_0x5a7b('0x148')](db['User'],{'as':'User'});db[_0x5a7b('0x42')]['belongsTo'](db[_0x5a7b('0x11c')],{'onDelete':_0x5a7b('0x10a'),'as':'Contact'});db['MailMessage'][_0x5a7b('0x148')](db[_0x5a7b('0x41')],{'as':_0x5a7b('0x168'),'foreignKey':_0x5a7b('0x161')});db['MailMessage'][_0x5a7b('0x148')](db['MailAccount'],{'as':_0x5a7b('0x162'),'foreignKey':_0x5a7b('0x158')});db[_0x5a7b('0x42')][_0x5a7b('0x148')](db[_0x5a7b('0x5e')],{'as':_0x5a7b('0x5e'),'foreignKey':_0x5a7b('0x169')});db[_0x5a7b('0x42')][_0x5a7b('0x148')](db[_0x5a7b('0x66')],{'as':_0x5a7b('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x5a7b('0x44')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{'onDelete':_0x5a7b('0x16a')});db[_0x5a7b('0x44')][_0x5a7b('0x148')](db['MailQueue'],{'onDelete':'restrict'});db[_0x5a7b('0x44')][_0x5a7b('0x148')](db[_0x5a7b('0x3c')],{'onDelete':_0x5a7b('0x16a')});db['MailApplication'][_0x5a7b('0x148')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x5a7b('0x16b')});db['MailApplication'][_0x5a7b('0x148')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x5a7b('0x16c')});db[_0x5a7b('0x46')][_0x5a7b('0x148')](db[_0x5a7b('0x3c')],{});db[_0x5a7b('0x46')][_0x5a7b('0x148')](db['CmList'],{'as':_0x5a7b('0x15d'),'foreignKey':'ListId'});db[_0x5a7b('0x46')]['belongsTo'](db[_0x5a7b('0x11c')],{'as':_0x5a7b('0x157'),'foreignKey':_0x5a7b('0x163')});db[_0x5a7b('0x46')][_0x5a7b('0x148')](db[_0x5a7b('0x41')],{});db[_0x5a7b('0x46')][_0x5a7b('0x148')](db[_0x5a7b('0x42')],{});db[_0x5a7b('0x46')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{});db['MailQueueReport']['belongsTo'](db[_0x5a7b('0x3e')],{});db['Dashboard']['hasMany'](db[_0x5a7b('0x16d')],{'as':_0x5a7b('0x16e'),'onDelete':'cascade'});db[_0x5a7b('0x132')]['hasMany'](db[_0x5a7b('0x7c')],{'as':'Dispositions','foreignKey':_0x5a7b('0x16f')});db[_0x5a7b('0x132')][_0x5a7b('0x10c')](db['CannedAnswer'],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0x5a7b('0x132')][_0x5a7b('0x10c')](db[_0x5a7b('0x170')],{'as':_0x5a7b('0x15c')});db[_0x5a7b('0x132')][_0x5a7b('0x10c')](db[_0x5a7b('0x4c')],{'as':_0x5a7b('0x13f')});db[_0x5a7b('0x132')]['hasMany'](db[_0x5a7b('0x17')],{'as':_0x5a7b('0x171'),'onDelete':_0x5a7b('0x10a')});db[_0x5a7b('0x132')]['hasMany'](db[_0x5a7b('0x172')],{'as':'Messages'});db[_0x5a7b('0x132')][_0x5a7b('0x148')](db[_0x5a7b('0x149')],{'as':_0x5a7b('0x149')});db['FaxAccount'][_0x5a7b('0x148')](db[_0x5a7b('0xf1')],{'as':_0x5a7b('0x15d'),'foreignKey':'ListId'});db[_0x5a7b('0x132')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x5a7b('0x14c')});db[_0x5a7b('0x132')][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x15f'),'through':_0x5a7b('0x133')});db['FaxApplication']['belongsTo'](db[_0x5a7b('0x12')],{'onDelete':_0x5a7b('0x16a')});db[_0x5a7b('0x4c')][_0x5a7b('0x148')](db[_0x5a7b('0x173')],{'onDelete':_0x5a7b('0x16a')});db[_0x5a7b('0x4c')][_0x5a7b('0x148')](db[_0x5a7b('0x132')],{'onDelete':_0x5a7b('0x16a')});db['FaxApplication']['belongsTo'](db['Tag'],{'onDelete':_0x5a7b('0x16a'),'foreignKey':_0x5a7b('0x16c')});db[_0x5a7b('0x170')]['hasMany'](db[_0x5a7b('0x172')],{'as':'Messages','onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x174')});db['FaxInteraction']['belongsTo'](db[_0x5a7b('0x132')],{'as':_0x5a7b('0x162'),'foreignKey':_0x5a7b('0x16f')});db[_0x5a7b('0x170')][_0x5a7b('0x148')](db[_0x5a7b('0x11c')],{'as':'Contact','foreignKey':_0x5a7b('0x163')});db[_0x5a7b('0x170')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{'as':'Owner','foreignKey':_0x5a7b('0x10b')});db['FaxInteraction']['belongsToMany'](db[_0x5a7b('0x88')],{'through':_0x5a7b('0x175'),'as':_0x5a7b('0x176')});db['FaxInteraction'][_0x5a7b('0x11f')](db[_0x5a7b('0x88')],{'through':_0x5a7b('0x175'),'as':_0x5a7b('0x177')});db[_0x5a7b('0x170')][_0x5a7b('0x11f')](db['User'],{'as':_0x5a7b('0x178'),'through':'user_has_fax_interactions','foreignKey':_0x5a7b('0x174')});db[_0x5a7b('0x172')]['belongsTo'](db[_0x5a7b('0x12')],{'onDelete':_0x5a7b('0x10a'),'as':_0x5a7b('0x12')});db['FaxMessage'][_0x5a7b('0x148')](db['FaxInteraction'],{'as':_0x5a7b('0x168'),'foreignKey':'FaxInteractionId'});db['FaxMessage']['belongsTo'](db[_0x5a7b('0x11c')],{'onDelete':_0x5a7b('0x10a'),'as':_0x5a7b('0x157')});db[_0x5a7b('0x172')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0x5a7b('0x179')});db[_0x5a7b('0x172')][_0x5a7b('0x148')](db[_0x5a7b('0x132')],{'as':'Account','foreignKey':_0x5a7b('0x16f')});db['FaxQueue'][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x15f'),'through':_0x5a7b('0x33')});db['FaxQueue']['belongsToMany'](db[_0x5a7b('0x14e')],{'through':_0x5a7b('0x17a'),'as':'Teams'});db['FaxQueueReport'][_0x5a7b('0x148')](db[_0x5a7b('0x132')],{});db[_0x5a7b('0x4f')][_0x5a7b('0x148')](db[_0x5a7b('0xf1')],{'as':_0x5a7b('0x15d'),'foreignKey':_0x5a7b('0x15e')});db['FaxQueueReport'][_0x5a7b('0x148')](db[_0x5a7b('0x11c')],{'as':'Contact','foreignKey':_0x5a7b('0x163')});db['FaxQueueReport'][_0x5a7b('0x148')](db['FaxInteraction'],{});db[_0x5a7b('0x4f')][_0x5a7b('0x148')](db[_0x5a7b('0x172')],{});db[_0x5a7b('0x4f')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{});db[_0x5a7b('0x4f')][_0x5a7b('0x148')](db[_0x5a7b('0x173')],{});db[_0x5a7b('0x138')]['hasMany'](db['Disposition'],{'as':_0x5a7b('0x17b'),'foreignKey':_0x5a7b('0x17c')});db[_0x5a7b('0x138')]['hasMany'](db['CannedAnswer'],{'as':_0x5a7b('0x15b'),'foreignKey':_0x5a7b('0x17c')});db['SmsAccount'][_0x5a7b('0x10c')](db[_0x5a7b('0x17d')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x5a7b('0x138')]['hasMany'](db['SmsInteraction'],{'as':_0x5a7b('0x15c')});db['SmsAccount'][_0x5a7b('0x10c')](db[_0x5a7b('0x51')],{'as':_0x5a7b('0x13f')});db[_0x5a7b('0x138')][_0x5a7b('0x148')](db[_0x5a7b('0xf1')],{'as':_0x5a7b('0x15d'),'foreignKey':_0x5a7b('0x15e')});db[_0x5a7b('0x138')]['belongsTo'](db[_0x5a7b('0x14b')],{'as':_0x5a7b('0x17e'),'foreignKey':_0x5a7b('0x14c')});db[_0x5a7b('0x138')][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x15f'),'through':_0x5a7b('0x13a')});db[_0x5a7b('0x51')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{'onDelete':_0x5a7b('0x16a')});db[_0x5a7b('0x51')][_0x5a7b('0x148')](db[_0x5a7b('0x55')],{'onDelete':_0x5a7b('0x16a')});db[_0x5a7b('0x51')][_0x5a7b('0x148')](db[_0x5a7b('0x138')],{'onDelete':'restrict'});db[_0x5a7b('0x51')][_0x5a7b('0x148')](db[_0x5a7b('0x7f')],{'onDelete':_0x5a7b('0x16a'),'foreignKey':_0x5a7b('0x16b')});db[_0x5a7b('0x51')]['belongsTo'](db[_0x5a7b('0x88')],{'onDelete':'restrict','foreignKey':_0x5a7b('0x16c')});db['SmsInteraction'][_0x5a7b('0x10c')](db[_0x5a7b('0x17d')],{'as':_0x5a7b('0x151'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x17f')});db[_0x5a7b('0x53')][_0x5a7b('0x148')](db[_0x5a7b('0x138')],{'as':_0x5a7b('0x162'),'foreignKey':_0x5a7b('0x17c')});db[_0x5a7b('0x53')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x5a7b('0x53')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x164'),'foreignKey':_0x5a7b('0x10b')});db[_0x5a7b('0x53')][_0x5a7b('0x11f')](db['Tag'],{'through':_0x5a7b('0x180'),'as':'Tags'});db[_0x5a7b('0x53')][_0x5a7b('0x11f')](db[_0x5a7b('0x88')],{'through':_0x5a7b('0x180'),'as':'ThroughTags'});db[_0x5a7b('0x53')][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x178'),'through':_0x5a7b('0x181'),'foreignKey':_0x5a7b('0x17f')});db['SmsMessage'][_0x5a7b('0x148')](db['User'],{'as':_0x5a7b('0x12')});db[_0x5a7b('0x17d')][_0x5a7b('0x148')](db[_0x5a7b('0x11c')],{'onDelete':'cascade','as':_0x5a7b('0x157')});db['SmsMessage'][_0x5a7b('0x148')](db['SmsInteraction'],{'onDelete':_0x5a7b('0x10a'),'as':_0x5a7b('0x168'),'foreignKey':'SmsInteractionId'});db[_0x5a7b('0x17d')][_0x5a7b('0x148')](db[_0x5a7b('0x138')],{'as':_0x5a7b('0x162'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x15f'),'through':_0x5a7b('0x35'),'foreignKey':_0x5a7b('0x182')});db[_0x5a7b('0x55')]['belongsToMany'](db[_0x5a7b('0x14e')],{'through':_0x5a7b('0x183'),'as':'Teams'});db['OpenchannelAccount'][_0x5a7b('0x10c')](db[_0x5a7b('0x7c')],{'as':_0x5a7b('0x17b'),'foreignKey':_0x5a7b('0x184')});db[_0x5a7b('0x56')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0x5a7b('0x56')]['hasMany'](db[_0x5a7b('0x59')],{'as':_0x5a7b('0x15c'),'foreignKey':_0x5a7b('0x184')});db[_0x5a7b('0x56')][_0x5a7b('0x10c')](db[_0x5a7b('0x5b')],{'as':_0x5a7b('0x151'),'foreignKey':_0x5a7b('0x184')});db[_0x5a7b('0x56')][_0x5a7b('0x10c')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['belongsTo'](db[_0x5a7b('0xf1')],{'as':'List','foreignKey':_0x5a7b('0x15e')});db[_0x5a7b('0x56')][_0x5a7b('0x148')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x5a7b('0x14c')});db[_0x5a7b('0x56')][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x15f'),'through':_0x5a7b('0x137')});db['OpenchannelApplication']['belongsTo'](db['User'],{'onDelete':_0x5a7b('0x16a')});db[_0x5a7b('0x58')]['belongsTo'](db[_0x5a7b('0x5c')],{'onDelete':_0x5a7b('0x16a'),'foreignKey':'OpenchannelQueueId'});db[_0x5a7b('0x58')][_0x5a7b('0x148')](db['OpenchannelAccount'],{'onDelete':_0x5a7b('0x16a'),'foreignKey':'OpenchannelAccountId'});db[_0x5a7b('0x58')]['belongsTo'](db[_0x5a7b('0x7f')],{'onDelete':_0x5a7b('0x16a'),'foreignKey':'IntervalId'});db[_0x5a7b('0x58')][_0x5a7b('0x148')](db[_0x5a7b('0x88')],{'onDelete':_0x5a7b('0x16a'),'foreignKey':_0x5a7b('0x16c')});db[_0x5a7b('0x59')]['hasMany'](db[_0x5a7b('0x5b')],{'as':'Messages','onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x185')});db[_0x5a7b('0x59')][_0x5a7b('0x148')](db[_0x5a7b('0x56')],{'as':_0x5a7b('0x162'),'foreignKey':_0x5a7b('0x184')});db[_0x5a7b('0x59')][_0x5a7b('0x148')](db['CmContact'],{'as':_0x5a7b('0x157'),'foreignKey':'ContactId'});db[_0x5a7b('0x59')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x164'),'foreignKey':_0x5a7b('0x10b')});db[_0x5a7b('0x59')][_0x5a7b('0x11f')](db['Tag'],{'through':_0x5a7b('0x186'),'as':_0x5a7b('0x176')});db[_0x5a7b('0x59')][_0x5a7b('0x11f')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0x5a7b('0x59')]['belongsToMany'](db[_0x5a7b('0x12')],{'as':'Users','through':_0x5a7b('0x125'),'foreignKey':_0x5a7b('0x185')});db[_0x5a7b('0x5b')]['belongsTo'](db[_0x5a7b('0x12')],{'onDelete':'cascade','as':_0x5a7b('0x12')});db[_0x5a7b('0x5b')][_0x5a7b('0x148')](db[_0x5a7b('0x11c')],{'onDelete':_0x5a7b('0x10a'),'as':'Contact'});db[_0x5a7b('0x5b')][_0x5a7b('0x148')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x5a7b('0x168'),'foreignKey':_0x5a7b('0x185')});db[_0x5a7b('0x5b')]['belongsTo'](db[_0x5a7b('0x166')],{'as':_0x5a7b('0x166'),'foreignKey':_0x5a7b('0x179')});db['OpenchannelMessage'][_0x5a7b('0x148')](db['OpenchannelAccount'],{'as':_0x5a7b('0x162'),'foreignKey':_0x5a7b('0x184')});db[_0x5a7b('0x5c')][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x15f'),'through':_0x5a7b('0x36'),'foreignKey':_0x5a7b('0x187')});db[_0x5a7b('0x5c')][_0x5a7b('0x11f')](db['Team'],{'through':_0x5a7b('0x188'),'as':_0x5a7b('0x189')});db[_0x5a7b('0x5e')][_0x5a7b('0x10c')](db[_0x5a7b('0x7c')],{'as':_0x5a7b('0x17b'),'foreignKey':_0x5a7b('0x169')});db['ChatWebsite'][_0x5a7b('0x10c')](db[_0x5a7b('0x7b')],{'as':_0x5a7b('0x15b'),'foreignKey':'ChatWebsiteId'});db[_0x5a7b('0x5e')][_0x5a7b('0x10c')](db[_0x5a7b('0x69')],{'as':'ProactiveActions'});db[_0x5a7b('0x5e')][_0x5a7b('0x10c')](db[_0x5a7b('0x122')],{'as':'Interactions'});db[_0x5a7b('0x5e')]['hasMany'](db[_0x5a7b('0x62')],{'as':'Applications'});db[_0x5a7b('0x5e')]['hasMany'](db['ChatMessage'],{'as':_0x5a7b('0x151')});db[_0x5a7b('0x5e')][_0x5a7b('0x148')](db[_0x5a7b('0xf1')],{'as':_0x5a7b('0x15d'),'foreignKey':_0x5a7b('0x15e')});db[_0x5a7b('0x5e')][_0x5a7b('0x148')](db[_0x5a7b('0x7f')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x5a7b('0x5e')][_0x5a7b('0x148')](db[_0x5a7b('0x3c')],{'as':_0x5a7b('0x3c'),'foreignKey':'MailAccountId'});db['ChatWebsite']['belongsTo'](db[_0x5a7b('0x14b')],{'as':_0x5a7b('0x17e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x5a7b('0x5e')][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':'Agents','through':_0x5a7b('0x131')});db[_0x5a7b('0x60')][_0x5a7b('0x148')](db[_0x5a7b('0x56')],{});db[_0x5a7b('0x60')][_0x5a7b('0x148')](db[_0x5a7b('0xf1')],{'as':_0x5a7b('0x15d'),'foreignKey':_0x5a7b('0x15e')});db[_0x5a7b('0x60')][_0x5a7b('0x148')](db[_0x5a7b('0x11c')],{'as':'Contact','foreignKey':'ContactId'});db['OpenchannelQueueReport'][_0x5a7b('0x148')](db[_0x5a7b('0x59')],{});db[_0x5a7b('0x60')][_0x5a7b('0x148')](db[_0x5a7b('0x5b')],{});db['OpenchannelQueueReport'][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{});db[_0x5a7b('0x60')][_0x5a7b('0x148')](db[_0x5a7b('0x5c')],{});db[_0x5a7b('0x62')][_0x5a7b('0x148')](db['User'],{'as':_0x5a7b('0x18a'),'foreignKey':_0x5a7b('0x10b'),'onDelete':'restrict'});db[_0x5a7b('0x62')]['belongsTo'](db[_0x5a7b('0x67')],{'as':_0x5a7b('0x18b'),'foreignKey':_0x5a7b('0x18c'),'onDelete':_0x5a7b('0x16a')});db['ChatApplication'][_0x5a7b('0x148')](db[_0x5a7b('0x5e')],{'as':_0x5a7b('0x18d'),'foreignKey':'ChatWebsiteId','onDelete':_0x5a7b('0x16a')});db[_0x5a7b('0x62')][_0x5a7b('0x148')](db['Tag'],{'onDelete':_0x5a7b('0x16a'),'foreignKey':'TagId'});db[_0x5a7b('0x122')]['hasMany'](db['ChatMessage'],{'as':'Messages','onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x18e')});db[_0x5a7b('0x122')][_0x5a7b('0x148')](db[_0x5a7b('0x5e')],{'as':_0x5a7b('0x162'),'foreignKey':'ChatWebsiteId'});db[_0x5a7b('0x122')]['belongsTo'](db[_0x5a7b('0x11c')],{'as':'Contact','foreignKey':_0x5a7b('0x163')});db[_0x5a7b('0x122')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x164'),'foreignKey':_0x5a7b('0x10b')});db[_0x5a7b('0x122')][_0x5a7b('0x11f')](db['Tag'],{'through':_0x5a7b('0x18f'),'as':_0x5a7b('0x176')});db['ChatInteraction']['belongsToMany'](db[_0x5a7b('0x88')],{'through':'chat_interaction_has_tags','as':_0x5a7b('0x177')});db[_0x5a7b('0x122')][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x178'),'through':_0x5a7b('0x123'),'foreignKey':_0x5a7b('0x18e')});db[_0x5a7b('0x64')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{'onDelete':'cascade','as':_0x5a7b('0x12')});db[_0x5a7b('0x64')][_0x5a7b('0x148')](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':_0x5a7b('0x163')});db[_0x5a7b('0x64')][_0x5a7b('0x148')](db[_0x5a7b('0x122')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x5a7b('0x18e')});db[_0x5a7b('0x64')]['belongsTo'](db[_0x5a7b('0x166')],{'as':'Attachment','foreignKey':_0x5a7b('0x179')});db['ChatMessage'][_0x5a7b('0x148')](db[_0x5a7b('0x5e')],{'as':_0x5a7b('0x162'),'foreignKey':'ChatWebsiteId'});db[_0x5a7b('0x66')][_0x5a7b('0x10c')](db[_0x5a7b('0x166')],{'as':_0x5a7b('0x167'),'foreignKey':_0x5a7b('0x190'),'onDelete':'cascade','hooks':!![]});db[_0x5a7b('0x66')][_0x5a7b('0x148')](db[_0x5a7b('0x11c')],{'onDelete':'cascade','as':_0x5a7b('0x157'),'foreignKey':'ContactId'});db['ChatOfflineMessage']['belongsTo'](db['ChatWebsite'],{'as':_0x5a7b('0x162'),'foreignKey':_0x5a7b('0x169')});db[_0x5a7b('0x67')][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':'Agents','through':_0x5a7b('0x30'),'hooks':!![]});db[_0x5a7b('0x67')][_0x5a7b('0x11f')](db[_0x5a7b('0x14e')],{'through':_0x5a7b('0x191'),'as':_0x5a7b('0x189')});db[_0x5a7b('0x119')][_0x5a7b('0x10c')](db[_0x5a7b('0x192')],{'as':_0x5a7b('0x151'),'foreignKey':_0x5a7b('0x193'),'onDelete':_0x5a7b('0x10a')});db[_0x5a7b('0x119')][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x142'),'through':'chat_group_has_users'});db[_0x5a7b('0x69')]['belongsTo'](db[_0x5a7b('0x5e')],{'as':_0x5a7b('0x18d'),'foreignKey':_0x5a7b('0x169')});db['CmCompany']['hasMany'](db['CmContact'],{'as':_0x5a7b('0x11d'),'foreignKey':_0x5a7b('0x194')});db[_0x5a7b('0x11c')][_0x5a7b('0x10c')](db[_0x5a7b('0x6d')],{'as':_0x5a7b('0x144'),'foreignKey':_0x5a7b('0x163')});db[_0x5a7b('0x11c')][_0x5a7b('0x10c')](db[_0x5a7b('0x70')],{'as':_0x5a7b('0x10e'),'foreignKey':_0x5a7b('0x163')});db[_0x5a7b('0x11c')]['hasMany'](db[_0x5a7b('0x72')],{'as':_0x5a7b('0x145'),'foreignKey':_0x5a7b('0x163')});db[_0x5a7b('0x11c')][_0x5a7b('0x10c')](db[_0x5a7b('0x110')],{'as':'ReportAgentPreview','foreignKey':_0x5a7b('0x163')});db[_0x5a7b('0x11c')][_0x5a7b('0x10c')](db[_0x5a7b('0xd1')],{'as':'JscriptySessions','foreignKey':_0x5a7b('0x163')});db[_0x5a7b('0x11c')][_0x5a7b('0x10c')](db[_0x5a7b('0x59')],{'as':_0x5a7b('0x111'),'foreignKey':_0x5a7b('0x163'),'onDelete':_0x5a7b('0x16a')});db['CmContact']['hasMany'](db[_0x5a7b('0x122')],{'as':_0x5a7b('0x112'),'foreignKey':'ContactId','onDelete':_0x5a7b('0x16a')});db[_0x5a7b('0x11c')][_0x5a7b('0x10c')](db[_0x5a7b('0x53')],{'as':'SmsInteractions','foreignKey':_0x5a7b('0x163'),'onDelete':_0x5a7b('0x16a')});db['CmContact'][_0x5a7b('0x10c')](db['FaxInteraction'],{'as':_0x5a7b('0x114'),'foreignKey':'ContactId','onDelete':_0x5a7b('0x16a')});db[_0x5a7b('0x11c')][_0x5a7b('0x10c')](db[_0x5a7b('0x41')],{'as':'MailInteractions','foreignKey':_0x5a7b('0x163'),'onDelete':_0x5a7b('0x16a')});db[_0x5a7b('0x11c')][_0x5a7b('0x148')](db['CmCompany'],{'as':_0x5a7b('0x195'),'foreignKey':_0x5a7b('0x194')});db[_0x5a7b('0x11c')][_0x5a7b('0x148')](db[_0x5a7b('0xf1')],{'as':'List','foreignKey':'ListId','onDelete':_0x5a7b('0x10a')});db[_0x5a7b('0x11c')][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':'Users','through':_0x5a7b('0x11e')});db[_0x5a7b('0x11c')][_0x5a7b('0x11f')](db[_0x5a7b('0x88')],{'as':_0x5a7b('0x176'),'through':_0x5a7b('0x196')});db[_0x5a7b('0x11c')][_0x5a7b('0x11f')](db[_0x5a7b('0x88')],{'through':'cm_contact_has_tags','as':_0x5a7b('0x177')});db[_0x5a7b('0x6d')][_0x5a7b('0x148')](db[_0x5a7b('0x11c')],{'as':_0x5a7b('0x157'),'foreignKey':_0x5a7b('0x163'),'onDelete':_0x5a7b('0x10a')});db[_0x5a7b('0x6d')]['belongsTo'](db[_0x5a7b('0xf1')],{'as':_0x5a7b('0x15d'),'foreignKey':_0x5a7b('0x15e'),'onDelete':_0x5a7b('0x10a')});db[_0x5a7b('0x6d')]['belongsTo'](db[_0x5a7b('0x12')],{'as':'Agent','foreignKey':_0x5a7b('0x10b')});db['CmHopper'][_0x5a7b('0x148')](db['VoiceQueue'],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x5a7b('0x6d')]['belongsTo'](db['Campaign'],{'as':_0x5a7b('0xe4'),'foreignKey':_0x5a7b('0x197'),'onDelete':_0x5a7b('0x10a')});db[_0x5a7b('0x6d')][_0x5a7b('0x148')](db['User'],{'as':_0x5a7b('0x164'),'foreignKey':_0x5a7b('0x198')});db[_0x5a7b('0x146')][_0x5a7b('0x148')](db['CmContact'],{'as':_0x5a7b('0x157'),'foreignKey':_0x5a7b('0x163'),'onDelete':'cascade'});db[_0x5a7b('0x146')][_0x5a7b('0x148')](db['CmList'],{'as':_0x5a7b('0x15d'),'foreignKey':_0x5a7b('0x15e'),'onDelete':_0x5a7b('0x10a')});db[_0x5a7b('0x146')][_0x5a7b('0x148')](db[_0x5a7b('0x1b')],{'as':_0x5a7b('0x18b'),'foreignKey':_0x5a7b('0x143'),'onDelete':_0x5a7b('0x10a')});db[_0x5a7b('0x146')]['belongsTo'](db['Campaign'],{'as':_0x5a7b('0xe4'),'foreignKey':_0x5a7b('0x197'),'onDelete':_0x5a7b('0x10a')});db[_0x5a7b('0x79')][_0x5a7b('0x10c')](db[_0x5a7b('0x7e')],{'as':{'plural':_0x5a7b('0x199'),'singular':_0x5a7b('0x19a')},'foreignKey':_0x5a7b('0x19b'),'onDelete':'cascade','hooks':!![]});db[_0x5a7b('0x79')][_0x5a7b('0x10c')](db[_0x5a7b('0x7e')],{'as':{'plural':_0x5a7b('0x19c'),'singular':'OneAny'},'foreignKey':_0x5a7b('0x19d'),'onDelete':_0x5a7b('0x10a'),'hooks':!![]});db[_0x5a7b('0x79')][_0x5a7b('0x10c')](db['Action'],{'as':'Actions','foreignKey':_0x5a7b('0x19e'),'onDelete':'cascade','hooks':!![]});db['Disposition'][_0x5a7b('0x10c')](db[_0x5a7b('0x7c')],{'as':_0x5a7b('0x17b'),'foreignKey':'ParentId','onDelete':'cascade'});db['Interval'][_0x5a7b('0x10c')](db[_0x5a7b('0x7f')],{'as':_0x5a7b('0x19f'),'foreignKey':'IntervalId','onDelete':_0x5a7b('0x10a'),'hooks':!![],'required':![]});db['Interval'][_0x5a7b('0x10c')](db[_0x5a7b('0x17')],{'as':'Extensions','foreignKey':_0x5a7b('0x16b'),'onDelete':_0x5a7b('0x16a')});db[_0x5a7b('0x7f')][_0x5a7b('0x10c')](db['MailApplication'],{'as':_0x5a7b('0x1a0'),'foreignKey':_0x5a7b('0x16b')});db['Interval'][_0x5a7b('0x10c')](db['ChatApplication'],{'as':_0x5a7b('0x1a1'),'foreignKey':_0x5a7b('0x16b')});db[_0x5a7b('0x7f')][_0x5a7b('0x10c')](db['FaxApplication'],{'as':_0x5a7b('0x1a2'),'foreignKey':_0x5a7b('0x16b')});db[_0x5a7b('0x7f')][_0x5a7b('0x10c')](db[_0x5a7b('0x51')],{'as':_0x5a7b('0x1a3'),'foreignKey':'IntervalId'});db[_0x5a7b('0x85')][_0x5a7b('0x148')](db['MailAccount'],{});db[_0x5a7b('0x85')][_0x5a7b('0x148')](db[_0x5a7b('0x94')],{'foreignKey':_0x5a7b('0x1a4')});db[_0x5a7b('0x85')][_0x5a7b('0x148')](db[_0x5a7b('0x92')],{'foreignKey':'CustomReportId'});db[_0x5a7b('0x87')][_0x5a7b('0x11f')](db[_0x5a7b('0x19')],{'as':_0x5a7b('0x1a5'),'through':_0x5a7b('0x141'),'onDelete':_0x5a7b('0x16a')});db['Tag']['belongsToMany'](db[_0x5a7b('0x11c')],{'through':_0x5a7b('0x196')});db[_0x5a7b('0x88')][_0x5a7b('0x11f')](db[_0x5a7b('0x122')],{'through':'chat_interaction_has_tags'});db[_0x5a7b('0x88')][_0x5a7b('0x11f')](db[_0x5a7b('0x41')],{'through':_0x5a7b('0x165')});db[_0x5a7b('0x88')][_0x5a7b('0x11f')](db[_0x5a7b('0x53')],{'through':'sms_interaction_has_tags'});db[_0x5a7b('0x88')][_0x5a7b('0x11f')](db[_0x5a7b('0x170')],{'through':'fax_interaction_has_tags'});db['Tag'][_0x5a7b('0x11f')](db[_0x5a7b('0x59')],{'through':_0x5a7b('0x186')});db['Tag'][_0x5a7b('0x11f')](db[_0x5a7b('0xfe')],{'through':_0x5a7b('0x1a6')});db[_0x5a7b('0x8c')]['hasMany'](db[_0x5a7b('0x7e')],{'as':{'plural':_0x5a7b('0x1a7'),'singular':_0x5a7b('0x1a8')},'foreignKey':_0x5a7b('0x1a9'),'onDelete':_0x5a7b('0x10a'),'hooks':!![]});db[_0x5a7b('0x8c')][_0x5a7b('0x10c')](db[_0x5a7b('0x7e')],{'as':{'plural':_0x5a7b('0x1aa'),'singular':_0x5a7b('0x1ab')},'foreignKey':_0x5a7b('0x1ac'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x5a7b('0x10c')](db[_0x5a7b('0x77')],{'as':_0x5a7b('0x1ad'),'foreignKey':_0x5a7b('0x1ae'),'onDelete':_0x5a7b('0x10a'),'hooks':!![]});db[_0x5a7b('0x92')][_0x5a7b('0x10c')](db[_0x5a7b('0x1af')],{'as':_0x5a7b('0x1b0'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1b1'),'hooks':!![]});db[_0x5a7b('0x94')][_0x5a7b('0x10c')](db[_0x5a7b('0x1af')],{'as':_0x5a7b('0x1b0'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1a4')});db[_0x5a7b('0x98')][_0x5a7b('0x10c')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x5a7b('0x1b2')});db['AnalyticFieldReport']['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0x5a7b('0x1b2')});db[_0x5a7b('0x9b')][_0x5a7b('0x10c')](db['SalesforceConfiguration'],{'as':_0x5a7b('0x1b3'),'onDelete':'cascade','foreignKey':_0x5a7b('0x1b4')});db[_0x5a7b('0x9d')][_0x5a7b('0x10c')](db[_0x5a7b('0x1b5')],{'as':_0x5a7b('0x1b6'),'onDelete':'cascade','foreignKey':_0x5a7b('0x1b7')});db['SalesforceConfiguration']['hasMany'](db[_0x5a7b('0x1b5')],{'as':_0x5a7b('0x1b8'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1b9')});db[_0x5a7b('0x9d')][_0x5a7b('0x10c')](db[_0x5a7b('0x1b5')],{'as':_0x5a7b('0x1b0'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1ba')});db[_0x5a7b('0x9d')]['belongsTo'](db['SalesforceAccount'],{'as':_0x5a7b('0x162'),'foreignKey':'AccountId'});db[_0x5a7b('0x1b5')][_0x5a7b('0x10c')](db[_0x5a7b('0x1b5')],{'as':_0x5a7b('0x1bb'),'foreignKey':_0x5a7b('0x1b7')});db[_0x5a7b('0x1b5')][_0x5a7b('0x10c')](db[_0x5a7b('0x1b5')],{'as':_0x5a7b('0x1bc'),'foreignKey':'DescriptionId'});db[_0x5a7b('0x1b5')][_0x5a7b('0x10c')](db[_0x5a7b('0x1b5')],{'as':_0x5a7b('0x1bd'),'foreignKey':_0x5a7b('0x1ba')});db[_0x5a7b('0x1b5')][_0x5a7b('0x148')](db['Variable'],{'as':_0x5a7b('0x1be'),'foreignKey':_0x5a7b('0x1bf')});db[_0x5a7b('0xa0')][_0x5a7b('0x10c')](db[_0x5a7b('0xa2')],{'as':_0x5a7b('0x1b3'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x5a7b('0xa2')][_0x5a7b('0x10c')](db[_0x5a7b('0xa3')],{'as':_0x5a7b('0x1b6'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1b7')});db[_0x5a7b('0xa2')][_0x5a7b('0x10c')](db[_0x5a7b('0xa3')],{'as':_0x5a7b('0x1b8'),'onDelete':_0x5a7b('0x10a'),'foreignKey':'DescriptionId'});db[_0x5a7b('0xa2')][_0x5a7b('0x10c')](db['SugarcrmField'],{'as':_0x5a7b('0x1b0'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1ba')});db[_0x5a7b('0xa2')]['belongsTo'](db[_0x5a7b('0xa0')],{'as':'Account','foreignKey':_0x5a7b('0x1b4')});db[_0x5a7b('0xa3')]['hasMany'](db[_0x5a7b('0xa3')],{'as':_0x5a7b('0x1bb'),'foreignKey':_0x5a7b('0x1b7')});db[_0x5a7b('0xa3')][_0x5a7b('0x10c')](db['SugarcrmField'],{'as':_0x5a7b('0x1bc'),'foreignKey':_0x5a7b('0x1b9')});db[_0x5a7b('0xa3')]['hasMany'](db['SugarcrmField'],{'as':_0x5a7b('0x1bd'),'foreignKey':'FieldId'});db[_0x5a7b('0xa3')][_0x5a7b('0x148')](db[_0x5a7b('0x1be')],{'as':_0x5a7b('0x1be'),'foreignKey':_0x5a7b('0x1bf')});db[_0x5a7b('0xa4')][_0x5a7b('0x10c')](db['DeskConfiguration'],{'as':_0x5a7b('0x1b3'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1b4')});db[_0x5a7b('0xa6')][_0x5a7b('0x10c')](db[_0x5a7b('0xa7')],{'as':_0x5a7b('0x1b6'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1b7')});db['DeskConfiguration']['hasMany'](db[_0x5a7b('0xa7')],{'as':_0x5a7b('0x1b8'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x5a7b('0xa6')][_0x5a7b('0x10c')](db[_0x5a7b('0xa7')],{'as':_0x5a7b('0x1b0'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1ba')});db[_0x5a7b('0xa6')]['belongsTo'](db[_0x5a7b('0xa4')],{'as':_0x5a7b('0x162'),'foreignKey':_0x5a7b('0x1b4')});db['DeskConfiguration'][_0x5a7b('0x11f')](db[_0x5a7b('0x88')],{'through':'int_desk_configuration_has_tags'});db[_0x5a7b('0xa7')][_0x5a7b('0x10c')](db[_0x5a7b('0xa7')],{'as':_0x5a7b('0x1bb'),'foreignKey':'SubjectId'});db[_0x5a7b('0xa7')][_0x5a7b('0x10c')](db[_0x5a7b('0xa7')],{'as':_0x5a7b('0x1bc'),'foreignKey':_0x5a7b('0x1b9')});db['DeskField'][_0x5a7b('0x10c')](db[_0x5a7b('0xa7')],{'as':_0x5a7b('0x1bd'),'foreignKey':_0x5a7b('0x1ba')});db[_0x5a7b('0xa7')]['belongsTo'](db[_0x5a7b('0x1be')],{'as':_0x5a7b('0x1be'),'foreignKey':'VariableId'});db[_0x5a7b('0xa9')][_0x5a7b('0x10c')](db[_0x5a7b('0xab')],{'as':_0x5a7b('0x1b3'),'onDelete':'cascade','foreignKey':_0x5a7b('0x1b4')});db[_0x5a7b('0xab')]['hasMany'](db['ZohoField'],{'as':'Subjects','onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1b7')});db['ZohoConfiguration'][_0x5a7b('0x10c')](db['ZohoField'],{'as':_0x5a7b('0x1b8'),'onDelete':_0x5a7b('0x10a'),'foreignKey':'DescriptionId'});db['ZohoConfiguration']['hasMany'](db['ZohoField'],{'as':_0x5a7b('0x1b0'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x5a7b('0xab')]['belongsTo'](db['ZohoAccount'],{'as':_0x5a7b('0x162'),'foreignKey':_0x5a7b('0x1b4')});db['ZohoField'][_0x5a7b('0x10c')](db[_0x5a7b('0xad')],{'as':_0x5a7b('0x1bb'),'foreignKey':_0x5a7b('0x1b7')});db['ZohoField'][_0x5a7b('0x10c')](db[_0x5a7b('0xad')],{'as':_0x5a7b('0x1bc'),'foreignKey':_0x5a7b('0x1b9')});db[_0x5a7b('0xad')][_0x5a7b('0x10c')](db[_0x5a7b('0xad')],{'as':_0x5a7b('0x1bd'),'foreignKey':'FieldId'});db[_0x5a7b('0xad')]['belongsTo'](db[_0x5a7b('0x1be')],{'as':_0x5a7b('0x1be'),'foreignKey':_0x5a7b('0x1bf')});db[_0x5a7b('0xaf')][_0x5a7b('0x10c')](db['ZendeskConfiguration'],{'as':_0x5a7b('0x1b3'),'onDelete':_0x5a7b('0x10a'),'foreignKey':'AccountId'});db[_0x5a7b('0xb0')][_0x5a7b('0x10c')](db[_0x5a7b('0xb2')],{'as':_0x5a7b('0x1b6'),'foreignKey':_0x5a7b('0x1b7')});db[_0x5a7b('0xb0')][_0x5a7b('0x10c')](db[_0x5a7b('0xb2')],{'as':_0x5a7b('0x1b8'),'foreignKey':'DescriptionId'});db[_0x5a7b('0xb0')][_0x5a7b('0x10c')](db['ZendeskField'],{'as':'Fields','foreignKey':_0x5a7b('0x1ba')});db[_0x5a7b('0xb0')][_0x5a7b('0x148')](db['ZendeskAccount'],{'as':_0x5a7b('0x162'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x5a7b('0x11f')](db['Tag'],{'through':_0x5a7b('0x1c0')});db['ZendeskField'][_0x5a7b('0x10c')](db[_0x5a7b('0xb2')],{'as':_0x5a7b('0x1bb'),'foreignKey':_0x5a7b('0x1b7')});db[_0x5a7b('0xb2')][_0x5a7b('0x10c')](db[_0x5a7b('0xb2')],{'as':_0x5a7b('0x1bc'),'foreignKey':'DescriptionId'});db[_0x5a7b('0xb2')][_0x5a7b('0x10c')](db[_0x5a7b('0xb2')],{'as':'Field','foreignKey':'FieldId'});db[_0x5a7b('0xb2')][_0x5a7b('0x148')](db[_0x5a7b('0x1be')],{'as':_0x5a7b('0x1be'),'foreignKey':_0x5a7b('0x1bf')});db['FreshdeskAccount'][_0x5a7b('0x10c')](db[_0x5a7b('0xb5')],{'as':'Configurations','onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1b4')});db[_0x5a7b('0xb5')]['hasMany'](db[_0x5a7b('0xb7')],{'as':'Subjects','onDelete':_0x5a7b('0x10a'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration']['hasMany'](db[_0x5a7b('0xb7')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x5a7b('0xb5')][_0x5a7b('0x10c')](db[_0x5a7b('0xb7')],{'as':_0x5a7b('0x1b0'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1ba')});db[_0x5a7b('0xb5')][_0x5a7b('0x148')](db[_0x5a7b('0xb4')],{'as':_0x5a7b('0x162'),'foreignKey':_0x5a7b('0x1b4')});db[_0x5a7b('0xb5')][_0x5a7b('0x11f')](db[_0x5a7b('0x88')],{'through':_0x5a7b('0x1c1')});db[_0x5a7b('0xb7')][_0x5a7b('0x10c')](db[_0x5a7b('0xb7')],{'as':_0x5a7b('0x1bb'),'foreignKey':_0x5a7b('0x1b7')});db[_0x5a7b('0xb7')]['hasMany'](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x5a7b('0xb7')][_0x5a7b('0x10c')](db[_0x5a7b('0xb7')],{'as':'Field','foreignKey':_0x5a7b('0x1ba')});db[_0x5a7b('0xb7')][_0x5a7b('0x148')](db[_0x5a7b('0x1be')],{'as':_0x5a7b('0x1be'),'foreignKey':_0x5a7b('0x1bf')});db[_0x5a7b('0xb9')][_0x5a7b('0x10c')](db[_0x5a7b('0xba')],{'as':_0x5a7b('0x1b3'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1b4')});db[_0x5a7b('0xba')][_0x5a7b('0x10c')](db[_0x5a7b('0xbc')],{'as':'Subjects','foreignKey':_0x5a7b('0x1b7')});db[_0x5a7b('0xba')][_0x5a7b('0x10c')](db[_0x5a7b('0xbc')],{'as':_0x5a7b('0x1b8'),'foreignKey':'DescriptionId'});db[_0x5a7b('0xba')][_0x5a7b('0x10c')](db['VtigerField'],{'as':'Fields','foreignKey':_0x5a7b('0x1ba')});db[_0x5a7b('0xba')][_0x5a7b('0x148')](db[_0x5a7b('0xb9')],{'as':_0x5a7b('0x162'),'foreignKey':_0x5a7b('0x1b4')});db[_0x5a7b('0xbc')]['hasMany'](db['VtigerField'],{'as':_0x5a7b('0x1bb'),'foreignKey':_0x5a7b('0x1b7')});db['VtigerField'][_0x5a7b('0x10c')](db[_0x5a7b('0xbc')],{'as':_0x5a7b('0x1bc'),'foreignKey':'DescriptionId'});db[_0x5a7b('0xbc')]['hasMany'](db['VtigerField'],{'as':_0x5a7b('0x1bd'),'foreignKey':_0x5a7b('0x1ba')});db[_0x5a7b('0xbc')][_0x5a7b('0x148')](db['Variable'],{'as':'Variable','foreignKey':_0x5a7b('0x1bf')});db['ServicenowAccount'][_0x5a7b('0x10c')](db[_0x5a7b('0xbe')],{'as':_0x5a7b('0x1b3'),'onDelete':_0x5a7b('0x10a'),'foreignKey':'AccountId'});db[_0x5a7b('0xbe')][_0x5a7b('0x10c')](db[_0x5a7b('0xc0')],{'as':'Subjects','foreignKey':_0x5a7b('0x1b7')});db[_0x5a7b('0xbe')][_0x5a7b('0x10c')](db[_0x5a7b('0xc0')],{'as':_0x5a7b('0x1b8'),'foreignKey':_0x5a7b('0x1b9')});db[_0x5a7b('0xbe')][_0x5a7b('0x10c')](db[_0x5a7b('0xc0')],{'as':_0x5a7b('0x1b0'),'foreignKey':'FieldId'});db[_0x5a7b('0xbe')][_0x5a7b('0x148')](db['ServicenowAccount'],{'as':'Account','foreignKey':'AccountId'});db['ServicenowField'][_0x5a7b('0x10c')](db[_0x5a7b('0xc0')],{'as':_0x5a7b('0x1bb'),'foreignKey':_0x5a7b('0x1b7')});db['ServicenowField']['hasMany'](db['ServicenowField'],{'as':'Description','foreignKey':_0x5a7b('0x1b9')});db[_0x5a7b('0xc0')]['hasMany'](db[_0x5a7b('0xc0')],{'as':_0x5a7b('0x1bd'),'foreignKey':_0x5a7b('0x1ba')});db[_0x5a7b('0xc0')][_0x5a7b('0x148')](db[_0x5a7b('0x1be')],{'as':_0x5a7b('0x1be'),'foreignKey':_0x5a7b('0x1bf')});db[_0x5a7b('0xc2')]['hasMany'](db[_0x5a7b('0x1c2')],{'as':_0x5a7b('0x1b3'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1b4')});db[_0x5a7b('0x1c2')][_0x5a7b('0x10c')](db[_0x5a7b('0x1c3')],{'as':_0x5a7b('0x1b6'),'onDelete':'cascade','foreignKey':_0x5a7b('0x1b7')});db[_0x5a7b('0x1c2')][_0x5a7b('0x10c')](db[_0x5a7b('0x1c3')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x5a7b('0x1b9')});db[_0x5a7b('0x1c2')][_0x5a7b('0x10c')](db['Dynamics365Field'],{'as':_0x5a7b('0x1b0'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1ba')});db[_0x5a7b('0x1c2')][_0x5a7b('0x148')](db[_0x5a7b('0xc2')],{'as':_0x5a7b('0x162'),'foreignKey':'AccountId'});db[_0x5a7b('0x1c3')][_0x5a7b('0x10c')](db['Dynamics365Field'],{'as':_0x5a7b('0x1bb'),'foreignKey':_0x5a7b('0x1b7')});db[_0x5a7b('0x1c3')][_0x5a7b('0x10c')](db[_0x5a7b('0x1c3')],{'as':_0x5a7b('0x1bc'),'foreignKey':'DescriptionId'});db[_0x5a7b('0x1c3')][_0x5a7b('0x10c')](db[_0x5a7b('0x1c3')],{'as':_0x5a7b('0x1bd'),'foreignKey':'FieldId'});db['Dynamics365Field'][_0x5a7b('0x148')](db[_0x5a7b('0x1be')],{'as':_0x5a7b('0x1be'),'foreignKey':_0x5a7b('0x1bf')});db[_0x5a7b('0x1c4')][_0x5a7b('0x10c')](db[_0x5a7b('0xc5')],{'as':_0x5a7b('0x1b3'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1b4')});db['FreshsalesConfiguration'][_0x5a7b('0x10c')](db[_0x5a7b('0xc7')],{'as':_0x5a7b('0x1b6'),'foreignKey':_0x5a7b('0x1b7')});db[_0x5a7b('0xc5')][_0x5a7b('0x10c')](db[_0x5a7b('0xc7')],{'as':_0x5a7b('0x1b8'),'foreignKey':_0x5a7b('0x1b9')});db['FreshsalesConfiguration'][_0x5a7b('0x10c')](db[_0x5a7b('0xc7')],{'as':_0x5a7b('0x1b0'),'foreignKey':_0x5a7b('0x1ba')});db[_0x5a7b('0xc5')]['belongsTo'](db[_0x5a7b('0x1c4')],{'as':'Account','foreignKey':'AccountId'});db[_0x5a7b('0xc7')][_0x5a7b('0x10c')](db[_0x5a7b('0xc7')],{'as':_0x5a7b('0x1bb'),'foreignKey':_0x5a7b('0x1b7')});db['FreshsalesField'][_0x5a7b('0x10c')](db['FreshsalesField'],{'as':'Description','foreignKey':_0x5a7b('0x1b9')});db[_0x5a7b('0xc7')]['hasMany'](db[_0x5a7b('0xc7')],{'as':_0x5a7b('0x1bd'),'foreignKey':_0x5a7b('0x1ba')});db[_0x5a7b('0xc7')][_0x5a7b('0x148')](db[_0x5a7b('0x1be')],{'as':_0x5a7b('0x1be'),'foreignKey':_0x5a7b('0x1bf')});db[_0x5a7b('0x1c5')][_0x5a7b('0x148')](db[_0x5a7b('0x5e')],{});db[_0x5a7b('0x1c5')][_0x5a7b('0x148')](db['CmList'],{'as':_0x5a7b('0x15d'),'foreignKey':_0x5a7b('0x15e')});db[_0x5a7b('0x1c5')]['belongsTo'](db[_0x5a7b('0x11c')],{'as':_0x5a7b('0x157'),'foreignKey':_0x5a7b('0x163')});db[_0x5a7b('0x1c5')]['belongsTo'](db[_0x5a7b('0x122')],{});db[_0x5a7b('0x1c5')][_0x5a7b('0x148')](db[_0x5a7b('0x64')],{});db[_0x5a7b('0x1c5')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{});db[_0x5a7b('0x1c5')]['belongsTo'](db[_0x5a7b('0x67')],{});db[_0x5a7b('0x192')]['belongsTo'](db[_0x5a7b('0x12')],{'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1c6')});db[_0x5a7b('0x192')][_0x5a7b('0x148')](db['User'],{'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1c7')});db[_0x5a7b('0xd1')][_0x5a7b('0x10c')](db[_0x5a7b('0xcf')],{'foreignKey':_0x5a7b('0x1c8'),'onDelete':_0x5a7b('0x10a')});db[_0x5a7b('0xd1')][_0x5a7b('0x10c')](db[_0x5a7b('0xcd')],{'foreignKey':_0x5a7b('0x1c8'),'onDelete':_0x5a7b('0x10a')});db['SmsQueueReport'][_0x5a7b('0x148')](db[_0x5a7b('0x138')],{});db[_0x5a7b('0xd3')][_0x5a7b('0x148')](db[_0x5a7b('0xf1')],{'as':_0x5a7b('0x15d'),'foreignKey':_0x5a7b('0x15e')});db[_0x5a7b('0xd3')]['belongsTo'](db[_0x5a7b('0x11c')],{'as':_0x5a7b('0x157'),'foreignKey':'ContactId'});db[_0x5a7b('0xd3')][_0x5a7b('0x148')](db[_0x5a7b('0x53')],{});db[_0x5a7b('0xd3')][_0x5a7b('0x148')](db[_0x5a7b('0x17d')],{});db[_0x5a7b('0xd3')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{});db[_0x5a7b('0xd3')]['belongsTo'](db['SmsQueue'],{});db['JscriptyProject'][_0x5a7b('0x10c')](db[_0x5a7b('0xd1')],{'foreignKey':'ProjectId'});db[_0x5a7b('0xd8')][_0x5a7b('0x10c')](db[_0x5a7b('0xcf')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x5a7b('0x10c')](db[_0x5a7b('0xcd')],{'foreignKey':_0x5a7b('0x1c9')});db[_0x5a7b('0xdc')]['belongsToMany'](db['User'],{'as':_0x5a7b('0x178'),'through':_0x5a7b('0x13d')});db[_0x5a7b('0x14e')][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x15f'),'through':'user_has_teams'});db[_0x5a7b('0x14e')][_0x5a7b('0x11f')](db[_0x5a7b('0x1b')],{'through':_0x5a7b('0x107'),'as':_0x5a7b('0x127')});db[_0x5a7b('0x14e')][_0x5a7b('0x11f')](db[_0x5a7b('0x3e')],{'through':_0x5a7b('0x160'),'as':_0x5a7b('0x128')});db[_0x5a7b('0x14e')]['belongsToMany'](db[_0x5a7b('0x67')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0x5a7b('0x14e')][_0x5a7b('0x11f')](db[_0x5a7b('0x173')],{'through':_0x5a7b('0x17a'),'as':'FaxQueues'});db[_0x5a7b('0x14e')]['belongsToMany'](db[_0x5a7b('0x55')],{'through':'team_has_sms_queues','as':_0x5a7b('0x1ca')});db['Team'][_0x5a7b('0x11f')](db[_0x5a7b('0x5c')],{'through':_0x5a7b('0x188'),'as':_0x5a7b('0x1cb')});db[_0x5a7b('0x14e')][_0x5a7b('0x11f')](db[_0x5a7b('0x1cc')],{'through':'team_has_whatsapp_queues','as':_0x5a7b('0x12b')});db['Campaign']['hasMany'](db['CmHopper'],{'as':_0x5a7b('0x144'),'foreignKey':_0x5a7b('0x197')});db['Campaign'][_0x5a7b('0x10c')](db[_0x5a7b('0x70')],{'as':_0x5a7b('0x10e'),'foreignKey':_0x5a7b('0x197')});db[_0x5a7b('0xe4')][_0x5a7b('0x10c')](db['CmHopperHistory'],{'as':_0x5a7b('0x145'),'foreignKey':_0x5a7b('0x197')});db[_0x5a7b('0xe4')]['hasMany'](db[_0x5a7b('0x146')],{'as':'HopperBlacks','foreignKey':_0x5a7b('0x197')});db[_0x5a7b('0xe4')]['belongsTo'](db[_0x5a7b('0x149')],{'as':'Trunk','foreignKey':_0x5a7b('0x1cd')});db[_0x5a7b('0xe4')][_0x5a7b('0x148')](db['Trunk'],{'as':_0x5a7b('0x14a'),'foreignKey':_0x5a7b('0x1ce')});db[_0x5a7b('0xe4')][_0x5a7b('0x148')](db[_0x5a7b('0x7f')],{'as':_0x5a7b('0x7f'),'foreignKey':_0x5a7b('0x16b')});db[_0x5a7b('0xe4')][_0x5a7b('0x148')](db[_0x5a7b('0xdc')],{'as':_0x5a7b('0xdc'),'foreignKey':_0x5a7b('0x1cf')});db[_0x5a7b('0xe4')]['belongsToMany'](db[_0x5a7b('0xf1')],{'as':_0x5a7b('0x120'),'through':'campaigns_has_cm_lists'});db[_0x5a7b('0xe4')][_0x5a7b('0x11f')](db[_0x5a7b('0xf1')],{'as':'BlackLists','through':_0x5a7b('0x1d0')});db[_0x5a7b('0x166')][_0x5a7b('0x148')](db[_0x5a7b('0x66')],{'as':_0x5a7b('0x66'),'foreignKey':_0x5a7b('0x190')});db['MailTransferReport'][_0x5a7b('0x148')](db[_0x5a7b('0x42')],{});db[_0x5a7b('0xea')]['belongsTo'](db['MailInteraction'],{});db[_0x5a7b('0xea')][_0x5a7b('0x148')](db['MailAccount'],{'foreignKey':_0x5a7b('0x1d1'),'as':_0x5a7b('0x1d2')});db[_0x5a7b('0xea')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{'foreignKey':'FromUserId','as':_0x5a7b('0x1d3')});db[_0x5a7b('0xea')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{'foreignKey':_0x5a7b('0x1d4'),'as':_0x5a7b('0x1d5')});db[_0x5a7b('0xea')][_0x5a7b('0x148')](db[_0x5a7b('0x3e')],{'foreignKey':_0x5a7b('0x1d6'),'as':'ToQueue'});db[_0x5a7b('0xea')]['belongsTo'](db['MailAccount'],{'foreignKey':_0x5a7b('0x1d7'),'as':_0x5a7b('0x1d8')});db[_0x5a7b('0x1d9')][_0x5a7b('0x148')](db[_0x5a7b('0x64')],{});db['ChatTransferReport'][_0x5a7b('0x148')](db[_0x5a7b('0x122')],{});db[_0x5a7b('0x1d9')][_0x5a7b('0x148')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0x5a7b('0x1d2')});db[_0x5a7b('0x1d9')][_0x5a7b('0x148')](db['User'],{'foreignKey':_0x5a7b('0x1da'),'as':_0x5a7b('0x1d3')});db[_0x5a7b('0x1d9')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{'foreignKey':_0x5a7b('0x1d4'),'as':'ToAgent'});db[_0x5a7b('0x1d9')]['belongsTo'](db[_0x5a7b('0x67')],{'foreignKey':_0x5a7b('0x1db'),'as':_0x5a7b('0x1dc')});db[_0x5a7b('0x1d9')]['belongsTo'](db[_0x5a7b('0x5e')],{'foreignKey':_0x5a7b('0x1dd'),'as':'ToAccount'});db[_0x5a7b('0xeb')][_0x5a7b('0x148')](db[_0x5a7b('0x172')],{});db[_0x5a7b('0xeb')][_0x5a7b('0x148')](db[_0x5a7b('0x170')],{});db[_0x5a7b('0xeb')][_0x5a7b('0x148')](db[_0x5a7b('0x132')],{'foreignKey':_0x5a7b('0x1de'),'as':_0x5a7b('0x1d2')});db[_0x5a7b('0xeb')]['belongsTo'](db[_0x5a7b('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x5a7b('0xeb')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{'foreignKey':_0x5a7b('0x1d4'),'as':_0x5a7b('0x1d5')});db[_0x5a7b('0xeb')]['belongsTo'](db[_0x5a7b('0x173')],{'foreignKey':_0x5a7b('0x1df'),'as':_0x5a7b('0x1dc')});db[_0x5a7b('0xeb')][_0x5a7b('0x148')](db[_0x5a7b('0x132')],{'foreignKey':_0x5a7b('0x1e0'),'as':'ToAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0x5a7b('0x5b')],{});db[_0x5a7b('0xed')]['belongsTo'](db[_0x5a7b('0x59')],{});db[_0x5a7b('0xed')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x5a7b('0x1e1'),'as':_0x5a7b('0x1d2')});db['OpenchannelTransferReport']['belongsTo'](db[_0x5a7b('0x12')],{'foreignKey':_0x5a7b('0x1da'),'as':_0x5a7b('0x1d3')});db[_0x5a7b('0xed')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{'foreignKey':_0x5a7b('0x1d4'),'as':_0x5a7b('0x1d5')});db[_0x5a7b('0xed')][_0x5a7b('0x148')](db[_0x5a7b('0x5c')],{'foreignKey':_0x5a7b('0x1e2'),'as':'ToQueue'});db['OpenchannelTransferReport'][_0x5a7b('0x148')](db[_0x5a7b('0x56')],{'foreignKey':'ToOpenchannelAccountId','as':_0x5a7b('0x1d8')});db[_0x5a7b('0xef')][_0x5a7b('0x148')](db['SmsMessage'],{});db[_0x5a7b('0xef')][_0x5a7b('0x148')](db[_0x5a7b('0x53')],{});db['SmsTransferReport'][_0x5a7b('0x148')](db[_0x5a7b('0x138')],{'foreignKey':_0x5a7b('0x1e3'),'as':_0x5a7b('0x1d2')});db['SmsTransferReport'][_0x5a7b('0x148')](db['User'],{'foreignKey':_0x5a7b('0x1da'),'as':_0x5a7b('0x1d3')});db[_0x5a7b('0xef')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0x5a7b('0x1d5')});db['SmsTransferReport']['belongsTo'](db[_0x5a7b('0x55')],{'foreignKey':_0x5a7b('0x1e4'),'as':'ToQueue'});db[_0x5a7b('0xef')][_0x5a7b('0x148')](db[_0x5a7b('0x138')],{'foreignKey':_0x5a7b('0x1e5'),'as':_0x5a7b('0x1d8')});db['CmList'][_0x5a7b('0x10c')](db['Disposition'],{'as':_0x5a7b('0x17b'),'foreignKey':_0x5a7b('0x15e')});db[_0x5a7b('0xf1')][_0x5a7b('0x10c')](db[_0x5a7b('0x75')],{'as':_0x5a7b('0x1e6'),'foreignKey':_0x5a7b('0x15e')});db[_0x5a7b('0xf1')][_0x5a7b('0x10c')](db[_0x5a7b('0x11c')],{'as':_0x5a7b('0x11d'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x15e')});db[_0x5a7b('0xf1')][_0x5a7b('0x10c')](db[_0x5a7b('0x70')],{'as':'HopperFinals','foreignKey':_0x5a7b('0x15e')});db['CmList'][_0x5a7b('0x10c')](db[_0x5a7b('0x72')],{'as':_0x5a7b('0x10f'),'foreignKey':_0x5a7b('0x15e')});db['CmList'][_0x5a7b('0x10c')](db['ReportAgentPreview'],{'as':_0x5a7b('0x110'),'foreignKey':_0x5a7b('0x15e')});db[_0x5a7b('0xf1')][_0x5a7b('0x11f')](db[_0x5a7b('0x1b')],{'as':_0x5a7b('0x1e7'),'through':_0x5a7b('0x14d')});db[_0x5a7b('0xf1')][_0x5a7b('0x11f')](db['User'],{'as':_0x5a7b('0x15f'),'through':_0x5a7b('0x12c')});db['VoicePrefix'][_0x5a7b('0x10c')](db['VoiceExtension'],{'as':_0x5a7b('0x1e8'),'onDelete':'cascade'});db[_0x5a7b('0x12d')][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':'Agents','through':'user_has_voice_prefixes'});db['UserProfile'][_0x5a7b('0x10c')](db['User'],{'as':_0x5a7b('0x178'),'foreignKey':_0x5a7b('0x118')});db[_0x5a7b('0xf4')][_0x5a7b('0x10c')](db['UserProfileSection'],{'as':_0x5a7b('0x1e9'),'foreignKey':_0x5a7b('0x118'),'onDelete':_0x5a7b('0x10a')});db[_0x5a7b('0xf5')][_0x5a7b('0x10c')](db[_0x5a7b('0xf6')],{'as':_0x5a7b('0x1ea'),'foreignKey':'sectionId','onDelete':_0x5a7b('0x10a')});db[_0x5a7b('0xfa')][_0x5a7b('0x10c')](db[_0x5a7b('0x7c')],{'as':_0x5a7b('0x17b'),'foreignKey':_0x5a7b('0x1eb')});db[_0x5a7b('0xfa')][_0x5a7b('0x10c')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x5a7b('0x1eb')});db[_0x5a7b('0xfa')][_0x5a7b('0x10c')](db[_0x5a7b('0xff')],{'as':_0x5a7b('0x151'),'foreignKey':_0x5a7b('0x1eb')});db[_0x5a7b('0xfa')]['hasMany'](db[_0x5a7b('0xfe')],{'as':_0x5a7b('0x15c')});db[_0x5a7b('0xfa')][_0x5a7b('0x10c')](db[_0x5a7b('0xfc')],{'as':_0x5a7b('0x13f')});db[_0x5a7b('0xfa')][_0x5a7b('0x148')](db[_0x5a7b('0xf1')],{'as':_0x5a7b('0x15d'),'foreignKey':_0x5a7b('0x15e')});db[_0x5a7b('0xfa')][_0x5a7b('0x148')](db[_0x5a7b('0x14b')],{'as':_0x5a7b('0x17e'),'foreignKey':_0x5a7b('0x14c')});db['WhatsappAccount'][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x15f'),'through':_0x5a7b('0x13b')});db[_0x5a7b('0xfc')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{'onDelete':_0x5a7b('0x16a')});db[_0x5a7b('0xfc')]['belongsTo'](db[_0x5a7b('0x1cc')],{'onDelete':'restrict'});db[_0x5a7b('0xfc')][_0x5a7b('0x148')](db['WhatsappAccount'],{'onDelete':_0x5a7b('0x16a')});db[_0x5a7b('0xfc')]['belongsTo'](db[_0x5a7b('0x7f')],{'onDelete':_0x5a7b('0x16a'),'foreignKey':'IntervalId'});db[_0x5a7b('0xfc')][_0x5a7b('0x148')](db[_0x5a7b('0x88')],{'onDelete':_0x5a7b('0x16a'),'foreignKey':_0x5a7b('0x16c')});db[_0x5a7b('0xfe')][_0x5a7b('0x10c')](db['WhatsappMessage'],{'as':_0x5a7b('0x151'),'onDelete':_0x5a7b('0x10a'),'foreignKey':_0x5a7b('0x1ec')});db['WhatsappInteraction']['belongsTo'](db[_0x5a7b('0xfa')],{'as':_0x5a7b('0x162'),'foreignKey':_0x5a7b('0x1eb')});db[_0x5a7b('0xfe')][_0x5a7b('0x148')](db[_0x5a7b('0x11c')],{'as':_0x5a7b('0x157'),'foreignKey':'ContactId'});db[_0x5a7b('0xfe')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x164'),'foreignKey':_0x5a7b('0x10b')});db[_0x5a7b('0xfe')][_0x5a7b('0x11f')](db[_0x5a7b('0x88')],{'through':'whatsapp_interaction_has_tags','as':_0x5a7b('0x176')});db[_0x5a7b('0xfe')]['belongsToMany'](db['Tag'],{'through':_0x5a7b('0x1a6'),'as':_0x5a7b('0x177')});db[_0x5a7b('0xfe')][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x178'),'through':_0x5a7b('0x126'),'foreignKey':'WhatsappInteractionId'});db[_0x5a7b('0xff')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x12')});db[_0x5a7b('0xff')]['belongsTo'](db[_0x5a7b('0x11c')],{'onDelete':_0x5a7b('0x10a'),'as':_0x5a7b('0x157')});db[_0x5a7b('0xff')][_0x5a7b('0x148')](db[_0x5a7b('0xfe')],{'onDelete':_0x5a7b('0x10a'),'as':_0x5a7b('0x168'),'foreignKey':_0x5a7b('0x1ec')});db[_0x5a7b('0xff')][_0x5a7b('0x148')](db[_0x5a7b('0xfa')],{'as':_0x5a7b('0x162'),'foreignKey':_0x5a7b('0x1eb')});db['WhatsappQueueReport'][_0x5a7b('0x148')](db['WhatsappAccount'],{});db[_0x5a7b('0x101')]['belongsTo'](db[_0x5a7b('0xf1')],{'as':'List','foreignKey':'ListId'});db['WhatsappQueueReport'][_0x5a7b('0x148')](db[_0x5a7b('0x11c')],{'as':_0x5a7b('0x157'),'foreignKey':_0x5a7b('0x163')});db[_0x5a7b('0x101')][_0x5a7b('0x148')](db[_0x5a7b('0xfe')],{});db['WhatsappQueueReport'][_0x5a7b('0x148')](db[_0x5a7b('0x1cc')],{});db[_0x5a7b('0x101')]['belongsTo'](db['WhatsappMessage'],{});db[_0x5a7b('0x101')][_0x5a7b('0x148')](db[_0x5a7b('0x12')],{});db[_0x5a7b('0x103')][_0x5a7b('0x148')](db[_0x5a7b('0xff')],{});db[_0x5a7b('0x103')]['belongsTo'](db[_0x5a7b('0xfe')],{});db[_0x5a7b('0x103')][_0x5a7b('0x148')](db[_0x5a7b('0xfa')],{'foreignKey':_0x5a7b('0x1ed'),'as':'FromAccount'});db[_0x5a7b('0x103')][_0x5a7b('0x148')](db[_0x5a7b('0xfa')],{'foreignKey':_0x5a7b('0x1ee'),'as':_0x5a7b('0x1d8')});db[_0x5a7b('0x103')]['belongsTo'](db[_0x5a7b('0x1cc')],{'foreignKey':_0x5a7b('0x1ef'),'as':_0x5a7b('0x1dc')});db['WhatsappTransferReport']['belongsTo'](db[_0x5a7b('0x12')],{'foreignKey':'FromUserId','as':_0x5a7b('0x1d3')});db[_0x5a7b('0x103')]['belongsTo'](db[_0x5a7b('0x12')],{'foreignKey':_0x5a7b('0x1d4'),'as':_0x5a7b('0x1d5')});db['WhatsappQueue'][_0x5a7b('0x11f')](db[_0x5a7b('0x12')],{'as':_0x5a7b('0x15f'),'through':_0x5a7b('0x37'),'foreignKey':'WhatsappQueueId'});db['WhatsappQueue'][_0x5a7b('0x11f')](db[_0x5a7b('0x14e')],{'through':_0x5a7b('0x1f0'),'as':_0x5a7b('0x189')});module[_0x5a7b('0x1f1')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 4c31d33..3c1f48d 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4528=['./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/authLocal','/api/auth/google','./api/authGoogle','/api/rpc','/api/version','./api/version','/api/system','./api/pm2','/api/webbar','./api/webbar','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','/index.html','username','password','newPassword','apiKey','firstName','lastName','phone','mobile','fax','email','clientSecret','code','accessKey','tenantId','accessToken','accessTokenSecret','consumerKey','calleridname','calleridnum','vidaooApiKey','clientEmail','privateKey','accountSid','localstationid','dsn','registry','isPlainObject','isString','replace','@@{','}@@','lodash','path','express','express-winston','util','./config/environment','./config/logger','api','auth','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_id','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceAgentReport','/api/members/reports','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','./api/smsInteraction','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/square/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport'];(function(_0x264e10,_0x5086c1){var _0x1c188a=function(_0x34d9f3){while(--_0x34d9f3){_0x264e10['push'](_0x264e10['shift']());}};_0x1c188a(++_0x5086c1);}(_0x4528,0x191));var _0x8452=function(_0xc24c08,_0x24badb){_0xc24c08=_0xc24c08-0x0;var _0xd50adb=_0x4528[_0xc24c08];return _0xd50adb;};'use strict';var _=require(_0x8452('0x0'));var path=require(_0x8452('0x1'));var express=require(_0x8452('0x2'));var ewinston=require(_0x8452('0x3'));var util=require(_0x8452('0x4'));var errors=require('./errors');var config=require(_0x8452('0x5'));var logger=require(_0x8452('0x6'))(_0x8452('0x7'));var authLogger=require(_0x8452('0x6'))(_0x8452('0x8'));exports['default']=function(_0x210ce0){_0x210ce0[_0x8452('0x9')](ewinston[_0x8452('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x40e539,_0xafd01d){var _0x50271b=_0x8452('0xb');if(!_[_0x8452('0xc')](_0x40e539[_0x8452('0xd')])){_0x50271b+=_0x8452('0xe');var _0x41a70b=_0x40e539[_0x8452('0xd')];maskSensitiveData(_0x41a70b);}return util[_0x8452('0xf')](_0x50271b,_0x40e539[_0x8452('0x10')],_0x40e539[_0x8452('0x11')][_0x8452('0x12')]?_0x40e539[_0x8452('0x11')][_0x8452('0x12')]:_0x40e539[_0x8452('0x13')][_0x8452('0x14')]||_0x40e539['ip'],_0x40e539[_0x8452('0x15')],_0xafd01d[_0x8452('0x16')],_0xafd01d['responseTime'],_0x40e539[_0x8452('0x17')]?_0x40e539['user']['id']:null,_0x40e539[_0x8452('0x17')]?_0x40e539['user'][_0x8452('0x18')]:null,_0x40e539[_0x8452('0x17')]?_0x40e539[_0x8452('0x17')][_0x8452('0x19')]:null,_0x41a70b?util[_0x8452('0x1a')](_0x41a70b,![],null):'');}}));_0x210ce0[_0x8452('0x9')](ewinston[_0x8452('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x3435c4,_0x7ba867){var _0xc35d24=_0x8452('0x1b');if(_0x3435c4['body']&&_0x3435c4[_0x8452('0xd')][_0x8452('0x1c')]&&_0x3435c4[_0x8452('0xd')]['agent_id']){_0xc35d24=_0x8452('0x1d');}return util[_0x8452('0xf')](_0xc35d24,_0x3435c4[_0x8452('0x10')],_0x3435c4[_0x8452('0x11')]['x-forwarded-for']?_0x3435c4['headers'][_0x8452('0x12')]:_0x3435c4[_0x8452('0x13')]['remoteAddress']||_0x3435c4['ip'],_0x3435c4[_0x8452('0x15')],_0x7ba867['statusCode'],_0x7ba867['responseTime'],_0x3435c4[_0x8452('0x17')]?_0x3435c4['user']['id']:null,_0x3435c4[_0x8452('0x17')]?_0x3435c4['user'][_0x8452('0x18')]:null,_0x3435c4[_0x8452('0x17')]?_0x3435c4[_0x8452('0x17')][_0x8452('0x19')]:null,_0x3435c4[_0x8452('0xd')]&&_0x3435c4[_0x8452('0xd')][_0x8452('0x1c')]?_0x3435c4['body'][_0x8452('0x1c')]:_0x8452('0x1e'),_0x3435c4[_0x8452('0xd')]&&_0x3435c4[_0x8452('0xd')][_0x8452('0x1f')]?_0x3435c4[_0x8452('0xd')][_0x8452('0x1f')]:'',_0x3435c4['body']&&_0x3435c4[_0x8452('0xd')][_0x8452('0x20')]?_0x3435c4['body'][_0x8452('0x20')]:'');},'ignoreRoute':function(_0xf32c01){var _0xe190dc=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xe190dc[_0x8452('0x21')](_0xf32c01[_0x8452('0x15')]);}}));_0x210ce0['use'](_0x8452('0x22'),require(_0x8452('0x23')));_0x210ce0['use'](_0x8452('0x24'),require(_0x8452('0x25')));_0x210ce0[_0x8452('0x9')](_0x8452('0x26'),require('./api/voiceContext'));_0x210ce0['use'](_0x8452('0x27'),require(_0x8452('0x28')));_0x210ce0[_0x8452('0x9')](_0x8452('0x29'),require('./api/voiceMusicOnHold'));_0x210ce0[_0x8452('0x9')](_0x8452('0x2a'),require(_0x8452('0x2b')));_0x210ce0[_0x8452('0x9')](_0x8452('0x2c'),require(_0x8452('0x2d')));_0x210ce0[_0x8452('0x9')](_0x8452('0x2e'),require(_0x8452('0x2f')));_0x210ce0[_0x8452('0x9')]('/api/voice/mails',require(_0x8452('0x30')));_0x210ce0[_0x8452('0x9')](_0x8452('0x31'),require(_0x8452('0x32')));_0x210ce0[_0x8452('0x9')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x210ce0[_0x8452('0x9')](_0x8452('0x33'),require('./api/voiceDialReport'));_0x210ce0[_0x8452('0x9')]('/api/voice/agents/reports',require(_0x8452('0x34')));_0x210ce0[_0x8452('0x9')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x210ce0[_0x8452('0x9')](_0x8452('0x35'),require('./api/memberReport'));_0x210ce0[_0x8452('0x9')]('/api/trunks',require(_0x8452('0x36')));_0x210ce0[_0x8452('0x9')](_0x8452('0x37'),require(_0x8452('0x38')));_0x210ce0[_0x8452('0x9')](_0x8452('0x39'),require('./api/mailServerOut'));_0x210ce0['use'](_0x8452('0x3a'),require(_0x8452('0x3b')));_0x210ce0[_0x8452('0x9')](_0x8452('0x3c'),require(_0x8452('0x3d')));_0x210ce0[_0x8452('0x9')](_0x8452('0x3e'),require(_0x8452('0x3f')));_0x210ce0[_0x8452('0x9')](_0x8452('0x40'),require(_0x8452('0x41')));_0x210ce0[_0x8452('0x9')](_0x8452('0x42'),require('./api/mailMessage'));_0x210ce0[_0x8452('0x9')](_0x8452('0x43'),require(_0x8452('0x44')));_0x210ce0[_0x8452('0x9')](_0x8452('0x45'),require(_0x8452('0x46')));_0x210ce0['use']('/api/dashboards',require(_0x8452('0x47')));_0x210ce0['use'](_0x8452('0x48'),require(_0x8452('0x49')));_0x210ce0[_0x8452('0x9')](_0x8452('0x4a'),require('./api/faxAccount'));_0x210ce0[_0x8452('0x9')](_0x8452('0x4b'),require(_0x8452('0x4c')));_0x210ce0['use'](_0x8452('0x4d'),require('./api/faxInteraction'));_0x210ce0[_0x8452('0x9')]('/api/fax/messages',require(_0x8452('0x4e')));_0x210ce0[_0x8452('0x9')](_0x8452('0x4f'),require(_0x8452('0x50')));_0x210ce0[_0x8452('0x9')](_0x8452('0x51'),require(_0x8452('0x52')));_0x210ce0[_0x8452('0x9')](_0x8452('0x53'),require('./api/smsAccount'));_0x210ce0[_0x8452('0x9')](_0x8452('0x54'),require(_0x8452('0x55')));_0x210ce0[_0x8452('0x9')]('/api/sms/interactions',require(_0x8452('0x56')));_0x210ce0[_0x8452('0x9')]('/api/sms/messages',require('./api/smsMessage'));_0x210ce0['use']('/api/sms/queues',require(_0x8452('0x57')));_0x210ce0[_0x8452('0x9')](_0x8452('0x58'),require('./api/openchannelAccount'));_0x210ce0[_0x8452('0x9')](_0x8452('0x59'),require(_0x8452('0x5a')));_0x210ce0['use']('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x210ce0['use'](_0x8452('0x5b'),require(_0x8452('0x5c')));_0x210ce0[_0x8452('0x9')](_0x8452('0x5d'),require(_0x8452('0x5e')));_0x210ce0[_0x8452('0x9')](_0x8452('0x5f'),require(_0x8452('0x60')));_0x210ce0['use'](_0x8452('0x61'),require(_0x8452('0x62')));_0x210ce0[_0x8452('0x9')]('/api/chat/applications',require('./api/chatApplication'));_0x210ce0['use'](_0x8452('0x63'),require(_0x8452('0x64')));_0x210ce0['use'](_0x8452('0x65'),require(_0x8452('0x66')));_0x210ce0[_0x8452('0x9')](_0x8452('0x67'),require(_0x8452('0x68')));_0x210ce0[_0x8452('0x9')](_0x8452('0x69'),require('./api/chatQueue'));_0x210ce0[_0x8452('0x9')](_0x8452('0x6a'),require(_0x8452('0x6b')));_0x210ce0[_0x8452('0x9')](_0x8452('0x6c'),require(_0x8452('0x6d')));_0x210ce0[_0x8452('0x9')](_0x8452('0x6e'),require(_0x8452('0x6f')));_0x210ce0[_0x8452('0x9')]('/api/cm/contacts',require('./api/cmContact'));_0x210ce0[_0x8452('0x9')](_0x8452('0x70'),require(_0x8452('0x71')));_0x210ce0[_0x8452('0x9')](_0x8452('0x72'),require('./api/cmHopperBlack'));_0x210ce0[_0x8452('0x9')](_0x8452('0x73'),require(_0x8452('0x74')));_0x210ce0['use'](_0x8452('0x75'),require(_0x8452('0x76')));_0x210ce0[_0x8452('0x9')](_0x8452('0x77'),require(_0x8452('0x78')));_0x210ce0[_0x8452('0x9')](_0x8452('0x79'),require(_0x8452('0x7a')));_0x210ce0[_0x8452('0x9')](_0x8452('0x7b'),require('./api/automation'));_0x210ce0[_0x8452('0x9')](_0x8452('0x7c'),require(_0x8452('0x7d')));_0x210ce0[_0x8452('0x9')](_0x8452('0x7e'),require(_0x8452('0x7f')));_0x210ce0[_0x8452('0x9')](_0x8452('0x80'),require('./api/condition'));_0x210ce0[_0x8452('0x9')]('/api/intervals',require(_0x8452('0x81')));_0x210ce0[_0x8452('0x9')](_0x8452('0x82'),require(_0x8452('0x83')));_0x210ce0[_0x8452('0x9')](_0x8452('0x84'),require(_0x8452('0x85')));_0x210ce0[_0x8452('0x9')]('/api/voiceQueuesLog',require(_0x8452('0x86')));_0x210ce0[_0x8452('0x9')](_0x8452('0x87'),require(_0x8452('0x88')));_0x210ce0['use']('/api/sounds',require(_0x8452('0x89')));_0x210ce0[_0x8452('0x9')](_0x8452('0x8a'),require(_0x8452('0x8b')));_0x210ce0['use'](_0x8452('0x8c'),require(_0x8452('0x8d')));_0x210ce0[_0x8452('0x9')](_0x8452('0x8e'),require(_0x8452('0x8f')));_0x210ce0['use'](_0x8452('0x90'),require('./api/variable'));_0x210ce0[_0x8452('0x9')](_0x8452('0x91'),require(_0x8452('0x92')));_0x210ce0[_0x8452('0x9')]('/api/integrations/reports',require(_0x8452('0x93')));_0x210ce0[_0x8452('0x9')](_0x8452('0x94'),require(_0x8452('0x95')));_0x210ce0['use'](_0x8452('0x96'),require('./api/analyticDefaultReport'));_0x210ce0[_0x8452('0x9')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x210ce0[_0x8452('0x9')](_0x8452('0x97'),require(_0x8452('0x98')));_0x210ce0[_0x8452('0x9')](_0x8452('0x99'),require(_0x8452('0x9a')));_0x210ce0['use'](_0x8452('0x9b'),require(_0x8452('0x9c')));_0x210ce0[_0x8452('0x9')](_0x8452('0x9d'),require('./api/intSalesforceAccount'));_0x210ce0[_0x8452('0x9')]('/api/integrations/salesforce/configurations',require(_0x8452('0x9e')));_0x210ce0[_0x8452('0x9')](_0x8452('0x9f'),require(_0x8452('0xa0')));_0x210ce0[_0x8452('0x9')]('/api/integrations/sugarcrm/accounts',require(_0x8452('0xa1')));_0x210ce0[_0x8452('0x9')](_0x8452('0xa2'),require(_0x8452('0xa3')));_0x210ce0[_0x8452('0x9')]('/api/integrations/sugarcrm/fields',require(_0x8452('0xa4')));_0x210ce0[_0x8452('0x9')](_0x8452('0xa5'),require('./api/intDeskAccount'));_0x210ce0['use'](_0x8452('0xa6'),require(_0x8452('0xa7')));_0x210ce0['use'](_0x8452('0xa8'),require('./api/intDeskField'));_0x210ce0['use'](_0x8452('0xa9'),require(_0x8452('0xaa')));_0x210ce0[_0x8452('0x9')](_0x8452('0xab'),require(_0x8452('0xac')));_0x210ce0[_0x8452('0x9')](_0x8452('0xad'),require(_0x8452('0xae')));_0x210ce0[_0x8452('0x9')](_0x8452('0xaf'),require('./api/intZendeskAccount'));_0x210ce0[_0x8452('0x9')](_0x8452('0xb0'),require(_0x8452('0xb1')));_0x210ce0[_0x8452('0x9')]('/api/integrations/zendesk/fields',require(_0x8452('0xb2')));_0x210ce0[_0x8452('0x9')](_0x8452('0xb3'),require('./api/intFreshdeskAccount'));_0x210ce0[_0x8452('0x9')](_0x8452('0xb4'),require(_0x8452('0xb5')));_0x210ce0[_0x8452('0x9')](_0x8452('0xb6'),require(_0x8452('0xb7')));_0x210ce0[_0x8452('0x9')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x210ce0[_0x8452('0x9')](_0x8452('0xb8'),require(_0x8452('0xb9')));_0x210ce0[_0x8452('0x9')](_0x8452('0xba'),require(_0x8452('0xbb')));_0x210ce0[_0x8452('0x9')](_0x8452('0xbc'),require(_0x8452('0xbd')));_0x210ce0[_0x8452('0x9')](_0x8452('0xbe'),require(_0x8452('0xbf')));_0x210ce0['use']('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x210ce0[_0x8452('0x9')](_0x8452('0xc0'),require(_0x8452('0xc1')));_0x210ce0[_0x8452('0x9')](_0x8452('0xc2'),require(_0x8452('0xc3')));_0x210ce0[_0x8452('0x9')]('/api/integrations/dynamics365/fields',require(_0x8452('0xc4')));_0x210ce0['use'](_0x8452('0xc5'),require(_0x8452('0xc6')));_0x210ce0[_0x8452('0x9')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x210ce0['use'](_0x8452('0xc7'),require(_0x8452('0xc8')));_0x210ce0[_0x8452('0x9')]('/api/networks',require(_0x8452('0xc9')));_0x210ce0[_0x8452('0x9')](_0x8452('0xca'),require(_0x8452('0xcb')));_0x210ce0[_0x8452('0x9')](_0x8452('0xcc'),require(_0x8452('0xcd')));_0x210ce0['use'](_0x8452('0xce'),require('./api/jscriptyAnswerReport'));_0x210ce0[_0x8452('0x9')]('/api/jscripty/questions/reports',require(_0x8452('0xcf')));_0x210ce0[_0x8452('0x9')](_0x8452('0xd0'),require('./api/jscriptySessionReport'));_0x210ce0[_0x8452('0x9')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x210ce0[_0x8452('0x9')](_0x8452('0xd1'),require('./api/squareReport'));_0x210ce0[_0x8452('0x9')]('/api/square/details/reports',require(_0x8452('0xd2')));_0x210ce0[_0x8452('0x9')](_0x8452('0xd3'),require('./api/jscriptyProject'));_0x210ce0[_0x8452('0x9')](_0x8452('0xd4'),require(_0x8452('0xd5')));_0x210ce0[_0x8452('0x9')]('/api/square/odbc',require(_0x8452('0xd6')));_0x210ce0[_0x8452('0x9')](_0x8452('0xd7'),require(_0x8452('0xd8')));_0x210ce0[_0x8452('0x9')](_0x8452('0xd9'),require(_0x8452('0xda')));_0x210ce0['use'](_0x8452('0xdb'),require(_0x8452('0xdc')));_0x210ce0[_0x8452('0x9')](_0x8452('0xdd'),require(_0x8452('0xde')));_0x210ce0[_0x8452('0x9')]('/api/license',require('./api/license'));_0x210ce0[_0x8452('0x9')](_0x8452('0xdf'),require(_0x8452('0xe0')));_0x210ce0['use'](_0x8452('0xe1'),require(_0x8452('0xe2')));_0x210ce0[_0x8452('0x9')](_0x8452('0xe3'),require(_0x8452('0xe4')));_0x210ce0['use']('/api/plugins',require(_0x8452('0xe5')));_0x210ce0[_0x8452('0x9')]('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x210ce0[_0x8452('0x9')](_0x8452('0xe6'),require('./api/chatTransferReport'));_0x210ce0[_0x8452('0x9')](_0x8452('0xe7'),require(_0x8452('0xe8')));_0x210ce0[_0x8452('0x9')]('/api/openchannel/reports/transfer',require(_0x8452('0xe9')));_0x210ce0[_0x8452('0x9')](_0x8452('0xea'),require(_0x8452('0xeb')));_0x210ce0[_0x8452('0x9')](_0x8452('0xec'),require(_0x8452('0xed')));_0x210ce0[_0x8452('0x9')](_0x8452('0xee'),require(_0x8452('0xef')));_0x210ce0[_0x8452('0x9')](_0x8452('0xf0'),require(_0x8452('0xf1')));_0x210ce0[_0x8452('0x9')](_0x8452('0xf2'),require(_0x8452('0xf3')));_0x210ce0[_0x8452('0x9')](_0x8452('0xf4'),require('./api/userProfileResource'));_0x210ce0[_0x8452('0x9')](_0x8452('0xf5'),require(_0x8452('0xf6')));_0x210ce0[_0x8452('0x9')](_0x8452('0xf7'),require(_0x8452('0xf8')));_0x210ce0['use'](_0x8452('0xf9'),require(_0x8452('0xfa')));_0x210ce0['use'](_0x8452('0xfb'),require('./api/whatsappInteraction'));_0x210ce0[_0x8452('0x9')](_0x8452('0xfc'),require(_0x8452('0xfd')));_0x210ce0[_0x8452('0x9')](_0x8452('0xfe'),require(_0x8452('0xff')));_0x210ce0[_0x8452('0x9')](_0x8452('0x100'),require(_0x8452('0x101')));_0x210ce0[_0x8452('0x9')]('/api/whatsapp/queues',require(_0x8452('0x102')));_0x210ce0[_0x8452('0x9')](_0x8452('0x103'),require(_0x8452('0x104')));_0x210ce0[_0x8452('0x9')](_0x8452('0x105'),require('./api/realtime'));_0x210ce0[_0x8452('0x9')]('/api/auth/local',require(_0x8452('0x106')));_0x210ce0[_0x8452('0x9')](_0x8452('0x107'),require(_0x8452('0x108')));_0x210ce0[_0x8452('0x9')]('/api/jira',require('./api/jira'));_0x210ce0[_0x8452('0x9')](_0x8452('0x109'),require('./api/rpc'));_0x210ce0[_0x8452('0x9')](_0x8452('0x10a'),require(_0x8452('0x10b')));_0x210ce0[_0x8452('0x9')](_0x8452('0x10c'),require('./api/system'));_0x210ce0[_0x8452('0x9')]('/api/pm2',require(_0x8452('0x10d')));_0x210ce0[_0x8452('0x9')](_0x8452('0x10e'),require(_0x8452('0x10f')));_0x210ce0[_0x8452('0x9')]('/apidoc',express[_0x8452('0x110')](path[_0x8452('0x111')](config[_0x8452('0x112')],'/apidoc')));_0x210ce0[_0x8452('0x9')](_0x8452('0x113'),express[_0x8452('0x110')](path[_0x8452('0x111')](config[_0x8452('0x112')],_0x8452('0x113'))));_0x210ce0[_0x8452('0x9')](_0x8452('0x114'),express[_0x8452('0x110')](path[_0x8452('0x111')](config[_0x8452('0x112')],_0x8452('0x114'))));_0x210ce0[_0x8452('0x9')](_0x8452('0x115'),express['static'](path[_0x8452('0x111')](config[_0x8452('0x112')],_0x8452('0x116'),_0x8452('0x117'))));_0x210ce0['use'](_0x8452('0x118'),express['static'](path[_0x8452('0x111')](config[_0x8452('0x112')],_0x8452('0x119'))));_0x210ce0[_0x8452('0x11a')](_0x8452('0x11b'))[_0x8452('0x11c')](errors[0x194]);_0x210ce0[_0x8452('0x11a')]('/*')['get'](function(_0x194fdb,_0x59489c){_0x59489c['sendFile'](path['resolve'](_0x210ce0[_0x8452('0x11c')]('appPath')+_0x8452('0x11d')));});};var sensitiveFields=[_0x8452('0x11e'),_0x8452('0x11f'),_0x8452('0x120'),_0x8452('0x121'),_0x8452('0x122'),_0x8452('0x123'),'street',_0x8452('0x124'),_0x8452('0x125'),_0x8452('0x126'),_0x8452('0x127'),'clientId',_0x8452('0x128'),'securityToken',_0x8452('0x129'),_0x8452('0x12a'),_0x8452('0x12b'),'token','channelSecret',_0x8452('0x12c'),_0x8452('0x12d'),'authToken',_0x8452('0x12e'),'consumerSecret','membername',_0x8452('0x12f'),_0x8452('0x130'),'exten',_0x8452('0x131'),_0x8452('0x132'),_0x8452('0x133'),'accesskeyid','secretaccesskey','key',_0x8452('0x17'),'pass',_0x8452('0x134'),_0x8452('0x135'),_0x8452('0x136'),'secret',_0x8452('0x137'),'oldPassword'];function maskSensitiveData(_0x5d1ad8){var _0x281330=/(?!^)[\s\S](?!$)/g;if(!_[_0x8452('0x138')](_0x5d1ad8))return;for(var _0x5da09e in _0x5d1ad8){if(_['isArray'](_0x5d1ad8[_0x5da09e])){for(var _0x581740=0x0;_0x581740<_0x5d1ad8[_0x5da09e]['length'];_0x581740++){maskSensitiveData(_0x5d1ad8[_0x5da09e][_0x581740]);}}else if(_['isPlainObject'](_0x5d1ad8[_0x5da09e])){maskSensitiveData(_0x5d1ad8[_0x5da09e]);}else if(_[_0x8452('0x139')](_0x5d1ad8[_0x5da09e])){_0x5d1ad8[_0x5da09e]=_0x5d1ad8[_0x5da09e][_0x8452('0x13a')](/{{{/g,_0x8452('0x13b'))[_0x8452('0x13a')](/}}}/g,_0x8452('0x13c'))[_0x8452('0x13a')](/{{/g,'@{')[_0x8452('0x13a')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x5da09e)){_0x5d1ad8[_0x5da09e]=_0x5d1ad8[_0x5da09e][_0x8452('0x13a')](_0x281330,'*');}}}} \ No newline at end of file +var _0x9039=['resolve','appPath','/index.html','username','password','apiKey','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','token','accessToken','authToken','consumerKey','consumerSecret','calleridname','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','localstationid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','includes','lodash','path','express','util','./errors','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_id','agent_name','test','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./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/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/cannedAnswer','/api/dispositions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/authLocal','/api/auth/google','./api/jira','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/webbar','/apidoc','join','/www','static','root','/demo','/snippet','snippet','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get'];(function(_0x5f4e2e,_0x4ad6ea){var _0x4932f0=function(_0x13f417){while(--_0x13f417){_0x5f4e2e['push'](_0x5f4e2e['shift']());}};_0x4932f0(++_0x4ad6ea);}(_0x9039,0x16f));var _0x9903=function(_0x4777fc,_0x40806d){_0x4777fc=_0x4777fc-0x0;var _0x28523f=_0x9039[_0x4777fc];return _0x28523f;};'use strict';var _=require(_0x9903('0x0'));var path=require(_0x9903('0x1'));var express=require(_0x9903('0x2'));var ewinston=require('express-winston');var util=require(_0x9903('0x3'));var errors=require(_0x9903('0x4'));var config=require('./config/environment');var logger=require(_0x9903('0x5'))(_0x9903('0x6'));var authLogger=require(_0x9903('0x5'))(_0x9903('0x7'));exports[_0x9903('0x8')]=function(_0x41891d){_0x41891d[_0x9903('0x9')](ewinston[_0x9903('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1fb7cd,_0x33b70c){var _0x456344=_0x9903('0xb');if(!_[_0x9903('0xc')](_0x1fb7cd[_0x9903('0xd')])){_0x456344+='\x20body=%s';var _0x535523=_0x1fb7cd['body'];maskSensitiveData(_0x535523);}return util[_0x9903('0xe')](_0x456344,_0x1fb7cd[_0x9903('0xf')],_0x1fb7cd[_0x9903('0x10')]['x-forwarded-for']?_0x1fb7cd['headers'][_0x9903('0x11')]:_0x1fb7cd[_0x9903('0x12')][_0x9903('0x13')]||_0x1fb7cd['ip'],_0x1fb7cd[_0x9903('0x14')],_0x33b70c[_0x9903('0x15')],_0x33b70c[_0x9903('0x16')],_0x1fb7cd[_0x9903('0x17')]?_0x1fb7cd[_0x9903('0x17')]['id']:null,_0x1fb7cd[_0x9903('0x17')]?_0x1fb7cd[_0x9903('0x17')][_0x9903('0x18')]:null,_0x1fb7cd[_0x9903('0x17')]?_0x1fb7cd[_0x9903('0x17')][_0x9903('0x19')]:null,_0x535523?util[_0x9903('0x1a')](_0x535523,![],null):'');}}));_0x41891d[_0x9903('0x9')](ewinston[_0x9903('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x46b195,_0x17767d){var _0x26012e=_0x9903('0x1b');if(_0x46b195[_0x9903('0xd')]&&_0x46b195[_0x9903('0xd')][_0x9903('0x1c')]&&_0x46b195[_0x9903('0xd')]['agent_id']){_0x26012e=_0x9903('0x1d');}return util[_0x9903('0xe')](_0x26012e,_0x46b195['method'],_0x46b195['headers'][_0x9903('0x11')]?_0x46b195[_0x9903('0x10')][_0x9903('0x11')]:_0x46b195[_0x9903('0x12')][_0x9903('0x13')]||_0x46b195['ip'],_0x46b195[_0x9903('0x14')],_0x17767d['statusCode'],_0x17767d[_0x9903('0x16')],_0x46b195[_0x9903('0x17')]?_0x46b195['user']['id']:null,_0x46b195[_0x9903('0x17')]?_0x46b195[_0x9903('0x17')][_0x9903('0x18')]:null,_0x46b195[_0x9903('0x17')]?_0x46b195[_0x9903('0x17')][_0x9903('0x19')]:null,_0x46b195['body']&&_0x46b195[_0x9903('0xd')][_0x9903('0x1c')]?_0x46b195['body']['device']:_0x9903('0x1e'),_0x46b195[_0x9903('0xd')]&&_0x46b195[_0x9903('0xd')][_0x9903('0x1f')]?_0x46b195[_0x9903('0xd')][_0x9903('0x1f')]:'',_0x46b195[_0x9903('0xd')]&&_0x46b195['body'][_0x9903('0x20')]?_0x46b195[_0x9903('0xd')][_0x9903('0x20')]:'');},'ignoreRoute':function(_0x2b3502){var _0x2e3174=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2e3174[_0x9903('0x21')](_0x2b3502[_0x9903('0x14')]);}}));_0x41891d['use']('/api/users',require(_0x9903('0x22')));_0x41891d[_0x9903('0x9')]('/api/voice/chanspy',require(_0x9903('0x23')));_0x41891d[_0x9903('0x9')](_0x9903('0x24'),require(_0x9903('0x25')));_0x41891d[_0x9903('0x9')](_0x9903('0x26'),require('./api/voiceExtension'));_0x41891d[_0x9903('0x9')](_0x9903('0x27'),require('./api/voiceMusicOnHold'));_0x41891d[_0x9903('0x9')](_0x9903('0x28'),require(_0x9903('0x29')));_0x41891d[_0x9903('0x9')](_0x9903('0x2a'),require(_0x9903('0x2b')));_0x41891d[_0x9903('0x9')](_0x9903('0x2c'),require(_0x9903('0x2d')));_0x41891d[_0x9903('0x9')](_0x9903('0x2e'),require('./api/voiceMail'));_0x41891d[_0x9903('0x9')](_0x9903('0x2f'),require('./api/voiceMailMessage'));_0x41891d['use'](_0x9903('0x30'),require(_0x9903('0x31')));_0x41891d[_0x9903('0x9')](_0x9903('0x32'),require(_0x9903('0x33')));_0x41891d[_0x9903('0x9')]('/api/voice/agents/reports',require(_0x9903('0x34')));_0x41891d[_0x9903('0x9')](_0x9903('0x35'),require(_0x9903('0x36')));_0x41891d[_0x9903('0x9')](_0x9903('0x37'),require(_0x9903('0x38')));_0x41891d['use']('/api/trunks',require(_0x9903('0x39')));_0x41891d[_0x9903('0x9')](_0x9903('0x3a'),require('./api/voiceTransferReport'));_0x41891d[_0x9903('0x9')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x41891d[_0x9903('0x9')](_0x9903('0x3b'),require(_0x9903('0x3c')));_0x41891d[_0x9903('0x9')]('/api/mail/queues',require(_0x9903('0x3d')));_0x41891d[_0x9903('0x9')](_0x9903('0x3e'),require(_0x9903('0x3f')));_0x41891d[_0x9903('0x9')](_0x9903('0x40'),require(_0x9903('0x41')));_0x41891d[_0x9903('0x9')](_0x9903('0x42'),require(_0x9903('0x43')));_0x41891d['use'](_0x9903('0x44'),require('./api/mailApplication'));_0x41891d[_0x9903('0x9')](_0x9903('0x45'),require(_0x9903('0x46')));_0x41891d[_0x9903('0x9')](_0x9903('0x47'),require(_0x9903('0x48')));_0x41891d[_0x9903('0x9')]('/api/dashboards/items',require('./api/dashboardItem'));_0x41891d[_0x9903('0x9')](_0x9903('0x49'),require(_0x9903('0x4a')));_0x41891d[_0x9903('0x9')](_0x9903('0x4b'),require('./api/faxApplication'));_0x41891d[_0x9903('0x9')]('/api/fax/interactions',require(_0x9903('0x4c')));_0x41891d[_0x9903('0x9')](_0x9903('0x4d'),require(_0x9903('0x4e')));_0x41891d['use'](_0x9903('0x4f'),require(_0x9903('0x50')));_0x41891d[_0x9903('0x9')](_0x9903('0x51'),require(_0x9903('0x52')));_0x41891d[_0x9903('0x9')](_0x9903('0x53'),require(_0x9903('0x54')));_0x41891d[_0x9903('0x9')](_0x9903('0x55'),require(_0x9903('0x56')));_0x41891d['use'](_0x9903('0x57'),require(_0x9903('0x58')));_0x41891d[_0x9903('0x9')](_0x9903('0x59'),require(_0x9903('0x5a')));_0x41891d[_0x9903('0x9')](_0x9903('0x5b'),require(_0x9903('0x5c')));_0x41891d['use'](_0x9903('0x5d'),require(_0x9903('0x5e')));_0x41891d['use'](_0x9903('0x5f'),require(_0x9903('0x60')));_0x41891d[_0x9903('0x9')](_0x9903('0x61'),require(_0x9903('0x62')));_0x41891d[_0x9903('0x9')](_0x9903('0x63'),require(_0x9903('0x64')));_0x41891d[_0x9903('0x9')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x41891d[_0x9903('0x9')](_0x9903('0x65'),require(_0x9903('0x66')));_0x41891d[_0x9903('0x9')](_0x9903('0x67'),require(_0x9903('0x68')));_0x41891d[_0x9903('0x9')]('/api/chat/applications',require(_0x9903('0x69')));_0x41891d[_0x9903('0x9')](_0x9903('0x6a'),require(_0x9903('0x6b')));_0x41891d['use']('/api/chat/messages',require(_0x9903('0x6c')));_0x41891d[_0x9903('0x9')](_0x9903('0x6d'),require(_0x9903('0x6e')));_0x41891d[_0x9903('0x9')](_0x9903('0x6f'),require('./api/chatQueue'));_0x41891d['use'](_0x9903('0x70'),require(_0x9903('0x71')));_0x41891d[_0x9903('0x9')](_0x9903('0x72'),require(_0x9903('0x73')));_0x41891d[_0x9903('0x9')](_0x9903('0x74'),require(_0x9903('0x75')));_0x41891d[_0x9903('0x9')](_0x9903('0x76'),require('./api/cmContact'));_0x41891d[_0x9903('0x9')](_0x9903('0x77'),require(_0x9903('0x78')));_0x41891d[_0x9903('0x9')]('/api/cm/hopper_black',require(_0x9903('0x79')));_0x41891d[_0x9903('0x9')](_0x9903('0x7a'),require(_0x9903('0x7b')));_0x41891d['use'](_0x9903('0x7c'),require(_0x9903('0x7d')));_0x41891d['use'](_0x9903('0x7e'),require(_0x9903('0x7f')));_0x41891d[_0x9903('0x9')]('/api/actions',require(_0x9903('0x80')));_0x41891d[_0x9903('0x9')](_0x9903('0x81'),require('./api/automation'));_0x41891d[_0x9903('0x9')]('/api/canned_answers',require(_0x9903('0x82')));_0x41891d[_0x9903('0x9')](_0x9903('0x83'),require('./api/disposition'));_0x41891d[_0x9903('0x9')]('/api/conditions',require(_0x9903('0x84')));_0x41891d['use'](_0x9903('0x85'),require(_0x9903('0x86')));_0x41891d[_0x9903('0x9')]('/api/pauses',require(_0x9903('0x87')));_0x41891d['use'](_0x9903('0x88'),require(_0x9903('0x89')));_0x41891d[_0x9903('0x9')](_0x9903('0x8a'),require(_0x9903('0x8b')));_0x41891d[_0x9903('0x9')](_0x9903('0x8c'),require('./api/schedule'));_0x41891d[_0x9903('0x9')](_0x9903('0x8d'),require(_0x9903('0x8e')));_0x41891d['use'](_0x9903('0x8f'),require('./api/tag'));_0x41891d['use'](_0x9903('0x90'),require(_0x9903('0x91')));_0x41891d['use'](_0x9903('0x92'),require(_0x9903('0x93')));_0x41891d['use']('/api/variables',require(_0x9903('0x94')));_0x41891d[_0x9903('0x9')]('/api/integrations',require(_0x9903('0x95')));_0x41891d[_0x9903('0x9')](_0x9903('0x96'),require('./api/integrationReport'));_0x41891d['use'](_0x9903('0x97'),require(_0x9903('0x98')));_0x41891d[_0x9903('0x9')](_0x9903('0x99'),require(_0x9903('0x9a')));_0x41891d[_0x9903('0x9')](_0x9903('0x9b'),require(_0x9903('0x9c')));_0x41891d[_0x9903('0x9')](_0x9903('0x9d'),require(_0x9903('0x9e')));_0x41891d[_0x9903('0x9')](_0x9903('0x9f'),require(_0x9903('0xa0')));_0x41891d[_0x9903('0x9')]('/api/analytics/tree_reports',require(_0x9903('0xa1')));_0x41891d['use'](_0x9903('0xa2'),require('./api/intSalesforceAccount'));_0x41891d['use'](_0x9903('0xa3'),require(_0x9903('0xa4')));_0x41891d[_0x9903('0x9')](_0x9903('0xa5'),require(_0x9903('0xa6')));_0x41891d['use'](_0x9903('0xa7'),require(_0x9903('0xa8')));_0x41891d[_0x9903('0x9')](_0x9903('0xa9'),require(_0x9903('0xaa')));_0x41891d[_0x9903('0x9')](_0x9903('0xab'),require(_0x9903('0xac')));_0x41891d['use']('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x41891d[_0x9903('0x9')](_0x9903('0xad'),require(_0x9903('0xae')));_0x41891d['use']('/api/integrations/desk/fields',require('./api/intDeskField'));_0x41891d[_0x9903('0x9')](_0x9903('0xaf'),require(_0x9903('0xb0')));_0x41891d[_0x9903('0x9')](_0x9903('0xb1'),require(_0x9903('0xb2')));_0x41891d[_0x9903('0x9')]('/api/integrations/zoho/fields',require(_0x9903('0xb3')));_0x41891d[_0x9903('0x9')](_0x9903('0xb4'),require(_0x9903('0xb5')));_0x41891d[_0x9903('0x9')](_0x9903('0xb6'),require('./api/intZendeskConfiguration'));_0x41891d['use'](_0x9903('0xb7'),require(_0x9903('0xb8')));_0x41891d[_0x9903('0x9')](_0x9903('0xb9'),require(_0x9903('0xba')));_0x41891d['use']('/api/integrations/freshdesk/configurations',require(_0x9903('0xbb')));_0x41891d['use'](_0x9903('0xbc'),require(_0x9903('0xbd')));_0x41891d[_0x9903('0x9')](_0x9903('0xbe'),require(_0x9903('0xbf')));_0x41891d[_0x9903('0x9')]('/api/integrations/vtiger/configurations',require(_0x9903('0xc0')));_0x41891d[_0x9903('0x9')]('/api/integrations/vtiger/fields',require(_0x9903('0xc1')));_0x41891d['use'](_0x9903('0xc2'),require('./api/intServicenowAccount'));_0x41891d[_0x9903('0x9')](_0x9903('0xc3'),require(_0x9903('0xc4')));_0x41891d[_0x9903('0x9')]('/api/integrations/servicenow/fields',require(_0x9903('0xc5')));_0x41891d[_0x9903('0x9')](_0x9903('0xc6'),require(_0x9903('0xc7')));_0x41891d['use']('/api/integrations/dynamics365/configurations',require(_0x9903('0xc8')));_0x41891d['use']('/api/integrations/dynamics365/fields',require(_0x9903('0xc9')));_0x41891d[_0x9903('0x9')](_0x9903('0xca'),require(_0x9903('0xcb')));_0x41891d[_0x9903('0x9')](_0x9903('0xcc'),require(_0x9903('0xcd')));_0x41891d[_0x9903('0x9')](_0x9903('0xce'),require(_0x9903('0xcf')));_0x41891d[_0x9903('0x9')](_0x9903('0xd0'),require('./api/network'));_0x41891d['use'](_0x9903('0xd1'),require(_0x9903('0xd2')));_0x41891d[_0x9903('0x9')](_0x9903('0xd3'),require(_0x9903('0xd4')));_0x41891d[_0x9903('0x9')](_0x9903('0xd5'),require(_0x9903('0xd6')));_0x41891d[_0x9903('0x9')](_0x9903('0xd7'),require(_0x9903('0xd8')));_0x41891d['use']('/api/jscripty/sessions/reports',require(_0x9903('0xd9')));_0x41891d[_0x9903('0x9')](_0x9903('0xda'),require(_0x9903('0xdb')));_0x41891d[_0x9903('0x9')](_0x9903('0xdc'),require(_0x9903('0xdd')));_0x41891d['use'](_0x9903('0xde'),require(_0x9903('0xdf')));_0x41891d['use']('/api/jscripty/projects',require(_0x9903('0xe0')));_0x41891d['use'](_0x9903('0xe1'),require(_0x9903('0xe2')));_0x41891d[_0x9903('0x9')](_0x9903('0xe3'),require('./api/squareOdbc'));_0x41891d[_0x9903('0x9')]('/api/square/projects',require('./api/squareProject'));_0x41891d[_0x9903('0x9')]('/api/square/recordings',require(_0x9903('0xe4')));_0x41891d[_0x9903('0x9')](_0x9903('0xe5'),require('./api/squareMessage'));_0x41891d[_0x9903('0x9')](_0x9903('0xe6'),require(_0x9903('0xe7')));_0x41891d[_0x9903('0x9')](_0x9903('0xe8'),require('./api/license'));_0x41891d[_0x9903('0x9')](_0x9903('0xe9'),require(_0x9903('0xea')));_0x41891d[_0x9903('0x9')](_0x9903('0xeb'),require(_0x9903('0xec')));_0x41891d[_0x9903('0x9')](_0x9903('0xed'),require('./api/attachment'));_0x41891d['use']('/api/plugins',require(_0x9903('0xee')));_0x41891d[_0x9903('0x9')](_0x9903('0xef'),require(_0x9903('0xf0')));_0x41891d[_0x9903('0x9')]('/api/chat/reports/transfer',require(_0x9903('0xf1')));_0x41891d[_0x9903('0x9')](_0x9903('0xf2'),require(_0x9903('0xf3')));_0x41891d[_0x9903('0x9')]('/api/openchannel/reports/transfer',require(_0x9903('0xf4')));_0x41891d[_0x9903('0x9')](_0x9903('0xf5'),require(_0x9903('0xf6')));_0x41891d[_0x9903('0x9')](_0x9903('0xf7'),require('./api/cmList'));_0x41891d[_0x9903('0x9')](_0x9903('0xf8'),require(_0x9903('0xf9')));_0x41891d['use']('/api/userProfiles',require(_0x9903('0xfa')));_0x41891d[_0x9903('0x9')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x41891d['use'](_0x9903('0xfb'),require(_0x9903('0xfc')));_0x41891d[_0x9903('0x9')]('/api/userNotifications',require(_0x9903('0xfd')));_0x41891d[_0x9903('0x9')](_0x9903('0xfe'),require(_0x9903('0xff')));_0x41891d[_0x9903('0x9')](_0x9903('0x100'),require(_0x9903('0x101')));_0x41891d[_0x9903('0x9')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x41891d[_0x9903('0x9')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x41891d[_0x9903('0x9')](_0x9903('0x102'),require(_0x9903('0x103')));_0x41891d[_0x9903('0x9')](_0x9903('0x104'),require(_0x9903('0x105')));_0x41891d[_0x9903('0x9')]('/api/whatsapp/queues',require(_0x9903('0x106')));_0x41891d['use'](_0x9903('0x107'),require(_0x9903('0x108')));_0x41891d[_0x9903('0x9')](_0x9903('0x109'),require('./api/realtime'));_0x41891d[_0x9903('0x9')]('/api/auth/local',require(_0x9903('0x10a')));_0x41891d['use'](_0x9903('0x10b'),require('./api/authGoogle'));_0x41891d[_0x9903('0x9')]('/api/jira',require(_0x9903('0x10c')));_0x41891d[_0x9903('0x9')]('/api/rpc',require(_0x9903('0x10d')));_0x41891d[_0x9903('0x9')]('/api/version',require(_0x9903('0x10e')));_0x41891d[_0x9903('0x9')](_0x9903('0x10f'),require(_0x9903('0x110')));_0x41891d['use'](_0x9903('0x111'),require('./api/pm2'));_0x41891d[_0x9903('0x9')]('/api/webbar',require(_0x9903('0x112')));_0x41891d[_0x9903('0x9')](_0x9903('0x113'),express['static'](path[_0x9903('0x114')](config['root'],_0x9903('0x113'))));_0x41891d['use'](_0x9903('0x115'),express[_0x9903('0x116')](path[_0x9903('0x114')](config[_0x9903('0x117')],'/www')));_0x41891d[_0x9903('0x9')](_0x9903('0x118'),express[_0x9903('0x116')](path[_0x9903('0x114')](config['root'],'/demo')));_0x41891d[_0x9903('0x9')](_0x9903('0x119'),express['static'](path['join'](config[_0x9903('0x117')],_0x9903('0x11a'),'3.0.0')));_0x41891d[_0x9903('0x9')](_0x9903('0x11b'),express[_0x9903('0x116')](path[_0x9903('0x114')](config[_0x9903('0x117')],'/server/files/plugins')));_0x41891d[_0x9903('0x11c')](_0x9903('0x11d'))[_0x9903('0x11e')](errors[0x194]);_0x41891d[_0x9903('0x11c')]('/*')[_0x9903('0x11e')](function(_0x740161,_0x7fa673){_0x7fa673['sendFile'](path[_0x9903('0x11f')](_0x41891d[_0x9903('0x11e')](_0x9903('0x120'))+_0x9903('0x121')));});};var sensitiveFields=[_0x9903('0x122'),_0x9903('0x123'),'newPassword',_0x9903('0x124'),'firstName',_0x9903('0x125'),_0x9903('0x126'),_0x9903('0x127'),_0x9903('0x128'),_0x9903('0x129'),_0x9903('0x12a'),_0x9903('0x12b'),_0x9903('0x12c'),_0x9903('0x12d'),_0x9903('0x12e'),'accessKey','tenantId',_0x9903('0x12f'),'channelSecret',_0x9903('0x130'),'accessTokenSecret',_0x9903('0x131'),_0x9903('0x132'),_0x9903('0x133'),'membername',_0x9903('0x134'),_0x9903('0x135'),_0x9903('0x136'),'vidaooApiKey',_0x9903('0x137'),_0x9903('0x138'),_0x9903('0x139'),_0x9903('0x13a'),_0x9903('0x13b'),'user',_0x9903('0x13c'),'accountSid',_0x9903('0x13d'),_0x9903('0x13e'),_0x9903('0x13f'),_0x9903('0x140'),'oldPassword'];function maskSensitiveData(_0x587a34){var _0x3d5204=/(?!^)[\s\S](?!$)/g;if(!_[_0x9903('0x141')](_0x587a34))return;for(var _0x476e87 in _0x587a34){if(_[_0x9903('0x142')](_0x587a34[_0x476e87])){for(var _0x38dad4=0x0;_0x38dad4<_0x587a34[_0x476e87][_0x9903('0x143')];_0x38dad4++){maskSensitiveData(_0x587a34[_0x476e87][_0x38dad4]);}}else if(_[_0x9903('0x141')](_0x587a34[_0x476e87])){maskSensitiveData(_0x587a34[_0x476e87]);}else if(_[_0x9903('0x144')](_0x587a34[_0x476e87])){_0x587a34[_0x476e87]=_0x587a34[_0x476e87][_0x9903('0x145')](/{{{/g,'@@{')[_0x9903('0x145')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0x9903('0x145')](/}}/g,'}@');if(_[_0x9903('0x146')](sensitiveFields,_0x476e87)){_0x587a34[_0x476e87]=_0x587a34[_0x476e87]['replace'](_0x3d5204,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 97fd9b9..d3b14cd 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d03=['../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','bluebird','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.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/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc'];(function(_0x25ebbe,_0x429631){var _0x5996f0=function(_0x412c64){while(--_0x412c64){_0x25ebbe['push'](_0x25ebbe['shift']());}};_0x5996f0(++_0x429631);}(_0x8d03,0xb1));var _0x38d0=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x8d03[_0x2d7f0e];return _0x110b07;};'use strict';var jayson=require(_0x38d0('0x0'));var BPromise=require(_0x38d0('0x1'));var _=require(_0x38d0('0x2'));var config=require('../config/environment');exports[_0x38d0('0x3')]=function(){return new BPromise(function(_0x1ee8ea,_0x228115){var _0x48c328={};_0x48c328=_[_0x38d0('0x4')](_0x48c328,require('../api/user/user.rpc'));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x5')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x6')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x7')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x8')));_0x48c328=_['merge'](_0x48c328,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x9')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0xa')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require('../api/memberReport/memberReport.rpc'));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0xb')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0xc')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0xd')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0xe')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require('../api/mailAccount/mailAccount.rpc'));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0xf')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x10')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x11')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x12')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x13')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x14')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require('../api/faxApplication/faxApplication.rpc'));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x15')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x16')));_0x48c328=_['merge'](_0x48c328,require('../api/faxQueue/faxQueue.rpc'));_0x48c328=_['merge'](_0x48c328,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x17')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x18')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x19')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x1a')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x1b')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x1c')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x1d')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x1e')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require('../api/chatInteraction/chatInteraction.rpc'));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require('../api/chatMessage/chatMessage.rpc'));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require('../api/chatQueue/chatQueue.rpc'));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x1f')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x20')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x21')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x22')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x23')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x24')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x25')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require('../api/pause/pause.rpc'));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x26')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x27')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x28')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x29')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x2a')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x2b')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x2c')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x2d')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x2e')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x2f')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x30')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x31')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x32')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require('../api/squareReport/squareReport.rpc'));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x33')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require('../api/setting/setting.rpc'));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require('../api/squareOdbc/squareOdbc.rpc'));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x34')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x35')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require('../api/squareMessage/squareMessage.rpc'));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x36')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x37')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x38')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x39')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x3a')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x3b')));_0x48c328=_[_0x38d0('0x4')](_0x48c328,require(_0x38d0('0x3c')));_0x48c328=_['merge'](_0x48c328,require(_0x38d0('0x3d')));var _0x4f0f70=jayson[_0x38d0('0x3e')](_0x48c328)[_0x38d0('0x3f')]();var _0x30c670=config[_0x38d0('0x40')][_0x38d0('0x41')]||config[_0x38d0('0x41')]+0x1;var _0x2d504d=config[_0x38d0('0x40')]['ip']||_0x38d0('0x42');_0x4f0f70['on'](_0x38d0('0x43'),function(_0x3d0673){return _0x228115(_0x3d0673);});_0x4f0f70['listen'](_0x30c670,_0x2d504d,function(){console[_0x38d0('0x44')](_0x38d0('0x45'),_0x2d504d,_0x30c670);require(_0x38d0('0x46'))[_0x38d0('0x47')]();return _0x1ee8ea('RPC\x20listening\x20on\x20'+_0x2d504d+':'+_0x30c670);});});}; \ No newline at end of file +var _0x339f=['../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.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/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.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','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','jayson/promise','bluebird','lodash','../config/environment','listen','../api/voiceExtension/voiceExtension.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc'];(function(_0x21d36e,_0x5dc096){var _0x4cc307=function(_0x4ae995){while(--_0x4ae995){_0x21d36e['push'](_0x21d36e['shift']());}};_0x4cc307(++_0x5dc096);}(_0x339f,0x1c6));var _0xf339=function(_0x484595,_0x5b42b1){_0x484595=_0x484595-0x0;var _0x58191d=_0x339f[_0x484595];return _0x58191d;};'use strict';var jayson=require(_0xf339('0x0'));var BPromise=require(_0xf339('0x1'));var _=require(_0xf339('0x2'));var config=require(_0xf339('0x3'));exports[_0xf339('0x4')]=function(){return new BPromise(function(_0x45064a,_0x479482){var _0x528857={};_0x528857=_['merge'](_0x528857,require('../api/user/user.rpc'));_0x528857=_['merge'](_0x528857,require(_0xf339('0x5')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x7')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x8')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x9')));_0x528857=_[_0xf339('0x6')](_0x528857,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0xa')));_0x528857=_['merge'](_0x528857,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x528857=_['merge'](_0x528857,require(_0xf339('0xb')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0xc')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0xd')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0xe')));_0x528857=_['merge'](_0x528857,require(_0xf339('0xf')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x10')));_0x528857=_['merge'](_0x528857,require(_0xf339('0x11')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x12')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x13')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x14')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x15')));_0x528857=_['merge'](_0x528857,require('../api/faxAccount/faxAccount.rpc'));_0x528857=_['merge'](_0x528857,require('../api/faxApplication/faxApplication.rpc'));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x16')));_0x528857=_[_0xf339('0x6')](_0x528857,require('../api/faxMessage/faxMessage.rpc'));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x17')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x18')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x19')));_0x528857=_['merge'](_0x528857,require(_0xf339('0x1a')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x1b')));_0x528857=_['merge'](_0x528857,require(_0xf339('0x1c')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x1d')));_0x528857=_[_0xf339('0x6')](_0x528857,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x1e')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x1f')));_0x528857=_[_0xf339('0x6')](_0x528857,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x20')));_0x528857=_['merge'](_0x528857,require(_0xf339('0x21')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x22')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x23')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x24')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x25')));_0x528857=_[_0xf339('0x6')](_0x528857,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x26')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x27')));_0x528857=_['merge'](_0x528857,require(_0xf339('0x28')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x29')));_0x528857=_['merge'](_0x528857,require('../api/sound/sound.rpc'));_0x528857=_['merge'](_0x528857,require('../api/template/template.rpc'));_0x528857=_['merge'](_0x528857,require(_0xf339('0x2a')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x2b')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x2c')));_0x528857=_['merge'](_0x528857,require(_0xf339('0x2d')));_0x528857=_[_0xf339('0x6')](_0x528857,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x528857=_['merge'](_0x528857,require(_0xf339('0x2e')));_0x528857=_[_0xf339('0x6')](_0x528857,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x2f')));_0x528857=_['merge'](_0x528857,require(_0xf339('0x30')));_0x528857=_['merge'](_0x528857,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x528857=_[_0xf339('0x6')](_0x528857,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x31')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x32')));_0x528857=_[_0xf339('0x6')](_0x528857,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x528857=_['merge'](_0x528857,require('../api/squareReport/squareReport.rpc'));_0x528857=_['merge'](_0x528857,require(_0xf339('0x33')));_0x528857=_[_0xf339('0x6')](_0x528857,require('../api/setting/setting.rpc'));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x34')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x35')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x36')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x37')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x38')));_0x528857=_[_0xf339('0x6')](_0x528857,require('../api/attachment/attachment.rpc'));_0x528857=_['merge'](_0x528857,require(_0xf339('0x39')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x3a')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x3b')));_0x528857=_[_0xf339('0x6')](_0x528857,require(_0xf339('0x3c')));_0x528857=_[_0xf339('0x6')](_0x528857,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x528857=_[_0xf339('0x6')](_0x528857,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x6e9bb=jayson[_0xf339('0x3d')](_0x528857)['http']();var _0x1a557a=config[_0xf339('0x3e')][_0xf339('0x3f')]||config[_0xf339('0x3f')]+0x1;var _0x5e9e87=config[_0xf339('0x3e')]['ip']||_0xf339('0x40');_0x6e9bb['on'](_0xf339('0x41'),function(_0x3736b9){return _0x479482(_0x3736b9);});_0x6e9bb[_0xf339('0x4')](_0x1a557a,_0x5e9e87,function(){console[_0xf339('0x42')](_0xf339('0x43'),_0x5e9e87,_0x1a557a);require('../config/triggers')[_0xf339('0x44')]();return _0x45064a('RPC\x20listening\x20on\x20'+_0x5e9e87+':'+_0x1a557a);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 525a031..211dbf0 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 _0x5f71=['result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','prototype','sendRequest','sync','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','noop','getVariable','recordFile','wav','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','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','./reply','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code'];(function(_0xcf807,_0x4c736b){var _0x2ef9e9=function(_0x33ed42){while(--_0x33ed42){_0xcf807['push'](_0xcf807['shift']());}};_0x2ef9e9(++_0x4c736b);}(_0x5f71,0xc9));var _0x15f7=function(_0x2b8345,_0x36e06e){_0x2b8345=_0x2b8345-0x0;var _0x37c707=_0x5f71[_0x2b8345];return _0x37c707;};'use strict';var util=require(_0x15f7('0x0'));var _=require('lodash');var EventEmitter=require(_0x15f7('0x1'))['EventEmitter'];var AGIReply=require(_0x15f7('0x2'));var AGIError=require('./error');function AGIChannel(_0x575fdb){var _0x510b60=this,_0x3a9fe1=new AGIReply(),_0x3fa535=![],_0x5593f3={};EventEmitter[_0x15f7('0x3')](_0x510b60);_0x575fdb[_0x15f7('0x4')](_0x15f7('0x5'));_0x575fdb[_0x15f7('0x6')](0x8*0x3c*0x3c*0x3e8);_0x3a9fe1[_0x15f7('0x4')](_0x15f7('0x5'));_0x3a9fe1['on'](_0x15f7('0x7'),function(_0x3f1490){for(var _0x3742c2 in _0x3f1490){_0x510b60[_0x3742c2]=_0x3f1490[_0x3742c2];}_0x510b60[_0x15f7('0x8')](_0x15f7('0x9'));});_0x3a9fe1['on'](_0x15f7('0xa'),function(_0x4b53ab){if(_0x4b53ab['toLowerCase']()==_0x15f7('0xb')){_0x510b60[_0x15f7('0x8')]('hangup');return;}if(_0x4b53ab[_0x15f7('0xc')](0x0,0xb)==_0x15f7('0xd')){_0x3fa535=!![];}if(_0x3fa535){_0x5593f3['rx']+=_0x4b53ab+'\x0a';if(_0x4b53ab[_0x15f7('0xe')](_0x15f7('0xf'))!=-0x1){_0x3fa535=![];}}else{_0x5593f3['rx']=_0x4b53ab;}if(_0x3fa535){return;}if(typeof _0x5593f3['cb']==_0x15f7('0x10')){var _0x13d8f=_0x5593f3['rx'][_0x15f7('0xc')](0x0,0x3),_0x319ce8=null,_0x49a74c=null;_0x13d8f=parseInt(_0x13d8f);if(isNaN(_0x13d8f)){_0x5593f3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x15f7('0x11')});return;}if(_0x13d8f!=0xc8){_0x5593f3['cb'](null,{'code':_0x13d8f,'result':-0x1,'extra':'KO'});return;}_0x319ce8=_0x5593f3['rx'][_0x15f7('0xc')](0x4)['replace'](_0x15f7('0x12'),'');if(_0x319ce8[_0x15f7('0x13')]('\x20')!=-0x1){_0x319ce8=_0x319ce8['substr'](0x0,_0x319ce8[_0x15f7('0x13')]('\x20'));}if(_[_0x15f7('0x14')](_0x319ce8,'-1')){_0x319ce8=parseInt(_0x319ce8);}_0x49a74c=_0x5593f3['rx'][_0x15f7('0x15')]('\x20');if(_0x49a74c[_0x15f7('0x16')]==0x3){_0x49a74c=_0x49a74c[0x2][_0x15f7('0xc')](0x1,_0x49a74c[0x2][_0x15f7('0x16')]-0x1);}else if(_0x49a74c[_0x15f7('0x16')]>0x3){var _0x4b0d42=/\((.+)\)/;var _0x38984b=_0x5593f3['rx'][_0x15f7('0x17')](_0x4b0d42);if(_0x38984b){_0x49a74c=_0x38984b[0x1];}else{_0x49a74c=null;}}else{_0x49a74c=null;}_0x5593f3['cb'](null,{'code':_0x13d8f,'result':_0x319ce8,'extra':_0x49a74c});}});_0x575fdb['on']('error',function(_0x2c78ca){_0x510b60[_0x15f7('0x8')](_0x15f7('0x18'),new AGIError(_0x15f7('0x19'),_0x2c78ca[_0x15f7('0x1a')]));});_0x575fdb['on'](_0x15f7('0x1b'),function(){_0x510b60[_0x15f7('0x8')]('close',new AGIError(_0x15f7('0x1c')));});_0x575fdb['on'](_0x15f7('0x1d'),function(){_0x510b60[_0x15f7('0x8')](_0x15f7('0x1d'),new AGIError(_0x15f7('0x1e')));_0x575fdb[_0x15f7('0x1f')]();});_0x575fdb[_0x15f7('0x20')](_0x3a9fe1);this['command']=function(_0x4de467,_0xa8c65a){var _0x4de467=_0x4de467||'',_0xa8c65a=typeof _0xa8c65a==_0x15f7('0x10')?_0xa8c65a:new Function();_0x5593f3={'tx':_0x4de467,'rx':'','cb':_0xa8c65a};_0x575fdb[_0x15f7('0x21')](_0x4de467+'\x0a');},this['close']=function(){_0x575fdb[_0x15f7('0x1f')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x15f7('0x22')][_0x15f7('0x23')]=function(_0x49fc13){return this['command'][_0x15f7('0x24')](this,_0x49fc13);};AGIChannel['prototype']['answer']=function(){return this[_0x15f7('0x23')]('ANSWER');};AGIChannel[_0x15f7('0x22')][_0x15f7('0x25')]=function(_0x64f9d9,_0x5bc7d1,_0x2d4d2d){_0x64f9d9=_0x64f9d9===undefined?'beep':_0x64f9d9;_0x5bc7d1=_0x5bc7d1===undefined?'5':_0x5bc7d1;_0x2d4d2d=_0x2d4d2d===undefined?'1':_0x2d4d2d;return this[_0x15f7('0x23')](util[_0x15f7('0x26')](_0x15f7('0x27'),_0x64f9d9,_0x5bc7d1*0x3e8,_0x2d4d2d));};AGIChannel['prototype']['noop']=function(_0x5962e6){_0x5962e6=_0x5962e6||'NO\x20MESSAGE';return this[_0x15f7('0x23')](util[_0x15f7('0x26')](_0x15f7('0x28'),_0x5962e6));};AGIChannel[_0x15f7('0x22')][_0x15f7('0x29')]=function(_0x477950,_0x5394b6){if(_['isArray'](_0x5394b6)){return this[_0x15f7('0x23')](util[_0x15f7('0x26')](_0x15f7('0x2a'),_0x477950,_0x5394b6['join'](',')));}return this[_0x15f7('0x23')](util['format'](_0x15f7('0x2a'),_0x477950,_0x5394b6));};AGIChannel['prototype'][_0x15f7('0x2b')]=function(_0x4417bc){return this[_0x15f7('0x23')](util[_0x15f7('0x26')]('SET\x20CONTEXT\x20%s',_0x4417bc));};AGIChannel['prototype'][_0x15f7('0x2c')]=function(_0x346082){return this[_0x15f7('0x23')](util[_0x15f7('0x26')](_0x15f7('0x2d'),_0x346082));};AGIChannel[_0x15f7('0x22')][_0x15f7('0x2e')]=function(_0xb1cb0e){return this[_0x15f7('0x23')](util[_0x15f7('0x26')](_0x15f7('0x2f'),_0xb1cb0e));};AGIChannel['prototype'][_0x15f7('0xb')]=function(){return this['sendRequest'](_0x15f7('0x30'));};AGIChannel[_0x15f7('0x22')][_0x15f7('0x31')]=function(_0x1ebb69,_0x2b2525){var _0x12d217=_['isBoolean'](_0x2b2525)||_[_0x15f7('0x32')](_0x2b2525)?_0x2b2525['toString']():_0x2b2525;return this[_0x15f7('0x23')](util[_0x15f7('0x26')](_0x15f7('0x33'),_0x1ebb69,_0x12d217?_0x12d217[_0x15f7('0x34')]()[_0x15f7('0x35')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x15f7('0x36')]=function(_0x4fd128,_0x4ee777){return this[_0x15f7('0x23')](util['format'](_0x15f7('0x37'),_0x4fd128,_0x4ee777));};AGIChannel[_0x15f7('0x22')][_0x15f7('0x38')]=function(_0x69d8dd,_0x408ca6){return this[_0x15f7('0x23')](util[_0x15f7('0x26')]('SAY\x20DIGITS\x20%s\x20%s',_0x69d8dd,_0x408ca6));};AGIChannel[_0x15f7('0x22')]['sayPhonetic']=function(_0x251856,_0x4d409f){return this['sendRequest'](util['format'](_0x15f7('0x39'),_0x251856,_0x4d409f));};AGIChannel[_0x15f7('0x22')][_0x15f7('0x3a')]=function(_0x712774,_0x332e81,_0xc4f0bd){_0x332e81=_0x332e81||this[_0x15f7('0x3b')];_0xc4f0bd=_0xc4f0bd||0x1;this[_0x15f7('0x2b')](_0x712774);this[_0x15f7('0x2c')](_0x332e81);this[_0x15f7('0x2e')](_0xc4f0bd);return this[_0x15f7('0x3c')](util[_0x15f7('0x26')]('GOTO\x20%s\x20%s\x20%s',_0x712774,_0x332e81,_0xc4f0bd));};AGIChannel[_0x15f7('0x22')][_0x15f7('0x3d')]=function(_0x5e752d){return this[_0x15f7('0x23')](util[_0x15f7('0x26')]('GET\x20VARIABLE\x20\x22%s\x22',_0x5e752d));};AGIChannel[_0x15f7('0x22')][_0x15f7('0x3e')]=function(_0x1d9b1f,_0x515814,_0x3fa2ea,_0x3a49e3,_0x2d4fdc,_0x565e54){_0x515814=_0x515814||_0x15f7('0x3f');_0x3fa2ea=_0x3fa2ea||'';_0x3a49e3=_0x3a49e3===undefined?-0x1:_0x3a49e3==='-1'?-0x1:_0x3a49e3*0x3e8;_0x2d4fdc=_0x2d4fdc===undefined?'':'s='+_0x2d4fdc;_0x565e54=_0x565e54?'BEEP':'';return this[_0x15f7('0x23')](util[_0x15f7('0x26')](_0x15f7('0x40'),_0x1d9b1f,_0x515814,_0x3fa2ea,_0x3a49e3,_0x565e54,_0x2d4fdc));};AGIChannel[_0x15f7('0x22')][_0x15f7('0x41')]=function(_0x22172f,_0x1bac4e){_0x1bac4e=_0x1bac4e||'';return this[_0x15f7('0x23')](util[_0x15f7('0x26')](_0x15f7('0x42'),_0x22172f,_0x1bac4e));};AGIChannel[_0x15f7('0x22')][_0x15f7('0x43')]=function(_0x561f31){return this[_0x15f7('0x29')]('AGI',_0x561f31);};AGIChannel[_0x15f7('0x22')][_0x15f7('0x44')]=function(_0x5bf39d){return this['exec'](_0x15f7('0x45'),_0x5bf39d);};AGIChannel[_0x15f7('0x22')][_0x15f7('0x18')]=function(_0x59a7eb,_0x204c87){this[_0x15f7('0x3c')](util[_0x15f7('0x26')](_0x15f7('0x46'),_0x59a7eb['id'],_0x59a7eb[_0x15f7('0x47')],_0x204c87));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x15f7('0x48')]=AGIChannel; \ No newline at end of file +var _0xc26e=['exec','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','events','./reply','./error','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','520-Invalid','520\x20End\x20of\x20proper','substring','no\x20code','replace','result=','indexOf','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','function','write','prototype','sendRequest','command','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','VERBOSE\x20\x22%s\x22'];(function(_0x50d340,_0x2cd66d){var _0x2ee49b=function(_0xf012d6){while(--_0xf012d6){_0x50d340['push'](_0x50d340['shift']());}};_0x2ee49b(++_0x2cd66d);}(_0xc26e,0x103));var _0xec26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc26e[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0xec26('0x0'))['EventEmitter'];var AGIReply=require(_0xec26('0x1'));var AGIError=require(_0xec26('0x2'));function AGIChannel(_0x113877){var _0x3ce85a=this,_0x5dc2a3=new AGIReply(),_0x248647=![],_0x53590d={};EventEmitter['call'](_0x3ce85a);_0x113877[_0xec26('0x3')](_0xec26('0x4'));_0x113877[_0xec26('0x5')](0x8*0x3c*0x3c*0x3e8);_0x5dc2a3['setEncoding']('utf8');_0x5dc2a3['on'](_0xec26('0x6'),function(_0x40e0f6){for(var _0x380f62 in _0x40e0f6){_0x3ce85a[_0x380f62]=_0x40e0f6[_0x380f62];}_0x3ce85a[_0xec26('0x7')](_0xec26('0x8'));});_0x5dc2a3['on'](_0xec26('0x9'),function(_0xf11228){if(_0xf11228[_0xec26('0xa')]()==_0xec26('0xb')){_0x3ce85a[_0xec26('0x7')]('hangup');return;}if(_0xf11228['substring'](0x0,0xb)==_0xec26('0xc')){_0x248647=!![];}if(_0x248647){_0x53590d['rx']+=_0xf11228+'\x0a';if(_0xf11228['search'](_0xec26('0xd'))!=-0x1){_0x248647=![];}}else{_0x53590d['rx']=_0xf11228;}if(_0x248647){return;}if(typeof _0x53590d['cb']=='function'){var _0x59ad16=_0x53590d['rx'][_0xec26('0xe')](0x0,0x3),_0x545660=null,_0x43db74=null;_0x59ad16=parseInt(_0x59ad16);if(isNaN(_0x59ad16)){_0x53590d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xec26('0xf')});return;}if(_0x59ad16!=0xc8){_0x53590d['cb'](null,{'code':_0x59ad16,'result':-0x1,'extra':'KO'});return;}_0x545660=_0x53590d['rx'][_0xec26('0xe')](0x4)[_0xec26('0x10')](_0xec26('0x11'),'');if(_0x545660[_0xec26('0x12')]('\x20')!=-0x1){_0x545660=_0x545660['substr'](0x0,_0x545660[_0xec26('0x12')]('\x20'));}if(_['startsWith'](_0x545660,'-1')){_0x545660=parseInt(_0x545660);}_0x43db74=_0x53590d['rx'][_0xec26('0x13')]('\x20');if(_0x43db74[_0xec26('0x14')]==0x3){_0x43db74=_0x43db74[0x2][_0xec26('0xe')](0x1,_0x43db74[0x2][_0xec26('0x14')]-0x1);}else if(_0x43db74[_0xec26('0x14')]>0x3){var _0x4b1c89=/\((.+)\)/;var _0x420070=_0x53590d['rx'][_0xec26('0x15')](_0x4b1c89);if(_0x420070){_0x43db74=_0x420070[0x1];}else{_0x43db74=null;}}else{_0x43db74=null;}_0x53590d['cb'](null,{'code':_0x59ad16,'result':_0x545660,'extra':_0x43db74});}});_0x113877['on']('error',function(_0x1c5fcc){_0x3ce85a[_0xec26('0x7')](_0xec26('0x16'),new AGIError(_0xec26('0x17'),_0x1c5fcc[_0xec26('0x18')]));});_0x113877['on'](_0xec26('0x19'),function(){_0x3ce85a[_0xec26('0x7')]('close',new AGIError(_0xec26('0x1a')));});_0x113877['on'](_0xec26('0x1b'),function(){_0x3ce85a[_0xec26('0x7')](_0xec26('0x1b'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x113877[_0xec26('0x1c')]();});_0x113877[_0xec26('0x1d')](_0x5dc2a3);this['command']=function(_0x2c5994,_0x5bd11e){var _0x2c5994=_0x2c5994||'',_0x5bd11e=typeof _0x5bd11e==_0xec26('0x1e')?_0x5bd11e:new Function();_0x53590d={'tx':_0x2c5994,'rx':'','cb':_0x5bd11e};_0x113877[_0xec26('0x1f')](_0x2c5994+'\x0a');},this[_0xec26('0x19')]=function(){_0x113877['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xec26('0x20')][_0xec26('0x21')]=function(_0x388e19){return this[_0xec26('0x22')][_0xec26('0x23')](this,_0x388e19);};AGIChannel[_0xec26('0x20')]['answer']=function(){return this['sendRequest'](_0xec26('0x24'));};AGIChannel[_0xec26('0x20')][_0xec26('0x25')]=function(_0x5dd9bd,_0x9f2fac,_0x32ce36){_0x5dd9bd=_0x5dd9bd===undefined?'beep':_0x5dd9bd;_0x9f2fac=_0x9f2fac===undefined?'5':_0x9f2fac;_0x32ce36=_0x32ce36===undefined?'1':_0x32ce36;return this[_0xec26('0x21')](util[_0xec26('0x26')](_0xec26('0x27'),_0x5dd9bd,_0x9f2fac*0x3e8,_0x32ce36));};AGIChannel[_0xec26('0x20')]['noop']=function(_0x4d73f6){_0x4d73f6=_0x4d73f6||'NO\x20MESSAGE';return this['sendRequest'](util[_0xec26('0x26')](_0xec26('0x28'),_0x4d73f6));};AGIChannel[_0xec26('0x20')][_0xec26('0x29')]=function(_0x35b048,_0xbe56c9){if(_['isArray'](_0xbe56c9)){return this[_0xec26('0x21')](util[_0xec26('0x26')](_0xec26('0x2a'),_0x35b048,_0xbe56c9['join'](',')));}return this[_0xec26('0x21')](util['format'](_0xec26('0x2a'),_0x35b048,_0xbe56c9));};AGIChannel['prototype'][_0xec26('0x2b')]=function(_0x280e3a){return this['sendRequest'](util[_0xec26('0x26')](_0xec26('0x2c'),_0x280e3a));};AGIChannel[_0xec26('0x20')]['setExtension']=function(_0x278a87){return this[_0xec26('0x21')](util[_0xec26('0x26')]('SET\x20EXTENSION\x20%s',_0x278a87));};AGIChannel[_0xec26('0x20')][_0xec26('0x2d')]=function(_0xe40927){return this[_0xec26('0x21')](util[_0xec26('0x26')](_0xec26('0x2e'),_0xe40927));};AGIChannel['prototype']['hangup']=function(){return this['sendRequest'](_0xec26('0x2f'));};AGIChannel[_0xec26('0x20')][_0xec26('0x30')]=function(_0x2dc890,_0x16f8ea){var _0x596341=_[_0xec26('0x31')](_0x16f8ea)||_[_0xec26('0x32')](_0x16f8ea)?_0x16f8ea['toString']():_0x16f8ea;return this[_0xec26('0x21')](util['format'](_0xec26('0x33'),_0x2dc890,_0x596341?_0x596341[_0xec26('0x34')]()[_0xec26('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xec26('0x20')][_0xec26('0x35')]=function(_0x5f4157,_0x13b11d){return this[_0xec26('0x21')](util[_0xec26('0x26')](_0xec26('0x36'),_0x5f4157,_0x13b11d));};AGIChannel[_0xec26('0x20')][_0xec26('0x37')]=function(_0x1cb715,_0x5828b8){return this[_0xec26('0x21')](util[_0xec26('0x26')](_0xec26('0x38'),_0x1cb715,_0x5828b8));};AGIChannel['prototype']['sayPhonetic']=function(_0x1a9a4c,_0x2a0d62){return this[_0xec26('0x21')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x1a9a4c,_0x2a0d62));};AGIChannel[_0xec26('0x20')][_0xec26('0x39')]=function(_0x4c6011,_0x59d558,_0x42cb40){_0x59d558=_0x59d558||this[_0xec26('0x3a')];_0x42cb40=_0x42cb40||0x1;this['setContext'](_0x4c6011);this['setExtension'](_0x59d558);this['setPriority'](_0x42cb40);return this[_0xec26('0x3b')](util[_0xec26('0x26')](_0xec26('0x3c'),_0x4c6011,_0x59d558,_0x42cb40));};AGIChannel[_0xec26('0x20')][_0xec26('0x3d')]=function(_0x2847df){return this[_0xec26('0x21')](util['format'](_0xec26('0x3e'),_0x2847df));};AGIChannel['prototype'][_0xec26('0x3f')]=function(_0xe84ec6,_0x8d2c85,_0x1da58d,_0x228e07,_0x263fda,_0x40896d){_0x8d2c85=_0x8d2c85||_0xec26('0x40');_0x1da58d=_0x1da58d||'';_0x228e07=_0x228e07===undefined?-0x1:_0x228e07==='-1'?-0x1:_0x228e07*0x3e8;_0x263fda=_0x263fda===undefined?'':'s='+_0x263fda;_0x40896d=_0x40896d?_0xec26('0x41'):'';return this['sendRequest'](util[_0xec26('0x26')](_0xec26('0x42'),_0xe84ec6,_0x8d2c85,_0x1da58d,_0x228e07,_0x40896d,_0x263fda));};AGIChannel[_0xec26('0x20')][_0xec26('0x43')]=function(_0x1fe768,_0x58671e){_0x58671e=_0x58671e||'';return this[_0xec26('0x21')](util['format'](_0xec26('0x44'),_0x1fe768,_0x58671e));};AGIChannel[_0xec26('0x20')][_0xec26('0x45')]=function(_0x5e2c23){return this['exec'](_0xec26('0x46'),_0x5e2c23);};AGIChannel['prototype'][_0xec26('0x47')]=function(_0x3818f8){return this['exec'](_0xec26('0x48'),_0x3818f8);};AGIChannel['prototype'][_0xec26('0x16')]=function(_0x15f6a0,_0x1b6130){this[_0xec26('0x3b')](util[_0xec26('0x26')](_0xec26('0x49'),_0x15f6a0['id'],_0x15f6a0[_0xec26('0x4a')],_0x1b6130));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 429a7a9..64a9ed1 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 _0x965e=['Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x965e,0x1a3));var _0xe965=function(_0x18369a,_0x4e8835){_0x18369a=_0x18369a-0x0;var _0xa6e2b8=_0x965e[_0x18369a];return _0xa6e2b8;};'use strict';var util=require(_0xe965('0x0'));var error={'E_AGI_UNDEFINED':_0xe965('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xe965('0x2'),'E_AGI_SERVER_CLOSE':_0xe965('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xe965('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xe965('0x5'),'E_AGI_SOCKET_ERROR':_0xe965('0x6'),'E_AGI_SOCKET_CLOSE':_0xe965('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xe965('0x8'),'E_AGI_COMMAND_EMPTY':_0xe965('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xe965('0xa'),'E_AGI_IVR_ENTRY':_0xe965('0xb')};function AGIError(_0x4c5d6a){var _0x4c5d6a=_0x4c5d6a||null,_0x33a294=_0x33a294||[],_0x3f3af0=0x1,_0x596d57='';if(!error[_0x4c5d6a]){_0x4c5d6a='E_AGI_UNDEFINED';}_0x33a294['push'](error[_0x4c5d6a]);while(arguments[_0x3f3af0]){_0x33a294[_0xe965('0xc')](arguments[_0x3f3af0]);_0x3f3af0++;}_0x596d57=util[_0xe965('0xd')][_0xe965('0xe')](util,_0x33a294);this[_0xe965('0xf')]=_0x596d57;this['name']=_0x4c5d6a;}module[_0xe965('0x10')]=AGIError; \ No newline at end of file +var _0xea91=['Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x49c5da,_0xe1c71f){var _0x197295=function(_0xc0cac2){while(--_0xc0cac2){_0x49c5da['push'](_0x49c5da['shift']());}};_0x197295(++_0xe1c71f);}(_0xea91,0x19d));var _0x1ea9=function(_0x3c5b20,_0x4b0336){_0x3c5b20=_0x3c5b20-0x0;var _0x217352=_0xea91[_0x3c5b20];return _0x217352;};'use strict';var util=require(_0x1ea9('0x0'));var error={'E_AGI_UNDEFINED':_0x1ea9('0x1'),'E_AGI_ARGUMENT_PORT':_0x1ea9('0x2'),'E_AGI_SERVER_ERROR':_0x1ea9('0x3'),'E_AGI_SERVER_CLOSE':_0x1ea9('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x1ea9('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x1ea9('0x6'),'E_AGI_COMMAND_EMPTY':_0x1ea9('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1ea9('0x8'),'E_AGI_IVR_ENTRY':_0x1ea9('0x9')};function AGIError(_0x61b133){var _0x61b133=_0x61b133||null,_0x3fcfdf=_0x3fcfdf||[],_0x20af48=0x1,_0x2e4c26='';if(!error[_0x61b133]){_0x61b133='E_AGI_UNDEFINED';}_0x3fcfdf[_0x1ea9('0xa')](error[_0x61b133]);while(arguments[_0x20af48]){_0x3fcfdf[_0x1ea9('0xa')](arguments[_0x20af48]);_0x20af48++;}_0x2e4c26=util[_0x1ea9('0xb')][_0x1ea9('0xc')](util,_0x3fcfdf);this[_0x1ea9('0xd')]=_0x2e4c26;this[_0x1ea9('0xe')]=_0x61b133;}module[_0x1ea9('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 29e87c6..a6a6315 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 _0x2310=['stop\x20traverse','length','condition','split','agicommand','vswitch','target','traverseBFS','default\x20on\x20switch\x20not\x20found','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','getdigits','getsecretdigits','edges','numberOfEdges','prototype','addVertex','vertices','addEdge','push','size','relations','getVertex','info','no\x20vertex\x20found'];(function(_0x49677a,_0x197e86){var _0x115408=function(_0xc88918){while(--_0xc88918){_0x49677a['push'](_0x49677a['shift']());}};_0x115408(++_0x197e86);}(_0x2310,0x123));var _0x0231=function(_0x59dc2c,_0x465b4c){_0x59dc2c=_0x59dc2c-0x0;var _0x40e68e=_0x2310[_0x59dc2c];return _0x40e68e;};'use strict';var _=require(_0x0231('0x0'));var logger=require(_0x0231('0x1'))(_0x0231('0x2'));var verticesWithRetry=['menu',_0x0231('0x3'),_0x0231('0x4')];var Graph=function(){this['vertices']={};this[_0x0231('0x5')]={};this[_0x0231('0x6')]=0x0;};Graph[_0x0231('0x7')][_0x0231('0x8')]=function(_0x958d38){this[_0x0231('0x9')][_0x958d38['id']]=_0x958d38;this[_0x0231('0x5')][_0x958d38['id']]=[];};Graph['prototype'][_0x0231('0xa')]=function(_0x4a5fd4,_0x25fe60,_0x1ce0d9){this['edges'][_0x4a5fd4][_0x0231('0xb')]({'target':_0x25fe60,'condition':_0x1ce0d9});this[_0x0231('0x6')]+=0x1;};Graph[_0x0231('0x7')][_0x0231('0xc')]=function(){return _[_0x0231('0xc')](this[_0x0231('0x9')]);};Graph[_0x0231('0x7')][_0x0231('0xd')]=function(){return this[_0x0231('0x6')];};Graph[_0x0231('0x7')][_0x0231('0xe')]=function(_0x1daec5){return this['vertices'][_0x1daec5];};Graph[_0x0231('0x7')]['traverseBFS']=function(_0x58f5e4,_0x4b6ef5){if(!this['vertices'][_0x58f5e4]){return logger[_0x0231('0xf')](_0x0231('0x10'));}var _0x358685=_0x4b6ef5(this[_0x0231('0x9')][_0x58f5e4]);if(!_0x358685){return logger[_0x0231('0xf')](_0x0231('0x11'));}if(this[_0x0231('0x5')][_0x58f5e4][_0x0231('0x12')]===0x0){return logger[_0x0231('0xf')]('no\x20edge/s\x20available');}for(var _0x15c442=0x0,_0x497b8a=[],_0x177943=![];_0x15c442\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','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','xml2json','lodash','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','127.0.0.1','nextTick','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','error','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','evtHangup','toJson','agicommand','retry','maxRetry','addVertex','omit','mxCell','length','target','source','getSquareProject','then','catch','createSquareReport','hasOwnProperty','indexOf','substring','inspect','debug','variables','stringify','timeout','hangup','sync','production','start','root','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS'];(function(_0x4b48ad,_0x3b2471){var _0x11e306=function(_0x3fd5f4){while(--_0x3fd5f4){_0x4b48ad['push'](_0x4b48ad['shift']());}};_0x11e306(++_0x3b2471);}(_0x3463,0x11a));var _0x3346=function(_0xffdd08,_0x5cfdbc){_0xffdd08=_0xffdd08-0x0;var _0x2cb77f=_0x3463[_0xffdd08];return _0x2cb77f;};'use strict';var parser=require(_0x3346('0x0'));var _=require(_0x3346('0x1'));var syncho=require('syncho');var util=require(_0x3346('0x2'));var moment=require('moment');var config=require(_0x3346('0x3'));var logger=require(_0x3346('0x4'))(_0x3346('0x5'));var utilLicense=require(_0x3346('0x6'));var rpc=require(_0x3346('0x7'));var mailRpc=require(_0x3346('0x8'));var Graph=require(_0x3346('0x9'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x3346('0x5')]=_['defaults'](config[_0x3346('0x5')],{'ip':_0x3346('0xa'),'port':0x11dd});function connectionHandler(_0x4d7021){process[_0x3346('0xb')](function(){syncho(function(){try{setChannelVariables(_0x4d7021);agiHandler(_0x4d7021);}catch(_0x430442){logger['error'](_0x430442[_0x3346('0xc')]);}});});}function listeningHandler(){console[_0x3346('0xd')](_0x3346('0xe'),config['agi']['port']);logger[_0x3346('0xf')](util[_0x3346('0x10')](_0x3346('0x11'),config[_0x3346('0x5')]['ip'],config[_0x3346('0x5')][_0x3346('0x12')]));}function errorHandler(_0x22c377){if(_0x22c377&&_0x22c377[_0x3346('0x13')]&&_0x22c377[_0x3346('0x14')]){logger[_0x3346('0x15')](util[_0x3346('0x10')]('[%s]\x20%s',_0x22c377[_0x3346('0x13')],_0x22c377[_0x3346('0x14')]));}else{logger[_0x3346('0x15')](util['format']('[ERROR]\x20%s',_0x22c377[_0x3346('0xc')]));}}function closeHandler(){logger[_0x3346('0xf')](util[_0x3346('0x10')](_0x3346('0x16'),this[_0x3346('0x17')],this['calleridname'],this[_0x3346('0x18')],this[_0x3346('0x19')],this[_0x3346('0x1a')]));try{createSquareReport(this);}catch(_0x42fca0){logger['error'](_0x42fca0[_0x3346('0xc')]);}}function timeoutHandler(){logger[_0x3346('0xf')](util[_0x3346('0x10')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x3346('0x17')],this['calleridname'],this[_0x3346('0x18')],this[_0x3346('0x19')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x3346('0x10')](_0x3346('0x1b'),this[_0x3346('0x17')],this[_0x3346('0x1c')],this[_0x3346('0x18')],this[_0x3346('0x19')],this[_0x3346('0x1a')]));this[_0x3346('0x1d')]=!![];}function getRoot(_0x19f627){return parser[_0x3346('0x1e')](_0x19f627,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x8d548b,_0x2b68c6,_0x381b14){_0x2b68c6[_0x3346('0x1f')]=_0x381b14;if(_0x2b68c6['hasOwnProperty'](_0x3346('0x20'))){_0x2b68c6[_0x3346('0x21')]=parseInt(_0x2b68c6[_0x3346('0x20')],0xa);}_0x8d548b[_0x3346('0x22')](_[_0x3346('0x23')](_0x2b68c6,_0x3346('0x24')));}function initGraph(_0x2e4788,_0x25f52c){var _0x52e28f=new Graph();for(var _0x514a38 in _0x2e4788){if(_0x2e4788['hasOwnProperty'](_0x514a38)){if(_['isArray'](_0x2e4788[_0x514a38])){for(var _0x5924e7=0x0;_0x5924e7<_0x2e4788[_0x514a38][_0x3346('0x25')];_0x5924e7+=0x1){addVertex(_0x52e28f,_0x2e4788[_0x514a38][_0x5924e7],_0x514a38);}}else{addVertex(_0x52e28f,_0x2e4788[_0x514a38],_0x514a38);}}}for(var _0x1dcdbc=0x0;_0x1dcdbc<_0x25f52c[_0x3346('0x25')];_0x1dcdbc+=0x1){if(_0x25f52c[_0x1dcdbc]['source']&&_0x25f52c[_0x1dcdbc][_0x3346('0x26')]){_0x52e28f['addEdge'](_0x25f52c[_0x1dcdbc][_0x3346('0x27')],_0x25f52c[_0x1dcdbc][_0x3346('0x26')],_0x25f52c[_0x1dcdbc]['value']);}}return _0x52e28f;}function getSquareProject(_0xbffe16,_0x3e50f8){rpc[_0x3346('0x28')](_0xbffe16)[_0x3346('0x29')](function(_0x2f6d88){_0x3e50f8(null,_0x2f6d88);})[_0x3346('0x2a')](function(_0x225c28){_0x3e50f8(null,_0x225c28);});}function createSquareReport(_0x581828,_0x3cadb6){rpc[_0x3346('0x2b')](_0x581828)['then'](function(_0x3c3cd9){if(_0x3cadb6){_0x3cadb6(null,_0x3c3cd9);}})[_0x3346('0x2a')](function(_0x5dca09){if(_0x3cadb6){_0x3cadb6(null,_0x5dca09);}});}function setChannelVariables(_0x5b4b22){for(var _0x539862 in _0x5b4b22){if(_0x5b4b22[_0x3346('0x2c')](_0x539862)){if(_0x539862[_0x3346('0x2d')]('agi_')===0x0){_0x5b4b22[_0x539862[_0x3346('0x2e')](0x4)]=_0x5b4b22[_0x539862];delete _0x5b4b22[_0x539862];}}}}function getLogFromObject(_0x407164){return util[_0x3346('0x2f')](_0x407164,{'showHidden':![],'depth':null});}function agiHandler(_0x2cba53){var _0x5efd60,_0x4e824,_0x243c27,_0x42981c,_0x3d9725;logger[_0x3346('0x30')](_0x3346('0x31'),JSON[_0x3346('0x32')](_0x2cba53,null,0x2));logger[_0x3346('0xf')](util[_0x3346('0x10')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2cba53['arg_1'],_0x2cba53[_0x3346('0x1c')],_0x2cba53['callerid'],_0x2cba53[_0x3346('0x19')],_0x2cba53[_0x3346('0x1a')]));_0x2cba53['on'](_0x3346('0x15'),errorHandler);_0x2cba53['on']('close',closeHandler);_0x2cba53['on'](_0x3346('0x33'),timeoutHandler);_0x2cba53[_0x3346('0x1d')]=![];_0x2cba53['on'](_0x3346('0x34'),hangupHandler);var _0x41654e=getSquareProject[_0x3346('0x35')](null,_0x2cba53[_0x3346('0x17')]);if(_0x41654e){if(_0x41654e[_0x3346('0x36')]){_0x5efd60=getRoot(_0x41654e[_0x3346('0x36')]);if(_0x5efd60&&_0x5efd60[_0x3346('0x37')]){logger[_0x3346('0x30')](_0x3346('0x38'),JSON[_0x3346('0x32')](_0x5efd60,null,0x2));_0x2cba53['joinAt']=moment()[_0x3346('0x10')](_0x3346('0x39'));_0x4e824=initGraph(_[_0x3346('0x23')](_0x5efd60,_0x3346('0x24')),_0x5efd60[_0x3346('0x24')]);_0x243c27=new Vertices(_0x2cba53,rpc,mailRpc);logger[_0x3346('0xf')](util['format'](_0x3346('0x3a'),_0x2cba53[_0x3346('0x17')],_0x2cba53['calleridname'],_0x2cba53[_0x3346('0x18')],_0x2cba53[_0x3346('0x19')],_0x2cba53['uniqueid']));_0x4e824['traverseBFS'](_0x5efd60[_0x3346('0x37')]['id'],function(_0x1f1ee4){try{_0x1f1ee4=_0x243c27['clear'](_0x1f1ee4);logger['debug'](_0x3346('0x3b'),JSON['stringify'](_0x1f1ee4,null,0x2));if(_0x1f1ee4[_0x3346('0x1f')]===_0x3346('0x3c')){logger[_0x3346('0xf')](_0x3346('0x3d'));_0x2cba53[_0x3346('0x3e')]=_0x1f1ee4[_0x3346('0x3e')]||_0x2cba53['context'];_0x2cba53[_0x3346('0x3f')]=_0x1f1ee4[_0x3346('0x3f')];_0x2cba53['priority']=_0x1f1ee4[_0x3346('0x40')]?_0x1f1ee4[_0x3346('0x40')]-0x1:0x1;return null;}else if(_0x1f1ee4&&_0x243c27[_0x1f1ee4[_0x3346('0x1f')]]){_0x3d9725=_0x243c27[_0x1f1ee4[_0x3346('0x1f')]](_0x1f1ee4);logger['info'](_0x3346('0x41'),JSON[_0x3346('0x32')](_0x3d9725,null,0x2));if(_0x3d9725&&_0x3d9725['code']===AGI_CODE_SUCCESS&&_0x3d9725[_0x3346('0x42')]!==AGI_RESULT_ERROR&&!_0x2cba53[_0x3346('0x1d')]){logger['debug'](_0x3346('0x41'),getLogFromObject(_0x3d9725));return _[_0x3346('0x43')](_0x3d9725[_0x3346('0x42')])?null:_0x3d9725[_0x3346('0x42')]['toString']();}else{logger[_0x3346('0x15')](_0x3346('0x41'),getLogFromObject(_0x3d9725));return null;}}else{logger[_0x3346('0x15')]('agicommand\x20not\x20found');return null;}}catch(_0x49ed83){logger[_0x3346('0x15')](_0x49ed83[_0x3346('0xc')]);return null;}});if(_0x5efd60['finally']){logger[_0x3346('0xf')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2cba53[_0x3346('0x17')],_0x2cba53[_0x3346('0x1c')],_0x2cba53['callerid'],_0x2cba53[_0x3346('0x19')],_0x2cba53[_0x3346('0x1a')]));_0x4e824[_0x3346('0x44')](_0x5efd60[_0x3346('0x45')]['id'],function(_0x57cfb7){try{_0x57cfb7=_0x243c27[_0x3346('0x46')](_0x57cfb7);logger[_0x3346('0x30')](_0x3346('0x3b'),JSON[_0x3346('0x32')](_0x57cfb7,null,0x2));if(_0x57cfb7&&_0x243c27[_0x57cfb7['agicommand']]){_0x3d9725=_0x243c27[_0x57cfb7['agicommand']](_0x57cfb7);if(_0x3d9725){logger[_0x3346('0x30')]('response',getLogFromObject(_0x3d9725));return _['isUndefined'](_0x3d9725[_0x3346('0x42')])?null:_0x3d9725['result'][_0x3346('0x47')]();}else{logger['error'](_0x3346('0x41'),getLogFromObject(_0x3d9725));return null;}}else{logger[_0x3346('0x15')]('agicommand\x20not\x20found');return null;}}catch(_0x157c7a){logger[_0x3346('0x15')](_0x157c7a[_0x3346('0xc')]);return null;}});}logger[_0x3346('0xf')](util[_0x3346('0x10')](_0x3346('0x48'),_0x2cba53['arg_1'],_0x2cba53[_0x3346('0x1c')],_0x2cba53[_0x3346('0x18')],_0x2cba53['dnid'],_0x2cba53[_0x3346('0x1a')]));logger['info'](util[_0x3346('0x10')](_0x3346('0x49'),_0x2cba53[_0x3346('0x3e')],_0x2cba53[_0x3346('0x3f')],parseInt(_0x2cba53[_0x3346('0x40')],0xa)+0x1));_0x2cba53[_0x3346('0x4a')](_0x2cba53[_0x3346('0x3e')],_0x2cba53[_0x3346('0x3f')],parseInt(_0x2cba53[_0x3346('0x40')],0xa)+0x1);_0x2cba53[_0x3346('0x4b')]();}}else{logger[_0x3346('0x15')](util[_0x3346('0x10')](_0x3346('0x4c'),_0x2cba53['arg_1']));_0x2cba53[_0x3346('0x4a')](_0x2cba53[_0x3346('0x3e')],_0x2cba53[_0x3346('0x3f')],parseInt(_0x2cba53[_0x3346('0x40')],0xa)+0x1);_0x2cba53[_0x3346('0x4b')]();}}else{logger[_0x3346('0x15')](util[_0x3346('0x10')](_0x3346('0x4d'),_0x2cba53[_0x3346('0x17')]));_0x2cba53[_0x3346('0x4a')](_0x2cba53[_0x3346('0x3e')],_0x2cba53['extension'],parseInt(_0x2cba53[_0x3346('0x40')],0xa)+0x1);_0x2cba53['close']();}}function main(){var _0xee13f8;return utilLicense[_0x3346('0x4e')]()[_0x3346('0x29')](function(_0x31705c){if(_0x31705c){if(_0x31705c['voice']){if(_0x31705c[_0x3346('0x4f')]&&_0x31705c[_0x3346('0x4f')]>0x0){logger[_0x3346('0xf')](util[_0x3346('0x10')](_0x3346('0x50'),_0x31705c['callysquare']));_0xee13f8=_0x31705c['callysquare'];}else{logger['info'](_0x3346('0x51'));}}else{logger[_0x3346('0xf')](_0x3346('0x52'));_0xee13f8=-0x1;}}})['catch'](function(_0x42e793){logger[_0x3346('0x15')](_0x3346('0x53'),_0x42e793['stack']);})[_0x3346('0x45')](function(){var _0x1c20e8=require('./server')(config[_0x3346('0x5')]['port'],config['agi']['ip'],_0xee13f8);_0x1c20e8['on'](_0x3346('0x15'),errorHandler);_0x1c20e8['on'](_0x3346('0x54'),listeningHandler);_0x1c20e8['on'](_0x3346('0x55'),connectionHandler);_0x1c20e8['on'](_0x3346('0x4b'),closeHandler);});}main(); \ No newline at end of file +var _0xdee0=['Project\x20%s\x20not\x20published','continueAt','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','port','connection','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./vertices','defaults','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','format','name','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','target','addEdge','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','production','start','debug','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','context','extension','priority','code','result','response','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s'];(function(_0x476b5e,_0x5d646e){var _0x41d0ee=function(_0x30b895){while(--_0x30b895){_0x476b5e['push'](_0x476b5e['shift']());}};_0x41d0ee(++_0x5d646e);}(_0xdee0,0x6a));var _0x0dee=function(_0x29b7ea,_0x1fe1fd){_0x29b7ea=_0x29b7ea-0x0;var _0x5da3db=_0xdee0[_0x29b7ea];return _0x5da3db;};'use strict';var parser=require('xml2json');var _=require(_0x0dee('0x0'));var syncho=require(_0x0dee('0x1'));var util=require(_0x0dee('0x2'));var moment=require(_0x0dee('0x3'));var config=require(_0x0dee('0x4'));var logger=require(_0x0dee('0x5'))(_0x0dee('0x6'));var utilLicense=require(_0x0dee('0x7'));var rpc=require(_0x0dee('0x8'));var mailRpc=require(_0x0dee('0x9'));var Graph=require('./graph');var Vertices=require(_0x0dee('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x0dee('0xb')](config[_0x0dee('0x6')],{'ip':_0x0dee('0xc'),'port':0x11dd});function connectionHandler(_0x4a30b9){process[_0x0dee('0xd')](function(){syncho(function(){try{setChannelVariables(_0x4a30b9);agiHandler(_0x4a30b9);}catch(_0x127525){logger[_0x0dee('0xe')](_0x127525['stack']);}});});}function listeningHandler(){console[_0x0dee('0xf')](_0x0dee('0x10'),config['agi']['port']);logger[_0x0dee('0x11')](util['format'](_0x0dee('0x12'),config[_0x0dee('0x6')]['ip'],config[_0x0dee('0x6')]['port']));}function errorHandler(_0x287f5c){if(_0x287f5c&&_0x287f5c['name']&&_0x287f5c[_0x0dee('0x13')]){logger['error'](util[_0x0dee('0x14')]('[%s]\x20%s',_0x287f5c[_0x0dee('0x15')],_0x287f5c[_0x0dee('0x13')]));}else{logger['error'](util[_0x0dee('0x14')](_0x0dee('0x16'),_0x287f5c[_0x0dee('0x17')]));}}function closeHandler(){logger['info'](util[_0x0dee('0x14')](_0x0dee('0x18'),this[_0x0dee('0x19')],this['calleridname'],this[_0x0dee('0x1a')],this[_0x0dee('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x215b78){logger[_0x0dee('0xe')](_0x215b78['stack']);}}function timeoutHandler(){logger[_0x0dee('0x11')](util[_0x0dee('0x14')](_0x0dee('0x1c'),this[_0x0dee('0x19')],this[_0x0dee('0x1d')],this[_0x0dee('0x1a')],this[_0x0dee('0x1b')],this[_0x0dee('0x1e')]));}function hangupHandler(){logger[_0x0dee('0x11')](util['format'](_0x0dee('0x1f'),this[_0x0dee('0x19')],this['calleridname'],this['callerid'],this[_0x0dee('0x1b')],this[_0x0dee('0x1e')]));this[_0x0dee('0x20')]=!![];}function getRoot(_0x17c60b){return parser[_0x0dee('0x21')](_0x17c60b,{'object':!![]})['mxGraphModel'][_0x0dee('0x22')];}function addVertex(_0x571adc,_0x10e446,_0x10af53){_0x10e446[_0x0dee('0x23')]=_0x10af53;if(_0x10e446[_0x0dee('0x24')](_0x0dee('0x25'))){_0x10e446[_0x0dee('0x26')]=parseInt(_0x10e446[_0x0dee('0x25')],0xa);}_0x571adc[_0x0dee('0x27')](_[_0x0dee('0x28')](_0x10e446,_0x0dee('0x29')));}function initGraph(_0x479d08,_0x23d259){var _0x4a4706=new Graph();for(var _0x384b9c in _0x479d08){if(_0x479d08[_0x0dee('0x24')](_0x384b9c)){if(_[_0x0dee('0x2a')](_0x479d08[_0x384b9c])){for(var _0x51b640=0x0;_0x51b640<_0x479d08[_0x384b9c][_0x0dee('0x2b')];_0x51b640+=0x1){addVertex(_0x4a4706,_0x479d08[_0x384b9c][_0x51b640],_0x384b9c);}}else{addVertex(_0x4a4706,_0x479d08[_0x384b9c],_0x384b9c);}}}for(var _0x283452=0x0;_0x283452<_0x23d259[_0x0dee('0x2b')];_0x283452+=0x1){if(_0x23d259[_0x283452]['source']&&_0x23d259[_0x283452][_0x0dee('0x2c')]){_0x4a4706[_0x0dee('0x2d')](_0x23d259[_0x283452]['source'],_0x23d259[_0x283452][_0x0dee('0x2c')],_0x23d259[_0x283452][_0x0dee('0x2e')]);}}return _0x4a4706;}function getSquareProject(_0x5ba56f,_0x416725){rpc[_0x0dee('0x2f')](_0x5ba56f)[_0x0dee('0x30')](function(_0x405bde){_0x416725(null,_0x405bde);})[_0x0dee('0x31')](function(_0x21b84c){_0x416725(null,_0x21b84c);});}function createSquareReport(_0x44bb51,_0xbf80e6){rpc[_0x0dee('0x32')](_0x44bb51)[_0x0dee('0x30')](function(_0x490b83){if(_0xbf80e6){_0xbf80e6(null,_0x490b83);}})[_0x0dee('0x31')](function(_0x535c25){if(_0xbf80e6){_0xbf80e6(null,_0x535c25);}});}function setChannelVariables(_0x45dd35){for(var _0x5e7baa in _0x45dd35){if(_0x45dd35['hasOwnProperty'](_0x5e7baa)){if(_0x5e7baa[_0x0dee('0x33')](_0x0dee('0x34'))===0x0){_0x45dd35[_0x5e7baa['substring'](0x4)]=_0x45dd35[_0x5e7baa];delete _0x45dd35[_0x5e7baa];}}}}function getLogFromObject(_0x3987d7){return util[_0x0dee('0x35')](_0x3987d7,{'showHidden':![],'depth':null});}function agiHandler(_0x58bc6b){var _0x4b36fe,_0x41e89a,_0x2ff8d5,_0x33a015,_0x4f5405;logger['debug'](_0x0dee('0x36'),JSON[_0x0dee('0x37')](_0x58bc6b,null,0x2));logger[_0x0dee('0x11')](util[_0x0dee('0x14')](_0x0dee('0x38'),_0x58bc6b[_0x0dee('0x19')],_0x58bc6b[_0x0dee('0x1d')],_0x58bc6b['callerid'],_0x58bc6b[_0x0dee('0x1b')],_0x58bc6b[_0x0dee('0x1e')]));_0x58bc6b['on'](_0x0dee('0xe'),errorHandler);_0x58bc6b['on'](_0x0dee('0x39'),closeHandler);_0x58bc6b['on'](_0x0dee('0x3a'),timeoutHandler);_0x58bc6b[_0x0dee('0x20')]=![];_0x58bc6b['on'](_0x0dee('0x3b'),hangupHandler);var _0x8d12be=getSquareProject['sync'](null,_0x58bc6b[_0x0dee('0x19')]);if(_0x8d12be){if(_0x8d12be[_0x0dee('0x3c')]){_0x4b36fe=getRoot(_0x8d12be[_0x0dee('0x3c')]);if(_0x4b36fe&&_0x4b36fe[_0x0dee('0x3d')]){logger[_0x0dee('0x3e')]('root',JSON[_0x0dee('0x37')](_0x4b36fe,null,0x2));_0x58bc6b['joinAt']=moment()[_0x0dee('0x14')](_0x0dee('0x3f'));_0x41e89a=initGraph(_[_0x0dee('0x28')](_0x4b36fe,_0x0dee('0x29')),_0x4b36fe[_0x0dee('0x29')]);_0x2ff8d5=new Vertices(_0x58bc6b,rpc,mailRpc);logger[_0x0dee('0x11')](util[_0x0dee('0x14')](_0x0dee('0x40'),_0x58bc6b[_0x0dee('0x19')],_0x58bc6b[_0x0dee('0x1d')],_0x58bc6b[_0x0dee('0x1a')],_0x58bc6b[_0x0dee('0x1b')],_0x58bc6b['uniqueid']));_0x41e89a[_0x0dee('0x41')](_0x4b36fe[_0x0dee('0x3d')]['id'],function(_0x3dd655){try{_0x3dd655=_0x2ff8d5[_0x0dee('0x42')](_0x3dd655);logger[_0x0dee('0x3e')](_0x0dee('0x43'),JSON[_0x0dee('0x37')](_0x3dd655,null,0x2));if(_0x3dd655[_0x0dee('0x23')]===_0x0dee('0x44')){logger[_0x0dee('0x11')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x58bc6b[_0x0dee('0x45')]=_0x3dd655['context']||_0x58bc6b[_0x0dee('0x45')];_0x58bc6b['extension']=_0x3dd655[_0x0dee('0x46')];_0x58bc6b[_0x0dee('0x47')]=_0x3dd655[_0x0dee('0x47')]?_0x3dd655[_0x0dee('0x47')]-0x1:0x1;return null;}else if(_0x3dd655&&_0x2ff8d5[_0x3dd655[_0x0dee('0x23')]]){_0x4f5405=_0x2ff8d5[_0x3dd655['agicommand']](_0x3dd655);logger[_0x0dee('0x11')]('response',JSON[_0x0dee('0x37')](_0x4f5405,null,0x2));if(_0x4f5405&&_0x4f5405[_0x0dee('0x48')]===AGI_CODE_SUCCESS&&_0x4f5405[_0x0dee('0x49')]!==AGI_RESULT_ERROR&&!_0x58bc6b['evtHangup']){logger['debug'](_0x0dee('0x4a'),getLogFromObject(_0x4f5405));return _[_0x0dee('0x4b')](_0x4f5405[_0x0dee('0x49')])?null:_0x4f5405[_0x0dee('0x49')][_0x0dee('0x4c')]();}else{logger[_0x0dee('0xe')](_0x0dee('0x4a'),getLogFromObject(_0x4f5405));return null;}}else{logger[_0x0dee('0xe')](_0x0dee('0x4d'));return null;}}catch(_0x525af2){logger[_0x0dee('0xe')](_0x525af2['stack']);return null;}});if(_0x4b36fe[_0x0dee('0x4e')]){logger[_0x0dee('0x11')](util['format'](_0x0dee('0x4f'),_0x58bc6b[_0x0dee('0x19')],_0x58bc6b['calleridname'],_0x58bc6b[_0x0dee('0x1a')],_0x58bc6b[_0x0dee('0x1b')],_0x58bc6b[_0x0dee('0x1e')]));_0x41e89a['traverseBFS'](_0x4b36fe[_0x0dee('0x4e')]['id'],function(_0x1893b9){try{_0x1893b9=_0x2ff8d5['clear'](_0x1893b9);logger[_0x0dee('0x3e')](_0x0dee('0x43'),JSON[_0x0dee('0x37')](_0x1893b9,null,0x2));if(_0x1893b9&&_0x2ff8d5[_0x1893b9[_0x0dee('0x23')]]){_0x4f5405=_0x2ff8d5[_0x1893b9[_0x0dee('0x23')]](_0x1893b9);if(_0x4f5405){logger[_0x0dee('0x3e')]('response',getLogFromObject(_0x4f5405));return _[_0x0dee('0x4b')](_0x4f5405[_0x0dee('0x49')])?null:_0x4f5405[_0x0dee('0x49')]['toString']();}else{logger[_0x0dee('0xe')](_0x0dee('0x4a'),getLogFromObject(_0x4f5405));return null;}}else{logger[_0x0dee('0xe')](_0x0dee('0x4d'));return null;}}catch(_0x34f238){logger[_0x0dee('0xe')](_0x34f238[_0x0dee('0x17')]);return null;}});}logger[_0x0dee('0x11')](util[_0x0dee('0x14')](_0x0dee('0x50'),_0x58bc6b[_0x0dee('0x19')],_0x58bc6b[_0x0dee('0x1d')],_0x58bc6b[_0x0dee('0x1a')],_0x58bc6b[_0x0dee('0x1b')],_0x58bc6b[_0x0dee('0x1e')]));logger[_0x0dee('0x11')](util[_0x0dee('0x14')](_0x0dee('0x51'),_0x58bc6b[_0x0dee('0x45')],_0x58bc6b[_0x0dee('0x46')],parseInt(_0x58bc6b[_0x0dee('0x47')],0xa)+0x1));_0x58bc6b['continueAt'](_0x58bc6b[_0x0dee('0x45')],_0x58bc6b[_0x0dee('0x46')],parseInt(_0x58bc6b['priority'],0xa)+0x1);_0x58bc6b[_0x0dee('0x39')]();}}else{logger['error'](util[_0x0dee('0x14')](_0x0dee('0x52'),_0x58bc6b[_0x0dee('0x19')]));_0x58bc6b[_0x0dee('0x53')](_0x58bc6b[_0x0dee('0x45')],_0x58bc6b[_0x0dee('0x46')],parseInt(_0x58bc6b[_0x0dee('0x47')],0xa)+0x1);_0x58bc6b[_0x0dee('0x39')]();}}else{logger[_0x0dee('0xe')](util[_0x0dee('0x14')]('Project\x20%s\x20not\x20found',_0x58bc6b[_0x0dee('0x19')]));_0x58bc6b[_0x0dee('0x53')](_0x58bc6b[_0x0dee('0x45')],_0x58bc6b['extension'],parseInt(_0x58bc6b[_0x0dee('0x47')],0xa)+0x1);_0x58bc6b[_0x0dee('0x39')]();}}function main(){var _0x5f0035;return utilLicense[_0x0dee('0x54')]()[_0x0dee('0x30')](function(_0x227cd8){if(_0x227cd8){if(_0x227cd8[_0x0dee('0x55')]){if(_0x227cd8[_0x0dee('0x56')]&&_0x227cd8[_0x0dee('0x56')]>0x0){logger[_0x0dee('0x11')](util[_0x0dee('0x14')](_0x0dee('0x57'),_0x227cd8['callysquare']));_0x5f0035=_0x227cd8['callysquare'];}else{logger[_0x0dee('0x11')](_0x0dee('0x58'));}}else{logger[_0x0dee('0x11')](_0x0dee('0x59'));_0x5f0035=-0x1;}}})[_0x0dee('0x31')](function(_0x4270de){logger[_0x0dee('0xe')](_0x0dee('0x5a'),_0x4270de[_0x0dee('0x17')]);})[_0x0dee('0x4e')](function(){var _0x21146c=require(_0x0dee('0x5b'))(config[_0x0dee('0x6')][_0x0dee('0x5c')],config[_0x0dee('0x6')]['ip'],_0x5f0035);_0x21146c['on'](_0x0dee('0xe'),errorHandler);_0x21146c['on']('listening',listeningHandler);_0x21146c['on'](_0x0dee('0x5d'),connectionHandler);_0x21146c['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 1acc76c..912e51a 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 _0xf9fa=['client','then','error','message','result','catch','SendMail','bluebird','jayson/promise'];(function(_0x4bf029,_0x3e24f6){var _0x359cf3=function(_0x1a27c5){while(--_0x1a27c5){_0x4bf029['push'](_0x4bf029['shift']());}};_0x359cf3(++_0x3e24f6);}(_0xf9fa,0xe8));var _0xaf9f=function(_0x43f2c2,_0x231016){_0x43f2c2=_0x43f2c2-0x0;var _0x4d7aaa=_0xf9fa[_0x43f2c2];return _0x4d7aaa;};'use strict';var BPromise=require(_0xaf9f('0x0'));var jayson=require(_0xaf9f('0x1'));var client=jayson[_0xaf9f('0x2')]['http']({'port':0x232b});function request(_0x5f43b8,_0x407282){return new BPromise(function(_0x3ad265,_0x59f0ea){return client['request'](_0x5f43b8,_0x407282)[_0xaf9f('0x3')](function(_0x1efa3b){if(_0x1efa3b[_0xaf9f('0x4')]){return _0x59f0ea(_0x1efa3b[_0xaf9f('0x4')][_0xaf9f('0x5')]);}else{return _0x3ad265(_0x1efa3b[_0xaf9f('0x6')]);}})[_0xaf9f('0x7')](function(_0x5a7f3d){return _0x59f0ea(_0x5a7f3d);});});}exports['sendMailMessage']=function(_0x80d399,_0x17926b){return request(_0xaf9f('0x8'),{'account':_0x80d399,'message':_0x17926b});}; \ No newline at end of file +var _0xd175=['message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd175,0x7c));var _0x5d17=function(_0x184459,_0x38d384){_0x184459=_0x184459-0x0;var _0x5cd9c0=_0xd175[_0x184459];return _0x5cd9c0;};'use strict';var BPromise=require(_0x5d17('0x0'));var jayson=require(_0x5d17('0x1'));var client=jayson[_0x5d17('0x2')][_0x5d17('0x3')]({'port':0x232b});function request(_0x3984c6,_0x3a1c40){return new BPromise(function(_0x20011f,_0x401bbc){return client[_0x5d17('0x4')](_0x3984c6,_0x3a1c40)[_0x5d17('0x5')](function(_0x3098b5){if(_0x3098b5['error']){return _0x401bbc(_0x3098b5['error'][_0x5d17('0x6')]);}else{return _0x20011f(_0x3098b5['result']);}})[_0x5d17('0x7')](function(_0x4a1bba){return _0x401bbc(_0x4a1bba);});});}exports[_0x5d17('0x8')]=function(_0x2d187f,_0x31323a){return request(_0x5d17('0x9'),{'account':_0x2d187f,'message':_0x31323a});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 322c20f..1e4a769 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 _0xd985=['indexOf','substring','split','slice','trim','length','emit','headers','line','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString'];(function(_0xb8104c,_0x2deacc){var _0x38ac32=function(_0x42696b){while(--_0x42696b){_0xb8104c['push'](_0xb8104c['shift']());}};_0x38ac32(++_0x2deacc);}(_0xd985,0x1a7));var _0x5d98=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xd985[_0x36884e];return _0x1cc367;};'use strict';var util=require(_0x5d98('0x0'));var Transform=require(_0x5d98('0x1'))[_0x5d98('0x2')];function AGIReply(_0x477b94){Transform[_0x5d98('0x3')](this,_0x477b94);this[_0x5d98('0x4')]='';this[_0x5d98('0x5')]=![];}util[_0x5d98('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x3eb975,_0x4732fe,_0x23a92f){var _0x3d5f54='\x0a',_0x4f054f=['\x0a\x0a',_0x5d98('0x7')],_0x1726f3=-0x1,_0x50f74c=-0x1,_0xb375d1='',_0x254c57=0x0,_0x246b79='',_0x155afa='';this['_localBuffer']+=_0x3eb975[_0x5d98('0x8')]();_0x246b79=this[_0x5d98('0x4')];if(!this['_inBody']){_0x254c57=0x0;while(_0x4f054f[_0x254c57]){while((_0x50f74c=_0x246b79[_0x5d98('0x9')](_0x4f054f[_0x254c57]))!=-0x1){_0xb375d1=_0x4f054f[_0x254c57];_0x155afa=_0x246b79[_0x5d98('0xa')](0x0,_0x50f74c);_0x246b79=_0x246b79[_0x5d98('0xa')](_0x50f74c+_0xb375d1['length']);var _0x203ca7=_0x155afa[_0x5d98('0xb')](_0x3d5f54),_0x5daa1f=0x0,_0x443e19={},_0x297cc5='',_0x5dd989='',_0x1f54d8=-0x1;while(_0x203ca7[_0x5daa1f]){_0x1f54d8=_0x203ca7[_0x5daa1f]['indexOf'](':');if(_0x1f54d8!=-0x1){_0x297cc5=_0x203ca7[_0x5daa1f][_0x5d98('0xc')](0x0,_0x1f54d8)[_0x5d98('0xd')]();_0x5dd989=_0x203ca7[_0x5daa1f]['slice'](_0x1f54d8+0x1)['trim']();if(_0x297cc5[_0x5d98('0xe')]>0x0){_0x443e19[_0x297cc5]=_0x5dd989;}}else{}_0x5daa1f++;}this[_0x5d98('0xf')](_0x5d98('0x10'),_0x443e19);this[_0x5d98('0x5')]=!![];}_0x254c57++;}this[_0x5d98('0x4')]=_0x246b79;}else{while((_0x1726f3=_0x246b79['indexOf'](_0x3d5f54))!=-0x1){_0x155afa=_0x246b79[_0x5d98('0xa')](0x0,_0x1726f3);this['emit'](_0x5d98('0x11'),_0x155afa);_0x246b79=_0x246b79[_0x5d98('0xa')](_0x1726f3+_0x3d5f54[_0x5d98('0xe')]);}this['_localBuffer']=_0x246b79;}_0x23a92f();};module['exports']=AGIReply; \ No newline at end of file +var _0xf451=['emit','headers','exports','util','stream','Transform','_localBuffer','_inBody','inherits','toString','substring','length','trim','slice'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf451,0x161));var _0x1f45=function(_0x2e6a0c,_0x56216c){_0x2e6a0c=_0x2e6a0c-0x0;var _0x4150ae=_0xf451[_0x2e6a0c];return _0x4150ae;};'use strict';var util=require(_0x1f45('0x0'));var Transform=require(_0x1f45('0x1'))[_0x1f45('0x2')];function AGIReply(_0x1ab6bb){Transform['call'](this,_0x1ab6bb);this[_0x1f45('0x3')]='';this[_0x1f45('0x4')]=![];}util[_0x1f45('0x5')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x52405c,_0x4912f6,_0x4a3c60){var _0x3436b8='\x0a',_0x2ca4f6=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x52a4e3=-0x1,_0x40037c=-0x1,_0x941433='',_0x11a766=0x0,_0x3915c5='',_0xf4e9cc='';this['_localBuffer']+=_0x52405c[_0x1f45('0x6')]();_0x3915c5=this[_0x1f45('0x3')];if(!this[_0x1f45('0x4')]){_0x11a766=0x0;while(_0x2ca4f6[_0x11a766]){while((_0x40037c=_0x3915c5['indexOf'](_0x2ca4f6[_0x11a766]))!=-0x1){_0x941433=_0x2ca4f6[_0x11a766];_0xf4e9cc=_0x3915c5[_0x1f45('0x7')](0x0,_0x40037c);_0x3915c5=_0x3915c5['substring'](_0x40037c+_0x941433[_0x1f45('0x8')]);var _0x346710=_0xf4e9cc['split'](_0x3436b8),_0x555541=0x0,_0x34f9fb={},_0xe8e07b='',_0x3dea97='',_0xb0f96b=-0x1;while(_0x346710[_0x555541]){_0xb0f96b=_0x346710[_0x555541]['indexOf'](':');if(_0xb0f96b!=-0x1){_0xe8e07b=_0x346710[_0x555541]['slice'](0x0,_0xb0f96b)[_0x1f45('0x9')]();_0x3dea97=_0x346710[_0x555541][_0x1f45('0xa')](_0xb0f96b+0x1)[_0x1f45('0x9')]();if(_0xe8e07b['length']>0x0){_0x34f9fb[_0xe8e07b]=_0x3dea97;}}else{}_0x555541++;}this[_0x1f45('0xb')](_0x1f45('0xc'),_0x34f9fb);this[_0x1f45('0x4')]=!![];}_0x11a766++;}this[_0x1f45('0x3')]=_0x3915c5;}else{while((_0x52a4e3=_0x3915c5['indexOf'](_0x3436b8))!=-0x1){_0xf4e9cc=_0x3915c5[_0x1f45('0x7')](0x0,_0x52a4e3);this[_0x1f45('0xb')]('line',_0xf4e9cc);_0x3915c5=_0x3915c5[_0x1f45('0x7')](_0x52a4e3+_0x3436b8[_0x1f45('0x8')]);}this['_localBuffer']=_0x3915c5;}_0x4a3c60();};module[_0x1f45('0xd')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 0e7d5d2..3629d0f 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 _0x60f4=['CreateSquareDetailsReport','createSquareReport','CreateSquareReport','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ListId','CreateCmContact','getPauseById','agentLogin','agentPause','PauseUser','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','client','http','then','error','message','result','catch','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','name','email','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','getTrunkById','ShowTrunk','ShowSound','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport'];(function(_0x29c2de,_0x26e420){var _0x3c698f=function(_0x58f203){while(--_0x58f203){_0x29c2de['push'](_0x29c2de['shift']());}};_0x3c698f(++_0x26e420);}(_0x60f4,0x17d));var _0x460f=function(_0x393643,_0x448793){_0x393643=_0x393643-0x0;var _0x586e3b=_0x60f4[_0x393643];return _0x586e3b;};'use strict';var BPromise=require(_0x460f('0x0'));var moment=require(_0x460f('0x1'));var _=require(_0x460f('0x2'));var util=require(_0x460f('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x460f('0x4')][_0x460f('0x5')]({'port':0x2329});function request(_0x450359,_0x5f4d51){return new BPromise(function(_0x2e3681,_0x1e0686){return client['request'](_0x450359,_0x5f4d51)[_0x460f('0x6')](function(_0x20b4b6){if(_0x20b4b6['error']){return _0x1e0686(_0x20b4b6[_0x460f('0x7')][_0x460f('0x8')]);}else{return _0x2e3681(_0x20b4b6[_0x460f('0x9')]);}})[_0x460f('0xa')](function(_0x113756){return _0x1e0686(_0x113756);});});}exports['getSquareProject']=function(_0x464bce){return request(_0x460f('0xb'),{'options':{'raw':![],'where':{'name':_0x464bce},'attributes':[_0x460f('0xc')]}});};exports[_0x460f('0xd')]=function(_0x3d62bc){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x3d62bc},'include':[{'model':_0x460f('0xe'),'as':_0x460f('0xf')}],'attributes':['id',_0x460f('0x10'),_0x460f('0x11')]}});};exports['getSquareProjectById']=function(_0x21ea59){return request(_0x460f('0xb'),{'options':{'where':{'id':_0x21ea59},'attributes':[_0x460f('0x10')]}});};exports[_0x460f('0x12')]=function(_0x14117d){return request(_0x460f('0x13'),{'options':{'where':{'id':_0x14117d},'attributes':[_0x460f('0x10')]}});};exports['getVariableById']=function(_0x174900){return request(_0x460f('0x14'),{'options':{'where':{'id':_0x174900},'attributes':[_0x460f('0x10')]}});};exports[_0x460f('0x15')]=function(_0x2890af){return request(_0x460f('0x16'),{'options':{'where':{'id':_0x2890af},'attributes':['dsn']}});};exports[_0x460f('0x17')]=function(_0x324a1a){return request('ShowUser',{'options':{'where':{'id':_0x324a1a},'attributes':[_0x460f('0x10')]}});};exports[_0x460f('0x18')]=function(_0x4b0ebf){return request(_0x460f('0x19'),{'options':{'where':{'id':_0x4b0ebf},'attributes':[_0x460f('0x10')]}});};exports['getSoundById']=function(_0x564384){return request(_0x460f('0x1a'),{'options':{'where':{'id':_0x564384},'attributes':['save_name']}});};exports[_0x460f('0x1b')]=function(_0x1a2391){return request(_0x460f('0x1c'),{'options':{'raw':![],'where':{'id':_0x1a2391},'include':[{'model':'Interval','as':_0x460f('0x1d')}]}});};exports[_0x460f('0x1e')]=function(_0x1173e4){return request(_0x460f('0x1f'),{'options':{'where':{'id':_0x1173e4},'attributes':['id',_0x460f('0x10')]}});};exports[_0x460f('0x20')]=function(_0xe3126e){return request(_0x460f('0x21'),{'body':_0xe3126e});};exports[_0x460f('0x22')]=function(_0x12f7e3){return request(_0x460f('0x23'),{'body':_0x12f7e3});};exports[_0x460f('0x24')]=function(_0x194f25){return request(_0x460f('0x25'),{'body':_['merge'](_0x194f25,{'project_name':_0x194f25['arg_1'],'prev_project_name':_0x194f25['arg_2']||'','is_subproject':_0x194f25['arg_2']?!![]:![],'leaveAt':moment()[_0x460f('0x26')](_0x460f('0x27'))})});};exports[_0x460f('0x28')]=function(_0x26b019){return request(_0x460f('0x29'),{'body':_0x26b019});};exports[_0x460f('0x2a')]=function(_0x33dee5){return request(_0x460f('0x2b'),{'body':_0x33dee5});};exports['createCmContact']=function(_0x36f406){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x36f406['phone'],'ListId':_0x36f406[_0x460f('0x2c')]}}})['then'](function(_0x38e710){if(_0x38e710){return _0x38e710;}return request(_0x460f('0x2d'),{'body':_0x36f406});});};exports[_0x460f('0x2e')]=function(_0x5800c0){return request('ShowPause',{'options':{'where':{'id':_0x5800c0},'attributes':[_0x460f('0x10')]}});};exports[_0x460f('0x2f')]=function(_0x542d89,_0x25b380){return request('LoginUser',{'body':{'interface':_0x25b380},'options':{'where':_0x542d89}});};exports[_0x460f('0x30')]=function(_0x2a3e48,_0x369960,_0x7c576b){return request(_0x460f('0x31'),{'body':{'type':_0x369960,'uniqueid':_0x7c576b},'options':{'where':_0x2a3e48}});};exports['agentUnpause']=function(_0x3908b0){return request(_0x460f('0x32'),{'body':{},'options':{'where':_0x3908b0}});};exports['agentLogout']=function(_0x4d5c43){return request(_0x460f('0x33'),{'body':{},'options':{'where':_0x4d5c43}});}; \ No newline at end of file +var _0xdd42=['ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','lodash','jayson/promise','client','then','error','message','result','catch','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getTrunkById','ShowTrunk'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0xdd42,0x1ef));var _0x2dd4=function(_0x8824f4,_0x384a13){_0x8824f4=_0x8824f4-0x0;var _0x29541a=_0xdd42[_0x8824f4];return _0x29541a;};'use strict';var BPromise=require(_0x2dd4('0x0'));var moment=require('moment');var _=require(_0x2dd4('0x1'));var util=require('util');var jayson=require(_0x2dd4('0x2'));var client=jayson[_0x2dd4('0x3')]['http']({'port':0x2329});function request(_0x1d8e33,_0x19224a){return new BPromise(function(_0x2114f2,_0x1e5966){return client['request'](_0x1d8e33,_0x19224a)[_0x2dd4('0x4')](function(_0x58c27a){if(_0x58c27a[_0x2dd4('0x5')]){return _0x1e5966(_0x58c27a[_0x2dd4('0x5')][_0x2dd4('0x6')]);}else{return _0x2114f2(_0x58c27a[_0x2dd4('0x7')]);}})[_0x2dd4('0x8')](function(_0x14da2c){return _0x1e5966(_0x14da2c);});});}exports['getSquareProject']=function(_0x54bdd8){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x54bdd8},'attributes':[_0x2dd4('0x9')]}});};exports[_0x2dd4('0xa')]=function(_0x135898){return request(_0x2dd4('0xb'),{'options':{'raw':![],'where':{'id':_0x135898},'include':[{'model':_0x2dd4('0xc'),'as':_0x2dd4('0xd')}],'attributes':['id',_0x2dd4('0xe'),_0x2dd4('0xf')]}});};exports[_0x2dd4('0x10')]=function(_0x11b551){return request(_0x2dd4('0x11'),{'options':{'where':{'id':_0x11b551},'attributes':['name']}});};exports[_0x2dd4('0x12')]=function(_0x384281){return request(_0x2dd4('0x13'),{'options':{'where':{'id':_0x384281},'attributes':[_0x2dd4('0xe')]}});};exports[_0x2dd4('0x14')]=function(_0x5a75f5){return request(_0x2dd4('0x15'),{'options':{'where':{'id':_0x5a75f5},'attributes':[_0x2dd4('0xe')]}});};exports[_0x2dd4('0x16')]=function(_0x5a2f7b){return request(_0x2dd4('0x17'),{'options':{'where':{'id':_0x5a2f7b},'attributes':[_0x2dd4('0x18')]}});};exports['getUserById']=function(_0x417367){return request('ShowUser',{'options':{'where':{'id':_0x417367},'attributes':['name']}});};exports[_0x2dd4('0x19')]=function(_0x57c1f1){return request(_0x2dd4('0x1a'),{'options':{'where':{'id':_0x57c1f1},'attributes':[_0x2dd4('0xe')]}});};exports['getSoundById']=function(_0x1b6954){return request(_0x2dd4('0x1b'),{'options':{'where':{'id':_0x1b6954},'attributes':[_0x2dd4('0x1c')]}});};exports[_0x2dd4('0x1d')]=function(_0x3dbedf){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x3dbedf},'include':[{'model':_0x2dd4('0x1e'),'as':_0x2dd4('0x1f')}]}});};exports[_0x2dd4('0x20')]=function(_0x516789){return request(_0x2dd4('0x21'),{'options':{'where':{'id':_0x516789},'attributes':['id',_0x2dd4('0xe')]}});};exports[_0x2dd4('0x22')]=function(_0x24df09){return request('CreateSmsMessage',{'body':_0x24df09});};exports[_0x2dd4('0x23')]=function(_0x42318d){return request(_0x2dd4('0x24'),{'body':_0x42318d});};exports['createSquareReport']=function(_0x492fe8){return request(_0x2dd4('0x25'),{'body':_[_0x2dd4('0x26')](_0x492fe8,{'project_name':_0x492fe8[_0x2dd4('0x27')],'prev_project_name':_0x492fe8[_0x2dd4('0x28')]||'','is_subproject':_0x492fe8['arg_2']?!![]:![],'leaveAt':moment()[_0x2dd4('0x29')](_0x2dd4('0x2a'))})});};exports[_0x2dd4('0x2b')]=function(_0x2b70ab){return request(_0x2dd4('0x2c'),{'body':_0x2b70ab});};exports[_0x2dd4('0x2d')]=function(_0x422ca9){return request(_0x2dd4('0x2e'),{'body':_0x422ca9});};exports['createCmContact']=function(_0x329066){return request(_0x2dd4('0x2f'),{'options':{'raw':![],'where':{'phone':_0x329066[_0x2dd4('0x30')],'ListId':_0x329066[_0x2dd4('0x31')]}}})['then'](function(_0x4858ca){if(_0x4858ca){return _0x4858ca;}return request('CreateCmContact',{'body':_0x329066});});};exports['getPauseById']=function(_0x3f85d1){return request(_0x2dd4('0x32'),{'options':{'where':{'id':_0x3f85d1},'attributes':['name']}});};exports[_0x2dd4('0x33')]=function(_0x91a905,_0x2a8640){return request(_0x2dd4('0x34'),{'body':{'interface':_0x2a8640},'options':{'where':_0x91a905}});};exports[_0x2dd4('0x35')]=function(_0x4f531c,_0x312e16,_0x5e024b){return request(_0x2dd4('0x36'),{'body':{'type':_0x312e16,'uniqueid':_0x5e024b},'options':{'where':_0x4f531c}});};exports[_0x2dd4('0x37')]=function(_0x5b42bd){return request(_0x2dd4('0x38'),{'body':{},'options':{'where':_0x5b42bd}});};exports['agentLogout']=function(_0x34c41e){return request(_0x2dd4('0x39'),{'body':{},'options':{'where':_0x34c41e}});}; \ 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 22d033b..98fdbcf 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 _0x4677=['exports','./polly'];(function(_0x3f6e7b,_0x54c444){var _0x298019=function(_0x47a7dc){while(--_0x47a7dc){_0x3f6e7b['push'](_0x3f6e7b['shift']());}};_0x298019(++_0x54c444);}(_0x4677,0x155));var _0x7467=function(_0xce7ce8,_0x1f6233){_0xce7ce8=_0xce7ce8-0x0;var _0x455173=_0x4677[_0xce7ce8];return _0x455173;};var polly=require(_0x7467('0x0'));var lex=require('./lex');module[_0x7467('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xc962=['./polly'];(function(_0x4e5ee4,_0x492d82){var _0x35c823=function(_0x5eb8a4){while(--_0x5eb8a4){_0x4e5ee4['push'](_0x4e5ee4['shift']());}};_0x35c823(++_0x492d82);}(_0xc962,0x6d));var _0x2c96=function(_0x3ee4f0,_0x4e31d7){_0x3ee4f0=_0x3ee4f0-0x0;var _0x1da293=_0xc962[_0x3ee4f0];return _0x1da293;};var polly=require(_0x2c96('0x0'));var lex=require('./lex');module['exports']={'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 9ee70cb..abcbc85 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 _0x6324=['./lib/api','exports'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x6324,0x142));var _0x4632=function(_0x5e4fdc,_0x183475){_0x5e4fdc=_0x5e4fdc-0x0;var _0xe2d401=_0x6324[_0x5e4fdc];return _0xe2d401;};'use strict';var lex=require(_0x4632('0x0'));module[_0x4632('0x1')]=function(_0xb0927d,_0x2fc528,_0x551054,_0x1805c5,_0x48e508,_0x3bea40){return lex(_0xb0927d,_0x2fc528,_0x551054,_0x1805c5,_0x48e508,_0x3bea40);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x1ffbbf,_0x18bf2d,_0x26844b,_0x1ba0bb,_0x455700,_0x2ad237){return lex(_0x1ffbbf,_0x18bf2d,_0x26844b,_0x1ba0bb,_0x455700,_0x2ad237);}; \ 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 1bf6d37..2de741c 100644 --- a/server/services/agi/scripts/aws/lex/lib/api.js +++ b/server/services/agi/scripts/aws/lex/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x2081ad,_0x42b16d){var _0x1f870e=function(_0xbf5712){while(--_0xbf5712){_0x2081ad['push'](_0x2081ad['shift']());}};_0x1f870e(++_0x42b16d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x2a1868,_0x5bb078){var _0xf9979f=function(_0x23b59b){while(--_0x23b59b){_0x2a1868['push'](_0x2a1868['shift']());}};_0xf9979f(++_0x5bb078);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index 73a833f..ac257a0 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 _0x5c32=['exports'];(function(_0x4aacc9,_0x5b819d){var _0x49891c=function(_0xf83310){while(--_0xf83310){_0x4aacc9['push'](_0x4aacc9['shift']());}};_0x49891c(++_0x5b819d);}(_0x5c32,0xeb));var _0x25c3=function(_0x5810bd,_0x179926){_0x5810bd=_0x5810bd-0x0;var _0xbc4b8c=_0x5c32[_0x5810bd];return _0xbc4b8c;};'use strict';var polly=require('./lib/api');module[_0x25c3('0x0')]=function(_0x5e8109,_0x3fede7,_0x5d8c42,_0x2da2c2,_0x1302a3,_0x317756,_0x162365){return polly(_0x5e8109,_0x3fede7,_0x5d8c42,_0x2da2c2,_0x1302a3,_0x317756,_0x162365);}; \ No newline at end of file +var _0x7e5e=['exports','./lib/api'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x7e5e,0x143));var _0xe7e5=function(_0x2797c6,_0x37421b){_0x2797c6=_0x2797c6-0x0;var _0x54809f=_0x7e5e[_0x2797c6];return _0x54809f;};'use strict';var polly=require(_0xe7e5('0x0'));module[_0xe7e5('0x1')]=function(_0x3aae7d,_0x540e58,_0x25171a,_0x44a02e,_0x32c55b,_0x33def2,_0x5f4684){return polly(_0x3aae7d,_0x540e58,_0x25171a,_0x44a02e,_0x32c55b,_0x33def2,_0x5f4684);}; \ 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 b184ea3..73b544a 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 _0x981c=['mp3','path','bluebird','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x981c,0xd2));var _0xc981=function(_0x2a8904,_0x4e721b){_0x2a8904=_0x2a8904-0x0;var _0x390838=_0x981c[_0x2a8904];return _0x390838;};'use strict';var fs=require('fs');var path=require(_0xc981('0x0'));var BPromise=require(_0xc981('0x1'));var rs=require('randomstring');var AWS=require(_0xc981('0x2'));function pollyResult(_0x4b248d,_0xd1b016,_0x2b82f2){return new BPromise(function(_0x59280e,_0x47985e){_0x4b248d[_0xc981('0x3')](_0xd1b016,function(_0x230e5e,_0x22653b){if(_0x230e5e){_0x47985e(_0x230e5e);}else if(_0x22653b){if(_0x22653b[_0xc981('0x4')]instanceof Buffer){fs[_0xc981('0x5')](_0x2b82f2,_0x22653b[_0xc981('0x4')],function(_0x1044e3){if(_0x1044e3){_0x47985e(_0x1044e3);}else{_0x59280e();}});}else{_0x47985e(new Error(_0xc981('0x6')));}}else{_0x47985e(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xc981('0x7')]=function(_0x3c7d70,_0x3be377,_0x20f2b7,_0x5168ba,_0xe6ddc1,_0x57f20b,_0x1385dc){var _0x4609eb=new AWS[(_0xc981('0x8'))]({'accessKeyId':_0x3c7d70,'secretAccessKey':_0x3be377,'region':_0x20f2b7});var _0x224b1f={'Text':_0xe6ddc1,'TextType':_0x57f20b||_0xc981('0x9'),'OutputFormat':_0xc981('0xa'),'VoiceId':_0x5168ba};return pollyResult(_0x4609eb,_0x224b1f,_0x1385dc);}; \ No newline at end of file +var _0xb8d6=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','bluebird','randomstring','aws-sdk','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x3f6600,_0x15e657){var _0x492aa2=function(_0x374f51){while(--_0x374f51){_0x3f6600['push'](_0x3f6600['shift']());}};_0x492aa2(++_0x15e657);}(_0xb8d6,0x1d3));var _0x6b8d=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xb8d6[_0xa1e3e3];return _0xc980e9;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x6b8d('0x0'));var rs=require(_0x6b8d('0x1'));var AWS=require(_0x6b8d('0x2'));function pollyResult(_0x5a55f2,_0xce15a7,_0x205e20){return new BPromise(function(_0x415c27,_0x291f06){_0x5a55f2['synthesizeSpeech'](_0xce15a7,function(_0x1e8b77,_0x5ba55d){if(_0x1e8b77){_0x291f06(_0x1e8b77);}else if(_0x5ba55d){if(_0x5ba55d['AudioStream']instanceof Buffer){fs[_0x6b8d('0x3')](_0x205e20,_0x5ba55d[_0x6b8d('0x4')],function(_0x24fc20){if(_0x24fc20){_0x291f06(_0x24fc20);}else{_0x415c27();}});}else{_0x291f06(new Error(_0x6b8d('0x5')));}}else{_0x291f06(new Error(_0x6b8d('0x6')));}});});}module[_0x6b8d('0x7')]=function(_0x5c7bf7,_0x389e60,_0x35ecd7,_0x3b2d9e,_0x213820,_0x3c5ebb,_0x317f96){var _0x368efe=new AWS[(_0x6b8d('0x8'))]({'accessKeyId':_0x5c7bf7,'secretAccessKey':_0x389e60,'region':_0x35ecd7});var _0x3453bd={'Text':_0x213820,'TextType':_0x3c5ebb||_0x6b8d('0x9'),'OutputFormat':_0x6b8d('0xa'),'VoiceId':_0x3b2d9e};return pollyResult(_0x368efe,_0x3453bd,_0x317f96);}; \ 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 e946f09..8b591e5 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 _0x0558=['./lib/api','exports'];(function(_0x24fe4d,_0x2b111a){var _0x26197a=function(_0x12ba3c){while(--_0x12ba3c){_0x24fe4d['push'](_0x24fe4d['shift']());}};_0x26197a(++_0x2b111a);}(_0x0558,0xa4));var _0x8055=function(_0x541260,_0x4c7f2e){_0x541260=_0x541260-0x0;var _0x1dd2b5=_0x0558[_0x541260];return _0x1dd2b5;};'use strict';var asr=require(_0x8055('0x0'));module[_0x8055('0x1')]=function(_0xc8d8c,_0x360d86,_0x55a4ac,_0x2b2df9){return asr(_0xc8d8c,_0x360d86,_0x55a4ac);}; \ No newline at end of file +var _0x5052=['exports','./lib/api'];(function(_0x381eec,_0x1012a0){var _0x2168c1=function(_0xc2769c){while(--_0xc2769c){_0x381eec['push'](_0x381eec['shift']());}};_0x2168c1(++_0x1012a0);}(_0x5052,0x8d));var _0x2505=function(_0x2e34cc,_0x41c060){_0x2e34cc=_0x2e34cc-0x0;var _0x2abce6=_0x5052[_0x2e34cc];return _0x2abce6;};'use strict';var asr=require(_0x2505('0x0'));module[_0x2505('0x1')]=function(_0x439f08,_0x31053d,_0x3ab1ad,_0x4bee7f){return asr(_0x439f08,_0x31053d,_0x3ab1ad);}; \ 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 130694f..27d0e3c 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 _0xd691=['readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0xd691,0xe6));var _0x1d69=function(_0x44d809,_0x1f76fb){_0x44d809=_0x44d809-0x0;var _0x5361b9=_0xd691[_0x44d809];return _0x5361b9;};'use strict';var url=require(_0x1d69('0x0'));var BPromise=require(_0x1d69('0x1'));var fs=require('fs');var host=_0x1d69('0x2');module['exports']=function(_0x468419,_0x44899f,_0x32502d){return new BPromise(function(_0x3dc1c9,_0x1fbb5e){var _0x2228be;if(typeof _0x468419!==_0x1d69('0x3')||_0x468419[_0x1d69('0x4')]===0x0){return _0x1fbb5e(_0x1d69('0x5'));}if(typeof _0x44899f!==_0x1d69('0x3')||_0x44899f['length']===0x0){return _0x1fbb5e('key\x20should\x20be\x20a\x20string');}if(typeof _0x32502d!==_0x1d69('0x6')&&(typeof _0x32502d!=='string'||_0x32502d[_0x1d69('0x4')]===0x0)){return _0x1fbb5e(_0x1d69('0x7'));}try{_0x2228be=fs[_0x1d69('0x8')](_0x468419)[_0x1d69('0x9')]('base64');}catch(_0x298c17){return _0x1fbb5e(_0x298c17);}return _0x3dc1c9({'method':_0x1d69('0xa'),'uri':host+_0x1d69('0xb')+_0x44899f,'body':{'config':{'encoding':_0x1d69('0xc'),'sampleRateHertz':_0x1d69('0xd'),'languageCode':_0x32502d},'audio':{'content':_0x2228be}},'json':!![]});});}; \ No newline at end of file +var _0xd52a=['LINEAR16','8000','bluebird','exports','string','length','undefined','lang\x20should\x20be\x20a\x20string','toString','/v1/speech:recognize?key='];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd52a,0xca));var _0xad52=function(_0x11e5d2,_0xb3d282){_0x11e5d2=_0x11e5d2-0x0;var _0x4888df=_0xd52a[_0x11e5d2];return _0x4888df;};'use strict';var url=require('url');var BPromise=require(_0xad52('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xad52('0x1')]=function(_0x7b9789,_0x30b335,_0x572592){return new BPromise(function(_0x3f4207,_0x383c44){var _0x130d6d;if(typeof _0x7b9789!==_0xad52('0x2')||_0x7b9789['length']===0x0){return _0x383c44('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x30b335!=='string'||_0x30b335[_0xad52('0x3')]===0x0){return _0x383c44('key\x20should\x20be\x20a\x20string');}if(typeof _0x572592!==_0xad52('0x4')&&(typeof _0x572592!=='string'||_0x572592[_0xad52('0x3')]===0x0)){return _0x383c44(_0xad52('0x5'));}try{_0x130d6d=fs['readFileSync'](_0x7b9789)[_0xad52('0x6')]('base64');}catch(_0x46fbc5){return _0x383c44(_0x46fbc5);}return _0x3f4207({'method':'POST','uri':host+_0xad52('0x7')+_0x30b335,'body':{'config':{'encoding':_0xad52('0x8'),'sampleRateHertz':_0xad52('0x9'),'languageCode':_0x572592},'audio':{'content':_0x130d6d}},'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 dbc31ce..13c2021 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 _0xfc52=['exports'];(function(_0x3879f5,_0x5b4fe8){var _0x27ee90=function(_0x46484a){while(--_0x46484a){_0x3879f5['push'](_0x3879f5['shift']());}};_0x27ee90(++_0x5b4fe8);}(_0xfc52,0xe7));var _0x2fc5=function(_0x148250,_0x2b8bcb){_0x148250=_0x148250-0x0;var _0x5c8521=_0xfc52[_0x148250];return _0x5c8521;};var asr=require('./asr');module[_0x2fc5('0x0')]={'asr':asr}; \ No newline at end of file +var _0x0e14=['./asr','exports'];(function(_0x55b62d,_0x35974b){var _0x225597=function(_0x42541b){while(--_0x42541b){_0x55b62d['push'](_0x55b62d['shift']());}};_0x225597(++_0x35974b);}(_0x0e14,0xea));var _0x40e1=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x0e14[_0x3b5250];return _0xc844a1;};var asr=require(_0x40e1('0x0'));module[_0x40e1('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 19846ce..6b07fe1 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 _0x745d=['tmp','generate','.wav','then','777','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','catch','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','status','code','metadata','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','diagnosticInfo','queryResult','fields','name','displayName','languageCode','queryText','responseId','intentDetectionConfidence','asr','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','path','request-promise','randomstring','google-tts-api','url','parse','util','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','close','unlink','download\x20error','pipe','end','data','wav','start','resolve'];(function(_0x26742c,_0xe241ee){var _0x4d9df4=function(_0x5bf307){while(--_0x5bf307){_0x26742c['push'](_0x26742c['shift']());}};_0x4d9df4(++_0xe241ee);}(_0x745d,0x16a));var _0xd745=function(_0x3bb6a1,_0x225a3e){_0x3bb6a1=_0x3bb6a1-0x0;var _0x404a16=_0x745d[_0x3bb6a1];return _0x404a16;};'use strict';var apiai=require(_0xd745('0x0'));var BPromise=require(_0xd745('0x1'));var dialogflow=require(_0xd745('0x2'));var fs=require('fs');var http=require(_0xd745('0x3'));var https=require(_0xd745('0x4'));var md5=require(_0xd745('0x5'));var path=require(_0xd745('0x6'));var querystring=require('querystring');var rp=require(_0xd745('0x7'));var rs=require(_0xd745('0x8'));var sox=require('sox');var tts=require(_0xd745('0x9'));var urlParse=require(_0xd745('0xa'))[_0xd745('0xb')];var util=require(_0xd745('0xc'));var aws=require('./aws');var google=require(_0xd745('0xd'));var sestek=require(_0xd745('0xe'));var tilde=require(_0xd745('0xf'));var logger=require(_0xd745('0x10'))(_0xd745('0x11'));var ISPEECH_API=_0xd745('0x12');function downloadFile(_0x7e2fa3,_0x11bad5){return new BPromise(function(_0x50dccb,_0x5d7202){var _0x76c217=urlParse(_0x7e2fa3);var _0x3e7d8f=_0x76c217[_0xd745('0x13')]===_0xd745('0x14')?https:http;var _0x323f2d={'host':_0x76c217[_0xd745('0x15')],'path':_0x76c217[_0xd745('0x6')],'headers':{'user-agent':_0xd745('0x16')}};_0x3e7d8f[_0xd745('0x17')](_0x323f2d,function(_0x1a9918){if(_0x1a9918[_0xd745('0x18')]!==0xc8){logger[_0xd745('0x19')](_0xd745('0x1a')+_0x7e2fa3+_0xd745('0x1b')+_0x1a9918[_0xd745('0x18')]+'\x20('+_0x1a9918['statusMessage']+')');_0x5d7202(new Error(_0xd745('0x1a')+_0x7e2fa3+_0xd745('0x1b')+_0x1a9918[_0xd745('0x18')]+'\x20('+_0x1a9918[_0xd745('0x1c')]+')'));return;}var _0x45b3b6=fs['createWriteStream'](_0x11bad5);_0x45b3b6['on'](_0xd745('0x1d'),function(){logger[_0xd745('0x1e')]('finish\x20download\x20file');_0x45b3b6[_0xd745('0x1f')](_0x50dccb);});_0x45b3b6['on'](_0xd745('0x19'),function(_0x5d7e70){fs[_0xd745('0x20')](_0x11bad5);logger['error'](_0xd745('0x21'),_0x5d7e70);_0x5d7202(_0x5d7e70);});_0x1a9918[_0xd745('0x22')](_0x45b3b6);})['on'](_0xd745('0x19'),function(_0xe114df){logger[_0xd745('0x19')](_0xe114df);_0x5d7202(_0xe114df);})[_0xd745('0x23')]();});}function uploadFile(_0x3b3b2a){return new BPromise(function(_0x11a82e,_0x23cf5e){var _0x622c3e=urlParse(_0x3b3b2a);var _0xd91295=_0x622c3e[_0xd745('0x13')]===_0xd745('0x14')?https:http;var _0x410b67={'host':_0x622c3e[_0xd745('0x15')],'path':_0x622c3e[_0xd745('0x6')],'headers':{'user-agent':_0xd745('0x16')}};_0xd91295[_0xd745('0x17')](_0x410b67,function(_0x48b1d2){if(_0x48b1d2[_0xd745('0x18')]!==0xc8){_0x23cf5e(new Error(_0xd745('0x1a')+_0x3b3b2a+_0xd745('0x1b')+_0x48b1d2[_0xd745('0x18')]+'\x20('+_0x48b1d2[_0xd745('0x1c')]+')'));return;}var _0x2eaccf='';_0x48b1d2['on'](_0xd745('0x24'),function(_0x909c46){_0x2eaccf+=_0x909c46;});_0x48b1d2['on'](_0xd745('0x23'),function(){_0x11a82e(_0x2eaccf);});})['on'](_0xd745('0x19'),function(_0x151f19){_0x23cf5e(_0x151f19);})[_0xd745('0x23')]();});}function convertFile(_0x20128e,_0x20ca46){return new BPromise(function(_0x5e8f38,_0x4dd4a5){var _0x2806a5=sox['transcode'](_0x20128e,_0x20ca46,{'sampleRate':0x1f40,'format':_0xd745('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2806a5['on'](_0xd745('0x19'),function(_0x39eb23){logger[_0xd745('0x19')]('error\x20convert',_0x39eb23);_0x4dd4a5(_0x39eb23);});_0x2806a5['on'](_0xd745('0x23'),function(){logger['info']('finish\x20to\x20convert');_0x5e8f38();});_0x2806a5[_0xd745('0x26')]();});}function base64Decode(_0x57714e,_0x37d7f5){var _0x499d1a=path[_0xd745('0x27')](__dirname,_0xd745('0x28'),rs[_0xd745('0x29')](0x4)+_0xd745('0x2a'));fs['writeFileSync'](_0x499d1a,_0x57714e,'base64');return convertFile(_0x499d1a,_0x37d7f5)[_0xd745('0x2b')](function(){try{fs['unlink'](_0x499d1a);fs['chmodSync'](_0x37d7f5,_0xd745('0x2c'));}catch(_0x3fe6dc){logger[_0xd745('0x19')](_0x3fe6dc);}return _0x37d7f5[_0xd745('0x2d')]('.')[0x0];});}function base64Encode(_0x597372){var _0x21831a=fs[_0xd745('0x2e')](_0x597372);return new Buffer(_0x21831a)[_0xd745('0x2f')](_0xd745('0x30'));}exports[_0xd745('0x31')]=function(_0x3d6db6,_0x292b58,_0x306c0e,_0x268115,_0x1e5f14,_0x22164a){var _0x3b36cd,_0x4f54b6;var _0x358fdc=_0xd745('0x32');var _0x3db6b4=_0xd745('0x33')+_0x3d6db6;var _0x5c437b={};if(_0x292b58===_0xd745('0x34')){_0x5c437b['input']={'ssml':_0x306c0e};}else{_0x5c437b[_0xd745('0x35')]={'text':_0x306c0e};};_0x5c437b[_0xd745('0x36')]={'languageCode':_0x268115,'ssmlGender':_0x1e5f14};_0x5c437b[_0xd745('0x37')]={'audioEncoding':_0xd745('0x38'),'sampleRateHertz':0x1f40};var _0xccef3c={'url':_0x358fdc+_0xd745('0x39')+_0x3db6b4,'method':_0xd745('0x3a'),'json':!![],'body':_0x5c437b};return rp(_0xccef3c)[_0xd745('0x2b')](function(_0x49f8f7){return new BPromise(function(_0x4b18f2,_0x1c2dee){_0x3b36cd=path[_0xd745('0x27')](__dirname,_0xd745('0x28'),rs[_0xd745('0x29')](0x4)+_0xd745('0x3b'));var _0x28317e=Buffer['from'](_0x49f8f7[_0xd745('0x3c')],_0xd745('0x30'));return fs[_0xd745('0x3d')](_0x3b36cd,_0x28317e,function(_0x80cf3b){_0x1c2dee(_0x80cf3b);},function(_0x5385ad){fs[_0xd745('0x3e')](_0x3b36cd,_0xd745('0x2c'));_0x4b18f2(_0x5385ad);});});})['then'](function(_0x664fc6){_0x4f54b6=path[_0xd745('0x27')](__dirname,_0xd745('0x28'),rs[_0xd745('0x29')](0x4)+_0xd745('0x2a'));return convertFile(_0x3b36cd,_0x4f54b6);})[_0xd745('0x2b')](function(){try{fs[_0xd745('0x20')](_0x3b36cd);fs['chmodSync'](_0x4f54b6,_0xd745('0x2c'));}catch(_0x4c8180){logger[_0xd745('0x19')](_0x4c8180);}logger[_0xd745('0x1e')](_0xd745('0x3f'),_0x4f54b6[_0xd745('0x2d')]('.')[0x0]);return _0x4f54b6['split']('.')[0x0];});};exports['googleTTS']=function(_0x326968,_0x447de1){var _0x1e0f38=_0xd745('0x40');var _0x25fe28,_0x153ef6;var _0x119f1d;var _0x46fafa={'encoding':_0xd745('0x41'),'method':'POST','timeout':0x2710,'url':_0x1e0f38,'headers':{'Content-Type':_0xd745('0x42')},'body':_0xd745('0x43')+encodeURIComponent(JSON[_0xd745('0x44')]([[[_0xd745('0x45'),JSON['stringify']([_0x326968,_0x447de1||'en',![],_0xd745('0x46')]),null,_0xd745('0x47')]]]))};return rp(_0x46fafa)['then'](function(_0x338fdd){try{_0x119f1d=eval(_0x338fdd['slice'](0x5))[0x0][0x2];}catch(_0x591e69){throw new Error('parse\x20response\x20failed:\x0a'+_0x338fdd[_0xd745('0x24')]);}if(!_0x119f1d){if(_0x326968[_0xd745('0x48')]>0xc8){throw new Error(_0xd745('0x49'));}else{throw new Error(_0xd745('0x4a')+_0x447de1+_0xd745('0x4b'));}}try{_0x119f1d=eval(_0x119f1d)[0x0];}catch(_0x4469bd){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xd745('0x24')]);}const _0x1b75d0=_0x119f1d;_0x25fe28=path[_0xd745('0x27')](__dirname,_0xd745('0x28'),rs['generate'](0x4)+'.mp3');fs['writeFileSync'](_0x25fe28,_0x119f1d,{'encoding':'base64'});_0x153ef6=path[_0xd745('0x27')](__dirname,_0xd745('0x28'),rs[_0xd745('0x29')](0x4)+_0xd745('0x2a'));return convertFile(_0x25fe28,_0x153ef6);})[_0xd745('0x2b')](function(){try{fs[_0xd745('0x20')](_0x25fe28);fs['chmodSync'](_0x153ef6,_0xd745('0x2c'));}catch(_0x366a79){logger[_0xd745('0x19')](_0x366a79);}logger[_0xd745('0x1e')](_0xd745('0x4c'),_0x153ef6[_0xd745('0x2d')]('.')[0x0]);return _0x153ef6[_0xd745('0x2d')]('.')[0x0];});};exports[_0xd745('0x4d')]=function(_0x4439ee,_0x3dbe89,_0x27877b){return google['asr'](_0x4439ee,_0x3dbe89,_0x27877b)[_0xd745('0x2b')](function(_0x1b6fcf){logger['info'](_0x1b6fcf['uri']);return rp(_0x1b6fcf);})['then'](function(_0x2b9d0f){var _0x39943e='';var _0x39d4be=0x0;try{fs['unlink'](_0x4439ee);}catch(_0x504ea8){logger['error'](_0x504ea8);}if(_0x2b9d0f&&_0x2b9d0f[_0xd745('0x4e')]){_0x39943e=_0x2b9d0f[_0xd745('0x4e')]['map'](function(_0x5b87b2){return _0x5b87b2&&_0x5b87b2[_0xd745('0x4f')][0x0]&&_0x5b87b2[_0xd745('0x4f')][0x0][_0xd745('0x50')]?_0x5b87b2[_0xd745('0x4f')][0x0]['transcript']:'';})[_0xd745('0x51')]('\x0a');_0x39d4be=_0x2b9d0f[_0xd745('0x4e')][_0xd745('0x52')](function(_0x8bd546){return _0x8bd546&&_0x8bd546[_0xd745('0x4f')][0x0]&&_0x8bd546[_0xd745('0x4f')][0x0][_0xd745('0x53')]?_0x8bd546[_0xd745('0x4f')][0x0][_0xd745('0x53')]:0x0;})[_0xd745('0x51')]('\x0a');}logger[_0xd745('0x1e')](_0xd745('0x54'),_0x39943e);logger[_0xd745('0x1e')]('googleASR\x20confidence',_0x39d4be);return{'transcript':_0x39943e,'confidence':_0x39d4be};})[_0xd745('0x55')](function(_0x2630ed){logger['error']('[%s]\x20%s:%s',_0x2630ed[_0xd745('0x18')],_0x2630ed['name'],_0x2630ed[_0xd745('0x56')]);});};exports[_0xd745('0x57')]=function(_0x2280cb,_0x13cad6,_0x48f824,_0x493271){var _0x508ecc=apiai(_0x13cad6,{'language':_0x493271||'en'});return _0x508ecc[_0xd745('0x58')](_0x48f824,{'sessionId':md5(_0x2280cb)})[_0xd745('0x2b')](function(_0xa14353){logger[_0xd745('0x1e')](JSON[_0xd745('0x44')](_0xa14353));return{'source':_0xa14353[_0xd745('0x59')][_0xd745('0x5a')],'resolvedQuery':_0xa14353['result'][_0xd745('0x5b')],'action':_0xa14353[_0xd745('0x59')][_0xd745('0x5c')],'actionIncomplete':_0xa14353['result'][_0xd745('0x5d')],'speech':_0xa14353[_0xd745('0x59')][_0xd745('0x5e')][_0xd745('0x5f')],'score':_0xa14353[_0xd745('0x59')]['score'],'statusCode':_0xa14353[_0xd745('0x60')][_0xd745('0x61')],'endConversation':_0xa14353[_0xd745('0x59')][_0xd745('0x62')]['endConversation']||![],'isFallbackIntent':_0xa14353['result']['metadata'][_0xd745('0x63')]};});};exports['googleDialogflowV2']=function(_0x17ccbf,_0x388bbf,_0x134132,_0x4f7ba8,_0x459184,_0x2d610e){var _0x5180c0=_0x4f7ba8[_0xd745('0x64')](/\\n/g,'\x0a');var _0x22add2={'credentials':{'private_key':_0x5180c0,'client_email':_0x134132}};var _0x5ec7f6=new dialogflow[(_0xd745('0x65'))](_0x22add2);var _0xd8049e=_0x5ec7f6[_0xd745('0x66')](_0x388bbf,md5(_0x17ccbf));var _0x4e992a={'session':_0xd8049e,'queryInput':{'text':{'text':_0x459184,'languageCode':_0x2d610e}}};return _0x5ec7f6[_0xd745('0x67')](_0x4e992a)['then'](function(_0x1e5e42){if(_0x1e5e42&&_0x1e5e42[_0xd745('0x48')]){logger[_0xd745('0x1e')](_0xd745('0x68'),JSON[_0xd745('0x44')](_0x1e5e42));var _0x56cee4=_0x1e5e42[0x0];if(_0x56cee4){var _0x3f2a7a={'action':_0x56cee4['queryResult'][_0xd745('0x5c')],'allRequiredParamsPresent':_0x56cee4['queryResult'][_0xd745('0x69')],'endConversation':_0x56cee4['queryResult'][_0xd745('0x6a')]&&_0x56cee4[_0xd745('0x6b')][_0xd745('0x6a')]['fields']?_0x56cee4[_0xd745('0x6b')][_0xd745('0x6a')][_0xd745('0x6c')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x56cee4[_0xd745('0x6b')]['fulfillmentText'],'intentName':_0x56cee4[_0xd745('0x6b')]['intent'][_0xd745('0x6d')],'intentDisplayName':_0x56cee4['queryResult']['intent'][_0xd745('0x6e')],'isFallbackIntent':_0x56cee4[_0xd745('0x6b')]['intent']['isFallback'],'languageCode':_0x56cee4[_0xd745('0x6b')][_0xd745('0x6f')],'queryText':_0x56cee4[_0xd745('0x6b')][_0xd745('0x70')],'responseId':_0x56cee4[_0xd745('0x71')],'score':_0x56cee4['queryResult'][_0xd745('0x72')],'speech':_0x56cee4[_0xd745('0x6b')]['fulfillmentText'],'providerResponse':JSON[_0xd745('0x44')](_0x1e5e42)};return _0x3f2a7a;}}});};exports['tildeASR']=function(_0x5b3cf4,_0x584bdc,_0x2a5f64,_0x321c0b){return tilde[_0xd745('0x73')](_0x5b3cf4,_0x584bdc,_0x2a5f64,_0x321c0b)['then'](function(_0x39c040){try{fs[_0xd745('0x20')](_0x5b3cf4);}catch(_0x1223b8){logger[_0xd745('0x19')](_0x1223b8);}logger[_0xd745('0x1e')]('Tilde\x20ASR\x20transcription',_0x39c040[_0xd745('0x50')]);logger[_0xd745('0x1e')](_0xd745('0x74'),_0x39c040[_0xd745('0x53')]);return _0x39c040;});};exports[_0xd745('0x75')]=function(_0x39a047,_0x455a0c,_0x44d9e4,_0x47096b,_0x178e20,_0x36f9a7){var _0x14bfac=path[_0xd745('0x27')](__dirname,_0xd745('0x28'),rs['generate'](0x4)+_0xd745('0x3b'));var _0x509ea6;return aws[_0xd745('0x76')](_0x39a047,_0x455a0c,_0x44d9e4,_0x47096b,_0x178e20,_0x36f9a7,_0x14bfac)[_0xd745('0x2b')](function(){_0x509ea6=path['resolve'](__dirname,_0xd745('0x28'),rs[_0xd745('0x29')](0x4)+_0xd745('0x2a'));return convertFile(_0x14bfac,_0x509ea6);})[_0xd745('0x2b')](function(){try{fs['unlink'](_0x14bfac);fs['chmodSync'](_0x509ea6,'777');}catch(_0x4c26f4){logger[_0xd745('0x19')](_0x4c26f4);}return _0x509ea6[_0xd745('0x2d')]('.')[0x0];});};exports[_0xd745('0x77')]=function(_0x2c90aa,_0x4f1532,_0x5b8961,_0x441426,_0x1dec4c,_0x4e85c0){return aws[_0xd745('0x78')](_0x2c90aa,_0x4f1532,_0x5b8961,_0x441426,_0x1dec4c,_0x4e85c0)[_0xd745('0x2b')](function(_0x35f946){logger[_0xd745('0x1e')](JSON['stringify'](_0x35f946));return _0x35f946;});};exports['ispeechTTS']=function(_0x5f2936,_0x183a14,_0x692027,_0x532614){var _0x1dbcf6=util['format'](_0xd745('0x79'),ISPEECH_API,_0x5f2936,encodeURIComponent(_0x183a14),_0x692027,_0x532614);var _0x2520b1=path[_0xd745('0x27')](__dirname,_0xd745('0x28'),rs[_0xd745('0x29')](0x4)+'.mp3');var _0xe01179;return downloadFile(_0x1dbcf6,_0x2520b1)[_0xd745('0x2b')](function(){_0xe01179=path[_0xd745('0x27')](__dirname,'tmp',rs[_0xd745('0x29')](0x4)+'.wav');return convertFile(_0x2520b1,_0xe01179);})[_0xd745('0x2b')](function(){try{fs[_0xd745('0x20')](_0x2520b1);fs[_0xd745('0x3e')](_0xe01179,'777');}catch(_0x5da5f8){logger['error'](_0x5da5f8);}return _0xe01179[_0xd745('0x2d')]('.')[0x0];});};exports[_0xd745('0x7a')]=function(_0x12deba,_0xedc5ab,_0x279dcb,_0x57a226){var _0x21a484=util[_0xd745('0x7b')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0xedc5ab,_0x279dcb,base64Encode(_0x12deba),_0x57a226?util[_0xd745('0x7b')](_0xd745('0x7c'),encodeURIComponent(_0x57a226)):_0xd745('0x7d'));return uploadFile(_0x21a484)[_0xd745('0x2b')](function(_0x39f73e){return querystring[_0xd745('0xb')](_0x39f73e);});};exports[_0xd745('0x7e')]=function(_0x1fc660,_0x57d90c){return sestek[_0xd745('0x7f')](_0x1fc660,_0x57d90c)['then'](function(_0x504bee){logger['info'](JSON['stringify'](_0x504bee));var _0x45c0b0={'speech':_0x504bee[_0xd745('0x80')],'action':_0x504bee[_0xd745('0x81')]?_0x504bee[_0xd745('0x81')]['CustomAction']:undefined,'actiondata':_0x504bee['channelData']?_0x504bee['channelData'][_0xd745('0x82')]:undefined};if(_0x504bee[_0xd745('0x81')]&&_0x504bee[_0xd745('0x81')]['AudioFromTts']){return base64Decode(_0x504bee['channelData'][_0xd745('0x83')][_0xd745('0x84')],path['resolve'](__dirname,_0xd745('0x28'),rs[_0xd745('0x29')](0x4)+'.wav'))[_0xd745('0x2b')](function(_0x1eb329){_0x45c0b0[_0xd745('0x85')]=_0x1eb329;return _0x45c0b0;});}return _0x45c0b0;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xd2d7=['uri','results','alternatives','transcript','join','map','confidence','catch','[%s]\x20%s:%s','name','message','result','source','resolvedQuery','action','actionIncomplete','fulfillment','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20confidence','polly','awsLex','lex','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','request-promise','url','parse','util','./aws','./google','./sestek','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','download\x20error','pipe','host','data','end','wav','error\x20convert','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','https://texttospeech.googleapis.com/v1/','?key=','ssml','voice','audioConfig','MP3','text:synthesize','tmp','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr'];(function(_0xac439e,_0x561182){var _0x1c8480=function(_0x3375e5){while(--_0x3375e5){_0xac439e['push'](_0xac439e['shift']());}};_0x1c8480(++_0x561182);}(_0xd2d7,0x14c));var _0x7d2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2d7[_0x3dd15e];return _0x231fd0;};'use strict';var apiai=require(_0x7d2d('0x0'));var BPromise=require(_0x7d2d('0x1'));var dialogflow=require(_0x7d2d('0x2'));var fs=require('fs');var http=require(_0x7d2d('0x3'));var https=require(_0x7d2d('0x4'));var md5=require(_0x7d2d('0x5'));var path=require(_0x7d2d('0x6'));var querystring=require('querystring');var rp=require(_0x7d2d('0x7'));var rs=require('randomstring');var sox=require('sox');var tts=require('google-tts-api');var urlParse=require(_0x7d2d('0x8'))[_0x7d2d('0x9')];var util=require(_0x7d2d('0xa'));var aws=require(_0x7d2d('0xb'));var google=require(_0x7d2d('0xc'));var sestek=require(_0x7d2d('0xd'));var tilde=require('./tilde');var logger=require('../../../config/logger')(_0x7d2d('0xe'));var ISPEECH_API=_0x7d2d('0xf');function downloadFile(_0x5df86b,_0xf720a4){return new BPromise(function(_0x20cc83,_0x5574d8){var _0x3b8500=urlParse(_0x5df86b);var _0x4f2df5=_0x3b8500[_0x7d2d('0x10')]===_0x7d2d('0x11')?https:http;var _0xd39bca={'host':_0x3b8500['host'],'path':_0x3b8500[_0x7d2d('0x6')],'headers':{'user-agent':_0x7d2d('0x12')}};_0x4f2df5[_0x7d2d('0x13')](_0xd39bca,function(_0x5ada94){if(_0x5ada94[_0x7d2d('0x14')]!==0xc8){logger[_0x7d2d('0x15')]('request\x20to\x20'+_0x5df86b+'\x20failed,\x20status\x20code\x20=\x20'+_0x5ada94[_0x7d2d('0x14')]+'\x20('+_0x5ada94['statusMessage']+')');_0x5574d8(new Error(_0x7d2d('0x16')+_0x5df86b+_0x7d2d('0x17')+_0x5ada94[_0x7d2d('0x14')]+'\x20('+_0x5ada94[_0x7d2d('0x18')]+')'));return;}var _0x49c0f8=fs[_0x7d2d('0x19')](_0xf720a4);_0x49c0f8['on'](_0x7d2d('0x1a'),function(){logger[_0x7d2d('0x1b')](_0x7d2d('0x1c'));_0x49c0f8['close'](_0x20cc83);});_0x49c0f8['on']('error',function(_0x339068){fs[_0x7d2d('0x1d')](_0xf720a4);logger[_0x7d2d('0x15')](_0x7d2d('0x1e'),_0x339068);_0x5574d8(_0x339068);});_0x5ada94[_0x7d2d('0x1f')](_0x49c0f8);})['on'](_0x7d2d('0x15'),function(_0x469041){logger['error'](_0x469041);_0x5574d8(_0x469041);})['end']();});}function uploadFile(_0x32a061){return new BPromise(function(_0x1c7367,_0x373551){var _0x4b498f=urlParse(_0x32a061);var _0x4845cf=_0x4b498f[_0x7d2d('0x10')]==='https:'?https:http;var _0x2955dc={'host':_0x4b498f[_0x7d2d('0x20')],'path':_0x4b498f[_0x7d2d('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x4845cf[_0x7d2d('0x13')](_0x2955dc,function(_0x43710c){if(_0x43710c[_0x7d2d('0x14')]!==0xc8){_0x373551(new Error('request\x20to\x20'+_0x32a061+_0x7d2d('0x17')+_0x43710c[_0x7d2d('0x14')]+'\x20('+_0x43710c['statusMessage']+')'));return;}var _0x4ec267='';_0x43710c['on'](_0x7d2d('0x21'),function(_0x46c5c1){_0x4ec267+=_0x46c5c1;});_0x43710c['on']('end',function(){_0x1c7367(_0x4ec267);});})['on']('error',function(_0x565fe6){_0x373551(_0x565fe6);})[_0x7d2d('0x22')]();});}function convertFile(_0x6d1000,_0x2704ba){return new BPromise(function(_0x5a5a22,_0x5c173c){var _0x1a920c=sox['transcode'](_0x6d1000,_0x2704ba,{'sampleRate':0x1f40,'format':_0x7d2d('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1a920c['on']('error',function(_0x2a9d1f){logger['error'](_0x7d2d('0x24'),_0x2a9d1f);_0x5c173c(_0x2a9d1f);});_0x1a920c['on']('end',function(){logger[_0x7d2d('0x1b')](_0x7d2d('0x25'));_0x5a5a22();});_0x1a920c[_0x7d2d('0x26')]();});}function base64Decode(_0x1f72d9,_0x221b1){var _0x457b20=path[_0x7d2d('0x27')](__dirname,'tmp',rs[_0x7d2d('0x28')](0x4)+_0x7d2d('0x29'));fs[_0x7d2d('0x2a')](_0x457b20,_0x1f72d9,_0x7d2d('0x2b'));return convertFile(_0x457b20,_0x221b1)[_0x7d2d('0x2c')](function(){try{fs['unlink'](_0x457b20);fs[_0x7d2d('0x2d')](_0x221b1,_0x7d2d('0x2e'));}catch(_0x30fc9e){logger[_0x7d2d('0x15')](_0x30fc9e);}return _0x221b1[_0x7d2d('0x2f')]('.')[0x0];});}function base64Encode(_0xcabf7){var _0x25f740=fs[_0x7d2d('0x30')](_0xcabf7);return new Buffer(_0x25f740)['toString'](_0x7d2d('0x2b'));}exports['googleCloudTTS']=function(_0x261a20,_0x4e8e82,_0x36a97a,_0x6b1411,_0x4cf51a,_0x5ca740){var _0x471704,_0xf81e93;var _0x2da716=_0x7d2d('0x31');var _0x277edd=_0x7d2d('0x32')+_0x261a20;var _0x426f2a={};if(_0x4e8e82===_0x7d2d('0x33')){_0x426f2a['input']={'ssml':_0x36a97a};}else{_0x426f2a['input']={'text':_0x36a97a};};_0x426f2a[_0x7d2d('0x34')]={'languageCode':_0x6b1411,'ssmlGender':_0x4cf51a};_0x426f2a[_0x7d2d('0x35')]={'audioEncoding':_0x7d2d('0x36'),'sampleRateHertz':0x1f40};var _0xe4ca72={'url':_0x2da716+_0x7d2d('0x37')+_0x277edd,'method':'POST','json':!![],'body':_0x426f2a};return rp(_0xe4ca72)[_0x7d2d('0x2c')](function(_0x1f4215){return new BPromise(function(_0xed99b1,_0x4650aa){_0x471704=path[_0x7d2d('0x27')](__dirname,_0x7d2d('0x38'),rs['generate'](0x4)+_0x7d2d('0x39'));var _0x1eb0c4=Buffer[_0x7d2d('0x3a')](_0x1f4215[_0x7d2d('0x3b')],_0x7d2d('0x2b'));return fs[_0x7d2d('0x3c')](_0x471704,_0x1eb0c4,function(_0x36a72d){_0x4650aa(_0x36a72d);},function(_0x515211){fs[_0x7d2d('0x2d')](_0x471704,_0x7d2d('0x2e'));_0xed99b1(_0x515211);});});})[_0x7d2d('0x2c')](function(_0x193951){_0xf81e93=path[_0x7d2d('0x27')](__dirname,_0x7d2d('0x38'),rs[_0x7d2d('0x28')](0x4)+'.wav');return convertFile(_0x471704,_0xf81e93);})[_0x7d2d('0x2c')](function(){try{fs[_0x7d2d('0x1d')](_0x471704);fs[_0x7d2d('0x2d')](_0xf81e93,_0x7d2d('0x2e'));}catch(_0x25789e){logger[_0x7d2d('0x15')](_0x25789e);}logger[_0x7d2d('0x1b')](_0x7d2d('0x3d'),_0xf81e93[_0x7d2d('0x2f')]('.')[0x0]);return _0xf81e93[_0x7d2d('0x2f')]('.')[0x0];});};exports['googleTTS']=function(_0x5190ac,_0x4cea2d){var _0x10e6d7=_0x7d2d('0x3e');var _0x38623e,_0x379612;var _0x2668fb;var _0x38a7e0={'encoding':_0x7d2d('0x3f'),'method':_0x7d2d('0x40'),'timeout':0x2710,'url':_0x10e6d7,'headers':{'Content-Type':_0x7d2d('0x41')},'body':'f.req='+encodeURIComponent(JSON[_0x7d2d('0x42')]([[[_0x7d2d('0x43'),JSON[_0x7d2d('0x42')]([_0x5190ac,_0x4cea2d||'en',![],_0x7d2d('0x44')]),null,_0x7d2d('0x45')]]]))};return rp(_0x38a7e0)[_0x7d2d('0x2c')](function(_0x3da124){try{_0x2668fb=eval(_0x3da124[_0x7d2d('0x46')](0x5))[0x0][0x2];}catch(_0x48ca4a){throw new Error(_0x7d2d('0x47')+_0x3da124[_0x7d2d('0x21')]);}if(!_0x2668fb){if(_0x5190ac[_0x7d2d('0x48')]>0xc8){throw new Error(_0x7d2d('0x49'));}else{throw new Error(_0x7d2d('0x4a')+_0x4cea2d+_0x7d2d('0x4b'));}}try{_0x2668fb=eval(_0x2668fb)[0x0];}catch(_0x17db74){throw new Error(_0x7d2d('0x47')+res['data']);}const _0x3ae00e=_0x2668fb;_0x38623e=path[_0x7d2d('0x27')](__dirname,'tmp',rs[_0x7d2d('0x28')](0x4)+'.mp3');fs['writeFileSync'](_0x38623e,_0x2668fb,{'encoding':_0x7d2d('0x2b')});_0x379612=path[_0x7d2d('0x27')](__dirname,'tmp',rs[_0x7d2d('0x28')](0x4)+'.wav');return convertFile(_0x38623e,_0x379612);})[_0x7d2d('0x2c')](function(){try{fs[_0x7d2d('0x1d')](_0x38623e);fs[_0x7d2d('0x2d')](_0x379612,_0x7d2d('0x2e'));}catch(_0x238226){logger[_0x7d2d('0x15')](_0x238226);}logger[_0x7d2d('0x1b')](_0x7d2d('0x4c'),_0x379612[_0x7d2d('0x2f')]('.')[0x0]);return _0x379612[_0x7d2d('0x2f')]('.')[0x0];});};exports[_0x7d2d('0x4d')]=function(_0x3bf4a1,_0x27936d,_0x5c3c01){return google[_0x7d2d('0x4e')](_0x3bf4a1,_0x27936d,_0x5c3c01)[_0x7d2d('0x2c')](function(_0x35c07f){logger[_0x7d2d('0x1b')](_0x35c07f[_0x7d2d('0x4f')]);return rp(_0x35c07f);})[_0x7d2d('0x2c')](function(_0x211536){var _0xe64b91='';var _0x5b931a=0x0;try{fs[_0x7d2d('0x1d')](_0x3bf4a1);}catch(_0x7e23be){logger[_0x7d2d('0x15')](_0x7e23be);}if(_0x211536&&_0x211536[_0x7d2d('0x50')]){_0xe64b91=_0x211536[_0x7d2d('0x50')]['map'](function(_0xae3a7d){return _0xae3a7d&&_0xae3a7d['alternatives'][0x0]&&_0xae3a7d[_0x7d2d('0x51')][0x0]['transcript']?_0xae3a7d['alternatives'][0x0][_0x7d2d('0x52')]:'';})[_0x7d2d('0x53')]('\x0a');_0x5b931a=_0x211536['results'][_0x7d2d('0x54')](function(_0x3fc899){return _0x3fc899&&_0x3fc899[_0x7d2d('0x51')][0x0]&&_0x3fc899[_0x7d2d('0x51')][0x0][_0x7d2d('0x55')]?_0x3fc899['alternatives'][0x0]['confidence']:0x0;})[_0x7d2d('0x53')]('\x0a');}logger['info']('googleASR\x20transcription',_0xe64b91);logger['info']('googleASR\x20confidence',_0x5b931a);return{'transcript':_0xe64b91,'confidence':_0x5b931a};})[_0x7d2d('0x56')](function(_0x14764c){logger[_0x7d2d('0x15')](_0x7d2d('0x57'),_0x14764c[_0x7d2d('0x14')],_0x14764c[_0x7d2d('0x58')],_0x14764c[_0x7d2d('0x59')]);});};exports['googleDialogflow']=function(_0x32fbfb,_0x4e0deb,_0x2b74ce,_0x3389f3){var _0x291ff4=apiai(_0x4e0deb,{'language':_0x3389f3||'en'});return _0x291ff4['textRequest'](_0x2b74ce,{'sessionId':md5(_0x32fbfb)})[_0x7d2d('0x2c')](function(_0x324150){logger['info'](JSON[_0x7d2d('0x42')](_0x324150));return{'source':_0x324150[_0x7d2d('0x5a')][_0x7d2d('0x5b')],'resolvedQuery':_0x324150[_0x7d2d('0x5a')][_0x7d2d('0x5c')],'action':_0x324150[_0x7d2d('0x5a')][_0x7d2d('0x5d')],'actionIncomplete':_0x324150['result'][_0x7d2d('0x5e')],'speech':_0x324150[_0x7d2d('0x5a')][_0x7d2d('0x5f')]['speech'],'score':_0x324150[_0x7d2d('0x5a')]['score'],'statusCode':_0x324150[_0x7d2d('0x60')][_0x7d2d('0x61')],'endConversation':_0x324150[_0x7d2d('0x5a')][_0x7d2d('0x62')]['endConversation']||![],'isFallbackIntent':_0x324150[_0x7d2d('0x5a')][_0x7d2d('0x62')][_0x7d2d('0x63')]};});};exports[_0x7d2d('0x64')]=function(_0x36ab97,_0x5ba345,_0x37315f,_0x1d47f9,_0x335231,_0x17ecc3){var _0x1c50c4=_0x1d47f9[_0x7d2d('0x65')](/\\n/g,'\x0a');var _0x28e8f7={'credentials':{'private_key':_0x1c50c4,'client_email':_0x37315f}};var _0x4d525b=new dialogflow[(_0x7d2d('0x66'))](_0x28e8f7);var _0x24bc97=_0x4d525b[_0x7d2d('0x67')](_0x5ba345,md5(_0x36ab97));var _0x2ae3a0={'session':_0x24bc97,'queryInput':{'text':{'text':_0x335231,'languageCode':_0x17ecc3}}};return _0x4d525b[_0x7d2d('0x68')](_0x2ae3a0)['then'](function(_0x475e69){if(_0x475e69&&_0x475e69[_0x7d2d('0x48')]){logger[_0x7d2d('0x1b')](_0x7d2d('0x69'),JSON[_0x7d2d('0x42')](_0x475e69));var _0xb3d60b=_0x475e69[0x0];if(_0xb3d60b){var _0x5a104d={'action':_0xb3d60b[_0x7d2d('0x6a')][_0x7d2d('0x5d')],'allRequiredParamsPresent':_0xb3d60b[_0x7d2d('0x6a')][_0x7d2d('0x6b')],'endConversation':_0xb3d60b['queryResult']['diagnosticInfo']&&_0xb3d60b['queryResult'][_0x7d2d('0x6c')][_0x7d2d('0x6d')]?_0xb3d60b[_0x7d2d('0x6a')][_0x7d2d('0x6c')][_0x7d2d('0x6d')][_0x7d2d('0x6e')][_0x7d2d('0x6f')]:![],'fulfillmentText':_0xb3d60b['queryResult']['fulfillmentText'],'intentName':_0xb3d60b[_0x7d2d('0x6a')][_0x7d2d('0x70')][_0x7d2d('0x58')],'intentDisplayName':_0xb3d60b[_0x7d2d('0x6a')][_0x7d2d('0x70')][_0x7d2d('0x71')],'isFallbackIntent':_0xb3d60b[_0x7d2d('0x6a')][_0x7d2d('0x70')][_0x7d2d('0x72')],'languageCode':_0xb3d60b[_0x7d2d('0x6a')][_0x7d2d('0x73')],'queryText':_0xb3d60b[_0x7d2d('0x6a')][_0x7d2d('0x74')],'responseId':_0xb3d60b['responseId'],'score':_0xb3d60b[_0x7d2d('0x6a')][_0x7d2d('0x75')],'speech':_0xb3d60b[_0x7d2d('0x6a')][_0x7d2d('0x76')],'providerResponse':JSON[_0x7d2d('0x42')](_0x475e69)};return _0x5a104d;}}});};exports[_0x7d2d('0x77')]=function(_0x1022fb,_0x4c27f9,_0x3d9cf1,_0x5bb275){return tilde[_0x7d2d('0x4e')](_0x1022fb,_0x4c27f9,_0x3d9cf1,_0x5bb275)[_0x7d2d('0x2c')](function(_0x3346b3){try{fs[_0x7d2d('0x1d')](_0x1022fb);}catch(_0x277760){logger['error'](_0x277760);}logger['info']('Tilde\x20ASR\x20transcription',_0x3346b3[_0x7d2d('0x52')]);logger['info'](_0x7d2d('0x78'),_0x3346b3[_0x7d2d('0x55')]);return _0x3346b3;});};exports['awsPolly']=function(_0x311a73,_0x26a010,_0x11e9ec,_0x3eab32,_0x44e27b,_0x97f506){var _0xf557ef=path[_0x7d2d('0x27')](__dirname,_0x7d2d('0x38'),rs[_0x7d2d('0x28')](0x4)+_0x7d2d('0x39'));var _0x456676;return aws[_0x7d2d('0x79')](_0x311a73,_0x26a010,_0x11e9ec,_0x3eab32,_0x44e27b,_0x97f506,_0xf557ef)[_0x7d2d('0x2c')](function(){_0x456676=path['resolve'](__dirname,_0x7d2d('0x38'),rs['generate'](0x4)+_0x7d2d('0x29'));return convertFile(_0xf557ef,_0x456676);})[_0x7d2d('0x2c')](function(){try{fs[_0x7d2d('0x1d')](_0xf557ef);fs[_0x7d2d('0x2d')](_0x456676,'777');}catch(_0x301adc){logger['error'](_0x301adc);}return _0x456676['split']('.')[0x0];});};exports[_0x7d2d('0x7a')]=function(_0x2b4954,_0x31cd4d,_0x50c52f,_0x319984,_0x702d6d,_0x596569){return aws[_0x7d2d('0x7b')](_0x2b4954,_0x31cd4d,_0x50c52f,_0x319984,_0x702d6d,_0x596569)[_0x7d2d('0x2c')](function(_0x1142d3){logger[_0x7d2d('0x1b')](JSON['stringify'](_0x1142d3));return _0x1142d3;});};exports['ispeechTTS']=function(_0x27b52d,_0x200150,_0x52c791,_0x2d0e91){var _0x12be4c=util[_0x7d2d('0x7c')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x27b52d,encodeURIComponent(_0x200150),_0x52c791,_0x2d0e91);var _0x47d883=path[_0x7d2d('0x27')](__dirname,'tmp',rs[_0x7d2d('0x28')](0x4)+_0x7d2d('0x39'));var _0x419ace;return downloadFile(_0x12be4c,_0x47d883)[_0x7d2d('0x2c')](function(){_0x419ace=path[_0x7d2d('0x27')](__dirname,_0x7d2d('0x38'),rs[_0x7d2d('0x28')](0x4)+_0x7d2d('0x29'));return convertFile(_0x47d883,_0x419ace);})[_0x7d2d('0x2c')](function(){try{fs[_0x7d2d('0x1d')](_0x47d883);fs['chmodSync'](_0x419ace,_0x7d2d('0x2e'));}catch(_0x3dc59b){logger[_0x7d2d('0x15')](_0x3dc59b);}return _0x419ace[_0x7d2d('0x2f')]('.')[0x0];});};exports[_0x7d2d('0x7d')]=function(_0x33b2df,_0x552761,_0x4d0ef6,_0x1b62f9){var _0x2a22ce=util[_0x7d2d('0x7c')](_0x7d2d('0x7e'),ISPEECH_API,_0x552761,_0x4d0ef6,base64Encode(_0x33b2df),_0x1b62f9?util[_0x7d2d('0x7c')](_0x7d2d('0x7f'),encodeURIComponent(_0x1b62f9)):'freeform=3');return uploadFile(_0x2a22ce)[_0x7d2d('0x2c')](function(_0x2411f1){return querystring[_0x7d2d('0x9')](_0x2411f1);});};exports[_0x7d2d('0x80')]=function(_0x26a9f7,_0x5b4be8){return sestek[_0x7d2d('0x81')](_0x26a9f7,_0x5b4be8)[_0x7d2d('0x2c')](function(_0x404fb4){logger[_0x7d2d('0x1b')](JSON['stringify'](_0x404fb4));var _0x5cad0e={'speech':_0x404fb4[_0x7d2d('0x82')],'action':_0x404fb4[_0x7d2d('0x83')]?_0x404fb4[_0x7d2d('0x83')]['CustomAction']:undefined,'actiondata':_0x404fb4['channelData']?_0x404fb4[_0x7d2d('0x83')][_0x7d2d('0x84')]:undefined};if(_0x404fb4[_0x7d2d('0x83')]&&_0x404fb4[_0x7d2d('0x83')][_0x7d2d('0x85')]){return base64Decode(_0x404fb4[_0x7d2d('0x83')]['AudioFromTts'][_0x7d2d('0x86')],path[_0x7d2d('0x27')](__dirname,_0x7d2d('0x38'),rs[_0x7d2d('0x28')](0x4)+_0x7d2d('0x29')))['then'](function(_0x4387b8){_0x5cad0e[_0x7d2d('0x87')]=_0x4387b8;return _0x5cad0e;});}return _0x5cad0e;});};exports[_0x7d2d('0x88')]=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 8f34e03..eb15c37 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 nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file +var _0xbfc9=['exports'];(function(_0x5d19a8,_0x40d9e5){var _0x25891a=function(_0x44fa72){while(--_0x44fa72){_0x5d19a8['push'](_0x5d19a8['shift']());}};_0x25891a(++_0x40d9e5);}(_0xbfc9,0xd5));var _0x9bfc=function(_0x2337cb,_0x365157){_0x2337cb=_0x2337cb-0x0;var _0x1c127b=_0xbfc9[_0x2337cb];return _0x1c127b;};var nda=require('./nda');module[_0x9bfc('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index e88e4ed..1ebc418 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 _0x21a3=['message','Nda','uniqueid','callerid','dnid','extension','access_token','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','request-promise','../../../../../config/logger','agi','exports','ndauth_url','/token','password','username','then','POST','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x21a3,0x66));var _0x321a=function(_0x27c25f,_0x4ff5fe){_0x27c25f=_0x27c25f-0x0;var _0x2da4c4=_0x21a3[_0x27c25f];return _0x2da4c4;};'use strict';var rp=require(_0x321a('0x0'));var url=require('url');var logger=require(_0x321a('0x1'))(_0x321a('0x2'));module[_0x321a('0x3')]=function(_0x401ef1,_0x3ad15d){var _0x185e2a={'method':'POST','uri':url['resolve'](_0x3ad15d[_0x321a('0x4')],_0x321a('0x5')),'form':{'grant_type':_0x321a('0x6'),'username':_0x3ad15d[_0x321a('0x7')],'password':_0x3ad15d['password']},'json':!![]};return rp(_0x185e2a)[_0x321a('0x8')](function(_0x24a04c){var _0x10c1d3={'method':_0x321a('0x9'),'uri':url[_0x321a('0xa')](_0x3ad15d[_0x321a('0xb')],_0x321a('0xc')),'body':{'type':_0x3ad15d[_0x321a('0xd')]||_0x321a('0xe'),'channelId':_0x321a('0xf'),'conversation':{'id':_0x401ef1[_0x321a('0x10')]},'from':{'id':_0x401ef1[_0x321a('0x11')],'name':_0x401ef1['calleridname']},'recipient':{'id':_0x401ef1[_0x321a('0x12')],'name':_0x401ef1[_0x321a('0x13')]},'text':_0x3ad15d['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x24a04c[_0x321a('0x14')]},'json':!![]};if(_0x3ad15d['project']){_0x10c1d3[_0x321a('0x15')][_0x321a('0x16')]['ProjectName']=_0x3ad15d['project'];}if(_0x3ad15d[_0x321a('0x17')]=='1'){_0x10c1d3[_0x321a('0x15')][_0x321a('0x16')][_0x321a('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x321a('0x19')};}if(_0x3ad15d[_0x321a('0x1a')]){_0x10c1d3[_0x321a('0x15')][_0x321a('0x16')]['CustomAction']=_0x3ad15d[_0x321a('0x1a')];if(_0x3ad15d[_0x321a('0x1b')]){_0x10c1d3['body'][_0x321a('0x16')][_0x321a('0x1c')]=_0x3ad15d[_0x321a('0x1b')];}}logger['info'](JSON['stringify'](_0x10c1d3));return rp(_0x10c1d3);});}; \ No newline at end of file +var _0x8b29=['project','body','channelData','ndagenerate_audio','CustomAction','CustomActionData','custom_action_data','info','request-promise','../../../../../config/logger','agi','resolve','/token','password','username','then','POST','ndassistant_url','message','Nda','uniqueid','callerid','calleridname','dnid','text','Bearer\x20'];(function(_0x27dfd1,_0xb31f12){var _0x31697f=function(_0x114ae3){while(--_0x114ae3){_0x27dfd1['push'](_0x27dfd1['shift']());}};_0x31697f(++_0xb31f12);}(_0x8b29,0xbe));var _0x98b2=function(_0x17d952,_0x5bef11){_0x17d952=_0x17d952-0x0;var _0x375183=_0x8b29[_0x17d952];return _0x375183;};'use strict';var rp=require(_0x98b2('0x0'));var url=require('url');var logger=require(_0x98b2('0x1'))(_0x98b2('0x2'));module['exports']=function(_0x51b66a,_0x2363fe){var _0x20afa9={'method':'POST','uri':url[_0x98b2('0x3')](_0x2363fe['ndauth_url'],_0x98b2('0x4')),'form':{'grant_type':_0x98b2('0x5'),'username':_0x2363fe[_0x98b2('0x6')],'password':_0x2363fe[_0x98b2('0x5')]},'json':!![]};return rp(_0x20afa9)[_0x98b2('0x7')](function(_0x2cd0cb){var _0x417ca6={'method':_0x98b2('0x8'),'uri':url[_0x98b2('0x3')](_0x2363fe[_0x98b2('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x2363fe['ndaactivity_type']||_0x98b2('0xa'),'channelId':_0x98b2('0xb'),'conversation':{'id':_0x51b66a[_0x98b2('0xc')]},'from':{'id':_0x51b66a[_0x98b2('0xd')],'name':_0x51b66a[_0x98b2('0xe')]},'recipient':{'id':_0x51b66a[_0x98b2('0xf')],'name':_0x51b66a['extension']},'text':_0x2363fe[_0x98b2('0x10')],'channelData':{}},'headers':{'Authorization':_0x98b2('0x11')+_0x2cd0cb['access_token']},'json':!![]};if(_0x2363fe[_0x98b2('0x12')]){_0x417ca6[_0x98b2('0x13')][_0x98b2('0x14')]['ProjectName']=_0x2363fe['project'];}if(_0x2363fe[_0x98b2('0x15')]=='1'){_0x417ca6['body'][_0x98b2('0x14')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x2363fe['custom_action']){_0x417ca6[_0x98b2('0x13')][_0x98b2('0x14')][_0x98b2('0x16')]=_0x2363fe['custom_action'];if(_0x2363fe['custom_action_data']){_0x417ca6['body'][_0x98b2('0x14')][_0x98b2('0x17')]=_0x2363fe[_0x98b2('0x18')];}}logger[_0x98b2('0x19')](JSON['stringify'](_0x417ca6));return rp(_0x417ca6);});}; \ 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 f4325d3..70d7e46 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 _0x83fa=['./lib/api','exports'];(function(_0x4568d6,_0x5847e0){var _0x5245c0=function(_0x548a40){while(--_0x548a40){_0x4568d6['push'](_0x4568d6['shift']());}};_0x5245c0(++_0x5847e0);}(_0x83fa,0x124));var _0xa83f=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x83fa[_0x5416db];return _0x243e35;};'use strict';var asr=require(_0xa83f('0x0'));module[_0xa83f('0x1')]=function(_0x159c7c,_0x3655ba,_0x2e48a2,_0x3bd6e2){return asr(_0x159c7c,_0x3655ba,_0x2e48a2,_0x3bd6e2);}; \ No newline at end of file +var _0xae1f=['./lib/api'];(function(_0x56edec,_0x190e71){var _0x52e87f=function(_0x44a25f){while(--_0x44a25f){_0x56edec['push'](_0x56edec['shift']());}};_0x52e87f(++_0x190e71);}(_0xae1f,0x106));var _0xfae1=function(_0x2b6600,_0x24c497){_0x2b6600=_0x2b6600-0x0;var _0x912ee2=_0xae1f[_0x2b6600];return _0x912ee2;};'use strict';var asr=require(_0xfae1('0x0'));module['exports']=function(_0x4b7fb5,_0x624d9f,_0x2a8df6,_0x43258b){return asr(_0x4b7fb5,_0x624d9f,_0x2a8df6,_0x43258b);}; \ 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 d8b1802..d0127fb 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 _0xd452=['send','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','info','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','close'];(function(_0x1e6db2,_0x3ba97e){var _0x528fe=function(_0x316fb5){while(--_0x316fb5){_0x1e6db2['push'](_0x1e6db2['shift']());}};_0x528fe(++_0x3ba97e);}(_0xd452,0x113));var _0x2d45=function(_0x34df4a,_0x209d10){_0x34df4a=_0x34df4a-0x0;var _0x145c69=_0xd452[_0x34df4a];return _0x145c69;};'use strict';var BPromise=require(_0x2d45('0x0'));var _=require(_0x2d45('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x2d45('0x2'));var crypto=require(_0x2d45('0x3'));var logger=require(_0x2d45('0x4'))(_0x2d45('0x5'));module[_0x2d45('0x6')]=function(_0x24ad71,_0x445c57,_0x8f042f,_0x3cc1c7){return new BPromise(function(_0x3b6bcd,_0x2f2c2e){logger['info'](_0x2d45('0x7'),_0x3cc1c7||_0x2d45('0x8'));var _0x37ab42=new WebSocket(_0x3cc1c7||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x271d59='';var _0x4ff42b='0';var _0x223f8d='1';var _0x4c8e5a=_0x2d45('0x9');function _0x37e1f5(_0x4b5805){var _0x501354=crypto[_0x2d45('0xa')]('sha1');_0x501354[_0x2d45('0xb')](_0x4b5805);return _0x501354[_0x2d45('0xc')]('hex');}function _0x31019b(){try{logger[_0x2d45('0xd')](_0x2d45('0xe'));var _0x1054c5=moment()[_0x2d45('0xf')]();var _0x37149b=_0x37e1f5(_0x1054c5+_0x445c57+_0x8f042f);_0x37ab42['send'](JSON[_0x2d45('0x10')]({'appID':_0x445c57,'timestamp':_0x1054c5,'appKey':_0x37149b}));var _0x2a0e1d=fs[_0x2d45('0x11')](_0x24ad71);_0x2a0e1d['on']('data',function(_0x4ff0c0){_0x37ab42['send'](_0x4ff0c0);});_0x2a0e1d['on'](_0x2d45('0x12'),function(){_0x37ab42[_0x2d45('0x13')](_0x2d45('0x14'));});}catch(_0x17c783){logger[_0x2d45('0x15')](_0x2d45('0x16'),JSON['stringify'](_0x17c783));_0x37ab42[_0x2d45('0x17')]();}}function _0x5d2eae(_0x56c3c9){try{if(_0x56c3c9){var _0x3ebb8c=JSON[_0x2d45('0x18')](_0x56c3c9);switch(_0x3ebb8c[_0x2d45('0x19')]){case 0x0:if(_0x3ebb8c['result']){if(_0x3ebb8c[_0x2d45('0x1a')][_0x2d45('0x1b')]){logger[_0x2d45('0xd')](_0x2d45('0x1c'),JSON[_0x2d45('0x10')](_0x3ebb8c[_0x2d45('0x1a')][_0x2d45('0x1d')]));_0x271d59=_0x3ebb8c[_0x2d45('0x1a')][_0x2d45('0x1d')][0x0][_0x2d45('0x1e')];_0x4ff42b=_0x3ebb8c[_0x2d45('0x1a')]['hypotheses'][0x0]['likelihood'];_0x223f8d='0';_0x4c8e5a=_0x2d45('0x1f');_0x37ab42[_0x2d45('0x17')]();}}break;case 0x1:logger[_0x2d45('0xd')](_0x2d45('0x9'));_0x223f8d='1';_0x4c8e5a='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x2d45('0xd')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x223f8d='2';_0x4c8e5a=_0x2d45('0x20');break;case 0x9:logger['info'](_0x2d45('0x21'));_0x223f8d='9';_0x4c8e5a='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x2d45('0xd')](_0x2d45('0x22'));_0x223f8d='10';_0x4c8e5a='Authentication\x20failed.';break;case 0xb:logger[_0x2d45('0xd')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x223f8d='11';_0x4c8e5a=_0x2d45('0x23');}}}catch(_0x26e987){logger[_0x2d45('0x15')](_0x2d45('0x24'),JSON[_0x2d45('0x10')](_0x26e987));_0x37ab42[_0x2d45('0x17')]();}}function _0x49d4ea(){logger[_0x2d45('0xd')](_0x2d45('0x25'));_0x3b6bcd({'transcript':_0x271d59,'confidence':_0x4ff42b,'status':_0x223f8d,'status_message':_0x4c8e5a});}function _0x162694(_0x3ee614){logger['error'](_0x2d45('0x26'));if(!_[_0x2d45('0x27')](_0x3ee614)){logger['error'](_[_0x2d45('0x28')](_0x3ee614)?JSON[_0x2d45('0x10')](_0x3ee614):_0x3ee614);}}_0x37ab42['on']('open',_0x31019b);_0x37ab42['on'](_0x2d45('0x29'),_0x5d2eae);_0x37ab42['on'](_0x2d45('0x12'),_0x49d4ea);_0x37ab42['on'](_0x2d45('0x15'),_0x162694);});}; \ No newline at end of file +var _0x9040=['wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','info','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','error','terminate','parse','status','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','message','lodash','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI'];(function(_0x4e2463,_0x1ceeca){var _0x563959=function(_0x53c9e6){while(--_0x53c9e6){_0x4e2463['push'](_0x4e2463['shift']());}};_0x563959(++_0x1ceeca);}(_0x9040,0xfd));var _0x0904=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x9040[_0x134c2e];return _0x2825db;};'use strict';var BPromise=require('bluebird');var _=require(_0x0904('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x0904('0x1'));var logger=require(_0x0904('0x2'))(_0x0904('0x3'));module[_0x0904('0x4')]=function(_0x4d881c,_0x1dc8aa,_0x16e269,_0x28a143){return new BPromise(function(_0x2158be,_0x438128){logger['info'](_0x0904('0x5'),_0x28a143||_0x0904('0x6'));var _0x593b32=new WebSocket(_0x28a143||_0x0904('0x6'),{'perMessageDeflate':![]});var _0x2a89c0='';var _0x4a1f56='0';var _0x3d259c='1';var _0x102f7f=_0x0904('0x7');function _0xbc764c(_0x39b34a){var _0x487347=crypto[_0x0904('0x8')](_0x0904('0x9'));_0x487347[_0x0904('0xa')](_0x39b34a);return _0x487347['digest']('hex');}function _0x952864(){try{logger[_0x0904('0xb')](_0x0904('0xc'));var _0x5cc18c=moment()['unix']();var _0x51da39=_0xbc764c(_0x5cc18c+_0x1dc8aa+_0x16e269);_0x593b32[_0x0904('0xd')](JSON[_0x0904('0xe')]({'appID':_0x1dc8aa,'timestamp':_0x5cc18c,'appKey':_0x51da39}));var _0x1b72b1=fs[_0x0904('0xf')](_0x4d881c);_0x1b72b1['on'](_0x0904('0x10'),function(_0x32d225){_0x593b32['send'](_0x32d225);});_0x1b72b1['on'](_0x0904('0x11'),function(){_0x593b32[_0x0904('0xd')]('EOS');});}catch(_0xb687f5){logger[_0x0904('0x12')]('Tilde\x20ASR\x20send\x20error',JSON[_0x0904('0xe')](_0xb687f5));_0x593b32[_0x0904('0x13')]();}}function _0x25b163(_0x308941){try{if(_0x308941){var _0x2fdcf6=JSON[_0x0904('0x14')](_0x308941);switch(_0x2fdcf6[_0x0904('0x15')]){case 0x0:if(_0x2fdcf6['result']){if(_0x2fdcf6['result'][_0x0904('0x16')]){logger[_0x0904('0xb')](_0x0904('0x17'),JSON[_0x0904('0xe')](_0x2fdcf6[_0x0904('0x18')]['hypotheses']));_0x2a89c0=_0x2fdcf6['result'][_0x0904('0x19')][0x0]['transcript'];_0x4a1f56=_0x2fdcf6[_0x0904('0x18')][_0x0904('0x19')][0x0][_0x0904('0x1a')];_0x3d259c='0';_0x102f7f=_0x0904('0x1b');_0x593b32[_0x0904('0x13')]();}}break;case 0x1:logger['info'](_0x0904('0x7'));_0x3d259c='1';_0x102f7f=_0x0904('0x7');break;case 0x2:logger[_0x0904('0xb')](_0x0904('0x1c'));_0x3d259c='2';_0x102f7f=_0x0904('0x1c');break;case 0x9:logger['info'](_0x0904('0x1d'));_0x3d259c='9';_0x102f7f=_0x0904('0x1d');break;case 0xa:logger[_0x0904('0xb')]('Authentication\x20failed.');_0x3d259c='10';_0x102f7f=_0x0904('0x1e');break;case 0xb:logger[_0x0904('0xb')](_0x0904('0x1f'));_0x3d259c='11';_0x102f7f=_0x0904('0x1f');}}}catch(_0x10b9b1){logger[_0x0904('0x12')](_0x0904('0x20'),JSON[_0x0904('0xe')](_0x10b9b1));_0x593b32['terminate']();}}function _0x2f6e59(){logger['info'](_0x0904('0x21'));_0x2158be({'transcript':_0x2a89c0,'confidence':_0x4a1f56,'status':_0x3d259c,'status_message':_0x102f7f});}function _0x23189b(_0x23abeb){logger[_0x0904('0x12')](_0x0904('0x22'));if(!_[_0x0904('0x23')](_0x23abeb)){logger['error'](_['isObject'](_0x23abeb)?JSON['stringify'](_0x23abeb):_0x23abeb);}}_0x593b32['on']('open',_0x952864);_0x593b32['on'](_0x0904('0x24'),_0x25b163);_0x593b32['on'](_0x0904('0x11'),_0x2f6e59);_0x593b32['on'](_0x0904('0x12'),_0x23189b);});}; \ 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 10cb4be..7420a7d 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0x70b8=['exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x70b8,0x138));var _0x870b=function(_0x1e3c47,_0xa849b7){_0x1e3c47=_0x1e3c47-0x0;var _0x187bdb=_0x70b8[_0x1e3c47];return _0x187bdb;};var asr=require('./asr');module[_0x870b('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index fc7febb..a30d6af 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 _0x2ea6=['events','EventEmitter','./channel','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','util'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x2ea6,0xf1));var _0x62ea=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0x2ea6[_0x1d70db];return _0x3060c6;};'use strict';var util=require(_0x62ea('0x0'));var net=require('net');var EventEmitter=require(_0x62ea('0x1'))[_0x62ea('0x2')];var AGIError=require('./error');var AGIChannel=require(_0x62ea('0x3'));var AGIServer=function(_0x66bfd2,_0x109491,_0x1635a2){var _0x145ddd=this,_0x66bfd2=_0x66bfd2||0x11dd,_0x109491=_0x109491||_0x62ea('0x4'),_0xac9345=null,_0x18c34d=0x0;EventEmitter['call'](_0x145ddd);function _0x134502(){if(!_0x66bfd2){_0x145ddd[_0x62ea('0x5')](_0x62ea('0x6'),new AGIError(_0x62ea('0x7')));return![];}_0xac9345=net[_0x62ea('0x8')]();_0xac9345[_0x62ea('0x9')](_0x66bfd2,_0x109491);_0xac9345['on'](_0x62ea('0xa'),function(){_0x145ddd[_0x62ea('0x5')](_0x62ea('0xa'));});_0xac9345['on']('connection',function(_0x46ed4d){_0xac9345[_0x62ea('0xb')](function(_0x291df2,_0x1a61b6){if(_0x291df2){_0x145ddd[_0x62ea('0x5')](_0x62ea('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x291df2));}else if(_0x1635a2&&_0x1635a2<0x0){_0x145ddd[_0x62ea('0x5')](_0x62ea('0x6'),new AGIError(_0x62ea('0xc')));_0x46ed4d[_0x62ea('0xd')]();}else if(_0x1635a2&&_0x1635a2>0x0&&_0x1635a2<_0x1a61b6){_0x18c34d+=0x1;_0x145ddd['emit']('error',new AGIError(_0x62ea('0xe'),_0x18c34d));_0x46ed4d[_0x62ea('0xd')]();}else{var _0x339ad1=new AGIChannel(_0x46ed4d);_0x339ad1['on'](_0x62ea('0xf'),function(){_0x145ddd[_0x62ea('0x5')](_0x62ea('0x10'),_0x339ad1);});}});});_0xac9345['on'](_0x62ea('0x6'),function(_0x7a3240){_0x145ddd[_0x62ea('0x5')](_0x62ea('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x7a3240[_0x62ea('0x11')]));});_0xac9345['on']('close',function(){_0x145ddd[_0x62ea('0x5')](_0x62ea('0x12'),new AGIError(_0x62ea('0x13')));});}process[_0x62ea('0x14')](function(){_0x134502();});};util['inherits'](AGIServer,EventEmitter);module[_0x62ea('0x15')]=function(_0x3e90a5,_0x534f0a,_0x37e072){return new AGIServer(_0x3e90a5,_0x534f0a,_0x37e072);}; \ No newline at end of file +var _0x6c53=['E_AGI_ARGUMENT_PORT','createServer','listening','emit','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./error','127.0.0.1','call','error'];(function(_0x41491a,_0x134077){var _0x40da87=function(_0x3272e8){while(--_0x3272e8){_0x41491a['push'](_0x41491a['shift']());}};_0x40da87(++_0x134077);}(_0x6c53,0xe8));var _0x36c5=function(_0xf28232,_0x5a6118){_0xf28232=_0xf28232-0x0;var _0x34b487=_0x6c53[_0xf28232];return _0x34b487;};'use strict';var util=require(_0x36c5('0x0'));var net=require(_0x36c5('0x1'));var EventEmitter=require(_0x36c5('0x2'))[_0x36c5('0x3')];var AGIError=require(_0x36c5('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x1988cd,_0x9f036f,_0x4519c6){var _0x2c5bde=this,_0x1988cd=_0x1988cd||0x11dd,_0x9f036f=_0x9f036f||_0x36c5('0x5'),_0x48fc78=null,_0x23cdad=0x0;EventEmitter[_0x36c5('0x6')](_0x2c5bde);function _0x3c880a(){if(!_0x1988cd){_0x2c5bde['emit'](_0x36c5('0x7'),new AGIError(_0x36c5('0x8')));return![];}_0x48fc78=net[_0x36c5('0x9')]();_0x48fc78['listen'](_0x1988cd,_0x9f036f);_0x48fc78['on'](_0x36c5('0xa'),function(){_0x2c5bde[_0x36c5('0xb')]('listening');});_0x48fc78['on'](_0x36c5('0xc'),function(_0x533618){_0x48fc78[_0x36c5('0xd')](function(_0x440695,_0x3291f7){if(_0x440695){_0x2c5bde[_0x36c5('0xb')]('error',new AGIError(_0x36c5('0xe'),_0x440695));}else if(_0x4519c6&&_0x4519c6<0x0){_0x2c5bde['emit'](_0x36c5('0x7'),new AGIError(_0x36c5('0xf')));_0x533618['destroy']();}else if(_0x4519c6&&_0x4519c6>0x0&&_0x4519c6<_0x3291f7){_0x23cdad+=0x1;_0x2c5bde[_0x36c5('0xb')]('error',new AGIError(_0x36c5('0x10'),_0x23cdad));_0x533618[_0x36c5('0x11')]();}else{var _0x1ea8f1=new AGIChannel(_0x533618);_0x1ea8f1['on']('ready',function(){_0x2c5bde['emit'](_0x36c5('0xc'),_0x1ea8f1);});}});});_0x48fc78['on'](_0x36c5('0x7'),function(_0x1595e2){_0x2c5bde[_0x36c5('0xb')](_0x36c5('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x1595e2[_0x36c5('0x12')]));});_0x48fc78['on'](_0x36c5('0x13'),function(){_0x2c5bde[_0x36c5('0xb')]('close',new AGIError(_0x36c5('0x14')));});}process[_0x36c5('0x15')](function(){_0x3c880a();});};util[_0x36c5('0x16')](AGIServer,EventEmitter);module[_0x36c5('0x17')]=function(_0x45ba3b,_0x4929a2,_0x433a06){return new AGIServer(_0x45ba3b,_0x4929a2,_0x433a06);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 46e30f2..be91a9f 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 _0x4381=['yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','../../config/environment','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariableById','name','catch','prototype','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','uniqueid','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','number','timeout','includes','PUT','method','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','computedVariables','sync','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','private_key','sestekNDA','ispeechTTS','speed','ispeechASR','key','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_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','saveRestApiResult','isPlainObject','%s.%s','isArray','length','split','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','%s[%s][%s]','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','DIAL','SIP/%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','providerResponse','DIALOGFLOW_%s','dialogflowV2','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','opts','Executed\x20command\x20%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','GOAL\x20%s','goalname','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','streamFile','unlink','aws\x20Polly\x20is\x20unreachable','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','no\x20appsecret\x20configured','beep','NOBEEP','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','condition','no\x20condition\x20configured','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','failure','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','agi','macro','position','record','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','service','host','port','secure','authentication','auth','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE'];(function(_0x17acfc,_0x291e10){var _0x21a95c=function(_0x14710a){while(--_0x14710a){_0x17acfc['push'](_0x17acfc['shift']());}};_0x21a95c(++_0x291e10);}(_0x4381,0x1f1));var _0x1438=function(_0x5ac5b4,_0x919cb7){_0x5ac5b4=_0x5ac5b4-0x0;var _0x5c0008=_0x4381[_0x5ac5b4];return _0x5c0008;};'use strict';var fs=require('fs');var path=require(_0x1438('0x0'));var util=require(_0x1438('0x1'));var _=require(_0x1438('0x2'));var sh=require(_0x1438('0x3'));var odbc=require(_0x1438('0x4'))();var rs=require(_0x1438('0x5'));var moment=require(_0x1438('0x6'));var Mustache=require(_0x1438('0x7'));var rp=require(_0x1438('0x8'));var logger=require(_0x1438('0x9'))('agi');var config=require(_0x1438('0xa'));var scripts=require('./scripts');var FILES_PATH=_0x1438('0xb');var recursiveMapAttributes=['rawHeaders',_0x1438('0xc')];var verticesWithRetry=[_0x1438('0xd'),_0x1438('0xe'),_0x1438('0xf')];var AGIVertices=function(_0x43f659,_0x2ca987,_0x124d7c){this[_0x1438('0x10')]=_0x43f659;this[_0x1438('0x11')]=_0x2ca987;this[_0x1438('0x12')]=_0x124d7c;};AGIVertices['prototype']['getVariable']=function(_0x1752f5,_0x36d828){this['rpc'][_0x1438('0x13')](_0x1752f5)['then'](function(_0x454692){_0x36d828(null,_0x454692?_0x454692[_0x1438('0x14')]:![]);})[_0x1438('0x15')](function(_0xf303f3){_0x36d828(_0xf303f3);});};AGIVertices[_0x1438('0x16')][_0x1438('0x17')]=function(_0x2e6c7c,_0x3a8f15){this[_0x1438('0x11')][_0x1438('0x18')](_0x2e6c7c)[_0x1438('0x19')](function(_0x96a169){_0x3a8f15(null,_0x96a169?_0x96a169[_0x1438('0x14')]:![]);})[_0x1438('0x15')](function(_0x20b8e6){_0x3a8f15(_0x20b8e6);});};AGIVertices[_0x1438('0x16')][_0x1438('0x1a')]=function(_0x296c21,_0x35d055){this['rpc']['getSquareProjectById'](_0x296c21)['then'](function(_0x2b2bcd){_0x35d055(null,_0x2b2bcd?_0x2b2bcd['name']:![]);})['catch'](function(_0x4e4eeb){_0x35d055(_0x4e4eeb);});};AGIVertices[_0x1438('0x16')][_0x1438('0x1b')]=function(_0x249850,_0x34721a){this[_0x1438('0x11')][_0x1438('0x1c')](_0x249850)[_0x1438('0x19')](function(_0x275341){_0x34721a(null,_0x275341?_0x275341['dsn']:![]);})[_0x1438('0x15')](function(_0x26df05){_0x34721a(_0x26df05);});};AGIVertices[_0x1438('0x16')][_0x1438('0x1d')]=function(_0x329fa7,_0x2928d4){this[_0x1438('0x11')][_0x1438('0x1e')](_0x329fa7)[_0x1438('0x19')](function(_0x3bb065){_0x2928d4(null,_0x3bb065?_0x3bb065[_0x1438('0x14')]:![]);})[_0x1438('0x15')](function(_0xf6fd86){_0x2928d4(_0xf6fd86);});};AGIVertices[_0x1438('0x16')][_0x1438('0x1f')]=function(_0x49fab3,_0x34b877){this[_0x1438('0x11')][_0x1438('0x20')](_0x49fab3)[_0x1438('0x19')](function(_0x637417){_0x34b877(null,_0x637417?_0x637417[_0x1438('0x14')]:![]);})['catch'](function(_0x54c1b6){_0x34b877(_0x54c1b6);});};AGIVertices['prototype']['getSound']=function(_0x20c2b2,_0x28108c){var _0x2bb80f=this;this[_0x1438('0x11')][_0x1438('0x21')](_0x20c2b2)['then'](function(_0x3768cf){_0x28108c(null,_0x3768cf?_0x2bb80f[_0x1438('0x22')](_0x3768cf['save_name']):![]);})[_0x1438('0x15')](function(_0x3b94e8){_0x28108c(_0x3b94e8);});};AGIVertices[_0x1438('0x16')][_0x1438('0x23')]=function(_0x46445b,_0x1809d7){this['rpc'][_0x1438('0x24')](_0x46445b)[_0x1438('0x19')](function(_0x232f3c){_0x1809d7(null,_0x232f3c?_0x232f3c:![]);})[_0x1438('0x15')](function(_0x139543){_0x1809d7(_0x139543);});};AGIVertices[_0x1438('0x16')][_0x1438('0x25')]=function(_0x63565a,_0x1712a4,_0x2992b8){this[_0x1438('0x12')][_0x1438('0x25')](_0x63565a,_0x1712a4)[_0x1438('0x19')](function(){_0x2992b8(null);})['catch'](function(_0x48c7b2){_0x2992b8(_0x48c7b2);});};AGIVertices[_0x1438('0x16')][_0x1438('0x26')]=function(_0x14ba48,_0x2c5f39){this[_0x1438('0x11')][_0x1438('0x27')](_0x14ba48)[_0x1438('0x19')](function(_0x28685f){if(_0x28685f){if(_0x28685f[_0x1438('0x28')]){_0x2c5f39(null,[_0x28685f[_0x1438('0x29')]]);}else{_0x2c5f39(null,_[_0x1438('0x2a')](_0x28685f['Intervals'],_0x1438('0x29')));}}else{_0x2c5f39(null,![]);}})[_0x1438('0x15')](function(_0x2837a2){_0x2c5f39(_0x2837a2);});};AGIVertices[_0x1438('0x16')][_0x1438('0x22')]=function(_0x30abc1){return util[_0x1438('0x2b')](_0x1438('0x2c'),FILES_PATH,_0x30abc1);};AGIVertices['prototype'][_0x1438('0x2d')]=function(_0x21f7d9,_0x540f40,_0x1993a7){odbc['open'](_0x21f7d9,function(_0x27c764){if(_0x27c764){logger[_0x1438('0x2e')](_0x1438('0x2f'),_0x27c764);_0x1993a7(_0x27c764);}else{logger[_0x1438('0x30')]('ODBC\x20connection\x20successfully');odbc[_0x1438('0x31')](_0x540f40,function(_0x3a1551,_0x44f285){if(_0x3a1551){logger[_0x1438('0x30')](_0x1438('0x32'),_0x540f40);_0x1993a7(_0x3a1551);}else{logger[_0x1438('0x30')]('Query\x20executed\x20correctly\x20%s',_0x540f40);odbc[_0x1438('0x33')](function(_0x2d2109){if(_0x2d2109){logger[_0x1438('0x2e')](_0x1438('0x34'),_0x2d2109);}_0x1993a7(null,_0x44f285);});}});}});};AGIVertices[_0x1438('0x16')][_0x1438('0x35')]=function(_0x56c3c2,_0xf1803a){this[_0x1438('0x11')][_0x1438('0x36')](_0x56c3c2)[_0x1438('0x19')](function(_0x3c1981){_0xf1803a(null,_0x3c1981?_0x3c1981:![]);})['catch'](function(_0x1174fb){_0xf1803a(_0x1174fb);});};AGIVertices[_0x1438('0x16')][_0x1438('0x37')]=function(_0x1aae7b,_0x4378df){this[_0x1438('0x11')]['createSmsMessage'](_0x1aae7b)[_0x1438('0x19')](function(_0x13a311){_0x4378df(null,_0x13a311);})[_0x1438('0x15')](function(_0xa778e4){_0x4378df(_0xa778e4);});};AGIVertices[_0x1438('0x16')][_0x1438('0x38')]=function(_0x43a3f8,_0x5b14c6,_0x3a7a78){this['rpc'][_0x1438('0x38')]({'uniqueid':this['channel']['uniqueid'],'node':_0x43a3f8[_0x1438('0x39')],'application':_0x43a3f8[_0x1438('0x3a')],'data':_0x5b14c6||null,'project_name':this[_0x1438('0x10')][_0x1438('0x3b')],'callerid':this[_0x1438('0x10')][_0x1438('0x3c')]})[_0x1438('0x19')](function(_0x54fb6c){if(_0x3a7a78){_0x3a7a78(null,_0x54fb6c);}})[_0x1438('0x15')](function(_0x43027d){if(_0x3a7a78){_0x3a7a78(_0x43027d);}});};AGIVertices[_0x1438('0x16')]['createSquareRecording']=function(_0x19a2de,_0x52b40c,_0x4b679b,_0x3858ef){this['rpc'][_0x1438('0x3d')]({'uniqueid':this[_0x1438('0x10')][_0x1438('0x3e')],'callerid':this[_0x1438('0x10')][_0x1438('0x3c')],'calleridname':this['channel']['calleridname'],'context':this[_0x1438('0x10')]['context'],'extension':this[_0x1438('0x10')][_0x1438('0x3f')],'priority':this[_0x1438('0x10')][_0x1438('0x40')],'accountcode':this['channel'][_0x1438('0x41')],'dnid':this[_0x1438('0x10')][_0x1438('0x42')],'projectName':this['channel']['arg_1'],'saveName':_0x52b40c,'filename':_0x19a2de[_0x1438('0x43')]||_0x52b40c,'savePath':_0x4b679b})[_0x1438('0x19')](function(_0x4eea0a){_0x3858ef(null,_0x4eea0a);})[_0x1438('0x15')](function(_0xd6d6b4){_0x3858ef(_0xd6d6b4);});};AGIVertices['prototype'][_0x1438('0x44')]=function(_0x183e80,_0x13a588,_0x42e5ae,_0x30032c,_0x17058b){this[_0x1438('0x11')][_0x1438('0x44')]({'uniqueid':this[_0x1438('0x10')]['uniqueid'],'body':_0x183e80,'direction':_0x13a588,'providerName':_0x42e5ae,'providerResponse':_0x30032c})[_0x1438('0x19')](function(_0x484294){if(_0x17058b){_0x17058b(null,_0x484294);}})[_0x1438('0x15')](function(_0x4361d9){if(_0x17058b){_0x17058b(_0x4361d9);}});};AGIVertices[_0x1438('0x16')][_0x1438('0x45')]=function(_0xe9fd9,_0x43b994){this[_0x1438('0x11')]['createCmContact']({'firstName':_['isEmpty'](_0xe9fd9[_0x1438('0x14')])||_[_0x1438('0x46')](_0xe9fd9[_0x1438('0x14')])?_0x1438('0x47')+Math[_0x1438('0x48')]():_0xe9fd9[_0x1438('0x14')],'lastName':_[_0x1438('0x49')](_0xe9fd9[_0x1438('0x4a')])||_[_0x1438('0x46')](_0xe9fd9[_0x1438('0x4a')])?null:_0xe9fd9[_0x1438('0x4a')],'phone':_0xe9fd9[_0x1438('0x4b')],'ListId':_0xe9fd9[_0x1438('0x4c')],'scheduledat':_0xe9fd9[_0x1438('0x4d')],'callbackUniqueid':this[_0x1438('0x10')][_0x1438('0x3e')],'tags':_0x1438('0x4e'),'description':'Callback\x20scheduled\x20at\x20'+_0xe9fd9[_0x1438('0x4d')][_0x1438('0x4f')](),'priority':_0xe9fd9[_0x1438('0x50')]})[_0x1438('0x19')](function(_0x45132){_0x43b994(null,_0x45132);})[_0x1438('0x15')](function(_0x202e36){_0x43b994(_0x202e36);});};AGIVertices[_0x1438('0x16')][_0x1438('0x51')]=function(_0x5ac34c,_0x5c7d16){this[_0x1438('0x11')][_0x1438('0x52')](_0x5ac34c)[_0x1438('0x19')](function(_0x5ad984){_0x5c7d16(null,_0x5ad984?_0x5ad984[_0x1438('0x14')]:![]);})[_0x1438('0x15')](function(_0x37cc4a){_0x5c7d16(_0x37cc4a);});};AGIVertices[_0x1438('0x16')][_0x1438('0x53')]=function(_0x4d2ca8,_0x29c749,_0x6dc874){var _0x402f07={'role':'agent'};_0x402f07[_0x4d2ca8]=this[_0x1438('0x10')][_0x1438('0x3c')];this[_0x1438('0x11')]['agentPause'](_0x402f07,_0x29c749,this[_0x1438('0x10')][_0x1438('0x3e')])[_0x1438('0x19')](function(_0x14b7b9){_0x6dc874(null,_[_0x1438('0x46')](_0x14b7b9)?![]:!![]);})[_0x1438('0x15')](function(_0x156e89){logger[_0x1438('0x2e')](_0x156e89);_0x6dc874(null,![]);});};AGIVertices[_0x1438('0x16')][_0x1438('0x54')]=function(_0x4f504d,_0x13f700){var _0x4a9867={'role':_0x1438('0x55')};_0x4a9867[_0x4f504d]=this[_0x1438('0x10')]['callerid'];this[_0x1438('0x11')][_0x1438('0x54')](_0x4a9867)[_0x1438('0x19')](function(_0x4e8314){_0x13f700(null,_[_0x1438('0x46')](_0x4e8314)?![]:!![]);})[_0x1438('0x15')](function(_0x2d36a5){logger[_0x1438('0x2e')](_0x2d36a5);_0x13f700(null,![]);});};AGIVertices[_0x1438('0x16')][_0x1438('0x56')]=function(_0x167cbf,_0x39cc89){var _0x30f043={'role':'agent'};_0x30f043[_0x167cbf]=this[_0x1438('0x10')][_0x1438('0x3c')];this[_0x1438('0x11')][_0x1438('0x56')](_0x30f043)['then'](function(_0x3c7502){_0x39cc89(null,_[_0x1438('0x46')](_0x3c7502)?![]:!![]);})['catch'](function(_0x335a78){logger['error'](_0x335a78);_0x39cc89(null,![]);});};AGIVertices['prototype'][_0x1438('0x57')]=function(_0x44a960,_0x1b4923){var _0x19b9ea={'role':'agent'};_0x19b9ea[_0x44a960]=this[_0x1438('0x10')][_0x1438('0x3c')];var _0xe0ac2d=_0x44a960!=_0x1438('0x58')?util['format'](_0x1438('0x59'),_0x1438('0x5a'),this[_0x1438('0x10')][_0x1438('0x3c')]):undefined;this[_0x1438('0x11')][_0x1438('0x57')](_0x19b9ea,_0xe0ac2d)[_0x1438('0x19')](function(_0x35e56d){_0x1b4923(null,_[_0x1438('0x46')](_0x35e56d)?![]:!![]);})[_0x1438('0x15')](function(_0x9f528d){logger['error'](_0x9f528d);_0x1b4923(null,![]);});};AGIVertices[_0x1438('0x16')][_0x1438('0x5b')]=function(_0x47c28e,_0x4b6ff5){sh[_0x1438('0x5c')](_[_0x1438('0x5d')](_0x47c28e),function(_0x1b812f,_0x43f1ef){var _0xd80b21=_0x43f1ef[_0x1438('0x5e')](/(\r\n|\n|\r)/gm,'');_0x4b6ff5(null,_0xd80b21);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x171809,_0x50272b){scripts[_0x1438('0x5f')](_0x171809['apiKey'],_0x171809['google_cloud_tts_text_type']||_0x1438('0x60'),_0x171809[_0x1438('0x60')],_0x171809[_0x1438('0x61')]||_0x1438('0x62'),_0x171809['ssmlGender']||_0x1438('0x63'),_0x171809[_0x1438('0x64')]||_0x1438('0x65'))[_0x1438('0x19')](function(_0x5aaad5){_0x50272b(null,_0x5aaad5);})[_0x1438('0x15')](function(_0x10b362){_0x50272b(_0x10b362);});};AGIVertices[_0x1438('0x16')][_0x1438('0x66')]=function(_0x9ba7b4,_0x3203bc){scripts['googleTTS'](_0x9ba7b4[_0x1438('0x60')],_0x9ba7b4[_0x1438('0x67')]||'en',0x1)[_0x1438('0x19')](function(_0x5507c0){_0x3203bc(null,_0x5507c0);})[_0x1438('0x15')](function(_0xba74b6){_0x3203bc(_0xba74b6);});};AGIVertices[_0x1438('0x16')][_0x1438('0x68')]=function(_0x3e6e61,_0x26375b){var _0x5ea965={'uri':_0x3e6e61[_0x1438('0x69')],'method':_0x3e6e61['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3e6e61['timeout'])===_0x1438('0x6a')&&parseInt(_0x3e6e61[_0x1438('0x6b')])>=0x1?parseInt(_0x3e6e61[_0x1438('0x6b')])*0x3e8:0x5*0x3e8};if(_[_0x1438('0x6c')](['POST',_0x1438('0x6d')],_0x5ea965[_0x1438('0x6e')][_0x1438('0x6f')]())){try{_0x5ea965['body']=_0x3e6e61[_0x1438('0xc')]?JSON[_0x1438('0x70')](_0x3e6e61[_0x1438('0xc')]):{};}catch(_0x21e30c){logger[_0x1438('0x2e')](_0x1438('0x71'),_0x21e30c);}}try{_0x5ea965[_0x1438('0x72')]=_0x3e6e61[_0x1438('0x73')]?JSON[_0x1438('0x70')](_0x3e6e61[_0x1438('0x73')]):{};}catch(_0x1f3ea3){logger[_0x1438('0x2e')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1f3ea3);}if(_0x3e6e61[_0x1438('0x74')]){try{var _0x2bf76a=require(_0x3e6e61['computedVariables'])[_0x1438('0x75')](this,_0x5ea965);_0x5ea965[_0x1438('0x76')]=Mustache[_0x1438('0x77')](_0x3e6e61['url'],_0x2bf76a,{},['$$','$$']);if(_0x5ea965[_0x1438('0x72')]){_0x5ea965[_0x1438('0x72')]=JSON[_0x1438('0x70')](Mustache['render'](JSON[_0x1438('0x78')](_0x5ea965[_0x1438('0x72')]),_0x2bf76a,{},['$$','$$']));}if(_0x5ea965[_0x1438('0x79')]){_0x5ea965[_0x1438('0x79')]=JSON[_0x1438('0x70')](Mustache[_0x1438('0x77')](JSON[_0x1438('0x78')](_0x5ea965[_0x1438('0x79')]),_0x2bf76a,{},['$$','$$']));}}catch(_0x4d53c8){logger[_0x1438('0x2e')](_0x1438('0x7a'),_0x4d53c8);}}rp(_0x5ea965)['then'](function(_0x5a6019){var _0x4081b0={'statusCode':_0x5a6019[_0x1438('0x7b')]||0xc8,'statusMessage':_0x5a6019[_0x1438('0x7c')]||'OK','headers':_0x5a6019[_0x1438('0x72')]||{},'body':_0x5a6019[_0x1438('0x79')]||{}};_0x26375b(null,_0x4081b0);})[_0x1438('0x15')](function(_0x5dd871){var _0x14ed56={'statusCode':_0x5dd871[_0x1438('0x7b')]||0x1f4,'statusMessage':_0x5dd871[_0x1438('0x7d')]||_0x1438('0x7e'),'headers':_0x5dd871[_0x1438('0x7f')][_0x1438('0x72')]||{},'body':_0x5dd871[_0x1438('0x7f')][_0x1438('0x79')]||{}};_0x26375b(null,_0x14ed56);});};AGIVertices[_0x1438('0x16')][_0x1438('0x80')]=function(_0x5d0ccc,_0x3926c2){scripts['googleDialogflow'](this['channel'][_0x1438('0x3e')],_0x5d0ccc['key'],_0x5d0ccc['text'],_0x5d0ccc[_0x1438('0x81')]||'en')[_0x1438('0x19')](function(_0x41d291){_0x3926c2(null,_0x41d291);})[_0x1438('0x15')](function(_0x7ed29b){_0x3926c2(_0x7ed29b);});};AGIVertices['prototype'][_0x1438('0x82')]=function(_0x2fd66d,_0x474184){scripts[_0x1438('0x82')](this[_0x1438('0x10')][_0x1438('0x3e')],_0x2fd66d['dialogflowV2_project_id'],_0x2fd66d[_0x1438('0x83')],_0x2fd66d[_0x1438('0x84')],_0x2fd66d['text'],_0x2fd66d['dialogflowV2_language']||'en')['then'](function(_0x8e2d6b){_0x474184(null,_0x8e2d6b);})['catch'](function(_0x54ca4a){_0x474184(_0x54ca4a);});};AGIVertices[_0x1438('0x16')][_0x1438('0x85')]=function(_0xde61b6,_0x574fb8){scripts[_0x1438('0x85')](this[_0x1438('0x10')],_0xde61b6)[_0x1438('0x19')](function(_0x5b791e){_0x574fb8(null,_0x5b791e);})[_0x1438('0x15')](function(_0x2e11ec){_0x574fb8(_0x2e11ec);});};AGIVertices[_0x1438('0x16')][_0x1438('0x86')]=function(_0x34f1da,_0x5d881e){scripts[_0x1438('0x86')](_0x34f1da['key'],_0x34f1da[_0x1438('0x60')],_0x34f1da['ispeech_tts_language']||_0x1438('0x62'),_0x34f1da[_0x1438('0x87')])[_0x1438('0x19')](function(_0x556a48){_0x5d881e(null,_0x556a48);})[_0x1438('0x15')](function(_0x2c7c8f){_0x5d881e(_0x2c7c8f);});};AGIVertices[_0x1438('0x16')][_0x1438('0x88')]=function(_0x27d686,_0x49df4f,_0x3d6d6a){scripts['ispeechASR'](_0x49df4f,_0x27d686[_0x1438('0x89')],_0x27d686[_0x1438('0x8a')]||_0x1438('0x62'),this[_0x1438('0x8b')](_0x27d686[_0x1438('0x8c')])?_0x27d686[_0x1438('0x8c')]:undefined)['then'](function(_0x3626d7){_0x3d6d6a(null,_0x3626d7);})['catch'](function(_0x560c70){_0x3d6d6a(_0x560c70);});};AGIVertices[_0x1438('0x16')][_0x1438('0x8d')]=function(_0x6d9b52,_0x32215c){scripts[_0x1438('0x8d')](_0x6d9b52[_0x1438('0x8e')],_0x6d9b52['aws_secret_access_key'],_0x6d9b52[_0x1438('0x8f')],_0x6d9b52[_0x1438('0x90')]||_0x1438('0x91'),_0x6d9b52[_0x1438('0x60')],_0x6d9b52[_0x1438('0x92')]||_0x1438('0x60'))[_0x1438('0x19')](function(_0x5bf062){_0x32215c(null,_0x5bf062);})['catch'](function(_0x4c9b36){_0x32215c(_0x4c9b36);});};AGIVertices[_0x1438('0x16')][_0x1438('0x93')]=function(_0x97d08f,_0x373cdd){scripts[_0x1438('0x93')](this['channel'][_0x1438('0x3e')],_0x97d08f[_0x1438('0x8e')],_0x97d08f[_0x1438('0x94')],_0x97d08f[_0x1438('0x95')],_0x97d08f['text'],_0x97d08f[_0x1438('0x96')])[_0x1438('0x19')](function(_0x3880e4){_0x373cdd(null,_0x3880e4);})[_0x1438('0x15')](function(_0x1a054e){_0x373cdd(_0x1a054e);});};AGIVertices[_0x1438('0x16')]['googleASR']=function(_0x5b2b84,_0x568e10,_0x27874){scripts[_0x1438('0x97')](_0x568e10,_0x5b2b84[_0x1438('0x89')],_0x5b2b84[_0x1438('0x98')]||_0x1438('0x62'))[_0x1438('0x19')](function(_0x5b9bcf){_0x27874(null,_0x5b9bcf);})[_0x1438('0x15')](function(_0x16e4dd){_0x27874(_0x16e4dd);});};AGIVertices[_0x1438('0x16')][_0x1438('0x99')]=function(_0x35e275,_0x1c99bf,_0xd517e9){scripts[_0x1438('0x99')](_0x1c99bf,_0x35e275[_0x1438('0x9a')],_0x35e275['appsecret'],_0x35e275[_0x1438('0x76')])[_0x1438('0x19')](function(_0x4b7c1a){_0xd517e9(null,_0x4b7c1a);})[_0x1438('0x15')](function(_0x541ef1){_0xd517e9(_0x541ef1);});};AGIVertices[_0x1438('0x16')][_0x1438('0x9b')]=function(_0x431eac){var _0x11e1bb=_['includes'](verticesWithRetry,_0x431eac['agicommand'])?_0x431eac:_[_0x1438('0x9c')](_0x431eac);for(var _0x56176d in _0x11e1bb){if(_0x11e1bb[_0x1438('0x9d')](_0x56176d)){if(_0x11e1bb[_0x56176d]&&_[_0x1438('0x9e')](_0x11e1bb[_0x56176d])){if(_['includes'](recursiveMapAttributes,_0x56176d)){_0x11e1bb[_0x56176d]=this[_0x1438('0x9f')](_0x11e1bb[_0x56176d]);}else{_0x11e1bb[_0x56176d]=this[_0x1438('0xa0')](_0x11e1bb[_0x56176d]);}}}}return _0x11e1bb;};AGIVertices[_0x1438('0x16')][_0x1438('0xa1')]=function(_0x15d7ea){for(var _0x1515dc in _0x15d7ea){if(_0x15d7ea[_0x1438('0x9d')](_0x1515dc)){if(_['isPlainObject'](_0x15d7ea[_0x1515dc])){this[_0x1438('0xa1')](_0x15d7ea[_0x1515dc]);}else if(_['isArray'](_0x15d7ea[_0x1515dc])){for(var _0x206731=0x0;_0x206731<_0x15d7ea[_0x1515dc]['length'];_0x206731++){this[_0x1438('0xa1')](_0x15d7ea[_0x1515dc][_0x206731]);}}else if(_[_0x1438('0x9e')](_0x15d7ea[_0x1515dc])){_0x15d7ea[_0x1515dc]=this[_0x1438('0xa0')](_0x15d7ea[_0x1515dc]);}}}};AGIVertices[_0x1438('0x16')][_0x1438('0xa2')]=function(_0x32723b,_0x59a300){for(var _0x13d45b in _0x32723b){if(_0x32723b[_0x1438('0x9d')](_0x13d45b)){if(_[_0x1438('0xa3')](_0x32723b[_0x13d45b])){if(!_[_0x1438('0x49')](_0x32723b[_0x13d45b])){this[_0x1438('0xa2')](_0x32723b[_0x13d45b],util[_0x1438('0x2b')](_0x1438('0xa4'),_0x59a300,_0x13d45b));}}else if(_[_0x1438('0xa5')](_0x32723b[_0x13d45b])){for(var _0x598f87=0x0;_0x598f87<_0x32723b[_0x13d45b][_0x1438('0xa6')];_0x598f87++){this[_0x1438('0xa2')](_0x32723b[_0x13d45b][_0x598f87],util[_0x1438('0x2b')](_0x1438('0xa4'),_0x59a300,_0x13d45b+'['+_0x598f87+']'));}}else{if(!_[_0x1438('0x46')](_0x32723b[_0x13d45b])){this['channel']['setVariable'](util[_0x1438('0x2b')](_0x1438('0xa4'),_0x59a300,_0x13d45b),_0x32723b[_0x13d45b]);}}}}};AGIVertices[_0x1438('0x16')][_0x1438('0x9f')]=function(_0x26755d){try{var _0x44b2ac=JSON['parse'](_0x26755d);this[_0x1438('0xa1')](_0x44b2ac);return JSON[_0x1438('0x78')](_0x44b2ac);}catch(_0xd5f924){return this[_0x1438('0xa0')](_0x26755d);}};AGIVertices[_0x1438('0x16')][_0x1438('0xa0')]=function(_0x460f1d){var _0x2aabc3=_0x460f1d[_0x1438('0xa7')]('{');for(var _0x5b8874=0x1;_0x5b8874<_0x2aabc3[_0x1438('0xa6')];_0x5b8874+=0x1){var _0x488457=_0x2aabc3[_0x5b8874][_0x1438('0xa7')]('}');if(_0x488457['length']>0x1){_0x460f1d=_0x460f1d['replaceAll']('{'+_0x488457[0x0]+'}',this[_0x1438('0x10')][_0x1438('0xa8')](_0x488457[0x0])[_0x1438('0xa9')]||_0x488457[0x0]);}}if(_0x2aabc3[_0x1438('0xa6')]===0x1){return _0x460f1d['toString']();}return this[_0x1438('0xa0')](_0x460f1d);};AGIVertices[_0x1438('0x16')][_0x1438('0xaa')]=function(_0x5864b2,_0x1e6bbf){var _0x40d8a7=this[_0x1438('0x10')][_0x1438('0xa8')](_0x5864b2);if(_0x40d8a7[_0x1438('0xab')]===-0x1){return _0x40d8a7;}logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0xac'),_0x1e6bbf,_0x40d8a7[_0x1438('0xa9')]));return this[_0x1438('0x10')][_0x1438('0xad')](_0x1e6bbf,_0x40d8a7[_0x1438('0xa9')]);};AGIVertices[_0x1438('0x16')][_0x1438('0x8b')]=function(_0x4c154a){return _0x4c154a&&_0x4c154a!=='0'&&_0x4c154a!=='-1'&&_0x4c154a!=='';};AGIVertices['prototype'][_0x1438('0xae')]=function(_0xc94ca2){this[_0x1438('0x38')][_0x1438('0x75')](this,_0xc94ca2,'-');_0xc94ca2[_0x1438('0xaf')]=_0xc94ca2['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x1438('0x16')]['mrcpsynth']=function(_0x5a27b6){logger[_0x1438('0x30')](util['format'](_0x1438('0xb0'),_0x5a27b6[_0x1438('0x39')]));if(!this['isConfigured'](_0x5a27b6['text'])){return this[_0x1438('0x10')][_0x1438('0xb1')]('no\x20text\x20configured');}var _0x11c67c='\x22'+_0x5a27b6[_0x1438('0x60')]+'\x22';if(this[_0x1438('0x8b')](_0x5a27b6['options'])){_0x11c67c+=','+_0x5a27b6[_0x1438('0x7f')];}var _0x527c0c=this[_0x1438('0x10')]['exec'](_0x1438('0xb2'),_0x11c67c);if(_0x527c0c[_0x1438('0xab')]===-0x1){return _0x527c0c;}return this[_0x1438('0x10')]['noop'](util[_0x1438('0x2b')](_0x1438('0xb3'),_0x11c67c));};AGIVertices[_0x1438('0x16')][_0x1438('0xb4')]=function(_0x40b2f9){logger['info'](util[_0x1438('0x2b')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x40b2f9[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0x40b2f9[_0x1438('0xb5')])){return this['channel'][_0x1438('0xb1')](_0x1438('0xb6'));}var _0x52730f=_0x40b2f9[_0x1438('0xb5')];if(this[_0x1438('0x8b')](_0x40b2f9['options'])){_0x52730f+=','+_0x40b2f9[_0x1438('0x7f')];}var _0x72af49=this['channel']['exec'](_0x1438('0xb7'),_0x52730f);if(_0x72af49[_0x1438('0xab')]===-0x1){return _0x72af49;}var _0x1ebb29=this[_0x1438('0xaa')](_0x1438('0xb8'),_0x1438('0xb9'));if(_0x1ebb29[_0x1438('0xab')]===-0x1){return _0x1ebb29;}var _0x1e10a7=this[_0x1438('0xaa')](_0x1438('0xba'),_0x1438('0xbb'));if(_0x1e10a7[_0x1438('0xab')]===-0x1){return _0x1e10a7;}var _0x3e83d2=this[_0x1438('0xaa')]('RECOG_INSTANCE()',_0x1438('0xbc'));if(_0x3e83d2[_0x1438('0xab')]===-0x1){return _0x3e83d2;}return this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x52730f));};AGIVertices[_0x1438('0x16')]['agi']=function(_0x54977a){logger['info'](util['format'](_0x1438('0xbd'),_0x54977a[_0x1438('0x39')]));return this[_0x1438('0x10')]['agi']([_0x54977a['command'],_0x54977a[_0x1438('0xbe')]]);};AGIVertices['prototype'][_0x1438('0xbf')]=function(_0x102b8f){logger['info'](util['format'](_0x1438('0xc0'),_0x102b8f[_0x1438('0x39')]));if(this[_0x1438('0x8b')](_0x102b8f[_0x1438('0x6b')])){logger['info'](util['format'](_0x1438('0xc1'),_0x102b8f[_0x1438('0x6b')]));var _0x4f67dd=this['channel'][_0x1438('0xc2')](_0x102b8f['timeout']);if(_0x4f67dd[_0x1438('0xab')]===-0x1){return _0x4f67dd;}}return this['channel'][_0x1438('0xbf')]();};AGIVertices[_0x1438('0x16')][_0x1438('0x4e')]=function(_0x18e3d8){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0xc3'),_0x18e3d8[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0x18e3d8[_0x1438('0x4c')])){return this['channel'][_0x1438('0x2e')](_0x18e3d8,_0x1438('0xc4'));}_0x18e3d8[_0x1438('0x4d')]=moment();if(this[_0x1438('0x8b')](_0x18e3d8[_0x1438('0xc5')])){_0x18e3d8[_0x1438('0x4d')]=moment()[_0x1438('0xc6')](_0x18e3d8['delay'],_0x1438('0xc7'));}if(!this[_0x1438('0x8b')](_0x18e3d8[_0x1438('0x50')])){_0x18e3d8[_0x1438('0x50')]=0x2;}this[_0x1438('0x45')]['sync'](this,_0x18e3d8);return this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0xc8'),_0x18e3d8[_0x1438('0x4b')],_0x18e3d8[_0x1438('0x4c')],_0x18e3d8['scheduledAt']));};AGIVertices['prototype'][_0x1438('0xc9')]=function(_0x1f27d7){logger['info'](util['format'](_0x1438('0xca'),_0x1f27d7[_0x1438('0x39')]));var _0x461521=this[_0x1438('0x10')][_0x1438('0x5c')](_0x1f27d7[_0x1438('0xcb')],_0x1f27d7[_0x1438('0x7f')]);if(_0x461521[_0x1438('0xab')]===-0x1){return _0x461521;}return this[_0x1438('0x10')]['noop'](util['format'](_0x1438('0xcc'),_0x1f27d7['application'],_0x1f27d7['options']));};AGIVertices[_0x1438('0x16')][_0x1438('0xcd')]=function(_0x5939e9){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0xce'),_0x5939e9[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0x5939e9[_0x1438('0x60')])){return this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0xcf'));}var _0x4af2cb='\x22'+_0x5939e9[_0x1438('0x60')]+'\x22';if(this[_0x1438('0x8b')](_0x5939e9[_0x1438('0x7f')])){_0x4af2cb+=','+_0x5939e9[_0x1438('0x7f')];}var _0x3d6be4=this[_0x1438('0x10')][_0x1438('0x5c')](_0x1438('0xb2'),_0x4af2cb);if(_0x3d6be4['result']===-0x1){return _0x3d6be4;}return this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0xb3'),_0x4af2cb));};AGIVertices[_0x1438('0x16')][_0x1438('0xd0')]=function(_0x3ac72c){logger['info'](util[_0x1438('0x2b')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x3ac72c[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0x3ac72c[_0x1438('0x60')])){return this[_0x1438('0x10')][_0x1438('0xb1')]('no\x20text\x20configured');}var _0x37f05a='\x22'+_0x3ac72c['text']+'\x22';if(this[_0x1438('0x8b')](_0x3ac72c['options'])){_0x37f05a+=','+_0x3ac72c[_0x1438('0x7f')];}var _0x19ee02=this['channel']['exec'](_0x1438('0xb2'),_0x37f05a);if(_0x19ee02[_0x1438('0xab')]===-0x1){return _0x19ee02;}return this['channel'][_0x1438('0xb1')](util['format'](_0x1438('0xb3'),_0x37f05a));};AGIVertices[_0x1438('0x16')]['lumenvoxasr']=function(_0x1229ab){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0xd1'),_0x1229ab[_0x1438('0x39')]));if(!this['isConfigured'](_0x1229ab[_0x1438('0xb5')])){return this[_0x1438('0x10')]['noop'](_0x1438('0xb6'));}var _0x4181f6=_0x1229ab[_0x1438('0xb5')];if(this[_0x1438('0x8b')](_0x1229ab[_0x1438('0x7f')])){_0x4181f6+=','+_0x1229ab[_0x1438('0x7f')];}var _0x2c2fd4=this[_0x1438('0x10')][_0x1438('0x5c')](_0x1438('0xb7'),_0x4181f6);if(_0x2c2fd4[_0x1438('0xab')]===-0x1){return _0x2c2fd4;}var _0x441b7a=this[_0x1438('0xaa')](_0x1438('0xb8'),_0x1438('0xd2'));if(_0x441b7a[_0x1438('0xab')]===-0x1){return _0x441b7a;}var _0x1468d6=this['getAndSetVariable']('RECOG_INPUT()',_0x1438('0xd3'));if(_0x1468d6['result']===-0x1){return _0x1468d6;}var _0xd2e2ee=this[_0x1438('0xaa')](_0x1438('0xd4'),_0x1438('0xd5'));if(_0xd2e2ee[_0x1438('0xab')]===-0x1){return _0xd2e2ee;}return this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0xd6'),_0x4181f6));};AGIVertices['prototype'][_0x1438('0xd7')]=function(_0x1269e4){logger[_0x1438('0x30')](util[_0x1438('0x2b')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x1269e4[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0x1269e4[_0x1438('0xb5')])){return this['channel'][_0x1438('0xb1')](_0x1438('0xb6'));}var _0x4f5b6c=_0x1269e4['grammar'];if(this[_0x1438('0x8b')](_0x1269e4['options'])){_0x4f5b6c+=','+_0x1269e4['options'];}var _0x3dd59f=this['channel'][_0x1438('0x5c')](_0x1438('0xb7'),_0x4f5b6c);if(_0x3dd59f['result']===-0x1){return _0x3dd59f;}var _0x13b3c2=this[_0x1438('0xaa')](_0x1438('0xb8'),_0x1438('0xd8'));if(_0x13b3c2[_0x1438('0xab')]===-0x1){return _0x13b3c2;}var _0x291f8b=this['getAndSetVariable']('RECOG_INPUT()',_0x1438('0xd9'));if(_0x291f8b[_0x1438('0xab')]===-0x1){return _0x291f8b;}var _0x291022=this[_0x1438('0xaa')](_0x1438('0xd4'),'SESTEK_ASR_INSTANCE');if(_0x291022[_0x1438('0xab')]===-0x1){return _0x291022;}return this['channel'][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0xd6'),_0x4f5b6c));};AGIVertices[_0x1438('0x16')][_0x1438('0xda')]=function(_0x32294d){logger[_0x1438('0x30')](util['format'](_0x1438('0xdb'),_0x32294d['label']));if(!this[_0x1438('0x8b')](_0x32294d[_0x1438('0xdc')])){return this[_0x1438('0x10')]['error'](_0x32294d,_0x1438('0xdd'));}var _0x39ccd6=this['getSquareOdbc'][_0x1438('0x75')](this,_0x32294d[_0x1438('0xdc')]);if(!_0x39ccd6){return this['channel'][_0x1438('0x2e')](_0x32294d,_0x1438('0xde'));}if(!this[_0x1438('0x8b')](_0x32294d[_0x1438('0x31')])){return this[_0x1438('0x10')]['error'](_0x32294d,_0x1438('0xdf'));}var _0x478eb5=_0x32294d[_0x1438('0x31')][_0x1438('0x5e')](/(\r\n|\n|\r)/gm,'\x20');this[_0x1438('0x10')][_0x1438('0xb1')](util['format'](_0x1438('0xe0'),_0x478eb5));var _0x1ee8e5=this['getQueryOdbc'][_0x1438('0x75')](this,_0x39ccd6,_0x478eb5);this[_0x1438('0x38')][_0x1438('0x75')](this,_0x32294d,_0x478eb5);if(!this[_0x1438('0x8b')](_0x32294d['variable_id'])){return this[_0x1438('0x10')]['noop'](_0x1438('0xe1'));}var _0x5ca143=this[_0x1438('0xa8')][_0x1438('0x75')](this,_0x32294d[_0x1438('0xe2')]);if(!_0x5ca143){return this[_0x1438('0x10')]['error'](_0x32294d,_0x1438('0xe3'));}var _0x40257b=this;_0x1ee8e5['forEach'](function(_0x507adc,_0x50e8db){Object['keys'](_0x507adc)['forEach'](function(_0x19519c){_0x40257b['channel'][_0x1438('0xad')](util['format'](_0x1438('0xe4'),_0x5ca143,_0x50e8db,_0x19519c),_0x507adc[_0x19519c]);});});this[_0x1438('0x10')][_0x1438('0xad')](util['format']('%s_ROWS_COUNT',_0x5ca143),_0x1ee8e5[_0x1438('0xa6')]);return this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0xe5'),_0x5ca143));};AGIVertices[_0x1438('0x16')]['dial']=function(_0x58b353){logger[_0x1438('0xe6')](util['format'](_0x1438('0xe7'),_0x58b353[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0x58b353['sip_id'])){return this[_0x1438('0x10')][_0x1438('0x2e')](_0x58b353,_0x1438('0xe8'));}var _0x1c48ca=this[_0x1438('0x1d')][_0x1438('0x75')](this,_0x58b353[_0x1438('0xe9')]);if(!_0x1c48ca){return this[_0x1438('0x10')]['error'](_0x58b353,'no\x20user\x20found');}var _0x1f61f6=this[_0x1438('0x10')][_0x1438('0x5c')](_0x1438('0xea'),[util[_0x1438('0x2b')](_0x1438('0xeb'),_0x1c48ca),_0x58b353['timeout'],_0x58b353['opts'],_0x58b353['url']]);if(_0x1f61f6['result']===-0x1){return _0x1f61f6;}return this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')]('Executed\x20command\x20%s',_0x1438('0xea')));};AGIVertices[_0x1438('0x16')][_0x1438('0xec')]=function(_0xb05e10){logger['info'](util['format'](_0x1438('0xed'),_0xb05e10['label']));if(!this[_0x1438('0x8b')](_0xb05e10[_0x1438('0x89')])){return this[_0x1438('0x10')]['noop'](_0x1438('0xee'));}if(!this[_0x1438('0x8b')](_0xb05e10[_0x1438('0x60')])){return this[_0x1438('0x10')]['noop'](_0x1438('0xcf'));}this[_0x1438('0x10')][_0x1438('0xef')]=!![];this[_0x1438('0x38')](_0xb05e10);this[_0x1438('0x44')](_0xb05e10[_0x1438('0x60')],'in','','');this[_0x1438('0x10')][_0x1438('0xb1')](util['format'](_0x1438('0xf0'),_0xb05e10[_0x1438('0x60')]));var _0x3cc56c=this[_0x1438('0x80')][_0x1438('0x75')](this,_0xb05e10);if(_0x3cc56c){for(var _0x31f514 in _0x3cc56c){if(_0x3cc56c[_0x1438('0x9d')](_0x31f514)){this[_0x1438('0x10')][_0x1438('0xad')](util['format']('DIALOGFLOW_%s',_0x31f514[_0x1438('0x6f')]()),_0x3cc56c[_0x31f514]);}}this[_0x1438('0x44')](_0x3cc56c[_0x1438('0xf1')],_0x1438('0xf2'),'dialogflow','');return this[_0x1438('0x10')]['noop'](util[_0x1438('0x2b')](_0x1438('0xf3'),_0x3cc56c[_0x1438('0xf1')]));}return this[_0x1438('0x10')][_0x1438('0x2e')](_0xb05e10,_0x1438('0xf4'));};AGIVertices[_0x1438('0x16')]['dialogflowV2']=function(_0x390112){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0xf5'),_0x390112[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0x390112['dialogflowV2_project_id'])){return this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0xf6'));}if(!this[_0x1438('0x8b')](_0x390112[_0x1438('0x83')])){return this[_0x1438('0x10')]['noop'](_0x1438('0xf7'));}if(!this[_0x1438('0x8b')](_0x390112[_0x1438('0x84')])){return this['channel'][_0x1438('0xb1')](_0x1438('0xf8'));}if(!this['isConfigured'](_0x390112[_0x1438('0xf9')])){return this['channel'][_0x1438('0xb1')](_0x1438('0xfa'));}if(!this[_0x1438('0x8b')](_0x390112['text'])){return this[_0x1438('0x10')]['noop'](_0x1438('0xcf'));}this[_0x1438('0x10')][_0x1438('0xef')]=!![];this[_0x1438('0x38')](_0x390112);this[_0x1438('0x44')](_0x390112['text'],'in','','');this['channel'][_0x1438('0xb1')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x390112[_0x1438('0x60')]));var _0x4347ba=this['googleDialogflowV2']['sync'](this,_0x390112);if(_0x4347ba){for(var _0x6924bd in _0x4347ba){if(_0x4347ba['hasOwnProperty'](_0x6924bd)){if(_0x6924bd!==_0x1438('0xfb')){this[_0x1438('0x10')][_0x1438('0xad')](util[_0x1438('0x2b')](_0x1438('0xfc'),_0x6924bd[_0x1438('0x6f')]()),_0x4347ba[_0x6924bd]);}}}this[_0x1438('0x44')](_0x4347ba[_0x1438('0xf1')],_0x1438('0xf2'),_0x1438('0xfd'),_0x4347ba[_0x1438('0xfb')]);return this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')]('DialogflowV2\x20Result\x20%s',_0x4347ba[_0x1438('0xf1')]));}return this['channel']['error'](_0x390112,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype']['sesteknda']=function(_0x24d2ac){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0xfe'),_0x24d2ac[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0x24d2ac['ndauth_url'])){return this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0xff'));}if(!this[_0x1438('0x8b')](_0x24d2ac[_0x1438('0x100')])){return this['channel'][_0x1438('0xb1')](_0x1438('0x101'));}if(!this[_0x1438('0x8b')](_0x24d2ac['password'])){return this[_0x1438('0x10')]['noop'](_0x1438('0x102'));}if(!this[_0x1438('0x8b')](_0x24d2ac['ndassistant_url'])){return this[_0x1438('0x10')]['noop'](_0x1438('0xcf'));}this[_0x1438('0x10')][_0x1438('0xef')]=!![];this[_0x1438('0x38')](_0x24d2ac);this[_0x1438('0x44')](_0x24d2ac['text'],'in','','');this[_0x1438('0x10')]['noop'](util[_0x1438('0x2b')](_0x1438('0x103'),_0x24d2ac[_0x1438('0x60')]));var _0xdaf719=this[_0x1438('0x85')][_0x1438('0x75')](this,_0x24d2ac);if(_0xdaf719){for(var _0x3d199f in _0xdaf719){if(_0xdaf719[_0x1438('0x9d')](_0x3d199f)){this['channel'][_0x1438('0xad')](util['format'](_0x1438('0x104'),_0x3d199f[_0x1438('0x6f')]()),_0xdaf719[_0x3d199f]);}}this['createSquareMessage'](_0xdaf719[_0x1438('0xf1')],'out',_0x1438('0x105'),'');if(_0xdaf719[_0x1438('0x106')]){this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0x107'),_0xdaf719[_0x1438('0x106')]));var _0x1126f1=this[_0x1438('0x10')]['streamFile'](_0xdaf719[_0x1438('0x106')]);try{fs['unlink'](_0xdaf719[_0x1438('0x106')]+_0x1438('0x108'));}catch(_0x2b21aa){logger[_0x1438('0x2e')](_0x2b21aa);}return _0x1126f1;}else{return this['channel'][_0x1438('0xb1')](util['format'](_0x1438('0x109'),_0xdaf719[_0x1438('0xf1')]));}}return this[_0x1438('0x10')][_0x1438('0x2e')](_0x24d2ac,_0x1438('0x10a'));};AGIVertices['prototype'][_0x1438('0x10b')]=function(_0x53e84a){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x10c'),_0x53e84a['label']));return this['channel'][_0x1438('0xb1')]('end');};AGIVertices[_0x1438('0x16')][_0x1438('0x10d')]=function(_0xab19c7){logger[_0x1438('0x30')](util['format'](_0x1438('0x10e'),_0xab19c7['label']));var _0x51ef15='';if(_0xab19c7[_0x1438('0x10f')]){if(!this[_0x1438('0x8b')](_0xab19c7['trunk_id'])){return this[_0x1438('0x10')][_0x1438('0x2e')](_0xab19c7,_0x1438('0x110'));}else{var _0x317086=parseInt(_0xab19c7[_0x1438('0x10f')],0xa);if(isNaN(_0x317086)){_0x51ef15=_0xab19c7['trunk_id'];}else{_0x51ef15=this[_0x1438('0x1f')][_0x1438('0x75')](this,_0xab19c7[_0x1438('0x10f')]);if(!_0x51ef15){return this[_0x1438('0x10')][_0x1438('0x2e')](_0xab19c7,'no\x20trunk\x20found');}}}}else if(_0xab19c7[_0x1438('0x111')]){_0x51ef15=_0xab19c7[_0x1438('0x111')];}else{return this[_0x1438('0x10')][_0x1438('0x2e')](_0xab19c7,'no\x20trunk\x20selected');}var _0x40927c=this['channel'][_0x1438('0x5c')]('DIAL',[util[_0x1438('0x2b')](_0x1438('0x112'),_0x51ef15,_0xab19c7[_0x1438('0x4b')]),_0xab19c7[_0x1438('0x6b')],_0xab19c7[_0x1438('0x113')],_0xab19c7[_0x1438('0x69')]]);if(_0x40927c[_0x1438('0xab')]===-0x1){return _0x40927c;}return this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0x114'),_0x1438('0xea')));};AGIVertices[_0x1438('0x16')][_0x1438('0x115')]=function(_0x46a273){logger['info'](util[_0x1438('0x2b')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x46a273['label']));return this['channel']['noop'](_0x1438('0x115'));};AGIVertices[_0x1438('0x16')][_0x1438('0xe')]=function(_0x152873){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x116'),_0x152873[_0x1438('0x39')]));if(_0x152873['retry']===0x0){return this[_0x1438('0xae')](_0x152873);}_0x152873[_0x1438('0xaf')]-=0x1;if(!this[_0x1438('0x8b')](_0x152873[_0x1438('0x117')])){return this[_0x1438('0x10')][_0x1438('0x2e')](_0x152873,_0x1438('0x118'));}var _0x2f3e04=this[_0x1438('0x119')]['sync'](this,_0x152873[_0x1438('0x117')]);if(!_0x2f3e04){return this[_0x1438('0x10')][_0x1438('0x2e')](_0x152873,_0x1438('0x11a'));}if(!this[_0x1438('0x8b')](_0x152873['variable_id'])){return this[_0x1438('0x10')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x439b01=this[_0x1438('0x10')][_0x1438('0x11b')](_0x2f3e04,_0x152873[_0x1438('0x11c')],_0x152873[_0x1438('0x11d')]);var _0x564046=_0x439b01[_0x1438('0xab')]?_0x439b01[_0x1438('0xab')]['toString']():'';logger[_0x1438('0x30')](_0x1438('0x11e'),JSON[_0x1438('0x78')](_0x439b01));if(_0x439b01['result']===-0x1){this['createSquareDetailsReport'][_0x1438('0x75')](this,_0x152873,_0x564046);return _0x439b01;}else if(_0x439b01['extra']===_0x1438('0x6b')){_0x439b01[_0x1438('0xab')]=_0x564046[_0x1438('0xa6')]>=parseInt(_0x152873[_0x1438('0x11f')])?'x':'i';}else{_0x439b01[_0x1438('0xab')]=_0x564046[_0x1438('0xa6')]>=parseInt(_0x152873['mindigit'])&&_0x564046[_0x1438('0xa6')]<=parseInt(_0x152873['maxdigit'])?'x':'i';}var _0x231f22=this['getVariable']['sync'](this,_0x152873['variable_id']);if(!_0x231f22){return this[_0x1438('0x10')][_0x1438('0x2e')](_0x152873,'no\x20variable\x20found');}this[_0x1438('0x10')][_0x1438('0xad')](_0x231f22,_0x564046);if(this[_0x1438('0x8b')](_0x152873[_0x1438('0x120')])){var _0x524a8d=parseInt(_0x152873[_0x1438('0x120')],0xa);var _0x18f730=rs[_0x1438('0x121')]({'charset':'*','length':_0x524a8d});var _0x1100e6=_0x564046[_0x1438('0xa6')];if(_0x1100e6>0x0){if(_0x1100e6>_0x524a8d){this['createSquareDetailsReport'][_0x1438('0x75')](this,_0x152873,_0x152873[_0x1438('0x122')]===_0x1438('0x123')?_0x18f730+_0x564046[_0x1438('0x124')](_0x524a8d):_0x564046['substr'](0x0,_0x1100e6-_0x524a8d)+_0x18f730);}else{this[_0x1438('0x38')][_0x1438('0x75')](this,_0x152873,rs[_0x1438('0x121')]({'charset':'*','length':_0x1100e6}));}}else{this['createSquareDetailsReport'][_0x1438('0x75')](this,_0x152873,'');}}else{this['createSquareDetailsReport'][_0x1438('0x75')](this,_0x152873,_0x564046);}return _0x439b01;};AGIVertices[_0x1438('0x16')]['getsecretdigits']=function(_0x548a1d){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x125'),_0x548a1d['label']));return this[_0x1438('0xe')](_0x548a1d);};AGIVertices[_0x1438('0x16')]['goal']=function(_0x60c173){logger[_0x1438('0x30')](util[_0x1438('0x2b')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x60c173[_0x1438('0x39')]));this[_0x1438('0x38')][_0x1438('0x75')](this,_0x60c173,_0x60c173['goalname']);return this[_0x1438('0x10')][_0x1438('0xb1')](util['format'](_0x1438('0x126'),_0x60c173[_0x1438('0x127')]));};AGIVertices[_0x1438('0x16')]['awspolly']=function(_0x3cb07f){logger['info'](util[_0x1438('0x2b')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x3cb07f[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0x3cb07f[_0x1438('0x8e')])||!this[_0x1438('0x8b')](_0x3cb07f['aws_secret_access_key'])){return this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0x128'));}if(!this[_0x1438('0x8b')](_0x3cb07f[_0x1438('0x60')])){return this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0xcf'));}this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0x129'),_0x3cb07f['text']));var _0x39b0d2=this[_0x1438('0x8d')][_0x1438('0x75')](this,_0x3cb07f);if(_0x39b0d2){this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')]('aws\x20Polly\x20%s\x20file\x20created',_0x39b0d2));var _0x47fbfd=this[_0x1438('0x10')][_0x1438('0x12a')](_0x39b0d2);try{fs[_0x1438('0x12b')](_0x39b0d2+'.wav');}catch(_0xc451de){logger[_0x1438('0x2e')](_0xc451de);}return _0x47fbfd;}return this[_0x1438('0x10')][_0x1438('0x2e')](_0x3cb07f,_0x1438('0x12c'));};AGIVertices['prototype']['awslex']=function(_0x392741){logger[_0x1438('0x30')](util[_0x1438('0x2b')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x392741[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0x392741[_0x1438('0x8e')])||!this[_0x1438('0x8b')](_0x392741[_0x1438('0x94')])){return this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0x128'));}if(!this[_0x1438('0x8b')](_0x392741[_0x1438('0x96')])){return this['channel']['noop'](_0x1438('0x12d'));}if(!this[_0x1438('0x8b')](_0x392741[_0x1438('0x60')])){return this[_0x1438('0x10')][_0x1438('0xb1')]('no\x20text\x20configured');}this['channel'][_0x1438('0xef')]=!![];this['createSquareDetailsReport'](_0x392741);this[_0x1438('0x44')](_0x392741[_0x1438('0x60')],'in','','');this['channel']['noop'](util[_0x1438('0x2b')](_0x1438('0x12e'),_0x392741['text']));var _0x355760=this[_0x1438('0x93')]['sync'](this,_0x392741);if(_0x355760){for(var _0x4199a8 in _0x355760){if(_0x355760[_0x1438('0x9d')](_0x4199a8)&&_[_0x1438('0x9e')](_0x355760[_0x4199a8])){this[_0x1438('0x10')]['setVariable'](util[_0x1438('0x2b')](_0x1438('0x12f'),_0x4199a8[_0x1438('0x6f')]()),_0x355760[_0x4199a8]);}}if(_[_0x1438('0x46')](_0x355760[_0x1438('0x7d')])){return this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0x130'));}else{this[_0x1438('0x44')](_0x355760['message'],_0x1438('0xf2'),_0x1438('0x131'),'');return this[_0x1438('0x10')][_0x1438('0xb1')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x355760[_0x1438('0x7d')]));}}return this['channel'][_0x1438('0x2e')](_0x392741,_0x1438('0x132'));};AGIVertices[_0x1438('0x16')]['googleasr']=function(_0x5d780e){logger[_0x1438('0x30')](util['format'](_0x1438('0x133'),_0x5d780e[_0x1438('0x39')],_0x5d780e['timeout']));if(!this[_0x1438('0x8b')](_0x5d780e[_0x1438('0x89')])){return this['channel']['noop']('no\x20key\x20configured');}var _0x3cc3ea=_0x1438('0x134');var _0x5494c7=util[_0x1438('0x2b')](_0x1438('0x135'),FILES_PATH,rs[_0x1438('0x121')](0x4));var _0x24d2e6=util['format'](_0x1438('0xa4'),_0x5494c7,_0x3cc3ea);var _0x437094=!![];if(_0x5d780e['beep']==='NOBEEP'){_0x437094=![];}var _0x91b3e4=this[_0x1438('0x10')][_0x1438('0x136')](_0x5494c7,_0x3cc3ea,_0x5d780e[_0x1438('0x137')],_0x5d780e['timeout'],undefined,_0x437094);if(_0x91b3e4['result']!==-0x1){this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0x138'),_0x24d2e6));var _0x186c4e=this['googleASR'][_0x1438('0x75')](this,_0x5d780e,_0x24d2e6);if(_0x186c4e){for(var _0x2ccf1b in _0x186c4e){if(_0x186c4e['hasOwnProperty'](_0x2ccf1b)){this[_0x1438('0x10')][_0x1438('0xad')](util[_0x1438('0x2b')](_0x1438('0x139'),_0x2ccf1b[_0x1438('0x6f')]()),_0x186c4e[_0x2ccf1b]);}}return this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0x13a'),JSON[_0x1438('0x78')](_0x186c4e)));}}return _0x91b3e4;};AGIVertices[_0x1438('0x16')][_0x1438('0x13b')]=function(_0x5cbd13){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x13c'),_0x5cbd13[_0x1438('0x39')]));if(!this['isConfigured'](_0x5cbd13['appid'])){return this[_0x1438('0x10')][_0x1438('0xb1')]('no\x20appid\x20configured');}if(!this[_0x1438('0x8b')](_0x5cbd13[_0x1438('0x13d')])){return this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0x13e'));}var _0x20a4ae=_0x1438('0x134');var _0x54bec2=util['format'](_0x1438('0x135'),FILES_PATH,rs[_0x1438('0x121')](0x4));var _0x93fd33=util[_0x1438('0x2b')](_0x1438('0xa4'),_0x54bec2,_0x20a4ae);var _0x301e4e=!![];if(_0x5cbd13[_0x1438('0x13f')]===_0x1438('0x140')){_0x301e4e=![];}var _0x5564b0=this[_0x1438('0x10')][_0x1438('0x136')](_0x54bec2,_0x20a4ae,_0x5cbd13[_0x1438('0x137')],_0x5cbd13['timeout'],undefined,_0x301e4e);if(_0x5564b0[_0x1438('0xab')]!==-0x1){this[_0x1438('0x10')]['noop'](util[_0x1438('0x2b')](_0x1438('0x141'),_0x93fd33));var _0x40f677=this[_0x1438('0x99')][_0x1438('0x75')](this,_0x5cbd13,_0x93fd33);if(_0x40f677){for(var _0x3ead0a in _0x40f677){if(_0x40f677[_0x1438('0x9d')](_0x3ead0a)){this[_0x1438('0x10')][_0x1438('0xad')](util['format']('TILDE_ASR_%s',_0x3ead0a['toUpperCase']()),_0x40f677[_0x3ead0a]);}}return this['channel'][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0x142'),JSON[_0x1438('0x78')](_0x40f677)));}}return _0x5564b0;};AGIVertices[_0x1438('0x16')][_0x1438('0x143')]=function(_0x3bb67c){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x144'),_0x3bb67c['label']));return this[_0x1438('0x10')][_0x1438('0x145')](_0x3bb67c[_0x1438('0x146')],_0x3bb67c[_0x1438('0x3f')],_0x3bb67c['priority']);};AGIVertices[_0x1438('0x16')][_0x1438('0x147')]=function(_0x59fdd4){logger[_0x1438('0x30')](util[_0x1438('0x2b')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x59fdd4['label']));if(!this[_0x1438('0x8b')](_0x59fdd4[_0x1438('0x148')])){return this['channel'][_0x1438('0x2e')](_0x59fdd4,_0x1438('0x149'));}try{var _0x538022=eval(_0x59fdd4[_0x1438('0x148')])?'true':_0x1438('0x14a');this[_0x1438('0x10')]['noop'](util[_0x1438('0x2b')]('EVAL\x20CONDITION\x20%s\x20%s',_0x59fdd4['condition'],_0x538022));return{'code':0xc8,'result':_0x538022};}catch(_0x176a0e){return{'code':0xc8,'result':_0x1438('0x14a')};}};AGIVertices[_0x1438('0x16')][_0x1438('0x14b')]=function(_0x4158ee){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x14c'),_0x4158ee[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0x4158ee[_0x1438('0x14d')])){return this[_0x1438('0x10')][_0x1438('0x2e')](_0x4158ee,_0x1438('0x14e'));}var _0x2cbee4=this['getIntervals']['sync'](this,_0x4158ee[_0x1438('0x14d')]);if(!_0x2cbee4){return this[_0x1438('0x10')][_0x1438('0x2e')](_0x4158ee,_0x1438('0x14f'));}for(var _0x4146f5=0x0;_0x4146f5<_0x2cbee4[_0x1438('0xa6')];_0x4146f5+=0x1){var _0x193751=this[_0x1438('0x10')][_0x1438('0xa8')](util[_0x1438('0x2b')](_0x1438('0x150'),_0x2cbee4[_0x4146f5]));if(_0x193751[_0x1438('0xab')]===-0x1){return _0x193751;}logger['info'](util[_0x1438('0x2b')](_0x1438('0x151'),_0x2cbee4[_0x4146f5],_0x193751[_0x1438('0xa9')]));if(_0x193751[_0x1438('0xa9')]==='true'){logger[_0x1438('0x30')](util['format'](_0x1438('0x151'),_0x2cbee4[_0x4146f5],_0x1438('0x152')));this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0x151'),_0x2cbee4[_0x4146f5],_0x1438('0x152')));return{'code':0xc8,'result':_0x1438('0x152')};}else{logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x151'),_0x2cbee4[_0x4146f5],_0x1438('0x14a')));this[_0x1438('0x10')]['noop'](util[_0x1438('0x2b')](_0x1438('0x151'),_0x2cbee4[_0x4146f5],_0x1438('0x14a')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x1438('0x153')]=function(_0x3d1f52){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x154'),_0x3d1f52[_0x1438('0x39')]));return this[_0x1438('0x10')][_0x1438('0x153')]();};AGIVertices[_0x1438('0x16')][_0x1438('0x155')]=function(_0x21a115){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x156'),_0x21a115[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0x21a115[_0x1438('0x89')])){return this[_0x1438('0x10')]['noop'](_0x1438('0xee'));}var _0x178ee2=_0x1438('0x134');var _0x1f4dfe=util[_0x1438('0x2b')](_0x1438('0x135'),FILES_PATH,rs['generate'](0x4));var _0x4c8bc7=util[_0x1438('0x2b')](_0x1438('0xa4'),_0x1f4dfe,_0x178ee2);var _0xb2db44=!![];if(_0x21a115[_0x1438('0x13f')]===_0x1438('0x140')){_0xb2db44=![];}var _0x127838=this[_0x1438('0x10')]['recordFile'](_0x1f4dfe,_0x178ee2,_0x21a115[_0x1438('0x137')],_0x21a115[_0x1438('0x6b')],undefined,_0xb2db44);if(_0x127838[_0x1438('0xab')]!==-0x1){this[_0x1438('0x10')][_0x1438('0xb1')](util['format'](_0x1438('0x157'),_0x4c8bc7));var _0x4fd280=this[_0x1438('0x88')][_0x1438('0x75')](this,_0x21a115,_0x4c8bc7);if(_0x4fd280){for(var _0x1568e4 in _0x4fd280){if(_0x4fd280['hasOwnProperty'](_0x1568e4)){this['channel']['setVariable'](util['format'](_0x1438('0x158'),_0x1568e4[_0x1438('0x6f')]()),_0x4fd280[_0x1568e4]);}}return this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0x159'),JSON[_0x1438('0x78')](_0x4fd280)));}}return _0x127838;};AGIVertices[_0x1438('0x16')][_0x1438('0x15a')]=function(_0x6d4bd0){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x15b'),_0x6d4bd0[_0x1438('0x39')]));if(!this['isConfigured'](_0x6d4bd0[_0x1438('0x89')])){return this[_0x1438('0x10')][_0x1438('0xb1')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x6d4bd0[_0x1438('0x60')])){return this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0xcf'));}this['channel'][_0x1438('0xb1')](util[_0x1438('0x2b')]('Trying\x20ispeech\x20TTS\x20%s',_0x6d4bd0[_0x1438('0x60')]));var _0x3f2174=this[_0x1438('0x86')][_0x1438('0x75')](this,_0x6d4bd0);if(_0x3f2174){this['channel'][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0x157'),_0x3f2174));var _0xd8314c=this['channel'][_0x1438('0x12a')](_0x3f2174,_0x6d4bd0[_0x1438('0x137')]);try{fs['unlink'](_0x3f2174+_0x1438('0x108'));}catch(_0x116f7e){logger[_0x1438('0x2e')](_0x116f7e);}return _0xd8314c;}return this[_0x1438('0x10')][_0x1438('0x2e')](_0x6d4bd0,_0x1438('0x15c'));};AGIVertices[_0x1438('0x16')][_0x1438('0x15d')]=function(_0x95f1f2){logger['info'](util[_0x1438('0x2b')](_0x1438('0x15e'),_0x95f1f2[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0x95f1f2[_0x1438('0x15f')])){return this[_0x1438('0x10')]['error'](_0x95f1f2,'no\x20find\x20by\x20configured');}logger[_0x1438('0x30')](util[_0x1438('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x1438('0x10')]['callerid'],_0x95f1f2[_0x1438('0x15f')]));var _0x393079=this[_0x1438('0x57')]['sync'](this,_0x95f1f2[_0x1438('0x15f')]);if(_0x393079){logger[_0x1438('0x30')](util['format'](_0x1438('0x160'),this['channel'][_0x1438('0x3c')],_0x95f1f2[_0x1438('0x15f')]));this['channel'][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0x160'),this[_0x1438('0x10')]['callerid'],_0x95f1f2['findBy']));return{'code':0xc8,'result':_0x1438('0x161')};}else{logger[_0x1438('0x30')](util['format'](_0x1438('0x162'),this['channel'][_0x1438('0x3c')],_0x95f1f2[_0x1438('0x15f')]));this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0x162'),this[_0x1438('0x10')][_0x1438('0x3c')],_0x95f1f2[_0x1438('0x15f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x1438('0x163')]=function(_0x4a672c){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x164'),_0x4a672c['label']));if(!this['isConfigured'](_0x4a672c[_0x1438('0x15f')])){return this['channel']['error'](_0x4a672c,'no\x20find\x20by\x20configured');}logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x165'),this[_0x1438('0x10')][_0x1438('0x3c')],_0x4a672c['findBy']));var _0x4f6181=this[_0x1438('0x56')][_0x1438('0x75')](this,_0x4a672c['findBy']);if(_0x4f6181){logger[_0x1438('0x30')](util[_0x1438('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1438('0x10')][_0x1438('0x3c')],_0x4a672c[_0x1438('0x15f')]));this['channel'][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0x160'),this[_0x1438('0x10')][_0x1438('0x3c')],_0x4a672c[_0x1438('0x15f')]));return{'code':0xc8,'result':'success'};}else{logger[_0x1438('0x30')](util[_0x1438('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x1438('0x3c')],_0x4a672c[_0x1438('0x15f')]));this['channel']['noop'](util[_0x1438('0x2b')](_0x1438('0x162'),this['channel'][_0x1438('0x3c')],_0x4a672c[_0x1438('0x15f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x1438('0x16')][_0x1438('0x166')]=function(_0x23a73d){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x167'),_0x23a73d[_0x1438('0x39')]));if(!this['isConfigured'](_0x23a73d[_0x1438('0x168')])){return this[_0x1438('0x10')][_0x1438('0x2e')](_0x23a73d,_0x1438('0x169'));}this['channel'][_0x1438('0xb1')](util['format'](_0x1438('0x16a'),_0x23a73d[_0x1438('0x168')]));var _0xd587b4=eval(_0x23a73d[_0x1438('0x168')]);if(!this[_0x1438('0x8b')](_0x23a73d[_0x1438('0xe2')])){return this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0xe1'));}var _0x54b93f=this[_0x1438('0xa8')][_0x1438('0x75')](this,_0x23a73d['variable_id']);if(!_0x54b93f){return this[_0x1438('0x10')]['error'](_0x23a73d,'no\x20variable\x20found');}if(_['isArray'](_0xd587b4)){var _0x56e65e=this;_0xd587b4['forEach'](function(_0x46bf3f,_0x2ef768){_0x56e65e[_0x1438('0x10')][_0x1438('0xad')](util[_0x1438('0x2b')](_0x1438('0x16b'),_0x54b93f,_0x2ef768),_0x46bf3f);});return this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0x16c'),_0x54b93f));}else{return this[_0x1438('0x10')]['setVariable'](_0x54b93f,_0xd587b4);}};AGIVertices['prototype'][_0x1438('0xd')]=function(_0x3aa2cc){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x16d'),_0x3aa2cc[_0x1438('0x39')]));if(_0x3aa2cc[_0x1438('0xaf')]===0x0){return this[_0x1438('0xae')](_0x3aa2cc);}_0x3aa2cc[_0x1438('0xaf')]-=0x1;if(!this[_0x1438('0x8b')](_0x3aa2cc['file_id'])){return this[_0x1438('0x10')][_0x1438('0x2e')](_0x3aa2cc,'no\x20file\x20audio\x20selected');}var _0x7189e4=this['getSound'][_0x1438('0x75')](this,_0x3aa2cc['file_id']);if(!_0x7189e4){return this[_0x1438('0x10')][_0x1438('0x2e')](_0x3aa2cc,_0x1438('0x11a'));}var _0xbd39e8=this[_0x1438('0x10')][_0x1438('0x11b')](_0x7189e4,_0x3aa2cc[_0x1438('0x11c')],_0x3aa2cc[_0x1438('0x16e')]);var _0x13300f=_0xbd39e8[_0x1438('0xab')];if(_0xbd39e8[_0x1438('0xab')]===-0x1){this[_0x1438('0x38')][_0x1438('0x75')](this,_0x3aa2cc,'-1');return _0xbd39e8;}else if(_0xbd39e8[_0x1438('0xa9')]==='timeout'){_0xbd39e8[_0x1438('0xab')]=_0xbd39e8[_0x1438('0xab')]['length']>0x0?_0xbd39e8[_0x1438('0xab')]:'t';}else if(_[_0x1438('0x49')](_0xbd39e8[_0x1438('0xab')])){_0xbd39e8[_0x1438('0xab')]='#';_0x13300f='#';}if(!this[_0x1438('0x8b')](_0x3aa2cc[_0x1438('0xe2')])){this[_0x1438('0x10')][_0x1438('0xb1')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x101107=this[_0x1438('0xa8')][_0x1438('0x75')](this,_0x3aa2cc[_0x1438('0xe2')]);if(!_0x101107){return this[_0x1438('0x10')][_0x1438('0x2e')](_0x3aa2cc,_0x1438('0xe3'));}this[_0x1438('0x10')][_0x1438('0xad')](_0x101107,_0x13300f);}this[_0x1438('0x38')][_0x1438('0x75')](this,_0x3aa2cc,_0x13300f);return _0xbd39e8;};AGIVertices[_0x1438('0x16')][_0x1438('0xb1')]=function(_0x47b688){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x16f'),_0x47b688[_0x1438('0x39')]));return this['channel'][_0x1438('0xb1')](_0x47b688['output']||_0x47b688[_0x1438('0x39')]);};AGIVertices[_0x1438('0x16')]['pause']=function(_0x2473ad){logger[_0x1438('0x30')](util['format'](_0x1438('0x170'),_0x2473ad[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0x2473ad[_0x1438('0x15f')])){return this[_0x1438('0x10')][_0x1438('0x2e')](_0x2473ad,_0x1438('0x171'));}logger[_0x1438('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x2473ad[_0x1438('0x15f')]));var _0x3c4c04=this[_0x1438('0x51')][_0x1438('0x75')](this,_0x2473ad['pause_id']);var _0x58d4df=this[_0x1438('0x53')][_0x1438('0x75')](this,_0x2473ad[_0x1438('0x15f')],_0x3c4c04);if(_0x58d4df){logger['info'](util[_0x1438('0x2b')](_0x1438('0x160'),this[_0x1438('0x10')]['callerid'],_0x2473ad[_0x1438('0x15f')]));this[_0x1438('0x10')]['noop'](util[_0x1438('0x2b')](_0x1438('0x160'),this[_0x1438('0x10')][_0x1438('0x3c')],_0x2473ad['findBy']));return{'code':0xc8,'result':_0x1438('0x161')};}else{logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x162'),this[_0x1438('0x10')]['callerid'],_0x2473ad[_0x1438('0x15f')]));this[_0x1438('0x10')][_0x1438('0xb1')](util['format'](_0x1438('0x160'),this[_0x1438('0x10')]['callerid'],_0x2473ad[_0x1438('0x15f')]));return{'code':0xc8,'result':_0x1438('0x172')};}};AGIVertices[_0x1438('0x16')]['playback']=function(_0xcb76dd){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x173'),_0xcb76dd[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0xcb76dd[_0x1438('0x117')])){return this[_0x1438('0x10')][_0x1438('0x2e')](_0xcb76dd,_0x1438('0x118'));}var _0x6420f4=this[_0x1438('0x119')][_0x1438('0x75')](this,_0xcb76dd['file_id']);if(!_0x6420f4){return this[_0x1438('0x10')][_0x1438('0x2e')](_0xcb76dd,'no\x20file\x20audio\x20found');}var _0x23ed05=this[_0x1438('0x10')][_0x1438('0x5c')]('PLAYBACK',[_0x6420f4,_0xcb76dd[_0x1438('0x113')]]);if(_0x23ed05[_0x1438('0xab')]===-0x1){return _0x23ed05;}return this['channel'][_0x1438('0xb1')](util['format'](_0x1438('0xcc'),'PLAYBACK',_0x6420f4));};AGIVertices['prototype'][_0x1438('0x174')]=function(_0x572399){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x175'),_0x572399['label']));if(!this[_0x1438('0x8b')](_0x572399[_0x1438('0x176')])){return this[_0x1438('0x10')][_0x1438('0x2e')](_0x572399,_0x1438('0x177'));}var _0x565854='';var _0x75dbc=parseInt(_0x572399[_0x1438('0x176')],0xa);if(isNaN(_0x75dbc)){_0x565854=_0x572399[_0x1438('0x176')];}else{_0x565854=this['getVoiceQueue']['sync'](this,_0x572399[_0x1438('0x176')]);if(!_0x565854){return this[_0x1438('0x10')][_0x1438('0x2e')](_0x572399,'no\x20queue\x20found');}}var _0xbb07db='';if(this['isConfigured'](_0x572399[_0x1438('0x117')])){var _0x44340c=this[_0x1438('0x119')][_0x1438('0x75')](this,_0x572399[_0x1438('0x117')]);if(_0x44340c){_0xbb07db=_0x44340c;}}this['createSquareDetailsReport']['sync'](this,_0x572399,_0x565854);if(_0x572399[_0x1438('0x113')][_0x1438('0x178')]('x')<0x0){_0x572399[_0x1438('0x113')]+='x';}if(_0x572399['opts'][_0x1438('0x178')]('X')<0x0){_0x572399[_0x1438('0x113')]+='X';}this['channel'][_0x1438('0xad')](_0x1438('0x179'),_0x565854?_0x565854['toLowerCase']():'');var _0x4a8aae=this['channel']['exec']('QUEUE',[_0x565854,_0x572399[_0x1438('0x113')],_0x572399[_0x1438('0x69')],_0xbb07db,_0x572399['timeout'],_0x572399[_0x1438('0x17a')],_0x572399[_0x1438('0x17b')],_0x572399['gosub'],'',_0x572399[_0x1438('0x17c')]]);if(_0x4a8aae[_0x1438('0xab')]===-0x1){return _0x4a8aae;}return this[_0x1438('0x10')][_0x1438('0xb1')](util['format'](_0x1438('0xcc'),'QUEUE',_0x565854));};AGIVertices['prototype'][_0x1438('0x17d')]=function(_0x20ffb7){logger[_0x1438('0x30')](util[_0x1438('0x2b')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x20ffb7[_0x1438('0x39')]));var _0x49ba25=_0x20ffb7[_0x1438('0x17e')]||_0x1438('0x134');var _0x3b57f2=util['format'](_0x1438('0x17f'),this['channel'][_0x1438('0x3e')],rs['generate'](0x5));var _0x509649=util[_0x1438('0x2b')]('%s/recordings/%s.%s',FILES_PATH,_0x3b57f2,_0x49ba25);var _0x5060fd=util['format'](_0x1438('0x135'),FILES_PATH,_0x3b57f2);this['createSquareRecording'][_0x1438('0x75')](this,_0x20ffb7,_0x3b57f2,_0x509649);this[_0x1438('0x10')][_0x1438('0xad')](_0x1438('0x180'),_0x3b57f2);logger[_0x1438('0x30')](_0x1438('0x181'),_0x5060fd,_0x49ba25,_0x20ffb7['escape_digits'],_0x20ffb7[_0x1438('0x6b')]);return this['channel'][_0x1438('0x136')](_0x5060fd,_0x49ba25,_0x20ffb7[_0x1438('0x182')],_0x20ffb7[_0x1438('0x6b')],undefined,!![]);};AGIVertices[_0x1438('0x16')][_0x1438('0x183')]=function(_0x1f5f00){logger['info'](util[_0x1438('0x2b')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x1f5f00['label']));if(!this['isConfigured'](_0x1f5f00[_0x1438('0x69')])){return this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0x184'));}var _0x4d7ff0=this[_0x1438('0x68')]['sync'](this,_0x1f5f00);logger[_0x1438('0x30')](util[_0x1438('0x2b')]('Response:',util['inspect'](_0x4d7ff0,{'showHidden':![],'depth':null})));if(!this[_0x1438('0x8b')](_0x1f5f00[_0x1438('0xe2')])){return this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0x185'));}var _0x5a8b34=this['getVariable'][_0x1438('0x75')](this,_0x1f5f00[_0x1438('0xe2')]);if(!_0x5a8b34){return this['channel'][_0x1438('0x2e')](_0x1f5f00,_0x1438('0xe3'));}this['channel'][_0x1438('0xad')](util['format'](_0x1438('0x186'),_0x5a8b34),_0x4d7ff0[_0x1438('0x7b')]?_0x4d7ff0[_0x1438('0x7b')]:'200');this[_0x1438('0x10')]['setVariable'](util['format'](_0x1438('0x187'),_0x5a8b34),_0x4d7ff0[_0x1438('0x7c')]?_0x4d7ff0[_0x1438('0x7c')]:'OK');if(_0x4d7ff0[_0x1438('0x79')]){try{this[_0x1438('0xa2')](_0x4d7ff0[_0x1438('0x79')],_0x5a8b34);}catch(_0x232f7d){logger[_0x1438('0x2e')](util[_0x1438('0x2b')](_0x1438('0x188'),_0x5a8b34));}}return this[_0x1438('0x10')]['noop'](util[_0x1438('0x2b')]('variable\x20%s\x20set',_0x5a8b34));};AGIVertices['prototype'][_0x1438('0x189')]=function(_0x463600){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x18a'),_0x463600[_0x1438('0x39')]));return this[_0x1438('0x10')][_0x1438('0x18b')](_0x463600[_0x1438('0x18c')][_0x1438('0x5e')](/\s+/g,''),_0x463600[_0x1438('0x182')]);};AGIVertices[_0x1438('0x16')]['saynumber']=function(_0x2667c5){logger['info'](util['format'](_0x1438('0x18d'),_0x2667c5[_0x1438('0x39')]));return this['channel'][_0x1438('0x18e')](_0x2667c5[_0x1438('0x6a')]['replace'](/\s+/g,''),_0x2667c5[_0x1438('0x182')]);};AGIVertices[_0x1438('0x16')][_0x1438('0x18f')]=function(_0x127bd6){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x190'),_0x127bd6[_0x1438('0x39')]));return this['channel'][_0x1438('0x191')](_0x127bd6['text'],_0x127bd6[_0x1438('0x182')]);};AGIVertices[_0x1438('0x16')][_0x1438('0x192')]=function(_0x50b0f3){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x193'),_0x50b0f3['label']));if(!this[_0x1438('0x8b')](_0x50b0f3[_0x1438('0x194')])){return this[_0x1438('0x10')][_0x1438('0xb1')]('no\x20mail\x20account\x20configured');}var _0x5d3351=this[_0x1438('0x23')][_0x1438('0x75')](this,_0x50b0f3['account_id']);if(!_0x5d3351||!_0x5d3351[_0x1438('0x195')]){return this[_0x1438('0x10')][_0x1438('0x2e')](_0x50b0f3,_0x1438('0x196'));}var _0x5799f4={'from':util[_0x1438('0x2b')](_0x1438('0x197'),_0x5d3351[_0x1438('0x14')],_0x5d3351[_0x1438('0x198')]||_0x5d3351['Smtp'][_0x1438('0x199')]),'to':_0x50b0f3['to']||'','cc':_0x50b0f3['cc']||'','bcc':_0x50b0f3['bcc']||'','subject':_0x50b0f3['subject'],'html':_0x50b0f3[_0x1438('0x60')],'text':_0x50b0f3[_0x1438('0x60')]};var _0x115529={'tls':{'rejectUnauthorized':![]}};if(_0x5d3351['Smtp'][_0x1438('0x19a')]){_0x115529[_0x1438('0x19a')]=_0x5d3351[_0x1438('0x195')]['service'];}else{_0x115529['host']=_0x5d3351[_0x1438('0x195')][_0x1438('0x19b')];_0x115529[_0x1438('0x19c')]=_0x5d3351['Smtp'][_0x1438('0x19c')];_0x115529['secure']=_0x5d3351['Smtp'][_0x1438('0x19d')];}if(_0x5d3351[_0x1438('0x195')][_0x1438('0x19e')]){_0x115529[_0x1438('0x19f')]={'user':_0x5d3351[_0x1438('0x195')][_0x1438('0x199')],'pass':_0x5d3351[_0x1438('0x195')]['pass']};}if(this['isConfigured'](_0x50b0f3[_0x1438('0x1a0')])){}logger[_0x1438('0xe6')](_0x1438('0x1a1'),JSON[_0x1438('0x78')](_0x5799f4));this['createSquareDetailsReport'][_0x1438('0x75')](this,_0x50b0f3,_0x50b0f3[_0x1438('0x194')]);this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x5d3351[_0x1438('0x14')]));this[_0x1438('0x25')][_0x1438('0x75')](this,_0x115529,_0x5799f4);return this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0x1a2'));};AGIVertices[_0x1438('0x16')][_0x1438('0x1a3')]=function(_0x528199){logger['info'](util[_0x1438('0x2b')](_0x1438('0x1a4'),_0x528199[_0x1438('0x39')]));return this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0x1a5'));};AGIVertices[_0x1438('0x16')][_0x1438('0x1a6')]=function(_0x27db1b){logger[_0x1438('0x30')](util[_0x1438('0x2b')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x27db1b[_0x1438('0x39')]));if(!this['isConfigured'](_0x27db1b[_0x1438('0x1a7')])){return this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0x1a8'));}var _0x2b39b4=this[_0x1438('0x35')][_0x1438('0x75')](this,_0x27db1b[_0x1438('0x1a7')]);if(!_0x2b39b4){return this[_0x1438('0x10')]['error'](_0x27db1b,_0x1438('0x1a9'));}var _0x2043c1={'body':_0x27db1b[_0x1438('0x1aa')],'phone':_0x27db1b['to']||'','SmsAccountId':_0x2b39b4['id']};logger['debug'](_0x1438('0x1ab'),JSON[_0x1438('0x78')](_0x2043c1));this['createSquareDetailsReport'][_0x1438('0x75')](this,_0x27db1b,_0x27db1b[_0x1438('0x1a7')]);this['channel']['noop'](util[_0x1438('0x2b')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x2b39b4[_0x1438('0x14')]));this['createSmsMessage']['sync'](this,_0x2043c1);return this[_0x1438('0x10')]['noop'](_0x1438('0x1ac'));};AGIVertices[_0x1438('0x16')]['set']=function(_0x433691){logger[_0x1438('0x30')](util['format'](_0x1438('0x1ad'),_0x433691[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0x433691[_0x1438('0xe2')])){return this[_0x1438('0x10')][_0x1438('0x2e')](_0x433691,_0x1438('0x1ae'));}var _0x2d16d2=this['getVariable'][_0x1438('0x75')](this,_0x433691['variable_id']);if(!_0x2d16d2){return this[_0x1438('0x10')][_0x1438('0x2e')](_0x433691,'no\x20variable\x20found');}return this[_0x1438('0x10')]['setVariable'](_0x2d16d2,_0x433691[_0x1438('0x1af')]);};AGIVertices['prototype'][_0x1438('0x1b0')]=function(_0x314aca){logger['info'](util['format'](_0x1438('0x1b1'),_0x314aca[_0x1438('0x39')]));this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0x1b2'));if(_0x314aca[_0x1438('0xbf')]===_0x1438('0x1b3')){this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0x1b4'));return this[_0x1438('0x10')][_0x1438('0xbf')]();}return this[_0x1438('0x10')][_0x1438('0xb1')]('Skipped\x20Answer');};AGIVertices['prototype'][_0x1438('0x1b5')]=function(_0x4bc53d){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x1b6'),_0x4bc53d[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0x4bc53d[_0x1438('0x1b7')])){return this[_0x1438('0x10')]['error'](_0x4bc53d,'no\x20subproject\x20selected');}var _0x32eab8=this[_0x1438('0x1a')]['sync'](this,_0x4bc53d[_0x1438('0x1b7')]);if(!this[_0x1438('0x8b')](_0x32eab8)){return this[_0x1438('0x10')]['error'](_0x4bc53d,util[_0x1438('0x2b')](_0x1438('0x1b8'),_0x4bc53d['project_id']));}if(_0x32eab8===this[_0x1438('0x10')][_0x1438('0x3b')]){return this['channel']['error'](_0x4bc53d,_0x1438('0x1b9'));}this['createSquareDetailsReport'][_0x1438('0x75')](this,_0x4bc53d,_0x32eab8);var _0x477a47=this[_0x1438('0x10')]['exec'](_0x1438('0x1ba'),util[_0x1438('0x2b')](_0x1438('0x1bb'),config[_0x1438('0x17a')]['host']||_0x1438('0x1bc'),_0x32eab8,this[_0x1438('0x10')][_0x1438('0x3b')]));if(_0x477a47[_0x1438('0xab')]===-0x1){return _0x477a47;}return this[_0x1438('0x10')][_0x1438('0xb1')](util['format']('Executed\x20command\x20%s\x20%s',_0x1438('0x1ba'),_0x32eab8));};AGIVertices['prototype'][_0x1438('0x1bd')]=function(_0x31d864){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x1be'),_0x31d864[_0x1438('0x39')]));var _0x2d113d=this[_0x1438('0x5b')][_0x1438('0x75')](this,_0x31d864['command']);this[_0x1438('0x38')]['sync'](this,_0x31d864,_0x31d864[_0x1438('0x1bf')]);if(this['isConfigured'](_0x31d864[_0x1438('0xe2')])){var _0x61b460=this['getVariable']['sync'](this,_0x31d864[_0x1438('0xe2')]);if(_0x61b460){this['channel'][_0x1438('0xad')](_0x61b460,_0x2d113d);return this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0x1c0'),_0x31d864[_0x1438('0x1bf')],_0x61b460));}}return this[_0x1438('0x10')]['noop'](util['format'](_0x1438('0x1c1'),_0x31d864['command']));};AGIVertices[_0x1438('0x16')][_0x1438('0x1c2')]=function(_0x24e291){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x1c3'),_0x24e291[_0x1438('0x39')]));_0x24e291[_0x1438('0x60')]=_0x24e291[_0x1438('0x60')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x24e291[_0x1438('0x1c4')])){return this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0x1c5'));}if(!this[_0x1438('0x8b')](_0x24e291[_0x1438('0x60')])){return this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0xcf'));}this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x24e291['text']));var _0x567ed2=this[_0x1438('0x5f')][_0x1438('0x75')](this,_0x24e291);if(_0x567ed2){this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0x1c6'),_0x567ed2));var _0x16b4fb=this[_0x1438('0x10')]['streamFile'](_0x567ed2);try{fs[_0x1438('0x12b')](_0x567ed2+_0x1438('0x108'));}catch(_0x283106){logger['error'](_0x283106);}return _0x16b4fb;}return this[_0x1438('0x10')][_0x1438('0x2e')](_0x24e291,_0x1438('0x1c7'));};AGIVertices[_0x1438('0x16')]['tts']=function(_0xcb04d1){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x1c8'),_0xcb04d1[_0x1438('0x39')]));_0xcb04d1[_0x1438('0x60')]=_0xcb04d1['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1438('0x8b')](_0xcb04d1[_0x1438('0x60')])){return this[_0x1438('0x10')][_0x1438('0xb1')](_0x1438('0xcf'));}this[_0x1438('0x10')]['noop'](util['format']('Trying\x20Google\x20TTS\x20%s',_0xcb04d1[_0x1438('0x60')]));var _0x470d4c=this['googleTTS'][_0x1438('0x75')](this,_0xcb04d1);if(_0x470d4c){this[_0x1438('0x10')]['noop'](util[_0x1438('0x2b')]('Google\x20TTS\x20%s\x20file\x20created',_0x470d4c));var _0x5f09d4=this[_0x1438('0x10')][_0x1438('0x12a')](_0x470d4c);try{fs[_0x1438('0x12b')](_0x470d4c+'.wav');}catch(_0x24ae19){logger[_0x1438('0x2e')](_0x24ae19);}return _0x5f09d4;}return this[_0x1438('0x10')]['error'](_0xcb04d1,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x1438('0x16')][_0x1438('0x1c9')]=function(_0x241298){logger[_0x1438('0x30')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x241298[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0x241298[_0x1438('0x15f')])){return this['channel'][_0x1438('0x2e')](_0x241298,_0x1438('0x171'));}logger[_0x1438('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x1438('0x10')][_0x1438('0x3c')],_0x241298[_0x1438('0x15f')]));var _0x574d0f=this[_0x1438('0x54')]['sync'](this,_0x241298[_0x1438('0x15f')]);if(_0x574d0f){logger[_0x1438('0x30')](util[_0x1438('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1438('0x10')][_0x1438('0x3c')],_0x241298[_0x1438('0x15f')]));this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0x160'),this[_0x1438('0x10')][_0x1438('0x3c')],_0x241298['findBy']));return{'code':0xc8,'result':_0x1438('0x161')};}else{logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x162'),this['channel'][_0x1438('0x3c')],_0x241298[_0x1438('0x15f')]));this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0x162'),this['channel'][_0x1438('0x3c')],_0x241298[_0x1438('0x15f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x1438('0x16')][_0x1438('0x1ca')]=function(_0x4385fa){logger[_0x1438('0x30')](util[_0x1438('0x2b')](_0x1438('0x1cb'),_0x4385fa[_0x1438('0x39')]));var _0x237090=this[_0x1438('0x10')][_0x1438('0x5c')](_0x1438('0x1cc'),[_0x4385fa[_0x1438('0x1cd')],_0x4385fa[_0x1438('0x7f')]]);if(_0x237090['result']===-0x1){return _0x237090;}return this[_0x1438('0x10')][_0x1438('0xb1')](util[_0x1438('0x2b')](_0x1438('0xcc'),_0x1438('0x1cc'),_0x4385fa[_0x1438('0x1cd')]));};AGIVertices[_0x1438('0x16')][_0x1438('0x1ce')]=function(_0x4ed2fe){logger[_0x1438('0x30')](util['format'](_0x1438('0x1cf'),_0x4ed2fe[_0x1438('0x39')]));if(!this[_0x1438('0x8b')](_0x4ed2fe[_0x1438('0xe2')])){return this[_0x1438('0x10')][_0x1438('0x2e')](_0x4ed2fe,'no\x20variable\x20selected');}var _0x550029=this[_0x1438('0xa8')]['sync'](this,_0x4ed2fe[_0x1438('0xe2')]);if(!_0x550029){return this[_0x1438('0x10')]['error'](_0x4ed2fe,_0x1438('0xe3'));}var _0x22653b=this[_0x1438('0x10')][_0x1438('0xa8')](_0x550029);return{'code':0xc8,'result':_0x22653b[_0x1438('0xa9')]?_0x22653b['extra']:'-'};};String['prototype'][_0x1438('0x1d0')]=function(_0x458cf6,_0x621bf6){return this[_0x1438('0xa7')](_0x458cf6)[_0x1438('0x1d1')](_0x621bf6);};module['exports']=AGIVertices; \ No newline at end of file +var _0x4e2e=['sms_account_id','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','prototype','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','then','getUser','getTrunkById','getSound','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','PUT','method','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','render','stringify','body','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appsecret','agicommand','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','saveRestApiResult','%s.%s','isArray','setVariable','replaceObjectAllVariables','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','callback_priority','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s_ROWS_COUNT','debug','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','no\x20valid\x20credentials\x20configured','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','appid','no\x20appid\x20configured','%s/recordings/%s','NOBEEP','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','indexOf','toLowerCase','QUEUE','macro','position','record','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','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>','user','bcc','subject','service','host','port','secure','authentication','auth','pass','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block'];(function(_0xb02168,_0x315466){var _0x59b8bb=function(_0x120555){while(--_0x120555){_0xb02168['push'](_0xb02168['shift']());}};_0x59b8bb(++_0x315466);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x1dd1ea,_0x458cc3){_0x1dd1ea=_0x1dd1ea-0x0;var _0x3b63ca=_0x4e2e[_0x1dd1ea];return _0x3b63ca;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xe4e2('0x0'));var _=require(_0xe4e2('0x1'));var sh=require(_0xe4e2('0x2'));var odbc=require(_0xe4e2('0x3'))();var rs=require(_0xe4e2('0x4'));var moment=require(_0xe4e2('0x5'));var Mustache=require('mustache');var rp=require(_0xe4e2('0x6'));var logger=require(_0xe4e2('0x7'))(_0xe4e2('0x8'));var config=require(_0xe4e2('0x9'));var scripts=require('./scripts');var FILES_PATH=_0xe4e2('0xa');var recursiveMapAttributes=[_0xe4e2('0xb'),_0xe4e2('0xc')];var verticesWithRetry=[_0xe4e2('0xd'),_0xe4e2('0xe'),_0xe4e2('0xf')];var AGIVertices=function(_0x1e9508,_0xbd6aae,_0x4912da){this[_0xe4e2('0x10')]=_0x1e9508;this[_0xe4e2('0x11')]=_0xbd6aae;this[_0xe4e2('0x12')]=_0x4912da;};AGIVertices['prototype'][_0xe4e2('0x13')]=function(_0x42a1f0,_0x137047){this[_0xe4e2('0x11')][_0xe4e2('0x14')](_0x42a1f0)['then'](function(_0x34a818){_0x137047(null,_0x34a818?_0x34a818[_0xe4e2('0x15')]:![]);})[_0xe4e2('0x16')](function(_0x13657c){_0x137047(_0x13657c);});};AGIVertices['prototype'][_0xe4e2('0x17')]=function(_0x14bbab,_0xb45217){this[_0xe4e2('0x11')][_0xe4e2('0x18')](_0x14bbab)['then'](function(_0x58e012){_0xb45217(null,_0x58e012?_0x58e012[_0xe4e2('0x15')]:![]);})[_0xe4e2('0x16')](function(_0x1f9b2d){_0xb45217(_0x1f9b2d);});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x1a')]=function(_0x54107a,_0x754778){this[_0xe4e2('0x11')][_0xe4e2('0x1b')](_0x54107a)['then'](function(_0x196f16){_0x754778(null,_0x196f16?_0x196f16['name']:![]);})[_0xe4e2('0x16')](function(_0x3f313b){_0x754778(_0x3f313b);});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x1c')]=function(_0x3dfbdf,_0x156243){this[_0xe4e2('0x11')][_0xe4e2('0x1d')](_0x3dfbdf)[_0xe4e2('0x1e')](function(_0x362741){_0x156243(null,_0x362741?_0x362741['dsn']:![]);})[_0xe4e2('0x16')](function(_0x2e7ecd){_0x156243(_0x2e7ecd);});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x1f')]=function(_0xbdf1ad,_0x23b466){this[_0xe4e2('0x11')]['getUserById'](_0xbdf1ad)[_0xe4e2('0x1e')](function(_0x2ab435){_0x23b466(null,_0x2ab435?_0x2ab435[_0xe4e2('0x15')]:![]);})['catch'](function(_0x353030){_0x23b466(_0x353030);});};AGIVertices[_0xe4e2('0x19')]['getTrunk']=function(_0xcba85a,_0x234c38){this[_0xe4e2('0x11')][_0xe4e2('0x20')](_0xcba85a)[_0xe4e2('0x1e')](function(_0x5887c9){_0x234c38(null,_0x5887c9?_0x5887c9[_0xe4e2('0x15')]:![]);})[_0xe4e2('0x16')](function(_0x1f6d1f){_0x234c38(_0x1f6d1f);});};AGIVertices['prototype'][_0xe4e2('0x21')]=function(_0x41cfd9,_0x31f651){var _0x5ec692=this;this[_0xe4e2('0x11')]['getSoundById'](_0x41cfd9)[_0xe4e2('0x1e')](function(_0x1e21c0){_0x31f651(null,_0x1e21c0?_0x5ec692['getSoundPath'](_0x1e21c0[_0xe4e2('0x22')]):![]);})[_0xe4e2('0x16')](function(_0x135116){_0x31f651(_0x135116);});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x23')]=function(_0x4d33de,_0x5f30dc){this[_0xe4e2('0x11')][_0xe4e2('0x24')](_0x4d33de)[_0xe4e2('0x1e')](function(_0x26fb97){_0x5f30dc(null,_0x26fb97?_0x26fb97:![]);})[_0xe4e2('0x16')](function(_0x1ef1e5){_0x5f30dc(_0x1ef1e5);});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x25')]=function(_0x37dec8,_0x59eb,_0x1c87b0){this[_0xe4e2('0x12')]['sendMailMessage'](_0x37dec8,_0x59eb)[_0xe4e2('0x1e')](function(){_0x1c87b0(null);})[_0xe4e2('0x16')](function(_0xe0846a){_0x1c87b0(_0xe0846a);});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x26')]=function(_0x201e77,_0x554344){this[_0xe4e2('0x11')][_0xe4e2('0x27')](_0x201e77)[_0xe4e2('0x1e')](function(_0x11ca74){if(_0x11ca74){if(_0x11ca74[_0xe4e2('0x28')]){_0x554344(null,[_0x11ca74[_0xe4e2('0x29')]]);}else{_0x554344(null,_[_0xe4e2('0x2a')](_0x11ca74[_0xe4e2('0x2b')],_0xe4e2('0x29')));}}else{_0x554344(null,![]);}})[_0xe4e2('0x16')](function(_0x2767df){_0x554344(_0x2767df);});};AGIVertices['prototype'][_0xe4e2('0x2c')]=function(_0x4d3c5e){return util[_0xe4e2('0x2d')](_0xe4e2('0x2e'),FILES_PATH,_0x4d3c5e);};AGIVertices['prototype'][_0xe4e2('0x2f')]=function(_0xbac59e,_0x4b437,_0x2b37fc){odbc['open'](_0xbac59e,function(_0x4652b1){if(_0x4652b1){logger['error'](_0xe4e2('0x30'),_0x4652b1);_0x2b37fc(_0x4652b1);}else{logger['info'](_0xe4e2('0x31'));odbc[_0xe4e2('0x32')](_0x4b437,function(_0x237ad2,_0x57c1c3){if(_0x237ad2){logger[_0xe4e2('0x33')](_0xe4e2('0x34'),_0x4b437);_0x2b37fc(_0x237ad2);}else{logger['info'](_0xe4e2('0x35'),_0x4b437);odbc[_0xe4e2('0x36')](function(_0x349193){if(_0x349193){logger[_0xe4e2('0x37')](_0xe4e2('0x38'),_0x349193);}_0x2b37fc(null,_0x57c1c3);});}});}});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x39')]=function(_0xcd3681,_0xc07ff5){this['rpc']['getSmsAccountById'](_0xcd3681)[_0xe4e2('0x1e')](function(_0x35e66b){_0xc07ff5(null,_0x35e66b?_0x35e66b:![]);})[_0xe4e2('0x16')](function(_0x3e1ae5){_0xc07ff5(_0x3e1ae5);});};AGIVertices['prototype']['createSmsMessage']=function(_0x36c5ef,_0x142815){this[_0xe4e2('0x11')][_0xe4e2('0x3a')](_0x36c5ef)['then'](function(_0x45e88c){_0x142815(null,_0x45e88c);})[_0xe4e2('0x16')](function(_0x385572){_0x142815(_0x385572);});};AGIVertices['prototype'][_0xe4e2('0x3b')]=function(_0x4789cf,_0x67ee4f,_0x253ab1){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0xe4e2('0x10')][_0xe4e2('0x3c')],'node':_0x4789cf[_0xe4e2('0x3d')],'application':_0x4789cf['agicommand'],'data':_0x67ee4f||null,'project_name':this[_0xe4e2('0x10')][_0xe4e2('0x3e')],'callerid':this['channel'][_0xe4e2('0x3f')]})[_0xe4e2('0x1e')](function(_0x1538bd){if(_0x253ab1){_0x253ab1(null,_0x1538bd);}})[_0xe4e2('0x16')](function(_0x4ed88f){if(_0x253ab1){_0x253ab1(_0x4ed88f);}});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x40')]=function(_0x478627,_0x5dfb91,_0x468314,_0x255b66){this['rpc']['createSquareRecording']({'uniqueid':this[_0xe4e2('0x10')][_0xe4e2('0x3c')],'callerid':this[_0xe4e2('0x10')]['callerid'],'calleridname':this[_0xe4e2('0x10')][_0xe4e2('0x41')],'context':this[_0xe4e2('0x10')][_0xe4e2('0x42')],'extension':this['channel'][_0xe4e2('0x43')],'priority':this[_0xe4e2('0x10')][_0xe4e2('0x44')],'accountcode':this[_0xe4e2('0x10')]['accountcode'],'dnid':this[_0xe4e2('0x10')][_0xe4e2('0x45')],'projectName':this['channel'][_0xe4e2('0x3e')],'saveName':_0x5dfb91,'filename':_0x478627[_0xe4e2('0x46')]||_0x5dfb91,'savePath':_0x468314})[_0xe4e2('0x1e')](function(_0x4f47f4){_0x255b66(null,_0x4f47f4);})[_0xe4e2('0x16')](function(_0x29199b){_0x255b66(_0x29199b);});};AGIVertices[_0xe4e2('0x19')]['createSquareMessage']=function(_0x5edd7e,_0xccf95e,_0x4c6253,_0xb0f89d,_0x5b2cab){this[_0xe4e2('0x11')][_0xe4e2('0x47')]({'uniqueid':this[_0xe4e2('0x10')]['uniqueid'],'body':_0x5edd7e,'direction':_0xccf95e,'providerName':_0x4c6253,'providerResponse':_0xb0f89d})[_0xe4e2('0x1e')](function(_0x504496){if(_0x5b2cab){_0x5b2cab(null,_0x504496);}})[_0xe4e2('0x16')](function(_0x264df8){if(_0x5b2cab){_0x5b2cab(_0x264df8);}});};AGIVertices['prototype'][_0xe4e2('0x48')]=function(_0x582674,_0x169251){this[_0xe4e2('0x11')]['createCmContact']({'firstName':_[_0xe4e2('0x49')](_0x582674[_0xe4e2('0x15')])||_[_0xe4e2('0x4a')](_0x582674[_0xe4e2('0x15')])?_0xe4e2('0x4b')+Math[_0xe4e2('0x4c')]():_0x582674[_0xe4e2('0x15')],'lastName':_[_0xe4e2('0x49')](_0x582674[_0xe4e2('0x4d')])||_['isNil'](_0x582674[_0xe4e2('0x4d')])?null:_0x582674[_0xe4e2('0x4d')],'phone':_0x582674[_0xe4e2('0x4e')],'ListId':_0x582674[_0xe4e2('0x4f')],'scheduledat':_0x582674[_0xe4e2('0x50')],'callbackUniqueid':this[_0xe4e2('0x10')][_0xe4e2('0x3c')],'tags':_0xe4e2('0x51'),'description':_0xe4e2('0x52')+_0x582674[_0xe4e2('0x50')][_0xe4e2('0x53')](),'priority':_0x582674['callback_priority']})[_0xe4e2('0x1e')](function(_0x435ae0){_0x169251(null,_0x435ae0);})[_0xe4e2('0x16')](function(_0x35448c){_0x169251(_0x35448c);});};AGIVertices['prototype'][_0xe4e2('0x54')]=function(_0x1250a2,_0x54f07d){this[_0xe4e2('0x11')][_0xe4e2('0x55')](_0x1250a2)[_0xe4e2('0x1e')](function(_0x317835){_0x54f07d(null,_0x317835?_0x317835['name']:![]);})[_0xe4e2('0x16')](function(_0x5c9d88){_0x54f07d(_0x5c9d88);});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x56')]=function(_0x1f22fb,_0x380dc0,_0x2cc813){var _0x26ab38={'role':_0xe4e2('0x57')};_0x26ab38[_0x1f22fb]=this[_0xe4e2('0x10')][_0xe4e2('0x3f')];this[_0xe4e2('0x11')][_0xe4e2('0x56')](_0x26ab38,_0x380dc0,this[_0xe4e2('0x10')]['uniqueid'])[_0xe4e2('0x1e')](function(_0x58dc01){_0x2cc813(null,_['isNil'](_0x58dc01)?![]:!![]);})[_0xe4e2('0x16')](function(_0x16eb59){logger[_0xe4e2('0x37')](_0x16eb59);_0x2cc813(null,![]);});};AGIVertices['prototype'][_0xe4e2('0x58')]=function(_0x4b6dfc,_0xb9e975){var _0x9ba757={'role':'agent'};_0x9ba757[_0x4b6dfc]=this[_0xe4e2('0x10')][_0xe4e2('0x3f')];this['rpc'][_0xe4e2('0x58')](_0x9ba757)[_0xe4e2('0x1e')](function(_0x4edabb){_0xb9e975(null,_[_0xe4e2('0x4a')](_0x4edabb)?![]:!![]);})[_0xe4e2('0x16')](function(_0x9d8ef8){logger[_0xe4e2('0x37')](_0x9d8ef8);_0xb9e975(null,![]);});};AGIVertices['prototype'][_0xe4e2('0x59')]=function(_0x3f94ef,_0x3d6417){var _0x133f62={'role':_0xe4e2('0x57')};_0x133f62[_0x3f94ef]=this[_0xe4e2('0x10')][_0xe4e2('0x3f')];this[_0xe4e2('0x11')][_0xe4e2('0x59')](_0x133f62)['then'](function(_0x59b1c0){_0x3d6417(null,_['isNil'](_0x59b1c0)?![]:!![]);})[_0xe4e2('0x16')](function(_0x17d904){logger[_0xe4e2('0x37')](_0x17d904);_0x3d6417(null,![]);});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x5a')]=function(_0x2c38a7,_0x956de7){var _0x497e47={'role':_0xe4e2('0x57')};_0x497e47[_0x2c38a7]=this[_0xe4e2('0x10')][_0xe4e2('0x3f')];var _0xaef7ee=_0x2c38a7!=_0xe4e2('0x5b')?util[_0xe4e2('0x2d')](_0xe4e2('0x5c'),_0xe4e2('0x5d'),this[_0xe4e2('0x10')][_0xe4e2('0x3f')]):undefined;this[_0xe4e2('0x11')][_0xe4e2('0x5a')](_0x497e47,_0xaef7ee)[_0xe4e2('0x1e')](function(_0x2ad8d1){_0x956de7(null,_[_0xe4e2('0x4a')](_0x2ad8d1)?![]:!![]);})['catch'](function(_0x4434c9){logger[_0xe4e2('0x37')](_0x4434c9);_0x956de7(null,![]);});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x5e')]=function(_0x2aa772,_0x26f90d){sh[_0xe4e2('0x5f')](_[_0xe4e2('0x60')](_0x2aa772),function(_0x134eec,_0x23e014){var _0x57a7eb=_0x23e014[_0xe4e2('0x61')](/(\r\n|\n|\r)/gm,'');_0x26f90d(null,_0x57a7eb);});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x62')]=function(_0x277384,_0x24859b){scripts[_0xe4e2('0x62')](_0x277384[_0xe4e2('0x63')],_0x277384[_0xe4e2('0x64')]||'text',_0x277384[_0xe4e2('0x65')],_0x277384[_0xe4e2('0x66')]||_0xe4e2('0x67'),_0x277384[_0xe4e2('0x68')]||_0xe4e2('0x69'),_0x277384[_0xe4e2('0x6a')]||_0xe4e2('0x6b'))[_0xe4e2('0x1e')](function(_0x173400){_0x24859b(null,_0x173400);})[_0xe4e2('0x16')](function(_0x50a4d7){_0x24859b(_0x50a4d7);});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x6c')]=function(_0x4da351,_0x2017d){scripts[_0xe4e2('0x6c')](_0x4da351[_0xe4e2('0x65')],_0x4da351[_0xe4e2('0x6d')]||'en',0x1)[_0xe4e2('0x1e')](function(_0x4b2024){_0x2017d(null,_0x4b2024);})[_0xe4e2('0x16')](function(_0x1447ee){_0x2017d(_0x1447ee);});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x6e')]=function(_0x1795c8,_0x113c47){var _0x8103b1={'uri':_0x1795c8[_0xe4e2('0x6f')],'method':_0x1795c8['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x1795c8[_0xe4e2('0x70')])===_0xe4e2('0x71')&&parseInt(_0x1795c8[_0xe4e2('0x70')])>=0x1?parseInt(_0x1795c8[_0xe4e2('0x70')])*0x3e8:0x5*0x3e8};if(_[_0xe4e2('0x72')]([_0xe4e2('0x73'),_0xe4e2('0x74')],_0x8103b1[_0xe4e2('0x75')][_0xe4e2('0x76')]())){try{_0x8103b1['body']=_0x1795c8[_0xe4e2('0xc')]?JSON[_0xe4e2('0x77')](_0x1795c8[_0xe4e2('0xc')]):{};}catch(_0x40fa3c){logger[_0xe4e2('0x37')](_0xe4e2('0x78'),_0x40fa3c);}}try{_0x8103b1[_0xe4e2('0x79')]=_0x1795c8[_0xe4e2('0xb')]?JSON[_0xe4e2('0x77')](_0x1795c8[_0xe4e2('0xb')]):{};}catch(_0x462e17){logger[_0xe4e2('0x37')](_0xe4e2('0x7a'),_0x462e17);}if(_0x1795c8['computedVariables']){try{var _0x3b4556=require(_0x1795c8['computedVariables'])[_0xe4e2('0x7b')](this,_0x8103b1);_0x8103b1[_0xe4e2('0x7c')]=Mustache['render'](_0x1795c8[_0xe4e2('0x6f')],_0x3b4556,{},['$$','$$']);if(_0x8103b1[_0xe4e2('0x79')]){_0x8103b1[_0xe4e2('0x79')]=JSON[_0xe4e2('0x77')](Mustache[_0xe4e2('0x7d')](JSON[_0xe4e2('0x7e')](_0x8103b1[_0xe4e2('0x79')]),_0x3b4556,{},['$$','$$']));}if(_0x8103b1['body']){_0x8103b1[_0xe4e2('0x7f')]=JSON[_0xe4e2('0x77')](Mustache['render'](JSON['stringify'](_0x8103b1[_0xe4e2('0x7f')]),_0x3b4556,{},['$$','$$']));}}catch(_0xe0914b){logger[_0xe4e2('0x37')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0xe0914b);}}rp(_0x8103b1)[_0xe4e2('0x1e')](function(_0x5b0948){var _0x3b45c3={'statusCode':_0x5b0948[_0xe4e2('0x80')]||0xc8,'statusMessage':_0x5b0948['statusMessage']||'OK','headers':_0x5b0948[_0xe4e2('0x79')]||{},'body':_0x5b0948[_0xe4e2('0x7f')]||{}};_0x113c47(null,_0x3b45c3);})[_0xe4e2('0x16')](function(_0x125b9c){var _0x1c9cdf={'statusCode':_0x125b9c[_0xe4e2('0x80')]||0x1f4,'statusMessage':_0x125b9c[_0xe4e2('0x81')]||_0xe4e2('0x82'),'headers':_0x125b9c[_0xe4e2('0x83')][_0xe4e2('0x79')]||{},'body':_0x125b9c['options'][_0xe4e2('0x7f')]||{}};_0x113c47(null,_0x1c9cdf);});};AGIVertices[_0xe4e2('0x19')]['googleDialogflow']=function(_0x9a49e3,_0x49f0d7){scripts[_0xe4e2('0x84')](this[_0xe4e2('0x10')][_0xe4e2('0x3c')],_0x9a49e3[_0xe4e2('0x85')],_0x9a49e3['text'],_0x9a49e3[_0xe4e2('0x86')]||'en')[_0xe4e2('0x1e')](function(_0x183067){_0x49f0d7(null,_0x183067);})[_0xe4e2('0x16')](function(_0x2a7326){_0x49f0d7(_0x2a7326);});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x87')]=function(_0x526a50,_0x5e5dbd){scripts[_0xe4e2('0x87')](this[_0xe4e2('0x10')][_0xe4e2('0x3c')],_0x526a50[_0xe4e2('0x88')],_0x526a50[_0xe4e2('0x89')],_0x526a50[_0xe4e2('0x8a')],_0x526a50[_0xe4e2('0x65')],_0x526a50[_0xe4e2('0x8b')]||'en')[_0xe4e2('0x1e')](function(_0x369171){_0x5e5dbd(null,_0x369171);})[_0xe4e2('0x16')](function(_0x61558c){_0x5e5dbd(_0x61558c);});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x8c')]=function(_0x91aa77,_0x6c86e5){scripts[_0xe4e2('0x8c')](this[_0xe4e2('0x10')],_0x91aa77)[_0xe4e2('0x1e')](function(_0x536922){_0x6c86e5(null,_0x536922);})[_0xe4e2('0x16')](function(_0x40289d){_0x6c86e5(_0x40289d);});};AGIVertices[_0xe4e2('0x19')]['ispeechTTS']=function(_0x53dfa7,_0xf31c76){scripts['ispeechTTS'](_0x53dfa7[_0xe4e2('0x85')],_0x53dfa7[_0xe4e2('0x65')],_0x53dfa7[_0xe4e2('0x8d')]||_0xe4e2('0x67'),_0x53dfa7[_0xe4e2('0x8e')])[_0xe4e2('0x1e')](function(_0x2c35f3){_0xf31c76(null,_0x2c35f3);})[_0xe4e2('0x16')](function(_0x2a674d){_0xf31c76(_0x2a674d);});};AGIVertices['prototype'][_0xe4e2('0x8f')]=function(_0x2382a8,_0x541cd4,_0x4ab01e){scripts[_0xe4e2('0x8f')](_0x541cd4,_0x2382a8[_0xe4e2('0x85')],_0x2382a8[_0xe4e2('0x90')]||_0xe4e2('0x67'),this[_0xe4e2('0x91')](_0x2382a8[_0xe4e2('0x92')])?_0x2382a8[_0xe4e2('0x92')]:undefined)[_0xe4e2('0x1e')](function(_0x272ebb){_0x4ab01e(null,_0x272ebb);})[_0xe4e2('0x16')](function(_0x5f23e9){_0x4ab01e(_0x5f23e9);});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x93')]=function(_0x174994,_0xb4355d){scripts[_0xe4e2('0x93')](_0x174994[_0xe4e2('0x94')],_0x174994[_0xe4e2('0x95')],_0x174994['aws_polly_region'],_0x174994[_0xe4e2('0x96')]||_0xe4e2('0x97'),_0x174994[_0xe4e2('0x65')],_0x174994[_0xe4e2('0x98')]||_0xe4e2('0x65'))[_0xe4e2('0x1e')](function(_0x3feb6c){_0xb4355d(null,_0x3feb6c);})[_0xe4e2('0x16')](function(_0x36bdff){_0xb4355d(_0x36bdff);});};AGIVertices['prototype'][_0xe4e2('0x99')]=function(_0x357ac4,_0x132da5){scripts['awsLex'](this[_0xe4e2('0x10')][_0xe4e2('0x3c')],_0x357ac4[_0xe4e2('0x94')],_0x357ac4[_0xe4e2('0x95')],_0x357ac4[_0xe4e2('0x9a')],_0x357ac4[_0xe4e2('0x65')],_0x357ac4['aws_bot_name'])[_0xe4e2('0x1e')](function(_0x203fb2){_0x132da5(null,_0x203fb2);})[_0xe4e2('0x16')](function(_0x5a13be){_0x132da5(_0x5a13be);});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x9b')]=function(_0xeed072,_0x2c0751,_0x39c8f4){scripts[_0xe4e2('0x9b')](_0x2c0751,_0xeed072[_0xe4e2('0x85')],_0xeed072[_0xe4e2('0x9c')]||_0xe4e2('0x67'))[_0xe4e2('0x1e')](function(_0x3266a4){_0x39c8f4(null,_0x3266a4);})[_0xe4e2('0x16')](function(_0x321658){_0x39c8f4(_0x321658);});};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x9d')]=function(_0x52cb24,_0x5650b9,_0x34c673){scripts['tildeASR'](_0x5650b9,_0x52cb24['appid'],_0x52cb24[_0xe4e2('0x9e')],_0x52cb24[_0xe4e2('0x7c')])[_0xe4e2('0x1e')](function(_0x1269b6){_0x34c673(null,_0x1269b6);})['catch'](function(_0x33c705){_0x34c673(_0x33c705);});};AGIVertices['prototype']['clear']=function(_0x35ef50){var _0x527d24=_[_0xe4e2('0x72')](verticesWithRetry,_0x35ef50[_0xe4e2('0x9f')])?_0x35ef50:_[_0xe4e2('0xa0')](_0x35ef50);for(var _0x4e6552 in _0x527d24){if(_0x527d24[_0xe4e2('0xa1')](_0x4e6552)){if(_0x527d24[_0x4e6552]&&_[_0xe4e2('0xa2')](_0x527d24[_0x4e6552])){if(_[_0xe4e2('0x72')](recursiveMapAttributes,_0x4e6552)){_0x527d24[_0x4e6552]=this['replaceObjectAllVariables'](_0x527d24[_0x4e6552]);}else{_0x527d24[_0x4e6552]=this[_0xe4e2('0xa3')](_0x527d24[_0x4e6552]);}}}}return _0x527d24;};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0xa4')]=function(_0xb7815a){for(var _0x56d019 in _0xb7815a){if(_0xb7815a[_0xe4e2('0xa1')](_0x56d019)){if(_[_0xe4e2('0xa5')](_0xb7815a[_0x56d019])){this[_0xe4e2('0xa4')](_0xb7815a[_0x56d019]);}else if(_['isArray'](_0xb7815a[_0x56d019])){for(var _0x5d39bf=0x0;_0x5d39bf<_0xb7815a[_0x56d019][_0xe4e2('0xa6')];_0x5d39bf++){this[_0xe4e2('0xa4')](_0xb7815a[_0x56d019][_0x5d39bf]);}}else if(_['isString'](_0xb7815a[_0x56d019])){_0xb7815a[_0x56d019]=this[_0xe4e2('0xa3')](_0xb7815a[_0x56d019]);}}}};AGIVertices['prototype'][_0xe4e2('0xa7')]=function(_0x3fa1eb,_0x5d65d6){for(var _0x3a8a2f in _0x3fa1eb){if(_0x3fa1eb['hasOwnProperty'](_0x3a8a2f)){if(_[_0xe4e2('0xa5')](_0x3fa1eb[_0x3a8a2f])){if(!_[_0xe4e2('0x49')](_0x3fa1eb[_0x3a8a2f])){this[_0xe4e2('0xa7')](_0x3fa1eb[_0x3a8a2f],util[_0xe4e2('0x2d')](_0xe4e2('0xa8'),_0x5d65d6,_0x3a8a2f));}}else if(_[_0xe4e2('0xa9')](_0x3fa1eb[_0x3a8a2f])){for(var _0x50b129=0x0;_0x50b129<_0x3fa1eb[_0x3a8a2f][_0xe4e2('0xa6')];_0x50b129++){this[_0xe4e2('0xa7')](_0x3fa1eb[_0x3a8a2f][_0x50b129],util[_0xe4e2('0x2d')]('%s.%s',_0x5d65d6,_0x3a8a2f+'['+_0x50b129+']'));}}else{if(!_[_0xe4e2('0x4a')](_0x3fa1eb[_0x3a8a2f])){this[_0xe4e2('0x10')][_0xe4e2('0xaa')](util['format'](_0xe4e2('0xa8'),_0x5d65d6,_0x3a8a2f),_0x3fa1eb[_0x3a8a2f]);}}}}};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0xab')]=function(_0x4bbc99){try{var _0x151d22=JSON[_0xe4e2('0x77')](_0x4bbc99);this[_0xe4e2('0xa4')](_0x151d22);return JSON[_0xe4e2('0x7e')](_0x151d22);}catch(_0x2c1528){return this[_0xe4e2('0xa3')](_0x4bbc99);}};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0xa3')]=function(_0x65b5fe){var _0x286b2e=_0x65b5fe[_0xe4e2('0xac')]('{');for(var _0x52a202=0x1;_0x52a202<_0x286b2e['length'];_0x52a202+=0x1){var _0x28b119=_0x286b2e[_0x52a202][_0xe4e2('0xac')]('}');if(_0x28b119[_0xe4e2('0xa6')]>0x1){_0x65b5fe=_0x65b5fe[_0xe4e2('0xad')]('{'+_0x28b119[0x0]+'}',this[_0xe4e2('0x10')][_0xe4e2('0x13')](_0x28b119[0x0])[_0xe4e2('0xae')]||_0x28b119[0x0]);}}if(_0x286b2e[_0xe4e2('0xa6')]===0x1){return _0x65b5fe['toString']();}return this[_0xe4e2('0xa3')](_0x65b5fe);};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0xaf')]=function(_0x3b0f32,_0x278ad0){var _0x416ebe=this[_0xe4e2('0x10')][_0xe4e2('0x13')](_0x3b0f32);if(_0x416ebe[_0xe4e2('0xb0')]===-0x1){return _0x416ebe;}logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0xb1'),_0x278ad0,_0x416ebe[_0xe4e2('0xae')]));return this[_0xe4e2('0x10')]['setVariable'](_0x278ad0,_0x416ebe['extra']);};AGIVertices['prototype'][_0xe4e2('0x91')]=function(_0x1060d9){return _0x1060d9&&_0x1060d9!=='0'&&_0x1060d9!=='-1'&&_0x1060d9!=='';};AGIVertices['prototype'][_0xe4e2('0xb2')]=function(_0x49dc91){this[_0xe4e2('0x3b')][_0xe4e2('0x7b')](this,_0x49dc91,'-');_0x49dc91[_0xe4e2('0xb3')]=_0x49dc91[_0xe4e2('0xb2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0xb4')]=function(_0x53c0f3){logger[_0xe4e2('0x33')](util['format'](_0xe4e2('0xb5'),_0x53c0f3[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x53c0f3[_0xe4e2('0x65')])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0xb7'));}var _0x55182e='\x22'+_0x53c0f3['text']+'\x22';if(this[_0xe4e2('0x91')](_0x53c0f3['options'])){_0x55182e+=','+_0x53c0f3['options'];}var _0x2eeea0=this[_0xe4e2('0x10')][_0xe4e2('0x5f')](_0xe4e2('0xb8'),_0x55182e);if(_0x2eeea0[_0xe4e2('0xb0')]===-0x1){return _0x2eeea0;}return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')]('Executed\x20command\x20MRCPSynth\x20%s',_0x55182e));};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0xb9')]=function(_0x21a8a8){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0xba'),_0x21a8a8[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x21a8a8[_0xe4e2('0xbb')])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')]('no\x20grammar\x20configured');}var _0x7582cb=_0x21a8a8[_0xe4e2('0xbb')];if(this[_0xe4e2('0x91')](_0x21a8a8['options'])){_0x7582cb+=','+_0x21a8a8[_0xe4e2('0x83')];}var _0x1f2866=this[_0xe4e2('0x10')][_0xe4e2('0x5f')](_0xe4e2('0xbc'),_0x7582cb);if(_0x1f2866[_0xe4e2('0xb0')]===-0x1){return _0x1f2866;}var _0x5ceb06=this['getAndSetVariable'](_0xe4e2('0xbd'),_0xe4e2('0xbe'));if(_0x5ceb06['result']===-0x1){return _0x5ceb06;}var _0x2f197d=this[_0xe4e2('0xaf')](_0xe4e2('0xbf'),_0xe4e2('0xc0'));if(_0x2f197d['result']===-0x1){return _0x2f197d;}var _0x4dc350=this[_0xe4e2('0xaf')]('RECOG_INSTANCE()',_0xe4e2('0xc1'));if(_0x4dc350[_0xe4e2('0xb0')]===-0x1){return _0x4dc350;}return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')]('Executed\x20command\x20MRCPRecog\x20%s',_0x7582cb));};AGIVertices['prototype'][_0xe4e2('0x8')]=function(_0x21729c){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0xc2'),_0x21729c['label']));return this[_0xe4e2('0x10')][_0xe4e2('0x8')]([_0x21729c['command'],_0x21729c['args']]);};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0xc3')]=function(_0x3a04cd){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x3a04cd[_0xe4e2('0x3d')]));if(this[_0xe4e2('0x91')](_0x3a04cd[_0xe4e2('0x70')])){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0xc4'),_0x3a04cd['timeout']));var _0x46bdd8=this[_0xe4e2('0x10')]['wait'](_0x3a04cd[_0xe4e2('0x70')]);if(_0x46bdd8['result']===-0x1){return _0x46bdd8;}}return this['channel'][_0xe4e2('0xc3')]();};AGIVertices['prototype'][_0xe4e2('0x51')]=function(_0x11adab){logger['info'](util[_0xe4e2('0x2d')](_0xe4e2('0xc5'),_0x11adab['label']));if(!this[_0xe4e2('0x91')](_0x11adab[_0xe4e2('0x4f')])){return this[_0xe4e2('0x10')]['error'](_0x11adab,_0xe4e2('0xc6'));}_0x11adab[_0xe4e2('0x50')]=moment();if(this[_0xe4e2('0x91')](_0x11adab[_0xe4e2('0xc7')])){_0x11adab[_0xe4e2('0x50')]=moment()[_0xe4e2('0xc8')](_0x11adab[_0xe4e2('0xc7')],_0xe4e2('0xc9'));}if(!this[_0xe4e2('0x91')](_0x11adab[_0xe4e2('0xca')])){_0x11adab[_0xe4e2('0xca')]=0x2;}this[_0xe4e2('0x48')][_0xe4e2('0x7b')](this,_0x11adab);return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x11adab[_0xe4e2('0x4e')],_0x11adab['list_id'],_0x11adab['scheduledAt']));};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0xcb')]=function(_0x1b9649){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0xcc'),_0x1b9649['label']));var _0x91904f=this[_0xe4e2('0x10')][_0xe4e2('0x5f')](_0x1b9649[_0xe4e2('0xcd')],_0x1b9649[_0xe4e2('0x83')]);if(_0x91904f['result']===-0x1){return _0x91904f;}return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0xce'),_0x1b9649[_0xe4e2('0xcd')],_0x1b9649[_0xe4e2('0x83')]));};AGIVertices[_0xe4e2('0x19')]['lumenvoxtts']=function(_0x5100c6){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0xcf'),_0x5100c6[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x5100c6['text'])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0xb7'));}var _0x5cc32b='\x22'+_0x5100c6[_0xe4e2('0x65')]+'\x22';if(this['isConfigured'](_0x5100c6[_0xe4e2('0x83')])){_0x5cc32b+=','+_0x5100c6[_0xe4e2('0x83')];}var _0x45269=this[_0xe4e2('0x10')][_0xe4e2('0x5f')](_0xe4e2('0xb8'),_0x5cc32b);if(_0x45269[_0xe4e2('0xb0')]===-0x1){return _0x45269;}return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0xd0'),_0x5cc32b));};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0xd1')]=function(_0x576923){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0xd2'),_0x576923['label']));if(!this[_0xe4e2('0x91')](_0x576923[_0xe4e2('0x65')])){return this[_0xe4e2('0x10')]['noop']('no\x20text\x20configured');}var _0x52e29e='\x22'+_0x576923['text']+'\x22';if(this[_0xe4e2('0x91')](_0x576923[_0xe4e2('0x83')])){_0x52e29e+=','+_0x576923[_0xe4e2('0x83')];}var _0x37028d=this['channel'][_0xe4e2('0x5f')](_0xe4e2('0xb8'),_0x52e29e);if(_0x37028d[_0xe4e2('0xb0')]===-0x1){return _0x37028d;}return this['channel'][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0xd0'),_0x52e29e));};AGIVertices[_0xe4e2('0x19')]['lumenvoxasr']=function(_0xa93de3){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0xd3'),_0xa93de3[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0xa93de3[_0xe4e2('0xbb')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x46bb7a=_0xa93de3[_0xe4e2('0xbb')];if(this[_0xe4e2('0x91')](_0xa93de3[_0xe4e2('0x83')])){_0x46bb7a+=','+_0xa93de3['options'];}var _0x125605=this[_0xe4e2('0x10')]['exec']('MRCPRecog',_0x46bb7a);if(_0x125605[_0xe4e2('0xb0')]===-0x1){return _0x125605;}var _0x7254=this[_0xe4e2('0xaf')](_0xe4e2('0xbd'),_0xe4e2('0xd4'));if(_0x7254[_0xe4e2('0xb0')]===-0x1){return _0x7254;}var _0x5d96a3=this[_0xe4e2('0xaf')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x5d96a3[_0xe4e2('0xb0')]===-0x1){return _0x5d96a3;}var _0x1f3c9c=this[_0xe4e2('0xaf')](_0xe4e2('0xd5'),_0xe4e2('0xd6'));if(_0x1f3c9c[_0xe4e2('0xb0')]===-0x1){return _0x1f3c9c;}return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0xd7'),_0x46bb7a));};AGIVertices['prototype']['sestekasr']=function(_0x17ddc9){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0xd8'),_0x17ddc9[_0xe4e2('0x3d')]));if(!this['isConfigured'](_0x17ddc9['grammar'])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0xd9'));}var _0x12ff0d=_0x17ddc9[_0xe4e2('0xbb')];if(this[_0xe4e2('0x91')](_0x17ddc9['options'])){_0x12ff0d+=','+_0x17ddc9[_0xe4e2('0x83')];}var _0x4a133d=this[_0xe4e2('0x10')][_0xe4e2('0x5f')](_0xe4e2('0xbc'),_0x12ff0d);if(_0x4a133d[_0xe4e2('0xb0')]===-0x1){return _0x4a133d;}var _0x2fec88=this[_0xe4e2('0xaf')](_0xe4e2('0xbd'),_0xe4e2('0xda'));if(_0x2fec88[_0xe4e2('0xb0')]===-0x1){return _0x2fec88;}var _0x1b5316=this[_0xe4e2('0xaf')](_0xe4e2('0xbf'),'SESTEK_ASR_TRANSCRIPT');if(_0x1b5316[_0xe4e2('0xb0')]===-0x1){return _0x1b5316;}var _0x1b5c25=this[_0xe4e2('0xaf')](_0xe4e2('0xd5'),_0xe4e2('0xdb'));if(_0x1b5c25['result']===-0x1){return _0x1b5c25;}return this[_0xe4e2('0x10')]['noop'](util[_0xe4e2('0x2d')](_0xe4e2('0xd7'),_0x12ff0d));};AGIVertices[_0xe4e2('0x19')]['database']=function(_0x16dfcd){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0xdc'),_0x16dfcd['label']));if(!this[_0xe4e2('0x91')](_0x16dfcd[_0xe4e2('0xdd')])){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x16dfcd,_0xe4e2('0xde'));}var _0x37f3bb=this[_0xe4e2('0x1c')][_0xe4e2('0x7b')](this,_0x16dfcd[_0xe4e2('0xdd')]);if(!_0x37f3bb){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x16dfcd,'no\x20odbc\x20database\x20found');}if(!this[_0xe4e2('0x91')](_0x16dfcd['query'])){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x16dfcd,'no\x20query\x20configured');}var _0x14ea87=_0x16dfcd[_0xe4e2('0x32')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0xdf'),_0x14ea87));var _0x3a17a=this[_0xe4e2('0x2f')][_0xe4e2('0x7b')](this,_0x37f3bb,_0x14ea87);this[_0xe4e2('0x3b')][_0xe4e2('0x7b')](this,_0x16dfcd,_0x14ea87);if(!this[_0xe4e2('0x91')](_0x16dfcd[_0xe4e2('0xe0')])){return this['channel'][_0xe4e2('0xb6')](_0xe4e2('0xe1'));}var _0x377a1c=this['getVariable'][_0xe4e2('0x7b')](this,_0x16dfcd[_0xe4e2('0xe0')]);if(!_0x377a1c){return this['channel']['error'](_0x16dfcd,_0xe4e2('0xe2'));}var _0x5f38f6=this;_0x3a17a['forEach'](function(_0x49a89f,_0x39f29d){Object[_0xe4e2('0xe3')](_0x49a89f)[_0xe4e2('0xe4')](function(_0x42008d){_0x5f38f6[_0xe4e2('0x10')][_0xe4e2('0xaa')](util['format']('%s[%s][%s]',_0x377a1c,_0x39f29d,_0x42008d),_0x49a89f[_0x42008d]);});});this[_0xe4e2('0x10')][_0xe4e2('0xaa')](util[_0xe4e2('0x2d')](_0xe4e2('0xe5'),_0x377a1c),_0x3a17a[_0xe4e2('0xa6')]);return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')]('variable\x20%s\x20set',_0x377a1c));};AGIVertices[_0xe4e2('0x19')]['dial']=function(_0x2a9198){logger[_0xe4e2('0xe6')](util[_0xe4e2('0x2d')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x2a9198[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x2a9198[_0xe4e2('0xe7')])){return this['channel'][_0xe4e2('0x37')](_0x2a9198,_0xe4e2('0xe8'));}var _0xcf9812=this['getUser'][_0xe4e2('0x7b')](this,_0x2a9198['sip_id']);if(!_0xcf9812){return this[_0xe4e2('0x10')]['error'](_0x2a9198,'no\x20user\x20found');}var _0x47a440=this[_0xe4e2('0x10')][_0xe4e2('0x5f')](_0xe4e2('0xe9'),[util[_0xe4e2('0x2d')](_0xe4e2('0xea'),_0xcf9812),_0x2a9198[_0xe4e2('0x70')],_0x2a9198[_0xe4e2('0xeb')],_0x2a9198['url']]);if(_0x47a440[_0xe4e2('0xb0')]===-0x1){return _0x47a440;}return this['channel'][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0xec'),_0xe4e2('0xe9')));};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0xed')]=function(_0x4c50c0){logger[_0xe4e2('0x33')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x4c50c0['label']));if(!this['isConfigured'](_0x4c50c0['key'])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0xee'));}if(!this['isConfigured'](_0x4c50c0[_0xe4e2('0x65')])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')]('no\x20text\x20configured');}this[_0xe4e2('0x10')][_0xe4e2('0xef')]=!![];this[_0xe4e2('0x3b')](_0x4c50c0);this[_0xe4e2('0x47')](_0x4c50c0[_0xe4e2('0x65')],'in','','');this[_0xe4e2('0x10')]['noop'](util['format'](_0xe4e2('0xf0'),_0x4c50c0[_0xe4e2('0x65')]));var _0x5499c9=this['googleDialogflow'][_0xe4e2('0x7b')](this,_0x4c50c0);if(_0x5499c9){for(var _0x478abf in _0x5499c9){if(_0x5499c9[_0xe4e2('0xa1')](_0x478abf)){this[_0xe4e2('0x10')][_0xe4e2('0xaa')](util['format'](_0xe4e2('0xf1'),_0x478abf[_0xe4e2('0x76')]()),_0x5499c9[_0x478abf]);}}this['createSquareMessage'](_0x5499c9[_0xe4e2('0xf2')],_0xe4e2('0xf3'),'dialogflow','');return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')]('Dialogflow\x20Result\x20%s',_0x5499c9[_0xe4e2('0xf2')]));}return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x4c50c0,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0xe4e2('0xf4')]=function(_0x42fe59){logger[_0xe4e2('0x33')](util['format'](_0xe4e2('0xf5'),_0x42fe59[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x42fe59[_0xe4e2('0x88')])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0xf6'));}if(!this[_0xe4e2('0x91')](_0x42fe59['client_email'])){return this['channel'][_0xe4e2('0xb6')](_0xe4e2('0xf7'));}if(!this[_0xe4e2('0x91')](_0x42fe59[_0xe4e2('0x8a')])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0xf8'));}if(!this['isConfigured'](_0x42fe59[_0xe4e2('0x8b')])){return this['channel'][_0xe4e2('0xb6')](_0xe4e2('0xf9'));}if(!this[_0xe4e2('0x91')](_0x42fe59['text'])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0xb7'));}this[_0xe4e2('0x10')]['bot']=!![];this[_0xe4e2('0x3b')](_0x42fe59);this[_0xe4e2('0x47')](_0x42fe59[_0xe4e2('0x65')],'in','','');this[_0xe4e2('0x10')]['noop'](util[_0xe4e2('0x2d')](_0xe4e2('0xfa'),_0x42fe59[_0xe4e2('0x65')]));var _0x194a18=this[_0xe4e2('0x87')][_0xe4e2('0x7b')](this,_0x42fe59);if(_0x194a18){for(var _0x53e5b6 in _0x194a18){if(_0x194a18[_0xe4e2('0xa1')](_0x53e5b6)){if(_0x53e5b6!==_0xe4e2('0xfb')){this[_0xe4e2('0x10')][_0xe4e2('0xaa')](util['format'](_0xe4e2('0xf1'),_0x53e5b6[_0xe4e2('0x76')]()),_0x194a18[_0x53e5b6]);}}}this[_0xe4e2('0x47')](_0x194a18[_0xe4e2('0xf2')],_0xe4e2('0xf3'),'dialogflowV2',_0x194a18[_0xe4e2('0xfb')]);return this[_0xe4e2('0x10')]['noop'](util[_0xe4e2('0x2d')]('DialogflowV2\x20Result\x20%s',_0x194a18[_0xe4e2('0xf2')]));}return this[_0xe4e2('0x10')]['error'](_0x42fe59,_0xe4e2('0xfc'));};AGIVertices[_0xe4e2('0x19')]['sesteknda']=function(_0x539df6){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0xfd'),_0x539df6[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x539df6['ndauth_url'])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0xfe'));}if(!this[_0xe4e2('0x91')](_0x539df6['username'])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0xff'));}if(!this[_0xe4e2('0x91')](_0x539df6[_0xe4e2('0x100')])){return this[_0xe4e2('0x10')]['noop'](_0xe4e2('0x101'));}if(!this[_0xe4e2('0x91')](_0x539df6['ndassistant_url'])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0xb7'));}this['channel'][_0xe4e2('0xef')]=!![];this[_0xe4e2('0x3b')](_0x539df6);this['createSquareMessage'](_0x539df6[_0xe4e2('0x65')],'in','','');this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util['format'](_0xe4e2('0x102'),_0x539df6[_0xe4e2('0x65')]));var _0x12f5db=this[_0xe4e2('0x8c')][_0xe4e2('0x7b')](this,_0x539df6);if(_0x12f5db){for(var _0x238bb4 in _0x12f5db){if(_0x12f5db[_0xe4e2('0xa1')](_0x238bb4)){this['channel']['setVariable'](util['format'](_0xe4e2('0x103'),_0x238bb4[_0xe4e2('0x76')]()),_0x12f5db[_0x238bb4]);}}this[_0xe4e2('0x47')](_0x12f5db[_0xe4e2('0xf2')],'out',_0xe4e2('0x104'),'');if(_0x12f5db[_0xe4e2('0x105')]){this['channel'][_0xe4e2('0xb6')](util['format'](_0xe4e2('0x106'),_0x12f5db[_0xe4e2('0x105')]));var _0xfa7e9c=this[_0xe4e2('0x10')][_0xe4e2('0x107')](_0x12f5db[_0xe4e2('0x105')]);try{fs['unlink'](_0x12f5db[_0xe4e2('0x105')]+_0xe4e2('0x108'));}catch(_0x229607){logger[_0xe4e2('0x37')](_0x229607);}return _0xfa7e9c;}else{return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0x109'),_0x12f5db[_0xe4e2('0xf2')]));}}return this['channel'][_0xe4e2('0x37')](_0x539df6,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0xe4e2('0x10a')]=function(_0x3f5c96){logger['info'](util[_0xe4e2('0x2d')](_0xe4e2('0x10b'),_0x3f5c96['label']));return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0x10a'));};AGIVertices[_0xe4e2('0x19')]['ext_dial']=function(_0xbedb46){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xbedb46[_0xe4e2('0x3d')]));var _0x47b7eb='';if(_0xbedb46[_0xe4e2('0x10c')]){if(!this['isConfigured'](_0xbedb46[_0xe4e2('0x10c')])){return this['channel'][_0xe4e2('0x37')](_0xbedb46,_0xe4e2('0x10d'));}else{var _0xfe8e24=parseInt(_0xbedb46[_0xe4e2('0x10c')],0xa);if(isNaN(_0xfe8e24)){_0x47b7eb=_0xbedb46[_0xe4e2('0x10c')];}else{_0x47b7eb=this[_0xe4e2('0x10e')][_0xe4e2('0x7b')](this,_0xbedb46[_0xe4e2('0x10c')]);if(!_0x47b7eb){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0xbedb46,_0xe4e2('0x10f'));}}}}else if(_0xbedb46[_0xe4e2('0x110')]){_0x47b7eb=_0xbedb46[_0xe4e2('0x110')];}else{return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0xbedb46,'no\x20trunk\x20selected');}var _0xa8856b=this['channel']['exec'](_0xe4e2('0xe9'),[util['format'](_0xe4e2('0x111'),_0x47b7eb,_0xbedb46['phone']),_0xbedb46['timeout'],_0xbedb46[_0xe4e2('0xeb')],_0xbedb46[_0xe4e2('0x6f')]]);if(_0xa8856b['result']===-0x1){return _0xa8856b;}return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0xec'),_0xe4e2('0xe9')));};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x112')]=function(_0x3c5f62){logger[_0xe4e2('0x33')](util['format'](_0xe4e2('0x113'),_0x3c5f62[_0xe4e2('0x3d')]));return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0x112'));};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0xe')]=function(_0x26f7bc){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x114'),_0x26f7bc[_0xe4e2('0x3d')]));if(_0x26f7bc['retry']===0x0){return this['maxRetry'](_0x26f7bc);}_0x26f7bc['retry']-=0x1;if(!this[_0xe4e2('0x91')](_0x26f7bc[_0xe4e2('0x115')])){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x26f7bc,_0xe4e2('0x116'));}var _0x1c3de9=this[_0xe4e2('0x21')][_0xe4e2('0x7b')](this,_0x26f7bc[_0xe4e2('0x115')]);if(!_0x1c3de9){return this[_0xe4e2('0x10')]['error'](_0x26f7bc,_0xe4e2('0x117'));}if(!this[_0xe4e2('0x91')](_0x26f7bc[_0xe4e2('0xe0')])){return this[_0xe4e2('0x10')]['error'](_0xe4e2('0xe1'));}var _0x5f527c=this[_0xe4e2('0x10')][_0xe4e2('0x118')](_0x1c3de9,_0x26f7bc['response'],_0x26f7bc[_0xe4e2('0x119')]);var _0x4cf5fa=_0x5f527c[_0xe4e2('0xb0')]?_0x5f527c[_0xe4e2('0xb0')]['toString']():'';logger[_0xe4e2('0x33')](_0xe4e2('0x11a'),JSON[_0xe4e2('0x7e')](_0x5f527c));if(_0x5f527c[_0xe4e2('0xb0')]===-0x1){this[_0xe4e2('0x3b')]['sync'](this,_0x26f7bc,_0x4cf5fa);return _0x5f527c;}else if(_0x5f527c['extra']===_0xe4e2('0x70')){_0x5f527c[_0xe4e2('0xb0')]=_0x4cf5fa[_0xe4e2('0xa6')]>=parseInt(_0x26f7bc[_0xe4e2('0x11b')])?'x':'i';}else{_0x5f527c['result']=_0x4cf5fa[_0xe4e2('0xa6')]>=parseInt(_0x26f7bc['mindigit'])&&_0x4cf5fa[_0xe4e2('0xa6')]<=parseInt(_0x26f7bc[_0xe4e2('0x119')])?'x':'i';}var _0x11392c=this[_0xe4e2('0x13')][_0xe4e2('0x7b')](this,_0x26f7bc[_0xe4e2('0xe0')]);if(!_0x11392c){return this['channel'][_0xe4e2('0x37')](_0x26f7bc,_0xe4e2('0xe2'));}this[_0xe4e2('0x10')]['setVariable'](_0x11392c,_0x4cf5fa);if(this[_0xe4e2('0x91')](_0x26f7bc[_0xe4e2('0x11c')])){var _0x2d28d2=parseInt(_0x26f7bc[_0xe4e2('0x11c')],0xa);var _0x558ab1=rs[_0xe4e2('0x11d')]({'charset':'*','length':_0x2d28d2});var _0x4692bc=_0x4cf5fa[_0xe4e2('0xa6')];if(_0x4692bc>0x0){if(_0x4692bc>_0x2d28d2){this[_0xe4e2('0x3b')][_0xe4e2('0x7b')](this,_0x26f7bc,_0x26f7bc[_0xe4e2('0x11e')]===_0xe4e2('0x11f')?_0x558ab1+_0x4cf5fa['substr'](_0x2d28d2):_0x4cf5fa[_0xe4e2('0x120')](0x0,_0x4692bc-_0x2d28d2)+_0x558ab1);}else{this[_0xe4e2('0x3b')][_0xe4e2('0x7b')](this,_0x26f7bc,rs['generate']({'charset':'*','length':_0x4692bc}));}}else{this[_0xe4e2('0x3b')][_0xe4e2('0x7b')](this,_0x26f7bc,'');}}else{this[_0xe4e2('0x3b')][_0xe4e2('0x7b')](this,_0x26f7bc,_0x4cf5fa);}return _0x5f527c;};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0xf')]=function(_0x14501a){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x121'),_0x14501a[_0xe4e2('0x3d')]));return this[_0xe4e2('0xe')](_0x14501a);};AGIVertices['prototype'][_0xe4e2('0x122')]=function(_0x65a6de){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x123'),_0x65a6de[_0xe4e2('0x3d')]));this[_0xe4e2('0x3b')]['sync'](this,_0x65a6de,_0x65a6de[_0xe4e2('0x124')]);return this[_0xe4e2('0x10')]['noop'](util['format'](_0xe4e2('0x125'),_0x65a6de[_0xe4e2('0x124')]));};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x126')]=function(_0x35910c){logger['info'](util[_0xe4e2('0x2d')](_0xe4e2('0x127'),_0x35910c[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x35910c[_0xe4e2('0x94')])||!this[_0xe4e2('0x91')](_0x35910c[_0xe4e2('0x95')])){return this['channel'][_0xe4e2('0xb6')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xe4e2('0x91')](_0x35910c['text'])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0xb7'));}this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util['format'](_0xe4e2('0x128'),_0x35910c[_0xe4e2('0x65')]));var _0x29226c=this['awsPolly'][_0xe4e2('0x7b')](this,_0x35910c);if(_0x29226c){this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0x129'),_0x29226c));var _0x42de1f=this['channel'][_0xe4e2('0x107')](_0x29226c);try{fs[_0xe4e2('0x12a')](_0x29226c+'.wav');}catch(_0x1c31cb){logger[_0xe4e2('0x37')](_0x1c31cb);}return _0x42de1f;}return this['channel']['error'](_0x35910c,_0xe4e2('0x12b'));};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x12c')]=function(_0x3feb4e){logger['info'](util[_0xe4e2('0x2d')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x3feb4e[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x3feb4e[_0xe4e2('0x94')])||!this[_0xe4e2('0x91')](_0x3feb4e['aws_secret_access_key'])){return this['channel']['noop'](_0xe4e2('0x12d'));}if(!this[_0xe4e2('0x91')](_0x3feb4e[_0xe4e2('0x12e')])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0x12f'));}if(!this[_0xe4e2('0x91')](_0x3feb4e[_0xe4e2('0x65')])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0xb7'));}this['channel'][_0xe4e2('0xef')]=!![];this[_0xe4e2('0x3b')](_0x3feb4e);this['createSquareMessage'](_0x3feb4e[_0xe4e2('0x65')],'in','','');this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0x130'),_0x3feb4e[_0xe4e2('0x65')]));var _0x3ed978=this[_0xe4e2('0x99')][_0xe4e2('0x7b')](this,_0x3feb4e);if(_0x3ed978){for(var _0x1530a4 in _0x3ed978){if(_0x3ed978['hasOwnProperty'](_0x1530a4)&&_[_0xe4e2('0xa2')](_0x3ed978[_0x1530a4])){this[_0xe4e2('0x10')][_0xe4e2('0xaa')](util[_0xe4e2('0x2d')](_0xe4e2('0x131'),_0x1530a4[_0xe4e2('0x76')]()),_0x3ed978[_0x1530a4]);}}if(_[_0xe4e2('0x4a')](_0x3ed978[_0xe4e2('0x81')])){return this[_0xe4e2('0x10')]['noop'](_0xe4e2('0x132'));}else{this['createSquareMessage'](_0x3ed978[_0xe4e2('0x81')],_0xe4e2('0xf3'),_0xe4e2('0x133'),'');return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')]('Amazon\x20Lex\x20Result\x20%s',_0x3ed978['message']));}}return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x3feb4e,_0xe4e2('0x134'));};AGIVertices['prototype']['googleasr']=function(_0x5262e3){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x135'),_0x5262e3[_0xe4e2('0x3d')],_0x5262e3[_0xe4e2('0x70')]));if(!this[_0xe4e2('0x91')](_0x5262e3['key'])){return this[_0xe4e2('0x10')]['noop'](_0xe4e2('0xee'));}var _0x3e91af=_0xe4e2('0x136');var _0x17c908=util[_0xe4e2('0x2d')]('%s/recordings/%s',FILES_PATH,rs[_0xe4e2('0x11d')](0x4));var _0x2c96ea=util[_0xe4e2('0x2d')](_0xe4e2('0xa8'),_0x17c908,_0x3e91af);var _0x3623e9=!![];if(_0x5262e3[_0xe4e2('0x137')]==='NOBEEP'){_0x3623e9=![];}var _0x28c14c=this[_0xe4e2('0x10')][_0xe4e2('0x138')](_0x17c908,_0x3e91af,_0x5262e3[_0xe4e2('0x139')],_0x5262e3[_0xe4e2('0x70')],undefined,_0x3623e9);if(_0x28c14c['result']!==-0x1){this['channel'][_0xe4e2('0xb6')](util['format'](_0xe4e2('0x13a'),_0x2c96ea));var _0x301de1=this[_0xe4e2('0x9b')][_0xe4e2('0x7b')](this,_0x5262e3,_0x2c96ea);if(_0x301de1){for(var _0x29486d in _0x301de1){if(_0x301de1['hasOwnProperty'](_0x29486d)){this[_0xe4e2('0x10')][_0xe4e2('0xaa')](util['format'](_0xe4e2('0x13b'),_0x29486d['toUpperCase']()),_0x301de1[_0x29486d]);}}return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')]('GoogleASR\x20Result\x20%s',JSON[_0xe4e2('0x7e')](_0x301de1)));}}return _0x28c14c;};AGIVertices[_0xe4e2('0x19')]['tildeasr']=function(_0x390d49){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x390d49[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x390d49[_0xe4e2('0x13c')])){return this[_0xe4e2('0x10')]['noop'](_0xe4e2('0x13d'));}if(!this[_0xe4e2('0x91')](_0x390d49['appsecret'])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')]('no\x20appsecret\x20configured');}var _0x1ad4c5='wav';var _0x49416e=util[_0xe4e2('0x2d')](_0xe4e2('0x13e'),FILES_PATH,rs['generate'](0x4));var _0x1c6df9=util['format'](_0xe4e2('0xa8'),_0x49416e,_0x1ad4c5);var _0x4d1d39=!![];if(_0x390d49['beep']===_0xe4e2('0x13f')){_0x4d1d39=![];}var _0x426485=this[_0xe4e2('0x10')][_0xe4e2('0x138')](_0x49416e,_0x1ad4c5,_0x390d49[_0xe4e2('0x139')],_0x390d49[_0xe4e2('0x70')],undefined,_0x4d1d39);if(_0x426485['result']!==-0x1){this['channel'][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0x140'),_0x1c6df9));var _0x1dd8b2=this['tildeASR'][_0xe4e2('0x7b')](this,_0x390d49,_0x1c6df9);if(_0x1dd8b2){for(var _0x35e11e in _0x1dd8b2){if(_0x1dd8b2[_0xe4e2('0xa1')](_0x35e11e)){this[_0xe4e2('0x10')]['setVariable'](util[_0xe4e2('0x2d')]('TILDE_ASR_%s',_0x35e11e[_0xe4e2('0x76')]()),_0x1dd8b2[_0x35e11e]);}}return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')]('TildeASR\x20Result\x20%s',JSON[_0xe4e2('0x7e')](_0x1dd8b2)));}}return _0x426485;};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x141')]=function(_0x594d55){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x142'),_0x594d55[_0xe4e2('0x3d')]));return this[_0xe4e2('0x10')][_0xe4e2('0x143')](_0x594d55[_0xe4e2('0x42')],_0x594d55['extension'],_0x594d55['priority']);};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x144')]=function(_0x5622cb){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x145'),_0x5622cb[_0xe4e2('0x3d')]));if(!this['isConfigured'](_0x5622cb[_0xe4e2('0x146')])){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x5622cb,_0xe4e2('0x147'));}try{var _0x490281=eval(_0x5622cb[_0xe4e2('0x146')])?_0xe4e2('0x148'):'false';this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0x149'),_0x5622cb[_0xe4e2('0x146')],_0x490281));return{'code':0xc8,'result':_0x490281};}catch(_0x535e0e){return{'code':0xc8,'result':_0xe4e2('0x14a')};}};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x14b')]=function(_0x4adf85){logger[_0xe4e2('0x33')](util['format'](_0xe4e2('0x14c'),_0x4adf85['label']));if(!this[_0xe4e2('0x91')](_0x4adf85[_0xe4e2('0x14d')])){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x4adf85,_0xe4e2('0x14e'));}var _0x492d8a=this[_0xe4e2('0x26')][_0xe4e2('0x7b')](this,_0x4adf85[_0xe4e2('0x14d')]);if(!_0x492d8a){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x4adf85,_0xe4e2('0x14f'));}for(var _0x37a306=0x0;_0x37a306<_0x492d8a[_0xe4e2('0xa6')];_0x37a306+=0x1){var _0xb44609=this[_0xe4e2('0x10')]['getVariable'](util[_0xe4e2('0x2d')](_0xe4e2('0x150'),_0x492d8a[_0x37a306]));if(_0xb44609[_0xe4e2('0xb0')]===-0x1){return _0xb44609;}logger[_0xe4e2('0x33')](util['format'](_0xe4e2('0x151'),_0x492d8a[_0x37a306],_0xb44609[_0xe4e2('0xae')]));if(_0xb44609[_0xe4e2('0xae')]==='true'){logger['info'](util[_0xe4e2('0x2d')](_0xe4e2('0x151'),_0x492d8a[_0x37a306],_0xe4e2('0x148')));this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0x151'),_0x492d8a[_0x37a306],_0xe4e2('0x148')));return{'code':0xc8,'result':_0xe4e2('0x148')};}else{logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x151'),_0x492d8a[_0x37a306],_0xe4e2('0x14a')));this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0x151'),_0x492d8a[_0x37a306],_0xe4e2('0x14a')));}}return{'code':0xc8,'result':_0xe4e2('0x14a')};};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x152')]=function(_0x2d9c47){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x2d9c47['label']));return this['channel'][_0xe4e2('0x152')]();};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x153')]=function(_0x15fbf4){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x154'),_0x15fbf4[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x15fbf4['key'])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')]('no\x20key\x20configured');}var _0x39f5dd=_0xe4e2('0x136');var _0x31fd9e=util[_0xe4e2('0x2d')](_0xe4e2('0x13e'),FILES_PATH,rs['generate'](0x4));var _0x33dff5=util[_0xe4e2('0x2d')](_0xe4e2('0xa8'),_0x31fd9e,_0x39f5dd);var _0x1d4751=!![];if(_0x15fbf4[_0xe4e2('0x137')]===_0xe4e2('0x13f')){_0x1d4751=![];}var _0x554697=this[_0xe4e2('0x10')]['recordFile'](_0x31fd9e,_0x39f5dd,_0x15fbf4[_0xe4e2('0x139')],_0x15fbf4[_0xe4e2('0x70')],undefined,_0x1d4751);if(_0x554697['result']!==-0x1){this[_0xe4e2('0x10')]['noop'](util[_0xe4e2('0x2d')](_0xe4e2('0x155'),_0x33dff5));var _0x119dba=this[_0xe4e2('0x8f')][_0xe4e2('0x7b')](this,_0x15fbf4,_0x33dff5);if(_0x119dba){for(var _0xc5b69d in _0x119dba){if(_0x119dba['hasOwnProperty'](_0xc5b69d)){this['channel'][_0xe4e2('0xaa')](util[_0xe4e2('0x2d')](_0xe4e2('0x156'),_0xc5b69d[_0xe4e2('0x76')]()),_0x119dba[_0xc5b69d]);}}return this[_0xe4e2('0x10')]['noop'](util[_0xe4e2('0x2d')](_0xe4e2('0x157'),JSON[_0xe4e2('0x7e')](_0x119dba)));}}return _0x554697;};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x158')]=function(_0x42e2d4){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x159'),_0x42e2d4[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x42e2d4[_0xe4e2('0x85')])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0xee'));}if(!this[_0xe4e2('0x91')](_0x42e2d4[_0xe4e2('0x65')])){return this['channel']['noop'](_0xe4e2('0xb7'));}this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0x15a'),_0x42e2d4[_0xe4e2('0x65')]));var _0x228f28=this['ispeechTTS'][_0xe4e2('0x7b')](this,_0x42e2d4);if(_0x228f28){this['channel'][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')]('ispeech\x20%s\x20file\x20created',_0x228f28));var _0x2fb440=this[_0xe4e2('0x10')][_0xe4e2('0x107')](_0x228f28,_0x42e2d4[_0xe4e2('0x139')]);try{fs['unlink'](_0x228f28+_0xe4e2('0x108'));}catch(_0x2698df){logger[_0xe4e2('0x37')](_0x2698df);}return _0x2fb440;}return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x42e2d4,_0xe4e2('0x15b'));};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x15c')]=function(_0x19600e){logger[_0xe4e2('0x33')](util['format'](_0xe4e2('0x15d'),_0x19600e['label']));if(!this['isConfigured'](_0x19600e['findBy'])){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x19600e,_0xe4e2('0x15e'));}logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x15f'),this[_0xe4e2('0x10')]['callerid'],_0x19600e[_0xe4e2('0x160')]));var _0x1f4c65=this[_0xe4e2('0x5a')][_0xe4e2('0x7b')](this,_0x19600e[_0xe4e2('0x160')]);if(_0x1f4c65){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe4e2('0x10')][_0xe4e2('0x3f')],_0x19600e[_0xe4e2('0x160')]));this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0x161'),this[_0xe4e2('0x10')]['callerid'],_0x19600e[_0xe4e2('0x160')]));return{'code':0xc8,'result':_0xe4e2('0x162')};}else{logger[_0xe4e2('0x33')](util['format'](_0xe4e2('0x163'),this[_0xe4e2('0x10')][_0xe4e2('0x3f')],_0x19600e[_0xe4e2('0x160')]));this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe4e2('0x10')][_0xe4e2('0x3f')],_0x19600e[_0xe4e2('0x160')]));return{'code':0xc8,'result':_0xe4e2('0x164')};}};AGIVertices['prototype'][_0xe4e2('0x165')]=function(_0x27ede0){logger[_0xe4e2('0x33')](util['format'](_0xe4e2('0x166'),_0x27ede0[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x27ede0['findBy'])){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x27ede0,_0xe4e2('0x15e'));}logger[_0xe4e2('0x33')](util['format'](_0xe4e2('0x15f'),this[_0xe4e2('0x10')]['callerid'],_0x27ede0[_0xe4e2('0x160')]));var _0x53dabc=this[_0xe4e2('0x59')][_0xe4e2('0x7b')](this,_0x27ede0['findBy']);if(_0x53dabc){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x161'),this[_0xe4e2('0x10')]['callerid'],_0x27ede0[_0xe4e2('0x160')]));this['channel']['noop'](util['format'](_0xe4e2('0x161'),this[_0xe4e2('0x10')]['callerid'],_0x27ede0[_0xe4e2('0x160')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe4e2('0x33')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xe4e2('0x3f')],_0x27ede0['findBy']));this[_0xe4e2('0x10')]['noop'](util[_0xe4e2('0x2d')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe4e2('0x10')][_0xe4e2('0x3f')],_0x27ede0[_0xe4e2('0x160')]));return{'code':0xc8,'result':_0xe4e2('0x164')};}};AGIVertices['prototype']['math']=function(_0x489035){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x167'),_0x489035[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x489035[_0xe4e2('0x168')])){return this['channel'][_0xe4e2('0x37')](_0x489035,_0xe4e2('0x169'));}this['channel'][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0x16a'),_0x489035[_0xe4e2('0x168')]));var _0x116b19=eval(_0x489035[_0xe4e2('0x168')]);if(!this[_0xe4e2('0x91')](_0x489035[_0xe4e2('0xe0')])){return this['channel'][_0xe4e2('0xb6')](_0xe4e2('0xe1'));}var _0x1e9b84=this[_0xe4e2('0x13')][_0xe4e2('0x7b')](this,_0x489035[_0xe4e2('0xe0')]);if(!_0x1e9b84){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x489035,'no\x20variable\x20found');}if(_[_0xe4e2('0xa9')](_0x116b19)){var _0x594e46=this;_0x116b19['forEach'](function(_0x303f4e,_0x22a4cb){_0x594e46[_0xe4e2('0x10')][_0xe4e2('0xaa')](util[_0xe4e2('0x2d')]('%s[%s]',_0x1e9b84,_0x22a4cb),_0x303f4e);});return this['channel']['noop'](util[_0xe4e2('0x2d')](_0xe4e2('0x16b'),_0x1e9b84));}else{return this[_0xe4e2('0x10')][_0xe4e2('0xaa')](_0x1e9b84,_0x116b19);}};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0xd')]=function(_0x3a1d25){logger[_0xe4e2('0x33')](util['format'](_0xe4e2('0x16c'),_0x3a1d25['label']));if(_0x3a1d25[_0xe4e2('0xb3')]===0x0){return this[_0xe4e2('0xb2')](_0x3a1d25);}_0x3a1d25[_0xe4e2('0xb3')]-=0x1;if(!this['isConfigured'](_0x3a1d25['file_id'])){return this[_0xe4e2('0x10')]['error'](_0x3a1d25,'no\x20file\x20audio\x20selected');}var _0x521a08=this[_0xe4e2('0x21')][_0xe4e2('0x7b')](this,_0x3a1d25['file_id']);if(!_0x521a08){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x3a1d25,_0xe4e2('0x117'));}var _0x2b2e58=this['channel'][_0xe4e2('0x118')](_0x521a08,_0x3a1d25[_0xe4e2('0x16d')],_0x3a1d25['digit']);var _0x6d6987=_0x2b2e58[_0xe4e2('0xb0')];if(_0x2b2e58[_0xe4e2('0xb0')]===-0x1){this[_0xe4e2('0x3b')]['sync'](this,_0x3a1d25,'-1');return _0x2b2e58;}else if(_0x2b2e58[_0xe4e2('0xae')]==='timeout'){_0x2b2e58[_0xe4e2('0xb0')]=_0x2b2e58['result'][_0xe4e2('0xa6')]>0x0?_0x2b2e58['result']:'t';}else if(_[_0xe4e2('0x49')](_0x2b2e58[_0xe4e2('0xb0')])){_0x2b2e58[_0xe4e2('0xb0')]='#';_0x6d6987='#';}if(!this[_0xe4e2('0x91')](_0x3a1d25[_0xe4e2('0xe0')])){this[_0xe4e2('0x10')][_0xe4e2('0xb6')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x5e5276=this[_0xe4e2('0x13')][_0xe4e2('0x7b')](this,_0x3a1d25[_0xe4e2('0xe0')]);if(!_0x5e5276){return this['channel'][_0xe4e2('0x37')](_0x3a1d25,'no\x20variable\x20found');}this['channel'][_0xe4e2('0xaa')](_0x5e5276,_0x6d6987);}this[_0xe4e2('0x3b')]['sync'](this,_0x3a1d25,_0x6d6987);return _0x2b2e58;};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0xb6')]=function(_0x2f507a){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x16e'),_0x2f507a[_0xe4e2('0x3d')]));return this['channel'][_0xe4e2('0xb6')](_0x2f507a[_0xe4e2('0x16f')]||_0x2f507a['label']);};AGIVertices['prototype']['pause']=function(_0x47b530){logger['info'](util['format'](_0xe4e2('0x170'),_0x47b530['label']));if(!this[_0xe4e2('0x91')](_0x47b530[_0xe4e2('0x160')])){return this[_0xe4e2('0x10')]['error'](_0x47b530,_0xe4e2('0x15e'));}logger['info'](util[_0xe4e2('0x2d')](_0xe4e2('0x15f'),this[_0xe4e2('0x10')]['callerid'],_0x47b530[_0xe4e2('0x160')]));var _0x248267=this['getPause']['sync'](this,_0x47b530[_0xe4e2('0x171')]);var _0x430811=this[_0xe4e2('0x56')][_0xe4e2('0x7b')](this,_0x47b530[_0xe4e2('0x160')],_0x248267);if(_0x430811){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x161'),this['channel'][_0xe4e2('0x3f')],_0x47b530['findBy']));this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0x161'),this[_0xe4e2('0x10')][_0xe4e2('0x3f')],_0x47b530[_0xe4e2('0x160')]));return{'code':0xc8,'result':_0xe4e2('0x162')};}else{logger[_0xe4e2('0x33')](util['format'](_0xe4e2('0x163'),this['channel'][_0xe4e2('0x3f')],_0x47b530[_0xe4e2('0x160')]));this['channel'][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe4e2('0x10')][_0xe4e2('0x3f')],_0x47b530[_0xe4e2('0x160')]));return{'code':0xc8,'result':_0xe4e2('0x164')};}};AGIVertices['prototype']['playback']=function(_0x59f98e){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x172'),_0x59f98e[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x59f98e[_0xe4e2('0x115')])){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x59f98e,'no\x20file\x20audio\x20selected');}var _0x393c01=this[_0xe4e2('0x21')][_0xe4e2('0x7b')](this,_0x59f98e[_0xe4e2('0x115')]);if(!_0x393c01){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x59f98e,_0xe4e2('0x117'));}var _0x143536=this['channel'][_0xe4e2('0x5f')](_0xe4e2('0x173'),[_0x393c01,_0x59f98e[_0xe4e2('0xeb')]]);if(_0x143536['result']===-0x1){return _0x143536;}return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0xce'),'PLAYBACK',_0x393c01));};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x174')]=function(_0x14ef7e){logger[_0xe4e2('0x33')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x14ef7e[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x14ef7e[_0xe4e2('0x175')])){return this['channel'][_0xe4e2('0x37')](_0x14ef7e,_0xe4e2('0x176'));}var _0x26224d='';var _0x119534=parseInt(_0x14ef7e[_0xe4e2('0x175')],0xa);if(isNaN(_0x119534)){_0x26224d=_0x14ef7e[_0xe4e2('0x175')];}else{_0x26224d=this[_0xe4e2('0x17')]['sync'](this,_0x14ef7e[_0xe4e2('0x175')]);if(!_0x26224d){return this['channel']['error'](_0x14ef7e,'no\x20queue\x20found');}}var _0x52c41a='';if(this['isConfigured'](_0x14ef7e[_0xe4e2('0x115')])){var _0x2daa1e=this['getSound']['sync'](this,_0x14ef7e['file_id']);if(_0x2daa1e){_0x52c41a=_0x2daa1e;}}this[_0xe4e2('0x3b')]['sync'](this,_0x14ef7e,_0x26224d);if(_0x14ef7e[_0xe4e2('0xeb')][_0xe4e2('0x177')]('x')<0x0){_0x14ef7e[_0xe4e2('0xeb')]+='x';}if(_0x14ef7e['opts'][_0xe4e2('0x177')]('X')<0x0){_0x14ef7e[_0xe4e2('0xeb')]+='X';}this['channel'][_0xe4e2('0xaa')]('XMCS-QUEUE',_0x26224d?_0x26224d[_0xe4e2('0x178')]():'');var _0x24016e=this[_0xe4e2('0x10')]['exec'](_0xe4e2('0x179'),[_0x26224d,_0x14ef7e[_0xe4e2('0xeb')],_0x14ef7e[_0xe4e2('0x6f')],_0x52c41a,_0x14ef7e['timeout'],_0x14ef7e[_0xe4e2('0x8')],_0x14ef7e[_0xe4e2('0x17a')],_0x14ef7e['gosub'],'',_0x14ef7e[_0xe4e2('0x17b')]]);if(_0x24016e['result']===-0x1){return _0x24016e;}return this['channel'][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x26224d));};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x17c')]=function(_0x26faea){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x26faea[_0xe4e2('0x3d')]));var _0xe46404=_0x26faea[_0xe4e2('0x17d')]||'wav';var _0x322bb2=util['format'](_0xe4e2('0x17e'),this[_0xe4e2('0x10')][_0xe4e2('0x3c')],rs[_0xe4e2('0x11d')](0x5));var _0x34c96f=util[_0xe4e2('0x2d')]('%s/recordings/%s.%s',FILES_PATH,_0x322bb2,_0xe46404);var _0x337d23=util['format'](_0xe4e2('0x13e'),FILES_PATH,_0x322bb2);this[_0xe4e2('0x40')][_0xe4e2('0x7b')](this,_0x26faea,_0x322bb2,_0x34c96f);this[_0xe4e2('0x10')][_0xe4e2('0xaa')](_0xe4e2('0x17f'),_0x322bb2);logger[_0xe4e2('0x33')](_0xe4e2('0x180'),_0x337d23,_0xe46404,_0x26faea[_0xe4e2('0x181')],_0x26faea[_0xe4e2('0x70')]);return this[_0xe4e2('0x10')][_0xe4e2('0x138')](_0x337d23,_0xe46404,_0x26faea[_0xe4e2('0x181')],_0x26faea['timeout'],undefined,!![]);};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x182')]=function(_0x19e554){logger[_0xe4e2('0x33')](util['format'](_0xe4e2('0x183'),_0x19e554[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x19e554[_0xe4e2('0x6f')])){return this[_0xe4e2('0x10')]['noop'](_0xe4e2('0x184'));}var _0x216ba4=this[_0xe4e2('0x6e')][_0xe4e2('0x7b')](this,_0x19e554);logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')]('Response:',util[_0xe4e2('0x185')](_0x216ba4,{'showHidden':![],'depth':null})));if(!this[_0xe4e2('0x91')](_0x19e554['variable_id'])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0x186'));}var _0x2238cf=this['getVariable'][_0xe4e2('0x7b')](this,_0x19e554['variable_id']);if(!_0x2238cf){return this['channel'][_0xe4e2('0x37')](_0x19e554,'no\x20variable\x20found');}this[_0xe4e2('0x10')][_0xe4e2('0xaa')](util[_0xe4e2('0x2d')]('%s_STATUS_CODE',_0x2238cf),_0x216ba4[_0xe4e2('0x80')]?_0x216ba4[_0xe4e2('0x80')]:_0xe4e2('0x187'));this[_0xe4e2('0x10')][_0xe4e2('0xaa')](util['format']('%s_STATUS_MESSAGE',_0x2238cf),_0x216ba4['statusMessage']?_0x216ba4[_0xe4e2('0x188')]:'OK');if(_0x216ba4[_0xe4e2('0x7f')]){try{this[_0xe4e2('0xa7')](_0x216ba4['body'],_0x2238cf);}catch(_0x3b26ba){logger['error'](util['format'](_0xe4e2('0x189'),_0x2238cf));}}return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0x18a'),_0x2238cf));};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x18b')]=function(_0x4bfe47){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x18c'),_0x4bfe47[_0xe4e2('0x3d')]));return this[_0xe4e2('0x10')][_0xe4e2('0x18d')](_0x4bfe47[_0xe4e2('0x18e')][_0xe4e2('0x61')](/\s+/g,''),_0x4bfe47['escape_digits']);};AGIVertices[_0xe4e2('0x19')]['saynumber']=function(_0x2244c2){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x18f'),_0x2244c2[_0xe4e2('0x3d')]));return this[_0xe4e2('0x10')][_0xe4e2('0x190')](_0x2244c2['number'][_0xe4e2('0x61')](/\s+/g,''),_0x2244c2[_0xe4e2('0x181')]);};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x191')]=function(_0x1323e2){logger['info'](util[_0xe4e2('0x2d')](_0xe4e2('0x192'),_0x1323e2[_0xe4e2('0x3d')]));return this[_0xe4e2('0x10')][_0xe4e2('0x193')](_0x1323e2[_0xe4e2('0x65')],_0x1323e2['escape_digits']);};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x194')]=function(_0x2f023e){logger['info'](util['format'](_0xe4e2('0x195'),_0x2f023e['label']));if(!this[_0xe4e2('0x91')](_0x2f023e[_0xe4e2('0x196')])){return this[_0xe4e2('0x10')]['noop'](_0xe4e2('0x197'));}var _0x70419a=this[_0xe4e2('0x23')][_0xe4e2('0x7b')](this,_0x2f023e['account_id']);if(!_0x70419a||!_0x70419a[_0xe4e2('0x198')]){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x2f023e,_0xe4e2('0x199'));}var _0xf79c29={'from':util[_0xe4e2('0x2d')](_0xe4e2('0x19a'),_0x70419a['name'],_0x70419a['email']||_0x70419a[_0xe4e2('0x198')][_0xe4e2('0x19b')]),'to':_0x2f023e['to']||'','cc':_0x2f023e['cc']||'','bcc':_0x2f023e[_0xe4e2('0x19c')]||'','subject':_0x2f023e[_0xe4e2('0x19d')],'html':_0x2f023e[_0xe4e2('0x65')],'text':_0x2f023e[_0xe4e2('0x65')]};var _0xcee234={'tls':{'rejectUnauthorized':![]}};if(_0x70419a[_0xe4e2('0x198')][_0xe4e2('0x19e')]){_0xcee234['service']=_0x70419a[_0xe4e2('0x198')][_0xe4e2('0x19e')];}else{_0xcee234['host']=_0x70419a['Smtp'][_0xe4e2('0x19f')];_0xcee234['port']=_0x70419a[_0xe4e2('0x198')][_0xe4e2('0x1a0')];_0xcee234[_0xe4e2('0x1a1')]=_0x70419a[_0xe4e2('0x198')][_0xe4e2('0x1a1')];}if(_0x70419a['Smtp'][_0xe4e2('0x1a2')]){_0xcee234[_0xe4e2('0x1a3')]={'user':_0x70419a['Smtp'][_0xe4e2('0x19b')],'pass':_0x70419a[_0xe4e2('0x198')][_0xe4e2('0x1a4')]};}if(this[_0xe4e2('0x91')](_0x2f023e['template_id'])){}logger[_0xe4e2('0xe6')]('sendMail\x20message',JSON['stringify'](_0xf79c29));this['createSquareDetailsReport'][_0xe4e2('0x7b')](this,_0x2f023e,_0x2f023e[_0xe4e2('0x196')]);this['channel'][_0xe4e2('0xb6')](util['format'](_0xe4e2('0x1a5'),_0x70419a[_0xe4e2('0x15')]));this[_0xe4e2('0x25')]['sync'](this,_0xcee234,_0xf79c29);return this[_0xe4e2('0x10')][_0xe4e2('0xb6')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x1a6')]=function(_0xc83b4c){logger[_0xe4e2('0x33')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0xc83b4c[_0xe4e2('0x3d')]));return this['channel'][_0xe4e2('0xb6')](_0xe4e2('0x1a7'));};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x1a8')]=function(_0x42913c){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x1a9'),_0x42913c[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x42913c['sms_account_id'])){return this[_0xe4e2('0x10')]['noop']('no\x20sms\x20account\x20configured');}var _0x47953e=this['getSmsAccount'][_0xe4e2('0x7b')](this,_0x42913c[_0xe4e2('0x1aa')]);if(!_0x47953e){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x42913c,'no\x20sms\x20account\x20found');}var _0x3f5bd7={'body':_0x42913c[_0xe4e2('0x1ab')],'phone':_0x42913c['to']||'','SmsAccountId':_0x47953e['id']};logger[_0xe4e2('0xe6')](_0xe4e2('0x1ac'),JSON[_0xe4e2('0x7e')](_0x3f5bd7));this['createSquareDetailsReport'][_0xe4e2('0x7b')](this,_0x42913c,_0x42913c[_0xe4e2('0x1aa')]);this['channel']['noop'](util[_0xe4e2('0x2d')](_0xe4e2('0x1ad'),_0x47953e[_0xe4e2('0x15')]));this[_0xe4e2('0x3a')][_0xe4e2('0x7b')](this,_0x3f5bd7);return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0x1ae'));};AGIVertices[_0xe4e2('0x19')]['set']=function(_0x3602e8){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x3602e8[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x3602e8[_0xe4e2('0xe0')])){return this['channel'][_0xe4e2('0x37')](_0x3602e8,_0xe4e2('0x1af'));}var _0x3ac66c=this['getVariable'][_0xe4e2('0x7b')](this,_0x3602e8['variable_id']);if(!_0x3ac66c){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x3602e8,_0xe4e2('0xe2'));}return this[_0xe4e2('0x10')][_0xe4e2('0xaa')](_0x3ac66c,_0x3602e8[_0xe4e2('0x1b0')]);};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x1b1')]=function(_0x3d2467){logger['info'](util['format'](_0xe4e2('0x1b2'),_0x3d2467[_0xe4e2('0x3d')]));this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0x1b3'));if(_0x3d2467[_0xe4e2('0xc3')]==='yes'){this['channel'][_0xe4e2('0xb6')]('Answer');return this[_0xe4e2('0x10')][_0xe4e2('0xc3')]();}return this['channel'][_0xe4e2('0xb6')](_0xe4e2('0x1b4'));};AGIVertices[_0xe4e2('0x19')]['subproject']=function(_0x1987aa){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x1b5'),_0x1987aa[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x1987aa[_0xe4e2('0x1b6')])){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x1987aa,_0xe4e2('0x1b7'));}var _0x3194ae=this[_0xe4e2('0x1a')]['sync'](this,_0x1987aa[_0xe4e2('0x1b6')]);if(!this['isConfigured'](_0x3194ae)){return this[_0xe4e2('0x10')]['error'](_0x1987aa,util[_0xe4e2('0x2d')](_0xe4e2('0x1b8'),_0x1987aa['project_id']));}if(_0x3194ae===this['channel']['arg_1']){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x1987aa,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xe4e2('0x3b')][_0xe4e2('0x7b')](this,_0x1987aa,_0x3194ae);var _0x50e158=this[_0xe4e2('0x10')][_0xe4e2('0x5f')](_0xe4e2('0x1b9'),util[_0xe4e2('0x2d')](_0xe4e2('0x1ba'),config[_0xe4e2('0x8')][_0xe4e2('0x19f')]||_0xe4e2('0x1bb'),_0x3194ae,this[_0xe4e2('0x10')][_0xe4e2('0x3e')]));if(_0x50e158[_0xe4e2('0xb0')]===-0x1){return _0x50e158;}return this['channel'][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0xce'),'AGI',_0x3194ae));};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x1bc')]=function(_0xcff8b2){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0xcff8b2[_0xe4e2('0x3d')]));var _0x309595=this['shellCommand'][_0xe4e2('0x7b')](this,_0xcff8b2[_0xe4e2('0x1bd')]);this[_0xe4e2('0x3b')]['sync'](this,_0xcff8b2,_0xcff8b2[_0xe4e2('0x1bd')]);if(this['isConfigured'](_0xcff8b2[_0xe4e2('0xe0')])){var _0x2f1821=this['getVariable'][_0xe4e2('0x7b')](this,_0xcff8b2[_0xe4e2('0xe0')]);if(_0x2f1821){this['channel'][_0xe4e2('0xaa')](_0x2f1821,_0x309595);return this['channel'][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0xcff8b2['command'],_0x2f1821));}}return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0x1be'),_0xcff8b2[_0xe4e2('0x1bd')]));};AGIVertices['prototype'][_0xe4e2('0x1bf')]=function(_0xc5bc54){logger['info'](util[_0xe4e2('0x2d')](_0xe4e2('0x1c0'),_0xc5bc54[_0xe4e2('0x3d')]));_0xc5bc54['text']=_0xc5bc54[_0xe4e2('0x65')][_0xe4e2('0x61')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe4e2('0x91')](_0xc5bc54[_0xe4e2('0x63')])){return this[_0xe4e2('0x10')]['noop']('no\x20apiKey\x20configured');}if(!this[_0xe4e2('0x91')](_0xc5bc54[_0xe4e2('0x65')])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')]('no\x20text\x20configured');}this['channel'][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0x1c1'),_0xc5bc54[_0xe4e2('0x65')]));var _0x4ccc3b=this[_0xe4e2('0x62')][_0xe4e2('0x7b')](this,_0xc5bc54);if(_0x4ccc3b){this[_0xe4e2('0x10')]['noop'](util[_0xe4e2('0x2d')](_0xe4e2('0x1c2'),_0x4ccc3b));var _0x81e700=this[_0xe4e2('0x10')][_0xe4e2('0x107')](_0x4ccc3b);try{fs[_0xe4e2('0x12a')](_0x4ccc3b+_0xe4e2('0x108'));}catch(_0x5a46e9){logger['error'](_0x5a46e9);}return _0x81e700;}return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0xc5bc54,_0xe4e2('0x1c3'));};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x1c4')]=function(_0x5a2d0c){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x1c5'),_0x5a2d0c[_0xe4e2('0x3d')]));_0x5a2d0c[_0xe4e2('0x65')]=_0x5a2d0c['text'][_0xe4e2('0x61')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe4e2('0x91')](_0x5a2d0c[_0xe4e2('0x65')])){return this[_0xe4e2('0x10')][_0xe4e2('0xb6')](_0xe4e2('0xb7'));}this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util['format'](_0xe4e2('0x1c6'),_0x5a2d0c['text']));var _0x23028c=this[_0xe4e2('0x6c')][_0xe4e2('0x7b')](this,_0x5a2d0c);if(_0x23028c){this['channel']['noop'](util[_0xe4e2('0x2d')](_0xe4e2('0x1c7'),_0x23028c));var _0x29c291=this[_0xe4e2('0x10')][_0xe4e2('0x107')](_0x23028c);try{fs[_0xe4e2('0x12a')](_0x23028c+_0xe4e2('0x108'));}catch(_0x54fc18){logger[_0xe4e2('0x37')](_0x54fc18);}return _0x29c291;}return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x5a2d0c,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xe4e2('0x19')][_0xe4e2('0x1c8')]=function(_0x508033){logger['info'](util[_0xe4e2('0x2d')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x508033[_0xe4e2('0x3d')]));if(!this[_0xe4e2('0x91')](_0x508033[_0xe4e2('0x160')])){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x508033,_0xe4e2('0x15e'));}logger['info'](util[_0xe4e2('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xe4e2('0x10')][_0xe4e2('0x3f')],_0x508033[_0xe4e2('0x160')]));var _0x500556=this['agentUnpause'][_0xe4e2('0x7b')](this,_0x508033['findBy']);if(_0x500556){logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x161'),this[_0xe4e2('0x10')][_0xe4e2('0x3f')],_0x508033[_0xe4e2('0x160')]));this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe4e2('0x10')][_0xe4e2('0x3f')],_0x508033['findBy']));return{'code':0xc8,'result':_0xe4e2('0x162')};}else{logger[_0xe4e2('0x33')](util[_0xe4e2('0x2d')](_0xe4e2('0x163'),this[_0xe4e2('0x10')][_0xe4e2('0x3f')],_0x508033[_0xe4e2('0x160')]));this[_0xe4e2('0x10')][_0xe4e2('0xb6')](util[_0xe4e2('0x2d')](_0xe4e2('0x163'),this[_0xe4e2('0x10')]['callerid'],_0x508033['findBy']));return{'code':0xc8,'result':_0xe4e2('0x164')};}};AGIVertices[_0xe4e2('0x19')]['voicemail']=function(_0x313d97){logger['info'](util[_0xe4e2('0x2d')](_0xe4e2('0x1c9'),_0x313d97['label']));var _0x41a080=this[_0xe4e2('0x10')][_0xe4e2('0x5f')](_0xe4e2('0x1ca'),[_0x313d97[_0xe4e2('0x1cb')],_0x313d97['options']]);if(_0x41a080[_0xe4e2('0xb0')]===-0x1){return _0x41a080;}return this[_0xe4e2('0x10')]['noop'](util[_0xe4e2('0x2d')](_0xe4e2('0xce'),_0xe4e2('0x1ca'),_0x313d97[_0xe4e2('0x1cb')]));};AGIVertices['prototype']['vswitch']=function(_0x307212){logger[_0xe4e2('0x33')](util['format'](_0xe4e2('0x1cc'),_0x307212['label']));if(!this[_0xe4e2('0x91')](_0x307212['variable_id'])){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x307212,_0xe4e2('0x1af'));}var _0x4ebb3f=this[_0xe4e2('0x13')][_0xe4e2('0x7b')](this,_0x307212['variable_id']);if(!_0x4ebb3f){return this[_0xe4e2('0x10')][_0xe4e2('0x37')](_0x307212,_0xe4e2('0xe2'));}var _0x3b3920=this[_0xe4e2('0x10')][_0xe4e2('0x13')](_0x4ebb3f);return{'code':0xc8,'result':_0x3b3920[_0xe4e2('0xae')]?_0x3b3920['extra']:'-'};};String['prototype'][_0xe4e2('0xad')]=function(_0x3b3888,_0x5f4fcb){return this[_0xe4e2('0xac')](_0x3b3888)[_0xe4e2('0x1cd')](_0x5f4fcb);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 3c57354..845cc9c 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 _0x9482=['stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','interface','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','attended','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','stringify','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','syncHangupRequest','bind','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout'];(function(_0x443ee3,_0x45dafc){var _0xf4f8a0=function(_0x4cfa3e){while(--_0x4cfa3e){_0x443ee3['push'](_0x443ee3['shift']());}};_0xf4f8a0(++_0x45dafc);}(_0x9482,0x8c));var _0x2948=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9482[_0x3947c9];return _0x2e7871;};'use strict';var util=require(_0x2948('0x0'));var _=require(_0x2948('0x1'));var moment=require(_0x2948('0x2'));var ami=require(_0x2948('0x3'));var logger=require(_0x2948('0x4'))(_0x2948('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x2948('0x6'));function Acw(_0x4bb926){this['voiceQueues']=_0x4bb926[_0x2948('0x7')];this[_0x2948('0x8')]=_0x4bb926[_0x2948('0x8')];this['timers']=_0x4bb926[_0x2948('0x9')];this[_0x2948('0xa')]={};ami['on'](_0x2948('0xb'),this[_0x2948('0xc')]['bind'](this));ami['on']('hanguprequest',this[_0x2948('0xd')][_0x2948('0xe')](this));ami['on'](_0x2948('0xf'),this['syncHangup'][_0x2948('0xe')](this));ami['on'](_0x2948('0x10'),this[_0x2948('0x11')]['bind'](this));ami['on'](_0x2948('0x12'),this[_0x2948('0x13')][_0x2948('0xe')](this));ami['on'](_0x2948('0x14'),this['syncBlindTransfer'][_0x2948('0xe')](this));ami['on'](_0x2948('0x15'),this['syncAgentConnectPreview'][_0x2948('0xe')](this));}function getDiff(_0x3ec2b4){var _0x3838cd=moment()[_0x2948('0x16')](0x0);var _0x475589=moment(_0x3ec2b4)[_0x2948('0x16')](0x0);return _0x3838cd[_0x2948('0x17')](_0x475589,_0x2948('0x18'));}Acw[_0x2948('0x19')][_0x2948('0x1a')]=function(_0x53f285){try{var _0x5e6c45=this;var _0x183fc0=this[_0x2948('0xa')][_0x53f285]['interface'];var _0x5cc8b4=this[_0x2948('0xa')][_0x53f285][_0x2948('0x1b')];var _0x569d4c=this[_0x2948('0x7')][_0x5cc8b4];var _0x1f5b01=![];var _0x1b62d2=_0x2948('0x1c');if(_0x569d4c[_0x2948('0x1d')]){if(_0x569d4c['mandatoryDispositionPause'][_0x2948('0x1e')]){_0x1f5b01=!![];_0x1b62d2=_0x569d4c[_0x2948('0x1f')][_0x2948('0x1e')];}}ami[_0x2948('0x20')]({'action':_0x2948('0x21'),'interface':_0x183fc0,'paused':!![],'reason':_0x1b62d2})[_0x2948('0x22')](function(_0xbb0f72){if(_0x5e6c45[_0x2948('0x8')][_0x183fc0]){return RpcUser['getAgent'](_0x5e6c45[_0x2948('0x8')][_0x183fc0]['id'])['then'](function(_0x5e239c){if(_0x5e239c&&!_0x5e239c[_0x2948('0x23')]){logger['info'](_0x2948('0x24'),_0x53f285,_0x183fc0,_0x5cc8b4);var _0x3e789a=_0x5e6c45[_0x2948('0xa')][_0x53f285]['attended']&&_0x5e6c45[_0x2948('0xa')][_0x53f285][_0x2948('0x25')]?_0x5e6c45[_0x2948('0xa')][_0x53f285][_0x2948('0x25')]:_0x53f285;return RpcUser[_0x2948('0x26')](_0x5e6c45[_0x2948('0x8')][_0x183fc0],_0x1b62d2,_0x3e789a)[_0x2948('0x22')](function(_0x4b4e96){if(!_0x1f5b01){_0x5e6c45['timers'][_0x183fc0]={};logger[_0x2948('0x27')](_0x2948('0x28'),_0x53f285,_0x5e6c45['voiceQueues'][_0x5cc8b4][_0x2948('0x29')],_0x183fc0,_0x5cc8b4);_0x5e6c45[_0x2948('0x9')][_0x183fc0]['timer']=setTimeout(_0x5e6c45[_0x2948('0x2a')][_0x2948('0xe')](_0x5e6c45,_0x183fc0),_0x5e6c45['voiceQueues'][_0x5cc8b4][_0x2948('0x29')]*0x3e8);_0x5e6c45[_0x2948('0x9')][_0x183fc0][_0x2948('0x2b')]=moment()[_0x2948('0x2c')](_0x2948('0x2d'));_0x5e6c45['timers'][_0x183fc0]['uniqueid']=_0x53f285;_0x5e6c45[_0x2948('0x9')][_0x183fc0][_0x2948('0x1b')]=_0x5cc8b4;_0x5e6c45['timers'][_0x183fc0][_0x2948('0x2e')]=function(){var _0x27f3a1=getDiff(_0x5e6c45[_0x2948('0x9')][_0x183fc0][_0x2948('0x2b')]);clearTimeout(_0x5e6c45[_0x2948('0x9')][_0x183fc0][_0x2948('0x2f')]);_0x5e6c45[_0x2948('0x9')][_0x183fc0][_0x2948('0x2f')]=![];RpcVoiceAgentReport[_0x2948('0x30')]({'acwtime':_0x27f3a1},_0x5e6c45['timers'][_0x183fc0][_0x2948('0x31')],_0x183fc0)[_0x2948('0x22')](function(_0x16c400){logger['info'](_0x2948('0x32'),_0x53f285,_0x27f3a1,_0x16c400);})[_0x2948('0x33')](function(_0x22e931){logger[_0x2948('0x34')](_0x2948('0x35'),_0x53f285,_0x22e931);});delete _0x5e6c45[_0x2948('0x9')][_0x183fc0];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x53f285,_0x183fc0,_0x5cc8b4);}});}})[_0x2948('0x33')](function(_0x5d1bc2){logger[_0x2948('0x34')](_0x2948('0x28'),_0x53f285,_0x5e6c45[_0x2948('0x7')][_0x5cc8b4][_0x2948('0x29')],_0x183fc0,_0x5cc8b4);})[_0x2948('0x36')](function(){delete _0x5e6c45[_0x2948('0xa')][_0x53f285];});}catch(_0x1741d8){logger[_0x2948('0x34')](_0x2948('0x37'),_0x1741d8['message']);}};Acw['prototype'][_0x2948('0x2a')]=function(_0x15d520){try{var _0x106163=this;if(_0x106163['timers'][_0x15d520]){_0x106163['timers'][_0x15d520][_0x2948('0x2f')]=![];var _0x419631=_0x106163[_0x2948('0x9')][_0x15d520][_0x2948('0x31')];var _0x468ec5=_0x106163['timers'][_0x15d520]['queue'];var _0x137ae0=_0x106163[_0x2948('0x7')][_0x468ec5][_0x2948('0x29')];logger[_0x2948('0x27')](_0x2948('0x38'),_0x419631,_0x15d520);RpcUser[_0x2948('0x39')](this[_0x2948('0x8')][_0x15d520]);RpcVoiceAgentReport[_0x2948('0x30')]({'acwtime':_0x137ae0,'agentacw':!![]},_0x419631,_0x15d520)[_0x2948('0x22')](function(_0x3fa38c){logger[_0x2948('0x27')](_0x2948('0x32'),_0x419631,_0x137ae0,_0x3fa38c);})[_0x2948('0x33')](function(_0x33ff1e){logger[_0x2948('0x34')](_0x2948('0x35'),_0x419631,_0x33ff1e);});}else{logger[_0x2948('0x34')](_0x2948('0x3a'),_0x15d520);if(_0x106163[_0x2948('0x9')]){logger[_0x2948('0x27')](_0x2948('0x3b'),JSON['stringify'](_0x106163[_0x2948('0x9')]));}}}catch(_0x39ca3b){logger[_0x2948('0x34')](_0x2948('0x3c'),_0x39ca3b[_0x2948('0x3d')]);}};Acw['prototype'][_0x2948('0xc')]=function(_0x471764){try{if(this['voiceQueues'][_0x471764[_0x2948('0x1b')]]&&(this[_0x2948('0x7')][_0x471764[_0x2948('0x1b')]]['acw']||this[_0x2948('0x7')][_0x471764[_0x2948('0x1b')]]['mandatoryDisposition'])){if(this[_0x2948('0x8')][_0x471764['interface']]){this[_0x2948('0xa')][_0x471764[_0x2948('0x31')]]={'queue':_0x471764['queue'],'interface':_0x471764['interface'],'destlinkedid':_0x471764[_0x2948('0x25')]};}}}catch(_0x5c546f){logger[_0x2948('0x34')](_0x2948('0x3e'),_0x5c546f[_0x2948('0x3d')]);}};Acw[_0x2948('0x19')]['syncAgentConnectPreview']=function(_0x5af3b7){try{if(this['voiceQueues'][_0x5af3b7[_0x2948('0x1b')]]&&(this[_0x2948('0x7')][_0x5af3b7[_0x2948('0x1b')]][_0x2948('0x5')]||this[_0x2948('0x7')][_0x5af3b7['queue']]['mandatoryDisposition'])){if(this[_0x2948('0x8')][_0x5af3b7[_0x2948('0x3f')]]){this[_0x2948('0xa')][_0x5af3b7['uniqueid']]={'queue':_0x5af3b7[_0x2948('0x1b')],'interface':_0x5af3b7[_0x2948('0x3f')]};}}}catch(_0x469e6b){logger[_0x2948('0x34')](_0x2948('0x40'),_0x469e6b[_0x2948('0x3d')]);}};Acw[_0x2948('0x19')][_0x2948('0xd')]=function(_0x4ee966){try{if(this[_0x2948('0xa')][_0x4ee966[_0x2948('0x31')]]&&_[_0x2948('0x41')](this[_0x2948('0xa')][_0x4ee966[_0x2948('0x31')]]['attended'])){logger[_0x2948('0x27')](_0x2948('0x42'),_0x4ee966[_0x2948('0x31')]);this[_0x2948('0x1a')](_0x4ee966[_0x2948('0x31')]);}else if(this[_0x2948('0xa')][_0x4ee966['linkedid']]&&_[_0x2948('0x41')](this[_0x2948('0xa')][_0x4ee966[_0x2948('0x43')]][_0x2948('0x44')])){logger[_0x2948('0x27')](_0x2948('0x45'),_0x4ee966[_0x2948('0x43')]);this[_0x2948('0x1a')](_0x4ee966[_0x2948('0x43')]);}}catch(_0x50a4ef){logger['error'](_0x2948('0x46'),_0x50a4ef[_0x2948('0x3d')]);}};Acw[_0x2948('0x19')][_0x2948('0x47')]=function(_0x8502cd){try{if(this[_0x2948('0xa')][_0x8502cd[_0x2948('0x31')]]&&this['channels'][_0x8502cd[_0x2948('0x31')]][_0x2948('0x44')]){logger['info'](_0x2948('0x48'),_0x8502cd['uniqueid']);this[_0x2948('0x1a')](_0x8502cd[_0x2948('0x31')]);}else if(this['channels'][_0x8502cd[_0x2948('0x43')]]&&this[_0x2948('0xa')][_0x8502cd[_0x2948('0x43')]]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x8502cd['linkedid']);this['startAcw'](_0x8502cd[_0x2948('0x43')]);}}catch(_0x1a3af8){logger[_0x2948('0x34')](_0x2948('0x49'),_0x1a3af8[_0x2948('0x3d')]);}};Acw['prototype'][_0x2948('0x13')]=function(_0x8f5ffb){try{if(!_[_0x2948('0x4a')](this[_0x2948('0xa')][_0x8f5ffb[_0x2948('0x4b')]])){this[_0x2948('0x1a')](_0x8f5ffb[_0x2948('0x4b')]);if(this['channels'][_0x8f5ffb[_0x2948('0x4c')]]){this[_0x2948('0xa')][_0x8f5ffb[_0x2948('0x4c')]]['attended']=!![];this[_0x2948('0xa')][_0x8f5ffb[_0x2948('0x4d')]]=this[_0x2948('0xa')][_0x8f5ffb[_0x2948('0x4c')]];delete this[_0x2948('0xa')][_0x8f5ffb['secondtransfereruniqueid']];}}else if(!_[_0x2948('0x4a')](this['channels'][_0x8f5ffb[_0x2948('0x4d')]])){this[_0x2948('0x1a')](_0x8f5ffb[_0x2948('0x4d')]);if(this[_0x2948('0xa')][_0x8f5ffb['origtransfereruniqueid']]){this[_0x2948('0xa')][_0x8f5ffb[_0x2948('0x4e')]]['attended']=!![];this[_0x2948('0xa')][_0x8f5ffb[_0x2948('0x4b')]]=this[_0x2948('0xa')][_0x8f5ffb['origtransfereruniqueid']];delete this['channels'][_0x8f5ffb[_0x2948('0x4e')]];}}}catch(_0x57f2c5){logger[_0x2948('0x34')](_0x2948('0x4f'),_0x57f2c5[_0x2948('0x3d')]);}};Acw['prototype'][_0x2948('0x50')]=function(_0x40665e){try{if(this[_0x2948('0xa')][_0x40665e[_0x2948('0x51')]]){logger[_0x2948('0x27')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x40665e['transfereruniqueid']));this[_0x2948('0x1a')](_0x40665e[_0x2948('0x51')]);}else if(this[_0x2948('0xa')][_0x40665e[_0x2948('0x52')]]){logger[_0x2948('0x27')](_0x2948('0x53'),JSON[_0x2948('0x54')](_0x40665e['transfererlinkedid']));this[_0x2948('0x1a')](_0x40665e[_0x2948('0x52')]);}}catch(_0x263e5b){logger[_0x2948('0x34')](_0x2948('0x55'),_0x263e5b[_0x2948('0x3d')]);}};Acw[_0x2948('0x19')]['syncAgentRingNoAnswer']=function(_0x3dc5f8){try{if(this[_0x2948('0x7')][_0x3dc5f8[_0x2948('0x1b')]]&&this[_0x2948('0x7')][_0x3dc5f8[_0x2948('0x1b')]][_0x2948('0x56')]==='all'){if(this['agents'][_0x3dc5f8['interface']]){logger[_0x2948('0x27')](_0x2948('0x57'),_0x3dc5f8['uniqueid'],_0x3dc5f8[_0x2948('0x3f')],_0x3dc5f8[_0x2948('0x1b')]);return RpcUser[_0x2948('0x26')](this[_0x2948('0x8')][_0x3dc5f8[_0x2948('0x3f')]],_0x2948('0x58'),_0x3dc5f8[_0x2948('0x31')]);}}}catch(_0x37a4d1){logger['error'](_0x2948('0x59'),_0x37a4d1[_0x2948('0x3d')]);}};module[_0x2948('0x5a')]=Acw; \ No newline at end of file +var _0x65e5=['timers','channels','agentconnect','syncAgentConnect','hanguprequest','hangup','bind','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','stopAcw','queue','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','exports','util','lodash','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents'];(function(_0x19c646,_0x5ece15){var _0x43aae5=function(_0x318b1a){while(--_0x318b1a){_0x19c646['push'](_0x19c646['shift']());}};_0x43aae5(++_0x5ece15);}(_0x65e5,0x140));var _0x565e=function(_0x2a7c2c,_0x120c16){_0x2a7c2c=_0x2a7c2c-0x0;var _0xb60a21=_0x65e5[_0x2a7c2c];return _0xb60a21;};'use strict';var util=require(_0x565e('0x0'));var _=require(_0x565e('0x1'));var moment=require('moment');var ami=require(_0x565e('0x2'));var logger=require('../../../config/logger')(_0x565e('0x3'));var RpcUser=require(_0x565e('0x4'));var RpcVoiceAgentReport=require(_0x565e('0x5'));function Acw(_0x2dc86b){this[_0x565e('0x6')]=_0x2dc86b[_0x565e('0x6')];this['agents']=_0x2dc86b[_0x565e('0x7')];this[_0x565e('0x8')]=_0x2dc86b[_0x565e('0x8')];this[_0x565e('0x9')]={};ami['on'](_0x565e('0xa'),this[_0x565e('0xb')]['bind'](this));ami['on'](_0x565e('0xc'),this['syncHangupRequest']['bind'](this));ami['on'](_0x565e('0xd'),this['syncHangup'][_0x565e('0xe')](this));ami['on']('agentringnoanswer',this[_0x565e('0xf')]['bind'](this));ami['on'](_0x565e('0x10'),this[_0x565e('0x11')]['bind'](this));ami['on'](_0x565e('0x12'),this[_0x565e('0x13')][_0x565e('0xe')](this));ami['on'](_0x565e('0x14'),this[_0x565e('0x15')][_0x565e('0xe')](this));}function getDiff(_0x342c6f){var _0x93939b=moment()['milliseconds'](0x0);var _0x4e7a5f=moment(_0x342c6f)[_0x565e('0x16')](0x0);return _0x93939b[_0x565e('0x17')](_0x4e7a5f,'seconds');}Acw[_0x565e('0x18')][_0x565e('0x19')]=function(_0x43fcf6){try{var _0x356038=this;var _0x45b306=this[_0x565e('0x9')][_0x43fcf6][_0x565e('0x1a')];var _0x235ce8=this[_0x565e('0x9')][_0x43fcf6]['queue'];var _0x359f20=this[_0x565e('0x6')][_0x235ce8];var _0x218ebe=![];var _0x16f01c=_0x565e('0x1b');if(_0x359f20[_0x565e('0x1c')]){if(_0x359f20[_0x565e('0x1d')][_0x565e('0x1e')]){_0x218ebe=!![];_0x16f01c=_0x359f20[_0x565e('0x1d')]['name'];}}ami['Action']({'action':_0x565e('0x1f'),'interface':_0x45b306,'paused':!![],'reason':_0x16f01c})[_0x565e('0x20')](function(_0x3b2aea){if(_0x356038['agents'][_0x45b306]){return RpcUser['getAgent'](_0x356038[_0x565e('0x7')][_0x45b306]['id'])[_0x565e('0x20')](function(_0x465752){if(_0x465752&&!_0x465752['voicePause']){logger[_0x565e('0x21')](_0x565e('0x22'),_0x43fcf6,_0x45b306,_0x235ce8);var _0x3d6eaa=_0x356038[_0x565e('0x9')][_0x43fcf6][_0x565e('0x23')]&&_0x356038[_0x565e('0x9')][_0x43fcf6][_0x565e('0x24')]?_0x356038['channels'][_0x43fcf6][_0x565e('0x24')]:_0x43fcf6;return RpcUser['savePause'](_0x356038[_0x565e('0x7')][_0x45b306],_0x16f01c,_0x3d6eaa)['then'](function(_0x5d483c){if(!_0x218ebe){_0x356038[_0x565e('0x8')][_0x45b306]={};logger[_0x565e('0x21')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x43fcf6,_0x356038[_0x565e('0x6')][_0x235ce8][_0x565e('0x25')],_0x45b306,_0x235ce8);_0x356038[_0x565e('0x8')][_0x45b306][_0x565e('0x26')]=setTimeout(_0x356038['stopAcw']['bind'](_0x356038,_0x45b306),_0x356038[_0x565e('0x6')][_0x235ce8]['acwTimeout']*0x3e8);_0x356038['timers'][_0x45b306][_0x565e('0x27')]=moment()[_0x565e('0x28')](_0x565e('0x29'));_0x356038[_0x565e('0x8')][_0x45b306][_0x565e('0x2a')]=_0x43fcf6;_0x356038[_0x565e('0x8')][_0x45b306]['queue']=_0x235ce8;_0x356038[_0x565e('0x8')][_0x45b306][_0x565e('0x2b')]=function(){var _0x4e3fb1=getDiff(_0x356038[_0x565e('0x8')][_0x45b306][_0x565e('0x27')]);clearTimeout(_0x356038[_0x565e('0x8')][_0x45b306][_0x565e('0x26')]);_0x356038[_0x565e('0x8')][_0x45b306][_0x565e('0x26')]=![];RpcVoiceAgentReport[_0x565e('0x2c')]({'acwtime':_0x4e3fb1},_0x356038[_0x565e('0x8')][_0x45b306]['uniqueid'],_0x45b306)[_0x565e('0x20')](function(_0x5c5a80){logger[_0x565e('0x21')](_0x565e('0x2d'),_0x43fcf6,_0x4e3fb1,_0x5c5a80);})[_0x565e('0x2e')](function(_0x39ba37){logger[_0x565e('0x2f')](_0x565e('0x30'),_0x43fcf6,_0x39ba37);});delete _0x356038[_0x565e('0x8')][_0x45b306];};}});}else{logger[_0x565e('0x21')](_0x565e('0x31'),_0x43fcf6,_0x45b306,_0x235ce8);}});}})[_0x565e('0x2e')](function(_0xa24dc8){logger[_0x565e('0x2f')](_0x565e('0x32'),_0x43fcf6,_0x356038[_0x565e('0x6')][_0x235ce8][_0x565e('0x25')],_0x45b306,_0x235ce8);})['finally'](function(){delete _0x356038[_0x565e('0x9')][_0x43fcf6];});}catch(_0x40f083){logger[_0x565e('0x2f')](_0x565e('0x33'),_0x40f083[_0x565e('0x34')]);}};Acw[_0x565e('0x18')][_0x565e('0x35')]=function(_0x1b572f){try{var _0x27b887=this;if(_0x27b887[_0x565e('0x8')][_0x1b572f]){_0x27b887['timers'][_0x1b572f]['timer']=![];var _0x37148b=_0x27b887['timers'][_0x1b572f][_0x565e('0x2a')];var _0x3b6141=_0x27b887[_0x565e('0x8')][_0x1b572f][_0x565e('0x36')];var _0x4fc9c1=_0x27b887[_0x565e('0x6')][_0x3b6141][_0x565e('0x25')];logger[_0x565e('0x21')](_0x565e('0x37'),_0x37148b,_0x1b572f);RpcUser[_0x565e('0x38')](this[_0x565e('0x7')][_0x1b572f]);RpcVoiceAgentReport[_0x565e('0x2c')]({'acwtime':_0x4fc9c1,'agentacw':!![]},_0x37148b,_0x1b572f)[_0x565e('0x20')](function(_0x189057){logger[_0x565e('0x21')]('[%s][UPDATE][ACWTIME:%s]',_0x37148b,_0x4fc9c1,_0x189057);})['catch'](function(_0x65ffc7){logger[_0x565e('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x37148b,_0x65ffc7);});}else{logger[_0x565e('0x2f')](_0x565e('0x39'),_0x1b572f);if(_0x27b887['timers']){logger[_0x565e('0x21')]('[ACW][TIMERS]',JSON[_0x565e('0x3a')](_0x27b887[_0x565e('0x8')]));}}}catch(_0x3e1e89){logger['error']('[ACW][STOP]\x20%s',_0x3e1e89[_0x565e('0x34')]);}};Acw['prototype'][_0x565e('0xb')]=function(_0x579e15){try{if(this['voiceQueues'][_0x579e15[_0x565e('0x36')]]&&(this[_0x565e('0x6')][_0x579e15[_0x565e('0x36')]][_0x565e('0x3')]||this[_0x565e('0x6')][_0x579e15[_0x565e('0x36')]][_0x565e('0x1c')])){if(this['agents'][_0x579e15[_0x565e('0x1a')]]){this[_0x565e('0x9')][_0x579e15[_0x565e('0x2a')]]={'queue':_0x579e15['queue'],'interface':_0x579e15[_0x565e('0x1a')],'destlinkedid':_0x579e15['destlinkedid']};}}}catch(_0x4056f1){logger[_0x565e('0x2f')](_0x565e('0x3b'),_0x4056f1[_0x565e('0x34')]);}};Acw[_0x565e('0x18')]['syncAgentConnectPreview']=function(_0x31141f){try{if(this['voiceQueues'][_0x31141f[_0x565e('0x36')]]&&(this[_0x565e('0x6')][_0x31141f[_0x565e('0x36')]][_0x565e('0x3')]||this[_0x565e('0x6')][_0x31141f['queue']][_0x565e('0x1c')])){if(this[_0x565e('0x7')][_0x31141f['interface']]){this[_0x565e('0x9')][_0x31141f['uniqueid']]={'queue':_0x31141f[_0x565e('0x36')],'interface':_0x31141f[_0x565e('0x1a')]};}}}catch(_0x569251){logger[_0x565e('0x2f')](_0x565e('0x3c'),_0x569251['message']);}};Acw['prototype'][_0x565e('0x3d')]=function(_0x480c1d){try{if(this[_0x565e('0x9')][_0x480c1d['uniqueid']]&&_['isUndefined'](this['channels'][_0x480c1d['uniqueid']]['attended'])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x480c1d[_0x565e('0x2a')]);this[_0x565e('0x19')](_0x480c1d[_0x565e('0x2a')]);}else if(this['channels'][_0x480c1d[_0x565e('0x3e')]]&&_['isUndefined'](this['channels'][_0x480c1d['linkedid']][_0x565e('0x23')])){logger[_0x565e('0x21')]('[%s][HANGUP:LINKEDID]',_0x480c1d[_0x565e('0x3e')]);this[_0x565e('0x19')](_0x480c1d[_0x565e('0x3e')]);}}catch(_0x461e92){logger[_0x565e('0x2f')](_0x565e('0x3f'),_0x461e92[_0x565e('0x34')]);}};Acw[_0x565e('0x18')]['syncHangup']=function(_0x3e8bfb){try{if(this[_0x565e('0x9')][_0x3e8bfb[_0x565e('0x2a')]]&&this[_0x565e('0x9')][_0x3e8bfb[_0x565e('0x2a')]][_0x565e('0x23')]){logger[_0x565e('0x21')](_0x565e('0x40'),_0x3e8bfb[_0x565e('0x2a')]);this[_0x565e('0x19')](_0x3e8bfb[_0x565e('0x2a')]);}else if(this[_0x565e('0x9')][_0x3e8bfb[_0x565e('0x3e')]]&&this['channels'][_0x3e8bfb[_0x565e('0x3e')]][_0x565e('0x23')]){logger['info'](_0x565e('0x41'),_0x3e8bfb['linkedid']);this[_0x565e('0x19')](_0x3e8bfb[_0x565e('0x3e')]);}}catch(_0x2cae85){logger[_0x565e('0x2f')]('[ACW][syncHangup]\x20%s',_0x2cae85[_0x565e('0x34')]);}};Acw[_0x565e('0x18')]['syncAttendedTransfer']=function(_0x4b7b31){try{if(!_[_0x565e('0x42')](this[_0x565e('0x9')][_0x4b7b31['transfereeuniqueid']])){this[_0x565e('0x19')](_0x4b7b31[_0x565e('0x43')]);if(this['channels'][_0x4b7b31[_0x565e('0x44')]]){this[_0x565e('0x9')][_0x4b7b31[_0x565e('0x44')]][_0x565e('0x23')]=!![];this[_0x565e('0x9')][_0x4b7b31[_0x565e('0x45')]]=this[_0x565e('0x9')][_0x4b7b31[_0x565e('0x44')]];delete this['channels'][_0x4b7b31[_0x565e('0x44')]];}}else if(!_[_0x565e('0x42')](this[_0x565e('0x9')][_0x4b7b31[_0x565e('0x45')]])){this[_0x565e('0x19')](_0x4b7b31[_0x565e('0x45')]);if(this['channels'][_0x4b7b31[_0x565e('0x46')]]){this['channels'][_0x4b7b31[_0x565e('0x46')]][_0x565e('0x23')]=!![];this[_0x565e('0x9')][_0x4b7b31[_0x565e('0x43')]]=this[_0x565e('0x9')][_0x4b7b31[_0x565e('0x46')]];delete this['channels'][_0x4b7b31[_0x565e('0x46')]];}}}catch(_0x4ecb65){logger[_0x565e('0x2f')]('[ACW][syncAttendedTransfer]\x20%s',_0x4ecb65[_0x565e('0x34')]);}};Acw['prototype'][_0x565e('0x13')]=function(_0x62ad27){try{if(this[_0x565e('0x9')][_0x62ad27[_0x565e('0x47')]]){logger['info'](_0x565e('0x48'),JSON[_0x565e('0x3a')](_0x62ad27['transfereruniqueid']));this[_0x565e('0x19')](_0x62ad27['transfereruniqueid']);}else if(this['channels'][_0x62ad27['transfererlinkedid']]){logger[_0x565e('0x21')](_0x565e('0x49'),JSON[_0x565e('0x3a')](_0x62ad27[_0x565e('0x4a')]));this[_0x565e('0x19')](_0x62ad27[_0x565e('0x4a')]);}}catch(_0x1332b3){logger[_0x565e('0x2f')](_0x565e('0x4b'),_0x1332b3[_0x565e('0x34')]);}};Acw[_0x565e('0x18')][_0x565e('0xf')]=function(_0x577377){try{if(this['voiceQueues'][_0x577377[_0x565e('0x36')]]&&this[_0x565e('0x6')][_0x577377[_0x565e('0x36')]][_0x565e('0x4c')]===_0x565e('0x4d')){if(this[_0x565e('0x7')][_0x577377[_0x565e('0x1a')]]){logger[_0x565e('0x21')](_0x565e('0x4e'),_0x577377[_0x565e('0x2a')],_0x577377[_0x565e('0x1a')],_0x577377[_0x565e('0x36')]);return RpcUser[_0x565e('0x4f')](this['agents'][_0x577377[_0x565e('0x1a')]],_0x565e('0x50'),_0x577377[_0x565e('0x2a')]);}}}catch(_0xc03371){logger[_0x565e('0x2f')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0xc03371['message']);}};module[_0x565e('0x51')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 0f1fa65..bf82ff7 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 _0x6d83=['actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','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\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','log','exports','asterisk-manager','bluebird','moment','util','lodash','../../config/logger','asterisk','port','username','Action','action','error','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0x206e64,_0x1ac328){var _0x2d29e3=function(_0x1ae8e0){while(--_0x1ae8e0){_0x206e64['push'](_0x206e64['shift']());}};_0x2d29e3(++_0x1ac328);}(_0x6d83,0x159));var _0x36d8=function(_0x5ded2a,_0x2b3e6a){_0x5ded2a=_0x5ded2a-0x0;var _0x403110=_0x6d83[_0x5ded2a];return _0x403110;};'use strict';var Manager=require(_0x36d8('0x0'));var BPromise=require(_0x36d8('0x1'));var moment=require(_0x36d8('0x2'));var util=require(_0x36d8('0x3'));var _=require(_0x36d8('0x4'));var logger=require(_0x36d8('0x5'))('ami');var config=require('../../config/environment');var ami=new Manager(config[_0x36d8('0x6')][_0x36d8('0x7')],config['asterisk']['ip'],config[_0x36d8('0x6')][_0x36d8('0x8')],config['asterisk']['password'],!![]);ami['keepConnected']();ami[_0x36d8('0x9')]=BPromise['promisify'](ami[_0x36d8('0xa')]);function error(_0x3582af){logger[_0x36d8('0xb')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x36d8('0x6')][_0x36d8('0x8')],config['asterisk']['ip'],config['asterisk'][_0x36d8('0x7')],util[_0x36d8('0xc')](_0x3582af,![],null)));}function close(){logger[_0x36d8('0xb')](util[_0x36d8('0xd')](_0x36d8('0xe'),config[_0x36d8('0x6')][_0x36d8('0x8')],config[_0x36d8('0x6')]['ip'],config[_0x36d8('0x6')][_0x36d8('0x7')]));}ami[_0x36d8('0xf')]=function(){return function(){return ami[_0x36d8('0x9')]({'action':_0x36d8('0x10')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0x36d8('0x11')});};};ami[_0x36d8('0x12')]=function(){return function(){return ami[_0x36d8('0x9')]({'action':_0x36d8('0x13')});};};ami[_0x36d8('0x14')]=function(){return function(){return ami[_0x36d8('0x9')]({'action':'queuesummary'});};};ami[_0x36d8('0x15')]=function(){return function(){return ami[_0x36d8('0x9')]({'action':_0x36d8('0x16')});};};function connect(_0x548717){logger[_0x36d8('0x17')](util[_0x36d8('0xd')](_0x36d8('0x18'),config[_0x36d8('0x6')][_0x36d8('0x8')],config['asterisk']['ip'],config[_0x36d8('0x6')][_0x36d8('0x7')]));ami['once']('error',error);ami[_0x36d8('0x19')](_0x36d8('0x1a'),close);}ami['on'](_0x36d8('0x1b'),connect);ami['on'](_0x36d8('0x1c'),function(_0xb916b3){logger[_0x36d8('0x17')](util[_0x36d8('0xd')](_0x36d8('0x1d'),config['asterisk']['username'],config[_0x36d8('0x6')]['ip'],config[_0x36d8('0x6')][_0x36d8('0x7')],util[_0x36d8('0xc')](_0xb916b3,![],null)));});ami['on']('fullybooted',function(_0x1ebb74){logger[_0x36d8('0x17')](util[_0x36d8('0xd')](_0x36d8('0x1e'),config[_0x36d8('0x6')][_0x36d8('0x8')],config[_0x36d8('0x6')]['ip'],config['asterisk'][_0x36d8('0x7')]));return BPromise[_0x36d8('0x1f')]()[_0x36d8('0x20')](ami['actionSipShowRegistry']())[_0x36d8('0x20')](ami[_0x36d8('0x21')]())['then'](ami['actionSipPeerStatus']())[_0x36d8('0x20')](ami[_0x36d8('0x14')]())[_0x36d8('0x20')](ami[_0x36d8('0x15')]())['catch'](function(_0x2da5af){console[_0x36d8('0x22')](_0x2da5af);});});ami[_0x36d8('0x19')](_0x36d8('0xb'),error);ami['once'](_0x36d8('0x1a'),close);module[_0x36d8('0x23')]=ami; \ No newline at end of file +var _0x2689=['lodash','ami','asterisk','port','username','password','keepConnected','promisify','action','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','format','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','catch','exports','asterisk-manager','bluebird','moment'];(function(_0x9e7f9b,_0x372c6a){var _0x236b32=function(_0x58f8d7){while(--_0x58f8d7){_0x9e7f9b['push'](_0x9e7f9b['shift']());}};_0x236b32(++_0x372c6a);}(_0x2689,0x19f));var _0x9268=function(_0x3689b2,_0x506685){_0x3689b2=_0x3689b2-0x0;var _0x526c28=_0x2689[_0x3689b2];return _0x526c28;};'use strict';var Manager=require(_0x9268('0x0'));var BPromise=require(_0x9268('0x1'));var moment=require(_0x9268('0x2'));var util=require('util');var _=require(_0x9268('0x3'));var logger=require('../../config/logger')(_0x9268('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x9268('0x5')][_0x9268('0x6')],config['asterisk']['ip'],config[_0x9268('0x5')][_0x9268('0x7')],config['asterisk'][_0x9268('0x8')],!![]);ami[_0x9268('0x9')]();ami['Action']=BPromise[_0x9268('0xa')](ami[_0x9268('0xb')]);function error(_0x5caec8){logger['error'](util['format'](_0x9268('0xc'),config[_0x9268('0x5')][_0x9268('0x7')],config[_0x9268('0x5')]['ip'],config[_0x9268('0x5')][_0x9268('0x6')],util[_0x9268('0xd')](_0x5caec8,![],null)));}function close(){logger[_0x9268('0xe')](util['format'](_0x9268('0xf'),config[_0x9268('0x5')][_0x9268('0x7')],config[_0x9268('0x5')]['ip'],config[_0x9268('0x5')][_0x9268('0x6')]));}ami[_0x9268('0x10')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x9268('0x11')]=function(){return function(){return ami[_0x9268('0x12')]({'action':_0x9268('0x13')});};};ami[_0x9268('0x14')]=function(){return function(){return ami['Action']({'action':_0x9268('0x15')});};};ami[_0x9268('0x16')]=function(){return function(){return ami[_0x9268('0x12')]({'action':_0x9268('0x17')});};};ami['actionCoreShowChannels']=function(){return function(){return ami['Action']({'action':'coreshowchannels'});};};function connect(_0x5baa98){logger[_0x9268('0x18')](util['format'](_0x9268('0x19'),config['asterisk'][_0x9268('0x7')],config['asterisk']['ip'],config['asterisk'][_0x9268('0x6')]));ami[_0x9268('0x1a')]('error',error);ami['once'](_0x9268('0x1b'),close);}ami['on'](_0x9268('0x1c'),connect);ami['on']('shutdown',function(_0xec7aae){logger[_0x9268('0x18')](util['format'](_0x9268('0x1d'),config[_0x9268('0x5')]['username'],config[_0x9268('0x5')]['ip'],config['asterisk'][_0x9268('0x6')],util[_0x9268('0xd')](_0xec7aae,![],null)));});ami['on'](_0x9268('0x1e'),function(_0x6d53f7){logger['info'](util[_0x9268('0x1f')](_0x9268('0x20'),config[_0x9268('0x5')][_0x9268('0x7')],config[_0x9268('0x5')]['ip'],config[_0x9268('0x5')][_0x9268('0x6')]));return BPromise[_0x9268('0x21')]()[_0x9268('0x22')](ami[_0x9268('0x10')]())[_0x9268('0x22')](ami['actionDeviceStateList']())[_0x9268('0x22')](ami['actionSipPeerStatus']())[_0x9268('0x22')](ami[_0x9268('0x16')]())[_0x9268('0x22')](ami[_0x9268('0x23')]())[_0x9268('0x24')](function(_0x2e4c40){console['log'](_0x2e4c40);});});ami[_0x9268('0x1a')](_0x9268('0xe'),error);ami[_0x9268('0x1a')](_0x9268('0x1b'),close);module[_0x9268('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 1b3e963..333eb14 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 _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x57cb4f,_0x541f57){var _0x29bb45=function(_0x462bee){while(--_0x462bee){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x29bb45(++_0x541f57);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xb7e7[_0x4d8ed9];return _0x1e2140;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file +var _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0xac4a,0x13f));var _0xaac4=function(_0x42f2d4,_0x19887e){_0x42f2d4=_0x42f2d4-0x0;var _0x3a7e1c=_0xac4a[_0x42f2d4];return _0x3a7e1c;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index ba65c84..1c7a037 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 _0x6ada=['countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','substring','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x3c0ea0,_0x127cd2){var _0x114c06=function(_0x4e58c8){while(--_0x4e58c8){_0x3c0ea0['push'](_0x3c0ea0['shift']());}};_0x114c06(++_0x127cd2);}(_0x6ada,0x117));var _0xa6ad=function(_0x2865a6,_0x1e4ed5){_0x2865a6=_0x2865a6-0x0;var _0x583e64=_0x6ada[_0x2865a6];return _0x583e64;};'use strict';var util=require(_0xa6ad('0x0'));var _=require(_0xa6ad('0x1'));var moment=require(_0xa6ad('0x2'));function checkNameSurname(_0x37fae0,_0x50c3ce,_0x469042){var _0x476ae5='';if(!_[_0xa6ad('0x3')](_0x50c3ce)&&_0xa6ad('0x4')===typeof _0x50c3ce){_0x476ae5+=_0x50c3ce;}if(!_[_0xa6ad('0x3')](_0x469042)&&_0xa6ad('0x4')===typeof _0x469042){_0x476ae5+='\x20'+_0x469042;}if(_0x476ae5!==''){return _0x476ae5;}return _0x37fae0;}function Action(_0x2af621,_0x3e9e4a,_0x2b42b3){this[_0xa6ad('0x5')]=_0x2af621;this[_0xa6ad('0x6')]=_0x2b42b3||undefined;this[_0xa6ad('0x7')]=checkNameSurname(_0x3e9e4a[_0xa6ad('0x8')][_0xa6ad('0x9')],_0x3e9e4a['Contact']['firstName'],_0x3e9e4a['Contact'][_0xa6ad('0xa')]);this[_0xa6ad('0xb')]=_0x3e9e4a['Contact'][_0xa6ad('0x9')];this[_0xa6ad('0xc')]=_0x2af621[_0xa6ad('0x7')];this[_0xa6ad('0xd')]=_0x3e9e4a[_0xa6ad('0xd')]||![];this['type']=_0x2af621[_0xa6ad('0xe')];this[_0xa6ad('0xf')]=_0x2af621[_0xa6ad('0xf')]||0x3;this[_0xa6ad('0x10')]=_0x3e9e4a[_0xa6ad('0x10')];this['countbusyretry']=_0x3e9e4a['countbusyretry'];this[_0xa6ad('0x11')]=_0x3e9e4a[_0xa6ad('0x11')];this['countnoanswerretry']=_0x3e9e4a['countnoanswerretry'];this[_0xa6ad('0x12')]=_0x3e9e4a['countnosuchnumberretry'];this[_0xa6ad('0x13')]=_0x3e9e4a[_0xa6ad('0x13')];this[_0xa6ad('0x14')]=_0x3e9e4a['countabandonedretry'];this[_0xa6ad('0x15')]=_0x3e9e4a[_0xa6ad('0x15')];this[_0xa6ad('0x16')]=_0x3e9e4a[_0xa6ad('0x16')];this['ContactId']=_0x3e9e4a[_0xa6ad('0x17')];this[_0xa6ad('0x18')]=_0x3e9e4a['ListId'];this[_0xa6ad('0x19')]=_0x3e9e4a[_0xa6ad('0x19')];this[_0xa6ad('0x1a')]=_0x3e9e4a['VoiceQueueId'];this['CampaignId']=_0x3e9e4a[_0xa6ad('0x1b')];this[_0xa6ad('0x1c')]=_0x3e9e4a['id'];this[_0xa6ad('0x1d')]=_0x3e9e4a['Contact']['firstName']||'';this['starttime']=moment()['format'](_0xa6ad('0x1e'));this[_0xa6ad('0x1f')]=_0x3e9e4a[_0xa6ad('0x1f')];this[_0xa6ad('0x20')]=_0x3e9e4a[_0xa6ad('0x20')];this['callbackat']=_0x3e9e4a[_0xa6ad('0x21')];this['recallme']=_0x3e9e4a[_0xa6ad('0x22')];this[_0xa6ad('0x23')]='';this[_0xa6ad('0x24')]='';}Action[_0xa6ad('0x25')][_0xa6ad('0x26')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0xa6ad('0x7')],this[_0xa6ad('0x5')][_0xa6ad('0x27')]>0x0?this['number'][_0xa6ad('0x28')](this[_0xa6ad('0x5')][_0xa6ad('0x27')]):this[_0xa6ad('0xb')]);};Action['prototype'][_0xa6ad('0x29')]=function(){return this['queue'];};module[_0xa6ad('0x2a')]=Action; \ No newline at end of file +var _0xcb01=['substring','prototype','getQueue','util','moment','string','isNil','voiceQueue','uniqueid','Contact','phone','firstName','lastName','number','queue','name','active','type','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xcb01,0x174));var _0x1cb0=function(_0x16d46b,_0x2a1869){_0x16d46b=_0x16d46b-0x0;var _0x31dbd1=_0xcb01[_0x16d46b];return _0x31dbd1;};'use strict';var util=require(_0x1cb0('0x0'));var _=require('lodash');var moment=require(_0x1cb0('0x1'));function checkNameSurname(_0x323f5d,_0xd8d34e,_0x145588){var _0x3f1789='';if(!_['isNil'](_0xd8d34e)&&_0x1cb0('0x2')===typeof _0xd8d34e){_0x3f1789+=_0xd8d34e;}if(!_[_0x1cb0('0x3')](_0x145588)&&_0x1cb0('0x2')===typeof _0x145588){_0x3f1789+='\x20'+_0x145588;}if(_0x3f1789!==''){return _0x3f1789;}return _0x323f5d;}function Action(_0x38bbdd,_0x57920b,_0x284960){this[_0x1cb0('0x4')]=_0x38bbdd;this[_0x1cb0('0x5')]=_0x284960||undefined;this['name']=checkNameSurname(_0x57920b[_0x1cb0('0x6')][_0x1cb0('0x7')],_0x57920b['Contact'][_0x1cb0('0x8')],_0x57920b[_0x1cb0('0x6')][_0x1cb0('0x9')]);this[_0x1cb0('0xa')]=_0x57920b[_0x1cb0('0x6')]['phone'];this[_0x1cb0('0xb')]=_0x38bbdd[_0x1cb0('0xc')];this['active']=_0x57920b[_0x1cb0('0xd')]||![];this[_0x1cb0('0xe')]=_0x38bbdd[_0x1cb0('0xe')];this['dialQueueTimeout']=_0x38bbdd['dialQueueTimeout']||0x3;this[_0x1cb0('0xf')]=_0x57920b[_0x1cb0('0xf')];this[_0x1cb0('0x10')]=_0x57920b['countbusyretry'];this[_0x1cb0('0x11')]=_0x57920b[_0x1cb0('0x11')];this['countnoanswerretry']=_0x57920b['countnoanswerretry'];this[_0x1cb0('0x12')]=_0x57920b['countnosuchnumberretry'];this[_0x1cb0('0x13')]=_0x57920b['countdropretry'];this[_0x1cb0('0x14')]=_0x57920b[_0x1cb0('0x14')];this[_0x1cb0('0x15')]=_0x57920b[_0x1cb0('0x15')];this[_0x1cb0('0x16')]=_0x57920b[_0x1cb0('0x16')];this['ContactId']=_0x57920b['ContactId'];this['ListId']=_0x57920b['ListId'];this['UserId']=_0x57920b[_0x1cb0('0x17')];this[_0x1cb0('0x18')]=_0x57920b[_0x1cb0('0x18')];this[_0x1cb0('0x19')]=_0x57920b['CampaignId'];this[_0x1cb0('0x1a')]=_0x57920b['id'];this[_0x1cb0('0x1b')]=_0x57920b[_0x1cb0('0x6')][_0x1cb0('0x8')]||'';this['starttime']=moment()['format'](_0x1cb0('0x1c'));this['callback']=_0x57920b[_0x1cb0('0x1d')];this[_0x1cb0('0x1e')]=_0x57920b[_0x1cb0('0x1e')];this[_0x1cb0('0x1f')]=_0x57920b[_0x1cb0('0x1f')];this['recallme']=_0x57920b[_0x1cb0('0x20')];this[_0x1cb0('0x21')]='';this[_0x1cb0('0x22')]='';}Action['prototype'][_0x1cb0('0x23')]=function(){return util[_0x1cb0('0x24')](_0x1cb0('0x25'),this[_0x1cb0('0xc')],this['voiceQueue']['dialCutDigit']>0x0?this[_0x1cb0('0xa')][_0x1cb0('0x26')](this[_0x1cb0('0x4')]['dialCutDigit']):this[_0x1cb0('0xa')]);};Action[_0x1cb0('0x27')][_0x1cb0('0x28')]=function(){return this[_0x1cb0('0xb')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 6b78f75..42a1caa 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 _0x76c4=['uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x25be63,_0x4b335e){var _0x4daaa8=function(_0x4b7f37){while(--_0x4b7f37){_0x25be63['push'](_0x25be63['shift']());}};_0x4daaa8(++_0x4b335e);}(_0x76c4,0x141));var _0x476c=function(_0x343cb7,_0x482a4f){_0x343cb7=_0x343cb7-0x0;var _0x3d1ddf=_0x76c4[_0x343cb7];return _0x3d1ddf;};'use strict';var util=require(_0x476c('0x0'));var _=require(_0x476c('0x1'));var moment=require(_0x476c('0x2'));function getSeconds(_0x40261b,_0x11d913){var _0x20aa07=moment(_0x40261b)[_0x476c('0x3')](0x0);var _0x798412=moment(_0x11d913)['milliseconds'](0x0);return _0x20aa07[_0x476c('0x4')](_0x798412,_0x476c('0x5'));}function AgentComplete(_0x534c87,_0x180379){this['state']=0x4;this[_0x476c('0x6')]=_0x476c('0x7');this[_0x476c('0x8')]=_0x534c87[_0x476c('0x8')];this[_0x476c('0x9')]=_0x534c87[_0x476c('0x9')];this[_0x476c('0xa')]=_0x534c87['type']===_0x476c('0xb')?_0x476c('0xc'):_0x534c87[_0x476c('0x9')];this[_0x476c('0xd')]=_0x534c87[_0x476c('0xd')];this[_0x476c('0xe')]=_0x534c87['countcongestionretry'];this[_0x476c('0xf')]=_0x534c87[_0x476c('0xf')];this[_0x476c('0x10')]=_0x534c87[_0x476c('0xd')]+_0x534c87[_0x476c('0xe')]+_0x534c87[_0x476c('0xf')]+_0x534c87[_0x476c('0x11')]+_0x534c87[_0x476c('0x12')]+_0x534c87[_0x476c('0x13')]+_0x534c87[_0x476c('0x14')]+_0x534c87[_0x476c('0x15')];this[_0x476c('0x11')]=_0x534c87[_0x476c('0x11')];this[_0x476c('0x12')]=_0x534c87[_0x476c('0x12')];this[_0x476c('0x13')]=_0x534c87['countabandonedretry'];this[_0x476c('0x14')]=_0x534c87[_0x476c('0x14')];this[_0x476c('0x15')]=_0x534c87[_0x476c('0x15')];this['uniqueid']=_0x180379[_0x476c('0x16')];this[_0x476c('0x17')]=_0x534c87[_0x476c('0x18')];this[_0x476c('0x19')]=_0x534c87[_0x476c('0x1a')];this[_0x476c('0x1b')]=_0x534c87[_0x476c('0x1b')];this['responsetime']=_0x534c87[_0x476c('0x1c')];this[_0x476c('0x1d')]=_0x534c87['answertime'];this[_0x476c('0x1e')]=moment()[_0x476c('0x1f')](_0x476c('0x20'));this[_0x476c('0x21')]=getSeconds(_0x534c87[_0x476c('0x1c')],_0x534c87[_0x476c('0x1b')]);this[_0x476c('0x22')]=getSeconds(_0x534c87[_0x476c('0x1d')],_0x534c87['responsetime']);this[_0x476c('0x23')]=getSeconds(this[_0x476c('0x1e')],_0x534c87['answertime']);this['queue']=_0x180379[_0x476c('0xc')];this[_0x476c('0x24')]=_0x180379[_0x476c('0x24')];this[_0x476c('0x25')]=_0x180379[_0x476c('0x25')];this[_0x476c('0x26')]=_0x534c87[_0x476c('0x26')];this[_0x476c('0x27')]=_0x534c87[_0x476c('0x27')];this['callbackat']=_0x534c87[_0x476c('0x28')];this[_0x476c('0x29')]=_0x534c87['recallme'];this[_0x476c('0x2a')]=_0x534c87['ContactId'];this[_0x476c('0x2b')]=_0x534c87['ListId'];this[_0x476c('0x2c')]=_0x534c87[_0x476c('0x2c')];this['VoiceQueueId']=_0x534c87['VoiceQueueId'];this[_0x476c('0x2d')]=_0x534c87['CampaignId'];this[_0x476c('0x2e')]=_0x534c87[_0x476c('0x2e')]||'';this[_0x476c('0x2f')]=_0x534c87[_0x476c('0x2f')]||'';}module[_0x476c('0x30')]=AgentComplete; \ No newline at end of file +var _0x957a=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x27dfe2,_0xa59b1e){var _0x45e3b9=function(_0x1c7af5){while(--_0x1c7af5){_0x27dfe2['push'](_0x27dfe2['shift']());}};_0x45e3b9(++_0xa59b1e);}(_0x957a,0x137));var _0xa957=function(_0x2e7b05,_0x5df7dc){_0x2e7b05=_0x2e7b05-0x0;var _0x14266f=_0x957a[_0x2e7b05];return _0x14266f;};'use strict';var util=require(_0xa957('0x0'));var _=require(_0xa957('0x1'));var moment=require(_0xa957('0x2'));function getSeconds(_0x23616d,_0x395094){var _0x4f6043=moment(_0x23616d)[_0xa957('0x3')](0x0);var _0x183683=moment(_0x395094)[_0xa957('0x3')](0x0);return _0x4f6043[_0xa957('0x4')](_0x183683,_0xa957('0x5'));}function AgentComplete(_0x3548b2,_0x14f018){this[_0xa957('0x6')]=0x4;this[_0xa957('0x7')]=_0xa957('0x8');this[_0xa957('0x9')]=_0x3548b2['scheduledat'];this['type']=_0x3548b2[_0xa957('0xa')];this[_0xa957('0xb')]=_0x3548b2[_0xa957('0xa')]===_0xa957('0xc')?_0xa957('0xd'):_0x3548b2[_0xa957('0xa')];this['countbusyretry']=_0x3548b2['countbusyretry'];this[_0xa957('0xe')]=_0x3548b2[_0xa957('0xe')];this[_0xa957('0xf')]=_0x3548b2[_0xa957('0xf')];this[_0xa957('0x10')]=_0x3548b2['countbusyretry']+_0x3548b2[_0xa957('0xe')]+_0x3548b2['countnoanswerretry']+_0x3548b2[_0xa957('0x11')]+_0x3548b2[_0xa957('0x12')]+_0x3548b2[_0xa957('0x13')]+_0x3548b2[_0xa957('0x14')]+_0x3548b2['countagentrejectretry'];this['countnosuchnumberretry']=_0x3548b2['countnosuchnumberretry'];this[_0xa957('0x12')]=_0x3548b2[_0xa957('0x12')];this[_0xa957('0x13')]=_0x3548b2[_0xa957('0x13')];this[_0xa957('0x14')]=_0x3548b2[_0xa957('0x14')];this[_0xa957('0x15')]=_0x3548b2[_0xa957('0x15')];this[_0xa957('0x16')]=_0x14f018[_0xa957('0x16')];this[_0xa957('0x17')]=_0x3548b2[_0xa957('0x18')];this[_0xa957('0x19')]=_0x3548b2[_0xa957('0x1a')];this[_0xa957('0x1b')]=_0x3548b2[_0xa957('0x1b')];this[_0xa957('0x1c')]=_0x3548b2['responsetime'];this[_0xa957('0x1d')]=_0x3548b2[_0xa957('0x1d')];this['endtime']=moment()[_0xa957('0x1e')](_0xa957('0x1f'));this[_0xa957('0x20')]=getSeconds(_0x3548b2[_0xa957('0x1c')],_0x3548b2[_0xa957('0x1b')]);this['holdtime']=getSeconds(_0x3548b2['answertime'],_0x3548b2[_0xa957('0x1c')]);this[_0xa957('0x21')]=getSeconds(this[_0xa957('0x22')],_0x3548b2[_0xa957('0x1d')]);this[_0xa957('0xd')]=_0x14f018['queue'];this[_0xa957('0x23')]=_0x14f018[_0xa957('0x23')];this[_0xa957('0x24')]=_0x14f018['reason'];this[_0xa957('0x25')]=_0x3548b2['callback'];this['callbackuniqueid']=_0x3548b2[_0xa957('0x26')];this[_0xa957('0x27')]=_0x3548b2[_0xa957('0x27')];this[_0xa957('0x28')]=_0x3548b2[_0xa957('0x28')];this[_0xa957('0x29')]=_0x3548b2[_0xa957('0x29')];this[_0xa957('0x2a')]=_0x3548b2['ListId'];this['UserId']=_0x3548b2['UserId'];this[_0xa957('0x2b')]=_0x3548b2['VoiceQueueId'];this[_0xa957('0x2c')]=_0x3548b2[_0xa957('0x2c')];this['originatecalleridnum']=_0x3548b2[_0xa957('0x2d')]||'';this[_0xa957('0x2e')]=_0x3548b2[_0xa957('0x2e')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index f7dc9c0..d05c11c 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 _0xf873=['campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type'];(function(_0x5693af,_0x2f1c6f){var _0x9bf701=function(_0x1c690b){while(--_0x1c690b){_0x5693af['push'](_0x5693af['shift']());}};_0x9bf701(++_0x2f1c6f);}(_0xf873,0xb2));var _0x3f87=function(_0x1f1819,_0x3c0750){_0x1f1819=_0x1f1819-0x0;var _0x5ac52c=_0xf873[_0x1f1819];return _0x5ac52c;};'use strict';var util=require('util');var _=require(_0x3f87('0x0'));var moment=require(_0x3f87('0x1'));function getSeconds(_0x311101,_0x3ef688){var _0x1c56a3=moment(_0x311101)[_0x3f87('0x2')](0x0);var _0x2fbb4f=moment(_0x3ef688)[_0x3f87('0x2')](0x0);return _0x1c56a3[_0x3f87('0x3')](_0x2fbb4f,'seconds');}function Final(_0x2e2177){this[_0x3f87('0x4')]=_0x2e2177[_0x3f87('0x4')];this['scheduledat']=_0x2e2177[_0x3f87('0x5')];this[_0x3f87('0x6')]=_0x2e2177[_0x3f87('0x6')];this[_0x3f87('0x7')]=_0x2e2177[_0x3f87('0x6')]===_0x3f87('0x8')?'queue':_0x2e2177[_0x3f87('0x6')];this[_0x3f87('0x9')]=_0x2e2177[_0x3f87('0x9')];this[_0x3f87('0xa')]=_0x2e2177[_0x3f87('0xa')];this[_0x3f87('0xb')]=_0x2e2177[_0x3f87('0xb')];this[_0x3f87('0xc')]=_0x2e2177[_0x3f87('0x9')]+_0x2e2177[_0x3f87('0xa')]+_0x2e2177[_0x3f87('0xb')]+_0x2e2177[_0x3f87('0xd')]+_0x2e2177[_0x3f87('0xe')]+_0x2e2177[_0x3f87('0xf')]+_0x2e2177['countmachineretry']+_0x2e2177[_0x3f87('0x10')];this[_0x3f87('0xd')]=_0x2e2177['countnosuchnumberretry'];this[_0x3f87('0xe')]=_0x2e2177[_0x3f87('0xe')];this[_0x3f87('0xf')]=_0x2e2177[_0x3f87('0xf')];this[_0x3f87('0x11')]=_0x2e2177[_0x3f87('0x11')];this[_0x3f87('0x10')]=_0x2e2177[_0x3f87('0x10')];this['queue']=_0x2e2177[_0x3f87('0x12')];this[_0x3f87('0x13')]=_0x2e2177[_0x3f87('0x13')];this['calleridnum']=_0x2e2177[_0x3f87('0x14')];this['starttime']=_0x2e2177[_0x3f87('0x15')];this[_0x3f87('0x16')]=_0x2e2177[_0x3f87('0x16')];this[_0x3f87('0x17')]=_0x2e2177[_0x3f87('0x16')];this['ringtime']=_0x2e2177[_0x3f87('0x18')]||0x0;this[_0x3f87('0x19')]=_0x2e2177[_0x3f87('0x19')]||0x0;this[_0x3f87('0x1a')]=_0x2e2177['talktime']||0x0;this['callback']=_0x2e2177['callback'];this[_0x3f87('0x1b')]=_0x2e2177[_0x3f87('0x1b')];this[_0x3f87('0x1c')]=_0x2e2177['callbackat'];this[_0x3f87('0x1d')]=_0x2e2177[_0x3f87('0x1d')];this[_0x3f87('0x1e')]=_0x2e2177[_0x3f87('0x1e')];this[_0x3f87('0x1f')]=_0x2e2177[_0x3f87('0x1f')];this[_0x3f87('0x20')]=_0x2e2177[_0x3f87('0x20')];this[_0x3f87('0x21')]=_0x2e2177[_0x3f87('0x21')];this[_0x3f87('0x22')]=_0x2e2177[_0x3f87('0x22')];this['originatecalleridnum']=_0x2e2177[_0x3f87('0x23')]||'';this[_0x3f87('0x24')]=_0x2e2177[_0x3f87('0x24')]||'';}module['exports']=Final; \ No newline at end of file +var _0x0b78=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue'];(function(_0x49bf14,_0x7d72a9){var _0x413809=function(_0x441f88){while(--_0x441f88){_0x49bf14['push'](_0x49bf14['shift']());}};_0x413809(++_0x7d72a9);}(_0x0b78,0x1ad));var _0x80b7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0b78[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x80b7('0x0'));var _=require(_0x80b7('0x1'));var moment=require('moment');function getSeconds(_0x10e644,_0x4f55ab){var _0x4bffac=moment(_0x10e644)[_0x80b7('0x2')](0x0);var _0x4ee9b4=moment(_0x4f55ab)[_0x80b7('0x2')](0x0);return _0x4bffac[_0x80b7('0x3')](_0x4ee9b4,_0x80b7('0x4'));}function Final(_0x5d4a96){this['uniqueid']=_0x5d4a96[_0x80b7('0x5')];this['scheduledat']=_0x5d4a96[_0x80b7('0x6')];this[_0x80b7('0x7')]=_0x5d4a96[_0x80b7('0x7')];this[_0x80b7('0x8')]=_0x5d4a96['type']===_0x80b7('0x9')?_0x80b7('0xa'):_0x5d4a96[_0x80b7('0x7')];this['countbusyretry']=_0x5d4a96[_0x80b7('0xb')];this['countcongestionretry']=_0x5d4a96[_0x80b7('0xc')];this[_0x80b7('0xd')]=_0x5d4a96[_0x80b7('0xd')];this[_0x80b7('0xe')]=_0x5d4a96[_0x80b7('0xb')]+_0x5d4a96[_0x80b7('0xc')]+_0x5d4a96[_0x80b7('0xd')]+_0x5d4a96[_0x80b7('0xf')]+_0x5d4a96[_0x80b7('0x10')]+_0x5d4a96[_0x80b7('0x11')]+_0x5d4a96[_0x80b7('0x12')]+_0x5d4a96['countagentrejectretry'];this[_0x80b7('0xf')]=_0x5d4a96[_0x80b7('0xf')];this['countdropretry']=_0x5d4a96[_0x80b7('0x10')];this[_0x80b7('0x11')]=_0x5d4a96['countabandonedretry'];this[_0x80b7('0x12')]=_0x5d4a96[_0x80b7('0x12')];this[_0x80b7('0x13')]=_0x5d4a96[_0x80b7('0x13')];this[_0x80b7('0xa')]=_0x5d4a96[_0x80b7('0xa')];this[_0x80b7('0x14')]=_0x5d4a96[_0x80b7('0x14')];this[_0x80b7('0x15')]=_0x5d4a96[_0x80b7('0x15')];this['starttime']=_0x5d4a96[_0x80b7('0x16')];this[_0x80b7('0x17')]=_0x5d4a96[_0x80b7('0x17')];this[_0x80b7('0x18')]=_0x5d4a96['responsetime'];this['ringtime']=_0x5d4a96[_0x80b7('0x19')]||0x0;this[_0x80b7('0x1a')]=_0x5d4a96[_0x80b7('0x1a')]||0x0;this[_0x80b7('0x1b')]=_0x5d4a96['talktime']||0x0;this['callback']=_0x5d4a96[_0x80b7('0x1c')];this[_0x80b7('0x1d')]=_0x5d4a96[_0x80b7('0x1d')];this[_0x80b7('0x1e')]=_0x5d4a96['callbackat'];this[_0x80b7('0x1f')]=_0x5d4a96['recallme'];this['ContactId']=_0x5d4a96[_0x80b7('0x20')];this[_0x80b7('0x21')]=_0x5d4a96[_0x80b7('0x21')];this[_0x80b7('0x22')]=_0x5d4a96[_0x80b7('0x22')];this[_0x80b7('0x23')]=_0x5d4a96[_0x80b7('0x23')];this[_0x80b7('0x24')]=_0x5d4a96[_0x80b7('0x24')];this[_0x80b7('0x25')]=_0x5d4a96[_0x80b7('0x25')]||'';this[_0x80b7('0x26')]=_0x5d4a96[_0x80b7('0x26')]||'';}module[_0x80b7('0x27')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 246aff0..a346cb2 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 _0x2638=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2638,0x12f));var _0x8263=function(_0xc5eaba,_0x5321d5){_0xc5eaba=_0xc5eaba-0x0;var _0x1a4cba=_0x2638[_0xc5eaba];return _0x1a4cba;};'use strict';var util=require(_0x8263('0x0'));var _=require(_0x8263('0x1'));var moment=require(_0x8263('0x2'));function getSeconds(_0x39f5ba,_0x532cb7){var _0x445c09=moment(_0x39f5ba)[_0x8263('0x3')](0x0);var _0x110065=moment(_0x532cb7)[_0x8263('0x3')](0x0);return _0x445c09[_0x8263('0x4')](_0x110065,_0x8263('0x5'));}function Hangup(_0x5c45f5,_0x1fb0e5){this[_0x8263('0x6')]=0x4;this[_0x8263('0x7')]=_0x8263('0x8');this[_0x8263('0x9')]=_0x5c45f5[_0x8263('0x9')];this[_0x8263('0xa')]=_0x5c45f5['type'];this[_0x8263('0xb')]=_0x5c45f5[_0x8263('0xa')]===_0x8263('0xc')?_0x8263('0xd'):_0x5c45f5[_0x8263('0xa')];this[_0x8263('0xe')]=_0x5c45f5[_0x8263('0xe')];this[_0x8263('0xf')]=_0x5c45f5['countcongestionretry'];this[_0x8263('0x10')]=_0x5c45f5[_0x8263('0x10')];this[_0x8263('0x11')]=_0x5c45f5[_0x8263('0xe')]+_0x5c45f5[_0x8263('0xf')]+_0x5c45f5[_0x8263('0x10')]+_0x5c45f5[_0x8263('0x12')]+_0x5c45f5['countdropretry']+_0x5c45f5[_0x8263('0x13')]+_0x5c45f5['countmachineretry']+_0x5c45f5[_0x8263('0x14')];this['countnosuchnumberretry']=_0x5c45f5[_0x8263('0x12')];this[_0x8263('0x15')]=_0x5c45f5[_0x8263('0x15')];this[_0x8263('0x13')]=_0x5c45f5[_0x8263('0x13')];this[_0x8263('0x16')]=_0x5c45f5[_0x8263('0x16')];this['countagentrejectretry']=_0x5c45f5['countagentrejectretry'];this[_0x8263('0x17')]=_0x1fb0e5[_0x8263('0x17')];this[_0x8263('0x18')]=_0x5c45f5[_0x8263('0x19')];this[_0x8263('0x1a')]=_0x5c45f5[_0x8263('0x1b')];this['starttime']=_0x5c45f5[_0x8263('0x1c')];this['responsetime']=_0x5c45f5['responsetime'];this[_0x8263('0x1d')]=moment()[_0x8263('0x1e')](_0x8263('0x1f'));this[_0x8263('0x20')]=getSeconds(_0x5c45f5[_0x8263('0x21')],_0x5c45f5['starttime']);this['holdtime']=0x0;this['talktime']=getSeconds(this['endtime'],_0x5c45f5[_0x8263('0x21')]);this[_0x8263('0xd')]=_0x5c45f5[_0x8263('0xd')];this[_0x8263('0x22')]='IVR';this[_0x8263('0x23')]=_0x1fb0e5['cause-txt'];this[_0x8263('0x24')]=_0x5c45f5[_0x8263('0x24')];this[_0x8263('0x25')]=_0x5c45f5[_0x8263('0x25')];this['callbackat']=_0x5c45f5[_0x8263('0x26')];this['recallme']=_0x5c45f5[_0x8263('0x27')];this[_0x8263('0x28')]=_0x5c45f5['ContactId'];this[_0x8263('0x29')]=_0x5c45f5[_0x8263('0x29')];this[_0x8263('0x2a')]=_0x5c45f5[_0x8263('0x2a')];this['VoiceQueueId']=_0x5c45f5[_0x8263('0x2b')];this[_0x8263('0x2c')]=_0x5c45f5[_0x8263('0x2c')];}module['exports']=Hangup; \ No newline at end of file +var _0x00dd=['UserId','VoiceQueueId','CampaignId','util','lodash','moment','diff','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','holdtime','membername','IVR','cause-txt','callback','callbackuniqueid','recallme','ListId'];(function(_0x314148,_0x50e34b){var _0x5703c4=function(_0x28bab8){while(--_0x28bab8){_0x314148['push'](_0x314148['shift']());}};_0x5703c4(++_0x50e34b);}(_0x00dd,0x189));var _0xd00d=function(_0x51b169,_0x5efbc2){_0x51b169=_0x51b169-0x0;var _0x12605a=_0x00dd[_0x51b169];return _0x12605a;};'use strict';var util=require(_0xd00d('0x0'));var _=require(_0xd00d('0x1'));var moment=require(_0xd00d('0x2'));function getSeconds(_0x5dde78,_0x3c56cb){var _0x284280=moment(_0x5dde78)['milliseconds'](0x0);var _0x550bb2=moment(_0x3c56cb)['milliseconds'](0x0);return _0x284280[_0xd00d('0x3')](_0x550bb2,'seconds');}function Hangup(_0x5d788f,_0x56556e){this['state']=0x4;this[_0xd00d('0x4')]=_0xd00d('0x5');this[_0xd00d('0x6')]=_0x5d788f[_0xd00d('0x6')];this[_0xd00d('0x7')]=_0x5d788f[_0xd00d('0x7')];this[_0xd00d('0x8')]=_0x5d788f[_0xd00d('0x7')]===_0xd00d('0x9')?_0xd00d('0xa'):_0x5d788f[_0xd00d('0x7')];this[_0xd00d('0xb')]=_0x5d788f['countbusyretry'];this['countcongestionretry']=_0x5d788f[_0xd00d('0xc')];this['countnoanswerretry']=_0x5d788f[_0xd00d('0xd')];this[_0xd00d('0xe')]=_0x5d788f['countbusyretry']+_0x5d788f[_0xd00d('0xc')]+_0x5d788f['countnoanswerretry']+_0x5d788f['countnosuchnumberretry']+_0x5d788f[_0xd00d('0xf')]+_0x5d788f[_0xd00d('0x10')]+_0x5d788f['countmachineretry']+_0x5d788f[_0xd00d('0x11')];this[_0xd00d('0x12')]=_0x5d788f[_0xd00d('0x12')];this[_0xd00d('0xf')]=_0x5d788f[_0xd00d('0xf')];this[_0xd00d('0x10')]=_0x5d788f[_0xd00d('0x10')];this['countmachineretry']=_0x5d788f['countmachineretry'];this[_0xd00d('0x11')]=_0x5d788f[_0xd00d('0x11')];this['uniqueid']=_0x56556e[_0xd00d('0x13')];this[_0xd00d('0x14')]=_0x5d788f[_0xd00d('0x15')];this[_0xd00d('0x16')]=_0x5d788f[_0xd00d('0x17')];this[_0xd00d('0x18')]=_0x5d788f['starttime'];this[_0xd00d('0x19')]=_0x5d788f[_0xd00d('0x19')];this[_0xd00d('0x1a')]=moment()['format'](_0xd00d('0x1b'));this['ringtime']=getSeconds(_0x5d788f[_0xd00d('0x19')],_0x5d788f[_0xd00d('0x18')]);this[_0xd00d('0x1c')]=0x0;this['talktime']=getSeconds(this[_0xd00d('0x1a')],_0x5d788f[_0xd00d('0x19')]);this[_0xd00d('0xa')]=_0x5d788f[_0xd00d('0xa')];this[_0xd00d('0x1d')]=_0xd00d('0x1e');this['reason']=_0x56556e[_0xd00d('0x1f')];this[_0xd00d('0x20')]=_0x5d788f[_0xd00d('0x20')];this[_0xd00d('0x21')]=_0x5d788f[_0xd00d('0x21')];this['callbackat']=_0x5d788f['callbackat'];this[_0xd00d('0x22')]=_0x5d788f[_0xd00d('0x22')];this['ContactId']=_0x5d788f['ContactId'];this[_0xd00d('0x23')]=_0x5d788f[_0xd00d('0x23')];this[_0xd00d('0x24')]=_0x5d788f['UserId'];this[_0xd00d('0x25')]=_0x5d788f[_0xd00d('0x25')];this[_0xd00d('0x26')]=_0x5d788f['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 d6bb98c..6dd50b1 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 _0x613e=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry'];(function(_0x41a547,_0x3ebb3f){var _0x3fa3f4=function(_0x126313){while(--_0x126313){_0x41a547['push'](_0x41a547['shift']());}};_0x3fa3f4(++_0x3ebb3f);}(_0x613e,0x1c7));var _0xe613=function(_0x20fa59,_0x3c0b58){_0x20fa59=_0x20fa59-0x0;var _0x198f78=_0x613e[_0x20fa59];return _0x198f78;};'use strict';var util=require(_0xe613('0x0'));var _=require(_0xe613('0x1'));var moment=require(_0xe613('0x2'));function getSeconds(_0x56aef3,_0x9571ac){var _0x36d103=moment(_0x56aef3)[_0xe613('0x3')](0x0);var _0x5bcf72=moment(_0x9571ac)[_0xe613('0x3')](0x0);return _0x36d103[_0xe613('0x4')](_0x5bcf72,_0xe613('0x5'));}function History(_0xda324a){this[_0xe613('0x6')]=_0xda324a['uniqueid'];this[_0xe613('0x7')]=_0xda324a[_0xe613('0x7')]||undefined;this[_0xe613('0x8')]=_0xda324a['type'];this[_0xe613('0x9')]=_0xda324a[_0xe613('0x8')]===_0xe613('0xa')?'queue':_0xda324a[_0xe613('0x8')];this[_0xe613('0xb')]=_0xda324a[_0xe613('0xb')];this[_0xe613('0xc')]=_0xda324a[_0xe613('0xc')];this['countnoanswerretry']=_0xda324a[_0xe613('0xd')];this[_0xe613('0xe')]=_0xda324a['countbusyretry']+_0xda324a['countcongestionretry']+_0xda324a[_0xe613('0xd')]+_0xda324a[_0xe613('0xf')]+_0xda324a[_0xe613('0x10')]+_0xda324a[_0xe613('0x11')]+_0xda324a[_0xe613('0x12')]+_0xda324a[_0xe613('0x13')];this['countnosuchnumberretry']=_0xda324a['countnosuchnumberretry'];this[_0xe613('0x10')]=_0xda324a[_0xe613('0x10')];this[_0xe613('0x11')]=_0xda324a[_0xe613('0x11')];this['countmachineretry']=_0xda324a[_0xe613('0x12')];this['countagentrejectretry']=_0xda324a['countagentrejectretry'];this[_0xe613('0x14')]=_0xda324a[_0xe613('0x14')];this[_0xe613('0x15')]=_0xda324a['name'];this[_0xe613('0x16')]=_0xda324a['number'];this[_0xe613('0x17')]=_0xda324a[_0xe613('0x17')];this[_0xe613('0x18')]=_0xda324a[_0xe613('0x18')];this[_0xe613('0x19')]=_0xda324a[_0xe613('0x18')];this['ringtime']=getSeconds(_0xda324a['responsetime'],_0xda324a['starttime']);this[_0xe613('0x1a')]=0x0;this['talktime']=0x0;this[_0xe613('0x1b')]=_0xda324a[_0xe613('0x1b')];this[_0xe613('0x1c')]=_0xda324a[_0xe613('0x1c')];this[_0xe613('0x1d')]=_0xda324a[_0xe613('0x1d')];this[_0xe613('0x1e')]=_0xda324a[_0xe613('0x1e')];this[_0xe613('0x1f')]=_0xda324a['ContactId'];this[_0xe613('0x20')]=_0xda324a[_0xe613('0x20')];this[_0xe613('0x21')]=_0xda324a['UserId'];this['VoiceQueueId']=_0xda324a[_0xe613('0x22')];this[_0xe613('0x23')]=_0xda324a[_0xe613('0x23')];this[_0xe613('0x24')]=_0xda324a['originatecalleridnum']||'';this[_0xe613('0x25')]=_0xda324a[_0xe613('0x25')]||'';}module[_0xe613('0x26')]=History; \ No newline at end of file +var _0xcf9d=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','name','number','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x882cb3,_0x288556){var _0x1f96a2=function(_0x3dfbaf){while(--_0x3dfbaf){_0x882cb3['push'](_0x882cb3['shift']());}};_0x1f96a2(++_0x288556);}(_0xcf9d,0x1ae));var _0xdcf9=function(_0x55fbb2,_0x2c5225){_0x55fbb2=_0x55fbb2-0x0;var _0x489cf1=_0xcf9d[_0x55fbb2];return _0x489cf1;};'use strict';var util=require('util');var _=require(_0xdcf9('0x0'));var moment=require(_0xdcf9('0x1'));function getSeconds(_0x1f9bab,_0x3fb537){var _0xf053ec=moment(_0x1f9bab)[_0xdcf9('0x2')](0x0);var _0x43b44e=moment(_0x3fb537)['milliseconds'](0x0);return _0xf053ec['diff'](_0x43b44e,_0xdcf9('0x3'));}function History(_0x14dfe6){this['uniqueid']=_0x14dfe6[_0xdcf9('0x4')];this['scheduledat']=_0x14dfe6[_0xdcf9('0x5')]||undefined;this[_0xdcf9('0x6')]=_0x14dfe6['type'];this['campaigntype']=_0x14dfe6[_0xdcf9('0x6')]===_0xdcf9('0x7')?'queue':_0x14dfe6[_0xdcf9('0x6')];this['countbusyretry']=_0x14dfe6[_0xdcf9('0x8')];this[_0xdcf9('0x9')]=_0x14dfe6[_0xdcf9('0x9')];this[_0xdcf9('0xa')]=_0x14dfe6['countnoanswerretry'];this[_0xdcf9('0xb')]=_0x14dfe6['countbusyretry']+_0x14dfe6[_0xdcf9('0x9')]+_0x14dfe6[_0xdcf9('0xa')]+_0x14dfe6['countnosuchnumberretry']+_0x14dfe6[_0xdcf9('0xc')]+_0x14dfe6[_0xdcf9('0xd')]+_0x14dfe6['countmachineretry']+_0x14dfe6[_0xdcf9('0xe')];this['countnosuchnumberretry']=_0x14dfe6['countnosuchnumberretry'];this[_0xdcf9('0xc')]=_0x14dfe6['countdropretry'];this['countabandonedretry']=_0x14dfe6[_0xdcf9('0xd')];this[_0xdcf9('0xf')]=_0x14dfe6[_0xdcf9('0xf')];this[_0xdcf9('0xe')]=_0x14dfe6[_0xdcf9('0xe')];this['queue']=_0x14dfe6[_0xdcf9('0x10')];this['calleridname']=_0x14dfe6[_0xdcf9('0x11')];this['calleridnum']=_0x14dfe6[_0xdcf9('0x12')];this[_0xdcf9('0x13')]=_0x14dfe6[_0xdcf9('0x13')];this['responsetime']=_0x14dfe6[_0xdcf9('0x14')];this['endtime']=_0x14dfe6[_0xdcf9('0x14')];this['ringtime']=getSeconds(_0x14dfe6[_0xdcf9('0x14')],_0x14dfe6[_0xdcf9('0x13')]);this[_0xdcf9('0x15')]=0x0;this[_0xdcf9('0x16')]=0x0;this[_0xdcf9('0x17')]=_0x14dfe6[_0xdcf9('0x17')];this[_0xdcf9('0x18')]=_0x14dfe6[_0xdcf9('0x18')];this[_0xdcf9('0x19')]=_0x14dfe6['callbackat'];this[_0xdcf9('0x1a')]=_0x14dfe6[_0xdcf9('0x1a')];this['ContactId']=_0x14dfe6[_0xdcf9('0x1b')];this[_0xdcf9('0x1c')]=_0x14dfe6[_0xdcf9('0x1c')];this['UserId']=_0x14dfe6[_0xdcf9('0x1d')];this[_0xdcf9('0x1e')]=_0x14dfe6[_0xdcf9('0x1e')];this[_0xdcf9('0x1f')]=_0x14dfe6[_0xdcf9('0x1f')];this['originatecalleridnum']=_0x14dfe6[_0xdcf9('0x20')]||'';this[_0xdcf9('0x21')]=_0x14dfe6['originatecalleridname']||'';}module[_0xdcf9('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 b8ceaf9..ed75c0c 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 _0x4065=['[booked][unlock3]','loopCampaigns','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','content','true','indexOf','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','\x5cw{0,','pow','replace','random','match','originate','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','trim','substring','dialCutDigit','SIP/%s/%s%s','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','object','[callProgressDetecting]','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','floor','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','check\x20failure','outboundQueuePauses','abandonmentRate','[CatchErlangB]','agentBusyFactor','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','countReScheduled','[countReScheduled]\x20','Contact.phone','loggerHandler','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Amax\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]','Ts\x20=\x20','interval\x20=\x20','Umin\x20=\x20','uuid','md5','ioredis','../preview/util/util','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','milliseconds','emit','strategy','loggedIn','sumBillable','sumDuration','talking','total','type','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\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','clearing\x20variable\x20start\x20progressive','handlePredictive','outbound','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','statedesc','starttime','clearZombieChannels','[uniqueid]','[actions]','undefined','sequence','isNil','Action','channel','catch','No\x20such\x20channel','queue','updateOriginated','resolve','then','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20is\x20null\x20or\x20undefined','merge','pick','ListId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','status','unmonitored','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','outboundAnswerCallsDay','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','createStateFinal','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]','uniqueid','[syncHangupInAMDIvr][createHistory]','MACHINE','stateGlobal','dialMachineMaxRetry','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','Unknow','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dialDropMaxRetry','dialDropRetryFrequency','VoiceQueueId','CampaignId','endtime','calleridname','calleridnum','Abandoned','dropreason','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','stringify','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]'];(function(_0x30b655,_0x2256c7){var _0x5d1d6f=function(_0x41eebf){while(--_0x41eebf){_0x30b655['push'](_0x30b655['shift']());}};_0x5d1d6f(++_0x2256c7);}(_0x4065,0xdc));var _0x5406=function(_0x537ae3,_0x12aeab){_0x537ae3=_0x537ae3-0x0;var _0x5d46ad=_0x4065[_0x537ae3];return _0x5d46ad;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x5406('0x0'));var moment=require('moment');var rr=require('rr');var md5=require(_0x5406('0x1'));var Redis=require(_0x5406('0x2'));var ut=require(_0x5406('0x3'));var config=require('../../../config/environment/');var logger=require(_0x5406('0x4'))(_0x5406('0x5'));var loggerBooked=require('../../../config/logger')(_0x5406('0x6'));var loggerPredictive=require(_0x5406('0x4'))(_0x5406('0x7'));var loggerPredictiveCalls=require(_0x5406('0x4'))(_0x5406('0x8'));var loggerSyncQueueSummary=require(_0x5406('0x4'))('syncQueueSummary');var ami=require(_0x5406('0x9'));config[_0x5406('0xa')]=_[_0x5406('0xb')](config[_0x5406('0xa')],{'host':_0x5406('0xc'),'port':0x18eb});var io=require(_0x5406('0xd'))(new Redis(config['redis']));var cmHopper=require(_0x5406('0xe'));var cmHopperHistory=require(_0x5406('0xf'));var cmHopperBlack=require(_0x5406('0x10'));var voiceQueueRt=require(_0x5406('0x11'));var Action=require(_0x5406('0x12'));var History=require(_0x5406('0x13'));var Final=require('./final');var AgentComplete=require(_0x5406('0x14'));var QueueCallerAbandon=require(_0x5406('0x15'));var Hangup=require('./hangup');var ipAgi=process[_0x5406('0x16')][_0x5406('0x17')]||_0x5406('0x18');var strategy={'rrmemory':_0x5406('0x19'),'roundrobin':_0x5406('0x1a')};var Sequence=function(){};Sequence[_0x5406('0x1b')][_0x5406('0x1c')]=function(_0x2a6603){this[_0x5406('0x1d')]=this['tail']?this[_0x5406('0x1d')][_0x5406('0x1e')](_0x2a6603):_0x2a6603();};function Dialer(_0xb982cc,_0xb25b29){this['sequence']=new Sequence();this[_0x5406('0x1f')]=_0xb25b29;this[_0x5406('0x20')]=_0xb982cc[_0x5406('0x20')];this[_0x5406('0x21')]=_0xb982cc[_0x5406('0x21')];this[_0x5406('0x22')]=_0xb982cc[_0x5406('0x22')];this[_0x5406('0x23')]=_0xb982cc['trunks'];this[_0x5406('0x24')]=config[_0x5406('0x24')]||0x2;this['channels']={};this[_0x5406('0x25')]={};this[_0x5406('0x26')]={};this[_0x5406('0x27')]={};this['optionPredictive']={};this[_0x5406('0x28')]={};this[_0x5406('0x29')]={};this[_0x5406('0x2a')]={};this[_0x5406('0x2b')]={};this[_0x5406('0x2c')]={};ami['on'](_0x5406('0x2d'),this[_0x5406('0x2e')][_0x5406('0x2f')](this));ami['on']('queuecallerabandon',this[_0x5406('0x30')]['bind'](this));ami['on'](_0x5406('0x31'),this[_0x5406('0x32')]['bind'](this));ami['on'](_0x5406('0x33'),this[_0x5406('0x34')][_0x5406('0x2f')](this));ami['on'](_0x5406('0x35'),this[_0x5406('0x36')][_0x5406('0x2f')](this));ami['on'](_0x5406('0x37'),this[_0x5406('0x38')]['bind'](this));ami['on'](_0x5406('0x39'),this[_0x5406('0x3a')][_0x5406('0x2f')](this));ami['on'](_0x5406('0x3b'),this[_0x5406('0x3c')][_0x5406('0x2f')](this));ami['on'](_0x5406('0x3d'),this[_0x5406('0x3e')]['bind'](this));ami['on'](_0x5406('0x3f'),this['syncQueueStatusComplete'][_0x5406('0x2f')](this));this['loopCampaigns']();this[_0x5406('0x40')]();}function isNotNull(_0x3cf64f){return _0x3cf64f!==null&&!_[_0x5406('0x41')](_0x3cf64f);}function checkIsLoggedIn(_0x24255f,_0x213bf4){return function(){if(_0x213bf4<=0x0){_0x24255f[_0x5406('0x42')]=_0x5406('0x43');throw _0x24255f[_0x5406('0x44')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x2daf47){return _0x2daf47;}function checkIsActive(_0x375338,_0x2e9ab9){return function(){if(!isActive(_0x2e9ab9)){_0x375338['message']=_0x5406('0x45');throw _0x375338[_0x5406('0x44')]+'\x20NOT\x20Active';}};}function checkInterval(_0x4f751c){return function(){if(!isNotNull(_0x4f751c[_0x5406('0x46')])){_0x4f751c[_0x5406('0x42')]=_0x5406('0x47');throw _0x4f751c[_0x5406('0x44')]+_0x5406('0x48');}if(!isNotNull(_0x4f751c['Interval']['Intervals'])){_0x4f751c['message']=_0x5406('0x47');throw _0x4f751c[_0x5406('0x44')]+_0x5406('0x48');}if(!isNotNull(_[_0x5406('0x49')](_0x4f751c['Interval'][_0x5406('0x4a')]))){_0x4f751c[_0x5406('0x42')]='INTERVAL_IS_NULL';throw _0x4f751c[_0x5406('0x44')]+_0x5406('0x48');}};}function msgResponse(_0x1bfe35,_0x5d7feb,_0x102696){return{'action':_0x1bfe35,'response':_0x5d7feb,'message':_0x102696,'stack':_0x102696};}function myreject(_0xe755f3){return function(_0x36e32d){return _0xe755f3(msgResponse('[ifTime][Action]','Error',JSON['stringify'](_0x36e32d)));};}function getSeconds(_0xbdeac2,_0x4d14d7){var _0x4c8e7d=moment(_0xbdeac2)[_0x5406('0x4b')](0x0);var _0x34f2da=moment(_0x4d14d7)[_0x5406('0x4b')](0x0);return _0x4c8e7d['diff'](_0x34f2da,'seconds');}function emit(_0x56f4b7,_0x1f061c,_0x134284){io['to'](_0x56f4b7)[_0x5406('0x4c')](_0x1f061c,_0x134284);}function emitVoiceQueueSummary(_0x3ac9ae){if(_0x3ac9ae['type']==='outbound'){var _0x95da62={'id':_0x3ac9ae['id'],'name':_0x3ac9ae[_0x5406('0x44')],'strategy':_0x3ac9ae[_0x5406('0x4d')],'answered':_0x3ac9ae['answered'],'available':_0x3ac9ae['available'],'loggedIn':_0x3ac9ae[_0x5406('0x4e')],'pTalking':_0x3ac9ae['pTalking'],'sumBillable':_0x3ac9ae[_0x5406('0x4f')],'sumDuration':_0x3ac9ae[_0x5406('0x50')],'sumHoldTime':_0x3ac9ae['sumHoldTime']||0x0,'talking':_0x3ac9ae[_0x5406('0x51')],'total':_0x3ac9ae[_0x5406('0x52')],'type':_0x3ac9ae[_0x5406('0x53')],'unmanaged':_0x3ac9ae[_0x5406('0x54')],'abandoned':_0x3ac9ae[_0x5406('0x55')],'waiting':_0x3ac9ae['waiting'],'loggedInDb':_0x3ac9ae[_0x5406('0x56')],'dialActive':_0x3ac9ae[_0x5406('0x57')],'dialMethod':_0x3ac9ae[_0x5406('0x58')],'dialOriginateCallerIdName':_0x3ac9ae[_0x5406('0x59')],'dialOriginateCallerIdNumber':_0x3ac9ae[_0x5406('0x5a')],'dialOriginateTimeout':_0x3ac9ae[_0x5406('0x5b')],'dialPrefix':_0x3ac9ae[_0x5406('0x5c')],'outboundAnswerAgiCallsDay':_0x3ac9ae[_0x5406('0x5d')],'outboundAnswerCallsDay':_0x3ac9ae['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3ac9ae[_0x5406('0x5e')],'outboundBusyCallsDay':_0x3ac9ae[_0x5406('0x5f')],'outboundCongestionCallsDay':_0x3ac9ae[_0x5406('0x60')],'outboundDropCallsDayACS':_0x3ac9ae[_0x5406('0x61')],'outboundDropCallsDayCallersExit':_0x3ac9ae[_0x5406('0x62')],'outboundDropCallsDayTimeout':_0x3ac9ae['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x3ac9ae[_0x5406('0x63')],'outboundNoSuchCallsDay':_0x3ac9ae['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x3ac9ae['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3ac9ae['outboundReCallsDay'],'outboundRejectCallsDay':_0x3ac9ae['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x3ac9ae[_0x5406('0x64')],'predictiveIntervalAnsweredCalls':_0x3ac9ae[_0x5406('0x65')],'predictiveIntervalAvgHoldtime':_0x3ac9ae[_0x5406('0x66')],'predictiveIntervalAvgTalktime':_0x3ac9ae['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x3ac9ae['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x3ac9ae[_0x5406('0x67')],'predictiveIntervalErlangCalls':_0x3ac9ae[_0x5406('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0x3ac9ae[_0x5406('0x69')],'predictiveIntervalHitRate':_0x3ac9ae[_0x5406('0x6a')],'predictiveIntervalMultiplicativeFactor':_0x3ac9ae[_0x5406('0x6b')],'predictiveIntervalPauses':_0x3ac9ae[_0x5406('0x6c')],'predictiveIntervalAvailable':_0x3ac9ae[_0x5406('0x6d')],'predictiveIntervalTotalCalls':_0x3ac9ae[_0x5406('0x6e')],'message':_0x3ac9ae[_0x5406('0x42')],'originated':_0x3ac9ae[_0x5406('0x6f')],'erlangCalls':_0x3ac9ae[_0x5406('0x70')],'erlangCallToSecond':_0x3ac9ae[_0x5406('0x71')],'erlangAbandonmentRate':_0x3ac9ae[_0x5406('0x72')],'erlangBusyFactor':_0x3ac9ae[_0x5406('0x73')],'startPredictive':_0x3ac9ae[_0x5406('0x28')],'startProgressive':_0x3ac9ae['startProgressive']};if(_0x3ac9ae[_0x5406('0x74')]){_0x95da62['Trunk']={'id':_0x3ac9ae[_0x5406('0x74')]['id'],'name':_0x3ac9ae[_0x5406('0x74')]['name'],'active':_0x3ac9ae['Trunk'][_0x5406('0x75')],'callerid':_0x3ac9ae[_0x5406('0x74')][_0x5406('0x76')]};}if(_0x3ac9ae[_0x5406('0x46')]){_0x95da62[_0x5406('0x46')]={'id':_0x3ac9ae['Interval']['id'],'name':_0x3ac9ae[_0x5406('0x46')][_0x5406('0x44')]};}var _0x1cc5d5=md5(JSON['stringify'](_0x95da62));if(_0x3ac9ae[_0x5406('0x1')]!==_0x1cc5d5){_0x3ac9ae[_0x5406('0x1')]=_0x1cc5d5;emit(util[_0x5406('0x77')](_0x5406('0x78'),_0x95da62['name']),_0x5406('0x79'),_0x95da62);}}}function emitCampaignSummary(_0x1b1475){if(_0x1b1475[_0x5406('0x53')]==='ivr'){emit(util[_0x5406('0x77')]('campaign:ivr:%s',_0x1b1475[_0x5406('0x44')]),'campaign:save',_0x1b1475);}}function checkGetDataPredictive(_0x12e39e){if(isNotNull(_0x12e39e)&&!_['isEmpty'](_0x12e39e)){loggerPredictive[_0x5406('0x7a')](_0x5406('0x7b'));loggerPredictive[_0x5406('0x7a')](_0x5406('0x7c'),_0x12e39e[_0x5406('0x6e')]);loggerPredictive[_0x5406('0x7a')](_0x5406('0x7d'),_0x12e39e[_0x5406('0x65')]);loggerPredictive[_0x5406('0x7a')](_0x5406('0x7e'),_0x12e39e[_0x5406('0x67')]);loggerPredictive[_0x5406('0x7a')](_0x5406('0x7f'),_0x12e39e[_0x5406('0x80')]);loggerPredictive[_0x5406('0x7a')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x12e39e[_0x5406('0x66')]);loggerPredictive['info'](_0x5406('0x81'),_0x12e39e[_0x5406('0x82')]);loggerPredictive[_0x5406('0x7a')](_0x5406('0x83'));if(_0x12e39e['predictiveIntervalTotalCalls']>0x0){if(!_[_0x5406('0x41')](_0x12e39e[_0x5406('0x82')])&&_0x12e39e[_0x5406('0x82')]>0x0){return!![];}loggerPredictive[_0x5406('0x7a')](_0x5406('0x84'));if(!_[_0x5406('0x41')](_0x12e39e['predictiveIntervalAvgHoldtime'])&&_0x12e39e[_0x5406('0x66')]>0x0){return!![];}loggerPredictive[_0x5406('0x7a')](_0x5406('0x85'));}else{loggerPredictive[_0x5406('0x7a')](_0x5406('0x86'));}}else{loggerPredictive[_0x5406('0x7a')](_0x5406('0x87'));}return![];}function mergeDataErlangB(_0x58771e){return function(_0x4702f4){loggerPredictive[_0x5406('0x7a')](_0x5406('0x88'));loggerPredictive[_0x5406('0x7a')](_0x5406('0x89'),_0x4702f4[_0x5406('0x70')]);loggerPredictive[_0x5406('0x7a')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4702f4[_0x5406('0x71')]);loggerPredictive['info'](_0x5406('0x8a'),_0x4702f4[_0x5406('0x72')]);loggerPredictive[_0x5406('0x7a')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4702f4[_0x5406('0x73')]);loggerPredictive[_0x5406('0x7a')](_0x5406('0x8a'),_0x4702f4[_0x5406('0x72')]);loggerPredictive[_0x5406('0x7a')](_0x5406('0x83'));_['merge'](_0x58771e,_0x4702f4);};}function getDiff(_0x17c4cd){var _0x333f07=moment()[_0x5406('0x4b')](0x0);var _0x102a53=moment(_0x17c4cd)[_0x5406('0x4b')](0x0);return _0x333f07['diff'](_0x102a53,'seconds');}function ifInterval(_0x31dc95,_0x2f16f3){if(_['isUndefined'](_0x2f16f3)){return![];}return getDiff(_0x2f16f3)<_0x31dc95*0x3c;}function freeVariablesPredictive(_0x4f6136){if(isNotNull(_0x4f6136)){if(!_[_0x5406('0x41')](_0x4f6136[_0x5406('0x29')])){_0x4f6136[_0x5406('0x29')]=undefined;loggerPredictive[_0x5406('0x7a')](_0x4f6136[_0x5406('0x44')],_0x5406('0x8b'));}if(!_[_0x5406('0x41')](_0x4f6136['startPredictive'])){_0x4f6136[_0x5406('0x28')]=undefined;loggerPredictive[_0x5406('0x7a')](_0x4f6136[_0x5406('0x44')],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0x4f6136[_0x5406('0x8c')])){clearInterval(_0x4f6136[_0x5406('0x8c')]);_0x4f6136[_0x5406('0x8c')]=undefined;loggerPredictive['info'](_0x4f6136[_0x5406('0x44')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x1e52df,_0x4dba05){if(_0x4dba05===0x0){return 0x0;}var _0x1edec4=0x1;for(var _0x2a1a18=0x1;_0x2a1a18<=_0x4dba05;_0x2a1a18+=0x1){_0x1edec4=0x1+_0x1edec4*_0x2a1a18/_0x1e52df;}return 0x1/_0x1edec4;}function isVoiceQueueOutbound(_0x534e78){return _0x534e78===_0x5406('0x8d');}function isNotPreview(_0x5d61a8){return _0x5d61a8!=='preview';}function isCampaignIvr(_0x2bc846){return _0x2bc846===_0x5406('0x8e');}function getCallerId(_0x4d8553,_0x41f142,_0x5b389e){if(!_['isUndefined'](_0x5b389e)&&typeof _0x5b389e==='string'&&!_['isEmpty'](_0x5b389e)){if(!_[_0x5406('0x41')](_0x41f142)&&typeof _0x41f142===_0x5406('0x8f')&&!_[_0x5406('0x49')](_0x41f142)){return util[_0x5406('0x77')](_0x5406('0x90'),_0x41f142,_0x5b389e);}return util[_0x5406('0x77')]('\x22%s\x22\x20<%s>',_0x5b389e,_0x5b389e);}if(!_[_0x5406('0x41')](_0x4d8553)&&typeof _0x4d8553===_0x5406('0x8f')&&!_[_0x5406('0x49')](_0x4d8553)){return _0x4d8553;}return _0x5406('0x91');}function loggerCatchQueueSummary(_0x254c3e,_0x524bc3){return function(_0x38bb72){freeVariablesPredictive(_0x524bc3);emitVoiceQueueSummary(_0x524bc3);emitCampaignSummary(_0x524bc3);loggerSyncQueueSummary['error'](_0x254c3e,util['inspect'](_0x38bb72,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x287fdf,_0x3ee1bb){return function(_0x331db0){loggerPredictive['error'](_0x3ee1bb[_0x5406('0x44')],_0x287fdf);loggerPredictive[_0x5406('0x92')](_0x331db0[_0x5406('0x93')]);freeVariablesPredictive(_0x3ee1bb);};}function loggerCatch(_0x4267db){return function(_0x5e52b3){logger['error'](_0x4267db,util[_0x5406('0x94')](_0x5e52b3,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3fee55){return _0x3fee55&&!_[_0x5406('0x41')](_0x3fee55)&&_0x3fee55[_0x5406('0x95')]>0x0;}function decremetOriginate(_0x751cf4){if(!_[_0x5406('0x41')](_0x751cf4)&&_0x751cf4!==null){if(typeof _0x751cf4[_0x5406('0x6f')]!=='undefined'){if(_0x751cf4[_0x5406('0x6f')]>0x0){_0x751cf4[_0x5406('0x6f')]-=0x1;}else{logger[_0x5406('0x92')](_0x5406('0x96'));}}}else{logger[_0x5406('0x92')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0xf9da3a,_0x36e143,_0x14ab54){if(_0x36e143>_0x14ab54){for(var _0x32af02=0x0;_0x32af02<_0x36e143-_0x14ab54;_0x32af02+=0x1){decremetOriginate(_0xf9da3a);}}}function loggerGetContactDialer(_0x1a2c1f,_0x5ef1f9,_0x4b124b){return function(_0x3314de){checkContactLowerLimitOriginate(_0x5ef1f9,_0x4b124b,0x0);logger[_0x5406('0x92')](_0x1a2c1f,util['inspect'](_0x3314de,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x211eb7){return function(_0x655fca){if(isNotNull(_0x655fca)&&isNotNull(_0x655fca[0x0])){if(_0x655fca[0x0][_0x5406('0x97')]>0x0){_0x211eb7[_0x5406('0x42')]=_0x5406('0x98');logger[_0x5406('0x7a')](_0x5406('0x99')+_0x211eb7[_0x5406('0x44')],_0x655fca[0x0][_0x5406('0x97')],_0x5406('0x9a'));}else{_0x211eb7[_0x5406('0x42')]=_0x5406('0x9b');logger[_0x5406('0x7a')](_0x5406('0x9c')+_0x211eb7[_0x5406('0x44')]);}}};}function notSendMessagesQueue(_0x13d71a){if(_0x13d71a[_0x5406('0x9d')]){freeVariablesPredictive(_0x13d71a);if(_0x13d71a[_0x5406('0x6f')]===0x0&&_0x13d71a[_0x5406('0x51')]===0x0&&_0x13d71a[_0x5406('0x9e')]===0x0&&(_0x13d71a['pTalking']||0x0)===0x0){_0x13d71a[_0x5406('0x9d')]=![];_0x13d71a['available']=0x0;_0x13d71a[_0x5406('0x42')]=_0x5406('0x45');loggerSyncQueueSummary[_0x5406('0x92')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x13d71a[_0x5406('0x44')],'is\x20not\x20active');}else{_0x13d71a['message']=_0x5406('0x9f');loggerSyncQueueSummary[_0x5406('0x92')](_0x5406('0xa0'),_0x13d71a[_0x5406('0x44')],_0x5406('0xa1'));}emitVoiceQueueSummary(_0x13d71a);}}function notSendMessagesCampaign(_0x5d06ff){if(_0x5d06ff[_0x5406('0x9d')]){if(_0x5d06ff[_0x5406('0x6f')]===0x0){_0x5d06ff['sendMessageOneNotActive']=![];_0x5d06ff[_0x5406('0x42')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x5406('0x92')](_0x5406('0xa2'),_0x5d06ff[_0x5406('0x44')],_0x5406('0xa3'));}else{_0x5d06ff[_0x5406('0x42')]=_0x5406('0x9f');loggerSyncQueueSummary[_0x5406('0x92')](_0x5406('0xa2'),_0x5d06ff[_0x5406('0x44')],_0x5406('0xa1'));}emitCampaignSummary(_0x5d06ff);}}function createObjHistory(_0x2ae2df,_0x193e46,_0x3f83f7,_0x34e798,_0x11a634){_0x2ae2df[_0x5406('0x42')]=_0x3f83f7;var _0x46d38c=new Action(_0x2ae2df,_0x193e46);var _0x2c3711=new History(_0x46d38c);_0x2c3711[_0x5406('0xa4')]=_0x34e798;_0x2c3711[_0x5406('0xa5')]=_0x11a634;_0x2c3711['endtime']=_0x46d38c[_0x5406('0xa6')];return _0x2c3711;}Dialer[_0x5406('0x1b')]['loopClearZombieChannels']=function(){var _0x523c46=this;setInterval(function(){_0x523c46[_0x5406('0xa7')](_0x523c46[_0x5406('0x27')],_0x5406('0xa8'));_0x523c46[_0x5406('0xa7')](_0x523c46[_0x5406('0x25')],_0x5406('0xa9'));},0x32c8);};Dialer['prototype'][_0x5406('0xa7')]=function(_0x5ae9b6,_0x323870){var _0x5ab02f=this;for(var _0x5337e7 in _0x5ae9b6){if(typeof _0x5ae9b6[_0x5337e7]!==_0x5406('0xaa')){this[_0x5406('0xab')]['enqueue'](function(){if(!_[_0x5406('0xac')](_0x5ae9b6[_0x5337e7])){return ami[_0x5406('0xad')]({'action':'status','channel':_0x5ae9b6[_0x5337e7][_0x5406('0xae')]})[_0x5406('0xaf')](function(_0xc2209e){if(_0xc2209e['message']===_0x5406('0xb0')){setTimeout(function(){if(_0x5ae9b6[_0x5337e7]&&_0x5ae9b6[_0x5337e7][_0x5406('0x53')]!=='ivr'){_0x5ab02f['updateOriginated'](_0x5ab02f['voiceQueues'][_0x5ae9b6[_0x5337e7][_0x5406('0xb1')]]);logger[_0x5406('0x92')]('[Dialer][checkChannel]',_0x323870,_0x5337e7,_0x5ae9b6[_0x5337e7][_0x5406('0xb1')]);delete _0x5ae9b6[_0x5337e7];}if(_0x5ae9b6[_0x5337e7]&&_0x5ae9b6[_0x5337e7][_0x5406('0x53')]===_0x5406('0x8e')){_0x5ab02f[_0x5406('0xb2')](_0x5ab02f[_0x5406('0x21')][_0x5ae9b6[_0x5337e7][_0x5406('0xb1')]]);logger[_0x5406('0x92')]('[Dialer][checkChannel][ivr]',_0x323870,_0x5337e7,_0x5ae9b6[_0x5337e7][_0x5406('0xb1')]);delete _0x5ae9b6[_0x5337e7];}},0x2328);}});}});}}};Dialer['prototype']['countReScheduled']=function(_0x316ef5){return BPromise[_0x5406('0xb3')]()[_0x5406('0xb4')](cmHopper['countReScheduled'](_0x316ef5))[_0x5406('0xaf')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x5406('0x1b')][_0x5406('0xb5')]=function(_0x403aec){return BPromise['resolve']()[_0x5406('0xb4')](cmHopperBlack['checkIsBlackList'](_0x403aec))[_0x5406('0xaf')](loggerCatch(_0x5406('0xb6')));};Dialer['prototype'][_0x5406('0xb7')]=function(_0x1a0bdf){return BPromise[_0x5406('0xb3')]()[_0x5406('0xb4')](cmHopperBlack['checkIsBlackListIvr'](_0x1a0bdf))['catch'](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer['prototype'][_0x5406('0xb8')]=function(_0x1f9c89){return BPromise['resolve']()[_0x5406('0xb4')](cmHopperHistory[_0x5406('0xb9')](_0x1f9c89))['catch'](loggerCatch(_0x5406('0xba')));};Dialer[_0x5406('0x1b')][_0x5406('0xbb')]=function(_0x344d79){return BPromise[_0x5406('0xb3')]()[_0x5406('0xb4')](cmHopper['rescheduleContact'](_0x344d79))['catch'](loggerCatch(_0x5406('0xbc')));};Dialer[_0x5406('0x1b')][_0x5406('0xbd')]=function(_0x37529f,_0x58a9db,_0x4c4017){return BPromise['resolve']()[_0x5406('0xb4')](cmHopper[_0x5406('0xbd')](_0x37529f,_0x58a9db,_0x4c4017))['catch'](loggerCatch(_0x5406('0xbe')));};Dialer[_0x5406('0x1b')][_0x5406('0xbf')]=function(_0x5e6c8f,_0x4ef7fa,_0x32515f,_0x1279d0,_0x30de12){return BPromise['resolve']()['then'](cmHopper[_0x5406('0xbf')](_0x5e6c8f,_0x4ef7fa,_0x32515f,_0x1279d0))[_0x5406('0xaf')](function(_0x1646da){_0x30de12[_0x5406('0xc0')]-=_0x32515f;_0x30de12[_0x5406('0xc0')]=_0x30de12['temp']>0x0?_0x30de12[_0x5406('0xc0')]:0x0;loggerCatch(_0x5406('0xc1'))(_0x1646da);});};Dialer[_0x5406('0x1b')][_0x5406('0xc2')]=function(_0xb45063,_0x1215de,_0x42aff7,_0xcfc136){return BPromise['resolve']()[_0x5406('0xb4')](cmHopper[_0x5406('0xc2')](_0xb45063,_0x1215de,_0x42aff7))['catch'](function(_0x436852){_0xcfc136[_0x5406('0xc0')]-=_0x1215de;_0xcfc136['temp']=_0xcfc136[_0x5406('0xc0')]>0x0?_0xcfc136[_0x5406('0xc0')]:0x0;loggerCatch(_0x5406('0xc3'))(_0x436852);});};Dialer[_0x5406('0x1b')][_0x5406('0xc4')]=function(_0x46726b){return BPromise[_0x5406('0xb3')]()['then'](voiceQueueRt[_0x5406('0xc4')](_0x46726b))[_0x5406('0xaf')](loggerCatch(_0x5406('0xc5')));};Dialer[_0x5406('0x1b')][_0x5406('0xc6')]=function(_0x1efdc3){return BPromise[_0x5406('0xb3')]()[_0x5406('0xb4')](cmHopper[_0x5406('0xc6')](_0x1efdc3))[_0x5406('0xaf')](loggerCatch(_0x5406('0xc7')));};Dialer['prototype']['createHistory']=function(_0x2c02d6){return BPromise['resolve']()[_0x5406('0xb4')](cmHopperHistory[_0x5406('0xc8')](_0x2c02d6))[_0x5406('0xaf')](loggerCatch('[createHistory]\x20'));};Dialer[_0x5406('0x1b')]['updateOriginated']=function(_0x1db05e){if(!_[_0x5406('0x41')](_0x1db05e)&&_0x1db05e!==null){if(typeof _0x1db05e[_0x5406('0x6f')]!==_0x5406('0xaa')){if(_0x1db05e[_0x5406('0x6f')]>0x0){_0x1db05e[_0x5406('0x6f')]-=0x1;}else{logger[_0x5406('0x92')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x5406('0x92')](_0x5406('0xc9'));}};Dialer['prototype']['loggerHandler']=function(_0x698c19,_0x1a0d26){var _0xfc185=this;return function(_0x5498b2){_0xfc185[_0x5406('0xb2')](_0x1a0d26);logger[_0x5406('0x92')](_0x698c19,util[_0x5406('0x94')](_0x5498b2,{'showHidden':![],'depth':null}));};};Dialer[_0x5406('0x1b')]['emptyContact']=function(_0x44aa5f,_0x2b0fb1,_0x21f6a3){var _0x4a535d={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x2b0fb1);this['saveInDb'](_[_0x5406('0xca')](_0x4a535d,_[_0x5406('0xcb')](_0x21f6a3,['ContactId',_0x5406('0xcc'),'UserId','VoiceQueueId','CampaignId'])),_0x5406('0xcd'),_0x5406('0xce'));logger['error'](_0x44aa5f);};Dialer[_0x5406('0x1b')][_0x5406('0xcf')]=function(_0x56df32){return _0x56df32===_0x5406('0xd0');};Dialer['prototype'][_0x5406('0xd1')]=function(_0x958017){return!_[_0x5406('0x41')](_0x958017)&&_0x958017&&!_[_0x5406('0x41')](_0x958017[_0x5406('0x44')])&&!_['isUndefined'](_0x958017[_0x5406('0x75')])&&_0x958017[_0x5406('0x75')]&&(this[_0x5406('0x23')][util[_0x5406('0x77')](_0x5406('0xd2'),_0x958017[_0x5406('0x44')])][_0x5406('0xd3')]==='reachable'||this[_0x5406('0x23')][util[_0x5406('0x77')](_0x5406('0xd2'),_0x958017[_0x5406('0x44')])][_0x5406('0xd3')]===_0x5406('0xd4'));};Dialer['prototype']['saveInDb']=function(_0x3a4d41,_0x5018fb,_0x8fcb90){this['createHistory'](_0x3a4d41)['catch'](loggerCatch(_0x5018fb));this[_0x5406('0xc6')](_0x3a4d41)['catch'](loggerCatch(_0x8fcb90));};Dialer[_0x5406('0x1b')]['syncVarSet']=function(_0x334d09){var _0x52f4ac=this[_0x5406('0x27')][_0x334d09['uniqueid']];var _0x257511;if(!_[_0x5406('0xac')](_0x334d09)&&!_['isNil'](_0x334d09[_0x5406('0xd5')])&&!_[_0x5406('0xac')](_0x334d09[_0x5406('0xd5')][_0x5406('0xd6')])&&_0x334d09[_0x5406('0xd7')]===_0x5406('0xd8')&&_0x52f4ac){if(_0x52f4ac[_0x5406('0x53')]!==_0x5406('0x8e')&&this['voiceQueues'][_0x52f4ac[_0x5406('0xb1')]][_0x5406('0xd9')]&&_0x334d09[_0x5406('0xda')]===_0x5406('0xdb')){delete this['uniqueId'][_0x334d09['uniqueid']];this[_0x5406('0xb2')](this[_0x5406('0x20')][_0x52f4ac[_0x5406('0xb1')]]);this[_0x5406('0x20')][_0x52f4ac[_0x5406('0xb1')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x52f4ac[_0x5406('0xb1')]]['outboundAnswerAgiCallsDay']+=0x1;_0x257511=new Hangup(_0x52f4ac,_0x334d09);_0x257511[_0x5406('0xa4')]=0x12;_0x257511['statedesc']=_0x5406('0xdc');_0x257511[_0x5406('0xdd')]=_0x5406('0xde');ami[_0x5406('0x4c')](_0x5406('0xdf'),ut[_0x5406('0xe0')](_0x257511,_0x5406('0xe1')));this[_0x5406('0xe2')](_0x257511,_0x5406('0xe3'),'[syncHangupInAMD]');}if(_0x52f4ac[_0x5406('0x53')]!==_0x5406('0x8e')&&this[_0x5406('0x20')][_0x52f4ac[_0x5406('0xb1')]][_0x5406('0xd9')]&&_0x334d09[_0x5406('0xda')]==='MACHINE'){var _0x48185f=this;return new BPromise(function(_0x37ba54,_0x475590){delete _0x48185f[_0x5406('0x27')][_0x334d09['uniqueid']];_0x48185f['updateOriginated'](_0x48185f[_0x5406('0x20')][_0x52f4ac['queue']]);_0x48185f[_0x5406('0x20')][_0x52f4ac['queue']][_0x5406('0xe4')]+=0x1;_0x48185f['voiceQueues'][_0x52f4ac['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x363792=_0x48185f[_0x5406('0x20')][_0x52f4ac[_0x5406('0xb1')]];var _0x30d506=new Hangup(_0x52f4ac,_0x334d09);_0x30d506['state']=0x13;_0x30d506[_0x5406('0xa5')]=_0x5406('0xe5');_0x30d506[_0x5406('0xdd')]=_0x5406('0xde');_0x30d506[_0x5406('0xe6')]+=0x1;_0x30d506[_0x5406('0xe7')]+=0x1;_0x30d506[_0x5406('0xe1')]=!![];ami[_0x5406('0x4c')](_0x5406('0xdf'),ut['buildObj'](_0x30d506,_0x5406('0xe1')));_0x48185f[_0x5406('0xc8')](_0x30d506)[_0x5406('0xaf')](loggerCatch(_0x5406('0xe8')));if(_0x30d506[_0x5406('0xe9')]+_0x30d506[_0x5406('0xea')]+_0x30d506[_0x5406('0xeb')]+_0x30d506[_0x5406('0xec')]+_0x30d506[_0x5406('0xed')]+_0x30d506['countabandonedretry']+_0x30d506[_0x5406('0xe6')]+_0x30d506[_0x5406('0xee')]>=_0x363792[_0x5406('0xef')]){_0x48185f['stateGlobal'](_0x30d506,_0x37ba54,_0x475590,_0x5406('0xf0'));}else{if(_0x30d506[_0x5406('0xe6')]>=_0x363792['dialMachineMaxRetry']){_0x48185f[_0x5406('0xf1')](_0x30d506,_0x37ba54,_0x475590,'reason\x2019\x20machine....');}else{_0x48185f[_0x5406('0xbb')]({'active':![],'countmachineretry':_0x30d506[_0x5406('0xe6')],'scheduledat':moment()[_0x5406('0xf2')](_0x363792['dialMachineRetryFrequency'],_0x5406('0xf3'))[_0x5406('0x77')](_0x5406('0xf4')),'ContactId':_0x30d506[_0x5406('0xf5')],'ListId':_0x30d506[_0x5406('0xcc')],'VoiceQueueId':_0x30d506['VoiceQueueId']||undefined,'CampaignId':_0x30d506['CampaignId']||undefined})['catch'](loggerCatch(_0x5406('0xf6')));_0x37ba54({'reschedule':0x1});}}});}if(_0x52f4ac['type']==='ivr'&&this[_0x5406('0x21')][_0x52f4ac[_0x5406('0xb1')]]['dialAMDActive']&&_0x334d09[_0x5406('0xda')]===_0x5406('0xdb')){delete this[_0x5406('0x27')][_0x334d09[_0x5406('0xf7')]];this[_0x5406('0xb2')](this[_0x5406('0x21')][_0x52f4ac[_0x5406('0xb1')]]);_0x257511=new Hangup(_0x52f4ac,_0x334d09);_0x257511[_0x5406('0xa4')]=0x12;_0x257511[_0x5406('0xa5')]='HangupInAMD';_0x257511[_0x5406('0xdd')]=_0x5406('0xde');ami['emit'](_0x5406('0xdf'),ut['buildObj'](_0x257511,_0x5406('0xe1')));this[_0x5406('0xe2')](_0x257511,_0x5406('0xf8'),'[syncHangupInAMDIvr]');}if(_0x52f4ac[_0x5406('0x53')]===_0x5406('0x8e')&&this[_0x5406('0x21')][_0x52f4ac[_0x5406('0xb1')]][_0x5406('0xd9')]&&_0x334d09[_0x5406('0xda')]===_0x5406('0xf9')){var _0x48185f=this;return new BPromise(function(_0x579aa5,_0x2ba4ce){delete _0x48185f[_0x5406('0x27')][_0x334d09['uniqueid']];_0x48185f[_0x5406('0xb2')](_0x48185f[_0x5406('0x21')][_0x52f4ac[_0x5406('0xb1')]]);_0x48185f['campaigns'][_0x52f4ac[_0x5406('0xb1')]]['outboundAnswerCallsDay']+=0x1;_0x48185f[_0x5406('0x21')][_0x52f4ac[_0x5406('0xb1')]][_0x5406('0x5d')]+=0x1;var _0x346d17=_0x48185f[_0x5406('0x21')][_0x52f4ac[_0x5406('0xb1')]];var _0x42e35f=new Hangup(_0x52f4ac,_0x334d09);_0x42e35f['state']=0x13;_0x42e35f['statedesc']=_0x5406('0xe5');_0x42e35f[_0x5406('0xdd')]=_0x5406('0xde');_0x42e35f['countmachineretry']+=0x1;_0x42e35f['countglobal']+=0x1;_0x42e35f['amd']=!![];ami['emit'](_0x5406('0xdf'),ut['buildObj'](_0x42e35f,_0x5406('0xe1')));_0x48185f[_0x5406('0xc8')](_0x42e35f)['catch'](loggerCatch(_0x5406('0xe8')));if(_0x42e35f[_0x5406('0xe9')]+_0x42e35f['countcongestionretry']+_0x42e35f[_0x5406('0xeb')]+_0x42e35f[_0x5406('0xec')]+_0x42e35f[_0x5406('0xed')]+_0x42e35f['countabandonedretry']+_0x42e35f[_0x5406('0xe6')]+_0x42e35f['countagentrejectretry']>=_0x346d17['dialGlobalMaxRetry']){_0x48185f[_0x5406('0xfa')](_0x42e35f,_0x579aa5,_0x2ba4ce,_0x5406('0xf0'));}else{if(_0x42e35f['countmachineretry']>=_0x346d17[_0x5406('0xfb')]){_0x48185f[_0x5406('0xf1')](_0x42e35f,_0x579aa5,_0x2ba4ce,'reason\x2019\x20machine....');}else{_0x48185f[_0x5406('0xbb')]({'active':![],'countmachineretry':_0x42e35f[_0x5406('0xe6')],'scheduledat':moment()['add'](_0x346d17[_0x5406('0xfc')],_0x5406('0xf3'))[_0x5406('0x77')](_0x5406('0xf4')),'ContactId':_0x42e35f[_0x5406('0xf5')],'ListId':_0x42e35f[_0x5406('0xcc')],'VoiceQueueId':_0x42e35f['VoiceQueueId']||undefined,'CampaignId':_0x42e35f['CampaignId']||undefined})[_0x5406('0xaf')](loggerCatch(_0x5406('0xf6')));_0x579aa5({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x5406('0x38')]=function(_0x3b0606){var _0x555ab8=this['uniqueId'][_0x3b0606['uniqueid']];var _0x58c886=this;var _0x39f37a;if(_0x555ab8&&_0x555ab8[_0x5406('0x53')]===_0x5406('0x8e')){delete this[_0x5406('0x27')][_0x3b0606[_0x5406('0xf7')]];this[_0x5406('0xb2')](this['campaigns'][_0x555ab8[_0x5406('0xb1')]]);this['campaigns'][_0x555ab8[_0x5406('0xb1')]][_0x5406('0xfd')]+=0x1;_0x39f37a=new Hangup(_0x555ab8,_0x3b0606);this[_0x5406('0xc8')](_0x39f37a)[_0x5406('0xaf')](loggerCatch(_0x5406('0xfe')));this[_0x5406('0xc6')](_0x39f37a)['catch'](loggerCatch(_0x5406('0xff')));}if(_0x555ab8&&_0x555ab8[_0x5406('0x53')]!==_0x5406('0x8e')&&isNotNull(this[_0x5406('0x20')][_0x555ab8['queue']][_0x5406('0x100')])){delete this[_0x5406('0x27')][_0x3b0606[_0x5406('0xf7')]];this[_0x5406('0xb2')](this['voiceQueues'][_0x555ab8['queue']]);this[_0x5406('0x20')][_0x555ab8[_0x5406('0xb1')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x555ab8['queue']][_0x5406('0x5d')]+=0x1;_0x39f37a=new Hangup(_0x555ab8,_0x3b0606);_0x39f37a[_0x5406('0xa4')]=0x10;_0x39f37a[_0x5406('0xa5')]='AnswerAGI';_0x39f37a[_0x5406('0xdd')]=_0x5406('0x101');this[_0x5406('0xc8')](_0x39f37a)['catch'](loggerCatch(_0x5406('0xfe')));this[_0x5406('0xc6')](_0x39f37a)[_0x5406('0xaf')](loggerCatch(_0x5406('0xff')));}if(_0x555ab8&&_0x555ab8[_0x5406('0x53')]!==_0x5406('0x8e')&&!isNotNull(this[_0x5406('0x20')][_0x555ab8[_0x5406('0xb1')]]['dialQueueProject'])){delete this[_0x5406('0x27')][_0x3b0606['uniqueid']];this[_0x5406('0xb2')](this[_0x5406('0x20')][_0x555ab8[_0x5406('0xb1')]]);this[_0x5406('0x20')][_0x555ab8[_0x5406('0xb1')]][_0x5406('0x64')]+=0x1;_0x39f37a=new Hangup(_0x555ab8,_0x3b0606);_0x39f37a[_0x5406('0xa4')]=0xc;_0x39f37a[_0x5406('0xa5')]=_0x3b0606[_0x5406('0x102')];_0x39f37a['membername']=_0x5406('0x103');this['createHistory'](_0x39f37a)['catch'](loggerCatch(_0x5406('0xfe')));this[_0x5406('0xc6')](_0x39f37a)[_0x5406('0xaf')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x5406('0x1b')][_0x5406('0x34')]=function(_0x4c9307){var _0x4d78f3=this[_0x5406('0x27')][_0x4c9307['uniqueid']];var _0xbfcd9b=this;if(this[_0x5406('0x20')][_0x4c9307[_0x5406('0xb1')]]){if(_0x4d78f3&&_0x4d78f3[_0x5406('0x53')]!=='ivr'){delete this[_0x5406('0x27')][_0x4c9307[_0x5406('0xf7')]];this[_0x5406('0x20')][_0x4c9307[_0x5406('0xb1')]]['outboundAnswerCallsDay']+=0x1;var _0x361ae0=new AgentComplete(_0x4d78f3,_0x4c9307);if(_0x4c9307['reason']===_0x5406('0x104')){_0x361ae0[_0x5406('0x105')]=this[_0x5406('0x20')][_0x4c9307[_0x5406('0xb1')]][_0x5406('0x106')]&&this[_0x5406('0x20')][_0x4c9307['queue']][_0x5406('0x107')]?moment()[_0x5406('0x77')](_0x5406('0xf4')):undefined;}this['createHistory'](_0x361ae0)['catch'](loggerCatch(_0x5406('0x108')));this['moveContactManagedDialer'](_0x361ae0)[_0x5406('0xaf')](loggerCatch(_0x5406('0x109')));}}};Dialer[_0x5406('0x1b')]['syncAgentConnect']=function(_0x21bb6a){if(this[_0x5406('0x20')][_0x21bb6a[_0x5406('0xb1')]]){if(this['uniqueId'][_0x21bb6a[_0x5406('0xf7')]]&&this['uniqueId'][_0x21bb6a[_0x5406('0xf7')]][_0x5406('0x53')]!==_0x5406('0x8e')){this[_0x5406('0xb2')](this[_0x5406('0x20')][_0x21bb6a[_0x5406('0xb1')]]);this['uniqueId'][_0x21bb6a[_0x5406('0xf7')]][_0x5406('0x10a')]=moment()[_0x5406('0x77')](_0x5406('0xf4'));}}};Dialer[_0x5406('0x1b')][_0x5406('0x10b')]=function(_0x29e5e1){this[_0x5406('0xc8')](_0x29e5e1)[_0x5406('0xaf')](loggerCatch(_0x5406('0x108')));this[_0x5406('0xc6')](_0x29e5e1)[_0x5406('0xaf')](loggerCatch(_0x5406('0x10c')));};Dialer[_0x5406('0x1b')][_0x5406('0x30')]=function(_0x348e4e){var _0x497d4f=this[_0x5406('0x27')][_0x348e4e[_0x5406('0xf7')]];var _0x17a8be=this;if(this[_0x5406('0x20')][_0x348e4e[_0x5406('0xb1')]]){if(_0x497d4f&&_0x497d4f[_0x5406('0x53')]!=='ivr'){delete this[_0x5406('0x27')][_0x348e4e['uniqueid']];this[_0x5406('0xb2')](this[_0x5406('0x20')][_0x348e4e[_0x5406('0xb1')]]);_0x497d4f[_0x5406('0x10d')]=moment()[_0x5406('0x77')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1a6236=new QueueCallerAbandon(_0x497d4f,_0x348e4e);if(getSeconds(_0x497d4f[_0x5406('0x10d')],_0x497d4f[_0x5406('0x10e')])>=_0x497d4f[_0x5406('0x10f')]){this['voiceQueues'][_0x348e4e[_0x5406('0xb1')]][_0x5406('0x67')]+=0x1;this[_0x5406('0x20')][_0x348e4e[_0x5406('0xb1')]][_0x5406('0x110')]+=0x1;this[_0x5406('0x20')][_0x348e4e[_0x5406('0xb1')]][_0x5406('0x69')]+=0x1;_0x1a6236[_0x5406('0xa4')]=0xa;_0x1a6236[_0x5406('0xa5')]=_0x5406('0x111');_0x1a6236['dropreason']='TIMEOUT';_0x1a6236['agiafterat']=this[_0x5406('0x20')][_0x348e4e[_0x5406('0xb1')]][_0x5406('0x106')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x1a6236[_0x5406('0xed')]+=0x1;_0x1a6236[_0x5406('0xe7')]+=0x1;if(_0x1a6236[_0x5406('0xed')]>=this[_0x5406('0x20')][_0x348e4e[_0x5406('0xb1')]][_0x5406('0x112')]){this[_0x5406('0x10b')](_0x1a6236);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x1a6236['countdropretry'],'scheduledat':moment()[_0x5406('0xf2')](this['voiceQueues'][_0x348e4e['queue']][_0x5406('0x113')],_0x5406('0xf3'))[_0x5406('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x497d4f[_0x5406('0xf5')],'ListId':_0x497d4f[_0x5406('0xcc')],'VoiceQueueId':_0x497d4f[_0x5406('0x114')]||undefined,'CampaignId':_0x497d4f[_0x5406('0x115')]||undefined})[_0x5406('0xaf')](loggerCatch('[rescheduleContact][Drop]'));var _0x1554dc=new History(_0x1a6236);_0x1554dc[_0x5406('0xa4')]=0xa;_0x1554dc['statedesc']=_0x5406('0x111');_0x1554dc['starttime']=moment()[_0x5406('0x77')]('YYYY-MM-DD\x20HH:mm:ss');_0x1554dc[_0x5406('0x116')]=_0x1554dc['starttime'];_0x1554dc[_0x5406('0x117')]=_0x1a6236[_0x5406('0x117')];_0x1554dc[_0x5406('0x118')]=_0x1a6236[_0x5406('0x118')];this[_0x5406('0xc8')](_0x1554dc)[_0x5406('0xaf')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x5406('0x20')][_0x348e4e[_0x5406('0xb1')]][_0x5406('0x80')]+=0x1;this[_0x5406('0x20')][_0x348e4e[_0x5406('0xb1')]][_0x5406('0x62')]+=0x1;_0x1a6236[_0x5406('0xa4')]=0xb;_0x1a6236[_0x5406('0xa5')]=_0x5406('0x119');_0x1a6236[_0x5406('0x11a')]='CALLEREXIT';_0x1a6236[_0x5406('0x11b')]+=0x1;_0x1a6236[_0x5406('0xe7')]+=0x1;if(_0x1a6236[_0x5406('0x11b')]>=this[_0x5406('0x20')][_0x348e4e[_0x5406('0xb1')]][_0x5406('0x11c')]){this[_0x5406('0x10b')](_0x1a6236);}else{this[_0x5406('0xbb')]({'active':![],'countabandonedretry':_0x1a6236[_0x5406('0x11b')],'scheduledat':moment()[_0x5406('0xf2')](this[_0x5406('0x20')][_0x348e4e['queue']][_0x5406('0x11d')],_0x5406('0xf3'))['format'](_0x5406('0xf4')),'ContactId':_0x497d4f[_0x5406('0xf5')],'ListId':_0x497d4f[_0x5406('0xcc')],'VoiceQueueId':_0x497d4f[_0x5406('0x114')]||undefined,'CampaignId':_0x497d4f[_0x5406('0x115')]||undefined})[_0x5406('0xaf')](loggerCatch(_0x5406('0x11e')));var _0x1554dc=new History(_0x1a6236);_0x1554dc['state']=0xb;_0x1554dc[_0x5406('0xa5')]=_0x5406('0x119');_0x1554dc[_0x5406('0xa6')]=moment()[_0x5406('0x77')](_0x5406('0xf4'));_0x1554dc['endtime']=_0x1554dc[_0x5406('0xa6')];_0x1554dc[_0x5406('0x117')]=_0x1a6236[_0x5406('0x117')];_0x1554dc['calleridnum']=_0x1a6236[_0x5406('0x118')];this[_0x5406('0xc8')](_0x1554dc)[_0x5406('0xaf')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x5406('0x1b')][_0x5406('0x3a')]=function(_0x5f15f8){if(this[_0x5406('0x25')][_0x5f15f8[_0x5406('0xf7')]]){this[_0x5406('0x25')][_0x5f15f8[_0x5406('0xf7')]]['channel']=_0x5f15f8[_0x5406('0xae')];}if(this[_0x5406('0x27')][_0x5f15f8[_0x5406('0xf7')]]){this[_0x5406('0x27')][_0x5f15f8[_0x5406('0xf7')]][_0x5406('0xae')]=_0x5f15f8[_0x5406('0xae')];}};Dialer[_0x5406('0x1b')][_0x5406('0x3e')]=function(_0xe3165f){if(strategy[this[_0x5406('0x20')][this[_0x5406('0x25')][_0xe3165f[_0x5406('0x11f')]]['queue']][_0x5406('0x4d')]]===_0x5406('0x1a')){if(this[_0x5406('0x25')][_0xe3165f[_0x5406('0x11f')]]&&_[_0x5406('0xac')](this[_0x5406('0x25')][_0xe3165f[_0x5406('0x11f')]][_0x5406('0x120')])&&_0xe3165f[_0x5406('0xd3')]==='1'&&_0xe3165f[_0x5406('0x121')]==='0'){if(this[_0x5406('0x22')][_0xe3165f[_0x5406('0x122')]]){if(!this['agents'][_0xe3165f[_0x5406('0x122')]]['locked']){this['agents'][_0xe3165f[_0x5406('0x122')]]['locked']=!![];this['actions'][_0xe3165f[_0x5406('0x11f')]][_0x5406('0x120')]=!![];this[_0x5406('0x25')][_0xe3165f[_0x5406('0x11f')]][_0x5406('0x122')]=_0xe3165f['stateinterface'];}}}}else if((strategy[this[_0x5406('0x20')][this['actions'][_0xe3165f[_0x5406('0x11f')]]['queue']][_0x5406('0x4d')]]||_0x5406('0x19'))==='rrmemory'){if(this[_0x5406('0x25')][_0xe3165f[_0x5406('0x11f')]]){if(this[_0x5406('0x22')][_0xe3165f[_0x5406('0x122')]]){this[_0x5406('0x25')][_0xe3165f['actionid']]['stateinterface']=_0xe3165f[_0x5406('0x122')];if(_[_0x5406('0xac')](this[_0x5406('0x2b')][this[_0x5406('0x25')][_0xe3165f[_0x5406('0x11f')]][_0x5406('0xb1')]])){this[_0x5406('0x2b')][this[_0x5406('0x25')][_0xe3165f[_0x5406('0x11f')]]['queue']]=[];}this['queueBooked'][this[_0x5406('0x25')][_0xe3165f[_0x5406('0x11f')]][_0x5406('0xb1')]][_0x5406('0x123')](_[_0x5406('0xca')](_['pick'](this[_0x5406('0x25')][_0xe3165f[_0x5406('0x11f')]],[_0x5406('0x124'),_0x5406('0x122')]),{'status':_0xe3165f[_0x5406('0xd3')],'paused':_0xe3165f[_0x5406('0x121')]}));}}}};function unlockQueueStatus(_0x24a7ff,_0x1b17fc){setTimeout(function(){if(_[_0x5406('0x41')](_0x24a7ff[_0x5406('0x125')])){loggerBooked[_0x5406('0x92')]('[unlockQueueStatus][undefined]',_0x1b17fc);}_0x24a7ff['queueStatusComplete']=!![];loggerBooked['info'](_0x5406('0x126'),_0x1b17fc,JSON[_0x5406('0x127')](_[_0x5406('0xcb')](_0x24a7ff,['name',_0x5406('0x125')])));},0x1f3);}Dialer[_0x5406('0x1b')][_0x5406('0x128')]=function(_0x1e40f1){var _0x44ce6a=this;var _0x2cf067=_0x44ce6a['voiceQueues'][_0x44ce6a[_0x5406('0x25')][_0x1e40f1['actionid']][_0x5406('0xb1')]];if(strategy[this[_0x5406('0x20')][this['actions'][_0x1e40f1[_0x5406('0x11f')]][_0x5406('0xb1')]][_0x5406('0x4d')]]===_0x5406('0x1a')){if(this[_0x5406('0x25')][_0x1e40f1['actionid']]&&this[_0x5406('0x25')][_0x1e40f1[_0x5406('0x11f')]][_0x5406('0x122')]){this[_0x5406('0x1f')][_0x5406('0x129')](this[_0x5406('0x25')][_0x1e40f1[_0x5406('0x11f')]][_0x5406('0x124')],this['actions'][_0x1e40f1[_0x5406('0x11f')]][_0x5406('0x122')])[_0x5406('0xaf')](function(_0xb57523){logger['error'](_0x5406('0x12a'),util[_0x5406('0x94')](_0xb57523,{'showHidden':![],'depth':null}));})['finally'](function(){_0x44ce6a[_0x5406('0xb2')](_0x44ce6a[_0x5406('0x20')][_0x44ce6a[_0x5406('0x25')][_0x1e40f1[_0x5406('0x11f')]]['queue']]);_0x44ce6a['agents'][_0x44ce6a[_0x5406('0x25')][_0x1e40f1['actionid']][_0x5406('0x122')]][_0x5406('0x120')]=![];delete _0x44ce6a['actions'][_0x1e40f1[_0x5406('0x11f')]];unlockQueueStatus(_0x2cf067);});}else{this['updateOriginated'](this[_0x5406('0x20')][this[_0x5406('0x25')][_0x1e40f1[_0x5406('0x11f')]]['queue']]);this[_0x5406('0xbb')]({'active':![],'ContactId':this['actions'][_0x1e40f1[_0x5406('0x11f')]]['ContactId'],'ListId':this[_0x5406('0x25')][_0x1e40f1[_0x5406('0x11f')]][_0x5406('0xcc')],'VoiceQueueId':this['actions'][_0x1e40f1[_0x5406('0x11f')]][_0x5406('0x114')]||undefined,'CampaignId':this[_0x5406('0x25')][_0x1e40f1[_0x5406('0x11f')]][_0x5406('0x115')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x5406('0x25')][_0x1e40f1[_0x5406('0x11f')]];unlockQueueStatus(_0x2cf067);}}else if((strategy[this['voiceQueues'][this[_0x5406('0x25')][_0x1e40f1[_0x5406('0x11f')]]['queue']][_0x5406('0x4d')]]||_0x5406('0x19'))===_0x5406('0x19')){var _0x166dd1;if(this[_0x5406('0x25')][_0x1e40f1[_0x5406('0x11f')]]&&!_[_0x5406('0x49')](this[_0x5406('0x2b')][this[_0x5406('0x25')][_0x1e40f1[_0x5406('0x11f')]][_0x5406('0xb1')]])){if(this[_0x5406('0x2c')][_0x44ce6a['actions'][_0x1e40f1[_0x5406('0x11f')]][_0x5406('0xb1')]]){this['queueBookedRR'][_0x44ce6a[_0x5406('0x25')][_0x1e40f1[_0x5406('0x11f')]]['queue']]=this[_0x5406('0x2c')][this[_0x5406('0x25')][_0x1e40f1[_0x5406('0x11f')]]['queue']]?this[_0x5406('0x2c')][this[_0x5406('0x25')][_0x1e40f1[_0x5406('0x11f')]][_0x5406('0xb1')]]:this[_0x5406('0x2b')][this[_0x5406('0x25')][_0x1e40f1[_0x5406('0x11f')]][_0x5406('0xb1')]]?this[_0x5406('0x2b')][this['actions'][_0x1e40f1[_0x5406('0x11f')]]['queue']][_0x5406('0x12b')]||0x0:0x0;}this[_0x5406('0x2b')][this[_0x5406('0x25')][_0x1e40f1[_0x5406('0x11f')]][_0x5406('0xb1')]]['_rr']=this['queueBookedRR'][this[_0x5406('0x25')][_0x1e40f1[_0x5406('0x11f')]][_0x5406('0xb1')]];for(var _0x1115e0=0x0;_0x1115e0=0x0;})['catch'](myreject(_0x5473cd)));}}else{_0x2b8e68[_0x5406('0x123')](ami[_0x5406('0xad')]({'action':'command','command':util[_0x5406('0x77')]('iftime\x20%s,%s',_0x19b674,!_['isUndefined'](config[_0x5406('0x141')][_0x5d6424])?_0x5d6424:'')})['then'](function(_0x3fb1db){return _0x3fb1db[_0x5406('0x146')][_0x5406('0x148')](_0x5406('0x147'))>=0x0;})[_0x5406('0xaf')](myreject(_0x5473cd)));}BPromise['all'](_0x2b8e68)[_0x5406('0xb4')](function(_0x1fed50){var _0x51d8bf=_[_0x5406('0x149')](_0x1fed50);if(_0x51d8bf){return _0x4ba0ee(_0x51d8bf);}else{_0x3c89e6[_0x5406('0x42')]=_0x31a318?'GLOBAL_INTERVAL_IS_OVERTIME':_0x5406('0x14a');return _0x5473cd(msgResponse(_0x5406('0x14b'),'Failure',_0x5406('0x14c')+_0x31a318+'\x20'+_0x50ce6b+'\x20Interval\x20is\x20overtime:\x20'+util[_0x5406('0x94')](_0x19b674,{'showHidden':![],'depth':null})+_0x5406('0x14d')+_0x5d6424));}})[_0x5406('0xaf')](function(_0xb15c82){return _0x5473cd(msgResponse(_0x5406('0x13b'),'Failure',JSON['stringify'](_0xb15c82)));});});};Dialer['prototype'][_0x5406('0x14e')]=function(_0x38d07d){var _0x1e6b51=this;return function(){switch(_0x38d07d['dialMethod']){case'progressive':freeVariablesPredictive(_0x38d07d);_0x1e6b51[_0x5406('0x14f')](_0x38d07d,0x1);break;case _0x5406('0x150'):freeVariablesPredictive(_0x38d07d);_0x1e6b51['handlePower'](_0x38d07d,_0x38d07d[_0x5406('0x151')]);break;case _0x5406('0x7'):_0x1e6b51[_0x5406('0x7')](_0x38d07d);break;case _0x5406('0x6'):freeVariablesPredictive(_0x38d07d);_0x1e6b51[_0x5406('0x14f')](_0x38d07d,0x1);break;default:freeVariablesPredictive(_0x38d07d);logger[_0x5406('0x92')](_0x5406('0x152'),_0x38d07d[_0x5406('0x44')],_0x5406('0x153'));}};};Dialer[_0x5406('0x1b')][_0x5406('0x154')]=function(_0x1b7d8e){var _0x6d0f43=this;return function(){_0x6d0f43['handleIvr'](_0x1b7d8e);};};Dialer['prototype'][_0x5406('0x36')]=function(_0x278f3b){var _0xaaf75e=this;if(isNotPreview(_0x278f3b[_0x5406('0x58')])){if(isVoiceQueueOutbound(_0x278f3b['type'])&&isActive(_0x278f3b['dialActive'])){_0x278f3b[_0x5406('0x9d')]=!![];BPromise[_0x5406('0xb3')]()[_0x5406('0xb4')](checkIsLoggedIn(_0x278f3b,_0x278f3b[_0x5406('0x4e')]))[_0x5406('0xb4')](checkIsActive(_0x278f3b,_0x278f3b[_0x5406('0x57')]))[_0x5406('0xb4')](checkInterval(_0x278f3b))['then'](_0xaaf75e[_0x5406('0x155')](_0x278f3b))[_0x5406('0xb4')](_0xaaf75e[_0x5406('0x13a')](_0x278f3b[_0x5406('0x156')],_0x278f3b['dialTimezone'],_0x278f3b[_0x5406('0x44')],_0x278f3b))['then'](_0xaaf75e['checkIfTimeIntervals'](_0x278f3b['Interval'],_0x278f3b[_0x5406('0x157')],_0x278f3b[_0x5406('0x44')],_0x278f3b))['then'](_0xaaf75e['checkDialMethod'](_0x278f3b))[_0x5406('0xaf')](loggerCatchQueueSummary(_0x5406('0x158'),_0x278f3b));}else{notSendMessagesQueue(_0x278f3b);}}else{freeVariablesPredictive(_0x278f3b);}};Dialer[_0x5406('0x1b')][_0x5406('0x136')]=function(){var _0x315425=this;var _0x34a3fc;for(var _0x5a5409 in this[_0x5406('0x21')]){if(typeof this['campaigns'][_0x5a5409]!==_0x5406('0xaa')){_0x34a3fc=this[_0x5406('0x21')][_0x5a5409];if(isCampaignIvr(_0x34a3fc['type'])&&isActive(_0x34a3fc[_0x5406('0x75')])){_0x34a3fc[_0x5406('0x9d')]=!![];BPromise['resolve']()[_0x5406('0xb4')](checkIsActive(_0x34a3fc,_0x34a3fc[_0x5406('0x75')]))[_0x5406('0xb4')](checkInterval(_0x34a3fc))[_0x5406('0xb4')](_0x315425[_0x5406('0x155')](_0x34a3fc))['then'](_0x315425[_0x5406('0x13a')](_0x34a3fc[_0x5406('0x156')],_0x34a3fc[_0x5406('0x157')],_0x34a3fc[_0x5406('0x44')],_0x34a3fc))[_0x5406('0xb4')](_0x315425[_0x5406('0x13c')](_0x34a3fc[_0x5406('0x46')],_0x34a3fc[_0x5406('0x157')],_0x34a3fc[_0x5406('0x44')],_0x34a3fc))[_0x5406('0xb4')](_0x315425[_0x5406('0x154')](_0x34a3fc))[_0x5406('0xaf')](loggerCatchQueueSummary('[syncCampaigns]',_0x34a3fc));}else{notSendMessagesCampaign(_0x34a3fc);}}}};function getCallerIdRandom(_0x227619,_0x23eb24){var _0x260563;var _0x152205;var _0x372a15;if(_0x23eb24<=0x0){_0x23eb24=0x1;}_0x260563=new RegExp(_0x5406('0x159')+_0x23eb24+'}$');_0x152205=Math[_0x5406('0x15a')](0xa,_0x23eb24-0x1);_0x372a15=Math[_0x5406('0x15a')](0xa,_0x23eb24)-0x1;return util[_0x5406('0x77')]('%s',_[_0x5406('0x15b')](_0x227619,_0x260563,_[_0x5406('0x15c')](_0x152205,_0x372a15)));}function extractCalleridName(_0x1a39a2){var _0x3af631=_0x1a39a2['match'](/"(.*?)"/);return _0x3af631?_0x3af631[0x1]:_0x1a39a2;}function extractCalleridNumber(_0x3f5e55){var _0x14d580=_0x3f5e55[_0x5406('0x15d')](/<(.*?)>/);return _0x14d580?_0x14d580[0x1]:_0x3f5e55;}Dialer['prototype']['actionOriginate']=function(_0x45d050,_0x4ea3b){var _0x5882b0=this;var _0x30f9fa=uuid['v4']();this[_0x5406('0x25')][_0x30f9fa]=new Action(_0x45d050,_0x4ea3b,_0x30f9fa);return new BPromise(function(_0x39605f,_0x34a943){if(_[_0x5406('0x41')](_0x45d050)&&typeof _0x45d050!=='object'){return _0x34a943(msgResponse(_0x5406('0x15e'),'Failure','voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x4ea3b[_0x5406('0x15f')][_0x5406('0x160')])||_0x4ea3b[_0x5406('0x15f')]['phone']===null){return _0x34a943(msgResponse(_0x5406('0x15e'),_0x5406('0x13d'),_0x5406('0x161')));}var _0x2352a1={'XMD-CALLERID':_0x5882b0[_0x5406('0x25')][_0x30f9fa][_0x5406('0x162')](),'XMD-AGI':_0x45d050[_0x5406('0x100')]?util[_0x5406('0x77')](_0x5406('0x163'),ipAgi,_0x45d050[_0x5406('0x100')]):_0x5406('0x164'),'XMD-AGIAFTER':_0x45d050[_0x5406('0x106')]?util[_0x5406('0x77')](_0x5406('0x163'),ipAgi,_0x45d050[_0x5406('0x106')]):_0x5406('0x164'),'XMD-QUEUE':_0x45d050[_0x5406('0x53')]===_0x5406('0x8d')?util[_0x5406('0x77')](_0x5406('0x165'),_0x45d050[_0x5406('0x44')],_0x45d050['dialQueueOptions']||'',_0x45d050[_0x5406('0x107')]?'c':'',_0x45d050['dialQueueTimeout']||0x3):_0x5406('0x164'),'XMD-CONTACTID':_0x4ea3b[_0x5406('0xf5')],'XMD-CDRTYPE':_0x5406('0x5'),'CALLERID(all)':_0x5882b0[_0x5406('0x25')][_0x30f9fa][_0x5406('0x162')](),'XMD-AMD':_0x45d050[_0x5406('0xd9')]?_0x5406('0x166'):_0x5406('0x164'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x45d050[_0x5406('0xd9')]){_0x2352a1['XMD-AMDINITIALSILENCE']=_0x45d050[_0x5406('0x167')]||0x9c4;_0x2352a1[_0x5406('0x168')]=_0x45d050[_0x5406('0x169')]||0x5dc;_0x2352a1[_0x5406('0x16a')]=_0x45d050[_0x5406('0x16b')]||0x320;_0x2352a1['XMD-AMDTOTALANALYSISTIME']=_0x45d050['dialAMDTotalAnalysisTime']||0x1388;_0x2352a1[_0x5406('0x16c')]=_0x45d050['dialAMDMinWordLength']||0x64;_0x2352a1[_0x5406('0x16d')]=_0x45d050[_0x5406('0x16e')]||0x32;_0x2352a1['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x45d050[_0x5406('0x16f')]||0x3;_0x2352a1[_0x5406('0x170')]=_0x45d050[_0x5406('0x171')]||0x100;_0x2352a1[_0x5406('0x172')]=_0x45d050[_0x5406('0x173')]||0x1388;}if(_0x45d050[_0x5406('0x53')]==='outbound'){_0x2352a1[_0x5406('0x174')]=_0x4ea3b[_0x5406('0x114')];}else{_0x2352a1[_0x5406('0x175')]=_0x4ea3b[_0x5406('0x115')];}for(var _0x2c9034 in _0x4ea3b[_0x5406('0x15f')]){if(typeof _0x4ea3b[_0x5406('0x15f')][_0x2c9034]!==_0x5406('0xaa')){if(isNotNull(_0x4ea3b[_0x5406('0x15f')][_0x2c9034])&&_0x2c9034!=='id'&&_0x2c9034!==_0x5406('0x176')&&_0x2c9034!=='createdAt'&&_0x2c9034!==_0x5406('0x177')){_0x2352a1[util[_0x5406('0x77')](_0x5406('0x178'),_0x5406('0x179'),_[_0x5406('0x17a')](_0x2c9034))]=_0x4ea3b[_0x5406('0x15f')][_0x2c9034];}}}var _0x372cd7=_0x5882b0[_0x5406('0xd1')](_0x45d050[_0x5406('0x74')])?getCallerId(_0x45d050['Trunk'][_0x5406('0x76')],_0x45d050['dialOriginateCallerIdName'],_0x45d050[_0x5406('0x17b')]>0x0?getCallerIdRandom(_0x45d050[_0x5406('0x5a')],_0x45d050['dialRandomLastDigitCallerIdNumber']):_0x45d050[_0x5406('0x5a')]):getCallerId(_[_0x5406('0xac')](_0x45d050[_0x5406('0x137')])?_0x45d050['Trunk'][_0x5406('0x76')]:_0x45d050[_0x5406('0x137')][_0x5406('0x76')],_0x45d050[_0x5406('0x59')],_0x45d050[_0x5406('0x17b')]>0x0?getCallerIdRandom(_0x45d050[_0x5406('0x5a')],_0x45d050[_0x5406('0x17b')]):_0x45d050[_0x5406('0x5a')]);if(_0x372cd7){_0x2352a1['XMD-ORIGINATECALLERIDNAME']=_0x5882b0[_0x5406('0x25')][_0x30f9fa]['originatecalleridname']=extractCalleridName(_0x372cd7);_0x2352a1[_0x5406('0x17c')]=_0x5882b0[_0x5406('0x25')][_0x30f9fa][_0x5406('0x17d')]=extractCalleridNumber(_0x372cd7);}return ami[_0x5406('0xad')]({'actionid':_0x30f9fa,'action':'originate','channel':_0x5882b0['isTrunkReachable'](_0x45d050['Trunk'])?util[_0x5406('0x77')]('SIP/%s/%s%s',_0x45d050['Trunk']['name'],isNotNull(_0x45d050['dialPrefix'])?_0x45d050[_0x5406('0x5c')][_0x5406('0x17e')]()||'':'',_0x45d050['dialCutDigit']>0x0?_0x4ea3b[_0x5406('0x15f')][_0x5406('0x160')][_0x5406('0x17f')](_0x45d050[_0x5406('0x180')]):_0x4ea3b[_0x5406('0x15f')][_0x5406('0x160')]):util[_0x5406('0x77')](_0x5406('0x181'),_[_0x5406('0xac')](_0x45d050['TrunkBackup'])?_0x45d050[_0x5406('0x74')][_0x5406('0x44')]:_0x45d050['TrunkBackup'][_0x5406('0x44')],isNotNull(_0x45d050[_0x5406('0x5c')])?_0x45d050[_0x5406('0x5c')]['trim']()||'':'',_0x45d050[_0x5406('0x180')]>0x0?_0x4ea3b[_0x5406('0x15f')][_0x5406('0x160')][_0x5406('0x17f')](_0x45d050[_0x5406('0x180')]):_0x4ea3b[_0x5406('0x15f')][_0x5406('0x160')]),'callerid':_0x372cd7,'Exten':_0x5406('0xd8'),'Context':'from-sip','Priority':'1','variable':_0x2352a1,'timeout':(_0x45d050[_0x5406('0x5b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x30f9fa})['then'](function(_0x361017){return _0x39605f(_0x361017);})['catch'](function(_0x21a797){_0x45d050[_0x5406('0x182')]+=0x1;var _0x500c47=new History(_0x5882b0[_0x5406('0x25')][_0x30f9fa]);logger['error'](util['format'](_0x5406('0x183'),JSON['stringify'](_0x21a797)));_0x500c47[_0x5406('0xa4')]=0xe;_0x500c47[_0x5406('0xa5')]=_0x5406('0x184');_0x500c47[_0x5406('0xa6')]=moment()['format'](_0x5406('0xf4'));_0x500c47[_0x5406('0x116')]=_0x500c47[_0x5406('0xa6')];_0x5882b0['createHistory'](_0x500c47)[_0x5406('0xaf')](loggerCatch(_0x5406('0x185')));_0x5882b0[_0x5406('0xc6')](_0x500c47)['catch'](loggerCatch(_0x5406('0x185')))[_0x5406('0x1e')](function(){delete _0x5882b0[_0x5406('0x25')][_0x30f9fa];return _0x34a943(msgResponse('originate',_0x5406('0x186'),_0x5406('0x187')));});});});};Dialer['prototype'][_0x5406('0x32')]=function(_0x19f48b){var _0x6dded3=this['actions'][_0x19f48b[_0x5406('0x11f')]];if(_0x6dded3){delete this['actions'][_0x19f48b[_0x5406('0x11f')]];_0x6dded3['responsetime']=moment()['format'](_0x5406('0xf4'));var _0xcd81e1=_0x6dded3[_0x5406('0x53')]===_0x5406('0x8e')?this[_0x5406('0x21')][_0x6dded3['queue']]:this[_0x5406('0x20')][_0x6dded3[_0x5406('0x188')]()];if(!this['isSuccess'](_0x19f48b[_0x5406('0x189')])){this[_0x5406('0xb2')](_0xcd81e1);return this[_0x5406('0x18a')](_0x6dded3,_0xcd81e1,_0x19f48b)[_0x5406('0xaf')](loggerCatch(_0x5406('0x18b')));}this[_0x5406('0x27')][_0x19f48b[_0x5406('0xf7')]]=_0x6dded3;}};Dialer[_0x5406('0x1b')][_0x5406('0x18c')]=function(_0x10a9f7,_0x4cf04e,_0x5d0e65){var _0x204419=new History(_0x4cf04e);if(_0x204419[_0x5406('0xe9')]+_0x204419['countcongestionretry']+_0x204419['countnoanswerretry']+_0x204419[_0x5406('0xec')]+_0x204419[_0x5406('0xed')]+_0x204419[_0x5406('0x11b')]+_0x204419[_0x5406('0xe6')]+_0x204419[_0x5406('0xee')]>=_0x5d0e65[_0x5406('0xef')]-0x1){return!![];}switch(_0x10a9f7){case 0x3:if(_0x204419[_0x5406('0xeb')]>=_0x5d0e65[_0x5406('0x18d')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x204419[_0x5406('0xeb')]+=0x1,'scheduledat':moment()[_0x5406('0xf2')](_0x5d0e65[_0x5406('0x18e')],_0x5406('0xf3'))['format'](_0x5406('0xf4')),'ContactId':_0x204419[_0x5406('0xf5')],'ListId':_0x204419[_0x5406('0xcc')],'VoiceQueueId':_0x204419[_0x5406('0x114')]||undefined,'CampaignId':_0x204419[_0x5406('0x115')]||undefined})[_0x5406('0xaf')](loggerCatch(_0x5406('0x18f')));break;case 0x5:if(_0x204419['countbusyretry']>=_0x5d0e65['dialBusyMaxRetry']-0x1){return!![];}this[_0x5406('0xbb')]({'active':![],'countbusyretry':_0x204419['countbusyretry']+=0x1,'scheduledat':moment()[_0x5406('0xf2')](_0x5d0e65[_0x5406('0x190')],'minutes')[_0x5406('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x204419[_0x5406('0xf5')],'ListId':_0x204419[_0x5406('0xcc')],'VoiceQueueId':_0x204419[_0x5406('0x114')]||undefined,'CampaignId':_0x204419['CampaignId']||undefined})[_0x5406('0xaf')](loggerCatch(_0x5406('0x191')));break;case 0x8:if(_0x204419[_0x5406('0xea')]>=_0x5d0e65[_0x5406('0x192')]-0x1){return!![];}this[_0x5406('0xbb')]({'active':![],'countcongestionretry':_0x204419[_0x5406('0xea')]+=0x1,'scheduledat':moment()[_0x5406('0xf2')](_0x5d0e65[_0x5406('0x193')],_0x5406('0xf3'))[_0x5406('0x77')](_0x5406('0xf4')),'ContactId':_0x204419['ContactId'],'ListId':_0x204419['ListId'],'VoiceQueueId':_0x204419['VoiceQueueId']||undefined,'CampaignId':_0x204419[_0x5406('0x115')]||undefined})[_0x5406('0xaf')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x204419[_0x5406('0xec')]>=_0x5d0e65[_0x5406('0x194')]-0x1){return!![];}else{this[_0x5406('0xbb')]({'active':![],'countnosuchnumberretry':_0x204419['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x5d0e65[_0x5406('0x195')],'minutes')[_0x5406('0x77')](_0x5406('0xf4')),'ContactId':_0x204419[_0x5406('0xf5')],'ListId':_0x204419[_0x5406('0xcc')],'VoiceQueueId':_0x204419['VoiceQueueId']||undefined,'CampaignId':_0x204419[_0x5406('0x115')]||undefined})[_0x5406('0xaf')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x204419[_0x5406('0xed')]>=_0x5d0e65[_0x5406('0x112')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x204419['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x5d0e65[_0x5406('0x113')],_0x5406('0xf3'))[_0x5406('0x77')](_0x5406('0xf4')),'ContactId':_0x204419[_0x5406('0xf5')],'ListId':_0x204419[_0x5406('0xcc')],'VoiceQueueId':_0x204419[_0x5406('0x114')]||undefined,'CampaignId':_0x204419[_0x5406('0x115')]||undefined})[_0x5406('0xaf')](loggerCatch(_0x5406('0x196')));break;case 0xb:if(_0x204419[_0x5406('0x11b')]>=_0x5d0e65[_0x5406('0x11c')]-0x1){return!![];}this[_0x5406('0xbb')]({'active':![],'countabandonedretry':_0x204419[_0x5406('0x11b')]+=0x1,'scheduledat':moment()[_0x5406('0xf2')](_0x5d0e65['dialAbandonedRetryFrequency'],_0x5406('0xf3'))[_0x5406('0x77')](_0x5406('0xf4')),'ContactId':_0x204419[_0x5406('0xf5')],'ListId':_0x204419[_0x5406('0xcc')],'VoiceQueueId':_0x204419[_0x5406('0x114')]||undefined,'CampaignId':_0x204419['CampaignId']||undefined})[_0x5406('0xaf')](loggerCatch(_0x5406('0x11e')));break;case 0x13:if(_0x204419['countmachineretry']>=_0x5d0e65[_0x5406('0xfb')]-0x1){return!![];}this[_0x5406('0xbb')]({'active':![],'countmachineretry':_0x204419['countmachineretry']+=0x1,'scheduledat':moment()[_0x5406('0xf2')](_0x5d0e65[_0x5406('0xfc')],_0x5406('0xf3'))[_0x5406('0x77')](_0x5406('0xf4')),'ContactId':_0x204419[_0x5406('0xf5')],'ListId':_0x204419[_0x5406('0xcc')],'VoiceQueueId':_0x204419['VoiceQueueId']||undefined,'CampaignId':_0x204419[_0x5406('0x115')]||undefined})[_0x5406('0xaf')](loggerCatch(_0x5406('0xf6')));break;case 0x14:if(_0x204419[_0x5406('0xee')]>=_0x5d0e65[_0x5406('0x197')]-0x1){return!![];}this[_0x5406('0xbb')]({'active':![],'countagentrejectretry':_0x204419['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x5406('0xf2')](_0x5d0e65[_0x5406('0x198')],_0x5406('0xf3'))[_0x5406('0x77')](_0x5406('0xf4')),'ContactId':_0x204419['ContactId'],'ListId':_0x204419[_0x5406('0xcc')],'VoiceQueueId':_0x204419[_0x5406('0x114')]||undefined,'CampaignId':_0x204419[_0x5406('0x115')]||undefined})[_0x5406('0xaf')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x5406('0x1b')][_0x5406('0x18a')]=function(_0x1393c0,_0x42338c,_0x7f11c){var _0x397ba1=this;var _0x26a851=new History(_0x1393c0);return new BPromise(function(_0xdadda0,_0x4a6ac7){if(_['isUndefined'](_0x42338c)&&typeof _0x42338c!==_0x5406('0x199')){return _0x4a6ac7(msgResponse(_0x5406('0x19a'),_0x5406('0x13d'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x7f11c)&&typeof _0x7f11c!=='object'){return _0x4a6ac7(msgResponse(_0x5406('0x19a'),_0x5406('0x13d'),_0x5406('0x19b')));}switch(_0x7f11c[_0x5406('0x19c')]){case'0':_0x42338c[_0x5406('0x19d')]+=0x1;_0x26a851[_0x5406('0xa4')]=0x0;_0x26a851[_0x5406('0xa5')]=_0x5406('0x19e');_0x26a851['countnosuchnumberretry']+=0x1;_0x26a851['countglobal']+=0x1;ami[_0x5406('0x4c')](_0x5406('0x19f'),ut[_0x5406('0xe0')](_0x1393c0,'nosuchnumber'));_0x397ba1[_0x5406('0xc8')](_0x26a851)['catch'](loggerCatch(_0x5406('0xe8')));if(_0x397ba1[_0x5406('0x18c')](0x0,_0x1393c0,_0x42338c)){if(_0x26a851[_0x5406('0xec')]>=_0x42338c[_0x5406('0x194')]){_0x397ba1[_0x5406('0xf1')](_0x26a851,_0xdadda0,_0x4a6ac7,_0x5406('0x1a0'));}else{_0x397ba1[_0x5406('0xfa')](_0x26a851,_0xdadda0,_0x4a6ac7,_0x5406('0x1a0'));}}break;case'3':_0x42338c[_0x5406('0x63')]+=0x1;_0x26a851[_0x5406('0xa4')]=0x3;_0x26a851['statedesc']=_0x5406('0x1a1');_0x26a851[_0x5406('0xeb')]+=0x1;_0x26a851['countglobal']+=0x1;ami['emit'](_0x5406('0x1a2'),ut[_0x5406('0xe0')](_0x1393c0,_0x5406('0x1a3')));_0x397ba1[_0x5406('0xc8')](_0x26a851)[_0x5406('0xaf')](loggerCatch(_0x5406('0x1a4')));if(_0x397ba1[_0x5406('0x18c')](0x3,_0x1393c0,_0x42338c)){if(_0x26a851[_0x5406('0xeb')]>=_0x42338c[_0x5406('0x18d')]){_0x397ba1[_0x5406('0xf1')](_0x26a851,_0xdadda0,_0x4a6ac7,_0x5406('0x1a5'));}else{_0x397ba1[_0x5406('0xfa')](_0x26a851,_0xdadda0,_0x4a6ac7,_0x5406('0x1a5'));}}break;case'5':_0x42338c['outboundBusyCallsDay']+=0x1;_0x26a851[_0x5406('0xa4')]=0x5;_0x26a851[_0x5406('0xa5')]=_0x5406('0x1a6');_0x26a851[_0x5406('0xe9')]+=0x1;_0x26a851['countglobal']+=0x1;ami[_0x5406('0x4c')]('custom:agentbusy',ut[_0x5406('0xe0')](_0x1393c0,'busy'));_0x397ba1['createHistory'](_0x26a851)[_0x5406('0xaf')](loggerCatch(_0x5406('0x1a7')));if(_0x397ba1['checkRetriveMax'](0x5,_0x1393c0,_0x42338c)){if(_0x26a851['countbusyretry']>=_0x42338c[_0x5406('0x1a8')]){_0x397ba1['createStateFinal'](_0x26a851,_0xdadda0,_0x4a6ac7,'reason\x205\x20busy');}else{_0x397ba1['stateGlobal'](_0x26a851,_0xdadda0,_0x4a6ac7,'reason\x205\x20busy');}}break;case'8':_0x42338c['outboundCongestionCallsDay']+=0x1;_0x26a851[_0x5406('0xa4')]=0x8;_0x26a851[_0x5406('0xa5')]=_0x5406('0x1a9');_0x26a851[_0x5406('0xea')]+=0x1;_0x26a851[_0x5406('0xe7')]+=0x1;ami[_0x5406('0x4c')]('custom:agentcongestion',ut[_0x5406('0xe0')](_0x1393c0,_0x5406('0x1aa')));_0x397ba1[_0x5406('0xc8')](_0x26a851)['catch'](loggerCatch(_0x5406('0x1ab')));if(_0x397ba1[_0x5406('0x18c')](0x8,_0x1393c0,_0x42338c)){if(_0x26a851['countcongestionretry']>=_0x42338c[_0x5406('0x192')]){_0x397ba1[_0x5406('0xf1')](_0x26a851,_0xdadda0,_0x4a6ac7,_0x5406('0x1ac'));}else{_0x397ba1[_0x5406('0xfa')](_0x26a851,_0xdadda0,_0x4a6ac7,_0x5406('0x1ac'));}}break;case'11':_0x42338c[_0x5406('0x1ad')]+=0x1;_0x26a851[_0x5406('0xa4')]=0xb;_0x26a851[_0x5406('0xa5')]=_0x5406('0x119');_0x26a851[_0x5406('0x11b')]+=0x1;_0x26a851[_0x5406('0xe7')]+=0x1;_0x397ba1[_0x5406('0xc8')](_0x26a851)[_0x5406('0xaf')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x397ba1[_0x5406('0x18c')](0xb,_0x1393c0,_0x42338c)){if(_0x26a851[_0x5406('0x11b')]>=_0x42338c[_0x5406('0x11c')]){_0x397ba1[_0x5406('0xf1')](_0x26a851,_0xdadda0,_0x4a6ac7,_0x5406('0x1ae'));}else{_0x397ba1[_0x5406('0xfa')](_0x26a851,_0xdadda0,_0x4a6ac7,_0x5406('0x1ae'));}}break;case'20':_0x42338c[_0x5406('0x1af')]+=0x1;_0x26a851[_0x5406('0xa4')]=0x14;_0x26a851[_0x5406('0xa5')]=_0x5406('0x1b0');_0x26a851[_0x5406('0xee')]+=0x1;_0x26a851[_0x5406('0xe7')]+=0x1;ami[_0x5406('0x4c')]('custom:agentreject',ut[_0x5406('0xe0')](_0x1393c0,'agentreject'));_0x397ba1[_0x5406('0xc8')](_0x26a851)[_0x5406('0xaf')](loggerCatch(_0x5406('0x1b1')));if(_0x397ba1[_0x5406('0x18c')](0x14,_0x1393c0,_0x42338c)){if(_0x26a851[_0x5406('0xee')]>=_0x42338c[_0x5406('0x197')]){_0x397ba1['createStateFinal'](_0x26a851,_0xdadda0,_0x4a6ac7,_0x5406('0x1b2'));}else{_0x397ba1[_0x5406('0xfa')](_0x26a851,_0xdadda0,_0x4a6ac7,_0x5406('0x1b2'));}}break;default:_0x42338c[_0x5406('0x64')]+=0x1;_0x26a851['state']=0xc;_0x26a851[_0x5406('0xa5')]=_0x7f11c[_0x5406('0x19c')];_0x397ba1[_0x5406('0xc8')](_0x26a851)[_0x5406('0xaf')](loggerCatch(_0x5406('0x1b3')));if(_0x397ba1['checkRetriveMax'](_0x7f11c['reason'],_0x1393c0,_0x42338c)){if(_0x26a851[_0x5406('0xe9')]+_0x26a851[_0x5406('0xea')]+_0x26a851['countnoanswerretry']+_0x26a851[_0x5406('0xec')]+_0x26a851[_0x5406('0xed')]+_0x26a851[_0x5406('0x11b')]+_0x26a851[_0x5406('0xe6')]+_0x26a851[_0x5406('0xee')]>=_0x42338c[_0x5406('0xef')]){_0x397ba1[_0x5406('0xfa')](_0x26a851,_0xdadda0,_0x4a6ac7,_0x7f11c[_0x5406('0x19c')]);}else{_0x397ba1[_0x5406('0xf1')](_0x26a851,_0xdadda0,_0x4a6ac7,_0x7f11c[_0x5406('0x19c')]);}}}});};Dialer['prototype'][_0x5406('0xfa')]=function(_0x1cb683,_0x4186dd,_0x2b023c,_0x130402){var _0x20d779=new Final(_0x1cb683);_0x20d779[_0x5406('0xa4')]=0xf;_0x20d779[_0x5406('0xa5')]=_0x5406('0x1b4');this[_0x5406('0xf1')](_0x20d779,_0x4186dd,_0x2b023c,_0x130402);};Dialer[_0x5406('0x1b')]['createStateFinal']=function(_0xb43541,_0x3bbeb0,_0x49f125,_0x446476){this[_0x5406('0xc6')](_0xb43541)[_0x5406('0xb4')](function(){return _0x3bbeb0(msgResponse(_0x5406('0x19a'),'Success',_0x446476));})[_0x5406('0xaf')](function(){return _0x49f125(msgResponse('[moveContactManagedDialer][0]',_0x5406('0x13d'),_0x5406('0x1b5')));});};Dialer['prototype'][_0x5406('0x7')]=function(_0x3a0154){var _0x4cefde=_0x3a0154['dialPredictiveOptimizationPercentage']/0x64;var _0x11f6db=_0x3a0154[_0x5406('0x110')]/(_0x3a0154['outboundDropCallsDayTimeout']+_0x3a0154[_0x5406('0xe4')]);var _0x52890c=Math['round'](_0x3a0154[_0x5406('0x6d')]*(_0x3a0154[_0x5406('0x1b6')]/0x64));var _0x5e59a3=Math['round'](_0x3a0154[_0x5406('0x6d')]*(_0x3a0154[_0x5406('0x1b7')]/0x64));var _0x2d0a19=_0x3a0154[_0x5406('0x1b8')]+_0x3a0154[_0x5406('0x51')];var _0xc1daf6=Math[_0x5406('0x1b9')](_0x3a0154['erlangCalls']*_0x3a0154[_0x5406('0x72')]*_0x3a0154[_0x5406('0x6a')]*_0x3a0154[_0x5406('0x6b')]);if(_[_0x5406('0x41')](_0x3a0154['startProgressive'])){if(!_[_0x5406('0x41')](_0x3a0154[_0x5406('0x28')])){_0x3a0154[_0x5406('0x28')]=undefined;loggerPredictive[_0x5406('0x92')](_0x5406('0x1ba'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x3a0154['handlePredictive'])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x3a0154[_0x5406('0x8c')]);_0x3a0154[_0x5406('0x8c')]=undefined;}_0x3a0154['startProgressive']=moment()[_0x5406('0x77')](_0x5406('0xf4'));loggerPredictive[_0x5406('0x7a')](_0x3a0154[_0x5406('0x44')],_0x5406('0x1bb'),_0x3a0154[_0x5406('0x29')]);this['handlePower'](_0x3a0154,0x1);}else if(ifInterval(_0x3a0154[_0x5406('0x1bc')],_0x3a0154[_0x5406('0x29')])){this[_0x5406('0x14f')](_0x3a0154,0x1);loggerPredictiveCalls[_0x5406('0x7a')](_0x5406('0x1bd'),_0x3a0154[_0x5406('0x29')],_0x3a0154[_0x5406('0x44')]);_0x3a0154[_0x5406('0x70')]=0x0;_0x3a0154[_0x5406('0x69')]=0x0;}else if(_0x4cefde<_0x11f6db&&_0x3a0154[_0x5406('0x1be')]==='dropRate'){freeVariablesPredictive(_0x3a0154);loggerPredictive[_0x5406('0x7a')](_0x5406('0x1bf'),_0x5406('0x1c0'),_0x11f6db,_0x5406('0x29'),_0x3a0154['name']);}else if(_0xc1daf6<_0x3a0154[_0x5406('0x69')]&&_0x3a0154['dialPredictiveOptimization']===_0x5406('0x1c1')){freeVariablesPredictive(_0x3a0154);loggerPredictive[_0x5406('0x7a')](_0x5406('0x1c2'),_0x5406('0x1c3'),_0xc1daf6,_0x5406('0x1c4'),_0x3a0154['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x3a0154[_0x5406('0x44')]);}else if(!ifInterval(_0x3a0154['dialPredictiveInterval'],_0x3a0154[_0x5406('0x29')])&&_[_0x5406('0x41')](_0x3a0154[_0x5406('0x28')])&&!_[_0x5406('0x41')](_0x3a0154[_0x5406('0x29')])){_0x3a0154[_0x5406('0x28')]=moment()[_0x5406('0x77')](_0x5406('0xf4'));loggerPredictive[_0x5406('0x7a')](_0x3a0154[_0x5406('0x44')],_0x5406('0x1c5'),_0x3a0154[_0x5406('0x28')]);this['averageHandleTime'](_0x3a0154['dialPredictiveInterval'])[_0x5406('0xb4')](this[_0x5406('0x1c6')](_0x3a0154))['then'](mergeDataErlangB(_0x3a0154))['then'](this[_0x5406('0x1c7')](_0x3a0154))['catch'](loggerCatchPredictive(_0x5406('0x1c8'),_0x3a0154));}else if(!ifInterval(_0x3a0154['dialPredictiveInterval'],_0x3a0154['startPredictive'])){_0x3a0154[_0x5406('0x69')]=0x0;_0x3a0154[_0x5406('0x28')]=moment()[_0x5406('0x77')](_0x5406('0xf4'));loggerPredictive['info'](_0x3a0154[_0x5406('0x44')],'recalculate\x20predictive\x20at',_0x3a0154[_0x5406('0x28')]);clearInterval(_0x3a0154[_0x5406('0x8c')]);_0x3a0154[_0x5406('0x8c')]=undefined;this[_0x5406('0xb8')](_0x3a0154[_0x5406('0x1bc')])[_0x5406('0xb4')](this[_0x5406('0x1c6')](_0x3a0154))[_0x5406('0xb4')](mergeDataErlangB(_0x3a0154))[_0x5406('0xb4')](this[_0x5406('0x1c7')](_0x3a0154))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x3a0154));}else if(_0x3a0154[_0x5406('0x6d')]&&_0x2d0a19<_0x3a0154[_0x5406('0x6d')]-_0x5e59a3){freeVariablesPredictive(_0x3a0154);loggerPredictive[_0x5406('0x7a')](_0x3a0154[_0x5406('0x44')],_0x5406('0x1c9'),_0x2d0a19,_0x5406('0x1ca'),_0x3a0154['predictiveIntervalAvailable'],'-',_0x5e59a3,'=',_0x3a0154[_0x5406('0x6d')]-_0x5e59a3,')');}else if(_0x3a0154[_0x5406('0x6d')]&&_0x2d0a19>_0x3a0154[_0x5406('0x6d')]+_0x52890c){freeVariablesPredictive(_0x3a0154);loggerPredictive['info'](_0x3a0154['name'],_0x5406('0x1c9'),_0x2d0a19,_0x5406('0x1cb'),_0x3a0154[_0x5406('0x6d')],'+',_0x52890c,'=',_0x3a0154[_0x5406('0x6d')]+_0x52890c,')');}};Dialer[_0x5406('0x1b')][_0x5406('0x1c6')]=function(_0x26ec7a){var _0x4cada2=this;return function(_0x7482ca){return new BPromise(function(_0x53abba,_0x190d90){_[_0x5406('0xca')](_0x26ec7a,_0x7482ca[0x0]);if(checkGetDataPredictive(_0x7482ca[0x0])){var _0x488afd=_0x26ec7a[_0x5406('0x6d')]=_0x26ec7a[_0x5406('0x51')]+_0x26ec7a[_0x5406('0x1b8')];var _0x164c97=_0x26ec7a[_0x5406('0x1bc')]*0x3c;var _0x26cb0f=_0x7482ca[0x0]['predictiveIntervalAvgTalktime']+_0x7482ca[0x0][_0x5406('0x66')];var _0x1dfdc0=(_0x7482ca[0x0]['predictiveIntervalAnsweredCalls']+_0x7482ca[0x0][_0x5406('0x67')]+_0x7482ca[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x7482ca[0x0][_0x5406('0x6e')];_0x26ec7a[_0x5406('0x6a')]=_0x1dfdc0>0x0?_0x1dfdc0:0x1;switch(_0x26ec7a['dialPredictiveOptimization']){case _0x5406('0x1c1'):var _0x4d0c89=_0x26ec7a[_0x5406('0x1cc')]/0x64;return _0x4cada2['abandonmentRate'](_0x488afd,_0x164c97,_0x26cb0f,_0x1dfdc0,_0x4d0c89)['then'](function(_0x5dcd36){return _0x53abba(_0x5dcd36);});case'agentBusyFactor':var _0x31b50d=_0x26ec7a[_0x5406('0x1cc')]/0x64;return _0x4cada2[_0x5406('0x1cd')](_0x488afd,_0x164c97,_0x26cb0f,_0x1dfdc0,_0x31b50d)[_0x5406('0xb4')](function(_0x5e3183){return _0x53abba(_0x5e3183);});default:return _0x190d90(msgResponse(_0x5406('0x1ce'),_0x5406('0x13d'),'Unknown\x20Predictive'));}}else{return _0x190d90(msgResponse(_0x5406('0x1ce'),_0x5406('0x13d'),_0x5406('0x1cf')));}});};};Dialer[_0x5406('0x1b')]['getDataPredictiveOld']=function(_0x288fbf){var _0x44acc5=this;return function(_0x1c740e){return new BPromise(function(_0x14419b,_0x39fc9e){_[_0x5406('0xca')](_0x288fbf,_0x1c740e[0x0]);if(checkGetDataPredictive(_0x1c740e[0x0])){loggerPredictive[_0x5406('0x7a')](JSON[_0x5406('0x127')](_0x1c740e[0x0]));if(_0x288fbf[_0x5406('0x1be')]===_0x5406('0x1c1')){return _0x44acc5[_0x5406('0xc4')](_0x288fbf['id'])['then'](function(_0x22d263){var _0x1ff163=_0x288fbf['loggedIn']-_0x22d263[0x0][_0x5406('0x1d0')];var _0x44e790=_0x288fbf[_0x5406('0x1bc')]*0x3c;var _0x351058=_0x1c740e[0x0][_0x5406('0x82')]+_0x1c740e[0x0][_0x5406('0x66')];var _0x554b67=(_0x1c740e[0x0][_0x5406('0x65')]+_0x1c740e[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1c740e[0x0][_0x5406('0x80')])/_0x1c740e[0x0][_0x5406('0x6e')];var _0x469de3=_0x288fbf[_0x5406('0x1cc')]/0x64;_0x288fbf[_0x5406('0x6c')]=_0x22d263[0x0]['outboundQueuePauses']||0x0;_0x288fbf[_0x5406('0x6a')]=_0x554b67>0x0?_0x554b67:0x1;return _0x44acc5[_0x5406('0x1d1')](_0x1ff163,_0x44e790,_0x351058,_0x554b67,_0x469de3);})[_0x5406('0xb4')](function(_0x4945b4){return _0x14419b(_0x4945b4);})[_0x5406('0xaf')](function(_0xa79a8f){return _0x39fc9e(msgResponse(_0x5406('0x1d2'),_0x5406('0x13d'),JSON[_0x5406('0x127')](_0xa79a8f)));});}if(_0x288fbf[_0x5406('0x1be')]===_0x5406('0x1d3')){return _0x44acc5[_0x5406('0xc4')](_0x288fbf['id'])[_0x5406('0xb4')](function(_0x4bcaa9){var _0x2df46d=_0x288fbf[_0x5406('0x4e')]-_0x4bcaa9[0x0][_0x5406('0x1d0')];var _0x2ca35f=_0x288fbf[_0x5406('0x1bc')]*0x3c;var _0x25dfa9=_0x1c740e[0x0][_0x5406('0x82')]+_0x1c740e[0x0][_0x5406('0x66')];var _0xe8c9b7=(_0x1c740e[0x0][_0x5406('0x65')]+_0x1c740e[0x0][_0x5406('0x67')]+_0x1c740e[0x0][_0x5406('0x80')])/_0x1c740e[0x0]['predictiveIntervalTotalCalls'];var _0x1218e2=_0x288fbf[_0x5406('0x1cc')]/0x64;_0x288fbf[_0x5406('0x6c')]=_0x4bcaa9[0x0][_0x5406('0x1d0')]||0x0;_0x288fbf[_0x5406('0x6a')]=_0xe8c9b7>0x0?_0xe8c9b7:0x1;return _0x44acc5[_0x5406('0x1cd')](_0x2df46d,_0x2ca35f,_0x25dfa9,_0xe8c9b7,_0x1218e2);})['then'](function(_0x2baf97){return _0x14419b(_0x2baf97);})[_0x5406('0xaf')](function(_0x4f71c2){return _0x39fc9e(msgResponse(_0x5406('0x1d2'),_0x5406('0x13d'),JSON[_0x5406('0x127')](_0x4f71c2)));});}}else{return _0x39fc9e(msgResponse('[getDataPredictive]',_0x5406('0x13d'),_0x5406('0x1cf')));}});};};Dialer[_0x5406('0x1b')][_0x5406('0x1c7')]=function(_0x23b30a){var _0x3a042b=this;return function(){var _0x128356=0x0;var _0xb9a962=Math['floor'](_0x23b30a[_0x5406('0x71')]*0x3e8);if(_0xb9a962>0x0){_0xb9a962=_0xb9a962<0x64?0x64:_0xb9a962;loggerPredictive[_0x5406('0x7a')](_0x23b30a[_0x5406('0x44')],_0x5406('0x1d4'),_0xb9a962,_0x5406('0x4b'));_0x23b30a[_0x5406('0x8c')]=setInterval(function(){_0x3a042b[_0x5406('0x8c')](_0x23b30a);loggerPredictiveCalls[_0x5406('0x7a')]('[handlePredictive]',_0x128356+=0x1);},_0xb9a962);}else{loggerPredictive['info'](_0x23b30a[_0x5406('0x44')],_0x5406('0x1d5'));}};};Dialer['prototype'][_0x5406('0x1d6')]=function(_0x22b379,_0x7bbb49){var _0xdcab46=this;return function(_0x48f0d3){if(_[_0x5406('0x49')](_0x48f0d3)){if(_[_0x5406('0xac')](_0x7bbb49['UserId'])||!_0x7bbb49[_0x5406('0x1d7')]){if(_0x22b379[_0x5406('0x58')]===_0x5406('0x6')){_0x22b379[_0x5406('0x125')]=_[_0x5406('0x41')](_0x22b379['queueStatusComplete'])?!![]:_0x22b379['queueStatusComplete'];var _0x17322f=uuid['v4']();_0xdcab46[_0x5406('0x25')][_0x17322f]=new Action(_0x22b379,_0x7bbb49,_0x17322f);loggerBooked[_0x5406('0x7a')](_0x5406('0x1d8'),_0x17322f,_0x5406('0x1d9'),JSON[_0x5406('0x127')](_0x22b379['queueStatusComplete']),_0x5406('0x1da'),_0x22b379[_0x5406('0x44')]);if(_0x22b379['queueStatusComplete']){_0x22b379[_0x5406('0x125')]=![];_0xdcab46[_0x5406('0x2b')][_0xdcab46[_0x5406('0x25')][_0x17322f][_0x5406('0xb1')]]=[];ami[_0x5406('0xad')]({'actionid':_0x17322f,'action':_0x5406('0x1db'),'queue':_0x22b379['name']})[_0x5406('0xaf')](function(){_0xdcab46[_0x5406('0xb2')](_0x22b379);_0xdcab46['rescheduleContact']({'active':![],'ContactId':_0xdcab46[_0x5406('0x25')][_0x17322f][_0x5406('0xf5')],'ListId':_0xdcab46[_0x5406('0x25')][_0x17322f][_0x5406('0xcc')],'VoiceQueueId':_0xdcab46[_0x5406('0x25')][_0x17322f][_0x5406('0x114')]||undefined,'CampaignId':_0xdcab46[_0x5406('0x25')][_0x17322f][_0x5406('0x115')]||undefined})[_0x5406('0xaf')](loggerCatch(_0x5406('0x1dc')));delete _0xdcab46[_0x5406('0x25')][_0x17322f];});}else{loggerBooked[_0x5406('0x7a')]('[booked][checkContactBlack][else]',JSON[_0x5406('0x127')](_0x22b379[_0x5406('0x125')]),_0x5406('0x1da'),_0x22b379['name']);_0xdcab46[_0x5406('0xb2')](_0x22b379);_0xdcab46['rescheduleContact']({'active':![],'ContactId':_0xdcab46['actions'][_0x17322f]['ContactId'],'ListId':_0xdcab46[_0x5406('0x25')][_0x17322f][_0x5406('0xcc')],'VoiceQueueId':_0xdcab46['actions'][_0x17322f]['VoiceQueueId']||undefined,'CampaignId':_0xdcab46[_0x5406('0x25')][_0x17322f]['CampaignId']||undefined})[_0x5406('0xaf')](loggerCatch(_0x5406('0x1dc')));delete _0xdcab46[_0x5406('0x25')][_0x17322f];}}else{return _0xdcab46[_0x5406('0x1dd')](_0x22b379,_0x7bbb49);}}else{if(getDiff(_0x7bbb49[_0x5406('0x1de')])<_0x22b379[_0x5406('0x1df')]*0x3c){if(_0x7bbb49['Agent']&&!_0x7bbb49['Agent'][_0x5406('0x1e0')]){_0xdcab46[_0x5406('0x1f')]['run'](_0x7bbb49['id'])['finally'](function(){_0xdcab46['updateOriginated'](_0x22b379);});}else{_0xdcab46[_0x5406('0xbd')]({'active':![]},_0x7bbb49['id'],0x1)[_0x5406('0x1e')](function(){_0xdcab46[_0x5406('0xb2')](_0x22b379);});}}else{_0x22b379[_0x5406('0x1e1')]+=0x1;_0xdcab46['updateOriginated'](_0x22b379);if(_0x22b379[_0x5406('0x1e2')]){_0xdcab46['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x7bbb49[_0x5406('0xf5')],'ListId':_0x7bbb49['ListId'],'VoiceQueueId':_0x7bbb49[_0x5406('0x114')]||undefined,'CampaignId':_0x7bbb49['CampaignId']||undefined})[_0x5406('0xaf')](loggerCatch(_0x5406('0x1e3')));_0xdcab46[_0x5406('0xc8')](createObjHistory(_0x22b379,_0x7bbb49,_0x5406('0x1e4'),0x17,_0x5406('0x1e5')))[_0x5406('0xaf')](loggerCatch(_0x5406('0x1e6')));}else{_0xdcab46[_0x5406('0xe2')](createObjHistory(_0x22b379,_0x7bbb49,_0x5406('0x1e7'),0x16,_0x5406('0x1e8')),'[Originate][HistoryRecallClose][historyCatch]',_0x5406('0x1e9'));}}}}else{_0x22b379[_0x5406('0x5e')]+=0x1;_0xdcab46[_0x5406('0xe2')](createObjHistory(_0x22b379,_0x7bbb49,_0x5406('0x1ea'),0xd,_0x5406('0x1eb')),_0x5406('0x1ec'),_0x5406('0x1ed'));throw _0x5406('0x1ee');}};};Dialer[_0x5406('0x1b')][_0x5406('0x1ef')]=function(_0x50f257){var _0x54bee5=this;var _0x3eb285=_0x50f257[_0x5406('0x1f0')]-_0x50f257[_0x5406('0x6f')]-_0x50f257['temp'];emitCampaignSummary(_0x50f257);if(_0x3eb285>0x0){if(_0x3eb285>this[_0x5406('0x24')]){_0x3eb285=this[_0x5406('0x24')];}_0x50f257[_0x5406('0xc0')]+=_0x3eb285;this[_0x5406('0xc2')](_0x50f257['id'],_0x3eb285,_0x50f257[_0x5406('0x1f1')],_0x50f257)['then'](function(_0x477535){_0x50f257['temp']-=_0x3eb285;_0x50f257[_0x5406('0xc0')]=_0x50f257[_0x5406('0xc0')]>0x0?_0x50f257['temp']:0x0;if(!checkContactEmpty(_0x477535)){_0x50f257[_0x5406('0x42')]=_0x5406('0x9b');logger[_0x5406('0x7a')]('[getContactCampaign2][Empty]'+_0x50f257[_0x5406('0x44')]);}else{_0x50f257[_0x5406('0x6f')]+=_0x477535[_0x5406('0x95')];_0x50f257[_0x5406('0x42')]=_0x5406('0x1f2');for(var _0xb8ceed=0x0;_0xb8ceed<_0x477535[_0x5406('0x95')];_0xb8ceed+=0x1){_0x50f257[_0x5406('0x1f3')]+=0x1;if(_['isNil'](_0x477535[_0xb8ceed])||_[_0x5406('0xac')](_0x477535[_0xb8ceed]['Contact'])||_[_0x5406('0xac')](_0x477535[_0xb8ceed][_0x5406('0x15f')][_0x5406('0x160')])){_0x54bee5[_0x5406('0x1f4')](_0x5406('0x1f5'),_0x50f257,_0x477535[_0xb8ceed]);}else{_0x54bee5[_0x5406('0xb7')](_[_0x5406('0xcb')](_0x477535[_0xb8ceed],['CampaignId','Contact.phone']))[_0x5406('0xb4')](_0x54bee5[_0x5406('0x1d6')](_0x50f257,_0x477535[_0xb8ceed]))[_0x5406('0xaf')](_0x54bee5['loggerHandler'](_0x5406('0x1f6'),_0x50f257));}}}})[_0x5406('0xaf')](loggerGetContactDialer(_0x5406('0x1f7'),_0x50f257,_0x3eb285));}};Dialer[_0x5406('0x1b')][_0x5406('0x14f')]=function(_0x3d2bc4,_0x3ad657){var _0x40571d=this;var _0x203a03=[];var _0x4c1d64=_0x3ad657>=0x1?_0x3ad657:0x1;if(_0x3d2bc4['dialMethod']===_0x5406('0x6')){_0x4c1d64=0x1;}var _0xfb7e7f=Math[_0x5406('0x1b9')](_0x3d2bc4[_0x5406('0x1b8')]*_0x4c1d64)-_0x3d2bc4['originated']-_0x3d2bc4['temp'];emitVoiceQueueSummary(_0x3d2bc4);if(_0x3d2bc4['dialLimitQueue']>0x0){var _0x5180c8=_0x3d2bc4[_0x5406('0x1f8')]-_0x3d2bc4['originated']-_0x3d2bc4['talking']-_0x3d2bc4['temp']-_0x3d2bc4['pTalking'];if(_0xfb7e7f>_0x5180c8){_0xfb7e7f=_0x5180c8;}}if(_0xfb7e7f>0x0){if(_0x3d2bc4['dialMethod']===_0x5406('0x6')){_0xfb7e7f=0x1;}if(_0xfb7e7f>this['maxNumberOriginate']){_0xfb7e7f=this[_0x5406('0x24')];}_0x3d2bc4['temp']+=_0xfb7e7f;for(var _0x4cff4c in this['agents']){if(typeof this[_0x5406('0x22')][_0x4cff4c]!=='undefined'){if(this['agents'][_0x4cff4c][_0x5406('0xa4')]===_0x5406('0x1f9')&&this[_0x5406('0x22')][_0x4cff4c][_0x5406('0xd3')]===_0x5406('0x1fa')){_0x203a03[_0x5406('0x123')](this[_0x5406('0x22')][_0x4cff4c]['id']);}}}this[_0x5406('0xbf')](_0x3d2bc4['id'],_0x203a03,_0xfb7e7f,_0x3d2bc4[_0x5406('0x1f1')],_0x3d2bc4)[_0x5406('0xb4')](function(_0x1a14e7){_0x3d2bc4[_0x5406('0xc0')]-=_0xfb7e7f;_0x3d2bc4[_0x5406('0xc0')]=_0x3d2bc4[_0x5406('0xc0')]>0x0?_0x3d2bc4[_0x5406('0xc0')]:0x0;if(!checkContactEmpty(_0x1a14e7)){_0x40571d[_0x5406('0x1fb')](_0x3d2bc4)[_0x5406('0xb4')](sendMessageReschedule(_0x3d2bc4))[_0x5406('0xaf')](loggerCatch(_0x5406('0x1fc')));}else{_0x3d2bc4[_0x5406('0x6f')]+=_0x1a14e7[_0x5406('0x95')];_0x3d2bc4[_0x5406('0x42')]=_0x3d2bc4[_0x5406('0x58')]===_0x5406('0x6')?_0x5406('0x166'):_0x5406('0x1f2');for(var _0x28821c=0x0;_0x28821c<_0x1a14e7[_0x5406('0x95')];_0x28821c+=0x1){if(_['isNil'](_0x1a14e7[_0x28821c])||_[_0x5406('0xac')](_0x1a14e7[_0x28821c]['Contact'])||_[_0x5406('0xac')](_0x1a14e7[_0x28821c]['Contact'][_0x5406('0x160')])){_0x40571d['emptyContact']('[actionOriginate]\x20',_0x3d2bc4,_0x1a14e7[_0x28821c]);}else{_0x40571d['checkIsBlackList'](_[_0x5406('0xcb')](_0x1a14e7[_0x28821c],[_0x5406('0x114'),_0x5406('0x1fd')]))[_0x5406('0xb4')](_0x40571d['checkContactBlack'](_0x3d2bc4,_0x1a14e7[_0x28821c]))[_0x5406('0xaf')](_0x40571d[_0x5406('0x1fe')]('[actionOriginate]\x20',_0x3d2bc4));}}}})[_0x5406('0xaf')](loggerGetContactDialer(_0x5406('0x1ff'),_0x3d2bc4,_0xfb7e7f));}};Dialer['prototype']['handlePredictive']=function(_0x2a037f){if(_0x2a037f[_0x5406('0x1f8')]>0x0){var _0x17f5f9=_0x2a037f[_0x5406('0x1f8')]-_0x2a037f[_0x5406('0x6f')]-_0x2a037f[_0x5406('0x51')];if(_0x17f5f9>0x0){this[_0x5406('0x200')](_0x2a037f);}else{loggerPredictiveCalls[_0x5406('0x7a')]('[handlePredictive][limitChannel]');}}else{this[_0x5406('0x200')](_0x2a037f);}};Dialer['prototype'][_0x5406('0x200')]=function(_0x5ef398){var _0x445b00=this;var _0x1e7bc5=[];_0x5ef398[_0x5406('0x6f')]+=0x1;for(var _0x26dc71 in this[_0x5406('0x22')]){if(typeof this['agents'][_0x26dc71]!==_0x5406('0xaa')){if(this['agents'][_0x26dc71][_0x5406('0xa4')]===_0x5406('0x1f9')&&this[_0x5406('0x22')][_0x26dc71][_0x5406('0xd3')]===_0x5406('0x1fa')){_0x1e7bc5[_0x5406('0x123')](this['agents'][_0x26dc71]['id']);}}}this[_0x5406('0xbf')](_0x5ef398['id'],_0x1e7bc5,0x1,_0x5ef398['dialOrderByScheduledAt'],_0x5ef398)[_0x5406('0xb4')](function(_0x375a0f){if(!checkContactEmpty(_0x375a0f)){checkContactLowerLimitOriginate(_0x5ef398,0x1,0x0);_0x445b00[_0x5406('0x1fb')](_0x5ef398)[_0x5406('0xb4')](sendMessageReschedule(_0x5ef398))[_0x5406('0xaf')](loggerCatch(_0x5406('0x1fc')));}else{_0x5ef398['message']='RUNNING';if(_[_0x5406('0xac')](_0x375a0f[0x0])||_[_0x5406('0xac')](_0x375a0f[0x0][_0x5406('0x15f')])||_[_0x5406('0xac')](_0x375a0f[0x0]['Contact']['phone'])){_0x445b00['emptyContact'](_0x5406('0x1f5'),_0x5ef398,_0x375a0f[0x0]);}else{_0x445b00[_0x5406('0xb5')](_[_0x5406('0xcb')](_0x375a0f[0x0],[_0x5406('0x114'),_0x5406('0x1fd')]))[_0x5406('0xb4')](_0x445b00[_0x5406('0x1d6')](_0x5ef398,_0x375a0f[0x0]))['catch'](_0x445b00[_0x5406('0x1fe')](_0x5406('0x201'),_0x5ef398));}}})[_0x5406('0xaf')](loggerGetContactDialer('[getContactDialerPredictive]',_0x5ef398,0x1));emitVoiceQueueSummary(_0x5ef398);};Dialer['prototype']['abandonmentRate']=function(_0x118a43,_0x29a03a,_0x587a45,_0x54fd77,_0x3a64c7,_0x15786f){loggerPredictive[_0x5406('0x7a')](_0x5406('0x202'));loggerPredictive['info'](_0x5406('0x203'),_0x118a43);loggerPredictive[_0x5406('0x7a')](_0x5406('0x204'),_0x29a03a);loggerPredictive['info'](_0x5406('0x205'),_0x587a45);loggerPredictive[_0x5406('0x7a')](_0x5406('0x206'),_0x54fd77);loggerPredictive[_0x5406('0x7a')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a64c7);loggerPredictive[_0x5406('0x7a')](_0x5406('0x83'));return new BPromise(function(_0x19d0a3,_0x4d0904){if(_0x118a43<=0x0||isNaN(_0x118a43)){return _0x4d0904(msgResponse(_0x5406('0x207'),_0x5406('0x186'),_0x5406('0x208')+_0x118a43));}if(_0x587a45<=0x0||isNaN(_0x587a45)){return _0x4d0904(msgResponse('[abandonmentRate]','Error','Ts\x20=\x20'+_0x587a45));}if(_0x54fd77<=0x0||isNaN(_0x54fd77)){return _0x4d0904(msgResponse(_0x5406('0x207'),_0x5406('0x186'),'p\x20=\x20'+_0x54fd77));}if(_0x29a03a<=0x0||isNaN(_0x29a03a)){return _0x4d0904(msgResponse(_0x5406('0x207'),_0x5406('0x186'),'interval\x20=\x20'+_0x29a03a));}if(_0x3a64c7<=0x0||isNaN(_0x3a64c7)){return _0x4d0904(msgResponse(_0x5406('0x207'),_0x5406('0x186'),_0x5406('0x209')+_0x3a64c7));}_0x15786f=_0x15786f||0x0;var _0x4beca7=0x1/_0x587a45;var _0x2a7001=0x0;var _0x57ea5f=0x0;var _0x3288e4=0x0;var _0x6d860a=0x0;for(var _0x23e32a=0x0;_0x3288e4<_0x3a64c7;_0x23e32a+=0x1){_0x57ea5f=_0x23e32a/_0x29a03a;_0x2a7001=(_0x54fd77*_0x57ea5f+_0x15786f)/_0x4beca7;_0x3288e4=erlangb(_0x2a7001,_0x118a43);_0x6d860a=_0x2a7001/_0x118a43*(0x1-erlangb(_0x2a7001,_0x118a43));}return _0x19d0a3({'erlangCalls':_0x23e32a,'erlangCallToSecond':_0x29a03a/_0x23e32a,'erlangAbandonmentRate':_0x3288e4,'erlangBusyFactor':_0x6d860a});});};Dialer[_0x5406('0x1b')][_0x5406('0x1cd')]=function(_0x36565f,_0x45ec03,_0x317380,_0x350aaf,_0x349d97,_0x400ac9){loggerPredictive[_0x5406('0x7a')](_0x5406('0x20a'));loggerPredictive[_0x5406('0x7a')](_0x5406('0x203'),_0x36565f);loggerPredictive['info'](_0x5406('0x204'),_0x45ec03);loggerPredictive[_0x5406('0x7a')](_0x5406('0x205'),_0x317380);loggerPredictive[_0x5406('0x7a')](_0x5406('0x206'),_0x350aaf);loggerPredictive[_0x5406('0x7a')](_0x5406('0x20b'),_0x349d97);loggerPredictive[_0x5406('0x7a')](_0x5406('0x83'));return new BPromise(function(_0x5eaa10,_0xc6f19f){if(_0x36565f<=0x0||isNaN(_0x36565f)){return _0xc6f19f(msgResponse('[busyFactor]',_0x5406('0x186'),'m\x20=\x20'+_0x36565f));}if(_0x317380<=0x0||isNaN(_0x317380)){return _0xc6f19f(msgResponse(_0x5406('0x20c'),_0x5406('0x186'),_0x5406('0x20d')+_0x317380));}if(_0x350aaf<=0x0||isNaN(_0x350aaf)){return _0xc6f19f(msgResponse(_0x5406('0x20c'),'Error','p\x20=\x20'+_0x350aaf));}if(_0x45ec03<=0x0||isNaN(_0x45ec03)){return _0xc6f19f(msgResponse(_0x5406('0x20c'),_0x5406('0x186'),_0x5406('0x20e')+_0x45ec03));}if(_0x349d97<=0x0||isNaN(_0x349d97)){return _0xc6f19f(msgResponse(_0x5406('0x20c'),_0x5406('0x186'),_0x5406('0x20f')+_0x349d97));}_0x400ac9=_0x400ac9||0x0;var _0x27f587=0x1/_0x317380;var _0x291434=0x0;var _0x57eadb=0x0;var _0x1fedd3=0x0;var _0xc56622=0x0;for(var _0x71b1d4=0x0;_0xc56622<_0x349d97;_0x71b1d4+=0x1){_0x57eadb=_0x71b1d4/_0x45ec03;_0x291434=(_0x350aaf*_0x57eadb+_0x400ac9)/_0x27f587;_0x1fedd3=erlangb(_0x291434,_0x36565f);_0xc56622=_0x291434/_0x36565f*(0x1-erlangb(_0x291434,_0x36565f));}return _0x5eaa10({'erlangCalls':_0x71b1d4,'erlangCallToSecond':_0x45ec03/_0x71b1d4,'erlangAbandonmentRate':_0x1fedd3,'erlangBusyFactor':_0xc56622});});};module['exports']=Dialer; \ No newline at end of file +var _0x3cfb=['outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\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','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','diff','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','string','isEmpty','\x22%s\x22\x20<%s>','error','inspect','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','pTalking','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','prototype','clearZombieChannels','undefined','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','then','checkIsBlackListIvr','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','merge','pick','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','SIP/%s','unmonitored','saveInDb','variable','amdstatus','exten','dialAMDActive','value','uniqueid','statedesc','membername','emit','custom:amd','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','AMD','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','buildObj','countbusyretry','dialGlobalMaxRetry','syncHangup','ivrAnswerCallsDay','AnswerAGI','AGI','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','cause-txt','Unknow','reason','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','dropreason','dialDropMaxRetry','Drop','calleridname','calleridnum','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','rrmemory','push','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','command','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','checkDialMethod','progressive','power','handlePower','booked','method\x20not\x20recognized','launchHandleIvr','handleIvr','loggedIn','dialActive','checkIsTrunkReachable','checkIfTime','dialGlobalInterval','[syncQueueSummary]','dialTimezone','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','object','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','outbound','dialQueueOptions','dialQueueTimeout','ACTIVE','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','responsetime','isSuccess','response','callProgressDetecting','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Drop]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','available','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact.phone','checkContactBlack','[getContactCampaign2]','dialLimitQueue','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','reachable','[getContactDialerPredictive]','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/logger','dialer','predictive','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','XCALLY_IP_AGI','127.0.0.1','roundrobin','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','syncQueueSummary','hangup','newexten','syncNewExten','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','Error','stringify','milliseconds','seconds','type','strategy','answered','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay'];(function(_0x463ab1,_0x46bf6a){var _0x349abe=function(_0xf851b){while(--_0xf851b){_0x463ab1['push'](_0x463ab1['shift']());}};_0x349abe(++_0x46bf6a);}(_0x3cfb,0x1b8));var _0xb3cf=function(_0x39ea3d,_0x1ae1ff){_0x39ea3d=_0x39ea3d-0x0;var _0x1f8167=_0x3cfb[_0x39ea3d];return _0x1f8167;};'use strict';var util=require(_0xb3cf('0x0'));var _=require(_0xb3cf('0x1'));var BPromise=require(_0xb3cf('0x2'));var uuid=require(_0xb3cf('0x3'));var moment=require(_0xb3cf('0x4'));var rr=require('rr');var md5=require(_0xb3cf('0x5'));var Redis=require(_0xb3cf('0x6'));var ut=require(_0xb3cf('0x7'));var config=require('../../../config/environment/');var logger=require(_0xb3cf('0x8'))(_0xb3cf('0x9'));var loggerBooked=require(_0xb3cf('0x8'))('booked');var loggerPredictive=require(_0xb3cf('0x8'))(_0xb3cf('0xa'));var loggerPredictiveCalls=require(_0xb3cf('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xb3cf('0x8'))('syncQueueSummary');var ami=require('../ami');config[_0xb3cf('0xb')]=_[_0xb3cf('0xc')](config[_0xb3cf('0xb')],{'host':_0xb3cf('0xd'),'port':0x18eb});var io=require(_0xb3cf('0xe'))(new Redis(config[_0xb3cf('0xb')]));var cmHopper=require(_0xb3cf('0xf'));var cmHopperHistory=require(_0xb3cf('0x10'));var cmHopperBlack=require(_0xb3cf('0x11'));var voiceQueueRt=require(_0xb3cf('0x12'));var Action=require(_0xb3cf('0x13'));var History=require(_0xb3cf('0x14'));var Final=require(_0xb3cf('0x15'));var AgentComplete=require(_0xb3cf('0x16'));var QueueCallerAbandon=require(_0xb3cf('0x17'));var Hangup=require('./hangup');var ipAgi=process['env'][_0xb3cf('0x18')]||_0xb3cf('0x19');var strategy={'rrmemory':'rrmemory','roundrobin':_0xb3cf('0x1a')};var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x174f92){this[_0xb3cf('0x1b')]=this[_0xb3cf('0x1b')]?this['tail'][_0xb3cf('0x1c')](_0x174f92):_0x174f92();};function Dialer(_0x87f87,_0x3abe89){this[_0xb3cf('0x1d')]=new Sequence();this[_0xb3cf('0x1e')]=_0x3abe89;this[_0xb3cf('0x1f')]=_0x87f87[_0xb3cf('0x1f')];this[_0xb3cf('0x20')]=_0x87f87[_0xb3cf('0x20')];this[_0xb3cf('0x21')]=_0x87f87['agents'];this[_0xb3cf('0x22')]=_0x87f87[_0xb3cf('0x22')];this[_0xb3cf('0x23')]=config[_0xb3cf('0x23')]||0x2;this['channels']={};this[_0xb3cf('0x24')]={};this[_0xb3cf('0x25')]={};this[_0xb3cf('0x26')]={};this[_0xb3cf('0x27')]={};this[_0xb3cf('0x28')]={};this[_0xb3cf('0x29')]={};this[_0xb3cf('0x2a')]={};this[_0xb3cf('0x2b')]={};this[_0xb3cf('0x2c')]={};ami['on'](_0xb3cf('0x2d'),this['syncAgentConnect'][_0xb3cf('0x2e')](this));ami['on'](_0xb3cf('0x2f'),this[_0xb3cf('0x30')][_0xb3cf('0x2e')](this));ami['on'](_0xb3cf('0x31'),this[_0xb3cf('0x32')][_0xb3cf('0x2e')](this));ami['on'](_0xb3cf('0x33'),this[_0xb3cf('0x34')][_0xb3cf('0x2e')](this));ami['on']('custom:queuesummary',this[_0xb3cf('0x35')][_0xb3cf('0x2e')](this));ami['on'](_0xb3cf('0x36'),this['syncHangup']['bind'](this));ami['on'](_0xb3cf('0x37'),this[_0xb3cf('0x38')]['bind'](this));ami['on']('varset',this[_0xb3cf('0x39')][_0xb3cf('0x2e')](this));ami['on']('queuemember',this[_0xb3cf('0x3a')][_0xb3cf('0x2e')](this));ami['on'](_0xb3cf('0x3b'),this[_0xb3cf('0x3c')][_0xb3cf('0x2e')](this));this[_0xb3cf('0x3d')]();this[_0xb3cf('0x3e')]();}function isNotNull(_0x11efb3){return _0x11efb3!==null&&!_[_0xb3cf('0x3f')](_0x11efb3);}function checkIsLoggedIn(_0x2fc46b,_0x4c71fe){return function(){if(_0x4c71fe<=0x0){_0x2fc46b[_0xb3cf('0x40')]='AGENTS_NOT_LOGGED';throw _0x2fc46b['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x2cf5a9){return _0x2cf5a9;}function checkIsActive(_0x342a5b,_0x5da98d){return function(){if(!isActive(_0x5da98d)){_0x342a5b[_0xb3cf('0x40')]=_0xb3cf('0x41');throw _0x342a5b[_0xb3cf('0x42')]+_0xb3cf('0x43');}};}function checkInterval(_0x288c3f){return function(){if(!isNotNull(_0x288c3f[_0xb3cf('0x44')])){_0x288c3f['message']=_0xb3cf('0x45');throw _0x288c3f['name']+_0xb3cf('0x46');}if(!isNotNull(_0x288c3f[_0xb3cf('0x44')][_0xb3cf('0x47')])){_0x288c3f[_0xb3cf('0x40')]=_0xb3cf('0x45');throw _0x288c3f[_0xb3cf('0x42')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x288c3f[_0xb3cf('0x44')]['Intervals']))){_0x288c3f['message']=_0xb3cf('0x45');throw _0x288c3f['name']+_0xb3cf('0x46');}};}function msgResponse(_0x18e925,_0x1108c7,_0x1662ba){return{'action':_0x18e925,'response':_0x1108c7,'message':_0x1662ba,'stack':_0x1662ba};}function myreject(_0x13e2b2){return function(_0x2f9eec){return _0x13e2b2(msgResponse('[ifTime][Action]',_0xb3cf('0x48'),JSON[_0xb3cf('0x49')](_0x2f9eec)));};}function getSeconds(_0x2219bf,_0x2e114e){var _0x56e147=moment(_0x2219bf)[_0xb3cf('0x4a')](0x0);var _0x4c3b82=moment(_0x2e114e)[_0xb3cf('0x4a')](0x0);return _0x56e147['diff'](_0x4c3b82,_0xb3cf('0x4b'));}function emit(_0x196333,_0x402413,_0x5a2cc5){io['to'](_0x196333)['emit'](_0x402413,_0x5a2cc5);}function emitVoiceQueueSummary(_0x3010c3){if(_0x3010c3[_0xb3cf('0x4c')]==='outbound'){var _0x4e01e4={'id':_0x3010c3['id'],'name':_0x3010c3['name'],'strategy':_0x3010c3[_0xb3cf('0x4d')],'answered':_0x3010c3[_0xb3cf('0x4e')],'available':_0x3010c3['available'],'loggedIn':_0x3010c3['loggedIn'],'pTalking':_0x3010c3['pTalking'],'sumBillable':_0x3010c3[_0xb3cf('0x4f')],'sumDuration':_0x3010c3[_0xb3cf('0x50')],'sumHoldTime':_0x3010c3[_0xb3cf('0x51')]||0x0,'talking':_0x3010c3[_0xb3cf('0x52')],'total':_0x3010c3['total'],'type':_0x3010c3['type'],'unmanaged':_0x3010c3[_0xb3cf('0x53')],'abandoned':_0x3010c3[_0xb3cf('0x54')],'waiting':_0x3010c3[_0xb3cf('0x55')],'loggedInDb':_0x3010c3[_0xb3cf('0x56')],'dialActive':_0x3010c3['dialActive'],'dialMethod':_0x3010c3[_0xb3cf('0x57')],'dialOriginateCallerIdName':_0x3010c3[_0xb3cf('0x58')],'dialOriginateCallerIdNumber':_0x3010c3[_0xb3cf('0x59')],'dialOriginateTimeout':_0x3010c3[_0xb3cf('0x5a')],'dialPrefix':_0x3010c3['dialPrefix'],'outboundAnswerAgiCallsDay':_0x3010c3[_0xb3cf('0x5b')],'outboundAnswerCallsDay':_0x3010c3[_0xb3cf('0x5c')],'outboundBlacklistCallsDay':_0x3010c3[_0xb3cf('0x5d')],'outboundBusyCallsDay':_0x3010c3['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x3010c3[_0xb3cf('0x5e')],'outboundDropCallsDayACS':_0x3010c3['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x3010c3['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x3010c3[_0xb3cf('0x5f')],'outboundNoAnswerCallsDay':_0x3010c3[_0xb3cf('0x60')],'outboundNoSuchCallsDay':_0x3010c3['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x3010c3['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3010c3[_0xb3cf('0x61')],'outboundRejectCallsDay':_0x3010c3[_0xb3cf('0x62')],'outboundUnknownCallsDay':_0x3010c3[_0xb3cf('0x63')],'predictiveIntervalAnsweredCalls':_0x3010c3['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x3010c3[_0xb3cf('0x64')],'predictiveIntervalAvgTalktime':_0x3010c3[_0xb3cf('0x65')],'predictiveIntervalDroppedCallsCallersExit':_0x3010c3[_0xb3cf('0x66')],'predictiveIntervalDroppedCallsTimeout':_0x3010c3[_0xb3cf('0x67')],'predictiveIntervalErlangCalls':_0x3010c3[_0xb3cf('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0x3010c3[_0xb3cf('0x69')],'predictiveIntervalHitRate':_0x3010c3[_0xb3cf('0x6a')],'predictiveIntervalMultiplicativeFactor':_0x3010c3[_0xb3cf('0x6b')],'predictiveIntervalPauses':_0x3010c3['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x3010c3[_0xb3cf('0x6c')],'predictiveIntervalTotalCalls':_0x3010c3[_0xb3cf('0x6d')],'message':_0x3010c3[_0xb3cf('0x40')],'originated':_0x3010c3[_0xb3cf('0x6e')],'erlangCalls':_0x3010c3[_0xb3cf('0x6f')],'erlangCallToSecond':_0x3010c3[_0xb3cf('0x70')],'erlangAbandonmentRate':_0x3010c3['erlangAbandonmentRate'],'erlangBusyFactor':_0x3010c3[_0xb3cf('0x71')],'startPredictive':_0x3010c3[_0xb3cf('0x28')],'startProgressive':_0x3010c3[_0xb3cf('0x29')]};if(_0x3010c3[_0xb3cf('0x72')]){_0x4e01e4[_0xb3cf('0x72')]={'id':_0x3010c3[_0xb3cf('0x72')]['id'],'name':_0x3010c3[_0xb3cf('0x72')][_0xb3cf('0x42')],'active':_0x3010c3[_0xb3cf('0x72')][_0xb3cf('0x73')],'callerid':_0x3010c3[_0xb3cf('0x72')][_0xb3cf('0x74')]};}if(_0x3010c3['Interval']){_0x4e01e4[_0xb3cf('0x44')]={'id':_0x3010c3['Interval']['id'],'name':_0x3010c3[_0xb3cf('0x44')]['name']};}var _0x2ef02b=md5(JSON['stringify'](_0x4e01e4));if(_0x3010c3[_0xb3cf('0x5')]!==_0x2ef02b){_0x3010c3['md5']=_0x2ef02b;emit(util[_0xb3cf('0x75')](_0xb3cf('0x76'),_0x4e01e4[_0xb3cf('0x42')]),_0xb3cf('0x77'),_0x4e01e4);}}}function emitCampaignSummary(_0x529e22){if(_0x529e22['type']===_0xb3cf('0x78')){emit(util[_0xb3cf('0x75')](_0xb3cf('0x79'),_0x529e22[_0xb3cf('0x42')]),_0xb3cf('0x7a'),_0x529e22);}}function checkGetDataPredictive(_0x40104e){if(isNotNull(_0x40104e)&&!_['isEmpty'](_0x40104e)){loggerPredictive['info'](_0xb3cf('0x7b'));loggerPredictive[_0xb3cf('0x7c')](_0xb3cf('0x7d'),_0x40104e[_0xb3cf('0x6d')]);loggerPredictive[_0xb3cf('0x7c')](_0xb3cf('0x7e'),_0x40104e[_0xb3cf('0x7f')]);loggerPredictive[_0xb3cf('0x7c')](_0xb3cf('0x80'),_0x40104e[_0xb3cf('0x67')]);loggerPredictive['info'](_0xb3cf('0x81'),_0x40104e[_0xb3cf('0x66')]);loggerPredictive[_0xb3cf('0x7c')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x40104e[_0xb3cf('0x64')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x40104e[_0xb3cf('0x65')]);loggerPredictive['info'](_0xb3cf('0x82'));if(_0x40104e['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x40104e['predictiveIntervalAvgTalktime'])&&_0x40104e['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xb3cf('0x7c')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xb3cf('0x3f')](_0x40104e[_0xb3cf('0x64')])&&_0x40104e[_0xb3cf('0x64')]>0x0){return!![];}loggerPredictive[_0xb3cf('0x7c')](_0xb3cf('0x83'));}else{loggerPredictive['info'](_0xb3cf('0x84'));}}else{loggerPredictive[_0xb3cf('0x7c')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x238190){return function(_0x15f110){loggerPredictive[_0xb3cf('0x7c')](_0xb3cf('0x85'));loggerPredictive[_0xb3cf('0x7c')](_0xb3cf('0x86'),_0x15f110[_0xb3cf('0x6f')]);loggerPredictive['info'](_0xb3cf('0x87'),_0x15f110[_0xb3cf('0x70')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x15f110[_0xb3cf('0x88')]);loggerPredictive[_0xb3cf('0x7c')](_0xb3cf('0x89'),_0x15f110[_0xb3cf('0x71')]);loggerPredictive[_0xb3cf('0x7c')](_0xb3cf('0x8a'),_0x15f110[_0xb3cf('0x88')]);loggerPredictive[_0xb3cf('0x7c')](_0xb3cf('0x82'));_['merge'](_0x238190,_0x15f110);};}function getDiff(_0x42b570){var _0xfbb3d4=moment()['milliseconds'](0x0);var _0x5093ef=moment(_0x42b570)[_0xb3cf('0x4a')](0x0);return _0xfbb3d4[_0xb3cf('0x8b')](_0x5093ef,'seconds');}function ifInterval(_0x45b15f,_0x63aaa){if(_[_0xb3cf('0x3f')](_0x63aaa)){return![];}return getDiff(_0x63aaa)<_0x45b15f*0x3c;}function freeVariablesPredictive(_0x5a678a){if(isNotNull(_0x5a678a)){if(!_['isUndefined'](_0x5a678a[_0xb3cf('0x29')])){_0x5a678a[_0xb3cf('0x29')]=undefined;loggerPredictive[_0xb3cf('0x7c')](_0x5a678a[_0xb3cf('0x42')],_0xb3cf('0x8c'));}if(!_[_0xb3cf('0x3f')](_0x5a678a[_0xb3cf('0x28')])){_0x5a678a[_0xb3cf('0x28')]=undefined;loggerPredictive[_0xb3cf('0x7c')](_0x5a678a[_0xb3cf('0x42')],_0xb3cf('0x8d'));}if(!_['isUndefined'](_0x5a678a[_0xb3cf('0x8e')])){clearInterval(_0x5a678a[_0xb3cf('0x8e')]);_0x5a678a[_0xb3cf('0x8e')]=undefined;loggerPredictive[_0xb3cf('0x7c')](_0x5a678a[_0xb3cf('0x42')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x3a447e,_0x3b85ba){if(_0x3b85ba===0x0){return 0x0;}var _0x4c2ffe=0x1;for(var _0x24c591=0x1;_0x24c591<=_0x3b85ba;_0x24c591+=0x1){_0x4c2ffe=0x1+_0x4c2ffe*_0x24c591/_0x3a447e;}return 0x1/_0x4c2ffe;}function isVoiceQueueOutbound(_0x4bfe81){return _0x4bfe81==='outbound';}function isNotPreview(_0x2ef9e8){return _0x2ef9e8!=='preview';}function isCampaignIvr(_0x4a5ab3){return _0x4a5ab3===_0xb3cf('0x78');}function getCallerId(_0x28b48d,_0x3a557f,_0x4dc30e){if(!_['isUndefined'](_0x4dc30e)&&typeof _0x4dc30e===_0xb3cf('0x8f')&&!_[_0xb3cf('0x90')](_0x4dc30e)){if(!_['isUndefined'](_0x3a557f)&&typeof _0x3a557f===_0xb3cf('0x8f')&&!_['isEmpty'](_0x3a557f)){return util[_0xb3cf('0x75')](_0xb3cf('0x91'),_0x3a557f,_0x4dc30e);}return util[_0xb3cf('0x75')]('\x22%s\x22\x20<%s>',_0x4dc30e,_0x4dc30e);}if(!_[_0xb3cf('0x3f')](_0x28b48d)&&typeof _0x28b48d===_0xb3cf('0x8f')&&!_[_0xb3cf('0x90')](_0x28b48d)){return _0x28b48d;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x500887,_0x30d785){return function(_0x531960){freeVariablesPredictive(_0x30d785);emitVoiceQueueSummary(_0x30d785);emitCampaignSummary(_0x30d785);loggerSyncQueueSummary[_0xb3cf('0x92')](_0x500887,util[_0xb3cf('0x93')](_0x531960,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3e0f55,_0x4ac9de){return function(_0x596c2f){loggerPredictive[_0xb3cf('0x92')](_0x4ac9de['name'],_0x3e0f55);loggerPredictive[_0xb3cf('0x92')](_0x596c2f[_0xb3cf('0x94')]);freeVariablesPredictive(_0x4ac9de);};}function loggerCatch(_0x34b2ef){return function(_0x3784ab){logger['error'](_0x34b2ef,util['inspect'](_0x3784ab,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x29495b){return _0x29495b&&!_['isUndefined'](_0x29495b)&&_0x29495b[_0xb3cf('0x95')]>0x0;}function decremetOriginate(_0x212064){if(!_[_0xb3cf('0x3f')](_0x212064)&&_0x212064!==null){if(typeof _0x212064[_0xb3cf('0x6e')]!=='undefined'){if(_0x212064['originated']>0x0){_0x212064['originated']-=0x1;}else{logger[_0xb3cf('0x92')](_0xb3cf('0x96'));}}}else{logger[_0xb3cf('0x92')](_0xb3cf('0x97'));}}function checkContactLowerLimitOriginate(_0x548f39,_0x19f2de,_0x255168){if(_0x19f2de>_0x255168){for(var _0x37df71=0x0;_0x37df71<_0x19f2de-_0x255168;_0x37df71+=0x1){decremetOriginate(_0x548f39);}}}function loggerGetContactDialer(_0xb3c5d2,_0x8938c7,_0x3d4c3c){return function(_0x1753b4){checkContactLowerLimitOriginate(_0x8938c7,_0x3d4c3c,0x0);logger[_0xb3cf('0x92')](_0xb3c5d2,util[_0xb3cf('0x93')](_0x1753b4,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3fbf5f){return function(_0x43119e){if(isNotNull(_0x43119e)&&isNotNull(_0x43119e[0x0])){if(_0x43119e[0x0][_0xb3cf('0x98')]>0x0){_0x3fbf5f['message']=_0xb3cf('0x99');logger[_0xb3cf('0x7c')](_0xb3cf('0x9a')+_0x3fbf5f[_0xb3cf('0x42')],_0x43119e[0x0][_0xb3cf('0x98')],_0xb3cf('0x9b'));}else{_0x3fbf5f['message']=_0xb3cf('0x9c');logger[_0xb3cf('0x7c')]('[getContactDialer2][Empty]'+_0x3fbf5f[_0xb3cf('0x42')]);}}};}function notSendMessagesQueue(_0x1a9686){if(_0x1a9686[_0xb3cf('0x9d')]){freeVariablesPredictive(_0x1a9686);if(_0x1a9686[_0xb3cf('0x6e')]===0x0&&_0x1a9686[_0xb3cf('0x52')]===0x0&&_0x1a9686[_0xb3cf('0x55')]===0x0&&(_0x1a9686[_0xb3cf('0x9e')]||0x0)===0x0){_0x1a9686[_0xb3cf('0x9d')]=![];_0x1a9686['available']=0x0;_0x1a9686['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0xb3cf('0x92')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x1a9686[_0xb3cf('0x42')],_0xb3cf('0x9f'));}else{_0x1a9686[_0xb3cf('0x40')]=_0xb3cf('0xa0');loggerSyncQueueSummary['error'](_0xb3cf('0xa1'),_0x1a9686[_0xb3cf('0x42')],_0xb3cf('0xa2'));}emitVoiceQueueSummary(_0x1a9686);}}function notSendMessagesCampaign(_0x565605){if(_0x565605['sendMessageOneNotActive']){if(_0x565605[_0xb3cf('0x6e')]===0x0){_0x565605[_0xb3cf('0x9d')]=![];_0x565605['message']=_0xb3cf('0x41');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x565605['name'],_0xb3cf('0x9f'));}else{_0x565605[_0xb3cf('0x40')]=_0xb3cf('0xa0');loggerSyncQueueSummary[_0xb3cf('0x92')](_0xb3cf('0xa3'),_0x565605[_0xb3cf('0x42')],'is\x20disactive');}emitCampaignSummary(_0x565605);}}function createObjHistory(_0x3edb17,_0x55880a,_0x219e52,_0x230c79,_0x524318){_0x3edb17[_0xb3cf('0x40')]=_0x219e52;var _0x4446c4=new Action(_0x3edb17,_0x55880a);var _0x10bf92=new History(_0x4446c4);_0x10bf92[_0xb3cf('0xa4')]=_0x230c79;_0x10bf92['statedesc']=_0x524318;_0x10bf92[_0xb3cf('0xa5')]=_0x4446c4[_0xb3cf('0xa6')];return _0x10bf92;}Dialer[_0xb3cf('0xa7')]['loopClearZombieChannels']=function(){var _0x1865b6=this;setInterval(function(){_0x1865b6[_0xb3cf('0xa8')](_0x1865b6[_0xb3cf('0x26')],'[uniqueid]');_0x1865b6['clearZombieChannels'](_0x1865b6[_0xb3cf('0x24')],'[actions]');},0x32c8);};Dialer[_0xb3cf('0xa7')][_0xb3cf('0xa8')]=function(_0x462845,_0x821b1c){var _0x1f34e7=this;for(var _0x5d7f45 in _0x462845){if(typeof _0x462845[_0x5d7f45]!==_0xb3cf('0xa9')){this['sequence']['enqueue'](function(){if(!_[_0xb3cf('0xaa')](_0x462845[_0x5d7f45])){return ami[_0xb3cf('0xab')]({'action':_0xb3cf('0xac'),'channel':_0x462845[_0x5d7f45][_0xb3cf('0xad')]})[_0xb3cf('0xae')](function(_0x5d472b){if(_0x5d472b[_0xb3cf('0x40')]===_0xb3cf('0xaf')){setTimeout(function(){if(_0x462845[_0x5d7f45]&&_0x462845[_0x5d7f45][_0xb3cf('0x4c')]!==_0xb3cf('0x78')){_0x1f34e7[_0xb3cf('0xb0')](_0x1f34e7[_0xb3cf('0x1f')][_0x462845[_0x5d7f45]['queue']]);logger[_0xb3cf('0x92')](_0xb3cf('0xb1'),_0x821b1c,_0x5d7f45,_0x462845[_0x5d7f45][_0xb3cf('0xb2')]);delete _0x462845[_0x5d7f45];}if(_0x462845[_0x5d7f45]&&_0x462845[_0x5d7f45][_0xb3cf('0x4c')]===_0xb3cf('0x78')){_0x1f34e7[_0xb3cf('0xb0')](_0x1f34e7[_0xb3cf('0x20')][_0x462845[_0x5d7f45][_0xb3cf('0xb2')]]);logger[_0xb3cf('0x92')]('[Dialer][checkChannel][ivr]',_0x821b1c,_0x5d7f45,_0x462845[_0x5d7f45][_0xb3cf('0xb2')]);delete _0x462845[_0x5d7f45];}},0x2328);}});}});}}};Dialer['prototype'][_0xb3cf('0xb3')]=function(_0x3eafb6){return BPromise[_0xb3cf('0xb4')]()['then'](cmHopper[_0xb3cf('0xb3')](_0x3eafb6))[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0xb5')));};Dialer[_0xb3cf('0xa7')]['checkIsBlackList']=function(_0x2edcdd){return BPromise[_0xb3cf('0xb4')]()['then'](cmHopperBlack[_0xb3cf('0xb6')](_0x2edcdd))[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0xb7')));};Dialer[_0xb3cf('0xa7')]['checkIsBlackListIvr']=function(_0x25033e){return BPromise[_0xb3cf('0xb4')]()[_0xb3cf('0xb8')](cmHopperBlack[_0xb3cf('0xb9')](_0x25033e))['catch'](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xb3cf('0xa7')][_0xb3cf('0xba')]=function(_0x5b603d){return BPromise[_0xb3cf('0xb4')]()['then'](cmHopperHistory['avgHandleTime'](_0x5b603d))[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0xbb')));};Dialer[_0xb3cf('0xa7')][_0xb3cf('0xbc')]=function(_0x4eff98){return BPromise[_0xb3cf('0xb4')]()[_0xb3cf('0xb8')](cmHopper[_0xb3cf('0xbc')](_0x4eff98))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0xb3cf('0xa7')][_0xb3cf('0xbd')]=function(_0x4fd7a0,_0x430fd6,_0x228174){return BPromise[_0xb3cf('0xb4')]()['then'](cmHopper['unlockContact'](_0x4fd7a0,_0x430fd6,_0x228174))[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0xbe')));};Dialer['prototype'][_0xb3cf('0xbf')]=function(_0x215c65,_0x1e31d4,_0x2ed632,_0x5904dc,_0xa19e2a){return BPromise[_0xb3cf('0xb4')]()[_0xb3cf('0xb8')](cmHopper[_0xb3cf('0xbf')](_0x215c65,_0x1e31d4,_0x2ed632,_0x5904dc))['catch'](function(_0x54ee13){_0xa19e2a['temp']-=_0x2ed632;_0xa19e2a['temp']=_0xa19e2a[_0xb3cf('0xc0')]>0x0?_0xa19e2a['temp']:0x0;loggerCatch('[getContactDialer]\x20')(_0x54ee13);});};Dialer[_0xb3cf('0xa7')][_0xb3cf('0xc1')]=function(_0x728d34,_0x34cfef,_0x4730d2,_0x5546fe){return BPromise[_0xb3cf('0xb4')]()[_0xb3cf('0xb8')](cmHopper['getContactDialerIvr'](_0x728d34,_0x34cfef,_0x4730d2))[_0xb3cf('0xae')](function(_0x50ae68){_0x5546fe[_0xb3cf('0xc0')]-=_0x34cfef;_0x5546fe[_0xb3cf('0xc0')]=_0x5546fe['temp']>0x0?_0x5546fe['temp']:0x0;loggerCatch(_0xb3cf('0xc2'))(_0x50ae68);});};Dialer['prototype'][_0xb3cf('0xc3')]=function(_0x168ffe){return BPromise[_0xb3cf('0xb4')]()[_0xb3cf('0xb8')](voiceQueueRt['getVoiceQueueRtPauses'](_0x168ffe))['catch'](loggerCatch(_0xb3cf('0xc4')));};Dialer[_0xb3cf('0xa7')][_0xb3cf('0xc5')]=function(_0x23fbcb){return BPromise[_0xb3cf('0xb4')]()[_0xb3cf('0xb8')](cmHopper[_0xb3cf('0xc5')](_0x23fbcb))[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0xc6')));};Dialer[_0xb3cf('0xa7')][_0xb3cf('0xc7')]=function(_0x18d19a){return BPromise[_0xb3cf('0xb4')]()['then'](cmHopperHistory[_0xb3cf('0xc7')](_0x18d19a))[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0xc8')));};Dialer[_0xb3cf('0xa7')][_0xb3cf('0xb0')]=function(_0x1a7c01){if(!_[_0xb3cf('0x3f')](_0x1a7c01)&&_0x1a7c01!==null){if(typeof _0x1a7c01[_0xb3cf('0x6e')]!=='undefined'){if(_0x1a7c01[_0xb3cf('0x6e')]>0x0){_0x1a7c01[_0xb3cf('0x6e')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0xb3cf('0xc9'));}};Dialer[_0xb3cf('0xa7')][_0xb3cf('0xca')]=function(_0x49faa1,_0x43b0d){var _0x14a822=this;return function(_0x4640ba){_0x14a822[_0xb3cf('0xb0')](_0x43b0d);logger[_0xb3cf('0x92')](_0x49faa1,util[_0xb3cf('0x93')](_0x4640ba,{'showHidden':![],'depth':null}));};};Dialer[_0xb3cf('0xa7')][_0xb3cf('0xcb')]=function(_0x37b3ff,_0x1e501b,_0x1a757a){var _0x1f9345={'state':0x19,'statedesc':_0xb3cf('0xcc')};this[_0xb3cf('0xb0')](_0x1e501b);this['saveInDb'](_[_0xb3cf('0xcd')](_0x1f9345,_[_0xb3cf('0xce')](_0x1a757a,[_0xb3cf('0xcf'),_0xb3cf('0xd0'),_0xb3cf('0xd1'),'VoiceQueueId',_0xb3cf('0xd2')])),_0xb3cf('0xd3'),_0xb3cf('0xd4'));logger[_0xb3cf('0x92')](_0x37b3ff);};Dialer[_0xb3cf('0xa7')]['isSuccess']=function(_0x169e6f){return _0x169e6f===_0xb3cf('0xd5');};Dialer[_0xb3cf('0xa7')][_0xb3cf('0xd6')]=function(_0x48ebf2){return!_['isUndefined'](_0x48ebf2)&&_0x48ebf2&&!_[_0xb3cf('0x3f')](_0x48ebf2[_0xb3cf('0x42')])&&!_['isUndefined'](_0x48ebf2[_0xb3cf('0x73')])&&_0x48ebf2[_0xb3cf('0x73')]&&(this[_0xb3cf('0x22')][util['format'](_0xb3cf('0xd7'),_0x48ebf2[_0xb3cf('0x42')])][_0xb3cf('0xac')]==='reachable'||this[_0xb3cf('0x22')][util[_0xb3cf('0x75')](_0xb3cf('0xd7'),_0x48ebf2[_0xb3cf('0x42')])][_0xb3cf('0xac')]===_0xb3cf('0xd8'));};Dialer[_0xb3cf('0xa7')][_0xb3cf('0xd9')]=function(_0x92a7ab,_0x1728a1,_0x1d7396){this[_0xb3cf('0xc7')](_0x92a7ab)[_0xb3cf('0xae')](loggerCatch(_0x1728a1));this[_0xb3cf('0xc5')](_0x92a7ab)[_0xb3cf('0xae')](loggerCatch(_0x1d7396));};Dialer[_0xb3cf('0xa7')]['syncVarSet']=function(_0x4651f1){var _0x15dd33=this[_0xb3cf('0x26')][_0x4651f1['uniqueid']];var _0x151c9f;if(!_['isNil'](_0x4651f1)&&!_['isNil'](_0x4651f1['variable'])&&!_[_0xb3cf('0xaa')](_0x4651f1[_0xb3cf('0xda')][_0xb3cf('0xdb')])&&_0x4651f1[_0xb3cf('0xdc')]==='xcally-motion-dialer'&&_0x15dd33){if(_0x15dd33[_0xb3cf('0x4c')]!==_0xb3cf('0x78')&&this[_0xb3cf('0x1f')][_0x15dd33['queue']][_0xb3cf('0xdd')]&&_0x4651f1[_0xb3cf('0xde')]==='HANGUP'){delete this[_0xb3cf('0x26')][_0x4651f1[_0xb3cf('0xdf')]];this[_0xb3cf('0xb0')](this[_0xb3cf('0x1f')][_0x15dd33[_0xb3cf('0xb2')]]);this[_0xb3cf('0x1f')][_0x15dd33[_0xb3cf('0xb2')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x15dd33[_0xb3cf('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;_0x151c9f=new Hangup(_0x15dd33,_0x4651f1);_0x151c9f[_0xb3cf('0xa4')]=0x12;_0x151c9f[_0xb3cf('0xe0')]='HangupInAMD';_0x151c9f[_0xb3cf('0xe1')]='AMD';ami[_0xb3cf('0xe2')](_0xb3cf('0xe3'),ut['buildObj'](_0x151c9f,_0xb3cf('0xe4')));this[_0xb3cf('0xd9')](_0x151c9f,_0xb3cf('0xe5'),_0xb3cf('0xe6'));}if(_0x15dd33[_0xb3cf('0x4c')]!==_0xb3cf('0x78')&&this[_0xb3cf('0x1f')][_0x15dd33[_0xb3cf('0xb2')]][_0xb3cf('0xdd')]&&_0x4651f1['value']==='MACHINE'){var _0x29a829=this;return new BPromise(function(_0x44a927,_0x4a4158){delete _0x29a829[_0xb3cf('0x26')][_0x4651f1[_0xb3cf('0xdf')]];_0x29a829['updateOriginated'](_0x29a829[_0xb3cf('0x1f')][_0x15dd33[_0xb3cf('0xb2')]]);_0x29a829[_0xb3cf('0x1f')][_0x15dd33['queue']][_0xb3cf('0x5c')]+=0x1;_0x29a829[_0xb3cf('0x1f')][_0x15dd33['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x31f8c2=_0x29a829[_0xb3cf('0x1f')][_0x15dd33[_0xb3cf('0xb2')]];var _0x22f956=new Hangup(_0x15dd33,_0x4651f1);_0x22f956[_0xb3cf('0xa4')]=0x13;_0x22f956[_0xb3cf('0xe0')]='Machine';_0x22f956[_0xb3cf('0xe1')]=_0xb3cf('0xe7');_0x22f956[_0xb3cf('0xe8')]+=0x1;_0x22f956[_0xb3cf('0xe9')]+=0x1;_0x22f956['amd']=!![];ami[_0xb3cf('0xe2')](_0xb3cf('0xe3'),ut['buildObj'](_0x22f956,_0xb3cf('0xe4')));_0x29a829[_0xb3cf('0xc7')](_0x22f956)[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0xea')));if(_0x22f956['countbusyretry']+_0x22f956[_0xb3cf('0xeb')]+_0x22f956[_0xb3cf('0xec')]+_0x22f956[_0xb3cf('0xed')]+_0x22f956[_0xb3cf('0xee')]+_0x22f956[_0xb3cf('0xef')]+_0x22f956[_0xb3cf('0xe8')]+_0x22f956[_0xb3cf('0xf0')]>=_0x31f8c2['dialGlobalMaxRetry']){_0x29a829[_0xb3cf('0xf1')](_0x22f956,_0x44a927,_0x4a4158,_0xb3cf('0xf2'));}else{if(_0x22f956[_0xb3cf('0xe8')]>=_0x31f8c2[_0xb3cf('0xf3')]){_0x29a829[_0xb3cf('0xf4')](_0x22f956,_0x44a927,_0x4a4158,'reason\x2019\x20machine....');}else{_0x29a829[_0xb3cf('0xbc')]({'active':![],'countmachineretry':_0x22f956[_0xb3cf('0xe8')],'scheduledat':moment()[_0xb3cf('0xf5')](_0x31f8c2[_0xb3cf('0xf6')],_0xb3cf('0xf7'))[_0xb3cf('0x75')](_0xb3cf('0xf8')),'ContactId':_0x22f956[_0xb3cf('0xcf')],'ListId':_0x22f956['ListId'],'VoiceQueueId':_0x22f956[_0xb3cf('0xf9')]||undefined,'CampaignId':_0x22f956[_0xb3cf('0xd2')]||undefined})[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0xfa')));_0x44a927({'reschedule':0x1});}}});}if(_0x15dd33[_0xb3cf('0x4c')]===_0xb3cf('0x78')&&this['campaigns'][_0x15dd33[_0xb3cf('0xb2')]][_0xb3cf('0xdd')]&&_0x4651f1[_0xb3cf('0xde')]==='HANGUP'){delete this['uniqueId'][_0x4651f1[_0xb3cf('0xdf')]];this[_0xb3cf('0xb0')](this[_0xb3cf('0x20')][_0x15dd33['queue']]);_0x151c9f=new Hangup(_0x15dd33,_0x4651f1);_0x151c9f[_0xb3cf('0xa4')]=0x12;_0x151c9f[_0xb3cf('0xe0')]=_0xb3cf('0xfb');_0x151c9f[_0xb3cf('0xe1')]='AMD';ami['emit'](_0xb3cf('0xe3'),ut['buildObj'](_0x151c9f,_0xb3cf('0xe4')));this[_0xb3cf('0xd9')](_0x151c9f,_0xb3cf('0xfc'),_0xb3cf('0xfd'));}if(_0x15dd33[_0xb3cf('0x4c')]===_0xb3cf('0x78')&&this[_0xb3cf('0x20')][_0x15dd33[_0xb3cf('0xb2')]][_0xb3cf('0xdd')]&&_0x4651f1['value']==='MACHINE'){var _0x29a829=this;return new BPromise(function(_0x4c1f92,_0xc6d299){delete _0x29a829[_0xb3cf('0x26')][_0x4651f1['uniqueid']];_0x29a829['updateOriginated'](_0x29a829[_0xb3cf('0x20')][_0x15dd33[_0xb3cf('0xb2')]]);_0x29a829[_0xb3cf('0x20')][_0x15dd33[_0xb3cf('0xb2')]][_0xb3cf('0x5c')]+=0x1;_0x29a829[_0xb3cf('0x20')][_0x15dd33['queue']][_0xb3cf('0x5b')]+=0x1;var _0x169c75=_0x29a829[_0xb3cf('0x20')][_0x15dd33[_0xb3cf('0xb2')]];var _0x10e2bd=new Hangup(_0x15dd33,_0x4651f1);_0x10e2bd[_0xb3cf('0xa4')]=0x13;_0x10e2bd[_0xb3cf('0xe0')]=_0xb3cf('0xfe');_0x10e2bd[_0xb3cf('0xe1')]=_0xb3cf('0xe7');_0x10e2bd[_0xb3cf('0xe8')]+=0x1;_0x10e2bd[_0xb3cf('0xe9')]+=0x1;_0x10e2bd['amd']=!![];ami[_0xb3cf('0xe2')](_0xb3cf('0xe3'),ut[_0xb3cf('0xff')](_0x10e2bd,_0xb3cf('0xe4')));_0x29a829['createHistory'](_0x10e2bd)['catch'](loggerCatch(_0xb3cf('0xea')));if(_0x10e2bd[_0xb3cf('0x100')]+_0x10e2bd[_0xb3cf('0xeb')]+_0x10e2bd[_0xb3cf('0xec')]+_0x10e2bd[_0xb3cf('0xed')]+_0x10e2bd[_0xb3cf('0xee')]+_0x10e2bd[_0xb3cf('0xef')]+_0x10e2bd[_0xb3cf('0xe8')]+_0x10e2bd[_0xb3cf('0xf0')]>=_0x169c75[_0xb3cf('0x101')]){_0x29a829[_0xb3cf('0xf1')](_0x10e2bd,_0x4c1f92,_0xc6d299,'reason19\x20machine....');}else{if(_0x10e2bd[_0xb3cf('0xe8')]>=_0x169c75[_0xb3cf('0xf3')]){_0x29a829[_0xb3cf('0xf4')](_0x10e2bd,_0x4c1f92,_0xc6d299,'reason\x2019\x20machine....');}else{_0x29a829[_0xb3cf('0xbc')]({'active':![],'countmachineretry':_0x10e2bd[_0xb3cf('0xe8')],'scheduledat':moment()['add'](_0x169c75[_0xb3cf('0xf6')],_0xb3cf('0xf7'))[_0xb3cf('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x10e2bd['ContactId'],'ListId':_0x10e2bd[_0xb3cf('0xd0')],'VoiceQueueId':_0x10e2bd[_0xb3cf('0xf9')]||undefined,'CampaignId':_0x10e2bd[_0xb3cf('0xd2')]||undefined})[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0xfa')));_0x4c1f92({'reschedule':0x1});}}});}}};Dialer[_0xb3cf('0xa7')][_0xb3cf('0x102')]=function(_0x1f4dea){var _0x11fdab=this[_0xb3cf('0x26')][_0x1f4dea[_0xb3cf('0xdf')]];var _0x4385f2=this;var _0x4a2cd1;if(_0x11fdab&&_0x11fdab['type']==='ivr'){delete this[_0xb3cf('0x26')][_0x1f4dea['uniqueid']];this[_0xb3cf('0xb0')](this[_0xb3cf('0x20')][_0x11fdab[_0xb3cf('0xb2')]]);this[_0xb3cf('0x20')][_0x11fdab[_0xb3cf('0xb2')]][_0xb3cf('0x103')]+=0x1;_0x4a2cd1=new Hangup(_0x11fdab,_0x1f4dea);this[_0xb3cf('0xc7')](_0x4a2cd1)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xb3cf('0xc5')](_0x4a2cd1)[_0xb3cf('0xae')](loggerCatch('[syncHangupIvr]'));}if(_0x11fdab&&_0x11fdab[_0xb3cf('0x4c')]!==_0xb3cf('0x78')&&isNotNull(this[_0xb3cf('0x1f')][_0x11fdab[_0xb3cf('0xb2')]]['dialQueueProject'])){delete this[_0xb3cf('0x26')][_0x1f4dea['uniqueid']];this[_0xb3cf('0xb0')](this[_0xb3cf('0x1f')][_0x11fdab[_0xb3cf('0xb2')]]);this[_0xb3cf('0x1f')][_0x11fdab[_0xb3cf('0xb2')]][_0xb3cf('0x5c')]+=0x1;this[_0xb3cf('0x1f')][_0x11fdab['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x4a2cd1=new Hangup(_0x11fdab,_0x1f4dea);_0x4a2cd1[_0xb3cf('0xa4')]=0x10;_0x4a2cd1['statedesc']=_0xb3cf('0x104');_0x4a2cd1[_0xb3cf('0xe1')]=_0xb3cf('0x105');this['createHistory'](_0x4a2cd1)['catch'](loggerCatch(_0xb3cf('0x106')));this[_0xb3cf('0xc5')](_0x4a2cd1)[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x107')));}if(_0x11fdab&&_0x11fdab[_0xb3cf('0x4c')]!==_0xb3cf('0x78')&&!isNotNull(this[_0xb3cf('0x1f')][_0x11fdab[_0xb3cf('0xb2')]][_0xb3cf('0x108')])){delete this['uniqueId'][_0x1f4dea[_0xb3cf('0xdf')]];this['updateOriginated'](this['voiceQueues'][_0x11fdab[_0xb3cf('0xb2')]]);this[_0xb3cf('0x1f')][_0x11fdab[_0xb3cf('0xb2')]][_0xb3cf('0x63')]+=0x1;_0x4a2cd1=new Hangup(_0x11fdab,_0x1f4dea);_0x4a2cd1[_0xb3cf('0xa4')]=0xc;_0x4a2cd1[_0xb3cf('0xe0')]=_0x1f4dea[_0xb3cf('0x109')];_0x4a2cd1[_0xb3cf('0xe1')]=_0xb3cf('0x10a');this[_0xb3cf('0xc7')](_0x4a2cd1)[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x106')));this[_0xb3cf('0xc5')](_0x4a2cd1)[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x107')));}};Dialer[_0xb3cf('0xa7')][_0xb3cf('0x34')]=function(_0x362bc0){var _0x37c05a=this['uniqueId'][_0x362bc0['uniqueid']];var _0x6917c0=this;if(this[_0xb3cf('0x1f')][_0x362bc0[_0xb3cf('0xb2')]]){if(_0x37c05a&&_0x37c05a[_0xb3cf('0x4c')]!==_0xb3cf('0x78')){delete this[_0xb3cf('0x26')][_0x362bc0[_0xb3cf('0xdf')]];this[_0xb3cf('0x1f')][_0x362bc0[_0xb3cf('0xb2')]][_0xb3cf('0x5c')]+=0x1;var _0x5572f3=new AgentComplete(_0x37c05a,_0x362bc0);if(_0x362bc0[_0xb3cf('0x10b')]==='agent'){_0x5572f3[_0xb3cf('0x10c')]=this[_0xb3cf('0x1f')][_0x362bc0[_0xb3cf('0xb2')]]['dialQueueProject2']&&this['voiceQueues'][_0x362bc0[_0xb3cf('0xb2')]][_0xb3cf('0x10d')]?moment()[_0xb3cf('0x75')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x5572f3)[_0xb3cf('0xae')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xb3cf('0xc5')](_0x5572f3)[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x10e')));}}};Dialer[_0xb3cf('0xa7')][_0xb3cf('0x10f')]=function(_0x334f56){if(this[_0xb3cf('0x1f')][_0x334f56['queue']]){if(this['uniqueId'][_0x334f56[_0xb3cf('0xdf')]]&&this['uniqueId'][_0x334f56[_0xb3cf('0xdf')]][_0xb3cf('0x4c')]!==_0xb3cf('0x78')){this['updateOriginated'](this[_0xb3cf('0x1f')][_0x334f56[_0xb3cf('0xb2')]]);this[_0xb3cf('0x26')][_0x334f56[_0xb3cf('0xdf')]][_0xb3cf('0x110')]=moment()[_0xb3cf('0x75')](_0xb3cf('0xf8'));}}};Dialer[_0xb3cf('0xa7')][_0xb3cf('0x111')]=function(_0x48a2cf){this[_0xb3cf('0xc7')](_0x48a2cf)[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x112')));this[_0xb3cf('0xc5')](_0x48a2cf)[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x113')));};Dialer[_0xb3cf('0xa7')]['syncQueueCallerAbandon']=function(_0x258d0a){var _0x16d0ea=this[_0xb3cf('0x26')][_0x258d0a[_0xb3cf('0xdf')]];var _0x4a947e=this;if(this[_0xb3cf('0x1f')][_0x258d0a[_0xb3cf('0xb2')]]){if(_0x16d0ea&&_0x16d0ea[_0xb3cf('0x4c')]!==_0xb3cf('0x78')){delete this[_0xb3cf('0x26')][_0x258d0a[_0xb3cf('0xdf')]];this['updateOriginated'](this['voiceQueues'][_0x258d0a[_0xb3cf('0xb2')]]);_0x16d0ea[_0xb3cf('0x114')]=moment()['format'](_0xb3cf('0xf8'));var _0x3539b0=new QueueCallerAbandon(_0x16d0ea,_0x258d0a);if(getSeconds(_0x16d0ea[_0xb3cf('0x114')],_0x16d0ea['responsetime'])>=_0x16d0ea['dialQueueTimeout']){this[_0xb3cf('0x1f')][_0x258d0a[_0xb3cf('0xb2')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xb3cf('0x1f')][_0x258d0a[_0xb3cf('0xb2')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xb3cf('0x1f')][_0x258d0a[_0xb3cf('0xb2')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x3539b0[_0xb3cf('0xa4')]=0xa;_0x3539b0[_0xb3cf('0xe0')]='Drop';_0x3539b0[_0xb3cf('0x115')]='TIMEOUT';_0x3539b0[_0xb3cf('0x10c')]=this[_0xb3cf('0x1f')][_0x258d0a[_0xb3cf('0xb2')]]['dialQueueProject2']?moment()[_0xb3cf('0x75')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x3539b0['countdropretry']+=0x1;_0x3539b0[_0xb3cf('0xe9')]+=0x1;if(_0x3539b0['countdropretry']>=this['voiceQueues'][_0x258d0a[_0xb3cf('0xb2')]][_0xb3cf('0x116')]){this['queueCallerAbandonCreateState'](_0x3539b0);}else{this[_0xb3cf('0xbc')]({'active':![],'countdropretry':_0x3539b0[_0xb3cf('0xee')],'scheduledat':moment()[_0xb3cf('0xf5')](this['voiceQueues'][_0x258d0a['queue']]['dialDropRetryFrequency'],_0xb3cf('0xf7'))[_0xb3cf('0x75')](_0xb3cf('0xf8')),'ContactId':_0x16d0ea[_0xb3cf('0xcf')],'ListId':_0x16d0ea[_0xb3cf('0xd0')],'VoiceQueueId':_0x16d0ea[_0xb3cf('0xf9')]||undefined,'CampaignId':_0x16d0ea[_0xb3cf('0xd2')]||undefined})[_0xb3cf('0xae')](loggerCatch('[rescheduleContact][Drop]'));var _0x4b96f1=new History(_0x3539b0);_0x4b96f1['state']=0xa;_0x4b96f1[_0xb3cf('0xe0')]=_0xb3cf('0x117');_0x4b96f1['starttime']=moment()['format'](_0xb3cf('0xf8'));_0x4b96f1[_0xb3cf('0xa5')]=_0x4b96f1[_0xb3cf('0xa6')];_0x4b96f1[_0xb3cf('0x118')]=_0x3539b0[_0xb3cf('0x118')];_0x4b96f1[_0xb3cf('0x119')]=_0x3539b0['calleridnum'];this[_0xb3cf('0xc7')](_0x4b96f1)[_0xb3cf('0xae')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xb3cf('0x1f')][_0x258d0a[_0xb3cf('0xb2')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xb3cf('0x1f')][_0x258d0a[_0xb3cf('0xb2')]][_0xb3cf('0x11a')]+=0x1;_0x3539b0[_0xb3cf('0xa4')]=0xb;_0x3539b0[_0xb3cf('0xe0')]=_0xb3cf('0x11b');_0x3539b0['dropreason']=_0xb3cf('0x11c');_0x3539b0[_0xb3cf('0xef')]+=0x1;_0x3539b0[_0xb3cf('0xe9')]+=0x1;if(_0x3539b0[_0xb3cf('0xef')]>=this['voiceQueues'][_0x258d0a['queue']]['dialAbandonedMaxRetry']){this[_0xb3cf('0x111')](_0x3539b0);}else{this[_0xb3cf('0xbc')]({'active':![],'countabandonedretry':_0x3539b0[_0xb3cf('0xef')],'scheduledat':moment()[_0xb3cf('0xf5')](this[_0xb3cf('0x1f')][_0x258d0a['queue']][_0xb3cf('0x11d')],_0xb3cf('0xf7'))['format'](_0xb3cf('0xf8')),'ContactId':_0x16d0ea[_0xb3cf('0xcf')],'ListId':_0x16d0ea[_0xb3cf('0xd0')],'VoiceQueueId':_0x16d0ea[_0xb3cf('0xf9')]||undefined,'CampaignId':_0x16d0ea[_0xb3cf('0xd2')]||undefined})[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x11e')));var _0x4b96f1=new History(_0x3539b0);_0x4b96f1['state']=0xb;_0x4b96f1[_0xb3cf('0xe0')]=_0xb3cf('0x11b');_0x4b96f1['starttime']=moment()[_0xb3cf('0x75')]('YYYY-MM-DD\x20HH:mm:ss');_0x4b96f1[_0xb3cf('0xa5')]=_0x4b96f1[_0xb3cf('0xa6')];_0x4b96f1[_0xb3cf('0x118')]=_0x3539b0[_0xb3cf('0x118')];_0x4b96f1[_0xb3cf('0x119')]=_0x3539b0['calleridnum'];this[_0xb3cf('0xc7')](_0x4b96f1)[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x11f')));}}}}};Dialer[_0xb3cf('0xa7')][_0xb3cf('0x38')]=function(_0x5cc437){if(this[_0xb3cf('0x24')][_0x5cc437['uniqueid']]){this[_0xb3cf('0x24')][_0x5cc437[_0xb3cf('0xdf')]][_0xb3cf('0xad')]=_0x5cc437['channel'];}if(this['uniqueId'][_0x5cc437[_0xb3cf('0xdf')]]){this[_0xb3cf('0x26')][_0x5cc437[_0xb3cf('0xdf')]][_0xb3cf('0xad')]=_0x5cc437[_0xb3cf('0xad')];}};Dialer[_0xb3cf('0xa7')][_0xb3cf('0x3a')]=function(_0x31df46){if(strategy[this['voiceQueues'][this[_0xb3cf('0x24')][_0x31df46['actionid']][_0xb3cf('0xb2')]]['strategy']]==='roundrobin'){if(this[_0xb3cf('0x24')][_0x31df46[_0xb3cf('0x120')]]&&_[_0xb3cf('0xaa')](this[_0xb3cf('0x24')][_0x31df46['actionid']][_0xb3cf('0x121')])&&_0x31df46[_0xb3cf('0xac')]==='1'&&_0x31df46[_0xb3cf('0x122')]==='0'){if(this[_0xb3cf('0x21')][_0x31df46['stateinterface']]){if(!this['agents'][_0x31df46[_0xb3cf('0x123')]][_0xb3cf('0x121')]){this[_0xb3cf('0x21')][_0x31df46['stateinterface']][_0xb3cf('0x121')]=!![];this['actions'][_0x31df46['actionid']]['locked']=!![];this[_0xb3cf('0x24')][_0x31df46[_0xb3cf('0x120')]][_0xb3cf('0x123')]=_0x31df46[_0xb3cf('0x123')];}}}}else if((strategy[this['voiceQueues'][this[_0xb3cf('0x24')][_0x31df46[_0xb3cf('0x120')]]['queue']][_0xb3cf('0x4d')]]||_0xb3cf('0x124'))==='rrmemory'){if(this[_0xb3cf('0x24')][_0x31df46[_0xb3cf('0x120')]]){if(this[_0xb3cf('0x21')][_0x31df46[_0xb3cf('0x123')]]){this['actions'][_0x31df46[_0xb3cf('0x120')]]['stateinterface']=_0x31df46[_0xb3cf('0x123')];if(_[_0xb3cf('0xaa')](this[_0xb3cf('0x2b')][this['actions'][_0x31df46['actionid']][_0xb3cf('0xb2')]])){this[_0xb3cf('0x2b')][this['actions'][_0x31df46['actionid']][_0xb3cf('0xb2')]]=[];}this['queueBooked'][this['actions'][_0x31df46[_0xb3cf('0x120')]][_0xb3cf('0xb2')]][_0xb3cf('0x125')](_[_0xb3cf('0xcd')](_['pick'](this[_0xb3cf('0x24')][_0x31df46[_0xb3cf('0x120')]],[_0xb3cf('0x126'),_0xb3cf('0x123')]),{'status':_0x31df46['status'],'paused':_0x31df46[_0xb3cf('0x122')]}));}}}};function unlockQueueStatus(_0x2cd0ba,_0x9d4279){setTimeout(function(){if(_['isUndefined'](_0x2cd0ba['queueStatusComplete'])){loggerBooked[_0xb3cf('0x92')](_0xb3cf('0x127'),_0x9d4279);}_0x2cd0ba[_0xb3cf('0x128')]=!![];loggerBooked[_0xb3cf('0x7c')](_0xb3cf('0x129'),_0x9d4279,JSON['stringify'](_[_0xb3cf('0xce')](_0x2cd0ba,[_0xb3cf('0x42'),_0xb3cf('0x128')])));},0x1f3);}Dialer[_0xb3cf('0xa7')]['syncQueueStatusComplete']=function(_0x13ca63){var _0x5d62c1=this;var _0x35ad39=_0x5d62c1[_0xb3cf('0x1f')][_0x5d62c1[_0xb3cf('0x24')][_0x13ca63['actionid']][_0xb3cf('0xb2')]];if(strategy[this['voiceQueues'][this['actions'][_0x13ca63[_0xb3cf('0x120')]][_0xb3cf('0xb2')]][_0xb3cf('0x4d')]]===_0xb3cf('0x1a')){if(this[_0xb3cf('0x24')][_0x13ca63[_0xb3cf('0x120')]]&&this['actions'][_0x13ca63[_0xb3cf('0x120')]][_0xb3cf('0x123')]){this[_0xb3cf('0x1e')][_0xb3cf('0x12a')](this[_0xb3cf('0x24')][_0x13ca63[_0xb3cf('0x120')]][_0xb3cf('0x126')],this[_0xb3cf('0x24')][_0x13ca63[_0xb3cf('0x120')]][_0xb3cf('0x123')])[_0xb3cf('0xae')](function(_0x214bbc){logger['error'](_0xb3cf('0x12b'),util[_0xb3cf('0x93')](_0x214bbc,{'showHidden':![],'depth':null}));})[_0xb3cf('0x1c')](function(){_0x5d62c1['updateOriginated'](_0x5d62c1[_0xb3cf('0x1f')][_0x5d62c1[_0xb3cf('0x24')][_0x13ca63['actionid']][_0xb3cf('0xb2')]]);_0x5d62c1[_0xb3cf('0x21')][_0x5d62c1[_0xb3cf('0x24')][_0x13ca63['actionid']][_0xb3cf('0x123')]][_0xb3cf('0x121')]=![];delete _0x5d62c1['actions'][_0x13ca63['actionid']];unlockQueueStatus(_0x35ad39);});}else{this[_0xb3cf('0xb0')](this['voiceQueues'][this[_0xb3cf('0x24')][_0x13ca63[_0xb3cf('0x120')]][_0xb3cf('0xb2')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0xb3cf('0x24')][_0x13ca63[_0xb3cf('0x120')]][_0xb3cf('0xcf')],'ListId':this[_0xb3cf('0x24')][_0x13ca63[_0xb3cf('0x120')]][_0xb3cf('0xd0')],'VoiceQueueId':this[_0xb3cf('0x24')][_0x13ca63[_0xb3cf('0x120')]][_0xb3cf('0xf9')]||undefined,'CampaignId':this[_0xb3cf('0x24')][_0x13ca63[_0xb3cf('0x120')]][_0xb3cf('0xd2')]||undefined})[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x12c')));delete this[_0xb3cf('0x24')][_0x13ca63[_0xb3cf('0x120')]];unlockQueueStatus(_0x35ad39);}}else if((strategy[this[_0xb3cf('0x1f')][this[_0xb3cf('0x24')][_0x13ca63['actionid']][_0xb3cf('0xb2')]][_0xb3cf('0x4d')]]||_0xb3cf('0x124'))===_0xb3cf('0x124')){var _0x4a5293;if(this['actions'][_0x13ca63[_0xb3cf('0x120')]]&&!_['isEmpty'](this[_0xb3cf('0x2b')][this[_0xb3cf('0x24')][_0x13ca63[_0xb3cf('0x120')]][_0xb3cf('0xb2')]])){if(this[_0xb3cf('0x2c')][_0x5d62c1[_0xb3cf('0x24')][_0x13ca63['actionid']]['queue']]){this[_0xb3cf('0x2c')][_0x5d62c1[_0xb3cf('0x24')][_0x13ca63[_0xb3cf('0x120')]]['queue']]=this[_0xb3cf('0x2c')][this[_0xb3cf('0x24')][_0x13ca63[_0xb3cf('0x120')]][_0xb3cf('0xb2')]]?this[_0xb3cf('0x2c')][this['actions'][_0x13ca63[_0xb3cf('0x120')]][_0xb3cf('0xb2')]]:this[_0xb3cf('0x2b')][this['actions'][_0x13ca63['actionid']][_0xb3cf('0xb2')]]?this[_0xb3cf('0x2b')][this[_0xb3cf('0x24')][_0x13ca63[_0xb3cf('0x120')]][_0xb3cf('0xb2')]][_0xb3cf('0x12d')]||0x0:0x0;}this[_0xb3cf('0x2b')][this['actions'][_0x13ca63['actionid']][_0xb3cf('0xb2')]][_0xb3cf('0x12d')]=this['queueBookedRR'][this['actions'][_0x13ca63['actionid']][_0xb3cf('0xb2')]];for(var _0x5304a4=0x0;_0x5304a4=0x0;})['catch'](myreject(_0x51e2c6)));}}else{_0x25faab[_0xb3cf('0x125')](ami[_0xb3cf('0xab')]({'action':_0xb3cf('0x141'),'command':util[_0xb3cf('0x75')]('iftime\x20%s,%s',_0x4d67e7,!_['isUndefined'](config[_0xb3cf('0x13f')][_0x164217])?_0x164217:'')})[_0xb3cf('0xb8')](function(_0xcbae93){return _0xcbae93['content'][_0xb3cf('0x143')](_0xb3cf('0x144'))>=0x0;})[_0xb3cf('0xae')](myreject(_0x51e2c6)));}BPromise['all'](_0x25faab)[_0xb3cf('0xb8')](function(_0xdfff9f){var _0x328f0e=_[_0xb3cf('0x145')](_0xdfff9f);if(_0x328f0e){return _0x4fd3e7(_0x328f0e);}else{_0x4ba9e8[_0xb3cf('0x40')]=_0x4ff448?_0xb3cf('0x146'):'INTERVAL_IS_OVERTIME';return _0x51e2c6(msgResponse(_0xb3cf('0x147'),_0xb3cf('0x13b'),'Global:\x20'+_0x4ff448+'\x20'+_0x5f0924+'\x20Interval\x20is\x20overtime:\x20'+util[_0xb3cf('0x93')](_0x4d67e7,{'showHidden':![],'depth':null})+_0xb3cf('0x148')+_0x164217));}})[_0xb3cf('0xae')](function(_0x8bdb7e){return _0x51e2c6(msgResponse(_0xb3cf('0x13a'),'Failure',JSON['stringify'](_0x8bdb7e)));});});};Dialer['prototype'][_0xb3cf('0x149')]=function(_0x443526){var _0x2599b5=this;return function(){switch(_0x443526[_0xb3cf('0x57')]){case _0xb3cf('0x14a'):freeVariablesPredictive(_0x443526);_0x2599b5['handlePower'](_0x443526,0x1);break;case _0xb3cf('0x14b'):freeVariablesPredictive(_0x443526);_0x2599b5[_0xb3cf('0x14c')](_0x443526,_0x443526['dialPowerLevel']);break;case'predictive':_0x2599b5['predictive'](_0x443526);break;case _0xb3cf('0x14d'):freeVariablesPredictive(_0x443526);_0x2599b5['handlePower'](_0x443526,0x1);break;default:freeVariablesPredictive(_0x443526);logger[_0xb3cf('0x92')]('Queue',_0x443526['name'],_0xb3cf('0x14e'));}};};Dialer['prototype'][_0xb3cf('0x14f')]=function(_0x3964b3){var _0x12a024=this;return function(){_0x12a024[_0xb3cf('0x150')](_0x3964b3);};};Dialer[_0xb3cf('0xa7')][_0xb3cf('0x35')]=function(_0x3b784c){var _0x466b19=this;if(isNotPreview(_0x3b784c[_0xb3cf('0x57')])){if(isVoiceQueueOutbound(_0x3b784c['type'])&&isActive(_0x3b784c['dialActive'])){_0x3b784c[_0xb3cf('0x9d')]=!![];BPromise['resolve']()['then'](checkIsLoggedIn(_0x3b784c,_0x3b784c[_0xb3cf('0x151')]))['then'](checkIsActive(_0x3b784c,_0x3b784c[_0xb3cf('0x152')]))[_0xb3cf('0xb8')](checkInterval(_0x3b784c))[_0xb3cf('0xb8')](_0x466b19[_0xb3cf('0x153')](_0x3b784c))[_0xb3cf('0xb8')](_0x466b19[_0xb3cf('0x154')](_0x3b784c[_0xb3cf('0x155')],_0x3b784c['dialTimezone'],_0x3b784c[_0xb3cf('0x42')],_0x3b784c))[_0xb3cf('0xb8')](_0x466b19[_0xb3cf('0x139')](_0x3b784c['Interval'],_0x3b784c['dialTimezone'],_0x3b784c['name'],_0x3b784c))['then'](_0x466b19[_0xb3cf('0x149')](_0x3b784c))[_0xb3cf('0xae')](loggerCatchQueueSummary(_0xb3cf('0x156'),_0x3b784c));}else{notSendMessagesQueue(_0x3b784c);}}else{freeVariablesPredictive(_0x3b784c);}};Dialer[_0xb3cf('0xa7')][_0xb3cf('0x135')]=function(){var _0x593ab1=this;var _0x1bd6b8;for(var _0x38eed9 in this[_0xb3cf('0x20')]){if(typeof this['campaigns'][_0x38eed9]!==_0xb3cf('0xa9')){_0x1bd6b8=this[_0xb3cf('0x20')][_0x38eed9];if(isCampaignIvr(_0x1bd6b8[_0xb3cf('0x4c')])&&isActive(_0x1bd6b8[_0xb3cf('0x73')])){_0x1bd6b8['sendMessageOneNotActive']=!![];BPromise['resolve']()['then'](checkIsActive(_0x1bd6b8,_0x1bd6b8[_0xb3cf('0x73')]))[_0xb3cf('0xb8')](checkInterval(_0x1bd6b8))[_0xb3cf('0xb8')](_0x593ab1['checkIsTrunkReachable'](_0x1bd6b8))[_0xb3cf('0xb8')](_0x593ab1[_0xb3cf('0x154')](_0x1bd6b8[_0xb3cf('0x155')],_0x1bd6b8[_0xb3cf('0x157')],_0x1bd6b8[_0xb3cf('0x42')],_0x1bd6b8))['then'](_0x593ab1[_0xb3cf('0x139')](_0x1bd6b8[_0xb3cf('0x44')],_0x1bd6b8[_0xb3cf('0x157')],_0x1bd6b8[_0xb3cf('0x42')],_0x1bd6b8))['then'](_0x593ab1['launchHandleIvr'](_0x1bd6b8))['catch'](loggerCatchQueueSummary(_0xb3cf('0x158'),_0x1bd6b8));}else{notSendMessagesCampaign(_0x1bd6b8);}}}};function getCallerIdRandom(_0x176c34,_0x22831c){var _0x3b1be1;var _0x39ae2d;var _0x44bef8;if(_0x22831c<=0x0){_0x22831c=0x1;}_0x3b1be1=new RegExp(_0xb3cf('0x159')+_0x22831c+'}$');_0x39ae2d=Math[_0xb3cf('0x15a')](0xa,_0x22831c-0x1);_0x44bef8=Math[_0xb3cf('0x15a')](0xa,_0x22831c)-0x1;return util[_0xb3cf('0x75')]('%s',_[_0xb3cf('0x15b')](_0x176c34,_0x3b1be1,_[_0xb3cf('0x15c')](_0x39ae2d,_0x44bef8)));}function extractCalleridName(_0xd5a546){var _0x52474d=_0xd5a546[_0xb3cf('0x15d')](/"(.*?)"/);return _0x52474d?_0x52474d[0x1]:_0xd5a546;}function extractCalleridNumber(_0x567250){var _0x2564f3=_0x567250['match'](/<(.*?)>/);return _0x2564f3?_0x2564f3[0x1]:_0x567250;}Dialer[_0xb3cf('0xa7')]['actionOriginate']=function(_0x9bcec8,_0x52b036){var _0x4c0d6f=this;var _0x96388c=uuid['v4']();this[_0xb3cf('0x24')][_0x96388c]=new Action(_0x9bcec8,_0x52b036,_0x96388c);return new BPromise(function(_0x1267dd,_0x1e50e3){if(_[_0xb3cf('0x3f')](_0x9bcec8)&&typeof _0x9bcec8!==_0xb3cf('0x15e')){return _0x1e50e3(msgResponse('originate',_0xb3cf('0x13b'),'voiceQueue\x20is\x20undefine'));}if(_[_0xb3cf('0x3f')](_0x52b036[_0xb3cf('0x15f')][_0xb3cf('0x160')])||_0x52b036[_0xb3cf('0x15f')][_0xb3cf('0x160')]===null){return _0x1e50e3(msgResponse(_0xb3cf('0x161'),'Failure',_0xb3cf('0x162')));}var _0x4f2617={'XMD-CALLERID':_0x4c0d6f[_0xb3cf('0x24')][_0x96388c][_0xb3cf('0x163')](),'XMD-AGI':_0x9bcec8[_0xb3cf('0x108')]?util[_0xb3cf('0x75')](_0xb3cf('0x164'),ipAgi,_0x9bcec8[_0xb3cf('0x108')]):_0xb3cf('0x165'),'XMD-AGIAFTER':_0x9bcec8['dialQueueProject2']?util[_0xb3cf('0x75')](_0xb3cf('0x164'),ipAgi,_0x9bcec8['dialQueueProject2']):'NONE','XMD-QUEUE':_0x9bcec8[_0xb3cf('0x4c')]===_0xb3cf('0x166')?util['format']('\x22%s,%s%s,,,%s\x22',_0x9bcec8[_0xb3cf('0x42')],_0x9bcec8[_0xb3cf('0x167')]||'',_0x9bcec8[_0xb3cf('0x10d')]?'c':'',_0x9bcec8[_0xb3cf('0x168')]||0x3):_0xb3cf('0x165'),'XMD-CONTACTID':_0x52b036[_0xb3cf('0xcf')],'XMD-CDRTYPE':_0xb3cf('0x9'),'CALLERID(all)':_0x4c0d6f[_0xb3cf('0x24')][_0x96388c]['getCaller'](),'XMD-AMD':_0x9bcec8['dialAMDActive']?_0xb3cf('0x169'):_0xb3cf('0x165'),'XMD-DESTINATION':_0xb3cf('0x16a')};if(_0x9bcec8[_0xb3cf('0xdd')]){_0x4f2617['XMD-AMDINITIALSILENCE']=_0x9bcec8[_0xb3cf('0x16b')]||0x9c4;_0x4f2617[_0xb3cf('0x16c')]=_0x9bcec8[_0xb3cf('0x16d')]||0x5dc;_0x4f2617[_0xb3cf('0x16e')]=_0x9bcec8[_0xb3cf('0x16f')]||0x320;_0x4f2617['XMD-AMDTOTALANALYSISTIME']=_0x9bcec8[_0xb3cf('0x170')]||0x1388;_0x4f2617['XMD-AMDMINWORDLENGTH']=_0x9bcec8[_0xb3cf('0x171')]||0x64;_0x4f2617[_0xb3cf('0x172')]=_0x9bcec8['dialAMDBetweenWordsSilence']||0x32;_0x4f2617[_0xb3cf('0x173')]=_0x9bcec8[_0xb3cf('0x174')]||0x3;_0x4f2617[_0xb3cf('0x175')]=_0x9bcec8['dialAMDSilenceThreshold']||0x100;_0x4f2617[_0xb3cf('0x176')]=_0x9bcec8['dialAMDMaximumWordLength']||0x1388;}if(_0x9bcec8[_0xb3cf('0x4c')]===_0xb3cf('0x166')){_0x4f2617[_0xb3cf('0x177')]=_0x52b036[_0xb3cf('0xf9')];}else{_0x4f2617[_0xb3cf('0x178')]=_0x52b036[_0xb3cf('0xd2')];}for(var _0x28d17b in _0x52b036[_0xb3cf('0x15f')]){if(typeof _0x52b036[_0xb3cf('0x15f')][_0x28d17b]!==_0xb3cf('0xa9')){if(isNotNull(_0x52b036['Contact'][_0x28d17b])&&_0x28d17b!=='id'&&_0x28d17b!==_0xb3cf('0x179')&&_0x28d17b!==_0xb3cf('0x17a')&&_0x28d17b!==_0xb3cf('0x17b')){_0x4f2617[util[_0xb3cf('0x75')](_0xb3cf('0x17c'),_0xb3cf('0x17d'),_[_0xb3cf('0x17e')](_0x28d17b))]=_0x52b036['Contact'][_0x28d17b];}}}var _0x1e1769=_0x4c0d6f[_0xb3cf('0xd6')](_0x9bcec8[_0xb3cf('0x72')])?getCallerId(_0x9bcec8[_0xb3cf('0x72')][_0xb3cf('0x74')],_0x9bcec8[_0xb3cf('0x58')],_0x9bcec8[_0xb3cf('0x17f')]>0x0?getCallerIdRandom(_0x9bcec8[_0xb3cf('0x59')],_0x9bcec8[_0xb3cf('0x17f')]):_0x9bcec8['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x9bcec8[_0xb3cf('0x136')])?_0x9bcec8[_0xb3cf('0x72')][_0xb3cf('0x74')]:_0x9bcec8[_0xb3cf('0x136')]['callerid'],_0x9bcec8[_0xb3cf('0x58')],_0x9bcec8[_0xb3cf('0x17f')]>0x0?getCallerIdRandom(_0x9bcec8[_0xb3cf('0x59')],_0x9bcec8['dialRandomLastDigitCallerIdNumber']):_0x9bcec8[_0xb3cf('0x59')]);if(_0x1e1769){_0x4f2617['XMD-ORIGINATECALLERIDNAME']=_0x4c0d6f[_0xb3cf('0x24')][_0x96388c]['originatecalleridname']=extractCalleridName(_0x1e1769);_0x4f2617[_0xb3cf('0x180')]=_0x4c0d6f[_0xb3cf('0x24')][_0x96388c][_0xb3cf('0x181')]=extractCalleridNumber(_0x1e1769);}return ami['Action']({'actionid':_0x96388c,'action':'originate','channel':_0x4c0d6f['isTrunkReachable'](_0x9bcec8[_0xb3cf('0x72')])?util[_0xb3cf('0x75')](_0xb3cf('0x182'),_0x9bcec8[_0xb3cf('0x72')]['name'],isNotNull(_0x9bcec8[_0xb3cf('0x183')])?_0x9bcec8['dialPrefix'][_0xb3cf('0x184')]()||'':'',_0x9bcec8[_0xb3cf('0x185')]>0x0?_0x52b036[_0xb3cf('0x15f')][_0xb3cf('0x160')][_0xb3cf('0x186')](_0x9bcec8[_0xb3cf('0x185')]):_0x52b036['Contact'][_0xb3cf('0x160')]):util[_0xb3cf('0x75')](_0xb3cf('0x182'),_[_0xb3cf('0xaa')](_0x9bcec8[_0xb3cf('0x136')])?_0x9bcec8[_0xb3cf('0x72')][_0xb3cf('0x42')]:_0x9bcec8[_0xb3cf('0x136')]['name'],isNotNull(_0x9bcec8[_0xb3cf('0x183')])?_0x9bcec8[_0xb3cf('0x183')][_0xb3cf('0x184')]()||'':'',_0x9bcec8[_0xb3cf('0x185')]>0x0?_0x52b036['Contact'][_0xb3cf('0x160')][_0xb3cf('0x186')](_0x9bcec8[_0xb3cf('0x185')]):_0x52b036[_0xb3cf('0x15f')][_0xb3cf('0x160')]),'callerid':_0x1e1769,'Exten':'xcally-motion-dialer','Context':_0xb3cf('0x187'),'Priority':'1','variable':_0x4f2617,'timeout':(_0x9bcec8[_0xb3cf('0x5a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x96388c})[_0xb3cf('0xb8')](function(_0x831955){return _0x1267dd(_0x831955);})[_0xb3cf('0xae')](function(_0xf3abec){_0x9bcec8[_0xb3cf('0x188')]+=0x1;var _0x359573=new History(_0x4c0d6f[_0xb3cf('0x24')][_0x96388c]);logger[_0xb3cf('0x92')](util['format'](_0xb3cf('0x189'),JSON[_0xb3cf('0x49')](_0xf3abec)));_0x359573[_0xb3cf('0xa4')]=0xe;_0x359573[_0xb3cf('0xe0')]=_0xb3cf('0x18a');_0x359573[_0xb3cf('0xa6')]=moment()[_0xb3cf('0x75')](_0xb3cf('0xf8'));_0x359573[_0xb3cf('0xa5')]=_0x359573[_0xb3cf('0xa6')];_0x4c0d6f[_0xb3cf('0xc7')](_0x359573)['catch'](loggerCatch(_0xb3cf('0x18b')));_0x4c0d6f[_0xb3cf('0xc5')](_0x359573)[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x18b')))[_0xb3cf('0x1c')](function(){delete _0x4c0d6f[_0xb3cf('0x24')][_0x96388c];return _0x1e50e3(msgResponse(_0xb3cf('0x161'),_0xb3cf('0x48'),'originate\x20action\x20Error'));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x3ae84e){var _0x34da8a=this[_0xb3cf('0x24')][_0x3ae84e[_0xb3cf('0x120')]];if(_0x34da8a){delete this[_0xb3cf('0x24')][_0x3ae84e[_0xb3cf('0x120')]];_0x34da8a[_0xb3cf('0x18c')]=moment()[_0xb3cf('0x75')](_0xb3cf('0xf8'));var _0x3cad53=_0x34da8a[_0xb3cf('0x4c')]===_0xb3cf('0x78')?this[_0xb3cf('0x20')][_0x34da8a['queue']]:this[_0xb3cf('0x1f')][_0x34da8a['getQueue']()];if(!this[_0xb3cf('0x18d')](_0x3ae84e[_0xb3cf('0x18e')])){this[_0xb3cf('0xb0')](_0x3cad53);return this[_0xb3cf('0x18f')](_0x34da8a,_0x3cad53,_0x3ae84e)[_0xb3cf('0xae')](loggerCatch('[callProgressDetecting]\x20'));}this[_0xb3cf('0x26')][_0x3ae84e[_0xb3cf('0xdf')]]=_0x34da8a;}};Dialer['prototype'][_0xb3cf('0x190')]=function(_0x8b5951,_0x46a64e,_0x53f351){var _0xf36751=new History(_0x46a64e);if(_0xf36751[_0xb3cf('0x100')]+_0xf36751[_0xb3cf('0xeb')]+_0xf36751[_0xb3cf('0xec')]+_0xf36751['countnosuchnumberretry']+_0xf36751[_0xb3cf('0xee')]+_0xf36751['countabandonedretry']+_0xf36751[_0xb3cf('0xe8')]+_0xf36751[_0xb3cf('0xf0')]>=_0x53f351[_0xb3cf('0x101')]-0x1){return!![];}switch(_0x8b5951){case 0x3:if(_0xf36751['countnoanswerretry']>=_0x53f351['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0xb3cf('0xbc')]({'active':![],'countnoanswerretry':_0xf36751[_0xb3cf('0xec')]+=0x1,'scheduledat':moment()[_0xb3cf('0xf5')](_0x53f351[_0xb3cf('0x191')],_0xb3cf('0xf7'))[_0xb3cf('0x75')](_0xb3cf('0xf8')),'ContactId':_0xf36751[_0xb3cf('0xcf')],'ListId':_0xf36751[_0xb3cf('0xd0')],'VoiceQueueId':_0xf36751[_0xb3cf('0xf9')]||undefined,'CampaignId':_0xf36751[_0xb3cf('0xd2')]||undefined})[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x192')));break;case 0x5:if(_0xf36751[_0xb3cf('0x100')]>=_0x53f351[_0xb3cf('0x193')]-0x1){return!![];}this[_0xb3cf('0xbc')]({'active':![],'countbusyretry':_0xf36751[_0xb3cf('0x100')]+=0x1,'scheduledat':moment()[_0xb3cf('0xf5')](_0x53f351[_0xb3cf('0x194')],_0xb3cf('0xf7'))[_0xb3cf('0x75')](_0xb3cf('0xf8')),'ContactId':_0xf36751[_0xb3cf('0xcf')],'ListId':_0xf36751[_0xb3cf('0xd0')],'VoiceQueueId':_0xf36751[_0xb3cf('0xf9')]||undefined,'CampaignId':_0xf36751[_0xb3cf('0xd2')]||undefined})['catch'](loggerCatch(_0xb3cf('0x195')));break;case 0x8:if(_0xf36751['countcongestionretry']>=_0x53f351[_0xb3cf('0x196')]-0x1){return!![];}this[_0xb3cf('0xbc')]({'active':![],'countcongestionretry':_0xf36751[_0xb3cf('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x53f351[_0xb3cf('0x197')],_0xb3cf('0xf7'))[_0xb3cf('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xf36751[_0xb3cf('0xcf')],'ListId':_0xf36751[_0xb3cf('0xd0')],'VoiceQueueId':_0xf36751['VoiceQueueId']||undefined,'CampaignId':_0xf36751[_0xb3cf('0xd2')]||undefined})['catch'](loggerCatch(_0xb3cf('0x198')));break;case 0x0:if(_0xf36751[_0xb3cf('0xed')]>=_0x53f351[_0xb3cf('0x199')]-0x1){return!![];}else{this[_0xb3cf('0xbc')]({'active':![],'countnosuchnumberretry':_0xf36751['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xb3cf('0xf5')](_0x53f351[_0xb3cf('0x19a')],_0xb3cf('0xf7'))[_0xb3cf('0x75')](_0xb3cf('0xf8')),'ContactId':_0xf36751[_0xb3cf('0xcf')],'ListId':_0xf36751[_0xb3cf('0xd0')],'VoiceQueueId':_0xf36751[_0xb3cf('0xf9')]||undefined,'CampaignId':_0xf36751[_0xb3cf('0xd2')]||undefined})[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x19b')));}break;case 0xa:if(_0xf36751[_0xb3cf('0xee')]>=_0x53f351[_0xb3cf('0x116')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0xf36751[_0xb3cf('0xee')]+=0x1,'scheduledat':moment()[_0xb3cf('0xf5')](_0x53f351[_0xb3cf('0x19c')],_0xb3cf('0xf7'))[_0xb3cf('0x75')](_0xb3cf('0xf8')),'ContactId':_0xf36751['ContactId'],'ListId':_0xf36751[_0xb3cf('0xd0')],'VoiceQueueId':_0xf36751['VoiceQueueId']||undefined,'CampaignId':_0xf36751['CampaignId']||undefined})[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x19d')));break;case 0xb:if(_0xf36751[_0xb3cf('0xef')]>=_0x53f351[_0xb3cf('0x19e')]-0x1){return!![];}this[_0xb3cf('0xbc')]({'active':![],'countabandonedretry':_0xf36751['countabandonedretry']+=0x1,'scheduledat':moment()[_0xb3cf('0xf5')](_0x53f351[_0xb3cf('0x11d')],_0xb3cf('0xf7'))[_0xb3cf('0x75')](_0xb3cf('0xf8')),'ContactId':_0xf36751['ContactId'],'ListId':_0xf36751['ListId'],'VoiceQueueId':_0xf36751[_0xb3cf('0xf9')]||undefined,'CampaignId':_0xf36751[_0xb3cf('0xd2')]||undefined})[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x11e')));break;case 0x13:if(_0xf36751[_0xb3cf('0xe8')]>=_0x53f351[_0xb3cf('0xf3')]-0x1){return!![];}this[_0xb3cf('0xbc')]({'active':![],'countmachineretry':_0xf36751[_0xb3cf('0xe8')]+=0x1,'scheduledat':moment()[_0xb3cf('0xf5')](_0x53f351['dialMachineRetryFrequency'],_0xb3cf('0xf7'))[_0xb3cf('0x75')](_0xb3cf('0xf8')),'ContactId':_0xf36751[_0xb3cf('0xcf')],'ListId':_0xf36751[_0xb3cf('0xd0')],'VoiceQueueId':_0xf36751[_0xb3cf('0xf9')]||undefined,'CampaignId':_0xf36751['CampaignId']||undefined})[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0xfa')));break;case 0x14:if(_0xf36751['countagentrejectretry']>=_0x53f351[_0xb3cf('0x19f')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0xf36751[_0xb3cf('0xf0')]+=0x1,'scheduledat':moment()['add'](_0x53f351[_0xb3cf('0x1a0')],_0xb3cf('0xf7'))[_0xb3cf('0x75')](_0xb3cf('0xf8')),'ContactId':_0xf36751[_0xb3cf('0xcf')],'ListId':_0xf36751[_0xb3cf('0xd0')],'VoiceQueueId':_0xf36751[_0xb3cf('0xf9')]||undefined,'CampaignId':_0xf36751['CampaignId']||undefined})[_0xb3cf('0xae')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0xb3cf('0x18f')]=function(_0x1cd871,_0x47c7cc,_0x1719d9){var _0x65eb98=this;var _0x4646f9=new History(_0x1cd871);return new BPromise(function(_0x5efc6a,_0x57495f){if(_[_0xb3cf('0x3f')](_0x47c7cc)&&typeof _0x47c7cc!==_0xb3cf('0x15e')){return _0x57495f(msgResponse(_0xb3cf('0x1a1'),'Failure',_0xb3cf('0x1a2')));}if(_[_0xb3cf('0x3f')](_0x1719d9)&&typeof _0x1719d9!==_0xb3cf('0x15e')){return _0x57495f(msgResponse('[callProgressDetecting]',_0xb3cf('0x13b'),_0xb3cf('0x1a3')));}switch(_0x1719d9[_0xb3cf('0x10b')]){case'0':_0x47c7cc[_0xb3cf('0x1a4')]+=0x1;_0x4646f9[_0xb3cf('0xa4')]=0x0;_0x4646f9['statedesc']=_0xb3cf('0x1a5');_0x4646f9[_0xb3cf('0xed')]+=0x1;_0x4646f9[_0xb3cf('0xe9')]+=0x1;ami[_0xb3cf('0xe2')]('custom:agentnosuchnumber',ut[_0xb3cf('0xff')](_0x1cd871,_0xb3cf('0x1a6')));_0x65eb98[_0xb3cf('0xc7')](_0x4646f9)[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0xea')));if(_0x65eb98[_0xb3cf('0x190')](0x0,_0x1cd871,_0x47c7cc)){if(_0x4646f9['countnosuchnumberretry']>=_0x47c7cc['dialNoSuchNumberMaxRetry']){_0x65eb98[_0xb3cf('0xf4')](_0x4646f9,_0x5efc6a,_0x57495f,_0xb3cf('0x1a7'));}else{_0x65eb98[_0xb3cf('0xf1')](_0x4646f9,_0x5efc6a,_0x57495f,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x47c7cc['outboundNoAnswerCallsDay']+=0x1;_0x4646f9[_0xb3cf('0xa4')]=0x3;_0x4646f9[_0xb3cf('0xe0')]='NoAnswer';_0x4646f9[_0xb3cf('0xec')]+=0x1;_0x4646f9['countglobal']+=0x1;ami['emit'](_0xb3cf('0x1a8'),ut[_0xb3cf('0xff')](_0x1cd871,'noanswer'));_0x65eb98[_0xb3cf('0xc7')](_0x4646f9)['catch'](loggerCatch(_0xb3cf('0x1a9')));if(_0x65eb98['checkRetriveMax'](0x3,_0x1cd871,_0x47c7cc)){if(_0x4646f9['countnoanswerretry']>=_0x47c7cc[_0xb3cf('0x1aa')]){_0x65eb98[_0xb3cf('0xf4')](_0x4646f9,_0x5efc6a,_0x57495f,_0xb3cf('0x1ab'));}else{_0x65eb98['stateGlobal'](_0x4646f9,_0x5efc6a,_0x57495f,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x47c7cc[_0xb3cf('0x1ac')]+=0x1;_0x4646f9['state']=0x5;_0x4646f9['statedesc']=_0xb3cf('0x1ad');_0x4646f9[_0xb3cf('0x100')]+=0x1;_0x4646f9[_0xb3cf('0xe9')]+=0x1;ami[_0xb3cf('0xe2')]('custom:agentbusy',ut[_0xb3cf('0xff')](_0x1cd871,_0xb3cf('0x1ae')));_0x65eb98['createHistory'](_0x4646f9)[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x1af')));if(_0x65eb98[_0xb3cf('0x190')](0x5,_0x1cd871,_0x47c7cc)){if(_0x4646f9[_0xb3cf('0x100')]>=_0x47c7cc['dialBusyMaxRetry']){_0x65eb98[_0xb3cf('0xf4')](_0x4646f9,_0x5efc6a,_0x57495f,_0xb3cf('0x1b0'));}else{_0x65eb98[_0xb3cf('0xf1')](_0x4646f9,_0x5efc6a,_0x57495f,_0xb3cf('0x1b0'));}}break;case'8':_0x47c7cc['outboundCongestionCallsDay']+=0x1;_0x4646f9[_0xb3cf('0xa4')]=0x8;_0x4646f9['statedesc']=_0xb3cf('0x1b1');_0x4646f9[_0xb3cf('0xeb')]+=0x1;_0x4646f9[_0xb3cf('0xe9')]+=0x1;ami[_0xb3cf('0xe2')](_0xb3cf('0x1b2'),ut[_0xb3cf('0xff')](_0x1cd871,_0xb3cf('0x1b3')));_0x65eb98[_0xb3cf('0xc7')](_0x4646f9)[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x1b4')));if(_0x65eb98[_0xb3cf('0x190')](0x8,_0x1cd871,_0x47c7cc)){if(_0x4646f9['countcongestionretry']>=_0x47c7cc[_0xb3cf('0x196')]){_0x65eb98[_0xb3cf('0xf4')](_0x4646f9,_0x5efc6a,_0x57495f,'reason\x208\x20congestion');}else{_0x65eb98[_0xb3cf('0xf1')](_0x4646f9,_0x5efc6a,_0x57495f,'reason\x208\x20congestion');}}break;case'11':_0x47c7cc[_0xb3cf('0x1b5')]+=0x1;_0x4646f9['state']=0xb;_0x4646f9[_0xb3cf('0xe0')]=_0xb3cf('0x11b');_0x4646f9[_0xb3cf('0xef')]+=0x1;_0x4646f9[_0xb3cf('0xe9')]+=0x1;_0x65eb98[_0xb3cf('0xc7')](_0x4646f9)[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x11f')));if(_0x65eb98[_0xb3cf('0x190')](0xb,_0x1cd871,_0x47c7cc)){if(_0x4646f9['countabandonedretry']>=_0x47c7cc[_0xb3cf('0x19e')]){_0x65eb98[_0xb3cf('0xf4')](_0x4646f9,_0x5efc6a,_0x57495f,_0xb3cf('0x1b6'));}else{_0x65eb98[_0xb3cf('0xf1')](_0x4646f9,_0x5efc6a,_0x57495f,_0xb3cf('0x1b6'));}}break;case'20':_0x47c7cc[_0xb3cf('0x62')]+=0x1;_0x4646f9[_0xb3cf('0xa4')]=0x14;_0x4646f9[_0xb3cf('0xe0')]=_0xb3cf('0x1b7');_0x4646f9[_0xb3cf('0xf0')]+=0x1;_0x4646f9[_0xb3cf('0xe9')]+=0x1;ami[_0xb3cf('0xe2')](_0xb3cf('0x1b8'),ut['buildObj'](_0x1cd871,_0xb3cf('0x1b9')));_0x65eb98[_0xb3cf('0xc7')](_0x4646f9)['catch'](loggerCatch(_0xb3cf('0x1ba')));if(_0x65eb98['checkRetriveMax'](0x14,_0x1cd871,_0x47c7cc)){if(_0x4646f9[_0xb3cf('0xf0')]>=_0x47c7cc[_0xb3cf('0x19f')]){_0x65eb98[_0xb3cf('0xf4')](_0x4646f9,_0x5efc6a,_0x57495f,'reason\x2020\x20agentreject');}else{_0x65eb98[_0xb3cf('0xf1')](_0x4646f9,_0x5efc6a,_0x57495f,_0xb3cf('0x1bb'));}}break;default:_0x47c7cc['outboundUnknownCallsDay']+=0x1;_0x4646f9[_0xb3cf('0xa4')]=0xc;_0x4646f9[_0xb3cf('0xe0')]=_0x1719d9[_0xb3cf('0x10b')];_0x65eb98['createHistory'](_0x4646f9)[_0xb3cf('0xae')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x65eb98['checkRetriveMax'](_0x1719d9['reason'],_0x1cd871,_0x47c7cc)){if(_0x4646f9['countbusyretry']+_0x4646f9['countcongestionretry']+_0x4646f9[_0xb3cf('0xec')]+_0x4646f9[_0xb3cf('0xed')]+_0x4646f9[_0xb3cf('0xee')]+_0x4646f9['countabandonedretry']+_0x4646f9[_0xb3cf('0xe8')]+_0x4646f9[_0xb3cf('0xf0')]>=_0x47c7cc[_0xb3cf('0x101')]){_0x65eb98[_0xb3cf('0xf1')](_0x4646f9,_0x5efc6a,_0x57495f,_0x1719d9[_0xb3cf('0x10b')]);}else{_0x65eb98[_0xb3cf('0xf4')](_0x4646f9,_0x5efc6a,_0x57495f,_0x1719d9['reason']);}}}});};Dialer[_0xb3cf('0xa7')][_0xb3cf('0xf1')]=function(_0x5a3497,_0x22be71,_0x4cfcfb,_0x1f0bf5){var _0x1d184e=new Final(_0x5a3497);_0x1d184e['state']=0xf;_0x1d184e[_0xb3cf('0xe0')]=_0xb3cf('0x1bc');this['createStateFinal'](_0x1d184e,_0x22be71,_0x4cfcfb,_0x1f0bf5);};Dialer[_0xb3cf('0xa7')][_0xb3cf('0xf4')]=function(_0x5667ce,_0x30b24e,_0x5e004f,_0x5c63f7){this[_0xb3cf('0xc5')](_0x5667ce)[_0xb3cf('0xb8')](function(){return _0x30b24e(msgResponse(_0xb3cf('0x1a1'),_0xb3cf('0xd5'),_0x5c63f7));})['catch'](function(){return _0x5e004f(msgResponse(_0xb3cf('0x1bd'),'Failure',_0xb3cf('0x1be')));});};Dialer[_0xb3cf('0xa7')][_0xb3cf('0xa')]=function(_0x1c8ce0){var _0x528baf=_0x1c8ce0[_0xb3cf('0x1bf')]/0x64;var _0x42638e=_0x1c8ce0[_0xb3cf('0x5f')]/(_0x1c8ce0[_0xb3cf('0x5f')]+_0x1c8ce0['outboundAnswerCallsDay']);var _0x194d04=Math['round'](_0x1c8ce0[_0xb3cf('0x6c')]*(_0x1c8ce0['predictiveIntervalMaxThreshold']/0x64));var _0x2ecde1=Math[_0xb3cf('0x1c0')](_0x1c8ce0[_0xb3cf('0x6c')]*(_0x1c8ce0[_0xb3cf('0x1c1')]/0x64));var _0x4a8253=_0x1c8ce0[_0xb3cf('0x1c2')]+_0x1c8ce0[_0xb3cf('0x52')];var _0x101bee=Math[_0xb3cf('0x1c3')](_0x1c8ce0[_0xb3cf('0x6f')]*_0x1c8ce0[_0xb3cf('0x88')]*_0x1c8ce0['predictiveIntervalHitRate']*_0x1c8ce0[_0xb3cf('0x6b')]);if(_[_0xb3cf('0x3f')](_0x1c8ce0[_0xb3cf('0x29')])){if(!_[_0xb3cf('0x3f')](_0x1c8ce0[_0xb3cf('0x28')])){_0x1c8ce0[_0xb3cf('0x28')]=undefined;loggerPredictive[_0xb3cf('0x92')](_0xb3cf('0x1c4'),_0xb3cf('0x1c5'));}if(!_['isUndefined'](_0x1c8ce0[_0xb3cf('0x8e')])){loggerPredictive['error'](_0xb3cf('0x1c4'),_0xb3cf('0x1c6'));clearInterval(_0x1c8ce0[_0xb3cf('0x8e')]);_0x1c8ce0['handlePredictive']=undefined;}_0x1c8ce0[_0xb3cf('0x29')]=moment()[_0xb3cf('0x75')](_0xb3cf('0xf8'));loggerPredictive[_0xb3cf('0x7c')](_0x1c8ce0[_0xb3cf('0x42')],'collection\x20data\x20in\x20progressive\x20at',_0x1c8ce0[_0xb3cf('0x29')]);this['handlePower'](_0x1c8ce0,0x1);}else if(ifInterval(_0x1c8ce0[_0xb3cf('0x1c7')],_0x1c8ce0['startProgressive'])){this['handlePower'](_0x1c8ce0,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x1c8ce0[_0xb3cf('0x29')],_0x1c8ce0[_0xb3cf('0x42')]);_0x1c8ce0[_0xb3cf('0x6f')]=0x0;_0x1c8ce0[_0xb3cf('0x69')]=0x0;}else if(_0x528baf<_0x42638e&&_0x1c8ce0[_0xb3cf('0x1c8')]===_0xb3cf('0x1c9')){freeVariablesPredictive(_0x1c8ce0);loggerPredictive['info'](_0xb3cf('0x1ca'),_0xb3cf('0x1cb'),_0x42638e,_0xb3cf('0x29'),_0x1c8ce0[_0xb3cf('0x42')]);}else if(_0x101bee<_0x1c8ce0[_0xb3cf('0x69')]&&_0x1c8ce0[_0xb3cf('0x1c8')]===_0xb3cf('0x1c9')){freeVariablesPredictive(_0x1c8ce0);loggerPredictive[_0xb3cf('0x7c')](_0xb3cf('0x1cc'),_0xb3cf('0x1cd'),_0x101bee,'Drop\x20in\x20this\x20interval',_0x1c8ce0['predictiveIntervalErlangCallsDroppedCalls'],_0xb3cf('0x29'),_0x1c8ce0[_0xb3cf('0x42')]);}else if(!ifInterval(_0x1c8ce0['dialPredictiveInterval'],_0x1c8ce0[_0xb3cf('0x29')])&&_[_0xb3cf('0x3f')](_0x1c8ce0[_0xb3cf('0x28')])&&!_[_0xb3cf('0x3f')](_0x1c8ce0['startProgressive'])){_0x1c8ce0[_0xb3cf('0x28')]=moment()[_0xb3cf('0x75')](_0xb3cf('0xf8'));loggerPredictive[_0xb3cf('0x7c')](_0x1c8ce0['name'],_0xb3cf('0x1ce'),_0x1c8ce0[_0xb3cf('0x28')]);this['averageHandleTime'](_0x1c8ce0[_0xb3cf('0x1c7')])[_0xb3cf('0xb8')](this[_0xb3cf('0x1cf')](_0x1c8ce0))[_0xb3cf('0xb8')](mergeDataErlangB(_0x1c8ce0))['then'](this['startMethodPredictive'](_0x1c8ce0))[_0xb3cf('0xae')](loggerCatchPredictive(_0xb3cf('0x1d0'),_0x1c8ce0));}else if(!ifInterval(_0x1c8ce0['dialPredictiveInterval'],_0x1c8ce0[_0xb3cf('0x28')])){_0x1c8ce0[_0xb3cf('0x69')]=0x0;_0x1c8ce0['startPredictive']=moment()['format'](_0xb3cf('0xf8'));loggerPredictive[_0xb3cf('0x7c')](_0x1c8ce0[_0xb3cf('0x42')],_0xb3cf('0x1d1'),_0x1c8ce0[_0xb3cf('0x28')]);clearInterval(_0x1c8ce0[_0xb3cf('0x8e')]);_0x1c8ce0[_0xb3cf('0x8e')]=undefined;this[_0xb3cf('0xba')](_0x1c8ce0['dialPredictiveInterval'])['then'](this[_0xb3cf('0x1cf')](_0x1c8ce0))[_0xb3cf('0xb8')](mergeDataErlangB(_0x1c8ce0))['then'](this[_0xb3cf('0x1d2')](_0x1c8ce0))[_0xb3cf('0xae')](loggerCatchPredictive(_0xb3cf('0x1d3'),_0x1c8ce0));}else if(_0x1c8ce0['predictiveIntervalAvailable']&&_0x4a8253<_0x1c8ce0[_0xb3cf('0x6c')]-_0x2ecde1){freeVariablesPredictive(_0x1c8ce0);loggerPredictive[_0xb3cf('0x7c')](_0x1c8ce0['name'],_0xb3cf('0x1d4'),_0x4a8253,_0xb3cf('0x1d5'),_0x1c8ce0['predictiveIntervalAvailable'],'-',_0x2ecde1,'=',_0x1c8ce0['predictiveIntervalAvailable']-_0x2ecde1,')');}else if(_0x1c8ce0[_0xb3cf('0x6c')]&&_0x4a8253>_0x1c8ce0[_0xb3cf('0x6c')]+_0x194d04){freeVariablesPredictive(_0x1c8ce0);loggerPredictive[_0xb3cf('0x7c')](_0x1c8ce0[_0xb3cf('0x42')],_0xb3cf('0x1d4'),_0x4a8253,')\x20are\x20more\x20than\x20threshold\x20(',_0x1c8ce0['predictiveIntervalAvailable'],'+',_0x194d04,'=',_0x1c8ce0[_0xb3cf('0x6c')]+_0x194d04,')');}};Dialer[_0xb3cf('0xa7')]['getDataPredictive']=function(_0x50d15a){var _0x4ae9fb=this;return function(_0xc11349){return new BPromise(function(_0x1fc662,_0x20670f){_['merge'](_0x50d15a,_0xc11349[0x0]);if(checkGetDataPredictive(_0xc11349[0x0])){var _0x56d319=_0x50d15a[_0xb3cf('0x6c')]=_0x50d15a[_0xb3cf('0x52')]+_0x50d15a[_0xb3cf('0x1c2')];var _0x533509=_0x50d15a[_0xb3cf('0x1c7')]*0x3c;var _0x54f89c=_0xc11349[0x0][_0xb3cf('0x65')]+_0xc11349[0x0]['predictiveIntervalAvgHoldtime'];var _0x48f344=(_0xc11349[0x0]['predictiveIntervalAnsweredCalls']+_0xc11349[0x0][_0xb3cf('0x67')]+_0xc11349[0x0][_0xb3cf('0x66')])/_0xc11349[0x0][_0xb3cf('0x6d')];_0x50d15a[_0xb3cf('0x6a')]=_0x48f344>0x0?_0x48f344:0x1;switch(_0x50d15a[_0xb3cf('0x1c8')]){case _0xb3cf('0x1c9'):var _0x55a255=_0x50d15a[_0xb3cf('0x1bf')]/0x64;return _0x4ae9fb[_0xb3cf('0x1d6')](_0x56d319,_0x533509,_0x54f89c,_0x48f344,_0x55a255)[_0xb3cf('0xb8')](function(_0x2d38ae){return _0x1fc662(_0x2d38ae);});case'agentBusyFactor':var _0x288b01=_0x50d15a[_0xb3cf('0x1bf')]/0x64;return _0x4ae9fb[_0xb3cf('0x1d7')](_0x56d319,_0x533509,_0x54f89c,_0x48f344,_0x288b01)[_0xb3cf('0xb8')](function(_0xbe5980){return _0x1fc662(_0xbe5980);});default:return _0x20670f(msgResponse('[getDataPredictive]','Failure',_0xb3cf('0x1d8')));}}else{return _0x20670f(msgResponse(_0xb3cf('0x1d9'),_0xb3cf('0x13b'),_0xb3cf('0x1da')));}});};};Dialer[_0xb3cf('0xa7')][_0xb3cf('0x1db')]=function(_0x52dbd8){var _0x31cc12=this;return function(_0x4dd566){return new BPromise(function(_0x186648,_0x711e){_[_0xb3cf('0xcd')](_0x52dbd8,_0x4dd566[0x0]);if(checkGetDataPredictive(_0x4dd566[0x0])){loggerPredictive['info'](JSON[_0xb3cf('0x49')](_0x4dd566[0x0]));if(_0x52dbd8[_0xb3cf('0x1c8')]===_0xb3cf('0x1c9')){return _0x31cc12[_0xb3cf('0xc3')](_0x52dbd8['id'])[_0xb3cf('0xb8')](function(_0x4dde03){var _0x51e820=_0x52dbd8[_0xb3cf('0x151')]-_0x4dde03[0x0][_0xb3cf('0x1dc')];var _0x11bcd6=_0x52dbd8['dialPredictiveInterval']*0x3c;var _0x5d56b1=_0x4dd566[0x0][_0xb3cf('0x65')]+_0x4dd566[0x0][_0xb3cf('0x64')];var _0x3c6005=(_0x4dd566[0x0]['predictiveIntervalAnsweredCalls']+_0x4dd566[0x0][_0xb3cf('0x67')]+_0x4dd566[0x0][_0xb3cf('0x66')])/_0x4dd566[0x0]['predictiveIntervalTotalCalls'];var _0x751c78=_0x52dbd8[_0xb3cf('0x1bf')]/0x64;_0x52dbd8[_0xb3cf('0x1dd')]=_0x4dde03[0x0][_0xb3cf('0x1dc')]||0x0;_0x52dbd8['predictiveIntervalHitRate']=_0x3c6005>0x0?_0x3c6005:0x1;return _0x31cc12[_0xb3cf('0x1d6')](_0x51e820,_0x11bcd6,_0x5d56b1,_0x3c6005,_0x751c78);})[_0xb3cf('0xb8')](function(_0x75245d){return _0x186648(_0x75245d);})[_0xb3cf('0xae')](function(_0xaf67ee){return _0x711e(msgResponse(_0xb3cf('0x1de'),'Failure',JSON[_0xb3cf('0x49')](_0xaf67ee)));});}if(_0x52dbd8['dialPredictiveOptimization']===_0xb3cf('0x1df')){return _0x31cc12['getVoiceQueueRtPauses'](_0x52dbd8['id'])[_0xb3cf('0xb8')](function(_0x2da36b){var _0x581244=_0x52dbd8[_0xb3cf('0x151')]-_0x2da36b[0x0][_0xb3cf('0x1dc')];var _0x5587ea=_0x52dbd8[_0xb3cf('0x1c7')]*0x3c;var _0xd4a503=_0x4dd566[0x0]['predictiveIntervalAvgTalktime']+_0x4dd566[0x0]['predictiveIntervalAvgHoldtime'];var _0x5828b9=(_0x4dd566[0x0]['predictiveIntervalAnsweredCalls']+_0x4dd566[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4dd566[0x0][_0xb3cf('0x66')])/_0x4dd566[0x0]['predictiveIntervalTotalCalls'];var _0x511617=_0x52dbd8[_0xb3cf('0x1bf')]/0x64;_0x52dbd8[_0xb3cf('0x1dd')]=_0x2da36b[0x0][_0xb3cf('0x1dc')]||0x0;_0x52dbd8['predictiveIntervalHitRate']=_0x5828b9>0x0?_0x5828b9:0x1;return _0x31cc12['busyFactor'](_0x581244,_0x5587ea,_0xd4a503,_0x5828b9,_0x511617);})['then'](function(_0x28366a){return _0x186648(_0x28366a);})[_0xb3cf('0xae')](function(_0x2c2da8){return _0x711e(msgResponse(_0xb3cf('0x1de'),_0xb3cf('0x13b'),JSON[_0xb3cf('0x49')](_0x2c2da8)));});}}else{return _0x711e(msgResponse(_0xb3cf('0x1d9'),_0xb3cf('0x13b'),_0xb3cf('0x1da')));}});};};Dialer['prototype'][_0xb3cf('0x1d2')]=function(_0xc9858e){var _0x4b8a82=this;return function(){var _0x537cd3=0x0;var _0x56c2b9=Math[_0xb3cf('0x1c3')](_0xc9858e[_0xb3cf('0x70')]*0x3e8);if(_0x56c2b9>0x0){_0x56c2b9=_0x56c2b9<0x64?0x64:_0x56c2b9;loggerPredictive['info'](_0xc9858e[_0xb3cf('0x42')],'one\x20call\x20every:',_0x56c2b9,_0xb3cf('0x4a'));_0xc9858e[_0xb3cf('0x8e')]=setInterval(function(){_0x4b8a82[_0xb3cf('0x8e')](_0xc9858e);loggerPredictiveCalls[_0xb3cf('0x7c')](_0xb3cf('0x1e0'),_0x537cd3+=0x1);},_0x56c2b9);}else{loggerPredictive['info'](_0xc9858e[_0xb3cf('0x42')],_0xb3cf('0x1e1'));}};};Dialer['prototype']['checkContactBlack']=function(_0x24b046,_0x1c063b){var _0x11a9d3=this;return function(_0x2a1b95){if(_[_0xb3cf('0x90')](_0x2a1b95)){if(_[_0xb3cf('0xaa')](_0x1c063b['UserId'])||!_0x1c063b[_0xb3cf('0x1e2')]){if(_0x24b046[_0xb3cf('0x57')]===_0xb3cf('0x14d')){_0x24b046['queueStatusComplete']=_[_0xb3cf('0x3f')](_0x24b046[_0xb3cf('0x128')])?!![]:_0x24b046[_0xb3cf('0x128')];var _0x5ded91=uuid['v4']();_0x11a9d3[_0xb3cf('0x24')][_0x5ded91]=new Action(_0x24b046,_0x1c063b,_0x5ded91);loggerBooked['info'](_0xb3cf('0x1e3'),_0x5ded91,_0xb3cf('0x1e4'),JSON['stringify'](_0x24b046[_0xb3cf('0x128')]),'Queue:\x20',_0x24b046[_0xb3cf('0x42')]);if(_0x24b046[_0xb3cf('0x128')]){_0x24b046['queueStatusComplete']=![];_0x11a9d3[_0xb3cf('0x2b')][_0x11a9d3[_0xb3cf('0x24')][_0x5ded91][_0xb3cf('0xb2')]]=[];ami[_0xb3cf('0xab')]({'actionid':_0x5ded91,'action':_0xb3cf('0x1e5'),'queue':_0x24b046[_0xb3cf('0x42')]})[_0xb3cf('0xae')](function(){_0x11a9d3['updateOriginated'](_0x24b046);_0x11a9d3[_0xb3cf('0xbc')]({'active':![],'ContactId':_0x11a9d3[_0xb3cf('0x24')][_0x5ded91][_0xb3cf('0xcf')],'ListId':_0x11a9d3[_0xb3cf('0x24')][_0x5ded91][_0xb3cf('0xd0')],'VoiceQueueId':_0x11a9d3[_0xb3cf('0x24')][_0x5ded91][_0xb3cf('0xf9')]||undefined,'CampaignId':_0x11a9d3[_0xb3cf('0x24')][_0x5ded91][_0xb3cf('0xd2')]||undefined})[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x1e6')));delete _0x11a9d3[_0xb3cf('0x24')][_0x5ded91];});}else{loggerBooked['info'](_0xb3cf('0x1e7'),JSON[_0xb3cf('0x49')](_0x24b046[_0xb3cf('0x128')]),_0xb3cf('0x1e8'),_0x24b046['name']);_0x11a9d3['updateOriginated'](_0x24b046);_0x11a9d3[_0xb3cf('0xbc')]({'active':![],'ContactId':_0x11a9d3[_0xb3cf('0x24')][_0x5ded91][_0xb3cf('0xcf')],'ListId':_0x11a9d3[_0xb3cf('0x24')][_0x5ded91]['ListId'],'VoiceQueueId':_0x11a9d3[_0xb3cf('0x24')][_0x5ded91][_0xb3cf('0xf9')]||undefined,'CampaignId':_0x11a9d3[_0xb3cf('0x24')][_0x5ded91][_0xb3cf('0xd2')]||undefined})['catch'](loggerCatch(_0xb3cf('0x1e6')));delete _0x11a9d3['actions'][_0x5ded91];}}else{return _0x11a9d3[_0xb3cf('0x1e9')](_0x24b046,_0x1c063b);}}else{if(getDiff(_0x1c063b[_0xb3cf('0x1ea')])<_0x24b046[_0xb3cf('0x1eb')]*0x3c){if(_0x1c063b[_0xb3cf('0x1ec')]&&!_0x1c063b[_0xb3cf('0x1ec')][_0xb3cf('0x1ed')]){_0x11a9d3[_0xb3cf('0x1e')][_0xb3cf('0x12a')](_0x1c063b['id'])[_0xb3cf('0x1c')](function(){_0x11a9d3[_0xb3cf('0xb0')](_0x24b046);});}else{_0x11a9d3[_0xb3cf('0xbd')]({'active':![]},_0x1c063b['id'],0x1)['finally'](function(){_0x11a9d3[_0xb3cf('0xb0')](_0x24b046);});}}else{_0x24b046[_0xb3cf('0x61')]+=0x1;_0x11a9d3['updateOriginated'](_0x24b046);if(_0x24b046[_0xb3cf('0x1ee')]){_0x11a9d3[_0xb3cf('0xbc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1c063b[_0xb3cf('0xcf')],'ListId':_0x1c063b[_0xb3cf('0xd0')],'VoiceQueueId':_0x1c063b[_0xb3cf('0xf9')]||undefined,'CampaignId':_0x1c063b[_0xb3cf('0xd2')]||undefined})['catch'](loggerCatch(_0xb3cf('0x1ef')));_0x11a9d3[_0xb3cf('0xc7')](createObjHistory(_0x24b046,_0x1c063b,_0xb3cf('0x1f0'),0x17,_0xb3cf('0x1f1')))[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0x1f2')));}else{_0x11a9d3['saveInDb'](createObjHistory(_0x24b046,_0x1c063b,_0xb3cf('0x1f3'),0x16,'RecallFailedTimeout'),_0xb3cf('0x1f4'),_0xb3cf('0x1f5'));}}}}else{_0x24b046[_0xb3cf('0x5d')]+=0x1;_0x11a9d3['saveInDb'](createObjHistory(_0x24b046,_0x1c063b,_0xb3cf('0x1f6'),0xd,_0xb3cf('0x1f7')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0xb3cf('0xa7')][_0xb3cf('0x150')]=function(_0x1b4d10){var _0x5e2d96=this;var _0x2eee1b=_0x1b4d10['limitCalls']-_0x1b4d10['originated']-_0x1b4d10[_0xb3cf('0xc0')];emitCampaignSummary(_0x1b4d10);if(_0x2eee1b>0x0){if(_0x2eee1b>this[_0xb3cf('0x23')]){_0x2eee1b=this['maxNumberOriginate'];}_0x1b4d10['temp']+=_0x2eee1b;this[_0xb3cf('0xc1')](_0x1b4d10['id'],_0x2eee1b,_0x1b4d10[_0xb3cf('0x1f8')],_0x1b4d10)[_0xb3cf('0xb8')](function(_0x5ad311){_0x1b4d10['temp']-=_0x2eee1b;_0x1b4d10[_0xb3cf('0xc0')]=_0x1b4d10['temp']>0x0?_0x1b4d10[_0xb3cf('0xc0')]:0x0;if(!checkContactEmpty(_0x5ad311)){_0x1b4d10[_0xb3cf('0x40')]=_0xb3cf('0x9c');logger[_0xb3cf('0x7c')](_0xb3cf('0x1f9')+_0x1b4d10[_0xb3cf('0x42')]);}else{_0x1b4d10[_0xb3cf('0x6e')]+=_0x5ad311[_0xb3cf('0x95')];_0x1b4d10[_0xb3cf('0x40')]=_0xb3cf('0x1fa');for(var _0x418446=0x0;_0x418446<_0x5ad311['length'];_0x418446+=0x1){_0x1b4d10[_0xb3cf('0x1fb')]+=0x1;if(_['isNil'](_0x5ad311[_0x418446])||_[_0xb3cf('0xaa')](_0x5ad311[_0x418446][_0xb3cf('0x15f')])||_['isNil'](_0x5ad311[_0x418446][_0xb3cf('0x15f')][_0xb3cf('0x160')])){_0x5e2d96[_0xb3cf('0xcb')]('[actionOriginate]\x20',_0x1b4d10,_0x5ad311[_0x418446]);}else{_0x5e2d96[_0xb3cf('0xb9')](_[_0xb3cf('0xce')](_0x5ad311[_0x418446],[_0xb3cf('0xd2'),_0xb3cf('0x1fc')]))[_0xb3cf('0xb8')](_0x5e2d96[_0xb3cf('0x1fd')](_0x1b4d10,_0x5ad311[_0x418446]))[_0xb3cf('0xae')](_0x5e2d96['loggerHandler']('[actionOriginateIvr]\x20',_0x1b4d10));}}}})[_0xb3cf('0xae')](loggerGetContactDialer(_0xb3cf('0x1fe'),_0x1b4d10,_0x2eee1b));}};Dialer[_0xb3cf('0xa7')][_0xb3cf('0x14c')]=function(_0x69c3b9,_0x4f23e3){var _0x3e3c1b=this;var _0x3d66f9=[];var _0x2c3ebd=_0x4f23e3>=0x1?_0x4f23e3:0x1;if(_0x69c3b9[_0xb3cf('0x57')]===_0xb3cf('0x14d')){_0x2c3ebd=0x1;}var _0x3e7b34=Math[_0xb3cf('0x1c3')](_0x69c3b9[_0xb3cf('0x1c2')]*_0x2c3ebd)-_0x69c3b9['originated']-_0x69c3b9[_0xb3cf('0xc0')];emitVoiceQueueSummary(_0x69c3b9);if(_0x69c3b9[_0xb3cf('0x1ff')]>0x0){var _0x51d39d=_0x69c3b9[_0xb3cf('0x1ff')]-_0x69c3b9[_0xb3cf('0x6e')]-_0x69c3b9['talking']-_0x69c3b9[_0xb3cf('0xc0')]-_0x69c3b9[_0xb3cf('0x9e')];if(_0x3e7b34>_0x51d39d){_0x3e7b34=_0x51d39d;}}if(_0x3e7b34>0x0){if(_0x69c3b9[_0xb3cf('0x57')]===_0xb3cf('0x14d')){_0x3e7b34=0x1;}if(_0x3e7b34>this[_0xb3cf('0x23')]){_0x3e7b34=this[_0xb3cf('0x23')];}_0x69c3b9['temp']+=_0x3e7b34;for(var _0x27acb4 in this[_0xb3cf('0x21')]){if(typeof this[_0xb3cf('0x21')][_0x27acb4]!=='undefined'){if(this[_0xb3cf('0x21')][_0x27acb4][_0xb3cf('0xa4')]==='not_inuse'&&this[_0xb3cf('0x21')][_0x27acb4][_0xb3cf('0xac')]==='reachable'){_0x3d66f9[_0xb3cf('0x125')](this[_0xb3cf('0x21')][_0x27acb4]['id']);}}}this[_0xb3cf('0xbf')](_0x69c3b9['id'],_0x3d66f9,_0x3e7b34,_0x69c3b9[_0xb3cf('0x1f8')],_0x69c3b9)[_0xb3cf('0xb8')](function(_0x1900d7){_0x69c3b9[_0xb3cf('0xc0')]-=_0x3e7b34;_0x69c3b9['temp']=_0x69c3b9['temp']>0x0?_0x69c3b9[_0xb3cf('0xc0')]:0x0;if(!checkContactEmpty(_0x1900d7)){_0x3e3c1b['countReScheduled'](_0x69c3b9)[_0xb3cf('0xb8')](sendMessageReschedule(_0x69c3b9))[_0xb3cf('0xae')](loggerCatch(_0xb3cf('0xb5')));}else{_0x69c3b9[_0xb3cf('0x6e')]+=_0x1900d7['length'];_0x69c3b9['message']=_0x69c3b9[_0xb3cf('0x57')]===_0xb3cf('0x14d')?_0xb3cf('0x169'):_0xb3cf('0x1fa');for(var _0x293818=0x0;_0x293818<_0x1900d7[_0xb3cf('0x95')];_0x293818+=0x1){if(_['isNil'](_0x1900d7[_0x293818])||_[_0xb3cf('0xaa')](_0x1900d7[_0x293818][_0xb3cf('0x15f')])||_[_0xb3cf('0xaa')](_0x1900d7[_0x293818][_0xb3cf('0x15f')][_0xb3cf('0x160')])){_0x3e3c1b[_0xb3cf('0xcb')]('[actionOriginate]\x20',_0x69c3b9,_0x1900d7[_0x293818]);}else{_0x3e3c1b['checkIsBlackList'](_[_0xb3cf('0xce')](_0x1900d7[_0x293818],[_0xb3cf('0xf9'),_0xb3cf('0x1fc')]))['then'](_0x3e3c1b[_0xb3cf('0x1fd')](_0x69c3b9,_0x1900d7[_0x293818]))[_0xb3cf('0xae')](_0x3e3c1b[_0xb3cf('0xca')](_0xb3cf('0x200'),_0x69c3b9));}}}})[_0xb3cf('0xae')](loggerGetContactDialer(_0xb3cf('0x201'),_0x69c3b9,_0x3e7b34));}};Dialer['prototype'][_0xb3cf('0x8e')]=function(_0x4441b4){if(_0x4441b4['dialLimitQueue']>0x0){var _0x4db71a=_0x4441b4[_0xb3cf('0x1ff')]-_0x4441b4[_0xb3cf('0x6e')]-_0x4441b4['talking'];if(_0x4db71a>0x0){this[_0xb3cf('0x202')](_0x4441b4);}else{loggerPredictiveCalls[_0xb3cf('0x7c')](_0xb3cf('0x203'));}}else{this[_0xb3cf('0x202')](_0x4441b4);}};Dialer[_0xb3cf('0xa7')]['tryOriginatePredictive']=function(_0x281a23){var _0x11adbd=this;var _0x14d7ee=[];_0x281a23[_0xb3cf('0x6e')]+=0x1;for(var _0x5ee5e0 in this[_0xb3cf('0x21')]){if(typeof this['agents'][_0x5ee5e0]!==_0xb3cf('0xa9')){if(this[_0xb3cf('0x21')][_0x5ee5e0][_0xb3cf('0xa4')]===_0xb3cf('0x204')&&this[_0xb3cf('0x21')][_0x5ee5e0][_0xb3cf('0xac')]===_0xb3cf('0x205')){_0x14d7ee[_0xb3cf('0x125')](this['agents'][_0x5ee5e0]['id']);}}}this['getContactDialer'](_0x281a23['id'],_0x14d7ee,0x1,_0x281a23['dialOrderByScheduledAt'],_0x281a23)['then'](function(_0x44efa6){if(!checkContactEmpty(_0x44efa6)){checkContactLowerLimitOriginate(_0x281a23,0x1,0x0);_0x11adbd['countReScheduled'](_0x281a23)['then'](sendMessageReschedule(_0x281a23))['catch'](loggerCatch(_0xb3cf('0xb5')));}else{_0x281a23['message']=_0xb3cf('0x1fa');if(_[_0xb3cf('0xaa')](_0x44efa6[0x0])||_[_0xb3cf('0xaa')](_0x44efa6[0x0][_0xb3cf('0x15f')])||_['isNil'](_0x44efa6[0x0][_0xb3cf('0x15f')][_0xb3cf('0x160')])){_0x11adbd['emptyContact'](_0xb3cf('0x200'),_0x281a23,_0x44efa6[0x0]);}else{_0x11adbd['checkIsBlackList'](_['pick'](_0x44efa6[0x0],['VoiceQueueId',_0xb3cf('0x1fc')]))['then'](_0x11adbd[_0xb3cf('0x1fd')](_0x281a23,_0x44efa6[0x0]))[_0xb3cf('0xae')](_0x11adbd[_0xb3cf('0xca')]('[actionOriginatePredictive]\x20',_0x281a23));}}})['catch'](loggerGetContactDialer(_0xb3cf('0x206'),_0x281a23,0x1));emitVoiceQueueSummary(_0x281a23);};Dialer[_0xb3cf('0xa7')]['abandonmentRate']=function(_0x33dc40,_0x325d1a,_0x3a262b,_0x51e746,_0x240307,_0x4b1312){loggerPredictive[_0xb3cf('0x7c')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info']('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',_0x33dc40);loggerPredictive[_0xb3cf('0x7c')](_0xb3cf('0x207'),_0x325d1a);loggerPredictive['info'](_0xb3cf('0x208'),_0x3a262b);loggerPredictive[_0xb3cf('0x7c')](_0xb3cf('0x209'),_0x51e746);loggerPredictive['info'](_0xb3cf('0x20a'),_0x240307);loggerPredictive[_0xb3cf('0x7c')]('---------------------------');return new BPromise(function(_0x20bc96,_0x6cf9fa){if(_0x33dc40<=0x0||isNaN(_0x33dc40)){return _0x6cf9fa(msgResponse(_0xb3cf('0x20b'),_0xb3cf('0x48'),_0xb3cf('0x20c')+_0x33dc40));}if(_0x3a262b<=0x0||isNaN(_0x3a262b)){return _0x6cf9fa(msgResponse('[abandonmentRate]',_0xb3cf('0x48'),'Ts\x20=\x20'+_0x3a262b));}if(_0x51e746<=0x0||isNaN(_0x51e746)){return _0x6cf9fa(msgResponse(_0xb3cf('0x20b'),_0xb3cf('0x48'),_0xb3cf('0x20d')+_0x51e746));}if(_0x325d1a<=0x0||isNaN(_0x325d1a)){return _0x6cf9fa(msgResponse('[abandonmentRate]','Error',_0xb3cf('0x20e')+_0x325d1a));}if(_0x240307<=0x0||isNaN(_0x240307)){return _0x6cf9fa(msgResponse(_0xb3cf('0x20b'),_0xb3cf('0x48'),'Amax\x20=\x20'+_0x240307));}_0x4b1312=_0x4b1312||0x0;var _0x34fe6e=0x1/_0x3a262b;var _0x67e7e8=0x0;var _0x87f9ae=0x0;var _0x4d5cb6=0x0;var _0x170919=0x0;for(var _0x477ca5=0x0;_0x4d5cb6<_0x240307;_0x477ca5+=0x1){_0x87f9ae=_0x477ca5/_0x325d1a;_0x67e7e8=(_0x51e746*_0x87f9ae+_0x4b1312)/_0x34fe6e;_0x4d5cb6=erlangb(_0x67e7e8,_0x33dc40);_0x170919=_0x67e7e8/_0x33dc40*(0x1-erlangb(_0x67e7e8,_0x33dc40));}return _0x20bc96({'erlangCalls':_0x477ca5,'erlangCallToSecond':_0x325d1a/_0x477ca5,'erlangAbandonmentRate':_0x4d5cb6,'erlangBusyFactor':_0x170919});});};Dialer[_0xb3cf('0xa7')]['busyFactor']=function(_0x57f03a,_0x5e5d17,_0x8a9764,_0x132e74,_0x2f46b5,_0x458318){loggerPredictive[_0xb3cf('0x7c')](_0xb3cf('0x20f'));loggerPredictive['info'](_0xb3cf('0x210'),_0x57f03a);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5e5d17);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x8a9764);loggerPredictive[_0xb3cf('0x7c')](_0xb3cf('0x209'),_0x132e74);loggerPredictive[_0xb3cf('0x7c')](_0xb3cf('0x211'),_0x2f46b5);loggerPredictive[_0xb3cf('0x7c')](_0xb3cf('0x82'));return new BPromise(function(_0x493c9b,_0x50cd15){if(_0x57f03a<=0x0||isNaN(_0x57f03a)){return _0x50cd15(msgResponse('[busyFactor]',_0xb3cf('0x48'),_0xb3cf('0x20c')+_0x57f03a));}if(_0x8a9764<=0x0||isNaN(_0x8a9764)){return _0x50cd15(msgResponse(_0xb3cf('0x212'),_0xb3cf('0x48'),'Ts\x20=\x20'+_0x8a9764));}if(_0x132e74<=0x0||isNaN(_0x132e74)){return _0x50cd15(msgResponse(_0xb3cf('0x212'),_0xb3cf('0x48'),_0xb3cf('0x20d')+_0x132e74));}if(_0x5e5d17<=0x0||isNaN(_0x5e5d17)){return _0x50cd15(msgResponse(_0xb3cf('0x212'),_0xb3cf('0x48'),'interval\x20=\x20'+_0x5e5d17));}if(_0x2f46b5<=0x0||isNaN(_0x2f46b5)){return _0x50cd15(msgResponse('[busyFactor]','Error','Umin\x20=\x20'+_0x2f46b5));}_0x458318=_0x458318||0x0;var _0x557ac8=0x1/_0x8a9764;var _0x324dbf=0x0;var _0x4a4e03=0x0;var _0x1d47f0=0x0;var _0x1df041=0x0;for(var _0x156270=0x0;_0x1df041<_0x2f46b5;_0x156270+=0x1){_0x4a4e03=_0x156270/_0x5e5d17;_0x324dbf=(_0x132e74*_0x4a4e03+_0x458318)/_0x557ac8;_0x1d47f0=erlangb(_0x324dbf,_0x57f03a);_0x1df041=_0x324dbf/_0x57f03a*(0x1-erlangb(_0x324dbf,_0x57f03a));}return _0x493c9b({'erlangCalls':_0x156270,'erlangCallToSecond':_0x5e5d17/_0x156270,'erlangAbandonmentRate':_0x1d47f0,'erlangBusyFactor':_0x1df041});});};module[_0xb3cf('0x213')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 89122a4..21cbd00 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 _0x3e86=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x3daaf7,_0x3852a6){var _0xd26513=function(_0x5ea3a2){while(--_0x5ea3a2){_0x3daaf7['push'](_0x3daaf7['shift']());}};_0xd26513(++_0x3852a6);}(_0x3e86,0x84));var _0x63e8=function(_0x5b448c,_0x4c427e){_0x5b448c=_0x5b448c-0x0;var _0x4b0451=_0x3e86[_0x5b448c];return _0x4b0451;};'use strict';var util=require('util');var _=require(_0x63e8('0x0'));var moment=require(_0x63e8('0x1'));function getSeconds(_0x380ae4,_0x2f497f){var _0x5cc53e=moment(_0x380ae4)[_0x63e8('0x2')](0x0);var _0x2ada5e=moment(_0x2f497f)['milliseconds'](0x0);return _0x5cc53e['diff'](_0x2ada5e,'seconds');}function QueueCallerAbandon(_0x465903,_0x91b194){this['scheduledat']=_0x465903[_0x63e8('0x3')];this['type']=_0x465903[_0x63e8('0x4')];this[_0x63e8('0x5')]=_0x465903[_0x63e8('0x4')]===_0x63e8('0x6')?'queue':_0x465903[_0x63e8('0x4')];this['countbusyretry']=_0x465903[_0x63e8('0x7')];this[_0x63e8('0x8')]=_0x465903[_0x63e8('0x8')];this['countnoanswerretry']=_0x465903[_0x63e8('0x9')];this['countglobal']=_0x465903['countbusyretry']+_0x465903['countcongestionretry']+_0x465903[_0x63e8('0x9')]+_0x465903[_0x63e8('0xa')]+_0x465903[_0x63e8('0xb')]+_0x465903[_0x63e8('0xc')]+_0x465903[_0x63e8('0xd')]+_0x465903['countagentrejectretry'];this[_0x63e8('0xa')]=_0x465903[_0x63e8('0xa')];this[_0x63e8('0xb')]=_0x465903['countdropretry'];this['countabandonedretry']=_0x465903[_0x63e8('0xc')];this[_0x63e8('0xd')]=_0x465903['countmachineretry'];this[_0x63e8('0xe')]=_0x465903['countagentrejectretry'];this[_0x63e8('0xf')]=_0x91b194[_0x63e8('0xf')];this['calleridname']=_0x465903[_0x63e8('0x10')];this[_0x63e8('0x11')]=_0x465903[_0x63e8('0x12')];this[_0x63e8('0x13')]=_0x465903[_0x63e8('0x13')];this[_0x63e8('0x14')]=_0x465903[_0x63e8('0x14')];this[_0x63e8('0x15')]=_0x465903[_0x63e8('0x15')];this[_0x63e8('0x16')]=this[_0x63e8('0x15')];this[_0x63e8('0x17')]=getSeconds(_0x465903[_0x63e8('0x14')],_0x465903['starttime']);this[_0x63e8('0x18')]=getSeconds(this[_0x63e8('0x15')],_0x465903['responsetime']);this[_0x63e8('0x19')]=0x0;this[_0x63e8('0x1a')]=_0x91b194[_0x63e8('0x1a')];this[_0x63e8('0x1b')]=_0x91b194[_0x63e8('0x1c')];this[_0x63e8('0x1d')]=_0x91b194[_0x63e8('0x1d')];this[_0x63e8('0x1e')]=_0x465903[_0x63e8('0x1e')];this[_0x63e8('0x1f')]=_0x465903[_0x63e8('0x1f')];this['callbackat']=_0x465903[_0x63e8('0x20')];this['recallme']=_0x465903[_0x63e8('0x21')];this[_0x63e8('0x22')]=_0x465903['ContactId'];this[_0x63e8('0x23')]=_0x465903[_0x63e8('0x23')];this[_0x63e8('0x24')]=_0x465903[_0x63e8('0x24')];this[_0x63e8('0x25')]=_0x465903[_0x63e8('0x25')];this[_0x63e8('0x26')]=_0x465903[_0x63e8('0x26')];this[_0x63e8('0x27')]=_0x465903['originatecalleridnum']||'';this[_0x63e8('0x28')]=_0x465903['originatecalleridname']||'';}module[_0x63e8('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0xbba2=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','starttime','droptime','endtime','holdtime','responsetime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xbba2,0x6c));var _0x2bba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbba2[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x2bba('0x0'));var _=require(_0x2bba('0x1'));var moment=require(_0x2bba('0x2'));function getSeconds(_0x757b80,_0x178e63){var _0x292b86=moment(_0x757b80)[_0x2bba('0x3')](0x0);var _0x5a60ee=moment(_0x178e63)[_0x2bba('0x3')](0x0);return _0x292b86['diff'](_0x5a60ee,_0x2bba('0x4'));}function QueueCallerAbandon(_0x54d8bc,_0x17f930){this[_0x2bba('0x5')]=_0x54d8bc['scheduledat'];this[_0x2bba('0x6')]=_0x54d8bc['type'];this[_0x2bba('0x7')]=_0x54d8bc[_0x2bba('0x6')]===_0x2bba('0x8')?'queue':_0x54d8bc[_0x2bba('0x6')];this[_0x2bba('0x9')]=_0x54d8bc[_0x2bba('0x9')];this['countcongestionretry']=_0x54d8bc[_0x2bba('0xa')];this[_0x2bba('0xb')]=_0x54d8bc[_0x2bba('0xb')];this[_0x2bba('0xc')]=_0x54d8bc['countbusyretry']+_0x54d8bc[_0x2bba('0xa')]+_0x54d8bc['countnoanswerretry']+_0x54d8bc[_0x2bba('0xd')]+_0x54d8bc[_0x2bba('0xe')]+_0x54d8bc[_0x2bba('0xf')]+_0x54d8bc[_0x2bba('0x10')]+_0x54d8bc[_0x2bba('0x11')];this['countnosuchnumberretry']=_0x54d8bc[_0x2bba('0xd')];this[_0x2bba('0xe')]=_0x54d8bc[_0x2bba('0xe')];this['countabandonedretry']=_0x54d8bc[_0x2bba('0xf')];this[_0x2bba('0x10')]=_0x54d8bc[_0x2bba('0x10')];this[_0x2bba('0x11')]=_0x54d8bc[_0x2bba('0x11')];this['uniqueid']=_0x17f930[_0x2bba('0x12')];this['calleridname']=_0x54d8bc['name'];this[_0x2bba('0x13')]=_0x54d8bc['number'];this[_0x2bba('0x14')]=_0x54d8bc[_0x2bba('0x14')];this['responsetime']=_0x54d8bc['responsetime'];this[_0x2bba('0x15')]=_0x54d8bc[_0x2bba('0x15')];this[_0x2bba('0x16')]=this[_0x2bba('0x15')];this['ringtime']=getSeconds(_0x54d8bc['responsetime'],_0x54d8bc[_0x2bba('0x14')]);this[_0x2bba('0x17')]=getSeconds(this[_0x2bba('0x15')],_0x54d8bc[_0x2bba('0x18')]);this['talktime']=0x0;this[_0x2bba('0x19')]=_0x17f930[_0x2bba('0x19')];this[_0x2bba('0x1a')]=_0x17f930[_0x2bba('0x1b')];this['reason']=_0x17f930[_0x2bba('0x1c')];this[_0x2bba('0x1d')]=_0x54d8bc[_0x2bba('0x1d')];this['callbackuniqueid']=_0x54d8bc[_0x2bba('0x1e')];this[_0x2bba('0x1f')]=_0x54d8bc[_0x2bba('0x1f')];this[_0x2bba('0x20')]=_0x54d8bc[_0x2bba('0x20')];this[_0x2bba('0x21')]=_0x54d8bc[_0x2bba('0x21')];this['ListId']=_0x54d8bc[_0x2bba('0x22')];this[_0x2bba('0x23')]=_0x54d8bc[_0x2bba('0x23')];this[_0x2bba('0x24')]=_0x54d8bc[_0x2bba('0x24')];this['CampaignId']=_0x54d8bc['CampaignId'];this[_0x2bba('0x25')]=_0x54d8bc[_0x2bba('0x25')]||'';this[_0x2bba('0x26')]=_0x54d8bc['originatecalleridname']||'';}module[_0x2bba('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 037e502..a4235ae 100644 --- a/server/services/ami/fax/action.js +++ b/server/services/ami/fax/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x4f3dfc,_0x2343f9){var _0x395e8d=function(_0x2c16a0){while(--_0x2c16a0){_0x4f3dfc['push'](_0x4f3dfc['shift']());}};_0x395e8d(++_0x2343f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x47fb68,_0x4f938f){var _0x158a8e=function(_0x11bee3){while(--_0x11bee3){_0x47fb68['push'](_0x47fb68['shift']());}};_0x158a8e(++_0x4f938f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 25e4d0c..0610647 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 _0x749b=['SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','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','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','syncNewchannel','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','context','exten','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','message','parse','.pdf','application/pdf','then','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','update','AttachmentId'];(function(_0x563129,_0x26d5f9){var _0x28d1a3=function(_0x2c2d43){while(--_0x2c2d43){_0x563129['push'](_0x563129['shift']());}};_0x28d1a3(++_0x26d5f9);}(_0x749b,0xb1));var _0xb749=function(_0x2a5b3b,_0x4ebe31){_0x2a5b3b=_0x2a5b3b-0x0;var _0xae665a=_0x749b[_0x2a5b3b];return _0xae665a;};'use strict';var util=require(_0xb749('0x0'));var _=require(_0xb749('0x1'));var BPromise=require(_0xb749('0x2'));var uuid=require(_0xb749('0x3'));var moment=require(_0xb749('0x4'));var path=require(_0xb749('0x5'));var tiff2pdf=require(_0xb749('0x6'));var gs=require('./util/gs');var logger=require(_0xb749('0x7'))('fax');var ami=require(_0xb749('0x8'));var rpcDb=require(_0xb749('0x9'));var Channel=require('./channel');var ut=require(_0xb749('0xa'));var Action=require(_0xb749('0xb'));var faxAccount=require(_0xb749('0xc'));var attachment=require(_0xb749('0xd'));var faxMessage=require(_0xb749('0xe'));function Fax(_0x456e31){this['channels']={};this[_0xb749('0xf')]=_0x456e31[_0xb749('0xf')];this[_0xb749('0x10')]=_0x456e31[_0xb749('0x10')];this[_0xb749('0x11')]={};ami['on']('newchannel',this[_0xb749('0x12')][_0xb749('0x13')](this));ami['on']('varset',this['syncVarSet'][_0xb749('0x13')](this));ami['on'](_0xb749('0x14'),this[_0xb749('0x15')][_0xb749('0x13')](this));ami['on'](_0xb749('0x16'),this[_0xb749('0x17')][_0xb749('0x13')](this));ami['on'](_0xb749('0x18'),this[_0xb749('0x19')]['bind'](this));ami['on'](_0xb749('0x1a'),this[_0xb749('0x1b')]['bind'](this));ami['on'](_0xb749('0x1c'),this['syncHangup']['bind'](this));ami['on'](_0xb749('0x1d'),this[_0xb749('0x1e')][_0xb749('0x13')](this));}Fax[_0xb749('0x1f')][_0xb749('0x12')]=function(_0x172485){if(_0x172485[_0xb749('0x20')]==='from-voip-provider'){for(var _0x19719c in this[_0xb749('0xf')]){if(this[_0xb749('0xf')]['hasOwnProperty'](_0x19719c)){if(_0x172485[_0xb749('0x21')]===this['faxAccounts'][_0x19719c]['localstationid']){this[_0xb749('0x22')][_0x172485['uniqueid']]={};this[_0xb749('0x22')][_0x172485[_0xb749('0x23')]][_0xb749('0x24')]=_0x172485[_0xb749('0x24')];this['channels'][_0x172485[_0xb749('0x23')]]['id']=this[_0xb749('0xf')][_0x19719c]['id'];this[_0xb749('0x22')][_0x172485['uniqueid']][_0xb749('0x25')]=this[_0xb749('0xf')][_0x19719c][_0xb749('0x25')];logger[_0xb749('0x26')](_0x172485[_0xb749('0x23')],'\x20syncNewchannel\x20');}}}}if(this[_0xb749('0x11')][_0x172485['uniqueid']]){this['channels'][_0x172485['uniqueid']]={};this['channels'][_0x172485[_0xb749('0x23')]][_0xb749('0x24')]=_0x172485[_0xb749('0x24')];logger[_0xb749('0x26')](_0x172485['uniqueid'],_0xb749('0x27'));}};Fax[_0xb749('0x1f')][_0xb749('0x28')]=function(_0x33aad9){if(this[_0xb749('0x22')][_0x33aad9[_0xb749('0x23')]]){for(var _0x48e67b in _0x33aad9[_0xb749('0x29')]){if(_0x33aad9[_0xb749('0x29')][_0xb749('0x2a')](_0x48e67b)){this['channels'][_0x33aad9[_0xb749('0x23')]][_0x48e67b]=_0x33aad9[_0xb749('0x2b')];}}}};Fax['prototype'][_0xb749('0x15')]=function(_0x44cef2){if(this['channels'][_0x44cef2['uniqueid']]){this['channels'][_0x44cef2[_0xb749('0x23')]][_0xb749('0x2c')]=_0x44cef2['channelstate'];this['channels'][_0x44cef2['uniqueid']][_0xb749('0x2d')]=_0x44cef2[_0xb749('0x2d')];}};Fax[_0xb749('0x1f')][_0xb749('0x17')]=function(_0x40f4d7){if(this[_0xb749('0x22')][_0x40f4d7['uniqueid']]){for(var _0x35a00b in _0x40f4d7['variable']){if(_0x40f4d7[_0xb749('0x29')][_0xb749('0x2a')](_0x35a00b)){this['channels'][_0x40f4d7[_0xb749('0x23')]][_0x35a00b]=_0x40f4d7[_0xb749('0x2b')];}}}};Fax['prototype'][_0xb749('0x19')]=function(_0x2d596f){if(this[_0xb749('0x22')][_0x2d596f[_0xb749('0x23')]]){this['channels'][_0x2d596f[_0xb749('0x23')]][_0xb749('0x2e')]=_0x2d596f[_0xb749('0x2e')];this['channels'][_0x2d596f[_0xb749('0x23')]][_0xb749('0x2f')]=_0x2d596f[_0xb749('0x2f')];this['channels'][_0x2d596f[_0xb749('0x23')]]['localstationid']=_0x2d596f[_0xb749('0x30')];this[_0xb749('0x22')][_0x2d596f[_0xb749('0x23')]][_0xb749('0x31')]=_0x2d596f[_0xb749('0x31')];logger[_0xb749('0x26')](_0x2d596f['uniqueid'],_0xb749('0x32'));}};Fax[_0xb749('0x1f')][_0xb749('0x1b')]=function(_0x169d63){var _0x5cd736=this;if(this[_0xb749('0x22')][_0x169d63['uniqueid']]){var _0x2887db=this[_0xb749('0x22')][_0x169d63[_0xb749('0x23')]]['id'];this[_0xb749('0x22')][_0x169d63[_0xb749('0x23')]]['remotestationid']=_0x169d63[_0xb749('0x33')];this['channels'][_0x169d63[_0xb749('0x23')]][_0xb749('0x34')]=_0x169d63[_0xb749('0x34')];this['channels'][_0x169d63[_0xb749('0x23')]][_0xb749('0x30')]=_0x169d63['localstationid'];this[_0xb749('0x22')][_0x169d63[_0xb749('0x23')]][_0xb749('0x35')]=_0x169d63['resolution'];this['channels'][_0x169d63[_0xb749('0x23')]]['transferrate']=_0x169d63['transferrate'];this[_0xb749('0x22')][_0x169d63[_0xb749('0x23')]][_0xb749('0x31')]=_0x169d63[_0xb749('0x31')];this[_0xb749('0x22')][_0x169d63[_0xb749('0x23')]][_0xb749('0x36')]=_0x169d63['calleridnum'];if(this[_0xb749('0x22')][_0x169d63['uniqueid']][_0xb749('0x34')]>0x0){tiff2pdf(_0x169d63[_0xb749('0x31')],_0xb749('0x37'),function(_0x4ce928){logger[_0xb749('0x26')](_0x169d63[_0xb749('0x23')],'\x20result\x20conversion\x20file\x20',_0x4ce928[_0xb749('0x38')]);attachment['create']({'name':path[_0xb749('0x39')](_0x169d63[_0xb749('0x31')])[_0xb749('0x25')],'basename':path[_0xb749('0x39')](_0x169d63[_0xb749('0x31')])[_0xb749('0x25')]+_0xb749('0x3a'),'type':_0xb749('0x3b')})[_0xb749('0x3c')](function(_0x11c77d){faxAccount[_0xb749('0x3d')](_0x2887db,{'from':_0x169d63[_0xb749('0x36')],'mapKey':_0xb749('0x3e'),'body':path['parse'](_0x169d63[_0xb749('0x31')])['name']+_0xb749('0x3a'),'AttachmentId':_0x11c77d['id']})[_0xb749('0x3f')](function(_0x9093cd){logger[_0xb749('0x40')](_0x169d63[_0xb749('0x23')],_0xb749('0x41'),JSON[_0xb749('0x42')](_0x9093cd));});})[_0xb749('0x3f')](function(_0x70eda1){logger[_0xb749('0x40')](_0x169d63[_0xb749('0x23')],_0xb749('0x43'),JSON[_0xb749('0x42')](_0x70eda1));});});}logger['info'](_0x169d63['uniqueid'],_0xb749('0x43'));}};Fax['prototype']['syncOriginateResponse']=function(_0x4ca533){if(this['actions'][_0x4ca533['uniqueid']]){_[_0xb749('0x44')](this[_0xb749('0x22')][_0x4ca533[_0xb749('0x23')]],_[_0xb749('0x45')](_0x4ca533,['response',_0xb749('0x46')]));}};function updateStatus(_0x4238ba){if(_0x4238ba['AttachmentId']){faxMessage[_0xb749('0x47')](_0x4238ba[_0xb749('0x48')],{'failMessage':_0xb749('0x49')})['then'](function(_0x5f2255){ut['logger'](_0xb749('0x4a'),_0x5f2255);})[_0xb749('0x3f')](function(_0x55540b){ut[_0xb749('0x4b')](_0xb749('0x4c'),_0x55540b);});}else{ut[_0xb749('0x4b')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xb749('0x1f')][_0xb749('0x4d')]=function(_0x7a8b1e,_0x2c4bc9,_0x40f1bb){var _0x4e212d=this;var _0x2af243={};if(_0x2c4bc9){_0x2af243={'read':_0x2c4bc9};}else{_0x2af243={'failMessage':_0x40f1bb};}if(this['actions'][_0x7a8b1e][_0xb749('0x48')]){faxMessage[_0xb749('0x47')](this[_0xb749('0x11')][_0x7a8b1e][_0xb749('0x48')],_0x2af243)[_0xb749('0x3c')](function(_0x150aae){ut[_0xb749('0x4b')](_0xb749('0x4e'),_0x150aae);})[_0xb749('0x3f')](function(_0x2472ab){ut[_0xb749('0x4b')](_0xb749('0x4f'),_0x2472ab);})['finally'](function(){delete _0x4e212d[_0xb749('0x22')][_0x7a8b1e];delete _0x4e212d[_0xb749('0x11')][_0x7a8b1e];});}else{ut['logger'](_0xb749('0x50'));delete this[_0xb749('0x22')][_0x7a8b1e];delete this['actions'][_0x7a8b1e];}};Fax[_0xb749('0x1f')][_0xb749('0x51')]=function(_0x2aa35e){var _0x4e3d2a=this;if(this['channels'][_0x2aa35e['uniqueid']]){if(this[_0xb749('0x11')][_0x2aa35e['uniqueid']]){this[_0xb749('0x22')][_0x2aa35e[_0xb749('0x23')]]['id']=this[_0xb749('0x11')][_0x2aa35e[_0xb749('0x23')]]['id'];this[_0xb749('0x22')][_0x2aa35e[_0xb749('0x23')]][_0xb749('0x25')]=this[_0xb749('0x11')][_0x2aa35e['uniqueid']][_0xb749('0x25')];}logger['info'](_0x2aa35e[_0xb749('0x23')],this[_0xb749('0x11')][_0x2aa35e['uniqueid']]?_0xb749('0x52'):_0xb749('0x53'),JSON['stringify'](this[_0xb749('0x22')][_0x2aa35e[_0xb749('0x23')]]));if(this[_0xb749('0x11')][_0x2aa35e['uniqueid']]){if(this['channels'][_0x2aa35e[_0xb749('0x23')]][_0xb749('0x54')]>0x0&&this[_0xb749('0x22')][_0x2aa35e[_0xb749('0x23')]][_0xb749('0x18')]===_0xb749('0x55')){this[_0xb749('0x4d')](_0x2aa35e[_0xb749('0x23')],!![]);}else{this[_0xb749('0x4d')](_0x2aa35e[_0xb749('0x23')],![],this[_0xb749('0x22')][_0x2aa35e['uniqueid']]['faxstatusstring']?_0xb749('0x56')+this[_0xb749('0x22')][_0x2aa35e['uniqueid']]['faxstatusstring']:_0xb749('0x57'));}}}};Fax[_0xb749('0x1f')][_0xb749('0x58')]=function(_0xdf1528){var _0x1235ab=this;return new BPromise(function(_0x36b0f7,_0x339c77){_0x1235ab[_0xb749('0x59')](_0xdf1528,_0x1235ab[_0xb749('0xf')][_0xdf1528[_0xb749('0x5a')]])[_0xb749('0x3c')](function(_0x5a4de1){ut[_0xb749('0x4b')](_0xb749('0x5b'),_0x5a4de1);_0x36b0f7(ut['message'](_0xb749('0x5c')));})['catch'](function(_0x5ad995){ut[_0xb749('0x4b')]('[Fax][execOriginate][failure]',_0x5ad995);updateStatus(_0xdf1528);_0x339c77(ut['message'](_0xb749('0x5d')));});});};Fax[_0xb749('0x1f')][_0xb749('0x5e')]=function(_0x99f990){var _0x4640eb=this;return new BPromise(function(_0x2181c9,_0x52d5aa){var _0x431700=_0x4640eb[_0xb749('0x5f')](_0x4640eb[_0xb749('0xf')][_0x99f990[_0xb749('0x5a')]][_0xb749('0x60')],_0x99f990);if(_0x431700[_0xb749('0x61')]){_0x2181c9(ut[_0xb749('0x38')](_0xb749('0x62')));}else{_0x52d5aa(ut[_0xb749('0x38')](_0x431700[_0xb749('0x38')]));}});};function originate(_0x912da4,_0x3eda9c,_0x27a525){return new BPromise(function(_0x507d04,_0x1d3d16){if(_0x27a525){var _0x2c52bb=util[_0xb749('0x63')](_0xb749('0x64'),path['parse'](_0x912da4[_0xb749('0x5')])[_0xb749('0x25')],_0x912da4[_0xb749('0x5')]);gs[_0xb749('0x65')](_0x2c52bb)[_0xb749('0x3c')](function(){_0x912da4['path']=util[_0xb749('0x63')](_0xb749('0x66'),path[_0xb749('0x39')](_0x912da4[_0xb749('0x5')])[_0xb749('0x67')],path[_0xb749('0x39')](_0x912da4[_0xb749('0x5')])['name']);_0x3eda9c[_0xb749('0x68')]=_0x912da4['path'];ut['logger'](_0xb749('0x69'),'');ami[_0xb749('0x6a')](ut[_0xb749('0x6b')](_0x912da4,_0x3eda9c))['then'](function(_0x56cdd3){_0x507d04(_0x56cdd3);})[_0xb749('0x3f')](function(_0x19297c){_0x1d3d16(_0x19297c);});})[_0xb749('0x3f')](function(_0x1192cd){_0x1d3d16(_0x1192cd);});}else{ami[_0xb749('0x6a')](ut['variablesAction'](_0x912da4,_0x3eda9c))[_0xb749('0x3c')](function(_0xe9bde6){_0x507d04(_0xe9bde6);})['catch'](function(_0xe8a08f){_0x1d3d16(_0xe8a08f);});}});}Fax[_0xb749('0x1f')]['execOriginate']=function(_0x53736b,_0xa81130){var _0x5c8721=this;return new BPromise(function(_0x59f55b,_0x18c983){var _0x44b760=uuid['v4']();var _0x34a245=ut[_0xb749('0x6c')](_0x53736b,_0xa81130);_0x5c8721[_0xb749('0x11')][_0x44b760]=new Action(_0x44b760,_0xa81130,_0x53736b);var _0x10752f=_0x5c8721[_0xb749('0x11')][_0x44b760];if(path[_0xb749('0x39')](_0x53736b['path'])[_0xb749('0x6d')]===_0xb749('0x3a')){originate(_0x10752f,_0x34a245,!![])['then'](function(_0x19347f){_0x59f55b(_0x19347f);})['catch'](function(_0x30bca1){_0x18c983(_0x30bca1);});}else{originate(_0x10752f,_0x34a245,![])[_0xb749('0x3c')](function(_0x7f60e){_0x59f55b(_0x7f60e);})['catch'](function(_0x2af12e){_0x18c983(_0x2af12e);});}});};Fax[_0xb749('0x1f')][_0xb749('0x6e')]=function(_0x4d96c2){return!_[_0xb749('0x6f')](_0x4d96c2)&&!_[_0xb749('0x6f')](_0x4d96c2[_0xb749('0x25')])&&!_[_0xb749('0x6f')](_0x4d96c2['active'])&&_0x4d96c2[_0xb749('0x70')]&&!_[_0xb749('0x6f')](this['trunks'][util[_0xb749('0x63')](_0xb749('0x71'),_0x4d96c2[_0xb749('0x25')])])&&!_[_0xb749('0x6f')](this[_0xb749('0x10')][util[_0xb749('0x63')]('SIP/%s',_0x4d96c2[_0xb749('0x25')])][_0xb749('0x2f')])&&(this['trunks'][util['format'](_0xb749('0x71'),_0x4d96c2['name'])][_0xb749('0x2f')]===_0xb749('0x72')||this['trunks'][util[_0xb749('0x63')](_0xb749('0x71'),_0x4d96c2[_0xb749('0x25')])][_0xb749('0x2f')]===_0xb749('0x73'));};Fax[_0xb749('0x1f')][_0xb749('0x5f')]=function(_0x4f4575,_0x260ddc){if(!this[_0xb749('0x6e')](_0x4f4575)){ut['logger'](_0xb749('0x74'),_[_0xb749('0x6f')](_0x4f4575)?'':_0x4f4575[_0xb749('0x25')]+_0xb749('0x75'));return{'isValid':![],'message':_0xb749('0x76')};}if(_['isNil'](_0x260ddc[_0xb749('0x3e')])){ut[_0xb749('0x4b')](_0xb749('0x77'),JSON[_0xb749('0x42')](_0x260ddc));return{'isValid':![],'message':_0xb749('0x78')};}if(_[_0xb749('0x6f')](_0x260ddc[_0xb749('0x5')])){ut[_0xb749('0x4b')](_0xb749('0x79'),JSON[_0xb749('0x42')](_0x260ddc));return{'isValid':![],'message':_0xb749('0x7a')};}return{'isValid':!![],'message':_0xb749('0x7b')};};module[_0xb749('0x7c')]=Fax; \ No newline at end of file +var _0x6afc=['\x20hangup\x20faxRiceive\x20','faxpages','updateStatus','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','then','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','addVariables','ext','isNil','active','format','SIP/%s','reachable','unmonitored','isTrunkReachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','lodash','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','varset','syncVarSet','bind','syncNewState','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','localstationid','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','\x20result\x20conversion\x20file\x20','create','parse','application/pdf','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20'];(function(_0xc93161,_0x347e90){var _0x13c4f0=function(_0x5c552e){while(--_0x5c552e){_0xc93161['push'](_0xc93161['shift']());}};_0x13c4f0(++_0x347e90);}(_0x6afc,0x191));var _0xc6af=function(_0x2884bf,_0x2d09d8){_0x2884bf=_0x2884bf-0x0;var _0xe17f8b=_0x6afc[_0x2884bf];return _0xe17f8b;};'use strict';var util=require('util');var _=require(_0xc6af('0x0'));var BPromise=require(_0xc6af('0x1'));var uuid=require(_0xc6af('0x2'));var moment=require(_0xc6af('0x3'));var path=require(_0xc6af('0x4'));var tiff2pdf=require(_0xc6af('0x5'));var gs=require('./util/gs');var logger=require(_0xc6af('0x6'))(_0xc6af('0x7'));var ami=require(_0xc6af('0x8'));var rpcDb=require(_0xc6af('0x9'));var Channel=require(_0xc6af('0xa'));var ut=require(_0xc6af('0xb'));var Action=require(_0xc6af('0xc'));var faxAccount=require(_0xc6af('0xd'));var attachment=require(_0xc6af('0xe'));var faxMessage=require(_0xc6af('0xf'));function Fax(_0xefb257){this['channels']={};this[_0xc6af('0x10')]=_0xefb257[_0xc6af('0x10')];this[_0xc6af('0x11')]=_0xefb257[_0xc6af('0x11')];this[_0xc6af('0x12')]={};ami['on'](_0xc6af('0x13'),this['syncNewchannel']['bind'](this));ami['on'](_0xc6af('0x14'),this[_0xc6af('0x15')][_0xc6af('0x16')](this));ami['on']('newstate',this[_0xc6af('0x17')][_0xc6af('0x16')](this));ami['on']('newexten',this['syncNewExten'][_0xc6af('0x16')](this));ami['on'](_0xc6af('0x18'),this[_0xc6af('0x19')][_0xc6af('0x16')](this));ami['on']('receivefax',this[_0xc6af('0x1a')][_0xc6af('0x16')](this));ami['on'](_0xc6af('0x1b'),this[_0xc6af('0x1c')]['bind'](this));ami['on'](_0xc6af('0x1d'),this['syncOriginateResponse'][_0xc6af('0x16')](this));}Fax[_0xc6af('0x1e')][_0xc6af('0x1f')]=function(_0x31a42b){if(_0x31a42b[_0xc6af('0x20')]===_0xc6af('0x21')){for(var _0x2cc0fa in this['faxAccounts']){if(this['faxAccounts'][_0xc6af('0x22')](_0x2cc0fa)){if(_0x31a42b[_0xc6af('0x23')]===this[_0xc6af('0x10')][_0x2cc0fa]['localstationid']){this[_0xc6af('0x24')][_0x31a42b[_0xc6af('0x25')]]={};this[_0xc6af('0x24')][_0x31a42b['uniqueid']][_0xc6af('0x26')]=_0x31a42b[_0xc6af('0x26')];this[_0xc6af('0x24')][_0x31a42b[_0xc6af('0x25')]]['id']=this[_0xc6af('0x10')][_0x2cc0fa]['id'];this[_0xc6af('0x24')][_0x31a42b[_0xc6af('0x25')]][_0xc6af('0x27')]=this[_0xc6af('0x10')][_0x2cc0fa]['name'];logger[_0xc6af('0x28')](_0x31a42b[_0xc6af('0x25')],_0xc6af('0x29'));}}}}if(this[_0xc6af('0x12')][_0x31a42b['uniqueid']]){this[_0xc6af('0x24')][_0x31a42b[_0xc6af('0x25')]]={};this[_0xc6af('0x24')][_0x31a42b[_0xc6af('0x25')]]['channel']=_0x31a42b['channel'];logger[_0xc6af('0x28')](_0x31a42b[_0xc6af('0x25')],_0xc6af('0x29'));}};Fax['prototype']['syncVarSet']=function(_0x58e7dd){if(this[_0xc6af('0x24')][_0x58e7dd['uniqueid']]){for(var _0x15822d in _0x58e7dd[_0xc6af('0x2a')]){if(_0x58e7dd[_0xc6af('0x2a')]['hasOwnProperty'](_0x15822d)){this['channels'][_0x58e7dd[_0xc6af('0x25')]][_0x15822d]=_0x58e7dd[_0xc6af('0x2b')];}}}};Fax[_0xc6af('0x1e')][_0xc6af('0x17')]=function(_0x25eb0a){if(this[_0xc6af('0x24')][_0x25eb0a['uniqueid']]){this['channels'][_0x25eb0a[_0xc6af('0x25')]][_0xc6af('0x2c')]=_0x25eb0a['channelstate'];this[_0xc6af('0x24')][_0x25eb0a[_0xc6af('0x25')]][_0xc6af('0x2d')]=_0x25eb0a['channelstatedesc'];}};Fax[_0xc6af('0x1e')][_0xc6af('0x2e')]=function(_0xa2c0a2){if(this[_0xc6af('0x24')][_0xa2c0a2[_0xc6af('0x25')]]){for(var _0x59f986 in _0xa2c0a2[_0xc6af('0x2a')]){if(_0xa2c0a2[_0xc6af('0x2a')][_0xc6af('0x22')](_0x59f986)){this[_0xc6af('0x24')][_0xa2c0a2[_0xc6af('0x25')]][_0x59f986]=_0xa2c0a2[_0xc6af('0x2b')];}}}};Fax[_0xc6af('0x1e')]['syncFaxStatus']=function(_0x506220){if(this[_0xc6af('0x24')][_0x506220[_0xc6af('0x25')]]){this[_0xc6af('0x24')][_0x506220['uniqueid']][_0xc6af('0x2f')]=_0x506220[_0xc6af('0x2f')];this['channels'][_0x506220['uniqueid']][_0xc6af('0x30')]=_0x506220[_0xc6af('0x30')];this[_0xc6af('0x24')][_0x506220[_0xc6af('0x25')]][_0xc6af('0x31')]=_0x506220[_0xc6af('0x31')];this['channels'][_0x506220['uniqueid']]['filename']=_0x506220['filename'];logger[_0xc6af('0x28')](_0x506220['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0xc6af('0x1e')][_0xc6af('0x1a')]=function(_0x5e4865){var _0xa63964=this;if(this['channels'][_0x5e4865[_0xc6af('0x25')]]){var _0x231aaa=this['channels'][_0x5e4865[_0xc6af('0x25')]]['id'];this['channels'][_0x5e4865[_0xc6af('0x25')]]['remotestationid']=_0x5e4865[_0xc6af('0x32')];this[_0xc6af('0x24')][_0x5e4865[_0xc6af('0x25')]][_0xc6af('0x33')]=_0x5e4865[_0xc6af('0x33')];this[_0xc6af('0x24')][_0x5e4865[_0xc6af('0x25')]][_0xc6af('0x31')]=_0x5e4865['localstationid'];this[_0xc6af('0x24')][_0x5e4865[_0xc6af('0x25')]]['resolution']=_0x5e4865[_0xc6af('0x34')];this[_0xc6af('0x24')][_0x5e4865[_0xc6af('0x25')]]['transferrate']=_0x5e4865[_0xc6af('0x35')];this['channels'][_0x5e4865[_0xc6af('0x25')]][_0xc6af('0x36')]=_0x5e4865[_0xc6af('0x36')];this['channels'][_0x5e4865['uniqueid']][_0xc6af('0x37')]=_0x5e4865[_0xc6af('0x37')];if(this[_0xc6af('0x24')][_0x5e4865['uniqueid']][_0xc6af('0x33')]>0x0){tiff2pdf(_0x5e4865['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x22c972){logger[_0xc6af('0x28')](_0x5e4865[_0xc6af('0x25')],_0xc6af('0x38'),_0x22c972['message']);attachment[_0xc6af('0x39')]({'name':path['parse'](_0x5e4865[_0xc6af('0x36')])[_0xc6af('0x27')],'basename':path[_0xc6af('0x3a')](_0x5e4865[_0xc6af('0x36')])[_0xc6af('0x27')]+'.pdf','type':_0xc6af('0x3b')})['then'](function(_0x4cd20c){faxAccount[_0xc6af('0x3c')](_0x231aaa,{'from':_0x5e4865[_0xc6af('0x37')],'mapKey':_0xc6af('0x7'),'body':path[_0xc6af('0x3a')](_0x5e4865[_0xc6af('0x36')])[_0xc6af('0x27')]+_0xc6af('0x3d'),'AttachmentId':_0x4cd20c['id']})[_0xc6af('0x3e')](function(_0x2fc248){logger[_0xc6af('0x3f')](_0x5e4865[_0xc6af('0x25')],_0xc6af('0x40'),JSON[_0xc6af('0x41')](_0x2fc248));});})[_0xc6af('0x3e')](function(_0x167a90){logger['error'](_0x5e4865[_0xc6af('0x25')],'\x20receiveFax\x20',JSON['stringify'](_0x167a90));});});}logger['info'](_0x5e4865['uniqueid'],_0xc6af('0x42'));}};Fax['prototype']['syncOriginateResponse']=function(_0x423ad3){if(this[_0xc6af('0x12')][_0x423ad3[_0xc6af('0x25')]]){_[_0xc6af('0x43')](this[_0xc6af('0x24')][_0x423ad3['uniqueid']],_[_0xc6af('0x44')](_0x423ad3,[_0xc6af('0x45'),'reason']));}};function updateStatus(_0x558427){if(_0x558427[_0xc6af('0x46')]){faxMessage[_0xc6af('0x47')](_0x558427['AttachmentId'],{'failMessage':_0xc6af('0x48')})['then'](function(_0x99738b){ut[_0xc6af('0x49')]('[Fax][Message][Error][Updated]',_0x99738b);})[_0xc6af('0x3e')](function(_0x1d4d47){ut[_0xc6af('0x49')](_0xc6af('0x4a'),_0x1d4d47);});}else{ut[_0xc6af('0x49')](_0xc6af('0x4b'));}}Fax['prototype']['updateStatus']=function(_0x4e39a3,_0x5af562,_0x21af7d){var _0x56e11d=this;var _0x5a9cee={};if(_0x5af562){_0x5a9cee={'read':_0x5af562};}else{_0x5a9cee={'failMessage':_0x21af7d};}if(this['actions'][_0x4e39a3][_0xc6af('0x46')]){faxMessage[_0xc6af('0x47')](this['actions'][_0x4e39a3][_0xc6af('0x46')],_0x5a9cee)['then'](function(_0x117a14){ut[_0xc6af('0x49')]('[Fax][Message][Updated]',_0x117a14);})['catch'](function(_0xdc182b){ut[_0xc6af('0x49')]('[Fax][Message][NoUpdate1]',_0xdc182b);})[_0xc6af('0x4c')](function(){delete _0x56e11d['channels'][_0x4e39a3];delete _0x56e11d[_0xc6af('0x12')][_0x4e39a3];});}else{ut[_0xc6af('0x49')](_0xc6af('0x4d'));delete this[_0xc6af('0x24')][_0x4e39a3];delete this[_0xc6af('0x12')][_0x4e39a3];}};Fax[_0xc6af('0x1e')][_0xc6af('0x1c')]=function(_0x176105){var _0x5de01a=this;if(this[_0xc6af('0x24')][_0x176105[_0xc6af('0x25')]]){if(this[_0xc6af('0x12')][_0x176105[_0xc6af('0x25')]]){this[_0xc6af('0x24')][_0x176105['uniqueid']]['id']=this[_0xc6af('0x12')][_0x176105['uniqueid']]['id'];this[_0xc6af('0x24')][_0x176105[_0xc6af('0x25')]]['name']=this[_0xc6af('0x12')][_0x176105[_0xc6af('0x25')]][_0xc6af('0x27')];}logger[_0xc6af('0x28')](_0x176105[_0xc6af('0x25')],this[_0xc6af('0x12')][_0x176105[_0xc6af('0x25')]]?_0xc6af('0x4e'):_0xc6af('0x4f'),JSON['stringify'](this[_0xc6af('0x24')][_0x176105[_0xc6af('0x25')]]));if(this['actions'][_0x176105[_0xc6af('0x25')]]){if(this[_0xc6af('0x24')][_0x176105[_0xc6af('0x25')]][_0xc6af('0x50')]>0x0&&this[_0xc6af('0x24')][_0x176105[_0xc6af('0x25')]][_0xc6af('0x18')]==='SUCCESS'){this['updateStatus'](_0x176105['uniqueid'],!![]);}else{this[_0xc6af('0x51')](_0x176105[_0xc6af('0x25')],![],this[_0xc6af('0x24')][_0x176105[_0xc6af('0x25')]]['faxstatusstring']?_0xc6af('0x52')+this[_0xc6af('0x24')][_0x176105[_0xc6af('0x25')]][_0xc6af('0x53')]:_0xc6af('0x54'));}}}};Fax[_0xc6af('0x1e')][_0xc6af('0x55')]=function(_0xba5f52){var _0x369a05=this;return new BPromise(function(_0x11c9b9,_0x162585){_0x369a05[_0xc6af('0x56')](_0xba5f52,_0x369a05[_0xc6af('0x10')][_0xba5f52[_0xc6af('0x57')]])['then'](function(_0x42c313){ut['logger'](_0xc6af('0x58'),_0x42c313);_0x11c9b9(ut[_0xc6af('0x59')](_0xc6af('0x5a')));})['catch'](function(_0x363499){ut[_0xc6af('0x49')](_0xc6af('0x5b'),_0x363499);updateStatus(_0xba5f52);_0x162585(ut[_0xc6af('0x59')](_0xc6af('0x5c')));});});};Fax[_0xc6af('0x1e')]['checkAfterSend']=function(_0x5eb95d){var _0x34bb6d=this;return new BPromise(function(_0x35ef1e,_0x152d5e){var _0x35aa6b=_0x34bb6d[_0xc6af('0x5d')](_0x34bb6d[_0xc6af('0x10')][_0x5eb95d[_0xc6af('0x57')]][_0xc6af('0x5e')],_0x5eb95d);if(_0x35aa6b[_0xc6af('0x5f')]){_0x35ef1e(ut['message'](_0xc6af('0x60')));}else{_0x152d5e(ut[_0xc6af('0x59')](_0x35aa6b[_0xc6af('0x59')]));}});};function originate(_0x4809e7,_0x3ccabf,_0x34b9d5){return new BPromise(function(_0x3b0703,_0x25d4dc){if(_0x34b9d5){var _0x31db21=util['format'](_0xc6af('0x61'),path['parse'](_0x4809e7['path'])[_0xc6af('0x27')],_0x4809e7[_0xc6af('0x4')]);gs[_0xc6af('0x62')](_0x31db21)[_0xc6af('0x63')](function(){_0x4809e7[_0xc6af('0x4')]=util['format']('%s/%s.tif',path[_0xc6af('0x3a')](_0x4809e7[_0xc6af('0x4')])[_0xc6af('0x64')],path[_0xc6af('0x3a')](_0x4809e7[_0xc6af('0x4')])['name']);_0x3ccabf[_0xc6af('0x65')]=_0x4809e7[_0xc6af('0x4')];ut[_0xc6af('0x49')](_0xc6af('0x66'),'');ami[_0xc6af('0x67')](ut['variablesAction'](_0x4809e7,_0x3ccabf))[_0xc6af('0x63')](function(_0xffeed7){_0x3b0703(_0xffeed7);})['catch'](function(_0x4a894f){_0x25d4dc(_0x4a894f);});})[_0xc6af('0x3e')](function(_0x3db3ff){_0x25d4dc(_0x3db3ff);});}else{ami[_0xc6af('0x67')](ut['variablesAction'](_0x4809e7,_0x3ccabf))['then'](function(_0x5dd592){_0x3b0703(_0x5dd592);})[_0xc6af('0x3e')](function(_0x57d23d){_0x25d4dc(_0x57d23d);});}});}Fax[_0xc6af('0x1e')][_0xc6af('0x56')]=function(_0x2ad142,_0x2cbef3){var _0x25240d=this;return new BPromise(function(_0x32feb2,_0x24a7ac){var _0x43fb19=uuid['v4']();var _0x357cd5=ut[_0xc6af('0x68')](_0x2ad142,_0x2cbef3);_0x25240d[_0xc6af('0x12')][_0x43fb19]=new Action(_0x43fb19,_0x2cbef3,_0x2ad142);var _0xd7898d=_0x25240d[_0xc6af('0x12')][_0x43fb19];if(path[_0xc6af('0x3a')](_0x2ad142[_0xc6af('0x4')])[_0xc6af('0x69')]===_0xc6af('0x3d')){originate(_0xd7898d,_0x357cd5,!![])[_0xc6af('0x63')](function(_0x4b055e){_0x32feb2(_0x4b055e);})[_0xc6af('0x3e')](function(_0x5a7adb){_0x24a7ac(_0x5a7adb);});}else{originate(_0xd7898d,_0x357cd5,![])[_0xc6af('0x63')](function(_0x52d9bd){_0x32feb2(_0x52d9bd);})[_0xc6af('0x3e')](function(_0xb85cdd){_0x24a7ac(_0xb85cdd);});}});};Fax[_0xc6af('0x1e')]['isTrunkReachable']=function(_0x3a6783){return!_[_0xc6af('0x6a')](_0x3a6783)&&!_[_0xc6af('0x6a')](_0x3a6783[_0xc6af('0x27')])&&!_[_0xc6af('0x6a')](_0x3a6783[_0xc6af('0x6b')])&&_0x3a6783[_0xc6af('0x6b')]&&!_[_0xc6af('0x6a')](this[_0xc6af('0x11')][util[_0xc6af('0x6c')](_0xc6af('0x6d'),_0x3a6783[_0xc6af('0x27')])])&&!_[_0xc6af('0x6a')](this[_0xc6af('0x11')][util[_0xc6af('0x6c')](_0xc6af('0x6d'),_0x3a6783[_0xc6af('0x27')])][_0xc6af('0x30')])&&(this[_0xc6af('0x11')][util[_0xc6af('0x6c')](_0xc6af('0x6d'),_0x3a6783[_0xc6af('0x27')])][_0xc6af('0x30')]===_0xc6af('0x6e')||this[_0xc6af('0x11')][util[_0xc6af('0x6c')](_0xc6af('0x6d'),_0x3a6783['name'])]['status']===_0xc6af('0x6f'));};Fax['prototype'][_0xc6af('0x5d')]=function(_0x5f14e5,_0x528b00){if(!this[_0xc6af('0x70')](_0x5f14e5)){ut[_0xc6af('0x49')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0xc6af('0x6a')](_0x5f14e5)?'':_0x5f14e5[_0xc6af('0x27')]+_0xc6af('0x71'));return{'isValid':![],'message':_0xc6af('0x72')};}if(_[_0xc6af('0x6a')](_0x528b00[_0xc6af('0x7')])){ut[_0xc6af('0x49')](_0xc6af('0x73'),JSON[_0xc6af('0x41')](_0x528b00));return{'isValid':![],'message':_0xc6af('0x74')};}if(_['isNil'](_0x528b00[_0xc6af('0x4')])){ut[_0xc6af('0x49')](_0xc6af('0x75'),JSON[_0xc6af('0x41')](_0x528b00));return{'isValid':![],'message':_0xc6af('0x76')};}return{'isValid':!![],'message':_0xc6af('0x77')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 5154e52..422a550 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 _0xd3e4=['lodash','error','inspect','notify','resolve','then','catch','[Notify]\x20','util','preview'];(function(_0x1fe32d,_0x75967e){var _0x36f52a=function(_0x1e9592){while(--_0x1e9592){_0x1fe32d['push'](_0x1fe32d['shift']());}};_0x36f52a(++_0x75967e);}(_0xd3e4,0x120));var _0x4d3e=function(_0x5e7b0a,_0xe2a383){_0x5e7b0a=_0x5e7b0a-0x0;var _0x59e412=_0xd3e4[_0x5e7b0a];return _0x59e412;};'use strict';var util=require(_0x4d3e('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x4d3e('0x1'));var _=require(_0x4d3e('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x2b922c){return function(_0x50c83c){logger[_0x4d3e('0x3')](_0x2b922c,util[_0x4d3e('0x4')](_0x50c83c,{'showHidden':![],'depth':null}));};}exports[_0x4d3e('0x5')]=function(_0x5bf302,_0x5908c3){return BPromise[_0x4d3e('0x6')]()[_0x4d3e('0x7')](faxAccount[_0x4d3e('0x5')](_0x5bf302,_0x5908c3))[_0x4d3e('0x8')](loggerCatch(_0x4d3e('0x9')));}; \ No newline at end of file +var _0x6a33=['catch','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','then'];(function(_0x2b19dc,_0x5a4ef4){var _0x23bda4=function(_0x4e3665){while(--_0x4e3665){_0x2b19dc['push'](_0x2b19dc['shift']());}};_0x23bda4(++_0x5a4ef4);}(_0x6a33,0xc7));var _0x36a3=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x6a33[_0xe73080];return _0x12cbc4;};'use strict';var util=require(_0x36a3('0x0'));var BPromise=require(_0x36a3('0x1'));var logger=require(_0x36a3('0x2'))(_0x36a3('0x3'));var _=require(_0x36a3('0x4'));var faxAccount=require(_0x36a3('0x5'));function loggerCatch(_0x3ab3b7){return function(_0x39ffdc){logger[_0x36a3('0x6')](_0x3ab3b7,util[_0x36a3('0x7')](_0x39ffdc,{'showHidden':![],'depth':null}));};}exports[_0x36a3('0x8')]=function(_0x15a5d0,_0x19e93a){return BPromise['resolve']()[_0x36a3('0x9')](faxAccount['notify'](_0x15a5d0,_0x19e93a))[_0x36a3('0xa')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 7e1a9f9..4f26639 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 _0x7c89=['fax','bluebird','info','Exec\x20gs','inspect','util','../../../../config/logger'];(function(_0x371c60,_0x3babc4){var _0x59c639=function(_0x922bfd){while(--_0x922bfd){_0x371c60['push'](_0x371c60['shift']());}};_0x59c639(++_0x3babc4);}(_0x7c89,0xa6));var _0x97c8=function(_0x467cb1,_0x1fca21){_0x467cb1=_0x467cb1-0x0;var _0x584cd1=_0x7c89[_0x467cb1];return _0x584cd1;};'use strict';var util=require(_0x97c8('0x0'));var logger=require(_0x97c8('0x1'))(_0x97c8('0x2'));var BPromise=require(_0x97c8('0x3'));var exec=require('child_process')['exec'];exports['execute']=function(_0x20c8e2){return new BPromise(function(_0x27189a,_0x408842){exec(_0x20c8e2,function(_0x4a3942,_0xec64d8,_0x368225){logger['info']('Exec\x20gs',_0xec64d8);if(_0x4a3942){logger[_0x97c8('0x4')](_0x97c8('0x5'),'\x20Error\x20:',util[_0x97c8('0x6')](_0x4a3942,{'showHidden':![],'depth':null}),_0xec64d8,_0x368225);_0x408842(_0x4a3942);}_0x27189a(_0xec64d8);});});}; \ No newline at end of file +var _0xbcee=['exec','execute','Exec\x20gs','inspect','util','../../../../config/logger','fax','bluebird','child_process'];(function(_0x4de3b0,_0x3018b2){var _0x223599=function(_0x366877){while(--_0x366877){_0x4de3b0['push'](_0x4de3b0['shift']());}};_0x223599(++_0x3018b2);}(_0xbcee,0x163));var _0xebce=function(_0x2d9f2e,_0x4f107c){_0x2d9f2e=_0x2d9f2e-0x0;var _0x44dde0=_0xbcee[_0x2d9f2e];return _0x44dde0;};'use strict';var util=require(_0xebce('0x0'));var logger=require(_0xebce('0x1'))(_0xebce('0x2'));var BPromise=require(_0xebce('0x3'));var exec=require(_0xebce('0x4'))[_0xebce('0x5')];exports[_0xebce('0x6')]=function(_0xfed781){return new BPromise(function(_0x52ab4f,_0xc59489){exec(_0xfed781,function(_0x3f820e,_0xe22768,_0x3f4e1d){logger['info'](_0xebce('0x7'),_0xe22768);if(_0x3f820e){logger['info'](_0xebce('0x7'),'\x20Error\x20:',util[_0xebce('0x8')](_0x3f820e,{'showHidden':![],'depth':null}),_0xe22768,_0x3f4e1d);_0xc59489(_0x3f820e);}_0x52ab4f(_0xe22768);});});}; \ 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 4c8cd72..6c70d76 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 _0x7029=['variablesAction','uniqueid','originate','xcally-motion-fax','util','moment','../../../../config/logger','fax','message','logger','inspect','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7029,0x101));var _0x9702=function(_0x50ee59,_0xfe1421){_0x50ee59=_0x50ee59-0x0;var _0x4c5840=_0x7029[_0x50ee59];return _0x4c5840;};'use strict';var util=require(_0x9702('0x0'));var _=require('lodash');var moment=require(_0x9702('0x1'));var logger=require(_0x9702('0x2'))(_0x9702('0x3'));exports[_0x9702('0x4')]=function(_0x1db467){return{'message':_0x1db467};};exports[_0x9702('0x5')]=function(_0x284f09,_0x399afb){logger['info'](_0x284f09,util[_0x9702('0x6')](_0x399afb,{'showHidden':![],'depth':null}));};exports[_0x9702('0x7')]=function(_0x247e09,_0x1ec8b1){var _0x453c7c={'XMF-ECM':_0x1ec8b1[_0x9702('0x8')],'XMF-HEADERINFO':_0x1ec8b1[_0x9702('0x9')],'XMF-MINRATE':_0x1ec8b1['minrate'],'XMF-MAXRATE':_0x1ec8b1[_0x9702('0xa')],'XMF-MODEM':util[_0x9702('0xb')](_0x9702('0xc'),_0x1ec8b1[_0x9702('0xd')]),'XMF-GATEWAY':_0x1ec8b1[_0x9702('0xe')],'XMF-FAXDETECT':_0x1ec8b1[_0x9702('0xf')],'XMF-T38TIMEOUT':_0x1ec8b1[_0x9702('0x10')],'XMF-LOCALSTATIONID':_0x1ec8b1[_0x9702('0x11')],'XMF-PATH':_0x247e09[_0x9702('0x12')]};return _0x453c7c;};exports[_0x9702('0x13')]=function(_0x4cb589,_0xca7483){return{'actionid':_0x4cb589[_0x9702('0x14')],'action':_0x9702('0x15'),'channel':_0x4cb589['channel'],'Exten':_0x9702('0x16'),'Context':'from-sip','Priority':'1','callerid':util[_0x9702('0xb')]('\x22%s\x22\x20<%s>',_0x4cb589[_0x9702('0x9')]?_0x4cb589[_0x9702('0x9')]:'',_0x4cb589['localstationid']),'variable':_0xca7483,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4cb589['uniqueid']};}; \ No newline at end of file +var _0x80c7=['info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','t38timeout','localstationid','path','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','moment','fax','message','logger'];(function(_0x383523,_0x262138){var _0x29c502=function(_0x3e64cd){while(--_0x3e64cd){_0x383523['push'](_0x383523['shift']());}};_0x29c502(++_0x262138);}(_0x80c7,0x73));var _0x780c=function(_0x1970a3,_0x29aef1){_0x1970a3=_0x1970a3-0x0;var _0x494cc9=_0x80c7[_0x1970a3];return _0x494cc9;};'use strict';var util=require(_0x780c('0x0'));var _=require('lodash');var moment=require(_0x780c('0x1'));var logger=require('../../../../config/logger')(_0x780c('0x2'));exports[_0x780c('0x3')]=function(_0x5c739c){return{'message':_0x5c739c};};exports[_0x780c('0x4')]=function(_0x10c550,_0x1ee316){logger[_0x780c('0x5')](_0x10c550,util[_0x780c('0x6')](_0x1ee316,{'showHidden':![],'depth':null}));};exports[_0x780c('0x7')]=function(_0x124ca0,_0x1a4745){var _0x37e48a={'XMF-ECM':_0x1a4745[_0x780c('0x8')],'XMF-HEADERINFO':_0x1a4745[_0x780c('0x9')],'XMF-MINRATE':_0x1a4745[_0x780c('0xa')],'XMF-MAXRATE':_0x1a4745[_0x780c('0xb')],'XMF-MODEM':util[_0x780c('0xc')](_0x780c('0xd'),_0x1a4745[_0x780c('0xe')]),'XMF-GATEWAY':_0x1a4745['gateway'],'XMF-FAXDETECT':_0x1a4745['faxdetect'],'XMF-T38TIMEOUT':_0x1a4745[_0x780c('0xf')],'XMF-LOCALSTATIONID':_0x1a4745[_0x780c('0x10')],'XMF-PATH':_0x124ca0[_0x780c('0x11')]};return _0x37e48a;};exports[_0x780c('0x12')]=function(_0x26bdc0,_0x1c0d40){return{'actionid':_0x26bdc0[_0x780c('0x13')],'action':'originate','channel':_0x26bdc0[_0x780c('0x14')],'Exten':_0x780c('0x15'),'Context':_0x780c('0x16'),'Priority':'1','callerid':util[_0x780c('0xc')](_0x780c('0x17'),_0x26bdc0[_0x780c('0x9')]?_0x26bdc0[_0x780c('0x9')]:'',_0x26bdc0[_0x780c('0x10')]),'variable':_0x1c0d40,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x26bdc0[_0x780c('0x13')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 226603d..d995109 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 _0xcff4=['getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getSalesforceAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initFaxAccounts','initVoiceQueueReports','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','hour','get','resolve','then','getAgents','initAgents','initTrunks'];(function(_0x3e6607,_0x359565){var _0x1e0242=function(_0xde2b37){while(--_0xde2b37){_0x3e6607['push'](_0x3e6607['shift']());}};_0x1e0242(++_0x359565);}(_0xcff4,0x197));var _0x4cff=function(_0x30a308,_0x3bc1d5){_0x30a308=_0x30a308-0x0;var _0x187598=_0xcff4[_0x30a308];return _0x187598;};'use strict';var BPromise=require(_0x4cff('0x0'));var util=require(_0x4cff('0x1'));var moment=require(_0x4cff('0x2'));var server=require('./server');var Realtime=require(_0x4cff('0x3'));var Report=require(_0x4cff('0x4'));var Acw=require('./acw');var Trigger=require(_0x4cff('0x5'));var Dialer=require(_0x4cff('0x6'));var Preview=require(_0x4cff('0x7'));var Fax=require(_0x4cff('0x8'));var user=require(_0x4cff('0x9'));var voiceQueue=require(_0x4cff('0xa'));var voiceQueueReport=require(_0x4cff('0xb'));var voiceCallReport=require(_0x4cff('0xc'));var trunk=require(_0x4cff('0xd'));var trigger=require(_0x4cff('0xe'));var template=require(_0x4cff('0xf'));var cmHopperHistory=require(_0x4cff('0x10'));var campaign=require(_0x4cff('0x11'));var voiceExtension=require(_0x4cff('0x12'));var faxAccount=require(_0x4cff('0x13'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x4cff('0x14'));var freshdesk=require(_0x4cff('0x15'));var desk=require(_0x4cff('0x16'));var zoho=require(_0x4cff('0x17'));var vtiger=require(_0x4cff('0x18'));var freshsales=require(_0x4cff('0x19'));var servicenow=require(_0x4cff('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'](_0x4cff('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4cff('0x1c')](_0x4cff('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x4cff('0x1d')]()[_0x4cff('0x1e')](user[_0x4cff('0x1f')]())['then'](realtime[_0x4cff('0x20')]())['then'](user['getTelephones']())[_0x4cff('0x1e')](realtime['initTelephones']())[_0x4cff('0x1e')](trunk['getTrunks']())['then'](realtime[_0x4cff('0x21')]())[_0x4cff('0x1e')](voiceQueue[_0x4cff('0x22')]())[_0x4cff('0x1e')](realtime[_0x4cff('0x23')]())[_0x4cff('0x1e')](trigger[_0x4cff('0x24')]())['then'](realtime[_0x4cff('0x25')]())['then'](template[_0x4cff('0x26')]())['then'](realtime[_0x4cff('0x27')]())[_0x4cff('0x1e')](zendesk['getZendeskAccounts']())[_0x4cff('0x1e')](realtime['initZendeskAccounts']())[_0x4cff('0x1e')](salesforce[_0x4cff('0x28')]())[_0x4cff('0x1e')](realtime['initSalesforceAccounts']())[_0x4cff('0x1e')](sugarcrm['getSugarcrmAccounts']())[_0x4cff('0x1e')](realtime[_0x4cff('0x29')]())[_0x4cff('0x1e')](freshdesk['getFreshdeskAccounts']())[_0x4cff('0x1e')](realtime[_0x4cff('0x2a')]())[_0x4cff('0x1e')](desk[_0x4cff('0x2b')]())[_0x4cff('0x1e')](realtime[_0x4cff('0x2c')]())['then'](zoho[_0x4cff('0x2d')]())['then'](realtime[_0x4cff('0x2e')]())[_0x4cff('0x1e')](vtiger[_0x4cff('0x2f')]())[_0x4cff('0x1e')](realtime[_0x4cff('0x30')]())[_0x4cff('0x1e')](freshsales[_0x4cff('0x31')]())[_0x4cff('0x1e')](realtime[_0x4cff('0x32')]())['then'](servicenow[_0x4cff('0x33')]())[_0x4cff('0x1e')](realtime['initServicenowAccounts']())[_0x4cff('0x1e')](dynamics365['getDynamics365Accounts']())[_0x4cff('0x1e')](realtime[_0x4cff('0x34')]())[_0x4cff('0x1e')](campaign['getCampaigns']())[_0x4cff('0x1e')](realtime[_0x4cff('0x35')]())[_0x4cff('0x1e')](voiceExtension[_0x4cff('0x36')]())[_0x4cff('0x1e')](realtime['initVoiceExtensions']())['then'](faxAccount['getFaxAccounts']())[_0x4cff('0x1e')](realtime[_0x4cff('0x37')]())[_0x4cff('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0x4cff('0x1d')]()[_0x4cff('0x1e')](voiceQueueReport['getVoiceQueueReports']())[_0x4cff('0x1e')](realtime[_0x4cff('0x38')]())[_0x4cff('0x1e')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x4cff('0x1e')](realtime['initVoiceQueueHopperHistory']())[_0x4cff('0x1e')](cmHopperHistory['getCampaignHopperHistory']())[_0x4cff('0x1e')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x4cff('0x39')]())[_0x4cff('0x1e')](realtime[_0x4cff('0x3a')]())[_0x4cff('0x1e')](function(_0x357d56){})[_0x4cff('0x3b')](function(_0x1885ae){console[_0x4cff('0x3c')](_0x1885ae);});}function main(){return server[_0x4cff('0x3d')](realtime,preview,fax)[_0x4cff('0x1e')](function(_0x5443e0){return initRealtime();})[_0x4cff('0x1e')](function(){return initParams();})[_0x4cff('0x1e')](function(){report[_0x4cff('0x3e')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x12ddec){console[_0x4cff('0x3c')](_0x12ddec);});}main(); \ No newline at end of file +var _0x572f=['./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk'];(function(_0x306b5b,_0x2f8e56){var _0xdae76d=function(_0x41f133){while(--_0x41f133){_0x306b5b['push'](_0x306b5b['shift']());}};_0xdae76d(++_0x2f8e56);}(_0x572f,0x10d));var _0xf572=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x572f[_0x40a045];return _0x1a687c;};'use strict';var BPromise=require(_0xf572('0x0'));var util=require(_0xf572('0x1'));var moment=require(_0xf572('0x2'));var server=require(_0xf572('0x3'));var Realtime=require(_0xf572('0x4'));var Report=require(_0xf572('0x5'));var Acw=require(_0xf572('0x6'));var Trigger=require(_0xf572('0x7'));var Dialer=require(_0xf572('0x8'));var Preview=require(_0xf572('0x9'));var Fax=require(_0xf572('0xa'));var user=require('./rpc/user');var voiceQueue=require(_0xf572('0xb'));var voiceQueueReport=require(_0xf572('0xc'));var voiceCallReport=require(_0xf572('0xd'));var trunk=require(_0xf572('0xe'));var trigger=require(_0xf572('0xf'));var template=require(_0xf572('0x10'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xf572('0x11'));var voiceExtension=require(_0xf572('0x12'));var faxAccount=require(_0xf572('0x13'));var zendesk=require(_0xf572('0x14'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xf572('0x15'));var freshdesk=require(_0xf572('0x16'));var desk=require(_0xf572('0x17'));var zoho=require(_0xf572('0x18'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xf572('0x19'));var servicenow=require(_0xf572('0x1a'));var dynamics365=require(_0xf572('0x1b'));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()[_0xf572('0x1c')](_0xf572('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xf572('0x1c')](_0xf572('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xf572('0x1e')]()[_0xf572('0x1f')](user[_0xf572('0x20')]())[_0xf572('0x1f')](realtime['initAgents']())['then'](user[_0xf572('0x21')]())[_0xf572('0x1f')](realtime[_0xf572('0x22')]())['then'](trunk[_0xf572('0x23')]())[_0xf572('0x1f')](realtime[_0xf572('0x24')]())[_0xf572('0x1f')](voiceQueue[_0xf572('0x25')]())[_0xf572('0x1f')](realtime[_0xf572('0x26')]())[_0xf572('0x1f')](trigger[_0xf572('0x27')]())[_0xf572('0x1f')](realtime[_0xf572('0x28')]())['then'](template['getTemplates']())[_0xf572('0x1f')](realtime['initTemplates']())[_0xf572('0x1f')](zendesk[_0xf572('0x29')]())[_0xf572('0x1f')](realtime[_0xf572('0x2a')]())[_0xf572('0x1f')](salesforce[_0xf572('0x2b')]())[_0xf572('0x1f')](realtime[_0xf572('0x2c')]())[_0xf572('0x1f')](sugarcrm[_0xf572('0x2d')]())[_0xf572('0x1f')](realtime['initSugarcrmAccounts']())[_0xf572('0x1f')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0xf572('0x2e')]())[_0xf572('0x1f')](desk[_0xf572('0x2f')]())[_0xf572('0x1f')](realtime[_0xf572('0x30')]())[_0xf572('0x1f')](zoho[_0xf572('0x31')]())[_0xf572('0x1f')](realtime[_0xf572('0x32')]())['then'](vtiger[_0xf572('0x33')]())[_0xf572('0x1f')](realtime[_0xf572('0x34')]())[_0xf572('0x1f')](freshsales[_0xf572('0x35')]())[_0xf572('0x1f')](realtime[_0xf572('0x36')]())['then'](servicenow['getServicenowAccounts']())['then'](realtime['initServicenowAccounts']())[_0xf572('0x1f')](dynamics365[_0xf572('0x37')]())[_0xf572('0x1f')](realtime[_0xf572('0x38')]())['then'](campaign[_0xf572('0x39')]())[_0xf572('0x1f')](realtime[_0xf572('0x3a')]())[_0xf572('0x1f')](voiceExtension[_0xf572('0x3b')]())[_0xf572('0x1f')](realtime[_0xf572('0x3c')]())['then'](faxAccount['getFaxAccounts']())['then'](realtime[_0xf572('0x3d')]())[_0xf572('0x1f')](function(){return realtime;});}function initParams(){return BPromise[_0xf572('0x1e')]()[_0xf572('0x1f')](voiceQueueReport[_0xf572('0x3e')]())[_0xf572('0x1f')](realtime[_0xf572('0x3f')]())[_0xf572('0x1f')](cmHopperHistory[_0xf572('0x40')]())[_0xf572('0x1f')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0xf572('0x1f')](realtime[_0xf572('0x41')]())[_0xf572('0x1f')](voiceCallReport[_0xf572('0x42')]())[_0xf572('0x1f')](realtime['initVoiceCallReports']())[_0xf572('0x1f')](function(_0xe98c0a){})[_0xf572('0x43')](function(_0x1e5a0b){console[_0xf572('0x44')](_0x1e5a0b);});}function main(){return server[_0xf572('0x45')](realtime,preview,fax)[_0xf572('0x1f')](function(_0x4900d8){return initRealtime();})[_0xf572('0x1f')](function(){return initParams();})['then'](function(){report[_0xf572('0x46')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x2daf5b){console[_0xf572('0x44')](_0x2daf5b);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 1ae92f3..88da4d8 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 _0x70e0=['name','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','emit','user:presence','lodash','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format'];(function(_0x4745d5,_0x20bd52){var _0x37265e=function(_0x39f7b5){while(--_0x39f7b5){_0x4745d5['push'](_0x4745d5['shift']());}};_0x37265e(++_0x20bd52);}(_0x70e0,0x17b));var _0x070e=function(_0x2d39ab,_0x1f126c){_0x2d39ab=_0x2d39ab-0x0;var _0x4b2fa9=_0x70e0[_0x2d39ab];return _0x4b2fa9;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x070e('0x3'));config[_0x070e('0x4')]=_[_0x070e('0x5')](config[_0x070e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x6'))(new Redis(config['redis']));function Agent(_0x46fe68){this['id']=_0x46fe68['id']||0x0;this['name']=_0x46fe68['name']||'';this['email']=_0x46fe68[_0x070e('0x7')]||'';this[_0x070e('0x8')]=_0x46fe68[_0x070e('0x8')]||'';this[_0x070e('0x9')]=_0x46fe68[_0x070e('0x9')]||'';this[_0x070e('0xa')]=_0x070e('0xb');this['stateTime']=0x0;this['status']=_0x070e('0xb');this[_0x070e('0xc')]='';this[_0x070e('0xd')]='';this[_0x070e('0xe')]='';this[_0x070e('0xf')]='';this[_0x070e('0x10')]=_0x46fe68[_0x070e('0x10')]||![];this[_0x070e('0x11')]=_0x070e('0xb');this[_0x070e('0x12')]=0x0;this[_0x070e('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x070e('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x11d2ce){var _0x14c3fd;if(_0x11d2ce&&_0x11d2ce['state']){_0x14c3fd=_0x11d2ce['state'][_0x070e('0x15')]();switch(_0x14c3fd){case _0x070e('0x16'):_0x14c3fd=_0x070e('0x17');break;case _0x070e('0x18'):_0x14c3fd='talking';break;}}if(_0x14c3fd&&this['voiceStatus']!==_0x14c3fd||_0x11d2ce[_0x070e('0x19')]){this[_0x070e('0x12')]=_[_0x070e('0x1a')](moment()[_0x070e('0x1b')]('x'));}if(_0x14c3fd){this[_0x070e('0x11')]=_0x14c3fd;}var _0x5037eb={'id':this['id'],'name':this[_0x070e('0x1c')],'email':this[_0x070e('0x7')],'accountcode':this[_0x070e('0x8')],'fullname':this[_0x070e('0x9')],'state':this[_0x070e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x070e('0x10')],'voiceStatus':this[_0x070e('0x11')],'voiceStatusTime':this[_0x070e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x070e('0x1d')],'interface':this['interface'],'onhold':this[_0x070e('0x1e')]};var _0x3f6985=md5(JSON[_0x070e('0x1f')](_0x5037eb));if(this[_0x070e('0x20')]!==_0x3f6985){this[_0x070e('0x20')]=_0x3f6985;io['to'](util[_0x070e('0x1b')](_0x070e('0x21'),_0x5037eb[_0x070e('0x1c')]))['emit'](_0x070e('0x22'),_0x5037eb);io[_0x070e('0x23')](_0x070e('0x24'),_0x5037eb);}};module['exports']=Agent; \ No newline at end of file +var _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x212e3b,_0x2c6d80){var _0x66eab2=function(_0x5260e0){while(--_0x5260e0){_0x212e3b['push'](_0x212e3b['shift']());}};_0x66eab2(++_0x2c6d80);}(_0xe706,0xa3));var _0x6e70=function(_0x2c00b3,_0x29b200){_0x2c00b3=_0x2c00b3-0x0;var _0x595512=_0xe706[_0x2c00b3];return _0x595512;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index acf08e0..7a3d2e9 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 _0xf733=['dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone'];(function(_0x51e498,_0x12751b){var _0x318757=function(_0x56c098){while(--_0x56c098){_0x51e498['push'](_0x51e498['shift']());}};_0x318757(++_0x12751b);}(_0xf733,0x1df));var _0x3f73=function(_0x59cf8a,_0x163bb9){_0x59cf8a=_0x59cf8a-0x0;var _0x22dde8=_0xf733[_0x59cf8a];return _0x22dde8;};'use strict';function Campaign(_0x5a3dd8){this['id']=_0x5a3dd8['id']||0x0;this['name']=_0x5a3dd8[_0x3f73('0x0')]||'';this['type']=_0x5a3dd8[_0x3f73('0x1')]||_0x3f73('0x2');this[_0x3f73('0x3')]=0x0;this[_0x3f73('0x4')]=0x0;this[_0x3f73('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x3f73('0x6')]='';this[_0x3f73('0x7')]=!![];this['active']=_0x5a3dd8[_0x3f73('0x8')];this[_0x3f73('0x9')]=_0x5a3dd8[_0x3f73('0x9')];this[_0x3f73('0xa')]=_0x5a3dd8['dialTimezone']||null;this['dialGlobalInterval']=_0x5a3dd8['dialGlobalInterval']?_0x5a3dd8[_0x3f73('0xb')]:null;this[_0x3f73('0xc')]=_0x5a3dd8[_0x3f73('0xc')];this[_0x3f73('0xd')]=_0x5a3dd8['dialOriginateCallerIdNumber'];this[_0x3f73('0xe')]=_0x5a3dd8[_0x3f73('0xe')]||0x1e;this[_0x3f73('0xf')]=_0x5a3dd8[_0x3f73('0xf')];this[_0x3f73('0x10')]=_0x5a3dd8[_0x3f73('0x10')];this[_0x3f73('0x11')]=_0x5a3dd8['dialBusyMaxRetry'];this[_0x3f73('0x12')]=_0x5a3dd8[_0x3f73('0x12')];this[_0x3f73('0x13')]=_0x5a3dd8['dialNoAnswerMaxRetry'];this[_0x3f73('0x14')]=_0x5a3dd8[_0x3f73('0x14')];this['dialGlobalMaxRetry']=_0x5a3dd8[_0x3f73('0x15')];this[_0x3f73('0x16')]=_0x5a3dd8[_0x3f73('0x16')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5a3dd8[_0x3f73('0x17')]||0x96;this[_0x3f73('0x18')]=_0x5a3dd8[_0x3f73('0x18')]||0x3;this[_0x3f73('0x19')]=_0x5a3dd8[_0x3f73('0x19')]||0x96;this[_0x3f73('0x1a')]=_0x5a3dd8[_0x3f73('0x1a')]||0x3;this[_0x3f73('0x1b')]=_0x5a3dd8[_0x3f73('0x1b')]||0x96;this[_0x3f73('0x1c')]=_0x5a3dd8[_0x3f73('0x1c')]||0x3;this[_0x3f73('0x1d')]=_0x5a3dd8[_0x3f73('0x1d')]||0x96;this[_0x3f73('0x1e')]=_0x5a3dd8[_0x3f73('0x1e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x5a3dd8[_0x3f73('0x1f')]||0x96;this['dialOrderByScheduledAt']=_0x5a3dd8['dialOrderByScheduledAt']||'DESC';this[_0x3f73('0x20')]=_0x5a3dd8[_0x3f73('0x20')]||undefined;this[_0x3f73('0x21')]=_0x5a3dd8[_0x3f73('0x21')]||undefined;this[_0x3f73('0x22')]=_0x5a3dd8[_0x3f73('0x22')]||undefined;this[_0x3f73('0x23')]=_0x5a3dd8[_0x3f73('0x23')]?_0x5a3dd8[_0x3f73('0x23')]:undefined;this[_0x3f73('0x24')]=_0x5a3dd8[_0x3f73('0x24')]?_0x5a3dd8[_0x3f73('0x24')]:undefined;this['Interval']=_0x5a3dd8['Interval']?_0x5a3dd8['Interval']:undefined;this[_0x3f73('0x25')]=_0x5a3dd8['SquareProject']?_0x5a3dd8[_0x3f73('0x25')]:undefined;this[_0x3f73('0x26')]=_0x5a3dd8[_0x3f73('0x25')]?_0x5a3dd8['SquareProject'][_0x3f73('0x0')]:undefined;this[_0x3f73('0x27')]=_0x5a3dd8[_0x3f73('0x27')]||![];this[_0x3f73('0x28')]=_0x5a3dd8[_0x3f73('0x28')];this[_0x3f73('0x29')]=_0x5a3dd8[_0x3f73('0x29')];this[_0x3f73('0x2a')]=_0x5a3dd8[_0x3f73('0x2a')];this['dialAMDTotalAnalysisTime']=_0x5a3dd8['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x5a3dd8[_0x3f73('0x2b')];this[_0x3f73('0x2c')]=_0x5a3dd8[_0x3f73('0x2c')];this[_0x3f73('0x2d')]=_0x5a3dd8[_0x3f73('0x2d')];this[_0x3f73('0x2e')]=_0x5a3dd8[_0x3f73('0x2e')];this[_0x3f73('0x2f')]=_0x5a3dd8[_0x3f73('0x2f')];}module[_0x3f73('0x30')]=Campaign; \ No newline at end of file +var _0x0b0d=['dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0b0d,0x19b));var _0xd0b0=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x0b0d[_0x47aa64];return _0x549c7a;};'use strict';function Campaign(_0x19e033){this['id']=_0x19e033['id']||0x0;this['name']=_0x19e033[_0xd0b0('0x0')]||'';this['type']=_0x19e033[_0xd0b0('0x1')]||_0xd0b0('0x2');this['originated']=0x0;this[_0xd0b0('0x3')]=0x0;this[_0xd0b0('0x4')]=0x0;this[_0xd0b0('0x5')]=0x0;this[_0xd0b0('0x6')]='';this[_0xd0b0('0x7')]=!![];this[_0xd0b0('0x8')]=_0x19e033[_0xd0b0('0x8')];this[_0xd0b0('0x9')]=_0x19e033[_0xd0b0('0x9')];this['dialTimezone']=_0x19e033[_0xd0b0('0xa')]||null;this[_0xd0b0('0xb')]=_0x19e033[_0xd0b0('0xb')]?_0x19e033[_0xd0b0('0xb')]:null;this['dialOriginateCallerIdName']=_0x19e033['dialOriginateCallerIdName'];this[_0xd0b0('0xc')]=_0x19e033[_0xd0b0('0xc')];this[_0xd0b0('0xd')]=_0x19e033['dialOriginateTimeout']||0x1e;this[_0xd0b0('0xe')]=_0x19e033['dialCongestionMaxRetry'];this[_0xd0b0('0xf')]=_0x19e033[_0xd0b0('0xf')];this['dialBusyMaxRetry']=_0x19e033[_0xd0b0('0x10')];this[_0xd0b0('0x11')]=_0x19e033['dialBusyRetryFrequency'];this[_0xd0b0('0x12')]=_0x19e033[_0xd0b0('0x12')];this[_0xd0b0('0x13')]=_0x19e033['dialNoAnswerRetryFrequency'];this[_0xd0b0('0x14')]=_0x19e033[_0xd0b0('0x14')];this[_0xd0b0('0x15')]=_0x19e033[_0xd0b0('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x19e033[_0xd0b0('0x16')]||0x96;this[_0xd0b0('0x17')]=_0x19e033['dialDropMaxRetry']||0x3;this[_0xd0b0('0x18')]=_0x19e033[_0xd0b0('0x18')]||0x96;this[_0xd0b0('0x19')]=_0x19e033[_0xd0b0('0x19')]||0x3;this[_0xd0b0('0x1a')]=_0x19e033['dialAbandonedRetryFrequency']||0x96;this[_0xd0b0('0x1b')]=_0x19e033['dialMachineMaxRetry']||0x3;this[_0xd0b0('0x1c')]=_0x19e033[_0xd0b0('0x1c')]||0x96;this[_0xd0b0('0x1d')]=_0x19e033[_0xd0b0('0x1d')]||0x3;this[_0xd0b0('0x1e')]=_0x19e033[_0xd0b0('0x1e')]||0x96;this[_0xd0b0('0x1f')]=_0x19e033['dialOrderByScheduledAt']||_0xd0b0('0x20');this[_0xd0b0('0x21')]=_0x19e033[_0xd0b0('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x19e033['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xd0b0('0x22')]=_0x19e033[_0xd0b0('0x22')]||undefined;this['TrunkBackup']=_0x19e033['TrunkBackup']?_0x19e033[_0xd0b0('0x23')]:undefined;this[_0xd0b0('0x24')]=_0x19e033[_0xd0b0('0x24')]?_0x19e033[_0xd0b0('0x24')]:undefined;this[_0xd0b0('0x25')]=_0x19e033[_0xd0b0('0x25')]?_0x19e033[_0xd0b0('0x25')]:undefined;this[_0xd0b0('0x26')]=_0x19e033['SquareProject']?_0x19e033['SquareProject']:undefined;this[_0xd0b0('0x27')]=_0x19e033['SquareProject']?_0x19e033[_0xd0b0('0x26')]['name']:undefined;this[_0xd0b0('0x28')]=_0x19e033[_0xd0b0('0x28')]||![];this['dialAMDInitialSilence']=_0x19e033['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x19e033[_0xd0b0('0x29')];this[_0xd0b0('0x2a')]=_0x19e033['dialAMDAfterGreetingSilence'];this[_0xd0b0('0x2b')]=_0x19e033['dialAMDTotalAnalysisTime'];this[_0xd0b0('0x2c')]=_0x19e033[_0xd0b0('0x2c')];this[_0xd0b0('0x2d')]=_0x19e033[_0xd0b0('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x19e033[_0xd0b0('0x2e')];this[_0xd0b0('0x2f')]=_0x19e033['dialAMDSilenceThreshold'];this[_0xd0b0('0x30')]=_0x19e033[_0xd0b0('0x30')];}module[_0xd0b0('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 40fcd5e..c7b6103 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 _0xa809=['unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','channel','calleridname','context','uniqueid','linkedid','exten','answertime'];(function(_0x3a9ff8,_0x1dba6f){var _0x2fc09f=function(_0x26af1e){while(--_0x26af1e){_0x3a9ff8['push'](_0x3a9ff8['shift']());}};_0x2fc09f(++_0x1dba6f);}(_0xa809,0x1f3));var _0x9a80=function(_0x5bc2b6,_0x264fd9){_0x5bc2b6=_0x5bc2b6-0x0;var _0x526798=_0xa809[_0x5bc2b6];return _0x526798;};'use strict';function Channel(){this['starttime']=null;this[_0x9a80('0x0')]='';this['destinationchannel']='';this['calleridnum']=0x0;this[_0x9a80('0x1')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this[_0x9a80('0x2')]='';this[_0x9a80('0x3')]=0x0;this[_0x9a80('0x4')]=0x0;this[_0x9a80('0x5')]=0x0;this['answered']=![];this[_0x9a80('0x6')]=null;this['endtime']=null;this[_0x9a80('0x7')]=![];this[_0x9a80('0x8')]=![];this['lastapplication']='';this[_0x9a80('0x9')]='';this[_0x9a80('0xa')]=0x0;this[_0x9a80('0xb')]=0x0;this[_0x9a80('0xc')]=0x0;this['type']=null;this[_0x9a80('0xd')]=null;this[_0x9a80('0xe')]=null;this[_0x9a80('0xf')]=![];this[_0x9a80('0x10')]=null;this[_0x9a80('0x11')]=null;this[_0x9a80('0x12')]=[];this[_0x9a80('0x13')]=undefined;this[_0x9a80('0x14')]=undefined;this['transferType']=undefined;this[_0x9a80('0x15')]=0x0;}module[_0x9a80('0x16')]=Channel; \ No newline at end of file +var _0xf7d2=['exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','holdtime','type','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','uniqueid','linkedid'];(function(_0x24106c,_0x367a6f){var _0xbaeb73=function(_0x483603){while(--_0x483603){_0x24106c['push'](_0x24106c['shift']());}};_0xbaeb73(++_0x367a6f);}(_0xf7d2,0x149));var _0x2f7d=function(_0x18bcd9,_0x1a586d){_0x18bcd9=_0x18bcd9-0x0;var _0x239579=_0xf7d2[_0x18bcd9];return _0x239579;};'use strict';function Channel(){this[_0x2f7d('0x0')]=null;this[_0x2f7d('0x1')]='';this[_0x2f7d('0x2')]='';this['calleridnum']=0x0;this[_0x2f7d('0x3')]='';this[_0x2f7d('0x4')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this['context']='';this[_0x2f7d('0x5')]=0x0;this[_0x2f7d('0x6')]=0x0;this[_0x2f7d('0x7')]=0x0;this[_0x2f7d('0x8')]=![];this['answertime']=null;this[_0x2f7d('0x9')]=null;this[_0x2f7d('0xa')]=![];this[_0x2f7d('0xb')]=![];this[_0x2f7d('0xc')]='';this[_0x2f7d('0xd')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x2f7d('0xe')]=0x0;this[_0x2f7d('0xf')]=null;this[_0x2f7d('0x10')]=null;this['disposition']=null;this[_0x2f7d('0x11')]=![];this[_0x2f7d('0x12')]=null;this[_0x2f7d('0x13')]=null;this[_0x2f7d('0x14')]=[];this[_0x2f7d('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0x2f7d('0x16')]=0x0;}module[_0x2f7d('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index d6c3931..3581e92 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 _0x207d=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x2cdfec,_0x4f1184){var _0x59eaef=function(_0x383e86){while(--_0x383e86){_0x2cdfec['push'](_0x2cdfec['shift']());}};_0x59eaef(++_0x4f1184);}(_0x207d,0x1cc));var _0xd207=function(_0x272936,_0x102203){_0x272936=_0x272936-0x0;var _0x4b988d=_0x207d[_0x272936];return _0x4b988d;};'use strict';function DeskAccount(_0x25b559){this['id']=_0x25b559['id']||0x0;this[_0xd207('0x0')]=_0x25b559[_0xd207('0x0')]||'';this[_0xd207('0x1')]=_0x25b559['username']||'';this[_0xd207('0x2')]=_0x25b559[_0xd207('0x2')]||'';this['authType']=_0x25b559[_0xd207('0x3')]||'';this[_0xd207('0x4')]=_0x25b559[_0xd207('0x4')]||'';this['consumerKey']=_0x25b559[_0xd207('0x5')]||'';this[_0xd207('0x6')]=_0x25b559[_0xd207('0x6')]||'';this['token']=_0x25b559[_0xd207('0x7')]||'';this['tokenSecret']=_0x25b559[_0xd207('0x8')]||'';this[_0xd207('0x9')]=_0x25b559['type']||'';this[_0xd207('0xa')]=_0x25b559[_0xd207('0xa')]||'';this[_0xd207('0xb')]=_0x25b559['Configurations']||{};}module[_0xd207('0xc')]=DeskAccount; \ No newline at end of file +var _0xce49=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x47b007,_0x322a07){var _0x35742b=function(_0x3017d1){while(--_0x3017d1){_0x47b007['push'](_0x47b007['shift']());}};_0x35742b(++_0x322a07);}(_0xce49,0x64));var _0x9ce4=function(_0x399993,_0x5a40ce){_0x399993=_0x399993-0x0;var _0x40ee12=_0xce49[_0x399993];return _0x40ee12;};'use strict';function DeskAccount(_0x554da4){this['id']=_0x554da4['id']||0x0;this['name']=_0x554da4[_0x9ce4('0x0')]||'';this[_0x9ce4('0x1')]=_0x554da4[_0x9ce4('0x1')]||'';this[_0x9ce4('0x2')]=_0x554da4[_0x9ce4('0x2')]||'';this['authType']=_0x554da4[_0x9ce4('0x3')]||'';this[_0x9ce4('0x4')]=_0x554da4[_0x9ce4('0x4')]||'';this[_0x9ce4('0x5')]=_0x554da4['consumerKey']||'';this[_0x9ce4('0x6')]=_0x554da4[_0x9ce4('0x6')]||'';this['token']=_0x554da4[_0x9ce4('0x7')]||'';this[_0x9ce4('0x8')]=_0x554da4[_0x9ce4('0x8')]||'';this['type']=_0x554da4[_0x9ce4('0x9')]||'';this[_0x9ce4('0xa')]=_0x554da4['serverUrl']||'';this[_0x9ce4('0xb')]=_0x554da4[_0x9ce4('0xb')]||{};}module[_0x9ce4('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 93a5dd0..4b22b33 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 _0x878f=['serverUrl','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x14805d,_0x5e61c8){var _0x441aad=function(_0x336f1a){while(--_0x336f1a){_0x14805d['push'](_0x14805d['shift']());}};_0x441aad(++_0x5e61c8);}(_0x878f,0x173));var _0xf878=function(_0x46b7d2,_0xebb874){_0x46b7d2=_0x46b7d2-0x0;var _0x52bb9d=_0x878f[_0x46b7d2];return _0x52bb9d;};'use strict';function Dynamics365Account(_0x51758f){this['id']=_0x51758f['id']||0x0;this[_0xf878('0x0')]=_0x51758f[_0xf878('0x0')]||'';this[_0xf878('0x1')]=_0x51758f[_0xf878('0x1')]||'';this[_0xf878('0x2')]=_0x51758f[_0xf878('0x2')]||'';this[_0xf878('0x3')]=_0x51758f[_0xf878('0x3')]||'';this[_0xf878('0x4')]=_0x51758f[_0xf878('0x4')]||'';this[_0xf878('0x5')]=_0x51758f['clientId']||'';this['clientSecret']=_0x51758f[_0xf878('0x6')]||{};this[_0xf878('0x7')]=_0x51758f['serverUrl']||'';this['Configurations']=_0x51758f['Configurations']||{};}module[_0xf878('0x8')]=Dynamics365Account; \ No newline at end of file +var _0xaa88=['username','password','remoteUri','tenantId','clientSecret','serverUrl','Configurations','name'];(function(_0x33d4a2,_0x2baaf4){var _0x2c793f=function(_0x414303){while(--_0x414303){_0x33d4a2['push'](_0x33d4a2['shift']());}};_0x2c793f(++_0x2baaf4);}(_0xaa88,0x137));var _0x8aa8=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0xaa88[_0x3be7ff];return _0x186721;};'use strict';function Dynamics365Account(_0x2d8583){this['id']=_0x2d8583['id']||0x0;this[_0x8aa8('0x0')]=_0x2d8583[_0x8aa8('0x0')]||'';this[_0x8aa8('0x1')]=_0x2d8583['username']||'';this[_0x8aa8('0x2')]=_0x2d8583[_0x8aa8('0x2')]||'';this[_0x8aa8('0x3')]=_0x2d8583[_0x8aa8('0x3')]||'';this[_0x8aa8('0x4')]=_0x2d8583[_0x8aa8('0x4')]||'';this['clientId']=_0x2d8583['clientId']||'';this[_0x8aa8('0x5')]=_0x2d8583['clientSecret']||{};this[_0x8aa8('0x6')]=_0x2d8583[_0x8aa8('0x6')]||'';this[_0x8aa8('0x7')]=_0x2d8583[_0x8aa8('0x7')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 8293d3b..e736742 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 _0x6820=['Trunk','ListId','key','exports','name','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP'];(function(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0x6820,0x184));var _0x0682=function(_0x40e448,_0x12ac0d){_0x40e448=_0x40e448-0x0;var _0x1a62ef=_0x6820[_0x40e448];return _0x1a62ef;};'use strict';function FaxAccount(_0x29ef06){this['id']=_0x29ef06['id']||0x0;this[_0x0682('0x0')]=_0x29ef06[_0x0682('0x0')]||'';this['description']=_0x29ef06['description'];this[_0x0682('0x1')]=_0x29ef06[_0x0682('0x1')];this[_0x0682('0x2')]=_0x29ef06['headerinfo'];this[_0x0682('0x3')]=_0x29ef06[_0x0682('0x3')];this[_0x0682('0x4')]=_0x29ef06['minrate']||0x960;this[_0x0682('0x5')]=_0x29ef06[_0x0682('0x5')]||0x3840;this[_0x0682('0x6')]=_0x29ef06[_0x0682('0x6')]||'v17,v27,v29';this[_0x0682('0x7')]=_0x29ef06['gateway']||'no';this[_0x0682('0x8')]=_0x29ef06['faxdetect']||'no';this['t38timeout']=_0x29ef06[_0x0682('0x9')]||0x1388;this[_0x0682('0xa')]=_0x29ef06['tech']||_0x0682('0xb');this['Trunk']=_0x29ef06['Trunk']?_0x29ef06[_0x0682('0xc')]:undefined;this['ListId']=_0x29ef06[_0x0682('0xd')];this['key']=_0x29ef06[_0x0682('0xe')];}module[_0x0682('0xf')]=FaxAccount; \ No newline at end of file +var _0xead9=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xead9,0xf4));var _0x9ead=function(_0x294bcd,_0x3a48d8){_0x294bcd=_0x294bcd-0x0;var _0x5c0dc9=_0xead9[_0x294bcd];return _0x5c0dc9;};'use strict';function FaxAccount(_0x16f84e){this['id']=_0x16f84e['id']||0x0;this[_0x9ead('0x0')]=_0x16f84e[_0x9ead('0x0')]||'';this[_0x9ead('0x1')]=_0x16f84e[_0x9ead('0x1')];this[_0x9ead('0x2')]=_0x16f84e[_0x9ead('0x2')];this['headerinfo']=_0x16f84e[_0x9ead('0x3')];this['localstationid']=_0x16f84e[_0x9ead('0x4')];this[_0x9ead('0x5')]=_0x16f84e[_0x9ead('0x5')]||0x960;this[_0x9ead('0x6')]=_0x16f84e['maxrate']||0x3840;this[_0x9ead('0x7')]=_0x16f84e[_0x9ead('0x7')]||_0x9ead('0x8');this[_0x9ead('0x9')]=_0x16f84e['gateway']||'no';this[_0x9ead('0xa')]=_0x16f84e[_0x9ead('0xa')]||'no';this[_0x9ead('0xb')]=_0x16f84e[_0x9ead('0xb')]||0x1388;this[_0x9ead('0xc')]=_0x16f84e[_0x9ead('0xc')]||_0x9ead('0xd');this[_0x9ead('0xe')]=_0x16f84e[_0x9ead('0xe')]?_0x16f84e['Trunk']:undefined;this[_0x9ead('0xf')]=_0x16f84e[_0x9ead('0xf')];this[_0x9ead('0x10')]=_0x16f84e[_0x9ead('0x10')];}module[_0x9ead('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 ba475ff..3fad06e 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 _0x2f81=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f81,0x110));var _0x12f8=function(_0x9d95ad,_0x31e501){_0x9d95ad=_0x9d95ad-0x0;var _0x30768e=_0x2f81[_0x9d95ad];return _0x30768e;};'use strict';function FreshdeskAccount(_0x365314){this['id']=_0x365314['id']||0x0;this[_0x12f8('0x0')]=_0x365314[_0x12f8('0x0')]||'';this[_0x12f8('0x1')]=_0x365314[_0x12f8('0x1')]||'';this[_0x12f8('0x2')]=_0x365314[_0x12f8('0x3')]||'';this[_0x12f8('0x4')]=_0x365314[_0x12f8('0x4')]||'';this[_0x12f8('0x5')]=_0x365314[_0x12f8('0x5')]||'';this[_0x12f8('0x6')]=_0x365314[_0x12f8('0x6')]||{};}module[_0x12f8('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xdc89=['serverUrl','Configurations','exports','name','username','token','remoteUri'];(function(_0x4f30c4,_0x371a97){var _0x52bd48=function(_0x2d7769){while(--_0x2d7769){_0x4f30c4['push'](_0x4f30c4['shift']());}};_0x52bd48(++_0x371a97);}(_0xdc89,0x1ae));var _0x9dc8=function(_0x1f2f61,_0x586f2f){_0x1f2f61=_0x1f2f61-0x0;var _0x10dabc=_0xdc89[_0x1f2f61];return _0x10dabc;};'use strict';function FreshdeskAccount(_0x3c92c7){this['id']=_0x3c92c7['id']||0x0;this['name']=_0x3c92c7[_0x9dc8('0x0')]||'';this[_0x9dc8('0x1')]=_0x3c92c7[_0x9dc8('0x1')]||'';this['apiKey']=_0x3c92c7[_0x9dc8('0x2')]||'';this[_0x9dc8('0x3')]=_0x3c92c7[_0x9dc8('0x3')]||'';this[_0x9dc8('0x4')]=_0x3c92c7[_0x9dc8('0x4')]||'';this[_0x9dc8('0x5')]=_0x3c92c7['Configurations']||{};}module[_0x9dc8('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index c6751e9..3b6a3fc 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 _0x6f47=['serverUrl','Configurations','exports','name','username','token','remoteUri'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0x6f47,0xc7));var _0x76f4=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x6f47[_0xbd08b4];return _0x314f1e;};'use strict';function FreshsalesAccount(_0xd05ad8){this['id']=_0xd05ad8['id']||0x0;this[_0x76f4('0x0')]=_0xd05ad8[_0x76f4('0x0')]||'';this['username']=_0xd05ad8[_0x76f4('0x1')]||'';this['apiKey']=_0xd05ad8[_0x76f4('0x2')]||'';this['remoteUri']=_0xd05ad8[_0x76f4('0x3')]||'';this[_0x76f4('0x4')]=_0xd05ad8[_0x76f4('0x4')]||'';this[_0x76f4('0x5')]=_0xd05ad8['Configurations']||{};}module[_0x76f4('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x8585=['name','username','apiKey','serverUrl','exports'];(function(_0xf2d321,_0x37b087){var _0x59da26=function(_0x323330){while(--_0x323330){_0xf2d321['push'](_0xf2d321['shift']());}};_0x59da26(++_0x37b087);}(_0x8585,0x64));var _0x5858=function(_0x503f4d,_0x476e97){_0x503f4d=_0x503f4d-0x0;var _0x4ce6d1=_0x8585[_0x503f4d];return _0x4ce6d1;};'use strict';function FreshsalesAccount(_0x2c6ce6){this['id']=_0x2c6ce6['id']||0x0;this[_0x5858('0x0')]=_0x2c6ce6[_0x5858('0x0')]||'';this['username']=_0x2c6ce6[_0x5858('0x1')]||'';this[_0x5858('0x2')]=_0x2c6ce6['token']||'';this['remoteUri']=_0x2c6ce6['remoteUri']||'';this[_0x5858('0x3')]=_0x2c6ce6[_0x5858('0x3')]||'';this['Configurations']=_0x2c6ce6['Configurations']||{};}module[_0x5858('0x4')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 4e09dca..c7d4bb9 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 _0x29da=['exten','priority','holdtime','assigned','lastAssignedTo','inbound','calleridnum','calleridname','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum','accountcode','context'];(function(_0xd7915f,_0x506cfe){var _0x56ddf0=function(_0x101021){while(--_0x101021){_0xd7915f['push'](_0xd7915f['shift']());}};_0x56ddf0(++_0x506cfe);}(_0x29da,0x101));var _0xa29d=function(_0x1a000a,_0x18923b){_0x1a000a=_0x1a000a-0x0;var _0x368f7b=_0x29da[_0x1a000a];return _0x368f7b;};'use strict';function QueueReport(){this['type']=_0xa29d('0x0');this['uniqueid']='';this[_0xa29d('0x1')]='';this[_0xa29d('0x2')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0xa29d('0x3')]=null;this[_0xa29d('0x4')]=0x1;this[_0xa29d('0x5')]=0x1;this[_0xa29d('0x6')]=![];this[_0xa29d('0x7')]=null;this[_0xa29d('0x8')]=![];this[_0xa29d('0x9')]=null;this['queuecallerexit']=![];this[_0xa29d('0xa')]=null;this[_0xa29d('0xb')]=0x1;this[_0xa29d('0xc')]='';this[_0xa29d('0xd')]='';this['connectedlinename']='';this[_0xa29d('0xe')]='';this[_0xa29d('0xf')]='';this[_0xa29d('0x10')]='';this[_0xa29d('0x11')]='';this[_0xa29d('0x12')]=0x0;this[_0xa29d('0x13')]=![];this[_0xa29d('0x14')]='';this['mohtime']=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file +var _0x282a=['queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','holdtime','assigned','lastAssignedTo','mohtime','type','inbound','calleridnum','calleridname','queuecallerleaveAt','position','count'];(function(_0x2a5fb9,_0x2e806c){var _0x377e31=function(_0x2e64fc){while(--_0x2e64fc){_0x2a5fb9['push'](_0x2a5fb9['shift']());}};_0x377e31(++_0x2e806c);}(_0x282a,0x1c7));var _0xa282=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x282a[_0x243b59];return _0x3e1676;};'use strict';function QueueReport(){this[_0xa282('0x0')]=_0xa282('0x1');this['uniqueid']='';this[_0xa282('0x2')]='';this[_0xa282('0x3')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0xa282('0x4')]=null;this[_0xa282('0x5')]=0x1;this[_0xa282('0x6')]=0x1;this[_0xa282('0x7')]=![];this[_0xa282('0x8')]=null;this['queuecallercomplete']=![];this[_0xa282('0x9')]=null;this[_0xa282('0xa')]=![];this['queuecallerexitAt']=null;this[_0xa282('0xb')]=0x1;this[_0xa282('0xc')]='';this[_0xa282('0xd')]='';this[_0xa282('0xe')]='';this[_0xa282('0xf')]='';this[_0xa282('0x10')]='';this['exten']='';this['priority']='';this[_0xa282('0x11')]=0x0;this[_0xa282('0x12')]=![];this[_0xa282('0x13')]='';this[_0xa282('0x14')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 39a8ca0..230ef12 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 _0xb6db=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x2abf14,_0x702931){var _0x418c7c=function(_0x12a358){while(--_0x12a358){_0x2abf14['push'](_0x2abf14['shift']());}};_0x418c7c(++_0x702931);}(_0xb6db,0x16a));var _0xbb6d=function(_0x4a7d97,_0x666be5){_0x4a7d97=_0x4a7d97-0x0;var _0x4b2039=_0xb6db[_0x4a7d97];return _0x4b2039;};'use strict';function SalesforceAccount(_0x25dd3a){this['id']=_0x25dd3a['id']||0x0;this['name']=_0x25dd3a[_0xbb6d('0x0')]||'';this[_0xbb6d('0x1')]=_0x25dd3a[_0xbb6d('0x1')]||'';this[_0xbb6d('0x2')]=_0x25dd3a[_0xbb6d('0x2')]||'';this['password']=_0x25dd3a[_0xbb6d('0x3')]||'';this[_0xbb6d('0x4')]=_0x25dd3a[_0xbb6d('0x4')]||'';this[_0xbb6d('0x5')]=_0x25dd3a[_0xbb6d('0x5')]||'';this[_0xbb6d('0x6')]=_0x25dd3a[_0xbb6d('0x6')]||'';this[_0xbb6d('0x7')]=_0x25dd3a[_0xbb6d('0x7')]||_0xbb6d('0x8');this['serverUrl']=_0x25dd3a[_0xbb6d('0x9')]||'';this[_0xbb6d('0xa')]=_0x25dd3a['Configurations']||{};}module[_0xbb6d('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xf40b=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports'];(function(_0x28b930,_0x19b05f){var _0x112256=function(_0x3b3f61){while(--_0x3b3f61){_0x28b930['push'](_0x28b930['shift']());}};_0x112256(++_0x19b05f);}(_0xf40b,0xb0));var _0xbf40=function(_0x2492dc,_0x3284a7){_0x2492dc=_0x2492dc-0x0;var _0x310431=_0xf40b[_0x2492dc];return _0x310431;};'use strict';function SalesforceAccount(_0x571898){this['id']=_0x571898['id']||0x0;this[_0xbf40('0x0')]=_0x571898[_0xbf40('0x0')]||'';this[_0xbf40('0x1')]=_0x571898[_0xbf40('0x1')]||'';this['remoteUri']=_0x571898[_0xbf40('0x2')]||'';this[_0xbf40('0x3')]=_0x571898[_0xbf40('0x3')]||'';this[_0xbf40('0x4')]=_0x571898[_0xbf40('0x4')]||'';this['clientSecret']=_0x571898[_0xbf40('0x5')]||'';this[_0xbf40('0x6')]=_0x571898[_0xbf40('0x6')]||'';this[_0xbf40('0x7')]=_0x571898[_0xbf40('0x7')]||'integrationTab';this[_0xbf40('0x8')]=_0x571898[_0xbf40('0x8')]||'';this[_0xbf40('0x9')]=_0x571898[_0xbf40('0x9')]||{};}module[_0xbf40('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 238318d..26ad8b4 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 _0xf8a4=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x188703,_0x596b26){var _0x1a0c81=function(_0x1cd22d){while(--_0x1cd22d){_0x188703['push'](_0x188703['shift']());}};_0x1a0c81(++_0x596b26);}(_0xf8a4,0xf2));var _0x4f8a=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xf8a4[_0x5d4607];return _0x5e4a86;};'use strict';function ServicenowAccount(_0xe798db){this['id']=_0xe798db['id']||0x0;this[_0x4f8a('0x0')]=_0xe798db[_0x4f8a('0x0')]||'';this[_0x4f8a('0x1')]=_0xe798db[_0x4f8a('0x1')]||'';this[_0x4f8a('0x2')]=_0xe798db[_0x4f8a('0x2')]||'';this[_0x4f8a('0x3')]=_0xe798db['remoteUri']||'';this[_0x4f8a('0x4')]=_0xe798db[_0x4f8a('0x4')]||'';this['Configurations']=_0xe798db[_0x4f8a('0x5')]||{};}module[_0x4f8a('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xedc5=['name','username','password','serverUrl','Configurations','exports'];(function(_0x4e77d4,_0x21b4d8){var _0x14602c=function(_0x1c621b){while(--_0x1c621b){_0x4e77d4['push'](_0x4e77d4['shift']());}};_0x14602c(++_0x21b4d8);}(_0xedc5,0x180));var _0x5edc=function(_0x1b8b95,_0x3ea343){_0x1b8b95=_0x1b8b95-0x0;var _0x3657ae=_0xedc5[_0x1b8b95];return _0x3657ae;};'use strict';function ServicenowAccount(_0x138a47){this['id']=_0x138a47['id']||0x0;this[_0x5edc('0x0')]=_0x138a47[_0x5edc('0x0')]||'';this[_0x5edc('0x1')]=_0x138a47['username']||'';this['password']=_0x138a47[_0x5edc('0x2')]||'';this['remoteUri']=_0x138a47['remoteUri']||'';this[_0x5edc('0x3')]=_0x138a47[_0x5edc('0x3')]||'';this['Configurations']=_0x138a47[_0x5edc('0x4')]||{};}module[_0x5edc('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 3730bce..6dfaf26 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 _0xc378=['name','password','remoteUri','serverUrl','Configurations'];(function(_0x415117,_0x35629d){var _0x36e531=function(_0xe9af6e){while(--_0xe9af6e){_0x415117['push'](_0x415117['shift']());}};_0x36e531(++_0x35629d);}(_0xc378,0x1bd));var _0x8c37=function(_0x28e74e,_0x53fdf1){_0x28e74e=_0x28e74e-0x0;var _0xb45ac1=_0xc378[_0x28e74e];return _0xb45ac1;};'use strict';function SugarcrmAccount(_0x3b8737){this['id']=_0x3b8737['id']||0x0;this[_0x8c37('0x0')]=_0x3b8737[_0x8c37('0x0')]||'';this['username']=_0x3b8737['username']||'';this[_0x8c37('0x1')]=_0x3b8737['password']||'';this[_0x8c37('0x2')]=_0x3b8737['remoteUri']||'';this[_0x8c37('0x3')]=_0x3b8737[_0x8c37('0x3')]||'';this[_0x8c37('0x4')]=_0x3b8737['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xd5f6=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xd5f6,0x198));var _0x6d5f=function(_0x1bd9df,_0x12a3ed){_0x1bd9df=_0x1bd9df-0x0;var _0x18443b=_0xd5f6[_0x1bd9df];return _0x18443b;};'use strict';function SugarcrmAccount(_0x466c05){this['id']=_0x466c05['id']||0x0;this['name']=_0x466c05[_0x6d5f('0x0')]||'';this[_0x6d5f('0x1')]=_0x466c05[_0x6d5f('0x1')]||'';this['password']=_0x466c05[_0x6d5f('0x2')]||'';this[_0x6d5f('0x3')]=_0x466c05[_0x6d5f('0x3')]||'';this[_0x6d5f('0x4')]=_0x466c05[_0x6d5f('0x4')]||'';this['Configurations']=_0x466c05[_0x6d5f('0x5')]||{};}module[_0x6d5f('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 80585ca..98b6cb4 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 _0x066e=['status','exports','accountcode','state','stateTime'];(function(_0x4d89f6,_0x2803df){var _0x3b10c5=function(_0x2da5ab){while(--_0x2da5ab){_0x4d89f6['push'](_0x4d89f6['shift']());}};_0x3b10c5(++_0x2803df);}(_0x066e,0xca));var _0xe066=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x066e[_0x18cd5b];return _0x5eaa52;};'use strict';function Telephone(_0x286c90){this['id']=_0x286c90['id']||0x0;this['name']=_0x286c90['name']||'';this[_0xe066('0x0')]=_0x286c90[_0xe066('0x0')]||'';this[_0xe066('0x1')]='unknown';this[_0xe066('0x2')]=0x0;this[_0xe066('0x3')]='unknown';this['address']='';}module[_0xe066('0x4')]=Telephone; \ No newline at end of file +var _0xf7a3=['unknown','stateTime','status','exports','name','accountcode','state'];(function(_0x44353d,_0x267761){var _0x93dd90=function(_0x218cc1){while(--_0x218cc1){_0x44353d['push'](_0x44353d['shift']());}};_0x93dd90(++_0x267761);}(_0xf7a3,0xac));var _0x3f7a=function(_0x47604d,_0x15a014){_0x47604d=_0x47604d-0x0;var _0x388e4c=_0xf7a3[_0x47604d];return _0x388e4c;};'use strict';function Telephone(_0x4cd1f6){this['id']=_0x4cd1f6['id']||0x0;this['name']=_0x4cd1f6[_0x3f7a('0x0')]||'';this[_0x3f7a('0x1')]=_0x4cd1f6['accountcode']||'';this[_0x3f7a('0x2')]=_0x3f7a('0x3');this[_0x3f7a('0x4')]=0x0;this[_0x3f7a('0x5')]=_0x3f7a('0x3');this['address']='';}module[_0x3f7a('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 2ba5262..a9fe450 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x1bf612,_0x49646b){var _0x2a4628=function(_0x402949){while(--_0x402949){_0x1bf612['push'](_0x1bf612['shift']());}};_0x2a4628(++_0x49646b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0xc5d6ca,_0x374cca){var _0x3f5d10=function(_0x1c8a4a){while(--_0x1c8a4a){_0xc5d6ca['push'](_0xc5d6ca['shift']());}};_0x3f5d10(++_0x374cca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 4cadb07..0e6a9af 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 _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x1a85,0x178));var _0x51a8=function(_0x176e9e,_0x3dfe11){_0x176e9e=_0x176e9e-0x0;var _0x1b675f=_0x1a85[_0x176e9e];return _0x1b675f;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x32e2f0,_0x1195e7){var _0x10b8e4=function(_0x2c58ec){while(--_0x2c58ec){_0x32e2f0['push'](_0x32e2f0['shift']());}};_0x10b8e4(++_0x1195e7);}(_0x2032,0xd9));var _0x2203=function(_0x13c3b6,_0xa4514c){_0x13c3b6=_0x13c3b6-0x0;var _0x2fc84f=_0x2032[_0x13c3b6];return _0x2fc84f;};'use strict';function Trigger(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['channel']||_0x2203('0x2');this[_0x2203('0x3')]=_0x4d6c97['status']||![];this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||[];this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||[];this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||[];}module[_0x2203('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 0327bf3..cf261b1 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 _0x8f6e=['status','registry','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','state','unknown','stateTime'];(function(_0x27b423,_0x312583){var _0x5c11b8=function(_0x22a3b9){while(--_0x22a3b9){_0x27b423['push'](_0x27b423['shift']());}};_0x5c11b8(++_0x312583);}(_0x8f6e,0xc8));var _0xe8f6=function(_0x57c662,_0x2c9ffe){_0x57c662=_0x57c662-0x0;var _0x216916=_0x8f6e[_0x57c662];return _0x216916;};'use strict';function Trunk(_0x2d6bda){this['id']=_0x2d6bda['id']||0x0;this[_0xe8f6('0x0')]=_0x2d6bda[_0xe8f6('0x0')]||![];this['name']=_0x2d6bda['name']||'';this[_0xe8f6('0x1')]=_0xe8f6('0x2');this[_0xe8f6('0x3')]=0x0;this[_0xe8f6('0x4')]=_0xe8f6('0x2');this[_0xe8f6('0x5')]=_0x2d6bda[_0xe8f6('0x5')]&&_0x2d6bda['registry']['indexOf'](':')?_0x2d6bda['registry'][_0xe8f6('0x6')](':')[0x0]:'';this[_0xe8f6('0x7')]='';this[_0xe8f6('0x8')]='';this[_0xe8f6('0x9')]='';this[_0xe8f6('0xa')]='';this[_0xe8f6('0xb')]='';this[_0xe8f6('0xc')]=_0xe8f6('0x2');this[_0xe8f6('0xd')]='';this[_0xe8f6('0xe')]='';this['defaultuser']=_0x2d6bda[_0xe8f6('0xf')]||'';}module[_0xe8f6('0x10')]=Trunk; \ No newline at end of file +var _0x896f=['stateTime','status','registry','indexOf','host','port','domain','domainport','refresh','stateRegistry','address','defaultuser','active','name','state','unknown'];(function(_0x41c5fb,_0x5d204c){var _0x1dfa13=function(_0x143fe7){while(--_0x143fe7){_0x41c5fb['push'](_0x41c5fb['shift']());}};_0x1dfa13(++_0x5d204c);}(_0x896f,0x13c));var _0xf896=function(_0x5400b,_0x55943a){_0x5400b=_0x5400b-0x0;var _0x36a39b=_0x896f[_0x5400b];return _0x36a39b;};'use strict';function Trunk(_0x1d799d){this['id']=_0x1d799d['id']||0x0;this[_0xf896('0x0')]=_0x1d799d[_0xf896('0x0')]||![];this[_0xf896('0x1')]=_0x1d799d[_0xf896('0x1')]||'';this[_0xf896('0x2')]=_0xf896('0x3');this[_0xf896('0x4')]=0x0;this[_0xf896('0x5')]=_0xf896('0x3');this['registry']=_0x1d799d['registry']&&_0x1d799d[_0xf896('0x6')][_0xf896('0x7')](':')?_0x1d799d[_0xf896('0x6')]['split'](':')[0x0]:'';this[_0xf896('0x8')]='';this[_0xf896('0x9')]='';this[_0xf896('0xa')]='';this[_0xf896('0xb')]='';this[_0xf896('0xc')]='';this[_0xf896('0xd')]=_0xf896('0x3');this['registrationtime']='';this[_0xf896('0xe')]='';this['defaultuser']=_0x1d799d[_0xf896('0xf')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 76c0049..2c09653 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 _0x91da=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x3d0f40,_0x174e76){var _0x465307=function(_0x2bbc7e){while(--_0x2bbc7e){_0x3d0f40['push'](_0x3d0f40['shift']());}};_0x465307(++_0x174e76);}(_0x91da,0x9a));var _0xa91d=function(_0x1b9cf9,_0x21bb57){_0x1b9cf9=_0x1b9cf9-0x0;var _0x20d0ed=_0x91da[_0x1b9cf9];return _0x20d0ed;};'use strict';function voiceExtension(_0x51ff9a){this['id']=_0x51ff9a['id']||0x0;this['exten']=_0x51ff9a[_0xa91d('0x0')]||'';this['recordingFormat']=_0x51ff9a[_0xa91d('0x1')]||_0xa91d('0x2');this[_0xa91d('0x3')]=_0x51ff9a[_0xa91d('0x3')]||![];}module[_0xa91d('0x4')]=voiceExtension; \ No newline at end of file +var _0x587e=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x6cd39e,_0x4c4df1){var _0x60b43d=function(_0x2fb782){while(--_0x2fb782){_0x6cd39e['push'](_0x6cd39e['shift']());}};_0x60b43d(++_0x4c4df1);}(_0x587e,0x6e));var _0xe587=function(_0x55dc69,_0x422f96){_0x55dc69=_0x55dc69-0x0;var _0x530a33=_0x587e[_0x55dc69];return _0x530a33;};'use strict';function voiceExtension(_0x3240a9){this['id']=_0x3240a9['id']||0x0;this['exten']=_0x3240a9[_0xe587('0x0')]||'';this['recordingFormat']=_0x3240a9[_0xe587('0x1')]||_0xe587('0x2');this['mandatoryDisposition']=_0x3240a9[_0xe587('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 78ed8f8..cb4594f 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 _0x1ddf=['originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','invalid','unavailable','ringing','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','total','sumHoldTime','unmanaged','loggedIn','available','acwTimeout','autopause','sendMessageOneNotActive'];(function(_0x93a689,_0x20d9d8){var _0x2df5f3=function(_0x14177f){while(--_0x14177f){_0x93a689['push'](_0x93a689['shift']());}};_0x2df5f3(++_0x20d9d8);}(_0x1ddf,0x1ab));var _0xf1dd=function(_0xc8f5a3,_0x4a02a5){_0xc8f5a3=_0xc8f5a3-0x0;var _0x55041a=_0x1ddf[_0xc8f5a3];return _0x55041a;};'use strict';var statusDesc=[_0xf1dd('0x0'),_0xf1dd('0x1'),'inuse','busy',_0xf1dd('0x2'),_0xf1dd('0x3'),_0xf1dd('0x4'),'ringinuse','onhold'];var monitorFormat={'wav':_0xf1dd('0x5'),'wav49':_0xf1dd('0x6'),'gsm':_0xf1dd('0x7')};var strategy={'rrmemory':_0xf1dd('0x8'),'roundrobin':_0xf1dd('0x9')};function VoiceQueue(_0x263400){this['id']=_0x263400['id']||0x0;this['name']=_0x263400[_0xf1dd('0xa')]||'';this[_0xf1dd('0xb')]=_0x263400[_0xf1dd('0xb')]||'';this[_0xf1dd('0xc')]=_0x263400['type']||'inbound';this['waiting']=0x0;this['talking']=0x0;this[_0xf1dd('0xd')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0xf1dd('0xe')]=0x0;this['sumBillable']=0x0;this[_0xf1dd('0xf')]=0x0;this['abandoned']=0x0;this[_0xf1dd('0x10')]=0x0;this[_0xf1dd('0x11')]=0x0;this['acw']=_0x263400['acw']||![];this[_0xf1dd('0x12')]=_0x263400[_0xf1dd('0x12')]||0xa;this[_0xf1dd('0x13')]=_0x263400['autopause']||'no';this[_0xf1dd('0x14')]=!![];this['message']='';this[_0xf1dd('0x15')]=0x0;this['temp']=0x0;this[_0xf1dd('0x16')]=_0x263400[_0xf1dd('0x16')]||null;this[_0xf1dd('0x17')]=_0x263400[_0xf1dd('0x17')]?_0x263400['dialGlobalInterval']:null;this[_0xf1dd('0x18')]=_0x263400[_0xf1dd('0x18')];this[_0xf1dd('0x19')]=_0x263400[_0xf1dd('0x19')]||_0xf1dd('0x1a');this[_0xf1dd('0x1b')]=_0x263400[_0xf1dd('0x1b')]||0x0;this[_0xf1dd('0x1c')]=_0x263400[_0xf1dd('0x1c')]||0x0;this['dialPowerLevel']=_0x263400[_0xf1dd('0x1d')]||0x1;this['dialPredictiveOptimization']=_0x263400[_0xf1dd('0x1e')]||_0xf1dd('0x1f');this[_0xf1dd('0x20')]=_0x263400[_0xf1dd('0x20')]||0.03;this[_0xf1dd('0x21')]=_0x263400[_0xf1dd('0x21')]||0x258;this[_0xf1dd('0x22')]=_0x263400[_0xf1dd('0x22')]||_0xf1dd('0x23');this[_0xf1dd('0x24')]=_0x263400[_0xf1dd('0x24')]||_0xf1dd('0x23');this[_0xf1dd('0x25')]=_0x263400[_0xf1dd('0x25')]||0x1e;this[_0xf1dd('0x26')]=_0x263400['dialQueueOptions']||_0xf1dd('0x27');this[_0xf1dd('0x28')]=_0x263400['dialQueueTimeout']||0x3;this[_0xf1dd('0x29')]=_0x263400[_0xf1dd('0x29')]||undefined;this[_0xf1dd('0x2a')]=_0x263400['dialCongestionMaxRetry']||0x3;this[_0xf1dd('0x2b')]=_0x263400['dialCongestionRetryFrequency']||0x96;this[_0xf1dd('0x2c')]=_0x263400['dialBusyMaxRetry']||0x3;this[_0xf1dd('0x2d')]=_0x263400[_0xf1dd('0x2d')]||0x96;this[_0xf1dd('0x2e')]=_0x263400[_0xf1dd('0x2e')]||0x3;this['dialNoAnswerRetryFrequency']=_0x263400[_0xf1dd('0x2f')]||0x96;this[_0xf1dd('0x30')]=_0x263400['dialNoSuchNumberMaxRetry']||0x3;this[_0xf1dd('0x31')]=_0x263400[_0xf1dd('0x31')]||0x96;this[_0xf1dd('0x32')]=_0x263400[_0xf1dd('0x32')]||0x3;this['dialDropRetryFrequency']=_0x263400[_0xf1dd('0x33')]||0x96;this['dialAbandonedMaxRetry']=_0x263400['dialAbandonedMaxRetry']||0x3;this[_0xf1dd('0x34')]=_0x263400['dialAbandonedRetryFrequency']||0x96;this[_0xf1dd('0x35')]=_0x263400[_0xf1dd('0x35')]||0x3;this[_0xf1dd('0x36')]=_0x263400['dialMachineRetryFrequency']||0x96;this[_0xf1dd('0x37')]=_0x263400['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x263400['dialAgentRejectRetryFrequency']||0x96;this[_0xf1dd('0x38')]=_0x263400['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x263400[_0xf1dd('0x39')]?_0x263400[_0xf1dd('0x39')]:undefined;this[_0xf1dd('0x3a')]=_0x263400[_0xf1dd('0x3a')]?_0x263400[_0xf1dd('0x3a')]:undefined;this[_0xf1dd('0x3b')]=_0x263400[_0xf1dd('0x3b')]||undefined;this[_0xf1dd('0x3c')]=_0x263400[_0xf1dd('0x3c')]?_0x263400[_0xf1dd('0x3c')]:undefined;this[_0xf1dd('0x3d')]=_0x263400['dialOrderByScheduledAt']||_0xf1dd('0x3e');this['dialRandomLastDigitCallerIdNumber']=_0x263400['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xf1dd('0x3f')]=_0x263400[_0xf1dd('0x3f')]||undefined;this[_0xf1dd('0x40')]=strategy[_0x263400[_0xf1dd('0x40')]]||_0xf1dd('0x8');this[_0xf1dd('0x41')]=!![];this[_0xf1dd('0x42')]=_0x263400['dialAMDActive']||![];this[_0xf1dd('0x43')]=_0x263400[_0xf1dd('0x43')];this[_0xf1dd('0x44')]=_0x263400[_0xf1dd('0x44')];this[_0xf1dd('0x45')]=_0x263400[_0xf1dd('0x45')];this[_0xf1dd('0x46')]=_0x263400['dialAMDTotalAnalysisTime'];this[_0xf1dd('0x47')]=_0x263400[_0xf1dd('0x47')];this[_0xf1dd('0x48')]=_0x263400[_0xf1dd('0x48')];this['dialAMDMaximumNumberOfWords']=_0x263400[_0xf1dd('0x49')];this[_0xf1dd('0x4a')]=_0x263400[_0xf1dd('0x4a')];this[_0xf1dd('0x4b')]=_0x263400[_0xf1dd('0x4b')];this[_0xf1dd('0x4c')]=0x0;this[_0xf1dd('0x4d')]=0x0;this[_0xf1dd('0x4e')]=_0x263400[_0xf1dd('0x4e')];this['outboundAnswerCallsDay']=0x0;this[_0xf1dd('0x4f')]=0x0;this[_0xf1dd('0x50')]=0x0;this[_0xf1dd('0x51')]=0x0;this[_0xf1dd('0x52')]=0x0;this[_0xf1dd('0x53')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xf1dd('0x54')]=0x0;this[_0xf1dd('0x55')]=0x0;this[_0xf1dd('0x56')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xf1dd('0x57')]=0x0;this['outboundReCallsDay']=0x0;this[_0xf1dd('0x58')]=0x0;this[_0xf1dd('0x59')]=undefined;this[_0xf1dd('0x5a')]=undefined;this['handlePredictive']=undefined;this[_0xf1dd('0x5b')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xf1dd('0x5c')]=0x0;this[_0xf1dd('0x5d')]=0x0;this[_0xf1dd('0x5e')]=0x0;this[_0xf1dd('0x5f')]=0x0;this[_0xf1dd('0x60')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xf1dd('0x61')]=_0x263400[_0xf1dd('0x62')]||0x14;this[_0xf1dd('0x63')]=_0x263400[_0xf1dd('0x62')]||0xa;this[_0xf1dd('0x64')]=0x0;this[_0xf1dd('0x65')]=0x0;this[_0xf1dd('0x66')]=0x1;this['erlangCalls']=0x0;this[_0xf1dd('0x67')]=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0xf1dd('0x68')]=_0x263400[_0xf1dd('0x68')]||0x1e;this[_0xf1dd('0x69')]=_0x263400[_0xf1dd('0x69')]||![];this[_0xf1dd('0x6a')]=_0x263400[_0xf1dd('0x6a')]||undefined;this[_0xf1dd('0x6b')]=_0x263400['dialAgiAfterHangupClient']||![];this[_0xf1dd('0x6c')]=_0x263400[_0xf1dd('0x6c')]||![];this['monitor_format']=monitorFormat[_0x263400[_0xf1dd('0xb')]]?monitorFormat[_0x263400[_0xf1dd('0xb')]]:undefined;this['mandatoryDisposition']=_0x263400[_0xf1dd('0x6d')]||![];this['mandatoryDispositionPause']=_0x263400[_0xf1dd('0x6e')]?_0x263400[_0xf1dd('0x6e')]:undefined;}module[_0xf1dd('0x6f')]=VoiceQueue; \ No newline at end of file +var _0x9fcd=['monitor_format','inbound','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','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','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','roundrobin','name'];(function(_0x3f19ec,_0x377f69){var _0x1835cf=function(_0x3032ad){while(--_0x3032ad){_0x3f19ec['push'](_0x3f19ec['shift']());}};_0x1835cf(++_0x377f69);}(_0x9fcd,0x15b));var _0xd9fc=function(_0x12ce9e,_0x414f63){_0x12ce9e=_0x12ce9e-0x0;var _0x1e0f2f=_0x9fcd[_0x12ce9e];return _0x1e0f2f;};'use strict';var statusDesc=[_0xd9fc('0x0'),_0xd9fc('0x1'),_0xd9fc('0x2'),'busy',_0xd9fc('0x3'),_0xd9fc('0x4'),_0xd9fc('0x5'),_0xd9fc('0x6'),_0xd9fc('0x7')];var monitorFormat={'wav':_0xd9fc('0x8'),'wav49':_0xd9fc('0x9'),'gsm':_0xd9fc('0xa')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xd9fc('0xb')};function VoiceQueue(_0x46c5b3){this['id']=_0x46c5b3['id']||0x0;this['name']=_0x46c5b3[_0xd9fc('0xc')]||'';this[_0xd9fc('0xd')]=_0x46c5b3[_0xd9fc('0xd')]||'';this['type']=_0x46c5b3['type']||_0xd9fc('0xe');this[_0xd9fc('0xf')]=0x0;this[_0xd9fc('0x10')]=0x0;this[_0xd9fc('0x11')]=0x0;this['answered']=0x0;this[_0xd9fc('0x12')]=0x0;this[_0xd9fc('0x13')]=0x0;this[_0xd9fc('0x14')]=0x0;this[_0xd9fc('0x15')]=0x0;this['abandoned']=0x0;this[_0xd9fc('0x16')]=0x0;this[_0xd9fc('0x17')]=0x0;this['acw']=_0x46c5b3[_0xd9fc('0x18')]||![];this['acwTimeout']=_0x46c5b3[_0xd9fc('0x19')]||0xa;this[_0xd9fc('0x1a')]=_0x46c5b3[_0xd9fc('0x1a')]||'no';this[_0xd9fc('0x1b')]=!![];this['message']='';this[_0xd9fc('0x1c')]=0x0;this['temp']=0x0;this['dialTimezone']=_0x46c5b3[_0xd9fc('0x1d')]||null;this[_0xd9fc('0x1e')]=_0x46c5b3[_0xd9fc('0x1e')]?_0x46c5b3[_0xd9fc('0x1e')]:null;this[_0xd9fc('0x1f')]=_0x46c5b3['dialActive'];this['dialMethod']=_0x46c5b3[_0xd9fc('0x20')]||_0xd9fc('0x21');this[_0xd9fc('0x22')]=_0x46c5b3[_0xd9fc('0x22')]||0x0;this[_0xd9fc('0x23')]=_0x46c5b3[_0xd9fc('0x23')]||0x0;this['dialPowerLevel']=_0x46c5b3[_0xd9fc('0x24')]||0x1;this[_0xd9fc('0x25')]=_0x46c5b3[_0xd9fc('0x25')]||_0xd9fc('0x26');this[_0xd9fc('0x27')]=_0x46c5b3[_0xd9fc('0x27')]||0.03;this[_0xd9fc('0x28')]=_0x46c5b3['dialPredictiveInterval']||0x258;this[_0xd9fc('0x29')]=_0x46c5b3[_0xd9fc('0x29')]||_0xd9fc('0x2a');this['dialOriginateCallerIdNumber']=_0x46c5b3[_0xd9fc('0x2b')]||_0xd9fc('0x2a');this[_0xd9fc('0x2c')]=_0x46c5b3['dialOriginateTimeout']||0x1e;this[_0xd9fc('0x2d')]=_0x46c5b3[_0xd9fc('0x2d')]||'tTxX';this['dialQueueTimeout']=_0x46c5b3[_0xd9fc('0x2e')]||0x3;this[_0xd9fc('0x2f')]=_0x46c5b3[_0xd9fc('0x2f')]||undefined;this[_0xd9fc('0x30')]=_0x46c5b3[_0xd9fc('0x30')]||0x3;this[_0xd9fc('0x31')]=_0x46c5b3[_0xd9fc('0x31')]||0x96;this[_0xd9fc('0x32')]=_0x46c5b3['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x46c5b3['dialBusyRetryFrequency']||0x96;this[_0xd9fc('0x33')]=_0x46c5b3['dialNoAnswerMaxRetry']||0x3;this[_0xd9fc('0x34')]=_0x46c5b3[_0xd9fc('0x34')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x46c5b3[_0xd9fc('0x35')]||0x3;this[_0xd9fc('0x36')]=_0x46c5b3[_0xd9fc('0x36')]||0x96;this[_0xd9fc('0x37')]=_0x46c5b3[_0xd9fc('0x37')]||0x3;this[_0xd9fc('0x38')]=_0x46c5b3[_0xd9fc('0x38')]||0x96;this[_0xd9fc('0x39')]=_0x46c5b3[_0xd9fc('0x39')]||0x3;this[_0xd9fc('0x3a')]=_0x46c5b3[_0xd9fc('0x3a')]||0x96;this['dialMachineMaxRetry']=_0x46c5b3[_0xd9fc('0x3b')]||0x3;this['dialMachineRetryFrequency']=_0x46c5b3[_0xd9fc('0x3c')]||0x96;this['dialAgentRejectMaxRetry']=_0x46c5b3[_0xd9fc('0x3d')]||0x3;this[_0xd9fc('0x3e')]=_0x46c5b3[_0xd9fc('0x3e')]||0x96;this[_0xd9fc('0x3f')]=_0x46c5b3[_0xd9fc('0x3f')]||0x4;this['Trunk']=_0x46c5b3['Trunk']?_0x46c5b3[_0xd9fc('0x40')]:undefined;this['TrunkBackup']=_0x46c5b3[_0xd9fc('0x41')]?_0x46c5b3[_0xd9fc('0x41')]:undefined;this[_0xd9fc('0x42')]=_0x46c5b3[_0xd9fc('0x42')]||undefined;this['Interval']=_0x46c5b3[_0xd9fc('0x43')]?_0x46c5b3[_0xd9fc('0x43')]:undefined;this['dialOrderByScheduledAt']=_0x46c5b3[_0xd9fc('0x44')]||'DESC';this[_0xd9fc('0x45')]=_0x46c5b3['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xd9fc('0x46')]=_0x46c5b3['dialCutDigit']||undefined;this[_0xd9fc('0x47')]=strategy[_0x46c5b3[_0xd9fc('0x47')]]||_0xd9fc('0x48');this[_0xd9fc('0x49')]=!![];this[_0xd9fc('0x4a')]=_0x46c5b3['dialAMDActive']||![];this[_0xd9fc('0x4b')]=_0x46c5b3[_0xd9fc('0x4b')];this[_0xd9fc('0x4c')]=_0x46c5b3[_0xd9fc('0x4c')];this[_0xd9fc('0x4d')]=_0x46c5b3['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x46c5b3[_0xd9fc('0x4e')];this[_0xd9fc('0x4f')]=_0x46c5b3[_0xd9fc('0x4f')];this[_0xd9fc('0x50')]=_0x46c5b3[_0xd9fc('0x50')];this['dialAMDMaximumNumberOfWords']=_0x46c5b3['dialAMDMaximumNumberOfWords'];this[_0xd9fc('0x51')]=_0x46c5b3['dialAMDSilenceThreshold'];this[_0xd9fc('0x52')]=_0x46c5b3[_0xd9fc('0x52')];this[_0xd9fc('0x53')]=0x0;this[_0xd9fc('0x54')]=0x0;this[_0xd9fc('0x55')]=_0x46c5b3[_0xd9fc('0x55')];this[_0xd9fc('0x56')]=0x0;this[_0xd9fc('0x57')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xd9fc('0x58')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xd9fc('0x59')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xd9fc('0x5a')]=0x0;this[_0xd9fc('0x5b')]=0x0;this[_0xd9fc('0x5c')]=0x0;this[_0xd9fc('0x5d')]=0x0;this[_0xd9fc('0x5e')]=0x0;this[_0xd9fc('0x5f')]=0x0;this[_0xd9fc('0x60')]=0x0;this[_0xd9fc('0x61')]=undefined;this[_0xd9fc('0x62')]=undefined;this[_0xd9fc('0x63')]=undefined;this[_0xd9fc('0x64')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xd9fc('0x65')]=0x0;this[_0xd9fc('0x66')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xd9fc('0x67')]=0x0;this[_0xd9fc('0x68')]=0x0;this[_0xd9fc('0x69')]=0x0;this[_0xd9fc('0x6a')]=_0x46c5b3['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xd9fc('0x6b')]=_0x46c5b3['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xd9fc('0x6c')]=0x0;this[_0xd9fc('0x6d')]=0x0;this[_0xd9fc('0x6e')]=0x1;this[_0xd9fc('0x6f')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0xd9fc('0x70')]=0x0;this[_0xd9fc('0x71')]=_0x46c5b3[_0xd9fc('0x71')]||0x1e;this[_0xd9fc('0x72')]=_0x46c5b3['dialRecallInQueue']||![];this[_0xd9fc('0x73')]=_0x46c5b3[_0xd9fc('0x73')]||undefined;this[_0xd9fc('0x74')]=_0x46c5b3['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x46c5b3['dialAgiAfterHangupAgent']||![];this[_0xd9fc('0xd')]=monitorFormat[_0x46c5b3[_0xd9fc('0xd')]]?monitorFormat[_0x46c5b3['monitor_format']]:undefined;this[_0xd9fc('0x75')]=_0x46c5b3[_0xd9fc('0x75')]||![];this['mandatoryDispositionPause']=_0x46c5b3[_0xd9fc('0x76')]?_0x46c5b3[_0xd9fc('0x76')]:undefined;}module[_0xd9fc('0x77')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 26cdb77..c84e5c9 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 _0x6dda=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x2e7d41,_0xbd0a3c){var _0x21c5fc=function(_0xdaa9b3){while(--_0xdaa9b3){_0x2e7d41['push'](_0x2e7d41['shift']());}};_0x21c5fc(++_0xbd0a3c);}(_0x6dda,0x1b5));var _0xa6dd=function(_0x5f26b6,_0x276ca0){_0x5f26b6=_0x5f26b6-0x0;var _0x5d2992=_0x6dda[_0x5f26b6];return _0x5d2992;};'use strict';function VtigerAccount(_0x57262d){this['id']=_0x57262d['id']||0x0;this[_0xa6dd('0x0')]=_0x57262d['name']||'';this['username']=_0x57262d[_0xa6dd('0x1')]||'';this['accessKey']=_0x57262d[_0xa6dd('0x2')]||'';this['remoteUri']=_0x57262d[_0xa6dd('0x3')]||'';this[_0xa6dd('0x4')]=_0x57262d[_0xa6dd('0x4')]||'';this['Configurations']=_0x57262d[_0xa6dd('0x5')]||{};}module[_0xa6dd('0x6')]=VtigerAccount; \ No newline at end of file +var _0xa44c=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xa44c,0x9a));var _0xca44=function(_0x5f2825,_0x5a9d97){_0x5f2825=_0x5f2825-0x0;var _0xa32608=_0xa44c[_0x5f2825];return _0xa32608;};'use strict';function VtigerAccount(_0xd3e9ee){this['id']=_0xd3e9ee['id']||0x0;this[_0xca44('0x0')]=_0xd3e9ee[_0xca44('0x0')]||'';this[_0xca44('0x1')]=_0xd3e9ee['username']||'';this[_0xca44('0x2')]=_0xd3e9ee[_0xca44('0x2')]||'';this[_0xca44('0x3')]=_0xd3e9ee['remoteUri']||'';this[_0xca44('0x4')]=_0xd3e9ee[_0xca44('0x4')]||'';this['Configurations']=_0xd3e9ee[_0xca44('0x5')]||{};}module[_0xca44('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 8f4488b..60583ce 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 _0x4da1=['exports','name','username','password','token','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x17a0dd,_0x2bc3a0){var _0xb53ce3=function(_0x575263){while(--_0x575263){_0x17a0dd['push'](_0x17a0dd['shift']());}};_0xb53ce3(++_0x2bc3a0);}(_0x4da1,0xb5));var _0x14da=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4da1[_0x321bb2];return _0x9c12ed;};'use strict';function ZendeskAccount(_0x23449f){this['id']=_0x23449f['id']||0x0;this['name']=_0x23449f[_0x14da('0x0')]||'';this['username']=_0x23449f[_0x14da('0x1')]||'';this[_0x14da('0x2')]=_0x23449f[_0x14da('0x2')]||'';this[_0x14da('0x3')]=_0x23449f[_0x14da('0x3')]||'';this['remoteUri']=_0x23449f['remoteUri']||'';this[_0x14da('0x4')]=_0x23449f[_0x14da('0x4')]||'';this[_0x14da('0x5')]=_0x23449f[_0x14da('0x5')]||_0x14da('0x6');this['serverUrl']=_0x23449f[_0x14da('0x7')]||'';this[_0x14da('0x8')]=_0x23449f[_0x14da('0x8')]||{};}module[_0x14da('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x4f89=['username','token','remoteUri','type','serverUrl','Configurations','exports','name'];(function(_0x40ddd7,_0x346d34){var _0x223b44=function(_0x3249bb){while(--_0x3249bb){_0x40ddd7['push'](_0x40ddd7['shift']());}};_0x223b44(++_0x346d34);}(_0x4f89,0x187));var _0x94f8=function(_0x43a251,_0x2ca1b8){_0x43a251=_0x43a251-0x0;var _0x15f782=_0x4f89[_0x43a251];return _0x15f782;};'use strict';function ZendeskAccount(_0x57249d){this['id']=_0x57249d['id']||0x0;this[_0x94f8('0x0')]=_0x57249d[_0x94f8('0x0')]||'';this['username']=_0x57249d[_0x94f8('0x1')]||'';this['password']=_0x57249d['password']||'';this[_0x94f8('0x2')]=_0x57249d[_0x94f8('0x2')]||'';this[_0x94f8('0x3')]=_0x57249d['remoteUri']||'';this['authType']=_0x57249d['authType']||'';this[_0x94f8('0x4')]=_0x57249d[_0x94f8('0x4')]||'integrationTab';this[_0x94f8('0x5')]=_0x57249d[_0x94f8('0x5')]||'';this[_0x94f8('0x6')]=_0x57249d['Configurations']||{};}module[_0x94f8('0x7')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 918435e..9d31abe 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 _0x2b59=['serverUrl','code','refreshToken','Configurations','exports','name','description','zone','clientId','clientSecret'];(function(_0x2c6035,_0x3a64ff){var _0x11ec59=function(_0x3c58f2){while(--_0x3c58f2){_0x2c6035['push'](_0x2c6035['shift']());}};_0x11ec59(++_0x3a64ff);}(_0x2b59,0x177));var _0x92b5=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2b59[_0x42cae2];return _0x5f256f;};'use strict';function ZohoAccount(_0x1ff3e0){this['id']=_0x1ff3e0['id']||0x0;this[_0x92b5('0x0')]=_0x1ff3e0[_0x92b5('0x0')]||'';this[_0x92b5('0x1')]=_0x1ff3e0['description']||'';this['host']=_0x1ff3e0['host']||'';this[_0x92b5('0x2')]=_0x1ff3e0['zone']||'';this['clientId']=_0x1ff3e0[_0x92b5('0x3')]||'';this['clientSecret']=_0x1ff3e0[_0x92b5('0x4')]||'';this[_0x92b5('0x5')]=_0x1ff3e0['serverUrl']||'';this[_0x92b5('0x6')]=_0x1ff3e0['code']||'';this[_0x92b5('0x7')]=_0x1ff3e0['refreshToken']||'';this[_0x92b5('0x8')]=_0x1ff3e0[_0x92b5('0x8')]||{};}module[_0x92b5('0x9')]=ZohoAccount; \ No newline at end of file +var _0xb49d=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x549c2b,_0x4a97ef){var _0x154e43=function(_0x274066){while(--_0x274066){_0x549c2b['push'](_0x549c2b['shift']());}};_0x154e43(++_0x4a97ef);}(_0xb49d,0xf9));var _0xdb49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb49d[_0x3dd15e];return _0x231fd0;};'use strict';function ZohoAccount(_0x8600de){this['id']=_0x8600de['id']||0x0;this[_0xdb49('0x0')]=_0x8600de[_0xdb49('0x0')]||'';this['description']=_0x8600de[_0xdb49('0x1')]||'';this[_0xdb49('0x2')]=_0x8600de[_0xdb49('0x2')]||'';this[_0xdb49('0x3')]=_0x8600de[_0xdb49('0x3')]||'';this[_0xdb49('0x4')]=_0x8600de[_0xdb49('0x4')]||'';this['clientSecret']=_0x8600de[_0xdb49('0x5')]||'';this[_0xdb49('0x6')]=_0x8600de[_0xdb49('0x6')]||'';this[_0xdb49('0x7')]=_0x8600de[_0xdb49('0x7')]||'';this['refreshToken']=_0x8600de[_0xdb49('0x8')]||'';this[_0xdb49('0x9')]=_0x8600de[_0xdb49('0x9')]||{};}module[_0xdb49('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index a2fd871..51649ae 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 _0x0e17=['Contact','phone','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','SIP/%s','calleridname'];(function(_0x4ae17d,_0x503a6d){var _0x3a3273=function(_0xb9fe80){while(--_0xb9fe80){_0x4ae17d['push'](_0x4ae17d['shift']());}};_0x3a3273(++_0x503a6d);}(_0x0e17,0x11c));var _0x70e1=function(_0x3c8fb5,_0x465f64){_0x3c8fb5=_0x3c8fb5-0x0;var _0x575801=_0x0e17[_0x3c8fb5];return _0x575801;};'use strict';var util=require(_0x70e1('0x0'));var _=require(_0x70e1('0x1'));var moment=require(_0x70e1('0x2'));function checkNameSurname(_0x3478f0,_0x1a79ba,_0x20e916){var _0x4f9beb='';if(!_[_0x70e1('0x3')](_0x1a79ba)&&_0x70e1('0x4')===typeof _0x1a79ba){_0x4f9beb+=_0x1a79ba;}if(!_[_0x70e1('0x3')](_0x20e916)&&_0x70e1('0x4')===typeof _0x20e916){_0x4f9beb+='\x20'+_0x20e916;}if(_0x4f9beb!==''){return _0x4f9beb;}return _0x3478f0;}function Action(_0x5a6e91,_0x5c2a10,_0x1ced51,_0x8ef7ce,_0x324421){this[_0x70e1('0x5')]=_0x1ced51||undefined;this[_0x70e1('0x6')]=_0x5a6e91['id'];this[_0x70e1('0x7')]=_0x5c2a10[_0x70e1('0x8')];this[_0x70e1('0x9')]=_0x5c2a10[_0x70e1('0x9')];this[_0x70e1('0xa')]='queue';this['dialAnswer']=![];this[_0x70e1('0xb')]=_[_0x70e1('0x3')](_0x5a6e91[_0x70e1('0xc')])?undefined:_0x5a6e91[_0x70e1('0xc')][_0x70e1('0x8')];this[_0x70e1('0xd')]=this['membername']?util[_0x70e1('0xe')](_0x70e1('0xf'),this[_0x70e1('0xb')]):_0x8ef7ce||undefined;this[_0x70e1('0x10')]=checkNameSurname(_0x5a6e91[_0x70e1('0x11')][_0x70e1('0x12')],_0x5a6e91['Contact']['firstName'],_0x5a6e91[_0x70e1('0x11')][_0x70e1('0x13')]);this[_0x70e1('0x14')]=_0x5a6e91[_0x70e1('0x14')]||![];this['calleridnum']=_0x5a6e91[_0x70e1('0x11')][_0x70e1('0x12')];this['scheduledat']=_0x5a6e91[_0x70e1('0x15')];this['countbusyretry']=_0x5a6e91[_0x70e1('0x16')]||0x0;this['countcongestionretry']=_0x5a6e91[_0x70e1('0x17')]||0x0;this[_0x70e1('0x18')]=_0x5a6e91['countnoanswerretry']||0x0;this[_0x70e1('0x19')]=(_0x5a6e91['countbusyretry']||0x0)+(_0x5a6e91['countcongestionretry']||0x0)+(_0x5a6e91[_0x70e1('0x18')]||0x0)+(_0x5a6e91['countnosuchnumberretry']||0x0)+(_0x5a6e91[_0x70e1('0x1a')]||0x0)+(_0x5a6e91[_0x70e1('0x1b')]||0x0)+(_0x5a6e91[_0x70e1('0x1c')]||0x0)+(_0x5a6e91[_0x70e1('0x1d')]||0x0);this[_0x70e1('0x1e')]=_0x5a6e91[_0x70e1('0x1e')]||0x0;this['countdropretry']=_0x5a6e91[_0x70e1('0x1a')]||0x0;this['countabandonedretry']=_0x5a6e91[_0x70e1('0x1b')]||0x0;this[_0x70e1('0x1c')]=_0x5a6e91[_0x70e1('0x1c')]||0x0;this[_0x70e1('0x1d')]=_0x5a6e91['countagentrejectretry']||0x0;this[_0x70e1('0x1f')]=_0x5a6e91[_0x70e1('0x1f')];this[_0x70e1('0x20')]=_0x5a6e91[_0x70e1('0x20')];this[_0x70e1('0x21')]=_0x5a6e91['callbackat'];this[_0x70e1('0x22')]=_0x5a6e91[_0x70e1('0x22')];this[_0x70e1('0x23')]=_0x5a6e91[_0x70e1('0x23')];this[_0x70e1('0x24')]=_0x5a6e91[_0x70e1('0x24')];this[_0x70e1('0x25')]=_['isNil'](_0x5a6e91[_0x70e1('0xc')])?_0x5a6e91[_0x70e1('0x25')]:_0x5a6e91['Agent']['id'];this[_0x70e1('0x26')]=_0x5a6e91[_0x70e1('0x26')];this['originatecalleridnum']='';this[_0x70e1('0x27')]='';}Action[_0x70e1('0x28')]['getCaller']=function(){return util['format'](_0x70e1('0x29'),this['calleridname'],this['number']);};module[_0x70e1('0x2a')]=Action; \ No newline at end of file +var _0x620a=['isNil','string','uniqueid','idContact','queue','type','dialAnswer','membername','Agent','name','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','format','number','exports','util','lodash','moment'];(function(_0xb046a2,_0x225dc9){var _0x1177cd=function(_0x182768){while(--_0x182768){_0xb046a2['push'](_0xb046a2['shift']());}};_0x1177cd(++_0x225dc9);}(_0x620a,0x1a1));var _0xa620=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x620a[_0x59ee6f];return _0x4c0979;};'use strict';var util=require(_0xa620('0x0'));var _=require(_0xa620('0x1'));var moment=require(_0xa620('0x2'));function checkNameSurname(_0x3a63e0,_0x3b2853,_0x350a3d){var _0x53807='';if(!_[_0xa620('0x3')](_0x3b2853)&&_0xa620('0x4')===typeof _0x3b2853){_0x53807+=_0x3b2853;}if(!_[_0xa620('0x3')](_0x350a3d)&&_0xa620('0x4')===typeof _0x350a3d){_0x53807+='\x20'+_0x350a3d;}if(_0x53807!==''){return _0x53807;}return _0x3a63e0;}function Action(_0x5a856a,_0x438716,_0x3ec134,_0x3a4e91,_0x2e0b1d){this[_0xa620('0x5')]=_0x3ec134||undefined;this[_0xa620('0x6')]=_0x5a856a['id'];this[_0xa620('0x7')]=_0x438716['name'];this[_0xa620('0x8')]=_0x438716[_0xa620('0x8')];this['campaigntype']='queue';this[_0xa620('0x9')]=![];this[_0xa620('0xa')]=_['isNil'](_0x5a856a[_0xa620('0xb')])?undefined:_0x5a856a[_0xa620('0xb')][_0xa620('0xc')];this['channelAgent']=this[_0xa620('0xa')]?util['format']('SIP/%s',this[_0xa620('0xa')]):_0x3a4e91||undefined;this[_0xa620('0xd')]=checkNameSurname(_0x5a856a[_0xa620('0xe')]['phone'],_0x5a856a[_0xa620('0xe')][_0xa620('0xf')],_0x5a856a['Contact'][_0xa620('0x10')]);this[_0xa620('0x11')]=_0x5a856a[_0xa620('0x11')]||![];this[_0xa620('0x12')]=_0x5a856a[_0xa620('0xe')][_0xa620('0x13')];this[_0xa620('0x14')]=_0x5a856a[_0xa620('0x14')];this[_0xa620('0x15')]=_0x5a856a['countbusyretry']||0x0;this[_0xa620('0x16')]=_0x5a856a[_0xa620('0x16')]||0x0;this[_0xa620('0x17')]=_0x5a856a[_0xa620('0x17')]||0x0;this[_0xa620('0x18')]=(_0x5a856a[_0xa620('0x15')]||0x0)+(_0x5a856a[_0xa620('0x16')]||0x0)+(_0x5a856a[_0xa620('0x17')]||0x0)+(_0x5a856a[_0xa620('0x19')]||0x0)+(_0x5a856a[_0xa620('0x1a')]||0x0)+(_0x5a856a[_0xa620('0x1b')]||0x0)+(_0x5a856a['countmachineretry']||0x0)+(_0x5a856a['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x5a856a[_0xa620('0x19')]||0x0;this[_0xa620('0x1a')]=_0x5a856a['countdropretry']||0x0;this['countabandonedretry']=_0x5a856a[_0xa620('0x1b')]||0x0;this[_0xa620('0x1c')]=_0x5a856a[_0xa620('0x1c')]||0x0;this[_0xa620('0x1d')]=_0x5a856a[_0xa620('0x1d')]||0x0;this[_0xa620('0x1e')]=_0x5a856a[_0xa620('0x1e')];this['callbackuniqueid']=_0x5a856a['callbackuniqueid'];this['callbackat']=_0x5a856a[_0xa620('0x1f')];this[_0xa620('0x20')]=_0x5a856a[_0xa620('0x20')];this['ContactId']=_0x5a856a[_0xa620('0x21')];this[_0xa620('0x22')]=_0x5a856a['ListId'];this[_0xa620('0x23')]=_[_0xa620('0x3')](_0x5a856a[_0xa620('0xb')])?_0x5a856a[_0xa620('0x23')]:_0x5a856a[_0xa620('0xb')]['id'];this[_0xa620('0x24')]=_0x5a856a['VoiceQueueId'];this['originatecalleridnum']='';this[_0xa620('0x25')]='';}Action[_0xa620('0x26')]['getCaller']=function(){return util[_0xa620('0x27')]('\x22%s\x22\x20<%s>',this[_0xa620('0xd')],this[_0xa620('0x28')]);};module[_0xa620('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 34e0aed..a521650 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 _0x5d0c=['custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','idContact','[Preview][execCall][failure]','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','phone','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','syncOriginateResponse','logLookAgent','response','custom:agentringnoanswer','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/logger','preview','actionPreview','./action','./util/util','defaults','redis','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','clockClearZombieChannels','originateresponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialMethod','dialOriginateCallerIdName','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','booked','clearZombieChannels','hasOwnProperty','dialActive','setMessage','enqueue','isNil','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','recallMe','getContactRecallMe','agentReadyId','agents','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','ANSWER','responsetime','uniqueid','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','countbusyretry','Busy','busy','cloneAction','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','rescheduleContact','dialNoAnswerRetryFrequency','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','outboundAbandonedCallsDay','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','cause-txt','dialstatus'];(function(_0x12732c,_0x438a37){var _0x7f93ff=function(_0x2cfbbe){while(--_0x2cfbbe){_0x12732c['push'](_0x12732c['shift']());}};_0x7f93ff(++_0x438a37);}(_0x5d0c,0x1c1));var _0xc5d0=function(_0x43c50b,_0x35ae23){_0x43c50b=_0x43c50b-0x0;var _0xcc6396=_0x5d0c[_0x43c50b];return _0xcc6396;};'use strict';var util=require(_0xc5d0('0x0'));var _=require(_0xc5d0('0x1'));var BPromise=require('bluebird');var uuid=require(_0xc5d0('0x2'));var moment=require(_0xc5d0('0x3'));var md5=require(_0xc5d0('0x4'));var Redis=require(_0xc5d0('0x5'));var config=require('../../../config/environment');var logger=require(_0xc5d0('0x6'))(_0xc5d0('0x7'));var loggerAction=require('../../../config/logger')(_0xc5d0('0x8'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0xc5d0('0x9'));var ut=require(_0xc5d0('0xa'));config['redis']=_[_0xc5d0('0xb')](config[_0xc5d0('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0xc5d0('0xd'))(new Redis(config[_0xc5d0('0xc')]));var Sequence=function(){};Sequence[_0xc5d0('0xe')]['enqueue']=function(_0x5b0910){this[_0xc5d0('0xf')]=this[_0xc5d0('0xf')]?this[_0xc5d0('0xf')][_0xc5d0('0x10')](_0x5b0910):_0x5b0910();};function Preview(_0x5057ef){this[_0xc5d0('0x11')]=new Sequence();this[_0xc5d0('0x12')]=_0x5057ef[_0xc5d0('0x13')];this['trunks']=_0x5057ef[_0xc5d0('0x14')];this[_0xc5d0('0x15')]={};this['agents']=_0x5057ef['agents'];this[_0xc5d0('0x16')]=0x0;ami['on'](_0xc5d0('0x17'),this['syncOriginateResponse'][_0xc5d0('0x18')](this));ami['on']('hangup',this[_0xc5d0('0x19')][_0xc5d0('0x18')](this));ami['on'](_0xc5d0('0x1a'),this[_0xc5d0('0x1b')][_0xc5d0('0x18')](this));ami['on'](_0xc5d0('0x1c'),this[_0xc5d0('0x1d')][_0xc5d0('0x18')](this));ami['on']('newexten',this['syncNewExten'][_0xc5d0('0x18')](this));ami['on'](_0xc5d0('0x1e'),this[_0xc5d0('0x1f')]['bind'](this));ami['on'](_0xc5d0('0x20'),this[_0xc5d0('0x21')][_0xc5d0('0x18')](this));ami['on'](_0xc5d0('0x22'),this[_0xc5d0('0x23')][_0xc5d0('0x18')](this));this[_0xc5d0('0x24')](this['campaignsPreview']);}function emit(_0x491da4,_0x2d1562,_0x46f65e){io['to'](_0x491da4)[_0xc5d0('0x25')](_0x2d1562,_0x46f65e);}function emitCampaignPreview(_0x13965a){if(_0x13965a[_0xc5d0('0x26')]===_0xc5d0('0x27')){var _0x446887={'id':_0x13965a['id'],'name':_0x13965a[_0xc5d0('0x28')],'strategy':_0x13965a['strategy'],'answered':_0x13965a['answered'],'available':_0x13965a[_0xc5d0('0x29')],'loggedIn':_0x13965a[_0xc5d0('0x2a')],'pTalking':_0x13965a[_0xc5d0('0x2b')],'sumBillable':_0x13965a['sumBillable'],'sumDuration':_0x13965a[_0xc5d0('0x2c')],'sumHoldTime':_0x13965a[_0xc5d0('0x2d')]||0x0,'talking':_0x13965a[_0xc5d0('0x2e')],'total':_0x13965a[_0xc5d0('0x2f')],'type':_0x13965a[_0xc5d0('0x26')],'unmanaged':_0x13965a[_0xc5d0('0x30')],'abandoned':_0x13965a[_0xc5d0('0x31')],'waiting':_0x13965a['waiting'],'loggedInDb':_0x13965a[_0xc5d0('0x32')],'dialActive':_0x13965a['dialActive'],'dialMethod':_0x13965a[_0xc5d0('0x33')],'dialOriginateCallerIdName':_0x13965a[_0xc5d0('0x34')],'dialOriginateCallerIdNumber':_0x13965a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x13965a['dialOriginateTimeout'],'dialPrefix':_0x13965a['dialPrefix'],'outboundAnswerAgiCallsDay':_0x13965a['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x13965a[_0xc5d0('0x35')],'outboundBlacklistCallsDay':_0x13965a[_0xc5d0('0x36')],'outboundBusyCallsDay':_0x13965a[_0xc5d0('0x37')],'outboundCongestionCallsDay':_0x13965a[_0xc5d0('0x38')],'outboundDropCallsDayACS':_0x13965a[_0xc5d0('0x39')],'outboundDropCallsDayCallersExit':_0x13965a[_0xc5d0('0x3a')],'outboundDropCallsDayTimeout':_0x13965a[_0xc5d0('0x3b')],'outboundNoAnswerCallsDay':_0x13965a[_0xc5d0('0x3c')],'outboundNoSuchCallsDay':_0x13965a[_0xc5d0('0x3d')],'outboundOriginateFailureCallsDay':_0x13965a['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x13965a[_0xc5d0('0x3e')],'outboundRejectCallsDay':_0x13965a[_0xc5d0('0x3f')],'outboundUnknownCallsDay':_0x13965a[_0xc5d0('0x40')],'outboundAbandonedCallsDay':_0x13965a['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x13965a[_0xc5d0('0x41')],'predictiveIntervalAvgHoldtime':_0x13965a[_0xc5d0('0x42')],'predictiveIntervalAvgTalktime':_0x13965a[_0xc5d0('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x13965a[_0xc5d0('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x13965a[_0xc5d0('0x45')],'predictiveIntervalErlangCalls':_0x13965a[_0xc5d0('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x13965a[_0xc5d0('0x47')],'predictiveIntervalHitRate':_0x13965a[_0xc5d0('0x48')],'predictiveIntervalMultiplicativeFactor':_0x13965a['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x13965a[_0xc5d0('0x49')],'predictiveIntervalAvailable':_0x13965a[_0xc5d0('0x4a')],'predictiveIntervalTotalCalls':_0x13965a[_0xc5d0('0x4b')],'message':_0x13965a[_0xc5d0('0x4c')],'originated':_0x13965a[_0xc5d0('0x4d')],'erlangCalls':_0x13965a[_0xc5d0('0x4e')],'erlangCallToSecond':_0x13965a['erlangCallToSecond'],'erlangAbandonmentRate':_0x13965a[_0xc5d0('0x4f')],'erlangBusyFactor':_0x13965a[_0xc5d0('0x50')],'startPredictive':_0x13965a['startPredictive'],'startProgressive':_0x13965a[_0xc5d0('0x51')]};if(_0x13965a[_0xc5d0('0x52')]){_0x446887[_0xc5d0('0x52')]={'id':_0x13965a[_0xc5d0('0x52')]['id'],'name':_0x13965a[_0xc5d0('0x52')][_0xc5d0('0x28')],'active':_0x13965a['Trunk'][_0xc5d0('0x53')],'callerid':_0x13965a['Trunk'][_0xc5d0('0x54')]};}if(_0x13965a[_0xc5d0('0x55')]){_0x446887[_0xc5d0('0x55')]={'id':_0x13965a[_0xc5d0('0x55')]['id'],'name':_0x13965a['Interval'][_0xc5d0('0x28')]};}var _0xaa019e=md5(JSON[_0xc5d0('0x56')](_0x446887));if(_0x13965a[_0xc5d0('0x4')]!==_0xaa019e){_0x13965a[_0xc5d0('0x4')]=_0xaa019e;emit(util[_0xc5d0('0x57')](_0xc5d0('0x58'),_0x446887['name']),_0xc5d0('0x59'),_0x446887);}}}function emitVoiceQueueChannelRemove(_0x19c44f){logger[_0xc5d0('0x5a')](_0xc5d0('0x5b'),JSON[_0xc5d0('0x56')](_0x19c44f));emit(util[_0xc5d0('0x57')](_0xc5d0('0x58'),_0x19c44f[_0xc5d0('0x28')]),'voice_queue_channel:remove',_0x19c44f);io['emit']('voice_queue_presence:remove',_0x19c44f);}function notSendMessagesQueue(_0x49ab10){if(_0x49ab10[_0xc5d0('0x5c')]){if(_0x49ab10[_0xc5d0('0x4d')]===0x0&&_0x49ab10[_0xc5d0('0x2b')]===0x0){_0x49ab10['sendMessageOneNotActive']=![];_0x49ab10[_0xc5d0('0x29')]=0x0;_0x49ab10[_0xc5d0('0x5d')]=0x0;_0x49ab10[_0xc5d0('0x4c')]=_0xc5d0('0x5e');ut[_0xc5d0('0x5f')](_0xc5d0('0x60'),_0x49ab10[_0xc5d0('0x28')]+_0xc5d0('0x61'));}else{_0x49ab10[_0xc5d0('0x4c')]=_0xc5d0('0x62');ut[_0xc5d0('0x5f')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x49ab10[_0xc5d0('0x28')]+_0xc5d0('0x63'));}emitCampaignPreview(_0x49ab10);}}Preview[_0xc5d0('0xe')]['loopCampaigns']=function(){var _0x45b66e=this;setInterval(function(){_0x45b66e['syncCampaigns']();},0x7cf);};Preview[_0xc5d0('0xe')]['syncCampaigns']=function(){var _0x1674ab=this[_0xc5d0('0x12')];this[_0xc5d0('0x16')]+=0x1;for(var _0x3b916a in _0x1674ab){if(_0x1674ab['hasOwnProperty'](_0x3b916a)&&(_0x1674ab[_0x3b916a][_0xc5d0('0x33')]===_0xc5d0('0x7')||_0x1674ab[_0x3b916a]['dialMethod']===_0xc5d0('0x64'))&&_0x1674ab[_0x3b916a][_0xc5d0('0x26')]===_0xc5d0('0x27')){if(this[_0xc5d0('0x16')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xc5d0('0x65')]();}}if(_0x1674ab[_0xc5d0('0x66')](_0x3b916a)&&_0x1674ab[_0x3b916a][_0xc5d0('0x33')]===_0xc5d0('0x7')&&_0x1674ab[_0x3b916a][_0xc5d0('0x26')]===_0xc5d0('0x27')){if(_0x1674ab[_0x3b916a][_0xc5d0('0x67')]){this[_0xc5d0('0x68')](_0x1674ab[_0x3b916a]);this['recallMe'](_0x1674ab[_0x3b916a]);}else{notSendMessagesQueue(_0x1674ab[_0x3b916a]);}}}};Preview[_0xc5d0('0xe')]['clearZombieChannel']=function(_0x8c6ff9){var _0x1160bc=this;this['sequence'][_0xc5d0('0x69')](function(){if(!_[_0xc5d0('0x6a')](_0x1160bc[_0xc5d0('0x15')][_0x8c6ff9])){loggerAction['info']('[clearZombieChannels][talking]',_0x8c6ff9,'Queue',_0x1160bc[_0xc5d0('0x15')][_0x8c6ff9][_0xc5d0('0x6b')],_0xc5d0('0x6c'),JSON['stringify'](_0x1160bc[_0xc5d0('0x12')][_0x1160bc[_0xc5d0('0x15')][_0x8c6ff9][_0xc5d0('0x6b')]]['originated']),_0xc5d0('0x6d'),JSON[_0xc5d0('0x56')](_0x1160bc[_0xc5d0('0x12')][_0x1160bc[_0xc5d0('0x15')][_0x8c6ff9]['queue']][_0xc5d0('0x2b')]),JSON[_0xc5d0('0x56')](_0x1160bc[_0xc5d0('0x15')][_0x8c6ff9][_0xc5d0('0x6e')]),JSON[_0xc5d0('0x56')](_[_0xc5d0('0x6f')](_0x1160bc[_0xc5d0('0x15')][_0x8c6ff9],[_0xc5d0('0x70'),_0xc5d0('0x71'),_0xc5d0('0x72'),_0xc5d0('0x73')])));return ami[_0xc5d0('0x74')]({'action':_0xc5d0('0x75'),'channel':_0x1160bc[_0xc5d0('0x15')][_0x8c6ff9][_0xc5d0('0x76')]})[_0xc5d0('0x77')](function(_0x58b255){if(_0x58b255[_0xc5d0('0x4c')]===_0xc5d0('0x78')){setTimeout(function(){if(_0x1160bc[_0xc5d0('0x15')][_0x8c6ff9]){ut[_0xc5d0('0x79')](_0x1160bc[_0xc5d0('0x12')][_0x1160bc[_0xc5d0('0x15')][_0x8c6ff9][_0xc5d0('0x6b')]],'[clearZombieChannel]');if(_0x1160bc['actions'][_0x8c6ff9][_0xc5d0('0x6e')]===!![]){ut[_0xc5d0('0x7a')](_0x1160bc[_0xc5d0('0x12')][_0x1160bc[_0xc5d0('0x15')][_0x8c6ff9][_0xc5d0('0x6b')]],_0xc5d0('0x7b'));ut[_0xc5d0('0x7c')]('[Dialer][checkChannel][pTalking][Preview]'+_0x8c6ff9,_0x1160bc['actions'][_0x8c6ff9][_0xc5d0('0x6b')]);}ut['loggerError'](_0xc5d0('0x7d')+_0x8c6ff9,_0x1160bc['actions'][_0x8c6ff9][_0xc5d0('0x6b')]);delete _0x1160bc[_0xc5d0('0x15')][_0x8c6ff9];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x10907a=this;loggerAction[_0xc5d0('0x5a')](_0xc5d0('0x7e'),_[_0xc5d0('0x7f')](this[_0xc5d0('0x15')]));for(var _0x2ee58f in this['actions']){if(_0x10907a['actions'][_0xc5d0('0x66')](_0x2ee58f)){_0x10907a[_0xc5d0('0x80')](_0x2ee58f);}}};Preview['prototype'][_0xc5d0('0x81')]=function(_0x3c8e81){var _0x20404b=this;rpcDb[_0xc5d0('0x82')](_0x3c8e81['id'],ut[_0xc5d0('0x83')](this[_0xc5d0('0x84')]))[_0xc5d0('0x85')](function(_0x5ab5b5){if(!_[_0xc5d0('0x6a')](_0x5ab5b5)){for(var _0xbbef20=0x0;_0xbbef20<_0x5ab5b5[_0xc5d0('0x86')];_0xbbef20+=0x1){if(ut[_0xc5d0('0x87')](_0x5ab5b5[_0xbbef20]['scheduledat'])<_0x3c8e81[_0xc5d0('0x88')]*0x3c){if(_0x5ab5b5[_0xbbef20][_0xc5d0('0x89')]&&!_0x5ab5b5[_0xbbef20][_0xc5d0('0x89')][_0xc5d0('0x8a')]){_0x20404b[_0xc5d0('0x8b')](_0x5ab5b5[_0xbbef20]['id'])[_0xc5d0('0x85')](ut[_0xc5d0('0x8c')](_0xc5d0('0x8d')))[_0xc5d0('0x77')](ut[_0xc5d0('0x8c')](_0xc5d0('0x8d')));}else{rpcDb[_0xc5d0('0x8e')](_0x5ab5b5[_0xbbef20]['id']);}}else{var _0x2c7655=new Action(_0x5ab5b5[_0xbbef20],_0x3c8e81);_0x2c7655[_0xc5d0('0x8f')]=moment()[_0xc5d0('0x57')](_0xc5d0('0x90'));_0x3c8e81[_0xc5d0('0x3e')]+=0x1;ut[_0xc5d0('0x91')](_0x2c7655,0x17,_0xc5d0('0x92'));if(_0x3c8e81[_0xc5d0('0x93')]){rpcDb[_0xc5d0('0x94')](ut[_0xc5d0('0x95')](_0x5ab5b5[_0xbbef20]));rpcDb[_0xc5d0('0x96')](_0x2c7655,_0xc5d0('0x97'));}else{ut[_0xc5d0('0x91')](_0x2c7655,0x16,'RecallFailedTimeout');rpcDb[_0xc5d0('0x96')](_0x2c7655,_0xc5d0('0x98'));rpcDb[_0xc5d0('0x99')](_0x2c7655,_0xc5d0('0x98'));}}}}})[_0xc5d0('0x77')](ut['logger2']('[getContactRecallMe]'));};Preview[_0xc5d0('0xe')][_0xc5d0('0x68')]=function(_0x3e78d2){_0x3e78d2[_0xc5d0('0x5c')]=!![];if(ut[_0xc5d0('0x9a')](_0x3e78d2[_0xc5d0('0x2a')])){_0x3e78d2[_0xc5d0('0x4c')]=_0xc5d0('0x9b');}else if(!ut[_0xc5d0('0x9c')](_0x3e78d2[_0xc5d0('0x67')])){_0x3e78d2[_0xc5d0('0x4c')]='NOT_ACTIVE';}else if(!this[_0xc5d0('0x9d')](_0x3e78d2[_0xc5d0('0x52')])){if(!this[_0xc5d0('0x9d')](_0x3e78d2['TrunkBackup'])){_0x3e78d2[_0xc5d0('0x4c')]='TRUNK_IS_NOT_REACHABLE';}else{_0x3e78d2['message']='ACTIVE';}}else{_0x3e78d2['message']='ACTIVE';}emitCampaignPreview(_0x3e78d2);};Preview[_0xc5d0('0xe')]['callProgressDetectingCustomer']=function(_0x50ede6,_0x45eea2,_0x3c390c){var _0x502d08=this;var _0x5d27ac=this['actions'][_0x45eea2];var _0x49fe35=this[_0xc5d0('0x12')][_0x5d27ac['queue']];var _0x5c7aa9;if(_0x49fe35){switch(_0x3c390c){case'1':_0x49fe35['outboundNoSuchCallsDay']+=0x1;_0x5d27ac[_0xc5d0('0x9e')]+=0x1;_0x5d27ac[_0xc5d0('0x9f')]=ut['totalGlobal'](_0x5d27ac);ut[_0xc5d0('0x91')](_0x5d27ac,0x0,_0xc5d0('0xa0'));ami[_0xc5d0('0x25')](_0xc5d0('0xa1'),ut[_0xc5d0('0xa2')](_0x5d27ac,_0xc5d0('0xa3')));rpcDb[_0xc5d0('0x96')](_0x5d27ac,_0xc5d0('0xa4'));if(ut[_0xc5d0('0xa5')](_0x5d27ac)>=_0x49fe35[_0xc5d0('0xa6')]){_0x5c7aa9=ut['cloneAction'](_0x5d27ac,0xf,_0xc5d0('0xa7'));rpcDb[_0xc5d0('0x99')](_0x5c7aa9,_0xc5d0('0xa8'));}else{if(_0x5d27ac[_0xc5d0('0x9e')]>=_0x49fe35[_0xc5d0('0xa9')]){rpcDb[_0xc5d0('0x99')](_0x5d27ac,_0xc5d0('0xa8'));}else{rpcDb['rescheduleContact'](ut[_0xc5d0('0xaa')](_0x5d27ac,_0xc5d0('0x9e'),_0x49fe35[_0xc5d0('0xab')]),_0x5d27ac['unlockAgent'],_0x5d27ac[_0xc5d0('0xac')]);}}delete this[_0xc5d0('0x15')][_0x50ede6['linkedid']];break;case _0xc5d0('0xad'):var _0x15c364=moment()[_0xc5d0('0x57')](_0xc5d0('0x90'));_0x5d27ac[_0xc5d0('0xae')]=_0x15c364;_0x5d27ac['answertime']=_0x15c364;_0x5d27ac[_0xc5d0('0x6e')]=!![];_0x49fe35['pTalking']+=0x1;logger['info']('[syncHangup][talking][increment]',_0x5d27ac[_0xc5d0('0xaf')],_0xc5d0('0xb0'),_0x49fe35[_0xc5d0('0x28')],_0xc5d0('0x6d'),_0x49fe35[_0xc5d0('0x2b')]);ami[_0xc5d0('0x25')](_0xc5d0('0xb1'),ut[_0xc5d0('0xa2')](_0x5d27ac,_0xc5d0('0xb2'),this[_0xc5d0('0x12')][_0x5d27ac['queue']]));if(_0x49fe35['acw']){ami[_0xc5d0('0x25')](_0xc5d0('0xb3'),ut[_0xc5d0('0xb4')](_0x5d27ac));}break;case'16':ami['emit'](_0xc5d0('0xb5'),ut[_0xc5d0('0xa2')](_0x5d27ac,_0xc5d0('0xb6'),this[_0xc5d0('0x12')][_0x5d27ac[_0xc5d0('0x6b')]]));emitVoiceQueueChannelRemove(ut[_0xc5d0('0xa2')](_0x5d27ac,'complete'));_0x49fe35['outboundAnswerCallsDay']+=0x1;_0x49fe35[_0xc5d0('0x2f')]+=0x1;_0x49fe35[_0xc5d0('0xb7')]+=0x1;ut['decrementTalkink'](_0x49fe35,'[16]');_0x5d27ac['countglobal']=ut[_0xc5d0('0xa5')](_0x5d27ac);ut[_0xc5d0('0x91')](_0x5d27ac,0x4,'Answer');rpcDb['createCustomerHistory'](_0x5d27ac,_0xc5d0('0xb8'));rpcDb[_0xc5d0('0x99')](_0x5d27ac,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xc5d0('0xb9')](_0x5d27ac);_0x49fe35[_0xc5d0('0x2c')]+=_0x5d27ac['talktime'];_0x49fe35['sumBillable']+=_0x5d27ac[_0xc5d0('0xba')];logger[_0xc5d0('0x5a')](_0xc5d0('0xbb'),_0x5d27ac[_0xc5d0('0xaf')],_0xc5d0('0xb0'),_0x49fe35[_0xc5d0('0x28')],_0xc5d0('0x6d'),_0x49fe35[_0xc5d0('0x2b')]);delete this[_0xc5d0('0x15')][_0x50ede6[_0xc5d0('0xbc')]];break;case _0xc5d0('0xbd'):_0x49fe35[_0xc5d0('0x37')]+=0x1;_0x5d27ac[_0xc5d0('0xbe')]+=0x1;_0x5d27ac[_0xc5d0('0x9f')]=ut[_0xc5d0('0xa5')](_0x5d27ac);ut[_0xc5d0('0x91')](_0x5d27ac,0x5,_0xc5d0('0xbf'));ami[_0xc5d0('0x25')]('custom:agentbusy',ut[_0xc5d0('0xa2')](_0x5d27ac,_0xc5d0('0xc0')));rpcDb[_0xc5d0('0x96')](_0x5d27ac,'[callProgressDetectingCustomer][logBusy]');if(ut['totalGlobal'](_0x5d27ac)>=_0x49fe35['dialGlobalMaxRetry']){_0x5c7aa9=ut[_0xc5d0('0xc1')](_0x5d27ac,0xf,'Global');rpcDb[_0xc5d0('0x99')](_0x5c7aa9,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x5d27ac[_0xc5d0('0xbe')]>=_0x49fe35['dialBusyMaxRetry']){rpcDb[_0xc5d0('0x99')](_0x5d27ac,_0xc5d0('0xc2'));}else{rpcDb['rescheduleContact'](ut[_0xc5d0('0xaa')](_0x5d27ac,'countbusyretry',_0x49fe35[_0xc5d0('0xc3')]),_0x5d27ac[_0xc5d0('0xc4')],_0x5d27ac[_0xc5d0('0xac')]);}}break;case _0xc5d0('0xc5'):_0x49fe35['outboundNoAnswerCallsDay']+=0x1;_0x5d27ac[_0xc5d0('0xc6')]+=0x1;_0x5d27ac['countglobal']=ut[_0xc5d0('0xa5')](_0x5d27ac);ut[_0xc5d0('0x91')](_0x5d27ac,0x3,'NoAnswer');ami[_0xc5d0('0x25')](_0xc5d0('0xc7'),ut[_0xc5d0('0xa2')](_0x5d27ac,_0xc5d0('0xc8')));rpcDb[_0xc5d0('0x96')](_0x5d27ac,_0xc5d0('0xc9'));if(ut[_0xc5d0('0xa5')](_0x5d27ac)>=_0x49fe35[_0xc5d0('0xa6')]){_0x5c7aa9=ut[_0xc5d0('0xc1')](_0x5d27ac,0xf,_0xc5d0('0xa7'));rpcDb[_0xc5d0('0x99')](_0x5c7aa9,_0xc5d0('0xca'));}else{if(_0x5d27ac[_0xc5d0('0xc6')]>=_0x49fe35[_0xc5d0('0xcb')]){rpcDb[_0xc5d0('0x99')](_0x5d27ac,_0xc5d0('0xc9'));}else{rpcDb[_0xc5d0('0xcc')](ut[_0xc5d0('0xaa')](_0x5d27ac,_0xc5d0('0xc6'),_0x49fe35[_0xc5d0('0xcd')]),_0x5d27ac[_0xc5d0('0xc4')],_0x5d27ac[_0xc5d0('0xac')]);}}break;case _0xc5d0('0xce'):_0x49fe35[_0xc5d0('0x38')]+=0x1;_0x5d27ac['countcongestionretry']+=0x1;_0x5d27ac[_0xc5d0('0x9f')]=ut[_0xc5d0('0xa5')](_0x5d27ac);ut[_0xc5d0('0x91')](_0x5d27ac,0x8,_0xc5d0('0xcf'));ami[_0xc5d0('0x25')](_0xc5d0('0xd0'),ut[_0xc5d0('0xa2')](_0x5d27ac,_0xc5d0('0xd1')));rpcDb['createCustomerHistory'](_0x5d27ac,_0xc5d0('0xd2'));if(ut[_0xc5d0('0xa5')](_0x5d27ac)>=_0x49fe35[_0xc5d0('0xa6')]){_0x5c7aa9=ut[_0xc5d0('0xc1')](_0x5d27ac,0xf,_0xc5d0('0xa7'));rpcDb[_0xc5d0('0x99')](_0x5c7aa9,_0xc5d0('0xd3'));}else{if(_0x5d27ac[_0xc5d0('0xd4')]>=_0x49fe35[_0xc5d0('0xd5')]){rpcDb[_0xc5d0('0x99')](_0x5d27ac,_0xc5d0('0xd2'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5d27ac,_0xc5d0('0xd4'),_0x49fe35[_0xc5d0('0xc3')]),_0x5d27ac['unlockAgent'],_0x5d27ac[_0xc5d0('0xac')]);}}break;case _0xc5d0('0xd6'):_0x49fe35[_0xc5d0('0x3f')]+=0x1;_0x5d27ac[_0xc5d0('0xd7')]+=0x1;_0x5d27ac['countglobal']=ut[_0xc5d0('0xa5')](_0x5d27ac);ut[_0xc5d0('0x91')](_0x5d27ac,0x14,_0xc5d0('0xd8'));ami[_0xc5d0('0x25')]('custom:agentreject',ut[_0xc5d0('0xa2')](_0x5d27ac,_0xc5d0('0xd9')));rpcDb['createCustomerHistory'](_0x5d27ac,_0xc5d0('0xda'));if(ut['totalGlobal'](_0x5d27ac)>=_0x49fe35[_0xc5d0('0xa6')]){_0x5c7aa9=ut['cloneAction'](_0x5d27ac,0x14,_0xc5d0('0xd8'));rpcDb[_0xc5d0('0x99')](_0x5c7aa9,_0xc5d0('0xdb'));}else{if(_0x5d27ac[_0xc5d0('0xd7')]>=_0x49fe35['dialAgentRejectMaxRetry']){rpcDb[_0xc5d0('0x99')](_0x5d27ac,_0xc5d0('0xdb'));}else{rpcDb[_0xc5d0('0xcc')](ut[_0xc5d0('0xaa')](_0x5d27ac,'countagentrejectretry',_0x49fe35['dialAgentRejectRetryFrequency']),_0x5d27ac[_0xc5d0('0xc4')],_0x5d27ac[_0xc5d0('0xac')]);}}break;case _0xc5d0('0xdc'):_0x49fe35[_0xc5d0('0xdd')]+=0x1;_0x5d27ac['countabandonedretry']+=0x1;_0x5d27ac['countglobal']=ut[_0xc5d0('0xa5')](_0x5d27ac);ut[_0xc5d0('0x91')](_0x5d27ac,0xb,'Abandoned');rpcDb[_0xc5d0('0x96')](_0x5d27ac,_0xc5d0('0xde'));if(ut[_0xc5d0('0xa5')](_0x5d27ac)>=_0x49fe35[_0xc5d0('0xa6')]){_0x5c7aa9=ut[_0xc5d0('0xc1')](_0x5d27ac,0xf,_0xc5d0('0xa7'));rpcDb[_0xc5d0('0x99')](_0x5c7aa9,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x5d27ac[_0xc5d0('0xdf')]>=_0x49fe35[_0xc5d0('0xe0')]){rpcDb[_0xc5d0('0x99')](_0x5d27ac,_0xc5d0('0xde'));}else{rpcDb[_0xc5d0('0xcc')](ut['scheduledAt'](_0x5d27ac,_0xc5d0('0xe1'),_0x49fe35[_0xc5d0('0xe2')]),_0x5d27ac[_0xc5d0('0xc4')],_0x5d27ac[_0xc5d0('0xac')]);}}break;case'18':_0x49fe35[_0xc5d0('0x40')]+=0x1;_0x5d27ac['countmachineretry']+=0x1;_0x5d27ac['countglobal']=ut['totalGlobal'](_0x5d27ac);ut[_0xc5d0('0x91')](_0x5d27ac,0x12,_0x50ede6[_0xc5d0('0xe3')]||_0x50ede6[_0xc5d0('0xe4')]);ami['emit'](_0xc5d0('0xe5'),ut['buildObj'](_0x5d27ac,_0xc5d0('0xe6')));rpcDb[_0xc5d0('0x96')](_0x5d27ac,_0xc5d0('0xe7'));if(ut[_0xc5d0('0xa5')](_0x5d27ac)>=_0x49fe35[_0xc5d0('0xa6')]){_0x5c7aa9=ut[_0xc5d0('0xc1')](_0x5d27ac,0xf,'Global');rpcDb[_0xc5d0('0x99')](_0x5c7aa9,_0xc5d0('0xe7'));}else{rpcDb[_0xc5d0('0x99')](_0x5d27ac,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0xc5d0('0x15')][_0x50ede6[_0xc5d0('0xbc')]];break;case'19':_0x49fe35[_0xc5d0('0x40')]+=0x1;_0x5d27ac['countglobal']=ut[_0xc5d0('0xa5')](_0x5d27ac);ut['logCustomer'](_0x5d27ac,0x13,_0x50ede6['cause-txt']||_0x50ede6[_0xc5d0('0xe4')]);ami[_0xc5d0('0x25')](_0xc5d0('0xe5'),ut[_0xc5d0('0xa2')](_0x5d27ac,_0xc5d0('0xe6')));rpcDb['createCustomerHistory'](_0x5d27ac,_0xc5d0('0xe8'));if(ut['totalGlobal'](_0x5d27ac)>=_0x49fe35['dialGlobalMaxRetry']){_0x5c7aa9=ut['cloneAction'](_0x5d27ac,0xf,_0xc5d0('0xa7'));rpcDb[_0xc5d0('0x99')](_0x5c7aa9,_0xc5d0('0xe8'));}else{rpcDb['createCustomerFinal'](_0x5d27ac,_0xc5d0('0xe8'));}delete this[_0xc5d0('0x15')][_0x50ede6[_0xc5d0('0xbc')]];break;default:if(_0x5d27ac[_0xc5d0('0x6e')]){ut['decrementTalkink'](_0x49fe35,_0xc5d0('0xe9'));ut[_0xc5d0('0x7c')](_0xc5d0('0xea')+_0x49fe35['name'],_0x50ede6);}_0x49fe35[_0xc5d0('0x40')]+=0x1;_0x5d27ac[_0xc5d0('0x9f')]=ut[_0xc5d0('0xa5')](_0x5d27ac);ut[_0xc5d0('0x91')](_0x5d27ac,0xc,_0x50ede6['cause-txt']||_0x50ede6[_0xc5d0('0xe4')]);rpcDb[_0xc5d0('0x96')](_0x5d27ac,_0xc5d0('0xeb'));if(ut[_0xc5d0('0xa5')](_0x5d27ac)>=_0x49fe35['dialGlobalMaxRetry']){_0x5c7aa9=ut['cloneAction'](_0x5d27ac,0xf,_0xc5d0('0xa7'));rpcDb[_0xc5d0('0x99')](_0x5c7aa9,_0xc5d0('0xec'));}else{rpcDb[_0xc5d0('0x99')](_0x5d27ac,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xc5d0('0x15')][_0x50ede6[_0xc5d0('0xbc')]];}if(!(_0x5d27ac[_0xc5d0('0x6e')]&&_0x3c390c==='16')){ut['updateOriginated'](_0x49fe35,'[callProgressDetectingCustomer]');logger[_0xc5d0('0x5a')](_0xc5d0('0xed'),_0x5d27ac[_0xc5d0('0xaf')],_0xc5d0('0xb0'),_0x49fe35[_0xc5d0('0x28')],_0xc5d0('0x6c'),_0x49fe35[_0xc5d0('0x4d')]);}if(_0x3c390c!==_0xc5d0('0xad')){delete this[_0xc5d0('0x15')][_0x50ede6[_0xc5d0('0xbc')]];delete this[_0xc5d0('0x15')][_0x50ede6[_0xc5d0('0xee')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x515222,_0x4ba1b1,_0x2a3b67){if(_[_0xc5d0('0xef')](_0x4ba1b1)&&_0xc5d0('0xf0')!==typeof _0x4ba1b1){return;}if(_[_0xc5d0('0xef')](_0x2a3b67)&&'object'!==typeof _0x2a3b67){return;}switch(_0x2a3b67[_0xc5d0('0xf1')]){case'0':ut['logAgent'](_0x515222,0x0,'NoSuchNumber');rpcDb[_0xc5d0('0xf2')](_0x515222,_0xc5d0('0xf3'));break;case'3':ut[_0xc5d0('0xf4')](_0x515222,0x3,_0xc5d0('0xf5'));rpcDb[_0xc5d0('0xf2')](_0x515222,_0xc5d0('0xf6'));break;case'5':ut[_0xc5d0('0xf4')](_0x515222,0x5,'Busy');rpcDb['createAgentHistory'](_0x515222,_0xc5d0('0xf7'));break;case'8':ut['logAgent'](_0x515222,0x8,'Congestion');rpcDb[_0xc5d0('0xf2')](_0x515222,_0xc5d0('0xf8'));break;case'22':ut[_0xc5d0('0xf4')](_0x515222,0x16,_0xc5d0('0xf9'));rpcDb['createAgentHistory'](_0x515222,_0xc5d0('0xfa'));break;default:ut['logAgent'](_0x515222,0xc,_0x2a3b67[_0xc5d0('0xf1')]);rpcDb['createAgentHistory'](_0x515222,_0xc5d0('0xf8'));}ut['updateOriginated'](_0x4ba1b1,_0xc5d0('0xfb'));logger[_0xc5d0('0x5a')]('[originated][decrement][callProgressDetectingAgent]',_0x515222[_0xc5d0('0xaf')],_0xc5d0('0xb0'),_0x4ba1b1[_0xc5d0('0x28')],'originated:\x20',_0x4ba1b1[_0xc5d0('0x4d')]);delete this[_0xc5d0('0x15')][_0x515222[_0xc5d0('0xaf')]];};Preview[_0xc5d0('0xe')][_0xc5d0('0xfc')]=function(_0x3c2b41,_0x28b783,_0x132919,_0xb38c77,_0x79d3e){var _0x3cdbef=this;return new BPromise(function(_0x35c51e,_0x47313c){if(_[_0xc5d0('0x6a')](_0x28b783)||_[_0xc5d0('0x6a')](_0x28b783[_0xc5d0('0xfd')])||_[_0xc5d0('0x6a')](_0x28b783['Contact']['phone'])||_[_0xc5d0('0x6a')](_0x28b783[_0xc5d0('0x72')])){_0x47313c(ut[_0xc5d0('0x4c')](_0xc5d0('0xfe'),_0xb38c77,_0x79d3e));return;}var _0x2a9848=uuid['v4']();var _0x557cdd=_0x3cdbef[_0xc5d0('0x12')][_0x28b783[_0xc5d0('0xff')][_0xc5d0('0x28')]];var _0x561cf4=_0x132919?_0x3cdbef[_0xc5d0('0x84')][_0x132919]['id']:undefined;_0x3cdbef[_0xc5d0('0x15')][_0x2a9848]=new Action(_0x28b783,_0x557cdd,_0x2a9848,_0x132919,_0x561cf4);var _0x32df44=_0x3cdbef[_0xc5d0('0x15')][_0x2a9848];_0x32df44[_0xc5d0('0xc4')]=_0xb38c77;_0x32df44['activeContact']=_0x79d3e;_0x32df44[_0xc5d0('0x100')]=_0x132919;if(_[_0xc5d0('0x101')](_0x3c2b41)){_0x3cdbef[_0xc5d0('0x102')](_0x32df44,_0x557cdd,_0x28b783,_0x132919)[_0xc5d0('0x85')](function(_0x1cac61){logger[_0xc5d0('0x5a')](_0xc5d0('0x103'),_0xc5d0('0x104')+_0x32df44[_0xc5d0('0x6b')]+'\x20IdHopper:\x20'+_0x32df44[_0xc5d0('0x105')],JSON[_0xc5d0('0x56')](_0x1cac61));ami['emit']('custom:agentcalled',ut[_0xc5d0('0xa2')](_0x32df44,'called',_0x3cdbef[_0xc5d0('0x12')][_0x32df44['queue']]));_0x35c51e(ut['message']('Calling'));})[_0xc5d0('0x77')](function(_0x4bf136){ut[_0xc5d0('0x5f')](_0xc5d0('0x106'),_0x4bf136);_0x47313c(ut[_0xc5d0('0x4c')]('Call\x20failed',_0xb38c77,_0x79d3e));});}else{_0x557cdd[_0xc5d0('0x36')]+=0x1;ut['logBlacklist'](_0x32df44);rpcDb['createHistory'](_0x32df44,_0xc5d0('0x107'));delete _0x3cdbef[_0xc5d0('0x15')][_0x2a9848];_0x47313c(ut['message'](_0xc5d0('0x108'),_0xb38c77,_0x79d3e));}});};Preview[_0xc5d0('0xe')][_0xc5d0('0x9d')]=function(_0x2931e1){return!_[_0xc5d0('0x6a')](_0x2931e1)&&!_[_0xc5d0('0x6a')](_0x2931e1[_0xc5d0('0x28')])&&!_[_0xc5d0('0x6a')](_0x2931e1[_0xc5d0('0x53')])&&_0x2931e1[_0xc5d0('0x53')]&&!_['isNil'](this[_0xc5d0('0x14')][util['format'](_0xc5d0('0x109'),_0x2931e1['name'])])&&!_['isNil'](this['trunks'][util[_0xc5d0('0x57')](_0xc5d0('0x109'),_0x2931e1[_0xc5d0('0x28')])][_0xc5d0('0x75')])&&(this[_0xc5d0('0x14')][util[_0xc5d0('0x57')](_0xc5d0('0x109'),_0x2931e1[_0xc5d0('0x28')])]['status']==='reachable'||this[_0xc5d0('0x14')][util['format'](_0xc5d0('0x109'),_0x2931e1[_0xc5d0('0x28')])][_0xc5d0('0x75')]==='unmonitored');};Preview[_0xc5d0('0xe')][_0xc5d0('0x8b')]=function(_0x54622e,_0x369f95){var _0x73c3a3=this;return new BPromise(function(_0x50c948,_0x30be79){_0x73c3a3['execRun'](_0x54622e,_0x369f95)[_0xc5d0('0x85')](function(_0x3b37f5){_0x50c948(_[_0xc5d0('0x6f')](_0x3b37f5,[_0xc5d0('0x4c')]));})['catch'](function(_0xb92813){if(_0xb92813[_0xc5d0('0x10a')]){rpcDb[_0xc5d0('0x10b')](_0x54622e);}if(_0xb92813[_0xc5d0('0x53')]){rpcDb[_0xc5d0('0x8e')](_0x54622e);}_0x30be79(_['pick'](_0xb92813,[_0xc5d0('0x4c')]));});});};Preview[_0xc5d0('0xe')][_0xc5d0('0x10c')]=function(_0x2e6b2b,_0x2a1a32){var _0x25556f=this;return new BPromise(function(_0x43af63,_0x31c2dc){var _0x2c2dc6,_0x2f3aa4;rpcDb[_0xc5d0('0x10d')](_0x2e6b2b)[_0xc5d0('0x85')](function(_0x5c7194){if(!_[_0xc5d0('0x6a')](_0x5c7194[0x0])){_0x2f3aa4=_0x5c7194[0x0][_0xc5d0('0x10e')]?![]:!![];_0x2c2dc6=_0x5c7194[0x0][_0xc5d0('0x10e')]?!![]:![];_0x2c2dc6=_0x2a1a32?!![]:_0x2c2dc6;}var _0x21ae2c=_0x25556f[_0xc5d0('0x10f')](_0x5c7194);if(_0x21ae2c[_0xc5d0('0x110')]){rpcDb['checkIsBlackList'](_[_0xc5d0('0x6f')](_0x5c7194[0x0],[_0xc5d0('0x72'),_0xc5d0('0x111')]))[_0xc5d0('0x85')](function(_0x11e9ae){_0x25556f[_0xc5d0('0xfc')](_0x11e9ae,_0x5c7194[0x0],_0x2a1a32,_0x2f3aa4,_0x2c2dc6)[_0xc5d0('0x85')](function(_0x2d7019){_0x43af63(_0x2d7019);})[_0xc5d0('0x77')](function(_0x8f9c48){_0x31c2dc(_0x8f9c48);});})[_0xc5d0('0x77')](function(_0x2f149c){ut['logger'](_0xc5d0('0x112'),_0x2f149c);_0x31c2dc(ut[_0xc5d0('0x4c')](_0xc5d0('0x113'),_0x2f3aa4,_0x2c2dc6));});}else{_0x31c2dc(ut[_0xc5d0('0x4c')](_0x21ae2c[_0xc5d0('0x4c')],_0x2f3aa4,_0x2c2dc6));}})[_0xc5d0('0x77')](function(_0xc416b8){ut[_0xc5d0('0x5f')](_0xc5d0('0x114'),_0xc416b8);_0x31c2dc(ut['message'](_0xc5d0('0x113'),![],!![]));});});};Preview[_0xc5d0('0xe')]['validateContact']=function(_0x11e346){if(_[_0xc5d0('0x6a')](_0x11e346)||_[_0xc5d0('0x101')](_0x11e346)||!_[_0xc5d0('0x6a')](_0x11e346[0x0][_0xc5d0('0x89')])&&_[_0xc5d0('0x6a')](_0x11e346[0x0][_0xc5d0('0x89')]['name'])){ut[_0xc5d0('0x5f')](_0xc5d0('0x115'),_0x11e346);return{'isValid':![],'message':_0xc5d0('0x116')};}var _0x1ca06a=this[_0xc5d0('0x12')][_0x11e346[0x0]['Queue'][_0xc5d0('0x28')]];_0x1ca06a[_0xc5d0('0x4c')]=_0xc5d0('0x117');if(_[_0xc5d0('0x6a')](_0x1ca06a)){ut[_0xc5d0('0x5f')](_0xc5d0('0x118'),_0x1ca06a);return{'isValid':![],'message':_0xc5d0('0x119')};}if(!this[_0xc5d0('0x9d')](_0x1ca06a[_0xc5d0('0x52')])){ut[_0xc5d0('0x5f')](_0xc5d0('0x11a'),_0xc5d0('0x11b')+_0x1ca06a['name']+_0xc5d0('0x11c'));if(!this['isTrunkReachable'](_0x1ca06a[_0xc5d0('0x11d')])){ut[_0xc5d0('0x5f')](_0xc5d0('0x11a'),_0x1ca06a[_0xc5d0('0x28')]+_0xc5d0('0x11e'));return{'isValid':![],'message':_0xc5d0('0x11f')};}}if(!ut[_0xc5d0('0x9c')](_0x1ca06a[_0xc5d0('0x67')])){ut['logger'](_0xc5d0('0x120'),_0x1ca06a[_0xc5d0('0x28')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xc5d0('0x11b')+_0x1ca06a[_0xc5d0('0x28')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xc5d0('0x121')};};Preview['prototype']['execCall']=function(_0x295582,_0x4d3337,_0x3f6e01,_0x49ee59){var _0x498378=this;return new BPromise(function(_0x372acb,_0x36f337){var _0x747f02=_0x295582[_0xc5d0('0xaf')];var _0x5d5f94=_0x498378[_0xc5d0('0x9d')](_0x4d3337['Trunk'])?util[_0xc5d0('0x57')](_0xc5d0('0x122'),_0x4d3337[_0xc5d0('0x52')][_0xc5d0('0x28')],_[_0xc5d0('0x6a')](_0x4d3337[_0xc5d0('0x123')])?'':_0x4d3337[_0xc5d0('0x123')][_0xc5d0('0x124')]()||'',_0x4d3337[_0xc5d0('0x125')]>0x0?_0x3f6e01[_0xc5d0('0xfd')][_0xc5d0('0x126')]['substring'](_0x4d3337[_0xc5d0('0x125')]):_0x3f6e01['Contact'][_0xc5d0('0x126')]):util['format'](_0xc5d0('0x122'),_[_0xc5d0('0x6a')](_0x4d3337[_0xc5d0('0x11d')])?_0x4d3337[_0xc5d0('0x52')][_0xc5d0('0x28')]:_0x4d3337[_0xc5d0('0x11d')][_0xc5d0('0x28')],_[_0xc5d0('0x6a')](_0x4d3337['dialPrefix'])?'':_0x4d3337[_0xc5d0('0x123')]['trim']()||'',_0x4d3337[_0xc5d0('0x125')]>0x0?_0x3f6e01[_0xc5d0('0xfd')][_0xc5d0('0x126')][_0xc5d0('0x127')](_0x4d3337[_0xc5d0('0x125')]):_0x3f6e01['Contact'][_0xc5d0('0x126')]);var _0x481b75=_0x498378[_0xc5d0('0x9d')](_0x4d3337[_0xc5d0('0x52')])?ut[_0xc5d0('0x128')](_0x4d3337[_0xc5d0('0x52')][_0xc5d0('0x54')],_0x4d3337[_0xc5d0('0x34')],_0x4d3337[_0xc5d0('0x129')]>0x0?ut[_0xc5d0('0x12a')](_0x4d3337[_0xc5d0('0x12b')],_0x4d3337[_0xc5d0('0x129')]):_0x4d3337[_0xc5d0('0x12b')]):ut[_0xc5d0('0x128')](_[_0xc5d0('0x6a')](_0x4d3337[_0xc5d0('0x11d')])?_0x4d3337[_0xc5d0('0x52')][_0xc5d0('0x54')]:_0x4d3337['TrunkBackup']['callerid'],_0x4d3337[_0xc5d0('0x34')],_0x4d3337[_0xc5d0('0x129')]>0x0?ut[_0xc5d0('0x12a')](_0x4d3337[_0xc5d0('0x12b')],_0x4d3337[_0xc5d0('0x129')]):_0x4d3337['dialOriginateCallerIdNumber']);if(_0x481b75){_0x295582[_0xc5d0('0x12c')]=ut[_0xc5d0('0x12d')](_0x481b75);_0x295582[_0xc5d0('0x12e')]=ut[_0xc5d0('0x12f')](_0x481b75);}var _0x524397=ut[_0xc5d0('0x130')](_0x4d3337,_0x3f6e01,_0x5d5f94,_0x481b75,_0x747f02,_0x295582);_[_0xc5d0('0x131')](_0x295582,ut[_0xc5d0('0x132')](_0x524397));_0x295582[_0xc5d0('0x8f')]=moment()[_0xc5d0('0x57')](_0xc5d0('0x90'));ami[_0xc5d0('0x74')](ut[_0xc5d0('0x133')](_0x295582,_0x4d3337,_0x524397,_0x295582[_0xc5d0('0xac')],_0x49ee59))[_0xc5d0('0x85')](function(_0x487764){_0x4d3337[_0xc5d0('0x4d')]+=0x1;logger[_0xc5d0('0x5a')](_0xc5d0('0x134'),_0x747f02,_0xc5d0('0xb0'),_0x4d3337['name'],_0xc5d0('0x6c'),_0x4d3337[_0xc5d0('0x4d')]);_0x372acb(_0x487764);})[_0xc5d0('0x77')](function(_0x34f620){ut[_0xc5d0('0xf4')](_0x295582,0xe,_0xc5d0('0x135'));rpcDb['createAgentHistory'](_0x295582,_0xc5d0('0x136'));_0x36f337(_0x34f620);});});};Preview[_0xc5d0('0xe')][_0xc5d0('0x137')]=function(_0x184f26){if(this['actions'][_0x184f26[_0xc5d0('0xbc')]]){this[_0xc5d0('0x15')][_0x184f26[_0xc5d0('0xbc')]][_0xc5d0('0x76')]=_0x184f26['channel'];}};Preview[_0xc5d0('0xe')][_0xc5d0('0x138')]=function(_0xa15f37){var _0x439873=this;var _0x4906a9=this[_0xc5d0('0x15')][_0xa15f37['actionid']];if(_0x4906a9){if(_0x4906a9['lookAgent']&&this[_0xc5d0('0x84')][_0x4906a9[_0xc5d0('0x100')]]){ut[_0xc5d0('0x139')](_0x4906a9,this[_0xc5d0('0x84')][_0x4906a9['lookAgent']][_0xc5d0('0x28')],this[_0xc5d0('0x84')][_0x4906a9[_0xc5d0('0x100')]]['id']);}var _0x5b74bf=_['clone'](_0x4906a9);_0x5b74bf[_0xc5d0('0xae')]=moment()['format'](_0xc5d0('0x90'));var _0x3ee11d=_0x439873[_0xc5d0('0x12')][_0x4906a9[_0xc5d0('0x6b')]];if(ut['isFailure'](_0xa15f37[_0xc5d0('0x13a')])){if(_0x4906a9[_0xc5d0('0xc4')]){rpcDb['unlockContact'](_0x4906a9[_0xc5d0('0x105')]);}if(_0x4906a9[_0xc5d0('0xac')]){rpcDb[_0xc5d0('0x8e')](_0x4906a9[_0xc5d0('0x105')]);}ami['emit'](_0xc5d0('0x13b'),ut[_0xc5d0('0xa2')](_0x4906a9,'rejected',this['campaignsPreview'][_0x4906a9['queue']]));this[_0xc5d0('0x13c')](_0x5b74bf,_0x3ee11d,_0xa15f37);}else{_0x4906a9[_0xc5d0('0x8f')]=moment()['format'](_0xc5d0('0x90'));ut['logAgent'](_0x5b74bf,0x4,'Answer');rpcDb[_0xc5d0('0xf2')](_0x5b74bf,_0xc5d0('0x13d'));}}};Preview['prototype'][_0xc5d0('0x19')]=function(_0x413f86){var _0x35b2e2=this;var _0x1032a6=this['actions'][_0x413f86['linkedid']];var _0xb4f909;if(_0x1032a6){_0xb4f909=this['campaignsPreview'][_0x1032a6[_0xc5d0('0x6b')]];logger['info'](_0xc5d0('0x13e'),_0x413f86[_0xc5d0('0xbc')],_0xc5d0('0xb0'),_0xb4f909['name'],_0xc5d0('0x6d'),_0xb4f909[_0xc5d0('0x2b')]);}if(this['actions'][_0x413f86[_0xc5d0('0xbc')]]&&_0x413f86[_0xc5d0('0xbc')]!==_0x413f86[_0xc5d0('0xaf')]){if(_0x413f86[_0xc5d0('0x13f')]==='16'&&this[_0xc5d0('0x15')][_0x413f86[_0xc5d0('0xbc')]][_0xc5d0('0x6e')]){this[_0xc5d0('0x140')](_0x413f86,_0x413f86[_0xc5d0('0xbc')],_0x413f86[_0xc5d0('0x13f')]);}else if(this[_0xc5d0('0x15')][_0x413f86['linkedid']][_0xc5d0('0x6e')]){logger['info'](_0xc5d0('0x141'),_0x413f86[_0xc5d0('0xbc')],_0x413f86['cause'],_0xc5d0('0xb0'),_0xb4f909[_0xc5d0('0x28')],_0xc5d0('0x6d'),_0xb4f909[_0xc5d0('0x2b')]);this[_0xc5d0('0x140')](_0x413f86,_0x413f86[_0xc5d0('0xbc')],_0x413f86[_0xc5d0('0x13f')]);}}else if(_0x1032a6&&_['isNil'](_0x1032a6[_0xc5d0('0x142')])&&_0xb4f909[_0xc5d0('0x143')]&&_0x413f86[_0xc5d0('0xbc')]===_0x413f86[_0xc5d0('0xaf')]&&_[_0xc5d0('0x6a')](_0x413f86[_0xc5d0('0xf1')])&&_0x413f86[_0xc5d0('0x13f')]==='16'&&_0x413f86[_0xc5d0('0x144')]==='6'&&_[_0xc5d0('0xef')](_0x1032a6[_0xc5d0('0x145')])){if(_0x1032a6[_0xc5d0('0xc4')]){rpcDb[_0xc5d0('0x10b')](_0x1032a6[_0xc5d0('0x105')]);}if(_0x1032a6[_0xc5d0('0xac')]){rpcDb[_0xc5d0('0x8e')](_0x1032a6[_0xc5d0('0x105')]);}_0x413f86[_0xc5d0('0xf1')]='22';this['callProgressDetectingAgent'](_0x1032a6,_0xb4f909,_0x413f86);}else if(_0x1032a6&&_0x1032a6[_0xc5d0('0x145')]){if(_0x413f86[_0xc5d0('0x13f')]==='16'&&this[_0xc5d0('0x15')][_0x413f86['linkedid']][_0xc5d0('0x6e')]){logger[_0xc5d0('0x5a')](_0xc5d0('0x146'),_0x413f86['linkedid'],_0x413f86[_0xc5d0('0x13f')],'\x20Queue',_0xb4f909[_0xc5d0('0x28')],'pTalking:\x20',_0xb4f909[_0xc5d0('0x2b')]);this[_0xc5d0('0x140')](_0x413f86,_0x413f86[_0xc5d0('0xbc')],_0x413f86[_0xc5d0('0x13f')]);}else if(this['actions'][_0x413f86[_0xc5d0('0xbc')]][_0xc5d0('0x6e')]){logger[_0xc5d0('0x5a')](_0xc5d0('0x141'),_0x413f86[_0xc5d0('0xbc')],_0x413f86[_0xc5d0('0x13f')],_0xc5d0('0xb0'),_0xb4f909[_0xc5d0('0x28')],_0xc5d0('0x6d'),_0xb4f909[_0xc5d0('0x2b')]);this[_0xc5d0('0x140')](_0x413f86,_0x413f86[_0xc5d0('0xbc')],_0x413f86['cause']);}}};Preview[_0xc5d0('0xe')][_0xc5d0('0x1d')]=function(_0x2f4f46){if(this[_0xc5d0('0x15')][_0x2f4f46[_0xc5d0('0xee')]]&&_0x2f4f46[_0xc5d0('0xee')]!==_0x2f4f46[_0xc5d0('0x147')]){this['callProgressDetectingCustomer'](_0x2f4f46,_0x2f4f46[_0xc5d0('0xee')],_0x2f4f46[_0xc5d0('0xe4')]);}};Preview[_0xc5d0('0xe')][_0xc5d0('0x1b')]=function(_0x38800b){if(this[_0xc5d0('0x15')][_0x38800b['linkedid']]&&_0x38800b['linkedid']!==_0x38800b[_0xc5d0('0xaf')]&&!this[_0xc5d0('0x15')][_0x38800b[_0xc5d0('0xbc')]]['dialAnswer']){if(_0x38800b[_0xc5d0('0x13f')]==='1'){this[_0xc5d0('0x140')](_0x38800b,_0x38800b[_0xc5d0('0xbc')],_0x38800b[_0xc5d0('0x13f')]);}}};Preview[_0xc5d0('0xe')][_0xc5d0('0x148')]=function(_0x1a4ad2,_0x4a7c0c,_0x1ca760){if(this[_0xc5d0('0x15')][_0x1a4ad2]){if(_[_0xc5d0('0x6a')](this[_0xc5d0('0x15')][_0x1a4ad2][_0xc5d0('0x149')])){this[_0xc5d0('0x15')][_0x1a4ad2][_0xc5d0('0x149')]={};}this[_0xc5d0('0x15')][_0x1a4ad2][_0xc5d0('0x149')][_0x4a7c0c]=_0x1ca760;}};Preview[_0xc5d0('0xe')]['syncVarSet']=function(_0x119065){try{if(!_[_0xc5d0('0x6a')](_0x119065)){if(ut[_0xc5d0('0x14a')](_[_0xc5d0('0x14b')](_0x119065['variable'])[0x0])){this['addVariable'](_0x119065['uniqueid'],_[_0xc5d0('0x14b')](_0x119065[_0xc5d0('0x14c')])[0x0],_0x119065[_0xc5d0('0x14d')]);}}}catch(_0x3afc15){logger['error'](_0xc5d0('0x14e'),util[_0xc5d0('0x14f')](_0x3afc15,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xc5d0('0x21')]=function(_0x53c234){if(_0x53c234){if(this[_0xc5d0('0x15')][_0x53c234[_0xc5d0('0x150')]]){this[_0xc5d0('0x15')][_0x53c234['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0xc5d0('0xe')][_0xc5d0('0x23')]=function(_0x518df6){if(_0x518df6){if(this[_0xc5d0('0x15')][_0x518df6['transfererlinkedid']]){this[_0xc5d0('0x15')][_0x518df6[_0xc5d0('0x151')]][_0xc5d0('0x145')]=!![];}}};module[_0xc5d0('0x152')]=Preview; \ No newline at end of file +var _0x021f=['destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','unmonitored','execRun','unlock','unlockContact','pick','recallme','validateContact','isValid','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','trim','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','Action','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','lookAgent','logLookAgent','clone','isFailure','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','variables','filterKey','keys','addVariable','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','waiting','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','Trunk','callerid','Interval','md5','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','ListId','status','channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','then','logger2','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','logCustomer','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','buildAcw','custom:agentcomplete','complete','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','rescheduleContact','unlockAgent','activeContact','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x021f,0x1b5));var _0xf021=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x021f[_0x40220a];return _0x3903cc;};'use strict';var util=require(_0xf021('0x0'));var _=require('lodash');var BPromise=require(_0xf021('0x1'));var uuid=require(_0xf021('0x2'));var moment=require(_0xf021('0x3'));var md5=require('md5');var Redis=require(_0xf021('0x4'));var config=require(_0xf021('0x5'));var logger=require(_0xf021('0x6'))(_0xf021('0x7'));var loggerAction=require(_0xf021('0x6'))(_0xf021('0x8'));var ami=require(_0xf021('0x9'));var rpcDb=require(_0xf021('0xa'));var Action=require(_0xf021('0xb'));var ut=require(_0xf021('0xc'));config[_0xf021('0xd')]=_['defaults'](config['redis'],{'host':_0xf021('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf021('0xd')]));var Sequence=function(){};Sequence[_0xf021('0xf')][_0xf021('0x10')]=function(_0x2aa2c6){this['tail']=this[_0xf021('0x11')]?this['tail'][_0xf021('0x12')](_0x2aa2c6):_0x2aa2c6();};function Preview(_0x18c3e6){this[_0xf021('0x13')]=new Sequence();this[_0xf021('0x14')]=_0x18c3e6[_0xf021('0x15')];this['trunks']=_0x18c3e6[_0xf021('0x16')];this[_0xf021('0x17')]={};this[_0xf021('0x18')]=_0x18c3e6[_0xf021('0x18')];this[_0xf021('0x19')]=0x0;ami['on'](_0xf021('0x1a'),this[_0xf021('0x1b')][_0xf021('0x1c')](this));ami['on'](_0xf021('0x1d'),this[_0xf021('0x1e')][_0xf021('0x1c')](this));ami['on'](_0xf021('0x1f'),this[_0xf021('0x20')][_0xf021('0x1c')](this));ami['on']('dialend',this[_0xf021('0x21')][_0xf021('0x1c')](this));ami['on'](_0xf021('0x22'),this[_0xf021('0x23')][_0xf021('0x1c')](this));ami['on'](_0xf021('0x24'),this[_0xf021('0x25')][_0xf021('0x1c')](this));ami['on'](_0xf021('0x26'),this[_0xf021('0x27')][_0xf021('0x1c')](this));ami['on'](_0xf021('0x28'),this[_0xf021('0x29')]['bind'](this));this['loopCampaigns'](this[_0xf021('0x14')]);}function emit(_0x33d616,_0x509ae7,_0x524f2e){io['to'](_0x33d616)[_0xf021('0x2a')](_0x509ae7,_0x524f2e);}function emitCampaignPreview(_0x4158e2){if(_0x4158e2[_0xf021('0x2b')]===_0xf021('0x2c')){var _0xa0a250={'id':_0x4158e2['id'],'name':_0x4158e2[_0xf021('0x2d')],'strategy':_0x4158e2[_0xf021('0x2e')],'answered':_0x4158e2[_0xf021('0x2f')],'available':_0x4158e2[_0xf021('0x30')],'loggedIn':_0x4158e2[_0xf021('0x31')],'pTalking':_0x4158e2[_0xf021('0x32')],'sumBillable':_0x4158e2[_0xf021('0x33')],'sumDuration':_0x4158e2[_0xf021('0x34')],'sumHoldTime':_0x4158e2[_0xf021('0x35')]||0x0,'talking':_0x4158e2[_0xf021('0x36')],'total':_0x4158e2['total'],'type':_0x4158e2[_0xf021('0x2b')],'unmanaged':_0x4158e2[_0xf021('0x37')],'abandoned':_0x4158e2['abandoned'],'waiting':_0x4158e2[_0xf021('0x38')],'loggedInDb':_0x4158e2['loggedInDb'],'dialActive':_0x4158e2[_0xf021('0x39')],'dialMethod':_0x4158e2['dialMethod'],'dialOriginateCallerIdName':_0x4158e2[_0xf021('0x3a')],'dialOriginateCallerIdNumber':_0x4158e2[_0xf021('0x3b')],'dialOriginateTimeout':_0x4158e2[_0xf021('0x3c')],'dialPrefix':_0x4158e2[_0xf021('0x3d')],'outboundAnswerAgiCallsDay':_0x4158e2[_0xf021('0x3e')],'outboundAnswerCallsDay':_0x4158e2[_0xf021('0x3f')],'outboundBlacklistCallsDay':_0x4158e2[_0xf021('0x40')],'outboundBusyCallsDay':_0x4158e2['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4158e2[_0xf021('0x41')],'outboundDropCallsDayACS':_0x4158e2[_0xf021('0x42')],'outboundDropCallsDayCallersExit':_0x4158e2[_0xf021('0x43')],'outboundDropCallsDayTimeout':_0x4158e2['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x4158e2[_0xf021('0x44')],'outboundNoSuchCallsDay':_0x4158e2[_0xf021('0x45')],'outboundOriginateFailureCallsDay':_0x4158e2['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4158e2['outboundReCallsDay'],'outboundRejectCallsDay':_0x4158e2[_0xf021('0x46')],'outboundUnknownCallsDay':_0x4158e2[_0xf021('0x47')],'outboundAbandonedCallsDay':_0x4158e2[_0xf021('0x48')],'predictiveIntervalAnsweredCalls':_0x4158e2[_0xf021('0x49')],'predictiveIntervalAvgHoldtime':_0x4158e2[_0xf021('0x4a')],'predictiveIntervalAvgTalktime':_0x4158e2[_0xf021('0x4b')],'predictiveIntervalDroppedCallsCallersExit':_0x4158e2['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4158e2[_0xf021('0x4c')],'predictiveIntervalErlangCalls':_0x4158e2[_0xf021('0x4d')],'predictiveIntervalErlangCallsDroppedCalls':_0x4158e2[_0xf021('0x4e')],'predictiveIntervalHitRate':_0x4158e2[_0xf021('0x4f')],'predictiveIntervalMultiplicativeFactor':_0x4158e2[_0xf021('0x50')],'predictiveIntervalPauses':_0x4158e2[_0xf021('0x51')],'predictiveIntervalAvailable':_0x4158e2['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4158e2[_0xf021('0x52')],'message':_0x4158e2[_0xf021('0x53')],'originated':_0x4158e2[_0xf021('0x54')],'erlangCalls':_0x4158e2['erlangCalls'],'erlangCallToSecond':_0x4158e2[_0xf021('0x55')],'erlangAbandonmentRate':_0x4158e2['erlangAbandonmentRate'],'erlangBusyFactor':_0x4158e2['erlangBusyFactor'],'startPredictive':_0x4158e2['startPredictive'],'startProgressive':_0x4158e2['startProgressive']};if(_0x4158e2[_0xf021('0x56')]){_0xa0a250[_0xf021('0x56')]={'id':_0x4158e2[_0xf021('0x56')]['id'],'name':_0x4158e2[_0xf021('0x56')][_0xf021('0x2d')],'active':_0x4158e2['Trunk']['active'],'callerid':_0x4158e2[_0xf021('0x56')][_0xf021('0x57')]};}if(_0x4158e2[_0xf021('0x58')]){_0xa0a250[_0xf021('0x58')]={'id':_0x4158e2[_0xf021('0x58')]['id'],'name':_0x4158e2['Interval'][_0xf021('0x2d')]};}var _0x50d8c0=md5(JSON['stringify'](_0xa0a250));if(_0x4158e2[_0xf021('0x59')]!==_0x50d8c0){_0x4158e2[_0xf021('0x59')]=_0x50d8c0;emit(util['format'](_0xf021('0x5a'),_0xa0a250['name']),_0xf021('0x5b'),_0xa0a250);}}}function emitVoiceQueueChannelRemove(_0x4d95fe){logger[_0xf021('0x5c')](_0xf021('0x5d'),JSON[_0xf021('0x5e')](_0x4d95fe));emit(util[_0xf021('0x5f')](_0xf021('0x5a'),_0x4d95fe[_0xf021('0x2d')]),'voice_queue_channel:remove',_0x4d95fe);io['emit'](_0xf021('0x60'),_0x4d95fe);}function notSendMessagesQueue(_0x562065){if(_0x562065[_0xf021('0x61')]){if(_0x562065['originated']===0x0&&_0x562065[_0xf021('0x32')]===0x0){_0x562065['sendMessageOneNotActive']=![];_0x562065[_0xf021('0x30')]=0x0;_0x562065[_0xf021('0x62')]=0x0;_0x562065['message']=_0xf021('0x63');ut['logger'](_0xf021('0x64'),_0x562065[_0xf021('0x2d')]+_0xf021('0x65'));}else{_0x562065[_0xf021('0x53')]=_0xf021('0x66');ut[_0xf021('0x67')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x562065['name']+_0xf021('0x68'));}emitCampaignPreview(_0x562065);}}Preview[_0xf021('0xf')][_0xf021('0x69')]=function(){var _0x5ead6f=this;setInterval(function(){_0x5ead6f[_0xf021('0x6a')]();},0x7cf);};Preview[_0xf021('0xf')][_0xf021('0x6a')]=function(){var _0x430b5b=this[_0xf021('0x14')];this[_0xf021('0x19')]+=0x1;for(var _0x4c5483 in _0x430b5b){if(_0x430b5b[_0xf021('0x6b')](_0x4c5483)&&(_0x430b5b[_0x4c5483]['dialMethod']===_0xf021('0x7')||_0x430b5b[_0x4c5483]['dialMethod']==='booked')&&_0x430b5b[_0x4c5483][_0xf021('0x2b')]===_0xf021('0x2c')){if(this['clockClearZombieChannels']>0x7){this[_0xf021('0x19')]=0x0;this['clearZombieChannels']();}}if(_0x430b5b[_0xf021('0x6b')](_0x4c5483)&&_0x430b5b[_0x4c5483][_0xf021('0x6c')]===_0xf021('0x7')&&_0x430b5b[_0x4c5483][_0xf021('0x2b')]==='outbound'){if(_0x430b5b[_0x4c5483][_0xf021('0x39')]){this[_0xf021('0x6d')](_0x430b5b[_0x4c5483]);this[_0xf021('0x6e')](_0x430b5b[_0x4c5483]);}else{notSendMessagesQueue(_0x430b5b[_0x4c5483]);}}}};Preview[_0xf021('0xf')][_0xf021('0x6f')]=function(_0x7097){var _0xd28280=this;this[_0xf021('0x13')][_0xf021('0x10')](function(){if(!_[_0xf021('0x70')](_0xd28280['actions'][_0x7097])){loggerAction[_0xf021('0x5c')](_0xf021('0x71'),_0x7097,_0xf021('0x72'),_0xd28280['actions'][_0x7097][_0xf021('0x73')],_0xf021('0x74'),JSON[_0xf021('0x5e')](_0xd28280['campaignsPreview'][_0xd28280['actions'][_0x7097][_0xf021('0x73')]][_0xf021('0x54')]),_0xf021('0x75'),JSON[_0xf021('0x5e')](_0xd28280[_0xf021('0x14')][_0xd28280['actions'][_0x7097][_0xf021('0x73')]][_0xf021('0x32')]),JSON['stringify'](_0xd28280['actions'][_0x7097][_0xf021('0x76')]),JSON[_0xf021('0x5e')](_['pick'](_0xd28280[_0xf021('0x17')][_0x7097],[_0xf021('0x77'),_0xf021('0x78'),_0xf021('0x79'),_0xf021('0x7a')])));return ami['Action']({'action':_0xf021('0x7b'),'channel':_0xd28280[_0xf021('0x17')][_0x7097][_0xf021('0x7c')]})['catch'](function(_0x4c7d5f){if(_0x4c7d5f[_0xf021('0x53')]==='No\x20such\x20channel'){setTimeout(function(){if(_0xd28280['actions'][_0x7097]){ut[_0xf021('0x7d')](_0xd28280[_0xf021('0x14')][_0xd28280[_0xf021('0x17')][_0x7097][_0xf021('0x73')]],_0xf021('0x7e'));if(_0xd28280['actions'][_0x7097]['dialAnswer']===!![]){ut[_0xf021('0x7f')](_0xd28280[_0xf021('0x14')][_0xd28280[_0xf021('0x17')][_0x7097][_0xf021('0x73')]],_0xf021('0x7e'));ut[_0xf021('0x80')]('[Dialer][checkChannel][pTalking][Preview]'+_0x7097,_0xd28280[_0xf021('0x17')][_0x7097][_0xf021('0x73')]);}ut[_0xf021('0x80')]('[Dialer][checkChannel][Preview]'+_0x7097,_0xd28280['actions'][_0x7097]['queue']);delete _0xd28280[_0xf021('0x17')][_0x7097];}},0x2328);}});}});};Preview[_0xf021('0xf')]['clearZombieChannels']=function(){var _0x19b958=this;loggerAction[_0xf021('0x5c')]('[action]',_['size'](this['actions']));for(var _0x122e2c in this['actions']){if(_0x19b958[_0xf021('0x17')]['hasOwnProperty'](_0x122e2c)){_0x19b958['clearZombieChannel'](_0x122e2c);}}};Preview['prototype'][_0xf021('0x6e')]=function(_0x27899f){var _0x438cdc=this;rpcDb[_0xf021('0x81')](_0x27899f['id'],ut[_0xf021('0x82')](this[_0xf021('0x18')]))['then'](function(_0x35efd5){if(!_[_0xf021('0x70')](_0x35efd5)){for(var _0x1d7149=0x0;_0x1d7149<_0x35efd5[_0xf021('0x83')];_0x1d7149+=0x1){if(ut[_0xf021('0x84')](_0x35efd5[_0x1d7149][_0xf021('0x85')])<_0x27899f[_0xf021('0x86')]*0x3c){if(_0x35efd5[_0x1d7149][_0xf021('0x87')]&&!_0x35efd5[_0x1d7149][_0xf021('0x87')]['voicePause']){_0x438cdc[_0xf021('0x88')](_0x35efd5[_0x1d7149]['id'])[_0xf021('0x89')](ut[_0xf021('0x8a')]('[RecallMe]'))[_0xf021('0x8b')](ut[_0xf021('0x8a')]('[RecallMe]'));}else{rpcDb[_0xf021('0x8c')](_0x35efd5[_0x1d7149]['id']);}}else{var _0x140932=new Action(_0x35efd5[_0x1d7149],_0x27899f);_0x140932[_0xf021('0x8d')]=moment()[_0xf021('0x5f')](_0xf021('0x8e'));_0x27899f[_0xf021('0x8f')]+=0x1;ut['logCustomer'](_0x140932,0x17,'RecallInQueue');if(_0x27899f[_0xf021('0x90')]){rpcDb[_0xf021('0x91')](ut['createBody'](_0x35efd5[_0x1d7149]));rpcDb[_0xf021('0x92')](_0x140932,_0xf021('0x93'));}else{ut['logCustomer'](_0x140932,0x16,_0xf021('0x94'));rpcDb[_0xf021('0x92')](_0x140932,_0xf021('0x95'));rpcDb['createCustomerFinal'](_0x140932,_0xf021('0x95'));}}}}})[_0xf021('0x8b')](ut['logger2'](_0xf021('0x96')));};Preview['prototype']['setMessage']=function(_0x48f7c1){_0x48f7c1[_0xf021('0x61')]=!![];if(ut[_0xf021('0x97')](_0x48f7c1[_0xf021('0x31')])){_0x48f7c1['message']='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0x48f7c1[_0xf021('0x39')])){_0x48f7c1[_0xf021('0x53')]='NOT_ACTIVE';}else if(!this[_0xf021('0x98')](_0x48f7c1[_0xf021('0x56')])){if(!this['isTrunkReachable'](_0x48f7c1['TrunkBackup'])){_0x48f7c1[_0xf021('0x53')]=_0xf021('0x99');}else{_0x48f7c1[_0xf021('0x53')]=_0xf021('0x9a');}}else{_0x48f7c1['message']=_0xf021('0x9a');}emitCampaignPreview(_0x48f7c1);};Preview[_0xf021('0xf')][_0xf021('0x9b')]=function(_0x5399ec,_0x400e67,_0x46c7e3){var _0x2d5dd9=this;var _0x5eb69b=this['actions'][_0x400e67];var _0x2e0c05=this[_0xf021('0x14')][_0x5eb69b['queue']];var _0x1abdef;if(_0x2e0c05){switch(_0x46c7e3){case'1':_0x2e0c05['outboundNoSuchCallsDay']+=0x1;_0x5eb69b[_0xf021('0x9c')]+=0x1;_0x5eb69b[_0xf021('0x9d')]=ut[_0xf021('0x9e')](_0x5eb69b);ut[_0xf021('0x9f')](_0x5eb69b,0x0,_0xf021('0xa0'));ami[_0xf021('0x2a')]('custom:agentnosuchnumber',ut[_0xf021('0xa1')](_0x5eb69b,_0xf021('0xa2')));rpcDb[_0xf021('0x92')](_0x5eb69b,_0xf021('0xa3'));if(ut[_0xf021('0x9e')](_0x5eb69b)>=_0x2e0c05[_0xf021('0xa4')]){_0x1abdef=ut[_0xf021('0xa5')](_0x5eb69b,0xf,_0xf021('0xa6'));rpcDb[_0xf021('0xa7')](_0x1abdef,_0xf021('0xa8'));}else{if(_0x5eb69b[_0xf021('0x9c')]>=_0x2e0c05[_0xf021('0xa9')]){rpcDb[_0xf021('0xa7')](_0x5eb69b,_0xf021('0xa8'));}else{rpcDb['rescheduleContact'](ut[_0xf021('0xaa')](_0x5eb69b,_0xf021('0x9c'),_0x2e0c05[_0xf021('0xab')]),_0x5eb69b['unlockAgent'],_0x5eb69b['activeContact']);}}delete this[_0xf021('0x17')][_0x5399ec[_0xf021('0xac')]];break;case _0xf021('0xad'):var _0x815c1b=moment()[_0xf021('0x5f')](_0xf021('0x8e'));_0x5eb69b[_0xf021('0xae')]=_0x815c1b;_0x5eb69b[_0xf021('0xaf')]=_0x815c1b;_0x5eb69b['dialAnswer']=!![];_0x2e0c05[_0xf021('0x32')]+=0x1;logger[_0xf021('0x5c')](_0xf021('0xb0'),_0x5eb69b[_0xf021('0xb1')],_0xf021('0xb2'),_0x2e0c05['name'],_0xf021('0x75'),_0x2e0c05['pTalking']);ami[_0xf021('0x2a')]('custom:agentconnect',ut[_0xf021('0xa1')](_0x5eb69b,_0xf021('0xb3'),this[_0xf021('0x14')][_0x5eb69b['queue']]));if(_0x2e0c05[_0xf021('0xb4')]){ami['emit']('custom:agentConnectPreview',ut[_0xf021('0xb5')](_0x5eb69b));}break;case'16':ami[_0xf021('0x2a')](_0xf021('0xb6'),ut[_0xf021('0xa1')](_0x5eb69b,_0xf021('0xb7'),this[_0xf021('0x14')][_0x5eb69b[_0xf021('0x73')]]));emitVoiceQueueChannelRemove(ut[_0xf021('0xa1')](_0x5eb69b,'complete'));_0x2e0c05['outboundAnswerCallsDay']+=0x1;_0x2e0c05['total']+=0x1;_0x2e0c05[_0xf021('0x2f')]+=0x1;ut[_0xf021('0x7f')](_0x2e0c05,_0xf021('0xb8'));_0x5eb69b[_0xf021('0x9d')]=ut[_0xf021('0x9e')](_0x5eb69b);ut[_0xf021('0x9f')](_0x5eb69b,0x4,'Answer');rpcDb[_0xf021('0x92')](_0x5eb69b,_0xf021('0xb9'));rpcDb[_0xf021('0xa7')](_0x5eb69b,_0xf021('0xba'));rpcDb[_0xf021('0xbb')](_0x5eb69b);_0x2e0c05[_0xf021('0x34')]+=_0x5eb69b[_0xf021('0xbc')];_0x2e0c05['sumBillable']+=_0x5eb69b[_0xf021('0xbc')];logger['info'](_0xf021('0xbd'),_0x5eb69b[_0xf021('0xb1')],'\x20Queue',_0x2e0c05[_0xf021('0x2d')],_0xf021('0x75'),_0x2e0c05['pTalking']);delete this[_0xf021('0x17')][_0x5399ec['linkedid']];break;case'BUSY':_0x2e0c05[_0xf021('0xbe')]+=0x1;_0x5eb69b[_0xf021('0xbf')]+=0x1;_0x5eb69b[_0xf021('0x9d')]=ut['totalGlobal'](_0x5eb69b);ut[_0xf021('0x9f')](_0x5eb69b,0x5,_0xf021('0xc0'));ami[_0xf021('0x2a')](_0xf021('0xc1'),ut[_0xf021('0xa1')](_0x5eb69b,_0xf021('0xc2')));rpcDb[_0xf021('0x92')](_0x5eb69b,_0xf021('0xc3'));if(ut[_0xf021('0x9e')](_0x5eb69b)>=_0x2e0c05[_0xf021('0xa4')]){_0x1abdef=ut['cloneAction'](_0x5eb69b,0xf,_0xf021('0xa6'));rpcDb[_0xf021('0xa7')](_0x1abdef,_0xf021('0xc4'));}else{if(_0x5eb69b[_0xf021('0xbf')]>=_0x2e0c05['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x5eb69b,_0xf021('0xc3'));}else{rpcDb['rescheduleContact'](ut[_0xf021('0xaa')](_0x5eb69b,'countbusyretry',_0x2e0c05[_0xf021('0xc5')]),_0x5eb69b['unlockAgent'],_0x5eb69b['activeContact']);}}break;case _0xf021('0xc6'):_0x2e0c05[_0xf021('0x44')]+=0x1;_0x5eb69b[_0xf021('0xc7')]+=0x1;_0x5eb69b[_0xf021('0x9d')]=ut[_0xf021('0x9e')](_0x5eb69b);ut[_0xf021('0x9f')](_0x5eb69b,0x3,_0xf021('0xc8'));ami[_0xf021('0x2a')]('custom:agentnoanswer',ut[_0xf021('0xa1')](_0x5eb69b,_0xf021('0xc9')));rpcDb[_0xf021('0x92')](_0x5eb69b,_0xf021('0xca'));if(ut[_0xf021('0x9e')](_0x5eb69b)>=_0x2e0c05[_0xf021('0xa4')]){_0x1abdef=ut['cloneAction'](_0x5eb69b,0xf,_0xf021('0xa6'));rpcDb['createCustomerFinal'](_0x1abdef,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x5eb69b[_0xf021('0xc7')]>=_0x2e0c05[_0xf021('0xcb')]){rpcDb[_0xf021('0xa7')](_0x5eb69b,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xf021('0xcc')](ut[_0xf021('0xaa')](_0x5eb69b,_0xf021('0xc7'),_0x2e0c05['dialNoAnswerRetryFrequency']),_0x5eb69b[_0xf021('0xcd')],_0x5eb69b[_0xf021('0xce')]);}}break;case _0xf021('0xcf'):_0x2e0c05[_0xf021('0x41')]+=0x1;_0x5eb69b[_0xf021('0xd0')]+=0x1;_0x5eb69b[_0xf021('0x9d')]=ut['totalGlobal'](_0x5eb69b);ut['logCustomer'](_0x5eb69b,0x8,_0xf021('0xd1'));ami[_0xf021('0x2a')](_0xf021('0xd2'),ut['buildObj'](_0x5eb69b,_0xf021('0xd3')));rpcDb['createCustomerHistory'](_0x5eb69b,_0xf021('0xd4'));if(ut[_0xf021('0x9e')](_0x5eb69b)>=_0x2e0c05[_0xf021('0xa4')]){_0x1abdef=ut[_0xf021('0xa5')](_0x5eb69b,0xf,_0xf021('0xa6'));rpcDb[_0xf021('0xa7')](_0x1abdef,_0xf021('0xd5'));}else{if(_0x5eb69b[_0xf021('0xd0')]>=_0x2e0c05[_0xf021('0xd6')]){rpcDb[_0xf021('0xa7')](_0x5eb69b,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xf021('0xcc')](ut[_0xf021('0xaa')](_0x5eb69b,'countcongestionretry',_0x2e0c05['dialBusyRetryFrequency']),_0x5eb69b[_0xf021('0xcd')],_0x5eb69b[_0xf021('0xce')]);}}break;case _0xf021('0xd7'):_0x2e0c05['outboundRejectCallsDay']+=0x1;_0x5eb69b[_0xf021('0xd8')]+=0x1;_0x5eb69b[_0xf021('0x9d')]=ut[_0xf021('0x9e')](_0x5eb69b);ut['logCustomer'](_0x5eb69b,0x14,'AgentReject');ami[_0xf021('0x2a')](_0xf021('0xd9'),ut['buildObj'](_0x5eb69b,_0xf021('0xda')));rpcDb['createCustomerHistory'](_0x5eb69b,_0xf021('0xdb'));if(ut['totalGlobal'](_0x5eb69b)>=_0x2e0c05[_0xf021('0xa4')]){_0x1abdef=ut[_0xf021('0xa5')](_0x5eb69b,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x1abdef,_0xf021('0xdc'));}else{if(_0x5eb69b[_0xf021('0xd8')]>=_0x2e0c05[_0xf021('0xdd')]){rpcDb['createCustomerFinal'](_0x5eb69b,_0xf021('0xdc'));}else{rpcDb[_0xf021('0xcc')](ut['scheduledAt'](_0x5eb69b,_0xf021('0xd8'),_0x2e0c05['dialAgentRejectRetryFrequency']),_0x5eb69b[_0xf021('0xcd')],_0x5eb69b[_0xf021('0xce')]);}}break;case _0xf021('0xde'):_0x2e0c05[_0xf021('0x48')]+=0x1;_0x5eb69b['countabandonedretry']+=0x1;_0x5eb69b[_0xf021('0x9d')]=ut['totalGlobal'](_0x5eb69b);ut['logCustomer'](_0x5eb69b,0xb,_0xf021('0xdf'));rpcDb[_0xf021('0x92')](_0x5eb69b,_0xf021('0xe0'));if(ut[_0xf021('0x9e')](_0x5eb69b)>=_0x2e0c05[_0xf021('0xa4')]){_0x1abdef=ut['cloneAction'](_0x5eb69b,0xf,_0xf021('0xa6'));rpcDb['createCustomerFinal'](_0x1abdef,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x5eb69b[_0xf021('0xe1')]>=_0x2e0c05[_0xf021('0xe2')]){rpcDb[_0xf021('0xa7')](_0x5eb69b,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xf021('0xcc')](ut[_0xf021('0xaa')](_0x5eb69b,_0xf021('0xe3'),_0x2e0c05['dialAbandonedRetryFrequency']),_0x5eb69b['unlockAgent'],_0x5eb69b['activeContact']);}}break;case'18':_0x2e0c05[_0xf021('0x47')]+=0x1;_0x5eb69b[_0xf021('0xe4')]+=0x1;_0x5eb69b[_0xf021('0x9d')]=ut[_0xf021('0x9e')](_0x5eb69b);ut[_0xf021('0x9f')](_0x5eb69b,0x12,_0x5399ec[_0xf021('0xe5')]||_0x5399ec['dialstatus']);ami[_0xf021('0x2a')](_0xf021('0xe6'),ut[_0xf021('0xa1')](_0x5eb69b,'amd'));rpcDb['createCustomerHistory'](_0x5eb69b,_0xf021('0xe7'));if(ut[_0xf021('0x9e')](_0x5eb69b)>=_0x2e0c05[_0xf021('0xa4')]){_0x1abdef=ut['cloneAction'](_0x5eb69b,0xf,_0xf021('0xa6'));rpcDb[_0xf021('0xa7')](_0x1abdef,_0xf021('0xe7'));}else{rpcDb[_0xf021('0xa7')](_0x5eb69b,_0xf021('0xe7'));}delete this[_0xf021('0x17')][_0x5399ec['linkedid']];break;case'19':_0x2e0c05[_0xf021('0x47')]+=0x1;_0x5eb69b[_0xf021('0x9d')]=ut[_0xf021('0x9e')](_0x5eb69b);ut[_0xf021('0x9f')](_0x5eb69b,0x13,_0x5399ec[_0xf021('0xe5')]||_0x5399ec[_0xf021('0xe8')]);ami['emit'](_0xf021('0xe6'),ut['buildObj'](_0x5eb69b,_0xf021('0xe9')));rpcDb['createCustomerHistory'](_0x5eb69b,_0xf021('0xea'));if(ut[_0xf021('0x9e')](_0x5eb69b)>=_0x2e0c05[_0xf021('0xa4')]){_0x1abdef=ut[_0xf021('0xa5')](_0x5eb69b,0xf,'Global');rpcDb[_0xf021('0xa7')](_0x1abdef,'[callProgressDetectingCustomer][machine]');}else{rpcDb['createCustomerFinal'](_0x5eb69b,'[callProgressDetectingCustomer][machine]');}delete this[_0xf021('0x17')][_0x5399ec[_0xf021('0xac')]];break;default:if(_0x5eb69b[_0xf021('0x76')]){ut[_0xf021('0x7f')](_0x2e0c05,_0xf021('0xeb'));ut['loggerError'](_0xf021('0xec')+_0x2e0c05[_0xf021('0x2d')],_0x5399ec);}_0x2e0c05[_0xf021('0x47')]+=0x1;_0x5eb69b['countglobal']=ut[_0xf021('0x9e')](_0x5eb69b);ut[_0xf021('0x9f')](_0x5eb69b,0xc,_0x5399ec[_0xf021('0xe5')]||_0x5399ec['dialstatus']);rpcDb['createCustomerHistory'](_0x5eb69b,_0xf021('0xed'));if(ut[_0xf021('0x9e')](_0x5eb69b)>=_0x2e0c05[_0xf021('0xa4')]){_0x1abdef=ut[_0xf021('0xa5')](_0x5eb69b,0xf,_0xf021('0xa6'));rpcDb[_0xf021('0xa7')](_0x1abdef,_0xf021('0xee'));}else{rpcDb[_0xf021('0xa7')](_0x5eb69b,_0xf021('0xee'));}delete this[_0xf021('0x17')][_0x5399ec[_0xf021('0xac')]];}if(!(_0x5eb69b[_0xf021('0x76')]&&_0x46c7e3==='16')){ut[_0xf021('0x7d')](_0x2e0c05,'[callProgressDetectingCustomer]');logger[_0xf021('0x5c')]('[originated][decrement][callProgressDetectingCustomer]',_0x5eb69b[_0xf021('0xb1')],_0xf021('0xb2'),_0x2e0c05[_0xf021('0x2d')],_0xf021('0x74'),_0x2e0c05[_0xf021('0x54')]);}if(_0x46c7e3!==_0xf021('0xad')){delete this[_0xf021('0x17')][_0x5399ec[_0xf021('0xac')]];delete this['actions'][_0x5399ec[_0xf021('0xef')]];}}};Preview[_0xf021('0xf')]['callProgressDetectingAgent']=function(_0xb7205b,_0x3c2ac6,_0x4883a8){if(_[_0xf021('0xf0')](_0x3c2ac6)&&_0xf021('0xf1')!==typeof _0x3c2ac6){return;}if(_[_0xf021('0xf0')](_0x4883a8)&&_0xf021('0xf1')!==typeof _0x4883a8){return;}switch(_0x4883a8[_0xf021('0xf2')]){case'0':ut[_0xf021('0xf3')](_0xb7205b,0x0,_0xf021('0xa0'));rpcDb[_0xf021('0xf4')](_0xb7205b,_0xf021('0xf5'));break;case'3':ut[_0xf021('0xf3')](_0xb7205b,0x3,_0xf021('0xc8'));rpcDb[_0xf021('0xf4')](_0xb7205b,_0xf021('0xf6'));break;case'5':ut[_0xf021('0xf3')](_0xb7205b,0x5,_0xf021('0xc0'));rpcDb[_0xf021('0xf4')](_0xb7205b,_0xf021('0xf7'));break;case'8':ut[_0xf021('0xf3')](_0xb7205b,0x8,_0xf021('0xd1'));rpcDb['createAgentHistory'](_0xb7205b,_0xf021('0xf8'));break;case'22':ut[_0xf021('0xf3')](_0xb7205b,0x16,_0xf021('0xf9'));rpcDb[_0xf021('0xf4')](_0xb7205b,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0xb7205b,0xc,_0x4883a8['reason']);rpcDb[_0xf021('0xf4')](_0xb7205b,_0xf021('0xf8'));}ut['updateOriginated'](_0x3c2ac6,'[callProgressDetectingAgent]');logger['info'](_0xf021('0xfa'),_0xb7205b[_0xf021('0xb1')],_0xf021('0xb2'),_0x3c2ac6[_0xf021('0x2d')],_0xf021('0x74'),_0x3c2ac6[_0xf021('0x54')]);delete this[_0xf021('0x17')][_0xb7205b[_0xf021('0xb1')]];};Preview[_0xf021('0xf')][_0xf021('0xfb')]=function(_0x202222,_0x4bbad0,_0x24771c,_0x1e0c15,_0x2ccd36){var _0x496165=this;return new BPromise(function(_0x59ccde,_0x31ff03){if(_[_0xf021('0x70')](_0x4bbad0)||_['isNil'](_0x4bbad0['Contact'])||_[_0xf021('0x70')](_0x4bbad0[_0xf021('0xfc')][_0xf021('0xfd')])||_['isNil'](_0x4bbad0[_0xf021('0x79')])){_0x31ff03(ut['message'](_0xf021('0xfe'),_0x1e0c15,_0x2ccd36));return;}var _0xebfab7=uuid['v4']();var _0x38d3ff=_0x496165[_0xf021('0x14')][_0x4bbad0[_0xf021('0x72')][_0xf021('0x2d')]];var _0x1faab4=_0x24771c?_0x496165[_0xf021('0x18')][_0x24771c]['id']:undefined;_0x496165['actions'][_0xebfab7]=new Action(_0x4bbad0,_0x38d3ff,_0xebfab7,_0x24771c,_0x1faab4);var _0x11fcd6=_0x496165['actions'][_0xebfab7];_0x11fcd6[_0xf021('0xcd')]=_0x1e0c15;_0x11fcd6[_0xf021('0xce')]=_0x2ccd36;_0x11fcd6['lookAgent']=_0x24771c;if(_[_0xf021('0xff')](_0x202222)){_0x496165[_0xf021('0x100')](_0x11fcd6,_0x38d3ff,_0x4bbad0,_0x24771c)['then'](function(_0x432c82){logger[_0xf021('0x5c')](_0xf021('0x101'),_0xf021('0x102')+_0x11fcd6[_0xf021('0x73')]+_0xf021('0x103')+_0x11fcd6[_0xf021('0x104')],JSON[_0xf021('0x5e')](_0x432c82));ami[_0xf021('0x2a')](_0xf021('0x105'),ut['buildObj'](_0x11fcd6,_0xf021('0x106'),_0x496165[_0xf021('0x14')][_0x11fcd6[_0xf021('0x73')]]));_0x59ccde(ut[_0xf021('0x53')](_0xf021('0x107')));})[_0xf021('0x8b')](function(_0xc59c0e){ut['logger']('[Preview][execCall][failure]',_0xc59c0e);_0x31ff03(ut['message'](_0xf021('0x108'),_0x1e0c15,_0x2ccd36));});}else{_0x38d3ff['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x11fcd6);rpcDb[_0xf021('0x109')](_0x11fcd6,_0xf021('0x10a'));delete _0x496165[_0xf021('0x17')][_0xebfab7];_0x31ff03(ut[_0xf021('0x53')](_0xf021('0x10b'),_0x1e0c15,_0x2ccd36));}});};Preview[_0xf021('0xf')]['isTrunkReachable']=function(_0x560c6c){return!_[_0xf021('0x70')](_0x560c6c)&&!_[_0xf021('0x70')](_0x560c6c['name'])&&!_[_0xf021('0x70')](_0x560c6c[_0xf021('0x10c')])&&_0x560c6c[_0xf021('0x10c')]&&!_[_0xf021('0x70')](this['trunks'][util[_0xf021('0x5f')](_0xf021('0x10d'),_0x560c6c[_0xf021('0x2d')])])&&!_['isNil'](this[_0xf021('0x16')][util[_0xf021('0x5f')](_0xf021('0x10d'),_0x560c6c[_0xf021('0x2d')])]['status'])&&(this[_0xf021('0x16')][util['format'](_0xf021('0x10d'),_0x560c6c[_0xf021('0x2d')])][_0xf021('0x7b')]==='reachable'||this['trunks'][util['format'](_0xf021('0x10d'),_0x560c6c[_0xf021('0x2d')])][_0xf021('0x7b')]===_0xf021('0x10e'));};Preview[_0xf021('0xf')]['run']=function(_0xd31884,_0x12c63f){var _0x2f5e04=this;return new BPromise(function(_0x4261db,_0x6552f4){_0x2f5e04[_0xf021('0x10f')](_0xd31884,_0x12c63f)[_0xf021('0x89')](function(_0x19ba37){_0x4261db(_['pick'](_0x19ba37,[_0xf021('0x53')]));})[_0xf021('0x8b')](function(_0x23cc2c){if(_0x23cc2c[_0xf021('0x110')]){rpcDb[_0xf021('0x111')](_0xd31884);}if(_0x23cc2c[_0xf021('0x10c')]){rpcDb[_0xf021('0x8c')](_0xd31884);}_0x6552f4(_[_0xf021('0x112')](_0x23cc2c,['message']));});});};Preview['prototype'][_0xf021('0x10f')]=function(_0x25a78a,_0x12724f){var _0x453c60=this;return new BPromise(function(_0xe29b6d,_0x3b1200){var _0x4b261f,_0xb90018;rpcDb['getContactPreview'](_0x25a78a)[_0xf021('0x89')](function(_0xa13338){if(!_['isNil'](_0xa13338[0x0])){_0xb90018=_0xa13338[0x0][_0xf021('0x113')]?![]:!![];_0x4b261f=_0xa13338[0x0]['recallme']?!![]:![];_0x4b261f=_0x12724f?!![]:_0x4b261f;}var _0xcd3f98=_0x453c60[_0xf021('0x114')](_0xa13338);if(_0xcd3f98[_0xf021('0x115')]){rpcDb[_0xf021('0x116')](_['pick'](_0xa13338[0x0],[_0xf021('0x79'),'Contact.phone']))[_0xf021('0x89')](function(_0x201d0a){_0x453c60[_0xf021('0xfb')](_0x201d0a,_0xa13338[0x0],_0x12724f,_0xb90018,_0x4b261f)[_0xf021('0x89')](function(_0x5b8bde){_0xe29b6d(_0x5b8bde);})['catch'](function(_0xec8ba2){_0x3b1200(_0xec8ba2);});})[_0xf021('0x8b')](function(_0x10a3be){ut[_0xf021('0x67')]('[Preview][checkIsBlackList]',_0x10a3be);_0x3b1200(ut['message'](_0xf021('0x117'),_0xb90018,_0x4b261f));});}else{_0x3b1200(ut['message'](_0xcd3f98[_0xf021('0x53')],_0xb90018,_0x4b261f));}})[_0xf021('0x8b')](function(_0x324a25){ut[_0xf021('0x67')](_0xf021('0x118'),_0x324a25);_0x3b1200(ut[_0xf021('0x53')](_0xf021('0x117'),![],!![]));});});};Preview[_0xf021('0xf')][_0xf021('0x114')]=function(_0x40a997){if(_['isNil'](_0x40a997)||_[_0xf021('0xff')](_0x40a997)||!_['isNil'](_0x40a997[0x0]['Agent'])&&_['isNil'](_0x40a997[0x0][_0xf021('0x87')]['name'])){ut['logger'](_0xf021('0x119'),_0x40a997);return{'isValid':![],'message':_0xf021('0x11a')};}var _0x5afb59=this[_0xf021('0x14')][_0x40a997[0x0][_0xf021('0x72')][_0xf021('0x2d')]];_0x5afb59[_0xf021('0x53')]=_0xf021('0x9a');if(_[_0xf021('0x70')](_0x5afb59)){ut['logger'](_0xf021('0x11b'),_0x5afb59);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x5afb59[_0xf021('0x56')])){ut[_0xf021('0x67')](_0xf021('0x11c'),'campaign\x20Name:\x20'+_0x5afb59[_0xf021('0x2d')]+_0xf021('0x11d'));if(!this['isTrunkReachable'](_0x5afb59[_0xf021('0x11e')])){ut[_0xf021('0x67')](_0xf021('0x11c'),_0x5afb59[_0xf021('0x2d')]+_0xf021('0x11f'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x5afb59['dialActive'])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x5afb59[_0xf021('0x2d')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x5afb59[_0xf021('0x2d')]+_0xf021('0x120')};}return{'isValid':!![],'message':_0xf021('0x121')};};Preview[_0xf021('0xf')]['execCall']=function(_0x6b0e13,_0x501374,_0x359f01,_0x421441){var _0x1760e8=this;return new BPromise(function(_0x3e8189,_0x6906cb){var _0x391669=_0x6b0e13[_0xf021('0xb1')];var _0x2b9578=_0x1760e8[_0xf021('0x98')](_0x501374[_0xf021('0x56')])?util[_0xf021('0x5f')](_0xf021('0x122'),_0x501374[_0xf021('0x56')][_0xf021('0x2d')],_[_0xf021('0x70')](_0x501374[_0xf021('0x3d')])?'':_0x501374['dialPrefix']['trim']()||'',_0x501374[_0xf021('0x123')]>0x0?_0x359f01[_0xf021('0xfc')][_0xf021('0xfd')]['substring'](_0x501374[_0xf021('0x123')]):_0x359f01[_0xf021('0xfc')][_0xf021('0xfd')]):util[_0xf021('0x5f')](_0xf021('0x122'),_['isNil'](_0x501374[_0xf021('0x11e')])?_0x501374[_0xf021('0x56')]['name']:_0x501374['TrunkBackup']['name'],_['isNil'](_0x501374[_0xf021('0x3d')])?'':_0x501374[_0xf021('0x3d')][_0xf021('0x124')]()||'',_0x501374[_0xf021('0x123')]>0x0?_0x359f01['Contact'][_0xf021('0xfd')][_0xf021('0x125')](_0x501374['dialCutDigit']):_0x359f01[_0xf021('0xfc')][_0xf021('0xfd')]);var _0x20d4a6=_0x1760e8[_0xf021('0x98')](_0x501374[_0xf021('0x56')])?ut[_0xf021('0x126')](_0x501374[_0xf021('0x56')][_0xf021('0x57')],_0x501374[_0xf021('0x3a')],_0x501374[_0xf021('0x127')]>0x0?ut[_0xf021('0x128')](_0x501374[_0xf021('0x3b')],_0x501374[_0xf021('0x127')]):_0x501374[_0xf021('0x3b')]):ut[_0xf021('0x126')](_[_0xf021('0x70')](_0x501374[_0xf021('0x11e')])?_0x501374[_0xf021('0x56')][_0xf021('0x57')]:_0x501374[_0xf021('0x11e')][_0xf021('0x57')],_0x501374[_0xf021('0x3a')],_0x501374[_0xf021('0x127')]>0x0?ut[_0xf021('0x128')](_0x501374['dialOriginateCallerIdNumber'],_0x501374['dialRandomLastDigitCallerIdNumber']):_0x501374['dialOriginateCallerIdNumber']);if(_0x20d4a6){_0x6b0e13[_0xf021('0x129')]=ut[_0xf021('0x12a')](_0x20d4a6);_0x6b0e13[_0xf021('0x12b')]=ut[_0xf021('0x12c')](_0x20d4a6);}var _0x13f9b7=ut[_0xf021('0x12d')](_0x501374,_0x359f01,_0x2b9578,_0x20d4a6,_0x391669,_0x6b0e13);_[_0xf021('0x12e')](_0x6b0e13,ut[_0xf021('0x12f')](_0x13f9b7));_0x6b0e13['starttime']=moment()[_0xf021('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0xf021('0x130')](ut[_0xf021('0x131')](_0x6b0e13,_0x501374,_0x13f9b7,_0x6b0e13['activeContact'],_0x421441))[_0xf021('0x89')](function(_0x50dba7){_0x501374[_0xf021('0x54')]+=0x1;logger[_0xf021('0x5c')](_0xf021('0x132'),_0x391669,'\x20Queue',_0x501374['name'],'originated:\x20',_0x501374[_0xf021('0x54')]);_0x3e8189(_0x50dba7);})[_0xf021('0x8b')](function(_0x4b2418){ut[_0xf021('0xf3')](_0x6b0e13,0xe,_0xf021('0x133'));rpcDb[_0xf021('0xf4')](_0x6b0e13,_0xf021('0x134'));_0x6906cb(_0x4b2418);});});};Preview['prototype'][_0xf021('0x23')]=function(_0x4cab9c){if(this[_0xf021('0x17')][_0x4cab9c['linkedid']]){this[_0xf021('0x17')][_0x4cab9c[_0xf021('0xac')]]['channel']=_0x4cab9c['channel'];}};Preview[_0xf021('0xf')]['syncOriginateResponse']=function(_0x2edb37){var _0x1ef446=this;var _0x171d6a=this[_0xf021('0x17')][_0x2edb37[_0xf021('0x135')]];if(_0x171d6a){if(_0x171d6a['lookAgent']&&this['agents'][_0x171d6a[_0xf021('0x136')]]){ut[_0xf021('0x137')](_0x171d6a,this[_0xf021('0x18')][_0x171d6a[_0xf021('0x136')]]['name'],this[_0xf021('0x18')][_0x171d6a[_0xf021('0x136')]]['id']);}var _0x54d7fa=_[_0xf021('0x138')](_0x171d6a);_0x54d7fa[_0xf021('0xae')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x1035a9=_0x1ef446[_0xf021('0x14')][_0x171d6a[_0xf021('0x73')]];if(ut[_0xf021('0x139')](_0x2edb37['response'])){if(_0x171d6a[_0xf021('0xcd')]){rpcDb['unlockContact'](_0x171d6a['idContact']);}if(_0x171d6a[_0xf021('0xce')]){rpcDb[_0xf021('0x8c')](_0x171d6a[_0xf021('0x104')]);}ami[_0xf021('0x2a')](_0xf021('0x13a'),ut[_0xf021('0xa1')](_0x171d6a,_0xf021('0x13b'),this[_0xf021('0x14')][_0x171d6a['queue']]));this[_0xf021('0x13c')](_0x54d7fa,_0x1035a9,_0x2edb37);}else{_0x171d6a['starttime']=moment()['format'](_0xf021('0x8e'));ut[_0xf021('0xf3')](_0x54d7fa,0x4,'Answer');rpcDb['createAgentHistory'](_0x54d7fa,_0xf021('0x13d'));}}};Preview[_0xf021('0xf')][_0xf021('0x1e')]=function(_0x31c193){var _0x33ec3c=this;var _0x37c79f=this['actions'][_0x31c193[_0xf021('0xac')]];var _0x11f7d5;if(_0x37c79f){_0x11f7d5=this[_0xf021('0x14')][_0x37c79f['queue']];logger[_0xf021('0x5c')](_0xf021('0x13e'),_0x31c193[_0xf021('0xac')],'\x20Queue',_0x11f7d5['name'],_0xf021('0x75'),_0x11f7d5[_0xf021('0x32')]);}if(this[_0xf021('0x17')][_0x31c193['linkedid']]&&_0x31c193[_0xf021('0xac')]!==_0x31c193[_0xf021('0xb1')]){if(_0x31c193[_0xf021('0x13f')]==='16'&&this[_0xf021('0x17')][_0x31c193[_0xf021('0xac')]][_0xf021('0x76')]){this[_0xf021('0x9b')](_0x31c193,_0x31c193['linkedid'],_0x31c193['cause']);}else if(this[_0xf021('0x17')][_0x31c193[_0xf021('0xac')]][_0xf021('0x76')]){logger[_0xf021('0x5c')](_0xf021('0x140'),_0x31c193[_0xf021('0xac')],_0x31c193['cause'],_0xf021('0xb2'),_0x11f7d5['name'],'pTalking:\x20',_0x11f7d5[_0xf021('0x32')]);this['callProgressDetectingCustomer'](_0x31c193,_0x31c193['linkedid'],_0x31c193[_0xf021('0x13f')]);}}else if(_0x37c79f&&_[_0xf021('0x70')](_0x37c79f[_0xf021('0x141')])&&_0x11f7d5[_0xf021('0x142')]&&_0x31c193[_0xf021('0xac')]===_0x31c193[_0xf021('0xb1')]&&_[_0xf021('0x70')](_0x31c193[_0xf021('0xf2')])&&_0x31c193['cause']==='16'&&_0x31c193[_0xf021('0x143')]==='6'&&_[_0xf021('0xf0')](_0x37c79f[_0xf021('0x144')])){if(_0x37c79f[_0xf021('0xcd')]){rpcDb['unlockContact'](_0x37c79f[_0xf021('0x104')]);}if(_0x37c79f[_0xf021('0xce')]){rpcDb['disableContact'](_0x37c79f[_0xf021('0x104')]);}_0x31c193[_0xf021('0xf2')]='22';this[_0xf021('0x13c')](_0x37c79f,_0x11f7d5,_0x31c193);}else if(_0x37c79f&&_0x37c79f['transfer']){if(_0x31c193['cause']==='16'&&this['actions'][_0x31c193[_0xf021('0xac')]][_0xf021('0x76')]){logger[_0xf021('0x5c')](_0xf021('0x145'),_0x31c193['linkedid'],_0x31c193['cause'],_0xf021('0xb2'),_0x11f7d5[_0xf021('0x2d')],_0xf021('0x75'),_0x11f7d5['pTalking']);this['callProgressDetectingCustomer'](_0x31c193,_0x31c193[_0xf021('0xac')],_0x31c193[_0xf021('0x13f')]);}else if(this[_0xf021('0x17')][_0x31c193[_0xf021('0xac')]][_0xf021('0x76')]){logger[_0xf021('0x5c')](_0xf021('0x140'),_0x31c193[_0xf021('0xac')],_0x31c193['cause'],'\x20Queue',_0x11f7d5[_0xf021('0x2d')],_0xf021('0x75'),_0x11f7d5[_0xf021('0x32')]);this[_0xf021('0x9b')](_0x31c193,_0x31c193[_0xf021('0xac')],_0x31c193[_0xf021('0x13f')]);}}};Preview['prototype'][_0xf021('0x21')]=function(_0xc5c5e3){if(this[_0xf021('0x17')][_0xc5c5e3[_0xf021('0xef')]]&&_0xc5c5e3[_0xf021('0xef')]!==_0xc5c5e3[_0xf021('0x146')]){this[_0xf021('0x9b')](_0xc5c5e3,_0xc5c5e3[_0xf021('0xef')],_0xc5c5e3[_0xf021('0xe8')]);}};Preview['prototype']['syncHangupRequest']=function(_0x1227f6){if(this['actions'][_0x1227f6[_0xf021('0xac')]]&&_0x1227f6['linkedid']!==_0x1227f6['uniqueid']&&!this[_0xf021('0x17')][_0x1227f6['linkedid']][_0xf021('0x76')]){if(_0x1227f6['cause']==='1'){this[_0xf021('0x9b')](_0x1227f6,_0x1227f6['linkedid'],_0x1227f6[_0xf021('0x13f')]);}}};Preview[_0xf021('0xf')]['addVariable']=function(_0x3d4880,_0x45ccd3,_0x1bf289){if(this['actions'][_0x3d4880]){if(_['isNil'](this[_0xf021('0x17')][_0x3d4880][_0xf021('0x147')])){this[_0xf021('0x17')][_0x3d4880][_0xf021('0x147')]={};}this['actions'][_0x3d4880]['variables'][_0x45ccd3]=_0x1bf289;}};Preview[_0xf021('0xf')][_0xf021('0x25')]=function(_0xd95d0f){try{if(!_[_0xf021('0x70')](_0xd95d0f)){if(ut[_0xf021('0x148')](_[_0xf021('0x149')](_0xd95d0f['variable'])[0x0])){this[_0xf021('0x14a')](_0xd95d0f[_0xf021('0xb1')],_['keys'](_0xd95d0f[_0xf021('0x14b')])[0x0],_0xd95d0f[_0xf021('0x14c')]);}}}catch(_0x211a63){logger[_0xf021('0x14d')]('[syncVarSet][Preview]',util[_0xf021('0x14e')](_0x211a63,{'showHidden':![],'depth':null}));}};Preview[_0xf021('0xf')][_0xf021('0x27')]=function(_0x475445){if(_0x475445){if(this[_0xf021('0x17')][_0x475445['transfertargetlinkedid']]){this[_0xf021('0x17')][_0x475445[_0xf021('0x14f')]][_0xf021('0x144')]=!![];}}};Preview[_0xf021('0xf')][_0xf021('0x29')]=function(_0x3f1e4a){if(_0x3f1e4a){if(this[_0xf021('0x17')][_0x3f1e4a[_0xf021('0x150')]]){this[_0xf021('0x17')][_0x3f1e4a['transfererlinkedid']][_0xf021('0x144')]=!![];}}};module[_0xf021('0x151')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index f8866f5..e299b6b 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 _0x4b22=['[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','lodash','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','active','rescheduleContact'];(function(_0x6942e0,_0x131e6d){var _0xb86490=function(_0x2fd5d7){while(--_0x2fd5d7){_0x6942e0['push'](_0x6942e0['shift']());}};_0xb86490(++_0x131e6d);}(_0x4b22,0x121));var _0x24b2=function(_0x330ec8,_0x3f919a){_0x330ec8=_0x330ec8-0x0;var _0x5bcefc=_0x4b22[_0x330ec8];return _0x5bcefc;};'use strict';var util=require(_0x24b2('0x0'));var BPromise=require(_0x24b2('0x1'));var logger=require(_0x24b2('0x2'))('preview');var _=require(_0x24b2('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x24b2('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x24b2('0x5'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x24b2('0x6'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x14dfe7){return function(_0x6654e8){logger[_0x24b2('0x7')](_0x14dfe7,util['inspect'](_0x6654e8,{'showHidden':![],'depth':null}));};}function create(_0x54ec12){return BPromise[_0x24b2('0x8')]()['then'](cmHopperHistory[_0x24b2('0x9')](_0x54ec12))[_0x24b2('0xa')](loggerCatch(_0x24b2('0xb')));}function createAgent(_0x406478){return BPromise[_0x24b2('0x8')]()[_0x24b2('0xc')](agentReportPreview[_0x24b2('0x9')](_0x406478))[_0x24b2('0xa')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x47ecb0){return BPromise[_0x24b2('0x8')]()[_0x24b2('0xc')](cmHopper[_0x24b2('0xd')](_0x47ecb0,!![]))[_0x24b2('0xa')](loggerCatch(_0x24b2('0xe')));}exports[_0x24b2('0xf')]=function(_0x3e19db){return BPromise[_0x24b2('0x8')]()[_0x24b2('0xc')](cmHopperBlack['checkIsBlackList'](_0x3e19db))[_0x24b2('0xa')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x24b2('0x10')]=function(_0x41fe23){return BPromise['resolve']()[_0x24b2('0xc')](cmHopper[_0x24b2('0x10')](_0x41fe23))[_0x24b2('0xa')](loggerCatch(_0x24b2('0x11')));};exports[_0x24b2('0x9')]=function(_0x3ca827,_0x401d4b){create(_0x3ca827)[_0x24b2('0xa')](loggerCatch(_0x401d4b));moveContact(_0x3ca827)[_0x24b2('0xa')](loggerCatch(_0x401d4b));};exports[_0x24b2('0x12')]=function(_0x5e635e,_0x5f3572){createAgent(_0x5e635e)[_0x24b2('0xa')](loggerCatch(_0x5f3572));};exports[_0x24b2('0x13')]=function(_0xdbf451,_0x1068fa){create(_0xdbf451)[_0x24b2('0xa')](loggerCatch(_0x1068fa));};exports[_0x24b2('0x14')]=function(_0x5ef5b1,_0x17f63c){moveContact(_0x5ef5b1)[_0x24b2('0xa')](loggerCatch(_0x17f63c));};exports['rescheduleContact']=function(_0x1f71ae,_0xcbf93c,_0x1d7e7c){if(_0xcbf93c){_0x1f71ae['UserId']=null;}if(_0x1d7e7c){_0x1f71ae[_0x24b2('0x15')]=![];}return BPromise[_0x24b2('0x8')]()[_0x24b2('0xc')](cmHopper[_0x24b2('0x16')](_0x1f71ae))[_0x24b2('0xa')](loggerCatch(_0x24b2('0x17')));};exports[_0x24b2('0x18')]=function(_0x55d34b){return BPromise[_0x24b2('0x8')]()[_0x24b2('0xc')](cmHopper[_0x24b2('0x18')](_0x55d34b))[_0x24b2('0xa')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x6c1ff4){return BPromise[_0x24b2('0x8')]()[_0x24b2('0xc')](cmHopper[_0x24b2('0x19')]({'UserId':null},_0x6c1ff4,0x1))[_0x24b2('0xa')](loggerCatch(_0x24b2('0x1a')));};exports[_0x24b2('0x1b')]=function(_0x115801){return BPromise[_0x24b2('0x8')]()[_0x24b2('0xc')](cmHopper[_0x24b2('0x19')]({'active':![]},_0x115801,0x1))[_0x24b2('0xa')](loggerCatch(_0x24b2('0x1c')));};exports[_0x24b2('0x1d')]=function(_0x3722da){var _0x4820fe={};_0x4820fe['type']=_0x3722da[_0x24b2('0x1e')];_0x4820fe['uniqueid']=_0x3722da[_0x24b2('0x1f')];_0x4820fe['calleridnum']=_0x3722da[_0x24b2('0x20')];_0x4820fe[_0x24b2('0x21')]=_0x3722da[_0x24b2('0x21')];_0x4820fe['queue']=_0x3722da[_0x24b2('0x22')];_0x4820fe[_0x24b2('0x23')]=_0x3722da['answertime'];_0x4820fe[_0x24b2('0x24')]=_0x3722da['answertime'];_0x4820fe[_0x24b2('0x25')]=0x1;_0x4820fe[_0x24b2('0x26')]=_0x3722da[_0x24b2('0x27')];_0x4820fe['connectedlinename']=_0x3722da[_0x24b2('0x28')];_0x4820fe[_0x24b2('0x29')]=_0x24b2('0x2a');_0x4820fe[_0x24b2('0x2b')]=_0x24b2('0x2c');_0x4820fe['holdtime']=0x0;_0x4820fe[_0x24b2('0x2d')]=0x1;_0x4820fe[_0x24b2('0x2e')]=_0x3722da[_0x24b2('0x28')];_0x4820fe[_0x24b2('0x2f')]=_0x24b2('0x30');return BPromise[_0x24b2('0x8')]()[_0x24b2('0xc')](voiceQueueReport['create'](_0x4820fe))[_0x24b2('0xa')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x24b2('0x31')]=function(_0x4a56b1,_0xe0af52){return BPromise[_0x24b2('0x8')]()[_0x24b2('0xc')](cmHopper['getContactRecallMe'](_0x4a56b1,_0xe0af52))[_0x24b2('0xa')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x24b2('0x32')]=function(_0x25d29e){return BPromise[_0x24b2('0x8')]()['then'](cmHopper[_0x24b2('0x16')](_0x25d29e,!![],!![]))[_0x24b2('0xa')](loggerCatch(_0x24b2('0x33')));}; \ No newline at end of file +var _0x3fa7=['preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','exten','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger'];(function(_0x3a9c54,_0x8ab5da){var _0x5bfeb5=function(_0x161a95){while(--_0x161a95){_0x3a9c54['push'](_0x3a9c54['shift']());}};_0x5bfeb5(++_0x8ab5da);}(_0x3fa7,0x1c5));var _0x73fa=function(_0x50c55e,_0xde89dc){_0x50c55e=_0x50c55e-0x0;var _0x13c7e8=_0x3fa7[_0x50c55e];return _0x13c7e8;};'use strict';var util=require(_0x73fa('0x0'));var BPromise=require(_0x73fa('0x1'));var logger=require(_0x73fa('0x2'))(_0x73fa('0x3'));var _=require('lodash');var cmHopper=require(_0x73fa('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x73fa('0x5'));var cmHopperBlack=require(_0x73fa('0x6'));var voiceQueueRt=require(_0x73fa('0x7'));var agentReportPreview=require(_0x73fa('0x8'));var voiceQueueReport=require(_0x73fa('0x9'));function loggerCatch(_0x491e21){return function(_0x43a1ec){logger[_0x73fa('0xa')](_0x491e21,util['inspect'](_0x43a1ec,{'showHidden':![],'depth':null}));};}function create(_0x73a4fb){return BPromise[_0x73fa('0xb')]()[_0x73fa('0xc')](cmHopperHistory[_0x73fa('0xd')](_0x73a4fb))[_0x73fa('0xe')](loggerCatch(_0x73fa('0xf')));}function createAgent(_0x588e99){return BPromise[_0x73fa('0xb')]()[_0x73fa('0xc')](agentReportPreview[_0x73fa('0xd')](_0x588e99))[_0x73fa('0xe')](loggerCatch(_0x73fa('0xf')));}function moveContact(_0x20fef3){return BPromise[_0x73fa('0xb')]()['then'](cmHopper[_0x73fa('0x10')](_0x20fef3,!![]))[_0x73fa('0xe')](loggerCatch(_0x73fa('0x11')));}exports[_0x73fa('0x12')]=function(_0x4bf140){return BPromise[_0x73fa('0xb')]()['then'](cmHopperBlack['checkIsBlackList'](_0x4bf140))[_0x73fa('0xe')](loggerCatch(_0x73fa('0x13')));};exports['getContactPreview']=function(_0x3a46df){return BPromise[_0x73fa('0xb')]()[_0x73fa('0xc')](cmHopper[_0x73fa('0x14')](_0x3a46df))['catch'](loggerCatch(_0x73fa('0x15')));};exports[_0x73fa('0xd')]=function(_0x45e383,_0x3eeedf){create(_0x45e383)['catch'](loggerCatch(_0x3eeedf));moveContact(_0x45e383)[_0x73fa('0xe')](loggerCatch(_0x3eeedf));};exports[_0x73fa('0x16')]=function(_0x3200a9,_0x3da635){createAgent(_0x3200a9)[_0x73fa('0xe')](loggerCatch(_0x3da635));};exports[_0x73fa('0x17')]=function(_0x29d62e,_0x39d3c9){create(_0x29d62e)[_0x73fa('0xe')](loggerCatch(_0x39d3c9));};exports[_0x73fa('0x18')]=function(_0x22f161,_0x56c037){moveContact(_0x22f161)[_0x73fa('0xe')](loggerCatch(_0x56c037));};exports[_0x73fa('0x19')]=function(_0x1489b2,_0x5a668a,_0x401e0d){if(_0x5a668a){_0x1489b2['UserId']=null;}if(_0x401e0d){_0x1489b2[_0x73fa('0x1a')]=![];}return BPromise[_0x73fa('0xb')]()[_0x73fa('0xc')](cmHopper['rescheduleContact'](_0x1489b2))[_0x73fa('0xe')](loggerCatch(_0x73fa('0x1b')));};exports[_0x73fa('0x1c')]=function(_0x11e903){return BPromise[_0x73fa('0xb')]()[_0x73fa('0xc')](cmHopper[_0x73fa('0x1c')](_0x11e903))[_0x73fa('0xe')](loggerCatch(_0x73fa('0x1d')));};exports[_0x73fa('0x1e')]=function(_0x37b824){return BPromise[_0x73fa('0xb')]()['then'](cmHopper[_0x73fa('0x1e')]({'UserId':null},_0x37b824,0x1))[_0x73fa('0xe')](loggerCatch(_0x73fa('0x1f')));};exports[_0x73fa('0x20')]=function(_0x2dc6c8){return BPromise[_0x73fa('0xb')]()[_0x73fa('0xc')](cmHopper[_0x73fa('0x1e')]({'active':![]},_0x2dc6c8,0x1))[_0x73fa('0xe')](loggerCatch('[activeContact]\x20'));};exports[_0x73fa('0x21')]=function(_0x2cfa9f){var _0x36e60b={};_0x36e60b[_0x73fa('0x22')]=_0x2cfa9f[_0x73fa('0x22')];_0x36e60b[_0x73fa('0x23')]=_0x2cfa9f[_0x73fa('0x23')];_0x36e60b[_0x73fa('0x24')]=_0x2cfa9f[_0x73fa('0x24')];_0x36e60b['calleridname']=_0x2cfa9f[_0x73fa('0x25')];_0x36e60b[_0x73fa('0x26')]=_0x2cfa9f[_0x73fa('0x26')];_0x36e60b[_0x73fa('0x27')]=_0x2cfa9f[_0x73fa('0x28')];_0x36e60b[_0x73fa('0x29')]=_0x2cfa9f[_0x73fa('0x28')];_0x36e60b[_0x73fa('0x2a')]=0x1;_0x36e60b['queuecallercompleteAt']=_0x2cfa9f[_0x73fa('0x2b')];_0x36e60b[_0x73fa('0x2c')]=_0x2cfa9f[_0x73fa('0x2d')];_0x36e60b[_0x73fa('0x2e')]='from-sip';_0x36e60b[_0x73fa('0x2f')]='xcally-motion-preview';_0x36e60b['holdtime']=0x0;_0x36e60b[_0x73fa('0x30')]=0x1;_0x36e60b[_0x73fa('0x31')]=_0x2cfa9f['membername'];_0x36e60b[_0x73fa('0x32')]='COMPLETED';return BPromise['resolve']()['then'](voiceQueueReport[_0x73fa('0x33')](_0x36e60b))[_0x73fa('0xe')](loggerCatch(_0x73fa('0x34')));};exports['getContactRecallMe']=function(_0x15f9a5,_0x221fdc){return BPromise['resolve']()[_0x73fa('0xc')](cmHopper[_0x73fa('0x35')](_0x15f9a5,_0x221fdc))[_0x73fa('0xe')](loggerCatch(_0x73fa('0x36')));};exports[_0x73fa('0x37')]=function(_0x1f0ab5){return BPromise[_0x73fa('0xb')]()[_0x73fa('0xc')](cmHopper[_0x73fa('0x19')](_0x1f0ab5,!![],!![]))[_0x73fa('0xe')](loggerCatch(_0x73fa('0x38')));}; \ 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 607d747..86cf765 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 _0x3fd5=['xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','error','info','inspect','loggerError','logger2','message','getCallerId','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','starttime','endtime','statedesc','responsetime','membername','logCustomer','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','answertime','isFailure','variablesAction','BOOKED','uniqueid','originate','channelAgent','calleridnum','timeout','totalGlobal','countcongestionretry','countagentrejectretry','countnosuchnumberretry','clone','Global','active','add','minutes','ListId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','queue','interface','mandatoryDisposition','agentReadyId','not_inuse','status','push','getDiff','seconds','filterKey','idContact','campaigntype','scheduledat','countbusyretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl'];(function(_0x1ae417,_0x1b11dc){var _0x5ae66c=function(_0x58a91f){while(--_0x58a91f){_0x1ae417['push'](_0x1ae417['shift']());}};_0x5ae66c(++_0x1b11dc);}(_0x3fd5,0x1ac));var _0x53fd=function(_0x13ce7e,_0x50b8f3){_0x13ce7e=_0x13ce7e-0x0;var _0x4c1412=_0x3fd5[_0x13ce7e];return _0x4c1412;};'use strict';var util=require(_0x53fd('0x0'));var _=require(_0x53fd('0x1'));var moment=require(_0x53fd('0x2'));var logger=require(_0x53fd('0x3'))(_0x53fd('0x4'));var ipAgi=process[_0x53fd('0x5')][_0x53fd('0x6')]||_0x53fd('0x7');function getSeconds(_0x13195e,_0x3bf6b0){var _0x9dbdcf=moment(_0x13195e)[_0x53fd('0x8')](0x0);var _0x27b156=moment(_0x3bf6b0)[_0x53fd('0x8')](0x0);return _0x9dbdcf[_0x53fd('0x9')](_0x27b156,'seconds');}exports['loggerCatch']=function(_0x2604ca){return function(_0x376530){logger[_0x53fd('0xa')](_0x2604ca,util['inspect'](_0x376530,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x2278f7,_0x4479f6){logger[_0x53fd('0xb')](_0x2278f7,util[_0x53fd('0xc')](_0x4479f6,{'showHidden':![],'depth':null}));};exports[_0x53fd('0xd')]=function(_0x25179d,_0x3c8283){logger[_0x53fd('0xa')](_0x25179d,util[_0x53fd('0xc')](_0x3c8283,{'showHidden':![],'depth':null}));};exports[_0x53fd('0xe')]=function(_0x59df83){return function(_0x1d9f0d){logger['info'](_0x59df83,util['inspect'](_0x1d9f0d,{'showHidden':![],'depth':null}));};};exports[_0x53fd('0xf')]=function(_0x5acc4f,_0x6dd151,_0x9f1384){return{'message':_0x5acc4f,'unlock':_0x6dd151,'active':_0x9f1384};};exports[_0x53fd('0x10')]=function(_0xf0aa03,_0x343861,_0x1f5ab5){if(!_['isUndefined'](_0x1f5ab5)&&'string'===typeof _0x1f5ab5&&!_[_0x53fd('0x11')](_0x1f5ab5)){if(!_['isUndefined'](_0x343861)&&_0x53fd('0x12')===typeof _0x343861&&!_[_0x53fd('0x11')](_0x343861)){return util[_0x53fd('0x13')](_0x53fd('0x14'),_0x343861,_0x1f5ab5);}return util[_0x53fd('0x13')](_0x53fd('0x14'),_0x1f5ab5,_0x1f5ab5);}if(!_['isUndefined'](_0xf0aa03)&&_0x53fd('0x12')===typeof _0xf0aa03&&!_[_0x53fd('0x11')](_0xf0aa03)){return _0xf0aa03;}return _0x53fd('0x15');};exports[_0x53fd('0x16')]=function(_0x36999d){if(_['isNil'](_0x36999d)){return![];}return _0x36999d;};exports['addVariables']=function(_0x43c90f,_0x155224,_0x2571da,_0xfe781a,_0x494764,_0x492364){var _0x4a0e4c={'XMD-QUEUE':_0x155224[_0x53fd('0x17')]?_0x155224[_0x53fd('0x17')][_0x53fd('0x18')]:'','XMD-CALLERID':_0xfe781a,'XMD-CALLERID-PREVIEW':_0x492364?util[_0x53fd('0x13')]('\x22%s\x22\x20<%s>',_0x492364[_0x53fd('0x19')],_0x492364['calleridnum']):_0xfe781a,'XMD-DIALID':_0x494764,'XMD-CONTACTID':_0x155224[_0x53fd('0x1a')],'XMD-CDRTYPE':_0x53fd('0x1b'),'CALLERID(all)':_0xfe781a,'XMD-VOICEQUEUEID':_0x155224[_0x53fd('0x1c')],'XMD-DIALCHANNEL':_0x2571da,'XMD-DIALTIMEOUT':_0x43c90f[_0x53fd('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x53fd('0x13')](_0x53fd('0x1e'),_0x43c90f[_0x53fd('0x1f')]?'g':'',_[_0x53fd('0x11')](_0x43c90f[_0x53fd('0x20')])?'':_0x53fd('0x21')),'XMD-DIALURL':_0x43c90f[_0x53fd('0x22')]||'','XMD-AGI':_0x43c90f[_0x53fd('0x23')]?util[_0x53fd('0x13')](_0x53fd('0x24'),ipAgi,_0x43c90f['dialQueueProject']):_0x53fd('0x25'),'XMD-AGIAFTER':_0x43c90f[_0x53fd('0x1f')]?util['format'](_0x53fd('0x24'),ipAgi,_0x43c90f['dialQueueProject2']):_0x53fd('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x492364?_0x492364[_0x53fd('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x492364?_0x492364['originatecalleridname']:'','XMD-DESTINATION':_0x53fd('0x27')};if(!_[_0x53fd('0x11')](_0x43c90f['monitor_format'])){_0x4a0e4c[util[_0x53fd('0x13')]('%s',_0x53fd('0x28'))]=_0x43c90f['monitor_format'];_0x4a0e4c[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x494764;}if(_0x155224&&_0x155224[_0x53fd('0x29')]){for(var _0x4ee4d6 in _0x155224['Contact']){if(_0x155224[_0x53fd('0x29')][_0x53fd('0x2a')](_0x4ee4d6)){if(!_[_0x53fd('0x2b')](_0x155224[_0x53fd('0x29')][_0x4ee4d6])&&_0x4ee4d6!=='id'&&_0x4ee4d6!==_0x53fd('0x2c')&&_0x4ee4d6!==_0x53fd('0x2d')&&_0x4ee4d6!==_0x53fd('0x2e')){_0x4a0e4c[util[_0x53fd('0x13')]('%s%s',_0x53fd('0x2f'),_[_0x53fd('0x30')](_0x4ee4d6))]=_0x155224[_0x53fd('0x29')][_0x4ee4d6];}}}}return _0x4a0e4c;};exports[_0x53fd('0x31')]=function(_0x35aba5){var _0xe430ca={};for(var _0x1cb4c0 in _0x35aba5){if(_0x35aba5[_0x53fd('0x2a')](_0x1cb4c0)){_0xe430ca[util[_0x53fd('0x13')]('%s',_['toLower'](_0x1cb4c0))]=_0x35aba5[_0x1cb4c0];}}return{'variables':_0xe430ca};};exports[_0x53fd('0x32')]=function(_0x1fadba,_0x100b79){if(!_['isNil'](_0x1fadba)){if(_0x1fadba[_0x53fd('0x2a')](_0x53fd('0x33'))){if(_0x1fadba[_0x53fd('0x33')]>0x0){_0x1fadba[_0x53fd('0x33')]-=0x1;}else{logger[_0x53fd('0xa')](_0x53fd('0x34'),_0x100b79);}}}else{logger[_0x53fd('0xa')](_0x53fd('0x35'),_0x100b79);}};exports[_0x53fd('0x36')]=function(_0x494cc8){var _0x8daa0a=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x494cc8[_0x53fd('0x37')]=0xd;_0x494cc8['statedesc']='Blacklist';_0x494cc8[_0x53fd('0x38')]=_0x8daa0a;_0x494cc8['responsetime']=_0x8daa0a;_0x494cc8[_0x53fd('0x39')]=_0x8daa0a;};exports['logAgent']=function(_0x23fc08,_0xc855d0,_0x54e4d3){var _0x1d58c1=moment()[_0x53fd('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x23fc08[_0x53fd('0x37')]=_0xc855d0;_0x23fc08[_0x53fd('0x3a')]=_0x54e4d3;_0x23fc08[_0x53fd('0x3b')]=_0x1d58c1;_0x23fc08['ringtime']=getSeconds(_0x23fc08[_0x53fd('0x3b')],_0x23fc08[_0x53fd('0x38')]);};exports['logLookAgent']=function(_0x26d26c,_0x3c45b5,_0x314f5a){_0x26d26c[_0x53fd('0x3c')]=_0x3c45b5;_0x26d26c['UserId']=_0x314f5a;};exports[_0x53fd('0x3d')]=function(_0x301c51,_0xab49af,_0x2556a0){var _0x37b162=moment()[_0x53fd('0x13')](_0x53fd('0x3e'));_0x301c51[_0x53fd('0x37')]=_0xab49af;_0x301c51[_0x53fd('0x3a')]=_0x2556a0;_0x301c51[_0x53fd('0x3b')]=_0x301c51[_0x53fd('0x3b')]?_0x301c51[_0x53fd('0x3b')]:_0x37b162;_0x301c51['endtime']=_0x301c51[_0x53fd('0x39')]?_0x301c51[_0x53fd('0x39')]:_0x37b162;_0x301c51[_0x53fd('0x3f')]=getSeconds(_0x301c51[_0x53fd('0x3b')]||0x0,_0x301c51[_0x53fd('0x38')]||0x0);_0x301c51[_0x53fd('0x40')]=_0x301c51[_0x53fd('0x41')]?getSeconds(_0x301c51['endtime'],_0x301c51['answertime']):0x0;};exports[_0x53fd('0x42')]=function(_0x389ca8){return _0x389ca8==='Failure';};exports[_0x53fd('0x43')]=function(_0x4d6588,_0x273371,_0x5e34ca,_0x46cf25,_0x16a884){var _0x4f7a10=_0x46cf25?'RECALL':_0x4d6588['calleridname'];_0x4f7a10=_0x16a884?_0x53fd('0x44'):_0x4f7a10;return{'actionid':_0x4d6588[_0x53fd('0x45')],'action':_0x53fd('0x46'),'channel':_0x4d6588[_0x53fd('0x47')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x4f7a10,_0x4d6588[_0x53fd('0x48')]),'Exten':_0x53fd('0x27'),'Context':'from-sip','Priority':'1','variable':_0x5e34ca,'timeout':(_0x273371[_0x53fd('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4d6588[_0x53fd('0x45')]};};exports[_0x53fd('0x4a')]=function(_0x30942c){return _0x30942c['countbusyretry']+_0x30942c[_0x53fd('0x4b')]+_0x30942c['countnoanswerretry']+_0x30942c[_0x53fd('0x4c')]+_0x30942c[_0x53fd('0x4d')];};exports['cloneAction']=function(_0x333a87){var _0x29dfaa=_[_0x53fd('0x4e')](_0x333a87);_0x29dfaa[_0x53fd('0x37')]=0xf;_0x29dfaa[_0x53fd('0x3a')]=_0x53fd('0x4f');return _0x29dfaa;};exports['scheduledAt']=function(_0x274ca4,_0x4e64bf,_0x5bf3b0){var _0x37b72e={};_0x37b72e[_0x4e64bf]=_0x274ca4[_0x4e64bf];_0x37b72e[_0x53fd('0x50')]=![];_0x37b72e['scheduledat']=moment()[_0x53fd('0x51')](_0x5bf3b0,_0x53fd('0x52'))[_0x53fd('0x13')](_0x53fd('0x3e'));_0x37b72e[_0x53fd('0x1a')]=_0x274ca4['ContactId'];_0x37b72e['ListId']=_0x274ca4[_0x53fd('0x53')];_0x37b72e[_0x53fd('0x1c')]=_0x274ca4['VoiceQueueId']||undefined;return _0x37b72e;};exports['decrementTalkink']=function(_0x5aea04,_0x45855a){if(!_['isNil'](_0x5aea04)){if(_0x5aea04[_0x53fd('0x54')]>0x0){_0x5aea04[_0x53fd('0x54')]-=0x1;}else{logger['error'](_0x45855a,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x53fd('0xa')](_0x45855a,_0x53fd('0x55'));}};exports['IsNotLoggedIn']=function(_0x126f63){if(_0x126f63<=0x0){return!![];}return![];};exports['buildObj']=function(_0x2c129d,_0x2643c1,_0x21b95e){_0x2c129d['lastevent']=_0x2643c1;_0x2c129d['name']=_0x2c129d[_0x53fd('0x56')];_0x2c129d[_0x53fd('0x57')]=_0x2c129d[_0x53fd('0x47')];if(_0x21b95e){_0x2c129d[_0x53fd('0x58')]=_0x21b95e[_0x53fd('0x58')];}return _0x2c129d;};exports['buildAcw']=function(_0x4723c2){var _0x1f8175={};_0x1f8175[_0x53fd('0x56')]=_0x4723c2[_0x53fd('0x56')];_0x1f8175[_0x53fd('0x57')]=_0x4723c2['channelAgent'];_0x1f8175[_0x53fd('0x45')]=_0x4723c2[_0x53fd('0x45')];return _0x1f8175;};exports[_0x53fd('0x59')]=function(_0x2c8d57){var _0x1918e3=[];for(var _0x3a6d03 in _0x2c8d57){if(_0x2c8d57[_0x53fd('0x2a')](_0x3a6d03)){if(!_['isNil'](_0x2c8d57[_0x3a6d03])&&_0x2c8d57[_0x3a6d03][_0x53fd('0x37')]===_0x53fd('0x5a')&&_0x2c8d57[_0x3a6d03][_0x53fd('0x5b')]==='reachable'){_0x1918e3[_0x53fd('0x5c')](_0x2c8d57[_0x3a6d03]['id']);}}}return _0x1918e3;};exports[_0x53fd('0x5d')]=function(_0x855633){var _0x5d8e97=moment()['milliseconds'](0x0);var _0x55c66f=moment(_0x855633)[_0x53fd('0x8')](0x0);return _0x5d8e97[_0x53fd('0x9')](_0x55c66f,_0x53fd('0x5e'));};exports['createBody']=function(_0x29f430){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x29f430[_0x53fd('0x1a')],'ListId':_0x29f430[_0x53fd('0x53')],'VoiceQueueId':_0x29f430[_0x53fd('0x1c')]||undefined,'CampaignId':_0x29f430['CampaignId']||undefined};};exports[_0x53fd('0x5f')]=function(_0x1ca414){if(_0x1ca414===_0x53fd('0x45')||_0x1ca414===_0x53fd('0x60')||_0x1ca414==='queue'||_0x1ca414==='type'||_0x1ca414===_0x53fd('0x61')||_0x1ca414==='dialAnswer'||_0x1ca414===_0x53fd('0x3c')||_0x1ca414===_0x53fd('0x47')||_0x1ca414===_0x53fd('0x19')||_0x1ca414==='active'||_0x1ca414===_0x53fd('0x48')||_0x1ca414===_0x53fd('0x62')||_0x1ca414===_0x53fd('0x63')||_0x1ca414===_0x53fd('0x4b')||_0x1ca414===_0x53fd('0x64')||_0x1ca414===_0x53fd('0x65')||_0x1ca414===_0x53fd('0x66')||_0x1ca414===_0x53fd('0x67')||_0x1ca414===_0x53fd('0x68')||_0x1ca414===_0x53fd('0x69')||_0x1ca414==='ContactId'||_0x1ca414===_0x53fd('0x53')||_0x1ca414===_0x53fd('0x6a')||_0x1ca414===_0x53fd('0x1c')||_0x1ca414===_0x53fd('0x6b')||_0x1ca414===_0x53fd('0x6c')||_0x1ca414==='xmd-queue'||_0x1ca414===_0x53fd('0x6d')||_0x1ca414===_0x53fd('0x6e')||_0x1ca414===_0x53fd('0x6f')||_0x1ca414===_0x53fd('0x70')||_0x1ca414===_0x53fd('0x71')||_0x1ca414==='xmd-dialid'||_0x1ca414===_0x53fd('0x72')||_0x1ca414===_0x53fd('0x73')||_0x1ca414===_0x53fd('0x74')||_0x1ca414===_0x53fd('0x75')||_0x1ca414===_0x53fd('0x76')||_0x1ca414===_0x53fd('0x77')||_0x1ca414===_0x53fd('0x78')||_0x1ca414===_0x53fd('0x79')||_0x1ca414==='rtpaudioqosjitter'||_0x1ca414==='rtpaudioqosjitterbridged'||_0x1ca414===_0x53fd('0x7a')||_0x1ca414===_0x53fd('0x7b')||_0x1ca414==='rtpaudioqosrtt'||_0x1ca414===_0x53fd('0x7c')||_0x1ca414===_0x53fd('0x78')||_0x1ca414===_0x53fd('0x79')||_0x1ca414===_0x53fd('0x7d')||_0x1ca414===_0x53fd('0x7e')||_0x1ca414==='rtpaudioqosloss'||_0x1ca414===_0x53fd('0x7b')||_0x1ca414==='rtpaudioqosrtt'||_0x1ca414===_0x53fd('0x7c')||_0x1ca414===_0x53fd('0x7f')||_0x1ca414==='bridgepvtcallid'||_0x1ca414===_0x53fd('0x37')||_0x1ca414===_0x53fd('0x3a')){return![];}return!![];};exports[_0x53fd('0x80')]=function(_0x304cd6,_0x7e6724){var _0xbb91c7,_0x2610cf,_0x110b29;if(_0x7e6724<=0x0){_0x7e6724=0x1;}_0xbb91c7=new RegExp(_0x53fd('0x81')+_0x7e6724+'}$');_0x2610cf=Math[_0x53fd('0x82')](0xa,_0x7e6724-0x1);_0x110b29=Math['pow'](0xa,_0x7e6724)-0x1;return util[_0x53fd('0x13')]('%s',_[_0x53fd('0x83')](_0x304cd6,_0xbb91c7,_[_0x53fd('0x84')](_0x2610cf,_0x110b29)));};exports['extractCalleridName']=function(_0x219f43){var _0x320ae5=_0x219f43[_0x53fd('0x85')](/"(.*?)"/);return _0x320ae5?_0x320ae5[0x1]:_0x219f43;};exports[_0x53fd('0x86')]=function(_0x5e0cfb){var _0x3812e8=_0x5e0cfb[_0x53fd('0x85')](/<(.*?)>/);return _0x3812e8?_0x3812e8[0x1]:_0x5e0cfb;}; \ No newline at end of file +var _0x48db=['isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','isFailure','RECALL','BOOKED','originate','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','name','queue','interface','channelAgent','mandatoryDisposition','buildAcw','not_inuse','status','push','diff','seconds','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','active','calleridnum','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','lodash','moment','../../../../config/logger','preview','env','127.0.0.1','milliseconds','loggerCatch','error','info','inspect','loggerError','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','calleridname','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','xcally-motion-preview','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','toLowerVariables'];(function(_0x27c3f0,_0x198aa2){var _0x11e51c=function(_0x2a48ec){while(--_0x2a48ec){_0x27c3f0['push'](_0x27c3f0['shift']());}};_0x11e51c(++_0x198aa2);}(_0x48db,0x160));var _0xb48d=function(_0x2e884d,_0x3e18d7){_0x2e884d=_0x2e884d-0x0;var _0x4d4f93=_0x48db[_0x2e884d];return _0x4d4f93;};'use strict';var util=require('util');var _=require(_0xb48d('0x0'));var moment=require(_0xb48d('0x1'));var logger=require(_0xb48d('0x2'))(_0xb48d('0x3'));var ipAgi=process[_0xb48d('0x4')]['XCALLY_IP_AGI']||_0xb48d('0x5');function getSeconds(_0x16bcbc,_0x3b094c){var _0x2ab70a=moment(_0x16bcbc)[_0xb48d('0x6')](0x0);var _0x200c5d=moment(_0x3b094c)[_0xb48d('0x6')](0x0);return _0x2ab70a['diff'](_0x200c5d,'seconds');}exports[_0xb48d('0x7')]=function(_0x37c8e1){return function(_0x4072db){logger[_0xb48d('0x8')](_0x37c8e1,util['inspect'](_0x4072db,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x6b0dd7,_0x1fb5ef){logger[_0xb48d('0x9')](_0x6b0dd7,util[_0xb48d('0xa')](_0x1fb5ef,{'showHidden':![],'depth':null}));};exports[_0xb48d('0xb')]=function(_0x3842ff,_0x1b98b3){logger[_0xb48d('0x8')](_0x3842ff,util['inspect'](_0x1b98b3,{'showHidden':![],'depth':null}));};exports[_0xb48d('0xc')]=function(_0x3ac55e){return function(_0x5f419e){logger[_0xb48d('0x9')](_0x3ac55e,util[_0xb48d('0xa')](_0x5f419e,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x22ba8f,_0x240a45,_0xff2add){return{'message':_0x22ba8f,'unlock':_0x240a45,'active':_0xff2add};};exports[_0xb48d('0xd')]=function(_0x1d2762,_0x41908d,_0x2fe32b){if(!_[_0xb48d('0xe')](_0x2fe32b)&&'string'===typeof _0x2fe32b&&!_['isEmpty'](_0x2fe32b)){if(!_['isUndefined'](_0x41908d)&&_0xb48d('0xf')===typeof _0x41908d&&!_[_0xb48d('0x10')](_0x41908d)){return util[_0xb48d('0x11')]('\x22%s\x22\x20<%s>',_0x41908d,_0x2fe32b);}return util[_0xb48d('0x11')](_0xb48d('0x12'),_0x2fe32b,_0x2fe32b);}if(!_[_0xb48d('0xe')](_0x1d2762)&&_0xb48d('0xf')===typeof _0x1d2762&&!_['isEmpty'](_0x1d2762)){return _0x1d2762;}return _0xb48d('0x13');};exports[_0xb48d('0x14')]=function(_0x34704c){if(_['isNil'](_0x34704c)){return![];}return _0x34704c;};exports[_0xb48d('0x15')]=function(_0x37700b,_0xc04a3b,_0x129947,_0x20ca84,_0x329e1c,_0x11bdf2){var _0x236fc5={'XMD-QUEUE':_0xc04a3b[_0xb48d('0x16')]?_0xc04a3b[_0xb48d('0x16')]['name']:'','XMD-CALLERID':_0x20ca84,'XMD-CALLERID-PREVIEW':_0x11bdf2?util[_0xb48d('0x11')]('\x22%s\x22\x20<%s>',_0x11bdf2[_0xb48d('0x17')],_0x11bdf2['calleridnum']):_0x20ca84,'XMD-DIALID':_0x329e1c,'XMD-CONTACTID':_0xc04a3b[_0xb48d('0x18')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x20ca84,'XMD-VOICEQUEUEID':_0xc04a3b[_0xb48d('0x19')],'XMD-DIALCHANNEL':_0x129947,'XMD-DIALTIMEOUT':_0x37700b[_0xb48d('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0xb48d('0x11')](_0xb48d('0x1b'),_0x37700b['dialQueueProject2']?'g':'',_[_0xb48d('0x10')](_0x37700b[_0xb48d('0x1c')])?'':_0xb48d('0x1d')),'XMD-DIALURL':_0x37700b['dialPreviewUrl']||'','XMD-AGI':_0x37700b[_0xb48d('0x1e')]?util[_0xb48d('0x11')](_0xb48d('0x1f'),ipAgi,_0x37700b[_0xb48d('0x1e')]):_0xb48d('0x20'),'XMD-AGIAFTER':_0x37700b[_0xb48d('0x21')]?util[_0xb48d('0x11')](_0xb48d('0x1f'),ipAgi,_0x37700b['dialQueueProject2']):_0xb48d('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x11bdf2?_0x11bdf2['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x11bdf2?_0x11bdf2['originatecalleridname']:'','XMD-DESTINATION':_0xb48d('0x22')};if(!_[_0xb48d('0x10')](_0x37700b[_0xb48d('0x1c')])){_0x236fc5[util[_0xb48d('0x11')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x37700b[_0xb48d('0x1c')];_0x236fc5[util[_0xb48d('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x329e1c;}if(_0xc04a3b&&_0xc04a3b[_0xb48d('0x23')]){for(var _0x4a4c9a in _0xc04a3b['Contact']){if(_0xc04a3b[_0xb48d('0x23')][_0xb48d('0x24')](_0x4a4c9a)){if(!_['isNil'](_0xc04a3b[_0xb48d('0x23')][_0x4a4c9a])&&_0x4a4c9a!=='id'&&_0x4a4c9a!=='tags'&&_0x4a4c9a!==_0xb48d('0x25')&&_0x4a4c9a!==_0xb48d('0x26')){_0x236fc5[util[_0xb48d('0x11')](_0xb48d('0x27'),'XMD-',_['toUpper'](_0x4a4c9a))]=_0xc04a3b[_0xb48d('0x23')][_0x4a4c9a];}}}}return _0x236fc5;};exports[_0xb48d('0x28')]=function(_0xd5022f){var _0x161f7c={};for(var _0x53b491 in _0xd5022f){if(_0xd5022f[_0xb48d('0x24')](_0x53b491)){_0x161f7c[util[_0xb48d('0x11')]('%s',_['toLower'](_0x53b491))]=_0xd5022f[_0x53b491];}}return{'variables':_0x161f7c};};exports['updateOriginated']=function(_0x518719,_0x57ed9e){if(!_[_0xb48d('0x29')](_0x518719)){if(_0x518719[_0xb48d('0x24')](_0xb48d('0x2a'))){if(_0x518719['originated']>0x0){_0x518719[_0xb48d('0x2a')]-=0x1;}else{logger[_0xb48d('0x8')](_0xb48d('0x2b'),_0x57ed9e);}}}else{logger[_0xb48d('0x8')](_0xb48d('0x2c'),_0x57ed9e);}};exports['logBlacklist']=function(_0x2c0c3e){var _0x90c609=moment()[_0xb48d('0x11')](_0xb48d('0x2d'));_0x2c0c3e[_0xb48d('0x2e')]=0xd;_0x2c0c3e[_0xb48d('0x2f')]=_0xb48d('0x30');_0x2c0c3e[_0xb48d('0x31')]=_0x90c609;_0x2c0c3e[_0xb48d('0x32')]=_0x90c609;_0x2c0c3e[_0xb48d('0x33')]=_0x90c609;};exports[_0xb48d('0x34')]=function(_0x2dd230,_0x4f3f0a,_0x47ece5){var _0x145f8d=moment()[_0xb48d('0x11')](_0xb48d('0x2d'));_0x2dd230['state']=_0x4f3f0a;_0x2dd230[_0xb48d('0x2f')]=_0x47ece5;_0x2dd230[_0xb48d('0x32')]=_0x145f8d;_0x2dd230[_0xb48d('0x35')]=getSeconds(_0x2dd230['responsetime'],_0x2dd230[_0xb48d('0x31')]);};exports[_0xb48d('0x36')]=function(_0xaa586,_0x365328,_0x302352){_0xaa586[_0xb48d('0x37')]=_0x365328;_0xaa586[_0xb48d('0x38')]=_0x302352;};exports[_0xb48d('0x39')]=function(_0x4da7e6,_0x37c926,_0x22ba37){var _0x3e2025=moment()[_0xb48d('0x11')](_0xb48d('0x2d'));_0x4da7e6[_0xb48d('0x2e')]=_0x37c926;_0x4da7e6['statedesc']=_0x22ba37;_0x4da7e6['responsetime']=_0x4da7e6[_0xb48d('0x32')]?_0x4da7e6[_0xb48d('0x32')]:_0x3e2025;_0x4da7e6[_0xb48d('0x33')]=_0x4da7e6['endtime']?_0x4da7e6['endtime']:_0x3e2025;_0x4da7e6[_0xb48d('0x35')]=getSeconds(_0x4da7e6[_0xb48d('0x32')]||0x0,_0x4da7e6[_0xb48d('0x31')]||0x0);_0x4da7e6['talktime']=_0x4da7e6['answertime']?getSeconds(_0x4da7e6['endtime'],_0x4da7e6['answertime']):0x0;};exports[_0xb48d('0x3a')]=function(_0x40bca7){return _0x40bca7==='Failure';};exports['variablesAction']=function(_0x34add2,_0x533158,_0x3bf817,_0xbc68e3,_0x2bc19d){var _0x46e25f=_0xbc68e3?_0xb48d('0x3b'):_0x34add2['calleridname'];_0x46e25f=_0x2bc19d?_0xb48d('0x3c'):_0x46e25f;return{'actionid':_0x34add2['uniqueid'],'action':_0xb48d('0x3d'),'channel':_0x34add2['channelAgent'],'callerid':util['format'](_0xb48d('0x12'),_0x46e25f,_0x34add2['calleridnum']),'Exten':_0xb48d('0x22'),'Context':_0xb48d('0x3e'),'Priority':'1','variable':_0x3bf817,'timeout':(_0x533158[_0xb48d('0x3f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x34add2[_0xb48d('0x40')]};};exports[_0xb48d('0x41')]=function(_0x4e5638){return _0x4e5638[_0xb48d('0x42')]+_0x4e5638['countcongestionretry']+_0x4e5638[_0xb48d('0x43')]+_0x4e5638[_0xb48d('0x44')]+_0x4e5638[_0xb48d('0x45')];};exports[_0xb48d('0x46')]=function(_0x3318dc){var _0x272544=_['clone'](_0x3318dc);_0x272544[_0xb48d('0x2e')]=0xf;_0x272544[_0xb48d('0x2f')]=_0xb48d('0x47');return _0x272544;};exports['scheduledAt']=function(_0x4da990,_0x369251,_0x4fc1c4){var _0x1de420={};_0x1de420[_0x369251]=_0x4da990[_0x369251];_0x1de420['active']=![];_0x1de420[_0xb48d('0x48')]=moment()['add'](_0x4fc1c4,_0xb48d('0x49'))[_0xb48d('0x11')](_0xb48d('0x2d'));_0x1de420[_0xb48d('0x18')]=_0x4da990[_0xb48d('0x18')];_0x1de420[_0xb48d('0x4a')]=_0x4da990[_0xb48d('0x4a')];_0x1de420[_0xb48d('0x19')]=_0x4da990[_0xb48d('0x19')]||undefined;return _0x1de420;};exports[_0xb48d('0x4b')]=function(_0xd1a75d,_0xf95e0c){if(!_[_0xb48d('0x29')](_0xd1a75d)){if(_0xd1a75d[_0xb48d('0x4c')]>0x0){_0xd1a75d[_0xb48d('0x4c')]-=0x1;}else{logger[_0xb48d('0x8')](_0xf95e0c,_0xb48d('0x4d'));}}else{logger['error'](_0xf95e0c,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xb48d('0x4e')]=function(_0x19e9ca){if(_0x19e9ca<=0x0){return!![];}return![];};exports[_0xb48d('0x4f')]=function(_0x59ba78,_0x3b74aa,_0x33ad72){_0x59ba78[_0xb48d('0x50')]=_0x3b74aa;_0x59ba78[_0xb48d('0x51')]=_0x59ba78[_0xb48d('0x52')];_0x59ba78[_0xb48d('0x53')]=_0x59ba78[_0xb48d('0x54')];if(_0x33ad72){_0x59ba78[_0xb48d('0x55')]=_0x33ad72['mandatoryDisposition'];}return _0x59ba78;};exports[_0xb48d('0x56')]=function(_0xd47c7e){var _0x4b4f98={};_0x4b4f98['queue']=_0xd47c7e[_0xb48d('0x52')];_0x4b4f98['interface']=_0xd47c7e[_0xb48d('0x54')];_0x4b4f98['uniqueid']=_0xd47c7e[_0xb48d('0x40')];return _0x4b4f98;};exports['agentReadyId']=function(_0x1a7b58){var _0x41b415=[];for(var _0x1a6708 in _0x1a7b58){if(_0x1a7b58[_0xb48d('0x24')](_0x1a6708)){if(!_[_0xb48d('0x29')](_0x1a7b58[_0x1a6708])&&_0x1a7b58[_0x1a6708][_0xb48d('0x2e')]===_0xb48d('0x57')&&_0x1a7b58[_0x1a6708][_0xb48d('0x58')]==='reachable'){_0x41b415[_0xb48d('0x59')](_0x1a7b58[_0x1a6708]['id']);}}}return _0x41b415;};exports['getDiff']=function(_0x2198c2){var _0x382fea=moment()[_0xb48d('0x6')](0x0);var _0x59a77c=moment(_0x2198c2)['milliseconds'](0x0);return _0x382fea[_0xb48d('0x5a')](_0x59a77c,_0xb48d('0x5b'));};exports[_0xb48d('0x5c')]=function(_0x451d51){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x451d51['ContactId'],'ListId':_0x451d51[_0xb48d('0x4a')],'VoiceQueueId':_0x451d51['VoiceQueueId']||undefined,'CampaignId':_0x451d51[_0xb48d('0x5d')]||undefined};};exports[_0xb48d('0x5e')]=function(_0x37e0c6){if(_0x37e0c6===_0xb48d('0x40')||_0x37e0c6===_0xb48d('0x5f')||_0x37e0c6===_0xb48d('0x52')||_0x37e0c6==='type'||_0x37e0c6===_0xb48d('0x60')||_0x37e0c6===_0xb48d('0x61')||_0x37e0c6==='membername'||_0x37e0c6===_0xb48d('0x54')||_0x37e0c6===_0xb48d('0x17')||_0x37e0c6===_0xb48d('0x62')||_0x37e0c6===_0xb48d('0x63')||_0x37e0c6==='scheduledat'||_0x37e0c6===_0xb48d('0x42')||_0x37e0c6===_0xb48d('0x64')||_0x37e0c6===_0xb48d('0x43')||_0x37e0c6===_0xb48d('0x65')||_0x37e0c6===_0xb48d('0x66')||_0x37e0c6===_0xb48d('0x67')||_0x37e0c6===_0xb48d('0x68')||_0x37e0c6===_0xb48d('0x69')||_0x37e0c6===_0xb48d('0x18')||_0x37e0c6===_0xb48d('0x4a')||_0x37e0c6==='UserId'||_0x37e0c6==='VoiceQueueId'||_0x37e0c6===_0xb48d('0x6a')||_0x37e0c6===_0xb48d('0x6b')||_0x37e0c6==='xmd-queue'||_0x37e0c6===_0xb48d('0x6c')||_0x37e0c6==='xmd-listid'||_0x37e0c6==='xmd-dialurl'||_0x37e0c6===_0xb48d('0x6d')||_0x37e0c6===_0xb48d('0x6e')||_0x37e0c6==='xmd-dialid'||_0x37e0c6===_0xb48d('0x6f')||_0x37e0c6===_0xb48d('0x70')||_0x37e0c6===_0xb48d('0x71')||_0x37e0c6===_0xb48d('0x72')||_0x37e0c6==='xmd-agiafter'||_0x37e0c6===_0xb48d('0x73')||_0x37e0c6==='rtpaudioqos'||_0x37e0c6===_0xb48d('0x74')||_0x37e0c6===_0xb48d('0x75')||_0x37e0c6===_0xb48d('0x76')||_0x37e0c6===_0xb48d('0x77')||_0x37e0c6==='rtpaudioqoslossbridged'||_0x37e0c6==='rtpaudioqosrtt'||_0x37e0c6===_0xb48d('0x78')||_0x37e0c6==='rtpaudioqos'||_0x37e0c6===_0xb48d('0x74')||_0x37e0c6===_0xb48d('0x75')||_0x37e0c6===_0xb48d('0x76')||_0x37e0c6===_0xb48d('0x77')||_0x37e0c6===_0xb48d('0x79')||_0x37e0c6===_0xb48d('0x7a')||_0x37e0c6===_0xb48d('0x78')||_0x37e0c6===_0xb48d('0x7b')||_0x37e0c6==='bridgepvtcallid'||_0x37e0c6==='state'||_0x37e0c6===_0xb48d('0x2f')){return![];}return!![];};exports[_0xb48d('0x7c')]=function(_0x29c21d,_0x26acf0){var _0x2c532b,_0x3a01f2,_0x408630;if(_0x26acf0<=0x0){_0x26acf0=0x1;}_0x2c532b=new RegExp(_0xb48d('0x7d')+_0x26acf0+'}$');_0x3a01f2=Math[_0xb48d('0x7e')](0xa,_0x26acf0-0x1);_0x408630=Math['pow'](0xa,_0x26acf0)-0x1;return util[_0xb48d('0x11')]('%s',_[_0xb48d('0x7f')](_0x29c21d,_0x2c532b,_['random'](_0x3a01f2,_0x408630)));};exports[_0xb48d('0x80')]=function(_0x1cbe51){var _0x3ecfd5=_0x1cbe51[_0xb48d('0x81')](/"(.*?)"/);return _0x3ecfd5?_0x3ecfd5[0x1]:_0x1cbe51;};exports[_0xb48d('0x82')]=function(_0x523636){var _0x594a68=_0x523636[_0xb48d('0x81')](/<(.*?)>/);return _0x594a68?_0x594a68[0x1]:_0x523636;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 7f73c98..8e7b630 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 _0x9139=['reload','queueadd','string','boolean','queueremove','queuepause'];(function(_0xf61d62,_0x5e1ce1){var _0x1b8b00=function(_0x21dbba){while(--_0x21dbba){_0xf61d62['push'](_0xf61d62['shift']());}};_0x1b8b00(++_0x5e1ce1);}(_0x9139,0x1bd));var _0x9913=function(_0x52b7d5,_0x34f791){_0x52b7d5=_0x52b7d5-0x0;var _0x1ef7c6=_0x9139[_0x52b7d5];return _0x1ef7c6;};'use strict';exports[_0x9913('0x0')]={'queue':{'type':_0x9913('0x1'),'required':!![]},'interface':{'type':_0x9913('0x1'),'required':!![]},'membername':{'type':_0x9913('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x9913('0x2'),'required':![]}};exports[_0x9913('0x3')]={'queue':{'type':_0x9913('0x1'),'required':!![]},'interface':{'type':_0x9913('0x1'),'required':!![]}};exports[_0x9913('0x4')]={'interface':{'type':_0x9913('0x1'),'required':!![]},'paused':{'type':_0x9913('0x2')},'reason':{'type':'string','required':![]}};exports[_0x9913('0x5')]={'module':{'type':_0x9913('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x9913('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x9913('0x1'),'required':!![]},'filename':{'type':_0x9913('0x1')},'format':{'type':_0x9913('0x1')},'mixmonitorid':{'type':_0x9913('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x9913('0x1'),'required':!![]},'context':{'type':_0x9913('0x1')}}; \ No newline at end of file +var _0x37df=['string','number','queuepause','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd'];(function(_0x5494b2,_0x2f28b8){var _0x346754=function(_0x14178d){while(--_0x14178d){_0x5494b2['push'](_0x5494b2['shift']());}};_0x346754(++_0x2f28b8);}(_0x37df,0x195));var _0xf37d=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0x37df[_0x589aee];return _0x2f5ed4;};'use strict';exports[_0xf37d('0x0')]={'queue':{'type':_0xf37d('0x1'),'required':!![]},'interface':{'type':_0xf37d('0x1'),'required':!![]},'membername':{'type':_0xf37d('0x1'),'required':!![]},'penalty':{'type':_0xf37d('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0xf37d('0x1'),'required':!![]},'interface':{'type':_0xf37d('0x1'),'required':!![]}};exports[_0xf37d('0x3')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xf37d('0x1'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0xf37d('0x4')]={'uniqueid':{'type':_0xf37d('0x1'),'required':!![]}};exports[_0xf37d('0x5')]={'uniqueid':{'type':_0xf37d('0x1'),'required':!![]},'filename':{'type':_0xf37d('0x1')},'format':{'type':_0xf37d('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xf37d('0x6')]={'uniqueid':{'type':_0xf37d('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xf37d('0x1'),'required':!![]},'context':{'type':_0xf37d('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index ebfdd43..c118eaf 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 _0x82fd=['isEmpty','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','agents','length','isUndefined','prototype','initTelephones','initTrunks','trunks','voiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','merge','initVoiceQueueReports','groupBy','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','disposition','ANSWERED','duration','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','triggers','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','name','isNil','interface','format','SIP/%s','hasOwnProperty','total','answered','sumDuration','sumBillable'];(function(_0x1e0ec6,_0x2a561e){var _0x9c94ba=function(_0xfdc01c){while(--_0xfdc01c){_0x1e0ec6['push'](_0x1e0ec6['shift']());}};_0x9c94ba(++_0x2a561e);}(_0x82fd,0xaa));var _0xd82f=function(_0xdaae6e,_0x2d9af6){_0xdaae6e=_0xdaae6e-0x0;var _0x27f9f5=_0x82fd[_0xdaae6e];return _0x27f9f5;};'use strict';var BPromise=require(_0xd82f('0x0'));var util=require(_0xd82f('0x1'));var _=require(_0xd82f('0x2'));var moment=require(_0xd82f('0x3'));var Agent=require(_0xd82f('0x4'));var Telephone=require(_0xd82f('0x5'));var Trunk=require(_0xd82f('0x6'));var VoiceQueue=require(_0xd82f('0x7'));var Trigger=require(_0xd82f('0x8'));var Template=require(_0xd82f('0x9'));var Campaign=require(_0xd82f('0xa'));var VoiceExtension=require(_0xd82f('0xb'));var ZendeskAccount=require(_0xd82f('0xc'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xd82f('0xd'));var SugarcrmAccount=require(_0xd82f('0xe'));var ZohoAccount=require(_0xd82f('0xf'));var DeskAccount=require(_0xd82f('0x10'));var VtigerAccount=require(_0xd82f('0x11'));var ServicenowAccount=require(_0xd82f('0x12'));var Dynamics365Account=require(_0xd82f('0x13'));var FreshsalesAccount=require(_0xd82f('0x14'));var FaxAccount=require(_0xd82f('0x15'));var Realtime=function(){this['agents']={};this[_0xd82f('0x16')]={};this['trunks']={};this['voiceQueues']={};this[_0xd82f('0x17')]={};this[_0xd82f('0x18')]={};this['templates']={};this[_0xd82f('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xd82f('0x1a')]={};this[_0xd82f('0x1b')]={};this[_0xd82f('0x1c')]={};this[_0xd82f('0x1d')]={};this[_0xd82f('0x1e')]={};this[_0xd82f('0x1f')]={};this[_0xd82f('0x20')]={};this[_0xd82f('0x21')]={};this[_0xd82f('0x22')]={};this[_0xd82f('0x23')]={};this[_0xd82f('0x24')]={};this[_0xd82f('0x25')]={};this[_0xd82f('0x26')]={};this['servicenowAccounts']={};this[_0xd82f('0x27')]={};this[_0xd82f('0x28')]={};this[_0xd82f('0x29')]={};};function freeIsNotKey(_0x878d40,_0x10d710,_0x294a07){var _0x26b241=_['mapKeys'](_0x878d40,function(_0x7e7dc3,_0x4bcaad){return _0x7e7dc3[_0x294a07];});for(var _0x4898e0 in _0x10d710){if(_0x10d710['hasOwnProperty'](_0x4898e0)){if(!_0x26b241[_0x4898e0]){delete _0x10d710[_0x4898e0];}}}}function freeIsNotKeySip(_0x4ca7fd,_0x1a2e83){var _0x3637a9=_['mapKeys'](_0x4ca7fd,function(_0x41f28c,_0x3ded56){return util['format']('SIP/%s',_0x41f28c[_0xd82f('0x2a')]);});for(var _0x456999 in _0x1a2e83){if(_0x1a2e83['hasOwnProperty'](_0x456999)){if(!_0x3637a9[_0x456999]){delete _0x1a2e83[_0x456999];}}}}function freeIsNotKeyAgent(_0x46c206,_0x28d598){var _0x15e3eb=_['mapKeys'](_0x46c206,function(_0x4fe849,_0x570ee9){var _0x9dc90d=_[_0xd82f('0x2b')](_0x4fe849[_0xd82f('0x2c')])?util[_0xd82f('0x2d')](_0xd82f('0x2e'),_0x4fe849[_0xd82f('0x2a')]):_0x4fe849[_0xd82f('0x2c')];return _0x9dc90d;});for(var _0x26d929 in _0x28d598){if(_0x28d598[_0xd82f('0x2f')](_0x26d929)){if(!_0x15e3eb[_0x26d929]){delete _0x28d598[_0x26d929];}}}}function clearVoiceCallReports(_0x335f54){_0x335f54[_0xd82f('0x30')]=0x0;_0x335f54[_0xd82f('0x31')]=0x0;_0x335f54['sumHoldTime']=0x0;_0x335f54[_0xd82f('0x32')]=0x0;_0x335f54[_0xd82f('0x33')]=0x0;}function clearCampaigns(_0x1716ce){if(!_[_0xd82f('0x34')](_0x1716ce)){for(var _0x4a266c in _0x1716ce){if(_0x1716ce[_0xd82f('0x2f')](_0x4a266c)){_0x1716ce[_0x4a266c]['ivrTotalCallsDays']=0x0;_0x1716ce[_0x4a266c]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x31b099){if(!_[_0xd82f('0x34')](_0x31b099)){for(var _0x20fd3a in _0x31b099){if(_0x31b099[_0xd82f('0x2f')](_0x20fd3a)){_0x31b099[_0x20fd3a][_0xd82f('0x30')]=0x0;_0x31b099[_0x20fd3a][_0xd82f('0x31')]=0x0;_0x31b099[_0x20fd3a][_0xd82f('0x35')]=0x0;_0x31b099[_0x20fd3a][_0xd82f('0x36')]=0x0;_0x31b099[_0x20fd3a][_0xd82f('0x37')]=0x0;_0x31b099[_0x20fd3a][_0xd82f('0x32')]=0x0;_0x31b099[_0x20fd3a][_0xd82f('0x33')]=0x0;_0x31b099[_0x20fd3a][_0xd82f('0x38')]=0x0;_0x31b099[_0x20fd3a]['outboundNoAnswerCallsDay']=0x0;_0x31b099[_0x20fd3a]['outboundBusyCallsDay']=0x0;_0x31b099[_0x20fd3a][_0xd82f('0x39')]=0x0;_0x31b099[_0x20fd3a][_0xd82f('0x3a')]=0x0;_0x31b099[_0x20fd3a][_0xd82f('0x3b')]=0x0;_0x31b099[_0x20fd3a]['outboundDropCallsDayTimeout']=0x0;_0x31b099[_0x20fd3a][_0xd82f('0x3c')]=0x0;_0x31b099[_0x20fd3a]['outboundBlacklistCallsDay']=0x0;_0x31b099[_0x20fd3a]['outboundOriginateFailureCallsDay']=0x0;_0x31b099[_0x20fd3a]['outboundRejectCallsDay']=0x0;_0x31b099[_0x20fd3a][_0xd82f('0x3d')]=0x0;_0x31b099[_0x20fd3a][_0xd82f('0x38')]=0x0;_0x31b099[_0x20fd3a][_0xd82f('0x3e')]=0x0;_0x31b099[_0x20fd3a][_0xd82f('0x3f')]=!![];}}}}Realtime['prototype'][_0xd82f('0x40')]=function(_0x55c569,_0x590a40){for(var _0x4b1b98 in _0x590a40){if(_0x55c569[_0xd82f('0x2f')](_0x4b1b98)){_0x55c569[_0x4b1b98]=_0x590a40[_0x4b1b98];}}};Realtime['prototype'][_0xd82f('0x41')]=function(){var _0x1bf940=this;return function(_0x5a0796){if(_0x5a0796){freeIsNotKeyAgent(_0x5a0796,_0x1bf940[_0xd82f('0x42')]);for(var _0x4d5c4d=0x0,_0x257427={},_0x72de={};_0x4d5c4d<_0x5a0796[_0xd82f('0x43')];_0x4d5c4d+=0x1){_0x257427=_0x5a0796[_0x4d5c4d];var _0x122536=_['isNil'](_0x257427[_0xd82f('0x2c')])?util[_0xd82f('0x2d')]('SIP/%s',_0x257427[_0xd82f('0x2a')]):_0x257427[_0xd82f('0x2c')];if(_[_0xd82f('0x44')](_0x1bf940['agents'][_0x122536])){_0x1bf940['agents'][_0x122536]=new Agent(_0x257427);}else{_0x1bf940[_0xd82f('0x40')](_0x1bf940[_0xd82f('0x42')][_0x122536],_0x257427);}}}return _0x1bf940['agents'];};};Realtime[_0xd82f('0x45')][_0xd82f('0x46')]=function(){var _0x30c1df=this;return function(_0x31ff59){if(_0x31ff59){freeIsNotKeySip(_0x31ff59,_0x30c1df[_0xd82f('0x16')]);for(var _0x5dcc84=0x0,_0x552e66={},_0x45393b={};_0x5dcc84<_0x31ff59['length'];_0x5dcc84+=0x1){_0x552e66=_0x31ff59[_0x5dcc84];if(_[_0xd82f('0x44')](_0x30c1df[_0xd82f('0x16')][util[_0xd82f('0x2d')](_0xd82f('0x2e'),_0x552e66['name'])])){_0x30c1df[_0xd82f('0x16')][util[_0xd82f('0x2d')]('SIP/%s',_0x552e66[_0xd82f('0x2a')])]=new Telephone(_0x552e66);}else{_0x30c1df[_0xd82f('0x40')](_0x30c1df[_0xd82f('0x16')][util[_0xd82f('0x2d')](_0xd82f('0x2e'),_0x552e66[_0xd82f('0x2a')])],_0x552e66);}}}return _0x30c1df[_0xd82f('0x16')];};};Realtime['prototype'][_0xd82f('0x47')]=function(){var _0x1d6c88=this;return function(_0x5b5d1a){if(_0x5b5d1a){freeIsNotKeySip(_0x5b5d1a,_0x1d6c88[_0xd82f('0x48')]);for(var _0x31cf71=0x0,_0x37115d={},_0x4cc4f5={};_0x31cf71<_0x5b5d1a['length'];_0x31cf71+=0x1){_0x37115d=_0x5b5d1a[_0x31cf71];if(_[_0xd82f('0x44')](_0x1d6c88[_0xd82f('0x48')][util[_0xd82f('0x2d')]('SIP/%s',_0x37115d['name'])])){_0x1d6c88['trunks'][util[_0xd82f('0x2d')]('SIP/%s',_0x37115d[_0xd82f('0x2a')])]=new Trunk(_0x37115d);}else{_0x1d6c88[_0xd82f('0x40')](_0x1d6c88[_0xd82f('0x48')][util['format'](_0xd82f('0x2e'),_0x37115d[_0xd82f('0x2a')])],_0x37115d);}}}return _0x1d6c88[_0xd82f('0x48')];};};Realtime[_0xd82f('0x45')]['initVoiceQueues']=function(){var _0x1c4c78=this;return function(_0x2f505b){if(_0x2f505b){freeIsNotKey(_0x2f505b,_0x1c4c78['voiceQueues'],_0xd82f('0x2a'));for(var _0x48cace=0x0,_0x7a19d4={},_0x3a43fc={};_0x48cace<_0x2f505b['length'];_0x48cace+=0x1){_0x7a19d4=_0x2f505b[_0x48cace];if(_[_0xd82f('0x44')](_0x1c4c78[_0xd82f('0x49')][_0x7a19d4['name']])){_0x1c4c78[_0xd82f('0x49')][_0x7a19d4[_0xd82f('0x2a')]]=new VoiceQueue(_0x7a19d4);}else{_0x1c4c78[_0xd82f('0x40')](_0x1c4c78['voiceQueues'][_0x7a19d4[_0xd82f('0x2a')]],_0x7a19d4);}}}return _0x1c4c78['voiceQueues'];};};Realtime[_0xd82f('0x45')][_0xd82f('0x4a')]=function(){var _0x195028=this;return function(_0x1e3d03){if(_0x1e3d03){freeIsNotKey(_0x1e3d03,_0x195028[_0xd82f('0x17')],'id');for(var _0x61a787=0x0,_0x53e314={},_0x551151={};_0x61a787<_0x1e3d03[_0xd82f('0x43')];_0x61a787+=0x1){_0x53e314=_0x1e3d03[_0x61a787];if(_[_0xd82f('0x44')](_0x195028[_0xd82f('0x17')][_0x53e314['id']])){_0x195028[_0xd82f('0x17')][_0x53e314['id']]=new Trigger(_0x53e314);}else{_0x195028[_0xd82f('0x40')](_0x195028[_0xd82f('0x17')][_0x53e314['id']],_0x53e314);}}}return _0x195028[_0xd82f('0x17')];};};Realtime[_0xd82f('0x45')][_0xd82f('0x4b')]=function(){var _0x2b2009=this;return function(_0x383111){if(_0x383111){freeIsNotKey(_0x383111,_0x2b2009[_0xd82f('0x4c')],'id');for(var _0x40b5ae=0x0,_0x395f23={},_0x2cd4b0={};_0x40b5ae<_0x383111['length'];_0x40b5ae+=0x1){_0x395f23=_0x383111[_0x40b5ae];if(_['isUndefined'](_0x2b2009[_0xd82f('0x4c')][_0x395f23['id']])){_0x2b2009[_0xd82f('0x4c')][_0x395f23['id']]=new Template(_0x395f23);}else{_0x2b2009['mergeFromDatabase'](_0x2b2009[_0xd82f('0x4c')][_0x395f23['id']],_0x395f23);}}}return _0x2b2009[_0xd82f('0x4c')];};};Realtime[_0xd82f('0x45')][_0xd82f('0x4d')]=function(){var _0x54ae1d=this;return function(_0x590a6d){if(_0x590a6d){freeIsNotKey(_0x590a6d,_0x54ae1d[_0xd82f('0x20')],'id');for(var _0x1c3a42=0x0,_0x2f94a0={},_0x18b17f={};_0x1c3a42<_0x590a6d[_0xd82f('0x43')];_0x1c3a42+=0x1){_0x2f94a0=_0x590a6d[_0x1c3a42];if(_[_0xd82f('0x44')](_0x54ae1d['zendeskAccounts'][_0x2f94a0['id']])){_0x54ae1d[_0xd82f('0x20')][_0x2f94a0['id']]=new ZendeskAccount(_0x2f94a0);}else{_0x54ae1d[_0xd82f('0x40')](_0x54ae1d[_0xd82f('0x20')][_0x2f94a0['id']],_0x2f94a0);}}}return _0x54ae1d[_0xd82f('0x20')];};};Realtime['prototype'][_0xd82f('0x4e')]=function(){var _0x505905=this;return function(_0x1eca86){if(_0x1eca86){freeIsNotKey(_0x1eca86,_0x505905[_0xd82f('0x21')],'id');for(var _0x190074=0x0,_0x5d3762={},_0x206de0={};_0x190074<_0x1eca86[_0xd82f('0x43')];_0x190074+=0x1){_0x5d3762=_0x1eca86[_0x190074];if(_['isUndefined'](_0x505905[_0xd82f('0x21')][_0x5d3762['id']])){_0x505905[_0xd82f('0x21')][_0x5d3762['id']]=new SalesforceAccount(_0x5d3762);}else{_0x505905['mergeFromDatabase'](_0x505905['salesforceAccounts'][_0x5d3762['id']],_0x5d3762);}}}return _0x505905[_0xd82f('0x21')];};};Realtime[_0xd82f('0x45')][_0xd82f('0x4f')]=function(){var _0x2908b0=this;return function(_0x574b99){if(_0x574b99){freeIsNotKey(_0x574b99,_0x2908b0[_0xd82f('0x23')],'id');for(var _0x27a468=0x0,_0x421294={},_0x3efb11={};_0x27a468<_0x574b99['length'];_0x27a468+=0x1){_0x421294=_0x574b99[_0x27a468];if(_[_0xd82f('0x44')](_0x2908b0[_0xd82f('0x23')][_0x421294['id']])){_0x2908b0['freshdeskAccounts'][_0x421294['id']]=new FreshdeskAccount(_0x421294);}else{_0x2908b0[_0xd82f('0x40')](_0x2908b0[_0xd82f('0x23')][_0x421294['id']],_0x421294);}}}return _0x2908b0[_0xd82f('0x23')];};};Realtime[_0xd82f('0x45')][_0xd82f('0x50')]=function(){var _0x3513b6=this;return function(_0x311f4a){if(_0x311f4a){freeIsNotKey(_0x311f4a,_0x3513b6[_0xd82f('0x24')],'id');for(var _0x1caef8=0x0,_0x580c64={},_0x515b39={};_0x1caef8<_0x311f4a[_0xd82f('0x43')];_0x1caef8+=0x1){_0x580c64=_0x311f4a[_0x1caef8];if(_[_0xd82f('0x44')](_0x3513b6[_0xd82f('0x24')][_0x580c64['id']])){_0x3513b6[_0xd82f('0x24')][_0x580c64['id']]=new ZohoAccount(_0x580c64);}else{_0x3513b6[_0xd82f('0x40')](_0x3513b6[_0xd82f('0x24')][_0x580c64['id']],_0x580c64);}}}return _0x3513b6[_0xd82f('0x24')];};};Realtime[_0xd82f('0x45')][_0xd82f('0x51')]=function(){var _0x3aa322=this;return function(_0x43de7c){if(_0x43de7c){freeIsNotKey(_0x43de7c,_0x3aa322[_0xd82f('0x25')],'id');for(var _0x106ae2=0x0,_0x33021b={},_0x4e8b1c={};_0x106ae2<_0x43de7c[_0xd82f('0x43')];_0x106ae2+=0x1){_0x33021b=_0x43de7c[_0x106ae2];if(_[_0xd82f('0x44')](_0x3aa322[_0xd82f('0x25')][_0x33021b['id']])){_0x3aa322[_0xd82f('0x25')][_0x33021b['id']]=new DeskAccount(_0x33021b);}else{_0x3aa322[_0xd82f('0x40')](_0x3aa322['deskAccounts'][_0x33021b['id']],_0x33021b);}}}return _0x3aa322[_0xd82f('0x25')];};};Realtime[_0xd82f('0x45')][_0xd82f('0x52')]=function(){var _0x143622=this;return function(_0x5f5858){if(_0x5f5858){freeIsNotKey(_0x5f5858,_0x143622['sugarcrmAccounts'],'id');for(var _0x639522=0x0,_0x494780={},_0x2e23b2={};_0x639522<_0x5f5858[_0xd82f('0x43')];_0x639522+=0x1){_0x494780=_0x5f5858[_0x639522];if(_[_0xd82f('0x44')](_0x143622['sugarcrmAccounts'][_0x494780['id']])){_0x143622[_0xd82f('0x22')][_0x494780['id']]=new SugarcrmAccount(_0x494780);}else{_0x143622['mergeFromDatabase'](_0x143622['sugarcrmAccounts'][_0x494780['id']],_0x494780);}}}return _0x143622[_0xd82f('0x22')];};};Realtime[_0xd82f('0x45')][_0xd82f('0x53')]=function(){var _0x2f671f=this;return function(_0xcee1c2){if(_0xcee1c2){freeIsNotKey(_0xcee1c2,_0x2f671f[_0xd82f('0x26')],'id');for(var _0x1a9b6b=0x0,_0x2c0428={},_0x1d25f={};_0x1a9b6b<_0xcee1c2[_0xd82f('0x43')];_0x1a9b6b+=0x1){_0x2c0428=_0xcee1c2[_0x1a9b6b];if(_[_0xd82f('0x44')](_0x2f671f['vtigerAccounts'][_0x2c0428['id']])){_0x2f671f['vtigerAccounts'][_0x2c0428['id']]=new VtigerAccount(_0x2c0428);}else{_0x2f671f[_0xd82f('0x40')](_0x2f671f[_0xd82f('0x26')][_0x2c0428['id']],_0x2c0428);}}}return _0x2f671f[_0xd82f('0x26')];};};Realtime['prototype'][_0xd82f('0x54')]=function(){var _0x59e734=this;return function(_0x475fe6){if(_0x475fe6){freeIsNotKey(_0x475fe6,_0x59e734[_0xd82f('0x55')],'id');for(var _0x448d1a=0x0,_0x56cf85={},_0x4d26ac={};_0x448d1a<_0x475fe6[_0xd82f('0x43')];_0x448d1a+=0x1){_0x56cf85=_0x475fe6[_0x448d1a];if(_['isUndefined'](_0x59e734['servicenowAccounts'][_0x56cf85['id']])){_0x59e734[_0xd82f('0x55')][_0x56cf85['id']]=new ServicenowAccount(_0x56cf85);}else{_0x59e734['mergeFromDatabase'](_0x59e734[_0xd82f('0x55')][_0x56cf85['id']],_0x56cf85);}}}return _0x59e734[_0xd82f('0x55')];};};Realtime[_0xd82f('0x45')][_0xd82f('0x56')]=function(){var _0x15ce2c=this;return function(_0x4a8894){if(_0x4a8894){freeIsNotKey(_0x4a8894,_0x15ce2c['dynamics365Accounts'],'id');for(var _0xe144eb=0x0,_0x39df72={},_0x2af176={};_0xe144eb<_0x4a8894[_0xd82f('0x43')];_0xe144eb+=0x1){_0x39df72=_0x4a8894[_0xe144eb];if(_[_0xd82f('0x44')](_0x15ce2c[_0xd82f('0x27')][_0x39df72['id']])){_0x15ce2c[_0xd82f('0x27')][_0x39df72['id']]=new Dynamics365Account(_0x39df72);}else{_0x15ce2c['mergeFromDatabase'](_0x15ce2c[_0xd82f('0x27')][_0x39df72['id']],_0x39df72);}}}return _0x15ce2c[_0xd82f('0x27')];};};Realtime['prototype']['initFreshsalesAccounts']=function(){var _0x56e18d=this;return function(_0x322fdc){if(_0x322fdc){freeIsNotKey(_0x322fdc,_0x56e18d[_0xd82f('0x28')],'id');for(var _0x2a3f5c=0x0,_0x2e1fb4={},_0x4fe65d={};_0x2a3f5c<_0x322fdc[_0xd82f('0x43')];_0x2a3f5c+=0x1){_0x2e1fb4=_0x322fdc[_0x2a3f5c];if(_[_0xd82f('0x44')](_0x56e18d[_0xd82f('0x28')][_0x2e1fb4['id']])){_0x56e18d[_0xd82f('0x28')][_0x2e1fb4['id']]=new FreshsalesAccount(_0x2e1fb4);}else{_0x56e18d['mergeFromDatabase'](_0x56e18d[_0xd82f('0x28')][_0x2e1fb4['id']],_0x2e1fb4);}}}return _0x56e18d[_0xd82f('0x28')];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x8c5f5b=this;return function(_0x483252){for(var _0x1cb8b8=0x0;_0x1cb8b8<_0x483252[_0xd82f('0x43')];_0x1cb8b8+=0x1){_[_0xd82f('0x57')](_0x8c5f5b['voiceQueues'][_0x483252[_0x1cb8b8][_0xd82f('0x2a')]],_0x483252[_0x1cb8b8]);}return _0x8c5f5b[_0xd82f('0x49')];};};Realtime[_0xd82f('0x45')][_0xd82f('0x58')]=function(){var _0x21c079=this;return function(_0x5d944b){clearVoiceQueues(_0x21c079[_0xd82f('0x49')]);if(_0x5d944b){_0x5d944b=_[_0xd82f('0x59')](_0x5d944b,'uniqueid');for(var _0x59ebe6 in _0x5d944b){if(_0x5d944b['hasOwnProperty'](_0x59ebe6)){var _0x3527da={};for(var _0x764a7c=0x0;_0x764a7c<_0x5d944b[_0x59ebe6][_0xd82f('0x43')];_0x764a7c+=0x1){var _0x33477a=_0x5d944b[_0x59ebe6][_0x764a7c][_0xd82f('0x5a')];if(_0x21c079['voiceQueues'][_0x33477a]){if(_0x5d944b[_0x59ebe6][_0x764a7c][_0xd82f('0x5b')]){_0x21c079['voiceQueues'][_0x33477a][_0xd82f('0x35')]+=0x1;}if(_0x5d944b[_0x59ebe6][_0x764a7c][_0xd82f('0x5c')]){_0x21c079[_0xd82f('0x49')][_0x33477a][_0xd82f('0x36')]+=0x1;}_0x21c079['voiceQueues'][_0x33477a][_0xd82f('0x37')]+=moment(_0x5d944b[_0x59ebe6][_0x764a7c][_0xd82f('0x5d')])[_0xd82f('0x5e')](moment(_0x5d944b[_0x59ebe6][_0x764a7c]['queuecallerjoinAt']),_0xd82f('0x5f'))||0x0;if(_0x764a7c===_0x5d944b[_0x59ebe6][_0xd82f('0x43')]-0x1){_0x21c079[_0xd82f('0x49')][_0x33477a][_0xd82f('0x32')]+=moment(_0x5d944b[_0x59ebe6][_0x764a7c][_0xd82f('0x60')]||_0x5d944b[_0x59ebe6][_0x764a7c][_0xd82f('0x61')]||_0x5d944b[_0x59ebe6][_0x764a7c][_0xd82f('0x62')])[_0xd82f('0x5e')](moment(_0x5d944b[_0x59ebe6][_0x764a7c][_0xd82f('0x63')]),_0xd82f('0x5f'))||0x0;_0x21c079[_0xd82f('0x49')][_0x33477a][_0xd82f('0x30')]+=0x1;if(_0x5d944b[_0x59ebe6][_0x764a7c][_0xd82f('0x64')]){_0x21c079[_0xd82f('0x49')][_0x33477a][_0xd82f('0x31')]+=0x1;_0x21c079['voiceQueues'][_0x33477a][_0xd82f('0x33')]+=moment(_0x5d944b[_0x59ebe6][_0x764a7c][_0xd82f('0x60')])['diff'](moment(_0x5d944b[_0x59ebe6][_0x764a7c][_0xd82f('0x5d')]),_0xd82f('0x5f'))||0x0;}}else{_0x21c079[_0xd82f('0x49')][_0x33477a][_0xd82f('0x32')]+=_0x21c079[_0xd82f('0x49')][_0x33477a][_0xd82f('0x37')]||0x0;}}}}}}return _0x21c079[_0xd82f('0x49')];};};Realtime[_0xd82f('0x45')]['initVoiceCallReports']=function(){var _0x99d769=this;return function(_0x5871f1){clearVoiceCallReports(_0x99d769['outbound']);if(_0x5871f1){for(var _0x1f1b25=0x0;_0x1f1b25<_0x5871f1[_0xd82f('0x43')];_0x1f1b25+=0x1){_0x99d769['outbound'][_0xd82f('0x30')]+=0x1;_0x99d769[_0xd82f('0x19')]['sumDuration']+=_0x5871f1[_0x1f1b25]['duration'];if(_0x5871f1[_0x1f1b25][_0xd82f('0x65')]===_0xd82f('0x66')){_0x99d769['outbound'][_0xd82f('0x31')]+=0x1;_0x99d769['outbound'][_0xd82f('0x37')]+=_0x5871f1[_0x1f1b25][_0xd82f('0x67')]-_0x5871f1[_0x1f1b25][_0xd82f('0x68')]||0x0;_0x99d769[_0xd82f('0x19')][_0xd82f('0x33')]+=_0x5871f1[_0x1f1b25][_0xd82f('0x68')];}}}return _0x99d769[_0xd82f('0x19')];};};Realtime[_0xd82f('0x45')][_0xd82f('0x69')]=function(){var _0x47a87f=this;return function(_0x34f138){if(_0x34f138){freeIsNotKey(_0x34f138,_0x47a87f[_0xd82f('0x18')],_0xd82f('0x2a'));for(var _0x56b615=0x0,_0x39f6b6={};_0x56b615<_0x34f138['length'];_0x56b615+=0x1){_0x39f6b6=_0x34f138[_0x56b615];if(_[_0xd82f('0x44')](_0x47a87f[_0xd82f('0x18')][_0x39f6b6['name']])){_0x47a87f[_0xd82f('0x18')][_0x39f6b6['name']]=new Campaign(_0x39f6b6);}else{_0x47a87f[_0xd82f('0x40')](_0x47a87f[_0xd82f('0x18')][_0x39f6b6[_0xd82f('0x2a')]],_0x39f6b6);_0x47a87f[_0xd82f('0x18')][_0x39f6b6[_0xd82f('0x2a')]]['dialQueueProject']=_0x39f6b6[_0xd82f('0x6a')]?_0x39f6b6['SquareProject'][_0xd82f('0x2a')]:undefined;}}}return _0x47a87f[_0xd82f('0x18')];};};Realtime[_0xd82f('0x45')][_0xd82f('0x6b')]=function(){var _0x19d9ad=this;return function(_0x5429e6){if(_0x5429e6){freeIsNotKey(_0x5429e6,_0x19d9ad[_0xd82f('0x1a')],'id');for(var _0x1ed785=0x0,_0x267537={};_0x1ed785<_0x5429e6[_0xd82f('0x43')];_0x1ed785+=0x1){_0x267537=_0x5429e6[_0x1ed785];if(_[_0xd82f('0x44')](_0x19d9ad['voiceExtensions'][_0x267537['id']])){_0x19d9ad['voiceExtensions'][_0x267537['id']]=new VoiceExtension(_0x267537);}else{_0x19d9ad[_0xd82f('0x40')](_0x19d9ad[_0xd82f('0x1a')][_0x267537['id']],_0x267537);}}}return _0x19d9ad['voiceExtensions'];};};Realtime[_0xd82f('0x45')][_0xd82f('0x6c')]=function(){var _0x4a7a15=this;return function(_0x43a577){clearCampaigns(_0x4a7a15[_0xd82f('0x18')]);for(var _0x3b7346=0x0;_0x3b7346<_0x43a577['length'];_0x3b7346+=0x1){_[_0xd82f('0x57')](_0x4a7a15['campaigns'][_0x43a577[_0x3b7346][_0xd82f('0x2a')]],_0x43a577[_0x3b7346]);}return _0x4a7a15[_0xd82f('0x18')];};};Realtime[_0xd82f('0x45')][_0xd82f('0x6d')]=function(){var _0x271319=this;return function(_0x207c67){if(_0x207c67){freeIsNotKey(_0x207c67,_0x271319[_0xd82f('0x29')],'id');for(var _0x87e370=0x0,_0x58b3b4={},_0x20e2dc={};_0x87e370<_0x207c67[_0xd82f('0x43')];_0x87e370+=0x1){_0x58b3b4=_0x207c67[_0x87e370];if(_[_0xd82f('0x44')](_0x271319[_0xd82f('0x29')][_0x58b3b4['id']])){_0x271319[_0xd82f('0x29')][_0x58b3b4['id']]=new FaxAccount(_0x58b3b4);}else{_0x271319['mergeFromDatabase'](_0x271319[_0xd82f('0x29')][_0x58b3b4['id']],_0x58b3b4);}}}return _0x271319[_0xd82f('0x29')];};};module[_0xd82f('0x6e')]=Realtime; \ No newline at end of file +var _0x0f59=['initVoiceQueueReports','groupBy','uniqueid','queuecallerabandon','queuecallerleaveAt','diff','queuecallercompleteAt','queuecallerexitAt','queuecallerjoinAt','total','queuecallercomplete','seconds','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','moment','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','outbound','voiceExtensions','outboundChannels','settings','zendeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','answered','unmanaged','abandoned','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory'];(function(_0x25eafd,_0x18e3bd){var _0x3aca77=function(_0xc4428b){while(--_0xc4428b){_0x25eafd['push'](_0x25eafd['shift']());}};_0x3aca77(++_0x18e3bd);}(_0x0f59,0xf6));var _0x90f5=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0x0f59[_0x38c632];return _0x12737e;};'use strict';var BPromise=require(_0x90f5('0x0'));var util=require(_0x90f5('0x1'));var _=require(_0x90f5('0x2'));var moment=require(_0x90f5('0x3'));var Agent=require('../model/agent');var Telephone=require(_0x90f5('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x90f5('0x5'));var Trigger=require(_0x90f5('0x6'));var Template=require(_0x90f5('0x7'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x90f5('0x8'));var ZendeskAccount=require(_0x90f5('0x9'));var SalesforceAccount=require(_0x90f5('0xa'));var FreshdeskAccount=require(_0x90f5('0xb'));var SugarcrmAccount=require(_0x90f5('0xc'));var ZohoAccount=require(_0x90f5('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x90f5('0xe'));var ServicenowAccount=require(_0x90f5('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x90f5('0x10'));var FaxAccount=require(_0x90f5('0x11'));var Realtime=function(){this[_0x90f5('0x12')]={};this[_0x90f5('0x13')]={};this[_0x90f5('0x14')]={};this[_0x90f5('0x15')]={};this[_0x90f5('0x16')]={};this[_0x90f5('0x17')]={};this['templates']={};this[_0x90f5('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x90f5('0x19')]={};this['channels']={};this['queueChannels']={};this[_0x90f5('0x1a')]={};this['timers']={};this[_0x90f5('0x1b')]={};this[_0x90f5('0x1c')]={};this['salesforceAccounts']={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x90f5('0x1d')]={};this[_0x90f5('0x1e')]={};this[_0x90f5('0x1f')]={};this[_0x90f5('0x20')]={};this[_0x90f5('0x21')]={};this['faxAccounts']={};};function freeIsNotKey(_0x291652,_0x4cd3df,_0x2ee353){var _0x219361=_[_0x90f5('0x22')](_0x291652,function(_0x1ff186,_0x46c4bc){return _0x1ff186[_0x2ee353];});for(var _0x17c371 in _0x4cd3df){if(_0x4cd3df[_0x90f5('0x23')](_0x17c371)){if(!_0x219361[_0x17c371]){delete _0x4cd3df[_0x17c371];}}}}function freeIsNotKeySip(_0x249be1,_0x45c531){var _0x15d525=_[_0x90f5('0x22')](_0x249be1,function(_0x33d60e,_0x5362bf){return util[_0x90f5('0x24')](_0x90f5('0x25'),_0x33d60e[_0x90f5('0x26')]);});for(var _0x15ed91 in _0x45c531){if(_0x45c531[_0x90f5('0x23')](_0x15ed91)){if(!_0x15d525[_0x15ed91]){delete _0x45c531[_0x15ed91];}}}}function freeIsNotKeyAgent(_0x1bd4a0,_0x45e062){var _0x55b6fc=_['mapKeys'](_0x1bd4a0,function(_0x519064,_0x52628d){var _0x52ac62=_[_0x90f5('0x27')](_0x519064[_0x90f5('0x28')])?util[_0x90f5('0x24')](_0x90f5('0x25'),_0x519064[_0x90f5('0x26')]):_0x519064[_0x90f5('0x28')];return _0x52ac62;});for(var _0x51ef6e in _0x45e062){if(_0x45e062[_0x90f5('0x23')](_0x51ef6e)){if(!_0x55b6fc[_0x51ef6e]){delete _0x45e062[_0x51ef6e];}}}}function clearVoiceCallReports(_0x548a58){_0x548a58['total']=0x0;_0x548a58['answered']=0x0;_0x548a58[_0x90f5('0x29')]=0x0;_0x548a58[_0x90f5('0x2a')]=0x0;_0x548a58[_0x90f5('0x2b')]=0x0;}function clearCampaigns(_0x3c3a2b){if(!_[_0x90f5('0x2c')](_0x3c3a2b)){for(var _0x3ef595 in _0x3c3a2b){if(_0x3c3a2b[_0x90f5('0x23')](_0x3ef595)){_0x3c3a2b[_0x3ef595]['ivrTotalCallsDays']=0x0;_0x3c3a2b[_0x3ef595][_0x90f5('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x364637){if(!_['isEmpty'](_0x364637)){for(var _0x2445eb in _0x364637){if(_0x364637[_0x90f5('0x23')](_0x2445eb)){_0x364637[_0x2445eb]['total']=0x0;_0x364637[_0x2445eb][_0x90f5('0x2e')]=0x0;_0x364637[_0x2445eb][_0x90f5('0x2f')]=0x0;_0x364637[_0x2445eb][_0x90f5('0x30')]=0x0;_0x364637[_0x2445eb][_0x90f5('0x29')]=0x0;_0x364637[_0x2445eb][_0x90f5('0x2a')]=0x0;_0x364637[_0x2445eb][_0x90f5('0x2b')]=0x0;_0x364637[_0x2445eb]['outboundAnswerAgiCallsDay']=0x0;_0x364637[_0x2445eb][_0x90f5('0x31')]=0x0;_0x364637[_0x2445eb][_0x90f5('0x32')]=0x0;_0x364637[_0x2445eb]['outboundCongestionCallsDay']=0x0;_0x364637[_0x2445eb][_0x90f5('0x33')]=0x0;_0x364637[_0x2445eb]['outboundUnknownCallsDay']=0x0;_0x364637[_0x2445eb][_0x90f5('0x34')]=0x0;_0x364637[_0x2445eb]['outboundDropCallsDayCallersExit']=0x0;_0x364637[_0x2445eb][_0x90f5('0x35')]=0x0;_0x364637[_0x2445eb][_0x90f5('0x36')]=0x0;_0x364637[_0x2445eb]['outboundRejectCallsDay']=0x0;_0x364637[_0x2445eb][_0x90f5('0x37')]=0x0;_0x364637[_0x2445eb][_0x90f5('0x38')]=0x0;_0x364637[_0x2445eb][_0x90f5('0x39')]=0x0;_0x364637[_0x2445eb][_0x90f5('0x3a')]=!![];}}}}Realtime[_0x90f5('0x3b')][_0x90f5('0x3c')]=function(_0x26a2a2,_0x5b394b){for(var _0x562353 in _0x5b394b){if(_0x26a2a2[_0x90f5('0x23')](_0x562353)){_0x26a2a2[_0x562353]=_0x5b394b[_0x562353];}}};Realtime[_0x90f5('0x3b')][_0x90f5('0x3d')]=function(){var _0x37af05=this;return function(_0x3af3df){if(_0x3af3df){freeIsNotKeyAgent(_0x3af3df,_0x37af05[_0x90f5('0x12')]);for(var _0x49eb7b=0x0,_0x5b6f28={},_0x5285de={};_0x49eb7b<_0x3af3df[_0x90f5('0x3e')];_0x49eb7b+=0x1){_0x5b6f28=_0x3af3df[_0x49eb7b];var _0x97a561=_[_0x90f5('0x27')](_0x5b6f28[_0x90f5('0x28')])?util[_0x90f5('0x24')](_0x90f5('0x25'),_0x5b6f28[_0x90f5('0x26')]):_0x5b6f28[_0x90f5('0x28')];if(_[_0x90f5('0x3f')](_0x37af05['agents'][_0x97a561])){_0x37af05[_0x90f5('0x12')][_0x97a561]=new Agent(_0x5b6f28);}else{_0x37af05[_0x90f5('0x3c')](_0x37af05[_0x90f5('0x12')][_0x97a561],_0x5b6f28);}}}return _0x37af05[_0x90f5('0x12')];};};Realtime[_0x90f5('0x3b')][_0x90f5('0x40')]=function(){var _0x32f6e7=this;return function(_0x370d1c){if(_0x370d1c){freeIsNotKeySip(_0x370d1c,_0x32f6e7[_0x90f5('0x13')]);for(var _0x5aef08=0x0,_0x1e39e4={},_0x199467={};_0x5aef08<_0x370d1c[_0x90f5('0x3e')];_0x5aef08+=0x1){_0x1e39e4=_0x370d1c[_0x5aef08];if(_[_0x90f5('0x3f')](_0x32f6e7[_0x90f5('0x13')][util['format'](_0x90f5('0x25'),_0x1e39e4[_0x90f5('0x26')])])){_0x32f6e7[_0x90f5('0x13')][util['format'](_0x90f5('0x25'),_0x1e39e4[_0x90f5('0x26')])]=new Telephone(_0x1e39e4);}else{_0x32f6e7[_0x90f5('0x3c')](_0x32f6e7[_0x90f5('0x13')][util[_0x90f5('0x24')](_0x90f5('0x25'),_0x1e39e4[_0x90f5('0x26')])],_0x1e39e4);}}}return _0x32f6e7[_0x90f5('0x13')];};};Realtime[_0x90f5('0x3b')][_0x90f5('0x41')]=function(){var _0x4a2462=this;return function(_0x4fb00b){if(_0x4fb00b){freeIsNotKeySip(_0x4fb00b,_0x4a2462[_0x90f5('0x14')]);for(var _0x4ac570=0x0,_0x27eb38={},_0x328035={};_0x4ac570<_0x4fb00b[_0x90f5('0x3e')];_0x4ac570+=0x1){_0x27eb38=_0x4fb00b[_0x4ac570];if(_['isUndefined'](_0x4a2462[_0x90f5('0x14')][util[_0x90f5('0x24')]('SIP/%s',_0x27eb38[_0x90f5('0x26')])])){_0x4a2462[_0x90f5('0x14')][util[_0x90f5('0x24')](_0x90f5('0x25'),_0x27eb38['name'])]=new Trunk(_0x27eb38);}else{_0x4a2462[_0x90f5('0x3c')](_0x4a2462[_0x90f5('0x14')][util[_0x90f5('0x24')]('SIP/%s',_0x27eb38[_0x90f5('0x26')])],_0x27eb38);}}}return _0x4a2462[_0x90f5('0x14')];};};Realtime[_0x90f5('0x3b')][_0x90f5('0x42')]=function(){var _0x127df8=this;return function(_0x37b4f6){if(_0x37b4f6){freeIsNotKey(_0x37b4f6,_0x127df8[_0x90f5('0x15')],_0x90f5('0x26'));for(var _0x2151ed=0x0,_0x588879={},_0x203144={};_0x2151ed<_0x37b4f6['length'];_0x2151ed+=0x1){_0x588879=_0x37b4f6[_0x2151ed];if(_[_0x90f5('0x3f')](_0x127df8[_0x90f5('0x15')][_0x588879['name']])){_0x127df8['voiceQueues'][_0x588879['name']]=new VoiceQueue(_0x588879);}else{_0x127df8[_0x90f5('0x3c')](_0x127df8[_0x90f5('0x15')][_0x588879[_0x90f5('0x26')]],_0x588879);}}}return _0x127df8['voiceQueues'];};};Realtime[_0x90f5('0x3b')][_0x90f5('0x43')]=function(){var _0x1bd1e2=this;return function(_0x151fe4){if(_0x151fe4){freeIsNotKey(_0x151fe4,_0x1bd1e2['triggers'],'id');for(var _0x21be87=0x0,_0x4dba9c={},_0x3d314c={};_0x21be87<_0x151fe4[_0x90f5('0x3e')];_0x21be87+=0x1){_0x4dba9c=_0x151fe4[_0x21be87];if(_[_0x90f5('0x3f')](_0x1bd1e2[_0x90f5('0x16')][_0x4dba9c['id']])){_0x1bd1e2['triggers'][_0x4dba9c['id']]=new Trigger(_0x4dba9c);}else{_0x1bd1e2[_0x90f5('0x3c')](_0x1bd1e2['triggers'][_0x4dba9c['id']],_0x4dba9c);}}}return _0x1bd1e2[_0x90f5('0x16')];};};Realtime[_0x90f5('0x3b')][_0x90f5('0x44')]=function(){var _0x234187=this;return function(_0x32d937){if(_0x32d937){freeIsNotKey(_0x32d937,_0x234187[_0x90f5('0x45')],'id');for(var _0x5af12e=0x0,_0xd60d4d={},_0x435852={};_0x5af12e<_0x32d937['length'];_0x5af12e+=0x1){_0xd60d4d=_0x32d937[_0x5af12e];if(_['isUndefined'](_0x234187['templates'][_0xd60d4d['id']])){_0x234187['templates'][_0xd60d4d['id']]=new Template(_0xd60d4d);}else{_0x234187[_0x90f5('0x3c')](_0x234187[_0x90f5('0x45')][_0xd60d4d['id']],_0xd60d4d);}}}return _0x234187[_0x90f5('0x45')];};};Realtime[_0x90f5('0x3b')][_0x90f5('0x46')]=function(){var _0x4f55df=this;return function(_0x2cebf9){if(_0x2cebf9){freeIsNotKey(_0x2cebf9,_0x4f55df[_0x90f5('0x1c')],'id');for(var _0xb208e9=0x0,_0x5ea642={},_0x9b1b56={};_0xb208e9<_0x2cebf9[_0x90f5('0x3e')];_0xb208e9+=0x1){_0x5ea642=_0x2cebf9[_0xb208e9];if(_[_0x90f5('0x3f')](_0x4f55df[_0x90f5('0x1c')][_0x5ea642['id']])){_0x4f55df[_0x90f5('0x1c')][_0x5ea642['id']]=new ZendeskAccount(_0x5ea642);}else{_0x4f55df[_0x90f5('0x3c')](_0x4f55df['zendeskAccounts'][_0x5ea642['id']],_0x5ea642);}}}return _0x4f55df['zendeskAccounts'];};};Realtime[_0x90f5('0x3b')][_0x90f5('0x47')]=function(){var _0x37d08d=this;return function(_0x59149c){if(_0x59149c){freeIsNotKey(_0x59149c,_0x37d08d[_0x90f5('0x48')],'id');for(var _0x2c6be0=0x0,_0x4225d9={},_0x57a6e7={};_0x2c6be0<_0x59149c[_0x90f5('0x3e')];_0x2c6be0+=0x1){_0x4225d9=_0x59149c[_0x2c6be0];if(_['isUndefined'](_0x37d08d['salesforceAccounts'][_0x4225d9['id']])){_0x37d08d[_0x90f5('0x48')][_0x4225d9['id']]=new SalesforceAccount(_0x4225d9);}else{_0x37d08d[_0x90f5('0x3c')](_0x37d08d[_0x90f5('0x48')][_0x4225d9['id']],_0x4225d9);}}}return _0x37d08d[_0x90f5('0x48')];};};Realtime[_0x90f5('0x3b')][_0x90f5('0x49')]=function(){var _0xfaf0cb=this;return function(_0x2b98df){if(_0x2b98df){freeIsNotKey(_0x2b98df,_0xfaf0cb[_0x90f5('0x4a')],'id');for(var _0x47b010=0x0,_0x838304={},_0x4c8045={};_0x47b010<_0x2b98df['length'];_0x47b010+=0x1){_0x838304=_0x2b98df[_0x47b010];if(_[_0x90f5('0x3f')](_0xfaf0cb[_0x90f5('0x4a')][_0x838304['id']])){_0xfaf0cb['freshdeskAccounts'][_0x838304['id']]=new FreshdeskAccount(_0x838304);}else{_0xfaf0cb[_0x90f5('0x3c')](_0xfaf0cb[_0x90f5('0x4a')][_0x838304['id']],_0x838304);}}}return _0xfaf0cb[_0x90f5('0x4a')];};};Realtime['prototype'][_0x90f5('0x4b')]=function(){var _0x1a5e4d=this;return function(_0x5f5c8a){if(_0x5f5c8a){freeIsNotKey(_0x5f5c8a,_0x1a5e4d[_0x90f5('0x4c')],'id');for(var _0x20cfcc=0x0,_0x3dad88={},_0x22cc2c={};_0x20cfcc<_0x5f5c8a[_0x90f5('0x3e')];_0x20cfcc+=0x1){_0x3dad88=_0x5f5c8a[_0x20cfcc];if(_[_0x90f5('0x3f')](_0x1a5e4d['zohoAccounts'][_0x3dad88['id']])){_0x1a5e4d[_0x90f5('0x4c')][_0x3dad88['id']]=new ZohoAccount(_0x3dad88);}else{_0x1a5e4d['mergeFromDatabase'](_0x1a5e4d[_0x90f5('0x4c')][_0x3dad88['id']],_0x3dad88);}}}return _0x1a5e4d[_0x90f5('0x4c')];};};Realtime[_0x90f5('0x3b')][_0x90f5('0x4d')]=function(){var _0x1030b1=this;return function(_0x31f26f){if(_0x31f26f){freeIsNotKey(_0x31f26f,_0x1030b1[_0x90f5('0x1d')],'id');for(var _0x3c4b31=0x0,_0x8a1e70={},_0x1c92b2={};_0x3c4b31<_0x31f26f[_0x90f5('0x3e')];_0x3c4b31+=0x1){_0x8a1e70=_0x31f26f[_0x3c4b31];if(_[_0x90f5('0x3f')](_0x1030b1[_0x90f5('0x1d')][_0x8a1e70['id']])){_0x1030b1['deskAccounts'][_0x8a1e70['id']]=new DeskAccount(_0x8a1e70);}else{_0x1030b1[_0x90f5('0x3c')](_0x1030b1[_0x90f5('0x1d')][_0x8a1e70['id']],_0x8a1e70);}}}return _0x1030b1[_0x90f5('0x1d')];};};Realtime['prototype'][_0x90f5('0x4e')]=function(){var _0x58a728=this;return function(_0x59d398){if(_0x59d398){freeIsNotKey(_0x59d398,_0x58a728['sugarcrmAccounts'],'id');for(var _0x2bc69f=0x0,_0x4fde21={},_0x167274={};_0x2bc69f<_0x59d398['length'];_0x2bc69f+=0x1){_0x4fde21=_0x59d398[_0x2bc69f];if(_['isUndefined'](_0x58a728[_0x90f5('0x4f')][_0x4fde21['id']])){_0x58a728['sugarcrmAccounts'][_0x4fde21['id']]=new SugarcrmAccount(_0x4fde21);}else{_0x58a728['mergeFromDatabase'](_0x58a728['sugarcrmAccounts'][_0x4fde21['id']],_0x4fde21);}}}return _0x58a728['sugarcrmAccounts'];};};Realtime[_0x90f5('0x3b')][_0x90f5('0x50')]=function(){var _0x4812e3=this;return function(_0x4d2654){if(_0x4d2654){freeIsNotKey(_0x4d2654,_0x4812e3[_0x90f5('0x1e')],'id');for(var _0x4d93a2=0x0,_0x1084a5={},_0x582331={};_0x4d93a2<_0x4d2654['length'];_0x4d93a2+=0x1){_0x1084a5=_0x4d2654[_0x4d93a2];if(_[_0x90f5('0x3f')](_0x4812e3[_0x90f5('0x1e')][_0x1084a5['id']])){_0x4812e3[_0x90f5('0x1e')][_0x1084a5['id']]=new VtigerAccount(_0x1084a5);}else{_0x4812e3[_0x90f5('0x3c')](_0x4812e3['vtigerAccounts'][_0x1084a5['id']],_0x1084a5);}}}return _0x4812e3[_0x90f5('0x1e')];};};Realtime[_0x90f5('0x3b')]['initServicenowAccounts']=function(){var _0x2d0fcb=this;return function(_0x2e0620){if(_0x2e0620){freeIsNotKey(_0x2e0620,_0x2d0fcb[_0x90f5('0x1f')],'id');for(var _0x2c6d60=0x0,_0x802343={},_0x2dab23={};_0x2c6d60<_0x2e0620[_0x90f5('0x3e')];_0x2c6d60+=0x1){_0x802343=_0x2e0620[_0x2c6d60];if(_[_0x90f5('0x3f')](_0x2d0fcb[_0x90f5('0x1f')][_0x802343['id']])){_0x2d0fcb['servicenowAccounts'][_0x802343['id']]=new ServicenowAccount(_0x802343);}else{_0x2d0fcb['mergeFromDatabase'](_0x2d0fcb['servicenowAccounts'][_0x802343['id']],_0x802343);}}}return _0x2d0fcb['servicenowAccounts'];};};Realtime[_0x90f5('0x3b')][_0x90f5('0x51')]=function(){var _0x368f8e=this;return function(_0x1012a7){if(_0x1012a7){freeIsNotKey(_0x1012a7,_0x368f8e[_0x90f5('0x20')],'id');for(var _0x161a91=0x0,_0x4b15b8={},_0xc552ee={};_0x161a91<_0x1012a7[_0x90f5('0x3e')];_0x161a91+=0x1){_0x4b15b8=_0x1012a7[_0x161a91];if(_[_0x90f5('0x3f')](_0x368f8e['dynamics365Accounts'][_0x4b15b8['id']])){_0x368f8e['dynamics365Accounts'][_0x4b15b8['id']]=new Dynamics365Account(_0x4b15b8);}else{_0x368f8e[_0x90f5('0x3c')](_0x368f8e[_0x90f5('0x20')][_0x4b15b8['id']],_0x4b15b8);}}}return _0x368f8e['dynamics365Accounts'];};};Realtime['prototype'][_0x90f5('0x52')]=function(){var _0x2a2946=this;return function(_0x18cba3){if(_0x18cba3){freeIsNotKey(_0x18cba3,_0x2a2946[_0x90f5('0x21')],'id');for(var _0x27966c=0x0,_0x3e19c9={},_0x58b0ad={};_0x27966c<_0x18cba3[_0x90f5('0x3e')];_0x27966c+=0x1){_0x3e19c9=_0x18cba3[_0x27966c];if(_[_0x90f5('0x3f')](_0x2a2946[_0x90f5('0x21')][_0x3e19c9['id']])){_0x2a2946[_0x90f5('0x21')][_0x3e19c9['id']]=new FreshsalesAccount(_0x3e19c9);}else{_0x2a2946['mergeFromDatabase'](_0x2a2946['freshsalesAccounts'][_0x3e19c9['id']],_0x3e19c9);}}}return _0x2a2946[_0x90f5('0x21')];};};Realtime['prototype'][_0x90f5('0x53')]=function(){var _0x17970d=this;return function(_0x450cb4){for(var _0x3d7448=0x0;_0x3d7448<_0x450cb4[_0x90f5('0x3e')];_0x3d7448+=0x1){_['merge'](_0x17970d[_0x90f5('0x15')][_0x450cb4[_0x3d7448][_0x90f5('0x26')]],_0x450cb4[_0x3d7448]);}return _0x17970d[_0x90f5('0x15')];};};Realtime[_0x90f5('0x3b')][_0x90f5('0x54')]=function(){var _0x545554=this;return function(_0x307bb5){clearVoiceQueues(_0x545554[_0x90f5('0x15')]);if(_0x307bb5){_0x307bb5=_[_0x90f5('0x55')](_0x307bb5,_0x90f5('0x56'));for(var _0x4cbcef in _0x307bb5){if(_0x307bb5[_0x90f5('0x23')](_0x4cbcef)){var _0x4e947b={};for(var _0x4997f5=0x0;_0x4997f5<_0x307bb5[_0x4cbcef][_0x90f5('0x3e')];_0x4997f5+=0x1){var _0x34de71=_0x307bb5[_0x4cbcef][_0x4997f5]['queue'];if(_0x545554[_0x90f5('0x15')][_0x34de71]){if(_0x307bb5[_0x4cbcef][_0x4997f5]['queuecallerexit']){_0x545554[_0x90f5('0x15')][_0x34de71][_0x90f5('0x2f')]+=0x1;}if(_0x307bb5[_0x4cbcef][_0x4997f5][_0x90f5('0x57')]){_0x545554[_0x90f5('0x15')][_0x34de71][_0x90f5('0x30')]+=0x1;}_0x545554[_0x90f5('0x15')][_0x34de71][_0x90f5('0x29')]+=moment(_0x307bb5[_0x4cbcef][_0x4997f5][_0x90f5('0x58')])[_0x90f5('0x59')](moment(_0x307bb5[_0x4cbcef][_0x4997f5]['queuecallerjoinAt']),'seconds')||0x0;if(_0x4997f5===_0x307bb5[_0x4cbcef]['length']-0x1){_0x545554['voiceQueues'][_0x34de71][_0x90f5('0x2a')]+=moment(_0x307bb5[_0x4cbcef][_0x4997f5][_0x90f5('0x5a')]||_0x307bb5[_0x4cbcef][_0x4997f5]['queuecallerabandonAt']||_0x307bb5[_0x4cbcef][_0x4997f5][_0x90f5('0x5b')])[_0x90f5('0x59')](moment(_0x307bb5[_0x4cbcef][_0x4997f5][_0x90f5('0x5c')]),'seconds')||0x0;_0x545554[_0x90f5('0x15')][_0x34de71][_0x90f5('0x5d')]+=0x1;if(_0x307bb5[_0x4cbcef][_0x4997f5][_0x90f5('0x5e')]){_0x545554[_0x90f5('0x15')][_0x34de71][_0x90f5('0x2e')]+=0x1;_0x545554[_0x90f5('0x15')][_0x34de71]['sumBillable']+=moment(_0x307bb5[_0x4cbcef][_0x4997f5][_0x90f5('0x5a')])['diff'](moment(_0x307bb5[_0x4cbcef][_0x4997f5][_0x90f5('0x58')]),_0x90f5('0x5f'))||0x0;}}else{_0x545554[_0x90f5('0x15')][_0x34de71][_0x90f5('0x2a')]+=_0x545554[_0x90f5('0x15')][_0x34de71][_0x90f5('0x29')]||0x0;}}}}}}return _0x545554[_0x90f5('0x15')];};};Realtime['prototype'][_0x90f5('0x60')]=function(){var _0x458bf4=this;return function(_0x265a7a){clearVoiceCallReports(_0x458bf4[_0x90f5('0x18')]);if(_0x265a7a){for(var _0x478288=0x0;_0x478288<_0x265a7a[_0x90f5('0x3e')];_0x478288+=0x1){_0x458bf4[_0x90f5('0x18')][_0x90f5('0x5d')]+=0x1;_0x458bf4['outbound'][_0x90f5('0x2a')]+=_0x265a7a[_0x478288][_0x90f5('0x61')];if(_0x265a7a[_0x478288][_0x90f5('0x62')]===_0x90f5('0x63')){_0x458bf4[_0x90f5('0x18')][_0x90f5('0x2e')]+=0x1;_0x458bf4['outbound']['sumHoldTime']+=_0x265a7a[_0x478288]['duration']-_0x265a7a[_0x478288][_0x90f5('0x64')]||0x0;_0x458bf4['outbound'][_0x90f5('0x2b')]+=_0x265a7a[_0x478288][_0x90f5('0x64')];}}}return _0x458bf4[_0x90f5('0x18')];};};Realtime[_0x90f5('0x3b')][_0x90f5('0x65')]=function(){var _0x5581af=this;return function(_0x4feb24){if(_0x4feb24){freeIsNotKey(_0x4feb24,_0x5581af[_0x90f5('0x17')],'name');for(var _0x4d6fff=0x0,_0x233606={};_0x4d6fff<_0x4feb24[_0x90f5('0x3e')];_0x4d6fff+=0x1){_0x233606=_0x4feb24[_0x4d6fff];if(_['isUndefined'](_0x5581af['campaigns'][_0x233606[_0x90f5('0x26')]])){_0x5581af['campaigns'][_0x233606[_0x90f5('0x26')]]=new Campaign(_0x233606);}else{_0x5581af[_0x90f5('0x3c')](_0x5581af[_0x90f5('0x17')][_0x233606['name']],_0x233606);_0x5581af[_0x90f5('0x17')][_0x233606[_0x90f5('0x26')]][_0x90f5('0x66')]=_0x233606['SquareProject']?_0x233606[_0x90f5('0x67')][_0x90f5('0x26')]:undefined;}}}return _0x5581af[_0x90f5('0x17')];};};Realtime[_0x90f5('0x3b')][_0x90f5('0x68')]=function(){var _0x6698e1=this;return function(_0x38c29c){if(_0x38c29c){freeIsNotKey(_0x38c29c,_0x6698e1['voiceExtensions'],'id');for(var _0x5a1114=0x0,_0x16f533={};_0x5a1114<_0x38c29c[_0x90f5('0x3e')];_0x5a1114+=0x1){_0x16f533=_0x38c29c[_0x5a1114];if(_[_0x90f5('0x3f')](_0x6698e1[_0x90f5('0x19')][_0x16f533['id']])){_0x6698e1['voiceExtensions'][_0x16f533['id']]=new VoiceExtension(_0x16f533);}else{_0x6698e1[_0x90f5('0x3c')](_0x6698e1[_0x90f5('0x19')][_0x16f533['id']],_0x16f533);}}}return _0x6698e1[_0x90f5('0x19')];};};Realtime[_0x90f5('0x3b')][_0x90f5('0x69')]=function(){var _0x495184=this;return function(_0x2ca025){clearCampaigns(_0x495184[_0x90f5('0x17')]);for(var _0x47d7cd=0x0;_0x47d7cd<_0x2ca025['length'];_0x47d7cd+=0x1){_[_0x90f5('0x6a')](_0x495184['campaigns'][_0x2ca025[_0x47d7cd][_0x90f5('0x26')]],_0x2ca025[_0x47d7cd]);}return _0x495184[_0x90f5('0x17')];};};Realtime['prototype'][_0x90f5('0x6b')]=function(){var _0x18fa32=this;return function(_0x32de6e){if(_0x32de6e){freeIsNotKey(_0x32de6e,_0x18fa32[_0x90f5('0x6c')],'id');for(var _0x3183a6=0x0,_0x32a7fd={},_0x10453f={};_0x3183a6<_0x32de6e[_0x90f5('0x3e')];_0x3183a6+=0x1){_0x32a7fd=_0x32de6e[_0x3183a6];if(_['isUndefined'](_0x18fa32[_0x90f5('0x6c')][_0x32a7fd['id']])){_0x18fa32[_0x90f5('0x6c')][_0x32a7fd['id']]=new FaxAccount(_0x32a7fd);}else{_0x18fa32[_0x90f5('0x3c')](_0x18fa32['faxAccounts'][_0x32a7fd['id']],_0x32a7fd);}}}return _0x18fa32[_0x90f5('0x6c')];};};module[_0x90f5('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 9f4e16f..beaf5c8 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 _0x0824=['connectedlinename','membername','isArray','voiceDialReport','startsWith','Local','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','name','isNil','find','accountcode','interface','SIP/%s','length','findAgent','connectedlinenum','assigned','lastAssignedTo','format','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','destination','exten','type','dialer','lastapplication','lastdata','queue','context','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','linkedid','transfers','transfereelinkedid','monitor','monitors','monitorFilename','filename','createdAt','calleridname'];(function(_0x27f146,_0x5515bf){var _0xd45e2a=function(_0x51dce2){while(--_0x51dce2){_0x27f146['push'](_0x27f146['shift']());}};_0xd45e2a(++_0x5515bf);}(_0x0824,0x65));var _0x4082=function(_0x65826e,_0x5ab5f8){_0x65826e=_0x65826e-0x0;var _0x37d03f=_0x0824[_0x65826e];return _0x37d03f;};'use strict';var _=require(_0x4082('0x0'));var moment=require('moment');var util=require(_0x4082('0x1'));var config=require(_0x4082('0x2'));var ami=require(_0x4082('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x4082('0x4'));var RpcVoiceDialReport=require(_0x4082('0x5'));var RpcMemberReport=require(_0x4082('0x6'));var RpcVoiceQueueReport=require(_0x4082('0x7'));var RpcVoiceRecording=require(_0x4082('0x8'));var RpcVoiceTransferReport=require(_0x4082('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x4082('0xa'));var VoiceAgentReport=require(_0x4082('0xb'));var VoiceDialReport=require(_0x4082('0xc'));var UserReport=require(_0x4082('0xd'));function Report(_0x3c1ae9){this[_0x4082('0xe')]=_0x3c1ae9;this[_0x4082('0xf')]=_0x3c1ae9[_0x4082('0xf')];this['telephones']=_0x3c1ae9[_0x4082('0x10')];}Report[_0x4082('0x11')][_0x4082('0x12')]=function(_0x1fe660){var _0x32be25=new VoiceQueueReport(this[_0x4082('0xe')]);var _0x1795e3=new VoiceAgentReport(this[_0x4082('0xe')]);var _0x42954a=new VoiceDialReport(this[_0x4082('0xe')]);var _0x3735a8=new VoiceCallReport(this[_0x4082('0xe')]);var _0x5b78d3=new UserReport(this['realtime']);if(config['xdr']&&config[_0x4082('0x13')][_0x4082('0x14')]){ami['on'](_0x4082('0x15'),this[_0x4082('0x16')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0x4082('0x17')][_0x4082('0x18')](this));ami['on'](_0x4082('0x19'),this[_0x4082('0x1a')]['bind'](this));ami['on'](_0x4082('0x1b'),this['voiceDialReport']['bind'](this));ami['on'](_0x4082('0x1c'),this[_0x4082('0x1d')]['bind'](this));ami['on'](_0x4082('0x1e'),this[_0x4082('0x1f')]['bind'](this));}};Report[_0x4082('0x11')]['findAgent']=function(_0x58bf6b){var _0xff8405;_0xff8405=_['find'](this[_0x4082('0xf')],function(_0x745418){return _0x745418['accountcode']==_0x58bf6b||_0x745418[_0x4082('0x20')]==_0x58bf6b;});if(_[_0x4082('0x21')](_0xff8405)){var _0x59560a=_[_0x4082('0x22')](this[_0x4082('0x10')],function(_0xe886){return _0xe886[_0x4082('0x23')]==_0x58bf6b||_0xe886[_0x4082('0x20')]==_0x58bf6b;});if(_0x59560a){_0xff8405=_['find'](this['agents'],function(_0x3b3eea){return _0x3b3eea[_0x4082('0x24')]==util['format'](_0x4082('0x25'),_0x59560a[_0x4082('0x20')]);});}}return _0xff8405;};Report[_0x4082('0x11')]['voiceQueueReport']=function(_0x166f41){for(var _0x5cd529=0x0;_0x5cd529<_0x166f41[_0x4082('0x26')];_0x5cd529+=0x1){var _0x2118e0=this[_0x4082('0x27')](_0x166f41[_0x5cd529][_0x4082('0x28')]);if(_0x2118e0){_0x166f41[_0x5cd529][_0x4082('0x23')]=_0x2118e0[_0x4082('0x23')];_0x166f41[_0x5cd529][_0x4082('0x29')]=!![];_0x166f41[_0x5cd529][_0x4082('0x2a')]=_0x2118e0[_0x4082('0x20')];_0x166f41[_0x5cd529][_0x4082('0x24')]=_[_0x4082('0x21')](_0x2118e0[_0x4082('0x24')])?util[_0x4082('0x2b')](_0x4082('0x25'),_0x2118e0[_0x4082('0x20')]):_0x2118e0['interface'];if(_0x166f41[_0x5cd529]['queuecallercomplete']){_0x166f41[_0x5cd529][_0x4082('0x2c')]=moment()[_0x4082('0x2b')](_0x4082('0x2d'));}if(_0x166f41[_0x5cd529][_0x4082('0x2e')]){_0x166f41[_0x5cd529][_0x4082('0x2f')]=moment()['format'](_0x4082('0x2d'));}RpcMemberReport[_0x4082('0x16')](_0x166f41[_0x5cd529]);}RpcVoiceQueueReport[_0x4082('0x30')](_0x166f41[_0x5cd529]);}};function extractCalleridNumber(_0x1dfe03){var _0xdc7ab9=_0x1dfe03['match'](/<(.*?)>/);return _0xdc7ab9?_0xdc7ab9[0x1]:_0x1dfe03;}Report[_0x4082('0x11')]['voiceCallReport']=function(_0x306f31){_0x306f31[_0x4082('0x31')]=_0x306f31['destination']||_0x306f31[_0x4082('0x32')];if(_0x306f31[_0x4082('0x33')]==_0x4082('0x34')){_0x306f31[_0x4082('0x35')]='queue';_0x306f31[_0x4082('0x36')]=_0x306f31[_0x4082('0x37')];if(_0x306f31[_0x4082('0x38')]=='from-voip-provider'){_0x306f31[_0x4082('0x23')]='';_0x306f31[_0x4082('0x31')]=extractCalleridNumber(_0x306f31['callerid']);}else if(_0x306f31['context']==_0x4082('0x39')){if(_0x306f31['destination']==_0x4082('0x3a')){_0x306f31[_0x4082('0x31')]=extractCalleridNumber(_0x306f31['calleridpreview']);_0x306f31[_0x4082('0x3b')]=_0x306f31[_0x4082('0x3c')];_0x306f31[_0x4082('0x3d')]=[_0x306f31[_0x4082('0x3e')],_0x306f31[_0x4082('0x3e')]=_0x306f31[_0x4082('0x3d')]][0x0];_0x306f31[_0x4082('0x3f')]=_0x306f31[_0x4082('0x40')];}else{_0x306f31['destination']=_0x306f31[_0x4082('0x3b')];_0x306f31[_0x4082('0x3b')]=_0x306f31[_0x4082('0x3c')];if(_0x306f31[_0x4082('0x41')]==_0x4082('0x42')){_0x306f31[_0x4082('0x23')]=_0x306f31[_0x4082('0x28')];}else{_0x306f31[_0x4082('0x23')]='';}}}}else{_0x306f31[_0x4082('0x3f')]=util[_0x4082('0x2b')](_0x4082('0x43'),_0x306f31['calleridname'],_0x306f31[_0x4082('0x3b')]);}if(RpcVoiceTransferReport['transfers'][_0x306f31[_0x4082('0x44')]]){var _0x10062a=RpcVoiceTransferReport[_0x4082('0x45')][_0x306f31[_0x4082('0x44')]];_0x10062a[_0x4082('0x46')]=_0x306f31['uniqueid'];RpcVoiceTransferReport['blindTransfer'](_0x10062a);delete RpcVoiceTransferReport[_0x4082('0x45')][_0x306f31[_0x4082('0x44')]];}RpcVoiceCallReport[_0x4082('0x30')](_0x306f31);if(_0x306f31[_0x4082('0x47')]){for(var _0x57f109=0x0;_0x57f109<_0x306f31[_0x4082('0x48')][_0x4082('0x26')];_0x57f109+=0x1){_0x306f31[_0x4082('0x49')]=_0x306f31[_0x4082('0x48')][_0x57f109][_0x4082('0x4a')];_0x306f31[_0x4082('0x4b')]=_0x306f31[_0x4082('0x48')][_0x57f109][_0x4082('0x4b')];if(_0x306f31[_0x4082('0x32')]==_0x4082('0x3a')){_0x306f31[_0x4082('0x3b')]=_0x306f31[_0x4082('0x28')];_0x306f31[_0x4082('0x4c')]=_0x306f31['connectedlinename'];_0x306f31[_0x4082('0x28')]=_0x306f31[_0x4082('0x23')];_0x306f31[_0x4082('0x4d')]=_0x306f31[_0x4082('0x4e')];_0x306f31[_0x4082('0x32')]=_0x306f31[_0x4082('0x3c')];}else if(_0x306f31[_0x4082('0x32')]=='xcally-motion-dialer'){_0x306f31[_0x4082('0x3b')]=_0x306f31[_0x4082('0x31')];_0x306f31[_0x4082('0x32')]=_0x306f31['originatecalleridnum'];}RpcVoiceRecording[_0x4082('0x30')](_0x306f31);}}};Report[_0x4082('0x11')][_0x4082('0x1a')]=function(_0x21c000){if(_[_0x4082('0x4f')](_0x21c000)){_0x21c000['forEach'](function(_0x29833a){RpcVoiceAgentReport[_0x4082('0x30')](_0x29833a);});}else{RpcVoiceAgentReport[_0x4082('0x30')](_0x21c000);}};Report[_0x4082('0x11')][_0x4082('0x50')]=function(_0x2e524e){RpcVoiceDialReport[_0x4082('0x30')](_0x2e524e);var _0x4a7f9f;var _0x1b81d3;var _0x2b8802=_0x2e524e['channel'];if(_[_0x4082('0x51')](_0x2b8802,_0x4082('0x52'))){_0x1b81d3=_0x2b8802[_0x4082('0x53')](_0x2b8802[_0x4082('0x54')]('/')+0x1,_0x2b8802['indexOf']('@'));_0x4a7f9f=_[_0x4082('0x22')](this[_0x4082('0xf')],function(_0x1d4195){return _0x1d4195[_0x4082('0x55')]==_0x1b81d3||_0x1d4195['phone']==_0x1b81d3||_0x1d4195[_0x4082('0x23')]==_0x1b81d3;});}else{_0x1b81d3=_0x2b8802[_0x4082('0x53')](_0x2b8802[_0x4082('0x54')]('/')+0x1,_0x2b8802[_0x4082('0x56')]('-'));_0x4a7f9f=this[_0x4082('0x27')](_0x1b81d3);}if(_0x4a7f9f){_0x2e524e[_0x4082('0x24')]=_[_0x4082('0x21')](_0x4a7f9f['interface'])?util[_0x4082('0x2b')](_0x4082('0x25'),_0x4a7f9f[_0x4082('0x20')]):_0x4a7f9f[_0x4082('0x24')];_0x2e524e[_0x4082('0x4e')]=_0x4a7f9f[_0x4082('0x20')];_0x2e524e[_0x4082('0x23')]=_0x4a7f9f[_0x4082('0x23')];RpcMemberReport['voiceDialReport'](_0x2e524e);}};Report[_0x4082('0x11')][_0x4082('0x1d')]=function(_0x8993c3){RpcVoiceTransferReport[_0x4082('0x45')][_0x8993c3[_0x4082('0x57')]]=_0x8993c3;};Report[_0x4082('0x11')][_0x4082('0x1f')]=function(_0x2da0c3){RpcVoiceTransferReport['attendedTransfer'](_0x2da0c3);};module[_0x4082('0x58')]=Report; \ No newline at end of file +var _0x82f0=['../rpc/voiceTransferReport','./voiceQueueReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','isNil','name','interface','format','SIP/%s','assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','type','dialer','lastapplication','lastdata','queue','context','from-voip-provider','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','channel','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','monitor','monitors','monitorFilename','filename','calleridname','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','membername','transfererlinkedid','exports','lodash','moment','../../../config/environment','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x82f0,0xf8));var _0x082f=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x82f0[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x082f('0x0'));var moment=require(_0x082f('0x1'));var util=require('util');var config=require(_0x082f('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x082f('0x3'));var RpcVoiceDialReport=require(_0x082f('0x4'));var RpcMemberReport=require(_0x082f('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x082f('0x6'));var RpcVoiceTransferReport=require(_0x082f('0x7'));var VoiceQueueReport=require(_0x082f('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x082f('0x9'));var UserReport=require('./userReport');function Report(_0x49fc66){this[_0x082f('0xa')]=_0x49fc66;this[_0x082f('0xb')]=_0x49fc66[_0x082f('0xb')];this[_0x082f('0xc')]=_0x49fc66[_0x082f('0xc')];}Report[_0x082f('0xd')][_0x082f('0xe')]=function(_0x11a59a){var _0x570098=new VoiceQueueReport(this[_0x082f('0xa')]);var _0x52eb98=new VoiceAgentReport(this['realtime']);var _0x445fe8=new VoiceDialReport(this['realtime']);var _0x2d50e1=new VoiceCallReport(this[_0x082f('0xa')]);var _0x42a842=new UserReport(this[_0x082f('0xa')]);if(config['xdr']&&config[_0x082f('0xf')][_0x082f('0x10')]){ami['on'](_0x082f('0x11'),this[_0x082f('0x12')]['bind'](this));ami['on'](_0x082f('0x13'),this[_0x082f('0x14')][_0x082f('0x15')](this));ami['on'](_0x082f('0x16'),this['voiceAgentReport'][_0x082f('0x15')](this));ami['on'](_0x082f('0x17'),this[_0x082f('0x18')][_0x082f('0x15')](this));ami['on'](_0x082f('0x19'),this[_0x082f('0x1a')][_0x082f('0x15')](this));ami['on'](_0x082f('0x1b'),this[_0x082f('0x1c')][_0x082f('0x15')](this));}};Report[_0x082f('0xd')][_0x082f('0x1d')]=function(_0xe83fd8){var _0x4a3b01;_0x4a3b01=_[_0x082f('0x1e')](this[_0x082f('0xb')],function(_0x31cd5e){return _0x31cd5e[_0x082f('0x1f')]==_0xe83fd8||_0x31cd5e['name']==_0xe83fd8;});if(_[_0x082f('0x20')](_0x4a3b01)){var _0x1fe655=_[_0x082f('0x1e')](this[_0x082f('0xc')],function(_0x5369e8){return _0x5369e8['accountcode']==_0xe83fd8||_0x5369e8[_0x082f('0x21')]==_0xe83fd8;});if(_0x1fe655){_0x4a3b01=_['find'](this[_0x082f('0xb')],function(_0x156c49){return _0x156c49[_0x082f('0x22')]==util[_0x082f('0x23')](_0x082f('0x24'),_0x1fe655['name']);});}}return _0x4a3b01;};Report[_0x082f('0xd')][_0x082f('0x12')]=function(_0x3c54ba){for(var _0x167638=0x0;_0x167638<_0x3c54ba['length'];_0x167638+=0x1){var _0x492893=this[_0x082f('0x1d')](_0x3c54ba[_0x167638]['connectedlinenum']);if(_0x492893){_0x3c54ba[_0x167638]['accountcode']=_0x492893[_0x082f('0x1f')];_0x3c54ba[_0x167638][_0x082f('0x25')]=!![];_0x3c54ba[_0x167638][_0x082f('0x26')]=_0x492893[_0x082f('0x21')];_0x3c54ba[_0x167638][_0x082f('0x22')]=_[_0x082f('0x20')](_0x492893[_0x082f('0x22')])?util[_0x082f('0x23')](_0x082f('0x24'),_0x492893[_0x082f('0x21')]):_0x492893[_0x082f('0x22')];if(_0x3c54ba[_0x167638][_0x082f('0x27')]){_0x3c54ba[_0x167638]['queuecallercompleteAt']=moment()[_0x082f('0x23')](_0x082f('0x28'));}if(_0x3c54ba[_0x167638][_0x082f('0x29')]){_0x3c54ba[_0x167638][_0x082f('0x2a')]=moment()['format'](_0x082f('0x28'));}RpcMemberReport[_0x082f('0x12')](_0x3c54ba[_0x167638]);}RpcVoiceQueueReport[_0x082f('0x2b')](_0x3c54ba[_0x167638]);}};function extractCalleridNumber(_0x136532){var _0x20b7f6=_0x136532[_0x082f('0x2c')](/<(.*?)>/);return _0x20b7f6?_0x20b7f6[0x1]:_0x136532;}Report['prototype'][_0x082f('0x14')]=function(_0x41d399){_0x41d399[_0x082f('0x2d')]=_0x41d399[_0x082f('0x2d')]||_0x41d399[_0x082f('0x2e')];if(_0x41d399[_0x082f('0x2f')]==_0x082f('0x30')){_0x41d399[_0x082f('0x31')]='queue';_0x41d399[_0x082f('0x32')]=_0x41d399[_0x082f('0x33')];if(_0x41d399[_0x082f('0x34')]==_0x082f('0x35')){_0x41d399[_0x082f('0x1f')]='';_0x41d399[_0x082f('0x2d')]=extractCalleridNumber(_0x41d399['callerid']);}else if(_0x41d399[_0x082f('0x34')]=='from-sip'){if(_0x41d399[_0x082f('0x2d')]==_0x082f('0x36')){_0x41d399[_0x082f('0x2d')]=extractCalleridNumber(_0x41d399[_0x082f('0x37')]);_0x41d399[_0x082f('0x38')]=_0x41d399[_0x082f('0x39')];_0x41d399['destinationchannel']=[_0x41d399[_0x082f('0x3a')],_0x41d399[_0x082f('0x3a')]=_0x41d399['destinationchannel']][0x0];_0x41d399['callerid']=_0x41d399[_0x082f('0x37')];}else{_0x41d399['destination']=_0x41d399[_0x082f('0x38')];_0x41d399['calleridnum']=_0x41d399[_0x082f('0x39')];if(_0x41d399[_0x082f('0x3b')]==_0x082f('0x3c')){_0x41d399[_0x082f('0x1f')]=_0x41d399[_0x082f('0x3d')];}else{_0x41d399[_0x082f('0x1f')]='';}}}}else{_0x41d399['callerid']=util[_0x082f('0x23')](_0x082f('0x3e'),_0x41d399['calleridname'],_0x41d399[_0x082f('0x38')]);}if(RpcVoiceTransferReport[_0x082f('0x3f')][_0x41d399['linkedid']]){var _0x38ad39=RpcVoiceTransferReport[_0x082f('0x3f')][_0x41d399[_0x082f('0x40')]];_0x38ad39[_0x082f('0x41')]=_0x41d399['uniqueid'];RpcVoiceTransferReport['blindTransfer'](_0x38ad39);delete RpcVoiceTransferReport[_0x082f('0x3f')][_0x41d399[_0x082f('0x40')]];}RpcVoiceCallReport['create'](_0x41d399);if(_0x41d399[_0x082f('0x42')]){for(var _0x39ae22=0x0;_0x39ae22<_0x41d399[_0x082f('0x43')]['length'];_0x39ae22+=0x1){_0x41d399[_0x082f('0x44')]=_0x41d399[_0x082f('0x43')][_0x39ae22][_0x082f('0x45')];_0x41d399['createdAt']=_0x41d399[_0x082f('0x43')][_0x39ae22]['createdAt'];if(_0x41d399[_0x082f('0x2e')]==_0x082f('0x36')){_0x41d399[_0x082f('0x38')]=_0x41d399[_0x082f('0x3d')];_0x41d399[_0x082f('0x46')]=_0x41d399[_0x082f('0x47')];_0x41d399['connectedlinenum']=_0x41d399[_0x082f('0x1f')];_0x41d399[_0x082f('0x47')]=_0x41d399['membername'];_0x41d399['exten']=_0x41d399[_0x082f('0x39')];}else if(_0x41d399[_0x082f('0x2e')]==_0x082f('0x48')){_0x41d399[_0x082f('0x38')]=_0x41d399[_0x082f('0x2d')];_0x41d399[_0x082f('0x2e')]=_0x41d399[_0x082f('0x39')];}RpcVoiceRecording[_0x082f('0x2b')](_0x41d399);}}};Report[_0x082f('0xd')]['voiceAgentReport']=function(_0x3ea43e){if(_[_0x082f('0x49')](_0x3ea43e)){_0x3ea43e[_0x082f('0x4a')](function(_0x1129e2){RpcVoiceAgentReport['create'](_0x1129e2);});}else{RpcVoiceAgentReport[_0x082f('0x2b')](_0x3ea43e);}};Report['prototype']['voiceDialReport']=function(_0x212f37){RpcVoiceDialReport['create'](_0x212f37);var _0xf38815;var _0x4ee692;var _0x4d7af9=_0x212f37[_0x082f('0x3a')];if(_[_0x082f('0x4b')](_0x4d7af9,_0x082f('0x4c'))){_0x4ee692=_0x4d7af9[_0x082f('0x4d')](_0x4d7af9[_0x082f('0x4e')]('/')+0x1,_0x4d7af9[_0x082f('0x4e')]('@'));_0xf38815=_[_0x082f('0x1e')](this[_0x082f('0xb')],function(_0x534a7c){return _0x534a7c[_0x082f('0x4f')]==_0x4ee692||_0x534a7c[_0x082f('0x50')]==_0x4ee692||_0x534a7c[_0x082f('0x1f')]==_0x4ee692;});}else{_0x4ee692=_0x4d7af9['substring'](_0x4d7af9[_0x082f('0x4e')]('/')+0x1,_0x4d7af9[_0x082f('0x51')]('-'));_0xf38815=this[_0x082f('0x1d')](_0x4ee692);}if(_0xf38815){_0x212f37[_0x082f('0x22')]=_[_0x082f('0x20')](_0xf38815[_0x082f('0x22')])?util[_0x082f('0x23')](_0x082f('0x24'),_0xf38815[_0x082f('0x21')]):_0xf38815[_0x082f('0x22')];_0x212f37[_0x082f('0x52')]=_0xf38815[_0x082f('0x21')];_0x212f37[_0x082f('0x1f')]=_0xf38815[_0x082f('0x1f')];RpcMemberReport['voiceDialReport'](_0x212f37);}};Report[_0x082f('0xd')][_0x082f('0x1a')]=function(_0x254dde){RpcVoiceTransferReport[_0x082f('0x3f')][_0x254dde[_0x082f('0x53')]]=_0x254dde;};Report[_0x082f('0xd')]['attendedTransfer']=function(_0x1af79e){RpcVoiceTransferReport[_0x082f('0x1c')](_0x1af79e);};module[_0x082f('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 585e135..3353acf 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 _0xce0c=['format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','toLowerCase','local','toNumber','updateStatusRealtime','stateTime','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','phone','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][peerstatus]','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','peerstatus','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect','resolve','actionDeviceStateList','error','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','find','username','stateRegistry','merge','omit','event','[userReport][registry]\x20sending\x20trunk:save\x20event:'];(function(_0x5f2e80,_0x515ac9){var _0x51ab0a=function(_0x115bb0){while(--_0x115bb0){_0x5f2e80['push'](_0x5f2e80['shift']());}};_0x51ab0a(++_0x515ac9);}(_0xce0c,0x1ea));var _0xcce0=function(_0x5bf18d,_0x264c55){_0x5bf18d=_0x5bf18d-0x0;var _0x1d6cc0=_0xce0c[_0x5bf18d];return _0x1d6cc0;};'use strict';var _=require(_0xcce0('0x0'));var moment=require(_0xcce0('0x1'));var util=require(_0xcce0('0x2'));var Redis=require(_0xcce0('0x3'));var BPromise=require(_0xcce0('0x4'));var config=require(_0xcce0('0x5'));var logger=require(_0xcce0('0x6'))(_0xcce0('0x7'));var ami=require(_0xcce0('0x8'));config[_0xcce0('0x9')]=_[_0xcce0('0xa')](config[_0xcce0('0x9')],{'host':_0xcce0('0xb'),'port':0x18eb});var io=require(_0xcce0('0xc'))(new Redis(config['redis']));function UserReport(_0x4be05a){this[_0xcce0('0xd')]=_0x4be05a[_0xcce0('0xd')];this[_0xcce0('0xe')]=_0x4be05a['agents'];this[_0xcce0('0xf')]=_0x4be05a['telephones'];ami['on'](_0xcce0('0x10'),this[_0xcce0('0x11')][_0xcce0('0x12')](this));ami['on']('registry',this[_0xcce0('0x11')][_0xcce0('0x12')](this));ami['on']('devicestatechange',this['syncDeviceState'][_0xcce0('0x12')](this));ami['on'](_0xcce0('0x13'),this[_0xcce0('0x14')][_0xcce0('0x12')](this));return this[_0xcce0('0x15')]();}function showSipRegistrations(){Promise['resolve']()[_0xcce0('0x16')](ami[_0xcce0('0x17')]())[_0xcce0('0x18')](function(_0x523052){logger['error'](_0xcce0('0x19'),util[_0xcce0('0x1a')](_0x523052,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xcce0('0x1b')]()[_0xcce0('0x16')](ami[_0xcce0('0x1c')]())['catch'](function(_0x362111){logger[_0xcce0('0x1d')](_0xcce0('0x1e'),util['inspect'](_0x362111,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xcce0('0x1b')]()[_0xcce0('0x16')](ami[_0xcce0('0x1f')]())[_0xcce0('0x18')](function(_0x1479a2){logger[_0xcce0('0x1d')](_0xcce0('0x20'),util[_0xcce0('0x1a')](_0x1479a2,{'showHidden':![],'depth':null}));});}UserReport[_0xcce0('0x21')][_0xcce0('0x15')]=function(){setInterval(function(){BPromise[_0xcce0('0x1b')]()[_0xcce0('0x16')](showSipRegistrations())['then'](listDeviceStates())[_0xcce0('0x16')](showPeersStatus());},0x32c8);};UserReport[_0xcce0('0x21')][_0xcce0('0x22')]=function(_0x12773b){return _0x12773b!==null&&!_[_0xcce0('0x23')](_0x12773b);};UserReport[_0xcce0('0x21')][_0xcce0('0x24')]=function(_0x4b317b,_0x4a8e21,_0x63a892){io['to'](_0x4b317b)[_0xcce0('0x24')](_0x4a8e21,_0x63a892);};UserReport[_0xcce0('0x21')][_0xcce0('0x11')]=function(_0x408a4f){try{if(this['isNotNull'](_0x408a4f)){logger[_0xcce0('0x25')](_0xcce0('0x26'),_0x408a4f['username'],_0x408a4f[_0xcce0('0x27')]);logger[_0xcce0('0x28')](_0xcce0('0x29'),util['inspect'](_0x408a4f,{'showHidden':![],'depth':null}));var _0x29636d=_[_0xcce0('0x2a')](this['trunks'],{'defaultuser':_0x408a4f[_0xcce0('0x2b')]});if(_0x29636d){_0x408a4f[_0xcce0('0x2c')]=_0x408a4f[_0xcce0('0x27')];_[_0xcce0('0x2d')](_0x29636d,_[_0xcce0('0x2e')](_0x408a4f,[_0xcce0('0x2f'),'actionid',_0xcce0('0x2b'),_0xcce0('0x27')]));logger['debug'](_0xcce0('0x30'),util[_0xcce0('0x1a')](_0x29636d,{'showHidden':![],'depth':null}));this[_0xcce0('0x24')](util[_0xcce0('0x31')](_0xcce0('0x32'),_0x29636d[_0xcce0('0x33')]),_0xcce0('0x34'),_0x29636d);}}}catch(_0x41ba3c){logger['error'](_0xcce0('0x29'),util[_0xcce0('0x1a')](_0x41ba3c,{'showHidden':![],'depth':null}));}};UserReport[_0xcce0('0x21')]['syncDeviceState']=function(_0x33aee3){try{if(this['isNotNull'](_0x33aee3)){logger['info'](_0xcce0('0x35'),_0x33aee3[_0xcce0('0x36')],_0x33aee3[_0xcce0('0x27')]);logger[_0xcce0('0x28')](_0xcce0('0x37'),util['inspect'](_0x33aee3,{'showHidden':![],'depth':null}));if(this['agents'][_0x33aee3[_0xcce0('0x36')]]){if(!this['agents'][_0x33aee3['device']]['local']||_0x33aee3[_0xcce0('0x27')][_0xcce0('0x38')]()=='inuse'){this['agents'][_0x33aee3[_0xcce0('0x36')]][_0xcce0('0x39')]=![];if(this[_0xcce0('0xe')][_0x33aee3['device']][_0xcce0('0x27')]!==_0x33aee3[_0xcce0('0x27')][_0xcce0('0x38')]()){this[_0xcce0('0xe')][_0x33aee3['device']]['stateTime']=_[_0xcce0('0x3a')](moment()[_0xcce0('0x31')]('x'));}this[_0xcce0('0xe')][_0x33aee3[_0xcce0('0x36')]]['state']=_0x33aee3[_0xcce0('0x27')]['toLowerCase']();this['agents'][_0x33aee3[_0xcce0('0x36')]][_0xcce0('0x3b')](_0x33aee3);}}else if(this[_0xcce0('0xf')][_0x33aee3[_0xcce0('0x36')]]){if(this[_0xcce0('0xf')][_0x33aee3[_0xcce0('0x36')]][_0xcce0('0x27')]!==_0x33aee3['state'][_0xcce0('0x38')]()){this[_0xcce0('0xf')][_0x33aee3[_0xcce0('0x36')]][_0xcce0('0x3c')]=_[_0xcce0('0x3a')](moment()[_0xcce0('0x31')]('x'));}this[_0xcce0('0xf')][_0x33aee3[_0xcce0('0x36')]]['state']=_0x33aee3[_0xcce0('0x27')]['toLowerCase']();logger[_0xcce0('0x28')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0xcce0('0xf')][_0x33aee3['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0xcce0('0x31')](_0xcce0('0x3d'),this[_0xcce0('0xf')][_0x33aee3['device']][_0xcce0('0x33')]),'telephone:save',this[_0xcce0('0xf')][_0x33aee3['device']]);}else if(this[_0xcce0('0xd')][_0x33aee3[_0xcce0('0x36')]]){if(this[_0xcce0('0xd')][_0x33aee3[_0xcce0('0x36')]][_0xcce0('0x27')]!==_0x33aee3[_0xcce0('0x27')][_0xcce0('0x38')]()){this[_0xcce0('0xd')][_0x33aee3['device']][_0xcce0('0x3c')]=_[_0xcce0('0x3a')](moment()[_0xcce0('0x31')]('x'));}this[_0xcce0('0xd')][_0x33aee3[_0xcce0('0x36')]][_0xcce0('0x27')]=_0x33aee3['state'][_0xcce0('0x38')]();logger[_0xcce0('0x28')](_0xcce0('0x3e'),util[_0xcce0('0x1a')](this[_0xcce0('0xd')][_0x33aee3[_0xcce0('0x36')]],{'showHidden':![],'depth':null}));this[_0xcce0('0x24')](util[_0xcce0('0x31')](_0xcce0('0x32'),this[_0xcce0('0xd')][_0x33aee3[_0xcce0('0x36')]][_0xcce0('0x33')]),_0xcce0('0x34'),this[_0xcce0('0xd')][_0x33aee3[_0xcce0('0x36')]]);}else if(_[_0xcce0('0x3f')](_0x33aee3[_0xcce0('0x36')],_0xcce0('0x40'))){var _0x569bb=_0x33aee3[_0xcce0('0x36')];var _0x268b21=_0x569bb[_0xcce0('0x41')](_0x569bb[_0xcce0('0x42')]('/')+0x1,_0x569bb[_0xcce0('0x42')]('@'));var _0x12b56d=_[_0xcce0('0x2a')](this[_0xcce0('0xe')],function(_0x4427e7){return _0x4427e7[_0xcce0('0x43')]==_0x268b21||_0x4427e7[_0xcce0('0x44')]==_0x268b21||_0x4427e7['accountcode']==_0x268b21;});if(_0x12b56d){if(_0x12b56d[_0xcce0('0x27')]!==_0x33aee3['state'][_0xcce0('0x38')]()){_0x12b56d[_0xcce0('0x3c')]=_[_0xcce0('0x3a')](moment()['format']('x'));}_0x12b56d[_0xcce0('0x27')]=_0x33aee3[_0xcce0('0x27')][_0xcce0('0x38')]();_0x12b56d['local']=!![];_0x12b56d[_0xcce0('0x3b')](_0x33aee3);}}}}catch(_0xfc0c71){logger['error']('[userReport][devicestatechange]',util[_0xcce0('0x1a')](_0xfc0c71,{'showHidden':![],'depth':null}));}};UserReport[_0xcce0('0x21')]['syncPeerStatus']=function(_0x6673a2){try{if(this[_0xcce0('0x22')](_0x6673a2)&&this[_0xcce0('0x22')](_0x6673a2[_0xcce0('0x13')])){logger[_0xcce0('0x25')](_0xcce0('0x45'),_0x6673a2[_0xcce0('0x46')],_0x6673a2[_0xcce0('0x47')],_0x6673a2[_0xcce0('0x13')]);logger[_0xcce0('0x28')]('[userReport][peerstatus]',util[_0xcce0('0x1a')](_0x6673a2,{'showHidden':![],'depth':null}));if(this[_0xcce0('0xe')][_0x6673a2[_0xcce0('0x46')]]){if(!this[_0xcce0('0xe')][_0x6673a2[_0xcce0('0x46')]]['local']||_0x6673a2['peerstatus'][_0xcce0('0x38')]()==_0xcce0('0x48')){this[_0xcce0('0xe')][_0x6673a2[_0xcce0('0x46')]][_0xcce0('0x39')]=![];this['agents'][_0x6673a2[_0xcce0('0x46')]]['status']=_0x6673a2[_0xcce0('0x13')][_0xcce0('0x38')]();this['agents'][_0x6673a2[_0xcce0('0x46')]][_0xcce0('0x47')]=_0x6673a2[_0xcce0('0x47')];this[_0xcce0('0xe')][_0x6673a2[_0xcce0('0x46')]][_0xcce0('0x3b')](_0x6673a2);}}else if(this['telephones'][_0x6673a2[_0xcce0('0x46')]]){this[_0xcce0('0xf')][_0x6673a2[_0xcce0('0x46')]][_0xcce0('0x49')]=_0x6673a2['peerstatus'][_0xcce0('0x38')]();this['telephones'][_0x6673a2['peer']][_0xcce0('0x47')]=_0x6673a2[_0xcce0('0x47')];logger[_0xcce0('0x28')](_0xcce0('0x4a'),util['inspect'](this[_0xcce0('0xf')][_0x6673a2[_0xcce0('0x46')]],{'showHidden':![],'depth':null}));this[_0xcce0('0x24')](util[_0xcce0('0x31')]('telephone:%s',this['telephones'][_0x6673a2[_0xcce0('0x46')]][_0xcce0('0x33')]),_0xcce0('0x4b'),this['telephones'][_0x6673a2[_0xcce0('0x46')]]);}else if(this[_0xcce0('0xd')][_0x6673a2['peer']]){this[_0xcce0('0xd')][_0x6673a2['peer']][_0xcce0('0x49')]=_0x6673a2[_0xcce0('0x13')][_0xcce0('0x38')]();this['trunks'][_0x6673a2[_0xcce0('0x46')]][_0xcce0('0x47')]=_0x6673a2[_0xcce0('0x47')];logger[_0xcce0('0x28')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xcce0('0x1a')](this[_0xcce0('0xd')][_0x6673a2[_0xcce0('0x46')]],{'showHidden':![],'depth':null}));this[_0xcce0('0x24')](util[_0xcce0('0x31')]('trunk:%s',this[_0xcce0('0xd')][_0x6673a2['peer']][_0xcce0('0x33')]),'trunk:save',this['trunks'][_0x6673a2[_0xcce0('0x46')]]);}}}catch(_0x1907e9){logger[_0xcce0('0x1d')](_0xcce0('0x4c'),util[_0xcce0('0x1a')](_0x1907e9,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x035c=['../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','syncDeviceState','peerstatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','[userReport][devicestatelist]','actionSipPeerStatus','prototype','isUndefined','emit','isNotNull','[userReport][registry]\x20registry:%s\x20state:%s','debug','username','stateRegistry','state','omit','event','actionid','name','trunk:save','[userReport][registry]','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','local','toLowerCase','inuse','device','toNumber','format','updateStatusRealtime','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','startsWith','Local','substring','indexOf','accountcode','[userReport][devicestatechange]','syncPeerStatus','peer','[userReport][peerstatus]','address','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','ioredis','../../../config/environment','ami'];(function(_0x597646,_0x3b7fa5){var _0x3d2ee8=function(_0x8fe622){while(--_0x8fe622){_0x597646['push'](_0x597646['shift']());}};_0x3d2ee8(++_0x3b7fa5);}(_0x035c,0x1ec));var _0xc035=function(_0x36b99d,_0x1d16ec){_0x36b99d=_0x36b99d-0x0;var _0x400d00=_0x035c[_0x36b99d];return _0x400d00;};'use strict';var _=require(_0xc035('0x0'));var moment=require(_0xc035('0x1'));var util=require('util');var Redis=require(_0xc035('0x2'));var BPromise=require('bluebird');var config=require(_0xc035('0x3'));var logger=require('../../../config/logger')(_0xc035('0x4'));var ami=require(_0xc035('0x5'));config[_0xc035('0x6')]=_[_0xc035('0x7')](config[_0xc035('0x6')],{'host':_0xc035('0x8'),'port':0x18eb});var io=require(_0xc035('0x9'))(new Redis(config[_0xc035('0x6')]));function UserReport(_0x23ad81){this[_0xc035('0xa')]=_0x23ad81['trunks'];this[_0xc035('0xb')]=_0x23ad81[_0xc035('0xb')];this[_0xc035('0xc')]=_0x23ad81['telephones'];ami['on'](_0xc035('0xd'),this[_0xc035('0xe')][_0xc035('0xf')](this));ami['on']('registry',this[_0xc035('0xe')]['bind'](this));ami['on']('devicestatechange',this[_0xc035('0x10')][_0xc035('0xf')](this));ami['on'](_0xc035('0x11'),this['syncPeerStatus'][_0xc035('0xf')](this));return this[_0xc035('0x12')]();}function showSipRegistrations(){Promise[_0xc035('0x13')]()[_0xc035('0x14')](ami[_0xc035('0x15')]())[_0xc035('0x16')](function(_0x5601de){logger[_0xc035('0x17')](_0xc035('0x18'),util[_0xc035('0x19')](_0x5601de,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xc035('0x13')]()[_0xc035('0x14')](ami['actionDeviceStateList']())[_0xc035('0x16')](function(_0x53c69){logger['error'](_0xc035('0x1a'),util[_0xc035('0x19')](_0x53c69,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xc035('0x13')]()['then'](ami[_0xc035('0x1b')]())['catch'](function(_0x19436a){logger[_0xc035('0x17')]('[userReport][sippeerstatus]',util[_0xc035('0x19')](_0x19436a,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise['resolve']()[_0xc035('0x14')](showSipRegistrations())['then'](listDeviceStates())[_0xc035('0x14')](showPeersStatus());},0x32c8);};UserReport[_0xc035('0x1c')]['isNotNull']=function(_0xa803ad){return _0xa803ad!==null&&!_[_0xc035('0x1d')](_0xa803ad);};UserReport[_0xc035('0x1c')][_0xc035('0x1e')]=function(_0x454e3f,_0x2e3f15,_0x42dd92){io['to'](_0x454e3f)[_0xc035('0x1e')](_0x2e3f15,_0x42dd92);};UserReport['prototype'][_0xc035('0xe')]=function(_0x5dc919){try{if(this[_0xc035('0x1f')](_0x5dc919)){logger['info'](_0xc035('0x20'),_0x5dc919['username'],_0x5dc919['state']);logger[_0xc035('0x21')]('[userReport][registry]',util['inspect'](_0x5dc919,{'showHidden':![],'depth':null}));var _0x8f546=_['find'](this[_0xc035('0xa')],{'defaultuser':_0x5dc919[_0xc035('0x22')]});if(_0x8f546){_0x5dc919[_0xc035('0x23')]=_0x5dc919[_0xc035('0x24')];_['merge'](_0x8f546,_[_0xc035('0x25')](_0x5dc919,[_0xc035('0x26'),_0xc035('0x27'),_0xc035('0x22'),_0xc035('0x24')]));logger[_0xc035('0x21')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util['inspect'](_0x8f546,{'showHidden':![],'depth':null}));this['emit'](util['format']('trunk:%s',_0x8f546[_0xc035('0x28')]),_0xc035('0x29'),_0x8f546);}}}catch(_0x4096b4){logger[_0xc035('0x17')](_0xc035('0x2a'),util[_0xc035('0x19')](_0x4096b4,{'showHidden':![],'depth':null}));}};UserReport[_0xc035('0x1c')][_0xc035('0x10')]=function(_0x534d39){try{if(this['isNotNull'](_0x534d39)){logger[_0xc035('0x2b')](_0xc035('0x2c'),_0x534d39['device'],_0x534d39[_0xc035('0x24')]);logger[_0xc035('0x21')]('[userReport][devicestatechange]',util[_0xc035('0x19')](_0x534d39,{'showHidden':![],'depth':null}));if(this['agents'][_0x534d39['device']]){if(!this[_0xc035('0xb')][_0x534d39['device']][_0xc035('0x2d')]||_0x534d39['state'][_0xc035('0x2e')]()==_0xc035('0x2f')){this[_0xc035('0xb')][_0x534d39[_0xc035('0x30')]][_0xc035('0x2d')]=![];if(this[_0xc035('0xb')][_0x534d39[_0xc035('0x30')]]['state']!==_0x534d39[_0xc035('0x24')][_0xc035('0x2e')]()){this[_0xc035('0xb')][_0x534d39[_0xc035('0x30')]]['stateTime']=_[_0xc035('0x31')](moment()[_0xc035('0x32')]('x'));}this[_0xc035('0xb')][_0x534d39[_0xc035('0x30')]]['state']=_0x534d39['state'][_0xc035('0x2e')]();this['agents'][_0x534d39[_0xc035('0x30')]][_0xc035('0x33')](_0x534d39);}}else if(this[_0xc035('0xc')][_0x534d39[_0xc035('0x30')]]){if(this['telephones'][_0x534d39['device']][_0xc035('0x24')]!==_0x534d39['state'][_0xc035('0x2e')]()){this['telephones'][_0x534d39[_0xc035('0x30')]][_0xc035('0x34')]=_['toNumber'](moment()[_0xc035('0x32')]('x'));}this['telephones'][_0x534d39[_0xc035('0x30')]][_0xc035('0x24')]=_0x534d39[_0xc035('0x24')][_0xc035('0x2e')]();logger[_0xc035('0x21')](_0xc035('0x35'),util[_0xc035('0x19')](this['telephones'][_0x534d39[_0xc035('0x30')]],{'showHidden':![],'depth':null}));this[_0xc035('0x1e')](util[_0xc035('0x32')](_0xc035('0x36'),this['telephones'][_0x534d39['device']][_0xc035('0x28')]),_0xc035('0x37'),this['telephones'][_0x534d39[_0xc035('0x30')]]);}else if(this[_0xc035('0xa')][_0x534d39[_0xc035('0x30')]]){if(this['trunks'][_0x534d39[_0xc035('0x30')]][_0xc035('0x24')]!==_0x534d39[_0xc035('0x24')][_0xc035('0x2e')]()){this[_0xc035('0xa')][_0x534d39[_0xc035('0x30')]][_0xc035('0x34')]=_[_0xc035('0x31')](moment()[_0xc035('0x32')]('x'));}this[_0xc035('0xa')][_0x534d39[_0xc035('0x30')]][_0xc035('0x24')]=_0x534d39[_0xc035('0x24')][_0xc035('0x2e')]();logger[_0xc035('0x21')](_0xc035('0x38'),util['inspect'](this[_0xc035('0xa')][_0x534d39[_0xc035('0x30')]],{'showHidden':![],'depth':null}));this[_0xc035('0x1e')](util[_0xc035('0x32')](_0xc035('0x39'),this['trunks'][_0x534d39['device']][_0xc035('0x28')]),_0xc035('0x29'),this[_0xc035('0xa')][_0x534d39['device']]);}else if(_[_0xc035('0x3a')](_0x534d39[_0xc035('0x30')],_0xc035('0x3b'))){var _0x218e5b=_0x534d39[_0xc035('0x30')];var _0x3dcba3=_0x218e5b[_0xc035('0x3c')](_0x218e5b[_0xc035('0x3d')]('/')+0x1,_0x218e5b[_0xc035('0x3d')]('@'));var _0x474b56=_['find'](this[_0xc035('0xb')],function(_0x13687e){return _0x13687e['mobile']==_0x3dcba3||_0x13687e['phone']==_0x3dcba3||_0x13687e[_0xc035('0x3e')]==_0x3dcba3;});if(_0x474b56){if(_0x474b56[_0xc035('0x24')]!==_0x534d39[_0xc035('0x24')][_0xc035('0x2e')]()){_0x474b56[_0xc035('0x34')]=_['toNumber'](moment()[_0xc035('0x32')]('x'));}_0x474b56[_0xc035('0x24')]=_0x534d39[_0xc035('0x24')][_0xc035('0x2e')]();_0x474b56[_0xc035('0x2d')]=!![];_0x474b56[_0xc035('0x33')](_0x534d39);}}}}catch(_0x5843cf){logger[_0xc035('0x17')](_0xc035('0x3f'),util[_0xc035('0x19')](_0x5843cf,{'showHidden':![],'depth':null}));}};UserReport[_0xc035('0x1c')][_0xc035('0x40')]=function(_0x333900){try{if(this['isNotNull'](_0x333900)&&this['isNotNull'](_0x333900['peerstatus'])){logger[_0xc035('0x2b')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x333900[_0xc035('0x41')],_0x333900['address'],_0x333900[_0xc035('0x11')]);logger[_0xc035('0x21')](_0xc035('0x42'),util[_0xc035('0x19')](_0x333900,{'showHidden':![],'depth':null}));if(this[_0xc035('0xb')][_0x333900['peer']]){if(!this[_0xc035('0xb')][_0x333900[_0xc035('0x41')]][_0xc035('0x2d')]||_0x333900[_0xc035('0x11')][_0xc035('0x2e')]()=='registered'){this['agents'][_0x333900[_0xc035('0x41')]][_0xc035('0x2d')]=![];this[_0xc035('0xb')][_0x333900['peer']]['status']=_0x333900[_0xc035('0x11')][_0xc035('0x2e')]();this[_0xc035('0xb')][_0x333900['peer']][_0xc035('0x43')]=_0x333900[_0xc035('0x43')];this['agents'][_0x333900['peer']][_0xc035('0x33')](_0x333900);}}else if(this[_0xc035('0xc')][_0x333900[_0xc035('0x41')]]){this[_0xc035('0xc')][_0x333900[_0xc035('0x41')]][_0xc035('0x44')]=_0x333900['peerstatus']['toLowerCase']();this['telephones'][_0x333900['peer']]['address']=_0x333900[_0xc035('0x43')];logger[_0xc035('0x21')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0xc035('0x19')](this[_0xc035('0xc')][_0x333900['peer']],{'showHidden':![],'depth':null}));this[_0xc035('0x1e')](util[_0xc035('0x32')](_0xc035('0x36'),this[_0xc035('0xc')][_0x333900['peer']][_0xc035('0x28')]),'telephone:save',this[_0xc035('0xc')][_0x333900['peer']]);}else if(this[_0xc035('0xa')][_0x333900[_0xc035('0x41')]]){this[_0xc035('0xa')][_0x333900['peer']][_0xc035('0x44')]=_0x333900[_0xc035('0x11')]['toLowerCase']();this[_0xc035('0xa')][_0x333900['peer']][_0xc035('0x43')]=_0x333900[_0xc035('0x43')];logger[_0xc035('0x21')](_0xc035('0x45'),util[_0xc035('0x19')](this['trunks'][_0x333900[_0xc035('0x41')]],{'showHidden':![],'depth':null}));this[_0xc035('0x1e')](util[_0xc035('0x32')](_0xc035('0x39'),this[_0xc035('0xa')][_0x333900['peer']][_0xc035('0x28')]),_0xc035('0x29'),this['trunks'][_0x333900[_0xc035('0x41')]]);}}}catch(_0x131b96){logger['error'](_0xc035('0x42'),util[_0xc035('0x19')](_0x131b96,{'showHidden':![],'depth':null}));}};module[_0xc035('0x46')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index a42a99b..10f42db 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 _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x12d8e1,_0x1a9438){var _0x5043b5=function(_0x467ce3){while(--_0x467ce3){_0x12d8e1['push'](_0x12d8e1['shift']());}};_0x5043b5(++_0x1a9438);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x413dba,_0x39aac7){var _0x211792=function(_0x329c54){while(--_0x329c54){_0x413dba['push'](_0x413dba['shift']());}};_0x211792(++_0x39aac7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 7b32bdf..d7f1454 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 _0x57ca=['xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','sipcallid','sipcalluniqueid','parse','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','answertime','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','transferType','undefined','stopRecordingOnTransfer','then','Action','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','context','transfererchannel','transfereruniqueid','BLIND','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','../rpc/setting','unknown','not_inuse','inuse','busy','invalid','unavailable','ringinuse','set','queue','dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','newexten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','debug','uniqueid','merge','pick','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','channelstate','keys','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','CDR(routeAlias)','appdata','duration','seconds','format','disposition','includes','lastapplication','startsWith','cdr(','split','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','linkedid','answered','holdtime','diff','xcally-motion-preview','connectedlinename','destinationchannel','toNumber','membername','name','UserId','from-sip','routealias','accountcode','exten','user:%s','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','OutgoingSpoolFailed','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','value','xmd-callerid','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum'];(function(_0xbf4ddf,_0x66b3cb){var _0x3cb273=function(_0x3cf903){while(--_0x3cf903){_0xbf4ddf['push'](_0xbf4ddf['shift']());}};_0x3cb273(++_0x66b3cb);}(_0x57ca,0x108));var _0xa57c=function(_0x111d82,_0x45c0b3){_0x111d82=_0x111d82-0x0;var _0x4b6ce8=_0x57ca[_0x111d82];return _0x4b6ce8;};'use strict';var BPromise=require('bluebird');var _=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var util=require('util');var path=require(_0xa57c('0x2'));var Redis=require(_0xa57c('0x3'));var config=require(_0xa57c('0x4'));var logger=require(_0xa57c('0x5'))(_0xa57c('0x6'));var ami=require('../ami');var Channel=require(_0xa57c('0x7'));var RpcSetting=require(_0xa57c('0x8'));var statusDesc=[_0xa57c('0x9'),_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc'),_0xa57c('0xd'),_0xa57c('0xe'),'ringing',_0xa57c('0xf'),'onhold'];var applications=[_0xa57c('0x10'),_0xa57c('0x11'),'agi',_0xa57c('0x12'),'playback',_0xa57c('0x13')];var dispositions=[_0xa57c('0x14'),'FAILED',_0xa57c('0x15'),'NO\x20ANSWER',_0xa57c('0x14'),_0xa57c('0x14'),_0xa57c('0x16'),_0xa57c('0x17'),_0xa57c('0x15'),'FAILED',_0xa57c('0x15')];var actions={};config['redis']=_[_0xa57c('0x18')](config[_0xa57c('0x19')],{'host':_0xa57c('0x1a'),'port':0x18eb});var io=require(_0xa57c('0x1b'))(new Redis(config[_0xa57c('0x19')]));function VoiceCallReport(_0x37a323){this[_0xa57c('0x1c')]=_0x37a323['channels'];this[_0xa57c('0x1d')]=_0x37a323[_0xa57c('0x1d')];this[_0xa57c('0x1e')]={};ami['on']('coreshowchannel',this[_0xa57c('0x1f')]['bind'](this));ami['on'](_0xa57c('0x20'),this[_0xa57c('0x1f')][_0xa57c('0x21')](this));ami['on'](_0xa57c('0x22'),this[_0xa57c('0x23')][_0xa57c('0x21')](this));ami['on'](_0xa57c('0x24'),this[_0xa57c('0x25')]['bind'](this));ami['on'](_0xa57c('0x26'),this['syncVarSet']['bind'](this));ami['on'](_0xa57c('0x27'),this[_0xa57c('0x28')][_0xa57c('0x21')](this));ami['on'](_0xa57c('0x29'),this['syncNewCallerId'][_0xa57c('0x21')](this));ami['on'](_0xa57c('0x2a'),this[_0xa57c('0x2b')][_0xa57c('0x21')](this));ami['on'](_0xa57c('0x2c'),this[_0xa57c('0x2d')][_0xa57c('0x21')](this));ami['on'](_0xa57c('0x2e'),this[_0xa57c('0x2f')][_0xa57c('0x21')](this));ami['on'](_0xa57c('0x30'),this[_0xa57c('0x31')][_0xa57c('0x21')](this));try{logger[_0xa57c('0x32')](_0xa57c('0x33'));ami['actionCoreShowChannels']();}catch(_0x2db443){logger[_0xa57c('0x34')](_0xa57c('0x35'),util[_0xa57c('0x36')](_0x2db443,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xa57c('0x37')][_0xa57c('0x38')]=function(_0x8ee1c0){return _0x8ee1c0!==null&&!_[_0xa57c('0x39')](_0x8ee1c0);};VoiceCallReport[_0xa57c('0x37')][_0xa57c('0x3a')]=function(_0x57ebe0,_0x3b7364,_0x4c1478){io['to'](_0x57ebe0)['emit'](_0x3b7364,_0x4c1478);};VoiceCallReport[_0xa57c('0x37')][_0xa57c('0x3b')]=function(_0x5a3e03){try{if(this[_0xa57c('0x38')](_0x5a3e03)){logger[_0xa57c('0x32')](_0xa57c('0x3c'),_0x5a3e03['uniqueid'],_0x5a3e03[_0xa57c('0x3d')],_0x5a3e03['calleridnum']);logger[_0xa57c('0x3e')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x5a3e03[_0xa57c('0x3f')],util['inspect'](_0x5a3e03,{'showHidden':![],'depth':null}));if(_0x5a3e03[_0xa57c('0x3f')]===_0x5a3e03['linkedid']){if(!_[_0xa57c('0x39')](this[_0xa57c('0x1c')][_0x5a3e03[_0xa57c('0x3f')]])){_[_0xa57c('0x40')](this[_0xa57c('0x1c')][_0x5a3e03[_0xa57c('0x3f')]],_[_0xa57c('0x41')](_0x5a3e03,_['keys'](this[_0xa57c('0x1c')][_0x5a3e03['uniqueid']])));}}}}catch(_0xbece0a){logger[_0xa57c('0x34')](_0xa57c('0x42'),_0x5a3e03['uniqueid'],util[_0xa57c('0x36')](_0xbece0a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa57c('0x23')]=function(_0x501a4c){try{if(this[_0xa57c('0x38')](_0x501a4c)){logger['debug'](_0xa57c('0x43'),_0x501a4c[_0xa57c('0x3f')],util['inspect'](_0x501a4c,{'showHidden':![],'depth':null}));if(_0x501a4c[_0xa57c('0x3f')]===_0x501a4c['linkedid']&&_0x501a4c[_0xa57c('0x44')]!='OutgoingSpoolFailed'){if(_[_0xa57c('0x39')](this[_0xa57c('0x1c')][_0x501a4c[_0xa57c('0x3f')]])){logger[_0xa57c('0x32')](_0xa57c('0x45'),_0x501a4c[_0xa57c('0x3f')],_0x501a4c['context'],_0x501a4c['exten']);this[_0xa57c('0x1c')][_0x501a4c[_0xa57c('0x3f')]]=new Channel();this[_0xa57c('0x1c')][_0x501a4c['uniqueid']][_0xa57c('0x46')]=moment()['format'](_0xa57c('0x47'));this[_0xa57c('0x1c')][_0x501a4c['uniqueid']]['disposition']=dispositions[_['toNumber'](_0x501a4c[_0xa57c('0x48')])];_[_0xa57c('0x40')](this[_0xa57c('0x1c')][_0x501a4c[_0xa57c('0x3f')]],_[_0xa57c('0x41')](_0x501a4c,_[_0xa57c('0x49')](this['channels'][_0x501a4c[_0xa57c('0x3f')]])));}}}}catch(_0x1d4d2e){logger['error']('[%s][voiceCallReport][newchannel]',_0x501a4c[_0xa57c('0x3f')],util[_0xa57c('0x36')](_0x1d4d2e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa57c('0x1f')]=function(_0x5603cf){try{if(this[_0xa57c('0x38')](_0x5603cf)){logger[_0xa57c('0x3e')](_0xa57c('0x4a'),_0x5603cf[_0xa57c('0x3f')],util['inspect'](_0x5603cf,{'showHidden':![],'depth':null}));if(_0x5603cf[_0xa57c('0x3f')]===_0x5603cf['linkedid']&&_0x5603cf['exten']!='h'&&_0x5603cf['channel']!='OutgoingSpoolFailed'){_0x5603cf['application']=_0x5603cf[_0xa57c('0x4b')][_0xa57c('0x4c')]();_0x5603cf[_0xa57c('0x4d')]=_0x5603cf['appdata']&&_0x5603cf['appdata']['startsWith'](_0xa57c('0x4e'))?_0x5603cf[_0xa57c('0x4f')]:(_0x5603cf[_0xa57c('0x4f')]||_0x5603cf[_0xa57c('0x4d')])[_0xa57c('0x4c')]();logger[_0xa57c('0x32')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x5603cf[_0xa57c('0x3f')],_0x5603cf[_0xa57c('0x4b')],_0x5603cf[_0xa57c('0x4d')]);if(_[_0xa57c('0x39')](this[_0xa57c('0x1c')][_0x5603cf[_0xa57c('0x3f')]])){this['channels'][_0x5603cf[_0xa57c('0x3f')]]=new Channel();this[_0xa57c('0x1c')][_0x5603cf[_0xa57c('0x3f')]][_0xa57c('0x46')]=_0x5603cf[_0xa57c('0x50')]?moment()['subtract'](moment[_0xa57c('0x50')](_0x5603cf[_0xa57c('0x50')])[_0xa57c('0x51')](),_0xa57c('0x51'))[_0xa57c('0x52')](_0xa57c('0x47')):moment()['format'](_0xa57c('0x47'));this[_0xa57c('0x1c')][_0x5603cf[_0xa57c('0x3f')]][_0xa57c('0x53')]=_0xa57c('0x14');}_[_0xa57c('0x40')](this['channels'][_0x5603cf['uniqueid']],_['pick'](_0x5603cf,_['keys'](this[_0xa57c('0x1c')][_0x5603cf['uniqueid']])));if(_[_0xa57c('0x54')](applications,_0x5603cf[_0xa57c('0x4b')])){this['channels'][_0x5603cf[_0xa57c('0x3f')]][_0xa57c('0x55')]=_0x5603cf[_0xa57c('0x4b')];this[_0xa57c('0x1c')][_0x5603cf[_0xa57c('0x3f')]]['lastdata']=_0x5603cf[_0xa57c('0x4d')];if(_0x5603cf[_0xa57c('0x4b')]===_0xa57c('0x10')&&_[_0xa57c('0x56')](_0x5603cf[_0xa57c('0x4d')]['toLowerCase'](),_0xa57c('0x57'))){var _0x560808=_0x5603cf['applicationdata'][_0xa57c('0x58')]('=');var _0x2c706f=_0x560808[0x0][_0xa57c('0x4c')]()['match'](/cdr\((.*)\)/);if(_0x2c706f){this['channels'][_0x5603cf[_0xa57c('0x3f')]][_0x2c706f[0x1]]=_0x560808[0x1];}}else if(_0x5603cf[_0xa57c('0x4b')]===_0xa57c('0x11')){this[_0xa57c('0x1c')][_0x5603cf['uniqueid']][_0xa57c('0x11')]=_0x5603cf[_0xa57c('0x4d')][_0xa57c('0x58')](',')[0x0];}}}}}catch(_0x59eadc){logger['error'](_0xa57c('0x59'),_0x5603cf[_0xa57c('0x3f')],util['inspect'](_0x59eadc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa57c('0x37')][_0xa57c('0x25')]=function(_0x273975){try{if(this[_0xa57c('0x38')](_0x273975)){logger[_0xa57c('0x32')](_0xa57c('0x5a'),_0x273975[_0xa57c('0x3f')],_0x273975['linkedid'],_0x273975['calleridname'],_0x273975[_0xa57c('0x5b')]);logger[_0xa57c('0x3e')](_0xa57c('0x5c'),_0x273975[_0xa57c('0x3f')],util[_0xa57c('0x36')](_0x273975,{'showHidden':![],'depth':null}));if(_0x273975[_0xa57c('0x3f')]!==_0x273975[_0xa57c('0x5d')]){if(this[_0xa57c('0x1c')][_0x273975['linkedid']]){if(_0x273975['channelstate']==='6'){if(!this[_0xa57c('0x1c')][_0x273975['linkedid']][_0xa57c('0x5e')]){var _0x1da3ef=moment();this[_0xa57c('0x1c')][_0x273975['linkedid']][_0xa57c('0x5e')]=!![];this['channels'][_0x273975[_0xa57c('0x5d')]]['answertime']=_0x1da3ef[_0xa57c('0x52')](_0xa57c('0x47'));if(this[_0xa57c('0x1c')][_0x273975[_0xa57c('0x5d')]]['starttime']){this[_0xa57c('0x1c')][_0x273975[_0xa57c('0x5d')]][_0xa57c('0x5f')]=_0x1da3ef[_0xa57c('0x60')](this[_0xa57c('0x1c')][_0x273975['linkedid']][_0xa57c('0x46')],_0xa57c('0x51'));}}this[_0xa57c('0x1c')][_0x273975[_0xa57c('0x5d')]][_0xa57c('0x5d')]=_0x273975[_0xa57c('0x3f')];if(_0x273975[_0xa57c('0x5b')]!==_0xa57c('0x61')){this[_0xa57c('0x1c')][_0x273975[_0xa57c('0x5d')]]['connectedlinenum']=_0x273975[_0xa57c('0x5b')];}this[_0xa57c('0x1c')][_0x273975[_0xa57c('0x5d')]][_0xa57c('0x62')]=_0x273975[_0xa57c('0x3d')];this[_0xa57c('0x1c')][_0x273975['linkedid']][_0xa57c('0x63')]=_0x273975[_0xa57c('0x44')];this['channels'][_0x273975[_0xa57c('0x5d')]][_0xa57c('0x53')]=dispositions[_[_0xa57c('0x64')](_0x273975[_0xa57c('0x48')])];if(this[_0xa57c('0x1d')][_0x273975[_0xa57c('0x44')][_0xa57c('0x58')]('-')[0x0]]){this['channels'][_0x273975[_0xa57c('0x5d')]]['UserId']=this[_0xa57c('0x1d')][_0x273975['channel'][_0xa57c('0x58')]('-')[0x0]]['id'];this['channels'][_0x273975[_0xa57c('0x5d')]][_0xa57c('0x65')]=this['agents'][_0x273975[_0xa57c('0x44')][_0xa57c('0x58')]('-')[0x0]][_0xa57c('0x66')];}}}}else{if(this[_0xa57c('0x1c')][_0x273975['uniqueid']]){if(_0x273975[_0xa57c('0x48')]==='6'){if(this[_0xa57c('0x1d')][_0x273975[_0xa57c('0x44')][_0xa57c('0x58')]('-')[0x0]]){this[_0xa57c('0x1c')][_0x273975[_0xa57c('0x3f')]][_0xa57c('0x67')]=this[_0xa57c('0x1d')][_0x273975[_0xa57c('0x44')][_0xa57c('0x58')]('-')[0x0]]['id'];this[_0xa57c('0x1c')][_0x273975[_0xa57c('0x3f')]][_0xa57c('0x65')]=this[_0xa57c('0x1d')][_0x273975[_0xa57c('0x44')][_0xa57c('0x58')]('-')[0x0]]['name'];}}}}if(_0x273975[_0xa57c('0x48')]==='6'&&_0x273975['context']===_0xa57c('0x68')){if(this[_0xa57c('0x1d')][_0x273975[_0xa57c('0x44')]['split']('-')[0x0]]){this[_0xa57c('0x1d')][_0x273975[_0xa57c('0x44')][_0xa57c('0x58')]('-')[0x0]]['destconnectedlinenum']=_0x273975['exten'];var _0x20ff5f;if(this[_0xa57c('0x1c')][_0x273975[_0xa57c('0x3f')]])_0x20ff5f=this[_0xa57c('0x1c')][_0x273975[_0xa57c('0x3f')]][_0xa57c('0x69')];else if(this[_0xa57c('0x1c')][_0x273975[_0xa57c('0x5d')]])_0x20ff5f=this[_0xa57c('0x1c')][_0x273975['linkedid']][_0xa57c('0x69')];logger[_0xa57c('0x3e')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x273975[_0xa57c('0x3f')],util[_0xa57c('0x36')]({'destaccountcode':this[_0xa57c('0x1d')][_0x273975[_0xa57c('0x44')][_0xa57c('0x58')]('-')[0x0]][_0xa57c('0x6a')],'destconnectedlinenum':_0x273975[_0xa57c('0x6b')],'routealias':_0x20ff5f},{'showHidden':![],'depth':null}));this[_0xa57c('0x3a')](util['format'](_0xa57c('0x6c'),this[_0xa57c('0x1d')][_0x273975['channel'][_0xa57c('0x58')]('-')[0x0]][_0xa57c('0x66')]),'user:agentconnect',{'destaccountcode':this['agents'][_0x273975[_0xa57c('0x44')][_0xa57c('0x58')]('-')[0x0]][_0xa57c('0x6a')],'destconnectedlinenum':_0x273975[_0xa57c('0x6b')],'routealias':_0x20ff5f});}}}}catch(_0x45b211){logger['error'](_0xa57c('0x6d'),_0x273975[_0xa57c('0x3f')],util[_0xa57c('0x36')](_0x45b211,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa57c('0x6e')]=function(_0x5a3611,_0x1281ec){try{if(this[_0xa57c('0x1c')][_0x5a3611]){logger[_0xa57c('0x32')](_0xa57c('0x6f'),_0x5a3611,_0x1281ec);this['channels'][_0x5a3611][_0xa57c('0x70')]=!![];if(_[_0xa57c('0x71')](_0x1281ec,_0xa57c('0x72'))){_0x1281ec=_0x1281ec[_0xa57c('0x73')]('.wav49',_0xa57c('0x74'));}this[_0xa57c('0x1c')][_0x5a3611][_0xa57c('0x75')]=_0x1281ec;var _0x49e030=_[_0xa57c('0x76')](this[_0xa57c('0x1c')][_0x5a3611][_0xa57c('0x77')],{'filename':_0x1281ec});if(_['isNil'](_0x49e030)){this[_0xa57c('0x1c')][_0x5a3611][_0xa57c('0x77')][_0xa57c('0x78')]({'filename':_0x1281ec,'createdAt':moment()[_0xa57c('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xa57c('0x79')});}}}catch(_0x42b304){logger['error'](_0xa57c('0x7a'),_0x5a3611,util[_0xa57c('0x36')](_0x42b304,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa57c('0x7b')]=function(_0x4d4524){try{if(this[_0xa57c('0x38')](_0x4d4524)){logger[_0xa57c('0x3e')](_0xa57c('0x7c'),_0x4d4524[_0xa57c('0x3f')],util['inspect'](_0x4d4524,{'showHidden':![],'depth':null}));if(this[_0xa57c('0x1c')][_0x4d4524[_0xa57c('0x3f')]]&&_0x4d4524[_0xa57c('0x44')]!=_0xa57c('0x7d')){if(this[_0xa57c('0x38')](_0x4d4524[_0xa57c('0x7e')])){if(this[_0xa57c('0x38')](_0x4d4524[_0xa57c('0x7e')][_0xa57c('0x7f')])){logger[_0xa57c('0x32')](_0xa57c('0x80'),_0x4d4524['uniqueid'],_0x4d4524['value']);this['syncMixMonitorFilename'](_0x4d4524[_0xa57c('0x3f')],_0x4d4524['value']);}else if(this[_0xa57c('0x38')](_0x4d4524[_0xa57c('0x7e')][_0xa57c('0x81')])){logger['info'](_0xa57c('0x82'),_0x4d4524[_0xa57c('0x3f')],_0x4d4524[_0xa57c('0x83')]);this[_0xa57c('0x1c')][_0x4d4524[_0xa57c('0x3f')]][_0xa57c('0x5b')]=_0x4d4524[_0xa57c('0x83')];}else if(this['isNotNull'](_0x4d4524[_0xa57c('0x7e')][_0xa57c('0x84')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x4d4524[_0xa57c('0x3f')],_0x4d4524[_0xa57c('0x83')]);this['channels'][_0x4d4524['uniqueid']][_0xa57c('0x85')]=_0x4d4524['value'];}else if(this[_0xa57c('0x38')](_0x4d4524[_0xa57c('0x7e')]['xmd-cdrtype'])){logger[_0xa57c('0x32')](_0xa57c('0x86'),_0x4d4524[_0xa57c('0x3f')],_0x4d4524[_0xa57c('0x83')]);this[_0xa57c('0x1c')][_0x4d4524['uniqueid']][_0xa57c('0x87')]=_0x4d4524['value'];}else if(this[_0xa57c('0x38')](_0x4d4524[_0xa57c('0x7e')]['xmd-queue'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x4d4524[_0xa57c('0x3f')],_0x4d4524['value']['split'](',')[0x0]);this[_0xa57c('0x1c')][_0x4d4524[_0xa57c('0x3f')]][_0xa57c('0x11')]=_0x4d4524['value'][_0xa57c('0x58')](',')[0x0];}else if(this[_0xa57c('0x38')](_0x4d4524[_0xa57c('0x7e')]['xmd-originatecalleridnum'])){logger['info'](_0xa57c('0x88'),_0x4d4524['uniqueid'],_0x4d4524[_0xa57c('0x83')]);this[_0xa57c('0x1c')][_0x4d4524['uniqueid']][_0xa57c('0x89')]=_0x4d4524['value'];}else if(this['isNotNull'](_0x4d4524['variable'][_0xa57c('0x8a')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x4d4524['uniqueid'],_0x4d4524[_0xa57c('0x83')]);this[_0xa57c('0x1c')][_0x4d4524['uniqueid']][_0xa57c('0x8b')]=_0x4d4524[_0xa57c('0x83')];}else if(this[_0xa57c('0x38')](_0x4d4524['variable'][_0xa57c('0x8c')])){logger[_0xa57c('0x32')](_0xa57c('0x8d'),_0x4d4524[_0xa57c('0x3f')],_0x4d4524['value']);this['channels'][_0x4d4524[_0xa57c('0x3f')]]['calleridpreview']=_0x4d4524[_0xa57c('0x83')];}else if(this[_0xa57c('0x38')](_0x4d4524[_0xa57c('0x7e')]['xmcs-queue'])){logger[_0xa57c('0x32')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x4d4524['uniqueid'],_0x4d4524[_0xa57c('0x83')]);this['channels'][_0x4d4524[_0xa57c('0x3f')]][_0xa57c('0x11')]=_0x4d4524['value'];}else if(this['isNotNull'](_0x4d4524[_0xa57c('0x7e')][_0xa57c('0x8e')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x4d4524[_0xa57c('0x3f')],_0x4d4524[_0xa57c('0x83')]);this[_0xa57c('0x1c')][_0x4d4524['uniqueid']][_0xa57c('0x8f')]=_0x4d4524[_0xa57c('0x83')];}}}else if(this[_0xa57c('0x38')](_0x4d4524[_0xa57c('0x7e')][_0xa57c('0x7f')])){if(_0x4d4524[_0xa57c('0x83')]){var _0x10f1b5=path[_0xa57c('0x90')](_0x4d4524[_0xa57c('0x83')])[_0xa57c('0x66')];logger[_0xa57c('0x32')](_0xa57c('0x80'),_0x10f1b5,_0x4d4524[_0xa57c('0x83')]);this['syncMixMonitorFilename'](_0x10f1b5,_0x4d4524[_0xa57c('0x83')]);}}else if(this[_0xa57c('0x1c')][_0x4d4524[_0xa57c('0x5d')]]){if(this[_0xa57c('0x38')](_0x4d4524[_0xa57c('0x7e')])){if(this[_0xa57c('0x38')](_0x4d4524['variable']['sipcallid'])){logger[_0xa57c('0x32')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x4d4524['linkedid'],_0x4d4524[_0xa57c('0x83')]);this[_0xa57c('0x1c')][_0x4d4524[_0xa57c('0x5d')]]['sipcalllinkedid']=_0x4d4524[_0xa57c('0x83')];}}}}}catch(_0x15d761){logger[_0xa57c('0x34')](_0xa57c('0x91'),_0x4d4524[_0xa57c('0x3f')],util['inspect'](_0x15d761,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa57c('0x28')]=function(_0x113ced){try{if(this[_0xa57c('0x38')](_0x113ced)){logger['debug'](_0xa57c('0x92'),_0x113ced['uniqueid'],util[_0xa57c('0x36')](_0x113ced,{'showHidden':![],'depth':null}));if(this[_0xa57c('0x1c')][_0x113ced[_0xa57c('0x3f')]]){logger[_0xa57c('0x32')](_0xa57c('0x93'),_0x113ced[_0xa57c('0x3f')],_0x113ced[_0xa57c('0x94')]);var _0x5c76b0=moment();this['channels'][_0x113ced[_0xa57c('0x3f')]][_0xa57c('0x95')]=_0x5c76b0[_0xa57c('0x52')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x113ced[_0xa57c('0x3f')]][_0xa57c('0x50')]=_0x5c76b0[_0xa57c('0x60')](this[_0xa57c('0x1c')][_0x113ced[_0xa57c('0x3f')]]['starttime'],_0xa57c('0x51'));if(this[_0xa57c('0x1c')][_0x113ced[_0xa57c('0x3f')]]['answered']){this[_0xa57c('0x1c')][_0x113ced[_0xa57c('0x3f')]]['billableseconds']=_0x5c76b0[_0xa57c('0x60')](this[_0xa57c('0x1c')][_0x113ced[_0xa57c('0x3f')]][_0xa57c('0x96')],_0xa57c('0x51'));this[_0xa57c('0x1c')][_0x113ced[_0xa57c('0x3f')]][_0xa57c('0x5f')]=this[_0xa57c('0x1c')][_0x113ced['uniqueid']][_0xa57c('0x50')]-this[_0xa57c('0x1c')][_0x113ced[_0xa57c('0x3f')]][_0xa57c('0x97')];}if(_0x113ced['context']==='from-sip'){if(this[_0xa57c('0x1d')][_0x113ced['channel'][_0xa57c('0x58')]('-')[0x0]]){this['agents'][_0x113ced[_0xa57c('0x44')]['split']('-')[0x0]]=_['omit'](this[_0xa57c('0x1d')][_0x113ced['channel'][_0xa57c('0x58')]('-')[0x0]],['destconnectedlinenum']);logger[_0xa57c('0x3e')](_0xa57c('0x98'),_0x113ced[_0xa57c('0x3f')],util[_0xa57c('0x36')]({'id':this['agents'][_0x113ced['channel'][_0xa57c('0x58')]('-')[0x0]]['id'],'destaccountcode':this[_0xa57c('0x1d')][_0x113ced['channel'][_0xa57c('0x58')]('-')[0x0]][_0xa57c('0x6a')]},{'showHidden':![],'depth':null}));this[_0xa57c('0x3a')](util[_0xa57c('0x52')](_0xa57c('0x6c'),this[_0xa57c('0x1d')][_0x113ced[_0xa57c('0x44')][_0xa57c('0x58')]('-')[0x0]][_0xa57c('0x66')]),_0xa57c('0x99'),{'id':this['agents'][_0x113ced['channel'][_0xa57c('0x58')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x113ced[_0xa57c('0x44')][_0xa57c('0x58')]('-')[0x0]][_0xa57c('0x6a')]});}}var _0x5a80a3=this;Promise[_0xa57c('0x9a')]()['then'](function(){var _0x4b52dd=_0x5a80a3[_0xa57c('0x1c')][_0x113ced[_0xa57c('0x3f')]];if(typeof _0x4b52dd[_0xa57c('0x9b')]===_0xa57c('0x9c'))return;if(_['isEmpty'](_0x4b52dd[_0xa57c('0x77')]))return;return RpcSetting['getSettings']()['then'](function(_0x581674){if(!_0x581674[_0xa57c('0x9d')])return;return Promise[_0xa57c('0x9a')]()[_0xa57c('0x9e')](function(){return ami[_0xa57c('0x9f')]({'action':'StopMixMonitor','channel':_0x4b52dd[_0xa57c('0x44')]})['catch'](function(){});})[_0xa57c('0x9e')](function(){return ami[_0xa57c('0x9f')]({'action':'StopMixMonitor','channel':_0x4b52dd[_0xa57c('0x63')]})[_0xa57c('0xa0')](function(){})[_0xa57c('0xa1')](function(){var _0x37886b=_0x5a80a3[_0xa57c('0x1d')][_0x4b52dd['destinationchannel'][_0xa57c('0x58')]('-')[0x0]];if(!_0x37886b)return;io['emit'](_0xa57c('0xa2'),{'agentId':_0x37886b['id'],'uniqueid':_0x4b52dd[_0xa57c('0x3f')]});});});});})[_0xa57c('0x9e')](function(){if(_0x113ced[_0xa57c('0xa3')]===_0xa57c('0xa4')){_0x5a80a3[_0xa57c('0x1e')][_0x113ced[_0xa57c('0x3f')]]=_0x5a80a3[_0xa57c('0x1c')][_0x113ced[_0xa57c('0x3f')]];}else{if(_0x5a80a3[_0xa57c('0x1c')][_0x113ced['uniqueid']][_0xa57c('0x87')]===_0xa57c('0xa5')&&_0x5a80a3['blindTransfers'][_0x113ced['uniqueid']]){_0x5a80a3['channels'][_0x113ced[_0xa57c('0x3f')]][_0xa57c('0x3f')]=[_0x5a80a3[_0xa57c('0x1c')][_0x113ced['uniqueid']][_0xa57c('0x5d')],_0x5a80a3['channels'][_0x113ced[_0xa57c('0x3f')]][_0xa57c('0x5d')]=_0x5a80a3['channels'][_0x113ced[_0xa57c('0x3f')]][_0xa57c('0x3f')]][0x0];delete _0x5a80a3[_0xa57c('0x1e')][_0x113ced[_0xa57c('0x3f')]];}}logger[_0xa57c('0x3e')](_0xa57c('0xa6'),_0x113ced['uniqueid'],util[_0xa57c('0x36')](_0x5a80a3[_0xa57c('0x1c')][_0x113ced[_0xa57c('0x3f')]],{'showHidden':![],'depth':null}));ami[_0xa57c('0x3a')](_0xa57c('0xa7'),_0x5a80a3[_0xa57c('0x1c')][_0x113ced['uniqueid']]);delete _0x5a80a3[_0xa57c('0x1c')][_0x113ced[_0xa57c('0x3f')]];});}}}catch(_0x3df42e){logger['error'](_0xa57c('0xa8'),_0x113ced['uniqueid'],util['inspect'](_0x3df42e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa57c('0x37')][_0xa57c('0x2b')]=function(_0x2f7b45){try{if(this[_0xa57c('0x38')](_0x2f7b45)){logger['info'](_0xa57c('0xa9'),_0x2f7b45['uniqueid'],_0x2f7b45[_0xa57c('0xaa')],_0x2f7b45['transfertargetcalleridnum']);logger['debug'](_0xa57c('0xab'),_0x2f7b45[_0xa57c('0x3f')],util[_0xa57c('0x36')](_0x2f7b45,{'showHidden':![],'depth':null}));if(this[_0xa57c('0x1c')][_0x2f7b45['transfereeuniqueid']]){this[_0xa57c('0x1c')][_0x2f7b45[_0xa57c('0xac')]][_0xa57c('0xad')]=_0x2f7b45[_0xa57c('0xaa')];this['channels'][_0x2f7b45[_0xa57c('0xac')]][_0xa57c('0xae')]=_0x2f7b45[_0xa57c('0xaf')];if(this[_0xa57c('0x1c')][_0x2f7b45[_0xa57c('0xb0')]]){var _0xb201ad=this['channels'][_0x2f7b45['secondtransfereruniqueid']];this['channels'][_0x2f7b45[_0xa57c('0xb0')]]=this[_0xa57c('0x1c')][_0x2f7b45[_0xa57c('0xac')]];this['channels'][_0x2f7b45['transfereeuniqueid']]=_0xb201ad;}}else if(this[_0xa57c('0x1c')][_0x2f7b45[_0xa57c('0xb1')]]){this['channels'][_0x2f7b45[_0xa57c('0xb1')]][_0xa57c('0xad')]=_0x2f7b45[_0xa57c('0xaa')];this['channels'][_0x2f7b45[_0xa57c('0xb1')]][_0xa57c('0xae')]=_0x2f7b45[_0xa57c('0xaf')];if(this[_0xa57c('0x1c')][_0x2f7b45[_0xa57c('0xb2')]]){var _0xb201ad=this[_0xa57c('0x1c')][_0x2f7b45[_0xa57c('0xb2')]];this['channels'][_0x2f7b45[_0xa57c('0xb2')]]=this['channels'][_0x2f7b45[_0xa57c('0xb1')]];this[_0xa57c('0x1c')][_0x2f7b45['transfertargetuniqueid']]=_0xb201ad;}}if((this[_0xa57c('0x1c')][_0x2f7b45[_0xa57c('0xb2')]]||this['channels'][_0x2f7b45['origtransfererlinkedid']])&&this[_0xa57c('0x1c')][_0x2f7b45[_0xa57c('0xb0')]]){var _0x4ece22=_[_0xa57c('0xb3')]([this[_0xa57c('0x1c')][_0x2f7b45[_0xa57c('0xb2')]],this[_0xa57c('0x1c')][_0x2f7b45[_0xa57c('0xb4')]],this[_0xa57c('0x1c')][_0x2f7b45['secondtransfereruniqueid']]],function(_0x4936b7){return _0x4936b7&&_0x4936b7[_0xa57c('0x87')]===_0xa57c('0xa5')&&_0x4936b7['routeid'];});if(_0x4ece22){if(this[_0xa57c('0x1c')][_0x2f7b45[_0xa57c('0xb2')]])this[_0xa57c('0x1c')][_0x2f7b45[_0xa57c('0xb2')]][_0xa57c('0x9b')]=_0xa57c('0xb5');if(this[_0xa57c('0x1c')][_0x2f7b45[_0xa57c('0xb4')]])this[_0xa57c('0x1c')][_0x2f7b45['origtransfererlinkedid']][_0xa57c('0x9b')]=_0xa57c('0xb5');this[_0xa57c('0x1c')][_0x2f7b45[_0xa57c('0xb0')]][_0xa57c('0x9b')]=_0xa57c('0xb5');}}}}catch(_0x309470){logger[_0xa57c('0x34')](_0xa57c('0xb6'),_0x2f7b45['uniqueid'],util[_0xa57c('0x36')](_0x309470,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa57c('0x37')][_0xa57c('0x2d')]=function(_0x26b953){try{if(this['isNotNull'](_0x26b953)){logger['info'](_0xa57c('0xb7'),_0x26b953[_0xa57c('0x3f')],_0x26b953[_0xa57c('0xb8')],_0x26b953[_0xa57c('0xb9')]);logger['debug'](_0xa57c('0xba'),_0x26b953['uniqueid'],util[_0xa57c('0x36')](_0x26b953,{'showHidden':![],'depth':null}));if(this['channels'][_0x26b953[_0xa57c('0xac')]]){this[_0xa57c('0x1c')][_0x26b953['transfereeuniqueid']]['transfercalleridnum']=_0x26b953[_0xa57c('0xb8')];this['channels'][_0x26b953[_0xa57c('0xac')]][_0xa57c('0xae')]=_0x26b953[_0xa57c('0xb9')];this[_0xa57c('0x1c')][_0x26b953['transfereeuniqueid']][_0xa57c('0x9b')]='BLIND';this[_0xa57c('0x28')]({'event':_0xa57c('0xa4'),'uniqueid':_0x26b953[_0xa57c('0xac')],'context':_0x26b953[_0xa57c('0xbb')],'channel':_0x26b953[_0xa57c('0xbc')]});}else{this[_0xa57c('0x1c')][_0x26b953[_0xa57c('0xbd')]][_0xa57c('0x9b')]=_0xa57c('0xbe');}}}catch(_0x145379){logger[_0xa57c('0x34')](_0xa57c('0xbf'),_0x26b953[_0xa57c('0x3f')],util['inspect'](_0x145379,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa57c('0x37')][_0xa57c('0x2f')]=function(_0x18d702){try{if(this[_0xa57c('0x38')](_0x18d702)){logger[_0xa57c('0x3e')](_0xa57c('0xc0'),_0x18d702[_0xa57c('0x3f')],util[_0xa57c('0x36')](_0x18d702,{'showHidden':![],'depth':null}));if(this[_0xa57c('0x1c')][_0x18d702[_0xa57c('0x3f')]]){if(!_[_0xa57c('0xc1')](this[_0xa57c('0x1c')][_0x18d702['uniqueid']][_0xa57c('0x96')])){this[_0xa57c('0x1c')][_0x18d702[_0xa57c('0x3f')]]['mohstarttime']=moment()['format'](_0xa57c('0x47'));logger[_0xa57c('0x32')]('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x18d702[_0xa57c('0x3f')],this[_0xa57c('0x1c')][_0x18d702[_0xa57c('0x3f')]][_0xa57c('0xc2')]);}}}}catch(_0x36ac2a){logger[_0xa57c('0x34')](_0xa57c('0xc3'),_0x18d702['uniqueid'],util['inspect'](_0x36ac2a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStop']=function(_0x446bf2){try{if(this['isNotNull'](_0x446bf2)){logger[_0xa57c('0x3e')](_0xa57c('0xc4'),_0x446bf2[_0xa57c('0x3f')],util[_0xa57c('0x36')](_0x446bf2,{'showHidden':![],'depth':null}));if(this['channels'][_0x446bf2['uniqueid']]){if(!_[_0xa57c('0xc1')](this['channels'][_0x446bf2[_0xa57c('0x3f')]][_0xa57c('0xc2')])){this[_0xa57c('0x1c')][_0x446bf2[_0xa57c('0x3f')]][_0xa57c('0xc5')]+=moment()['milliseconds'](0x0)[_0xa57c('0x60')](this['channels'][_0x446bf2[_0xa57c('0x3f')]][_0xa57c('0xc2')],_0xa57c('0x51'));logger[_0xa57c('0x32')](_0xa57c('0xc6'),_0x446bf2[_0xa57c('0x3f')],this[_0xa57c('0x1c')][_0x446bf2[_0xa57c('0x3f')]]['mohtime']);delete this[_0xa57c('0x1c')][_0x446bf2[_0xa57c('0x3f')]][_0xa57c('0xc2')];}}}}catch(_0x1dc024){logger[_0xa57c('0x34')](_0xa57c('0xc7'),_0x446bf2['uniqueid'],util[_0xa57c('0x36')](_0x1dc024,{'showHidden':![],'depth':null}));}};module[_0xa57c('0xc8')]=VoiceCallReport; \ No newline at end of file +var _0x5f66=['[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','lodash','util','path','ioredis','../../../config/environment','../../../config/logger','../ami','../rpc/setting','unknown','busy','invalid','unavailable','ringing','ringinuse','onhold','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','redis','defaults','localhost','socket.io-emitter','channels','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','newstate','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','prototype','isNotNull','isUndefined','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','inspect','merge','keys','error','[%s][voiceCallReport][newcallerid]','syncNewChannel','debug','channel','OutgoingSpoolFailed','context','format','disposition','toNumber','channelstate','pick','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','exten','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','starttime','duration','subtract','seconds','includes','lastapplication','lastdata','set','cdr(','match','split','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','linkedid','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','YYYY-MM-DD\x20HH:mm:ss','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','agents','UserId','name','from-sip','destconnectedlinenum','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','emit','user:agentconnect','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','replace','.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','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','queue','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','cause-txt','holdtime','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','accountcode','user:agentcomplete','then','transferType','undefined','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','webbar:stopmonitors','event','BlindTransfer','outbound','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','origtransfererlinkedid','routeid','ATTENDED'];(function(_0x24195e,_0x59eeef){var _0x1fd717=function(_0x28807e){while(--_0x28807e){_0x24195e['push'](_0x24195e['shift']());}};_0x1fd717(++_0x59eeef);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var BPromise=require('bluebird');var _=require(_0x65f6('0x0'));var moment=require('moment');var util=require(_0x65f6('0x1'));var path=require(_0x65f6('0x2'));var Redis=require(_0x65f6('0x3'));var config=require(_0x65f6('0x4'));var logger=require(_0x65f6('0x5'))('ami');var ami=require(_0x65f6('0x6'));var Channel=require('../model/channel');var RpcSetting=require(_0x65f6('0x7'));var statusDesc=[_0x65f6('0x8'),'not_inuse','inuse',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe')];var applications=['set','queue',_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0x12')];var dispositions=['NO\x20ANSWER',_0x65f6('0x13'),'FAILED','NO\x20ANSWER',_0x65f6('0x14'),'NO\x20ANSWER',_0x65f6('0x15'),'BUSY',_0x65f6('0x13'),_0x65f6('0x13'),_0x65f6('0x13')];var actions={};config[_0x65f6('0x16')]=_[_0x65f6('0x17')](config[_0x65f6('0x16')],{'host':_0x65f6('0x18'),'port':0x18eb});var io=require(_0x65f6('0x19'))(new Redis(config[_0x65f6('0x16')]));function VoiceCallReport(_0x3440af){this['channels']=_0x3440af[_0x65f6('0x1a')];this['agents']=_0x3440af['agents'];this[_0x65f6('0x1b')]={};ami['on'](_0x65f6('0x1c'),this[_0x65f6('0x1d')][_0x65f6('0x1e')](this));ami['on'](_0x65f6('0x1f'),this[_0x65f6('0x1d')][_0x65f6('0x1e')](this));ami['on'](_0x65f6('0x20'),this['syncNewChannel']['bind'](this));ami['on'](_0x65f6('0x21'),this['syncNewState']['bind'](this));ami['on']('varset',this[_0x65f6('0x22')][_0x65f6('0x1e')](this));ami['on']('hangup',this[_0x65f6('0x23')][_0x65f6('0x1e')](this));ami['on'](_0x65f6('0x24'),this[_0x65f6('0x25')][_0x65f6('0x1e')](this));ami['on'](_0x65f6('0x26'),this['syncAttendedTransfer'][_0x65f6('0x1e')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x65f6('0x1e')](this));ami['on'](_0x65f6('0x27'),this['syncMusicOnHoldStart'][_0x65f6('0x1e')](this));ami['on'](_0x65f6('0x28'),this[_0x65f6('0x29')][_0x65f6('0x1e')](this));try{logger['info'](_0x65f6('0x2a'));ami[_0x65f6('0x2b')]();}catch(_0x20a161){logger['error']('[voiceCallReport][coreshowchannels]',util['inspect'](_0x20a161,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x65f6('0x2c')][_0x65f6('0x2d')]=function(_0x4b2292){return _0x4b2292!==null&&!_[_0x65f6('0x2e')](_0x4b2292);};VoiceCallReport[_0x65f6('0x2c')]['emit']=function(_0x325cb4,_0x2bff2b,_0x28d0df){io['to'](_0x325cb4)['emit'](_0x2bff2b,_0x28d0df);};VoiceCallReport['prototype']['syncNewCallerId']=function(_0x266cfe){try{if(this[_0x65f6('0x2d')](_0x266cfe)){logger[_0x65f6('0x2f')](_0x65f6('0x30'),_0x266cfe[_0x65f6('0x31')],_0x266cfe[_0x65f6('0x32')],_0x266cfe[_0x65f6('0x33')]);logger['debug']('[%s][voiceCallReport][newcallerid]\x20event:',_0x266cfe[_0x65f6('0x31')],util[_0x65f6('0x34')](_0x266cfe,{'showHidden':![],'depth':null}));if(_0x266cfe['uniqueid']===_0x266cfe['linkedid']){if(!_[_0x65f6('0x2e')](this[_0x65f6('0x1a')][_0x266cfe[_0x65f6('0x31')]])){_[_0x65f6('0x35')](this[_0x65f6('0x1a')][_0x266cfe[_0x65f6('0x31')]],_['pick'](_0x266cfe,_[_0x65f6('0x36')](this[_0x65f6('0x1a')][_0x266cfe[_0x65f6('0x31')]])));}}}}catch(_0x4bc037){logger[_0x65f6('0x37')](_0x65f6('0x38'),_0x266cfe[_0x65f6('0x31')],util[_0x65f6('0x34')](_0x4bc037,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x65f6('0x2c')][_0x65f6('0x39')]=function(_0x4d4d84){try{if(this[_0x65f6('0x2d')](_0x4d4d84)){logger[_0x65f6('0x3a')]('[%s][voiceCallReport][newchannel]\x20event:',_0x4d4d84[_0x65f6('0x31')],util['inspect'](_0x4d4d84,{'showHidden':![],'depth':null}));if(_0x4d4d84[_0x65f6('0x31')]===_0x4d4d84['linkedid']&&_0x4d4d84[_0x65f6('0x3b')]!=_0x65f6('0x3c')){if(_['isUndefined'](this[_0x65f6('0x1a')][_0x4d4d84[_0x65f6('0x31')]])){logger[_0x65f6('0x2f')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x4d4d84['uniqueid'],_0x4d4d84[_0x65f6('0x3d')],_0x4d4d84['exten']);this[_0x65f6('0x1a')][_0x4d4d84['uniqueid']]=new Channel();this[_0x65f6('0x1a')][_0x4d4d84[_0x65f6('0x31')]]['starttime']=moment()[_0x65f6('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x4d4d84[_0x65f6('0x31')]][_0x65f6('0x3f')]=dispositions[_[_0x65f6('0x40')](_0x4d4d84[_0x65f6('0x41')])];_[_0x65f6('0x35')](this[_0x65f6('0x1a')][_0x4d4d84[_0x65f6('0x31')]],_[_0x65f6('0x42')](_0x4d4d84,_['keys'](this[_0x65f6('0x1a')][_0x4d4d84['uniqueid']])));}}}}catch(_0x12a589){logger[_0x65f6('0x37')](_0x65f6('0x43'),_0x4d4d84[_0x65f6('0x31')],util['inspect'](_0x12a589,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x65f6('0x2c')][_0x65f6('0x1d')]=function(_0x413819){try{if(this[_0x65f6('0x2d')](_0x413819)){logger[_0x65f6('0x3a')](_0x65f6('0x44'),_0x413819[_0x65f6('0x31')],util[_0x65f6('0x34')](_0x413819,{'showHidden':![],'depth':null}));if(_0x413819[_0x65f6('0x31')]===_0x413819['linkedid']&&_0x413819[_0x65f6('0x45')]!='h'&&_0x413819[_0x65f6('0x3b')]!=_0x65f6('0x3c')){_0x413819[_0x65f6('0x46')]=_0x413819[_0x65f6('0x46')][_0x65f6('0x47')]();_0x413819[_0x65f6('0x48')]=_0x413819[_0x65f6('0x49')]&&_0x413819[_0x65f6('0x49')][_0x65f6('0x4a')](_0x65f6('0x4b'))?_0x413819[_0x65f6('0x49')]:(_0x413819[_0x65f6('0x49')]||_0x413819[_0x65f6('0x48')])[_0x65f6('0x47')]();logger[_0x65f6('0x2f')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x413819[_0x65f6('0x31')],_0x413819[_0x65f6('0x46')],_0x413819[_0x65f6('0x48')]);if(_[_0x65f6('0x2e')](this['channels'][_0x413819[_0x65f6('0x31')]])){this[_0x65f6('0x1a')][_0x413819[_0x65f6('0x31')]]=new Channel();this['channels'][_0x413819[_0x65f6('0x31')]][_0x65f6('0x4c')]=_0x413819[_0x65f6('0x4d')]?moment()[_0x65f6('0x4e')](moment['duration'](_0x413819[_0x65f6('0x4d')])['seconds'](),_0x65f6('0x4f'))[_0x65f6('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x65f6('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x65f6('0x1a')][_0x413819[_0x65f6('0x31')]][_0x65f6('0x3f')]=_0x65f6('0x14');}_[_0x65f6('0x35')](this[_0x65f6('0x1a')][_0x413819['uniqueid']],_['pick'](_0x413819,_[_0x65f6('0x36')](this[_0x65f6('0x1a')][_0x413819[_0x65f6('0x31')]])));if(_[_0x65f6('0x50')](applications,_0x413819[_0x65f6('0x46')])){this[_0x65f6('0x1a')][_0x413819[_0x65f6('0x31')]][_0x65f6('0x51')]=_0x413819[_0x65f6('0x46')];this['channels'][_0x413819[_0x65f6('0x31')]][_0x65f6('0x52')]=_0x413819[_0x65f6('0x48')];if(_0x413819['application']===_0x65f6('0x53')&&_[_0x65f6('0x4a')](_0x413819['applicationdata'][_0x65f6('0x47')](),_0x65f6('0x54'))){var _0x57eb04=_0x413819[_0x65f6('0x48')]['split']('=');var _0x247be3=_0x57eb04[0x0][_0x65f6('0x47')]()[_0x65f6('0x55')](/cdr\((.*)\)/);if(_0x247be3){this['channels'][_0x413819[_0x65f6('0x31')]][_0x247be3[0x1]]=_0x57eb04[0x1];}}else if(_0x413819[_0x65f6('0x46')]==='queue'){this[_0x65f6('0x1a')][_0x413819[_0x65f6('0x31')]]['queue']=_0x413819[_0x65f6('0x48')][_0x65f6('0x56')](',')[0x0];}}}}}catch(_0x413dbc){logger[_0x65f6('0x37')](_0x65f6('0x57'),_0x413819[_0x65f6('0x31')],util[_0x65f6('0x34')](_0x413dbc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x65f6('0x2c')]['syncNewState']=function(_0x52c5a4){try{if(this['isNotNull'](_0x52c5a4)){logger[_0x65f6('0x2f')](_0x65f6('0x58'),_0x52c5a4[_0x65f6('0x31')],_0x52c5a4[_0x65f6('0x59')],_0x52c5a4['calleridname'],_0x52c5a4[_0x65f6('0x33')]);logger[_0x65f6('0x3a')](_0x65f6('0x5a'),_0x52c5a4['uniqueid'],util[_0x65f6('0x34')](_0x52c5a4,{'showHidden':![],'depth':null}));if(_0x52c5a4[_0x65f6('0x31')]!==_0x52c5a4[_0x65f6('0x59')]){if(this['channels'][_0x52c5a4['linkedid']]){if(_0x52c5a4[_0x65f6('0x41')]==='6'){if(!this[_0x65f6('0x1a')][_0x52c5a4[_0x65f6('0x59')]][_0x65f6('0x5b')]){var _0x2a76b3=moment();this[_0x65f6('0x1a')][_0x52c5a4[_0x65f6('0x59')]][_0x65f6('0x5b')]=!![];this[_0x65f6('0x1a')][_0x52c5a4[_0x65f6('0x59')]][_0x65f6('0x5c')]=_0x2a76b3[_0x65f6('0x3e')](_0x65f6('0x5d'));if(this[_0x65f6('0x1a')][_0x52c5a4['linkedid']][_0x65f6('0x4c')]){this[_0x65f6('0x1a')][_0x52c5a4[_0x65f6('0x59')]]['holdtime']=_0x2a76b3[_0x65f6('0x5e')](this[_0x65f6('0x1a')][_0x52c5a4[_0x65f6('0x59')]][_0x65f6('0x4c')],'seconds');}}this[_0x65f6('0x1a')][_0x52c5a4[_0x65f6('0x59')]][_0x65f6('0x59')]=_0x52c5a4[_0x65f6('0x31')];if(_0x52c5a4['calleridnum']!==_0x65f6('0x5f')){this[_0x65f6('0x1a')][_0x52c5a4['linkedid']][_0x65f6('0x60')]=_0x52c5a4[_0x65f6('0x33')];}this[_0x65f6('0x1a')][_0x52c5a4['linkedid']][_0x65f6('0x61')]=_0x52c5a4[_0x65f6('0x32')];this[_0x65f6('0x1a')][_0x52c5a4[_0x65f6('0x59')]][_0x65f6('0x62')]=_0x52c5a4[_0x65f6('0x3b')];this['channels'][_0x52c5a4['linkedid']]['disposition']=dispositions[_[_0x65f6('0x40')](_0x52c5a4[_0x65f6('0x41')])];if(this[_0x65f6('0x63')][_0x52c5a4[_0x65f6('0x3b')][_0x65f6('0x56')]('-')[0x0]]){this[_0x65f6('0x1a')][_0x52c5a4['linkedid']][_0x65f6('0x64')]=this[_0x65f6('0x63')][_0x52c5a4['channel'][_0x65f6('0x56')]('-')[0x0]]['id'];this[_0x65f6('0x1a')][_0x52c5a4[_0x65f6('0x59')]]['membername']=this[_0x65f6('0x63')][_0x52c5a4[_0x65f6('0x3b')]['split']('-')[0x0]][_0x65f6('0x65')];}}}}else{if(this[_0x65f6('0x1a')][_0x52c5a4[_0x65f6('0x31')]]){if(_0x52c5a4[_0x65f6('0x41')]==='6'){if(this[_0x65f6('0x63')][_0x52c5a4[_0x65f6('0x3b')][_0x65f6('0x56')]('-')[0x0]]){this['channels'][_0x52c5a4['uniqueid']][_0x65f6('0x64')]=this[_0x65f6('0x63')][_0x52c5a4['channel'][_0x65f6('0x56')]('-')[0x0]]['id'];this['channels'][_0x52c5a4[_0x65f6('0x31')]]['membername']=this[_0x65f6('0x63')][_0x52c5a4[_0x65f6('0x3b')][_0x65f6('0x56')]('-')[0x0]][_0x65f6('0x65')];}}}}if(_0x52c5a4[_0x65f6('0x41')]==='6'&&_0x52c5a4[_0x65f6('0x3d')]===_0x65f6('0x66')){if(this[_0x65f6('0x63')][_0x52c5a4[_0x65f6('0x3b')]['split']('-')[0x0]]){this['agents'][_0x52c5a4[_0x65f6('0x3b')][_0x65f6('0x56')]('-')[0x0]][_0x65f6('0x67')]=_0x52c5a4['exten'];var _0x49cd14;if(this[_0x65f6('0x1a')][_0x52c5a4[_0x65f6('0x31')]])_0x49cd14=this[_0x65f6('0x1a')][_0x52c5a4[_0x65f6('0x31')]][_0x65f6('0x68')];else if(this[_0x65f6('0x1a')][_0x52c5a4['linkedid']])_0x49cd14=this['channels'][_0x52c5a4[_0x65f6('0x59')]][_0x65f6('0x68')];logger['debug'](_0x65f6('0x69'),_0x52c5a4['uniqueid'],util[_0x65f6('0x34')]({'destaccountcode':this[_0x65f6('0x63')][_0x52c5a4[_0x65f6('0x3b')][_0x65f6('0x56')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x52c5a4[_0x65f6('0x45')],'routealias':_0x49cd14},{'showHidden':![],'depth':null}));this[_0x65f6('0x6a')](util[_0x65f6('0x3e')]('user:%s',this['agents'][_0x52c5a4[_0x65f6('0x3b')]['split']('-')[0x0]][_0x65f6('0x65')]),_0x65f6('0x6b'),{'destaccountcode':this[_0x65f6('0x63')][_0x52c5a4[_0x65f6('0x3b')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x52c5a4['exten'],'routealias':_0x49cd14});}}}}catch(_0x2e29b4){logger[_0x65f6('0x37')](_0x65f6('0x6c'),_0x52c5a4['uniqueid'],util[_0x65f6('0x34')](_0x2e29b4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x65f6('0x2c')][_0x65f6('0x6d')]=function(_0x49cee2,_0x40d0f7){try{if(this[_0x65f6('0x1a')][_0x49cee2]){logger['info'](_0x65f6('0x6e'),_0x49cee2,_0x40d0f7);this[_0x65f6('0x1a')][_0x49cee2]['monitor']=!![];if(_[_0x65f6('0x6f')](_0x40d0f7,'.wav49')){_0x40d0f7=_0x40d0f7[_0x65f6('0x70')]('.wav49',_0x65f6('0x71'));}this[_0x65f6('0x1a')][_0x49cee2]['monitorFilename']=_0x40d0f7;var _0x157158=_[_0x65f6('0x72')](this[_0x65f6('0x1a')][_0x49cee2][_0x65f6('0x73')],{'filename':_0x40d0f7});if(_[_0x65f6('0x74')](_0x157158)){this[_0x65f6('0x1a')][_0x49cee2][_0x65f6('0x73')][_0x65f6('0x75')]({'filename':_0x40d0f7,'createdAt':moment()[_0x65f6('0x3e')](_0x65f6('0x5d')),'mixmonitorid':'','status':_0x65f6('0x76')});}}}catch(_0x574d84){logger[_0x65f6('0x37')](_0x65f6('0x77'),_0x49cee2,util[_0x65f6('0x34')](_0x574d84,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x65f6('0x2c')]['syncVarSet']=function(_0x453080){try{if(this[_0x65f6('0x2d')](_0x453080)){logger['debug'](_0x65f6('0x78'),_0x453080['uniqueid'],util[_0x65f6('0x34')](_0x453080,{'showHidden':![],'depth':null}));if(this['channels'][_0x453080[_0x65f6('0x31')]]&&_0x453080[_0x65f6('0x3b')]!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x453080[_0x65f6('0x79')])){if(this[_0x65f6('0x2d')](_0x453080['variable'][_0x65f6('0x7a')])){logger[_0x65f6('0x2f')](_0x65f6('0x7b'),_0x453080['uniqueid'],_0x453080[_0x65f6('0x7c')]);this[_0x65f6('0x6d')](_0x453080['uniqueid'],_0x453080[_0x65f6('0x7c')]);}else if(this['isNotNull'](_0x453080[_0x65f6('0x79')]['xmd-phone'])){logger['info'](_0x65f6('0x7d'),_0x453080[_0x65f6('0x31')],_0x453080[_0x65f6('0x7c')]);this[_0x65f6('0x1a')][_0x453080[_0x65f6('0x31')]][_0x65f6('0x33')]=_0x453080[_0x65f6('0x7c')];}else if(this[_0x65f6('0x2d')](_0x453080['variable']['xmd-callerid'])){logger[_0x65f6('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x453080[_0x65f6('0x31')],_0x453080[_0x65f6('0x7c')]);this[_0x65f6('0x1a')][_0x453080[_0x65f6('0x31')]][_0x65f6('0x7e')]=_0x453080['value'];}else if(this[_0x65f6('0x2d')](_0x453080[_0x65f6('0x79')][_0x65f6('0x7f')])){logger['info'](_0x65f6('0x80'),_0x453080[_0x65f6('0x31')],_0x453080[_0x65f6('0x7c')]);this[_0x65f6('0x1a')][_0x453080[_0x65f6('0x31')]][_0x65f6('0x81')]=_0x453080['value'];}else if(this['isNotNull'](_0x453080[_0x65f6('0x79')][_0x65f6('0x82')])){logger[_0x65f6('0x2f')](_0x65f6('0x83'),_0x453080['uniqueid'],_0x453080['value'][_0x65f6('0x56')](',')[0x0]);this[_0x65f6('0x1a')][_0x453080[_0x65f6('0x31')]][_0x65f6('0x84')]=_0x453080[_0x65f6('0x7c')][_0x65f6('0x56')](',')[0x0];}else if(this['isNotNull'](_0x453080['variable']['xmd-originatecalleridnum'])){logger[_0x65f6('0x2f')](_0x65f6('0x85'),_0x453080[_0x65f6('0x31')],_0x453080[_0x65f6('0x7c')]);this['channels'][_0x453080['uniqueid']][_0x65f6('0x86')]=_0x453080[_0x65f6('0x7c')];}else if(this['isNotNull'](_0x453080[_0x65f6('0x79')]['xmd-destination'])){logger[_0x65f6('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x453080[_0x65f6('0x31')],_0x453080[_0x65f6('0x7c')]);this['channels'][_0x453080[_0x65f6('0x31')]][_0x65f6('0x87')]=_0x453080[_0x65f6('0x7c')];}else if(this[_0x65f6('0x2d')](_0x453080[_0x65f6('0x79')][_0x65f6('0x88')])){logger['info'](_0x65f6('0x89'),_0x453080['uniqueid'],_0x453080[_0x65f6('0x7c')]);this['channels'][_0x453080[_0x65f6('0x31')]][_0x65f6('0x8a')]=_0x453080[_0x65f6('0x7c')];}else if(this[_0x65f6('0x2d')](_0x453080['variable'][_0x65f6('0x8b')])){logger[_0x65f6('0x2f')](_0x65f6('0x8c'),_0x453080['uniqueid'],_0x453080['value']);this[_0x65f6('0x1a')][_0x453080[_0x65f6('0x31')]]['queue']=_0x453080[_0x65f6('0x7c')];}else if(this[_0x65f6('0x2d')](_0x453080[_0x65f6('0x79')]['sipcallid'])){logger[_0x65f6('0x2f')](_0x65f6('0x8d'),_0x453080['uniqueid'],_0x453080[_0x65f6('0x7c')]);this[_0x65f6('0x1a')][_0x453080[_0x65f6('0x31')]]['sipcalluniqueid']=_0x453080[_0x65f6('0x7c')];}}}else if(this[_0x65f6('0x2d')](_0x453080[_0x65f6('0x79')]['mixmonitor_filename'])){if(_0x453080[_0x65f6('0x7c')]){var _0x4febfa=path[_0x65f6('0x8e')](_0x453080[_0x65f6('0x7c')])[_0x65f6('0x65')];logger[_0x65f6('0x2f')](_0x65f6('0x7b'),_0x4febfa,_0x453080[_0x65f6('0x7c')]);this['syncMixMonitorFilename'](_0x4febfa,_0x453080[_0x65f6('0x7c')]);}}else if(this[_0x65f6('0x1a')][_0x453080[_0x65f6('0x59')]]){if(this[_0x65f6('0x2d')](_0x453080[_0x65f6('0x79')])){if(this['isNotNull'](_0x453080['variable']['sipcallid'])){logger[_0x65f6('0x2f')](_0x65f6('0x8d'),_0x453080[_0x65f6('0x59')],_0x453080['value']);this[_0x65f6('0x1a')][_0x453080['linkedid']]['sipcalllinkedid']=_0x453080[_0x65f6('0x7c')];}}}}}catch(_0x41b58b){logger['error'](_0x65f6('0x8f'),_0x453080[_0x65f6('0x31')],util[_0x65f6('0x34')](_0x41b58b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x65f6('0x2c')][_0x65f6('0x23')]=function(_0x1bd68f){try{if(this[_0x65f6('0x2d')](_0x1bd68f)){logger[_0x65f6('0x3a')](_0x65f6('0x90'),_0x1bd68f[_0x65f6('0x31')],util[_0x65f6('0x34')](_0x1bd68f,{'showHidden':![],'depth':null}));if(this[_0x65f6('0x1a')][_0x1bd68f['uniqueid']]){logger[_0x65f6('0x2f')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x1bd68f['uniqueid'],_0x1bd68f[_0x65f6('0x91')]);var _0x10a877=moment();this[_0x65f6('0x1a')][_0x1bd68f[_0x65f6('0x31')]]['endtime']=_0x10a877[_0x65f6('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1bd68f[_0x65f6('0x31')]][_0x65f6('0x4d')]=_0x10a877[_0x65f6('0x5e')](this[_0x65f6('0x1a')][_0x1bd68f[_0x65f6('0x31')]][_0x65f6('0x4c')],'seconds');if(this[_0x65f6('0x1a')][_0x1bd68f['uniqueid']][_0x65f6('0x5b')]){this[_0x65f6('0x1a')][_0x1bd68f[_0x65f6('0x31')]]['billableseconds']=_0x10a877[_0x65f6('0x5e')](this['channels'][_0x1bd68f['uniqueid']][_0x65f6('0x5c')],_0x65f6('0x4f'));this[_0x65f6('0x1a')][_0x1bd68f[_0x65f6('0x31')]][_0x65f6('0x92')]=this['channels'][_0x1bd68f[_0x65f6('0x31')]][_0x65f6('0x4d')]-this[_0x65f6('0x1a')][_0x1bd68f[_0x65f6('0x31')]]['billableseconds'];}if(_0x1bd68f[_0x65f6('0x3d')]===_0x65f6('0x66')){if(this[_0x65f6('0x63')][_0x1bd68f[_0x65f6('0x3b')][_0x65f6('0x56')]('-')[0x0]]){this[_0x65f6('0x63')][_0x1bd68f[_0x65f6('0x3b')][_0x65f6('0x56')]('-')[0x0]]=_['omit'](this[_0x65f6('0x63')][_0x1bd68f[_0x65f6('0x3b')][_0x65f6('0x56')]('-')[0x0]],[_0x65f6('0x67')]);logger[_0x65f6('0x3a')](_0x65f6('0x93'),_0x1bd68f['uniqueid'],util[_0x65f6('0x34')]({'id':this[_0x65f6('0x63')][_0x1bd68f['channel'][_0x65f6('0x56')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x1bd68f[_0x65f6('0x3b')][_0x65f6('0x56')]('-')[0x0]][_0x65f6('0x94')]},{'showHidden':![],'depth':null}));this[_0x65f6('0x6a')](util[_0x65f6('0x3e')]('user:%s',this[_0x65f6('0x63')][_0x1bd68f[_0x65f6('0x3b')][_0x65f6('0x56')]('-')[0x0]][_0x65f6('0x65')]),_0x65f6('0x95'),{'id':this['agents'][_0x1bd68f['channel'][_0x65f6('0x56')]('-')[0x0]]['id'],'destaccountcode':this[_0x65f6('0x63')][_0x1bd68f[_0x65f6('0x3b')][_0x65f6('0x56')]('-')[0x0]]['accountcode']});}}var _0x57cd18=this;Promise['resolve']()[_0x65f6('0x96')](function(){var _0x3b0a97=_0x57cd18[_0x65f6('0x1a')][_0x1bd68f['uniqueid']];if(typeof _0x3b0a97[_0x65f6('0x97')]===_0x65f6('0x98'))return;if(_[_0x65f6('0x99')](_0x3b0a97[_0x65f6('0x73')]))return;return RpcSetting[_0x65f6('0x9a')]()['then'](function(_0x35b13c){if(!_0x35b13c[_0x65f6('0x9b')])return;return Promise['resolve']()['then'](function(){return ami[_0x65f6('0x9c')]({'action':_0x65f6('0x9d'),'channel':_0x3b0a97[_0x65f6('0x3b')]})[_0x65f6('0x9e')](function(){});})[_0x65f6('0x96')](function(){return ami['Action']({'action':_0x65f6('0x9d'),'channel':_0x3b0a97['destinationchannel']})[_0x65f6('0x9e')](function(){})['finally'](function(){var _0x38fcc9=_0x57cd18['agents'][_0x3b0a97[_0x65f6('0x62')]['split']('-')[0x0]];if(!_0x38fcc9)return;io[_0x65f6('0x6a')](_0x65f6('0x9f'),{'agentId':_0x38fcc9['id'],'uniqueid':_0x3b0a97['uniqueid']});});});});})['then'](function(){if(_0x1bd68f[_0x65f6('0xa0')]===_0x65f6('0xa1')){_0x57cd18[_0x65f6('0x1b')][_0x1bd68f[_0x65f6('0x31')]]=_0x57cd18[_0x65f6('0x1a')][_0x1bd68f[_0x65f6('0x31')]];}else{if(_0x57cd18[_0x65f6('0x1a')][_0x1bd68f[_0x65f6('0x31')]][_0x65f6('0x81')]===_0x65f6('0xa2')&&_0x57cd18[_0x65f6('0x1b')][_0x1bd68f[_0x65f6('0x31')]]){_0x57cd18[_0x65f6('0x1a')][_0x1bd68f[_0x65f6('0x31')]][_0x65f6('0x31')]=[_0x57cd18[_0x65f6('0x1a')][_0x1bd68f[_0x65f6('0x31')]]['linkedid'],_0x57cd18[_0x65f6('0x1a')][_0x1bd68f[_0x65f6('0x31')]][_0x65f6('0x59')]=_0x57cd18[_0x65f6('0x1a')][_0x1bd68f[_0x65f6('0x31')]][_0x65f6('0x31')]][0x0];delete _0x57cd18[_0x65f6('0x1b')][_0x1bd68f[_0x65f6('0x31')]];}}logger[_0x65f6('0x3a')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x1bd68f[_0x65f6('0x31')],util[_0x65f6('0x34')](_0x57cd18[_0x65f6('0x1a')][_0x1bd68f[_0x65f6('0x31')]],{'showHidden':![],'depth':null}));ami['emit'](_0x65f6('0xa3'),_0x57cd18[_0x65f6('0x1a')][_0x1bd68f['uniqueid']]);delete _0x57cd18[_0x65f6('0x1a')][_0x1bd68f[_0x65f6('0x31')]];});}}}catch(_0x3e5e0a){logger[_0x65f6('0x37')](_0x65f6('0xa4'),_0x1bd68f[_0x65f6('0x31')],util['inspect'](_0x3e5e0a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x65f6('0x2c')][_0x65f6('0xa5')]=function(_0x1403a7){try{if(this[_0x65f6('0x2d')](_0x1403a7)){logger['info']('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x1403a7['uniqueid'],_0x1403a7[_0x65f6('0xa6')],_0x1403a7[_0x65f6('0xa7')]);logger[_0x65f6('0x3a')](_0x65f6('0xa8'),_0x1403a7[_0x65f6('0x31')],util['inspect'](_0x1403a7,{'showHidden':![],'depth':null}));if(this['channels'][_0x1403a7[_0x65f6('0xa9')]]){this[_0x65f6('0x1a')][_0x1403a7[_0x65f6('0xa9')]]['transfercalleridnum']=_0x1403a7['origtransferercalleridnum'];this[_0x65f6('0x1a')][_0x1403a7['transfereeuniqueid']][_0x65f6('0xaa')]=_0x1403a7[_0x65f6('0xa7')];if(this[_0x65f6('0x1a')][_0x1403a7[_0x65f6('0xab')]]){var _0x4632d0=this[_0x65f6('0x1a')][_0x1403a7[_0x65f6('0xab')]];this[_0x65f6('0x1a')][_0x1403a7[_0x65f6('0xab')]]=this['channels'][_0x1403a7[_0x65f6('0xa9')]];this[_0x65f6('0x1a')][_0x1403a7['transfereeuniqueid']]=_0x4632d0;}}else if(this[_0x65f6('0x1a')][_0x1403a7['transfertargetuniqueid']]){this[_0x65f6('0x1a')][_0x1403a7[_0x65f6('0xac')]][_0x65f6('0xad')]=_0x1403a7['origtransferercalleridnum'];this[_0x65f6('0x1a')][_0x1403a7['transfertargetuniqueid']]['transferconnectedlinenum']=_0x1403a7[_0x65f6('0xa7')];if(this[_0x65f6('0x1a')][_0x1403a7['origtransfereruniqueid']]){var _0x4632d0=this['channels'][_0x1403a7[_0x65f6('0xae')]];this[_0x65f6('0x1a')][_0x1403a7[_0x65f6('0xae')]]=this[_0x65f6('0x1a')][_0x1403a7[_0x65f6('0xac')]];this[_0x65f6('0x1a')][_0x1403a7[_0x65f6('0xac')]]=_0x4632d0;}}if((this[_0x65f6('0x1a')][_0x1403a7['origtransfereruniqueid']]||this[_0x65f6('0x1a')][_0x1403a7[_0x65f6('0xaf')]])&&this[_0x65f6('0x1a')][_0x1403a7[_0x65f6('0xab')]]){var _0x288bd0=_['some']([this[_0x65f6('0x1a')][_0x1403a7['origtransfereruniqueid']],this[_0x65f6('0x1a')][_0x1403a7['origtransfererlinkedid']],this[_0x65f6('0x1a')][_0x1403a7[_0x65f6('0xab')]]],function(_0x83ec2e){return _0x83ec2e&&_0x83ec2e[_0x65f6('0x81')]===_0x65f6('0xa2')&&_0x83ec2e[_0x65f6('0xb0')];});if(_0x288bd0){if(this[_0x65f6('0x1a')][_0x1403a7[_0x65f6('0xae')]])this[_0x65f6('0x1a')][_0x1403a7[_0x65f6('0xae')]][_0x65f6('0x97')]=_0x65f6('0xb1');if(this[_0x65f6('0x1a')][_0x1403a7[_0x65f6('0xaf')]])this[_0x65f6('0x1a')][_0x1403a7[_0x65f6('0xaf')]][_0x65f6('0x97')]='ATTENDED';this[_0x65f6('0x1a')][_0x1403a7['secondtransfereruniqueid']][_0x65f6('0x97')]=_0x65f6('0xb1');}}}}catch(_0x431691){logger[_0x65f6('0x37')](_0x65f6('0xb2'),_0x1403a7[_0x65f6('0x31')],util['inspect'](_0x431691,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x65f6('0x2c')][_0x65f6('0xb3')]=function(_0xa05c50){try{if(this[_0x65f6('0x2d')](_0xa05c50)){logger[_0x65f6('0x2f')](_0x65f6('0xb4'),_0xa05c50[_0x65f6('0x31')],_0xa05c50[_0x65f6('0xb5')],_0xa05c50[_0x65f6('0xb6')]);logger[_0x65f6('0x3a')](_0x65f6('0xb7'),_0xa05c50['uniqueid'],util['inspect'](_0xa05c50,{'showHidden':![],'depth':null}));if(this[_0x65f6('0x1a')][_0xa05c50[_0x65f6('0xa9')]]){this[_0x65f6('0x1a')][_0xa05c50[_0x65f6('0xa9')]][_0x65f6('0xad')]=_0xa05c50[_0x65f6('0xb5')];this[_0x65f6('0x1a')][_0xa05c50['transfereeuniqueid']][_0x65f6('0xaa')]=_0xa05c50[_0x65f6('0xb6')];this[_0x65f6('0x1a')][_0xa05c50[_0x65f6('0xa9')]][_0x65f6('0x97')]=_0x65f6('0xb8');this[_0x65f6('0x23')]({'event':_0x65f6('0xa1'),'uniqueid':_0xa05c50[_0x65f6('0xa9')],'context':_0xa05c50[_0x65f6('0x3d')],'channel':_0xa05c50[_0x65f6('0xb9')]});}else{this[_0x65f6('0x1a')][_0xa05c50[_0x65f6('0xba')]]['transferType']='BLIND';}}}catch(_0x56e0c0){logger[_0x65f6('0x37')](_0x65f6('0xbb'),_0xa05c50[_0x65f6('0x31')],util['inspect'](_0x56e0c0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x65f6('0x2c')][_0x65f6('0xbc')]=function(_0x10d421){try{if(this['isNotNull'](_0x10d421)){logger[_0x65f6('0x3a')](_0x65f6('0xbd'),_0x10d421['uniqueid'],util[_0x65f6('0x34')](_0x10d421,{'showHidden':![],'depth':null}));if(this[_0x65f6('0x1a')][_0x10d421[_0x65f6('0x31')]]){if(!_['isNil'](this[_0x65f6('0x1a')][_0x10d421[_0x65f6('0x31')]][_0x65f6('0x5c')])){this[_0x65f6('0x1a')][_0x10d421[_0x65f6('0x31')]][_0x65f6('0xbe')]=moment()[_0x65f6('0x3e')](_0x65f6('0x5d'));logger[_0x65f6('0x2f')](_0x65f6('0xbf'),_0x10d421['uniqueid'],this[_0x65f6('0x1a')][_0x10d421[_0x65f6('0x31')]][_0x65f6('0xbe')]);}}}}catch(_0x4aacac){logger['error'](_0x65f6('0xc0'),_0x10d421['uniqueid'],util[_0x65f6('0x34')](_0x4aacac,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x65f6('0x2c')][_0x65f6('0x29')]=function(_0xbf4abe){try{if(this[_0x65f6('0x2d')](_0xbf4abe)){logger['debug'](_0x65f6('0xc1'),_0xbf4abe[_0x65f6('0x31')],util[_0x65f6('0x34')](_0xbf4abe,{'showHidden':![],'depth':null}));if(this[_0x65f6('0x1a')][_0xbf4abe['uniqueid']]){if(!_[_0x65f6('0x74')](this[_0x65f6('0x1a')][_0xbf4abe[_0x65f6('0x31')]][_0x65f6('0xbe')])){this[_0x65f6('0x1a')][_0xbf4abe[_0x65f6('0x31')]][_0x65f6('0xc2')]+=moment()[_0x65f6('0xc3')](0x0)[_0x65f6('0x5e')](this[_0x65f6('0x1a')][_0xbf4abe[_0x65f6('0x31')]][_0x65f6('0xbe')],_0x65f6('0x4f'));logger[_0x65f6('0x2f')](_0x65f6('0xc4'),_0xbf4abe['uniqueid'],this[_0x65f6('0x1a')][_0xbf4abe[_0x65f6('0x31')]]['mohtime']);delete this['channels'][_0xbf4abe[_0x65f6('0x31')]][_0x65f6('0xbe')];}}}}catch(_0x3c109d){logger[_0x65f6('0x37')](_0x65f6('0xc5'),_0xbf4abe[_0x65f6('0x31')],util[_0x65f6('0x34')](_0x3c109d,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 11c4b66..41cc10b 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 _0xe081=['[%s][voiceDialReport][newexten]\x20event:','application','set','applicationdata','appdata','cdr(','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','bind','dialend','syncHangup','isNotNull','isUndefined','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','called','channel','substring','lastIndexOf','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','lastevent','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','error','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','variable','outboundrouteid','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','membername','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','format','duration','diff','seconds','complete','total','answered','holdtime','starttime','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%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]','syncNewExten'];(function(_0x299c32,_0x2f6e01){var _0x41a57d=function(_0x1ac2b8){while(--_0x1ac2b8){_0x299c32['push'](_0x299c32['shift']());}};_0x41a57d(++_0x2f6e01);}(_0xe081,0x1f2));var _0x1e08=function(_0x14a050,_0x471fbf){_0x14a050=_0x14a050-0x0;var _0x5dc00f=_0xe081[_0x14a050];return _0x5dc00f;};'use strict';var _=require(_0x1e08('0x0'));var moment=require(_0x1e08('0x1'));var util=require(_0x1e08('0x2'));var Redis=require(_0x1e08('0x3'));var config=require(_0x1e08('0x4'));var logger=require(_0x1e08('0x5'))(_0x1e08('0x6'));var ami=require(_0x1e08('0x7'));config['redis']=_[_0x1e08('0x8')](config['redis'],{'host':_0x1e08('0x9'),'port':0x18eb});var io=require(_0x1e08('0xa'))(new Redis(config['redis']));function VoiceDialReport(_0x24df5c){this[_0x1e08('0xb')]=_0x24df5c[_0x1e08('0xc')];this[_0x1e08('0xd')]=_0x24df5c[_0x1e08('0xd')];this[_0x1e08('0xe')]={};this[_0x1e08('0xf')]={};ami['on'](_0x1e08('0x10'),this[_0x1e08('0x11')][_0x1e08('0x12')](this));ami['on'](_0x1e08('0x13'),this['syncDialEnd'][_0x1e08('0x12')](this));ami['on']('varset',this['syncVarSet'][_0x1e08('0x12')](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on']('hangup',this[_0x1e08('0x14')]['bind'](this));}VoiceDialReport['prototype'][_0x1e08('0x15')]=function(_0x1be02e){return _0x1be02e!==null&&!_[_0x1e08('0x16')](_0x1be02e);};VoiceDialReport[_0x1e08('0x17')][_0x1e08('0x18')]=function(_0x3c3787,_0x5f2129,_0x6f9e09){io['to'](_0x3c3787)[_0x1e08('0x18')](_0x5f2129,_0x6f9e09);};VoiceDialReport[_0x1e08('0x17')][_0x1e08('0x11')]=function(_0x23443e){try{if(this[_0x1e08('0x15')](_0x23443e)){logger[_0x1e08('0x19')](_0x1e08('0x1a'),_0x23443e[_0x1e08('0x1b')],util[_0x1e08('0x1c')](_0x23443e,{'showHidden':![],'depth':null}));if(this[_0x1e08('0xb')][_0x23443e[_0x1e08('0x1b')]]){_[_0x1e08('0x1d')](this[_0x1e08('0xb')][_0x23443e['uniqueid']],{'starttime':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x1e08('0x1e'),'interface':_0x23443e[_0x1e08('0x1f')][_0x1e08('0x20')](0x0,_0x23443e['channel'][_0x1e08('0x21')]('-')),'membername':_0x23443e[_0x1e08('0x1f')]['substring'](_0x23443e['channel']['lastIndexOf']('/')+0x1,_0x23443e[_0x1e08('0x1f')]['lastIndexOf']('-'))},_['omit'](_0x23443e,[_0x1e08('0x22'),_0x1e08('0x23')]));logger['info'](_0x1e08('0x24'),_0x23443e['uniqueid'],this[_0x1e08('0xb')][_0x23443e['uniqueid']]['membername'],this[_0x1e08('0xb')][_0x23443e[_0x1e08('0x1b')]][_0x1e08('0x25')]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x23443e[_0x1e08('0x1b')],util[_0x1e08('0x1c')](this['channels'][_0x23443e[_0x1e08('0x1b')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x23443e['uniqueid']])_[_0x1e08('0x1d')](this['channels'][_0x23443e[_0x1e08('0x1b')]],this['applications'][_0x23443e[_0x1e08('0x1b')]]);this['emit'](_0x1e08('0x26'),_0x1e08('0x27'),this['channels'][_0x23443e['uniqueid']]);logger[_0x1e08('0x19')](_0x1e08('0x28'),_0x23443e[_0x1e08('0x1b')],util['inspect'](this[_0x1e08('0xb')][_0x23443e[_0x1e08('0x1b')]],{'showHidden':![],'depth':null}));ami['emit'](_0x1e08('0x29'),this['channels'][_0x23443e[_0x1e08('0x1b')]]);}}}catch(_0x599da2){logger['error'](_0x1e08('0x2a'),_0x23443e[_0x1e08('0x1b')],util[_0x1e08('0x1c')](_0x599da2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1e08('0x17')][_0x1e08('0x2b')]=function(_0x17145e){try{if(this[_0x1e08('0x15')](_0x17145e)){logger[_0x1e08('0x19')](_0x1e08('0x2c'),_0x17145e[_0x1e08('0x1b')],util[_0x1e08('0x1c')](_0x17145e,{'showHidden':![],'depth':null}));if(this['channels'][_0x17145e[_0x1e08('0x1b')]]){this[_0x1e08('0xb')][_0x17145e['uniqueid']][_0x1e08('0x2d')]=_0x17145e[_0x1e08('0x2d')];if(_0x17145e[_0x1e08('0x2d')]===_0x1e08('0x2e')){this[_0x1e08('0xb')][_0x17145e[_0x1e08('0x1b')]][_0x1e08('0x2f')]=_0x17145e[_0x1e08('0x2f')];this[_0x1e08('0xb')][_0x17145e[_0x1e08('0x1b')]][_0x1e08('0x30')]=_0x17145e[_0x1e08('0x30')];this[_0x1e08('0xb')][_0x17145e[_0x1e08('0x1b')]][_0x1e08('0x31')]=moment()['format'](_0x1e08('0x32'));this[_0x1e08('0xb')][_0x17145e['uniqueid']][_0x1e08('0x33')]='connect';logger[_0x1e08('0x34')](_0x1e08('0x35'),_0x17145e[_0x1e08('0x1b')],_0x17145e[_0x1e08('0x1f')][_0x1e08('0x20')](_0x17145e['channel'][_0x1e08('0x21')]('/')+0x1,_0x17145e[_0x1e08('0x1f')][_0x1e08('0x21')]('-')));logger[_0x1e08('0x19')](_0x1e08('0x36'),_0x17145e['uniqueid'],util[_0x1e08('0x1c')](this[_0x1e08('0xb')][_0x17145e[_0x1e08('0x1b')]],{'showHidden':![],'depth':null}));ami['emit'](_0x1e08('0x37'),this[_0x1e08('0xb')][_0x17145e['uniqueid']]);}logger[_0x1e08('0x19')](_0x1e08('0x38'),_0x17145e[_0x1e08('0x1b')],util[_0x1e08('0x1c')](this[_0x1e08('0xb')][_0x17145e[_0x1e08('0x1b')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x1e08('0x27'),this['channels'][_0x17145e[_0x1e08('0x1b')]]);}}}catch(_0x47708e){logger[_0x1e08('0x39')](_0x1e08('0x3a'),_0x17145e[_0x1e08('0x1b')],util['inspect'](_0x47708e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1e08('0x17')]['syncVarSet']=function(_0x4d34d8){try{if(this[_0x1e08('0x15')](_0x4d34d8)){logger['debug'](_0x1e08('0x3b'),_0x4d34d8['uniqueid'],util[_0x1e08('0x1c')](_0x4d34d8,{'showHidden':![],'depth':null}));this[_0x1e08('0x3c')](_0x4d34d8['uniqueid'],_['keys'](_0x4d34d8[_0x1e08('0x3d')])[0x0],_0x4d34d8['value']);if(this[_0x1e08('0x15')](_0x4d34d8[_0x1e08('0x3d')])&&this[_0x1e08('0x15')](_0x4d34d8[_0x1e08('0x3d')][_0x1e08('0x3e')])){if(_['isUndefined'](this[_0x1e08('0xb')][_0x4d34d8[_0x1e08('0x1b')]])){this[_0x1e08('0xb')][_0x4d34d8[_0x1e08('0x1b')]]={'routeId':_0x4d34d8[_0x1e08('0x3f')],'variables':this[_0x1e08('0xf')][_0x4d34d8[_0x1e08('0x1b')]]};logger[_0x1e08('0x34')](_0x1e08('0x40'),_0x4d34d8['uniqueid'],_0x4d34d8[_0x1e08('0x3d')][_0x1e08('0x3e')],_[_0x1e08('0x41')](_0x4d34d8['variable'])[0x0],_0x4d34d8[_0x1e08('0x3f')]);logger[_0x1e08('0x19')](_0x1e08('0x42'),_0x4d34d8[_0x1e08('0x1b')],util[_0x1e08('0x1c')](this[_0x1e08('0xb')][_0x4d34d8[_0x1e08('0x1b')]],{'showHidden':![],'depth':null}));this['emit'](_0x1e08('0x26'),_0x1e08('0x27'),this[_0x1e08('0xb')][_0x4d34d8[_0x1e08('0x1b')]]);}}}}catch(_0x34db1d){logger[_0x1e08('0x39')](_0x1e08('0x43'),_0x4d34d8[_0x1e08('0x1b')],util['inspect'](_0x34db1d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1e08('0x17')][_0x1e08('0x3c')]=function(_0x381199,_0x43dce4,_0x252495){var _0x5ce0b1=[_0x1e08('0x44'),_0x1e08('0x45'),_0x1e08('0x46'),_0x1e08('0x47'),'rtpaudioqosloss',_0x1e08('0x48'),_0x1e08('0x49'),'rtpaudioqosrttbridged',_0x1e08('0x4a'),_0x1e08('0x4b'),_0x1e08('0x4c'),_0x1e08('0x4d'),_0x1e08('0x4e'),_0x1e08('0x4f'),'memberinterface','memberlastcall',_0x1e08('0x50'),_0x1e08('0x51'),_0x1e08('0x52')];if(!_[_0x1e08('0x53')](_0x43dce4)&&!_[_0x1e08('0x54')](_0x5ce0b1,_0x43dce4)){if(_[_0x1e08('0x16')](this['variables'][_0x381199])){this[_0x1e08('0xf')][_0x381199]={};}this[_0x1e08('0xf')][_0x381199][_0x43dce4]=_0x252495;}};VoiceDialReport[_0x1e08('0x17')][_0x1e08('0x14')]=function(_0x1ee3f5){try{if(this['isNotNull'](_0x1ee3f5)){logger[_0x1e08('0x19')](_0x1e08('0x55'),_0x1ee3f5['uniqueid'],util[_0x1e08('0x1c')](_0x1ee3f5,{'showHidden':![],'depth':null}));if(this[_0x1e08('0xb')][_0x1ee3f5[_0x1e08('0x1b')]]){logger[_0x1e08('0x34')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x1ee3f5[_0x1e08('0x1b')],_0x1ee3f5[_0x1e08('0x56')]);this['channels'][_0x1ee3f5['uniqueid']][_0x1e08('0x57')]=moment()[_0x1e08('0x58')](_0x1e08('0x32'));this[_0x1e08('0xb')][_0x1ee3f5[_0x1e08('0x1b')]][_0x1e08('0x59')]=moment(this[_0x1e08('0xb')][_0x1ee3f5['uniqueid']][_0x1e08('0x57')])[_0x1e08('0x5a')](this[_0x1e08('0xb')][_0x1ee3f5[_0x1e08('0x1b')]]['starttime'],_0x1e08('0x5b'));this[_0x1e08('0xb')][_0x1ee3f5['uniqueid']][_0x1e08('0x33')]=_0x1e08('0x5c');this[_0x1e08('0xd')][_0x1e08('0x5d')]+=0x1;if(this['channels'][_0x1ee3f5['uniqueid']][_0x1e08('0x31')]){this[_0x1e08('0xd')][_0x1e08('0x5e')]+=0x1;this[_0x1e08('0xb')][_0x1ee3f5['uniqueid']][_0x1e08('0x5f')]=moment(this['channels'][_0x1ee3f5[_0x1e08('0x1b')]][_0x1e08('0x31')])[_0x1e08('0x5a')](this[_0x1e08('0xb')][_0x1ee3f5[_0x1e08('0x1b')]][_0x1e08('0x60')],_0x1e08('0x5b'));this[_0x1e08('0xb')][_0x1ee3f5[_0x1e08('0x1b')]][_0x1e08('0x61')]=moment(this['channels'][_0x1ee3f5[_0x1e08('0x1b')]][_0x1e08('0x57')])[_0x1e08('0x5a')](this[_0x1e08('0xb')][_0x1ee3f5[_0x1e08('0x1b')]][_0x1e08('0x31')],_0x1e08('0x5b'));this[_0x1e08('0xd')]['sumHoldTime']+=this[_0x1e08('0xb')][_0x1ee3f5[_0x1e08('0x1b')]]['holdtime']||0x0;this[_0x1e08('0xd')]['sumBillable']+=this[_0x1e08('0xb')][_0x1ee3f5[_0x1e08('0x1b')]]['billableseconds'];}this[_0x1e08('0xd')][_0x1e08('0x62')]+=this['channels'][_0x1ee3f5[_0x1e08('0x1b')]]['duration'];logger['debug'](_0x1e08('0x63'),_0x1ee3f5['uniqueid'],util[_0x1e08('0x1c')](this['channels'][_0x1ee3f5['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x1e08('0x18')](_0x1e08('0x64'),this[_0x1e08('0xb')][_0x1ee3f5['uniqueid']]);logger[_0x1e08('0x19')](_0x1e08('0x65'),_0x1ee3f5['uniqueid'],util[_0x1e08('0x1c')](this[_0x1e08('0xb')][_0x1ee3f5[_0x1e08('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x1e08('0x18')](_0x1e08('0x66'),this[_0x1e08('0xb')][_0x1ee3f5[_0x1e08('0x1b')]]);logger[_0x1e08('0x19')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x1ee3f5['uniqueid'],util[_0x1e08('0x1c')](this[_0x1e08('0xb')][_0x1ee3f5[_0x1e08('0x1b')]],{'showHidden':![],'depth':null}));this[_0x1e08('0x18')](_0x1e08('0x26'),_0x1e08('0x67'),this[_0x1e08('0xd')]);logger[_0x1e08('0x34')](_0x1e08('0x68'),JSON[_0x1e08('0x69')](this['channels'][_0x1ee3f5[_0x1e08('0x1b')]]));logger[_0x1e08('0x19')](_0x1e08('0x6a'),_0x1ee3f5[_0x1e08('0x1b')],util[_0x1e08('0x1c')](this[_0x1e08('0xb')][_0x1ee3f5['uniqueid']],{'showHidden':![],'depth':null}));this[_0x1e08('0x18')]('voice:outbound',_0x1e08('0x6b'),this[_0x1e08('0xb')][_0x1ee3f5[_0x1e08('0x1b')]]);delete this['channels'][_0x1ee3f5[_0x1e08('0x1b')]];}else if(this[_0x1e08('0xb')][_0x1ee3f5['linkedid']]){this[_0x1e08('0xb')][_0x1ee3f5['linkedid']][_0x1e08('0x1b')]=this[_0x1e08('0xb')][_0x1ee3f5[_0x1e08('0x6c')]][_0x1e08('0x6d')];}if(this['variables'][_0x1ee3f5[_0x1e08('0x1b')]]){delete this['variables'][_0x1ee3f5[_0x1e08('0x1b')]];}}}catch(_0x2a07ad){logger[_0x1e08('0x39')](_0x1e08('0x6e'),_0x1ee3f5[_0x1e08('0x1b')],util[_0x1e08('0x1c')](_0x2a07ad,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x1e08('0x6f')]=function(_0x2ed718){try{if(this[_0x1e08('0x15')](_0x2ed718)){logger[_0x1e08('0x19')](_0x1e08('0x70'),_0x2ed718[_0x1e08('0x1b')],util[_0x1e08('0x1c')](_0x2ed718,{'showHidden':![],'depth':null}));if(_0x2ed718[_0x1e08('0x71')]['toLowerCase']()===_0x1e08('0x72')){_0x2ed718[_0x1e08('0x73')]=(_0x2ed718[_0x1e08('0x74')]||_0x2ed718[_0x1e08('0x73')])['toLowerCase']();if(_['startsWith'](_0x2ed718[_0x1e08('0x73')],_0x1e08('0x75'))){if(_[_0x1e08('0x16')](this[_0x1e08('0xe')][_0x2ed718[_0x1e08('0x1b')]]))this[_0x1e08('0xe')][_0x2ed718[_0x1e08('0x1b')]]={};logger[_0x1e08('0x34')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x2ed718[_0x1e08('0x1b')],_0x2ed718['application'],_0x2ed718[_0x1e08('0x73')]);var _0x141167=_0x2ed718['applicationdata'][_0x1e08('0x76')]('=');var _0x32f78a=_0x141167[0x0][_0x1e08('0x77')](/cdr\((.*)\)/);if(_0x32f78a)this[_0x1e08('0xe')][_0x2ed718[_0x1e08('0x1b')]][_0x32f78a[0x1]]=_0x141167[0x1];}}}}catch(_0x3a4ee5){logger['error'](_0x1e08('0x78'),_0x2ed718[_0x1e08('0x1b')],util['inspect'](_0x3a4ee5,{'showHidden':![],'depth':null}));}};module[_0x1e08('0x79')]=VoiceDialReport; \ No newline at end of file +var _0x9c74=['lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipuri','bridgepvtcallid','memberdynamic','memberinterface','membername','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','info','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','starttime','seconds','complete','answered','holdtime','diff','billableseconds','answertime','sumHoldTime','sumBillable','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','voice_outbound:save','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','syncDialEnd','varset','syncVarSet','syncNewExten','bind','syncHangup','isUndefined','emit','isNotNull','debug','[%s][voiceDialReport][dialbegin]\x20event:','inspect','merge','uniqueid','YYYY-MM-DD\x20HH:mm:ss','called','substring','channel','lastIndexOf','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','prototype','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','format'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9c74,0x193));var _0x49c7=function(_0xda6326,_0x4e805f){_0xda6326=_0xda6326-0x0;var _0x5933c4=_0x9c74[_0xda6326];return _0x5933c4;};'use strict';var _=require(_0x49c7('0x0'));var moment=require(_0x49c7('0x1'));var util=require('util');var Redis=require(_0x49c7('0x2'));var config=require(_0x49c7('0x3'));var logger=require(_0x49c7('0x4'))(_0x49c7('0x5'));var ami=require('../ami');config[_0x49c7('0x6')]=_['defaults'](config['redis'],{'host':_0x49c7('0x7'),'port':0x18eb});var io=require(_0x49c7('0x8'))(new Redis(config['redis']));function VoiceDialReport(_0x40c94e){this[_0x49c7('0x9')]=_0x40c94e[_0x49c7('0xa')];this[_0x49c7('0xb')]=_0x40c94e[_0x49c7('0xb')];this[_0x49c7('0xc')]={};this[_0x49c7('0xd')]={};ami['on'](_0x49c7('0xe'),this[_0x49c7('0xf')]['bind'](this));ami['on']('dialend',this[_0x49c7('0x10')]['bind'](this));ami['on'](_0x49c7('0x11'),this[_0x49c7('0x12')]['bind'](this));ami['on']('newexten',this[_0x49c7('0x13')][_0x49c7('0x14')](this));ami['on']('hangup',this[_0x49c7('0x15')][_0x49c7('0x14')](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x13b4d4){return _0x13b4d4!==null&&!_[_0x49c7('0x16')](_0x13b4d4);};VoiceDialReport['prototype'][_0x49c7('0x17')]=function(_0x4b0ed7,_0x3b6f2d,_0x304637){io['to'](_0x4b0ed7)[_0x49c7('0x17')](_0x3b6f2d,_0x304637);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x3fffb8){try{if(this[_0x49c7('0x18')](_0x3fffb8)){logger[_0x49c7('0x19')](_0x49c7('0x1a'),_0x3fffb8['uniqueid'],util[_0x49c7('0x1b')](_0x3fffb8,{'showHidden':![],'depth':null}));if(this[_0x49c7('0x9')][_0x3fffb8['uniqueid']]){_[_0x49c7('0x1c')](this[_0x49c7('0x9')][_0x3fffb8[_0x49c7('0x1d')]],{'starttime':moment()['format'](_0x49c7('0x1e')),'lastevent':_0x49c7('0x1f'),'interface':_0x3fffb8['channel'][_0x49c7('0x20')](0x0,_0x3fffb8[_0x49c7('0x21')][_0x49c7('0x22')]('-')),'membername':_0x3fffb8[_0x49c7('0x21')][_0x49c7('0x20')](_0x3fffb8['channel']['lastIndexOf']('/')+0x1,_0x3fffb8[_0x49c7('0x21')][_0x49c7('0x22')]('-'))},_[_0x49c7('0x23')](_0x3fffb8,[_0x49c7('0x24'),_0x49c7('0x25')]));logger['info'](_0x49c7('0x26'),_0x3fffb8[_0x49c7('0x1d')],this['channels'][_0x3fffb8[_0x49c7('0x1d')]]['membername'],this['channels'][_0x3fffb8[_0x49c7('0x1d')]][_0x49c7('0x27')]);logger[_0x49c7('0x19')](_0x49c7('0x28'),_0x3fffb8[_0x49c7('0x1d')],util[_0x49c7('0x1b')](this[_0x49c7('0x9')][_0x3fffb8[_0x49c7('0x1d')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x3fffb8[_0x49c7('0x1d')]])_[_0x49c7('0x1c')](this[_0x49c7('0x9')][_0x3fffb8[_0x49c7('0x1d')]],this[_0x49c7('0xc')][_0x3fffb8[_0x49c7('0x1d')]]);this[_0x49c7('0x17')](_0x49c7('0x29'),_0x49c7('0x2a'),this[_0x49c7('0x9')][_0x3fffb8[_0x49c7('0x1d')]]);logger[_0x49c7('0x19')](_0x49c7('0x2b'),_0x3fffb8[_0x49c7('0x1d')],util[_0x49c7('0x1b')](this[_0x49c7('0x9')][_0x3fffb8[_0x49c7('0x1d')]],{'showHidden':![],'depth':null}));ami[_0x49c7('0x17')](_0x49c7('0x2c'),this['channels'][_0x3fffb8[_0x49c7('0x1d')]]);}}}catch(_0x2142de){logger[_0x49c7('0x2d')]('[%s][voiceDialReport][dialbegin]',_0x3fffb8[_0x49c7('0x1d')],util[_0x49c7('0x1b')](_0x2142de,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x49c7('0x2e')][_0x49c7('0x10')]=function(_0x3b06d9){try{if(this[_0x49c7('0x18')](_0x3b06d9)){logger[_0x49c7('0x19')](_0x49c7('0x2f'),_0x3b06d9[_0x49c7('0x1d')],util[_0x49c7('0x1b')](_0x3b06d9,{'showHidden':![],'depth':null}));if(this['channels'][_0x3b06d9[_0x49c7('0x1d')]]){this[_0x49c7('0x9')][_0x3b06d9[_0x49c7('0x1d')]][_0x49c7('0x30')]=_0x3b06d9[_0x49c7('0x30')];if(_0x3b06d9[_0x49c7('0x30')]===_0x49c7('0x31')){this[_0x49c7('0x9')][_0x3b06d9[_0x49c7('0x1d')]][_0x49c7('0x32')]=_0x3b06d9[_0x49c7('0x32')];this[_0x49c7('0x9')][_0x3b06d9[_0x49c7('0x1d')]][_0x49c7('0x33')]=_0x3b06d9[_0x49c7('0x33')];this[_0x49c7('0x9')][_0x3b06d9[_0x49c7('0x1d')]]['answertime']=moment()[_0x49c7('0x34')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3b06d9[_0x49c7('0x1d')]][_0x49c7('0x35')]=_0x49c7('0x36');logger['info'](_0x49c7('0x37'),_0x3b06d9['uniqueid'],_0x3b06d9[_0x49c7('0x21')][_0x49c7('0x20')](_0x3b06d9[_0x49c7('0x21')][_0x49c7('0x22')]('/')+0x1,_0x3b06d9[_0x49c7('0x21')]['lastIndexOf']('-')));logger[_0x49c7('0x19')](_0x49c7('0x38'),_0x3b06d9[_0x49c7('0x1d')],util[_0x49c7('0x1b')](this[_0x49c7('0x9')][_0x3b06d9[_0x49c7('0x1d')]],{'showHidden':![],'depth':null}));ami[_0x49c7('0x17')]('custom:dialconnect',this[_0x49c7('0x9')][_0x3b06d9[_0x49c7('0x1d')]]);}logger[_0x49c7('0x19')](_0x49c7('0x39'),_0x3b06d9['uniqueid'],util[_0x49c7('0x1b')](this[_0x49c7('0x9')][_0x3b06d9[_0x49c7('0x1d')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x49c7('0x2a'),this[_0x49c7('0x9')][_0x3b06d9[_0x49c7('0x1d')]]);}}}catch(_0xaa7ba3){logger[_0x49c7('0x2d')](_0x49c7('0x3a'),_0x3b06d9['uniqueid'],util[_0x49c7('0x1b')](_0xaa7ba3,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x49c7('0x2e')][_0x49c7('0x12')]=function(_0x1b3cf0){try{if(this[_0x49c7('0x18')](_0x1b3cf0)){logger[_0x49c7('0x19')]('[%s][voiceDialReport][varset]\x20event:',_0x1b3cf0[_0x49c7('0x1d')],util['inspect'](_0x1b3cf0,{'showHidden':![],'depth':null}));this['addVariable'](_0x1b3cf0['uniqueid'],_[_0x49c7('0x3b')](_0x1b3cf0[_0x49c7('0x3c')])[0x0],_0x1b3cf0[_0x49c7('0x3d')]);if(this[_0x49c7('0x18')](_0x1b3cf0[_0x49c7('0x3c')])&&this[_0x49c7('0x18')](_0x1b3cf0[_0x49c7('0x3c')][_0x49c7('0x3e')])){if(_[_0x49c7('0x16')](this['channels'][_0x1b3cf0[_0x49c7('0x1d')]])){this['channels'][_0x1b3cf0[_0x49c7('0x1d')]]={'routeId':_0x1b3cf0[_0x49c7('0x3d')],'variables':this[_0x49c7('0xd')][_0x1b3cf0[_0x49c7('0x1d')]]};logger['info']('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x1b3cf0[_0x49c7('0x1d')],_0x1b3cf0[_0x49c7('0x3c')]['outboundrouteid'],_[_0x49c7('0x3b')](_0x1b3cf0[_0x49c7('0x3c')])[0x0],_0x1b3cf0[_0x49c7('0x3d')]);logger[_0x49c7('0x19')](_0x49c7('0x3f'),_0x1b3cf0[_0x49c7('0x1d')],util['inspect'](this[_0x49c7('0x9')][_0x1b3cf0[_0x49c7('0x1d')]],{'showHidden':![],'depth':null}));this[_0x49c7('0x17')](_0x49c7('0x29'),_0x49c7('0x2a'),this[_0x49c7('0x9')][_0x1b3cf0['uniqueid']]);}}}}catch(_0x389cf2){logger[_0x49c7('0x2d')](_0x49c7('0x40'),_0x1b3cf0[_0x49c7('0x1d')],util['inspect'](_0x389cf2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x49c7('0x2e')][_0x49c7('0x41')]=function(_0x2f5609,_0x36eb57,_0x286533){var _0x1493a1=[_0x49c7('0x42'),'rtpaudioqosbridged',_0x49c7('0x43'),_0x49c7('0x44'),'rtpaudioqosloss',_0x49c7('0x45'),_0x49c7('0x46'),'rtpaudioqosrttbridged','sipcallid',_0x49c7('0x47'),'bridgepeer',_0x49c7('0x48'),'membercalls',_0x49c7('0x49'),_0x49c7('0x4a'),'memberlastcall',_0x49c7('0x4b'),_0x49c7('0x4c'),_0x49c7('0x4d')];if(!_[_0x49c7('0x4e')](_0x36eb57)&&!_[_0x49c7('0x4f')](_0x1493a1,_0x36eb57)){if(_[_0x49c7('0x16')](this['variables'][_0x2f5609])){this['variables'][_0x2f5609]={};}this[_0x49c7('0xd')][_0x2f5609][_0x36eb57]=_0x286533;}};VoiceDialReport['prototype'][_0x49c7('0x15')]=function(_0x50a00b){try{if(this[_0x49c7('0x18')](_0x50a00b)){logger['debug'](_0x49c7('0x50'),_0x50a00b[_0x49c7('0x1d')],util['inspect'](_0x50a00b,{'showHidden':![],'depth':null}));if(this[_0x49c7('0x9')][_0x50a00b[_0x49c7('0x1d')]]){logger[_0x49c7('0x51')](_0x49c7('0x52'),_0x50a00b[_0x49c7('0x1d')],_0x50a00b[_0x49c7('0x53')]);this[_0x49c7('0x9')][_0x50a00b['uniqueid']][_0x49c7('0x54')]=moment()['format'](_0x49c7('0x1e'));this['channels'][_0x50a00b['uniqueid']][_0x49c7('0x55')]=moment(this[_0x49c7('0x9')][_0x50a00b[_0x49c7('0x1d')]][_0x49c7('0x54')])['diff'](this['channels'][_0x50a00b[_0x49c7('0x1d')]][_0x49c7('0x56')],_0x49c7('0x57'));this[_0x49c7('0x9')][_0x50a00b[_0x49c7('0x1d')]]['lastevent']=_0x49c7('0x58');this[_0x49c7('0xb')]['total']+=0x1;if(this[_0x49c7('0x9')][_0x50a00b[_0x49c7('0x1d')]]['answertime']){this[_0x49c7('0xb')][_0x49c7('0x59')]+=0x1;this[_0x49c7('0x9')][_0x50a00b[_0x49c7('0x1d')]][_0x49c7('0x5a')]=moment(this[_0x49c7('0x9')][_0x50a00b[_0x49c7('0x1d')]]['answertime'])[_0x49c7('0x5b')](this[_0x49c7('0x9')][_0x50a00b[_0x49c7('0x1d')]]['starttime'],_0x49c7('0x57'));this['channels'][_0x50a00b[_0x49c7('0x1d')]][_0x49c7('0x5c')]=moment(this['channels'][_0x50a00b['uniqueid']][_0x49c7('0x54')])[_0x49c7('0x5b')](this[_0x49c7('0x9')][_0x50a00b['uniqueid']][_0x49c7('0x5d')],'seconds');this[_0x49c7('0xb')][_0x49c7('0x5e')]+=this[_0x49c7('0x9')][_0x50a00b[_0x49c7('0x1d')]][_0x49c7('0x5a')]||0x0;this[_0x49c7('0xb')][_0x49c7('0x5f')]+=this[_0x49c7('0x9')][_0x50a00b['uniqueid']][_0x49c7('0x5c')];}this[_0x49c7('0xb')]['sumDuration']+=this['channels'][_0x50a00b[_0x49c7('0x1d')]]['duration'];logger['debug'](_0x49c7('0x60'),_0x50a00b[_0x49c7('0x1d')],util[_0x49c7('0x1b')](this[_0x49c7('0x9')][_0x50a00b[_0x49c7('0x1d')]],{'showHidden':![],'depth':null}));ami[_0x49c7('0x17')]('custom:voiceDialReport',this[_0x49c7('0x9')][_0x50a00b[_0x49c7('0x1d')]]);logger[_0x49c7('0x19')](_0x49c7('0x61'),_0x50a00b[_0x49c7('0x1d')],util[_0x49c7('0x1b')](this[_0x49c7('0x9')][_0x50a00b[_0x49c7('0x1d')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialend',this[_0x49c7('0x9')][_0x50a00b[_0x49c7('0x1d')]]);logger[_0x49c7('0x19')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x50a00b['uniqueid'],util[_0x49c7('0x1b')](this[_0x49c7('0x9')][_0x50a00b[_0x49c7('0x1d')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x49c7('0x62'),this[_0x49c7('0xb')]);logger[_0x49c7('0x51')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this['channels'][_0x50a00b[_0x49c7('0x1d')]]));logger[_0x49c7('0x19')](_0x49c7('0x63'),_0x50a00b[_0x49c7('0x1d')],util[_0x49c7('0x1b')](this[_0x49c7('0x9')][_0x50a00b['uniqueid']],{'showHidden':![],'depth':null}));this[_0x49c7('0x17')](_0x49c7('0x29'),_0x49c7('0x64'),this[_0x49c7('0x9')][_0x50a00b[_0x49c7('0x1d')]]);delete this[_0x49c7('0x9')][_0x50a00b[_0x49c7('0x1d')]];}else if(this[_0x49c7('0x9')][_0x50a00b[_0x49c7('0x65')]]){this['channels'][_0x50a00b[_0x49c7('0x65')]][_0x49c7('0x1d')]=this[_0x49c7('0x9')][_0x50a00b[_0x49c7('0x65')]]['destuniqueid'];}if(this[_0x49c7('0xd')][_0x50a00b['uniqueid']]){delete this['variables'][_0x50a00b[_0x49c7('0x1d')]];}}}catch(_0x3b2c36){logger[_0x49c7('0x2d')]('[%s][voiceDialReport][hangup]',_0x50a00b[_0x49c7('0x1d')],util[_0x49c7('0x1b')](_0x3b2c36,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x49c7('0x2e')][_0x49c7('0x13')]=function(_0x2684b8){try{if(this[_0x49c7('0x18')](_0x2684b8)){logger[_0x49c7('0x19')](_0x49c7('0x66'),_0x2684b8['uniqueid'],util[_0x49c7('0x1b')](_0x2684b8,{'showHidden':![],'depth':null}));if(_0x2684b8[_0x49c7('0x67')][_0x49c7('0x68')]()===_0x49c7('0x69')){_0x2684b8[_0x49c7('0x6a')]=(_0x2684b8[_0x49c7('0x6b')]||_0x2684b8[_0x49c7('0x6a')])[_0x49c7('0x68')]();if(_[_0x49c7('0x6c')](_0x2684b8[_0x49c7('0x6a')],_0x49c7('0x6d'))){if(_[_0x49c7('0x16')](this[_0x49c7('0xc')][_0x2684b8[_0x49c7('0x1d')]]))this[_0x49c7('0xc')][_0x2684b8['uniqueid']]={};logger[_0x49c7('0x51')](_0x49c7('0x6e'),_0x2684b8[_0x49c7('0x1d')],_0x2684b8[_0x49c7('0x67')],_0x2684b8[_0x49c7('0x6a')]);var _0x3c703d=_0x2684b8[_0x49c7('0x6a')][_0x49c7('0x6f')]('=');var _0x29eb8b=_0x3c703d[0x0][_0x49c7('0x70')](/cdr\((.*)\)/);if(_0x29eb8b)this[_0x49c7('0xc')][_0x2684b8[_0x49c7('0x1d')]][_0x29eb8b[0x1]]=_0x3c703d[0x1];}}}}catch(_0x2049aa){logger['error']('[%s][voiceDialReport][newexten]',_0x2684b8['uniqueid'],util['inspect'](_0x2049aa,{'showHidden':![],'depth':null}));}};module[_0x49c7('0x71')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index fa8ee22..554c36a 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 _0xcd31=['queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','push','[%s][voiceQueueReport][queuecallerabandon]','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','syncQueueCallerLeave','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','[%s][voiceQueueReport][agentconnect]','queuecallercomplete','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','last','membername','transfer','reason','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','toLowerCase','local/','linkedid','queuecallerexit','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','emitVoiceQueueChannelRemove','agentcomplete','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','queuecallerexitAt','TIMEOUT','lastevent','timeout','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','memberrealtime','includes','[%s][voiceQueueReport][hangup]','unmanaged','diff','length','milliseconds','queuecallercompleteAt','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','syncBlindTransfer','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','transfererchannel','[%s][voiceQueueReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','appdata','startsWith','CDR(routeAlias)','cdr(','match','[%s][voiceQueueReport][newexten]','exports','moment','util','md5','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','campaigns','variables','queuesummary','syncQueueSummary','syncQueueSummaryComplete','bind','queuecallerjoin','queuecallerabandon','syncQueueCallerAbandon','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','newexten','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','blindtransfer','loopQueueSummary','loopQueueShow','hasOwnProperty','originated','talking','pTalking','queueStatusComplete','isEmpty','clearZombieChannels','switch','isNil','Action','status','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','inspect','[FullyBooted]\x20clear\x20realtime','clearQueueReport','clearqueuereport','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','emit','voice_queue_channel:save','name','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','sumBillable','sumDuration','sumHoldTime','total','abandoned','waiting','Trunk','active','Interval','stringify','[voiceQueueReport][','format','voice_queue:save','isNotNull','isUndefined','[voiceQueueReport][queues]','flagQueueSummary','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummary]\x20event:','queue','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedIn','available','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]'];(function(_0x3c5e54,_0x2b991b){var _0x3ae1f3=function(_0x43f80f){while(--_0x43f80f){_0x3c5e54['push'](_0x3c5e54['shift']());}};_0x3ae1f3(++_0x2b991b);}(_0xcd31,0x15d));var _0x1cd3=function(_0xd758b6,_0x225982){_0xd758b6=_0xd758b6-0x0;var _0x1dd8f3=_0xcd31[_0xd758b6];return _0x1dd8f3;};'use strict';var _=require('lodash');var moment=require(_0x1cd3('0x0'));var util=require(_0x1cd3('0x1'));var md5=require(_0x1cd3('0x2'));var Redis=require('ioredis');var config=require(_0x1cd3('0x3'));var logger=require(_0x1cd3('0x4'))(_0x1cd3('0x5'));var ami=require(_0x1cd3('0x6'));var QueueReport=require(_0x1cd3('0x7'));config[_0x1cd3('0x8')]=_['defaults'](config[_0x1cd3('0x8')],{'host':_0x1cd3('0x9'),'port':0x18eb});var io=require(_0x1cd3('0xa'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x1cd3('0xb')][_0x1cd3('0xc')]=function(_0x124659){this['tail']=this[_0x1cd3('0xd')]?this[_0x1cd3('0xd')][_0x1cd3('0xe')](_0x124659):_0x124659();};function VoiceQueueReport(_0xb3159f){this[_0x1cd3('0xf')]=new Sequence();this[_0x1cd3('0x10')]={};this[_0x1cd3('0x11')]=_0xb3159f['agents'];this[_0x1cd3('0x12')]=_0xb3159f[_0x1cd3('0x13')];this[_0x1cd3('0x14')]=_0xb3159f[_0x1cd3('0x14')];this['flagQueueSummary']=!![];this[_0x1cd3('0x15')]=_0xb3159f['campaigns'];this[_0x1cd3('0x16')]={};ami['on'](_0x1cd3('0x17'),this[_0x1cd3('0x18')]['bind'](this));ami['on']('queuesummarycomplete',this[_0x1cd3('0x19')][_0x1cd3('0x1a')](this));ami['on'](_0x1cd3('0x1b'),this['syncQueueCallerJoin'][_0x1cd3('0x1a')](this));ami['on'](_0x1cd3('0x1c'),this[_0x1cd3('0x1d')][_0x1cd3('0x1a')](this));ami['on']('queuecallerleave',this['syncQueueCallerLeave']['bind'](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on'](_0x1cd3('0x1e'),this[_0x1cd3('0x1f')][_0x1cd3('0x1a')](this));ami['on'](_0x1cd3('0x20'),this[_0x1cd3('0x21')][_0x1cd3('0x1a')](this));ami['on'](_0x1cd3('0x22'),this[_0x1cd3('0x23')][_0x1cd3('0x1a')](this));ami['on'](_0x1cd3('0x24'),this['syncFullyBooted'][_0x1cd3('0x1a')](this));ami['on'](_0x1cd3('0x25'),this['syncNewExten'][_0x1cd3('0x1a')](this));ami['on'](_0x1cd3('0x26'),this['syncMusicOnHoldStart'][_0x1cd3('0x1a')](this));ami['on'](_0x1cd3('0x27'),this[_0x1cd3('0x28')][_0x1cd3('0x1a')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x1cd3('0x1a')](this));ami['on'](_0x1cd3('0x29'),this['syncBlindTransfer']['bind'](this));this[_0x1cd3('0x2a')]();this[_0x1cd3('0x2b')]();}function clearChannels(_0x510514){if(!_['isEmpty'](_0x510514)){for(var _0x34b15f in _0x510514){if(_0x510514[_0x1cd3('0x2c')](_0x34b15f)){delete _0x510514[_0x34b15f];}}}}function clearCampaigns(_0x5ca367){if(!_['isEmpty'](_0x5ca367)){for(var _0x1c86f6 in _0x5ca367){if(_0x5ca367[_0x1cd3('0x2c')](_0x1c86f6)){_0x5ca367[_0x1c86f6][_0x1cd3('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x5e4dc7){if(!_['isEmpty'](_0x5e4dc7)){for(var _0x334ce2 in _0x5e4dc7){if(_0x5e4dc7['hasOwnProperty'](_0x334ce2)){_0x5e4dc7[_0x334ce2][_0x1cd3('0x2d')]=0x0;_0x5e4dc7[_0x334ce2][_0x1cd3('0x2e')]=0x0;_0x5e4dc7[_0x334ce2][_0x1cd3('0x2f')]=0x0;_0x5e4dc7[_0x334ce2]['waiting']=0x0;_0x5e4dc7[_0x334ce2][_0x1cd3('0x30')]=!![];}}}}function clearAgentBooked(_0x53979a){if(!_[_0x1cd3('0x31')](_0x53979a)){for(var _0x3e3afb in _0x53979a){if(_0x53979a[_0x1cd3('0x2c')](_0x3e3afb)){_0x53979a[_0x3e3afb]['unlockRR']=!![];}}}}VoiceQueueReport[_0x1cd3('0xb')][_0x1cd3('0x32')]=function(){var _0x3d4963=this;for(var _0x4399a1 in this[_0x1cd3('0x12')]){if(this['channels'][_0x1cd3('0x2c')](_0x4399a1)&&!this[_0x1cd3('0x12')][_0x4399a1][_0x1cd3('0x33')]){this[_0x1cd3('0xf')][_0x1cd3('0xc')](function(){if(!_[_0x1cd3('0x34')](_0x3d4963['channels'][_0x4399a1])){return ami[_0x1cd3('0x35')]({'action':_0x1cd3('0x36'),'channel':_0x3d4963['channels'][_0x4399a1]['channel']})[_0x1cd3('0x37')](function(_0xf3f9a7){if(_0xf3f9a7[_0x1cd3('0x38')]===_0x1cd3('0x39')){setTimeout(function(){if(_0x3d4963[_0x1cd3('0x12')][_0x4399a1]){delete _0x3d4963['channels'][_0x4399a1];logger[_0x1cd3('0x3a')]('[%s][voiceQueueReport][checkChannel]',_0x4399a1,util['inspect'](_0xf3f9a7,{'showHidden':![],'depth':null}));}if(_0x3d4963[_0x1cd3('0x10')][_0x4399a1]){delete _0x3d4963[_0x1cd3('0x10')][_0x4399a1];logger[_0x1cd3('0x3a')](_0x1cd3('0x3b'),_0x4399a1,util['inspect'](_0xf3f9a7,{'showHidden':![],'depth':null}));}if(_0x3d4963[_0x1cd3('0x16')][_0x4399a1]){delete _0x3d4963['variables'][_0x4399a1];logger[_0x1cd3('0x3a')](_0x1cd3('0x3c'),_0x4399a1,util[_0x1cd3('0x3d')](_0xf3f9a7,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x1cd3('0xb')]['syncFullyBooted']=function(){logger['error'](_0x1cd3('0x3e'));clearChannels(this['channels']);this[_0x1cd3('0x3f')](this[_0x1cd3('0x10')]);clearAgentBooked(this[_0x1cd3('0x11')]);clearVoiceQueues(this[_0x1cd3('0x14')]);clearCampaigns(this[_0x1cd3('0x15')]);};VoiceQueueReport['prototype']['clearQueueReport']=function(_0x538e73){var _0x4f88a5=this;if(!_[_0x1cd3('0x31')](_0x538e73)){for(var _0x51094a in _0x538e73){if(_0x538e73[_0x1cd3('0x2c')](_0x51094a)){_0x4f88a5['emitVoiceQueueChannelRemove'](_0x538e73[_0x51094a],_0x1cd3('0x40'));delete _0x538e73[_0x51094a];}}}};VoiceQueueReport[_0x1cd3('0xb')]['emit']=function(_0x296b75,_0x64badd,_0x11eba4){io['to'](_0x296b75)['emit'](_0x64badd,_0x11eba4);};VoiceQueueReport['prototype'][_0x1cd3('0x41')]=function(_0x203dc0,_0x25eb9b){logger[_0x1cd3('0x42')](_0x1cd3('0x43')+_0x25eb9b+_0x1cd3('0x44'),_0x203dc0[_0x1cd3('0x45')],util[_0x1cd3('0x3d')](_0x203dc0,{'showHidden':![],'depth':null}));this[_0x1cd3('0x46')](util['format']('voice:queue:%s',_0x203dc0['name']),_0x1cd3('0x47'),_0x203dc0);io[_0x1cd3('0x46')]('voice_queue_presence:save',_0x203dc0);};VoiceQueueReport[_0x1cd3('0xb')]['emitVoiceQueueChannelRemove']=function(_0x40b662,_0x2f6a00){logger[_0x1cd3('0x42')](_0x1cd3('0x43')+_0x2f6a00+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x40b662['uniqueid'],util['inspect'](_0x40b662,{'showHidden':![],'depth':null}));this[_0x1cd3('0x46')](util['format']('voice:queue:%s',_0x40b662[_0x1cd3('0x48')]),'voice_queue_channel:remove',_0x40b662);io[_0x1cd3('0x46')](_0x1cd3('0x49'),_0x40b662);};VoiceQueueReport[_0x1cd3('0xb')][_0x1cd3('0x4a')]=function(_0x326a80,_0x2a627d){if(_0x326a80[_0x1cd3('0x4b')]===_0x1cd3('0x4c')){var _0x53cac5={'id':_0x326a80['id'],'name':_0x326a80[_0x1cd3('0x48')],'strategy':_0x326a80[_0x1cd3('0x4d')],'answered':_0x326a80[_0x1cd3('0x4e')],'available':_0x326a80['available'],'loggedIn':_0x326a80['loggedIn'],'pTalking':_0x326a80[_0x1cd3('0x2f')],'sumBillable':_0x326a80[_0x1cd3('0x4f')],'sumDuration':_0x326a80[_0x1cd3('0x50')],'sumHoldTime':_0x326a80[_0x1cd3('0x51')]||0x0,'talking':_0x326a80[_0x1cd3('0x2e')],'total':_0x326a80[_0x1cd3('0x52')],'type':_0x326a80[_0x1cd3('0x4b')],'unmanaged':_0x326a80['unmanaged'],'abandoned':_0x326a80[_0x1cd3('0x53')],'waiting':_0x326a80[_0x1cd3('0x54')]};if(_0x326a80[_0x1cd3('0x55')]){_0x53cac5['Trunk']={'id':_0x326a80['Trunk']['id'],'name':_0x326a80[_0x1cd3('0x55')][_0x1cd3('0x48')],'active':_0x326a80[_0x1cd3('0x55')][_0x1cd3('0x56')],'callerid':_0x326a80[_0x1cd3('0x55')]['callerid']};}if(_0x326a80['Interval']){_0x53cac5['Interval']={'id':_0x326a80[_0x1cd3('0x57')]['id'],'name':_0x326a80[_0x1cd3('0x57')][_0x1cd3('0x48')]};}var _0x310caf=md5(JSON[_0x1cd3('0x58')](_0x53cac5));if(_0x326a80['md5']!==_0x310caf){_0x326a80['md5']=_0x310caf;logger[_0x1cd3('0x42')](_0x1cd3('0x59')+_0x2a627d+']\x20sending\x20voice_queue:save\x20event:',util[_0x1cd3('0x3d')](_0x53cac5,{'showHidden':![],'depth':null}));this[_0x1cd3('0x46')](util[_0x1cd3('0x5a')]('voice:queue:%s',_0x53cac5['name']),_0x1cd3('0x5b'),_0x53cac5);}}};VoiceQueueReport['prototype'][_0x1cd3('0x5c')]=function(_0x2f81ff){return _0x2f81ff!==null&&!_[_0x1cd3('0x5d')](_0x2f81ff);};VoiceQueueReport[_0x1cd3('0xb')][_0x1cd3('0x2b')]=function(){var _0xfaecf0=this;setInterval(function(){_0xfaecf0[_0x1cd3('0x32')]();ami[_0x1cd3('0x35')]({'action':'queues'})[_0x1cd3('0x37')](function(_0xa261fc){logger[_0x1cd3('0x3a')](_0x1cd3('0x5e'),util['inspect'](_0xa261fc,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x1cd3('0xb')][_0x1cd3('0x2a')]=function(){var _0xecb81e=this;setInterval(function(){if(_0xecb81e['flagQueueSummary']){return ami['Action']({'action':_0x1cd3('0x17')})['then'](function(_0x413e66){_0xecb81e[_0x1cd3('0x5f')]=![];})[_0x1cd3('0x37')](function(_0x28a4c1){logger['error'](_0x1cd3('0x60'),util[_0x1cd3('0x3d')](_0x28a4c1,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x1cd3('0xb')][_0x1cd3('0x18')]=function(_0x57a1e7){try{if(this[_0x1cd3('0x5c')](_0x57a1e7)&&this[_0x1cd3('0x5c')](_0x57a1e7['queue'])){logger['debug'](_0x1cd3('0x61'),util['inspect'](_0x57a1e7,{'showHidden':![],'depth':null}));if(this[_0x1cd3('0x14')][_0x57a1e7[_0x1cd3('0x62')]]){logger[_0x1cd3('0x63')](_0x1cd3('0x64'),_0x57a1e7[_0x1cd3('0x62')]);var _0x3cc228=_[_0x1cd3('0x65')](this['channels'],_0x1cd3('0x62'))[_0x57a1e7[_0x1cd3('0x62')]]||0x0;var _0x22ea88=_0x3cc228-_0x57a1e7[_0x1cd3('0x66')];if(this[_0x1cd3('0x14')][_0x57a1e7[_0x1cd3('0x62')]][_0x1cd3('0x54')]!==_[_0x1cd3('0x67')](_0x57a1e7[_0x1cd3('0x66')])||this[_0x1cd3('0x14')][_0x57a1e7[_0x1cd3('0x62')]][_0x1cd3('0x68')]!==_[_0x1cd3('0x67')](_0x57a1e7['loggedin'])||this[_0x1cd3('0x14')][_0x57a1e7['queue']][_0x1cd3('0x69')]!==_[_0x1cd3('0x67')](_0x57a1e7[_0x1cd3('0x69')])||this['voiceQueues'][_0x57a1e7[_0x1cd3('0x62')]][_0x1cd3('0x2e')]!==_0x22ea88){this[_0x1cd3('0x14')][_0x57a1e7[_0x1cd3('0x62')]][_0x1cd3('0x54')]=_[_0x1cd3('0x67')](_0x57a1e7[_0x1cd3('0x66')]);this[_0x1cd3('0x14')][_0x57a1e7[_0x1cd3('0x62')]]['loggedIn']=_[_0x1cd3('0x67')](_0x57a1e7[_0x1cd3('0x6a')]);this[_0x1cd3('0x14')][_0x57a1e7[_0x1cd3('0x62')]]['available']=_[_0x1cd3('0x67')](_0x57a1e7[_0x1cd3('0x69')]);this[_0x1cd3('0x14')][_0x57a1e7[_0x1cd3('0x62')]][_0x1cd3('0x2e')]=_0x22ea88>0x0?_0x22ea88:0x0;this[_0x1cd3('0x14')][_0x57a1e7['queue']][_0x1cd3('0x2e')]=this[_0x1cd3('0x14')][_0x57a1e7[_0x1cd3('0x62')]][_0x1cd3('0x2e')]>_[_0x1cd3('0x67')](_0x57a1e7[_0x1cd3('0x6a')])?_[_0x1cd3('0x67')](_0x57a1e7[_0x1cd3('0x6a')]):this[_0x1cd3('0x14')][_0x57a1e7[_0x1cd3('0x62')]]['talking'];this[_0x1cd3('0x4a')](this[_0x1cd3('0x14')][_0x57a1e7[_0x1cd3('0x62')]],_0x1cd3('0x17'));}logger[_0x1cd3('0x42')](_0x1cd3('0x6b'),util[_0x1cd3('0x3d')](this[_0x1cd3('0x14')][_0x57a1e7[_0x1cd3('0x62')]],{'showHidden':![],'depth':null}));ami['emit'](_0x1cd3('0x6c'),this['voiceQueues'][_0x57a1e7[_0x1cd3('0x62')]]);}}}catch(_0x1175c2){logger['error'](_0x1cd3('0x60'),util[_0x1cd3('0x3d')](_0x1175c2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1cd3('0xb')]['syncQueueSummaryComplete']=function(_0x3ced1a){logger[_0x1cd3('0x42')](_0x1cd3('0x6d'),util[_0x1cd3('0x3d')](_0x3ced1a,{'showHidden':![],'depth':null}));this[_0x1cd3('0x5f')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x2babca){try{if(this[_0x1cd3('0x5c')](_0x2babca)){logger['debug'](_0x1cd3('0x6e'),_0x2babca['uniqueid'],util[_0x1cd3('0x3d')](_0x2babca,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x2babca[_0x1cd3('0x45')]]))this['queueReports'][_0x2babca[_0x1cd3('0x45')]]=[];if(_['isUndefined'](this[_0x1cd3('0x12')][_0x2babca[_0x1cd3('0x45')]]))this[_0x1cd3('0x12')][_0x2babca[_0x1cd3('0x45')]]={};var _0x510eeb=new QueueReport();_0x510eeb[_0x1cd3('0x48')]=_0x2babca[_0x1cd3('0x62')];_0x510eeb['type']=this[_0x1cd3('0x14')][_0x510eeb[_0x1cd3('0x48')]]&&this['voiceQueues'][_0x510eeb[_0x1cd3('0x48')]][_0x1cd3('0x4b')]?this[_0x1cd3('0x14')][_0x510eeb['name']][_0x1cd3('0x4b')]||'inbound':_0x1cd3('0x4c');_0x510eeb[_0x1cd3('0x62')]=_0x2babca[_0x1cd3('0x62')];_0x510eeb[_0x1cd3('0x6f')]=moment()['format'](_0x1cd3('0x70'));_0x510eeb[_0x1cd3('0x71')]=_0x2babca[_0x1cd3('0x71')];_0x510eeb[_0x1cd3('0x72')]=_0x2babca['count'];_0x510eeb[_0x1cd3('0x45')]=_0x2babca[_0x1cd3('0x45')];_0x510eeb[_0x1cd3('0x73')]=this[_0x1cd3('0x12')][_0x2babca['uniqueid']][_0x1cd3('0x73')];logger['info'](_0x1cd3('0x74'),_0x510eeb[_0x1cd3('0x48')],_0x510eeb[_0x1cd3('0x4b')]);_['merge'](_0x510eeb,_[_0x1cd3('0x75')](_0x2babca,_[_0x1cd3('0x76')](_0x510eeb)));this[_0x1cd3('0x10')][_0x2babca[_0x1cd3('0x45')]][_0x1cd3('0x77')](_0x510eeb);this[_0x1cd3('0x12')][_0x2babca[_0x1cd3('0x45')]]=_0x510eeb;this[_0x1cd3('0x41')](_0x510eeb,_0x1cd3('0x1b'));}}catch(_0x2b1a93){logger['error'](_0x1cd3('0x6e'),_0x2babca[_0x1cd3('0x45')],util['inspect'](_0x2b1a93,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1cd3('0xb')][_0x1cd3('0x1d')]=function(_0x1b763a){try{if(this[_0x1cd3('0x5c')](_0x1b763a)){logger[_0x1cd3('0x42')](_0x1cd3('0x78'),_0x1b763a[_0x1cd3('0x45')],util[_0x1cd3('0x3d')](_0x1b763a,{'showHidden':![],'depth':null}));if(this[_0x1cd3('0x10')][_0x1b763a['uniqueid']]){var _0x3da1eb=_['last'](this[_0x1cd3('0x10')][_0x1b763a[_0x1cd3('0x45')]]);_0x3da1eb['queuecallercomplete']=![];_0x3da1eb['queuecallercompleteAt']=null;_0x3da1eb[_0x1cd3('0x79')]=_0x1b763a[_0x1cd3('0x79')];_0x3da1eb[_0x1cd3('0x7a')]=_0x1b763a['originalposition'];_0x3da1eb[_0x1cd3('0x1c')]=!![];_0x3da1eb[_0x1cd3('0x7b')]=moment()[_0x1cd3('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x3da1eb[_0x1cd3('0x7c')]=_0x1cd3('0x7d');_0x3da1eb['lastAssignedTo']=null;logger[_0x1cd3('0x63')](_0x1cd3('0x7e'),_0x3da1eb[_0x1cd3('0x48')],_0x3da1eb[_0x1cd3('0x4b')]);this[_0x1cd3('0x12')][_0x1b763a[_0x1cd3('0x45')]]=_0x3da1eb;this['emitVoiceQueueChannelRemove'](_0x3da1eb,_0x1cd3('0x1c'));}}}catch(_0x5d7d9c){logger[_0x1cd3('0x3a')](_0x1cd3('0x78'),_0x1b763a[_0x1cd3('0x45')],util[_0x1cd3('0x3d')](_0x5d7d9c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1cd3('0xb')][_0x1cd3('0x7f')]=function(_0x13be2b){try{if(this[_0x1cd3('0x5c')](_0x13be2b)){logger[_0x1cd3('0x42')](_0x1cd3('0x80'),_0x13be2b['uniqueid'],util[_0x1cd3('0x3d')](_0x13be2b,{'showHidden':![],'depth':null}));if(this[_0x1cd3('0x10')][_0x13be2b['uniqueid']]){var _0x137c16=_['last'](this[_0x1cd3('0x10')][_0x13be2b[_0x1cd3('0x45')]]);_0x137c16[_0x1cd3('0x81')]=moment()[_0x1cd3('0x5a')](_0x1cd3('0x70'));_0x137c16[_0x1cd3('0x82')]=_0x13be2b[_0x1cd3('0x82')];_0x137c16[_0x1cd3('0x83')]=_0x13be2b[_0x1cd3('0x83')];logger[_0x1cd3('0x63')](_0x1cd3('0x84'),_0x137c16[_0x1cd3('0x48')],_0x137c16['type'],_0x13be2b[_0x1cd3('0x82')],_0x13be2b[_0x1cd3('0x83')]);this[_0x1cd3('0x12')][_0x13be2b[_0x1cd3('0x45')]]=_0x137c16;this[_0x1cd3('0x41')](_0x137c16,_0x1cd3('0x85'));}}}catch(_0x2e3ba5){logger[_0x1cd3('0x3a')](_0x1cd3('0x80'),_0x13be2b['uniqueid'],util['inspect'](_0x2e3ba5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1cd3('0xb')]['syncAgentConnect']=function(_0x37b1c3){try{if(this['isNotNull'](_0x37b1c3)){logger[_0x1cd3('0x42')](_0x1cd3('0x86'),_0x37b1c3[_0x1cd3('0x45')],util[_0x1cd3('0x3d')](_0x37b1c3,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x37b1c3[_0x1cd3('0x45')]]){var _0x347313=_['last'](this['queueReports'][_0x37b1c3[_0x1cd3('0x45')]]);_0x347313[_0x1cd3('0x87')]=!![];_0x347313[_0x1cd3('0x7c')]=_0x1cd3('0x88');logger[_0x1cd3('0x63')](_0x1cd3('0x89'),_0x347313[_0x1cd3('0x48')],_0x347313['type']);}}}catch(_0xa29d9b){logger[_0x1cd3('0x3a')]('[%s][voiceQueueReport][agentconnect]',_0x37b1c3[_0x1cd3('0x45')],util[_0x1cd3('0x3d')](_0xa29d9b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x47df12){try{if(this['isNotNull'](_0x47df12)){logger[_0x1cd3('0x42')](_0x1cd3('0x8a'),_0x47df12[_0x1cd3('0x45')],util['inspect'](_0x47df12,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x47df12[_0x1cd3('0x45')]]){var _0x4d5955=_[_0x1cd3('0x8b')](this['queueReports'][_0x47df12[_0x1cd3('0x45')]]);_0x4d5955[_0x1cd3('0x1c')]=![];_0x4d5955[_0x1cd3('0x7b')]=null;_0x4d5955['assigned']=!![];_0x4d5955['lastAssignedTo']=_0x47df12[_0x1cd3('0x8c')];_0x4d5955[_0x1cd3('0x79')]=_0x47df12[_0x1cd3('0x79')];_0x4d5955['queuecallercomplete']=!![];_0x4d5955['queuecallerexit']=![];_0x4d5955['queuecallerexitAt']=null;if(!_0x4d5955[_0x1cd3('0x8d')]){if(_0x47df12[_0x1cd3('0x8e')]=='transfer'){_0x4d5955['queuecallerexitreason']='COMPLETED';logger[_0x1cd3('0x63')](_0x1cd3('0x8f'),_0x4d5955[_0x1cd3('0x48')],_0x4d5955[_0x1cd3('0x4b')]);}else{if(_['startsWith'](_0x47df12['channel'][_0x1cd3('0x90')](),_0x1cd3('0x91'))){if(this[_0x1cd3('0x10')][_0x47df12[_0x1cd3('0x92')]]){var _0x536a01=_[_0x1cd3('0x8b')](this[_0x1cd3('0x10')][_0x47df12[_0x1cd3('0x92')]]);_0x536a01['queuecallercomplete']=![];_0x536a01[_0x1cd3('0x93')]=!![];_0x536a01['queuecallerexitAt']=moment(_0x4d5955[_0x1cd3('0x6f')])['add'](_0x47df12[_0x1cd3('0x79')],_0x1cd3('0x94'))['format'](_0x1cd3('0x70'));_0x536a01['queuecallerexitreason']=_0x1cd3('0x95');_0x536a01[_0x1cd3('0x8d')]=!![];_0x536a01[_0x1cd3('0x96')]=_0x1cd3('0x97');_0x536a01[_0x1cd3('0x98')]=_0x47df12[_0x1cd3('0x99')];_0x536a01[_0x1cd3('0x9a')]=_0x47df12['uniqueid'];logger['info'](_0x1cd3('0x9b'),_0x536a01[_0x1cd3('0x48')],_0x536a01[_0x1cd3('0x4b')]);var _0x5cc3fb=this[_0x1cd3('0x10')][_0x47df12[_0x1cd3('0x92')]];this[_0x1cd3('0x10')][_0x47df12[_0x1cd3('0x92')]]=this[_0x1cd3('0x10')][_0x47df12[_0x1cd3('0x45')]];this[_0x1cd3('0x10')][_0x47df12[_0x1cd3('0x45')]]=_0x5cc3fb;}}else{_0x4d5955[_0x1cd3('0x7c')]=_0x1cd3('0x9c')+_0x47df12[_0x1cd3('0x8e')]['toUpperCase']();logger[_0x1cd3('0x63')](_0x1cd3('0x9d'),_0x4d5955[_0x1cd3('0x48')],_0x4d5955[_0x1cd3('0x4b')],_0x4d5955[_0x1cd3('0x7c')]);}}}this['channels'][_0x47df12[_0x1cd3('0x45')]]=_0x4d5955;this[_0x1cd3('0x9e')](_0x4d5955,_0x1cd3('0x9f'));}}}catch(_0x4ff342){logger['error'](_0x1cd3('0x8a'),_0x47df12[_0x1cd3('0x45')],util[_0x1cd3('0x3d')](_0x4ff342,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1cd3('0xb')]['syncVarSet']=function(_0x3f2413){try{if(this['isNotNull'](_0x3f2413)){logger[_0x1cd3('0x42')](_0x1cd3('0xa0'),_0x3f2413[_0x1cd3('0x45')],util['inspect'](_0x3f2413,{'showHidden':![],'depth':null}));this[_0x1cd3('0xa1')](_0x3f2413[_0x1cd3('0x45')],_[_0x1cd3('0x76')](_0x3f2413[_0x1cd3('0xa2')])[0x0],_0x3f2413[_0x1cd3('0xa3')]);if(this[_0x1cd3('0x10')][_0x3f2413[_0x1cd3('0x45')]]){var _0x5e7031=_[_0x1cd3('0x8b')](this[_0x1cd3('0x10')][_0x3f2413[_0x1cd3('0x45')]]);if(_0x5e7031){if(this[_0x1cd3('0x5c')](_0x3f2413[_0x1cd3('0xa2')])&&this[_0x1cd3('0x5c')](_0x3f2413['variable']['queuestatus'])){switch(_0x3f2413[_0x1cd3('0xa3')]){case _0x1cd3('0xa4'):_0x5e7031[_0x1cd3('0x93')]=![];_0x5e7031[_0x1cd3('0xa5')]=null;break;case _0x1cd3('0xa6'):_0x5e7031[_0x1cd3('0xa7')]=_0x1cd3('0xa8');_0x5e7031['queuecallerexit']=!![];_0x5e7031['queuecallerexitAt']=moment()[_0x1cd3('0x5a')](_0x1cd3('0x70'));_0x5e7031[_0x1cd3('0x81')]=moment()[_0x1cd3('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x1cd3('0x42')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x3f2413[_0x1cd3('0x45')],util['inspect'](_0x5e7031,{'showHidden':![],'depth':null}));ami[_0x1cd3('0x46')](_0x1cd3('0xa9'),_0x5e7031);break;default:_0x5e7031[_0x1cd3('0x93')]=!![];_0x5e7031['queuecallerexitAt']=moment()[_0x1cd3('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e7031[_0x1cd3('0x81')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5e7031[_0x1cd3('0x1c')]=![];_0x5e7031[_0x1cd3('0x7b')]=null;_0x5e7031[_0x1cd3('0x7c')]=_0x3f2413[_0x1cd3('0xa3')];this['channels'][_0x3f2413['uniqueid']]=_0x5e7031;this[_0x1cd3('0x9e')](_0x5e7031,'varset');}else if(this['isNotNull'](_0x3f2413[_0x1cd3('0xa2')])&&this[_0x1cd3('0x5c')](_0x3f2413['variable'][_0x1cd3('0xaa')])){if(!_0x5e7031[_0x1cd3('0x1c')]){_0x5e7031[_0x1cd3('0x93')]=!![];_0x5e7031[_0x1cd3('0xa5')]=moment()['format'](_0x1cd3('0x70'));_0x5e7031[_0x1cd3('0x7c')]=_0x1cd3('0xab');_0x5e7031[_0x1cd3('0x81')]=moment()[_0x1cd3('0x5a')](_0x1cd3('0x70'));this[_0x1cd3('0x12')][_0x3f2413[_0x1cd3('0x45')]]=_0x5e7031;}}logger[_0x1cd3('0x63')](_0x1cd3('0xac'),_0x3f2413[_0x1cd3('0x45')],_0x5e7031[_0x1cd3('0x48')],_0x5e7031[_0x1cd3('0x4b')],_[_0x1cd3('0x76')](_0x3f2413[_0x1cd3('0xa2')])[0x0],_0x3f2413['value']);_0x5e7031['variables']=this[_0x1cd3('0x16')][_0x3f2413['uniqueid']];}}}}catch(_0x59386a){logger['error'](_0x1cd3('0xa0'),_0x3f2413[_0x1cd3('0x45')],util[_0x1cd3('0x3d')](_0x59386a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1cd3('0xb')][_0x1cd3('0xa1')]=function(_0x3859cd,_0x3458be,_0x250994){var _0xfbf763=[_0x1cd3('0xad'),_0x1cd3('0xae'),_0x1cd3('0xaf'),_0x1cd3('0xb0'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0x1cd3('0xb1'),_0x1cd3('0xb2'),_0x1cd3('0xb3'),'bridgepeer',_0x1cd3('0xb4'),'membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty',_0x1cd3('0xb5')];if(!_[_0x1cd3('0x34')](_0x3458be)&&!_[_0x1cd3('0xb6')](_0xfbf763,_0x3458be)){if(_[_0x1cd3('0x5d')](this[_0x1cd3('0x16')][_0x3859cd])){this[_0x1cd3('0x16')][_0x3859cd]={};}this['variables'][_0x3859cd][_0x3458be]=_0x250994;}};VoiceQueueReport['prototype'][_0x1cd3('0x23')]=function(_0x3e15c2){try{if(this[_0x1cd3('0x5c')](_0x3e15c2)){logger['debug'](_0x1cd3('0xb7'),_0x3e15c2[_0x1cd3('0x45')],util[_0x1cd3('0x3d')](_0x3e15c2,{'showHidden':![],'depth':null}));if(this[_0x1cd3('0x10')][_0x3e15c2[_0x1cd3('0x45')]]){for(var _0xe5ebf1=0x0,_0x33ad9b={};_0xe5ebf10x0?_0x2fe018:0x0;this[_0x38d5('0x13')][_0x53cea9[_0x38d5('0x65')]][_0x38d5('0x2f')]=this[_0x38d5('0x13')][_0x53cea9['queue']][_0x38d5('0x2f')]>_[_0x38d5('0x6a')](_0x53cea9[_0x38d5('0x6b')])?_[_0x38d5('0x6a')](_0x53cea9['loggedin']):this['voiceQueues'][_0x53cea9[_0x38d5('0x65')]][_0x38d5('0x2f')];this[_0x38d5('0x6d')](this[_0x38d5('0x13')][_0x53cea9[_0x38d5('0x65')]],_0x38d5('0x16'));}logger['debug'](_0x38d5('0x6e'),util[_0x38d5('0x3d')](this['voiceQueues'][_0x53cea9['queue']],{'showHidden':![],'depth':null}));ami[_0x38d5('0x42')]('custom:queuesummary',this[_0x38d5('0x13')][_0x53cea9['queue']]);}}}catch(_0x518947){logger['error'](_0x38d5('0x64'),util[_0x38d5('0x3d')](_0x518947,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x38d5('0x1a')]=function(_0x442093){logger[_0x38d5('0x4c')](_0x38d5('0x6f'),util[_0x38d5('0x3d')](_0x442093,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0x38d5('0xc')][_0x38d5('0x1b')]=function(_0x519146){try{if(this[_0x38d5('0x60')](_0x519146)){logger[_0x38d5('0x4c')](_0x38d5('0x70'),_0x519146[_0x38d5('0x46')],util[_0x38d5('0x3d')](_0x519146,{'showHidden':![],'depth':null}));if(_[_0x38d5('0x71')](this[_0x38d5('0x10')][_0x519146[_0x38d5('0x46')]]))this['queueReports'][_0x519146[_0x38d5('0x46')]]=[];if(_[_0x38d5('0x71')](this[_0x38d5('0x12')][_0x519146[_0x38d5('0x46')]]))this[_0x38d5('0x12')][_0x519146[_0x38d5('0x46')]]={};var _0x2ce317=new QueueReport();_0x2ce317[_0x38d5('0x48')]=_0x519146[_0x38d5('0x65')];_0x2ce317[_0x38d5('0x56')]=this['voiceQueues'][_0x2ce317['name']]&&this[_0x38d5('0x13')][_0x2ce317[_0x38d5('0x48')]][_0x38d5('0x56')]?this[_0x38d5('0x13')][_0x2ce317['name']][_0x38d5('0x56')]||'inbound':_0x38d5('0x72');_0x2ce317[_0x38d5('0x65')]=_0x519146[_0x38d5('0x65')];_0x2ce317[_0x38d5('0x73')]=moment()[_0x38d5('0x47')](_0x38d5('0x74'));_0x2ce317[_0x38d5('0x75')]=_0x519146[_0x38d5('0x75')];_0x2ce317['count']=_0x519146['count'];_0x2ce317[_0x38d5('0x46')]=_0x519146[_0x38d5('0x46')];_0x2ce317[_0x38d5('0x76')]=this[_0x38d5('0x12')][_0x519146[_0x38d5('0x46')]][_0x38d5('0x76')];logger['info'](_0x38d5('0x77'),_0x2ce317['name'],_0x2ce317[_0x38d5('0x56')]);_[_0x38d5('0x78')](_0x2ce317,_[_0x38d5('0x79')](_0x519146,_[_0x38d5('0x7a')](_0x2ce317)));this[_0x38d5('0x10')][_0x519146[_0x38d5('0x46')]]['push'](_0x2ce317);this[_0x38d5('0x12')][_0x519146[_0x38d5('0x46')]]=_0x2ce317;this[_0x38d5('0x43')](_0x2ce317,'queuecallerjoin');}}catch(_0x483d25){logger['error'](_0x38d5('0x70'),_0x519146[_0x38d5('0x46')],util[_0x38d5('0x3d')](_0x483d25,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x38d5('0xc')][_0x38d5('0x7b')]=function(_0x3f6463){try{if(this[_0x38d5('0x60')](_0x3f6463)){logger[_0x38d5('0x4c')](_0x38d5('0x7c'),_0x3f6463['uniqueid'],util[_0x38d5('0x3d')](_0x3f6463,{'showHidden':![],'depth':null}));if(this[_0x38d5('0x10')][_0x3f6463['uniqueid']]){var _0x3f0ae3=_['last'](this['queueReports'][_0x3f6463['uniqueid']]);_0x3f0ae3[_0x38d5('0x7d')]=![];_0x3f0ae3[_0x38d5('0x7e')]=null;_0x3f0ae3[_0x38d5('0x7f')]=_0x3f6463['holdtime'];_0x3f0ae3[_0x38d5('0x80')]=_0x3f6463[_0x38d5('0x80')];_0x3f0ae3[_0x38d5('0x1c')]=!![];_0x3f0ae3[_0x38d5('0x81')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3f0ae3[_0x38d5('0x82')]=_0x38d5('0x83');_0x3f0ae3['lastAssignedTo']=null;logger[_0x38d5('0x66')](_0x38d5('0x84'),_0x3f0ae3[_0x38d5('0x48')],_0x3f0ae3[_0x38d5('0x56')]);this['channels'][_0x3f6463['uniqueid']]=_0x3f0ae3;this[_0x38d5('0x4b')](_0x3f0ae3,_0x38d5('0x1c'));}}}catch(_0x162b20){logger[_0x38d5('0x3c')](_0x38d5('0x7c'),_0x3f6463[_0x38d5('0x46')],util[_0x38d5('0x3d')](_0x162b20,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x38d5('0xc')][_0x38d5('0x1e')]=function(_0x3575d7){try{if(this[_0x38d5('0x60')](_0x3575d7)){logger[_0x38d5('0x4c')](_0x38d5('0x85'),_0x3575d7[_0x38d5('0x46')],util['inspect'](_0x3575d7,{'showHidden':![],'depth':null}));if(this[_0x38d5('0x10')][_0x3575d7['uniqueid']]){var _0x4c945b=_[_0x38d5('0x86')](this[_0x38d5('0x10')][_0x3575d7[_0x38d5('0x46')]]);_0x4c945b[_0x38d5('0x87')]=moment()[_0x38d5('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c945b[_0x38d5('0x88')]=_0x3575d7[_0x38d5('0x88')];_0x4c945b[_0x38d5('0x89')]=_0x3575d7[_0x38d5('0x89')];logger[_0x38d5('0x66')](_0x38d5('0x8a'),_0x4c945b[_0x38d5('0x48')],_0x4c945b['type'],_0x3575d7[_0x38d5('0x88')],_0x3575d7[_0x38d5('0x89')]);this[_0x38d5('0x12')][_0x3575d7[_0x38d5('0x46')]]=_0x4c945b;this[_0x38d5('0x43')](_0x4c945b,_0x38d5('0x1d'));}}}catch(_0x211ed4){logger[_0x38d5('0x3c')](_0x38d5('0x85'),_0x3575d7[_0x38d5('0x46')],util[_0x38d5('0x3d')](_0x211ed4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x38d5('0x22')]=function(_0x3eb56c){try{if(this[_0x38d5('0x60')](_0x3eb56c)){logger[_0x38d5('0x4c')](_0x38d5('0x8b'),_0x3eb56c[_0x38d5('0x46')],util['inspect'](_0x3eb56c,{'showHidden':![],'depth':null}));if(this[_0x38d5('0x10')][_0x3eb56c[_0x38d5('0x46')]]){var _0x2871c1=_[_0x38d5('0x86')](this[_0x38d5('0x10')][_0x3eb56c[_0x38d5('0x46')]]);_0x2871c1[_0x38d5('0x7d')]=!![];_0x2871c1[_0x38d5('0x82')]=_0x38d5('0x8c');logger[_0x38d5('0x66')](_0x38d5('0x8d'),_0x2871c1[_0x38d5('0x48')],_0x2871c1[_0x38d5('0x56')]);}}}catch(_0x41e1d1){logger[_0x38d5('0x3c')](_0x38d5('0x8b'),_0x3eb56c[_0x38d5('0x46')],util['inspect'](_0x41e1d1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x38d5('0xc')][_0x38d5('0x20')]=function(_0x37a1fb){try{if(this[_0x38d5('0x60')](_0x37a1fb)){logger[_0x38d5('0x4c')](_0x38d5('0x8e'),_0x37a1fb[_0x38d5('0x46')],util[_0x38d5('0x3d')](_0x37a1fb,{'showHidden':![],'depth':null}));if(this[_0x38d5('0x10')][_0x37a1fb[_0x38d5('0x46')]]){var _0x535db5=_[_0x38d5('0x86')](this['queueReports'][_0x37a1fb['uniqueid']]);_0x535db5['queuecallerabandon']=![];_0x535db5['queuecallerabandonAt']=null;_0x535db5[_0x38d5('0x8f')]=!![];_0x535db5[_0x38d5('0x90')]=_0x37a1fb[_0x38d5('0x91')];_0x535db5[_0x38d5('0x7f')]=_0x37a1fb[_0x38d5('0x7f')];_0x535db5[_0x38d5('0x7d')]=!![];_0x535db5['queuecallerexit']=![];_0x535db5['queuecallerexitAt']=null;if(!_0x535db5[_0x38d5('0x92')]){if(_0x37a1fb[_0x38d5('0x93')]==_0x38d5('0x92')){_0x535db5[_0x38d5('0x82')]=_0x38d5('0x94');logger[_0x38d5('0x66')](_0x38d5('0x95'),_0x535db5[_0x38d5('0x48')],_0x535db5[_0x38d5('0x56')]);}else{if(_[_0x38d5('0x96')](_0x37a1fb[_0x38d5('0x38')][_0x38d5('0x97')](),_0x38d5('0x98'))){if(this[_0x38d5('0x10')][_0x37a1fb['linkedid']]){var _0x1d39e2=_['last'](this[_0x38d5('0x10')][_0x37a1fb['linkedid']]);_0x1d39e2[_0x38d5('0x7d')]=![];_0x1d39e2['queuecallerexit']=!![];_0x1d39e2['queuecallerexitAt']=moment(_0x535db5['queuecallerjoinAt'])[_0x38d5('0x99')](_0x37a1fb[_0x38d5('0x7f')],_0x38d5('0x9a'))[_0x38d5('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d39e2[_0x38d5('0x82')]='FORWARDTRANSFER';_0x1d39e2[_0x38d5('0x92')]=!![];_0x1d39e2[_0x38d5('0x9b')]=_0x38d5('0x9c');_0x1d39e2['transferexten']=_0x37a1fb[_0x38d5('0x9d')];_0x1d39e2[_0x38d5('0x9e')]=_0x37a1fb[_0x38d5('0x46')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x1d39e2[_0x38d5('0x48')],_0x1d39e2[_0x38d5('0x56')]);var _0xba91b5=this[_0x38d5('0x10')][_0x37a1fb[_0x38d5('0x9f')]];this[_0x38d5('0x10')][_0x37a1fb['linkedid']]=this[_0x38d5('0x10')][_0x37a1fb[_0x38d5('0x46')]];this[_0x38d5('0x10')][_0x37a1fb[_0x38d5('0x46')]]=_0xba91b5;}}else{_0x535db5[_0x38d5('0x82')]=_0x38d5('0xa0')+_0x37a1fb[_0x38d5('0x93')][_0x38d5('0xa1')]();logger[_0x38d5('0x66')](_0x38d5('0xa2'),_0x535db5[_0x38d5('0x48')],_0x535db5[_0x38d5('0x56')],_0x535db5[_0x38d5('0x82')]);}}}this['channels'][_0x37a1fb[_0x38d5('0x46')]]=_0x535db5;this[_0x38d5('0x4b')](_0x535db5,_0x38d5('0x1f'));}}}catch(_0x2000d9){logger[_0x38d5('0x3c')]('[%s][voiceQueueReport][agentcomplete]',_0x37a1fb[_0x38d5('0x46')],util['inspect'](_0x2000d9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x38d5('0x23')]=function(_0x40d445){try{if(this['isNotNull'](_0x40d445)){logger[_0x38d5('0x4c')](_0x38d5('0xa3'),_0x40d445[_0x38d5('0x46')],util['inspect'](_0x40d445,{'showHidden':![],'depth':null}));this[_0x38d5('0xa4')](_0x40d445[_0x38d5('0x46')],_[_0x38d5('0x7a')](_0x40d445['variable'])[0x0],_0x40d445[_0x38d5('0xa5')]);if(this[_0x38d5('0x10')][_0x40d445[_0x38d5('0x46')]]){var _0x22207f=_[_0x38d5('0x86')](this[_0x38d5('0x10')][_0x40d445['uniqueid']]);if(_0x22207f){if(this['isNotNull'](_0x40d445[_0x38d5('0xa6')])&&this[_0x38d5('0x60')](_0x40d445[_0x38d5('0xa6')]['queuestatus'])){switch(_0x40d445['value']){case'CONTINUE':_0x22207f['queuecallerexit']=![];_0x22207f['queuecallerexitAt']=null;break;case _0x38d5('0xa7'):_0x22207f[_0x38d5('0xa8')]=_0x38d5('0xa9');_0x22207f[_0x38d5('0xaa')]=!![];_0x22207f[_0x38d5('0xab')]=moment()[_0x38d5('0x47')](_0x38d5('0x74'));_0x22207f[_0x38d5('0x87')]=moment()['format'](_0x38d5('0x74'));logger['debug'](_0x38d5('0xac'),_0x40d445[_0x38d5('0x46')],util[_0x38d5('0x3d')](_0x22207f,{'showHidden':![],'depth':null}));ami[_0x38d5('0x42')](_0x38d5('0xad'),_0x22207f);break;default:_0x22207f[_0x38d5('0xaa')]=!![];_0x22207f[_0x38d5('0xab')]=moment()['format'](_0x38d5('0x74'));_0x22207f[_0x38d5('0x87')]=moment()[_0x38d5('0x47')](_0x38d5('0x74'));}_0x22207f[_0x38d5('0x1c')]=![];_0x22207f[_0x38d5('0x81')]=null;_0x22207f['queuecallerexitreason']=_0x40d445[_0x38d5('0xa5')];this[_0x38d5('0x12')][_0x40d445['uniqueid']]=_0x22207f;this['emitVoiceQueueChannelRemove'](_0x22207f,'varset');}else if(this['isNotNull'](_0x40d445['variable'])&&this[_0x38d5('0x60')](_0x40d445['variable']['queueposition'])){if(!_0x22207f['queuecallerabandon']){_0x22207f[_0x38d5('0xaa')]=!![];_0x22207f[_0x38d5('0xab')]=moment()[_0x38d5('0x47')](_0x38d5('0x74'));_0x22207f[_0x38d5('0x82')]=_0x38d5('0xae');_0x22207f[_0x38d5('0x87')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x38d5('0x12')][_0x40d445[_0x38d5('0x46')]]=_0x22207f;}}logger[_0x38d5('0x66')](_0x38d5('0xaf'),_0x40d445[_0x38d5('0x46')],_0x22207f[_0x38d5('0x48')],_0x22207f[_0x38d5('0x56')],_[_0x38d5('0x7a')](_0x40d445['variable'])[0x0],_0x40d445[_0x38d5('0xa5')]);_0x22207f[_0x38d5('0x3e')]=this[_0x38d5('0x3e')][_0x40d445['uniqueid']];}}}}catch(_0x822648){logger[_0x38d5('0x3c')](_0x38d5('0xa3'),_0x40d445[_0x38d5('0x46')],util[_0x38d5('0x3d')](_0x822648,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x46242d,_0x107fca,_0x8677c2){var _0x4ffed2=['rtpaudioqos','rtpaudioqosbridged',_0x38d5('0xb0'),_0x38d5('0xb1'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x38d5('0xb2'),'rtpaudioqosrttbridged',_0x38d5('0xb3'),_0x38d5('0xb4'),_0x38d5('0xb5'),_0x38d5('0xb6'),_0x38d5('0xb7'),_0x38d5('0xb8'),_0x38d5('0xb9'),_0x38d5('0xba'),_0x38d5('0x91'),'memberpenalty',_0x38d5('0xbb')];if(!_['isNil'](_0x107fca)&&!_[_0x38d5('0xbc')](_0x4ffed2,_0x107fca)){if(_[_0x38d5('0x71')](this[_0x38d5('0x3e')][_0x46242d])){this['variables'][_0x46242d]={};}this['variables'][_0x46242d][_0x107fca]=_0x8677c2;}};VoiceQueueReport[_0x38d5('0xc')][_0x38d5('0xbd')]=function(_0x48afdb){try{if(this[_0x38d5('0x60')](_0x48afdb)){logger['debug'](_0x38d5('0xbe'),_0x48afdb['uniqueid'],util[_0x38d5('0x3d')](_0x48afdb,{'showHidden':![],'depth':null}));if(this[_0x38d5('0x10')][_0x48afdb[_0x38d5('0x46')]]){for(var _0x44ad9a=0x0,_0x485075={};_0x44ad9a=0x0?moment(_0x3092c4['endtime'])[_0x984f('0x19')](_0x3092c4[_0x984f('0x16')],_0x984f('0x18')):null,'data1':'outbound','data2':_0x3092c4[_0x984f('0x11')],'data3':_0x3092c4['exten'],'data4':_0x3092c4[_0x984f('0x1a')]||null,'role':'agent','internal':_0x3092c4['accountcode']?_['toNumber'](_0x3092c4[_0x984f('0x11')]):undefined,'uniqueid':_0x3092c4[_0x984f('0x12')]},'log':_0x984f('0x5')});}; \ No newline at end of file +var _0x9e6d=['toNumber','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','accountcode','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','dialstring','agent'];(function(_0x4fae90,_0x5d6ee9){var _0x1f9725=function(_0x4fe0c4){while(--_0x4fe0c4){_0x4fae90['push'](_0x4fae90['shift']());}};_0x1f9725(++_0x5d6ee9);}(_0x9e6d,0x1b3));var _0xd9e6=function(_0x44b366,_0xf7e29a){_0x44b366=_0x44b366-0x0;var _0x308ddd=_0x9e6d[_0x44b366];return _0x308ddd;};'use strict';var moment=require('moment');var _=require(_0xd9e6('0x0'));var util=require(_0xd9e6('0x1'));var client=require(_0xd9e6('0x2'));exports[_0xd9e6('0x3')]=function(_0x3a0628){var _0x566aca=_0x3a0628[_0xd9e6('0x4')]||_0x3a0628[_0xd9e6('0x5')];return client[_0xd9e6('0x6')](_0xd9e6('0x7'),{'body':{'channel':_0xd9e6('0x8'),'membername':_0x3a0628[_0xd9e6('0x9')],'interface':_[_0xd9e6('0xa')](_0x3a0628[_0xd9e6('0xb')])?util['format'](_0xd9e6('0xc'),_0x3a0628[_0xd9e6('0x9')]):_0x3a0628[_0xd9e6('0xb')],'type':_0xd9e6('0xd'),'enterAt':_0x3a0628[_0xd9e6('0xe')],'exitAt':_0x566aca,'duration':moment(_0x566aca)[_0xd9e6('0xf')](_0x3a0628['queuecallerleaveAt'],_0xd9e6('0x10')),'data1':_0xd9e6('0x11'),'data2':_0x3a0628[_0xd9e6('0x12')],'data3':_0x3a0628[_0xd9e6('0x13')],'data4':null,'data5':_0x3a0628[_0xd9e6('0x14')],'role':'agent','internal':_0x3a0628[_0xd9e6('0x15')]?_['toNumber'](_0x3a0628['accountcode']):undefined,'uniqueid':_0x3a0628[_0xd9e6('0x16')]},'log':'CreateMemberReport'});};exports[_0xd9e6('0x17')]=function(_0x5723a6){return client[_0xd9e6('0x6')]('CreateMemberReport',{'body':{'channel':_0xd9e6('0x8'),'membername':_0x5723a6[_0xd9e6('0x18')],'interface':_0x5723a6[_0xd9e6('0xb')],'type':_0xd9e6('0xd'),'enterAt':_0x5723a6[_0xd9e6('0x19')],'exitAt':_0x5723a6['endtime'],'duration':moment(_0x5723a6[_0xd9e6('0x1a')])['diff'](_0x5723a6[_0xd9e6('0x19')],_0xd9e6('0x10'))>=0x0?moment(_0x5723a6[_0xd9e6('0x1a')])['diff'](_0x5723a6['starttime'],_0xd9e6('0x10')):null,'data1':_0xd9e6('0x1b'),'data2':_0x5723a6[_0xd9e6('0x15')],'data3':_0x5723a6['exten'],'data4':_0x5723a6[_0xd9e6('0x1c')]||null,'role':_0xd9e6('0x1d'),'internal':_0x5723a6[_0xd9e6('0x15')]?_[_0xd9e6('0x1e')](_0x5723a6[_0xd9e6('0x15')]):undefined,'uniqueid':_0x5723a6[_0xd9e6('0x16')]},'log':_0xd9e6('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 95cf348..687caae 100644 --- a/server/services/ami/rpc/setting.js +++ b/server/services/ami/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb95d=['ShowSetting','stopRecordingOnTransfer','GetSettings','../client','Request'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0xb95d,0x1c5));var _0xdb95=function(_0x56ddab,_0x5957ae){_0x56ddab=_0x56ddab-0x0;var _0x53dd24=_0xb95d[_0x56ddab];return _0x53dd24;};'use strict';var client=require(_0xdb95('0x0'));exports['getSettings']=function(){return client[_0xdb95('0x1')](_0xdb95('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xdb95('0x3')]},'log':_0xdb95('0x4')});}; \ No newline at end of file +var _0xa6f0=['../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','GetSettings'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0xa6f0,0xea));var _0x0a6f=function(_0x251435,_0x3d7f81){_0x251435=_0x251435-0x0;var _0x3b9ee3=_0xa6f0[_0x251435];return _0x3b9ee3;};'use strict';var client=require(_0x0a6f('0x0'));exports[_0x0a6f('0x1')]=function(){return client[_0x0a6f('0x2')](_0x0a6f('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0a6f('0x4')]},'log':_0x0a6f('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index f5adbd9..fd7c5b3 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 _0x9341=['../client','getTemplates','GetTemplate','name','html'];(function(_0x297bf9,_0x3ed549){var _0x3e86dc=function(_0x21ea35){while(--_0x21ea35){_0x297bf9['push'](_0x297bf9['shift']());}};_0x3e86dc(++_0x3ed549);}(_0x9341,0xff));var _0x1934=function(_0x40df8a,_0x333e27){_0x40df8a=_0x40df8a-0x0;var _0x4788f0=_0x9341[_0x40df8a];return _0x4788f0;};'use strict';var client=require(_0x1934('0x0'));exports[_0x1934('0x1')]=function(_0x5c2738){return function(_0x3db752){return client['Request'](_0x1934('0x2'),{'options':{'raw':!![],'attributes':['id',_0x1934('0x3'),_0x1934('0x4')]},'log':_0x1934('0x2')});};}; \ No newline at end of file +var _0x8689=['../client','getTemplates','GetTemplate','name','html'];(function(_0x5d07ac,_0x119581){var _0x3da334=function(_0x5b0d81){while(--_0x5b0d81){_0x5d07ac['push'](_0x5d07ac['shift']());}};_0x3da334(++_0x119581);}(_0x8689,0x14a));var _0x9868=function(_0x2598a2,_0x19d25a){_0x2598a2=_0x2598a2-0x0;var _0x10f13a=_0x8689[_0x2598a2];return _0x10f13a;};'use strict';var client=require(_0x9868('0x0'));exports[_0x9868('0x1')]=function(_0xd717d7){return function(_0x9a6aad){return client['Request'](_0x9868('0x2'),{'options':{'raw':!![],'attributes':['id',_0x9868('0x3'),_0x9868('0x4')]},'log':_0x9868('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 7e77ea9..0aee394 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 _0xacd2=['Action','action','data1','data3','data4','data5','data6','data7','name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions'];(function(_0x1e753b,_0x209149){var _0x13d34e=function(_0x338150){while(--_0x338150){_0x1e753b['push'](_0x1e753b['shift']());}};_0x13d34e(++_0x209149);}(_0xacd2,0x17e));var _0x2acd=function(_0x421af1,_0x52e042){_0x421af1=_0x421af1-0x0;var _0x2856d3=_0xacd2[_0x421af1];return _0x2856d3;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x4ba276){return function(_0x1bc108){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x2acd('0x0'),_0x2acd('0x1'),_0x2acd('0x2')],'include':[{'model':_0x2acd('0x3'),'as':_0x2acd('0x4'),'attributes':['id',_0x2acd('0x5'),_0x2acd('0x6'),_0x2acd('0x7')]},{'model':_0x2acd('0x3'),'as':_0x2acd('0x8'),'attributes':['id',_0x2acd('0x5'),_0x2acd('0x6'),'value']},{'model':_0x2acd('0x9'),'as':'Actions','attributes':['id',_0x2acd('0xa'),_0x2acd('0xb'),'data2',_0x2acd('0xc'),_0x2acd('0xd'),_0x2acd('0xe'),_0x2acd('0xf'),_0x2acd('0x10')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x4967=['AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1','data2','data6','data7','../client','GetTrigger','channel','status','Condition'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x4967,0x10b));var _0x7496=function(_0x4f5226,_0x518f6c){_0x4f5226=_0x4f5226-0x0;var _0x42fdd5=_0x4967[_0x4f5226];return _0x42fdd5;};'use strict';var client=require(_0x7496('0x0'));exports['getTriggers']=function(_0x27cc0a){return function(_0x4012bd){return client['Request'](_0x7496('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x7496('0x2'),_0x7496('0x3')],'include':[{'model':_0x7496('0x4'),'as':_0x7496('0x5'),'attributes':['id',_0x7496('0x6'),_0x7496('0x7'),_0x7496('0x8')]},{'model':_0x7496('0x4'),'as':_0x7496('0x9'),'attributes':['id',_0x7496('0x6'),_0x7496('0x7'),'value']},{'model':_0x7496('0xa'),'as':_0x7496('0xb'),'attributes':['id',_0x7496('0xc'),_0x7496('0xd'),_0x7496('0xe'),'data3','data4','data5',_0x7496('0xf'),_0x7496('0x10')]}]},'log':_0x7496('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 835a258..986eb1d 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 _0xf629=['../client','Request','GetTrunk','name','registry'];(function(_0x5af97c,_0x24a49f){var _0x3472ae=function(_0x54cdc3){while(--_0x54cdc3){_0x5af97c['push'](_0x5af97c['shift']());}};_0x3472ae(++_0x24a49f);}(_0xf629,0xd7));var _0x9f62=function(_0x410b0b,_0x4e4d91){_0x410b0b=_0x410b0b-0x0;var _0x315c91=_0xf629[_0x410b0b];return _0x315c91;};'use strict';var client=require(_0x9f62('0x0'));exports['getTrunks']=function(_0x173e36){return function(_0x4c2f42){return client[_0x9f62('0x1')](_0x9f62('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9f62('0x3'),_0x9f62('0x4'),'defaultuser']},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xaefc=['../client','getTrunks','Request','GetTrunk','defaultuser'];(function(_0x5917f0,_0x3d07e1){var _0x2edf04=function(_0x303dc1){while(--_0x303dc1){_0x5917f0['push'](_0x5917f0['shift']());}};_0x2edf04(++_0x3d07e1);}(_0xaefc,0xc8));var _0xcaef=function(_0x1141a6,_0x3fd193){_0x1141a6=_0x1141a6-0x0;var _0x50f183=_0xaefc[_0x1141a6];return _0x50f183;};'use strict';var client=require(_0xcaef('0x0'));exports[_0xcaef('0x1')]=function(_0x434367){return function(_0x5e5d8b){return client[_0xcaef('0x2')](_0xcaef('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0xcaef('0x4')]},'log':_0xcaef('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 6b5c5f2..2636c7f 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 _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x55287f,_0x4f4808){var _0x3938d6=function(_0x53d660){while(--_0x53d660){_0x55287f['push'](_0x55287f['shift']());}};_0x3938d6(++_0x4f4808);}(_0xedd9,0xfc));var _0x9edd=function(_0x143a25,_0x37d7f5){_0x143a25=_0x143a25-0x0;var _0x326bb9=_0xedd9[_0x143a25];return _0x326bb9;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0xf12288,_0x4911a6){var _0x4117ba=function(_0x34d17c){while(--_0x34d17c){_0xf12288['push'](_0xf12288['shift']());}};_0x4117ba(++_0x4911a6);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 1355262..86884d4 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 _0x0a74=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x385d07,_0x526574){var _0x4fc7e7=function(_0x1b7e00){while(--_0x1b7e00){_0x385d07['push'](_0x385d07['shift']());}};_0x4fc7e7(++_0x526574);}(_0x0a74,0x69));var _0x40a7=function(_0x36fecf,_0x2529fe){_0x36fecf=_0x36fecf-0x0;var _0x4b7f8e=_0x0a74[_0x36fecf];return _0x4b7f8e;};'use strict';var client=require(_0x40a7('0x0'));exports[_0x40a7('0x1')]=function(_0x5b2392){return client[_0x40a7('0x2')]('CreateVoiceAgentReport',{'body':_0x5b2392,'log':_0x40a7('0x3')});};exports[_0x40a7('0x4')]=function(_0x370dee,_0x5a0607,_0x572ee){return client[_0x40a7('0x2')](_0x40a7('0x5'),{'body':_0x370dee,'options':{'where':{'uniqueid':_0x5a0607,'interface':_0x572ee,'agentcomplete':!![]}},'log':_0x40a7('0x5')});}; \ No newline at end of file +var _0xe900=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x27beea,_0x3bc9f4){var _0x122645=function(_0x2c848){while(--_0x2c848){_0x27beea['push'](_0x27beea['shift']());}};_0x122645(++_0x3bc9f4);}(_0xe900,0xd3));var _0x0e90=function(_0x1de3f6,_0x4e1bfe){_0x1de3f6=_0x1de3f6-0x0;var _0x22e886=_0xe900[_0x1de3f6];return _0x22e886;};'use strict';var client=require(_0x0e90('0x0'));exports[_0x0e90('0x1')]=function(_0x5db873){return client[_0x0e90('0x2')](_0x0e90('0x3'),{'body':_0x5db873,'log':_0x0e90('0x3')});};exports[_0x0e90('0x4')]=function(_0x20f8e4,_0x30cc1f,_0x964455){return client['Request'](_0x0e90('0x5'),{'body':_0x20f8e4,'options':{'where':{'uniqueid':_0x30cc1f,'interface':_0x964455,'agentcomplete':!![]}},'log':_0x0e90('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 9124e52..b4fbe95 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 _0xa841=['format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','billableseconds','GetVoiceCallReports','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day'];(function(_0x5341d2,_0x2da6d6){var _0x3a4d6a=function(_0x254688){while(--_0x254688){_0x5341d2['push'](_0x5341d2['shift']());}};_0x3a4d6a(++_0x2da6d6);}(_0xa841,0x16f));var _0x1a84=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xa841[_0x1cc8fe];return _0x230054;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0x1a84('0x0'));var client=require(_0x1a84('0x1'));exports[_0x1a84('0x2')]=function(_0xc7b411){return client[_0x1a84('0x3')](_0x1a84('0x4'),{'body':_[_0x1a84('0x5')](_0xc7b411,{'source':_0xc7b411[_0x1a84('0x6')],'destinationcontext':_0xc7b411['context'],'callerid':_0xc7b411['callerid'],'amaflags':_0x1a84('0x7')}),'log':'CreateVoiceCallReport'});};exports[_0x1a84('0x8')]=function(){return function(){return client['Request'](_0x1a84('0x9'),{'options':{'where':{'type':[_0x1a84('0xa')],'createdAt':{'$between':[moment()[_0x1a84('0xb')](_0x1a84('0xc'))[_0x1a84('0xd')](_0x1a84('0xe')),moment()[_0x1a84('0xf')](_0x1a84('0xc'))[_0x1a84('0xd')](_0x1a84('0xe'))]}},'attributes':[_0x1a84('0x10'),_0x1a84('0x11'),'duration',_0x1a84('0x12')]},'log':_0x1a84('0x13')});};}; \ No newline at end of file +var _0xb83f=['type','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash','create','Request','merge','calleridnum','context','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day'];(function(_0x5d07ff,_0x1f976f){var _0x5226ad=function(_0x1653a4){while(--_0x1653a4){_0x5d07ff['push'](_0x5d07ff['shift']());}};_0x5226ad(++_0x1f976f);}(_0xb83f,0x169));var _0xfb83=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xb83f[_0x56482c];return _0x5aae7a;};'use strict';var moment=require(_0xfb83('0x0'));var util=require(_0xfb83('0x1'));var _=require(_0xfb83('0x2'));var client=require('../client');exports[_0xfb83('0x3')]=function(_0x39b931){return client[_0xfb83('0x4')]('CreateVoiceCallReport',{'body':_[_0xfb83('0x5')](_0x39b931,{'source':_0x39b931[_0xfb83('0x6')],'destinationcontext':_0x39b931[_0xfb83('0x7')],'callerid':_0x39b931['callerid'],'amaflags':_0xfb83('0x8')}),'log':_0xfb83('0x9')});};exports[_0xfb83('0xa')]=function(){return function(){return client[_0xfb83('0x4')](_0xfb83('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xfb83('0xc')]('day')[_0xfb83('0xd')](_0xfb83('0xe')),moment()[_0xfb83('0xf')](_0xfb83('0x10'))[_0xfb83('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xfb83('0x11'),_0xfb83('0x12'),'duration',_0xfb83('0x13')]},'log':_0xfb83('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 949781d..b2db6f2 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 _0x22f9=['create','Request','CreateVoiceDialReport','../client'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x22f9,0xc3));var _0x922f=function(_0x480190,_0x1caae1){_0x480190=_0x480190-0x0;var _0x331c2f=_0x22f9[_0x480190];return _0x331c2f;};'use strict';var client=require(_0x922f('0x0'));exports[_0x922f('0x1')]=function(_0x2e62e9){return client[_0x922f('0x2')](_0x922f('0x3'),{'body':_0x2e62e9,'log':_0x922f('0x3')});}; \ No newline at end of file +var _0xf17d=['CreateVoiceDialReport','../client','create','Request'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf17d,0x1a5));var _0xdf17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf17d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xdf17('0x0'));exports[_0xdf17('0x1')]=function(_0x427b7b){return client[_0xdf17('0x2')](_0xdf17('0x3'),{'body':_0x427b7b,'log':_0xdf17('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 7c0e113..9ff65ad 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 _0x3140=['getVoiceExtensions','Request','GetVoiceExtension','../client'];(function(_0x2f4b58,_0x2b3177){var _0x2791e3=function(_0x105acf){while(--_0x105acf){_0x2f4b58['push'](_0x2f4b58['shift']());}};_0x2791e3(++_0x2b3177);}(_0x3140,0xaf));var _0x0314=function(_0xe896bf,_0x4f8e5e){_0xe896bf=_0xe896bf-0x0;var _0x4c7a8a=_0x3140[_0xe896bf];return _0x4c7a8a;};'use strict';var client=require(_0x0314('0x0'));exports[_0x0314('0x1')]=function(){return function(){return client[_0x0314('0x2')](_0x0314('0x3'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x0314('0x1')});};}; \ No newline at end of file +var _0x9d9b=['exten','getVoiceExtensions','Request'];(function(_0x415260,_0x135fcb){var _0x490f21=function(_0x28d91c){while(--_0x28d91c){_0x415260['push'](_0x415260['shift']());}};_0x490f21(++_0x135fcb);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x2d34a8,_0x25ec1f){_0x2d34a8=_0x2d34a8-0x0;var _0x296432=_0x9d9b[_0x2d34a8];return _0x296432;};'use strict';var client=require('../client');exports[_0xb9d9('0x0')]=function(){return function(){return client[_0xb9d9('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xb9d9('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xb9d9('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index b8a3752..d380297 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 _0xcb5c=['dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','interval','getVoiceQueues','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel'];(function(_0x3363e7,_0x10a9f2){var _0x2e8449=function(_0x4d712e){while(--_0x4d712e){_0x3363e7['push'](_0x3363e7['shift']());}};_0x2e8449(++_0x10a9f2);}(_0xcb5c,0xe2));var _0xccb5=function(_0x1702e1,_0x5f09a1){_0x1702e1=_0x1702e1-0x0;var _0x44b6f1=_0xcb5c[_0x1702e1];return _0x44b6f1;};'use strict';var client=require('../client');exports[_0xccb5('0x0')]=function(){return function(){return client['Request'](_0xccb5('0x1'),{'options':{'raw':![],'attributes':['id',_0xccb5('0x2'),'acw',_0xccb5('0x3'),_0xccb5('0x4'),_0xccb5('0x5'),_0xccb5('0x6'),_0xccb5('0x7'),_0xccb5('0x8'),_0xccb5('0x9'),_0xccb5('0xa'),_0xccb5('0xb'),'dialPredictiveOptimization',_0xccb5('0xc'),_0xccb5('0xd'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0xccb5('0xe'),'dialQueueOptions',_0xccb5('0xf'),_0xccb5('0x10'),_0xccb5('0x11'),_0xccb5('0x12'),_0xccb5('0x13'),_0xccb5('0x14'),_0xccb5('0x15'),_0xccb5('0x16'),'dialGlobalMaxRetry',_0xccb5('0x17'),_0xccb5('0x18'),_0xccb5('0x19'),_0xccb5('0x1a'),_0xccb5('0x1b'),_0xccb5('0x1c'),_0xccb5('0x1d'),'dialAMDAfterGreetingSilence',_0xccb5('0x1e'),_0xccb5('0x1f'),_0xccb5('0x20'),'dialAMDMaximumNumberOfWords',_0xccb5('0x21'),'dialAMDMaximumWordLength','timeout',_0xccb5('0x22'),_0xccb5('0x23'),_0xccb5('0x24'),_0xccb5('0x25'),_0xccb5('0x26'),'dialQueueProject2',_0xccb5('0x5'),'strategy',_0xccb5('0x27'),_0xccb5('0x28'),_0xccb5('0x29'),_0xccb5('0x2a'),_0xccb5('0x2b'),_0xccb5('0x2c'),'dialAbandonedMaxRetry',_0xccb5('0x2d'),_0xccb5('0x2e'),_0xccb5('0x2f'),_0xccb5('0x30'),_0xccb5('0x31'),'mandatoryDisposition',_0xccb5('0x32'),_0xccb5('0x33')],'include':[{'model':_0xccb5('0x34'),'as':_0xccb5('0x34'),'attributes':['id',_0xccb5('0x2'),_0xccb5('0x35'),_0xccb5('0x36')]},{'model':'Pause','as':_0xccb5('0x37'),'attributes':['id',_0xccb5('0x2')]},{'model':_0xccb5('0x34'),'as':_0xccb5('0x38'),'attributes':['id',_0xccb5('0x2'),_0xccb5('0x35'),'active']},{'model':_0xccb5('0x39'),'as':_0xccb5('0x39'),'attributes':['id',_0xccb5('0x2')],'include':[{'model':_0xccb5('0x39'),'as':'Intervals','attributes':['id',_0xccb5('0x2'),_0xccb5('0x3a')]}]}]},'log':_0xccb5('0x0')});};}; \ No newline at end of file +var _0xd963=['dialRecallInQueue','dialOrderByScheduledAt','dialQueueProject2','monitor_format','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','name','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','timeout','dialRecallMeTimeout'];(function(_0x55a164,_0x271d7c){var _0x6b0ff2=function(_0x2b8e76){while(--_0x2b8e76){_0x55a164['push'](_0x55a164['shift']());}};_0x6b0ff2(++_0x271d7c);}(_0xd963,0x137));var _0x3d96=function(_0x4554c1,_0x589649){_0x4554c1=_0x4554c1-0x0;var _0x1dfa5c=_0xd963[_0x4554c1];return _0x1dfa5c;};'use strict';var client=require(_0x3d96('0x0'));exports[_0x3d96('0x1')]=function(){return function(){return client[_0x3d96('0x2')](_0x3d96('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x3d96('0x4'),_0x3d96('0x5'),'autopause','monitor_format','type',_0x3d96('0x6'),_0x3d96('0x7'),_0x3d96('0x8'),_0x3d96('0x9'),_0x3d96('0xa'),_0x3d96('0xb'),'dialPredictiveOptimizationPercentage',_0x3d96('0xc'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x3d96('0xd'),_0x3d96('0xe'),_0x3d96('0xf'),'dialQueueProject','dialCongestionMaxRetry',_0x3d96('0x10'),_0x3d96('0x11'),_0x3d96('0x12'),_0x3d96('0x13'),_0x3d96('0x14'),'dialGlobalMaxRetry',_0x3d96('0x15'),'dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive',_0x3d96('0x16'),_0x3d96('0x17'),_0x3d96('0x18'),_0x3d96('0x19'),_0x3d96('0x1a'),_0x3d96('0x1b'),_0x3d96('0x1c'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength',_0x3d96('0x1d'),_0x3d96('0x1e'),_0x3d96('0x1f'),_0x3d96('0x20'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x3d96('0x21'),_0x3d96('0x22'),'strategy',_0x3d96('0x23'),_0x3d96('0x24'),_0x3d96('0x25'),_0x3d96('0x26'),'dialDropMaxRetry',_0x3d96('0x27'),_0x3d96('0x28'),'dialAbandonedRetryFrequency',_0x3d96('0x29'),_0x3d96('0x2a'),_0x3d96('0x2b'),_0x3d96('0x2c'),_0x3d96('0x2d'),'dialPredictiveIntervalMaxThreshold',_0x3d96('0x2e')],'include':[{'model':_0x3d96('0x2f'),'as':_0x3d96('0x2f'),'attributes':['id','name',_0x3d96('0x30'),_0x3d96('0x31')]},{'model':_0x3d96('0x32'),'as':_0x3d96('0x33'),'attributes':['id',_0x3d96('0x34')]},{'model':_0x3d96('0x2f'),'as':_0x3d96('0x35'),'attributes':['id',_0x3d96('0x34'),_0x3d96('0x30'),_0x3d96('0x31')]},{'model':_0x3d96('0x36'),'as':_0x3d96('0x36'),'attributes':['id',_0x3d96('0x34')],'include':[{'model':_0x3d96('0x36'),'as':_0x3d96('0x37'),'attributes':['id',_0x3d96('0x34'),_0x3d96('0x38')]}]}]},'log':_0x3d96('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index a56611d..5b21abc 100644 --- a/server/services/ami/rpc/voiceQueueReport.js +++ b/server/services/ami/rpc/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x5016a3,_0x2a0a58){var _0x14d27f=function(_0x443366){while(--_0x443366){_0x5016a3['push'](_0x5016a3['shift']());}};_0x14d27f(++_0x2a0a58);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x2af9d3,_0x26fa40){var _0x5cc532=function(_0x27ac52){while(--_0x27ac52){_0x2af9d3['push'](_0x2af9d3['shift']());}};_0x5cc532(++_0x26fa40);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 2db9cfd..5186d82 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 _0xad0e=['getVoiceQueueRtPauses','../client','GetVoiceQueueRtPauses'];(function(_0x5876bf,_0xad1e87){var _0x5eef13=function(_0x3c0595){while(--_0x3c0595){_0x5876bf['push'](_0x5876bf['shift']());}};_0x5eef13(++_0xad1e87);}(_0xad0e,0xa6));var _0xead0=function(_0x298e45,_0x105e71){_0x298e45=_0x298e45-0x0;var _0x400535=_0xad0e[_0x298e45];return _0x400535;};'use strict';var client=require(_0xead0('0x0'));exports['getVoiceQueueRtPauses']=function(_0x2241c3){return function(){return client['Request'](_0xead0('0x1'),{'options':{'where':{'VoiceQueueId':_0x2241c3,'paused':!![]},'raw':!![]},'log':_0xead0('0x2')});};}; \ No newline at end of file +var _0xfd46=['getVoiceQueueRtPauses','../client'];(function(_0x204e63,_0x1f5d01){var _0x3a9cff=function(_0x2e4549){while(--_0x2e4549){_0x204e63['push'](_0x204e63['shift']());}};_0x3a9cff(++_0x1f5d01);}(_0xfd46,0x1e5));var _0x6fd4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xfd46[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0x6fd4('0x0'));exports[_0x6fd4('0x1')]=function(_0x2e2ff9){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x2e2ff9,'paused':!![]},'raw':!![]},'log':_0x6fd4('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 5d01c78..a505e09 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x2d2bc0,_0x2a4f74){var _0x294fab=function(_0x29e6cc){while(--_0x29e6cc){_0x2d2bc0['push'](_0x2d2bc0['shift']());}};_0x294fab(++_0x2a4f74);}(_0x7a54,0x106));var _0x47a5=function(_0x5aa507,_0x1a8c7a){_0x5aa507=_0x5aa507-0x0;var _0x1f1a62=_0x7a54[_0x5aa507];return _0x1f1a62;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x573b2e,_0x12c594){var _0x1d170c=function(_0x533942){while(--_0x533942){_0x573b2e['push'](_0x573b2e['shift']());}};_0x1d170c(++_0x12c594);}(_0x7a54,0x106));var _0x47a5=function(_0x70fdba,_0x1987b7){_0x70fdba=_0x70fdba-0x0;var _0x3dd532=_0x7a54[_0x70fdba];return _0x3dd532;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 1bb6fd1..6de3a30 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 _0xd704=['secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transfererexten','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname'];(function(_0x5093e9,_0x5154d0){var _0x4c9a22=function(_0x15176d){while(--_0x15176d){_0x5093e9['push'](_0x5093e9['shift']());}};_0x4c9a22(++_0x5154d0);}(_0xd704,0x11c));var _0x4d70=function(_0x586e9d,_0x3f5ffe){_0x586e9d=_0x586e9d-0x0;var _0x45b5c7=_0xd704[_0x586e9d];return _0x45b5c7;};'use strict';var client=require('../client');exports[_0x4d70('0x0')]={};exports['blindTransfer']=function(_0x32fa43){return client[_0x4d70('0x1')](_0x4d70('0x2'),{'body':{'result':_0x32fa43['result'],'transfererchannel':_0x32fa43[_0x4d70('0x3')],'transferercalleridnum':_0x32fa43[_0x4d70('0x4')],'transferercalleridname':_0x32fa43[_0x4d70('0x5')],'transfererconnectedlinenum':_0x32fa43['transfererconnectedlinenum'],'transfererconnectedlinename':_0x32fa43[_0x4d70('0x6')],'transfereraccountcode':_0x32fa43[_0x4d70('0x7')],'transferercontext':_0x32fa43['transferercontext'],'transfererexten':_0x32fa43[_0x4d70('0x8')],'transfererlinkedid':_0x32fa43['transfererlinkedid'],'transfereechannel':_0x32fa43[_0x4d70('0x9')],'transfereecalleridnum':_0x32fa43[_0x4d70('0xa')],'transfereecalleridname':_0x32fa43['transfereecalleridname'],'transfereeconnectedlinenum':_0x32fa43[_0x4d70('0xb')],'transfereeconnectedlinename':_0x32fa43[_0x4d70('0xc')],'transfereeaccountcode':_0x32fa43[_0x4d70('0xd')],'transfereecontext':_0x32fa43[_0x4d70('0xe')],'transfereeexten':_0x32fa43['transfereeexten'],'transfereelinkedid':_0x32fa43[_0x4d70('0xf')],'isexternal':_0x32fa43[_0x4d70('0x10')],'context':_0x32fa43['context'],'extension':_0x32fa43['extension'],'type':_0x4d70('0x11')},'log':_0x4d70('0x2')});};exports[_0x4d70('0x12')]=function(_0x57ec4d){return client['Request'](_0x4d70('0x2'),{'body':{'result':_0x57ec4d['result'],'transfererchannel':_0x57ec4d[_0x4d70('0x13')],'transferercalleridnum':_0x57ec4d[_0x4d70('0x14')],'transferercalleridname':_0x57ec4d[_0x4d70('0x15')],'transfererconnectedlinenum':_0x57ec4d[_0x4d70('0x16')],'transfererconnectedlinename':_0x57ec4d[_0x4d70('0x17')],'transfereraccountcode':_0x57ec4d['origtransfereraccountcode'],'transferercontext':_0x57ec4d[_0x4d70('0x18')],'transfererexten':_0x57ec4d['secondtransfererexten'],'transfererlinkedid':_0x57ec4d[_0x4d70('0x19')],'transfereechannel':_0x57ec4d['transfertargetchannel'],'transfereecalleridnum':_0x57ec4d['transfertargetcalleridnum'],'transfereecalleridname':_0x57ec4d[_0x4d70('0x1a')],'transfereeconnectedlinenum':_0x57ec4d[_0x4d70('0x1b')],'transfereeconnectedlinename':_0x57ec4d[_0x4d70('0x1c')],'transfereeaccountcode':_0x57ec4d['transfertargetaccountcode'],'transfereecontext':_0x57ec4d['transfertargetcontext'],'transfereeexten':_0x57ec4d[_0x4d70('0x1d')],'transfereelinkedid':_0x57ec4d[_0x4d70('0x1e')],'isexternal':_0x57ec4d[_0x4d70('0x10')],'context':_0x57ec4d[_0x4d70('0x1f')],'extension':_0x57ec4d[_0x4d70('0x20')],'type':_0x4d70('0x21')},'log':_0x4d70('0x2')});}; \ No newline at end of file +var _0x9c98=['transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridname','transfereeconnectedlinenum','transfereecontext','isexternal','context','extension','blind','attendedTransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid'];(function(_0x27dc44,_0x577382){var _0x53c90a=function(_0x1afa34){while(--_0x1afa34){_0x27dc44['push'](_0x27dc44['shift']());}};_0x53c90a(++_0x577382);}(_0x9c98,0x155));var _0x89c9=function(_0x15745b,_0x8ee239){_0x15745b=_0x15745b-0x0;var _0x20b0cf=_0x9c98[_0x15745b];return _0x20b0cf;};'use strict';var client=require(_0x89c9('0x0'));exports[_0x89c9('0x1')]={};exports[_0x89c9('0x2')]=function(_0x420782){return client[_0x89c9('0x3')](_0x89c9('0x4'),{'body':{'result':_0x420782[_0x89c9('0x5')],'transfererchannel':_0x420782[_0x89c9('0x6')],'transferercalleridnum':_0x420782[_0x89c9('0x7')],'transferercalleridname':_0x420782[_0x89c9('0x8')],'transfererconnectedlinenum':_0x420782['transfererconnectedlinenum'],'transfererconnectedlinename':_0x420782[_0x89c9('0x9')],'transfereraccountcode':_0x420782[_0x89c9('0xa')],'transferercontext':_0x420782[_0x89c9('0xb')],'transfererexten':_0x420782[_0x89c9('0xc')],'transfererlinkedid':_0x420782[_0x89c9('0xd')],'transfereechannel':_0x420782['transfereechannel'],'transfereecalleridnum':_0x420782['transfereecalleridnum'],'transfereecalleridname':_0x420782[_0x89c9('0xe')],'transfereeconnectedlinenum':_0x420782[_0x89c9('0xf')],'transfereeconnectedlinename':_0x420782['transfereeconnectedlinename'],'transfereeaccountcode':_0x420782['transfereeaccountcode'],'transfereecontext':_0x420782[_0x89c9('0x10')],'transfereeexten':_0x420782['transfereeexten'],'transfereelinkedid':_0x420782['transfereelinkedid'],'isexternal':_0x420782[_0x89c9('0x11')],'context':_0x420782[_0x89c9('0x12')],'extension':_0x420782[_0x89c9('0x13')],'type':_0x89c9('0x14')},'log':_0x89c9('0x4')});};exports[_0x89c9('0x15')]=function(_0x1f788b){return client[_0x89c9('0x3')](_0x89c9('0x4'),{'body':{'result':_0x1f788b[_0x89c9('0x5')],'transfererchannel':_0x1f788b['origtransfererchannel'],'transferercalleridnum':_0x1f788b[_0x89c9('0x16')],'transferercalleridname':_0x1f788b[_0x89c9('0x17')],'transfererconnectedlinenum':_0x1f788b[_0x89c9('0x18')],'transfererconnectedlinename':_0x1f788b[_0x89c9('0x19')],'transfereraccountcode':_0x1f788b[_0x89c9('0x1a')],'transferercontext':_0x1f788b['secondtransferercontext'],'transfererexten':_0x1f788b[_0x89c9('0x1b')],'transfererlinkedid':_0x1f788b[_0x89c9('0x1c')],'transfereechannel':_0x1f788b[_0x89c9('0x1d')],'transfereecalleridnum':_0x1f788b['transfertargetcalleridnum'],'transfereecalleridname':_0x1f788b['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1f788b[_0x89c9('0x1e')],'transfereeconnectedlinename':_0x1f788b[_0x89c9('0x1f')],'transfereeaccountcode':_0x1f788b[_0x89c9('0x20')],'transfereecontext':_0x1f788b['transfertargetcontext'],'transfereeexten':_0x1f788b[_0x89c9('0x21')],'transfereelinkedid':_0x1f788b['transfertargetlinkedid'],'isexternal':_0x1f788b[_0x89c9('0x11')],'context':_0x1f788b[_0x89c9('0x22')],'extension':_0x1f788b[_0x89c9('0x23')],'type':_0x89c9('0x24')},'log':_0x89c9('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index be4198c..4eb2b98 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 _0xba18=['isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','toLowerCase','Channel\x20doesn\x27t\x20exist','voicechannel','resolve','StopMixMonitor','destinationchannel','status','stop','%s.%s','wav','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','trunks','outboundChannels','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','listen','%s/%s','SIP','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','asterisk','command','Command','content','catch','message','voiceQueues','hasOwnProperty','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','find','omit','undefined','values','channels','username','map','channel','format','filename','uniqueid','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/'];(function(_0x326b2e,_0x404386){var _0x105f56=function(_0x81992a){while(--_0x81992a){_0x326b2e['push'](_0x326b2e['shift']());}};_0x105f56(++_0x404386);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ba1('0x0'));var util=require(_0x8ba1('0x1'));var jayson=require(_0x8ba1('0x2'));var schema=require(_0x8ba1('0x3'));var BPromise=require(_0x8ba1('0x4'));var moment=require(_0x8ba1('0x5'));var config=require(_0x8ba1('0x6'));var properties=require(_0x8ba1('0x7'));var ami=require('../ami');exports[_0x8ba1('0x8')]=function(_0x3136d7,_0x2db11a,_0x2a9dab){return new BPromise(function(_0x3b107c,_0x2ffa15){var _0x51a988={'QueuePause':function(_0x3a87eb){return new Promise(function(_0x3d1fe7,_0x4dc6c4){var _0x49709e=util['format'](_0x8ba1('0x9'),_0x8ba1('0xa'),_0x3a87eb['name']);if(_0x3136d7[_0x8ba1('0xb')]&&_0x3136d7[_0x8ba1('0xb')][_0x49709e]&&_0x3136d7[_0x8ba1('0xb')][_0x49709e][_0x8ba1('0xc')]){_0x3136d7[_0x8ba1('0xb')][_0x49709e]['updateAcw']();}if(_0x3136d7[_0x8ba1('0xd')][_0x49709e]){_0x3136d7[_0x8ba1('0xd')][_0x49709e][_0x8ba1('0xe')]({'statePause':_0x3a87eb[_0x8ba1('0xf')]?!![]:![]});}_0x3d1fe7({'code':0xc8,'message':_0x8ba1('0x10')});});},'Reload':function(_0x229748){var _0x58e32b=this;return new Promise(function(_0x108541,_0x44a40a){if(ami[_0x8ba1('0x11')]()==![]){return _0x44a40a(_0x58e32b[_0x8ba1('0x12')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x8ba1('0x13')][_0x8ba1('0x14')]('\x20')));}_0x229748=_[_0x8ba1('0x15')](_0x229748,_[_0x8ba1('0x16')](properties[_0x8ba1('0x17')]));_0x229748[_0x8ba1('0x18')]=_0x8ba1('0x19');return ami[_0x8ba1('0x1a')](_0x229748)[_0x8ba1('0x1b')](function(_0x245929){_0x108541({'code':0xc8,'message':_0x245929['message']});})['catch'](function(_0x1a48fa){_0x44a40a(_0x58e32b[_0x8ba1('0x12')](0x1f5,_0x1a48fa['message']));});});},'Command':function(_0xd8bda0){var _0x2e5fba=this;return new Promise(function(_0x3fadfc,_0x3355c8){if(ami[_0x8ba1('0x11')]()==![]){return _0x3355c8(_0x2e5fba[_0x8ba1('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x8ba1('0x1c')]['username'],_0x8ba1('0x13')][_0x8ba1('0x14')]('\x20')));}_0xd8bda0=_[_0x8ba1('0x15')](_0xd8bda0,_0x8ba1('0x1d'));_0xd8bda0['action']=_0x8ba1('0x1e');return ami[_0x8ba1('0x1a')](_0xd8bda0)[_0x8ba1('0x1b')](function(_0x38a2de){_0x3fadfc({'code':0xc8,'message':_0x38a2de[_0x8ba1('0x1f')]});})[_0x8ba1('0x20')](function(_0x845108){_0x3355c8(_0x2e5fba[_0x8ba1('0x12')](0x1f5,_0x845108[_0x8ba1('0x21')]));});});},'VoiceQueues':function(_0x31a38c){return new Promise(function(_0x3b205c,_0x550d33){var _0x5c924e=[];for(var _0x41c2bb in _0x3136d7[_0x8ba1('0x22')]){if(_0x3136d7['voiceQueues'][_0x8ba1('0x23')](_0x41c2bb)){var _0xef508d=_0x3136d7[_0x8ba1('0x22')][_0x41c2bb];var _0x326460={'id':_0xef508d['id'],'name':_0xef508d[_0x8ba1('0x24')],'strategy':_0xef508d[_0x8ba1('0x25')],'answered':_0xef508d[_0x8ba1('0x26')],'available':_0xef508d[_0x8ba1('0x27')],'loggedIn':_0xef508d[_0x8ba1('0x28')],'pTalking':_0xef508d[_0x8ba1('0x29')],'sumBillable':_0xef508d[_0x8ba1('0x2a')],'sumDuration':_0xef508d[_0x8ba1('0x2b')],'sumHoldTime':_0xef508d[_0x8ba1('0x2c')]||0x0,'talking':_0xef508d[_0x8ba1('0x2d')],'total':_0xef508d['total'],'type':_0xef508d[_0x8ba1('0x2e')],'unmanaged':_0xef508d[_0x8ba1('0x2f')],'abandoned':_0xef508d[_0x8ba1('0x30')],'waiting':_0xef508d[_0x8ba1('0x31')],'loggedInDb':_0xef508d[_0x8ba1('0x32')]};if(_0xef508d[_0x8ba1('0x2e')]==='outbound'){_0x326460[_0x8ba1('0x33')]=_0xef508d[_0x8ba1('0x33')];_0x326460['dialMethod']=_0xef508d[_0x8ba1('0x34')];_0x326460['dialOriginateCallerIdName']=_0xef508d[_0x8ba1('0x35')];_0x326460[_0x8ba1('0x36')]=_0xef508d['dialOriginateCallerIdNumber'];_0x326460[_0x8ba1('0x37')]=_0xef508d[_0x8ba1('0x37')];_0x326460[_0x8ba1('0x38')]=_0xef508d[_0x8ba1('0x38')];_0x326460[_0x8ba1('0x39')]=_0xef508d['temp'];_0x326460[_0x8ba1('0x3a')]=_0xef508d[_0x8ba1('0x3a')];_0x326460[_0x8ba1('0x3b')]=_0xef508d[_0x8ba1('0x3b')];_0x326460[_0x8ba1('0x3c')]=_0xef508d[_0x8ba1('0x3c')];_0x326460[_0x8ba1('0x3d')]=_0xef508d[_0x8ba1('0x3d')];_0x326460['outboundCongestionCallsDay']=_0xef508d[_0x8ba1('0x3e')];_0x326460[_0x8ba1('0x3f')]=_0xef508d[_0x8ba1('0x3f')];_0x326460[_0x8ba1('0x40')]=_0xef508d[_0x8ba1('0x40')];_0x326460[_0x8ba1('0x41')]=_0xef508d[_0x8ba1('0x41')];_0x326460[_0x8ba1('0x42')]=_0xef508d[_0x8ba1('0x42')];_0x326460[_0x8ba1('0x43')]=_0xef508d['outboundNoSuchCallsDay'];_0x326460[_0x8ba1('0x44')]=_0xef508d[_0x8ba1('0x44')];_0x326460[_0x8ba1('0x45')]=_0xef508d[_0x8ba1('0x45')];_0x326460[_0x8ba1('0x46')]=_0xef508d[_0x8ba1('0x46')];_0x326460[_0x8ba1('0x47')]=_0xef508d[_0x8ba1('0x47')];_0x326460[_0x8ba1('0x48')]=_0xef508d[_0x8ba1('0x48')];_0x326460['predictiveIntervalAvgHoldtime']=_0xef508d['predictiveIntervalAvgHoldtime'];_0x326460[_0x8ba1('0x49')]=_0xef508d[_0x8ba1('0x49')];_0x326460[_0x8ba1('0x4a')]=_0xef508d[_0x8ba1('0x4a')];_0x326460[_0x8ba1('0x4b')]=_0xef508d[_0x8ba1('0x4b')];_0x326460[_0x8ba1('0x4c')]=_0xef508d[_0x8ba1('0x4c')];_0x326460[_0x8ba1('0x4d')]=_0xef508d[_0x8ba1('0x4d')];_0x326460[_0x8ba1('0x4e')]=_0xef508d[_0x8ba1('0x4e')];_0x326460[_0x8ba1('0x4f')]=_0xef508d[_0x8ba1('0x4f')];_0x326460['predictiveIntervalPauses']=_0xef508d[_0x8ba1('0x50')];_0x326460[_0x8ba1('0x51')]=_0xef508d[_0x8ba1('0x51')];_0x326460[_0x8ba1('0x52')]=_0xef508d['predictiveIntervalTotalCalls'];_0x326460['message']=_0xef508d[_0x8ba1('0x21')];_0x326460[_0x8ba1('0x53')]=_0xef508d[_0x8ba1('0x53')];_0x326460[_0x8ba1('0x54')]=_0xef508d[_0x8ba1('0x54')];_0x326460['erlangCallToSecond']=_0xef508d[_0x8ba1('0x55')];_0x326460[_0x8ba1('0x56')]=_0xef508d[_0x8ba1('0x56')];_0x326460['erlangBusyFactor']=_0xef508d[_0x8ba1('0x57')];_0x326460[_0x8ba1('0x58')]=_0xef508d[_0x8ba1('0x58')];_0x326460[_0x8ba1('0x59')]=_0xef508d[_0x8ba1('0x59')];}if(_0xef508d[_0x8ba1('0x5a')]){_0x326460['Trunk']={'id':_0xef508d[_0x8ba1('0x5a')]['id'],'name':_0xef508d['Trunk'][_0x8ba1('0x24')],'active':_0xef508d[_0x8ba1('0x5a')][_0x8ba1('0x5b')],'callerid':_0xef508d[_0x8ba1('0x5a')][_0x8ba1('0x5c')]};}if(_0xef508d[_0x8ba1('0x5d')]){_0x326460['Interval']={'id':_0xef508d[_0x8ba1('0x5d')]['id'],'name':_0xef508d[_0x8ba1('0x5d')]['name']};}_0x5c924e['push'](_0x326460);}}_0x3b205c({'count':_0x5c924e[_0x8ba1('0x5e')],'rows':_0x5c924e});});},'UpdateVoiceQueue':function(_0x3e285a){return new Promise(function(_0x129207,_0x12e53e){var _0x120b36=_[_0x8ba1('0x5f')](_0x3136d7[_0x8ba1('0x22')],{'id':parseInt(_0x3e285a['id'])});var _0x2061df=_[_0x8ba1('0x60')](_0x3e285a,['id']);if(_0x120b36){for(var _0x195b8e in _0x2061df){if(typeof _0x2061df[_0x195b8e]!==_0x8ba1('0x61')&&typeof _0x120b36[_0x195b8e]!==_0x8ba1('0x61')){_0x120b36[_0x195b8e]=_0x2061df[_0x195b8e];}}_0x129207(_0x120b36);}else{_0x12e53e();}});},'VoiceChannels':function(_0x2507d5){return new Promise(function(_0x5dcc29,_0x2d37c3){var _0x3bb667=_[_0x8ba1('0x62')](_0x3136d7[_0x8ba1('0x63')]);_0x5dcc29({'count':_0x3bb667[_0x8ba1('0x5e')],'rows':_0x3bb667});});},'VoiceChannelMixMonitor':function(_0x1062e3){var _0x353eef=this;return new Promise(function(_0x1ff2a8,_0x475311){if(ami[_0x8ba1('0x11')]()==![]){return _0x475311(_0x353eef[_0x8ba1('0x12')](0x1f4,[config[_0x8ba1('0x1c')]['ip'],config[_0x8ba1('0x1c')][_0x8ba1('0x64')],'ami\x20disconnected'][_0x8ba1('0x14')]('\x20')));}var _0x40a5cd=schema(properties['voicechannel'])[_0x8ba1('0x3')](_0x1062e3);if(_0x40a5cd[_0x8ba1('0x5e')]>0x0){return _0x475311(_0x353eef[_0x8ba1('0x12')](0x1f4,_[_0x8ba1('0x65')](_0x40a5cd,_0x8ba1('0x21'))['join'](',\x20')));}var _0x4a058f=_[_0x8ba1('0x5f')](_0x3136d7[_0x8ba1('0x63')],{'uniqueid':_0x1062e3['uniqueid']});if(_0x4a058f&&_0x4a058f[_0x8ba1('0x66')]){var _0x83a130=util[_0x8ba1('0x67')]('%s.%s',_0x1062e3[_0x8ba1('0x68')]||_0x1062e3[_0x8ba1('0x69')],_0x1062e3[_0x8ba1('0x67')]||'wav');return ami[_0x8ba1('0x1a')]({'action':_0x8ba1('0x6a'),'channel':_0x4a058f[_0x8ba1('0x66')],'file':_0x83a130,'options':_0x8ba1('0x6b')})['then'](function(_0x36907d){var _0x418279=_[_0x8ba1('0x5f')](_0x4a058f[_0x8ba1('0x6c')],{'filename':_0x8ba1('0x6d')+_0x83a130['toLowerCase']()});if(_[_0x8ba1('0x6e')](_0x418279)){_0x4a058f[_0x8ba1('0x6c')][_0x8ba1('0x6f')]({'filename':_0x8ba1('0x6d')+_0x83a130['toLowerCase'](),'createdAt':moment()[_0x8ba1('0x67')](_0x8ba1('0x70')),'mixmonitorid':_0x36907d[_0x8ba1('0x71')],'status':_0x8ba1('0x72')});}else{_0x418279[_0x8ba1('0x71')]=_0x36907d[_0x8ba1('0x71')];_0x418279['status']=_0x8ba1('0x72');}_0x1ff2a8({'code':0xc8,'message':[_0x1062e3['uniqueid'],'MixMonitor\x20Success',_0x36907d[_0x8ba1('0x71')]]['join']('\x20'),'mixmonitorid':_0x36907d[_0x8ba1('0x71')]});})[_0x8ba1('0x20')](function(_0x5b9e3c){_0x475311(_0x353eef[_0x8ba1('0x12')](0x1f5,[_0x1062e3['uniqueid'],_0x5b9e3c['message'][_0x8ba1('0x73')]()]['join']('\x20')));});}else{return _0x475311(_0x353eef[_0x8ba1('0x12')](0x1f5,_0x8ba1('0x74')));}});},'VoiceChannelStopMixMonitor':function(_0x28cada){var _0x1a73fc=this;return new Promise(function(_0xc0550b,_0x3766d2){if(ami['isConnected']()==![]){return _0x3766d2(_0x1a73fc[_0x8ba1('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x8ba1('0x1c')]['username'],_0x8ba1('0x13')]['join']('\x20')));}var _0x1a3d6e=schema(properties[_0x8ba1('0x75')])[_0x8ba1('0x3')](_0x28cada);if(_0x1a3d6e[_0x8ba1('0x5e')]>0x0){return _0x3766d2(_0x1a73fc[_0x8ba1('0x12')](0x1f4,_['map'](_0x1a3d6e,'message')['join'](',\x20')));}var _0x52a539=_[_0x8ba1('0x5f')](_0x3136d7[_0x8ba1('0x63')],{'uniqueid':_0x28cada[_0x8ba1('0x69')]});if(_0x52a539){return BPromise[_0x8ba1('0x76')]()['then'](function(){if(_0x52a539[_0x8ba1('0x66')]){return ami[_0x8ba1('0x1a')]({'action':_0x8ba1('0x77'),'channel':_0x52a539[_0x8ba1('0x66')],'mixmonitorid':_0x28cada['mixmonitorid']})['catch'](function(_0x5592fb){});}})[_0x8ba1('0x1b')](function(){if(_0x52a539['destinationchannel']){return ami[_0x8ba1('0x1a')]({'action':_0x8ba1('0x77'),'channel':_0x52a539[_0x8ba1('0x78')],'mixmonitorid':_0x28cada['mixmonitorid']})[_0x8ba1('0x20')](function(_0x494603){});}})[_0x8ba1('0x1b')](function(_0x26bb89){var _0x2389d5=_[_0x8ba1('0x5f')](_0x52a539[_0x8ba1('0x6c')],{'mixmonitorid':_0x28cada[_0x8ba1('0x71')]});if(_0x2389d5){_0x2389d5[_0x8ba1('0x79')]=_0x8ba1('0x7a');}})[_0x8ba1('0x1b')](function(){var _0x503fab=util[_0x8ba1('0x67')](_0x8ba1('0x7b'),_0x28cada[_0x8ba1('0x68')]||_0x28cada[_0x8ba1('0x69')],_0x28cada[_0x8ba1('0x67')]||_0x8ba1('0x7c'));var _0x4bd9ca=_[_0x8ba1('0x5f')](_0x52a539[_0x8ba1('0x6c')],{'filename':'/var/spool/asterisk/monitor/'+_0x503fab[_0x8ba1('0x73')]()});if(_0x4bd9ca){_0x4bd9ca[_0x8ba1('0x79')]=_0x8ba1('0x7a');}})[_0x8ba1('0x1b')](function(){_0xc0550b({'code':0xc8,'message':[_0x28cada['uniqueid'],_0x8ba1('0x7d')][_0x8ba1('0x14')]('\x20')});})[_0x8ba1('0x20')](function(_0x20b4da){_0x3766d2(_0x1a73fc[_0x8ba1('0x12')](0x1f5,[_0x28cada[_0x8ba1('0x69')],_0x20b4da['message'][_0x8ba1('0x73')]()][_0x8ba1('0x14')]('\x20')));});}else{return _0x3766d2(_0x1a73fc[_0x8ba1('0x12')](0x1f5,_0x8ba1('0x74')));}});},'VoiceQueuesChannels':function(_0x257c53){return new Promise(function(_0x23e8e2,_0x459356){var _0x54033e=_[_0x8ba1('0x62')](_0x3136d7[_0x8ba1('0x7e')]);_0x23e8e2({'count':_0x54033e[_0x8ba1('0x5e')],'rows':_0x54033e});});},'VoiceQueuesChannel':function(_0x3b4662){var _0x33dcac=this;return new Promise(function(_0x346511,_0x5a069e){var _0x184ac8=schema(properties['voicequeuechannel'])[_0x8ba1('0x3')](_0x3b4662);if(_0x184ac8['length']>0x0){return _0x5a069e(_0x33dcac['error'](0x1f4,_['map'](_0x184ac8,_0x8ba1('0x21'))[_0x8ba1('0x14')](',\x20')));}var _0x1336ad=_['find'](_0x3136d7[_0x8ba1('0x7e')],{'uniqueid':_0x3b4662[_0x8ba1('0x69')]});if(_0x1336ad){_0x346511(_0x1336ad);}else{return _0x5a069e(_0x33dcac[_0x8ba1('0x12')](0x1f5,_0x8ba1('0x74')));}});},'VoiceQueuesChannelHangup':function(_0xa72d96){var _0x9ad36=this;return new Promise(function(_0x29b2e2,_0xd85e6d){if(ami['isConnected']()==![]){return _0xd85e6d(_0x9ad36[_0x8ba1('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x8ba1('0x1c')][_0x8ba1('0x64')],_0x8ba1('0x13')]['join']('\x20')));}var _0xdb491a=schema(properties[_0x8ba1('0x7f')])[_0x8ba1('0x3')](_0xa72d96);if(_0xdb491a[_0x8ba1('0x5e')]>0x0){return _0xd85e6d(_0x9ad36[_0x8ba1('0x12')](0x1f4,_[_0x8ba1('0x65')](_0xdb491a,'message')[_0x8ba1('0x14')](',\x20')));}var _0x301505=_['find'](_0x3136d7[_0x8ba1('0x7e')],{'uniqueid':_0xa72d96[_0x8ba1('0x69')]});if(_0x301505&&_0x301505[_0x8ba1('0x66')]){return ami[_0x8ba1('0x1a')]({'action':_0x8ba1('0x80'),'channel':_0x301505['channel']})[_0x8ba1('0x1b')](function(_0x2293c6){_0x29b2e2({'code':0xc8,'message':[_0xa72d96[_0x8ba1('0x69')],_0x2293c6[_0x8ba1('0x21')][_0x8ba1('0x73')]()][_0x8ba1('0x14')]('\x20')});})[_0x8ba1('0x20')](function(_0x46c62c){_0xd85e6d(_0x9ad36['error'](0x1f5,[_0xa72d96[_0x8ba1('0x69')],_0x46c62c[_0x8ba1('0x21')]['toLowerCase']()][_0x8ba1('0x14')]('\x20')));});}else{return _0xd85e6d(_0x9ad36[_0x8ba1('0x12')](0x1f5,_0x8ba1('0x74')));}});},'VoiceQueuesChannelRedirect':function(_0x4f8d5c){var _0x1eddf1=this;return new Promise(function(_0x2ad3fa,_0x2065c3){if(ami['isConnected']()==![]){return _0x2065c3(_0x1eddf1[_0x8ba1('0x12')](0x1f4,[config[_0x8ba1('0x1c')]['ip'],config['asterisk'][_0x8ba1('0x64')],_0x8ba1('0x13')][_0x8ba1('0x14')]('\x20')));}var _0x3740df=schema(properties['voicequeuechannelredirect'])['validate'](_0x4f8d5c);if(_0x3740df[_0x8ba1('0x5e')]>0x0){return _0x2065c3(_0x1eddf1[_0x8ba1('0x12')](0x1f4,_[_0x8ba1('0x65')](_0x3740df,'message')[_0x8ba1('0x14')](',\x20')));}var _0x5ec079=_[_0x8ba1('0x5f')](_0x3136d7[_0x8ba1('0x7e')],{'uniqueid':_0x4f8d5c['uniqueid']});if(_0x5ec079&&_0x5ec079['channel']){return ami['Action']({'action':_0x8ba1('0x81'),'channel':_0x5ec079[_0x8ba1('0x66')],'exten':_0x4f8d5c[_0x8ba1('0x82')],'context':_0x4f8d5c[_0x8ba1('0x83')]||_0x5ec079[_0x8ba1('0x83')],'priority':0x1})[_0x8ba1('0x1b')](function(_0x122626){_0x2ad3fa({'code':0xc8,'message':[_0x4f8d5c[_0x8ba1('0x69')],_0x122626[_0x8ba1('0x21')]['toLowerCase']()]['join']('\x20')});})[_0x8ba1('0x20')](function(_0x33f2b8){_0x2065c3(_0x1eddf1['error'](0x1f5,[_0x4f8d5c[_0x8ba1('0x69')],_0x33f2b8['message'][_0x8ba1('0x73')]()][_0x8ba1('0x14')]('\x20')));});}else{return _0x2065c3(_0x1eddf1[_0x8ba1('0x12')](0x1f5,_0x8ba1('0x74')));}});},'Agents':function(_0x3cf705){return new Promise(function(_0x5ab322,_0x15d805){var _0x29a760=_['values'](_0x3136d7['agents']);_0x5ab322({'count':_0x29a760[_0x8ba1('0x5e')],'rows':_0x29a760});});},'Telephones':function(_0x478be7){return new Promise(function(_0x6f2a86,_0x2c9e1d){var _0x440c23=_[_0x8ba1('0x62')](_0x3136d7[_0x8ba1('0x84')]);_0x6f2a86({'count':_0x440c23[_0x8ba1('0x5e')],'rows':_0x440c23});});},'Trunks':function(_0x55eb67){return new Promise(function(_0x557243,_0x18fbab){var _0x42c7d7=_[_0x8ba1('0x62')](_0x3136d7[_0x8ba1('0x85')]);_0x557243({'count':_0x42c7d7[_0x8ba1('0x5e')],'rows':_0x42c7d7});});},'OutboundChannels':function(_0x3eda44){return new Promise(function(_0xe66471,_0x3a057d){var _0x444b18=_[_0x8ba1('0x62')](_0x3136d7[_0x8ba1('0x86')]);_0xe66471({'count':_0x444b18[_0x8ba1('0x5e')],'rows':_0x444b18});});},'Outbound':function(_0x31c241){return new Promise(function(_0x1a32bd,_0x1fbf0e){_0x1a32bd(_0x3136d7[_0x8ba1('0x87')]);});},'Campaigns':function(_0x5759b8){return new Promise(function(_0xa0e684,_0x1d4402){var _0x3c816d=_[_0x8ba1('0x62')](_0x3136d7[_0x8ba1('0x88')]);_0xa0e684({'count':_0x3c816d[_0x8ba1('0x5e')],'rows':_0x3c816d});});},'VoiceQueuesPreview':function(_0x345c09){var _0x239464=this;return new Promise(function(_0x491211,_0x1fce95){_0x2db11a[_0x8ba1('0x89')](_0x345c09['id'])[_0x8ba1('0x1b')](function(_0xabe196){_0x491211({'code':0xc8,'message':_0xabe196[_0x8ba1('0x21')]});})[_0x8ba1('0x20')](function(_0x42bfc7){_0x1fce95(_0x239464[_0x8ba1('0x12')](0x1f4,_0x42bfc7[_0x8ba1('0x21')]));});});},'EventManager':function(_0xb0e292){var _0x3771c2=this;return new Promise(function(_0x3a06da,_0x6ad4b1){if(!_0xb0e292[_0x8ba1('0x8a')]){return _0x6ad4b1(_0x3771c2[_0x8ba1('0x12')](0x1f4,_0x8ba1('0x8b')));}ami[_0x8ba1('0x8c')]('custom:'+_0xb0e292[_0x8ba1('0x8a')],_0xb0e292[_0x8ba1('0x21')]);_0x3a06da({'code':0xc8,'message':_0xb0e292});});},'FaxAccounts':function(_0x5c9a4e){return new Promise(function(_0x2ba9d9,_0x120f59){var _0x366a4a=_[_0x8ba1('0x62')](_0x3136d7[_0x8ba1('0x8d')]);_0x2ba9d9({'count':_0x366a4a[_0x8ba1('0x5e')],'rows':_0x366a4a});});},'SendFax':function(_0xef7b5d){var _0x4f1e28=this;return new Promise(function(_0x379718,_0x4f0091){_0x2a9dab[_0x8ba1('0x8e')](_0xef7b5d)[_0x8ba1('0x1b')](function(_0x2b821e){_0x379718({'code':0xc8,'message':_0x2b821e[_0x8ba1('0x21')]});})[_0x8ba1('0x20')](function(_0x4d4a11){_0x4f0091(_0x4f1e28['error'](0x1f4,_0x4d4a11[_0x8ba1('0x21')]));});});},'CheckAfterSend':function(_0x28e91a){var _0x4b4176=this;return new Promise(function(_0x43b490,_0x53fd78){_0x2a9dab[_0x8ba1('0x8f')](_0x28e91a)['then'](function(_0x3c0188){_0x43b490({'code':0xc8,'message':_0x3c0188[_0x8ba1('0x21')]});})[_0x8ba1('0x20')](function(_0x610717){_0x53fd78(_0x4b4176[_0x8ba1('0x12')](0x1f4,_0x610717[_0x8ba1('0x21')]));});});}};var _0x53e53b=jayson[_0x8ba1('0x90')](_0x51a988)[_0x8ba1('0x91')]();_0x53e53b['on'](_0x8ba1('0x12'),function(_0x2261be){return _0x2ffa15(_0x2261be);});_0x53e53b[_0x8ba1('0x8')](0x232a,_0x8ba1('0x92'),function(){console[_0x8ba1('0x93')](_0x8ba1('0x94'),0x232a);return _0x3b107c(_0x8ba1('0x95')+0x232a);});});}; \ No newline at end of file +var _0x77d4=['updateAcw','agents','updateStatusRealtime','isConnected','asterisk','ami\x20disconnected','join','pick','module','action','Reload','Action','catch','error','message','username','command','Command','then','content','voiceQueues','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','push','length','find','undefined','channels','voicechannel','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','filename','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannel','map','Hangup','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','validate','moment','../../../config/environment','listen','format','%s/%s','SIP','name','timers'];(function(_0x2835c4,_0x35567c){var _0x4b78e1=function(_0x55549a){while(--_0x55549a){_0x2835c4['push'](_0x2835c4['shift']());}};_0x4b78e1(++_0x35567c);}(_0x77d4,0x108));var _0x477d=function(_0x3d2f87,_0xa9f93a){_0x3d2f87=_0x3d2f87-0x0;var _0x45e78c=_0x77d4[_0x3d2f87];return _0x45e78c;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var jayson=require('jayson/promise');var schema=require(_0x477d('0x1'));var BPromise=require('bluebird');var moment=require(_0x477d('0x2'));var config=require(_0x477d('0x3'));var properties=require('../properties');var ami=require('../ami');exports[_0x477d('0x4')]=function(_0xf3cde0,_0x3d2f8d,_0x471fca){return new BPromise(function(_0x2545e5,_0x45ca2d){var _0x5153df={'QueuePause':function(_0x4f4fb4){return new Promise(function(_0x2dd5d2,_0x579859){var _0x5da70c=util[_0x477d('0x5')](_0x477d('0x6'),_0x477d('0x7'),_0x4f4fb4[_0x477d('0x8')]);if(_0xf3cde0[_0x477d('0x9')]&&_0xf3cde0['timers'][_0x5da70c]&&_0xf3cde0[_0x477d('0x9')][_0x5da70c]['timer']){_0xf3cde0[_0x477d('0x9')][_0x5da70c][_0x477d('0xa')]();}if(_0xf3cde0['agents'][_0x5da70c]){_0xf3cde0[_0x477d('0xb')][_0x5da70c][_0x477d('0xc')]({'statePause':_0x4f4fb4['pause']?!![]:![]});}_0x2dd5d2({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x6ff724){var _0x420779=this;return new Promise(function(_0x55bdfd,_0x290d46){if(ami[_0x477d('0xd')]()==![]){return _0x290d46(_0x420779['error'](0x1f4,[config['asterisk']['ip'],config[_0x477d('0xe')]['username'],_0x477d('0xf')][_0x477d('0x10')]('\x20')));}_0x6ff724=_[_0x477d('0x11')](_0x6ff724,_['keys'](properties[_0x477d('0x12')]));_0x6ff724[_0x477d('0x13')]=_0x477d('0x14');return ami[_0x477d('0x15')](_0x6ff724)['then'](function(_0x28f17a){_0x55bdfd({'code':0xc8,'message':_0x28f17a['message']});})[_0x477d('0x16')](function(_0x1399d7){_0x290d46(_0x420779[_0x477d('0x17')](0x1f5,_0x1399d7[_0x477d('0x18')]));});});},'Command':function(_0x37bcb3){var _0x2145ce=this;return new Promise(function(_0x5bea7e,_0x33db7a){if(ami['isConnected']()==![]){return _0x33db7a(_0x2145ce[_0x477d('0x17')](0x1f4,[config[_0x477d('0xe')]['ip'],config[_0x477d('0xe')][_0x477d('0x19')],_0x477d('0xf')][_0x477d('0x10')]('\x20')));}_0x37bcb3=_[_0x477d('0x11')](_0x37bcb3,_0x477d('0x1a'));_0x37bcb3[_0x477d('0x13')]=_0x477d('0x1b');return ami[_0x477d('0x15')](_0x37bcb3)[_0x477d('0x1c')](function(_0x43c845){_0x5bea7e({'code':0xc8,'message':_0x43c845[_0x477d('0x1d')]});})['catch'](function(_0x4481b0){_0x33db7a(_0x2145ce['error'](0x1f5,_0x4481b0[_0x477d('0x18')]));});});},'VoiceQueues':function(_0x2506d8){return new Promise(function(_0x26a4b2,_0x2287b4){var _0x4bb50e=[];for(var _0xd6dca5 in _0xf3cde0[_0x477d('0x1e')]){if(_0xf3cde0[_0x477d('0x1e')]['hasOwnProperty'](_0xd6dca5)){var _0x585648=_0xf3cde0[_0x477d('0x1e')][_0xd6dca5];var _0x3c6270={'id':_0x585648['id'],'name':_0x585648[_0x477d('0x8')],'strategy':_0x585648['strategy'],'answered':_0x585648[_0x477d('0x1f')],'available':_0x585648[_0x477d('0x20')],'loggedIn':_0x585648[_0x477d('0x21')],'pTalking':_0x585648[_0x477d('0x22')],'sumBillable':_0x585648[_0x477d('0x23')],'sumDuration':_0x585648['sumDuration'],'sumHoldTime':_0x585648[_0x477d('0x24')]||0x0,'talking':_0x585648[_0x477d('0x25')],'total':_0x585648[_0x477d('0x26')],'type':_0x585648[_0x477d('0x27')],'unmanaged':_0x585648[_0x477d('0x28')],'abandoned':_0x585648[_0x477d('0x29')],'waiting':_0x585648[_0x477d('0x2a')],'loggedInDb':_0x585648[_0x477d('0x2b')]};if(_0x585648[_0x477d('0x27')]===_0x477d('0x2c')){_0x3c6270[_0x477d('0x2d')]=_0x585648[_0x477d('0x2d')];_0x3c6270[_0x477d('0x2e')]=_0x585648[_0x477d('0x2e')];_0x3c6270[_0x477d('0x2f')]=_0x585648[_0x477d('0x2f')];_0x3c6270[_0x477d('0x30')]=_0x585648[_0x477d('0x30')];_0x3c6270[_0x477d('0x31')]=_0x585648[_0x477d('0x31')];_0x3c6270['dialPrefix']=_0x585648[_0x477d('0x32')];_0x3c6270['temp']=_0x585648[_0x477d('0x33')];_0x3c6270[_0x477d('0x34')]=_0x585648[_0x477d('0x34')];_0x3c6270['outboundAnswerCallsDay']=_0x585648[_0x477d('0x35')];_0x3c6270[_0x477d('0x36')]=_0x585648[_0x477d('0x36')];_0x3c6270[_0x477d('0x37')]=_0x585648[_0x477d('0x37')];_0x3c6270[_0x477d('0x38')]=_0x585648[_0x477d('0x38')];_0x3c6270[_0x477d('0x39')]=_0x585648[_0x477d('0x39')];_0x3c6270[_0x477d('0x3a')]=_0x585648['outboundDropCallsDayCallersExit'];_0x3c6270[_0x477d('0x3b')]=_0x585648[_0x477d('0x3b')];_0x3c6270[_0x477d('0x3c')]=_0x585648['outboundNoAnswerCallsDay'];_0x3c6270[_0x477d('0x3d')]=_0x585648[_0x477d('0x3d')];_0x3c6270[_0x477d('0x3e')]=_0x585648['outboundOriginateFailureCallsDay'];_0x3c6270['outboundReCallsDay']=_0x585648[_0x477d('0x3f')];_0x3c6270[_0x477d('0x40')]=_0x585648[_0x477d('0x40')];_0x3c6270[_0x477d('0x41')]=_0x585648[_0x477d('0x41')];_0x3c6270['predictiveIntervalAnsweredCalls']=_0x585648[_0x477d('0x42')];_0x3c6270['predictiveIntervalAvgHoldtime']=_0x585648[_0x477d('0x43')];_0x3c6270[_0x477d('0x44')]=_0x585648[_0x477d('0x44')];_0x3c6270['predictiveIntervalDroppedCallsCallersExit']=_0x585648['predictiveIntervalDroppedCallsCallersExit'];_0x3c6270[_0x477d('0x45')]=_0x585648[_0x477d('0x45')];_0x3c6270[_0x477d('0x46')]=_0x585648[_0x477d('0x46')];_0x3c6270['predictiveIntervalErlangCallsDroppedCalls']=_0x585648[_0x477d('0x47')];_0x3c6270[_0x477d('0x48')]=_0x585648[_0x477d('0x48')];_0x3c6270[_0x477d('0x49')]=_0x585648[_0x477d('0x49')];_0x3c6270['predictiveIntervalPauses']=_0x585648[_0x477d('0x4a')];_0x3c6270[_0x477d('0x4b')]=_0x585648['predictiveIntervalAvailable'];_0x3c6270[_0x477d('0x4c')]=_0x585648['predictiveIntervalTotalCalls'];_0x3c6270[_0x477d('0x18')]=_0x585648[_0x477d('0x18')];_0x3c6270[_0x477d('0x4d')]=_0x585648[_0x477d('0x4d')];_0x3c6270[_0x477d('0x4e')]=_0x585648[_0x477d('0x4e')];_0x3c6270[_0x477d('0x4f')]=_0x585648[_0x477d('0x4f')];_0x3c6270[_0x477d('0x50')]=_0x585648['erlangAbandonmentRate'];_0x3c6270[_0x477d('0x51')]=_0x585648[_0x477d('0x51')];_0x3c6270[_0x477d('0x52')]=_0x585648[_0x477d('0x52')];_0x3c6270['startProgressive']=_0x585648['startProgressive'];}if(_0x585648[_0x477d('0x53')]){_0x3c6270[_0x477d('0x53')]={'id':_0x585648['Trunk']['id'],'name':_0x585648[_0x477d('0x53')]['name'],'active':_0x585648['Trunk'][_0x477d('0x54')],'callerid':_0x585648[_0x477d('0x53')][_0x477d('0x55')]};}if(_0x585648[_0x477d('0x56')]){_0x3c6270[_0x477d('0x56')]={'id':_0x585648[_0x477d('0x56')]['id'],'name':_0x585648['Interval'][_0x477d('0x8')]};}_0x4bb50e[_0x477d('0x57')](_0x3c6270);}}_0x26a4b2({'count':_0x4bb50e[_0x477d('0x58')],'rows':_0x4bb50e});});},'UpdateVoiceQueue':function(_0x402b67){return new Promise(function(_0x2c723a,_0x4f80f3){var _0x4aad41=_[_0x477d('0x59')](_0xf3cde0[_0x477d('0x1e')],{'id':parseInt(_0x402b67['id'])});var _0x13638f=_['omit'](_0x402b67,['id']);if(_0x4aad41){for(var _0x45a5da in _0x13638f){if(typeof _0x13638f[_0x45a5da]!==_0x477d('0x5a')&&typeof _0x4aad41[_0x45a5da]!==_0x477d('0x5a')){_0x4aad41[_0x45a5da]=_0x13638f[_0x45a5da];}}_0x2c723a(_0x4aad41);}else{_0x4f80f3();}});},'VoiceChannels':function(_0x1ad4d1){return new Promise(function(_0x247b40,_0x44785b){var _0x13f606=_['values'](_0xf3cde0[_0x477d('0x5b')]);_0x247b40({'count':_0x13f606[_0x477d('0x58')],'rows':_0x13f606});});},'VoiceChannelMixMonitor':function(_0x45dd6a){var _0x2fb74d=this;return new Promise(function(_0x45bac2,_0x32b430){if(ami[_0x477d('0xd')]()==![]){return _0x32b430(_0x2fb74d[_0x477d('0x17')](0x1f4,[config[_0x477d('0xe')]['ip'],config[_0x477d('0xe')][_0x477d('0x19')],_0x477d('0xf')][_0x477d('0x10')]('\x20')));}var _0x2b23c0=schema(properties[_0x477d('0x5c')])['validate'](_0x45dd6a);if(_0x2b23c0[_0x477d('0x58')]>0x0){return _0x32b430(_0x2fb74d[_0x477d('0x17')](0x1f4,_['map'](_0x2b23c0,'message')['join'](',\x20')));}var _0xf0f20e=_[_0x477d('0x59')](_0xf3cde0[_0x477d('0x5b')],{'uniqueid':_0x45dd6a[_0x477d('0x5d')]});if(_0xf0f20e&&_0xf0f20e[_0x477d('0x5e')]){var _0x1f4168=util[_0x477d('0x5')](_0x477d('0x5f'),_0x45dd6a['filename']||_0x45dd6a[_0x477d('0x5d')],_0x45dd6a[_0x477d('0x5')]||_0x477d('0x60'));return ami[_0x477d('0x15')]({'action':_0x477d('0x61'),'channel':_0xf0f20e[_0x477d('0x5e')],'file':_0x1f4168,'options':_0x477d('0x62')})[_0x477d('0x1c')](function(_0x5d9114){var _0x3178ed=_[_0x477d('0x59')](_0xf0f20e[_0x477d('0x63')],{'filename':_0x477d('0x64')+_0x1f4168[_0x477d('0x65')]()});if(_['isNil'](_0x3178ed)){_0xf0f20e[_0x477d('0x63')][_0x477d('0x57')]({'filename':_0x477d('0x64')+_0x1f4168[_0x477d('0x65')](),'createdAt':moment()[_0x477d('0x5')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x5d9114['mixmonitorid'],'status':_0x477d('0x66')});}else{_0x3178ed[_0x477d('0x67')]=_0x5d9114[_0x477d('0x67')];_0x3178ed[_0x477d('0x68')]=_0x477d('0x66');}_0x45bac2({'code':0xc8,'message':[_0x45dd6a[_0x477d('0x5d')],_0x477d('0x69'),_0x5d9114[_0x477d('0x67')]]['join']('\x20'),'mixmonitorid':_0x5d9114['mixmonitorid']});})['catch'](function(_0x491a9a){_0x32b430(_0x2fb74d['error'](0x1f5,[_0x45dd6a[_0x477d('0x5d')],_0x491a9a['message'][_0x477d('0x65')]()]['join']('\x20')));});}else{return _0x32b430(_0x2fb74d[_0x477d('0x17')](0x1f5,_0x477d('0x6a')));}});},'VoiceChannelStopMixMonitor':function(_0x5d0922){var _0x248f85=this;return new Promise(function(_0x4739ac,_0x3d8a12){if(ami[_0x477d('0xd')]()==![]){return _0x3d8a12(_0x248f85[_0x477d('0x17')](0x1f4,[config['asterisk']['ip'],config[_0x477d('0xe')][_0x477d('0x19')],'ami\x20disconnected'][_0x477d('0x10')]('\x20')));}var _0xe8ea8b=schema(properties[_0x477d('0x5c')])[_0x477d('0x1')](_0x5d0922);if(_0xe8ea8b[_0x477d('0x58')]>0x0){return _0x3d8a12(_0x248f85['error'](0x1f4,_['map'](_0xe8ea8b,_0x477d('0x18'))[_0x477d('0x10')](',\x20')));}var _0x52983d=_[_0x477d('0x59')](_0xf3cde0['channels'],{'uniqueid':_0x5d0922['uniqueid']});if(_0x52983d){return BPromise[_0x477d('0x6b')]()[_0x477d('0x1c')](function(){if(_0x52983d[_0x477d('0x5e')]){return ami[_0x477d('0x15')]({'action':_0x477d('0x6c'),'channel':_0x52983d['channel'],'mixmonitorid':_0x5d0922['mixmonitorid']})[_0x477d('0x16')](function(_0x23c435){});}})[_0x477d('0x1c')](function(){if(_0x52983d[_0x477d('0x6d')]){return ami[_0x477d('0x15')]({'action':_0x477d('0x6c'),'channel':_0x52983d[_0x477d('0x6d')],'mixmonitorid':_0x5d0922[_0x477d('0x67')]})[_0x477d('0x16')](function(_0x4fd5e1){});}})['then'](function(_0x2eddb1){var _0x5049bd=_[_0x477d('0x59')](_0x52983d[_0x477d('0x63')],{'mixmonitorid':_0x5d0922[_0x477d('0x67')]});if(_0x5049bd){_0x5049bd['status']=_0x477d('0x6e');}})[_0x477d('0x1c')](function(){var _0x5ec335=util[_0x477d('0x5')](_0x477d('0x5f'),_0x5d0922[_0x477d('0x6f')]||_0x5d0922[_0x477d('0x5d')],_0x5d0922[_0x477d('0x5')]||_0x477d('0x60'));var _0x55f1a9=_[_0x477d('0x59')](_0x52983d[_0x477d('0x63')],{'filename':_0x477d('0x64')+_0x5ec335[_0x477d('0x65')]()});if(_0x55f1a9){_0x55f1a9['status']=_0x477d('0x6e');}})['then'](function(){_0x4739ac({'code':0xc8,'message':[_0x5d0922[_0x477d('0x5d')],_0x477d('0x70')]['join']('\x20')});})[_0x477d('0x16')](function(_0x3ca382){_0x3d8a12(_0x248f85[_0x477d('0x17')](0x1f5,[_0x5d0922['uniqueid'],_0x3ca382['message'][_0x477d('0x65')]()][_0x477d('0x10')]('\x20')));});}else{return _0x3d8a12(_0x248f85[_0x477d('0x17')](0x1f5,_0x477d('0x6a')));}});},'VoiceQueuesChannels':function(_0x57be6f){return new Promise(function(_0x2e0cc0,_0x38a650){var _0x53de6a=_[_0x477d('0x71')](_0xf3cde0[_0x477d('0x72')]);_0x2e0cc0({'count':_0x53de6a[_0x477d('0x58')],'rows':_0x53de6a});});},'VoiceQueuesChannel':function(_0x51dd68){var _0x1f2c3e=this;return new Promise(function(_0x4466f0,_0x120e0e){var _0x5ef582=schema(properties[_0x477d('0x73')])[_0x477d('0x1')](_0x51dd68);if(_0x5ef582[_0x477d('0x58')]>0x0){return _0x120e0e(_0x1f2c3e[_0x477d('0x17')](0x1f4,_[_0x477d('0x74')](_0x5ef582,_0x477d('0x18'))[_0x477d('0x10')](',\x20')));}var _0x3a3202=_[_0x477d('0x59')](_0xf3cde0['queueChannels'],{'uniqueid':_0x51dd68['uniqueid']});if(_0x3a3202){_0x4466f0(_0x3a3202);}else{return _0x120e0e(_0x1f2c3e[_0x477d('0x17')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x40e98d){var _0x51aaaa=this;return new Promise(function(_0x283326,_0x4ac6ae){if(ami[_0x477d('0xd')]()==![]){return _0x4ac6ae(_0x51aaaa[_0x477d('0x17')](0x1f4,[config[_0x477d('0xe')]['ip'],config[_0x477d('0xe')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x54924b=schema(properties['voicequeuechannelhangup'])[_0x477d('0x1')](_0x40e98d);if(_0x54924b[_0x477d('0x58')]>0x0){return _0x4ac6ae(_0x51aaaa[_0x477d('0x17')](0x1f4,_[_0x477d('0x74')](_0x54924b,_0x477d('0x18'))[_0x477d('0x10')](',\x20')));}var _0x576e01=_[_0x477d('0x59')](_0xf3cde0['queueChannels'],{'uniqueid':_0x40e98d['uniqueid']});if(_0x576e01&&_0x576e01[_0x477d('0x5e')]){return ami[_0x477d('0x15')]({'action':_0x477d('0x75'),'channel':_0x576e01[_0x477d('0x5e')]})[_0x477d('0x1c')](function(_0x46c6c9){_0x283326({'code':0xc8,'message':[_0x40e98d['uniqueid'],_0x46c6c9['message'][_0x477d('0x65')]()][_0x477d('0x10')]('\x20')});})[_0x477d('0x16')](function(_0x506d9b){_0x4ac6ae(_0x51aaaa['error'](0x1f5,[_0x40e98d[_0x477d('0x5d')],_0x506d9b[_0x477d('0x18')][_0x477d('0x65')]()][_0x477d('0x10')]('\x20')));});}else{return _0x4ac6ae(_0x51aaaa[_0x477d('0x17')](0x1f5,_0x477d('0x6a')));}});},'VoiceQueuesChannelRedirect':function(_0x1345da){var _0x257f54=this;return new Promise(function(_0x2a6560,_0x52dba2){if(ami[_0x477d('0xd')]()==![]){return _0x52dba2(_0x257f54[_0x477d('0x17')](0x1f4,[config['asterisk']['ip'],config[_0x477d('0xe')][_0x477d('0x19')],_0x477d('0xf')][_0x477d('0x10')]('\x20')));}var _0x171f25=schema(properties['voicequeuechannelredirect'])[_0x477d('0x1')](_0x1345da);if(_0x171f25['length']>0x0){return _0x52dba2(_0x257f54[_0x477d('0x17')](0x1f4,_[_0x477d('0x74')](_0x171f25,'message')[_0x477d('0x10')](',\x20')));}var _0x3fa3f6=_['find'](_0xf3cde0[_0x477d('0x72')],{'uniqueid':_0x1345da[_0x477d('0x5d')]});if(_0x3fa3f6&&_0x3fa3f6['channel']){return ami[_0x477d('0x15')]({'action':_0x477d('0x76'),'channel':_0x3fa3f6[_0x477d('0x5e')],'exten':_0x1345da[_0x477d('0x77')],'context':_0x1345da[_0x477d('0x78')]||_0x3fa3f6[_0x477d('0x78')],'priority':0x1})[_0x477d('0x1c')](function(_0x1560e3){_0x2a6560({'code':0xc8,'message':[_0x1345da[_0x477d('0x5d')],_0x1560e3[_0x477d('0x18')][_0x477d('0x65')]()][_0x477d('0x10')]('\x20')});})[_0x477d('0x16')](function(_0xb6280e){_0x52dba2(_0x257f54[_0x477d('0x17')](0x1f5,[_0x1345da['uniqueid'],_0xb6280e[_0x477d('0x18')]['toLowerCase']()]['join']('\x20')));});}else{return _0x52dba2(_0x257f54[_0x477d('0x17')](0x1f5,_0x477d('0x6a')));}});},'Agents':function(_0x4aec09){return new Promise(function(_0x210c4d,_0x142967){var _0xc49c1e=_[_0x477d('0x71')](_0xf3cde0[_0x477d('0xb')]);_0x210c4d({'count':_0xc49c1e[_0x477d('0x58')],'rows':_0xc49c1e});});},'Telephones':function(_0x1731ff){return new Promise(function(_0x4b23d9,_0x19e391){var _0x3d1808=_['values'](_0xf3cde0[_0x477d('0x79')]);_0x4b23d9({'count':_0x3d1808[_0x477d('0x58')],'rows':_0x3d1808});});},'Trunks':function(_0x4c1902){return new Promise(function(_0x2f3cac,_0x1092cb){var _0x135a69=_[_0x477d('0x71')](_0xf3cde0[_0x477d('0x7a')]);_0x2f3cac({'count':_0x135a69[_0x477d('0x58')],'rows':_0x135a69});});},'OutboundChannels':function(_0x1653b4){return new Promise(function(_0x20fc0c,_0xa8e188){var _0x3276bc=_[_0x477d('0x71')](_0xf3cde0[_0x477d('0x7b')]);_0x20fc0c({'count':_0x3276bc[_0x477d('0x58')],'rows':_0x3276bc});});},'Outbound':function(_0x4f1c1c){return new Promise(function(_0x5a04dd,_0x1ba7e6){_0x5a04dd(_0xf3cde0['outbound']);});},'Campaigns':function(_0x53a8fd){return new Promise(function(_0x5bb2bb,_0x20223e){var _0x4298b7=_['values'](_0xf3cde0[_0x477d('0x7c')]);_0x5bb2bb({'count':_0x4298b7[_0x477d('0x58')],'rows':_0x4298b7});});},'VoiceQueuesPreview':function(_0x2d3c0c){var _0x82997a=this;return new Promise(function(_0x35145b,_0x5ca0ae){_0x3d2f8d['run'](_0x2d3c0c['id'])[_0x477d('0x1c')](function(_0xd9386e){_0x35145b({'code':0xc8,'message':_0xd9386e[_0x477d('0x18')]});})[_0x477d('0x16')](function(_0x2ec9cd){_0x5ca0ae(_0x82997a['error'](0x1f4,_0x2ec9cd['message']));});});},'EventManager':function(_0x4d64fc){var _0x35a59e=this;return new Promise(function(_0x3514e1,_0x5957e1){if(!_0x4d64fc[_0x477d('0x7d')]){return _0x5957e1(_0x35a59e[_0x477d('0x17')](0x1f4,_0x477d('0x7e')));}ami[_0x477d('0x7f')](_0x477d('0x80')+_0x4d64fc[_0x477d('0x7d')],_0x4d64fc[_0x477d('0x18')]);_0x3514e1({'code':0xc8,'message':_0x4d64fc});});},'FaxAccounts':function(_0x4e965a){return new Promise(function(_0x20c153,_0x545827){var _0x43d598=_[_0x477d('0x71')](_0xf3cde0[_0x477d('0x81')]);_0x20c153({'count':_0x43d598[_0x477d('0x58')],'rows':_0x43d598});});},'SendFax':function(_0x26658d){var _0x266f99=this;return new Promise(function(_0x8b4d43,_0x4b5bdd){_0x471fca[_0x477d('0x82')](_0x26658d)[_0x477d('0x1c')](function(_0x59c944){_0x8b4d43({'code':0xc8,'message':_0x59c944[_0x477d('0x18')]});})['catch'](function(_0x11d967){_0x4b5bdd(_0x266f99['error'](0x1f4,_0x11d967[_0x477d('0x18')]));});});},'CheckAfterSend':function(_0xeea9bf){var _0x1aee21=this;return new Promise(function(_0x1f5797,_0xb28afa){_0x471fca['checkAfterSend'](_0xeea9bf)[_0x477d('0x1c')](function(_0x5044c3){_0x1f5797({'code':0xc8,'message':_0x5044c3[_0x477d('0x18')]});})[_0x477d('0x16')](function(_0x245ba9){_0xb28afa(_0x1aee21['error'](0x1f4,_0x245ba9[_0x477d('0x18')]));});});}};var _0x2c7a72=jayson[_0x477d('0x83')](_0x5153df)[_0x477d('0x84')]();_0x2c7a72['on'](_0x477d('0x17'),function(_0x30ed3a){return _0x45ca2d(_0x30ed3a);});_0x2c7a72[_0x477d('0x4')](0x232a,_0x477d('0x85'),function(){console[_0x477d('0x86')](_0x477d('0x87'),0x232a);return _0x2545e5(_0x477d('0x88')+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 edafd5f..8276ae8 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 _0xf3c2=['map','routeId','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','destcalleridnum','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','name','format','trigger:%s','action','toLowerCase','length','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','info','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','phone'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xf3c2,0x1da));var _0x2f3c=function(_0x2abd9e,_0x4fef34){_0x2abd9e=_0x2abd9e-0x0;var _0x4a3b59=_0xf3c2[_0x2abd9e];return _0x4a3b59;};'use strict';var _=require(_0x2f3c('0x0'));var BPromise=require('bluebird');var Redis=require(_0x2f3c('0x1'));var util=require(_0x2f3c('0x2'));var config=require(_0x2f3c('0x3'));var logger=require(_0x2f3c('0x4'))(_0x2f3c('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0x2f3c('0x6')]=_[_0x2f3c('0x7')](config[_0x2f3c('0x6')],{'host':_0x2f3c('0x8'),'port':0x18eb});var io=require(_0x2f3c('0x9'))(new Redis(config['redis']));function emit(_0x465960,_0xc49fed,_0x5c9723,_0x5afb33,_0x58b91f){logger[_0x2f3c('0xa')]('[CM][%s][%s]',_0x465960,_0xc49fed['id'],_0x5c9723,_0x5afb33,JSON[_0x2f3c('0xb')](_0x58b91f));io['to'](_0x5c9723)[_0x2f3c('0xc')](_0x5afb33,_0x58b91f);}exports[_0x2f3c('0xd')]=function(_0x32dea3,_0x3f8eff,_0x1d9f62,_0x5abdd2){var _0x33710c,_0x4f2e5f;var _0x4a8849={};var _0x22cce9=Number(_0x1d9f62[_0x2f3c('0xe')]);var _0x302461=_0x1d9f62[_0x2f3c('0xf')]?Boolean(Number(_0x1d9f62[_0x2f3c('0xf')])):![];var _0x3ac44a;if(_0x5abdd2[_0x2f3c('0x10')]){_0x4a8849['id']=_0x5abdd2[_0x2f3c('0x10')];}if(!_0x4a8849['id']){_0x4a8849[_0x2f3c('0x11')]=_0x22cce9;_0x3ac44a=_0x1d9f62[_0x2f3c('0x12')]&&_0x1d9f62[_0x2f3c('0x12')]!=='0'?_0x1d9f62[_0x2f3c('0x12')][_0x2f3c('0x13')](','):[_0x2f3c('0x14')];_0x4a8849['$or']=_[_0x2f3c('0x15')](_0x3ac44a,function(_0xb854a4){var _0x2db80e={};_0x2db80e[_0xb854a4]=_0x5abdd2[_0x2f3c('0x16')]?_0x5abdd2['destcalleridnum']:_0x5abdd2[_0x2f3c('0x17')];return _0x2db80e;});}var _0x30b236=['id',_0x2f3c('0x18'),_0x2f3c('0x19'),_0x2f3c('0x14'),_0x2f3c('0x1a'),_0x2f3c('0x1b'),'ListId',_0x2f3c('0x1c'),_0x2f3c('0x1d'),_0x2f3c('0x1e')];var _0x5424d4=_[_0x2f3c('0x1f')](_0x30b236,_0x3ac44a);BPromise[_0x2f3c('0x20')]()[_0x2f3c('0x21')](cmContactRpc['getContacts']({'attributes':_0x5424d4,'where':_0x4a8849}))['then'](function(_0x5cc3b9){_0x4f2e5f=_0x5cc3b9;if(!_['isEmpty'](_0x4f2e5f)){if(_0x4f2e5f['length']===0x1){_0x33710c=_0x4f2e5f[0x0];logger[_0x2f3c('0xa')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x5abdd2[_0x2f3c('0x22')],_0x3f8eff['id'],_0x33710c['id']);}else{logger[_0x2f3c('0xa')](_0x2f3c('0x23'),_0x5abdd2[_0x2f3c('0x22')],_0x3f8eff['id'],_[_0x2f3c('0x15')](_0x4f2e5f,'id')[_0x2f3c('0x24')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x5abdd2[_0x2f3c('0x22')],_0x3f8eff['id']);var _0x27bfb8={'ListId':_0x22cce9};var _0x1b6eaf=_0x1d9f62[_0x2f3c('0x25')]&&_0x1d9f62[_0x2f3c('0x25')]!=='0'?_0x1d9f62[_0x2f3c('0x25')]:_0x2f3c('0x14');if(_0x302461){logger['info'](_0x2f3c('0x26'),_0x5abdd2[_0x2f3c('0x22')],_0x3f8eff['id']);_0x27bfb8[_0x1b6eaf]=_[_0x2f3c('0x27')](_0x5abdd2[_0x2f3c('0x16')])?_0x5abdd2[_0x2f3c('0x17')]:_0x5abdd2[_0x2f3c('0x28')];if(_[_0x2f3c('0x27')](_0x5abdd2['routeId'])){_0x27bfb8[_0x2f3c('0x18')]=_0x5abdd2[_0x2f3c('0x29')]&&_0x5abdd2[_0x2f3c('0x29')]!==_0x2f3c('0x2a')?_0x5abdd2[_0x2f3c('0x29')]:_0x2f3c('0x2b');}else{_0x27bfb8[_0x2f3c('0x18')]=_0x5abdd2[_0x2f3c('0x2c')]&&_0x5abdd2['destcalleridname']!==_0x2f3c('0x2a')?_0x5abdd2[_0x2f3c('0x2c')]:_0x2f3c('0x2b');}return BPromise[_0x2f3c('0x20')]()[_0x2f3c('0x21')](cmContactRpc[_0x2f3c('0x2d')](_0x27bfb8))[_0x2f3c('0x21')](function(_0x1bf79a){_0x33710c=_0x1bf79a;_0x4f2e5f[_0x2f3c('0x2e')](_0x1bf79a);if(_0x33710c){logger['info'](_0x2f3c('0x2f'),_0x5abdd2[_0x2f3c('0x22')],_0x3f8eff['id'],_0x33710c['id']);}return;});}else{logger[_0x2f3c('0xa')](_0x2f3c('0x30'),_0x5abdd2[_0x2f3c('0x22')],_0x3f8eff['id']);_0x27bfb8[_0x1b6eaf]=_[_0x2f3c('0x27')](_0x5abdd2['routeId'])?_0x5abdd2[_0x2f3c('0x17')]:_0x5abdd2[_0x2f3c('0x28')];if(_[_0x2f3c('0x27')](_0x5abdd2[_0x2f3c('0x16')])){_0x27bfb8[_0x2f3c('0x18')]=_0x5abdd2[_0x2f3c('0x29')]&&_0x5abdd2[_0x2f3c('0x29')]!==_0x2f3c('0x2a')?_0x5abdd2[_0x2f3c('0x29')]:'Unknown';}else{_0x27bfb8[_0x2f3c('0x18')]=_0x5abdd2[_0x2f3c('0x2c')]&&_0x5abdd2[_0x2f3c('0x2c')]!==_0x2f3c('0x2a')?_0x5abdd2[_0x2f3c('0x2c')]:_0x2f3c('0x2b');}_0x33710c=_0x27bfb8;_0x4f2e5f[_0x2f3c('0x2e')](_0x27bfb8);return;}}})[_0x2f3c('0x21')](function(){if(_0x32dea3){emit(_0x5abdd2['uniqueid'],_0x3f8eff,util['format']('user:%s',_0x32dea3[_0x2f3c('0x31')]),util[_0x2f3c('0x32')](_0x2f3c('0x33'),_0x1d9f62[_0x2f3c('0x34')][_0x2f3c('0x35')]()),{'evt':_['merge'](_0x5abdd2,{'autoCreate':_0x302461}),'contact':_0x33710c===undefined?{}:_0x33710c,'contacts':_0x4f2e5f[_0x2f3c('0x36')]===0x0?undefined:_0x4f2e5f});}});}; \ No newline at end of file +var _0x16b7=['format','user:%s','trigger:%s','action','toLowerCase','merge','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data1','data2','xmd-contactid','ListId','data3','split','$or','map','destcalleridnum','firstName','phone','mobile','fax','createdAt','updatedAt','union','resolve','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridnum','calleridname','','Unknown','destcalleridname','then','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x16b7,0x1d6));var _0x716b=function(_0x463e50,_0x28327b){_0x463e50=_0x463e50-0x0;var _0x4ca6d3=_0x16b7[_0x463e50];return _0x4ca6d3;};'use strict';var _=require(_0x716b('0x0'));var BPromise=require('bluebird');var Redis=require(_0x716b('0x1'));var util=require(_0x716b('0x2'));var config=require(_0x716b('0x3'));var logger=require(_0x716b('0x4'))('trigger');var cmContactRpc=require(_0x716b('0x5'));config[_0x716b('0x6')]=_[_0x716b('0x7')](config[_0x716b('0x6')],{'host':_0x716b('0x8'),'port':0x18eb});var io=require(_0x716b('0x9'))(new Redis(config[_0x716b('0x6')]));function emit(_0x2bdbe0,_0x11fb2c,_0x5bd6f0,_0x41a002,_0xba0adb){logger[_0x716b('0xa')](_0x716b('0xb'),_0x2bdbe0,_0x11fb2c['id'],_0x5bd6f0,_0x41a002,JSON[_0x716b('0xc')](_0xba0adb));io['to'](_0x5bd6f0)['emit'](_0x41a002,_0xba0adb);}exports[_0x716b('0xd')]=function(_0x31598c,_0xe81bd6,_0x172908,_0x5bab0c){var _0x4411b2,_0x2394f6;var _0x2da018={};var _0x427c7e=Number(_0x172908[_0x716b('0xe')]);var _0x31c31b=_0x172908[_0x716b('0xf')]?Boolean(Number(_0x172908['data2'])):![];var _0x319ce6;if(_0x5bab0c[_0x716b('0x10')]){_0x2da018['id']=_0x5bab0c[_0x716b('0x10')];}if(!_0x2da018['id']){_0x2da018[_0x716b('0x11')]=_0x427c7e;_0x319ce6=_0x172908[_0x716b('0x12')]&&_0x172908[_0x716b('0x12')]!=='0'?_0x172908['data3'][_0x716b('0x13')](','):['phone'];_0x2da018[_0x716b('0x14')]=_[_0x716b('0x15')](_0x319ce6,function(_0x495b4d){var _0x182d17={};_0x182d17[_0x495b4d]=_0x5bab0c['routeId']?_0x5bab0c[_0x716b('0x16')]:_0x5bab0c['calleridnum'];return _0x182d17;});}var _0x550cfa=['id',_0x716b('0x17'),'lastName',_0x716b('0x18'),_0x716b('0x19'),_0x716b('0x1a'),_0x716b('0x11'),_0x716b('0x1b'),'scheduledAt',_0x716b('0x1c')];var _0x2ee507=_[_0x716b('0x1d')](_0x550cfa,_0x319ce6);BPromise[_0x716b('0x1e')]()['then'](cmContactRpc['getContacts']({'attributes':_0x2ee507,'where':_0x2da018}))['then'](function(_0x2757ce){_0x2394f6=_0x2757ce;if(!_[_0x716b('0x1f')](_0x2394f6)){if(_0x2394f6[_0x716b('0x20')]===0x1){_0x4411b2=_0x2394f6[0x0];logger[_0x716b('0xa')](_0x716b('0x21'),_0x5bab0c[_0x716b('0x22')],_0xe81bd6['id'],_0x4411b2['id']);}else{logger['info'](_0x716b('0x23'),_0x5bab0c[_0x716b('0x22')],_0xe81bd6['id'],_[_0x716b('0x15')](_0x2394f6,'id')[_0x716b('0x24')](','));}return;}else{logger[_0x716b('0xa')](_0x716b('0x25'),_0x5bab0c[_0x716b('0x22')],_0xe81bd6['id']);var _0x2b2ff2={'ListId':_0x427c7e};var _0x5914f3=_0x172908[_0x716b('0x26')]&&_0x172908[_0x716b('0x26')]!=='0'?_0x172908[_0x716b('0x26')]:_0x716b('0x18');if(_0x31c31b){logger[_0x716b('0xa')](_0x716b('0x27'),_0x5bab0c[_0x716b('0x22')],_0xe81bd6['id']);_0x2b2ff2[_0x5914f3]=_[_0x716b('0x28')](_0x5bab0c[_0x716b('0x29')])?_0x5bab0c[_0x716b('0x2a')]:_0x5bab0c[_0x716b('0x16')];if(_[_0x716b('0x28')](_0x5bab0c[_0x716b('0x29')])){_0x2b2ff2[_0x716b('0x17')]=_0x5bab0c['calleridname']&&_0x5bab0c[_0x716b('0x2b')]!==_0x716b('0x2c')?_0x5bab0c[_0x716b('0x2b')]:_0x716b('0x2d');}else{_0x2b2ff2[_0x716b('0x17')]=_0x5bab0c[_0x716b('0x2e')]&&_0x5bab0c['destcalleridname']!==_0x716b('0x2c')?_0x5bab0c['destcalleridname']:_0x716b('0x2d');}return BPromise[_0x716b('0x1e')]()[_0x716b('0x2f')](cmContactRpc[_0x716b('0x30')](_0x2b2ff2))[_0x716b('0x2f')](function(_0xd0da6){_0x4411b2=_0xd0da6;_0x2394f6[_0x716b('0x31')](_0xd0da6);if(_0x4411b2){logger['info'](_0x716b('0x32'),_0x5bab0c['uniqueid'],_0xe81bd6['id'],_0x4411b2['id']);}return;});}else{logger[_0x716b('0xa')](_0x716b('0x33'),_0x5bab0c['uniqueid'],_0xe81bd6['id']);_0x2b2ff2[_0x5914f3]=_['isNil'](_0x5bab0c['routeId'])?_0x5bab0c[_0x716b('0x2a')]:_0x5bab0c[_0x716b('0x16')];if(_[_0x716b('0x28')](_0x5bab0c[_0x716b('0x29')])){_0x2b2ff2[_0x716b('0x17')]=_0x5bab0c[_0x716b('0x2b')]&&_0x5bab0c[_0x716b('0x2b')]!==''?_0x5bab0c[_0x716b('0x2b')]:'Unknown';}else{_0x2b2ff2[_0x716b('0x17')]=_0x5bab0c[_0x716b('0x2e')]&&_0x5bab0c['destcalleridname']!==_0x716b('0x2c')?_0x5bab0c[_0x716b('0x2e')]:_0x716b('0x2d');}_0x4411b2=_0x2b2ff2;_0x2394f6[_0x716b('0x31')](_0x2b2ff2);return;}}})['then'](function(){if(_0x31598c){emit(_0x5bab0c[_0x716b('0x22')],_0xe81bd6,util[_0x716b('0x34')](_0x716b('0x35'),_0x31598c['name']),util[_0x716b('0x34')](_0x716b('0x36'),_0x172908[_0x716b('0x37')][_0x716b('0x38')]()),{'evt':_[_0x716b('0x39')](_0x5bab0c,{'autoCreate':_0x31c31b}),'contact':_0x4411b2===undefined?{}:_0x4411b2,'contacts':_0x2394f6['length']===0x0?undefined:_0x2394f6});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index add07e0..5a0d322 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 _0xdc7b=['syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','info','emit','prototype','clone','checkTriggers','interface','triggers','status','checkTrigger','merge','variables','length','Actions','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','data3','isNil','data4','location','windowWidth','data5','800','windowHeight','data6','600','winApplication','winArguments','user:%s','name','trigger:%s:%s','format','trigger:%s','exec','integration','queue','routeId','urlforward','parse','query','AllConditions','channel','AnyConditions','checkConditions','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','event','agent','membername','lastevent','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','trigger','../ami','redis','defaults','popup','winapp','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','zohoAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:dialbegin'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xdc7b,0xc2));var _0xbdc7=function(_0x500f60,_0x430934){_0x500f60=_0x500f60-0x0;var _0x45701b=_0xdc7b[_0x500f60];return _0x45701b;};'use strict';var util=require(_0xbdc7('0x0'));var _=require(_0xbdc7('0x1'));var url=require(_0xbdc7('0x2'));var Mustache=require(_0xbdc7('0x3'));var Redis=require(_0xbdc7('0x4'));var urlforward=require(_0xbdc7('0x5'));var integration=require(_0xbdc7('0x6'));var cmContact=require(_0xbdc7('0x7'));var script=require(_0xbdc7('0x8'));var config=require(_0xbdc7('0x9'));var logger=require('../../../config/logger')(_0xbdc7('0xa'));var ami=require(_0xbdc7('0xb'));config[_0xbdc7('0xc')]=_[_0xbdc7('0xd')](config[_0xbdc7('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbdc7('0xc')]));var operators={'equals':function(_0x239bad,_0x2e7210){return _0x239bad==_0x2e7210;},'not_equals':function(_0x4b1005,_0x101dab){return _0x4b1005!=_0x101dab;}};var barAndWebActions=[_0xbdc7('0xe'),_0xbdc7('0x2'),_0xbdc7('0xf')];function Trigger(_0x5ae880){this['triggers']=_0x5ae880['triggers'];this['agents']=_0x5ae880[_0xbdc7('0x10')];this[_0xbdc7('0x11')]=_0x5ae880[_0xbdc7('0x11')];this['templates']=_0x5ae880[_0xbdc7('0x12')];this['voiceExtensions']=_0x5ae880[_0xbdc7('0x13')];this[_0xbdc7('0x14')]=_0x5ae880[_0xbdc7('0x14')];this[_0xbdc7('0x15')]=_0x5ae880[_0xbdc7('0x15')];this[_0xbdc7('0x16')]=_0x5ae880[_0xbdc7('0x16')];this[_0xbdc7('0x17')]=_0x5ae880[_0xbdc7('0x17')];this['zohoAccounts']=_0x5ae880['zohoAccounts'];this[_0xbdc7('0x18')]=_0x5ae880[_0xbdc7('0x18')];this[_0xbdc7('0x19')]=_0x5ae880[_0xbdc7('0x19')];this[_0xbdc7('0x1a')]=_0x5ae880['servicenowAccounts'];this[_0xbdc7('0x1b')]=_0x5ae880['dynamics365Accounts'];this['freshsalesAccounts']=_0x5ae880[_0xbdc7('0x1c')];this[_0xbdc7('0x1d')]={'zendesk':this[_0xbdc7('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xbdc7('0x15')],'sugarcrm':this[_0xbdc7('0x17')],'zoho':this[_0xbdc7('0x1e')],'desk':this[_0xbdc7('0x18')],'vtiger':this[_0xbdc7('0x19')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xbdc7('0x1c')],'servicenow':this['servicenowAccounts']};ami['on'](_0xbdc7('0x1f'),this[_0xbdc7('0x20')]['bind'](this));ami['on']('custom:agentconnect',this['syncCustomEvent'][_0xbdc7('0x21')](this));ami['on'](_0xbdc7('0x22'),this['syncCustomEvent'][_0xbdc7('0x21')](this));ami['on'](_0xbdc7('0x23'),this[_0xbdc7('0x20')][_0xbdc7('0x21')](this));ami['on'](_0xbdc7('0x24'),this[_0xbdc7('0x20')][_0xbdc7('0x21')](this));ami['on'](_0xbdc7('0x25'),this[_0xbdc7('0x20')][_0xbdc7('0x21')](this));ami['on'](_0xbdc7('0x26'),this['syncCustomEvent'][_0xbdc7('0x21')](this));ami['on'](_0xbdc7('0x27'),this[_0xbdc7('0x20')][_0xbdc7('0x21')](this));ami['on'](_0xbdc7('0x28'),this[_0xbdc7('0x20')][_0xbdc7('0x21')](this));ami['on'](_0xbdc7('0x29'),this[_0xbdc7('0x20')][_0xbdc7('0x21')](this));ami['on'](_0xbdc7('0x2a'),this['syncCustomEvent'][_0xbdc7('0x21')](this));ami['on']('custom:timeout',this[_0xbdc7('0x20')][_0xbdc7('0x21')](this));ami['on'](_0xbdc7('0x2b'),this[_0xbdc7('0x2c')][_0xbdc7('0x21')](this));ami['on'](_0xbdc7('0x2d'),this[_0xbdc7('0x2c')][_0xbdc7('0x21')](this));ami['on'](_0xbdc7('0x2e'),this[_0xbdc7('0x2c')][_0xbdc7('0x21')](this));ami['on'](_0xbdc7('0x2f'),this['syncCustomEvent'][_0xbdc7('0x21')](this));ami['on'](_0xbdc7('0x30'),this['syncCustomEvent'][_0xbdc7('0x21')](this));ami['on']('custom:incomingmessage',this[_0xbdc7('0x20')][_0xbdc7('0x21')](this));ami['on'](_0xbdc7('0x31'),this[_0xbdc7('0x20')][_0xbdc7('0x21')](this));ami['on'](_0xbdc7('0x32'),this[_0xbdc7('0x20')][_0xbdc7('0x21')](this));ami['on'](_0xbdc7('0x33'),this[_0xbdc7('0x20')][_0xbdc7('0x21')](this));}Trigger['prototype']['emit']=function(_0x53fd5e,_0x20912b,_0x12e60f){logger[_0xbdc7('0x34')](_0x53fd5e,_0x20912b,JSON['stringify'](_0x12e60f));io['to'](_0x53fd5e)[_0xbdc7('0x35')](_0x20912b,_0x12e60f);};Trigger[_0xbdc7('0x36')][_0xbdc7('0x20')]=function(_0x34fd42){var _0x46bd43=_[_0xbdc7('0x37')](_0x34fd42);this[_0xbdc7('0x38')](_0x46bd43);};Trigger[_0xbdc7('0x36')][_0xbdc7('0x2c')]=function(_0x3cc118){if(this[_0xbdc7('0x10')][_0x3cc118[_0xbdc7('0x39')]]){this[_0xbdc7('0x20')](_0x3cc118);}};Trigger[_0xbdc7('0x36')][_0xbdc7('0x38')]=function(_0x5baf59){var _0x6aad21;for(var _0x290dae in this[_0xbdc7('0x3a')]){if(this['triggers']['hasOwnProperty'](_0x290dae)){if(this[_0xbdc7('0x3a')][_0x290dae][_0xbdc7('0x3b')]){_0x6aad21=this[_0xbdc7('0x3c')](this[_0xbdc7('0x3a')][_0x290dae],_0x5baf59);if(_0x6aad21){_[_0xbdc7('0x3d')](_0x5baf59,_0x5baf59[_0xbdc7('0x3e')]);for(var _0x1bcac1=0x0,_0x283f54,_0x2753c1,_0x52a4ee;_0x1bcac10x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[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:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x4c3a95,_0x12df1b){var _0x3b71a9=function(_0x1deca2){while(--_0x1deca2){_0x4c3a95['push'](_0x4c3a95['shift']());}};_0x3b71a9(++_0x12df1b);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ 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 512527b..465e3c1 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 _0x6918=['contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','4.0','telephone1','contactid',']\x20Enduser\x20Created!','includes','picklist','nameField','idField','substring','indexOf','content','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','phonecalls','callDirection','queue','headers','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','remoteUri','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','POST','clientId','username','password','clientSecret','then','access_token','error',']\x20Wrong\x20credentials!','systemusers?$select=internalemailaddress,isdisabled,systemuserid','isNil','validateEmail','email','userEmail','length','isdisabled','info','toUpperCase','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','lastIndexOf','enduserId','catch','toLowerCase'];(function(_0x531e2f,_0xa895b7){var _0x4c543d=function(_0xd67a52){while(--_0xd67a52){_0x531e2f['push'](_0x531e2f['shift']());}};_0x4c543d(++_0xa895b7);}(_0x6918,0x1b2));var _0x8691=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6918[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var rp=require('request-promise');var util=require(_0x8691('0x0'));var intUtil=require('./util');var md5=require(_0x8691('0x1'));var Redis=require(_0x8691('0x2'));var logger=require(_0x8691('0x3'))(_0x8691('0x4'));var config=require(_0x8691('0x5'));config[_0x8691('0x6')]=_[_0x8691('0x7')](config[_0x8691('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x8691('0x8'))(new Redis(config[_0x8691('0x6')]));function getAuthToken(_0x375bcd,_0x384a08,_0x3eb5c1){var _0x12e2c9={'method':_0x8691('0x9'),'uri':_0x384a08,'form':{'client_id':_0x375bcd[_0x8691('0xa')],'resource':_0x375bcd['remoteUri'],'username':_0x375bcd[_0x8691('0xb')],'password':_0x375bcd[_0x8691('0xc')],'grant_type':_0x8691('0xc'),'client_secret':_0x375bcd[_0x8691('0xd')]},'json':!![]};return rp(_0x12e2c9)[_0x8691('0xe')](function(_0x27bb63){return _0x27bb63[_0x8691('0xf')];})['catch'](function(_0x3952bd){logger[_0x8691('0x10')]('['+[_0x3eb5c1['toUpperCase']()]+_0x8691('0x11'));return _0x3952bd['message'];});}function getUser(_0x423f5d,_0x5190b9,_0x5d21bf,_0x3f28d5,_0x9ac3c3,_0x442f3e){return new BPromise(function(_0x2b6ad4,_0x2db21d){return getAuthToken(_0x5190b9,_0x3f28d5,_0x442f3e)[_0x8691('0xe')](function(_0x2ebedd){var _0x44e350={'method':'GET','uri':_0x9ac3c3+_0x8691('0x12'),'headers':{'Authorization':'Bearer\x20'+_0x2ebedd,'OData-Version':'4.0'},'json':!![]};return rp(_0x44e350);})[_0x8691('0xe')](function(_0x16cb85){var _0xaf58ef=_0x16cb85['value'];var _0x2c4925=![];var _0x18db9a=null;if(!_[_0x8691('0x13')](_0x5d21bf)){if(intUtil[_0x8691('0x14')](_0x5d21bf[_0x8691('0x15')])){_0x423f5d[_0x8691('0x16')]=_0x5d21bf[_0x8691('0x15')];for(_0x18db9a=0x0;_0x18db9a<_0xaf58ef[_0x8691('0x17')];_0x18db9a++){if(_0xaf58ef[_0x18db9a]['internalemailaddress']===_0x5d21bf[_0x8691('0x15')]&&!_0xaf58ef[_0x18db9a][_0x8691('0x18')]){_0x2c4925=!![];logger[_0x8691('0x19')]('['+[_0x442f3e[_0x8691('0x1a')]()]+']\x20Agent\x20found\x20'+_0xaf58ef[_0x18db9a][_0x8691('0x1b')]+'!');_0x423f5d[_0x8691('0x1c')]=_0xaf58ef[_0x18db9a]['systemuserid'];}}}}if(!_0x2c4925){logger[_0x8691('0x19')]('['+[_0x442f3e[_0x8691('0x1a')]()]+_0x8691('0x1d'));_0x423f5d[_0x8691('0x16')]=_0x5190b9[_0x8691('0xb')];for(_0x18db9a=0x0;_0x18db9a<_0xaf58ef[_0x8691('0x17')];_0x18db9a++){if(_0xaf58ef[_0x18db9a]['internalemailaddress']===_0x5190b9[_0x8691('0xb')]){_0x423f5d[_0x8691('0x1c')]=_0xaf58ef[_0x18db9a][_0x8691('0x1b')];}}}_0x2b6ad4(_0x423f5d);})['catch'](function(_0x4133f2){_0x2db21d(_0x4133f2[_0x8691('0x1e')]);});});}function createEndUser(_0x6ff98c,_0xacde7b,_0x230e35,_0x1a8237,_0x38f9ba,_0x447545){return new BPromise(function(_0x96ce56,_0x298e20){return getAuthToken(_0xacde7b,_0x230e35,_0x447545)[_0x8691('0xe')](function(_0x214fac){var _0x5204df=_0x447545['toLowerCase']()===_0x8691('0x1f')?_0x38f9ba[_0x8691('0x20')]:_0x38f9ba[_0x8691('0x21')];var _0x8ac555={'method':_0x8691('0x9'),'uri':_0x1a8237+_0x8691('0x22'),'body':{'telephone1':_0x5204df,'fullname':_0x5204df,'firstname':_0x5204df,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8691('0x23')+_0x6ff98c[_0x8691('0x1c')]+')'},'headers':{'Authorization':_0x8691('0x24')+_0x214fac,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x8ac555);})[_0x8691('0xe')](function(_0x2db49e){var _0x146a94=_0x2db49e['headers']['odata-entityid'];var _0x8962a9=_0x146a94['substring'](_0x146a94[_0x8691('0x25')]('(')+0x1,_0x146a94[_0x8691('0x25')](')'));_0x6ff98c[_0x8691('0x26')]=_0x8962a9;_0x96ce56(_0x6ff98c);})[_0x8691('0x27')](function(_0x37504c){_0x298e20(_0x37504c[_0x8691('0x1e')]);});});}function getEndUser(_0x425e48,_0x17218a,_0x3f01d1,_0x36a1a1,_0x1b0f99,_0x182e61){return new BPromise(function(_0xbaf137,_0x5a0445){var _0xfd18d4=_0x182e61[_0x8691('0x28')]()===_0x8691('0x1f')?_0x1b0f99[_0x8691('0x20')]:_0x1b0f99['calleridnum'];return getAuthToken(_0x17218a,_0x3f01d1,_0x182e61)[_0x8691('0xe')](function(_0x3e1210){var _0x14bebb={'method':'GET','uri':_0x36a1a1+_0x8691('0x29')+_0xfd18d4[_0x8691('0x2a')]('+',_0x8691('0x2b'))+'\x27','headers':{'Authorization':_0x8691('0x24')+_0x3e1210,'If-None-Match':null,'OData-Version':_0x8691('0x2c')},'json':!![]};return rp(_0x14bebb);})[_0x8691('0xe')](function(_0x1870f2){var _0x1f148f=null;if(_0x1870f2){var _0x4979cd=_0x1870f2['value'];var _0x4f554d=![];for(_0x1f148f=0x0;_0x1f148f<_0x4979cd[_0x8691('0x17')];_0x1f148f++){if(_0x4979cd[_0x1f148f][_0x8691('0x2d')]===_0xfd18d4){_0x4f554d=!![];_0x425e48[_0x8691('0x26')]=_0x4979cd[_0x1f148f][_0x8691('0x2e')];}}if(_0x4f554d){_0xbaf137(_0x425e48);}else{return createEndUser(_0x425e48,_0x17218a,_0x3f01d1,_0x36a1a1,_0x1b0f99,_0x182e61)['then'](function(_0x2287c2){logger['info']('['+[_0x182e61['toUpperCase']()]+']\x20Enduser\x20created!',_0x2287c2[_0x8691('0x26')]);_0xbaf137(_0x2287c2);});}}else{return createEndUser(_0x425e48,_0x17218a,_0x3f01d1,_0x36a1a1,_0x1b0f99,_0x182e61)[_0x8691('0xe')](function(_0x51e893){logger[_0x8691('0x19')]('['+[_0x182e61['toUpperCase']()]+_0x8691('0x2f'),_0x51e893[_0x8691('0x26')]);_0xbaf137(_0x51e893);});}});});}function getCustomFields(_0x3f3c72,_0x1cf743,_0x50f97e){var _0x48d494={};if(_0x3f3c72[_0x8691('0x17')]>0x0){_['forEach'](_0x3f3c72,function(_0x26a8ac){if(_[_0x8691('0x30')](['string',_0x8691('0x31')],_0x26a8ac['type'])&&_0x26a8ac[_0x8691('0x32')]&&!_0x26a8ac['customField']){var _0x3546d7=_0x26a8ac[_0x8691('0x33')][_0x8691('0x28')]();var _0xdbdb6c=_0x3546d7[_0x8691('0x34')](0x0,_0x3546d7[_0x8691('0x35')]('_'));var _0x50c0c8=_0x3546d7[_0x8691('0x34')](_0x3546d7[_0x8691('0x35')]('_')+0x1);if(_0xdbdb6c===_0x50f97e){_0x48d494[_0x50c0c8]=_0x26a8ac[_0x8691('0x36')];}}});}return _0x48d494;}function getTicket(_0x59eb27,_0x524f32,_0x31617e,_0x20cffb,_0x5b737e,_0x2e9f93,_0x4df561){return new BPromise(function(_0x2c1d83,_0x530415){var _0x495e3d;return getAuthToken(_0x524f32,_0x31617e,_0x4df561)['then'](function(_0x2ada30){if(_0x2e9f93['ticketType']===_0x8691('0x37')){_0x495e3d={'method':_0x8691('0x9'),'uri':_0x20cffb+_0x8691('0x38'),'body':Object[_0x8691('0x39')]({},{'title':intUtil[_0x8691('0x3a')](_0x2e9f93[_0x8691('0x3b')],_0x5b737e,'\x20'),'description':intUtil[_0x8691('0x3a')](_0x2e9f93[_0x8691('0x3c')],_0x5b737e,'\x0a'),'customerid_contact@odata.bind':_0x8691('0x3d')+_0x59eb27[_0x8691('0x26')]+')','ownerid@odata.bind':_0x8691('0x23')+_0x59eb27['userId']+')','caseorigincode':'1'},getCustomFields(_0x2e9f93[_0x8691('0x3e')],_0x5b737e,_0x2e9f93['ticketType'])),'headers':{'Authorization':_0x8691('0x24')+_0x2ada30,'OData-Version':_0x8691('0x2c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2e9f93[_0x8691('0x3f')]===_0x8691('0x40')){_0x495e3d={'method':'POST','uri':_0x20cffb+_0x8691('0x41'),'body':Object[_0x8691('0x39')]({},{'subject':intUtil[_0x8691('0x3a')](_0x2e9f93[_0x8691('0x3b')],_0x5b737e,'\x20'),'phonenumber':String(_0x5b737e[_0x8691('0x21')]),'description':intUtil[_0x8691('0x3a')](_0x2e9f93[_0x8691('0x3c')],_0x5b737e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x8691('0x3d')+_0x59eb27[_0x8691('0x26')]+')','ownerid@odata.bind':'/systemusers('+_0x59eb27[_0x8691('0x1c')]+')','directioncode':_0x59eb27[_0x8691('0x42')]===_0x8691('0x43')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x8691('0x23')+_0x59eb27['userId']+')','participationtypemask':_0x59eb27[_0x8691('0x42')]===_0x8691('0x43')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x59eb27[_0x8691('0x26')]+')','participationtypemask':_0x59eb27[_0x8691('0x42')]===_0x8691('0x43')?0x1:0x2}]},getCustomFields(_0x2e9f93[_0x8691('0x3e')],_0x5b737e,_0x2e9f93[_0x8691('0x3f')])),'headers':{'Authorization':'Bearer\x20'+_0x2ada30,'OData-Version':_0x8691('0x2c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x495e3d);})[_0x8691('0xe')](function(_0x44ee31){var _0x240740=_0x44ee31[_0x8691('0x44')][_0x8691('0x45')];var _0x21a73b=_0x240740[_0x8691('0x34')](_0x240740[_0x8691('0x25')]('(')+0x1,_0x240740[_0x8691('0x25')](')'));_0x59eb27[_0x8691('0x46')]=_0x21a73b;_0x2c1d83(_0x59eb27);})[_0x8691('0x27')](function(_0x1e20a3){_0x530415(_0x1e20a3[_0x8691('0x1e')]);});});}function emit(_0x1aa38a,_0x8ab5d,_0x386c60,_0x159453){var _0xba6700={'uri':util[_0x8691('0x47')](_0x8691('0x48'),_0x1aa38a,_0x386c60,_0x159453)};io['to'](util[_0x8691('0x47')](_0x8691('0x49'),_0x8ab5d))['emit']('trigger:browser:url',_0xba6700);}exports['cs']=function(_0x577e4a,_0x29d926,_0x7d6339,_0x5756dc,_0x279ffb,_0x1650fd,_0x1b8896,_0x2021b3){var _0x398e10={};_0x1650fd[_0x8691('0x4a')]=intUtil[_0x8691('0x4b')](_0x1650fd[_0x8691('0x4a')]);_0x1650fd['serverUrl']=intUtil[_0x8691('0x4b')](_0x1650fd[_0x8691('0x4c')]);_0x398e10[_0x8691('0x42')]=_0x2021b3===_0x8691('0x43')||_0x2021b3===_0x8691('0x4d')?_0x8691('0x43'):_0x8691('0x1f');var _0x576f73=util[_0x8691('0x47')]('%s/api/data/v9.0/',_0x1650fd[_0x8691('0x4a')]);var _0x4ae0a6=util[_0x8691('0x47')](_0x8691('0x4e'),_0x1650fd[_0x8691('0x4f')]);var _0x4888da=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1650fd[_0x8691('0x4c')],_0x29d926['uniqueid'],md5(_0x29d926[_0x8691('0x50')]));if(_0x279ffb&&_0x279ffb[_0x8691('0x51')]){logger['info'](_0x8691('0x52'),'Recording\x20is\x20enabled!');_0x29d926['recordingURL']=_0x4888da;}else if(_0x1b8896&&_0x1b8896[_0x8691('0x53')]&&_0x1b8896['recordingFormat']!==_0x8691('0x54')){logger[_0x8691('0x19')](_0x8691('0x55'),_0x8691('0x56'));_0x29d926[_0x8691('0x57')]=_0x4888da;}else{_0x29d926[_0x8691('0x57')]='';}return getUser(_0x398e10,_0x1650fd,_0x5756dc,_0x4ae0a6,_0x576f73,_0x2021b3)[_0x8691('0xe')](function(_0x3724b0){logger['info']('['+_0x2021b3[_0x8691('0x1a')]()+']\x20The\x20User\x20ID\x20is:',_0x3724b0[_0x8691('0x1c')]);logger[_0x8691('0x19')]('['+_0x2021b3[_0x8691('0x1a')]()+']\x20The\x20User\x20email\x20is:',_0x3724b0[_0x8691('0x16')]);return getEndUser(_0x3724b0,_0x1650fd,_0x4ae0a6,_0x576f73,_0x29d926,_0x2021b3);})['then'](function(_0x21a881){logger[_0x8691('0x19')]('['+_0x2021b3['toUpperCase']()+_0x8691('0x58'),_0x21a881[_0x8691('0x26')]);logger[_0x8691('0x19')]('['+_0x2021b3['toUpperCase']()+_0x8691('0x59'),_0x29d926[_0x8691('0x21')]);return getTicket(_0x21a881,_0x1650fd,_0x4ae0a6,_0x576f73,_0x29d926,_0x7d6339,_0x2021b3);})[_0x8691('0xe')](function(_0x24e5ac){logger[_0x8691('0x19')](util['format']('['+_0x2021b3['toUpperCase']()+_0x8691('0x5a'),_0x7d6339[_0x8691('0x3f')],_0x24e5ac[_0x8691('0x46')]));logger[_0x8691('0x19')](util[_0x8691('0x47')]('['+_0x2021b3[_0x8691('0x1a')]()+_0x8691('0x5b'),_0x2021b3));if(_0x2021b3!=='unmanaged'){logger[_0x8691('0x19')]('['+_0x2021b3[_0x8691('0x1a')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x1650fd['remoteUri'],_0x5756dc[_0x8691('0x5c')],_0x7d6339['ticketType'],_0x24e5ac[_0x8691('0x46')]);}})[_0x8691('0x27')](function(_0x417773){logger['error']('['+_0x2021b3[_0x8691('0x1a')]()+_0x8691('0x5d'),util[_0x8691('0x5e')](_0x417773,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa81e=['phonecall','phonecalls','callDirection','queue','odata-entityid','ticketId','format','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','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','localhost','POST','clientId','remoteUri','username','password','clientSecret','then','toUpperCase','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','message','toLowerCase','contacts','/systemusers(','headers','substring','lastIndexOf','outbound','calleridnum','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','telephone1','contactid',']\x20Enduser\x20created!','enduserId',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','customField','idField','indexOf','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xa81e,0xe8));var _0xea81=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa81e[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xea81('0x0'));var BPromise=require(_0xea81('0x1'));var rp=require(_0xea81('0x2'));var util=require(_0xea81('0x3'));var intUtil=require(_0xea81('0x4'));var md5=require(_0xea81('0x5'));var Redis=require(_0xea81('0x6'));var logger=require('../../../../config/logger')(_0xea81('0x7'));var config=require(_0xea81('0x8'));config[_0xea81('0x9')]=_['defaults'](config[_0xea81('0x9')],{'host':_0xea81('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xea81('0x9')]));function getAuthToken(_0x1374a1,_0x3a3dbf,_0x5645a2){var _0x44f130={'method':_0xea81('0xb'),'uri':_0x3a3dbf,'form':{'client_id':_0x1374a1[_0xea81('0xc')],'resource':_0x1374a1[_0xea81('0xd')],'username':_0x1374a1[_0xea81('0xe')],'password':_0x1374a1[_0xea81('0xf')],'grant_type':_0xea81('0xf'),'client_secret':_0x1374a1[_0xea81('0x10')]},'json':!![]};return rp(_0x44f130)[_0xea81('0x11')](function(_0x24b0e7){return _0x24b0e7['access_token'];})['catch'](function(_0x254910){logger['error']('['+[_0x5645a2[_0xea81('0x12')]()]+']\x20Wrong\x20credentials!');return _0x254910['message'];});}function getUser(_0x1ddb0c,_0x21cdc7,_0x30a105,_0x34203c,_0x2a5276,_0x45c2fb){return new BPromise(function(_0xfa78b6,_0x171a6e){return getAuthToken(_0x21cdc7,_0x34203c,_0x45c2fb)[_0xea81('0x11')](function(_0x3e645c){var _0x35470e={'method':'GET','uri':_0x2a5276+_0xea81('0x13'),'headers':{'Authorization':_0xea81('0x14')+_0x3e645c,'OData-Version':_0xea81('0x15')},'json':!![]};return rp(_0x35470e);})[_0xea81('0x11')](function(_0x3297de){var _0x37b5d0=_0x3297de[_0xea81('0x16')];var _0xd3185e=![];var _0xaf492d=null;if(!_[_0xea81('0x17')](_0x30a105)){if(intUtil[_0xea81('0x18')](_0x30a105[_0xea81('0x19')])){_0x1ddb0c[_0xea81('0x1a')]=_0x30a105[_0xea81('0x19')];for(_0xaf492d=0x0;_0xaf492d<_0x37b5d0[_0xea81('0x1b')];_0xaf492d++){if(_0x37b5d0[_0xaf492d][_0xea81('0x1c')]===_0x30a105[_0xea81('0x19')]&&!_0x37b5d0[_0xaf492d]['isdisabled']){_0xd3185e=!![];logger[_0xea81('0x1d')]('['+[_0x45c2fb['toUpperCase']()]+_0xea81('0x1e')+_0x37b5d0[_0xaf492d][_0xea81('0x1f')]+'!');_0x1ddb0c[_0xea81('0x20')]=_0x37b5d0[_0xaf492d]['systemuserid'];}}}}if(!_0xd3185e){logger[_0xea81('0x1d')]('['+[_0x45c2fb[_0xea81('0x12')]()]+_0xea81('0x21'));_0x1ddb0c[_0xea81('0x1a')]=_0x21cdc7[_0xea81('0xe')];for(_0xaf492d=0x0;_0xaf492d<_0x37b5d0[_0xea81('0x1b')];_0xaf492d++){if(_0x37b5d0[_0xaf492d][_0xea81('0x1c')]===_0x21cdc7[_0xea81('0xe')]){_0x1ddb0c[_0xea81('0x20')]=_0x37b5d0[_0xaf492d][_0xea81('0x1f')];}}}_0xfa78b6(_0x1ddb0c);})[_0xea81('0x22')](function(_0x2dcb20){_0x171a6e(_0x2dcb20[_0xea81('0x23')]);});});}function createEndUser(_0x2899c7,_0x31edff,_0x3c3686,_0x15cf04,_0x4d41ae,_0x1ebcc0){return new BPromise(function(_0x216485,_0x2046d0){return getAuthToken(_0x31edff,_0x3c3686,_0x1ebcc0)[_0xea81('0x11')](function(_0x507aed){var _0x3811fa=_0x1ebcc0[_0xea81('0x24')]()==='outbound'?_0x4d41ae['destcalleridnum']:_0x4d41ae['calleridnum'];var _0x3c30ef={'method':_0xea81('0xb'),'uri':_0x15cf04+_0xea81('0x25'),'body':{'telephone1':_0x3811fa,'fullname':_0x3811fa,'firstname':_0x3811fa,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xea81('0x26')+_0x2899c7[_0xea81('0x20')]+')'},'headers':{'Authorization':_0xea81('0x14')+_0x507aed,'OData-Version':_0xea81('0x15')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x3c30ef);})[_0xea81('0x11')](function(_0x4b3fd2){var _0x2a92eb=_0x4b3fd2[_0xea81('0x27')]['odata-entityid'];var _0x992772=_0x2a92eb[_0xea81('0x28')](_0x2a92eb[_0xea81('0x29')]('(')+0x1,_0x2a92eb[_0xea81('0x29')](')'));_0x2899c7['enduserId']=_0x992772;_0x216485(_0x2899c7);})[_0xea81('0x22')](function(_0x385017){_0x2046d0(_0x385017[_0xea81('0x23')]);});});}function getEndUser(_0x15223c,_0x46355d,_0x10008a,_0x2b71a5,_0x48a5d8,_0x900419){return new BPromise(function(_0x4df2d3,_0x55dd1c){var _0x4343e3=_0x900419['toLowerCase']()===_0xea81('0x2a')?_0x48a5d8['destcalleridnum']:_0x48a5d8[_0xea81('0x2b')];return getAuthToken(_0x46355d,_0x10008a,_0x900419)[_0xea81('0x11')](function(_0x2e7f94){var _0x1fa175={'method':_0xea81('0x2c'),'uri':_0x2b71a5+_0xea81('0x2d')+_0x4343e3['replace']('+','%2b')+'\x27','headers':{'Authorization':_0xea81('0x14')+_0x2e7f94,'If-None-Match':null,'OData-Version':_0xea81('0x15')},'json':!![]};return rp(_0x1fa175);})['then'](function(_0x2d32a8){var _0x2020b2=null;if(_0x2d32a8){var _0xc94314=_0x2d32a8[_0xea81('0x16')];var _0x16845b=![];for(_0x2020b2=0x0;_0x2020b2<_0xc94314[_0xea81('0x1b')];_0x2020b2++){if(_0xc94314[_0x2020b2][_0xea81('0x2e')]===_0x4343e3){_0x16845b=!![];_0x15223c['enduserId']=_0xc94314[_0x2020b2][_0xea81('0x2f')];}}if(_0x16845b){_0x4df2d3(_0x15223c);}else{return createEndUser(_0x15223c,_0x46355d,_0x10008a,_0x2b71a5,_0x48a5d8,_0x900419)[_0xea81('0x11')](function(_0xa4dba2){logger['info']('['+[_0x900419[_0xea81('0x12')]()]+_0xea81('0x30'),_0xa4dba2[_0xea81('0x31')]);_0x4df2d3(_0xa4dba2);});}}else{return createEndUser(_0x15223c,_0x46355d,_0x10008a,_0x2b71a5,_0x48a5d8,_0x900419)[_0xea81('0x11')](function(_0x62a829){logger[_0xea81('0x1d')]('['+[_0x900419['toUpperCase']()]+_0xea81('0x32'),_0x62a829[_0xea81('0x31')]);_0x4df2d3(_0x62a829);});}});});}function getCustomFields(_0x175984,_0x8afcf3,_0x571b94){var _0x16b813={};if(_0x175984[_0xea81('0x1b')]>0x0){_[_0xea81('0x33')](_0x175984,function(_0x2f4a57){if(_[_0xea81('0x34')]([_0xea81('0x35'),_0xea81('0x36')],_0x2f4a57[_0xea81('0x37')])&&_0x2f4a57['nameField']&&!_0x2f4a57[_0xea81('0x38')]){var _0x54c8b5=_0x2f4a57[_0xea81('0x39')][_0xea81('0x24')]();var _0x386122=_0x54c8b5[_0xea81('0x28')](0x0,_0x54c8b5[_0xea81('0x3a')]('_'));var _0x3d240e=_0x54c8b5['substring'](_0x54c8b5['indexOf']('_')+0x1);if(_0x386122===_0x571b94){_0x16b813[_0x3d240e]=_0x2f4a57['content'];}}});}return _0x16b813;}function getTicket(_0x5b46e2,_0x53a88e,_0x53fd06,_0x1d8e62,_0x1dbda2,_0x1eda4f,_0x52aca6){return new BPromise(function(_0x1b1d79,_0x32a060){var _0x3075ab;return getAuthToken(_0x53a88e,_0x53fd06,_0x52aca6)[_0xea81('0x11')](function(_0x561be7){if(_0x1eda4f[_0xea81('0x3b')]===_0xea81('0x3c')){_0x3075ab={'method':_0xea81('0xb'),'uri':_0x1d8e62+_0xea81('0x3d'),'body':Object[_0xea81('0x3e')]({},{'title':intUtil[_0xea81('0x3f')](_0x1eda4f[_0xea81('0x40')],_0x1dbda2,'\x20'),'description':intUtil[_0xea81('0x3f')](_0x1eda4f[_0xea81('0x41')],_0x1dbda2,'\x0a'),'customerid_contact@odata.bind':_0xea81('0x42')+_0x5b46e2[_0xea81('0x31')]+')','ownerid@odata.bind':_0xea81('0x26')+_0x5b46e2[_0xea81('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x1eda4f[_0xea81('0x43')],_0x1dbda2,_0x1eda4f[_0xea81('0x3b')])),'headers':{'Authorization':_0xea81('0x14')+_0x561be7,'OData-Version':_0xea81('0x15')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1eda4f['ticketType']===_0xea81('0x44')){_0x3075ab={'method':_0xea81('0xb'),'uri':_0x1d8e62+_0xea81('0x45'),'body':Object[_0xea81('0x3e')]({},{'subject':intUtil['getString'](_0x1eda4f['Subjects'],_0x1dbda2,'\x20'),'phonenumber':String(_0x1dbda2['calleridnum']),'description':intUtil[_0xea81('0x3f')](_0x1eda4f[_0xea81('0x41')],_0x1dbda2,'\x0a'),'regardingobjectid_contact@odata.bind':_0xea81('0x42')+_0x5b46e2['enduserId']+')','ownerid@odata.bind':_0xea81('0x26')+_0x5b46e2[_0xea81('0x20')]+')','directioncode':_0x5b46e2[_0xea81('0x46')]===_0xea81('0x47')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xea81('0x26')+_0x5b46e2[_0xea81('0x20')]+')','participationtypemask':_0x5b46e2[_0xea81('0x46')]===_0xea81('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0xea81('0x42')+_0x5b46e2[_0xea81('0x31')]+')','participationtypemask':_0x5b46e2[_0xea81('0x46')]===_0xea81('0x47')?0x1:0x2}]},getCustomFields(_0x1eda4f['Fields'],_0x1dbda2,_0x1eda4f[_0xea81('0x3b')])),'headers':{'Authorization':'Bearer\x20'+_0x561be7,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3075ab);})['then'](function(_0x3c1bac){var _0x114e8d=_0x3c1bac['headers'][_0xea81('0x48')];var _0x1da72a=_0x114e8d['substring'](_0x114e8d[_0xea81('0x29')]('(')+0x1,_0x114e8d[_0xea81('0x29')](')'));_0x5b46e2[_0xea81('0x49')]=_0x1da72a;_0x1b1d79(_0x5b46e2);})[_0xea81('0x22')](function(_0x7b6c9f){_0x32a060(_0x7b6c9f[_0xea81('0x23')]);});});}function emit(_0x243625,_0x2aaea1,_0x18d11b,_0x1816d9){var _0x4e1c77={'uri':util[_0xea81('0x4a')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x243625,_0x18d11b,_0x1816d9)};io['to'](util[_0xea81('0x4a')](_0xea81('0x4b'),_0x2aaea1))[_0xea81('0x4c')](_0xea81('0x4d'),_0x4e1c77);}exports['cs']=function(_0x17f3c5,_0x9f9c81,_0x3d2d38,_0xf68485,_0x1b4949,_0x281e15,_0x304434,_0xef88ba){var _0x292629={};_0x281e15[_0xea81('0xd')]=intUtil['stripTrailingSlash'](_0x281e15[_0xea81('0xd')]);_0x281e15['serverUrl']=intUtil[_0xea81('0x4e')](_0x281e15[_0xea81('0x4f')]);_0x292629['callDirection']=_0xef88ba===_0xea81('0x47')||_0xef88ba===_0xea81('0x50')?_0xea81('0x47'):_0xea81('0x2a');var _0x1d6143=util[_0xea81('0x4a')](_0xea81('0x51'),_0x281e15[_0xea81('0xd')]);var _0xf82ef8=util[_0xea81('0x4a')](_0xea81('0x52'),_0x281e15[_0xea81('0x53')]);var _0x1eccd6=util['format'](_0xea81('0x54'),_0x281e15[_0xea81('0x4f')],_0x9f9c81[_0xea81('0x55')],md5(_0x9f9c81[_0xea81('0x55')]));if(_0x1b4949&&_0x1b4949['monitor_format']){logger[_0xea81('0x1d')]('[QUEUE]',_0xea81('0x56'));_0x9f9c81[_0xea81('0x57')]=_0x1eccd6;}else if(_0x304434&&_0x304434[_0xea81('0x58')]&&_0x304434[_0xea81('0x58')]!=='none'){logger['info'](_0xea81('0x59'),'Recording\x20is\x20enabled!');_0x9f9c81[_0xea81('0x57')]=_0x1eccd6;}else{_0x9f9c81['recordingURL']='';}return getUser(_0x292629,_0x281e15,_0xf68485,_0xf82ef8,_0x1d6143,_0xef88ba)['then'](function(_0x56a806){logger[_0xea81('0x1d')]('['+_0xef88ba[_0xea81('0x12')]()+_0xea81('0x5a'),_0x56a806['userId']);logger[_0xea81('0x1d')]('['+_0xef88ba[_0xea81('0x12')]()+_0xea81('0x5b'),_0x56a806['userEmail']);return getEndUser(_0x56a806,_0x281e15,_0xf82ef8,_0x1d6143,_0x9f9c81,_0xef88ba);})[_0xea81('0x11')](function(_0x18e2cd){logger[_0xea81('0x1d')]('['+_0xef88ba['toUpperCase']()+_0xea81('0x5c'),_0x18e2cd['enduserId']);logger[_0xea81('0x1d')]('['+_0xef88ba[_0xea81('0x12')]()+_0xea81('0x5d'),_0x9f9c81[_0xea81('0x2b')]);return getTicket(_0x18e2cd,_0x281e15,_0xf82ef8,_0x1d6143,_0x9f9c81,_0x3d2d38,_0xef88ba);})[_0xea81('0x11')](function(_0xf94482){logger[_0xea81('0x1d')](util[_0xea81('0x4a')]('['+_0xef88ba[_0xea81('0x12')]()+_0xea81('0x5e'),_0x3d2d38['ticketType'],_0xf94482[_0xea81('0x49')]));logger['info'](util[_0xea81('0x4a')]('['+_0xef88ba[_0xea81('0x12')]()+_0xea81('0x5f'),_0xef88ba));if(_0xef88ba!==_0xea81('0x50')){logger['info']('['+_0xef88ba[_0xea81('0x12')]()+']',_0xea81('0x60'));emit(_0x281e15[_0xea81('0xd')],_0xf68485['name'],_0x3d2d38[_0xea81('0x3b')],_0xf94482[_0xea81('0x49')]);}})[_0xea81('0x22')](function(_0x20d9dd){logger[_0xea81('0x61')]('['+_0xef88ba[_0xea81('0x12')]()+_0xea81('0x62'),util[_0xea81('0x63')](_0x20d9dd,{'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 66d01e6..2cd799b 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 _0x5e14=['map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','toString','customField','push','idField','variable','variableName','customVariable','Variable','queue','serverUrl','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','catch','error','unmanaged','monitor_format','toUpperCase','lastevent','request-promise','md5','util','ioredis','./util','../../../../config/logger','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','info','merge','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','[HTTP]','stringify'];(function(_0x5e03fc,_0x1b5ed7){var _0x116ada=function(_0x1bb90e){while(--_0x1bb90e){_0x5e03fc['push'](_0x5e03fc['shift']());}};_0x116ada(++_0x1b5ed7);}(_0x5e14,0x89));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0x45e1('0x0'));var md5=require(_0x45e1('0x1'));var util=require(_0x45e1('0x2'));var Redis=require(_0x45e1('0x3'));var intUtil=require(_0x45e1('0x4'));var config=require('../../../../config/environment');var logger=require(_0x45e1('0x5'))(_0x45e1('0x6'));config['redis']=_[_0x45e1('0x7')](config[_0x45e1('0x8')],{'host':_0x45e1('0x9'),'port':0x18eb});var io=require(_0x45e1('0xa'))(new Redis(config[_0x45e1('0x8')]));var headers={'Content-Type':_0x45e1('0xb'),'Accept':_0x45e1('0xb')};function emit(_0x375736,_0x14440a,_0x6a9ffe){io['to'](_0x375736)['emit'](_0x14440a,_0x6a9ffe);}function getTicket(_0x2a17c8,_0x3eaf2e,_0x3c68f9,_0x28aefe,_0x1e8a63){logger[_0x45e1('0xc')]('Creating\x20new\x20ticket...');var _0x18dfca=_[_0x45e1('0xd')]({'responder_id':_0x3eaf2e['id'],'requester_id':_0x3c68f9['id'],'name':util['format'](_0x45e1('0xe'),_0x1e8a63[_0x45e1('0xf')]),'phone':_0x1e8a63[_0x45e1('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x28aefe[_0x45e1('0x11')],_0x1e8a63,'\x20'),'description':intUtil[_0x45e1('0x12')](_0x28aefe[_0x45e1('0x13')],_0x1e8a63,_0x45e1('0x14')),'tags':getTags(_0x28aefe[_0x45e1('0x15')],_0x45e1('0x16'))},getCustomFields(_0x28aefe[_0x45e1('0x17')],_0x1e8a63));_0x18dfca[_0x45e1('0x18')]=_[_0x45e1('0x19')](_[_0x45e1('0x1a')](_0x18dfca['custom_fields'],'id'),_0x45e1('0x1b'));return request({'uri':util[_0x45e1('0x1c')](_0x45e1('0x1d'),_0x2a17c8[_0x45e1('0x1e')]),'method':'POST','body':_0x18dfca})[_0x45e1('0x1f')](function(_0x1b3f5d){logger[_0x45e1('0xc')](_0x45e1('0x20'));return _0x1b3f5d;});}function getUser(_0x669827,_0x392070){if(intUtil[_0x45e1('0x21')](_0x392070)){return request({'uri':util[_0x45e1('0x1c')]('%s/api/v2/agents',_0x669827[_0x45e1('0x1e')]),'qs':{'email':_0x392070}})[_0x45e1('0x1f')](function(_0x1bc0b3){if(_0x1bc0b3[_0x45e1('0x22')]){logger['info'](_0x45e1('0x23'));return _[_0x45e1('0x24')](_0x1bc0b3,function(_0x2d99de){return _0x2d99de['contact']['email']===_0x392070;});}else{logger[_0x45e1('0xc')](_0x45e1('0x25'));return request({'uri':util[_0x45e1('0x1c')](_0x45e1('0x26'),_0x669827[_0x45e1('0x1e')])})[_0x45e1('0x1f')](function(_0x2ffea9){logger[_0x45e1('0xc')](_0x45e1('0x27'));return _0x2ffea9;});}});}else{logger[_0x45e1('0xc')](_0x45e1('0x28'));return request({'uri':util[_0x45e1('0x1c')](_0x45e1('0x26'),_0x669827[_0x45e1('0x1e')])})[_0x45e1('0x1f')](function(_0x20cc4b){logger['info'](_0x45e1('0x27'));return _0x20cc4b;});}}function getEndUser(_0x18c57a,_0xdf57e0,_0x1c5ab){logger['info'](_0x45e1('0x29'),_0x1c5ab);return request({'uri':util[_0x45e1('0x1c')]('%s/api/v2/contacts',_0x18c57a[_0x45e1('0x1e')]),'qs':{'phone':_0x1c5ab}})[_0x45e1('0x1f')](function(_0x183fed){if(_0x183fed[_0x45e1('0x22')]){logger[_0x45e1('0xc')]('Enduser\x20found!');return _[_0x45e1('0x24')](_0x183fed,{'phone':_0x1c5ab});}else{logger[_0x45e1('0xc')](_0x45e1('0x2a'));return request({'uri':util[_0x45e1('0x1c')](_0x45e1('0x2b'),_0x18c57a[_0x45e1('0x1e')]),'method':'POST','body':{'name':_0xdf57e0,'phone':_0x1c5ab}})['then'](function(_0x1dac76){logger['info'](_0x45e1('0x2c'));return _0x1dac76;});}});}function getAuth(_0x434fc7){return util[_0x45e1('0x1c')](_0x45e1('0x2d'),new Buffer(_0x434fc7[_0x45e1('0x2e')]+':X')['toString']('base64'));}function request(_0x4f6d34){logger['debug'](_0x45e1('0x2f'),JSON[_0x45e1('0x30')](_0x4f6d34));return rp(_['defaults'](_0x4f6d34,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x516553,_0x2cf4be){var _0x55fe10=[];if(_0x516553&&_0x516553['length']>0x0){_0x55fe10=_[_0x45e1('0x31')](_0x516553,_0x2cf4be);}return _0x55fe10;}function getCustomFields(_0x435297,_0x423147){var _0x52f56c=[];var _0x239d10={'custom_fields':[]};if(_0x435297[_0x45e1('0x22')]>0x0){_[_0x45e1('0x32')](_0x435297,function(_0x46a91c){if(_[_0x45e1('0x33')]([_0x45e1('0x34'),_0x45e1('0x35')],_0x46a91c[_0x45e1('0x36')])&&_0x46a91c[_0x45e1('0x37')]&&!_0x46a91c['customField']){_0x239d10[_0x46a91c[_0x45e1('0x37')][_0x45e1('0x38')]()]=_0x46a91c[_0x45e1('0x39')][_0x45e1('0x3a')]();}else if(_[_0x45e1('0x33')]([_0x45e1('0x34'),_0x45e1('0x35')],_0x46a91c['type'])&&_0x46a91c['idField']&&_0x46a91c[_0x45e1('0x3b')]){_0x239d10[_0x45e1('0x18')][_0x45e1('0x3c')]({'id':_0x46a91c[_0x45e1('0x3d')],'value':_0x46a91c[_0x45e1('0x39')]['toString']()});}else if(_0x46a91c[_0x45e1('0x36')]===_0x45e1('0x3e')&&_0x46a91c[_0x45e1('0x3f')]&&_0x46a91c[_0x45e1('0x3d')]&&_0x46a91c[_0x45e1('0x3b')]){_0x423147[_0x46a91c[_0x45e1('0x3f')]]&&_0x239d10[_0x45e1('0x18')][_0x45e1('0x3c')]({'id':_0x46a91c['idField'],'value':_0x423147[_0x46a91c[_0x45e1('0x3f')]][_0x45e1('0x3a')]()});}else if(_0x46a91c[_0x45e1('0x36')]===_0x45e1('0x40')&&_0x46a91c['Variable']&&_0x46a91c[_0x45e1('0x41')][_0x45e1('0x16')]&&_0x46a91c[_0x45e1('0x3d')]&&_0x46a91c[_0x45e1('0x3b')]){_0x423147[_0x46a91c['Variable'][_0x45e1('0x16')][_0x45e1('0x38')]()]&&_0x239d10[_0x45e1('0x18')][_0x45e1('0x3c')]({'id':_0x46a91c[_0x45e1('0x3d')],'value':_0x423147[_0x46a91c['Variable'][_0x45e1('0x16')]['toLowerCase']()]['toString']()});}});}return _0x239d10;}exports[_0x45e1('0x42')]=function(_0x4f3c62,_0x3fe9ea,_0x11779c,_0x38e352,_0x5dac2e,_0x13e921){var _0x4c436e,_0x43f21d;_0x13e921[_0x45e1('0x1e')]=intUtil['stripTrailingSlash'](_0x13e921[_0x45e1('0x1e')]);_0x13e921[_0x45e1('0x43')]=intUtil['stripTrailingSlash'](_0x13e921[_0x45e1('0x43')]);if(_0x5dac2e&&_0x5dac2e['monitor_format']){logger[_0x45e1('0xc')](_0x45e1('0x44'),'Recording\x20is\x20enabled!');_0x3fe9ea['recordingURL']=util[_0x45e1('0x1c')](_0x45e1('0x45'),_0x13e921[_0x45e1('0x43')],_0x3fe9ea[_0x45e1('0x46')],md5(_0x3fe9ea[_0x45e1('0x46')]));}else{_0x3fe9ea[_0x45e1('0x47')]='';}headers[_0x45e1('0x48')]=getAuth(_0x13e921);return getUser(_0x13e921,_0x38e352[_0x45e1('0x49')])[_0x45e1('0x1f')](function(_0xc4e75d){_0x4c436e=_0xc4e75d;logger[_0x45e1('0xc')]('The\x20User\x20ID\x20is:',_0x4c436e['id']);return getEndUser(_0x13e921,_0x3fe9ea[_0x45e1('0xf')],_0x3fe9ea[_0x45e1('0x10')]);})[_0x45e1('0x1f')](function(_0xf478f6){_0x43f21d=_0xf478f6;logger[_0x45e1('0xc')](_0x45e1('0x4a'),_0x43f21d['id']);return getTicket(_0x13e921,_0x4c436e,_0x43f21d,_0x11779c,_0x3fe9ea);})[_0x45e1('0x1f')](function(_0x2171d2){if(_0x2171d2&&_0x2171d2['id']){logger['info'](_0x45e1('0x20'));logger[_0x45e1('0xc')](_0x45e1('0x4b'),_0x2171d2['id']);logger[_0x45e1('0xc')](_0x45e1('0x44'),_0x45e1('0x4c'));emit(util[_0x45e1('0x1c')](_0x45e1('0x4d'),_0x38e352[_0x45e1('0x16')]),_0x45e1('0x4e'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x13e921['remoteUri'],_0x2171d2['id'])});}})['catch'](function(_0x3e86ff){logger['error'](_0x45e1('0x44'),JSON[_0x45e1('0x30')](_0x3e86ff));});};exports[_0x45e1('0x4f')]=function(_0x41a67b,_0x270a7a,_0x2edbb4,_0x3bb458,_0x4fb040,_0x4dc295,_0x254f79){var _0x365a0d,_0x1c218;_0x4dc295['remoteUri']=intUtil[_0x45e1('0x50')](_0x4dc295[_0x45e1('0x1e')]);_0x4dc295[_0x45e1('0x43')]=intUtil[_0x45e1('0x50')](_0x4dc295[_0x45e1('0x43')]);if(_0x254f79&&_0x254f79['recordingFormat']&&_0x254f79[_0x45e1('0x51')]!==_0x45e1('0x52')){logger[_0x45e1('0xc')](_0x45e1('0x53'),_0x45e1('0x54'));_0x270a7a['recordingURL']=util[_0x45e1('0x1c')](_0x45e1('0x45'),_0x4dc295[_0x45e1('0x43')],_0x270a7a['uniqueid'],md5(_0x270a7a[_0x45e1('0x46')]));}headers[_0x45e1('0x48')]=getAuth(_0x4dc295);return getUser(_0x4dc295,_0x3bb458[_0x45e1('0x49')])[_0x45e1('0x1f')](function(_0x3f8a12){_0x365a0d=_0x3f8a12;logger['info'](_0x45e1('0x55'),_0x365a0d['id']);return getEndUser(_0x4dc295,_0x270a7a[_0x45e1('0x56')],_0x270a7a['destcalleridnum']);})[_0x45e1('0x1f')](function(_0x5deeda){_0x1c218=_0x5deeda;logger['info'](_0x45e1('0x4a'),_0x1c218['id']);return getTicket(_0x4dc295,_0x365a0d,_0x1c218,_0x2edbb4,_0x270a7a);})[_0x45e1('0x1f')](function(_0x33f666){if(_0x33f666&&_0x33f666['id']){logger[_0x45e1('0xc')](_0x45e1('0x20'));logger[_0x45e1('0xc')](_0x45e1('0x4b'),_0x33f666['id']);logger[_0x45e1('0xc')](_0x45e1('0x53'),_0x45e1('0x4c'));emit(util[_0x45e1('0x1c')](_0x45e1('0x4d'),_0x3bb458[_0x45e1('0x16')]),_0x45e1('0x4e'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x4dc295[_0x45e1('0x1e')],_0x33f666['id'])});}})[_0x45e1('0x57')](function(_0x461037){logger[_0x45e1('0x58')]('[OUTBOUND]',JSON[_0x45e1('0x30')](_0x461037));});};exports[_0x45e1('0x59')]=function(_0x4df973,_0x307acd,_0x293650,_0x1862b6,_0x52b0de,_0x1b1467){var _0xcb690a,_0x2ac239;_0x1b1467[_0x45e1('0x1e')]=intUtil[_0x45e1('0x50')](_0x1b1467['remoteUri']);_0x1b1467[_0x45e1('0x43')]=intUtil[_0x45e1('0x50')](_0x1b1467[_0x45e1('0x43')]);if(_0x52b0de&&_0x52b0de[_0x45e1('0x5a')]){logger[_0x45e1('0xc')]('['+_0x307acd['lastevent'][_0x45e1('0x5b')]()+']',_0x45e1('0x54'));_0x307acd['recordingURL']=util[_0x45e1('0x1c')](_0x45e1('0x45'),_0x1b1467[_0x45e1('0x43')],_0x307acd[_0x45e1('0x46')],md5(_0x307acd[_0x45e1('0x46')]));}else{_0x307acd[_0x45e1('0x47')]='';}headers['Authorization']=getAuth(_0x1b1467);return getUser(_0x1b1467,'')[_0x45e1('0x1f')](function(_0xc58b38){_0xcb690a=_0xc58b38;logger[_0x45e1('0xc')]('The\x20User\x20ID\x20is:',_0xcb690a['id']);return getEndUser(_0x1b1467,_0x307acd[_0x45e1('0xf')],_0x307acd['calleridnum']);})[_0x45e1('0x1f')](function(_0x66de64){_0x2ac239=_0x66de64;logger[_0x45e1('0xc')](_0x45e1('0x4a'),_0x2ac239['id']);return getTicket(_0x1b1467,_0xcb690a,_0x2ac239,_0x293650,_0x307acd);})['then'](function(_0x40e814){if(_0x40e814){logger[_0x45e1('0xc')](_0x45e1('0x20'));logger['info'](_0x45e1('0x4b'),_0x40e814['id']);}})[_0x45e1('0x57')](function(_0x3d3512){logger[_0x45e1('0x58')]('['+_0x307acd[_0x45e1('0x5c')][_0x45e1('0x5b')]()+']',JSON['stringify'](_0x3d3512));});}; \ No newline at end of file +var _0x4b04=['includes','type','idField','push','variableName','Variable','name','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','stringify','unmanaged','lastevent','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','
','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','POST','Basic\x20%s','toString','base64','debug','map','forEach','string','picklist','nameField','customField','content'];(function(_0x2de8f1,_0x3683f0){var _0x42eb5b=function(_0xbc047f){while(--_0xbc047f){_0x2de8f1['push'](_0x2de8f1['shift']());}};_0x42eb5b(++_0x3683f0);}(_0x4b04,0x19c));var _0x44b0=function(_0x155f23,_0x3597b4){_0x155f23=_0x155f23-0x0;var _0x487f07=_0x4b04[_0x155f23];return _0x487f07;};'use strict';var _=require(_0x44b0('0x0'));var rp=require(_0x44b0('0x1'));var md5=require('md5');var util=require(_0x44b0('0x2'));var Redis=require(_0x44b0('0x3'));var intUtil=require(_0x44b0('0x4'));var config=require(_0x44b0('0x5'));var logger=require(_0x44b0('0x6'))('freshdesk');config[_0x44b0('0x7')]=_[_0x44b0('0x8')](config[_0x44b0('0x7')],{'host':_0x44b0('0x9'),'port':0x18eb});var io=require(_0x44b0('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0x44b0('0xb'),'Accept':_0x44b0('0xb')};function emit(_0x27aaf2,_0xf09c9d,_0x1960b6){io['to'](_0x27aaf2)[_0x44b0('0xc')](_0xf09c9d,_0x1960b6);}function getTicket(_0x22891a,_0x256bbf,_0x44dcff,_0x1ec44a,_0x5c7b47){logger[_0x44b0('0xd')](_0x44b0('0xe'));var _0x177cd6=_[_0x44b0('0xf')]({'responder_id':_0x256bbf['id'],'requester_id':_0x44dcff['id'],'name':util['format'](_0x44b0('0x10'),_0x5c7b47[_0x44b0('0x11')]),'phone':_0x5c7b47[_0x44b0('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x1ec44a[_0x44b0('0x13')],_0x5c7b47,'\x20'),'description':intUtil[_0x44b0('0x14')](_0x1ec44a[_0x44b0('0x15')],_0x5c7b47,_0x44b0('0x16')),'tags':getTags(_0x1ec44a['Tags'],'name')},getCustomFields(_0x1ec44a[_0x44b0('0x17')],_0x5c7b47));_0x177cd6[_0x44b0('0x18')]=_[_0x44b0('0x19')](_[_0x44b0('0x1a')](_0x177cd6[_0x44b0('0x18')],'id'),_0x44b0('0x1b'));return request({'uri':util[_0x44b0('0x1c')](_0x44b0('0x1d'),_0x22891a[_0x44b0('0x1e')]),'method':'POST','body':_0x177cd6})[_0x44b0('0x1f')](function(_0x1862ef){logger[_0x44b0('0xd')](_0x44b0('0x20'));return _0x1862ef;});}function getUser(_0x13275b,_0x556258){if(intUtil[_0x44b0('0x21')](_0x556258)){return request({'uri':util[_0x44b0('0x1c')](_0x44b0('0x22'),_0x13275b[_0x44b0('0x1e')]),'qs':{'email':_0x556258}})['then'](function(_0x5572e4){if(_0x5572e4[_0x44b0('0x23')]){logger[_0x44b0('0xd')](_0x44b0('0x24'));return _[_0x44b0('0x25')](_0x5572e4,function(_0x2ca4b1){return _0x2ca4b1['contact'][_0x44b0('0x26')]===_0x556258;});}else{logger[_0x44b0('0xd')](_0x44b0('0x27'));return request({'uri':util[_0x44b0('0x1c')](_0x44b0('0x28'),_0x13275b[_0x44b0('0x1e')])})[_0x44b0('0x1f')](function(_0xaba5f7){logger[_0x44b0('0xd')](_0x44b0('0x29'));return _0xaba5f7;});}});}else{logger['info'](_0x44b0('0x2a'));return request({'uri':util['format'](_0x44b0('0x28'),_0x13275b[_0x44b0('0x1e')])})[_0x44b0('0x1f')](function(_0x3ed7a8){logger[_0x44b0('0xd')](_0x44b0('0x29'));return _0x3ed7a8;});}}function getEndUser(_0xc0ca69,_0x58418b,_0x5d3522){logger[_0x44b0('0xd')](_0x44b0('0x2b'),_0x5d3522);return request({'uri':util[_0x44b0('0x1c')](_0x44b0('0x2c'),_0xc0ca69[_0x44b0('0x1e')]),'qs':{'phone':_0x5d3522}})['then'](function(_0x4ece81){if(_0x4ece81['length']){logger[_0x44b0('0xd')](_0x44b0('0x2d'));return _[_0x44b0('0x25')](_0x4ece81,{'phone':_0x5d3522});}else{logger[_0x44b0('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x44b0('0x1c')](_0x44b0('0x2c'),_0xc0ca69[_0x44b0('0x1e')]),'method':_0x44b0('0x2e'),'body':{'name':_0x58418b,'phone':_0x5d3522}})[_0x44b0('0x1f')](function(_0x33787c){logger[_0x44b0('0xd')]('Enduser\x20created.');return _0x33787c;});}});}function getAuth(_0x57310e){return util[_0x44b0('0x1c')](_0x44b0('0x2f'),new Buffer(_0x57310e['apiKey']+':X')[_0x44b0('0x30')](_0x44b0('0x31')));}function request(_0x3f100a){logger[_0x44b0('0x32')]('[HTTP]',JSON['stringify'](_0x3f100a));return rp(_[_0x44b0('0x8')](_0x3f100a,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0xfdc927,_0xcf4755){var _0x101ca9=[];if(_0xfdc927&&_0xfdc927['length']>0x0){_0x101ca9=_[_0x44b0('0x33')](_0xfdc927,_0xcf4755);}return _0x101ca9;}function getCustomFields(_0x219271,_0x5a7922){var _0x385365=[];var _0x2f9f90={'custom_fields':[]};if(_0x219271[_0x44b0('0x23')]>0x0){_[_0x44b0('0x34')](_0x219271,function(_0x11771c){if(_['includes']([_0x44b0('0x35'),_0x44b0('0x36')],_0x11771c['type'])&&_0x11771c[_0x44b0('0x37')]&&!_0x11771c[_0x44b0('0x38')]){_0x2f9f90[_0x11771c[_0x44b0('0x37')]['toLowerCase']()]=_0x11771c[_0x44b0('0x39')][_0x44b0('0x30')]();}else if(_[_0x44b0('0x3a')]([_0x44b0('0x35'),_0x44b0('0x36')],_0x11771c[_0x44b0('0x3b')])&&_0x11771c[_0x44b0('0x3c')]&&_0x11771c[_0x44b0('0x38')]){_0x2f9f90[_0x44b0('0x18')][_0x44b0('0x3d')]({'id':_0x11771c[_0x44b0('0x3c')],'value':_0x11771c[_0x44b0('0x39')][_0x44b0('0x30')]()});}else if(_0x11771c['type']==='variable'&&_0x11771c[_0x44b0('0x3e')]&&_0x11771c[_0x44b0('0x3c')]&&_0x11771c['customField']){_0x5a7922[_0x11771c[_0x44b0('0x3e')]]&&_0x2f9f90[_0x44b0('0x18')]['push']({'id':_0x11771c[_0x44b0('0x3c')],'value':_0x5a7922[_0x11771c['variableName']][_0x44b0('0x30')]()});}else if(_0x11771c[_0x44b0('0x3b')]==='customVariable'&&_0x11771c[_0x44b0('0x3f')]&&_0x11771c[_0x44b0('0x3f')]['name']&&_0x11771c[_0x44b0('0x3c')]&&_0x11771c[_0x44b0('0x38')]){_0x5a7922[_0x11771c[_0x44b0('0x3f')][_0x44b0('0x40')][_0x44b0('0x41')]()]&&_0x2f9f90['custom_fields']['push']({'id':_0x11771c[_0x44b0('0x3c')],'value':_0x5a7922[_0x11771c[_0x44b0('0x3f')][_0x44b0('0x40')]['toLowerCase']()]['toString']()});}});}return _0x2f9f90;}exports[_0x44b0('0x42')]=function(_0xd0a0b7,_0x524ceb,_0x3ed256,_0x28bb1b,_0x165dce,_0x2a0251){var _0x58013d,_0x290741;_0x2a0251[_0x44b0('0x1e')]=intUtil[_0x44b0('0x43')](_0x2a0251[_0x44b0('0x1e')]);_0x2a0251[_0x44b0('0x44')]=intUtil[_0x44b0('0x43')](_0x2a0251[_0x44b0('0x44')]);if(_0x165dce&&_0x165dce[_0x44b0('0x45')]){logger[_0x44b0('0xd')](_0x44b0('0x46'),_0x44b0('0x47'));_0x524ceb[_0x44b0('0x48')]=util[_0x44b0('0x1c')](_0x44b0('0x49'),_0x2a0251[_0x44b0('0x44')],_0x524ceb[_0x44b0('0x4a')],md5(_0x524ceb[_0x44b0('0x4a')]));}else{_0x524ceb['recordingURL']='';}headers['Authorization']=getAuth(_0x2a0251);return getUser(_0x2a0251,_0x28bb1b['email'])[_0x44b0('0x1f')](function(_0x4ec8ee){_0x58013d=_0x4ec8ee;logger[_0x44b0('0xd')](_0x44b0('0x4b'),_0x58013d['id']);return getEndUser(_0x2a0251,_0x524ceb['calleridname'],_0x524ceb[_0x44b0('0x12')]);})['then'](function(_0x126250){_0x290741=_0x126250;logger['info'](_0x44b0('0x4c'),_0x290741['id']);return getTicket(_0x2a0251,_0x58013d,_0x290741,_0x3ed256,_0x524ceb);})[_0x44b0('0x1f')](function(_0xe683ce){if(_0xe683ce&&_0xe683ce['id']){logger['info'](_0x44b0('0x20'));logger[_0x44b0('0xd')](_0x44b0('0x4d'),_0xe683ce['id']);logger[_0x44b0('0xd')](_0x44b0('0x46'),_0x44b0('0x4e'));emit(util['format'](_0x44b0('0x4f'),_0x28bb1b['name']),_0x44b0('0x50'),{'uri':util[_0x44b0('0x1c')](_0x44b0('0x51'),_0x2a0251['remoteUri'],_0xe683ce['id'])});}})[_0x44b0('0x52')](function(_0x2f7e3b){logger[_0x44b0('0x53')]('[QUEUE]',JSON['stringify'](_0x2f7e3b));});};exports[_0x44b0('0x54')]=function(_0x4e6fb8,_0xccb6ee,_0x4366f3,_0x232c8c,_0x2d32fd,_0x133750,_0x127f06){var _0xaad8e3,_0xc55260;_0x133750[_0x44b0('0x1e')]=intUtil['stripTrailingSlash'](_0x133750['remoteUri']);_0x133750[_0x44b0('0x44')]=intUtil['stripTrailingSlash'](_0x133750[_0x44b0('0x44')]);if(_0x127f06&&_0x127f06[_0x44b0('0x55')]&&_0x127f06[_0x44b0('0x55')]!=='none'){logger['info'](_0x44b0('0x56'),_0x44b0('0x47'));_0xccb6ee[_0x44b0('0x48')]=util[_0x44b0('0x1c')](_0x44b0('0x49'),_0x133750[_0x44b0('0x44')],_0xccb6ee[_0x44b0('0x4a')],md5(_0xccb6ee[_0x44b0('0x4a')]));}headers[_0x44b0('0x57')]=getAuth(_0x133750);return getUser(_0x133750,_0x232c8c[_0x44b0('0x26')])['then'](function(_0x12aca4){_0xaad8e3=_0x12aca4;logger[_0x44b0('0xd')]('The\x20User\x20ID\x20is:',_0xaad8e3['id']);return getEndUser(_0x133750,_0xccb6ee[_0x44b0('0x58')],_0xccb6ee[_0x44b0('0x59')]);})[_0x44b0('0x1f')](function(_0x5955fc){_0xc55260=_0x5955fc;logger[_0x44b0('0xd')](_0x44b0('0x4c'),_0xc55260['id']);return getTicket(_0x133750,_0xaad8e3,_0xc55260,_0x4366f3,_0xccb6ee);})[_0x44b0('0x1f')](function(_0x3cbce1){if(_0x3cbce1&&_0x3cbce1['id']){logger['info'](_0x44b0('0x20'));logger[_0x44b0('0xd')]('The\x20Ticket\x20ID\x20is:',_0x3cbce1['id']);logger[_0x44b0('0xd')](_0x44b0('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x44b0('0x1c')](_0x44b0('0x4f'),_0x232c8c[_0x44b0('0x40')]),_0x44b0('0x50'),{'uri':util[_0x44b0('0x1c')]('%s/helpdesk/tickets/%d',_0x133750['remoteUri'],_0x3cbce1['id'])});}})[_0x44b0('0x52')](function(_0x4eddc7){logger[_0x44b0('0x53')](_0x44b0('0x56'),JSON[_0x44b0('0x5a')](_0x4eddc7));});};exports[_0x44b0('0x5b')]=function(_0x187389,_0x3fe74d,_0x2551ab,_0x42480b,_0x4c2577,_0x1cef02){var _0x3ed838,_0x1cb7eb;_0x1cef02[_0x44b0('0x1e')]=intUtil[_0x44b0('0x43')](_0x1cef02[_0x44b0('0x1e')]);_0x1cef02[_0x44b0('0x44')]=intUtil[_0x44b0('0x43')](_0x1cef02[_0x44b0('0x44')]);if(_0x4c2577&&_0x4c2577[_0x44b0('0x45')]){logger[_0x44b0('0xd')]('['+_0x3fe74d[_0x44b0('0x5c')][_0x44b0('0x5d')]()+']',_0x44b0('0x47'));_0x3fe74d[_0x44b0('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1cef02[_0x44b0('0x44')],_0x3fe74d[_0x44b0('0x4a')],md5(_0x3fe74d[_0x44b0('0x4a')]));}else{_0x3fe74d[_0x44b0('0x48')]='';}headers[_0x44b0('0x57')]=getAuth(_0x1cef02);return getUser(_0x1cef02,'')[_0x44b0('0x1f')](function(_0xc77c06){_0x3ed838=_0xc77c06;logger[_0x44b0('0xd')](_0x44b0('0x4b'),_0x3ed838['id']);return getEndUser(_0x1cef02,_0x3fe74d[_0x44b0('0x11')],_0x3fe74d[_0x44b0('0x12')]);})[_0x44b0('0x1f')](function(_0x35750b){_0x1cb7eb=_0x35750b;logger[_0x44b0('0xd')](_0x44b0('0x4c'),_0x1cb7eb['id']);return getTicket(_0x1cef02,_0x3ed838,_0x1cb7eb,_0x2551ab,_0x3fe74d);})[_0x44b0('0x1f')](function(_0x376dc4){if(_0x376dc4){logger['info'](_0x44b0('0x20'));logger[_0x44b0('0xd')]('The\x20Ticket\x20ID\x20is:',_0x376dc4['id']);}})[_0x44b0('0x52')](function(_0x1a852b){logger[_0x44b0('0x53')]('['+_0x3fe74d['lastevent'][_0x44b0('0x5d')]()+']',JSON['stringify'](_0x1a852b));});}; \ 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 ace418e..87d8c63 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 _0xe167=['Getting\x20admin\x20information','then','users','length','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','GET','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','email','User\x20found:','userId','Admin\x20selected','userEmail','adminEmail','message','&f=','&entities=contact','contacts','contactNumber','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','add','format','ticketId','Task\x20created:','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','name','lodash','request-promise','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','/api/selector/owners','headers','info'];(function(_0x4a38ee,_0x5a5a4c){var _0xbb52f=function(_0x597f25){while(--_0x597f25){_0x4a38ee['push'](_0x4a38ee['shift']());}};_0xbb52f(++_0x5a5a4c);}(_0xe167,0x8c));var _0x7e16=function(_0x49e73e,_0x818404){_0x49e73e=_0x49e73e-0x0;var _0x3b1741=_0xe167[_0x49e73e];return _0x3b1741;};'use strict';var _=require(_0x7e16('0x0'));var rp=require(_0x7e16('0x1'));var md5=require('md5');var util=require(_0x7e16('0x2'));var moment=require(_0x7e16('0x3'));var Promise=require(_0x7e16('0x4'));var Redis=require(_0x7e16('0x5'));var intUtil=require(_0x7e16('0x6'));var config=require(_0x7e16('0x7'));var logger=require(_0x7e16('0x8'))(_0x7e16('0x9'));config[_0x7e16('0xa')]=_[_0x7e16('0xb')](config[_0x7e16('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x7e16('0xc'))(new Redis(config[_0x7e16('0xa')]));function getAdminId(_0x5b1919,_0x2fc284,_0x5db8c0,_0x362a6f){return new Promise(function(_0x2167f7,_0xa8d6f1){var _0x1de89b=![];var _0x14c730={'method':'GET','uri':_0x362a6f+_0x7e16('0xd'),'json':!![]};_0x14c730[_0x7e16('0xe')]=_0x5db8c0;logger[_0x7e16('0xf')](_0x7e16('0x10'));return rp(_0x14c730)[_0x7e16('0x11')](function(_0x2d4206){if(_0x2d4206){var _0x1cf0d0=_0x2d4206[_0x7e16('0x12')];var _0x455124=null;for(_0x455124=0x0;_0x455124<_0x1cf0d0[_0x7e16('0x13')];_0x455124++){if(_0x1cf0d0[_0x455124]['email']===_0x5b1919['adminEmail']){_0x5b1919[_0x7e16('0x14')]=_0x1cf0d0[_0x455124]['id'];_0x1de89b=!![];}}if(_0x1de89b){logger[_0x7e16('0xf')](_0x7e16('0x15'),_0x5b1919[_0x7e16('0x14')]);_0x2167f7(_0x5b1919);}else{_0xa8d6f1({'statusCode':0x194,'message':_0x7e16('0x16')});}}else{_0xa8d6f1({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x7e16('0x17')](function(_0x3bcbcb){logger[_0x7e16('0x18')]('['+[_0x2fc284[_0x7e16('0x19')]()]+']',_0x3bcbcb['message']);_0xa8d6f1(_0x3bcbcb);});});}function getUser(_0x4561ad,_0x3107a8,_0x1b84ad){return function(_0x38b3f7){return new Promise(function(_0x271b00,_0x149da6){var _0x48f0ac={'method':_0x7e16('0x1a'),'uri':_0x1b84ad+_0x7e16('0xd'),'json':!![]};_0x48f0ac[_0x7e16('0xe')]=_0x3107a8;logger[_0x7e16('0xf')](_0x7e16('0x1b'));return rp(_0x48f0ac)[_0x7e16('0x11')](function(_0x388c12){if(_0x388c12){var _0x1c3b2c=_0x388c12[_0x7e16('0x12')];var _0x23c4c5=![];var _0x4b57aa=null;if(_0x38b3f7[_0x7e16('0x1c')]!==null){logger[_0x7e16('0xf')](_0x7e16('0x1d'),_0x38b3f7['agentEmail']);_0x38b3f7['userEmail']=_0x38b3f7[_0x7e16('0x1c')];for(_0x4b57aa=0x0;_0x4b57aa<_0x1c3b2c[_0x7e16('0x13')];_0x4b57aa++){if(_0x1c3b2c[_0x4b57aa][_0x7e16('0x1e')]===_0x38b3f7[_0x7e16('0x1c')]){_0x23c4c5=!![];_0x38b3f7['userId']=_0x1c3b2c[_0x4b57aa]['id'];logger['info'](_0x7e16('0x1f'),_0x38b3f7[_0x7e16('0x20')]);}}}if(!_0x23c4c5){logger['info'](_0x7e16('0x21'));_0x38b3f7[_0x7e16('0x22')]=_0x38b3f7[_0x7e16('0x23')];_0x38b3f7[_0x7e16('0x20')]=_0x38b3f7[_0x7e16('0x14')];_0x23c4c5=!![];}if(_0x23c4c5){_0x271b00(_0x38b3f7);}else{_0x149da6({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x149da6({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x7e16('0x17')](function(_0x8dcd72){logger[_0x7e16('0x18')]('['+[_0x4561ad[_0x7e16('0x19')]()]+']',_0x8dcd72[_0x7e16('0x24')]);_0x149da6(_0x8dcd72);});});};}function searchContact(_0x45b8a0,_0x44724a,_0x1a45e4,_0x1b3bcf){return new Promise(function(_0x536179,_0x19e613){var _0x2e3721={'method':'GET','headers':_0x44724a,'uri':_0x45b8a0+'/api/lookup?q='+_0x1b3bcf+_0x7e16('0x25')+_0x1a45e4+_0x7e16('0x26'),'json':!![]};rp(_0x2e3721)['then'](function(_0x43b5f3){var _0x517c90=_['find'](_0x43b5f3[_0x7e16('0x27')][_0x7e16('0x27')],[_0x1a45e4,_0x1b3bcf]);_0x536179(_0x517c90);})[_0x7e16('0x17')](function(_0x560c16){_0x19e613(_0x560c16);});});}function getEndUser(_0x40dddc,_0x112769,_0x3c6f4f){return function(_0x371c05){return new Promise(function(_0x1cecaf,_0x2517a5){logger[_0x7e16('0xf')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x371c05[_0x7e16('0x28')]));searchContact(_0x3c6f4f,_0x112769,'mobile_number',_0x371c05[_0x7e16('0x28')])[_0x7e16('0x11')](function(_0x151f59){if(_0x151f59){_0x371c05['endUserId']=_0x151f59['id'];logger[_0x7e16('0xf')](_0x7e16('0x29'),_0x371c05[_0x7e16('0x2a')]);return _0x1cecaf(_0x371c05);}searchContact(_0x3c6f4f,_0x112769,_0x7e16('0x2b'),_0x371c05['contactNumber'])[_0x7e16('0x11')](function(_0x5451ab){if(_0x5451ab){_0x371c05[_0x7e16('0x2a')]=_0x5451ab['id'];logger[_0x7e16('0xf')](_0x7e16('0x2c'),_0x371c05[_0x7e16('0x2a')]);return _0x1cecaf(_0x371c05);}createEndUser(_0x371c05,_0x40dddc,_0x112769,_0x3c6f4f)[_0x7e16('0x11')](function(_0x129560){logger['info'](_0x7e16('0x2d'),_0x129560[_0x7e16('0x2a')]);return _0x1cecaf(_0x129560);});});})[_0x7e16('0x17')](function(_0x4895ca){_0x2517a5(_0x4895ca);});});};}function createEndUser(_0x48a36f,_0x2ea86c,_0x335cd2,_0x41fbba){return new Promise(function(_0x4d6970,_0x57ec36){var _0x50cbd4=moment();var _0x1b1931={'method':_0x7e16('0x2e'),'uri':_0x41fbba+'/api/contacts','body':{'contact':{'last_name':_0x48a36f[_0x7e16('0x28')],'work_number':_0x48a36f[_0x7e16('0x28')],'mobile_number':_0x48a36f[_0x7e16('0x28')],'owner_id':_0x48a36f[_0x7e16('0x20')],'created_at':_0x50cbd4['format'](_0x7e16('0x2f'))}},'json':!![]};_0x1b1931[_0x7e16('0xe')]=_0x335cd2;logger[_0x7e16('0xf')](_0x7e16('0x30'));return rp(_0x1b1931)[_0x7e16('0x11')](function(_0x131f2c){_0x48a36f[_0x7e16('0x2a')]=_0x131f2c[_0x7e16('0x31')]['id'];_0x4d6970(_0x48a36f);})[_0x7e16('0x17')](function(_0x59bae9){logger[_0x7e16('0x18')]('['+[_0x2ea86c[_0x7e16('0x19')]()]+']',_0x59bae9[_0x7e16('0x24')]);_0x57ec36(_0x59bae9['message']);});});}function getTicket(_0x21efa0,_0x392fa3,_0x26f0fc,_0x2011b4,_0x2df967){return function(_0x578dbc){logger[_0x7e16('0xf')](_0x7e16('0x32'));return new Promise(function(_0x228689,_0x251dd0){var _0xf7473c=moment();var _0xb29bcd={'method':_0x7e16('0x2e'),'uri':_0x26f0fc+'/api/tasks','body':{'title':intUtil[_0x7e16('0x33')](_0x2011b4[_0x7e16('0x34')],_0x2df967,'\x20'),'description':intUtil[_0x7e16('0x33')](_0x2011b4[_0x7e16('0x35')],_0x2df967,'\x0a'),'owner_id':_0x578dbc[_0x7e16('0x20')],'creater_id':_0x578dbc[_0x7e16('0x14')],'targetable_id':_0x578dbc[_0x7e16('0x2a')],'targetable_type':_0x7e16('0x36'),'created_at':_0xf7473c['format'](_0x7e16('0x2f')),'due_date':_0xf7473c[_0x7e16('0x37')](0x1e,'m')[_0x7e16('0x38')](_0x7e16('0x2f'))},'json':!![]};_0xb29bcd[_0x7e16('0xe')]=_0x392fa3;return rp(_0xb29bcd)[_0x7e16('0x11')](function(_0x40b0b6){_0x578dbc[_0x7e16('0x39')]=_0x40b0b6['task']['id'];logger['info'](_0x7e16('0x3a'),_0x578dbc['ticketId']);_0x228689(_0x578dbc);})[_0x7e16('0x17')](function(_0xe12b9){logger[_0x7e16('0x18')]('['+[_0x21efa0[_0x7e16('0x19')]()]+']',_0xe12b9['message']);_0x251dd0(_0xe12b9[_0x7e16('0x24')]);});});};}function emit(_0x231029,_0x193be8,_0x172205){var _0x27b9d0={'uri':_0x231029+'/contacts/'+_0x172205};io['to'](util[_0x7e16('0x38')]('user:%s',_0x193be8))['emit'](_0x7e16('0x3b'),_0x27b9d0);}exports['cs']=function(_0x491d78,_0xa71d96,_0x9f73e6,_0x5c4e00,_0x39b8fa,_0x5bfc25,_0x23edb7,_0x51495f){var _0x1d32e7={};var _0x325fd8={'Authorization':'Token\x20token='+_0x5bfc25[_0x7e16('0x3c')]};_0x5bfc25[_0x7e16('0x3d')]=intUtil[_0x7e16('0x3e')](_0x5bfc25[_0x7e16('0x3d')]);_0x5bfc25[_0x7e16('0x3f')]=intUtil[_0x7e16('0x3e')](_0x5bfc25[_0x7e16('0x3f')]);var _0x4c09f4=_0x5bfc25['remoteUri'];_0x1d32e7[_0x7e16('0x23')]=_0x5bfc25['username'];_0x1d32e7['contactNumber']=_0x51495f['toLowerCase']()==='outbound'?_0xa71d96[_0x7e16('0x40')]:_0xa71d96[_0x7e16('0x41')];_0x1d32e7[_0x7e16('0x42')]=_0x51495f===_0x7e16('0x43')||_0x51495f==='unmanaged'?_0x7e16('0x43'):'outbound';if(_0x5c4e00){_0x1d32e7['agentEmail']=_0x5c4e00[_0x7e16('0x1e')];}var _0x40e29e=util['format'](_0x7e16('0x44'),_0x5bfc25[_0x7e16('0x3f')],_0xa71d96[_0x7e16('0x45')],md5(_0xa71d96[_0x7e16('0x45')]));if(_0x39b8fa&&_0x39b8fa[_0x7e16('0x46')]){logger[_0x7e16('0xf')]('[QUEUE]',_0x7e16('0x47'));_0xa71d96[_0x7e16('0x48')]=_0x40e29e;}else if(_0x23edb7&&_0x23edb7[_0x7e16('0x49')]&&_0x23edb7['recordingFormat']!==_0x7e16('0x4a')){logger[_0x7e16('0xf')]('[OUTBOUND]',_0x7e16('0x47'));_0xa71d96[_0x7e16('0x48')]=_0x40e29e;}else{_0xa71d96['recordingURL']='';}return getAdminId(_0x1d32e7,_0x51495f,_0x325fd8,_0x4c09f4)[_0x7e16('0x11')](getUser(_0x51495f,_0x325fd8,_0x4c09f4))[_0x7e16('0x11')](getEndUser(_0x51495f,_0x325fd8,_0x4c09f4))['then'](getTicket(_0x51495f,_0x325fd8,_0x4c09f4,_0x9f73e6,_0xa71d96))[_0x7e16('0x11')](function(_0x552b2d){logger[_0x7e16('0xf')](util[_0x7e16('0x38')](_0x7e16('0x4b'),_0x552b2d[_0x7e16('0x39')]));if(_0x51495f!==_0x7e16('0x4c')){logger[_0x7e16('0xf')]('['+[_0x51495f[_0x7e16('0x19')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x4c09f4,_0x5c4e00[_0x7e16('0x4d')],_0x552b2d[_0x7e16('0x2a')]);}})[_0x7e16('0x17')](function(_0x38cde5){logger[_0x7e16('0x18')]('['+[_0x51495f['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x38cde5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x23bf=['users','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','GET','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','email','userId','User\x20found:','Admin\x20selected','userEmail','adminEmail','message','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','getString','Subjects','Descriptions','Contact','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x23bf,0x9c));var _0xf23b=function(_0x5cbb91,_0x443393){_0x5cbb91=_0x5cbb91-0x0;var _0x10f19e=_0x23bf[_0x5cbb91];return _0x10f19e;};'use strict';var _=require('lodash');var rp=require(_0xf23b('0x0'));var md5=require('md5');var util=require('util');var moment=require('moment');var Promise=require(_0xf23b('0x1'));var Redis=require(_0xf23b('0x2'));var intUtil=require(_0xf23b('0x3'));var config=require(_0xf23b('0x4'));var logger=require(_0xf23b('0x5'))(_0xf23b('0x6'));config[_0xf23b('0x7')]=_[_0xf23b('0x8')](config[_0xf23b('0x7')],{'host':_0xf23b('0x9'),'port':0x18eb});var io=require(_0xf23b('0xa'))(new Redis(config['redis']));function getAdminId(_0x1c7e8a,_0xde9990,_0x12959f,_0x25f868){return new Promise(function(_0x4c9852,_0x28db8b){var _0x231227=![];var _0x4e4a6b={'method':'GET','uri':_0x25f868+_0xf23b('0xb'),'json':!![]};_0x4e4a6b[_0xf23b('0xc')]=_0x12959f;logger[_0xf23b('0xd')](_0xf23b('0xe'));return rp(_0x4e4a6b)[_0xf23b('0xf')](function(_0x2f7f2e){if(_0x2f7f2e){var _0x46b0ae=_0x2f7f2e[_0xf23b('0x10')];var _0x5b6323=null;for(_0x5b6323=0x0;_0x5b6323<_0x46b0ae['length'];_0x5b6323++){if(_0x46b0ae[_0x5b6323]['email']===_0x1c7e8a['adminEmail']){_0x1c7e8a['adminId']=_0x46b0ae[_0x5b6323]['id'];_0x231227=!![];}}if(_0x231227){logger[_0xf23b('0xd')](_0xf23b('0x11'),_0x1c7e8a[_0xf23b('0x12')]);_0x4c9852(_0x1c7e8a);}else{_0x28db8b({'statusCode':0x194,'message':_0xf23b('0x13')});}}else{_0x28db8b({'statusCode':0x194,'message':_0xf23b('0x13')});}})[_0xf23b('0x14')](function(_0x26accc){logger[_0xf23b('0x15')]('['+[_0xde9990[_0xf23b('0x16')]()]+']',_0x26accc['message']);_0x28db8b(_0x26accc);});});}function getUser(_0x1eb710,_0x18c914,_0x20387b){return function(_0x3e4466){return new Promise(function(_0x1a4445,_0x543a23){var _0x3dd492={'method':_0xf23b('0x17'),'uri':_0x20387b+'/api/selector/owners','json':!![]};_0x3dd492[_0xf23b('0xc')]=_0x18c914;logger[_0xf23b('0xd')](_0xf23b('0x18'));return rp(_0x3dd492)[_0xf23b('0xf')](function(_0x2f009b){if(_0x2f009b){var _0x198731=_0x2f009b[_0xf23b('0x10')];var _0xe3659c=![];var _0x2cc80=null;if(_0x3e4466[_0xf23b('0x19')]!==null){logger['info'](_0xf23b('0x1a'),_0x3e4466['agentEmail']);_0x3e4466['userEmail']=_0x3e4466[_0xf23b('0x19')];for(_0x2cc80=0x0;_0x2cc80<_0x198731['length'];_0x2cc80++){if(_0x198731[_0x2cc80][_0xf23b('0x1b')]===_0x3e4466['agentEmail']){_0xe3659c=!![];_0x3e4466[_0xf23b('0x1c')]=_0x198731[_0x2cc80]['id'];logger[_0xf23b('0xd')](_0xf23b('0x1d'),_0x3e4466[_0xf23b('0x1c')]);}}}if(!_0xe3659c){logger[_0xf23b('0xd')](_0xf23b('0x1e'));_0x3e4466[_0xf23b('0x1f')]=_0x3e4466[_0xf23b('0x20')];_0x3e4466[_0xf23b('0x1c')]=_0x3e4466[_0xf23b('0x12')];_0xe3659c=!![];}if(_0xe3659c){_0x1a4445(_0x3e4466);}else{_0x543a23({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x543a23({'statusCode':0x194,'message':_0xf23b('0x13')});}})[_0xf23b('0x14')](function(_0x52c0d9){logger[_0xf23b('0x15')]('['+[_0x1eb710[_0xf23b('0x16')]()]+']',_0x52c0d9[_0xf23b('0x21')]);_0x543a23(_0x52c0d9);});});};}function searchContact(_0x54431a,_0x36e676,_0x4000de,_0xadee62){return new Promise(function(_0x31e6c1,_0x3f2fdd){var _0x24f058={'method':_0xf23b('0x17'),'headers':_0x36e676,'uri':_0x54431a+_0xf23b('0x22')+_0xadee62+_0xf23b('0x23')+_0x4000de+_0xf23b('0x24'),'json':!![]};rp(_0x24f058)[_0xf23b('0xf')](function(_0x3a1bd0){var _0x5f4248=_['find'](_0x3a1bd0[_0xf23b('0x25')][_0xf23b('0x25')],[_0x4000de,_0xadee62]);_0x31e6c1(_0x5f4248);})[_0xf23b('0x14')](function(_0x1b1b7d){_0x3f2fdd(_0x1b1b7d);});});}function getEndUser(_0x2a019f,_0x2af0ff,_0x27f486){return function(_0x2e1d02){return new Promise(function(_0x4cc9e0,_0x51c660){logger[_0xf23b('0xd')](util[_0xf23b('0x26')](_0xf23b('0x27'),_0x2e1d02[_0xf23b('0x28')]));searchContact(_0x27f486,_0x2af0ff,_0xf23b('0x29'),_0x2e1d02[_0xf23b('0x28')])[_0xf23b('0xf')](function(_0x19dc5d){if(_0x19dc5d){_0x2e1d02[_0xf23b('0x2a')]=_0x19dc5d['id'];logger['info'](_0xf23b('0x2b'),_0x2e1d02[_0xf23b('0x2a')]);return _0x4cc9e0(_0x2e1d02);}searchContact(_0x27f486,_0x2af0ff,_0xf23b('0x2c'),_0x2e1d02[_0xf23b('0x28')])['then'](function(_0x6a4d44){if(_0x6a4d44){_0x2e1d02['endUserId']=_0x6a4d44['id'];logger['info']('Contact\x20found\x20work_number:',_0x2e1d02[_0xf23b('0x2a')]);return _0x4cc9e0(_0x2e1d02);}createEndUser(_0x2e1d02,_0x2a019f,_0x2af0ff,_0x27f486)[_0xf23b('0xf')](function(_0x509167){logger['info'](_0xf23b('0x2d'),_0x509167[_0xf23b('0x2a')]);return _0x4cc9e0(_0x509167);});});})[_0xf23b('0x14')](function(_0xcef008){_0x51c660(_0xcef008);});});};}function createEndUser(_0x41a79a,_0x3c33ce,_0x5c06b6,_0x5b01b2){return new Promise(function(_0x3fc420,_0x704c8c){var _0x187676=moment();var _0x2a0e32={'method':_0xf23b('0x2e'),'uri':_0x5b01b2+_0xf23b('0x2f'),'body':{'contact':{'last_name':_0x41a79a[_0xf23b('0x28')],'work_number':_0x41a79a[_0xf23b('0x28')],'mobile_number':_0x41a79a[_0xf23b('0x28')],'owner_id':_0x41a79a[_0xf23b('0x1c')],'created_at':_0x187676[_0xf23b('0x26')](_0xf23b('0x30'))}},'json':!![]};_0x2a0e32[_0xf23b('0xc')]=_0x5c06b6;logger['info'](_0xf23b('0x31'));return rp(_0x2a0e32)[_0xf23b('0xf')](function(_0x4f1c83){_0x41a79a[_0xf23b('0x2a')]=_0x4f1c83[_0xf23b('0x32')]['id'];_0x3fc420(_0x41a79a);})['catch'](function(_0x57a27a){logger[_0xf23b('0x15')]('['+[_0x3c33ce[_0xf23b('0x16')]()]+']',_0x57a27a[_0xf23b('0x21')]);_0x704c8c(_0x57a27a['message']);});});}function getTicket(_0x2cb8e0,_0x1802ba,_0x22329a,_0x5a7e09,_0x4ac09c){return function(_0x141847){logger[_0xf23b('0xd')]('Creating\x20new\x20task');return new Promise(function(_0x4ad145,_0x1c8f59){var _0x15f5b7=moment();var _0x4a2fe6={'method':_0xf23b('0x2e'),'uri':_0x22329a+'/api/tasks','body':{'title':intUtil[_0xf23b('0x33')](_0x5a7e09[_0xf23b('0x34')],_0x4ac09c,'\x20'),'description':intUtil['getString'](_0x5a7e09[_0xf23b('0x35')],_0x4ac09c,'\x0a'),'owner_id':_0x141847[_0xf23b('0x1c')],'creater_id':_0x141847['adminId'],'targetable_id':_0x141847[_0xf23b('0x2a')],'targetable_type':_0xf23b('0x36'),'created_at':_0x15f5b7[_0xf23b('0x26')](_0xf23b('0x30')),'due_date':_0x15f5b7[_0xf23b('0x37')](0x1e,'m')[_0xf23b('0x26')](_0xf23b('0x30'))},'json':!![]};_0x4a2fe6['headers']=_0x1802ba;return rp(_0x4a2fe6)[_0xf23b('0xf')](function(_0x42123d){_0x141847[_0xf23b('0x38')]=_0x42123d['task']['id'];logger[_0xf23b('0xd')](_0xf23b('0x39'),_0x141847[_0xf23b('0x38')]);_0x4ad145(_0x141847);})['catch'](function(_0x19df7f){logger[_0xf23b('0x15')]('['+[_0x2cb8e0['toUpperCase']()]+']',_0x19df7f[_0xf23b('0x21')]);_0x1c8f59(_0x19df7f[_0xf23b('0x21')]);});});};}function emit(_0x46b5f5,_0x4bd424,_0x7aad50){var _0x78f036={'uri':_0x46b5f5+_0xf23b('0x3a')+_0x7aad50};io['to'](util['format'](_0xf23b('0x3b'),_0x4bd424))[_0xf23b('0x3c')](_0xf23b('0x3d'),_0x78f036);}exports['cs']=function(_0xb9a617,_0x563146,_0x34e838,_0x45b590,_0x127a11,_0x132c92,_0x207f67,_0x411f70){var _0x404f55={};var _0xddadb1={'Authorization':_0xf23b('0x3e')+_0x132c92['apiKey']};_0x132c92['remoteUri']=intUtil[_0xf23b('0x3f')](_0x132c92[_0xf23b('0x40')]);_0x132c92[_0xf23b('0x41')]=intUtil[_0xf23b('0x3f')](_0x132c92[_0xf23b('0x41')]);var _0x207f9a=_0x132c92[_0xf23b('0x40')];_0x404f55[_0xf23b('0x20')]=_0x132c92[_0xf23b('0x42')];_0x404f55[_0xf23b('0x28')]=_0x411f70[_0xf23b('0x43')]()===_0xf23b('0x44')?_0x563146[_0xf23b('0x45')]:_0x563146['calleridnum'];_0x404f55[_0xf23b('0x46')]=_0x411f70===_0xf23b('0x47')||_0x411f70===_0xf23b('0x48')?_0xf23b('0x47'):'outbound';if(_0x45b590){_0x404f55[_0xf23b('0x19')]=_0x45b590[_0xf23b('0x1b')];}var _0x32c196=util[_0xf23b('0x26')](_0xf23b('0x49'),_0x132c92[_0xf23b('0x41')],_0x563146['uniqueid'],md5(_0x563146[_0xf23b('0x4a')]));if(_0x127a11&&_0x127a11[_0xf23b('0x4b')]){logger[_0xf23b('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0x563146['recordingURL']=_0x32c196;}else if(_0x207f67&&_0x207f67['recordingFormat']&&_0x207f67[_0xf23b('0x4c')]!==_0xf23b('0x4d')){logger[_0xf23b('0xd')](_0xf23b('0x4e'),_0xf23b('0x4f'));_0x563146[_0xf23b('0x50')]=_0x32c196;}else{_0x563146[_0xf23b('0x50')]='';}return getAdminId(_0x404f55,_0x411f70,_0xddadb1,_0x207f9a)[_0xf23b('0xf')](getUser(_0x411f70,_0xddadb1,_0x207f9a))[_0xf23b('0xf')](getEndUser(_0x411f70,_0xddadb1,_0x207f9a))[_0xf23b('0xf')](getTicket(_0x411f70,_0xddadb1,_0x207f9a,_0x34e838,_0x563146))['then'](function(_0x1d177d){logger[_0xf23b('0xd')](util['format'](_0xf23b('0x51'),_0x1d177d[_0xf23b('0x38')]));if(_0x411f70!==_0xf23b('0x48')){logger[_0xf23b('0xd')]('['+[_0x411f70['toUpperCase']()]+']',_0xf23b('0x52'));emit(_0x207f9a,_0x45b590[_0xf23b('0x53')],_0x1d177d[_0xf23b('0x2a')]);}})['catch'](function(_0x4da26b){logger[_0xf23b('0x15')]('['+[_0x411f70[_0xf23b('0x16')]()]+_0xf23b('0x54'),util[_0xf23b('0x55')](_0x4da26b,{'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 8659f5e..f895073 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 _0xe29d=['freshsales','servicenow','exec','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','salesforce','vtiger','dynamics365','unknown\x20integration','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','error','%s\x20account\x20#%s\x20not\x20found','lodash','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','freshdesk','zoho','desk'];(function(_0x7ddaca,_0x4fc7bd){var _0x564994=function(_0x547b8){while(--_0x547b8){_0x7ddaca['push'](_0x7ddaca['shift']());}};_0x564994(++_0x4fc7bd);}(_0xe29d,0x151));var _0xde29=function(_0x1088e9,_0x39728b){_0x1088e9=_0x1088e9-0x0;var _0x526be2=_0xe29d[_0x1088e9];return _0x526be2;};'use strict';var _=require(_0xde29('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0xde29('0x1'));var freshdesk=require(_0xde29('0x2'));var zoho=require(_0xde29('0x3'));var desk=require(_0xde29('0x4'));var vtiger=require(_0xde29('0x5'));var servicenow=require(_0xde29('0x6'));var dynamics365=require(_0xde29('0x7'));var freshsales=require(_0xde29('0x8'));var integrations=[_0xde29('0x9'),'salesforce','sugarcrm',_0xde29('0xa'),_0xde29('0xb'),_0xde29('0xc'),'vtiger','dynamics365',_0xde29('0xd'),_0xde29('0xe')];exports[_0xde29('0xf')]=function(_0x525fca,_0x1553c8,_0x3d6b30,_0x271d00,_0x11c491,_0x3812dc){if(_0x3d6b30){if(_['includes'](integrations,_0x525fca[_0xde29('0x10')][_0xde29('0x11')]())){try{var _0x11ea97=null;var _0xf4fe63='';var _0x26019d=_0x3d6b30[_0x525fca[_0xde29('0x10')][_0xde29('0x11')]()];if(_0x26019d){var _0x2b3fe9=_0x26019d[_0x525fca[_0xde29('0x12')]];if(_0x2b3fe9){var _0x4c8b97=_[_0xde29('0x13')](_0x2b3fe9[_0xde29('0x14')],{'id':parseInt(_0x525fca['data3'],0xa)});if(_0x4c8b97){if(_0x271d00){if(_0x11c491&&_0x1553c8[_0xde29('0x15')]){_0xf4fe63=_0xde29('0x15');}else if(_0x1553c8[_0xde29('0x16')]){_0xf4fe63=_0xde29('0x17');}else{console[_0xde29('0x18')](_0xde29('0x19'),_0x1553c8);}}else{_0xf4fe63='unmanaged';}switch(_0x525fca['data1'][_0xde29('0x11')]()){case _0xde29('0x9'):zendesk[_0xf4fe63](_0x525fca,_0x1553c8,_0x4c8b97,_0x271d00,_0x11c491,_0x2b3fe9,_0x3812dc);break;case _0xde29('0x1a'):salesforce[_0xf4fe63](_0x525fca,_0x1553c8,_0x4c8b97,_0x271d00,_0x11c491,_0x2b3fe9,_0x3812dc);break;case'sugarcrm':sugarcrm[_0xf4fe63](_0x525fca,_0x1553c8,_0x4c8b97,_0x271d00,_0x11c491,_0x2b3fe9,_0x3812dc);break;case'freshdesk':freshdesk[_0xf4fe63](_0x525fca,_0x1553c8,_0x4c8b97,_0x271d00,_0x11c491,_0x2b3fe9,_0x3812dc);break;case _0xde29('0xb'):zoho[_0xf4fe63](_0x525fca,_0x1553c8,_0x4c8b97,_0x271d00,_0x11c491,_0x2b3fe9,_0x3812dc);break;case _0xde29('0xc'):desk[_0xf4fe63](_0x525fca,_0x1553c8,_0x4c8b97,_0x271d00,_0x11c491,_0x2b3fe9,_0x3812dc);break;case _0xde29('0x1b'):vtiger[_0xf4fe63](_0x525fca,_0x1553c8,_0x4c8b97,_0x271d00,_0x11c491,_0x2b3fe9,_0x3812dc);break;case _0xde29('0xd'):freshsales['cs'](_0x525fca,_0x1553c8,_0x4c8b97,_0x271d00,_0x11c491,_0x2b3fe9,_0x3812dc,_0xf4fe63);break;case _0xde29('0xe'):servicenow['cs'](_0x525fca,_0x1553c8,_0x4c8b97,_0x271d00,_0x11c491,_0x2b3fe9,_0x3812dc,_0xf4fe63);break;case _0xde29('0x1c'):dynamics365['cs'](_0x525fca,_0x1553c8,_0x4c8b97,_0x271d00,_0x11c491,_0x2b3fe9,_0x3812dc,_0xf4fe63);break;default:console[_0xde29('0x18')](_0xde29('0x1d'));}}else{_0x11ea97=require('../../../../config/logger')(_0x525fca['data1'][_0xde29('0x11')]());_0x11ea97['error'](_0xde29('0x1e'),util['format'](_0xde29('0x1f'),_0x525fca['data1']['toLowerCase'](),_0x525fca['data3']));}}else{_0x11ea97=require(_0xde29('0x20'))(_0x525fca[_0xde29('0x10')][_0xde29('0x11')]());_0x11ea97[_0xde29('0x21')](_0xde29('0x1e'),util['format'](_0xde29('0x22'),_0x525fca[_0xde29('0x10')][_0xde29('0x11')](),_0x525fca[_0xde29('0x12')]));}}else{}}catch(_0x3a7320){console[_0xde29('0x21')](_0x3a7320);}}}}; \ No newline at end of file +var _0x6815=['./dynamics365','./freshsales','sugarcrm','zoho','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','unmanaged','zendesk','salesforce','freshdesk','desk','vtiger','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./servicenow'];(function(_0x1db0d2,_0x2c0712){var _0x2a442b=function(_0x28130e){while(--_0x28130e){_0x1db0d2['push'](_0x1db0d2['shift']());}};_0x2a442b(++_0x2c0712);}(_0x6815,0x6b));var _0x5681=function(_0x219089,_0x4627f4){_0x219089=_0x219089-0x0;var _0x23638e=_0x6815[_0x219089];return _0x23638e;};'use strict';var _=require('lodash');var util=require(_0x5681('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0x5681('0x1'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x5681('0x2'));var zoho=require(_0x5681('0x3'));var desk=require(_0x5681('0x4'));var vtiger=require(_0x5681('0x5'));var servicenow=require(_0x5681('0x6'));var dynamics365=require(_0x5681('0x7'));var freshsales=require(_0x5681('0x8'));var integrations=['zendesk','salesforce',_0x5681('0x9'),'freshdesk',_0x5681('0xa'),'desk','vtiger',_0x5681('0xb'),_0x5681('0xc'),_0x5681('0xd')];exports[_0x5681('0xe')]=function(_0x145def,_0x4930c7,_0x548fcf,_0x4fae78,_0x33114b,_0x40883f){if(_0x548fcf){if(_[_0x5681('0xf')](integrations,_0x145def[_0x5681('0x10')][_0x5681('0x11')]())){try{var _0x27e29b=null;var _0x37ff1d='';var _0x41af9a=_0x548fcf[_0x145def[_0x5681('0x10')]['toLowerCase']()];if(_0x41af9a){var _0x7c4fec=_0x41af9a[_0x145def[_0x5681('0x12')]];if(_0x7c4fec){var _0x207b00=_[_0x5681('0x13')](_0x7c4fec[_0x5681('0x14')],{'id':parseInt(_0x145def[_0x5681('0x15')],0xa)});if(_0x207b00){if(_0x4fae78){if(_0x33114b&&_0x4930c7[_0x5681('0x16')]){_0x37ff1d=_0x5681('0x16');}else if(_0x4930c7[_0x5681('0x17')]){_0x37ff1d='outbound';}else{console['log']('EVENT\x20UNKNOWN',_0x4930c7);}}else{_0x37ff1d=_0x5681('0x18');}switch(_0x145def[_0x5681('0x10')][_0x5681('0x11')]()){case _0x5681('0x19'):zendesk[_0x37ff1d](_0x145def,_0x4930c7,_0x207b00,_0x4fae78,_0x33114b,_0x7c4fec,_0x40883f);break;case _0x5681('0x1a'):salesforce[_0x37ff1d](_0x145def,_0x4930c7,_0x207b00,_0x4fae78,_0x33114b,_0x7c4fec,_0x40883f);break;case _0x5681('0x9'):sugarcrm[_0x37ff1d](_0x145def,_0x4930c7,_0x207b00,_0x4fae78,_0x33114b,_0x7c4fec,_0x40883f);break;case _0x5681('0x1b'):freshdesk[_0x37ff1d](_0x145def,_0x4930c7,_0x207b00,_0x4fae78,_0x33114b,_0x7c4fec,_0x40883f);break;case _0x5681('0xa'):zoho[_0x37ff1d](_0x145def,_0x4930c7,_0x207b00,_0x4fae78,_0x33114b,_0x7c4fec,_0x40883f);break;case _0x5681('0x1c'):desk[_0x37ff1d](_0x145def,_0x4930c7,_0x207b00,_0x4fae78,_0x33114b,_0x7c4fec,_0x40883f);break;case _0x5681('0x1d'):vtiger[_0x37ff1d](_0x145def,_0x4930c7,_0x207b00,_0x4fae78,_0x33114b,_0x7c4fec,_0x40883f);break;case'freshsales':freshsales['cs'](_0x145def,_0x4930c7,_0x207b00,_0x4fae78,_0x33114b,_0x7c4fec,_0x40883f,_0x37ff1d);break;case _0x5681('0xd'):servicenow['cs'](_0x145def,_0x4930c7,_0x207b00,_0x4fae78,_0x33114b,_0x7c4fec,_0x40883f,_0x37ff1d);break;case _0x5681('0xb'):dynamics365['cs'](_0x145def,_0x4930c7,_0x207b00,_0x4fae78,_0x33114b,_0x7c4fec,_0x40883f,_0x37ff1d);break;default:console[_0x5681('0x1e')](_0x5681('0x1f'));}}else{_0x27e29b=require(_0x5681('0x20'))(_0x145def[_0x5681('0x10')][_0x5681('0x11')]());_0x27e29b[_0x5681('0x21')](_0x5681('0x22'),util[_0x5681('0x23')](_0x5681('0x24'),_0x145def[_0x5681('0x10')][_0x5681('0x11')](),_0x145def[_0x5681('0x15')]));}}else{_0x27e29b=require('../../../../config/logger')(_0x145def['data1'][_0x5681('0x11')]());_0x27e29b[_0x5681('0x21')](_0x5681('0x22'),util['format'](_0x5681('0x25'),_0x145def[_0x5681('0x10')][_0x5681('0x11')](),_0x145def[_0x5681('0x12')]));}}else{}}catch(_0x3ad06d){console[_0x5681('0x21')](_0x3ad06d);}}}}; \ 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 64c8b68..d227d2b 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 _0x238d=['outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','bluebird','jsforce','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','sobject','User','find','execute','then','length','Email','Name','info','resolve','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','additionalSearchLead','$or','account_contact_lead','additionalSearchAccount','Account','Contact','Lead','first','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','Caller\x20-\x20%s','','format','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variableName','name','concat','remoteUri','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email'];(function(_0x55b0d7,_0x4afbeb){var _0x1f9236=function(_0x53a000){while(--_0x53a000){_0x55b0d7['push'](_0x55b0d7['shift']());}};_0x1f9236(++_0x4afbeb);}(_0x238d,0x17b));var _0xd238=function(_0x316536,_0x5af3c8){_0x316536=_0x316536-0x0;var _0x191aa0=_0x238d[_0x316536];return _0x191aa0;};'use strict';var _=require(_0xd238('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd238('0x1'));var md5=require('md5');var jsforce=require(_0xd238('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xd238('0x3'));var config=require(_0xd238('0x4'));var logger=require('../../../../config/logger')('salesforce');config['redis']=_['defaults'](config[_0xd238('0x5')],{'host':_0xd238('0x6'),'port':0x18eb});var io=require(_0xd238('0x7'))(new Redis(config[_0xd238('0x5')]));function emit(_0x70a16e,_0x4af41d,_0x1c1e43){io['to'](_0x70a16e)[_0xd238('0x8')](_0x4af41d,_0x1c1e43);}function getTicket(_0x49881f,_0x87025c,_0x39eaa9,_0x53f12c,_0x4038e5,_0x50ba1a,_0x452c65,_0xf709d5){var _0x1452e0=Object[_0xd238('0x9')]({},{'OwnerId':_0x87025c['id'],'Subject':intUtil[_0xd238('0xa')](_0x53f12c[_0xd238('0xb')],_0x4038e5,'\x20'),'Description':intUtil[_0xd238('0xa')](_0x53f12c[_0xd238('0xc')],_0x4038e5,'\x0a')},getCustomFields(_0x50ba1a,_0x4038e5));if(_0x39eaa9){if(_0x53f12c[_0xd238('0xd')]===_0xd238('0xe')){_0x1452e0[_0xd238('0xf')]=moment['utc']();_0x1452e0[_0xd238('0x10')]=![];_0x1452e0[_0xd238('0x11')]=![];if(_0x39eaa9[_0xd238('0x12')]===_0xd238('0x13')||_0x39eaa9[_0xd238('0x12')]===_0xd238('0x14')){_0x1452e0[_0xd238('0x15')]=_0x39eaa9['id'];}else if(_0x39eaa9[_0xd238('0x12')]===_0xd238('0x16')){_0x1452e0[_0xd238('0x17')]=_0x39eaa9['id'];}}else if(_0x53f12c[_0xd238('0xd')]===_0xd238('0x18')){if(_0x39eaa9[_0xd238('0x12')]===_0xd238('0x13')){_0x1452e0[_0xd238('0x19')]=_0x39eaa9['id'];}else if(_0x39eaa9[_0xd238('0x12')]===_0xd238('0x16')){_0x1452e0[_0xd238('0x1a')]=_0x39eaa9['id'];}else if(_0x39eaa9[_0xd238('0x12')]===_0xd238('0x14')&&_0x53f12c['leadId']){_0x1452e0[_0x53f12c[_0xd238('0x1b')]]=_0x39eaa9['id'];}else{logger['info'](_0xd238('0x1c'));}}}return _0x452c65['sobject'](_0x53f12c[_0xd238('0xd')])[_0xd238('0x1d')](_0x1452e0);}function getUser(_0x543ef0,_0x5adf76,_0x5a3ac1){if(!_[_0xd238('0x1e')](_0x5adf76)&&intUtil[_0xd238('0x1f')](_0x5adf76)){var _0x1d904c={'Email':_0x5adf76};var _0x118b68={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5a3ac1[_0xd238('0x20')](_0xd238('0x21'))[_0xd238('0x22')](_0x1d904c,_0x118b68)[_0xd238('0x23')]()[_0xd238('0x24')](function(_0x398a72){if(_0x398a72[_0xd238('0x25')]){var _0x48922f=_[_0xd238('0x22')](_0x398a72,function(_0x67c802){return _0x67c802[_0xd238('0x26')]===_0x5adf76;});if(_0x48922f){logger['info']('Agent\x20%s\x20found.',_0x5adf76);return BPromise['resolve']({'id':_0x48922f['Id'],'name':_0x48922f[_0xd238('0x27')]});}}else{logger[_0xd238('0x28')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5adf76);return _0x5a3ac1['identity']()['then'](function(_0xf2b9d8){return BPromise[_0xd238('0x29')]({'id':_0xf2b9d8[_0xd238('0x2a')],'name':_0xf2b9d8[_0xd238('0x2b')]});});}});}else{logger[_0xd238('0x28')](_0xd238('0x2c'),_0x5adf76);return _0x5a3ac1['identity']()[_0xd238('0x24')](function(_0x14cf05){return BPromise[_0xd238('0x29')]({'id':_0x14cf05[_0xd238('0x2a')],'name':_0x14cf05[_0xd238('0x2b')]});});}}function getEndUser(_0x53887f,_0x42703d,_0x1a5870,_0x1635ad,_0x24ee67){var _0x45eaf0={'$or':{'Phone':_0x1635ad}};var _0x23183f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd238('0x29')]()[_0xd238('0x24')](function(){logger[_0xd238('0x28')](_0xd238('0x2d'),_0x1635ad,_0x42703d[_0xd238('0x2e')]);switch(_0x42703d['moduleSearch']){case'contact_lead':var _0x25c098=_[_0xd238('0x2f')](_0x45eaf0);if(_0x42703d[_0xd238('0x30')]){var _0x3604f2={};_0x3604f2[_0x42703d[_0xd238('0x30')]]=_0x1635ad;_[_0xd238('0x31')](_0x25c098['$or'],_0x3604f2);}return _0x24ee67[_0xd238('0x20')]('Contact')[_0xd238('0x22')](_0x25c098,_0x23183f)[_0xd238('0x23')]()[_0xd238('0x24')](function(_0x5eae3e){if(_0x5eae3e&&_0x5eae3e[_0xd238('0x25')]){return _0x5eae3e;}else{var _0x329651=_[_0xd238('0x2f')](_0x45eaf0);if(_0x42703d[_0xd238('0x32')]){var _0x483d45={};_0x483d45[_0x42703d[_0xd238('0x32')]]=_0x1635ad;_[_0xd238('0x31')](_0x329651[_0xd238('0x33')],_0x483d45);}return _0x24ee67['sobject']('Lead')[_0xd238('0x22')](_0x329651,_0x23183f);}});case _0xd238('0x34'):var _0x5af60c=_['cloneDeep'](_0x45eaf0);if(_0x42703d['additionalSearchAccount']){var _0x3604f2={};_0x3604f2[_0x42703d[_0xd238('0x35')]]=_0x1635ad;_[_0xd238('0x31')](_0x5af60c[_0xd238('0x33')],_0x3604f2);}return _0x24ee67['sobject'](_0xd238('0x36'))[_0xd238('0x22')](_0x5af60c,_0x23183f)[_0xd238('0x23')]()[_0xd238('0x24')](function(_0x5c1216){if(_0x5c1216&&_0x5c1216[_0xd238('0x25')]){return _0x5c1216;}else{var _0x48a51e=_[_0xd238('0x2f')](_0x45eaf0);if(_0x42703d[_0xd238('0x30')]){var _0x5c0d2b={};_0x5c0d2b[_0x42703d[_0xd238('0x30')]]=_0x1635ad;_[_0xd238('0x31')](_0x48a51e[_0xd238('0x33')],_0x5c0d2b);}return _0x24ee67[_0xd238('0x20')](_0xd238('0x37'))[_0xd238('0x22')](_0x48a51e,_0x23183f)['then'](function(_0x53f9a9){if(_0x53f9a9&&_0x53f9a9[_0xd238('0x25')]){return _0x53f9a9;}else{var _0x4dc2e3=_[_0xd238('0x2f')](_0x45eaf0);if(_0x42703d[_0xd238('0x32')]){var _0x34611a={};_0x34611a[_0x42703d[_0xd238('0x32')]]=_0x1635ad;_[_0xd238('0x31')](_0x4dc2e3[_0xd238('0x33')],_0x34611a);}return _0x24ee67[_0xd238('0x20')](_0xd238('0x38'))[_0xd238('0x22')](_0x4dc2e3,_0x23183f);}});}});case _0xd238('0x13'):var _0x25c098=_[_0xd238('0x2f')](_0x45eaf0);if(_0x42703d['additionalSearchContact']){var _0x3604f2={};_0x3604f2[_0x42703d['additionalSearchContact']]=_0x1635ad;_[_0xd238('0x31')](_0x25c098[_0xd238('0x33')],_0x3604f2);}return _0x24ee67['sobject']('Contact')[_0xd238('0x22')](_0x25c098,_0x23183f)[_0xd238('0x23')]();case _0xd238('0x14'):var _0x39490c=_['cloneDeep'](_0x45eaf0);if(_0x42703d['additionalSearchLead']){var _0x3604f2={};_0x3604f2[_0x42703d['additionalSearchLead']]=_0x1635ad;_['merge'](_0x39490c['$or'],_0x3604f2);}return _0x24ee67['sobject']('Lead')[_0xd238('0x22')](_0x39490c,_0x23183f);case _0xd238('0x16'):var _0x5af60c=_[_0xd238('0x2f')](_0x45eaf0);if(_0x42703d['additionalSearchAccount']){var _0x3604f2={};_0x3604f2[_0x42703d['additionalSearchAccount']]=_0x1635ad;_[_0xd238('0x31')](_0x5af60c['$or'],_0x3604f2);}return _0x24ee67[_0xd238('0x20')](_0xd238('0x36'))[_0xd238('0x22')](_0x5af60c,_0x23183f);default:return null;}})[_0xd238('0x24')](function(_0x483cec){if(_0x483cec&&_0x483cec[_0xd238('0x25')]){var _0x25339c=_[_0xd238('0x39')](_0x483cec);if(_0x25339c){return BPromise['resolve']({'id':_0x25339c['Id'],'name':_0x25339c[_0xd238('0x27')],'phone':_0x25339c['Phone'],'endUserType':_0x25339c['attributes'][_0xd238('0x3a')][_0xd238('0x3b')]()});}}})['then'](function(_0x43e46d){if(_0x43e46d){logger[_0xd238('0x28')](_0xd238('0x3c'),_0x43e46d[_0xd238('0x12')],_0x1635ad);return BPromise[_0xd238('0x29')](_0x43e46d);}else{logger[_0xd238('0x28')](_0xd238('0x3d'),_0x1635ad);var _0x4d8e19={'Phone':_0x1635ad};if(_0x42703d[_0xd238('0x3e')]){if(_0x42703d[_0xd238('0x3e')]==='contact'){logger[_0xd238('0x28')](_0xd238('0x3f'),_0x1635ad,_0x42703d[_0xd238('0x3e')]);_0x4d8e19[_0xd238('0x40')]=_0x1a5870!==''?_0x1a5870:util['format'](_0xd238('0x41'),_0x1635ad);}else if(_0x42703d['moduleCreate']===_0xd238('0x14')){logger[_0xd238('0x28')](_0xd238('0x3f'),_0x1635ad,_0x42703d[_0xd238('0x3e')]);_0x4d8e19['LastName']=_0x1a5870!==_0xd238('0x42')?_0x1a5870:util[_0xd238('0x43')]('Caller\x20-\x20%s',_0x1635ad);_0x4d8e19[_0xd238('0x44')]=_0xd238('0x45');}else if(_0x42703d['moduleCreate']===_0xd238('0x16')){logger['info'](_0xd238('0x3f'),_0x1635ad,_0x42703d[_0xd238('0x3e')]);_0x4d8e19[_0xd238('0x27')]=_0x1a5870!==_0xd238('0x42')?_0x1a5870:util[_0xd238('0x43')]('Caller\x20-\x20%s',_0x1635ad);}else{return null;}}return _0x24ee67['sobject'](_[_0xd238('0x46')](_0x42703d[_0xd238('0x3e')]))[_0xd238('0x1d')](_0x4d8e19)[_0xd238('0x24')](function(_0x558d68){return BPromise[_0xd238('0x29')]({'id':_0x558d68['id'],'endUserType':_0x42703d[_0xd238('0x3e')]});});}});}function getCustomFields(_0x239cf2,_0x5a8036){var _0x55b5ed={};if(_0x239cf2[_0xd238('0x25')]>0x0){_[_0xd238('0x47')](_0x239cf2,function(_0x49f4b4){if(_[_0xd238('0x48')]([_0xd238('0x49'),_0xd238('0x4a')],_0x49f4b4[_0xd238('0x3a')])&&_0x49f4b4[_0xd238('0x4b')]){_0x55b5ed[_0x49f4b4[_0xd238('0x4b')]]=_0x49f4b4[_0xd238('0x4c')][_0xd238('0x4d')]();}else if(_0x49f4b4[_0xd238('0x3a')]==='variable'&&_0x49f4b4[_0xd238('0x4e')]&&_0x49f4b4[_0xd238('0x4b')]){_0x5a8036[_0x49f4b4[_0xd238('0x4e')]]&&(_0x55b5ed[_0x49f4b4[_0xd238('0x4b')]]=_0x5a8036[_0x49f4b4[_0xd238('0x4e')]][_0xd238('0x4d')]());}else if(_0x49f4b4[_0xd238('0x3a')]==='customVariable'&&_0x49f4b4['Variable']&&_0x49f4b4['Variable'][_0xd238('0x4f')]&&_0x49f4b4[_0xd238('0x4b')]){_0x5a8036[_0x49f4b4['Variable'][_0xd238('0x4f')][_0xd238('0x3b')]()]&&(_0x55b5ed[_0x49f4b4[_0xd238('0x4b')]]=_0x5a8036[_0x49f4b4['Variable'][_0xd238('0x4f')][_0xd238('0x3b')]()]['toString']());}});}return _0x55b5ed;}function getConnection(_0x2212f0){var _0x5c8cb3=_0x2212f0['password'][_0xd238('0x50')](_0x2212f0['securityToken']);var _0x1dd3c1=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2212f0[_0xd238('0x51')]||'https://login.salesforce.com','clientId':_0x2212f0[_0xd238('0x52')],'clientSecret':_0x2212f0[_0xd238('0x53')]}});return _0x1dd3c1[_0xd238('0x54')](_0x2212f0['username'],_0x5c8cb3)[_0xd238('0x24')](function(){logger[_0xd238('0x28')](_0xd238('0x55'));return _0x1dd3c1;});}exports[_0xd238('0x56')]=function(_0x424573,_0x4da3a4,_0x3322b0,_0x5160d2,_0x284e3c,_0x314cf7){var _0x5bde49,_0x10997d,_0xb0eef7,_0x33dfd2;_0x314cf7[_0xd238('0x57')]=intUtil[_0xd238('0x58')](_0x314cf7[_0xd238('0x57')]);_0x314cf7[_0xd238('0x51')]=intUtil[_0xd238('0x58')](_0x314cf7[_0xd238('0x51')]);if(_0x284e3c&&_0x284e3c['monitor_format']){logger[_0xd238('0x28')]('[QUEUE]',_0xd238('0x59'));_0x4da3a4[_0xd238('0x5a')]=util[_0xd238('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x314cf7[_0xd238('0x57')],_0x4da3a4['uniqueid'],md5(_0x4da3a4[_0xd238('0x5b')]));}else{_0x4da3a4[_0xd238('0x5a')]='';}return getConnection(_0x314cf7)[_0xd238('0x24')](function(_0x4a1c62){_0x33dfd2=_0x4a1c62;return getUser(_0x314cf7,_0x5160d2['email'],_0x33dfd2);})[_0xd238('0x24')](function(_0x4c47b2){_0x5bde49=_0x4c47b2;return getEndUser(_0x314cf7,_0x3322b0,_0x4da3a4[_0xd238('0x5c')],_0x4da3a4[_0xd238('0x5d')],_0x33dfd2);})['then'](function(_0x2e2f5a){_0x10997d=_0x2e2f5a;return getTicket(_0x314cf7,_0x5bde49,_0x10997d,_0x3322b0,_0x4da3a4,_0x3322b0[_0xd238('0x5e')],_0x33dfd2,_0xd238('0x56'));})['then'](function(_0x18941d){_0xb0eef7=_0x18941d;logger[_0xd238('0x28')](_0xd238('0x5f'),_0xb0eef7['id']);logger[_0xd238('0x28')](_0xd238('0x60'),_0xb0eef7['id'],_0x5160d2[_0xd238('0x4f')],_0x314cf7['type']);switch(_0x314cf7[_0xd238('0x3a')]){case _0xd238('0x61'):emit(util['format'](_0xd238('0x62'),_0x5160d2['name']),_0xd238('0x63'),{'recordId':_0xb0eef7['id']});break;case _0xd238('0x64'):emit(util[_0xd238('0x43')](_0xd238('0x62'),_0x5160d2[_0xd238('0x4f')]),_0xd238('0x65'),{'uri':util[_0xd238('0x43')](_0xd238('0x66'),_0x33dfd2[_0xd238('0x67')],_0xb0eef7['id'])});break;default:logger[_0xd238('0x68')](_0xd238('0x69'));}})[_0xd238('0x6a')](function(_0x25ae4e){logger['error'](_0xd238('0x6b'),_0x25ae4e);});};exports['outbound']=function(_0x5b02fa,_0x3b745e,_0x301cb3,_0x13476c,_0x15992b,_0x1d8a3b,_0x4f8e9d){var _0x40437c,_0x211c7b,_0x2ec26f,_0x29b920;_0x1d8a3b['serverUrl']=intUtil['stripTrailingSlash'](_0x1d8a3b[_0xd238('0x57')]);_0x1d8a3b['remoteUri']=intUtil[_0xd238('0x58')](_0x1d8a3b[_0xd238('0x51')]);if(_0x4f8e9d&&_0x4f8e9d[_0xd238('0x6c')]&&_0x4f8e9d[_0xd238('0x6c')]!==_0xd238('0x6d')){logger[_0xd238('0x28')](_0xd238('0x6e'),_0xd238('0x59'));_0x3b745e['recordingURL']=util[_0xd238('0x43')](_0xd238('0x6f'),_0x1d8a3b['serverUrl'],_0x3b745e[_0xd238('0x5b')],md5(_0x3b745e[_0xd238('0x5b')]));}return getConnection(_0x1d8a3b)[_0xd238('0x24')](function(_0x2e3158){_0x29b920=_0x2e3158;return getUser(_0x1d8a3b,_0x13476c[_0xd238('0x70')],_0x29b920);})[_0xd238('0x24')](function(_0x318f67){_0x40437c=_0x318f67;return getEndUser(_0x1d8a3b,_0x301cb3,_0x3b745e['destcalleridname'],_0x3b745e['destcalleridnum'],_0x29b920);})[_0xd238('0x24')](function(_0x1c7cc3){_0x211c7b=_0x1c7cc3;return getTicket(_0x1d8a3b,_0x40437c,_0x211c7b,_0x301cb3,_0x3b745e,_0x301cb3['Fields'],_0x29b920,_0xd238('0x71'));})[_0xd238('0x24')](function(_0x347a46){_0x2ec26f=_0x347a46;logger[_0xd238('0x28')](_0xd238('0x72'),_0x2ec26f['id']);logger[_0xd238('0x28')](_0xd238('0x73'),_0x2ec26f['id'],_0x13476c[_0xd238('0x4f')],_0x1d8a3b[_0xd238('0x3a')]);switch(_0x1d8a3b[_0xd238('0x3a')]){case'integrationTab':emit(util['format'](_0xd238('0x62'),_0x13476c[_0xd238('0x4f')]),'trigger:salesforce:display',{'recordId':_0x2ec26f['id']});break;case _0xd238('0x64'):emit(util[_0xd238('0x43')](_0xd238('0x62'),_0x13476c['name']),_0xd238('0x65'),{'uri':util[_0xd238('0x43')](_0xd238('0x66'),_0x29b920[_0xd238('0x67')],_0x2ec26f['id'])});break;default:logger[_0xd238('0x68')](_0xd238('0x6e'),_0xd238('0x74'));}})[_0xd238('0x6a')](function(_0x426609){logger[_0xd238('0x68')](_0xd238('0x6e'),_0x426609);});};exports[_0xd238('0x75')]=function(_0x72e6c3,_0x400db7,_0x1161b8,_0x3baf9c,_0x170f58,_0x579a3c){var _0x561caf,_0x18ab98,_0x13d6ce,_0x8f2569;_0x579a3c[_0xd238('0x57')]=intUtil[_0xd238('0x58')](_0x579a3c[_0xd238('0x57')]);_0x579a3c[_0xd238('0x51')]=intUtil[_0xd238('0x58')](_0x579a3c[_0xd238('0x51')]);if(_0x170f58&&_0x170f58[_0xd238('0x76')]){logger[_0xd238('0x28')]('['+_0x400db7[_0xd238('0x77')]['toUpperCase']()+']',_0xd238('0x59'));_0x400db7[_0xd238('0x5a')]=util['format'](_0xd238('0x6f'),_0x579a3c['serverUrl'],_0x400db7[_0xd238('0x5b')],md5(_0x400db7[_0xd238('0x5b')]));}else{_0x400db7[_0xd238('0x5a')]='';}return getConnection(_0x579a3c)[_0xd238('0x24')](function(_0x3ebb81){_0x8f2569=_0x3ebb81;if(!_[_0xd238('0x1e')](_0x3baf9c)){return getUser(_0x579a3c,_0x3baf9c[_0xd238('0x4f')],_0x8f2569);}else{return getUser(_0x579a3c,null,_0x8f2569);}})['then'](function(_0x2db9b7){_0x561caf=_0x2db9b7;return getEndUser(_0x579a3c,_0x1161b8,_0x400db7[_0xd238('0x5c')],_0x400db7[_0xd238('0x5d')],_0x8f2569);})[_0xd238('0x24')](function(_0x4a2bc0){_0x18ab98=_0x4a2bc0;return getTicket(_0x579a3c,_0x561caf,_0x18ab98,_0x1161b8,_0x400db7,_0x1161b8[_0xd238('0x5e')],_0x8f2569);})[_0xd238('0x24')](function(_0x5ade62){_0x13d6ce=_0x5ade62;logger['info']('['+_0x400db7[_0xd238('0x77')][_0xd238('0x78')]()+_0xd238('0x79'),_0x13d6ce['id']);logger[_0xd238('0x28')]('['+_0x400db7[_0xd238('0x77')]['toUpperCase']()+_0xd238('0x7a'),_0x579a3c[_0xd238('0x3a')]);})['catch'](function(_0x4f25eb){logger[_0xd238('0x68')]('['+_0x400db7['lastevent'][_0xd238('0x78')]()+']',_0x4f25eb);});}; \ No newline at end of file +var _0x7251=['[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','catch','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','assign','getString','Subjects','Descriptions','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','Case','ContactId','AccountId','lead','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','then','length','Email','Agent\x20%s\x20found.','resolve','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','execute','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','account','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','Caller\x20-\x20%s','','Company','No\x20Company','format','upperFirst','forEach','string','idField','content','toString','variable','variableName','Variable','name','password','concat','securityToken','remoteUri','clientSecret','username','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','uniqueid','email','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','error'];(function(_0xd6771b,_0x3655dc){var _0x2471eb=function(_0x37f5c0){while(--_0x37f5c0){_0xd6771b['push'](_0xd6771b['shift']());}};_0x2471eb(++_0x3655dc);}(_0x7251,0x107));var _0x1725=function(_0x27c1da,_0x2591e2){_0x27c1da=_0x27c1da-0x0;var _0xeade5=_0x7251[_0x27c1da];return _0xeade5;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x1725('0x0'));var BPromise=require(_0x1725('0x1'));var md5=require(_0x1725('0x2'));var jsforce=require(_0x1725('0x3'));var util=require('util');var Redis=require(_0x1725('0x4'));var intUtil=require(_0x1725('0x5'));var config=require('../../../../config/environment');var logger=require(_0x1725('0x6'))(_0x1725('0x7'));config[_0x1725('0x8')]=_[_0x1725('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1725('0xa'))(new Redis(config[_0x1725('0x8')]));function emit(_0x2e7c64,_0x7fa48c,_0x50020f){io['to'](_0x2e7c64)['emit'](_0x7fa48c,_0x50020f);}function getTicket(_0x1f0253,_0x3ab313,_0x2b250a,_0x42856a,_0x47f155,_0x47982c,_0x5478b5,_0x4435cb){var _0x4586e0=Object[_0x1725('0xb')]({},{'OwnerId':_0x3ab313['id'],'Subject':intUtil[_0x1725('0xc')](_0x42856a[_0x1725('0xd')],_0x47f155,'\x20'),'Description':intUtil[_0x1725('0xc')](_0x42856a[_0x1725('0xe')],_0x47f155,'\x0a')},getCustomFields(_0x47982c,_0x47f155));if(_0x2b250a){if(_0x42856a[_0x1725('0xf')]===_0x1725('0x10')){_0x4586e0['ActivityDate']=moment[_0x1725('0x11')]();_0x4586e0[_0x1725('0x12')]=![];_0x4586e0[_0x1725('0x13')]=![];if(_0x2b250a[_0x1725('0x14')]===_0x1725('0x15')||_0x2b250a[_0x1725('0x14')]==='lead'){_0x4586e0[_0x1725('0x16')]=_0x2b250a['id'];}else if(_0x2b250a[_0x1725('0x14')]==='account'){_0x4586e0['WhatId']=_0x2b250a['id'];}}else if(_0x42856a[_0x1725('0xf')]===_0x1725('0x17')){if(_0x2b250a[_0x1725('0x14')]===_0x1725('0x15')){_0x4586e0[_0x1725('0x18')]=_0x2b250a['id'];}else if(_0x2b250a[_0x1725('0x14')]==='account'){_0x4586e0[_0x1725('0x19')]=_0x2b250a['id'];}else if(_0x2b250a[_0x1725('0x14')]===_0x1725('0x1a')&&_0x42856a[_0x1725('0x1b')]){_0x4586e0[_0x42856a[_0x1725('0x1b')]]=_0x2b250a['id'];}else{logger['info'](_0x1725('0x1c'));}}}return _0x5478b5[_0x1725('0x1d')](_0x42856a[_0x1725('0xf')])[_0x1725('0x1e')](_0x4586e0);}function getUser(_0x1e969d,_0x3ffc39,_0x276617){if(!_[_0x1725('0x1f')](_0x3ffc39)&&intUtil[_0x1725('0x20')](_0x3ffc39)){var _0x23c9ef={'Email':_0x3ffc39};var _0x34ab7a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x276617[_0x1725('0x1d')]('User')[_0x1725('0x21')](_0x23c9ef,_0x34ab7a)['execute']()[_0x1725('0x22')](function(_0xafb40b){if(_0xafb40b[_0x1725('0x23')]){var _0x386b2e=_[_0x1725('0x21')](_0xafb40b,function(_0x476b54){return _0x476b54[_0x1725('0x24')]===_0x3ffc39;});if(_0x386b2e){logger['info'](_0x1725('0x25'),_0x3ffc39);return BPromise[_0x1725('0x26')]({'id':_0x386b2e['Id'],'name':_0x386b2e['Name']});}}else{logger[_0x1725('0x27')](_0x1725('0x28'),_0x3ffc39);return _0x276617[_0x1725('0x29')]()[_0x1725('0x22')](function(_0x1dfaa1){return BPromise[_0x1725('0x26')]({'id':_0x1dfaa1['user_id'],'name':_0x1dfaa1[_0x1725('0x2a')]});});}});}else{logger[_0x1725('0x27')](_0x1725('0x28'),_0x3ffc39);return _0x276617[_0x1725('0x29')]()[_0x1725('0x22')](function(_0x13d714){return BPromise[_0x1725('0x26')]({'id':_0x13d714[_0x1725('0x2b')],'name':_0x13d714['display_name']});});}}function getEndUser(_0xf5b4f1,_0x55b1bc,_0x481fe7,_0x38accd,_0xaeec58){var _0x35093a={'$or':{'Phone':_0x38accd}};var _0x17efa4={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x1725('0x26')]()['then'](function(){logger['info'](_0x1725('0x2c'),_0x38accd,_0x55b1bc['moduleSearch']);switch(_0x55b1bc[_0x1725('0x2d')]){case _0x1725('0x2e'):var _0x72a683=_[_0x1725('0x2f')](_0x35093a);if(_0x55b1bc['additionalSearchContact']){var _0x5d9b6d={};_0x5d9b6d[_0x55b1bc[_0x1725('0x30')]]=_0x38accd;_[_0x1725('0x31')](_0x72a683['$or'],_0x5d9b6d);}return _0xaeec58['sobject'](_0x1725('0x32'))[_0x1725('0x21')](_0x72a683,_0x17efa4)[_0x1725('0x33')]()['then'](function(_0x3d7ccf){if(_0x3d7ccf&&_0x3d7ccf[_0x1725('0x23')]){return _0x3d7ccf;}else{var _0x5775a2=_['cloneDeep'](_0x35093a);if(_0x55b1bc[_0x1725('0x34')]){var _0x2eb436={};_0x2eb436[_0x55b1bc[_0x1725('0x34')]]=_0x38accd;_[_0x1725('0x31')](_0x5775a2[_0x1725('0x35')],_0x2eb436);}return _0xaeec58[_0x1725('0x1d')](_0x1725('0x36'))[_0x1725('0x21')](_0x5775a2,_0x17efa4);}});case _0x1725('0x37'):var _0x337c6a=_[_0x1725('0x2f')](_0x35093a);if(_0x55b1bc[_0x1725('0x38')]){var _0x5d9b6d={};_0x5d9b6d[_0x55b1bc[_0x1725('0x38')]]=_0x38accd;_['merge'](_0x337c6a[_0x1725('0x35')],_0x5d9b6d);}return _0xaeec58[_0x1725('0x1d')](_0x1725('0x39'))['find'](_0x337c6a,_0x17efa4)[_0x1725('0x33')]()[_0x1725('0x22')](function(_0x32ba29){if(_0x32ba29&&_0x32ba29[_0x1725('0x23')]){return _0x32ba29;}else{var _0x1d627f=_['cloneDeep'](_0x35093a);if(_0x55b1bc[_0x1725('0x30')]){var _0x47d383={};_0x47d383[_0x55b1bc[_0x1725('0x30')]]=_0x38accd;_[_0x1725('0x31')](_0x1d627f[_0x1725('0x35')],_0x47d383);}return _0xaeec58[_0x1725('0x1d')](_0x1725('0x32'))[_0x1725('0x21')](_0x1d627f,_0x17efa4)[_0x1725('0x22')](function(_0x23a96a){if(_0x23a96a&&_0x23a96a[_0x1725('0x23')]){return _0x23a96a;}else{var _0x317bfb=_[_0x1725('0x2f')](_0x35093a);if(_0x55b1bc[_0x1725('0x34')]){var _0x56db20={};_0x56db20[_0x55b1bc['additionalSearchLead']]=_0x38accd;_[_0x1725('0x31')](_0x317bfb[_0x1725('0x35')],_0x56db20);}return _0xaeec58[_0x1725('0x1d')](_0x1725('0x36'))[_0x1725('0x21')](_0x317bfb,_0x17efa4);}});}});case _0x1725('0x15'):var _0x72a683=_[_0x1725('0x2f')](_0x35093a);if(_0x55b1bc['additionalSearchContact']){var _0x5d9b6d={};_0x5d9b6d[_0x55b1bc[_0x1725('0x30')]]=_0x38accd;_[_0x1725('0x31')](_0x72a683[_0x1725('0x35')],_0x5d9b6d);}return _0xaeec58['sobject'](_0x1725('0x32'))[_0x1725('0x21')](_0x72a683,_0x17efa4)['execute']();case'lead':var _0x2dbeeb=_[_0x1725('0x2f')](_0x35093a);if(_0x55b1bc[_0x1725('0x34')]){var _0x5d9b6d={};_0x5d9b6d[_0x55b1bc[_0x1725('0x34')]]=_0x38accd;_['merge'](_0x2dbeeb[_0x1725('0x35')],_0x5d9b6d);}return _0xaeec58[_0x1725('0x1d')](_0x1725('0x36'))[_0x1725('0x21')](_0x2dbeeb,_0x17efa4);case _0x1725('0x3a'):var _0x337c6a=_['cloneDeep'](_0x35093a);if(_0x55b1bc['additionalSearchAccount']){var _0x5d9b6d={};_0x5d9b6d[_0x55b1bc['additionalSearchAccount']]=_0x38accd;_['merge'](_0x337c6a[_0x1725('0x35')],_0x5d9b6d);}return _0xaeec58['sobject'](_0x1725('0x39'))[_0x1725('0x21')](_0x337c6a,_0x17efa4);default:return null;}})[_0x1725('0x22')](function(_0x3d1efa){if(_0x3d1efa&&_0x3d1efa['length']){var _0x2388fc=_[_0x1725('0x3b')](_0x3d1efa);if(_0x2388fc){return BPromise[_0x1725('0x26')]({'id':_0x2388fc['Id'],'name':_0x2388fc[_0x1725('0x3c')],'phone':_0x2388fc[_0x1725('0x3d')],'endUserType':_0x2388fc[_0x1725('0x3e')][_0x1725('0x3f')][_0x1725('0x40')]()});}}})[_0x1725('0x22')](function(_0x5071eb){if(_0x5071eb){logger[_0x1725('0x27')](_0x1725('0x41'),_0x5071eb[_0x1725('0x14')],_0x38accd);return BPromise[_0x1725('0x26')](_0x5071eb);}else{logger[_0x1725('0x27')](_0x1725('0x42'),_0x38accd);var _0x575586={'Phone':_0x38accd};if(_0x55b1bc[_0x1725('0x43')]){if(_0x55b1bc['moduleCreate']==='contact'){logger[_0x1725('0x27')](_0x1725('0x44'),_0x38accd,_0x55b1bc[_0x1725('0x43')]);_0x575586[_0x1725('0x45')]=_0x481fe7!==''?_0x481fe7:util['format'](_0x1725('0x46'),_0x38accd);}else if(_0x55b1bc[_0x1725('0x43')]==='lead'){logger[_0x1725('0x27')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x38accd,_0x55b1bc[_0x1725('0x43')]);_0x575586[_0x1725('0x45')]=_0x481fe7!==_0x1725('0x47')?_0x481fe7:util['format']('Caller\x20-\x20%s',_0x38accd);_0x575586[_0x1725('0x48')]=_0x1725('0x49');}else if(_0x55b1bc['moduleCreate']===_0x1725('0x3a')){logger['info'](_0x1725('0x44'),_0x38accd,_0x55b1bc[_0x1725('0x43')]);_0x575586[_0x1725('0x3c')]=_0x481fe7!==''?_0x481fe7:util[_0x1725('0x4a')](_0x1725('0x46'),_0x38accd);}else{return null;}}return _0xaeec58[_0x1725('0x1d')](_[_0x1725('0x4b')](_0x55b1bc[_0x1725('0x43')]))[_0x1725('0x1e')](_0x575586)[_0x1725('0x22')](function(_0x2c1189){return BPromise['resolve']({'id':_0x2c1189['id'],'endUserType':_0x55b1bc[_0x1725('0x43')]});});}});}function getCustomFields(_0x1e2449,_0x210699){var _0x129444={};if(_0x1e2449['length']>0x0){_[_0x1725('0x4c')](_0x1e2449,function(_0x303c4b){if(_['includes']([_0x1725('0x4d'),'picklist'],_0x303c4b[_0x1725('0x3f')])&&_0x303c4b[_0x1725('0x4e')]){_0x129444[_0x303c4b[_0x1725('0x4e')]]=_0x303c4b[_0x1725('0x4f')][_0x1725('0x50')]();}else if(_0x303c4b[_0x1725('0x3f')]===_0x1725('0x51')&&_0x303c4b[_0x1725('0x52')]&&_0x303c4b[_0x1725('0x4e')]){_0x210699[_0x303c4b['variableName']]&&(_0x129444[_0x303c4b['idField']]=_0x210699[_0x303c4b[_0x1725('0x52')]][_0x1725('0x50')]());}else if(_0x303c4b[_0x1725('0x3f')]==='customVariable'&&_0x303c4b[_0x1725('0x53')]&&_0x303c4b[_0x1725('0x53')][_0x1725('0x54')]&&_0x303c4b[_0x1725('0x4e')]){_0x210699[_0x303c4b[_0x1725('0x53')]['name'][_0x1725('0x40')]()]&&(_0x129444[_0x303c4b['idField']]=_0x210699[_0x303c4b[_0x1725('0x53')][_0x1725('0x54')][_0x1725('0x40')]()][_0x1725('0x50')]());}});}return _0x129444;}function getConnection(_0x2aecb5){var _0x51c831=_0x2aecb5[_0x1725('0x55')][_0x1725('0x56')](_0x2aecb5[_0x1725('0x57')]);var _0x1db723=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2aecb5[_0x1725('0x58')]||'https://login.salesforce.com','clientId':_0x2aecb5['clientId'],'clientSecret':_0x2aecb5[_0x1725('0x59')]}});return _0x1db723['login'](_0x2aecb5[_0x1725('0x5a')],_0x51c831)['then'](function(){logger['info']('Connection\x20established.');return _0x1db723;});}exports['queue']=function(_0x149097,_0x9ddcc4,_0x5e0442,_0x4ed917,_0x509780,_0x34ee33){var _0x1f6d8f,_0x1ab98d,_0x55d227,_0x394651;_0x34ee33[_0x1725('0x5b')]=intUtil['stripTrailingSlash'](_0x34ee33[_0x1725('0x5b')]);_0x34ee33[_0x1725('0x58')]=intUtil[_0x1725('0x5c')](_0x34ee33['remoteUri']);if(_0x509780&&_0x509780[_0x1725('0x5d')]){logger[_0x1725('0x27')](_0x1725('0x5e'),'Recording\x20is\x20enabled!');_0x9ddcc4[_0x1725('0x5f')]=util[_0x1725('0x4a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x34ee33[_0x1725('0x5b')],_0x9ddcc4[_0x1725('0x60')],md5(_0x9ddcc4['uniqueid']));}else{_0x9ddcc4[_0x1725('0x5f')]='';}return getConnection(_0x34ee33)[_0x1725('0x22')](function(_0x3bb7d6){_0x394651=_0x3bb7d6;return getUser(_0x34ee33,_0x4ed917[_0x1725('0x61')],_0x394651);})[_0x1725('0x22')](function(_0x5e9054){_0x1f6d8f=_0x5e9054;return getEndUser(_0x34ee33,_0x5e0442,_0x9ddcc4['calleridname'],_0x9ddcc4['calleridnum'],_0x394651);})[_0x1725('0x22')](function(_0x5bdf26){_0x1ab98d=_0x5bdf26;return getTicket(_0x34ee33,_0x1f6d8f,_0x1ab98d,_0x5e0442,_0x9ddcc4,_0x5e0442[_0x1725('0x62')],_0x394651,'queue');})[_0x1725('0x22')](function(_0x2bbe58){_0x55d227=_0x2bbe58;logger[_0x1725('0x27')](_0x1725('0x63'),_0x55d227['id']);logger[_0x1725('0x27')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x55d227['id'],_0x4ed917[_0x1725('0x54')],_0x34ee33[_0x1725('0x3f')]);switch(_0x34ee33[_0x1725('0x3f')]){case _0x1725('0x64'):emit(util['format'](_0x1725('0x65'),_0x4ed917[_0x1725('0x54')]),_0x1725('0x66'),{'recordId':_0x55d227['id']});break;case'newTab':emit(util[_0x1725('0x4a')](_0x1725('0x65'),_0x4ed917[_0x1725('0x54')]),_0x1725('0x67'),{'uri':util[_0x1725('0x4a')](_0x1725('0x68'),_0x394651['instanceUrl'],_0x55d227['id'])});break;default:logger[_0x1725('0x69')](_0x1725('0x6a'));}})['catch'](function(_0x51ee9b){logger['error'](_0x1725('0x5e'),_0x51ee9b);});};exports[_0x1725('0x6b')]=function(_0x18a3f3,_0x1d8336,_0x4ad936,_0x464d30,_0x33fed6,_0xbf9d42,_0x1b0516){var _0x272d7b,_0x3be38e,_0x5253b9,_0xfdee5f;_0xbf9d42['serverUrl']=intUtil[_0x1725('0x5c')](_0xbf9d42[_0x1725('0x5b')]);_0xbf9d42['remoteUri']=intUtil[_0x1725('0x5c')](_0xbf9d42[_0x1725('0x58')]);if(_0x1b0516&&_0x1b0516[_0x1725('0x6c')]&&_0x1b0516[_0x1725('0x6c')]!=='none'){logger[_0x1725('0x27')](_0x1725('0x6d'),_0x1725('0x6e'));_0x1d8336[_0x1725('0x5f')]=util['format'](_0x1725('0x6f'),_0xbf9d42['serverUrl'],_0x1d8336[_0x1725('0x60')],md5(_0x1d8336[_0x1725('0x60')]));}return getConnection(_0xbf9d42)['then'](function(_0x5c86ab){_0xfdee5f=_0x5c86ab;return getUser(_0xbf9d42,_0x464d30['email'],_0xfdee5f);})[_0x1725('0x22')](function(_0x583b1b){_0x272d7b=_0x583b1b;return getEndUser(_0xbf9d42,_0x4ad936,_0x1d8336[_0x1725('0x70')],_0x1d8336['destcalleridnum'],_0xfdee5f);})[_0x1725('0x22')](function(_0x573a6e){_0x3be38e=_0x573a6e;return getTicket(_0xbf9d42,_0x272d7b,_0x3be38e,_0x4ad936,_0x1d8336,_0x4ad936['Fields'],_0xfdee5f,_0x1725('0x6b'));})[_0x1725('0x22')](function(_0x3b6f2){_0x5253b9=_0x3b6f2;logger[_0x1725('0x27')](_0x1725('0x71'),_0x5253b9['id']);logger['info'](_0x1725('0x72'),_0x5253b9['id'],_0x464d30[_0x1725('0x54')],_0xbf9d42[_0x1725('0x3f')]);switch(_0xbf9d42[_0x1725('0x3f')]){case _0x1725('0x64'):emit(util[_0x1725('0x4a')](_0x1725('0x65'),_0x464d30['name']),_0x1725('0x66'),{'recordId':_0x5253b9['id']});break;case'newTab':emit(util[_0x1725('0x4a')]('user:%s',_0x464d30[_0x1725('0x54')]),_0x1725('0x67'),{'uri':util[_0x1725('0x4a')](_0x1725('0x68'),_0xfdee5f[_0x1725('0x73')],_0x5253b9['id'])});break;default:logger['error'](_0x1725('0x6d'),_0x1725('0x74'));}})[_0x1725('0x75')](function(_0x3cc97c){logger[_0x1725('0x69')](_0x1725('0x6d'),_0x3cc97c);});};exports['unmanaged']=function(_0x30335e,_0x53d592,_0x5681a2,_0x2bb72a,_0x2f8966,_0x5d2a7a){var _0x278201,_0x449cda,_0x2d198a,_0x41b9be;_0x5d2a7a['serverUrl']=intUtil['stripTrailingSlash'](_0x5d2a7a[_0x1725('0x5b')]);_0x5d2a7a[_0x1725('0x58')]=intUtil[_0x1725('0x5c')](_0x5d2a7a[_0x1725('0x58')]);if(_0x2f8966&&_0x2f8966['monitor_format']){logger['info']('['+_0x53d592[_0x1725('0x76')][_0x1725('0x77')]()+']',_0x1725('0x6e'));_0x53d592['recordingURL']=util[_0x1725('0x4a')](_0x1725('0x6f'),_0x5d2a7a[_0x1725('0x5b')],_0x53d592['uniqueid'],md5(_0x53d592[_0x1725('0x60')]));}else{_0x53d592['recordingURL']='';}return getConnection(_0x5d2a7a)[_0x1725('0x22')](function(_0x48fb5f){_0x41b9be=_0x48fb5f;if(!_[_0x1725('0x1f')](_0x2bb72a)){return getUser(_0x5d2a7a,_0x2bb72a[_0x1725('0x54')],_0x41b9be);}else{return getUser(_0x5d2a7a,null,_0x41b9be);}})[_0x1725('0x22')](function(_0x195ec1){_0x278201=_0x195ec1;return getEndUser(_0x5d2a7a,_0x5681a2,_0x53d592['calleridname'],_0x53d592[_0x1725('0x78')],_0x41b9be);})[_0x1725('0x22')](function(_0x269bc3){_0x449cda=_0x269bc3;return getTicket(_0x5d2a7a,_0x278201,_0x449cda,_0x5681a2,_0x53d592,_0x5681a2[_0x1725('0x62')],_0x41b9be);})[_0x1725('0x22')](function(_0x3340bc){_0x2d198a=_0x3340bc;logger[_0x1725('0x27')]('['+_0x53d592[_0x1725('0x76')][_0x1725('0x77')]()+_0x1725('0x79'),_0x2d198a['id']);logger['info']('['+_0x53d592[_0x1725('0x76')]['toUpperCase']()+_0x1725('0x7a'),_0x5d2a7a[_0x1725('0x3f')]);})['catch'](function(_0x678c49){logger[_0x1725('0x69')]('['+_0x53d592[_0x1725('0x76')][_0x1725('0x77')]()+']',_0x678c49);});}; \ 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 03bdb90..ff2d205 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 _0x69e1=['message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','length','active','true','userId','adminEmail','info','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','customField','nameField','toLowerCase','content','picklist','type','idField','toString','variable','variableName','Variable','name','assign','getString','Subjects','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','Incident','Incident\x20-\x20','forEach','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','md5','ioredis','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','toUpperCase','error'];(function(_0x5a1269,_0xe4af7d){var _0x494b9d=function(_0x59ca2f){while(--_0x59ca2f){_0x5a1269['push'](_0x5a1269['shift']());}};_0x494b9d(++_0xe4af7d);}(_0x69e1,0xca));var _0x169e=function(_0x31e25b,_0x515296){_0x31e25b=_0x31e25b-0x0;var _0x30c7b2=_0x69e1[_0x31e25b];return _0x30c7b2;};'use strict';var _=require(_0x169e('0x0'));var Promise=require(_0x169e('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0x169e('0x2'));var Redis=require(_0x169e('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x169e('0x4'))(_0x169e('0x5'));config[_0x169e('0x6')]=_['defaults'](config['redis'],{'host':_0x169e('0x7'),'port':0x18eb});var io=require(_0x169e('0x8'))(new Redis(config['redis']));function getAdminUser(_0x828eb2,_0x4ab213,_0x289757,_0x3cfd72,_0x251dc6,_0x3a5af1){return new Promise(function(_0x51fc64,_0x5952c3){var _0x3ceb26={'method':_0x169e('0x9'),'uri':_0x3cfd72+_0x169e('0xa')+'&'+_0x251dc6+'&'+_0x3a5af1,'auth':_0x4ab213,'json':!![]};return rp(_0x3ceb26)['then'](function(_0x8388e){if(_0x8388e[_0x169e('0xb')]['length']>0x0){_0x289757[_0x169e('0xc')]=_0x8388e[_0x169e('0xb')][0x0][_0x169e('0xd')];}logger['info']('['+[_0x828eb2[_0x169e('0xe')]()]+'],\x20getAdminUser\x20crm',_0x289757);_0x51fc64(_0x289757);})['catch'](function(_0x4c0249){logger[_0x169e('0xf')]('['+[_0x828eb2[_0x169e('0xe')]()]+']',_0x4c0249[_0x169e('0x10')]);_0x5952c3(_0x4c0249[_0x169e('0x10')]);});});}function getUser(_0x39871b,_0x77600,_0x3599eb,_0x164430,_0xf3fede){return function(_0x2fd2ee){logger['info']('['+[_0x39871b[_0x169e('0xe')]()]+_0x169e('0x11'),_0x2fd2ee);return new Promise(function(_0x5af96f,_0x3c788b){if(intUtil[_0x169e('0x12')](_0x2fd2ee['userEmail'])){var _0x53e2db={'method':'GET','uri':_0x3599eb+'sys_user?sysparm_query=email%3D'+_0x2fd2ee[_0x169e('0x13')]+'&'+_0x164430+'&'+_0xf3fede,'auth':_0x77600,'json':!![]};logger['info']('['+[_0x39871b['toUpperCase']()]+_0x169e('0x14'),_0x53e2db);return rp(_0x53e2db)[_0x169e('0x15')](function(_0x1f410e){logger['info']('['+[_0x39871b[_0x169e('0xe')]()]+_0x169e('0x16'),_0x1f410e);if(_0x1f410e[_0x169e('0xb')][_0x169e('0x17')]>0x0&&String(_0x1f410e[_0x169e('0xb')][0x0][_0x169e('0x18')])===_0x169e('0x19')){_0x2fd2ee[_0x169e('0x1a')]=_0x1f410e[_0x169e('0xb')][0x0][_0x169e('0xd')];}else{_0x2fd2ee[_0x169e('0x1a')]=_0x2fd2ee[_0x169e('0xc')];_0x2fd2ee[_0x169e('0x13')]=_0x2fd2ee[_0x169e('0x1b')];}logger[_0x169e('0x1c')]('['+[_0x39871b[_0x169e('0xe')]()]+_0x169e('0x1d'),_0x2fd2ee);_0x5af96f(_0x2fd2ee);})[_0x169e('0x1e')](function(_0x12cc08){logger[_0x169e('0xf')]('['+[_0x39871b[_0x169e('0xe')]()]+']',_0x12cc08['message']);_0x3c788b(_0x12cc08[_0x169e('0x10')]);});}else{logger[_0x169e('0x1c')]('['+[_0x39871b[_0x169e('0xe')]()]+']\x20using\x20admin\x20profile');_0x2fd2ee[_0x169e('0x1a')]=_0x2fd2ee[_0x169e('0xc')];_0x2fd2ee['userEmail']=_0x2fd2ee[_0x169e('0x1b')];_0x5af96f(_0x2fd2ee);}});};}function createEndUser(_0x50440e,_0x1fb0ed,_0x131ce6,_0x21e8b8,_0xd90948){logger[_0x169e('0x1c')]('['+[_0x50440e[_0x169e('0xe')]()]+_0x169e('0x1f'),_0x131ce6);return new Promise(function(_0x31f283,_0x277653){var _0x907ced={'method':_0x169e('0x20'),'uri':_0x21e8b8+_0x169e('0x21')+_0xd90948,'body':{'user_name':_0x131ce6[_0x169e('0x22')],'roles':'user','first_name':_0x131ce6[_0x169e('0x22')],'active':_0x169e('0x19'),'date_format':'System','phone':_0x131ce6['endUserNumber']},'auth':_0x1fb0ed,'json':!![]};return rp(_0x907ced)[_0x169e('0x15')](function(_0x52a87c){logger[_0x169e('0x1c')]('['+[_0x50440e[_0x169e('0xe')]()]+_0x169e('0x23'),_0x52a87c['result']);_0x131ce6[_0x169e('0x24')]=_0x52a87c[_0x169e('0xb')][_0x169e('0xd')];_0x31f283(_0x131ce6);})[_0x169e('0x1e')](function(_0x15aed7){logger[_0x169e('0xf')]('['+[_0x50440e[_0x169e('0xe')]()]+']',_0x15aed7[_0x169e('0x10')]);_0x277653(_0x15aed7[_0x169e('0x10')]);});});}function getEndUser(_0x2f4a1f,_0x59c66d,_0x44bb52,_0x2e0fff,_0x281a82){return function(_0x2be995){logger[_0x169e('0x1c')]('['+[_0x2f4a1f[_0x169e('0xe')]()]+'],\x20getEndUser\x20input\x20crm',_0x2be995);return new Promise(function(_0x54c65a,_0x3691fb){var _0xcbde8c={'method':_0x169e('0x9'),'uri':_0x44bb52+_0x169e('0x25')+_0x2be995[_0x169e('0x22')]+'&'+_0x2e0fff+'&'+_0x281a82,'auth':_0x59c66d,'json':!![]};return rp(_0xcbde8c)['then'](function(_0x5bb372){if(_0x5bb372[_0x169e('0xb')]['length']>0x0){_0x2be995[_0x169e('0x24')]=_0x5bb372[_0x169e('0xb')][0x0][_0x169e('0xd')];logger[_0x169e('0x1c')]('['+[_0x2f4a1f['toUpperCase']()]+_0x169e('0x26'),_0x2be995);_0x54c65a(_0x2be995);}else{return createEndUser(_0x2f4a1f,_0x59c66d,_0x2be995,_0x44bb52,_0x2e0fff)[_0x169e('0x15')](function(_0x4df0d1){logger[_0x169e('0x1c')]('['+[_0x2f4a1f[_0x169e('0xe')]()]+_0x169e('0x27'),_0x4df0d1);_0x54c65a(_0x4df0d1);});}})['catch'](function(_0x38c3bb){logger[_0x169e('0xf')]('['+[_0x2f4a1f['toUpperCase']()]+']',_0x38c3bb[_0x169e('0x10')]);_0x3691fb(_0x38c3bb[_0x169e('0x10')]);});});};}function getCustomFields(_0x4d4131,_0x1c4106){var _0x5c0376={};if(_0x4d4131[_0x169e('0x17')]>0x0){_['forEach'](_0x4d4131,function(_0x38bc23){if(_[_0x169e('0x28')]([_0x169e('0x29'),'picklist'],_0x38bc23['type'])&&_0x38bc23['nameField']&&!_0x38bc23[_0x169e('0x2a')]){_0x5c0376[_0x38bc23[_0x169e('0x2b')][_0x169e('0x2c')]()]=_0x38bc23[_0x169e('0x2d')]['toString']();}else if(_['includes']([_0x169e('0x29'),_0x169e('0x2e')],_0x38bc23[_0x169e('0x2f')])&&_0x38bc23['idField']&&_0x38bc23['customField']){_0x5c0376[_0x38bc23[_0x169e('0x30')][_0x169e('0x2c')]()]=_0x38bc23[_0x169e('0x2d')][_0x169e('0x31')]();}else if(_0x38bc23[_0x169e('0x2f')]===_0x169e('0x32')&&_0x38bc23[_0x169e('0x33')]&&_0x38bc23[_0x169e('0x30')]&&_0x38bc23[_0x169e('0x2a')]){_0x5c0376[_0x38bc23['idField']['toLowerCase']()]=_0x1c4106[_0x38bc23[_0x169e('0x33')]][_0x169e('0x31')]();}else if(_0x38bc23[_0x169e('0x2f')]==='customVariable'&&_0x38bc23[_0x169e('0x34')]&&_0x38bc23['Variable'][_0x169e('0x35')]&&_0x38bc23[_0x169e('0x30')]&&_0x38bc23['customField']){_0x5c0376[_0x38bc23[_0x169e('0x30')][_0x169e('0x2c')]()]=_0x1c4106[_0x38bc23['Variable']['name'][_0x169e('0x2c')]()][_0x169e('0x31')]();}});}return _0x5c0376;}function getTicket(_0x26025d,_0x377b70,_0xa28c56,_0x52aaae,_0x4d9115,_0x38b23d){return function(_0xf50ea1){logger[_0x169e('0x1c')]('['+[_0x26025d[_0x169e('0xe')]()]+']\x20getTicket\x20input\x20crm',_0xf50ea1);return new Promise(function(_0x3a1875,_0x2fa398){var _0x31cb18=_0x26025d[_0x169e('0x2c')]()==='outbound'?_0xf50ea1[_0x169e('0x1a')]:_0xf50ea1[_0x169e('0x24')];var _0xaedcb={'method':_0x169e('0x20'),'uri':_0xa28c56+'incident'+'?'+_0x38b23d,'body':Object[_0x169e('0x36')]({},{'active':_0x169e('0x19'),'caller_id':_0x31cb18,'assigned_to':_0xf50ea1[_0x169e('0x1a')],'short_description':intUtil[_0x169e('0x37')](_0x52aaae[_0x169e('0x38')],_0x4d9115,'\x20'),'description':intUtil[_0x169e('0x37')](_0x52aaae[_0x169e('0x39')],_0x4d9115,'\x0a')},getCustomFields(_0x52aaae[_0x169e('0x3a')],_0x4d9115)),'auth':_0x377b70,'json':!![]};return rp(_0xaedcb)[_0x169e('0x15')](function(_0x131e7c){logger[_0x169e('0x1c')]('['+[_0x26025d[_0x169e('0xe')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x131e7c['result']);_0xf50ea1[_0x169e('0x3b')]=_0x131e7c[_0x169e('0xb')][_0x169e('0xd')];_0xf50ea1[_0x169e('0x3c')]=_0x131e7c[_0x169e('0xb')][_0x169e('0x3d')];logger['info']('['+[_0x26025d[_0x169e('0xe')]()]+_0x169e('0x3e'),_0xf50ea1);_0x3a1875(_0xf50ea1);})[_0x169e('0x1e')](function(_0x2af302){logger[_0x169e('0xf')]('['+[_0x26025d['toUpperCase']()]+']',_0x2af302[_0x169e('0x10')]);_0x2fa398(_0x2af302[_0x169e('0x10')]);});});};}function createRemoteTag(_0x2fe096,_0x807230,_0x381dd2,_0x1672d5){return new Promise(function(_0x5c49d0,_0xb1c8a1){var _0x344473={'method':_0x169e('0x20'),'uri':_0x381dd2+_0x169e('0x3f')+'?'+_0x1672d5,'body':{'short_description':_0x2fe096,'global':!![],'active':!![],'name':_0x2fe096},'auth':_0x807230,'json':!![]};return rp(_0x344473)[_0x169e('0x15')](function(_0x35c2a8){var _0x9e4d=_0x35c2a8['result'][_0x169e('0xd')];_0x5c49d0(_0x9e4d);});});}function getRemoteTag(_0x3f201e,_0x17847a,_0x342410,_0x468bc7,_0x10b6b8){return new Promise(function(_0x10af84,_0x116b39){var _0x96100c={'method':_0x169e('0x9'),'uri':_0x342410+_0x169e('0x3f')+_0x169e('0x40')+_0x3f201e+'&'+_0x468bc7,'auth':_0x17847a,'json':!![]};return rp(_0x96100c)[_0x169e('0x15')](function(_0x2ee649){if(_0x2ee649[_0x169e('0xb')][_0x169e('0x17')]>0x0){var _0x426571=_0x2ee649[_0x169e('0xb')][0x0][_0x169e('0xd')];_0x10af84(_0x426571);}else{return createRemoteTag(_0x3f201e,_0x17847a,_0x342410,_0x468bc7)[_0x169e('0x15')](function(_0x2ff486){_0x10af84(_0x2ff486);});}});});}function assignTagToIncident(_0x245e60,_0x768b5b,_0xc5ff2e,_0x473c03,_0x2a4f0f){return new Promise(function(_0x43308a,_0x29d1f6){var _0x4e1beb={'method':_0x169e('0x20'),'uri':_0xc5ff2e+_0x169e('0x41')+'?'+_0x2a4f0f,'body':{'label':_0x245e60,'table':_0x169e('0x42'),'id_type':_0x169e('0x43'),'table_key':_0x473c03[_0x169e('0x3b')],'title':_0x169e('0x44')+_0x473c03['ticketNumber'],'id_display':_0x473c03[_0x169e('0x3c')]},'auth':_0x768b5b,'json':!![]};return rp(_0x4e1beb)[_0x169e('0x15')](function(_0xbfef35){_0x43308a();})['catch'](function(){_0x43308a();});});}function manageTags(_0xe08209,_0x1cd23e,_0x3aa3fa,_0x5f1acf,_0x454b1d,_0x3b6517,_0xe45aac){return new Promise(function(_0x4fc48d,_0x2a66e9){var _0x48beba=[];_0x1cd23e[_0x169e('0x45')](function(_0x107864){_0x48beba['push'](getRemoteTag(_0x107864,_0x3aa3fa,_0x5f1acf,_0x3b6517,_0xe45aac));});return Promise[_0x169e('0x46')](_0x48beba)[_0x169e('0x15')](function(_0x11012f){if(_0x11012f[_0x169e('0x17')]){logger[_0x169e('0x1c')]('['+[_0xe08209[_0x169e('0xe')]()]+_0x169e('0x47'),_0x11012f);var _0x373046=[];_0x11012f[_0x169e('0x45')](function(_0x4ffafc){_0x373046[_0x169e('0x48')](assignTagToIncident(_0x4ffafc,_0x3aa3fa,_0x5f1acf,_0x454b1d,_0x3b6517));});return Promise[_0x169e('0x46')](_0x373046)[_0x169e('0x15')](function(){_0x4fc48d();})[_0x169e('0x1e')](function(){_0x4fc48d();});}else{_0x4fc48d();}});});}function getTags(_0x261dd6,_0x5bbf7a,_0x43209c,_0x357225,_0x343e94,_0x1ec425){return function(_0x1a303f){return new Promise(function(_0x470b0c,_0x3ce021){var _0x46bead=[];var _0x1b4894=_0x357225[_0x169e('0x49')];if(_0x1b4894&&_0x1b4894['length']>0x0){_0x46bead=_[_0x169e('0x4a')](_0x1b4894,'name');}if(_0x46bead[_0x169e('0x17')]>0x0){return manageTags(_0x261dd6,_0x46bead,_0x5bbf7a,_0x43209c,_0x1a303f,_0x343e94,_0x1ec425)[_0x169e('0x15')](function(){_0x470b0c(_0x1a303f);});}else{_0x470b0c(_0x1a303f);}});};}function emit(_0x2b5841,_0x241581,_0x141a22){var _0x2a4455=_0x169e('0x4b')+_0x169e('0x4c')+_0x169e('0x4d')+_0x169e('0x4e');var _0x24fac3={'uri':_0x2b5841+_0x169e('0x4f')+_0x141a22+_0x2a4455};io['to'](util[_0x169e('0x50')](_0x169e('0x51'),_0x241581))[_0x169e('0x52')](_0x169e('0x53'),_0x24fac3);}exports['cs']=function(_0x211be0,_0x411cba,_0x267454,_0x39782a,_0x54e4d8,_0x1ac1fd,_0x50b508,_0x208926){var _0x314d2d={};var _0x7a8db1={'user':_0x1ac1fd[_0x169e('0x54')],'pass':_0x1ac1fd[_0x169e('0x55')]};var _0x369e8b=_0x169e('0x56');var _0x357811=_0x169e('0x57');_0x1ac1fd[_0x169e('0x58')]=intUtil[_0x169e('0x59')](_0x1ac1fd[_0x169e('0x58')]);_0x1ac1fd[_0x169e('0x5a')]=intUtil['stripTrailingSlash'](_0x1ac1fd[_0x169e('0x5a')]);var _0x1cc8f6=util[_0x169e('0x50')](_0x169e('0x5b'),_0x1ac1fd[_0x169e('0x58')]);_0x314d2d[_0x169e('0x13')]=!_[_0x169e('0x5c')](_0x39782a)?_0x39782a[_0x169e('0x5d')]:null;_0x314d2d[_0x169e('0x1b')]=_0x1ac1fd[_0x169e('0x5d')];_0x314d2d[_0x169e('0x22')]=_0x208926[_0x169e('0x2c')]()==='outbound'?_0x411cba[_0x169e('0x5e')]:_0x411cba[_0x169e('0x5f')];_0x314d2d[_0x169e('0x60')]=_0x208926===_0x169e('0x61')||_0x208926===_0x169e('0x62')?_0x169e('0x61'):'outbound';var _0xd732dc=util['format'](_0x169e('0x63'),_0x1ac1fd['serverUrl'],_0x411cba[_0x169e('0x64')],md5(_0x411cba[_0x169e('0x64')]));if(_0x54e4d8&&_0x54e4d8['monitor_format']){logger[_0x169e('0x1c')](_0x169e('0x65'),_0x169e('0x66'));_0x411cba[_0x169e('0x67')]=_0xd732dc;}else if(_0x50b508&&_0x50b508[_0x169e('0x68')]&&_0x50b508[_0x169e('0x68')]!==_0x169e('0x69')){logger['info']('[OUTBOUND]',_0x169e('0x66'));_0x411cba[_0x169e('0x67')]=_0xd732dc;}else{_0x411cba[_0x169e('0x67')]='';}return getAdminUser(_0x208926,_0x7a8db1,_0x314d2d,_0x1cc8f6,_0x357811,_0x369e8b)['then'](getUser(_0x208926,_0x7a8db1,_0x1cc8f6,_0x357811,_0x369e8b))['then'](getEndUser(_0x208926,_0x7a8db1,_0x1cc8f6,_0x357811,_0x369e8b))[_0x169e('0x15')](getTicket(_0x208926,_0x7a8db1,_0x1cc8f6,_0x267454,_0x411cba,_0x357811))[_0x169e('0x15')](function(_0x94c396){logger[_0x169e('0x1c')](util[_0x169e('0x50')](_0x169e('0x6a'),_0x94c396[_0x169e('0x3b')]));logger[_0x169e('0x1c')](util['format']('call\x20direction:\x20%s',_0x208926));if(_0x208926!==_0x169e('0x62')){logger['info']('['+[_0x208926[_0x169e('0xe')]()]+']',_0x169e('0x6b'));emit(_0x1ac1fd[_0x169e('0x58')],_0x39782a[_0x169e('0x35')],_0x94c396['ticketId']);}})[_0x169e('0x1e')](function(_0x4cda95){logger[_0x169e('0xf')]('['+[_0x208926[_0x169e('0xe')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x169e('0x6c')](_0x4cda95,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb785=['/nav_to.do?uri=incident.do?sys_id%3D','user:%s','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','format','isNil','email','outbound','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','type','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name','customField','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','incident','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','forEach','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber'];(function(_0x59191b,_0x364ee2){var _0x158d7a=function(_0x151462){while(--_0x151462){_0x59191b['push'](_0x59191b['shift']());}};_0x158d7a(++_0x364ee2);}(_0xb785,0x8c));var _0x5b78=function(_0x3b54fb,_0x4953df){_0x3b54fb=_0x3b54fb-0x0;var _0x463a4e=_0xb785[_0x3b54fb];return _0x463a4e;};'use strict';var _=require(_0x5b78('0x0'));var Promise=require(_0x5b78('0x1'));var rp=require(_0x5b78('0x2'));var util=require(_0x5b78('0x3'));var md5=require(_0x5b78('0x4'));var Redis=require(_0x5b78('0x5'));var intUtil=require(_0x5b78('0x6'));var config=require(_0x5b78('0x7'));var logger=require(_0x5b78('0x8'))(_0x5b78('0x9'));config[_0x5b78('0xa')]=_[_0x5b78('0xb')](config[_0x5b78('0xa')],{'host':_0x5b78('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x590143,_0x4d0c4f,_0x468db6,_0x2e7f19,_0xcb127a,_0xc1eb96){return new Promise(function(_0x3e7fdf,_0x1db5a9){var _0x57761f={'method':_0x5b78('0xd'),'uri':_0x2e7f19+_0x5b78('0xe')+'&'+_0xcb127a+'&'+_0xc1eb96,'auth':_0x4d0c4f,'json':!![]};return rp(_0x57761f)[_0x5b78('0xf')](function(_0x5778f6){if(_0x5778f6[_0x5b78('0x10')][_0x5b78('0x11')]>0x0){_0x468db6[_0x5b78('0x12')]=_0x5778f6[_0x5b78('0x10')][0x0][_0x5b78('0x13')];}logger[_0x5b78('0x14')]('['+[_0x590143[_0x5b78('0x15')]()]+_0x5b78('0x16'),_0x468db6);_0x3e7fdf(_0x468db6);})[_0x5b78('0x17')](function(_0x1087b2){logger[_0x5b78('0x18')]('['+[_0x590143[_0x5b78('0x15')]()]+']',_0x1087b2[_0x5b78('0x19')]);_0x1db5a9(_0x1087b2[_0x5b78('0x19')]);});});}function getUser(_0x728879,_0x45f651,_0x44f761,_0x4081e9,_0x47805e){return function(_0x9b8007){logger[_0x5b78('0x14')]('['+[_0x728879[_0x5b78('0x15')]()]+'],\x20getUser\x20input\x20crm',_0x9b8007);return new Promise(function(_0x2524fe,_0x39501f){if(intUtil[_0x5b78('0x1a')](_0x9b8007[_0x5b78('0x1b')])){var _0x4ec1b1={'method':_0x5b78('0xd'),'uri':_0x44f761+_0x5b78('0x1c')+_0x9b8007[_0x5b78('0x1b')]+'&'+_0x4081e9+'&'+_0x47805e,'auth':_0x45f651,'json':!![]};logger[_0x5b78('0x14')]('['+[_0x728879[_0x5b78('0x15')]()]+_0x5b78('0x1d'),_0x4ec1b1);return rp(_0x4ec1b1)[_0x5b78('0xf')](function(_0x1cd7cc){logger[_0x5b78('0x14')]('['+[_0x728879[_0x5b78('0x15')]()]+_0x5b78('0x1e'),_0x1cd7cc);if(_0x1cd7cc[_0x5b78('0x10')][_0x5b78('0x11')]>0x0&&String(_0x1cd7cc[_0x5b78('0x10')][0x0]['active'])===_0x5b78('0x1f')){_0x9b8007[_0x5b78('0x20')]=_0x1cd7cc[_0x5b78('0x10')][0x0][_0x5b78('0x13')];}else{_0x9b8007['userId']=_0x9b8007['adminId'];_0x9b8007[_0x5b78('0x1b')]=_0x9b8007[_0x5b78('0x21')];}logger['info']('['+[_0x728879[_0x5b78('0x15')]()]+_0x5b78('0x22'),_0x9b8007);_0x2524fe(_0x9b8007);})[_0x5b78('0x17')](function(_0x2824ec){logger['error']('['+[_0x728879[_0x5b78('0x15')]()]+']',_0x2824ec[_0x5b78('0x19')]);_0x39501f(_0x2824ec[_0x5b78('0x19')]);});}else{logger[_0x5b78('0x14')]('['+[_0x728879[_0x5b78('0x15')]()]+_0x5b78('0x23'));_0x9b8007[_0x5b78('0x20')]=_0x9b8007['adminId'];_0x9b8007[_0x5b78('0x1b')]=_0x9b8007[_0x5b78('0x21')];_0x2524fe(_0x9b8007);}});};}function createEndUser(_0x35871d,_0x5b29fb,_0x20de38,_0x278d96,_0x50846e){logger['info']('['+[_0x35871d[_0x5b78('0x15')]()]+_0x5b78('0x24'),_0x20de38);return new Promise(function(_0x1d5150,_0x234758){var _0x247e3c={'method':_0x5b78('0x25'),'uri':_0x278d96+_0x5b78('0x26')+_0x50846e,'body':{'user_name':_0x20de38[_0x5b78('0x27')],'roles':_0x5b78('0x28'),'first_name':_0x20de38['endUserNumber'],'active':'true','date_format':_0x5b78('0x29'),'phone':_0x20de38[_0x5b78('0x27')]},'auth':_0x5b29fb,'json':!![]};return rp(_0x247e3c)[_0x5b78('0xf')](function(_0x413941){logger[_0x5b78('0x14')]('['+[_0x35871d[_0x5b78('0x15')]()]+_0x5b78('0x2a'),_0x413941[_0x5b78('0x10')]);_0x20de38[_0x5b78('0x2b')]=_0x413941[_0x5b78('0x10')][_0x5b78('0x13')];_0x1d5150(_0x20de38);})[_0x5b78('0x17')](function(_0x3a6633){logger['error']('['+[_0x35871d[_0x5b78('0x15')]()]+']',_0x3a6633['message']);_0x234758(_0x3a6633['message']);});});}function getEndUser(_0x4b642e,_0x56ef59,_0x164156,_0x597ba1,_0x31bc7f){return function(_0x486c2d){logger[_0x5b78('0x14')]('['+[_0x4b642e[_0x5b78('0x15')]()]+_0x5b78('0x2c'),_0x486c2d);return new Promise(function(_0x41719a,_0x5661e0){var _0x2e14e0={'method':_0x5b78('0xd'),'uri':_0x164156+_0x5b78('0x2d')+_0x486c2d['endUserNumber']+'&'+_0x597ba1+'&'+_0x31bc7f,'auth':_0x56ef59,'json':!![]};return rp(_0x2e14e0)[_0x5b78('0xf')](function(_0x5485e7){if(_0x5485e7[_0x5b78('0x10')][_0x5b78('0x11')]>0x0){_0x486c2d[_0x5b78('0x2b')]=_0x5485e7[_0x5b78('0x10')][0x0][_0x5b78('0x13')];logger[_0x5b78('0x14')]('['+[_0x4b642e['toUpperCase']()]+_0x5b78('0x2e'),_0x486c2d);_0x41719a(_0x486c2d);}else{return createEndUser(_0x4b642e,_0x56ef59,_0x486c2d,_0x164156,_0x597ba1)[_0x5b78('0xf')](function(_0x3dfb66){logger['info']('['+[_0x4b642e[_0x5b78('0x15')]()]+_0x5b78('0x2f'),_0x3dfb66);_0x41719a(_0x3dfb66);});}})[_0x5b78('0x17')](function(_0x24d127){logger['error']('['+[_0x4b642e[_0x5b78('0x15')]()]+']',_0x24d127['message']);_0x5661e0(_0x24d127[_0x5b78('0x19')]);});});};}function getCustomFields(_0xac6078,_0x3e1bc0){var _0x45263b={};if(_0xac6078[_0x5b78('0x11')]>0x0){_['forEach'](_0xac6078,function(_0x320e29){if(_[_0x5b78('0x30')]([_0x5b78('0x31'),_0x5b78('0x32')],_0x320e29[_0x5b78('0x33')])&&_0x320e29['nameField']&&!_0x320e29['customField']){_0x45263b[_0x320e29[_0x5b78('0x34')][_0x5b78('0x35')]()]=_0x320e29[_0x5b78('0x36')][_0x5b78('0x37')]();}else if(_[_0x5b78('0x30')]([_0x5b78('0x31'),'picklist'],_0x320e29['type'])&&_0x320e29['idField']&&_0x320e29['customField']){_0x45263b[_0x320e29[_0x5b78('0x38')][_0x5b78('0x35')]()]=_0x320e29['content'][_0x5b78('0x37')]();}else if(_0x320e29[_0x5b78('0x33')]===_0x5b78('0x39')&&_0x320e29[_0x5b78('0x3a')]&&_0x320e29[_0x5b78('0x38')]&&_0x320e29['customField']){_0x45263b[_0x320e29[_0x5b78('0x38')]['toLowerCase']()]=_0x3e1bc0[_0x320e29[_0x5b78('0x3a')]][_0x5b78('0x37')]();}else if(_0x320e29[_0x5b78('0x33')]===_0x5b78('0x3b')&&_0x320e29[_0x5b78('0x3c')]&&_0x320e29[_0x5b78('0x3c')][_0x5b78('0x3d')]&&_0x320e29['idField']&&_0x320e29[_0x5b78('0x3e')]){_0x45263b[_0x320e29['idField'][_0x5b78('0x35')]()]=_0x3e1bc0[_0x320e29[_0x5b78('0x3c')][_0x5b78('0x3d')][_0x5b78('0x35')]()][_0x5b78('0x37')]();}});}return _0x45263b;}function getTicket(_0x1470ea,_0x1ebff9,_0x11f646,_0x4b8870,_0x454bb6,_0x197826){return function(_0x23913c){logger['info']('['+[_0x1470ea[_0x5b78('0x15')]()]+']\x20getTicket\x20input\x20crm',_0x23913c);return new Promise(function(_0x27789b,_0x28cf63){var _0x30ec2d=_0x1470ea[_0x5b78('0x35')]()==='outbound'?_0x23913c[_0x5b78('0x20')]:_0x23913c[_0x5b78('0x2b')];var _0x4b05c2={'method':_0x5b78('0x25'),'uri':_0x11f646+'incident'+'?'+_0x197826,'body':Object[_0x5b78('0x3f')]({},{'active':'true','caller_id':_0x30ec2d,'assigned_to':_0x23913c['userId'],'short_description':intUtil[_0x5b78('0x40')](_0x4b8870[_0x5b78('0x41')],_0x454bb6,'\x20'),'description':intUtil[_0x5b78('0x40')](_0x4b8870[_0x5b78('0x42')],_0x454bb6,'\x0a')},getCustomFields(_0x4b8870[_0x5b78('0x43')],_0x454bb6)),'auth':_0x1ebff9,'json':!![]};return rp(_0x4b05c2)['then'](function(_0x1d49e4){logger[_0x5b78('0x14')]('['+[_0x1470ea['toUpperCase']()]+_0x5b78('0x44'),_0x1d49e4[_0x5b78('0x10')]);_0x23913c[_0x5b78('0x45')]=_0x1d49e4['result']['sys_id'];_0x23913c[_0x5b78('0x46')]=_0x1d49e4['result'][_0x5b78('0x47')];logger[_0x5b78('0x14')]('['+[_0x1470ea['toUpperCase']()]+']\x20getTicket\x20crm',_0x23913c);_0x27789b(_0x23913c);})[_0x5b78('0x17')](function(_0x214fb8){logger[_0x5b78('0x18')]('['+[_0x1470ea[_0x5b78('0x15')]()]+']',_0x214fb8['message']);_0x28cf63(_0x214fb8['message']);});});};}function createRemoteTag(_0x23ef03,_0x142118,_0xad17ce,_0x2f6bcd){return new Promise(function(_0x984a92,_0xdf1db4){var _0xb30cfc={'method':_0x5b78('0x25'),'uri':_0xad17ce+'label'+'?'+_0x2f6bcd,'body':{'short_description':_0x23ef03,'global':!![],'active':!![],'name':_0x23ef03},'auth':_0x142118,'json':!![]};return rp(_0xb30cfc)[_0x5b78('0xf')](function(_0x2f366d){var _0x28d9f2=_0x2f366d['result'][_0x5b78('0x13')];_0x984a92(_0x28d9f2);});});}function getRemoteTag(_0x4f8a68,_0x406a09,_0x5aad8e,_0x152fc6,_0x2f8ed6){return new Promise(function(_0x293e5a,_0x58f1bf){var _0x5604b6={'method':_0x5b78('0xd'),'uri':_0x5aad8e+_0x5b78('0x48')+_0x5b78('0x49')+_0x4f8a68+'&'+_0x152fc6,'auth':_0x406a09,'json':!![]};return rp(_0x5604b6)[_0x5b78('0xf')](function(_0x594db4){if(_0x594db4[_0x5b78('0x10')][_0x5b78('0x11')]>0x0){var _0x14a737=_0x594db4[_0x5b78('0x10')][0x0]['sys_id'];_0x293e5a(_0x14a737);}else{return createRemoteTag(_0x4f8a68,_0x406a09,_0x5aad8e,_0x152fc6)[_0x5b78('0xf')](function(_0x39c0e4){_0x293e5a(_0x39c0e4);});}});});}function assignTagToIncident(_0xea05a5,_0x38e759,_0x5e8b99,_0x5231c0,_0x4e89c1){return new Promise(function(_0x36c8a1,_0x112256){var _0x10e3ab={'method':_0x5b78('0x25'),'uri':_0x5e8b99+_0x5b78('0x4a')+'?'+_0x4e89c1,'body':{'label':_0xea05a5,'table':_0x5b78('0x4b'),'id_type':_0x5b78('0x4c'),'table_key':_0x5231c0[_0x5b78('0x45')],'title':_0x5b78('0x4d')+_0x5231c0[_0x5b78('0x46')],'id_display':_0x5231c0[_0x5b78('0x46')]},'auth':_0x38e759,'json':!![]};return rp(_0x10e3ab)[_0x5b78('0xf')](function(_0x1db9cd){_0x36c8a1();})[_0x5b78('0x17')](function(){_0x36c8a1();});});}function manageTags(_0x161a68,_0x1d2c66,_0x49f068,_0x5cd786,_0x2f2e81,_0x30feae,_0x507faf){return new Promise(function(_0x59853c,_0x553f5e){var _0x13a2e1=[];_0x1d2c66['forEach'](function(_0x3d0981){_0x13a2e1[_0x5b78('0x4e')](getRemoteTag(_0x3d0981,_0x49f068,_0x5cd786,_0x30feae,_0x507faf));});return Promise[_0x5b78('0x4f')](_0x13a2e1)[_0x5b78('0xf')](function(_0x33ff55){if(_0x33ff55['length']){logger[_0x5b78('0x14')]('['+[_0x161a68['toUpperCase']()]+_0x5b78('0x50'),_0x33ff55);var _0x5ada32=[];_0x33ff55[_0x5b78('0x51')](function(_0x5dec3){_0x5ada32[_0x5b78('0x4e')](assignTagToIncident(_0x5dec3,_0x49f068,_0x5cd786,_0x2f2e81,_0x30feae));});return Promise[_0x5b78('0x4f')](_0x5ada32)[_0x5b78('0xf')](function(){_0x59853c();})[_0x5b78('0x17')](function(){_0x59853c();});}else{_0x59853c();}});});}function getTags(_0x187119,_0x3d4d3f,_0x413732,_0x385f35,_0x21c3a9,_0x240740){return function(_0x4fd164){return new Promise(function(_0x29f496,_0x56aa4e){var _0x42d5d4=[];var _0x41e7b1=_0x385f35[_0x5b78('0x52')];if(_0x41e7b1&&_0x41e7b1['length']>0x0){_0x42d5d4=_[_0x5b78('0x53')](_0x41e7b1,'name');}if(_0x42d5d4['length']>0x0){return manageTags(_0x187119,_0x42d5d4,_0x3d4d3f,_0x413732,_0x4fd164,_0x21c3a9,_0x240740)['then'](function(){_0x29f496(_0x4fd164);});}else{_0x29f496(_0x4fd164);}});};}function emit(_0x46fdfc,_0x23768a,_0xb9fa18){var _0x87951a=_0x5b78('0x54')+_0x5b78('0x55')+_0x5b78('0x56')+_0x5b78('0x57');var _0x482a27={'uri':_0x46fdfc+_0x5b78('0x58')+_0xb9fa18+_0x87951a};io['to'](util['format'](_0x5b78('0x59'),_0x23768a))['emit']('trigger:browser:url',_0x482a27);}exports['cs']=function(_0x2918b2,_0x3ef9c7,_0x4cec5d,_0x18f610,_0x5a904f,_0x4301d2,_0x3429c5,_0x5e21dc){var _0x3706c0={};var _0x57f3cc={'user':_0x4301d2[_0x5b78('0x5a')],'pass':_0x4301d2[_0x5b78('0x5b')]};var _0x11bb9a='sysparm_limit=1';var _0x1453ed=_0x5b78('0x5c');_0x4301d2[_0x5b78('0x5d')]=intUtil[_0x5b78('0x5e')](_0x4301d2[_0x5b78('0x5d')]);_0x4301d2['serverUrl']=intUtil[_0x5b78('0x5e')](_0x4301d2['serverUrl']);var _0x591999=util[_0x5b78('0x5f')]('%s/api/now/table/',_0x4301d2[_0x5b78('0x5d')]);_0x3706c0[_0x5b78('0x1b')]=!_[_0x5b78('0x60')](_0x18f610)?_0x18f610['email']:null;_0x3706c0[_0x5b78('0x21')]=_0x4301d2[_0x5b78('0x61')];_0x3706c0['endUserNumber']=_0x5e21dc[_0x5b78('0x35')]()===_0x5b78('0x62')?_0x3ef9c7['destcalleridnum']:_0x3ef9c7['calleridnum'];_0x3706c0[_0x5b78('0x63')]=_0x5e21dc===_0x5b78('0x64')||_0x5e21dc===_0x5b78('0x65')?_0x5b78('0x64'):_0x5b78('0x62');var _0x52d248=util[_0x5b78('0x5f')](_0x5b78('0x66'),_0x4301d2[_0x5b78('0x67')],_0x3ef9c7[_0x5b78('0x68')],md5(_0x3ef9c7[_0x5b78('0x68')]));if(_0x5a904f&&_0x5a904f[_0x5b78('0x69')]){logger[_0x5b78('0x14')]('[QUEUE]',_0x5b78('0x6a'));_0x3ef9c7[_0x5b78('0x6b')]=_0x52d248;}else if(_0x3429c5&&_0x3429c5[_0x5b78('0x6c')]&&_0x3429c5[_0x5b78('0x6c')]!==_0x5b78('0x6d')){logger[_0x5b78('0x14')]('[OUTBOUND]',_0x5b78('0x6a'));_0x3ef9c7[_0x5b78('0x6b')]=_0x52d248;}else{_0x3ef9c7[_0x5b78('0x6b')]='';}return getAdminUser(_0x5e21dc,_0x57f3cc,_0x3706c0,_0x591999,_0x1453ed,_0x11bb9a)[_0x5b78('0xf')](getUser(_0x5e21dc,_0x57f3cc,_0x591999,_0x1453ed,_0x11bb9a))['then'](getEndUser(_0x5e21dc,_0x57f3cc,_0x591999,_0x1453ed,_0x11bb9a))['then'](getTicket(_0x5e21dc,_0x57f3cc,_0x591999,_0x4cec5d,_0x3ef9c7,_0x1453ed))['then'](function(_0x5d8f5f){logger[_0x5b78('0x14')](util['format'](_0x5b78('0x6e'),_0x5d8f5f['ticketId']));logger[_0x5b78('0x14')](util[_0x5b78('0x5f')](_0x5b78('0x6f'),_0x5e21dc));if(_0x5e21dc!=='unmanaged'){logger[_0x5b78('0x14')]('['+[_0x5e21dc['toUpperCase']()]+']',_0x5b78('0x70'));emit(_0x4301d2['remoteUri'],_0x18f610[_0x5b78('0x3d')],_0x5d8f5f[_0x5b78('0x45')]);}})[_0x5b78('0x17')](function(_0x55d264){logger[_0x5b78('0x18')]('['+[_0x5e21dc[_0x5b78('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x5b78('0x71')](_0x55d264,{'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 4fa5681..5e6ee7a 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 _0x2cb6=['[HTTP]','merge','map','type','string','nameField','toLowerCase','content','custom_fields','variable','customField','customVariable','Variable','POST','login','username','password','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','uri','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Fields','Outbound','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','Inbound','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','socket.io-emitter','emit','info','name','getString','Subjects','assigned_user_id','created_by','Descriptions','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','direction','length','forEach','variableName','push','idField','set_entry','JSON','format','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','Agent\x20found!','resolve','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug'];(function(_0x147e8a,_0x8c4570){var _0x22efe7=function(_0x57fd66){while(--_0x57fd66){_0x147e8a['push'](_0x147e8a['shift']());}};_0x22efe7(++_0x8c4570);}(_0x2cb6,0x130));var _0x62cb=function(_0x5877db,_0x23165b){_0x5877db=_0x5877db-0x0;var _0x362fdb=_0x2cb6[_0x5877db];return _0x362fdb;};'use strict';var _=require(_0x62cb('0x0'));var rp=require('request-promise');var BPromise=require(_0x62cb('0x1'));var md5=require(_0x62cb('0x2'));var util=require(_0x62cb('0x3'));var Redis=require(_0x62cb('0x4'));var intUtil=require(_0x62cb('0x5'));var config=require(_0x62cb('0x6'));var logger=require('../../../../config/logger')('sugarcrm');config[_0x62cb('0x7')]=_[_0x62cb('0x8')](config[_0x62cb('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x62cb('0x9'))(new Redis(config[_0x62cb('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x4218a5,_0x29278b,_0x3a76b1){io['to'](_0x4218a5)[_0x62cb('0xa')](_0x29278b,_0x3a76b1);}function getTicket(_0x3229d7,_0x321fc5,_0x1bafae,_0x35c313,_0x4aa718,_0x2f2f2f,_0x270c13,_0x6445e0){logger[_0x62cb('0xb')]('Creating\x20new\x20ticket...');var _0x3ef55c=new Date();var _0x95641f=[{'name':_0x62cb('0xc'),'value':intUtil[_0x62cb('0xd')](_0x35c313[_0x62cb('0xe')],_0x4aa718,'\x20')},{'name':_0x62cb('0xf'),'value':_0x321fc5['id']},{'name':_0x62cb('0x10'),'value':_0x321fc5['id']},{'name':'description','value':intUtil[_0x62cb('0xd')](_0x35c313[_0x62cb('0x11')],_0x4aa718,'\x0a')},{'name':'date_start','value':_0x3ef55c[_0x62cb('0x12')]()[_0x62cb('0x13')](0x0,0x13)['replace']('T','\x20')},{'name':_0x62cb('0x14'),'value':'0'},{'name':_0x62cb('0x15'),'value':'15'},{'name':_0x62cb('0x16'),'value':_0x1bafae['id']},{'name':_0x62cb('0x17'),'value':'Contacts'},{'name':'parent_name','value':_0x1bafae[_0x62cb('0xc')]},{'name':_0x62cb('0x18'),'value':_0x6445e0}];if(_0x2f2f2f[_0x62cb('0x19')]){_[_0x62cb('0x1a')](_0x2f2f2f,function(_0x4c2f87){if(_0x4aa718[_0x4c2f87[_0x62cb('0x1b')]]){_0x95641f[_0x62cb('0x1c')]({'name':_0x4c2f87[_0x62cb('0x1d')],'value':_0x4aa718[_0x4c2f87[_0x62cb('0x1b')]]});}});}return request({'form':{'method':_0x62cb('0x1e'),'input_type':_0x62cb('0x1f'),'response_type':_0x62cb('0x1f'),'rest_data':JSON['stringify']({'session':_0x270c13['id'],'module_name':'Calls','name_value_list':_0x95641f})}});}function getAuth(_0x470870){return util[_0x62cb('0x20')](_0x62cb('0x21'),new Buffer(_0x470870[_0x62cb('0x22')]+':X')[_0x62cb('0x23')](_0x62cb('0x24')));}function getServerInfo(_0x394879){return request({'form':{'method':_0x62cb('0x25'),'input_type':_0x62cb('0x1f'),'response_type':'JSON','rest_data':JSON[_0x62cb('0x26')]({'session':_0x394879['id']})}});}function getUser(_0x55cdf1,_0x3c1439,_0x149fbc){if(!_[_0x62cb('0x27')](_0x3c1439)){logger[_0x62cb('0xb')](_0x62cb('0x28'),_0x3c1439);return request({'form':{'method':_0x62cb('0x29'),'input_type':_0x62cb('0x1f'),'response_type':_0x62cb('0x1f'),'rest_data':JSON[_0x62cb('0x26')]({'session':_0x149fbc['id'],'module_name':_0x62cb('0x2a'),'query':util['format'](_0x62cb('0x2b'),_0x3c1439),'order_by':'','offset':'0','select_fields':['id',_0x62cb('0xc'),_0x62cb('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1984aa){if(_0x1984aa[_0x62cb('0x2d')][_0x62cb('0x19')]){var _0xb24f42=_[_0x62cb('0x2e')](_0x1984aa['entry_list'],function(_0x455500){return _0x455500['name_value_list']['user_name']['value']===_0x3c1439;});if(_0xb24f42){logger[_0x62cb('0xb')](_0x62cb('0x2f'));return BPromise[_0x62cb('0x30')]({'id':_0xb24f42[_0x62cb('0x31')]['id'][_0x62cb('0x32')],'name':_0xb24f42[_0x62cb('0x31')][_0x62cb('0xc')][_0x62cb('0x32')]});}}logger[_0x62cb('0xb')](_0x62cb('0x33'));return BPromise[_0x62cb('0x30')]({'id':_0x149fbc['name_value_list']['user_id']['value'],'name':_0x149fbc[_0x62cb('0x31')]['user_name']['value']});});}else{logger[_0x62cb('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x62cb('0x30')]({'id':_0x149fbc[_0x62cb('0x31')][_0x62cb('0x34')]['value'],'name':_0x149fbc[_0x62cb('0x31')][_0x62cb('0x2c')]['value']});}}function getEndUser(_0x1afffc,_0xd16e29,_0x442287,_0x2ec94d){logger[_0x62cb('0xb')](_0x62cb('0x35'),_0x442287);return request({'form':{'method':_0x62cb('0x29'),'input_type':'JSON','response_type':_0x62cb('0x1f'),'rest_data':JSON[_0x62cb('0x26')]({'session':_0x2ec94d['id'],'module_name':_0x62cb('0x36'),'query':util['format'](_0x62cb('0x37'),_0x442287),'order_by':'','offset':'0','select_fields':['id',_0x62cb('0xc'),_0x62cb('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x62cb('0x39')](function(_0x5b0a8e){if(_0x5b0a8e[_0x62cb('0x2d')][_0x62cb('0x19')]){var _0x470118=_['find'](_0x5b0a8e[_0x62cb('0x2d')],function(_0x5e924f){return _0x5e924f[_0x62cb('0x31')][_0x62cb('0x38')][_0x62cb('0x32')]===_0x442287;});if(_0x470118){logger['info'](_0x62cb('0x3a'));return BPromise[_0x62cb('0x30')]({'id':_0x470118['name_value_list']['id']['value'],'name':_0x470118[_0x62cb('0x31')]['name'][_0x62cb('0x32')],'phone':_0x470118['name_value_list'][_0x62cb('0x38')][_0x62cb('0x32')]});}}else{logger[_0x62cb('0xb')](_0x62cb('0x3b'));return request({'form':{'method':_0x62cb('0x1e'),'input_type':_0x62cb('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2ec94d['id'],'module_name':_0x62cb('0x36'),'name_value_list':[{'name':'first_name','value':_0xd16e29!==_0x62cb('0x3c')?_0xd16e29:util[_0x62cb('0x20')](_0x62cb('0x3d'),_0x442287)},{'name':'phone_home','value':_0x442287}]})}})[_0x62cb('0x39')](function(_0x5694db){logger['info'](_0x62cb('0x3e'));return BPromise[_0x62cb('0x30')]({'id':_0x5694db['id'],'name':_0x5694db[_0x62cb('0x2d')][_0x62cb('0x3f')][_0x62cb('0x32')],'phone':_0x5694db['entry_list'][_0x62cb('0x38')][_0x62cb('0x32')]});});}});}function request(_0x141068){logger[_0x62cb('0x40')](_0x62cb('0x41'),JSON[_0x62cb('0x26')](_0x141068));return rp(_[_0x62cb('0x42')](def,_0x141068));}function getTags(_0x1d2361,_0x137ab3){var _0x5c3890=[];if(_0x1d2361&&_0x1d2361[_0x62cb('0x19')]>0x0){_0x5c3890=_[_0x62cb('0x43')](_0x1d2361,_0x137ab3);}return _0x5c3890;}function getCustomFields(_0x20f985,_0x3b1c22){var _0x2ad5af=[];var _0x2f6866={'custom_fields':[]};if(_0x20f985[_0x62cb('0x19')]>0x0){_[_0x62cb('0x1a')](_0x20f985,function(_0x47373b){if(_0x47373b[_0x62cb('0x44')]===_0x62cb('0x45')&&_0x47373b['nameField']&&!_0x47373b['customField']){_0x2f6866[_0x47373b[_0x62cb('0x46')][_0x62cb('0x47')]()]=_0x47373b[_0x62cb('0x48')][_0x62cb('0x23')]();}else if(_0x47373b[_0x62cb('0x44')]==='string'&&_0x47373b[_0x62cb('0x1d')]&&_0x47373b['customField']){_0x2f6866[_0x62cb('0x49')]['push']({'id':_0x47373b[_0x62cb('0x1d')],'value':_0x47373b[_0x62cb('0x48')]['toString']()});}else if(_0x47373b[_0x62cb('0x44')]===_0x62cb('0x4a')&&_0x47373b['variableName']&&_0x47373b[_0x62cb('0x1d')]&&_0x47373b[_0x62cb('0x4b')]){_0x3b1c22[_0x47373b[_0x62cb('0x1b')]]&&_0x2f6866[_0x62cb('0x49')][_0x62cb('0x1c')]({'id':_0x47373b[_0x62cb('0x1d')],'value':_0x3b1c22[_0x47373b[_0x62cb('0x1b')]][_0x62cb('0x23')]()});}else if(_0x47373b['type']===_0x62cb('0x4c')&&_0x47373b[_0x62cb('0x4d')]&&_0x47373b[_0x62cb('0x4d')][_0x62cb('0xc')]&&_0x47373b['idField']&&_0x47373b[_0x62cb('0x4b')]){_0x3b1c22[_0x47373b[_0x62cb('0x4d')][_0x62cb('0xc')][_0x62cb('0x47')]()]&&_0x2f6866[_0x62cb('0x49')][_0x62cb('0x1c')]({'id':_0x47373b[_0x62cb('0x1d')],'value':_0x3b1c22[_0x47373b[_0x62cb('0x4d')][_0x62cb('0xc')]['toLowerCase']()][_0x62cb('0x23')]()});}});}return _0x2f6866;}function getConnection(_0x43400e){return request({'method':_0x62cb('0x4e'),'form':{'method':_0x62cb('0x4f'),'input_type':_0x62cb('0x1f'),'response_type':_0x62cb('0x1f'),'rest_data':JSON[_0x62cb('0x26')]({'user_auth':{'user_name':_0x43400e[_0x62cb('0x50')],'password':_0x43400e[_0x62cb('0x51')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x4b8118){var _0xb9abe0=_0x4b8118;if(_0xb9abe0['id']){def[_0x62cb('0x52')]=_0xb9abe0['id'];return BPromise[_0x62cb('0x30')](_0xb9abe0);}else{throw new Error(util[_0x62cb('0x20')](_0x62cb('0x53'),_0x43400e['id']));}});}function setRelationship(_0x14b13e,_0x5afff2,_0x523fb2,_0x197fdd){return request({'form':{'method':_0x62cb('0x54'),'input_type':'JSON','response_type':_0x62cb('0x1f'),'rest_data':JSON['stringify']({'session':_0x14b13e['id'],'module_name':_0x62cb('0x55'),'module_id':_0x523fb2['id'],'link_field_name':_0x197fdd,'related_ids':[_0x5afff2['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x31113c,_0x23c82d,_0x20cb54,_0x56c12b,_0xd3c8e7,_0x119e6e){var _0x539048,_0x2162c1,_0x5a3c71,_0x5edeac;_0x119e6e[_0x62cb('0x56')]=intUtil[_0x62cb('0x57')](_0x119e6e[_0x62cb('0x56')]);_0x119e6e[_0x62cb('0x58')]=intUtil['stripTrailingSlash'](_0x119e6e[_0x62cb('0x58')]);def['uri']=util[_0x62cb('0x20')](_0x62cb('0x59'),_0x119e6e[_0x62cb('0x56')]);if(_0xd3c8e7&&_0xd3c8e7[_0x62cb('0x5a')]){logger[_0x62cb('0xb')]('[QUEUE]',_0x62cb('0x5b'));_0x23c82d[_0x62cb('0x5c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x119e6e['serverUrl'],_0x23c82d[_0x62cb('0x5d')],md5(_0x23c82d[_0x62cb('0x5d')]));}else{_0x23c82d['recordingURL']='';}return getConnection(_0x119e6e)[_0x62cb('0x39')](function(_0x39c5a1){_0x5edeac=_0x39c5a1;return getUser(_0x119e6e,_0x56c12b['name'],_0x5edeac);})[_0x62cb('0x39')](function(_0x37b9b3){_0x539048=_0x37b9b3;logger[_0x62cb('0xb')](_0x62cb('0x5e'),_0x539048['id']);return getEndUser(_0x119e6e,_0x23c82d[_0x62cb('0x5f')],_0x23c82d[_0x62cb('0x60')],_0x5edeac);})[_0x62cb('0x39')](function(_0x31f836){_0x2162c1=_0x31f836;logger[_0x62cb('0xb')](_0x62cb('0x61'),_0x2162c1['id']);return getTicket(_0x119e6e,_0x539048,_0x2162c1,_0x20cb54,_0x23c82d,_0x20cb54['Fields'],_0x5edeac,'Inbound');})[_0x62cb('0x39')](function(_0x58551b){_0x5a3c71=_0x58551b;logger['info'](_0x62cb('0x62'));logger[_0x62cb('0xb')]('The\x20Ticket\x20ID\x20is:',_0x5a3c71['id']);return setRelationship(_0x5edeac,_0x539048,_0x5a3c71,_0x62cb('0x63'));})[_0x62cb('0x39')](function(){return setRelationship(_0x5edeac,_0x2162c1,_0x5a3c71,_0x62cb('0x64'));})[_0x62cb('0x39')](function(){return getServerInfo(_0x5edeac);})[_0x62cb('0x39')](function(_0x5eb9a3){var _0xf4ef50=parseInt(_0x5eb9a3[_0x62cb('0x65')][_0x62cb('0x66')](0x0));var _0x1bb7b2=util['format'](_0x62cb('0x67'),_0x119e6e[_0x62cb('0x56')],_0x5a3c71['id']);if(_0xf4ef50>0x6){_0x1bb7b2=util[_0x62cb('0x20')](_0x62cb('0x68'),_0x119e6e[_0x62cb('0x56')],_0x5a3c71['id']);}logger[_0x62cb('0xb')](_0x62cb('0x69'),_0x62cb('0x6a'));emit(util['format']('user:%s',_0x56c12b['name']),_0x62cb('0x6b'),{'uri':_0x1bb7b2});})[_0x62cb('0x6c')](function(_0x29d34b){logger[_0x62cb('0x6d')](_0x62cb('0x69'),JSON[_0x62cb('0x26')](_0x29d34b));});};exports['outbound']=function(_0x561c68,_0x3ee0ba,_0xefcbf5,_0x4693cf,_0x4e7e78,_0x41ac2e,_0x1a9d5c){var _0x1e28ce,_0x41cc1b,_0x5e01b1,_0x3564b2;_0x41ac2e[_0x62cb('0x56')]=intUtil[_0x62cb('0x57')](_0x41ac2e[_0x62cb('0x56')]);_0x41ac2e[_0x62cb('0x58')]=intUtil[_0x62cb('0x57')](_0x41ac2e[_0x62cb('0x58')]);def[_0x62cb('0x6e')]=util['format'](_0x62cb('0x59'),_0x41ac2e[_0x62cb('0x56')]);if(_0x1a9d5c&&_0x1a9d5c[_0x62cb('0x6f')]&&_0x1a9d5c['recordingFormat']!=='none'){logger[_0x62cb('0xb')](_0x62cb('0x70'),_0x62cb('0x5b'));_0x3ee0ba[_0x62cb('0x5c')]=util[_0x62cb('0x20')](_0x62cb('0x71'),_0x41ac2e['serverUrl'],_0x3ee0ba[_0x62cb('0x5d')],md5(_0x3ee0ba['uniqueid']));}return getConnection(_0x41ac2e)[_0x62cb('0x39')](function(_0x13db45){_0x3564b2=_0x13db45;return getUser(_0x41ac2e,_0x4693cf[_0x62cb('0xc')],_0x3564b2);})['then'](function(_0x488ead){_0x1e28ce=_0x488ead;logger[_0x62cb('0xb')]('The\x20User\x20ID\x20is:',_0x1e28ce['id']);return getEndUser(_0x41ac2e,_0x3ee0ba['destcalleridname'],_0x3ee0ba[_0x62cb('0x72')],_0x3564b2);})[_0x62cb('0x39')](function(_0x123924){_0x41cc1b=_0x123924;logger['info'](_0x62cb('0x61'),_0x41cc1b['id']);return getTicket(_0x41ac2e,_0x1e28ce,_0x41cc1b,_0xefcbf5,_0x3ee0ba,_0xefcbf5[_0x62cb('0x73')],_0x3564b2,_0x62cb('0x74'));})[_0x62cb('0x39')](function(_0x2616ab){_0x5e01b1=_0x2616ab;logger[_0x62cb('0xb')](_0x62cb('0x62'));logger['info'](_0x62cb('0x75'),_0x5e01b1['id']);return setRelationship(_0x3564b2,_0x1e28ce,_0x5e01b1,_0x62cb('0x63'));})[_0x62cb('0x39')](function(){return setRelationship(_0x3564b2,_0x41cc1b,_0x5e01b1,_0x62cb('0x64'));})['then'](function(){return getServerInfo(_0x3564b2);})[_0x62cb('0x39')](function(_0x34181b){var _0x288613=parseInt(_0x34181b[_0x62cb('0x65')][_0x62cb('0x66')](0x0));var _0x55814b=util[_0x62cb('0x20')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x41ac2e['remoteUri'],_0x5e01b1['id']);if(_0x288613>0x6){_0x55814b=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x41ac2e['remoteUri'],_0x5e01b1['id']);}logger[_0x62cb('0xb')](_0x62cb('0x70'),_0x62cb('0x6a'));emit(util[_0x62cb('0x20')](_0x62cb('0x76'),_0x4693cf[_0x62cb('0xc')]),_0x62cb('0x6b'),{'uri':_0x55814b});})[_0x62cb('0x6c')](function(_0x45a4ca){logger[_0x62cb('0x6d')](_0x62cb('0x70'),JSON['stringify'](_0x45a4ca));});};exports[_0x62cb('0x77')]=function(_0x65f7a,_0x283753,_0x41240a,_0x374e45,_0x4ed3c1,_0x2e714d){var _0x14f375,_0x475da3,_0x3f6c5d,_0x41de58;_0x2e714d[_0x62cb('0x56')]=intUtil['stripTrailingSlash'](_0x2e714d['remoteUri']);_0x2e714d[_0x62cb('0x58')]=intUtil['stripTrailingSlash'](_0x2e714d[_0x62cb('0x58')]);def[_0x62cb('0x6e')]=util[_0x62cb('0x20')](_0x62cb('0x59'),_0x2e714d[_0x62cb('0x56')]);if(_0x4ed3c1&&_0x4ed3c1[_0x62cb('0x5a')]){logger['info']('['+_0x283753[_0x62cb('0x78')][_0x62cb('0x79')]()+']',_0x62cb('0x5b'));_0x283753[_0x62cb('0x5c')]=util[_0x62cb('0x20')](_0x62cb('0x71'),_0x2e714d[_0x62cb('0x58')],_0x283753[_0x62cb('0x5d')],md5(_0x283753['uniqueid']));}else{_0x283753[_0x62cb('0x5c')]='';}return getConnection(_0x2e714d)[_0x62cb('0x39')](function(_0x1f261e){_0x41de58=_0x1f261e;if(!_[_0x62cb('0x27')](_0x374e45)){return getUser(_0x2e714d,_0x374e45[_0x62cb('0xc')],_0x41de58);}else{return getUser(_0x2e714d,null,_0x41de58);}})[_0x62cb('0x39')](function(_0x361974){_0x14f375=_0x361974;logger[_0x62cb('0xb')](_0x62cb('0x5e'),_0x14f375['id']);return getEndUser(_0x2e714d,_0x283753['calleridname'],_0x283753[_0x62cb('0x60')],_0x41de58);})[_0x62cb('0x39')](function(_0x57adc4){_0x475da3=_0x57adc4;logger[_0x62cb('0xb')](_0x62cb('0x61'),_0x475da3['id']);return getTicket(_0x2e714d,_0x14f375,_0x475da3,_0x41240a,_0x283753,_0x41240a[_0x62cb('0x73')],_0x41de58,_0x62cb('0x7a'));})[_0x62cb('0x39')](function(_0xe0d967){_0x3f6c5d=_0xe0d967;logger[_0x62cb('0xb')]('Ticket\x20created!');logger[_0x62cb('0xb')](_0x62cb('0x75'),_0x3f6c5d['id']);return setRelationship(_0x41de58,_0x14f375,_0x3f6c5d,_0x62cb('0x63'));})[_0x62cb('0x39')](function(){return setRelationship(_0x41de58,_0x475da3,_0x3f6c5d,'contacts');})['then'](function(){return getServerInfo(_0x41de58);})[_0x62cb('0x6c')](function(_0xe07c73){logger[_0x62cb('0x6d')]('['+_0x283753[_0x62cb('0x78')][_0x62cb('0x79')]()+']',JSON[_0x62cb('0x26')](_0xe07c73));});}; \ No newline at end of file +var _0x2ebd=['phone_home','first_name','','Caller\x20-\x20%s','Enduser\x20created.','merge','map','type','nameField','customField','string','custom_fields','content','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','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','catch','error','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','users','version','user:%s','lastevent','toUpperCase','isNil','Inbound','lodash','request-promise','bluebird','util','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','getString','Descriptions','toISOString','slice','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','Calls','Basic\x20%s','apiKey','toString','get_server_info','stringify','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','value','name_value_list','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','then','Enduser\x20found!'];(function(_0x61a7b2,_0x1ebc7f){var _0xfe0901=function(_0x1e2ea7){while(--_0x1e2ea7){_0x61a7b2['push'](_0x61a7b2['shift']());}};_0xfe0901(++_0x1ebc7f);}(_0x2ebd,0x125));var _0xd2eb=function(_0x33711e,_0x57999f){_0x33711e=_0x33711e-0x0;var _0x5816e3=_0x2ebd[_0x33711e];return _0x5816e3;};'use strict';var _=require(_0xd2eb('0x0'));var rp=require(_0xd2eb('0x1'));var BPromise=require(_0xd2eb('0x2'));var md5=require('md5');var util=require(_0xd2eb('0x3'));var Redis=require('ioredis');var intUtil=require(_0xd2eb('0x4'));var config=require(_0xd2eb('0x5'));var logger=require('../../../../config/logger')(_0xd2eb('0x6'));config[_0xd2eb('0x7')]=_[_0xd2eb('0x8')](config[_0xd2eb('0x7')],{'host':_0xd2eb('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd2eb('0x7')]));var def={'method':_0xd2eb('0xa'),'json':!![]};function emit(_0x56426a,_0x49d395,_0x1ed670){io['to'](_0x56426a)[_0xd2eb('0xb')](_0x49d395,_0x1ed670);}function getTicket(_0x177217,_0x3dc289,_0x40ee60,_0x139dcf,_0x188f6d,_0x300fea,_0x452d2d,_0x20ab9){logger[_0xd2eb('0xc')](_0xd2eb('0xd'));var _0x363772=new Date();var _0x192a22=[{'name':_0xd2eb('0xe'),'value':intUtil['getString'](_0x139dcf[_0xd2eb('0xf')],_0x188f6d,'\x20')},{'name':_0xd2eb('0x10'),'value':_0x3dc289['id']},{'name':_0xd2eb('0x11'),'value':_0x3dc289['id']},{'name':_0xd2eb('0x12'),'value':intUtil[_0xd2eb('0x13')](_0x139dcf[_0xd2eb('0x14')],_0x188f6d,'\x0a')},{'name':'date_start','value':_0x363772[_0xd2eb('0x15')]()[_0xd2eb('0x16')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xd2eb('0x17'),'value':_0x40ee60['id']},{'name':_0xd2eb('0x18'),'value':_0xd2eb('0x19')},{'name':_0xd2eb('0x1a'),'value':_0x40ee60[_0xd2eb('0xe')]},{'name':_0xd2eb('0x1b'),'value':_0x20ab9}];if(_0x300fea[_0xd2eb('0x1c')]){_[_0xd2eb('0x1d')](_0x300fea,function(_0x55a5d6){if(_0x188f6d[_0x55a5d6[_0xd2eb('0x1e')]]){_0x192a22[_0xd2eb('0x1f')]({'name':_0x55a5d6[_0xd2eb('0x20')],'value':_0x188f6d[_0x55a5d6['variableName']]});}});}return request({'form':{'method':_0xd2eb('0x21'),'input_type':_0xd2eb('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x452d2d['id'],'module_name':_0xd2eb('0x23'),'name_value_list':_0x192a22})}});}function getAuth(_0x1f8bcf){return util['format'](_0xd2eb('0x24'),new Buffer(_0x1f8bcf[_0xd2eb('0x25')]+':X')[_0xd2eb('0x26')]('base64'));}function getServerInfo(_0x4bcafd){return request({'form':{'method':_0xd2eb('0x27'),'input_type':'JSON','response_type':_0xd2eb('0x22'),'rest_data':JSON[_0xd2eb('0x28')]({'session':_0x4bcafd['id']})}});}function getUser(_0x2b1616,_0x2a4010,_0x19ee51){if(!_['isNil'](_0x2a4010)){logger['info'](_0xd2eb('0x29'),_0x2a4010);return request({'form':{'method':_0xd2eb('0x2a'),'input_type':_0xd2eb('0x22'),'response_type':'JSON','rest_data':JSON[_0xd2eb('0x28')]({'session':_0x19ee51['id'],'module_name':_0xd2eb('0x2b'),'query':util[_0xd2eb('0x2c')](_0xd2eb('0x2d'),_0x2a4010),'order_by':'','offset':'0','select_fields':['id',_0xd2eb('0xe'),_0xd2eb('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x95dce6){if(_0x95dce6[_0xd2eb('0x2f')][_0xd2eb('0x1c')]){var _0x5a2d9a=_[_0xd2eb('0x30')](_0x95dce6['entry_list'],function(_0x4df043){return _0x4df043['name_value_list'][_0xd2eb('0x2e')][_0xd2eb('0x31')]===_0x2a4010;});if(_0x5a2d9a){logger['info']('Agent\x20found!');return BPromise['resolve']({'id':_0x5a2d9a[_0xd2eb('0x32')]['id'][_0xd2eb('0x31')],'name':_0x5a2d9a['name_value_list'][_0xd2eb('0xe')][_0xd2eb('0x31')]});}}logger[_0xd2eb('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xd2eb('0x33')]({'id':_0x19ee51[_0xd2eb('0x32')][_0xd2eb('0x34')][_0xd2eb('0x31')],'name':_0x19ee51[_0xd2eb('0x32')][_0xd2eb('0x2e')][_0xd2eb('0x31')]});});}else{logger[_0xd2eb('0xc')](_0xd2eb('0x35'));return BPromise[_0xd2eb('0x33')]({'id':_0x19ee51['name_value_list'][_0xd2eb('0x34')][_0xd2eb('0x31')],'name':_0x19ee51['name_value_list'][_0xd2eb('0x2e')]['value']});}}function getEndUser(_0x59d742,_0x55b396,_0x1219ac,_0x52f9f7){logger[_0xd2eb('0xc')](_0xd2eb('0x36'),_0x1219ac);return request({'form':{'method':'get_entry_list','input_type':_0xd2eb('0x22'),'response_type':_0xd2eb('0x22'),'rest_data':JSON[_0xd2eb('0x28')]({'session':_0x52f9f7['id'],'module_name':'Contacts','query':util[_0xd2eb('0x2c')](_0xd2eb('0x37'),_0x1219ac),'order_by':'','offset':'0','select_fields':['id',_0xd2eb('0xe'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd2eb('0x38')](function(_0x5f1e39){if(_0x5f1e39['entry_list']['length']){var _0x374c4c=_[_0xd2eb('0x30')](_0x5f1e39[_0xd2eb('0x2f')],function(_0x150a08){return _0x150a08[_0xd2eb('0x32')]['phone_home'][_0xd2eb('0x31')]===_0x1219ac;});if(_0x374c4c){logger[_0xd2eb('0xc')](_0xd2eb('0x39'));return BPromise['resolve']({'id':_0x374c4c['name_value_list']['id'][_0xd2eb('0x31')],'name':_0x374c4c[_0xd2eb('0x32')][_0xd2eb('0xe')][_0xd2eb('0x31')],'phone':_0x374c4c[_0xd2eb('0x32')][_0xd2eb('0x3a')][_0xd2eb('0x31')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xd2eb('0x21'),'input_type':_0xd2eb('0x22'),'response_type':_0xd2eb('0x22'),'rest_data':JSON[_0xd2eb('0x28')]({'session':_0x52f9f7['id'],'module_name':'Contacts','name_value_list':[{'name':_0xd2eb('0x3b'),'value':_0x55b396!==_0xd2eb('0x3c')?_0x55b396:util[_0xd2eb('0x2c')](_0xd2eb('0x3d'),_0x1219ac)},{'name':_0xd2eb('0x3a'),'value':_0x1219ac}]})}})['then'](function(_0x413a5d){logger[_0xd2eb('0xc')](_0xd2eb('0x3e'));return BPromise[_0xd2eb('0x33')]({'id':_0x413a5d['id'],'name':_0x413a5d[_0xd2eb('0x2f')][_0xd2eb('0x3b')][_0xd2eb('0x31')],'phone':_0x413a5d[_0xd2eb('0x2f')][_0xd2eb('0x3a')]['value']});});}});}function request(_0x1dd924){logger['debug']('[HTTP]',JSON[_0xd2eb('0x28')](_0x1dd924));return rp(_[_0xd2eb('0x3f')](def,_0x1dd924));}function getTags(_0x250e3e,_0x3b7ff2){var _0x520113=[];if(_0x250e3e&&_0x250e3e[_0xd2eb('0x1c')]>0x0){_0x520113=_[_0xd2eb('0x40')](_0x250e3e,_0x3b7ff2);}return _0x520113;}function getCustomFields(_0x243c9d,_0x40452b){var _0x4a1de1=[];var _0x4730fd={'custom_fields':[]};if(_0x243c9d[_0xd2eb('0x1c')]>0x0){_[_0xd2eb('0x1d')](_0x243c9d,function(_0x337932){if(_0x337932[_0xd2eb('0x41')]==='string'&&_0x337932[_0xd2eb('0x42')]&&!_0x337932[_0xd2eb('0x43')]){_0x4730fd[_0x337932[_0xd2eb('0x42')]['toLowerCase']()]=_0x337932['content'][_0xd2eb('0x26')]();}else if(_0x337932[_0xd2eb('0x41')]===_0xd2eb('0x44')&&_0x337932[_0xd2eb('0x20')]&&_0x337932[_0xd2eb('0x43')]){_0x4730fd[_0xd2eb('0x45')][_0xd2eb('0x1f')]({'id':_0x337932[_0xd2eb('0x20')],'value':_0x337932[_0xd2eb('0x46')]['toString']()});}else if(_0x337932[_0xd2eb('0x41')]==='variable'&&_0x337932['variableName']&&_0x337932['idField']&&_0x337932[_0xd2eb('0x43')]){_0x40452b[_0x337932[_0xd2eb('0x1e')]]&&_0x4730fd[_0xd2eb('0x45')]['push']({'id':_0x337932[_0xd2eb('0x20')],'value':_0x40452b[_0x337932[_0xd2eb('0x1e')]][_0xd2eb('0x26')]()});}else if(_0x337932[_0xd2eb('0x41')]==='customVariable'&&_0x337932[_0xd2eb('0x47')]&&_0x337932[_0xd2eb('0x47')]['name']&&_0x337932[_0xd2eb('0x20')]&&_0x337932[_0xd2eb('0x43')]){_0x40452b[_0x337932[_0xd2eb('0x47')][_0xd2eb('0xe')][_0xd2eb('0x48')]()]&&_0x4730fd[_0xd2eb('0x45')]['push']({'id':_0x337932['idField'],'value':_0x40452b[_0x337932[_0xd2eb('0x47')]['name'][_0xd2eb('0x48')]()][_0xd2eb('0x26')]()});}});}return _0x4730fd;}function getConnection(_0x2befd){return request({'method':_0xd2eb('0xa'),'form':{'method':_0xd2eb('0x49'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xd2eb('0x28')]({'user_auth':{'user_name':_0x2befd[_0xd2eb('0x4a')],'password':_0x2befd[_0xd2eb('0x4b')],'encryption':_0xd2eb('0x4c')},'application':_0xd2eb('0x4d')})}})['then'](function(_0x5878e7){var _0x4b4545=_0x5878e7;if(_0x4b4545['id']){def[_0xd2eb('0x4e')]=_0x4b4545['id'];return BPromise[_0xd2eb('0x33')](_0x4b4545);}else{throw new Error(util['format'](_0xd2eb('0x4f'),_0x2befd['id']));}});}function setRelationship(_0x17f9f7,_0x296388,_0x3dc911,_0x347339){return request({'form':{'method':_0xd2eb('0x50'),'input_type':_0xd2eb('0x22'),'response_type':_0xd2eb('0x22'),'rest_data':JSON[_0xd2eb('0x28')]({'session':_0x17f9f7['id'],'module_name':_0xd2eb('0x23'),'module_id':_0x3dc911['id'],'link_field_name':_0x347339,'related_ids':[_0x296388['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xd2eb('0x51')]=function(_0x1fef78,_0x4a354f,_0x563799,_0x3fea80,_0x473edd,_0x35c044){var _0x516486,_0x28e20f,_0x2ee5f3,_0x2b6a04;_0x35c044[_0xd2eb('0x52')]=intUtil['stripTrailingSlash'](_0x35c044[_0xd2eb('0x52')]);_0x35c044[_0xd2eb('0x53')]=intUtil[_0xd2eb('0x54')](_0x35c044[_0xd2eb('0x53')]);def['uri']=util[_0xd2eb('0x2c')](_0xd2eb('0x55'),_0x35c044[_0xd2eb('0x52')]);if(_0x473edd&&_0x473edd[_0xd2eb('0x56')]){logger[_0xd2eb('0xc')](_0xd2eb('0x57'),_0xd2eb('0x58'));_0x4a354f['recordingURL']=util[_0xd2eb('0x2c')](_0xd2eb('0x59'),_0x35c044['serverUrl'],_0x4a354f[_0xd2eb('0x5a')],md5(_0x4a354f['uniqueid']));}else{_0x4a354f[_0xd2eb('0x5b')]='';}return getConnection(_0x35c044)['then'](function(_0x2c6749){_0x2b6a04=_0x2c6749;return getUser(_0x35c044,_0x3fea80[_0xd2eb('0xe')],_0x2b6a04);})[_0xd2eb('0x38')](function(_0xabda46){_0x516486=_0xabda46;logger[_0xd2eb('0xc')](_0xd2eb('0x5c'),_0x516486['id']);return getEndUser(_0x35c044,_0x4a354f[_0xd2eb('0x5d')],_0x4a354f[_0xd2eb('0x5e')],_0x2b6a04);})['then'](function(_0x2bffd1){_0x28e20f=_0x2bffd1;logger['info'](_0xd2eb('0x5f'),_0x28e20f['id']);return getTicket(_0x35c044,_0x516486,_0x28e20f,_0x563799,_0x4a354f,_0x563799[_0xd2eb('0x60')],_0x2b6a04,'Inbound');})[_0xd2eb('0x38')](function(_0x3e3f1b){_0x2ee5f3=_0x3e3f1b;logger[_0xd2eb('0xc')](_0xd2eb('0x61'));logger[_0xd2eb('0xc')](_0xd2eb('0x62'),_0x2ee5f3['id']);return setRelationship(_0x2b6a04,_0x516486,_0x2ee5f3,'users');})[_0xd2eb('0x38')](function(){return setRelationship(_0x2b6a04,_0x28e20f,_0x2ee5f3,_0xd2eb('0x63'));})[_0xd2eb('0x38')](function(){return getServerInfo(_0x2b6a04);})['then'](function(_0x490a8d){var _0x54f0d4=parseInt(_0x490a8d['version'][_0xd2eb('0x64')](0x0));var _0x8fa558=util[_0xd2eb('0x2c')](_0xd2eb('0x65'),_0x35c044[_0xd2eb('0x52')],_0x2ee5f3['id']);if(_0x54f0d4>0x6){_0x8fa558=util[_0xd2eb('0x2c')](_0xd2eb('0x66'),_0x35c044['remoteUri'],_0x2ee5f3['id']);}logger[_0xd2eb('0xc')](_0xd2eb('0x57'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd2eb('0x2c')]('user:%s',_0x3fea80[_0xd2eb('0xe')]),'trigger:browser:url',{'uri':_0x8fa558});})[_0xd2eb('0x67')](function(_0x2845f4){logger[_0xd2eb('0x68')](_0xd2eb('0x57'),JSON[_0xd2eb('0x28')](_0x2845f4));});};exports['outbound']=function(_0x9912ea,_0x2ff929,_0x3da542,_0x2713c5,_0x5a30ad,_0x402c15,_0x372809){var _0x24d270,_0x5abfe2,_0x4f494d,_0x2de6cf;_0x402c15[_0xd2eb('0x52')]=intUtil[_0xd2eb('0x54')](_0x402c15[_0xd2eb('0x52')]);_0x402c15[_0xd2eb('0x53')]=intUtil[_0xd2eb('0x54')](_0x402c15['serverUrl']);def['uri']=util[_0xd2eb('0x2c')]('%s/service/v4_1/rest.php',_0x402c15[_0xd2eb('0x52')]);if(_0x372809&&_0x372809[_0xd2eb('0x69')]&&_0x372809[_0xd2eb('0x69')]!=='none'){logger[_0xd2eb('0xc')](_0xd2eb('0x6a'),_0xd2eb('0x58'));_0x2ff929[_0xd2eb('0x5b')]=util['format'](_0xd2eb('0x59'),_0x402c15[_0xd2eb('0x53')],_0x2ff929[_0xd2eb('0x5a')],md5(_0x2ff929[_0xd2eb('0x5a')]));}return getConnection(_0x402c15)[_0xd2eb('0x38')](function(_0x36b4f7){_0x2de6cf=_0x36b4f7;return getUser(_0x402c15,_0x2713c5['name'],_0x2de6cf);})[_0xd2eb('0x38')](function(_0xd74c6f){_0x24d270=_0xd74c6f;logger[_0xd2eb('0xc')](_0xd2eb('0x5c'),_0x24d270['id']);return getEndUser(_0x402c15,_0x2ff929[_0xd2eb('0x6b')],_0x2ff929[_0xd2eb('0x6c')],_0x2de6cf);})[_0xd2eb('0x38')](function(_0xdd46f2){_0x5abfe2=_0xdd46f2;logger[_0xd2eb('0xc')](_0xd2eb('0x5f'),_0x5abfe2['id']);return getTicket(_0x402c15,_0x24d270,_0x5abfe2,_0x3da542,_0x2ff929,_0x3da542[_0xd2eb('0x60')],_0x2de6cf,_0xd2eb('0x6d'));})[_0xd2eb('0x38')](function(_0x29496f){_0x4f494d=_0x29496f;logger[_0xd2eb('0xc')](_0xd2eb('0x61'));logger[_0xd2eb('0xc')]('The\x20Ticket\x20ID\x20is:',_0x4f494d['id']);return setRelationship(_0x2de6cf,_0x24d270,_0x4f494d,_0xd2eb('0x6e'));})[_0xd2eb('0x38')](function(){return setRelationship(_0x2de6cf,_0x5abfe2,_0x4f494d,_0xd2eb('0x63'));})[_0xd2eb('0x38')](function(){return getServerInfo(_0x2de6cf);})[_0xd2eb('0x38')](function(_0x22b16f){var _0x30db6e=parseInt(_0x22b16f[_0xd2eb('0x6f')][_0xd2eb('0x64')](0x0));var _0x299d3a=util[_0xd2eb('0x2c')](_0xd2eb('0x65'),_0x402c15['remoteUri'],_0x4f494d['id']);if(_0x30db6e>0x6){_0x299d3a=util[_0xd2eb('0x2c')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x402c15['remoteUri'],_0x4f494d['id']);}logger[_0xd2eb('0xc')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd2eb('0x2c')](_0xd2eb('0x70'),_0x2713c5[_0xd2eb('0xe')]),'trigger:browser:url',{'uri':_0x299d3a});})[_0xd2eb('0x67')](function(_0x25077b){logger[_0xd2eb('0x68')](_0xd2eb('0x6a'),JSON[_0xd2eb('0x28')](_0x25077b));});};exports['unmanaged']=function(_0x5a2d63,_0x5bf5be,_0x3f8c88,_0x29e99d,_0x24bb58,_0x56962c){var _0x3022c7,_0x4fd058,_0x1ff1f1,_0x1054b2;_0x56962c['remoteUri']=intUtil[_0xd2eb('0x54')](_0x56962c[_0xd2eb('0x52')]);_0x56962c[_0xd2eb('0x53')]=intUtil[_0xd2eb('0x54')](_0x56962c['serverUrl']);def['uri']=util[_0xd2eb('0x2c')](_0xd2eb('0x55'),_0x56962c[_0xd2eb('0x52')]);if(_0x24bb58&&_0x24bb58[_0xd2eb('0x56')]){logger[_0xd2eb('0xc')]('['+_0x5bf5be[_0xd2eb('0x71')][_0xd2eb('0x72')]()+']',_0xd2eb('0x58'));_0x5bf5be[_0xd2eb('0x5b')]=util[_0xd2eb('0x2c')](_0xd2eb('0x59'),_0x56962c[_0xd2eb('0x53')],_0x5bf5be[_0xd2eb('0x5a')],md5(_0x5bf5be['uniqueid']));}else{_0x5bf5be[_0xd2eb('0x5b')]='';}return getConnection(_0x56962c)[_0xd2eb('0x38')](function(_0x5ae965){_0x1054b2=_0x5ae965;if(!_[_0xd2eb('0x73')](_0x29e99d)){return getUser(_0x56962c,_0x29e99d['name'],_0x1054b2);}else{return getUser(_0x56962c,null,_0x1054b2);}})[_0xd2eb('0x38')](function(_0x4d040e){_0x3022c7=_0x4d040e;logger[_0xd2eb('0xc')](_0xd2eb('0x5c'),_0x3022c7['id']);return getEndUser(_0x56962c,_0x5bf5be[_0xd2eb('0x5d')],_0x5bf5be[_0xd2eb('0x5e')],_0x1054b2);})[_0xd2eb('0x38')](function(_0x530daa){_0x4fd058=_0x530daa;logger[_0xd2eb('0xc')]('The\x20Enduser\x20ID\x20is:',_0x4fd058['id']);return getTicket(_0x56962c,_0x3022c7,_0x4fd058,_0x3f8c88,_0x5bf5be,_0x3f8c88[_0xd2eb('0x60')],_0x1054b2,_0xd2eb('0x74'));})[_0xd2eb('0x38')](function(_0x35037){_0x1ff1f1=_0x35037;logger[_0xd2eb('0xc')](_0xd2eb('0x61'));logger[_0xd2eb('0xc')](_0xd2eb('0x62'),_0x1ff1f1['id']);return setRelationship(_0x1054b2,_0x3022c7,_0x1ff1f1,_0xd2eb('0x6e'));})[_0xd2eb('0x38')](function(){return setRelationship(_0x1054b2,_0x4fd058,_0x1ff1f1,_0xd2eb('0x63'));})[_0xd2eb('0x38')](function(){return getServerInfo(_0x1054b2);})[_0xd2eb('0x67')](function(_0x418e05){logger[_0xd2eb('0x68')]('['+_0x5bf5be['lastevent'][_0xd2eb('0x72')]()+']',JSON['stringify'](_0x418e05));});}; \ 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 8add271..d201f73 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 _0x0090=['push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','format','%s:\x20%s','key','keyContent','keyType','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','lodash','util','getString','length','sortBy','string'];(function(_0x2dd5f2,_0x40a6c7){var _0x290afc=function(_0x4c5b26){while(--_0x4c5b26){_0x2dd5f2['push'](_0x2dd5f2['shift']());}};_0x290afc(++_0x40a6c7);}(_0x0090,0x66));var _0x0009=function(_0x34be4b,_0x4da868){_0x34be4b=_0x34be4b-0x0;var _0x13918a=_0x0090[_0x34be4b];return _0x13918a;};'use strict';var _=require(_0x0009('0x0'));var util=require(_0x0009('0x1'));exports[_0x0009('0x2')]=function(_0x30e2ec,_0x49fde6,_0x4b6d90){var _0x13cc6f=[];if(_0x30e2ec[_0x0009('0x3')]>0x0){var _0x404e04=_[_0x0009('0x4')](_0x30e2ec,['id']);for(var _0x4ffc5a=0x0;_0x4ffc5a<_0x404e04[_0x0009('0x3')];_0x4ffc5a++){var _0x5c6edd=_0x404e04[_0x4ffc5a];if(_0x5c6edd['type']===_0x0009('0x5')){_0x13cc6f[_0x0009('0x6')](_0x5c6edd[_0x0009('0x7')]);}else if(_0x5c6edd[_0x0009('0x8')]===_0x0009('0x9')&&_0x5c6edd[_0x0009('0xa')]){_0x49fde6[_0x5c6edd[_0x0009('0xa')]]&&_0x13cc6f[_0x0009('0x6')](_0x49fde6[_0x5c6edd[_0x0009('0xa')]][_0x0009('0xb')]());}else if(_0x5c6edd[_0x0009('0x8')]===_0x0009('0xc')&&_0x5c6edd[_0x0009('0xd')]&&_0x5c6edd[_0x0009('0xd')][_0x0009('0xe')]){_0x49fde6[_0x5c6edd[_0x0009('0xd')][_0x0009('0xe')][_0x0009('0xf')]()]&&_0x13cc6f['push'](_0x49fde6[_0x5c6edd[_0x0009('0xd')]['name'][_0x0009('0xf')]()]['toString']());}else if(_0x5c6edd[_0x0009('0x8')]==='keyValue'){if(_0x5c6edd['keyType']===_0x0009('0x5')&&_0x5c6edd['key']){_0x13cc6f[_0x0009('0x6')](util[_0x0009('0x10')](_0x0009('0x11'),_0x5c6edd[_0x0009('0x12')],_0x5c6edd[_0x0009('0x13')]));}else if(_0x5c6edd[_0x0009('0x14')]===_0x0009('0x9')&&_0x5c6edd['variableName']&&_0x5c6edd['key']){_0x49fde6[_0x5c6edd[_0x0009('0xa')]]&&_0x13cc6f[_0x0009('0x6')](util[_0x0009('0x10')](_0x0009('0x11'),_0x5c6edd[_0x0009('0x12')],_0x49fde6[_0x5c6edd[_0x0009('0xa')]]));}else if(_0x5c6edd[_0x0009('0x14')]==='customVariable'&&_0x5c6edd[_0x0009('0xd')]&&_0x5c6edd[_0x0009('0xd')][_0x0009('0xe')]&&_0x5c6edd[_0x0009('0x12')]){_0x49fde6[_0x5c6edd[_0x0009('0xd')][_0x0009('0xe')][_0x0009('0xf')]()]&&_0x13cc6f[_0x0009('0x6')](util[_0x0009('0x10')](_0x0009('0x11'),_0x5c6edd['key'],_0x49fde6[_0x5c6edd[_0x0009('0xd')][_0x0009('0xe')]['toLowerCase']()]));}}}}return _0x13cc6f[_0x0009('0x15')](_0x4b6d90);};exports[_0x0009('0x16')]=function(_0x51bb4e){var _0x6b5dcf=_0x51bb4e['slice'](-0x1);if(_0x6b5dcf==='/'){_0x51bb4e=_0x51bb4e[_0x0009('0x17')](0x0,_0x51bb4e[_0x0009('0x18')](_0x6b5dcf));}return _0x51bb4e;};exports[_0x0009('0x19')]=function(_0x1f099a){if(!_[_0x0009('0x1a')](_0x1f099a)&&_0x1f099a!==''){var _0x430f89=/^(([^<>()\[\]\\.,;:\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 _0x430f89['test'](String(_0x1f099a)[_0x0009('0xf')]());}else{return![];}}; \ No newline at end of file +var _0x8a63=['toString','Variable','name','toLowerCase','keyType','key','%s:\x20%s','keyContent','format','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','isNil','lodash','util','getString','length','sortBy','type','string','push','content','variable','variableName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a63,0xb2));var _0x38a6=function(_0x11273e,_0x3821a6){_0x11273e=_0x11273e-0x0;var _0x1e8616=_0x8a63[_0x11273e];return _0x1e8616;};'use strict';var _=require(_0x38a6('0x0'));var util=require(_0x38a6('0x1'));exports[_0x38a6('0x2')]=function(_0x3002ec,_0x32e83f,_0x1dec67){var _0x18d540=[];if(_0x3002ec[_0x38a6('0x3')]>0x0){var _0x570b29=_[_0x38a6('0x4')](_0x3002ec,['id']);for(var _0xb92b9f=0x0;_0xb92b9f<_0x570b29[_0x38a6('0x3')];_0xb92b9f++){var _0x1cd036=_0x570b29[_0xb92b9f];if(_0x1cd036[_0x38a6('0x5')]===_0x38a6('0x6')){_0x18d540[_0x38a6('0x7')](_0x1cd036[_0x38a6('0x8')]);}else if(_0x1cd036[_0x38a6('0x5')]===_0x38a6('0x9')&&_0x1cd036[_0x38a6('0xa')]){_0x32e83f[_0x1cd036['variableName']]&&_0x18d540['push'](_0x32e83f[_0x1cd036[_0x38a6('0xa')]][_0x38a6('0xb')]());}else if(_0x1cd036['type']==='customVariable'&&_0x1cd036[_0x38a6('0xc')]&&_0x1cd036[_0x38a6('0xc')][_0x38a6('0xd')]){_0x32e83f[_0x1cd036[_0x38a6('0xc')][_0x38a6('0xd')][_0x38a6('0xe')]()]&&_0x18d540[_0x38a6('0x7')](_0x32e83f[_0x1cd036['Variable']['name']['toLowerCase']()]['toString']());}else if(_0x1cd036[_0x38a6('0x5')]==='keyValue'){if(_0x1cd036[_0x38a6('0xf')]===_0x38a6('0x6')&&_0x1cd036[_0x38a6('0x10')]){_0x18d540[_0x38a6('0x7')](util['format'](_0x38a6('0x11'),_0x1cd036['key'],_0x1cd036[_0x38a6('0x12')]));}else if(_0x1cd036[_0x38a6('0xf')]===_0x38a6('0x9')&&_0x1cd036[_0x38a6('0xa')]&&_0x1cd036[_0x38a6('0x10')]){_0x32e83f[_0x1cd036[_0x38a6('0xa')]]&&_0x18d540[_0x38a6('0x7')](util[_0x38a6('0x13')]('%s:\x20%s',_0x1cd036[_0x38a6('0x10')],_0x32e83f[_0x1cd036[_0x38a6('0xa')]]));}else if(_0x1cd036[_0x38a6('0xf')]===_0x38a6('0x14')&&_0x1cd036[_0x38a6('0xc')]&&_0x1cd036[_0x38a6('0xc')]['name']&&_0x1cd036[_0x38a6('0x10')]){_0x32e83f[_0x1cd036['Variable'][_0x38a6('0xd')][_0x38a6('0xe')]()]&&_0x18d540[_0x38a6('0x7')](util[_0x38a6('0x13')](_0x38a6('0x11'),_0x1cd036[_0x38a6('0x10')],_0x32e83f[_0x1cd036[_0x38a6('0xc')][_0x38a6('0xd')][_0x38a6('0xe')]()]));}}}}return _0x18d540[_0x38a6('0x15')](_0x1dec67);};exports[_0x38a6('0x16')]=function(_0xba1119){var _0x23ae7d=_0xba1119[_0x38a6('0x17')](-0x1);if(_0x23ae7d==='/'){_0xba1119=_0xba1119[_0x38a6('0x18')](0x0,_0xba1119[_0x38a6('0x19')](_0x23ae7d));}return _0xba1119;};exports['validateEmail']=function(_0x47db71){if(!_[_0x38a6('0x1a')](_0x47db71)&&_0x47db71!==''){var _0x5e5d56=/^(([^<>()\[\]\\.,;:\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 _0x5e5d56['test'](String(_0x47db71)[_0x38a6('0xe')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 544d1e1..e507843 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 _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x53e96d,_0x2ca82f){var _0x367a1d=function(_0x27d9a7){while(--_0x27d9a7){_0x53e96d['push'](_0x53e96d['shift']());}};_0x367a1d(++_0x2ca82f);}(_0x34e8,0x12c));var _0x834e=function(_0xb0d12,_0x2cd648){_0xb0d12=_0xb0d12-0x0;var _0x543262=_0x34e8[_0xb0d12];return _0x543262;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0xcf51a6,_0x9a5137){var _0x472bdd=function(_0x21986f){while(--_0x21986f){_0xcf51a6['push'](_0xcf51a6['shift']());}};_0x472bdd(++_0x9a5137);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index de4a6a2..6aff072 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 _0x032a=['type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','GET','map','includes','string','picklist','customField','nameField','content','type','custom_fields','push','idField','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','/api/v2','lastevent','toUpperCase','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','lodash','request-promise','util','ioredis','./util','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','application/json','info','format','%s/tickets.json','POST','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone'];(function(_0x15f50a,_0x560602){var _0x297011=function(_0x35bb6d){while(--_0x35bb6d){_0x15f50a['push'](_0x15f50a['shift']());}};_0x297011(++_0x560602);}(_0x032a,0x11d));var _0xa032=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0x032a[_0x41d432];return _0x1650f9;};'use strict';var _=require(_0xa032('0x0'));var rp=require(_0xa032('0x1'));var md5=require('md5');var util=require(_0xa032('0x2'));var Redis=require(_0xa032('0x3'));var intUtil=require(_0xa032('0x4'));var config=require('../../../../config/environment');var logger=require(_0xa032('0x5'))(_0xa032('0x6'));config[_0xa032('0x7')]=_[_0xa032('0x8')](config[_0xa032('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xa032('0x9'))(new Redis(config[_0xa032('0x7')]));function emit(_0x44787f,_0xe2293b,_0x5c8c37){io['to'](_0x44787f)['emit'](_0xe2293b,_0x5c8c37);}var headers={'Content-Type':_0xa032('0xa'),'Accept':'application/json'};function getTicket(_0x2761ac,_0x59769a,_0x41fafa,_0xa51a80,_0x54c043){logger[_0xa032('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xa032('0xc')](_0xa032('0xd'),_0x2761ac['remoteUri']),'method':_0xa032('0xe'),'body':{'ticket':_['merge']({'requester_id':_0x41fafa['id'],'submitter_id':_0x59769a?_0x59769a['id']:undefined,'assignee_id':_0x59769a?_0x59769a['id']:undefined,'tags':getTags(_0xa51a80[_0xa032('0xf')],_0xa032('0x10')),'subject':intUtil[_0xa032('0x11')](_0xa51a80['Subjects'],_0x54c043,'\x20'),'description':intUtil[_0xa032('0x11')](_0xa51a80[_0xa032('0x12')],_0x54c043,'\x0a'),'comment':{'public':![],'body':intUtil[_0xa032('0x11')](_0xa51a80[_0xa032('0x12')],_0x54c043,'\x0a')}},getCustomFields(_0xa51a80[_0xa032('0x13')],_0x54c043))}})[_0xa032('0x14')](function(_0x43a878){logger[_0xa032('0xb')](_0xa032('0x15'));return _0x43a878[_0xa032('0x16')];});}function getUser(_0x53c371,_0x2305ab){if(intUtil[_0xa032('0x17')](_0x2305ab)){logger[_0xa032('0xb')]('Getting\x20agent\x20with\x20email',_0x2305ab);return request({'uri':util[_0xa032('0xc')](_0xa032('0x18'),_0x53c371[_0xa032('0x19')]),'qs':{'query':util[_0xa032('0xc')](_0xa032('0x1a'),_0x2305ab)}})[_0xa032('0x14')](function(_0x2cf77a){if(_0x2cf77a[_0xa032('0x1b')]){logger[_0xa032('0xb')](_0xa032('0x1c'));return _['find'](_0x2cf77a[_0xa032('0x1d')],{'email':_0x2305ab,'role':_0xa032('0x1e')});}else{logger[_0xa032('0xb')](_0xa032('0x1f'));return request({'uri':util['format'](_0xa032('0x20'),_0x53c371['remoteUri'])})[_0xa032('0x14')](function(_0x2faac0){logger[_0xa032('0xb')](_0xa032('0x21'));return _0x2faac0[_0xa032('0x22')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa032('0xc')](_0xa032('0x20'),_0x53c371[_0xa032('0x19')])})[_0xa032('0x14')](function(_0x409ede){logger[_0xa032('0xb')](_0xa032('0x21'));return _0x409ede[_0xa032('0x22')];});}}function getEndUser(_0x264d02,_0x403f18,_0x2ed9c1){logger['info'](_0xa032('0x23'),_0x2ed9c1);return request({'uri':util[_0xa032('0xc')](_0xa032('0x18'),_0x264d02[_0xa032('0x19')]),'qs':{'query':util[_0xa032('0xc')](_0xa032('0x24'),_0x2ed9c1)}})['then'](function(_0x497a8f){var _0x150aeb;if(_0x497a8f[_0xa032('0x1d')][_0xa032('0x25')]){_0x497a8f[_0xa032('0x1d')]=_['filter'](_0x497a8f['results'],{'suspended':![],'role':_0xa032('0x26')});if(_0x497a8f[_0xa032('0x1d')][_0xa032('0x25')]){_0x150aeb=_[_0xa032('0x27')](_0x497a8f[_0xa032('0x1d')]);}}if(_0x150aeb){logger[_0xa032('0xb')]('Enduser\x20found!');return _0x150aeb;}else{logger['info'](_0xa032('0x28'));return request({'uri':util[_0xa032('0xc')](_0xa032('0x29'),_0x264d02[_0xa032('0x19')]),'method':'POST','body':{'user':{'role':_0xa032('0x26'),'name':util[_0xa032('0xc')](_0xa032('0x2a'),_0x403f18||_0x2ed9c1),'phone':_0x2ed9c1}}})['then'](function(_0x3b94ec){logger[_0xa032('0xb')](_0xa032('0x2b'));return _0x3b94ec[_0xa032('0x22')];});}});}function getAuth(_0x494e3b){var _0x34b3c3;if(_0x494e3b[_0xa032('0x2c')]===_0xa032('0x2d')){_0x34b3c3=util[_0xa032('0xc')](_0xa032('0x2e'),_0x494e3b[_0xa032('0x2f')],_0x494e3b[_0xa032('0x2d')]);}else if(_0x494e3b[_0xa032('0x2c')]===_0xa032('0x30')){_0x34b3c3=util[_0xa032('0xc')](_0xa032('0x31'),_0x494e3b[_0xa032('0x2f')],_0x494e3b[_0xa032('0x30')]);}return util[_0xa032('0xc')](_0xa032('0x32'),new Buffer(_0x34b3c3)[_0xa032('0x33')](_0xa032('0x34')));}function request(_0x58db65){logger['debug'](_0xa032('0x35'),JSON['stringify'](_0x58db65));return rp(_[_0xa032('0x8')](_0x58db65,{'method':_0xa032('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x4ac310,_0xd92727){var _0x176bfa=[];if(_0x4ac310&&_0x4ac310[_0xa032('0x25')]>0x0){_0x176bfa=_[_0xa032('0x37')](_0x4ac310,_0xd92727);}return _0x176bfa;}function getCustomFields(_0x5549e7,_0x406de4){var _0x4ce229=[];var _0x42c53b={'custom_fields':[]};if(_0x5549e7['length']>0x0){_['forEach'](_0x5549e7,function(_0x67863d){if(_[_0xa032('0x38')]([_0xa032('0x39'),_0xa032('0x3a')],_0x67863d['type'])&&_0x67863d['nameField']&&!_0x67863d[_0xa032('0x3b')]){_0x42c53b[_0x67863d[_0xa032('0x3c')]['toLowerCase']()]=_0x67863d[_0xa032('0x3d')][_0xa032('0x33')]();}else if(_[_0xa032('0x38')]([_0xa032('0x39'),_0xa032('0x3a')],_0x67863d[_0xa032('0x3e')])&&_0x67863d['idField']&&_0x67863d[_0xa032('0x3b')]){_0x42c53b[_0xa032('0x3f')][_0xa032('0x40')]({'id':_0x67863d[_0xa032('0x41')],'value':_0x67863d[_0xa032('0x3d')]['toString']()});}else if(_0x67863d['type']===_0xa032('0x42')&&_0x67863d[_0xa032('0x43')]&&_0x67863d[_0xa032('0x41')]&&_0x67863d[_0xa032('0x3b')]){_0x406de4[_0x67863d[_0xa032('0x43')]]&&_0x42c53b['custom_fields'][_0xa032('0x40')]({'id':_0x67863d['idField'],'value':_0x406de4[_0x67863d['variableName']][_0xa032('0x33')]()});}else if(_0x67863d[_0xa032('0x3e')]==='customVariable'&&_0x67863d[_0xa032('0x44')]&&_0x67863d['Variable'][_0xa032('0x10')]&&_0x67863d[_0xa032('0x41')]&&_0x67863d[_0xa032('0x3b')]){_0x406de4[_0x67863d[_0xa032('0x44')]['name'][_0xa032('0x45')]()]&&_0x42c53b[_0xa032('0x3f')][_0xa032('0x40')]({'id':_0x67863d[_0xa032('0x41')],'value':_0x406de4[_0x67863d[_0xa032('0x44')][_0xa032('0x10')]['toLowerCase']()][_0xa032('0x33')]()});}});}return _0x42c53b;}exports[_0xa032('0x46')]=function(_0x31b409,_0x1282b0,_0x344444,_0x2fecdf,_0x28b472,_0x18a426){var _0x401472,_0x455ddc;_0x18a426[_0xa032('0x19')]=intUtil[_0xa032('0x47')](_0x18a426[_0xa032('0x19')]);_0x18a426[_0xa032('0x48')]=intUtil[_0xa032('0x47')](_0x18a426[_0xa032('0x48')]);if(_0x28b472&&_0x28b472[_0xa032('0x49')]){logger['info'](_0xa032('0x4a'),_0xa032('0x4b'));_0x1282b0[_0xa032('0x4c')]=util[_0xa032('0xc')](_0xa032('0x4d'),_0x18a426[_0xa032('0x48')],_0x1282b0[_0xa032('0x4e')],md5(_0x1282b0[_0xa032('0x4e')]));}else{_0x1282b0[_0xa032('0x4c')]='';}headers[_0xa032('0x4f')]=getAuth(_0x18a426);return getUser(_0x18a426,_0x2fecdf[_0xa032('0x50')])[_0xa032('0x14')](function(_0x3d2f75){_0x401472=_0x3d2f75;logger[_0xa032('0xb')](_0xa032('0x51'),_0x401472['id']);return getEndUser(_0x18a426,_0x1282b0['calleridname'],_0x1282b0['calleridnum']);})[_0xa032('0x14')](function(_0x4d5d51){_0x455ddc=_0x4d5d51;logger['info']('The\x20Enduser\x20ID\x20is:',_0x455ddc['id']);return getTicket(_0x18a426,_0x401472,_0x455ddc,_0x344444,_0x1282b0);})[_0xa032('0x14')](function(_0x3a95d1){if(_0x3a95d1){logger['info'](_0xa032('0x52'),_0x3a95d1['id']);switch(_0x18a426['type']){case'integrationTab':logger[_0xa032('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xa032('0xc')](_0xa032('0x53'),_0x18a426[_0xa032('0x19')],_0x401472['id'],_0x3a95d1['id']),'method':_0xa032('0xe')});case'newTab':logger[_0xa032('0xb')](_0xa032('0x4a'),_0xa032('0x54'));emit(util[_0xa032('0xc')](_0xa032('0x55'),_0x2fecdf[_0xa032('0x10')]),_0xa032('0x56'),{'uri':util['format'](_0xa032('0x57'),_0x18a426[_0xa032('0x19')][_0xa032('0x58')]('/api/v2',''),_0x3a95d1['id'])});break;default:logger[_0xa032('0x59')]('[QUEUE]',_0xa032('0x5a'));}}})[_0xa032('0x5b')](function(_0x21ebd8){logger[_0xa032('0x59')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xa032('0x5c')](_0x21ebd8,{'showHidden':!![],'depth':null}));});};exports[_0xa032('0x5d')]=function(_0x5a2092,_0xb88f09,_0x5dbc75,_0x393e84,_0x5c58e9,_0x1c5ab0,_0x197692){var _0x2c6853,_0x533258;_0x1c5ab0[_0xa032('0x19')]=intUtil[_0xa032('0x47')](_0x1c5ab0[_0xa032('0x19')]);_0x1c5ab0[_0xa032('0x48')]=intUtil[_0xa032('0x47')](_0x1c5ab0[_0xa032('0x48')]);if(_0x197692&&_0x197692[_0xa032('0x5e')]&&_0x197692[_0xa032('0x5e')]!=='none'){logger['info'](_0xa032('0x5f'),_0xa032('0x4b'));_0xb88f09[_0xa032('0x4c')]=util['format'](_0xa032('0x4d'),_0x1c5ab0['serverUrl'],_0xb88f09[_0xa032('0x4e')],md5(_0xb88f09['uniqueid']));}headers['Authorization']=getAuth(_0x1c5ab0);return getUser(_0x1c5ab0,_0x393e84[_0xa032('0x50')])[_0xa032('0x14')](function(_0xbb124f){_0x2c6853=_0xbb124f;logger[_0xa032('0xb')](_0xa032('0x51'),_0x2c6853['id']);return getEndUser(_0x1c5ab0,_0xb88f09[_0xa032('0x60')],_0xb88f09[_0xa032('0x61')]);})[_0xa032('0x14')](function(_0x4276c5){_0x533258=_0x4276c5;logger[_0xa032('0xb')]('The\x20Enduser\x20ID\x20is:',_0x533258['id']);return getTicket(_0x1c5ab0,_0x2c6853,_0x533258,_0x5dbc75,_0xb88f09);})[_0xa032('0x14')](function(_0x72625c){if(_0x72625c){logger[_0xa032('0xb')]('The\x20Ticket\x20ID\x20is:',_0x72625c['id']);switch(_0x1c5ab0[_0xa032('0x3e')]){case _0xa032('0x62'):logger['info'](_0xa032('0x5f'),_0xa032('0x63'));return request({'uri':util[_0xa032('0xc')](_0xa032('0x53'),_0x1c5ab0[_0xa032('0x19')],_0x2c6853['id'],_0x72625c['id']),'method':_0xa032('0xe')});case _0xa032('0x64'):logger[_0xa032('0xb')]('[OUTBOUND]',_0xa032('0x54'));emit(util[_0xa032('0xc')]('user:%s',_0x393e84[_0xa032('0x10')]),_0xa032('0x56'),{'uri':util['format'](_0xa032('0x57'),_0x1c5ab0['remoteUri'][_0xa032('0x58')](_0xa032('0x65'),''),_0x72625c['id'])});break;default:logger[_0xa032('0x59')](_0xa032('0x5f'),_0xa032('0x5a'));}}})['catch'](function(_0x4ae1c6){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x4ae1c6,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0xa06593,_0x28cdd8,_0x4e77ce,_0x3ba8d1,_0x5dc047,_0x145f1a){var _0x2c3457,_0x5c6dcd;_0x145f1a[_0xa032('0x19')]=intUtil[_0xa032('0x47')](_0x145f1a['remoteUri']);_0x145f1a[_0xa032('0x48')]=intUtil[_0xa032('0x47')](_0x145f1a[_0xa032('0x48')]);if(_0x5dc047&&_0x5dc047[_0xa032('0x49')]){logger[_0xa032('0xb')]('['+_0x28cdd8[_0xa032('0x66')][_0xa032('0x67')]()+']',_0xa032('0x4b'));_0x28cdd8['recordingURL']=util[_0xa032('0xc')](_0xa032('0x4d'),_0x145f1a[_0xa032('0x48')],_0x28cdd8[_0xa032('0x4e')],md5(_0x28cdd8[_0xa032('0x4e')]));}else{_0x28cdd8['recordingURL']='';}headers['Authorization']=getAuth(_0x145f1a);return getUser(_0x145f1a)[_0xa032('0x14')](function(_0x3a3b54){_0x2c3457=_0x3a3b54;logger[_0xa032('0xb')]('The\x20User\x20ID\x20is:',_0x2c3457['id']);return getEndUser(_0x145f1a,_0x28cdd8[_0xa032('0x68')],_0x28cdd8[_0xa032('0x69')]);})[_0xa032('0x14')](function(_0x2c9f30){_0x5c6dcd=_0x2c9f30;logger['info'](_0xa032('0x6a'),_0x5c6dcd['id']);return getTicket(_0x145f1a,_0x2c3457,_0x5c6dcd,_0x4e77ce,_0x28cdd8);})[_0xa032('0x14')](function(_0x2634d7){if(_0x2634d7){logger[_0xa032('0xb')](_0xa032('0x52'),_0x2634d7['id']);}})[_0xa032('0x5b')](function(_0x18aa68){logger[_0xa032('0x59')]('['+_0x28cdd8['lastevent'][_0xa032('0x67')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x18aa68,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x86e1=['type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','string','type','nameField','customField','toLowerCase','content','picklist','custom_fields','push','idField','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','POST','merge','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','remoteUri'];(function(_0x221eb2,_0x2d65bc){var _0x3760ee=function(_0x3a88ee){while(--_0x3a88ee){_0x221eb2['push'](_0x221eb2['shift']());}};_0x3760ee(++_0x2d65bc);}(_0x86e1,0xcc));var _0x186e=function(_0xad12ac,_0x2d34d0){_0xad12ac=_0xad12ac-0x0;var _0x20ec06=_0x86e1[_0xad12ac];return _0x20ec06;};'use strict';var _=require('lodash');var rp=require(_0x186e('0x0'));var md5=require('md5');var util=require(_0x186e('0x1'));var Redis=require(_0x186e('0x2'));var intUtil=require(_0x186e('0x3'));var config=require(_0x186e('0x4'));var logger=require(_0x186e('0x5'))(_0x186e('0x6'));config[_0x186e('0x7')]=_['defaults'](config[_0x186e('0x7')],{'host':_0x186e('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x186e('0x7')]));function emit(_0x5ece88,_0x45af17,_0x5899dd){io['to'](_0x5ece88)[_0x186e('0x9')](_0x45af17,_0x5899dd);}var headers={'Content-Type':_0x186e('0xa'),'Accept':_0x186e('0xa')};function getTicket(_0x313008,_0x43d7e0,_0x5b222d,_0x43a4e4,_0x6c329){logger[_0x186e('0xb')](_0x186e('0xc'));return request({'uri':util['format'](_0x186e('0xd'),_0x313008['remoteUri']),'method':_0x186e('0xe'),'body':{'ticket':_[_0x186e('0xf')]({'requester_id':_0x5b222d['id'],'submitter_id':_0x43d7e0?_0x43d7e0['id']:undefined,'assignee_id':_0x43d7e0?_0x43d7e0['id']:undefined,'tags':getTags(_0x43a4e4[_0x186e('0x10')],_0x186e('0x11')),'subject':intUtil[_0x186e('0x12')](_0x43a4e4['Subjects'],_0x6c329,'\x20'),'description':intUtil['getString'](_0x43a4e4[_0x186e('0x13')],_0x6c329,'\x0a'),'comment':{'public':![],'body':intUtil[_0x186e('0x12')](_0x43a4e4[_0x186e('0x13')],_0x6c329,'\x0a')}},getCustomFields(_0x43a4e4[_0x186e('0x14')],_0x6c329))}})[_0x186e('0x15')](function(_0x2deca7){logger['info'](_0x186e('0x16'));return _0x2deca7[_0x186e('0x17')];});}function getUser(_0x32dd2c,_0x5d1bbc){if(intUtil[_0x186e('0x18')](_0x5d1bbc)){logger[_0x186e('0xb')](_0x186e('0x19'),_0x5d1bbc);return request({'uri':util[_0x186e('0x1a')]('%s/search.json',_0x32dd2c[_0x186e('0x1b')]),'qs':{'query':util['format'](_0x186e('0x1c'),_0x5d1bbc)}})[_0x186e('0x15')](function(_0x9affbe){if(_0x9affbe[_0x186e('0x1d')]){logger[_0x186e('0xb')](_0x186e('0x1e'));return _[_0x186e('0x1f')](_0x9affbe[_0x186e('0x20')],{'email':_0x5d1bbc,'role':'agent'});}else{logger['info'](_0x186e('0x21'));return request({'uri':util[_0x186e('0x1a')](_0x186e('0x22'),_0x32dd2c[_0x186e('0x1b')])})[_0x186e('0x15')](function(_0x40aeeb){logger[_0x186e('0xb')](_0x186e('0x23'));return _0x40aeeb[_0x186e('0x24')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x186e('0x1a')](_0x186e('0x22'),_0x32dd2c[_0x186e('0x1b')])})['then'](function(_0x27f349){logger['info'](_0x186e('0x23'));return _0x27f349[_0x186e('0x24')];});}}function getEndUser(_0x50972f,_0x5b7684,_0x3ede80){logger[_0x186e('0xb')](_0x186e('0x25'),_0x3ede80);return request({'uri':util['format'](_0x186e('0x26'),_0x50972f[_0x186e('0x1b')]),'qs':{'query':util[_0x186e('0x1a')](_0x186e('0x27'),_0x3ede80)}})[_0x186e('0x15')](function(_0x430cb1){var _0x436d42;if(_0x430cb1[_0x186e('0x20')][_0x186e('0x28')]){_0x430cb1['results']=_[_0x186e('0x29')](_0x430cb1[_0x186e('0x20')],{'suspended':![],'role':_0x186e('0x2a')});if(_0x430cb1['results'][_0x186e('0x28')]){_0x436d42=_[_0x186e('0x2b')](_0x430cb1['results']);}}if(_0x436d42){logger[_0x186e('0xb')](_0x186e('0x2c'));return _0x436d42;}else{logger[_0x186e('0xb')](_0x186e('0x2d'));return request({'uri':util[_0x186e('0x1a')](_0x186e('0x2e'),_0x50972f['remoteUri']),'method':'POST','body':{'user':{'role':_0x186e('0x2a'),'name':util['format'](_0x186e('0x2f'),_0x5b7684||_0x3ede80),'phone':_0x3ede80}}})['then'](function(_0x285925){logger[_0x186e('0xb')]('Enduser\x20created.');return _0x285925['user'];});}});}function getAuth(_0x33ca39){var _0x2f841a;if(_0x33ca39[_0x186e('0x30')]===_0x186e('0x31')){_0x2f841a=util[_0x186e('0x1a')]('%s:%s',_0x33ca39['username'],_0x33ca39[_0x186e('0x31')]);}else if(_0x33ca39[_0x186e('0x30')]===_0x186e('0x32')){_0x2f841a=util[_0x186e('0x1a')](_0x186e('0x33'),_0x33ca39['username'],_0x33ca39[_0x186e('0x32')]);}return util[_0x186e('0x1a')](_0x186e('0x34'),new Buffer(_0x2f841a)[_0x186e('0x35')](_0x186e('0x36')));}function request(_0x5f5589){logger[_0x186e('0x37')](_0x186e('0x38'),JSON[_0x186e('0x39')](_0x5f5589));return rp(_['defaults'](_0x5f5589,{'method':_0x186e('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x2bcce8,_0x10cbb6){var _0x1fa77b=[];if(_0x2bcce8&&_0x2bcce8['length']>0x0){_0x1fa77b=_[_0x186e('0x3b')](_0x2bcce8,_0x10cbb6);}return _0x1fa77b;}function getCustomFields(_0x12c7e0,_0x9c9d0e){var _0x51fa2d=[];var _0x490c7={'custom_fields':[]};if(_0x12c7e0['length']>0x0){_[_0x186e('0x3c')](_0x12c7e0,function(_0x1817e5){if(_['includes']([_0x186e('0x3d'),'picklist'],_0x1817e5[_0x186e('0x3e')])&&_0x1817e5[_0x186e('0x3f')]&&!_0x1817e5[_0x186e('0x40')]){_0x490c7[_0x1817e5['nameField'][_0x186e('0x41')]()]=_0x1817e5[_0x186e('0x42')][_0x186e('0x35')]();}else if(_['includes']([_0x186e('0x3d'),_0x186e('0x43')],_0x1817e5[_0x186e('0x3e')])&&_0x1817e5['idField']&&_0x1817e5['customField']){_0x490c7[_0x186e('0x44')][_0x186e('0x45')]({'id':_0x1817e5[_0x186e('0x46')],'value':_0x1817e5['content'][_0x186e('0x35')]()});}else if(_0x1817e5[_0x186e('0x3e')]===_0x186e('0x47')&&_0x1817e5[_0x186e('0x48')]&&_0x1817e5['idField']&&_0x1817e5[_0x186e('0x40')]){_0x9c9d0e[_0x1817e5['variableName']]&&_0x490c7['custom_fields'][_0x186e('0x45')]({'id':_0x1817e5[_0x186e('0x46')],'value':_0x9c9d0e[_0x1817e5[_0x186e('0x48')]][_0x186e('0x35')]()});}else if(_0x1817e5[_0x186e('0x3e')]===_0x186e('0x49')&&_0x1817e5[_0x186e('0x4a')]&&_0x1817e5[_0x186e('0x4a')][_0x186e('0x11')]&&_0x1817e5[_0x186e('0x46')]&&_0x1817e5[_0x186e('0x40')]){_0x9c9d0e[_0x1817e5[_0x186e('0x4a')]['name'][_0x186e('0x41')]()]&&_0x490c7[_0x186e('0x44')][_0x186e('0x45')]({'id':_0x1817e5['idField'],'value':_0x9c9d0e[_0x1817e5[_0x186e('0x4a')][_0x186e('0x11')]['toLowerCase']()][_0x186e('0x35')]()});}});}return _0x490c7;}exports[_0x186e('0x4b')]=function(_0xf2e6a0,_0x45a3e7,_0x4cc496,_0x39ac40,_0x475e0b,_0x4fd8b4){var _0x361b58,_0x4901ab;_0x4fd8b4[_0x186e('0x1b')]=intUtil[_0x186e('0x4c')](_0x4fd8b4[_0x186e('0x1b')]);_0x4fd8b4['serverUrl']=intUtil['stripTrailingSlash'](_0x4fd8b4['serverUrl']);if(_0x475e0b&&_0x475e0b[_0x186e('0x4d')]){logger['info']('[QUEUE]',_0x186e('0x4e'));_0x45a3e7[_0x186e('0x4f')]=util['format'](_0x186e('0x50'),_0x4fd8b4[_0x186e('0x51')],_0x45a3e7['uniqueid'],md5(_0x45a3e7[_0x186e('0x52')]));}else{_0x45a3e7[_0x186e('0x4f')]='';}headers[_0x186e('0x53')]=getAuth(_0x4fd8b4);return getUser(_0x4fd8b4,_0x39ac40[_0x186e('0x54')])[_0x186e('0x15')](function(_0x5749d7){_0x361b58=_0x5749d7;logger[_0x186e('0xb')]('The\x20User\x20ID\x20is:',_0x361b58['id']);return getEndUser(_0x4fd8b4,_0x45a3e7[_0x186e('0x55')],_0x45a3e7[_0x186e('0x56')]);})[_0x186e('0x15')](function(_0x4bda19){_0x4901ab=_0x4bda19;logger[_0x186e('0xb')](_0x186e('0x57'),_0x4901ab['id']);return getTicket(_0x4fd8b4,_0x361b58,_0x4901ab,_0x4cc496,_0x45a3e7);})[_0x186e('0x15')](function(_0x1942b2){if(_0x1942b2){logger['info'](_0x186e('0x58'),_0x1942b2['id']);switch(_0x4fd8b4[_0x186e('0x3e')]){case _0x186e('0x59'):logger[_0x186e('0xb')]('[QUEUE]',_0x186e('0x5a'));return request({'uri':util[_0x186e('0x1a')](_0x186e('0x5b'),_0x4fd8b4[_0x186e('0x1b')],_0x361b58['id'],_0x1942b2['id']),'method':_0x186e('0xe')});case _0x186e('0x5c'):logger[_0x186e('0xb')](_0x186e('0x5d'),_0x186e('0x5e'));emit(util[_0x186e('0x1a')]('user:%s',_0x39ac40[_0x186e('0x11')]),_0x186e('0x5f'),{'uri':util['format'](_0x186e('0x60'),_0x4fd8b4['remoteUri'][_0x186e('0x61')](_0x186e('0x62'),''),_0x1942b2['id'])});break;default:logger[_0x186e('0x63')](_0x186e('0x5d'),_0x186e('0x64'));}}})[_0x186e('0x65')](function(_0x2e6ff6){logger[_0x186e('0x63')](_0x186e('0x66'),util[_0x186e('0x67')](_0x2e6ff6,{'showHidden':!![],'depth':null}));});};exports[_0x186e('0x68')]=function(_0x1dbea8,_0x276b1d,_0x19f530,_0x102b6d,_0x3c9063,_0x3b165e,_0x29855d){var _0x37273d,_0x407df7;_0x3b165e[_0x186e('0x1b')]=intUtil[_0x186e('0x4c')](_0x3b165e['remoteUri']);_0x3b165e[_0x186e('0x51')]=intUtil[_0x186e('0x4c')](_0x3b165e[_0x186e('0x51')]);if(_0x29855d&&_0x29855d[_0x186e('0x69')]&&_0x29855d[_0x186e('0x69')]!==_0x186e('0x6a')){logger[_0x186e('0xb')](_0x186e('0x6b'),'Recording\x20is\x20enabled!');_0x276b1d[_0x186e('0x4f')]=util[_0x186e('0x1a')](_0x186e('0x50'),_0x3b165e[_0x186e('0x51')],_0x276b1d[_0x186e('0x52')],md5(_0x276b1d[_0x186e('0x52')]));}headers['Authorization']=getAuth(_0x3b165e);return getUser(_0x3b165e,_0x102b6d[_0x186e('0x54')])['then'](function(_0x3171af){_0x37273d=_0x3171af;logger['info'](_0x186e('0x6c'),_0x37273d['id']);return getEndUser(_0x3b165e,_0x276b1d[_0x186e('0x6d')],_0x276b1d[_0x186e('0x6e')]);})['then'](function(_0x5cc78e){_0x407df7=_0x5cc78e;logger[_0x186e('0xb')](_0x186e('0x57'),_0x407df7['id']);return getTicket(_0x3b165e,_0x37273d,_0x407df7,_0x19f530,_0x276b1d);})['then'](function(_0x2c6a93){if(_0x2c6a93){logger[_0x186e('0xb')](_0x186e('0x58'),_0x2c6a93['id']);switch(_0x3b165e[_0x186e('0x3e')]){case _0x186e('0x59'):logger[_0x186e('0xb')](_0x186e('0x6b'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x186e('0x1a')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3b165e[_0x186e('0x1b')],_0x37273d['id'],_0x2c6a93['id']),'method':_0x186e('0xe')});case _0x186e('0x5c'):logger['info'](_0x186e('0x6b'),_0x186e('0x5e'));emit(util[_0x186e('0x1a')](_0x186e('0x6f'),_0x102b6d[_0x186e('0x11')]),'trigger:browser:url',{'uri':util[_0x186e('0x1a')]('%s/agent/tickets/%s',_0x3b165e[_0x186e('0x1b')][_0x186e('0x61')](_0x186e('0x62'),''),_0x2c6a93['id'])});break;default:logger['error'](_0x186e('0x6b'),_0x186e('0x64'));}}})[_0x186e('0x65')](function(_0x146ce8){logger[_0x186e('0x63')](_0x186e('0x70'),util[_0x186e('0x67')](_0x146ce8,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x1b8a52,_0x1d9a71,_0x34f022,_0x2be7fe,_0x1b8d88,_0x248e70){var _0x3c19bd,_0x1df366;_0x248e70[_0x186e('0x1b')]=intUtil[_0x186e('0x4c')](_0x248e70[_0x186e('0x1b')]);_0x248e70[_0x186e('0x51')]=intUtil[_0x186e('0x4c')](_0x248e70[_0x186e('0x51')]);if(_0x1b8d88&&_0x1b8d88[_0x186e('0x4d')]){logger[_0x186e('0xb')]('['+_0x1d9a71[_0x186e('0x71')][_0x186e('0x72')]()+']',_0x186e('0x4e'));_0x1d9a71[_0x186e('0x4f')]=util[_0x186e('0x1a')](_0x186e('0x50'),_0x248e70[_0x186e('0x51')],_0x1d9a71[_0x186e('0x52')],md5(_0x1d9a71['uniqueid']));}else{_0x1d9a71[_0x186e('0x4f')]='';}headers[_0x186e('0x53')]=getAuth(_0x248e70);return getUser(_0x248e70)['then'](function(_0x33c540){_0x3c19bd=_0x33c540;logger['info'](_0x186e('0x6c'),_0x3c19bd['id']);return getEndUser(_0x248e70,_0x1d9a71[_0x186e('0x55')],_0x1d9a71[_0x186e('0x56')]);})['then'](function(_0xde75c6){_0x1df366=_0xde75c6;logger[_0x186e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1df366['id']);return getTicket(_0x248e70,_0x3c19bd,_0x1df366,_0x34f022,_0x1d9a71);})[_0x186e('0x15')](function(_0x31d060){if(_0x31d060){logger[_0x186e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x31d060['id']);}})[_0x186e('0x65')](function(_0x2b0185){logger[_0x186e('0x63')]('['+_0x1d9a71[_0x186e('0x71')][_0x186e('0x72')]()+']'+_0x186e('0x73'),util[_0x186e('0x67')](_0x2b0185,{'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 366b177..8c93288 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 _0xf2dd=['idField','content','type','variableName','toString','customVariable','Variable','name','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','format','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Agent\x20found!','info','profile','Administrator','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','enduserType','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','https://www.zohoapis.','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','complete','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','agentcalledAt','Call_Type','Inbound','merge','Fields','SUCCESS','Call\x20created!','details','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','[QUEUE]','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','trigger:browser:url','unmanaged','toUpperCase','calleridname','lodash','request-promise','./util','moment','bluebird','../../../../config/logger','redis','localhost','[HTTP]','length','forEach','includes','string','picklist'];(function(_0x407677,_0x3a77eb){var _0x4227ff=function(_0x322706){while(--_0x322706){_0x407677['push'](_0x407677['shift']());}};_0x4227ff(++_0x3a77eb);}(_0xf2dd,0x84));var _0xdf2d=function(_0x2543d6,_0x3a5e78){_0x2543d6=_0x2543d6-0x0;var _0x55213c=_0xf2dd[_0x2543d6];return _0x55213c;};'use strict';var _=require(_0xdf2d('0x0'));var rp=require(_0xdf2d('0x1'));var md5=require('md5');var util=require('util');var intUtil=require(_0xdf2d('0x2'));var moment=require(_0xdf2d('0x3'));var Redis=require('ioredis');var BPromise=require(_0xdf2d('0x4'));var config=require('../../../../config/environment');var logger=require(_0xdf2d('0x5'))('zoho');config[_0xdf2d('0x6')]=_['defaults'](config[_0xdf2d('0x6')],{'host':_0xdf2d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdf2d('0x6')]));function emit(_0x1d53e1,_0x3ead9f,_0x3606cc){io['to'](_0x1d53e1)['emit'](_0x3ead9f,_0x3606cc);}function request(_0x29e961){logger['debug'](_0xdf2d('0x8'),JSON['stringify'](_0x29e961));return rp(_0x29e961);}function getCustomFields(_0x500cc3,_0x5c357f){var _0x3377d2={};if(_0x500cc3[_0xdf2d('0x9')]>0x0){_[_0xdf2d('0xa')](_0x500cc3,function(_0x594e16){if(_[_0xdf2d('0xb')]([_0xdf2d('0xc'),_0xdf2d('0xd')],_0x594e16['type'])&&_0x594e16[_0xdf2d('0xe')]){_0x3377d2[_0x594e16[_0xdf2d('0xe')]]=_0x594e16[_0xdf2d('0xf')]['toString']();}else if(_0x594e16[_0xdf2d('0x10')]==='variable'&&_0x594e16[_0xdf2d('0x11')]&&_0x594e16[_0xdf2d('0xe')]&&_0x5c357f[_0x594e16['variableName']]){_0x3377d2[_0x594e16[_0xdf2d('0xe')]]=_0x5c357f[_0x594e16['variableName']][_0xdf2d('0x12')]();}else if(_0x594e16[_0xdf2d('0x10')]===_0xdf2d('0x13')&&_0x594e16[_0xdf2d('0x14')]&&_0x594e16['Variable'][_0xdf2d('0x15')]&&_0x594e16['idField']&&_0x5c357f[_0x594e16[_0xdf2d('0x14')][_0xdf2d('0x15')]['toLowerCase']()]){_0x3377d2[_0x594e16[_0xdf2d('0xe')]]=_0x5c357f[_0x594e16['Variable'][_0xdf2d('0x15')]['toLowerCase']()][_0xdf2d('0x12')]();}});}return _0x3377d2;}function getName(_0x1fb5bc){if(_0x1fb5bc['indexOf']('\x20')>0x0){var _0x24dc59=_0x1fb5bc['split'](/ (.+)/);if(_0x24dc59[0x1]){return _0x24dc59;}}return[_0x1fb5bc,_0x1fb5bc];}var accountsTokens={};function getAccessToken(_0x23c5f1){return new Promise(function(_0x3185ed,_0x100827){if(!_[_0xdf2d('0x16')](accountsTokens[_0x23c5f1['id']])&&!_[_0xdf2d('0x16')](accountsTokens[_0x23c5f1['id']][_0xdf2d('0x17')])){if(moment()[_0xdf2d('0x18')](accountsTokens[_0x23c5f1['id']][_0xdf2d('0x19')])){_0x3185ed(accountsTokens[_0x23c5f1['id']][_0xdf2d('0x17')]);}}var _0x383dd3;switch(_0x23c5f1[_0xdf2d('0x1a')]){case'US':_0x383dd3=_0xdf2d('0x1b');break;case'AU':_0x383dd3=_0xdf2d('0x1c');break;case'EU':_0x383dd3=_0xdf2d('0x1d');break;case'IN':_0x383dd3=_0xdf2d('0x1e');break;case'CN':_0x383dd3=_0xdf2d('0x1f');break;default:_0x383dd3=_0xdf2d('0x1d');break;}var _0x3b3a0c={'method':_0xdf2d('0x20'),'uri':_0x383dd3+'/oauth/v2/token','qs':{'refresh_token':_0x23c5f1['refreshToken'],'client_id':_0x23c5f1[_0xdf2d('0x21')],'client_secret':_0x23c5f1[_0xdf2d('0x22')],'grant_type':_0xdf2d('0x23')},'json':!![]};return rp(_0x3b3a0c)[_0xdf2d('0x24')](function(_0x13422f){accountsTokens[_0x23c5f1['id']]={'access_token':_0x13422f['access_token'],'expires_in':moment()[_0xdf2d('0x25')](_0x13422f[_0xdf2d('0x19')],_0xdf2d('0x26'))};_0x3185ed(_0x13422f[_0xdf2d('0x17')]);})[_0xdf2d('0x27')](function(_0x53d496){logger[_0xdf2d('0x28')]('Failing\x20creating\x20the\x20access_token',_0x53d496['stack']);_0x100827(_0x53d496);});});}function getUser(_0x4cd025,_0x459eec,_0x3f7936,_0xaa486b){logger['info']('Search\x20user');return request({'method':'GET','uri':util[_0xdf2d('0x29')]('https://www.zohoapis.%s/crm/v2/users',_0x459eec),'qs':{'type':_0xdf2d('0x2a')},'headers':{'Authorization':_0xdf2d('0x2b')+_0x4cd025},'json':!![]})[_0xdf2d('0x24')](function(_0x221906){if(_0x221906['users']){var _0x311e9c=-0x1;if(_[_0xdf2d('0x2c')](_0x221906[_0xdf2d('0x2d')])){if(!_[_0xdf2d('0x16')](_0xaa486b)){_0x311e9c=_[_0xdf2d('0x2e')](_0x221906['users'],function(_0x52307c){return _0x52307c[_0xdf2d('0x2f')]===_0xaa486b;});}if(_0x311e9c>=0x0){logger['info'](_0xdf2d('0x30'));}else{logger[_0xdf2d('0x31')]('Using\x20the\x20admin\x20account!');_0x311e9c=_[_0xdf2d('0x2e')](_0x221906[_0xdf2d('0x2d')],function(_0x362661){return _0x362661[_0xdf2d('0x32')][_0xdf2d('0x15')]==='Administrator';});}return _0x221906[_0xdf2d('0x2d')][_0x311e9c];}else{if(_0x221906['user'][_0xdf2d('0x32')][_0xdf2d('0x15')]===_0xdf2d('0x33')){logger[_0xdf2d('0x31')](_0xdf2d('0x34'));user=_0x221906['user'];return user;}else{logger[_0xdf2d('0x28')](_0xdf2d('0x35'),JSON[_0xdf2d('0x36')](_0x221906));throw new Error(_0xdf2d('0x37')+JSON[_0xdf2d('0x36')](_0x221906));}}}else{logger['error'](_0xdf2d('0x35'),JSON[_0xdf2d('0x36')](_0x221906));throw new Error(_0xdf2d('0x37')+JSON[_0xdf2d('0x36')](_0x221906));}})['catch'](function(_0x3ddaad){console[_0xdf2d('0x28')](_0x3ddaad);});}function getZohoUser(_0x536b52,_0x3ee6e2){return new BPromise(function(_0x440794,_0x397616){request(_0x536b52)[_0xdf2d('0x24')](function(_0x5c470b){var _0x2ba7c3=null;if(_0x5c470b){_0x2ba7c3=_0x5c470b[_0xdf2d('0x38')][0x0];_0x2ba7c3['enduserType']=_0x3ee6e2;}_0x440794(_0x2ba7c3);})[_0xdf2d('0x27')](function(_0x5820c3){_0x397616(_0x5820c3);});});}function createEndUser(_0x3b6edf,_0x3df945,_0x367027,_0x2a9963,_0xc23424,_0x41089f){var _0x367027=getName(_0x367027);return request({'method':_0xdf2d('0x20'),'uri':'https://www.zohoapis.'+_0x3df945+_0xdf2d('0x39')+_[_0xdf2d('0x3a')](_0x41089f[_0xdf2d('0x3b')])+'s','body':{'data':[{'Last_Name':_0x367027[0x1],'First_Name':_0x367027[0x0],'Phone':_0x2a9963,'Owner':{'name':!_[_0xdf2d('0x16')](_0xc23424['role']['name'])?_0xc23424[_0xdf2d('0x3c')]['name']:!_[_0xdf2d('0x16')](_0xc23424[_0xdf2d('0x3d')])?_0xc23424[_0xdf2d('0x3d')]+'\x20'+_0xc23424[_0xdf2d('0x3e')]:_0xc23424[_0xdf2d('0x3e')],'id':_0xc23424['id']}}]},'headers':{'Authorization':_0xdf2d('0x2b')+_0x3b6edf},'json':!![]})[_0xdf2d('0x24')](function(_0xba0ec3){if(_0xba0ec3&&_0xba0ec3[_0xdf2d('0x38')][0x0]['code']==='SUCCESS'){var _0x1c117e=_0xba0ec3[_0xdf2d('0x38')][0x0]['details'];_0x1c117e[_0xdf2d('0x3f')]=_[_0xdf2d('0x3a')](_0x41089f['moduleCreate'])+'s';return _0x1c117e;}logger[_0xdf2d('0x28')]('The\x20failing\x20result\x20is',JSON[_0xdf2d('0x36')](data));throw new Error(_0xdf2d('0x40')+JSON['stringify'](data));})[_0xdf2d('0x27')](function(_0x36c442){console[_0xdf2d('0x41')](_0xdf2d('0x42'),_0x36c442);});}function getEndUser(_0x5aa691,_0x463878,_0x842d92,_0x1d1d96,_0x4bb3da,_0x21a772,_0x1b4bc7){var _0x463a1f={'method':_0xdf2d('0x43'),'uri':'','headers':{'Authorization':_0xdf2d('0x2b')+_0x5aa691},'json':!![]};switch(_0x1b4bc7[_0xdf2d('0x44')]){case _0xdf2d('0x45'):_0x463a1f[_0xdf2d('0x46')]='https://www.zohoapis.'+_0x463878+_0xdf2d('0x47')+_0x4bb3da+'))';return getZohoUser(_0x463a1f,_0xdf2d('0x48'))[_0xdf2d('0x24')](function(_0x340476){if(_0x340476)return _0x340476;_0x463a1f[_0xdf2d('0x46')]=_0xdf2d('0x49')+_0x463878+_0xdf2d('0x4a')+_0x4bb3da+'))';return getZohoUser(_0x463a1f,_0xdf2d('0x4b'))[_0xdf2d('0x24')](function(_0x219f7d){if(_0x219f7d)return _0x219f7d;if(_0x1b4bc7[_0xdf2d('0x3b')]!=_0xdf2d('0x4c')){return createEndUser(_0x5aa691,_0x463878,_0x1d1d96,_0x4bb3da,_0x21a772,_0x1b4bc7);}else{return{};}});});break;case'contact':_0x463a1f[_0xdf2d('0x46')]=_0xdf2d('0x49')+_0x463878+_0xdf2d('0x47')+_0x4bb3da+'))';return getZohoUser(_0x463a1f,_0xdf2d('0x48'))[_0xdf2d('0x24')](function(_0x27b0b9){if(_0x27b0b9)return _0x27b0b9;if(_0x1b4bc7[_0xdf2d('0x3b')]!=_0xdf2d('0x4c')){return createEndUser(_0x5aa691,_0x463878,_0x1d1d96,_0x4bb3da,_0x21a772,_0x1b4bc7);}else{return{};}});break;case _0xdf2d('0x4d'):_0x463a1f['uri']=_0xdf2d('0x49')+_0x463878+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4bb3da+'))';return getZohoUser(_0x463a1f,_0xdf2d('0x4b'))[_0xdf2d('0x24')](function(_0xf5c079){if(_0xf5c079)return _0xf5c079;if(_0x1b4bc7[_0xdf2d('0x3b')]!=_0xdf2d('0x4c')){return createEndUser(_0x5aa691,_0x463878,_0x1d1d96,_0x4bb3da,_0x21a772,_0x1b4bc7);}else{return{};}});break;}}function getCall(_0x5df254,_0x34876c,_0x769185,_0x28a2aa,_0x26807e,_0x469786,_0x30dbd2,_0x48aa32){logger[_0xdf2d('0x31')](_0xdf2d('0x4e'));var _0x2f7e21={};_0x2f7e21[_0xdf2d('0x4f')]={'name':!_[_0xdf2d('0x16')](_0x28a2aa[_0xdf2d('0x3c')]['name'])&&!_[_0xdf2d('0x16')](_0x28a2aa[_0xdf2d('0x32')][_0xdf2d('0x15')])&&_0x28a2aa[_0xdf2d('0x32')][_0xdf2d('0x15')]==='administrator'?_0x28a2aa[_0xdf2d('0x3c')][_0xdf2d('0x15')]:!_['isNil'](_0x28a2aa['first_name'])?_0x28a2aa[_0xdf2d('0x3d')]+'\x20'+_0x28a2aa[_0xdf2d('0x3e')]:_0x28a2aa[_0xdf2d('0x3e')],'id':_0x28a2aa['id']};_0x2f7e21[_0xdf2d('0x50')]=intUtil[_0xdf2d('0x51')](_0x469786[_0xdf2d('0x52')],_0x30dbd2,'\x20');_0x2f7e21[_0xdf2d('0x53')]=intUtil[_0xdf2d('0x51')](_0x469786[_0xdf2d('0x54')],_0x30dbd2,'\x0a');if(_0x26807e[_0xdf2d('0x3f')]===_0xdf2d('0x48')){_0x2f7e21[_0xdf2d('0x55')]={'name':!_[_0xdf2d('0x16')](_0x26807e[_0xdf2d('0x56')])?_0x26807e[_0xdf2d('0x56')]:!_[_0xdf2d('0x16')](_0x26807e[_0xdf2d('0x57')])?_0x26807e['First_Name']+'\x20'+_0x26807e[_0xdf2d('0x58')]:_0x26807e[_0xdf2d('0x58')],'id':_0x26807e['id']};}if(_0x26807e[_0xdf2d('0x3f')]===_0xdf2d('0x4b')){_0x2f7e21[_0xdf2d('0x59')]={'name':!_[_0xdf2d('0x16')](_0x26807e[_0xdf2d('0x56')])?_0x26807e['Full_Name']:!_[_0xdf2d('0x16')](_0x26807e[_0xdf2d('0x57')])?_0x26807e[_0xdf2d('0x57')]+'\x20'+_0x26807e[_0xdf2d('0x58')]:_0x26807e[_0xdf2d('0x58')],'id':_0x26807e['id']};_0x2f7e21['$se_module']=_[_0xdf2d('0x3a')](_0x26807e[_0xdf2d('0x3f')]);}if(_0x30dbd2['talktime']){_0x2f7e21[_0xdf2d('0x5a')]=moment[_0xdf2d('0x5b')](parseInt(_0x30dbd2['talktime'])*0x3e8)[_0xdf2d('0x29')](_0xdf2d('0x5c'));}else if(_0x30dbd2['answertime']&&_0x30dbd2[_0xdf2d('0x5d')]){_0x2f7e21[_0xdf2d('0x5a')]=moment[_0xdf2d('0x5b')](moment(_0x30dbd2[_0xdf2d('0x5d')],_0xdf2d('0x5e'))[_0xdf2d('0x5f')](moment(_0x30dbd2[_0xdf2d('0x60')],_0xdf2d('0x5e'))))[_0xdf2d('0x29')](_0xdf2d('0x5c'));}switch(_0x30dbd2[_0xdf2d('0x61')]){case _0xdf2d('0x62'):_0x2f7e21[_0xdf2d('0x63')]='Called';break;case _0xdf2d('0x64'):case'connect':_0x2f7e21['Call_Result']=_0xdf2d('0x65');break;case _0xdf2d('0x66'):_0x2f7e21[_0xdf2d('0x63')]=_0xdf2d('0x67');break;case _0xdf2d('0x68'):_0x2f7e21[_0xdf2d('0x63')]=_0xdf2d('0x69');break;case _0xdf2d('0x6a'):_0x2f7e21['Call_Result']=_0xdf2d('0x6b');default:}_0x2f7e21['Call_Start_Time']=(_0x48aa32==='outbound'?moment(_0x30dbd2[_0xdf2d('0x60')])[_0xdf2d('0x29')](_0xdf2d('0x5e')):moment(_0x30dbd2[_0xdf2d('0x6c')])[_0xdf2d('0x29')](_0xdf2d('0x5e')))||moment()[_0xdf2d('0x29')](_0xdf2d('0x5e'));_0x2f7e21[_0xdf2d('0x6d')]=_0x48aa32||_0xdf2d('0x6e');_0x2f7e21=_[_0xdf2d('0x6f')](_0x2f7e21,getCustomFields(_0x469786[_0xdf2d('0x70')],_0x30dbd2));return request({'method':'POST','uri':_0xdf2d('0x49')+_0x34876c+'/crm/v2/Calls','headers':{'Authorization':_0xdf2d('0x2b')+_0x5df254},'body':{'data':[_0x2f7e21]},'json':!![]})[_0xdf2d('0x24')](function(_0x195ed9){if(_0x195ed9&&_0x195ed9[_0xdf2d('0x38')][0x0]['code']===_0xdf2d('0x71')){logger[_0xdf2d('0x31')](_0xdf2d('0x72'));return{'id':_0x195ed9[_0xdf2d('0x38')][0x0][_0xdf2d('0x73')]['id']};}})[_0xdf2d('0x27')](function(_0x1e7556){logger['info']('err',_0x1e7556['stack']);console[_0xdf2d('0x41')](_0xdf2d('0x74'),_0x1e7556);});}exports[_0xdf2d('0x75')]=function(_0x3a0dd0,_0x554d38,_0x1db8b6,_0x2820a9,_0x35c68b,_0x1baabc){var _0x3ab3cb,_0x17873f,_0x62c7d2;_0x1baabc['host']=intUtil[_0xdf2d('0x76')](_0x1baabc[_0xdf2d('0x77')]);_0x1baabc[_0xdf2d('0x78')]=intUtil['stripTrailingSlash'](_0x1baabc[_0xdf2d('0x78')]);if(_0x35c68b&&_0x35c68b[_0xdf2d('0x79')]){logger[_0xdf2d('0x31')]('[QUEUE]',_0xdf2d('0x7a'));_0x554d38['recordingURL']=_0x1baabc[_0xdf2d('0x78')]+_0xdf2d('0x7b')+_0x554d38[_0xdf2d('0x7c')]+_0xdf2d('0x7d')+md5(_0x554d38[_0xdf2d('0x7c')]);}else{_0x554d38[_0xdf2d('0x7e')]='';}var _0x595097=_0x1baabc[_0xdf2d('0x77')]===_0xdf2d('0x7f')?'eu':_0xdf2d('0x80');return getAccessToken(_0x1baabc)[_0xdf2d('0x24')](function(_0x493393){_0x62c7d2=_0x493393;return getUser(_0x62c7d2,_0x595097,_0x1baabc,_0x2820a9[_0xdf2d('0x2f')]);})[_0xdf2d('0x24')](function(_0x12abf0){_0x3ab3cb=_0x12abf0;logger[_0xdf2d('0x31')](_0xdf2d('0x81'),_0x3ab3cb['id']);return getEndUser(_0x62c7d2,_0x595097,_0x1baabc,_0x554d38['calleridname'],_0x554d38[_0xdf2d('0x82')],_0x3ab3cb,_0x1db8b6);})[_0xdf2d('0x24')](function(_0x5c8529){_0x17873f=_0x5c8529;return getCall(_0x62c7d2,_0x595097,_0x1baabc,_0x3ab3cb,_0x17873f,_0x1db8b6,_0x554d38,_0xdf2d('0x6e'));})[_0xdf2d('0x24')](function(_0x46db51){if(_0x46db51){logger['info']('The\x20Call\x20ID\x20is:',_0x46db51['id']);logger[_0xdf2d('0x31')](_0xdf2d('0x83'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xdf2d('0x29')](_0xdf2d('0x84'),_0x2820a9[_0xdf2d('0x15')]),'trigger:browser:url',{'uri':_0xdf2d('0x85')+_0x1baabc[_0xdf2d('0x77')]+_0xdf2d('0x86')+_0x46db51['id']});}})['catch'](function(_0x9a029a){logger[_0xdf2d('0x28')](_0xdf2d('0x83'),JSON[_0xdf2d('0x36')](_0x9a029a));});};exports[_0xdf2d('0x87')]=function(_0x515df4,_0x1eabaa,_0x16729a,_0x123043,_0x28919d,_0x1831b7,_0x5ea4fc){var _0xadd641,_0x63c9da,_0x2faf07;_0x1831b7['host']=intUtil[_0xdf2d('0x76')](_0x1831b7[_0xdf2d('0x77')]);_0x1831b7[_0xdf2d('0x78')]=intUtil['stripTrailingSlash'](_0x1831b7[_0xdf2d('0x78')]);if(_0x5ea4fc&&_0x5ea4fc[_0xdf2d('0x88')]&&_0x5ea4fc[_0xdf2d('0x88')]!=='none'){logger[_0xdf2d('0x31')](_0xdf2d('0x89'),_0xdf2d('0x7a'));_0x1eabaa[_0xdf2d('0x7e')]=_0x1831b7[_0xdf2d('0x78')]+_0xdf2d('0x7b')+_0x1eabaa[_0xdf2d('0x7c')]+_0xdf2d('0x7d')+md5(_0x1eabaa[_0xdf2d('0x7c')]);}var _0x1ffd4c=_0x1831b7[_0xdf2d('0x77')]===_0xdf2d('0x7f')?'eu':_0xdf2d('0x80');return getAccessToken(_0x1831b7)['then'](function(_0x5eb1fa){_0x2faf07=_0x5eb1fa;return getUser(_0x2faf07,_0x1ffd4c,_0x1831b7,_0x123043[_0xdf2d('0x2f')]);})[_0xdf2d('0x24')](function(_0x5824d5){_0xadd641=_0x5824d5;logger[_0xdf2d('0x31')](_0xdf2d('0x81'),_0xadd641['id']);return getEndUser(_0x2faf07,_0x1ffd4c,_0x1831b7,_0x1eabaa[_0xdf2d('0x8a')],_0x1eabaa[_0xdf2d('0x8b')],_0xadd641,_0x16729a);})['then'](function(_0x47e0bb){_0x63c9da=_0x47e0bb;return getCall(_0x2faf07,_0x1ffd4c,_0x1831b7,_0xadd641,_0x63c9da,_0x16729a,_0x1eabaa,_0xdf2d('0x8c'));})[_0xdf2d('0x24')](function(_0x2b71c0){if(_0x2b71c0){logger[_0xdf2d('0x31')](_0xdf2d('0x8d'),_0x2b71c0['id']);logger[_0xdf2d('0x31')](_0xdf2d('0x89'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xdf2d('0x29')](_0xdf2d('0x84'),_0x123043['name']),_0xdf2d('0x8e'),{'uri':_0xdf2d('0x85')+_0x1831b7[_0xdf2d('0x77')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2b71c0['id']});}})[_0xdf2d('0x27')](function(_0x4a6274){logger['error'](_0xdf2d('0x89'),JSON[_0xdf2d('0x36')](_0x4a6274));});};exports[_0xdf2d('0x8f')]=function(_0x1ab6c2,_0x561c27,_0x26c802,_0x7d3751,_0xeae2ae,_0x47e557){var _0x33f5df,_0x2f995b,_0x3b4672;_0x47e557[_0xdf2d('0x77')]=intUtil[_0xdf2d('0x76')](_0x47e557[_0xdf2d('0x77')]);_0x47e557['serverUrl']=intUtil[_0xdf2d('0x76')](_0x47e557[_0xdf2d('0x78')]);if(_0xeae2ae&&_0xeae2ae[_0xdf2d('0x79')]){logger['info']('['+_0x561c27[_0xdf2d('0x61')][_0xdf2d('0x90')]()+']',_0xdf2d('0x7a'));_0x561c27[_0xdf2d('0x7e')]=_0x47e557[_0xdf2d('0x78')]+_0xdf2d('0x7b')+_0x561c27[_0xdf2d('0x7c')]+_0xdf2d('0x7d')+md5(_0x561c27['uniqueid']);}else{_0x561c27[_0xdf2d('0x7e')]='';}var _0x140b28=_0x47e557['host']===_0xdf2d('0x7f')?'eu':_0xdf2d('0x80');return getAccessToken(_0x47e557)['then'](function(_0x39c168){_0x3b4672=_0x39c168;return getUser(_0x3b4672,_0x140b28,_0x47e557);})['then'](function(_0x1995db){_0x33f5df=_0x1995db;logger[_0xdf2d('0x31')](_0xdf2d('0x81'),_0x33f5df['id']);return getEndUser(_0x3b4672,_0x140b28,_0x47e557,_0x561c27[_0xdf2d('0x91')],_0x561c27[_0xdf2d('0x82')],_0x33f5df,_0x26c802);})[_0xdf2d('0x24')](function(_0x3ed495){_0x2f995b=_0x3ed495;return getCall(_0x3b4672,_0x140b28,_0x47e557,_0x33f5df,_0x2f995b,_0x26c802,_0x561c27,_0xdf2d('0x6e'));})[_0xdf2d('0x24')](function(_0x1887f0){if(_0x1887f0){logger[_0xdf2d('0x31')](_0xdf2d('0x8d'),_0x1887f0['id']);}})[_0xdf2d('0x27')](function(_0x66ee3){logger[_0xdf2d('0x28')]('['+_0x561c27[_0xdf2d('0x61')][_0xdf2d('0x90')]()+']',JSON[_0xdf2d('0x36')](_0x66ee3));});}; \ No newline at end of file +var _0xcb4f=['isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','refresh_token','then','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','Error:\x20','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','moduleCreate','nothing','contact','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Called','complete','connect','Call_Result','Answered','rejected','Abandoned','Timeout','Call_Start_Time','format','agentcalledAt','merge','Fields','/crm/v2/Calls','err','log','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','https://crm.','unmanaged','toUpperCase','request-promise','util','moment','ioredis','bluebird','../../../../config/logger','defaults','localhost','emit','debug','[HTTP]','stringify','length','forEach','string','picklist','type','idField','content','variable','variableName','toString','customVariable','name','Variable','split'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xcb4f,0x1b1));var _0xfcb4=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xcb4f[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var rp=require(_0xfcb4('0x0'));var md5=require('md5');var util=require(_0xfcb4('0x1'));var intUtil=require('./util');var moment=require(_0xfcb4('0x2'));var Redis=require(_0xfcb4('0x3'));var BPromise=require(_0xfcb4('0x4'));var config=require('../../../../config/environment');var logger=require(_0xfcb4('0x5'))('zoho');config['redis']=_[_0xfcb4('0x6')](config['redis'],{'host':_0xfcb4('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x5d9069,_0x565b1c,_0x145a53){io['to'](_0x5d9069)[_0xfcb4('0x8')](_0x565b1c,_0x145a53);}function request(_0x68e07f){logger[_0xfcb4('0x9')](_0xfcb4('0xa'),JSON[_0xfcb4('0xb')](_0x68e07f));return rp(_0x68e07f);}function getCustomFields(_0x1fb27a,_0x58bc41){var _0x48b677={};if(_0x1fb27a[_0xfcb4('0xc')]>0x0){_[_0xfcb4('0xd')](_0x1fb27a,function(_0x18ff02){if(_['includes']([_0xfcb4('0xe'),_0xfcb4('0xf')],_0x18ff02[_0xfcb4('0x10')])&&_0x18ff02[_0xfcb4('0x11')]){_0x48b677[_0x18ff02['idField']]=_0x18ff02[_0xfcb4('0x12')]['toString']();}else if(_0x18ff02[_0xfcb4('0x10')]===_0xfcb4('0x13')&&_0x18ff02[_0xfcb4('0x14')]&&_0x18ff02[_0xfcb4('0x11')]&&_0x58bc41[_0x18ff02[_0xfcb4('0x14')]]){_0x48b677[_0x18ff02['idField']]=_0x58bc41[_0x18ff02['variableName']][_0xfcb4('0x15')]();}else if(_0x18ff02[_0xfcb4('0x10')]===_0xfcb4('0x16')&&_0x18ff02['Variable']&&_0x18ff02['Variable'][_0xfcb4('0x17')]&&_0x18ff02[_0xfcb4('0x11')]&&_0x58bc41[_0x18ff02['Variable'][_0xfcb4('0x17')]['toLowerCase']()]){_0x48b677[_0x18ff02[_0xfcb4('0x11')]]=_0x58bc41[_0x18ff02[_0xfcb4('0x18')][_0xfcb4('0x17')]['toLowerCase']()][_0xfcb4('0x15')]();}});}return _0x48b677;}function getName(_0x572b45){if(_0x572b45['indexOf']('\x20')>0x0){var _0x3867ad=_0x572b45[_0xfcb4('0x19')](/ (.+)/);if(_0x3867ad[0x1]){return _0x3867ad;}}return[_0x572b45,_0x572b45];}var accountsTokens={};function getAccessToken(_0x3f9103){return new Promise(function(_0x5b8ba7,_0x20d54d){if(!_[_0xfcb4('0x1a')](accountsTokens[_0x3f9103['id']])&&!_['isNil'](accountsTokens[_0x3f9103['id']][_0xfcb4('0x1b')])){if(moment()[_0xfcb4('0x1c')](accountsTokens[_0x3f9103['id']]['expires_in'])){_0x5b8ba7(accountsTokens[_0x3f9103['id']][_0xfcb4('0x1b')]);}}var _0x2f0752;switch(_0x3f9103[_0xfcb4('0x1d')]){case'US':_0x2f0752=_0xfcb4('0x1e');break;case'AU':_0x2f0752=_0xfcb4('0x1f');break;case'EU':_0x2f0752=_0xfcb4('0x20');break;case'IN':_0x2f0752=_0xfcb4('0x21');break;case'CN':_0x2f0752=_0xfcb4('0x22');break;default:_0x2f0752=_0xfcb4('0x20');break;}var _0x280662={'method':_0xfcb4('0x23'),'uri':_0x2f0752+_0xfcb4('0x24'),'qs':{'refresh_token':_0x3f9103[_0xfcb4('0x25')],'client_id':_0x3f9103['clientId'],'client_secret':_0x3f9103['clientSecret'],'grant_type':_0xfcb4('0x26')},'json':!![]};return rp(_0x280662)[_0xfcb4('0x27')](function(_0x5f12df){accountsTokens[_0x3f9103['id']]={'access_token':_0x5f12df[_0xfcb4('0x1b')],'expires_in':moment()[_0xfcb4('0x28')](_0x5f12df[_0xfcb4('0x29')],_0xfcb4('0x2a'))};_0x5b8ba7(_0x5f12df[_0xfcb4('0x1b')]);})[_0xfcb4('0x2b')](function(_0x377041){logger[_0xfcb4('0x2c')](_0xfcb4('0x2d'),_0x377041[_0xfcb4('0x2e')]);_0x20d54d(_0x377041);});});}function getUser(_0x5b52e5,_0x124658,_0x41e403,_0x3a060e){logger[_0xfcb4('0x2f')]('Search\x20user');return request({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x124658),'qs':{'type':_0xfcb4('0x30')},'headers':{'Authorization':_0xfcb4('0x31')+_0x5b52e5},'json':!![]})[_0xfcb4('0x27')](function(_0x23c7ea){if(_0x23c7ea[_0xfcb4('0x32')]){var _0x29b162=-0x1;if(_[_0xfcb4('0x33')](_0x23c7ea[_0xfcb4('0x32')])){if(!_[_0xfcb4('0x1a')](_0x3a060e)){_0x29b162=_[_0xfcb4('0x34')](_0x23c7ea[_0xfcb4('0x32')],function(_0x531e94){return _0x531e94[_0xfcb4('0x35')]===_0x3a060e;});}if(_0x29b162>=0x0){logger[_0xfcb4('0x2f')](_0xfcb4('0x36'));}else{logger[_0xfcb4('0x2f')](_0xfcb4('0x37'));_0x29b162=_[_0xfcb4('0x34')](_0x23c7ea[_0xfcb4('0x32')],function(_0x2483b9){return _0x2483b9[_0xfcb4('0x38')]['name']===_0xfcb4('0x39');});}return _0x23c7ea['users'][_0x29b162];}else{if(_0x23c7ea[_0xfcb4('0x3a')][_0xfcb4('0x38')][_0xfcb4('0x17')]==='Administrator'){logger[_0xfcb4('0x2f')]('Using\x20the\x20admin\x20account!');user=_0x23c7ea[_0xfcb4('0x3a')];return user;}else{logger['error'](_0xfcb4('0x3b'),JSON[_0xfcb4('0xb')](_0x23c7ea));throw new Error(_0xfcb4('0x3c')+JSON['stringify'](_0x23c7ea));}}}else{logger[_0xfcb4('0x2c')](_0xfcb4('0x3b'),JSON[_0xfcb4('0xb')](_0x23c7ea));throw new Error(_0xfcb4('0x3c')+JSON[_0xfcb4('0xb')](_0x23c7ea));}})[_0xfcb4('0x2b')](function(_0x45ae41){console[_0xfcb4('0x2c')](_0x45ae41);});}function getZohoUser(_0x277ff0,_0x1a95f1){return new BPromise(function(_0x405c2f,_0x206787){request(_0x277ff0)['then'](function(_0x3c575a){var _0x1b422a=null;if(_0x3c575a){_0x1b422a=_0x3c575a[_0xfcb4('0x3d')][0x0];_0x1b422a[_0xfcb4('0x3e')]=_0x1a95f1;}_0x405c2f(_0x1b422a);})[_0xfcb4('0x2b')](function(_0x492979){_0x206787(_0x492979);});});}function createEndUser(_0x52de53,_0x50b43b,_0x35589e,_0x12c682,_0xf7f29c,_0x311bed){var _0x35589e=getName(_0x35589e);return request({'method':_0xfcb4('0x23'),'uri':'https://www.zohoapis.'+_0x50b43b+_0xfcb4('0x3f')+_[_0xfcb4('0x40')](_0x311bed['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x35589e[0x1],'First_Name':_0x35589e[0x0],'Phone':_0x12c682,'Owner':{'name':!_['isNil'](_0xf7f29c['role']['name'])?_0xf7f29c[_0xfcb4('0x41')]['name']:!_[_0xfcb4('0x1a')](_0xf7f29c[_0xfcb4('0x42')])?_0xf7f29c['first_name']+'\x20'+_0xf7f29c[_0xfcb4('0x43')]:_0xf7f29c[_0xfcb4('0x43')],'id':_0xf7f29c['id']}}]},'headers':{'Authorization':_0xfcb4('0x31')+_0x52de53},'json':!![]})[_0xfcb4('0x27')](function(_0x2a8ff6){if(_0x2a8ff6&&_0x2a8ff6[_0xfcb4('0x3d')][0x0][_0xfcb4('0x44')]===_0xfcb4('0x45')){var _0x3371f8=_0x2a8ff6[_0xfcb4('0x3d')][0x0]['details'];_0x3371f8[_0xfcb4('0x3e')]=_[_0xfcb4('0x40')](_0x311bed['moduleCreate'])+'s';return _0x3371f8;}logger[_0xfcb4('0x2c')](_0xfcb4('0x3b'),JSON[_0xfcb4('0xb')](data));throw new Error(_0xfcb4('0x46')+JSON[_0xfcb4('0xb')](data));})[_0xfcb4('0x2b')](function(_0x1305ed){console['log'](_0xfcb4('0x47'),_0x1305ed);});}function getEndUser(_0x2bc970,_0x46ace5,_0x16c057,_0xeb0288,_0xedd6b1,_0x4493f1,_0x15e041){var _0x59a954={'method':_0xfcb4('0x48'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2bc970},'json':!![]};switch(_0x15e041[_0xfcb4('0x49')]){case _0xfcb4('0x4a'):_0x59a954[_0xfcb4('0x4b')]=_0xfcb4('0x4c')+_0x46ace5+_0xfcb4('0x4d')+_0xedd6b1+'))';return getZohoUser(_0x59a954,_0xfcb4('0x4e'))[_0xfcb4('0x27')](function(_0x537159){if(_0x537159)return _0x537159;_0x59a954[_0xfcb4('0x4b')]=_0xfcb4('0x4c')+_0x46ace5+_0xfcb4('0x4f')+_0xedd6b1+'))';return getZohoUser(_0x59a954,_0xfcb4('0x50'))[_0xfcb4('0x27')](function(_0x266f21){if(_0x266f21)return _0x266f21;if(_0x15e041[_0xfcb4('0x51')]!=_0xfcb4('0x52')){return createEndUser(_0x2bc970,_0x46ace5,_0xeb0288,_0xedd6b1,_0x4493f1,_0x15e041);}else{return{};}});});break;case _0xfcb4('0x53'):_0x59a954['uri']=_0xfcb4('0x4c')+_0x46ace5+_0xfcb4('0x4d')+_0xedd6b1+'))';return getZohoUser(_0x59a954,_0xfcb4('0x4e'))[_0xfcb4('0x27')](function(_0x47e38b){if(_0x47e38b)return _0x47e38b;if(_0x15e041[_0xfcb4('0x51')]!=_0xfcb4('0x52')){return createEndUser(_0x2bc970,_0x46ace5,_0xeb0288,_0xedd6b1,_0x4493f1,_0x15e041);}else{return{};}});break;case'lead':_0x59a954[_0xfcb4('0x4b')]=_0xfcb4('0x4c')+_0x46ace5+_0xfcb4('0x4f')+_0xedd6b1+'))';return getZohoUser(_0x59a954,_0xfcb4('0x50'))[_0xfcb4('0x27')](function(_0x46a98d){if(_0x46a98d)return _0x46a98d;if(_0x15e041['moduleCreate']!=_0xfcb4('0x52')){return createEndUser(_0x2bc970,_0x46ace5,_0xeb0288,_0xedd6b1,_0x4493f1,_0x15e041);}else{return{};}});break;}}function getCall(_0x5405e4,_0x4a5f20,_0x4d9ed3,_0x5b5ef0,_0x53d2d5,_0x3fcbbf,_0x3580e3,_0x97c78a){logger['info'](_0xfcb4('0x54'));var _0x1ee719={};_0x1ee719[_0xfcb4('0x55')]={'name':!_['isNil'](_0x5b5ef0[_0xfcb4('0x41')][_0xfcb4('0x17')])&&!_[_0xfcb4('0x1a')](_0x5b5ef0[_0xfcb4('0x38')][_0xfcb4('0x17')])&&_0x5b5ef0[_0xfcb4('0x38')][_0xfcb4('0x17')]===_0xfcb4('0x56')?_0x5b5ef0['role'][_0xfcb4('0x17')]:!_[_0xfcb4('0x1a')](_0x5b5ef0[_0xfcb4('0x42')])?_0x5b5ef0[_0xfcb4('0x42')]+'\x20'+_0x5b5ef0[_0xfcb4('0x43')]:_0x5b5ef0['last_name'],'id':_0x5b5ef0['id']};_0x1ee719['Subject']=intUtil[_0xfcb4('0x57')](_0x3fcbbf[_0xfcb4('0x58')],_0x3580e3,'\x20');_0x1ee719[_0xfcb4('0x59')]=intUtil[_0xfcb4('0x57')](_0x3fcbbf[_0xfcb4('0x5a')],_0x3580e3,'\x0a');if(_0x53d2d5[_0xfcb4('0x3e')]===_0xfcb4('0x4e')){_0x1ee719[_0xfcb4('0x5b')]={'name':!_['isNil'](_0x53d2d5[_0xfcb4('0x5c')])?_0x53d2d5[_0xfcb4('0x5c')]:!_[_0xfcb4('0x1a')](_0x53d2d5[_0xfcb4('0x5d')])?_0x53d2d5['First_Name']+'\x20'+_0x53d2d5[_0xfcb4('0x5e')]:_0x53d2d5[_0xfcb4('0x5e')],'id':_0x53d2d5['id']};}if(_0x53d2d5[_0xfcb4('0x3e')]===_0xfcb4('0x50')){_0x1ee719[_0xfcb4('0x5f')]={'name':!_[_0xfcb4('0x1a')](_0x53d2d5[_0xfcb4('0x5c')])?_0x53d2d5[_0xfcb4('0x5c')]:!_[_0xfcb4('0x1a')](_0x53d2d5[_0xfcb4('0x5d')])?_0x53d2d5['First_Name']+'\x20'+_0x53d2d5[_0xfcb4('0x5e')]:_0x53d2d5[_0xfcb4('0x5e')],'id':_0x53d2d5['id']};_0x1ee719['$se_module']=_[_0xfcb4('0x40')](_0x53d2d5[_0xfcb4('0x3e')]);}if(_0x3580e3[_0xfcb4('0x60')]){_0x1ee719[_0xfcb4('0x61')]=moment[_0xfcb4('0x62')](parseInt(_0x3580e3[_0xfcb4('0x60')])*0x3e8)['format']('mm:ss');}else if(_0x3580e3[_0xfcb4('0x63')]&&_0x3580e3['endtime']){_0x1ee719[_0xfcb4('0x61')]=moment[_0xfcb4('0x62')](moment(_0x3580e3[_0xfcb4('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0xfcb4('0x65')](moment(_0x3580e3[_0xfcb4('0x66')],_0xfcb4('0x67'))))['format']('mm:ss');}switch(_0x3580e3[_0xfcb4('0x68')]){case _0xfcb4('0x69'):_0x1ee719['Call_Result']=_0xfcb4('0x6a');break;case _0xfcb4('0x6b'):case _0xfcb4('0x6c'):_0x1ee719[_0xfcb4('0x6d')]=_0xfcb4('0x6e');break;case _0xfcb4('0x6f'):_0x1ee719[_0xfcb4('0x6d')]='Rejected';break;case'abandoned':_0x1ee719[_0xfcb4('0x6d')]=_0xfcb4('0x70');break;case'timeout':_0x1ee719[_0xfcb4('0x6d')]=_0xfcb4('0x71');default:}_0x1ee719[_0xfcb4('0x72')]=(_0x97c78a==='outbound'?moment(_0x3580e3[_0xfcb4('0x66')])[_0xfcb4('0x73')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x3580e3[_0xfcb4('0x74')])[_0xfcb4('0x73')](_0xfcb4('0x67')))||moment()[_0xfcb4('0x73')](_0xfcb4('0x67'));_0x1ee719['Call_Type']=_0x97c78a||'Inbound';_0x1ee719=_[_0xfcb4('0x75')](_0x1ee719,getCustomFields(_0x3fcbbf[_0xfcb4('0x76')],_0x3580e3));return request({'method':_0xfcb4('0x23'),'uri':_0xfcb4('0x4c')+_0x4a5f20+_0xfcb4('0x77'),'headers':{'Authorization':_0xfcb4('0x31')+_0x5405e4},'body':{'data':[_0x1ee719]},'json':!![]})['then'](function(_0x1cb8f6){if(_0x1cb8f6&&_0x1cb8f6['data'][0x0]['code']===_0xfcb4('0x45')){logger[_0xfcb4('0x2f')]('Call\x20created!');return{'id':_0x1cb8f6['data'][0x0]['details']['id']};}})[_0xfcb4('0x2b')](function(_0x4201e1){logger[_0xfcb4('0x2f')](_0xfcb4('0x78'),_0x4201e1[_0xfcb4('0x2e')]);console[_0xfcb4('0x79')](_0xfcb4('0x78'),_0x4201e1);});}exports['queue']=function(_0x1bb80e,_0x1d54ff,_0x4e862e,_0x106408,_0x18b189,_0x5b02c1){var _0x2b8edf,_0x2d893b,_0xd15851;_0x5b02c1['host']=intUtil[_0xfcb4('0x7a')](_0x5b02c1[_0xfcb4('0x7b')]);_0x5b02c1['serverUrl']=intUtil['stripTrailingSlash'](_0x5b02c1[_0xfcb4('0x7c')]);if(_0x18b189&&_0x18b189[_0xfcb4('0x7d')]){logger[_0xfcb4('0x2f')](_0xfcb4('0x7e'),_0xfcb4('0x7f'));_0x1d54ff['recordingURL']=_0x5b02c1[_0xfcb4('0x7c')]+_0xfcb4('0x80')+_0x1d54ff[_0xfcb4('0x81')]+_0xfcb4('0x82')+md5(_0x1d54ff[_0xfcb4('0x81')]);}else{_0x1d54ff[_0xfcb4('0x83')]='';}var _0x727f52=_0x5b02c1[_0xfcb4('0x7b')]===_0xfcb4('0x84')?'eu':_0xfcb4('0x85');return getAccessToken(_0x5b02c1)[_0xfcb4('0x27')](function(_0xfe6c33){_0xd15851=_0xfe6c33;return getUser(_0xd15851,_0x727f52,_0x5b02c1,_0x106408[_0xfcb4('0x35')]);})[_0xfcb4('0x27')](function(_0x3d6a7){_0x2b8edf=_0x3d6a7;logger[_0xfcb4('0x2f')](_0xfcb4('0x86'),_0x2b8edf['id']);return getEndUser(_0xd15851,_0x727f52,_0x5b02c1,_0x1d54ff[_0xfcb4('0x87')],_0x1d54ff[_0xfcb4('0x88')],_0x2b8edf,_0x4e862e);})['then'](function(_0x38a163){_0x2d893b=_0x38a163;return getCall(_0xd15851,_0x727f52,_0x5b02c1,_0x2b8edf,_0x2d893b,_0x4e862e,_0x1d54ff,_0xfcb4('0x89'));})[_0xfcb4('0x27')](function(_0x2d67a7){if(_0x2d67a7){logger[_0xfcb4('0x2f')](_0xfcb4('0x8a'),_0x2d67a7['id']);logger[_0xfcb4('0x2f')](_0xfcb4('0x7e'),_0xfcb4('0x8b'));emit(util[_0xfcb4('0x73')](_0xfcb4('0x8c'),_0x106408[_0xfcb4('0x17')]),_0xfcb4('0x8d'),{'uri':'https://crm.'+_0x5b02c1['host']+_0xfcb4('0x8e')+_0x2d67a7['id']});}})[_0xfcb4('0x2b')](function(_0x2b2b01){logger['error']('[QUEUE]',JSON[_0xfcb4('0xb')](_0x2b2b01));});};exports[_0xfcb4('0x8f')]=function(_0xff6031,_0x33fe76,_0x1cc896,_0x31a77a,_0x4015ff,_0x3efc76,_0x2de64e){var _0x4a573b,_0x8282c9,_0x11e03e;_0x3efc76['host']=intUtil[_0xfcb4('0x7a')](_0x3efc76['host']);_0x3efc76[_0xfcb4('0x7c')]=intUtil[_0xfcb4('0x7a')](_0x3efc76[_0xfcb4('0x7c')]);if(_0x2de64e&&_0x2de64e['recordingFormat']&&_0x2de64e[_0xfcb4('0x90')]!==_0xfcb4('0x91')){logger['info'](_0xfcb4('0x92'),_0xfcb4('0x7f'));_0x33fe76[_0xfcb4('0x83')]=_0x3efc76[_0xfcb4('0x7c')]+_0xfcb4('0x80')+_0x33fe76['uniqueid']+_0xfcb4('0x82')+md5(_0x33fe76[_0xfcb4('0x81')]);}var _0x6d031c=_0x3efc76[_0xfcb4('0x7b')]===_0xfcb4('0x84')?'eu':'com';return getAccessToken(_0x3efc76)[_0xfcb4('0x27')](function(_0x9d7731){_0x11e03e=_0x9d7731;return getUser(_0x11e03e,_0x6d031c,_0x3efc76,_0x31a77a[_0xfcb4('0x35')]);})['then'](function(_0x445fe9){_0x4a573b=_0x445fe9;logger['info'](_0xfcb4('0x86'),_0x4a573b['id']);return getEndUser(_0x11e03e,_0x6d031c,_0x3efc76,_0x33fe76[_0xfcb4('0x93')],_0x33fe76[_0xfcb4('0x94')],_0x4a573b,_0x1cc896);})[_0xfcb4('0x27')](function(_0x564a20){_0x8282c9=_0x564a20;return getCall(_0x11e03e,_0x6d031c,_0x3efc76,_0x4a573b,_0x8282c9,_0x1cc896,_0x33fe76,_0xfcb4('0x95'));})[_0xfcb4('0x27')](function(_0x3ae89b){if(_0x3ae89b){logger[_0xfcb4('0x2f')](_0xfcb4('0x8a'),_0x3ae89b['id']);logger['info'](_0xfcb4('0x92'),_0xfcb4('0x8b'));emit(util[_0xfcb4('0x73')](_0xfcb4('0x8c'),_0x31a77a[_0xfcb4('0x17')]),_0xfcb4('0x8d'),{'uri':_0xfcb4('0x96')+_0x3efc76[_0xfcb4('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x3ae89b['id']});}})[_0xfcb4('0x2b')](function(_0x2fb576){logger[_0xfcb4('0x2c')](_0xfcb4('0x92'),JSON[_0xfcb4('0xb')](_0x2fb576));});};exports[_0xfcb4('0x97')]=function(_0x980ccf,_0x401950,_0x5266b9,_0x634784,_0xae865d,_0xad37){var _0xce01b8,_0x1bf82d,_0x59095d;_0xad37['host']=intUtil[_0xfcb4('0x7a')](_0xad37[_0xfcb4('0x7b')]);_0xad37[_0xfcb4('0x7c')]=intUtil[_0xfcb4('0x7a')](_0xad37['serverUrl']);if(_0xae865d&&_0xae865d[_0xfcb4('0x7d')]){logger[_0xfcb4('0x2f')]('['+_0x401950[_0xfcb4('0x68')][_0xfcb4('0x98')]()+']',_0xfcb4('0x7f'));_0x401950['recordingURL']=_0xad37['serverUrl']+_0xfcb4('0x80')+_0x401950[_0xfcb4('0x81')]+_0xfcb4('0x82')+md5(_0x401950[_0xfcb4('0x81')]);}else{_0x401950['recordingURL']='';}var _0x5ee5d8=_0xad37[_0xfcb4('0x7b')]===_0xfcb4('0x84')?'eu':_0xfcb4('0x85');return getAccessToken(_0xad37)[_0xfcb4('0x27')](function(_0x54bd0e){_0x59095d=_0x54bd0e;return getUser(_0x59095d,_0x5ee5d8,_0xad37);})[_0xfcb4('0x27')](function(_0x2cb813){_0xce01b8=_0x2cb813;logger[_0xfcb4('0x2f')](_0xfcb4('0x86'),_0xce01b8['id']);return getEndUser(_0x59095d,_0x5ee5d8,_0xad37,_0x401950[_0xfcb4('0x87')],_0x401950[_0xfcb4('0x88')],_0xce01b8,_0x5266b9);})[_0xfcb4('0x27')](function(_0xf97078){_0x1bf82d=_0xf97078;return getCall(_0x59095d,_0x5ee5d8,_0xad37,_0xce01b8,_0x1bf82d,_0x5266b9,_0x401950,'Inbound');})[_0xfcb4('0x27')](function(_0x19731a){if(_0x19731a){logger[_0xfcb4('0x2f')]('The\x20Call\x20ID\x20is:',_0x19731a['id']);}})['catch'](function(_0xe3d092){logger[_0xfcb4('0x2c')]('['+_0x401950[_0xfcb4('0x68')][_0xfcb4('0x98')]()+']',JSON[_0xfcb4('0xb')](_0xe3d092));});}; \ 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 c7cc804..a75f5e7 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 _0x1a1a=['render','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','trigger','exec','data2','Script','data3'];(function(_0x192998,_0x35f3b3){var _0xa416cb=function(_0x1ea4d2){while(--_0x1ea4d2){_0x192998['push'](_0x192998['shift']());}};_0xa416cb(++_0x35f3b3);}(_0x1a1a,0x10d));var _0xa1a1=function(_0x17e619,_0x324776){_0x17e619=_0x17e619-0x0;var _0x46aac5=_0x1a1a[_0x17e619];return _0x46aac5;};'use strict';var util=require(_0xa1a1('0x0'));var sh=require(_0xa1a1('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0xa1a1('0x2'));exports[_0xa1a1('0x3')]=function(_0x19120c,_0x26fb46){var _0x37723d=_0x19120c[_0xa1a1('0x4')]?_0x19120c[_0xa1a1('0x4')]:_0xa1a1('0x5');var _0x434ca6=_0x19120c[_0xa1a1('0x6')]?Mustache[_0xa1a1('0x7')](_0x19120c['data3'],_0x26fb46):_0x26fb46;sh[_0xa1a1('0x3')](_0x434ca6,function(_0x132543,_0x4bfd84,_0x567a3d){if(_0x132543!==0x0){logger[_0xa1a1('0x8')](util[_0xa1a1('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x37723d,_0x434ca6,_0x132543,_0x567a3d));}else{logger[_0xa1a1('0xa')](util['format'](_0xa1a1('0xb'),_0x37723d,_0x434ca6,_0x4bfd84));}});}; \ No newline at end of file +var _0xd701=['error','format','%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','mustache','../../../../config/logger','trigger','exec','Script','data3','render'];(function(_0x50d000,_0x490905){var _0x14bc7e=function(_0x60dcbc){while(--_0x60dcbc){_0x50d000['push'](_0x50d000['shift']());}};_0x14bc7e(++_0x490905);}(_0xd701,0x1c5));var _0x1d70=function(_0x2dd6b1,_0x4485d7){_0x2dd6b1=_0x2dd6b1-0x0;var _0x494306=_0xd701[_0x2dd6b1];return _0x494306;};'use strict';var util=require(_0x1d70('0x0'));var sh=require(_0x1d70('0x1'));var Mustache=require(_0x1d70('0x2'));var logger=require(_0x1d70('0x3'))(_0x1d70('0x4'));exports[_0x1d70('0x5')]=function(_0x300538,_0x21ea1e){var _0x3b74f1=_0x300538['data2']?_0x300538['data2']:_0x1d70('0x6');var _0x4c1889=_0x300538[_0x1d70('0x7')]?Mustache[_0x1d70('0x8')](_0x300538[_0x1d70('0x7')],_0x21ea1e):_0x21ea1e;sh['exec'](_0x4c1889,function(_0x7f15ff,_0x453c5d,_0x2dcdfe){if(_0x7f15ff!==0x0){logger[_0x1d70('0x9')](util[_0x1d70('0xa')](_0x1d70('0xb'),_0x3b74f1,_0x4c1889,_0x7f15ff,_0x2dcdfe));}else{logger[_0x1d70('0xc')](util['format'](_0x1d70('0xd'),_0x3b74f1,_0x4c1889,_0x453c5d));}});}; \ 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 c1fe998..94ff82b 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 _0xf082=['body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','format','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','message','request-promise','lodash','mustache','../../../../config/logger','trigger','data1','toUpperCase','render','data5','number','headers','data6','parse','error','stack','GET','DELETE','PUT','body'];(function(_0x2a2bce,_0x4b2ab3){var _0x36f441=function(_0x5c4b36){while(--_0x5c4b36){_0x2a2bce['push'](_0x2a2bce['shift']());}};_0x36f441(++_0x4b2ab3);}(_0xf082,0x116));var _0x2f08=function(_0xcb1e7b,_0x50db53){_0xcb1e7b=_0xcb1e7b-0x0;var _0xda56f4=_0xf082[_0xcb1e7b];return _0xda56f4;};'use strict';var rp=require(_0x2f08('0x0'));var util=require('util');var _=require(_0x2f08('0x1'));var Mustache=require(_0x2f08('0x2'));var logger=require(_0x2f08('0x3'))(_0x2f08('0x4'));exports['exec']=function(_0x1a9447,_0x10970e){var _0xbff2b2,_0x5504a3;var _0x3912e4={'method':_0x1a9447[_0x2f08('0x5')][_0x2f08('0x6')](),'uri':Mustache[_0x2f08('0x7')](_0x1a9447['data2'],_0x10970e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1a9447[_0x2f08('0x8')])===_0x2f08('0x9')&&parseInt(_0x1a9447[_0x2f08('0x8')])>=0x1&&parseInt(_0x1a9447[_0x2f08('0x8')])<=0xa?parseInt(_0x1a9447['data5'])*0x3e8:0x5*0x3e8};try{_0x3912e4[_0x2f08('0xa')]=_0x1a9447[_0x2f08('0xb')]?JSON[_0x2f08('0xc')](Mustache[_0x2f08('0x7')](_0x1a9447[_0x2f08('0xb')],_0x10970e)):{};}catch(_0x18710b){logger[_0x2f08('0xd')](_0x18710b[_0x2f08('0xe')]);}switch(_0x1a9447['data1'][_0x2f08('0x6')]()){case _0x2f08('0xf'):case _0x2f08('0x10'):_0xbff2b2=null;_0x3912e4['qs']=_0x10970e;break;case'POST':case _0x2f08('0x11'):if(_0x1a9447['data7']){try{_0xbff2b2=JSON['parse'](Mustache['render'](_0x1a9447['data7'],_0x10970e));_0x3912e4[_0x2f08('0x12')]=_0xbff2b2;}catch(_0x807ba){logger[_0x2f08('0xd')](_0x807ba[_0x2f08('0xe')]);logger['error'](_0x2f08('0x13'));}}else{_0xbff2b2=_0x10970e;_0x3912e4[_0x2f08('0x12')]=_0xbff2b2;}break;}logger[_0x2f08('0x14')](util['format'](_0x2f08('0x15'),_0x1a9447[_0x2f08('0x5')],_0x1a9447[_0x2f08('0x16')],JSON[_0x2f08('0x17')](_0x3912e4)));rp(_0x3912e4)['then'](function(_0x36767a){_0xbff2b2=!_[_0x2f08('0x18')](_0xbff2b2)?_0x2f08('0x19')+_0xbff2b2:'';_0x5504a3=typeof _0x36767a[_0x2f08('0x12')]===_0x2f08('0x1a')?JSON[_0x2f08('0x17')](_0x36767a[_0x2f08('0x12')]):_0x36767a['body'];logger[_0x2f08('0x14')](util['format'](_0x2f08('0x1b'),_0x1a9447[_0x2f08('0x5')],_0x1a9447[_0x2f08('0x16')],_0x36767a['statusCode'],_0x5504a3));})[_0x2f08('0x1c')](function(_0x5d523b){logger['error'](util[_0x2f08('0x1d')](_0x2f08('0x1e'),_0x1a9447['data1'],_0x1a9447[_0x2f08('0x16')],_0x5d523b[_0x2f08('0x1f')],_0x5d523b['name'],_0x5d523b[_0x2f08('0x20')]));});}; \ No newline at end of file +var _0xbd46=['%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','exec','toUpperCase','render','data2','data5','number','parse','data6','error','stack','data1','GET','DELETE','POST','PUT','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','stringify','then','isNil',',\x20request\x20body:\x20','object'];(function(_0x440fde,_0x445ce0){var _0x11052c=function(_0x49f547){while(--_0x49f547){_0x440fde['push'](_0x440fde['shift']());}};_0x11052c(++_0x445ce0);}(_0xbd46,0x1bf));var _0x6bd4=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0xbd46[_0x466bc5];return _0x138952;};'use strict';var rp=require(_0x6bd4('0x0'));var util=require(_0x6bd4('0x1'));var _=require(_0x6bd4('0x2'));var Mustache=require(_0x6bd4('0x3'));var logger=require('../../../../config/logger')('trigger');exports[_0x6bd4('0x4')]=function(_0x1d175b,_0x1c7e77){var _0x536b59,_0x2c8dd6;var _0x2bd082={'method':_0x1d175b['data1'][_0x6bd4('0x5')](),'uri':Mustache[_0x6bd4('0x6')](_0x1d175b[_0x6bd4('0x7')],_0x1c7e77),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1d175b[_0x6bd4('0x8')])===_0x6bd4('0x9')&&parseInt(_0x1d175b[_0x6bd4('0x8')])>=0x1&&parseInt(_0x1d175b[_0x6bd4('0x8')])<=0xa?parseInt(_0x1d175b['data5'])*0x3e8:0x5*0x3e8};try{_0x2bd082['headers']=_0x1d175b['data6']?JSON[_0x6bd4('0xa')](Mustache[_0x6bd4('0x6')](_0x1d175b[_0x6bd4('0xb')],_0x1c7e77)):{};}catch(_0x37eb23){logger[_0x6bd4('0xc')](_0x37eb23[_0x6bd4('0xd')]);}switch(_0x1d175b[_0x6bd4('0xe')][_0x6bd4('0x5')]()){case _0x6bd4('0xf'):case _0x6bd4('0x10'):_0x536b59=null;_0x2bd082['qs']=_0x1c7e77;break;case _0x6bd4('0x11'):case _0x6bd4('0x12'):if(_0x1d175b[_0x6bd4('0x13')]){try{_0x536b59=JSON['parse'](Mustache[_0x6bd4('0x6')](_0x1d175b['data7'],_0x1c7e77));_0x2bd082['body']=_0x536b59;}catch(_0xd88769){logger['error'](_0xd88769[_0x6bd4('0xd')]);logger[_0x6bd4('0xc')](_0x6bd4('0x14'));}}else{_0x536b59=_0x1c7e77;_0x2bd082[_0x6bd4('0x15')]=_0x536b59;}break;}logger[_0x6bd4('0x16')](util[_0x6bd4('0x17')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x1d175b['data1'],_0x1d175b[_0x6bd4('0x7')],JSON[_0x6bd4('0x18')](_0x2bd082)));rp(_0x2bd082)[_0x6bd4('0x19')](function(_0x56b29f){_0x536b59=!_[_0x6bd4('0x1a')](_0x536b59)?_0x6bd4('0x1b')+_0x536b59:'';_0x2c8dd6=typeof _0x56b29f[_0x6bd4('0x15')]===_0x6bd4('0x1c')?JSON[_0x6bd4('0x18')](_0x56b29f['body']):_0x56b29f['body'];logger[_0x6bd4('0x16')](util[_0x6bd4('0x17')](_0x6bd4('0x1d'),_0x1d175b[_0x6bd4('0xe')],_0x1d175b[_0x6bd4('0x7')],_0x56b29f[_0x6bd4('0x1e')],_0x2c8dd6));})['catch'](function(_0x151cdc){logger[_0x6bd4('0xc')](util['format'](_0x6bd4('0x1f'),_0x1d175b[_0x6bd4('0xe')],_0x1d175b['data2'],_0x151cdc[_0x6bd4('0x1e')],_0x151cdc[_0x6bd4('0x20')],_0x151cdc[_0x6bd4('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 1c426d8..677941c 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 _0x5871=['then','rpc','error','message','result','catch','jayson/promise','bluebird','routing','client','Request'];(function(_0x471eb0,_0x1f54c8){var _0x2d9f31=function(_0x3ea4cb){while(--_0x3ea4cb){_0x471eb0['push'](_0x471eb0['shift']());}};_0x2d9f31(++_0x1f54c8);}(_0x5871,0x1c9));var _0x1587=function(_0x308606,_0x7a195f){_0x308606=_0x308606-0x0;var _0x2567ea=_0x5871[_0x308606];return _0x2567ea;};'use strict';var jayson=require(_0x1587('0x0'));var BPromise=require(_0x1587('0x1'));var logger=require('../../config/logger')(_0x1587('0x2'));var client=jayson[_0x1587('0x3')]['http']({'port':0x2329});client[_0x1587('0x4')]=function(_0x48b0b0,_0x151587){return new BPromise(function(_0x18d360,_0x2873ed){return client['request'](_0x48b0b0,_0x151587)[_0x1587('0x5')](function(_0x8be030){logger['debug'](_0x1587('0x6'),_0x1587('0x2'),_0x48b0b0,_0x151587,_0x8be030);if(_0x8be030[_0x1587('0x7')]){logger[_0x1587('0x7')](_0x1587('0x6'),'routing',_0x48b0b0,_0x8be030[_0x1587('0x7')][_0x1587('0x8')],_0x151587);return _0x2873ed(_0x8be030[_0x1587('0x7')][_0x1587('0x8')]);}else{return _0x18d360(_0x8be030[_0x1587('0x9')]);}})[_0x1587('0xa')](function(_0x33fc4d){logger['error'](_0x1587('0x6'),_0x1587('0x2'),_0x48b0b0,_0x33fc4d,_0x151587);return _0x2873ed(_0x33fc4d);});});};module['exports']=client; \ No newline at end of file +var _0xcf05=['result','catch','exports','jayson/promise','../../config/logger','routing','http','Request','request','then','debug','rpc','error','message'];(function(_0x50775b,_0x2fba5f){var _0x755f5d=function(_0x308d04){while(--_0x308d04){_0x50775b['push'](_0x50775b['shift']());}};_0x755f5d(++_0x2fba5f);}(_0xcf05,0x10d));var _0x5cf0=function(_0x3d5445,_0x48118a){_0x3d5445=_0x3d5445-0x0;var _0x323627=_0xcf05[_0x3d5445];return _0x323627;};'use strict';var jayson=require(_0x5cf0('0x0'));var BPromise=require('bluebird');var logger=require(_0x5cf0('0x1'))(_0x5cf0('0x2'));var client=jayson['client'][_0x5cf0('0x3')]({'port':0x2329});client[_0x5cf0('0x4')]=function(_0x329ee5,_0x4b71be){return new BPromise(function(_0x1d2ee9,_0x55edca){return client[_0x5cf0('0x5')](_0x329ee5,_0x4b71be)[_0x5cf0('0x6')](function(_0x15c8ef){logger[_0x5cf0('0x7')](_0x5cf0('0x8'),_0x5cf0('0x2'),_0x329ee5,_0x4b71be,_0x15c8ef);if(_0x15c8ef[_0x5cf0('0x9')]){logger[_0x5cf0('0x9')](_0x5cf0('0x8'),'routing',_0x329ee5,_0x15c8ef[_0x5cf0('0x9')][_0x5cf0('0xa')],_0x4b71be);return _0x55edca(_0x15c8ef[_0x5cf0('0x9')]['message']);}else{return _0x1d2ee9(_0x15c8ef[_0x5cf0('0xb')]);}})[_0x5cf0('0xc')](function(_0x245861){logger[_0x5cf0('0x9')](_0x5cf0('0x8'),_0x5cf0('0x2'),_0x329ee5,_0x245861,_0x4b71be);return _0x55edca(_0x245861);});});};module[_0x5cf0('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 15c5427..8909f6e 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 _0x3cdd=['./server','./realtime','./lib/email','resolve','then','getMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','catch','log','bluebird'];(function(_0x3552f1,_0x506863){var _0xc14ea2=function(_0x5cac5c){while(--_0x5cac5c){_0x3552f1['push'](_0x3552f1['shift']());}};_0xc14ea2(++_0x506863);}(_0x3cdd,0xb5));var _0xd3cd=function(_0x2e0651,_0x83c41d){_0x2e0651=_0x2e0651-0x0;var _0x49f70a=_0x3cdd[_0x2e0651];return _0x49f70a;};'use strict';var BPromise=require(_0xd3cd('0x0'));var server=require(_0xd3cd('0x1'));var Realtime=require(_0xd3cd('0x2'));var EmailChannel=require(_0xd3cd('0x3'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xd3cd('0x4')]()[_0xd3cd('0x5')](mailAccount[_0xd3cd('0x6')]())[_0xd3cd('0x5')](realtime['initMailAccounts']())['then'](function(){email[_0xd3cd('0x7')](realtime[_0xd3cd('0x8')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xd3cd('0x5')](function(){return initRealtime();})[_0xd3cd('0x5')](function(){return setting[_0xd3cd('0x9')]();})[_0xd3cd('0x5')](function(_0x2a9791){return setInterval(initRealtime,_0x2a9791[_0xd3cd('0xa')]*0x3e8);})[_0xd3cd('0xb')](function(_0x40f06c){console[_0xd3cd('0xc')](_0x40f06c);});}main(); \ No newline at end of file +var _0xcbd5=['./realtime','./rpc/mailAccount','./rpc/setting','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','catch','log','bluebird','./server'];(function(_0x228acb,_0x3d4196){var _0x294939=function(_0x2673fc){while(--_0x2673fc){_0x228acb['push'](_0x228acb['shift']());}};_0x294939(++_0x3d4196);}(_0xcbd5,0x1c0));var _0x5cbd=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0xcbd5[_0x46efd7];return _0x5637e4;};'use strict';var BPromise=require(_0x5cbd('0x0'));var server=require(_0x5cbd('0x1'));var Realtime=require(_0x5cbd('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x5cbd('0x3'));var setting=require(_0x5cbd('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x5cbd('0x5')]()[_0x5cbd('0x6')](mailAccount[_0x5cbd('0x7')]())['then'](realtime[_0x5cbd('0x8')]())[_0x5cbd('0x6')](function(){email['refresh'](realtime[_0x5cbd('0x9')]);return realtime;});}function main(){return server[_0x5cbd('0xa')](realtime,email)[_0x5cbd('0x6')](function(){return initRealtime();})[_0x5cbd('0x6')](function(){return setting[_0x5cbd('0xb')]();})[_0x5cbd('0x6')](function(_0x657a33){return setInterval(initRealtime,_0x657a33[_0x5cbd('0xc')]*0x3e8);})[_0x5cbd('0xd')](function(_0x4bee1c){console[_0x5cbd('0xe')](_0x4bee1c);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 58c300d..40290aa 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 _0x97f3=['send','Smtp','verified','catch','verify','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','emit','key','active','Imap','messageStatus','total','isNil','mailAccount:update','prototype','refresh','hasOwnProperty','box','bind','imapAccounts','handleImapEmail','end','error','handleImapError','status','disabled','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','lastSync','sendMail'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x97f3,0xdd));var _0x397f=function(_0x29a9ce,_0x105a34){_0x29a9ce=_0x29a9ce-0x0;var _0x1ef1e8=_0x97f3[_0x29a9ce];return _0x1ef1e8;};'use strict';var _=require('lodash');var moment=require(_0x397f('0x0'));var BPromise=require(_0x397f('0x1'));var md5=require(_0x397f('0x2'));var Redis=require(_0x397f('0x3'));var config=require(_0x397f('0x4'));var logger=require('../../../config/logger')(_0x397f('0x5'));config[_0x397f('0x6')]=_['defaults'](config[_0x397f('0x6')],{'host':_0x397f('0x7'),'port':0x18eb});var io=require(_0x397f('0x8'))(new Redis(config[_0x397f('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x397f('0x9'));var mailAccount=require(_0x397f('0xa'));var md5Accounts={};function EmailChannel(_0x1de519){logger[_0x397f('0xb')](_0x397f('0xc'));this[_0x397f('0xd')]=_0x1de519[_0x397f('0xd')];this['imapAccounts']={};this[_0x397f('0xe')]=new EmailSmtp();}EmailChannel['prototype'][_0x397f('0xf')]=function(_0x56687f){var _0x48eca4=this[_0x397f('0xd')][_0x56687f];var _0xe1864d={'id':_0x48eca4['id'],'name':_0x48eca4['name'],'key':_0x48eca4[_0x397f('0x10')],'active':_0x48eca4[_0x397f('0x11')],'Imap':{'status':_0x48eca4[_0x397f('0x12')]['status'],'messageStatus':_0x48eca4[_0x397f('0x12')][_0x397f('0x13')],'total':_0x48eca4[_0x397f('0x12')][_0x397f('0x14')]}};if(_[_0x397f('0x15')](md5Accounts[_0x56687f])){md5Accounts[_0x56687f]={};}var _0x2128b0=md5(JSON['stringify'](_0xe1864d));if(md5Accounts[_0x56687f][_0x397f('0x2')]!==_0x2128b0){md5Accounts[_0x56687f][_0x397f('0x2')]=_0x2128b0;io[_0x397f('0xf')](_0x397f('0x16'),_0xe1864d);}};EmailChannel[_0x397f('0x17')][_0x397f('0x18')]=function(_0x7998dd){for(var _0x195f3d in _0x7998dd){if(_0x7998dd[_0x397f('0x19')](_0x195f3d)){if(_0x7998dd[_0x195f3d][_0x397f('0x12')]&&_0x7998dd[_0x195f3d]['active']){var _0x3dcd05=_0x7998dd[_0x195f3d][_0x397f('0x12')];if(!this['imapAccounts'][_0x397f('0x19')](_0x3dcd05['id'])){this['imapAccounts'][_0x3dcd05['id']]=new EmailImap(_0x3dcd05,_0x7998dd[_0x195f3d]['email']);this['imapAccounts'][_0x3dcd05['id']]['on'](_0x397f('0x1a'),this['handleImapBox'][_0x397f('0x1b')](this,_0x195f3d));this[_0x397f('0x1c')][_0x3dcd05['id']]['on']('email',this[_0x397f('0x1d')][_0x397f('0x1b')](this,_0x195f3d));this[_0x397f('0x1c')][_0x3dcd05['id']]['on'](_0x397f('0x1e'),this['handleImapEnd'][_0x397f('0x1b')](this,_0x195f3d));this[_0x397f('0x1c')][_0x3dcd05['id']]['on'](_0x397f('0x1f'),this[_0x397f('0x20')][_0x397f('0x1b')](this,_0x195f3d));}}else{if(_['isNil'](this[_0x397f('0xd')][_0x195f3d]['Imap'])){this[_0x397f('0xd')][_0x195f3d][_0x397f('0x12')]={};}this[_0x397f('0xd')][_0x195f3d][_0x397f('0x12')][_0x397f('0x21')]=_0x397f('0x22');this[_0x397f('0xd')][_0x195f3d][_0x397f('0x12')][_0x397f('0x13')]='';this[_0x397f('0xf')](_0x195f3d);}}}};EmailChannel[_0x397f('0x17')][_0x397f('0x23')]=function(_0x423cfe,_0x489e1d){if(this['mailAccounts'][_0x423cfe]){this[_0x397f('0xd')][_0x423cfe][_0x397f('0x12')][_0x397f('0x21')]=_0x397f('0x24');this[_0x397f('0xd')][_0x423cfe][_0x397f('0x12')][_0x397f('0x13')]=_0x489e1d['name'];if(_0x489e1d[_0x397f('0x25')]){this[_0x397f('0xd')][_0x423cfe][_0x397f('0x12')][_0x397f('0x14')]=_0x489e1d[_0x397f('0x25')][_0x397f('0x14')];}return this[_0x397f('0xf')](_0x423cfe);}};EmailChannel[_0x397f('0x17')][_0x397f('0x1d')]=function(_0x3856b9,_0x23342a){logger[_0x397f('0xb')](_0x397f('0x26'),_0x23342a['firstName'],_0x23342a[_0x397f('0x27')],_0x23342a[_0x397f('0x28')],_0x3856b9);if(this['mailAccounts'][_0x3856b9]){return mailAccount[_0x397f('0x29')](_0x3856b9,_0x23342a)[_0x397f('0x2a')](function(_0x5eeb8a){if(_0x5eeb8a){logger[_0x397f('0xb')](_0x397f('0x2b'));}})['catch'](function(_0x594a3e){logger[_0x397f('0x1f')](_0x397f('0x2c'),JSON[_0x397f('0x2d')](_0x594a3e));});}};EmailChannel['prototype'][_0x397f('0x2e')]=function(_0x3a9306){if(this[_0x397f('0xd')][_0x3a9306]&&this[_0x397f('0xd')][_0x3a9306][_0x397f('0x12')]){if(this['imapAccounts'][this[_0x397f('0xd')][_0x3a9306][_0x397f('0x12')]['id']]){delete this[_0x397f('0x1c')][this[_0x397f('0xd')][_0x3a9306][_0x397f('0x12')]['id']];}this[_0x397f('0xd')][_0x3a9306][_0x397f('0x12')][_0x397f('0x2f')]=moment();this[_0x397f('0xf')](_0x3a9306);}};EmailChannel[_0x397f('0x17')][_0x397f('0x20')]=function(_0x58355c,_0x5588ef){if(this['mailAccounts'][_0x58355c]){this[_0x397f('0xd')][_0x58355c]['Imap'][_0x397f('0x21')]=_0x397f('0x1f');this[_0x397f('0xd')][_0x58355c]['Imap'][_0x397f('0x13')]=_0x5588ef;return this[_0x397f('0xf')](_0x58355c);}};EmailChannel[_0x397f('0x17')][_0x397f('0x30')]=function(_0x2751e7,_0x4b184d){return this['smtp'][_0x397f('0x31')](_0x2751e7,_0x4b184d);};EmailChannel['prototype']['verifySmtp']=function(_0x8904a7){var _0x2b3d71=this;if(this['mailAccounts'][_0x8904a7['id']]){if(_[_0x397f('0x15')](this[_0x397f('0xd')][_0x8904a7['id']][_0x397f('0x32')])){this['mailAccounts'][_0x8904a7['id']][_0x397f('0x32')]={};}this[_0x397f('0xd')][_0x8904a7['id']][_0x397f('0x32')][_0x397f('0x2f')]=moment();return new BPromise(function(_0x151dd0,_0x12f147){return _0x2b3d71['smtp']['verify'](_0x8904a7)[_0x397f('0x2a')](function(_0x5cc9df){_0x2b3d71[_0x397f('0xd')][_0x8904a7['id']]['Smtp'][_0x397f('0x21')]=_0x397f('0x33');_0x2b3d71[_0x397f('0xd')][_0x8904a7['id']]['Smtp']['messageStatus']='';_0x2b3d71[_0x397f('0xf')](_0x8904a7['id']);_0x151dd0(_0x5cc9df);})[_0x397f('0x34')](function(_0x142383){_0x2b3d71[_0x397f('0xd')][_0x8904a7['id']][_0x397f('0x32')][_0x397f('0x21')]=_0x397f('0x1f');_0x2b3d71[_0x397f('0xd')][_0x8904a7['id']]['Smtp'][_0x397f('0x13')]=_0x142383;_0x2b3d71[_0x397f('0xf')](_0x8904a7['id']);_0x12f147(_0x142383);});});}return this[_0x397f('0xe')][_0x397f('0x35')](_0x8904a7);};module['exports']=EmailChannel; \ No newline at end of file +var _0x152c=['../rpc/mailAccount','info','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','total','isNil','stringify','md5','refresh','hasOwnProperty','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','mailAccounts','disabled','messageStatus','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','verify','verified','catch','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x152c,0x1f4));var _0xc152=function(_0x5d7bec,_0x11ec4a){_0x5d7bec=_0x5d7bec-0x0;var _0x509441=_0x152c[_0x5d7bec];return _0x509441;};'use strict';var _=require(_0xc152('0x0'));var moment=require(_0xc152('0x1'));var BPromise=require(_0xc152('0x2'));var md5=require('md5');var Redis=require(_0xc152('0x3'));var config=require(_0xc152('0x4'));var logger=require(_0xc152('0x5'))(_0xc152('0x6'));config[_0xc152('0x7')]=_[_0xc152('0x8')](config[_0xc152('0x7')],{'host':_0xc152('0x9'),'port':0x18eb});var io=require(_0xc152('0xa'))(new Redis(config['redis']));var EmailImap=require(_0xc152('0xb'));var EmailSmtp=require(_0xc152('0xc'));var mailAccount=require(_0xc152('0xd'));var md5Accounts={};function EmailChannel(_0x4e6ac4){logger[_0xc152('0xe')]('start\x20email\x20channel');this['mailAccounts']=_0x4e6ac4['mailAccounts'];this[_0xc152('0xf')]={};this[_0xc152('0x10')]=new EmailSmtp();}EmailChannel[_0xc152('0x11')][_0xc152('0x12')]=function(_0xe1f58e){var _0x31d085=this['mailAccounts'][_0xe1f58e];var _0x2153ec={'id':_0x31d085['id'],'name':_0x31d085[_0xc152('0x13')],'key':_0x31d085[_0xc152('0x14')],'active':_0x31d085[_0xc152('0x15')],'Imap':{'status':_0x31d085[_0xc152('0x16')][_0xc152('0x17')],'messageStatus':_0x31d085['Imap']['messageStatus'],'total':_0x31d085['Imap'][_0xc152('0x18')]}};if(_[_0xc152('0x19')](md5Accounts[_0xe1f58e])){md5Accounts[_0xe1f58e]={};}var _0x316f9b=md5(JSON[_0xc152('0x1a')](_0x2153ec));if(md5Accounts[_0xe1f58e]['md5']!==_0x316f9b){md5Accounts[_0xe1f58e][_0xc152('0x1b')]=_0x316f9b;io[_0xc152('0x12')]('mailAccount:update',_0x2153ec);}};EmailChannel[_0xc152('0x11')][_0xc152('0x1c')]=function(_0x2a02c8){for(var _0x2c339b in _0x2a02c8){if(_0x2a02c8['hasOwnProperty'](_0x2c339b)){if(_0x2a02c8[_0x2c339b][_0xc152('0x16')]&&_0x2a02c8[_0x2c339b][_0xc152('0x15')]){var _0x29513=_0x2a02c8[_0x2c339b]['Imap'];if(!this[_0xc152('0xf')][_0xc152('0x1d')](_0x29513['id'])){this[_0xc152('0xf')][_0x29513['id']]=new EmailImap(_0x29513,_0x2a02c8[_0x2c339b][_0xc152('0x6')]);this[_0xc152('0xf')][_0x29513['id']]['on'](_0xc152('0x1e'),this['handleImapBox'][_0xc152('0x1f')](this,_0x2c339b));this[_0xc152('0xf')][_0x29513['id']]['on'](_0xc152('0x6'),this[_0xc152('0x20')][_0xc152('0x1f')](this,_0x2c339b));this[_0xc152('0xf')][_0x29513['id']]['on'](_0xc152('0x21'),this[_0xc152('0x22')]['bind'](this,_0x2c339b));this[_0xc152('0xf')][_0x29513['id']]['on'](_0xc152('0x23'),this[_0xc152('0x24')][_0xc152('0x1f')](this,_0x2c339b));}}else{if(_[_0xc152('0x19')](this['mailAccounts'][_0x2c339b][_0xc152('0x16')])){this['mailAccounts'][_0x2c339b][_0xc152('0x16')]={};}this[_0xc152('0x25')][_0x2c339b][_0xc152('0x16')]['status']=_0xc152('0x26');this[_0xc152('0x25')][_0x2c339b]['Imap'][_0xc152('0x27')]='';this[_0xc152('0x12')](_0x2c339b);}}}};EmailChannel[_0xc152('0x11')]['handleImapBox']=function(_0x11b346,_0x29af3e){if(this[_0xc152('0x25')][_0x11b346]){this[_0xc152('0x25')][_0x11b346]['Imap'][_0xc152('0x17')]=_0xc152('0x28');this[_0xc152('0x25')][_0x11b346]['Imap'][_0xc152('0x27')]=_0x29af3e[_0xc152('0x13')];if(_0x29af3e[_0xc152('0x29')]){this[_0xc152('0x25')][_0x11b346][_0xc152('0x16')][_0xc152('0x18')]=_0x29af3e['messages'][_0xc152('0x18')];}return this[_0xc152('0x12')](_0x11b346);}};EmailChannel['prototype'][_0xc152('0x20')]=function(_0xda9f8e,_0x2d51a3){logger[_0xc152('0xe')](_0xc152('0x2a'),_0x2d51a3['firstName'],_0x2d51a3[_0xc152('0x2b')],_0x2d51a3[_0xc152('0x2c')],_0xda9f8e);if(this[_0xc152('0x25')][_0xda9f8e]){return mailAccount[_0xc152('0x2d')](_0xda9f8e,_0x2d51a3)[_0xc152('0x2e')](function(_0x1b64e6){if(_0x1b64e6){logger['info'](_0xc152('0x2f'));}})['catch'](function(_0xe1ebf4){logger[_0xc152('0x23')](_0xc152('0x30'),JSON[_0xc152('0x1a')](_0xe1ebf4));});}};EmailChannel[_0xc152('0x11')][_0xc152('0x22')]=function(_0x1fbf91){if(this[_0xc152('0x25')][_0x1fbf91]&&this[_0xc152('0x25')][_0x1fbf91][_0xc152('0x16')]){if(this[_0xc152('0xf')][this[_0xc152('0x25')][_0x1fbf91]['Imap']['id']]){delete this[_0xc152('0xf')][this[_0xc152('0x25')][_0x1fbf91][_0xc152('0x16')]['id']];}this[_0xc152('0x25')][_0x1fbf91][_0xc152('0x16')]['lastSync']=moment();this[_0xc152('0x12')](_0x1fbf91);}};EmailChannel[_0xc152('0x11')]['handleImapError']=function(_0x176fad,_0x256ab2){if(this[_0xc152('0x25')][_0x176fad]){this[_0xc152('0x25')][_0x176fad][_0xc152('0x16')]['status']='error';this['mailAccounts'][_0x176fad][_0xc152('0x16')][_0xc152('0x27')]=_0x256ab2;return this[_0xc152('0x12')](_0x176fad);}};EmailChannel[_0xc152('0x11')][_0xc152('0x31')]=function(_0x88728f,_0x5b6a08){return this[_0xc152('0x10')][_0xc152('0x32')](_0x88728f,_0x5b6a08);};EmailChannel[_0xc152('0x11')][_0xc152('0x33')]=function(_0x2127d6){var _0x380ae5=this;if(this[_0xc152('0x25')][_0x2127d6['id']]){if(_['isNil'](this[_0xc152('0x25')][_0x2127d6['id']][_0xc152('0x34')])){this[_0xc152('0x25')][_0x2127d6['id']][_0xc152('0x34')]={};}this[_0xc152('0x25')][_0x2127d6['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x515d11,_0x3cfff0){return _0x380ae5[_0xc152('0x10')][_0xc152('0x35')](_0x2127d6)[_0xc152('0x2e')](function(_0x22ef79){_0x380ae5[_0xc152('0x25')][_0x2127d6['id']][_0xc152('0x34')][_0xc152('0x17')]=_0xc152('0x36');_0x380ae5[_0xc152('0x25')][_0x2127d6['id']]['Smtp']['messageStatus']='';_0x380ae5['emit'](_0x2127d6['id']);_0x515d11(_0x22ef79);})[_0xc152('0x37')](function(_0x2fb0d4){_0x380ae5['mailAccounts'][_0x2127d6['id']][_0xc152('0x34')][_0xc152('0x17')]=_0xc152('0x23');_0x380ae5[_0xc152('0x25')][_0x2127d6['id']][_0xc152('0x34')][_0xc152('0x27')]=_0x2fb0d4;_0x380ae5['emit'](_0x2127d6['id']);_0x3cfff0(_0x2fb0d4);});});}return this[_0xc152('0x10')][_0xc152('0x35')](_0x2127d6);};module[_0xc152('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 13ca9c9..ffd10c6 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 _0x9221=['connTimeout','authTimeout','isNil','authentication','user','host','port','tls','required','password','getHost','service','anonymous@xcally.com','handleOpenBox','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','upperFirst','exports','util','imap','randomstring','mailparser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','account','once','handleReady','bind','handleEnd','error','handleError','connect','inherits','prototype'];(function(_0x3ab353,_0x5d5283){var _0x1e2285=function(_0x55804f){while(--_0x55804f){_0x3ab353['push'](_0x3ab353['shift']());}};_0x1e2285(++_0x5d5283);}(_0x9221,0x64));var _0x1922=function(_0x53084c,_0x4a10a7){_0x53084c=_0x53084c-0x0;var _0x3725c5=_0x9221[_0x53084c];return _0x3725c5;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x1922('0x0'));var Imap=require(_0x1922('0x1'));var _=require('lodash');var rs=require(_0x1922('0x2'));var simpleParser=require(_0x1922('0x3'))['simpleParser'];var Iconv=require(_0x1922('0x4'))[_0x1922('0x5')];var EventEmitter=require(_0x1922('0x6'))[_0x1922('0x7')];var utils=require(_0x1922('0x8'));var logger=require(_0x1922('0x9'))(_0x1922('0xa'));function EmailImap(_0x5aa05c,_0x116227){this[_0x1922('0xb')]=_0x1922('0xc');this['account']=this[_0x1922('0xd')](_0x5aa05c,_0x116227);this['imap']=new Imap(this[_0x1922('0xe')]);this[_0x1922('0x1')][_0x1922('0xf')]('ready',this[_0x1922('0x10')][_0x1922('0x11')](this));this['imap'][_0x1922('0xf')]('end',this[_0x1922('0x12')]['bind'](this));this[_0x1922('0x1')]['on'](_0x1922('0x13'),this[_0x1922('0x14')]['bind'](this));this['imap'][_0x1922('0x15')]();}util[_0x1922('0x16')](EmailImap,EventEmitter);EmailImap[_0x1922('0x17')][_0x1922('0xd')]=function(_0x33b35d,_0x4a76f7){var _0x5db997={'connTimeout':_0x33b35d['connTimeout']?_0x33b35d[_0x1922('0x18')]*0x3e8:0x2710,'authTimeout':_0x33b35d[_0x1922('0x19')]?_0x33b35d[_0x1922('0x19')]*0x3e8:0x1388};if(_[_0x1922('0x1a')](_0x33b35d['service'])){if(_0x33b35d[_0x1922('0x1b')]){_0x5db997[_0x1922('0x1c')]=_0x33b35d[_0x1922('0x1c')];_0x5db997['password']=_0x33b35d['password'];}_0x5db997[_0x1922('0x1d')]=_0x33b35d['host'];_0x5db997[_0x1922('0x1e')]=_0x33b35d[_0x1922('0x1e')]||0x3e1;if(_0x33b35d['tls']){_0x5db997['tls']=!![];}else{_0x5db997[_0x1922('0x1f')]=![];_0x5db997['autotls']=_0x1922('0x20');}}else{_0x5db997[_0x1922('0x1c')]=_0x33b35d[_0x1922('0x1c')];_0x5db997[_0x1922('0x21')]=_0x33b35d['password'];_0x5db997[_0x1922('0x1d')]=utils[_0x1922('0x22')](_0x33b35d[_0x1922('0x23')]);_0x5db997[_0x1922('0x1e')]=0x3e1;_0x5db997['tls']=!![];}_0x5db997[_0x1922('0xa')]=_0x4a76f7||_0x33b35d[_0x1922('0x1c')]||_0x1922('0x24');return _0x5db997;};EmailImap['prototype'][_0x1922('0x10')]=function(){this['imap']['openBox'](this[_0x1922('0xb')],![],this[_0x1922('0x25')][_0x1922('0x11')](this));};EmailImap[_0x1922('0x17')][_0x1922('0x25')]=function(_0xdaf3b3,_0x2a77e8){if(_0xdaf3b3){this[_0x1922('0x14')](_0xdaf3b3,!![]);}else{this[_0x1922('0x26')](_0x1922('0x27'),_0x2a77e8);this[_0x1922('0x28')]();}};EmailImap['prototype'][_0x1922('0x29')]=function(_0x58ebb5){if(_0x58ebb5){this[_0x1922('0x14')](_0x58ebb5,!![]);}else{this[_0x1922('0x1')][_0x1922('0x2a')]();}};EmailImap[_0x1922('0x17')][_0x1922('0x28')]=function(){this[_0x1922('0x1')][_0x1922('0x2b')]([_0x1922('0x2c')],this[_0x1922('0x2d')]['bind'](this));};EmailImap[_0x1922('0x17')][_0x1922('0x2d')]=function(_0x353c71,_0x2ebb6c){if(_0x353c71){this[_0x1922('0x14')](_0x353c71,!![]);}else{if(_0x2ebb6c['length']){try{var _0x10f398=this[_0x1922('0x1')][_0x1922('0x2e')](_0x2ebb6c,{'bodies':'','markSeen':!![]});_0x10f398['on'](_0x1922('0x2f'),this[_0x1922('0x30')][_0x1922('0x11')](this));_0x10f398[_0x1922('0xf')]('error',this[_0x1922('0x31')][_0x1922('0x11')](this));_0x10f398[_0x1922('0xf')](_0x1922('0x2a'),this[_0x1922('0x32')][_0x1922('0x11')](this));}catch(_0x483910){logger[_0x1922('0x13')](_0x483910);}}else{this[_0x1922('0x1')][_0x1922('0x33')](!![],this[_0x1922('0x29')][_0x1922('0x11')](this));}}};EmailImap[_0x1922('0x17')][_0x1922('0x30')]=function(_0x54c09f,_0x349f04){_0x54c09f['on'](_0x1922('0x34'),this[_0x1922('0x35')][_0x1922('0x11')](this));_0x54c09f[_0x1922('0xf')](_0x1922('0x36'),this['handleMessageAttributes'][_0x1922('0x11')](this));_0x54c09f[_0x1922('0xf')]('end',this[_0x1922('0x37')][_0x1922('0x11')](this));};EmailImap['prototype'][_0x1922('0x35')]=function(_0x12a534,_0x1e0e69){simpleParser(_0x12a534,{'Iconv':Iconv},this['handleSimpleParser'][_0x1922('0x11')](this));};EmailImap[_0x1922('0x17')]['handleMessageAttributes']=function(_0x35511f){};EmailImap[_0x1922('0x17')][_0x1922('0x37')]=function(){};EmailImap['prototype'][_0x1922('0x38')]=function(_0x4fc0e3,_0x125136){if(_0x4fc0e3){logger['error'](_0x4fc0e3);}else{var _0x53572f=this;utils[_0x1922('0x39')](this[_0x1922('0xe')],_0x125136,function(_0x5f423d){_0x53572f[_0x1922('0x26')](_0x1922('0xa'),_0x5f423d);});}};EmailImap[_0x1922('0x17')][_0x1922('0x32')]=function(){this[_0x1922('0x1')]['closeBox'](!![],this['handleCloseBox'][_0x1922('0x11')](this));};EmailImap[_0x1922('0x17')][_0x1922('0x31')]=function(_0x1183a7){this[_0x1922('0x14')](_0x1183a7);this[_0x1922('0x1')]['closeBox'](!![],this[_0x1922('0x29')][_0x1922('0x11')](this));};EmailImap[_0x1922('0x17')][_0x1922('0x12')]=function(){this[_0x1922('0x26')](_0x1922('0x2a'));};EmailImap[_0x1922('0x17')]['handleError']=function(_0x4d6f5d,_0x1e474b){logger[_0x1922('0x13')]('handleError',this[_0x1922('0xe')]['email'],JSON[_0x1922('0x3a')](_0x4d6f5d));var _0x461151='';if(_0x4d6f5d){if(_0x4d6f5d[_0x1922('0x3b')]){_0x461151=_0x4d6f5d[_0x1922('0x3b')];}else{for(var _0x233f5a in _0x4d6f5d){if(_0x4d6f5d['hasOwnProperty'](_0x233f5a)){_0x461151+=_[_0x1922('0x3c')](_0x233f5a)+':\x20'+_0x4d6f5d[_0x233f5a]+'\x0a';}}}}if(_0x1e474b){this[_0x1922('0x1')][_0x1922('0x2a')]();}else{this[_0x1922('0x26')]('error',_0x461151);this[_0x1922('0x26')]('end');}};module[_0x1922('0x3d')]=EmailImap; \ No newline at end of file +var _0x70e0=['handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','handleFetchError','stringify','textCode','hasOwnProperty','path','util','imap','mailparser','simpleParser','iconv','Iconv','EventEmitter','../../../config/logger','mailbox','INBOX','account','getAccount','handleReady','bind','once','end','handleEnd','error','handleError','inherits','authTimeout','isNil','service','user','password','host','port','tls','autotls','email','anonymous@xcally.com','prototype','openBox'];(function(_0x403c8d,_0x5e3825){var _0x4ca60d=function(_0x9326c1){while(--_0x9326c1){_0x403c8d['push'](_0x403c8d['shift']());}};_0x4ca60d(++_0x5e3825);}(_0x70e0,0x17b));var _0x070e=function(_0x440d05,_0x473dc1){_0x440d05=_0x440d05-0x0;var _0x5e6624=_0x70e0[_0x440d05];return _0x5e6624;};'use strict';var fs=require('fs');var path=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var Imap=require(_0x070e('0x2'));var _=require('lodash');var rs=require('randomstring');var simpleParser=require(_0x070e('0x3'))[_0x070e('0x4')];var Iconv=require(_0x070e('0x5'))[_0x070e('0x6')];var EventEmitter=require('events')[_0x070e('0x7')];var utils=require('./utils');var logger=require(_0x070e('0x8'))('email');function EmailImap(_0x56e420,_0x5032e5){this[_0x070e('0x9')]=_0x070e('0xa');this[_0x070e('0xb')]=this[_0x070e('0xc')](_0x56e420,_0x5032e5);this[_0x070e('0x2')]=new Imap(this[_0x070e('0xb')]);this[_0x070e('0x2')]['once']('ready',this[_0x070e('0xd')][_0x070e('0xe')](this));this[_0x070e('0x2')][_0x070e('0xf')](_0x070e('0x10'),this[_0x070e('0x11')][_0x070e('0xe')](this));this[_0x070e('0x2')]['on'](_0x070e('0x12'),this[_0x070e('0x13')][_0x070e('0xe')](this));this['imap']['connect']();}util[_0x070e('0x14')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x5bae0f,_0x11d2ce){var _0x14c3fd={'connTimeout':_0x5bae0f['connTimeout']?_0x5bae0f['connTimeout']*0x3e8:0x2710,'authTimeout':_0x5bae0f[_0x070e('0x15')]?_0x5bae0f[_0x070e('0x15')]*0x3e8:0x1388};if(_[_0x070e('0x16')](_0x5bae0f[_0x070e('0x17')])){if(_0x5bae0f['authentication']){_0x14c3fd['user']=_0x5bae0f[_0x070e('0x18')];_0x14c3fd[_0x070e('0x19')]=_0x5bae0f[_0x070e('0x19')];}_0x14c3fd[_0x070e('0x1a')]=_0x5bae0f[_0x070e('0x1a')];_0x14c3fd['port']=_0x5bae0f[_0x070e('0x1b')]||0x3e1;if(_0x5bae0f[_0x070e('0x1c')]){_0x14c3fd[_0x070e('0x1c')]=!![];}else{_0x14c3fd[_0x070e('0x1c')]=![];_0x14c3fd[_0x070e('0x1d')]='required';}}else{_0x14c3fd['user']=_0x5bae0f['user'];_0x14c3fd[_0x070e('0x19')]=_0x5bae0f[_0x070e('0x19')];_0x14c3fd[_0x070e('0x1a')]=utils['getHost'](_0x5bae0f[_0x070e('0x17')]);_0x14c3fd['port']=0x3e1;_0x14c3fd[_0x070e('0x1c')]=!![];}_0x14c3fd[_0x070e('0x1e')]=_0x11d2ce||_0x5bae0f[_0x070e('0x18')]||_0x070e('0x1f');return _0x14c3fd;};EmailImap[_0x070e('0x20')][_0x070e('0xd')]=function(){this[_0x070e('0x2')][_0x070e('0x21')](this['mailbox'],![],this[_0x070e('0x22')][_0x070e('0xe')](this));};EmailImap[_0x070e('0x20')]['handleOpenBox']=function(_0xf17c56,_0x5f3e9d){if(_0xf17c56){this['handleError'](_0xf17c56,!![]);}else{this[_0x070e('0x23')](_0x070e('0x24'),_0x5f3e9d);this[_0x070e('0x25')]();}};EmailImap[_0x070e('0x20')][_0x070e('0x26')]=function(_0x497f58){if(_0x497f58){this[_0x070e('0x13')](_0x497f58,!![]);}else{this[_0x070e('0x2')][_0x070e('0x10')]();}};EmailImap[_0x070e('0x20')][_0x070e('0x25')]=function(){this[_0x070e('0x2')][_0x070e('0x27')]([_0x070e('0x28')],this['handleReadUnseen'][_0x070e('0xe')](this));};EmailImap[_0x070e('0x20')][_0x070e('0x29')]=function(_0x56fc12,_0x5c5f0d){if(_0x56fc12){this[_0x070e('0x13')](_0x56fc12,!![]);}else{if(_0x5c5f0d[_0x070e('0x2a')]){try{var _0xa6c0ab=this['imap'][_0x070e('0x2b')](_0x5c5f0d,{'bodies':'','markSeen':!![]});_0xa6c0ab['on'](_0x070e('0x2c'),this[_0x070e('0x2d')][_0x070e('0xe')](this));_0xa6c0ab['once']('error',this['handleFetchError']['bind'](this));_0xa6c0ab[_0x070e('0xf')]('end',this[_0x070e('0x2e')][_0x070e('0xe')](this));}catch(_0x4f8130){logger['error'](_0x4f8130);}}else{this[_0x070e('0x2')][_0x070e('0x2f')](!![],this['handleCloseBox']['bind'](this));}}};EmailImap[_0x070e('0x20')][_0x070e('0x2d')]=function(_0x444d02,_0x31fdc5){_0x444d02['on'](_0x070e('0x30'),this['handleMessageBody']['bind'](this));_0x444d02[_0x070e('0xf')](_0x070e('0x31'),this[_0x070e('0x32')][_0x070e('0xe')](this));_0x444d02[_0x070e('0xf')]('end',this[_0x070e('0x33')][_0x070e('0xe')](this));};EmailImap['prototype'][_0x070e('0x34')]=function(_0x34746e,_0x4ba6f0){simpleParser(_0x34746e,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0x070e('0x20')][_0x070e('0x32')]=function(_0x39dfaa){};EmailImap[_0x070e('0x20')][_0x070e('0x33')]=function(){};EmailImap['prototype'][_0x070e('0x35')]=function(_0xa1bb20,_0xb53332){if(_0xa1bb20){logger['error'](_0xa1bb20);}else{var _0x268c5d=this;utils[_0x070e('0x36')](this[_0x070e('0xb')],_0xb53332,function(_0x54b72f){_0x268c5d[_0x070e('0x23')](_0x070e('0x1e'),_0x54b72f);});}};EmailImap['prototype'][_0x070e('0x2e')]=function(){this['imap'][_0x070e('0x2f')](!![],this[_0x070e('0x26')][_0x070e('0xe')](this));};EmailImap[_0x070e('0x20')][_0x070e('0x37')]=function(_0x47b929){this[_0x070e('0x13')](_0x47b929);this['imap']['closeBox'](!![],this[_0x070e('0x26')][_0x070e('0xe')](this));};EmailImap[_0x070e('0x20')]['handleEnd']=function(){this[_0x070e('0x23')](_0x070e('0x10'));};EmailImap[_0x070e('0x20')][_0x070e('0x13')]=function(_0x4a4ee3,_0x13e4e0){logger['error']('handleError',this['account'][_0x070e('0x1e')],JSON[_0x070e('0x38')](_0x4a4ee3));var _0x26b3e2='';if(_0x4a4ee3){if(_0x4a4ee3[_0x070e('0x39')]){_0x26b3e2=_0x4a4ee3[_0x070e('0x39')];}else{for(var _0x562aa4 in _0x4a4ee3){if(_0x4a4ee3[_0x070e('0x3a')](_0x562aa4)){_0x26b3e2+=_['upperFirst'](_0x562aa4)+':\x20'+_0x4a4ee3[_0x562aa4]+'\x0a';}}}}if(_0x13e4e0){this[_0x070e('0x2')][_0x070e('0x10')]();}else{this[_0x070e('0x23')]('error',_0x26b3e2);this['emit'](_0x070e('0x10'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 5661bb6..2e189c0 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 _0xbce7=['prototype','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired','exports','bluebird'];(function(_0x411b14,_0x3f9e36){var _0x402736=function(_0x2be12e){while(--_0x2be12e){_0x411b14['push'](_0x411b14['shift']());}};_0x402736(++_0x3f9e36);}(_0xbce7,0x121));var _0x7bce=function(_0x2b36b0,_0x331282){_0x2b36b0=_0x2b36b0-0x0;var _0x3c0a23=_0xbce7[_0x2b36b0];return _0x3c0a23;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x7bce('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x7bce('0x1')]['send']=function(_0x2c3d23,_0x2c9ad2){return new BPromise(function(_0x64c739,_0xacf9d){var _0x262014=nodemailer[_0x7bce('0x2')](_0x2c3d23);_0x262014[_0x7bce('0x3')](_0x7bce('0x4'),inlineBase64());_0x262014[_0x7bce('0x5')](_0x2c9ad2,function(_0x528c51,_0x26dea2){if(_0x528c51){_0xacf9d(_0x528c51[_0x7bce('0x6')]());}else{_0x64c739(_0x26dea2);}});});};EmailSmtp[_0x7bce('0x1')][_0x7bce('0x7')]=function(_0x5224c9){return new BPromise(function(_0x1eee4a,_0xb2c097){var _0x275779=nodemailer['createTransport'](_0x5224c9);_0x275779[_0x7bce('0x7')](function(_0x98ffbf,_0x54caa4){if(_0x98ffbf){_0xb2c097(_0x98ffbf['toString']());}else{if(_0x54caa4){_0x1eee4a(_0x54caa4);}else{_0xb2c097(_0x7bce('0x8'));}}});});};module[_0x7bce('0x9')]=EmailSmtp; \ No newline at end of file +var _0xd11c=['toString','verify','Not\x20verifired','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','createTransport','use','compile','sendMail'];(function(_0x3a475b,_0x21112e){var _0x3a9416=function(_0x2eb99a){while(--_0x2eb99a){_0x3a475b['push'](_0x3a475b['shift']());}};_0x3a9416(++_0x21112e);}(_0xd11c,0x64));var _0xcd11=function(_0x29f5cd,_0x5c64d4){_0x29f5cd=_0x29f5cd-0x0;var _0x278c24=_0xd11c[_0x29f5cd];return _0x278c24;};'use strict';var nodemailer=require(_0xcd11('0x0'));var BPromise=require(_0xcd11('0x1'));var inlineBase64=require(_0xcd11('0x2'));function EmailSmtp(){}EmailSmtp[_0xcd11('0x3')]['send']=function(_0x1795cf,_0xff51f6){return new BPromise(function(_0x5a911c,_0x625771){var _0x5ea020=nodemailer[_0xcd11('0x4')](_0x1795cf);_0x5ea020[_0xcd11('0x5')](_0xcd11('0x6'),inlineBase64());_0x5ea020[_0xcd11('0x7')](_0xff51f6,function(_0x54c958,_0x41a6e3){if(_0x54c958){_0x625771(_0x54c958[_0xcd11('0x8')]());}else{_0x5a911c(_0x41a6e3);}});});};EmailSmtp['prototype']['verify']=function(_0x4b8bb9){return new BPromise(function(_0x54d09b,_0x49d811){var _0x16fb3d=nodemailer[_0xcd11('0x4')](_0x4b8bb9);_0x16fb3d[_0xcd11('0x9')](function(_0xe371ab,_0x194e6e){if(_0xe371ab){_0x49d811(_0xe371ab[_0xcd11('0x8')]());}else{if(_0x194e6e){_0x54d09b(_0x194e6e);}else{_0x49d811(_0xcd11('0xa'));}}});});};module[_0xcd11('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 3003d3d..7477b5c 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 _0xfef3=['lodash','randomstring','util','node-tnef','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','value','name','split','length','join','Anonymous','pop','html','test','replace','includes','','body','textAsHtml','message','originTo','originCc','isEmpty','bcc','attachments','attach','type','attachment','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xfef3,0x118));var _0x3fef=function(_0xb30a60,_0x19580f){_0xb30a60=_0xb30a60-0x0;var _0x381a7b=_0xfef3[_0xb30a60];return _0x381a7b;};'use strict';var _=require(_0x3fef('0x0'));var moment=require('moment');var random=require(_0x3fef('0x1'));var fs=require('fs');var path=require('path');var util=require(_0x3fef('0x2'));var tnef=require(_0x3fef('0x3'));var logger=require('../../../config/logger')(_0x3fef('0x4'));var config=require(_0x3fef('0x5'));function getAddress(_0x538f28){var _0x2f88b8=_[_0x3fef('0x6')](_0x538f28['value']);return _0x2f88b8&&_0x2f88b8[_0x3fef('0x7')]?_0x2f88b8[_0x3fef('0x7')]:_0x3fef('0x8')+random[_0x3fef('0x9')](0x6)+_0x3fef('0xa');}function getFirstName(_0x41960c){var _0x356ad8=_[_0x3fef('0x6')](_0x41960c[_0x3fef('0xb')]);if(_0x356ad8&&_0x356ad8[_0x3fef('0xc')]){var _0x67cdd8=_0x356ad8[_0x3fef('0xc')][_0x3fef('0xd')](/\s+/);return _0x67cdd8[_0x3fef('0xe')]?_0x67cdd8['slice'](0x0,-0x1)[_0x3fef('0xf')]('\x20'):_0x356ad8[_0x3fef('0xc')];}return _0x3fef('0x10');}function getLastName(_0x49d216){var _0x1c20b3=_['head'](_0x49d216[_0x3fef('0xb')]);if(_0x1c20b3&&_0x1c20b3[_0x3fef('0xc')]){var _0x2da64b=_0x1c20b3['name'][_0x3fef('0xd')](/\s+/);return _0x2da64b['length']>0x1?_0x2da64b[_0x3fef('0x11')]():'';}return'';}function getMails(_0x14c053,_0x56a65d){var _0x2dec1b='';for(var _0x177e28=0x0;_0x177e28<_0x56a65d[_0x3fef('0xb')][_0x3fef('0xe')];_0x177e28+=0x1){if(_0x56a65d[_0x3fef('0xb')][_0x177e28][_0x3fef('0x7')]!==_0x14c053){if(!_['isEmpty'](_0x2dec1b)){_0x2dec1b+=',';}_0x2dec1b+=_0x56a65d[_0x3fef('0xb')][_0x177e28][_0x3fef('0xc')]||_0x56a65d[_0x3fef('0xb')][_0x177e28][_0x3fef('0x7')]||'';_0x2dec1b+='\x20<';_0x2dec1b+=_0x56a65d[_0x3fef('0xb')][_0x177e28][_0x3fef('0x7')]?_0x56a65d['value'][_0x177e28][_0x3fef('0x7')]:_0x3fef('0x8')+random['generate'](0x6)+_0x3fef('0xa');_0x2dec1b+='>';}}return _0x2dec1b;}function parseEmail(_0x51a554,_0x42e095,_0x218f91){if(_0x42e095[_0x3fef('0x12')]){var _0x2b5226=/)<[^<]*)*<\/script>/gi;while(_0x2b5226[_0x3fef('0x13')](_0x42e095[_0x3fef('0x12')])){_0x42e095[_0x3fef('0x12')]=_0x42e095[_0x3fef('0x12')][_0x3fef('0x14')](_0x2b5226,'');}if(_0x42e095[_0x3fef('0x12')][_0x3fef('0x15')](_0x3fef('0x16'))){var _0x433a3e=[];_0x42e095['attachments']['forEach'](_0x50025f=>{_0x433a3e[_0x3fef('0x17')](_0x50025f[_0x3fef('0x18')]);});var _0xa16dc=/]+>/g;var _0x5f047c=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x4d462c=_0x42e095['html'][_0x3fef('0x14')](_0x5f047c,_0x3fef('0x19'));var _0x64d3e6=_0x4d462c[_0x3fef('0x14')](_0xa16dc,_0x3fef('0x1a'));for(let _0x492ea0=0x0;_0x492ea0<_0x433a3e['length'];_0x492ea0++){var _0x563556=_0x64d3e6[_0x3fef('0x14')](_0x3fef('0x1a'),'\x20[Attachment:\x20'+_0x433a3e[_0x492ea0]+_0x3fef('0x1b'));_0x64d3e6=_0x563556;}_0x42e095[_0x3fef('0x12')]=_0x64d3e6;}_0x218f91['body']=_0x42e095[_0x3fef('0x12')];}else{_0x218f91[_0x3fef('0x1c')]=_0x42e095[_0x3fef('0x1d')];}if(_0x218f91[_0x3fef('0x1c')]){_0x218f91[_0x3fef('0x1c')]=_0x218f91[_0x3fef('0x1c')][_0x3fef('0x14')](/Empty\x20message

','Attachments','Title','Data','getHost','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','@xcally.com','head','name','split','slice','join','Anonymous','pop','isEmpty','generate','test','html','includes','\x20[Attachment:\x20','body','0x1?_0x11c730[_0x6791('0x11')]():'';}return'';}function getMails(_0x5122f9,_0x2a9151){var _0x4c32a1='';for(var _0x3be9f0=0x0;_0x3be9f0<_0x2a9151[_0x6791('0x7')]['length'];_0x3be9f0+=0x1){if(_0x2a9151[_0x6791('0x7')][_0x3be9f0]['address']!==_0x5122f9){if(!_[_0x6791('0x12')](_0x4c32a1)){_0x4c32a1+=',';}_0x4c32a1+=_0x2a9151[_0x6791('0x7')][_0x3be9f0]['name']||_0x2a9151[_0x6791('0x7')][_0x3be9f0][_0x6791('0x8')]||'';_0x4c32a1+='\x20<';_0x4c32a1+=_0x2a9151['value'][_0x3be9f0][_0x6791('0x8')]?_0x2a9151['value'][_0x3be9f0][_0x6791('0x8')]:_0x6791('0x9')+random[_0x6791('0x13')](0x6)+_0x6791('0xa');_0x4c32a1+='>';}}return _0x4c32a1;}function parseEmail(_0x25adbc,_0x2bc0ab,_0x2ba11a){if(_0x2bc0ab['html']){var _0x4a2922=/)<[^<]*)*<\/script>/gi;while(_0x4a2922[_0x6791('0x14')](_0x2bc0ab['html'])){_0x2bc0ab[_0x6791('0x15')]=_0x2bc0ab[_0x6791('0x15')]['replace'](_0x4a2922,'');}if(_0x2bc0ab[_0x6791('0x15')][_0x6791('0x16')](_0x6791('0x17'))){var _0x12d83b=[];_0x2bc0ab['attachments'][_0x6791('0x18')](_0x1b516d=>{_0x12d83b['push'](_0x1b516d['filename']);});var _0x4b23bc=/]+>/g;var _0x372dae=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x502043=_0x2bc0ab[_0x6791('0x15')]['replace'](_0x372dae,'_SRC');var _0x496273=_0x502043[_0x6791('0x19')](_0x4b23bc,_0x6791('0x1a'));for(let _0xd49b84=0x0;_0xd49b84<_0x12d83b['length'];_0xd49b84++){var _0x3def2e=_0x496273[_0x6791('0x19')]('_IMG',_0x6791('0x1b')+_0x12d83b[_0xd49b84]+'\x20]');_0x496273=_0x3def2e;}_0x2bc0ab[_0x6791('0x15')]=_0x496273;}_0x2ba11a['body']=_0x2bc0ab['html'];}else{_0x2ba11a[_0x6791('0x1c')]=_0x2bc0ab['textAsHtml'];}if(_0x2ba11a[_0x6791('0x1c')]){_0x2ba11a[_0x6791('0x1c')]=_0x2ba11a['body'][_0x6791('0x19')](/0x0){if(this[_0x565756+'Capacity']>0x0&&this[_0x565756+'CurrentCapacity']>=this[_0x565756+_0x1560('0x29')]){return _0x1560('0x2a');}else{return _0x1560('0x2b');}}else{return _0x1560('0x2c');}};Agent[_0x1560('0x26')]['updateRealtime']=function(){var _0x2fde54=['mail',_0x1560('0x2d'),_0x1560('0x2e'),_0x1560('0x2f'),'sms',_0x1560('0x30')];for(var _0x2ff5ff=0x0;_0x2ff5ff<_0x2fde54[_0x1560('0x31')];_0x2ff5ff+=0x1){var _0x3d7dd2=this[_0x1560('0x27')](_0x2fde54[_0x2ff5ff]);if(this[_0x2fde54[_0x2ff5ff]+'Status']!==_0x3d7dd2){this[_0x2fde54[_0x2ff5ff]+'StatusTime']=_[_0x1560('0x32')](moment()['format']('x'));}this[_0x2fde54[_0x2ff5ff]+_0x1560('0x33')]=_0x3d7dd2;}var _0x52fe31={'id':this['id'],'name':this[_0x1560('0x6')],'online':this[_0x1560('0x7')],'voicePause':this[_0x1560('0x8')],'chatPause':this[_0x1560('0x9')],'mailPause':this['mailPause'],'smsPause':this[_0x1560('0x34')],'faxPause':this['faxPause'],'openchannelPause':this[_0x1560('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x1560('0xf')],'chatCapacity':this[_0x1560('0x10')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x1560('0x12')],'mailStatusTime':this[_0x1560('0x13')],'mailCapacity':this[_0x1560('0x14')],'mailCurrentCapacity':this[_0x1560('0x15')],'faxStatus':this[_0x1560('0x16')],'faxStatusTime':this[_0x1560('0x35')],'faxCapacity':this[_0x1560('0x17')],'faxCurrentCapacity':this[_0x1560('0x18')],'smsStatus':this[_0x1560('0x19')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x1560('0x1b')],'smsCurrentCapacity':this[_0x1560('0x1c')],'whatsappStatus':this[_0x1560('0x1d')],'whatsappStatusTime':this[_0x1560('0x1e')],'whatsappCapacity':this[_0x1560('0x1f')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x1560('0x21')],'openchannelStatusTime':this[_0x1560('0x22')],'openchannelCapacity':this[_0x1560('0x23')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x1560('0x36')],'busyQueue':this[_0x1560('0x24')]};var _0x5ab9af=md5(JSON[_0x1560('0x37')](_0x52fe31));if(this[_0x1560('0x38')]!==_0x5ab9af){this[_0x1560('0x38')]=_0x5ab9af;io[_0x1560('0x39')](_0x1560('0x3a'),_0x52fe31);}};module[_0x1560('0x3b')]=Agent; \ No newline at end of file +var _0xd4e1=['getChannelStatus','Status','toNumber','format','faxStatus','openchannelStatus','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','unknown','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','Capacity','CurrentCapacity','working','idle','openchannel','fax','sms','whatsapp','length'];(function(_0x217b21,_0x53d0d5){var _0x449d78=function(_0x14de36){while(--_0x14de36){_0x217b21['push'](_0x217b21['shift']());}};_0x449d78(++_0x53d0d5);}(_0xd4e1,0x140));var _0x1d4e=function(_0x1eb680,_0x1c3539){_0x1eb680=_0x1eb680-0x0;var _0x3cc581=_0xd4e1[_0x1eb680];return _0x3cc581;};'use strict';var _=require(_0x1d4e('0x0'));var moment=require(_0x1d4e('0x1'));var md5=require(_0x1d4e('0x2'));var Redis=require(_0x1d4e('0x3'));var config=require(_0x1d4e('0x4'));config[_0x1d4e('0x5')]=_['defaults'](config[_0x1d4e('0x5')],{'host':_0x1d4e('0x6'),'port':0x18eb});var io=require(_0x1d4e('0x7'))(new Redis(config[_0x1d4e('0x5')]));function Agent(_0x434b03){this['id']=_0x434b03['id']||0x0;this['name']=_0x434b03[_0x1d4e('0x8')]||'';this['online']=_0x434b03[_0x1d4e('0x9')]||!![];this[_0x1d4e('0xa')]=_0x434b03['voicePause']||![];this['chatPause']=_0x434b03[_0x1d4e('0xb')]||![];this[_0x1d4e('0xc')]=_0x434b03[_0x1d4e('0xc')]||![];this[_0x1d4e('0xd')]=_0x434b03[_0x1d4e('0xd')]||![];this[_0x1d4e('0xe')]=_0x434b03[_0x1d4e('0xe')]||![];this['openchannelPause']=_0x434b03[_0x1d4e('0xf')]||![];this[_0x1d4e('0x10')]='unknown';this[_0x1d4e('0x11')]=0x0;this[_0x1d4e('0x12')]=_0x434b03['chatCapacity']||0x0;this[_0x1d4e('0x13')]=0x0;this[_0x1d4e('0x14')]='unknown';this[_0x1d4e('0x15')]=0x0;this[_0x1d4e('0x16')]=_0x434b03[_0x1d4e('0x16')]||0x0;this[_0x1d4e('0x17')]=0x0;this['faxStatus']=_0x1d4e('0x18');this[_0x1d4e('0x19')]=0x0;this[_0x1d4e('0x1a')]=_0x434b03['faxCapacity']||0x0;this[_0x1d4e('0x1b')]=0x0;this[_0x1d4e('0x1c')]=_0x1d4e('0x18');this[_0x1d4e('0x1d')]=0x0;this[_0x1d4e('0x1e')]=_0x434b03[_0x1d4e('0x1e')]||0x0;this[_0x1d4e('0x1f')]=0x0;this[_0x1d4e('0x20')]='unknown';this[_0x1d4e('0x21')]=0x0;this[_0x1d4e('0x22')]=_0x434b03[_0x1d4e('0x22')]||0x0;this[_0x1d4e('0x23')]=0x0;this['openchannelStatus']=_0x1d4e('0x18');this[_0x1d4e('0x24')]=0x0;this[_0x1d4e('0x25')]=_0x434b03[_0x1d4e('0x25')]||0x0;this[_0x1d4e('0x26')]=0x0;this[_0x1d4e('0x27')]=![];this[_0x1d4e('0x28')]=undefined;this[_0x1d4e('0x2')]='';this[_0x1d4e('0x29')]();}Agent[_0x1d4e('0x2a')]['getChannelStatus']=function(_0x587d57){if(this[_0x587d57+'CurrentCapacity']>0x0){if(this[_0x587d57+_0x1d4e('0x2b')]>0x0&&this[_0x587d57+_0x1d4e('0x2c')]>=this[_0x587d57+_0x1d4e('0x2b')]){return'maxcapacity';}else{return _0x1d4e('0x2d');}}else{return _0x1d4e('0x2e');}};Agent[_0x1d4e('0x2a')][_0x1d4e('0x29')]=function(){var _0x201a61=['mail','chat',_0x1d4e('0x2f'),_0x1d4e('0x30'),_0x1d4e('0x31'),_0x1d4e('0x32')];for(var _0x34988d=0x0;_0x34988d<_0x201a61[_0x1d4e('0x33')];_0x34988d+=0x1){var _0xe66861=this[_0x1d4e('0x34')](_0x201a61[_0x34988d]);if(this[_0x201a61[_0x34988d]+_0x1d4e('0x35')]!==_0xe66861){this[_0x201a61[_0x34988d]+'StatusTime']=_[_0x1d4e('0x36')](moment()[_0x1d4e('0x37')]('x'));}this[_0x201a61[_0x34988d]+_0x1d4e('0x35')]=_0xe66861;}var _0x402f42={'id':this['id'],'name':this[_0x1d4e('0x8')],'online':this[_0x1d4e('0x9')],'voicePause':this[_0x1d4e('0xa')],'chatPause':this['chatPause'],'mailPause':this[_0x1d4e('0xc')],'smsPause':this[_0x1d4e('0xe')],'faxPause':this[_0x1d4e('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x1d4e('0x10')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x1d4e('0x12')],'chatCurrentCapacity':this[_0x1d4e('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x1d4e('0x15')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x1d4e('0x17')],'faxStatus':this[_0x1d4e('0x38')],'faxStatusTime':this[_0x1d4e('0x19')],'faxCapacity':this[_0x1d4e('0x1a')],'faxCurrentCapacity':this[_0x1d4e('0x1b')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x1d4e('0x1d')],'smsCapacity':this[_0x1d4e('0x1e')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x1d4e('0x21')],'whatsappCapacity':this[_0x1d4e('0x22')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x1d4e('0x39')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x1d4e('0x27')],'busyQueue':this[_0x1d4e('0x28')]};var _0x2f02af=md5(JSON[_0x1d4e('0x3a')](_0x402f42));if(this[_0x1d4e('0x2')]!==_0x2f02af){this[_0x1d4e('0x2')]=_0x2f02af;io[_0x1d4e('0x3b')](_0x1d4e('0x3c'),_0x402f42);}};module[_0x1d4e('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 2cd7eb0..5188271 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 _0x63b3=['chat:queue:%s','emit','chat_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','beepall','md5','updateRouting','updateRealtime','prototype','mapAgentsId','map','Agents','_rr','loggedIn','length','online','chatPause','paused','available','stringify','format'];(function(_0x4c6a18,_0xb8f273){var _0xe5f081=function(_0x30f2c5){while(--_0x30f2c5){_0x4c6a18['push'](_0x4c6a18['shift']());}};_0xe5f081(++_0xb8f273);}(_0x63b3,0x1a7));var _0x363b=function(_0x5e5e32,_0x402706){_0x5e5e32=_0x5e5e32-0x0;var _0x3096b1=_0x63b3[_0x5e5e32];return _0x3096b1;};'use strict';var _=require(_0x363b('0x0'));var md5=require('md5');var util=require(_0x363b('0x1'));var Redis=require(_0x363b('0x2'));var config=require(_0x363b('0x3'));config[_0x363b('0x4')]=_[_0x363b('0x5')](config[_0x363b('0x4')],{'host':_0x363b('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x363b('0x4')]));function ChatQueue(_0x174fe1){this['id']=_0x174fe1['id']||0x0;this['name']=_0x174fe1[_0x363b('0x7')]||'';this['timeout']=_0x174fe1['timeout']||0xa;this['strategy']=_0x174fe1['strategy']||_0x363b('0x8');this['Agents']=_0x174fe1['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x363b('0x9')]='';this[_0x363b('0xa')]();this[_0x363b('0xb')]();}ChatQueue[_0x363b('0xc')][_0x363b('0xa')]=function(){var _0x503a1e=this['mapAgentsId']['_rr'];this[_0x363b('0xd')]=_[_0x363b('0xe')](this[_0x363b('0xf')],'id');this[_0x363b('0xd')][_0x363b('0x10')]=_0x503a1e;};ChatQueue['prototype'][_0x363b('0xb')]=function(){this[_0x363b('0x11')]=0x0;this['paused']=0x0;for(var _0x3c2bed=0x0;_0x3c2bed=0x0?this['available']:0x0;var _0x21bb3e={'id':this['id'],'available':this[_0x363b('0x16')],'loggedIn':this[_0x363b('0x11')],'name':this[_0x363b('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x3876ed=md5(JSON[_0x363b('0x17')](_0x21bb3e));if(this[_0x363b('0x9')]!==_0x3876ed){this['md5']=_0x3876ed;io['to'](util[_0x363b('0x18')](_0x363b('0x19'),_0x21bb3e[_0x363b('0x7')]))[_0x363b('0x1a')](_0x363b('0x1b'),_0x21bb3e);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x1d8f=['md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','paused','length','online','loggedIn','chatPause','available','waiting','stringify','format','chat:queue:%s','chat_queue:save','exports'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0x1d8f,0xfc));var _0xf1d8=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x1d8f[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var md5=require(_0xf1d8('0x0'));var util=require('util');var Redis=require(_0xf1d8('0x1'));var config=require(_0xf1d8('0x2'));config[_0xf1d8('0x3')]=_['defaults'](config['redis'],{'host':_0xf1d8('0x4'),'port':0x18eb});var io=require(_0xf1d8('0x5'))(new Redis(config[_0xf1d8('0x3')]));function ChatQueue(_0x3ca5cb){this['id']=_0x3ca5cb['id']||0x0;this[_0xf1d8('0x6')]=_0x3ca5cb[_0xf1d8('0x6')]||'';this[_0xf1d8('0x7')]=_0x3ca5cb['timeout']||0xa;this[_0xf1d8('0x8')]=_0x3ca5cb[_0xf1d8('0x8')]||'beepall';this[_0xf1d8('0x9')]=_0x3ca5cb[_0xf1d8('0x9')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xf1d8('0x0')]='';this['updateRouting']();this[_0xf1d8('0xa')]();}ChatQueue[_0xf1d8('0xb')][_0xf1d8('0xc')]=function(){var _0x537fe5=this[_0xf1d8('0xd')][_0xf1d8('0xe')];this[_0xf1d8('0xd')]=_[_0xf1d8('0xf')](this[_0xf1d8('0x9')],'id');this['mapAgentsId'][_0xf1d8('0xe')]=_0x537fe5;};ChatQueue[_0xf1d8('0xb')][_0xf1d8('0xa')]=function(){this['loggedIn']=0x0;this[_0xf1d8('0x10')]=0x0;for(var _0x594e16=0x0;_0x594e16=0x0?this[_0xf1d8('0x15')]:0x0;var _0x51e6db={'id':this['id'],'available':this[_0xf1d8('0x15')],'loggedIn':this['loggedIn'],'name':this[_0xf1d8('0x6')],'paused':this[_0xf1d8('0x10')],'waiting':this[_0xf1d8('0x16')]};var _0x310657=md5(JSON[_0xf1d8('0x17')](_0x51e6db));if(this[_0xf1d8('0x0')]!==_0x310657){this[_0xf1d8('0x0')]=_0x310657;io['to'](util[_0xf1d8('0x18')](_0xf1d8('0x19'),_0x51e6db[_0xf1d8('0x6')]))['emit'](_0xf1d8('0x1a'),_0x51e6db);}};module[_0xf1d8('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 4940c8b..ec7658f 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 _0x656e=['Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','faxPause','available','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','util','redis','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x13ff4f,_0x4defc2){var _0xd04dee=function(_0x516beb){while(--_0x516beb){_0x13ff4f['push'](_0x13ff4f['shift']());}};_0xd04dee(++_0x4defc2);}(_0x656e,0x13c));var _0xe656=function(_0x9dfd2a,_0x506da8){_0x9dfd2a=_0x9dfd2a-0x0;var _0x5cd200=_0x656e[_0x9dfd2a];return _0x5cd200;};'use strict';var _=require(_0xe656('0x0'));var md5=require('md5');var util=require(_0xe656('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xe656('0x2')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xe656('0x3'))(new Redis(config[_0xe656('0x2')]));function FaxQueue(_0x2b725b){this['id']=_0x2b725b['id']||0x0;this[_0xe656('0x4')]=_0x2b725b[_0xe656('0x4')]||'';this[_0xe656('0x5')]=_0x2b725b[_0xe656('0x5')]||0xa;this[_0xe656('0x6')]=_0x2b725b[_0xe656('0x6')]||_0xe656('0x7');this[_0xe656('0x8')]=_0x2b725b['Agents'];this[_0xe656('0x9')]={};this[_0xe656('0xa')]=0x0;this[_0xe656('0xb')]='';this[_0xe656('0xc')]();this[_0xe656('0xd')]();}FaxQueue[_0xe656('0xe')][_0xe656('0xc')]=function(){var _0x4b6272=this[_0xe656('0x9')][_0xe656('0xf')];this['mapAgentsId']=_[_0xe656('0x10')](this['Agents'],'id');this[_0xe656('0x9')][_0xe656('0xf')]=_0x4b6272;};FaxQueue[_0xe656('0xe')][_0xe656('0xd')]=function(){this[_0xe656('0x11')]=0x0;this[_0xe656('0x12')]=0x0;for(var _0x2f62c7=0x0;_0x2f62c7=0x0?this[_0xe656('0x15')]:0x0;var _0x4f1e99={'id':this['id'],'available':this[_0xe656('0x15')],'loggedIn':this[_0xe656('0x11')],'name':this['name'],'paused':this[_0xe656('0x12')],'waiting':this['waiting']};var _0x132942=md5(JSON['stringify'](_0x4f1e99));if(this[_0xe656('0xb')]!==_0x132942){this[_0xe656('0xb')]=_0x132942;io['to'](util[_0xe656('0x16')](_0xe656('0x17'),_0x4f1e99['name']))[_0xe656('0x18')](_0xe656('0x19'),_0x4f1e99);}};module[_0xe656('0x1a')]=FaxQueue; \ No newline at end of file +var _0xaf56=['mapAgentsId','waiting','md5','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','name','timeout','strategy','beepall','Agents'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xaf56,0x65));var _0x6af5=function(_0x239a37,_0x1675c8){_0x239a37=_0x239a37-0x0;var _0x46db3c=_0xaf56[_0x239a37];return _0x46db3c;};'use strict';var _=require(_0x6af5('0x0'));var md5=require('md5');var util=require(_0x6af5('0x1'));var Redis=require(_0x6af5('0x2'));var config=require(_0x6af5('0x3'));config['redis']=_[_0x6af5('0x4')](config[_0x6af5('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6af5('0x5')]));function FaxQueue(_0x2f04f9){this['id']=_0x2f04f9['id']||0x0;this[_0x6af5('0x6')]=_0x2f04f9[_0x6af5('0x6')]||'';this[_0x6af5('0x7')]=_0x2f04f9[_0x6af5('0x7')]||0xa;this[_0x6af5('0x8')]=_0x2f04f9['strategy']||_0x6af5('0x9');this[_0x6af5('0xa')]=_0x2f04f9[_0x6af5('0xa')];this[_0x6af5('0xb')]={};this[_0x6af5('0xc')]=0x0;this[_0x6af5('0xd')]='';this[_0x6af5('0xe')]();this[_0x6af5('0xf')]();}FaxQueue['prototype'][_0x6af5('0xe')]=function(){var _0x5cd867=this[_0x6af5('0xb')][_0x6af5('0x10')];this[_0x6af5('0xb')]=_[_0x6af5('0x11')](this[_0x6af5('0xa')],'id');this[_0x6af5('0xb')][_0x6af5('0x10')]=_0x5cd867;};FaxQueue['prototype'][_0x6af5('0xf')]=function(){this[_0x6af5('0x12')]=0x0;this[_0x6af5('0x13')]=0x0;for(var _0x308ea3=0x0;_0x308ea3=0x0?this[_0x6af5('0x17')]:0x0;var _0x26e452={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6af5('0x12')],'name':this['name'],'paused':this[_0x6af5('0x13')],'waiting':this[_0x6af5('0xc')]};var _0xb59d49=md5(JSON[_0x6af5('0x18')](_0x26e452));if(this['md5']!==_0xb59d49){this[_0x6af5('0xd')]=_0xb59d49;io['to'](util[_0x6af5('0x19')](_0x6af5('0x1a'),_0x26e452[_0x6af5('0x6')]))['emit']('fax_queue:save',_0x26e452);}};module[_0x6af5('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 743313c..9e8ebf3 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 _0xdfbd=['Intervals','name'];(function(_0x48f8e6,_0x25485a){var _0x47cea6=function(_0x21c182){while(--_0x21c182){_0x48f8e6['push'](_0x48f8e6['shift']());}};_0x47cea6(++_0x25485a);}(_0xdfbd,0x135));var _0xddfb=function(_0x36d2c7,_0x88912e){_0x36d2c7=_0x36d2c7-0x0;var _0x5d1e31=_0xdfbd[_0x36d2c7];return _0x5d1e31;};'use strict';function Interval(_0x47e50d){this['id']=_0x47e50d['id']||0x0;this[_0xddfb('0x0')]=_0x47e50d['name']||'';this['Intervals']=_0x47e50d[_0xddfb('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xf3db=['exports','name','Intervals'];(function(_0x4f42db,_0x5d1f80){var _0xa64249=function(_0x5af531){while(--_0x5af531){_0x4f42db['push'](_0x4f42db['shift']());}};_0xa64249(++_0x5d1f80);}(_0xf3db,0xa0));var _0xbf3d=function(_0x36b597,_0x2f71e3){_0x36b597=_0x36b597-0x0;var _0x30eed3=_0xf3db[_0x36b597];return _0x30eed3;};'use strict';function Interval(_0x4ed556){this['id']=_0x4ed556['id']||0x0;this['name']=_0x4ed556[_0xbf3d('0x0')]||'';this[_0xbf3d('0x1')]=_0x4ed556['Intervals']||{};}module[_0xbf3d('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 0d09c98..7e57567 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 _0xe770=['paused','length','online','mailPause','available','stringify','format','mail:queue:%s','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','_rr','map','loggedIn'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe770,0xd4));var _0x0e77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe770[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0e77('0x0'));var md5=require('md5');var util=require(_0x0e77('0x1'));var Redis=require(_0x0e77('0x2'));var config=require(_0x0e77('0x3'));config['redis']=_[_0x0e77('0x4')](config[_0x0e77('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x0e77('0x6'))(new Redis(config[_0x0e77('0x5')]));function MailQueue(_0x1db331){this['id']=_0x1db331['id']||0x0;this[_0x0e77('0x7')]=_0x1db331[_0x0e77('0x7')]||'';this[_0x0e77('0x8')]=_0x1db331[_0x0e77('0x8')]||0xa;this[_0x0e77('0x9')]=_0x1db331[_0x0e77('0x9')]||_0x0e77('0xa');this[_0x0e77('0xb')]=_0x1db331[_0x0e77('0xb')];this[_0x0e77('0xc')]={};this[_0x0e77('0xd')]=0x0;this[_0x0e77('0xe')]='';this[_0x0e77('0xf')]();this[_0x0e77('0x10')]();}MailQueue['prototype'][_0x0e77('0xf')]=function(){var _0x35cec1=this[_0x0e77('0xc')][_0x0e77('0x11')];this[_0x0e77('0xc')]=_[_0x0e77('0x12')](this[_0x0e77('0xb')],'id');this[_0x0e77('0xc')][_0x0e77('0x11')]=_0x35cec1;};MailQueue['prototype'][_0x0e77('0x10')]=function(){this[_0x0e77('0x13')]=0x0;this[_0x0e77('0x14')]=0x0;for(var _0x4e4a51=0x0;_0x4e4a51=0x0?this['available']:0x0;var _0xc636d1={'id':this['id'],'available':this[_0x0e77('0x18')],'loggedIn':this[_0x0e77('0x13')],'name':this[_0x0e77('0x7')],'paused':this[_0x0e77('0x14')],'waiting':this[_0x0e77('0xd')]};var _0x56a2b8=md5(JSON[_0x0e77('0x19')](_0xc636d1));if(this[_0x0e77('0xe')]!==_0x56a2b8){this[_0x0e77('0xe')]=_0x56a2b8;io['to'](util[_0x0e77('0x1a')](_0x0e77('0x1b'),_0xc636d1['name']))['emit']('mail_queue:save',_0xc636d1);}};module[_0x0e77('0x1c')]=MailQueue; \ No newline at end of file +var _0x5347=['name','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','updateRouting','mapAgentsId','_rr','prototype','updateRealtime','loggedIn','paused','online','mailPause','available','waiting','stringify','format','mail:queue:%s'];(function(_0x1e5a8e,_0x5b6e70){var _0x141229=function(_0x24eed4){while(--_0x24eed4){_0x1e5a8e['push'](_0x1e5a8e['shift']());}};_0x141229(++_0x5b6e70);}(_0x5347,0xaa));var _0x7534=function(_0x32146e,_0x2be230){_0x32146e=_0x32146e-0x0;var _0x375cc7=_0x5347[_0x32146e];return _0x375cc7;};'use strict';var _=require('lodash');var md5=require(_0x7534('0x0'));var util=require(_0x7534('0x1'));var Redis=require(_0x7534('0x2'));var config=require(_0x7534('0x3'));config[_0x7534('0x4')]=_[_0x7534('0x5')](config['redis'],{'host':_0x7534('0x6'),'port':0x18eb});var io=require(_0x7534('0x7'))(new Redis(config[_0x7534('0x4')]));function MailQueue(_0x3d4997){this['id']=_0x3d4997['id']||0x0;this['name']=_0x3d4997['name']||'';this['timeout']=_0x3d4997[_0x7534('0x8')]||0xa;this[_0x7534('0x9')]=_0x3d4997['strategy']||_0x7534('0xa');this['Agents']=_0x3d4997[_0x7534('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x7534('0x0')]='';this['updateRouting']();this['updateRealtime']();}MailQueue['prototype'][_0x7534('0xc')]=function(){var _0x431649=this[_0x7534('0xd')][_0x7534('0xe')];this[_0x7534('0xd')]=_['map'](this[_0x7534('0xb')],'id');this[_0x7534('0xd')][_0x7534('0xe')]=_0x431649;};MailQueue[_0x7534('0xf')][_0x7534('0x10')]=function(){this[_0x7534('0x11')]=0x0;this[_0x7534('0x12')]=0x0;for(var _0x8e77f5=0x0;_0x8e77f5=0x0?this['available']:0x0;var _0x458c58={'id':this['id'],'available':this['available'],'loggedIn':this[_0x7534('0x11')],'name':this['name'],'paused':this[_0x7534('0x12')],'waiting':this[_0x7534('0x16')]};var _0x586537=md5(JSON[_0x7534('0x17')](_0x458c58));if(this[_0x7534('0x0')]!==_0x586537){this[_0x7534('0x0')]=_0x586537;io['to'](util[_0x7534('0x18')](_0x7534('0x19'),_0x458c58[_0x7534('0x1a')]))['emit']('mail_queue:save',_0x458c58);}};module[_0x7534('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index d952b17..8a1535e 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x23c16c,_0x522c6d){var _0x49d96b=function(_0x54d7c9){while(--_0x54d7c9){_0x23c16c['push'](_0x23c16c['shift']());}};_0x49d96b(++_0x522c6d);}(_0x814b,0x1a2));var _0xb814=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x814b[_0x5f0089];return _0x193892;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x326f,0xd1));var _0xf326=function(_0x33ff5f,_0x13ac7e){_0x33ff5f=_0x33ff5f-0x0;var _0x306d44=_0x326f[_0x33ff5f];return _0x306d44;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 4dcb080..4157479 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 _0xbf5c=['sms_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','available','waiting','stringify','format'];(function(_0x1e024d,_0x5e1028){var _0x40d9b5=function(_0x4f0c14){while(--_0x4f0c14){_0x1e024d['push'](_0x1e024d['shift']());}};_0x40d9b5(++_0x5e1028);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x2cd328,_0x4b96b3){_0x2cd328=_0x2cd328-0x0;var _0x157490=_0xbf5c[_0x2cd328];return _0x157490;};'use strict';var _=require(_0xcbf5('0x0'));var md5=require(_0xcbf5('0x1'));var util=require(_0xcbf5('0x2'));var Redis=require('ioredis');var config=require(_0xcbf5('0x3'));config[_0xcbf5('0x4')]=_[_0xcbf5('0x5')](config['redis'],{'host':_0xcbf5('0x6'),'port':0x18eb});var io=require(_0xcbf5('0x7'))(new Redis(config['redis']));function SmsQueue(_0x3457d0){this['id']=_0x3457d0['id']||0x0;this[_0xcbf5('0x8')]=_0x3457d0[_0xcbf5('0x8')]||'';this['timeout']=_0x3457d0[_0xcbf5('0x9')]||0xa;this[_0xcbf5('0xa')]=_0x3457d0['strategy']||'beepall';this[_0xcbf5('0xb')]=_0x3457d0[_0xcbf5('0xb')];this[_0xcbf5('0xc')]={};this['waiting']=0x0;this[_0xcbf5('0x1')]='';this[_0xcbf5('0xd')]();this[_0xcbf5('0xe')]();}SmsQueue[_0xcbf5('0xf')][_0xcbf5('0xd')]=function(){var _0x248575=this['mapAgentsId'][_0xcbf5('0x10')];this[_0xcbf5('0xc')]=_[_0xcbf5('0x11')](this['Agents'],'id');this['mapAgentsId'][_0xcbf5('0x10')]=_0x248575;};SmsQueue['prototype'][_0xcbf5('0xe')]=function(){this[_0xcbf5('0x12')]=0x0;this[_0xcbf5('0x13')]=0x0;for(var _0x2e7536=0x0;_0x2e7536=0x0?this[_0xcbf5('0x14')]:0x0;var _0x53939d={'id':this['id'],'available':this[_0xcbf5('0x14')],'loggedIn':this[_0xcbf5('0x12')],'name':this[_0xcbf5('0x8')],'paused':this[_0xcbf5('0x13')],'waiting':this[_0xcbf5('0x15')]};var _0x3b3022=md5(JSON[_0xcbf5('0x16')](_0x53939d));if(this[_0xcbf5('0x1')]!==_0x3b3022){this['md5']=_0x3b3022;io['to'](util[_0xcbf5('0x17')]('sms:queue:%s',_0x53939d[_0xcbf5('0x8')]))['emit'](_0xcbf5('0x18'),_0x53939d);}};module[_0xcbf5('0x19')]=SmsQueue; \ No newline at end of file +var _0x9f62=['sms:queue:%s','emit','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','waiting','prototype','updateRouting','mapAgentsId','_rr','updateRealtime','loggedIn','paused','Agents','length','online','smsPause','available','stringify','format'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x9f62,0x154));var _0x29f6=function(_0x1e2313,_0x54df1b){_0x1e2313=_0x1e2313-0x0;var _0x41243f=_0x9f62[_0x1e2313];return _0x41243f;};'use strict';var _=require('lodash');var md5=require(_0x29f6('0x0'));var util=require('util');var Redis=require(_0x29f6('0x1'));var config=require(_0x29f6('0x2'));config[_0x29f6('0x3')]=_['defaults'](config['redis'],{'host':_0x29f6('0x4'),'port':0x18eb});var io=require(_0x29f6('0x5'))(new Redis(config[_0x29f6('0x3')]));function SmsQueue(_0x1e71ac){this['id']=_0x1e71ac['id']||0x0;this['name']=_0x1e71ac[_0x29f6('0x6')]||'';this[_0x29f6('0x7')]=_0x1e71ac[_0x29f6('0x7')]||0xa;this[_0x29f6('0x8')]=_0x1e71ac[_0x29f6('0x8')]||'beepall';this['Agents']=_0x1e71ac['Agents'];this['mapAgentsId']={};this[_0x29f6('0x9')]=0x0;this[_0x29f6('0x0')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0x29f6('0xa')][_0x29f6('0xb')]=function(){var _0x4909e0=this[_0x29f6('0xc')][_0x29f6('0xd')];this['mapAgentsId']=_['map'](this['Agents'],'id');this['mapAgentsId'][_0x29f6('0xd')]=_0x4909e0;};SmsQueue[_0x29f6('0xa')][_0x29f6('0xe')]=function(){this[_0x29f6('0xf')]=0x0;this[_0x29f6('0x10')]=0x0;for(var _0x156c96=0x0;_0x156c96=0x0?this[_0x29f6('0x15')]:0x0;var _0x3af478={'id':this['id'],'available':this[_0x29f6('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x29f6('0x6')],'paused':this[_0x29f6('0x10')],'waiting':this['waiting']};var _0x159227=md5(JSON[_0x29f6('0x16')](_0x3af478));if(this[_0x29f6('0x0')]!==_0x159227){this[_0x29f6('0x0')]=_0x159227;io['to'](util[_0x29f6('0x17')](_0x29f6('0x18'),_0x3af478['name']))[_0x29f6('0x19')]('sms_queue:save',_0x3af478);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index f4eb8d7..81f5eea 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 _0x126e=['available','waiting','format','whatsapp:queue:%s','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','whatsappPause'];(function(_0x99e0b5,_0x371bba){var _0x1791ba=function(_0x57b446){while(--_0x57b446){_0x99e0b5['push'](_0x99e0b5['shift']());}};_0x1791ba(++_0x371bba);}(_0x126e,0x1d6));var _0xe126=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x126e[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var md5=require(_0xe126('0x0'));var util=require(_0xe126('0x1'));var Redis=require(_0xe126('0x2'));var config=require(_0xe126('0x3'));config[_0xe126('0x4')]=_[_0xe126('0x5')](config[_0xe126('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xe126('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x24593c){this['id']=_0x24593c['id']||0x0;this[_0xe126('0x7')]=_0x24593c[_0xe126('0x7')]||'';this[_0xe126('0x8')]=_0x24593c[_0xe126('0x8')]||0xa;this['strategy']=_0x24593c[_0xe126('0x9')]||_0xe126('0xa');this[_0xe126('0xb')]=_0x24593c[_0xe126('0xb')];this[_0xe126('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0xe126('0xd')]();this[_0xe126('0xe')]();}WhatsappQueue['prototype'][_0xe126('0xd')]=function(){var _0x5078f0=this[_0xe126('0xc')][_0xe126('0xf')];this['mapAgentsId']=_[_0xe126('0x10')](this['Agents'],'id');this[_0xe126('0xc')][_0xe126('0xf')]=_0x5078f0;};WhatsappQueue[_0xe126('0x11')][_0xe126('0xe')]=function(){this[_0xe126('0x12')]=0x0;this[_0xe126('0x13')]=0x0;for(var _0xf0a586=0x0;_0xf0a586=0x0?this['available']:0x0;var _0x4e1a18={'id':this['id'],'available':this[_0xe126('0x17')],'loggedIn':this[_0xe126('0x12')],'name':this[_0xe126('0x7')],'paused':this[_0xe126('0x13')],'waiting':this[_0xe126('0x18')]};var _0x17c680=md5(JSON['stringify'](_0x4e1a18));if(this[_0xe126('0x0')]!==_0x17c680){this[_0xe126('0x0')]=_0x17c680;io['to'](util[_0xe126('0x19')](_0xe126('0x1a'),_0x4e1a18['name']))['emit'](_0xe126('0x1b'),_0x4e1a18);}};module[_0xe126('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x0f1e=['length','online','whatsappPause','paused','available','waiting','md5','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','ioredis','redis','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f1e,0x80));var _0xe0f1=function(_0x14bf66,_0x3e1066){_0x14bf66=_0x14bf66-0x0;var _0xaf4bf7=_0x0f1e[_0x14bf66];return _0xaf4bf7;};'use strict';var _=require(_0xe0f1('0x0'));var md5=require('md5');var util=require(_0xe0f1('0x1'));var Redis=require(_0xe0f1('0x2'));var config=require('../../../config/environment');config[_0xe0f1('0x3')]=_['defaults'](config[_0xe0f1('0x3')],{'host':_0xe0f1('0x4'),'port':0x18eb});var io=require(_0xe0f1('0x5'))(new Redis(config[_0xe0f1('0x3')]));function WhatsappQueue(_0x2ccc0f){this['id']=_0x2ccc0f['id']||0x0;this[_0xe0f1('0x6')]=_0x2ccc0f[_0xe0f1('0x6')]||'';this['timeout']=_0x2ccc0f['timeout']||0xa;this[_0xe0f1('0x7')]=_0x2ccc0f[_0xe0f1('0x7')]||_0xe0f1('0x8');this[_0xe0f1('0x9')]=_0x2ccc0f[_0xe0f1('0x9')];this[_0xe0f1('0xa')]={};this['waiting']=0x0;this['md5']='';this[_0xe0f1('0xb')]();this[_0xe0f1('0xc')]();}WhatsappQueue[_0xe0f1('0xd')][_0xe0f1('0xb')]=function(){var _0x2c0f1b=this['mapAgentsId'][_0xe0f1('0xe')];this['mapAgentsId']=_[_0xe0f1('0xf')](this[_0xe0f1('0x9')],'id');this['mapAgentsId'][_0xe0f1('0xe')]=_0x2c0f1b;};WhatsappQueue[_0xe0f1('0xd')][_0xe0f1('0xc')]=function(){this[_0xe0f1('0x10')]=0x0;this['paused']=0x0;for(var _0xefca1c=0x0;_0xefca1c=0x0?this[_0xe0f1('0x15')]:0x0;var _0x138171={'id':this['id'],'available':this[_0xe0f1('0x15')],'loggedIn':this[_0xe0f1('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xe0f1('0x16')]};var _0x41649e=md5(JSON['stringify'](_0x138171));if(this[_0xe0f1('0x17')]!==_0x41649e){this[_0xe0f1('0x17')]=_0x41649e;io['to'](util[_0xe0f1('0x18')](_0xe0f1('0x19'),_0x138171[_0xe0f1('0x6')]))[_0xe0f1('0x1a')](_0xe0f1('0x1b'),_0x138171);}};module[_0xe0f1('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 7d3c071..f1d263a 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 8d0d399..9b5c292 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 _0xe4ae=['update','Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x7a6aed,_0x335e68){var _0x9dbabf=function(_0x453c9c){while(--_0x453c9c){_0x7a6aed['push'](_0x7a6aed['shift']());}};_0x9dbabf(++_0x335e68);}(_0xe4ae,0xbc));var _0xee4a=function(_0x4b2550,_0x149925){_0x4b2550=_0x4b2550-0x0;var _0x28cafd=_0xe4ae[_0x4b2550];return _0x28cafd;};'use strict';var client=require(_0xee4a('0x0'));exports[_0xee4a('0x1')]=function(_0x23fca8,_0x3fe49e){return client[_0xee4a('0x2')](_0xee4a('0x3'),{'body':_0x3fe49e,'options':{'where':{'id':_0x23fca8}},'log':_0xee4a('0x4')});};exports['addTags']=function(_0x44aec0,_0x7ecefd){return client[_0xee4a('0x2')](_0xee4a('0x5'),{'body':_0x7ecefd,'options':{'where':{'id':_0x44aec0}},'log':_0xee4a('0x6')});}; \ No newline at end of file +var _0x76e6=['UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76e6,0xb9));var _0x676e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x76e6[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports['update']=function(_0x556cb2,_0x25dbaf){return client[_0x676e('0x0')](_0x676e('0x1'),{'body':_0x25dbaf,'options':{'where':{'id':_0x556cb2}},'log':_0x676e('0x2')});};exports[_0x676e('0x3')]=function(_0x30ddd3,_0xf7fd9c){return client[_0x676e('0x0')](_0x676e('0x4'),{'body':_0xf7fd9c,'options':{'where':{'id':_0x30ddd3}},'log':_0x676e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 2a0c854..4ca44d9 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 _0xaa05=['createChatMessage','create','Request','CreateChatMessage'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xaa05,0x131));var _0x5aa0=function(_0x18fb16,_0x45edbc){_0x18fb16=_0x18fb16-0x0;var _0x147b0d=_0xaa05[_0x18fb16];return _0x147b0d;};'use strict';var client=require('../client');exports[_0x5aa0('0x0')]=function(_0xb9622f){return client[_0x5aa0('0x1')](_0x5aa0('0x2'),{'body':_0xb9622f,'log':_0x5aa0('0x3')});}; \ No newline at end of file +var _0xa896=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x169045,_0x36511c){var _0x5a78ef=function(_0x21ccd0){while(--_0x21ccd0){_0x169045['push'](_0x169045['shift']());}};_0x5a78ef(++_0x36511c);}(_0xa896,0x145));var _0x6a89=function(_0x1fba11,_0x502525){_0x1fba11=_0x1fba11-0x0;var _0x46f1c1=_0xa896[_0x1fba11];return _0x46f1c1;};'use strict';var client=require(_0x6a89('0x0'));exports[_0x6a89('0x1')]=function(_0x2e2601){return client[_0x6a89('0x2')](_0x6a89('0x3'),{'body':_0x2e2601,'log':_0x6a89('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 1825873..f74cb9a 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 _0x7266=['name','User','Agents','chatPause','../client','getChatQueues','Request','GetChatQueue'];(function(_0x79cd47,_0x16102d){var _0x3b9484=function(_0x23db95){while(--_0x23db95){_0x79cd47['push'](_0x79cd47['shift']());}};_0x3b9484(++_0x16102d);}(_0x7266,0xec));var _0x6726=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x7266[_0x46aff0];return _0x9d78cf;};'use strict';var client=require(_0x6726('0x0'));exports[_0x6726('0x1')]=function(){return function(){return client[_0x6726('0x2')](_0x6726('0x3'),{'options':{'raw':![],'attributes':['id',_0x6726('0x4'),'timeout','strategy'],'include':[{'model':_0x6726('0x5'),'as':_0x6726('0x6'),'attributes':['id','name','online',_0x6726('0x7')]}]},'log':_0x6726('0x1')});};}; \ No newline at end of file +var _0x41d9=['chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy','Agents'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0x41d9,0x13c));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x941d('0x0'));exports[_0x941d('0x1')]=function(){return function(){return client[_0x941d('0x2')](_0x941d('0x3'),{'options':{'raw':![],'attributes':['id',_0x941d('0x4'),_0x941d('0x5'),_0x941d('0x6')],'include':[{'model':'User','as':_0x941d('0x7'),'attributes':['id',_0x941d('0x4'),'online',_0x941d('0x8')]}]},'log':_0x941d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 26d4adc..563f568 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 _0x684d=['create','Request','CreateChatQueueReport','DESC'];(function(_0x219b41,_0x30d3b4){var _0x421198=function(_0x5346b6){while(--_0x5346b6){_0x219b41['push'](_0x219b41['shift']());}};_0x421198(++_0x30d3b4);}(_0x684d,0x174));var _0xd684=function(_0xa61ffa,_0x534965){_0xa61ffa=_0xa61ffa-0x0;var _0x2566c2=_0x684d[_0xa61ffa];return _0x2566c2;};'use strict';var client=require('../client');exports[_0xd684('0x0')]=function(_0x33830c){return client[_0xd684('0x1')]('CreateChatQueueReport',{'body':_0x33830c,'log':_0xd684('0x2')});};exports['update']=function(_0x20d7ea,_0x1d505b){return client[_0xd684('0x1')]('UpdateChatQueueReport',{'body':_0x1d505b,'options':{'where':{'uniqueid':_0x20d7ea},'order':[['id',_0xd684('0x3')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x3645=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','create','Request'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x3645,0x154));var _0x5364=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0x3645[_0x324012];return _0x435cf2;};'use strict';var client=require('../client');exports[_0x5364('0x0')]=function(_0x12217b){return client[_0x5364('0x1')](_0x5364('0x2'),{'body':_0x12217b,'log':_0x5364('0x2')});};exports[_0x5364('0x3')]=function(_0x3c0f77,_0x5a63bf){return client[_0x5364('0x1')](_0x5364('0x4'),{'body':_0x5a63bf,'options':{'where':{'uniqueid':_0x3c0f77},'order':[['id',_0x5364('0x5')]],'limit':0x1},'log':_0x5364('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index eef878c..d86068d 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x5ba200,_0x189ee6){var _0x103fb4=function(_0x1d9b17){while(--_0x1d9b17){_0x5ba200['push'](_0x5ba200['shift']());}};_0x103fb4(++_0x189ee6);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x7a54,0x106));var _0x47a5=function(_0x352868,_0xaedf7b){_0x352868=_0x352868-0x0;var _0x42821d=_0x7a54[_0x352868];return _0x42821d;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index ea16dbc..af025ba 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 _0x922d=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x922d,0x189));var _0xd922=function(_0x51b546,_0x538a76){_0x51b546=_0x51b546-0x0;var _0x5e3ecb=_0x922d[_0x51b546];return _0x5e3ecb;};'use strict';var client=require(_0xd922('0x0'));exports[_0xd922('0x1')]=function(_0x453390){return client[_0xd922('0x2')](_0xd922('0x3'),{'body':_0x453390,'log':_0xd922('0x4')});}; \ No newline at end of file +var _0xe2ae=['../client','create','CreateFaxMessage','createFaxMessage'];(function(_0x5548ad,_0x1c7bd8){var _0x4d0d3d=function(_0x298286){while(--_0x298286){_0x5548ad['push'](_0x5548ad['shift']());}};_0x4d0d3d(++_0x1c7bd8);}(_0xe2ae,0x154));var _0xee2a=function(_0xe5f6c,_0x438095){_0xe5f6c=_0xe5f6c-0x0;var _0x4c2a1a=_0xe2ae[_0xe5f6c];return _0x4c2a1a;};'use strict';var client=require(_0xee2a('0x0'));exports[_0xee2a('0x1')]=function(_0x45b09b){return client['Request'](_0xee2a('0x2'),{'body':_0x45b09b,'log':_0xee2a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index cd8c675..6864639 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 _0xb579=['timeout','strategy','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name'];(function(_0xdf92c4,_0x3aaecc){var _0x25b3fb=function(_0x2279d7){while(--_0x2279d7){_0xdf92c4['push'](_0xdf92c4['shift']());}};_0x25b3fb(++_0x3aaecc);}(_0xb579,0xeb));var _0x9b57=function(_0x28682c,_0x14f8dc){_0x28682c=_0x28682c-0x0;var _0x4daae0=_0xb579[_0x28682c];return _0x4daae0;};'use strict';var client=require(_0x9b57('0x0'));exports[_0x9b57('0x1')]=function(){return function(){return client[_0x9b57('0x2')](_0x9b57('0x3'),{'options':{'raw':![],'attributes':['id',_0x9b57('0x4'),_0x9b57('0x5'),_0x9b57('0x6')],'include':[{'model':'User','as':_0x9b57('0x7'),'attributes':['id',_0x9b57('0x4'),_0x9b57('0x8'),_0x9b57('0x9')]}]},'log':_0x9b57('0x1')});};}; \ No newline at end of file +var _0x6c77=['../client','Request','name','strategy','Agents','online','faxPause','getFaxQueues'];(function(_0x53f897,_0x539857){var _0x6879f8=function(_0xa3c36){while(--_0xa3c36){_0x53f897['push'](_0x53f897['shift']());}};_0x6879f8(++_0x539857);}(_0x6c77,0x108));var _0x76c7=function(_0x31d03c,_0x158cef){_0x31d03c=_0x31d03c-0x0;var _0x420e61=_0x6c77[_0x31d03c];return _0x420e61;};'use strict';var client=require(_0x76c7('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x76c7('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x76c7('0x2'),'timeout',_0x76c7('0x3')],'include':[{'model':'User','as':_0x76c7('0x4'),'attributes':['id',_0x76c7('0x2'),_0x76c7('0x5'),_0x76c7('0x6')]}]},'log':_0x76c7('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 6d7c8b6..8c4f272 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 _0x416b=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x406571,_0x1d66aa){var _0x4280f9=function(_0x4611ea){while(--_0x4611ea){_0x406571['push'](_0x406571['shift']());}};_0x4280f9(++_0x1d66aa);}(_0x416b,0x1d9));var _0xb416=function(_0x42f0d1,_0x45fe4a){_0x42f0d1=_0x42f0d1-0x0;var _0x43f981=_0x416b[_0x42f0d1];return _0x43f981;};'use strict';var client=require(_0xb416('0x0'));exports[_0xb416('0x1')]=function(_0x408c68){return client[_0xb416('0x2')](_0xb416('0x3'),{'body':_0x408c68,'log':'CreateFaxQueueReport'});};exports[_0xb416('0x4')]=function(_0x3d93cb,_0x742fc5){return client[_0xb416('0x2')](_0xb416('0x5'),{'body':_0x742fc5,'options':{'where':{'uniqueid':_0x3d93cb},'order':[['id',_0xb416('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x8cb8=['DESC','../client','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x5008e0,_0x149f6e){var _0x172e82=function(_0x2a4ee8){while(--_0x2a4ee8){_0x5008e0['push'](_0x5008e0['shift']());}};_0x172e82(++_0x149f6e);}(_0x8cb8,0x1dc));var _0x88cb=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0x8cb8[_0x7791d5];return _0x5ce288;};'use strict';var client=require(_0x88cb('0x0'));exports['create']=function(_0x59b648){return client[_0x88cb('0x1')]('CreateFaxQueueReport',{'body':_0x59b648,'log':_0x88cb('0x2')});};exports['update']=function(_0xe96d9c,_0x2128b6){return client[_0x88cb('0x1')](_0x88cb('0x3'),{'body':_0x2128b6,'options':{'where':{'uniqueid':_0xe96d9c},'order':[['id',_0x88cb('0x4')]],'limit':0x1},'log':_0x88cb('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 2ca9f2b..8867c59 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 _0x1aac=['getIntervals','GetInterval','Interval','Intervals','name','../client'];(function(_0x1a3173,_0x448397){var _0x136e31=function(_0x547dac){while(--_0x547dac){_0x1a3173['push'](_0x1a3173['shift']());}};_0x136e31(++_0x448397);}(_0x1aac,0x1e5));var _0xc1aa=function(_0x5eb0bb,_0x23a3ab){_0x5eb0bb=_0x5eb0bb-0x0;var _0x11712e=_0x1aac[_0x5eb0bb];return _0x11712e;};'use strict';var client=require(_0xc1aa('0x0'));exports[_0xc1aa('0x1')]=function(){return function(){return client['Request'](_0xc1aa('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xc1aa('0x3'),'as':_0xc1aa('0x4'),'attributes':['id',_0xc1aa('0x5'),'interval']}]},'log':_0xc1aa('0x1')});};}; \ No newline at end of file +var _0xd3ec=['interval','../client','getIntervals','Request','GetInterval','Interval','Intervals','name'];(function(_0x3bb96c,_0x3ea07e){var _0x2a0823=function(_0x5bf3d4){while(--_0x5bf3d4){_0x3bb96c['push'](_0x3bb96c['shift']());}};_0x2a0823(++_0x3ea07e);}(_0xd3ec,0x1b1));var _0xcd3e=function(_0x50bc00,_0x487e3a){_0x50bc00=_0x50bc00-0x0;var _0x34a166=_0xd3ec[_0x50bc00];return _0x34a166;};'use strict';var client=require(_0xcd3e('0x0'));exports[_0xcd3e('0x1')]=function(){return function(){return client[_0xcd3e('0x2')](_0xcd3e('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xcd3e('0x4'),'as':_0xcd3e('0x5'),'attributes':['id',_0xcd3e('0x6'),_0xcd3e('0x7')]}]},'log':_0xcd3e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 4e050cb..d547247 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 _0xeb3b=['../client','update','Request','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x3e5b77,_0x281e90){var _0x6d96b0=function(_0x272520){while(--_0x272520){_0x3e5b77['push'](_0x3e5b77['shift']());}};_0x6d96b0(++_0x281e90);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x4a2718,_0x2b8edb){_0x4a2718=_0x4a2718-0x0;var _0x41cddf=_0xeb3b[_0x4a2718];return _0x41cddf;};'use strict';var client=require(_0xbeb3('0x0'));exports[_0xbeb3('0x1')]=function(_0xc5aaa3,_0x33e049){return client[_0xbeb3('0x2')]('UpdateMailInteraction',{'body':_0x33e049,'options':{'where':{'id':_0xc5aaa3}},'log':'updateMailInteraction'});};exports[_0xbeb3('0x3')]=function(_0x5b0e3b,_0x2e8ce3){return client['Request'](_0xbeb3('0x4'),{'body':_0x2e8ce3,'options':{'where':{'id':_0x5b0e3b}},'log':_0xbeb3('0x5')});}; \ No newline at end of file +var _0x1a85=['AddTagsToMailInteraction','Request','addTags'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1a85,0x178));var _0x51a8=function(_0xc9df8b,_0x21744d){_0xc9df8b=_0xc9df8b-0x0;var _0x35ca5d=_0x1a85[_0xc9df8b];return _0x35ca5d;};'use strict';var client=require('../client');exports['update']=function(_0x305f18,_0x382cb8){return client[_0x51a8('0x0')]('UpdateMailInteraction',{'body':_0x382cb8,'options':{'where':{'id':_0x305f18}},'log':'updateMailInteraction'});};exports[_0x51a8('0x1')]=function(_0x1377a4,_0x99e371){return client['Request'](_0x51a8('0x2'),{'body':_0x99e371,'options':{'where':{'id':_0x1377a4}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 220bb57..804ab3c 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 _0xdc91=['../client','create','Request'];(function(_0x506172,_0xbc3a3){var _0x2723c0=function(_0x57c3d9){while(--_0x57c3d9){_0x506172['push'](_0x506172['shift']());}};_0x2723c0(++_0xbc3a3);}(_0xdc91,0x96));var _0x1dc9=function(_0x352607,_0x6ac8fa){_0x352607=_0x352607-0x0;var _0x5fd4fa=_0xdc91[_0x352607];return _0x5fd4fa;};'use strict';var client=require(_0x1dc9('0x0'));exports[_0x1dc9('0x1')]=function(_0x3bede4){return client[_0x1dc9('0x2')]('CreateMailMessage',{'body':_0x3bede4,'log':'createMailMessage'});}; \ No newline at end of file +var _0x7898=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x44a651,_0x2b0fe9){var _0x21f577=function(_0x5a318d){while(--_0x5a318d){_0x44a651['push'](_0x44a651['shift']());}};_0x21f577(++_0x2b0fe9);}(_0x7898,0x13f));var _0x8789=function(_0x8969c2,_0xc524b7){_0x8969c2=_0x8969c2-0x0;var _0x519f23=_0x7898[_0x8969c2];return _0x519f23;};'use strict';var client=require(_0x8789('0x0'));exports[_0x8789('0x1')]=function(_0x47e85a){return client[_0x8789('0x2')](_0x8789('0x3'),{'body':_0x47e85a,'log':_0x8789('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index a5561c3..7124a0a 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 _0x5520=['strategy','User','Agents','../client','getMailQueues','Request','GetMailQueue','name','timeout'];(function(_0x3afa05,_0x218828){var _0x1b4dbf=function(_0x2dcc33){while(--_0x2dcc33){_0x3afa05['push'](_0x3afa05['shift']());}};_0x1b4dbf(++_0x218828);}(_0x5520,0x18f));var _0x0552=function(_0x22f82a,_0x36ea1d){_0x22f82a=_0x22f82a-0x0;var _0x3abd49=_0x5520[_0x22f82a];return _0x3abd49;};'use strict';var client=require(_0x0552('0x0'));exports[_0x0552('0x1')]=function(){return function(){return client[_0x0552('0x2')](_0x0552('0x3'),{'options':{'raw':![],'attributes':['id',_0x0552('0x4'),_0x0552('0x5'),_0x0552('0x6')],'include':[{'model':_0x0552('0x7'),'as':_0x0552('0x8'),'attributes':['id','name','online','mailPause']}]},'log':_0x0552('0x1')});};}; \ No newline at end of file +var _0x3912=['../client','Request','GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause','getMailQueues'];(function(_0xe19622,_0x19c06b){var _0xe6c726=function(_0x1dc801){while(--_0x1dc801){_0xe19622['push'](_0xe19622['shift']());}};_0xe6c726(++_0x19c06b);}(_0x3912,0xdc));var _0x2391=function(_0x2e2bb5,_0x5de33d){_0x2e2bb5=_0x2e2bb5-0x0;var _0x4cee5a=_0x3912[_0x2e2bb5];return _0x4cee5a;};'use strict';var client=require(_0x2391('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x2391('0x1')](_0x2391('0x2'),{'options':{'raw':![],'attributes':['id',_0x2391('0x3'),_0x2391('0x4'),_0x2391('0x5')],'include':[{'model':_0x2391('0x6'),'as':_0x2391('0x7'),'attributes':['id','name',_0x2391('0x8'),_0x2391('0x9')]}]},'log':_0x2391('0xa')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index c4d99a4..45598e8 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 _0x2734=['Request','UpdateMailQueueReport','DESC','create','CreateMailQueueReport','update'];(function(_0x11a962,_0x3cc338){var _0x55d423=function(_0xf4b236){while(--_0xf4b236){_0x11a962['push'](_0x11a962['shift']());}};_0x55d423(++_0x3cc338);}(_0x2734,0x147));var _0x4273=function(_0x2f7e44,_0x11e11a){_0x2f7e44=_0x2f7e44-0x0;var _0x344d4a=_0x2734[_0x2f7e44];return _0x344d4a;};'use strict';var client=require('../client');exports[_0x4273('0x0')]=function(_0x3b4e3b){return client['Request'](_0x4273('0x1'),{'body':_0x3b4e3b,'log':_0x4273('0x1')});};exports[_0x4273('0x2')]=function(_0x27c349,_0xef32fb){return client[_0x4273('0x3')](_0x4273('0x4'),{'body':_0xef32fb,'options':{'where':{'uniqueid':_0x27c349},'order':[['id',_0x4273('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xca8b=['CreateMailQueueReport','update','UpdateMailQueueReport','../client','create','Request'];(function(_0x1f5046,_0x5948ef){var _0x3421bf=function(_0x19d243){while(--_0x19d243){_0x1f5046['push'](_0x1f5046['shift']());}};_0x3421bf(++_0x5948ef);}(_0xca8b,0xb7));var _0xbca8=function(_0x4d1ce0,_0x18c46d){_0x4d1ce0=_0x4d1ce0-0x0;var _0x5b8e64=_0xca8b[_0x4d1ce0];return _0x5b8e64;};'use strict';var client=require(_0xbca8('0x0'));exports[_0xbca8('0x1')]=function(_0x11274f){return client[_0xbca8('0x2')](_0xbca8('0x3'),{'body':_0x11274f,'log':'CreateMailQueueReport'});};exports[_0xbca8('0x4')]=function(_0x43f638,_0x473ab5){return client[_0xbca8('0x2')](_0xbca8('0x5'),{'body':_0x473ab5,'options':{'where':{'uniqueid':_0x43f638},'order':[['id','DESC']],'limit':0x1},'log':_0xbca8('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 5c0bb68..88170ef 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 _0xc2bd=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request','updateOpenchannelInteraction'];(function(_0x4528fa,_0x2abd6b){var _0x1bd2de=function(_0x1bdc12){while(--_0x1bdc12){_0x4528fa['push'](_0x4528fa['shift']());}};_0x1bd2de(++_0x2abd6b);}(_0xc2bd,0x1d7));var _0xdc2b=function(_0xfdf926,_0x49e41a){_0xfdf926=_0xfdf926-0x0;var _0x20d688=_0xc2bd[_0xfdf926];return _0x20d688;};'use strict';var client=require('../client');exports[_0xdc2b('0x0')]=function(_0x58654d,_0x192e74){return client[_0xdc2b('0x1')]('UpdateOpenchannelInteraction',{'body':_0x192e74,'options':{'where':{'id':_0x58654d}},'log':_0xdc2b('0x2')});};exports[_0xdc2b('0x3')]=function(_0x22eb9a,_0x53d417){return client[_0xdc2b('0x1')](_0xdc2b('0x4'),{'body':_0x53d417,'options':{'where':{'id':_0x22eb9a}},'log':_0xdc2b('0x5')});}; \ No newline at end of file +var _0x7f37=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x380c28,_0x25e1f5){var _0x14158d=function(_0x212b46){while(--_0x212b46){_0x380c28['push'](_0x380c28['shift']());}};_0x14158d(++_0x25e1f5);}(_0x7f37,0x1ed));var _0x77f3=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7f37[_0xfae23b];return _0x200640;};'use strict';var client=require(_0x77f3('0x0'));exports['update']=function(_0x130721,_0x386f46){return client[_0x77f3('0x1')](_0x77f3('0x2'),{'body':_0x386f46,'options':{'where':{'id':_0x130721}},'log':_0x77f3('0x3')});};exports[_0x77f3('0x4')]=function(_0x33c4c5,_0x62f4c){return client['Request'](_0x77f3('0x5'),{'body':_0x62f4c,'options':{'where':{'id':_0x33c4c5}},'log':_0x77f3('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 63fe9d9..c31dcdb 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 _0x62af=['create','Request','CreateOpenchannelMessage','../client'];(function(_0x5b369a,_0x242eb5){var _0x404a31=function(_0xf4bb24){while(--_0xf4bb24){_0x5b369a['push'](_0x5b369a['shift']());}};_0x404a31(++_0x242eb5);}(_0x62af,0x177));var _0xf62a=function(_0x577f7d,_0x3a17f0){_0x577f7d=_0x577f7d-0x0;var _0x5f5544=_0x62af[_0x577f7d];return _0x5f5544;};'use strict';var client=require(_0xf62a('0x0'));exports[_0xf62a('0x1')]=function(_0x5f4f1a){return client[_0xf62a('0x2')](_0xf62a('0x3'),{'body':_0x5f4f1a,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x00b0=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x5ee2bd,_0x76daab){var _0x509cba=function(_0x2fb21a){while(--_0x2fb21a){_0x5ee2bd['push'](_0x5ee2bd['shift']());}};_0x509cba(++_0x76daab);}(_0x00b0,0x75));var _0x000b=function(_0x34f508,_0x37fbba){_0x34f508=_0x34f508-0x0;var _0x24dd82=_0x00b0[_0x34f508];return _0x24dd82;};'use strict';var client=require(_0x000b('0x0'));exports[_0x000b('0x1')]=function(_0x1bf086){return client[_0x000b('0x2')](_0x000b('0x3'),{'body':_0x1bf086,'log':_0x000b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 043ae02..ddab749 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 _0x09de=['name','timeout','strategy','User','Agents','openchannelPause','../client','getOpenchannelQueues','Request'];(function(_0xca82a4,_0x407eb4){var _0x5eed21=function(_0x5d553e){while(--_0x5d553e){_0xca82a4['push'](_0xca82a4['shift']());}};_0x5eed21(++_0x407eb4);}(_0x09de,0xde));var _0xe09d=function(_0x1196b0,_0x36c47a){_0x1196b0=_0x1196b0-0x0;var _0x111c52=_0x09de[_0x1196b0];return _0x111c52;};'use strict';var client=require(_0xe09d('0x0'));exports[_0xe09d('0x1')]=function(){return function(){return client[_0xe09d('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xe09d('0x3'),_0xe09d('0x4'),_0xe09d('0x5')],'include':[{'model':_0xe09d('0x6'),'as':_0xe09d('0x7'),'attributes':['id','name','online',_0xe09d('0x8')]}]},'log':_0xe09d('0x1')});};}; \ No newline at end of file +var _0x8906=['GetOpenchannelQueue','name','timeout','User','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request'];(function(_0x5a8269,_0xfb2f54){var _0x539ed7=function(_0x31ce98){while(--_0x31ce98){_0x5a8269['push'](_0x5a8269['shift']());}};_0x539ed7(++_0xfb2f54);}(_0x8906,0x179));var _0x6890=function(_0xd711aa,_0xec85b0){_0xd711aa=_0xd711aa-0x0;var _0x305a07=_0x8906[_0xd711aa];return _0x305a07;};'use strict';var client=require(_0x6890('0x0'));exports[_0x6890('0x1')]=function(){return function(){return client[_0x6890('0x2')](_0x6890('0x3'),{'options':{'raw':![],'attributes':['id',_0x6890('0x4'),_0x6890('0x5'),'strategy'],'include':[{'model':_0x6890('0x6'),'as':_0x6890('0x7'),'attributes':['id',_0x6890('0x4'),_0x6890('0x8'),_0x6890('0x9')]}]},'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 949b285..8a872c4 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 _0x43a5=['DESC','../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x17f924,_0x1b131b){var _0x45b0cc=function(_0x2743b3){while(--_0x2743b3){_0x17f924['push'](_0x17f924['shift']());}};_0x45b0cc(++_0x1b131b);}(_0x43a5,0xb0));var _0x543a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x43a5[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x543a('0x0'));exports[_0x543a('0x1')]=function(_0x3138a2){return client[_0x543a('0x2')](_0x543a('0x3'),{'body':_0x3138a2,'log':_0x543a('0x3')});};exports[_0x543a('0x4')]=function(_0x2b19cc,_0x1bf340){return client[_0x543a('0x2')](_0x543a('0x5'),{'body':_0x1bf340,'options':{'where':{'uniqueid':_0x2b19cc},'order':[['id',_0x543a('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xdb21=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x2158a6,_0x11993c){var _0x4da6ed=function(_0xadf211){while(--_0xadf211){_0x2158a6['push'](_0x2158a6['shift']());}};_0x4da6ed(++_0x11993c);}(_0xdb21,0xcd));var _0x1db2=function(_0x29af0e,_0x35f669){_0x29af0e=_0x29af0e-0x0;var _0x349e39=_0xdb21[_0x29af0e];return _0x349e39;};'use strict';var client=require(_0x1db2('0x0'));exports[_0x1db2('0x1')]=function(_0x5be389){return client[_0x1db2('0x2')](_0x1db2('0x3'),{'body':_0x5be389,'log':_0x1db2('0x3')});};exports[_0x1db2('0x4')]=function(_0x5b63b4,_0x3b352c){return client[_0x1db2('0x2')](_0x1db2('0x5'),{'body':_0x3b352c,'options':{'where':{'uniqueid':_0x5b63b4},'order':[['id',_0x1db2('0x6')]],'limit':0x1},'log':_0x1db2('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 09896b6..596eb07 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 _0x7e16=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','updateSmsInteraction'];(function(_0x4a67b6,_0x47b695){var _0x35c374=function(_0xe81766){while(--_0xe81766){_0x4a67b6['push'](_0x4a67b6['shift']());}};_0x35c374(++_0x47b695);}(_0x7e16,0x16f));var _0x67e1=function(_0x10b798,_0x1d3bca){_0x10b798=_0x10b798-0x0;var _0x4cb0a7=_0x7e16[_0x10b798];return _0x4cb0a7;};'use strict';var client=require(_0x67e1('0x0'));exports[_0x67e1('0x1')]=function(_0x14f1a6,_0x3ca930){return client['Request']('UpdateSmsInteraction',{'body':_0x3ca930,'options':{'where':{'id':_0x14f1a6}},'log':_0x67e1('0x2')});};exports['addTags']=function(_0x268f07,_0x25d798){return client['Request'](_0x67e1('0x3'),{'body':_0x25d798,'options':{'where':{'id':_0x268f07}},'log':_0x67e1('0x4')});}; \ No newline at end of file +var _0x9335=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x1a8515,_0x21a19b){var _0x5d4399=function(_0x2059f3){while(--_0x2059f3){_0x1a8515['push'](_0x1a8515['shift']());}};_0x5d4399(++_0x21a19b);}(_0x9335,0xab));var _0x5933=function(_0x4e4a79,_0x5127d4){_0x4e4a79=_0x4e4a79-0x0;var _0xdf6bc1=_0x9335[_0x4e4a79];return _0xdf6bc1;};'use strict';var client=require(_0x5933('0x0'));exports[_0x5933('0x1')]=function(_0x49884a,_0x2a823d){return client[_0x5933('0x2')](_0x5933('0x3'),{'body':_0x2a823d,'options':{'where':{'id':_0x49884a}},'log':_0x5933('0x4')});};exports[_0x5933('0x5')]=function(_0xc3fbd1,_0x310370){return client['Request'](_0x5933('0x6'),{'body':_0x310370,'options':{'where':{'id':_0xc3fbd1}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 69cfd59..97a5a00 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 _0xdaf4=['../client','create','Request'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xdaf4,0x72));var _0x4daf=function(_0x2ab365,_0xa3812e){_0x2ab365=_0x2ab365-0x0;var _0x49fef3=_0xdaf4[_0x2ab365];return _0x49fef3;};'use strict';var client=require(_0x4daf('0x0'));exports[_0x4daf('0x1')]=function(_0x3f5357){return client[_0x4daf('0x2')]('CreateSmsMessage',{'body':_0x3f5357,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xd0fc=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x1ac470,_0xa3ee66){var _0x756f41=function(_0x112185){while(--_0x112185){_0x1ac470['push'](_0x1ac470['shift']());}};_0x756f41(++_0xa3ee66);}(_0xd0fc,0x1a1));var _0xcd0f=function(_0x49f26a,_0x39615c){_0x49f26a=_0x49f26a-0x0;var _0x33cc95=_0xd0fc[_0x49f26a];return _0x33cc95;};'use strict';var client=require(_0xcd0f('0x0'));exports[_0xcd0f('0x1')]=function(_0x466ce8){return client[_0xcd0f('0x2')](_0xcd0f('0x3'),{'body':_0x466ce8,'log':_0xcd0f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 7ff6670..5b2d617 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 _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x102d55,_0x377614){var _0x31443b=function(_0x333de9){while(--_0x333de9){_0x102d55['push'](_0x102d55['shift']());}};_0x31443b(++_0x377614);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xb7e7[_0x1b7368];return _0x25d54c;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x5cca51,_0x3240ff){var _0x2a5776=function(_0x2c7a44){while(--_0x2c7a44){_0x5cca51['push'](_0x5cca51['shift']());}};_0x2a5776(++_0x3240ff);}(_0x70e0,0x17b));var _0x070e=function(_0x1b949a,_0x5e57e1){_0x1b949a=_0x1b949a-0x0;var _0x1e5c17=_0x70e0[_0x1b949a];return _0x1e5c17;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index addb8db..99f01f5 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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x11fd65,_0x2f79e9){var _0x344f0f=function(_0x7097d8){while(--_0x7097d8){_0x11fd65['push'](_0x11fd65['shift']());}};_0x344f0f(++_0x2f79e9);}(_0x70e0,0x17b));var _0x070e=function(_0x46d1cf,_0x59e2f0){_0x46d1cf=_0x46d1cf-0x0;var _0x100ad3=_0x70e0[_0x46d1cf];return _0x100ad3;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x1d1963,_0x32cc0e){var _0x3f58bb=function(_0x514823){while(--_0x514823){_0x1d1963['push'](_0x1d1963['shift']());}};_0x3f58bb(++_0x32cc0e);}(_0xedd9,0xfc));var _0x9edd=function(_0x195e02,_0xf460b9){_0x195e02=_0x195e02-0x0;var _0x27e1a3=_0xedd9[_0x195e02];return _0x27e1a3;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 704356c..4670a9e 100644 --- a/server/services/routing/rpc/user.js +++ b/server/services/routing/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x41c46a,_0x300a8b){var _0xc09c44=function(_0x35dcbe){while(--_0x35dcbe){_0x41c46a['push'](_0x41c46a['shift']());}};_0xc09c44(++_0x300a8b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x2b68fc,_0x10362e){var _0x2e3490=function(_0x13052e){while(--_0x13052e){_0x2b68fc['push'](_0x2b68fc['shift']());}};_0x2e3490(++_0x10362e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index b49af5c..0857bff 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 _0xed54=['update','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xed54,0xfc));var _0x4ed5=function(_0x1f2fb7,_0x41a0a5){_0x1f2fb7=_0x1f2fb7-0x0;var _0x25b07a=_0xed54[_0x1f2fb7];return _0x25b07a;};'use strict';var client=require('../client');exports[_0x4ed5('0x0')]=function(_0x2c284e,_0x1ac6d6){return client[_0x4ed5('0x1')]('UpdateWhatsappInteraction',{'body':_0x1ac6d6,'options':{'where':{'id':_0x2c284e}},'log':_0x4ed5('0x2')});};exports[_0x4ed5('0x3')]=function(_0x5f4777,_0x5c6d8b){return client[_0x4ed5('0x1')](_0x4ed5('0x4'),{'body':_0x5c6d8b,'options':{'where':{'id':_0x5f4777}},'log':_0x4ed5('0x5')});}; \ No newline at end of file +var _0x6596=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x15bd1d,_0x1fb319){var _0x33d66e=function(_0x4b6125){while(--_0x4b6125){_0x15bd1d['push'](_0x15bd1d['shift']());}};_0x33d66e(++_0x1fb319);}(_0x6596,0x1d3));var _0x6659=function(_0x22c887,_0x27af84){_0x22c887=_0x22c887-0x0;var _0xb7e820=_0x6596[_0x22c887];return _0xb7e820;};'use strict';var client=require(_0x6659('0x0'));exports[_0x6659('0x1')]=function(_0x51eb88,_0x28cf44){return client[_0x6659('0x2')](_0x6659('0x3'),{'body':_0x28cf44,'options':{'where':{'id':_0x51eb88}},'log':_0x6659('0x4')});};exports[_0x6659('0x5')]=function(_0x67ac1d,_0x4bfd3c){return client['Request'](_0x6659('0x6'),{'body':_0x4bfd3c,'options':{'where':{'id':_0x67ac1d}},'log':_0x6659('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 5f7fe53..65bc3e9 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 _0xf9d7=['CreateWhatsappMessage','../client','create','Request'];(function(_0x5c768b,_0x5e88a6){var _0x335af8=function(_0x39b04f){while(--_0x39b04f){_0x5c768b['push'](_0x5c768b['shift']());}};_0x335af8(++_0x5e88a6);}(_0xf9d7,0x135));var _0x7f9d=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0xf9d7[_0xd39959];return _0x1ff69c;};'use strict';var client=require(_0x7f9d('0x0'));exports[_0x7f9d('0x1')]=function(_0x1030fa){return client[_0x7f9d('0x2')](_0x7f9d('0x3'),{'body':_0x1030fa,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xd06a=['createWhatsappMessage','../client','Request'];(function(_0x2f77d6,_0x815a1d){var _0x5bf9eb=function(_0xb05bb5){while(--_0xb05bb5){_0x2f77d6['push'](_0x2f77d6['shift']());}};_0x5bf9eb(++_0x815a1d);}(_0xd06a,0x1b4));var _0xad06=function(_0x43f2da,_0x33b3c6){_0x43f2da=_0x43f2da-0x0;var _0x3c99f4=_0xd06a[_0x43f2da];return _0x3c99f4;};'use strict';var client=require(_0xad06('0x0'));exports['create']=function(_0x5cadcc){return client[_0xad06('0x1')]('CreateWhatsappMessage',{'body':_0x5cadcc,'log':_0xad06('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 71c6236..60b0afc 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 _0x679f=['Agents','name','online','whatsappPause','getWhatsappQueues','../client','Request','GetWhatsappQueue','timeout','strategy','User'];(function(_0x39bba3,_0x2e7897){var _0x2c4c99=function(_0x13e791){while(--_0x13e791){_0x39bba3['push'](_0x39bba3['shift']());}};_0x2c4c99(++_0x2e7897);}(_0x679f,0x19c));var _0xf679=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x679f[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0xf679('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xf679('0x1')](_0xf679('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xf679('0x3'),_0xf679('0x4')],'include':[{'model':_0xf679('0x5'),'as':_0xf679('0x6'),'attributes':['id',_0xf679('0x7'),_0xf679('0x8'),_0xf679('0x9')]}]},'log':_0xf679('0xa')});};}; \ No newline at end of file +var _0xeb57=['online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy','User','Agents'];(function(_0xf66bcd,_0x4c2192){var _0x2b110f=function(_0xb866a7){while(--_0xb866a7){_0xf66bcd['push'](_0xf66bcd['shift']());}};_0x2b110f(++_0x4c2192);}(_0xeb57,0x78));var _0x7eb5=function(_0x600ddc,_0x787a98){_0x600ddc=_0x600ddc-0x0;var _0x364c98=_0xeb57[_0x600ddc];return _0x364c98;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x7eb5('0x0')](_0x7eb5('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x7eb5('0x2'),_0x7eb5('0x3')],'include':[{'model':_0x7eb5('0x4'),'as':_0x7eb5('0x5'),'attributes':['id','name',_0x7eb5('0x6'),_0x7eb5('0x7')]}]},'log':_0x7eb5('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 3d99ee0..557fa70 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 _0x0a72=['../client','create','Request','UpdateWhatsappQueueReport'];(function(_0x4b5813,_0x5769de){var _0x423465=function(_0x18071f){while(--_0x18071f){_0x4b5813['push'](_0x4b5813['shift']());}};_0x423465(++_0x5769de);}(_0x0a72,0x1e0));var _0x20a7=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x0a72[_0x4c7fb5];return _0x2e10ac;};'use strict';var client=require(_0x20a7('0x0'));exports[_0x20a7('0x1')]=function(_0x1768e7){return client[_0x20a7('0x2')]('CreateWhatsappQueueReport',{'body':_0x1768e7,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x540300,_0x3a086a){return client[_0x20a7('0x2')](_0x20a7('0x3'),{'body':_0x3a086a,'options':{'where':{'uniqueid':_0x540300},'order':[['id','DESC']],'limit':0x1},'log':_0x20a7('0x3')});}; \ No newline at end of file +var _0x405b=['update','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x5875a2,_0x2e726f){var _0x55d10a=function(_0x430870){while(--_0x430870){_0x5875a2['push'](_0x5875a2['shift']());}};_0x55d10a(++_0x2e726f);}(_0x405b,0xec));var _0xb405=function(_0x2d5c34,_0x5324f1){_0x2d5c34=_0x2d5c34-0x0;var _0x5b10b5=_0x405b[_0x2d5c34];return _0x5b10b5;};'use strict';var client=require(_0xb405('0x0'));exports[_0xb405('0x1')]=function(_0x24fc39){return client[_0xb405('0x2')](_0xb405('0x3'),{'body':_0x24fc39,'log':_0xb405('0x3')});};exports[_0xb405('0x4')]=function(_0x5854eb,_0x4ee779){return client[_0xb405('0x2')](_0xb405('0x5'),{'body':_0x4ee779,'options':{'where':{'uniqueid':_0x5854eb},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index c5313a6..ab29b9d 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 _0x2b13=['message','join','stop','find','agents','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','[%s][QUEUE]\x20%s','validate','lodash','seq-queue','routing','string','number','info','format','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map'];(function(_0xc32223,_0x131881){var _0x2938a2=function(_0x128a81){while(--_0x128a81){_0xc32223['push'](_0xc32223['shift']());}};_0x2938a2(++_0x131881);}(_0x2b13,0x76));var _0x32b1=function(_0x26d952,_0x19552f){_0x26d952=_0x26d952-0x0;var _0x5db704=_0x2b13[_0x26d952];return _0x5db704;};'use strict';var schema=require(_0x32b1('0x0'));var _=require(_0x32b1('0x1'));var util=require('util');var seqqueue=require(_0x32b1('0x2'));var logger=require('../../../../config/logger')(_0x32b1('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x32b1('0x4'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x32b1('0x5'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x2a070b,_0x3e91d7,_0xa1d669){return logger[_0x32b1('0x6')](util[_0x32b1('0x7')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x2a070b,_0x3e91d7[_0x32b1('0x8')],_0xa1d669));}function handleFindAgent(_0x1de11e){return function(_0x300e5b){return _0x300e5b[_0x32b1('0x8')][_0x32b1('0x9')]()===_0x1de11e[_0x32b1('0x9')]();};}exports['consequence']=function(_0x3b373d,_0x40ef94,_0x267437,_0x3d344c){return function(_0x3832ee){try{var _0x3c8d95={'name':_0x40ef94[0x0],'timeout':_0x40ef94[0x1]};var _0x32b607=queue[_0x32b1('0x0')](_0x3c8d95,{'typecast':!![]});if(_0x32b607[_0x32b1('0xa')]){logger[_0x32b1('0xb')](_0x32b1('0xc'),_0x3b373d,_[_0x32b1('0xd')](_0x32b607,_0x32b1('0xe'))[_0x32b1('0xf')](',\x20'));_0x3832ee[_0x32b1('0x10')]();}else{var _0x10eaa0=_[_0x32b1('0x11')](_0x267437[_0x32b1('0x12')],handleFindAgent(_0x3c8d95[_0x32b1('0x8')]));if(_0x10eaa0){var _0x189717=(_0x3c8d95[_0x32b1('0x13')]||0xa)*0x3e8;var _0x385592,_0x2ff110;var _0x2a5d42=seqqueue[_0x32b1('0x14')](_0x189717);_0x2a5d42['id']=_0x3b373d;_0x2a5d42['atimeout']=_0x189717;_0x2a5d42[_0x32b1('0x15')]=_0x3d344c[_0x32b1('0x15')];writeLog(_0x3b373d,_0x10eaa0,util[_0x32b1('0x7')](_0x32b1('0x16'),_0x189717));_0x267437[_0x32b1('0x17')][_0x3b373d]['on'](_0x32b1('0x18'),function(){logger['info'](_0x32b1('0x19'),_0x3b373d);clearTimeout(_0x2ff110);_0x2ff110=undefined;_0x2a5d42[_0x32b1('0x1a')]();if(_0x267437[_0x32b1('0x17')][_0x3b373d]){delete _0x267437[_0x32b1('0x17')][_0x3b373d];}_0x3832ee[_0x32b1('0x10')]();});_0x267437[_0x32b1('0x17')][_0x3b373d]['on'](_0x32b1('0x1b'),function(){if(_0x267437[_0x32b1('0x17')][_0x3b373d]){delete _0x267437[_0x32b1('0x17')][_0x3b373d];}});_0x2ff110=setTimeout(function(){logger['info'](_0x32b1('0x1c'),_0x3b373d);clearTimeout(_0x2ff110);_0x2a5d42[_0x32b1('0x1a')]();_0x3832ee[_0x32b1('0x1d')]();},_0x189717);strategy[_0x32b1('0x1e')](_0x2a5d42,_0x10eaa0,_0x267437,_0x3d344c);}else{logger[_0x32b1('0xb')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x3b373d,_0x3c8d95[_0x32b1('0x8')]);_0x3832ee[_0x32b1('0x10')]();}}}catch(_0x43a57d){console[_0x32b1('0x1f')](_0x43a57d);logger[_0x32b1('0xb')](_0x32b1('0x20'),_0x3b373d,_0x43a57d['stack']);_0x3832ee[_0x32b1('0x10')]();}};}; \ No newline at end of file +var _0x091a=['find','agents','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger','routing','./strategy','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','stop'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0x091a,0x76));var _0xa091=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x091a[_0x13e741];return _0x3f8bb3;};'use strict';var schema=require(_0xa091('0x0'));var _=require('lodash');var util=require(_0xa091('0x1'));var seqqueue=require(_0xa091('0x2'));var logger=require(_0xa091('0x3'))(_0xa091('0x4'));var strategy=require(_0xa091('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x350026,_0x6cabfd,_0x1aa57d){return logger[_0xa091('0x6')](util[_0xa091('0x7')](_0xa091('0x8'),_0x350026,_0x6cabfd[_0xa091('0x9')],_0x1aa57d));}function handleFindAgent(_0x5e2e92){return function(_0xb593e9){return _0xb593e9[_0xa091('0x9')][_0xa091('0xa')]()===_0x5e2e92[_0xa091('0xa')]();};}exports[_0xa091('0xb')]=function(_0x55e865,_0x2d70e4,_0x355fe2,_0x336abd){return function(_0x4401f3){try{var _0x46f5c7={'name':_0x2d70e4[0x0],'timeout':_0x2d70e4[0x1]};var _0x127b58=queue[_0xa091('0x0')](_0x46f5c7,{'typecast':!![]});if(_0x127b58[_0xa091('0xc')]){logger[_0xa091('0xd')](_0xa091('0xe'),_0x55e865,_[_0xa091('0xf')](_0x127b58,_0xa091('0x10'))['join'](',\x20'));_0x4401f3[_0xa091('0x11')]();}else{var _0x14c30b=_[_0xa091('0x12')](_0x355fe2[_0xa091('0x13')],handleFindAgent(_0x46f5c7[_0xa091('0x9')]));if(_0x14c30b){var _0x5742e9=(_0x46f5c7[_0xa091('0x14')]||0xa)*0x3e8;var _0xe45591,_0x3876c1;var _0x1c92c9=seqqueue[_0xa091('0x15')](_0x5742e9);_0x1c92c9['id']=_0x55e865;_0x1c92c9['atimeout']=_0x5742e9;_0x1c92c9[_0xa091('0x16')]=_0x336abd['channel'];writeLog(_0x55e865,_0x14c30b,util['format'](_0xa091('0x17'),_0x5742e9));_0x355fe2[_0xa091('0x18')][_0x55e865]['on'](_0xa091('0x19'),function(){logger[_0xa091('0x6')](_0xa091('0x1a'),_0x55e865);clearTimeout(_0x3876c1);_0x3876c1=undefined;_0x1c92c9['close']();if(_0x355fe2[_0xa091('0x18')][_0x55e865]){delete _0x355fe2[_0xa091('0x18')][_0x55e865];}_0x4401f3[_0xa091('0x11')]();});_0x355fe2[_0xa091('0x18')][_0x55e865]['on'](_0xa091('0x1b'),function(){if(_0x355fe2['rules'][_0x55e865]){delete _0x355fe2[_0xa091('0x18')][_0x55e865];}});_0x3876c1=setTimeout(function(){logger['info'](_0xa091('0x1c'),_0x55e865);clearTimeout(_0x3876c1);_0x1c92c9['close']();_0x4401f3[_0xa091('0x1d')]();},_0x5742e9);strategy[_0xa091('0x1e')](_0x1c92c9,_0x14c30b,_0x355fe2,_0x336abd);}else{logger[_0xa091('0xd')](_0xa091('0x1f'),_0x55e865,_0x46f5c7[_0xa091('0x9')]);_0x4401f3[_0xa091('0x11')]();}}}catch(_0x456f41){console['log'](_0x456f41);logger['error'](_0xa091('0x20'),_0x55e865,_0x456f41[_0xa091('0x21')]);_0x4401f3[_0xa091('0x11')]();}};}; \ 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 40bcb18..5341dac 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 _0xbae6=['./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','phone','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','postText','message','amazonlex','providerName','Failed','catch','lodash','moment'];(function(_0x519678,_0x425426){var _0x72cc0b=function(_0x2b69db){while(--_0x2b69db){_0x519678['push'](_0x519678['shift']());}};_0x72cc0b(++_0x425426);}(_0xbae6,0xba));var _0x6bae=function(_0x1860af,_0x1c28c9){_0x1860af=_0x1860af-0x0;var _0x4279a7=_0xbae6[_0x1860af];return _0x4279a7;};'use strict';var _=require(_0x6bae('0x0'));var moment=require(_0x6bae('0x1'));var AWS=require('aws-sdk');var utils=require(_0x6bae('0x2'));var logger=require(_0x6bae('0x3'))(_0x6bae('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x6bae('0x5')),'mailMessage':require(_0x6bae('0x6')),'smsMessage':require(_0x6bae('0x7')),'faxMessage':require(_0x6bae('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x6bae('0x9')]=function(_0x54db11,_0x2a835d){return function(_0x4522a4){try{if(!_[_0x6bae('0xa')](this[_0x6bae('0xb')][_0x6bae('0xc')])){logger[_0x6bae('0xd')](_0x6bae('0xe'),_0x54db11,_0x6bae('0xf'));return _0x4522a4[_0x6bae('0x10')]();}var _0x50cec6={'ContactId':this[_0x6bae('0x11')]['id'],'sentAt':moment()[_0x6bae('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x6bae('0x13')};if(this[_0x6bae('0x14')]===_0x6bae('0x15')||this['channel']==='whatsapp'){_0x50cec6['phone']=this[_0x6bae('0xb')][_0x6bae('0x16')];}var _0x3dd96c=this[_0x6bae('0x14')];if(_0x3dd96c==='chat'){_0x50cec6[_0x6bae('0x17')]=this[_0x6bae('0x18')]['id'];}else{_0x50cec6[_[_0x6bae('0x19')](_0x3dd96c)+'AccountId']=this[_0x6bae('0x18')]['id'];}_0x50cec6[_[_0x6bae('0x19')](_0x3dd96c)+_0x6bae('0x1a')]=this[_0x6bae('0xb')]['id'];if(this[_0x6bae('0xb')][_0x6bae('0x1b')]){var _0x4b9b5f=_0x2a835d[0x4];if(!_[_0x6bae('0x1c')](_0x4b9b5f)){_0x50cec6[_0x6bae('0x1d')]=utils[_0x6bae('0x1e')](_0x4b9b5f,this);return rpc[_0x3dd96c+_0x6bae('0x1f')][_0x6bae('0x20')](_0x50cec6)[_0x6bae('0x21')](function(_0x527d09){logger[_0x6bae('0xd')](_0x6bae('0xe'),_0x54db11,_0x50cec6['body']);})['catch'](function(_0x18f0ab){logger[_0x6bae('0x22')](_0x6bae('0xe'),_0x54db11,JSON[_0x6bae('0x23')](_0x18f0ab));})['finally'](function(){logger[_0x6bae('0xd')](_0x6bae('0x24'),_0x54db11);_0x4522a4[_0x6bae('0x25')]();});}else{logger[_0x6bae('0xd')](_0x6bae('0x26'),_0x54db11);_0x4522a4[_0x6bae('0x25')]();}}else{var _0x3ef349=this;var _0x5d125d=new AWS[(_0x6bae('0x27'))]({'accessKeyId':_0x2a835d[0x0],'secretAccessKey':_0x2a835d[0x1],'region':_0x2a835d[0x2]});var _0x4751cd={'botAlias':_0x6bae('0x28'),'botName':_0x2a835d[0x3],'inputText':this['message'][_0x6bae('0x1d')],'userId':this[_0x6bae('0x14')]+':'+this[_0x6bae('0xb')]['id']['toString']()};_0x5d125d[_0x6bae('0x29')](_0x4751cd,function(_0x35ae88,_0x5701ea){if(_0x35ae88){logger['error'](_0x6bae('0xe'),_0x54db11,_0x35ae88[_0x6bae('0x2a')]);_0x4522a4[_0x6bae('0x10')]();}else if(_0x5701ea&&_0x5701ea[_0x6bae('0x2a')]){_0x3ef349[_0x6bae('0x1d')][_0x6bae('0x2b')]=_0x5701ea;_0x50cec6[_0x6bae('0x1d')]=_0x5701ea[_0x6bae('0x2a')];_0x50cec6[_0x6bae('0x2c')]=_0x6bae('0x2b');_0x50cec6['providerResponse']=JSON['stringify'](_0x5701ea);return rpc[_0x3dd96c+'Message'][_0x6bae('0x20')](_0x50cec6)[_0x6bae('0x21')](function(_0xd9d9fc){logger[_0x6bae('0xd')](_0x6bae('0xe'),_0x54db11,_0x50cec6[_0x6bae('0x1d')]);if(_0x5701ea['dialogState']==_0x6bae('0x2d')){_0x4522a4[_0x6bae('0x10')]();}else{_0x4522a4[_0x6bae('0x25')]();}})[_0x6bae('0x2e')](function(_0x2c68c1){logger[_0x6bae('0x22')](_0x6bae('0xe'),_0x54db11,JSON[_0x6bae('0x23')](_0x2c68c1));_0x4522a4['next']();});}else{_0x4522a4[_0x6bae('0x10')]();}});}}catch(_0xb475bc){logger['error']('[%s][AMAZONLEX]\x20%s',_0x54db11,JSON[_0x6bae('0x23')](_0xb475bc));_0x4522a4['stop']();}};}; \ No newline at end of file +var _0x6fac=['./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','created','isEmpty','body','getMustacheRender','then','[%s][AMAZONLEX]\x20%s','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!','LexRuntime','$LATEST','toString','postText','message','amazonlex','providerName','providerResponse','Message','create','Failed','lodash','moment','aws-sdk'];(function(_0x5a8a09,_0x39eaa8){var _0x4d35f9=function(_0x4fd335){while(--_0x4fd335){_0x5a8a09['push'](_0x5a8a09['shift']());}};_0x4d35f9(++_0x39eaa8);}(_0x6fac,0x1da));var _0xc6fa=function(_0x2b63d5,_0x439208){_0x2b63d5=_0x2b63d5-0x0;var _0x148f9d=_0x6fac[_0x2b63d5];return _0x148f9d;};'use strict';var _=require(_0xc6fa('0x0'));var moment=require(_0xc6fa('0x1'));var AWS=require(_0xc6fa('0x2'));var utils=require(_0xc6fa('0x3'));var logger=require(_0xc6fa('0x4'))(_0xc6fa('0x5'));var rpc={'chatMessage':require(_0xc6fa('0x6')),'openchannelMessage':require(_0xc6fa('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xc6fa('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc6fa('0x9'))};exports[_0xc6fa('0xa')]=function(_0x5dfbdd,_0x21a3ef){return function(_0x4985ff){try{if(!_[_0xc6fa('0xb')](this[_0xc6fa('0xc')][_0xc6fa('0xd')])){logger[_0xc6fa('0xe')]('[%s][AMAZONLEX]\x20%s',_0x5dfbdd,_0xc6fa('0xf'));return _0x4985ff[_0xc6fa('0x10')]();}var _0x4ffbae={'ContactId':this[_0xc6fa('0x11')]['id'],'sentAt':moment()[_0xc6fa('0x12')](_0xc6fa('0x13')),'direction':_0xc6fa('0x14')};if(this[_0xc6fa('0x15')]===_0xc6fa('0x16')||this[_0xc6fa('0x15')]===_0xc6fa('0x17')){_0x4ffbae['phone']=this[_0xc6fa('0xc')][_0xc6fa('0x18')];}var _0x3f23f4=this[_0xc6fa('0x15')];if(_0x3f23f4===_0xc6fa('0x19')){_0x4ffbae[_0xc6fa('0x1a')]=this[_0xc6fa('0x1b')]['id'];}else{_0x4ffbae[_['upperFirst'](_0x3f23f4)+'AccountId']=this[_0xc6fa('0x1b')]['id'];}_0x4ffbae[_[_0xc6fa('0x1c')](_0x3f23f4)+'InteractionId']=this[_0xc6fa('0xc')]['id'];if(this['interaction'][_0xc6fa('0x1d')]){var _0x2d80fa=_0x21a3ef[0x4];if(!_[_0xc6fa('0x1e')](_0x2d80fa)){_0x4ffbae[_0xc6fa('0x1f')]=utils[_0xc6fa('0x20')](_0x2d80fa,this);return rpc[_0x3f23f4+'Message']['create'](_0x4ffbae)[_0xc6fa('0x21')](function(_0xf9d806){logger[_0xc6fa('0xe')](_0xc6fa('0x22'),_0x5dfbdd,_0x4ffbae[_0xc6fa('0x1f')]);})[_0xc6fa('0x23')](function(_0xefaeb9){logger[_0xc6fa('0x24')](_0xc6fa('0x22'),_0x5dfbdd,JSON[_0xc6fa('0x25')](_0xefaeb9));})[_0xc6fa('0x26')](function(){logger[_0xc6fa('0xe')](_0xc6fa('0x27'),_0x5dfbdd);_0x4985ff[_0xc6fa('0x28')]();});}else{logger[_0xc6fa('0xe')](_0xc6fa('0x29'),_0x5dfbdd);_0x4985ff[_0xc6fa('0x28')]();}}else{var _0x5af3b8=this;var _0x397137=new AWS[(_0xc6fa('0x2a'))]({'accessKeyId':_0x21a3ef[0x0],'secretAccessKey':_0x21a3ef[0x1],'region':_0x21a3ef[0x2]});var _0x3e5cea={'botAlias':_0xc6fa('0x2b'),'botName':_0x21a3ef[0x3],'inputText':this['message'][_0xc6fa('0x1f')],'userId':this['channel']+':'+this[_0xc6fa('0xc')]['id'][_0xc6fa('0x2c')]()};_0x397137[_0xc6fa('0x2d')](_0x3e5cea,function(_0x1056ef,_0x515639){if(_0x1056ef){logger[_0xc6fa('0x24')]('[%s][AMAZONLEX]\x20%s',_0x5dfbdd,_0x1056ef[_0xc6fa('0x2e')]);_0x4985ff['next']();}else if(_0x515639&&_0x515639[_0xc6fa('0x2e')]){_0x5af3b8['body'][_0xc6fa('0x2f')]=_0x515639;_0x4ffbae[_0xc6fa('0x1f')]=_0x515639[_0xc6fa('0x2e')];_0x4ffbae[_0xc6fa('0x30')]=_0xc6fa('0x2f');_0x4ffbae[_0xc6fa('0x31')]=JSON[_0xc6fa('0x25')](_0x515639);return rpc[_0x3f23f4+_0xc6fa('0x32')][_0xc6fa('0x33')](_0x4ffbae)[_0xc6fa('0x21')](function(_0x5f4794){logger['info'](_0xc6fa('0x22'),_0x5dfbdd,_0x4ffbae[_0xc6fa('0x1f')]);if(_0x515639['dialogState']==_0xc6fa('0x34')){_0x4985ff['next']();}else{_0x4985ff[_0xc6fa('0x28')]();}})[_0xc6fa('0x23')](function(_0x2733c8){logger[_0xc6fa('0x24')]('[%s][AMAZONLEX]\x20%s',_0x5dfbdd,JSON[_0xc6fa('0x25')](_0x2733c8));_0x4985ff[_0xc6fa('0x10')]();});}else{_0x4985ff[_0xc6fa('0x10')]();}});}}catch(_0x3fcb74){logger[_0xc6fa('0x24')](_0xc6fa('0x22'),_0x5dfbdd,JSON[_0xc6fa('0x25')](_0x3fcb74));_0x4985ff['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 507e515..d77cc0a 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 _0x659d=['subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','service','Smtp','host','port','secure','authentication','auth','user','pass','inReplyTo','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','then','[%s][AUTOREPLY]\x20%s','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','consequence','isNil','interaction','info','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','channel','mail','body','getMustacheRender','message','from','phone'];(function(_0x481df5,_0x216652){var _0x32726e=function(_0x2133f4){while(--_0x2133f4){_0x481df5['push'](_0x481df5['shift']());}};_0x32726e(++_0x216652);}(_0x659d,0x107));var _0xd659=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x659d[_0x20589d];return _0x422de9;};'use strict';var _=require(_0xd659('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require(_0xd659('0x1'))(_0xd659('0x2'));var rpc={'chatMessage':require(_0xd659('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd659('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd659('0x5')),'whatsappMessage':require(_0xd659('0x6')),'chatInteraction':require(_0xd659('0x7')),'openchannelInteraction':require(_0xd659('0x8')),'mailInteraction':require(_0xd659('0x9')),'smsInteraction':require(_0xd659('0xa')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xd659('0xb'))};var mailRpc=require('../../mailRpc');exports[_0xd659('0xc')]=function(_0x42595b,_0x19873d){return function(_0x503d9e){try{if(_0x19873d[0x0]==='1'&&(_[_0xd659('0xd')](this[_0xd659('0xe')]['created'])||!this[_0xd659('0xe')]['created'])){logger[_0xd659('0xf')]('[%s][AUTOREPLY]\x20%s',_0x42595b,_0xd659('0x10'));return _0x503d9e[_0xd659('0x11')]();}if(_0x19873d[0x0]==='2'&&this[_0xd659('0xe')][_0xd659('0x12')]){logger[_0xd659('0xf')](_0xd659('0x13'),_0x42595b,_0xd659('0x14'));return _0x503d9e[_0xd659('0x11')]();}var _0x3dbd9c=this['channel'];var _0x54f480={'ContactId':this[_0xd659('0x15')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0xd659('0x16')]===_0xd659('0x17')){_0x54f480[_0xd659('0x18')]=utils[_0xd659('0x19')](_0x19873d[0x2],this);}else{_0x54f480[_0xd659('0x18')]=utils[_0xd659('0x19')](_0x19873d[0x1],this);}if(this['message']){_0x54f480['to']=this[_0xd659('0x1a')][_0xd659('0x1b')]||'';if(this[_0xd659('0x16')]===_0xd659('0x17')&&_0x19873d[0x1]==='1'){_0x54f480['cc']=this[_0xd659('0x1a')]['cc']||'';}_0x54f480[_0xd659('0x1b')]=this[_0xd659('0x1a')]['to']||'';_0x54f480[_0xd659('0x1c')]=this[_0xd659('0x1a')]['phone']||'';_0x54f480['read']=!![];if(this[_0xd659('0x1a')][_0xd659('0x1d')]){_0x54f480[_0xd659('0x1d')]='';_0x54f480[_0xd659('0x1d')]+=_[_0xd659('0x1e')](this[_0xd659('0x1a')]['subject'],'Re:')?'':_0xd659('0x1f');_0x54f480['subject']+=this[_0xd659('0x1a')][_0xd659('0x1d')];}}if(this[_0xd659('0x16')]===_0xd659('0x20')){_0x54f480[_0xd659('0x21')]=this[_0xd659('0x22')]['id'];}else{_0x54f480[_[_0xd659('0x23')](this[_0xd659('0x16')])+_0xd659('0x24')]=this[_0xd659('0x22')]['id'];}_0x54f480[_[_0xd659('0x23')](this[_0xd659('0x16')])+'InteractionId']=this['interaction']['id'];var _0x5189ba=this[_0xd659('0xe')];if(rpc[this[_0xd659('0x16')]+_0xd659('0x25')]){if(this['channel']===_0xd659('0x17')){var _0x156d91={'tls':{'rejectUnauthorized':![]}};if(this[_0xd659('0x22')]['Smtp'][_0xd659('0x26')]){_0x156d91[_0xd659('0x26')]=this[_0xd659('0x22')][_0xd659('0x27')][_0xd659('0x26')];}else{_0x156d91[_0xd659('0x28')]=this[_0xd659('0x22')][_0xd659('0x27')][_0xd659('0x28')];_0x156d91[_0xd659('0x29')]=this[_0xd659('0x22')]['Smtp'][_0xd659('0x29')];_0x156d91[_0xd659('0x2a')]=this['account'][_0xd659('0x27')][_0xd659('0x2a')];}if(this['account'][_0xd659('0x27')][_0xd659('0x2b')]){_0x156d91[_0xd659('0x2c')]={'user':this[_0xd659('0x22')]['Smtp'][_0xd659('0x2d')],'pass':this[_0xd659('0x22')]['Smtp'][_0xd659('0x2e')]};}_0x54f480[_0xd659('0x2f')]=this['message']['messageId'];_0x54f480['html']=_0xd659('0x30')+_[_0xd659('0x31')](_0x54f480['body'],_0xd659('0x32'),_0xd659('0x33'))+_0xd659('0x34');_0x54f480[_0xd659('0x35')]={'Auto-Submitted':_0xd659('0x36'),'X-Auto-Response-Suppress':_0xd659('0x37'),'Precedence':_0xd659('0x38')};return mailRpc[_0xd659('0x39')](_0x156d91,_0x54f480)['then'](function(_0x57a2bd){logger[_0xd659('0xf')](_0xd659('0x3a'),_0x42595b);_0x54f480['messageId']=_0x57a2bd[_0xd659('0x1a')][_0xd659('0x3b')];return rpc[_0x3dbd9c+_0xd659('0x25')][_0xd659('0x3c')](_0x54f480);})[_0xd659('0x3d')](function(_0x266bdd){logger[_0xd659('0xf')](_0xd659('0x3e'),_0x42595b,JSON['stringify'](_0x266bdd));})[_0xd659('0x3f')](function(_0x140fce){logger[_0xd659('0x40')](_0xd659('0x41'),_0x42595b,JSON['stringify'](_0x140fce));})[_0xd659('0x42')](function(){Promise[_0xd659('0x43')]()[_0xd659('0x3d')](function(){if(_0x19873d[0x0]!=='2'||_0x5189ba[_0xd659('0x12')])return;return rpc[_0x3dbd9c+_0xd659('0x44')][_0xd659('0x45')](_0x5189ba['id'],{'autoreplyExecuted':!![]})[_0xd659('0x3d')](function(_0x3e159f){logger['info'](_0xd659('0x13'),_0x42595b,JSON['stringify'](_0x3e159f));})[_0xd659('0x3f')](function(_0x55ea91){logger['error'](_0xd659('0x46'),_0x42595b,JSON[_0xd659('0x47')](_0x55ea91));});})[_0xd659('0x3d')](function(){_0x503d9e[_0xd659('0x11')]();});});}else{return rpc[this[_0xd659('0x16')]+_0xd659('0x25')]['create'](_0x54f480)[_0xd659('0x3d')](function(_0x3098fd){logger[_0xd659('0xf')](_0xd659('0x3e'),_0x42595b,_0x54f480[_0xd659('0x18')]);})[_0xd659('0x3f')](function(_0x4f2731){logger['error'](_0xd659('0x3e'),_0x42595b,JSON['stringify'](_0x4f2731));})[_0xd659('0x42')](function(){Promise['resolve']()[_0xd659('0x3d')](function(){if(_0x19873d[0x0]!=='2'||_0x5189ba[_0xd659('0x12')])return;return rpc[_0x3dbd9c+_0xd659('0x44')][_0xd659('0x45')](_0x5189ba['id'],{'autoreplyExecuted':!![]})[_0xd659('0x3d')](function(_0x440df9){logger['info'](_0xd659('0x13'),_0x42595b,JSON['stringify'](_0x440df9));})[_0xd659('0x3f')](function(_0x497cc1){logger[_0xd659('0x40')](_0xd659('0x46'),_0x42595b,JSON[_0xd659('0x47')](_0x497cc1));});})[_0xd659('0x3d')](function(){_0x503d9e[_0xd659('0x11')]();});});}}}catch(_0x19f29a){logger[_0xd659('0x40')](_0xd659('0x3e'),_0x42595b,JSON[_0xd659('0x47')](_0x19f29a));_0x503d9e[_0xd659('0x48')]();}};}; \ No newline at end of file +var _0xc544=['error','finally','resolve','Interaction','update','catch','create','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','interaction','created','info','[%s][AUTOREPLY]\x20%s','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','out','channel','body','getMustacheRender','message','from','mail','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','upperFirst','account','InteractionId','Message','Smtp','service','host','secure','authentication','auth','user','pass','html','','','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','stringify'];(function(_0x32bd57,_0x1b2d71){var _0x105be4=function(_0x1f9e64){while(--_0x1f9e64){_0x32bd57['push'](_0x32bd57['shift']());}};_0x105be4(++_0x1b2d71);}(_0xc544,0x1a6));var _0x4c54=function(_0x410107,_0x2eff65){_0x410107=_0x410107-0x0;var _0x30c5e9=_0xc544[_0x410107];return _0x30c5e9;};'use strict';var _=require(_0x4c54('0x0'));var moment=require(_0x4c54('0x1'));var utils=require(_0x4c54('0x2'));var logger=require(_0x4c54('0x3'))(_0x4c54('0x4'));var rpc={'chatMessage':require(_0x4c54('0x5')),'openchannelMessage':require(_0x4c54('0x6')),'mailMessage':require(_0x4c54('0x7')),'smsMessage':require(_0x4c54('0x8')),'faxMessage':require(_0x4c54('0x9')),'whatsappMessage':require(_0x4c54('0xa')),'chatInteraction':require(_0x4c54('0xb')),'openchannelInteraction':require(_0x4c54('0xc')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x4c54('0xd')),'faxInteraction':require(_0x4c54('0xe')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x4c54('0xf'));exports[_0x4c54('0x10')]=function(_0x3055d7,_0x21c08b){return function(_0xadd643){try{if(_0x21c08b[0x0]==='1'&&(_['isNil'](this[_0x4c54('0x11')][_0x4c54('0x12')])||!this[_0x4c54('0x11')][_0x4c54('0x12')])){logger[_0x4c54('0x13')](_0x4c54('0x14'),_0x3055d7,'Autoreply\x20already\x20sent');return _0xadd643[_0x4c54('0x15')]();}if(_0x21c08b[0x0]==='2'&&this[_0x4c54('0x11')][_0x4c54('0x16')]){logger[_0x4c54('0x13')](_0x4c54('0x17'),_0x3055d7,_0x4c54('0x18'));return _0xadd643[_0x4c54('0x15')]();}var _0x1cb756=this['channel'];var _0x24b22f={'ContactId':this['contact']['id'],'sentAt':moment()[_0x4c54('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x4c54('0x1a')};if(this[_0x4c54('0x1b')]==='mail'){_0x24b22f[_0x4c54('0x1c')]=utils[_0x4c54('0x1d')](_0x21c08b[0x2],this);}else{_0x24b22f[_0x4c54('0x1c')]=utils[_0x4c54('0x1d')](_0x21c08b[0x1],this);}if(this[_0x4c54('0x1e')]){_0x24b22f['to']=this['message'][_0x4c54('0x1f')]||'';if(this[_0x4c54('0x1b')]===_0x4c54('0x20')&&_0x21c08b[0x1]==='1'){_0x24b22f['cc']=this[_0x4c54('0x1e')]['cc']||'';}_0x24b22f['from']=this[_0x4c54('0x1e')]['to']||'';_0x24b22f[_0x4c54('0x21')]=this[_0x4c54('0x1e')][_0x4c54('0x21')]||'';_0x24b22f[_0x4c54('0x22')]=!![];if(this['message'][_0x4c54('0x23')]){_0x24b22f[_0x4c54('0x23')]='';_0x24b22f[_0x4c54('0x23')]+=_[_0x4c54('0x24')](this[_0x4c54('0x1e')][_0x4c54('0x23')],'Re:')?'':_0x4c54('0x25');_0x24b22f[_0x4c54('0x23')]+=this[_0x4c54('0x1e')]['subject'];}}if(this['channel']===_0x4c54('0x26')){_0x24b22f[_0x4c54('0x27')]=this['account']['id'];}else{_0x24b22f[_[_0x4c54('0x28')](this[_0x4c54('0x1b')])+'AccountId']=this[_0x4c54('0x29')]['id'];}_0x24b22f[_[_0x4c54('0x28')](this['channel'])+_0x4c54('0x2a')]=this[_0x4c54('0x11')]['id'];var _0x14ed91=this[_0x4c54('0x11')];if(rpc[this[_0x4c54('0x1b')]+_0x4c54('0x2b')]){if(this[_0x4c54('0x1b')]===_0x4c54('0x20')){var _0x5c8ceb={'tls':{'rejectUnauthorized':![]}};if(this[_0x4c54('0x29')][_0x4c54('0x2c')][_0x4c54('0x2d')]){_0x5c8ceb[_0x4c54('0x2d')]=this[_0x4c54('0x29')][_0x4c54('0x2c')]['service'];}else{_0x5c8ceb['host']=this[_0x4c54('0x29')][_0x4c54('0x2c')][_0x4c54('0x2e')];_0x5c8ceb['port']=this[_0x4c54('0x29')][_0x4c54('0x2c')]['port'];_0x5c8ceb[_0x4c54('0x2f')]=this['account'][_0x4c54('0x2c')][_0x4c54('0x2f')];}if(this['account'][_0x4c54('0x2c')][_0x4c54('0x30')]){_0x5c8ceb[_0x4c54('0x31')]={'user':this[_0x4c54('0x29')][_0x4c54('0x2c')][_0x4c54('0x32')],'pass':this['account'][_0x4c54('0x2c')][_0x4c54('0x33')]};}_0x24b22f['inReplyTo']=this[_0x4c54('0x1e')]['messageId'];_0x24b22f[_0x4c54('0x34')]=_0x4c54('0x35')+_['replace'](_0x24b22f[_0x4c54('0x1c')],'0xff){_0x1f0004['body']=_0x384cd0[0x5];return rpc[_0x1d75dd+_0xe644('0x9')][_0xe644('0xa')](_0x1f0004)[_0xe644('0xb')](function(_0x1eaa10){logger[_0xe644('0xc')]('[%s][DIALOGFLOWV2]\x20%s',_0x30a116,_0x1f0004[_0xe644('0x23')]);})[_0xe644('0xe')](function(_0x54c2e2){logger[_0xe644('0xf')](_0xe644('0xd'),_0x30a116,JSON[_0xe644('0x10')](_0x54c2e2));})['finally'](function(){_0x3c5e29['stop']();});}return _0x23cd50[_0xe644('0x28')](_0x40daee)['then'](function(_0x36a0b1){if(_0x36a0b1&&_0x36a0b1[_0xe644('0x27')]){_0x2a476f[_0xe644('0x23')][_0xe644('0x29')]=_0x36a0b1;var _0x8d1a1f=_0x36a0b1[0x0];var _0x39487c=_0x8d1a1f[_0xe644('0x2a')][_0xe644('0x2b')]&&_0x8d1a1f[_0xe644('0x2a')][_0xe644('0x2b')][_0xe644('0x2c')]?_0x8d1a1f[_0xe644('0x2a')][_0xe644('0x2b')]['fields']['end_conversation'][_0xe644('0x2d')]:![];_0x2a476f['body']['DIALOGFLOWV2_ACTION']=_0x8d1a1f[_0xe644('0x2a')]['action'];_0x2a476f[_0xe644('0x23')][_0xe644('0x2e')]=_0x8d1a1f[_0xe644('0x2a')]['allRequiredParamsPresent'];_0x2a476f['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x8d1a1f[_0xe644('0x2a')][_0xe644('0x2b')]&&_0x8d1a1f[_0xe644('0x2a')][_0xe644('0x2b')][_0xe644('0x2c')]?_0x8d1a1f[_0xe644('0x2a')][_0xe644('0x2b')]['fields'][_0xe644('0x2f')][_0xe644('0x2d')]:![];_0x2a476f['body'][_0xe644('0x30')]=_0x8d1a1f['queryResult']['intent'][_0xe644('0x31')];_0x2a476f[_0xe644('0x23')][_0xe644('0x32')]=_0x8d1a1f[_0xe644('0x2a')][_0xe644('0x33')]['displayName'];_0x2a476f[_0xe644('0x23')][_0xe644('0x34')]=_0x8d1a1f[_0xe644('0x2a')][_0xe644('0x33')][_0xe644('0x35')];_0x2a476f['body'][_0xe644('0x36')]=_0x8d1a1f[_0xe644('0x2a')]['languageCode'];_0x2a476f[_0xe644('0x23')][_0xe644('0x37')]=_0x8d1a1f['queryResult'][_0xe644('0x38')];_0x2a476f[_0xe644('0x23')][_0xe644('0x39')]=_0x8d1a1f['queryResult']['intentDetectionConfidence'];_0x1f0004[_0xe644('0x3a')]=_0xe644('0x29');_0x1f0004['providerResponse']=JSON[_0xe644('0x10')](_0x36a0b1);var _0xd1da9b=[];for(var _0xc35fdd=0x0;_0xc35fdd<_0x36a0b1[_0xe644('0x27')];_0xc35fdd++){var _0x8aa5b6=_0x36a0b1[_0xc35fdd];if(_0x8aa5b6&&_0x8aa5b6[_0xe644('0x2a')]&&_0x8aa5b6['queryResult'][_0xe644('0x3b')]){_0xd1da9b[_0xe644('0x3c')](createMessage(_0x30a116,_0x1d75dd,_0x1f0004,_0x8aa5b6[_0xe644('0x2a')][_0xe644('0x3b')]));}}return Promise[_0xe644('0x3d')](_0xd1da9b)[_0xe644('0xb')](function(){if(_0x39487c){_0x3c5e29[_0xe644('0x15')]();}else{_0x3c5e29[_0xe644('0x24')]();}})[_0xe644('0xe')](function(_0x7bb4ea){logger['error'](_0xe644('0xd'),_0x30a116,JSON[_0xe644('0x10')](_0x7bb4ea));_0x3c5e29['next']();});}})[_0xe644('0xe')](function(_0x292d09){logger[_0xe644('0xf')](_0xe644('0xd'),_0x30a116,_0x292d09['message']);_0x3c5e29['next']();});}}catch(_0x26b2b6){logger[_0xe644('0xf')](_0xe644('0xd'),_0x30a116,JSON[_0xe644('0x10')](_0x26b2b6));_0x3c5e29[_0xe644('0x24')]();}};}; \ No newline at end of file +var _0xc7d5=['sms','whatsapp','chat','account','upperFirst','AccountId','InteractionId','getMustacheRender','finally','stop','SessionsClient','sessionPath','message','length','detectIntent','then','dialogflowV2','queryResult','diagnosticInfo','fields','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel'];(function(_0x7f91ed,_0x5870e5){var _0x56b3d8=function(_0x55a249){while(--_0x55a249){_0x7f91ed['push'](_0x7f91ed['shift']());}};_0x56b3d8(++_0x5870e5);}(_0xc7d5,0x6b));var _0x5c7d=function(_0x1f33b1,_0x237ea3){_0x1f33b1=_0x1f33b1-0x0;var _0x408a43=_0xc7d5[_0x1f33b1];return _0x408a43;};'use strict';var _=require(_0x5c7d('0x0'));var dialogflow=require(_0x5c7d('0x1'));var md5=require(_0x5c7d('0x2'));var moment=require(_0x5c7d('0x3'));var Promise=require(_0x5c7d('0x4'));var logger=require(_0x5c7d('0x5'))(_0x5c7d('0x6'));var utils=require('./utils');var rpc={'chatMessage':require(_0x5c7d('0x7')),'openchannelMessage':require(_0x5c7d('0x8')),'mailMessage':require(_0x5c7d('0x9')),'smsMessage':require(_0x5c7d('0xa')),'faxMessage':require(_0x5c7d('0xb')),'whatsappMessage':require(_0x5c7d('0xc'))};function createMessage(_0xb8c11a,_0xd264b7,_0x370be6,_0x5016c1){return new Promise(function(_0x2a7b27,_0x5704cd){var _0x408989=_[_0x5c7d('0xd')](_0x370be6);_0x408989[_0x5c7d('0xe')]=_0x5016c1;return rpc[_0xd264b7+_0x5c7d('0xf')][_0x5c7d('0x10')](_0x408989)['then'](function(){logger[_0x5c7d('0x11')](_0x5c7d('0x12'),_0xb8c11a,_0x408989['body']);_0x2a7b27();})[_0x5c7d('0x13')](function(_0x129d3a){logger[_0x5c7d('0x14')](_0x5c7d('0x12'),_0xb8c11a,JSON[_0x5c7d('0x15')](_0x129d3a));_0x5704cd(_0x129d3a);});});}exports[_0x5c7d('0x16')]=function(_0x263fbf,_0xba3d3e){return function(_0x7b6184){try{if(!_[_0x5c7d('0x17')](this[_0x5c7d('0x18')][_0x5c7d('0x19')])){logger[_0x5c7d('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x263fbf,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x7b6184[_0x5c7d('0x1a')]();}var _0x382ffb={'ContactId':this[_0x5c7d('0x1b')]['id'],'sentAt':moment()[_0x5c7d('0x1c')](_0x5c7d('0x1d')),'direction':'out'};if(this[_0x5c7d('0x1e')]===_0x5c7d('0x1f')||this['channel']===_0x5c7d('0x20')){_0x382ffb['phone']=this[_0x5c7d('0x18')]['phone'];}var _0xe4cef3=this[_0x5c7d('0x1e')];if(_0xe4cef3===_0x5c7d('0x21')){_0x382ffb['ChatWebsiteId']=this[_0x5c7d('0x22')]['id'];}else{_0x382ffb[_[_0x5c7d('0x23')](_0xe4cef3)+_0x5c7d('0x24')]=this['account']['id'];}_0x382ffb[_[_0x5c7d('0x23')](_0xe4cef3)+_0x5c7d('0x25')]=this[_0x5c7d('0x18')]['id'];if(this[_0x5c7d('0x18')]['created']){var _0x4b9792=_0xba3d3e[0x4];if(!_['isEmpty'](_0x4b9792)){_0x382ffb[_0x5c7d('0xe')]=utils[_0x5c7d('0x26')](_0x4b9792,this);return rpc[_0xe4cef3+_0x5c7d('0xf')]['create'](_0x382ffb)['then'](function(_0x5f5da5){logger[_0x5c7d('0x11')](_0x5c7d('0x12'),_0x263fbf,_0x382ffb[_0x5c7d('0xe')]);})[_0x5c7d('0x13')](function(_0x312a07){logger['error'](_0x5c7d('0x12'),_0x263fbf,JSON[_0x5c7d('0x15')](_0x312a07));})[_0x5c7d('0x27')](function(){logger[_0x5c7d('0x11')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x263fbf);_0x7b6184[_0x5c7d('0x28')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x263fbf);_0x7b6184[_0x5c7d('0x28')]();}}else{var _0x4a9b27=this;var _0x39b850=_0xba3d3e[0x2]['replace'](/\\n/g,'\x0a');var _0x4c5bdf={'credentials':{'private_key':_0x39b850,'client_email':_0xba3d3e[0x1]}};var _0x5828ae=new dialogflow[(_0x5c7d('0x29'))](_0x4c5bdf);var _0x4b85bd=_0x5828ae[_0x5c7d('0x2a')](_0xba3d3e[0x0],md5(_0x4a9b27[_0x5c7d('0x18')]['id']));var _0x158dfd={'session':_0x4b85bd,'queryInput':{'text':{'text':_0x4a9b27[_0x5c7d('0x2b')]['body'],'languageCode':_0xba3d3e[0x3]||'en'}}};if(_0x4a9b27[_0x5c7d('0x2b')][_0x5c7d('0xe')][_0x5c7d('0x2c')]>0xff){_0x382ffb[_0x5c7d('0xe')]=_0xba3d3e[0x5];return rpc[_0xe4cef3+_0x5c7d('0xf')][_0x5c7d('0x10')](_0x382ffb)['then'](function(_0x4e24ad){logger[_0x5c7d('0x11')](_0x5c7d('0x12'),_0x263fbf,_0x382ffb[_0x5c7d('0xe')]);})[_0x5c7d('0x13')](function(_0x3278c8){logger['error'](_0x5c7d('0x12'),_0x263fbf,JSON[_0x5c7d('0x15')](_0x3278c8));})['finally'](function(){_0x7b6184[_0x5c7d('0x28')]();});}return _0x5828ae[_0x5c7d('0x2d')](_0x158dfd)[_0x5c7d('0x2e')](function(_0x442a03){if(_0x442a03&&_0x442a03['length']){_0x4a9b27[_0x5c7d('0xe')][_0x5c7d('0x2f')]=_0x442a03;var _0x32964d=_0x442a03[0x0];var _0x18a20e=_0x32964d[_0x5c7d('0x30')][_0x5c7d('0x31')]&&_0x32964d[_0x5c7d('0x30')]['diagnosticInfo'][_0x5c7d('0x32')]?_0x32964d[_0x5c7d('0x30')][_0x5c7d('0x31')][_0x5c7d('0x32')]['end_conversation']['boolValue']:![];_0x4a9b27[_0x5c7d('0xe')][_0x5c7d('0x33')]=_0x32964d[_0x5c7d('0x30')]['action'];_0x4a9b27['body'][_0x5c7d('0x34')]=_0x32964d['queryResult'][_0x5c7d('0x35')];_0x4a9b27[_0x5c7d('0xe')][_0x5c7d('0x36')]=_0x32964d[_0x5c7d('0x30')][_0x5c7d('0x31')]&&_0x32964d[_0x5c7d('0x30')][_0x5c7d('0x31')][_0x5c7d('0x32')]?_0x32964d['queryResult'][_0x5c7d('0x31')][_0x5c7d('0x32')][_0x5c7d('0x37')]['boolValue']:![];_0x4a9b27['body'][_0x5c7d('0x38')]=_0x32964d[_0x5c7d('0x30')][_0x5c7d('0x39')]['name'];_0x4a9b27[_0x5c7d('0xe')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x32964d['queryResult'][_0x5c7d('0x39')][_0x5c7d('0x3a')];_0x4a9b27[_0x5c7d('0xe')][_0x5c7d('0x3b')]=_0x32964d[_0x5c7d('0x30')][_0x5c7d('0x39')]['isFallback'];_0x4a9b27[_0x5c7d('0xe')]['DIALOGFLOWV2_LANGUAGECODE']=_0x32964d[_0x5c7d('0x30')][_0x5c7d('0x3c')];_0x4a9b27[_0x5c7d('0xe')]['DIALOGFLOWV2_QUERYTEXT']=_0x32964d[_0x5c7d('0x30')][_0x5c7d('0x3d')];_0x4a9b27[_0x5c7d('0xe')][_0x5c7d('0x3e')]=_0x32964d[_0x5c7d('0x30')][_0x5c7d('0x3f')];_0x382ffb[_0x5c7d('0x40')]=_0x5c7d('0x2f');_0x382ffb[_0x5c7d('0x41')]=JSON[_0x5c7d('0x15')](_0x442a03);var _0x5a0c9b=[];for(var _0x3eb8cf=0x0;_0x3eb8cf<_0x442a03['length'];_0x3eb8cf++){var _0x38e540=_0x442a03[_0x3eb8cf];if(_0x38e540&&_0x38e540['queryResult']&&_0x38e540['queryResult'][_0x5c7d('0x42')]){_0x5a0c9b[_0x5c7d('0x43')](createMessage(_0x263fbf,_0xe4cef3,_0x382ffb,_0x38e540['queryResult'][_0x5c7d('0x42')]));}}return Promise[_0x5c7d('0x44')](_0x5a0c9b)[_0x5c7d('0x2e')](function(){if(_0x18a20e){_0x7b6184['next']();}else{_0x7b6184[_0x5c7d('0x28')]();}})['catch'](function(_0x55d3f7){logger[_0x5c7d('0x14')](_0x5c7d('0x12'),_0x263fbf,JSON[_0x5c7d('0x15')](_0x55d3f7));_0x7b6184[_0x5c7d('0x1a')]();});}})[_0x5c7d('0x13')](function(_0x3010c7){logger[_0x5c7d('0x14')](_0x5c7d('0x12'),_0x263fbf,_0x3010c7[_0x5c7d('0x2b')]);_0x7b6184[_0x5c7d('0x1a')]();});}}catch(_0x544a92){logger[_0x5c7d('0x14')]('[%s][DIALOGFLOWV2]\x20%s',_0x263fbf,JSON[_0x5c7d('0x15')](_0x544a92));_0x7b6184['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index ad9510f..c2d95eb 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 _0x3aba=['lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','consequence','fromString','validate','length','error','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify'];(function(_0x956e4d,_0x1f0f89){var _0x36ac46=function(_0x1fa413){while(--_0x1fa413){_0x956e4d['push'](_0x956e4d['shift']());}};_0x36ac46(++_0x1f0f89);}(_0x3aba,0x152));var _0xa3ab=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0x3aba[_0x2f48cd];return _0x193ae2;};'use strict';var schema=require('validate');var _=require(_0xa3ab('0x0'));var htmlToText=require(_0xa3ab('0x1'));var utils=require('./utils');var logger=require(_0xa3ab('0x2'))(_0xa3ab('0x3'));var gotoif=schema({'condition':{'type':_0xa3ab('0x4'),'required':!![],'message':_0xa3ab('0x5')},'priorityTrue':{'type':'number','message':_0xa3ab('0x6')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xa3ab('0x7')]=function(_0x35ea9e,_0x336a96){return function(_0x4719f4){try{var _0xdc849={'condition':htmlToText[_0xa3ab('0x8')](utils['getMustacheRender'](_0x336a96[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x336a96[0x1],'priorityFalse':_0x336a96[0x2]};var _0x50516e=gotoif[_0xa3ab('0x9')](_0xdc849,{'typecast':!![]});if(_0x50516e[_0xa3ab('0xa')]){logger[_0xa3ab('0xb')](_0xa3ab('0xc'),_0x35ea9e,_['map'](_0x50516e,_0xa3ab('0xd'))[_0xa3ab('0xe')](',\x20'));_0x4719f4[_0xa3ab('0xf')]();}else{try{var _0x5a0013=eval('('+_0xdc849[_0xa3ab('0x10')]+')');var _0x191202=_0x5a0013?_0xdc849[_0xa3ab('0x11')]:_0xdc849[_0xa3ab('0x12')];logger[_0xa3ab('0x13')](_0xa3ab('0x14'),_0x35ea9e,_0xdc849[_0xa3ab('0x10')],_0x5a0013,_0x191202||_0xa3ab('0x15'));if(_0x191202){var _0x14f7bb=_['findIndex'](_0x4719f4[_0xa3ab('0x16')](),{'p':_0x191202});if(_0x14f7bb>=0x0){logger[_0xa3ab('0x13')](_0xa3ab('0x17'),_0x35ea9e,_0x191202||'next',_0x14f7bb);_0x4719f4[_0xa3ab('0x15')](_0x14f7bb);}else{logger['info'](_0xa3ab('0x18'),_0x35ea9e,_0x191202||_0xa3ab('0x15'));_0x4719f4[_0xa3ab('0xf')]();}}else{_0x4719f4['next']();}}catch(_0x31e9ab){logger[_0xa3ab('0xb')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x35ea9e,_0x31e9ab['message']);_0x4719f4[_0xa3ab('0xf')]();}}}catch(_0x231321){logger[_0xa3ab('0xb')]('[%s][GOTOIF]\x20%s',_0x35ea9e,JSON[_0xa3ab('0x19')](_0x231321));_0x4719f4['stop']();}};}; \ No newline at end of file +var _0x3242=['getMustacheRender','replace','error','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityTrue','priorityFalse','findIndex','info','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','./utils','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x3242,0x12e));var _0x2324=function(_0x4fd931,_0x11af78){_0x4fd931=_0x4fd931-0x0;var _0x4f39e6=_0x3242[_0x4fd931];return _0x4f39e6;};'use strict';var schema=require(_0x2324('0x0'));var _=require(_0x2324('0x1'));var htmlToText=require(_0x2324('0x2'));var utils=require(_0x2324('0x3'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0x2324('0x4'),'required':!![],'message':_0x2324('0x5')},'priorityTrue':{'type':_0x2324('0x6'),'message':_0x2324('0x7')},'priorityFalse':{'type':_0x2324('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x2324('0x8')]=function(_0x571851,_0x5add97){return function(_0x454c4c){try{var _0x5c87ac={'condition':htmlToText[_0x2324('0x9')](utils[_0x2324('0xa')](_0x5add97[0x0],this),{'wordwrap':![]})[_0x2324('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5add97[0x1],'priorityFalse':_0x5add97[0x2]};var _0x3dfb6b=gotoif[_0x2324('0x0')](_0x5c87ac,{'typecast':!![]});if(_0x3dfb6b['length']){logger[_0x2324('0xc')](_0x2324('0xd'),_0x571851,_['map'](_0x3dfb6b,_0x2324('0xe'))[_0x2324('0xf')](',\x20'));_0x454c4c[_0x2324('0x10')]();}else{try{var _0x97479f=eval('('+_0x5c87ac[_0x2324('0x11')]+')');var _0xfa36fc=_0x97479f?_0x5c87ac[_0x2324('0x12')]:_0x5c87ac[_0x2324('0x13')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x571851,_0x5c87ac[_0x2324('0x11')],_0x97479f,_0xfa36fc||'next');if(_0xfa36fc){var _0xfcd233=_[_0x2324('0x14')](_0x454c4c['rules'](),{'p':_0xfa36fc});if(_0xfcd233>=0x0){logger[_0x2324('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x571851,_0xfa36fc||_0x2324('0x16'),_0xfcd233);_0x454c4c[_0x2324('0x16')](_0xfcd233);}else{logger[_0x2324('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x571851,_0xfa36fc||'next');_0x454c4c[_0x2324('0x10')]();}}else{_0x454c4c[_0x2324('0x16')]();}}catch(_0x54f7d5){logger[_0x2324('0xc')](_0x2324('0x17'),_0x571851,_0x54f7d5['message']);_0x454c4c[_0x2324('0x10')]();}}}catch(_0x3071c7){logger[_0x2324('0xc')](_0x2324('0xd'),_0x571851,JSON['stringify'](_0x3071c7));_0x454c4c[_0x2324('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index d579f58..d3a95d6 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 _0xdf48=['[%s][GOTOP]\x20priority\x20%s','priority','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop'];(function(_0x183900,_0x560e2c){var _0x2b1c8c=function(_0x2e9b1d){while(--_0x2e9b1d){_0x183900['push'](_0x183900['shift']());}};_0x2b1c8c(++_0x560e2c);}(_0xdf48,0x8c));var _0x8df4=function(_0x50845a,_0x2a5829){_0x50845a=_0x50845a-0x0;var _0x365b94=_0xdf48[_0x50845a];return _0x365b94;};'use strict';var schema=require(_0x8df4('0x0'));var _=require(_0x8df4('0x1'));var logger=require(_0x8df4('0x2'))(_0x8df4('0x3'));var gotop=schema({'priority':{'type':_0x8df4('0x4'),'required':!![],'message':_0x8df4('0x5')}});exports[_0x8df4('0x6')]=function(_0x212249,_0x54ac78){return function(_0x5838bc){try{var _0x1befc7={'priority':_0x54ac78[0x0]};var _0x11b6c4=gotop[_0x8df4('0x0')](_0x1befc7,{'typecast':!![]});if(_0x11b6c4[_0x8df4('0x7')]){logger[_0x8df4('0x8')](_0x8df4('0x9'),_0x212249,_[_0x8df4('0xa')](_0x11b6c4,_0x8df4('0xb'))[_0x8df4('0xc')](',\x20'));_0x5838bc[_0x8df4('0xd')]();}else{logger['info'](_0x8df4('0xe'),_0x212249,_0x1befc7[_0x8df4('0xf')]);if(_0x1befc7[_0x8df4('0xf')]){var _0x40f468=_['findIndex'](_0x5838bc[_0x8df4('0x10')](),{'p':_0x1befc7[_0x8df4('0xf')]});if(_0x40f468>=0x0){logger[_0x8df4('0x11')](_0x8df4('0x12'),_0x212249,_0x1befc7[_0x8df4('0xf')]||'next',_0x40f468);_0x5838bc[_0x8df4('0x13')](_0x40f468);}else{logger[_0x8df4('0x11')](_0x8df4('0x14'),_0x212249,_0x1befc7['priority']||_0x8df4('0x13'));_0x5838bc[_0x8df4('0xd')]();}}else{_0x5838bc[_0x8df4('0x13')]();}}}catch(_0x560cd7){logger[_0x8df4('0x8')](_0x8df4('0x9'),_0x212249,JSON[_0x8df4('0x15')](_0x560cd7));_0x5838bc[_0x8df4('0xd')]();}};}; \ No newline at end of file +var _0xeddd=['lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate'];(function(_0x332412,_0x3b9e07){var _0xf45ac8=function(_0x205757){while(--_0x205757){_0x332412['push'](_0x332412['shift']());}};_0xf45ac8(++_0x3b9e07);}(_0xeddd,0x13a));var _0xdedd=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xeddd[_0x4ff09b];return _0x3f5c2e;};'use strict';var schema=require(_0xdedd('0x0'));var _=require(_0xdedd('0x1'));var logger=require(_0xdedd('0x2'))('routing');var gotop=schema({'priority':{'type':_0xdedd('0x3'),'required':!![],'message':_0xdedd('0x4')}});exports[_0xdedd('0x5')]=function(_0x528063,_0x3c8681){return function(_0x2f22ab){try{var _0x2b3597={'priority':_0x3c8681[0x0]};var _0x586496=gotop[_0xdedd('0x0')](_0x2b3597,{'typecast':!![]});if(_0x586496[_0xdedd('0x6')]){logger[_0xdedd('0x7')](_0xdedd('0x8'),_0x528063,_[_0xdedd('0x9')](_0x586496,_0xdedd('0xa'))[_0xdedd('0xb')](',\x20'));_0x2f22ab[_0xdedd('0xc')]();}else{logger[_0xdedd('0xd')](_0xdedd('0xe'),_0x528063,_0x2b3597[_0xdedd('0xf')]);if(_0x2b3597['priority']){var _0x51cb2d=_[_0xdedd('0x10')](_0x2f22ab['rules'](),{'p':_0x2b3597[_0xdedd('0xf')]});if(_0x51cb2d>=0x0){logger[_0xdedd('0xd')](_0xdedd('0x11'),_0x528063,_0x2b3597[_0xdedd('0xf')]||'next',_0x51cb2d);_0x2f22ab[_0xdedd('0x12')](_0x51cb2d);}else{logger['info'](_0xdedd('0x13'),_0x528063,_0x2b3597[_0xdedd('0xf')]||_0xdedd('0x12'));_0x2f22ab[_0xdedd('0xc')]();}}else{_0x2f22ab[_0xdedd('0x12')]();}}}catch(_0x5b6ba8){logger[_0xdedd('0x7')](_0xdedd('0x8'),_0x528063,JSON[_0xdedd('0x14')](_0x5b6ba8));_0x2f22ab[_0xdedd('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index a69e27e..35d970f 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 _0xc4dd=['../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','getMustacheRender','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','then','info','body','next','catch','error','stop','[%s][MESSAGE]\x20%s','lodash','./utils'];(function(_0x3868c2,_0xed112d){var _0x1de8a6=function(_0x321374){while(--_0x321374){_0x3868c2['push'](_0x3868c2['shift']());}};_0x1de8a6(++_0xed112d);}(_0xc4dd,0xad));var _0xdc4d=function(_0x39afc7,_0x530dbc){_0x39afc7=_0x39afc7-0x0;var _0xd918ea=_0xc4dd[_0x39afc7];return _0xd918ea;};'use strict';var _=require(_0xdc4d('0x0'));var utils=require(_0xdc4d('0x1'));var logger=require(_0xdc4d('0x2'))('routing');var rpc={'chatMessage':require(_0xdc4d('0x3')),'openchannelMessage':require(_0xdc4d('0x4')),'mailMessage':require(_0xdc4d('0x5')),'smsMessage':require(_0xdc4d('0x6')),'faxMessage':require(_0xdc4d('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x27d6a9,_0x1696e3){return function(_0x5d4933){try{var _0x3c4ce7={'body':utils[_0xdc4d('0x8')](_0x1696e3[0x0],this),'ContactId':this['contact']['id']};if(this[_0xdc4d('0x9')]===_0xdc4d('0xa')){_0x3c4ce7[_0xdc4d('0xb')]=this[_0xdc4d('0xc')]['id'];}else{_0x3c4ce7[_[_0xdc4d('0xd')](this[_0xdc4d('0x9')])+_0xdc4d('0xe')]=this['account']['id'];}_0x3c4ce7[_[_0xdc4d('0xd')](this[_0xdc4d('0x9')])+'InteractionId']=this[_0xdc4d('0xf')]['id'];if(rpc[this['channel']+_0xdc4d('0x10')]){return rpc[this['channel']+'Message']['create'](_0x3c4ce7)[_0xdc4d('0x11')](function(_0xc63ead){logger[_0xdc4d('0x12')]('[%s][MESSAGE]\x20%s',_0x27d6a9,_0x3c4ce7[_0xdc4d('0x13')]);_0x5d4933[_0xdc4d('0x14')]();})[_0xdc4d('0x15')](function(_0x586e74){logger[_0xdc4d('0x16')]('[%s][MESSAGE]\x20%s',_0x27d6a9,JSON['stringify'](_0x586e74));_0x5d4933[_0xdc4d('0x17')]();});}}catch(_0xff4e3){logger[_0xdc4d('0x16')](_0xdc4d('0x18'),_0x27d6a9,JSON['stringify'](_0xff4e3));_0x5d4933[_0xdc4d('0x17')]();}};}; \ No newline at end of file +var _0x2b47=['create','then','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','contact','channel','ChatWebsiteId','AccountId','interaction','Message'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x2b47,0x77));var _0x72b4=function(_0x50001e,_0x588659){_0x50001e=_0x50001e-0x0;var _0x5d7426=_0x2b47[_0x50001e];return _0x5d7426;};'use strict';var _=require(_0x72b4('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x72b4('0x1'));var rpc={'chatMessage':require(_0x72b4('0x2')),'openchannelMessage':require(_0x72b4('0x3')),'mailMessage':require(_0x72b4('0x4')),'smsMessage':require(_0x72b4('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x72b4('0x6'))};exports['consequence']=function(_0x3e7572,_0xbbdddf){return function(_0x543f61){try{var _0x577b5c={'body':utils['getMustacheRender'](_0xbbdddf[0x0],this),'ContactId':this[_0x72b4('0x7')]['id']};if(this[_0x72b4('0x8')]==='chat'){_0x577b5c[_0x72b4('0x9')]=this['account']['id'];}else{_0x577b5c[_['upperFirst'](this[_0x72b4('0x8')])+_0x72b4('0xa')]=this['account']['id'];}_0x577b5c[_['upperFirst'](this[_0x72b4('0x8')])+'InteractionId']=this[_0x72b4('0xb')]['id'];if(rpc[this[_0x72b4('0x8')]+_0x72b4('0xc')]){return rpc[this[_0x72b4('0x8')]+'Message'][_0x72b4('0xd')](_0x577b5c)[_0x72b4('0xe')](function(_0x4c57a0){logger['info'](_0x72b4('0xf'),_0x3e7572,_0x577b5c[_0x72b4('0x10')]);_0x543f61[_0x72b4('0x11')]();})[_0x72b4('0x12')](function(_0x383706){logger[_0x72b4('0x13')](_0x72b4('0xf'),_0x3e7572,JSON[_0x72b4('0x14')](_0x383706));_0x543f61[_0x72b4('0x15')]();});}}catch(_0x2a7a05){logger[_0x72b4('0x13')](_0x72b4('0xf'),_0x3e7572,JSON[_0x72b4('0x14')](_0x2a7a05));_0x543f61['stop']();}};}; \ 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 0b8e4c4..58f0c9b 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 _0x9685=['getMustacheRender','next','error','stringify','stop','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x15bb23,_0x358cec){var _0x1dbe94=function(_0x598f2a){while(--_0x598f2a){_0x15bb23['push'](_0x15bb23['shift']());}};_0x1dbe94(++_0x358cec);}(_0x9685,0x13b));var _0x5968=function(_0x3c9135,_0x3b8891){_0x3c9135=_0x3c9135-0x0;var _0x4f0596=_0x9685[_0x3c9135];return _0x4f0596;};'use strict';var utils=require('./utils');var logger=require(_0x5968('0x0'))(_0x5968('0x1'));exports[_0x5968('0x2')]=function(_0x2aa9a5,_0x122ea1){return function(_0x38e170){try{logger[_0x5968('0x3')](_0x5968('0x4'),_0x2aa9a5,utils[_0x5968('0x5')](_0x122ea1[0x0],this));_0x38e170[_0x5968('0x6')]();}catch(_0x2ca35e){logger[_0x5968('0x7')](_0x5968('0x4'),_0x2aa9a5,JSON[_0x5968('0x8')](_0x2ca35e));_0x38e170[_0x5968('0x9')]();}};}; \ No newline at end of file +var _0xfbcc=['error','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next'];(function(_0x3b76c6,_0x1d8403){var _0x32eecd=function(_0x3342ed){while(--_0x3342ed){_0x3b76c6['push'](_0x3b76c6['shift']());}};_0x32eecd(++_0x1d8403);}(_0xfbcc,0xf7));var _0xcfbc=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0xfbcc[_0x16e57d];return _0x40239c;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')('routing');exports[_0xcfbc('0x0')]=function(_0x2457e3,_0x27facd){return function(_0x4d7ce8){try{logger[_0xcfbc('0x1')](_0xcfbc('0x2'),_0x2457e3,utils[_0xcfbc('0x3')](_0x27facd[0x0],this));_0x4d7ce8[_0xcfbc('0x4')]();}catch(_0x4b2930){logger[_0xcfbc('0x5')]('[%s][NOOP]\x20%s',_0x2457e3,JSON['stringify'](_0x4b2930));_0x4d7ce8['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 1d8a88d..90c0f42 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 _0x97c0=['socket.io-emitter','queue','from','emit','clone','queue_id','account','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','upperFirst','InteractionId','interaction','MessageId','message','AccountId','WebsiteId','info','name','QueueReport','catch','error','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','validate','map','join','stop','find','Queues','atimeout','qtimeout','end','close','rules','complete','next','rrmemory','beepall','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','moment','../../../../config/environment','routing','./strategy','redis','localhost'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x97c0,0x8d));var _0x097c=function(_0x5f0029,_0x27b95a){_0x5f0029=_0x5f0029-0x0;var _0xaf524c=_0x97c0[_0x5f0029];return _0xaf524c;};'use strict';var schema=require('validate');var _=require(_0x097c('0x0'));var util=require(_0x097c('0x1'));var seqqueue=require(_0x097c('0x2'));var moment=require(_0x097c('0x3'));var Redis=require('ioredis');var config=require(_0x097c('0x4'));var logger=require('../../../../config/logger')(_0x097c('0x5'));var strategy=require(_0x097c('0x6'));config['redis']=_['defaults'](config[_0x097c('0x7')],{'host':_0x097c('0x8'),'port':0x18eb});var io=require(_0x097c('0x9'))(new Redis(config[_0x097c('0x7')]));var attributes=['id','queue_id','account',_0x097c('0xa'),_0x097c('0xb'),'joinAt'];function emit(_0xcb44f7,_0x2e7d98,_0x497c99){io['to'](_0xcb44f7)[_0x097c('0xc')](_0x2e7d98,_0x497c99);}function emitChannelQueueInteraction(_0x4b87fe,_0x1a9713,_0x1fe18e,_0x108a8d,_0x113229,_0x1a2454,_0x3a52e3,_0x39738b){var _0x26a9af=_[_0x097c('0xd')](_0x1fe18e);_0x26a9af[_0x097c('0xe')]=_0x39738b;_0x26a9af['queue']=_0x1a9713;_0x26a9af[_0x097c('0xf')]=_0x108a8d;_0x26a9af['id']=_0x113229;if(_0x1a2454){_0x3a52e3[util[_0x097c('0x10')](_0x097c('0x11'),_0x4b87fe)][_0x113229]=_['pick'](_0x26a9af,attributes);}else{delete _0x3a52e3[util[_0x097c('0x10')](_0x097c('0x11'),_0x4b87fe)][_0x113229];}emit(util[_0x097c('0x10')](_0x097c('0x12'),_0x4b87fe,_0x1a9713),util[_0x097c('0x10')](_0x097c('0x13'),_0x4b87fe,_0x1a2454?'save':_0x097c('0x14')),_[_0x097c('0x15')](_0x26a9af,attributes));}var rpc={'openchannelQueueReport':require(_0x097c('0x16')),'mailQueueReport':require(_0x097c('0x17')),'chatQueueReport':require(_0x097c('0x18')),'smsQueueReport':require(_0x097c('0x19')),'faxQueueReport':require(_0x097c('0x1a')),'whatsappQueueReport':require(_0x097c('0x1b'))};var queue=schema({'name':{'type':_0x097c('0x1c'),'required':!![],'message':_0x097c('0x1d')},'timeout':{'type':_0x097c('0x1e'),'message':_0x097c('0x1f')}});function startRouting(_0x4fe8f8,_0x2f60af,_0x5e6a1e,_0x532c16){if(_0x4fe8f8&&_0x2f60af&&_0x5e6a1e){_0x2f60af['waiting']+=0x1;var _0x57a1cb={'uniqueid':_0x4fe8f8,'from':_0x5e6a1e[_0x097c('0x20')]?_0x5e6a1e[_0x097c('0x20')][_0x097c('0xb')]:'','joinAt':moment()[_0x097c('0x10')](_0x097c('0x21')),'ContactId':_0x5e6a1e[_0x097c('0x22')]?_0x5e6a1e[_0x097c('0x22')]['id']:null,'ListId':_0x5e6a1e[_0x097c('0x23')]?_0x5e6a1e['list']['id']:null};_0x57a1cb[_['upperFirst'](_0x5e6a1e[_0x097c('0x24')])+'QueueId']=_0x2f60af['id']||null;_0x57a1cb[_[_0x097c('0x25')](_0x5e6a1e[_0x097c('0x24')])+_0x097c('0x26')]=_0x5e6a1e['interaction']?_0x5e6a1e[_0x097c('0x27')]['id']:null;_0x57a1cb[_[_0x097c('0x25')](_0x5e6a1e[_0x097c('0x24')])+_0x097c('0x28')]=_0x5e6a1e[_0x097c('0x29')]?_0x5e6a1e['message']['id']:null;_0x57a1cb[_[_0x097c('0x25')](_0x5e6a1e[_0x097c('0x24')])+(_0x5e6a1e[_0x097c('0x24')]!=='chat'?_0x097c('0x2a'):_0x097c('0x2b'))]=_0x5e6a1e[_0x097c('0xf')]?_0x5e6a1e['account']['id']:null;logger[_0x097c('0x2c')](util[_0x097c('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x4fe8f8,_0x2f60af[_0x097c('0x2d')]));emitChannelQueueInteraction(_0x5e6a1e[_0x097c('0x24')],_0x2f60af[_0x097c('0x2d')],_0x57a1cb,_0x5e6a1e[_0x097c('0xf')]['name'],_0x5e6a1e[_0x097c('0x29')]['id'],!![],_0x532c16,_0x2f60af['id']);if(rpc[_0x5e6a1e[_0x097c('0x24')]+_0x097c('0x2e')]){return rpc[_0x5e6a1e['channel']+_0x097c('0x2e')]['create'](_0x57a1cb)[_0x097c('0x2f')](function(_0x518590){logger[_0x097c('0x30')]('create\x20queue\x20report');});}}}function stopRouting(_0xf85a52,_0x242819,_0x4920bf,_0x2f1025){if(_0xf85a52&&_0x242819){_0x242819[_0x097c('0x31')]-=0x1;var _0x1a06cb={'leaveAt':moment()[_0x097c('0x10')](_0x097c('0x21')),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x097c('0x32')};logger[_0x097c('0x2c')](util[_0x097c('0x10')](_0x097c('0x33'),_0xf85a52,_0x242819['name']));emitChannelQueueInteraction(_0x4920bf[_0x097c('0x24')],_0x242819[_0x097c('0x2d')],_0x4920bf[_0x097c('0x20')],_0x4920bf[_0x097c('0xf')]['name'],_0x4920bf[_0x097c('0x29')]['id'],![],_0x2f1025,_0x242819['id']);if(rpc[_0x4920bf[_0x097c('0x24')]+_0x097c('0x2e')]){return rpc[_0x4920bf[_0x097c('0x24')]+'QueueReport']['update'](_0xf85a52,_0x1a06cb)['catch'](function(_0x2f4ceb){logger[_0x097c('0x30')](_0x097c('0x34'));});}}}function endRouting(_0x3c1d6a,_0xffe77d,_0x4393d3,_0x4fcd35){if(_0x3c1d6a&&_0xffe77d){_0xffe77d[_0x097c('0x31')]-=0x1;var _0x8a64ec={'leaveAt':moment()['format'](_0x097c('0x21')),'exitAt':moment()[_0x097c('0x10')](_0x097c('0x21')),'reason':'timeout'};logger[_0x097c('0x2c')](util[_0x097c('0x10')](_0x097c('0x35'),_0x3c1d6a,_0xffe77d[_0x097c('0x2d')]));emitChannelQueueInteraction(_0x4393d3[_0x097c('0x24')],_0xffe77d[_0x097c('0x2d')],_0x4393d3['body'],_0x4393d3['account'][_0x097c('0x2d')],_0x4393d3[_0x097c('0x29')]['id'],![],_0x4fcd35);if(rpc[_0x4393d3[_0x097c('0x24')]+_0x097c('0x2e')]){return rpc[_0x4393d3[_0x097c('0x24')]+_0x097c('0x2e')][_0x097c('0x36')](_0x3c1d6a,_0x8a64ec)[_0x097c('0x2f')](function(_0x25619d){logger[_0x097c('0x30')](_0x097c('0x34'));});}}}function handleFindQueue(_0xf92685){return function(_0x30eefe){return _0x30eefe['name'][_0x097c('0x37')]()===_0xf92685[_0x097c('0x37')]();};}exports[_0x097c('0x38')]=function(_0xeac141,_0x1b308f,_0x5727fd,_0x2a6c51){return function(_0x5352f3){try{var _0x2245dc={'name':_0x1b308f[0x0],'timeout':_0x1b308f[0x1]};var _0x4cae9d=queue[_0x097c('0x39')](_0x2245dc,{'typecast':!![]});if(_0x4cae9d['length']){logger[_0x097c('0x30')]('[%s][QUEUE]\x20%s',_0xeac141,_[_0x097c('0x3a')](_0x4cae9d,'message')[_0x097c('0x3b')](',\x20'));_0x5352f3[_0x097c('0x3c')]();}else{var _0x1cf368=_[_0x097c('0x3d')](_0x5727fd[_0x2a6c51[_0x097c('0x24')]+_0x097c('0x3e')],handleFindQueue(_0x2245dc[_0x097c('0x2d')]));if(_0x1cf368){startRouting(_0xeac141,_0x1cf368,_0x2a6c51,_0x5727fd);var _0x2f5577=(_0x1cf368['timeout']||0xa)*0x3e8;var _0x4e73ba=(_0x2245dc['timeout']||0x14)*0x3e8;var _0x456c1a,_0x5772c4;if(_0x2f5577>_0x4e73ba){_0x4e73ba=_0x2f5577;}var _0x1ef631=seqqueue['createQueue'](_0x2f5577);_0x1ef631['id']=_0xeac141;_0x1ef631[_0x097c('0x3f')]=_0x2f5577;_0x1ef631[_0x097c('0x40')]=_0x4e73ba;_0x1ef631[_0x097c('0x24')]=_0x2a6c51[_0x097c('0x24')];_0x5727fd['rules'][_0xeac141]['on'](_0x097c('0x41'),function(){logger[_0x097c('0x2c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0xeac141);stopRouting(_0xeac141,_0x1cf368,_0x2a6c51,_0x5727fd);clearTimeout(_0x456c1a);_0x456c1a=undefined;_0x1ef631[_0x097c('0x42')](!![]);if(_0x5727fd[_0x097c('0x43')][_0xeac141]){delete _0x5727fd[_0x097c('0x43')][_0xeac141];}_0x5352f3[_0x097c('0x3c')]();});_0x5727fd[_0x097c('0x43')][_0xeac141]['on'](_0x097c('0x44'),function(){if(_0x5727fd[_0x097c('0x43')][_0xeac141]){delete _0x5727fd[_0x097c('0x43')][_0xeac141];}});_0x456c1a=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0xeac141);endRouting(_0xeac141,_0x1cf368,_0x2a6c51,_0x5727fd);clearTimeout(_0x456c1a);_0x1ef631['close'](!![]);_0x5352f3[_0x097c('0x45')]();},_0x4e73ba);switch(_0x1cf368['strategy']){case'rrmemory':strategy[_0x097c('0x46')](_0x1ef631,_0x1cf368,_0x5727fd,_0x2a6c51);break;default:strategy[_0x097c('0x47')](_0x1ef631,_0x1cf368,_0x5727fd,_0x2a6c51);}}else{logger[_0x097c('0x30')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xeac141,_0x2245dc[_0x097c('0x2d')]);_0x5352f3[_0x097c('0x3c')]();}}}catch(_0x4c777c){console[_0x097c('0x48')](_0x4c777c);logger[_0x097c('0x30')](_0x097c('0x49'),_0xeac141,_0x4c777c[_0x097c('0x4a')]);_0x5352f3[_0x097c('0x3c')]();}};}; \ No newline at end of file +var _0xd719=['create','catch','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','update','error','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','timeout','createQueue','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','localhost','socket.io-emitter','queue','from','joinAt','emit','clone','account','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport'];(function(_0x3830eb,_0x184cf4){var _0x20747e=function(_0x5334bc){while(--_0x5334bc){_0x3830eb['push'](_0x3830eb['shift']());}};_0x20747e(++_0x184cf4);}(_0xd719,0xb8));var _0x9d71=function(_0x3a1769,_0x22369a){_0x3a1769=_0x3a1769-0x0;var _0x486817=_0xd719[_0x3a1769];return _0x486817;};'use strict';var schema=require(_0x9d71('0x0'));var _=require(_0x9d71('0x1'));var util=require('util');var seqqueue=require(_0x9d71('0x2'));var moment=require('moment');var Redis=require(_0x9d71('0x3'));var config=require(_0x9d71('0x4'));var logger=require(_0x9d71('0x5'))('routing');var strategy=require(_0x9d71('0x6'));config[_0x9d71('0x7')]=_[_0x9d71('0x8')](config['redis'],{'host':_0x9d71('0x9'),'port':0x18eb});var io=require(_0x9d71('0xa'))(new Redis(config['redis']));var attributes=['id','queue_id','account',_0x9d71('0xb'),_0x9d71('0xc'),_0x9d71('0xd')];function emit(_0x3583bb,_0x51f6a2,_0x3aef80){io['to'](_0x3583bb)[_0x9d71('0xe')](_0x51f6a2,_0x3aef80);}function emitChannelQueueInteraction(_0x2cd194,_0x5abe1f,_0xe43168,_0x52b127,_0x5d4e82,_0x5536cd,_0x2304a5,_0x5276a8){var _0x5ce923=_[_0x9d71('0xf')](_0xe43168);_0x5ce923['queue_id']=_0x5276a8;_0x5ce923[_0x9d71('0xb')]=_0x5abe1f;_0x5ce923[_0x9d71('0x10')]=_0x52b127;_0x5ce923['id']=_0x5d4e82;if(_0x5536cd){_0x2304a5[util[_0x9d71('0x11')]('%sQueuesWaitingInteractions',_0x2cd194)][_0x5d4e82]=_['pick'](_0x5ce923,attributes);}else{delete _0x2304a5[util['format']('%sQueuesWaitingInteractions',_0x2cd194)][_0x5d4e82];}emit(util['format'](_0x9d71('0x12'),_0x2cd194,_0x5abe1f),util[_0x9d71('0x11')](_0x9d71('0x13'),_0x2cd194,_0x5536cd?_0x9d71('0x14'):'remove'),_[_0x9d71('0x15')](_0x5ce923,attributes));}var rpc={'openchannelQueueReport':require(_0x9d71('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x9d71('0x17')),'smsQueueReport':require(_0x9d71('0x18')),'faxQueueReport':require(_0x9d71('0x19')),'whatsappQueueReport':require(_0x9d71('0x1a'))};var queue=schema({'name':{'type':_0x9d71('0x1b'),'required':!![],'message':_0x9d71('0x1c')},'timeout':{'type':_0x9d71('0x1d'),'message':_0x9d71('0x1e')}});function startRouting(_0x427c11,_0x35230e,_0x59d22e,_0x12cd00){if(_0x427c11&&_0x35230e&&_0x59d22e){_0x35230e[_0x9d71('0x1f')]+=0x1;var _0x265a9c={'uniqueid':_0x427c11,'from':_0x59d22e[_0x9d71('0x20')]?_0x59d22e['body']['from']:'','joinAt':moment()[_0x9d71('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x59d22e[_0x9d71('0x21')]?_0x59d22e[_0x9d71('0x21')]['id']:null,'ListId':_0x59d22e['list']?_0x59d22e[_0x9d71('0x22')]['id']:null};_0x265a9c[_[_0x9d71('0x23')](_0x59d22e[_0x9d71('0x24')])+'QueueId']=_0x35230e['id']||null;_0x265a9c[_[_0x9d71('0x23')](_0x59d22e['channel'])+_0x9d71('0x25')]=_0x59d22e[_0x9d71('0x26')]?_0x59d22e[_0x9d71('0x26')]['id']:null;_0x265a9c[_['upperFirst'](_0x59d22e[_0x9d71('0x24')])+_0x9d71('0x27')]=_0x59d22e[_0x9d71('0x28')]?_0x59d22e[_0x9d71('0x28')]['id']:null;_0x265a9c[_[_0x9d71('0x23')](_0x59d22e[_0x9d71('0x24')])+(_0x59d22e[_0x9d71('0x24')]!==_0x9d71('0x29')?_0x9d71('0x2a'):'WebsiteId')]=_0x59d22e[_0x9d71('0x10')]?_0x59d22e[_0x9d71('0x10')]['id']:null;logger[_0x9d71('0x2b')](util[_0x9d71('0x11')](_0x9d71('0x2c'),_0x427c11,_0x35230e[_0x9d71('0x2d')]));emitChannelQueueInteraction(_0x59d22e[_0x9d71('0x24')],_0x35230e['name'],_0x265a9c,_0x59d22e['account'][_0x9d71('0x2d')],_0x59d22e[_0x9d71('0x28')]['id'],!![],_0x12cd00,_0x35230e['id']);if(rpc[_0x59d22e['channel']+_0x9d71('0x2e')]){return rpc[_0x59d22e['channel']+_0x9d71('0x2e')][_0x9d71('0x2f')](_0x265a9c)[_0x9d71('0x30')](function(_0x2beca5){logger['error'](_0x9d71('0x31'));});}}}function stopRouting(_0x16ebf6,_0x59535a,_0x17ce4c,_0x2a9696){if(_0x16ebf6&&_0x59535a){_0x59535a['waiting']-=0x1;var _0x5ed5c8={'leaveAt':moment()['format'](_0x9d71('0x32')),'acceptAt':moment()[_0x9d71('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x9d71('0x33')};logger['info'](util[_0x9d71('0x11')](_0x9d71('0x34'),_0x16ebf6,_0x59535a[_0x9d71('0x2d')]));emitChannelQueueInteraction(_0x17ce4c[_0x9d71('0x24')],_0x59535a[_0x9d71('0x2d')],_0x17ce4c[_0x9d71('0x20')],_0x17ce4c[_0x9d71('0x10')]['name'],_0x17ce4c['message']['id'],![],_0x2a9696,_0x59535a['id']);if(rpc[_0x17ce4c[_0x9d71('0x24')]+'QueueReport']){return rpc[_0x17ce4c[_0x9d71('0x24')]+_0x9d71('0x2e')][_0x9d71('0x35')](_0x16ebf6,_0x5ed5c8)['catch'](function(_0x5b1145){logger[_0x9d71('0x36')](_0x9d71('0x37'));});}}}function endRouting(_0x2a03fb,_0x59d8bc,_0x14909d,_0x3680d6){if(_0x2a03fb&&_0x59d8bc){_0x59d8bc['waiting']-=0x1;var _0x3c5f60={'leaveAt':moment()[_0x9d71('0x11')](_0x9d71('0x32')),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0x9d71('0x2b')](util[_0x9d71('0x11')](_0x9d71('0x38'),_0x2a03fb,_0x59d8bc[_0x9d71('0x2d')]));emitChannelQueueInteraction(_0x14909d[_0x9d71('0x24')],_0x59d8bc[_0x9d71('0x2d')],_0x14909d[_0x9d71('0x20')],_0x14909d[_0x9d71('0x10')]['name'],_0x14909d[_0x9d71('0x28')]['id'],![],_0x3680d6);if(rpc[_0x14909d['channel']+_0x9d71('0x2e')]){return rpc[_0x14909d[_0x9d71('0x24')]+_0x9d71('0x2e')][_0x9d71('0x35')](_0x2a03fb,_0x3c5f60)['catch'](function(_0x528092){logger[_0x9d71('0x36')](_0x9d71('0x37'));});}}}function handleFindQueue(_0x5cea04){return function(_0xd92f3b){return _0xd92f3b[_0x9d71('0x2d')][_0x9d71('0x39')]()===_0x5cea04[_0x9d71('0x39')]();};}exports[_0x9d71('0x3a')]=function(_0x1d2c46,_0xa926dc,_0x18d629,_0x5f0409){return function(_0x2e77a5){try{var _0x2764e5={'name':_0xa926dc[0x0],'timeout':_0xa926dc[0x1]};var _0x23ebda=queue[_0x9d71('0x0')](_0x2764e5,{'typecast':!![]});if(_0x23ebda[_0x9d71('0x3b')]){logger['error'](_0x9d71('0x3c'),_0x1d2c46,_[_0x9d71('0x3d')](_0x23ebda,_0x9d71('0x28'))[_0x9d71('0x3e')](',\x20'));_0x2e77a5[_0x9d71('0x3f')]();}else{var _0x19704e=_[_0x9d71('0x40')](_0x18d629[_0x5f0409['channel']+'Queues'],handleFindQueue(_0x2764e5[_0x9d71('0x2d')]));if(_0x19704e){startRouting(_0x1d2c46,_0x19704e,_0x5f0409,_0x18d629);var _0x479b23=(_0x19704e[_0x9d71('0x41')]||0xa)*0x3e8;var _0x460844=(_0x2764e5[_0x9d71('0x41')]||0x14)*0x3e8;var _0x22d9f1,_0x2d6e38;if(_0x479b23>_0x460844){_0x460844=_0x479b23;}var _0xc8686c=seqqueue[_0x9d71('0x42')](_0x479b23);_0xc8686c['id']=_0x1d2c46;_0xc8686c['atimeout']=_0x479b23;_0xc8686c['qtimeout']=_0x460844;_0xc8686c[_0x9d71('0x24')]=_0x5f0409['channel'];_0x18d629[_0x9d71('0x43')][_0x1d2c46]['on']('end',function(){logger[_0x9d71('0x2b')](_0x9d71('0x44'),_0x1d2c46);stopRouting(_0x1d2c46,_0x19704e,_0x5f0409,_0x18d629);clearTimeout(_0x22d9f1);_0x22d9f1=undefined;_0xc8686c[_0x9d71('0x45')](!![]);if(_0x18d629['rules'][_0x1d2c46]){delete _0x18d629[_0x9d71('0x43')][_0x1d2c46];}_0x2e77a5[_0x9d71('0x3f')]();});_0x18d629[_0x9d71('0x43')][_0x1d2c46]['on'](_0x9d71('0x46'),function(){if(_0x18d629[_0x9d71('0x43')][_0x1d2c46]){delete _0x18d629[_0x9d71('0x43')][_0x1d2c46];}});_0x22d9f1=setTimeout(function(){logger['info'](_0x9d71('0x47'),_0x1d2c46);endRouting(_0x1d2c46,_0x19704e,_0x5f0409,_0x18d629);clearTimeout(_0x22d9f1);_0xc8686c[_0x9d71('0x45')](!![]);_0x2e77a5['next']();},_0x460844);switch(_0x19704e[_0x9d71('0x48')]){case _0x9d71('0x49'):strategy['rrmemory'](_0xc8686c,_0x19704e,_0x18d629,_0x5f0409);break;default:strategy['beepall'](_0xc8686c,_0x19704e,_0x18d629,_0x5f0409);}}else{logger[_0x9d71('0x36')](_0x9d71('0x4a'),_0x1d2c46,_0x2764e5[_0x9d71('0x2d')]);_0x2e77a5[_0x9d71('0x3f')]();}}}catch(_0x1d000e){console[_0x9d71('0x4b')](_0x1d000e);logger[_0x9d71('0x36')]('[%s][QUEUE]\x20%s',_0x1d2c46,_0x1d000e[_0x9d71('0x4c')]);_0x2e77a5[_0x9d71('0x3f')]();}};}; \ 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 34ff848..c5c07fd 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 _0x865a=['forcedOwnership','isAgentAvailable','channel','busy','showNotification','writeLog','RINGING',':FORCED','info','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','drained','prototype','[%s][AGENT]\x20try\x20with\x20%s','agent','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','routing'];(function(_0xd98ca3,_0x38fbd9){var _0x35960d=function(_0x52e8ee){while(--_0x52e8ee){_0xd98ca3['push'](_0xd98ca3['shift']());}};_0x35960d(++_0x38fbd9);}(_0x865a,0x1b5));var _0xa865=function(_0x8db9c3,_0x4940bf){_0x8db9c3=_0x8db9c3-0x0;var _0x4773a3=_0x865a[_0x8db9c3];return _0x4773a3;};'use strict';var _=require(_0xa865('0x0'));var uuid=require(_0xa865('0x1'));var util=require(_0xa865('0x2'));var logger=require(_0xa865('0x3'))('routing');var Agent=function(_0x2e5746,_0x4f50ee,_0x38ccc6,_0x196a0a){this[_0xa865('0x4')]=uuid['v4']();this[_0xa865('0x5')]=_0x2e5746;this['agent']=_0x4f50ee;this[_0xa865('0x6')]=_0x38ccc6;this['routing']=_0x196a0a;this[_0xa865('0x5')][_0xa865('0x7')](this[_0xa865('0x8')][_0xa865('0x9')](this),this['handleTimeout'][_0xa865('0x9')](this));this[_0xa865('0x5')]['on']('timeout',this[_0xa865('0xa')][_0xa865('0x9')](this));this['squeue']['on'](_0xa865('0xb'),this['handleDrained']['bind'](this));};Agent[_0xa865('0xc')]['push']=function(){this[_0xa865('0x5')][_0xa865('0x7')](this[_0xa865('0x8')][_0xa865('0x9')](this),this[_0xa865('0xa')][_0xa865('0x9')](this));};Agent[_0xa865('0xc')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0xa865('0xc')][_0xa865('0x8')]=function(_0x3e5a18){logger['info'](_0xa865('0xd'),this['squeue']['id'],this[_0xa865('0xe')]['id']);if(_['isNil'](this[_0xa865('0x6')][_0xa865('0xf')][this[_0xa865('0xe')]['id']])){logger['info'](_0xa865('0x10'),this[_0xa865('0x5')]['id'],this[_0xa865('0xe')]['id']);setTimeout(this[_0xa865('0x7')][_0xa865('0x9')](this),0x3e8);}else{if(this[_0xa865('0x11')][_0xa865('0x12')]||util[_0xa865('0x13')](this[_0xa865('0x5')]['id'],this[_0xa865('0x6')][_0xa865('0xf')][this[_0xa865('0xe')]['id']],this['squeue'][_0xa865('0x14')],![])){this[_0xa865('0x6')][_0xa865('0xf')][this[_0xa865('0xe')]['id']][_0xa865('0x15')]=!![];this[_0xa865('0x6')][_0xa865('0xf')][this['agent']['id']]['busyQueue']=undefined;util[_0xa865('0x16')](this[_0xa865('0x4')],this[_0xa865('0x5')]['id'],this[_0xa865('0x6')][_0xa865('0xf')][this['agent']['id']],null,this[_0xa865('0x11')]);util[_0xa865('0x17')](this[_0xa865('0x5')]['id'],this[_0xa865('0x6')][_0xa865('0xf')][this['agent']['id']],_0xa865('0x18')+(this[_0xa865('0x11')][_0xa865('0x12')]?_0xa865('0x19'):''));}else{logger[_0xa865('0x1a')](_0xa865('0x1b'),this[_0xa865('0x5')]['id'],this[_0xa865('0xe')]['id']);setTimeout(this['push'][_0xa865('0x9')](this),0x3e8);}}};Agent[_0xa865('0xc')][_0xa865('0xa')]=function(_0xe553e){if(_[_0xa865('0x1c')](this[_0xa865('0x6')][_0xa865('0xf')][this[_0xa865('0xe')]['id']])){return logger[_0xa865('0x1a')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xa865('0x5')]['id'],this[_0xa865('0xe')]['id']);}else{logger['info'](_0xa865('0x1d'),this[_0xa865('0x5')]['id'],this['agent']['id']);util[_0xa865('0x1e')](this[_0xa865('0x4')],this[_0xa865('0x5')]['id'],this['realtime'][_0xa865('0xf')][this[_0xa865('0xe')]['id']],null,this[_0xa865('0x11')]);this[_0xa865('0x6')][_0xa865('0xf')][this[_0xa865('0xe')]['id']]['busy']=![];this['realtime'][_0xa865('0xf')][this[_0xa865('0xe')]['id']][_0xa865('0x1f')]=undefined;util['writeLog'](this[_0xa865('0x5')]['id'],this[_0xa865('0x6')][_0xa865('0xf')][this['agent']['id']],_0xe553e?_0xa865('0x20'):_0xa865('0x21'));}if(!_0xe553e){setTimeout(this[_0xa865('0x7')]['bind'](this),0x3e8);}};function agent(_0x219451,_0x4a6a8f,_0x4b2a1c,_0x1b4b8e){return new Agent(_0x219451,_0x4a6a8f,_0x4b2a1c,_0x1b4b8e);}module[_0xa865('0x22')]=agent; \ No newline at end of file +var _0xce1d=['writeLog','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','agents','busy','busyQueue','showNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce1d,0x1be));var _0xdce1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xce1d[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var uuid=require(_0xdce1('0x0'));var util=require(_0xdce1('0x1'));var logger=require(_0xdce1('0x2'))(_0xdce1('0x3'));var Agent=function(_0x230eed,_0x1f2fdc,_0x23a405,_0x4669ab){this[_0xdce1('0x4')]=uuid['v4']();this['squeue']=_0x230eed;this[_0xdce1('0x5')]=_0x1f2fdc;this[_0xdce1('0x6')]=_0x23a405;this[_0xdce1('0x3')]=_0x4669ab;this[_0xdce1('0x7')][_0xdce1('0x8')](this[_0xdce1('0x9')][_0xdce1('0xa')](this),this[_0xdce1('0xb')][_0xdce1('0xa')](this));this[_0xdce1('0x7')]['on']('timeout',this[_0xdce1('0xb')][_0xdce1('0xa')](this));this['squeue']['on'](_0xdce1('0xc'),this[_0xdce1('0xd')][_0xdce1('0xa')](this));};Agent[_0xdce1('0xe')][_0xdce1('0x8')]=function(){this['squeue'][_0xdce1('0x8')](this[_0xdce1('0x9')][_0xdce1('0xa')](this),this[_0xdce1('0xb')][_0xdce1('0xa')](this));};Agent[_0xdce1('0xe')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0xdce1('0xe')][_0xdce1('0x9')]=function(_0x1e2041){logger[_0xdce1('0xf')](_0xdce1('0x10'),this[_0xdce1('0x7')]['id'],this[_0xdce1('0x5')]['id']);if(_[_0xdce1('0x11')](this[_0xdce1('0x6')]['agents'][this[_0xdce1('0x5')]['id']])){logger['info'](_0xdce1('0x12'),this[_0xdce1('0x7')]['id'],this['agent']['id']);setTimeout(this['push'][_0xdce1('0xa')](this),0x3e8);}else{if(this[_0xdce1('0x3')][_0xdce1('0x13')]||util[_0xdce1('0x14')](this[_0xdce1('0x7')]['id'],this['realtime']['agents'][this[_0xdce1('0x5')]['id']],this['squeue'][_0xdce1('0x15')],![])){this[_0xdce1('0x6')][_0xdce1('0x16')][this['agent']['id']][_0xdce1('0x17')]=!![];this['realtime'][_0xdce1('0x16')][this[_0xdce1('0x5')]['id']][_0xdce1('0x18')]=undefined;util[_0xdce1('0x19')](this[_0xdce1('0x4')],this[_0xdce1('0x7')]['id'],this['realtime'][_0xdce1('0x16')][this[_0xdce1('0x5')]['id']],null,this[_0xdce1('0x3')]);util['writeLog'](this['squeue']['id'],this[_0xdce1('0x6')][_0xdce1('0x16')][this['agent']['id']],_0xdce1('0x1a')+(this[_0xdce1('0x3')][_0xdce1('0x13')]?':FORCED':''));}else{logger[_0xdce1('0xf')](_0xdce1('0x1b'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0xdce1('0x8')][_0xdce1('0xa')](this),0x3e8);}}};Agent[_0xdce1('0xe')][_0xdce1('0xb')]=function(_0x194e94){if(_[_0xdce1('0x11')](this['realtime'][_0xdce1('0x16')][this[_0xdce1('0x5')]['id']])){return logger[_0xdce1('0xf')](_0xdce1('0x12'),this[_0xdce1('0x7')]['id'],this[_0xdce1('0x5')]['id']);}else{logger[_0xdce1('0xf')](_0xdce1('0x1c'),this[_0xdce1('0x7')]['id'],this[_0xdce1('0x5')]['id']);util[_0xdce1('0x1d')](this['notificationId'],this[_0xdce1('0x7')]['id'],this[_0xdce1('0x6')]['agents'][this[_0xdce1('0x5')]['id']],null,this[_0xdce1('0x3')]);this[_0xdce1('0x6')][_0xdce1('0x16')][this[_0xdce1('0x5')]['id']][_0xdce1('0x17')]=![];this[_0xdce1('0x6')][_0xdce1('0x16')][this[_0xdce1('0x5')]['id']][_0xdce1('0x18')]=undefined;util[_0xdce1('0x1e')](this[_0xdce1('0x7')]['id'],this[_0xdce1('0x6')][_0xdce1('0x16')][this['agent']['id']],_0x194e94?_0xdce1('0x1f'):_0xdce1('0x20'));}if(!_0x194e94){setTimeout(this[_0xdce1('0x8')][_0xdce1('0xa')](this),0x3e8);}};function agent(_0x35c949,_0x5be575,_0x2a4c67,_0x4308f9){return new Agent(_0x35c949,_0x5be575,_0x2a4c67,_0x4308f9);}module[_0xdce1('0x21')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 52e1fa7..91e022d 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 _0xe953=['squeue','realtime','routing','push','handleRun','handleTimeout','bind','drained','prototype','handleDrained','isNil','queue','Agents','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','RINGING','busy','busyQueue','name','showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','length','hideNotification','writeLog','TIMEOUT','exports'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xe953,0x1d0));var _0x3e95=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xe953[_0x1b6186];return _0x186121;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require('./util');var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x1afca4,_0x31b87e,_0x49d837,_0x46f343){this['notificationId']=uuid['v4']();this[_0x3e95('0x0')]=_0x1afca4;this['queue']=_0x31b87e;this[_0x3e95('0x1')]=_0x49d837;this[_0x3e95('0x2')]=_0x46f343;this[_0x3e95('0x0')][_0x3e95('0x3')](this[_0x3e95('0x4')]['bind'](this),this[_0x3e95('0x5')][_0x3e95('0x6')](this));this[_0x3e95('0x0')]['on']('timeout',this[_0x3e95('0x5')][_0x3e95('0x6')](this));this[_0x3e95('0x0')]['on'](_0x3e95('0x7'),this['handleDrained'][_0x3e95('0x6')](this));};Beepall['prototype'][_0x3e95('0x3')]=function(){this[_0x3e95('0x0')][_0x3e95('0x3')](this[_0x3e95('0x4')][_0x3e95('0x6')](this),this[_0x3e95('0x5')]['bind'](this));};Beepall[_0x3e95('0x8')][_0x3e95('0x9')]=function(_0x58bb85){this[_0x3e95('0x5')](!![]);};Beepall[_0x3e95('0x8')][_0x3e95('0x4')]=function(_0x2b360e){var _0x48055e=!![];if(!_[_0x3e95('0xa')](this[_0x3e95('0xb')])&&!_['isNil'](this[_0x3e95('0xb')][_0x3e95('0xc')])&&this[_0x3e95('0xb')][_0x3e95('0xc')]['length']>0x0){for(var _0x1490ec=0x0,_0x4d44c3;_0x1490ec0x0){for(var _0x21db23=0x0,_0x52913c;_0x21db230x0&&_0x53848c[_0x1e5065+'CurrentCapacity']>=_0x53848c[_0x1e5065+_0x0a6b('0x24')]){writeLog(_0x122c19,_0x53848c,_0x1e5065['toUpperCase']()+_0x0a6b('0x25'));return![];}}return!![];};exports[_0x0a6b('0x26')]=function(_0x45ae97,_0x4884a1,_0x526fdc,_0xf1ed3d,_0xe01bba){return sendNotification(!![],_0x45ae97,_0x4884a1,_0x526fdc,_0xf1ed3d,_0xe01bba);};exports[_0x0a6b('0x27')]=function(_0x3d649e,_0x1935a3,_0x2bbcb1,_0x486f0d,_0xa7ab7c){return sendNotification(![],_0x3d649e,_0x1935a3,_0x2bbcb1,_0x486f0d,_0xa7ab7c);};exports[_0x0a6b('0x28')]=writeLog; \ No newline at end of file +var _0xafc4=['notification:%s','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','lodash','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','localhost','socket.io-emitter','redis','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','emit'];(function(_0x1d134e,_0x2038dd){var _0x828902=function(_0x4d0f26){while(--_0x4d0f26){_0x1d134e['push'](_0x1d134e['shift']());}};_0x828902(++_0x2038dd);}(_0xafc4,0x69));var _0x4afc=function(_0x5669c8,_0x31090a){_0x5669c8=_0x5669c8-0x0;var _0x3f1f4a=_0xafc4[_0x5669c8];return _0x3f1f4a;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var utils=require(_0x4afc('0x1'));var Mustache=require('mustache');var Redis=require(_0x4afc('0x2'));var config=require(_0x4afc('0x3'));var logger=require(_0x4afc('0x4'))(_0x4afc('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0x4afc('0x6'),'port':0x18eb});var io=require(_0x4afc('0x7'))(new Redis(config[_0x4afc('0x8')]));function emit(_0x1bb281,_0xc828d9,_0xaf053d){io['to'](_0x1bb281)['emit'](_0xc828d9,_0xaf053d);}function sendNotification(_0x31e165,_0x1c740c,_0x134aad,_0x1e6bf5,_0x1b8981,_0x458fde){io['to'](util['format']('user:%s',_0x1e6bf5[_0x4afc('0x9')]))['emit'](_0x4afc('0xa'),_0x1e6bf5);var _0x225793=_0x458fde||{};var _0x49b56f=_0x134aad[_0x4afc('0xb')]('.');var _0x3fb54a={'uniqueid':_0x1c740c,'channel':_0x49b56f[0x0],'id':_0x49b56f[0x1],'title':_0x49b56f[0x0]+_0x4afc('0xc'),'interactionId':_0x49b56f[0x2],'queue':_0x1b8981?_0x1b8981[_0x4afc('0x9')]:null,'sound':_0x225793[_0x4afc('0xd')][_0x4afc('0xe')],'shake':_0x225793[_0x4afc('0xd')][_0x4afc('0xf')]};try{if(!_0x225793['body']){_0x225793[_0x4afc('0x10')]={};}if(_0x1b8981){_0x225793[_0x4afc('0x10')][_0x4afc('0x11')]=_0x1b8981;}else if(_0x225793[_0x4afc('0x10')]['queue']){delete _0x225793['body'][_0x4afc('0x11')];}_0x3fb54a['msg']=utils[_0x4afc('0x12')](_0x225793[_0x4afc('0xd')][_0x4afc('0x13')],_0x225793);}catch(_0x31eec4){_0x3fb54a[_0x4afc('0x14')]=_0x4afc('0x15');logger[_0x4afc('0x16')](util[_0x4afc('0x17')](_0x4afc('0x18'),_0x1c740c,_0x31eec4[_0x4afc('0x19')]));}io['to'](util[_0x4afc('0x17')]('user:%s',_0x1e6bf5[_0x4afc('0x9')]))[_0x4afc('0x1a')](util[_0x4afc('0x17')](_0x4afc('0x1b'),_0x31e165?'save':_0x4afc('0x1c')),_0x3fb54a);}function writeLog(_0x30eda3,_0x2de6e9,_0x280587){return logger[_0x4afc('0x1d')](util[_0x4afc('0x17')](_0x4afc('0x1e'),_0x30eda3,_0x2de6e9['name'],_0x280587));}exports[_0x4afc('0x1f')]=function(_0x3ecf2d,_0x57f37c,_0x37debf,_0x4e9a48){if(_0x57f37c[_0x4afc('0x20')]){writeLog(_0x3ecf2d,_0x57f37c,_0x4afc('0x21'));return![];}if(!_0x57f37c[_0x4afc('0x22')]){writeLog(_0x3ecf2d,_0x57f37c,_0x4afc('0x23'));return![];}if(_0x57f37c[_0x37debf+_0x4afc('0x24')]){writeLog(_0x3ecf2d,_0x57f37c,_0x4afc('0x25'));return![];}if(_0x4e9a48&&_0x57f37c[_0x4afc('0x26')](_0x37debf+_0x4afc('0x27'))&&_0x57f37c[_0x4afc('0x26')](_0x37debf+_0x4afc('0x28'))){if(_0x57f37c[_0x37debf+_0x4afc('0x27')]>0x0&&_0x57f37c[_0x37debf+_0x4afc('0x28')]>=_0x57f37c[_0x37debf+_0x4afc('0x27')]){writeLog(_0x3ecf2d,_0x57f37c,_0x37debf['toUpperCase']()+_0x4afc('0x29'));return![];}}return!![];};exports[_0x4afc('0x2a')]=function(_0x2d6112,_0x4e254d,_0x52212d,_0x54433f,_0x426e9d){return sendNotification(!![],_0x2d6112,_0x4e254d,_0x52212d,_0x54433f,_0x426e9d);};exports[_0x4afc('0x2b')]=function(_0x5e4747,_0xd26d2f,_0x628e42,_0x494fe7,_0x514278){return sendNotification(![],_0x5e4747,_0xd26d2f,_0x628e42,_0x494fe7,_0x514278);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index ca2a61a..319f6b1 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 _0xf925=['string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','info','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','next','isObject','stringify','validate','shelljs'];(function(_0xc54d7d,_0x1ab11b){var _0x3fee94=function(_0x4c7a16){while(--_0x4c7a16){_0xc54d7d['push'](_0xc54d7d['shift']());}};_0x3fee94(++_0x1ab11b);}(_0xf925,0x1a7));var _0x5f92=function(_0x3cfaa3,_0x34f6c9){_0x3cfaa3=_0x3cfaa3-0x0;var _0x55a02c=_0xf925[_0x3cfaa3];return _0x55a02c;};'use strict';var schema=require(_0x5f92('0x0'));var sh=require(_0x5f92('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':_0x5f92('0x2'),'required':!![],'message':_0x5f92('0x3')}});exports[_0x5f92('0x4')]=function(_0x57f4c4,_0xe0c587){return function(_0x267177){try{var _0x3a2a93={'command':_0xe0c587[0x0]};var _0x484788=system[_0x5f92('0x0')](_0x3a2a93,{'typecast':!![]});if(_0x484788[_0x5f92('0x5')]){logger[_0x5f92('0x6')](_0x5f92('0x7'),_0x57f4c4,_[_0x5f92('0x8')](_0x484788,_0x5f92('0x9'))['join'](',\x20'));logger['info'](_0x5f92('0xa'),_0x57f4c4);_0x267177['next']();}else{var _0x21b51a=this;var _0xb517e4=utils[_0x5f92('0xb')](_0xe0c587[0x0],this);logger['info'](_0x5f92('0xc'),_0x57f4c4,_0xb517e4);sh[_0x5f92('0xd')](_['trim'](_0xb517e4),function(_0xba925d,_0x5a8f58){logger[_0x5f92('0xe')](_0x5f92('0xf'),_0x57f4c4,_0xba925d);if(_0xba925d==0x0){var _0x3a472d=_0x5a8f58[_0x5f92('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x5f92('0x11')](_0xe0c587[0x1])||_[_0x5f92('0x12')](_0xe0c587[0x1])){logger[_0x5f92('0xe')](_0x5f92('0x13'),_0x57f4c4);_0x21b51a['body'][_0xe0c587[0x1]]=_0x3a472d;}else{logger[_0x5f92('0xe')](_0x5f92('0x14'),_0x57f4c4,_0xe0c587[0x1],_0x3a472d);_0x21b51a[_0x5f92('0x15')][_0xe0c587[0x1]]=_0x3a472d;}}_0x267177[_0x5f92('0x16')]();});}}catch(_0x5d78ee){logger[_0x5f92('0x6')](_0x5f92('0x7'),_0x57f4c4,_[_0x5f92('0x17')](_0x5d78ee)?JSON[_0x5f92('0x18')](_0x5d78ee):_0x5d78ee);logger['info'](_0x5f92('0xa'),_0x57f4c4);_0x267177[_0x5f92('0x16')]();}};}; \ No newline at end of file +var _0x8e59=['stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','isObject'];(function(_0x5affc3,_0x236210){var _0x28fdcd=function(_0xb760f){while(--_0xb760f){_0x5affc3['push'](_0x5affc3['shift']());}};_0x28fdcd(++_0x236210);}(_0x8e59,0x1e2));var _0x98e5=function(_0x3f6d29,_0xc6a020){_0x3f6d29=_0x3f6d29-0x0;var _0x50621e=_0x8e59[_0x3f6d29];return _0x50621e;};'use strict';var schema=require(_0x98e5('0x0'));var sh=require(_0x98e5('0x1'));var _=require(_0x98e5('0x2'));var utils=require(_0x98e5('0x3'));var logger=require(_0x98e5('0x4'))(_0x98e5('0x5'));var system=schema({'command':{'type':_0x98e5('0x6'),'required':!![],'message':_0x98e5('0x7')}});exports['consequence']=function(_0x2baa8e,_0x16621f){return function(_0x15342f){try{var _0x3f8539={'command':_0x16621f[0x0]};var _0x328651=system[_0x98e5('0x0')](_0x3f8539,{'typecast':!![]});if(_0x328651['length']){logger['error'](_0x98e5('0x8'),_0x2baa8e,_[_0x98e5('0x9')](_0x328651,_0x98e5('0xa'))[_0x98e5('0xb')](',\x20'));logger[_0x98e5('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2baa8e);_0x15342f[_0x98e5('0xd')]();}else{var _0x420308=this;var _0x9bbf97=utils[_0x98e5('0xe')](_0x16621f[0x0],this);logger[_0x98e5('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x2baa8e,_0x9bbf97);sh['exec'](_[_0x98e5('0xf')](_0x9bbf97),function(_0x396fee,_0x31af98){logger[_0x98e5('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x2baa8e,_0x396fee);if(_0x396fee==0x0){var _0x490ef1=_0x31af98[_0x98e5('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x98e5('0x11')](_0x16621f[0x1])||_[_0x98e5('0x12')](_0x16621f[0x1])){logger['info'](_0x98e5('0x13'),_0x2baa8e);_0x420308[_0x98e5('0x14')][_0x16621f[0x1]]=_0x490ef1;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x2baa8e,_0x16621f[0x1],_0x490ef1);_0x420308['body'][_0x16621f[0x1]]=_0x490ef1;}}_0x15342f[_0x98e5('0xd')]();});}}catch(_0x448520){logger['error']('[%s][SYSTEM]\x20%s',_0x2baa8e,_[_0x98e5('0x15')](_0x448520)?JSON[_0x98e5('0x16')](_0x448520):_0x448520);logger[_0x98e5('0xc')](_0x98e5('0x17'),_0x2baa8e);_0x15342f[_0x98e5('0xd')]();}};}; \ 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 a857f83..b11f97c 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 _0x9b78=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','info','catch','isObject','stringify','validate','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9b78,0x1c9));var _0x89b7=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x9b78[_0x146a97];return _0x259d5c;};'use strict';var schema=require(_0x89b7('0x0'));var _=require(_0x89b7('0x1'));var rpc={'chatInteraction':require(_0x89b7('0x2')),'openchannelInteraction':require(_0x89b7('0x3')),'smsInteraction':require(_0x89b7('0x4')),'mailInteraction':require(_0x89b7('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x89b7('0x6'))};var logger=require(_0x89b7('0x7'))(_0x89b7('0x8'));var tag=schema({'tag':{'type':_0x89b7('0x9'),'required':!![],'message':_0x89b7('0xa')}});exports[_0x89b7('0xb')]=function(_0x498b82,_0x1669ff,_0x3dc33c,_0x3f624b){return function(_0x58dfad){try{var _0x23e9d8={'tag':_0x1669ff[0x0]};var _0x416493=tag[_0x89b7('0x0')](_0x23e9d8,{'typecast':!![]});if(_0x416493[_0x89b7('0xc')]){logger[_0x89b7('0xd')](_0x89b7('0xe'),_0x498b82,_[_0x89b7('0xf')](_0x416493,_0x89b7('0x10'))[_0x89b7('0x11')](',\x20'));logger['info'](_0x89b7('0x12'),_0x498b82);_0x58dfad[_0x89b7('0x13')]();}else{var _0x2e8227={'ids':[_0x1669ff[0x0]]};if(rpc[_0x3f624b[_0x89b7('0x14')]+_0x89b7('0x15')]){rpc[_0x3f624b[_0x89b7('0x14')]+_0x89b7('0x15')]['addTags'](_0x3f624b[_0x89b7('0x16')]['id'],_0x2e8227)['then'](function(_0x2a29bb){logger[_0x89b7('0x17')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x498b82,_0x1669ff[0x1],_0x3f624b['channel'],_0x3f624b[_0x89b7('0x16')]['id']);})[_0x89b7('0x18')](function(_0x35be87){logger[_0x89b7('0xd')](_0x89b7('0xe'),_0x498b82,JSON['stringify'](_0x35be87));logger[_0x89b7('0x17')](_0x89b7('0x12'),_0x498b82);})['finally'](function(){_0x58dfad['next']();});}}}catch(_0x393cb0){logger['error'](_0x89b7('0xe'),_0x498b82,_[_0x89b7('0x19')](_0x393cb0)?JSON[_0x89b7('0x1a')](_0x393cb0):_0x393cb0);logger[_0x89b7('0x17')](_0x89b7('0x12'),_0x498b82);_0x58dfad[_0x89b7('0x13')]();}};}; \ No newline at end of file +var _0x59f2=['catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','consequence','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x59f2,0x160));var _0x259f=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x59f2[_0x173441];return _0x2423a8;};'use strict';var schema=require(_0x259f('0x0'));var _=require(_0x259f('0x1'));var rpc={'chatInteraction':require(_0x259f('0x2')),'openchannelInteraction':require(_0x259f('0x3')),'smsInteraction':require(_0x259f('0x4')),'mailInteraction':require(_0x259f('0x5')),'faxInteraction':require(_0x259f('0x6')),'whatsappInteraction':require(_0x259f('0x7'))};var logger=require(_0x259f('0x8'))('routing');var tag=schema({'tag':{'type':_0x259f('0x9'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x259f('0xa')]=function(_0x32afb7,_0x34b571,_0x16835c,_0x4a8502){return function(_0xa921cb){try{var _0x3c4ac7={'tag':_0x34b571[0x0]};var _0x4a2db0=tag['validate'](_0x3c4ac7,{'typecast':!![]});if(_0x4a2db0['length']){logger[_0x259f('0xb')](_0x259f('0xc'),_0x32afb7,_[_0x259f('0xd')](_0x4a2db0,_0x259f('0xe'))[_0x259f('0xf')](',\x20'));logger[_0x259f('0x10')](_0x259f('0x11'),_0x32afb7);_0xa921cb[_0x259f('0x12')]();}else{var _0x12ccd1={'ids':[_0x34b571[0x0]]};if(rpc[_0x4a8502[_0x259f('0x13')]+'Interaction']){rpc[_0x4a8502[_0x259f('0x13')]+_0x259f('0x14')][_0x259f('0x15')](_0x4a8502[_0x259f('0x16')]['id'],_0x12ccd1)[_0x259f('0x17')](function(_0x4c52a1){logger[_0x259f('0x10')](_0x259f('0x18'),_0x32afb7,_0x34b571[0x1],_0x4a8502[_0x259f('0x13')],_0x4a8502[_0x259f('0x16')]['id']);})[_0x259f('0x19')](function(_0x5e152b){logger[_0x259f('0xb')](_0x259f('0xc'),_0x32afb7,JSON[_0x259f('0x1a')](_0x5e152b));logger[_0x259f('0x10')](_0x259f('0x11'),_0x32afb7);})[_0x259f('0x1b')](function(){_0xa921cb[_0x259f('0x12')]();});}}}catch(_0x401559){logger[_0x259f('0xb')](_0x259f('0xc'),_0x32afb7,_[_0x259f('0x1c')](_0x401559)?JSON[_0x259f('0x1a')](_0x401559):_0x401559);logger[_0x259f('0x10')](_0x259f('0x11'),_0x32afb7);_0xa921cb['next']();}};}; \ 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 550a18f..f735cce 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x65a5c7,_0x4e512b){var _0x137d78=function(_0x361881){while(--_0x361881){_0x65a5c7['push'](_0x65a5c7['shift']());}};_0x137d78(++_0x4e512b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x5e324c,_0x8d24c8){var _0x1c6570=function(_0x544325){while(--_0x544325){_0x5e324c['push'](_0x5e324c['shift']());}};_0x1c6570(++_0x8d24c8);}(_0xe706,0xa3));var _0x6e70=function(_0x368cd6,_0x275b63){_0x368cd6=_0x368cd6-0x0;var _0x16161d=_0xe706[_0x368cd6];return _0x16161d;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 6141e61..978c509 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 _0xba34=['Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','applications','length','existsSync','app','.js','toLowerCase','appdata','push','slice','join','dialogflow','dialogflowv2','amazonlex','split','tag','TagId','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','on\x20interval','error','execute','Applications\x20executed','stringify','matchPath','emit','complete','stack','routing\x20is\x20empty','agent','agents','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','busyQueue','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','loggedIn','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','127.0.0.1'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xba34,0x119));var _0x4ba3=function(_0x1baad1,_0x57446d){_0x1baad1=_0x1baad1-0x0;var _0x5c5ef7=_0xba34[_0x1baad1];return _0x5c5ef7;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var fs=require('fs');var jayson=require(_0x4ba3('0x3'));var BPromise=require(_0x4ba3('0x4'));var uuid=require('uuid');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x4ba3('0x5'));var rpc={'openchannelQueueReport':require(_0x4ba3('0x6')),'mailQueueReport':require(_0x4ba3('0x7')),'chatQueueReport':require(_0x4ba3('0x8')),'smsQueueReport':require(_0x4ba3('0x9')),'faxQueueReport':require(_0x4ba3('0xa')),'whatsappQueueReport':require(_0x4ba3('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x6254fb,_0x368eee,_0x2df7f3){return util[_0x4ba3('0xc')](_0x4ba3('0xd'),_0x6254fb,_0x368eee||0x0,_0x2df7f3||0x0);}function getIntervals(_0xcf1ec3,_0x292f58){var _0x3f653c=[];if(!_[_0x4ba3('0xe')](_0x292f58[_0x4ba3('0xf')])&&!_[_0x4ba3('0xe')](_0xcf1ec3[_0x292f58['IntervalId']])&&!_[_0x4ba3('0xe')](_0xcf1ec3[_0x292f58[_0x4ba3('0xf')]]['Intervals'])){_0x3f653c=_[_0x4ba3('0x10')](_0xcf1ec3[_0x292f58['IntervalId']][_0x4ba3('0x11')],'interval');}else if(!_[_0x4ba3('0xe')](_0x292f58[_0x4ba3('0x12')])){_0x3f653c=[_0x292f58[_0x4ba3('0x12')]];}return _0x3f653c;}exports[_0x4ba3('0x13')]=function(_0x2bc796){_0x2bc796[_0x4ba3('0x14')]={};return new BPromise(function(_0x3a74f7,_0x12ac90){var _0x1dec48={'Start':function(_0x401366){var _0x36638b=this;return new Promise(function(_0x301359,_0x29a9d1){if(_0x401366){try{var _0x25f584=[];var _0x40e75b=getId(_0x401366[_0x4ba3('0x15')],_0x401366['message']?_0x401366[_0x4ba3('0x16')]['id']:0x0,_0x401366[_0x4ba3('0x17')]?_0x401366[_0x4ba3('0x17')]['id']:0x0);if(_0x401366[_0x4ba3('0x18')]&&_['isArray'](_0x401366[_0x4ba3('0x18')])&&_0x401366[_0x4ba3('0x18')][_0x4ba3('0x19')]){for(var _0x1e2ce5=0x0;_0x1e2ce5<_0x401366[_0x4ba3('0x18')][_0x4ba3('0x19')];_0x1e2ce5+=0x1){var _0x4b2791=_0x401366['applications'][_0x1e2ce5];if(fs[_0x4ba3('0x1a')](path['join'](__dirname,_0x4ba3('0x18'),_0x4b2791[_0x4ba3('0x1b')]+_0x4ba3('0x1c')))){var _0xbc7023=[];switch(_0x4b2791[_0x4ba3('0x1b')][_0x4ba3('0x1d')]()){case'autoreply':var _0x143c78=_0x4b2791[_0x4ba3('0x1e')]['split'](',');if(_0x401366[_0x4ba3('0x15')]==='mail'){_0xbc7023[_0x4ba3('0x1f')](_0x143c78[0x0]);_0xbc7023[_0x4ba3('0x1f')](_0x143c78[0x1]);_0xbc7023[_0x4ba3('0x1f')](_0x143c78[_0x4ba3('0x20')](0x2,_0x143c78[_0x4ba3('0x19')])[_0x4ba3('0x21')](','));}else{_0xbc7023[_0x4ba3('0x1f')](_0x143c78[0x0]);_0xbc7023[_0x4ba3('0x1f')](_0x143c78[_0x4ba3('0x20')](0x1,_0x143c78[_0x4ba3('0x19')])['join'](','));}break;case _0x4ba3('0x22'):var _0x13c353=_0x4b2791[_0x4ba3('0x1e')]['split'](',');_0xbc7023[_0x4ba3('0x1f')](_0x13c353[0x0]);_0xbc7023[_0x4ba3('0x1f')](_0x13c353[0x1]);_0xbc7023[_0x4ba3('0x1f')](_0x13c353['slice'](0x2,_0x13c353[_0x4ba3('0x19')])[_0x4ba3('0x21')](','));break;case _0x4ba3('0x23'):var _0x22394d=_0x4b2791['appdata']['split'](',');_0xbc7023[_0x4ba3('0x1f')](_0x22394d[0x0]);_0xbc7023[_0x4ba3('0x1f')](_0x22394d[0x1]);_0xbc7023[_0x4ba3('0x1f')](_0x22394d[0x2]);_0xbc7023[_0x4ba3('0x1f')](_0x22394d[0x3]);_0xbc7023[_0x4ba3('0x1f')](_0x22394d[0x4]);_0xbc7023[_0x4ba3('0x1f')](_0x22394d['slice'](0x5,_0x22394d[_0x4ba3('0x19')])[_0x4ba3('0x21')](','));break;case _0x4ba3('0x24'):var _0xbf95b3=_0x4b2791[_0x4ba3('0x1e')][_0x4ba3('0x25')](',');_0xbc7023[_0x4ba3('0x1f')](_0xbf95b3[0x0]);_0xbc7023[_0x4ba3('0x1f')](_0xbf95b3[0x1]);_0xbc7023[_0x4ba3('0x1f')](_0xbf95b3[0x2]);_0xbc7023[_0x4ba3('0x1f')](_0xbf95b3[0x3]);_0xbc7023['push'](_0xbf95b3['slice'](0x4,_0xbf95b3['length'])[_0x4ba3('0x21')](','));break;case _0x4ba3('0x16'):_0xbc7023[_0x4ba3('0x1f')](_0x4b2791[_0x4ba3('0x1e')]);break;case _0x4ba3('0x26'):_0xbc7023[_0x4ba3('0x1f')](_0x4b2791[_0x4ba3('0x27')]);_0xbc7023[_0x4ba3('0x1f')](_0x4b2791[_0x4ba3('0x1e')]);break;default:_0xbc7023=_[_0x4ba3('0xe')](_0x4b2791[_0x4ba3('0x1e')])?[]:_0x4b2791[_0x4ba3('0x1e')]['split'](',');}var _0x3801d0={'id':util[_0x4ba3('0xc')](_0x4ba3('0x28'),_0x40e75b,_0x4b2791['id'],_0x4b2791['app']),'condition':require(_0x4ba3('0x29'))['condition'](_0x40e75b,getIntervals(_0x2bc796[_0x4ba3('0x2a')],_0x4b2791),_0x2bc796),'consequence':require(_0x4ba3('0x2b')+_0x4b2791[_0x4ba3('0x1b')])[_0x4ba3('0x2c')](_0x40e75b,_0xbc7023,_0x2bc796,_0x401366),'p':_0x4b2791[_0x4ba3('0x2d')]||0x0};logger[_0x4ba3('0x2e')]('Push\x20new\x20rule',_0x3801d0['id'],_0x4ba3('0x2f'),getIntervals(_0x2bc796[_0x4ba3('0x2a')],_0x4b2791)[_0x4ba3('0x21')]('\x20|\x20'));_0x25f584[_0x4ba3('0x1f')](_0x3801d0);}else{logger[_0x4ba3('0x30')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x4ba3('0x21')](__dirname,'applications',_0x4b2791['app']+_0x4ba3('0x1c')));}}_0x2bc796[_0x4ba3('0x14')][_0x40e75b]=new RuleEngine(_0x25f584);_0x2bc796[_0x4ba3('0x14')][_0x40e75b][_0x4ba3('0x31')](_0x401366,function(_0x20ac88){logger['info'](_0x4ba3('0x32'),JSON[_0x4ba3('0x33')](_0x20ac88[_0x4ba3('0x34')]));if(_0x2bc796[_0x4ba3('0x14')][_0x40e75b]){_0x2bc796[_0x4ba3('0x14')][_0x40e75b][_0x4ba3('0x35')](_0x4ba3('0x36'));}});return _0x301359({'code':0xc8,'message':_0x401366});}else{logger[_0x4ba3('0x2e')]('No\x20applications\x20to\x20execute');return _0x301359({'code':0xc8,'message':_0x401366});}}catch(_0x30718b){logger[_0x4ba3('0x30')](_0x30718b[_0x4ba3('0x37')]);return _0x29a9d1(_0x36638b[_0x4ba3('0x30')](0x1f4,_0x30718b));}}return _0x29a9d1(_0x4ba3('0x38'));});},'AcceptMessage':function(_0x25b2c9){var _0x748631=this;return new Promise(function(_0xdcc2a2,_0x15d305){if(_0x25b2c9[_0x4ba3('0x39')]&&_0x25b2c9[_0x4ba3('0x39')]['id']){if(_0x2bc796[_0x4ba3('0x3a')][_0x25b2c9[_0x4ba3('0x39')]['id']]){_0x2bc796[_0x4ba3('0x3a')][_0x25b2c9['agent']['id']]['busy']=![];_0x2bc796['agents'][_0x25b2c9['agent']['id']]['busyQueue']=undefined;}}if(_0x25b2c9[_0x4ba3('0x16')]&&_0x25b2c9['message']['id']){try{var _0x29e74d=getId(_0x25b2c9['channel'],_0x25b2c9[_0x4ba3('0x16')]?_0x25b2c9[_0x4ba3('0x16')]['id']:0x0,_0x25b2c9[_0x4ba3('0x17')]?_0x25b2c9[_0x4ba3('0x17')]['id']:0x0);if(_0x2bc796[_0x4ba3('0x14')][_0x29e74d]){_0x2bc796['rules'][_0x29e74d][_0x4ba3('0x35')]('end');if(rpc[_0x25b2c9[_0x4ba3('0x15')]+'QueueReport']){rpc[_0x25b2c9[_0x4ba3('0x15')]+_0x4ba3('0x3b')][_0x4ba3('0x3c')](_0x29e74d,{'UserId':_0x25b2c9[_0x4ba3('0x16')][_0x4ba3('0x3d')]})[_0x4ba3('0x3e')](function(_0x1e8e96){logger['error'](_0x4ba3('0x3f'));});}}return _0xdcc2a2({'code':0xc8,'message':_0x25b2c9});}catch(_0x13cc06){logger[_0x4ba3('0x30')](_0x13cc06[_0x4ba3('0x37')]);return _0x15d305(_0x748631[_0x4ba3('0x30')](0x1f4,_0x13cc06));}}logger['error']('message\x20is\x20empty');return _0x15d305(_0x748631[_0x4ba3('0x30')](0x1f4,_0x4ba3('0x40')));});},'RejectMessage':function(_0x18617b){var _0x4b4de9=this;return new Promise(function(_0xd466f6,_0xfd30a0){if(_0x18617b[_0x4ba3('0x39')]&&_0x18617b['agent']['id']){try{if(_0x2bc796['agents'][_0x18617b[_0x4ba3('0x39')]['id']]){_0x2bc796['agents'][_0x18617b[_0x4ba3('0x39')]['id']][_0x4ba3('0x41')]=![];_0x2bc796[_0x4ba3('0x3a')][_0x18617b[_0x4ba3('0x39')]['id']][_0x4ba3('0x42')]=undefined;}return _0xd466f6({'code':0xc8,'message':_0x18617b});}catch(_0x213eb0){logger['error'](_0x213eb0[_0x4ba3('0x37')]);return _0xfd30a0(_0x4b4de9[_0x4ba3('0x30')](0x1f4,_0x213eb0));}}logger['error'](_0x4ba3('0x40'));return _0xfd30a0(_0x4b4de9[_0x4ba3('0x30')](0x1f4,_0x4ba3('0x40')));});},'AbandonInteraction':function(_0x19d6a3){var _0x360472=this;return new Promise(function(_0x4d092d,_0x37a312){if(_0x19d6a3[_0x4ba3('0x15')]&&_0x19d6a3['interaction']&&_0x19d6a3[_0x4ba3('0x17')]['id']){try{var _0x19d70f=getId(_0x19d6a3[_0x4ba3('0x15')],_0x19d6a3[_0x4ba3('0x16')]?_0x19d6a3[_0x4ba3('0x16')]['id']:0x0,_0x19d6a3[_0x4ba3('0x17')]?_0x19d6a3[_0x4ba3('0x17')]['id']:0x0);if(_0x2bc796[_0x4ba3('0x14')][_0x19d70f]){_0x2bc796[_0x4ba3('0x14')][_0x19d70f][_0x4ba3('0x35')](_0x4ba3('0x43'));}return _0x4d092d({'code':0xc8,'message':_0x19d6a3});}catch(_0x29161b){logger[_0x4ba3('0x30')](_0x29161b[_0x4ba3('0x37')]);return _0x37a312(_0x360472[_0x4ba3('0x30')](0x1f4,_0x29161b));}}logger['error']('message\x20is\x20empty');return _0x37a312(_0x360472['error'](0x1f4,_0x4ba3('0x40')));});},'AgentCapacity':function(_0x1b7ad1){var _0xf0fa9e=this;return new Promise(function(_0x2be798,_0x40af1d){if(_0x2bc796['agents'][_0x4ba3('0x44')](_0x1b7ad1['id'])){for(var _0x4620ae in _0x1b7ad1[_0x4ba3('0x45')]){if(_0x1b7ad1[_0x4ba3('0x45')][_0x4ba3('0x44')](_0x4620ae)){if(_0x2bc796[_0x4ba3('0x3a')][_0x1b7ad1['id']][_0x4ba3('0x44')](_0x4620ae+_0x4ba3('0x46'))){_0x2bc796[_0x4ba3('0x3a')][_0x1b7ad1['id']][_0x4620ae+_0x4ba3('0x46')]=parseInt(_0x1b7ad1[_0x4ba3('0x45')][_0x4620ae],0xa);}}}_0x2bc796[_0x4ba3('0x3a')][_0x1b7ad1['id']][_0x4ba3('0x47')]();return _0x2be798({'code':0xc8,'message':_0x2bc796[_0x4ba3('0x3a')][_0x1b7ad1['id']]});}else{return _0x40af1d(_0xf0fa9e['error'](0x1f4,_0x4ba3('0x48')));}});},'Agents':function(_0x42bb4b){return new Promise(function(_0x8eb7b6,_0x451696){var _0x22d5ca=_[_0x4ba3('0x49')](_0x2bc796[_0x4ba3('0x3a')]);_0x8eb7b6({'count':_0x22d5ca[_0x4ba3('0x19')],'rows':_0x22d5ca});});},'ChatQueues':function(_0x581512){return new Promise(function(_0x8ea419,_0x3a9cff){var _0x3c63d0=[];for(var _0x4ebcf9 in _0x2bc796[_0x4ba3('0x4a')]){if(_0x2bc796['chatQueues'][_0x4ba3('0x44')](_0x4ebcf9)){var _0x4cc10a=_0x2bc796[_0x4ba3('0x4a')][_0x4ebcf9];var _0x369a9f={'id':_0x4cc10a['id'],'available':_0x4cc10a[_0x4ba3('0x4b')],'loggedIn':_0x4cc10a['loggedIn'],'name':_0x4cc10a[_0x4ba3('0x4c')],'paused':_0x4cc10a[_0x4ba3('0x4d')],'waiting':_0x4cc10a[_0x4ba3('0x4e')]};_0x3c63d0[_0x4ba3('0x1f')](_0x369a9f);}}_0x8ea419({'count':_0x3c63d0[_0x4ba3('0x19')],'rows':_0x3c63d0});});},'MailQueues':function(_0x5ead3b){return new Promise(function(_0x2bef15,_0x252195){var _0x34cc21=[];for(var _0x469ef0 in _0x2bc796[_0x4ba3('0x4f')]){if(_0x2bc796[_0x4ba3('0x4f')][_0x4ba3('0x44')](_0x469ef0)){var _0x38699e=_0x2bc796[_0x4ba3('0x4f')][_0x469ef0];var _0x6b3329={'id':_0x38699e['id'],'available':_0x38699e[_0x4ba3('0x4b')],'loggedIn':_0x38699e['loggedIn'],'name':_0x38699e[_0x4ba3('0x4c')],'paused':_0x38699e[_0x4ba3('0x4d')],'waiting':_0x38699e['waiting']};_0x34cc21['push'](_0x6b3329);}}_0x2bef15({'count':_0x34cc21[_0x4ba3('0x19')],'rows':_0x34cc21});});},'OpenchannelQueues':function(_0x296bf6){return new Promise(function(_0x5c7c2f,_0x220c83){var _0x30bb71=[];for(var _0x1fb2aa in _0x2bc796['openchannelQueues']){if(_0x2bc796[_0x4ba3('0x50')][_0x4ba3('0x44')](_0x1fb2aa)){var _0x1af489=_0x2bc796[_0x4ba3('0x50')][_0x1fb2aa];var _0x24a75a={'id':_0x1af489['id'],'available':_0x1af489[_0x4ba3('0x4b')],'loggedIn':_0x1af489['loggedIn'],'name':_0x1af489[_0x4ba3('0x4c')],'paused':_0x1af489[_0x4ba3('0x4d')],'waiting':_0x1af489[_0x4ba3('0x4e')]};_0x30bb71['push'](_0x24a75a);}}_0x5c7c2f({'count':_0x30bb71[_0x4ba3('0x19')],'rows':_0x30bb71});});},'SmsQueues':function(_0x2f8bcc){return new Promise(function(_0x385cee,_0x24f035){var _0x21c8b1=[];for(var _0x2d75a3 in _0x2bc796[_0x4ba3('0x51')]){if(_0x2bc796[_0x4ba3('0x51')]['hasOwnProperty'](_0x2d75a3)){var _0x540f5c=_0x2bc796[_0x4ba3('0x51')][_0x2d75a3];var _0x5d8e46={'id':_0x540f5c['id'],'available':_0x540f5c[_0x4ba3('0x4b')],'loggedIn':_0x540f5c[_0x4ba3('0x52')],'name':_0x540f5c[_0x4ba3('0x4c')],'paused':_0x540f5c['paused'],'waiting':_0x540f5c[_0x4ba3('0x4e')]};_0x21c8b1[_0x4ba3('0x1f')](_0x5d8e46);}}_0x385cee({'count':_0x21c8b1[_0x4ba3('0x19')],'rows':_0x21c8b1});});},'FaxQueues':function(_0x5baf26){return new Promise(function(_0x36dca0,_0x55b660){var _0xd6ad8e=[];for(var _0x247352 in _0x2bc796['faxQueues']){if(_0x2bc796[_0x4ba3('0x53')][_0x4ba3('0x44')](_0x247352)){var _0x3e566d=_0x2bc796[_0x4ba3('0x53')][_0x247352];var _0x2feb68={'id':_0x3e566d['id'],'available':_0x3e566d[_0x4ba3('0x4b')],'loggedIn':_0x3e566d[_0x4ba3('0x52')],'name':_0x3e566d[_0x4ba3('0x4c')],'paused':_0x3e566d[_0x4ba3('0x4d')],'waiting':_0x3e566d['waiting']};_0xd6ad8e[_0x4ba3('0x1f')](_0x2feb68);}}_0x36dca0({'count':_0xd6ad8e[_0x4ba3('0x19')],'rows':_0xd6ad8e});});},'WhatsappQueues':function(_0x3853e1){return new Promise(function(_0x4378cc,_0x39d78f){var _0x2cbc54=[];for(var _0x4479cf in _0x2bc796[_0x4ba3('0x54')]){if(_0x2bc796[_0x4ba3('0x54')][_0x4ba3('0x44')](_0x4479cf)){var _0x468219=_0x2bc796[_0x4ba3('0x54')][_0x4479cf];var _0x4e46af={'id':_0x468219['id'],'available':_0x468219[_0x4ba3('0x4b')],'loggedIn':_0x468219[_0x4ba3('0x52')],'name':_0x468219['name'],'paused':_0x468219[_0x4ba3('0x4d')],'waiting':_0x468219[_0x4ba3('0x4e')]};_0x2cbc54['push'](_0x4e46af);}}_0x4378cc({'count':_0x2cbc54['length'],'rows':_0x2cbc54});});},'ChatQueuesWaitingInteractions':function(_0x4ce27){return new Promise(function(_0x14a6d9,_0x1c5b2d){var _0x1be0ed=_[_0x4ba3('0x49')](_0x2bc796[_0x4ba3('0x55')]);_0x14a6d9({'count':_0x1be0ed[_0x4ba3('0x19')],'rows':_0x1be0ed});});},'MailQueuesWaitingInteractions':function(_0x1246bc){return new Promise(function(_0x516c41,_0x272480){var _0x5bab62=_[_0x4ba3('0x49')](_0x2bc796[_0x4ba3('0x56')]);_0x516c41({'count':_0x5bab62[_0x4ba3('0x19')],'rows':_0x5bab62});});},'OpenchannelQueuesWaitingInteractions':function(_0x3c3638){return new Promise(function(_0x451e16,_0x254f91){var _0x157b32=_[_0x4ba3('0x49')](_0x2bc796['openchannelQueuesWaitingInteractions']);_0x451e16({'count':_0x157b32[_0x4ba3('0x19')],'rows':_0x157b32});});},'SmsQueuesWaitingInteractions':function(_0x344748){return new Promise(function(_0x374e29,_0x5a1872){var _0x9bd44d=_[_0x4ba3('0x49')](_0x2bc796[_0x4ba3('0x57')]);_0x374e29({'count':_0x9bd44d[_0x4ba3('0x19')],'rows':_0x9bd44d});});},'FaxQueuesWaitingInteractions':function(_0x15a015){return new Promise(function(_0x2569bc,_0x3ea460){var _0x5c70b9=_['values'](_0x2bc796[_0x4ba3('0x58')]);_0x2569bc({'count':_0x5c70b9['length'],'rows':_0x5c70b9});});},'WhatsappQueuesWaitingInteractions':function(_0x43bf64){return new Promise(function(_0x15508f,_0x108679){var _0x20f7db=_['values'](_0x2bc796['whatsappQueuesWaitingInteractions']);_0x15508f({'count':_0x20f7db[_0x4ba3('0x19')],'rows':_0x20f7db});});}};var _0x2b2132=jayson['server'](_0x1dec48)[_0x4ba3('0x59')]();_0x2b2132['on'](_0x4ba3('0x30'),function(_0x6a2d81){logger[_0x4ba3('0x30')](JSON[_0x4ba3('0x33')](_0x6a2d81));return _0x12ac90(_0x6a2d81);});_0x2b2132[_0x4ba3('0x13')](0x232c,_0x4ba3('0x5a'),function(){console['log'](_0x4ba3('0x5b'),0x232c);return _0x3a74f7(_0x4ba3('0x5c')+0x232c);});});}; \ No newline at end of file +var _0x0e4b=['info','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','emit','capacity','hasOwnProperty','CurrentCapacity','agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','length','existsSync','join','.js','toLowerCase','autoreply','split','push','slice','dialogflow','appdata','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','app','condition','intervals','./applications/','on\x20interval','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify'];(function(_0x45161c,_0x5494fc){var _0x186581=function(_0x78fada){while(--_0x78fada){_0x45161c['push'](_0x45161c['shift']());}};_0x186581(++_0x5494fc);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x5495c1,_0xe42f5a){_0x5495c1=_0x5495c1-0x0;var _0x46e5dc=_0x0e4b[_0x5495c1];return _0x46e5dc;};'use strict';var _=require(_0xb0e4('0x0'));var util=require(_0xb0e4('0x1'));var path=require(_0xb0e4('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xb0e4('0x3'));var uuid=require('uuid');var config=require('../../../config/environment');var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0xb0e4('0x4')),'mailQueueReport':require(_0xb0e4('0x5')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xb0e4('0x6')),'faxQueueReport':require(_0xb0e4('0x7')),'whatsappQueueReport':require(_0xb0e4('0x8'))};var RuleEngine=require(_0xb0e4('0x9'));function getId(_0x35aa64,_0x57f45d,_0x5192f0){return util[_0xb0e4('0xa')](_0xb0e4('0xb'),_0x35aa64,_0x57f45d||0x0,_0x5192f0||0x0);}function getIntervals(_0x1d6452,_0x23555b){var _0x12a36a=[];if(!_[_0xb0e4('0xc')](_0x23555b[_0xb0e4('0xd')])&&!_[_0xb0e4('0xc')](_0x1d6452[_0x23555b[_0xb0e4('0xd')]])&&!_[_0xb0e4('0xc')](_0x1d6452[_0x23555b[_0xb0e4('0xd')]][_0xb0e4('0xe')])){_0x12a36a=_[_0xb0e4('0xf')](_0x1d6452[_0x23555b[_0xb0e4('0xd')]][_0xb0e4('0xe')],'interval');}else if(!_[_0xb0e4('0xc')](_0x23555b[_0xb0e4('0x10')])){_0x12a36a=[_0x23555b['interval']];}return _0x12a36a;}exports[_0xb0e4('0x11')]=function(_0x26f664){_0x26f664[_0xb0e4('0x12')]={};return new BPromise(function(_0x460180,_0x1e1ca5){var _0x57ba9d={'Start':function(_0x4b3f3f){var _0x17419f=this;return new Promise(function(_0x3a140c,_0x5b219a){if(_0x4b3f3f){try{var _0x152ceb=[];var _0x376d1f=getId(_0x4b3f3f[_0xb0e4('0x13')],_0x4b3f3f[_0xb0e4('0x14')]?_0x4b3f3f[_0xb0e4('0x14')]['id']:0x0,_0x4b3f3f[_0xb0e4('0x15')]?_0x4b3f3f['interaction']['id']:0x0);if(_0x4b3f3f['applications']&&_['isArray'](_0x4b3f3f[_0xb0e4('0x16')])&&_0x4b3f3f[_0xb0e4('0x16')][_0xb0e4('0x17')]){for(var _0x690682=0x0;_0x690682<_0x4b3f3f[_0xb0e4('0x16')][_0xb0e4('0x17')];_0x690682+=0x1){var _0x54b7ff=_0x4b3f3f[_0xb0e4('0x16')][_0x690682];if(fs[_0xb0e4('0x18')](path[_0xb0e4('0x19')](__dirname,_0xb0e4('0x16'),_0x54b7ff['app']+_0xb0e4('0x1a')))){var _0x4f2488=[];switch(_0x54b7ff['app'][_0xb0e4('0x1b')]()){case _0xb0e4('0x1c'):var _0xe6a9cf=_0x54b7ff['appdata'][_0xb0e4('0x1d')](',');if(_0x4b3f3f['channel']==='mail'){_0x4f2488[_0xb0e4('0x1e')](_0xe6a9cf[0x0]);_0x4f2488[_0xb0e4('0x1e')](_0xe6a9cf[0x1]);_0x4f2488[_0xb0e4('0x1e')](_0xe6a9cf[_0xb0e4('0x1f')](0x2,_0xe6a9cf[_0xb0e4('0x17')])[_0xb0e4('0x19')](','));}else{_0x4f2488[_0xb0e4('0x1e')](_0xe6a9cf[0x0]);_0x4f2488['push'](_0xe6a9cf[_0xb0e4('0x1f')](0x1,_0xe6a9cf['length'])[_0xb0e4('0x19')](','));}break;case _0xb0e4('0x20'):var _0x37b2fc=_0x54b7ff[_0xb0e4('0x21')]['split'](',');_0x4f2488[_0xb0e4('0x1e')](_0x37b2fc[0x0]);_0x4f2488[_0xb0e4('0x1e')](_0x37b2fc[0x1]);_0x4f2488[_0xb0e4('0x1e')](_0x37b2fc[_0xb0e4('0x1f')](0x2,_0x37b2fc[_0xb0e4('0x17')])[_0xb0e4('0x19')](','));break;case _0xb0e4('0x22'):var _0x31a339=_0x54b7ff['appdata'][_0xb0e4('0x1d')](',');_0x4f2488['push'](_0x31a339[0x0]);_0x4f2488[_0xb0e4('0x1e')](_0x31a339[0x1]);_0x4f2488[_0xb0e4('0x1e')](_0x31a339[0x2]);_0x4f2488['push'](_0x31a339[0x3]);_0x4f2488[_0xb0e4('0x1e')](_0x31a339[0x4]);_0x4f2488[_0xb0e4('0x1e')](_0x31a339[_0xb0e4('0x1f')](0x5,_0x31a339[_0xb0e4('0x17')])[_0xb0e4('0x19')](','));break;case _0xb0e4('0x23'):var _0x5e8667=_0x54b7ff[_0xb0e4('0x21')]['split'](',');_0x4f2488['push'](_0x5e8667[0x0]);_0x4f2488[_0xb0e4('0x1e')](_0x5e8667[0x1]);_0x4f2488['push'](_0x5e8667[0x2]);_0x4f2488[_0xb0e4('0x1e')](_0x5e8667[0x3]);_0x4f2488['push'](_0x5e8667[_0xb0e4('0x1f')](0x4,_0x5e8667['length'])[_0xb0e4('0x19')](','));break;case _0xb0e4('0x14'):_0x4f2488[_0xb0e4('0x1e')](_0x54b7ff['appdata']);break;case _0xb0e4('0x24'):_0x4f2488['push'](_0x54b7ff[_0xb0e4('0x25')]);_0x4f2488[_0xb0e4('0x1e')](_0x54b7ff[_0xb0e4('0x21')]);break;default:_0x4f2488=_[_0xb0e4('0xc')](_0x54b7ff[_0xb0e4('0x21')])?[]:_0x54b7ff['appdata'][_0xb0e4('0x1d')](',');}var _0x5628e5={'id':util[_0xb0e4('0xa')](_0xb0e4('0x26'),_0x376d1f,_0x54b7ff['id'],_0x54b7ff[_0xb0e4('0x27')]),'condition':require('./interval')[_0xb0e4('0x28')](_0x376d1f,getIntervals(_0x26f664[_0xb0e4('0x29')],_0x54b7ff),_0x26f664),'consequence':require(_0xb0e4('0x2a')+_0x54b7ff[_0xb0e4('0x27')])['consequence'](_0x376d1f,_0x4f2488,_0x26f664,_0x4b3f3f),'p':_0x54b7ff['priority']||0x0};logger['info']('Push\x20new\x20rule',_0x5628e5['id'],_0xb0e4('0x2b'),getIntervals(_0x26f664['intervals'],_0x54b7ff)[_0xb0e4('0x19')]('\x20|\x20'));_0x152ceb[_0xb0e4('0x1e')](_0x5628e5);}else{logger['error'](_0xb0e4('0x2c'),path[_0xb0e4('0x19')](__dirname,_0xb0e4('0x16'),_0x54b7ff[_0xb0e4('0x27')]+'.js'));}}_0x26f664[_0xb0e4('0x12')][_0x376d1f]=new RuleEngine(_0x152ceb);_0x26f664[_0xb0e4('0x12')][_0x376d1f]['execute'](_0x4b3f3f,function(_0xa97f7c){logger['info'](_0xb0e4('0x2d'),JSON[_0xb0e4('0x2e')](_0xa97f7c['matchPath']));if(_0x26f664[_0xb0e4('0x12')][_0x376d1f]){_0x26f664['rules'][_0x376d1f]['emit']('complete');}});return _0x3a140c({'code':0xc8,'message':_0x4b3f3f});}else{logger[_0xb0e4('0x2f')](_0xb0e4('0x30'));return _0x3a140c({'code':0xc8,'message':_0x4b3f3f});}}catch(_0x5d2d60){logger[_0xb0e4('0x31')](_0x5d2d60['stack']);return _0x5b219a(_0x17419f[_0xb0e4('0x31')](0x1f4,_0x5d2d60));}}return _0x5b219a(_0xb0e4('0x32'));});},'AcceptMessage':function(_0x2a5c01){var _0x3b8cb7=this;return new Promise(function(_0x4b1975,_0x610856){if(_0x2a5c01[_0xb0e4('0x33')]&&_0x2a5c01[_0xb0e4('0x33')]['id']){if(_0x26f664[_0xb0e4('0x34')][_0x2a5c01[_0xb0e4('0x33')]['id']]){_0x26f664[_0xb0e4('0x34')][_0x2a5c01[_0xb0e4('0x33')]['id']][_0xb0e4('0x35')]=![];_0x26f664[_0xb0e4('0x34')][_0x2a5c01[_0xb0e4('0x33')]['id']][_0xb0e4('0x36')]=undefined;}}if(_0x2a5c01[_0xb0e4('0x14')]&&_0x2a5c01[_0xb0e4('0x14')]['id']){try{var _0x3d39f1=getId(_0x2a5c01[_0xb0e4('0x13')],_0x2a5c01[_0xb0e4('0x14')]?_0x2a5c01['message']['id']:0x0,_0x2a5c01[_0xb0e4('0x15')]?_0x2a5c01[_0xb0e4('0x15')]['id']:0x0);if(_0x26f664[_0xb0e4('0x12')][_0x3d39f1]){_0x26f664[_0xb0e4('0x12')][_0x3d39f1]['emit'](_0xb0e4('0x37'));if(rpc[_0x2a5c01[_0xb0e4('0x13')]+'QueueReport']){rpc[_0x2a5c01[_0xb0e4('0x13')]+_0xb0e4('0x38')][_0xb0e4('0x39')](_0x3d39f1,{'UserId':_0x2a5c01[_0xb0e4('0x14')]['UserId']})[_0xb0e4('0x3a')](function(_0x38d6e2){logger[_0xb0e4('0x31')](_0xb0e4('0x3b'));});}}return _0x4b1975({'code':0xc8,'message':_0x2a5c01});}catch(_0x78b898){logger[_0xb0e4('0x31')](_0x78b898[_0xb0e4('0x3c')]);return _0x610856(_0x3b8cb7[_0xb0e4('0x31')](0x1f4,_0x78b898));}}logger[_0xb0e4('0x31')](_0xb0e4('0x3d'));return _0x610856(_0x3b8cb7[_0xb0e4('0x31')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x24128c){var _0x37fb23=this;return new Promise(function(_0x49346d,_0x59415e){if(_0x24128c['agent']&&_0x24128c[_0xb0e4('0x33')]['id']){try{if(_0x26f664[_0xb0e4('0x34')][_0x24128c['agent']['id']]){_0x26f664['agents'][_0x24128c['agent']['id']]['busy']=![];_0x26f664['agents'][_0x24128c['agent']['id']][_0xb0e4('0x36')]=undefined;}return _0x49346d({'code':0xc8,'message':_0x24128c});}catch(_0x52f7c5){logger[_0xb0e4('0x31')](_0x52f7c5[_0xb0e4('0x3c')]);return _0x59415e(_0x37fb23[_0xb0e4('0x31')](0x1f4,_0x52f7c5));}}logger[_0xb0e4('0x31')]('message\x20is\x20empty');return _0x59415e(_0x37fb23[_0xb0e4('0x31')](0x1f4,_0xb0e4('0x3d')));});},'AbandonInteraction':function(_0x47eff5){var _0xc1246c=this;return new Promise(function(_0x4b5c87,_0x4467df){if(_0x47eff5[_0xb0e4('0x13')]&&_0x47eff5[_0xb0e4('0x15')]&&_0x47eff5[_0xb0e4('0x15')]['id']){try{var _0x4b1d48=getId(_0x47eff5[_0xb0e4('0x13')],_0x47eff5[_0xb0e4('0x14')]?_0x47eff5[_0xb0e4('0x14')]['id']:0x0,_0x47eff5[_0xb0e4('0x15')]?_0x47eff5['interaction']['id']:0x0);if(_0x26f664[_0xb0e4('0x12')][_0x4b1d48]){_0x26f664[_0xb0e4('0x12')][_0x4b1d48][_0xb0e4('0x3e')]('end');}return _0x4b5c87({'code':0xc8,'message':_0x47eff5});}catch(_0x4970a8){logger['error'](_0x4970a8['stack']);return _0x4467df(_0xc1246c['error'](0x1f4,_0x4970a8));}}logger[_0xb0e4('0x31')]('message\x20is\x20empty');return _0x4467df(_0xc1246c[_0xb0e4('0x31')](0x1f4,_0xb0e4('0x3d')));});},'AgentCapacity':function(_0x34a332){var _0x10b23b=this;return new Promise(function(_0x4ecd8b,_0x387319){if(_0x26f664[_0xb0e4('0x34')]['hasOwnProperty'](_0x34a332['id'])){for(var _0x3f9bd4 in _0x34a332['capacity']){if(_0x34a332[_0xb0e4('0x3f')][_0xb0e4('0x40')](_0x3f9bd4)){if(_0x26f664[_0xb0e4('0x34')][_0x34a332['id']]['hasOwnProperty'](_0x3f9bd4+_0xb0e4('0x41'))){_0x26f664[_0xb0e4('0x34')][_0x34a332['id']][_0x3f9bd4+'CurrentCapacity']=parseInt(_0x34a332[_0xb0e4('0x3f')][_0x3f9bd4],0xa);}}}_0x26f664[_0xb0e4('0x34')][_0x34a332['id']]['updateRealtime']();return _0x4ecd8b({'code':0xc8,'message':_0x26f664['agents'][_0x34a332['id']]});}else{return _0x387319(_0x10b23b[_0xb0e4('0x31')](0x1f4,_0xb0e4('0x42')));}});},'Agents':function(_0x2aefeb){return new Promise(function(_0x5a6b6e,_0xf91cd1){var _0xf318df=_['values'](_0x26f664[_0xb0e4('0x34')]);_0x5a6b6e({'count':_0xf318df[_0xb0e4('0x17')],'rows':_0xf318df});});},'ChatQueues':function(_0x571a5e){return new Promise(function(_0x108395,_0x305b44){var _0x2b2767=[];for(var _0x4a7d65 in _0x26f664[_0xb0e4('0x43')]){if(_0x26f664[_0xb0e4('0x43')][_0xb0e4('0x40')](_0x4a7d65)){var _0x40c288=_0x26f664['chatQueues'][_0x4a7d65];var _0x2995e7={'id':_0x40c288['id'],'available':_0x40c288[_0xb0e4('0x44')],'loggedIn':_0x40c288[_0xb0e4('0x45')],'name':_0x40c288[_0xb0e4('0x46')],'paused':_0x40c288[_0xb0e4('0x47')],'waiting':_0x40c288[_0xb0e4('0x48')]};_0x2b2767[_0xb0e4('0x1e')](_0x2995e7);}}_0x108395({'count':_0x2b2767['length'],'rows':_0x2b2767});});},'MailQueues':function(_0x58cae0){return new Promise(function(_0x46d2f1,_0x3bcb8d){var _0x2b8e35=[];for(var _0xfaadc5 in _0x26f664[_0xb0e4('0x49')]){if(_0x26f664[_0xb0e4('0x49')][_0xb0e4('0x40')](_0xfaadc5)){var _0x25f452=_0x26f664[_0xb0e4('0x49')][_0xfaadc5];var _0x2f8e3c={'id':_0x25f452['id'],'available':_0x25f452[_0xb0e4('0x44')],'loggedIn':_0x25f452[_0xb0e4('0x45')],'name':_0x25f452[_0xb0e4('0x46')],'paused':_0x25f452[_0xb0e4('0x47')],'waiting':_0x25f452[_0xb0e4('0x48')]};_0x2b8e35[_0xb0e4('0x1e')](_0x2f8e3c);}}_0x46d2f1({'count':_0x2b8e35['length'],'rows':_0x2b8e35});});},'OpenchannelQueues':function(_0x4b1c07){return new Promise(function(_0x55868c,_0x1203a2){var _0x34ee55=[];for(var _0x3a7d66 in _0x26f664[_0xb0e4('0x4a')]){if(_0x26f664['openchannelQueues']['hasOwnProperty'](_0x3a7d66)){var _0x1e04d1=_0x26f664[_0xb0e4('0x4a')][_0x3a7d66];var _0xa05a06={'id':_0x1e04d1['id'],'available':_0x1e04d1['available'],'loggedIn':_0x1e04d1[_0xb0e4('0x45')],'name':_0x1e04d1[_0xb0e4('0x46')],'paused':_0x1e04d1['paused'],'waiting':_0x1e04d1['waiting']};_0x34ee55[_0xb0e4('0x1e')](_0xa05a06);}}_0x55868c({'count':_0x34ee55['length'],'rows':_0x34ee55});});},'SmsQueues':function(_0x2400e0){return new Promise(function(_0x3ae187,_0x138b22){var _0x44eb57=[];for(var _0x1bd223 in _0x26f664[_0xb0e4('0x4b')]){if(_0x26f664[_0xb0e4('0x4b')][_0xb0e4('0x40')](_0x1bd223)){var _0x1afbb9=_0x26f664[_0xb0e4('0x4b')][_0x1bd223];var _0x129143={'id':_0x1afbb9['id'],'available':_0x1afbb9['available'],'loggedIn':_0x1afbb9[_0xb0e4('0x45')],'name':_0x1afbb9[_0xb0e4('0x46')],'paused':_0x1afbb9[_0xb0e4('0x47')],'waiting':_0x1afbb9[_0xb0e4('0x48')]};_0x44eb57[_0xb0e4('0x1e')](_0x129143);}}_0x3ae187({'count':_0x44eb57[_0xb0e4('0x17')],'rows':_0x44eb57});});},'FaxQueues':function(_0x2b25c5){return new Promise(function(_0x962df6,_0x4aae28){var _0x1e418f=[];for(var _0xffe7f in _0x26f664[_0xb0e4('0x4c')]){if(_0x26f664[_0xb0e4('0x4c')][_0xb0e4('0x40')](_0xffe7f)){var _0x1172e3=_0x26f664[_0xb0e4('0x4c')][_0xffe7f];var _0x474956={'id':_0x1172e3['id'],'available':_0x1172e3[_0xb0e4('0x44')],'loggedIn':_0x1172e3['loggedIn'],'name':_0x1172e3[_0xb0e4('0x46')],'paused':_0x1172e3['paused'],'waiting':_0x1172e3[_0xb0e4('0x48')]};_0x1e418f['push'](_0x474956);}}_0x962df6({'count':_0x1e418f['length'],'rows':_0x1e418f});});},'WhatsappQueues':function(_0x4d658b){return new Promise(function(_0x3d38a5,_0x3b6ea4){var _0x2f39c1=[];for(var _0x282398 in _0x26f664[_0xb0e4('0x4d')]){if(_0x26f664[_0xb0e4('0x4d')][_0xb0e4('0x40')](_0x282398)){var _0x5d7895=_0x26f664[_0xb0e4('0x4d')][_0x282398];var _0x5a0ada={'id':_0x5d7895['id'],'available':_0x5d7895[_0xb0e4('0x44')],'loggedIn':_0x5d7895['loggedIn'],'name':_0x5d7895['name'],'paused':_0x5d7895[_0xb0e4('0x47')],'waiting':_0x5d7895['waiting']};_0x2f39c1['push'](_0x5a0ada);}}_0x3d38a5({'count':_0x2f39c1[_0xb0e4('0x17')],'rows':_0x2f39c1});});},'ChatQueuesWaitingInteractions':function(_0x6fba98){return new Promise(function(_0x27e840,_0x1ca5d5){var _0x567866=_[_0xb0e4('0x4e')](_0x26f664[_0xb0e4('0x4f')]);_0x27e840({'count':_0x567866[_0xb0e4('0x17')],'rows':_0x567866});});},'MailQueuesWaitingInteractions':function(_0x5751ae){return new Promise(function(_0x59c3d0,_0xfbf6a9){var _0x3426c8=_[_0xb0e4('0x4e')](_0x26f664[_0xb0e4('0x50')]);_0x59c3d0({'count':_0x3426c8['length'],'rows':_0x3426c8});});},'OpenchannelQueuesWaitingInteractions':function(_0x2ef0a4){return new Promise(function(_0x56b789,_0x219620){var _0x298df1=_[_0xb0e4('0x4e')](_0x26f664[_0xb0e4('0x51')]);_0x56b789({'count':_0x298df1[_0xb0e4('0x17')],'rows':_0x298df1});});},'SmsQueuesWaitingInteractions':function(_0x447726){return new Promise(function(_0x2e36ec,_0x5dfc86){var _0x326f52=_[_0xb0e4('0x4e')](_0x26f664[_0xb0e4('0x52')]);_0x2e36ec({'count':_0x326f52[_0xb0e4('0x17')],'rows':_0x326f52});});},'FaxQueuesWaitingInteractions':function(_0x130eae){return new Promise(function(_0x318e9c,_0x2f4b49){var _0x367469=_[_0xb0e4('0x4e')](_0x26f664[_0xb0e4('0x53')]);_0x318e9c({'count':_0x367469[_0xb0e4('0x17')],'rows':_0x367469});});},'WhatsappQueuesWaitingInteractions':function(_0xd8c8ec){return new Promise(function(_0x50b29e,_0x9ec769){var _0x377d82=_[_0xb0e4('0x4e')](_0x26f664['whatsappQueuesWaitingInteractions']);_0x50b29e({'count':_0x377d82[_0xb0e4('0x17')],'rows':_0x377d82});});}};var _0x7af7d2=jayson[_0xb0e4('0x54')](_0x57ba9d)[_0xb0e4('0x55')]();_0x7af7d2['on'](_0xb0e4('0x31'),function(_0x431116){logger[_0xb0e4('0x31')](JSON['stringify'](_0x431116));return _0x1e1ca5(_0x431116);});_0x7af7d2['listen'](0x232c,'127.0.0.1',function(){console[_0xb0e4('0x56')](_0xb0e4('0x57'),0x232c);return _0x460180(_0xb0e4('0x58')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 9c6a203..dc3c9d1 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 _0x6cf0=['[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack','bluebird','jayson/promise','lodash','routing','client','http','request','then','error','message','result','catch','condition','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info'];(function(_0x3122e4,_0x245f66){var _0x66e755=function(_0xf02db7){while(--_0xf02db7){_0x3122e4['push'](_0x3122e4['shift']());}};_0x66e755(++_0x245f66);}(_0x6cf0,0x96));var _0x06cf=function(_0x121639,_0x47dc42){_0x121639=_0x121639-0x0;var _0x4f9f47=_0x6cf0[_0x121639];return _0x4f9f47;};'use strict';var util=require('util');var BPromise=require(_0x06cf('0x0'));var jayson=require(_0x06cf('0x1'));var _=require(_0x06cf('0x2'));var logger=require('../../../config/logger')(_0x06cf('0x3'));var client=jayson[_0x06cf('0x4')][_0x06cf('0x5')]({'port':0x232a});function request(_0x4a5a73,_0x9af623){return new BPromise(function(_0x998640,_0x3cded2){return client[_0x06cf('0x6')](_0x4a5a73,_0x9af623)[_0x06cf('0x7')](function(_0x265fa5){if(_0x265fa5[_0x06cf('0x8')]){return _0x3cded2(_0x265fa5[_0x06cf('0x8')][_0x06cf('0x9')]);}else{return _0x998640(_0x265fa5[_0x06cf('0xa')]);}})[_0x06cf('0xb')](function(_0x5b1bc2){return _0x3cded2(_0x5b1bc2);});});}exports[_0x06cf('0xc')]=function(_0x1c0a21,_0x1a4e05,_0x118b96){return function(_0x5939d5){if(_0x118b96['rules']&&!_0x118b96['rules'][_0x1c0a21]){logger['info'](_0x06cf('0xd'),_0x1c0a21);return _0x5939d5[_0x06cf('0xe')]();}var _0x780139=[];for(var _0x4e500a=0x0;_0x4e500a<_0x1a4e05[_0x06cf('0xf')];_0x4e500a+=0x1){_0x780139['push'](request(_0x06cf('0x10'),{'command':util['format'](_0x06cf('0x11'),_0x1a4e05[_0x4e500a])})[_0x06cf('0x7')](function(_0x4dcdeb){return _0x4dcdeb&&_0x4dcdeb[_0x06cf('0x9')]&&_0x4dcdeb['message'][_0x06cf('0x12')](_0x06cf('0x13'))>=0x0?!![]:![];})['catch'](function(_0x2d6f45){logger['error'](_0x06cf('0x14'),_0x1c0a21,_0x1a4e05[_0x4e500a]);}));}BPromise[_0x06cf('0x15')](_0x780139)['then'](function(_0x4f9ed2){var _0x39e93c=_[_0x06cf('0x16')](_0x4f9ed2);logger[_0x06cf('0x17')](_0x06cf('0x18'),_0x1c0a21,_0x1a4e05[_0x06cf('0x19')](_0x06cf('0x1a')),_0x39e93c);_0x5939d5['when'](_0x39e93c);})[_0x06cf('0xb')](function(_0x497a28){console[_0x06cf('0x1b')](_0x497a28);logger['error'](_0x06cf('0x18'),_0x1c0a21,_0x1a4e05[_0x06cf('0x19')](_0x06cf('0x1a')),_0x497a28[_0x06cf('0x1c')]);_0x5939d5[_0x06cf('0xe')]();});};}; \ No newline at end of file +var _0xb838=['length','push','Command','iftime\x20%s','indexOf','catch','all','some','join','\x20|\x20','when','log','stack','util','bluebird','jayson/promise','routing','http','request','then','error','message','result','condition','rules','info','stop'];(function(_0x52202d,_0x5be7e6){var _0x4b9df3=function(_0x1b1657){while(--_0x1b1657){_0x52202d['push'](_0x52202d['shift']());}};_0x4b9df3(++_0x5be7e6);}(_0xb838,0x94));var _0x8b83=function(_0x10fff8,_0x4bbc42){_0x10fff8=_0x10fff8-0x0;var _0x53d05a=_0xb838[_0x10fff8];return _0x53d05a;};'use strict';var util=require(_0x8b83('0x0'));var BPromise=require(_0x8b83('0x1'));var jayson=require(_0x8b83('0x2'));var _=require('lodash');var logger=require('../../../config/logger')(_0x8b83('0x3'));var client=jayson['client'][_0x8b83('0x4')]({'port':0x232a});function request(_0x47356f,_0x32615f){return new BPromise(function(_0x3efcbe,_0x3cff22){return client[_0x8b83('0x5')](_0x47356f,_0x32615f)[_0x8b83('0x6')](function(_0xee35ee){if(_0xee35ee[_0x8b83('0x7')]){return _0x3cff22(_0xee35ee[_0x8b83('0x7')][_0x8b83('0x8')]);}else{return _0x3efcbe(_0xee35ee[_0x8b83('0x9')]);}})['catch'](function(_0x135860){return _0x3cff22(_0x135860);});});}exports[_0x8b83('0xa')]=function(_0x536334,_0x8ebe9a,_0x40cac8){return function(_0x31e816){if(_0x40cac8[_0x8b83('0xb')]&&!_0x40cac8[_0x8b83('0xb')][_0x536334]){logger[_0x8b83('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x536334);return _0x31e816[_0x8b83('0xd')]();}var _0x5758c1=[];for(var _0x288393=0x0;_0x288393<_0x8ebe9a[_0x8b83('0xe')];_0x288393+=0x1){_0x5758c1[_0x8b83('0xf')](request(_0x8b83('0x10'),{'command':util['format'](_0x8b83('0x11'),_0x8ebe9a[_0x288393])})[_0x8b83('0x6')](function(_0x46fdda){return _0x46fdda&&_0x46fdda[_0x8b83('0x8')]&&_0x46fdda[_0x8b83('0x8')][_0x8b83('0x12')]('true')>=0x0?!![]:![];})[_0x8b83('0x13')](function(_0x325036){logger[_0x8b83('0x7')]('[%s][INTERVAL]\x20%s',_0x536334,_0x8ebe9a[_0x288393]);}));}BPromise[_0x8b83('0x14')](_0x5758c1)[_0x8b83('0x6')](function(_0x3bf037){var _0x54d87c=_[_0x8b83('0x15')](_0x3bf037);logger[_0x8b83('0xc')]('[%s][INTERVAL]\x20%s\x20%s',_0x536334,_0x8ebe9a[_0x8b83('0x16')](_0x8b83('0x17')),_0x54d87c);_0x31e816[_0x8b83('0x18')](_0x54d87c);})[_0x8b83('0x13')](function(_0x58e899){console[_0x8b83('0x19')](_0x58e899);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x536334,_0x8ebe9a[_0x8b83('0x16')]('\x20|\x20'),_0x58e899[_0x8b83('0x1a')]);_0x31e816['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index f1922e8..3e74166 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 _0xbfcc=['now','lastevent','called','connectedlinename','agentringnoanswer','isNil','debug','timeout','reason','holdtime','ringtime','push','error','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','talktime','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','extension','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererexten','transfertargetuniqueid','agentcalledAt','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','lodash','info','format','membername','interface','connectedlinenum','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','uniqueid'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0xbfcc[_0x3e531a];return _0x3c2574;};'use strict';var _=require(_0xcbfc('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1a2fe0,_0x2d1386){utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1a2fe0['uniqueid'],_0x1a2fe0['channel'],_0x1a2fe0['queue'],_0x1a2fe0[_0xcbfc('0x3')],_0x1a2fe0[_0xcbfc('0x4')],_0x1a2fe0['calleridnum'],_0x1a2fe0[_0xcbfc('0x5')],_0x1a2fe0['lastevent']));if(_0x1a2fe0[_0xcbfc('0x6')]){utils[_0xcbfc('0x7')](_0x1a2fe0[_0xcbfc('0x6')])[_0xcbfc('0x8')](function(_0x4eff22){if(_0x4eff22){_0x1a2fe0[_0xcbfc('0x9')]=_0x4eff22[_0xcbfc('0x9')];_0x1a2fe0[_0xcbfc('0xa')]=_0x1a2fe0[_0xcbfc('0xb')]?_0x4eff22[_0xcbfc('0xc')]:![];_0x1a2fe0[_0xcbfc('0xd')]=_0x1a2fe0['agentacw']?_0x4eff22[_0xcbfc('0xe')]:0x0;}utils[_0xcbfc('0xf')](_0xcbfc('0x10'),_0x1a2fe0);});}else{utils[_0xcbfc('0xf')](_0xcbfc('0x10'),_0x1a2fe0);}if(_0x2d1386){delete transfers[_0x1a2fe0['uniqueid']];}else{delete agents[_0x1a2fe0[_0xcbfc('0x11')]];}}exports[_0xcbfc('0x12')]=function(_0x80d08d){try{utils['debug'](util[_0xcbfc('0x2')](_0xcbfc('0x13'),_0x80d08d[_0xcbfc('0x14')]),_0x80d08d);agents[_0x80d08d[_0xcbfc('0x11')]]=_0x80d08d;agents[_0x80d08d[_0xcbfc('0x11')]]['agentcalledAt']=utils[_0xcbfc('0x15')]();agents[_0x80d08d[_0xcbfc('0x11')]][_0xcbfc('0x16')]=_0xcbfc('0x17');agents[_0x80d08d['destuniqueid']]['connectedlinenum']=null;agents[_0x80d08d[_0xcbfc('0x11')]][_0xcbfc('0x18')]=null;utils[_0xcbfc('0x1')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x80d08d[_0xcbfc('0x14')],agents[_0x80d08d[_0xcbfc('0x11')]][_0xcbfc('0x3')],_0x80d08d['destuniqueid']));}catch(_0x3825d5){utils['error'](util[_0xcbfc('0x2')](_0xcbfc('0x13'),_0x80d08d[_0xcbfc('0x14')]),_0x3825d5);}};exports[_0xcbfc('0x19')]=function(_0x25c167){try{if(!_[_0xcbfc('0x1a')](agents[_0x25c167['destuniqueid']])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')]('[%s][agents][agentringnoanswer]',_0x25c167[_0xcbfc('0x14')]),_0x25c167);utils['info'](util['format']('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x25c167[_0xcbfc('0x14')],agents[_0x25c167['destuniqueid']]['membername'],_0x25c167[_0xcbfc('0x11')]));agents[_0x25c167[_0xcbfc('0x11')]][_0xcbfc('0x19')]=!![];agents[_0x25c167[_0xcbfc('0x11')]]['agentringnoanswerAt']=utils[_0xcbfc('0x15')]();agents[_0x25c167['destuniqueid']][_0xcbfc('0x16')]=_0xcbfc('0x1c');agents[_0x25c167['destuniqueid']][_0xcbfc('0x1d')]=_0xcbfc('0x1c');agents[_0x25c167['destuniqueid']][_0xcbfc('0x1e')]=_0x25c167[_0xcbfc('0x1f')]?parseInt(_0x25c167[_0xcbfc('0x1f')])/0x3e8:0x0;agents[_0x25c167[_0xcbfc('0x11')]]['talktime']=0x0;unanswered[_0xcbfc('0x20')](_0x25c167[_0xcbfc('0x11')]);}}catch(_0x4f632a){utils[_0xcbfc('0x21')](util[_0xcbfc('0x2')](_0xcbfc('0x22'),_0x25c167[_0xcbfc('0x14')]),_0x4f632a);}};exports[_0xcbfc('0x23')]=function(_0x19d2e){try{_[_0xcbfc('0x24')](agents,function(_0x5366cf,_0x41b68b){if(_0x5366cf[_0xcbfc('0x14')]==_0x19d2e[_0xcbfc('0x14')]&&!_[_0xcbfc('0x25')](unanswered,_0x5366cf['destuniqueid'])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x26'),_0x19d2e[_0xcbfc('0x14')]),_0x19d2e);utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x27'),_0x19d2e['uniqueid'],_0x5366cf[_0xcbfc('0x3')],_0x5366cf[_0xcbfc('0x11')]));_0x5366cf['agentringnoanswer']=!![];_0x5366cf[_0xcbfc('0x28')]=utils[_0xcbfc('0x15')]();_0x5366cf[_0xcbfc('0x16')]='abandoned';_0x5366cf['reason']='abandoned';_0x5366cf[_0xcbfc('0x1e')]=_0x19d2e[_0xcbfc('0x1e')];_0x5366cf[_0xcbfc('0x29')]=0x0;writeDB(_0x5366cf);}});}catch(_0x9c1ff3){utils[_0xcbfc('0x21')](util[_0xcbfc('0x2')](_0xcbfc('0x26'),_0x19d2e[_0xcbfc('0x14')]),_0x9c1ff3);}};exports['agentconnect']=function(_0x2f14ff){try{if(agents[_0x2f14ff[_0xcbfc('0x11')]]){utils['debug'](util[_0xcbfc('0x2')]('[%s][agents][agentconnect]',_0x2f14ff[_0xcbfc('0x14')]),_0x2f14ff);utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2f14ff[_0xcbfc('0x14')],agents[_0x2f14ff['destuniqueid']]['membername'],_0x2f14ff[_0xcbfc('0x11')]));agents[_0x2f14ff[_0xcbfc('0x11')]][_0xcbfc('0x2a')]=utils[_0xcbfc('0x15')]();agents[_0x2f14ff[_0xcbfc('0x11')]][_0xcbfc('0x5')]=_0x2f14ff[_0xcbfc('0x5')];agents[_0x2f14ff[_0xcbfc('0x11')]]['connectedlinename']=_0x2f14ff[_0xcbfc('0x18')];agents[_0x2f14ff['destuniqueid']][_0xcbfc('0x1e')]=_0x2f14ff[_0xcbfc('0x1f')];agents[_0x2f14ff[_0xcbfc('0x11')]][_0xcbfc('0x16')]='connect';_['forIn'](agents,function(_0x236b66,_0x1c678b){if(_0x236b66[_0xcbfc('0x11')]!=_0x2f14ff[_0xcbfc('0x11')]&&_0x236b66[_0xcbfc('0x14')]==_0x2f14ff['uniqueid']){_0x236b66[_0xcbfc('0x29')]=0x0;_0x236b66[_0xcbfc('0x1e')]=_0x2f14ff[_0xcbfc('0x1f')];_0x236b66['agentringnoanswer']=!![];_0x236b66[_0xcbfc('0x28')]=utils[_0xcbfc('0x15')]();_0x236b66[_0xcbfc('0x16')]='answered_elsewhere';_0x236b66[_0xcbfc('0x1d')]=_0xcbfc('0x2b');_0x236b66[_0xcbfc('0x2c')]=_0x2f14ff[_0xcbfc('0x11')];_0x236b66[_0xcbfc('0x2d')]=_0x2f14ff[_0xcbfc('0x3')];writeDB(_0x236b66);}});}}catch(_0x1e14bb){utils['error'](util[_0xcbfc('0x2')](_0xcbfc('0x2e'),_0x2f14ff['uniqueid']),_0x1e14bb);}};exports[_0xcbfc('0xb')]=function(_0x50a01c){try{if(!_[_0xcbfc('0x1a')](agents[_0x50a01c[_0xcbfc('0x11')]])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x2f'),_0x50a01c[_0xcbfc('0x14')]),_0x50a01c);utils['info'](util[_0xcbfc('0x2')](_0xcbfc('0x30'),_0x50a01c[_0xcbfc('0x14')],agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x3')],_0x50a01c[_0xcbfc('0x11')]));agents[_0x50a01c[_0xcbfc('0x11')]]['agentcomplete']=!![];agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x31')]=utils['now']();agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x29')]=utils[_0xcbfc('0x32')](agents[_0x50a01c['destuniqueid']][_0xcbfc('0x31')],agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x2a')]);agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x1d')]=_0x50a01c[_0xcbfc('0x1d')];agents[_0x50a01c[_0xcbfc('0x11')]]['lastevent']='complete';writeDB(agents[_0x50a01c[_0xcbfc('0x11')]]);}}catch(_0x94398c){utils[_0xcbfc('0x21')](util[_0xcbfc('0x2')]('[%s][agents][agentcomplete]',_0x50a01c['uniqueid']),_0x94398c);}};exports[_0xcbfc('0x33')]=function(_0xe5c5ef){try{if(!_[_0xcbfc('0x1a')](agents[_0xe5c5ef['transfereruniqueid']])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x34'),_0xe5c5ef['uniqueid']),_0xe5c5ef);utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x35'),_0xe5c5ef[_0xcbfc('0x14')],agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x3')],agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x14')]));agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x37')]=!![];agents[_0xe5c5ef['transfereruniqueid']][_0xcbfc('0x38')]=_0xcbfc('0x39');agents[_0xe5c5ef[_0xcbfc('0x36')]]['transferexten']=_0xe5c5ef[_0xcbfc('0x3a')];agents[_0xe5c5ef[_0xcbfc('0x36')]]['transferuniqueid']=agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x14')];}}catch(_0x38db76){utils[_0xcbfc('0x21')](util['format'](_0xcbfc('0x34'),_0xe5c5ef[_0xcbfc('0x14')]),_0x38db76);}};exports['attendedtransfer']=function(_0x2fe240){try{utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x3b'),_0x2fe240[_0xcbfc('0x3c')]),_0x2fe240);if(_0x2fe240[_0xcbfc('0x3c')]==_0x2fe240[_0xcbfc('0x3d')]){if(!_[_0xcbfc('0x1a')](agents[_0x2fe240[_0xcbfc('0x3e')]])){utils[_0xcbfc('0x1')](util['format'](_0xcbfc('0x3f'),_0x2fe240['origtransfereruniqueid'],agents[_0x2fe240['secondtransfereruniqueid']]['membername']));agents[_0x2fe240[_0xcbfc('0x3e')]][_0xcbfc('0x37')]=!![];agents[_0x2fe240[_0xcbfc('0x3e')]][_0xcbfc('0x38')]=_0xcbfc('0x40');agents[_0x2fe240[_0xcbfc('0x3e')]][_0xcbfc('0x41')]=_0x2fe240[_0xcbfc('0x42')];agents[_0x2fe240['secondtransfereruniqueid']][_0xcbfc('0x43')]=_0x2fe240[_0xcbfc('0x3c')];}if(_0x2fe240[_0xcbfc('0x44')]&&agents[_0x2fe240['transfereeuniqueid']]){agents[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x45')]=0x1;transfers[_0x2fe240[_0xcbfc('0x44')]]=_[_0xcbfc('0x46')](agents[_0x2fe240[_0xcbfc('0x44')]]);transfers[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x47')]=agents[_0x2fe240['secondtransfereruniqueid']][_0xcbfc('0x47')];transfers[_0x2fe240['transfereeuniqueid']][_0xcbfc('0x48')]=agents[_0x2fe240[_0xcbfc('0x3e')]]['calleridname'];transfers[_0x2fe240[_0xcbfc('0x44')]]['agentcalledAt']=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x2a')]=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x1e')]=0x0;transfers[_0x2fe240['transfereeuniqueid']][_0xcbfc('0x45')]=0x2;}}else if(_0x2fe240[_0xcbfc('0x3e')]==_0x2fe240['secondtransfererlinkedid']){if(!_[_0xcbfc('0x1a')](agents[_0x2fe240[_0xcbfc('0x3c')]])){utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x3f'),_0x2fe240[_0xcbfc('0x3c')],agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x3')]));agents[_0x2fe240['origtransfereruniqueid']][_0xcbfc('0x37')]=!![];agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x38')]=_0xcbfc('0x40');agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x41')]=_0x2fe240[_0xcbfc('0x49')];agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x43')]=_0x2fe240[_0xcbfc('0x3e')];}if(_0x2fe240['transfertargetuniqueid']&&agents[_0x2fe240[_0xcbfc('0x4a')]]){agents[_0x2fe240[_0xcbfc('0x4a')]]['agententerreason']=0x1;transfers[_0x2fe240[_0xcbfc('0x4a')]]=_['clone'](agents[_0x2fe240['transfertargetuniqueid']]);transfers[_0x2fe240[_0xcbfc('0x4a')]][_0xcbfc('0x47')]=agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x47')];transfers[_0x2fe240[_0xcbfc('0x4a')]]['calleridname']=agents[_0x2fe240['origtransfereruniqueid']][_0xcbfc('0x48')];transfers[_0x2fe240[_0xcbfc('0x4a')]][_0xcbfc('0x4b')]=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x4a')]]['agentconnectAt']=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x4a')]][_0xcbfc('0x1e')]=0x0;transfers[_0x2fe240['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x4c3d4d){utils[_0xcbfc('0x21')](util['format']('[%s][agents][attendedtransfer]',_0x2fe240[_0xcbfc('0x3c')]),_0x4c3d4d);}};exports['hangup']=function(_0x99068f){try{utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x4c'),_0x99068f[_0xcbfc('0x14')]),_0x99068f);if(agents[_0x99068f[_0xcbfc('0x14')]]&&agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]===_0xcbfc('0x1c')){if(_0x99068f['cause']==='21'){agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]=_0xcbfc('0x4d');agents[_0x99068f['uniqueid']][_0xcbfc('0x16')]=_0xcbfc('0x4d');}utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x4e'),_0x99068f[_0xcbfc('0x14')],agents[_0x99068f[_0xcbfc('0x14')]]['membername'],agents[_0x99068f[_0xcbfc('0x14')]]['reason'],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x16')]));writeDB(agents[_0x99068f[_0xcbfc('0x14')]]);var _0x51019a=unanswered[_0xcbfc('0x4f')](_0x99068f['uniqueid']);if(_0x51019a>-0x1){unanswered[_0xcbfc('0x50')](_0x51019a,0x1);}}if(transfers[_0x99068f[_0xcbfc('0x14')]]){transfers[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0xb')]=!![];transfers[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x31')]=utils[_0xcbfc('0x15')]();transfers[_0x99068f['uniqueid']][_0xcbfc('0x29')]=utils[_0xcbfc('0x32')](transfers[_0x99068f[_0xcbfc('0x14')]]['agentcompleteAt'],transfers[_0x99068f[_0xcbfc('0x14')]]['agentconnectAt']);transfers[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]=_0xcbfc('0x51');transfers[_0x99068f['uniqueid']][_0xcbfc('0x16')]=_0xcbfc('0x52');utils['info'](util[_0xcbfc('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x99068f[_0xcbfc('0x14')],transfers[_0x99068f['uniqueid']][_0xcbfc('0x3')],transfers[_0x99068f[_0xcbfc('0x14')]]['reason'],transfers[_0x99068f[_0xcbfc('0x14')]]['lastevent']));writeDB(transfers[_0x99068f[_0xcbfc('0x14')]],!![]);}if(agents[_0x99068f[_0xcbfc('0x14')]]&&agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x2a')]){agents[_0x99068f['uniqueid']][_0xcbfc('0xb')]=!![];agents[_0x99068f['uniqueid']][_0xcbfc('0x31')]=utils[_0xcbfc('0x15')]();agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x29')]=utils[_0xcbfc('0x32')](agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x31')],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x2a')]);agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]=agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x37')]?_0xcbfc('0x37'):_0xcbfc('0x51');agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x16')]='complete';utils[_0xcbfc('0x1')](util['format'](_0xcbfc('0x4e'),_0x99068f['uniqueid'],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x3')],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x16')]));writeDB(agents[_0x99068f[_0xcbfc('0x14')]]);}}catch(_0x4f38cb){utils[_0xcbfc('0x21')](util['format'](_0xcbfc('0x4c'),_0x99068f[_0xcbfc('0x14')]),_0x4f38cb);}}; \ No newline at end of file +var _0x69d3=['isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','util','./utils','info','uniqueid','membername','interface','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','format','[%s][agents][agentcalled]','agentcalledAt','now','destuniqueid','called','connectedlinename','error','agentringnoanswer'];(function(_0x350e88,_0x32723e){var _0x359fae=function(_0x232b15){while(--_0x232b15){_0x350e88['push'](_0x350e88['shift']());}};_0x359fae(++_0x32723e);}(_0x69d3,0xda));var _0x369d=function(_0xcfde0e,_0x36c5f2){_0xcfde0e=_0xcfde0e-0x0;var _0x471a35=_0x69d3[_0xcfde0e];return _0x471a35;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var utils=require(_0x369d('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x52c3ba,_0x47591f){utils[_0x369d('0x3')](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x52c3ba[_0x369d('0x4')],_0x52c3ba['channel'],_0x52c3ba['queue'],_0x52c3ba[_0x369d('0x5')],_0x52c3ba[_0x369d('0x6')],_0x52c3ba[_0x369d('0x7')],_0x52c3ba[_0x369d('0x8')],_0x52c3ba[_0x369d('0x9')]));if(_0x52c3ba[_0x369d('0xa')]){utils[_0x369d('0xb')](_0x52c3ba[_0x369d('0xa')])[_0x369d('0xc')](function(_0x580727){if(_0x580727){_0x52c3ba['type']=_0x580727[_0x369d('0xd')];_0x52c3ba[_0x369d('0xe')]=_0x52c3ba[_0x369d('0xf')]?_0x580727[_0x369d('0x10')]:![];_0x52c3ba['acwtime']=_0x52c3ba['agentacw']?_0x580727[_0x369d('0x11')]:0x0;}utils[_0x369d('0x12')](_0x369d('0x13'),_0x52c3ba);});}else{utils[_0x369d('0x12')](_0x369d('0x13'),_0x52c3ba);}if(_0x47591f){delete transfers[_0x52c3ba[_0x369d('0x4')]];}else{delete agents[_0x52c3ba['destuniqueid']];}}exports[_0x369d('0x14')]=function(_0x9d016){try{utils[_0x369d('0x15')](util[_0x369d('0x16')](_0x369d('0x17'),_0x9d016['uniqueid']),_0x9d016);agents[_0x9d016['destuniqueid']]=_0x9d016;agents[_0x9d016['destuniqueid']][_0x369d('0x18')]=utils[_0x369d('0x19')]();agents[_0x9d016[_0x369d('0x1a')]]['lastevent']=_0x369d('0x1b');agents[_0x9d016[_0x369d('0x1a')]][_0x369d('0x8')]=null;agents[_0x9d016['destuniqueid']][_0x369d('0x1c')]=null;utils[_0x369d('0x3')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x9d016['uniqueid'],agents[_0x9d016[_0x369d('0x1a')]][_0x369d('0x5')],_0x9d016[_0x369d('0x1a')]));}catch(_0x4ddcb2){utils[_0x369d('0x1d')](util[_0x369d('0x16')](_0x369d('0x17'),_0x9d016[_0x369d('0x4')]),_0x4ddcb2);}};exports[_0x369d('0x1e')]=function(_0x538ca4){try{if(!_[_0x369d('0x1f')](agents[_0x538ca4[_0x369d('0x1a')]])){utils[_0x369d('0x15')](util[_0x369d('0x16')](_0x369d('0x20'),_0x538ca4[_0x369d('0x4')]),_0x538ca4);utils[_0x369d('0x3')](util[_0x369d('0x16')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x538ca4['uniqueid'],agents[_0x538ca4[_0x369d('0x1a')]][_0x369d('0x5')],_0x538ca4[_0x369d('0x1a')]));agents[_0x538ca4[_0x369d('0x1a')]][_0x369d('0x1e')]=!![];agents[_0x538ca4[_0x369d('0x1a')]][_0x369d('0x21')]=utils['now']();agents[_0x538ca4['destuniqueid']][_0x369d('0x9')]=_0x369d('0x22');agents[_0x538ca4[_0x369d('0x1a')]][_0x369d('0x23')]=_0x369d('0x22');agents[_0x538ca4[_0x369d('0x1a')]][_0x369d('0x24')]=_0x538ca4['ringtime']?parseInt(_0x538ca4[_0x369d('0x25')])/0x3e8:0x0;agents[_0x538ca4[_0x369d('0x1a')]][_0x369d('0x26')]=0x0;unanswered[_0x369d('0x27')](_0x538ca4[_0x369d('0x1a')]);}}catch(_0x41367a){utils[_0x369d('0x1d')](util['format'](_0x369d('0x20'),_0x538ca4['uniqueid']),_0x41367a);}};exports['queuecallerabandon']=function(_0x38feda){try{_[_0x369d('0x28')](agents,function(_0x5844c7,_0x104540){if(_0x5844c7['uniqueid']==_0x38feda[_0x369d('0x4')]&&!_[_0x369d('0x29')](unanswered,_0x5844c7[_0x369d('0x1a')])){utils[_0x369d('0x15')](util[_0x369d('0x16')](_0x369d('0x2a'),_0x38feda[_0x369d('0x4')]),_0x38feda);utils['info'](util[_0x369d('0x16')](_0x369d('0x2b'),_0x38feda[_0x369d('0x4')],_0x5844c7[_0x369d('0x5')],_0x5844c7[_0x369d('0x1a')]));_0x5844c7[_0x369d('0x1e')]=!![];_0x5844c7[_0x369d('0x21')]=utils[_0x369d('0x19')]();_0x5844c7['lastevent']=_0x369d('0x2c');_0x5844c7[_0x369d('0x23')]=_0x369d('0x2c');_0x5844c7[_0x369d('0x24')]=_0x38feda[_0x369d('0x24')];_0x5844c7['talktime']=0x0;writeDB(_0x5844c7);}});}catch(_0x35f326){utils[_0x369d('0x1d')](util[_0x369d('0x16')](_0x369d('0x2a'),_0x38feda[_0x369d('0x4')]),_0x35f326);}};exports[_0x369d('0x2d')]=function(_0x50c033){try{if(agents[_0x50c033[_0x369d('0x1a')]]){utils[_0x369d('0x15')](util[_0x369d('0x16')](_0x369d('0x2e'),_0x50c033[_0x369d('0x4')]),_0x50c033);utils[_0x369d('0x3')](util[_0x369d('0x16')](_0x369d('0x2f'),_0x50c033[_0x369d('0x4')],agents[_0x50c033[_0x369d('0x1a')]][_0x369d('0x5')],_0x50c033[_0x369d('0x1a')]));agents[_0x50c033[_0x369d('0x1a')]][_0x369d('0x30')]=utils[_0x369d('0x19')]();agents[_0x50c033[_0x369d('0x1a')]][_0x369d('0x8')]=_0x50c033[_0x369d('0x8')];agents[_0x50c033[_0x369d('0x1a')]][_0x369d('0x1c')]=_0x50c033[_0x369d('0x1c')];agents[_0x50c033[_0x369d('0x1a')]][_0x369d('0x24')]=_0x50c033[_0x369d('0x25')];agents[_0x50c033['destuniqueid']]['lastevent']=_0x369d('0x31');_[_0x369d('0x28')](agents,function(_0x8a1ef5,_0x401bc7){if(_0x8a1ef5[_0x369d('0x1a')]!=_0x50c033[_0x369d('0x1a')]&&_0x8a1ef5[_0x369d('0x4')]==_0x50c033[_0x369d('0x4')]){_0x8a1ef5[_0x369d('0x26')]=0x0;_0x8a1ef5['holdtime']=_0x50c033[_0x369d('0x25')];_0x8a1ef5[_0x369d('0x1e')]=!![];_0x8a1ef5[_0x369d('0x21')]=utils[_0x369d('0x19')]();_0x8a1ef5[_0x369d('0x9')]=_0x369d('0x32');_0x8a1ef5[_0x369d('0x23')]=_0x369d('0x32');_0x8a1ef5['answeredelsewheredestinationuniqueid']=_0x50c033['destuniqueid'];_0x8a1ef5[_0x369d('0x33')]=_0x50c033[_0x369d('0x5')];writeDB(_0x8a1ef5);}});}}catch(_0x30909a){utils['error'](util['format']('[%s][agents][agentconnect]',_0x50c033[_0x369d('0x4')]),_0x30909a);}};exports[_0x369d('0xf')]=function(_0x55dfde){try{if(!_[_0x369d('0x1f')](agents[_0x55dfde[_0x369d('0x1a')]])){utils[_0x369d('0x15')](util[_0x369d('0x16')]('[%s][agents][agentcomplete]',_0x55dfde[_0x369d('0x4')]),_0x55dfde);utils['info'](util[_0x369d('0x16')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x55dfde[_0x369d('0x4')],agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x5')],_0x55dfde['destuniqueid']));agents[_0x55dfde['destuniqueid']][_0x369d('0xf')]=!![];agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x34')]=utils['now']();agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x26')]=utils[_0x369d('0x35')](agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x34')],agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x30')]);agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x23')]=_0x55dfde['reason'];agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x9')]=_0x369d('0x36');writeDB(agents[_0x55dfde[_0x369d('0x1a')]]);}}catch(_0x27e2c7){utils[_0x369d('0x1d')](util['format'](_0x369d('0x37'),_0x55dfde[_0x369d('0x4')]),_0x27e2c7);}};exports[_0x369d('0x38')]=function(_0x44a357){try{if(!_[_0x369d('0x1f')](agents[_0x44a357[_0x369d('0x39')]])){utils[_0x369d('0x15')](util[_0x369d('0x16')](_0x369d('0x3a'),_0x44a357[_0x369d('0x4')]),_0x44a357);utils[_0x369d('0x3')](util[_0x369d('0x16')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x44a357[_0x369d('0x4')],agents[_0x44a357[_0x369d('0x39')]][_0x369d('0x5')],agents[_0x44a357[_0x369d('0x39')]][_0x369d('0x4')]));agents[_0x44a357['transfereruniqueid']][_0x369d('0x3b')]=!![];agents[_0x44a357['transfereruniqueid']][_0x369d('0x3c')]=_0x369d('0x3d');agents[_0x44a357[_0x369d('0x39')]][_0x369d('0x3e')]=_0x44a357[_0x369d('0x3f')];agents[_0x44a357[_0x369d('0x39')]][_0x369d('0x40')]=agents[_0x44a357[_0x369d('0x39')]][_0x369d('0x4')];}}catch(_0x9f1544){utils['error'](util['format'](_0x369d('0x3a'),_0x44a357[_0x369d('0x4')]),_0x9f1544);}};exports[_0x369d('0x41')]=function(_0x4226de){try{utils[_0x369d('0x15')](util['format']('[%s][agents][attendedtransfer]',_0x4226de[_0x369d('0x42')]),_0x4226de);if(_0x4226de[_0x369d('0x42')]==_0x4226de['origtransfererlinkedid']){if(!_[_0x369d('0x1f')](agents[_0x4226de['secondtransfereruniqueid']])){utils[_0x369d('0x3')](util[_0x369d('0x16')](_0x369d('0x43'),_0x4226de['origtransfereruniqueid'],agents[_0x4226de[_0x369d('0x44')]][_0x369d('0x5')]));agents[_0x4226de[_0x369d('0x44')]][_0x369d('0x3b')]=!![];agents[_0x4226de['secondtransfereruniqueid']]['transfertype']=_0x369d('0x45');agents[_0x4226de[_0x369d('0x44')]][_0x369d('0x3e')]=_0x4226de['origtransfererexten'];agents[_0x4226de[_0x369d('0x44')]][_0x369d('0x40')]=_0x4226de[_0x369d('0x42')];}if(_0x4226de['transfereeuniqueid']&&agents[_0x4226de['transfereeuniqueid']]){agents[_0x4226de[_0x369d('0x46')]][_0x369d('0x47')]=0x1;transfers[_0x4226de[_0x369d('0x46')]]=_[_0x369d('0x48')](agents[_0x4226de['transfereeuniqueid']]);transfers[_0x4226de[_0x369d('0x46')]][_0x369d('0x7')]=agents[_0x4226de[_0x369d('0x44')]][_0x369d('0x7')];transfers[_0x4226de[_0x369d('0x46')]]['calleridname']=agents[_0x4226de[_0x369d('0x44')]][_0x369d('0x49')];transfers[_0x4226de[_0x369d('0x46')]]['agentcalledAt']=utils[_0x369d('0x19')]();transfers[_0x4226de['transfereeuniqueid']][_0x369d('0x30')]=utils['now']();transfers[_0x4226de['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x4226de['transfereeuniqueid']][_0x369d('0x47')]=0x2;}}else if(_0x4226de['secondtransfereruniqueid']==_0x4226de[_0x369d('0x4a')]){if(!_['isNil'](agents[_0x4226de[_0x369d('0x42')]])){utils[_0x369d('0x3')](util[_0x369d('0x16')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x4226de[_0x369d('0x42')],agents[_0x4226de[_0x369d('0x42')]][_0x369d('0x5')]));agents[_0x4226de[_0x369d('0x42')]][_0x369d('0x3b')]=!![];agents[_0x4226de[_0x369d('0x42')]]['transfertype']=_0x369d('0x45');agents[_0x4226de['origtransfereruniqueid']]['transferexten']=_0x4226de['secondtransfererexten'];agents[_0x4226de[_0x369d('0x42')]][_0x369d('0x40')]=_0x4226de[_0x369d('0x44')];}if(_0x4226de[_0x369d('0x4b')]&&agents[_0x4226de[_0x369d('0x4b')]]){agents[_0x4226de[_0x369d('0x4b')]][_0x369d('0x47')]=0x1;transfers[_0x4226de[_0x369d('0x4b')]]=_[_0x369d('0x48')](agents[_0x4226de[_0x369d('0x4b')]]);transfers[_0x4226de[_0x369d('0x4b')]][_0x369d('0x7')]=agents[_0x4226de[_0x369d('0x42')]][_0x369d('0x7')];transfers[_0x4226de[_0x369d('0x4b')]][_0x369d('0x49')]=agents[_0x4226de['origtransfereruniqueid']][_0x369d('0x49')];transfers[_0x4226de['transfertargetuniqueid']][_0x369d('0x18')]=utils[_0x369d('0x19')]();transfers[_0x4226de[_0x369d('0x4b')]][_0x369d('0x30')]=utils[_0x369d('0x19')]();transfers[_0x4226de['transfertargetuniqueid']][_0x369d('0x24')]=0x0;transfers[_0x4226de['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x3ee715){utils[_0x369d('0x1d')](util[_0x369d('0x16')](_0x369d('0x4c'),_0x4226de[_0x369d('0x42')]),_0x3ee715);}};exports[_0x369d('0x4d')]=function(_0x341d93){try{utils[_0x369d('0x15')](util['format'](_0x369d('0x4e'),_0x341d93[_0x369d('0x4')]),_0x341d93);if(agents[_0x341d93['uniqueid']]&&agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x23')]===_0x369d('0x22')){if(_0x341d93['cause']==='21'){agents[_0x341d93[_0x369d('0x4')]]['reason']=_0x369d('0x4f');agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x9')]=_0x369d('0x4f');}utils[_0x369d('0x3')](util[_0x369d('0x16')](_0x369d('0x50'),_0x341d93['uniqueid'],agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x5')],agents[_0x341d93['uniqueid']][_0x369d('0x23')],agents[_0x341d93['uniqueid']][_0x369d('0x9')]));writeDB(agents[_0x341d93[_0x369d('0x4')]]);var _0x2b7897=unanswered['indexOf'](_0x341d93[_0x369d('0x4')]);if(_0x2b7897>-0x1){unanswered[_0x369d('0x51')](_0x2b7897,0x1);}}if(transfers[_0x341d93['uniqueid']]){transfers[_0x341d93[_0x369d('0x4')]][_0x369d('0xf')]=!![];transfers[_0x341d93[_0x369d('0x4')]]['agentcompleteAt']=utils[_0x369d('0x19')]();transfers[_0x341d93[_0x369d('0x4')]][_0x369d('0x26')]=utils[_0x369d('0x35')](transfers[_0x341d93[_0x369d('0x4')]]['agentcompleteAt'],transfers[_0x341d93[_0x369d('0x4')]][_0x369d('0x30')]);transfers[_0x341d93[_0x369d('0x4')]][_0x369d('0x23')]=_0x369d('0x52');transfers[_0x341d93['uniqueid']]['lastevent']=_0x369d('0x36');utils[_0x369d('0x3')](util[_0x369d('0x16')](_0x369d('0x50'),_0x341d93[_0x369d('0x4')],transfers[_0x341d93[_0x369d('0x4')]]['membername'],transfers[_0x341d93[_0x369d('0x4')]][_0x369d('0x23')],transfers[_0x341d93['uniqueid']][_0x369d('0x9')]));writeDB(transfers[_0x341d93['uniqueid']],!![]);}if(agents[_0x341d93[_0x369d('0x4')]]&&agents[_0x341d93['uniqueid']][_0x369d('0x30')]){agents[_0x341d93[_0x369d('0x4')]]['agentcomplete']=!![];agents[_0x341d93[_0x369d('0x4')]]['agentcompleteAt']=utils[_0x369d('0x19')]();agents[_0x341d93['uniqueid']]['talktime']=utils[_0x369d('0x35')](agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x34')],agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x30')]);agents[_0x341d93['uniqueid']][_0x369d('0x23')]=agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x3b')]?_0x369d('0x3b'):_0x369d('0x52');agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x9')]=_0x369d('0x36');utils[_0x369d('0x3')](util['format'](_0x369d('0x50'),_0x341d93[_0x369d('0x4')],agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x5')],agents[_0x341d93['uniqueid']][_0x369d('0x23')],agents[_0x341d93['uniqueid']][_0x369d('0x9')]));writeDB(agents[_0x341d93[_0x369d('0x4')]]);}}catch(_0x34a225){utils[_0x369d('0x1d')](util[_0x369d('0x16')](_0x369d('0x4e'),_0x341d93[_0x369d('0x4')]),_0x34a225);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 66c2bb1..dedf684 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 _0x7d6d=['set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','accountcode','then','UserId','request','CreateVoiceCallReport','debug','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','origtransfererchannel','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','xmd-originatecalleridnum','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','value','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase'];(function(_0x5947f8,_0x305779){var _0x43888e=function(_0xa6aadc){while(--_0xa6aadc){_0x5947f8['push'](_0x5947f8['shift']());}};_0x43888e(++_0x305779);}(_0x7d6d,0x75));var _0xd7d6=function(_0x1fdce6,_0x4412d9){_0x1fdce6=_0x1fdce6-0x0;var _0x36b546=_0x7d6d[_0x1fdce6];return _0x36b546;};'use strict';var _=require(_0xd7d6('0x0'));var util=require(_0xd7d6('0x1'));var utils=require('./utils');var transfers=require(_0xd7d6('0x2'));var dispositions=['NO\x20ANSWER',_0xd7d6('0x3'),'FAILED',_0xd7d6('0x4'),_0xd7d6('0x4'),_0xd7d6('0x4'),_0xd7d6('0x5'),_0xd7d6('0x6'),'FAILED',_0xd7d6('0x3'),'FAILED'];var channels={};function writeDB(_0x2605cf){var _0x112843;if(transfers[_0xd7d6('0x7')][_0x2605cf[_0xd7d6('0x8')]]){_0x112843=_0x2605cf[_0xd7d6('0x8')];_0x2605cf[_0xd7d6('0x8')]=transfers[_0xd7d6('0x7')][_0x2605cf[_0xd7d6('0x8')]]['transfereeuniqueid'];}utils[_0xd7d6('0x9')](util[_0xd7d6('0xa')](_0xd7d6('0xb'),_0x2605cf[_0xd7d6('0x8')],_0x2605cf[_0xd7d6('0xc')],_0x2605cf[_0xd7d6('0xd')],_0x2605cf['membername'],_0x2605cf[_0xd7d6('0xe')],_0x2605cf[_0xd7d6('0xf')],_0x2605cf['connectedlinenum'],_0x2605cf['lastevent']));if(_0x2605cf[_0xd7d6('0x10')]){utils['getUserByInternal'](_0x2605cf[_0xd7d6('0x10')])[_0xd7d6('0x11')](function(_0x48c32e){if(_0x48c32e){_0x2605cf[_0xd7d6('0x12')]=_0x48c32e['id'];}utils[_0xd7d6('0x13')](_0xd7d6('0x14'),_0x2605cf);});}else{utils[_0xd7d6('0x13')](_0xd7d6('0x14'),_0x2605cf);}if(channels[_0x2605cf['uniqueid']]){delete channels[_0x2605cf[_0xd7d6('0x8')]];}else if(_0x112843&&channels[_0x112843]){delete transfers[_0xd7d6('0x7')][_0x112843];delete channels[_0x112843];}}exports['newchannel']=function(_0x22dbbc){try{utils[_0xd7d6('0x15')](util[_0xd7d6('0xa')]('[%s][calls][newchannel]',_0x22dbbc['uniqueid']),_0x22dbbc);if(_0x22dbbc[_0xd7d6('0x8')]==_0x22dbbc['linkedid']&&_0x22dbbc['channel']!=_0xd7d6('0x16')){utils[_0xd7d6('0x9')](util[_0xd7d6('0xa')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x22dbbc[_0xd7d6('0x8')],_0x22dbbc[_0xd7d6('0x17')],_0x22dbbc[_0xd7d6('0x18')]));channels[_0x22dbbc[_0xd7d6('0x8')]]={'uniqueid':_0x22dbbc['uniqueid'],'accountcode':_0x22dbbc[_0xd7d6('0x10')],'source':_0x22dbbc[_0xd7d6('0xf')],'destination':_0x22dbbc[_0xd7d6('0x18')],'destinationcontext':_0x22dbbc[_0xd7d6('0x17')],'channel':_0x22dbbc[_0xd7d6('0xc')],'starttime':utils[_0xd7d6('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xd7d6('0x4'),'amaflags':_0xd7d6('0x1a')};}}catch(_0x2f0521){utils[_0xd7d6('0x1b')](util['format'](_0xd7d6('0x1c'),_0x22dbbc[_0xd7d6('0x8')]),_0x2f0521);}};exports[_0xd7d6('0x1d')]=function(_0x9a62c9){try{utils[_0xd7d6('0x15')](util[_0xd7d6('0xa')]('[%s][calls][newstate]',_0x9a62c9[_0xd7d6('0x8')]),_0x9a62c9);if(!_[_0xd7d6('0x1e')](channels[_0x9a62c9[_0xd7d6('0x8')]])&&_0x9a62c9[_0xd7d6('0x1f')]==0x6){utils['info'](util[_0xd7d6('0xa')](_0xd7d6('0x20'),_0x9a62c9[_0xd7d6('0x8')],_0x9a62c9['context'],_0x9a62c9[_0xd7d6('0xc')]));if(_[_0xd7d6('0x1e')](channels[_0x9a62c9[_0xd7d6('0x8')]][_0xd7d6('0x21')])){channels[_0x9a62c9[_0xd7d6('0x8')]]['systemanswertime']=utils['now']();}}else if(!_[_0xd7d6('0x1e')](channels[_0x9a62c9[_0xd7d6('0x22')]])&&_0x9a62c9[_0xd7d6('0x1f')]==0x6&&_0x9a62c9[_0xd7d6('0x17')]!=_0xd7d6('0x23')){utils[_0xd7d6('0x9')](util[_0xd7d6('0xa')](_0xd7d6('0x24'),_0x9a62c9[_0xd7d6('0x8')],_0x9a62c9[_0xd7d6('0x22')],_0x9a62c9[_0xd7d6('0x17')],_0x9a62c9[_0xd7d6('0xc')]));channels[_0x9a62c9['linkedid']][_0xd7d6('0x10')]=_0x9a62c9[_0xd7d6('0x10')];channels[_0x9a62c9[_0xd7d6('0x22')]][_0xd7d6('0x25')]=_0x9a62c9[_0xd7d6('0xc')];if(_[_0xd7d6('0x1e')](channels[_0x9a62c9[_0xd7d6('0x22')]][_0xd7d6('0x26')])){channels[_0x9a62c9[_0xd7d6('0x22')]][_0xd7d6('0x26')]=utils[_0xd7d6('0x19')]();}channels[_0x9a62c9['linkedid']][_0xd7d6('0x27')]=dispositions[_['toNumber'](_0x9a62c9[_0xd7d6('0x1f')])]||'ANSWERED';}}catch(_0x57c42a){utils[_0xd7d6('0x1b')](util[_0xd7d6('0xa')](_0xd7d6('0x28'),_0x9a62c9['uniqueid']),_0x57c42a);}};exports[_0xd7d6('0x29')]=function(_0x1d64a4){try{if(!_['isNil'](channels[_0x1d64a4[_0xd7d6('0x8')]])){utils['debug'](util[_0xd7d6('0xa')](_0xd7d6('0x2a'),_0x1d64a4[_0xd7d6('0x8')]),_0x1d64a4);if(_[_0xd7d6('0x1e')](channels[_0x1d64a4[_0xd7d6('0x8')]][_0xd7d6('0x2b')])){channels[_0x1d64a4['uniqueid']][_0xd7d6('0x2b')]=_0x1d64a4[_0xd7d6('0x2c')]+'\x20<'+_0x1d64a4[_0xd7d6('0xf')]+'>';}utils['info'](util[_0xd7d6('0xa')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x1d64a4[_0xd7d6('0x8')],channels[_0x1d64a4[_0xd7d6('0x8')]]['callerid'],_0x1d64a4[_0xd7d6('0x2d')]));channels[_0x1d64a4['uniqueid']][_0xd7d6('0x2e')]=utils['now']();channels[_0x1d64a4[_0xd7d6('0x8')]][_0xd7d6('0x2f')]=utils[_0xd7d6('0x30')](channels[_0x1d64a4['uniqueid']][_0xd7d6('0x2e')],channels[_0x1d64a4[_0xd7d6('0x8')]][_0xd7d6('0x31')]);channels[_0x1d64a4[_0xd7d6('0x8')]][_0xd7d6('0x32')]=channels[_0x1d64a4['uniqueid']]['answertime']?utils[_0xd7d6('0x30')](channels[_0x1d64a4[_0xd7d6('0x8')]][_0xd7d6('0x2e')],channels[_0x1d64a4['uniqueid']][_0xd7d6('0x26')]):0x0;writeDB(channels[_0x1d64a4[_0xd7d6('0x8')]]);}}catch(_0x1ca778){utils[_0xd7d6('0x1b')](util['format']('[%s][calls][hangup]',_0x1d64a4['uniqueid']),_0x1ca778);}};exports['attendedtransfer']=function(_0x1d0efa){try{if(!_[_0xd7d6('0x1e')](channels[_0x1d0efa[_0xd7d6('0x33')]])){utils[_0xd7d6('0x15')](util[_0xd7d6('0xa')]('[%s][calls][attendedtransfer]',_0x1d0efa['origtransfereruniqueid']),_0x1d0efa);if(channels[_0x1d0efa['localtwolinkedid']][_0xd7d6('0xc')]==_0x1d0efa[_0xd7d6('0x34')]){utils[_0xd7d6('0x9')](util[_0xd7d6('0xa')](_0xd7d6('0x35'),_0x1d0efa['origtransfereruniqueid'],_0x1d0efa[_0xd7d6('0x33')],_0x1d0efa[_0xd7d6('0x36')]));channels[_0x1d0efa[_0xd7d6('0x33')]]['destinationchannel']=_0x1d0efa[_0xd7d6('0x36')];channels[_0x1d0efa[_0xd7d6('0x33')]]['userfield']=_0xd7d6('0x37');}else if(channels[_0x1d0efa[_0xd7d6('0x33')]][_0xd7d6('0xc')]=_0x1d0efa['transfertargetchannel']){utils[_0xd7d6('0x9')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x1d0efa['origtransfereruniqueid'],_0x1d0efa[_0xd7d6('0x33')],_0x1d0efa[_0xd7d6('0x38')]));channels[_0x1d0efa[_0xd7d6('0x33')]][_0xd7d6('0x25')]=_0x1d0efa[_0xd7d6('0x38')];channels[_0x1d0efa[_0xd7d6('0x33')]]['userfield']=_0xd7d6('0x37');}}}catch(_0x82bddc){utils[_0xd7d6('0x1b')](util[_0xd7d6('0xa')](_0xd7d6('0x39'),_0x1d0efa[_0xd7d6('0x3a')]),_0x82bddc);}};exports['musiconholdstart']=function(_0x280f78){try{if(!_[_0xd7d6('0x1e')](channels[_0x280f78[_0xd7d6('0x8')]])){utils['debug'](util['format'](_0xd7d6('0x3b'),_0x280f78[_0xd7d6('0x8')]),_0x280f78);channels[_0x280f78[_0xd7d6('0x8')]][_0xd7d6('0x3c')]=utils['now']();utils[_0xd7d6('0x9')](util['format'](_0xd7d6('0x3d'),_0x280f78['uniqueid'],channels[_0x280f78[_0xd7d6('0x8')]][_0xd7d6('0x3c')]));}}catch(_0x556110){utils['error'](util['format'](_0xd7d6('0x3b'),_0x280f78[_0xd7d6('0x8')]),_0x556110);}};exports[_0xd7d6('0x3e')]=function(_0x4bca07){try{if(!_['isNil'](channels[_0x4bca07[_0xd7d6('0x8')]])){utils[_0xd7d6('0x15')](util['format']('[%s][calls][musiconholdstop]',_0x4bca07[_0xd7d6('0x8')]),_0x4bca07);if(!_[_0xd7d6('0x1e')](channels[_0x4bca07[_0xd7d6('0x8')]][_0xd7d6('0x3c')])){channels[_0x4bca07[_0xd7d6('0x8')]][_0xd7d6('0x3f')]+=utils[_0xd7d6('0x30')](utils['now'](),channels[_0x4bca07[_0xd7d6('0x8')]]['musiconholdstartAt']);utils[_0xd7d6('0x9')](util[_0xd7d6('0xa')](_0xd7d6('0x40'),_0x4bca07[_0xd7d6('0x8')],channels[_0x4bca07[_0xd7d6('0x8')]][_0xd7d6('0x3f')]));delete channels[_0x4bca07[_0xd7d6('0x8')]][_0xd7d6('0x3c')];}}}catch(_0x3611d5){utils[_0xd7d6('0x1b')](util[_0xd7d6('0xa')](_0xd7d6('0x41'),_0x4bca07[_0xd7d6('0x8')]),_0x3611d5);}};exports[_0xd7d6('0x42')]=function(_0x387e41){try{if(!_[_0xd7d6('0x1e')](channels[_0x387e41[_0xd7d6('0x8')]])){utils[_0xd7d6('0x15')](util[_0xd7d6('0xa')](_0xd7d6('0x43'),_0x387e41[_0xd7d6('0x8')]),_0x387e41);if(!_[_0xd7d6('0x1e')](_0x387e41['variable'][_0xd7d6('0x44')])){utils['info'](util[_0xd7d6('0xa')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x387e41[_0xd7d6('0x8')],_0x387e41['value']));channels[_0x387e41[_0xd7d6('0x8')]][_0xd7d6('0x45')]=_0x387e41['value'];}if(!_[_0xd7d6('0x1e')](_0x387e41[_0xd7d6('0x46')][_0xd7d6('0x47')])){utils[_0xd7d6('0x9')](util[_0xd7d6('0xa')](_0xd7d6('0x48'),_0x387e41[_0xd7d6('0x8')],_0x387e41[_0xd7d6('0x49')]));channels[_0x387e41[_0xd7d6('0x8')]][_0xd7d6('0x4a')]=_0x387e41[_0xd7d6('0x49')];channels[_0x387e41[_0xd7d6('0x8')]][_0xd7d6('0x2b')]='\x22'+_0x387e41[_0xd7d6('0x49')]+_0xd7d6('0x4b')+_0x387e41[_0xd7d6('0x49')]+'>';}if(!_['isNil'](_0x387e41['variable'][_0xd7d6('0x4c')])||!_[_0xd7d6('0x1e')](_0x387e41[_0xd7d6('0x46')][_0xd7d6('0x4d')])){utils[_0xd7d6('0x9')](util[_0xd7d6('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x387e41[_0xd7d6('0x8')],!_[_0xd7d6('0x1e')](_0x387e41[_0xd7d6('0x46')][_0xd7d6('0x4c')])?_0xd7d6('0x4c'):_0xd7d6('0x4d'),_0x387e41[_0xd7d6('0x49')]));channels[_0x387e41[_0xd7d6('0x8')]][_0xd7d6('0x2b')]=_0x387e41[_0xd7d6('0x49')];}if(!_['isNil'](_0x387e41[_0xd7d6('0x46')][_0xd7d6('0x4e')])||!_[_0xd7d6('0x1e')](_0x387e41[_0xd7d6('0x46')][_0xd7d6('0x4f')])){utils[_0xd7d6('0x9')](util[_0xd7d6('0xa')](_0xd7d6('0x50'),_0x387e41['uniqueid'],!_['isNil'](_0x387e41[_0xd7d6('0x46')][_0xd7d6('0x4e')])?_0xd7d6('0x4e'):_0xd7d6('0x4f'),_0x387e41[_0xd7d6('0x49')]));channels[_0x387e41[_0xd7d6('0x8')]][_0xd7d6('0x51')]='Queue';channels[_0x387e41['uniqueid']][_0xd7d6('0x52')]=_0x387e41[_0xd7d6('0x49')];channels[_0x387e41[_0xd7d6('0x8')]][_0xd7d6('0xd')]=!![];}if(!_[_0xd7d6('0x1e')](_0x387e41[_0xd7d6('0x46')][_0xd7d6('0x53')])){utils[_0xd7d6('0x9')](util['format'](_0xd7d6('0x54'),_0x387e41[_0xd7d6('0x8')],_0x387e41['value']));channels[_0x387e41[_0xd7d6('0x8')]]['ContactId']=_0x387e41[_0xd7d6('0x49')];}if(!_['isNil'](_0x387e41[_0xd7d6('0x46')]['xmd-cdrtype'])){utils[_0xd7d6('0x9')](util[_0xd7d6('0xa')](_0xd7d6('0x55'),_0x387e41[_0xd7d6('0x8')],_0x387e41['value']));channels[_0x387e41[_0xd7d6('0x8')]][_0xd7d6('0x56')]=_0x387e41['value'];}if(!_[_0xd7d6('0x1e')](_0x387e41[_0xd7d6('0x46')][_0xd7d6('0x57')])){utils['info'](util[_0xd7d6('0xa')](_0xd7d6('0x58'),_0x387e41['uniqueid'],_0x387e41[_0xd7d6('0x49')]));channels[_0x387e41[_0xd7d6('0x8')]][_0xd7d6('0x59')]=_0x387e41['value'];}if(!_['isNil'](_0x387e41['variable']['sipcallid'])){utils[_0xd7d6('0x9')](util[_0xd7d6('0xa')](_0xd7d6('0x5a'),_0x387e41['uniqueid'],_0x387e41[_0xd7d6('0x49')]));channels[_0x387e41[_0xd7d6('0x8')]]['sipcallid']=_0x387e41['value'];}}}catch(_0x3ce8d0){utils[_0xd7d6('0x1b')](util[_0xd7d6('0xa')]('[%s][calls][varset]',_0x387e41[_0xd7d6('0x8')]),_0x3ce8d0);}};exports[_0xd7d6('0x5b')]=function(_0x43c171){try{if(!_[_0xd7d6('0x1e')](channels[_0x43c171[_0xd7d6('0x8')]])){utils[_0xd7d6('0x15')](util[_0xd7d6('0xa')](_0xd7d6('0x5c'),_0x43c171['uniqueid']),_0x43c171);utils[_0xd7d6('0x9')](util['format'](_0xd7d6('0x5d'),_0x43c171[_0xd7d6('0x8')],_0x43c171[_0xd7d6('0x5e')],_0x43c171[_0xd7d6('0x5f')]));if(_0x43c171['application'][_0xd7d6('0x60')]()==_0xd7d6('0x61')&&_[_0xd7d6('0x62')](_0x43c171[_0xd7d6('0x5f')][_0xd7d6('0x60')](),_0xd7d6('0x63'))){var _0x53bfb0=_0x43c171[_0xd7d6('0x5f')][_0xd7d6('0x64')]('=');var _0x422b77=_0x53bfb0[0x0][_0xd7d6('0x65')](_0x53bfb0[0x0][_0xd7d6('0x66')]('(')+0x1,_0x53bfb0[0x0][_0xd7d6('0x66')](')'));var _0x323714=_0x53bfb0[0x1];channels[_0x43c171['uniqueid']][_0x422b77]=_0x323714;}if(!_[_0xd7d6('0x67')]([_0xd7d6('0x29'),_0xd7d6('0x68'),_0xd7d6('0x69'),_0xd7d6('0x61'),_0xd7d6('0x6a')],_0x43c171[_0xd7d6('0x5e')]['toLowerCase']())){channels[_0x43c171['uniqueid']][_0xd7d6('0x51')]=_0x43c171['application'];channels[_0x43c171[_0xd7d6('0x8')]][_0xd7d6('0x52')]=_0x43c171[_0xd7d6('0x5f')];}}}catch(_0x560948){utils['error'](util[_0xd7d6('0xa')]('[%s][calls][newexten]',_0x43c171['uniqueid']),_0x560948);}}; \ No newline at end of file +var _0x1c12=['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','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','lodash','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','then','UserId','request','format','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','[%s][calls][hangup]','callerid','calleridname','calleridnum','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication'];(function(_0x10ace1,_0x4ed3fc){var _0x18b2e4=function(_0x4b5b5d){while(--_0x4b5b5d){_0x10ace1['push'](_0x10ace1['shift']());}};_0x18b2e4(++_0x4ed3fc);}(_0x1c12,0x1d1));var _0x21c1=function(_0x492027,_0x2f7a52){_0x492027=_0x492027-0x0;var _0x4b7d6d=_0x1c12[_0x492027];return _0x4b7d6d;};'use strict';var _=require(_0x21c1('0x0'));var util=require(_0x21c1('0x1'));var utils=require(_0x21c1('0x2'));var transfers=require(_0x21c1('0x3'));var dispositions=['NO\x20ANSWER',_0x21c1('0x4'),_0x21c1('0x4'),_0x21c1('0x5'),_0x21c1('0x5'),'NO\x20ANSWER',_0x21c1('0x6'),_0x21c1('0x7'),_0x21c1('0x4'),'FAILED',_0x21c1('0x4')];var channels={};function writeDB(_0x49bf61){var _0xa938ca;if(transfers['blinds'][_0x49bf61[_0x21c1('0x8')]]){_0xa938ca=_0x49bf61[_0x21c1('0x8')];_0x49bf61[_0x21c1('0x8')]=transfers[_0x21c1('0x9')][_0x49bf61['uniqueid']][_0x21c1('0xa')];}utils[_0x21c1('0xb')](util['format'](_0x21c1('0xc'),_0x49bf61['uniqueid'],_0x49bf61['channel'],_0x49bf61[_0x21c1('0xd')],_0x49bf61['membername'],_0x49bf61['interface'],_0x49bf61['calleridnum'],_0x49bf61['connectedlinenum'],_0x49bf61['lastevent']));if(_0x49bf61['accountcode']){utils['getUserByInternal'](_0x49bf61['accountcode'])[_0x21c1('0xe')](function(_0x233f59){if(_0x233f59){_0x49bf61[_0x21c1('0xf')]=_0x233f59['id'];}utils[_0x21c1('0x10')]('CreateVoiceCallReport',_0x49bf61);});}else{utils[_0x21c1('0x10')]('CreateVoiceCallReport',_0x49bf61);}if(channels[_0x49bf61[_0x21c1('0x8')]]){delete channels[_0x49bf61[_0x21c1('0x8')]];}else if(_0xa938ca&&channels[_0xa938ca]){delete transfers[_0x21c1('0x9')][_0xa938ca];delete channels[_0xa938ca];}}exports['newchannel']=function(_0x3dd87e){try{utils['debug'](util[_0x21c1('0x11')]('[%s][calls][newchannel]',_0x3dd87e[_0x21c1('0x8')]),_0x3dd87e);if(_0x3dd87e[_0x21c1('0x8')]==_0x3dd87e['linkedid']&&_0x3dd87e[_0x21c1('0x12')]!=_0x21c1('0x13')){utils[_0x21c1('0xb')](util['format'](_0x21c1('0x14'),_0x3dd87e[_0x21c1('0x8')],_0x3dd87e[_0x21c1('0x15')],_0x3dd87e[_0x21c1('0x16')]));channels[_0x3dd87e[_0x21c1('0x8')]]={'uniqueid':_0x3dd87e[_0x21c1('0x8')],'accountcode':_0x3dd87e[_0x21c1('0x17')],'source':_0x3dd87e['calleridnum'],'destination':_0x3dd87e[_0x21c1('0x16')],'destinationcontext':_0x3dd87e[_0x21c1('0x15')],'channel':_0x3dd87e[_0x21c1('0x12')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x21c1('0x18')};}}catch(_0x42f984){utils[_0x21c1('0x19')](util[_0x21c1('0x11')](_0x21c1('0x1a'),_0x3dd87e[_0x21c1('0x8')]),_0x42f984);}};exports[_0x21c1('0x1b')]=function(_0x4c759c){try{utils[_0x21c1('0x1c')](util[_0x21c1('0x11')](_0x21c1('0x1d'),_0x4c759c[_0x21c1('0x8')]),_0x4c759c);if(!_[_0x21c1('0x1e')](channels[_0x4c759c[_0x21c1('0x8')]])&&_0x4c759c[_0x21c1('0x1f')]==0x6){utils[_0x21c1('0xb')](util['format'](_0x21c1('0x20'),_0x4c759c[_0x21c1('0x8')],_0x4c759c['context'],_0x4c759c[_0x21c1('0x12')]));if(_['isNil'](channels[_0x4c759c[_0x21c1('0x8')]][_0x21c1('0x21')])){channels[_0x4c759c['uniqueid']][_0x21c1('0x21')]=utils[_0x21c1('0x22')]();}}else if(!_[_0x21c1('0x1e')](channels[_0x4c759c[_0x21c1('0x23')]])&&_0x4c759c[_0x21c1('0x1f')]==0x6&&_0x4c759c[_0x21c1('0x15')]!=_0x21c1('0x24')){utils['info'](util[_0x21c1('0x11')](_0x21c1('0x25'),_0x4c759c[_0x21c1('0x8')],_0x4c759c['linkedid'],_0x4c759c[_0x21c1('0x15')],_0x4c759c['channel']));channels[_0x4c759c[_0x21c1('0x23')]]['accountcode']=_0x4c759c['accountcode'];channels[_0x4c759c[_0x21c1('0x23')]][_0x21c1('0x26')]=_0x4c759c['channel'];if(_[_0x21c1('0x1e')](channels[_0x4c759c['linkedid']][_0x21c1('0x27')])){channels[_0x4c759c[_0x21c1('0x23')]]['answertime']=utils['now']();}channels[_0x4c759c[_0x21c1('0x23')]][_0x21c1('0x28')]=dispositions[_['toNumber'](_0x4c759c[_0x21c1('0x1f')])]||'ANSWERED';}}catch(_0x5cf980){utils[_0x21c1('0x19')](util[_0x21c1('0x11')](_0x21c1('0x1d'),_0x4c759c[_0x21c1('0x8')]),_0x5cf980);}};exports['hangup']=function(_0x460e2b){try{if(!_[_0x21c1('0x1e')](channels[_0x460e2b['uniqueid']])){utils[_0x21c1('0x1c')](util[_0x21c1('0x11')](_0x21c1('0x29'),_0x460e2b[_0x21c1('0x8')]),_0x460e2b);if(_[_0x21c1('0x1e')](channels[_0x460e2b[_0x21c1('0x8')]][_0x21c1('0x2a')])){channels[_0x460e2b[_0x21c1('0x8')]][_0x21c1('0x2a')]=_0x460e2b[_0x21c1('0x2b')]+'\x20<'+_0x460e2b[_0x21c1('0x2c')]+'>';}utils[_0x21c1('0xb')](util[_0x21c1('0x11')](_0x21c1('0x2d'),_0x460e2b[_0x21c1('0x8')],channels[_0x460e2b[_0x21c1('0x8')]][_0x21c1('0x2a')],_0x460e2b[_0x21c1('0x2e')]));channels[_0x460e2b[_0x21c1('0x8')]]['endtime']=utils['now']();channels[_0x460e2b['uniqueid']][_0x21c1('0x2f')]=utils[_0x21c1('0x30')](channels[_0x460e2b[_0x21c1('0x8')]][_0x21c1('0x31')],channels[_0x460e2b[_0x21c1('0x8')]]['starttime']);channels[_0x460e2b[_0x21c1('0x8')]][_0x21c1('0x32')]=channels[_0x460e2b[_0x21c1('0x8')]][_0x21c1('0x27')]?utils[_0x21c1('0x30')](channels[_0x460e2b['uniqueid']][_0x21c1('0x31')],channels[_0x460e2b[_0x21c1('0x8')]][_0x21c1('0x27')]):0x0;writeDB(channels[_0x460e2b[_0x21c1('0x8')]]);}}catch(_0x455af2){utils[_0x21c1('0x19')](util[_0x21c1('0x11')]('[%s][calls][hangup]',_0x460e2b[_0x21c1('0x8')]),_0x455af2);}};exports['attendedtransfer']=function(_0x56c544){try{if(!_['isNil'](channels[_0x56c544[_0x21c1('0x33')]])){utils[_0x21c1('0x1c')](util[_0x21c1('0x11')](_0x21c1('0x34'),_0x56c544[_0x21c1('0x35')]),_0x56c544);if(channels[_0x56c544[_0x21c1('0x33')]][_0x21c1('0x12')]==_0x56c544[_0x21c1('0x36')]){utils[_0x21c1('0xb')](util[_0x21c1('0x11')](_0x21c1('0x37'),_0x56c544[_0x21c1('0x35')],_0x56c544[_0x21c1('0x33')],_0x56c544[_0x21c1('0x38')]));channels[_0x56c544['localtwolinkedid']][_0x21c1('0x26')]=_0x56c544[_0x21c1('0x38')];channels[_0x56c544[_0x21c1('0x33')]][_0x21c1('0x39')]=_0x21c1('0x3a');}else if(channels[_0x56c544[_0x21c1('0x33')]][_0x21c1('0x12')]=_0x56c544[_0x21c1('0x3b')]){utils[_0x21c1('0xb')](util[_0x21c1('0x11')](_0x21c1('0x37'),_0x56c544[_0x21c1('0x35')],_0x56c544['localtwolinkedid'],_0x56c544[_0x21c1('0x3c')]));channels[_0x56c544[_0x21c1('0x33')]]['destinationchannel']=_0x56c544[_0x21c1('0x3c')];channels[_0x56c544[_0x21c1('0x33')]][_0x21c1('0x39')]=_0x21c1('0x3a');}}}catch(_0x38377a){utils['error'](util[_0x21c1('0x11')](_0x21c1('0x34'),_0x56c544[_0x21c1('0x35')]),_0x38377a);}};exports[_0x21c1('0x3d')]=function(_0x34c661){try{if(!_[_0x21c1('0x1e')](channels[_0x34c661[_0x21c1('0x8')]])){utils[_0x21c1('0x1c')](util[_0x21c1('0x11')]('[%s][calls][musiconholdstart]',_0x34c661[_0x21c1('0x8')]),_0x34c661);channels[_0x34c661['uniqueid']]['musiconholdstartAt']=utils[_0x21c1('0x22')]();utils[_0x21c1('0xb')](util['format'](_0x21c1('0x3e'),_0x34c661[_0x21c1('0x8')],channels[_0x34c661[_0x21c1('0x8')]][_0x21c1('0x3f')]));}}catch(_0x214776){utils[_0x21c1('0x19')](util[_0x21c1('0x11')](_0x21c1('0x40'),_0x34c661[_0x21c1('0x8')]),_0x214776);}};exports[_0x21c1('0x41')]=function(_0x4e25a4){try{if(!_[_0x21c1('0x1e')](channels[_0x4e25a4[_0x21c1('0x8')]])){utils['debug'](util['format']('[%s][calls][musiconholdstop]',_0x4e25a4[_0x21c1('0x8')]),_0x4e25a4);if(!_[_0x21c1('0x1e')](channels[_0x4e25a4[_0x21c1('0x8')]][_0x21c1('0x3f')])){channels[_0x4e25a4['uniqueid']][_0x21c1('0x42')]+=utils[_0x21c1('0x30')](utils[_0x21c1('0x22')](),channels[_0x4e25a4[_0x21c1('0x8')]][_0x21c1('0x3f')]);utils[_0x21c1('0xb')](util[_0x21c1('0x11')](_0x21c1('0x43'),_0x4e25a4[_0x21c1('0x8')],channels[_0x4e25a4[_0x21c1('0x8')]]['mohtime']));delete channels[_0x4e25a4[_0x21c1('0x8')]][_0x21c1('0x3f')];}}}catch(_0x5d0611){utils[_0x21c1('0x19')](util[_0x21c1('0x11')](_0x21c1('0x44'),_0x4e25a4[_0x21c1('0x8')]),_0x5d0611);}};exports[_0x21c1('0x45')]=function(_0xa84e5d){try{if(!_[_0x21c1('0x1e')](channels[_0xa84e5d['uniqueid']])){utils[_0x21c1('0x1c')](util[_0x21c1('0x11')](_0x21c1('0x46'),_0xa84e5d['uniqueid']),_0xa84e5d);if(!_[_0x21c1('0x1e')](_0xa84e5d['variable'][_0x21c1('0x47')])){utils[_0x21c1('0xb')](util[_0x21c1('0x11')](_0x21c1('0x48'),_0xa84e5d[_0x21c1('0x8')],_0xa84e5d[_0x21c1('0x49')]));channels[_0xa84e5d[_0x21c1('0x8')]][_0x21c1('0x4a')]=_0xa84e5d[_0x21c1('0x49')];}if(!_[_0x21c1('0x1e')](_0xa84e5d[_0x21c1('0x4b')][_0x21c1('0x4c')])){utils[_0x21c1('0xb')](util['format'](_0x21c1('0x4d'),_0xa84e5d[_0x21c1('0x8')],_0xa84e5d['value']));channels[_0xa84e5d[_0x21c1('0x8')]][_0x21c1('0x4e')]=_0xa84e5d['value'];channels[_0xa84e5d[_0x21c1('0x8')]][_0x21c1('0x2a')]='\x22'+_0xa84e5d[_0x21c1('0x49')]+'\x22\x20<'+_0xa84e5d[_0x21c1('0x49')]+'>';}if(!_[_0x21c1('0x1e')](_0xa84e5d[_0x21c1('0x4b')][_0x21c1('0x4f')])||!_[_0x21c1('0x1e')](_0xa84e5d[_0x21c1('0x4b')]['xmd-callerid'])){utils[_0x21c1('0xb')](util['format'](_0x21c1('0x50'),_0xa84e5d[_0x21c1('0x8')],!_[_0x21c1('0x1e')](_0xa84e5d[_0x21c1('0x4b')]['xmd-callerid-preview'])?'xmd-callerid-preview':_0x21c1('0x51'),_0xa84e5d[_0x21c1('0x49')]));channels[_0xa84e5d['uniqueid']]['callerid']=_0xa84e5d[_0x21c1('0x49')];}if(!_[_0x21c1('0x1e')](_0xa84e5d[_0x21c1('0x4b')][_0x21c1('0x52')])||!_[_0x21c1('0x1e')](_0xa84e5d[_0x21c1('0x4b')]['xmcs-queue'])){utils[_0x21c1('0xb')](util[_0x21c1('0x11')](_0x21c1('0x50'),_0xa84e5d[_0x21c1('0x8')],!_[_0x21c1('0x1e')](_0xa84e5d[_0x21c1('0x4b')][_0x21c1('0x52')])?'xmd-queue':_0x21c1('0x53'),_0xa84e5d['value']));channels[_0xa84e5d[_0x21c1('0x8')]][_0x21c1('0x54')]=_0x21c1('0x55');channels[_0xa84e5d[_0x21c1('0x8')]][_0x21c1('0x56')]=_0xa84e5d[_0x21c1('0x49')];channels[_0xa84e5d['uniqueid']][_0x21c1('0xd')]=!![];}if(!_['isNil'](_0xa84e5d[_0x21c1('0x4b')][_0x21c1('0x57')])){utils['info'](util[_0x21c1('0x11')](_0x21c1('0x58'),_0xa84e5d[_0x21c1('0x8')],_0xa84e5d['value']));channels[_0xa84e5d[_0x21c1('0x8')]][_0x21c1('0x59')]=_0xa84e5d[_0x21c1('0x49')];}if(!_[_0x21c1('0x1e')](_0xa84e5d[_0x21c1('0x4b')][_0x21c1('0x5a')])){utils[_0x21c1('0xb')](util[_0x21c1('0x11')](_0x21c1('0x5b'),_0xa84e5d[_0x21c1('0x8')],_0xa84e5d[_0x21c1('0x49')]));channels[_0xa84e5d['uniqueid']][_0x21c1('0x5c')]=_0xa84e5d['value'];}if(!_[_0x21c1('0x1e')](_0xa84e5d[_0x21c1('0x4b')][_0x21c1('0x5d')])){utils[_0x21c1('0xb')](util[_0x21c1('0x11')](_0x21c1('0x5e'),_0xa84e5d[_0x21c1('0x8')],_0xa84e5d['value']));channels[_0xa84e5d[_0x21c1('0x8')]][_0x21c1('0x5f')]=_0xa84e5d[_0x21c1('0x49')];}if(!_[_0x21c1('0x1e')](_0xa84e5d['variable'][_0x21c1('0x60')])){utils['info'](util[_0x21c1('0x11')](_0x21c1('0x61'),_0xa84e5d[_0x21c1('0x8')],_0xa84e5d[_0x21c1('0x49')]));channels[_0xa84e5d[_0x21c1('0x8')]][_0x21c1('0x60')]=_0xa84e5d[_0x21c1('0x49')];}}}catch(_0x4ee723){utils[_0x21c1('0x19')](util['format']('[%s][calls][varset]',_0xa84e5d[_0x21c1('0x8')]),_0x4ee723);}};exports[_0x21c1('0x62')]=function(_0x5c64ff){try{if(!_[_0x21c1('0x1e')](channels[_0x5c64ff['uniqueid']])){utils[_0x21c1('0x1c')](util['format']('[%s][calls][newexten]',_0x5c64ff['uniqueid']),_0x5c64ff);utils[_0x21c1('0xb')](util[_0x21c1('0x11')](_0x21c1('0x63'),_0x5c64ff[_0x21c1('0x8')],_0x5c64ff[_0x21c1('0x64')],_0x5c64ff[_0x21c1('0x65')]));if(_0x5c64ff[_0x21c1('0x64')][_0x21c1('0x66')]()==_0x21c1('0x67')&&_[_0x21c1('0x68')](_0x5c64ff[_0x21c1('0x65')][_0x21c1('0x66')](),_0x21c1('0x69'))){var _0x468287=_0x5c64ff['appdata'][_0x21c1('0x6a')]('=');var _0x203c66=_0x468287[0x0][_0x21c1('0x6b')](_0x468287[0x0][_0x21c1('0x6c')]('(')+0x1,_0x468287[0x0][_0x21c1('0x6c')](')'));var _0xcaf7b6=_0x468287[0x1];channels[_0x5c64ff['uniqueid']][_0x203c66]=_0xcaf7b6;}if(!_[_0x21c1('0x6d')](['hangup','noop','execif',_0x21c1('0x67'),'gotoif'],_0x5c64ff[_0x21c1('0x64')]['toLowerCase']())){channels[_0x5c64ff[_0x21c1('0x8')]][_0x21c1('0x54')]=_0x5c64ff[_0x21c1('0x64')];channels[_0x5c64ff[_0x21c1('0x8')]]['lastdata']=_0x5c64ff[_0x21c1('0x65')];}}}catch(_0x504e26){utils[_0x21c1('0x19')](util['format']('[%s][calls][newexten]',_0x5c64ff['uniqueid']),_0x504e26);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index ee5101f..1df65a9 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 _0x1f75=['[core]\x20error','close','managerevent','./utils','connect','info','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x3737d0,_0x1626a7){var _0x41f7fb=function(_0x275aa7){while(--_0x275aa7){_0x3737d0['push'](_0x3737d0['shift']());}};_0x41f7fb(++_0x1626a7);}(_0x1f75,0x12c));var _0x51f7=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x1f75[_0x288f5e];return _0x476cc9;};'use strict';var utils=require(_0x51f7('0x0'));exports[_0x51f7('0x1')]=function(){utils[_0x51f7('0x2')]('[core]\x20connected');};exports[_0x51f7('0x3')]=function(){utils[_0x51f7('0x2')](_0x51f7('0x4'));};exports[_0x51f7('0x5')]=function(){utils[_0x51f7('0x2')](_0x51f7('0x6'));};exports[_0x51f7('0x7')]=function(_0x732a10){utils[_0x51f7('0x7')](_0x51f7('0x8'),_0x732a10);};exports[_0x51f7('0x9')]=function(){utils[_0x51f7('0x2')]('[core]\x20close');};exports[_0x51f7('0xa')]=function(_0x7a9c0c){}; \ No newline at end of file +var _0xcfd8=['[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','connect','info'];(function(_0x2f1647,_0x3a4e6f){var _0x555018=function(_0x5778bd){while(--_0x5778bd){_0x2f1647['push'](_0x2f1647['shift']());}};_0x555018(++_0x3a4e6f);}(_0xcfd8,0x103));var _0x8cfd=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0xcfd8[_0x1e9424];return _0x1bd96c;};'use strict';var utils=require('./utils');exports[_0x8cfd('0x0')]=function(){utils[_0x8cfd('0x1')](_0x8cfd('0x2'));};exports[_0x8cfd('0x3')]=function(){utils[_0x8cfd('0x1')](_0x8cfd('0x4'));};exports[_0x8cfd('0x5')]=function(){utils[_0x8cfd('0x1')](_0x8cfd('0x6'));};exports['error']=function(_0x4a0b2b){utils[_0x8cfd('0x7')](_0x8cfd('0x8'),_0x4a0b2b);};exports['close']=function(){utils[_0x8cfd('0x1')]('[core]\x20close');};exports['managerevent']=function(_0x28a2f2){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index ea7e3ab..f2f65ca 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 _0x675c=['toLowerCase','set','startsWith','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','isNil','[%s][dials][dialbegin]','assign','now','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','dialstatus','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','duration','diffTime','endtime','holdtime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','application','appdata'];(function(_0x459c94,_0xbca048){var _0x26c0fb=function(_0xe8657d){while(--_0xe8657d){_0x459c94['push'](_0x459c94['shift']());}};_0x26c0fb(++_0xbca048);}(_0x675c,0x13a));var _0xc675=function(_0x4eb0ee,_0x3dd9f4){_0x4eb0ee=_0x4eb0ee-0x0;var _0x1d575f=_0x675c[_0x4eb0ee];return _0x1d575f;};'use strict';var _=require('lodash');var util=require(_0xc675('0x0'));var utils=require(_0xc675('0x1'));var dials={};function writeDB(_0x290a42){utils[_0xc675('0x2')](util[_0xc675('0x3')](_0xc675('0x4'),_0x290a42[_0xc675('0x5')],_0x290a42[_0xc675('0x6')],_0x290a42[_0xc675('0x7')],_0x290a42['calleridnum'],_0x290a42[_0xc675('0x8')],_0x290a42['dialstatus']));utils[_0xc675('0x9')](_0xc675('0xa'),_0x290a42);delete dials[_0x290a42[_0xc675('0x5')]];}exports['newexten']=function(_0x137325){try{utils[_0xc675('0xb')](util[_0xc675('0x3')](_0xc675('0xc'),_0x137325['uniqueid']),_0x137325);utils[_0xc675('0x2')](util[_0xc675('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x137325[_0xc675('0x5')],_0x137325[_0xc675('0xd')],_0x137325[_0xc675('0xe')]));if(_0x137325[_0xc675('0xd')][_0xc675('0xf')]()==_0xc675('0x10')&&_[_0xc675('0x11')](_0x137325[_0xc675('0xe')][_0xc675('0xf')](),'cdr(routeid)')){var _0x195b98=_0x137325[_0xc675('0xe')]['split']('=');dials[_0x137325[_0xc675('0x5')]]={'routeId':_0x195b98[0x1]};}}catch(_0x84639d){utils[_0xc675('0x12')](util[_0xc675('0x3')](_0xc675('0xc'),_0x137325[_0xc675('0x5')]),_0x84639d);}};exports[_0xc675('0x13')]=function(_0x329f12){try{utils['debug'](util[_0xc675('0x3')](_0xc675('0x14'),_0x329f12[_0xc675('0x5')]),_0x329f12);if(!_['isNil'](_0x329f12[_0xc675('0x15')][_0xc675('0x16')])){utils[_0xc675('0x2')](util['format'](_0xc675('0x17'),_0x329f12[_0xc675('0x5')],_0x329f12[_0xc675('0x18')]));dials[_0x329f12['uniqueid']]={'routeId':_0x329f12['value']};}}catch(_0x5ef562){utils[_0xc675('0x12')](util[_0xc675('0x3')](_0xc675('0x14'),_0x329f12['uniqueid']),_0x5ef562);}};exports['dialbegin']=function(_0x52cfd2){try{if(!_[_0xc675('0x19')](dials[_0x52cfd2[_0xc675('0x5')]])){utils[_0xc675('0xb')](util[_0xc675('0x3')](_0xc675('0x1a'),_0x52cfd2['uniqueid']),_0x52cfd2);dials[_0x52cfd2['uniqueid']]=_[_0xc675('0x1b')](dials[_0x52cfd2[_0xc675('0x5')]],_0x52cfd2);dials[_0x52cfd2[_0xc675('0x5')]]['starttime']=utils[_0xc675('0x1c')]();dials[_0x52cfd2['uniqueid']]['lastevent']='called';utils[_0xc675('0x2')](util['format'](_0xc675('0x1d'),_0x52cfd2[_0xc675('0x5')],dials[_0x52cfd2[_0xc675('0x5')]][_0xc675('0x1e')]));}}catch(_0x349c6f){utils[_0xc675('0x12')](util[_0xc675('0x3')](_0xc675('0x1a'),_0x52cfd2[_0xc675('0x5')]),_0x349c6f);}};exports[_0xc675('0x1f')]=function(_0x5dabf5){try{if(!_[_0xc675('0x19')](dials[_0x5dabf5['uniqueid']])){utils['debug'](util[_0xc675('0x3')]('[%s][dials][dialend]',_0x5dabf5['uniqueid']),_0x5dabf5);dials[_0x5dabf5[_0xc675('0x5')]][_0xc675('0x20')]=_0x5dabf5['dialstatus'];if(_0x5dabf5[_0xc675('0x20')]==_0xc675('0x21')){dials[_0x5dabf5['uniqueid']]=_[_0xc675('0x1b')](dials[_0x5dabf5[_0xc675('0x5')]],_0x5dabf5);dials[_0x5dabf5[_0xc675('0x5')]]['answertime']=utils[_0xc675('0x1c')]();dials[_0x5dabf5[_0xc675('0x5')]]['lastevent']=_0xc675('0x22');utils[_0xc675('0x2')](util[_0xc675('0x3')](_0xc675('0x23'),_0x5dabf5[_0xc675('0x5')],_0x5dabf5[_0xc675('0x20')],dials[_0x5dabf5[_0xc675('0x5')]][_0xc675('0x24')]));}else{utils[_0xc675('0x2')](util[_0xc675('0x3')](_0xc675('0x25'),_0x5dabf5[_0xc675('0x5')],_0x5dabf5['dialstatus']));}}}catch(_0x26480c){utils[_0xc675('0x12')](util[_0xc675('0x3')](_0xc675('0x26'),_0x5dabf5[_0xc675('0x5')]),_0x26480c);}};exports['hangup']=function(_0x47c3b6){try{if(!_[_0xc675('0x19')](dials[_0x47c3b6['uniqueid']])){utils['debug'](util[_0xc675('0x3')]('[%s][dials][hangup]',_0x47c3b6['uniqueid']),_0x47c3b6);utils['info'](util['format'](_0xc675('0x27'),_0x47c3b6['uniqueid'],_0x47c3b6[_0xc675('0x28')],_0x47c3b6[_0xc675('0x29')],_0x47c3b6['cause-txt']));dials[_0x47c3b6['uniqueid']]=_[_0xc675('0x1b')](dials[_0x47c3b6['uniqueid']],{'endtime':utils[_0xc675('0x1c')](),'lastevent':'complete'});dials[_0x47c3b6[_0xc675('0x5')]][_0xc675('0x2a')]=utils[_0xc675('0x2b')](dials[_0x47c3b6[_0xc675('0x5')]][_0xc675('0x2c')],dials[_0x47c3b6[_0xc675('0x5')]][_0xc675('0x1e')]);dials[_0x47c3b6[_0xc675('0x5')]][_0xc675('0x2d')]=utils[_0xc675('0x2b')](dials[_0x47c3b6['uniqueid']]['answertime']||dials[_0x47c3b6[_0xc675('0x5')]][_0xc675('0x2c')],dials[_0x47c3b6[_0xc675('0x5')]][_0xc675('0x1e')]);dials[_0x47c3b6[_0xc675('0x5')]][_0xc675('0x2e')]=dials[_0x47c3b6[_0xc675('0x5')]][_0xc675('0x24')]?utils['diffTime'](dials[_0x47c3b6[_0xc675('0x5')]][_0xc675('0x2c')],dials[_0x47c3b6[_0xc675('0x5')]][_0xc675('0x24')]):0x0;writeDB(dials[_0x47c3b6[_0xc675('0x5')]]);}}catch(_0x184bf3){utils[_0xc675('0x12')](util[_0xc675('0x3')]('[%s][dials][hangup]',_0x47c3b6['uniqueid']),_0x184bf3);}}; \ No newline at end of file +var _0x5bec=['[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','complete','duration','diffTime','endtime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','error','[%s][dials][newexten]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','assign','starttime','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialstatus','ANSWER','answertime','now','connect'];(function(_0x5bf19e,_0x18e9ad){var _0x8304bb=function(_0x23071b){while(--_0x23071b){_0x5bf19e['push'](_0x5bf19e['shift']());}};_0x8304bb(++_0x18e9ad);}(_0x5bec,0x129));var _0xc5be=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x5bec[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0xc5be('0x0'));var util=require(_0xc5be('0x1'));var utils=require(_0xc5be('0x2'));var dials={};function writeDB(_0x4d2ce5){utils[_0xc5be('0x3')](util[_0xc5be('0x4')](_0xc5be('0x5'),_0x4d2ce5[_0xc5be('0x6')],_0x4d2ce5[_0xc5be('0x7')],_0x4d2ce5[_0xc5be('0x8')],_0x4d2ce5[_0xc5be('0x9')],_0x4d2ce5[_0xc5be('0xa')],_0x4d2ce5['dialstatus']));utils[_0xc5be('0xb')](_0xc5be('0xc'),_0x4d2ce5);delete dials[_0x4d2ce5[_0xc5be('0x6')]];}exports[_0xc5be('0xd')]=function(_0x290641){try{utils[_0xc5be('0xe')](util[_0xc5be('0x4')]('[%s][dials][newexten]',_0x290641[_0xc5be('0x6')]),_0x290641);utils[_0xc5be('0x3')](util[_0xc5be('0x4')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x290641[_0xc5be('0x6')],_0x290641[_0xc5be('0xf')],_0x290641[_0xc5be('0x10')]));if(_0x290641[_0xc5be('0xf')][_0xc5be('0x11')]()=='set'&&_[_0xc5be('0x12')](_0x290641[_0xc5be('0x10')][_0xc5be('0x11')](),_0xc5be('0x13'))){var _0x2e2212=_0x290641['appdata'][_0xc5be('0x14')]('=');dials[_0x290641[_0xc5be('0x6')]]={'routeId':_0x2e2212[0x1]};}}catch(_0x504c1e){utils[_0xc5be('0x15')](util[_0xc5be('0x4')](_0xc5be('0x16'),_0x290641['uniqueid']),_0x504c1e);}};exports['varset']=function(_0xe5ff01){try{utils['debug'](util[_0xc5be('0x4')]('[%s][dials][varset]',_0xe5ff01[_0xc5be('0x6')]),_0xe5ff01);if(!_[_0xc5be('0x17')](_0xe5ff01[_0xc5be('0x18')][_0xc5be('0x19')])){utils['info'](util['format'](_0xc5be('0x1a'),_0xe5ff01[_0xc5be('0x6')],_0xe5ff01[_0xc5be('0x1b')]));dials[_0xe5ff01[_0xc5be('0x6')]]={'routeId':_0xe5ff01[_0xc5be('0x1b')]};}}catch(_0x32b09c){utils[_0xc5be('0x15')](util[_0xc5be('0x4')](_0xc5be('0x1c'),_0xe5ff01[_0xc5be('0x6')]),_0x32b09c);}};exports[_0xc5be('0x1d')]=function(_0x4339b6){try{if(!_[_0xc5be('0x17')](dials[_0x4339b6[_0xc5be('0x6')]])){utils['debug'](util[_0xc5be('0x4')]('[%s][dials][dialbegin]',_0x4339b6[_0xc5be('0x6')]),_0x4339b6);dials[_0x4339b6[_0xc5be('0x6')]]=_[_0xc5be('0x1e')](dials[_0x4339b6[_0xc5be('0x6')]],_0x4339b6);dials[_0x4339b6[_0xc5be('0x6')]][_0xc5be('0x1f')]=utils['now']();dials[_0x4339b6[_0xc5be('0x6')]]['lastevent']=_0xc5be('0x20');utils[_0xc5be('0x3')](util[_0xc5be('0x4')](_0xc5be('0x21'),_0x4339b6[_0xc5be('0x6')],dials[_0x4339b6[_0xc5be('0x6')]][_0xc5be('0x1f')]));}}catch(_0x55be26){utils[_0xc5be('0x15')](util[_0xc5be('0x4')]('[%s][dials][dialbegin]',_0x4339b6[_0xc5be('0x6')]),_0x55be26);}};exports['dialend']=function(_0xeb45cc){try{if(!_['isNil'](dials[_0xeb45cc['uniqueid']])){utils[_0xc5be('0xe')](util[_0xc5be('0x4')]('[%s][dials][dialend]',_0xeb45cc['uniqueid']),_0xeb45cc);dials[_0xeb45cc['uniqueid']][_0xc5be('0x22')]=_0xeb45cc[_0xc5be('0x22')];if(_0xeb45cc[_0xc5be('0x22')]==_0xc5be('0x23')){dials[_0xeb45cc[_0xc5be('0x6')]]=_[_0xc5be('0x1e')](dials[_0xeb45cc[_0xc5be('0x6')]],_0xeb45cc);dials[_0xeb45cc[_0xc5be('0x6')]][_0xc5be('0x24')]=utils[_0xc5be('0x25')]();dials[_0xeb45cc[_0xc5be('0x6')]]['lastevent']=_0xc5be('0x26');utils['info'](util[_0xc5be('0x4')](_0xc5be('0x27'),_0xeb45cc['uniqueid'],_0xeb45cc[_0xc5be('0x22')],dials[_0xeb45cc[_0xc5be('0x6')]]['answertime']));}else{utils[_0xc5be('0x3')](util[_0xc5be('0x4')](_0xc5be('0x28'),_0xeb45cc[_0xc5be('0x6')],_0xeb45cc[_0xc5be('0x22')]));}}}catch(_0x2ba478){utils[_0xc5be('0x15')](util[_0xc5be('0x4')]('[%s][dials][dialend]',_0xeb45cc[_0xc5be('0x6')]),_0x2ba478);}};exports[_0xc5be('0x29')]=function(_0x5aba38){try{if(!_[_0xc5be('0x17')](dials[_0x5aba38[_0xc5be('0x6')]])){utils[_0xc5be('0xe')](util[_0xc5be('0x4')](_0xc5be('0x2a'),_0x5aba38[_0xc5be('0x6')]),_0x5aba38);utils[_0xc5be('0x3')](util[_0xc5be('0x4')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x5aba38[_0xc5be('0x6')],_0x5aba38[_0xc5be('0x9')],_0x5aba38[_0xc5be('0x2b')],_0x5aba38['cause-txt']));dials[_0x5aba38[_0xc5be('0x6')]]=_[_0xc5be('0x1e')](dials[_0x5aba38[_0xc5be('0x6')]],{'endtime':utils[_0xc5be('0x25')](),'lastevent':_0xc5be('0x2c')});dials[_0x5aba38['uniqueid']][_0xc5be('0x2d')]=utils[_0xc5be('0x2e')](dials[_0x5aba38[_0xc5be('0x6')]][_0xc5be('0x2f')],dials[_0x5aba38[_0xc5be('0x6')]][_0xc5be('0x1f')]);dials[_0x5aba38['uniqueid']]['holdtime']=utils[_0xc5be('0x2e')](dials[_0x5aba38[_0xc5be('0x6')]][_0xc5be('0x24')]||dials[_0x5aba38[_0xc5be('0x6')]][_0xc5be('0x2f')],dials[_0x5aba38['uniqueid']][_0xc5be('0x1f')]);dials[_0x5aba38[_0xc5be('0x6')]]['billableseconds']=dials[_0x5aba38[_0xc5be('0x6')]]['answertime']?utils[_0xc5be('0x2e')](dials[_0x5aba38[_0xc5be('0x6')]][_0xc5be('0x2f')],dials[_0x5aba38['uniqueid']]['answertime']):0x0;writeDB(dials[_0x5aba38['uniqueid']]);}}catch(_0x391b70){utils[_0xc5be('0x15')](util['format']('[%s][dials][hangup]',_0x5aba38[_0xc5be('0x6')]),_0x391b70);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 4c3db69..4665c4e 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 _0xab67=['./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','asterisk','username','password','keepConnected','xdr','disabled'];(function(_0x365ac6,_0x10562c){var _0x4607e5=function(_0x38eb9e){while(--_0x38eb9e){_0x365ac6['push'](_0x365ac6['shift']());}};_0x4607e5(++_0x10562c);}(_0xab67,0x133));var _0x7ab6=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xab67[_0x257642];return _0x3d813b;};var AsteriskManager=require(_0x7ab6('0x0'));var config=require(_0x7ab6('0x1'));var utils=require('./utils');var util=require('util');var ami=new AsteriskManager(config[_0x7ab6('0x2')]['port'],config[_0x7ab6('0x2')]['ip'],config['asterisk'][_0x7ab6('0x3')],config[_0x7ab6('0x2')][_0x7ab6('0x4')],!![]);ami[_0x7ab6('0x5')]();if(config[_0x7ab6('0x6')]&&config[_0x7ab6('0x6')][_0x7ab6('0x7')]){utils['info']('XDR\x20DISABLED');}else{var agents=require(_0x7ab6('0x8'));var calls=require(_0x7ab6('0x9'));var queues=require(_0x7ab6('0xa'));var recordings=require(_0x7ab6('0xb'));var members=require(_0x7ab6('0xc'));var dials=require(_0x7ab6('0xd'));var transfers=require(_0x7ab6('0xe'));var core=require(_0x7ab6('0xf'));ami['on'](_0x7ab6('0x10'),core[_0x7ab6('0x10')]);ami['on'](_0x7ab6('0x11'),core[_0x7ab6('0x11')]);ami['on'](_0x7ab6('0x12'),core['fullybooted']);ami['on']('error',core[_0x7ab6('0x13')]);ami['on'](_0x7ab6('0x14'),core[_0x7ab6('0x14')]);ami['on']('managerevent',core['managerevent']);ami['on'](_0x7ab6('0x15'),function(_0x2b9516){try{utils[_0x7ab6('0x16')](util['format'](_0x7ab6('0x17'),_0x2b9516[_0x7ab6('0x18')]),_0x2b9516);members[_0x7ab6('0x15')](_0x2b9516);}catch(_0x9779){utils[_0x7ab6('0x13')](util[_0x7ab6('0x19')](_0x7ab6('0x17'),_0x2b9516[_0x7ab6('0x18')]),_0x9779);}});ami['on'](_0x7ab6('0x1a'),function(_0x56b795){try{utils[_0x7ab6('0x16')](util[_0x7ab6('0x19')](_0x7ab6('0x1b'),_0x56b795[_0x7ab6('0x1c')]),_0x56b795);agents[_0x7ab6('0x1a')](_0x56b795);}catch(_0x72496f){utils[_0x7ab6('0x13')](util[_0x7ab6('0x19')](_0x7ab6('0x1b'),_0x56b795['uniqueid']),_0x72496f);}});ami['on']('agentringnoanswer',function(_0x4a1c6c){try{utils['debug'](util[_0x7ab6('0x19')](_0x7ab6('0x1d'),_0x4a1c6c['uniqueid']),_0x4a1c6c);agents[_0x7ab6('0x1e')](_0x4a1c6c);}catch(_0x4361db){utils['error'](util[_0x7ab6('0x19')]('[%s][index][agentringnoanswer]',_0x4a1c6c[_0x7ab6('0x1c')]),_0x4361db);}});ami['on']('agentconnect',function(_0x443b61){try{utils['debug'](util[_0x7ab6('0x19')]('[%s][index][agentconnect]',_0x443b61['uniqueid']),_0x443b61);agents[_0x7ab6('0x1f')](_0x443b61);queues['agentconnect'](_0x443b61);}catch(_0x5f3549){utils[_0x7ab6('0x13')](util[_0x7ab6('0x19')](_0x7ab6('0x20'),_0x443b61[_0x7ab6('0x1c')]),_0x5f3549);}});ami['on'](_0x7ab6('0x21'),function(_0xfcd6e6){try{utils['debug'](util[_0x7ab6('0x19')]('[%s][index][agentcomplete]',_0xfcd6e6[_0x7ab6('0x1c')]),_0xfcd6e6);agents[_0x7ab6('0x21')](_0xfcd6e6);queues[_0x7ab6('0x21')](_0xfcd6e6);members['agentcomplete'](_0xfcd6e6);}catch(_0x96d305){utils[_0x7ab6('0x13')](util[_0x7ab6('0x19')]('[%s][index][agentcomplete]',_0xfcd6e6[_0x7ab6('0x1c')]),_0x96d305);}});ami['on'](_0x7ab6('0x22'),function(_0x30c86a){try{utils['debug'](util[_0x7ab6('0x19')](_0x7ab6('0x23'),_0x30c86a[_0x7ab6('0x1c')]),_0x30c86a);agents[_0x7ab6('0x22')](_0x30c86a);queues['queuecallerabandon'](_0x30c86a);}catch(_0x2d0b07){utils['error'](util[_0x7ab6('0x19')](_0x7ab6('0x23'),_0x30c86a[_0x7ab6('0x1c')]),_0x2d0b07);}});ami['on']('queuecallerjoin',function(_0x32e169){try{utils[_0x7ab6('0x16')](util['format']('[%s][index][queuecallerjoin]',_0x32e169['uniqueid']),_0x32e169);queues[_0x7ab6('0x24')](_0x32e169);recordings[_0x7ab6('0x24')](_0x32e169);}catch(_0x529c29){utils[_0x7ab6('0x13')](util['format']('[%s][index][queuecallerjoin]',_0x32e169[_0x7ab6('0x1c')]),_0x529c29);}});ami['on'](_0x7ab6('0x25'),function(_0x18f588){try{utils['debug'](util[_0x7ab6('0x19')](_0x7ab6('0x26'),_0x18f588[_0x7ab6('0x1c')]),_0x18f588);queues[_0x7ab6('0x25')](_0x18f588);}catch(_0x5ce2bc){utils['error'](util[_0x7ab6('0x19')]('[%s][index][queuecallerleave]',_0x18f588[_0x7ab6('0x1c')]),_0x5ce2bc);}});ami['on']('musiconholdstart',function(_0x2ee60e){try{utils['debug'](util[_0x7ab6('0x19')](_0x7ab6('0x27'),_0x2ee60e[_0x7ab6('0x1c')]),_0x2ee60e);queues['musiconholdstart'](_0x2ee60e);calls['musiconholdstart'](_0x2ee60e);}catch(_0xb2b813){utils[_0x7ab6('0x13')](util['format']('[%s][index][musiconholdstart]',_0x2ee60e[_0x7ab6('0x1c')]),_0xb2b813);}});ami['on'](_0x7ab6('0x28'),function(_0x3453ab){try{utils[_0x7ab6('0x16')](util['format'](_0x7ab6('0x29'),_0x3453ab[_0x7ab6('0x1c')]),_0x3453ab);queues[_0x7ab6('0x28')](_0x3453ab);calls[_0x7ab6('0x28')](_0x3453ab);}catch(_0x398757){utils[_0x7ab6('0x13')](util[_0x7ab6('0x19')](_0x7ab6('0x29'),_0x3453ab['uniqueid']),_0x398757);}});ami['on']('newstate',function(_0x2664a3){try{utils[_0x7ab6('0x16')](util[_0x7ab6('0x19')]('[%s][index][newstate]',_0x2664a3[_0x7ab6('0x1c')]),_0x2664a3);calls[_0x7ab6('0x2a')](_0x2664a3);recordings['newstate'](_0x2664a3);}catch(_0x52827d){utils['error'](util[_0x7ab6('0x19')](_0x7ab6('0x2b'),_0x2664a3[_0x7ab6('0x1c')]),_0x52827d);}});ami['on'](_0x7ab6('0x2c'),function(_0x4523e6){try{utils[_0x7ab6('0x16')](util['format'](_0x7ab6('0x2d'),_0x4523e6[_0x7ab6('0x1c')]),_0x4523e6);calls['hangup'](_0x4523e6);recordings['hangup'](_0x4523e6);dials[_0x7ab6('0x2c')](_0x4523e6);agents[_0x7ab6('0x2c')](_0x4523e6);queues['hangup'](_0x4523e6);}catch(_0x4ee24f){utils[_0x7ab6('0x13')](util[_0x7ab6('0x19')]('[%s][index][hangup]',_0x4523e6[_0x7ab6('0x1c')]),_0x4ee24f);}});ami['on'](_0x7ab6('0x2e'),function(_0x3acc1a){try{utils['debug'](util[_0x7ab6('0x19')](_0x7ab6('0x2f'),_0x3acc1a[_0x7ab6('0x1c')]),_0x3acc1a);members['cdr'](_0x3acc1a);}catch(_0x184df1){utils[_0x7ab6('0x13')](util[_0x7ab6('0x19')]('[%s][index][cdr]',_0x3acc1a['uniqueid']),_0x184df1);}});ami['on'](_0x7ab6('0x30'),function(_0x1a9cc2){try{utils['debug'](util['format'](_0x7ab6('0x31'),_0x1a9cc2[_0x7ab6('0x1c')]),_0x1a9cc2);queues[_0x7ab6('0x30')](_0x1a9cc2);agents[_0x7ab6('0x30')](_0x1a9cc2);transfers[_0x7ab6('0x30')](_0x1a9cc2);}catch(_0x3b058a){utils['error'](util[_0x7ab6('0x19')](_0x7ab6('0x31'),_0x1a9cc2[_0x7ab6('0x1c')]),_0x3b058a);}});ami['on'](_0x7ab6('0x32'),function(_0x25245c){try{utils[_0x7ab6('0x16')](util[_0x7ab6('0x19')]('[%s][index][attendedtransfer]',_0x25245c[_0x7ab6('0x33')]),_0x25245c);queues[_0x7ab6('0x32')](_0x25245c);transfers[_0x7ab6('0x32')](_0x25245c);agents['attendedtransfer'](_0x25245c);calls[_0x7ab6('0x32')](_0x25245c);}catch(_0x3c9b93){utils[_0x7ab6('0x13')](util[_0x7ab6('0x19')](_0x7ab6('0x34'),_0x25245c[_0x7ab6('0x33')]),_0x3c9b93);}});ami['on']('varset',function(_0xc9da49){try{utils['debug'](util[_0x7ab6('0x19')](_0x7ab6('0x35'),_0xc9da49[_0x7ab6('0x1c')]),_0xc9da49);queues[_0x7ab6('0x36')](_0xc9da49);recordings[_0x7ab6('0x36')](_0xc9da49);calls['varset'](_0xc9da49);dials[_0x7ab6('0x36')](_0xc9da49);}catch(_0x9e0d2f){utils['error'](util[_0x7ab6('0x19')]('[%s][index][varset]',_0xc9da49['uniqueid']),_0x9e0d2f);}});ami['on'](_0x7ab6('0x37'),function(_0x205200){try{utils[_0x7ab6('0x16')](util[_0x7ab6('0x19')](_0x7ab6('0x38'),_0x205200[_0x7ab6('0x1c')]),_0x205200);calls[_0x7ab6('0x37')](_0x205200);recordings[_0x7ab6('0x37')](_0x205200);dials[_0x7ab6('0x37')](_0x205200);}catch(_0x1078fa){utils[_0x7ab6('0x13')](util[_0x7ab6('0x19')](_0x7ab6('0x38'),_0x205200[_0x7ab6('0x1c')]),_0x1078fa);}});ami['on'](_0x7ab6('0x39'),function(_0x42e283){try{utils[_0x7ab6('0x16')](util['format'](_0x7ab6('0x3a'),_0x42e283[_0x7ab6('0x1c')]),_0x42e283);calls['newchannel'](_0x42e283);recordings[_0x7ab6('0x39')](_0x42e283);}catch(_0x55d37e){utils[_0x7ab6('0x13')](util[_0x7ab6('0x19')]('[%s][index][newchannel]',_0x42e283[_0x7ab6('0x1c')]),_0x55d37e);}});ami['on'](_0x7ab6('0x3b'),function(_0x259206){try{utils['debug'](util[_0x7ab6('0x19')](_0x7ab6('0x3c'),_0x259206[_0x7ab6('0x1c')]),_0x259206);dials[_0x7ab6('0x3b')](_0x259206);}catch(_0x1d198a){utils[_0x7ab6('0x13')](util[_0x7ab6('0x19')]('[%s]dialbegin',_0x259206[_0x7ab6('0x1c')]),_0x1d198a);}});ami['on'](_0x7ab6('0x3d'),function(_0x1ff10f){try{utils['debug'](util[_0x7ab6('0x19')](_0x7ab6('0x3e'),_0x1ff10f[_0x7ab6('0x1c')]),_0x1ff10f);dials[_0x7ab6('0x3d')](_0x1ff10f);}catch(_0x1c1c29){utils[_0x7ab6('0x13')](util[_0x7ab6('0x19')](_0x7ab6('0x3e'),_0x1ff10f[_0x7ab6('0x1c')]),_0x1c1c29);}});} \ No newline at end of file +var _0xfd09=['keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','device','devicestatechange','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','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','[%s][index][varset]','varset','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','../../config/environment','./utils','asterisk','password'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfd09,0x14b));var _0x9fd0=function(_0x5ce34a,_0x57887e){_0x5ce34a=_0x5ce34a-0x0;var _0x309350=_0xfd09[_0x5ce34a];return _0x309350;};var AsteriskManager=require('asterisk-manager');var config=require(_0x9fd0('0x0'));var utils=require(_0x9fd0('0x1'));var util=require('util');var ami=new AsteriskManager(config[_0x9fd0('0x2')]['port'],config['asterisk']['ip'],config[_0x9fd0('0x2')]['username'],config['asterisk'][_0x9fd0('0x3')],!![]);ami[_0x9fd0('0x4')]();if(config['xdr']&&config[_0x9fd0('0x5')][_0x9fd0('0x6')]){utils[_0x9fd0('0x7')](_0x9fd0('0x8'));}else{var agents=require(_0x9fd0('0x9'));var calls=require(_0x9fd0('0xa'));var queues=require(_0x9fd0('0xb'));var recordings=require(_0x9fd0('0xc'));var members=require(_0x9fd0('0xd'));var dials=require(_0x9fd0('0xe'));var transfers=require('./transfers.controller');var core=require(_0x9fd0('0xf'));ami['on'](_0x9fd0('0x10'),core[_0x9fd0('0x10')]);ami['on']('shutdown',core[_0x9fd0('0x11')]);ami['on']('fullybooted',core[_0x9fd0('0x12')]);ami['on'](_0x9fd0('0x13'),core[_0x9fd0('0x13')]);ami['on'](_0x9fd0('0x14'),core[_0x9fd0('0x14')]);ami['on']('managerevent',core[_0x9fd0('0x15')]);ami['on']('devicestatechange',function(_0x2bf639){try{utils[_0x9fd0('0x16')](util[_0x9fd0('0x17')]('[%s][index][devicestatechange]',_0x2bf639[_0x9fd0('0x18')]),_0x2bf639);members[_0x9fd0('0x19')](_0x2bf639);}catch(_0x5246db){utils[_0x9fd0('0x13')](util[_0x9fd0('0x17')](_0x9fd0('0x1a'),_0x2bf639['device']),_0x5246db);}});ami['on'](_0x9fd0('0x1b'),function(_0x41c1db){try{utils[_0x9fd0('0x16')](util[_0x9fd0('0x17')](_0x9fd0('0x1c'),_0x41c1db[_0x9fd0('0x1d')]),_0x41c1db);agents[_0x9fd0('0x1b')](_0x41c1db);}catch(_0x43a43f){utils[_0x9fd0('0x13')](util[_0x9fd0('0x17')]('[%s][index][agentcalled]',_0x41c1db[_0x9fd0('0x1d')]),_0x43a43f);}});ami['on'](_0x9fd0('0x1e'),function(_0x1973dd){try{utils[_0x9fd0('0x16')](util['format'](_0x9fd0('0x1f'),_0x1973dd[_0x9fd0('0x1d')]),_0x1973dd);agents[_0x9fd0('0x1e')](_0x1973dd);}catch(_0x390f6){utils[_0x9fd0('0x13')](util[_0x9fd0('0x17')](_0x9fd0('0x1f'),_0x1973dd[_0x9fd0('0x1d')]),_0x390f6);}});ami['on'](_0x9fd0('0x20'),function(_0x39709e){try{utils[_0x9fd0('0x16')](util[_0x9fd0('0x17')](_0x9fd0('0x21'),_0x39709e[_0x9fd0('0x1d')]),_0x39709e);agents[_0x9fd0('0x20')](_0x39709e);queues[_0x9fd0('0x20')](_0x39709e);}catch(_0x4aed7f){utils['error'](util[_0x9fd0('0x17')]('[%s][index][agentconnect]',_0x39709e['uniqueid']),_0x4aed7f);}});ami['on']('agentcomplete',function(_0x24ff25){try{utils[_0x9fd0('0x16')](util[_0x9fd0('0x17')](_0x9fd0('0x22'),_0x24ff25[_0x9fd0('0x1d')]),_0x24ff25);agents[_0x9fd0('0x23')](_0x24ff25);queues[_0x9fd0('0x23')](_0x24ff25);members['agentcomplete'](_0x24ff25);}catch(_0x1b8f3b){utils['error'](util[_0x9fd0('0x17')](_0x9fd0('0x22'),_0x24ff25[_0x9fd0('0x1d')]),_0x1b8f3b);}});ami['on'](_0x9fd0('0x24'),function(_0x1f990f){try{utils[_0x9fd0('0x16')](util[_0x9fd0('0x17')](_0x9fd0('0x25'),_0x1f990f[_0x9fd0('0x1d')]),_0x1f990f);agents[_0x9fd0('0x24')](_0x1f990f);queues[_0x9fd0('0x24')](_0x1f990f);}catch(_0x573d52){utils[_0x9fd0('0x13')](util[_0x9fd0('0x17')](_0x9fd0('0x25'),_0x1f990f[_0x9fd0('0x1d')]),_0x573d52);}});ami['on'](_0x9fd0('0x26'),function(_0xd05bed){try{utils[_0x9fd0('0x16')](util[_0x9fd0('0x17')](_0x9fd0('0x27'),_0xd05bed[_0x9fd0('0x1d')]),_0xd05bed);queues[_0x9fd0('0x26')](_0xd05bed);recordings[_0x9fd0('0x26')](_0xd05bed);}catch(_0x210b5d){utils[_0x9fd0('0x13')](util[_0x9fd0('0x17')](_0x9fd0('0x27'),_0xd05bed['uniqueid']),_0x210b5d);}});ami['on'](_0x9fd0('0x28'),function(_0x28e226){try{utils[_0x9fd0('0x16')](util[_0x9fd0('0x17')](_0x9fd0('0x29'),_0x28e226[_0x9fd0('0x1d')]),_0x28e226);queues[_0x9fd0('0x28')](_0x28e226);}catch(_0xb688e3){utils[_0x9fd0('0x13')](util[_0x9fd0('0x17')](_0x9fd0('0x29'),_0x28e226[_0x9fd0('0x1d')]),_0xb688e3);}});ami['on'](_0x9fd0('0x2a'),function(_0x44619b){try{utils[_0x9fd0('0x16')](util[_0x9fd0('0x17')]('[%s][index][musiconholdstart]',_0x44619b['uniqueid']),_0x44619b);queues['musiconholdstart'](_0x44619b);calls[_0x9fd0('0x2a')](_0x44619b);}catch(_0x1b31b5){utils[_0x9fd0('0x13')](util['format'](_0x9fd0('0x2b'),_0x44619b[_0x9fd0('0x1d')]),_0x1b31b5);}});ami['on'](_0x9fd0('0x2c'),function(_0x430fdd){try{utils['debug'](util[_0x9fd0('0x17')](_0x9fd0('0x2d'),_0x430fdd[_0x9fd0('0x1d')]),_0x430fdd);queues[_0x9fd0('0x2c')](_0x430fdd);calls[_0x9fd0('0x2c')](_0x430fdd);}catch(_0x3474cb){utils[_0x9fd0('0x13')](util['format'](_0x9fd0('0x2d'),_0x430fdd[_0x9fd0('0x1d')]),_0x3474cb);}});ami['on'](_0x9fd0('0x2e'),function(_0x1ed273){try{utils['debug'](util[_0x9fd0('0x17')](_0x9fd0('0x2f'),_0x1ed273[_0x9fd0('0x1d')]),_0x1ed273);calls[_0x9fd0('0x2e')](_0x1ed273);recordings[_0x9fd0('0x2e')](_0x1ed273);}catch(_0x53b5c9){utils[_0x9fd0('0x13')](util[_0x9fd0('0x17')](_0x9fd0('0x2f'),_0x1ed273[_0x9fd0('0x1d')]),_0x53b5c9);}});ami['on'](_0x9fd0('0x30'),function(_0x4ce161){try{utils['debug'](util[_0x9fd0('0x17')](_0x9fd0('0x31'),_0x4ce161['uniqueid']),_0x4ce161);calls[_0x9fd0('0x30')](_0x4ce161);recordings[_0x9fd0('0x30')](_0x4ce161);dials[_0x9fd0('0x30')](_0x4ce161);agents['hangup'](_0x4ce161);queues[_0x9fd0('0x30')](_0x4ce161);}catch(_0x358868){utils['error'](util[_0x9fd0('0x17')](_0x9fd0('0x31'),_0x4ce161['uniqueid']),_0x358868);}});ami['on'](_0x9fd0('0x32'),function(_0x110026){try{utils[_0x9fd0('0x16')](util[_0x9fd0('0x17')](_0x9fd0('0x33'),_0x110026[_0x9fd0('0x1d')]),_0x110026);members[_0x9fd0('0x32')](_0x110026);}catch(_0x2d38bf){utils['error'](util['format'](_0x9fd0('0x33'),_0x110026[_0x9fd0('0x1d')]),_0x2d38bf);}});ami['on'](_0x9fd0('0x34'),function(_0x5b12aa){try{utils[_0x9fd0('0x16')](util[_0x9fd0('0x17')](_0x9fd0('0x35'),_0x5b12aa[_0x9fd0('0x1d')]),_0x5b12aa);queues[_0x9fd0('0x34')](_0x5b12aa);agents[_0x9fd0('0x34')](_0x5b12aa);transfers[_0x9fd0('0x34')](_0x5b12aa);}catch(_0x56966f){utils[_0x9fd0('0x13')](util[_0x9fd0('0x17')]('[%s][index][blindtransfer]',_0x5b12aa['uniqueid']),_0x56966f);}});ami['on']('attendedtransfer',function(_0x39568b){try{utils['debug'](util['format'](_0x9fd0('0x36'),_0x39568b[_0x9fd0('0x37')]),_0x39568b);queues[_0x9fd0('0x38')](_0x39568b);transfers[_0x9fd0('0x38')](_0x39568b);agents[_0x9fd0('0x38')](_0x39568b);calls['attendedtransfer'](_0x39568b);}catch(_0x5dd75c){utils[_0x9fd0('0x13')](util['format'](_0x9fd0('0x36'),_0x39568b[_0x9fd0('0x37')]),_0x5dd75c);}});ami['on']('varset',function(_0x2da6ee){try{utils['debug'](util[_0x9fd0('0x17')](_0x9fd0('0x39'),_0x2da6ee[_0x9fd0('0x1d')]),_0x2da6ee);queues[_0x9fd0('0x3a')](_0x2da6ee);recordings[_0x9fd0('0x3a')](_0x2da6ee);calls[_0x9fd0('0x3a')](_0x2da6ee);dials[_0x9fd0('0x3a')](_0x2da6ee);}catch(_0x20fe15){utils[_0x9fd0('0x13')](util[_0x9fd0('0x17')]('[%s][index][varset]',_0x2da6ee['uniqueid']),_0x20fe15);}});ami['on']('newexten',function(_0x59984f){try{utils[_0x9fd0('0x16')](util[_0x9fd0('0x17')](_0x9fd0('0x3b'),_0x59984f[_0x9fd0('0x1d')]),_0x59984f);calls[_0x9fd0('0x3c')](_0x59984f);recordings[_0x9fd0('0x3c')](_0x59984f);dials[_0x9fd0('0x3c')](_0x59984f);}catch(_0x355511){utils[_0x9fd0('0x13')](util[_0x9fd0('0x17')](_0x9fd0('0x3b'),_0x59984f[_0x9fd0('0x1d')]),_0x355511);}});ami['on'](_0x9fd0('0x3d'),function(_0x309969){try{utils['debug'](util['format']('[%s][index][newchannel]',_0x309969[_0x9fd0('0x1d')]),_0x309969);calls['newchannel'](_0x309969);recordings[_0x9fd0('0x3d')](_0x309969);}catch(_0x206582){utils[_0x9fd0('0x13')](util[_0x9fd0('0x17')](_0x9fd0('0x3e'),_0x309969[_0x9fd0('0x1d')]),_0x206582);}});ami['on'](_0x9fd0('0x3f'),function(_0x12ba33){try{utils[_0x9fd0('0x16')](util[_0x9fd0('0x17')](_0x9fd0('0x40'),_0x12ba33[_0x9fd0('0x1d')]),_0x12ba33);dials[_0x9fd0('0x3f')](_0x12ba33);}catch(_0x1885b5){utils[_0x9fd0('0x13')](util[_0x9fd0('0x17')]('[%s]dialbegin',_0x12ba33[_0x9fd0('0x1d')]),_0x1885b5);}});ami['on'](_0x9fd0('0x41'),function(_0x2d9c86){try{utils[_0x9fd0('0x16')](util[_0x9fd0('0x17')](_0x9fd0('0x42'),_0x2d9c86[_0x9fd0('0x1d')]),_0x2d9c86);dials[_0x9fd0('0x41')](_0x2d9c86);}catch(_0x2f12c5){utils[_0x9fd0('0x13')](util[_0x9fd0('0x17')](_0x9fd0('0x42'),_0x2d9c86[_0x9fd0('0x1d')]),_0x2f12c5);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 6568d8c..30e767b 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 _0xa142=['isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','assign','data1','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','type','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','membername','request','error','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','exitAt','diffTime','enterAt','agentcomplete'];(function(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0xa142,0x1eb));var _0x2a14=function(_0x3bac05,_0xe3556a){_0x3bac05=_0x3bac05-0x0;var _0x5bc64b=_0xa142[_0x3bac05];return _0x5bc64b;};'use strict';var _=require('lodash');var util=require(_0x2a14('0x0'));var utils=require(_0x2a14('0x1'));var members={};var exclude=[_0x2a14('0x2'),_0x2a14('0x3')];function writeDB(_0x77fb73){utils[_0x2a14('0x4')](util[_0x2a14('0x5')](_0x2a14('0x6'),_0x77fb73[_0x2a14('0x7')],_0x77fb73[_0x2a14('0x8')],_0x77fb73[_0x2a14('0x9')],_0x77fb73['data2'],_0x77fb73['membername'],_0x77fb73[_0x2a14('0xa')]));if(_0x77fb73[_0x2a14('0x8')]){utils[_0x2a14('0xb')](_0x77fb73[_0x2a14('0x8')])[_0x2a14('0xc')](function(_0x10e14c){if(_0x10e14c){_0x77fb73['membername']=_0x10e14c[_0x2a14('0xd')];_0x77fb73[_0x2a14('0xe')]=_0x10e14c[_0x2a14('0xe')];utils['request'](_0x2a14('0xf'),_0x77fb73);}else{utils[_0x2a14('0x10')](_0x77fb73[_0x2a14('0x8')][_0x2a14('0x11')]('/')[0x1])[_0x2a14('0xc')](function(_0x4ca0fe){if(_0x4ca0fe){_0x77fb73[_0x2a14('0x12')]=_0x4ca0fe[_0x2a14('0xd')];_0x77fb73[_0x2a14('0xe')]=_0x4ca0fe['internal'];utils[_0x2a14('0x13')]('CreateMemberReport',_0x77fb73);}});}})['catch'](function(_0x46acbb){utils[_0x2a14('0x14')](util[_0x2a14('0x5')](_0x2a14('0x15'),_0x77fb73[_0x2a14('0x7')]),_0x46acbb);});}delete members[_0x77fb73[_0x2a14('0x8')]];}function startsWith(_0x355d3b,_0x2b6736){return _[_0x2a14('0x16')](_0x355d3b,function(_0x47a4c4){return _[_0x2a14('0x17')](_0x2b6736,_0x47a4c4);});}exports['devicestatechange']=function(_0x387836){try{utils[_0x2a14('0x18')](util[_0x2a14('0x5')](_0x2a14('0x19'),members[_0x387836[_0x2a14('0x1a')]]?members[_0x387836[_0x2a14('0x1a')]][_0x2a14('0x7')]:_0x387836[_0x2a14('0x1a')]),_0x387836);utils['info'](util['format'](_0x2a14('0x1b'),members[_0x387836[_0x2a14('0x1a')]]?members[_0x387836[_0x2a14('0x1a')]][_0x2a14('0x7')]:_0x387836[_0x2a14('0x1a')],_0x387836['state'],_0x387836[_0x2a14('0x1a')]));switch(_0x387836[_0x2a14('0x1c')]){case _0x2a14('0x1d'):case _0x2a14('0x1e'):if(!startsWith(exclude,_0x387836[_0x2a14('0x1a')])){members[_0x387836[_0x2a14('0x1a')]]={'channel':_0x2a14('0x1f'),'interface':_0x387836['device'],'type':_0x2a14('0x20'),'enterAt':utils[_0x2a14('0x21')](),'role':_0x2a14('0x22')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x387836[_0x2a14('0x1a')]])){members[_0x387836['device']][_0x2a14('0x23')]=utils[_0x2a14('0x21')]();members[_0x387836[_0x2a14('0x1a')]]['duration']=utils[_0x2a14('0x24')](members[_0x387836['device']][_0x2a14('0x23')],members[_0x387836[_0x2a14('0x1a')]][_0x2a14('0x25')]);if(members[_0x387836[_0x2a14('0x1a')]][_0x2a14('0x7')]){writeDB(members[_0x387836[_0x2a14('0x1a')]]);}}break;default:break;}}catch(_0x318081){utils[_0x2a14('0x14')](util[_0x2a14('0x5')](_0x2a14('0x19'),members[_0x387836[_0x2a14('0x1a')]]?members[_0x387836[_0x2a14('0x1a')]][_0x2a14('0x7')]:_0x387836[_0x2a14('0x1a')]),_0x318081);}};exports[_0x2a14('0x26')]=function(_0x53a940){try{if(!_[_0x2a14('0x27')](members[_0x53a940[_0x2a14('0x8')]])){utils['debug'](util['format'](_0x2a14('0x28'),_0x53a940[_0x2a14('0x7')]),_0x53a940);utils[_0x2a14('0x4')](util[_0x2a14('0x5')](_0x2a14('0x29'),_0x53a940['uniqueid'],_0x53a940[_0x2a14('0x8')],_0x53a940[_0x2a14('0x2a')]));members[_0x53a940[_0x2a14('0x8')]]=_['assign'](members[_0x53a940[_0x2a14('0x8')]],{'data4':_0x53a940[_0x2a14('0x2a')],'uniqueid':_0x53a940[_0x2a14('0x7')]});}}catch(_0x483d9f){utils['error'](util['format'](_0x2a14('0x28'),_0x53a940[_0x2a14('0x7')]),_0x483d9f);}};exports[_0x2a14('0x2b')]=function(_0x208348){try{utils[_0x2a14('0x18')](util[_0x2a14('0x5')](_0x2a14('0x2c'),_0x208348[_0x2a14('0x7')]),_0x208348);if(_0x208348['channel']){var _0x257896=_0x208348[_0x2a14('0x9')][_0x2a14('0x11')]('-')[0x0];if(!_[_0x2a14('0x27')](members[_0x257896])){members[_0x257896]=_[_0x2a14('0x2d')](members[_0x257896],{'data1':members[_0x257896][_0x2a14('0x2e')]||_0x208348[_0x2a14('0xa')],'data2':members[_0x257896][_0x2a14('0x2f')]||_0x208348[_0x2a14('0x30')],'data3':members[_0x257896][_0x2a14('0x31')]||_0x208348[_0x2a14('0x32')],'uniqueid':members[_0x257896][_0x2a14('0x7')]||_0x208348[_0x2a14('0x7')]});utils['info'](util[_0x2a14('0x5')](_0x2a14('0x33'),_0x208348[_0x2a14('0x7')],members[_0x257896][_0x2a14('0x2e')],members[_0x257896][_0x2a14('0x2f')],members[_0x257896]['data3']));if(members[_0x257896][_0x2a14('0x23')]){writeDB(members[_0x257896]);}}}if(_0x208348[_0x2a14('0x34')]){var _0x21af58=_0x208348[_0x2a14('0x34')][_0x2a14('0x11')]('-')[0x0];if(!_['isNil'](members[_0x21af58])){members[_0x21af58]=_[_0x2a14('0x2d')](members[_0x21af58],{'data1':members[_0x21af58][_0x2a14('0x2e')]||_0x208348[_0x2a14('0xa')],'data2':members[_0x21af58][_0x2a14('0x2f')]||_0x208348[_0x2a14('0x30')],'data3':members[_0x21af58][_0x2a14('0x31')]||_0x208348[_0x2a14('0x32')],'uniqueid':members[_0x21af58][_0x2a14('0x7')]||_0x208348['uniqueid']});utils[_0x2a14('0x4')](util[_0x2a14('0x5')](_0x2a14('0x33'),_0x208348[_0x2a14('0x7')],members[_0x21af58][_0x2a14('0x2e')],members[_0x21af58]['data2'],members[_0x21af58][_0x2a14('0x31')]));if(members[_0x21af58]['exitAt']){writeDB(members[_0x21af58]);}}}}catch(_0x3efc53){utils[_0x2a14('0x14')](util['format'](_0x2a14('0x2c'),_0x208348[_0x2a14('0x7')]),_0x3efc53);}}; \ No newline at end of file +var _0x5dad=['interface','getUserByInterface','name','internal','request','getUserByName','split','catch','error','some','devicestatechange','debug','[%s][members][devicestatechange]','uniqueid','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','lodash','util','./utils','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','data2','membername','type'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0x5dad,0x128));var _0xd5da=function(_0x28a48f,_0x597fd1){_0x28a48f=_0x28a48f-0x0;var _0x44a6af=_0x5dad[_0x28a48f];return _0x44a6af;};'use strict';var _=require(_0xd5da('0x0'));var util=require(_0xd5da('0x1'));var utils=require(_0xd5da('0x2'));var members={};var exclude=['Local/_attended@transfer',_0xd5da('0x3')];function writeDB(_0x4bebbf){utils['info'](util[_0xd5da('0x4')](_0xd5da('0x5'),_0x4bebbf['uniqueid'],_0x4bebbf['interface'],_0x4bebbf[_0xd5da('0x6')],_0x4bebbf[_0xd5da('0x7')],_0x4bebbf[_0xd5da('0x8')],_0x4bebbf[_0xd5da('0x9')]));if(_0x4bebbf[_0xd5da('0xa')]){utils[_0xd5da('0xb')](_0x4bebbf[_0xd5da('0xa')])['then'](function(_0x112b9e){if(_0x112b9e){_0x4bebbf['membername']=_0x112b9e[_0xd5da('0xc')];_0x4bebbf[_0xd5da('0xd')]=_0x112b9e[_0xd5da('0xd')];utils[_0xd5da('0xe')]('CreateMemberReport',_0x4bebbf);}else{utils[_0xd5da('0xf')](_0x4bebbf[_0xd5da('0xa')][_0xd5da('0x10')]('/')[0x1])['then'](function(_0x2b1470){if(_0x2b1470){_0x4bebbf[_0xd5da('0x8')]=_0x2b1470[_0xd5da('0xc')];_0x4bebbf[_0xd5da('0xd')]=_0x2b1470[_0xd5da('0xd')];utils[_0xd5da('0xe')]('CreateMemberReport',_0x4bebbf);}});}})[_0xd5da('0x11')](function(_0x5448d5){utils[_0xd5da('0x12')](util[_0xd5da('0x4')]('[%s][members][writeDB]',_0x4bebbf['uniqueid']),_0x5448d5);});}delete members[_0x4bebbf[_0xd5da('0xa')]];}function startsWith(_0x1059ca,_0x227c93){return _[_0xd5da('0x13')](_0x1059ca,function(_0x106338){return _['startsWith'](_0x227c93,_0x106338);});}exports[_0xd5da('0x14')]=function(_0x15c96c){try{utils[_0xd5da('0x15')](util[_0xd5da('0x4')](_0xd5da('0x16'),members[_0x15c96c['device']]?members[_0x15c96c['device']][_0xd5da('0x17')]:_0x15c96c[_0xd5da('0x18')]),_0x15c96c);utils[_0xd5da('0x19')](util[_0xd5da('0x4')](_0xd5da('0x1a'),members[_0x15c96c[_0xd5da('0x18')]]?members[_0x15c96c[_0xd5da('0x18')]][_0xd5da('0x17')]:_0x15c96c[_0xd5da('0x18')],_0x15c96c[_0xd5da('0x1b')],_0x15c96c[_0xd5da('0x18')]));switch(_0x15c96c[_0xd5da('0x1b')]){case'INUSE':case _0xd5da('0x1c'):if(!startsWith(exclude,_0x15c96c['device'])){members[_0x15c96c['device']]={'channel':_0xd5da('0x1d'),'interface':_0x15c96c[_0xd5da('0x18')],'type':'TALKING','enterAt':utils[_0xd5da('0x1e')](),'role':_0xd5da('0x1f')};}break;case _0xd5da('0x20'):if(!_[_0xd5da('0x21')](members[_0x15c96c['device']])){members[_0x15c96c[_0xd5da('0x18')]][_0xd5da('0x22')]=utils['now']();members[_0x15c96c[_0xd5da('0x18')]][_0xd5da('0x23')]=utils[_0xd5da('0x24')](members[_0x15c96c[_0xd5da('0x18')]][_0xd5da('0x22')],members[_0x15c96c[_0xd5da('0x18')]][_0xd5da('0x25')]);if(members[_0x15c96c['device']][_0xd5da('0x17')]){writeDB(members[_0x15c96c['device']]);}}break;default:break;}}catch(_0x14acd4){utils[_0xd5da('0x12')](util['format']('[%s][members][devicestatechange]',members[_0x15c96c[_0xd5da('0x18')]]?members[_0x15c96c[_0xd5da('0x18')]]['uniqueid']:_0x15c96c[_0xd5da('0x18')]),_0x14acd4);}};exports[_0xd5da('0x26')]=function(_0x24e566){try{if(!_[_0xd5da('0x21')](members[_0x24e566[_0xd5da('0xa')]])){utils['debug'](util['format'](_0xd5da('0x27'),_0x24e566[_0xd5da('0x17')]),_0x24e566);utils[_0xd5da('0x19')](util[_0xd5da('0x4')](_0xd5da('0x28'),_0x24e566[_0xd5da('0x17')],_0x24e566[_0xd5da('0xa')],_0x24e566['queue']));members[_0x24e566[_0xd5da('0xa')]]=_[_0xd5da('0x29')](members[_0x24e566[_0xd5da('0xa')]],{'data4':_0x24e566[_0xd5da('0x2a')],'uniqueid':_0x24e566[_0xd5da('0x17')]});}}catch(_0x31f3ea){utils[_0xd5da('0x12')](util['format'](_0xd5da('0x27'),_0x24e566[_0xd5da('0x17')]),_0x31f3ea);}};exports[_0xd5da('0x2b')]=function(_0xaea6d1){try{utils[_0xd5da('0x15')](util[_0xd5da('0x4')](_0xd5da('0x2c'),_0xaea6d1[_0xd5da('0x17')]),_0xaea6d1);if(_0xaea6d1[_0xd5da('0x6')]){var _0x4ba3bc=_0xaea6d1[_0xd5da('0x6')]['split']('-')[0x0];if(!_[_0xd5da('0x21')](members[_0x4ba3bc])){members[_0x4ba3bc]=_[_0xd5da('0x29')](members[_0x4ba3bc],{'data1':members[_0x4ba3bc]['data1']||_0xaea6d1[_0xd5da('0x9')],'data2':members[_0x4ba3bc][_0xd5da('0x7')]||_0xaea6d1[_0xd5da('0x2d')],'data3':members[_0x4ba3bc][_0xd5da('0x2e')]||_0xaea6d1[_0xd5da('0x2f')],'uniqueid':members[_0x4ba3bc][_0xd5da('0x17')]||_0xaea6d1['uniqueid']});utils['info'](util[_0xd5da('0x4')](_0xd5da('0x30'),_0xaea6d1['uniqueid'],members[_0x4ba3bc][_0xd5da('0x31')],members[_0x4ba3bc][_0xd5da('0x7')],members[_0x4ba3bc]['data3']));if(members[_0x4ba3bc][_0xd5da('0x22')]){writeDB(members[_0x4ba3bc]);}}}if(_0xaea6d1[_0xd5da('0x32')]){var _0x4d7ab5=_0xaea6d1[_0xd5da('0x32')]['split']('-')[0x0];if(!_[_0xd5da('0x21')](members[_0x4d7ab5])){members[_0x4d7ab5]=_[_0xd5da('0x29')](members[_0x4d7ab5],{'data1':members[_0x4d7ab5][_0xd5da('0x31')]||_0xaea6d1[_0xd5da('0x9')],'data2':members[_0x4d7ab5][_0xd5da('0x7')]||_0xaea6d1[_0xd5da('0x2d')],'data3':members[_0x4d7ab5][_0xd5da('0x2e')]||_0xaea6d1['destination'],'uniqueid':members[_0x4d7ab5][_0xd5da('0x17')]||_0xaea6d1['uniqueid']});utils[_0xd5da('0x19')](util['format'](_0xd5da('0x30'),_0xaea6d1['uniqueid'],members[_0x4d7ab5][_0xd5da('0x31')],members[_0x4d7ab5][_0xd5da('0x7')],members[_0x4d7ab5][_0xd5da('0x2e')]));if(members[_0x4d7ab5][_0xd5da('0x22')]){writeDB(members[_0x4d7ab5]);}}}}catch(_0x4fe39f){utils[_0xd5da('0x12')](util[_0xd5da('0x4')](_0xd5da('0x2c'),_0xaea6d1[_0xd5da('0x17')]),_0x4fe39f);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 542f028..e88d899 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 _0x2820=['CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','uniqueid','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','format','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallercomplete','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','variable','value','toUpperCase','queuecallerabandon','queuecallerabandonAt','queuecallerexit','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transfertype','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','queuecallerenterreason','calleridname','mohtime','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','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','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request'];(function(_0x32eb8b,_0xf8d7d2){var _0x33a0cc=function(_0x1500f7){while(--_0x1500f7){_0x32eb8b['push'](_0x32eb8b['shift']());}};_0x33a0cc(++_0xf8d7d2);}(_0x2820,0xc6));var _0x0282=function(_0x406fdb,_0x96cce5){_0x406fdb=_0x406fdb-0x0;var _0x1d916e=_0x2820[_0x406fdb];return _0x1d916e;};'use strict';var _=require(_0x0282('0x0'));var util=require(_0x0282('0x1'));var utils=require(_0x0282('0x2'));var queues={};function writeDB(_0x1000a0){utils['info'](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x1000a0['uniqueid'],_0x1000a0[_0x0282('0x3')],_0x1000a0[_0x0282('0x4')],_0x1000a0[_0x0282('0x5')],_0x1000a0[_0x0282('0x6')],_0x1000a0['accountcode'],_0x1000a0[_0x0282('0x7')]));if(_0x1000a0[_0x0282('0x4')]){utils[_0x0282('0x8')](_0x1000a0[_0x0282('0x4')])[_0x0282('0x9')](function(_0x456402){if(_0x456402){_0x1000a0[_0x0282('0xa')]=_0x456402[_0x0282('0xa')];}utils[_0x0282('0xb')](_0x0282('0xc'),_0x1000a0);});}else{utils['request'](_0x0282('0xc'),_0x1000a0);}if(_0x1000a0[_0x0282('0xd')]){delete queues[_0x1000a0[_0x0282('0xd')]];}else{delete queues[_0x1000a0['uniqueid']];}}exports[_0x0282('0xe')]=function(_0x40a472){try{utils[_0x0282('0xf')](util['format'](_0x0282('0x10'),_0x40a472[_0x0282('0x11')]),_0x40a472);utils[_0x0282('0x12')](util['format'](_0x0282('0x13'),_0x40a472[_0x0282('0x11')],_0x40a472['queue'],_0x40a472[_0x0282('0x14')]));queues[_0x40a472[_0x0282('0x11')]]=_[_0x0282('0x15')](_0x40a472,{'originalposition':_0x40a472[_0x0282('0x14')],'queuecallerjoinAt':utils[_0x0282('0x16')](),'mohtime':0x0});}catch(_0x455c8f){utils[_0x0282('0x17')](util[_0x0282('0x18')]('[%s][queues][queuecallerjoin]',_0x40a472[_0x0282('0x11')]),_0x455c8f);}};exports[_0x0282('0x19')]=function(_0x267670){try{if(!_[_0x0282('0x1a')](queues[_0x267670['uniqueid']])){utils[_0x0282('0xf')](util[_0x0282('0x18')](_0x0282('0x1b'),_0x267670['uniqueid']),_0x267670);if(queues[_0x267670[_0x0282('0x11')]][_0x0282('0x1c')]){if(!queues[_0x267670[_0x0282('0x11')]]['queuecallerabandon']&&!queues[_0x267670[_0x0282('0x11')]]['queuecallerexit']){queues[_0x267670[_0x0282('0x11')]][_0x0282('0x1d')]=!![];queues[_0x267670[_0x0282('0x11')]]['queuecallercompleteAt']=utils[_0x0282('0x16')]();queues[_0x267670['uniqueid']]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0x0282('0x12')](util[_0x0282('0x18')](_0x0282('0x1e'),_0x267670[_0x0282('0x11')],queues[_0x267670[_0x0282('0x11')]]['name'],queues[_0x267670[_0x0282('0x11')]][_0x0282('0x7')]));writeDB(queues[_0x267670[_0x0282('0x11')]]);}else if(queues[_0x267670[_0x0282('0x11')]][_0x0282('0xd')]){utils['info'](util[_0x0282('0x18')](_0x0282('0x1f'),_0x267670['uniqueid'],queues[_0x267670['uniqueid']][_0x0282('0x20')],queues[_0x267670[_0x0282('0x11')]][_0x0282('0xd')]));queues[queues[_0x267670[_0x0282('0x11')]][_0x0282('0xd')]]=queues[_0x267670[_0x0282('0x11')]];queues[queues[_0x267670['uniqueid']]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x267670[_0x0282('0x11')]];}}}catch(_0x29894b){utils[_0x0282('0x17')](util[_0x0282('0x18')]('[%s][queues][hangup]',_0x267670[_0x0282('0x11')]),_0x29894b);}};exports['varset']=function(_0xffb1d2){try{utils[_0x0282('0xf')](util[_0x0282('0x18')]('[%s][queues][varset]',_0xffb1d2[_0x0282('0x11')]),_0xffb1d2);if(!_[_0x0282('0x1a')](_0xffb1d2[_0x0282('0x21')]['queuestatus'])&&_0xffb1d2[_0x0282('0x22')][_0x0282('0x23')]()!=='CONTINUE'){if(!_[_0x0282('0x1a')](queues[_0xffb1d2['uniqueid']])){queues[_0xffb1d2[_0x0282('0x11')]][_0x0282('0x24')]=![];queues[_0xffb1d2[_0x0282('0x11')]][_0x0282('0x25')]=null;queues[_0xffb1d2[_0x0282('0x11')]][_0x0282('0x26')]=!![];queues[_0xffb1d2[_0x0282('0x11')]]['queuecallerexitAt']=utils['now']();queues[_0xffb1d2['uniqueid']][_0x0282('0x7')]=_0xffb1d2[_0x0282('0x22')][_0x0282('0x23')]();utils['info'](util[_0x0282('0x18')](_0x0282('0x27'),_0xffb1d2[_0x0282('0x11')],queues[_0xffb1d2[_0x0282('0x11')]][_0x0282('0x20')],_0xffb1d2[_0x0282('0x22')],queues[_0xffb1d2[_0x0282('0x11')]][_0x0282('0x7')]));writeDB(queues[_0xffb1d2[_0x0282('0x11')]]);}}else if(!_['isNil'](_0xffb1d2[_0x0282('0x21')]['queueposition'])){if(!_['isNil'](queues[_0xffb1d2[_0x0282('0x11')]])&&!queues[_0xffb1d2[_0x0282('0x11')]][_0x0282('0x24')]){queues[_0xffb1d2['uniqueid']]['queuecallerabandon']=![];queues[_0xffb1d2[_0x0282('0x11')]][_0x0282('0x25')]=null;queues[_0xffb1d2[_0x0282('0x11')]][_0x0282('0x26')]=!![];queues[_0xffb1d2[_0x0282('0x11')]][_0x0282('0x28')]=utils[_0x0282('0x16')]();queues[_0xffb1d2[_0x0282('0x11')]][_0x0282('0x7')]=_0x0282('0x29');utils[_0x0282('0x12')](util[_0x0282('0x18')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0xffb1d2['uniqueid'],queues[_0xffb1d2[_0x0282('0x11')]][_0x0282('0x20')],_0xffb1d2[_0x0282('0x22')],queues[_0xffb1d2[_0x0282('0x11')]][_0x0282('0x7')]));}}}catch(_0x3610a3){utils[_0x0282('0x17')](util[_0x0282('0x18')](_0x0282('0x2a'),_0xffb1d2['uniqueid']),_0x3610a3);}};exports[_0x0282('0x24')]=function(_0x2f2967){try{if(!_[_0x0282('0x1a')](queues[_0x2f2967['uniqueid']])){utils[_0x0282('0xf')](util[_0x0282('0x18')](_0x0282('0x2b'),_0x2f2967[_0x0282('0x11')]),_0x2f2967);queues[_0x2f2967['uniqueid']][_0x0282('0x26')]=![];queues[_0x2f2967[_0x0282('0x11')]][_0x0282('0x28')]=null;queues[_0x2f2967['uniqueid']]['queuecallerabandon']=!![];queues[_0x2f2967[_0x0282('0x11')]]['queuecallerabandonAt']=utils[_0x0282('0x16')]();queues[_0x2f2967[_0x0282('0x11')]]['queuecallerexitreason']=_0x0282('0x2c');utils['info'](util[_0x0282('0x18')](_0x0282('0x2d'),_0x2f2967['uniqueid'],queues[_0x2f2967[_0x0282('0x11')]]['name'],queues[_0x2f2967[_0x0282('0x11')]]['queuecallerexitreason']));}}catch(_0xdc2882){utils[_0x0282('0x17')](util[_0x0282('0x18')](_0x0282('0x2b'),_0x2f2967[_0x0282('0x11')]),_0xdc2882);}};exports['queuecallerleave']=function(_0x4815e5){try{if(!_[_0x0282('0x1a')](queues[_0x4815e5[_0x0282('0x11')]])){utils[_0x0282('0xf')](util[_0x0282('0x18')](_0x0282('0x2e'),_0x4815e5['uniqueid']),_0x4815e5);utils[_0x0282('0x12')](util['format'](_0x0282('0x2f'),_0x4815e5[_0x0282('0x11')],queues[_0x4815e5[_0x0282('0x11')]][_0x0282('0x20')],_0x4815e5[_0x0282('0x30')],_0x4815e5[_0x0282('0x31')]));queues[_0x4815e5[_0x0282('0x11')]][_0x0282('0x32')]=!![];queues[_0x4815e5[_0x0282('0x11')]][_0x0282('0x1c')]=utils[_0x0282('0x16')]();queues[_0x4815e5[_0x0282('0x11')]][_0x0282('0x33')]=utils[_0x0282('0x34')](queues[_0x4815e5['uniqueid']][_0x0282('0x1c')],queues[_0x4815e5[_0x0282('0x11')]]['queuecallerjoinAt']);queues[_0x4815e5[_0x0282('0x11')]]['position']=_0x4815e5[_0x0282('0x14')];queues[_0x4815e5[_0x0282('0x11')]][_0x0282('0x35')]=_0x4815e5[_0x0282('0x35')];queues[_0x4815e5[_0x0282('0x11')]][_0x0282('0x30')]=_0x4815e5[_0x0282('0x30')];queues[_0x4815e5[_0x0282('0x11')]][_0x0282('0x31')]=_0x4815e5['connectedlinename'];}}catch(_0x448c68){utils[_0x0282('0x17')](util['format']('[%s][queues][queuecallerleave]',_0x4815e5[_0x0282('0x11')]),_0x448c68);}};exports[_0x0282('0x36')]=function(_0x21981c){try{if(!_[_0x0282('0x1a')](queues[_0x21981c[_0x0282('0x11')]])){utils[_0x0282('0xf')](util[_0x0282('0x18')](_0x0282('0x37'),_0x21981c[_0x0282('0x11')]),_0x21981c);utils[_0x0282('0x12')](util['format'](_0x0282('0x38'),_0x21981c['uniqueid'],queues[_0x21981c[_0x0282('0x11')]]['name'],_0x21981c[_0x0282('0x39')],_0x21981c['destaccountcode']));queues[_0x21981c['uniqueid']][_0x0282('0x24')]=![];queues[_0x21981c[_0x0282('0x11')]][_0x0282('0x24')]=![];queues[_0x21981c['uniqueid']]['queuecallerabandonAt']=null;queues[_0x21981c[_0x0282('0x11')]][_0x0282('0x26')]=![];queues[_0x21981c[_0x0282('0x11')]][_0x0282('0x7')]=null;queues[_0x21981c[_0x0282('0x11')]][_0x0282('0x28')]=null;queues[_0x21981c[_0x0282('0x11')]][_0x0282('0x3a')]=!![];queues[_0x21981c['uniqueid']][_0x0282('0x3b')]=_0x21981c['destaccountcode'];queues[_0x21981c['uniqueid']][_0x0282('0x5')]=_0x21981c[_0x0282('0x39')];}}catch(_0x3c1b25){utils[_0x0282('0x17')](util[_0x0282('0x18')]('[%s][queues][agentconnect]',_0x21981c[_0x0282('0x11')]),_0x3c1b25);}};exports[_0x0282('0x3c')]=function(_0x50d314){try{if(!_[_0x0282('0x1a')](queues[_0x50d314[_0x0282('0x11')]])){if(queues[_0x50d314['uniqueid']]['queuecallerleaveAt']){utils['debug'](util[_0x0282('0x18')](_0x0282('0x3d'),_0x50d314[_0x0282('0x11')]),_0x50d314);queues[_0x50d314[_0x0282('0x11')]][_0x0282('0x24')]=![];queues[_0x50d314[_0x0282('0x11')]][_0x0282('0x24')]=![];queues[_0x50d314[_0x0282('0x11')]]['queuecallerabandonAt']=null;queues[_0x50d314[_0x0282('0x11')]][_0x0282('0x26')]=![];queues[_0x50d314[_0x0282('0x11')]][_0x0282('0x28')]=null;queues[_0x50d314[_0x0282('0x11')]][_0x0282('0x3a')]=!![];queues[_0x50d314[_0x0282('0x11')]][_0x0282('0x5')]=_0x50d314[_0x0282('0x39')];queues[_0x50d314[_0x0282('0x11')]]['queuecallercomplete']=!![];queues[_0x50d314[_0x0282('0x11')]][_0x0282('0x3e')]=utils['now']();if(_0x50d314[_0x0282('0x3f')]==_0x0282('0x40')){if(!queues[_0x50d314[_0x0282('0x11')]][_0x0282('0x40')]){queues[_0x50d314['uniqueid']]['queuecallerexitreason']=_0x0282('0x41');}}else{queues[_0x50d314[_0x0282('0x11')]][_0x0282('0x7')]=_0x0282('0x42')+_0x50d314[_0x0282('0x3f')][_0x0282('0x23')]();}utils['info'](util[_0x0282('0x18')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x50d314['uniqueid'],queues[_0x50d314['uniqueid']]['name'],_0x50d314['membername'],queues[_0x50d314[_0x0282('0x11')]]['queuecallerexitreason']));writeDB(queues[_0x50d314[_0x0282('0x11')]]);}}}catch(_0x28261f){utils[_0x0282('0x17')](util[_0x0282('0x18')](_0x0282('0x3d'),_0x50d314[_0x0282('0x11')]),_0x28261f);}};exports[_0x0282('0x43')]=function(_0x1540a2){try{if(!_[_0x0282('0x1a')](queues[_0x1540a2[_0x0282('0x44')]])){utils['debug'](util[_0x0282('0x18')](_0x0282('0x45'),_0x1540a2['uniqueid']),_0x1540a2);queues[_0x1540a2[_0x0282('0x44')]][_0x0282('0x40')]=!![];queues[_0x1540a2[_0x0282('0x44')]]['transfertype']=_0x0282('0x46');queues[_0x1540a2[_0x0282('0x44')]][_0x0282('0x47')]=_0x1540a2['extension'];queues[_0x1540a2['transfereeuniqueid']][_0x0282('0x48')]=_0x1540a2[_0x0282('0x44')];queues[_0x1540a2[_0x0282('0x44')]][_0x0282('0x7')]='BLINDTRANSFER';utils['info'](util[_0x0282('0x18')](_0x0282('0x49'),_0x1540a2[_0x0282('0x11')],queues[_0x1540a2[_0x0282('0x44')]][_0x0282('0x20')],_0x1540a2[_0x0282('0x44')],_0x1540a2[_0x0282('0x4a')]));}}catch(_0x1a02e3){utils[_0x0282('0x17')](util[_0x0282('0x18')](_0x0282('0x45'),_0x1540a2[_0x0282('0x11')]),_0x1a02e3);}};exports[_0x0282('0x4b')]=function(_0x9b1b01){try{utils[_0x0282('0xf')](util['format'](_0x0282('0x4c'),_0x9b1b01[_0x0282('0x4d')]),_0x9b1b01);if(_0x9b1b01[_0x0282('0x4d')]==_0x9b1b01['origtransfererlinkedid']){if(!_[_0x0282('0x1a')](queues[_0x9b1b01[_0x0282('0x4e')]])){utils[_0x0282('0x12')](util['format'](_0x0282('0x4f'),_0x9b1b01['origtransfereruniqueid'],queues[_0x9b1b01['secondtransfererlinkedid']]['name'],_0x9b1b01['origtransfererexten']));queues[_0x9b1b01[_0x0282('0x4e')]][_0x0282('0x40')]=!![];queues[_0x9b1b01['secondtransfererlinkedid']][_0x0282('0x50')]=_0x0282('0x51');queues[_0x9b1b01[_0x0282('0x4e')]][_0x0282('0x47')]=_0x9b1b01[_0x0282('0x52')];queues[_0x9b1b01[_0x0282('0x4e')]][_0x0282('0x48')]=_0x9b1b01['origtransfereruniqueid'];queues[_0x9b1b01[_0x0282('0x4e')]][_0x0282('0x7')]=_0x0282('0x53');}if(!_[_0x0282('0x1a')](queues[_0x9b1b01[_0x0282('0x54')]])){if(_0x9b1b01[_0x0282('0x55')]&&queues[_0x9b1b01['transfereelinkedid']]){queues[_0x9b1b01[_0x0282('0x55')]]['queuecallerenterreason']=0x1;queues[_0x9b1b01[_0x0282('0x44')]]=_[_0x0282('0x56')](queues[_0x9b1b01[_0x0282('0x55')]]);queues[_0x9b1b01[_0x0282('0x44')]][_0x0282('0xd')]=_0x9b1b01[_0x0282('0x57')];queues[_0x9b1b01[_0x0282('0x44')]][_0x0282('0x58')]=0x2;queues[_0x9b1b01[_0x0282('0x44')]][_0x0282('0x6')]=queues[_0x9b1b01[_0x0282('0x4e')]]['calleridnum'];queues[_0x9b1b01[_0x0282('0x44')]][_0x0282('0x59')]=queues[_0x9b1b01[_0x0282('0x4e')]][_0x0282('0x59')];queues[_0x9b1b01[_0x0282('0x44')]]['queuecallerjoinAt']=utils[_0x0282('0x16')]();queues[_0x9b1b01['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x0282('0x16')]();queues[_0x9b1b01[_0x0282('0x44')]][_0x0282('0x33')]=0x0;queues[_0x9b1b01[_0x0282('0x44')]][_0x0282('0x5a')]=0x0;utils[_0x0282('0x12')](util[_0x0282('0x18')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x9b1b01[_0x0282('0x4d')],queues[_0x9b1b01[_0x0282('0x44')]][_0x0282('0x20')],queues[_0x9b1b01[_0x0282('0x44')]]['calleridnum'],queues[_0x9b1b01['transfereeuniqueid']][_0x0282('0x59')]));}else{utils[_0x0282('0x12')](util[_0x0282('0x18')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x9b1b01['origtransfereruniqueid'],queues[_0x9b1b01[_0x0282('0x54')]][_0x0282('0x20')],_0x9b1b01[_0x0282('0x4e')]));queues[_0x9b1b01[_0x0282('0x54')]][_0x0282('0xd')]=_0x9b1b01[_0x0282('0x4e')];}}}else if(_0x9b1b01[_0x0282('0x5b')]==_0x9b1b01[_0x0282('0x4e')]){if(!_['isNil'](queues[_0x9b1b01[_0x0282('0x54')]])){utils[_0x0282('0x12')](util[_0x0282('0x18')](_0x0282('0x5c'),_0x9b1b01[_0x0282('0x4d')],queues[_0x9b1b01[_0x0282('0x54')]][_0x0282('0x20')],_0x9b1b01[_0x0282('0x5b')],_0x9b1b01[_0x0282('0x5d')]));queues[_0x9b1b01[_0x0282('0x54')]]['transfer']=!![];queues[_0x9b1b01[_0x0282('0x54')]]['transfertype']='ATTENDED';queues[_0x9b1b01[_0x0282('0x54')]][_0x0282('0x47')]=_0x9b1b01['secondtransfererexten'];queues[_0x9b1b01[_0x0282('0x54')]][_0x0282('0x48')]=_0x9b1b01[_0x0282('0x5b')];queues[_0x9b1b01[_0x0282('0x54')]][_0x0282('0x7')]='ATTENDEDTRANSFER';}if(!_[_0x0282('0x1a')](queues[_0x9b1b01['secondtransfererlinkedid']])){if(_0x9b1b01['transfertargetlinkedid']&&queues[_0x9b1b01['transfertargetlinkedid']]){queues[_0x9b1b01[_0x0282('0x5e')]][_0x0282('0x58')]=0x1;queues[_0x9b1b01[_0x0282('0x57')]]=_['clone'](queues[_0x9b1b01[_0x0282('0x5e')]]);queues[_0x9b1b01['transfertargetuniqueid']]['transfereduniqueid']=_0x9b1b01[_0x0282('0x57')];queues[_0x9b1b01[_0x0282('0x57')]][_0x0282('0x58')]=0x2;queues[_0x9b1b01[_0x0282('0x57')]][_0x0282('0x6')]=queues[_0x9b1b01[_0x0282('0x54')]][_0x0282('0x6')];queues[_0x9b1b01[_0x0282('0x57')]][_0x0282('0x59')]=queues[_0x9b1b01[_0x0282('0x54')]][_0x0282('0x59')];queues[_0x9b1b01[_0x0282('0x57')]][_0x0282('0x5f')]=utils[_0x0282('0x16')]();queues[_0x9b1b01['transfertargetuniqueid']][_0x0282('0x1c')]=utils['now']();queues[_0x9b1b01['transfertargetuniqueid']][_0x0282('0x33')]=0x0;queues[_0x9b1b01[_0x0282('0x57')]][_0x0282('0x5a')]=0x0;utils[_0x0282('0x12')](util[_0x0282('0x18')](_0x0282('0x60'),_0x9b1b01[_0x0282('0x4d')],queues[_0x9b1b01[_0x0282('0x57')]]['name'],queues[_0x9b1b01[_0x0282('0x57')]][_0x0282('0xd')],queues[_0x9b1b01['transfertargetuniqueid']]['calleridnum'],queues[_0x9b1b01[_0x0282('0x57')]][_0x0282('0x59')]));}else{utils[_0x0282('0x12')](util[_0x0282('0x18')](_0x0282('0x61'),_0x9b1b01['origtransfereruniqueid'],queues[_0x9b1b01[_0x0282('0x4e')]][_0x0282('0x20')],_0x9b1b01[_0x0282('0x54')]));queues[_0x9b1b01[_0x0282('0x4e')]][_0x0282('0xd')]=_0x9b1b01[_0x0282('0x54')];}}}}catch(_0x1461c9){utils[_0x0282('0x17')](util[_0x0282('0x18')]('[%s][queues][attendedtransfer]',_0x9b1b01['origtransfereruniqueid']),_0x1461c9);}};exports[_0x0282('0x62')]=function(_0x26424c){try{if(!_[_0x0282('0x1a')](queues[_0x26424c[_0x0282('0x11')]])){utils[_0x0282('0xf')](util[_0x0282('0x18')]('[%s][queues][musiconholdstart]',_0x26424c[_0x0282('0x11')]),_0x26424c);queues[_0x26424c[_0x0282('0x11')]][_0x0282('0x63')]=utils['now']();utils[_0x0282('0x12')](util[_0x0282('0x18')](_0x0282('0x64'),_0x26424c[_0x0282('0x11')],queues[_0x26424c[_0x0282('0x11')]][_0x0282('0x20')],queues[_0x26424c[_0x0282('0x11')]][_0x0282('0x63')]));}}catch(_0x1497a3){utils[_0x0282('0x17')](util['format'](_0x0282('0x65'),_0x26424c[_0x0282('0x11')]),_0x1497a3);}};exports[_0x0282('0x66')]=function(_0x23a9cd){try{if(!_[_0x0282('0x1a')](queues[_0x23a9cd[_0x0282('0x11')]])){if(!_['isNil'](queues[_0x23a9cd[_0x0282('0x11')]][_0x0282('0x63')])){utils['debug'](util[_0x0282('0x18')](_0x0282('0x67'),_0x23a9cd[_0x0282('0x11')]),_0x23a9cd);queues[_0x23a9cd[_0x0282('0x11')]][_0x0282('0x5a')]+=utils[_0x0282('0x34')](utils[_0x0282('0x16')](),queues[_0x23a9cd[_0x0282('0x11')]][_0x0282('0x63')]);utils['info'](util[_0x0282('0x18')](_0x0282('0x68'),_0x23a9cd[_0x0282('0x11')],queues[_0x23a9cd[_0x0282('0x11')]][_0x0282('0x20')],queues[_0x23a9cd[_0x0282('0x11')]]['mohtime']));delete queues[_0x23a9cd[_0x0282('0x11')]][_0x0282('0x63')];}}}catch(_0x241898){utils[_0x0282('0x17')](util[_0x0282('0x18')](_0x0282('0x67'),_0x23a9cd[_0x0282('0x11')]),_0x241898);}}; \ No newline at end of file +var _0xc3d9=['now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][hangup]','varset','value','CONTINUE','queuecallerabandonAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','position','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfereruniqueid','transfertype','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','error','format','[%s][queues][queuecallerjoin]','isNil','debug','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xc3d9,0x11e));var _0x9c3d=function(_0x210603,_0x4adbac){_0x210603=_0x210603-0x0;var _0x1bcb7d=_0xc3d9[_0x210603];return _0x1bcb7d;};'use strict';var _=require(_0x9c3d('0x0'));var util=require(_0x9c3d('0x1'));var utils=require(_0x9c3d('0x2'));var queues={};function writeDB(_0x5ac489){utils[_0x9c3d('0x3')](util['format'](_0x9c3d('0x4'),_0x5ac489['uniqueid'],_0x5ac489[_0x9c3d('0x5')],_0x5ac489[_0x9c3d('0x6')],_0x5ac489['lastAssignedTo'],_0x5ac489[_0x9c3d('0x7')],_0x5ac489[_0x9c3d('0x8')],_0x5ac489[_0x9c3d('0x9')]));if(_0x5ac489[_0x9c3d('0x6')]){utils[_0x9c3d('0xa')](_0x5ac489[_0x9c3d('0x6')])['then'](function(_0x570ba0){if(_0x570ba0){_0x5ac489['type']=_0x570ba0[_0x9c3d('0xb')];}utils[_0x9c3d('0xc')]('CreateVoiceQueueReport',_0x5ac489);});}else{utils['request'](_0x9c3d('0xd'),_0x5ac489);}if(_0x5ac489[_0x9c3d('0xe')]){delete queues[_0x5ac489['transfereduniqueid']];}else{delete queues[_0x5ac489[_0x9c3d('0xf')]];}}exports[_0x9c3d('0x10')]=function(_0x4c5f35){try{utils['debug'](util['format']('[%s][queues][queuecallerjoin]',_0x4c5f35[_0x9c3d('0xf')]),_0x4c5f35);utils[_0x9c3d('0x3')](util['format'](_0x9c3d('0x11'),_0x4c5f35[_0x9c3d('0xf')],_0x4c5f35['queue'],_0x4c5f35['position']));queues[_0x4c5f35['uniqueid']]=_[_0x9c3d('0x12')](_0x4c5f35,{'originalposition':_0x4c5f35['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x44ae4e){utils[_0x9c3d('0x13')](util[_0x9c3d('0x14')](_0x9c3d('0x15'),_0x4c5f35['uniqueid']),_0x44ae4e);}};exports['hangup']=function(_0x24c8ed){try{if(!_[_0x9c3d('0x16')](queues[_0x24c8ed[_0x9c3d('0xf')]])){utils[_0x9c3d('0x17')](util['format']('[%s][queues][hangup]',_0x24c8ed[_0x9c3d('0xf')]),_0x24c8ed);if(queues[_0x24c8ed[_0x9c3d('0xf')]][_0x9c3d('0x18')]){if(!queues[_0x24c8ed[_0x9c3d('0xf')]][_0x9c3d('0x19')]&&!queues[_0x24c8ed[_0x9c3d('0xf')]][_0x9c3d('0x1a')]){queues[_0x24c8ed[_0x9c3d('0xf')]][_0x9c3d('0x1b')]=!![];queues[_0x24c8ed['uniqueid']][_0x9c3d('0x1c')]=utils[_0x9c3d('0x1d')]();queues[_0x24c8ed[_0x9c3d('0xf')]][_0x9c3d('0x9')]=_0x9c3d('0x1e');}utils['info'](util[_0x9c3d('0x14')](_0x9c3d('0x1f'),_0x24c8ed[_0x9c3d('0xf')],queues[_0x24c8ed[_0x9c3d('0xf')]][_0x9c3d('0x20')],queues[_0x24c8ed[_0x9c3d('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x24c8ed[_0x9c3d('0xf')]]);}else if(queues[_0x24c8ed[_0x9c3d('0xf')]][_0x9c3d('0xe')]){utils[_0x9c3d('0x3')](util[_0x9c3d('0x14')](_0x9c3d('0x21'),_0x24c8ed[_0x9c3d('0xf')],queues[_0x24c8ed[_0x9c3d('0xf')]][_0x9c3d('0x20')],queues[_0x24c8ed['uniqueid']][_0x9c3d('0xe')]));queues[queues[_0x24c8ed[_0x9c3d('0xf')]][_0x9c3d('0xe')]]=queues[_0x24c8ed[_0x9c3d('0xf')]];queues[queues[_0x24c8ed[_0x9c3d('0xf')]][_0x9c3d('0xe')]]['queuecallerenterreason']=0x2;delete queues[_0x24c8ed[_0x9c3d('0xf')]];}}}catch(_0xb35469){utils[_0x9c3d('0x13')](util[_0x9c3d('0x14')](_0x9c3d('0x22'),_0x24c8ed[_0x9c3d('0xf')]),_0xb35469);}};exports[_0x9c3d('0x23')]=function(_0x59b81a){try{utils[_0x9c3d('0x17')](util[_0x9c3d('0x14')]('[%s][queues][varset]',_0x59b81a[_0x9c3d('0xf')]),_0x59b81a);if(!_['isNil'](_0x59b81a['variable']['queuestatus'])&&_0x59b81a[_0x9c3d('0x24')]['toUpperCase']()!==_0x9c3d('0x25')){if(!_[_0x9c3d('0x16')](queues[_0x59b81a[_0x9c3d('0xf')]])){queues[_0x59b81a['uniqueid']][_0x9c3d('0x19')]=![];queues[_0x59b81a[_0x9c3d('0xf')]][_0x9c3d('0x26')]=null;queues[_0x59b81a[_0x9c3d('0xf')]][_0x9c3d('0x1a')]=!![];queues[_0x59b81a[_0x9c3d('0xf')]]['queuecallerexitAt']=utils[_0x9c3d('0x1d')]();queues[_0x59b81a['uniqueid']][_0x9c3d('0x9')]=_0x59b81a[_0x9c3d('0x24')][_0x9c3d('0x27')]();utils[_0x9c3d('0x3')](util['format'](_0x9c3d('0x28'),_0x59b81a[_0x9c3d('0xf')],queues[_0x59b81a[_0x9c3d('0xf')]]['name'],_0x59b81a[_0x9c3d('0x24')],queues[_0x59b81a[_0x9c3d('0xf')]][_0x9c3d('0x9')]));writeDB(queues[_0x59b81a[_0x9c3d('0xf')]]);}}else if(!_[_0x9c3d('0x16')](_0x59b81a[_0x9c3d('0x29')]['queueposition'])){if(!_[_0x9c3d('0x16')](queues[_0x59b81a[_0x9c3d('0xf')]])&&!queues[_0x59b81a[_0x9c3d('0xf')]][_0x9c3d('0x19')]){queues[_0x59b81a[_0x9c3d('0xf')]][_0x9c3d('0x19')]=![];queues[_0x59b81a[_0x9c3d('0xf')]][_0x9c3d('0x26')]=null;queues[_0x59b81a[_0x9c3d('0xf')]][_0x9c3d('0x1a')]=!![];queues[_0x59b81a[_0x9c3d('0xf')]][_0x9c3d('0x2a')]=utils[_0x9c3d('0x1d')]();queues[_0x59b81a[_0x9c3d('0xf')]]['queuecallerexitreason']='EXITWITHKEY';utils[_0x9c3d('0x3')](util[_0x9c3d('0x14')](_0x9c3d('0x2b'),_0x59b81a['uniqueid'],queues[_0x59b81a[_0x9c3d('0xf')]][_0x9c3d('0x20')],_0x59b81a[_0x9c3d('0x24')],queues[_0x59b81a[_0x9c3d('0xf')]]['queuecallerexitreason']));}}}catch(_0x2a7962){utils[_0x9c3d('0x13')](util[_0x9c3d('0x14')](_0x9c3d('0x2c'),_0x59b81a[_0x9c3d('0xf')]),_0x2a7962);}};exports[_0x9c3d('0x19')]=function(_0xb670f5){try{if(!_['isNil'](queues[_0xb670f5['uniqueid']])){utils[_0x9c3d('0x17')](util[_0x9c3d('0x14')](_0x9c3d('0x2d'),_0xb670f5[_0x9c3d('0xf')]),_0xb670f5);queues[_0xb670f5[_0x9c3d('0xf')]][_0x9c3d('0x1a')]=![];queues[_0xb670f5[_0x9c3d('0xf')]]['queuecallerexitAt']=null;queues[_0xb670f5['uniqueid']][_0x9c3d('0x19')]=!![];queues[_0xb670f5[_0x9c3d('0xf')]]['queuecallerabandonAt']=utils[_0x9c3d('0x1d')]();queues[_0xb670f5[_0x9c3d('0xf')]][_0x9c3d('0x9')]='ABANDONED';utils[_0x9c3d('0x3')](util[_0x9c3d('0x14')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0xb670f5[_0x9c3d('0xf')],queues[_0xb670f5[_0x9c3d('0xf')]][_0x9c3d('0x20')],queues[_0xb670f5[_0x9c3d('0xf')]]['queuecallerexitreason']));}}catch(_0x8e62cc){utils[_0x9c3d('0x13')](util[_0x9c3d('0x14')](_0x9c3d('0x2d'),_0xb670f5[_0x9c3d('0xf')]),_0x8e62cc);}};exports[_0x9c3d('0x2e')]=function(_0x1367ca){try{if(!_[_0x9c3d('0x16')](queues[_0x1367ca[_0x9c3d('0xf')]])){utils[_0x9c3d('0x17')](util[_0x9c3d('0x14')](_0x9c3d('0x2f'),_0x1367ca[_0x9c3d('0xf')]),_0x1367ca);utils[_0x9c3d('0x3')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x1367ca[_0x9c3d('0xf')],queues[_0x1367ca[_0x9c3d('0xf')]][_0x9c3d('0x20')],_0x1367ca[_0x9c3d('0x30')],_0x1367ca[_0x9c3d('0x31')]));queues[_0x1367ca['uniqueid']][_0x9c3d('0x2e')]=!![];queues[_0x1367ca['uniqueid']][_0x9c3d('0x18')]=utils['now']();queues[_0x1367ca[_0x9c3d('0xf')]][_0x9c3d('0x32')]=utils[_0x9c3d('0x33')](queues[_0x1367ca[_0x9c3d('0xf')]][_0x9c3d('0x18')],queues[_0x1367ca[_0x9c3d('0xf')]][_0x9c3d('0x34')]);queues[_0x1367ca[_0x9c3d('0xf')]]['position']=_0x1367ca[_0x9c3d('0x35')];queues[_0x1367ca[_0x9c3d('0xf')]]['count']=_0x1367ca['count'];queues[_0x1367ca[_0x9c3d('0xf')]][_0x9c3d('0x30')]=_0x1367ca['connectedlinenum'];queues[_0x1367ca['uniqueid']][_0x9c3d('0x31')]=_0x1367ca[_0x9c3d('0x31')];}}catch(_0xa5af1f){utils[_0x9c3d('0x13')](util['format'](_0x9c3d('0x2f'),_0x1367ca[_0x9c3d('0xf')]),_0xa5af1f);}};exports[_0x9c3d('0x36')]=function(_0x101892){try{if(!_['isNil'](queues[_0x101892[_0x9c3d('0xf')]])){utils[_0x9c3d('0x17')](util[_0x9c3d('0x14')](_0x9c3d('0x37'),_0x101892[_0x9c3d('0xf')]),_0x101892);utils[_0x9c3d('0x3')](util[_0x9c3d('0x14')](_0x9c3d('0x38'),_0x101892[_0x9c3d('0xf')],queues[_0x101892[_0x9c3d('0xf')]][_0x9c3d('0x20')],_0x101892[_0x9c3d('0x39')],_0x101892[_0x9c3d('0x3a')]));queues[_0x101892[_0x9c3d('0xf')]][_0x9c3d('0x19')]=![];queues[_0x101892[_0x9c3d('0xf')]][_0x9c3d('0x19')]=![];queues[_0x101892[_0x9c3d('0xf')]][_0x9c3d('0x26')]=null;queues[_0x101892['uniqueid']][_0x9c3d('0x1a')]=![];queues[_0x101892[_0x9c3d('0xf')]][_0x9c3d('0x9')]=null;queues[_0x101892[_0x9c3d('0xf')]][_0x9c3d('0x2a')]=null;queues[_0x101892[_0x9c3d('0xf')]]['assigned']=!![];queues[_0x101892['uniqueid']][_0x9c3d('0x8')]=_0x101892[_0x9c3d('0x3a')];queues[_0x101892[_0x9c3d('0xf')]][_0x9c3d('0x3b')]=_0x101892[_0x9c3d('0x39')];}}catch(_0x435aad){utils[_0x9c3d('0x13')](util[_0x9c3d('0x14')](_0x9c3d('0x37'),_0x101892['uniqueid']),_0x435aad);}};exports[_0x9c3d('0x3c')]=function(_0x5e259d){try{if(!_[_0x9c3d('0x16')](queues[_0x5e259d[_0x9c3d('0xf')]])){if(queues[_0x5e259d[_0x9c3d('0xf')]][_0x9c3d('0x18')]){utils['debug'](util[_0x9c3d('0x14')](_0x9c3d('0x3d'),_0x5e259d['uniqueid']),_0x5e259d);queues[_0x5e259d['uniqueid']]['queuecallerabandon']=![];queues[_0x5e259d[_0x9c3d('0xf')]][_0x9c3d('0x19')]=![];queues[_0x5e259d[_0x9c3d('0xf')]][_0x9c3d('0x26')]=null;queues[_0x5e259d[_0x9c3d('0xf')]][_0x9c3d('0x1a')]=![];queues[_0x5e259d[_0x9c3d('0xf')]][_0x9c3d('0x2a')]=null;queues[_0x5e259d[_0x9c3d('0xf')]][_0x9c3d('0x3e')]=!![];queues[_0x5e259d[_0x9c3d('0xf')]][_0x9c3d('0x3b')]=_0x5e259d[_0x9c3d('0x39')];queues[_0x5e259d['uniqueid']][_0x9c3d('0x1b')]=!![];queues[_0x5e259d['uniqueid']]['queuecallercompleteAt']=utils[_0x9c3d('0x1d')]();if(_0x5e259d[_0x9c3d('0x3f')]==_0x9c3d('0x40')){if(!queues[_0x5e259d[_0x9c3d('0xf')]][_0x9c3d('0x40')]){queues[_0x5e259d[_0x9c3d('0xf')]][_0x9c3d('0x9')]=_0x9c3d('0x41');}}else{queues[_0x5e259d[_0x9c3d('0xf')]][_0x9c3d('0x9')]=_0x9c3d('0x42')+_0x5e259d[_0x9c3d('0x3f')]['toUpperCase']();}utils['info'](util['format'](_0x9c3d('0x43'),_0x5e259d[_0x9c3d('0xf')],queues[_0x5e259d[_0x9c3d('0xf')]][_0x9c3d('0x20')],_0x5e259d[_0x9c3d('0x39')],queues[_0x5e259d['uniqueid']][_0x9c3d('0x9')]));writeDB(queues[_0x5e259d[_0x9c3d('0xf')]]);}}}catch(_0x2cfaf5){utils[_0x9c3d('0x13')](util[_0x9c3d('0x14')]('[%s][queues][agentcomplete]',_0x5e259d[_0x9c3d('0xf')]),_0x2cfaf5);}};exports['blindtransfer']=function(_0xdf7124){try{if(!_[_0x9c3d('0x16')](queues[_0xdf7124['transfereeuniqueid']])){utils[_0x9c3d('0x17')](util[_0x9c3d('0x14')](_0x9c3d('0x44'),_0xdf7124[_0x9c3d('0xf')]),_0xdf7124);queues[_0xdf7124[_0x9c3d('0x45')]][_0x9c3d('0x40')]=!![];queues[_0xdf7124[_0x9c3d('0x45')]]['transfertype']=_0x9c3d('0x46');queues[_0xdf7124[_0x9c3d('0x45')]][_0x9c3d('0x47')]=_0xdf7124[_0x9c3d('0x48')];queues[_0xdf7124[_0x9c3d('0x45')]][_0x9c3d('0x49')]=_0xdf7124[_0x9c3d('0x45')];queues[_0xdf7124[_0x9c3d('0x45')]][_0x9c3d('0x9')]=_0x9c3d('0x4a');utils['info'](util[_0x9c3d('0x14')](_0x9c3d('0x4b'),_0xdf7124['uniqueid'],queues[_0xdf7124[_0x9c3d('0x45')]][_0x9c3d('0x20')],_0xdf7124[_0x9c3d('0x45')],_0xdf7124[_0x9c3d('0x48')]));}}catch(_0x4be43a){utils[_0x9c3d('0x13')](util['format'](_0x9c3d('0x44'),_0xdf7124['uniqueid']),_0x4be43a);}};exports['attendedtransfer']=function(_0x1c18eb){try{utils['debug'](util[_0x9c3d('0x14')](_0x9c3d('0x4c'),_0x1c18eb['origtransfereruniqueid']),_0x1c18eb);if(_0x1c18eb['origtransfereruniqueid']==_0x1c18eb[_0x9c3d('0x4d')]){if(!_[_0x9c3d('0x16')](queues[_0x1c18eb[_0x9c3d('0x4e')]])){utils[_0x9c3d('0x3')](util[_0x9c3d('0x14')](_0x9c3d('0x4f'),_0x1c18eb[_0x9c3d('0x50')],queues[_0x1c18eb[_0x9c3d('0x4e')]]['name'],_0x1c18eb['origtransfererexten']));queues[_0x1c18eb[_0x9c3d('0x4e')]][_0x9c3d('0x40')]=!![];queues[_0x1c18eb['secondtransfererlinkedid']][_0x9c3d('0x51')]='ATTENDED';queues[_0x1c18eb[_0x9c3d('0x4e')]][_0x9c3d('0x47')]=_0x1c18eb[_0x9c3d('0x52')];queues[_0x1c18eb[_0x9c3d('0x4e')]][_0x9c3d('0x49')]=_0x1c18eb[_0x9c3d('0x50')];queues[_0x1c18eb[_0x9c3d('0x4e')]]['queuecallerexitreason']=_0x9c3d('0x53');}if(!_[_0x9c3d('0x16')](queues[_0x1c18eb[_0x9c3d('0x4d')]])){if(_0x1c18eb['transfereelinkedid']&&queues[_0x1c18eb[_0x9c3d('0x54')]]){queues[_0x1c18eb[_0x9c3d('0x54')]][_0x9c3d('0x55')]=0x1;queues[_0x1c18eb['transfereeuniqueid']]=_[_0x9c3d('0x56')](queues[_0x1c18eb[_0x9c3d('0x54')]]);queues[_0x1c18eb['transfereeuniqueid']][_0x9c3d('0xe')]=_0x1c18eb[_0x9c3d('0x57')];queues[_0x1c18eb[_0x9c3d('0x45')]]['queuecallerenterreason']=0x2;queues[_0x1c18eb[_0x9c3d('0x45')]][_0x9c3d('0x7')]=queues[_0x1c18eb[_0x9c3d('0x4e')]][_0x9c3d('0x7')];queues[_0x1c18eb['transfereeuniqueid']][_0x9c3d('0x58')]=queues[_0x1c18eb[_0x9c3d('0x4e')]][_0x9c3d('0x58')];queues[_0x1c18eb[_0x9c3d('0x45')]]['queuecallerjoinAt']=utils['now']();queues[_0x1c18eb['transfereeuniqueid']][_0x9c3d('0x18')]=utils[_0x9c3d('0x1d')]();queues[_0x1c18eb[_0x9c3d('0x45')]][_0x9c3d('0x32')]=0x0;queues[_0x1c18eb['transfereeuniqueid']][_0x9c3d('0x59')]=0x0;utils[_0x9c3d('0x3')](util[_0x9c3d('0x14')](_0x9c3d('0x5a'),_0x1c18eb[_0x9c3d('0x50')],queues[_0x1c18eb[_0x9c3d('0x45')]]['name'],queues[_0x1c18eb[_0x9c3d('0x45')]][_0x9c3d('0x7')],queues[_0x1c18eb['transfereeuniqueid']]['calleridname']));}else{utils[_0x9c3d('0x3')](util[_0x9c3d('0x14')](_0x9c3d('0x5b'),_0x1c18eb[_0x9c3d('0x50')],queues[_0x1c18eb[_0x9c3d('0x4d')]][_0x9c3d('0x20')],_0x1c18eb[_0x9c3d('0x4e')]));queues[_0x1c18eb[_0x9c3d('0x4d')]][_0x9c3d('0xe')]=_0x1c18eb[_0x9c3d('0x4e')];}}}else if(_0x1c18eb[_0x9c3d('0x5c')]==_0x1c18eb[_0x9c3d('0x4e')]){if(!_['isNil'](queues[_0x1c18eb[_0x9c3d('0x4d')]])){utils[_0x9c3d('0x3')](util[_0x9c3d('0x14')](_0x9c3d('0x5d'),_0x1c18eb[_0x9c3d('0x50')],queues[_0x1c18eb[_0x9c3d('0x4d')]][_0x9c3d('0x20')],_0x1c18eb[_0x9c3d('0x5c')],_0x1c18eb[_0x9c3d('0x5e')]));queues[_0x1c18eb[_0x9c3d('0x4d')]]['transfer']=!![];queues[_0x1c18eb[_0x9c3d('0x4d')]][_0x9c3d('0x51')]=_0x9c3d('0x5f');queues[_0x1c18eb[_0x9c3d('0x4d')]][_0x9c3d('0x47')]=_0x1c18eb[_0x9c3d('0x5e')];queues[_0x1c18eb[_0x9c3d('0x4d')]]['transferuniqueid']=_0x1c18eb[_0x9c3d('0x5c')];queues[_0x1c18eb['origtransfererlinkedid']][_0x9c3d('0x9')]=_0x9c3d('0x53');}if(!_[_0x9c3d('0x16')](queues[_0x1c18eb['secondtransfererlinkedid']])){if(_0x1c18eb[_0x9c3d('0x60')]&&queues[_0x1c18eb[_0x9c3d('0x60')]]){queues[_0x1c18eb['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x1c18eb[_0x9c3d('0x57')]]=_[_0x9c3d('0x56')](queues[_0x1c18eb[_0x9c3d('0x60')]]);queues[_0x1c18eb['transfertargetuniqueid']][_0x9c3d('0xe')]=_0x1c18eb[_0x9c3d('0x57')];queues[_0x1c18eb['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x1c18eb[_0x9c3d('0x57')]][_0x9c3d('0x7')]=queues[_0x1c18eb[_0x9c3d('0x4d')]][_0x9c3d('0x7')];queues[_0x1c18eb[_0x9c3d('0x57')]][_0x9c3d('0x58')]=queues[_0x1c18eb['origtransfererlinkedid']][_0x9c3d('0x58')];queues[_0x1c18eb[_0x9c3d('0x57')]][_0x9c3d('0x34')]=utils[_0x9c3d('0x1d')]();queues[_0x1c18eb[_0x9c3d('0x57')]][_0x9c3d('0x18')]=utils[_0x9c3d('0x1d')]();queues[_0x1c18eb[_0x9c3d('0x57')]]['holdtime']=0x0;queues[_0x1c18eb[_0x9c3d('0x57')]][_0x9c3d('0x59')]=0x0;utils['info'](util[_0x9c3d('0x14')](_0x9c3d('0x61'),_0x1c18eb[_0x9c3d('0x50')],queues[_0x1c18eb['transfertargetuniqueid']]['name'],queues[_0x1c18eb[_0x9c3d('0x57')]][_0x9c3d('0xe')],queues[_0x1c18eb[_0x9c3d('0x57')]]['calleridnum'],queues[_0x1c18eb[_0x9c3d('0x57')]][_0x9c3d('0x58')]));}else{utils['info'](util[_0x9c3d('0x14')](_0x9c3d('0x5b'),_0x1c18eb[_0x9c3d('0x50')],queues[_0x1c18eb[_0x9c3d('0x4e')]][_0x9c3d('0x20')],_0x1c18eb[_0x9c3d('0x4d')]));queues[_0x1c18eb[_0x9c3d('0x4e')]][_0x9c3d('0xe')]=_0x1c18eb[_0x9c3d('0x4d')];}}}}catch(_0x241df8){utils[_0x9c3d('0x13')](util[_0x9c3d('0x14')](_0x9c3d('0x4c'),_0x1c18eb[_0x9c3d('0x50')]),_0x241df8);}};exports[_0x9c3d('0x62')]=function(_0x23e474){try{if(!_[_0x9c3d('0x16')](queues[_0x23e474[_0x9c3d('0xf')]])){utils['debug'](util[_0x9c3d('0x14')](_0x9c3d('0x63'),_0x23e474[_0x9c3d('0xf')]),_0x23e474);queues[_0x23e474[_0x9c3d('0xf')]][_0x9c3d('0x64')]=utils[_0x9c3d('0x1d')]();utils[_0x9c3d('0x3')](util[_0x9c3d('0x14')](_0x9c3d('0x65'),_0x23e474[_0x9c3d('0xf')],queues[_0x23e474['uniqueid']][_0x9c3d('0x20')],queues[_0x23e474[_0x9c3d('0xf')]][_0x9c3d('0x64')]));}}catch(_0x21ada5){utils[_0x9c3d('0x13')](util[_0x9c3d('0x14')](_0x9c3d('0x63'),_0x23e474[_0x9c3d('0xf')]),_0x21ada5);}};exports[_0x9c3d('0x66')]=function(_0x5ae5c3){try{if(!_[_0x9c3d('0x16')](queues[_0x5ae5c3[_0x9c3d('0xf')]])){if(!_['isNil'](queues[_0x5ae5c3['uniqueid']]['musiconholdstartAt'])){utils[_0x9c3d('0x17')](util[_0x9c3d('0x14')](_0x9c3d('0x67'),_0x5ae5c3[_0x9c3d('0xf')]),_0x5ae5c3);queues[_0x5ae5c3[_0x9c3d('0xf')]][_0x9c3d('0x59')]+=utils[_0x9c3d('0x33')](utils[_0x9c3d('0x1d')](),queues[_0x5ae5c3[_0x9c3d('0xf')]]['musiconholdstartAt']);utils['info'](util['format'](_0x9c3d('0x68'),_0x5ae5c3[_0x9c3d('0xf')],queues[_0x5ae5c3[_0x9c3d('0xf')]][_0x9c3d('0x20')],queues[_0x5ae5c3[_0x9c3d('0xf')]][_0x9c3d('0x59')]));delete queues[_0x5ae5c3['uniqueid']][_0x9c3d('0x64')];}}}catch(_0x5e936e){utils[_0x9c3d('0x13')](util[_0x9c3d('0x14')](_0x9c3d('0x67'),_0x5ae5c3[_0x9c3d('0xf')]),_0x5e936e);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 03214f8..54b52ff 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 _0xf73d=['[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.WAV','find','monitors','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','[%s][recordings][newchannel]','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','debug','uniqueid','channelstate','varset','isNil','variable','mixmonitor_filename'];(function(_0x1e6cd9,_0x3dda89){var _0x53816c=function(_0x53ff9a){while(--_0x53ff9a){_0x1e6cd9['push'](_0x1e6cd9['shift']());}};_0x53816c(++_0x3dda89);}(_0xf73d,0x8e));var _0xdf73=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf73d[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xdf73('0x0'));var util=require(_0xdf73('0x1'));var utils=require(_0xdf73('0x2'));var recordings={};function writeDB(_0x2d75af){utils['info'](util[_0xdf73('0x3')](_0xdf73('0x4'),_0x2d75af['uniqueid']));if(_0x2d75af['accountcode']){utils[_0xdf73('0x5')](_0x2d75af[_0xdf73('0x6')])[_0xdf73('0x7')](function(_0x30c834){if(_0x30c834){_0x2d75af[_0xdf73('0x8')]=_0x30c834[_0xdf73('0x9')];_0x2d75af[_0xdf73('0xa')]=_0x30c834['id'];}utils[_0xdf73('0xb')]('CreateVoiceRecording',_0x2d75af);});}else{utils[_0xdf73('0xb')](_0xdf73('0xc'),_0x2d75af);}}exports['newchannel']=function(_0x13183f){try{utils['debug'](util[_0xdf73('0x3')](_0xdf73('0xd'),_0x13183f['uniqueid']),_0x13183f);if(_0x13183f['uniqueid']==_0x13183f[_0xdf73('0xe')]){utils[_0xdf73('0xf')](util[_0xdf73('0x3')](_0xdf73('0x10'),_0x13183f['uniqueid'],_0x13183f[_0xdf73('0x11')],_0x13183f[_0xdf73('0x12')]));recordings[_0x13183f['uniqueid']]={'uniqueid':_0x13183f['uniqueid'],'accountcode':_0x13183f['accountcode'],'exten':_0x13183f['exten'],'context':_0x13183f[_0xdf73('0x11')],'channel':_0x13183f[_0xdf73('0x13')],'monitors':[]};}}catch(_0x1223f1){utils[_0xdf73('0x14')](util[_0xdf73('0x3')]('[%s][recordings][newchannel]',_0x13183f['uniqueid']),_0x1223f1);}};exports[_0xdf73('0x15')]=function(_0x201046){try{utils[_0xdf73('0x16')](util[_0xdf73('0x3')]('[%s][recordings][newstate]',_0x201046[_0xdf73('0x17')]),_0x201046);if(!_['isNil'](recordings[_0x201046['uniqueid']])&&_0x201046[_0xdf73('0x18')]==0x6){utils[_0xdf73('0xf')](util[_0xdf73('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x201046[_0xdf73('0x17')],_0x201046[_0xdf73('0x11')],_0x201046['channel']));}else if(!_['isNil'](recordings[_0x201046['linkedid']])&&_0x201046['channelstate']==0x6&&_0x201046[_0xdf73('0x11')]!='transfer'){utils[_0xdf73('0xf')](util[_0xdf73('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x201046[_0xdf73('0x17')],_0x201046['linkedid'],_0x201046[_0xdf73('0x11')],_0x201046[_0xdf73('0x13')]));recordings[_0x201046['linkedid']]['accountcode']=_0x201046[_0xdf73('0x6')];}}catch(_0x301770){utils[_0xdf73('0x14')](util[_0xdf73('0x3')]('[%s][recordings][newstate]',_0x201046[_0xdf73('0x17')]),_0x301770);}};exports[_0xdf73('0x19')]=function(_0x3b61d7){try{if(!_[_0xdf73('0x1a')](_0x3b61d7[_0xdf73('0x1b')])&&!_[_0xdf73('0x1a')](_0x3b61d7['variable'][_0xdf73('0x1c')])){utils[_0xdf73('0x16')](util['format']('[%s][recordings][varset]',_0x3b61d7[_0xdf73('0x17')]),_0x3b61d7);utils['info'](util[_0xdf73('0x3')](_0xdf73('0x1d'),_0x3b61d7[_0xdf73('0x17')],_0x3b61d7[_0xdf73('0x1b')],_0x3b61d7[_0xdf73('0x1e')]));if(_[_0xdf73('0x1f')](_0x3b61d7[_0xdf73('0x1e')],'.wav49')){_0x3b61d7['value']=_0x3b61d7[_0xdf73('0x1e')][_0xdf73('0x20')]('.wav49',_0xdf73('0x21'));}if(recordings[_0x3b61d7[_0xdf73('0xe')]]){var _0x602686=_[_0xdf73('0x22')](recordings[_0x3b61d7[_0xdf73('0xe')]][_0xdf73('0x23')],{'value':_0x3b61d7[_0xdf73('0x1e')]});if(_[_0xdf73('0x1a')](_0x602686)){recordings[_0x3b61d7[_0xdf73('0xe')]][_0xdf73('0x23')]['push']({'value':_0x3b61d7[_0xdf73('0x1e')]});}}}}catch(_0x58d2eb){utils[_0xdf73('0x14')](util['format']('[%s][recordings][varset]',_0x3b61d7['uniqueid']),_0x58d2eb);}};exports['hangup']=function(_0x489b5b){try{if(!_[_0xdf73('0x1a')](recordings[_0x489b5b[_0xdf73('0x17')]])){utils[_0xdf73('0x16')](util[_0xdf73('0x3')]('[%s][recordings][hangup]',_0x489b5b[_0xdf73('0x17')]),_0x489b5b);utils['info'](util[_0xdf73('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x489b5b[_0xdf73('0x17')],_0x489b5b[_0xdf73('0x24')],_0x489b5b[_0xdf73('0x25')],_0x489b5b[_0xdf73('0x26')]));recordings[_0x489b5b[_0xdf73('0x17')]]['calleridnum']=_0x489b5b[_0xdf73('0x24')];recordings[_0x489b5b[_0xdf73('0x17')]][_0xdf73('0x25')]=_0x489b5b[_0xdf73('0x25')];recordings[_0x489b5b[_0xdf73('0x17')]][_0xdf73('0x27')]=_0x489b5b['connectedlinenum'];recordings[_0x489b5b[_0xdf73('0x17')]]['connectedlinename']=_0x489b5b[_0xdf73('0x28')];if(recordings[_0x489b5b[_0xdf73('0x17')]][_0xdf73('0x29')]==_0xdf73('0x2a')&&recordings[_0x489b5b['uniqueid']]['accountcode']){recordings[_0x489b5b['uniqueid']][_0xdf73('0x27')]=recordings[_0x489b5b['uniqueid']][_0xdf73('0x6')];recordings[_0x489b5b['uniqueid']][_0xdf73('0x28')]='';}recordings[_0x489b5b[_0xdf73('0x17')]]['monitors'][_0xdf73('0x2b')](function(_0x1712d4){var _0x53a1f7=_[_0xdf73('0x2c')](recordings[_0x489b5b[_0xdf73('0x17')]]);_0x53a1f7[_0xdf73('0x1e')]=_0x1712d4[_0xdf73('0x1e')];writeDB(_0x53a1f7);});delete recordings[_0x489b5b[_0xdf73('0x17')]];}}catch(_0x5822a4){utils[_0xdf73('0x14')](util[_0xdf73('0x3')](_0xdf73('0x2d'),_0x489b5b['uniqueid']),_0x5822a4);}};exports[_0xdf73('0x2e')]=function(_0x12883b){try{if(!_[_0xdf73('0x1a')](recordings[_0x12883b[_0xdf73('0x17')]])){utils[_0xdf73('0x16')](util[_0xdf73('0x3')](_0xdf73('0x2f'),_0x12883b[_0xdf73('0x17')]),_0x12883b);utils[_0xdf73('0xf')](util[_0xdf73('0x3')](_0xdf73('0x30'),_0x12883b[_0xdf73('0x17')],_0x12883b[_0xdf73('0x31')],_0x12883b[_0xdf73('0x32')]));if(_0x12883b[_0xdf73('0x31')][_0xdf73('0x33')]()=='set'&&_['startsWith'](_0x12883b[_0xdf73('0x32')][_0xdf73('0x33')](),_0xdf73('0x34'))){var _0x429775=_0x12883b[_0xdf73('0x32')]['split']('=');var _0x518519=_0x429775[0x0][_0xdf73('0x35')](_0x429775[0x0][_0xdf73('0x36')]('(')+0x1,_0x429775[0x0]['lastIndexOf'](')'));var _0x24ee95=_0x429775[0x1];recordings[_0x12883b[_0xdf73('0x17')]][_0x518519]=_0x24ee95;}}}catch(_0x1d38dd){utils[_0xdf73('0x14')](util[_0xdf73('0x3')](_0xdf73('0x2f'),_0x12883b[_0xdf73('0x17')]),_0x1d38dd);}};exports['queuecallerjoin']=function(_0x367403){try{if(!_[_0xdf73('0x1a')](recordings[_0x367403[_0xdf73('0x17')]])){utils[_0xdf73('0x16')](util['format'](_0xdf73('0x37'),_0x367403[_0xdf73('0x17')]),_0x367403);utils[_0xdf73('0xf')](util[_0xdf73('0x3')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x367403['uniqueid'],_0x367403[_0xdf73('0x38')]));recordings[_0x367403['uniqueid']][_0xdf73('0x38')]=_0x367403[_0xdf73('0x38')];}}catch(_0x2283a4){utils[_0xdf73('0x14')](util['format'](_0xdf73('0x37'),_0x367403[_0xdf73('0x17')]),_0x2283a4);}}; \ No newline at end of file +var _0x3e4c=['.wav49','replace','.WAV','find','monitors','[%s][recordings][varset]','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','calleridnum','connectedlinenum','connectedlinename','type','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','substring','lastIndexOf','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','name','UserId','CreateVoiceRecording','request','newchannel','format','[%s][recordings][newchannel]','uniqueid','linkedid','context','exten','channel','newstate','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith'];(function(_0x546b13,_0x26dd8e){var _0x2e2f59=function(_0x1dae94){while(--_0x1dae94){_0x546b13['push'](_0x546b13['shift']());}};_0x2e2f59(++_0x26dd8e);}(_0x3e4c,0xd2));var _0xc3e4=function(_0x8d1c66,_0x8ac8e){_0x8d1c66=_0x8d1c66-0x0;var _0x354bb0=_0x3e4c[_0x8d1c66];return _0x354bb0;};'use strict';var _=require(_0xc3e4('0x0'));var util=require(_0xc3e4('0x1'));var utils=require(_0xc3e4('0x2'));var recordings={};function writeDB(_0x485873){utils[_0xc3e4('0x3')](util['format'](_0xc3e4('0x4'),_0x485873['uniqueid']));if(_0x485873[_0xc3e4('0x5')]){utils[_0xc3e4('0x6')](_0x485873['accountcode'])[_0xc3e4('0x7')](function(_0x1db513){if(_0x1db513){_0x485873['membername']=_0x1db513[_0xc3e4('0x8')];_0x485873[_0xc3e4('0x9')]=_0x1db513['id'];}utils['request'](_0xc3e4('0xa'),_0x485873);});}else{utils[_0xc3e4('0xb')](_0xc3e4('0xa'),_0x485873);}}exports[_0xc3e4('0xc')]=function(_0xea75ad){try{utils['debug'](util[_0xc3e4('0xd')](_0xc3e4('0xe'),_0xea75ad[_0xc3e4('0xf')]),_0xea75ad);if(_0xea75ad[_0xc3e4('0xf')]==_0xea75ad[_0xc3e4('0x10')]){utils['info'](util[_0xc3e4('0xd')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0xea75ad[_0xc3e4('0xf')],_0xea75ad[_0xc3e4('0x11')],_0xea75ad[_0xc3e4('0x12')]));recordings[_0xea75ad[_0xc3e4('0xf')]]={'uniqueid':_0xea75ad[_0xc3e4('0xf')],'accountcode':_0xea75ad[_0xc3e4('0x5')],'exten':_0xea75ad[_0xc3e4('0x12')],'context':_0xea75ad[_0xc3e4('0x11')],'channel':_0xea75ad[_0xc3e4('0x13')],'monitors':[]};}}catch(_0x170867){utils['error'](util[_0xc3e4('0xd')](_0xc3e4('0xe'),_0xea75ad[_0xc3e4('0xf')]),_0x170867);}};exports[_0xc3e4('0x14')]=function(_0x342cbf){try{utils[_0xc3e4('0x15')](util[_0xc3e4('0xd')](_0xc3e4('0x16'),_0x342cbf[_0xc3e4('0xf')]),_0x342cbf);if(!_[_0xc3e4('0x17')](recordings[_0x342cbf['uniqueid']])&&_0x342cbf[_0xc3e4('0x18')]==0x6){utils[_0xc3e4('0x3')](util[_0xc3e4('0xd')](_0xc3e4('0x19'),_0x342cbf[_0xc3e4('0xf')],_0x342cbf[_0xc3e4('0x11')],_0x342cbf['channel']));}else if(!_[_0xc3e4('0x17')](recordings[_0x342cbf[_0xc3e4('0x10')]])&&_0x342cbf['channelstate']==0x6&&_0x342cbf[_0xc3e4('0x11')]!=_0xc3e4('0x1a')){utils[_0xc3e4('0x3')](util[_0xc3e4('0xd')](_0xc3e4('0x1b'),_0x342cbf[_0xc3e4('0xf')],_0x342cbf[_0xc3e4('0x10')],_0x342cbf[_0xc3e4('0x11')],_0x342cbf[_0xc3e4('0x13')]));recordings[_0x342cbf['linkedid']][_0xc3e4('0x5')]=_0x342cbf[_0xc3e4('0x5')];}}catch(_0x2565b6){utils[_0xc3e4('0x1c')](util[_0xc3e4('0xd')](_0xc3e4('0x16'),_0x342cbf[_0xc3e4('0xf')]),_0x2565b6);}};exports['varset']=function(_0x1fe8a2){try{if(!_['isNil'](_0x1fe8a2['variable'])&&!_['isNil'](_0x1fe8a2[_0xc3e4('0x1d')][_0xc3e4('0x1e')])){utils['debug'](util[_0xc3e4('0xd')]('[%s][recordings][varset]',_0x1fe8a2[_0xc3e4('0xf')]),_0x1fe8a2);utils[_0xc3e4('0x3')](util[_0xc3e4('0xd')](_0xc3e4('0x1f'),_0x1fe8a2[_0xc3e4('0xf')],_0x1fe8a2['variable'],_0x1fe8a2[_0xc3e4('0x20')]));if(_[_0xc3e4('0x21')](_0x1fe8a2[_0xc3e4('0x20')],_0xc3e4('0x22'))){_0x1fe8a2[_0xc3e4('0x20')]=_0x1fe8a2['value'][_0xc3e4('0x23')]('.wav49',_0xc3e4('0x24'));}if(recordings[_0x1fe8a2['linkedid']]){var _0x1235da=_[_0xc3e4('0x25')](recordings[_0x1fe8a2[_0xc3e4('0x10')]]['monitors'],{'value':_0x1fe8a2[_0xc3e4('0x20')]});if(_['isNil'](_0x1235da)){recordings[_0x1fe8a2['linkedid']][_0xc3e4('0x26')]['push']({'value':_0x1fe8a2['value']});}}}}catch(_0x47c2ed){utils['error'](util[_0xc3e4('0xd')](_0xc3e4('0x27'),_0x1fe8a2[_0xc3e4('0xf')]),_0x47c2ed);}};exports['hangup']=function(_0x586d06){try{if(!_['isNil'](recordings[_0x586d06['uniqueid']])){utils[_0xc3e4('0x15')](util[_0xc3e4('0xd')](_0xc3e4('0x28'),_0x586d06[_0xc3e4('0xf')]),_0x586d06);utils['info'](util[_0xc3e4('0xd')](_0xc3e4('0x29'),_0x586d06[_0xc3e4('0xf')],_0x586d06['calleridnum'],_0x586d06[_0xc3e4('0x2a')],_0x586d06['cause-txt']));recordings[_0x586d06[_0xc3e4('0xf')]][_0xc3e4('0x2b')]=_0x586d06['calleridnum'];recordings[_0x586d06['uniqueid']]['calleridname']=_0x586d06[_0xc3e4('0x2a')];recordings[_0x586d06[_0xc3e4('0xf')]]['connectedlinenum']=_0x586d06[_0xc3e4('0x2c')];recordings[_0x586d06[_0xc3e4('0xf')]][_0xc3e4('0x2d')]=_0x586d06[_0xc3e4('0x2d')];if(recordings[_0x586d06['uniqueid']][_0xc3e4('0x2e')]=='outbound'&&recordings[_0x586d06['uniqueid']][_0xc3e4('0x5')]){recordings[_0x586d06['uniqueid']][_0xc3e4('0x2c')]=recordings[_0x586d06[_0xc3e4('0xf')]][_0xc3e4('0x5')];recordings[_0x586d06[_0xc3e4('0xf')]][_0xc3e4('0x2d')]='';}recordings[_0x586d06['uniqueid']][_0xc3e4('0x26')][_0xc3e4('0x2f')](function(_0x21245e){var _0x5c977d=_['clone'](recordings[_0x586d06[_0xc3e4('0xf')]]);_0x5c977d['value']=_0x21245e['value'];writeDB(_0x5c977d);});delete recordings[_0x586d06[_0xc3e4('0xf')]];}}catch(_0x39776d){utils[_0xc3e4('0x1c')](util['format']('[%s][recordings][hangup]',_0x586d06[_0xc3e4('0xf')]),_0x39776d);}};exports[_0xc3e4('0x30')]=function(_0x8cdd25){try{if(!_[_0xc3e4('0x17')](recordings[_0x8cdd25['uniqueid']])){utils[_0xc3e4('0x15')](util[_0xc3e4('0xd')](_0xc3e4('0x31'),_0x8cdd25[_0xc3e4('0xf')]),_0x8cdd25);utils['info'](util['format'](_0xc3e4('0x32'),_0x8cdd25[_0xc3e4('0xf')],_0x8cdd25[_0xc3e4('0x33')],_0x8cdd25[_0xc3e4('0x34')]));if(_0x8cdd25[_0xc3e4('0x33')]['toLowerCase']()==_0xc3e4('0x35')&&_[_0xc3e4('0x36')](_0x8cdd25[_0xc3e4('0x34')][_0xc3e4('0x37')](),_0xc3e4('0x38'))){var _0x59051b=_0x8cdd25[_0xc3e4('0x34')]['split']('=');var _0x5dd79d=_0x59051b[0x0][_0xc3e4('0x39')](_0x59051b[0x0][_0xc3e4('0x3a')]('(')+0x1,_0x59051b[0x0][_0xc3e4('0x3a')](')'));var _0x3cc7dd=_0x59051b[0x1];recordings[_0x8cdd25[_0xc3e4('0xf')]][_0x5dd79d]=_0x3cc7dd;}}}catch(_0x1e51b2){utils[_0xc3e4('0x1c')](util[_0xc3e4('0xd')](_0xc3e4('0x31'),_0x8cdd25[_0xc3e4('0xf')]),_0x1e51b2);}};exports['queuecallerjoin']=function(_0x38b566){try{if(!_[_0xc3e4('0x17')](recordings[_0x38b566[_0xc3e4('0xf')]])){utils[_0xc3e4('0x15')](util[_0xc3e4('0xd')]('[%s][recordings][queuecallerjoin]',_0x38b566[_0xc3e4('0xf')]),_0x38b566);utils['info'](util[_0xc3e4('0xd')](_0xc3e4('0x3b'),_0x38b566[_0xc3e4('0xf')],_0x38b566['queue']));recordings[_0x38b566['uniqueid']][_0xc3e4('0x3c')]=_0x38b566[_0xc3e4('0x3c')];}}catch(_0x4d0724){utils['error'](util[_0xc3e4('0xd')]('[%s][recordings][queuecallerjoin]',_0x38b566[_0xc3e4('0xf')]),_0x4d0724);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 6baa4c8..75f4797 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 _0xb331=['debug','transferercalleridnum','transferercalleridname','transfereecalleridname','blinds','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','type','attended','uniqueid','request','CreateVoiceTransferReport'];(function(_0x1f7243,_0x3e5be3){var _0x4d7ad6=function(_0xa54525){while(--_0xa54525){_0x1f7243['push'](_0x1f7243['shift']());}};_0x4d7ad6(++_0x3e5be3);}(_0xb331,0xc3));var _0x1b33=function(_0x341616,_0x300e68){_0x341616=_0x341616-0x0;var _0x4b9fc0=_0xb331[_0x341616];return _0x4b9fc0;};'use strict';var _=require(_0x1b33('0x0'));var util=require(_0x1b33('0x1'));var utils=require(_0x1b33('0x2'));function writeDB(_0x315437){utils[_0x1b33('0x3')](util[_0x1b33('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0x315437[_0x1b33('0x5')]===_0x1b33('0x6')?_0x315437['origtransfereruniqueid']:_0x315437[_0x1b33('0x7')],_0x315437['type']));utils[_0x1b33('0x8')](_0x1b33('0x9'),_0x315437);}exports['blinds']={};exports['blindtransfer']=function(_0x38ffb3){try{utils[_0x1b33('0xa')](util[_0x1b33('0x4')]('[%s][transfers][blindtransfer]',_0x38ffb3['uniqueid']),_0x38ffb3);utils[_0x1b33('0x3')](util[_0x1b33('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x38ffb3[_0x1b33('0x7')],_0x38ffb3[_0x1b33('0xb')],_0x38ffb3[_0x1b33('0xc')],_0x38ffb3['transfereecalleridnum'],_0x38ffb3[_0x1b33('0xd')]));_0x38ffb3[_0x1b33('0x5')]='blind';exports[_0x1b33('0xe')][_0x38ffb3['transfereruniqueid']]=_0x38ffb3;writeDB(_0x38ffb3);}catch(_0x3fdb8d){utils[_0x1b33('0xf')](util['format'](_0x1b33('0x10'),_0x38ffb3[_0x1b33('0x7')]),_0x3fdb8d);}};exports[_0x1b33('0x11')]=function(_0x54a952){try{utils[_0x1b33('0xa')](util['format'](_0x1b33('0x12'),_0x54a952[_0x1b33('0x13')]),_0x54a952);utils[_0x1b33('0x3')](util[_0x1b33('0x4')](_0x1b33('0x14'),_0x54a952[_0x1b33('0x13')],_0x54a952[_0x1b33('0x15')],_0x54a952[_0x1b33('0x16')],_0x54a952[_0x1b33('0x17')],_0x54a952[_0x1b33('0x18')]));_0x54a952=_[_0x1b33('0x19')](_0x54a952,{'transfererchannel':_0x54a952[_0x1b33('0x1a')],'transferercalleridnum':_0x54a952[_0x1b33('0x15')],'transferercalleridname':_0x54a952[_0x1b33('0x16')],'transfererconnectedlinenum':_0x54a952[_0x1b33('0x1b')],'transfererconnectedlinename':_0x54a952[_0x1b33('0x1c')],'transfereraccountcode':_0x54a952[_0x1b33('0x1d')],'transferercontext':_0x54a952[_0x1b33('0x1e')],'transfererexten':_0x54a952[_0x1b33('0x1f')],'transfererlinkedid':_0x54a952[_0x1b33('0x20')],'context':_0x54a952[_0x1b33('0x21')],'extension':_0x54a952['origtransfererexten'],'type':_0x1b33('0x6')});if(_[_0x1b33('0x22')](_0x54a952[_0x1b33('0x23')])){_0x54a952=_[_0x1b33('0x19')](_0x54a952,{'transfereechannel':_0x54a952[_0x1b33('0x24')],'transfereecalleridnum':_0x54a952[_0x1b33('0x17')],'transfereecalleridname':_0x54a952['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x54a952['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x54a952[_0x1b33('0x25')],'transfereeaccountcode':_0x54a952['transfertargetaccountcode'],'transfereecontext':_0x54a952[_0x1b33('0x26')],'transfereeexten':_0x54a952[_0x1b33('0x27')],'transfereelinkedid':_0x54a952[_0x1b33('0x28')]});}writeDB(_0x54a952);}catch(_0x4a3189){utils['error'](util[_0x1b33('0x4')](_0x1b33('0x12'),_0x54a952['origtransfereruniqueid']),_0x4a3189);}}; \ No newline at end of file +var _0x0ffa=['CreateVoiceTransferReport','blinds','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended'];(function(_0xd45961,_0x5afb73){var _0x365644=function(_0x21cdbb){while(--_0x21cdbb){_0xd45961['push'](_0xd45961['shift']());}};_0x365644(++_0x5afb73);}(_0x0ffa,0x16b));var _0xa0ff=function(_0x2378fd,_0x1860a0){_0x2378fd=_0x2378fd-0x0;var _0x5765a1=_0x0ffa[_0x2378fd];return _0x5765a1;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xa0ff('0x0'));function writeDB(_0x2069c3){utils[_0xa0ff('0x1')](util[_0xa0ff('0x2')](_0xa0ff('0x3'),_0x2069c3[_0xa0ff('0x4')]===_0xa0ff('0x5')?_0x2069c3['origtransfereruniqueid']:_0x2069c3['uniqueid'],_0x2069c3[_0xa0ff('0x4')]));utils['request'](_0xa0ff('0x6'),_0x2069c3);}exports[_0xa0ff('0x7')]={};exports['blindtransfer']=function(_0x2785d4){try{utils[_0xa0ff('0x8')](util[_0xa0ff('0x2')](_0xa0ff('0x9'),_0x2785d4['uniqueid']),_0x2785d4);utils[_0xa0ff('0x1')](util['format'](_0xa0ff('0xa'),_0x2785d4[_0xa0ff('0xb')],_0x2785d4[_0xa0ff('0xc')],_0x2785d4[_0xa0ff('0xd')],_0x2785d4[_0xa0ff('0xe')],_0x2785d4[_0xa0ff('0xf')]));_0x2785d4[_0xa0ff('0x4')]=_0xa0ff('0x10');exports[_0xa0ff('0x7')][_0x2785d4[_0xa0ff('0x11')]]=_0x2785d4;writeDB(_0x2785d4);}catch(_0x296af6){utils[_0xa0ff('0x12')](util[_0xa0ff('0x2')]('[%s][transfers][blindtransfer]',_0x2785d4[_0xa0ff('0xb')]),_0x296af6);}};exports['attendedtransfer']=function(_0x4ab5aa){try{utils[_0xa0ff('0x8')](util[_0xa0ff('0x2')](_0xa0ff('0x13'),_0x4ab5aa[_0xa0ff('0x14')]),_0x4ab5aa);utils[_0xa0ff('0x1')](util[_0xa0ff('0x2')](_0xa0ff('0x15'),_0x4ab5aa['origtransfereruniqueid'],_0x4ab5aa[_0xa0ff('0x16')],_0x4ab5aa[_0xa0ff('0x17')],_0x4ab5aa[_0xa0ff('0x18')],_0x4ab5aa[_0xa0ff('0x19')]));_0x4ab5aa=_[_0xa0ff('0x1a')](_0x4ab5aa,{'transfererchannel':_0x4ab5aa[_0xa0ff('0x1b')],'transferercalleridnum':_0x4ab5aa[_0xa0ff('0x16')],'transferercalleridname':_0x4ab5aa[_0xa0ff('0x17')],'transfererconnectedlinenum':_0x4ab5aa['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4ab5aa[_0xa0ff('0x1c')],'transfereraccountcode':_0x4ab5aa[_0xa0ff('0x1d')],'transferercontext':_0x4ab5aa[_0xa0ff('0x1e')],'transfererexten':_0x4ab5aa[_0xa0ff('0x1f')],'transfererlinkedid':_0x4ab5aa[_0xa0ff('0x20')],'context':_0x4ab5aa[_0xa0ff('0x21')],'extension':_0x4ab5aa[_0xa0ff('0x22')],'type':'attended'});if(_[_0xa0ff('0x23')](_0x4ab5aa[_0xa0ff('0x24')])){_0x4ab5aa=_['assign'](_0x4ab5aa,{'transfereechannel':_0x4ab5aa['transfertargetchannel'],'transfereecalleridnum':_0x4ab5aa['transfertargetcalleridnum'],'transfereecalleridname':_0x4ab5aa[_0xa0ff('0x19')],'transfereeconnectedlinenum':_0x4ab5aa['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4ab5aa[_0xa0ff('0x25')],'transfereeaccountcode':_0x4ab5aa[_0xa0ff('0x26')],'transfereecontext':_0x4ab5aa['transfertargetcontext'],'transfereeexten':_0x4ab5aa[_0xa0ff('0x27')],'transfereelinkedid':_0x4ab5aa[_0xa0ff('0x28')]});}writeDB(_0x4ab5aa);}catch(_0x47f479){utils[_0xa0ff('0x12')](util[_0xa0ff('0x2')](_0xa0ff('0x13'),_0x4ab5aa[_0xa0ff('0x14')]),_0x47f479);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index f61999d..f37fe77 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 _0x0a05=['add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','info','inspect','debug','error','request','then','catch','[utils][request]\x20name:%s','GetUser','internal','name','interface','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x0a05,0x9e));var _0x50a0=function(_0x1e5068,_0x31e9c4){_0x1e5068=_0x1e5068-0x0;var _0x2230b6=_0x0a05[_0x1e5068];return _0x2230b6;};'use strict';var BPromise=require(_0x50a0('0x0'));var jayson=require(_0x50a0('0x1'));var moment=require(_0x50a0('0x2'));var util=require(_0x50a0('0x3'));var client=jayson[_0x50a0('0x4')][_0x50a0('0x5')]({'port':0x2329});var logger=require(_0x50a0('0x6'))('xdr');exports[_0x50a0('0x7')]=function(_0x5e03f2,_0x901f3){logger['info'](_0x5e03f2,_0x901f3?util[_0x50a0('0x8')](_0x901f3,{'showHidden':![],'depth':null}):'');};exports[_0x50a0('0x9')]=function(_0x4b976d,_0x56503f){logger[_0x50a0('0x9')](_0x4b976d,_0x56503f?util[_0x50a0('0x8')](_0x56503f,{'showHidden':![],'depth':null}):'');};exports[_0x50a0('0xa')]=function(_0x2ea146,_0x5d6056){logger[_0x50a0('0xa')](_0x2ea146,_0x5d6056?util['inspect'](_0x5d6056,{'showHidden':![],'depth':null}):'');};exports[_0x50a0('0xb')]=function(_0x136e4b,_0x39a17e){return client['request'](_0x136e4b,{'body':_0x39a17e})[_0x50a0('0xc')](function(_0x4ce087){logger[_0x50a0('0x9')]('[utils][request]\x20name:%s',_0x136e4b,_0x4ce087?util['inspect'](_0x4ce087,{'showHidden':![],'depth':null}):'');})[_0x50a0('0xd')](function(_0x3da025){logger[_0x50a0('0xa')](_0x50a0('0xe'),_0x136e4b,_0x3da025?util[_0x50a0('0x8')](_0x3da025,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5eadb1){return client[_0x50a0('0xb')](_0x50a0('0xf'),{'options':{'raw':!![],'attributes':['id',_0x50a0('0x10'),_0x50a0('0x11'),_0x50a0('0x12')],'where':_0x5eadb1,'limit':0x1}})['then'](function(_0x4db16e){logger['debug']('[utils][getUser]\x20where:%s',JSON[_0x50a0('0x13')](_0x5eadb1),_0x4db16e?util[_0x50a0('0x8')](_0x4db16e,{'showHidden':![],'depth':null}):'');return _0x4db16e[_0x50a0('0x14')][_0x50a0('0x15')]?_0x4db16e[_0x50a0('0x14')][0x0]:null;});}exports[_0x50a0('0x16')]=function(_0x4a9c6f){return new BPromise(function(_0x4e2e05,_0x4303b1){if(_0x4a9c6f){return getUser({'internal':_0x4a9c6f})[_0x50a0('0xc')](function(_0x195a58){logger[_0x50a0('0x7')](_0x50a0('0x17'),_0x4a9c6f,_0x195a58?'found':_0x50a0('0x18'));return _0x4e2e05(_0x195a58);})['catch'](function(_0x2603f1){logger[_0x50a0('0xa')](_0x50a0('0x19'),_0x2603f1?util[_0x50a0('0x8')](_0x2603f1,{'showHidden':![],'depth':null}):'');return _0x4e2e05(null);});}return _0x4e2e05(null);});};exports['getUserByInterface']=function(_0x62c40a){return new BPromise(function(_0x5bfbab,_0x22abda){if(_0x62c40a){return getUser({'interface':_0x62c40a})[_0x50a0('0xc')](function(_0x50d724){logger[_0x50a0('0x7')](_0x50a0('0x1a'),_0x62c40a,_0x50d724?_0x50a0('0x1b'):_0x50a0('0x18'));return _0x5bfbab(_0x50d724);})[_0x50a0('0xd')](function(_0x10ec8b){logger[_0x50a0('0xa')](_0x50a0('0x1c'),_0x10ec8b?util['inspect'](_0x10ec8b,{'showHidden':![],'depth':null}):'');return _0x5bfbab(null);});}return _0x5bfbab(null);});};exports['getUserByName']=function(_0x3378e2){return new BPromise(function(_0x44958b,_0xba9168){if(_0x3378e2){return getUser({'name':_0x3378e2})['then'](function(_0x40b91c){logger[_0x50a0('0x7')](_0x50a0('0x1d'),_0x3378e2,_0x40b91c?'found':_0x50a0('0x18'));return _0x44958b(_0x40b91c);})['catch'](function(_0x3d0b47){logger[_0x50a0('0xa')](_0x50a0('0x1e'),_0x3d0b47?util['inspect'](_0x3d0b47,{'showHidden':![],'depth':null}):'');return _0x44958b(null);});}return _0x44958b(null);});};exports[_0x50a0('0x1f')]=function(_0x2e0dd9){return new BPromise(function(_0x4654da,_0x532288){if(_0x2e0dd9){return client[_0x50a0('0xb')](_0x50a0('0x20'),{'options':{'raw':!![],'attributes':['id',_0x50a0('0x11'),_0x50a0('0x21'),'acw','acwTimeout'],'where':{'name':_0x2e0dd9},'limit':0x1}})['then'](function(_0x5524ae){logger[_0x50a0('0x9')](_0x50a0('0x22'),_0x2e0dd9,_0x5524ae?util[_0x50a0('0x8')](_0x5524ae,{'showHidden':![],'depth':null}):'');logger[_0x50a0('0x7')](_0x50a0('0x23'),_0x2e0dd9,_0x5524ae?_0x50a0('0x1b'):_0x50a0('0x18'));return _0x4654da(_0x5524ae['result']['length']?_0x5524ae[_0x50a0('0x14')][0x0]:null);})['catch'](function(_0x3e5b83){logger['error'](_0x50a0('0x24'),_0x3e5b83?util[_0x50a0('0x8')](_0x3e5b83,{'showHidden':![],'depth':null}):'');return _0x4654da(null);});}return _0x4654da(null);});};exports[_0x50a0('0x25')]=function(_0x37d2bb,_0xccbe26){return moment(_0x37d2bb)[_0x50a0('0x26')](_0xccbe26,_0x50a0('0x27'))[_0x50a0('0x28')](_0x50a0('0x29'));};exports[_0x50a0('0x2a')]=function(_0x2ceb96,_0x465e10){return moment(_0x2ceb96)['subtract'](_0x465e10,_0x50a0('0x27'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x50a0('0x2b')]=function(_0x10a6c3,_0x5dcd45){return moment(_0x10a6c3)[_0x50a0('0x2c')](moment(_0x5dcd45),_0x50a0('0x27'));};exports[_0x50a0('0x2d')]=function(_0x8eb59b,_0x234778){return parseInt(_0x8eb59b,0xa)+parseInt(_0x234778,0xa);};exports[_0x50a0('0x2e')]=function(){return moment()[_0x50a0('0x28')](_0x50a0('0x29'));};exports[_0x50a0('0x2f')]=function(_0x670899,_0x3a3301){if(_0x3a3301){return moment(_0x670899)[_0x50a0('0x2f')](_0x3a3301);}return!![];};exports[_0x50a0('0x30')]=function(_0x512d3d,_0x24729e){if(_0x24729e){return moment(_0x512d3d)[_0x50a0('0x30')](_0x24729e);}else if(_0x512d3d){return!![];}return![];}; \ No newline at end of file +var _0xed1f=['catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','subtract','diff','now','YYYY-MM-DD\x20HH:mm:ss','isAfter','isBefore','bluebird','jayson/promise','client','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','internal','name','[utils][getUser]\x20where:%s','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound'];(function(_0x7e21bc,_0x2bc22b){var _0x4877be=function(_0x13c17c){while(--_0x13c17c){_0x7e21bc['push'](_0x7e21bc['shift']());}};_0x4877be(++_0x2bc22b);}(_0xed1f,0x170));var _0xfed1=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xed1f[_0xe73080];return _0x12cbc4;};'use strict';var BPromise=require(_0xfed1('0x0'));var jayson=require(_0xfed1('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0xfed1('0x2')]['http']({'port':0x2329});var logger=require(_0xfed1('0x3'))('xdr');exports[_0xfed1('0x4')]=function(_0x423af3,_0x198341){logger[_0xfed1('0x4')](_0x423af3,_0x198341?util[_0xfed1('0x5')](_0x198341,{'showHidden':![],'depth':null}):'');};exports[_0xfed1('0x6')]=function(_0x471095,_0x396781){logger[_0xfed1('0x6')](_0x471095,_0x396781?util[_0xfed1('0x5')](_0x396781,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x416d28,_0x38d525){logger[_0xfed1('0x7')](_0x416d28,_0x38d525?util['inspect'](_0x38d525,{'showHidden':![],'depth':null}):'');};exports[_0xfed1('0x8')]=function(_0x5e229a,_0x5d94ce){return client[_0xfed1('0x8')](_0x5e229a,{'body':_0x5d94ce})[_0xfed1('0x9')](function(_0x5864ab){logger['debug'](_0xfed1('0xa'),_0x5e229a,_0x5864ab?util[_0xfed1('0x5')](_0x5864ab,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x56555a){logger['error'](_0xfed1('0xa'),_0x5e229a,_0x56555a?util[_0xfed1('0x5')](_0x56555a,{'showHidden':![],'depth':null}):'');});};function getUser(_0x445d36){return client[_0xfed1('0x8')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0xfed1('0xb'),_0xfed1('0xc'),'interface'],'where':_0x445d36,'limit':0x1}})['then'](function(_0x176227){logger[_0xfed1('0x6')](_0xfed1('0xd'),JSON['stringify'](_0x445d36),_0x176227?util[_0xfed1('0x5')](_0x176227,{'showHidden':![],'depth':null}):'');return _0x176227[_0xfed1('0xe')][_0xfed1('0xf')]?_0x176227[_0xfed1('0xe')][0x0]:null;});}exports['getUserByInternal']=function(_0x31ff97){return new BPromise(function(_0x4c492e,_0x34512d){if(_0x31ff97){return getUser({'internal':_0x31ff97})[_0xfed1('0x9')](function(_0x376474){logger[_0xfed1('0x4')](_0xfed1('0x10'),_0x31ff97,_0x376474?_0xfed1('0x11'):_0xfed1('0x12'));return _0x4c492e(_0x376474);})[_0xfed1('0x13')](function(_0xf0113f){logger['error'](_0xfed1('0x14'),_0xf0113f?util['inspect'](_0xf0113f,{'showHidden':![],'depth':null}):'');return _0x4c492e(null);});}return _0x4c492e(null);});};exports[_0xfed1('0x15')]=function(_0x3e5ada){return new BPromise(function(_0x431e8b,_0x3a159e){if(_0x3e5ada){return getUser({'interface':_0x3e5ada})[_0xfed1('0x9')](function(_0x4610fd){logger[_0xfed1('0x4')](_0xfed1('0x16'),_0x3e5ada,_0x4610fd?'found':'notfound');return _0x431e8b(_0x4610fd);})[_0xfed1('0x13')](function(_0x5c9385){logger[_0xfed1('0x7')](_0xfed1('0x17'),_0x5c9385?util['inspect'](_0x5c9385,{'showHidden':![],'depth':null}):'');return _0x431e8b(null);});}return _0x431e8b(null);});};exports[_0xfed1('0x18')]=function(_0x138656){return new BPromise(function(_0x472dbc,_0x5bce5d){if(_0x138656){return getUser({'name':_0x138656})[_0xfed1('0x9')](function(_0xea7a81){logger['info'](_0xfed1('0x19'),_0x138656,_0xea7a81?_0xfed1('0x11'):_0xfed1('0x12'));return _0x472dbc(_0xea7a81);})['catch'](function(_0x1337d6){logger[_0xfed1('0x7')](_0xfed1('0x1a'),_0x1337d6?util['inspect'](_0x1337d6,{'showHidden':![],'depth':null}):'');return _0x472dbc(null);});}return _0x472dbc(null);});};exports[_0xfed1('0x1b')]=function(_0x46cf02){return new BPromise(function(_0x411182,_0x1867f6){if(_0x46cf02){return client[_0xfed1('0x8')](_0xfed1('0x1c'),{'options':{'raw':!![],'attributes':['id','name',_0xfed1('0x1d'),_0xfed1('0x1e'),'acwTimeout'],'where':{'name':_0x46cf02},'limit':0x1}})[_0xfed1('0x9')](function(_0x3c971d){logger[_0xfed1('0x6')]('[utils][getVoiceQueueByName]\x20name:%s',_0x46cf02,_0x3c971d?util[_0xfed1('0x5')](_0x3c971d,{'showHidden':![],'depth':null}):'');logger[_0xfed1('0x4')](_0xfed1('0x1f'),_0x46cf02,_0x3c971d?_0xfed1('0x11'):'notfound');return _0x411182(_0x3c971d[_0xfed1('0xe')][_0xfed1('0xf')]?_0x3c971d[_0xfed1('0xe')][0x0]:null);})[_0xfed1('0x13')](function(_0x2853ee){logger['error'](_0xfed1('0x20'),_0x2853ee?util[_0xfed1('0x5')](_0x2853ee,{'showHidden':![],'depth':null}):'');return _0x411182(null);});}return _0x411182(null);});};exports[_0xfed1('0x21')]=function(_0x38f385,_0x2b5a05){return moment(_0x38f385)[_0xfed1('0x22')](_0x2b5a05,_0xfed1('0x23'))[_0xfed1('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x4e1e8d,_0x22d942){return moment(_0x4e1e8d)[_0xfed1('0x25')](_0x22d942,'seconds')[_0xfed1('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x5f000b,_0x389946){return moment(_0x5f000b)[_0xfed1('0x26')](moment(_0x389946),_0xfed1('0x23'));};exports['sumTime']=function(_0x4d7e32,_0x2b59f7){return parseInt(_0x4d7e32,0xa)+parseInt(_0x2b59f7,0xa);};exports[_0xfed1('0x27')]=function(){return moment()[_0xfed1('0x24')](_0xfed1('0x28'));};exports[_0xfed1('0x29')]=function(_0x8e024,_0x2ab4f4){if(_0x2ab4f4){return moment(_0x8e024)['isAfter'](_0x2ab4f4);}return!![];};exports[_0xfed1('0x2a')]=function(_0x4d4296,_0x350023){if(_0x350023){return moment(_0x4d4296)[_0xfed1('0x2a')](_0x350023);}else if(_0x4d4296){return!![];}return![];}; \ No newline at end of file